diff --git a/asm/macros/battle_frontier/battle_pyramid.inc b/asm/macros/battle_frontier/battle_pyramid.inc index bb5069f18a..42141d9937 100644 --- a/asm/macros/battle_frontier/battle_pyramid.inc +++ b/asm/macros/battle_frontier/battle_pyramid.inc @@ -69,8 +69,8 @@ .endm @ VAR_RESULT is 1 if player is on a Pyramid floor, 2 if on the Pyramid peak, 0 otherwise - .macro pyramid_inchallenge - setvar VAR_0x8004, BATTLE_PYRAMID_FUNC_IS_IN + .macro pyramid_getlocation + setvar VAR_0x8004, BATTLE_PYRAMID_FUNC_CURRENT_LOCATION special CallBattlePyramidFunction .endm diff --git a/data/scripts/field_poison.inc b/data/scripts/field_poison.inc index ddda34ebaa..1d89bcfdfd 100644 --- a/data/scripts/field_poison.inc +++ b/data/scripts/field_poison.inc @@ -29,9 +29,9 @@ EventScript_FrontierFieldWhiteOut:: waitbuttonpress pike_inchallenge goto_if_eq VAR_RESULT, TRUE, BattleFrontier_BattlePike_EventScript_Retire - pyramid_inchallenge - goto_if_eq VAR_RESULT, 1, BattleFrontier_BattlePyramid_EventScript_WarpToLobbyLost @ On Pyramid floor - goto_if_eq VAR_RESULT, 2, BattleFrontier_BattlePyramid_EventScript_WarpToLobbyLost @ On Pyramid peak + pyramid_getlocation + goto_if_eq VAR_RESULT, PYRAMID_LOCATION_FLOOR, BattleFrontier_BattlePyramid_EventScript_WarpToLobbyLost + goto_if_eq VAR_RESULT, PYRAMID_LOCATION_TOP, BattleFrontier_BattlePyramid_EventScript_WarpToLobbyLost trainerhill_inchallenge goto_if_eq VAR_RESULT, TRUE, TrainerHill_1F_EventScript_Lost special Script_FadeOutMapMusic diff --git a/data/scripts/obtain_item.inc b/data/scripts/obtain_item.inc index e982858e7b..6831a75b6e 100644 --- a/data/scripts/obtain_item.inc +++ b/data/scripts/obtain_item.inc @@ -118,8 +118,8 @@ EventScript_PickUpItem:: waitfanfare waitmessage bufferitemnameplural STR_VAR_2, VAR_0x8004, VAR_0x8005 - pyramid_inchallenge - goto_if_eq VAR_RESULT, TRUE, EventScript_PutBattlePyramidItemInBag + pyramid_getlocation + goto_if_eq VAR_RESULT, PYRAMID_LOCATION_FLOOR, EventScript_PutBattlePyramidItemInBag msgbox gText_PutItemInPocket, MSGBOX_DEFAULT return diff --git a/include/battle_pyramid.h b/include/battle_pyramid.h index ec80fdeed3..d55d8d2e93 100644 --- a/include/battle_pyramid.h +++ b/include/battle_pyramid.h @@ -1,13 +1,15 @@ #ifndef GUARD_BATTLE_PYRAMID_H #define GUARD_BATTLE_PYRAMID_H +#include "constants/battle_pyramid.h" + void CallBattlePyramidFunction(void); u16 LocalIdToPyramidTrainerId(u8 localId); bool8 GetBattlePyramidTrainerFlag(u8 eventId); void MarkApproachingPyramidTrainersAsBattled(void); void GenerateBattlePyramidWildMon(void); u8 GetPyramidRunMultiplier(void); -u8 InBattlePyramid(void); +u8 CurrentBattlePyramidLocation(void); bool8 InBattlePyramid_(void); void PausePyramidChallenge(void); void SoftResetInBattlePyramid(void); diff --git a/include/constants/battle_pyramid.h b/include/constants/battle_pyramid.h index ac80a2d7d3..08fa695cf2 100644 --- a/include/constants/battle_pyramid.h +++ b/include/constants/battle_pyramid.h @@ -43,7 +43,7 @@ #define BATTLE_PYRAMID_FUNC_SET_TRAINERS 9 #define BATTLE_PYRAMID_FUNC_SHOW_HINT_TEXT 10 #define BATTLE_PYRAMID_FUNC_UPDATE_STREAK 11 // unused -#define BATTLE_PYRAMID_FUNC_IS_IN 12 +#define BATTLE_PYRAMID_FUNC_CURRENT_LOCATION 12 #define BATTLE_PYRAMID_FUNC_UPDATE_LIGHT 13 #define BATTLE_PYRAMID_FUNC_CLEAR_HELD_ITEMS 14 #define BATTLE_PYRAMID_FUNC_SET_FLOOR_PALETTE 15 @@ -62,4 +62,8 @@ #define PYRAMID_LIGHT_SET_RADIUS 0 #define PYRAMID_LIGHT_INCR_RADIUS 1 +#define PYRAMID_LOCATION_NONE 0 // Not in the Pyramid +#define PYRAMID_LOCATION_FLOOR 1 +#define PYRAMID_LOCATION_TOP 2 + #endif // GUARD_CONSTANTS_BATTLE_PYRAMID_H diff --git a/src/battle_pyramid.c b/src/battle_pyramid.c index 3f0aab2470..d78cd38417 100644 --- a/src/battle_pyramid.c +++ b/src/battle_pyramid.c @@ -79,7 +79,7 @@ static void HidePyramidItem(void); static void SetPyramidFacilityTrainers(void); static void ShowPostBattleHintText(void); static void UpdatePyramidWinStreak(void); -static void GetInBattlePyramid(void); +static void GetCurrentBattlePyramidLocation(void); static void UpdatePyramidLightRadius(void); static void ClearPyramidPartyHeldItems(void); static void SetPyramidFloorPalette(void); @@ -798,7 +798,7 @@ static void (*const sBattlePyramidFunctions[])(void) = [BATTLE_PYRAMID_FUNC_SET_TRAINERS] = SetPyramidFacilityTrainers, [BATTLE_PYRAMID_FUNC_SHOW_HINT_TEXT] = ShowPostBattleHintText, [BATTLE_PYRAMID_FUNC_UPDATE_STREAK] = UpdatePyramidWinStreak, - [BATTLE_PYRAMID_FUNC_IS_IN] = GetInBattlePyramid, + [BATTLE_PYRAMID_FUNC_CURRENT_LOCATION] = GetCurrentBattlePyramidLocation, [BATTLE_PYRAMID_FUNC_UPDATE_LIGHT] = UpdatePyramidLightRadius, [BATTLE_PYRAMID_FUNC_CLEAR_HELD_ITEMS] = ClearPyramidPartyHeldItems, [BATTLE_PYRAMID_FUNC_SET_FLOOR_PALETTE] = SetPyramidFloorPalette, @@ -1113,9 +1113,9 @@ static void UpdatePyramidWinStreak(void) gSaveBlock2Ptr->frontier.pyramidRecordStreaks[lvlMode] = gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode]; } -static void GetInBattlePyramid(void) +static void GetCurrentBattlePyramidLocation(void) { - gSpecialVar_Result = InBattlePyramid(); + gSpecialVar_Result = CurrentBattlePyramidLocation(); } static void UpdatePyramidLightRadius(void) @@ -1419,14 +1419,14 @@ u8 GetPyramidRunMultiplier(void) return sPyramidFloorTemplates[id].runMultiplier; } -u8 InBattlePyramid(void) +u8 CurrentBattlePyramidLocation(void) { if (gMapHeader.mapLayoutId == LAYOUT_BATTLE_FRONTIER_BATTLE_PYRAMID_FLOOR) - return 1; + return PYRAMID_LOCATION_FLOOR; else if (gMapHeader.mapLayoutId == LAYOUT_BATTLE_FRONTIER_BATTLE_PYRAMID_TOP) - return 2; + return PYRAMID_LOCATION_TOP; else - return FALSE; + return PYRAMID_LOCATION_NONE; } bool8 InBattlePyramid_(void) @@ -1437,7 +1437,7 @@ bool8 InBattlePyramid_(void) void PausePyramidChallenge(void) { - if (InBattlePyramid()) + if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE) { RestorePyramidPlayerParty(); gSaveBlock2Ptr->frontier.challengeStatus = CHALLENGE_STATUS_PAUSED; @@ -1448,7 +1448,7 @@ void PausePyramidChallenge(void) void SoftResetInBattlePyramid(void) { - if (InBattlePyramid()) + if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE) DoSoftReset(); } diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 17486a0e9e..f69126cf72 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -9684,7 +9684,7 @@ static void Cmd_pickup(void) { } - else if (InBattlePyramid()) + else if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE) { for (i = 0; i < PARTY_SIZE; i++) { diff --git a/src/battle_setup.c b/src/battle_setup.c index 5851ab5a1d..41026de725 100644 --- a/src/battle_setup.c +++ b/src/battle_setup.c @@ -406,7 +406,7 @@ static void DoStandardWildBattle(void) StopPlayerAvatar(); gMain.savedCallback = CB2_EndWildBattle; gBattleTypeFlags = 0; - if (InBattlePyramid()) + if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE) { VarSet(VAR_TEMP_PLAYING_PYRAMID_MUSIC, 0); gBattleTypeFlags |= BATTLE_TYPE_PYRAMID; @@ -466,7 +466,7 @@ static void DoTrainerBattle(void) static void DoBattlePyramidTrainerHillBattle(void) { - if (InBattlePyramid()) + if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE) CreateBattleStartTask(GetSpecialBattleTransition(B_TRANSITION_GROUP_B_PYRAMID), 0); else CreateBattleStartTask(GetSpecialBattleTransition(B_TRANSITION_GROUP_TRAINER_HILL), 0); @@ -604,7 +604,7 @@ static void CB2_EndWildBattle(void) CpuFill16(0, (void *)(BG_PLTT), BG_PLTT_SIZE); ResetOamRange(0, 128); - if (IsPlayerDefeated(gBattleOutcome) == TRUE && !InBattlePyramid() && !InBattlePike()) + if (IsPlayerDefeated(gBattleOutcome) == TRUE && CurrentBattlePyramidLocation() == PYRAMID_LOCATION_NONE && !InBattlePike()) { SetMainCallback2(CB2_WhiteOut); } @@ -622,7 +622,7 @@ static void CB2_EndScriptedWildBattle(void) if (IsPlayerDefeated(gBattleOutcome) == TRUE) { - if (InBattlePyramid()) + if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE) SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic); else SetMainCallback2(CB2_WhiteOut); @@ -795,14 +795,14 @@ static u8 GetWildBattleTransition(void) if (enemyLevel < playerLevel) { - if (InBattlePyramid()) + if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE) return B_TRANSITION_BLUR; else return sBattleTransitionTable_Wild[transitionType][0]; } else { - if (InBattlePyramid()) + if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE) return B_TRANSITION_GRID_SQUARES; else return sBattleTransitionTable_Wild[transitionType][1]; @@ -1234,7 +1234,7 @@ u8 GetTrainerBattleMode(void) bool8 GetTrainerFlag(void) { - if (InBattlePyramid()) + if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE) return GetBattlePyramidTrainerFlag(gSelectedObjectEvent); else if (InTrainerHill()) return GetHillTrainerFlag(gSelectedObjectEvent); @@ -1276,7 +1276,7 @@ void BattleSetup_StartTrainerBattle(void) else gBattleTypeFlags = (BATTLE_TYPE_TRAINER); - if (InBattlePyramid()) + if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE) { VarSet(VAR_TEMP_PLAYING_PYRAMID_MUSIC, 0); gBattleTypeFlags |= BATTLE_TYPE_PYRAMID; @@ -1316,7 +1316,7 @@ void BattleSetup_StartTrainerBattle(void) gWhichTrainerToFaceAfterBattle = 0; gMain.savedCallback = CB2_EndTrainerBattle; - if (InBattlePyramid() || InTrainerHillChallenge()) + if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE || InTrainerHillChallenge()) DoBattlePyramidTrainerHillBattle(); else DoTrainerBattle(); @@ -1332,7 +1332,7 @@ static void CB2_EndTrainerBattle(void) } else if (IsPlayerDefeated(gBattleOutcome) == TRUE) { - if (InBattlePyramid() || InTrainerHillChallenge()) + if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE || InTrainerHillChallenge()) SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic); else SetMainCallback2(CB2_WhiteOut); @@ -1340,7 +1340,7 @@ static void CB2_EndTrainerBattle(void) else { SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic); - if (!InBattlePyramid() && !InTrainerHillChallenge()) + if (CurrentBattlePyramidLocation() == PYRAMID_LOCATION_NONE && !InTrainerHillChallenge()) { RegisterTrainerInMatchCall(); SetBattledTrainersFlags(); @@ -1377,7 +1377,7 @@ void BattleSetup_StartRematchBattle(void) void ShowTrainerIntroSpeech(void) { - if (InBattlePyramid()) + if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE) { if (gNoOfApproachingTrainers == 0 || gNoOfApproachingTrainers == 1) CopyPyramidTrainerSpeechBefore(LocalIdToPyramidTrainerId(gSpecialVar_LastTalked)); diff --git a/src/battle_util.c b/src/battle_util.c index 070385f0ad..7a9786b67f 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -426,7 +426,7 @@ bool8 TryRunFromBattle(u8 battler) } else if (gBattleMons[battler].ability == ABILITY_RUN_AWAY) { - if (InBattlePyramid()) + if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE) { gBattleStruct->runTries++; pyramidMultiplier = GetPyramidRunMultiplier(); @@ -453,7 +453,7 @@ bool8 TryRunFromBattle(u8 battler) { if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE)) { - if (InBattlePyramid()) + if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE) { pyramidMultiplier = GetPyramidRunMultiplier(); speedVar = (gBattleMons[battler].speed * pyramidMultiplier) / (gBattleMons[BATTLE_OPPOSITE(battler)].speed) + (gBattleStruct->runTries * 30); diff --git a/src/event_object_movement.c b/src/event_object_movement.c index fb4c778f7b..6997f0b40a 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -1338,7 +1338,7 @@ u8 Unref_TryInitLocalObjectEvent(u8 localId) if (gMapHeader.events != NULL) { - if (InBattlePyramid()) + if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE) objectEventCount = GetNumBattlePyramidObjectEvents(); else if (InTrainerHill()) objectEventCount = HILL_TRAINERS_PER_FLOOR; @@ -1654,7 +1654,7 @@ void TrySpawnObjectEvents(s16 cameraX, s16 cameraY) s16 top = gSaveBlock1Ptr->pos.y; s16 bottom = gSaveBlock1Ptr->pos.y + MAP_OFFSET_H + 2; - if (InBattlePyramid()) + if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE) objectCount = GetNumBattlePyramidObjectEvents(); else if (InTrainerHill()) objectCount = HILL_TRAINERS_PER_FLOOR; diff --git a/src/field_poison.c b/src/field_poison.c index d952b4b640..1b8ae94094 100644 --- a/src/field_poison.c +++ b/src/field_poison.c @@ -90,9 +90,9 @@ static void Task_TryFieldPoisonWhiteOut(u8 taskId) { // Battle facilities have their own white out script to handle the challenge loss #ifdef BUGFIX - if (InBattlePyramid() || InBattlePike() || InTrainerHillChallenge()) + if (CurrentBattlePyramidLocation() || InBattlePike() || InTrainerHillChallenge()) #else - if (InBattlePyramid() | InBattlePike() || InTrainerHillChallenge()) + if (CurrentBattlePyramidLocation() | InBattlePike() || InTrainerHillChallenge()) #endif gSpecialVar_Result = FLDPSN_FRONTIER_WHITEOUT; else diff --git a/src/frontier_pass.c b/src/frontier_pass.c index 12bb1f3ea7..54d25a11e0 100644 --- a/src/frontier_pass.c +++ b/src/frontier_pass.c @@ -917,12 +917,12 @@ static void CB2_ReturnFromRecord(void) sPassData->cursorX = sSavedPassData.cursorX; sPassData->cursorY = sSavedPassData.cursorY; memset(&sSavedPassData, 0, sizeof(sSavedPassData)); - switch (InBattlePyramid()) + switch (CurrentBattlePyramidLocation()) { - case 1: + case PYRAMID_LOCATION_FLOOR: PlayBGM(MUS_B_PYRAMID); break; - case 2: + case PYRAMID_LOCATION_TOP: PlayBGM(MUS_B_PYRAMID_TOP); break; default: diff --git a/src/item.c b/src/item.c index 3921ed98ac..a22eaaec91 100644 --- a/src/item.c +++ b/src/item.c @@ -133,7 +133,7 @@ bool8 CheckBagHasItem(u16 itemId, u16 count) if (GetItemPocket(itemId) == 0) return FALSE; - if (InBattlePyramid() || FlagGet(FLAG_STORING_ITEMS_IN_PYRAMID_BAG) == TRUE) + if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE || FlagGet(FLAG_STORING_ITEMS_IN_PYRAMID_BAG) == TRUE) return CheckPyramidBagHasItem(itemId, count); pocket = GetItemPocket(itemId) - 1; // Check for item slots that contain the item @@ -181,7 +181,7 @@ bool8 CheckBagHasSpace(u16 itemId, u16 count) if (GetItemPocket(itemId) == POCKET_NONE) return FALSE; - if (InBattlePyramid() || FlagGet(FLAG_STORING_ITEMS_IN_PYRAMID_BAG) == TRUE) + if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE || FlagGet(FLAG_STORING_ITEMS_IN_PYRAMID_BAG) == TRUE) { return CheckPyramidBagHasSpace(itemId, count); } @@ -243,7 +243,7 @@ bool8 AddBagItem(u16 itemId, u16 count) return FALSE; // check Battle Pyramid Bag - if (InBattlePyramid() || FlagGet(FLAG_STORING_ITEMS_IN_PYRAMID_BAG) == TRUE) + if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE || FlagGet(FLAG_STORING_ITEMS_IN_PYRAMID_BAG) == TRUE) { return AddPyramidBagItem(itemId, count); } @@ -351,7 +351,7 @@ bool8 RemoveBagItem(u16 itemId, u16 count) return FALSE; // check Battle Pyramid Bag - if (InBattlePyramid() || FlagGet(FLAG_STORING_ITEMS_IN_PYRAMID_BAG) == TRUE) + if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE || FlagGet(FLAG_STORING_ITEMS_IN_PYRAMID_BAG) == TRUE) { return RemovePyramidBagItem(itemId, count); } diff --git a/src/item_menu.c b/src/item_menu.c index a1323a6386..e5e3e88f4e 100755 --- a/src/item_menu.c +++ b/src/item_menu.c @@ -565,7 +565,7 @@ void CB2_BagMenuFromStartMenu(void) void CB2_BagMenuFromBattle(void) { - if (!InBattlePyramid()) + if (CurrentBattlePyramidLocation() == PYRAMID_LOCATION_NONE) GoToBagMenu(ITEMMENULOCATION_BATTLE, POCKETS_COUNT, CB2_SetUpReshowBattleScreenAfterMenu2); else GoToBattlePyramidBagMenu(PYRAMIDBAG_LOC_BATTLE, CB2_SetUpReshowBattleScreenAfterMenu2); @@ -2036,7 +2036,7 @@ bool8 UseRegisteredKeyItemOnField(void) { u8 taskId; - if (InUnionRoom() == TRUE || InBattlePyramid() || InBattlePike() || InMultiPartnerRoom() == TRUE) + if (InUnionRoom() == TRUE || CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE || InBattlePike() || InMultiPartnerRoom() == TRUE) return FALSE; HideMapNamePopUpWindow(); ChangeBgY_ScreenOff(0, 0, BG_COORD_SET); diff --git a/src/item_use.c b/src/item_use.c index 671720be21..6ae235675a 100755 --- a/src/item_use.c +++ b/src/item_use.c @@ -102,7 +102,7 @@ static void SetUpItemUseCallback(u8 taskId) type = gTasks[taskId].tEnigmaBerryType - 1; else type = GetItemType(gSpecialVar_ItemId) - 1; - if (!InBattlePyramid()) + if (CurrentBattlePyramidLocation() == PYRAMID_LOCATION_NONE) { gBagMenu->newScreenCallback = sItemUseCallbacks[type]; Task_FadeAndCloseBagMenu(taskId); @@ -144,7 +144,7 @@ static void DisplayCannotUseItemMessage(u8 taskId, bool8 isUsingRegisteredKeyIte StringExpandPlaceholders(gStringVar4, str); if (!isUsingRegisteredKeyItemOnField) { - if (!InBattlePyramid()) + if (CurrentBattlePyramidLocation() == PYRAMID_LOCATION_NONE) DisplayItemMessage(taskId, FONT_NORMAL, gStringVar4, CloseItemMessage); else DisplayItemMessageInBattlePyramid(taskId, gText_DadsAdvice, Task_CloseBattlePyramidBagMessage); @@ -826,7 +826,7 @@ static void RemoveUsedItem(void) RemoveBagItem(gSpecialVar_ItemId, 1); CopyItemName(gSpecialVar_ItemId, gStringVar2); StringExpandPlaceholders(gStringVar4, gText_PlayerUsedVar2); - if (!InBattlePyramid()) + if (CurrentBattlePyramidLocation() == PYRAMID_LOCATION_NONE) { UpdatePocketItemList(GetItemPocket(gSpecialVar_ItemId)); UpdatePocketListPosition(GetItemPocket(gSpecialVar_ItemId)); @@ -842,7 +842,7 @@ void ItemUseOutOfBattle_Repel(u8 taskId) { if (VarGet(VAR_REPEL_STEP_COUNT) == 0) gTasks[taskId].func = Task_StartUseRepel; - else if (!InBattlePyramid()) + else if (CurrentBattlePyramidLocation() == PYRAMID_LOCATION_NONE) DisplayItemMessage(taskId, FONT_NORMAL, gText_RepelEffectsLingered, CloseItemMessage); else DisplayItemMessageInBattlePyramid(taskId, gText_RepelEffectsLingered, Task_CloseBattlePyramidBagMessage); @@ -866,7 +866,7 @@ static void Task_UseRepel(u8 taskId) { VarSet(VAR_REPEL_STEP_COUNT, GetItemHoldEffectParam(gSpecialVar_ItemId)); RemoveUsedItem(); - if (!InBattlePyramid()) + if (CurrentBattlePyramidLocation() == PYRAMID_LOCATION_NONE) DisplayItemMessage(taskId, FONT_NORMAL, gStringVar4, CloseItemMessage); else DisplayItemMessageInBattlePyramid(taskId, gStringVar4, Task_CloseBattlePyramidBagMessage); @@ -878,7 +878,7 @@ static void Task_UsedBlackWhiteFlute(u8 taskId) if(++gTasks[taskId].data[8] > 7) { PlaySE(SE_GLASS_FLUTE); - if (!InBattlePyramid()) + if (CurrentBattlePyramidLocation() == PYRAMID_LOCATION_NONE) DisplayItemMessage(taskId, FONT_NORMAL, gStringVar4, CloseItemMessage); else DisplayItemMessageInBattlePyramid(taskId, gStringVar4, Task_CloseBattlePyramidBagMessage); @@ -951,12 +951,12 @@ void ItemUseInBattle_PokeBall(u8 taskId) if (IsPlayerPartyAndPokemonStorageFull() == FALSE) // have room for mon? { RemoveBagItem(gSpecialVar_ItemId, 1); - if (!InBattlePyramid()) + if (CurrentBattlePyramidLocation() == PYRAMID_LOCATION_NONE) Task_FadeAndCloseBagMenu(taskId); else CloseBattlePyramidBag(taskId); } - else if (!InBattlePyramid()) + else if (CurrentBattlePyramidLocation() == PYRAMID_LOCATION_NONE) { DisplayItemMessage(taskId, FONT_NORMAL, gText_BoxFull, CloseItemMessage); } @@ -970,7 +970,7 @@ static void Task_CloseStatIncreaseMessage(u8 taskId) { if (JOY_NEW(A_BUTTON | B_BUTTON)) { - if (!InBattlePyramid()) + if (CurrentBattlePyramidLocation() == PYRAMID_LOCATION_NONE) Task_FadeAndCloseBagMenu(taskId); else CloseBattlePyramidBag(taskId); @@ -983,7 +983,7 @@ static void Task_UseStatIncreaseItem(u8 taskId) { PlaySE(SE_USE_ITEM); RemoveBagItem(gSpecialVar_ItemId, 1); - if (!InBattlePyramid()) + if (CurrentBattlePyramidLocation() == PYRAMID_LOCATION_NONE) DisplayItemMessage(taskId, FONT_NORMAL, UseStatIncreaseItem(gSpecialVar_ItemId), Task_CloseStatIncreaseMessage); else DisplayItemMessageInBattlePyramid(taskId, UseStatIncreaseItem(gSpecialVar_ItemId), Task_CloseStatIncreaseMessage); @@ -997,7 +997,7 @@ void ItemUseInBattle_StatIncrease(u8 taskId) if (ExecuteTableBasedItemEffect(&gPlayerParty[partyId], gSpecialVar_ItemId, partyId, 0) != FALSE) { - if (!InBattlePyramid()) + if (CurrentBattlePyramidLocation() == PYRAMID_LOCATION_NONE) DisplayItemMessage(taskId, FONT_NORMAL, gText_WontHaveEffect, CloseItemMessage); else DisplayItemMessageInBattlePyramid(taskId, gText_WontHaveEffect, Task_CloseBattlePyramidBagMessage); @@ -1011,7 +1011,7 @@ void ItemUseInBattle_StatIncrease(u8 taskId) static void ItemUseInBattle_ShowPartyMenu(u8 taskId) { - if (!InBattlePyramid()) + if (CurrentBattlePyramidLocation() == PYRAMID_LOCATION_NONE) { gBagMenu->newScreenCallback = ChooseMonForInBattleItem; Task_FadeAndCloseBagMenu(taskId); @@ -1049,7 +1049,7 @@ void ItemUseInBattle_Escape(u8 taskId) if((gBattleTypeFlags & BATTLE_TYPE_TRAINER) == FALSE) { RemoveUsedItem(); - if (!InBattlePyramid()) + if (CurrentBattlePyramidLocation() == PYRAMID_LOCATION_NONE) DisplayItemMessage(taskId, FONT_NORMAL, gStringVar4, Task_FadeAndCloseBagMenu); else DisplayItemMessageInBattlePyramid(taskId, gStringVar4, CloseBattlePyramidBag); diff --git a/src/map_name_popup.c b/src/map_name_popup.c index a99c23ae62..4b30068f3c 100644 --- a/src/map_name_popup.c +++ b/src/map_name_popup.c @@ -339,7 +339,7 @@ static void ShowMapNamePopUpWindow(void) u8 x; const u8 *mapDisplayHeaderSource; - if (InBattlePyramid()) + if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE) { if (gMapHeader.mapLayoutId == LAYOUT_BATTLE_FRONTIER_BATTLE_PYRAMID_TOP) { diff --git a/src/party_menu.c b/src/party_menu.c index b0397c79ae..7cde1a018c 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -3092,7 +3092,7 @@ static void CursorCb_Give(u8 taskId) static void CB2_SelectBagItemToGive(void) { - if (InBattlePyramid() == FALSE) + if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE == FALSE) GoToBagMenu(ITEMMENULOCATION_PARTY, POCKETS_COUNT, CB2_GiveHoldItem); else GoToBattlePyramidBagMenu(PYRAMIDBAG_LOC_PARTY, CB2_GiveHoldItem); @@ -4275,7 +4275,7 @@ void CB2_ShowPartyMenuForItemUse(void) static void CB2_ReturnToBagMenu(void) { - if (InBattlePyramid() == FALSE) + if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE == FALSE) GoToBagMenu(ITEMMENULOCATION_LAST, POCKETS_COUNT, NULL); else GoToBattlePyramidBagMenu(PYRAMIDBAG_LOC_PREV, gPyramidBagMenuState.exitCallback); @@ -5358,7 +5358,7 @@ void CB2_PartyMenuFromStartMenu(void) // As opposted to by selecting Give in the party menu, which is handled by CursorCb_Give void CB2_ChooseMonToGiveItem(void) { - MainCallback callback = (InBattlePyramid() == FALSE) ? CB2_ReturnToBagMenu : CB2_ReturnToPyramidBagMenu; + MainCallback callback = (CurrentBattlePyramidLocation() == PYRAMID_LOCATION_NONE) ? CB2_ReturnToBagMenu : CB2_ReturnToPyramidBagMenu; InitPartyMenu(PARTY_MENU_TYPE_FIELD, PARTY_LAYOUT_SINGLE, PARTY_ACTION_GIVE_ITEM, FALSE, PARTY_MSG_GIVE_TO_WHICH_MON, Task_HandleChooseMonInput, callback); gPartyMenu.bagItem = gSpecialVar_ItemId; } diff --git a/src/pokemon.c b/src/pokemon.c index ebf36f9b90..a06693dc8a 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -5840,7 +5840,7 @@ s32 GetBattlerMultiplayerId(u16 id) u8 GetTrainerEncounterMusicId(u16 trainerOpponentId) { - if (InBattlePyramid()) + if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE) return GetTrainerEncounterMusicIdInBattlePyramid(trainerOpponentId); else if (InTrainerHillChallenge()) return GetTrainerEncounterMusicIdInTrainerHill(trainerOpponentId); @@ -6970,7 +6970,7 @@ static bool8 ShouldSkipFriendshipChange(void) { if (gMain.inBattle && gBattleTypeFlags & (BATTLE_TYPE_FRONTIER)) return TRUE; - if (!gMain.inBattle && (InBattlePike() || InBattlePyramid())) + if (!gMain.inBattle && (InBattlePike() || CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE)) return TRUE; return FALSE; } diff --git a/src/start_menu.c b/src/start_menu.c index 0910fad84d..13a46c51c6 100644 --- a/src/start_menu.c +++ b/src/start_menu.c @@ -293,7 +293,7 @@ static void BuildStartMenuActions(void) { BuildBattlePikeStartMenu(); } - else if (InBattlePyramid()) + else if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE) { BuildBattlePyramidStartMenu(); } @@ -439,7 +439,7 @@ static void RemoveExtraStartMenuWindows(void) CopyWindowToVram(sSafariBallsWindowId, COPYWIN_GFX); RemoveWindow(sSafariBallsWindowId); } - if (InBattlePyramid()) + if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE) { ClearStdWindowAndFrameToTransparent(sBattlePyramidFloorWindowId, FALSE); RemoveWindow(sBattlePyramidFloorWindowId); @@ -499,7 +499,7 @@ static bool32 InitStartMenuStep(void) case 3: if (GetSafariZoneFlag()) ShowSafariBallsWindow(); - if (InBattlePyramid()) + if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE) ShowPyramidFloorWindow(); sInitStartMenuData[0]++; break; @@ -720,7 +720,7 @@ static bool8 StartMenuPlayerNameCallback(void) static bool8 StartMenuSaveCallback(void) { - if (InBattlePyramid()) + if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE) RemoveExtraStartMenuWindows(); gMenuCallback = SaveStartCallback; // Display save menu @@ -981,7 +981,7 @@ static u8 SaveConfirmSaveCallback(void) RemoveStartMenuWindow(); ShowSaveInfoWindow(); - if (InBattlePyramid()) + if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE) { ShowSaveMessage(gText_BattlePyramidConfirmRest, SaveYesNoCallback); } diff --git a/src/trainer_see.c b/src/trainer_see.c index c38c82ca2e..f7b19aa8d9 100644 --- a/src/trainer_see.c +++ b/src/trainer_see.c @@ -256,7 +256,7 @@ static u8 CheckTrainer(u8 objectEventId) else scriptPtr = GetObjectEventScriptPointerByObjectEventId(objectEventId); - if (InBattlePyramid()) + if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE) { if (GetBattlePyramidTrainerFlag(objectEventId)) return 0; diff --git a/src/wild_encounter.c b/src/wild_encounter.c index 9c74dfe965..7ac9ae0e8f 100644 --- a/src/wild_encounter.c +++ b/src/wild_encounter.c @@ -851,7 +851,7 @@ bool8 UpdateRepelCounter(void) { u16 steps; - if (InBattlePike() || InBattlePyramid()) + if (InBattlePike() || CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE) return FALSE; if (InUnionRoom() == TRUE) return FALSE;