Subversion Repositories Kolibri OS

Rev

Go to most recent revision | 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_EVENT__
  24. #define __D_EVENT__
  25.  
  26.  
  27. #include "doomtype.h"
  28.  
  29.  
  30. //
  31. // Event handling.
  32. //
  33.  
  34. // Input event types.
  35. typedef enum
  36. {
  37.     ev_keydown,
  38.     ev_keyup,
  39.     ev_mouse,
  40.     ev_joystick
  41. } evtype_t;
  42.  
  43. // Event structure.
  44. typedef struct
  45. {
  46.     evtype_t    type;
  47.     int         data1;          // keys / mouse/joystick buttons
  48.     int         data2;          // mouse/joystick x move
  49.     int         data3;          // mouse/joystick y move
  50. } event_t;
  51.  
  52.  
  53. typedef enum
  54. {
  55.     ga_nothing,
  56.     ga_loadlevel,
  57.     ga_newgame,
  58.     ga_loadgame,
  59.     ga_savegame,
  60.     ga_playdemo,
  61.     ga_completed,
  62.     ga_victory,
  63.     ga_worlddone,
  64.     ga_screenshot
  65. } gameaction_t;
  66.  
  67.  
  68.  
  69. //
  70. // Button/action code definitions.
  71. //
  72. typedef enum
  73. {
  74.     // Press "Fire".
  75.     BT_ATTACK           = 1,
  76.     // Use button, to open doors, activate switches.
  77.     BT_USE              = 2,
  78.  
  79.     // Flag: game events, not really buttons.
  80.     BT_SPECIAL          = 128,
  81.     BT_SPECIALMASK      = 3,
  82.    
  83.     // Flag, weapon change pending.
  84.     // If true, the next 3 bits hold weapon num.
  85.     BT_CHANGE           = 4,
  86.     // The 3bit weapon mask and shift, convenience.
  87.     BT_WEAPONMASK       = (8+16+32),
  88.     BT_WEAPONSHIFT      = 3,
  89.  
  90.     // Pause the game.
  91.     BTS_PAUSE           = 1,
  92.     // Save the game at each console.
  93.     BTS_SAVEGAME        = 2,
  94.  
  95.     // Savegame slot numbers
  96.     //  occupy the second byte of buttons.    
  97.     BTS_SAVEMASK        = (4+8+16),
  98.     BTS_SAVESHIFT       = 2,
  99.  
  100. } buttoncode_t;
  101.  
  102.  
  103.  
  104.  
  105. //
  106. // GLOBAL VARIABLES
  107. //
  108. #define MAXEVENTS               64
  109.  
  110. extern  event_t         events[MAXEVENTS];
  111. extern  int             eventhead;
  112. extern  int             eventtail;
  113.  
  114. extern  gameaction_t    gameaction;
  115.  
  116.  
  117. #endif
  118. //-----------------------------------------------------------------------------
  119. //
  120. // $Log:$
  121. //
  122. //-----------------------------------------------------------------------------
  123.