d_player.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  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. #ifndef __D_PLAYER__
  34. #define __D_PLAYER__
  35. // The player data structure depends on a number
  36. // of other structs: items (internal inventory),
  37. // animation states (closely tied to the sprites
  38. // used to represent them, unfortunately).
  39. #include "d_items.h"
  40. #include "p_pspr.h"
  41. // In addition, the player is just a special
  42. // case of the generic moving object/actor.
  43. #include "p_mobj.h"
  44. // Finally, for odd reasons, the player input
  45. // is buffered within the player data struct,
  46. // as commands per game tick.
  47. #include "d_ticcmd.h"
  48. //
  49. // Player states.
  50. //
  51. typedef enum
  52. {
  53. // Playing or camping.
  54. PST_LIVE,
  55. // Dead on the ground, view follows killer.
  56. PST_DEAD,
  57. // Ready to restart/respawn???
  58. PST_REBORN
  59. } playerstate_t;
  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. } cheat_t;
  72. //
  73. // Extended player object info: player_t
  74. //
  75. typedef struct player_s
  76. {
  77. mobj_t* mo;
  78. playerstate_t playerstate;
  79. ticcmd_t cmd;
  80. // Determine POV,
  81. // including viewpoint bobbing during movement.
  82. // Focal origin above r.z
  83. fixed_t viewz;
  84. // Base height above floor for viewz.
  85. fixed_t viewheight;
  86. // Bob/squat speed.
  87. fixed_t deltaviewheight;
  88. // bounded/scaled total momentum.
  89. fixed_t bob;
  90. /* killough 10/98: used for realistic bobbing (i.e. not simply overall speed)
  91. * mo->momx and mo->momy represent true momenta experienced by player.
  92. * This only represents the thrust that the player applies himself.
  93. * This avoids anomolies with such things as Boom ice and conveyors.
  94. */
  95. fixed_t momx, momy; // killough 10/98
  96. // This is only used between levels,
  97. // mo->health is used during levels.
  98. int health;
  99. int armorpoints;
  100. // Armor type is 0-2.
  101. int armortype;
  102. // Power ups. invinc and invis are tic counters.
  103. int powers[NUMPOWERS];
  104. boolean cards[NUMCARDS];
  105. boolean backpack;
  106. // Frags, kills of other players.
  107. int frags[MAXPLAYERS];
  108. weapontype_t readyweapon;
  109. // Is wp_nochange if not changing.
  110. weapontype_t pendingweapon;
  111. boolean weaponowned[NUMWEAPONS];
  112. int ammo[NUMAMMO];
  113. int maxammo[NUMAMMO];
  114. // True if button down last tic.
  115. int attackdown;
  116. int usedown;
  117. // Bit flags, for cheats and debug.
  118. // See cheat_t, above.
  119. int cheats;
  120. // Refired shots are less accurate.
  121. int refire;
  122. // For intermission stats.
  123. int killcount;
  124. int itemcount;
  125. int secretcount;
  126. // Hint messages. // CPhipps - const
  127. const char* message;
  128. // For screen flashing (red or bright).
  129. int damagecount;
  130. int bonuscount;
  131. // Who did damage (NULL for floors/ceilings).
  132. mobj_t* attacker;
  133. // So gun flashes light up areas.
  134. int extralight;
  135. // Current PLAYPAL, ???
  136. // can be set to REDCOLORMAP for pain, etc.
  137. int fixedcolormap;
  138. // Player skin colorshift,
  139. // 0-3 for which color to draw player.
  140. int colormap;
  141. // Overlay view sprites (gun, etc).
  142. pspdef_t psprites[NUMPSPRITES];
  143. // True if secret level has been done.
  144. boolean didsecret;
  145. } player_t;
  146. //
  147. // INTERMISSION
  148. // Structure passed e.g. to WI_Start(wb)
  149. //
  150. typedef struct
  151. {
  152. boolean in; // whether the player is in game
  153. // Player stats, kills, collected items etc.
  154. int skills;
  155. int sitems;
  156. int ssecret;
  157. int stime;
  158. int frags[4];
  159. int score; // current score on entry, modified on return
  160. } wbplayerstruct_t;
  161. typedef struct
  162. {
  163. int epsd; // episode # (0-2)
  164. // if true, splash the secret level
  165. boolean didsecret;
  166. // previous and next levels, origin 0
  167. int last;
  168. int next;
  169. int maxkills;
  170. int maxitems;
  171. int maxsecret;
  172. int maxfrags;
  173. // the par time
  174. int partime;
  175. // index of this player in game
  176. int pnum;
  177. wbplayerstruct_t plyr[MAXPLAYERS];
  178. // CPhipps - total game time for completed levels so far
  179. int totaltimes;
  180. } wbstartstruct_t;
  181. #endif