Nuclide
Software Development Kit for id Tech
NSClientPlayer.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016-2022 Vera Visions LLC.
3 *
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
13 * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
14 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15*/
16
17noref .vector v_angle;
18
24class
26{
27public:
28 void NSClientPlayer(void);
29
30 virtual void ProcessInput(void);
31 virtual void PreFrame(void);
32 virtual void PostFrame(void);
33
34 virtual void Physics_Fall(float);
35 virtual void Physics_Crouch(void);
36 virtual void Physics_Prone(void);
37 virtual void Physics_Jump(void);
38 virtual void Physics_CheckJump(float);
39 virtual void Physics_SetViewParms(void);
40 virtual void Physics_WaterJump(void);
41 virtual void Physics_WaterMove(void);
42 virtual float Physics_MaxSpeed(void);
43 virtual void Physics_InputPreMove(void);
44 virtual void Physics_InputPostMove(void);
45 virtual void Physics_Run(void);
46
47 virtual bool IsFakeSpectator(void);
48 virtual bool IsRealSpectator(void);
49 virtual bool IsDead(void);
50 virtual bool IsPlayer(void);
51 virtual void SharedInputFrame(void);
52
54 virtual bool CanSprint(void);
56 virtual bool CanProne(void);
58 virtual bool CanCrouch(void);
60 virtual bool CanLean(void);
61
63 virtual void UpdatePlayerAnimation(float);
64
65
66#ifdef CLIENT
67 virtual void VehicleRelink(void);
68 virtual void OnRemoveEntity(void);
69 virtual void ReceiveEntity(float,float);
70 virtual void PredictPreFrame(void);
71 virtual void PredictPostFrame(void);
72 virtual void ClientInputFrame(void);
73 virtual void UpdateAliveCam(void);
74
76 virtual void UpdatePlayerJaw(float);
77
79 virtual void UpdatePlayerAttachments(bool);
80
81 virtual float predraw(void);
82 virtual void postdraw(void);
83
84#endif
85
86#ifdef SERVER
87 /* overrides */
88 virtual void Save(float);
89 virtual void Restore(string,string);
90 virtual void Respawn(void);
91 virtual void EvaluateEntity(void);
92 virtual float SendEntity(entity,float);
93 virtual void Death(void);
94 virtual void ServerInputFrame(void);
95
97 virtual float OptimiseChangedFlags(entity,float);
98
100 virtual void MakePlayer(void);
102 virtual void MakeTempSpectator(void);
104 virtual void MakeSpectator(void);
105
107 virtual void InputUse_Down(void);
109 virtual void InputUse_Up(void);
110
111#endif
112
113 virtual void Footsteps_Update(void);
114
115private:
116
117#ifdef CLIENT
118 PREDICTED_INT(weaponframe)
119 PREDICTED_FLOAT(vehicle_entnum)
120#endif
121
122#ifdef SERVER
123 PREDICTED_INT_N(weaponframe)
124#endif
125
127
128 PREDICTED_FLOAT_N(colormap)
130 PREDICTED_FLOAT(viewzoom)
134 PREDICTED_FLOAT_N(pmove_flags)
135
136 PREDICTED_FLOAT(w_attack_next)
137 PREDICTED_FLOAT(w_idle_next)
139 PREDICTED_FLOAT(weapontime)
140 PREDICTED_FLOAT(m_flStamina)
141 PREDICTED_VECTOR(punchangle)
142
143 /* We can't use the default .items field, because FTE will assume
144 * effects of some bits. Such as invisibility, quad, etc.
145 * also, modders probably want 32 bits for items. */
146 PREDICTED_INT(g_items)
147 PREDICTED_FLOAT_N(activeweapon)
148
149#ifdef NEW_INVENTORY
150 NSWeapon m_weapons[MAX_WEAPONS];
151 NSWeapon m_activeweapon;
152#endif
153
154 /* vehicle info */
155 PREDICTED_ENT(vehicle)
156
157 /* these are NOT networked */
158 int a_ammo1;
159 int a_ammo2;
160 int a_ammo3;
161
162 PREDICTED_VECTOR(grapvelocity)
163
164#ifdef CLIENT
165 int sequence;
166
167 /* external weapon model */
168 NSRenderableEntity p_model;
169 int p_hand_bone;
170 int p_model_bone;
171 float lastweapon;
172#endif
173
174#ifdef SERVER
175 int voted;
176 int step;
177 float step_time;
178
179 int m_iUnderwaterDamage;
180 float m_flUnderwaterTime;
181 float m_flPainTime;
182
183 entity last_used;
184
185 float pb_angle_delta;
186 float pb_player_delta;
187 vector pb_last_angles;
188
189 int m_iFriendlyDMG;
190#endif
191};
192
193/* all potential SendFlags bits we can possibly send */
195{
196 PLAYER_MODELINDEX,
197 PLAYER_ORIGIN,
198 PLAYER_ANGLES,
199 PLAYER_VELOCITY,
200 PLAYER_FLAGS,
201 PLAYER_WEAPON,
202 PLAYER_ITEMS,
203 PLAYER_HEALTH,
204 PLAYER_SIZE,
205 PLAYER_MOVETYPE,
206 PLAYER_PUNCHANGLE,
207 PLAYER_VIEWZOOM,
208 PLAYER_TIMINGS,
209 PLAYER_VEHICLE,
210 PLAYER_SPECTATE,
211 PLAYER_CUSTOMFIELDSTART,
212};
noref vector v_angle
Definition: NSClientPlayer.h:17
enumflags
Definition: NSClientPlayer.h:195
noref float health
Definition: NSSurfacePropEntity.h:18
This entity class represents every player client.
Definition: NSClientPlayer.h:26
virtual void Respawn(void)
Server: Called when the entity first spawns or when game-logic requests the entity to return to its o...
virtual void Save(float)
Handles saving a copy of this entity to a given filehandle.
virtual void EvaluateEntity(void)
Run each tic after physics are run to determine if we need to send updates over the network.
virtual float SendEntity(entity, float)
Called by the engine whenever we need to send a client an update about this entity.
virtual float OptimiseChangedFlags(entity, float)
Helper function that will optimise the changed-flags of your player entity.
virtual void ServerInputFrame(void)
Server: This is where the input* variables arrive after sending them out from the client (see ClientI...
virtual void InputUse_Up(void)
Called when we let go of the button bound to +use.
virtual void Restore(string, string)
Similar to ::SpawnKey but for save-game fields.
virtual void InputUse_Down(void)
Called when we press the button bound to +use.
virtual void MakeTempSpectator(void)
When called, will turn the client into a spectator until the next round.
virtual void MakePlayer(void)
When called, will turn the client into a proper player.
virtual void MakeSpectator(void)
When called, will turn the client into a general spectator.
virtual void Death(void)
Called when the health is equal or below 0.
This entity class represents every spectator client.
Definition: NSClientSpectator.h:66
This entity represents any NSEntity with advanced rendering properties.
Definition: NSRenderableEntity.h:91
Definition: NSWeapon.h:3
vector(vector) normalize
entity() spawn
vector view_ofs
Definition: pmove.h:20
#define PREDICTED_FLOAT_N(x)
Definition: defs.h:38
#define PREDICTED_INT_N(x)
Definition: defs.h:37
float gflags
Definition: defs.h:186
float teleport_time
Definition: defs.h:184
#define PREDICTED_FLOAT(x)
Definition: defs.h:31
#define PREDICTED_VECTOR_N(x)
Definition: defs.h:39
#define PREDICTED_VECTOR(x)
Definition: defs.h:32
vector basevelocity
Definition: defs.h:185
#define PREDICTED_INT(x)
Definition: defs.h:30
#define PREDICTED_ENT(x)
Definition: defs.h:33