]> icculus.org git repositories - icculus/iodoom3.git/blob - neo/game/Player.h
hello world
[icculus/iodoom3.git] / neo / game / Player.h
1 /*
2 ===========================================================================
3
4 Doom 3 GPL Source Code
5 Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 
6
7 This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).  
8
9 Doom 3 Source Code is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
14 Doom 3 Source Code is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with Doom 3 Source Code.  If not, see <http://www.gnu.org/licenses/>.
21
22 In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code.  If not, please request a copy in writing from id Software at the address below.
23
24 If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
25
26 ===========================================================================
27 */
28
29 #ifndef __GAME_PLAYER_H__
30 #define __GAME_PLAYER_H__
31
32 /*
33 ===============================================================================
34
35         Player entity.
36         
37 ===============================================================================
38 */
39
40 extern const idEventDef EV_Player_GetButtons;
41 extern const idEventDef EV_Player_GetMove;
42 extern const idEventDef EV_Player_GetViewAngles;
43 extern const idEventDef EV_Player_EnableWeapon;
44 extern const idEventDef EV_Player_DisableWeapon;
45 extern const idEventDef EV_Player_ExitTeleporter;
46 extern const idEventDef EV_Player_SelectWeapon;
47 extern const idEventDef EV_SpectatorTouch;
48
49 const float THIRD_PERSON_FOCUS_DISTANCE = 512.0f;
50 const int       LAND_DEFLECT_TIME = 150;
51 const int       LAND_RETURN_TIME = 300;
52 const int       FOCUS_TIME = 300;
53 const int       FOCUS_GUI_TIME = 500;
54
55 const int MAX_WEAPONS = 16;
56
57 const int DEAD_HEARTRATE = 0;                   // fall to as you die
58 const int LOWHEALTH_HEARTRATE_ADJ = 20; // 
59 const int DYING_HEARTRATE = 30;                 // used for volumen calc when dying/dead
60 const int BASE_HEARTRATE = 70;                  // default
61 const int ZEROSTAMINA_HEARTRATE = 115;  // no stamina
62 const int MAX_HEARTRATE = 130;                  // maximum
63 const int ZERO_VOLUME = -40;                    // volume at zero
64 const int DMG_VOLUME = 5;                               // volume when taking damage
65 const int DEATH_VOLUME = 15;                    // volume at death
66
67 const int SAVING_THROW_TIME = 5000;             // maximum one "saving throw" every five seconds
68
69 const int ASYNC_PLAYER_INV_AMMO_BITS = idMath::BitsForInteger( 999 );   // 9 bits to cover the range [0, 999]
70 const int ASYNC_PLAYER_INV_CLIP_BITS = -7;                                                              // -7 bits to cover the range [-1, 60]
71
72 struct idItemInfo {
73         idStr name;
74         idStr icon;
75 };
76
77 struct idObjectiveInfo {
78         idStr title;
79         idStr text;
80         idStr screenshot;
81 };
82
83 struct idLevelTriggerInfo {
84         idStr levelName;
85         idStr triggerName;
86 };
87
88 // powerups - the "type" in item .def must match
89 enum {
90         BERSERK = 0, 
91         INVISIBILITY,
92         MEGAHEALTH,
93         ADRENALINE,
94         MAX_POWERUPS
95 };
96
97 // powerup modifiers
98 enum {
99         SPEED = 0,
100         PROJECTILE_DAMAGE,
101         MELEE_DAMAGE,
102         MELEE_DISTANCE
103 };
104
105 // influence levels
106 enum {
107         INFLUENCE_NONE = 0,                     // none
108         INFLUENCE_LEVEL1,                       // no gun or hud
109         INFLUENCE_LEVEL2,                       // no gun, hud, movement
110         INFLUENCE_LEVEL3,                       // slow player movement
111 };
112
113 class idInventory {
114 public:
115         int                                             maxHealth;
116         int                                             weapons;
117         int                                             powerups;
118         int                                             armor;
119         int                                             maxarmor;
120         int                                             ammo[ AMMO_NUMTYPES ];
121         int                                             clip[ MAX_WEAPONS ];
122         int                                             powerupEndTime[ MAX_POWERUPS ];
123
124         // mp
125         int                                             ammoPredictTime;
126
127         int                                             deplete_armor;
128         float                                   deplete_rate;
129         int                                             deplete_ammount;
130         int                                             nextArmorDepleteTime;
131
132         int                                             pdasViewed[4]; // 128 bit flags for indicating if a pda has been viewed
133
134         int                                             selPDA;
135         int                                             selEMail;
136         int                                             selVideo;
137         int                                             selAudio;
138         bool                                    pdaOpened;
139         bool                                    turkeyScore;
140         idList<idDict *>                items;
141         idStrList                               pdas;
142         idStrList                               pdaSecurity;
143         idStrList                               videos;
144         idStrList                               emails;
145
146         bool                                    ammoPulse;
147         bool                                    weaponPulse;
148         bool                                    armorPulse;
149         int                                             lastGiveTime;
150
151         idList<idLevelTriggerInfo> levelTriggers;
152
153                                                         idInventory() { Clear(); }
154                                                         ~idInventory() { Clear(); }
155
156         // save games
157         void                                    Save( idSaveGame *savefile ) const;                                     // archives object for save game file
158         void                                    Restore( idRestoreGame *savefile );                                     // unarchives object from save game file
159
160         void                                    Clear( void );
161         void                                    GivePowerUp( idPlayer *player, int powerup, int msec );
162         void                                    ClearPowerUps( void );
163         void                                    GetPersistantData( idDict &dict );
164         void                                    RestoreInventory( idPlayer *owner, const idDict &dict );
165         bool                                    Give( idPlayer *owner, const idDict &spawnArgs, const char *statname, const char *value, int *idealWeapon, bool updateHud );
166         void                                    Drop( const idDict &spawnArgs, const char *weapon_classname, int weapon_index );
167         ammo_t                                  AmmoIndexForAmmoClass( const char *ammo_classname ) const;
168         int                                             MaxAmmoForAmmoClass( idPlayer *owner, const char *ammo_classname ) const;
169         int                                             WeaponIndexForAmmoClass( const idDict & spawnArgs, const char *ammo_classname ) const;
170         ammo_t                                  AmmoIndexForWeaponClass( const char *weapon_classname, int *ammoRequired );
171         const char *                    AmmoPickupNameForIndex( ammo_t ammonum ) const;
172         void                                    AddPickupName( const char *name, const char *icon );
173
174         int                                             HasAmmo( ammo_t type, int amount );
175         bool                                    UseAmmo( ammo_t type, int amount );
176         int                                             HasAmmo( const char *weapon_classname );                        // looks up the ammo information for the weapon class first
177
178         void                                    UpdateArmor( void );
179
180         int                                             nextItemPickup;
181         int                                             nextItemNum;
182         int                                             onePickupTime;
183         idList<idItemInfo>              pickupItemNames;
184         idList<idObjectiveInfo> objectiveNames;
185 };
186
187 typedef struct {
188         int             time;
189         idVec3  dir;            // scaled larger for running
190 } loggedAccel_t;
191
192 typedef struct {
193         int             areaNum;
194         idVec3  pos;
195 } aasLocation_t;
196
197 class idPlayer : public idActor {
198 public:
199         enum {
200                 EVENT_IMPULSE = idEntity::EVENT_MAXEVENTS,
201                 EVENT_EXIT_TELEPORTER,
202                 EVENT_ABORT_TELEPORTER,
203                 EVENT_POWERUP,
204                 EVENT_SPECTATE,
205                 EVENT_MAXEVENTS
206         };
207
208         usercmd_t                               usercmd;
209
210         class idPlayerView              playerView;                     // handles damage kicks and effects
211
212         bool                                    noclip;
213         bool                                    godmode;
214
215         bool                                    spawnAnglesSet;         // on first usercmd, we must set deltaAngles
216         idAngles                                spawnAngles;
217         idAngles                                viewAngles;                     // player view angles
218         idAngles                                cmdAngles;                      // player cmd angles
219
220         int                                             buttonMask;
221         int                                             oldButtons;
222         int                                             oldFlags;
223
224         int                                             lastHitTime;                    // last time projectile fired by player hit target
225         int                                             lastSndHitTime;                 // MP hit sound - != lastHitTime because we throttle
226         int                                             lastSavingThrowTime;    // for the "free miss" effect
227
228         idScriptBool                    AI_FORWARD;
229         idScriptBool                    AI_BACKWARD;
230         idScriptBool                    AI_STRAFE_LEFT;
231         idScriptBool                    AI_STRAFE_RIGHT;
232         idScriptBool                    AI_ATTACK_HELD;
233         idScriptBool                    AI_WEAPON_FIRED;
234         idScriptBool                    AI_JUMP;
235         idScriptBool                    AI_CROUCH;
236         idScriptBool                    AI_ONGROUND;
237         idScriptBool                    AI_ONLADDER;
238         idScriptBool                    AI_DEAD;
239         idScriptBool                    AI_RUN;
240         idScriptBool                    AI_PAIN;
241         idScriptBool                    AI_HARDLANDING;
242         idScriptBool                    AI_SOFTLANDING;
243         idScriptBool                    AI_RELOAD;
244         idScriptBool                    AI_TELEPORT;
245         idScriptBool                    AI_TURN_LEFT;
246         idScriptBool                    AI_TURN_RIGHT;
247
248         // inventory
249         idInventory                             inventory;
250
251         idEntityPtr<idWeapon>   weapon;
252         idUserInterface *               hud;                            // MP: is NULL if not local player
253         idUserInterface *               objectiveSystem;
254         bool                                    objectiveSystemOpen;
255
256         int                                             weapon_soulcube;
257         int                                             weapon_pda;
258         int                                             weapon_fists;
259
260         int                                             heartRate;
261         idInterpolate<float>    heartInfo;
262         int                                             lastHeartAdjust;
263         int                                             lastHeartBeat;
264         int                                             lastDmgTime;
265         int                                             deathClearContentsTime;
266         bool                                    doingDeathSkin;
267         int                                             lastArmorPulse;         // lastDmgTime if we had armor at time of hit
268         float                                   stamina;
269         float                                   healthPool;                     // amount of health to give over time
270         int                                             nextHealthPulse;
271         bool                                    healthPulse;
272         bool                                    healthTake;
273         int                                             nextHealthTake;
274
275
276         bool                                    hiddenWeapon;           // if the weapon is hidden ( in noWeapons maps )
277         idEntityPtr<idProjectile> soulCubeProjectile;
278
279         // mp stuff
280         static idVec3                   colorBarTable[ 5 ];
281         int                                             spectator;
282         idVec3                                  colorBar;                       // used for scoreboard and hud display
283         int                                             colorBarIndex;
284         bool                                    scoreBoardOpen;
285         bool                                    forceScoreBoard;
286         bool                                    forceRespawn;
287         bool                                    spectating;
288         int                                             lastSpectateTeleport;
289         bool                                    lastHitToggle;
290         bool                                    forcedReady;
291         bool                                    wantSpectate;           // from userInfo
292         bool                                    weaponGone;                     // force stop firing
293         bool                                    useInitialSpawns;       // toggled by a map restart to be active for the first game spawn
294         int                                             latchedTeam;            // need to track when team gets changed
295         int                                             tourneyRank;            // for tourney cycling - the higher, the more likely to play next - server
296         int                                             tourneyLine;            // client side - our spot in the wait line. 0 means no info.
297         int                                             spawnedTime;            // when client first enters the game
298
299         idEntityPtr<idEntity>   teleportEntity;         // while being teleported, this is set to the entity we'll use for exit
300         int                                             teleportKiller;         // entity number of an entity killing us at teleporter exit
301         bool                                    lastManOver;            // can't respawn in last man anymore (srv only)
302         bool                                    lastManPlayAgain;       // play again when end game delay is cancelled out before expiring (srv only)
303         bool                                    lastManPresent;         // true when player was in when game started (spectators can't join a running LMS)
304         bool                                    isLagged;                       // replicated from server, true if packets haven't been received from client.
305         bool                                    isChatting;                     // replicated from server, true if the player is chatting.
306
307         // timers
308         int                                             minRespawnTime;         // can respawn when time > this, force after g_forcerespawn
309         int                                             maxRespawnTime;         // force respawn after this time
310
311         // the first person view values are always calculated, even
312         // if a third person view is used
313         idVec3                                  firstPersonViewOrigin;
314         idMat3                                  firstPersonViewAxis;
315
316         idDragEntity                    dragEntity;
317
318 public:
319         CLASS_PROTOTYPE( idPlayer );
320
321                                                         idPlayer();
322         virtual                                 ~idPlayer();
323
324         void                                    Spawn( void );
325         void                                    Think( void );
326
327         // save games
328         void                                    Save( idSaveGame *savefile ) const;                                     // archives object for save game file
329         void                                    Restore( idRestoreGame *savefile );                                     // unarchives object from save game file
330
331         virtual void                    Hide( void );
332         virtual void                    Show( void );
333
334         void                                    Init( void );
335         void                                    PrepareForRestart( void );
336         virtual void                    Restart( void );
337         void                                    LinkScriptVariables( void );
338         void                                    SetupWeaponEntity( void );
339         void                                    SelectInitialSpawnPoint( idVec3 &origin, idAngles &angles );
340         void                                    SpawnFromSpawnSpot( void );
341         void                                    SpawnToPoint( const idVec3      &spawn_origin, const idAngles &spawn_angles );
342         void                                    SetClipModel( void );   // spectator mode uses a different bbox size
343
344         void                                    SavePersistantInfo( void );
345         void                                    RestorePersistantInfo( void );
346         void                                    SetLevelTrigger( const char *levelName, const char *triggerName );
347
348         bool                                    UserInfoChanged( bool canModify );
349         idDict *                                GetUserInfo( void );
350         bool                                    BalanceTDM( void );
351
352         void                                    CacheWeapons( void );
353
354         void                                    EnterCinematic( void );
355         void                                    ExitCinematic( void );
356         bool                                    HandleESC( void );
357         bool                                    SkipCinematic( void );
358
359         void                                    UpdateConditions( void );
360         void                                    SetViewAngles( const idAngles &angles );
361
362                                                         // delta view angles to allow movers to rotate the view of the player
363         void                                    UpdateDeltaViewAngles( const idAngles &angles );
364
365         virtual bool                    Collide( const trace_t &collision, const idVec3 &velocity );
366
367         virtual void                    GetAASLocation( idAAS *aas, idVec3 &pos, int &areaNum ) const;
368         virtual void                    GetAIAimTargets( const idVec3 &lastSightPos, idVec3 &headPos, idVec3 &chestPos );
369         virtual void                    DamageFeedback( idEntity *victim, idEntity *inflictor, int &damage );
370         void                                    CalcDamagePoints(  idEntity *inflictor, idEntity *attacker, const idDict *damageDef,
371                                                            const float damageScale, const int location, int *health, int *armor );
372         virtual void                    Damage( idEntity *inflictor, idEntity *attacker, const idVec3 &dir, const char *damageDefName, const float damageScale, const int location );
373
374                                                         // use exitEntityNum to specify a teleport with private camera view and delayed exit
375         virtual void                    Teleport( const idVec3 &origin, const idAngles &angles, idEntity *destination );
376
377         void                                    Kill( bool delayRespawn, bool nodamage );
378         virtual void                    Killed( idEntity *inflictor, idEntity *attacker, int damage, const idVec3 &dir, int location );
379         void                                    StartFxOnBone(const char *fx, const char *bone);
380
381         renderView_t *                  GetRenderView( void );
382         void                                    CalculateRenderView( void );    // called every tic by player code
383         void                                    CalculateFirstPersonView( void );
384
385         void                                    DrawHUD( idUserInterface *hud );
386
387         void                                    WeaponFireFeedback( const idDict *weaponDef );
388
389         float                                   DefaultFov( void ) const;
390         float                                   CalcFov( bool honorZoom );
391         void                                    CalculateViewWeaponPos( idVec3 &origin, idMat3 &axis );
392         idVec3                                  GetEyePosition( void ) const;
393         void                                    GetViewPos( idVec3 &origin, idMat3 &axis ) const;
394         void                                    OffsetThirdPersonView( float angle, float range, float height, bool clip );
395
396         bool                                    Give( const char *statname, const char *value );
397         bool                                    GiveItem( idItem *item );
398         void                                    GiveItem( const char *name );
399         void                                    GiveHealthPool( float amt );
400         
401         bool                                    GiveInventoryItem( idDict *item );
402         void                                    RemoveInventoryItem( idDict *item );
403         bool                                    GiveInventoryItem( const char *name );
404         void                                    RemoveInventoryItem( const char *name );
405         idDict *                                FindInventoryItem( const char *name );
406
407         void                                    GivePDA( const char *pdaName, idDict *item );
408         void                                    GiveVideo( const char *videoName, idDict *item );
409         void                                    GiveEmail( const char *emailName );
410         void                                    GiveSecurity( const char *security );
411         void                                    GiveObjective( const char *title, const char *text, const char *screenshot );
412         void                                    CompleteObjective( const char *title );
413
414         bool                                    GivePowerUp( int powerup, int time );
415         void                                    ClearPowerUps( void );
416         bool                                    PowerUpActive( int powerup ) const;
417         float                                   PowerUpModifier( int type );
418
419         int                                             SlotForWeapon( const char *weaponName );
420         void                                    Reload( void );
421         void                                    NextWeapon( void );
422         void                                    NextBestWeapon( void );
423         void                                    PrevWeapon( void );
424         void                                    SelectWeapon( int num, bool force );
425         void                                    DropWeapon( bool died ) ;
426         void                                    StealWeapon( idPlayer *player );
427         void                                    AddProjectilesFired( int count );
428         void                                    AddProjectileHits( int count );
429         void                                    SetLastHitTime( int time );
430         void                                    LowerWeapon( void );
431         void                                    RaiseWeapon( void );
432         void                                    WeaponLoweringCallback( void );
433         void                                    WeaponRisingCallback( void );
434         void                                    RemoveWeapon( const char *weap );
435         bool                                    CanShowWeaponViewmodel( void ) const;
436
437         void                                    AddAIKill( void );
438         void                                    SetSoulCubeProjectile( idProjectile *projectile );
439
440         void                                    AdjustHeartRate( int target, float timeInSecs, float delay, bool force );
441         void                                    SetCurrentHeartRate( void );
442         int                                             GetBaseHeartRate( void );
443         void                                    UpdateAir( void );
444
445         virtual bool                    HandleSingleGuiCommand( idEntity *entityGui, idLexer *src );
446         bool                                    GuiActive( void ) { return focusGUIent != NULL; }
447
448         void                                    PerformImpulse( int impulse );
449         void                                    Spectate( bool spectate );
450         void                                    TogglePDA( void );
451         void                                    ToggleScoreboard( void );
452         void                                    RouteGuiMouse( idUserInterface *gui );
453         void                                    UpdateHud( void );
454         const idDeclPDA *               GetPDA( void ) const;
455         const idDeclVideo *             GetVideo( int index );
456         void                                    SetInfluenceFov( float fov );
457         void                                    SetInfluenceView( const char *mtr, const char *skinname, float radius, idEntity *ent );
458         void                                    SetInfluenceLevel( int level );
459         int                                             GetInfluenceLevel( void ) { return influenceActive; };
460         void                                    SetPrivateCameraView( idCamera *camView );
461         idCamera *                              GetPrivateCameraView( void ) const { return privateCameraView; }
462         void                                    StartFxFov( float duration  );
463         void                                    UpdateHudWeapon( bool flashWeapon = true );
464         void                                    UpdateHudStats( idUserInterface *hud );
465         void                                    UpdateHudAmmo( idUserInterface *hud );
466         void                                    Event_StopAudioLog( void );
467         void                                    StartAudioLog( void );
468         void                                    StopAudioLog( void );
469         void                                    ShowTip( const char *title, const char *tip, bool autoHide );
470         void                                    HideTip( void );
471         bool                                    IsTipVisible( void ) { return tipUp; };
472         void                                    ShowObjective( const char *obj );
473         void                                    HideObjective( void );
474
475         virtual void                    ClientPredictionThink( void );
476         virtual void                    WriteToSnapshot( idBitMsgDelta &msg ) const;
477         virtual void                    ReadFromSnapshot( const idBitMsgDelta &msg );
478         void                                    WritePlayerStateToSnapshot( idBitMsgDelta &msg ) const;
479         void                                    ReadPlayerStateFromSnapshot( const idBitMsgDelta &msg );
480
481         virtual bool                    ServerReceiveEvent( int event, int time, const idBitMsg &msg );
482
483         virtual bool                    GetPhysicsToVisualTransform( idVec3 &origin, idMat3 &axis );
484         virtual bool                    GetPhysicsToSoundTransform( idVec3 &origin, idMat3 &axis );
485
486         virtual bool                    ClientReceiveEvent( int event, int time, const idBitMsg &msg );
487         bool                                    IsReady( void );
488         bool                                    IsRespawning( void );
489         bool                                    IsInTeleport( void );
490
491         idEntity                                *GetInfluenceEntity( void ) { return influenceEntity; };
492         const idMaterial                *GetInfluenceMaterial( void ) { return influenceMaterial; };
493         float                                   GetInfluenceRadius( void ) { return influenceRadius; };
494
495         // server side work for in/out of spectate. takes care of spawning it into the world as well
496         void                                    ServerSpectate( bool spectate );
497         // for very specific usage. != GetPhysics()
498         idPhysics                               *GetPlayerPhysics( void );
499         void                                    TeleportDeath( int killer );
500         void                                    SetLeader( bool lead );
501         bool                                    IsLeader( void );
502
503         void                                    UpdateSkinSetup( bool restart );
504
505         bool                                    OnLadder( void ) const;
506
507         virtual void                    UpdatePlayerIcons( void );
508         virtual void                    DrawPlayerIcons( void );
509         virtual void                    HidePlayerIcons( void );
510         bool                                    NeedsIcon( void );
511
512         bool                                    SelfSmooth( void );
513         void                                    SetSelfSmooth( bool b );
514
515 private:
516         jointHandle_t                   hipJoint;
517         jointHandle_t                   chestJoint;
518         jointHandle_t                   headJoint;
519
520         idPhysics_Player                physicsObj;                     // player physics
521
522         idList<aasLocation_t>   aasLocation;            // for AI tracking the player
523
524         int                                             bobFoot;
525         float                                   bobFrac;
526         float                                   bobfracsin;
527         int                                             bobCycle;                       // for view bobbing and footstep generation
528         float                                   xyspeed;
529         int                                             stepUpTime;
530         float                                   stepUpDelta;
531         float                                   idealLegsYaw;
532         float                                   legsYaw;
533         bool                                    legsForward;
534         float                                   oldViewYaw;
535         idAngles                                viewBobAngles;
536         idVec3                                  viewBob;
537         int                                             landChange;
538         int                                             landTime;
539
540         int                                             currentWeapon;
541         int                                             idealWeapon;
542         int                                             previousWeapon;
543         int                                             weaponSwitchTime;
544         bool                                    weaponEnabled;
545         bool                                    showWeaponViewModel;
546
547         const idDeclSkin *              skin;
548         const idDeclSkin *              powerUpSkin;
549         idStr                                   baseSkinName;
550
551         int                                             numProjectilesFired;    // number of projectiles fired
552         int                                             numProjectileHits;              // number of hits on mobs
553
554         bool                                    airless;
555         int                                             airTics;                                // set to pm_airTics at start, drops in vacuum
556         int                                             lastAirDamage;
557
558         bool                                    gibDeath;
559         bool                                    gibsLaunched;
560         idVec3                                  gibsDir;
561
562         idInterpolate<float>    zoomFov;
563         idInterpolate<float>    centerView;
564         bool                                    fxFov;
565
566         float                                   influenceFov;
567         int                                             influenceActive;                // level of influence.. 1 == no gun or hud .. 2 == 1 + no movement
568         idEntity *                              influenceEntity;
569         const idMaterial *              influenceMaterial;
570         float                                   influenceRadius;
571         const idDeclSkin *              influenceSkin;
572
573         idCamera *                              privateCameraView;
574
575         static const int                NUM_LOGGED_VIEW_ANGLES = 64;            // for weapon turning angle offsets
576         idAngles                                loggedViewAngles[NUM_LOGGED_VIEW_ANGLES];       // [gameLocal.framenum&(LOGGED_VIEW_ANGLES-1)]
577         static const int                NUM_LOGGED_ACCELS = 16;                 // for weapon turning angle offsets
578         loggedAccel_t                   loggedAccel[NUM_LOGGED_ACCELS]; // [currentLoggedAccel & (NUM_LOGGED_ACCELS-1)]
579         int                                             currentLoggedAccel;
580
581         // if there is a focusGUIent, the attack button will be changed into mouse clicks
582         idEntity *                              focusGUIent;
583         idUserInterface *               focusUI;                                // focusGUIent->renderEntity.gui, gui2, or gui3
584         idAI *                                  focusCharacter;
585         int                                             talkCursor;                             // show the state of the focusCharacter (0 == can't talk/dead, 1 == ready to talk, 2 == busy talking)
586         int                                             focusTime;
587         idAFEntity_Vehicle *    focusVehicle;
588         idUserInterface *               cursor;
589         
590         // full screen guis track mouse movements directly
591         int                                             oldMouseX;
592         int                                             oldMouseY;
593
594         idStr                                   pdaAudio;
595         idStr                                   pdaVideo;
596         idStr                                   pdaVideoWave;
597
598         bool                                    tipUp;
599         bool                                    objectiveUp;
600
601         int                                             lastDamageDef;
602         idVec3                                  lastDamageDir;
603         int                                             lastDamageLocation;
604         int                                             smoothedFrame;
605         bool                                    smoothedOriginUpdated;
606         idVec3                                  smoothedOrigin;
607         idAngles                                smoothedAngles;
608
609         // mp
610         bool                                    ready;                                  // from userInfo
611         bool                                    respawning;                             // set to true while in SpawnToPoint for telefrag checks
612         bool                                    leader;                                 // for sudden death situations
613         int                                             lastSpectateChange;
614         int                                             lastTeleFX;
615         unsigned int                    lastSnapshotSequence;   // track state hitches on clients
616         bool                                    weaponCatchup;                  // raise up the weapon silently ( state catchups )
617         int                                             MPAim;                                  // player num in aim
618         int                                             lastMPAim;
619         int                                             lastMPAimTime;                  // last time the aim changed
620         int                                             MPAimFadeTime;                  // for GUI fade
621         bool                                    MPAimHighlight;
622         bool                                    isTelefragged;                  // proper obituaries
623
624         idPlayerIcon                    playerIcon;
625
626         bool                                    selfSmooth;
627
628         void                                    LookAtKiller( idEntity *inflictor, idEntity *attacker );
629
630         void                                    StopFiring( void );
631         void                                    FireWeapon( void );
632         void                                    Weapon_Combat( void );
633         void                                    Weapon_NPC( void );
634         void                                    Weapon_GUI( void );
635         void                                    UpdateWeapon( void );
636         void                                    UpdateSpectating( void );
637         void                                    SpectateFreeFly( bool force );  // ignore the timeout to force when followed spec is no longer valid
638         void                                    SpectateCycle( void );
639         idAngles                                GunTurningOffset( void );
640         idVec3                                  GunAcceleratingOffset( void );
641
642         void                                    UseObjects( void );
643         void                                    CrashLand( const idVec3 &oldOrigin, const idVec3 &oldVelocity );
644         void                                    BobCycle( const idVec3 &pushVelocity );
645         void                                    UpdateViewAngles( void );
646         void                                    EvaluateControls( void );
647         void                                    AdjustSpeed( void );
648         void                                    AdjustBodyAngles( void );
649         void                                    InitAASLocation( void );
650         void                                    SetAASLocation( void );
651         void                                    Move( void );
652         void                                    UpdatePowerUps( void );
653         void                                    UpdateDeathSkin( bool state_hitch );
654         void                                    ClearPowerup( int i );
655         void                                    SetSpectateOrigin( void );
656
657         void                                    ClearFocus( void );
658         void                                    UpdateFocus( void );
659         void                                    UpdateLocation( void );
660         idUserInterface *               ActiveGui( void );
661         void                                    UpdatePDAInfo( bool updatePDASel );
662         int                                             AddGuiPDAData( const declType_t dataType, const char *listName, const idDeclPDA *src, idUserInterface *gui );
663         void                                    ExtractEmailInfo( const idStr &email, const char *scan, idStr &out );
664         void                                    UpdateObjectiveInfo( void );
665
666         void                                    UseVehicle( void );
667
668         void                                    Event_GetButtons( void );
669         void                                    Event_GetMove( void );
670         void                                    Event_GetViewAngles( void );
671         void                                    Event_StopFxFov( void );
672         void                                    Event_EnableWeapon( void );
673         void                                    Event_DisableWeapon( void );
674         void                                    Event_GetCurrentWeapon( void );
675         void                                    Event_GetPreviousWeapon( void );
676         void                                    Event_SelectWeapon( const char *weaponName );
677         void                                    Event_GetWeaponEntity( void );
678         void                                    Event_OpenPDA( void );
679         void                                    Event_PDAAvailable( void );
680         void                                    Event_InPDA( void );
681         void                                    Event_ExitTeleporter( void );
682         void                                    Event_HideTip( void );
683         void                                    Event_LevelTrigger( void );
684         void                                    Event_Gibbed( void );
685         void                                    Event_GetIdealWeapon( void );
686 };
687
688 ID_INLINE bool idPlayer::IsReady( void ) {
689         return ready || forcedReady;
690 }
691
692 ID_INLINE bool idPlayer::IsRespawning( void ) {
693         return respawning;
694 }
695
696 ID_INLINE idPhysics* idPlayer::GetPlayerPhysics( void ) {
697         return &physicsObj;
698 }
699
700 ID_INLINE bool idPlayer::IsInTeleport( void ) {
701         return ( teleportEntity.GetEntity() != NULL );
702 }
703
704 ID_INLINE void idPlayer::SetLeader( bool lead ) {
705         leader = lead;
706 }
707
708 ID_INLINE bool idPlayer::IsLeader( void ) {
709         return leader;
710 }
711
712 ID_INLINE bool idPlayer::SelfSmooth( void ) {
713         return selfSmooth;
714 }
715
716 ID_INLINE void idPlayer::SetSelfSmooth( bool b ) {
717         selfSmooth = b;
718 }
719
720 #endif /* !__GAME_PLAYER_H__ */
721