📄 entity.h
字号:
//-----------------------------------------------------------------------------
//
// $Logfile:: /Quake 2 Engine/Sin/code/game/entity.h $
// $Revision:: 157 $
// $Author:: Markd $
// $Date:: 11/15/98 11:33p $
//
// 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.h $
//
// 157 11/15/98 11:33p Markd
// added fat projectile flag
//
// 156 11/13/98 2:35a Aldie
// Added mutant drain MOD
//
// 155 11/08/98 10:50p Jimdose
// changed how archive wrote groundentity entity number
//
// 154 10/27/98 3:51a Jimdose
// added FL_NOION
//
// 153 10/26/98 4:30p Aldie
// Added Ghost command
//
// 152 10/25/98 11:53p Jimdose
// added EXPORT_TEMPLATE
//
// 151 10/25/98 4:37a Aldie
// Moved link()
//
// 150 10/25/98 12:01a Markd
// put in censored support
//
// 149 10/24/98 7:15p Jimdose
// archive wasn't saving orientation
//
// 148 10/23/98 5:39a Jimdose
// Added SetMassEvent
//
// 147 10/22/98 1:40a Markd
// Added stealth mode
//
// 146 10/20/98 11:30p Markd
// Increased ranges on BroadcastSounds
//
// 145 10/20/98 3:30a Jimdose
// Added isBoundTo
//
// 144 10/20/98 12:44a Markd
// Made setSize virtual
//
// 143 10/18/98 8:44p Jimdose
// Added GetEntName
//
// 142 10/17/98 11:02p Markd
// Added ifskill
//
// 141 10/17/98 8:11p Jimdose
// Changed Damage to DamgeEvent
//
// 140 10/16/98 1:42a Jimdose
// Added FL_DONTSAVE
//
// 139 10/15/98 3:39p Markd
// Added FL_FORCEFIELD
//
// 138 10/13/98 11:14p Markd
// Added hurt and mutate events
//
// 137 10/13/98 5:25p Markd
// Added UseBoundingBoxEvent
//
// 136 10/11/98 8:50p Jimdose
// Added RandomGlobalEntitySound and RandomGlobalEntitySoundEvent
//
// 135 10/11/98 7:41p Aldie
// Mutate and restore commands for Richard
//
// 134 10/11/98 5:34p Aldie
// Added MOD_MUTANTHANDS
//
// 133 10/10/98 9:13p Markd
// Took out SetAliasPrefix
//
// 132 10/10/98 9:13p Aldie
// Added SPIDERSPLASH
//
// 131 10/10/98 3:35a Jimdose
// changed team to moveteam
//
// 130 10/10/98 1:32a Jimdose
// moved edict archiving out of entity archive functions
// no longer call SetOrigin during unarchiving since it needs parent and
// bindmaster pointers. Instead, edicts are now fully unarchived.
//
// 129 10/09/98 8:59p Aldie
// Moved air_finished to player
//
// 128 10/09/98 4:33p Aldie
// Add MOD_FRIENDLY_FIRE
//
// 127 10/08/98 7:39p Aldie
// Added lightoffset
//
// 126 10/08/98 7:25p Aldie
// minlight, gravity, lightoffset
//
// 125 10/07/98 11:45p Jimdose
// Added DistanceTo and WithinDistance for vectors
// Added SetDeltaAngles
//
// 124 10/06/98 10:50p Aldie
// Created an oxygenator
//
// 123 10/06/98 9:39p Markd
// removed last_origin
//
// 122 10/05/98 11:23p Markd
// Moved all SOUND_RADIUSES to header
//
// 121 10/05/98 10:37p Aldie
// Added FL_SILENCER
//
// 120 10/04/98 10:28p Aldie
// Added multiple weapon changes. Damage, flashes, quantum stuff
//
// 119 10/03/98 1:12p Aldie
// Added new pulse effects
//
// 118 10/02/98 11:27p Jimdose
// Added SetEntNum
//
// 117 9/28/98 9:12p Markd
// Put in archive and unarchive functions
//
// 116 9/28/98 4:07p Aldie
// Added oxygen powerup
//
// 115 9/26/98 4:46p Aldie
// Added mutant mode
//
// 114 9/23/98 10:07p Aldie
// Added ION_DESTRUCT to MOD
//
// 113 9/22/98 2:59p Aldie
// Added effects command
//
// 112 9/15/98 6:37p Markd
// Added RotatedBounds flag support
//
// 111 9/13/98 4:35p Aldie
// Changed MOD_LASERBEAM to MOD_LASER
//
// 110 9/12/98 11:11p Aldie
// Added some more MOD
//
// 109 9/11/98 4:24p Aldie
// Added a couple more means of death
//
// 108 9/09/98 6:45p Markd
// put in world weapon model animations
//
// 107 9/08/98 11:30p Jimdose
// Added AnimEvent
//
// 106 9/02/98 11:08a Markd
// Put in setModel into Sentient so that weapon could be properly detached and
// re-attached again.
//
// 105 8/31/98 7:45p Aldie
// Updated surface data structure and removed surfinfo field
//
// 104 8/31/98 5:45p Aldie
// Added FL_CLOAK
//
// 103 8/29/98 9:49p Jimdose
// moved #defines and enum defines from g_local.h
//
// 102 8/28/98 3:46p Markd
// Added centroid to edict_s
//
// 101 8/27/98 9:04p Jimdose
// Moved a lot of small functions to the header as inline
// Made Centroid a variable
//
// 100 8/24/98 6:50p Jimdose
// Added SetGravityAxis
//
// 99 8/22/98 8:55p Jimdose
// Added support for alternate gravity axis
//
// 98 8/18/98 11:08p Markd
// Added new Alias System
//
// 97 8/18/98 11:12a Markd
// Added "skin" event
//
// 96 8/08/98 8:18p Markd
// Made max_health a float
//
// 95 8/08/98 7:51p Jimdose
// Made definition of world into include of worldspawn.h
//
// 94 7/31/98 8:10p Jimdose
// Script commands now include flags to indicate cheats and console commands
//
// 93 7/29/98 2:32p Aldie
// Changed health to a float
//
// 92 7/25/98 3:58p Markd
// Added EV_GotKill
//
// 91 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
//
// 90 7/21/98 9:34p Jimdose
// Added AliasExists and PrefixAliasExists
//
// 89 7/21/98 1:10p Aldie
// Added meansofdeath to obituaries
//
// 88 7/20/98 5:08p Aldie
// Added explicit processinitcommands
//
// 87 7/18/98 11:15p Markd
// Added takedamage and nodamage
//
// 86 7/18/98 4:02p Markd
// Added attach, detach, attachmodel events
//
// 85 7/17/98 4:04p Markd
// Added HasAnim to entity.cpp
//
// 84 7/15/98 11:23p Markd
// Added processinitcommands stuff
//
// 83 7/14/98 11:35p Markd
// Added PHSSound and RandomPHSSound
//
// 82 7/14/98 3:54p Markd
// Added last_animation_time
//
// 81 7/13/98 5:01p Aldie
// Added dead player bodies with gibbing
//
// 80 7/11/98 2:49p Markd
// Added dialog event
//
// 79 7/11/98 2:25p Markd
// removed dialog event
//
// 78 7/10/98 11:11p Markd
// Added dialog event
//
// 77 7/09/98 9:35p Jimdose
// Added getParentVector
//
// 76 7/08/98 12:58p Jimdose
// Added classname event
//
// 75 6/24/98 12:23p Markd
// Added shatter_percentage
//
// 74 6/19/98 4:45p Jimdose
// Added Centroid, DistanceTo, and WithinDistance
//
// 73 6/19/98 10:56a Markd
// re-ordered tesselation event
//
// 72 6/18/98 2:00p Markd
// rewrote tesselation code
//
// 71 6/10/98 5:10p Markd
// Added ExpandAlias
//
// 70 6/10/98 2:10p Aldie
// Updated damage function.
//
// 69 6/08/98 4:58p Markd
// Added GroupModelEvent
//
// 68 6/05/98 6:27p Aldie
// Added location to Damage function.
//
// 67 5/26/98 10:53p Markd
// made sounds be SOUND_SYNCH by default
//
// 66 5/26/98 9:39p Markd
// removed damage regions
//
// 65 5/26/98 9:25p Aldie
// Added kill event
//
// 64 5/26/98 8:44p Markd
// Added damage_regions and DamageSkin Method
//
// 63 5/25/98 12:22p Aldie
// Inited waterlevel and water type
//
// 62 5/25/98 7:58p Markd
// Added RandomPositionedSound
//
// 61 5/25/98 6:47p Jimdose
// Made animateframe, prethink and posthink into functions built into the base
// entity class
//
// 60 5/25/98 4:43p Markd
// Added SpawnParticles
//
// 59 5/24/98 9:01p Jimdose
// Changed classname to a const char *
//
// 58 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
//
// 57 5/24/98 1:05a Jimdose
// Added sound events for ai
//
// 56 5/20/98 11:12a Markd
// removed char * dependency
//
// 55 5/14/98 10:20p Jimdose
// world is now an EntityPtr
//
// 54 5/13/98 4:54p Jimdose
// now uses SafePtrs
//
// 53 5/11/98 8:07p Jimdose
// Added EntityPtr
//
// 52 5/11/98 5:53p Markd
// Added aliascache command
//
// 51 5/11/98 2:19p Markd
// Fixed randomsound stuff
//
// 50 5/08/98 2:57p Markd
// Added another RandomSound method
//
// 49 5/07/98 11:32p Markd
// Removed footstep command and event
//
// 48 5/04/98 8:32p Markd
// Removed cachemodel and cachesound
//
// 47 5/03/98 4:37p Jimdose
// removed oldorigin
//
// 46 5/02/98 8:45p Markd
// Added CacheModel, CacheSound and entityflags events
//
// 45 5/02/98 12:49a Jimdose
// added scale event
//
// 44 5/01/98 7:32p Jimdose
// Added groundplane, groundsurface, groundcontents
//
// 43 4/29/98 10:46p Markd
// added positioned_sound and random_sound
//
// 42 4/16/98 1:56p Jimdose
// Added EndAnimEvent and PrevAnimEvent
//
// 41 4/10/98 12:34a Jimdose
// got rid of damage_inflictor
//
// 40 4/09/98 3:30p Jimdose
// sound and stopsound are now virtual
//
// 39 4/07/98 8:00p Markd
//
// 38 4/05/98 10:43p Markd
// Added Tesselate
//
// 37 4/05/98 10:17p Jimdose
// added lastorigin
//
// 36 4/05/98 7:20p Aldie
// Added dyamic lights
//
// 35 4/05/98 1:59a Jimdose
// Added setmodelevent
//
// 34 4/04/98 7:28p Jimdose
// added HitSky for generic trace
//
// 33 4/04/98 6:14p Jimdose
// Added HitSky and RandomSound
//
// 32 4/02/98 4:52p Jimdose
// Added parameter to droptofloor
// Added animation control events
//
// 31 3/31/98 5:40p Markd
// Added StartAnimatingEvent
//
// 30 3/30/98 11:39p Markd
// Added modelIndex function
//
// 29 3/30/98 11:21p Markd
// Added setScale
//
// 28 3/30/98 11:16p Markd
// Added sound and random sound support
//
// 27 3/30/98 7:29p Markd
// Added Footstep method
//
// 26 3/29/98 9:38p Jimdose
// Changed Killed and Pain to events
// Added damage event
//
// 25 3/27/98 7:01p Markd
// Added vieworigin and viewangles
//
// 24 3/26/98 8:10p Jimdose
// Changed groundentity to an edict_t *
// Added GetBone
//
// 23 3/25/98 3:24p Markd
// Added model binding variables
//
// 22 3/23/98 1:33p Jimdose
// Revamped event and command system
//
// 21 3/18/98 7:19p Jimdose
// Added RandomAnimate
// Added animDoneEvent
//
// 20 3/11/98 11:30a Markd
// Added movement variable totaldelta
//
// 19 3/07/98 2:05p Markd
// Added stuff for Animation system
//
// 18 3/02/98 8:49p Jimdose
// Changed CLASS_PROTOTYPE to only take the classname
//
// 17 2/17/98 6:59p Jimdose
// no longer pass script into interpretCommand
//
// 16 2/16/98 2:05p Jimdose
// Added hierarchial object binding.
// Added joinTeam and quitTeam for object teams
// Added getLocalVector to aid in translating into the object's local
// coordinate system.
// Added orientation rotation matrix that is calculated each time setAngles is
// called, allowing us to get rid of a lot of calls to AngleVectors.
//
// 15 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.
//
// 14 2/03/98 10:57a Jimdose
// Updated to work with Quake 2 engine
// Moved initialization to constructor and removed Init function
//
// 12 12/12/97 4:27p Markd
// Added "soundprefix"
//
// 11 11/24/97 6:54p Markd
// Added Register Sound and Random Sound
//
// 10 11/15/97 6:53p Markd
// added ProcessNoteCommands, added RandomAnimate, added animloop_count and
// animloop_anim variables for animation loop tracking
//
// 9 11/15/97 2:48p Jimdose
// Added ProcessEvent member function
//
// 8 11/14/97 4:44p Jimdose
// Added PostEvent
//
// 7 11/12/97 5:13p Jimdose
// Created event definitions
//
// 6 10/29/97 4:18p Jimdose
// Added FadeOut.
//
// 5 10/28/97 4:13p Jimdose
// Added interpretCommand to make Entity be controllable by scripts via
// ScriptMaster.
//
// 4 9/29/97 6:18p Markd
// working on animate
//
// 3 9/26/97 6:14p 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).
//
#ifndef __ENTITY_H__
#define __ENTITY_H__
#include "g_local.h"
#include "class.h"
#include "vector.h"
#include "script.h"
#include "listener.h"
typedef enum
{
DAMAGE_NO,
DAMAGE_YES, // will take damage if hit
DAMAGE_AIM // auto targeting recognizes this
} damage_t;
//deadflag
#define DEAD_NO 0
#define DEAD_DYING 1
#define DEAD_DEAD 2
#define DEAD_RESPAWNABLE 3
// flags
#define FL_FLY 0x00000001
#define FL_SWIM 0x00000002 // implied immunity to drowining
#define FL_INWATER 0x00000004
#define FL_GODMODE 0x00000008
#define FL_NOTARGET 0x00000010
#define FL_PARTIALGROUND 0x00000020 // not all corners are valid
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -