home *** CD-ROM | disk | FTP | other *** search
/ GameStar 2006 March / Gamestar_82_2006-03_dvd.iso / DVDStar / Editace / quake4_sdkv10.exe / source / game / Player.h < prev    next >
C/C++ Source or Header  |  2005-11-14  |  39KB  |  1,253 lines

  1. // RAVEN BEGIN
  2. // bdube: note that this file is no longer merged with Doom3 updates
  3. //
  4. // MERGE_DATE 07/07/2004
  5.  
  6. #ifndef __GAME_PLAYER_H__
  7. #define __GAME_PLAYER_H__
  8.  
  9. /*
  10. ===============================================================================
  11.  
  12.     Player entity.
  13.     
  14. ===============================================================================
  15. */
  16.  
  17. extern const idEventDef EV_Player_GetButtons;
  18. extern const idEventDef EV_Player_GetMove;
  19. extern const idEventDef EV_Player_GetViewAngles;
  20. extern const idEventDef EV_Player_SetViewAngles;
  21. extern const idEventDef EV_Player_EnableWeapon;
  22. extern const idEventDef EV_Player_DisableWeapon;
  23. extern const idEventDef EV_Player_ExitTeleporter;
  24. extern const idEventDef EV_Player_SelectWeapon;
  25. extern const idEventDef EV_Player_Freeze;
  26. extern const idEventDef EV_SpectatorTouch;
  27. extern const idEventDef EV_Player_SetArmor;
  28. extern const idEventDef EV_Player_SetExtraProjPassEntity;
  29. extern const idEventDef EV_Player_DamageEffect;
  30.  
  31. const float THIRD_PERSON_FOCUS_DISTANCE    = 512.0f;
  32. const int    LAND_DEFLECT_TIME            = 150;
  33. const int    LAND_RETURN_TIME            = 300;
  34. const int    FOCUS_TIME                    = 200;
  35. const int    FOCUS_GUI_TIME                = 300;
  36. const int    FOCUS_USABLE_TIME            = 100;
  37.  
  38. const int    MAX_WEAPONS                    = 16;
  39. const int    MAX_AMMO                    = 16;
  40.  
  41. const int    MAX_SKILL_LEVELS            = 4;
  42.  
  43. const int    ZERO_VOLUME                    = -40;            // volume at zero
  44. const int    DMG_VOLUME                    = 5;            // volume when taking damage
  45. const int    DEATH_VOLUME                = 15;            // volume at death
  46.  
  47. const int    SAVING_THROW_TIME            = 5000;            // maximum one "saving throw" every five seconds
  48.  
  49. const int    ASYNC_PLAYER_INV_AMMO_BITS = idMath::BitsForInteger( 999 );    // 9 bits to cover the range [0, 999]
  50. const int    ASYNC_PLAYER_INV_CLIP_BITS = -7;                                // -7 bits to cover the range [-1, 60]
  51. const int    ASYNC_PLAYER_INV_WPMOD_BITS = 3;                                // 3 bits (max of 3 mods per gun)
  52.  
  53. // RAVEN BEGIN
  54. // jnewquist: Xenon weapon combo system
  55. #ifdef _XENON
  56. typedef struct
  57. {
  58.     int up;
  59.     int down;
  60.     int left;
  61.     int right;
  62. } nextWeaponCombo_t;
  63. #endif
  64. // RAVEN END
  65.  
  66. typedef enum {
  67.     FOCUS_NONE,
  68.     FOCUS_GUI,
  69.     FOCUS_BRACKETS,
  70.     FOCUS_VEHICLE,
  71.     FOCUS_LOCKED_VEHICLE,
  72.     FOCUS_USABLE,
  73.     FOCUS_USABLE_VEHICLE,
  74.     FOCUS_CHARACTER,
  75.     FOCUS_MAX
  76. } playerFocus_t;
  77.  
  78. struct idItemInfo {
  79.     idStr name;
  80.     idStr icon;
  81. };
  82.  
  83. struct idObjectiveInfo {
  84.     idStr title;
  85.     idStr text;
  86.     idStr screenshot;
  87. };
  88.  
  89. struct idLevelTriggerInfo {
  90.     idStr levelName;
  91.     idStr triggerName;
  92. };
  93. /*
  94. struct rvDatabaseEntry {
  95.     idStr title;
  96.     idStr text;
  97.     idStr image;
  98.     idStr filter;
  99. };
  100. */
  101. typedef struct {
  102.     int        time;
  103.     idVec3    dir;        // scaled larger for running
  104. } loggedAccel_t;
  105.  
  106. typedef struct {
  107.      int        areaNum;
  108.      idVec3    pos;
  109. } aasLocation_t;
  110.  
  111. // powerups
  112. enum {
  113.     // standard powerups
  114.     POWERUP_QUADDAMAGE = 0, 
  115.     POWERUP_HASTE,
  116.     POWERUP_REGENERATION,
  117.     POWERUP_INVISIBILITY,
  118.         
  119.     // ctf powerups
  120.     POWERUP_CTF_MARINEFLAG,
  121.     POWERUP_CTF_STROGGFLAG,
  122.     POWERUP_CTF_ONEFLAG,
  123.  
  124.     // persistant powerups, keep these with ammo regen first and scout last or persistance breaks
  125.     POWERUP_AMMOREGEN,
  126.     POWERUP_GUARD,
  127.     POWERUP_DOUBLER,
  128.     POWERUP_SCOUT,
  129.     
  130.     POWERUP_MAX
  131. };
  132.  
  133. enum {
  134.     PMOD_SPEED = 0,
  135.     PMOD_PROJECTILE_DAMAGE,
  136.     PMOD_MELEE_DAMAGE,
  137.     PMOD_MELEE_DISTANCE,
  138.     PMOD_PROJECTILE_DEATHPUSH,
  139.     PMOD_FIRERATE,
  140.     PMOD_MAX
  141. };
  142.  
  143. typedef enum {
  144.     PE_NONE,
  145.     PE_GRAB_A,
  146.     PE_GRAB_B,
  147.     PE_SALUTE,
  148.     PE_CHEER,
  149.     PE_TAUNT
  150. } playerEmote_t;
  151.  
  152. // influence levels
  153. enum {
  154.     INFLUENCE_NONE = 0,            // none
  155.     INFLUENCE_LEVEL1,            // no gun or hud
  156.     INFLUENCE_LEVEL2,            // no gun, hud, movement
  157.     INFLUENCE_LEVEL3,            // slow player movement
  158. };
  159.  
  160. typedef enum { 
  161.     PTS_UNKNOWN = 0,
  162.     PTS_ADVANCED,
  163.     PTS_ELIMINATED,
  164.     PTS_PLAYING,
  165.     PTS_NUM_STATES
  166. } playerTourneyStatus_t;
  167.  
  168. const int    ASYNC_PLAYER_TOURNEY_STATUS_BITS = idMath::BitsForInteger( PTS_NUM_STATES );
  169.  
  170. class idInventory {
  171. public:
  172.     int                        maxHealth;
  173.     int                        weapons;
  174.     int                        powerups;
  175.     int                        armor;
  176.     int                        maxarmor;
  177.     int                        ammo[ MAX_AMMO ];
  178.     int                        clip[ MAX_WEAPONS ];
  179.     int                        powerupEndTime[ POWERUP_MAX ];
  180.     int                        weaponMods[ MAX_WEAPONS ];
  181.  
  182.      // multiplayer
  183.      int                        ammoPredictTime;
  184.     int                        ammoRegenStep[ MAX_WEAPONS ];
  185.     int                        ammoRegenTime[ MAX_WEAPONS ];
  186.     int                        ammoIndices[ MAX_WEAPONS ];
  187.     int                        startingAmmo[ MAX_WEAPONS ];
  188.  
  189.      int                        lastGiveTime;
  190.      
  191.     idList<idDict *>        items;
  192.     idStrList                pdas;
  193.     idStrList                pdaSecurity;
  194.     idStrList                videos;
  195.  
  196.     idList<idLevelTriggerInfo> levelTriggers;
  197.  
  198.                             idInventory() { Clear(); }
  199.                             ~idInventory() { Clear(); }
  200.  
  201.     // save games
  202.     void                    Save( idSaveGame *savefile ) const;                    // archives object for save game file
  203.     void                    Restore( idRestoreGame *savefile );                    // unarchives object from save game file
  204.  
  205.     void                    Clear( void );
  206.     void                    GivePowerUp( idPlayer* player, int powerup, int msec );
  207.     void                    ClearPowerUps( void );
  208.     void                    GetPersistantData( idDict &dict );
  209.     void                    RestoreInventory( idPlayer *owner, const idDict &dict );
  210.     bool                    Give( idPlayer *owner, const idDict &spawnArgs, const char *statname, const char *value, int *idealWeapon, bool updateHud, bool dropped = false );
  211.     void                    Drop( const idDict &spawnArgs, const char *weapon_classname, int weapon_index );
  212.     int                        AmmoIndexForAmmoClass( const char *ammo_classname ) const;
  213.     int                        MaxAmmoForAmmoClass( idPlayer *owner, const char *ammo_classname ) const;
  214.     int                        AmmoIndexForWeaponClass( const char *weapon_classname, int *ammoRequired = NULL );
  215.     const char *            AmmoClassForWeaponClass( const char *weapon_classname);
  216.  
  217. // RAVEN BEGIN
  218. // mekberg: if the player can pick up the ammo at this time
  219.     bool                    DetermineAmmoAvailability( idPlayer* owner, const char *ammoName, int ammoIndex, int ammoAmount, int ammoMax );
  220. // RAVEN END
  221.     
  222.     int                        AmmoIndexForWeaponIndex( int weaponIndex );
  223.     int                        StartingAmmoForWeaponIndex( int weaponIndex );
  224.     int                        AmmoRegenStepForWeaponIndex( int weaponIndex );
  225.     int                        AmmoRegenTimeForWeaponIndex( int weaponIndex );
  226.  
  227.     int                        HasAmmo( int index, int amount );
  228.     bool                    UseAmmo( int index, int amount );
  229.     int                        HasAmmo( const char *weapon_classname );            // looks up the ammo information for the weapon class first
  230.  
  231.     int                        nextItemPickup;
  232.     int                        nextItemNum;
  233.     int                        onePickupTime;
  234.     idList<idItemInfo>        pickupItemNames;
  235.     idList<idObjectiveInfo>    objectiveNames;
  236. //    idList<rvDatabaseEntry>    database;
  237.     
  238.     int                        secretAreasDiscovered;
  239. };
  240.  
  241. class idPlayer : public idActor {
  242. public:
  243.  
  244. // RAVEN BEGIN   
  245. #ifdef _XENON
  246.      int rocketJumpStart;
  247.      int rocketJumpEnd;
  248. #endif
  249. // RAVEN END
  250.      
  251.      enum {
  252.          EVENT_IMPULSE = idEntity::EVENT_MAXEVENTS,
  253.          EVENT_EXIT_TELEPORTER,
  254.          EVENT_ABORT_TELEPORTER,
  255.          EVENT_POWERUP,
  256.          EVENT_SPECTATE,
  257.         EVENT_EMOTE,
  258.          EVENT_MAXEVENTS
  259.      };
  260.  
  261.     friend class idThread;
  262.  
  263.     usercmd_t                usercmd;
  264.  
  265.     class idPlayerView        playerView;            // handles damage kicks and effects
  266.  
  267.     bool                    noclip;
  268.     bool                    godmode;
  269.     int                        godmodeDamage;
  270.     bool                    undying;
  271.  
  272.     bool                    spawnAnglesSet;        // on first usercmd, we must set deltaAngles
  273.     idAngles                spawnAngles;
  274.     idAngles                viewAngles;            // player view angles
  275.     idAngles                cmdAngles;            // player cmd angles
  276.  
  277. // RAVEN BEGIN
  278. // mwhitlock: Xenon texture streaming.
  279. #if defined(_XENON)
  280.     bool                    streamingPrecache;
  281. #endif
  282. // RAVEN END
  283.  
  284.     int                        buttonMask;
  285.     int                        oldButtons;
  286.     int                        oldFlags;
  287.  
  288.     int                        lastHitTime;            // last time projectile fired by player hit target
  289.      int                        lastSndHitTime;            // MP hit sound - != lastHitTime because we throttle
  290.     int                        lastSavingThrowTime;    // for the "free miss" effect
  291.  
  292.     struct playerFlags_s {
  293.         bool        forward            :1;
  294.         bool        backward        :1;
  295.         bool        strafeLeft        :1;
  296.         bool        strafeRight        :1;
  297.         bool        attackHeld        :1;
  298.         bool        weaponFired        :1;
  299.         bool        jump            :1;
  300.         bool        crouch            :1;
  301.         bool        onGround        :1;
  302.         bool        onLadder        :1;
  303.         bool        dead            :1;
  304.         bool        run                :1;
  305.         bool        pain            :1;
  306.         bool        hardLanding        :1;
  307.         bool        softLanding        :1;
  308.         bool        reload            :1;
  309.         bool        teleport        :1;
  310.         bool        turnLeft        :1;
  311.         bool        turnRight        :1;
  312.         bool        hearingLoss        :1;
  313.         bool        objectiveFailed    :1;
  314.         bool        noFallingDamage :1;
  315.     } pfl;
  316.         
  317.     // inventory
  318.     idInventory                inventory;
  319.  
  320.     rvWeapon*                        weapon;
  321.     idEntityPtr<rvViewWeapon>        weaponViewModel;
  322.     idEntityPtr<idAnimatedEntity>    weaponWorldModel;
  323.     const idDeclEntityDef*            weaponDef;
  324.  
  325.  
  326.      idUserInterface *        hud;                // Common hud
  327.     idUserInterface *        mphud;                // hud overlay containing MP elements
  328.     
  329.     idUserInterface *        objectiveSystem;
  330.     idUserInterface *        cinematicHud;
  331.     bool                    objectiveSystemOpen;
  332.     bool                    objectiveButtonReleased;
  333.     bool                    disableHud;
  334.     bool                    showNewObjectives;
  335.  
  336.     int                        lastDmgTime;
  337.     int                        deathClearContentsTime;
  338.      bool                    doingDeathSkin;
  339.     int                        nextHealthPulse;    // time when health will tick down
  340.     int                        nextAmmoRegenPulse[ MAX_AMMO ];    // time when ammo will regenerate
  341.     int                        nextArmorPulse;        // time when armor will tick down
  342.     bool                    hiddenWeapon;        // if the weapon is hidden ( in noWeapons maps )
  343.  
  344.     // mp stuff
  345.     int                        spectator;
  346.  
  347.     bool                    scoreBoardOpen;
  348.     bool                    forceScoreBoard;
  349.     bool                    forceRespawn;
  350.     int                        forceScoreBoardTime;
  351.  
  352.     bool                    spectating;
  353.     bool                    lastHitToggle;
  354.     bool                    lastArmorHit;
  355.     bool                    forcedReady;
  356.     int                        lastArenaChange;
  357.     
  358.     bool                    wantSpectate;            // from userInfo
  359.     bool                    jumpDuringHitch;
  360.  
  361.      bool                    weaponGone;                // force stop firing
  362.      bool                    useInitialSpawns;        // toggled by a map restart to be active for the first game spawn
  363.      bool                    isLagged;                // replicated from server, true if packets haven't been received from client.
  364.      bool                    isChatting;                // replicated from server, true if the player is chatting.
  365.  
  366.     int                        lastSpectateTeleport;
  367.     int                        latchedTeam;            // need to track when team gets changed
  368.      int                        spawnedTime;            // when client first enters the game
  369.  
  370.      idEntityPtr<idEntity>    teleportEntity;            // while being teleported, this is set to the entity we'll use for exit
  371.     int                        teleportKiller;            // entity number of an entity killing us at teleporter exit
  372.  
  373.     idEntityPtr<idPlayer>    lastKiller;
  374.  
  375.     // timers
  376.     int                        minRespawnTime;            // can respawn when time > this, force after g_forcerespawn
  377.     int                        maxRespawnTime;            // force respawn after this time
  378.  
  379.     // the first person view values are always calculated, even
  380.     // if a third person view is used
  381.     idVec3                    firstPersonViewOrigin;
  382.     idMat3                    firstPersonViewAxis;
  383.  
  384.     idDragEntity            dragEntity;
  385.     idVec3                    intentDir;
  386.  
  387.     rvAASTacticalSensor*    aasSensor;
  388.  
  389.     idEntityPtr<idEntity>    extraProjPassEntity;
  390.     
  391.     bool                    vsMsgState;
  392.  
  393. //RAVEN BEGIN
  394. // asalmon: the eneny the player is most likely currently aiming at
  395. #ifdef _XBOX
  396.     idActor*                        bestEnemy;
  397. #endif
  398. //RAVEN END
  399.  
  400.  
  401. public:
  402.     CLASS_PROTOTYPE( idPlayer );
  403.  
  404.                             idPlayer();
  405.     virtual                    ~idPlayer();
  406.  
  407.     void                    Spawn( void );
  408.     void                    Think( void );
  409.  
  410.     // save games
  411.     void                    Save( idSaveGame *savefile ) const;                    // archives object for save game file
  412.     void                    Restore( idRestoreGame *savefile );                    // unarchives object from save game file
  413.  
  414.     static const char*        GetSpawnClassname ( void );
  415.  
  416.     virtual void            Hide( void );
  417.     virtual void            Show( void );
  418.  
  419.     void                    Init( void );
  420.      void                    PrepareForRestart( void );
  421.      virtual void            Restart( void );
  422.     void                    SetWeapon ( int weapon );
  423.     void                    SetupWeaponEntity( void );
  424.     bool                    SelectSpawnPoint( idVec3 &origin, idAngles &angles );
  425.     void                    SpawnFromSpawnSpot( void );
  426.     void                    SpawnToPoint( const idVec3    &spawn_origin, const idAngles &spawn_angles );
  427.     void                    SetClipModel( bool forceSpectatorBBox = false );    // spectator mode uses a different bbox size
  428.  
  429.     void                    SavePersistantInfo( void );
  430.     void                    RestorePersistantInfo( void );
  431.     void                    SetLevelTrigger( const char *levelName, const char *triggerName );
  432.  
  433.      bool                    UserInfoChanged( void );
  434.     idDict *                GetUserInfo( void );
  435. // RAVEN BEGIN
  436. // shouchard:  BalanceTDM->BalanceTeam (now used for CTF as well as TDM)
  437.     bool                    BalanceTeam( void );
  438. // RAVEN END
  439.     void                    CacheWeapons( void );
  440.  
  441.      bool                    HandleESC( void );
  442.        void                    EnterCinematic( void );
  443.        void                    ExitCinematic( void );
  444.      bool                    SkipCinematic( void );
  445.  
  446.     void                    UpdateConditions( void );
  447.     void                    SetViewAngles( const idAngles &angles );
  448.  
  449.     void                    BiasIntentDir            ( idVec3 newIntentDir, float prevBias = 199.0f );
  450.  
  451.                             // delta view angles to allow movers to rotate the view of the player
  452.     void                    UpdateDeltaViewAngles( const idAngles &angles );
  453.  
  454.     virtual bool            Collide( const trace_t &collision, const idVec3 &velocity );
  455.  
  456.      virtual void            GetAASLocation( idAAS *aas, idVec3 &pos, int &areaNum ) const;
  457.      virtual void            DamageFeedback( idEntity *victim, idEntity *inflictor, int &damage );
  458.     void                    CalcDamagePoints(  idEntity *inflictor, idEntity *attacker, const idDict *damageDef,
  459.                                const float damageScale, const int location, int *health, int *armor );
  460.     virtual    void            Damage( idEntity *inflictor, idEntity *attacker, const idVec3 &dir, const char *damageDefName, const float damageScale, const int location );
  461.     virtual void            AddDamageEffect( const trace_t &collision, const idVec3 &velocity, const char *damageDefName, idEntity* inflictor );
  462.                              // use exitEntityNum to specify a teleport with private camera view and delayed exit
  463.      virtual void            Teleport( const idVec3 &origin, const idAngles &angles, idEntity *destination );
  464.  
  465.     virtual void            GetDebugInfo ( debugInfoProc_t proc, void* userData );
  466.  
  467.     virtual bool            CanDamage( const idVec3 &origin, idVec3 &damagePoint, idEntity *ignoreEnt );
  468.  
  469.      void                    Kill( bool delayRespawn, bool nodamage );
  470.     virtual void            Killed( idEntity *inflictor, idEntity *attacker, int damage, const idVec3 &dir, int location );
  471.  
  472.     renderView_t *            GetRenderView( void );
  473.     void                    SmoothenRenderView( bool firstPerson );
  474.     void                    CalculateRenderView( void );    // called every tic by player code
  475.     void                    CalculateFirstPersonView( void );
  476.     
  477.     void                    DrawShadow( renderEntity_t *headRenderEnt );
  478.     void                    DrawHUD( idUserInterface *hud );
  479.     void                    StartRadioChatter ( void );
  480.     void                    StopRadioChatter ( void );
  481.  
  482.     void                    WeaponFireFeedback( const idDict *weaponDef );
  483.  
  484.      float                    DefaultFov( void ) const;
  485.      float                    CalcFov( bool honorZoom );
  486.     void                    CalculateViewWeaponPos( idVec3 &origin, idMat3 &axis );
  487.     void                    GetViewPos( idVec3 &origin, idMat3 &axis ) const;
  488.      void                    OffsetThirdPersonView( float angle, float range, float height, bool clip );
  489. // RAVEN BEGIN
  490. // jnewquist: option to avoid clipping against world
  491.     void                    OffsetThirdPersonVehicleView    ( bool clip );
  492. // RAVEN END
  493.     bool                    OffsetThirdPersonTargetView        ( void );
  494.  
  495.     bool                    Give( const char *statname, const char *value, bool dropped = false );
  496.     bool                    GiveItem( idItem *item );
  497.     void                    GiveItem( const char *name );
  498.     
  499.     // Inventory
  500.     bool                    GiveInventoryItem( idDict *item );
  501.     void                    RemoveInventoryItem( idDict *item );
  502.     bool                    GiveInventoryItem( const char *name );
  503.     void                    RemoveInventoryItem( const char *name );
  504.     idDict *                FindInventoryItem( const char *name );
  505.  
  506.     // Wrist computer
  507.     void                    GiveObjective                ( const char *title, const char *text, const char *screenshot );
  508.     void                    CompleteObjective            ( const char *title );
  509.     void                    FailObjective                ( const char *title );
  510.     void                    GiveDatabaseEntry            ( const idDict* dbEntry, bool hudPopup = true );
  511.     bool                    IsObjectiveUp                ( void ) const { return objectiveUp; }
  512.     idUserInterface *        GetObjectiveHud                ( void ) { return objectiveSystem; }
  513.  
  514.     // Secret Areas
  515.     void                    DiscoverSecretArea            ( const char *description);
  516.     
  517.     void                    StartBossBattle                ( idEntity* ent );
  518.  
  519.     // Powerups
  520.     bool                    GivePowerUp                    ( int powerup, int time );
  521.     void                    ClearPowerUps                ( void );
  522.  
  523.     void                    StartPowerUpEffect            ( int powerup );
  524.     void                    StopPowerUpEffect            ( int powerup );
  525.     
  526.     bool                    PowerUpActive                ( int powerup ) const;
  527.     float                    PowerUpModifier                ( int type );
  528.     void                    ClearPowerup                ( int i );
  529.     const char*                GetArenaPowerupString        ( void );
  530.  
  531.     // Helper methods to retrieving dictionaries
  532.     const idDeclEntityDef*    GetWeaponDef                ( int weaponIndex );
  533.     const idDeclEntityDef*    GetPowerupDef                ( int powerupIndex );
  534.  
  535.     // Weapons
  536.     bool                    GiveWeaponMods                ( int mods );
  537.     bool                    GiveWeaponMods                ( int weapon, int mods );
  538.     void                    GiveWeaponMod                ( const char* weaponmod );
  539.  
  540.     int                        SlotForWeapon                ( const char *weaponName );
  541.  
  542.     idEntity*                DropItem                    ( const char* itemClass, const idDict& customArgs, const idVec3& velocity = vec3_origin ) const; 
  543.     void                    DropPowerups                ( void );
  544.     idEntity*                ResetFlag                    ( const char* itemClass, const idDict& customArgs ) const;
  545.     void                    RespawnFlags                ( void );
  546.     void                    DropWeapon                    ( void );
  547.  
  548. // RAVEN BEGIN
  549. // abahr:
  550.     bool                    WeaponIsEnabled                ( void ) const { return weaponEnabled; }
  551.     void                    ShowCrosshair                ( void );
  552.     void                    HideCrosshair                ( void );
  553. // RAVEN END
  554.  
  555. //RAVEN BEGIN
  556. //asalmon: switch weapon based on d-pad combo
  557. #ifdef _XBOX
  558.     void                    ScheduleWeaponSwitch        (int weapon);
  559. #endif
  560. //RAVEN BEGIN
  561.  
  562.     void                    Reload                        ( void );
  563.     void                    NextWeapon                    ( void );
  564.     void                    NextBestWeapon                ( void );
  565.     void                    PrevWeapon                    ( void );
  566.     void                    LastWeapon                    ( void );
  567.      void                    SelectWeapon                ( int num, bool force );
  568.     void                    SelectWeapon                ( const char * );
  569.     void                    AddProjectilesFired            ( int count );
  570.     void                    AddProjectileHits            ( int count );
  571.     void                    SetLastHitTime                ( int time, bool armorHit );
  572.      void                    LowerWeapon                    ( void );
  573.      void                    RaiseWeapon                    ( void );
  574.      void                    WeaponLoweringCallback        ( void );
  575.      void                    WeaponRisingCallback        ( void );
  576.     void                    RemoveWeapon                ( const char *weap );
  577.     void                    Flashlight                    ( bool on );
  578.     void                    ToggleFlashlight            ( void );
  579.      bool                    CanShowWeaponViewmodel        ( void ) const;
  580.  
  581.     virtual bool            HandleSingleGuiCommand( idEntity *entityGui, idLexer *src );
  582.     bool                    GuiActive( void ) { return focusType == FOCUS_GUI; }
  583.  
  584.     void                    PerformImpulse( int impulse );
  585.     void                    Spectate( bool spectate, bool force = false );
  586.      void                    ToggleObjectives ( void );
  587.      void                    ToggleScoreboard( void );
  588.     void                    RouteGuiMouse( idUserInterface *gui );
  589.      void                    UpdateHud( void );
  590.     idUserInterface*        GetHud();
  591.     const idUserInterface*    GetHud() const;
  592.     void                    SetInfluenceFov( float fov );
  593.      void                    SetInfluenceView( const char *mtr, const char *skinname, float radius, idEntity *ent );
  594.     void                    SetInfluenceLevel( int level );
  595.      int                        GetInfluenceLevel( void ) { return influenceActive; };
  596.     void                    SetPrivateCameraView( idCamera *camView );
  597.     idCamera *                GetPrivateCameraView( void ) const { return privateCameraView; }
  598.     void                    StartFxFov( float duration  );
  599.      void                    UpdateHudWeapon( int displayWeapon=-1 );
  600.      void                    UpdateHudStats( idUserInterface *hud );
  601.      void                    UpdateHudAmmo( idUserInterface *hud );
  602.      void                    ShowTip( const char *title, const char *tip, bool autoHide );
  603.      void                    HideTip( void );
  604.      bool                    IsTipVisible( void ) { return tipUp; };
  605.     void                    ShowObjective( const char *obj );
  606.      void                    HideObjective( void );
  607.     idVec3                    GetEyePosition ( void ) const;
  608.  
  609.     void                    LocalClientPredictionThink( void );
  610.     void                    NonLocalClientPredictionThink( void );
  611.     virtual void            ClientPredictionThink( void );
  612.     virtual void            WriteToSnapshot( idBitMsgDelta &msg ) const;
  613.     virtual void            ReadFromSnapshot( const idBitMsgDelta &msg );
  614.     void                    WritePlayerStateToSnapshot( idBitMsgDelta &msg ) const;
  615.     void                    ReadPlayerStateFromSnapshot( const idBitMsgDelta &msg );
  616.  
  617.     virtual bool            ClientStale( void );
  618.     virtual void            ClientUnstale( void );
  619.  
  620.     virtual bool            ServerReceiveEvent( int event, int time, const idBitMsg &msg );
  621.  
  622.     virtual bool            GetMasterPosition( idVec3 &masterOrigin, idMat3 &masterAxis ) const;
  623.     virtual bool            GetPhysicsToVisualTransform( idVec3 &origin, idMat3 &axis );
  624.     virtual bool            GetPhysicsToSoundTransform( idVec3 &origin, idMat3 &axis );
  625.  
  626.     virtual bool            ClientReceiveEvent( int event, int time, const idBitMsg &msg );
  627.     
  628.     bool                    IsBeingTalkedTo    ( void );
  629.      bool                    IsReady            ( void );
  630.      bool                    IsRespawning    ( void );
  631.      bool                    IsInTeleport    ( void );
  632.     bool                    IsZoomed        ( void );
  633.     bool                    IsFlashlightOn    ( void );
  634.     virtual bool            IsCrouching        ( void ) const;
  635.     
  636.     // voice com muting
  637.     bool                    IsPlayerMuted    ( idPlayer* player ) const;
  638.     bool                    IsPlayerMuted    ( int clientNum ) const;
  639.     void                    MutePlayer        ( idPlayer* player, bool mute );
  640.     void                    MutePlayer        ( int clientNum, bool mute );
  641.     
  642.  
  643.     // buddy list
  644.     void                    SetFriend        ( idPlayer* player, bool isFriend );
  645.     void                    SetFriend        ( int clientNum, bool isFriend );
  646.     bool                    IsFriend        ( idPlayer* player ) const;
  647.     bool                    IsFriend        ( int clientNum ) const;
  648.  
  649.     // time joined server
  650.     int                        GetConnectTime    ( void ) const;
  651.     void                    SetConnectTime    ( int time );
  652.  
  653.     // emotes
  654.     void                    SetEmote        ( playerEmote_t emote );
  655.     
  656.     // rankings
  657.     int                        GetRank            ( void ) const;
  658.     void                    SetRank            ( int newRank );
  659.  
  660.     // arenas for tourney mode
  661.     int                        GetArena        ( void ) const;
  662.     void                    SetArena        ( int newArena );
  663.  
  664.      idEntity                *GetInfluenceEntity( void ) { return influenceEntity; };
  665.      const idMaterial        *GetInfluenceMaterial( void ) { return influenceMaterial; };
  666.      float                    GetInfluenceRadius( void ) { return influenceRadius; };
  667.  
  668.     // server side work for in/out of spectate. takes care of spawning it into the world as well
  669.     void                    ServerSpectate( bool spectate );
  670.  
  671.     // for very specific usage. != GetPhysics()
  672.     idPhysics                *GetPlayerPhysics( void );
  673.      void                    TeleportDeath( int killer );
  674.      void                    SetLeader( bool lead );
  675.      bool                    IsLeader( void );
  676.  
  677.      void                    UpdateModelSetup( bool forceReload = false );
  678.  
  679.     bool                    OnLadder( void ) const;
  680.  
  681.     rvViewWeapon*            GetWeaponViewModel    ( void ) const;
  682.     idAnimatedEntity*        GetWeaponWorldModel ( void ) const;
  683.     int                        GetCurrentWeapon    ( void ) const;
  684.  
  685.     bool                    IsGibbed            ( void ) const;
  686.     const idVec3&            GetGibDir            ( void ) const;
  687.  
  688.     void                    SetInitialHud ( void );
  689.  
  690.     void                    RemoveClientModel ( const char* entityDefName );
  691.     void                    RemoveClientModels ( void );
  692.     
  693.     rvClientEntityPtr<rvClientModel> AddClientModel ( const char* entityDefName, const char* shaderName = NULL );
  694.  
  695.     void                    ClientGib            ( const idVec3& dir );
  696.     void                    ClientDamageEffects ( const idDict& damageDef, const idVec3& dir, int damage );
  697.  
  698.  
  699.     void                    ApplyImpulse( idEntity *ent, int id, const idVec3 &point, const idVec3 &impulse, bool splash = false );
  700.  
  701.     void                    GUIMainNotice( const char* message, bool persist = false );
  702.     void                    GUIFragNotice( const char* message, bool persist = false );
  703.  
  704.     virtual bool            EnterVehicle        ( idEntity* vehicle );
  705.     virtual bool            ExitVehicle            ( bool force = false );
  706.  
  707.     virtual void            SetClipWorld( int newCW );
  708.     virtual int                GetClipWorld( void ) const;
  709.  
  710.     virtual idEntity*        GetGroundElevator( idEntity* testElevator=NULL ) const;
  711.     
  712.     int                        GetWeaponIndex( const char* weaponName );
  713.  
  714.     virtual void            SetInstance( int newInstance );
  715.     void                    JoinInstance( int newInstance );
  716.  
  717.     void                    ClientInstanceJoin( void );
  718.     void                    ClientInstanceLeave( void );
  719.  
  720.     void                    SetHudOverlay( idUserInterface* overlay, int duration );
  721.  
  722.     void                    SetShowHud( bool showHud );
  723.     bool                    GetShowHud( void );
  724.  
  725.  
  726.     // mekberg: wrap saveMessages
  727.     void                    SaveMessage( void );
  728.  
  729.     // mekberg: set pm_ cvars
  730.     void                    SetPMCVars( void );
  731.  
  732.     void                    SetTourneyStatus( playerTourneyStatus_t newStatus ) { tourneyStatus = newStatus; }
  733.     playerTourneyStatus_t    GetTourneyStatus( void ) { return tourneyStatus; }
  734.     const char*                GetTextTourneyStatus( void );
  735.  
  736.     const idVec4&            GetHitscanTint( void );
  737.  
  738.     void                    ForceScoreboard( bool force, int time );
  739.  
  740.     // call only on the local player
  741.     idUserInterface*        GetCursorGUI( void );
  742.  
  743. protected:
  744.     void                    SetupHead( const char* modelKeyName = "", idVec3 headOffset = idVec3(0, 0, 0) );
  745.  
  746. private:
  747.     float                    vehicleCameraDist;
  748.  
  749.     jointHandle_t            hipJoint;
  750.     jointHandle_t            chestJoint;
  751.  
  752.     idPhysics_Player        physicsObj;            // player physics
  753.  
  754.      idList<aasLocation_t>    aasLocation;        // for AI tracking the player
  755.  
  756.     idStr                    modelName;            // current model name
  757.     const idDict*            modelDict;
  758.  
  759.     int                        bobFoot;
  760.     float                    bobFrac;
  761.     float                    bobfracsin;
  762.     int                        bobCycle;            // for view bobbing and footstep generation
  763.     float                    xyspeed;
  764.     int                        stepUpTime;
  765.     float                    stepUpDelta;
  766.     float                    idealLegsYaw;
  767.     float                    legsYaw;
  768.      bool                    legsForward;
  769.     float                    oldViewYaw;
  770.     idAngles                viewBobAngles;
  771.     idVec3                    viewBob;
  772.     int                        landChange;
  773.     int                        landTime;
  774.     
  775.     // ddynerman: we read fall deltas from spawnargs, cache them to save some lookups
  776.     float                    fatalFallDelta;
  777.     float                    hardFallDelta;
  778.     float                    softFallDelta;
  779.     float                    noFallDelta;
  780.  
  781.     int                        currentWeapon;
  782.     int                        idealWeapon;
  783.     int                        previousWeapon;
  784.     int                        weaponSwitchTime;
  785.     bool                    weaponEnabled;
  786.      bool                    showWeaponViewModel;
  787.  
  788. // RAVEN BEGIN
  789. // mekberg: allow disabling of objectives during non-cinematic time periods
  790.     bool                    objectivesEnabled;
  791. // RAVEN END
  792.  
  793.     bool                    flashlightOn;
  794.     bool                    zoomed;
  795.  
  796.     bool                    reloadModel;
  797.  
  798.     const idDeclSkin *        skin;
  799.     const idDeclSkin *        weaponViewSkin;
  800.     const idDeclSkin *        headSkin;
  801.  
  802.     const idDeclSkin *        powerUpSkin;            // active powerup skin
  803.     const idDeclSkin *        gibSkin;
  804.  
  805.     const idMaterial*        quadOverlay;
  806.     const idMaterial*        hasteOverlay;
  807.     const idMaterial*        regenerationOverlay;
  808.     const idMaterial*        invisibilityOverlay;
  809.     const idMaterial*        powerUpOverlay;
  810.  
  811.     int                        numProjectilesFired;    // number of projectiles fired
  812.     int                        numProjectileHits;        // number of hits on mobs
  813.  
  814.     bool                    airless;
  815.     int                        airTics;                // set to pm_airTics at start, drops in vacuum
  816.     int                        lastAirDamage;
  817.  
  818.     bool                    gibDeath;
  819.     bool                    gibsLaunched;
  820.     idVec3                    gibDir;
  821.  
  822.     playerTourneyStatus_t    tourneyStatus;
  823.     bool                    isStrogg;
  824.  
  825.     idInterpolate<float>    zoomFov;
  826.     idInterpolate<float>    centerView;
  827.     bool                    fxFov;
  828.  
  829.     float                    influenceFov;
  830.     int                        influenceActive;        // level of influence.. 1 == no gun or hud .. 2 == 1 + no movement
  831.      idEntity *                influenceEntity;
  832.      const idMaterial *        influenceMaterial;
  833.     float                    influenceRadius;
  834.      const idDeclSkin *        influenceSkin;
  835.  
  836.     idCamera *                privateCameraView;
  837.  
  838.     static const int        NUM_LOGGED_VIEW_ANGLES = 64;        // for weapon turning angle offsets
  839.     idAngles                loggedViewAngles[NUM_LOGGED_VIEW_ANGLES];    // [gameLocal.framenum&(LOGGED_VIEW_ANGLES-1)]
  840.     static const int        NUM_LOGGED_ACCELS = 16;            // for weapon turning angle offsets
  841.     loggedAccel_t            loggedAccel[NUM_LOGGED_ACCELS];    // [currentLoggedAccel & (NUM_LOGGED_ACCELS-1)]
  842.     int                        currentLoggedAccel;
  843.  
  844.     int                        demoViewAngleTime;
  845.     idAngles                demoViewAngles;
  846.  
  847.     // if there is a focusGUIent, the attack button will be changed into mouse clicks
  848.     idUserInterface *        focusUI;
  849.     int                        focusTime;
  850.     playerFocus_t            focusType;
  851.     idEntityPtr<idEntity>    focusEnt;
  852.     idUserInterface *        focusBrackets;    
  853.     int                        focusBracketsTime;
  854.  
  855.     bool                    targetFriendly;
  856.  
  857.     idEntityPtr<idAI>        talkingNPC;                // NPC who's currently talking to us
  858.      int                        talkCursor;                // show the state of the focusCharacter (0 == can't talk/dead, 1 == ready to talk, 2 == busy talking)
  859.     idUserInterface *        cursor;
  860.  
  861.     idUserInterface *        overlayHud;            // a temporary hud overlay
  862.     int                        overlayHudTime;
  863.     
  864.     // full screen guis track mouse movements directly
  865.     int                        oldMouseX;
  866.     int                        oldMouseY;
  867.  
  868.     bool                    tipUp;
  869.     bool                    objectiveUp;
  870.  
  871.     float                    dynamicProtectionScale;    // value to scale damage by due to dynamic protection
  872.     int                        lastDamageDef;
  873.     idVec3                    lastDamageDir;
  874.     int                        lastDamageLocation;
  875.  
  876.     int                        predictedFrame;
  877.     idVec3                    predictedOrigin;
  878.     idAngles                predictedAngles;
  879.     bool                    predictedUpdated;
  880.     idVec3                    predictionOriginError;
  881.     idAngles                predictionAnglesError;
  882.     int                        predictionErrorTime;
  883.  
  884.     // mp
  885.      bool                    ready;                    // from userInfo
  886.      bool                    respawning;                // set to true while in SpawnToPoint for telefrag checks
  887.      bool                    leader;                    // for sudden death situations
  888.      bool                    weaponCatchup;            // raise up the weapon silently ( state catchups )
  889.     bool                    isTelefragged;            // proper obituaries
  890.     
  891.     int                        lastSpectateChange;
  892.      int                        lastTeleFX;
  893.      unsigned int            lastSnapshotSequence;    // track state hitches on clients
  894.      
  895.     int                        aimClientNum;            // player num in aim
  896.  
  897.     idPlayer*                lastImpulsePlayer;        // the last player who gave me an impulse, may be null
  898.     
  899.     int                        arena;                    // current arena for tourney gameplay
  900.  
  901.     int                        connectTime;
  902.     int                        mutedPlayers;            // bitfield set to which clients this player wants muted
  903.     int                        friendPlayers;            // bitfield set to which clients this player has marked as friends
  904.     
  905.     int                        rank;
  906.  
  907.     int                        deathSkinTime;
  908.     bool                    deathStateHitch;
  909.  
  910.     playerEmote_t            emote;
  911.  
  912.     int                        powerupEffectTime;
  913.     const idDecl            *powerupEffect;
  914.     int                        powerupEffectType;
  915.     idList<jointHandle_t>    powerupEffectJoints;
  916.     rvClientEffectPtr        hasteEffect;
  917.     rvClientEffectPtr        flagEffect;
  918.  
  919.     idVec4                    hitscanTint;
  920.     // end mp
  921.  
  922.     int                        lastImpulseTime;        // time of last impulse
  923.     idEntityPtr<idEntity>    bossEnemy;
  924.  
  925.     const idDeclEntityDef*    cachedWeaponDefs [ MAX_WEAPONS ];
  926.     const idDeclEntityDef*    cachedPowerupDefs [ POWERUP_MAX ];
  927.  
  928.     bool                    weaponChangeIconsUp;
  929.  
  930.     int                        oldInventoryWeapons;
  931.  
  932.     bool                    WantSmoothing( void ) const;
  933.     void                    PredictionErrorDecay( void );
  934.  
  935.     bool                    CanZoom(void);
  936.  
  937.     void                    LookAtKiller( idEntity *inflictor, idEntity *attacker );
  938.  
  939.     void                    StopFiring( void );
  940.     void                    FireWeapon( void );
  941.     void                    Weapon_Combat( void );
  942.     void                    Weapon_NPC( void );
  943.     void                    Weapon_GUI( void );
  944.     void                    Weapon_Vehicle ( void );
  945.     void                    Weapon_Usable ( void );
  946.     void                    SpectateFreeFly( bool force );    // ignore the timeout to force when followed spec is no longer valid
  947.     void                    SpectateCycle( void );
  948.     idAngles                GunTurningOffset( void );
  949.     idVec3                    GunAcceleratingOffset( void );
  950.  
  951.     void                    CrashLand( const idVec3 &oldOrigin, const idVec3 &oldVelocity );
  952.     void                    BobCycle( const idVec3 &pushVelocity );
  953.     void                    EvaluateControls( void );
  954.     void                    AdjustSpeed( void );
  955.     void                    AdjustBodyAngles( void );
  956.     void                    Move( void );
  957.     void                    SetSpectateOrigin( void );
  958.  
  959.      void                    InitAASLocation( void );
  960.      void                    SetAASLocation( void );
  961.  
  962.     idUserInterface *        ActiveGui( void );
  963.  
  964.     void                    UpdateWeapon                ( void );
  965.     void                    UpdateSpectating            ( void );
  966.     void                    UpdateAir                    ( void );
  967. // RAVEN BEGIN
  968. // abahr
  969.     void                    UpdateGravity                ( void );
  970. // nrausch: common handling for objective screen toggle    
  971.     void                    HandleObjectiveInput        ( void );
  972.     void                    HandleCheats                ( void );
  973.     void                    ClearCheatState                ( void );
  974. // RAVEN END
  975.     void                    UpdateViewAngles            ( void );
  976.     void                    UpdatePowerUps                ( void );
  977.      void                    UpdateDeathSkin                ( bool state_hitch );
  978.     void                    UpdateFocus                    ( void );
  979.      void                    UpdateLocation                ( void );
  980.     void                    UpdateObjectiveInfo            ( void );
  981. //    void                    UpdateDatabaseInfo            ( void );
  982.     void                    UpdateIntentDir                ( void );    
  983.  
  984.     void                    LoadDeferredModel            ( void );
  985.  
  986.     void                    ClearFocus                    ( void );
  987.     void                    UpdateFocusCharacter        ( idEntity* newEnt );
  988.     void                    SetFocus                    ( playerFocus_t type, int focusTime, idEntity* ent, idUserInterface* ui );
  989.  
  990.     void                    Event_GetButtons            ( void );
  991.     void                    Event_GetMove                ( void );
  992.     void                    Event_GetViewAngles            ( void );
  993.     void                    Event_SetViewAngles            ( const idVec3 &vec );
  994.     void                    Event_StopFxFov                ( void );
  995.     void                    Event_EnableWeapon            ( void );
  996.     void                    Event_DisableWeapon            ( void );
  997.     void                    Event_GetCurrentWeapon        ( void );
  998.     void                    Event_GetPreviousWeapon        ( void );
  999.     void                    Event_SelectWeapon            ( const char *weaponName );
  1000.     void                    Event_GetWeaponEntity        ( void );
  1001.     void                    Event_ExitTeleporter        ( void );
  1002.     void                    Event_HideTip                ( void );
  1003.     void                    Event_LevelTrigger            ( void );
  1004.     void                    Event_GetViewPos            ( void );
  1005.     void                    Event_TeleportPlayer        ( idVec3 &newPos, idVec3 &newAngles );
  1006.     void                    Event_Freeze                ( float f );
  1007.     void                    Event_HideDatabaseEntry        ( void );    
  1008.     void                    Event_ZoomIn                ( void );
  1009.     void                    Event_ZoomOut                ( void );
  1010.     void                    Event_FinishHearingLoss        ( float fadeTime );
  1011.     void                    Event_GetAmmoData            ( const char *ammoClass );
  1012.     void                    Event_RefillAmmo            ( void );
  1013.     void                    Event_AllowFallDamage        ( int toggle );
  1014.     
  1015.     void                    Event_EnableTarget            ( void );
  1016.     void                    Event_DisableTarget            ( void );
  1017.     virtual void            Event_DamageOverTimeEffect    ( int endTime, int interval, const char *damageDefName );
  1018.     
  1019.     // RAVEN BEGIN
  1020.     // twhitaker: added Event_ApplyImpulse
  1021.     void                    Event_ApplyImpulse            ( idEntity* ent, idVec3 &point, idVec3 &impulse    );
  1022.  
  1023.     // mekberg:    added sethealth
  1024.     void                    Event_SetHealth                    ( float newHealth );
  1025.     void                    Event_SetArmor                    ( float newArmor );
  1026.  
  1027.     void                    Event_SetExtraProjPassEntity( idEntity* _extraProjPassEntity );
  1028.     void                    Event_DamageEffect            ( const char *damageDefName, idEntity* _damageFromEnt  );
  1029.  
  1030.     // mekberg: allow enabling/disabling of objectives
  1031.     void                    Event_EnableObjectives        ( void );
  1032.     void                    Event_DisableObjectives        ( void );
  1033.  
  1034.     //  mekberg: don't supress showing new objectives anymore
  1035.     void                    Event_AllowNewObjectives    ( void );
  1036.  
  1037.     // twhitaker: death shader
  1038.     void                    UpdateDeathShader            ( bool state_hitch );
  1039.     
  1040.     bool doInitWeapon;
  1041.     void                    InitWeapon            ( void );
  1042.     // RAVEN END
  1043.  
  1044.     bool                    IsLegsIdle                        ( bool crouching ) const;
  1045.     
  1046.     stateResult_t            State_Wait_Alive                ( const stateParms_t& parms );
  1047.     stateResult_t            State_Wait_ReloadAnim            ( const stateParms_t& parms );
  1048.     
  1049.     stateResult_t            State_Torso_Idle                ( const stateParms_t& parms );
  1050.     stateResult_t            State_Torso_IdleThink            ( const stateParms_t& parms );
  1051.     stateResult_t            State_Torso_Teleport            ( const stateParms_t& parms );
  1052.     stateResult_t            State_Torso_RaiseWeapon            ( const stateParms_t& parms );
  1053.     stateResult_t            State_Torso_LowerWeapon            ( const stateParms_t& parms );
  1054.     stateResult_t            State_Torso_Fire                ( const stateParms_t& parms );
  1055.     stateResult_t            State_Torso_Fire_Windup            ( const stateParms_t& parms );
  1056.  
  1057.     stateResult_t            State_Torso_Reload                ( const stateParms_t& parms );
  1058.     stateResult_t            State_Torso_Pain                ( const stateParms_t& parms );
  1059.     stateResult_t            State_Torso_Dead                ( const stateParms_t& parms );
  1060.     stateResult_t            State_Torso_Emote                ( const stateParms_t& parms );
  1061.     
  1062.     stateResult_t            State_Legs_Idle                    ( const stateParms_t& parms );
  1063.     stateResult_t            State_Legs_Run_Forward            ( const stateParms_t& parms );
  1064.     stateResult_t            State_Legs_Run_Backward            ( const stateParms_t& parms );
  1065.     stateResult_t            State_Legs_Run_Left                ( const stateParms_t& parms );
  1066.     stateResult_t            State_Legs_Run_Right            ( const stateParms_t& parms );
  1067.     stateResult_t            State_Legs_Walk_Forward            ( const stateParms_t& parms );
  1068.     stateResult_t            State_Legs_Walk_Backward        ( const stateParms_t& parms );
  1069.     stateResult_t            State_Legs_Walk_Left            ( const stateParms_t& parms );
  1070.     stateResult_t            State_Legs_Walk_Right            ( const stateParms_t& parms );
  1071.     stateResult_t            State_Legs_Crouch                ( const stateParms_t& parms );
  1072.     stateResult_t            State_Legs_Uncrouch                ( const stateParms_t& parms );
  1073.     stateResult_t            State_Legs_Crouch_Idle            ( const stateParms_t& parms );
  1074.     stateResult_t            State_Legs_Crouch_Forward        ( const stateParms_t& parms );
  1075.     stateResult_t            State_Legs_Crouch_Backward        ( const stateParms_t& parms );
  1076.     stateResult_t            State_Legs_Jump                    ( const stateParms_t& parms );
  1077.     stateResult_t            State_Legs_Fall                    ( const stateParms_t& parms );
  1078.     stateResult_t            State_Legs_Land                    ( const stateParms_t& parms );
  1079.     stateResult_t            State_Legs_Dead                    ( const stateParms_t& parms );
  1080.     
  1081.      CLASS_STATES_PROTOTYPE( idPlayer );
  1082. };
  1083.  
  1084. ID_INLINE bool idPlayer::IsBeingTalkedTo( void ) {
  1085.     return talkingNPC!=NULL;
  1086. }
  1087.  
  1088. ID_INLINE bool idPlayer::IsRespawning( void ) {
  1089.      return respawning;
  1090. }
  1091.  
  1092. ID_INLINE idPhysics* idPlayer::GetPlayerPhysics( void ) {
  1093.     return &physicsObj;
  1094. }
  1095.  
  1096. ID_INLINE bool idPlayer::IsInTeleport( void ) {
  1097.      return ( teleportEntity.GetEntity() != NULL );
  1098. }
  1099.  
  1100. ID_INLINE void idPlayer::SetLeader( bool lead ) {
  1101.     leader = lead;
  1102. }
  1103.  
  1104. ID_INLINE bool idPlayer::IsLeader( void ) {
  1105.      return leader;
  1106. }
  1107.  
  1108. ID_INLINE bool idPlayer::IsZoomed ( void ) {
  1109.     return zoomed;
  1110. }
  1111.  
  1112. ID_INLINE bool idPlayer::IsFlashlightOn ( void ) {
  1113.     return flashlightOn;
  1114. }
  1115.  
  1116. ID_INLINE rvViewWeapon* idPlayer::GetWeaponViewModel ( void ) const {
  1117.     return weaponViewModel;
  1118. }
  1119.  
  1120. ID_INLINE idAnimatedEntity* idPlayer::GetWeaponWorldModel ( void ) const {
  1121.     return weaponWorldModel;
  1122. }
  1123.  
  1124. ID_INLINE int idPlayer::GetCurrentWeapon( void ) const {
  1125.     return currentWeapon;
  1126. }
  1127.  
  1128. ID_INLINE bool idPlayer::IsGibbed( void ) const {
  1129.     return gibDeath;
  1130. }
  1131.  
  1132. ID_INLINE const idVec3& idPlayer::GetGibDir( void ) const {
  1133.     return gibDir;
  1134. }
  1135.  
  1136. ID_INLINE int idPlayer::GetClipWorld( void ) const {
  1137.     return clipWorld;
  1138. }
  1139.  
  1140. ID_INLINE void idPlayer::SetClipWorld( int newCW ) {
  1141.     idEntity::SetClipWorld( newCW );
  1142.     
  1143.     if( head.GetEntity() ) {
  1144.         head.GetEntity()->SetClipWorld( newCW );
  1145.  
  1146.         head.GetEntity()->UnlinkCombat();
  1147.         head.GetEntity()->LinkCombat();
  1148.     }
  1149.  
  1150.     if( weapon ) {
  1151.         if( weapon->GetViewModel() ) {
  1152.             weapon->GetViewModel()->SetClipWorld( newCW );
  1153.         }
  1154.  
  1155.         if( weapon->GetWorldModel() ) {
  1156.             weapon->GetWorldModel()->SetClipWorld( newCW );
  1157.         }
  1158.     }
  1159.  
  1160.     UnlinkCombat();
  1161.     LinkCombat();
  1162. }
  1163.  
  1164. ID_INLINE int idPlayer::GetWeaponIndex( const char* weaponName ) {
  1165.     for( int i = 0; i < MAX_WEAPONS; i++ ) {
  1166.         if( !idStr::Icmp( spawnArgs.GetString( va( "def_weapon%d", i ), "" ), weaponName ) ) {
  1167.             return i;
  1168.         }
  1169.     }
  1170.  
  1171.     return 0;
  1172. }
  1173.  
  1174. ID_INLINE idUserInterface* idPlayer::GetHud() {
  1175.     return vehicleController.IsDriving() ? vehicleController.GetHud() : hud;
  1176. }
  1177.  
  1178. ID_INLINE const idUserInterface* idPlayer::GetHud() const {
  1179.     return vehicleController.IsDriving() ? vehicleController.GetHud() : hud;
  1180. }
  1181.  
  1182. ID_INLINE bool idPlayer::IsPlayerMuted( idPlayer* player ) const {
  1183.     return !!( mutedPlayers & ( 1 << player->entityNumber ) );
  1184. }
  1185.  
  1186. ID_INLINE bool idPlayer::IsPlayerMuted( int clientNum ) const {
  1187.     return !!( mutedPlayers & ( 1 << clientNum ) );
  1188. }
  1189.  
  1190. ID_INLINE void idPlayer::MutePlayer( idPlayer* player, bool mute ) {
  1191.     if( mute ) {
  1192.         mutedPlayers |= ( 1 << player->entityNumber );
  1193.     } else {
  1194.         mutedPlayers &= ~( 1 << player->entityNumber );
  1195.     }
  1196. }
  1197.  
  1198. ID_INLINE void idPlayer::MutePlayer( int clientNum, bool mute ) {
  1199.     if( mute ) {
  1200.         mutedPlayers |= ( 1 << clientNum );
  1201.     } else {
  1202.         mutedPlayers &= ~( 1 << clientNum );
  1203.     }
  1204. }
  1205.  
  1206. ID_INLINE bool idPlayer::IsFriend( idPlayer* player ) const {
  1207.     return !!( friendPlayers & ( 1 << player->entityNumber ) );
  1208. }
  1209.  
  1210. ID_INLINE bool idPlayer::IsFriend( int clientNum ) const {
  1211.     return !!( friendPlayers & ( 1 << clientNum ) );
  1212. }
  1213.  
  1214. ID_INLINE void idPlayer::SetFriend( idPlayer* player, bool isFriend ) {
  1215.     if( isFriend ) {
  1216.         friendPlayers |= ( 1 << player->entityNumber ); 
  1217.     } else {
  1218.         friendPlayers &= ~( 1 << player->entityNumber );
  1219.     }
  1220. }
  1221.  
  1222. ID_INLINE void idPlayer::SetFriend( int clientNum, bool isFriend ) {
  1223.     if( isFriend ) {
  1224.         friendPlayers |= ( 1 << clientNum );
  1225.     } else {
  1226.         friendPlayers &= ~( 1 << clientNum );
  1227.     }
  1228. }
  1229.  
  1230. ID_INLINE int idPlayer::GetConnectTime( void ) const {
  1231.     return connectTime;
  1232. }
  1233.  
  1234. ID_INLINE void idPlayer::SetConnectTime( int time ) {
  1235.     connectTime = time;
  1236. }
  1237.  
  1238. ID_INLINE int idPlayer::GetRank( void ) const {
  1239.     return rank;
  1240. }
  1241.  
  1242. ID_INLINE void idPlayer::SetRank( int newRank ) {
  1243.     rank = newRank;
  1244. }
  1245.  
  1246. ID_INLINE int idPlayer::GetArena( void ) const {
  1247.     return arena;
  1248. }
  1249.  
  1250. #endif /* !__GAME_PLAYER_H__ */
  1251.  
  1252. // RAVEN END
  1253.