mirror of
https://github.com/libretro/RetroArch
synced 2025-03-31 10:20:41 +00:00
Cleanups
This commit is contained in:
parent
39279292ef
commit
cf3cdbbcc9
@ -333,25 +333,27 @@ static int16_t dinput_pressed_analog(struct dinput_input *di,
|
|||||||
static int16_t dinput_lightgun_aiming_state(
|
static int16_t dinput_lightgun_aiming_state(
|
||||||
struct dinput_input *di, unsigned idx, unsigned id)
|
struct dinput_input *di, unsigned idx, unsigned id)
|
||||||
{
|
{
|
||||||
const int edge_detect = 32700;
|
|
||||||
struct video_viewport vp;
|
struct video_viewport vp;
|
||||||
bool inside = false;
|
const int edge_detect = 32700;
|
||||||
int x = 0;
|
bool inside = false;
|
||||||
int y = 0;
|
int16_t res_x = 0;
|
||||||
int16_t res_x = 0;
|
int16_t res_y = 0;
|
||||||
int16_t res_y = 0;
|
int16_t res_screen_x = 0;
|
||||||
int16_t res_screen_x = 0;
|
int16_t res_screen_y = 0;
|
||||||
int16_t res_screen_y = 0;
|
|
||||||
unsigned num = 0;
|
|
||||||
|
|
||||||
struct pointer_status* check_pos = di->pointer_head.next;
|
int x = 0;
|
||||||
|
int y = 0;
|
||||||
|
unsigned num = 0;
|
||||||
|
|
||||||
vp.x = 0;
|
struct pointer_status
|
||||||
vp.y = 0;
|
*check_pos = di->pointer_head.next;
|
||||||
vp.width = 0;
|
|
||||||
vp.height = 0;
|
vp.x = 0;
|
||||||
vp.full_width = 0;
|
vp.y = 0;
|
||||||
vp.full_height = 0;
|
vp.width = 0;
|
||||||
|
vp.height = 0;
|
||||||
|
vp.full_width = 0;
|
||||||
|
vp.full_height = 0;
|
||||||
|
|
||||||
while (check_pos && num < idx)
|
while (check_pos && num < idx)
|
||||||
{
|
{
|
||||||
@ -372,17 +374,25 @@ static int16_t dinput_lightgun_aiming_state(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!(video_driver_translate_coord_viewport_wrap(
|
if (!(video_driver_translate_coord_viewport_wrap(
|
||||||
&vp, x, y, &res_x, &res_y, &res_screen_x, &res_screen_y)))
|
&vp, x, y,
|
||||||
|
&res_x, &res_y, &res_screen_x, &res_screen_y)))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
inside = (res_x >= -edge_detect) && (res_y >= -edge_detect) && (res_x <= edge_detect) && (res_y <= edge_detect);
|
inside = (res_x >= -edge_detect)
|
||||||
|
&& (res_y >= -edge_detect)
|
||||||
|
&& (res_x <= edge_detect)
|
||||||
|
&& (res_y <= edge_detect);
|
||||||
|
|
||||||
switch (id)
|
switch ( id )
|
||||||
{
|
{
|
||||||
case RETRO_DEVICE_ID_LIGHTGUN_SCREEN_X:
|
case RETRO_DEVICE_ID_LIGHTGUN_SCREEN_X:
|
||||||
return inside ? res_x : 0;
|
if (inside)
|
||||||
|
return res_x;
|
||||||
|
break;
|
||||||
case RETRO_DEVICE_ID_LIGHTGUN_SCREEN_Y:
|
case RETRO_DEVICE_ID_LIGHTGUN_SCREEN_Y:
|
||||||
return inside ? res_y : 0;
|
if (inside)
|
||||||
|
return res_y;
|
||||||
|
break;
|
||||||
case RETRO_DEVICE_ID_LIGHTGUN_IS_OFFSCREEN:
|
case RETRO_DEVICE_ID_LIGHTGUN_IS_OFFSCREEN:
|
||||||
return !inside;
|
return !inside;
|
||||||
default:
|
default:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user