From 54842f50dbaeac18ef8fa1eaf68cdfffa80efc31 Mon Sep 17 00:00:00 2001 From: fgsfds Date: Fri, 22 Sep 2023 21:06:32 +0200 Subject: [PATCH] port: another UB fix in bg.c --- src/game/bg.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/game/bg.c b/src/game/bg.c index 1ee68c305..20219795a 100644 --- a/src/game/bg.c +++ b/src/game/bg.c @@ -4378,7 +4378,11 @@ bool bgTestHitInVtxBatch(struct coord *arg0, struct coord *arg1, struct coord *a texturenum = *(s16 *) PHYS_TO_K0(tmp); } +#ifdef AVOID_UB + if (batch->type == VTXBATCHTYPE_XLU && texturenum >= 0 && g_Textures[texturenum].surfacetype == SURFACETYPE_DEFAULT) { +#else if (batch->type == VTXBATCHTYPE_XLU && g_Textures[texturenum].surfacetype == SURFACETYPE_DEFAULT) { +#endif hit = false; }