Fix L and R triggers with tas input.

Partially copied from revision 1be844406c, but allows < fully pressed, and without the typo.
This commit is contained in:
Rachel Bryk 2013-07-23 19:24:05 -04:00
parent 09338c673c
commit 9fdc7360cd
2 changed files with 49 additions and 16 deletions

View File

@ -31,7 +31,7 @@ TASInputDlg::TASInputDlg(wxWindow *parent, wxWindowID id, const wxString &title,
{
A_turbo = B_turbo = X_turbo = Y_turbo = Z_turbo = L_turbo = R_turbo = START_turbo = DL_turbo = DR_turbo = DD_turbo = DU_turbo = false;
xaxis = yaxis = c_xaxis = c_yaxis = 128;
A_cont = B_cont = X_cont = Y_cont = Z_cont = L_cont = R_cont = START_cont = DL_cont = DR_cont = DD_cont = DU_cont = mstickx = msticky = cstickx = csticky = false;
A_cont = B_cont = X_cont = Y_cont = Z_cont = L_cont = L_button_cont = R_cont = R_button_cont = START_cont = DL_cont = DR_cont = DD_cont = DU_cont = mstickx = msticky = cstickx = csticky = false;
wxBoxSizer* const top_box = new wxBoxSizer(wxHORIZONTAL);
wxBoxSizer* const bottom_box = new wxBoxSizer(wxHORIZONTAL);
@ -364,25 +364,53 @@ void TASInputDlg::GetKeyBoardInput(SPADStatus *PadStatus)
Y_cont = false;
}
if(((PadStatus->button & PAD_TRIGGER_L) != 0))
if(((PadStatus->triggerLeft) != 0))
{
wx_l_button->SetValue(true);
if (PadStatus->triggerLeft == 255)
{
wx_l_button->SetValue(true);
L_button_cont = true;
}
else if (L_slider_cont)
{
wx_l_button->SetValue(false);
L_button_cont = false;
}
wx_l_s->SetValue(PadStatus->triggerLeft);
wx_l_t->SetValue(wxString::Format(wxT("%i"), PadStatus->triggerLeft));
L_cont = true;
}
else if(L_cont)
{
wx_l_button->SetValue(false);
wx_l_s->SetValue(0);
wx_l_t->SetValue(wxT("0"));
L_cont = false;
}
if(((PadStatus->button & PAD_TRIGGER_R) != 0))
if(((PadStatus->triggerRight) != 0))
{
wx_r_button->SetValue(true);
if (PadStatus->triggerRight == 255)
{
wx_r_button->SetValue(true);
R_button_cont = true;
}
else if (R_button_cont)
{
wx_r_button->SetValue(false);
R_button_cont = false;
}
wx_r_s->SetValue(PadStatus->triggerRight);
wx_r_t->SetValue(wxString::Format(wxT("%i"), PadStatus->triggerRight));
R_cont = true;
}
else if(R_cont)
{
wx_r_button->SetValue(false);
wx_r_s->SetValue(0);
wx_r_t->SetValue(wxT("0"));
R_cont = false;
}
@ -409,6 +437,19 @@ void TASInputDlg::GetKeyBoardInput(SPADStatus *PadStatus)
}
}
void TASInputDlg::SetLandRTriggers()
{
if (wx_l_button->GetValue())
lTrig = 255;
else
lTrig = wx_l_s->GetValue();
if (wx_r_button->GetValue())
rTrig = 255;
else
rTrig = wx_r_s->GetValue();
}
void TASInputDlg::GetValues(SPADStatus *PadStatus, int controllerID)
{
if (!IsShown())
@ -416,6 +457,7 @@ void TASInputDlg::GetValues(SPADStatus *PadStatus, int controllerID)
//TODO:: Make this instant not when polled.
GetKeyBoardInput(PadStatus);
SetLandRTriggers();
// TODO: implement support for more controllers
if (controllerID != 0)
@ -480,16 +522,6 @@ void TASInputDlg::GetValues(SPADStatus *PadStatus, int controllerID)
else
PadStatus->button &= ~PAD_BUTTON_Y;
if(wx_l_button->IsChecked())
PadStatus->button |= PAD_TRIGGER_L;
else
PadStatus->button &= ~PAD_TRIGGER_L;
if(wx_r_button->IsChecked())
PadStatus->button |= PAD_TRIGGER_R;
else
PadStatus->button &= ~PAD_TRIGGER_R;
if(wx_z_button->IsChecked())
PadStatus->button |= PAD_TRIGGER_Z;
else

View File

@ -33,6 +33,7 @@ class TASInputDlg : public wxDialog
void ButtonTurbo();
void GetKeyBoardInput(SPADStatus *PadStatus);
bool TextBoxHasFocus();
void SetLandRTriggers();
bool HasFocus();
wxBitmap CreateStickBitmap(int x, int y);
@ -78,7 +79,7 @@ class TASInputDlg : public wxDialog
wxStaticBitmap* static_bitmap_main, *static_bitmap_c;
wxBitmap bitmap;
bool A_turbo,B_turbo, X_turbo, Y_turbo, Z_turbo, L_turbo, R_turbo, START_turbo,DL_turbo,DR_turbo,DD_turbo,DU_turbo;
bool A_cont,B_cont, X_cont, Y_cont, Z_cont, L_cont, R_cont, START_cont,DL_cont,DR_cont,DD_cont,DU_cont,mstickx,msticky,cstickx,csticky;
bool A_cont,B_cont, X_cont, Y_cont, Z_cont, L_cont, L_button_cont, R_cont, R_button_cont, START_cont,DL_cont,DR_cont,DD_cont,DU_cont,mstickx,msticky,cstickx,csticky;
int xaxis,yaxis,c_xaxis,c_yaxis,update,update_axis;
DECLARE_EVENT_TABLE();