⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 actor.cpp

📁 this keik game source
💻 CPP
📖 第 1 页 / 共 5 页
字号:
//-----------------------------------------------------------------------------
//
//  $Logfile:: /Quake 2 Engine/Sin/code/game/actor.cpp                        $
// $Revision:: 233                                                            $
//   $Author:: Markd                                                          $
//     $Date:: 2/08/99 5:12p                                                  $
//
// Copyright (C) 1998 by Ritual Entertainment, Inc.
// All rights reserved.
//
// This source may not be distributed and/or modified without
// expressly written permission by Ritual Entertainment, Inc.
//
// $Log:: /Quake 2 Engine/Sin/code/game/actor.cpp                             $
// 
// 233   2/08/99 5:12p Markd
// fixed 2015 actor problem
// 
// 232   1/29/99 6:14p Jimdose
// added 2015 changes
// 
// 231   1/27/99 10:02p Markd
// Merged 2015 source into main code base
// 
// 230   11/16/98 8:50p Markd
// increased chat times
// 
// 229   11/16/98 7:28p Markd
// bullet proofed TargetEnemies so that dead bodies only spoke their secret
// once and then cleared who they were upset at, much like a soul being
// released from a dead body ;)
// 
// 228   11/15/98 7:58p Jimdose
// Actors now exclusively use flags for movement types
// Made eyeposition max out at maxs.z
// Swim monsters will no longer leave water
// Air monsters will no longer enter water
// 
// 227   11/15/98 2:58a Markd
// scale pain threshold by skill a bit less than what it is right now
// 
// 226   11/15/98 1:24a Jimdose
// monsters don't play snd_sightenemy now unless DoAction( "sightenemy" )
// succeeds.
// 
// 225   11/14/98 6:41p Jimdose
// guys no longer drown in moving water after the water has moved
// 
// 224   11/13/98 11:55p Markd
// bodyimpact sound to goryimpact sound
// 
// 223   11/13/98 11:00p Jimdose
// Took EV_CONSOLE off of fov
// 
// 222   11/13/98 10:02p Jimdose
// bodies no longer float when they die in water
// guys will allow themselves to fall when they are standing on other setients
// 
// 221   11/13/98 4:04p Markd
// increased min melee range
// 
// 220   11/12/98 11:30p Jimdose
// Increased melee kick
// 
// 219   11/10/98 5:47p Jimdose
// Made CanSee non-inline because it caused link problems
// 
// 218   11/09/98 6:23p Markd
// Added turnspeed event
// 
// 217   11/08/98 7:06p Markd
// Put in nochatter, made mutants not Like each other, added seenEnemy to
// actorinfo
// 
// 216   11/07/98 10:16p Jimdose
// actors no longer get mad at scriptobjects that hurt them
// 
// 215   11/07/98 3:34p Markd
// Added nodeathfade command
// 
// 214   11/06/98 8:25p Jimdose
// made visiondistance adjustable from script
// 
// 213   11/03/98 10:02p Aldie
// Drop inventory when being tesselated
// 
// 212   10/27/98 9:06p Markd
// tweaked enemy aiming
// 
// 211   10/27/98 7:52p Jimdose
// added IfEnemyWithinEvent
// made guys not lean if they're not moving very far
// 
// 210   10/27/98 3:46p Markd
// Changed skill level on actors
// 
// 209   10/27/98 3:51a Jimdose
// added kick to MeleeEvent
// 
// 208   10/27/98 1:50a Markd
// Made JumpTo take in account water level
// 
// 207   10/26/98 9:53p Markd
// Moved GotKill around, added gibfest sound
// 
// 206   10/26/98 9:04p Markd
// Changed jumpto behavior
// 
// 205   10/26/98 8:22p Markd
// Put CheckWater in Killed function
// 
// 204   10/26/98 5:51p Jimdose
// actor saves off spawn args before processing init commands
// 
// 203   10/26/98 2:19p Markd
// Added last_jump_time
// 
// 202   10/26/98 1:20p Markd
// made guys be BestTargetable after having an enemy already
// 
// 201   10/26/98 12:13p Markd
// fixed bug with blood preventing parent mode melee attacks
// 
// 200   10/26/98 3:59a Jimdose
// made Trymove not return STEPMOVE_STUCK when opening doors 
// 
// 199   10/26/98 1:53a Jimdose
// TryMove was still using origin insteard of worldorigin, so the M_CheckBottom
// call was always checking where the monster currently was, and not where he
// was going to.
// 
// 198   10/25/98 11:53p Aldie
// Another dead check to avoid bodies that are in the air not going dead
// 
// 197   10/25/98 4:43a Markd
// Added animal event
// 
// 196   10/25/98 4:28a Jimdose
// Made opendoor a forced action
// made CanShootFrom do extra tests to see if it should shoot damagable objects
// 
// 195   10/25/98 1:52a Aldie
// Changed gibanim functionality to be location based
// 
// 194   10/24/98 3:10p Markd
// Put in eyeoffset command
// 
// 193   10/24/98 3:26a Markd
// Put in more debug info for actors
// 
// 192   10/24/98 12:42a Markd
// changed origins to worldorigins where appropriate
// 
// 191   10/23/98 6:46p Aldie
// Turn off shadows for death and do deathgib anim on location
// 
// 190   10/22/98 9:28p Aldie
// Added ability for deathgib animation
// 
// 189   10/22/98 3:05p Markd
// fixed movespeed on actors
// 
// 188   10/22/98 1:40a Markd
// Added FL_STEALTH ability
// 
// 187   10/21/98 11:15p Markd
// Put in FL_CLOAK ability for targetting from enemies
// 
// 186   10/21/98 6:43p Markd
// made eyeposition the top of their bounding box
// 
// 185   10/21/98 3:37p Markd
// put in different enemy alignment and put in support for skins
// 
// 184   10/21/98 2:13a Markd
// Fixed jumping stuff
// 
// 183   10/20/98 11:29p Markd
// Made CanShootFrom aim at the chest rather than the centroid
// 
// 182   10/20/98 8:05p Aldie
// Added a DoGib function to ease readability
// 
// 181   10/20/98 2:37a Markd
// Added additional JumpTo methods
// 
// 180   10/20/98 12:43a Markd
// Put in scale for health, setsize, melee_range and melee_damage
// 
// 179   10/19/98 11:53p Aldie
// Moved the solid_trigger setting to the setup function of touchfields
// 
// 178   10/19/98 11:49p Aldie
// Fixed a bug where touch field was SOLID_BBOX.  Now it is forced to
// SOLID_TRIGGER.
// 
// 177   10/19/98 9:55p Markd
// Made it so "state" event does a ProcessScript
// 
// 176   10/19/98 8:58p Aldie
// Fix dead check for bodies in water
// 
// 175   10/19/98 2:58a Markd
// Fixed CanShootFrom and Jumping
// 
// 174   10/19/98 2:41a Markd
// made MakeEnemy not target the world
// 
// 173   10/19/98 2:41a Aldie
// Removed MOVETYPE_TOSS when actors die
// 
// 172   10/19/98 12:04a Jimdose
// made all code use fast checks for inheritance (no text lookups when
// possible)
// isSubclassOf no longer requires ::_classinfo()
// 
// 171   10/18/98 6:43p Markd
// If no melee attack, make weapon not droppable
// 
// 170   10/18/98 12:34a Markd
// Scaled shots_per_attack based on skill level
// 
// 169   10/18/98 12:01a Markd
// Fixed AttackEntity and IfCanShoot
// 
// 168   10/17/98 11:00p Markd
// Added IfCanShoot and not gettine mad at non-damageable things
// 
// 167   10/17/98 9:41p Markd
// Made InvestigateSound not set nextsoundtime unless the Action responds
// 
// 166   10/17/98 7:34p Jimdose
// deleted trig when actor deleted
// 
// 165   10/17/98 4:59p Markd
// Added attackmode event
// 
// 164   10/17/98 3:31p Markd
// Made firing more accurate over great distances
// 
// 163   10/17/98 12:34a Markd
// Initialized chattime to random( 20 )
// 
// 162   10/16/98 7:18p Markd
// Added a bunch of new commands, and added interfaces to the editor
// 
// 161   10/16/98 3:11a Aldie
// Double the armor when actors die
// 
// 160   10/16/98 1:41a Jimdose
// Added goto command for actors.  This helps the all too common mistake of
// typing "local.self goto label"
// 
// 159   10/15/98 9:32p Markd
// Made inanimate objects not move, not bleed, and not gib
// 
// 158   10/14/98 10:54p Jimdose
// Made Hates check for a null entity
// Added null check to investigate functions
// 
// 157   10/14/98 9:00p Markd
// Fixed JumpTo command, speed wise
// 
// 156   10/14/98 5:20p Markd
// Added jumpto event and jumpto function
// 
// 155   10/14/98 2:17a Markd
// Added in ifcanmeleeattack event
// 
// 154   10/14/98 1:27a Markd
// Added Has_weapon support
// 
// 153   10/14/98 12:11a Markd
// Put extra reach into melee event
// 
// 152   10/13/98 11:03p Markd
// Put scale in on all Anim_delta calls
// 
// 151   10/13/98 7:34p Markd
// made gib code scalable
// 
// 150   10/13/98 12:26a Markd
// Added support for flying creatures, also made it so that CanShootFrom fired
// from the centroid, and not from the gun position
// 
// 149   10/11/98 8:17p Markd
// Working on nautic fixes
// 
// 148   10/11/98 5:20p Markd
// Put in default pain_thresholds
// 
// 147   10/11/98 5:00p Markd
// Fixed water drowning, changed ProcessCommands so that it doesn't overwrite
// the the "thread" variable
// 
// 146   10/11/98 12:32a Markd
// Added Flight ability
// 
// 145   10/10/98 9:12p Markd
// Fixed Chatter using an alias for SoundTimeLength
// 
// 144   10/10/98 7:59p Markd
// Put in painthreshold and snd_pain_taunt
// 
// 143   10/10/98 5:01p Markd
// Changed trace masks to edict->clipmasks
// 
// 142   10/10/98 3:27p Markd
// Made EndBehavior always notify the actor script
// 
// 141   10/10/98 1:24a Jimdose
// Did some bulletproofing against possible NULL actorthread
// Prethink kills actors with NULL threads
// added SetVariable for setting thread variables safely
// 
// 140   10/09/98 5:24p Markd
// Fixed inanimate actor animations
// 
// 139   10/09/98 4:59p Jimdose
// Working on savegames
// 
// 138   10/07/98 11:32a Markd
// Made DamageThresholds targetable by actors
// 
// 137   10/06/98 5:25p Markd
// Made MakeEnemy and DoAction take the force parameter
// 
// 136   10/06/98 12:14p Markd
// Added ForceAction
// 
// 135   10/05/98 10:33p Markd
// Added canStrafe and noStrafe, also added MinimumAttackRange
// 
// 134   10/05/98 2:57p Markd
// Changed Chatter settings
// 
// 133   10/04/98 10:36p Markd
// Put in attack_finished
// 
// 132   10/04/98 8:45p Aldie
// Gib functions
// 
// 131   10/04/98 2:49p Markd
// Fixed swimming and forward speed stuff
// 
// 130   10/03/98 7:15p Markd
// got swimming characters working, in the process re-wrote a lot of the combat
// stuff
// 
// 129   10/01/98 8:00p Markd
// Added melee capabilities
// 
// 128   10/01/98 4:13p Jimdose
// Fixed some problems with CanShootFrom that prevented guys from being able to
// shoot the player when he's on ledges with railings
// 
// 127   9/24/98 7:26p Markd
// made inanimate objects not set off triggers
// 
// 126   9/24/98 7:10p Jimdose
// Added MyGunAngles
// 
// 125   9/24/98 12:42a Jimdose
// attempting to fix dead guys hanging in air
// 
// 124   9/22/98 10:19p Jimdose
// Initialized lastmove
// Fixed InFov
// Set fovdot in Fov event
// 
// 123   9/22/98 5:19p Markd
// Put in new consolidated gib function
// 
// 122   9/22/98 5:10p Jimdose
// Fixed inanimate objects
// 
// 121   9/22/98 3:21p Markd
// put in parentmode lockout for blood and gibs
// 
// 120   9/22/98 6:27a Jimdose
// Fixed bug when setting "attackmode"
// 
// 119   9/22/98 5:37a Jimdose
// Made attackmode only set once when thread is created
// 
// 118   9/22/98 5:31a Jimdose
// Added attackmode
// 
// 117   9/22/98 1:58a Jimdose
// Added lastmove and forwardspeed
// Regrouped functions by functionality
// Removed reaction table stuff
// 
// 116   9/19/98 7:49p Jimdose
// Fixed uninitialized pointer in ShowInfo and added more data
// 
// 115   9/19/98 6:16p Jimdose
// Added AttackPlayer
// AttackEntity and AttackPlayer makes the actor attack the entity immediately
// by forcing a call to SightEnemy
// 
// 114   9/19/98 4:34p Jimdose
// changed gi.dprintf's to gi.printf's in ShowInfo
// 
// 113   9/18/98 10:55p Jimdose
// Added inanimate actor type
// started work on swimming monsters
// 
// 112   9/16/98 8:38p Jimdose
// Made InFOV only test the fov in 2 dimensions
// 
// 111   9/14/98 5:26p Jimdose
// Made EndBehavior set script variables
// Added some checks for NULL when getting nearest nodes
// SeenEnemy is now cleared when currentEnemy is killed
// CanShootFrom no longer assumes ScriptSlaves are shootable, but does shoot
// ScriptModel.  Gotta find some solution that allows the level designers to
// specify whats shootable by the AI.
// 
// 110   9/08/98 9:48p Jimdose
// Enabled multi-size bounding box path code
// 
// 109   9/03/98 9:05p Jimdose
// Guys will now shoot through scriptslaves and objects with the assumption
// that he can destroy it
// 
// 108   8/31/98 7:46p Jimdose
// Spread out targeting a bit 
// 
// 107   8/31/98 5:42p Jimdose
// Added checks for NULL pointer in MakeEnemy and AttackEnemy
// 
// 106   8/29/98 9:39p Jimdose
// Added call info to G_Trace
// 
// 105   8/29/98 5:26p Markd
// added specialfx, replaced misc with specialfx where appropriate
// 
// 104   8/29/98 1:11p Markd
// Made it so M_CheckBottom only checks if groundentity is not world
// 
// 103   8/27/98 9:00p Jimdose
// Made centroid into a variable
// Made guys target enemies less often
// MakeEnemy checks if ent is the world (when a target is non-valid, the ent
// may be the world)
// 
// 102   8/27/98 6:00p Aldie
// Drop inventory items if the actors are gibbed.
// 
// 101   8/27/98 4:49p Jimdose
// Fixed bug with hidden actors being shown again on startup
// Made actors not target hidden enemies, or target while hidden (for
// cinematics)
// 
// 100   8/27/98 4:27p Markd
// detach children
// 
// 99    8/26/98 11:13p Jimdose
// Began strafe support
// 
// 98    8/26/98 6:45p Jimdose
// Made DefineStateEvent prepend the value in ai_actorscript
// 
// 97    8/24/98 6:55p Jimdose
// Added crouching pain and death animations
// Added path
// 
// 96    8/20/98 8:38p Jimdose
// Actors now share enemy info between each other on sight
// CanShoot checks the head as well as the centroid
// InFOV now uses an eliptical cone for testing vision (better vertical
// peripheral vision).
// 
// 95    8/19/98 4:57p Jimdose
// CanShootFrom now takes min and max weapon firing distances into account
// 
// 94    8/19/98 3:59p Jimdose
// Added IfNearEvent and CopyStateEvent
// 
// 93    8/19/98 2:30p Jimdose
// Can no longer alias "alert" to "idle" so I've added a hasalert variable
// 
// 92    8/18/98 11:57p Aldie
// Fixed init variable warning
// 
// 91    8/18/98 11:08p Markd
// Added new Alias System
// 
// 90    8/18/98 9:59p Jimdose
// Made actors only react to some sounds when they're caused by an enemy.
// Hmmm, would be nice if they checked their "memory" to see if they expect
// that kind of sound from there.
// 
// 89    8/15/98 5:29p Jimdose
// Fixed up the thread startup code.  No longer need to wait .1 in the script
// before sending commands.  Actor script is no longer run twice (because of
// the delayed model init commands.
// Got rid of !init label in scripts.  Now starts at beginning unless a label
// is given.
// CanShoot checks vision distance as an early exit.
// 
// 88    8/14/98 11:34p Jimdose
// Got rid of "runtoarea" state.  Attack now just lets MakeEnemy call
// sightenemy.  Hmmm...probably should change to make sure that actor
// immediatly attacks the specified entity.
// don't set currentEnemy until sightenemy is responded to.  Gets rid of a lot
// of brain dead situations.
// 
// 87    8/14/98 6:24p Jimdose
// Got rid of decelleration for steering
// 
// 86    8/13/98 7:30p Jimdose
// actorThread is now persistant.  Threads don't get killed unless actor dies
// or is removed.
// 
// 85    8/08/98 2:05p Markd
// Added entity who got the event to ForwardBehaviorEvent
// 
// 84    8/07/98 7:57p Markd
// Added ForwardToBehavior event
// 
// 83    8/07/98 6:01p Jimdose
// Rewrite AimAndShoot
// 
// 82    8/06/98 6:59p Jimdose
// Added IfEnemyVisible
// 
// 81    8/05/98 7:18p Jimdose
// Added definestate, ignoresounds, respondtosounds, respondtoall
// 
// 80    8/03/98 6:49p Jimdose
// fixed thread bug
// 
// 79    7/29/98 6:32p Jimdose
// Added MonsterStart
// 
// 78    7/29/98 6:27p Jimdose
// Removed monster.h
// 
// 77    7/29/98 2:30p Aldie
// Changed health to a float
// 
// 76    7/26/98 3:40p Jimdose
// Fixed guys in water
// guys no longer open locked doors
// 
// 75    7/26/98 11:43a Jimdose

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -