diff options
Diffstat (limited to 'src/d_player.h')
-rw-r--r-- | src/d_player.h | 234 |
1 files changed, 234 insertions, 0 deletions
diff --git a/src/d_player.h b/src/d_player.h new file mode 100644 index 0000000..a45abe8 --- /dev/null +++ b/src/d_player.h | |||
@@ -0,0 +1,234 @@ | |||
1 | /* Emacs style mode select -*- C++ -*- | ||
2 | *----------------------------------------------------------------------------- | ||
3 | * | ||
4 | * | ||
5 | * PrBoom: a Doom port merged with LxDoom and LSDLDoom | ||
6 | * based on BOOM, a modified and improved DOOM engine | ||
7 | * Copyright (C) 1999 by | ||
8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman | ||
9 | * Copyright (C) 1999-2000 by | ||
10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze | ||
11 | * Copyright 2005, 2006 by | ||
12 | * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or | ||
15 | * modify it under the terms of the GNU General Public License | ||
16 | * as published by the Free Software Foundation; either version 2 | ||
17 | * of the License, or (at your option) any later version. | ||
18 | * | ||
19 | * This program is distributed in the hope that it will be useful, | ||
20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
22 | * GNU General Public License for more details. | ||
23 | * | ||
24 | * You should have received a copy of the GNU General Public License | ||
25 | * along with this program; if not, write to the Free Software | ||
26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | ||
27 | * 02111-1307, USA. | ||
28 | * | ||
29 | * DESCRIPTION: | ||
30 | * Player state structure. | ||
31 | * | ||
32 | *-----------------------------------------------------------------------------*/ | ||
33 | |||
34 | |||
35 | #ifndef __D_PLAYER__ | ||
36 | #define __D_PLAYER__ | ||
37 | |||
38 | |||
39 | // The player data structure depends on a number | ||
40 | // of other structs: items (internal inventory), | ||
41 | // animation states (closely tied to the sprites | ||
42 | // used to represent them, unfortunately). | ||
43 | #include "d_items.h" | ||
44 | #include "p_pspr.h" | ||
45 | |||
46 | // In addition, the player is just a special | ||
47 | // case of the generic moving object/actor. | ||
48 | #include "p_mobj.h" | ||
49 | |||
50 | // Finally, for odd reasons, the player input | ||
51 | // is buffered within the player data struct, | ||
52 | // as commands per game tick. | ||
53 | #include "d_ticcmd.h" | ||
54 | |||
55 | #ifdef __GNUG__ | ||
56 | #pragma interface | ||
57 | #endif | ||
58 | |||
59 | |||
60 | // | ||
61 | // Player states. | ||
62 | // | ||
63 | typedef enum | ||
64 | { | ||
65 | // Playing or camping. | ||
66 | PST_LIVE, | ||
67 | // Dead on the ground, view follows killer. | ||
68 | PST_DEAD, | ||
69 | // Ready to restart/respawn??? | ||
70 | PST_REBORN | ||
71 | |||
72 | } playerstate_t; | ||
73 | |||
74 | |||
75 | // | ||
76 | // Player internal flags, for cheats and debug. | ||
77 | // | ||
78 | typedef enum | ||
79 | { | ||
80 | // No clipping, walk through barriers. | ||
81 | CF_NOCLIP = 1, | ||
82 | // No damage, no health loss. | ||
83 | CF_GODMODE = 2, | ||
84 | // Not really a cheat, just a debug aid. | ||
85 | CF_NOMOMENTUM = 4 | ||
86 | |||
87 | } cheat_t; | ||
88 | |||
89 | |||
90 | // | ||
91 | // Extended player object info: player_t | ||
92 | // | ||
93 | typedef struct player_s | ||
94 | { | ||
95 | mobj_t* mo; | ||
96 | playerstate_t playerstate; | ||
97 | ticcmd_t cmd; | ||
98 | |||
99 | // Determine POV, | ||
100 | // including viewpoint bobbing during movement. | ||
101 | // Focal origin above r.z | ||
102 | fixed_t viewz; | ||
103 | // Base height above floor for viewz. | ||
104 | fixed_t viewheight; | ||
105 | // Bob/squat speed. | ||
106 | fixed_t deltaviewheight; | ||
107 | // bounded/scaled total momentum. | ||
108 | fixed_t bob; | ||
109 | |||
110 | /* killough 10/98: used for realistic bobbing (i.e. not simply overall speed) | ||
111 | * mo->momx and mo->momy represent true momenta experienced by player. | ||
112 | * This only represents the thrust that the player applies himself. | ||
113 | * This avoids anomolies with such things as Boom ice and conveyors. | ||
114 | */ | ||
115 | fixed_t momx, momy; // killough 10/98 | ||
116 | |||
117 | // This is only used between levels, | ||
118 | // mo->health is used during levels. | ||
119 | int health; | ||
120 | int armorpoints; | ||
121 | // Armor type is 0-2. | ||
122 | int armortype; | ||
123 | |||
124 | // Power ups. invinc and invis are tic counters. | ||
125 | int powers[NUMPOWERS]; | ||
126 | boolean cards[NUMCARDS]; | ||
127 | boolean backpack; | ||
128 | |||
129 | // Frags, kills of other players. | ||
130 | int frags[MAXPLAYERS]; | ||
131 | weapontype_t readyweapon; | ||
132 | |||
133 | // Is wp_nochange if not changing. | ||
134 | weapontype_t pendingweapon; | ||
135 | |||
136 | boolean weaponowned[NUMWEAPONS]; | ||
137 | int ammo[NUMAMMO]; | ||
138 | int maxammo[NUMAMMO]; | ||
139 | |||
140 | // True if button down last tic. | ||
141 | int attackdown; | ||
142 | int usedown; | ||
143 | |||
144 | // Bit flags, for cheats and debug. | ||
145 | // See cheat_t, above. | ||
146 | int cheats; | ||
147 | |||
148 | // Refired shots are less accurate. | ||
149 | int refire; | ||
150 | |||
151 | // For intermission stats. | ||
152 | int killcount; | ||
153 | int itemcount; | ||
154 | int secretcount; | ||
155 | |||
156 | // Hint messages. // CPhipps - const | ||
157 | const char* message; | ||
158 | |||
159 | // For screen flashing (red or bright). | ||
160 | int damagecount; | ||
161 | int bonuscount; | ||
162 | |||
163 | // Who did damage (NULL for floors/ceilings). | ||
164 | mobj_t* attacker; | ||
165 | |||
166 | // So gun flashes light up areas. | ||
167 | int extralight; | ||
168 | |||
169 | // Current PLAYPAL, ??? | ||
170 | // can be set to REDCOLORMAP for pain, etc. | ||
171 | int fixedcolormap; | ||
172 | |||
173 | // Player skin colorshift, | ||
174 | // 0-3 for which color to draw player. | ||
175 | int colormap; | ||
176 | |||
177 | // Overlay view sprites (gun, etc). | ||
178 | pspdef_t psprites[NUMPSPRITES]; | ||
179 | |||
180 | // True if secret level has been done. | ||
181 | boolean didsecret; | ||
182 | |||
183 | } player_t; | ||
184 | |||
185 | |||
186 | // | ||
187 | // INTERMISSION | ||
188 | // Structure passed e.g. to WI_Start(wb) | ||
189 | // | ||
190 | typedef struct | ||
191 | { | ||
192 | boolean in; // whether the player is in game | ||
193 | |||
194 | // Player stats, kills, collected items etc. | ||
195 | int skills; | ||
196 | int sitems; | ||
197 | int ssecret; | ||
198 | int stime; | ||
199 | int frags[4]; | ||
200 | int score; // current score on entry, modified on return | ||
201 | |||
202 | } wbplayerstruct_t; | ||
203 | |||
204 | typedef struct | ||
205 | { | ||
206 | int epsd; // episode # (0-2) | ||
207 | |||
208 | // if true, splash the secret level | ||
209 | boolean didsecret; | ||
210 | |||
211 | // previous and next levels, origin 0 | ||
212 | int last; | ||
213 | int next; | ||
214 | |||
215 | int maxkills; | ||
216 | int maxitems; | ||
217 | int maxsecret; | ||
218 | int maxfrags; | ||
219 | |||
220 | // the par time | ||
221 | int partime; | ||
222 | |||
223 | // index of this player in game | ||
224 | int pnum; | ||
225 | |||
226 | wbplayerstruct_t plyr[MAXPLAYERS]; | ||
227 | |||
228 | // CPhipps - total game time for completed levels so far | ||
229 | int totaltimes; | ||
230 | |||
231 | } wbstartstruct_t; | ||
232 | |||
233 | |||
234 | #endif | ||