📄 sentient.cpp
字号:
//-----------------------------------------------------------------------------
//
// $Logfile:: /Quake 2 Engine/Sin/code/game/sentient.cpp $
// $Revision:: 189 $
// $Author:: Jimdose $
// $Date:: 11/17/98 6:56p $
//
// 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/sentient.cpp $
//
// 189 11/17/98 6:56p Jimdose
// made EventGiveHealth clear the damage skin on the player
//
// 188 11/16/98 9:05p Markd
// added meansofdeath to pain
//
// 187 11/16/98 7:46p Markd
// Hooked up takeItem to an event, for some reason this was never done?
//
// 186 11/14/98 8:07p Jimdose
// added DF_NO_DROP_WEAPONS
//
// 185 11/13/98 10:20p Aldie
// Added event take item
//
// 184 11/13/98 2:36a Aldie
// Fixed typo for MOD_SPEARGUN and gibbing. Also removed pain for MUTANT_DRAIN
//
// 183 11/12/98 11:29p Aldie
// No blood for mutant drain
//
// 182 11/09/98 6:22p Markd
// Added dropweaponnow event
//
// 181 11/08/98 10:49p Jimdose
// sentientFrozen wasn't being archived
//
// 180 11/08/98 8:30p Aldie
// Added a couple of strings to archive for sentients
//
// 179 10/27/98 6:20a Aldie
// Fixed drop inventory items bug
//
// 178 10/27/98 3:50a Jimdose
// made armordamage not do Ion tesselation when FL_NOION is set
//
// 177 10/26/98 9:53p Markd
// Moved GotKill around, added gibfest sound
//
// 176 10/26/98 8:12p Aldie
// Fixed some weapon bugs with detaching from owner when removing
//
// 175 10/26/98 2:21a Aldie
// Added MOD_HELIGUN to DoGib
//
// 174 10/25/98 10:15p Aldie
// Fix dropweapon code (again)
//
// 173 10/25/98 4:37a Aldie
// Put an assertion to help us find a bug with giving items
//
// 172 10/25/98 1:51a Aldie
// Fixed an inventory bug ( free inventory ) and lowered percentage of gun
// getting shot out of your hands
//
// 171 10/24/98 11:47p Jimdose
// fixed RestorePersistantData so that setowner works after G_CallSpawn
//
// 170 10/24/98 6:38p Markd
// Added gibbed to GotKill, also added GotKill to gibbed section of ArmorDamage
//
// 169 10/24/98 4:34p Aldie
// Added a warning message if we could not find the item in
// "EventGiveTargetname" - hopefully this will help find the problem.
//
// 168 10/24/98 2:08p Aldie
// Fixed crash bug with floating inventories
//
// 167 10/24/98 12:42a Markd
// changed origins to worldorigins where appropriate
//
// 166 10/23/98 9:58p Aldie
// Fixed dropweapon bug
//
// 165 10/23/98 7:11p Aldie
// Damage tweak for singleplayer
//
// 164 10/23/98 2:37a Aldie
// Added MOD_VEHICLE
//
// 163 10/22/98 11:11p Markd
// Put item variables into Add and Remove to keep track of inventory
//
// 162 10/22/98 10:22p Markd
// Put in support for game and level item script variables
//
// 161 10/22/98 9:29p Aldie
// Added support for death gib animations
//
// 160 10/22/98 4:58p Aldie
// Only do rocket jump in deathmatch
//
// 159 10/22/98 2:38a Aldie
// Added setdropweapon command for sentients
//
// 158 10/22/98 1:40a Aldie
// Don't put blood on ents
//
// 157 10/21/98 8:41p Markd
// Fixed currentWeapon bug with WeaponUse
//
// 156 10/21/98 7:50p Aldie
// Fixed a function declaration
//
// 155 10/20/98 11:23p Jimdose
// made weapons switch properly if you pickup a weapon while reloading
// made drop weapon and take weapon use the best weapon when switching
//
// 154 10/20/98 8:05p Aldie
// Added a DoGib function to ease readability
//
// 153 10/20/98 1:18a Markd
// Made fists and adrenaline a gibbable act
//
// 152 10/19/98 12:07a Jimdose
// made all code use fast checks for inheritance (no text lookups when
// possible)
// isSubclassOf no longer requires ::_classinfo()
//
// 151 10/18/98 6:43p Markd
// Allowed other actors to have their weapons knocked from their hands
//
// 150 10/17/98 8:14p Jimdose
// Changed G_CallSpawn2 to G_CallSpawn
//
// 149 10/17/98 5:15p Markd
// rotate centroid by orientation when making force field
//
// 148 10/16/98 3:10a Aldie
// Removed global dmg multipliers
//
// 147 10/15/98 3:37p Markd
// Added forcefield support
//
// 146 10/15/98 3:11p Aldie
// Damage skill multiplier ( for testing purposes )
//
// 145 10/14/98 1:19a Jimdose
// Got cross-level persistant info working
//
// 144 10/12/98 3:49p Aldie
// Init a couple vars
//
// 143 10/11/98 5:34p Aldie
// Gib from MUTANTHANDS
//
// 142 10/11/98 12:03a Aldie
// Mutant mode takes less dmg
//
// 141 10/10/98 5:58p Aldie
// More quantumdestab fixes
//
// 140 10/09/98 5:23p Aldie
// Teamplay
//
// 139 10/08/98 12:02a Jimdose
// Bloodsplats are now a separate class
//
// 138 10/05/98 10:18p Aldie
// Covnverted over to new silencer methods
//
// 137 10/04/98 10:28p Aldie
// Added multiple weapon changes. Damage, flashes, quantum stuff
//
// 136 10/03/98 7:27p Markd
// Added pos tio get gun orientation
//
// 135 10/03/98 5:13p Jimdose
// changed the way Unarchive reads the event pointer
//
// 134 10/01/98 8:00p Aldie
// Consolidated cprintf
//
// 133 9/27/98 4:36p Aldie
// Modified armor damage and clipped velocity.z for bulletweapons in
// armordamage
//
// 132 9/26/98 4:45p Aldie
// Added mutant mode
//
// 131 9/25/98 4:37p Markd
// Made two sentient functions not inline, so that it would work with vc 6.0
//
// 130 9/23/98 12:37p Markd
// added tesselate sound when ionized
//
// 129 9/22/98 3:21p Markd
// put in parentmode lockout for blood and gibs
//
// 128 9/22/98 12:14p Aldie
// Added sentientFrozen
//
// 127 9/21/98 6:05p Markd
// added archive and unarchive functions
//
// 126 9/20/98 9:08p Aldie
// Fixed a particle bug with RandomParticles
//
// 125 9/20/98 7:11p Aldie
// Added flags to particles
//
// 124 9/18/98 9:55p Markd
// Added noshadow event
//
// 123 9/18/98 8:40p Aldie
// Ion tesselate effect
//
// 122 9/16/98 8:58p Aldie
// Added ability to do a hold down weapon charge
//
// 121 9/12/98 11:08p Aldie
// Fixed armor damage bug
//
// 120 9/11/98 2:50p Aldie
// Added releasefiring functionality
//
// 119 9/09/98 6:49p Markd
// Check to see if weapon is droppable before dropping it
//
// 118 9/05/98 12:12p Aldie
// Tweaked armor damage that does 50% damage to player and 50% damage to armor
// in deathmatch. Also inited poweruptype and poweruptimer
//
// 117 9/02/98 11:08a Markd
// Put in setModel into Sentient so that weapon could be properly detached and
// re-attached again.
//
// 116 9/01/98 7:46p Aldie
// Changed blood around so dead bodies bleed
//
// 115 8/31/98 7:16p Markd
// Fixed player animation naming convention
//
// 114 8/31/98 5:45p Aldie
// Powerup stuff
//
// 113 8/31/98 1:55p Markd
// weapons no longer double trigger animations
//
// 112 8/29/98 9:46p Jimdose
// Added call info to G_Trace
//
// 111 8/29/98 7:23p Aldie
// Made a givetargetname function for giving monsters targeted items.
//
// 110 8/29/98 2:53p Aldie
// Updated printing of location based damage
//
// 109 8/27/98 9:03p Jimdose
// made grav a reference
//
// 108 8/27/98 6:43p Markd
// re-added StartAnimating calls in TempAnim and SetANim
//
// 107 8/27/98 6:00p Aldie
// Drop inventory items if the actors are gibbed.
//
// 106 8/27/98 5:29p Markd
// Took out start animating calls
//
// 105 8/27/98 2:30p Aldie
// Added DAMAGE_NO_SKILL flag
//
// 104 8/24/98 6:52p Jimdose
// Fixed inverted gravity axis
//
// 103 8/22/98 9:35p Jimdose
// Added support for alternate gravity axis
//
// 102 8/21/98 7:38p Markd
// Fixed climbing code
//
// 101 8/19/98 8:50p Aldie
// Show damage locations and use random particles for blood.
//
// 100 8/17/98 2:58p Aldie
// Rearranged blood and spark particles
//
// 99 8/15/98 4:07p Aldie
// Made NextWeapon and PreviousWeapon obey the AutoChange function. So the
// sniperrifle will not be auto used.
//
// 98 8/14/98 5:48p Aldie
// Moved more of blood splat stuff here.
//
// 97 8/14/98 5:39p Aldie
// Moved spray blood to entity
//
// 96 8/13/98 8:10p Aldie
// Added sparks and blood to armordamage
//
// 95 8/12/98 4:20p Aldie
// Fixed icons not showing up correctly
//
// 94 8/06/98 10:53p Aldie
// Added weapon tweaks and kickback. Also modified blast radius damage and
// rocket jumping.
//
// 93 8/04/98 6:14p Aldie
// Updated armor damage stuff
//
// 92 8/04/98 5:10p Markd
// Took out "Monster" clause in ArmorDamage
//
// 91 7/31/98 8:09p Jimdose
// Script commands now include flags to indicate cheats and console commands
//
// 90 7/29/98 2:32p Aldie
// Changed health to a float
//
// 89 7/26/98 4:15a Aldie
// Check for in vehicle so the player can kill himself
//
// 88 7/26/98 2:59a Markd
// guys don't get their guns knocked out of their hands for now
//
// 87 7/26/98 2:54a Markd
// changed player damage multipliers
//
// 86 7/26/98 12:46a Aldie
// Trying to fix stuck dead anims
//
// 85 7/25/98 3:57p Markd
// Added EV_GotKill
//
// 84 7/25/98 2:11a Jimdose
// Added SentientList
//
// 83 7/24/98 9:58p Aldie
// Gib stuff
//
// 82 7/24/98 6:19p Aldie
// Check for inventory of type
//
// 81 7/24/98 3:49p Aldie
// Made sentients check for uselessness in the future
//
// 80 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
//
// 79 7/23/98 1:51p Aldie
// Print damage to attacker and client
//
// 78 7/23/98 12:17p Aldie
// Print damage reports to victims.
//
// 77 7/21/98 9:09p Aldie
// Process commands on given weapons too. Seems to work ok.
//
// 76 7/21/98 1:10p Aldie
// Added meansofdeath to obituaries
//
// 75 7/20/98 7:42p Aldie
// Set owner of given items before processing their commands.
//
// 74 7/20/98 6:54p Markd
// Added damage support based on skill level
//
// 73 7/20/98 5:40p Aldie
// When giving items to sentients process the commands immediately.
//
// 72 7/19/98 10:34p Aldie
// Added DAMAGE_NO_ARMOR functionality
//
// 71 7/19/98 7:38p Markd
// Added Shield support for 1/4 damage
//
// 70 7/19/98 7:35p Markd
// Fixed ForceWeaponChange so that it doesn't squash newWeapon
//
// 69 7/19/98 5:41p Markd
// Added ForceWeaponChange, added takeItem
//
// 68 7/18/98 7:37p Aldie
// Updated showdamage printing.
//
// 67 7/18/98 5:08p Aldie
// Added showdamage
//
// 66 7/17/98 4:01p Markd
// Added CanChangeWeapons
//
// 65 7/14/98 6:57p Aldie
// Updated health commands
//
// 64 7/13/98 5:00p Aldie
// Added dead player bodies with gibbing
//
// 63 7/11/98 8:22p Jimdose
// When dropping a weapon, if the weapon can't be dropped, it's deleted if the
// player is dying. This fixes the crash when the player dies while using the
// fists.
//
// 62 7/11/98 5:55p Aldie
// Undid when we send icons to the player for picking stuff up.
//
// 61 7/10/98 11:11p Jimdose
// characters no longer switch weapons after dropping them when killed
//
// 60 7/10/98 12:05a Aldie
// Fixed icon sending if you don't pickup a weapon
//
// 59 7/01/98 7:03p Aldie
// Floating inventory mods for empty inventories
//
// 58 6/30/98 6:48p Aldie
// Gib a dead body, and don't display items that have 0 amount.
//
// 57 6/25/98 8:47p Markd
// Added keyed items for Triggers, Rewrote Item class, rewrote every pickup
// method
//
// 56 6/25/98 12:42p Aldie
// Updated some inventory and weapon swtiching stuff
//
// 55 6/24/98 4:44p Aldie
// Made it so you can only view one inventory at a time
//
// 54 6/24/98 1:37p Aldie
// Implementation of inventory system and picking stuff up
//
// 53 6/21/98 5:54p Jimdose
// Moved call to GetBoneGroupName from the constructor to SetCurrentWeapon
// since the model isn't set yet when the constructor is called.
//
// 52 6/20/98 7:49p Markd
// Added location to pain and killed events, also added gun_bone_group_name
// variable
//
// 51 6/20/98 2:20p Aldie
// Removed sone printfs
//
// 50 6/19/98 9:28p Jimdose
// Added GetGunOrientation
//
// 49 6/19/98 6:36p Aldie
// Put some more inventory managment in
//
// 48 6/18/98 9:25p Aldie
// Started inventory system
//
// 47 6/18/98 2:00p Markd
// rewrote tesselation code
//
// 46 6/17/98 1:20a Jimdose
// Changed Attack to FireWeapon
//
// 45 6/15/98 9:09p Aldie
// Added a generic give and an updater for silenced weapons, when you pick it
// up
//
// 44 6/15/98 3:36p Aldie
// Updated armor damage calculations
//
// 43 6/10/98 2:10p Aldie
// Updated damage function.
//
// 42 6/09/98 4:22p Jimdose
// AnimLoop went into an infinite loop when the anim didn't exist
//
// 41 6/08/98 9:04p Aldie
// Updated checks for weapon changing when no ammo available
//
// 40 6/08/98 8:35p Markd
// put in code to put away weapon when readytouse becomes false
//
// 39 6/08/98 8:19p Markd
// Put in ReadyToUse call when switching weapons
//
// 38 6/08/98 11:34a Aldie
// Updated damage based location checks
//
// 37 6/05/98 6:25p Aldie
// Added give and take armor as well as ArmorDamage calculations based on
// location hit
//
// 36 5/27/98 12:59a Markd
// Put in shadows flag
//
// 35 5/26/98 4:46p Aldie
// added take functions
//
// 34 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
//
// 33 5/24/98 4:48p Jimdose
// Made char *'s const
//
// 32 5/20/98 6:38p Jimdose
// Made anim functions use const char *
//
// 31 5/08/98 2:57p Markd
// Added weapon pickup sound
//
// 30 5/03/98 4:37p Jimdose
// Changed Vector class
//
// 29 4/25/98 5:09p Markd
// Added up and down support for angles
//
// 28 4/07/98 6:47p Jimdose
// Fixed weapon switching bugs
//
// 27 4/06/98 5:46p Jimdose
// Added "angles" spawn values
//
// 26 4/05/98 2:57a Jimdose
// Made checks for anim and classname case insensitive
//
// 25 3/30/98 2:37p Jimdose
// Added Ammo
// Added weapon dropping
//
// 24 3/29/98 10:01p Jimdose
// Added animation control functions
//
// 23 3/27/98 5:37p Jimdose
// Added FreeInventory for when players respawn
//
// 22 3/24/98 4:57p Jimdose
// Changed usage of GetToken to GetString so that script variables can be used
//
// 21 3/23/98 1:31p Jimdose
// Revamped event and command system
//
// 20 3/18/98 7:23p Jimdose
// Added code for handling readying and putting away weapons
//
// 19 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.
//
// 18 3/02/98 5:38p Jimdose
// Added destructor so that all held weapons are released from being owned.
// Temporariliy disabled type checking on Weapons.
//
// 17 2/19/98 2:36p Jimdose
// Added weapons back in
//
// 16 2/17/98 6:59p Jimdose
// no longer pass script into interpretCommand
//
// 15 2/03/98 10:51a Jimdose
// Updated to work with Quake 2 engine
// Moved initialization to constructor and removed Init function
//
// 13 12/15/97 4:39p Aldie
// Added support for gunoffset in def files.
//
// 12 12/15/97 1:37a Jimdose
// Added assertions in nextWeapon and previousWeapon to help track down a bug.
// While changing weapons, I got a NULL pointer when I retrieved a entity
// number from the inventory. Weapons in the inventory should never be freed
// during the game without being removed from the inventory first.
//
// 11 12/11/97 3:36p Markd
// Moved ClearInventory List to before Init call to super class
//
// 10 12/09/97 7:41p Markd
// Added NumWeapons and WeaponNumber functions
//
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -