- code shrink

This commit is contained in:
michniewski 2008-10-18 21:05:21 +00:00
parent 12a7c1cec2
commit d0ddc94113

View File

@ -297,35 +297,15 @@ void decodepad (int pad)
// Is XY inside the "zone"? // Is XY inside the "zone"?
if (wm_ax * wm_ax + wm_ay * wm_ay > PADCAL * PADCAL) if (wm_ax * wm_ax + wm_ay * wm_ay > PADCAL * PADCAL)
{ {
/*** we don't want division by zero ***/
if (wm_ax > 0 && wm_ay == 0) if (wm_ax > 0 && wm_ay == 0)
{ wp |= (exp_type == WPAD_EXP_CLASSIC) ? WPAD_CLASSIC_BUTTON_RIGHT : WPAD_BUTTON_RIGHT;
if(exp_type == WPAD_EXP_CLASSIC)
wp |= WPAD_CLASSIC_BUTTON_RIGHT;
else
wp |= WPAD_BUTTON_RIGHT;
}
if (wm_ax < 0 && wm_ay == 0) if (wm_ax < 0 && wm_ay == 0)
{ wp |= (exp_type == WPAD_EXP_CLASSIC) ? WPAD_CLASSIC_BUTTON_LEFT : WPAD_BUTTON_LEFT;
if(exp_type == WPAD_EXP_CLASSIC)
wp |= WPAD_CLASSIC_BUTTON_LEFT;
else
wp |= WPAD_BUTTON_LEFT;
}
if (wm_ax == 0 && wm_ay > 0) if (wm_ax == 0 && wm_ay > 0)
{ wp |= (exp_type == WPAD_EXP_CLASSIC) ? WPAD_CLASSIC_BUTTON_UP : WPAD_BUTTON_UP;
if(exp_type == WPAD_EXP_CLASSIC)
wp |= WPAD_CLASSIC_BUTTON_UP;
else
wp |= WPAD_BUTTON_UP;
}
if (wm_ax == 0 && wm_ay < 0) if (wm_ax == 0 && wm_ay < 0)
{ wp |= (exp_type == WPAD_EXP_CLASSIC) ? WPAD_CLASSIC_BUTTON_DOWN : WPAD_BUTTON_DOWN;
if(exp_type == WPAD_EXP_CLASSIC)
wp |= WPAD_CLASSIC_BUTTON_DOWN;
else
wp |= WPAD_BUTTON_DOWN;
}
if (wm_ax != 0 && wm_ay != 0) if (wm_ax != 0 && wm_ay != 0)
{ {
@ -335,17 +315,11 @@ void decodepad (int pad)
{ {
if (wm_ax >= 0) if (wm_ax >= 0)
{ {
if(exp_type == WPAD_EXP_CLASSIC) wp |= (exp_type == WPAD_EXP_CLASSIC) ? WPAD_CLASSIC_BUTTON_RIGHT : WPAD_BUTTON_RIGHT;
wp |= WPAD_CLASSIC_BUTTON_RIGHT;
else
wp |= WPAD_BUTTON_RIGHT;
} }
else else
{ {
if(exp_type == WPAD_EXP_CLASSIC) wp |= (exp_type == WPAD_EXP_CLASSIC) ? WPAD_CLASSIC_BUTTON_LEFT : WPAD_BUTTON_LEFT;
wp |= WPAD_CLASSIC_BUTTON_LEFT;
else
wp |= WPAD_BUTTON_LEFT;
} }
} }
@ -355,17 +329,11 @@ void decodepad (int pad)
{ {
if (wm_ay >= 0) if (wm_ay >= 0)
{ {
if(exp_type == WPAD_EXP_CLASSIC) wp |= (exp_type == WPAD_EXP_CLASSIC) ? WPAD_CLASSIC_BUTTON_UP : WPAD_BUTTON_UP;
wp |= WPAD_CLASSIC_BUTTON_UP;
else
wp |= WPAD_BUTTON_UP;
} }
else else
{ {
if(exp_type == WPAD_EXP_CLASSIC) wp |= (exp_type == WPAD_EXP_CLASSIC) ? WPAD_CLASSIC_BUTTON_DOWN : WPAD_BUTTON_DOWN;
wp |= WPAD_CLASSIC_BUTTON_DOWN;
else
wp |= WPAD_BUTTON_DOWN;
} }
} }
} }