d_event.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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_EVENT__
  22. #define __D_EVENT__
  23. #include "doomtype.h"
  24. //
  25. // Event handling.
  26. //
  27. // Input event types.
  28. typedef enum
  29. {
  30. ev_keydown,
  31. ev_keyup,
  32. ev_mouse,
  33. ev_joystick
  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
  92. //-----------------------------------------------------------------------------
  93. //
  94. // $Log:$
  95. //
  96. //-----------------------------------------------------------------------------