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