![]() |
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, std::list< Bullet > &bullets, EventLister &eventsItemPickup, 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 &) |
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 () |
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) |
void | updateAudioVisuals (const proofps_dd::Config &config, bool bServer) |
void | show () |
void | hide () |
void | setVisibilityState (bool state) |
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 |
PgeOldNewValue< int > & | getDeaths () |
const PgeOldNewValue< int > & | getDeaths () const |
bool & | getRespawnFlag () |
void | respawn (bool bMe, const Weapon &wpnDefaultAvailable, bool bServer) |
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) |
bool | isJumping () const |
bool | canFall () const |
void | setCanFall (bool state) |
bool | isInAir () const |
bool | getHasJustStartedFallingNaturallyInThisTick () const |
void | setHasJustStartedFallingNaturallyInThisTick (bool val) |
bool | getHasJustStartedFallingAfterJumpingStoppedInThisTick () const |
void | setHasJustStartedFallingAfterJumpingStoppedInThisTick (bool val) |
bool | isFalling () const |
const std::chrono::time_point< std::chrono::steady_clock > & | getTimeStartedFalling () const |
const float | getHeightStartedFalling () const |
bool & | getHasJustStoppedJumpingInThisTick () |
bool | jumpAllowed () const |
void | setJumpAllowed (bool b) |
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 |
PureVector & | getJumpForce () |
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 () |
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 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 () |
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 |
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 | handleFallingFromHigh (int iServerScream) |
void | handleLanded (const float &fFallHeight, bool bDamageTaken, bool bDied) |
void | handleTakeNonWeaponItem (const proofps_dd::MapItemType &eMapItemType) |
void | handleTakeWeaponItem (const proofps_dd::MapItemType &eMapItemType, const Weapon &wpnTaken, const bool &bJustBecameAvailable, const int &nAmmoIncrease) |
void | handleJumppadActivated () |
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 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 | 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 = 10.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" |
Private Types | |
enum class | OldNewValueName { OvArmor , OvHealth , OvFrags , OvDeaths , OvPos , OvAngleY , OvAngleZ , OvWpnAngle , OvWpnMomentaryAccuracy , OvCrouchInput , OvInvulnerability } |
Private Member Functions | |
void | BuildPlayerObject (bool blend) |
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 |
std::map< OldNewValueName, std::variant< PgeOldNewValue< int >, PgeOldNewValue< bool >, PgeOldNewValue< TPureFloat >, PgeOldNewValue< PureVector > > > | m_vecOldNewValues |
bool | m_bNetDirty = false |
std::chrono::time_point< std::chrono::steady_clock > | m_timeDied |
bool | m_bRespawn = false |
std::chrono::time_point< std::chrono::steady_clock > | m_timeStartedInvulnerability |
unsigned int | m_nInvulnerabilityDurationSecs = 0 |
PureVector | m_vecImpactForce |
PureObject3D * | m_pObj = nullptr |
PureTexture * | m_pTexPlayerStand = nullptr |
PureTexture * | m_pTexPlayerCrouch = nullptr |
WeaponManager | m_wpnMgr |
pge_audio::PgeAudio & | m_audio |
PGEcfgProfiles & | m_cfgProfiles |
std::list< Bullet > & | m_bullets |
EventLister & | m_eventsItemPickup |
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. | |
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 |
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_handleFallYell = 0 |
SoLoud::handle | m_handleSndPlayerLandSmallFall = 0 |
SoLoud::handle | m_handleSndPlayerLandBigFall = 0 |
SoLoud::handle | m_handleSndPlayerDamage = 0 |
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 |
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 |
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_sndJumppad = 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 |
|
strongprivate |
|
explicit |
Definition at line 73 of file Player.cpp.
proofps_dd::Player::~Player | ( | ) |
Definition at line 257 of file Player.cpp.
proofps_dd::Player::Player | ( | const Player & | other | ) |
Definition at line 162 of file Player.cpp.
|
delete |
bool proofps_dd::Player::attack | ( | ) |
Definition at line 1252 of file Player.cpp.
|
private |
Definition at line 1698 of file Player.cpp.
bool proofps_dd::Player::canFall | ( | ) | const |
Definition at line 700 of file Player.cpp.
bool proofps_dd::Player::canTakeItem | ( | const MapItem & | item | ) | const |
Definition at line 1304 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 466 of file Player.cpp.
void proofps_dd::Player::die | ( | bool | bMe, |
bool | bServer ) |
Definition at line 530 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 930 of file Player.cpp.
void proofps_dd::Player::doCrouchShared | ( | ) |
Definition at line 959 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 506 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 974 of file Player.cpp.
void proofps_dd::Player::doStandupShared | ( | ) |
Definition at line 996 of file Player.cpp.
|
static |
Definition at line 30 of file Player.cpp.
PgeOldNewValue< TPureFloat > & proofps_dd::Player::getAngleY | ( | ) |
Definition at line 647 of file Player.cpp.
const PgeOldNewValue< TPureFloat > & proofps_dd::Player::getAngleY | ( | ) | const |
Definition at line 653 of file Player.cpp.
PgeOldNewValue< TPureFloat > & proofps_dd::Player::getAngleZ | ( | ) |
Definition at line 659 of file Player.cpp.
const PgeOldNewValue< TPureFloat > & proofps_dd::Player::getAngleZ | ( | ) | const |
Definition at line 665 of file Player.cpp.
|
private |
Definition at line 1720 of file Player.cpp.
const PgeOldNewValue< int > & proofps_dd::Player::getArmor | ( | ) | const |
Definition at line 476 of file Player.cpp.
bool & proofps_dd::Player::getAttack | ( | ) |
Definition at line 1247 of file Player.cpp.
CConsole & proofps_dd::Player::getConsole | ( | ) | const |
Definition at line 471 of file Player.cpp.
PgeOldNewValue< bool > & proofps_dd::Player::getCrouchInput | ( | ) |
Definition at line 881 of file Player.cpp.
bool & proofps_dd::Player::getCrouchStateCurrent | ( | ) |
Definition at line 887 of file Player.cpp.
const bool & proofps_dd::Player::getCrouchStateCurrent | ( | ) | const |
Definition at line 892 of file Player.cpp.
PgeOldNewValue< int > & proofps_dd::Player::getDeaths | ( | ) |
Definition at line 567 of file Player.cpp.
const PgeOldNewValue< int > & proofps_dd::Player::getDeaths | ( | ) | const |
Definition at line 573 of file Player.cpp.
PgeOldNewValue< int > & proofps_dd::Player::getFrags | ( | ) |
Definition at line 1292 of file Player.cpp.
const PgeOldNewValue< int > & proofps_dd::Player::getFrags | ( | ) | const |
Definition at line 1298 of file Player.cpp.
float proofps_dd::Player::getGravity | ( | ) | const |
Definition at line 682 of file Player.cpp.
bool proofps_dd::Player::getHasJustStartedFallingAfterJumpingStoppedInThisTick | ( | ) | const |
Definition at line 737 of file Player.cpp.
bool proofps_dd::Player::getHasJustStartedFallingNaturallyInThisTick | ( | ) | const |
Definition at line 719 of file Player.cpp.
bool & proofps_dd::Player::getHasJustStoppedJumpingInThisTick | ( | ) |
Definition at line 768 of file Player.cpp.
|
private |
Definition at line 1726 of file Player.cpp.
const PgeOldNewValue< int > & proofps_dd::Player::getHealth | ( | ) | const |
Definition at line 486 of file Player.cpp.
const float proofps_dd::Player::getHeightStartedFalling | ( | ) | const |
Definition at line 763 of file Player.cpp.
PureVector & proofps_dd::Player::getImpactForce | ( | ) |
Definition at line 525 of file Player.cpp.
const PgeOldNewValue< bool > & proofps_dd::Player::getInvulnerability | ( | ) | const |
Definition at line 316 of file Player.cpp.
const unsigned int & proofps_dd::Player::getInvulnerabilityDurationSeconds | ( | ) | const |
Definition at line 338 of file Player.cpp.
const std::string & proofps_dd::Player::getIpAddress | ( | ) | const |
Definition at line 301 of file Player.cpp.
PureVector & proofps_dd::Player::getJumpForce | ( | ) |
Definition at line 876 of file Player.cpp.
|
static |
Definition at line 25 of file Player.cpp.
const std::string & proofps_dd::Player::getName | ( | ) | const |
Definition at line 306 of file Player.cpp.
PureObject3D * proofps_dd::Player::getObject3D | ( | ) | const |
Definition at line 677 of file Player.cpp.
PgeOldNewValue< PureVector > & proofps_dd::Player::getPos | ( | ) |
Definition at line 625 of file Player.cpp.
const PgeOldNewValue< PureVector > & proofps_dd::Player::getPos | ( | ) | const |
Definition at line 631 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 1214 of file Player.cpp.
float proofps_dd::Player::getProposedNewPosYforStandup | ( | ) | const |
Definition at line 912 of file Player.cpp.
bool & proofps_dd::Player::getRespawnFlag | ( | ) |
Definition at line 579 of file Player.cpp.
const pge_network::PgeNetworkConnectionHandle & proofps_dd::Player::getServerSideConnectionHandle | ( | ) | const |
Definition at line 296 of file Player.cpp.
float proofps_dd::Player::getSomersaultAngle | ( | ) | const |
Definition at line 1122 of file Player.cpp.
const proofps_dd::Strafe & proofps_dd::Player::getStrafe | ( | ) | const |
Definition at line 1188 of file Player.cpp.
float & proofps_dd::Player::getStrafeSpeed | ( | ) |
Definition at line 1224 of file Player.cpp.
const std::chrono::time_point< std::chrono::steady_clock > & proofps_dd::Player::getTimeBootedUp | ( | ) | const |
Definition at line 276 of file Player.cpp.
const std::chrono::time_point< std::chrono::steady_clock > & proofps_dd::Player::getTimeConstructed | ( | ) | const |
Definition at line 271 of file Player.cpp.
const std::chrono::time_point< std::chrono::steady_clock > & proofps_dd::Player::getTimeDied | ( | ) | const |
Definition at line 562 of file Player.cpp.
const std::chrono::time_point< std::chrono::steady_clock > & proofps_dd::Player::getTimeInvulnerabilityStarted | ( | ) | const |
Definition at line 343 of file Player.cpp.
const std::chrono::time_point< std::chrono::steady_clock > & proofps_dd::Player::getTimeLastActualStrafe | ( | ) | const |
Definition at line 1219 of file Player.cpp.
const std::chrono::time_point< std::chrono::steady_clock > & proofps_dd::Player::getTimeLastSetWillJump | ( | ) | const |
Definition at line 871 of file Player.cpp.
const std::chrono::time_point< std::chrono::steady_clock > & proofps_dd::Player::getTimeLastToggleRun | ( | ) | const |
Definition at line 1183 of file Player.cpp.
const std::chrono::time_point< std::chrono::steady_clock > & proofps_dd::Player::getTimeStartedFalling | ( | ) | const |
Definition at line 758 of file Player.cpp.
bool & proofps_dd::Player::getWantToStandup | ( | ) |
Definition at line 907 of file Player.cpp.
PgeOldNewValue< PureVector > & proofps_dd::Player::getWeaponAngle | ( | ) |
Definition at line 671 of file Player.cpp.
Weapon * proofps_dd::Player::getWeaponInstanceByMapItemType | ( | const MapItemType & | mapItemType | ) |
Definition at line 1444 of file Player.cpp.
const Weapon * proofps_dd::Player::getWeaponInstanceByMapItemType | ( | const MapItemType & | mapItemType | ) | const |
Definition at line 1414 of file Player.cpp.
WeaponManager & proofps_dd::Player::getWeaponManager | ( | ) |
Definition at line 399 of file Player.cpp.
const WeaponManager & proofps_dd::Player::getWeaponManager | ( | ) | const |
Definition at line 404 of file Player.cpp.
|
private |
Definition at line 1732 of file Player.cpp.
const PgeOldNewValue< float > & proofps_dd::Player::getWeaponMomentaryAccuracy | ( | ) | const |
Definition at line 1275 of file Player.cpp.
float proofps_dd::Player::getWillJumpXInNextTick | ( | ) | const |
Definition at line 840 of file Player.cpp.
float proofps_dd::Player::getWillJumpYInNextTick | ( | ) | const |
Definition at line 845 of file Player.cpp.
bool proofps_dd::Player::getWillSomersaultInNextTick | ( | ) | const |
Definition at line 1006 of file Player.cpp.
void proofps_dd::Player::handleFallingFromHigh | ( | int | iServerScream | ) |
Definition at line 1450 of file Player.cpp.
void proofps_dd::Player::handleJumppadActivated | ( | ) |
Definition at line 1645 of file Player.cpp.
void proofps_dd::Player::handleLanded | ( | const float & | fFallHeight, |
bool | bDamageTaken, | ||
bool | bDied ) |
Definition at line 1514 of file Player.cpp.
void proofps_dd::Player::handleTakeNonWeaponItem | ( | const proofps_dd::MapItemType & | eMapItemType | ) |
Definition at line 1571 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 1612 of file Player.cpp.
void proofps_dd::Player::hide | ( | ) |
Definition at line 385 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 413 of file Player.cpp.
bool proofps_dd::Player::isExpectingAfterBootUpDelayedUpdate | ( | ) | const |
Definition at line 286 of file Player.cpp.
bool proofps_dd::Player::isFalling | ( | ) | const |
Definition at line 753 of file Player.cpp.
bool proofps_dd::Player::isInAir | ( | ) | const |
Definition at line 714 of file Player.cpp.
bool proofps_dd::Player::isJumping | ( | ) | const |
Definition at line 695 of file Player.cpp.
const bool & proofps_dd::Player::isJumpingInitiatedFromCrouching | ( | ) | const |
Definition at line 897 of file Player.cpp.
const bool & proofps_dd::Player::isJumpInitiatedByJumppad | ( | ) | const |
Definition at line 902 of file Player.cpp.
bool proofps_dd::Player::isJustCreatedAndExpectingStartPos | ( | ) | const |
Definition at line 637 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/late by 1 frame is not a problem.
Definition at line 1239 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 457 of file Player.cpp.
bool proofps_dd::Player::isRunning | ( | ) | const |
Definition at line 1172 of file Player.cpp.
bool proofps_dd::Player::isSomersaulting | ( | ) | const |
Definition at line 1117 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 be 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 792 of file Player.cpp.
bool proofps_dd::Player::jumpAllowed | ( | ) | const |
Definition at line 773 of file Player.cpp.
proofps_dd::Player & proofps_dd::Player::operator= | ( | const Player & | other | ) |
Definition at line 210 of file Player.cpp.
void proofps_dd::Player::resetSomersaultServer | ( | ) |
Definition at line 1166 of file Player.cpp.
void proofps_dd::Player::respawn | ( | bool | bMe, |
const Weapon & | wpnDefaultAvailable, | ||
bool | bServer ) |
Definition at line 584 of file Player.cpp.
void proofps_dd::Player::setArmor | ( | int | value | ) |
Definition at line 482 of file Player.cpp.
void proofps_dd::Player::setCanFall | ( | bool | state | ) |
Definition at line 705 of file Player.cpp.
void proofps_dd::Player::setExpectingAfterBootUpDelayedUpdate | ( | bool | b | ) |
Definition at line 291 of file Player.cpp.
void proofps_dd::Player::setGravity | ( | float | value | ) |
Definition at line 687 of file Player.cpp.
void proofps_dd::Player::setHasJustStartedFallingAfterJumpingStoppedInThisTick | ( | bool | val | ) |
Definition at line 742 of file Player.cpp.
void proofps_dd::Player::setHasJustStartedFallingNaturallyInThisTick | ( | bool | val | ) |
Definition at line 724 of file Player.cpp.
void proofps_dd::Player::setHealth | ( | int | value | ) |
Definition at line 492 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 331 of file Player.cpp.
void proofps_dd::Player::setJumpAllowed | ( | bool | b | ) |
Definition at line 777 of file Player.cpp.
void proofps_dd::Player::setJustCreatedAndExpectingStartPos | ( | bool | b | ) |
Definition at line 642 of file Player.cpp.
void proofps_dd::Player::setName | ( | const std::string & | sName | ) |
Definition at line 311 of file Player.cpp.
void proofps_dd::Player::setRun | ( | bool | state | ) |
Definition at line 1177 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 1112 of file Player.cpp.
void proofps_dd::Player::setStrafe | ( | const proofps_dd::Strafe & | strafe | ) |
Definition at line 1193 of file Player.cpp.
void proofps_dd::Player::setTimeBootedUp | ( | ) |
Definition at line 281 of file Player.cpp.
void proofps_dd::Player::setVisibilityState | ( | bool | state | ) |
Definition at line 390 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 1285 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 can 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 859 of file Player.cpp.
void proofps_dd::Player::setWillSomersaultInNextTick | ( | bool | flag | ) |
Definition at line 1011 of file Player.cpp.
void proofps_dd::Player::show | ( | ) |
Definition at line 380 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 1024 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 1134 of file Player.cpp.
void proofps_dd::Player::stopJumping | ( | ) |
Definition at line 836 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 1335 of file Player.cpp.
void proofps_dd::Player::updateAudioVisuals | ( | const proofps_dd::Config & | config, |
bool | bServer ) |
Definition at line 348 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 430 of file Player.cpp.
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
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 |
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 |
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 |
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 |
|
staticprivate |
|
private |
|
private |
|
staticprivate |
|
private |
|
private |
|
private |
|
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 |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |