| 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 |
#include "dsda/pclass.h" |
| 39 |
|
| 40 |
// The player data structure depends on a number |
| 41 |
// of other structs: items (internal inventory), |
| 42 |
// animation states (closely tied to the sprites |
| 43 |
// used to represent them, unfortunately). |
| 44 |
#include "d_items.h" |
| 45 |
#include "p_pspr.h" |
| 46 |
|
| 47 |
// In addition, the player is just a special |
| 48 |
// case of the generic moving object/actor. |
| 49 |
#include "p_mobj.h" |
| 50 |
|
| 51 |
// Finally, for odd reasons, the player input |
| 52 |
// is buffered within the player data struct, |
| 53 |
// as commands per game tick. |
| 54 |
#include "d_ticcmd.h" |
| 55 |
|
| 56 |
// |
| 57 |
// Player states. |
| 58 |
// |
| 59 |
typedef enum |
| 60 |
{ |
| 61 |
// Playing or camping. |
| 62 |
PST_LIVE, |
| 63 |
// Dead on the ground, view follows killer. |
| 64 |
PST_DEAD, |
| 65 |
// Ready to restart/respawn??? |
| 66 |
PST_REBORN |
| 67 |
|
| 68 |
} playerstate_t; |
| 69 |
|
| 70 |
#define CF_NOCLIP 0x01 // no clipping |
| 71 |
#define CF_GODMODE 0x02 // immune to damage |
| 72 |
#define CF_INFINITE_AMMO 0x04 // infinite ammo |
| 73 |
#define CF_NOTARGET 0x08 // monsters don't target |
| 74 |
#define CF_FLY 0x10 // flying player |
| 75 |
|
| 76 |
// heretic |
| 77 |
typedef struct |
| 78 |
{ |
| 79 |
int type; |
| 80 |
int count; |
| 81 |
} inventory_t; |
| 82 |
|
| 83 |
// heretic |
| 84 |
typedef enum |
| 85 |
{ |
| 86 |
arti_none, |
| 87 |
arti_invulnerability, |
| 88 |
arti_invisibility, |
| 89 |
arti_health, |
| 90 |
arti_superhealth, |
| 91 |
arti_tomeofpower, |
| 92 |
arti_torch, |
| 93 |
arti_firebomb, |
| 94 |
arti_egg, |
| 95 |
arti_fly, |
| 96 |
arti_teleport, |
| 97 |
NUMARTIFACTS, |
| 98 |
|
| 99 |
// hexen |
| 100 |
hexen_arti_none = arti_none, |
| 101 |
hexen_arti_invulnerability, |
| 102 |
hexen_arti_health, |
| 103 |
hexen_arti_superhealth, |
| 104 |
hexen_arti_healingradius, |
| 105 |
hexen_arti_summon, |
| 106 |
hexen_arti_torch, |
| 107 |
hexen_arti_egg, |
| 108 |
hexen_arti_fly, |
| 109 |
hexen_arti_blastradius, |
| 110 |
hexen_arti_poisonbag, |
| 111 |
hexen_arti_teleportother, |
| 112 |
hexen_arti_speed, |
| 113 |
hexen_arti_boostmana, |
| 114 |
hexen_arti_boostarmor, |
| 115 |
hexen_arti_teleport, |
| 116 |
// Puzzle artifacts |
| 117 |
hexen_arti_firstpuzzitem, |
| 118 |
hexen_arti_puzzskull = hexen_arti_firstpuzzitem, |
| 119 |
hexen_arti_puzzgembig, |
| 120 |
hexen_arti_puzzgemred, |
| 121 |
hexen_arti_puzzgemgreen1, |
| 122 |
hexen_arti_puzzgemgreen2, |
| 123 |
hexen_arti_puzzgemblue1, |
| 124 |
hexen_arti_puzzgemblue2, |
| 125 |
hexen_arti_puzzbook1, |
| 126 |
hexen_arti_puzzbook2, |
| 127 |
hexen_arti_puzzskull2, |
| 128 |
hexen_arti_puzzfweapon, |
| 129 |
hexen_arti_puzzcweapon, |
| 130 |
hexen_arti_puzzmweapon, |
| 131 |
hexen_arti_puzzgear1, |
| 132 |
hexen_arti_puzzgear2, |
| 133 |
hexen_arti_puzzgear3, |
| 134 |
hexen_arti_puzzgear4, |
| 135 |
HEXEN_NUMARTIFACTS |
| 136 |
} artitype_t; |
| 137 |
|
| 138 |
#define NUMINVENTORYSLOTS HEXEN_NUMARTIFACTS |
| 139 |
|
| 140 |
// |
| 141 |
// Extended player object info: player_t |
| 142 |
// |
| 143 |
typedef struct player_s |
| 144 |
{ |
| 145 |
mobj_t* mo; |
| 146 |
playerstate_t playerstate; |
| 147 |
ticcmd_t cmd; |
| 148 |
|
| 149 |
// Determine POV, |
| 150 |
// including viewpoint bobbing during movement. |
| 151 |
// Focal origin above r.z |
| 152 |
fixed_t viewz; |
| 153 |
// Base height above floor for viewz. |
| 154 |
fixed_t viewheight; |
| 155 |
// Bob/squat speed. |
| 156 |
fixed_t deltaviewheight; |
| 157 |
// bounded/scaled total momentum. |
| 158 |
fixed_t bob; |
| 159 |
|
| 160 |
// This is only used between levels, |
| 161 |
// mo->health is used during levels. |
| 162 |
int health; |
| 163 |
int armorpoints[NUMARMOR]; |
| 164 |
// Armor type is 0-2. |
| 165 |
int armortype; |
| 166 |
|
| 167 |
// Power ups. invinc and invis are tic counters. |
| 168 |
int powers[NUMPOWERS]; |
| 169 |
dboolean cards[NUMCARDS]; |
| 170 |
dboolean backpack; |
| 171 |
|
| 172 |
// Frags, kills of other players. |
| 173 |
int frags[MAX_MAXPLAYERS]; |
| 174 |
weapontype_t readyweapon; |
| 175 |
|
| 176 |
// Is wp_nochange if not changing. |
| 177 |
weapontype_t pendingweapon; |
| 178 |
|
| 179 |
dboolean weaponowned[NUMWEAPONS]; |
| 180 |
int ammo[NUMAMMO]; |
| 181 |
int maxammo[NUMAMMO]; |
| 182 |
|
| 183 |
// True if button down last tic. |
| 184 |
int attackdown; |
| 185 |
int usedown; |
| 186 |
|
| 187 |
// See CF flags above. |
| 188 |
int cheats; |
| 189 |
|
| 190 |
// Refired shots are less accurate. |
| 191 |
int refire; |
| 192 |
|
| 193 |
// For intermission stats. |
| 194 |
int killcount; |
| 195 |
int itemcount; |
| 196 |
int secretcount; |
| 197 |
|
| 198 |
// For screen flashing (red or bright). |
| 199 |
int damagecount; |
| 200 |
int bonuscount; |
| 201 |
|
| 202 |
// Who did damage (NULL for floors/ceilings). |
| 203 |
mobj_t* attacker; |
| 204 |
|
| 205 |
// So gun flashes light up areas. |
| 206 |
int extralight; |
| 207 |
|
| 208 |
// Current PLAYPAL, ??? |
| 209 |
// can be set to REDCOLORMAP for pain, etc. |
| 210 |
int fixedcolormap; |
| 211 |
|
| 212 |
// Player skin colorshift, |
| 213 |
// 0-3 for which color to draw player. |
| 214 |
int colormap; |
| 215 |
|
| 216 |
// Overlay view sprites (gun, etc). |
| 217 |
pspdef_t psprites[NUMPSPRITES]; |
| 218 |
|
| 219 |
// True if secret level has been done. |
| 220 |
dboolean didsecret; |
| 221 |
|
| 222 |
// e6y |
| 223 |
// All non original (new) fields of player_t struct are moved to bottom |
| 224 |
// for compatibility with overflow (from a deh) of player_t::ammo[NUMAMMO] |
| 225 |
|
| 226 |
/* killough 10/98: used for realistic bobbing (i.e. not simply overall speed) |
| 227 |
* mo->momx and mo->momy represent true momenta experienced by player. |
| 228 |
* This only represents the thrust that the player applies himself. |
| 229 |
* This avoids anomolies with such things as Boom ice and conveyors. |
| 230 |
*/ |
| 231 |
fixed_t momx, momy; // killough 10/98 |
| 232 |
|
| 233 |
//e6y |
| 234 |
int maxkilldiscount; |
| 235 |
|
| 236 |
fixed_t prev_viewz; |
| 237 |
angle_t prev_viewangle; |
| 238 |
angle_t prev_viewpitch; |
| 239 |
|
| 240 |
// heretic |
| 241 |
int flyheight; |
| 242 |
int lookdir; |
| 243 |
dboolean centering; |
| 244 |
inventory_t inventory[NUMINVENTORYSLOTS]; |
| 245 |
artitype_t readyArtifact; |
| 246 |
int artifactCount; |
| 247 |
int inventorySlotNum; |
| 248 |
int flamecount; // for flame thrower duration |
| 249 |
int chickenTics; // player is a chicken if > 0 |
| 250 |
int chickenPeck; // chicken peck countdown |
| 251 |
mobj_t *rain1; // active rain maker 1 |
| 252 |
mobj_t *rain2; // active rain maker 2 |
| 253 |
|
| 254 |
// hexen |
| 255 |
pclass_t pclass; // player class type |
| 256 |
int morphTics; // player is a pig if > 0 |
| 257 |
int pieces; // Fourth Weapon pieces |
| 258 |
int ravenkeys; // Track statusbar keys |
| 259 |
short yellowMessage; |
| 260 |
int poisoncount; // screen flash for poison damage |
| 261 |
mobj_t *poisoner; // NULL for non-player mobjs |
| 262 |
unsigned int jumpTics; // delay the next jump for a moment |
| 263 |
unsigned int worldTimer; // total time the player's been playing |
| 264 |
|
| 265 |
// zdoom |
| 266 |
int hazardcount; |
| 267 |
byte hazardinterval; |
| 268 |
} player_t; |
| 269 |
|
| 270 |
|
| 271 |
// |
| 272 |
// INTERMISSION |
| 273 |
// Structure passed e.g. to WI_Start(wb) |
| 274 |
// |
| 275 |
typedef struct |
| 276 |
{ |
| 277 |
dboolean in; // whether the player is in game |
| 278 |
|
| 279 |
// Player stats, kills, collected items etc. |
| 280 |
int skills; |
| 281 |
int sitems; |
| 282 |
int ssecret; |
| 283 |
int stime; |
| 284 |
int frags[4]; |
| 285 |
int score; // current score on entry, modified on return |
| 286 |
|
| 287 |
} wbplayerstruct_t; |
| 288 |
|
| 289 |
typedef struct |
| 290 |
{ |
| 291 |
int epsd; // episode # (0-2) |
| 292 |
|
| 293 |
// if true, splash the secret level |
| 294 |
dboolean didsecret; |
| 295 |
|
| 296 |
// previous and next levels, origin 0 |
| 297 |
int last; |
| 298 |
int next; |
| 299 |
int nextep; // for when MAPINFO progression crosses into another episode. |
| 300 |
|
| 301 |
int maxkills; |
| 302 |
int maxitems; |
| 303 |
int maxsecret; |
| 304 |
int maxfrags; |
| 305 |
|
| 306 |
// the par time |
| 307 |
int partime; |
| 308 |
int fake_partime; |
| 309 |
dboolean modified_partime; |
| 310 |
|
| 311 |
// index of this player in game |
| 312 |
int pnum; |
| 313 |
|
| 314 |
wbplayerstruct_t plyr[MAX_MAXPLAYERS]; |
| 315 |
|
| 316 |
// CPhipps - total game time for completed levels so far |
| 317 |
int totaltimes; |
| 318 |
|
| 319 |
} wbstartstruct_t; |
| 320 |
|
| 321 |
fixed_t P_PlayerSpeed(player_t* player); |
| 322 |
|
| 323 |
#endif |