Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

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