mirror of
https://github.com/libretro/RetroArch
synced 2025-04-09 21:45:45 +00:00
Overlays: Ignore hitboxes with zero area (#14619)
I.e. Set 'reach_x' or 'reach_y' to zero to ensure no hitbox math is done nits
This commit is contained in:
parent
6c05f4794c
commit
3de186e374
@ -1408,6 +1408,8 @@ static bool inside_hitbox(const struct overlay_desc *desc, float x, float y)
|
|||||||
return
|
return
|
||||||
(fabs(x - desc->x_hitbox) <= desc->range_x_mod) &&
|
(fabs(x - desc->x_hitbox) <= desc->range_x_mod) &&
|
||||||
(fabs(y - desc->y_hitbox) <= desc->range_y_mod);
|
(fabs(y - desc->y_hitbox) <= desc->range_y_mod);
|
||||||
|
case OVERLAY_HITBOX_NONE:
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,8 @@ typedef struct video_overlay_interface
|
|||||||
enum overlay_hitbox
|
enum overlay_hitbox
|
||||||
{
|
{
|
||||||
OVERLAY_HITBOX_RADIAL = 0,
|
OVERLAY_HITBOX_RADIAL = 0,
|
||||||
OVERLAY_HITBOX_RECT
|
OVERLAY_HITBOX_RECT,
|
||||||
|
OVERLAY_HITBOX_NONE
|
||||||
};
|
};
|
||||||
|
|
||||||
enum overlay_type
|
enum overlay_type
|
||||||
|
@ -237,7 +237,6 @@ static bool task_overlay_load_desc(
|
|||||||
char overlay_desc_normalized_key[32];
|
char overlay_desc_normalized_key[32];
|
||||||
char overlay[256];
|
char overlay[256];
|
||||||
float tmp_float = 0.0f;
|
float tmp_float = 0.0f;
|
||||||
int tmp_int = 0;
|
|
||||||
bool tmp_bool = false;
|
bool tmp_bool = false;
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
bool by_pixel = false;
|
bool by_pixel = false;
|
||||||
@ -444,6 +443,10 @@ static bool task_overlay_load_desc(
|
|||||||
desc->reach_down = tmp_float;
|
desc->reach_down = tmp_float;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( (desc->reach_left == 0.0f && desc->reach_right == 0.0f)
|
||||||
|
|| (desc->reach_up == 0.0f && desc->reach_down == 0.0f))
|
||||||
|
desc->hitbox = OVERLAY_HITBOX_NONE;
|
||||||
|
|
||||||
desc->mod_x = desc->x - desc->range_x;
|
desc->mod_x = desc->x - desc->range_x;
|
||||||
desc->mod_w = 2.0f * desc->range_x;
|
desc->mod_w = 2.0f * desc->range_x;
|
||||||
desc->mod_y = desc->y - desc->range_y;
|
desc->mod_y = desc->y - desc->range_y;
|
||||||
@ -464,12 +467,14 @@ static bool task_overlay_load_desc(
|
|||||||
snprintf(conf_key, sizeof(conf_key),
|
snprintf(conf_key, sizeof(conf_key),
|
||||||
"overlay%u_desc%u_exclusive", ol_idx, desc_idx);
|
"overlay%u_desc%u_exclusive", ol_idx, desc_idx);
|
||||||
desc->exclusive = false;
|
desc->exclusive = false;
|
||||||
config_get_bool(conf, conf_key, &desc->exclusive);
|
if (config_get_bool(conf, conf_key, &tmp_bool))
|
||||||
|
desc->exclusive = tmp_bool;
|
||||||
|
|
||||||
snprintf(conf_key, sizeof(conf_key),
|
snprintf(conf_key, sizeof(conf_key),
|
||||||
"overlay%u_desc%u_range_mod_exclusive", ol_idx, desc_idx);
|
"overlay%u_desc%u_range_mod_exclusive", ol_idx, desc_idx);
|
||||||
desc->range_mod_exclusive = false;
|
desc->range_mod_exclusive = false;
|
||||||
config_get_bool(conf, conf_key, &desc->range_mod_exclusive);
|
if (config_get_bool(conf, conf_key, &tmp_bool))
|
||||||
|
desc->range_mod_exclusive = tmp_bool;
|
||||||
|
|
||||||
snprintf(conf_key, sizeof(conf_key),
|
snprintf(conf_key, sizeof(conf_key),
|
||||||
"overlay%u_desc%u_movable", ol_idx, desc_idx);
|
"overlay%u_desc%u_movable", ol_idx, desc_idx);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user