PRooFPS-dd Dev Doc 1.0
PRooFPS-dd Developer Documentation
Loading...
Searching...
No Matches
proofps_dd::PlayerHandling Class Reference

Detailed Description

Definition at line 38 of file PlayerHandling.h.

#include <PlayerHandling.h>

+ Inheritance diagram for proofps_dd::PlayerHandling:

Public Member Functions

CConsole & getConsole () const
 
 PlayerHandling (PGE &pge, proofps_dd::Durations &durations, proofps_dd::GUI &gui, std::map< pge_network::PgeNetworkConnectionHandle, proofps_dd::Player > &mapPlayers, proofps_dd::Maps &maps, proofps_dd::Sounds &sounds, proofps_dd::CameraHandling &camera)
 
 PlayerHandling (const PlayerHandling &)=delete
 
PlayerHandlingoperator= (const PlayerHandling &)=delete
 
 PlayerHandling (PlayerHandling &&)=delete
 
PlayerHandling && operator= (PlayerHandling &&)=delete
 

Static Public Member Functions

static const char * getLoggerModuleName ()
 

Protected Member Functions

bool hasPlayerBootedUp (const pge_network::PgeNetworkConnectionHandle &connHandle) const
 
void handlePlayerDied (Player &player, XHair &xhair, const pge_network::PgeNetworkConnectionHandle &nKillerConnHandleServerSide)
 
void handlePlayerRespawned (Player &player, XHair &xhair)
 
void serverRespawnPlayer (Player &player, const proofps_dd::GameRestartType_KeepPlayers &eRestartType, const proofps_dd::Config &config, PGEcfgProfiles &cfgProfiles)
 Respawn is required when either a game is started, restarted, or a dead player needs to be revived.
 
void serverResettlePlayer (Player &player, const proofps_dd::Config &config)
 Resettle is required when a round-based game starts a new round, and we need to reposition alive players back to spawn points.
 
void serverUpdateRespawnTimers (const proofps_dd::Config &config, PGEcfgProfiles &cfgProfiles, proofps_dd::GameMode &gameMode, proofps_dd::Durations &durations)
 
void handlePlayerTeamIdChangedOrToggledSpectatorMode (Player &player, const unsigned int &iTeamId, const bool &bToggledSpectatorMode, const proofps_dd::Config &config, PGEcfgProfiles &cfgProfiles)
 
void handleExplosionMultiKill (int nPlayersDiedByExplosion)
 
void writePlayerList ()
 
bool handleUserConnected (pge_network::PgeNetworkConnectionHandle connHandleServerSide, const pge_network::MsgUserConnectedServerSelf &msg, PGEcfgProfiles &cfgProfiles, proofps_dd::Config &config, std::function< void(int)> &cbDisplayMapLoadingProgressUpdate)
 
bool handleUserDisconnected (pge_network::PgeNetworkConnectionHandle connHandleServerSide, const pge_network::MsgUserDisconnectedFromServer &msg, proofps_dd::GameMode &gameMode)
 
bool handleUserNameChange (pge_network::PgeNetworkConnectionHandle connHandleServerSide, const proofps_dd::MsgUserNameChangeAndBootupDone &msg, proofps_dd::Config &config, PGEcfgProfiles &cfgProfiles)
 
void resetSendClientUpdatesCounter (proofps_dd::Config &config)
 
void serverUpdatePlayersOldValues (proofps_dd::Config &config, PgeObjectPool< proofps_dd::Smoke > &smokes)
 
void serverSendUserUpdates (PGEcfgProfiles &cfgProfiles, proofps_dd::Config &config, proofps_dd::Durations &durations, proofps_dd::GameMode &gameMode)
 
bool handleUserUpdateFromServer (pge_network::PgeNetworkConnectionHandle connHandleServerSide, const proofps_dd::MsgUserUpdateFromServer &msg, XHair &xhair, const proofps_dd::Config &config, proofps_dd::GameMode &gameMode, PgeObjectPool< proofps_dd::Smoke > &smokes)
 
bool handleDeathNotificationFromServer (pge_network::PgeNetworkConnectionHandle nDeadConnHandleServerSide, const proofps_dd::MsgDeathNotificationFromServer &msg, proofps_dd::GameMode &gameMode)
 
bool handlePlayerEventFromServer (pge_network::PgeNetworkConnectionHandle connHandleServerSide, const proofps_dd::MsgPlayerEventFromServer &msg, PureVector &vecCamShakeForce, const proofps_dd::Config &config, PGEcfgProfiles &cfgProfiles)
 
bool serverHandleUserInGameMenuCmd (pge_network::PgeNetworkConnectionHandle connHandleServerSide, const proofps_dd::MsgUserInGameMenuCmd &msg, const proofps_dd::Config &config, PGEcfgProfiles &cfgProfiles)
 
void updatePlayersVisuals (const proofps_dd::Config &config, proofps_dd::GameMode &gameMode)
 Invoked in every frame by all instances.
 
- Protected Member Functions inherited from proofps_dd::Networking
void allowListAppMessages ()
 
 Networking (PGE &pge, proofps_dd::Durations &durations)
 
 Networking (const Networking &)=delete
 
Networkingoperator= (const Networking &)=delete
 
 Networking (Networking &&)=delete
 
Networking && operator= (Networking &&)=delete
 
CConsole & getConsole () const
 
bool isMyConnection (const pge_network::PgeNetworkConnectionHandle &connHandleServerSide) const
 
const pge_network::PgeNetworkConnectionHandle & getMyServerSideConnectionHandle () const
 
bool reinitializeNetworking ()
 
bool isServer () const
 

Private Attributes

PGE & m_pge
 
proofps_dd::GUIm_gui
 
std::map< pge_network::PgeNetworkConnectionHandle, proofps_dd::Player > & m_mapPlayers
 
proofps_dd::Mapsm_maps
 
proofps_dd::Soundsm_sounds
 
proofps_dd::CameraHandlingm_camera
 
unsigned int m_nSendClientUpdatesInEveryNthTick = 1
 
unsigned int m_nSendClientUpdatesCntr = m_nSendClientUpdatesInEveryNthTick
 

Additional Inherited Members

- Static Protected Member Functions inherited from proofps_dd::Networking
static const char * getLoggerModuleName ()
 
- Protected Attributes inherited from proofps_dd::Networking
pge_network::PgeNetworkConnectionHandle m_nServerSideConnectionHandle
 Server-side connection handle received from server in PgePktUserConnected (server instance also receives this from itself).
 
- Static Protected Attributes inherited from proofps_dd::Networking
static constexpr char * szCVarClServerIp = "cl_server_ip"
 

Constructor & Destructor Documentation

◆ PlayerHandling() [1/3]

proofps_dd::PlayerHandling::PlayerHandling ( PGE & pge,
proofps_dd::Durations & durations,
proofps_dd::GUI & gui,
std::map< pge_network::PgeNetworkConnectionHandle, proofps_dd::Player > & mapPlayers,
proofps_dd::Maps & maps,
proofps_dd::Sounds & sounds,
proofps_dd::CameraHandling & camera )

Definition at line 25 of file PlayerHandling.cpp.

◆ PlayerHandling() [2/3]

proofps_dd::PlayerHandling::PlayerHandling ( const PlayerHandling & )
delete

◆ PlayerHandling() [3/3]

proofps_dd::PlayerHandling::PlayerHandling ( PlayerHandling && )
delete

Member Function Documentation

◆ getConsole()

CConsole & proofps_dd::PlayerHandling::getConsole ( ) const

Definition at line 51 of file PlayerHandling.cpp.

◆ getLoggerModuleName()

const char * proofps_dd::PlayerHandling::getLoggerModuleName ( )
static

Definition at line 20 of file PlayerHandling.cpp.

◆ handleDeathNotificationFromServer()

bool proofps_dd::PlayerHandling::handleDeathNotificationFromServer ( pge_network::PgeNetworkConnectionHandle nDeadConnHandleServerSide,
const proofps_dd::MsgDeathNotificationFromServer & msg,
proofps_dd::GameMode & gameMode )
protected

Definition at line 1418 of file PlayerHandling.cpp.

◆ handleExplosionMultiKill()

void proofps_dd::PlayerHandling::handleExplosionMultiKill ( int nPlayersDiedByExplosion)
protected

Definition at line 508 of file PlayerHandling.cpp.

◆ handlePlayerDied()

void proofps_dd::PlayerHandling::handlePlayerDied ( Player & player,
XHair & xhair,
const pge_network::PgeNetworkConnectionHandle & nKillerConnHandleServerSide )
protected

Definition at line 71 of file PlayerHandling.cpp.

◆ handlePlayerEventFromServer()

bool proofps_dd::PlayerHandling::handlePlayerEventFromServer ( pge_network::PgeNetworkConnectionHandle connHandleServerSide,
const proofps_dd::MsgPlayerEventFromServer & msg,
PureVector & vecCamShakeForce,
const proofps_dd::Config & config,
PGEcfgProfiles & cfgProfiles )
protected

Definition at line 1483 of file PlayerHandling.cpp.

◆ handlePlayerRespawned()

void proofps_dd::PlayerHandling::handlePlayerRespawned ( Player & player,
XHair & xhair )
protected

Definition at line 145 of file PlayerHandling.cpp.

◆ handlePlayerTeamIdChangedOrToggledSpectatorMode()

void proofps_dd::PlayerHandling::handlePlayerTeamIdChangedOrToggledSpectatorMode ( Player & player,
const unsigned int & iTeamId,
const bool & bToggledSpectatorMode,
const proofps_dd::Config & config,
PGEcfgProfiles & cfgProfiles )
protected

Definition at line 295 of file PlayerHandling.cpp.

◆ handleUserConnected()

bool proofps_dd::PlayerHandling::handleUserConnected ( pge_network::PgeNetworkConnectionHandle connHandleServerSide,
const pge_network::MsgUserConnectedServerSelf & msg,
PGEcfgProfiles & cfgProfiles,
proofps_dd::Config & config,
std::function< void(int)> & cbDisplayMapLoadingProgressUpdate )
protected

Definition at line 533 of file PlayerHandling.cpp.

◆ handleUserDisconnected()

bool proofps_dd::PlayerHandling::handleUserDisconnected ( pge_network::PgeNetworkConnectionHandle connHandleServerSide,
const pge_network::MsgUserDisconnectedFromServer & msg,
proofps_dd::GameMode & gameMode )
protected

Definition at line 714 of file PlayerHandling.cpp.

◆ handleUserNameChange()

bool proofps_dd::PlayerHandling::handleUserNameChange ( pge_network::PgeNetworkConnectionHandle connHandleServerSide,
const proofps_dd::MsgUserNameChangeAndBootupDone & msg,
proofps_dd::Config & config,
PGEcfgProfiles & cfgProfiles )
protected

Definition at line 795 of file PlayerHandling.cpp.

◆ handleUserUpdateFromServer()

bool proofps_dd::PlayerHandling::handleUserUpdateFromServer ( pge_network::PgeNetworkConnectionHandle connHandleServerSide,
const proofps_dd::MsgUserUpdateFromServer & msg,
XHair & xhair,
const proofps_dd::Config & config,
proofps_dd::GameMode & gameMode,
PgeObjectPool< proofps_dd::Smoke > & smokes )
protected

Definition at line 1158 of file PlayerHandling.cpp.

◆ hasPlayerBootedUp()

bool proofps_dd::PlayerHandling::hasPlayerBootedUp ( const pge_network::PgeNetworkConnectionHandle & connHandle) const
protected

Definition at line 60 of file PlayerHandling.cpp.

◆ operator=() [1/2]

PlayerHandling & proofps_dd::PlayerHandling::operator= ( const PlayerHandling & )
delete

◆ operator=() [2/2]

PlayerHandling && proofps_dd::PlayerHandling::operator= ( PlayerHandling && )
delete

◆ resetSendClientUpdatesCounter()

void proofps_dd::PlayerHandling::resetSendClientUpdatesCounter ( proofps_dd::Config & config)
protected

Definition at line 1008 of file PlayerHandling.cpp.

◆ serverHandleUserInGameMenuCmd()

bool proofps_dd::PlayerHandling::serverHandleUserInGameMenuCmd ( pge_network::PgeNetworkConnectionHandle connHandleServerSide,
const proofps_dd::MsgUserInGameMenuCmd & msg,
const proofps_dd::Config & config,
PGEcfgProfiles & cfgProfiles )
protected

Definition at line 1564 of file PlayerHandling.cpp.

◆ serverResettlePlayer()

void proofps_dd::PlayerHandling::serverResettlePlayer ( Player & player,
const proofps_dd::Config & config )
protected

Resettle is required when a round-based game starts a new round, and we need to reposition alive players back to spawn points.

Their HP will be defaulted as well to 100. Player's AP, items and weapons are not touched, so these are carried over to next round.

Shall not be invoked for dead players: dead players shall be respawned, not resettled. Shall not be invoked for players in spectator mode: they must toggle their spectator mode state manually to trigger respawn.

Parameters
playerThe player to be resettled.
configThe usual Config instance.

Definition at line 229 of file PlayerHandling.cpp.

◆ serverRespawnPlayer()

void proofps_dd::PlayerHandling::serverRespawnPlayer ( Player & player,
const proofps_dd::GameRestartType_KeepPlayers & eRestartType,
const proofps_dd::Config & config,
PGEcfgProfiles & cfgProfiles )
protected

Respawn is required when either a game is started, restarted, or a dead player needs to be revived.

The player can be either dead or alive, doesn't matter. Player's HP and AP will be reset to defaults, also items and weapons.

Parameters
playerThe player to be respawned.
eRestartTypeDepending on restart type, player's stats and other stuff will be defaulted as well.
configThe usual Config instance.

Definition at line 175 of file PlayerHandling.cpp.

◆ serverSendUserUpdates()

void proofps_dd::PlayerHandling::serverSendUserUpdates ( PGEcfgProfiles & cfgProfiles,
proofps_dd::Config & config,
proofps_dd::Durations & durations,
proofps_dd::GameMode & gameMode )
protected

Definition at line 1032 of file PlayerHandling.cpp.

◆ serverUpdatePlayersOldValues()

void proofps_dd::PlayerHandling::serverUpdatePlayersOldValues ( proofps_dd::Config & config,
PgeObjectPool< proofps_dd::Smoke > & smokes )
protected

Definition at line 1015 of file PlayerHandling.cpp.

◆ serverUpdateRespawnTimers()

void proofps_dd::PlayerHandling::serverUpdateRespawnTimers ( const proofps_dd::Config & config,
PGEcfgProfiles & cfgProfiles,
proofps_dd::GameMode & gameMode,
proofps_dd::Durations & durations )
protected

Definition at line 261 of file PlayerHandling.cpp.

◆ updatePlayersVisuals()

void proofps_dd::PlayerHandling::updatePlayersVisuals ( const proofps_dd::Config & config,
proofps_dd::GameMode & gameMode )
protected

Invoked in every frame by all instances.

Definition at line 1601 of file PlayerHandling.cpp.

◆ writePlayerList()

void proofps_dd::PlayerHandling::writePlayerList ( )
protected

Definition at line 522 of file PlayerHandling.cpp.

Member Data Documentation

◆ m_camera

proofps_dd::CameraHandling& proofps_dd::PlayerHandling::m_camera
private

Definition at line 178 of file PlayerHandling.h.

◆ m_gui

proofps_dd::GUI& proofps_dd::PlayerHandling::m_gui
private

Definition at line 174 of file PlayerHandling.h.

◆ m_mapPlayers

std::map<pge_network::PgeNetworkConnectionHandle, proofps_dd::Player>& proofps_dd::PlayerHandling::m_mapPlayers
private

Definition at line 175 of file PlayerHandling.h.

◆ m_maps

proofps_dd::Maps& proofps_dd::PlayerHandling::m_maps
private

Definition at line 176 of file PlayerHandling.h.

◆ m_nSendClientUpdatesCntr

unsigned int proofps_dd::PlayerHandling::m_nSendClientUpdatesCntr = m_nSendClientUpdatesInEveryNthTick
private

Definition at line 181 of file PlayerHandling.h.

◆ m_nSendClientUpdatesInEveryNthTick

unsigned int proofps_dd::PlayerHandling::m_nSendClientUpdatesInEveryNthTick = 1
private

Definition at line 180 of file PlayerHandling.h.

◆ m_pge

PGE& proofps_dd::PlayerHandling::m_pge
private

Definition at line 173 of file PlayerHandling.h.

◆ m_sounds

proofps_dd::Sounds& proofps_dd::PlayerHandling::m_sounds
private

Definition at line 177 of file PlayerHandling.h.


The documentation for this class was generated from the following files: