mirror of
https://github.com/nunuhara/xsystem4.git
synced 2026-10-01 11:28:01 +03:00
Fix DrawGraph.GetAlphaColor/SACT2.SP_GetAMapValue
Properly handle cases where the coordinate is outside of the sprite. Fixes an issue on the Haru Urare menu sceen.
This commit is contained in:
@@ -191,6 +191,12 @@ static void DrawGraph_CopyReverseAMapLR(int dst, int dx, int dy, int src, int sx
|
||||
|
||||
static bool DrawGraph_GetAlphaColor(int surface, int x, int y, int *a)
|
||||
{
|
||||
struct sact_sprite *sp = sact_get_sprite(surface);
|
||||
// NOTE: System40.exe errors here
|
||||
if (!sp)
|
||||
VM_ERROR("Invalid sprite index: %d", surface);
|
||||
if (x < 0 || x >= sp->rect.w || y < 0 || y >= sp->rect.h)
|
||||
return false;
|
||||
*a = sact_SP_GetAMapValue(surface, x, y);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -568,6 +568,8 @@ int sact_SP_GetAMapValue(int sp_no, int x, int y)
|
||||
{
|
||||
struct sact_sprite *sp = sact_get_sprite(sp_no);
|
||||
if (!sp) return 0;
|
||||
if (x < 0 || x >= sp->rect.w || y < 0 || y >= sp->rect.h)
|
||||
return -1;
|
||||
return sprite_get_amap_value(sp, x, y);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user