-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
d_player.h
149 lines (129 loc) · 4.93 KB
/
d_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
/**\file
*\section License
* License: GPL
* Online License Link: http://www.gnu.org/licenses/gpl.html
*
*\author Copyright © 2003-2012 Jaakko Keränen <jaakko.keranen@iki.fi>
*\author Copyright © 2005-2012 Daniel Swanson <danij@dengine.net>
*
* 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 2 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
/**
* d_player.h: Player data structures.
*/
#ifndef __D_PLAYER__
#define __D_PLAYER__
#ifndef __JDOOM__
# error "Using jDoom headers without __JDOOM__"
#endif
#include "d_items.h"
#include "p_pspr.h"
#include "p_mobj.h"
#include "g_controls.h"
//
// Player states.
//
typedef enum {
PST_LIVE, // Playing or camping.
PST_DEAD, // Dead on the ground, view follows killer.
PST_REBORN // Ready to restart/respawn???
} playerstate_t;
//
// Player internal flags, for cheats and debug.
//
typedef enum {
CF_NOCLIP = 0x1, // No clipping, walk through barriers.
CF_GODMODE = 0x2, // No damage, no health loss.
CF_NOMOMENTUM = 0x4 // Not really a cheat, just a debug aid.
} cheat_t;
typedef struct player_s {
ddplayer_t* plr; // Pointer to the engine's player data.
playerstate_t playerState;
playerclass_t class_; // Player class type.
playerbrain_t brain;
int health; // This is only used between levels, mo->health is used during levels.
int armorPoints;
int armorType; // Armor type is 0-2.
int powers[NUM_POWER_TYPES]; // Power ups. invinc and invis are tic counters.
boolean keys[NUM_KEY_TYPES];
boolean backpack;
int frags[MAXPLAYERS];
weapontype_t readyWeapon;
weapontype_t pendingWeapon; // Is wp_nochange if not changing.
struct playerweapon_s {
boolean owned;
} weapons[NUM_WEAPON_TYPES];
struct playerammo_s {
int owned;
int max;
} ammo[NUM_AMMO_TYPES];
int attackDown; // True if button down last tic.
int useDown;
int cheats; // Bit flags, for cheats and debug, see cheat_t, above.
int refire; // Refired shots are less accurate.
// For intermission stats:
int killCount;
int itemCount;
int secretCount;
// For screen flashing (red or bright):
int damageCount;
int bonusCount;
mobj_t* attacker; // Who did damage (NULL for floors/ceilings).
int colorMap; // Player skin colorshift, 0-3 for which color to draw player.
pspdef_t pSprites[NUMPSPRITES]; // Overlay view sprites (gun, etc).
boolean didSecret; // True if secret level has been done.
int jumpTics; // The player can jump if this counter is zero.
int airCounter;
int flyHeight;
int rebornWait; // The player can be reborn if this counter is zero.
boolean centering; // The player's view pitch is centering back to zero.
int update, startSpot;
coord_t viewOffset[3]; // Relative to position of the player mobj.
coord_t viewZ; // Focal origin above r.z.
coord_t viewHeight; // Base height above floor for viewZ.
coord_t viewHeightDelta;
coord_t bob; // Bounded/scaled total momentum.
// Target view to a mobj (NULL=disabled):
mobj_t* viewLock; // $democam
int lockFull;
} player_t;
//
// INTERMISSION
// Structure passed e.g. to WI_Init(wb)
//
typedef struct {
boolean inGame; // Whether the player is in game.
// Player stats, kills, collected items etc.
int kills;
int items;
int secret;
int time;
int frags[MAXPLAYERS];
int score; // Current score on entry, modified on return.
} wbplayerstruct_t;
typedef struct {
uint episode;
boolean didSecret; // If true, splash the secret level.
uint currentMap, nextMap; // This and next maps.
int maxKills;
int maxItems;
int maxSecret;
int maxFrags;
int parTime;
int pNum; // Index of this player in game.
wbplayerstruct_t plyr[MAXPLAYERS];
} wbstartstruct_t;
#endif