d_event.h 3.1 KB

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