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