d_player.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. /*
  2. ===========================================================================
  3. Doom 3 BFG Edition GPL Source Code
  4. Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
  5. This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
  6. Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation, either version 3 of the License, or
  9. (at your option) any later version.
  10. Doom 3 BFG Edition Source Code 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. You should have received a copy of the GNU General Public License
  15. along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
  16. In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
  17. If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
  18. ===========================================================================
  19. */
  20. #ifndef __D_PLAYER__
  21. #define __D_PLAYER__
  22. // The player data structure depends on a number
  23. // of other structs: items (internal inventory),
  24. // animation states (closely tied to the sprites
  25. // used to represent them, unfortunately).
  26. #include "d_items.h"
  27. #include "p_pspr.h"
  28. // In addition, the player is just a special
  29. // case of the generic moving object/actor.
  30. #include "p_mobj.h"
  31. // Finally, for odd reasons, the player input
  32. // is buffered within the player data struct,
  33. // as commands per game tick.
  34. #include "d_ticcmd.h"
  35. #ifdef __GNUG__
  36. #pragma interface
  37. #endif
  38. //
  39. // Player states.
  40. //
  41. typedef enum
  42. {
  43. // Playing or camping.
  44. PST_LIVE,
  45. // Dead on the ground, view follows killer.
  46. PST_DEAD,
  47. // Ready to restart/respawn???
  48. PST_REBORN
  49. } playerstate_t;
  50. //
  51. // Player internal flags, for cheats and debug.
  52. //
  53. typedef enum
  54. {
  55. // No clipping, walk through barriers.
  56. CF_NOCLIP = 1,
  57. // No damage, no health loss.
  58. CF_GODMODE = 2,
  59. // Not really a cheat, just a debug aid.
  60. CF_NOMOMENTUM = 4,
  61. // Gives kfa at the beginning of the level.
  62. CF_GIVEALL = 8,
  63. CF_INFAMMO = 16,
  64. } cheat_t;
  65. //
  66. // Extended player object info: player_t
  67. //
  68. typedef struct player_s
  69. {
  70. mobj_t* mo;
  71. playerstate_t playerstate;
  72. ticcmd_t cmd;
  73. // Determine POV,
  74. // including viewpoint bobbing during movement.
  75. // Focal origin above r.z
  76. fixed_t viewz;
  77. // Base height above floor for viewz.
  78. fixed_t viewheight;
  79. // Bob/squat speed.
  80. fixed_t deltaviewheight;
  81. // bounded/scaled total momentum.
  82. fixed_t bob;
  83. // This is only used between levels,
  84. // mo->health is used during levels.
  85. int health;
  86. int armorpoints;
  87. // Armor type is 0-2.
  88. int armortype;
  89. // Power ups. invinc and invis are tic counters.
  90. int powers[NUMPOWERS];
  91. qboolean cards[NUMCARDS];
  92. qboolean backpack;
  93. // Frags, kills of other players.
  94. int frags[MAXPLAYERS];
  95. weapontype_t readyweapon;
  96. // Is wp_nochange if not changing.
  97. weapontype_t pendingweapon;
  98. int weaponowned[NUMWEAPONS];
  99. int ammo[NUMAMMO];
  100. int maxammo[NUMAMMO];
  101. // True if button down last tic.
  102. int attackdown;
  103. int usedown;
  104. // Bit flags, for cheats and debug.
  105. // See cheat_t, above.
  106. int cheats;
  107. // Refired shots are less accurate.
  108. int refire;
  109. // For intermission stats.
  110. int killcount;
  111. int itemcount;
  112. int secretcount;
  113. int chainsawKills;
  114. int berserkKills;
  115. // Hint messages.
  116. const char* message;
  117. // For screen flashing (red or bright).
  118. int damagecount;
  119. int bonuscount;
  120. // Who did damage (NULL for floors/ceilings).
  121. mobj_t* attacker;
  122. // So gun flashes light up areas.
  123. int extralight;
  124. // Current PLAYPAL, ???
  125. // can be set to REDCOLORMAP for pain, etc.
  126. int fixedcolormap;
  127. // Player skin colorshift,
  128. // 0-3 for which color to draw player.
  129. int colormap;
  130. // Overlay view sprites (gun, etc).
  131. pspdef_t psprites[NUMPSPRITES];
  132. // True if secret level has been done.
  133. qboolean didsecret;
  134. } player_t;
  135. //
  136. // INTERMISSION
  137. // Structure passed e.g. to WI_Start(wb)
  138. //
  139. typedef struct
  140. {
  141. qboolean in; // whether the player is in game
  142. // Player stats, kills, collected items etc.
  143. int skills;
  144. int sitems;
  145. int ssecret;
  146. int stime;
  147. int frags[4];
  148. int score; // current score on entry, modified on return
  149. } wbplayerstruct_t;
  150. typedef struct
  151. {
  152. int epsd; // episode # (0-2)
  153. // if true, splash the secret level
  154. qboolean didsecret;
  155. // previous and next levels, origin 0
  156. int last;
  157. int next;
  158. int maxkills;
  159. int maxitems;
  160. int maxsecret;
  161. int maxfrags;
  162. // the par time
  163. int partime;
  164. // index of this player in game
  165. int pnum;
  166. wbplayerstruct_t plyr[MAXPLAYERS];
  167. } wbstartstruct_t;
  168. #endif