![]() |
PRooFPS-dd Dev Doc 1.0
PRooFPS-dd Developer Documentation
|
#include <Player.h>
Public Member Functions | |
| CConsole & | getConsole () const |
| Player (pge_audio::PgeAudio &audio, PGEcfgProfiles &cfgProfiles, PgeObjectPool< PooledBullet > &bullets, EventLister<> &eventsItemPickup, EventLister<> &eventsInventoryChange, EventLister<> &eventsAmmoChange, PR00FsUltimateRenderingEngine &gfx, pge_network::PgeINetwork &network, const pge_network::PgeNetworkConnectionHandle &connHandle, const std::string &sIpAddress) | |
| ~Player () | |
| Player (const Player &) | |
| Player & | operator= (const Player &)=delete |
| Player (Player &&)=delete | |
| Player & | operator= (Player &&)=delete |
| const std::chrono::time_point< std::chrono::steady_clock > & | getTimeConstructed () const |
| const std::chrono::time_point< std::chrono::steady_clock > & | getTimeBootedUp () const |
| void | setTimeBootedUp () |
| Based on PRooFPS v0.5 network protocol, this is set when MsgUserNameChangeAndBootupDone is processed. | |
| bool | hasBootedUp () const |
| bool | isExpectingAfterBootUpDelayedUpdate () const |
| void | setExpectingAfterBootUpDelayedUpdate (bool b) |
| const pge_network::PgeNetworkConnectionHandle & | getServerSideConnectionHandle () const |
| const std::string & | getIpAddress () const |
| const std::string & | getName () const |
| void | setName (const std::string &sName) |
| bool & | isInSpectatorMode () |
| const bool & | isInSpectatorMode () const |
| const bool & | isForcedSpectating () const |
| void | setForcedSpectating (bool value) |
| void | updateAudioVisuals (const proofps_dd::Config &config, bool bServer, bool bAllowedForGameplay) |
| Invoked in every frame. | |
| void | show () |
| void | hide () |
| void | setVisibilityState (bool state) |
| Sets visibility state for BOTH the player object and the current weapon. | |
| bool | isVisible () const |
| WeaponManager & | getWeaponManager () |
| const WeaponManager & | getWeaponManager () const |
| bool | isDirty () const |
| Check if there is any old-new value pending to be committed. | |
| void | updateOldValues () |
| Invokes commit() for all maintained old-new values. | |
| bool | isNetDirty () const |
| Check if there was any old-new value updated in recent updateOldValues() call(s) since the last call to clearNetDirty(). | |
| void | clearNetDirty () |
| Clears the isNetDirty() flag. | |
| const PgeOldNewValue< int > & | getArmor () const |
| void | setArmor (int value) |
| const PgeOldNewValue< int > & | getHealth () const |
| void | setHealth (int value) |
| void | doDamage (int dmgAP, int dmgHP) |
| Input can be the calculated damage caused by bullet, or falling from high, etc. | |
| PureVector & | getImpactForce () |
| void | die (bool bMe, bool bServer) |
| const std::chrono::time_point< std::chrono::steady_clock > & | getTimeDied () const |
| void | moveTimeDiedEarlier (std::chrono::milliseconds::rep byMillisecs) |
| PgeOldNewValue< int > & | getDeaths () |
| const PgeOldNewValue< int > & | getDeaths () const |
| PgeOldNewValue< unsigned int > & | getSuicides () |
| const PgeOldNewValue< unsigned int > & | getSuicides () const |
| PgeOldNewValue< float > & | getFiringAccuracy () |
| const PgeOldNewValue< float > & | getFiringAccuracy () const |
| PgeOldNewValue< unsigned int > & | getShotsFiredCount () |
| const PgeOldNewValue< unsigned int > & | getShotsFiredCount () const |
| unsigned int & | getShotsHitTarget () |
| const unsigned int & | getShotsHitTarget () const |
| bool & | getRespawnFlag () |
| void | respawn (bool bMe, const Weapon &wpnDefaultAvailable, bool bServer) |
| bool & | getResettlingFlag () |
| void | resettleAndRespawnShared () |
| const PgeOldNewValue< bool > & | getInvulnerability () const |
| void | setInvulnerability (const bool &bState, const unsigned int &nSeconds=0) |
| Both server and client use this function. | |
| const unsigned int & | getInvulnerabilityDurationSeconds () const |
| const std::chrono::time_point< std::chrono::steady_clock > & | getTimeInvulnerabilityStarted () const |
| PgeOldNewValue< PureVector > & | getPos () |
| const PgeOldNewValue< PureVector > & | getPos () const |
| bool | isJustCreatedAndExpectingStartPos () const |
| void | setJustCreatedAndExpectingStartPos (bool b) |
| PgeOldNewValue< TPureFloat > & | getAngleY () |
| const PgeOldNewValue< TPureFloat > & | getAngleY () const |
| PgeOldNewValue< TPureFloat > & | getAngleZ () |
| const PgeOldNewValue< TPureFloat > & | getAngleZ () const |
| PgeOldNewValue< PureVector > & | getWeaponAngle () |
| PureObject3D * | getObject3D () const |
| float | getGravity () const |
| void | setGravity (float value) |
| Physics class is required to invoke this in every physics tick. | |
| PgeOldNewValue< bool > & | getJumpInput () |
| bool | isJumping () const |
| bool | canFall () const |
| void | setCanFall (bool state) |
| To be invoked by Physics class whenever it detects change in the status of falling. | |
| bool | isInAir () const |
| bool | getHasJustStartedFallingNaturallyInThisTick () const |
| void | setHasJustStartedFallingNaturallyInThisTick (bool val) |
| Physics class is required to invoke this whenever the gravity pulling force actually manages to decrease the altitude of the player in a physics tick, after it was not yet possible in the previous tick. | |
| bool | getHasJustStartedFallingAfterJumpingStoppedInThisTick () const |
| void | setHasJustStartedFallingAfterJumpingStoppedInThisTick (bool val) |
| Physics class is required to invoke this whenever a player-induced jump has just been finished its upward movement. | |
| bool | isFalling () const |
| Unlike canFall(), this returns a more useful value about falling actually confirmed by the physics engine. | |
| bool | isFallingNaturally () const |
| bool | isFallingAfterJumpingStopped () const |
| const std::chrono::time_point< std::chrono::steady_clock > & | getTimeStartedFalling () const |
| The timestamp of the moment Physics class invoked: | |
| const float | getHeightStartedFalling () const |
| The vertical position of the player in the moment of Physics class invoked: | |
| bool & | getHasJustStoppedJumpingInThisTick () |
| bool | jumpAllowed () const |
| void | setJumpAllowed (bool b) |
| Physics class is required to invoke this in every physics tick based on different conditions. | |
| void | jump (const float &fRunSpeedPerTickForJumppadHorizontalForce=0.f) |
| Triggers a jump. | |
| void | stopJumping () |
| float | getWillJumpXInNextTick () const |
| float | getWillJumpYInNextTick () const |
| void | setWillJumpInNextTick (float factorY, float factorX) |
| Sets the multipliers for jump force that will be used for the next jump. | |
| const std::chrono::time_point< std::chrono::steady_clock > & | getTimeLastSetWillJump () const |
| float | getHeightJumpInitiated () const |
| PureVector & | getJumpForce () |
| bool | getWillWallJumpInNextTick () const |
| void | setWillWallJumpInNextTick () |
| Sets the multipliers for jump force that will be used for the next wall jump. | |
| void | cancelWillWallJump () |
| Resets getWillWallJumpInNextTick(). | |
| void | wallJump () |
| int & | getTicksSinceLastHorizontalCollision () |
| bool | hasJetLax () const |
| void | setHasJetLax (bool state) |
| bool | hasAntiGravityActive () const |
| void | setHasAntiGravityActive (bool state) |
| PureVector & | getAntiGravityForce () |
| void | setCurrentInventoryItemPower (const float &newValue) |
| Unlike with other PgeOldNewValue functions, we do not define a non-const version of getCurrentInventoryItemPower(), so this way we force that both server- and client instances must call this function for updating inventory item power. | |
| const PgeOldNewValue< float > & | getCurrentInventoryItemPower () const |
| void | updateCurrentInventoryItemPowerAudioVisualsShared (const proofps_dd::Config &config, PgeObjectPool< Smoke > &smokes) |
| For this audio-visual control to work properly, this function shall be invoked MAX 1 time per frame! | |
| void | forceDeactivateCurrentInventoryItem () |
| PgeOldNewValue< bool > & | getCrouchInput () |
| bool & | getCrouchStateCurrent () |
| const bool & | getCrouchStateCurrent () const |
| const bool & | isJumpingInitiatedFromCrouching () const |
| const bool & | isJumpInitiatedByJumppad () const |
| bool & | getWantToStandup () |
| float | getProposedNewPosYforStandup () const |
| void | doCrouchServer () |
| Changing player properties for physics. | |
| void | doCrouchShared () |
| void | doStandupServer () |
| Changing player properties for physics. | |
| void | doStandupShared () |
| PgeOldNewValue< bool > & | getDescentInput () |
| bool | getWillSomersaultInNextTick () const |
| void | setWillSomersaultInNextTick (bool flag) |
| void | startSomersaultServer (bool bJumpInduced) |
| Salto/somersault aka front-/backflip. | |
| void | setSomersaultClient (float angleZ) |
| Since server calculates somersault angle, client just receives the angle periodically from server. | |
| bool | isSomersaulting () const |
| float | getSomersaultAngle () const |
| void | stepSomersaultAngleServer (float angle) |
| Stepping the somersault angle i.e. | |
| void | resetSomersaultServer () |
| bool | isRunning () const |
| void | setRun (bool state) |
| const std::chrono::time_point< std::chrono::steady_clock > & | getTimeLastToggleRun () const |
| const std::chrono::time_point< std::chrono::steady_clock > & | getTimeLastToggleUseItem () const |
| const proofps_dd::Strafe & | getStrafe () const |
| void | setStrafe (const proofps_dd::Strafe &strafe) |
| const proofps_dd::Strafe & | getPreviousActualStrafe () const |
| Gets previous non-NONE strafe value registered before the last NONE strafe value and the current non-NONE strafe state. | |
| const std::chrono::time_point< std::chrono::steady_clock > & | getTimeLastActualStrafe () const |
| float & | getStrafeSpeed () |
| const PgeOldNewValue< bool > & | getActuallyRunningOnGround () const |
| PgeOldNewValue< bool > & | getActuallyRunningOnGround () |
| bool | isMoving () const |
| Tells if the player is stationary or not. | |
| bool & | getAttack () |
| bool | attack () |
| const PgeOldNewValue< float > & | getWeaponMomentaryAccuracy () const |
| void | setWeaponMomentaryAccuracy (float value) |
| This is just for server sending momentary weapon accuracy to all players, so they can scale their xhair accordingly. | |
| PgeOldNewValue< int > & | getFrags () |
| const PgeOldNewValue< int > & | getFrags () const |
| PgeOldNewValue< unsigned int > & | getTeamId () |
| const PgeOldNewValue< unsigned int > & | getTeamId () const |
| bool | canTakeItem (const MapItem &item) const |
| void | takeItem (MapItem &item, pge_network::PgePacket &pktWpnUpdate, bool &bHasJustBecomeAvailable) |
| const Weapon * | getWeaponInstanceByMapItemType (const MapItemType &mapItemType) const |
| Weapon * | getWeaponInstanceByMapItemType (const MapItemType &mapItemType) |
| void | updateImpactForceByBulletImpactOrRecoil (bool bRecoil, Bullet &bullet, Weapon &wpn) |
| void | handleFallingFromHigh (int iServerScream) |
| void | handleLanded (const float &fFallHeight, bool bDamageTaken, bool bDied, PureVector &vecCamShakeForce, const bool &bMe) |
| void | handleActuallyRunningOnGround () |
| void | handleTakeNonWeaponItem (const proofps_dd::MapItemType &eMapItemType, const bool &bMe) |
| void | handleToggleInventoryItem (const proofps_dd::MapItemType &eMapItemType, const bool &bSyncHistory) |
| void | handleUntakeInventoryItem (const proofps_dd::MapItemType &eMapItemType) |
| void | handleTakeWeaponItem (const proofps_dd::MapItemType &eMapItemType, const Weapon &wpnTaken, const bool &bJustBecameAvailable, const int &nAmmoIncrease) |
| void | handleJumppadActivated () |
| void | handleTeamIdChanged (const unsigned int &iTeamId) |
| void | handleToggleSpectatorMode () |
Static Public Member Functions | |
| static const char * | getLoggerModuleName () |
| static void | genUniqueUserName (char szNewUserName[proofps_dd::MsgUserNameChangeAndBootupDone::nUserNameBufferLength], const std::string &sNameFromConfig, const std::map< pge_network::PgeNetworkConnectionHandle, proofps_dd::Player > &m_mapPlayers) |
Static Public Attributes | |
| static constexpr auto | smokeEmitOperValuesLowPowerThrust |
| See explanation of this at Smoke::smokeEmitOperValues. | |
| static constexpr auto | smokeEmitOperValuesHighPowerThrust |
| See explanation of this at Smoke::smokeEmitOperValues. | |
| static constexpr char * | szCVarClName = "cl_name" |
| static constexpr float | fObjWidth = 0.95f |
| static constexpr float | fObjHeightStanding = 1.88f |
| static constexpr float | fObjHeightCrouchScaling = 0.48f |
| static constexpr float | fHeightLastJumpWhenPlayerIsOnGround = 999999.f |
| static constexpr float | fBaseSpeedWalk = 2.f |
| static constexpr float | fBaseSpeedRun = 4.f |
| static constexpr float | fBaseSpeedCrouch = 1.5f |
| static constexpr float | fJumpGravityStartFromStanding = 19.f |
| static constexpr float | fJumpGravityStartFromCrouching = 15.f |
| static constexpr char * | szCVarSvMovingAffectsAim = "sv_moving_affects_aim" |
| static constexpr char * | szCVarSvSomersaultMidAirAutoCrouch = "sv_somersault_mid_air_auto_crouch" |
| static constexpr char * | szCVarSvSomersaultMidAirJumpForceMultiplier = "sv_somersault_mid_air_jump_force_multiplier" |
| static constexpr unsigned int | nSomersaultTargetDurationMillisecs = 300 |
| static constexpr float | fSomersaultMidAirJumpForceMultiplierMin = 1.f |
| static constexpr float | fSomersaultMidAirJumpForceMultiplierMax = 2.f |
| static constexpr float | fSomersaultMidAirJumpForceMultiplierDef = Player::fSomersaultMidAirJumpForceMultiplierMax |
| static constexpr float | fSomersaultGroundImpactForceX = 15.f |
| static constexpr unsigned int | nSvDmRespawnDelaySecsDef = 3 |
| static constexpr char * | szCVarSvDmRespawnDelaySecs = "sv_dm_respawn_delay" |
| static constexpr unsigned int | nSvDmRespawnInvulnerabilityDelaySecsDef = 3 |
| static constexpr char * | szCVarSvDmRespawnInvulnerabilityDelaySecs = "sv_dm_respawn_invulnerability_delay" |
| static constexpr unsigned int | nPlayersMax = 15 |
| static constexpr char * | szCVarPlayersMax = "players_max" |
Private Types | |
| enum class | OldNewValueName { OvArmor , OvHealth , OvFrags , OvDeaths , OvSuicides , OvFiringAccuracy , OvShotsFired , OvPos , OvAngleY , OvAngleZ , OvWpnAngle , OvWpnMomentaryAccuracy , OvCrouchInput , OvDescentInput , OvActuallyRunningOnGround , OvInvulnerability , OvJumpInput , OvCurrentInventoryItemPower } |
Private Member Functions | |
| void | BuildPlayerObject (bool blend) |
| int & | getParticleEmitPerNthPhysicsIterationCntr () |
| const int & | getParticleEmitPerNthPhysicsIterationCntr () const |
| void | emitParticles (const proofps_dd::Config &config, PgeObjectPool< Smoke > &smokes, const bool &bHighPowerThrust) |
| PgeOldNewValue< int > & | getArmor () |
| PgeOldNewValue< int > & | getHealth () |
| PgeOldNewValue< float > & | getWeaponMomentaryAccuracy () |
Private Attributes | |
| pge_network::PgeNetworkConnectionHandle | m_connHandleServerSide |
| Used by both server and clients to identify the connection. | |
| std::string | m_sIpAddress |
| std::string | m_sName |
| std::chrono::time_point< std::chrono::steady_clock > | m_timeCtor |
| std::chrono::time_point< std::chrono::steady_clock > | m_timeBootedUp |
| Timestamp of server-side processing of UserNameChangeAndBootupDone (after MsgUserConnectedServerSelf and MsgUserSetupFromServer is already processed. | |
| bool | m_bExpectingAfterBootUpDelayedUpdate = true |
| bool | m_bSpectatorMode = true |
| bool | m_bForcedSpectating = false |
| std::map< OldNewValueName, std::variant< PgeOldNewValue< int >, PgeOldNewValue< unsigned int >, PgeOldNewValue< bool >, PgeOldNewValue< TPureFloat >, PgeOldNewValue< PureVector > > > | m_vecOldNewValues |
| PgeOldNewValue< unsigned int > | m_iTeamId {0} |
| Which team this player belongs to. | |
| bool | m_bNetDirty = false |
| std::chrono::time_point< std::chrono::steady_clock > | m_timeDied |
| bool | m_bRespawn = false |
| bool | m_bResettle = false |
| std::chrono::time_point< std::chrono::steady_clock > | m_timeStartedInvulnerability |
| unsigned int | m_nInvulnerabilityDurationSecs = 0 |
| unsigned int | m_nShotsHitTarget = 0 |
| PureVector | m_vecImpactForce |
| PureVector | m_vecAntiGravityForce |
| PureObject3D * | m_pObj = nullptr |
| PureTexture * | m_pTexPlayerStand = nullptr |
| PureTexture * | m_pTexPlayerCrouch = nullptr |
| WeaponManager | m_wpnMgr |
| pge_audio::PgeAudio & | m_audio |
| PGEcfgProfiles & | m_cfgProfiles |
| PgeObjectPool< PooledBullet > & | m_bullets |
| EventLister & | m_eventsItemPickup |
| EventLister & | m_eventsInventoryChange |
| EventLister & | m_eventsAmmoChange |
| PR00FsUltimateRenderingEngine & | m_gfx |
| pge_network::PgeINetwork & | m_network |
| PureVector | m_vecJumpForce |
| float | m_fGravity = 0.f |
| bool | m_bJumping = false |
| bool | m_bAllowJump = false |
| float | m_fWillJumpMultFactorX = 0.f |
| Since v0.2.6 we also record horizontal jump factor which is non-0 for jumppads triggering horizontal force. | |
| float | m_fWillJumpMultFactorY = 0.f |
| Before v0.2.6 this was a boolean value, but then I changed it to float so it also means how strong the jump will be. | |
| float | m_fJumpInitiatedHeight = fHeightLastJumpWhenPlayerIsOnGround |
| bool | m_bWillWallJump = false |
| int | m_nConsecutiveWallJump = 0 |
| int | m_nTicksSinceLastHorizontalCollision = 0 |
| PureVector | m_angleSavedForWallJump |
| std::chrono::time_point< std::chrono::steady_clock > | m_timeLastWillJump |
| bool | m_bCanFall = true |
| bool | m_bFalling = true |
| bool | m_bHasJustStartedFallingNaturally = true |
| bool | m_bHasJustStartedFallingAfterJumpingStopped = false |
| bool | m_bFallingNaturally = true |
| bool | m_bFallingAfterJumpingStopped = false |
| std::chrono::time_point< std::chrono::steady_clock > | m_timeStartedFalling |
| float | m_fHeightStartedFalling = 0.f |
| bool | m_bHasJustStoppedJumping = false |
| bool | m_bFallingHighTriggered = false |
| This flag is set by handleFallingFromHigh(), we need to use this flag to make sure the actions are triggered only once when the player is falling from high. | |
| SoLoud::handle | m_handleSndPlayerItemDeactivateAntiGravity = 0 |
| SoLoud::handle | m_handleSndPlayerItemLowThrustAntiGravity = 0 |
| bool | m_bSndPlayerItemLowThrustAntiGravityLoopingStarted = false |
| SoLoud::handle | m_handleSndPlayerItemHighThrustAntiGravity = 0 |
| bool | m_bSndPlayerItemHighThrustAntiGravityLoopingStarted = false |
| SoLoud::handle | m_handleFallYell = 0 |
| SoLoud::handle | m_handleSndPlayerLandSmallFall = 0 |
| SoLoud::handle | m_handleSndPlayerLandBigFall = 0 |
| SoLoud::handle | m_handleSndPlayerDamage = 0 |
| SoLoud::handle | m_handleSndPlayerFootstep = 0 |
| std::chrono::time_point< std::chrono::steady_clock > | m_timeLastSndPlayerFootstepPlayed |
| bool | m_bCrouchingStateCurrent = false |
| True when player is crouching currently, regardless of current input (OvCrouchInput). | |
| bool | m_bCrouchingWasActiveWhenInitiatedJump = false |
| We need to save current crouching state at the moment of initiating jump-up, so that we can check in any later moment of jumping up if somersaulting can be initiated: it must not be initiated when player was already crouching at the moment of jump-up. | |
| bool | m_bJumpWasInitiatedByJumppad = false |
| We need to save if jumping was initiated by jumppad because we should not allow mid-air somersaulting in such case. | |
| bool | m_bWantToStandup = true |
| True when player wants standing position as per input, regardless of currently crouching or not. | |
| bool | m_bWillSomersault = false |
| float | m_fSomersaultAngleZ = 0.f |
| If non-zero, there is ongoing somersaulting handled by physics. | |
| bool | m_bRunning = true |
| std::chrono::time_point< std::chrono::steady_clock > | m_timeLastToggleRun |
| std::chrono::time_point< std::chrono::steady_clock > | m_timeLastToggleUseItem |
| bool | m_bJustCreatedAndExpectingStartPos = true |
| proofps_dd::Strafe | m_strafe = Strafe::NONE |
| proofps_dd::Strafe | m_prevActualStrafe = Strafe::NONE |
| std::chrono::time_point< std::chrono::steady_clock > | m_timeLastStrafe |
| float | m_strafeSpeed = 0.f |
| bool | m_bAttack = false |
| bool | m_bHasJetLax = false |
| bool | m_bHasAntiGravityActive = false |
| PgeOldNewValue< float > | m_fCurrentInventoryItemPower { 0.f } |
| int | m_nParticleEmitPerNthPhysicsIterCntr { 0 } |
| Counter to be used by particle emitter logic. | |
Static Private Attributes | |
| static const std::map< MapItemType, std::string > | m_mapItemTypeToWeaponFilename |
| static uint32_t | m_nPlayerInstanceCntr = 0 |
| static SoLoud::Wav * | m_sndWpnAmmo = nullptr |
| static SoLoud::Wav * | m_sndWpnNew = nullptr |
| static SoLoud::Wav * | m_sndArmor = nullptr |
| static SoLoud::Wav * | m_sndMedkit = nullptr |
| static SoLoud::Wav * | m_sndJetlax = nullptr |
| static SoLoud::Wav * | m_sndJumppad = nullptr |
| static SoLoud::Wav * | m_sndPlayerItemActivateAntiGravity = nullptr |
| static SoLoud::Wav * | m_sndPlayerItemDeactivateAntiGravity = nullptr |
| static SoLoud::Wav * | m_sndPlayerItemLowThrustAntiGravity = nullptr |
| static SoLoud::Wav * | m_sndPlayerItemHighThrustAntiGravity = nullptr |
| static SoLoud::Wav * | m_sndFallYell_1 = nullptr |
| static SoLoud::Wav * | m_sndFallYell_2 = nullptr |
| static SoLoud::Wav * | m_sndPlayerLandSmallFall = nullptr |
| static SoLoud::Wav * | m_sndPlayerLandBigFall = nullptr |
| static SoLoud::Wav * | m_sndPlayerDamage = nullptr |
| static SoLoud::Wav * | m_sndPlayerFootstep [4] = { nullptr } |
| static SoLoud::Wav * | m_sndPlayerFunnyLaughDiedByLanding = nullptr |
| static std::chrono::milliseconds::rep | m_nMaxSndPlayerFootstepDurationMillisecs = 0 |
| static std::chrono::milliseconds::rep | m_nMinTimeBetweenPlayerWalkSoundsMillisecs = 0 |
|
strongprivate |
|
explicit |
Definition at line 86 of file Player.cpp.
| proofps_dd::Player::~Player | ( | ) |
Definition at line 293 of file Player.cpp.
| proofps_dd::Player::Player | ( | const Player & | other | ) |
Definition at line 234 of file Player.cpp.
|
delete |
| bool proofps_dd::Player::attack | ( | ) |
Definition at line 1887 of file Player.cpp.
|
private |
Definition at line 2789 of file Player.cpp.
| void proofps_dd::Player::cancelWillWallJump | ( | ) |
Resets getWillWallJumpInNextTick().
In some case, a triggered wall jump should be cancelled. Since wall jumping is triggered by player in input handling, but actually triggered in physics, we have to cancel the player-triggered wall jump in physics if we detect no actual horizontal wall collision. Otherwise, the wall jump would be really triggered by physics later due to the set flag.
Definition at line 1289 of file Player.cpp.
| bool proofps_dd::Player::canFall | ( | ) | const |
Definition at line 928 of file Player.cpp.
| bool proofps_dd::Player::canTakeItem | ( | const MapItem & | item | ) | const |
Definition at line 1981 of file Player.cpp.
| void proofps_dd::Player::clearNetDirty | ( | ) |
Clears the isNetDirty() flag.
The idea is that this should be called by the game only after sending out updates to clients.
Definition at line 582 of file Player.cpp.
| void proofps_dd::Player::die | ( | bool | bMe, |
| bool | bServer ) |
Definition at line 646 of file Player.cpp.
| void proofps_dd::Player::doCrouchServer | ( | ) |
Changing player properties for physics.
Invokes getPos().commit() too so not be called careless from anywhere. Should be invoked only by server physics at the beginning of physics calculations.
| bPullUpLegs | True will result in the top Y position of the object won't change thus it will shrink upwards (should be used mid-air). False will result in both the top and bottom Y positions of the object will change thus it will shrink towards center (should be used on ground). |
Definition at line 1538 of file Player.cpp.
| void proofps_dd::Player::doCrouchShared | ( | ) |
Definition at line 1567 of file Player.cpp.
| void proofps_dd::Player::doDamage | ( | int | dmgAP, |
| int | dmgHP ) |
Input can be the calculated damage caused by bullet, or falling from high, etc.
AP is able to decrease the suffered HP damage, but not vice versa. This means a player can die even if AP stays positive.
| dmgAP | The input damage that will be applied to AP. It simply decreases AP by this value. |
| dmgHP | The input damage that will be applied to HP. This damage is decreased by the decreased AP before being applied to HP. |
Definition at line 622 of file Player.cpp.
| void proofps_dd::Player::doStandupServer | ( | ) |
Changing player properties for physics.
Invokes getPos().set() too so not be called careless from anywhere. Should be invoked only by server physics during physics calculations.
Definition at line 1582 of file Player.cpp.
| void proofps_dd::Player::doStandupShared | ( | ) |
Definition at line 1604 of file Player.cpp.
|
private |
Definition at line 2824 of file Player.cpp.
| void proofps_dd::Player::forceDeactivateCurrentInventoryItem | ( | ) |
Definition at line 1467 of file Player.cpp.
|
static |
Definition at line 43 of file Player.cpp.
| PgeOldNewValue< bool > & proofps_dd::Player::getActuallyRunningOnGround | ( | ) |
Definition at line 1855 of file Player.cpp.
| const PgeOldNewValue< bool > & proofps_dd::Player::getActuallyRunningOnGround | ( | ) | const |
Definition at line 1849 of file Player.cpp.
| PgeOldNewValue< TPureFloat > & proofps_dd::Player::getAngleY | ( | ) |
Definition at line 853 of file Player.cpp.
| const PgeOldNewValue< TPureFloat > & proofps_dd::Player::getAngleY | ( | ) | const |
Definition at line 859 of file Player.cpp.
| PgeOldNewValue< TPureFloat > & proofps_dd::Player::getAngleZ | ( | ) |
Definition at line 865 of file Player.cpp.
| const PgeOldNewValue< TPureFloat > & proofps_dd::Player::getAngleZ | ( | ) | const |
Definition at line 871 of file Player.cpp.
| PureVector & proofps_dd::Player::getAntiGravityForce | ( | ) |
Definition at line 1368 of file Player.cpp.
|
private |
Definition at line 2857 of file Player.cpp.
| const PgeOldNewValue< int > & proofps_dd::Player::getArmor | ( | ) | const |
Definition at line 592 of file Player.cpp.
| bool & proofps_dd::Player::getAttack | ( | ) |
Definition at line 1882 of file Player.cpp.
| CConsole & proofps_dd::Player::getConsole | ( | ) | const |
Definition at line 587 of file Player.cpp.
| PgeOldNewValue< bool > & proofps_dd::Player::getCrouchInput | ( | ) |
Definition at line 1489 of file Player.cpp.
| bool & proofps_dd::Player::getCrouchStateCurrent | ( | ) |
Definition at line 1495 of file Player.cpp.
| const bool & proofps_dd::Player::getCrouchStateCurrent | ( | ) | const |
Definition at line 1500 of file Player.cpp.
| const PgeOldNewValue< float > & proofps_dd::Player::getCurrentInventoryItemPower | ( | ) | const |
Definition at line 1392 of file Player.cpp.
| PgeOldNewValue< int > & proofps_dd::Player::getDeaths | ( | ) |
Definition at line 699 of file Player.cpp.
| const PgeOldNewValue< int > & proofps_dd::Player::getDeaths | ( | ) | const |
Definition at line 705 of file Player.cpp.
| PgeOldNewValue< bool > & proofps_dd::Player::getDescentInput | ( | ) |
Definition at line 1614 of file Player.cpp.
| PgeOldNewValue< float > & proofps_dd::Player::getFiringAccuracy | ( | ) |
Definition at line 723 of file Player.cpp.
| const PgeOldNewValue< float > & proofps_dd::Player::getFiringAccuracy | ( | ) | const |
Definition at line 729 of file Player.cpp.
| PgeOldNewValue< int > & proofps_dd::Player::getFrags | ( | ) |
Definition at line 1959 of file Player.cpp.
| const PgeOldNewValue< int > & proofps_dd::Player::getFrags | ( | ) | const |
Definition at line 1965 of file Player.cpp.
| float proofps_dd::Player::getGravity | ( | ) | const |
Definition at line 888 of file Player.cpp.
| bool proofps_dd::Player::getHasJustStartedFallingAfterJumpingStoppedInThisTick | ( | ) | const |
Definition at line 987 of file Player.cpp.
| bool proofps_dd::Player::getHasJustStartedFallingNaturallyInThisTick | ( | ) | const |
Definition at line 961 of file Player.cpp.
| bool & proofps_dd::Player::getHasJustStoppedJumpingInThisTick | ( | ) |
Definition at line 1064 of file Player.cpp.
|
private |
Definition at line 2863 of file Player.cpp.
| const PgeOldNewValue< int > & proofps_dd::Player::getHealth | ( | ) | const |
Definition at line 602 of file Player.cpp.
| float proofps_dd::Player::getHeightJumpInitiated | ( | ) | const |
Definition at line 1195 of file Player.cpp.
| const float proofps_dd::Player::getHeightStartedFalling | ( | ) | const |
The vertical position of the player in the moment of Physics class invoked:
Definition at line 1055 of file Player.cpp.
| PureVector & proofps_dd::Player::getImpactForce | ( | ) |
Definition at line 641 of file Player.cpp.
| const PgeOldNewValue< bool > & proofps_dd::Player::getInvulnerability | ( | ) | const |
Definition at line 395 of file Player.cpp.
| const unsigned int & proofps_dd::Player::getInvulnerabilityDurationSeconds | ( | ) | const |
Definition at line 417 of file Player.cpp.
| const std::string & proofps_dd::Player::getIpAddress | ( | ) | const |
Definition at line 356 of file Player.cpp.
| PureVector & proofps_dd::Player::getJumpForce | ( | ) |
Definition at line 1200 of file Player.cpp.
| PgeOldNewValue< bool > & proofps_dd::Player::getJumpInput | ( | ) |
Definition at line 910 of file Player.cpp.
|
static |
Definition at line 38 of file Player.cpp.
| const std::string & proofps_dd::Player::getName | ( | ) | const |
Definition at line 361 of file Player.cpp.
| PureObject3D * proofps_dd::Player::getObject3D | ( | ) | const |
Definition at line 883 of file Player.cpp.
|
private |
Definition at line 2814 of file Player.cpp.
|
private |
Definition at line 2819 of file Player.cpp.
| PgeOldNewValue< PureVector > & proofps_dd::Player::getPos | ( | ) |
Definition at line 831 of file Player.cpp.
| const PgeOldNewValue< PureVector > & proofps_dd::Player::getPos | ( | ) | const |
Definition at line 837 of file Player.cpp.
| const proofps_dd::Strafe & proofps_dd::Player::getPreviousActualStrafe | ( | ) | const |
Gets previous non-NONE strafe value registered before the last NONE strafe value and the current non-NONE strafe state.
It is Strafe::NONE only right after constructing the Player object or after respawn().
Definition at line 1834 of file Player.cpp.
| float proofps_dd::Player::getProposedNewPosYforStandup | ( | ) | const |
Definition at line 1520 of file Player.cpp.
| bool & proofps_dd::Player::getResettlingFlag | ( | ) |
Definition at line 806 of file Player.cpp.
| bool & proofps_dd::Player::getRespawnFlag | ( | ) |
Definition at line 757 of file Player.cpp.
| const pge_network::PgeNetworkConnectionHandle & proofps_dd::Player::getServerSideConnectionHandle | ( | ) | const |
Definition at line 351 of file Player.cpp.
| PgeOldNewValue< unsigned int > & proofps_dd::Player::getShotsFiredCount | ( | ) |
Definition at line 735 of file Player.cpp.
| const PgeOldNewValue< unsigned int > & proofps_dd::Player::getShotsFiredCount | ( | ) | const |
Definition at line 741 of file Player.cpp.
| unsigned int & proofps_dd::Player::getShotsHitTarget | ( | ) |
Definition at line 747 of file Player.cpp.
| const unsigned int & proofps_dd::Player::getShotsHitTarget | ( | ) | const |
Definition at line 752 of file Player.cpp.
| float proofps_dd::Player::getSomersaultAngle | ( | ) | const |
Definition at line 1737 of file Player.cpp.
| const proofps_dd::Strafe & proofps_dd::Player::getStrafe | ( | ) | const |
Definition at line 1808 of file Player.cpp.
| float & proofps_dd::Player::getStrafeSpeed | ( | ) |
Definition at line 1844 of file Player.cpp.
| PgeOldNewValue< unsigned int > & proofps_dd::Player::getSuicides | ( | ) |
Definition at line 711 of file Player.cpp.
| const PgeOldNewValue< unsigned int > & proofps_dd::Player::getSuicides | ( | ) | const |
Definition at line 717 of file Player.cpp.
| PgeOldNewValue< unsigned int > & proofps_dd::Player::getTeamId | ( | ) |
Definition at line 1971 of file Player.cpp.
| const PgeOldNewValue< unsigned int > & proofps_dd::Player::getTeamId | ( | ) | const |
Definition at line 1976 of file Player.cpp.
| int & proofps_dd::Player::getTicksSinceLastHorizontalCollision | ( | ) |
Definition at line 1336 of file Player.cpp.
| const std::chrono::time_point< std::chrono::steady_clock > & proofps_dd::Player::getTimeBootedUp | ( | ) | const |
Definition at line 318 of file Player.cpp.
| const std::chrono::time_point< std::chrono::steady_clock > & proofps_dd::Player::getTimeConstructed | ( | ) | const |
Definition at line 309 of file Player.cpp.
| const std::chrono::time_point< std::chrono::steady_clock > & proofps_dd::Player::getTimeDied | ( | ) | const |
Definition at line 682 of file Player.cpp.
| const std::chrono::time_point< std::chrono::steady_clock > & proofps_dd::Player::getTimeInvulnerabilityStarted | ( | ) | const |
Definition at line 422 of file Player.cpp.
| const std::chrono::time_point< std::chrono::steady_clock > & proofps_dd::Player::getTimeLastActualStrafe | ( | ) | const |
Definition at line 1839 of file Player.cpp.
| const std::chrono::time_point< std::chrono::steady_clock > & proofps_dd::Player::getTimeLastSetWillJump | ( | ) | const |
Definition at line 1190 of file Player.cpp.
| const std::chrono::time_point< std::chrono::steady_clock > & proofps_dd::Player::getTimeLastToggleRun | ( | ) | const |
Definition at line 1798 of file Player.cpp.
| const std::chrono::time_point< std::chrono::steady_clock > & proofps_dd::Player::getTimeLastToggleUseItem | ( | ) | const |
Definition at line 1803 of file Player.cpp.
| const std::chrono::time_point< std::chrono::steady_clock > & proofps_dd::Player::getTimeStartedFalling | ( | ) | const |
The timestamp of the moment Physics class invoked:
Definition at line 1045 of file Player.cpp.
| bool & proofps_dd::Player::getWantToStandup | ( | ) |
Definition at line 1515 of file Player.cpp.
| PgeOldNewValue< PureVector > & proofps_dd::Player::getWeaponAngle | ( | ) |
Definition at line 877 of file Player.cpp.
| Weapon * proofps_dd::Player::getWeaponInstanceByMapItemType | ( | const MapItemType & | mapItemType | ) |
Definition at line 2142 of file Player.cpp.
| const Weapon * proofps_dd::Player::getWeaponInstanceByMapItemType | ( | const MapItemType & | mapItemType | ) | const |
Definition at line 2108 of file Player.cpp.
| WeaponManager & proofps_dd::Player::getWeaponManager | ( | ) |
Definition at line 515 of file Player.cpp.
| const WeaponManager & proofps_dd::Player::getWeaponManager | ( | ) | const |
Definition at line 520 of file Player.cpp.
|
private |
Definition at line 2869 of file Player.cpp.
| const PgeOldNewValue< float > & proofps_dd::Player::getWeaponMomentaryAccuracy | ( | ) | const |
Definition at line 1942 of file Player.cpp.
| float proofps_dd::Player::getWillJumpXInNextTick | ( | ) | const |
Definition at line 1158 of file Player.cpp.
| float proofps_dd::Player::getWillJumpYInNextTick | ( | ) | const |
Definition at line 1163 of file Player.cpp.
| bool proofps_dd::Player::getWillSomersaultInNextTick | ( | ) | const |
Definition at line 1620 of file Player.cpp.
| bool proofps_dd::Player::getWillWallJumpInNextTick | ( | ) | const |
Definition at line 1205 of file Player.cpp.
| void proofps_dd::Player::handleActuallyRunningOnGround | ( | ) |
Definition at line 2339 of file Player.cpp.
| void proofps_dd::Player::handleFallingFromHigh | ( | int | iServerScream | ) |
Definition at line 2200 of file Player.cpp.
| void proofps_dd::Player::handleJumppadActivated | ( | ) |
Definition at line 2650 of file Player.cpp.
| void proofps_dd::Player::handleLanded | ( | const float & | fFallHeight, |
| bool | bDamageTaken, | ||
| bool | bDied, | ||
| PureVector & | vecCamShakeForce, | ||
| const bool & | bMe ) |
Definition at line 2264 of file Player.cpp.
| void proofps_dd::Player::handleTakeNonWeaponItem | ( | const proofps_dd::MapItemType & | eMapItemType, |
| const bool & | bMe ) |
Definition at line 2375 of file Player.cpp.
| void proofps_dd::Player::handleTakeWeaponItem | ( | const proofps_dd::MapItemType & | eMapItemType, |
| const Weapon & | wpnTaken, | ||
| const bool & | bJustBecameAvailable, | ||
| const int & | nAmmoIncrease ) |
Definition at line 2617 of file Player.cpp.
| void proofps_dd::Player::handleTeamIdChanged | ( | const unsigned int & | iTeamId | ) |
Definition at line 2675 of file Player.cpp.
| void proofps_dd::Player::handleToggleInventoryItem | ( | const proofps_dd::MapItemType & | eMapItemType, |
| const bool & | bSyncHistory ) |
Definition at line 2460 of file Player.cpp.
| void proofps_dd::Player::handleToggleSpectatorMode | ( | ) |
Definition at line 2710 of file Player.cpp.
| void proofps_dd::Player::handleUntakeInventoryItem | ( | const proofps_dd::MapItemType & | eMapItemType | ) |
Definition at line 2582 of file Player.cpp.
| bool proofps_dd::Player::hasAntiGravityActive | ( | ) | const |
Definition at line 1351 of file Player.cpp.
| bool proofps_dd::Player::hasBootedUp | ( | ) | const |
Definition at line 336 of file Player.cpp.
| bool proofps_dd::Player::hasJetLax | ( | ) | const |
Definition at line 1341 of file Player.cpp.
| void proofps_dd::Player::hide | ( | ) |
Definition at line 484 of file Player.cpp.
| bool proofps_dd::Player::isDirty | ( | ) | const |
Check if there is any old-new value pending to be committed.
Definition at line 529 of file Player.cpp.
| bool proofps_dd::Player::isExpectingAfterBootUpDelayedUpdate | ( | ) | const |
Definition at line 341 of file Player.cpp.
| bool proofps_dd::Player::isFalling | ( | ) | const |
Unlike canFall(), this returns a more useful value about falling actually confirmed by the physics engine.
The falling can be "natural" or when the last jump-induced upward movement has stopped. See:
Definition at line 1019 of file Player.cpp.
| bool proofps_dd::Player::isFallingAfterJumpingStopped | ( | ) | const |
Definition at line 1035 of file Player.cpp.
| bool proofps_dd::Player::isFallingNaturally | ( | ) | const |
Definition at line 1027 of file Player.cpp.
| const bool & proofps_dd::Player::isForcedSpectating | ( | ) | const |
Definition at line 381 of file Player.cpp.
| bool proofps_dd::Player::isInAir | ( | ) | const |
Definition at line 952 of file Player.cpp.
| bool & proofps_dd::Player::isInSpectatorMode | ( | ) |
Definition at line 371 of file Player.cpp.
| const bool & proofps_dd::Player::isInSpectatorMode | ( | ) | const |
Definition at line 376 of file Player.cpp.
| bool proofps_dd::Player::isJumping | ( | ) | const |
Definition at line 916 of file Player.cpp.
| const bool & proofps_dd::Player::isJumpingInitiatedFromCrouching | ( | ) | const |
Definition at line 1505 of file Player.cpp.
| const bool & proofps_dd::Player::isJumpInitiatedByJumppad | ( | ) | const |
Definition at line 1510 of file Player.cpp.
| bool proofps_dd::Player::isJustCreatedAndExpectingStartPos | ( | ) | const |
Definition at line 843 of file Player.cpp.
| bool proofps_dd::Player::isMoving | ( | ) | const |
Tells if the player is stationary or not.
This function was created to be used in any phase of a frame. There are some situations when checking (getPos().getOld() == getPos().getNew()) won't work, for example, if we are checking that condition before the next physics tick in the current frame. It might use previous frame's data, so it should be used only if the truth of the returned value being false for or late by 1 frame is not a problem.
Can be used only on server instance, as client returns false info due to lack of some data.
Definition at line 1874 of file Player.cpp.
| bool proofps_dd::Player::isNetDirty | ( | ) | const |
Check if there was any old-new value updated in recent updateOldValues() call(s) since the last call to clearNetDirty().
The idea is that the game should invoke updateOldValues() in every tick/physics iteration, and the game should later check the isNetDirty() flag to decide if it should send out updates to clients or not. Thus the isNetDirty() flag cannot be set by the game itself, it is always set by the updateOldValues(), and the game is expected to clear it using clearNetDirty() after sending out updates to clients.
Definition at line 573 of file Player.cpp.
| bool proofps_dd::Player::isRunning | ( | ) | const |
Definition at line 1787 of file Player.cpp.
| bool proofps_dd::Player::isSomersaulting | ( | ) | const |
Definition at line 1732 of file Player.cpp.
| bool proofps_dd::Player::isVisible | ( | ) | const |
Definition at line 505 of file Player.cpp.
| void proofps_dd::Player::jump | ( | const float & | fRunSpeedPerTickForJumppadHorizontalForce = 0.f | ) |
Triggers a jump.
Prior calling to setWillJumpInNextTick() is mandatory for setting up jump multiplier factors for calculating forces.
Cannot trigger another jump if already jumping or somersaulting.
Since jump() is also used to trigger jumppad-induced jumps, that could also trigger horizontal force, we have fRunSpeedPerTickForJumppadHorizontalForce optional argument for such calculation.
| fRunSpeedPerTickForJumppadHorizontalForce | Optional, only used in case of jumppad-induced jumps to calculate horizontal jump force. |
Definition at line 1096 of file Player.cpp.
| bool proofps_dd::Player::jumpAllowed | ( | ) | const |
Definition at line 1072 of file Player.cpp.
| void proofps_dd::Player::moveTimeDiedEarlier | ( | std::chrono::milliseconds::rep | byMillisecs | ) |
Definition at line 687 of file Player.cpp.
| void proofps_dd::Player::resetSomersaultServer | ( | ) |
Definition at line 1781 of file Player.cpp.
| void proofps_dd::Player::resettleAndRespawnShared | ( | ) |
Definition at line 811 of file Player.cpp.
| void proofps_dd::Player::respawn | ( | bool | bMe, |
| const Weapon & | wpnDefaultAvailable, | ||
| bool | bServer ) |
Definition at line 762 of file Player.cpp.
| void proofps_dd::Player::setArmor | ( | int | value | ) |
Definition at line 598 of file Player.cpp.
| void proofps_dd::Player::setCanFall | ( | bool | state | ) |
To be invoked by Physics class whenever it detects change in the status of falling.
See canFall() for details.
Definition at line 937 of file Player.cpp.
| void proofps_dd::Player::setCurrentInventoryItemPower | ( | const float & | newValue | ) |
Unlike with other PgeOldNewValue functions, we do not define a non-const version of getCurrentInventoryItemPower(), so this way we force that both server- and client instances must call this function for updating inventory item power.
Reason: originally we wanted to use this as a convenient and reliable way to control the inventory item sound based on power drop (low drop vs high drop) at a single location. But the server still invokes this 2 times per frame, from Physics' serverUpdateAntiGravityForce() and that messed up this plan. So we now control sound in a separate function: updateCurrentInventoryItemPowerAudioVisualsShared().
Definition at line 1383 of file Player.cpp.
| void proofps_dd::Player::setExpectingAfterBootUpDelayedUpdate | ( | bool | b | ) |
Definition at line 346 of file Player.cpp.
| void proofps_dd::Player::setForcedSpectating | ( | bool | value | ) |
Definition at line 386 of file Player.cpp.
| void proofps_dd::Player::setGravity | ( | float | value | ) |
Physics class is required to invoke this in every physics tick.
The gravity that is constantly pulling down objects in the game is constant but we maintain a momentary value for each dynamic object, derived from the constant gravity. This momentary value is being changed in each physics tick using this function. Detecting "natural" or "post-jump" falling also depends on this.
Definition at line 900 of file Player.cpp.
| void proofps_dd::Player::setHasAntiGravityActive | ( | bool | state | ) |
Definition at line 1356 of file Player.cpp.
| void proofps_dd::Player::setHasJetLax | ( | bool | state | ) |
Definition at line 1346 of file Player.cpp.
| void proofps_dd::Player::setHasJustStartedFallingAfterJumpingStoppedInThisTick | ( | bool | val | ) |
Physics class is required to invoke this whenever a player-induced jump has just been finished its upward movement.
Definition at line 995 of file Player.cpp.
| void proofps_dd::Player::setHasJustStartedFallingNaturallyInThisTick | ( | bool | val | ) |
Physics class is required to invoke this whenever the gravity pulling force actually manages to decrease the altitude of the player in a physics tick, after it was not yet possible in the previous tick.
Definition at line 970 of file Player.cpp.
| void proofps_dd::Player::setHealth | ( | int | value | ) |
Definition at line 608 of file Player.cpp.
| void proofps_dd::Player::setInvulnerability | ( | const bool & | bState, |
| const unsigned int & | nSeconds = 0 ) |
Both server and client use this function.
However, only server actually uses the nSeconds argument. Client never knows the duration of invulnerability, it just always sets the state received from server. Server is responsible for managing invulnerability durations and explicitly notifying clients about invulnerability ending.
| bState | True for activating player invulnerability, false to reset it. |
| nSeconds | Duration of invulnerability. Used by server instance only. |
Definition at line 410 of file Player.cpp.
| void proofps_dd::Player::setJumpAllowed | ( | bool | b | ) |
Physics class is required to invoke this in every physics tick based on different conditions.
Definition at line 1080 of file Player.cpp.
| void proofps_dd::Player::setJustCreatedAndExpectingStartPos | ( | bool | b | ) |
Definition at line 848 of file Player.cpp.
| void proofps_dd::Player::setName | ( | const std::string & | sName | ) |
Definition at line 366 of file Player.cpp.
| void proofps_dd::Player::setRun | ( | bool | state | ) |
Definition at line 1792 of file Player.cpp.
| void proofps_dd::Player::setSomersaultClient | ( | float | angleZ | ) |
Since server calculates somersault angle, client just receives the angle periodically from server.
This function is for that case when server sends the updated angle.
Definition at line 1727 of file Player.cpp.
| void proofps_dd::Player::setStrafe | ( | const proofps_dd::Strafe & | strafe | ) |
Definition at line 1813 of file Player.cpp.
| void proofps_dd::Player::setTimeBootedUp | ( | ) |
Based on PRooFPS v0.5 network protocol, this is set when MsgUserNameChangeAndBootupDone is processed.
This is processed by all network instances on their side, therefore expected to be valid in every network instance for every player.
Definition at line 327 of file Player.cpp.
| void proofps_dd::Player::setVisibilityState | ( | bool | state | ) |
Sets visibility state for BOTH the player object and the current weapon.
Definition at line 492 of file Player.cpp.
| void proofps_dd::Player::setWeaponMomentaryAccuracy | ( | float | value | ) |
This is just for server sending momentary weapon accuracy to all players, so they can scale their xhair accordingly.
Only server is able to calculate players' aim accuracy, it is easier to simply send it to them.
Definition at line 1952 of file Player.cpp.
| void proofps_dd::Player::setWillJumpInNextTick | ( | float | factorY, |
| float | factorX ) |
Sets the multipliers for jump force that will be used for the next jump.
The jump will actually happen in the current or in the next tick, depending on WHEN this function is called. See Physics code for details.
| factorY | Multiplier for Player::fJumpGravityStartFromStanding. Use 1.0 to trigger a regular jump from standing position. Any value that is not 0 or 1.0 is considered to be a jumppad-induced jump when jump() is invoked. Use 0 to cancel the jump triggering in the current or in the next tick. |
Definition at line 1177 of file Player.cpp.
| void proofps_dd::Player::setWillSomersaultInNextTick | ( | bool | flag | ) |
Definition at line 1625 of file Player.cpp.
| void proofps_dd::Player::setWillWallJumpInNextTick | ( | ) |
Sets the multipliers for jump force that will be used for the next wall jump.
The wall jump will actually happen in the current or in the next tick, depending on WHEN this function is called. See Physics code for details.
Unlike a regular jump, wall jump can be initiated only if the player has already initiated a regular jump before, and the player is still "in" that regular jump i.e. not yet started to fall down or already on ground. Additional requirement is that the player must look in the opposite direction of the wall they are strafing against. So if player is strafing towards left wall, they shall look to the right when triggering wall jump.
Definition at line 1225 of file Player.cpp.
| void proofps_dd::Player::show | ( | ) |
Definition at line 479 of file Player.cpp.
| void proofps_dd::Player::startSomersaultServer | ( | bool | bJumpInduced | ) |
Salto/somersault aka front-/backflip.
The idea is this function sets an initial positive or negative value for the angle based on strafe direction, and then Physics class will take care of the full somersaulting by periodic calls to stepSomersaultAngleServer().
| bJumpInduced | Set it to true if somersault is initiated during jump-up so it will be a mid-air salto/somersault. Set it to false if somersault is initiated on-ground so it will be an on-ground somersault. |
Definition at line 1638 of file Player.cpp.
| void proofps_dd::Player::stepSomersaultAngleServer | ( | float | angle | ) |
Stepping the somersault angle i.e.
changing the angle in the proper direction. The idea is that we set the initial angle by a call to startSomersaultServer() and then in consecutive physics timesteps we call stepSomersaultAngleServer() with a value calculated by the physics engine. Somersaulting will stop once stepSomersaultAngleServer() finishes a complete roll/flip. This also means that currently only 1 full roll/flip is done before isSomersaulting() returns false again.
Definition at line 1749 of file Player.cpp.
| void proofps_dd::Player::stopJumping | ( | ) |
Definition at line 1151 of file Player.cpp.
| void proofps_dd::Player::takeItem | ( | MapItem & | item, |
| pge_network::PgePacket & | pktWpnUpdate, | ||
| bool & | bHasJustBecomeAvailable ) |
| item | Item being picked up by the player. |
| pktWpnUpdate | This function writes MsgWpnUpdateFromServer into this packet. |
| bHasJustBecomeAvailable | Set by function only in case of weapon items. True if player did not have this weapon before, false otherwise. |
Definition at line 2018 of file Player.cpp.
| void proofps_dd::Player::updateAudioVisuals | ( | const proofps_dd::Config & | config, |
| bool | bServer, | ||
| bool | bAllowedForGameplay ) |
Invoked in every frame.
| bAllowedForGameplay | Shall come from GameMode::isPlayerAllowedForGameplay(). |
Definition at line 432 of file Player.cpp.
| void proofps_dd::Player::updateCurrentInventoryItemPowerAudioVisualsShared | ( | const proofps_dd::Config & | config, |
| PgeObjectPool< Smoke > & | smokes ) |
For this audio-visual control to work properly, this function shall be invoked MAX 1 time per frame!
Server instance shall invoke it after it updated current inventory item power for the last time in the current frame, but before clearing dirtiness of old-new values. Basically it is invoked at tick-rate.
Client instance shall invoke it before clearing dirtiness of old-new values.
Definition at line 1406 of file Player.cpp.
| void proofps_dd::Player::updateImpactForceByBulletImpactOrRecoil | ( | bool | bRecoil, |
| Bullet & | bullet, | ||
| Weapon & | wpn ) |
| bRecoil | True if the impact is due to this player firing a bullet, false otherwise (if impact is due to another player's bullet is hitting this player). |
| bullet | It is either the bullet fired by this player in case of bRecoil is true, or the attacker's fired bullet impacting this player if bRecoil is false. |
| wpn | It is either this player's current weapon in case of bRecoil is true, or the attacker's weapon if bRecoil is false. |
Definition at line 2156 of file Player.cpp.
| void proofps_dd::Player::updateOldValues | ( | ) |
Invokes commit() for all maintained old-new values.
Also sets the isNetDirty() flag if there was any dirty old-new value. The idea is that the game should invoke this function in every tick/physics iteration, and the game should later check the isNetDirty() flag to decide if it should send out updates to clients or not.
Definition at line 546 of file Player.cpp.
| void proofps_dd::Player::wallJump | ( | ) |
Definition at line 1294 of file Player.cpp.
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
private |
|
private |
True when player is crouching currently, regardless of current input (OvCrouchInput).
This should be replicated to all clients and should affect the visuals of the player. Can be set to true by input, but only server physics engine can set it to false, or a respawn event. Somersaulting can also set it to true if mid-air auto-crouch is enabled (Player::szCVarSvSomersaultMidAirAutoCrouch). Default false.
|
private |
|
private |
|
private |
|
private |
This flag is set by handleFallingFromHigh(), we need to use this flag to make sure the actions are triggered only once when the player is falling from high.
This is because Physics calls handleFallingFromHigh() in each physics step when the player is falling from high. Reset of this flag should be whenever falling high is interrupted, e.g. when player landed on ground.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
True when player wants standing position as per input, regardless of currently crouching or not.
This is an input to the physics engine. Unlike getCrouchInput(), this is persistent across frames. If this is true and the player is currently crouching, the physics engine will contantly check if there is possibility to stand up i.e. there is nothing blocking us from standing up. If the physics engine finds enough space to stand up and other conditions are also fulfilled (e.g. not somersaulting), it will flip m_bCrouchingStateCurrent to false so higher level layers will know the player is not crouching anymore. Default true.
|
private |
Used by both server and clients to identify the connection.
Clients don't use it for direct communication. Note: this is the client's handle on server side! This is not the same handle as client has for the connection towards the server, those connection handles are not related to each other!
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
Before v0.2.6 this was a boolean value, but then I changed it to float so it also means how strong the jump will be.
0 means false in the pre-v0.2.6 world, and any positive value means true (= player will jump). Also I added Y to the end of the name because now we also record FactorX in separate var.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
Which team this player belongs to.
Not all game modes use this member. Check the API documentation of the GameMode-derived classes to know more. 0 means no team selected. Intentionally not part of m_vecOldNewValues, does not contribute to isDirty() or isNetDirty() or MsgUserUpdateFromServer either. Handled in MsgPlayerEventFromServer.
|
staticprivate |
|
private |
|
private |
|
staticprivate |
|
staticprivate |
|
private |
|
staticprivate |
|
private |
|
private |
|
private |
|
private |
|
private |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
private |
|
private |
Timestamp of server-side processing of UserNameChangeAndBootupDone (after MsgUserConnectedServerSelf and MsgUserSetupFromServer is already processed.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
See explanation of this at Smoke::smokeEmitOperValues.
|
staticconstexpr |
See explanation of this at Smoke::smokeEmitOperValues.
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |