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
26class
28{
29public:
30 void NSClientPlayer(void);
31
32 virtual void ProcessInput(void);
33 virtual void PreFrame(void);
34 virtual void PostFrame(void);
35
36 virtual void Physics_Fall(float);
37 virtual void Physics_Crouch(void);
38 virtual void Physics_Prone(void);
39 virtual void Physics_Jump(void);
40 virtual void Physics_CheckJump(float);
41 virtual void Physics_SetViewParms(void);
42 virtual void Physics_WaterJump(void);
43 virtual void Physics_WaterMove(void);
44 virtual float Physics_MaxSpeed(void);
45 virtual void Physics_InputPreMove(void);
46 virtual void Physics_InputPostMove(void);
47 virtual void Physics_Run(void);
48
49 virtual bool IsFakeSpectator(void);
50 virtual bool IsRealSpectator(void);
51 virtual bool IsDead(void);
52 virtual bool IsPlayer(void);
53 virtual void SharedInputFrame(void);
54
56 virtual bool CanSprint(void);
58 virtual bool CanProne(void);
60 virtual bool CanCrouch(void);
62 virtual bool CanLean(void);
63
65 virtual void UpdatePlayerAnimation(float);
66
67 virtual void Damage(entity, entity, NSDict, float, vector, vector);
68
69
70#ifdef CLIENT
71 virtual void VehicleRelink(void);
72 virtual void OnRemoveEntity(void);
73 virtual void ReceiveEntity(float,float);
74 virtual void PredictPreFrame(void);
75 virtual void PredictPostFrame(void);
76 virtual void ClientInputFrame(void);
77
78 virtual vector CalculateLean(vector);
79 virtual void UpdateAliveCam(void);
80
82 virtual void UpdatePlayerJaw(float);
83
85 virtual void UpdatePlayerAttachments(bool);
86
87 virtual float predraw(void);
88 virtual void postdraw(void);
89
90#endif
91
92#ifdef SERVER
93 /* overrides */
94 virtual void Save(float);
95 virtual void Restore(string,string);
96 virtual void Respawn(void);
97 virtual void EvaluateEntity(void);
98 virtual float SendEntity(entity,float);
99 virtual void Death(entity, entity, int, vector, int);
100 virtual void ServerInputFrame(void);
101
103 virtual float OptimiseChangedFlags(entity,float);
104
106 virtual void MakePlayer(void);
108 virtual void MakeTempSpectator(void);
110 virtual void MakeSpectator(void);
111
113 virtual void InputUse_Down(void);
115 virtual void InputUse_Up(void);
116
117#endif
118
119 virtual void Footsteps_Update(void);
120
121private:
122
123#ifdef CLIENT
124 PREDICTED_INT(weaponframe)
125 PREDICTED_FLOAT(vehicle_entnum)
126#endif
127
128#ifdef SERVER
129 PREDICTED_INT_N(weaponframe)
130 float nadeCookingTime;
131#endif
132
134
135 PREDICTED_FLOAT_N(colormap)
137 PREDICTED_FLOAT(viewzoom)
141 PREDICTED_FLOAT_N(pmove_flags)
142
143 PREDICTED_FLOAT(w_attack_next)
144 PREDICTED_FLOAT(w_idle_next)
146 PREDICTED_FLOAT(weapontime)
147 PREDICTED_FLOAT(m_flStamina)
148 PREDICTED_VECTOR(punchangle)
149
150 /* We can't use the default .items field, because FTE will assume
151 * effects of some bits. Such as invisibility, quad, etc.
152 * also, modders probably want 32 bits for items. */
153 PREDICTED_INT(g_items)
154 PREDICTED_FLOAT_N(activeweapon)
155 NSItem m_itemList_net;
156 int m_iAmmoTypes_net[MAX_AMMO_TYPES];
157
158
159 /* vehicle info */
160 PREDICTED_ENT(vehicle)
161
162 /* these are NOT networked */
163 int a_ammo1;
164 int a_ammo2;
165 int a_ammo3;
166
167 PREDICTED_VECTOR(grapvelocity)
168
169#ifdef CLIENT
170 int sequence;
171
172 /* external weapon model */
173 NSRenderableEntity p_model;
174 int p_hand_bone;
175 int p_model_bone;
176 float lastweapon;
177#endif
178
179#ifdef SERVER
180 int voted;
181 int step;
182 float step_time;
183
184 int m_iUnderwaterDamage;
185 float m_flUnderwaterTime;
186 float m_flPainTime;
187
188 entity last_used;
189
190 float pb_angle_delta;
191 float pb_player_delta;
192 vector pb_last_angles;
193
194 int m_iFriendlyDMG;
195#endif
196};
197
198/* all potential SendFlags bits we can possibly send */
200{
201 PLAYER_MODELINDEX,
202 PLAYER_ORIGIN,
203 PLAYER_ANGLES,
204 PLAYER_VELOCITY,
205 PLAYER_FLAGS,
206 PLAYER_WEAPON,
207 PLAYER_ITEMS,
208 PLAYER_HEALTH,
209 PLAYER_SIZE,
210 PLAYER_MOVETYPE,
211 PLAYER_PUNCHANGLE,
212 PLAYER_VIEWZOOM,
213 PLAYER_TIMINGS,
214 PLAYER_VEHICLE,
215 PLAYER_SPECTATE,
216 PLAYER_AMMOTYPES,
217 PLAYER_WEAPONFRAME,
218 PLAYER_CUSTOMFIELDSTART,
219};
noref vector v_angle
Definition: NSClientPlayer.h:17
enumflags
Definition: NSClientPlayer.h:200
noref float health
Definition: NSSurfacePropEntity.h:18
This entity class represents every player client.
Definition: NSClientPlayer.h:28
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 Death(entity, entity, int, vector, int)
Called when the health is equal or below 0.
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 NSIO::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.
This entity class represents every spectator client.
Definition: NSClientSpectator.h:69
Definition: NSDict.h:19
This entity class represents inventory items, weapons.
Definition: NSItem.h:68
This entity represents any NSEntity with advanced rendering properties.
Definition: NSRenderableEntity.h:94
vector view_ofs
Definition: pmove.h:20
#define PREDICTED_FLOAT_N(x)
Definition: defs.h:41
#define PREDICTED_INT_N(x)
Definition: defs.h:40
#define MAX_AMMO_TYPES
Definition: defs.h:69
float gflags
Definition: defs.h:200
float teleport_time
Definition: defs.h:198
#define PREDICTED_FLOAT(x)
Definition: defs.h:34
#define PREDICTED_VECTOR_N(x)
Definition: defs.h:42
#define PREDICTED_VECTOR(x)
Definition: defs.h:35
vector basevelocity
Definition: defs.h:199
#define PREDICTED_INT(x)
Definition: defs.h:33
#define PREDICTED_ENT(x)
Definition: defs.h:36