Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion include/global.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions src/dungeon_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ void TryResetDungeonMapTilesScheduledForCopy(void)
s32 x, y;
Dungeon *dungeon = gDungeon;
if (dungeon->dungeonMap.resetTilesScheduledForCopy) {
#ifdef BUGFIX
#ifdef UBFIX
for (y = 0; y < DUNGEON_MAP_MAX_Y; y++) {
for (x = 0; x < DUNGEON_MAP_MAX_X; x++) {
dungeon->dungeonMap.tileScheduledForCopy[y][x] = FALSE;
Expand All @@ -584,7 +584,7 @@ void TryResetDungeonMapTilesScheduledForCopy(void)
dungeon->dungeonMap.tileScheduledForCopy[y][x] = FALSE;
}
}
#endif // BUGFIX
#endif // UBFIX
dungeon->dungeonMap.resetTilesScheduledForCopy = FALSE;
}
}
10 changes: 5 additions & 5 deletions src/ground_script.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/text_2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down