Drop some overworld prefixes

This commit is contained in:
GriffinR
2021-11-15 10:57:22 -05:00
parent 65d3b58374
commit c1130592fa
8 changed files with 64 additions and 70 deletions
+4 -4
View File
@@ -67,8 +67,8 @@ void SetGameStat(u8 index, u32 value);
void ApplyNewEncryptionKeyToGameStats(u32 newKey); void ApplyNewEncryptionKeyToGameStats(u32 newKey);
void LoadObjEventTemplatesFromHeader(void); void LoadObjEventTemplatesFromHeader(void);
void LoadSaveblockObjEventScripts(void); void LoadSaveblockObjEventScripts(void);
void Overworld_SetObjEventTemplateCoords(u8 localId, s16 x, s16 y); void SetObjEventTemplateCoords(u8 localId, s16 x, s16 y);
void Overworld_SetObjEventTemplateMovementType(u8 localId, u8 movementType); void SetObjEventTemplateMovementType(u8 localId, u8 movementType);
const struct MapLayout *GetMapLayout(void); const struct MapLayout *GetMapLayout(void);
void ApplyCurrentWarp(void); void ApplyCurrentWarp(void);
struct MapHeader const *const Overworld_GetMapHeaderByGroupAndId(u16 mapGroup, u16 mapNum); struct MapHeader const *const Overworld_GetMapHeaderByGroupAndId(u16 mapGroup, u16 mapNum);
@@ -98,8 +98,8 @@ void ResetInitialPlayerAvatarState(void);
void StoreInitialPlayerAvatarState(void); void StoreInitialPlayerAvatarState(void);
bool32 Overworld_IsBikingAllowed(void); bool32 Overworld_IsBikingAllowed(void);
void SetDefaultFlashLevel(void); void SetDefaultFlashLevel(void);
void Overworld_SetFlashLevel(s32 flashLevel); void SetFlashLevel(s32 flashLevel);
u8 Overworld_GetFlashLevel(void); u8 GetFlashLevel(void);
void SetCurrentMapLayout(u16 mapLayoutId); void SetCurrentMapLayout(u16 mapLayoutId);
void SetObjectEventLoadFlag(u8 var); void SetObjectEventLoadFlag(u8 var);
u16 GetLocationMusic(struct WarpData *warp); u16 GetLocationMusic(struct WarpData *warp);
+1 -1
View File
@@ -700,7 +700,7 @@ static u8 GetBattleTransitionTypeByMap(void)
PlayerGetDestCoords(&x, &y); PlayerGetDestCoords(&x, &y);
tileBehavior = MapGridGetMetatileBehaviorAt(x, y); tileBehavior = MapGridGetMetatileBehaviorAt(x, y);
if (Overworld_GetFlashLevel()) if (GetFlashLevel())
return TRANSITION_TYPE_FLASH; return TRANSITION_TYPE_FLASH;
if (!MetatileBehavior_IsSurfableWaterOrUnderwater(tileBehavior)) if (!MetatileBehavior_IsSurfableWaterOrUnderwater(tileBehavior))
{ {
+1 -1
View File
@@ -1141,7 +1141,7 @@ static const u8 sPlayerDirectionToCopyDirection[][4] = {
static void ClearObjectEvent(struct ObjectEvent *objectEvent) static void ClearObjectEvent(struct ObjectEvent *objectEvent)
{ {
*objectEvent = (struct ObjectEvent){}; *objectEvent = (struct ObjectEvent){};
objectEvent->localId = 0xFF; objectEvent->localId = OBJ_EVENT_ID_PLAYER;
objectEvent->mapNum = MAP_NUM(UNDEFINED); objectEvent->mapNum = MAP_NUM(UNDEFINED);
objectEvent->mapGroup = MAP_GROUP(UNDEFINED); objectEvent->mapGroup = MAP_GROUP(UNDEFINED);
objectEvent->movementActionId = MOVEMENT_ACTION_NONE; objectEvent->movementActionId = MOVEMENT_ACTION_NONE;
+1 -1
View File
@@ -974,7 +974,7 @@ static u8 StartUpdateOrbFlashEffect(s32 centerX, s32 centerY, s32 initialFlashRa
// A higher flashLevel value is a smaller flash radius (more darkness). 0 is full brightness // A higher flashLevel value is a smaller flash radius (more darkness). 0 is full brightness
void AnimateFlash(u8 flashLevel) void AnimateFlash(u8 flashLevel)
{ {
u8 curFlashLevel = Overworld_GetFlashLevel(); u8 curFlashLevel = GetFlashLevel();
bool8 fullBrightness = FALSE; bool8 fullBrightness = FALSE;
if (!flashLevel) if (!flashLevel)
fullBrightness = TRUE; fullBrightness = TRUE;
+12 -10
View File
@@ -3029,6 +3029,8 @@ void CloseFrontierExchangeCornerItemIconWindow(void)
RemoveWindow(sFrontierExchangeCorner_ItemIconWindowId); RemoveWindow(sFrontierExchangeCorner_ItemIconWindowId);
} }
#define TAG_ITEM_ICON 5500
static void FillFrontierExchangeCornerWindowAndItemIcon(u16 menu, u16 selection) static void FillFrontierExchangeCornerWindowAndItemIcon(u16 menu, u16 selection)
{ {
#include "data/battle_frontier/battle_frontier_exchange_corner.h" #include "data/battle_frontier/battle_frontier_exchange_corner.h"
@@ -3046,9 +3048,9 @@ static void FillFrontierExchangeCornerWindowAndItemIcon(u16 menu, u16 selection)
} }
else else
{ {
FreeSpriteTilesByTag(5500); FreeSpriteTilesByTag(TAG_ITEM_ICON);
FreeSpritePaletteByTag(5500); FreeSpritePaletteByTag(TAG_ITEM_ICON);
sScrollableMultichoice_ItemSpriteId = AddDecorationIconObject(sFrontierExchangeCorner_Decor1[selection], 33, 88, 0, 5500, 5500); sScrollableMultichoice_ItemSpriteId = AddDecorationIconObject(sFrontierExchangeCorner_Decor1[selection], 33, 88, 0, TAG_ITEM_ICON, TAG_ITEM_ICON);
} }
break; break;
case SCROLL_MULTI_BF_EXCHANGE_CORNER_DECOR_VENDOR_2: case SCROLL_MULTI_BF_EXCHANGE_CORNER_DECOR_VENDOR_2:
@@ -3059,9 +3061,9 @@ static void FillFrontierExchangeCornerWindowAndItemIcon(u16 menu, u16 selection)
} }
else else
{ {
FreeSpriteTilesByTag(5500); FreeSpriteTilesByTag(TAG_ITEM_ICON);
FreeSpritePaletteByTag(5500); FreeSpritePaletteByTag(TAG_ITEM_ICON);
sScrollableMultichoice_ItemSpriteId = AddDecorationIconObject(sFrontierExchangeCorner_Decor2[selection], 33, 88, 0, 5500, 5500); sScrollableMultichoice_ItemSpriteId = AddDecorationIconObject(sFrontierExchangeCorner_Decor2[selection], 33, 88, 0, TAG_ITEM_ICON, TAG_ITEM_ICON);
} }
break; break;
case SCROLL_MULTI_BF_EXCHANGE_CORNER_VITAMIN_VENDOR: case SCROLL_MULTI_BF_EXCHANGE_CORNER_VITAMIN_VENDOR:
@@ -3078,9 +3080,9 @@ static void FillFrontierExchangeCornerWindowAndItemIcon(u16 menu, u16 selection)
static void ShowFrontierExchangeCornerItemIcon(u16 item) static void ShowFrontierExchangeCornerItemIcon(u16 item)
{ {
FreeSpriteTilesByTag(5500); FreeSpriteTilesByTag(TAG_ITEM_ICON);
FreeSpritePaletteByTag(5500); FreeSpritePaletteByTag(TAG_ITEM_ICON);
sScrollableMultichoice_ItemSpriteId = AddItemIconSprite(5500, 5500, item); sScrollableMultichoice_ItemSpriteId = AddItemIconSprite(TAG_ITEM_ICON, TAG_ITEM_ICON, item);
if (sScrollableMultichoice_ItemSpriteId != MAX_SPRITES) if (sScrollableMultichoice_ItemSpriteId != MAX_SPRITES)
{ {
@@ -3416,7 +3418,7 @@ static void ChangeDeoxysRockLevel(u8 rockLevel)
gFieldEffectArguments[5] = 5; gFieldEffectArguments[5] = 5;
FieldEffectStart(FLDEFF_MOVE_DEOXYS_ROCK); FieldEffectStart(FLDEFF_MOVE_DEOXYS_ROCK);
Overworld_SetObjEventTemplateCoords(1, sDeoxysRockCoords[rockLevel][0], sDeoxysRockCoords[rockLevel][1]); SetObjEventTemplateCoords(LOCALID_BIRTH_ISLAND_EXTERIOR_ROCK, sDeoxysRockCoords[rockLevel][0], sDeoxysRockCoords[rockLevel][1]);
} }
static void WaitForDeoxysRockMovement(u8 taskId) static void WaitForDeoxysRockMovement(u8 taskId)
+9 -13
View File
@@ -175,7 +175,6 @@ static u8 GetAdjustedInitialTransitionFlags(struct InitialPlayerAvatarState *, u
static u8 GetAdjustedInitialDirection(struct InitialPlayerAvatarState *, u8, u16, u8); static u8 GetAdjustedInitialDirection(struct InitialPlayerAvatarState *, u8, u16, u8);
static u16 GetCenterScreenMetatileBehavior(void); static u16 GetCenterScreenMetatileBehavior(void);
// IWRAM bss vars
static void *sUnusedOverworldCallback; static void *sUnusedOverworldCallback;
static u8 sPlayerLinkStates[MAX_LINK_PLAYERS]; static u8 sPlayerLinkStates[MAX_LINK_PLAYERS];
// This callback is called with a player's key code. It then returns an // This callback is called with a player's key code. It then returns an
@@ -185,7 +184,6 @@ static u16 (*sPlayerKeyInterceptCallback)(u32);
static bool8 sReceivingFromLink; static bool8 sReceivingFromLink;
static u8 sRfuKeepAliveTimer; static u8 sRfuKeepAliveTimer;
// IWRAM common
u16 *gBGTilemapBuffers1; u16 *gBGTilemapBuffers1;
u16 *gBGTilemapBuffers2; u16 *gBGTilemapBuffers2;
u16 *gBGTilemapBuffers3; u16 *gBGTilemapBuffers3;
@@ -195,7 +193,6 @@ bool8 (*gFieldCallback2)(void);
u8 gLocalLinkPlayerId; // This is our player id in a multiplayer mode. u8 gLocalLinkPlayerId; // This is our player id in a multiplayer mode.
u8 gFieldLinkPlayerCount; u8 gFieldLinkPlayerCount;
// EWRAM vars
EWRAM_DATA static u8 sObjectEventLoadFlag = 0; EWRAM_DATA static u8 sObjectEventLoadFlag = 0;
EWRAM_DATA struct WarpData gLastUsedWarp = {0}; EWRAM_DATA struct WarpData gLastUsedWarp = {0};
EWRAM_DATA static struct WarpData sWarpDestination = {0}; // new warp position EWRAM_DATA static struct WarpData sWarpDestination = {0}; // new warp position
@@ -207,11 +204,10 @@ EWRAM_DATA static u16 sAmbientCrySpecies = 0;
EWRAM_DATA static bool8 sIsAmbientCryWaterMon = FALSE; EWRAM_DATA static bool8 sIsAmbientCryWaterMon = FALSE;
EWRAM_DATA struct LinkPlayerObjectEvent gLinkPlayerObjectEvents[4] = {0}; EWRAM_DATA struct LinkPlayerObjectEvent gLinkPlayerObjectEvents[4] = {0};
// const rom data
static const struct WarpData sDummyWarpData = static const struct WarpData sDummyWarpData =
{ {
.mapGroup = -1, .mapGroup = MAP_GROUP(UNDEFINED),
.mapNum = -1, .mapNum = MAP_NUM(UNDEFINED),
.warpId = -1, .warpId = -1,
.x = -1, .x = -1,
.y = -1, .y = -1,
@@ -495,7 +491,7 @@ void LoadSaveblockObjEventScripts(void)
savObjTemplates[i].script = mapHeaderObjTemplates[i].script; savObjTemplates[i].script = mapHeaderObjTemplates[i].script;
} }
void Overworld_SetObjEventTemplateCoords(u8 localId, s16 x, s16 y) void SetObjEventTemplateCoords(u8 localId, s16 x, s16 y)
{ {
s32 i; s32 i;
struct ObjectEventTemplate *savObjTemplates = gSaveBlock1Ptr->objectEventTemplates; struct ObjectEventTemplate *savObjTemplates = gSaveBlock1Ptr->objectEventTemplates;
@@ -512,7 +508,7 @@ void Overworld_SetObjEventTemplateCoords(u8 localId, s16 x, s16 y)
} }
} }
void Overworld_SetObjEventTemplateMovementType(u8 localId, u8 movementType) void SetObjEventTemplateMovementType(u8 localId, u8 movementType)
{ {
s32 i; s32 i;
@@ -570,9 +566,9 @@ static void SetWarpData(struct WarpData *warp, s8 mapGroup, s8 mapNum, s8 warpId
static bool32 IsDummyWarp(struct WarpData *warp) static bool32 IsDummyWarp(struct WarpData *warp)
{ {
if (warp->mapGroup != -1) if (warp->mapGroup != (s8)MAP_GROUP(UNDEFINED))
return FALSE; return FALSE;
else if (warp->mapNum != -1) else if (warp->mapNum != (s8)MAP_NUM(UNDEFINED))
return FALSE; return FALSE;
else if (warp->warpId != -1) else if (warp->warpId != -1)
return FALSE; return FALSE;
@@ -978,14 +974,14 @@ void SetDefaultFlashLevel(void)
gSaveBlock1Ptr->flashLevel = gMaxFlashLevel - 1; gSaveBlock1Ptr->flashLevel = gMaxFlashLevel - 1;
} }
void Overworld_SetFlashLevel(s32 flashLevel) void SetFlashLevel(s32 flashLevel)
{ {
if (flashLevel < 0 || flashLevel > gMaxFlashLevel) if (flashLevel < 0 || flashLevel > gMaxFlashLevel)
flashLevel = 0; flashLevel = 0;
gSaveBlock1Ptr->flashLevel = flashLevel; gSaveBlock1Ptr->flashLevel = flashLevel;
} }
u8 Overworld_GetFlashLevel(void) u8 GetFlashLevel(void)
{ {
return gSaveBlock1Ptr->flashLevel; return gSaveBlock1Ptr->flashLevel;
} }
@@ -1790,7 +1786,7 @@ static void InitCurrentFlashLevelScanlineEffect(void)
WriteBattlePyramidViewScanlineEffectBuffer(); WriteBattlePyramidViewScanlineEffectBuffer();
ScanlineEffect_SetParams(sFlashEffectParams); ScanlineEffect_SetParams(sFlashEffectParams);
} }
else if ((flashLevel = Overworld_GetFlashLevel())) else if ((flashLevel = GetFlashLevel()))
{ {
WriteFlashScanlineEffectBuffer(flashLevel); WriteFlashScanlineEffectBuffer(flashLevel);
ScanlineEffect_SetParams(sFlashEffectParams); ScanlineEffect_SetParams(sFlashEffectParams);
+30 -37
View File
@@ -58,11 +58,11 @@ EWRAM_DATA const u8 *gRamScriptRetAddr = NULL;
static EWRAM_DATA u32 sAddressOffset = 0; // For relative addressing in vgoto etc., used by saved scripts (e.g. Mystery Event) static EWRAM_DATA u32 sAddressOffset = 0; // For relative addressing in vgoto etc., used by saved scripts (e.g. Mystery Event)
static EWRAM_DATA u16 sPauseCounter = 0; static EWRAM_DATA u16 sPauseCounter = 0;
static EWRAM_DATA u16 sMovingNpcId = 0; static EWRAM_DATA u16 sMovingNpcId = 0;
static EWRAM_DATA u16 sMovingNpcMapBank = 0; static EWRAM_DATA u16 sMovingNpcMapGroup = 0;
static EWRAM_DATA u16 sMovingNpcMapId = 0; static EWRAM_DATA u16 sMovingNpcMapNum = 0;
static EWRAM_DATA u16 sFieldEffectScriptId = 0; static EWRAM_DATA u16 sFieldEffectScriptId = 0;
static u8 gBrailleWindowId; static u8 sBrailleWindowId;
extern const SpecialFunc gSpecials[]; extern const SpecialFunc gSpecials[];
extern const u8 *gStdScripts[]; extern const u8 *gStdScripts[];
@@ -612,9 +612,7 @@ bool8 ScrCmd_animateflash(struct ScriptContext *ctx)
bool8 ScrCmd_setflashradius(struct ScriptContext *ctx) bool8 ScrCmd_setflashradius(struct ScriptContext *ctx)
{ {
u16 flashLevel = VarGet(ScriptReadHalfword(ctx)); SetFlashLevel(VarGet(ScriptReadHalfword(ctx)));
Overworld_SetFlashLevel(flashLevel);
return FALSE; return FALSE;
} }
@@ -668,9 +666,7 @@ bool8 ScrCmd_fadescreenswapbuffers(struct ScriptContext *ctx)
static bool8 RunPauseTimer(void) static bool8 RunPauseTimer(void)
{ {
sPauseCounter--; if (--sPauseCounter == 0)
if (sPauseCounter == 0)
return TRUE; return TRUE;
else else
return FALSE; return FALSE;
@@ -945,9 +941,9 @@ bool8 ScrCmd_waitfanfare(struct ScriptContext *ctx)
bool8 ScrCmd_playbgm(struct ScriptContext *ctx) bool8 ScrCmd_playbgm(struct ScriptContext *ctx)
{ {
u16 songId = ScriptReadHalfword(ctx); u16 songId = ScriptReadHalfword(ctx);
bool8 val = ScriptReadByte(ctx); bool8 save = ScriptReadByte(ctx);
if (val == TRUE) if (save == TRUE)
Overworld_SetSavedMusic(songId); Overworld_SetSavedMusic(songId);
PlayNewMapMusic(songId); PlayNewMapMusic(songId);
return FALSE; return FALSE;
@@ -1018,7 +1014,7 @@ bool8 ScrCmd_applymovement_at(struct ScriptContext *ctx)
static bool8 WaitForMovementFinish(void) static bool8 WaitForMovementFinish(void)
{ {
return ScriptMovement_IsObjectMovementFinished(sMovingNpcId, sMovingNpcMapId, sMovingNpcMapBank); return ScriptMovement_IsObjectMovementFinished(sMovingNpcId, sMovingNpcMapNum, sMovingNpcMapGroup);
} }
bool8 ScrCmd_waitmovement(struct ScriptContext *ctx) bool8 ScrCmd_waitmovement(struct ScriptContext *ctx)
@@ -1027,8 +1023,8 @@ bool8 ScrCmd_waitmovement(struct ScriptContext *ctx)
if (localId != 0) if (localId != 0)
sMovingNpcId = localId; sMovingNpcId = localId;
sMovingNpcMapBank = gSaveBlock1Ptr->location.mapGroup; sMovingNpcMapGroup = gSaveBlock1Ptr->location.mapGroup;
sMovingNpcMapId = gSaveBlock1Ptr->location.mapNum; sMovingNpcMapNum = gSaveBlock1Ptr->location.mapNum;
SetupNativeScript(ctx, WaitForMovementFinish); SetupNativeScript(ctx, WaitForMovementFinish);
return TRUE; return TRUE;
} }
@@ -1036,15 +1032,15 @@ bool8 ScrCmd_waitmovement(struct ScriptContext *ctx)
bool8 ScrCmd_waitmovement_at(struct ScriptContext *ctx) bool8 ScrCmd_waitmovement_at(struct ScriptContext *ctx)
{ {
u16 localId = VarGet(ScriptReadHalfword(ctx)); u16 localId = VarGet(ScriptReadHalfword(ctx));
u8 mapBank; u8 mapGroup;
u8 mapId; u8 mapNum;
if (localId != 0) if (localId != 0)
sMovingNpcId = localId; sMovingNpcId = localId;
mapBank = ScriptReadByte(ctx); mapGroup = ScriptReadByte(ctx);
mapId = ScriptReadByte(ctx); mapNum = ScriptReadByte(ctx);
sMovingNpcMapBank = mapBank; sMovingNpcMapGroup = mapGroup;
sMovingNpcMapId = mapId; sMovingNpcMapNum = mapNum;
SetupNativeScript(ctx, WaitForMovementFinish); SetupNativeScript(ctx, WaitForMovementFinish);
return TRUE; return TRUE;
} }
@@ -1101,7 +1097,7 @@ bool8 ScrCmd_setobjectxyperm(struct ScriptContext *ctx)
u16 x = VarGet(ScriptReadHalfword(ctx)); u16 x = VarGet(ScriptReadHalfword(ctx));
u16 y = VarGet(ScriptReadHalfword(ctx)); u16 y = VarGet(ScriptReadHalfword(ctx));
Overworld_SetObjEventTemplateCoords(localId, x, y); SetObjEventTemplateCoords(localId, x, y);
return FALSE; return FALSE;
} }
@@ -1178,7 +1174,7 @@ bool8 ScrCmd_setobjectmovementtype(struct ScriptContext *ctx)
u16 localId = VarGet(ScriptReadHalfword(ctx)); u16 localId = VarGet(ScriptReadHalfword(ctx));
u8 movementType = ScriptReadByte(ctx); u8 movementType = ScriptReadByte(ctx);
Overworld_SetObjEventTemplateMovementType(localId, movementType); SetObjEventTemplateMovementType(localId, movementType);
return FALSE; return FALSE;
} }
@@ -1311,7 +1307,7 @@ bool8 ScrCmd_messageinstant(struct ScriptContext *ctx)
msg = (const u8 *)ctx->data[0]; msg = (const u8 *)ctx->data[0];
LoadMessageBoxAndBorderGfx(); LoadMessageBoxAndBorderGfx();
DrawDialogueFrame(0, 1); DrawDialogueFrame(0, 1);
AddTextPrinterParameterized(0, FONT_NORMAL, msg, 0, 1, 0, 0); AddTextPrinterParameterized(0, FONT_NORMAL, msg, 0, 1, 0, NULL);
return FALSE; return FALSE;
} }
@@ -1528,13 +1524,13 @@ bool8 ScrCmd_braillemessage(struct ScriptContext *ctx)
yText = (yText - yWindow - 1) * 8; yText = (yText - yWindow - 1) * 8;
winTemplate = CreateWindowTemplate(0, xWindow, yWindow + 1, width, height, 0xF, 0x1); winTemplate = CreateWindowTemplate(0, xWindow, yWindow + 1, width, height, 0xF, 0x1);
gBrailleWindowId = AddWindow(&winTemplate); sBrailleWindowId = AddWindow(&winTemplate);
LoadUserWindowBorderGfx(gBrailleWindowId, 0x214, 0xE0); LoadUserWindowBorderGfx(sBrailleWindowId, 0x214, 0xE0);
DrawStdWindowFrame(gBrailleWindowId, 0); DrawStdWindowFrame(sBrailleWindowId, 0);
PutWindowTilemap(gBrailleWindowId); PutWindowTilemap(sBrailleWindowId);
FillWindowPixelBuffer(gBrailleWindowId, PIXEL_FILL(1)); FillWindowPixelBuffer(sBrailleWindowId, PIXEL_FILL(1));
AddTextPrinterParameterized(gBrailleWindowId, FONT_BRAILLE, gStringVar4, xText, yText, TEXT_SKIP_DRAW, NULL); AddTextPrinterParameterized(sBrailleWindowId, FONT_BRAILLE, gStringVar4, xText, yText, TEXT_SKIP_DRAW, NULL);
CopyWindowToVram(gBrailleWindowId, COPYWIN_FULL); CopyWindowToVram(sBrailleWindowId, COPYWIN_FULL);
return FALSE; return FALSE;
} }
@@ -1933,7 +1929,7 @@ bool8 ScrCmd_setberrytree(struct ScriptContext *ctx)
u8 growthStage = ScriptReadByte(ctx); u8 growthStage = ScriptReadByte(ctx);
if (berry == 0) if (berry == 0)
PlantBerryTree(treeId, 0, growthStage, FALSE); PlantBerryTree(treeId, berry, growthStage, FALSE);
else else
PlantBerryTree(treeId, berry, growthStage, FALSE); PlantBerryTree(treeId, berry, growthStage, FALSE);
return FALSE; return FALSE;
@@ -2230,9 +2226,7 @@ bool8 ScrCmd_checkmoneventlegal(struct ScriptContext *ctx)
return FALSE; return FALSE;
} }
// TODO: Should be renamed. Name implies general usage, but its specifically for Wonder Card bool8 ScrCmd_gotowondercardscript(struct ScriptContext *ctx)
// See GetSavedRamScriptIfValid, which is NULL if ValidateSavedWonderCard returns FALSE
bool8 ScrCmd_gotoram(struct ScriptContext *ctx)
{ {
const u8* script = GetSavedRamScriptIfValid(); const u8* script = GetSavedRamScriptIfValid();
@@ -2244,7 +2238,6 @@ bool8 ScrCmd_gotoram(struct ScriptContext *ctx)
return FALSE; return FALSE;
} }
// Unused
// For the warp used by the Aqua Hideout, see DoTeleportTileWarp // For the warp used by the Aqua Hideout, see DoTeleportTileWarp
bool8 ScrCmd_warpspinenter(struct ScriptContext *ctx) bool8 ScrCmd_warpspinenter(struct ScriptContext *ctx)
{ {
@@ -2273,8 +2266,8 @@ bool8 ScrCmd_setmonmetlocation(struct ScriptContext *ctx)
static void CloseBrailleWindow(void) static void CloseBrailleWindow(void)
{ {
ClearStdWindowAndFrame(gBrailleWindowId, 1); ClearStdWindowAndFrame(sBrailleWindowId, 1);
RemoveWindow(gBrailleWindowId); RemoveWindow(sBrailleWindowId);
} }
bool8 ScrCmd_buffertrainerclassname(struct ScriptContext *ctx) bool8 ScrCmd_buffertrainerclassname(struct ScriptContext *ctx)
+6 -3
View File
@@ -3,6 +3,7 @@
#include "event_data.h" #include "event_data.h"
#include "mystery_gift.h" #include "mystery_gift.h"
#include "util.h" #include "util.h"
#include "constants/event_objects.h"
#include "constants/maps.h" #include "constants/maps.h"
#include "constants/map_scripts.h" #include "constants/map_scripts.h"
@@ -399,6 +400,8 @@ const u8 *GetRamScript(u8 objectId, const u8 *script)
} }
} }
#define NO_OBJECT OBJ_EVENT_ID_PLAYER
bool32 ValidateSavedRamScript(void) bool32 ValidateSavedRamScript(void)
{ {
struct RamScriptData *scriptData = &gSaveBlock1Ptr->ramScript.data; struct RamScriptData *scriptData = &gSaveBlock1Ptr->ramScript.data;
@@ -408,7 +411,7 @@ bool32 ValidateSavedRamScript(void)
return FALSE; return FALSE;
if (scriptData->mapNum != MAP_NUM(UNDEFINED)) if (scriptData->mapNum != MAP_NUM(UNDEFINED))
return FALSE; return FALSE;
if (scriptData->objectId != 0xFF) if (scriptData->objectId != NO_OBJECT)
return FALSE; return FALSE;
if (CalculateRamScriptChecksum() != gSaveBlock1Ptr->ramScript.checksum) if (CalculateRamScriptChecksum() != gSaveBlock1Ptr->ramScript.checksum)
return FALSE; return FALSE;
@@ -426,7 +429,7 @@ u8 *GetSavedRamScriptIfValid(void)
return NULL; return NULL;
if (scriptData->mapNum != MAP_NUM(UNDEFINED)) if (scriptData->mapNum != MAP_NUM(UNDEFINED))
return NULL; return NULL;
if (scriptData->objectId != 0xFF) if (scriptData->objectId != NO_OBJECT)
return NULL; return NULL;
if (CalculateRamScriptChecksum() != gSaveBlock1Ptr->ramScript.checksum) if (CalculateRamScriptChecksum() != gSaveBlock1Ptr->ramScript.checksum)
{ {
@@ -443,5 +446,5 @@ void InitRamScript_NoObjectEvent(u8 *script, u16 scriptSize)
{ {
if (scriptSize > sizeof(gSaveBlock1Ptr->ramScript.data.script)) if (scriptSize > sizeof(gSaveBlock1Ptr->ramScript.data.script))
scriptSize = sizeof(gSaveBlock1Ptr->ramScript.data.script); scriptSize = sizeof(gSaveBlock1Ptr->ramScript.data.script);
InitRamScript(script, scriptSize, MAP_GROUP(UNDEFINED), MAP_NUM(UNDEFINED), 0xFF); InitRamScript(script, scriptSize, MAP_GROUP(UNDEFINED), MAP_NUM(UNDEFINED), NO_OBJECT);
} }