summaryrefslogtreecommitdiff
path: root/src/Pad.cpp
blob: 869c4d488aa7befa7adb8e13a17e972f2a8dac1d (plain)
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
#include "common.h"
#include "patcher.h"
#include "Pad.h"

CPad *CPad::Pads = (CPad*)0x6F0360;

uint16 *CPad::OldKeyState = (uint16*)0x6F1E70;
uint16 *CPad::NewKeyState = (uint16*)0x6E60D0;
uint16 *CPad::TempKeyState = (uint16*)0x774DE8;

CMouseControllerState &CPad::OldMouseControllerState = *(CMouseControllerState*)0x8472A0;
CMouseControllerState &CPad::NewMouseControllerState = *(CMouseControllerState*)0x8809F0;
CMouseControllerState &CPad::PCTempMouseControllerState = *(CMouseControllerState*)0x6F1E60;

WRAPPER void CPad::PrintErrorMessage(void) { EAXJMP(0x4942B0); }

void
CControllerState::Clear(void)
{
	LeftStickX = 0;
	LeftStickY = 0;
	RightStickX = 0;
	RightStickY = 0;
	LeftShoulder1 = 0;
	LeftShoulder2 = 0;
	RightShoulder1 = 0;
	RightShoulder2 = 0;
	DPadUp = 0;
	DPadDown = 0;
	DPadLeft = 0;
	DPadRight = 0;
	Start = 0;
	Select = 0;
	Square = 0;
	Triangle = 0;
	Cross = 0;
	Circle = 0;
	LeftShock = 0;
	RightShock = 0;
	NetworkTalk = 0;
}

bool
CPad::ForceCameraBehindPlayer(void)
{
	if(DisablePlayerControls)
		return false;
	switch(Mode){
	case 0:
	case 1:
		return !!NewState.LeftShoulder1;
	case 2:
		return !!NewState.Triangle;
	case 3:
		return !!NewState.Circle;
	}
	return false;
}

bool
CPad::GetWeapon(void)
{
	if(DisablePlayerControls)
		return false;
	switch(Mode){
	case 0:
	case 1:
		return !!NewState.Circle;
	case 2:
		return !!NewState.Cross;
	case 3:
		return !!NewState.RightShoulder1;
	}
	return false;
}

bool
CPad::GetLookBehindForCar(void)
{
	if(DisablePlayerControls)
		return false;
	return NewState.LeftShoulder2 && NewState.RightShoulder2;
}

bool
CPad::GetLookBehindForPed(void)
{
	if(DisablePlayerControls)
		return false;
	return !!NewState.RightShock;
}

bool
CPad::GetLookLeft(void)
{
	if(DisablePlayerControls)
		return false;
	return !!NewState.LeftShoulder2;
}

bool
CPad::GetLookRight(void)
{
	if(DisablePlayerControls)
		return false;
	return !!NewState.RightShoulder2;
}