-
Notifications
You must be signed in to change notification settings - Fork 122
/
player.h
480 lines (361 loc) · 13.4 KB
/
player.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
/*
===========================================================================
Copyright (C) 2010-2013 Ninja and TheKelm
Copyright (C) 1999-2005 Id Software, Inc.
This file is part of CoD4X18-Server source code.
CoD4X18-Server source code is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
CoD4X18-Server source code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
===========================================================================
*/
#ifndef __PLAYER_H__
#define __PLAYER_H__
#include "q_shared.h"
#include "q_math.h"
#include "entity.h"
typedef struct{
int score; //0x2f78
int deaths; //0x2f7c
int kills; //0x2f80
int assists; //0x2f84
}clientScoreboard_t;
typedef struct{
int sprintButtonUpRequired;
int sprintDelay;
int lastSprintStart;
int lastSprintEnd;
int sprintStartMaxLength;
}sprintState_t;
typedef struct{
int yaw;
int timer;
int transIndex;
int flags;
}mantleState_t;
typedef struct playerState_s {
int commandTime; // 0
int pm_type; // 4
int bobCycle; // 8
int pm_flags; // 12
int weapFlags; // 16
int otherFlags; // 20
int pm_time; // 24
vec3_t origin; // 28
// http://zeroy.com/script/player/getvelocity.htm
vec3_t velocity; // 40
vec2_t oldVelocity;
int weaponTime; // 60
int weaponDelay; // 64
int grenadeTimeLeft; // 68
int throwBackGrenadeOwner; // 72
int throwBackGrenadeTimeLeft; // 76
int weaponRestrictKickTime; // 80
int foliageSoundTime; // 84
int gravity; // 88
float leanf; // 92
int speed; // 96
vec3_t delta_angles; // 100
/*The ground entity's rotation will be added onto the player's view. In particular, this will
* cause the player's yaw to rotate around the entity's z-axis instead of the world z-axis.
* Any rotation that the reference entity undergoes will affect the player.
* http://zeroy.com/script/player/playersetgroundreferenceent.htm */
int groundEntityNum; // 112
vec3_t vLadderVec; // 116
int jumpTime; // 128
float jumpOriginZ; // 132
// Animations as in mp/playeranim.script and animtrees/multiplayer.atr, it also depends on mp/playeranimtypes.txt (the currently used weapon)
int legsTimer; // 136
int legsAnim; // 140
int torsoTimer; // 144
int torsoAnim; // 148
int legsAnimDuration;
int torsoAnimDuration;
int damageTimer; // 160
int damageDuration; // 164
int flinchYawAnim; // 168
int movementDir; // 172
int eFlags; // 176
int eventSequence; // 180
int events[4];
unsigned int eventParms[4];
int oldEventSequence;
int clientNum; // 220
int offHandIndex; // 224
OffhandSecondaryClass_t offhandSecondary; // 228
unsigned int weapon; // 232
int weaponstate; // 236
unsigned int weaponShotCount; // 240
float fWeaponPosFrac; // 244
int adsDelayTime; // 248
// http://zeroy.com/script/player/resetspreadoverride.htm
// http://zeroy.com/script/player/setspreadoverride.htm
int spreadOverride; // 252
int spreadOverrideState; // 256
int viewmodelIndex; // 260
vec3_t viewangles; // 264
int viewHeightTarget; // 276
float viewHeightCurrent; // 280
int viewHeightLerpTime; // 284
int viewHeightLerpTarget; // 288
int viewHeightLerpDown; // 292
vec2_t viewAngleClampBase; // 296
vec2_t viewAngleClampRange; // 304
int damageEvent; // 312
int damageYaw; // 316
int damagePitch; // 320
int damageCount; // 324
int stats[5];
int ammo[128];
int ammoclip[128];
unsigned int weapons[4];
unsigned int weaponold[4];
unsigned int weaponrechamber[4];
float proneDirection; // 1420
float proneDirectionPitch; // 1424
float proneTorsoPitch; // 1428
ViewLockTypes_t viewlocked; // 1432
int viewlocked_entNum; // 1436
int cursorHint; // 1440
int cursorHintString; // 1444
int cursorHintEntIndex; // 1448
int iCompassPlayerInfo; // 1452
int radarEnabled; // 1456
int locationSelectionInfo; // 1460
sprintState_t sprintState; // 1464
// used for leaning?
float fTorsoPitch; // 1484
float fWaistPitch; // 1488
float holdBreathScale; // 1492
int holdBreathTimer; // 1496
// Scales player movement speed by this amount, ???it's actually a float???
// http://zeroy.com/script/player/setmovespeedscale.htm
float moveSpeedScaleMultiplier; // 1500
mantleState_t mantleState; // 1504
float meleeChargeYaw; // 1520
int meleeChargeDist; // 1524
int meleeChargeTime; // 1528
int perks; // 1532
ActionSlotType_t actionSlotType[4]; // 1536
ActionSlotParam_t actionSlotParam[4]; // 1552
int entityEventSequence; // 1568
int weapAnim; // 1572
float aimSpreadScale; // 1576
// http://zeroy.com/script/player/shellshock.htm
int shellshockIndex; // 1580
int shellshockTime; // 1584
int shellshockDuration; // 1588
// http://zeroy.com/script/player/setdepthoffield.htm
float dofNearStart; // 1592
float dofNearEnd; // 1596
float dofFarStart; // 1600
float dofFarEnd; // 1604
float dofNearBlur; // 1608
float dofFarBlur; // 1612
float dofViewmodelStart; // 1616
float dofViewmodelEnd; // 1620
int hudElemLastAssignedSoundID; // 1624
objective_t objective[16];
char weaponmodels[128];
int deltaTime; // 2204
int killCamEntity; // 2208
hudElemState_t hud;// 2212
} playerState_t;//Size: 0x2f64
typedef enum {
CON_DISCONNECTED,
CON_CONNECTING,
CON_CONNECTED
} clientConnected_t;
typedef enum {
SPECTATOR_NOT,
SPECTATOR_FREE,
SPECTATOR_FOLLOW,
SPECTATOR_SCOREBOARD
} spectatorState_t;
typedef enum {
TEAM_BEGIN, // Beginning a team game, spawn at base
TEAM_ACTIVE // Now actively playing
} playerTeamStateState_t;
typedef struct {
int location;
} playerTeamState_t;
typedef enum {
TEAM_FREE,
TEAM_RED,
TEAM_BLUE,
TEAM_SPECTATOR,
TEAM_NUM_TEAMS
}team_t;
// the auto following clients don't follow a specific client
// number, but instead follow the first two active players
#define FOLLOW_ACTIVE1 -1
#define FOLLOW_ACTIVE2 -2
// client data that stays across multiple levels or tournament restarts
// this is achieved by writing all the data to cvar strings at game shutdown
// time and reading them back at connection time. Anything added here
// MUST be dealt with in G_InitSessionData() / G_ReadSessionData() / G_WriteSessionData()
#define MAX_NETNAME 16
typedef struct clientState_s
{
int clientIndex;
team_t team;
int modelindex;
int attachModelIndex[6];
int attachTagIndex[6];
char netname[MAX_NETNAME];
float maxSprintTimeMultiplier;
int rank;
int prestige;
int perks;
int attachedVehEntNum;
int attachedVehSlotIndex;
}clientState_t;
#define PICKUP_ACTIVATE 0 // pickup items only when using "+activate"
#define PICKUP_TOUCH 1 // pickup items when touched
#define PICKUP_FORCE 2 // pickup the next item when touched (and reset to PICKUP_ACTIVATE when done)
// usercmd_t is sent to the server each client frame
typedef struct usercmd_s {//Not Known
int serverTime;
int buttons;
int angles[3];
byte weapon;
byte offHandIndex;
byte field_16;
byte field_17;
int field_18;
int field_1C;
} usercmd_t;
// client data that stays across multiple respawns, but is cleared
// on each level change or team change at ClientBegin()
typedef struct {
enum
{ STATE_PLAYING, STATE_DEAD,
STATE_SPECTATOR, STATE_INTERMISSION
}sessionState;//0x2f64
int forceSpectatorClient;
int unk2;
int unk3; // These 2 are between int status_icon;
int archiveTime; //0x2f74
clientScoreboard_t scoreboard; //0x2f78
uint16_t scriptPersId; //0x2f88 the first spawn should be at a cool location
byte pad2;
byte pad;
clientConnected_t connected; //0x2f8c
usercmd_t cmd; //0x2f90 we would lose angles if not persistant
usercmd_t oldcmd; //0x2fb0 previous command processed by pmove()
qboolean localClient; //0x2fd0 true if "ip" info key is "localhost"
qboolean predictItemPickup; //0x2fd4 based on cg_predictItems userinfo
char newnetname[MAX_NETNAME]; //0x2fd8
int maxHealth; // 0x2fe8 for handicapping
int enterTime; // 0x2fec level.time the client entered the game
playerTeamState_t teamState; // status in teamplay games
int voteCount; // 0x2ff4 to prevent people from constantly calling votes
int teamVoteCount; // to prevent people from constantly calling votes // N/A
float moveSpeedScaleMultiplier; // 0x2ffc
int viewmodelIndex; // 0x3000 //Model-index
qboolean noSpectate; // 0x3004
int teamInfo; // 0x3008 is free (unused)addr
clientState_t cs;
int psOffsetTime;
} clientSession_t;
typedef struct {
vec3_t mins;
vec3_t maxs;
vec3_t origin;
int time;
int servertime;
} clientMarker_t;
#define MAX_CLIENT_MARKERS 10
#define LT_SPECIAL_PICKUP_MOD 3 // JPW NERVE # of times (minus one for modulo) LT must drop ammo before scoring a point
#define MEDIC_SPECIAL_PICKUP_MOD 4 // JPW NERVE same thing for medic
typedef struct {
void* dummy;
}animModelInfo_t; //Dummy
typedef struct {
qboolean bAutoReload; // do we predict autoreload of weapons
int blockCenterViewTime; // don't let centerview happen for a little while
// Arnout: MG42 aiming
float varc, harc;
vec3_t centerangles;
} pmoveExt_t; // data used both in client and server - store it here
typedef struct gclient_s gclient_t;
// this structure is cleared on each ClientSpawn(),
// except for 'client->pers' and 'client->sess'
struct gclient_s {
// ps MUST be the first element, because the server expects it
playerState_t ps; //0x00 communicated by server to clients
// the rest of the structure is private to game
clientSession_t sess; //0x2f64
int spectatorClient; //0x3074 for chasecam and follow mode
qboolean noclip; //0x3078
qboolean ufo; //0x307c
qboolean bFrozen; //0x3080
int lastCmdTime; //0x3084 level.time of last usercmd_t, for EF_CONNECTION
// we can't just use pers.lastCommand.time, because
// of the g_sycronousclients case
//Buttonlogic
int buttons; //0x3088
int oldbuttons;
int latched_buttons;
int buttonsSinceLastFrame; //0x3094
vec3_t oldOrigin;
// sum up damage over an entire frame, so
// shotgun blasts give a single big kick
float fGunPitch;
float fGunYaw;
int damage_blood; // damage taken out of health
vec3_t damage_from; //0x30b0 origin for vector calculation
qboolean damage_fromWorld; //0x30bc if true, don't use the damage_from vector
int accurateCount; // for "impressive" reward sound N/A
int accuracy_shots; // total number of shots N/A
int accuracy_hits; // total number of hits N/A
int inactivityTime; //0x30cc kick players when time > this
qboolean inactivityWarning; //0x30d0 qtrue if the five second warning has been given
int playerTalkTime; //0x30d4 ??
int rewardTime; // clear the EF_AWARD_IMPRESSIVE, etc when time > this N/A
vec3_t unk; //0x30dc
int airOutTime; //0x30e8 Unknown only reset
int lastKillTime; // ???for multiple kill rewards
int dummy34;
qboolean fireHeld; // ???used for hook
gentity_t *persistantPowerup; //0x30f8 grapple hook if out
int switchTeamTime; //0x30fc time the player switched teams
int IMtooLazy[33];
//Not anymore resolved
// timeResidual is used to handle events that happen every second
// like health / armor countdowns and regeneration
/* int timeResidual;
float currentAimSpreadScale;
int medicHealAmt;
// RF, may be shared by multiple clients/characters
animModelInfo_t *modelInfo;
// -------------------------------------------------------------------------------------------
// if working on a post release patch, new variables should ONLY be inserted after this point
gentity_t *persistantPowerup;
int portalID;
int ammoTimes[WP_NUM_WEAPONS];
int invulnerabilityTime;
gentity_t *cameraPortal; // grapple hook if out
vec3_t cameraOrigin;
int dropWeaponTime; // JPW NERVE last time a weapon was dropped
int limboDropWeapon; // JPW NERVE weapon to drop in limbo
int deployQueueNumber; // JPW NERVE player order in reinforcement FIFO queue
int sniperRifleFiredTime; // JPW NERVE last time a sniper rifle was fired (for muzzle flip effects)
float sniperRifleMuzzleYaw; // JPW NERVE for time-dependent muzzle flip in multiplayer
int lastBurnTime; // JPW NERVE last time index for flamethrower burn
int PCSpecialPickedUpCount; // JPW NERVE used to count # of times somebody's picked up this LTs ammo (or medic health) (for scoring)
int saved_persistant[MAX_PERSISTANT]; // DHM - Nerve :: Save ps->persistant here during Limbo
// g_antilag.c
int topMarker;
clientMarker_t clientMarkers[MAX_CLIENT_MARKERS];
clientMarker_t backupMarker;
gentity_t *tempHead; // Gordon: storing a temporary head for bullet head shot detection
pmoveExt_t pmext;*/
};//Size: 0x3184
#endif