ID_IN.H 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. /* Catacomb Armageddon Source Code
  2. * Copyright (C) 1993-2014 Flat Rock Software
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License along
  15. * with this program; if not, write to the Free Software Foundation, Inc.,
  16. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  17. */
  18. //
  19. // ID Engine
  20. // ID_IN.h - Header file for Input Manager
  21. // v1.0d1
  22. // By Jason Blochowiak
  23. //
  24. #ifndef __TYPES__
  25. #include "ID_Types.h"
  26. #endif
  27. #ifndef __ID_IN__
  28. #define __ID_IN__
  29. #ifdef __DEBUG__
  30. #define __DEBUG_InputMgr__
  31. #endif
  32. #define MaxPlayers 4
  33. #define MaxKbds 2
  34. #define MaxJoys 2
  35. #define NumCodes 128
  36. typedef byte ScanCode;
  37. #define sc_None 0
  38. #define sc_Bad 0xff
  39. #define sc_Return 0x1c
  40. #define sc_Enter sc_Return
  41. #define sc_Escape 0x01
  42. #define sc_Space 0x39
  43. #define sc_BackSpace 0x0e
  44. #define sc_Tab 0x0f
  45. #define sc_Alt 0x38
  46. #define sc_Control 0x1d
  47. #define sc_CapsLock 0x3a
  48. #define sc_LShift 0x2a
  49. #define sc_RShift 0x36
  50. #define sc_UpArrow 0x48
  51. #define sc_DownArrow 0x50
  52. #define sc_LeftArrow 0x4b
  53. #define sc_RightArrow 0x4d
  54. #define sc_Insert 0x52
  55. #define sc_Delete 0x53
  56. #define sc_Home 0x47
  57. #define sc_End 0x4f
  58. #define sc_PgUp 0x49
  59. #define sc_PgDn 0x51
  60. #define sc_F1 0x3b
  61. #define sc_F2 0x3c
  62. #define sc_F3 0x3d
  63. #define sc_F4 0x3e
  64. #define sc_F5 0x3f
  65. #define sc_F6 0x40
  66. #define sc_F7 0x41
  67. #define sc_F8 0x42
  68. #define sc_F9 0x43
  69. #define sc_F10 0x44
  70. #define sc_F11 0x57
  71. #define sc_F12 0x59
  72. #define sc_A 0x1e
  73. #define sc_B 0x30
  74. #define sc_C 0x2e
  75. #define sc_D 0x20
  76. #define sc_E 0x12
  77. #define sc_F 0x21
  78. #define sc_G 0x22
  79. #define sc_H 0x23
  80. #define sc_I 0x17
  81. #define sc_J 0x24
  82. #define sc_K 0x25
  83. #define sc_L 0x26
  84. #define sc_M 0x32
  85. #define sc_N 0x31
  86. #define sc_O 0x18
  87. #define sc_P 0x19
  88. #define sc_Q 0x10
  89. #define sc_R 0x13
  90. #define sc_S 0x1f
  91. #define sc_T 0x14
  92. #define sc_U 0x16
  93. #define sc_V 0x2f
  94. #define sc_W 0x11
  95. #define sc_X 0x2d
  96. #define sc_Y 0x15
  97. #define sc_Z 0x2c
  98. #define key_None 0
  99. #define key_Return 0x0d
  100. #define key_Enter key_Return
  101. #define key_Escape 0x1b
  102. #define key_Space 0x20
  103. #define key_BackSpace 0x08
  104. #define key_Tab 0x09
  105. #define key_Delete 0x7f
  106. // Stuff for the mouse
  107. #define MReset 0
  108. #define MButtons 3
  109. #define MDelta 11
  110. #define MouseInt 0x33
  111. #define Mouse(x) _AX = x,geninterrupt(MouseInt)
  112. typedef enum {
  113. demo_Off,demo_Record,demo_Playback,demo_PlayDone
  114. } Demo;
  115. typedef enum {
  116. ctrl_None, // MDM (GAMERS EDGE) - added
  117. ctrl_Keyboard,
  118. ctrl_Keyboard1 = ctrl_Keyboard,ctrl_Keyboard2,
  119. ctrl_Joystick,
  120. ctrl_Joystick1 = ctrl_Joystick,ctrl_Joystick2,
  121. ctrl_Mouse
  122. } ControlType;
  123. typedef enum {
  124. motion_Left = -1,motion_Up = -1,
  125. motion_None = 0,
  126. motion_Right = 1,motion_Down = 1
  127. } Motion;
  128. typedef enum {
  129. dir_North,dir_NorthEast,
  130. dir_East,dir_SouthEast,
  131. dir_South,dir_SouthWest,
  132. dir_West,dir_NorthWest,
  133. dir_None
  134. } Direction;
  135. typedef struct {
  136. boolean button0,button1;
  137. int x,y;
  138. Motion xaxis,yaxis;
  139. Direction dir;
  140. } CursorInfo;
  141. typedef CursorInfo ControlInfo;
  142. typedef struct {
  143. ScanCode button0,button1,
  144. upleft, up, upright,
  145. left, right,
  146. downleft, down, downright;
  147. } KeyboardDef;
  148. typedef struct {
  149. word joyMinX,joyMinY,
  150. threshMinX,threshMinY,
  151. threshMaxX,threshMaxY,
  152. joyMaxX,joyMaxY,
  153. joyMultXL,joyMultYL,
  154. joyMultXH,joyMultYH;
  155. } JoystickDef;
  156. // Global variables
  157. extern boolean Keyboard[],
  158. MousePresent,
  159. JoysPresent[];
  160. extern boolean Paused;
  161. extern char LastASCII;
  162. extern ScanCode LastScan;
  163. extern KeyboardDef KbdDefs[];
  164. extern JoystickDef JoyDefs[];
  165. extern ControlType Controls[MaxPlayers];
  166. extern boolean JoystickCalibrated; // MDM (GAMERS EDGE) - added
  167. extern ControlType ControlTypeUsed; // MDM (GAMERS EDGE) - added
  168. extern Demo DemoMode;
  169. extern byte _seg *DemoBuffer;
  170. extern word DemoOffset,DemoSize;
  171. // Function prototypes
  172. #define IN_KeyDown(code) (Keyboard[(code)])
  173. #define IN_ClearKey(code) {Keyboard[code] = false;\
  174. if (code == LastScan) LastScan = sc_None;}
  175. // DEBUG - put names in prototypes
  176. extern void IN_Startup(void),IN_Shutdown(void),
  177. IN_Default(boolean gotit,ControlType in),
  178. IN_SetKeyHook(void (*)()),
  179. IN_ClearKeysDown(void),
  180. IN_ReadCursor(CursorInfo *),
  181. IN_ReadControl(int,ControlInfo *),
  182. IN_SetControlType(int,ControlType),
  183. IN_GetJoyAbs(word joy,word *xp,word *yp),
  184. IN_SetupJoy(word joy,word minx,word maxx,
  185. word miny,word maxy),
  186. IN_StartDemoPlayback(byte _seg *buffer,word bufsize),
  187. IN_StopDemo(void),IN_FreeDemoBuffer(void),
  188. IN_Ack(void),IN_AckBack(void);
  189. extern boolean IN_UserInput(longword delay,boolean clear),
  190. IN_IsUserInput(void),
  191. IN_StartDemoRecord(word bufsize);
  192. extern byte *IN_GetScanName(ScanCode);
  193. extern char IN_WaitForASCII(void);
  194. extern ScanCode IN_WaitForKey(void);
  195. extern word IN_GetJoyButtonsDB(word joy);
  196. #endif