Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
state.qc
Go to the documentation of this file.
1#include "state.qh"
2
5
7void Inventory_delete(entity this);
11
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}
21
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}
36
37void DecodeLevelParms(entity this);
38void PlayerScore_Attach(entity this);
39void ClientData_Attach(entity this);
40void accuracy_init(entity this);
41void entcs_attach(entity this);
42void anticheat_init(entity this);
43void W_HitPlotOpen(entity this);
44void bot_clientconnect(entity this);
45
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}
64
66void W_HitPlotClose(entity this);
68void entcs_detach(entity this);
69void accuracy_free(entity this);
70void ClientData_Detach(entity this);
71void PlayerScore_Detach(entity this);
72
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}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
Purpose: common client state, usable on client and server Client: singleton representing the viewed p...
Definition state.qh:29
Purpose: common player state, usable on client and server Client: singleton representing the viewed p...
Definition state.qh:8
void GetCvars(entity this, entity store, int f)
Inventory inventory_store
Player inventory storage (holds previous state)
Definition inventory.qh:14
#define NEW(cname,...)
Definition oo.qh:117
void PlayerStats_PlayerBasic_CheckUpdate(entity joiningplayer)
#define NULL
Definition post.qh:14
void Inventory_clear(PlayerState this)
void accuracy_init(entity this)
init/free
Definition accuracy.qc:50
void accuracy_free(entity this)
Definition accuracy.qc:58
void ClientData_Detach(entity this)
Definition client.qc:179
void PlayerState_attach(entity this)
Definition state.qc:12
void anticheat_init(entity this)
Definition anticheat.qc:256
void InventoryStorage_delete(PlayerState this)
void Inventory_delete(entity this)
Definition inventory.qh:158
void Inventory_new(PlayerState this)
Definition inventory.qh:149
void PlayerScore_Detach(entity this)
Definition scores.qc:344
void W_HitPlotClose(entity this)
Definition hitplot.qc:92
void PlayerScore_Attach(entity this)
Definition scores.qc:334
void bot_clientdisconnect(entity this)
Definition bot.qc:454
void anticheat_report_to_eventlog(entity this)
Definition anticheat.qc:211
void bot_clientconnect(entity this)
Definition bot.qc:469
void entcs_detach(entity this)
Definition ent_cs.qc:268
void InventoryStorage_attach(PlayerState this)
void entcs_attach(entity this)
Definition ent_cs.qc:251
void ClientState_detach(entity this)
Definition state.qc:73
void ClientData_Attach(entity this)
Definition client.qc:172
void PlayerState_detach(entity this)
Definition state.qc:22
void DecodeLevelParms(entity this)
Definition client.qc:984
void W_HitPlotOpen(entity this)
Definition hitplot.qc:82
void ClientState_attach(entity this)
Definition state.qc:46
ClientState _cs
Definition state.qh:42
#define CS_CVAR(this)
Definition state.qh:51
#define PS(this)
Definition state.qh:18
PlayerState _ps
Definition state.qh:17
ClientState CS(Client this)
Definition state.qh:47
void StatusEffectsStorage_attach(entity e)
void StatusEffectsStorage_delete(entity e)
#define FOREACH_CLIENT(cond, body)
Definition utils.qh:50