[go: up one dir, main page]

Menu

[904618]: / src / d_player.h  Maximize  Restore  History

Download this file

446 lines (352 with data), 11.2 kB

  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
// -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*-
// ----------------------------------------------------------------------------
// :oCCCCOCoc.
// .cCO8OOOOOOOOO8Oo:
// .oOO8OOOOOOOOOOOOOOOCc
// cO8888: .:oOOOOC. TM
// :888888: :CCCc .oOOOOC. ### ### #########
// C888888: .ooo: .C######## ##### ##### ###### ###### ##########
// O888888: .oO### ### ##### ##### ######## ######## #### ###
// C888888: :8O. .C########## ### #### ### ## ## ## ## #### ###
// :8@@@@8: :888c o### ### #### ### ######## ######## ##########
// :8@@@@C C@@@@ oo######## ### ## ### ###### ###### #########
// cO@@@@@@@@@@@@@@@@@Oc0
// :oO8@@@@@@@@@@Oo.
// .oCOOOOOCc. http://remood.org/
// ----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 2008-2013 GhostlyDeath <ghostlydeath@remood.org>
// <ghostlydeath@gmail.com>
// ----------------------------------------------------------------------------
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 3
// of the License, or (at your option) any later version.
//
// This program 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 General Public License for more details.
// ----------------------------------------------------------------------------
// DESCRIPTION: player data structures
#ifndef __D_PLAYER__
#define __D_PLAYER__
#include "d_ticcmd.h" // TODO FIXME: Only used once
/* Define D_Prof_t */
#if !defined(__REMOOD_DPROFTDEFINED)
#define __REMOOD_DPROFTDEFINED
typedef struct D_Prof_s D_Prof_t;
#endif
/* Define mobj_t */
#if !defined(__REMOOD_MOBJT_DEFINED)
typedef struct mobj_s mobj_t;
#define __REMOOD_MOBJT_DEFINED
#endif
/* Define player_t */
#if !defined(__REMOOD_PLAYERT_DEFINED)
typedef struct player_s player_t;
#define __REMOOD_PLAYERT_DEFINED
#endif
/* Define PI_wepid_t */
#if !defined(__REMOOD_PIWEPIDT_DEFINED)
typedef int32_t PI_wepid_t;
#define __REMOOD_PIWEPIDT_DEFINED
#endif
/* Define PI_state_t */
#if !defined(__REMOOD_PISTATE_DEFINED)
typedef struct PI_state_s PI_state_t;
#define __REMOOD_PISTATE_DEFINED
#endif
/* Define PI_wep_t */
#if !defined(__REMOOD_PIWEP_DEFINED)
typedef struct PI_wep_s PI_wep_t;
#define __REMOOD_PIWEP_DEFINED
#endif
/* Define mapthing_t */
#if !defined(__REMOOD_MAPTHINGT_DEFINED)
typedef struct mapthing_s mapthing_t;
#define __REMOOD_MAPTHINGT_DEFINED
#endif
/* Define wbstartstruct_t */
#if !defined(__REMOOD_WBSS_DEFINED)
typedef struct wbstartstruct_s wbstartstruct_t;
#define __REMOOD_WBSS_DEFINED
#endif
// The player data structure depends on a number
// of other structs: items (internal inventory),
// animation states (closely tied to the sprites
// used to represent them, unfortunately).
// In addition, the player is just a special
// case of the generic moving object/actor.
// Finally, for odd reasons, the player input
// is buffered within the player data struct,
// as commands per game tick.
//
// Player states.
//
typedef enum
{
// Playing or camping.
PST_LIVE,
// Dead on the ground, view follows killer.
PST_DEAD,
// Ready to restart/respawn???
PST_REBORN
} P_PlayerState_t;
//
// Player internal flags, for cheats and debug.
//
typedef enum
{
// No clipping, walk through barriers.
CF_NOCLIP = 1,
// No damage, no health loss.
CF_GODMODE = 2,
// Not really a cheat, just a debug aid.
CF_NOMOMENTUM = 4,
//added:28-02-98: new cheats
CF_FLYAROUND = 8,
//added:28-02-98: NOT REALLY A CHEAT
// Allow player avatar to walk in-air
// if trying to get over a small wall (hack for playability)
CF_JUMPOVER = 16
} cheat_t;
/* camera_t -- Chase cam */
typedef struct camera_s
{
bool_t chase;
angle_t aiming;
int32_t fixedcolormap;
//SoM: Things used by FS cameras.
fixed_t viewheight;
angle_t startangle;
mobj_t* mo;
} camera_t;
struct SN_Port_s;
// Power up artifacts.
typedef enum
{
pw_invulnerability,
pw_strength,
pw_invisibility,
pw_ironfeet,
pw_allmap,
pw_infrared,
NUMPOWERS
} powertype_t;
//
// Overlay psprites are scaled shapes
// drawn directly on the view screen,
// coordinates are given for a 320*200 view screen.
//
typedef enum
{
ps_weapon,
ps_flash,
NUMPSPRITES
} psprnum_t;
/* Define pspdef_t */
#if !defined(__REMOOD_PSPDEFT_DEFINED)
typedef struct pspdef_s pspdef_t;
#define __REMOOD_PSPDEFT_DEFINED
#endif
struct pspdef_s
{
PI_state_t* state; // a NULL state means not active
int32_t tics;
fixed_t sx;
fixed_t sy;
};
#define NUMINVENTORYSLOTS 14
#define MAXARTECONT 16
typedef struct
{
uint8_t type;
uint8_t count;
} inventory_t;
// ========================================================================
// PLAYER STRUCTURE
// ========================================================================
struct player_s
{
mobj_t* mo;
// added 1-6-98: for movement prediction
P_PlayerState_t playerstate;
ticcmd_t cmd;
// Determine POV,
// including viewpoint bobbing during movement.
// Focal origin above r.z
fixed_t viewz;
// Base height above floor for viewz.
fixed_t viewheight;
// Bob/squat speed.
fixed_t deltaviewheight;
// bounded/scaled total momentum.
fixed_t bob;
fixed_t FlatBob; // Flat bobbing value
//added:16-02-98: mouse aiming, where the guy is looking at!
// It is updated with cmd->aiming.
angle_t aiming;
// This is only used between levels,
// mo->health is used during levels.
int32_t health;
int32_t armorpoints;
// Armor type is 0-2.
uint8_t armortype;
// Power ups. invinc and invis are tic counters.
int32_t powers[NUMPOWERS];
bool_t backpack;
// Frags, kills of other players.
uint16_t addfrags; // player have killed a player but is gone
uint16_t frags[MAXPLAYERS];
PI_wepid_t readyweapon;
// Is wp_nochange if not changing.
PI_wepid_t pendingweapon;
PI_wepid_t DeadWeapon; // Weapon held when dead
PI_wepid_t* FavoriteWeapons; // Favorite Weapons
bool_t* weaponowned;
int32_t* ammo;
int32_t* maxammo;
bool_t originalweaponswitch;
//added:28-02-98:
bool_t autoaim_toggle;
// True if button down last tic.
bool_t attackdown;
bool_t usedown;
bool_t jumpdown; //added:19-03-98:dont jump like a monkey!
// Bit flags, for cheats and debug.
// See cheat_t, above.
int32_t cheats;
// Refired shots are less accurate.
int32_t refire;
// For intermission stats.
int32_t killcount;
int32_t itemcount;
int32_t secretcount;
// Hint messages.
char* message;
// For screen flashing (red or bright).
int32_t damagecount;
int32_t bonuscount;
uint8_t PalChoice; // Palette to display for player
// Who did damage (NULL for floors/ceilings).
mobj_t* attacker;
int32_t specialsector; //lava/slime/water...
// So gun flashes light up areas.
int32_t extralight;
// Current PLAYPAL, ???
// can be set to REDCOLORMAP for pain, etc.
int32_t fixedcolormap;
// Player skin colorshift,
// 0-3 for which color to draw player.
// adding 6-2-98 comment : unused by doom2 1.9 now is used
int32_t skincolor;
int32_t VTeamColor; // Virtual Team Color
// added 2/8/98
int32_t skin;
// Overlay view sprites (gun, etc).
pspdef_t psprites[NUMPSPRITES];
// True if secret level has been done.
bool_t didsecret;
// heretic
int32_t chickenTics; // player is a chicken if > 0
int32_t chickenPeck; // chicken peck countdown
mobj_t* rain1; // active rain maker 1
mobj_t* rain2; // active rain maker 2
int32_t flamecount;
fixed_t flyheight;
inventory_t inventory[NUMINVENTORYSLOTS];
int32_t inventorySlotNum;
int32_t inv_ptr;
int32_t st_curpos; // position of inventory scroll
int32_t st_inventoryTics; // when >0 show inventory in status bar
PI_wep_t** weaponinfo; // can be changed when use level2 weapons (heretic)
// Sound Info
int32_t flushdelay;
// GhostlyDeath <October 23, 2010> -- Player inflicted momentum
fixed_t MoveMom;
fixed_t TargetViewZ;
// GhostlyDeath <September 16, 2011> -- "Effort" based bobbing
fixed_t FakeMom[3];
// GhostlyDeath <March 6, 2012> -- Per-player (chase) camera
camera_t camera;
fixed_t CamDist, CamHeight, CamSpeed; // Camera Properties
bool_t ChaseCam; // Chase Camera
// GhostlyDeath <October 5, 2012> -- Title-screen Demo Stuff
mobj_t* LastBFGBall; // Player's last BFG Ball
mobj_t* Attackee; // Thing being attacked
/*** EXTENDED STUFF ***/
D_Prof_t* ProfileEx; // Extended Profiles
struct SN_Port_s* Port; // Port
// Health
int32_t MaxHealth[2]; // Max Health
int32_t MaxArmor[2]; // Max Armor
// Counter-Operative
bool_t CounterOpPlayer; // On the monster's side
// Kill Totals
int32_t TotalFrags; // Total kills
int32_t TotalDeaths; // Total deaths
uint32_t FraggerID; // Fragger ID
// Load prevention
tic_t SuicideDelay; // Prevent suicides until after
// Key Cards
uint32_t KeyCards[2]; // Cards and Skulls
uint8_t KeyFlash[2][32]; // Flashing of keys
// Ping
uint16_t Ping; // Player's Ping
uint32_t BackupButtons;
};
//
// INTERMISSION
// Structure passed e.g. to WI_Start(wb)
//
typedef struct
{
bool_t in; // whether the player is in game
// Player stats, kills, collected items etc.
int32_t skills;
int32_t sitems;
int32_t ssecret;
int32_t stime;
uint16_t frags[MAXPLAYERS]; // added 17-1-98 more than 4 players
int32_t score; // current score on entry, modified on return
// BP: unused for now but don't forget....
uint16_t addfrags;
} wbplayerstruct_t;
struct P_LevelInfoEx_s;
struct wbstartstruct_s
{
int32_t epsd; // episode # (0-2)
// if true, splash the secret level
bool_t didsecret;
// previous and next levels, origin 0
int32_t last;
int32_t next;
int32_t maxkills;
int32_t maxitems;
int32_t maxsecret;
int32_t maxfrags;
// the par time
int32_t partime;
// index of this player in game
int32_t pnum;
wbplayerstruct_t plyr[MAXPLAYERS];
struct P_LevelInfoEx_s* NextInfo; // Info for next level
};
/**************
*** GLOBALS ***
**************/
extern char player_names[MAXPLAYERS][MAXPLAYERNAME];
extern char team_names[MAXPLAYERS][MAXPLAYERNAME * 2];
extern player_t players[MAXPLAYERS];
extern bool_t playeringame[MAXPLAYERS];
#define MAX_DM_STARTS 64
extern mapthing_t* deathmatchstarts[MAX_DM_STARTS];
extern int numdmstarts;
extern mapthing_t* g_TeamStarts[MAXSKINCOLORS][MAXPLAYERS];
extern mapthing_t* playerstarts[MAXPLAYERS];
#define BODYQUESIZE MAXPLAYERS
extern mobj_t* bodyque[BODYQUESIZE];
extern int bodyqueslot;
#endif