mirror of
https://github.com/pret/pmd-red.git
synced 2026-10-01 21:38:41 -05:00
Merge pull request #479 from Kurausukun/ubfix
Some checks failed
GithubCI / build (push) Has been cancelled
Some checks failed
GithubCI / build (push) Has been cancelled
Add UBFIX Define and Standardize #ifdef vs #ifndef
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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;
|
||||
@@ -584,7 +584,7 @@ void TryResetDungeonMapTilesScheduledForCopy(void)
|
||||
dungeon->dungeonMap.tileScheduledForCopy[y][x] = FALSE;
|
||||
}
|
||||
}
|
||||
#endif // BUGFIX
|
||||
#endif // UBFIX
|
||||
dungeon->dungeonMap.resetTilesScheduledForCopy = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user