GCPadStatus: coalescing magic numbers into consts
This commit is contained in:
parent
38d5197a2c
commit
0d2bef2743
|
@ -58,10 +58,10 @@ void GetStatus(u8 _numPAD, GCPadStatus* _pPADStatus)
|
|||
{
|
||||
// if gui has lock (messing with controls), skip this input cycle
|
||||
// center axes and return
|
||||
_pPADStatus->stickX = 0x80;
|
||||
_pPADStatus->stickY = 0x80;
|
||||
_pPADStatus->substickX = 0x80;
|
||||
_pPADStatus->substickY = 0x80;
|
||||
_pPADStatus->stickX = GCPadStatus::MAIN_STICK_CENTER_X;
|
||||
_pPADStatus->stickY = GCPadStatus::MAIN_STICK_CENTER_Y;
|
||||
_pPADStatus->substickX = GCPadStatus::C_STICK_CENTER_X;
|
||||
_pPADStatus->substickY = GCPadStatus::C_STICK_CENTER_Y;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -103,12 +103,12 @@ void GCPad::GetInput(GCPadStatus* const pad)
|
|||
|
||||
// sticks
|
||||
m_main_stick->GetState(&x, &y);
|
||||
pad->stickX = 0x80 + (x * 0x7F);
|
||||
pad->stickY = 0x80 + (y * 0x7F);
|
||||
pad->stickX = GCPadStatus::MAIN_STICK_CENTER_X + (x * GCPadStatus::MAIN_STICK_RADIUS);
|
||||
pad->stickY = GCPadStatus::MAIN_STICK_CENTER_Y + (y * GCPadStatus::MAIN_STICK_RADIUS);
|
||||
|
||||
m_c_stick->GetState(&x, &y);
|
||||
pad->substickX = 0x80 + (x * 0x7F);
|
||||
pad->substickY = 0x80 + (y * 0x7F);
|
||||
pad->substickX = GCPadStatus::C_STICK_CENTER_X + (x * GCPadStatus::C_STICK_RADIUS);
|
||||
pad->substickY = GCPadStatus::C_STICK_CENTER_Y + (y * GCPadStatus::C_STICK_RADIUS);
|
||||
|
||||
// triggers
|
||||
m_triggers->GetState(&pad->button, trigger_bitmasks, triggers);
|
||||
|
|
|
@ -244,7 +244,7 @@ void TASInputDlg::ResetValues()
|
|||
|
||||
void TASInputDlg::GetKeyBoardInput(GCPadStatus* PadStatus)
|
||||
{
|
||||
if (PadStatus->stickX != 128)
|
||||
if (PadStatus->stickX != GCPadStatus::MAIN_STICK_CENTER_X)
|
||||
{
|
||||
mainX = PadStatus->stickX;
|
||||
mstickx = true;
|
||||
|
@ -254,11 +254,11 @@ void TASInputDlg::GetKeyBoardInput(GCPadStatus* PadStatus)
|
|||
else if (mstickx)
|
||||
{
|
||||
mstickx = false;
|
||||
mainX = 128;
|
||||
mainX = GCPadStatus::MAIN_STICK_CENTER_X;
|
||||
wx_mainX_t->SetValue(wxString::Format("%i", mainX));
|
||||
}
|
||||
|
||||
if (PadStatus->stickY != 128)
|
||||
if (PadStatus->stickY != GCPadStatus::MAIN_STICK_CENTER_Y)
|
||||
{
|
||||
mainY = PadStatus->stickY;
|
||||
msticky = true;
|
||||
|
@ -267,11 +267,11 @@ void TASInputDlg::GetKeyBoardInput(GCPadStatus* PadStatus)
|
|||
else if (msticky)
|
||||
{
|
||||
msticky = false;
|
||||
mainY = 128;
|
||||
mainY = GCPadStatus::MAIN_STICK_CENTER_Y;
|
||||
wx_mainY_t->SetValue(wxString::Format("%i", mainY));
|
||||
}
|
||||
|
||||
if (PadStatus->substickX != 128)
|
||||
if (PadStatus->substickX != GCPadStatus::C_STICK_CENTER_X)
|
||||
{
|
||||
cX = PadStatus->substickX;
|
||||
cstickx = true;
|
||||
|
@ -280,11 +280,11 @@ void TASInputDlg::GetKeyBoardInput(GCPadStatus* PadStatus)
|
|||
else if (cstickx)
|
||||
{
|
||||
cstickx = false;
|
||||
cX = 128;
|
||||
cX = GCPadStatus::C_STICK_CENTER_X;
|
||||
wx_cX_t->SetValue(wxString::Format("%i", cX));
|
||||
}
|
||||
|
||||
if (PadStatus->substickY != 128)
|
||||
if (PadStatus->substickY != GCPadStatus::C_STICK_CENTER_Y)
|
||||
{
|
||||
cY = PadStatus->substickY;
|
||||
csticky = true;
|
||||
|
@ -293,7 +293,7 @@ void TASInputDlg::GetKeyBoardInput(GCPadStatus* PadStatus)
|
|||
else if (csticky)
|
||||
{
|
||||
csticky = false;
|
||||
cY = 128;
|
||||
cY = GCPadStatus::C_STICK_CENTER_Y;
|
||||
wx_cY_t->SetValue(wxString::Format("%i", cY));
|
||||
}
|
||||
|
||||
|
|
|
@ -45,4 +45,11 @@ struct GCPadStatus
|
|||
unsigned char analogA; // 0 <= analogA <= 255
|
||||
unsigned char analogB; // 0 <= analogB <= 255
|
||||
signed char err; // one of PAD_ERR_* number
|
||||
|
||||
static const u8 MAIN_STICK_CENTER_X = 0x80;
|
||||
static const u8 MAIN_STICK_CENTER_Y = 0x80;
|
||||
static const u8 MAIN_STICK_RADIUS = 0x7f;
|
||||
static const u8 C_STICK_CENTER_X = 0x80;
|
||||
static const u8 C_STICK_CENTER_Y = 0x80;
|
||||
static const u8 C_STICK_RADIUS = 0x7f;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue