📄 player.cpp
字号:
// 113 5/27/98 5:21a Markd
// switched order of giveWeapon's
//
// 112 5/26/98 7:55p Jimdose
// added scripted cameras
//
// 111 5/26/98 4:45p Aldie
// Added take (object) from player
//
// 110 5/25/98 1:39p Aldie
// Added create console user
//
// 109 5/26/98 4:37a Jimdose
// Third person camera works again
// Added tracking crosshair
//
// 108 5/26/98 1:54a Markd
// Fixed up a bunch of player sounds
//
// 107 5/25/98 6:47p Jimdose
// Made animateframe, prethink and posthink into functions built into the base
// entity class
//
// 106 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
//
// 105 5/24/98 4:48p Jimdose
// Made char *'s const
//
// 104 5/24/98 1:04a Jimdose
// Added sound events for ai
//
// 103 5/22/98 12:22p Aldie
// Removed unused variable from player struct
//
// 102 5/22/98 12:17p Aldie
// Added gravity paths and updated earthquake effect
//
// 101 5/20/98 10:22p Aldie
// Added earthquake effects
//
// 100 5/18/98 8:14p Jimdose
// Renamed Navigator back to PathManager
//
// 99 5/16/98 5:00p Markd
// Added RF_XFLIP stuff
//
// 98 5/13/98 4:49p Jimdose
// Now use SafePtrs for keeping track of nodes
//
// 97 5/11/98 3:19p Markd
// Changed zoom-in and zoom-out sounds
//
// 96 5/11/98 2:19p Markd
// Fixed randomsound stuff
//
// 95 5/11/98 11:25a Markd
// Added new weapons
//
// 94 5/09/98 7:44p Markd
// Added gunmodel, gunframe and gunindex for other side gun animations
//
// 93 5/08/98 7:01p Markd
// Took out RF_SHELL flags
//
// 92 5/07/98 11:23p Markd
// Added playerframe, playeranim and playerindex to playerstate
//
// 91 5/07/98 10:46p Aldie
// Fixed players exiting consoles.
//
// 90 5/07/98 10:43p Jimdose
// working on cameras and archiving
//
// 89 5/05/98 2:40p Jimdose
// Added support for new camera system.
// Rewrote a lot of stuff to allow a clean separation between the camera
// control variables in client and the Player entity. This allows a much
// easier interface for creating new camera views
//
// 88 5/03/98 4:46p Jimdose
// Added camera view
// changed Vector class. Aliased vectors via pointsTo no longer supported.
//
// 87 5/02/98 4:24p Jimdose
// Added FL_BLOOD to player
//
// 86 5/01/98 6:15p Jimdose
// Made Respawn an event so that Trigger_Hurt wouldn't rekill a player after
// respawn
//
// 85 5/01/98 5:55p Aldie
// Removed debugging printf's
//
// 84 4/29/98 5:38p Jimdose
// Added death messages
// Sniper rifle zooms out before changing weapon
// fov no longer a cheat and is persistant across respawns
//
// 83 4/27/98 6:09p Jimdose
// Changed alpha on debug lines
//
// 82 4/27/98 4:12p Jimdose
// Working on path placement
//
// 81 4/21/98 2:25p Aldie
// Added enterconsole and exit console events.
//
// 80 4/20/98 5:44p Jimdose
// working on ai
//
// 79 4/20/98 2:45p Jimdose
// working on ai
//
// 78 4/18/98 6:10p Aldie
// Updated ammo stats.
//
// 77 4/18/98 4:24p Aldie
// Added ammo bar to stats.
//
// 76 4/18/98 4:06p Jimdose
// Working on ai
//
// 75 4/18/98 3:17p Markd
// Changed view weapon naming convention
//
// 74 4/18/98 3:02p Jimdose
// Added ai_createnodes and ai_showpath
// working on ai
//
// 73 4/16/98 6:22p Jimdose
//
// 72 4/16/98 5:35p Aldie
// Change fov of sniperrifle
//
// 71 4/16/98 3:22p Jimdose
//
// 70 4/16/98 2:09p Jimdose
// Added prevframe support for guns
// No longer set SOLID_NOT in destructor (world may have been deleted, so the
// gi.link in setSolidType would crash)
//
// 69 4/09/98 8:44p Jimdose
// Added view blend effects
// added drowing
//
// 68 4/09/98 7:44p Aldie
// Added blending for sniper zoom.
//
// 67 4/08/98 5:32p Jimdose
// Fixed bug in SpawnEntity
// Added key/value pairs to spawn command
//
// 66 4/08/98 4:46p Jimdose
// Made weapon appear in third person view
// Secondary Use isn't sent until the weapon is ready
// Zoom mode overrides third person view.
//
// 65 4/07/98 11:55p Jimdose
// Changed beams to specify color
//
// 64 4/07/98 8:05p Jimdose
// Made use much more sensitive. Opens too many things at once, but, oh well.
//
// 63 4/07/98 6:41p Jimdose
// Fixed bugs in weapon code
// Added checks for being dead in various functions (changing weapons)
// working on making use more responsive
//
// 62 4/07/98 3:48p Aldie
// Added zooming crosshair
//
// 61 4/06/98 8:00p Jimdose
// Init resets your gravity to 1.0
//
// 60 4/06/98 7:10p Aldie
// Added zooming for SniperRifle
//
// 59 4/05/98 2:57a Jimdose
// added respawn_time
// made firing anim work temporarily
//
// 58 4/04/98 6:07p Jimdose
// Added events for syncing firing to animation
//
// 57 4/02/98 4:56p Jimdose
// Added pain, obituary and showscores
// Fixed bug in Init where persistant data was always being cleared
// ammo stats are now kept up to date
// Added falling and landing animations
//
// 56 3/31/98 1:40p Jimdose
// Removed footstep stuff (it's in entity now)
// jump sound is now played by the model
//
// 55 3/31/98 12:47p Jimdose
// Fixed the gunoffset
//
// 54 3/30/98 11:39p Markd
// Added modelIndex stuff
//
// 53 3/30/98 9:55p Jimdose
// Changed location of .def files
//
// 52 3/30/98 2:41p Jimdose
// Worked on weapons
// Fixed footstep. There weren't any 'break's in the switch statement
//
// 51 3/29/98 9:42p Jimdose
// Moved animation stuff to sentient
// Changed killed to an event
//
// 50 3/29/98 5:57p Jimdose
// Added SpawnEntity command
//
// 49 3/28/98 8:55p Jimdose
// Added pulse rifle
//
// 48 3/28/98 6:51p Jimdose
// Made the angles in player starts work
//
// 47 3/28/98 4:35p Jimdose
// Added kill command
// Added deathmatch starts
// You can no longer move your view when you're dead
//
// 46 3/27/98 10:00p Jimdose
// Changed all worldangle references to use setAngles
//
// 45 3/27/98 6:36p Jimdose
// Precached weapon models
// Added assault rifle
//
// 44 3/27/98 5:40p Jimdose
// Added third person view mode
// respawn now calls FreeInventory so that weapons don't carry over when you
// die
//
// 43 3/26/98 8:25p Jimdose
// Added deathmatch
// Precache sounds
// Added animation control functions
//
// 42 3/23/98 1:31p Jimdose
// Revamped event and command system
//
// 41 3/18/98 7:22p Jimdose
// Added new-style weapons
// Fixed bug where orientation and v_angle wasn't being set
//
// 40 3/04/98 5:13p Aldie
// Added support for damage surfaces.
//
// 39 3/03/98 6:56p Aldie
// Removed a printf.
//
// 38 3/03/98 6:51p Aldie
// Added some more footstep sounds.
//
// 37 3/03/98 6:02p Aldie
// First pass at footsteps.
//
// 36 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.
//
// 35 3/02/98 5:41p Jimdose
// Added commands for testing paths
// Changed the trace that use does.
//
// 34 2/21/98 1:21p Jimdose
// Removed A LOT of unused varables and code. Anything from here on out should
// be code written specifically for Sin and not converted Quake code. Quake is
// not a blueprint. It's only a reference.
//
// 33 2/19/98 2:35p Jimdose
// Added weapons back in
//
// 32 2/17/98 8:34p Jimdose
// Enabled the use key
//
// 31 2/06/98 5:44p Jimdose
// replaced use of think and touch functions with events
// move client to Entity
//
// 30 2/03/98 10:59a Jimdose
// Updated to work with Quake 2 engine
// Moved initialization to constructor and removed Init function
// This will probably be rewritten to be simpler. This first rewrite sucks.
//
// 28 12/15/97 2:52p Markd
// Fixed default weapons
//
// 27 12/15/97 12:35p Aldie
//
// 26 12/14/97 8:51p Aldie
// Updated impulse 9 to give all weapons.
//
// 25 12/14/97 8:16p Aldie
// Modified give all weapons list.
//
// 24 12/14/97 5:33p Markd
// Made default weapon Shotgun instead of DoubleBarrel
//
// 23 12/13/97 6:53p Aldie
// Added shotgun to give all weapons list
//
// 22 12/06/97 1:31p Aldie
// Fixed give weapon handler so that "give all" is case insensitive.
//
// 21 12/06/97 12:34p Aldie
// Added Tracer Gun to give all weapons list.
//
// 20 12/05/97 4:08p Aldie
// Added event to player for giving weapons.
//
// 19 11/18/97 5:29p Markd
// Added magnum and spear gun to impulse 9, checked for NULL currentWeapon and
// updated weapon frames in PlayerPostThink
//
// 18 11/12/97 5:12p Jimdose
// Changed enter and exit vehicle messages to be defined in Player.h
//
// 17 11/12/97 2:10p Jimdose
// Simplified the interface to PathSearch
//
// 16 11/10/97 8:30p Jimdose
// Flags were being subtracted rather than masked off in Jump.
//
// 15 11/07/97 6:49p Jimdose
// Added code for testing path.cpp. Enable by defining TESTPATH
//
// 14 11/01/97 2:19p Jimdose
// looking
//
// 13 11/01/97 2:12p Jimdose
// jump in vehicles
//
// 12 10/31/97 9:02p Jimdose
// Added FL_PRETHINK and FL_POSTTHINK
//
// 11 10/30/97 11:48p Jimdose
// Worked on vehicle code
//
// 10 10/29/97 12:54p Markd
// made viewthing multiple spawnable
//
// 9 10/29/97 11:51a Markd
// Made viewthing always face you when spawned.
//
// 8 10/28/97 6:54p Markd
// Added SPAWN_VIEWTHING message. Also added "return true" to other handled
// messages
//
// 7 10/27/97 3:29p Jimdose
// Removed dependency on quakedef.h
//
// 6 10/22/97 12:24p Jimdose
// Disabled warning when player recieves a blocked event.
//
// 5 10/09/97 4:26p Jimdose
// Worked on vehicle code
//
// 4 10/08/97 9:30p Jimdose
// Refined Vehicle movement.
//
// 3 10/08/97 6:03p Jimdose
// Began vehicle support.
//
// 2 9/26/97 6:47p Jimdose
// Added standard Ritual headers
//
// DESCRIPTION:
// Class definition of the player.
//
#include "g_local.h"
#include "entity.h"
#include "player.h"
#include "worldspawn.h"
#include "weapon.h"
#include "trigger.h"
#include "scriptmaster.h"
#include "vehicle.h"
#include "path.h"
#include "navigate.h"
#include "misc.h"
#include "q_shared.h"
#include "console.h"
#include "earthquake.h"
#include "gravpath.h"
#include "armor.h"
#include "inventoryitem.h"
#include "gibs.h"
#include "spidermine.h"
#include "deadbody.h"
#include "actor.h"
#include <windows.h>
const Vector power_color( 0.0, 1.0, 0.0 );
const Vector acolor( 1.0, 1.0, 1.0 );
const Vector bcolor( 1.0, 0.0, 0.0 );
static const char *ammo_types[ NUM_AMMO_TYPES ] =
{
"Bullet357", "ShotgunClip", "Bullet10mm", "Bullet50mm", "BulletPulse", "BulletSniper", "Rockets", "SpiderMines"
};
static const char *armor_types[ NUM_ARMOR_TYPES ] =
{
"RiotHelmet", "FlakJacket", "FlakPants"
};
Event EV_Player_GodCheat( "superfuzz", EV_CHEAT );
Event EV_Player_NoTargetCheat( "wallflower", EV_CHEAT );
Event EV_Player_NoClipCheat( "nocollision", EV_CHEAT );
Event EV_Player_GiveAllCheat( "wuss", EV_CHEAT );
Event EV_Player_EndLevel( "endlevel" );
Event EV_Player_DevGodCheat( "god", EV_CHEAT );
Event EV_Player_DevNoTargetCheat( "notarget", EV_CHEAT );
Event EV_Player_DevNoClipCheat( "noclip", EV_CHEAT );
Event EV_Player_PrevWeapon( "weapprev", EV_CONSOLE );
Event EV_Player_NextWeapon( "weapnext", EV_CONSOLE );
Event EV_Player_PrevItem( "invprev", EV_CONSOLE );
Event EV_Player_NextItem( "invnext", EV_CONSOLE );
Event EV_Player_UseInventoryItem( "invuse", EV_CONSOLE );
Event EV_Player_GiveCheat( "give", EV_CHEAT );
Event EV_Player_Take( "take" );
Event EV_Player_UseItem( "use", EV_CONSOLE );
Event EV_Player_Spectator( "spectator", EV_CONSOLE );
Event EV_Player_GameVersion( "gameversion", EV_CONSOLE );
Event EV_Player_Fov( "fov" );
Event EV_Player_SaveFov( "savefov", EV_CONSOLE );
Event EV_Player_RestoreFov( "restorefov", EV_CONSOLE );
Event EV_Player_ToggleViewMode( "toggleviewmode", EV_CONSOLE );
Event EV_Player_ToggleZoomMode( "togglezoommode", EV_CHEAT );
Event EV_Player_ZoomOut( "zoomout" );
Event EV_Player_Kill( "playerkill", EV_CONSOLE );
Event EV_Player_Dead( "dead" );
Event EV_Player_SpawnEntity( "spawn", EV_CHEAT );
Event EV_Player_SpawnActor( "actor", EV_CHEAT );
Event EV_Player_ShowInfo( "showinfo", EV_CONSOLE );
Event EV_Player_ReadyToFire( "readytofire" );
Event EV_Player_WaitingToFire( "waitingtofire" );
Event EV_Player_AttackDone( "attackdone" );
Event EV_Player_AddPathNode( "addnode", EV_CHEAT );
Event EV_Player_Respawn( "respawn" );
Event EV_Player_ClearFloatingInventory( "clear_flinv" );
Event EV_Player_TestThread( "testthread", EV_CHEAT );
Event EV_Player_PowerupTimer( "poweruptimer" );
Event EV_Player_UpdatePowerupTimer( "updatepoweruptime" );
Event EV_Player_DrawOverlay( "drawoverlay" );
Event EV_Player_HideOverlay( "hideoverlay" );
Event EV_Player_DrawStats( "drawstats" );
Event EV_Player_HideStats( "hidestats" );
Event EV_Player_SetFlashColor( "setflashcolor" );
Event EV_Player_ClearFlashColor( "clearflashcolor" );
Event EV_Player_Mutate( "mutate", EV_CHEAT );
Event EV_Player_Human( "human", EV_CHEAT );
Event EV_Player_Skin( "skin" );
Event EV_Player_WhatIs( "whatis", EV_CHEAT );
Event EV_Player_ActorInfo( "actorinfo", EV_CHEAT );
Event EV_Player_Taunt( "taunt", EV_CONSOLE );
Event EV_Player_KillEnt( "killent", EV_CONSOLE );
Event EV_Player_KillClass( "killclass", EV_CONSOLE );
Event EV_Player_RemoveEnt( "removeent", EV_CONSOLE );
Event EV_Player_RemoveClass( "removeclass", EV_CONSOLE );
#define UPRIGHT_SPEED 320.0f
#define CROUCH_SPEED 110.0f
#define ACCELERATION 10.0f
#define TAUNT_TIME 1.0f
/*
==============================================================================
PLAYER
==============================================================================
*/
// deadflag values
cvar_t * s_debugmusic;
cvar_t * whereami;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -