add UBFIX define

This commit is contained in:
Kurausukun 2026-04-29 12:26:18 -04:00
parent 808ad38ebe
commit 2fffa96dec
3 changed files with 13 additions and 7 deletions

View File

@ -60,8 +60,14 @@ static inline bool8 AreStringsDifferent(const u8 *str1, const u8 *str2)
return strcmp(str1, str2) != 0;
}
#ifdef BUGFIX
#ifndef UBFIX
#define UBFIX
#endif
#endif
#ifdef MODERN
#define BUGFIX
#define UBFIX
#define NONMATCHING
#include "mini_printf.h"

View File

@ -2480,17 +2480,17 @@ static s32 ExecuteScriptCommand(Action *action)
// making the target position nonsense. But even if they were correct,
// the way the cap is calculated would make the random offset biased off-center.
// This doesn't affect the released version because these script commands are never used.
#ifndef BUGFIX
#ifdef BUGFIX
action->callbacks->getHitboxCenter(action->parentObject, &scriptData->pos1);
scriptData->pos2.x = scriptData->pos1.x + ((OtherRandInt(curCmd.arg1 * 2 + 1) - curCmd.arg1) << 8);
scriptData->pos2.y = scriptData->pos1.y + ((OtherRandInt(curCmd.arg2 * 2 + 1) - curCmd.arg2) << 8);
#else
s32 cap1 = curCmd.arg1 * 2 - 1;
s32 cap2 = curCmd.arg2 * 2 - 1;
action->callbacks->getHitboxCenter(action->parentObject, &scriptData->pos1);
scriptData->pos2.x = scriptData->pos1.x + ((OtherRandInt(cap1) - curCmd.argShort) << 8);
scriptData->pos2.y = scriptData->pos1.y + ((OtherRandInt(cap2) - curCmd.arg1) << 8);
#else
action->callbacks->getHitboxCenter(action->parentObject, &scriptData->pos1);
scriptData->pos2.x = scriptData->pos1.x + ((OtherRandInt(curCmd.arg1 * 2 + 1) - curCmd.arg1) << 8);
scriptData->pos2.y = scriptData->pos1.y + ((OtherRandInt(curCmd.arg2 * 2 + 1) - curCmd.arg2) << 8);
#endif
if (curCmd.op == CMD_BYTE_7F || curCmd.op == CMD_BYTE_85) {
scriptData->unk2A = HYPOT;

View File

@ -1177,7 +1177,7 @@ void sub_80089AC(const WindowTemplate *r4, DungeonPos *r5_Str)
// BUG: The background array is 161 entries long, but this function will potentially write
// up to index 160 + 12 = 172, overflowing the array.
#ifdef BUGFIX
#ifdef UBFIX
if (r5 > 160 - 12) {
r5 = 160 - 12;
}