Skip to content

Commit

Permalink
Stick to the new name
Browse files Browse the repository at this point in the history
  • Loading branch information
AsparagusEduardo committed Dec 6, 2024
1 parent 720b2da commit 29ef1cf
Show file tree
Hide file tree
Showing 16 changed files with 52 additions and 57 deletions.
5 changes: 0 additions & 5 deletions include/battle_pyramid.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,4 @@ void LoadBattlePyramidFloorObjectEventScripts(void);
u8 GetNumBattlePyramidObjectEvents(void);
u16 GetBattlePyramidPickupItemId(void);

static inline bool8 InBattlePyramid()
{
return (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE);
}

#endif // GUARD_BATTLE_PYRAMID_H
4 changes: 2 additions & 2 deletions src/battle_pyramid.c
Original file line number Diff line number Diff line change
Expand Up @@ -1437,7 +1437,7 @@ bool8 InBattlePyramid_(void)

void PausePyramidChallenge(void)
{
if (InBattlePyramid())
if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE)
{
RestorePyramidPlayerParty();
gSaveBlock2Ptr->frontier.challengeStatus = CHALLENGE_STATUS_PAUSED;
Expand All @@ -1448,7 +1448,7 @@ void PausePyramidChallenge(void)

void SoftResetInBattlePyramid(void)
{
if (InBattlePyramid())
if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE)
DoSoftReset();
}

Expand Down
2 changes: 1 addition & 1 deletion src/battle_script_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -9615,7 +9615,7 @@ static void Cmd_pickup(void)
{

}
else if (InBattlePyramid())
else if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE)
{
for (i = 0; i < PARTY_SIZE; i++)
{
Expand Down
24 changes: 12 additions & 12 deletions src/battle_setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,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;
Expand Down Expand Up @@ -465,7 +465,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);
Expand Down Expand Up @@ -603,7 +603,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);
}
Expand All @@ -621,7 +621,7 @@ static void CB2_EndScriptedWildBattle(void)

if (IsPlayerDefeated(gBattleOutcome) == TRUE)
{
if (InBattlePyramid())
if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE)
SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic);
else
SetMainCallback2(CB2_WhiteOut);
Expand Down Expand Up @@ -794,14 +794,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];
Expand Down Expand Up @@ -1233,7 +1233,7 @@ u8 GetTrainerBattleMode(void)

bool8 GetTrainerFlag(void)
{
if (InBattlePyramid())
if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE)
return GetBattlePyramidTrainerFlag(gSelectedObjectEvent);
else if (InTrainerHill())
return GetHillTrainerFlag(gSelectedObjectEvent);
Expand Down Expand Up @@ -1275,7 +1275,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;
Expand Down Expand Up @@ -1315,7 +1315,7 @@ void BattleSetup_StartTrainerBattle(void)
gWhichTrainerToFaceAfterBattle = 0;
gMain.savedCallback = CB2_EndTrainerBattle;

if (InBattlePyramid() || InTrainerHillChallenge())
if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE || InTrainerHillChallenge())
DoBattlePyramidTrainerHillBattle();
else
DoTrainerBattle();
Expand All @@ -1331,15 +1331,15 @@ 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);
}
else
{
SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic);
if (!InBattlePyramid() && !InTrainerHillChallenge())
if (CurrentBattlePyramidLocation() == PYRAMID_LOCATION_NONE && !InTrainerHillChallenge())
{
RegisterTrainerInMatchCall();
SetBattledTrainersFlags();
Expand Down Expand Up @@ -1376,7 +1376,7 @@ void BattleSetup_StartRematchBattle(void)

void ShowTrainerIntroSpeech(void)
{
if (InBattlePyramid())
if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE)
{
if (gNoOfApproachingTrainers == 0 || gNoOfApproachingTrainers == 1)
CopyPyramidTrainerSpeechBefore(LocalIdToPyramidTrainerId(gSpecialVar_LastTalked));
Expand Down
4 changes: 2 additions & 2 deletions src/battle_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/event_object_movement.c
Original file line number Diff line number Diff line change
Expand Up @@ -1327,7 +1327,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;
Expand Down Expand Up @@ -1643,7 +1643,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;
Expand Down
2 changes: 1 addition & 1 deletion src/field_poison.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ 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() != PYRAMID_LOCATION_NONE || InBattlePike() || InTrainerHillChallenge())
#else
if (CurrentBattlePyramidLocation() | InBattlePike() || InTrainerHillChallenge())
#endif
Expand Down
8 changes: 4 additions & 4 deletions src/item.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ bool8 CheckBagHasItem(u16 itemId, u16 count)

if (ItemId_GetPocket(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 = ItemId_GetPocket(itemId) - 1;
// Check for item slots that contain the item
Expand Down Expand Up @@ -181,7 +181,7 @@ bool8 CheckBagHasSpace(u16 itemId, u16 count)
if (ItemId_GetPocket(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);
}
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions src/item_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
26 changes: 13 additions & 13 deletions src/item_use.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ static void SetUpItemUseCallback(u8 taskId)
type = gTasks[taskId].tEnigmaBerryType - 1;
else
type = ItemId_GetType(gSpecialVar_ItemId) - 1;
if (!InBattlePyramid())
if (CurrentBattlePyramidLocation() == PYRAMID_LOCATION_NONE)
{
gBagMenu->newScreenCallback = sItemUseCallbacks[type];
Task_FadeAndCloseBagMenu(taskId);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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(ItemId_GetPocket(gSpecialVar_ItemId));
UpdatePocketListPosition(ItemId_GetPocket(gSpecialVar_ItemId));
Expand All @@ -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);
Expand All @@ -866,7 +866,7 @@ static void Task_UseRepel(u8 taskId)
{
VarSet(VAR_REPEL_STEP_COUNT, ItemId_GetHoldEffectParam(gSpecialVar_ItemId));
RemoveUsedItem();
if (!InBattlePyramid())
if (CurrentBattlePyramidLocation() == PYRAMID_LOCATION_NONE)
DisplayItemMessage(taskId, FONT_NORMAL, gStringVar4, CloseItemMessage);
else
DisplayItemMessageInBattlePyramid(taskId, gStringVar4, Task_CloseBattlePyramidBagMessage);
Expand All @@ -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);
Expand Down Expand Up @@ -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);
}
Expand All @@ -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);
Expand All @@ -983,7 +983,7 @@ static void Task_UseStatIncreaseItem(u8 taskId)
{
PlaySE(SE_USE_ITEM);
RemoveBagItem(gSpecialVar_ItemId, 1);
if (CurrentBattlePyramidLocation() == PYRAMID_LOCATION_NONE) // !InBattlePyramid() doesn't match
if (CurrentBattlePyramidLocation() == PYRAMID_LOCATION_NONE) // CurrentBattlePyramidLocation() == PYRAMID_LOCATION_NONE doesn't match
DisplayItemMessage(taskId, FONT_NORMAL, UseStatIncreaseItem(gSpecialVar_ItemId), Task_CloseStatIncreaseMessage);
else
DisplayItemMessageInBattlePyramid(taskId, UseStatIncreaseItem(gSpecialVar_ItemId), Task_CloseStatIncreaseMessage);
Expand All @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/map_name_popup.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,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)
{
Expand Down
6 changes: 3 additions & 3 deletions src/party_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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()) ? 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;
}
Expand Down
Loading

0 comments on commit 29ef1cf

Please sign in to comment.