d_player.h 4.6 KB

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