Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
state.qh File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  ClientState
 Purpose: common client state, usable on client and server Client: singleton representing the viewed player Server: instance per client. More...
class  PlayerState
 Purpose: common player state, usable on client and server Client: singleton representing the viewed player Server: instance per client, clients decoupled from players. More...

Macros

#define CS_CVAR(this)
#define PS(this)

Functions

void ClientState_attach (entity this)
void ClientState_detach (entity this)
ClientState CS (Client this)
void PlayerState_attach (entity this)
void PlayerState_detach (entity this)

Variables

ClientState _cs
PlayerState _ps

Macro Definition Documentation

◆ CS_CVAR

◆ PS

Function Documentation

◆ ClientState_attach()

void ClientState_attach ( entity this)

Definition at line 46 of file state.qc.

47{
48 this._cs = NEW(ClientState, this);
49
50 // TODO: fold all of these into ClientState
51
52 DecodeLevelParms(this);
53
57 accuracy_init(this);
58 entcs_attach(this);
59 anticheat_init(this);
60 W_HitPlotOpen(this);
63}
Purpose: common client state, usable on client and server Client: singleton representing the viewed p...
Definition state.qh:29
#define NEW(cname,...)
Definition oo.qh:117
void PlayerStats_PlayerBasic_CheckUpdate(entity joiningplayer)
void accuracy_init(entity this)
init/free
Definition accuracy.qc:50
void anticheat_init(entity this)
Definition anticheat.qc:256
void PlayerScore_Attach(entity this)
Definition scores.qc:334
void InventoryStorage_attach(PlayerState this)
void entcs_attach(entity this)
Definition ent_cs.qc:251
void ClientData_Attach(entity this)
Definition client.qc:172
void DecodeLevelParms(entity this)
Definition client.qc:984
void W_HitPlotOpen(entity this)
Definition hitplot.qc:82
ClientState _cs
Definition state.qh:42
void StatusEffectsStorage_attach(entity e)

◆ ClientState_detach()

void ClientState_detach ( entity this)

Definition at line 73 of file state.qc.

74{
75 GetCvars(this, CS_CVAR(this), -1); // free cvars TODO: is this still needed now that it's stored on the clientstate entity?
76 accuracy_free(this); // TODO: needs to be before CS() is deleted!
77 PlayerScore_Detach(this); // what ^they^ said
78 W_HitPlotClose(this);
80 entcs_detach(this);
83 delete(CS(this));
84 this._cs = NULL;
85
87
89}
void GetCvars(entity this, entity store, int f)
#define NULL
Definition post.qh:14
void accuracy_free(entity this)
Definition accuracy.qc:58
void ClientData_Detach(entity this)
Definition client.qc:179
void InventoryStorage_delete(PlayerState this)
void PlayerScore_Detach(entity this)
Definition scores.qc:344
void W_HitPlotClose(entity this)
Definition hitplot.qc:92
void bot_clientdisconnect(entity this)
Definition bot.qc:454
void anticheat_report_to_eventlog(entity this)
Definition anticheat.qc:211
void entcs_detach(entity this)
Definition ent_cs.qc:268
#define CS_CVAR(this)
Definition state.qh:51
ClientState CS(Client this)
Definition state.qh:47
void StatusEffectsStorage_delete(entity e)

References _cs, accuracy_free(), anticheat_report_to_eventlog(), bot_clientdisconnect(), ClientData_Detach(), CS(), CS_CVAR, entcs_detach(), entity(), GetCvars(), InventoryStorage_delete(), NULL, PlayerScore_Detach(), StatusEffectsStorage_delete(), and W_HitPlotClose().

Referenced by ClientDisconnect().

◆ CS()

ClientState CS ( Client this)

Definition at line 47 of file state.qh.

47{ TC(Client, this); assert(this._cs); return this._cs; }
#define TC(T, sym)
Definition _all.inc:82
#define assert(expr,...)
Definition log.qh:8

References _cs, assert, and TC.

Referenced by accuracy_add(), accuracy_free(), accuracy_init(), accuracy_resend(), accuracy_reset(), accuracy_send(), anticheat_fixangle(), anticheat_init(), anticheat_physics(), anticheat_prethink(), anticheat_report_to_eventlog(), anticheat_report_to_playerstats(), anticheat_spectatecopy(), antilag_restore_all(), antilag_takeback_all(), BanCommand_mute(), BanCommand_unmute(), bot_cmd_impulse(), bot_cmd_pause(), bot_presskeys(), bot_think(), bumblebee_exit(), bumblebee_pilot_frame(), ChatBubbleThink(), client_hasweapon(), ClientCommand_clientversion(), ClientCommand_join(), ClientCommand_minigame(), ClientConnect(), ClientData_Attach(), ClientData_Detach(), ClientData_Send(), ClientData_Touch(), ClientDisconnect(), ClientState_detach(), CommonCommand_timeout(), CommonCommand_who(), crosshair_trace(), ctf_FlagThink(), Damage(), DecodeLevelParms(), Drag(), DumpStats(), EndFrame(), entcs_attach(), entcs_detach(), entcs_force_origin(), entcs_update_players(), FireImoBeam(), FireRailgunBullet(), FixPlayermodel(), frag_centermessage_override(), GetPlayerScoreString(), GetPressedKeys(), Handicap_GetForcedHandicap(), Handicap_Initialize(), Handicap_SetForcedHandicap(), havocbot_ai(), havocbot_ctf_reset_role(), havocbot_keyboard_movement(), havocbot_movetogoal(), Heal(), ImpulseCommands(), invite_minigame(), joinAllowed(), lms_RemovePlayer(), MapVote_Tick(), minigame_addplayer(), minigame_find_player(), MinigameImpulse(), multi_touch(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), Obituary(), ObserverOrSpectatorThink(), part_minigame(), PingPLReport_Think(), player_clear_minigame(), Player_Physics(), PlayerDamage(), PlayerFrame(), PlayerPostThink(), PlayerPreThink(), PlayerScore_Add(), PlayerScore_Attach(), PlayerScore_Clear(), PlayerScore_Detach(), PlayerScore_PlayerStats(), PlayerScore_Set(), PlayerScore_Sort(), PlayerStats_GameReport_FinalizePlayer(), PlayerTeamScore_Compare(), PlayerThink(), PM_check_specialcommand(), PutObserverInServer(), PutPlayerInServer(), race_AbandonRaceCheck(), race_GetFractionalLapCount(), race_SendTime(), racer_exit(), RadiusDamageForSource(), raptor_exit(), raptor_frame(), ReadyRestart_force(), reset_map(), Say(), Score_ClearAll(), Score_NicePrint_Player(), ScoreInfo_SendEntity(), SendWelcomeMessage(), SetChangeParms(), SetPlayerTeam(), SetSpectatee_status(), SetZoomState(), SpectateCopy(), spiderbot_exit(), spiderbot_frame(), SV_ParseClientCommand(), SV_PlayerPhysics(), sys_phys_monitor(), sys_phys_override(), sys_phys_spectator_control(), TeamBalance_RemoveExcessPlayers(), vehicles_enter(), W_HitPlotAnalysis(), W_HitPlotClose(), W_HitPlotOpen(), W_Nexball_Touch(), W_SetupShot_Dir_ProjectileSize_Range(), W_Tuba_GetNote(), WarpZone_crosshair_trace(), WarpZone_PlayerPhysics_FixVAngle(), WinningCondition_Race(), and WinningConditionHelper().

◆ PlayerState_attach()

void PlayerState_attach ( entity this)

Definition at line 12 of file state.qc.

13{
14 if (PS(this) && PS(this).m_client == this)
15 return;
16
17 this._ps = NEW(PlayerState, this);
18
19 Inventory_new(PS(this));
20}
Purpose: common player state, usable on client and server Client: singleton representing the viewed p...
Definition state.qh:8
void Inventory_new(PlayerState this)
Definition inventory.qh:149
#define PS(this)
Definition state.qh:18
PlayerState _ps
Definition state.qh:17

References _ps, entity(), Inventory_new(), NEW, and PS.

Referenced by PutPlayerInServer().

◆ PlayerState_detach()

void PlayerState_detach ( entity this)

Definition at line 22 of file state.qc.

23{
24 PlayerState ps = PS(this);
25 if (!ps) return; // initial connect
26 PS(this) = NULL;
27 Inventory_clear(this.inventory_store); // no need to network updates, as there is no inventory attached
28
29 if (ps.m_client != this) return; // don't own state, spectator
30 ps.ps_push(ps, this);
32
33 FOREACH_CLIENT(PS(it) == ps, { PS(it) = NULL; });
34 delete(ps);
35}
Inventory inventory_store
Player inventory storage (holds previous state)
Definition inventory.qh:14
void Inventory_clear(PlayerState this)
void Inventory_delete(entity this)
Definition inventory.qh:158
#define FOREACH_CLIENT(cond, body)
Definition utils.qh:50

References entity(), FOREACH_CLIENT, Inventory_clear(), Inventory_delete(), inventory_store, NULL, and PS.

Referenced by PutObserverInServer().

Variable Documentation

◆ _cs

Definition at line 42 of file state.qh.

Referenced by ClientState_attach(), ClientState_detach(), and CS().

◆ _ps

Definition at line 17 of file state.qh.

Referenced by CopyBody(), and PlayerState_attach().