📄 entity.cpp
字号:
//-----------------------------------------------------------------------------
//
// $Logfile:: /Quake 2 Engine/Sin/code/game/entity.cpp $
// $Revision:: 296 $
// $Author:: Jimdose $
// $Date:: 11/18/98 5:22a $
//
// Copyright (C) 1997 by Ritual Entertainment, Inc.
// All rights reserved.
//
// This source is may not be distributed and/or modified without
// expressly written permission by Ritual Entertainment, Inc.
//
// $Log:: /Quake 2 Engine/Sin/code/game/entity.cpp $
//
// 296 11/18/98 5:22a Jimdose
// CheckGround properly checks normal an alternate grav axis
//
// 295 11/18/98 3:03a Jimdose
// made EV_Mutate a cheat
//
// 294 11/18/98 12:22a Jimdose
// fixed fullmins and fullmaxs when gravaxis is non-0 in setSize
//
// 293 11/15/98 11:31p Markd
// make sure all our children are deleted when removing
//
// 292 11/14/98 5:29p Jimdose
// Made BroadcastSound search through the SentientList instead of using
// findradius. This way, fewer entities are checked.
//
// 291 11/13/98 10:20p Aldie
// Fix crash bug in attachevent
//
// 290 11/13/98 1:47a Markd
// Don't set gravaxis if the same as before
//
// 289 11/10/98 8:03p Jimdose
// made setSize and SetGravityAxis change fullmins and fullmaxs appropriately
//
// 288 11/08/98 6:33p Jimdose
// added FLAG_IGNORE to the flag modifaction functions, making sure that
// illegal values don't cause flags to be modified
//
// 287 11/04/98 8:40p Jimdose
// Made it so the Flags event will not screw the flags if the string is not
// recognized.
//
// 286 10/26/98 9:41p Markd
// Fixed gotkill message not passing in gibbed parameter
//
// 285 10/26/98 4:26p Aldie
// Added ghost command for models that are notsolid, and notvisible, but still
// need to get sent over.
//
// 284 10/25/98 4:38a Aldie
// Moved link()
//
// 283 10/25/98 12:01a Markd
// put in censored support
//
// 282 10/24/98 5:43p Markd
// Fixed IfSkillEvent
//
// 281 10/24/98 12:42a Markd
// changed origins to worldorigins where appropriate
//
// 280 10/23/98 11:50p Jimdose
// fixed usagage of model as a temporary variable in AttachModelEvent
//
// 279 10/23/98 5:38a Jimdose
// Added SetMassEvent
//
// 278 10/22/98 4:57p Aldie
// Removed blastscale_z values
//
// 277 10/22/98 1:40a Markd
// Added stealth mode
//
// 276 10/21/98 1:29a Jimdose
// fixed crash bug with binding/unbinding and teams
//
// 275 10/20/98 11:29p Markd
// Revamped Broadcast sound
//
// 274 10/20/98 4:00p Aldie
// Put in teammaster checkwhen unbinding
//
// 273 10/20/98 3:32a Jimdose
// Made setSolidType not error out when loading savegames
// added isBoundTo to test is an entity is affected by another entity via
// binding
// binding is no longer order dependent
//
// 272 10/19/98 8:55p Markd
// Put check in setSolidType
//
// 271 10/19/98 5:29p Aldie
// Zero out total_delta when stop animating is called
//
// 270 10/19/98 12:07a Jimdose
// made all code use fast checks for inheritance (no text lookups when
// possible)
// isSubclassOf no longer requires ::_classinfo()
//
// 269 10/18/98 8:40p Jimdose
// Added GetEntName
// Made setModel check if it's SOLID_BSP when it has no model
//
// 268 10/17/98 11:02p Markd
// Added ifskill
//
// 267 10/17/98 8:11p Jimdose
// Changed Damage to DamgeEvent
//
// 266 10/15/98 3:39p Markd
// added forcefield ability
//
// 265 10/14/98 10:21p Markd
// Added debug code for AnimateFrame
//
// 264 10/13/98 11:13p Markd
// Added hurt and mutate support
//
// 263 10/13/98 5:25p Markd
// Added UseBoundingBoxEvent
//
// 262 10/11/98 8:50p Jimdose
// Added RandomGlobalEntitySound and RandomGlobalEntitySoundEvent
//
// 261 10/10/98 10:37p Markd
// made it so that targetnames with "$" could not be entered
//
// 260 10/10/98 9:13p Markd
// Took out SetAliasPrefix
//
// 259 10/10/98 3:24a Jimdose
// changed team to moveteam
//
// 258 10/09/98 10:18p Jimdose
// made setSize check mins and maxs in the edict instead of the shadow
// variables in Entity to check if it should change the size
//
// 257 10/09/98 8:58p Aldie
// Move air_finished to player
//
// 256 10/09/98 8:02p Jimdose
// made SetModel only post processinitcommands when LoadingSavegame is false
//
// 255 10/08/98 7:40p Aldie
// Added minlight
//
// 254 10/08/98 7:25p Aldie
// minlight, gravity, lightoffset
//
// 253 10/07/98 11:46p Jimdose
// Disabled ProcessInitCommands when loading savegames
// made setModel use str instead of char array
//
// 252 10/06/98 9:59p Aldie
// Added an oxygenator
//
// 251 10/06/98 9:39p Markd
// removed last_origin
//
// 250 10/05/98 11:30p Markd
// Changed sound radius to header
//
// 249 10/04/98 10:28p Aldie
// Added multiple weapon changes. Damage, flashes, quantum stuff
//
// 248 10/03/98 1:09p Aldie
// Added rendereffects flag
//
// 247 10/02/98 10:59p Jimdose
// Added SetEntNum
//
// 246 10/01/98 7:59p Markd
// Made dialog use NO_PHS
//
// 245 9/23/98 11:00p Markd
// put in some garbage collection on stuff that wasn't freed up
//
// 244 9/22/98 5:11p Jimdose
// Changed the radius of most of the sound events
//
// 243 9/22/98 3:21p Markd
// put in parentmode lockout for blood and gibs
//
// 242 9/22/98 2:59p Aldie
// Added effects command
//
// 241 9/20/98 7:11p Aldie
// Added flags to particles
//
// 240 9/20/98 3:45p Markd
// Changed default dialog channel from CHAN_DIALOG to CHAN_DIALOG_SECONDARY
//
// 239 9/17/98 6:19p Jimdose
// Made BroadcastSound use centroid instead of worldorigin for basing it's
// radius and phs checks
//
// 238 9/17/98 10:50a Markd
// fixed gun entity not being shown
//
// 237 9/15/98 6:37p Markd
// Added RotatedBounds flag support
//
// 236 9/12/98 11:27a Markd
// fixed check in Animateframe to go to the next animation
//
// 235 9/11/98 11:25p Markd
// cleared out last_animation_time when stopanimating is called
//
// 234 9/09/98 6:49p Markd
// forgot to check to see if num_frames_in_gun_anim was greater than one
//
// 233 9/09/98 6:45p Markd
// put in world weapon model animations
//
// 232 9/08/98 11:31p Jimdose
// Added AnimEvent
//
// 231 9/08/98 8:11p Markd
// Fixed Animation timing so frames weren't skipped
//
// 230 9/07/98 8:28p Markd
// Added fullradius
//
// 229 8/29/98 9:40p Jimdose
// Added call info to G_Trace
//
// 228 8/29/98 5:27p Markd
// added specialfx, replaced misc with specialfx where appropriate
//
// 227 8/28/98 7:03p Markd
// Fixed Broadcast Sound
//
// 226 8/28/98 4:13p Markd
// Increased VoiceSound radius
//
// 225 8/27/98 9:04p Jimdose
// Moved a lot of small functions to the header as inline
// Made Centroid a variable
//
// 224 8/24/98 6:51p Jimdose
// Added SetGravityAxis
//
// 223 8/22/98 9:36p Jimdose
// Renamed spawn arg
//
// 222 8/22/98 8:55p Jimdose
// Added support for alternate gravity axis
//
// 221 8/21/98 3:48p Markd
// Added new group "all" behavior
//
// 220 8/19/98 8:48p Aldie
// Reduce lag for weapons and fixed assertion
//
// 219 8/18/98 11:08p Markd
// Added new Alias System
//
// 218 8/18/98 11:12a Markd
// Added "skin" event
//
// 217 8/15/98 5:30p Jimdose
// Made RegisterAlias and RegisterAliasAndCache use a str for storing the name
// so we don't have any name length crashes
//
// 216 8/09/98 5:52p Markd
// Attached models are ThrowObjects by default
//
// 215 8/08/98 8:36p Markd
// forgot to return a value in attach function
//
// 214 8/08/98 8:27p Markd
// Added attach and bind check for self binding/attaching
//
// 213 8/08/98 7:50p Jimdose
// changed realWorld to world
//
// 212 8/07/98 4:21p Aldie
// Allow kill from the console.
//
// 211 8/06/98 10:53p Aldie
// Added weapon tweaks and kickback. Also modified blast radius damage and
// rocket jumping.
//
// 210 8/04/98 6:05p Aldie
// Added RF_DETAIL flag and removed some dead code
//
// 209 7/31/98 8:08p Jimdose
// Script commands now include flags to indicate cheats and console commands
//
// 208 7/29/98 2:31p Aldie
// Changed health to a float
//
// 207 7/26/98 1:14a Markd
// rename entityflags to flags because we wern't using entityflags in any def
// files
//
// 206 7/25/98 8:18p Markd
// Fixed animation bug
//
// 205 7/25/98 3:57p Markd
// Added EV_GotKill
//
// 204 7/24/98 6:18p Markd
// changed some CHAN_AUTO's to CHAN_BODY, changed CHAN_VOICE in dialog to
// CHAN_DIALOG
//
// 203 7/24/98 6:17p Aldie
// Dialog checking
//
// 202 7/23/98 6:17p Aldie
// Updated damage system and fixed some damage related bugs. Also put tracers
// back to the way they were, and added gib event to funcscriptmodels
//
// 201 7/22/98 10:41p Aldie
// Fixed tracers
//
// 200 7/21/98 10:42p Markd
// Fixed entity tesselation
//
// 199 7/21/98 10:04p Markd
// Added DIE_EXPLODE stuff to entity flags
//
// 198 7/21/98 9:34p Jimdose
// Added AliasExists and PrefixAliasExists
//
// 197 7/21/98 1:10p Aldie
// Added meansofdeath to obituaries
//
// 196 7/20/98 3:52p Aldie
// Made a ProcessInitCommands which is called from the event.
//
// 195 7/19/98 8:27p Jimdose
// Made setModel cancel any EV_ProcessInitCommands events
//
// 194 7/18/98 11:16p Markd
// Added takedamage and nodamage events
//
// 193 7/18/98 8:05p Markd
// Fixed bug with attached models
//
// 192 7/18/98 4:05p Markd
// Added movetype events to attach, detach and attachmodel
//
// 191 7/18/98 3:52p Markd
// Added attach, detach and attach model commands
//
// 190 7/17/98 3:50p Markd
// Added HasAnim method
//
// 189 7/15/98 11:22p Markd
// Added ProcessInitCommands when setting model
//
// 188 7/14/98 11:35p Markd
// Added PHSSound and RandomPHSSound
//
// 187 7/14/98 4:35p Markd
// fixed animation bug
//
// 186 7/14/98 3:53p Markd
// Added proper frame 0 animation if immediately animating when calling
// RandomAnimate
//
// 185 7/13/98 4:59p Aldie
// Added dead player bodies with gibbing
//
// 184 7/11/98 2:48p Markd
// Added dialog event
//
// 183 7/11/98 2:25p Markd
// Removed dialog event
//
// 182 7/10/98 11:11p Markd
// Added DialogEvent
//
// 181 7/09/98 11:52p Markd
// fixed greater than 10FPS support
//
// 180 7/09/98 9:37p Jimdose
// Added getParentVector, since some calls to getLocalVector needed the
// transform in terms of the parent, and some to the local vector. phew...
// hope that's that! :)
//
// 179 7/09/98 12:55a Markd
// put in arbitrary frames per second support for models
//
// 178 7/09/98 12:41a Markd
// Added support for greater than 10FPS
//
// 177 7/09/98 12:18a Jimdose
// As soon as I checked in the file, I realized that getLocalVector was only
// incorrect in returning the vector untouched when it didn't have a
// bindmaster. getLocalVector is independent of binding, so I fixed that and
// returned the bind call to getLocalVector to its original (correct) state.
// For binding, either way is correct, but getLocalVector is used in the
// physics for calculating a delta move in the coordinate system of the object,
// so this is more correct.
//
// 176 7/09/98 12:11a Jimdose
// fixed getLocalVector to do the dot products agains the bindmaster's
// orientation instead of the object's. This fixes a bug with binding to
// objects that are oriented.
//
// 175 7/08/98 12:55p Jimdose
// Added classname event to clear up warnings when loading def files
//
// 174 7/03/98 12:00p Aldie
// Fixed random animate to post endevent frametime in the future if anim not
// found
//
// 173 6/27/98 2:17p Aldie
// Updated CanDamage
//
// 172 6/25/98 4:58p Markd
// Fixed tesselation bug
//
// 171 6/24/98 12:39p Markd
// Added default tesselation percentage
//
// 170 6/20/98 7:49p Markd
// Added location to Killed and Pain events
//
// 169 6/20/98 3:42p Markd
// Changed default damage tesselation
//
// 168 6/19/98 7:24p Markd
// took out initialization of groups by setModel
//
// 167 6/19/98 4:45p Jimdose
// Added Centroid, DistanceTo, and WithinDistance
//
// 166 6/19/98 10:56a Markd
// re-ordered tesselation event
//
// 165 6/18/98 8:46p Jimdose
// Added better event error handling
// Added source info to events
//
// 164 6/18/98 6:14p Markd
// forgot to remove a warning
//
// 163 6/18/98 2:00p Markd
// rewrote tesselation code
//
// 162 6/17/98 7:34p Markd
// Fixed weird bug when world has targetname set!
//
// 161 6/17/98 6:16p Markd
// Fixed broadcast sound NumArgs bug
//
// 160 6/17/98 3:03p Markd
// Changed NumArgs back to previous behavior
//
// 159 6/15/98 8:04p Markd
// put in Group_Flags support
//
// 158 6/13/98 7:32p Markd
// put in default tesselation of 10 thick
//
// 157 6/10/98 7:53p Markd
// Made NumArgs behave correctly like argc
//
// 156 6/10/98 2:10p Aldie
// Updated damage function.
//
// 155 6/09/98 6:41p Markd
// made static sounds default to ATTN_IDLE instead of ATTN_STATIC
//
// 154 6/09/98 4:40p Markd
// Added additonal environment mapped effect
//
// 153 6/08/98 8:20p Markd
// When RandomAnimate fails, the animdone event is still posted
//
// 152 6/08/98 7:21p Aldie
// Fixed group command parsing
//
// 151 6/08/98 5:18p Markd
// made group events use '+' and '-' behavior
//
// 150 6/08/98 5:17p Aldie
// Moved defines to qshared.
//
// 149 6/08/98 4:58p Markd
// Added GroupModelEvent for model dynamic modifications
//
// 148 6/08/98 2:37p Markd
// changed some static sound stuff
//
// 147 6/08/98 1:54p Jimdose
// Made sure that animdoneevent was freed if the animation was stopped or
// changed
//
// 146 6/05/98 6:23p Aldie
// Added a location string to Damage
//
// 145 6/04/98 4:36p Markd
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -