📄 entity.cpp
字号:
// made all script sounds not use PHS so that sounds would be sent over no
// matter what
//
// 144 5/27/98 8:35p Markd
// decreased health quotient
//
// 143 5/27/98 7:34p Markd
// reduce damage on player by 50%
//
// 142 5/27/98 4:55p Markd
// Added Inflictor message to Killed
//
// 141 5/26/98 10:54p Markd
// Made sound flags SOUND_SYNCH default
//
// 140 5/26/98 9:40p Markd
// Made damage appear instantly
//
// 139 5/26/98 9:25p Aldie
// Added kill event
//
// 138 5/26/98 8:45p Markd
// Initilialize number of groups for model
//
// 137 5/26/98 4:22p Markd
// Added Target registration stuff
//
// 136 5/26/98 1:29a Markd
// fixed rotated bounding boxes
//
// 135 5/25/98 12:22p Aldie
// Inited waterlevel and watertype
//
// 134 5/25/98 8:50p Markd
// Increased damage momentum for E3
//
// 133 5/25/98 7:59p Markd
// Added RandomPositionedSound
//
// 132 5/25/98 6:46p Jimdose
// Made animateframe, prethink and posthink into functions built into the base
// entity class
//
// 131 5/25/98 4:43p Markd
// Added SpawnParticles to entity
//
// 130 5/24/98 8:55p Jimdose
// Changed classname to a const char *
//
// 129 5/24/98 8:46p Jimdose
// Made a lot of functions more str-friendly.
// Got rid of a lot of char * based strings
// Cleaned up get spawn arg functions and sound functions
// sound functions now use consistant syntax
//
// 128 5/24/98 4:48p Jimdose
// Made char *'s const
//
// 127 5/24/98 2:47p Markd
// Made char *'s into const char *'s
//
// 126 5/24/98 1:06a Jimdose
// Added sound events for ai
//
// 125 5/23/98 6:47p Aldie
// Fixed FADE_OUT
//
// 124 5/20/98 1:42p Markd
// Added proper stopsound behavior
//
// 123 5/20/98 11:11a Markd
// removed char * dependency
//
// 122 5/15/98 6:46p Markd
// patched FLAGS command, also set max_health
//
// 121 5/13/98 4:44p Jimdose
// Changed remove time in FadeOut
// Damage checks if inflictor or attacker are NULL.
//
// 120 5/11/98 5:53p Markd
// Added aliascache command
//
// 119 5/11/98 2:19p Markd
// Fixed randomsound stuff
//
// 118 5/09/98 7:11p Markd
// Removed sound parameter from tesselate command
//
// 117 5/08/98 7:00p Markd
// Added FL_DARKEN Support
//
// 116 5/08/98 2:55p Markd
// Put in an additional randomsound method
//
// 115 5/07/98 11:32p Markd
// Removed footstep event and command
//
// 114 5/06/98 11:22a Markd
// Fixed up some sound stuff
//
// 113 5/04/98 8:31p Markd
// Removed cachemodel and cachesound
//
// 112 5/03/98 8:09p Markd
// Fixed calculate bounds bug in creator and also added precaching to
// modelindex and soundindex
//
// 111 5/03/98 7:13p Markd
// Added precache to alias event
//
// 110 5/03/98 4:31p Jimdose
// Changed Vector class. No longer includes PointsTo
//
// 109 5/03/98 2:41p Jimdose
// no change
//
// 107 5/02/98 8:41p Markd
// Added cachemodel and cachesound and also entityflags events
//
// 106 5/02/98 12:49a Jimdose
// added scale event
//
// 105 5/01/98 8:32p Markd
// Added some precache comments
//
// 104 5/01/98 8:17p Jimdose
// Init groundsurface to NULL
//
// 103 5/01/98 7:39p Markd
// changed entsound and related functions to ambientsound etc.
//
// 102 5/01/98 7:32p Jimdose
// Added groundplane, groundsurface, groundcontents
//
// 101 5/01/98 5:02p Markd
// temporarily commented out setting of children in setorigin
//
// 100 5/01/98 11:09a Markd
// Added sound to tesselation event
//
// 99 4/29/98 10:44p Markd
// Added positioned_sound and random_sound with more parameters
//
// 98 4/29/98 5:55p Jimdose
// Added "bind" spawn key to allow binding without using scripts
//
// 97 4/16/98 1:59p Jimdose
// Added EndAnimEvent and PrevFrameEvent
//
// 96 4/14/98 6:55p Markd
// Moved SetModel in Entity Constructor, added thickness to tesselation
// parameter
//
// 95 4/14/98 5:25p Markd
// Fixed setsize support
//
// 94 4/10/98 4:55p Jimdose
// fixed bug in tesselate
// damage no longer affects people in noclip mode
//
// 93 4/10/98 1:22a Markd
// Added FL_TESSELATE damage func
//
// 92 4/10/98 12:34a Jimdose
// RandomSound now uses CHAN_BODY
// Got rid of damage_inflictor
//
// 91 4/09/98 8:45p Jimdose
// Made channel non-specific sound functions use CHAN_AUTO instead of
// CHAN_VOICE
//
// 90 4/09/98 1:40p Markd
// Added a NextAnim(0) which I accidentally took out before, needed for single
// animation stuff
//
// 89 4/08/98 6:03p Jimdose
// Changed momentum from damage
//
// 88 4/07/98 8:00p Markd
// removed defhandle, changed all SINMDL calls to modelindex calls, removed
// SINMDL prefix
//
// 87 4/07/98 5:40p Jimdose
// Made animdone events be posted 0 time in future instead of FRAMETIME / 2
//
// 86 4/06/98 8:25p Markd
// Can't use centroid fix with B-models, only A-models
//
// 85 4/06/98 7:21p Markd
// Fixed PVS tesselation bug, fixed it by sending over centroid instead.
//
// 84 4/06/98 6:40p Jimdose
// BecomeSolid and BecomeNonSolid no longer change the movetype
// BecomeSolid now handles a-model and b-model entities
//
// 83 4/06/98 5:44p Jimdose
// Moved the "angles" stuff to Object and Sentient
//
// 82 4/06/98 12:02a Markd
// Grabbed a float as an integer instead
//
// 81 4/05/98 10:42p Markd
// Added Tesselate Event
//
// 80 4/05/98 10:17p Jimdose
// added lastorigin
//
// 79 4/05/98 9:41p Markd
// Added "angles" and "angle" support
//
// 78 4/05/98 7:19p Aldie
// Added dynamic lights.
//
// 77 4/05/98 1:55a Jimdose
// Added SetModelEvent
//
// 76 4/04/98 7:51p Jimdose
// Oops! trace->surface->surfaceinfo is NULL if it's an a-model! :)
//
// 75 4/04/98 7:29p Jimdose
// Added HitSky that takes a generic trace
//
// 74 4/04/98 6:03p Jimdose
// Added HitSky and RandomSound
//
// 73 4/02/98 4:51p Jimdose
// Added animation control events
// Made RandomSound default volume to 1
// Made droptofloor accept the max distance to fall
//
// 72 3/31/98 5:40p Markd
// Added StartAnimatingEvent
//
// 71 3/31/98 4:21p Jimdose
// Fixed angle mod
//
// 70 3/31/98 3:03p Markd
// Fixed CalculateBounds and set proper solidtype for models
//
// 69 3/31/98 2:26p Jimdose
// Got rid of some unneeded R_ConcatRotations
//
// 68 3/31/98 2:04p Jimdose
// Fixed binding bug
//
// 67 3/30/98 11:39p Markd
// Added modelIndex function
//
// 66 3/30/98 11:20p Markd
// Added scale support to entity
//
// 65 3/30/98 11:17p Markd
// Added sound and random sound support
//
// 64 3/30/98 9:14p Markd
// Fixed attenuation of footstep sounds
//
// 63 3/30/98 9:54p Jimdose
// Setmodel now prepends "models/" to model names.
//
// 62 3/30/98 7:30p Markd
// Added FootStep method
//
// 61 3/30/98 3:09p Jimdose
// made total_delta based on the entity's scale
//
// 60 3/29/98 9:01p Markd
// Added Frame events and Init Events
//
// 59 3/29/98 9:38p Jimdose
// Changed Killed and Pain to events
// Added damage event
// last_frame_in_anim wasn't being initialized when the entity was allocated
//
// 58 3/27/98 7:01p Markd
// Added vieworigin and viewangle
//
// 57 3/26/98 8:24p Jimdose
// Added GetBone (not working yet)
// Changed groundentity to an edict_t *
//
// 56 3/25/98 7:13p Markd
// Added detach to free event and made sure that parents exist when detaching
//
// 55 3/25/98 3:24p Markd
// Added attach, detach, model binding variables and modified setorigin
//
// 54 3/24/98 4:54p Jimdose
// Changed usage of GetToken to GetString so that script variables can be used
//
// 53 3/23/98 1:31p Jimdose
// Revamped event and command system
//
// 52 3/18/98 7:49p Jimdose
// Updated sound for new sound system
//
// 51 3/18/98 7:19p Jimdose
// Added RandomAnimate
// Tweaked animation code
//
// 50 3/11/98 6:51p Aldie
// Added alpha to the render state for an entity.
//
// 49 3/11/98 11:32a Markd
// Added total_delta variable
//
// 48 3/09/98 2:57p Aldie
// Fixed some alpha calculations in entity.
//
// 47 3/09/98 2:49p Jimdose
// Working on euler-quat stuff
//
// 46 3/07/98 2:04p Markd
// Got animation system up and running (no pun intended)
//
// 45 3/05/98 2:49p Jimdose
// Made playsound command work again.
//
// 44 3/02/98 8:49p Jimdose
// Changed the classid parameter of CLASS_DECLARATION to a quoted string so
// that you could have a NULL classid.
//
// 43 3/02/98 5:51p Jimdose
// Added entname to edict_t.
// Copy classname into entname
// No longer set default targetname to edict#
//
// 42 2/18/98 8:08p Jimdose
// Changed calls to getEntityFromScript to GetObject calls
//
// 41 2/17/98 6:58p Jimdose
// Gave entities a default target name.
// no longer pass script into interpretCommand
//
// 40 2/16/98 2:33p Jimdose
// Fixed bug in bind where an uninitialized pointer was referenced.
//
// 39 2/16/98 1:58p Jimdose
// Added object teams
// Added true hierarchial binding
// Fixed bug with spawning using specific edicts.
//
// 38 2/06/98 5:47p Jimdose
// Added link and unlink
// Removed touch and think functions
// Removed Spawn (all spawning done in constructor)
// Added client pointer
// No longer initialize mins and maxs to '0 0 0' since it screws up bmodels.
//
// 37 2/03/98 10:57a Jimdose
// Updated to work with Quake 2 engine
// Moved initialization to constructor and removed Init function
//
// 35 12/15/97 11:56a Markd
// zeroed out velocity in "notsolid"
//
// 34 12/15/97 1:34a Jimdose
// Decreased the momentum added from damage
//
// 33 12/13/97 5:42p Markd
// Made it so that ProcessNoteCommands no longer uses a static Script variable
//
// 32 12/12/97 7:19p Markd
// Fixed model spawning stuff for decals and *models
//
// 31 12/12/97 4:27p Markd
// Added "soundprefix"
//
// 30 12/12/97 2:10p Markd
// Only calls animcallback if animate is still true
//
// 29 12/12/97 1:19p Markd
// Moved model setArg to before setModel
//
// 28 12/12/97 1:00p Jimdose
// Added warning to AnimateThink when no animation is set
//
// 27 12/11/97 7:41p Markd
// moved note processing into setmodel
//
// 26 12/11/97 3:34p Markd
// Fixed SetArg for "model", set "model" to "" when it was processed
// checked for global_loading in registersound
//
// 25 12/08/97 4:28p Aldie
// Changed FadeOut factors so that the blood splats look ok.
//
// 24 12/06/97 4:54p Markd
// Added default spawing behavior
// Added alpha, target, targetname, spawnflags, model, origin, angle, angles to
// interpretCommand
//
// 23 12/05/97 3:03p Jimdose
// Now responds to EVENT_REMOVE.
// Made it so that if "model" is set when spawned then it precaches that model.
//
// 22 12/03/97 6:40p Markd
// changed how alias stuff works for sounds
//
// 21 11/24/97 6:54p Markd
// Added Register Sound and Random Sound, added Setsize
//
// 20 11/18/97 5:30p Markd
// Added weighting in RandomAnimate, also commented out warnings in
// InterpretCommands (they were debug messages)
//
// 19 11/17/97 5:45p Markd
// Added $owner command to ProcessFrameNotes routine
//
// 18 11/15/97 6:53p Markd
// Added ProcessNoteCommands, Added RandomAnimate, added animloop_ variables
// for animation loop processing
//
// 17 11/15/97 2:48p Jimdose
// Added ProcessEvent call which calls System->ProcessEvent
//
// 16 11/14/97 4:44p Jimdose
// Added PostEvent
//
// 15 10/30/97 7:42p Jimdose
// In Damage, now only add momentum if not a bsp model
//
// 14 10/29/97 4:19p Jimdose
// Added FadeOut.
//
// 13 10/28/97 4:13p Jimdose
// Added interpretCommand to make Entity be controllable by scripts via
// ScriptMaster.
//
// 12 10/27/97 3:30p Jimdose
// Removed dependency on quakedef.h
//
// 11 10/08/97 8:52p Jimdose
// Added EVENT_USE to Event()
//
// 10 10/08/97 6:03p Jimdose
// Began vehicle support.
//
// 9 10/01/97 10:27a Markd
// forgot to put break statement next to zero time animation
//
// 8 10/01/97 10:23a Markd
// Fixed Animate bug, some animations had ZERO length animation times, still
// investigating that problem
//
// 7 9/30/97 9:59p Markd
// Fixed AnimTime stuff
//
// 6 9/30/97 5:55p Jimdose
// Damaged entities now get velocity from inflictor
//
// 5 9/30/97 2:39p Markd
// Fixed Animate stuff
//
// 4 9/29/97 6:18p Markd
// working on animate
//
// 3 9/26/97 6:13p Jimdose
// Added standard Ritual headers
//
// DESCRIPTION:
// Base class for all enities that are controlled by Sin. If you have any
// object that should be called on a periodic basis and it is not an entity,
// then you have to have an dummy entity that calls it.
//
// An entity in Sin is any object that is not part of the world. Any non-world
// object that is visible in Sin is an entity, although it is not required that
// all entities be visible to the player. Some objects are basically just virtual
// constructs that act as an instigator of certain actions, for example, some
// triggers are invisible and cannot be touched, but when activated by other
// objects can cause things to happen.
//
// All entities are capable of receiving messages from Sin or from other entities.
// Messages received by an entity may be ignored, passed on to their superclass,
// or acted upon by the entity itself. The programmer must decide on the proper
// action for the entity to take to any message. There will be many messages
// that are completely irrelevant to an entity and should be ignored. Some messages
// may require certain states to exist and if they are received by an entity when
// it these states don't exist may indicate a logic error on the part of the
// programmer or map designer and should be reported as warnings (if the problem is
// not severe enough for the game to be halted) or as errors (if the problem should
// not be ignored at any cost).
//
#include "entity.h"
#include "worldspawn.h"
#include "scriptmaster.h"
#include "sentient.h"
#include "misc.h"
#include "specialfx.h"
#include "object.h"
#include "player.h"
CLASS_DECLARATION( Listener, Entity, NULL );
// Player events
Event EV_ClientConnect( "client_connect" );
Event EV_ClientDisconnect( "client_disconnect" );
Event EV_ClientKill( "client_kill" );
Event EV_ClientMove( "client_move" );
Event EV_ClientEndFrame( "client_endframe" );
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -