1 /*
2 Copyright (C) 1994-1995 Apogee Software, Ltd.
3 
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (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.
12 
13 See the GNU General Public License for more details.
14 
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18 
19 */
20 //***************************************************************************
21 //
22 // Public header for RT_IN.C.
23 //
24 //***************************************************************************
25 
26 #ifndef _rt_in_public
27 #define _rt_in_public
28 
29 #include "develop.h"
30 #include "rottnet.h"
31 
32 //***************************************************************************
33 //
34 // DEFINES
35 //
36 //***************************************************************************
37 
38 #define MAXLETTERS   32
39 
40 
41 //***************************************************************************
42 //
43 // TYPEDEFS
44 //
45 //***************************************************************************
46 
47 typedef  enum
48 {
49 	motion_Left  = -1,
50 	motion_Up    = -1,
51    motion_None  = 0,
52    motion_Right = 1,
53    motion_Down  = 1
54 } Motion;
55 
56 
57 typedef  enum
58 {
59    dir_North,
60    dir_NorthEast,
61    dir_East,
62    dir_SouthEast,
63    dir_South,
64    dir_SouthWest,
65    dir_West,
66    dir_NorthWest,
67    dir_None
68 } Direction;
69 
70 typedef byte ScanCode;
71 
72 typedef  enum
73 {
74 	ctrl_Keyboard,
75 	ctrl_Keyboard1 = ctrl_Keyboard, ctrl_Keyboard2,
76 	ctrl_Joystick,
77 	ctrl_Joystick1 = ctrl_Joystick, ctrl_Joystick2,
78 	ctrl_Mouse
79 } ControlType;
80 
81 typedef  struct
82 {
83 	boolean     button0,
84 					button1,
85 					button2,
86 					button3;
87 	int         x,
88 					y;
89 	Motion      xaxis,
90 					yaxis;
91 	Direction   dir;
92 } CursorInfo;
93 
94 
95 typedef  CursorInfo  ControlInfo;
96 
97 
98 typedef  struct
99 {
100    ScanCode button0,
101             button1,
102             upleft,
103             up,
104             upright,
105             left,
106             right,
107             downleft,
108             down,
109             downright;
110 } KeyboardDef;
111 
112 
113 typedef struct
114 {
115    word  joyMinX,joyMinY,
116          threshMinX,threshMinY,
117          threshMaxX,threshMaxY,
118          joyMaxX,joyMaxY,
119          joyMultXL,joyMultYL,
120          joyMultXH,joyMultYH;
121 } JoystickDef;
122 
123 
124 typedef struct
125 {
126    boolean messageon;
127    boolean directed;
128    boolean inmenu;
129    int     remoteridicule;
130    int     towho;
131    int     textnum;
132    int     length;
133 } ModemMessage;
134 
135 
136 //***************************************************************************
137 //
138 // GLOBALS
139 //
140 //***************************************************************************
141 
142 extern boolean MousePresent;
143 extern boolean JoysPresent[MaxJoys];
144 extern boolean JoyPadPresent;
145 extern int     mouseadjustment;
146 extern int     threshold;
147 
148 extern boolean  Paused;
149 extern volatile int LastScan;
150 extern KeyboardDef KbdDefs;
151 extern JoystickDef JoyDefs[];
152 extern ControlType Controls[MAXPLAYERS];
153 
154 extern boolean  SpaceBallPresent;
155 extern boolean  CybermanPresent;
156 extern boolean  AssassinPresent;
157 extern char LastASCII;
158 extern volatile int LastScan;
159 
160 extern byte Joy_xb,
161             Joy_yb,
162             Joy_xs,
163             Joy_ys;
164 extern word Joy_x,
165             Joy_y;
166 
167 extern int LastLetter;
168 extern char LetterQueue[MAXLETTERS];
169 extern ModemMessage MSG;
170 
171 extern const char ScanChars[128];
172 
173 //***************************************************************************
174 //
175 // PROTOTYPES
176 //
177 //***************************************************************************
178 
179 void INL_GetMouseDelta(int *x,int *y);
180 word IN_GetMouseButtons (void);
181 void IN_IgnoreMouseButtons( void );
182 boolean INL_StartMouse (void);
183 void INL_ShutMouse (void);
184 void IN_Startup(void);
185 void IN_Default (boolean gotit, ControlType in);
186 void IN_Shutdown (void);
187 void IN_SetKeyHook(void (*hook)());
188 void IN_ClearKeysDown (void);
189 void IN_ReadControl (int player, ControlInfo *info);
190 void IN_SetControlType (int player, ControlType type);
191 ScanCode IN_WaitForKey (void);
192 char IN_WaitForASCII (void);
193 void IN_StartAck (void);
194 boolean IN_CheckAck (void);
195 void IN_Ack (void);
196 boolean IN_UserInput (long delay);
197 void IN_GetJoyAbs (word joy, word *xp, word *yp);
198 void INL_GetJoyDelta (word joy, int *dx, int *dy);
199 word INL_GetJoyButtons (word joy);
200 //word IN_GetJoyButtonsDB (word joy);
201 void INL_SetJoyScale (word joy);
202 void IN_SetupJoy (word joy, word minx, word maxx, word miny, word maxy);
203 boolean INL_StartJoy (word joy);
204 void INL_ShutJoy (word joy);
205 int IN_JoyButtons (void);
206 void IN_UpdateKeyboard (void);
207 void IN_ClearKeyboardQueue (void);
208 int IN_InputUpdateKeyboard (void);
209 void IN_PumpEvents (void);
210 void QueueLetterInput (void);
211 
212 #endif
213