mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Change ControlState typedef to double, and change all related floats/doubles to use it.
Fixes an off by 1 issue related to double->float->double conversion, and eliminates numerous warnings.
This commit is contained in:
@ -43,7 +43,7 @@ static void DrawCenteredRectangle(wxDC &dc, int x, int y, int w, int h)
|
||||
|
||||
#define COORD_VIS_SIZE 4
|
||||
|
||||
static void DrawCoordinate(wxDC &dc, double x, double y)
|
||||
static void DrawCoordinate(wxDC &dc, ControlState x, ControlState y)
|
||||
{
|
||||
int xc = VIS_COORD(x);
|
||||
int yc = VIS_COORD(y);
|
||||
@ -60,7 +60,7 @@ static void DrawControlGroupBox(wxDC &dc, ControlGroupBox *g)
|
||||
{
|
||||
// this is starting to be a mess combining all these in one case
|
||||
|
||||
double x = 0, y = 0, z = 0;
|
||||
ControlState x = 0, y = 0, z = 0;
|
||||
|
||||
switch (g->control_group->type)
|
||||
{
|
||||
@ -103,7 +103,7 @@ static void DrawControlGroupBox(wxDC &dc, ControlGroupBox *g)
|
||||
dc.SetPen(LightGrayPen);
|
||||
|
||||
// polygon offset
|
||||
float max
|
||||
ControlState max
|
||||
, diagonal
|
||||
, box = 64
|
||||
, d_of = box / 256.0
|
||||
@ -111,18 +111,18 @@ static void DrawControlGroupBox(wxDC &dc, ControlGroupBox *g)
|
||||
|
||||
if (g->control_group->name == "Main Stick")
|
||||
{
|
||||
max = (87.0f / 127.0f) * 100;
|
||||
diagonal = (55.0f / 127.0f) * 100;
|
||||
max = (87.0 / 127.0) * 100;
|
||||
diagonal = (55.0 / 127.0) * 100;
|
||||
}
|
||||
else if (g->control_group->name == "C-Stick")
|
||||
{
|
||||
max = (74.0f / 127.0f) * 100;
|
||||
diagonal = (46.0f / 127.0f) * 100;
|
||||
max = (74.0 / 127.0) * 100;
|
||||
diagonal = (46.0 / 127.0) * 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
max = (82.0f / 127.0f) * 100;
|
||||
diagonal = (58.0f / 127.0f) * 100;
|
||||
max = (82.0 / 127.0) * 100;
|
||||
diagonal = (58.0 / 127.0) * 100;
|
||||
}
|
||||
|
||||
// polygon corners
|
||||
@ -153,7 +153,7 @@ static void DrawControlGroupBox(wxDC &dc, ControlGroupBox *g)
|
||||
|
||||
// raw dot
|
||||
{
|
||||
float xx, yy;
|
||||
ControlState xx, yy;
|
||||
xx = g->control_group->controls[3]->control_ref->State();
|
||||
xx -= g->control_group->controls[2]->control_ref->State();
|
||||
yy = g->control_group->controls[1]->control_ref->State();
|
||||
@ -177,9 +177,9 @@ static void DrawControlGroupBox(wxDC &dc, ControlGroupBox *g)
|
||||
break;
|
||||
case GROUP_TYPE_FORCE :
|
||||
{
|
||||
double raw_dot[3];
|
||||
double adj_dot[3];
|
||||
const float deadzone = g->control_group->settings[0]->value;
|
||||
ControlState raw_dot[3];
|
||||
ControlState adj_dot[3];
|
||||
const ControlState deadzone = g->control_group->settings[0]->value;
|
||||
|
||||
// adjusted
|
||||
((ControllerEmu::Force*)g->control_group)->GetState(adj_dot);
|
||||
@ -287,7 +287,7 @@ static void DrawControlGroupBox(wxDC &dc, ControlGroupBox *g)
|
||||
dc.SetPen(*wxGREY_PEN);
|
||||
ControlState deadzone = g->control_group->settings[0]->value;
|
||||
|
||||
double* const trigs = new double[trigger_count];
|
||||
ControlState* const trigs = new ControlState[trigger_count];
|
||||
((ControllerEmu::Triggers*)g->control_group)->GetState(trigs);
|
||||
|
||||
for (unsigned int n = 0; n < trigger_count; ++n)
|
||||
@ -363,7 +363,7 @@ static void DrawControlGroupBox(wxDC &dc, ControlGroupBox *g)
|
||||
dc.SetBrush(*wxGREY_BRUSH);
|
||||
dc.DrawRectangle(31 + state * 30, 0, 2, 14);
|
||||
|
||||
double adj_state;
|
||||
ControlState adj_state;
|
||||
((ControllerEmu::Slider*)g->control_group)->GetState(&adj_state);
|
||||
if (state)
|
||||
{
|
||||
|
Reference in New Issue
Block a user