Wing Commander II
Reconstructed Win32 source (1996)
Toggle main menu visibility
Loading...
Searching...
No Matches
joystick.c
Go to the documentation of this file.
1
/*
2
* Joystick sampling.
3
*
4
* Retail object 0x44F1F0-0x44F2FF (link order; see docs/ORDER.md).
5
*/
6
#include "
game.h
"
7
8
/* Function start: 0x44F1F0 */
9
short
SampleBothJoysticks
(
InputDeviceSample
*samples,
10
unsigned
int
fallback)
11
{
12
GetJoystickPosition
((
unsigned
int
*)&samples[0].x,
13
(
unsigned
int
*)&samples[0].y,
14
(
int
*)&samples[0].buttons, 0, fallback);
15
GetJoystickPosition
((
unsigned
int
*)&samples[1].x,
16
(
unsigned
int
*)&samples[1].y,
17
(
int
*)&samples[1].buttons, 1, fallback);
18
return
1;
19
}
20
21
/* Function start: 0x44F247 */
22
void
SampleJoystickDevice
(
InputDeviceSample
*samples,
short
joystick,
23
unsigned
int
fallback)
24
{
25
short
sampleIndex;
26
27
sampleIndex = 0;
28
if
(joystick != 0)
29
sampleIndex = 1;
30
else
31
sampleIndex = 0;
32
GetJoystickPosition
(
33
(
unsigned
int
*)&samples[sampleIndex].x,
34
(
unsigned
int
*)&samples[sampleIndex].y,
35
(
int
*)&samples[sampleIndex].buttons, joystick, fallback);
36
}
37
38
/* Function start: 0x44F2B8 */
39
/* Nothing in the shipped executable calls this. */
40
short
ReadJoystickButtons
(
void
)
41
{
42
return
GetJoystickButtons
();
43
}
44
45
/* Function start: 0x44F2CD */
46
/* Nothing in the shipped executable calls this. Samples the active input
47
* device into its own sample slot. */
48
void
SampleActiveJoystickDevice
(
void
)
49
{
50
SampleJoystickDevice
(&
g_aInputDeviceSamplesList
[
51
g_8_nActiveInputDeviceWord
],
52
g_8_nActiveInputDeviceWord
, 0);
53
}
54
55
/* Linker commons defined here. LINK lays a unit's commons out by the
56
* identifiers' hash keys, so these spellings follow the original addresses. */
57
short
g_8_nActiveInputDeviceWord
;
/* 0x005d1726 */
58
int
g_nControllerVerticalDeadZoneWord
;
/* 0x005d1728 */
59
int
g_nJoystickHorizDeadZone
;
/* 0x005d172c */
60
int
g_26_nUnusedControllerNumber
[3];
/* 0x005d1730 */
/* never referenced */
61
int
g_59_nJoystickUpScaleWord
;
/* 0x005d173c */
62
int
g_12_nControllerLeftScaleValue
;
/* 0x005d1740 */
63
int
g_4_nJoystickMaximumXValue
;
/* 0x005d1744 */
64
int
g_nJoystickMaximumY
;
/* 0x005d1748 */
65
int
g_12_nJoystickMinimumXNumber
;
/* 0x005d174c */
66
int
g_2_nJsMinimumY
;
/* 0x005d1750 */
67
int
g_nJoystickVerticalRangeNumber
;
/* 0x005d1754 */
68
int
g_3_nControllerHorizontalRange
;
/* 0x005d1758 */
69
int
g_1_nJsRightScaleWord
;
/* 0x005d175c */
70
int
g_12_nJoystickDownScaleWord
;
/* 0x005d1760 */
71
int
g_2_nJoystickCentreY
;
/* 0x005d1764 */
72
int
g_1_nJoystickCentreXNumber
;
/* 0x005d1768 */
73
int
g_4_nControllerFailureValue
;
/* 0x005d176c */
74
char
g_nUnusedJsWord
;
/* 0x005d1770 */
/* never referenced */
75
InputDeviceSample
g_aInputDeviceSamplesList
[2];
/* 0x005d1780 */
76
short
g_3_nFlightControlCommandValue
;
/* 0x005d1798 */
77
char
g_16_nUnusedJoystickWord
;
/* 0x005d179a */
/* never referenced */
GetJoystickPosition
void GetJoystickPosition(unsigned int *x, unsigned int *y, int *buttons, unsigned short joystick, unsigned int fallback)
Definition
winmain.c:657
SampleBothJoysticks
short SampleBothJoysticks(InputDeviceSample *samples, unsigned int fallback)
Definition
joystick.c:9
GetJoystickButtons
short GetJoystickButtons(void)
Definition
winmain.c:706
SampleJoystickDevice
void SampleJoystickDevice(InputDeviceSample *samples, short joystick, unsigned int fallback)
Definition
joystick.c:22
SampleActiveJoystickDevice
void SampleActiveJoystickDevice(void)
Definition
joystick.c:48
ReadJoystickButtons
short ReadJoystickButtons(void)
Definition
joystick.c:40
game.h
Shared Win32 declarations, types and library interfaces.
g_3_nFlightControlCommandValue
short g_3_nFlightControlCommandValue
Definition
joystick.c:76
g_nControllerVerticalDeadZoneWord
int g_nControllerVerticalDeadZoneWord
Definition
joystick.c:58
g_12_nJoystickDownScaleWord
int g_12_nJoystickDownScaleWord
Definition
joystick.c:70
g_12_nControllerLeftScaleValue
int g_12_nControllerLeftScaleValue
Definition
joystick.c:62
g_4_nJoystickMaximumXValue
int g_4_nJoystickMaximumXValue
Definition
joystick.c:63
g_1_nJoystickCentreXNumber
int g_1_nJoystickCentreXNumber
Definition
joystick.c:72
g_2_nJsMinimumY
int g_2_nJsMinimumY
Definition
joystick.c:66
g_1_nJsRightScaleWord
int g_1_nJsRightScaleWord
Definition
joystick.c:69
g_aInputDeviceSamplesList
InputDeviceSample g_aInputDeviceSamplesList[2]
Definition
joystick.c:75
g_nJoystickVerticalRangeNumber
int g_nJoystickVerticalRangeNumber
Definition
joystick.c:67
g_2_nJoystickCentreY
int g_2_nJoystickCentreY
Definition
joystick.c:71
g_8_nActiveInputDeviceWord
short g_8_nActiveInputDeviceWord
Definition
joystick.c:57
g_nJoystickHorizDeadZone
int g_nJoystickHorizDeadZone
Definition
joystick.c:59
g_4_nControllerFailureValue
int g_4_nControllerFailureValue
Definition
joystick.c:73
g_3_nControllerHorizontalRange
int g_3_nControllerHorizontalRange
Definition
joystick.c:68
g_12_nJoystickMinimumXNumber
int g_12_nJoystickMinimumXNumber
Definition
joystick.c:65
g_59_nJoystickUpScaleWord
int g_59_nJoystickUpScaleWord
Definition
joystick.c:61
g_nJoystickMaximumY
int g_nJoystickMaximumY
Definition
joystick.c:64
g_nUnusedJsWord
char g_nUnusedJsWord
Definition
joystick.c:74
g_16_nUnusedJoystickWord
char g_16_nUnusedJoystickWord
Definition
joystick.c:77
g_26_nUnusedControllerNumber
int g_26_nUnusedControllerNumber[3]
Definition
joystick.c:60
InputDeviceSample
Definition
game.h:221
src
joystick.c
Generated by
1.18.0