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