1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
|
//-------------------------------------------------------------------------
/*
Copyright (C) 1996, 2003 - 3D Realms Entertainment
This file is part of Duke Nukem 3D version 1.5 - Atomic Edition
Duke Nukem 3D is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
aint32_t with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Original Source: 1996 - Todd Replogle
Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
*/
//-------------------------------------------------------------------------
#include "duke3d.h"
#include "control.h"
#include "mouse.h"
#include "joystick.h"
//***************************************************************************
//
// GLOBALS
//
//***************************************************************************
// FIX_00018: Removed the "smoothmouse" option. This was just a bad fix. Mouse is now faster,
// smoother.
// extern int g_CV_EnableSmoothMouse;
// extern int g_CV_SmoothMouseSensX;
// extern int g_CV_SmoothMouseSensY;
uint32 CONTROL_RudderEnabled;
boolean CONTROL_MousePresent;
boolean CONTROL_JoysPresent[ MaxJoys ];
boolean CONTROL_MouseEnabled;
boolean CONTROL_JoystickEnabled;
byte CONTROL_JoystickPort;
uint32 CONTROL_MouseButtonState1;
uint32 CONTROL_MouseButtonState2;
// FIX_00019: DigitalAxis Handling now supported. (cool for medkit use)
uint32 CONTROL_MouseDigitalAxisState1;
uint32 CONTROL_MouseDigitalAxisState2;
//uint32 CONTROL_ButtonHeldState1;
//uint32 CONTROL_ButtonHeldState2;
uint32 CONTROL_JoyButtonState1;
uint32 CONTROL_JoyButtonState2;
uint32 CONTROL_JoyHatState1; //[MAXJOYHATS];
uint32 CONTROL_JoyHatState2; //[MAXJOYHATS];
static short mouseButtons = 0;
static short lastmousebuttons = 0;
static short joyHats[MAXJOYHATS];
static short lastjoyHats[MAXJOYHATS];
static int32 mousePositionX = 0;
static int32 mousePositionY = 0;
static int32 mouseRelativeX = 0;
static int32 mouseRelativeY = 0;
//***************************************************************************
//
// FUNCTIONS
//
//***************************************************************************
// Joystick/Gamepad bindings
static int32 JoyAxisMapping[MAXJOYAXES];
static int32 JoyHatMapping[MAXJOYHATS][8];
static int32 JoyButtonMapping[MAXJOYBUTTONS];
static float JoyAnalogScale[MAXJOYAXES];
static int32 JoyAnalogDeadzone[MAXJOYAXES];
int ACTION(int i)
{
//Keyboard input
if( (KB_KeyDown[KeyMapping[i].key1]) ||
(KB_KeyDown[KeyMapping[i].key2])
)
{
return 1;
}
// Check mouse
if((ControllerType == controltype_keyboardandmouse) ||
(ControllerType == controltype_joystickandmouse))
{
//Mouse buttons
if ((i)>31)
{
if((CONTROL_MouseButtonState2>>( (i) - 32) ) & 1)
{
return 1;
}
}
else
{
if((CONTROL_MouseButtonState1>> (i) ) & 1)
{
return 1;
}
}
// FIX_00019: DigitalAxis Handling now supported. (cool for medkit use)
//Mouse Digital Axes
if ((i)>31)
{
if((CONTROL_MouseDigitalAxisState2>>( (i) - 32) ) & 1)
{
return 1;
}
}
else
{
if((CONTROL_MouseDigitalAxisState1>> (i) ) & 1)
{
return 1;
}
}
}
// Check joystick
if((ControllerType == controltype_keyboardandjoystick) ||
(ControllerType == controltype_joystickandmouse)
)
{
if ((i)>31)
{
// Check the joystick
if( (CONTROL_JoyButtonState2 >> (i - 32)) & 1)
{
return 1;
}
// Check the hats
if( (CONTROL_JoyHatState2 >> (i - 32)) & 1)
{
return 1;
}
}
else
{
if( (CONTROL_JoyButtonState1 >> i) & 1)
{
return 1;
}
// Check the hats
if( (CONTROL_JoyHatState1 >> i) & 1)
{
return 1;
}
}
}
return 0;
}
int RESET_ACTION(int i)
{
KB_KeyDown[KeyMapping[i].key1] = 0;
KB_KeyDown[KeyMapping[i].key2] = 0;
return 0;
}
static void SETMOUSEBUTTON(int i)
{
//CONTROL_MouseButtonState1 |= (1<<i);
int b;
if (i < 32)
{
b = 1 << i;
CONTROL_MouseButtonState1 |= b;
}
else
{
i -= 32;
b = 1 << i;
CONTROL_MouseButtonState2 |= b;
}
}
void RESMOUSEBUTTON(int i)
{
//CONTROL_MouseButtonState1 &= ~(1<<i);
int b;
if (i < 32) {
b = 1 << i;
CONTROL_MouseButtonState1 &= ~b;
} else {
i -= 32;
b = 1 << i;
CONTROL_MouseButtonState2 &= ~b;
}
}
// FIX_00019: DigitalAxis Handling now supported. (cool for medkit use)
void SETMOUSEDIGITALAXIS(int i)
{
int b;
if (i<0)
return;
if (i < 32)
{
b = 1 << i;
CONTROL_MouseDigitalAxisState1 |= b;
}
else
{
i -= 32;
b = 1 << i;
CONTROL_MouseDigitalAxisState2 |= b;
}
}
void RESMOUSEDIGITALAXIS(int i)
{
int b;
if (i<0)
return;
if (i < 32)
{
b = 1 << i;
CONTROL_MouseDigitalAxisState1 &= ~b;
}
else
{
i -= 32;
b = 1 << i;
CONTROL_MouseDigitalAxisState2 &= ~b;
}
}
static void SETJOYBUTTON(int i)
{
//CONTROL_JoyButtonState |= (1<<i);
int b;
if (i < 32)
{
b = 1 << i;
CONTROL_JoyButtonState1 |= b;
}
else
{
i -= 32;
b = 1 << i;
CONTROL_JoyButtonState2 |= b;
}
}
static void RESJOYBUTTON(int i)
{
int b;
if (i < 32) {
b = 1 << i;
CONTROL_JoyButtonState1 &= ~b;
} else {
i -= 32;
b = 1 << i;
CONTROL_JoyButtonState2 &= ~b;
}
}
static void SETHATBUTTON(int i)
{
//CONTROL_JoyHatState1 |= (1<<i);
int b;
if (i < 32)
{
b = 1 << i;
CONTROL_JoyHatState1 |= b;
}
else
{
i -= 32;
b = 1 << i;
CONTROL_JoyHatState2 |= b;
}
}
static void RESHATBUTTON(int i)
{
//CONTROL_JoyHatState1 &= ~(1<<i);
int b;
if (i < 32) {
b = 1 << i;
CONTROL_JoyHatState1 &= ~b;
} else {
i -= 32;
b = 1 << i;
CONTROL_JoyHatState2 &= ~b;
}
}
void CONTROL_UpdateKeyboardState(int key, int pressed)
{
/*
if(pressed)
{
CONTROL_KeyStates[key] = 1;
}
else
{
CONTROL_KeyStates[key] = 0;
}
*/
/*
int i;
for (i = 0; i < MAXGAMEBUTTONS; i++)
{
if (KeyMapping[i].key_active == false)
{
continue;
}
if (KeyMapping[i].key1 == key ||
KeyMapping[i].key2 == key)
{
if (pressed)
{
SETBUTTON(i);
}
else
{
RESBUTTON(i);
}
}
}
*/
}
void CONTROL_MapKey( int32 which, kb_scancode key1, kb_scancode key2 )
{
// FIX_00020: Protect you from assigning a function to the ESC key through duke3d.cfg
if(key1==sc_Escape || key2==sc_Escape)
{
if(key1==sc_Escape)
key1=0;
else
key2=0;
printf("Discarding ESCAPE key for function : %s\n", gamefunctions[which]);
}
if(key1 || key2)
KeyMapping[which].key_active = true;
else
KeyMapping[which].key_active = false;
KeyMapping[which].key1 = key1;
KeyMapping[which].key2 = key2;
}
void CONTROL_MapButton
(
int32 whichfunction,
int32 whichbutton,
boolean clicked_or_doubleclicked
)
{
if(clicked_or_doubleclicked)
return; // TODO
if(whichbutton < 0 || whichbutton >= MAXMOUSEBUTTONS)
return;
MouseMapping[whichbutton] = whichfunction;
}
void CONTROL_MapJoyButton(int32 whichfunction, int32 whichbutton, boolean doubleclicked)
{
if(whichbutton < 0 || whichbutton >= MAXJOYBUTTONS)
{
return;
}
if(doubleclicked)
return; // TODO
JoyButtonMapping[whichbutton] = whichfunction;
}
void CONTROL_MapJoyHat(int32 whichfunction, int32 whichhat, int32 whichvalue)
{
if(whichhat < 0 || whichhat >= MAXJOYHATS)
{
return;
}
JoyHatMapping[whichhat][whichvalue] = whichfunction;
}
void CONTROL_DefineFlag( int32 which, boolean toggle )
{
// STUBBED("CONTROL_DefineFlag");
}
boolean CONTROL_FlagActive( int32 which )
{
STUBBED("CONTROL_FlagActive");
return false;
}
void CONTROL_ClearAssignments( void )
{
STUBBED("CONTROL_ClearAssignments");
}
void CONTROL_GetUserInput( UserInput *info )
{
STUBBED("CONTROL_GetUserInput");
}
void CONTROL_GetInput( ControlInfo *info )
{
int32 sens_X = CONTROL_GetMouseSensitivity_X();
int32 sens_Y = CONTROL_GetMouseSensitivity_Y();
int32 mx = 0, my = 0;
int i, j;
memset(info, '\0', sizeof (ControlInfo));
//info->dx = info->dz = 0;
_handle_events(); // get the very last mouse position before reading it.
MOUSE_GetDelta(&mx,&my);
//GetCursorPos(&point);
// SDL_GetMouseState(&x, &y);
// SDL_WarpMouse(160, 100);
//mx = (-xx+point.x)<<2;
//my = (-yy+point.y)<<2;
//xx=point.x; yy=point.y;
info->dyaw = (mx * sens_X);
switch(ControllerType)
{
case controltype_keyboardandjoystick:
{
}
break;
case controltype_joystickandmouse:
// Not sure what I was thinking here...
// Commented this out because it totally breaks smooth mouse etc...
/*
{
// Mouse should use pitch instead of forward movement.
info->dpitch = my * sens*2;
}
break;
*/
default:
{
// If mouse aim is active
if( myaimmode )
{
// FIX_00052: Y axis for the mouse is now twice as sensitive as before
info->dpitch = (my * sens_Y * 2);
}
else
{
info->dz = (my * sens_Y * 2);
}
}
break;
}
// TODO: releasing the mouse button does not honor if a keyboard key with
// the same function is still pressed. how should it?
for(i=0; i<MAXMOUSEBUTTONS;++i)
{
if( MouseMapping[i] != -1 )
{
if(!(lastmousebuttons & (1<<i)) && mouseButtons & (1<<i))
{
SETMOUSEBUTTON(MouseMapping[i]); //MouseMapping[i]
//printf("mouse button: %d\n", i);
}
else if(lastmousebuttons & (1<<i) && !(mouseButtons & (1<<i)))
{
RESMOUSEBUTTON(MouseMapping[i]);//MouseMapping[i]
}
}
}
lastmousebuttons = mouseButtons;
// FIX_00019: DigitalAxis Handling now supported. (cool for medkit use)
// update digital axis
RESMOUSEDIGITALAXIS(MouseDigitalAxeMapping[0][0]);
RESMOUSEDIGITALAXIS(MouseDigitalAxeMapping[0][1]);
RESMOUSEDIGITALAXIS(MouseDigitalAxeMapping[1][0]);
RESMOUSEDIGITALAXIS(MouseDigitalAxeMapping[1][1]);
if (mx < 0)
{
SETMOUSEDIGITALAXIS(MouseDigitalAxeMapping[0][0]);
}
else if (mx > 0)
{
SETMOUSEDIGITALAXIS(MouseDigitalAxeMapping[0][1]);
}
if (my < 0)
{
SETMOUSEDIGITALAXIS(MouseDigitalAxeMapping[1][0]);
}
else if (my > 0)
{
SETMOUSEDIGITALAXIS(MouseDigitalAxeMapping[1][1]);
}
// update stick state.
if ((CONTROL_JoystickEnabled) && (_joystick_update()))
{
// Check the hats
JOYSTICK_UpdateHats();
// TODO: make this NOT use the BUTTON() system for storing the hat input. (requires much game code changing)
for(i=0; i<MAXJOYHATS; i++)
{
for(j=0; j<8; j++)
{
if(!(lastjoyHats[i] & (1<<j)) && (joyHats[i] & (1<<j)))
{
SETHATBUTTON(JoyHatMapping[i][j]);
}
else if((lastjoyHats[i] & (1<<j)) && !(joyHats[i] & (1<<j)))
{
RESHATBUTTON(JoyHatMapping[i][j]);
}
}
lastjoyHats[i] = joyHats[i];
}
for(i=0; i<MAXJOYAXES;i++)
{
switch(JoyAxisMapping[i])
{
case analog_turning:
{
info->dyaw += (int32)((float)CONTROL_FilterDeadzone
(
_joystick_axis(i),
JoyAnalogDeadzone[i]
)
* JoyAnalogScale[i]
);
}
break;
case analog_strafing:
{
info->dx += (int32)((float)CONTROL_FilterDeadzone
(
_joystick_axis(i),
JoyAnalogDeadzone[i]
)
* JoyAnalogScale[i]
);
//printf("Joy %d = %d\n", i, info->dx);
}
break;
case analog_lookingupanddown:
info->dpitch += (int32)((float)CONTROL_FilterDeadzone
(
_joystick_axis(i),
JoyAnalogDeadzone[i]
)
* JoyAnalogScale[i]
);
break;
case analog_elevation: //STUB
break;
case analog_rolling: //STUB
break;
case analog_moving:
{
info->dz += (int32)((float)CONTROL_FilterDeadzone
(
_joystick_axis(i),
JoyAnalogDeadzone[i]
)
* JoyAnalogScale[i]
);
}
break;
default:
break;
}
}
// !!! FIXME: Do this.
//SETBUTTON based on _joystick_button().
for(i=0; i<MAXJOYBUTTONS;++i)
{
if(_joystick_button(i))
{
SETJOYBUTTON(JoyButtonMapping[i]);
}
else
{
RESJOYBUTTON(JoyButtonMapping[i]);
}
}
}
}
void CONTROL_ClearAction( int32 whichbutton )
{
//RESBUTTON(whichbutton);
KB_KeyDown[KeyMapping[whichbutton].key1] = 0;
KB_KeyDown[KeyMapping[whichbutton].key2] = 0;
RESJOYBUTTON(whichbutton);
RESHATBUTTON(whichbutton);
RESMOUSEDIGITALAXIS(whichbutton);
}
void CONTROL_ClearUserInput( UserInput *info )
{
STUBBED("CONTROL_ClearUserInput");
}
void CONTROL_WaitRelease( void )
{
STUBBED("CONTROL_WaitRelease");
}
void CONTROL_Ack( void )
{
STUBBED("CONTROL_Ack");
}
void CONTROL_CenterJoystick
(
void ( *CenterCenter )( void ),
void ( *UpperLeft )( void ),
void ( *LowerRight )( void ),
void ( *CenterThrottle )( void ),
void ( *CenterRudder )( void )
)
{
STUBBED("CONTROL_CenterJoystick");
}
int32 CONTROL_GetMouseSensitivity_X( void )
{
return mouseSensitivity_X;
}
void CONTROL_SetMouseSensitivity_X( int32 newsensitivity )
{
mouseSensitivity_X = newsensitivity;
}
// FIX_00014: Added Y cursor setup for mouse sensitivity in the menus
int32 CONTROL_GetMouseSensitivity_Y( void )
{
return mouseSensitivity_Y;
}
void CONTROL_SetMouseSensitivity_Y( int32 newsensitivity )
{
mouseSensitivity_Y = newsensitivity;
}
void CONTROL_Startup
(
controltype which,
int32 ( *TimeFunction )( void ),
int32 ticspersecond
)
{
int i;
// Init the joystick
_joystick_init();
for(i=0; i < MAXJOYHATS; i++)
{
joyHats[i] = 0;
lastjoyHats[i] = 0;
}
CONTROL_MouseButtonState1 = 0;
CONTROL_MouseButtonState2 = 0;
CONTROL_MouseDigitalAxisState1 = 0;
CONTROL_MouseDigitalAxisState2 = 0;
CONTROL_JoyButtonState1 = 0;
CONTROL_JoyButtonState2 = 0;
CONTROL_JoyHatState1 = 0;
CONTROL_JoyHatState2 = 0;
}
void CONTROL_Shutdown( void )
{
_joystick_deinit();
}
void CONTROL_MapAnalogAxis
(
int32 whichaxis,
int32 whichanalog
)
{
//STUBBED("CONTROL_MapAnalogAxis");
if(whichaxis < MAXJOYAXES)
{
JoyAxisMapping[whichaxis] = whichanalog;
}
}
// FIX_00019: DigitalAxis Handling now supported. (cool for medkit use)
void CONTROL_MapDigitalAxis
(
int32 whichaxis,
int32 whichfunction,
int32 direction
)
{
if(whichaxis < 0 || whichaxis >= MAXMOUSEAXES || direction < 0 || direction >= 2)
return;
MouseDigitalAxeMapping[whichaxis][direction] = whichfunction;
}
void CONTROL_SetAnalogAxisScale
(
int32 whichaxis,
float axisscale
)
{
if(whichaxis < MAXJOYAXES)
{
// Set it... make sure we don't let them set it to 0.. div by 0 is bad.
JoyAnalogScale[whichaxis] = (axisscale == 0) ? 1.0f : axisscale;
}
}
void CONTROL_SetAnalogAxisDeadzone
(
int32 whichaxis,
int32 axisdeadzone
)
{
if(whichaxis < MAXJOYAXES)
{
// Set it...
JoyAnalogDeadzone[whichaxis] = axisdeadzone;
}
}
int32 CONTROL_FilterDeadzone
(
int32 axisvalue,
int32 axisdeadzone
)
{
if((axisvalue < axisdeadzone) && (axisvalue > -axisdeadzone))
{
return 0;
}
return axisvalue;
}
int32 CONTROL_GetFilteredAxisValue(int32 axis)
{
return (int32)((float)CONTROL_FilterDeadzone
(
_joystick_axis(axis),
JoyAnalogDeadzone[axis]
)
* JoyAnalogScale[axis]
);
}
void CONTROL_PrintAxes( void )
{
STUBBED("CONTROL_PrintAxes");
}
boolean MOUSE_Init( void )
{
memset(MouseMapping,-1,sizeof(MouseMapping));
memset(MouseDigitalAxeMapping, -1, sizeof(MouseDigitalAxeMapping));
return true;
}
void MOUSE_Shutdown( void )
{
STUBBED("MOUSE_Shutdown");
}
void MOUSE_ShowCursor( void )
{
STUBBED("MOUSE_ShowCursor");
}
void MOUSE_HideCursor( void )
{
STUBBED("MOUSE_HideCursor");
}
static void updateMouse(void)
{
// this is in buildengine.
short x, y;
getmousevalues(&x, &y, &mouseButtons);
mouseRelativeX += x;
mouseRelativeY += y;
mousePositionX += x;
mousePositionY += y;
}
int32 MOUSE_GetButtons( void )
{
//updateMouse();
return ((int32) mouseButtons);
}
void MOUSE_GetPosition( int32*x, int32*y )
{
if (x) *x = mousePositionX;
if (y) *y = mousePositionY;
}
void MOUSE_GetDelta( int32*x, int32*y )
{
updateMouse();
if (x) *x = mouseRelativeX;
if (y) *y = mouseRelativeY;
mouseRelativeX = 0;
mouseRelativeY = 0;
}
void JOYSTICK_UpdateHats()
{
int i;
for(i=0; i<MAXJOYHATS; i++)
{
//for(j=0; j<8; j++)
//{
joyHats[i] = _joystick_hat(i);
//}
}
}
|