summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/apprentice.c4
-rw-r--r--src/battle_controller_link_opponent.c7
-rw-r--r--src/battle_controller_link_partner.c11
-rw-r--r--src/battle_controller_opponent.c6
-rw-r--r--src/battle_controller_player.c6
-rw-r--r--src/battle_controller_player_partner.c6
-rw-r--r--src/battle_controller_recorded_opponent.c6
-rw-r--r--src/battle_controller_recorded_player.c6
-rw-r--r--src/battle_controller_safari.c8
-rw-r--r--src/battle_controller_wally.c8
-rw-r--r--src/battle_dome.c2
-rw-r--r--src/battle_factory_screen.c50
-rw-r--r--src/battle_interface.c2
-rw-r--r--src/battle_main.c2
-rw-r--r--src/battle_message.c94
-rw-r--r--src/battle_pyramid_bag.c33
-rw-r--r--src/battle_records.c8
-rw-r--r--src/battle_script_commands.c8
-rw-r--r--src/battle_setup.c2
-rw-r--r--src/battle_tower.c6
-rw-r--r--src/battle_util.c30
-rw-r--r--src/berry_blender.c16
-rw-r--r--src/berry_fix_program.c8
-rw-r--r--src/berry_tag_screen.c14
-rw-r--r--src/cable_club.c4
-rw-r--r--src/clear_save_data_screen.c6
-rw-r--r--src/coins.c6
-rw-r--r--src/contest.c14
-rw-r--r--src/contest_link_80F57C4.c2
-rw-r--r--src/contest_painting.c2
-rw-r--r--src/credits.c2
-rw-r--r--src/daycare.c6
-rw-r--r--src/decoration.c50
-rw-r--r--src/diploma.c2
-rw-r--r--src/easy_chat.c16
-rw-r--r--src/egg_hatch.c4
-rw-r--r--src/event_data.c22
-rw-r--r--src/field_control_avatar.c14
-rw-r--r--src/field_effect.c2
-rwxr-xr-xsrc/field_message_box.c6
-rw-r--r--src/field_player_avatar.c10
-rw-r--r--src/field_region_map.c8
-rw-r--r--src/field_specials.c149
-rw-r--r--src/fldeff_misc.c10
-rw-r--r--src/fldeff_softboiled.c2
-rw-r--r--src/flying.c1409
-rw-r--r--src/frontier_pass.c8
-rw-r--r--src/frontier_util.c38
-rw-r--r--src/hall_of_fame.c18
-rw-r--r--src/item.c4
-rwxr-xr-xsrc/item_menu.c39
-rwxr-xr-xsrc/item_use.c4
-rw-r--r--src/learn_move.c6
-rw-r--r--src/link.c8
-rw-r--r--src/list_menu.c20
-rw-r--r--src/load_save.c2
-rw-r--r--src/lottery_corner.c2
-rw-r--r--src/mail.c4
-rw-r--r--src/main.c14
-rw-r--r--src/main_menu.c217
-rw-r--r--src/map_name_popup.c4
-rw-r--r--src/match_call.c8
-rw-r--r--src/mauville_old_man.c2
-rw-r--r--src/menu.c123
-rw-r--r--src/menu_helpers.c2
-rw-r--r--src/mirage_tower.c2
-rw-r--r--src/money.c6
-rw-r--r--src/mystery_event_menu.c8
-rw-r--r--src/naming_screen.c14
-rw-r--r--src/option_menu.c4
-rw-r--r--src/overworld.c44
-rwxr-xr-xsrc/party_menu.c25
-rw-r--r--src/player_pc.c30
-rw-r--r--src/pokeblock.c12
-rw-r--r--src/pokeblock_feed.c4
-rw-r--r--src/pokedex.c14
-rw-r--r--src/pokemon_storage_system.c52
-rw-r--r--src/pokemon_summary_screen.c30
-rw-r--r--src/pokenav.c4
-rw-r--r--src/record_mixing.c4
-rw-r--r--src/region_map.c26
-rw-r--r--src/reset_rtc_screen.c10
-rw-r--r--src/rom_8011DC0.c24
-rw-r--r--src/roulette.c40
-rw-r--r--src/save.c6
-rw-r--r--src/save_failed_screen.c20
-rw-r--r--src/scrcmd.c8
-rw-r--r--src/script_menu.c16
-rw-r--r--src/secret_base.c166
-rwxr-xr-xsrc/shop.c20
-rw-r--r--src/siirtc.c8
-rw-r--r--src/slot_machine.c22
-rw-r--r--src/start_menu.c46
-rw-r--r--src/starter_choose.c8
-rw-r--r--src/text.c8
-rw-r--r--src/time_events.c2
-rw-r--r--src/trade.c18
-rw-r--r--src/trader.c4
-rwxr-xr-xsrc/trainer_card.c12
-rw-r--r--src/trainer_hill.c88
-rw-r--r--src/tv.c26
-rw-r--r--src/unk_text_util_2.c8
-rw-r--r--src/wallclock.c4
-rw-r--r--src/window.c9
104 files changed, 2471 insertions, 993 deletions
diff --git a/src/apprentice.c b/src/apprentice.c
index 9cf8cd4b4..27ff8e36e 100644
--- a/src/apprentice.c
+++ b/src/apprentice.c
@@ -1619,7 +1619,7 @@ static u8 CreateAndShowWindow(u8 left, u8 top, u8 width, u8 height)
static void RemoveAndHideWindow(u8 windowId)
{
- sub_8198070(windowId, TRUE);
+ ClearStdWindowAndFrameToTransparent(windowId, TRUE);
RemoveWindow(windowId);
}
@@ -1826,7 +1826,7 @@ static void Script_PrintMessage(void)
FreezeEventObjects();
sub_808B864();
sub_808BCF4();
- NewMenuHelpers_DrawDialogueFrame(0, 1);
+ DrawDialogueFrame(0, 1);
PrintMessage();
}
diff --git a/src/battle_controller_link_opponent.c b/src/battle_controller_link_opponent.c
index 6c0f81d41..23d469c27 100644
--- a/src/battle_controller_link_opponent.c
+++ b/src/battle_controller_link_opponent.c
@@ -16,6 +16,7 @@
#include "palette.h"
#include "pokeball.h"
#include "pokemon.h"
+#include "recorded_battle.h"
#include "reshow_battle_screen.h"
#include "sound.h"
#include "string_util.h"
@@ -89,7 +90,7 @@ static void LinkOpponentHandleBattleAnimation(void);
static void LinkOpponentHandleLinkStandbyMsg(void);
static void LinkOpponentHandleResetActionMoveSelection(void);
static void LinkOpponentHandleCmd55(void);
-static void nullsub_92(void);
+static void LinkOpponentCmdEnd(void);
static void LinkOpponentBufferRunCommand(void);
static void LinkOpponentBufferExecCompleted(void);
@@ -161,7 +162,7 @@ static void (*const sLinkOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
LinkOpponentHandleLinkStandbyMsg,
LinkOpponentHandleResetActionMoveSelection,
LinkOpponentHandleCmd55,
- nullsub_92
+ LinkOpponentCmdEnd
};
static void nullsub_28(void)
@@ -1854,6 +1855,6 @@ static void LinkOpponentHandleCmd55(void)
gBattlerControllerFuncs[gActiveBattler] = sub_80587B0;
}
-static void nullsub_92(void)
+static void LinkOpponentCmdEnd(void)
{
}
diff --git a/src/battle_controller_link_partner.c b/src/battle_controller_link_partner.c
index 59fc2aae5..22633c5bc 100644
--- a/src/battle_controller_link_partner.c
+++ b/src/battle_controller_link_partner.c
@@ -16,6 +16,7 @@
#include "palette.h"
#include "pokeball.h"
#include "pokemon.h"
+#include "recorded_battle.h"
#include "reshow_battle_screen.h"
#include "sound.h"
#include "string_util.h"
@@ -88,7 +89,7 @@ static void LinkPartnerHandleBattleAnimation(void);
static void LinkPartnerHandleLinkStandbyMsg(void);
static void LinkPartnerHandleResetActionMoveSelection(void);
static void LinkPartnerHandleCmd55(void);
-static void nullsub_113(void);
+static void LinkPartnerCmdEnd(void);
static void LinkPartnerBufferRunCommand(void);
static void LinkPartnerBufferExecCompleted(void);
@@ -159,10 +160,10 @@ static void (*const sLinkPartnerBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
LinkPartnerHandleLinkStandbyMsg,
LinkPartnerHandleResetActionMoveSelection,
LinkPartnerHandleCmd55,
- nullsub_113
+ LinkPartnerCmdEnd
};
-static void nullsub_112(void)
+static void SpriteCB_Null2(void)
{
}
@@ -1562,7 +1563,7 @@ static void LinkPartnerHandleIntroTrainerBallThrow(void)
gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = Task_HidePartyStatusSummary;
gBattleSpritesDataPtr->animationData->field_9_x1 = 1;
- gBattlerControllerFuncs[gActiveBattler] = nullsub_112;
+ gBattlerControllerFuncs[gActiveBattler] = SpriteCB_Null2;
}
static void sub_814DCCC(u8 taskId)
@@ -1685,6 +1686,6 @@ static void LinkPartnerHandleCmd55(void)
gBattlerControllerFuncs[gActiveBattler] = sub_80587B0;
}
-static void nullsub_113(void)
+static void LinkPartnerCmdEnd(void)
{
}
diff --git a/src/battle_controller_opponent.c b/src/battle_controller_opponent.c
index 9fee8134d..7d940cb89 100644
--- a/src/battle_controller_opponent.c
+++ b/src/battle_controller_opponent.c
@@ -95,7 +95,7 @@ static void OpponentHandleBattleAnimation(void);
static void OpponentHandleLinkStandbyMsg(void);
static void OpponentHandleResetActionMoveSelection(void);
static void OpponentHandleCmd55(void);
-static void nullsub_91(void);
+static void OpponentCmdEnd(void);
static void OpponentBufferRunCommand(void);
static void OpponentBufferExecCompleted(void);
@@ -167,7 +167,7 @@ static void (*const sOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
OpponentHandleLinkStandbyMsg,
OpponentHandleResetActionMoveSelection,
OpponentHandleCmd55,
- nullsub_91
+ OpponentCmdEnd
};
// unknown unused data
@@ -2001,6 +2001,6 @@ static void OpponentHandleCmd55(void)
OpponentBufferExecCompleted();
}
-static void nullsub_91(void)
+static void OpponentCmdEnd(void)
{
}
diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c
index 42d29dbbd..b377ecf64 100644
--- a/src/battle_controller_player.c
+++ b/src/battle_controller_player.c
@@ -95,7 +95,7 @@ static void PlayerHandleBattleAnimation(void);
static void PlayerHandleLinkStandbyMsg(void);
static void PlayerHandleResetActionMoveSelection(void);
static void PlayerHandleCmd55(void);
-static void nullsub_22(void);
+static void PlayerCmdEnd(void);
static void PlayerBufferRunCommand(void);
static void HandleInputChooseTarget(void);
@@ -182,7 +182,7 @@ static void (*const sPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
PlayerHandleLinkStandbyMsg,
PlayerHandleResetActionMoveSelection,
PlayerHandleCmd55,
- nullsub_22
+ PlayerCmdEnd
};
static const u8 sTargetIdentities[] = {B_POSITION_PLAYER_LEFT, B_POSITION_PLAYER_RIGHT, B_POSITION_OPPONENT_RIGHT, B_POSITION_OPPONENT_LEFT};
@@ -3101,6 +3101,6 @@ static void PlayerHandleCmd55(void)
gBattlerControllerFuncs[gActiveBattler] = sub_80587B0;
}
-static void nullsub_22(void)
+static void PlayerCmdEnd(void)
{
}
diff --git a/src/battle_controller_player_partner.c b/src/battle_controller_player_partner.c
index 95a3f698b..2c53938c1 100644
--- a/src/battle_controller_player_partner.c
+++ b/src/battle_controller_player_partner.c
@@ -87,7 +87,7 @@ static void PlayerPartnerHandleBattleAnimation(void);
static void PlayerPartnerHandleLinkStandbyMsg(void);
static void PlayerPartnerHandleResetActionMoveSelection(void);
static void PlayerPartnerHandleCmd55(void);
-static void nullsub_128(void);
+static void PlayerPartnerCmdEnd(void);
static void PlayerPartnerBufferRunCommand(void);
static void PlayerPartnerBufferExecCompleted(void);
@@ -164,7 +164,7 @@ static void (*const sPlayerPartnerBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
PlayerPartnerHandleLinkStandbyMsg,
PlayerPartnerHandleResetActionMoveSelection,
PlayerPartnerHandleCmd55,
- nullsub_128
+ PlayerPartnerCmdEnd
};
// unknown unused data
@@ -1925,6 +1925,6 @@ static void PlayerPartnerHandleCmd55(void)
gBattlerControllerFuncs[gActiveBattler] = sub_80587B0;
}
-static void nullsub_128(void)
+static void PlayerPartnerCmdEnd(void)
{
}
diff --git a/src/battle_controller_recorded_opponent.c b/src/battle_controller_recorded_opponent.c
index c66a1b49c..e43c5f8ae 100644
--- a/src/battle_controller_recorded_opponent.c
+++ b/src/battle_controller_recorded_opponent.c
@@ -90,7 +90,7 @@ static void RecordedOpponentHandleBattleAnimation(void);
static void RecordedOpponentHandleLinkStandbyMsg(void);
static void RecordedOpponentHandleResetActionMoveSelection(void);
static void RecordedOpponentHandleCmd55(void);
-static void nullsub_119(void);
+static void RecordedOpponentCmdEnd(void);
static void RecordedOpponentBufferRunCommand(void);
static void RecordedOpponentBufferExecCompleted(void);
@@ -162,7 +162,7 @@ static void (*const sRecordedOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void
RecordedOpponentHandleLinkStandbyMsg,
RecordedOpponentHandleResetActionMoveSelection,
RecordedOpponentHandleCmd55,
- nullsub_119
+ RecordedOpponentCmdEnd
};
static void nullsub_70(void)
@@ -1788,6 +1788,6 @@ static void RecordedOpponentHandleCmd55(void)
gBattlerControllerFuncs[gActiveBattler] = sub_80587B0;
}
-static void nullsub_119(void)
+static void RecordedOpponentCmdEnd(void)
{
}
diff --git a/src/battle_controller_recorded_player.c b/src/battle_controller_recorded_player.c
index cc40f159a..412c49f17 100644
--- a/src/battle_controller_recorded_player.c
+++ b/src/battle_controller_recorded_player.c
@@ -87,7 +87,7 @@ static void RecordedPlayerHandleBattleAnimation(void);
static void RecordedPlayerHandleLinkStandbyMsg(void);
static void RecordedPlayerHandleResetActionMoveSelection(void);
static void RecordedPlayerHandleCmd55(void);
-static void nullsub_121(void);
+static void RecordedPlayerCmdEnd(void);
static void RecordedPlayerBufferRunCommand(void);
static void RecordedPlayerBufferExecCompleted(void);
@@ -158,7 +158,7 @@ static void (*const sRecordedPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void)
RecordedPlayerHandleLinkStandbyMsg,
RecordedPlayerHandleResetActionMoveSelection,
RecordedPlayerHandleCmd55,
- nullsub_121
+ RecordedPlayerCmdEnd
};
static void nullsub_120(void)
@@ -1806,6 +1806,6 @@ static void RecordedPlayerHandleCmd55(void)
gBattlerControllerFuncs[gActiveBattler] = sub_80587B0;
}
-static void nullsub_121(void)
+static void RecordedPlayerCmdEnd(void)
{
}
diff --git a/src/battle_controller_safari.c b/src/battle_controller_safari.c
index b0173df68..e9da16252 100644
--- a/src/battle_controller_safari.c
+++ b/src/battle_controller_safari.c
@@ -82,7 +82,7 @@ static void SafariHandleBattleAnimation(void);
static void SafariHandleLinkStandbyMsg(void);
static void SafariHandleResetActionMoveSelection(void);
static void SafariHandleCmd55(void);
-static void nullsub_115(void);
+static void SafariCmdEnd(void);
static void SafariBufferRunCommand(void);
static void SafariBufferExecCompleted(void);
@@ -146,10 +146,10 @@ static void (*const sSafariBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
SafariHandleLinkStandbyMsg,
SafariHandleResetActionMoveSelection,
SafariHandleCmd55,
- nullsub_115
+ SafariCmdEnd
};
-static void nullsub_114(void)
+static void SpriteCB_Null4(void)
{
}
@@ -686,6 +686,6 @@ static void SafariHandleCmd55(void)
gBattlerControllerFuncs[gActiveBattler] = sub_81595E4;
}
-static void nullsub_115(void)
+static void SafariCmdEnd(void)
{
}
diff --git a/src/battle_controller_wally.c b/src/battle_controller_wally.c
index a3dc92757..f1b783b21 100644
--- a/src/battle_controller_wally.c
+++ b/src/battle_controller_wally.c
@@ -90,7 +90,7 @@ static void WallyHandleBattleAnimation(void);
static void WallyHandleLinkStandbyMsg(void);
static void WallyHandleResetActionMoveSelection(void);
static void WallyHandleCmd55(void);
-static void nullsub_118(void);
+static void WallyCmdEnd(void);
static void WallyBufferRunCommand(void);
static void WallyBufferExecCompleted(void);
@@ -159,10 +159,10 @@ static void (*const sWallyBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
WallyHandleLinkStandbyMsg,
WallyHandleResetActionMoveSelection,
WallyHandleCmd55,
- nullsub_118
+ WallyCmdEnd
};
-static void nullsub_117(void)
+static void SpriteCB_Null7(void)
{
}
@@ -1557,6 +1557,6 @@ static void WallyHandleCmd55(void)
gBattlerControllerFuncs[gActiveBattler] = sub_80587B0;
}
-static void nullsub_118(void)
+static void WallyCmdEnd(void)
{
}
diff --git a/src/battle_dome.c b/src/battle_dome.c
index bfede1b28..f86faeffb 100644
--- a/src/battle_dome.c
+++ b/src/battle_dome.c
@@ -3794,7 +3794,7 @@ static void sub_8190CD4(u8 taskId)
for (i = windowId; i < windowId + 9; i++)
{
CopyWindowToVram(i, 2);
- FillWindowPixelBuffer(i, 0);
+ FillWindowPixelBuffer(i, PIXEL_FILL(0));
}
gTasks[taskId].data[0] = 3;
break;
diff --git a/src/battle_factory_screen.c b/src/battle_factory_screen.c
index e48dbd30b..85c0b2808 100644
--- a/src/battle_factory_screen.c
+++ b/src/battle_factory_screen.c
@@ -1741,7 +1741,7 @@ static void Select_CopyMonsToPlayerParty(void)
{
gPlayerParty[i] = sFactorySelectScreen->mons[j].monData;
gSaveBlock2Ptr->frontier.rentalMons[i].monId = sFactorySelectScreen->mons[j].monSetId;
- gSaveBlock2Ptr->frontier.rentalMons[i].personality = GetMonData(&gPlayerParty[i].box, MON_DATA_PERSONALITY, NULL);
+ gSaveBlock2Ptr->frontier.rentalMons[i].personality = GetMonData(&gPlayerParty[i], MON_DATA_PERSONALITY, NULL);
gSaveBlock2Ptr->frontier.rentalMons[i].abilityBit = GetBoxMonData(&gPlayerParty[i].box, MON_DATA_ALT_ABILITY, NULL);
gSaveBlock2Ptr->frontier.rentalMons[i].ivs = GetBoxMonData(&gPlayerParty[i].box, MON_DATA_ATK_IV, NULL);
break;
@@ -1786,14 +1786,14 @@ static void sub_819B958(u8 windowId)
{
gSprites[sFactorySelectScreen->menuCursor1SpriteId].invisible = TRUE;
gSprites[sFactorySelectScreen->menuCursor2SpriteId].invisible = TRUE;
- FillWindowPixelBuffer(windowId, 0);
+ FillWindowPixelBuffer(windowId, PIXEL_FILL(0));
CopyWindowToVram(windowId, 2);
ClearWindowTilemap(windowId);
}
static void Select_PrintRentalPkmnString(void)
{
- FillWindowPixelBuffer(0, 0);
+ FillWindowPixelBuffer(0, PIXEL_FILL(0));
AddTextPrinterParameterized(0, 1, gText_RentalPkmn2, 2, 1, 0, NULL);
CopyWindowToVram(0, 3);
}
@@ -1804,7 +1804,7 @@ static void Select_PrintMonSpecies(void)
u8 x;
u8 monId = sFactorySelectScreen->cursorPos;
- FillWindowPixelBuffer(1, 0);
+ FillWindowPixelBuffer(1, PIXEL_FILL(0));
species = GetMonData(&sFactorySelectScreen->mons[monId].monData, MON_DATA_SPECIES, NULL);
StringCopy(gStringVar4, gSpeciesNames[species]);
x = GetStringRightAlignXOffset(1, gStringVar4, 86);
@@ -1816,7 +1816,7 @@ static void Select_PrintSelectMonString(void)
{
const u8 *str = NULL;
- FillWindowPixelBuffer(2, 0);
+ FillWindowPixelBuffer(2, PIXEL_FILL(0));
if (sFactorySelectScreen->selectingMonsState == 1)
str = gText_SelectFirstPkmn;
else if (sFactorySelectScreen->selectingMonsState == 2)
@@ -1832,7 +1832,7 @@ static void Select_PrintSelectMonString(void)
static void Select_PrintCantSelectSameMon(void)
{
- FillWindowPixelBuffer(2, 0);
+ FillWindowPixelBuffer(2, PIXEL_FILL(0));
AddTextPrinterParameterized(2, 1, gText_CantSelectSamePkmn, 2, 5, 0, NULL);
CopyWindowToVram(2, 2);
}
@@ -1842,7 +1842,7 @@ static void Select_PrintMenuOptions(void)
u8 selectedId = sFactorySelectScreen->mons[sFactorySelectScreen->cursorPos].selectedId;
PutWindowTilemap(3);
- FillWindowPixelBuffer(3, 0);
+ FillWindowPixelBuffer(3, PIXEL_FILL(0));
AddTextPrinterParameterized3(3, 1, 7, 1, gUnknown_08610476, 0, gText_Summary);
if (selectedId != 0)
AddTextPrinterParameterized3(3, 1, 7, 17, gUnknown_08610476, 0, gText_Deselect);
@@ -1856,7 +1856,7 @@ static void Select_PrintMenuOptions(void)
static void Select_PrintYesNoOptions(void)
{
PutWindowTilemap(4);
- FillWindowPixelBuffer(4, 0);
+ FillWindowPixelBuffer(4, PIXEL_FILL(0));
AddTextPrinterParameterized3(4, 1, 7, 1, gUnknown_08610476, 0, gText_Yes2);
AddTextPrinterParameterized3(4, 1, 7, 17, gUnknown_08610476, 0, gText_No2);
CopyWindowToVram(4, 3);
@@ -1924,7 +1924,7 @@ static void Select_PrintMonCategory(void)
if (monId < SELECTABLE_MONS_COUNT)
{
PutWindowTilemap(5);
- FillWindowPixelBuffer(5, 0);
+ FillWindowPixelBuffer(5, PIXEL_FILL(0));
species = GetMonData(&sFactorySelectScreen->mons[monId].monData, MON_DATA_SPECIES, NULL);
CopyMonCategoryText(SpeciesToNationalPokedexNum(species), text);
x = GetStringRightAlignXOffset(1, text, 0x76);
@@ -2873,7 +2873,7 @@ static void sub_819D588(u8 taskId)
case 3:
if (!gPaletteFade.active)
{
- FillWindowPixelBuffer(5, 0);
+ FillWindowPixelBuffer(5, PIXEL_FILL(0));
CopyWindowToVram(5, 2);
if (sFactorySwapScreen->inEnemyScreen == TRUE)
{
@@ -3002,7 +3002,7 @@ static void sub_819D770(u8 taskId)
gTasks[taskId].data[0]++;
break;
case 6:
- FillWindowPixelBuffer(5, 0);
+ FillWindowPixelBuffer(5, PIXEL_FILL(0));
CopyWindowToVram(5, 2);
gTasks[taskId].data[0]++;
break;
@@ -3546,7 +3546,7 @@ static void sub_819EA64(u8 windowId)
{
gSprites[sFactorySwapScreen->menuCursor1SpriteId].invisible = TRUE;
gSprites[sFactorySwapScreen->menuCursor2SpriteId].invisible = TRUE;
- FillWindowPixelBuffer(windowId, 0);
+ FillWindowPixelBuffer(windowId, PIXEL_FILL(0));
CopyWindowToVram(windowId, 2);
ClearWindowTilemap(windowId);
}
@@ -3554,14 +3554,14 @@ static void sub_819EA64(u8 windowId)
static void sub_819EAC0(void)
{
PutWindowTilemap(1);
- FillWindowPixelBuffer(1, 0);
+ FillWindowPixelBuffer(1, PIXEL_FILL(0));
CopyWindowToVram(1, 2);
}
static void sub_819EADC(void)
{
PutWindowTilemap(7);
- FillWindowPixelBuffer(7, 0);
+ FillWindowPixelBuffer(7, PIXEL_FILL(0));
CopyWindowToVram(7, 2);
}
@@ -3569,13 +3569,13 @@ static void sub_819EAF8(void)
{
sub_819EAC0();
PutWindowTilemap(5);
- FillWindowPixelBuffer(5, 0);
+ FillWindowPixelBuffer(5, PIXEL_FILL(0));
CopyWindowToVram(5, 2);
}
static void Swap_PrintPkmnSwap(void)
{
- FillWindowPixelBuffer(0, 0x11);
+ FillWindowPixelBuffer(0, PIXEL_FILL(1));
AddTextPrinterParameterized(0, 1, gText_PkmnSwap, 2, 1, 0, NULL);
CopyWindowToVram(0, 3);
}
@@ -3585,7 +3585,7 @@ static void Swap_PrintMonSpecies(void)
u16 species;
u8 x;
- FillWindowPixelBuffer(1, 0);
+ FillWindowPixelBuffer(1, PIXEL_FILL(0));
if (sFactorySwapScreen->cursorPos > 2)
{
CopyWindowToVram(1, 2);
@@ -3606,7 +3606,7 @@ static void Swap_PrintMonSpecies(void)
static void Swap_PrintOnInfoWindow(const u8 *str)
{
- FillWindowPixelBuffer(2, 0);
+ FillWindowPixelBuffer(2, PIXEL_FILL(0));
AddTextPrinterParameterized(2, 1, str, 2, 5, 0, NULL);
CopyWindowToVram(2, 2);
}
@@ -3614,7 +3614,7 @@ static void Swap_PrintOnInfoWindow(const u8 *str)
static void Swap_PrintMenuOptions(void)
{
PutWindowTilemap(3);
- FillWindowPixelBuffer(3, 0);
+ FillWindowPixelBuffer(3, PIXEL_FILL(0));
AddTextPrinterParameterized3(3, 1, 15, 1, gUnknown_08610922, 0, gText_Summary2);
AddTextPrinterParameterized3(3, 1, 15, 17, gUnknown_08610922, 0, gText_Swap);
AddTextPrinterParameterized3(3, 1, 15, 33, gUnknown_08610922, 0, gText_Rechoose);
@@ -3624,7 +3624,7 @@ static void Swap_PrintMenuOptions(void)
static void Swap_PrintYesNoOptions(void)
{
PutWindowTilemap(4);
- FillWindowPixelBuffer(4, 0);
+ FillWindowPixelBuffer(4, PIXEL_FILL(0));
AddTextPrinterParameterized3(4, 1, 7, 1, gUnknown_08610922, 0, gText_Yes3);
AddTextPrinterParameterized3(4, 1, 7, 17, gUnknown_08610922, 0, gText_No3);
CopyWindowToVram(4, 3);
@@ -3638,7 +3638,7 @@ static void Swap_PrintActionString(const u8 *str, u32 y, u32 windowId)
static void Swap_PrintActionStrings(void)
{
- FillWindowPixelBuffer(5, 0);
+ FillWindowPixelBuffer(5, PIXEL_FILL(0));
switch (sFactorySwapScreen->inEnemyScreen)
{
case TRUE:
@@ -3652,7 +3652,7 @@ static void Swap_PrintActionStrings(void)
static void Swap_PrintActionStrings2(void)
{
- FillWindowPixelBuffer(3, 0);
+ FillWindowPixelBuffer(3, PIXEL_FILL(0));
switch (sFactorySwapScreen->inEnemyScreen)
{
case TRUE:
@@ -3693,7 +3693,7 @@ static void Swap_PrintMonSpecies2(void)
LoadPalette(pal, 0xF0, 0xA);
PutWindowTilemap(7);
- FillWindowPixelBuffer(7, 0);
+ FillWindowPixelBuffer(7, PIXEL_FILL(0));
if (sFactorySwapScreen->cursorPos > 2)
{
CopyWindowToVram(7, 3);
@@ -3745,7 +3745,7 @@ static void Swap_PrintMonCategory(void)
u8 x;
u8 monId = sFactorySwapScreen->cursorPos;
- FillWindowPixelBuffer(8, 0);
+ FillWindowPixelBuffer(8, PIXEL_FILL(0));
if (monId > 2)
{
CopyWindowToVram(8, 2);
@@ -3940,7 +3940,7 @@ static void Task_SwapCantHaveSameMons(u8 taskId)
case 2:
if (sFactorySwapScreen->unk30 != TRUE)
{
- FillWindowPixelBuffer(5, 0);
+ FillWindowPixelBuffer(5, PIXEL_FILL(0));
CopyWindowToVram(5, 2);
gTasks[taskId].data[0]++;
}
diff --git a/src/battle_interface.c b/src/battle_interface.c
index 4a6ac67f1..f2916012e 100644
--- a/src/battle_interface.c
+++ b/src/battle_interface.c
@@ -2579,7 +2579,7 @@ static u8* AddTextPrinterAndCreateWindowOnHealthbox(const u8 *str, u32 x, u32 y,
struct WindowTemplate winTemplate = sHealthboxWindowTemplate;
winId = AddWindow(&winTemplate);
- FillWindowPixelBuffer(winId, (bgColor << 4) | (bgColor));
+ FillWindowPixelBuffer(winId, PIXEL_FILL(bgColor));
color[0] = bgColor;
color[1] = 1;
diff --git a/src/battle_main.c b/src/battle_main.c
index befef364f..2b0c5980e 100644
--- a/src/battle_main.c
+++ b/src/battle_main.c
@@ -3277,7 +3277,7 @@ void FaintClearSetData(void)
gProtectStructs[gActiveBattler].targetNotAffected = 0;
gProtectStructs[gActiveBattler].chargingTurn = 0;
gProtectStructs[gActiveBattler].fleeFlag = 0;
- gProtectStructs[gActiveBattler].usedImprisionedMove = 0;
+ gProtectStructs[gActiveBattler].usedImprisonedMove = 0;
gProtectStructs[gActiveBattler].loveImmobility = 0;
gProtectStructs[gActiveBattler].usedDisabledMove = 0;
gProtectStructs[gActiveBattler].usedTauntedMove = 0;
diff --git a/src/battle_message.c b/src/battle_message.c
index 164108dec..6762cd416 100644
--- a/src/battle_message.c
+++ b/src/battle_message.c
@@ -1357,7 +1357,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] =
{
// The corresponding WindowTemplate is gStandardBattleWindowTemplates[] within src/battle_bg.c
{ // 0 Standard battle message
- .fillValue = 0xFF,
+ .fillValue = PIXEL_FILL(0xF),
.fontId = 1,
.x = 0,
.y = 1,
@@ -1369,7 +1369,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] =
.shadowColor = 6,
},
{ // 1 "What will (pokemon) do?"
- .fillValue = 0xFF,
+ .fillValue = PIXEL_FILL(0xF),
.fontId = 1,
.x = 1,
.y = 1,
@@ -1381,7 +1381,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] =
.shadowColor = 6,
},
{ // 2 "Fight/Pokemon/Bag/Run"
- .fillValue = 0xEE,
+ .fillValue = PIXEL_FILL(0xE),
.fontId = 1,
.x = 0,
.y = 1,
@@ -1393,7 +1393,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] =
.shadowColor = 15,
},
{ // 3 Top left move
- .fillValue = 0xEE,
+ .fillValue = PIXEL_FILL(0xE),
.fontId = 7,
.x = 0,
.y = 1,
@@ -1405,7 +1405,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] =
.shadowColor = 15,
},
{ // 4 Top right move
- .fillValue = 0xEE,
+ .fillValue = PIXEL_FILL(0xE),
.fontId = 7,
.x = 0,
.y = 1,
@@ -1417,7 +1417,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] =
.shadowColor = 15,
},
{ // 5 Bottom left move
- .fillValue = 0xEE,
+ .fillValue = PIXEL_FILL(0xE),
.fontId = 7,
.x = 0,
.y = 1,
@@ -1429,7 +1429,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] =
.shadowColor = 15,
},
{ // 6 Bottom right move
- .fillValue = 0xEE,
+ .fillValue = PIXEL_FILL(0xE),
.fontId = 7,
.x = 0,
.y = 1,
@@ -1441,7 +1441,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] =
.shadowColor = 15,
},
{ // 7 "PP"
- .fillValue = 0xEE,
+ .fillValue = PIXEL_FILL(0xE),
.fontId = 7,
.x = 0,
.y = 1,
@@ -1453,7 +1453,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] =
.shadowColor = 11,
},
{ // 8
- .fillValue = 0xEE,
+ .fillValue = PIXEL_FILL(0xE),
.fontId = 1,
.x = 0,
.y = 1,
@@ -1465,7 +1465,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] =
.shadowColor = 15,
},
{ // 9 PP remaining
- .fillValue = 0xEE,
+ .fillValue = PIXEL_FILL(0xE),
.fontId = 1,
.x = 2,
.y = 1,
@@ -1477,7 +1477,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] =
.shadowColor = 11,
},
{ // 10 "type"
- .fillValue = 0xEE,
+ .fillValue = PIXEL_FILL(0xE),
.fontId = 7,
.x = 0,
.y = 1,
@@ -1489,7 +1489,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] =
.shadowColor = 15,
},
{ // 11 "switch which?"
- .fillValue = 0xEE,
+ .fillValue = PIXEL_FILL(0xE),
.fontId = 7,
.x = 0,
.y = 1,
@@ -1501,7 +1501,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] =
.shadowColor = 15,
},
{ // 12 "gText_BattleYesNoChoice"
- .fillValue = 0xEE,
+ .fillValue = PIXEL_FILL(0xE),
.fontId = 1,
.x = 0,
.y = 1,
@@ -1513,7 +1513,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] =
.shadowColor = 15,
},
{ // 13
- .fillValue = 0xEE,
+ .fillValue = PIXEL_FILL(0xE),
.fontId = 1,
.x = 0,
.y = 1,
@@ -1525,7 +1525,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] =
.shadowColor = 15,
},
{ // 14
- .fillValue = 0x0,
+ .fillValue = PIXEL_FILL(0),
.fontId = 1,
.x = 32,
.y = 1,
@@ -1537,7 +1537,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] =
.shadowColor = 2,
},
{ // 15
- .fillValue = 0xEE,
+ .fillValue = PIXEL_FILL(0xE),
.fontId = 1,
.x = -1,
.y = 1,
@@ -1549,7 +1549,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] =
.shadowColor = 15,
},
{ // 16
- .fillValue = 0xEE,
+ .fillValue = PIXEL_FILL(0xE),
.fontId = 1,
.x = -1,
.y = 1,
@@ -1561,7 +1561,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] =
.shadowColor = 15,
},
{ // 17
- .fillValue = 0xEE,
+ .fillValue = PIXEL_FILL(0xE),
.fontId = 1,
.x = -1,
.y = 1,
@@ -1573,7 +1573,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] =
.shadowColor = 15,
},
{ // 18
- .fillValue = 0xEE,
+ .fillValue = PIXEL_FILL(0xE),
.fontId = 1,
.x = -1,
.y = 1,
@@ -1585,7 +1585,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] =
.shadowColor = 15,
},
{ // 19
- .fillValue = 0xEE,
+ .fillValue = PIXEL_FILL(0xE),
.fontId = 1,
.x = -1,
.y = 1,
@@ -1597,7 +1597,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] =
.shadowColor = 15,
},
{ // 20
- .fillValue = 0xEE,
+ .fillValue = PIXEL_FILL(0xE),
.fontId = 1,
.x = -1,
.y = 1,
@@ -1609,7 +1609,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] =
.shadowColor = 15,
},
{ // 21
- .fillValue = 0x0,
+ .fillValue = PIXEL_FILL(0),
.fontId = 1,
.x = -1,
.y = 1,
@@ -1621,7 +1621,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] =
.shadowColor = 6,
},
{ // 22
- .fillValue = 0x0,
+ .fillValue = PIXEL_FILL(0),
.fontId = 1,
.x = -1,
.y = 1,
@@ -1633,7 +1633,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] =
.shadowColor = 6,
},
{ // 23
- .fillValue = 0x0,
+ .fillValue = PIXEL_FILL(0x0),
.fontId = 1,
.x = -1,
.y = 1,
@@ -1649,7 +1649,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] =
static const struct BattleWindowText sTextOnWindowsInfo_Arena[] =
{
{ // 0
- .fillValue = 0xFF,
+ .fillValue = PIXEL_FILL(0xF),
.fontId = 1,
.x = 0,
.y = 1,
@@ -1661,7 +1661,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] =
.shadowColor = 6,
},
{ // 1
- .fillValue = 0xFF,
+ .fillValue = PIXEL_FILL(0xF),
.fontId = 1,
.x = 1,
.y = 1,
@@ -1673,7 +1673,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] =
.shadowColor = 6,
},
{ // 2
- .fillValue = 0xEE,
+ .fillValue = PIXEL_FILL(0xE),
.fontId = 1,
.x = 0,
.y = 1,
@@ -1685,7 +1685,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] =
.shadowColor = 15,
},
{ // 3
- .fillValue = 0xEE,
+ .fillValue = PIXEL_FILL(0xE),
.fontId = 7,
.x = 0,
.y = 1,
@@ -1697,7 +1697,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] =
.shadowColor = 15,
},
{ // 4
- .fillValue = 0xEE,
+ .fillValue = PIXEL_FILL(0xE),
.fontId = 7,
.x = 0,
.y = 1,
@@ -1709,7 +1709,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] =
.shadowColor = 15,
},
{ // 5
- .fillValue = 0xEE,
+ .fillValue = PIXEL_FILL(0xE),
.fontId = 7,
.x = 0,
.y = 1,
@@ -1721,7 +1721,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] =
.shadowColor = 15,
},
{ // 6
- .fillValue = 0xEE,
+ .fillValue = PIXEL_FILL(0xE),
.fontId = 7,
.x = 0,
.y = 1,
@@ -1733,7 +1733,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] =
.shadowColor = 15,
},
{ // 7
- .fillValue = 0xEE,
+ .fillValue = PIXEL_FILL(0xE),
.fontId = 7,
.x = 0,
.y = 1,
@@ -1745,7 +1745,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] =
.shadowColor = 11,
},
{ // 8
- .fillValue = 0xEE,
+ .fillValue = PIXEL_FILL(0xE),
.fontId = 1,
.x = 0,
.y = 1,
@@ -1757,7 +1757,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] =
.shadowColor = 15,
},
{ // 9
- .fillValue = 0xEE,
+ .fillValue = PIXEL_FILL(0xE),
.fontId = 1,
.x = 2,
.y = 1,
@@ -1769,7 +1769,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] =
.shadowColor = 11,
},
{ // 10
- .fillValue = 0xEE,
+ .fillValue = PIXEL_FILL(0xE),
.fontId = 7,
.x = 0,
.y = 1,
@@ -1781,7 +1781,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] =
.shadowColor = 15,
},
{ // 11
- .fillValue = 0xEE,
+ .fillValue = PIXEL_FILL(0xE),
.fontId = 7,
.x = 0,
.y = 1,
@@ -1793,7 +1793,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] =
.shadowColor = 15,
},
{ // 12
- .fillValue = 0xEE,
+ .fillValue = PIXEL_FILL(0xE),
.fontId = 1,
.x = 0,
.y = 1,
@@ -1805,7 +1805,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] =
.shadowColor = 15,
},
{ // 13
- .fillValue = 0xEE,
+ .fillValue = PIXEL_FILL(0xE),
.fontId = 1,
.x = 0,
.y = 1,
@@ -1817,7 +1817,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] =
.shadowColor = 15,
},
{ // 14
- .fillValue = 0x0,
+ .fillValue = PIXEL_FILL(0),
.fontId = 1,
.x = 32,
.y = 1,
@@ -1829,7 +1829,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] =
.shadowColor = 2,
},
{ // 15
- .fillValue = 0xEE,
+ .fillValue = PIXEL_FILL(0xE),
.fontId = 1,
.x = -1,
.y = 1,
@@ -1841,7 +1841,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] =
.shadowColor = 15,
},
{ // 16
- .fillValue = 0xEE,
+ .fillValue = PIXEL_FILL(0xE),
.fontId = 1,
.x = -1,
.y = 1,
@@ -1853,7 +1853,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] =
.shadowColor = 15,
},
{ // 17
- .fillValue = 0xEE,
+ .fillValue = PIXEL_FILL(0xE),
.fontId = 1,
.x = -1,
.y = 1,
@@ -1865,7 +1865,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] =
.shadowColor = 15,
},
{ // 18
- .fillValue = 0xEE,
+ .fillValue = PIXEL_FILL(0xE),
.fontId = 1,
.x = -1,
.y = 1,
@@ -1877,7 +1877,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] =
.shadowColor = 15,
},
{ // 19
- .fillValue = 0xEE,
+ .fillValue = PIXEL_FILL(0xE),
.fontId = 1,
.x = -1,
.y = 1,
@@ -1889,7 +1889,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] =
.shadowColor = 15,
},
{ // 20
- .fillValue = 0xEE,
+ .fillValue = PIXEL_FILL(0xE),
.fontId = 1,
.x = -1,
.y = 1,
@@ -1901,7 +1901,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] =
.shadowColor = 15,
},
{ // 21
- .fillValue = 0xEE,
+ .fillValue = PIXEL_FILL(0xE),
.fontId = 1,
.x = -1,
.y = 1,
@@ -1913,7 +1913,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] =
.shadowColor = 15,
},
{ // 22
- .fillValue = 0x11,
+ .fillValue = PIXEL_FILL(0x1),
.fontId = 1,
.x = 0,
.y = 1,
diff --git a/src/battle_pyramid_bag.c b/src/battle_pyramid_bag.c
index 1f0672dcb..2e13ea08b 100644
--- a/src/battle_pyramid_bag.c
+++ b/src/battle_pyramid_bag.c
@@ -651,7 +651,7 @@ static void PrintItemDescription(s32 listMenuId)
StringExpandPlaceholders(gStringVar4, gText_ReturnToVar1);
desc = gStringVar4;
}
- FillWindowPixelBuffer(1, 0);
+ FillWindowPixelBuffer(1, PIXEL_FILL(0));
PrintOnWindow_Font1(1, desc, 3, 0, 0, 1, 0, 0);
}
@@ -804,7 +804,7 @@ static void sub_81C5A98(u8 listMenuTaskId, u8 arg1)
static void sub_81C5AB8(u8 y, u8 arg1)
{
if (arg1 == 0xFF)
- FillWindowPixelRect(0, 0, 0, y, GetMenuCursorDimensionByFont(1, 0), GetMenuCursorDimensionByFont(1, 1));
+ FillWindowPixelRect(0, PIXEL_FILL(0), 0, y, GetMenuCursorDimensionByFont(1, 0), GetMenuCursorDimensionByFont(1, 1));
else
PrintOnWindow_Font1(0, gText_SelectorArrow2, 0, y, 0, 0, 0, arg1);
}
@@ -911,7 +911,7 @@ static void sub_81C5D20(u8 taskId)
CopyItemName(gSpecialVar_ItemId, gStringVar1);
StringExpandPlaceholders(gStringVar4, gText_Var1IsSelected);
- FillWindowPixelBuffer(1, 0);
+ FillWindowPixelBuffer(1, PIXEL_FILL(0));
PrintOnWindow_Font1(1, gStringVar4, 3, 0, 0, 1, 0, 0);
if (gPyramidBagResources->menuActionsCount == 1)
sub_81C5EAC(sub_81C6D24(0));
@@ -1048,7 +1048,7 @@ static void BagAction_UseOnField(u8 taskId)
else if (ItemId_GetFieldFunc(gSpecialVar_ItemId) != NULL)
{
sub_81C61A8();
- FillWindowPixelBuffer(1, 0);
+ FillWindowPixelBuffer(1, PIXEL_FILL(0));
schedule_bg_copy_tilemap_to_vram(0);
ItemId_GetFieldFunc(gSpecialVar_ItemId)(taskId);
}
@@ -1086,7 +1086,7 @@ static void BagAction_Toss(u8 taskId)
{
CopyItemName(gSpecialVar_ItemId, gStringVar1);
StringExpandPlaceholders(gStringVar4, gText_TossHowManyVar1s);
- FillWindowPixelBuffer(1, 0);
+ FillWindowPixelBuffer(1, PIXEL_FILL(0));
PrintOnWindow_Font1(1, gStringVar4, 3, 0, 0, 1, 0, 0);
sub_81C6404();
gTasks[taskId].func = sub_81C64B4;
@@ -1100,7 +1100,7 @@ static void sub_81C6350(u8 taskId)
CopyItemName(gSpecialVar_ItemId, gStringVar1);
ConvertIntToDecimalStringN(gStringVar2, data[8], STR_CONV_MODE_LEFT_ALIGN, 2);
StringExpandPlaceholders(gStringVar4, gText_ConfirmTossItems);
- FillWindowPixelBuffer(1, 0);
+ FillWindowPixelBuffer(1, PIXEL_FILL(0));
PrintOnWindow_Font1(1, gStringVar4, 3, 0, 0, 1, 0, 0);
sub_81C6DAC(taskId, &sYesNoTossFuncions);
}
@@ -1146,7 +1146,7 @@ static void sub_81C64B4(u8 taskId)
else if (gMain.newKeys & A_BUTTON)
{
PlaySE(SE_SELECT);
- sub_8198070(3, 0);
+ ClearStdWindowAndFrameToTransparent(3, 0);
ClearWindowTilemap(3);
schedule_bg_copy_tilemap_to_vram(1);
sub_81C6350(taskId);
@@ -1154,7 +1154,7 @@ static void sub_81C64B4(u8 taskId)
else if (gMain.newKeys & B_BUTTON)
{
PlaySE(SE_SELECT);
- sub_8198070(3, 0);
+ ClearStdWindowAndFrameToTransparent(3, 0);
ClearWindowTilemap(3);
schedule_bg_copy_tilemap_to_vram(1);
DontTossItem(taskId);
@@ -1168,7 +1168,7 @@ static void TossItem(u8 taskId)
CopyItemName(gSpecialVar_ItemId, gStringVar1);
ConvertIntToDecimalStringN(gStringVar2, data[8], STR_CONV_MODE_LEFT_ALIGN, 2);
StringExpandPlaceholders(gStringVar4, gText_ThrewAwayVar2Var1s);
- FillWindowPixelBuffer(1, 0);
+ FillWindowPixelBuffer(1, PIXEL_FILL(0));
PrintOnWindow_Font1(1, gStringVar4, 3, 0, 0, 1, 0, 0);
gTasks[taskId].func = sub_81C65CC;
}
@@ -1265,7 +1265,7 @@ static void Task_BeginItemSwap(u8 taskId)
ListMenuSetUnkIndicatorsStructField(data[0], 0x10, 1);
CopyItemName(gSaveBlock2Ptr->frontier.pyramidBag.itemId[gSaveBlock2Ptr->frontier.lvlMode][data[1]], gStringVar1);
StringExpandPlaceholders(gStringVar4, gText_MoveVar1Where);
- FillWindowPixelBuffer(1, 0);
+ FillWindowPixelBuffer(1, PIXEL_FILL(0));
PrintOnWindow_Font1(1, gStringVar4, 3, 0, 0, 1, 0, 0);
sub_81C5A98(data[0], 1);
sub_81C704C(data[1]);
@@ -1395,7 +1395,7 @@ static void sub_81C6BD8(void)
LoadPalette(gUnknown_0860F074, 0xF0, 0x20);
for (i = 0; i < 5; i++)
- FillWindowPixelBuffer(i, 0);
+ FillWindowPixelBuffer(i, PIXEL_FILL(0));
PutWindowTilemap(0);
PutWindowTilemap(1);
@@ -1415,7 +1415,7 @@ static void PrintOnWindow_Font7(u8 windowId, const u8 *src, u8 x, u8 y, u8 lette
static void sub_81C6CEC(u8 windowId)
{
- SetWindowBorderStyle(windowId, 0, 1, 0xE);
+ DrawStdFrameWithCustomTileAndPalette(windowId, 0, 1, 0xE);
schedule_bg_copy_tilemap_to_vram(1);
}
@@ -1430,7 +1430,7 @@ static u8 sub_81C6D24(u8 windowArrayId)
if (*windowId == 0xFF)
{
*windowId = AddWindow(&gUnknown_0861F350[windowArrayId]);
- SetWindowBorderStyle(*windowId, FALSE, 1, 0xE);
+ DrawStdFrameWithCustomTileAndPalette(*windowId, FALSE, 1, 0xE);
schedule_bg_copy_tilemap_to_vram(1);
}
return *windowId;
@@ -1441,7 +1441,7 @@ static void sub_81C6D6C(u8 windowArrayId)
u8 *windowId = &gPyramidBagResources->windowIds[windowArrayId];
if (*windowId != 0xFF)
{
- sub_8198070(*windowId, FALSE);
+ ClearStdWindowAndFrameToTransparent(*windowId, FALSE);
ClearWindowTilemap(*windowId);
RemoveWindow(*windowId);
schedule_bg_copy_tilemap_to_vram(1);
@@ -1456,14 +1456,15 @@ static void sub_81C6DAC(u8 taskId, const struct YesNoFuncTable *yesNoTable)
void DisplayItemMessageInBattlePyramid(u8 taskId, const u8 *str, void (*callback)(u8 taskId))
{
- FillWindowPixelBuffer(2, 0x11);
+ FillWindowPixelBuffer(2, PIXEL_FILL(1));
DisplayMessageAndContinueTask(taskId, 2, 0xA, 0xD, 1, GetPlayerTextSpeedDelay(), str, callback);
schedule_bg_copy_tilemap_to_vram(1);
}
static void sub_81C6E1C(void)
{
- sub_8197DF8(2, FALSE);
+ ClearDialogWindowAndFrameToTransparent(2, FALSE);
+ // This ClearWindowTilemap call is redundant, since ClearDialogWindowAndFrameToTransparent already calls it.
ClearWindowTilemap(2);
schedule_bg_copy_tilemap_to_vram(1);
}
diff --git a/src/battle_records.c b/src/battle_records.c
index d905ccaf3..fdd915d07 100644
--- a/src/battle_records.c
+++ b/src/battle_records.c
@@ -319,8 +319,8 @@ void ShowLinkBattleRecords(void)
s32 i, x;
gRecordsWindowId = AddWindow(&sLinkBattleRecordsWindow);
- NewMenuHelpers_DrawStdWindowFrame(gRecordsWindowId, FALSE);
- FillWindowPixelBuffer(gRecordsWindowId, 0x11);
+ DrawStdWindowFrame(gRecordsWindowId, FALSE);
+ FillWindowPixelBuffer(gRecordsWindowId, PIXEL_FILL(1));
StringExpandPlaceholders(gStringVar4, gText_PlayersBattleResults);
x = GetStringCenterAlignXOffset(1, gStringVar4, 208);
@@ -341,7 +341,7 @@ void ShowLinkBattleRecords(void)
void RemoveRecordsWindow(void)
{
- sub_819746C(gRecordsWindowId, FALSE);
+ ClearStdWindowAndFrame(gRecordsWindowId, FALSE);
RemoveWindow(gRecordsWindowId);
}
@@ -382,7 +382,7 @@ static void Task_ExitTrainerHillRecords(u8 taskId)
static void RemoveTrainerHillRecordsWindow(u8 windowId)
{
- FillWindowPixelBuffer(windowId, 0);
+ FillWindowPixelBuffer(windowId, PIXEL_FILL(0));
ClearWindowTilemap(windowId);
CopyWindowToVram(windowId, 2);
RemoveWindow(windowId);
diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c
index 8a4436a3f..ac9fb3073 100644
--- a/src/battle_script_commands.c
+++ b/src/battle_script_commands.c
@@ -295,7 +295,7 @@ static void atkD7_setyawn(void);
static void atkD8_setdamagetohealthdifference(void);
static void atkD9_scaledamagebyhealthratio(void);
static void atkDA_tryswapabilities(void);
-static void atkDB_tryimprision(void);
+static void atkDB_tryimprison(void);
static void atkDC_trysetgrudge(void);
static void atkDD_weightdamagecalculation(void);
static void atkDE_asistattackselect(void);
@@ -547,7 +547,7 @@ void (* const gBattleScriptingCommandsTable[])(void) =
atkD8_setdamagetohealthdifference,
atkD9_scaledamagebyhealthratio,
atkDA_tryswapabilities,
- atkDB_tryimprision,
+ atkDB_tryimprison,
atkDC_trysetgrudge,
atkDD_weightdamagecalculation,
atkDE_asistattackselect,
@@ -9609,7 +9609,7 @@ static void atkDA_tryswapabilities(void) // skill swap
}
}
-static void atkDB_tryimprision(void)
+static void atkDB_tryimprison(void)
{
if ((gStatuses3[gBattlerAttacker] & STATUS3_IMPRISONED_OTHERS))
{
@@ -9620,7 +9620,7 @@ static void atkDB_tryimprision(void)
u8 battlerId, sideAttacker;
sideAttacker = GetBattlerSide(gBattlerAttacker);
- PressurePPLoseOnUsingImprision(gBattlerAttacker);
+ PressurePPLoseOnUsingImprison(gBattlerAttacker);
for (battlerId = 0; battlerId < gBattlersCount; battlerId++)
{
if (sideAttacker != GetBattlerSide(battlerId))
diff --git a/src/battle_setup.c b/src/battle_setup.c
index 3d27b517e..347486a0b 100644
--- a/src/battle_setup.c
+++ b/src/battle_setup.c
@@ -638,7 +638,7 @@ u8 BattleSetup_GetTerrainId(void)
return BATTLE_TERRAIN_BUILDING;
case MAP_TYPE_UNDERWATER:
return BATTLE_TERRAIN_UNDERWATER;
- case MAP_TYPE_6:
+ case MAP_TYPE_OCEAN_ROUTE:
if (MetatileBehavior_IsSurfableWaterOrUnderwater(tileBehavior))
return BATTLE_TERRAIN_WATER;
return BATTLE_TERRAIN_PLAIN;
diff --git a/src/battle_tower.c b/src/battle_tower.c
index 06aaef48d..46aab4bac 100644
--- a/src/battle_tower.c
+++ b/src/battle_tower.c
@@ -51,7 +51,7 @@ static void AwardBattleTowerRibbons(void);
static void SaveBattleTowerProgress(void);
static void sub_8163914(void);
static void nullsub_61(void);
-static void nullsub_116(void);
+static void SpriteCB_Null6(void);
static void sub_81642A0(void);
static void sub_8164828(void);
static void sub_8164B74(void);
@@ -1061,7 +1061,7 @@ static void (* const gUnknown_085DF96C[])(void) =
SaveBattleTowerProgress,
sub_8163914,
nullsub_61,
- nullsub_116,
+ SpriteCB_Null6,
sub_81642A0,
sub_8164828,
sub_8164B74,
@@ -2437,7 +2437,7 @@ static void nullsub_61(void)
}
-static void nullsub_116(void)
+static void SpriteCB_Null6(void)
{
}
diff --git a/src/battle_util.c b/src/battle_util.c
index 2f583a9c7..aa88cf952 100644
--- a/src/battle_util.c
+++ b/src/battle_util.c
@@ -106,10 +106,10 @@ void PressurePPLose(u8 target, u8 attacker, u16 move)
}
}
-void PressurePPLoseOnUsingImprision(u8 attacker)
+void PressurePPLoseOnUsingImprison(u8 attacker)
{
int i, j;
- int imprisionPos = 4;
+ int imprisonPos = 4;
u8 atkSide = GetBattlerSide(attacker);
for (i = 0; i < gBattlersCount; i++)
@@ -123,19 +123,19 @@ void PressurePPLoseOnUsingImprision(u8 attacker)
}
if (j != MAX_MON_MOVES)
{
- imprisionPos = j;
+ imprisonPos = j;
if (gBattleMons[attacker].pp[j] != 0)
gBattleMons[attacker].pp[j]--;
}
}
}
- if (imprisionPos != 4
+ if (imprisonPos != 4
&& !(gBattleMons[attacker].status2 & STATUS2_TRANSFORMED)
- && !(gDisableStructs[attacker].mimickedMoves & gBitTable[imprisionPos]))
+ && !(gDisableStructs[attacker].mimickedMoves & gBitTable[imprisonPos]))
{
gActiveBattler = attacker;
- BtlController_EmitSetMonData(0, REQUEST_PPMOVE1_BATTLE + imprisionPos, 0, 1, &gBattleMons[gActiveBattler].pp[imprisionPos]);
+ BtlController_EmitSetMonData(0, REQUEST_PPMOVE1_BATTLE + imprisonPos, 0, 1, &gBattleMons[gActiveBattler].pp[imprisonPos]);
MarkBattlerForControllerExec(gActiveBattler);
}
}
@@ -224,7 +224,7 @@ bool8 WasUnableToUseMove(u8 battler)
{
if (gProtectStructs[battler].prlzImmobility
|| gProtectStructs[battler].targetNotAffected
- || gProtectStructs[battler].usedImprisionedMove
+ || gProtectStructs[battler].usedImprisonedMove
|| gProtectStructs[battler].loveImmobility
|| gProtectStructs[battler].usedDisabledMove
|| gProtectStructs[battler].usedTauntedMove
@@ -365,12 +365,12 @@ u8 TrySetCantSelectMoveBattleScript(void)
gCurrentMove = move;
if (gBattleTypeFlags & BATTLE_TYPE_PALACE)
{
- gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingImprisionedMoveInPalace;
+ gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingImprisonedMoveInPalace;
gProtectStructs[gActiveBattler].palaceUnableToUseMove = 1;
}
else
{
- gSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingImprisionedMove;
+ gSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingImprisonedMove;
limitations++;
}
}
@@ -438,7 +438,7 @@ u8 CheckMoveLimitations(u8 battlerId, u8 unusableMoves, u8 check)
unusableMoves |= gBitTable[i];
if (gDisableStructs[battlerId].tauntTimer && check & MOVE_LIMITATION_TAUNT && gBattleMoves[gBattleMons[battlerId].moves[i]].power == 0)
unusableMoves |= gBitTable[i];
- if (GetImprisonedMovesCount(battlerId, gBattleMons[battlerId].moves[i]) && check & MOVE_LIMITATION_IMPRISION)
+ if (GetImprisonedMovesCount(battlerId, gBattleMons[battlerId].moves[i]) && check & MOVE_LIMITATION_IMPRISON)
unusableMoves |= gBitTable[i];
if (gDisableStructs[battlerId].encoreTimer && gDisableStructs[battlerId].encoredMove != gBattleMons[battlerId].moves[i])
unusableMoves |= gBitTable[i];
@@ -469,7 +469,7 @@ bool8 AreAllMovesUnusable(void)
u8 GetImprisonedMovesCount(u8 battlerId, u16 move)
{
s32 i;
- u8 imprisionedMoves = 0;
+ u8 imprisonedMoves = 0;
u8 battlerSide = GetBattlerSide(battlerId);
for (i = 0; i < gBattlersCount; i++)
@@ -483,11 +483,11 @@ u8 GetImprisonedMovesCount(u8 battlerId, u16 move)
break;
}
if (j < MAX_MON_MOVES)
- imprisionedMoves++;
+ imprisonedMoves++;
}
}
- return imprisionedMoves;
+ return imprisonedMoves;
}
enum
@@ -1466,7 +1466,7 @@ u8 AtkCanceller_UnableToUseMove(void)
case CANCELLER_IMPRISONED: // imprisoned
if (GetImprisonedMovesCount(gBattlerAttacker, gCurrentMove))
{
- gProtectStructs[gBattlerAttacker].usedImprisionedMove = 1;
+ gProtectStructs[gBattlerAttacker].usedImprisonedMove = 1;
CancelMultiTurnMoves(gBattlerAttacker);
gBattlescriptCurrInstr = BattleScript_MoveUsedIsImprisoned;
gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE;
@@ -1526,7 +1526,7 @@ u8 AtkCanceller_UnableToUseMove(void)
}
else
{
- BattleScriptPush(BattleScript_MoveUsedIsParalyzedCantAttack);
+ BattleScriptPush(BattleScript_MoveUsedIsInLoveCantAttack);
gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE;
gProtectStructs[gBattlerAttacker].loveImmobility = 1;
CancelMultiTurnMoves(gBattlerAttacker);
diff --git a/src/berry_blender.c b/src/berry_blender.c
index 70e50a72e..450bcae42 100644
--- a/src/berry_blender.c
+++ b/src/berry_blender.c
@@ -937,7 +937,7 @@ static void InitBerryBlenderWindows(void)
DeactivateAllTextPrinters();
for (i = 0; i < 5; i++)
- FillWindowPixelBuffer(i, 0);
+ FillWindowPixelBuffer(i, PIXEL_FILL(0));
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x1E, 0x14);
sub_81978B0(0xE0);
@@ -1243,7 +1243,7 @@ static void sub_8080018(void)
case 10:
if (++sBerryBlenderData->framesToWait > 20)
{
- sub_8197DF8(4, TRUE);
+ ClearDialogWindowAndFrameToTransparent(4, TRUE);
if (GetBlockReceivedStatus() == sub_800A9D8())
{
for (i = 0; i < GetLinkPlayerCount(); i++)
@@ -3317,7 +3317,7 @@ static bool8 Blender_PrintBlendingResults(void)
sBerryBlenderData->mainState++;
break;
case 5:
- sub_8198070(5, 1);
+ ClearStdWindowAndFrameToTransparent(5, 1);
for (i = 0; i < BLENDER_MAX_PLAYERS; i++)
{
@@ -3458,7 +3458,7 @@ static bool8 Blender_PrintBlendingRanking(void)
}
break;
case 3:
- SetWindowBorderStyle(5, 0, 1, 0xD);
+ DrawStdFrameWithCustomTileAndPalette(5, 0, 1, 0xD);
xPos = GetStringCenterAlignXOffset(1, sText_Ranking, 0xA8);
Blender_AddTextPrinter(5, sText_Ranking, xPos, 1, TEXT_SPEED_FF, 0);
@@ -3529,8 +3529,8 @@ void ShowBerryBlenderRecordWindow(void)
winTemplate = sBlenderRecordWindowTemplate;
gRecordsWindowId = AddWindow(&winTemplate);
- NewMenuHelpers_DrawStdWindowFrame(gRecordsWindowId, 0);
- FillWindowPixelBuffer(gRecordsWindowId, 0x11);
+ DrawStdWindowFrame(gRecordsWindowId, 0);
+ FillWindowPixelBuffer(gRecordsWindowId, PIXEL_FILL(1));
xPos = GetStringCenterAlignXOffset(1, gText_BlenderMaxSpeedRecord, 0x90);
AddTextPrinterParameterized(gRecordsWindowId, 1, gText_BlenderMaxSpeedRecord, xPos, 1, 0, NULL);
@@ -3639,7 +3639,7 @@ static void Blender_AddTextPrinter(u8 windowId, const u8 *string, u8 x, u8 y, s3
if (caseId != 3)
{
- FillWindowPixelBuffer(windowId, txtColor[0] | (txtColor[0] << 4));
+ FillWindowPixelBuffer(windowId, PIXEL_FILL(txtColor[0]));
}
AddTextPrinterParameterized4(windowId, 1, x, y, letterSpacing, 1, txtColor, speed, string);
@@ -3650,7 +3650,7 @@ static bool32 Blender_PrintText(s16 *textState, const u8 *string, s32 textSpeed)
switch (*textState)
{
case 0:
- sub_8197B1C(4, FALSE, 0x14, 0xF);
+ DrawDialogFrameWithCustomTileAndPalette(4, FALSE, 0x14, 0xF);
Blender_AddTextPrinter(4, string, 0, 1, textSpeed, 0);
PutWindowTilemap(4);
CopyWindowToVram(4, 3);
diff --git a/src/berry_fix_program.c b/src/berry_fix_program.c
index 3631c083a..37be569f8 100644
--- a/src/berry_fix_program.c
+++ b/src/berry_fix_program.c
@@ -226,9 +226,9 @@ static void berry_fix_gpu_set(void)
DmaCopy32(3, sUnknown_08618138, BG_PLTT + 0x1E0, 0x20);
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_1D_MAP);
- FillWindowPixelBuffer(2, 0);
- FillWindowPixelBuffer(3, 0);
- FillWindowPixelBuffer(0, 0xAA);
+ FillWindowPixelBuffer(2, PIXEL_FILL(0));
+ FillWindowPixelBuffer(3, PIXEL_FILL(0));
+ FillWindowPixelBuffer(0, PIXEL_FILL(0xA));
width = GetStringWidth(0, sUnknown_08617E9B, 0);
left = (0x78 - width) / 2;
@@ -273,7 +273,7 @@ static int berry_fix_text_update(int checkval)
static void berry_fix_text_print(int scene)
{
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 32, 32);
- FillWindowPixelBuffer(1, 0xAA);
+ FillWindowPixelBuffer(1, PIXEL_FILL(0xA));
AddTextPrinterParameterized3(1, 1, 0, 0, sUnknown_08618158, -1, gUnknown_08618160[scene]);
PutWindowTilemap(1);
CopyWindowToVram(1, 2);
diff --git a/src/berry_tag_screen.c b/src/berry_tag_screen.c
index 6e968fc0a..a7cf4daf2 100644
--- a/src/berry_tag_screen.c
+++ b/src/berry_tag_screen.c
@@ -381,7 +381,7 @@ static void PrintTextInBerryTagScreen(u8 windowId, const u8 *text, u8 x, u8 y, s
static void AddBerryTagTextToBg0(void)
{
memcpy(GetBgTilemapBuffer(0), sBerryTag->tilemapBuffers[2], sizeof(sBerryTag->tilemapBuffers[2]));
- FillWindowPixelBuffer(WIN_BERRY_TAG, 0xFF);
+ FillWindowPixelBuffer(WIN_BERRY_TAG, PIXEL_FILL(15));
PrintTextInBerryTagScreen(WIN_BERRY_TAG, gText_BerryTag, GetStringCenterAlignXOffset(1, gText_BerryTag, 0x40), 1, 0, 1);
PutWindowTilemap(WIN_BERRY_TAG);
schedule_bg_copy_tilemap_to_vram(0);
@@ -598,7 +598,7 @@ static void Task_DisplayAnotherBerry(u8 taskId)
switch (data[0])
{
case 0x30:
- FillWindowPixelBuffer(0, 0);
+ FillWindowPixelBuffer(0, PIXEL_FILL(0));
break;
case 0x40:
PrintBerryNumberAndName();
@@ -608,7 +608,7 @@ static void Task_DisplayAnotherBerry(u8 taskId)
CreateBerrySprite();
break;
case 0x60:
- FillWindowPixelBuffer(1, 0);
+ FillWindowPixelBuffer(1, PIXEL_FILL(0));
break;
case 0x70:
PrintBerrySize();
@@ -620,7 +620,7 @@ static void Task_DisplayAnotherBerry(u8 taskId)
SetFlavorCirclesVisiblity();
break;
case 0xA0:
- FillWindowPixelBuffer(2, 0);
+ FillWindowPixelBuffer(2, PIXEL_FILL(0));
break;
case 0xB0:
PrintBerryDescription1();
@@ -635,7 +635,7 @@ static void Task_DisplayAnotherBerry(u8 taskId)
switch (data[0])
{
case 0x30:
- FillWindowPixelBuffer(2, 0);
+ FillWindowPixelBuffer(2, PIXEL_FILL(0));
break;
case 0x40:
PrintBerryDescription2();
@@ -647,7 +647,7 @@ static void Task_DisplayAnotherBerry(u8 taskId)
SetFlavorCirclesVisiblity();
break;
case 0x70:
- FillWindowPixelBuffer(1, 0);
+ FillWindowPixelBuffer(1, PIXEL_FILL(0));
break;
case 0x80:
PrintBerryFirmness();
@@ -660,7 +660,7 @@ static void Task_DisplayAnotherBerry(u8 taskId)
CreateBerrySprite();
break;
case 0xB0:
- FillWindowPixelBuffer(0, 0);
+ FillWindowPixelBuffer(0, PIXEL_FILL(0));
break;
case 0xC0:
PrintBerryNumberAndName();
diff --git a/src/cable_club.c b/src/cable_club.c
index d83508504..b80e76e99 100644
--- a/src/cable_club.c
+++ b/src/cable_club.c
@@ -92,7 +92,9 @@ static void sub_80B23B0(u16 windowId, u32 value)
static void sub_80B241C(u16 windowId)
{
- sub_819746C(windowId, FALSE);
+ // Following this call with a copy-to-vram with mode 3 is identical to
+ // calling ClearStdWindowAndFrame(windowId, TRUE).
+ ClearStdWindowAndFrame(windowId, FALSE);
CopyWindowToVram(windowId, 3);
}
diff --git a/src/clear_save_data_screen.c b/src/clear_save_data_screen.c
index 5ec90e10c..c1d6930c7 100644
--- a/src/clear_save_data_screen.c
+++ b/src/clear_save_data_screen.c
@@ -79,7 +79,7 @@ void CB2_InitClearSaveDataScreen(void)
static void Task_DoClearSaveDataScreenYesNo(u8 taskId)
{
- SetWindowBorderStyle(0, 0, 2, 14);
+ DrawStdFrameWithCustomTileAndPalette(0, 0, 2, 14);
AddTextPrinterParameterized(0, 1, gText_ClearAllSaveData, 0, 1, 0, 0);
CreateYesNoMenu(sClearSaveYesNo, 2, 14, 1);
gTasks[taskId].func = Task_ClearSaveDataScreenYesNoChoice;
@@ -90,7 +90,7 @@ static void Task_ClearSaveDataScreenYesNoChoice(u8 taskId)
switch (Menu_ProcessInputNoWrapClearOnChoose())
{
case 0:
- FillWindowPixelBuffer(0, 17);
+ FillWindowPixelBuffer(0, PIXEL_FILL(1));
AddTextPrinterParameterized(0, 1, gText_ClearingData, 0, 1, 0, 0);
gTasks[taskId].func = Task_ClearSaveData;
break;
@@ -203,7 +203,7 @@ static void InitClearSaveDataScreenWindows(void)
{
InitWindows(sClearSaveTextWindow);
DeactivateAllTextPrinters();
- FillWindowPixelBuffer(0, 0);
+ FillWindowPixelBuffer(0, PIXEL_FILL(0));
LoadWindowGfx(0, 0, 2, 224);
LoadPalette(gUnknown_0860F074, 0xF0, 0x20);
}
diff --git a/src/coins.c b/src/coins.c
index 967eb92ac..b838c303e 100644
--- a/src/coins.c
+++ b/src/coins.c
@@ -27,15 +27,15 @@ void ShowCoinsWindow(u32 coinAmount, u8 x, u8 y)
struct WindowTemplate template;
SetWindowTemplateFields(&template, 0, x, y, 8, 2, 0xF, 0x141);
sCoinsWindowId = AddWindow(&template);
- FillWindowPixelBuffer(sCoinsWindowId, 0);
+ FillWindowPixelBuffer(sCoinsWindowId, PIXEL_FILL(0));
PutWindowTilemap(sCoinsWindowId);
- SetWindowBorderStyle(sCoinsWindowId, FALSE, 0x214, 0xE);
+ DrawStdFrameWithCustomTileAndPalette(sCoinsWindowId, FALSE, 0x214, 0xE);
PrintCoinsString(coinAmount);
}
void HideCoinsWindow(void)
{
- sub_819746C(sCoinsWindowId, TRUE);
+ ClearStdWindowAndFrame(sCoinsWindowId, TRUE);
RemoveWindow(sCoinsWindowId);
}
diff --git a/src/contest.c b/src/contest.c
index 230ccd1b4..114a1fb69 100644
--- a/src/contest.c
+++ b/src/contest.c
@@ -817,7 +817,7 @@ static void sub_80D8490(u8 taskId)
}
r5 = StringCopy(r5, gMoveNames[move]);
- FillWindowPixelBuffer(i + 5, 0);
+ FillWindowPixelBuffer(i + 5, PIXEL_FILL(0));
Contest_PrintTextToBg0WindowAt(i + 5, sp8, 5, 1, 7);
}
@@ -939,7 +939,7 @@ static void sub_80D895C(u8 taskId)
for (i = 0; i < 4; i++)
{
- FillWindowPixelBuffer(5 + i, 0);
+ FillWindowPixelBuffer(5 + i, PIXEL_FILL(0));
PutWindowTilemap(5 + i);
CopyWindowToVram(5 + i, 2);
}
@@ -2256,7 +2256,7 @@ static void sub_80DAEA4(void)
for (i = 0; i < 4; i++)
{
- FillWindowPixelBuffer(gUnknown_02039F26[i], 0);
+ FillWindowPixelBuffer(gUnknown_02039F26[i], PIXEL_FILL(0));
sub_80DAF04(i);
sub_80DAF88(i);
}
@@ -2476,7 +2476,7 @@ static void prints_contest_move_description(u16 a)
ContestBG_FillBoxWithTile(0, 0x5036, 0x15, 0x20, 0x08, 0x01, 0x11);
ContestBG_FillBoxWithTile(0, 0x5014, 0x15, 0x20, numHearts, 0x01, 0x11);
- FillWindowPixelBuffer(10, 0);
+ FillWindowPixelBuffer(10, PIXEL_FILL(0));
Contest_PrintTextToBg0WindowStd(10, gContestEffectDescriptionPointers[gContestMoves[a].effect]);
Contest_PrintTextToBg0WindowStd(9, gText_Slash);
}
@@ -2619,7 +2619,7 @@ static void sub_80DB884(void)
static void sub_80DB89C(void)
{
- FillWindowPixelBuffer(4, 0);
+ FillWindowPixelBuffer(4, PIXEL_FILL(0));
CopyWindowToVram(4, 2);
Contest_SetBgCopyFlags(0);
}
@@ -3454,7 +3454,7 @@ static void sub_80DCD48(void)
break;
default:
for (i = 0; i < 4; i++)
- FillWindowPixelBuffer(i, 0);
+ FillWindowPixelBuffer(i, PIXEL_FILL(0));
for (i = 0; i < 4; i++)
{
value = sContestantStatus[i].unk4;
@@ -5036,7 +5036,7 @@ static void sub_80DF750(void)
return;
for (i = 0; i < 4; i++)
- FillWindowPixelBuffer(i, 0);
+ FillWindowPixelBuffer(i, PIXEL_FILL(0));
if (gHeap[0x1A000] == 2)
{
diff --git a/src/contest_link_80F57C4.c b/src/contest_link_80F57C4.c
index 881d9847e..a4b88c074 100644
--- a/src/contest_link_80F57C4.c
+++ b/src/contest_link_80F57C4.c
@@ -934,7 +934,7 @@ static void sub_80F6AE8(void)
// windowTemplate.width = 30;
// windowTemplate.height = 2;
// windowId = AddWindow(&windowTemplate);
-// FillWindowPixelBuffer(windowId, 0x11);
+// FillWindowPixelBuffer(windowId, PIXEL_FILL(1));
// origWidth = GetStringWidth(1, text, 0) + 9;
// strWidth = origWidth;
// if (strWidth < 0)
diff --git a/src/contest_painting.c b/src/contest_painting.c
index 2f0c97764..931deb01b 100644
--- a/src/contest_painting.c
+++ b/src/contest_painting.c
@@ -279,7 +279,7 @@ static void InitContestPaintingWindow(void)
SetBgTilemapBuffer(1, AllocZeroed(BG_SCREEN_SIZE));
gContestPaintingWindowId = AddWindow(&gUnknown_085B07EC);
DeactivateAllTextPrinters();
- FillWindowPixelBuffer(gContestPaintingWindowId, 0);
+ FillWindowPixelBuffer(gContestPaintingWindowId, PIXEL_FILL(0));
PutWindowTilemap(gContestPaintingWindowId);
CopyWindowToVram(gContestPaintingWindowId, 3);
ShowBg(1);
diff --git a/src/credits.c b/src/credits.c
index aee5332f5..4483e3160 100644
--- a/src/credits.c
+++ b/src/credits.c
@@ -1592,7 +1592,7 @@ static void sub_8175DA0(u8 taskIdB)
case 5:
if (!gPaletteFade.active)
{
- FillWindowPixelBuffer(0, 0);
+ FillWindowPixelBuffer(0, PIXEL_FILL(0));
CopyWindowToVram(0, 2);
gTasks[taskIdB].data[TDB_0] = 2;
}
diff --git a/src/daycare.c b/src/daycare.c
index b75fab292..885ac31a1 100644
--- a/src/daycare.c
+++ b/src/daycare.c
@@ -1259,7 +1259,7 @@ static void Task_HandleDaycareLevelMenuInput(u8 taskId)
break;
}
DestroyListMenuTask(gTasks[taskId].tMenuListTaskId, NULL, NULL);
- sub_819746C(gTasks[taskId].tWindowId, TRUE);
+ ClearStdWindowAndFrame(gTasks[taskId].tWindowId, TRUE);
RemoveWindow(gTasks[taskId].tWindowId);
DestroyTask(taskId);
EnableBothScriptContexts();
@@ -1268,7 +1268,7 @@ static void Task_HandleDaycareLevelMenuInput(u8 taskId)
{
gSpecialVar_Result = 2;
DestroyListMenuTask(gTasks[taskId].tMenuListTaskId, NULL, NULL);
- sub_819746C(gTasks[taskId].tWindowId, TRUE);
+ ClearStdWindowAndFrame(gTasks[taskId].tWindowId, TRUE);
RemoveWindow(gTasks[taskId].tWindowId);
DestroyTask(taskId);
EnableBothScriptContexts();
@@ -1283,7 +1283,7 @@ void ShowDaycareLevelMenu(void)
u8 daycareMenuTaskId;
windowId = AddWindow(&sDaycareLevelMenuWindowTemplate);
- NewMenuHelpers_DrawStdWindowFrame(windowId, FALSE);
+ DrawStdWindowFrame(windowId, FALSE);
menuTemplate = sDaycareListMenuLevelTemplate;
menuTemplate.windowId = windowId;
diff --git a/src/decoration.c b/src/decoration.c
index 83ec4bc34..0712b5d32 100644
--- a/src/decoration.c
+++ b/src/decoration.c
@@ -463,14 +463,14 @@ u8 sub_81269D4(u8 idx)
{
*winidx = AddWindow(&gUnknown_085A6B90[idx]);
}
- SetWindowBorderStyle(*winidx, 0, 0x214, 0xe);
+ DrawStdFrameWithCustomTileAndPalette(*winidx, 0, 0x214, 0xe);
schedule_bg_copy_tilemap_to_vram(0);
return *winidx;
}
void sub_8126A58(u8 idx)
{
- sub_8198070(sDecorMenuWindowIndices[idx], FALSE);
+ ClearStdWindowAndFrameToTransparent(sDecorMenuWindowIndices[idx], FALSE);
ClearWindowTilemap(sDecorMenuWindowIndices[idx]);
RemoveWindow(sDecorMenuWindowIndices[idx]);
schedule_bg_copy_tilemap_to_vram(0);
@@ -543,7 +543,7 @@ void sub_8126B80(u8 taskId)
void sub_8126C08(void)
{
- FillWindowPixelBuffer(0, 0x11);
+ FillWindowPixelBuffer(0, PIXEL_FILL(1));
AddTextPrinterParameterized2(0, 1, sSecretBasePCMenuItemDescriptions[sSecretBasePCMenuCursorPos], 0, 0, 2, 1, 3);
}
@@ -572,7 +572,7 @@ void SecretBasePC_PutAway(u8 taskId)
else
{
sub_8126A58(0);
- sub_8197434(0, 0);
+ ClearDialogWindowAndFrame(0, 0);
FadeScreen(1, 0);
gTasks[taskId].data[2] = 0;
gTasks[taskId].func = sub_8129ABC;
@@ -617,7 +617,7 @@ void sub_8126DA4(u8 taskId)
void SecretBasePC_PrepMenuForSelectingStoredDecors(u8 taskId)
{
LoadPalette(gUnknown_085A6BB0, 0xd0, 0x20);
- sub_8197434(0, 0);
+ ClearDialogWindowAndFrame(0, 0);
sub_8126A58(0);
sub_8126DFC(taskId);
}
@@ -634,7 +634,7 @@ void sub_8126DFC(u8 taskId)
void sub_8126E44(u8 taskId)
{
- FillWindowPixelBuffer(sDecorMenuWindowIndices[1], 0x11);
+ FillWindowPixelBuffer(sDecorMenuWindowIndices[1], PIXEL_FILL(1));
sub_8126E8C(taskId);
InitMenuInUpperLeftCornerPlaySoundWhenAPressed(sDecorMenuWindowIndices[1], 9, sCurDecorationCategory);
gTasks[taskId].func = sub_8127088;
@@ -751,7 +751,7 @@ void sub_81270E8(u8 taskId)
void sub_8127180(u8 taskId)
{
- sub_8197434(0, 0);
+ ClearDialogWindowAndFrame(0, 0);
sub_8126DFC(taskId);
}
@@ -771,7 +771,7 @@ void sub_81271CC(u8 taskId)
{
sub_8126A58(1);
sub_8126A88();
- NewMenuHelpers_DrawDialogueFrame(0, 0);
+ DrawDialogueFrame(0, 0);
sub_8126C08();
gTasks[taskId].func = sub_8126B80;
}
@@ -779,7 +779,7 @@ void sub_81271CC(u8 taskId)
void sub_8127208(u8 taskId)
{
LoadPalette(gUnknown_085A6BB0, 0xd0, 0x20);
- sub_8197434(0, 0);
+ ClearDialogWindowAndFrame(0, 0);
gTasks[taskId].data[11] = 2;
sCurDecorationCategory = DECORCAT_DESK;
sub_8126DFC(taskId);
@@ -968,7 +968,7 @@ void sub_8127744(u32 a0)
const u8 *txt;
winidx = sDecorMenuWindowIndices[3];
- FillWindowPixelBuffer(winidx, 0x11);
+ FillWindowPixelBuffer(winidx, PIXEL_FILL(1));
if (a0 >= sCurDecorCatCount)
{
txt = gText_GoBackPrevMenu;
@@ -1095,7 +1095,7 @@ void sub_8127A14(u8 taskId)
void sub_8127A30(u8 taskId)
{
- sub_8197434(0, 0);
+ ClearDialogWindowAndFrame(0, 0);
gTasks[taskId].func = sub_8127A14;
}
@@ -1103,7 +1103,7 @@ void sub_8127A5C(u8 taskId)
{
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
{
- sub_8197434(0, 0);
+ ClearDialogWindowAndFrame(0, 0);
sub_81269D4(1);
sub_8127620(taskId);
}
@@ -1254,7 +1254,7 @@ void sub_8127E18(void)
break;
}
}
- VarSet(VAR_0x3F20 + gMapHeader.events->eventObjects[j].graphicsId, sPlaceDecorationGraphicsDataBuffer.decoration->tiles[0]);
+ VarSet(UNKNOWN_VAR_OFFSET_3F20 + gMapHeader.events->eventObjects[j].graphicsId, sPlaceDecorationGraphicsDataBuffer.decoration->tiles[0]);
gSpecialVar_0x8005 = gMapHeader.events->eventObjects[j].localId;
gSpecialVar_0x8006 = sCurDecorMapX;
gSpecialVar_0x8007 = sCurDecorMapY;
@@ -1628,13 +1628,13 @@ void sub_8128950(u8 taskId)
void sub_81289D0(u8 taskId)
{
- DisplayYesNoMenu();
+ DisplayYesNoMenuDefaultYes();
DoYesNoFuncWithChoice(taskId, &gUnknown_085A72C4);
}
void sub_81289F0(u8 taskId)
{
- sub_8197434(0, 0);
+ ClearDialogWindowAndFrame(0, 0);
sub_8128AAC(taskId);
if (gDecorations[gCurDecorInventoryItems[gCurDecorationIndex]].permission != DECORPERM_SOLID_MAT)
{
@@ -1693,13 +1693,13 @@ void sub_8128AAC(u8 taskId)
void sub_8128B80(u8 taskId)
{
- DisplayYesNoMenu();
+ DisplayYesNoMenuDefaultYes();
DoYesNoFuncWithChoice(taskId, &gUnknown_085A72CC);
}
void sub_8128BA0(u8 taskId)
{
- sub_8197434(0, 0);
+ ClearDialogWindowAndFrame(0, 0);
sub_8128BBC(taskId);
}
@@ -1887,7 +1887,7 @@ void sub_8128E18(u8 taskId)
void sub_8128FD8(u8 taskId)
{
- sub_8197434(0, 1);
+ ClearDialogWindowAndFrame(0, 1);
gSprites[sDecor_CameraSpriteObjectIdx1].data[7] = 0;
gTasks[taskId].data[10] = 0;
gTasks[taskId].func = sub_8128E18;
@@ -2251,7 +2251,7 @@ void sub_81298EC(u8 taskId)
if (!gPaletteFade.active) {
DrawWholeMapView();
ScriptContext1_SetupScript(EventScript_275D2E);
- sub_8197434(0, 1);
+ ClearDialogWindowAndFrame(0, 1);
gTasks[taskId].data[2] = 2;
}
break;
@@ -2343,7 +2343,7 @@ void sub_8129ABC(u8 taskId)
void sub_8129B34(u8 taskId)
{
- sub_8197434(0, 1);
+ ClearDialogWindowAndFrame(0, 1);
gSprites[sDecor_CameraSpriteObjectIdx1].data[7] = 0;
gSprites[sDecor_CameraSpriteObjectIdx1].invisible = FALSE;
gSprites[sDecor_CameraSpriteObjectIdx1].callback = sub_812A36C;
@@ -2588,7 +2588,7 @@ void sub_812A0E8(u8 taskId)
void sub_812A1A0(u8 taskId)
{
- DisplayYesNoMenu();
+ DisplayYesNoMenuDefaultYes();
DoYesNoFuncWithChoice(taskId, &gUnknown_085A7348);
}
@@ -2601,13 +2601,13 @@ void sub_812A1C0(u8 taskId)
void sub_812A1F0(u8 taskId)
{
- DisplayYesNoMenu();
+ DisplayYesNoMenuDefaultYes();
DoYesNoFuncWithChoice(taskId, &gUnknown_085A7350);
}
void sub_812A210(u8 taskId)
{
- sub_8197434(0, 0);
+ ClearDialogWindowAndFrame(0, 0);
sub_812A22C(taskId);
}
@@ -2671,7 +2671,7 @@ void sub_812A334(void)
u8 taskId;
pal_fill_black();
- NewMenuHelpers_DrawDialogueFrame(0, 1);
+ DrawDialogueFrame(0, 1);
sub_8126ABC();
taskId = CreateTask(sub_812A2C4, 8);
gTasks[taskId].data[2] = 0;
@@ -2725,7 +2725,7 @@ void sub_812A3D4(u8 taskId)
void sub_812A458(u8 taskId)
{
- DisplayYesNoMenu();
+ DisplayYesNoMenuDefaultYes();
DoYesNoFuncWithChoice(taskId, &gUnknown_085A741C);
}
diff --git a/src/diploma.c b/src/diploma.c
index 78d49527f..2113b09ed 100644
--- a/src/diploma.c
+++ b/src/diploma.c
@@ -196,7 +196,7 @@ static void InitDiplomaWindow(void)
InitWindows(sDiplomaWinTemplates);
DeactivateAllTextPrinters();
LoadPalette(gUnknown_0860F074, 0xF0, 0x20);
- FillWindowPixelBuffer(0, 0);
+ FillWindowPixelBuffer(0, PIXEL_FILL(0));
PutWindowTilemap(0);
}
diff --git a/src/easy_chat.c b/src/easy_chat.c
index a8fb12eb5..b03058eb9 100644
--- a/src/easy_chat.c
+++ b/src/easy_chat.c
@@ -3697,7 +3697,7 @@ static void sub_811CFCC(void)
return;
xOffset = GetStringCenterAlignXOffset(1, titleText, 144);
- FillWindowPixelBuffer(0, 0);
+ FillWindowPixelBuffer(0, PIXEL_FILL(0));
sub_811D058(0, 1, titleText, xOffset, 1, 0xFF, 0, 2, 3);
PutWindowTilemap(0);
CopyWindowToVram(0, 3);
@@ -3767,7 +3767,7 @@ static void sub_811D104(u8 arg0)
break;
}
- FillWindowPixelBuffer(1, 0x11);
+ FillWindowPixelBuffer(1, PIXEL_FILL(1));
if (text1)
sub_811D028(1, 1, text1, 0, 1, 0xFF, 0);
@@ -3817,7 +3817,7 @@ static void sub_811D2C8(void)
if (frameId == 7)
var1 = 1;
- FillWindowPixelBuffer(sUnknown_0203A11C->windowId, 0x11);
+ FillWindowPixelBuffer(sUnknown_0203A11C->windowId, PIXEL_FILL(1));
for (i = 0; i < numRows; i++)
{
memcpy(spC, sText_Clear17, sizeof(sText_Clear17));
@@ -3957,7 +3957,7 @@ static void sub_811D684(void)
static void sub_811D698(u32 arg0)
{
sub_811DD84();
- FillWindowPixelBuffer(2, 0x11);
+ FillWindowPixelBuffer(2, PIXEL_FILL(1));
switch (arg0)
{
case 0:
@@ -4114,14 +4114,14 @@ static void sub_811D950(u8 arg0, u8 arg1)
var1 = 0;
}
- FillWindowPixelRect(2, 0x11, 0, y, 224, var2);
+ FillWindowPixelRect(2, PIXEL_FILL(1), 0, y, 224, var2);
if (var1)
- FillWindowPixelRect(2, 0x11, 0, 0, 224, var1);
+ FillWindowPixelRect(2, PIXEL_FILL(1), 0, 0, 224, var1);
}
static void sub_811D9B4(void)
{
- FillWindowPixelBuffer(2, 0x11);
+ FillWindowPixelBuffer(2, PIXEL_FILL(1));
CopyWindowToVram(2, 2);
}
@@ -4791,7 +4791,7 @@ static void sub_811E948(void)
template.paletteNum = 11;
template.baseBlock = 0x34;
windowId = AddWindow(&template);
- FillWindowPixelBuffer(windowId, 0x11);
+ FillWindowPixelBuffer(windowId, PIXEL_FILL(1));
for (i = 0; i < 4; i++)
{
const u8 *str = sFooterTextOptions[footerId][i];
diff --git a/src/egg_hatch.c b/src/egg_hatch.c
index ba1020669..a9b6001ec 100644
--- a/src/egg_hatch.c
+++ b/src/egg_hatch.c
@@ -606,7 +606,7 @@ static void CB2_EggHatch_1(void)
case 1:
if (!gPaletteFade.active)
{
- FillWindowPixelBuffer(sEggHatchData->windowId, 0);
+ FillWindowPixelBuffer(sEggHatchData->windowId, PIXEL_FILL(0));
sEggHatchData->CB2_PalCounter = 0;
sEggHatchData->CB2_state++;
}
@@ -857,7 +857,7 @@ static void CreateEggShardSprite(u8 x, u8 y, s16 data1, s16 data2, s16 data3, u8
static void EggHatchPrintMessage(u8 windowId, u8* string, u8 x, u8 y, u8 speed)
{
- FillWindowPixelBuffer(windowId, 0xFF);
+ FillWindowPixelBuffer(windowId, PIXEL_FILL(15));
sEggHatchData->textColor[0] = 0;
sEggHatchData->textColor[1] = 5;
sEggHatchData->textColor[2] = 6;
diff --git a/src/event_data.c b/src/event_data.c
index e75c37773..50628f984 100644
--- a/src/event_data.c
+++ b/src/event_data.c
@@ -23,8 +23,8 @@ EWRAM_DATA u16 gSpecialVar_LastTalked = 0;
EWRAM_DATA u16 gSpecialVar_Facing = 0;
EWRAM_DATA u16 gSpecialVar_MonBoxId = 0;
EWRAM_DATA u16 gSpecialVar_MonBoxPos = 0;
-EWRAM_DATA u16 gSpecialVar_0x8014 = 0;
-EWRAM_DATA static u8 gUnknown_020375FC[16] = {0};
+EWRAM_DATA u16 gSpecialVar_Unused_0x8014 = 0;
+EWRAM_DATA static u8 gSpecialFlags[16] = {0};
extern u16 *const gSpecialVars[];
@@ -32,7 +32,7 @@ void InitEventData(void)
{
memset(gSaveBlock1Ptr->flags, 0, sizeof(gSaveBlock1Ptr->flags));
memset(gSaveBlock1Ptr->vars, 0, sizeof(gSaveBlock1Ptr->vars));
- memset(gUnknown_020375FC, 0, sizeof(gUnknown_020375FC));
+ memset(gSpecialFlags, 0, sizeof(gSpecialFlags));
}
void ClearTempFieldEventData(void)
@@ -131,13 +131,13 @@ void sub_809D4D8(void)
void sub_809D570(void)
{
VarSet(VAR_EVENT_PICHU_SLOT, 0);
- VarSet(VAR_0x40DE, 0);
- VarSet(VAR_0x40DF, 0);
- VarSet(VAR_0x40E0, 0);
- VarSet(VAR_0x40E1, 0);
- VarSet(VAR_0x40E2, 0);
- VarSet(VAR_0x40E3, 0);
- VarSet(VAR_0x40E4, 0);
+ VarSet(VAR_NEVER_READ_0x40DE, 0);
+ VarSet(VAR_NEVER_READ_0x40DF, 0);
+ VarSet(VAR_NEVER_READ_0x40E0, 0);
+ VarSet(VAR_NEVER_READ_0x40E1, 0);
+ VarSet(VAR_NEVER_READ_0x40E2, 0);
+ VarSet(VAR_NEVER_READ_0x40E3, 0);
+ VarSet(VAR_NEVER_READ_0x40E4, 0);
}
void DisableResetRTC(void)
@@ -199,7 +199,7 @@ u8 *GetFlagPointer(u16 id)
else if (id < SPECIAL_FLAGS_START)
return &gSaveBlock1Ptr->flags[id / 8];
else
- return &gUnknown_020375FC[(id - SPECIAL_FLAGS_START) / 8];
+ return &gSpecialFlags[(id - SPECIAL_FLAGS_START) / 8];
}
u8 FlagSet(u16 id)
diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c
index f5961bb48..680191bb3 100644
--- a/src/field_control_avatar.c
+++ b/src/field_control_avatar.c
@@ -556,9 +556,9 @@ static bool8 TryStartStepCountScript(u16 metatileBehavior)
ScriptContext1_SetupScript(EventScript_EggHatch);
return TRUE;
}
- if (sub_813B3B0() == TRUE)
+ if (UnusualWeatherHasExpired() == TRUE)
{
- ScriptContext1_SetupScript(gUnknown_08273D1F);
+ ScriptContext1_SetupScript(UnusualWeather_EventScript_EndEventAndCleanup_1);
return TRUE;
}
if (ShouldDoBrailleRegicePuzzle() == TRUE)
@@ -566,27 +566,27 @@ static bool8 TryStartStepCountScript(u16 metatileBehavior)
ScriptContext1_SetupScript(IslandCave_EventScript_238EAF);
return TRUE;
}
- if (is_tile_that_overrides_player_control() == TRUE)
+ if (ShouldDoWallyCall() == TRUE)
{
ScriptContext1_SetupScript(MauvilleCity_EventScript_1DF7BA);
return TRUE;
}
- if (sub_8138120() == TRUE)
+ if (ShouldDoWinonaCall() == TRUE)
{
ScriptContext1_SetupScript(Route119_EventScript_1F49EC);
return TRUE;
}
- if (sub_8138168() == TRUE)
+ if (ShouldDoScottCall() == TRUE)
{
ScriptContext1_SetupScript(LittlerootTown_ProfessorBirchsLab_EventScript_1FA4D6);
return TRUE;
}
- if (sub_81381B0() == TRUE)
+ if (ShouldDoRoxanneCall() == TRUE)
{
ScriptContext1_SetupScript(RustboroCity_Gym_EventScript_21307B);
return TRUE;
}
- if (sub_81381F8() == TRUE)
+ if (ShouldDoRivalRayquazaCall() == TRUE)
{
ScriptContext1_SetupScript(MossdeepCity_SpaceCenter_2F_EventScript_224175);
return TRUE;
diff --git a/src/field_effect.c b/src/field_effect.c
index fcdc483e6..ee9dcb987 100644
--- a/src/field_effect.c
+++ b/src/field_effect.c
@@ -2437,7 +2437,7 @@ static void sub_80B8410(struct Task *task)
bool8 FldEff_FieldMoveShowMon(void)
{
u8 taskId;
- if (is_map_type_1_2_3_5_or_6(GetCurrentMapType()) == TRUE)
+ if (IsMapTypeOutdoors(GetCurrentMapType()) == TRUE)
{
taskId = CreateTask(sub_80B8554, 0xff);
} else
diff --git a/src/field_message_box.c b/src/field_message_box.c
index fa1aee566..1c554b6c6 100755
--- a/src/field_message_box.c
+++ b/src/field_message_box.c
@@ -31,7 +31,7 @@ static void sub_8098154(u8 taskId)
task->data[0]++;
break;
case 1:
- NewMenuHelpers_DrawDialogueFrame(0, 1);
+ DrawDialogueFrame(0, 1);
task->data[0]++;
break;
case 2:
@@ -125,7 +125,7 @@ static void textbox_auto_and_task_add(void)
void HideFieldMessageBox(void)
{
task_del_textbox();
- sub_8197434(0, 1);
+ ClearDialogWindowAndFrame(0, 1);
sFieldMessageBoxMode = 0;
}
@@ -144,7 +144,7 @@ bool8 IsFieldMessageBoxHidden(void)
void sub_8098358(void)
{
task_del_textbox();
- NewMenuHelpers_DrawStdWindowFrame(0, 1);
+ DrawStdWindowFrame(0, 1);
sFieldMessageBoxMode = 0;
}
diff --git a/src/field_player_avatar.c b/src/field_player_avatar.c
index 66f176d39..a070fe0e1 100644
--- a/src/field_player_avatar.c
+++ b/src/field_player_avatar.c
@@ -1918,7 +1918,7 @@ static bool8 Fishing9(struct Task *task)
static bool8 Fishing10(struct Task *task)
{
AlignFishingAnimationFrames();
- FillWindowPixelBuffer(0, 0x11);
+ FillWindowPixelBuffer(0, PIXEL_FILL(1));
AddTextPrinterParameterized2(0, 1, gText_PokemonOnHook, 1, 0, 2, 1, 3);
task->tStep++;
task->tFrameCounter = 0;
@@ -1944,7 +1944,7 @@ static bool8 Fishing11(struct Task *task)
sub_8155604(gEventObjects[gPlayerAvatar.eventObjectId].fieldEffectSpriteId, 0, 0);
gSprites[gPlayerAvatar.spriteId].pos2.x = 0;
gSprites[gPlayerAvatar.spriteId].pos2.y = 0;
- sub_8197434(0, TRUE);
+ ClearDialogWindowAndFrame(0, TRUE);
task->tFrameCounter++;
return FALSE;
}
@@ -1966,7 +1966,7 @@ static bool8 Fishing12(struct Task *task)
{
AlignFishingAnimationFrames();
StartSpriteAnim(&gSprites[gPlayerAvatar.spriteId], GetFishingNoCatchDirectionAnimNum(GetPlayerFacingDirection()));
- FillWindowPixelBuffer(0, 0x11);
+ FillWindowPixelBuffer(0, PIXEL_FILL(1));
AddTextPrinterParameterized2(0, 1, gText_NotEvenANibble, 1, 0, 2, 1, 3);
task->tStep = FISHING_SHOW_RESULT;
return TRUE;
@@ -1977,7 +1977,7 @@ static bool8 Fishing13(struct Task *task)
{
AlignFishingAnimationFrames();
StartSpriteAnim(&gSprites[gPlayerAvatar.spriteId], GetFishingNoCatchDirectionAnimNum(GetPlayerFacingDirection()));
- FillWindowPixelBuffer(0, 0x11);
+ FillWindowPixelBuffer(0, PIXEL_FILL(1));
AddTextPrinterParameterized2(0, 1, gText_ItGotAway, 1, 0, 2, 1, 3);
task->tStep++;
return TRUE;
@@ -2017,7 +2017,7 @@ static bool8 Fishing16(struct Task *task)
gPlayerAvatar.preventStep = FALSE;
ScriptContext2_Disable();
UnfreezeEventObjects();
- sub_8197434(0, TRUE);
+ ClearDialogWindowAndFrame(0, TRUE);
sub_80ED950(0);
DestroyTask(FindTaskIdByFunc(Task_Fishing));
}
diff --git a/src/field_region_map.c b/src/field_region_map.c
index d49ce3a4e..1d54333fb 100644
--- a/src/field_region_map.c
+++ b/src/field_region_map.c
@@ -139,11 +139,11 @@ static void FieldUpdateRegionMap(void)
sFieldRegionMapHandler->state++;
break;
case 1:
- SetWindowBorderStyle(1, 0, 0x27, 0xd);
+ DrawStdFrameWithCustomTileAndPalette(1, 0, 0x27, 0xd);
offset = GetStringCenterAlignXOffset(1, gText_Hoenn, 0x38);
AddTextPrinterParameterized(1, 1, gText_Hoenn, offset, 1, 0, NULL);
schedule_bg_copy_tilemap_to_vram(0);
- SetWindowBorderStyle(0, 0, 0x27, 0xd);
+ DrawStdFrameWithCustomTileAndPalette(0, 0, 0x27, 0xd);
PrintRegionMapSecName();
BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, 0);
sFieldRegionMapHandler->state++;
@@ -196,13 +196,13 @@ static void PrintRegionMapSecName(void)
{
if (sFieldRegionMapHandler->regionMap.iconDrawType != MAPSECTYPE_NONE)
{
- FillWindowPixelBuffer(0, 0x11);
+ FillWindowPixelBuffer(0, PIXEL_FILL(1));
AddTextPrinterParameterized(0, 1, sFieldRegionMapHandler->regionMap.mapSecName, 0, 1, 0, NULL);
schedule_bg_copy_tilemap_to_vram(0);
}
else
{
- FillWindowPixelBuffer(0, 0x11);
+ FillWindowPixelBuffer(0, PIXEL_FILL(1));
CopyWindowToVram(0, 3);
}
}
diff --git a/src/field_specials.c b/src/field_specials.c
index 85bc41723..436b06f53 100644
--- a/src/field_specials.c
+++ b/src/field_specials.c
@@ -358,17 +358,17 @@ u8 GetSSTidalLocation(s8 *mapGroup, s8 *mapNum, s16 *x, s16 *y)
return 0;
}
-bool32 is_tile_that_overrides_player_control(void)
+bool32 ShouldDoWallyCall(void)
{
if (FlagGet(FLAG_ENABLE_FIRST_WALLY_POKENAV_CALL))
{
switch (gMapHeader.mapType)
{
- case 1:
- case 2:
- case 3:
- case 6:
- if (++(*GetVarPointer(VAR_0x40F2)) < 0xFA)
+ case MAP_TYPE_TOWN:
+ case MAP_TYPE_CITY:
+ case MAP_TYPE_ROUTE:
+ case MAP_TYPE_OCEAN_ROUTE:
+ if (++(*GetVarPointer(VAR_WALLY_CALL_STEP_COUNTER)) < 250)
{
return FALSE;
}
@@ -385,7 +385,7 @@ bool32 is_tile_that_overrides_player_control(void)
return TRUE;
}
-bool32 sub_8138120(void)
+bool32 ShouldDoWinonaCall(void)
{
if (FlagGet(FLAG_REGISTER_WINONA_POKENAV))
{
@@ -394,8 +394,8 @@ bool32 sub_8138120(void)
case MAP_TYPE_TOWN:
case MAP_TYPE_CITY:
case MAP_TYPE_ROUTE:
- case MAP_TYPE_6:
- if (++(*GetVarPointer(VAR_0x40F3)) < 10)
+ case MAP_TYPE_OCEAN_ROUTE:
+ if (++(*GetVarPointer(VAR_WINONA_CALL_STEP_COUNTER)) < 10)
{
return FALSE;
}
@@ -412,7 +412,7 @@ bool32 sub_8138120(void)
return TRUE;
}
-bool32 sub_8138168(void)
+bool32 ShouldDoScottCall(void)
{
if (FlagGet(FLAG_SCOTT_CALL_NATIONAL_DEX))
{
@@ -422,7 +422,7 @@ bool32 sub_8138168(void)
case 2:
case 3:
case 6:
- if (++(*GetVarPointer(VAR_0x40F5)) < 0xA)
+ if (++(*GetVarPointer(VAR_SCOTT_CALL_STEP_COUNTER)) < 10)
{
return FALSE;
}
@@ -439,7 +439,7 @@ bool32 sub_8138168(void)
return TRUE;
}
-bool32 sub_81381B0(void)
+bool32 ShouldDoRoxanneCall(void)
{
if (FlagGet(FLAG_ENABLE_ROXANNE_FIRST_CALL))
{
@@ -449,7 +449,7 @@ bool32 sub_81381B0(void)
case 2:
case 3:
case 6:
- if (++(*GetVarPointer(VAR_0x40F4)) < 0xFA)
+ if (++(*GetVarPointer(VAR_ROXANNE_CALL_STEP_COUNTER)) < 250)
{
return FALSE;
}
@@ -466,7 +466,7 @@ bool32 sub_81381B0(void)
return TRUE;
}
-bool32 sub_81381F8(void)
+bool32 ShouldDoRivalRayquazaCall(void)
{
if (FlagGet(FLAG_DEFEATED_MAGMA_SPACE_CENTER))
{
@@ -476,7 +476,7 @@ bool32 sub_81381F8(void)
case 2:
case 3:
case 6:
- if (++(*GetVarPointer(VAR_0x40F6)) < 0xFA)
+ if (++(*GetVarPointer(VAR_RIVAL_RAYQUAZA_CALL_STEP_COUNTER)) < 250)
{
return FALSE;
}
@@ -1516,7 +1516,7 @@ bool8 FoundBlackGlasses(void)
void SetRoute119Weather(void)
{
- if (is_map_type_1_2_3_5_or_6(GetLastUsedWarpMapType()) != TRUE)
+ if (IsMapTypeOutdoors(GetLastUsedWarpMapType()) != TRUE)
{
SetSav1Weather(20);
}
@@ -1524,7 +1524,7 @@ void SetRoute119Weather(void)
void SetRoute123Weather(void)
{
- if (is_map_type_1_2_3_5_or_6(GetLastUsedWarpMapType()) != TRUE)
+ if (IsMapTypeOutdoors(GetLastUsedWarpMapType()) != TRUE)
{
SetSav1Weather(21);
}
@@ -1860,7 +1860,7 @@ void sub_8139B60(void)
void sub_8139C10(void)
{
- sub_8198070(gUnknown_0203AB5E, TRUE);
+ ClearStdWindowAndFrameToTransparent(gUnknown_0203AB5E, TRUE);
RemoveWindow(gUnknown_0203AB5E);
}
@@ -2645,8 +2645,8 @@ static void sub_813A570(u8 taskId)
sub_813A738(taskId);
DestroyListMenuTask(task->data[14], NULL, NULL);
Free(gUnknown_0203AB64);
- sub_8198070(task->data[13], 1);
- FillWindowPixelBuffer(task->data[13], 0);
+ ClearStdWindowAndFrameToTransparent(task->data[13], 1);
+ FillWindowPixelBuffer(task->data[13], PIXEL_FILL(0));
CopyWindowToVram(task->data[13], 2);
RemoveWindow(task->data[13]);
DestroyTask(taskId);
@@ -2890,7 +2890,7 @@ void sub_813A958(void)
void sub_813A988(void)
{
- sub_8198070(gUnknown_0203AB6D, TRUE);
+ ClearStdWindowAndFrameToTransparent(gUnknown_0203AB6D, TRUE);
RemoveWindow(gUnknown_0203AB6D);
}
@@ -2942,7 +2942,7 @@ void sub_813AA18(void)
void sub_813AA44(void)
{
- sub_8198070(gUnknown_0203AB6E, TRUE);
+ ClearStdWindowAndFrameToTransparent(gUnknown_0203AB6E, TRUE);
RemoveWindow(gUnknown_0203AB6E);
}
@@ -3001,7 +3001,7 @@ static void sub_813AA60(u16 a0, u16 a1)
if (a0 > 2 && a0 < 7)
{
- FillWindowPixelRect(0, 0x11, 0, 0, 216, 32);
+ FillWindowPixelRect(0, PIXEL_FILL(1), 0, 0, 216, 32);
switch (a0)
{
case 3:
@@ -3140,7 +3140,7 @@ static void sub_813AD34(u8 a0, u16 a1)
if (a0 == 9 || a0 == 10)
{
- FillWindowPixelRect(gUnknown_0203AB5E, 0x11, 0, 0, 96, 48);
+ FillWindowPixelRect(gUnknown_0203AB5E, PIXEL_FILL(1), 0, 0, 96, 48);
if (a0 == 10)
{
AddTextPrinterParameterized(gUnknown_0203AB5E, 1, gUnknown_085B3254[a1], 0, 1, 0, NULL);
@@ -3154,7 +3154,7 @@ static void sub_813AD34(u8 a0, u16 a1)
void sub_813ADB8(void)
{
- sub_8198070(gUnknown_0203AB5E, TRUE);
+ ClearStdWindowAndFrameToTransparent(gUnknown_0203AB5E, TRUE);
RemoveWindow(gUnknown_0203AB5E);
}
@@ -3226,8 +3226,8 @@ void sub_813AF48(void)
struct Task *task = &gTasks[taskId];
DestroyListMenuTask(task->data[14], NULL, NULL);
Free(gUnknown_0203AB64);
- sub_8198070(task->data[13], TRUE);
- FillWindowPixelBuffer(task->data[13], 0);
+ ClearStdWindowAndFrameToTransparent(task->data[13], TRUE);
+ FillWindowPixelBuffer(task->data[13], PIXEL_FILL(0));
ClearWindowTilemap(task->data[13]);
CopyWindowToVram(task->data[13], 2);
RemoveWindow(task->data[13]);
@@ -3421,40 +3421,59 @@ bool8 sub_813B260(void)
return FALSE;
}
-void sub_813B2E4(void)
+void CreateUnusualWeatherEvent(void)
{
u16 randomValue = Random();
- VarSet(VAR_0x4038, 0);
+ VarSet(VAR_UNUSUAL_WEATHER_STEP_COUNTER, 0);
if (FlagGet(FLAG_DEFEATED_KYOGRE) == TRUE)
{
- VarSet(VAR_0x4037, (randomValue & 7) + 1);
+ VarSet(VAR_UNUSUAL_WEATHER_LOCATION, (randomValue % UNUSUAL_WEATHER_COUNT_PER_LEGENDARY) + UNUSUAL_WEATHER_GROUDON_LOCATIONS_START);
}
else if (FlagGet(FLAG_DEFEATED_GROUDON) == TRUE)
{
- VarSet(VAR_0x4037, (randomValue & 7) + 9);
+ VarSet(VAR_UNUSUAL_WEATHER_LOCATION, (randomValue % UNUSUAL_WEATHER_COUNT_PER_LEGENDARY) + UNUSUAL_WEATHER_KYOGRE_LOCATIONS_START);
}
else if ((randomValue & 1) == 0)
{
randomValue = Random();
- VarSet(VAR_0x4037, (randomValue & 7) + 1);
+ VarSet(VAR_UNUSUAL_WEATHER_LOCATION, (randomValue % UNUSUAL_WEATHER_COUNT_PER_LEGENDARY) + UNUSUAL_WEATHER_GROUDON_LOCATIONS_START);
}
else
{
randomValue = Random();
- VarSet(VAR_0x4037, (randomValue & 7) + 9);
- }
-}
-
-bool32 sub_813B374(void)
-{
- static const u8 gUnknown_085B3400[] = { 0x1d, 0x1d, 0x1e, 0x1e, 0x1f, 0x1f, 0x21, 0x21, 0x14, 0x14, 0x28, 0x28, 0x2a, 0x2a, 0x2c, 0x2c };
+ VarSet(VAR_UNUSUAL_WEATHER_LOCATION, (randomValue % UNUSUAL_WEATHER_COUNT_PER_LEGENDARY) + UNUSUAL_WEATHER_KYOGRE_LOCATIONS_START);
+ }
+}
+
+// Saves the map name for the current unusual weather location in gStringVar1, then
+// returns TRUE if the weather is for Kyogre, and FALSE if it's for Groudon.
+bool32 GetUnusualWeatherMapNameAndType(void)
+{
+ static const u8 sUnusualWeatherMapNumbers[] = {
+ MAP_NUM(ROUTE114),
+ MAP_NUM(ROUTE114),
+ MAP_NUM(ROUTE115),
+ MAP_NUM(ROUTE115),
+ MAP_NUM(ROUTE116),
+ MAP_NUM(ROUTE116),
+ MAP_NUM(ROUTE118),
+ MAP_NUM(ROUTE118),
+ MAP_NUM(ROUTE105),
+ MAP_NUM(ROUTE105),
+ MAP_NUM(ROUTE125),
+ MAP_NUM(ROUTE125),
+ MAP_NUM(ROUTE127),
+ MAP_NUM(ROUTE127),
+ MAP_NUM(ROUTE129),
+ MAP_NUM(ROUTE129)
+ };
- u16 var = VarGet(VAR_0x4037);
+ u16 unusualWeather = VarGet(VAR_UNUSUAL_WEATHER_LOCATION);
- GetMapName(gStringVar1, gUnknown_085B3400[var - 1], 0);
+ GetMapName(gStringVar1, sUnusualWeatherMapNumbers[unusualWeather - 1], 0);
- if (var < 9)
+ if (unusualWeather < UNUSUAL_WEATHER_KYOGRE_LOCATIONS_START)
{
return FALSE;
}
@@ -3464,21 +3483,39 @@ bool32 sub_813B374(void)
}
}
-bool8 sub_813B3B0(void)
-{
- static const u8 gUnknown_085B3410[] = { 0x1d, 0x1d, 0x1e, 0x1e, 0x1f, 0x1f, 0x21, 0x21, 0x14, 0x14, 0x28, 0x28, 0x2a, 0x2a, 0x2c, 0x2c };
+bool8 UnusualWeatherHasExpired(void)
+{
+ // Duplicate array.
+ static const u8 sUnusualWeatherMapNumbers_2[] = {
+ MAP_NUM(ROUTE114),
+ MAP_NUM(ROUTE114),
+ MAP_NUM(ROUTE115),
+ MAP_NUM(ROUTE115),
+ MAP_NUM(ROUTE116),
+ MAP_NUM(ROUTE116),
+ MAP_NUM(ROUTE118),
+ MAP_NUM(ROUTE118),
+ MAP_NUM(ROUTE105),
+ MAP_NUM(ROUTE105),
+ MAP_NUM(ROUTE125),
+ MAP_NUM(ROUTE125),
+ MAP_NUM(ROUTE127),
+ MAP_NUM(ROUTE127),
+ MAP_NUM(ROUTE129),
+ MAP_NUM(ROUTE129)
+ };
- u16 var1 = VarGet(VAR_0x4038);
- u16 var2 = VarGet(VAR_0x4037);
+ u16 steps = VarGet(VAR_UNUSUAL_WEATHER_STEP_COUNTER);
+ u16 unusualWeather = VarGet(VAR_UNUSUAL_WEATHER_LOCATION);
- if (!var2)
+ if (unusualWeather == UNUSUAL_WEATHER_NONE)
{
return FALSE;
}
- if (++var1 > 999)
+ if (++steps > 999)
{
- VarSet(VAR_0x4038, 0);
+ VarSet(VAR_UNUSUAL_WEATHER_STEP_COUNTER, 0);
if (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(UNDERWATER_MARINE_CAVE))
{
switch (gSaveBlock1Ptr->location.mapNum)
@@ -3488,7 +3525,7 @@ bool8 sub_813B3B0(void)
case MAP_NUM(MARINE_CAVE_END):
case MAP_NUM(TERRA_CAVE_ENTRANCE):
case MAP_NUM(TERRA_CAVE_END):
- VarSet(VAR_0x4039, 1);
+ VarSet(VAR_SHOULD_END_UNUSUAL_WEATHER, 1);
return FALSE;
default:
break;
@@ -3503,27 +3540,27 @@ bool8 sub_813B3B0(void)
case MAP_NUM(UNDERWATER5):
case MAP_NUM(UNDERWATER6):
case MAP_NUM(UNDERWATER7):
- VarSet(VAR_0x4039, 1);
+ VarSet(VAR_SHOULD_END_UNUSUAL_WEATHER, 1);
return FALSE;
default:
break;
}
}
- if (gSaveBlock1Ptr->location.mapNum == gUnknown_085B3410[var2 - 1] &&
+ if (gSaveBlock1Ptr->location.mapNum == sUnusualWeatherMapNumbers_2[unusualWeather - 1] &&
gSaveBlock1Ptr->location.mapGroup == 0)
{
return TRUE;
}
else
{
- VarSet(VAR_0x4037, 0);
+ VarSet(VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_NONE);
return FALSE;
}
}
else
{
- VarSet(VAR_0x4038, var1);
+ VarSet(VAR_UNUSUAL_WEATHER_STEP_COUNTER, steps);
return FALSE;
}
}
@@ -3577,7 +3614,7 @@ bool32 sub_813B4E0(void)
bool32 sub_813B514(void)
{
- if (!VarGet(VAR_0x403F))
+ if (!VarGet(VAR_ALWAYS_ZERO_0x403F))
{
return FALSE;
}
diff --git a/src/fldeff_misc.c b/src/fldeff_misc.c
index df4576a7f..d4d6075f3 100644
--- a/src/fldeff_misc.c
+++ b/src/fldeff_misc.c
@@ -1126,7 +1126,7 @@ void GetShieldToyTVDecorationInfo(void)
if (!VarGet(VAR_CURRENT_SECRET_BASE))
return;
- VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x10);
+ VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x10);
break;
case 734:
ConvertIntToDecimalStringN(gStringVar1, 50, STR_CONV_MODE_LEFT_ALIGN, 2);
@@ -1137,7 +1137,7 @@ void GetShieldToyTVDecorationInfo(void)
if (!VarGet(VAR_CURRENT_SECRET_BASE))
return;
- VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x20);
+ VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x20);
break;
case 756:
gSpecialVar_Result = 1;
@@ -1145,7 +1145,7 @@ void GetShieldToyTVDecorationInfo(void)
if (!VarGet(VAR_CURRENT_SECRET_BASE))
return;
- VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x80);
+ VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x80);
break;
case 757:
gSpecialVar_Result = 2;
@@ -1153,7 +1153,7 @@ void GetShieldToyTVDecorationInfo(void)
if (!VarGet(VAR_CURRENT_SECRET_BASE))
return;
- VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x80);
+ VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x80);
break;
case 758:
gSpecialVar_Result = 3;
@@ -1161,7 +1161,7 @@ void GetShieldToyTVDecorationInfo(void)
if (!VarGet(VAR_CURRENT_SECRET_BASE))
return;
- VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x80);
+ VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x80);
break;
}
}
diff --git a/src/fldeff_softboiled.c b/src/fldeff_softboiled.c
index adec780b3..eca7d045b 100644
--- a/src/fldeff_softboiled.c
+++ b/src/fldeff_softboiled.c
@@ -86,7 +86,7 @@ static void sub_8161724(u8 taskId)
sub_81B0FCC(gUnknown_0203CEC8.unk9, 0);
gUnknown_0203CEC8.unk9 = gUnknown_0203CEC8.unkA;
sub_81B0FCC(gUnknown_0203CEC8.unkA, 1);
- sub_8198070(0x6, FALSE);
+ ClearStdWindowAndFrameToTransparent(0x6, FALSE);
ClearWindowTilemap(0x6);
display_pokemon_menu_message(0);
gTasks[taskId].func = sub_81B1370;
diff --git a/src/flying.c b/src/flying.c
index 48df12a06..a157582e9 100644
--- a/src/flying.c
+++ b/src/flying.c
@@ -4,6 +4,9 @@
#include "trig.h"
#include "constants/battle_anim.h"
#include "constants/rgb.h"
+#include "random.h"
+
+extern const struct SpriteTemplate gUnknown_085973E8;
void sub_810DE70(struct Sprite *);
void sub_810DFA8(struct Sprite *);
@@ -11,22 +14,29 @@ void sub_810E044(struct Sprite *);
void sub_810E13C(struct Sprite *);
void sub_810E1C8(struct Sprite *);
void sub_810E314(struct Sprite *);
-extern void sub_810EA4C(struct Sprite *);
-extern void sub_810EAA0(struct Sprite *);
-extern void sub_810EC34(struct Sprite *);
-extern void sub_810EC94(struct Sprite *);
-extern void sub_810ED28(struct Sprite *);
-extern void sub_810EE14(struct Sprite *);
-extern void sub_810EEF8(struct Sprite *);
-extern void sub_810F004(struct Sprite *);
-extern void sub_810F084(struct Sprite *);
+void sub_810E520(struct Sprite *);
+void sub_810EB40(struct Sprite *);
+void sub_810EA4C(struct Sprite *);
+void sub_810EAA0(struct Sprite *);
+void sub_810EC34(struct Sprite *);
+void sub_810EC94(struct Sprite *);
+void sub_810ED28(struct Sprite *);
+void sub_810ED70(struct Sprite *);
+void sub_810EDD0(struct Sprite *);
+void sub_810EE14(struct Sprite *);
+void sub_810EEF8(struct Sprite *);
+void sub_810EFA8(struct Sprite *);
+void sub_810F004(struct Sprite *);
+void sub_810F018(struct Sprite *);
+void sub_810F084(struct Sprite *);
+void sub_810F140(struct Sprite *);
static void sub_810DE98(struct Sprite *);
static void sub_810DF18(u8);
static void sub_810E028(struct Sprite *);
static void sub_810E184(struct Sprite *);
static void sub_810E24C(struct Sprite *);
-void sub_810E520(struct Sprite *);
+
const struct SpriteTemplate gUnknown_08596270 =
{
@@ -98,7 +108,7 @@ const union AffineAnimCmd gUnknown_085962EC[] =
const union AffineAnimCmd *const gUnknown_08596314[] =
{
- gUnknown_085962EC,
+ gUnknown_085962EC,
};
const union AffineAnimCmd gUnknown_08596318[] =
@@ -347,7 +357,8 @@ void sub_810DE70(struct Sprite *sprite)
sprite->callback(sprite);
}
-static void sub_810DE98(struct Sprite *sprite) {
+static void sub_810DE98(struct Sprite *sprite)
+{
sprite->pos2.x = Sin(sprite->data[1], 32);
sprite->pos2.y = Cos(sprite->data[1], 8);
sprite->data[1] += 5;
@@ -382,8 +393,7 @@ static void sub_810DF18(u8 taskId)
{
gPlttBufferFaded[base + 0x101 + i] = gPlttBufferFaded[base + 0x100 + i];
i--;
- }
- while (i > 0);
+ } while (i > 0);
gPlttBufferFaded[base + 0x101] = temp;
}
@@ -514,7 +524,9 @@ static void sub_810E24C(struct Sprite *sprite)
sprite->data[3] &= 0xFF;
}
- if ((u32)(sprite->pos1.x + sprite->pos2.x + 32) > 304 || sprite->pos1.y + sprite->pos2.y > 160)
+ if (sprite->pos1.x + sprite->pos2.x < -32
+ || sprite->pos1.x + sprite->pos2.x > 272
+ || sprite->pos1.y + sprite->pos2.y > 160)
{
gSprites[GetAnimBattlerSpriteId(ANIM_ATTACKER)].invisible = 0;
DestroyAnimSprite(sprite);
@@ -536,56 +548,62 @@ void sub_810E2C8(struct Sprite *sprite)
}
}
-// FAKEMATCHING
+struct FeatherDanceData
+{
+ u8 unk0_0a:1;
+ u8 unk0_0b:1;
+ u8 unk0_0c:1;
+ u8 unk0_0d:1;
+ u8 unk0_1:4;
+ u8 unk1;
+ u16 unk2;
+ s16 unk4;
+ u16 unk6;
+ u16 unk8;
+ u16 unkA;
+ u8 unkC[2];
+ u16 unkE_0:1;
+ u16 unkE_1:15;
+};
+
void sub_810E314(struct Sprite *sprite)
{
- s16 *data;
- u8 slot;
- s16 spriteCoord;
- int t1, t2;
- u32 arg2;
- u32 matrixNum;
- u8 sinIndex;
- register s16 sinVal asm ("r4");
- register int sinVal2 asm ("r0");
+ u8 battler, matrixNum, sinIndex;
+ s16 spriteCoord, sinVal;
- data = sprite->data;
+ struct FeatherDanceData *data = (struct FeatherDanceData *)sprite->data;
if (gBattleAnimArgs[7] & 0x100)
- slot = gBattleAnimAttacker;
+ battler = gBattleAnimAttacker;
else
- slot = gBattleAnimTarget;
+ battler = gBattleAnimTarget;
- if (GetBattlerSide(slot) == B_SIDE_PLAYER)
+ if (GetBattlerSide(battler) == B_SIDE_PLAYER)
gBattleAnimArgs[0] = -gBattleAnimArgs[0];
- sprite->pos1.x = GetBattlerSpriteCoord(slot, 0) + gBattleAnimArgs[0];
- spriteCoord = GetBattlerSpriteCoord(slot, 1);
+ sprite->pos1.x = GetBattlerSpriteCoord(battler, BATTLER_COORD_ATTR_HEIGHT) + gBattleAnimArgs[0];
+ spriteCoord = GetBattlerSpriteCoord(battler, BATTLER_COORD_ATTR_WIDTH);
sprite->pos1.y = spriteCoord + gBattleAnimArgs[1];
- data[4] = sprite->pos1.y << 8;
-
- t1 = (spriteCoord + (u16) gBattleAnimArgs[6]) << 1;
- data[7] = (data[7] & 1) | t1;
- ((u8 *) data)[0] |= 4;
- arg2 = (u16) gBattleAnimArgs[2];
- data[1] = (u8) gBattleAnimArgs[2];
- arg2 <<= 16;
- data[5] = arg2 >> 24;
- data[2] = gBattleAnimArgs[3];
- data[3] = gBattleAnimArgs[4];
- data[6] = gBattleAnimArgs[5];
+ data->unk8 = sprite->pos1.y << 8;
+ data->unkE_1 = spriteCoord + gBattleAnimArgs[6];
+ data->unk0_0c = 1;
+ data->unk2 = gBattleAnimArgs[2] & 0xFF;
+ data->unkA = (gBattleAnimArgs[2] >> 8) & 0xFF;
+ data->unk4 = gBattleAnimArgs[3];
+ data->unk6 = gBattleAnimArgs[4];
+ *(u16*)(data->unkC) = gBattleAnimArgs[5];
- if ((u16) (data[1] - 64) <= 0x7f)
+ if (data->unk2 >= 64 && data->unk2 <= 191)
{
if (!IsContest())
- sprite->oam.priority = GetBattlerSpriteBGPriority(slot) + 1;
+ sprite->oam.priority = GetBattlerSpriteBGPriority(battler) + 1;
else
- sprite->oam.priority = GetBattlerSpriteBGPriority(slot);
+ sprite->oam.priority = GetBattlerSpriteBGPriority(battler);
- ((u8 *) data)[14] = data[7] & -2;
+ data->unkE_0 = 0;
- if (!(data[2] & 0x8000))
+ if (!(data->unk4 & 0x8000))
{
sprite->hFlip ^= 1;
sprite->animNum = sprite->hFlip;
@@ -596,10 +614,10 @@ void sub_810E314(struct Sprite *sprite)
}
else
{
- sprite->oam.priority = GetBattlerSpriteBGPriority(slot);
- ((u8 *) data)[14] |= 1;
+ sprite->oam.priority = GetBattlerSpriteBGPriority(battler);
+ data->unkE_0 = 1;
- if (data[2] & 0x8000)
+ if (data->unk4 & 0x8000)
{
sprite->hFlip ^= 1;
sprite->animNum = sprite->hFlip;
@@ -609,20 +627,1291 @@ void sub_810E314(struct Sprite *sprite)
}
}
- t2 = (u16) data[1] >> 6 << 4;
- ((u8 *) data)[0] = (15 & data[0]) | t2;
-
- sprite->pos2.x = (gSineTable[(u16) data[1]] * (u8) data[6]) >> 8;
-
+ data->unk0_1 = data->unk2 >> 6;
+ sprite->pos2.x = (gSineTable[data->unk2] * data->unkC[0]) >> 8;
matrixNum = sprite->oam.matrixNum;
- sinIndex = (-sprite->pos2.x >> 1) + data[5];
+ sinIndex = (-sprite->pos2.x >> 1) + data->unkA;
sinVal = gSineTable[sinIndex];
gOamMatrices[matrixNum].a = gOamMatrices[matrixNum].d = gSineTable[sinIndex + 64];
- gOamMatrices[matrixNum].b = sinVal;
- sinVal2 = -sinVal;
- gOamMatrices[matrixNum].c = sinVal2;
+ // The comparison below is completely pointless. 'sprite' is sure to be a valid pointer and
+ // both the 'if' and 'else' parts are exactly the same.
+ // The only reason for this is making sure the compiler generates the exact ASM.
+ if (sprite)
+ {
+ gOamMatrices[matrixNum].b = sinVal;
+ gOamMatrices[matrixNum].c = -sinVal;
+ }
+ else
+ {
+ gOamMatrices[matrixNum].b = sinVal;
+ gOamMatrices[matrixNum].c = -sinVal;
+ }
sprite->callback = sub_810E520;
}
+
+#ifdef NONMATCHING
+/*
+Things I can't get to match:
+1. data->unk0_1 bitfield behaviour. The way bits are read is different.
+2. sprite->oam.priority--; sprite->oam.priority++; Nonmatching version tail-merges these, original does not.
+3. sprite->pos2.x = (gSineTable[data->unk2] * var) >> 8; data->unk2 is very weirdly read at seemingly random moments inside the switch.
+4. sinVal r6/r7 mismatch.
+*/
+void sub_810E520(struct Sprite *sprite)
+{
+ u8 matrixNum, sinIndex, var;
+ s16 sinVal = 0;
+ struct FeatherDanceData *data = (struct FeatherDanceData *)sprite->data;
+
+ if (data->unk0_0a)
+ {
+ if (data->unk1-- % 256 == 0)
+ {
+ data->unk0_0a = 0;
+ data->unk1 = 0;
+ }
+ }
+ else
+ {
+ switch (data->unk2 >> 6)
+ {
+ case 0:
+ if (data->unk0_1 == 1)
+ {
+ data->unk0_0d = 1;
+ data->unk0_0a = 1;
+ data->unk1 = 0;
+ }
+ else if (data->unk0_1 == 3)
+ {
+ data->unk0_0b ^= 1;
+ data->unk1 = 0;
+ }
+ else if (data->unk0_0d)
+ {
+ sprite->hFlip ^= 1;
+ sprite->animNum = sprite->hFlip;
+ sprite->animBeginning = 1;
+ sprite->animEnded = 0;
+ if (data->unk0_0c)
+ {
+ if (!IsContest())
+ {
+ if (!data->unkE_0)
+ sprite->oam.priority--;
+ else
+ sprite->oam.priority++;
+ }
+ else
+ {
+ if (!data->unkE_0)
+ sprite->subpriority -= 12;
+ else
+ sprite->subpriority += 12;
+ }
+ data->unkE_0 ^= 1;
+ }
+ data->unk0_0d = 0;
+ }
+ data->unk0_1 = 0;
+ break;
+ case 1:
+ if (data->unk0_1 == 0)
+ {
+ data->unk0_0d = 1;
+ data->unk0_0a = 1;
+ data->unk1 = 0;
+ }
+ else if (data->unk0_1 == 2)
+ {
+ data->unk0_0a = 1;
+ data->unk1 = 0;
+ }
+ else if (data->unk0_0d)
+ {
+ sprite->hFlip ^= 1;
+ sprite->animNum = sprite->hFlip;
+ sprite->animBeginning = 1;
+ sprite->animEnded = 0;
+ if (data->unk0_0c)
+ {
+ if (!IsContest())
+ {
+ if (!data->unkE_0)
+ sprite->oam.priority--;
+ else
+ sprite->oam.priority++;
+ }
+ else
+ {
+ if (!data->unkE_0)
+ sprite->subpriority -= 12;
+ else
+ sprite->subpriority += 12;
+ }
+ data->unkE_0 ^= 1;
+ }
+ data->unk0_0d = 0;
+ }
+ data->unk0_1 = 1;
+ break;
+ case 2:
+ if (data->unk0_1 == 0)
+ {
+ data->unk0_0d = 1;
+ data->unk0_0a = 1;
+ data->unk1 = 0;
+ }
+ else if (data->unk0_1 == 2)
+ {
+ data->unk0_0a = 1;
+ data->unk1 = 0;
+ }
+ else if (data->unk0_0d)
+ {
+ sprite->hFlip ^= 1;
+ sprite->animNum = sprite->hFlip;
+ sprite->animBeginning = 1;
+ sprite->animEnded = 0;
+ if (data->unk0_0c)
+ {
+ if (!IsContest())
+ {
+ if (!data->unkE_0)
+ sprite->oam.priority--;
+ else
+ sprite->oam.priority++;
+ }
+ else
+ {
+ if (!data->unkE_0)
+ sprite->subpriority -= 12;
+ else
+ sprite->subpriority += 12;
+ }
+ data->unkE_0 ^= 1;
+ }
+ data->unk0_0d = 0;
+ }
+ data->unk0_1 = 2;
+ break;
+ case 3:
+ if (data->unk0_1 == 2)
+ {
+ data->unk0_0d = 1;
+ }
+ else if (data->unk0_1 == 0)
+ {
+ data->unk0_0b ^= 1;
+ data->unk1 = 0;
+ }
+ else if (data->unk0_0d)
+ {
+ sprite->hFlip ^= 1;
+ sprite->animNum = sprite->hFlip;
+ sprite->animBeginning = 1;
+ sprite->animEnded = 0;
+ if (data->unk0_0c)
+ {
+ if (!IsContest())
+ {
+ if (!data->unkE_0)
+ sprite->oam.priority--;
+ else
+ sprite->oam.priority++;
+ }
+ else
+ {
+ if (!data->unkE_0)
+ sprite->subpriority -= 12;
+ else
+ sprite->subpriority += 12;
+ }
+ data->unkE_0 ^= 1;
+ }
+ data->unk0_0d = 0;
+ }
+ data->unk0_1 = 3;
+ break;
+ }
+
+ var = data->unkC[data->unk0_0b];
+ sprite->pos2.x = (gSineTable[data->unk2] * var) >> 8;
+ matrixNum = sprite->oam.matrixNum;
+
+ sinIndex = (-sprite->pos2.x >> 1) + data->unkA;
+ sinVal = gSineTable[sinIndex];
+
+ gOamMatrices[matrixNum].a = gOamMatrices[matrixNum].d = gSineTable[sinIndex + 64];
+ gOamMatrices[matrixNum].b = sinVal;
+ gOamMatrices[matrixNum].c = -sinVal;
+
+ data->unk8 += data->unk6;
+ sprite->pos1.y = data->unk8 >> 8;
+ if (data->unk4 & 0x8000)
+ data->unk2 = (data->unk2 - (data->unk4 & 0x7FFF)) & 0xFF;
+ else
+ data->unk2 = (data->unk2 + (data->unk4 & 0x7FFF)) & 0xFF;
+
+ if (sprite->pos1.y + sprite->pos2.y > data->unkE_1)
+ {
+ sprite->data[0] = 0;
+ sprite->callback = sub_810E2C8;
+ }
+ }
+}
+#else
+NAKED
+void sub_810E520(struct Sprite *sprite)
+{
+ asm_unified("push {r4-r7,lr}\n\
+ mov r7, r9\n\
+ mov r6, r8\n\
+ push {r6,r7}\n\
+ adds r5, r0, 0\n\
+ movs r6, 0\n\
+ adds r4, r5, 0\n\
+ adds r4, 0x2E\n\
+ ldrb r2, [r4]\n\
+ movs r7, 0x1\n\
+ movs r0, 0x1\n\
+ mov r9, r0\n\
+ ands r0, r2\n\
+ cmp r0, 0\n\
+ beq _0810E55A\n\
+ ldrb r0, [r4, 0x1]\n\
+ adds r1, r0, 0\n\
+ adds r1, 0xFF\n\
+ strb r1, [r4, 0x1]\n\
+ lsls r0, 24\n\
+ cmp r0, 0\n\
+ beq _0810E54E\n\
+ b _0810EA36\n\
+_0810E54E:\n\
+ movs r0, 0x2\n\
+ negs r0, r0\n\
+ ands r0, r2\n\
+ strb r0, [r4]\n\
+ strb r6, [r4, 0x1]\n\
+ b _0810EA36\n\
+_0810E55A:\n\
+ ldrh r0, [r4, 0x2]\n\
+ lsrs r1, r0, 6\n\
+ mov r12, r0\n\
+ cmp r1, 0x1\n\
+ bne _0810E566\n\
+ b _0810E68A\n\
+_0810E566:\n\
+ cmp r1, 0x1\n\
+ bgt _0810E570\n\
+ cmp r1, 0\n\
+ beq _0810E57E\n\
+ b _0810E97C\n\
+_0810E570:\n\
+ cmp r1, 0x2\n\
+ bne _0810E576\n\
+ b _0810E77E\n\
+_0810E576:\n\
+ cmp r1, 0x3\n\
+ bne _0810E57C\n\
+ b _0810E872\n\
+_0810E57C:\n\
+ b _0810E97C\n\
+_0810E57E:\n\
+ lsls r1, r2, 24\n\
+ lsrs r0, r1, 28\n\
+ cmp r0, 0x1\n\
+ bne _0810E592\n\
+ movs r0, 0x8\n\
+ orrs r0, r2\n\
+ orrs r0, r7\n\
+ strb r0, [r4]\n\
+ strb r6, [r4, 0x1]\n\
+ b _0810E680\n\
+_0810E592:\n\
+ lsrs r0, r1, 28\n\
+ cmp r0, 0x3\n\
+ bne _0810E5B4\n\
+ lsls r0, r2, 30\n\
+ lsrs r0, 31\n\
+ movs r1, 0x1\n\
+ eors r0, r1\n\
+ ands r0, r7\n\
+ lsls r0, 1\n\
+ movs r1, 0x3\n\
+ negs r1, r1\n\
+ ands r1, r2\n\
+ orrs r1, r0\n\
+ orrs r1, r7\n\
+ strb r1, [r4]\n\
+ strb r6, [r4, 0x1]\n\
+ b _0810E680\n\
+_0810E5B4:\n\
+ movs r0, 0x8\n\
+ ands r0, r2\n\
+ cmp r0, 0\n\
+ beq _0810E680\n\
+ adds r3, r5, 0\n\
+ adds r3, 0x3F\n\
+ ldrb r2, [r3]\n\
+ lsls r1, r2, 31\n\
+ lsrs r1, 31\n\
+ movs r6, 0x1\n\
+ eors r1, r6\n\
+ ands r1, r7\n\
+ movs r0, 0x2\n\
+ negs r0, r0\n\
+ mov r8, r0\n\
+ ands r0, r2\n\
+ orrs r0, r1\n\
+ strb r0, [r3]\n\
+ lsls r0, 31\n\
+ lsrs r0, 31\n\
+ adds r1, r5, 0\n\
+ adds r1, 0x2A\n\
+ strb r0, [r1]\n\
+ ldrb r0, [r3]\n\
+ movs r1, 0x4\n\
+ orrs r0, r1\n\
+ movs r1, 0x11\n\
+ negs r1, r1\n\
+ ands r0, r1\n\
+ strb r0, [r3]\n\
+ ldrb r1, [r4]\n\
+ movs r0, 0x4\n\
+ ands r0, r1\n\
+ cmp r0, 0\n\
+ beq _0810E672\n\
+ bl IsContest\n\
+ lsls r0, 24\n\
+ cmp r0, 0\n\
+ bne _0810E642\n\
+ ldrb r1, [r4, 0xE]\n\
+ mov r0, r9\n\
+ ands r0, r1\n\
+ cmp r0, 0\n\
+ bne _0810E628\n\
+ ldrb r2, [r5, 0x5]\n\
+ lsls r1, r2, 28\n\
+ lsrs r1, 30\n\
+ subs r1, 0x1\n\
+ movs r0, 0x3\n\
+ ands r1, r0\n\
+ lsls r1, 2\n\
+ movs r0, 0xD\n\
+ negs r0, r0\n\
+ ands r0, r2\n\
+ orrs r0, r1\n\
+ strb r0, [r5, 0x5]\n\
+ b _0810E660\n\
+_0810E628:\n\
+ ldrb r2, [r5, 0x5]\n\
+ lsls r1, r2, 28\n\
+ lsrs r1, 30\n\
+ adds r1, 0x1\n\
+ movs r0, 0x3\n\
+ ands r1, r0\n\
+ lsls r1, 2\n\
+ movs r0, 0xD\n\
+ negs r0, r0\n\
+ ands r0, r2\n\
+ orrs r0, r1\n\
+ strb r0, [r5, 0x5]\n\
+ b _0810E660\n\
+_0810E642:\n\
+ ldrb r1, [r4, 0xE]\n\
+ mov r0, r9\n\
+ ands r0, r1\n\
+ cmp r0, 0\n\
+ bne _0810E656\n\
+ adds r1, r5, 0\n\
+ adds r1, 0x43\n\
+ ldrb r0, [r1]\n\
+ subs r0, 0xC\n\
+ b _0810E65E\n\
+_0810E656:\n\
+ adds r1, r5, 0\n\
+ adds r1, 0x43\n\
+ ldrb r0, [r1]\n\
+ adds r0, 0xC\n\
+_0810E65E:\n\
+ strb r0, [r1]\n\
+_0810E660:\n\
+ ldrb r2, [r4, 0xE]\n\
+ lsls r0, r2, 31\n\
+ lsrs r0, 31\n\
+ eors r0, r6\n\
+ ands r0, r7\n\
+ mov r1, r8\n\
+ ands r1, r2\n\
+ orrs r1, r0\n\
+ strb r1, [r4, 0xE]\n\
+_0810E672:\n\
+ ldrb r1, [r4]\n\
+ movs r0, 0x9\n\
+ negs r0, r0\n\
+ ands r0, r1\n\
+ strb r0, [r4]\n\
+ ldrh r1, [r4, 0x2]\n\
+ mov r12, r1\n\
+_0810E680:\n\
+ ldrb r1, [r4]\n\
+ movs r0, 0xF\n\
+ ands r0, r1\n\
+ strb r0, [r4]\n\
+ b _0810E97C\n\
+_0810E68A:\n\
+ lsls r1, r2, 24\n\
+ lsrs r0, r1, 28\n\
+ cmp r0, 0\n\
+ bne _0810E698\n\
+ movs r0, 0x8\n\
+ orrs r0, r2\n\
+ b _0810E6A0\n\
+_0810E698:\n\
+ lsrs r0, r1, 28\n\
+ cmp r0, 0x2\n\
+ bne _0810E6A8\n\
+ adds r0, r2, 0\n\
+_0810E6A0:\n\
+ orrs r0, r7\n\
+ strb r0, [r4]\n\
+ strb r6, [r4, 0x1]\n\
+ b _0810E774\n\
+_0810E6A8:\n\
+ movs r0, 0x8\n\
+ ands r0, r2\n\
+ cmp r0, 0\n\
+ beq _0810E774\n\
+ adds r3, r5, 0\n\
+ adds r3, 0x3F\n\
+ ldrb r2, [r3]\n\
+ lsls r1, r2, 31\n\
+ lsrs r1, 31\n\
+ movs r6, 0x1\n\
+ eors r1, r6\n\
+ ands r1, r7\n\
+ movs r0, 0x2\n\
+ negs r0, r0\n\
+ mov r8, r0\n\
+ ands r0, r2\n\
+ orrs r0, r1\n\
+ strb r0, [r3]\n\
+ lsls r0, 31\n\
+ lsrs r0, 31\n\
+ adds r1, r5, 0\n\
+ adds r1, 0x2A\n\
+ strb r0, [r1]\n\
+ ldrb r0, [r3]\n\
+ movs r1, 0x4\n\
+ orrs r0, r1\n\
+ movs r1, 0x11\n\
+ negs r1, r1\n\
+ ands r0, r1\n\
+ strb r0, [r3]\n\
+ ldrb r1, [r4]\n\
+ movs r0, 0x4\n\
+ ands r0, r1\n\
+ cmp r0, 0\n\
+ beq _0810E766\n\
+ bl IsContest\n\
+ lsls r0, 24\n\
+ cmp r0, 0\n\
+ bne _0810E736\n\
+ ldrb r1, [r4, 0xE]\n\
+ mov r0, r9\n\
+ ands r0, r1\n\
+ cmp r0, 0\n\
+ bne _0810E71C\n\
+ ldrb r2, [r5, 0x5]\n\
+ lsls r1, r2, 28\n\
+ lsrs r1, 30\n\
+ subs r1, 0x1\n\
+ movs r0, 0x3\n\
+ ands r1, r0\n\
+ lsls r1, 2\n\
+ movs r0, 0xD\n\
+ negs r0, r0\n\
+ ands r0, r2\n\
+ orrs r0, r1\n\
+ strb r0, [r5, 0x5]\n\
+ b _0810E754\n\
+_0810E71C:\n\
+ ldrb r2, [r5, 0x5]\n\
+ lsls r1, r2, 28\n\
+ lsrs r1, 30\n\
+ adds r1, 0x1\n\
+ movs r0, 0x3\n\
+ ands r1, r0\n\
+ lsls r1, 2\n\
+ movs r0, 0xD\n\
+ negs r0, r0\n\
+ ands r0, r2\n\
+ orrs r0, r1\n\
+ strb r0, [r5, 0x5]\n\
+ b _0810E754\n\
+_0810E736:\n\
+ ldrb r1, [r4, 0xE]\n\
+ mov r0, r9\n\
+ ands r0, r1\n\
+ cmp r0, 0\n\
+ bne _0810E74A\n\
+ adds r1, r5, 0\n\
+ adds r1, 0x43\n\
+ ldrb r0, [r1]\n\
+ subs r0, 0xC\n\
+ b _0810E752\n\
+_0810E74A:\n\
+ adds r1, r5, 0\n\
+ adds r1, 0x43\n\
+ ldrb r0, [r1]\n\
+ adds r0, 0xC\n\
+_0810E752:\n\
+ strb r0, [r1]\n\
+_0810E754:\n\
+ ldrb r2, [r4, 0xE]\n\
+ lsls r0, r2, 31\n\
+ lsrs r0, 31\n\
+ eors r0, r6\n\
+ ands r0, r7\n\
+ mov r1, r8\n\
+ ands r1, r2\n\
+ orrs r1, r0\n\
+ strb r1, [r4, 0xE]\n\
+_0810E766:\n\
+ ldrb r1, [r4]\n\
+ movs r0, 0x9\n\
+ negs r0, r0\n\
+ ands r0, r1\n\
+ strb r0, [r4]\n\
+ ldrh r1, [r4, 0x2]\n\
+ mov r12, r1\n\
+_0810E774:\n\
+ ldrb r0, [r4]\n\
+ movs r1, 0xF\n\
+ ands r1, r0\n\
+ movs r0, 0x10\n\
+ b _0810E978\n\
+_0810E77E:\n\
+ lsls r1, r2, 24\n\
+ lsrs r0, r1, 28\n\
+ cmp r0, 0x3\n\
+ bne _0810E78C\n\
+ movs r0, 0x8\n\
+ orrs r0, r2\n\
+ b _0810E794\n\
+_0810E78C:\n\
+ lsrs r0, r1, 28\n\
+ cmp r0, 0x1\n\
+ bne _0810E79C\n\
+ adds r0, r2, 0\n\
+_0810E794:\n\
+ orrs r0, r7\n\
+ strb r0, [r4]\n\
+ strb r6, [r4, 0x1]\n\
+ b _0810E868\n\
+_0810E79C:\n\
+ movs r0, 0x8\n\
+ ands r0, r2\n\
+ cmp r0, 0\n\
+ beq _0810E868\n\
+ adds r3, r5, 0\n\
+ adds r3, 0x3F\n\
+ ldrb r2, [r3]\n\
+ lsls r1, r2, 31\n\
+ lsrs r1, 31\n\
+ movs r6, 0x1\n\
+ eors r1, r6\n\
+ ands r1, r7\n\
+ movs r0, 0x2\n\
+ negs r0, r0\n\
+ mov r8, r0\n\
+ ands r0, r2\n\
+ orrs r0, r1\n\
+ strb r0, [r3]\n\
+ lsls r0, 31\n\
+ lsrs r0, 31\n\
+ adds r1, r5, 0\n\
+ adds r1, 0x2A\n\
+ strb r0, [r1]\n\
+ ldrb r0, [r3]\n\
+ movs r1, 0x4\n\
+ orrs r0, r1\n\
+ movs r1, 0x11\n\
+ negs r1, r1\n\
+ ands r0, r1\n\
+ strb r0, [r3]\n\
+ ldrb r1, [r4]\n\
+ movs r0, 0x4\n\
+ ands r0, r1\n\
+ cmp r0, 0\n\
+ beq _0810E85A\n\
+ bl IsContest\n\
+ lsls r0, 24\n\
+ cmp r0, 0\n\
+ bne _0810E82A\n\
+ ldrb r1, [r4, 0xE]\n\
+ mov r0, r9\n\
+ ands r0, r1\n\
+ cmp r0, 0\n\
+ bne _0810E810\n\
+ ldrb r2, [r5, 0x5]\n\
+ lsls r1, r2, 28\n\
+ lsrs r1, 30\n\
+ subs r1, 0x1\n\
+ movs r0, 0x3\n\
+ ands r1, r0\n\
+ lsls r1, 2\n\
+ movs r0, 0xD\n\
+ negs r0, r0\n\
+ ands r0, r2\n\
+ orrs r0, r1\n\
+ strb r0, [r5, 0x5]\n\
+ b _0810E848\n\
+_0810E810:\n\
+ ldrb r2, [r5, 0x5]\n\
+ lsls r1, r2, 28\n\
+ lsrs r1, 30\n\
+ adds r1, 0x1\n\
+ movs r0, 0x3\n\
+ ands r1, r0\n\
+ lsls r1, 2\n\
+ movs r0, 0xD\n\
+ negs r0, r0\n\
+ ands r0, r2\n\
+ orrs r0, r1\n\
+ strb r0, [r5, 0x5]\n\
+ b _0810E848\n\
+_0810E82A:\n\
+ ldrb r1, [r4, 0xE]\n\
+ mov r0, r9\n\
+ ands r0, r1\n\
+ cmp r0, 0\n\
+ bne _0810E83E\n\
+ adds r1, r5, 0\n\
+ adds r1, 0x43\n\
+ ldrb r0, [r1]\n\
+ subs r0, 0xC\n\
+ b _0810E846\n\
+_0810E83E:\n\
+ adds r1, r5, 0\n\
+ adds r1, 0x43\n\
+ ldrb r0, [r1]\n\
+ adds r0, 0xC\n\
+_0810E846:\n\
+ strb r0, [r1]\n\
+_0810E848:\n\
+ ldrb r2, [r4, 0xE]\n\
+ lsls r0, r2, 31\n\
+ lsrs r0, 31\n\
+ eors r0, r6\n\
+ ands r0, r7\n\
+ mov r1, r8\n\
+ ands r1, r2\n\
+ orrs r1, r0\n\
+ strb r1, [r4, 0xE]\n\
+_0810E85A:\n\
+ ldrb r1, [r4]\n\
+ movs r0, 0x9\n\
+ negs r0, r0\n\
+ ands r0, r1\n\
+ strb r0, [r4]\n\
+ ldrh r1, [r4, 0x2]\n\
+ mov r12, r1\n\
+_0810E868:\n\
+ ldrb r0, [r4]\n\
+ movs r1, 0xF\n\
+ ands r1, r0\n\
+ movs r0, 0x20\n\
+ b _0810E978\n\
+_0810E872:\n\
+ lsls r1, r2, 24\n\
+ lsrs r0, r1, 28\n\
+ cmp r0, 0x2\n\
+ bne _0810E882\n\
+ movs r0, 0x8\n\
+ orrs r0, r2\n\
+ strb r0, [r4]\n\
+ b _0810E970\n\
+_0810E882:\n\
+ lsrs r0, r1, 28\n\
+ cmp r0, 0\n\
+ bne _0810E8A4\n\
+ lsls r0, r2, 30\n\
+ lsrs r0, 31\n\
+ movs r1, 0x1\n\
+ eors r0, r1\n\
+ ands r0, r7\n\
+ lsls r0, 1\n\
+ movs r1, 0x3\n\
+ negs r1, r1\n\
+ ands r1, r2\n\
+ orrs r1, r0\n\
+ orrs r1, r7\n\
+ strb r1, [r4]\n\
+ strb r6, [r4, 0x1]\n\
+ b _0810E970\n\
+_0810E8A4:\n\
+ movs r0, 0x8\n\
+ ands r0, r2\n\
+ cmp r0, 0\n\
+ beq _0810E970\n\
+ adds r3, r5, 0\n\
+ adds r3, 0x3F\n\
+ ldrb r2, [r3]\n\
+ lsls r1, r2, 31\n\
+ lsrs r1, 31\n\
+ movs r6, 0x1\n\
+ eors r1, r6\n\
+ ands r1, r7\n\
+ movs r0, 0x2\n\
+ negs r0, r0\n\
+ mov r8, r0\n\
+ ands r0, r2\n\
+ orrs r0, r1\n\
+ strb r0, [r3]\n\
+ lsls r0, 31\n\
+ lsrs r0, 31\n\
+ adds r1, r5, 0\n\
+ adds r1, 0x2A\n\
+ strb r0, [r1]\n\
+ ldrb r0, [r3]\n\
+ movs r1, 0x4\n\
+ orrs r0, r1\n\
+ movs r1, 0x11\n\
+ negs r1, r1\n\
+ ands r0, r1\n\
+ strb r0, [r3]\n\
+ ldrb r1, [r4]\n\
+ movs r0, 0x4\n\
+ ands r0, r1\n\
+ cmp r0, 0\n\
+ beq _0810E962\n\
+ bl IsContest\n\
+ lsls r0, 24\n\
+ cmp r0, 0\n\
+ bne _0810E932\n\
+ ldrb r1, [r4, 0xE]\n\
+ mov r0, r9\n\
+ ands r0, r1\n\
+ cmp r0, 0\n\
+ bne _0810E918\n\
+ ldrb r2, [r5, 0x5]\n\
+ lsls r1, r2, 28\n\
+ lsrs r1, 30\n\
+ subs r1, 0x1\n\
+ movs r0, 0x3\n\
+ ands r1, r0\n\
+ lsls r1, 2\n\
+ movs r0, 0xD\n\
+ negs r0, r0\n\
+ ands r0, r2\n\
+ orrs r0, r1\n\
+ strb r0, [r5, 0x5]\n\
+ b _0810E950\n\
+_0810E918:\n\
+ ldrb r2, [r5, 0x5]\n\
+ lsls r1, r2, 28\n\
+ lsrs r1, 30\n\
+ adds r1, 0x1\n\
+ movs r0, 0x3\n\
+ ands r1, r0\n\
+ lsls r1, 2\n\
+ movs r0, 0xD\n\
+ negs r0, r0\n\
+ ands r0, r2\n\
+ orrs r0, r1\n\
+ strb r0, [r5, 0x5]\n\
+ b _0810E950\n\
+_0810E932:\n\
+ ldrb r1, [r4, 0xE]\n\
+ mov r0, r9\n\
+ ands r0, r1\n\
+ cmp r0, 0\n\
+ bne _0810E946\n\
+ adds r1, r5, 0\n\
+ adds r1, 0x43\n\
+ ldrb r0, [r1]\n\
+ subs r0, 0xC\n\
+ b _0810E94E\n\
+_0810E946:\n\
+ adds r1, r5, 0\n\
+ adds r1, 0x43\n\
+ ldrb r0, [r1]\n\
+ adds r0, 0xC\n\
+_0810E94E:\n\
+ strb r0, [r1]\n\
+_0810E950:\n\
+ ldrb r2, [r4, 0xE]\n\
+ lsls r0, r2, 31\n\
+ lsrs r0, 31\n\
+ eors r0, r6\n\
+ ands r0, r7\n\
+ mov r1, r8\n\
+ ands r1, r2\n\
+ orrs r1, r0\n\
+ strb r1, [r4, 0xE]\n\
+_0810E962:\n\
+ ldrb r1, [r4]\n\
+ movs r0, 0x9\n\
+ negs r0, r0\n\
+ ands r0, r1\n\
+ strb r0, [r4]\n\
+ ldrh r1, [r4, 0x2]\n\
+ mov r12, r1\n\
+_0810E970:\n\
+ ldrb r0, [r4]\n\
+ movs r1, 0xF\n\
+ ands r1, r0\n\
+ movs r0, 0x30\n\
+_0810E978:\n\
+ orrs r1, r0\n\
+ strb r1, [r4]\n\
+_0810E97C:\n\
+ ldrb r1, [r4]\n\
+ lsls r1, 30\n\
+ lsrs r1, 31\n\
+ adds r0, r4, 0\n\
+ adds r0, 0xC\n\
+ adds r0, r1\n\
+ ldrb r1, [r0]\n\
+ ldr r3, =gSineTable\n\
+ mov r2, r12\n\
+ lsls r0, r2, 1\n\
+ adds r0, r3\n\
+ movs r2, 0\n\
+ ldrsh r0, [r0, r2]\n\
+ muls r0, r1\n\
+ asrs r0, 8\n\
+ strh r0, [r5, 0x24]\n\
+ ldrb r2, [r5, 0x3]\n\
+ lsls r2, 26\n\
+ lsrs r2, 27\n\
+ movs r1, 0x24\n\
+ ldrsh r0, [r5, r1]\n\
+ negs r0, r0\n\
+ asrs r0, 1\n\
+ ldrb r1, [r4, 0xA]\n\
+ adds r0, r1\n\
+ lsls r0, 24\n\
+ lsrs r0, 24\n\
+ lsls r1, r0, 1\n\
+ adds r1, r3\n\
+ ldrh r6, [r1]\n\
+ ldr r1, =gOamMatrices\n\
+ lsls r2, 3\n\
+ adds r2, r1\n\
+ adds r0, 0x40\n\
+ lsls r0, 1\n\
+ adds r0, r3\n\
+ ldrh r0, [r0]\n\
+ strh r0, [r2, 0x6]\n\
+ strh r0, [r2]\n\
+ strh r6, [r2, 0x2]\n\
+ lsls r0, r6, 16\n\
+ asrs r0, 16\n\
+ negs r0, r0\n\
+ strh r0, [r2, 0x4]\n\
+ ldrh r0, [r4, 0x6]\n\
+ ldrh r2, [r4, 0x8]\n\
+ adds r0, r2\n\
+ strh r0, [r4, 0x8]\n\
+ lsls r0, 16\n\
+ lsrs r0, 24\n\
+ strh r0, [r5, 0x22]\n\
+ movs r1, 0x4\n\
+ ldrsh r0, [r4, r1]\n\
+ movs r1, 0x80\n\
+ lsls r1, 8\n\
+ ands r0, r1\n\
+ cmp r0, 0\n\
+ beq _0810EA0C\n\
+ ldrh r0, [r4, 0x4]\n\
+ subs r1, 0x1\n\
+ ands r1, r0\n\
+ ldrh r0, [r4, 0x2]\n\
+ subs r0, r1\n\
+ movs r1, 0xFF\n\
+ ands r0, r1\n\
+ strh r0, [r4, 0x2]\n\
+ b _0810EA1C\n\
+ .pool\n\
+_0810EA0C:\n\
+ ldrh r0, [r4, 0x4]\n\
+ ldr r1, =0x00007fff\n\
+ ands r1, r0\n\
+ ldrh r2, [r4, 0x2]\n\
+ adds r1, r2\n\
+ movs r0, 0xFF\n\
+ ands r1, r0\n\
+ strh r1, [r4, 0x2]\n\
+_0810EA1C:\n\
+ movs r0, 0x22\n\
+ ldrsh r1, [r5, r0]\n\
+ movs r2, 0x26\n\
+ ldrsh r0, [r5, r2]\n\
+ adds r1, r0\n\
+ ldrh r0, [r4, 0xE]\n\
+ lsrs r0, 1\n\
+ cmp r1, r0\n\
+ blt _0810EA36\n\
+ movs r0, 0\n\
+ strh r0, [r5, 0x2E]\n\
+ ldr r0, =sub_810E2C8\n\
+ str r0, [r5, 0x1C]\n\
+_0810EA36:\n\
+ pop {r3,r4}\n\
+ mov r8, r3\n\
+ mov r9, r4\n\
+ pop {r4-r7}\n\
+ pop {r0}\n\
+ bx r0\n\
+ .pool\n\
+ ");
+}
+#endif
+
+void sub_810EA4C(struct Sprite *sprite)
+{
+ sprite->oam.priority = GetBattlerSpriteBGPriority(gBattleAnimTarget);
+ sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2);
+ sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, 3);
+ sprite->callback = TranslateAnimSpriteToTargetMonLocation;
+}
+
+void sub_810EAA0(struct Sprite * sprite)
+{
+ u16 arg;
+ u8 mult;
+
+ if (!gBattleAnimArgs[2])
+ InitSpritePosToAnimAttacker(sprite, 0);
+ else
+ InitSpritePosToAnimTarget(sprite, FALSE);
+
+ if ((!gBattleAnimArgs[2] && !GetBattlerSide(gBattleAnimAttacker))
+ || (gBattleAnimArgs[2] == 1 && !GetBattlerSide(gBattleAnimTarget)))
+ {
+ sprite->pos1.x += 8;
+ }
+
+ SeekSpriteAnim(sprite, gBattleAnimArgs[4]);
+ sprite->pos1.x -= 32;
+ sprite->data[1] = 0x0ccc;
+
+ arg = gBattleAnimArgs[4];
+ mult = 12;
+ sprite->pos2.x += mult * arg;
+ sprite->data[0] = arg;
+ sprite->data[7] = gBattleAnimArgs[3];
+ sprite->callback = sub_810EB40;
+}
+
+void sub_810EB40(struct Sprite *sprite)
+{
+ sprite->pos2.x += sprite->data[1] >> 8;
+
+ if (++sprite->data[0] == 6)
+ {
+ sprite->data[0] = 0;
+ sprite->pos2.x = 0;
+ StartSpriteAnim(sprite, 0);
+ }
+
+ if (--sprite->data[7] == -1)
+ DestroyAnimSprite(sprite);
+}
+
+void sub_810EB88(u8 task)
+{
+ if (!(gTasks[task].data[0] % 32))
+ {
+ gAnimVisualTaskCount++;
+
+ gBattleAnimArgs[0] = Sin(gTasks[task].data[0], -13);
+ gBattleAnimArgs[1] = Cos(gTasks[task].data[0], -13);
+ gBattleAnimArgs[2] = 1;
+ gBattleAnimArgs[3] = 3;
+
+ CreateSpriteAndAnimate(&gUnknown_085973E8,
+ GetBattlerSpriteCoord(gBattleAnimTarget, 2),
+ GetBattlerSpriteCoord(gBattleAnimTarget, 3),
+ 3);
+ }
+
+ gTasks[task].data[0] += 8;
+
+ if (gTasks[task].data[0] > 255)
+ DestroyAnimVisualTask(task);
+}
+
+void sub_810EC34(struct Sprite *sprite)
+{
+ switch (sprite->data[0])
+ {
+ case 0:
+ InitSpritePosToAnimAttacker(sprite, 1);
+ gSprites[GetAnimBattlerSpriteId(0)].invisible = 1;
+ ++sprite->data[0];
+ break;
+ case 1:
+ if (sprite->affineAnimEnded)
+ DestroyAnimSprite(sprite);
+ break;
+ }
+}
+
+void sub_810EC94(struct Sprite *sprite)
+{
+ switch (sprite->data[0])
+ {
+ case 0:
+ sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimTarget, 1);
+ sprite->pos2.y = -sprite->pos1.y - 32;
+ sprite->data[0]++;
+ break;
+ case 1:
+ sprite->pos2.y += 10;
+ if (sprite->pos2.y >= 0)
+ ++sprite->data[0];
+ break;
+ case 2:
+ sprite->pos2.y -= 10;
+ if (sprite->pos1.y + sprite->pos2.y < -32)
+ {
+ gSprites[GetAnimBattlerSpriteId(0)].invisible = 0;
+ DestroyAnimSprite(sprite);
+ }
+ break;
+ }
+}
+
+void sub_810ED28(struct Sprite *sprite)
+{
+ InitSpritePosToAnimAttacker(sprite, 1);
+ sprite->data[0] = gBattleAnimArgs[2];
+ sprite->data[1] = gBattleAnimArgs[3];
+ sprite->callback = sub_810ED70;
+ gSprites[GetAnimBattlerSpriteId(0)].invisible = 1;
+}
+
+void sub_810ED70(struct Sprite *sprite)
+{
+ if (sprite->data[0] > 0)
+ {
+ sprite->data[0]--;
+ }
+ else if (sprite->pos1.y + sprite->pos2.y > -32)
+ {
+ sprite->data[2] += sprite->data[1];
+ sprite->pos2.y -= (sprite->data[2] >> 8);
+ }
+ else
+ {
+ sprite->invisible = 1;
+ if (sprite->data[3]++ > 20)
+ sprite->callback = sub_810EDD0;
+ }
+}
+
+void sub_810EDD0(struct Sprite *sprite)
+{
+ sprite->pos2.y += sprite->data[2] >> 8;
+
+ if (sprite->pos1.y + sprite->pos2.y > -32)
+ sprite->invisible = 0;
+
+ if (sprite->pos2.y > 0)
+ DestroyAnimSprite(sprite);
+}
+
+void sub_810EE14(struct Sprite *sprite)
+{
+ u32 matrixNum;
+ int t1, t2;
+
+ switch (sprite->data[0])
+ {
+ case 0:
+ if (!gBattleAnimArgs[0])
+ {
+ sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 0);
+ sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, 1);
+ }
+ else
+ {
+ sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimTarget, 0);
+ sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimTarget, 1);
+ }
+
+ sprite->data[1] = 512;
+
+ TrySetSpriteRotScale(sprite, 0, 256, sprite->data[1], 0);
+ sprite->data[0]++;
+ break;
+ case 1:
+ if (sprite->data[2] <= 11)
+ sprite->data[1] -= 40;
+ else
+ sprite->data[1] += 40;
+
+ sprite->data[2]++;
+
+ TrySetSpriteRotScale(sprite, 0, 256, sprite->data[1], 0);
+
+ matrixNum = sprite->oam.matrixNum;
+
+ t1 = 15616;
+ t2 = t1 / gOamMatrices[matrixNum].d + 1;
+
+ if (t2 > 128)
+ t2 = 128;
+
+ t2 = (64 - t2) / 2;
+ sprite->pos2.y = t2;
+
+ if (sprite->data[2] == 24)
+ {
+ sub_80A749C(sprite);
+ DestroyAnimSprite(sprite);
+ }
+ break;
+ }
+}
+
+void sub_810EEF8(struct Sprite *sprite)
+{
+ int v1 = 0x1ff & Random2();
+ int v2 = 0x7f & Random2();
+
+ if (v1 % 2)
+ sprite->data[0] = 736 + v1;
+ else
+ sprite->data[0] = 736 - v1;
+
+ if (v2 % 2)
+ sprite->data[1] = 896 + v2;
+ else
+ sprite->data[1] = 896 - v2;
+
+ sprite->data[2] = gBattleAnimArgs[0];
+
+ if (sprite->data[2])
+ sprite->oam.matrixNum = 8;
+
+ if (gBattleAnimArgs[1] == 0)
+ {
+ sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 0);
+ sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, 1) + 32;
+ }
+ else
+ {
+ sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimTarget, 0);
+ sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimTarget, 1) + 32;
+ }
+
+ sprite->callback = sub_810EFA8;
+}
+
+void sub_810EFA8(struct Sprite *sprite)
+{
+ if (sprite->data[2] == 0)
+ {
+ sprite->pos2.x += sprite->data[0] >> 8;
+ sprite->pos2.y -= sprite->data[1] >> 8;
+ }
+ else
+ {
+ sprite->pos2.x -= sprite->data[0] >> 8;
+ sprite->pos2.y -= sprite->data[1] >> 8;
+ }
+
+ sprite->data[0] = sprite->data[0];
+ sprite->data[1] -= 32;
+
+ if (sprite->data[0] < 0)
+ sprite->data[0] = 0;
+
+ if (++sprite->data[3] == 31)
+ DestroyAnimSprite(sprite);
+}
+
+void sub_810F004(struct Sprite *sprite)
+{
+ sprite->data[6] = 0;
+ sprite->data[7] = 64;
+ sprite->callback = sub_810F018;
+}
+
+void sub_810F018(struct Sprite *sprite)
+{
+ switch (sprite->data[0])
+ {
+ case 0:
+ if (++sprite->data[1] > 8)
+ {
+ sprite->data[1] = 0;
+ sprite->invisible ^= 1;
+ if (++sprite->data[2] > 5 && sprite->invisible)
+ sprite->data[0]++;
+ }
+ break;
+ case 1:
+ DestroyAnimSprite(sprite);
+ break;
+ }
+}
+
+void sub_810F084(struct Sprite *sprite)
+{
+ u16 rotation;
+ s16 posx = sprite->pos1.x;
+ s16 posy = sprite->pos1.y;
+
+ sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2);
+ sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, 3);
+
+ sprite->data[4] = sprite->pos1.x << 4;
+ sprite->data[5] = sprite->pos1.y << 4;
+
+ sprite->data[6] = ((posx - sprite->pos1.x) << 4) / 12;
+ sprite->data[7] = ((posy - sprite->pos1.y) << 4) / 12;
+
+ rotation = ArcTan2Neg(posx - sprite->pos1.x, posy - sprite->pos1.y);
+ rotation += 49152;
+
+ TrySetSpriteRotScale(sprite, 1, 0x100, 0x100, rotation);
+
+ sprite->callback = sub_810F140;
+}
+
+void sub_810F140(struct Sprite *sprite)
+{
+ sprite->data[4] += sprite->data[6];
+ sprite->data[5] += sprite->data[7];
+
+ sprite->pos1.x = sprite->data[4] >> 4;
+ sprite->pos1.y = sprite->data[5] >> 4;
+
+ if (sprite->pos1.x > 285 || sprite->pos1.x < -45
+ || sprite->pos1.y > 157 || sprite->pos1.y < -45)
+ DestroySpriteAndMatrix(sprite);
+}
+
+void unref_sub_810F184(u8 taskId)
+{
+ if (gBattleAnimArgs[0] == 0)
+ {
+ u8 spriteId = GetAnimBattlerSpriteId(0);
+ gSprites[spriteId].invisible = 1;
+ }
+ else
+ {
+ u8 spriteId = GetAnimBattlerSpriteId(0);
+ gSprites[spriteId].invisible = 0;
+ }
+ DestroyAnimVisualTask(taskId);
+}
diff --git a/src/frontier_pass.c b/src/frontier_pass.c
index 0db546c4d..fff93c3c7 100644
--- a/src/frontier_pass.c
+++ b/src/frontier_pass.c
@@ -1090,7 +1090,7 @@ static void ShowAndPrintWindows(void)
for (i = 0; i < WINDOW_COUNT; i++)
{
PutWindowTilemap(i);
- FillWindowPixelBuffer(i, 0);
+ FillWindowPixelBuffer(i, PIXEL_FILL(0));
}
x = GetStringCenterAlignXOffset(1, gText_SymbolsEarned, 96);
@@ -1116,7 +1116,7 @@ static void ShowAndPrintWindows(void)
static void PrintAreaDescription(u8 cursorArea)
{
- FillWindowPixelBuffer(WINDOW_DESCRIPTION, 0);
+ FillWindowPixelBuffer(WINDOW_DESCRIPTION, PIXEL_FILL(0));
if (cursorArea == CURSOR_AREA_RECORD && !sPassData->hasBattleRecord)
AddTextPrinterParameterized3(WINDOW_DESCRIPTION, 1, 2, 0, sTextColors[1], 0, sPassAreaDescriptions[0]);
else if (cursorArea != CURSOR_AREA_NOTHING)
@@ -1656,7 +1656,7 @@ static void PrintOnFrontierMap(void)
for (i = 0; i < MAP_WINDOW_COUNT; i++)
{
PutWindowTilemap(i);
- FillWindowPixelBuffer(i, 0);
+ FillWindowPixelBuffer(i, PIXEL_FILL(0));
}
for (i = 0; i < NUM_FRONTIER_FACILITIES; i++)
@@ -1698,7 +1698,7 @@ static void HandleFrontierMapCursorMove(u8 direction)
StartSpriteAnim(sMapData->mapIndicatorSprite, sMapLandmarks[sMapData->cursorPos].animNum);
sMapData->mapIndicatorSprite->pos1.x = sMapLandmarks[sMapData->cursorPos].x;
sMapData->mapIndicatorSprite->pos1.y = sMapLandmarks[sMapData->cursorPos].y;
- FillWindowPixelBuffer(MAP_WINDOW_DESCRIPTION, 0);
+ FillWindowPixelBuffer(MAP_WINDOW_DESCRIPTION, PIXEL_FILL(0));
AddTextPrinterParameterized3(MAP_WINDOW_DESCRIPTION, 1, 4, 0, sTextColors[0], 0, sMapLandmarks[sMapData->cursorPos].description);
for (i = 0; i < 3; i++)
diff --git a/src/frontier_util.c b/src/frontier_util.c
index 8c190f522..bce7b926f 100644
--- a/src/frontier_util.c
+++ b/src/frontier_util.c
@@ -1041,8 +1041,8 @@ static void TowerPrintPrevOrCurrentStreak(u8 battleMode, u8 lvlMode, u8 x1, u8 x
static void ShowTowerResultsWindow(u8 battleMode)
{
gRecordsWindowId = AddWindow(&gUnknown_08611C74);
- NewMenuHelpers_DrawStdWindowFrame(gRecordsWindowId, FALSE);
- FillWindowPixelBuffer(gRecordsWindowId, 0x11);
+ DrawStdWindowFrame(gRecordsWindowId, FALSE);
+ FillWindowPixelBuffer(gRecordsWindowId, PIXEL_FILL(1));
if (battleMode == FRONTIER_MODE_SINGLES)
StringExpandPlaceholders(gStringVar4, gText_SingleBattleRoomResults);
else if (battleMode == FRONTIER_MODE_DOUBLES)
@@ -1112,8 +1112,8 @@ static void DomePrintPrevOrCurrentStreak(u8 battleMode, u8 lvlMode, u8 x1, u8 x2
static void ShowDomeResultsWindow(u8 battleMode)
{
gRecordsWindowId = AddWindow(&gUnknown_08611C74);
- NewMenuHelpers_DrawStdWindowFrame(gRecordsWindowId, FALSE);
- FillWindowPixelBuffer(gRecordsWindowId, 0x11);
+ DrawStdWindowFrame(gRecordsWindowId, FALSE);
+ FillWindowPixelBuffer(gRecordsWindowId, PIXEL_FILL(1));
if (battleMode == FRONTIER_MODE_SINGLES)
StringExpandPlaceholders(gStringVar4, gText_SingleBattleTourneyResults);
else
@@ -1188,8 +1188,8 @@ static void PalacePrintPrevOrCurrentStreak(u8 battleMode, u8 lvlMode, u8 x1, u8
static void ShowPalaceResultsWindow(u8 battleMode)
{
gRecordsWindowId = AddWindow(&gUnknown_08611C74);
- NewMenuHelpers_DrawStdWindowFrame(gRecordsWindowId, FALSE);
- FillWindowPixelBuffer(gRecordsWindowId, 0x11);
+ DrawStdWindowFrame(gRecordsWindowId, FALSE);
+ FillWindowPixelBuffer(gRecordsWindowId, PIXEL_FILL(1));
if (battleMode == FRONTIER_MODE_SINGLES)
StringExpandPlaceholders(gStringVar4, gText_SingleBattleHallResults);
else
@@ -1244,8 +1244,8 @@ static void PikePrintPrevOrCurrentStreak(u8 lvlMode, u8 x1, u8 x2, u8 y)
static void ShowPikeResultsWindow(void)
{
gRecordsWindowId = AddWindow(&gUnknown_08611C74);
- NewMenuHelpers_DrawStdWindowFrame(gRecordsWindowId, FALSE);
- FillWindowPixelBuffer(gRecordsWindowId, 0x11);
+ DrawStdWindowFrame(gRecordsWindowId, FALSE);
+ FillWindowPixelBuffer(gRecordsWindowId, PIXEL_FILL(1));
StringExpandPlaceholders(gStringVar4, gText_BattleChoiceResults);
PrintAligned(gStringVar4, 0);
AddTextPrinterParameterized(gRecordsWindowId, 1, gText_Lv502, 8, 33, TEXT_SPEED_FF, NULL);
@@ -1306,8 +1306,8 @@ static void ArenaPrintPrevOrCurrentStreak(u8 lvlMode, u8 x1, u8 x2, u8 y)
static void ShowArenaResultsWindow(void)
{
gRecordsWindowId = AddWindow(&gUnknown_08611C74);
- NewMenuHelpers_DrawStdWindowFrame(gRecordsWindowId, FALSE);
- FillWindowPixelBuffer(gRecordsWindowId, 0x11);
+ DrawStdWindowFrame(gRecordsWindowId, FALSE);
+ FillWindowPixelBuffer(gRecordsWindowId, PIXEL_FILL(1));
PrintHyphens(10);
StringExpandPlaceholders(gStringVar4, gText_SetKOTourneyResults);
PrintAligned(gStringVar4, 2);
@@ -1392,8 +1392,8 @@ static void FactoryPrintPrevOrCurrentStreak(u8 battleMode, u8 lvlMode, u8 x1, u8
static void ShowFactoryResultsWindow(u8 battleMode)
{
gRecordsWindowId = AddWindow(&gUnknown_08611C74);
- NewMenuHelpers_DrawStdWindowFrame(gRecordsWindowId, FALSE);
- FillWindowPixelBuffer(gRecordsWindowId, 0x11);
+ DrawStdWindowFrame(gRecordsWindowId, FALSE);
+ FillWindowPixelBuffer(gRecordsWindowId, PIXEL_FILL(1));
if (battleMode == FRONTIER_MODE_SINGLES)
StringExpandPlaceholders(gStringVar4, gText_BattleSwapSingleResults);
else
@@ -1457,8 +1457,8 @@ static void PyramidPrintPrevOrCurrentStreak(u8 lvlMode, u8 x1, u8 x2, u8 y)
static void ShowPyramidResultsWindow(void)
{
gRecordsWindowId = AddWindow(&gUnknown_08611C74);
- NewMenuHelpers_DrawStdWindowFrame(gRecordsWindowId, FALSE);
- FillWindowPixelBuffer(gRecordsWindowId, 0x11);
+ DrawStdWindowFrame(gRecordsWindowId, FALSE);
+ FillWindowPixelBuffer(gRecordsWindowId, PIXEL_FILL(1));
StringExpandPlaceholders(gStringVar4, gText_BattleQuestResults);
PrintAligned(gStringVar4, 2);
AddTextPrinterParameterized(gRecordsWindowId, 1, gText_Lv502, 8, 49, TEXT_SPEED_FF, NULL);
@@ -1480,8 +1480,8 @@ static void ShowLinkContestResultsWindow(void)
s32 x;
gRecordsWindowId = AddWindow(&gUnknown_08611C7C);
- NewMenuHelpers_DrawStdWindowFrame(gRecordsWindowId, FALSE);
- FillWindowPixelBuffer(gRecordsWindowId, 0x11);
+ DrawStdWindowFrame(gRecordsWindowId, FALSE);
+ FillWindowPixelBuffer(gRecordsWindowId, PIXEL_FILL(1));
StringExpandPlaceholders(gStringVar4, gText_LinkContestResults);
x = GetStringCenterAlignXOffset(1, gStringVar4, 208);
@@ -2350,8 +2350,8 @@ static void PrintHallRecords(s32 hallFacilityId, s32 lvlMode)
void ShowRankingHallRecordsWindow(void)
{
gRecordsWindowId = AddWindow(&gUnknown_08611C84);
- NewMenuHelpers_DrawStdWindowFrame(gRecordsWindowId, FALSE);
- FillWindowPixelBuffer(gRecordsWindowId, 0x11);
+ DrawStdWindowFrame(gRecordsWindowId, FALSE);
+ FillWindowPixelBuffer(gRecordsWindowId, PIXEL_FILL(1));
PrintHallRecords(gSpecialVar_0x8005, FRONTIER_LVL_50);
PutWindowTilemap(gRecordsWindowId);
CopyWindowToVram(gRecordsWindowId, 3);
@@ -2359,7 +2359,7 @@ void ShowRankingHallRecordsWindow(void)
void ScrollRankingHallRecordsWindow(void)
{
- FillWindowPixelBuffer(gRecordsWindowId, 0x11);
+ FillWindowPixelBuffer(gRecordsWindowId, PIXEL_FILL(1));
PrintHallRecords(gSpecialVar_0x8005, FRONTIER_LVL_OPEN);
CopyWindowToVram(gRecordsWindowId, 2);
}
diff --git a/src/hall_of_fame.c b/src/hall_of_fame.c
index 48e4f8bec..2c31dba01 100644
--- a/src/hall_of_fame.c
+++ b/src/hall_of_fame.c
@@ -488,7 +488,7 @@ static void Task_Hof_InitTeamSaveData(u8 taskId)
}
*lastSavedTeam = *sHofMonPtr;
- NewMenuHelpers_DrawDialogueFrame(0, 0);
+ DrawDialogueFrame(0, 0);
AddTextPrinterParameterized2(0, 1, gText_SavingDontTurnOffPower, 0, NULL, 2, 1, 3);
CopyWindowToVram(0, 3);
gTasks[taskId].func = Task_Hof_TrySaveData;
@@ -568,7 +568,7 @@ static void Task_Hof_DisplayMon(u8 taskId)
gSprites[spriteId].tSpecies = currMon->species;
gSprites[spriteId].callback = SpriteCB_GetOnScreenAndAnimate;
gTasks[taskId].tMonSpriteId(currMonId) = spriteId;
- sub_8197434(0, TRUE);
+ ClearDialogWindowAndFrame(0, TRUE);
gTasks[taskId].func = Task_Hof_PrintMonInfoAfterAnimating;
}
@@ -647,7 +647,7 @@ static void sub_8173DC0(u8 taskId)
gSprites[gTasks[taskId].tMonSpriteId(i)].oam.priority = 1;
}
BeginNormalPaletteFade(sUnknown_0203BCD4, 0, 12, 12, RGB(16, 29, 24));
- FillWindowPixelBuffer(0, 0);
+ FillWindowPixelBuffer(0, PIXEL_FILL(0));
CopyWindowToVram(0, 3);
gTasks[taskId].tFrameCount = 7;
gTasks[taskId].func = sub_8173EA4;
@@ -695,7 +695,7 @@ static void Task_Hof_WaitAndPrintPlayerInfo(u8 taskId)
{
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x20, 0x20);
HallOfFame_PrintPlayerInfo(1, 2);
- NewMenuHelpers_DrawDialogueFrame(0, 0);
+ DrawDialogueFrame(0, 0);
AddTextPrinterParameterized2(0, 1, gText_LeagueChamp, 0, NULL, 2, 1, 3);
CopyWindowToVram(0, 3);
gTasks[taskId].func = Task_Hof_ExitOnKeyPressed;
@@ -1064,7 +1064,7 @@ static void Task_HofPC_HandleExit(u8 taskId)
static void Task_HofPC_PrintDataIsCorrupted(u8 taskId)
{
sub_8198180(gText_UnkCtrlF800Exit, 8, TRUE);
- NewMenuHelpers_DrawDialogueFrame(0, 0);
+ DrawDialogueFrame(0, 0);
AddTextPrinterParameterized2(0, 1, gText_HOFCorrupted, 0, NULL, 2, 1, 3);
CopyWindowToVram(0, 3);
gTasks[taskId].func = Task_HofPC_ExitOnButtonPress;
@@ -1084,7 +1084,7 @@ static void Task_HofPC_ExitOnButtonPress(u8 taskId)
static void HallOfFame_PrintWelcomeText(u8 unusedPossiblyWindowId, u8 unused2)
{
- FillWindowPixelBuffer(0, 0);
+ FillWindowPixelBuffer(0, PIXEL_FILL(0));
PutWindowTilemap(0);
AddTextPrinterParameterized3(0, 1, GetStringCenterAlignXOffset(1, gText_WelcomeToHOF, 0xD0), 1, sUnknown_085E5388, 0, gText_WelcomeToHOF);
CopyWindowToVram(0, 3);
@@ -1097,7 +1097,7 @@ static void HallOfFame_PrintMonInfo(struct HallofFameMon* currMon, u8 unused1, u
s32 dexNumber;
s32 width;
- FillWindowPixelBuffer(0, 0);
+ FillWindowPixelBuffer(0, PIXEL_FILL(0));
PutWindowTilemap(0);
// dex number
@@ -1178,9 +1178,9 @@ static void HallOfFame_PrintPlayerInfo(u8 unused1, u8 unused2)
u32 width;
u16 trainerId;
- FillWindowPixelBuffer(1, 0x11);
+ FillWindowPixelBuffer(1, PIXEL_FILL(1));
PutWindowTilemap(1);
- SetWindowBorderStyle(1, FALSE, 0x21D, 0xD);
+ DrawStdFrameWithCustomTileAndPalette(1, FALSE, 0x21D, 0xD);
AddTextPrinterParameterized3(1, 1, 0, 1, sUnknown_085E538C, -1, gText_Name);
width = GetStringRightAlignXOffset(1, gSaveBlock2Ptr->playerName, 0x70);
diff --git a/src/item.c b/src/item.c
index 71c2dc0f7..0e13ddf4c 100644
--- a/src/item.c
+++ b/src/item.c
@@ -539,8 +539,8 @@ bool8 RemoveBagItem(u16 itemId, u16 count)
if (CurrentMapIsSecretBase() == TRUE)
{
- VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x200);
- VarSet(VAR_0x40ED, itemId);
+ VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x200);
+ VarSet(VAR_SECRET_BASE_LAST_ITEM_USED, itemId);
}
var = GetItemListPosition(pocket);
diff --git a/src/item_menu.c b/src/item_menu.c
index 877444575..5738757bd 100755
--- a/src/item_menu.c
+++ b/src/item_menu.c
@@ -8,6 +8,7 @@
#include "bg.h"
#include "constants/items.h"
#include "constants/songs.h"
+#include "data2.h"
#include "decompress.h"
#include "event_data.h"
#include "event_object_movement.h"
@@ -445,7 +446,6 @@ EWRAM_DATA u16 gSpecialVar_ItemId = 0;
static EWRAM_DATA struct TempWallyStruct *gUnknown_0203CE80 = 0;
extern u8 *const gPocketNamesStringsTable[];
-extern const u8 gMoveNames[][0xD];
extern u8* gReturnToXStringsTable[];
extern const u8 EventScript_2736B3[];
extern const u16 gUnknown_0860F074[];
@@ -883,7 +883,7 @@ void bag_menu_print_description_box_text(int a)
StringExpandPlaceholders(gStringVar4, gText_ReturnToVar1);
str = gStringVar4;
}
- FillWindowPixelBuffer(1, 0);
+ FillWindowPixelBuffer(1, PIXEL_FILL(0));
bag_menu_print(1, 1, str, 3, 1, 0, 0, 0, 0);
}
@@ -895,7 +895,7 @@ void bag_menu_print_cursor_(u8 a, u8 b)
void bag_menu_print_cursor(u8 a, u8 b)
{
if (b == 0xFF)
- FillWindowPixelRect(0, 0, 0, a, GetMenuCursorDimensionByFont(1, 0), GetMenuCursorDimensionByFont(1, 1));
+ FillWindowPixelRect(0, PIXEL_FILL(0), 0, a, GetMenuCursorDimensionByFont(1, 0), GetMenuCursorDimensionByFont(1, 1));
else
bag_menu_print(0, 1, gText_SelectorArrow2, 0, a, 0, 0, 0, b);
@@ -1027,7 +1027,7 @@ void DisplayItemMessage(u8 taskId, u8 fontId, const u8 *str, void ( *callback)(u
s16* data = gTasks[taskId].data;
data[10] = AddItemMessageWindow(4);
- FillWindowPixelBuffer(data[10], 17);
+ FillWindowPixelBuffer(data[10], PIXEL_FILL(1));
DisplayMessageAndContinueTask(taskId, data[10], 10, 13, fontId, GetPlayerTextSpeedDelay(), str, callback);
schedule_bg_copy_tilemap_to_vram(1);
}
@@ -1292,7 +1292,7 @@ void bag_menu_swap_items(u8 taskId)
gUnknown_0203CE54->unk81A = data[1];
CopyItemName(BagGetItemIdByPocketPosition(gUnknown_0203CE58.pocket + 1, data[1]), gStringVar1);
StringExpandPlaceholders(gStringVar4, gText_MoveVar1Where);
- FillWindowPixelBuffer(1, 0);
+ FillWindowPixelBuffer(1, PIXEL_FILL(0));
bag_menu_print(1, 1, gStringVar4, 3, 1, 0, 0, 0, 0);
sub_80D4FEC(data[1]);
sub_81AB89C();
@@ -1504,7 +1504,7 @@ void sub_81AC644(u8 unused)
{
CopyItemName(gSpecialVar_ItemId, gStringVar1);
StringExpandPlaceholders(gStringVar4, gText_Var1IsSelected);
- FillWindowPixelBuffer(1, 0);
+ FillWindowPixelBuffer(1, PIXEL_FILL(0));
bag_menu_print(1, 1, gStringVar4, 3, 1, 0, 0, 0, 0);
}
if (gUnknown_0203CE54->unk828 == 1)
@@ -1645,7 +1645,7 @@ void ItemMenu_UseOutOfBattle(u8 taskId)
bag_menu_print_there_is_no_pokemon(taskId);
else
{
- FillWindowPixelBuffer(1, 0);
+ FillWindowPixelBuffer(1, PIXEL_FILL(0));
schedule_bg_copy_tilemap_to_vram(0);
if (gUnknown_0203CE58.pocket != BERRIES_POCKET)
ItemId_GetFieldFunc(gSpecialVar_ItemId)(taskId);
@@ -1669,7 +1669,7 @@ void ItemMenu_Toss(u8 taskId)
{
CopyItemName(gSpecialVar_ItemId, gStringVar1);
StringExpandPlaceholders(gStringVar4, gText_TossHowManyVar1s);
- FillWindowPixelBuffer(1, 0);
+ FillWindowPixelBuffer(1, PIXEL_FILL(0));
bag_menu_print(1, 1, gStringVar4, 3, 1, 0, 0, 0, 0);
sub_81ABC3C(7);
gTasks[taskId].func = Task_ChooseHowManyToToss;
@@ -1683,7 +1683,7 @@ void BagMenuConfirmToss(u8 taskId)
CopyItemName(gSpecialVar_ItemId, gStringVar1);
ConvertIntToDecimalStringN(gStringVar2, data[8], 0, 3);
StringExpandPlaceholders(gStringVar4, gText_ConfirmTossItems);
- FillWindowPixelBuffer(1, 0);
+ FillWindowPixelBuffer(1, PIXEL_FILL(0));
bag_menu_print(1, 1, gStringVar4, 3, 1, 0, 0, 0, 0);
bag_menu_yes_no(taskId, 5, &gUnknown_08614084);
}
@@ -1726,7 +1726,7 @@ void BagMenuActuallyToss(u8 taskId)
CopyItemName(gSpecialVar_ItemId, gStringVar1);
ConvertIntToDecimalStringN(gStringVar2, data[8], 0, 3);
StringExpandPlaceholders(gStringVar4, gText_ThrewAwayVar2Var1s);
- FillWindowPixelBuffer(1, 0);
+ FillWindowPixelBuffer(1, PIXEL_FILL(0));
bag_menu_print(1, 1, gStringVar4, 3, 1, 0, 0, 0, 0);
gTasks[taskId].func = Task_ActuallyToss;
}
@@ -2042,7 +2042,7 @@ void display_deposit_item_ask_str(u8 taskId)
{
CopyItemName(gSpecialVar_ItemId, gStringVar1);
StringExpandPlaceholders(gStringVar4, gText_DepositHowManyVar1);
- FillWindowPixelBuffer(1, 0);
+ FillWindowPixelBuffer(1, PIXEL_FILL(0));
bag_menu_print(1, 1, gStringVar4, 3, 1, 0, 0, 0, 0);
sub_81ABC3C(7);
gTasks[taskId].func = sub_81ADA7C;
@@ -2077,7 +2077,7 @@ void sub_81ADB14(u8 taskId)
{
s16* data = gTasks[taskId].data;
- FillWindowPixelBuffer(1, 0);
+ FillWindowPixelBuffer(1, PIXEL_FILL(0));
if (ItemId_GetImportance(gSpecialVar_ItemId))
{
bag_menu_print(1, 1, gText_CantStoreImportantItems, 3, 1, 0, 0, 0, 0);
@@ -2243,7 +2243,7 @@ void bag_menu_print_pocket_names(const u8 *pocketName1, const u8 *pocketName2)
window.width = 16;
window.height = 2;
windowId = AddWindow(&window);
- FillWindowPixelBuffer(windowId, 0);
+ FillWindowPixelBuffer(windowId, PIXEL_FILL(0));
offset = GetStringCenterAlignXOffset(1, pocketName1, 0x40);
bag_menu_print(windowId, 1, pocketName1, offset, 1, 0, 0, -1, 1);
if (pocketName2)
@@ -2282,7 +2282,7 @@ void setup_bag_menu_textboxes(void)
LoadPalette(&gUnknown_0860F074, 0xF0, 0x20);
for (i = 0; i < 3; i++)
{
- FillWindowPixelBuffer(i, 0);
+ FillWindowPixelBuffer(i, PIXEL_FILL(0));
PutWindowTilemap(i);
}
schedule_bg_copy_tilemap_to_vram(0);
@@ -2305,7 +2305,7 @@ u8 bag_menu_add_window(u8 a)
if (*ptr == 0xFF)
{
*ptr = AddWindow(&gUnknown_086141AC[a]);
- SetWindowBorderStyle(*ptr, 0, 1, 14);
+ DrawStdFrameWithCustomTileAndPalette(*ptr, 0, 1, 14);
schedule_bg_copy_tilemap_to_vram(1);
}
return *ptr;
@@ -2316,7 +2316,7 @@ void bag_menu_remove_window(u8 a)
u8 *ptr = &gUnknown_0203CE54->windowPointers[a];
if (*ptr != 0xFF)
{
- sub_8198070(*ptr, 0);
+ ClearStdWindowAndFrameToTransparent(*ptr, 0);
ClearWindowTilemap(*ptr);
RemoveWindow(*ptr);
schedule_bg_copy_tilemap_to_vram(1);
@@ -2337,7 +2337,8 @@ void bag_menu_RemoveBagItem_message_window(u8 a)
u8 *ptr = &gUnknown_0203CE54->windowPointers[a];
if (*ptr != 0xFF)
{
- sub_8197DF8(*ptr, 0);
+ ClearDialogWindowAndFrameToTransparent(*ptr, FALSE);
+ // This ClearWindowTilemap call is redundant, since ClearDialogWindowAndFrameToTransparent already calls it.
ClearWindowTilemap(*ptr);
RemoveWindow(*ptr);
schedule_bg_copy_tilemap_to_vram(1);
@@ -2365,7 +2366,7 @@ void bag_menu_remove_money_window(void)
void bag_menu_prepare_tmhm_move_window(void)
{
- FillWindowPixelBuffer(3, 0);
+ FillWindowPixelBuffer(3, PIXEL_FILL(0));
blit_move_info_icon(3, 19, 0, 0);
blit_move_info_icon(3, 20, 0, 12);
blit_move_info_icon(3, 21, 0, 24);
@@ -2379,7 +2380,7 @@ void PrintTMHMMoveData(u16 itemId)
u16 moveId;
const u8* text;
- FillWindowPixelBuffer(4, 0);
+ FillWindowPixelBuffer(4, PIXEL_FILL(0));
if (itemId == ITEM_NONE)
{
for (i = 0; i < 4; i++)
diff --git a/src/item_use.c b/src/item_use.c
index f9d81bfc0..e646a18ee 100755
--- a/src/item_use.c
+++ b/src/item_use.c
@@ -174,7 +174,7 @@ void DisplayCannotDismountBikeMessage(u8 taskId, bool8 isUsingRegisteredKeyItemO
void CleanUpAfterFailingToUseRegisteredKeyItemOnField(u8 taskId)
{
- sub_8197434(0, 1);
+ ClearDialogWindowAndFrame(0, 1);
DestroyTask(taskId);
ScriptUnfreezeEventObjects();
ScriptContext2_Disable();
@@ -336,7 +336,7 @@ void sub_80FD504(u8 taskId)
void sub_80FD5CC(u8 taskId)
{
- sub_8197434(0, 1);
+ ClearDialogWindowAndFrame(0, 1);
ScriptUnfreezeEventObjects();
ScriptContext2_Disable();
DestroyTask(taskId);
diff --git a/src/learn_move.c b/src/learn_move.c
index 7a6916013..879acff6d 100644
--- a/src/learn_move.c
+++ b/src/learn_move.c
@@ -498,7 +498,7 @@ static void LearnMoveMain(void)
case 27:
if (!sub_81D2C3C())
{
- FillWindowPixelBuffer(3, 0x11);
+ FillWindowPixelBuffer(3, PIXEL_FILL(1));
if (sLearnMoveStruct2.showContestInfo == FALSE)
{
sLearnMoveStruct->state = 3;
@@ -631,7 +631,7 @@ static void HideSpritesAndPrintTeachText(bool8 a)
if (!a)
{
StringExpandPlaceholders(gStringVar4, gText_TeachWhichMoveToPkmn);
- FillWindowPixelBuffer(3, 0x11);
+ FillWindowPixelBuffer(3, PIXEL_FILL(1));
AddTextPrinterParameterized(3, 1, gStringVar4, 0, 1, 0, NULL);
}
}
@@ -695,7 +695,7 @@ static void ShowTeachMoveText(bool8 showContest)
if (showContest == FALSE)
{
StringExpandPlaceholders(gStringVar4, gText_TeachWhichMoveToPkmn);
- FillWindowPixelBuffer(3, 0x11);
+ FillWindowPixelBuffer(3, PIXEL_FILL(1));
AddTextPrinterParameterized(3, 1, gStringVar4, 0, 1, 0, NULL);
}
}
diff --git a/src/link.c b/src/link.c
index 05da4e458..525d50d7c 100644
--- a/src/link.c
+++ b/src/link.c
@@ -1685,8 +1685,8 @@ static void sub_800B080(void)
CopyToBgTilemapBuffer(1, gWirelessLinkDisplayTilemap, 0, 0);
CopyBgTilemapBufferToVram(1);
LoadPalette(gWirelessLinkDisplayPal, 0, 0x20);
- FillWindowPixelBuffer(0, 0x00);
- FillWindowPixelBuffer(2, 0x00);
+ FillWindowPixelBuffer(0, PIXEL_FILL(0));
+ FillWindowPixelBuffer(2, PIXEL_FILL(0));
AddTextPrinterParameterized3(0, 3, 2, 6, gUnknown_082ED224, 0, gText_CommErrorEllipsis);
AddTextPrinterParameterized3(2, 3, 2, 1, gUnknown_082ED224, 0, gText_MoveCloserToLinkPartner);
PutWindowTilemap(0);
@@ -1698,8 +1698,8 @@ static void sub_800B080(void)
static void sub_800B138(void)
{
LoadBgTiles(0, g2BlankTilesGfx, 0x20, 0);
- FillWindowPixelBuffer(1, 0x00);
- FillWindowPixelBuffer(2, 0x00);
+ FillWindowPixelBuffer(1, PIXEL_FILL(0));
+ FillWindowPixelBuffer(2, PIXEL_FILL(0));
AddTextPrinterParameterized3(1, 3, 2, 0, gUnknown_082ED224, 0, gText_CommErrorCheckConnections);
PutWindowTilemap(1);
PutWindowTilemap(2);
diff --git a/src/list_menu.c b/src/list_menu.c
index 7a9547661..51d7dcb15 100644
--- a/src/list_menu.c
+++ b/src/list_menu.c
@@ -355,11 +355,11 @@ s32 DoMysteryGiftListMenu(struct WindowTemplate *windowTemplate, struct ListMenu
switch (arg2)
{
case 0: // can never be reached, because of the if statement above
- sub_819746C(sMysteryGiftLinkMenu.windowId, FALSE);
+ ClearStdWindowAndFrame(sMysteryGiftLinkMenu.windowId, FALSE);
break;
case 2:
case 1:
- sub_819746C(sMysteryGiftLinkMenu.windowId, FALSE);
+ ClearStdWindowAndFrame(sMysteryGiftLinkMenu.windowId, FALSE);
break;
}
}
@@ -486,7 +486,7 @@ void RedrawListMenu(u8 listTaskId)
{
struct ListMenu *list = (void*) gTasks[listTaskId].data;
- FillWindowPixelBuffer(list->template.windowId, (list->template.fillValue << 4) | (list->template.fillValue));
+ FillWindowPixelBuffer(list->template.windowId, PIXEL_FILL(list->template.fillValue));
ListMenuPrintEntries(list, list->scrollOffset, 0, list->template.maxShowed);
ListMenuDrawCursor(list);
CopyWindowToVram(list->template.windowId, 2);
@@ -584,7 +584,7 @@ static u8 ListMenuInitInternal(struct ListMenuTemplate *listMenuTemplate, u16 sc
if (list->template.totalItems < list->template.maxShowed)
list->template.maxShowed = list->template.totalItems;
- FillWindowPixelBuffer(list->template.windowId, (list->template.fillValue << 4) | (list->template.fillValue));
+ FillWindowPixelBuffer(list->template.windowId, PIXEL_FILL(list->template.fillValue));
ListMenuPrintEntries(list, list->scrollOffset, 0, list->template.maxShowed);
ListMenuDrawCursor(list);
ListMenuCallSelectionChangedCallback(list, TRUE);
@@ -698,7 +698,7 @@ static void ListMenuErasePrintedCursor(struct ListMenu *list, u16 selectedRow)
u8 width = GetMenuCursorDimensionByFont(list->template.fontId, 0);
u8 height = GetMenuCursorDimensionByFont(list->template.fontId, 1);
FillWindowPixelRect(list->template.windowId,
- (list->template.fillValue << 4) | (list->template.fillValue),
+ PIXEL_FILL(list->template.fillValue),
list->template.cursor_X,
selectedRow * yMultiplier + list->template.upText_Y,
width,
@@ -795,7 +795,7 @@ static void ListMenuScroll(struct ListMenu *list, u8 count, bool8 movingDown)
{
if (count >= list->template.maxShowed)
{
- FillWindowPixelBuffer(list->template.windowId, (list->template.fillValue << 4) | (list->template.fillValue));
+ FillWindowPixelBuffer(list->template.windowId, PIXEL_FILL(list->template.fillValue));
ListMenuPrintEntries(list, list->scrollOffset, 0, list->template.maxShowed);
}
else
@@ -806,26 +806,26 @@ static void ListMenuScroll(struct ListMenu *list, u8 count, bool8 movingDown)
{
u16 y, width, height;
- ScrollWindow(list->template.windowId, 1, count * yMultiplier, (list->template.fillValue << 4) | (list->template.fillValue));
+ ScrollWindow(list->template.windowId, 1, count * yMultiplier, PIXEL_FILL(list->template.fillValue));
ListMenuPrintEntries(list, list->scrollOffset, 0, count);
y = (list->template.maxShowed * yMultiplier) + list->template.upText_Y;
width = GetWindowAttribute(list->template.windowId, WINDOW_WIDTH) * 8;
height = (GetWindowAttribute(list->template.windowId, WINDOW_HEIGHT) * 8) - y;
FillWindowPixelRect(list->template.windowId,
- (list->template.fillValue << 4) | (list->template.fillValue),
+ PIXEL_FILL(list->template.fillValue),
0, y, width, height);
}
else
{
u16 width;
- ScrollWindow(list->template.windowId, 0, count * yMultiplier, (list->template.fillValue << 4) | (list->template.fillValue));
+ ScrollWindow(list->template.windowId, 0, count * yMultiplier, PIXEL_FILL(list->template.fillValue));
ListMenuPrintEntries(list, list->scrollOffset + (list->template.maxShowed - count), list->template.maxShowed - count, count);
width = GetWindowAttribute(list->template.windowId, WINDOW_WIDTH) * 8;
FillWindowPixelRect(list->template.windowId,
- (list->template.fillValue << 4) | (list->template.fillValue),
+ PIXEL_FILL(list->template.fillValue),
0, 0, width, list->template.upText_Y);
}
}
diff --git a/src/load_save.c b/src/load_save.c
index a0d2568d3..d6785254f 100644
--- a/src/load_save.c
+++ b/src/load_save.c
@@ -99,7 +99,7 @@ void MoveSaveBlocks_ResetHeap(void)
hblankCB = gMain.hblankCallback;
gMain.vblankCallback = NULL;
gMain.hblankCallback = NULL;
- gUnknown_0203CF5C = NULL;
+ gTrainerHillVBlankCounter = NULL;
saveBlock2Copy = (struct SaveBlock2 *)(gHeap);
saveBlock1Copy = (struct SaveBlock1 *)(gHeap + sizeof(struct SaveBlock2));
diff --git a/src/lottery_corner.c b/src/lottery_corner.c
index bd7d17ef7..bb3bb7a5c 100644
--- a/src/lottery_corner.c
+++ b/src/lottery_corner.c
@@ -27,7 +27,7 @@ void ResetLotteryCorner(void)
u16 rand = Random();
SetLotteryNumber((Random() << 16) | rand);
- VarSet(VAR_POKELOT_PRIZE, 0);
+ VarSet(VAR_POKELOT_PRIZE_ITEM, 0);
}
void SetRandomLotteryNumber(u16 i)
diff --git a/src/mail.c b/src/mail.c
index aa4ba571f..9cca4492e 100644
--- a/src/mail.c
+++ b/src/mail.c
@@ -477,8 +477,8 @@ static void sub_8121B1C(void)
y = 0;
PutWindowTilemap(0);
PutWindowTilemap(1);
- FillWindowPixelBuffer(0, 0);
- FillWindowPixelBuffer(1, 0);
+ FillWindowPixelBuffer(0, PIXEL_FILL(0));
+ FillWindowPixelBuffer(1, PIXEL_FILL(0));
for (i = 0; i < sMailRead->layout->numSubStructs; i ++)
{
if (sMailRead->strbuf[i][0] == EOS || sMailRead->strbuf[i][0] == CHAR_SPACE)
diff --git a/src/main.c b/src/main.c
index aa42c5958..40381bb68 100644
--- a/src/main.c
+++ b/src/main.c
@@ -160,7 +160,7 @@ static void UpdateLinkAndCallCallbacks(void)
static void InitMainCallbacks(void)
{
gMain.vblankCounter1 = 0;
- gUnknown_0203CF5C = NULL;
+ gTrainerHillVBlankCounter = NULL;
gMain.vblankCounter2 = 0;
gMain.callback1 = NULL;
SetMainCallback2(CB2_InitCopyrightScreenAfterBootup);
@@ -319,8 +319,8 @@ static void VBlankIntr(void)
gMain.vblankCounter1++;
- if (gUnknown_0203CF5C && *gUnknown_0203CF5C < 0xFFFFFFFF)
- (*gUnknown_0203CF5C)++;
+ if (gTrainerHillVBlankCounter && *gTrainerHillVBlankCounter < 0xFFFFFFFF)
+ (*gTrainerHillVBlankCounter)++;
if (gMain.vblankCallback)
gMain.vblankCallback();
@@ -388,14 +388,14 @@ static void WaitForVBlank(void)
;
}
-void sub_80008DC(u32 *var)
+void SetTrainerHillVBlankCounter(u32 *counter)
{
- gUnknown_0203CF5C = var;
+ gTrainerHillVBlankCounter = counter;
}
-void sub_80008E8(void)
+void ClearTrainerHillVBlankCounter(void)
{
- gUnknown_0203CF5C = NULL;
+ gTrainerHillVBlankCounter = NULL;
}
void DoSoftReset(void)
diff --git a/src/main_menu.c b/src/main_menu.c
index 82a30aa59..e6e29d942 100644
--- a/src/main_menu.c
+++ b/src/main_menu.c
@@ -39,6 +39,135 @@
#include "title_screen.h"
#include "window.h"
+/*
+ * Main menu state machine
+ * -----------------------
+ *
+ * Entry point: CB2_InitMainMenu
+ *
+ * Note: States advance sequentially unless otherwise stated.
+ *
+ * CB2_InitMainMenu / CB2_ReinitMainMenu
+ * - Both of these states call InitMainMenu, which does all the work.
+ * - In the Reinit case, the init code will check if the user came from
+ * the options screen. If they did, then the options menu item is
+ * pre-selected.
+ *
+ * Task_MainMenuCheckSaveFile
+ * - Determines how many menu options to show based on whether
+ * the save file is Ok, empty, corrupted, etc.
+ * - If there was an error loading the save file, advance to
+ * Task_WaitForSaveFileErrorWindow.
+ * - If there were no errors, advance to Task_MainMenuCheckBattery.
+ * - Note that the check to enable Mystery Events would normally happen
+ * here, but this version of Emerald has them disabled.
+ *
+ * Task_WaitForSaveFileErrorWindow
+ * - Wait for the text to finish printing and then for the A button
+ * to be pressed.
+ *
+ * Task_MainMenuCheckBattery
+ * - If the battery is OK, advance to Task_DisplayMainMenu.
+ * - If the battery is dry, advance to Task_WaitForBatteryDryErrorWindow.
+ *
+ * Task_WaitForBatteryDryErrorWindow
+ * - Wait for the text to finish printing and then for the A button
+ * to be pressed.
+ *
+ * Task_DisplayMainWindow
+ * - Display the buttons to the user. If the menu is in HAS_MYSTERY_EVENTS
+ * mode, there are too many buttons for one screen and a scrollbar is added,
+ * and the scrollbar task is spawned (Task_ScrollIndicatorArrowPairOnMainMenu).
+ *
+ * Task_HighlightSelectedMainMenuItem
+ * - Update the UI to match the currently selected item.
+ *
+ * Task_HandleMainMenuInput
+ * - If A is pressed, advance to Task_HandleMainMenuAPressed.
+ * - If B is pressed, return to the title screen via CB2_InitTitleScreen.
+ * - If Up or Down is pressed, handle scrolling if there is a scroll bar, change
+ * the selection, then go back to Task_HighlightSelectedMainMenuItem.
+ *
+ * Task_HandleMainMenuAPressed
+ * - If the user selected New Game, advance to Task_NewGameBirchSpeech_Init.
+ * - If the user selected Continue, advance to CB2_ContinueSavedGame.
+ * - If the user selected the Options menu, advance to CB2_InitOptionMenu.
+ * - If the user selected Mystery Gift, advance to CB2_MysteryGift. However,
+ * if the wireless adapter was removed, instead advance to
+ * Task_DisplayMainMenuInvalidActionError.
+ * - Code to start a Mystery Event is present here, but is unreachable in this
+ * version.
+ *
+ * Task_HandleMainMenuBPressed
+ * - Clean up the main menu and go back to CB2_InitTitleScreen.
+ *
+ * Task_DisplayMainMenuInvalidActionError
+ * - Print one of three different error messages, wait for the text to stop
+ * printing, and then wait for A or B to be pressed.
+ * - Then advance to Task_HandleMainMenuBPressed.
+ *
+ * Task_NewGameBirchSpeechInit
+ * - Load the sprites for the intro speech, start playing music
+ * Task_NewGameBirchSpeech_WaitToShowBirch
+ * - Spawn Task_NewGameBirchSpeech_FadeInTarget1OutTarget2
+ * - Spawn Task_NewGameBirchSpeech_FadePlatformOut
+ * - Both of these tasks destroy themselves when done.
+ * Task_NewGameBirchSpeech_WaitForSpriteFadeInWelcome
+ * Task_NewGameBirchSpeech_ThisIsAPokemon
+ * - When the text is done printing, spawns Task_NewGameBirchSpeechSub_InitPokeball
+ * Task_NewGameBirchSpeech_MainSpeech
+ * Task_NewGameBirchSpeech_AndYouAre
+ * Task_NewGameBirchSpeech_StartBirchLotadPlatformFade
+ * Task_NewGameBirchSpeech_StartBirchLotadPlatformFade
+ * Task_NewGameBirchSpeech_SlidePlatformAway
+ * Task_NewGameBirchSpeech_StartPlayerFadeIn
+ * Task_NewGameBirchSpeech_WaitForPlayerFadeIn
+ * Task_NewGameBirchSpeech_BoyOrGirl
+ * Task_NewGameBirchSpeech_WaitToShowGenderMenu
+ * Task_NewGameBirchSpeech_ChooseGender
+ * - Animates by advancing to Task_NewGameBirchSpeech_SlideOutOldGenderSprite
+ * whenever the player's selection changes.
+ * - Advances to Task_NewGameBirchSpeech_WhatsYourName when done.
+ *
+ * Task_NewGameBirchSpeech_SlideOutOldGenderSprite
+ * Task_NewGameBirchSpeech_SlideInNewGenderSprite
+ * - Returns back to Task_NewGameBirchSpeech_ChooseGender.
+ *
+ * Task_NewGameBirchSpeech_WhatsYourName
+ * Task_NewGameBirchSpeech_WaitForWhatsYourNameToPrint
+ * Task_NewGameBirchSpeech_WaitPressBeforeNameChoice
+ * Task_NewGameBirchSpeech_StartNamingScreen
+ * C2_NamingScreen
+ * - Returns to CB2_NewGameBirchSpeech_ReturnFromNamingScreen when done
+ * CB2_NewGameBirchSpeech_ReturnFromNamingScreen
+ * Task_NewGameBirchSpeech_ReturnFromNamingScreenShowTextbox
+ * Task_NewGameBirchSpeech_SoItsPlayerName
+ * Task_NewGameBirchSpeech_CreateNameYesNo
+ * Task_NewGameBirchSpeech_ProcessNameYesNoMenu
+ * - If confirmed, advance to Task_NewGameBirchSpeech_SlidePlatformAway2.
+ * - Otherwise, return to Task_NewGameBirchSpeech_BoyOrGirl.
+ *
+ * Task_NewGameBirchSpeech_SlidePlatformAway2
+ * Task_NewGameBirchSpeech_ReshowBirchLotad
+ * Task_NewGameBirchSpeech_WaitForSpriteFadeInAndTextPrinter
+ * Task_NewGameBirchSpeech_AreYouReady
+ * Task_NewGameBirchSpeech_ShrinkPlayer
+ * Task_NewGameBirchSpeech_WaitForPlayerShrink
+ * Task_NewGameBirchSpeech_FadePlayerToWhite
+ * Task_NewGameBirchSpeech_Cleanup
+ * - Advances to CB2_NewGame.
+ *
+ * Task_NewGameBirchSpeechSub_InitPokeball
+ * - Advances to Task_NewGameBirchSpeechSub_WaitForLotad
+ * Task_NewGameBirchSpeechSub_WaitForLotad
+ * - Destroys itself when done.
+ */
+
+// These two defines are used with the sCurrItemAndOptionsMenuCheck,
+// to distinguish between its two parts.
+#define OPTION_MENU_FLAG 0x8000
+#define CURRENT_ITEM_MASK 0x7FFF
+
// Static type declarations
// Static RAM declarations
@@ -112,7 +241,7 @@ static void SpriteCB_MovePlayerDownWhileShrinking(struct Sprite*);
static void Task_NewGameBirchSpeech_WaitForPlayerShrink(u8);
static void Task_NewGameBirchSpeech_FadePlayerToWhite(u8);
static void Task_NewGameBirchSpeech_Cleanup(u8);
-static void nullsub_11();
+static void SpriteCB_Null();
static void Task_NewGameBirchSpeech_ReturnFromNamingScreenShowTextbox(u8);
static void MainMenu_FormatSavegamePlayer(void);
static void MainMenu_FormatSavegamePokedex(void);
@@ -247,7 +376,7 @@ static const struct WindowTemplate sWindowTemplates_MainMenu[] =
DUMMY_WIN_TEMPLATE
};
-static const struct WindowTemplate gUnknown_082FF080[] =
+static const struct WindowTemplate gNewGameBirchSpeechTextWindows[] =
{
{
.bg = 0,
@@ -542,7 +671,7 @@ static void Task_MainMenuCheckSaveFile(u8 taskId)
gTasks[taskId].func = Task_WaitForSaveFileErrorWindow;
break;
}
- if (sCurrItemAndOptionMenuCheck & 0x8000) // are we returning from the options menu?
+ if (sCurrItemAndOptionMenuCheck & OPTION_MENU_FLAG) // are we returning from the options menu?
{
switch (tMenuType) // if so, highlight the OPTIONS item
{
@@ -558,7 +687,7 @@ static void Task_MainMenuCheckSaveFile(u8 taskId)
break;
}
}
- sCurrItemAndOptionMenuCheck &= 0x7FFF; // turn off the "returning from options menu" flag
+ sCurrItemAndOptionMenuCheck &= CURRENT_ITEM_MASK; // turn off the "returning from options menu" flag
tCurrItem = sCurrItemAndOptionMenuCheck;
tItemCount = tMenuType + 2;
}
@@ -637,6 +766,8 @@ static void Task_DisplayMainMenu(u8 taskId)
palette = RGB(26, 26, 25);
LoadPalette(&palette, 252, 2);
+ // Note: If there is no save file, the save block is zeroed out,
+ // so the default gender is MALE.
if (gSaveBlock2Ptr->playerGender == MALE)
{
palette = RGB(4, 16, 31);
@@ -652,8 +783,8 @@ static void Task_DisplayMainMenu(u8 taskId)
{
case HAS_NO_SAVED_GAME:
default:
- FillWindowPixelBuffer(0, 0xAA);
- FillWindowPixelBuffer(1, 0xAA);
+ FillWindowPixelBuffer(0, PIXEL_FILL(0xA));
+ FillWindowPixelBuffer(1, PIXEL_FILL(0xA));
AddTextPrinterParameterized3(0, 1, 0, 1, sTextColor_Headers, -1, gText_MainMenuNewGame);
AddTextPrinterParameterized3(1, 1, 0, 1, sTextColor_Headers, -1, gText_MainMenuOption);
PutWindowTilemap(0);
@@ -664,9 +795,9 @@ static void Task_DisplayMainMenu(u8 taskId)
DrawMainMenuWindowBorder(&sWindowTemplates_MainMenu[1], MAIN_MENU_BORDER_TILE);
break;
case HAS_SAVED_GAME:
- FillWindowPixelBuffer(2, 0xAA);
- FillWindowPixelBuffer(3, 0xAA);
- FillWindowPixelBuffer(4, 0xAA);
+ FillWindowPixelBuffer(2, PIXEL_FILL(0xA));
+ FillWindowPixelBuffer(3, PIXEL_FILL(0xA));
+ FillWindowPixelBuffer(4, PIXEL_FILL(0xA));
AddTextPrinterParameterized3(2, 1, 0, 1, sTextColor_Headers, -1, gText_MainMenuContinue);
AddTextPrinterParameterized3(3, 1, 0, 1, sTextColor_Headers, -1, gText_MainMenuNewGame);
AddTextPrinterParameterized3(4, 1, 0, 1, sTextColor_Headers, -1, gText_MainMenuOption);
@@ -682,10 +813,10 @@ static void Task_DisplayMainMenu(u8 taskId)
DrawMainMenuWindowBorder(&sWindowTemplates_MainMenu[4], MAIN_MENU_BORDER_TILE);
break;
case HAS_MYSTERY_GIFT:
- FillWindowPixelBuffer(2, 0xAA);
- FillWindowPixelBuffer(3, 0xAA);
- FillWindowPixelBuffer(4, 0xAA);
- FillWindowPixelBuffer(5, 0xAA);
+ FillWindowPixelBuffer(2, PIXEL_FILL(0xA));
+ FillWindowPixelBuffer(3, PIXEL_FILL(0xA));
+ FillWindowPixelBuffer(4, PIXEL_FILL(0xA));
+ FillWindowPixelBuffer(5, PIXEL_FILL(0xA));
AddTextPrinterParameterized3(2, 1, 0, 1, sTextColor_Headers, -1, gText_MainMenuContinue);
AddTextPrinterParameterized3(3, 1, 0, 1, sTextColor_Headers, -1, gText_MainMenuNewGame);
AddTextPrinterParameterized3(4, 1, 0, 1, sTextColor_Headers, -1, gText_MainMenuMysteryGift);
@@ -705,11 +836,11 @@ static void Task_DisplayMainMenu(u8 taskId)
DrawMainMenuWindowBorder(&sWindowTemplates_MainMenu[5], MAIN_MENU_BORDER_TILE);
break;
case HAS_MYSTERY_EVENTS:
- FillWindowPixelBuffer(2, 0xAA);
- FillWindowPixelBuffer(3, 0xAA);
- FillWindowPixelBuffer(4, 0xAA);
- FillWindowPixelBuffer(5, 0xAA);
- FillWindowPixelBuffer(6, 0xAA);
+ FillWindowPixelBuffer(2, PIXEL_FILL(0xA));
+ FillWindowPixelBuffer(3, PIXEL_FILL(0xA));
+ FillWindowPixelBuffer(4, PIXEL_FILL(0xA));
+ FillWindowPixelBuffer(5, PIXEL_FILL(0xA));
+ FillWindowPixelBuffer(6, PIXEL_FILL(0xA));
AddTextPrinterParameterized3(2, 1, 0, 1, sTextColor_Headers, -1, gText_MainMenuContinue);
AddTextPrinterParameterized3(3, 1, 0, 1, sTextColor_Headers, -1, gText_MainMenuNewGame);
AddTextPrinterParameterized3(4, 1, 0, 1, sTextColor_Headers, -1, gText_MainMenuMysteryGift2);
@@ -813,14 +944,14 @@ static void Task_HandleMainMenuAPressed(u8 taskId)
{
if (gTasks[taskId].tMenuType == HAS_MYSTERY_EVENTS)
RemoveScrollIndicatorArrowPair(gTasks[taskId].tScrollArrowTaskId);
- sub_819746C(0, 1);
- sub_819746C(1, 1);
- sub_819746C(2, 1);
- sub_819746C(3, 1);
- sub_819746C(4, 1);
- sub_819746C(5, 1);
- sub_819746C(6, 1);
- sub_819746C(7, 1);
+ ClearStdWindowAndFrame(0, TRUE);
+ ClearStdWindowAndFrame(1, TRUE);
+ ClearStdWindowAndFrame(2, TRUE);
+ ClearStdWindowAndFrame(3, TRUE);
+ ClearStdWindowAndFrame(4, TRUE);
+ ClearStdWindowAndFrame(5, TRUE);
+ ClearStdWindowAndFrame(6, TRUE);
+ ClearStdWindowAndFrame(7, TRUE);
wirelessAdapterConnected = IsWirelessAdapterConnected();
switch (gTasks[taskId].tMenuType)
{
@@ -973,7 +1104,7 @@ static void Task_HandleMainMenuAPressed(u8 taskId)
if (action != ACTION_OPTION)
sCurrItemAndOptionMenuCheck = 0;
else
- sCurrItemAndOptionMenuCheck |= 0x8000; // entering the options menu
+ sCurrItemAndOptionMenuCheck |= OPTION_MENU_FLAG; // entering the options menu
}
}
@@ -981,7 +1112,7 @@ static void Task_HandleMainMenuBPressed(u8 taskId)
{
if (!gPaletteFade.active)
{
- if (gTasks[taskId].tMenuType == 3)
+ if (gTasks[taskId].tMenuType == HAS_MYSTERY_EVENTS)
RemoveScrollIndicatorArrowPair(gTasks[taskId].tScrollArrowTaskId);
sCurrItemAndOptionMenuCheck = 0;
FreeAllWindowBuffers();
@@ -1199,7 +1330,7 @@ static void Task_NewGameBirchSpeech_WaitForSpriteFadeInWelcome(u8 taskId)
}
else
{
- InitWindows(gUnknown_082FF080);
+ InitWindows(gNewGameBirchSpeechTextWindows);
LoadMainMenuWindowFrameTiles(0, 0xF3);
LoadMessageBoxGfx(0, 0xFC, 0xF0);
NewGameBirchSpeech_ShowDialogueWindow(0, 1);
@@ -1642,7 +1773,7 @@ static void Task_NewGameBirchSpeech_FadePlayerToWhite(u8 taskId)
if (!gPaletteFade.active)
{
spriteId = gTasks[taskId].tPlayerSpriteId;
- gSprites[spriteId].callback = nullsub_11;
+ gSprites[spriteId].callback = SpriteCB_Null;
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP);
BeginNormalPaletteFade(0xFFFF0000, 0, 0, 16, RGB_WHITEALPHA);
gTasks[taskId].func = Task_NewGameBirchSpeech_Cleanup;
@@ -1730,14 +1861,14 @@ static void CB2_NewGameBirchSpeech_ReturnFromNamingScreen(void)
REG_IME = savedIme;
SetVBlankCallback(VBlankCB_MainMenu);
SetMainCallback2(CB2_MainMenu);
- InitWindows(gUnknown_082FF080);
+ InitWindows(gNewGameBirchSpeechTextWindows);
LoadMainMenuWindowFrameTiles(0, 0xF3);
LoadMessageBoxGfx(0, 0xFC, 0xF0);
PutWindowTilemap(0);
CopyWindowToVram(0, 3);
}
-static void nullsub_11(struct Sprite *sprite)
+static void SpriteCB_Null(struct Sprite *sprite)
{
}
@@ -1763,22 +1894,22 @@ static void AddBirchSpeechObjects(u8 taskId)
u8 maySpriteId;
birchSpriteId = AddNewGameBirchObject(0x88, 0x3C, 1);
- gSprites[birchSpriteId].callback = nullsub_11;
+ gSprites[birchSpriteId].callback = SpriteCB_Null;
gSprites[birchSpriteId].oam.priority = 0;
gSprites[birchSpriteId].invisible = TRUE;
gTasks[taskId].tBirchSpriteId = birchSpriteId;
lotadSpriteId = NewGameBirchSpeech_CreateLotadSprite(100, 0x4B);
- gSprites[lotadSpriteId].callback = nullsub_11;
+ gSprites[lotadSpriteId].callback = SpriteCB_Null;
gSprites[lotadSpriteId].oam.priority = 0;
gSprites[lotadSpriteId].invisible = TRUE;
gTasks[taskId].tLotadSpriteId = lotadSpriteId;
brendanSpriteId = CreateTrainerSprite(FacilityClassToPicIndex(FACILITY_CLASS_BRENDAN), 120, 60, 0, &gDecompressionBuffer[0]);
- gSprites[brendanSpriteId].callback = nullsub_11;
+ gSprites[brendanSpriteId].callback = SpriteCB_Null;
gSprites[brendanSpriteId].invisible = TRUE;
gSprites[brendanSpriteId].oam.priority = 0;
gTasks[taskId].tBrendanSpriteId = brendanSpriteId;
maySpriteId = CreateTrainerSprite(FacilityClassToPicIndex(FACILITY_CLASS_MAY), 120, 60, 0, &gDecompressionBuffer[0x800]);
- gSprites[maySpriteId].callback = nullsub_11;
+ gSprites[maySpriteId].callback = SpriteCB_Null;
gSprites[maySpriteId].invisible = TRUE;
gSprites[maySpriteId].oam.priority = 0;
gTasks[taskId].tMaySpriteId = maySpriteId;
@@ -1966,8 +2097,8 @@ static void NewGameBirchSpeech_StartFadePlatformOut(u8 taskId, u8 delay)
static void NewGameBirchSpeech_ShowGenderMenu(void)
{
- DrawMainMenuWindowBorder(&gUnknown_082FF080[1], 0xF3);
- FillWindowPixelBuffer(1, 17);
+ DrawMainMenuWindowBorder(&gNewGameBirchSpeechTextWindows[1], 0xF3);
+ FillWindowPixelBuffer(1, PIXEL_FILL(1));
PrintMenuTable(1, 2, sMenuActions_Gender);
InitMenuInUpperLeftCornerPlaySoundWhenAPressed(1, 2, 0);
PutWindowTilemap(1);
@@ -1995,7 +2126,7 @@ static void NewGameBirchSpeech_SetDefaultPlayerName(u8 nameId)
static void CreateMainMenuErrorWindow(const u8* str)
{
- FillWindowPixelBuffer(7, 17);
+ FillWindowPixelBuffer(7, PIXEL_FILL(1));
AddTextPrinterParameterized(7, 1, str, 0, 1, 2, 0);
PutWindowTilemap(7);
CopyWindowToVram(7, 2);
@@ -2105,12 +2236,12 @@ static void NewGameBirchSpeech_ClearGenderWindowTilemap(u8 a, u8 b, u8 c, u8 d,
FillBgTilemapBufferRect(a, 0, b + 0xFF, c + 0xFF, d + 2, e + 2, 2);
}
-static void NewGameBirchSpeech_ClearGenderWindow(u8 windowId, u8 a)
+static void NewGameBirchSpeech_ClearGenderWindow(u8 windowId, bool8 copyToVram)
{
CallWindowFunction(windowId, NewGameBirchSpeech_ClearGenderWindowTilemap);
- FillWindowPixelBuffer(windowId, 0x11);
+ FillWindowPixelBuffer(windowId, PIXEL_FILL(1));
ClearWindowTilemap(windowId);
- if (a == 1)
+ if (copyToVram == TRUE)
CopyWindowToVram(windowId, 3);
}
@@ -2146,7 +2277,7 @@ void CreateYesNoMenuParameterized(u8 a, u8 b, u16 c, u16 d, u8 e, u8 f)
static void NewGameBirchSpeech_ShowDialogueWindow(u8 windowId, u8 copyToVram)
{
CallWindowFunction(windowId, NewGameBirchSpeech_CreateDialogueWindowBorder);
- FillWindowPixelBuffer(windowId, 17);
+ FillWindowPixelBuffer(windowId, PIXEL_FILL(1));
PutWindowTilemap(windowId);
if (copyToVram == TRUE)
CopyWindowToVram(windowId, 3);
diff --git a/src/map_name_popup.c b/src/map_name_popup.c
index cdb4c3330..8936198ae 100644
--- a/src/map_name_popup.c
+++ b/src/map_name_popup.c
@@ -276,7 +276,7 @@ static void Task_MapNamePopUpWindow(u8 taskId)
}
break;
case 4:
- sub_819746C(GetMapNamePopUpWindowId(), TRUE);
+ ClearStdWindowAndFrame(GetMapNamePopUpWindowId(), TRUE);
task->data[0] = 5;
break;
case 5:
@@ -290,7 +290,7 @@ void HideMapNamePopUpWindow(void)
{
if (FuncIsActiveTask(Task_MapNamePopUpWindow))
{
- sub_819746C(GetMapNamePopUpWindowId(), TRUE);
+ ClearStdWindowAndFrame(GetMapNamePopUpWindowId(), TRUE);
RemoveMapNamePopUpWindow();
SetGpuReg_ForcedBlank(REG_OFFSET_BG0VOFS, 0);
DestroyTask(sPopupTaskId);
diff --git a/src/match_call.c b/src/match_call.c
index ce1573164..641079ba9 100644
--- a/src/match_call.c
+++ b/src/match_call.c
@@ -1014,7 +1014,7 @@ static bool32 MapAllowsMatchCall(void)
if (gMapHeader.regionMapSectionId == MAPSEC_SOOTOPOLIS_CITY
&& FlagGet(FLAG_HIDE_SOOTOPOLIS_CITY_RAYQUAZA) == TRUE
- && FlagGet(FLAG_UNUSED_0x0DC) == FALSE)
+ && FlagGet(FLAG_NEVER_SET_0x0DC) == FALSE)
return FALSE;
if (gMapHeader.regionMapSectionId == MAPSEC_MT_CHIMNEY
@@ -1189,7 +1189,7 @@ static bool32 LoadMatchCallWindowGfx(u8 taskId)
return FALSE;
}
- FillWindowPixelBuffer(taskData[2], 0x88);
+ FillWindowPixelBuffer(taskData[2], PIXEL_FILL(8));
LoadPalette(sUnknown_0860EA4C, 0xE0, 0x20);
LoadPalette(sPokeNavIconPalette, 0xF0, 0x20);
ChangeBgY(0, -0x2000, 0);
@@ -1239,7 +1239,7 @@ static bool32 sub_81962D8(u8 taskId)
s16 *taskData = gTasks[taskId].data;
if (!ExecuteMatchCallTextPrinter(taskData[2]))
{
- FillWindowPixelBuffer(taskData[2], 0x88);
+ FillWindowPixelBuffer(taskData[2], PIXEL_FILL(8));
if (!gMatchCallState.triggeredFromScript)
SelectMatchCallMessage(gMatchCallState.trainerId, gStringVar4);
@@ -1255,7 +1255,7 @@ static bool32 sub_8196330(u8 taskId)
s16 *taskData = gTasks[taskId].data;
if (!ExecuteMatchCallTextPrinter(taskData[2]) && !IsSEPlaying() && gMain.newKeys & (A_BUTTON | B_BUTTON))
{
- FillWindowPixelBuffer(taskData[2], 0x88);
+ FillWindowPixelBuffer(taskData[2], PIXEL_FILL(8));
CopyWindowToVram(taskData[2], 2);
PlaySE(SE_TOREOFF);
return TRUE;
diff --git a/src/mauville_old_man.c b/src/mauville_old_man.c
index fd8e74c0a..ec5cb238b 100644
--- a/src/mauville_old_man.c
+++ b/src/mauville_old_man.c
@@ -437,7 +437,7 @@ static void BardSong_TextSubPrinter(struct TextPrinterTemplate * printer, u16 a1
static void sub_8120708(const u8 * src)
{
- NewMenuHelpers_DrawDialogueFrame(0, 0);
+ DrawDialogueFrame(0, 0);
AddTextPrinterParameterized(0, 1, src, 0, 1, 1, BardSong_TextSubPrinter);
gUnknown_03002F84 = TRUE;
CopyWindowToVram(0, 3);
diff --git a/src/menu.c b/src/menu.c
index e82a6355c..b04572b81 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -124,16 +124,16 @@ const struct MoveMenuInfoIcon gMoveMenuInfoIcons[] =
// Forward declarations
-void DrawStandardFrame(u8, u8, u8, u8, u8, u8);
-void DrawDialogueFrame(u8, u8, u8, u8, u8, u8);
-void sub_81977BC(u8, u8, u8, u8, u8, u8);
-void sub_8197804(u8, u8, u8, u8, u8, u8);
-void sub_8197BB4(u8, u8, u8, u8, u8, u8);
-void sub_8197E30(u8, u8, u8, u8, u8, u8);
-void DrawWindowBorder(u8, u8, u8, u8, u8, u8);
-void sub_81980A8(u8, u8, u8, u8, u8, u8);
-void task_free_buf_after_copying_tile_data_to_vram(u8 taskId);
+void WindowFunc_DrawStandardFrame(u8, u8, u8, u8, u8, u8);
+void WindowFunc_DrawDialogueFrame(u8, u8, u8, u8, u8, u8);
+void WindowFunc_ClearStdWindowAndFrame(u8, u8, u8, u8, u8, u8);
+void WindowFunc_ClearDialogWindowAndFrame(u8, u8, u8, u8, u8, u8);
+void WindowFunc_DrawDialogFrameWithCustomTileAndPalette(u8, u8, u8, u8, u8, u8);
+void WindowFunc_ClearDialogWindowAndFrameNullPalette(u8, u8, u8, u8, u8, u8);
+void WindowFunc_DrawStdFrameWithCustomTileAndPalette(u8, u8, u8, u8, u8, u8);
+void WindowFunc_ClearStdWindowAndFrameToTransparent(u8, u8, u8, u8, u8, u8);
void sub_8198C78(void);
+void task_free_buf_after_copying_tile_data_to_vram(u8 taskId);
void InitStandardTextBoxWindows(void)
{
@@ -208,43 +208,43 @@ void sub_81973A4(void)
LoadUserWindowBorderGfx(0, STD_WINDOW_BASE_TILE_NUM, STD_WINDOW_PALETTE_NUM * 0x10);
}
-void NewMenuHelpers_DrawDialogueFrame(u8 windowId, bool8 copyToVram)
+void DrawDialogueFrame(u8 windowId, bool8 copyToVram)
{
- CallWindowFunction(windowId, DrawDialogueFrame);
- FillWindowPixelBuffer(windowId, 0x11);
+ CallWindowFunction(windowId, WindowFunc_DrawDialogueFrame);
+ FillWindowPixelBuffer(windowId, PIXEL_FILL(1));
PutWindowTilemap(windowId);
if (copyToVram == TRUE)
CopyWindowToVram(windowId, 3);
}
-void NewMenuHelpers_DrawStdWindowFrame(u8 windowId, bool8 copyToVram)
+void DrawStdWindowFrame(u8 windowId, bool8 copyToVram)
{
- CallWindowFunction(windowId, DrawStandardFrame);
- FillWindowPixelBuffer(windowId, 0x11);
+ CallWindowFunction(windowId, WindowFunc_DrawStandardFrame);
+ FillWindowPixelBuffer(windowId, PIXEL_FILL(1));
PutWindowTilemap(windowId);
if (copyToVram == TRUE)
CopyWindowToVram(windowId, 3);
}
-void sub_8197434(u8 windowId, bool8 copyToVram)
+void ClearDialogWindowAndFrame(u8 windowId, bool8 copyToVram)
{
- CallWindowFunction(windowId, sub_8197804);
- FillWindowPixelBuffer(windowId, 0x11);
+ CallWindowFunction(windowId, WindowFunc_ClearDialogWindowAndFrame);
+ FillWindowPixelBuffer(windowId, PIXEL_FILL(1));
ClearWindowTilemap(windowId);
if (copyToVram == TRUE)
CopyWindowToVram(windowId, 3);
}
-void sub_819746C(u8 windowId, bool8 copyToVram)
+void ClearStdWindowAndFrame(u8 windowId, bool8 copyToVram)
{
- CallWindowFunction(windowId, sub_81977BC);
- FillWindowPixelBuffer(windowId, 0x11);
+ CallWindowFunction(windowId, WindowFunc_ClearStdWindowAndFrame);
+ FillWindowPixelBuffer(windowId, PIXEL_FILL(1));
ClearWindowTilemap(windowId);
if (copyToVram == TRUE)
CopyWindowToVram(windowId, 3);
}
-void DrawStandardFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum)
+void WindowFunc_DrawStandardFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum)
{
int i;
@@ -311,7 +311,7 @@ void DrawStandardFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height
STD_WINDOW_PALETTE_NUM);
}
-void DrawDialogueFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum)
+void WindowFunc_DrawDialogueFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum)
{
FillBgTilemapBufferRect(bg,
DLG_WINDOW_BASE_TILE_NUM + 1,
@@ -406,25 +406,25 @@ void DrawDialogueFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height
DLG_WINDOW_PALETTE_NUM);
}
-void sub_81977BC(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum)
+void WindowFunc_ClearStdWindowAndFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum)
{
FillBgTilemapBufferRect(bg, 0, tilemapLeft - 1, tilemapTop - 1, width + 2, height + 2, STD_WINDOW_PALETTE_NUM);
}
-void sub_8197804(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum)
+void WindowFunc_ClearDialogWindowAndFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum)
{
FillBgTilemapBufferRect(bg, 0, tilemapLeft - 3, tilemapTop - 1, width + 6, height + 2, STD_WINDOW_PALETTE_NUM);
}
void SetStandardWindowBorderStyle(u8 windowId, bool8 copyToVram)
{
- SetWindowBorderStyle(windowId, copyToVram, STD_WINDOW_BASE_TILE_NUM, STD_WINDOW_PALETTE_NUM);
+ DrawStdFrameWithCustomTileAndPalette(windowId, copyToVram, STD_WINDOW_BASE_TILE_NUM, STD_WINDOW_PALETTE_NUM);
}
void sub_819786C(u8 windowId, bool8 copyToVram)
{
LoadMessageBoxGfx(windowId, DLG_WINDOW_BASE_TILE_NUM, DLG_WINDOW_PALETTE_NUM * 0x10);
- sub_8197B1C(windowId, copyToVram, DLG_WINDOW_BASE_TILE_NUM, 0xF);
+ DrawDialogFrameWithCustomTileAndPalette(windowId, copyToVram, DLG_WINDOW_BASE_TILE_NUM, 0xF);
}
void sub_819789C(void)
@@ -456,12 +456,12 @@ void DisplayItemMessageOnField(u8 taskId, const u8 *string, TaskFunc callback)
CopyWindowToVram(0, 3);
}
-void DisplayYesNoMenu(void)
+void DisplayYesNoMenuDefaultYes(void)
{
CreateYesNoMenu(&sYesNo_WindowTemplates, STD_WINDOW_BASE_TILE_NUM, STD_WINDOW_PALETTE_NUM, 0);
}
-void sub_8197948(u8 initialCursorPos)
+void DisplayYesNoMenuWithDefault(u8 initialCursorPos)
{
CreateYesNoMenu(&sYesNo_WindowTemplates, STD_WINDOW_BASE_TILE_NUM, STD_WINDOW_PALETTE_NUM, initialCursorPos);
}
@@ -547,29 +547,30 @@ void sub_8197AE8(bool8 copyToVram)
CopyBgTilemapBufferToVram(0);
}
-void sub_8197B1C(u8 windowId, bool8 copyToVram, u16 tileNum, u8 paletteNum)
+void DrawDialogFrameWithCustomTileAndPalette(u8 windowId, bool8 copyToVram, u16 tileNum, u8 paletteNum)
{
sTileNum = tileNum;
sPaletteNum = paletteNum;
- CallWindowFunction(windowId, sub_8197BB4);
- FillWindowPixelBuffer(windowId, 0x11);
+ CallWindowFunction(windowId, WindowFunc_DrawDialogFrameWithCustomTileAndPalette);
+ FillWindowPixelBuffer(windowId, PIXEL_FILL(1));
PutWindowTilemap(windowId);
if (copyToVram == TRUE)
CopyWindowToVram(windowId, 3);
}
-void sub_8197B64(u8 windowId, bool8 copyToVram, u16 tileNum)
+// Never used.
+void DrawDialogFrameWithCustomTile(u8 windowId, bool8 copyToVram, u16 tileNum)
{
sTileNum = tileNum;
sPaletteNum = GetWindowAttribute(windowId, WINDOW_PALETTE_NUM);
- CallWindowFunction(windowId, sub_8197BB4);
- FillWindowPixelBuffer(windowId, 0x11);
+ CallWindowFunction(windowId, WindowFunc_DrawDialogFrameWithCustomTileAndPalette);
+ FillWindowPixelBuffer(windowId, PIXEL_FILL(1));
PutWindowTilemap(windowId);
if (copyToVram == TRUE)
CopyWindowToVram(windowId, 3);
}
-void sub_8197BB4(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum)
+void WindowFunc_DrawDialogFrameWithCustomTileAndPalette(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum)
{
FillBgTilemapBufferRect(bg,
sTileNum + 1,
@@ -664,43 +665,45 @@ void sub_8197BB4(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 p
sPaletteNum);
}
-void sub_8197DF8(u8 windowId, bool8 copyToVram)
+void ClearDialogWindowAndFrameToTransparent(u8 windowId, bool8 copyToVram)
{
- CallWindowFunction(windowId, sub_8197E30);
- FillWindowPixelBuffer(windowId, 0);
+ // The palette slot doesn't matter, since the tiles are transparent.
+ CallWindowFunction(windowId, WindowFunc_ClearDialogWindowAndFrameNullPalette);
+ FillWindowPixelBuffer(windowId, PIXEL_FILL(0));
ClearWindowTilemap(windowId);
if (copyToVram == TRUE)
CopyWindowToVram(windowId, 3);
}
-void sub_8197E30(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum)
+void WindowFunc_ClearDialogWindowAndFrameNullPalette(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum)
{
FillBgTilemapBufferRect(bg, 0, tilemapLeft - 3, tilemapTop - 1, width + 6, height + 2, 0);
}
-void SetWindowBorderStyle(u8 windowId, bool8 copyToVram, u16 baseTileNum, u8 paletteNum)
+void DrawStdFrameWithCustomTileAndPalette(u8 windowId, bool8 copyToVram, u16 baseTileNum, u8 paletteNum)
{
sTileNum = baseTileNum;
sPaletteNum = paletteNum;
- CallWindowFunction(windowId, DrawWindowBorder);
- FillWindowPixelBuffer(windowId, 0x11);
+ CallWindowFunction(windowId, WindowFunc_DrawStdFrameWithCustomTileAndPalette);
+ FillWindowPixelBuffer(windowId, PIXEL_FILL(1));
PutWindowTilemap(windowId);
if (copyToVram == TRUE)
CopyWindowToVram(windowId, 3);
}
-void sub_8197EC8(u8 windowId, bool8 copyToVram, u16 baseTileNum)
+// Never used.
+void DrawStdFrameWithCustomTile(u8 windowId, bool8 copyToVram, u16 baseTileNum)
{
sTileNum = baseTileNum;
sPaletteNum = GetWindowAttribute(windowId, WINDOW_PALETTE_NUM);
- CallWindowFunction(windowId, DrawWindowBorder);
- FillWindowPixelBuffer(windowId, 0x11);
+ CallWindowFunction(windowId, WindowFunc_DrawStdFrameWithCustomTileAndPalette);
+ FillWindowPixelBuffer(windowId, PIXEL_FILL(1));
PutWindowTilemap(windowId);
if (copyToVram == TRUE)
CopyWindowToVram(windowId, 3);
}
-void DrawWindowBorder(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum)
+void WindowFunc_DrawStdFrameWithCustomTileAndPalette(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum)
{
FillBgTilemapBufferRect(bg,
sTileNum + 0,
@@ -760,16 +763,16 @@ void DrawWindowBorder(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height,
sPaletteNum);
}
-void sub_8198070(u8 windowId, bool8 copyToVram)
+void ClearStdWindowAndFrameToTransparent(u8 windowId, bool8 copyToVram)
{
- CallWindowFunction(windowId, sub_81980A8);
- FillWindowPixelBuffer(windowId, 0);
+ CallWindowFunction(windowId, WindowFunc_ClearStdWindowAndFrameToTransparent);
+ FillWindowPixelBuffer(windowId, PIXEL_FILL(0));
ClearWindowTilemap(windowId);
if (copyToVram == TRUE)
CopyWindowToVram(windowId, 3);
}
-void sub_81980A8(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum)
+void WindowFunc_ClearStdWindowAndFrameToTransparent(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum)
{
FillBgTilemapBufferRect(bg, 0, tilemapLeft - 1, tilemapTop - 1, width + 2, height + 2, 0);
}
@@ -809,7 +812,7 @@ void sub_8198180(const u8 *string, u8 a2, bool8 copyToVram)
if (sWindowId != 0xFF)
{
PutWindowTilemap(sWindowId);
- FillWindowPixelBuffer(sWindowId, 0xFF);
+ FillWindowPixelBuffer(sWindowId, PIXEL_FILL(15));
width = GetStringWidth(0, string, 0);
AddTextPrinterParameterized3(sWindowId,
0,
@@ -843,7 +846,7 @@ void sub_8198204(const u8 *string, const u8 *string2, u8 a3, u8 a4, bool8 copyTo
color[2] = 2;
}
PutWindowTilemap(sWindowId);
- FillWindowPixelBuffer(sWindowId, 0xFF);
+ FillWindowPixelBuffer(sWindowId, PIXEL_FILL(15));
if (string2 != NULL)
{
width = GetStringWidth(0, string2, 0);
@@ -871,7 +874,7 @@ void sub_81982F0(void)
{
if (sWindowId != 0xFF)
{
- FillWindowPixelBuffer(sWindowId, 0xFF);
+ FillWindowPixelBuffer(sWindowId, PIXEL_FILL(15));
CopyWindowToVram(sWindowId, 3);
}
}
@@ -880,7 +883,7 @@ void sub_8198314(void)
{
if (sWindowId != 0xFF)
{
- FillWindowPixelBuffer(sWindowId, 0);
+ FillWindowPixelBuffer(sWindowId, PIXEL_FILL(0));
ClearWindowTilemap(sWindowId);
CopyWindowToVram(sWindowId, 3);
RemoveWindow(sWindowId);
@@ -929,7 +932,7 @@ void RedrawMenuCursor(u8 oldPos, u8 newPos)
width = GetMenuCursorDimensionByFont(sMenu.fontId, 0);
height = GetMenuCursorDimensionByFont(sMenu.fontId, 1);
- FillWindowPixelRect(sMenu.windowId, 0x11, sMenu.left, sMenu.optionHeight * oldPos + sMenu.top, width, height);
+ FillWindowPixelRect(sMenu.windowId, PIXEL_FILL(1), sMenu.left, sMenu.optionHeight * oldPos + sMenu.top, width, height);
AddTextPrinterParameterized(sMenu.windowId, sMenu.fontId, gText_SelectorArrow3, sMenu.left, sMenu.optionHeight * newPos + sMenu.top, 0, 0);
}
@@ -1173,7 +1176,7 @@ void sub_8198AF8(const struct WindowTemplate *window, u8 fontId, u8 left, u8 top
struct TextPrinterTemplate printer;
sYesNoWindowId = AddWindow(window);
- SetWindowBorderStyle(sYesNoWindowId, TRUE, baseTileNum, paletteNum);
+ DrawStdFrameWithCustomTileAndPalette(sYesNoWindowId, TRUE, baseTileNum, paletteNum);
printer.currentChar = gText_YesNo;
printer.windowId = sYesNoWindowId;
@@ -1209,7 +1212,7 @@ s8 Menu_ProcessInputNoWrapClearOnChoose(void)
void sub_8198C78(void)
{
- sub_8198070(sYesNoWindowId, TRUE);
+ ClearStdWindowAndFrameToTransparent(sYesNoWindowId, TRUE);
RemoveWindow(sYesNoWindowId);
}
@@ -1308,7 +1311,7 @@ void sub_8199060(u8 oldCursorPos, u8 newCursorPos)
u8 xPos = (oldCursorPos % sMenu.horizontalCount) * sMenu.optionWidth + sMenu.left;
u8 yPos = (oldCursorPos / sMenu.horizontalCount) * sMenu.optionHeight + sMenu.top;
FillWindowPixelRect(sMenu.windowId,
- 0x11,
+ PIXEL_FILL(1),
xPos,
yPos,
cursorWidth,
@@ -1638,7 +1641,7 @@ void CreateYesNoMenu(const struct WindowTemplate *window, u16 baseTileNum, u8 pa
struct TextPrinterTemplate printer;
sYesNoWindowId = AddWindow(window);
- SetWindowBorderStyle(sYesNoWindowId, TRUE, baseTileNum, paletteNum);
+ DrawStdFrameWithCustomTileAndPalette(sYesNoWindowId, TRUE, baseTileNum, paletteNum);
printer.currentChar = gText_YesNo;
printer.windowId = sYesNoWindowId;
diff --git a/src/menu_helpers.c b/src/menu_helpers.c
index 1f9979eca..3fb5ca40d 100644
--- a/src/menu_helpers.c
+++ b/src/menu_helpers.c
@@ -127,7 +127,7 @@ void SetVBlankHBlankCallbacksToNull(void)
void DisplayMessageAndContinueTask(u8 taskId, u8 windowId, u16 arg2, u8 arg3, u8 fontId, u8 textSpeed, const u8 *string, void *taskFunc)
{
gUnknown_0203A140 = windowId;
- sub_8197B1C(windowId, TRUE, arg2, arg3);
+ DrawDialogFrameWithCustomTileAndPalette(windowId, TRUE, arg2, arg3);
if (string != gStringVar4)
StringExpandPlaceholders(gStringVar4, string);
diff --git a/src/mirage_tower.c b/src/mirage_tower.c
index a8dd5d9de..4f5834db1 100644
--- a/src/mirage_tower.c
+++ b/src/mirage_tower.c
@@ -317,7 +317,7 @@ void SetMirageTowerVisibility(void)
u16 rand;
bool8 visible;
- if (VarGet(VAR_0x40CB))
+ if (VarGet(VAR_ROUTE_111_STATE))
{
FlagClear(FLAG_MIRAGE_TOWER_VISIBLE);
return;
diff --git a/src/money.c b/src/money.c
index faf830637..4ff8086ea 100644
--- a/src/money.c
+++ b/src/money.c
@@ -154,7 +154,7 @@ void PrintMoneyAmount(u8 windowId, u8 x, u8 y, int amount, u8 speed)
void PrintMoneyAmountInMoneyBoxWithBorder(u8 windowId, u16 tileStart, u8 pallete, int amount)
{
- SetWindowBorderStyle(windowId, FALSE, tileStart, pallete);
+ DrawStdFrameWithCustomTileAndPalette(windowId, FALSE, tileStart, pallete);
PrintMoneyAmountInMoneyBox(windowId, amount, 0);
}
@@ -169,7 +169,7 @@ void DrawMoneyBox(int amount, u8 x, u8 y)
SetWindowTemplateFields(&template, 0, x + 1, y + 1, 10, 2, 15, 8);
sMoneyBoxWindowId = AddWindow(&template);
- FillWindowPixelBuffer(sMoneyBoxWindowId, 0);
+ FillWindowPixelBuffer(sMoneyBoxWindowId, PIXEL_FILL(0));
PutWindowTilemap(sMoneyBoxWindowId);
CopyWindowToVram(sMoneyBoxWindowId, 1);
PrintMoneyAmountInMoneyBoxWithBorder(sMoneyBoxWindowId, 0x214, 14, amount);
@@ -179,7 +179,7 @@ void DrawMoneyBox(int amount, u8 x, u8 y)
void HideMoneyBox(void)
{
RemoveMoneyLabelObject();
- sub_8198070(sMoneyBoxWindowId, FALSE);
+ ClearStdWindowAndFrameToTransparent(sMoneyBoxWindowId, FALSE);
CopyWindowToVram(sMoneyBoxWindowId, 2);
RemoveWindow(sMoneyBoxWindowId);
}
diff --git a/src/mystery_event_menu.c b/src/mystery_event_menu.c
index 2058bb81f..ad4a2e692 100644
--- a/src/mystery_event_menu.c
+++ b/src/mystery_event_menu.c
@@ -90,7 +90,7 @@ void CB2_InitMysteryEventMenu(void)
DeactivateAllTextPrinters();
for (i = 0; i < 2; i++)
- FillWindowPixelBuffer(i, 0);
+ FillWindowPixelBuffer(i, PIXEL_FILL(0));
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x1E, 0x14);
LoadUserWindowBorderGfx(0, 1u, 0xD0u);
@@ -133,7 +133,7 @@ static void CB2_MysteryEventMenu(void)
switch (gMain.state)
{
case 0:
- SetWindowBorderStyle(0, 1, 1, 0xD);
+ DrawStdFrameWithCustomTileAndPalette(0, 1, 1, 0xD);
PutWindowTilemap(0);
CopyWindowToVram(0, 3);
ShowBg(0);
@@ -180,7 +180,7 @@ static void CB2_MysteryEventMenu(void)
{
PlaySE(SE_SELECT);
CheckShouldAdvanceLinkState();
- SetWindowBorderStyle(1, 1, 1, 0xD);
+ DrawStdFrameWithCustomTileAndPalette(1, 1, 1, 0xD);
PrintMysteryMenuText(1, gText_LoadingEvent, 1, 2, 0);
PutWindowTilemap(1);
CopyWindowToVram(1, 3);
@@ -313,6 +313,6 @@ static void PrintMysteryMenuText(u8 windowId, const u8 *text, u8 x, u8 y, s32 sp
textColor[1] = 2;
textColor[2] = 3;
- FillWindowPixelBuffer(windowId, (textColor[0]) | (textColor[0] << 4));
+ FillWindowPixelBuffer(windowId, PIXEL_FILL(textColor[0]));
AddTextPrinterParameterized4(windowId, 1, x, y, letterSpacing, lineSpacing, textColor, speed, text);
}
diff --git a/src/naming_screen.c b/src/naming_screen.c
index c310ceb9f..22bbb84d7 100644
--- a/src/naming_screen.c
+++ b/src/naming_screen.c
@@ -557,7 +557,7 @@ static void DisplaySentToPCMessage(void)
stringToDisplay++;
StringExpandPlaceholders(gStringVar4, gUnknown_0858BDB8[stringToDisplay]);
- NewMenuHelpers_DrawDialogueFrame(0, 0);
+ DrawDialogueFrame(0, 0);
gTextFlags.canABSpeedUpPrint = TRUE;
AddTextPrinterParameterized2(0, 1, gStringVar4, GetPlayerTextSpeedDelay(), 0, 2, 1, 3);
CopyWindowToVram(0, 3);
@@ -1474,7 +1474,7 @@ static void HandleDpadMovement(struct Task *task)
static void sub_80E4894(void)
{
- FillWindowPixelBuffer(gNamingScreenData->windows[3], 0x11);
+ FillWindowPixelBuffer(gNamingScreenData->windows[3], PIXEL_FILL(1));
AddTextPrinterParameterized(gNamingScreenData->windows[3], 1, gNamingScreenData->template->title, 8, 1, 0, 0);
PutWindowTilemap(gNamingScreenData->windows[3]);
}
@@ -1485,7 +1485,7 @@ static void sub_80E48E8(void)
StringCopy(buffer, gSpeciesNames[gNamingScreenData->monSpecies]);
StringAppendN(buffer, gNamingScreenData->template->title, 15);
- FillWindowPixelBuffer(gNamingScreenData->windows[3], 0x11);
+ FillWindowPixelBuffer(gNamingScreenData->windows[3], PIXEL_FILL(1));
AddTextPrinterParameterized(gNamingScreenData->windows[3], 1, buffer, 8, 1, 0, 0);
PutWindowTilemap(gNamingScreenData->windows[3]);
}
@@ -1672,7 +1672,7 @@ static void sub_80E4D10(void)
u8 maxChars = gNamingScreenData->template->maxChars;
u16 unk = gNamingScreenData->inputCharBaseXPos - 0x40;
- FillWindowPixelBuffer(gNamingScreenData->windows[2], 0x11);
+ FillWindowPixelBuffer(gNamingScreenData->windows[2], PIXEL_FILL(1));
for (i = 0; i < maxChars; i++)
{
@@ -1704,7 +1704,9 @@ static const struct TextColorThing sUnkColorStruct =
static const u8 sFillValues[3] =
{
- 0xEE, 0xDD, 0xFF
+ PIXEL_FILL(0xE),
+ PIXEL_FILL(0xD),
+ PIXEL_FILL(0xF)
};
static const u8 *const sUnkColors[3] =
@@ -1766,7 +1768,7 @@ static void sub_80E4EF0(void)
{
const u8 color[3] = { 15, 1, 2 };
- FillWindowPixelBuffer(gNamingScreenData->windows[4], 0xFF);
+ FillWindowPixelBuffer(gNamingScreenData->windows[4], PIXEL_FILL(15));
AddTextPrinterParameterized3(gNamingScreenData->windows[4], 0, 2, 1, color, 0, gText_MoveOkBack);
PutWindowTilemap(gNamingScreenData->windows[4]);
CopyWindowToVram(gNamingScreenData->windows[4], 3);
diff --git a/src/option_menu.c b/src/option_menu.c
index caeb3d5da..2fc0d6f3e 100644
--- a/src/option_menu.c
+++ b/src/option_menu.c
@@ -619,7 +619,7 @@ static void ButtonMode_DrawChoices(u8 selection)
static void DrawTextOption(void)
{
- FillWindowPixelBuffer(WIN_TEXT_OPTION, 0x11);
+ FillWindowPixelBuffer(WIN_TEXT_OPTION, PIXEL_FILL(1));
AddTextPrinterParameterized(WIN_TEXT_OPTION, 1, gText_Option, 8, 1, TEXT_SPEED_FF, NULL);
CopyWindowToVram(WIN_TEXT_OPTION, 3);
}
@@ -628,7 +628,7 @@ static void DrawOptionMenuTexts(void)
{
u8 i;
- FillWindowPixelBuffer(WIN_OPTIONS, 0x11);
+ FillWindowPixelBuffer(WIN_OPTIONS, PIXEL_FILL(1));
for (i = 0; i < MENUITEM_COUNT; i++)
{
AddTextPrinterParameterized(WIN_OPTIONS, 1, sOptionMenuItemsNames[i], 8, (i * 16) + 1, TEXT_SPEED_FF, NULL);
diff --git a/src/overworld.c b/src/overworld.c
index be94a694b..0ff8d5b7f 100644
--- a/src/overworld.c
+++ b/src/overworld.c
@@ -430,10 +430,12 @@ static void Overworld_ResetStateAfterWhiteOut(void)
FlagClear(FLAG_SYS_SAFARI_MODE);
FlagClear(FLAG_SYS_USE_STRENGTH);
FlagClear(FLAG_SYS_USE_FLASH);
- if (VarGet(VAR_0x4039) == 1)
+ // If you were defeated by Kyogre/Groudon and the step counter has
+ // maxed out, end the unusual weather.
+ if (VarGet(VAR_SHOULD_END_UNUSUAL_WEATHER) == 1)
{
- VarSet(VAR_0x4039, 0);
- VarSet(VAR_0x4037, 0);
+ VarSet(VAR_SHOULD_END_UNUSUAL_WEATHER, 0);
+ VarSet(VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_NONE);
}
}
@@ -698,7 +700,7 @@ void UpdateEscapeWarp(s16 x, s16 y)
{
u8 currMapType = GetCurrentMapType();
u8 destMapType = GetMapTypeByGroupAndId(sWarpDestination.mapGroup, sWarpDestination.mapNum);
- if (is_map_type_1_2_3_5_or_6(currMapType) && is_map_type_1_2_3_5_or_6(destMapType) != TRUE)
+ if (IsMapTypeOutdoors(currMapType) && IsMapTypeOutdoors(destMapType) != TRUE)
SetEscapeWarp(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1, x - 7, y - 6);
}
@@ -843,8 +845,8 @@ void LoadMapFromCameraTransition(u8 mapGroup, u8 mapNum)
static void mli0_load_map(u32 a1)
{
- bool8 v2;
- bool8 indoors;
+ bool8 isOutdoors;
+ bool8 isIndoors;
LoadCurrentMapData();
if (!(sUnknown_020322D8 & 1))
@@ -857,8 +859,8 @@ static void mli0_load_map(u32 a1)
LoadEventObjTemplatesFromHeader();
}
- v2 = is_map_type_1_2_3_5_or_6(gMapHeader.mapType);
- indoors = Overworld_MapTypeIsIndoors(gMapHeader.mapType);
+ isOutdoors = IsMapTypeOutdoors(gMapHeader.mapType);
+ isIndoors = IsMapTypeIndoors(gMapHeader.mapType);
sub_80EB218();
TrySetMapSaveWarpStatus();
@@ -870,7 +872,7 @@ static void mli0_load_map(u32 a1)
DoTimeBasedEvents();
SetSav1WeatherFromCurrMapHeader();
ChooseAmbientCrySpecies();
- if (v2)
+ if (isOutdoors)
FlagClear(FLAG_SYS_USE_FLASH);
SetDefaultFlashLevel();
Overworld_ClearSavedMusic();
@@ -884,7 +886,7 @@ static void mli0_load_map(u32 a1)
else
InitMap();
- if (a1 != 1 && indoors)
+ if (a1 != 1 && isIndoors)
{
UpdateTVScreensOnMap(gBackupMapLayout.width, gBackupMapLayout.height);
sub_80E9238(1);
@@ -945,7 +947,7 @@ static u8 GetAdjustedInitialTransitionFlags(struct InitialPlayerAvatarState *pla
static u8 GetAdjustedInitialDirection(struct InitialPlayerAvatarState *playerStruct, u8 transitionFlags, u16 metatileBehavior, u8 mapType)
{
- if (FlagGet(FLAG_SYS_CRUISE_MODE) && mapType == MAP_TYPE_6)
+ if (FlagGet(FLAG_SYS_CRUISE_MODE) && mapType == MAP_TYPE_OCEAN_ROUTE)
return DIR_EAST;
else if (MetatileBehavior_IsDeepSouthWarp(metatileBehavior) == TRUE)
return DIR_NORTH;
@@ -1038,7 +1040,7 @@ static bool16 ShouldLegendaryMusicPlayAtLocation(struct WarpData *warp)
case MAP_NUM(ROUTE128):
return TRUE;
default:
- if (VarGet(VAR_0x405E) < 4)
+ if (VarGet(VAR_RAYQUAZA_STATE) < 4)
return FALSE;
switch (warp->mapNum)
{
@@ -1054,7 +1056,7 @@ static bool16 ShouldLegendaryMusicPlayAtLocation(struct WarpData *warp)
static bool16 NoMusicInSotopolisWithLegendaries(struct WarpData *warp)
{
- if (VarGet(VAR_0x40CA) != 1)
+ if (VarGet(VAR_SKY_PILLAR_STATE) != 1)
return FALSE;
else if (warp->mapGroup != MAP_GROUP(SOOTOPOLIS_CITY))
return FALSE;
@@ -1079,9 +1081,9 @@ static bool16 IsInfiltratedWeatherInstitute(struct WarpData *warp)
static bool16 IsInflitratedSpaceCenter(struct WarpData *warp)
{
- if (VarGet(VAR_0x405D) == 0)
+ if (VarGet(VAR_MOSSDEEP_STATE) == 0)
return FALSE;
- else if (VarGet(VAR_0x405D) > 2)
+ else if (VarGet(VAR_MOSSDEEP_STATE) > 2)
return FALSE;
else if (warp->mapGroup != MAP_GROUP(MOSSDEEP_CITY_SPACE_CENTER_1F))
return FALSE;
@@ -1219,7 +1221,7 @@ void Overworld_ChangeMusicTo(u16 newMusic)
u8 GetMapMusicFadeoutSpeed(void)
{
const struct MapHeader *mapHeader = GetDestinationWarpMapHeader();
- if (Overworld_MapTypeIsIndoors(mapHeader->mapType) == TRUE)
+ if (IsMapTypeIndoors(mapHeader->mapType) == TRUE)
return 2;
else
return 4;
@@ -1232,7 +1234,7 @@ void TryFadeOutOldMapMusic(void)
if (FlagGet(FLAG_SPECIAL_FLAG_0x4001) != TRUE && warpMusic != GetCurrentMapMusic())
{
if (currentMusic == MUS_NAMINORI
- && VarGet(VAR_0x40CA) == 2
+ && VarGet(VAR_SKY_PILLAR_STATE) == 2
&& gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(SOOTOPOLIS_CITY)
&& gSaveBlock1Ptr->location.mapNum == MAP_NUM(SOOTOPOLIS_CITY)
&& sWarpDestination.mapGroup == MAP_GROUP(SOOTOPOLIS_CITY)
@@ -1350,13 +1352,13 @@ u8 GetLastUsedWarpMapType(void)
return GetMapTypeByWarpData(&gLastUsedWarp);
}
-bool8 is_map_type_1_2_3_5_or_6(u8 mapType)
+bool8 IsMapTypeOutdoors(u8 mapType)
{
if (mapType == MAP_TYPE_ROUTE
|| mapType == MAP_TYPE_TOWN
|| mapType == MAP_TYPE_UNDERWATER
|| mapType == MAP_TYPE_CITY
- || mapType == MAP_TYPE_6)
+ || mapType == MAP_TYPE_OCEAN_ROUTE)
return TRUE;
else
return FALSE;
@@ -1366,14 +1368,14 @@ bool8 Overworld_MapTypeAllowsTeleportAndFly(u8 mapType)
{
if (mapType == MAP_TYPE_ROUTE
|| mapType == MAP_TYPE_TOWN
- || mapType == MAP_TYPE_6
+ || mapType == MAP_TYPE_OCEAN_ROUTE
|| mapType == MAP_TYPE_CITY)
return TRUE;
else
return FALSE;
}
-bool8 Overworld_MapTypeIsIndoors(u8 mapType)
+bool8 IsMapTypeIndoors(u8 mapType)
{
if (mapType == MAP_TYPE_INDOOR
|| mapType == MAP_TYPE_SECRET_BASE)
diff --git a/src/party_menu.c b/src/party_menu.c
index 10665ad9e..525063326 100755
--- a/src/party_menu.c
+++ b/src/party_menu.c
@@ -2754,7 +2754,7 @@ static void sub_81B1B8C(u8 taskId)
{
if (gTasks[taskId].data[0] == 0)
{
- sub_8198070(6, 0);
+ ClearStdWindowAndFrameToTransparent(6, 0);
ClearWindowTilemap(6);
}
DestroyTask(taskId);
@@ -2779,7 +2779,7 @@ static void sub_81B1C1C(u8 taskId)
{
if (sub_81B1BD4() != TRUE)
{
- sub_8198070(6, 0);
+ ClearStdWindowAndFrameToTransparent(6, 0);
ClearWindowTilemap(6);
if (sub_81221AC() == TRUE)
{
@@ -3109,7 +3109,7 @@ static void sub_81B239C(u8 a)
}
DeactivateAllTextPrinters();
for (i = 0; i < PARTY_SIZE; i++)
- FillWindowPixelBuffer(i, 0);
+ FillWindowPixelBuffer(i, PIXEL_FILL(0));
LoadUserWindowBorderGfx(0, 0x4F, 0xD0);
LoadPalette(GetOverworldTextboxPalettePtr(), 0xE0, 0x20);
LoadPalette(gUnknown_0860F074, 0xF0, 0x20);
@@ -3127,7 +3127,7 @@ static void sub_81B2428(bool8 a)
if (a == TRUE)
{
firstWindowId = AddWindow(&gUnknown_08615918);
- FillWindowPixelBuffer(firstWindowId, 0);
+ FillWindowPixelBuffer(firstWindowId, PIXEL_FILL(0));
mainOffset = GetStringCenterAlignXOffset(0, gMenuText_Confirm, 48);
AddTextPrinterParameterized4(firstWindowId, 0, mainOffset, 1, 0, 0, gUnknown_086157FC[0], -1, gMenuText_Confirm);
PutWindowTilemap(firstWindowId);
@@ -3140,7 +3140,7 @@ static void sub_81B2428(bool8 a)
windowId = AddWindow(&gUnknown_08615908);
offset = 3;
}
- FillWindowPixelBuffer(windowId, 0);
+ FillWindowPixelBuffer(windowId, PIXEL_FILL(0));
if (gUnknown_0203CEC8.unk8_0 != 10)
{
mainOffset = GetStringCenterAlignXOffset(0, gText_Cancel, 48);
@@ -3480,8 +3480,9 @@ static void DisplayPartyPokemonHPBar(u16 hp, u16 maxhp, struct Struct203CEDC *pt
FillWindowPixelRect(ptr->windowId, gUnknown_08615AB8[0], ptr->unk0->unk4[20], ptr->unk0->unk4[21] + 1, hpFraction, 2);
if (hpFraction != ptr->unk0->unk4[22])
{
- FillWindowPixelRect(ptr->windowId, 13, ptr->unk0->unk4[20] + hpFraction, ptr->unk0->unk4[21], ptr->unk0->unk4[22] - hpFraction, 1);
- FillWindowPixelRect(ptr->windowId, 2, ptr->unk0->unk4[20] + hpFraction, ptr->unk0->unk4[21] + 1, ptr->unk0->unk4[22] - hpFraction, 2);
+ // This appears to be an alternating fill
+ FillWindowPixelRect(ptr->windowId, 0x0D, ptr->unk0->unk4[20] + hpFraction, ptr->unk0->unk4[21], ptr->unk0->unk4[22] - hpFraction, 1);
+ FillWindowPixelRect(ptr->windowId, 0x02, ptr->unk0->unk4[20] + hpFraction, ptr->unk0->unk4[21] + 1, ptr->unk0->unk4[22] - hpFraction, 2);
}
CopyWindowToVram(ptr->windowId, 2);
}
@@ -3502,7 +3503,7 @@ static void sub_81B302C(u8 *ptr)
{
if (*ptr != 0xFF)
{
- sub_8198070(*ptr, 0);
+ ClearStdWindowAndFrameToTransparent(*ptr, 0);
RemoveWindow(*ptr);
*ptr = 0xFF;
schedule_bg_copy_tilemap_to_vram(2);
@@ -3547,7 +3548,7 @@ void display_pokemon_menu_message(u32 stringID)
else if (sub_81B314C() == FALSE)
stringID = 1;
}
- SetWindowBorderStyle(*windowPtr, FALSE, 0x4F, 0xD);
+ DrawStdFrameWithCustomTileAndPalette(*windowPtr, FALSE, 0x4F, 0xD);
StringExpandPlaceholders(gStringVar4, gUnknown_08615AF4[stringID]);
AddTextPrinterParameterized(*windowPtr, 1, gStringVar4, 0, 1, 0, 0);
schedule_bg_copy_tilemap_to_vram(2);
@@ -3597,7 +3598,7 @@ static u8 sub_81B31B0(u8 a)
}
gUnknown_0203CEC4->unkC[0] = AddWindow(&window);
- SetWindowBorderStyle(gUnknown_0203CEC4->unkC[0], FALSE, 0x4F, 13);
+ DrawStdFrameWithCustomTileAndPalette(gUnknown_0203CEC4->unkC[0], FALSE, 0x4F, 13);
if (a == 3)
return gUnknown_0203CEC4->unkC[0];
cursorDimension = GetMenuCursorDimensionByFont(1, 0);
@@ -3617,7 +3618,7 @@ static u8 sub_81B31B0(u8 a)
static void sub_81B3300(const u8 *text)
{
- SetWindowBorderStyle(6, FALSE, 0x4F, 13);
+ DrawStdFrameWithCustomTileAndPalette(6, FALSE, 0x4F, 13);
gTextFlags.canABSpeedUpPrint = TRUE;
AddTextPrinterParameterized2(6, 1, text, GetPlayerTextSpeedDelay(), 0, 2, 1, 3);
}
@@ -3630,7 +3631,7 @@ static void sub_81B334C(void)
static u8 sub_81B3364(void)
{
gUnknown_0203CEC4->unkC[0] = AddWindow(&gUnknown_08615970);
- SetWindowBorderStyle(gUnknown_0203CEC4->unkC[0], FALSE, 0x4F, 13);
+ DrawStdFrameWithCustomTileAndPalette(gUnknown_0203CEC4->unkC[0], FALSE, 0x4F, 13);
return gUnknown_0203CEC4->unkC[0];
}
diff --git a/src/player_pc.c b/src/player_pc.c
index 0d08a5e7b..6e78533e7 100644
--- a/src/player_pc.c
+++ b/src/player_pc.c
@@ -361,14 +361,14 @@ static void PlayerPCProcessMenuInput(u8 taskId)
break;
case MENU_B_PRESSED:
PlaySE(SE_SELECT);
- sub_8198070(data[4], FALSE);
+ ClearStdWindowAndFrameToTransparent(data[4], FALSE);
ClearWindowTilemap(data[4]);
RemoveWindow(data[4]);
schedule_bg_copy_tilemap_to_vram(0);
gTasks[taskId].func = PlayerPC_TurnOff;
break;
default:
- sub_8198070(data[4], FALSE);
+ ClearStdWindowAndFrameToTransparent(data[4], FALSE);
ClearWindowTilemap(data[4]);
RemoveWindow(data[4]);
schedule_bg_copy_tilemap_to_vram(0);
@@ -403,7 +403,7 @@ static void PlayerPC_Mailbox(u8 taskId)
ItemStorage_SetItemAndMailCount(taskId);
if (sub_81D1C44(playerPCItemPageInfo.count) == TRUE)
{
- sub_8197434(0, 0);
+ ClearDialogWindowAndFrame(0, 0);
Mailbox_DrawMailboxMenu(taskId);
gTasks[taskId].func = Mailbox_ProcessInput;
}
@@ -451,7 +451,7 @@ static void InitItemStorageMenu(u8 taskId, u8 var)
static void ItemStorageMenuPrint(const u8 *textPtr)
{
- NewMenuHelpers_DrawDialogueFrame(0, 0);
+ DrawDialogueFrame(0, 0);
AddTextPrinterParameterized(0, 1, textPtr, 0, 1, 0, 0);
}
@@ -506,7 +506,7 @@ void sub_816B31C(void)
void Mailbox_DoRedrawMailboxMenuAfterReturn(void)
{
sub_81973A4();
- NewMenuHelpers_DrawDialogueFrame(0, 1);
+ DrawDialogueFrame(0, 1);
InitItemStorageMenu(CreateTask(ItemStorage_HandleReturnToProcessInput, 0), 1);
pal_fill_black();
}
@@ -560,7 +560,7 @@ static void ItemStorage_WithdrawToss_Helper(u8 taskId, bool8 toss)
FreeAndReserveObjectSpritePalettes();
LoadListMenuArrowsGfx();
sub_8122344(gUnknown_0203BCC4->spriteIds, 7);
- sub_8197434(0,0);
+ ClearDialogWindowAndFrame(0,0);
gTasks[taskId].func = ItemStorage_ProcessWithdrawTossInput;
}
@@ -583,7 +583,7 @@ static void sub_816B4DC(u8 taskId)
{
u16 *data = gTasks[taskId].data;
- sub_8198070(data[4], FALSE);
+ ClearStdWindowAndFrameToTransparent(data[4], FALSE);
ClearWindowTilemap(data[4]);
RemoveWindow(data[4]);
schedule_bg_copy_tilemap_to_vram(0);
@@ -761,7 +761,7 @@ static void Mailbox_MoveToBag(u8 taskId)
static void Mailbox_DrawYesNoBeforeMove(u8 taskId)
{
- DisplayYesNoMenu();
+ DisplayYesNoMenuDefaultYes();
gTasks[taskId].func = Mailbox_MoveToBagYesNoPrompt;
}
@@ -863,7 +863,7 @@ static void Mailbox_NoPokemonForMail(u8 taskId)
static void Mailbox_Cancel(u8 taskId)
{
sub_81D1D04(2);
- sub_8197434(0, 0);
+ ClearDialogWindowAndFrame(0, 0);
Mailbox_DrawMailboxMenu(taskId);
schedule_bg_copy_tilemap_to_vram(0);
gTasks[taskId].func = Mailbox_ProcessInput;
@@ -892,7 +892,7 @@ static u8 sub_816BC7C(u8 a)
if (*windowIdLoc == 0xFF)
{
*windowIdLoc = AddWindow(&gUnknown_085DFF5C[a]);
- SetWindowBorderStyle(*windowIdLoc, FALSE, 0x214, 0xE);
+ DrawStdFrameWithCustomTileAndPalette(*windowIdLoc, FALSE, 0x214, 0xE);
schedule_bg_copy_tilemap_to_vram(0);
}
return *windowIdLoc;
@@ -903,7 +903,7 @@ static void sub_816BCC4(u8 a)
u8 *windowIdLoc = &(gUnknown_0203BCC4->windowIds[a]);
if (*windowIdLoc != 0xFF)
{
- sub_8198070(*windowIdLoc, FALSE);
+ ClearStdWindowAndFrameToTransparent(*windowIdLoc, FALSE);
ClearWindowTilemap(*windowIdLoc);
schedule_bg_copy_tilemap_to_vram(0);
RemoveWindow(*windowIdLoc);
@@ -977,7 +977,7 @@ static void sub_816BEF0(s32 id)
description = (u8 *)ItemId_GetDescription(gSaveBlock1Ptr->pcItems[id].itemId);
else
description = ItemStorage_GetItemPcResponse(ITEMPC_GO_BACK_TO_PREV);
- FillWindowPixelBuffer(windowId, 17);
+ FillWindowPixelBuffer(windowId, PIXEL_FILL(1));
AddTextPrinterParameterized(windowId, 1, description, 0, 1, 0, NULL);
}
@@ -1005,7 +1005,7 @@ static void sub_816BFE0(u8 y, u8 b, u8 speed)
{
u8 windowId = gUnknown_0203BCC4->windowIds[0];
if (b == 0xFF)
- FillWindowPixelRect(windowId, 17, 0, y, GetMenuCursorDimensionByFont(1, 0), GetMenuCursorDimensionByFont(1, 1));
+ FillWindowPixelRect(windowId, PIXEL_FILL(1), 0, y, GetMenuCursorDimensionByFont(1, 0), GetMenuCursorDimensionByFont(1, 1));
else
AddTextPrinterParameterized4(windowId, 1, 0, y, 0, 0, gUnknown_085DFF8C, speed, gText_SelectorArrow2);
}
@@ -1123,7 +1123,7 @@ static const u8* ItemStorage_GetItemPcResponse(u16 itemId)
static void ItemStorage_PrintItemPcResponse(const u8 *string)
{
u8 windowId = gUnknown_0203BCC4->windowIds[1];
- FillWindowPixelBuffer(windowId, 0x11);
+ FillWindowPixelBuffer(windowId, PIXEL_FILL(1));
StringExpandPlaceholders(gStringVar4, string);
AddTextPrinterParameterized(windowId, 1, gStringVar4, 0, 1, 0, NULL);
}
@@ -1170,7 +1170,7 @@ static void ItemStorage_GoBackToPlayerPCMenu_InitStorage(u8 taskId)
data = gTasks[taskId].data;
if (!IsDma3ManagerBusyWithBgCopy())
{
- NewMenuHelpers_DrawDialogueFrame(0, 0);
+ DrawDialogueFrame(0, 0);
if (!data[3])
InitItemStorageMenu(taskId, ITEMPC_MENU_WITHDRAW);
else
diff --git a/src/pokeblock.c b/src/pokeblock.c
index 3fd4f34df..2682754aa 100644
--- a/src/pokeblock.c
+++ b/src/pokeblock.c
@@ -665,7 +665,7 @@ static void HandleInitWindows(void)
for (i = 0; i < ARRAY_COUNT(sWindowTemplatesForPokeblockMenu) - 1; i++)
{
- FillWindowPixelBuffer(i, 0);
+ FillWindowPixelBuffer(i, PIXEL_FILL(0));
}
schedule_bg_copy_tilemap_to_vram(0);
@@ -749,7 +749,7 @@ static void sub_8135FCC(s32 pkblId)
struct Pokeblock *pokeblock;
u16 rectTilemapSrc[2];
- FillWindowPixelBuffer(7, 0);
+ FillWindowPixelBuffer(7, PIXEL_FILL(0));
if (pkblId != LIST_B_PRESSED)
{
@@ -1120,7 +1120,7 @@ static void PutPokeblockOptionsWindow(u8 taskId)
data[1] = 9;
sub_8136418();
- SetWindowBorderStyle(data[1], 0, 1, 0xE);
+ DrawStdFrameWithCustomTileAndPalette(data[1], 0, 1, 0xE);
sub_81995E4(data[1], sPokeblockMenu->optionsNo, sPokeblockMenuActions, sPokeblockMenu->pokeblockOptionsIds);
InitMenuInUpperLeftCornerPlaySoundWhenAPressed(data[1], sPokeblockMenu->optionsNo, 0);
PutWindowTilemap(data[1]);
@@ -1173,7 +1173,7 @@ static void PokeblockAction_Toss(u8 taskId)
{
s16 *data = gTasks[taskId].data;
- sub_8198070(data[1], FALSE);
+ ClearStdWindowAndFrameToTransparent(data[1], FALSE);
StringCopy(gStringVar1, gPokeblockNames[gSaveBlock1Ptr->pokeblocks[gSpecialVar_ItemId].color]);
StringExpandPlaceholders(gStringVar4, gText_ThrowAwayVar1);
DisplayMessageAndContinueTask(taskId, 10, 10, 13, 1, GetPlayerTextSpeedDelay(), gStringVar4, CreateTossPokeblockYesNoMenu);
@@ -1219,7 +1219,7 @@ static void HandleErasePokeblock(u8 taskId)
static void TossPokeblockChoice_No(u8 taskId)
{
- sub_8197DF8(10, FALSE);
+ ClearDialogWindowAndFrameToTransparent(10, FALSE);
schedule_bg_copy_tilemap_to_vram(1);
sub_81363BC();
gTasks[taskId].func = Task_HandlePokeblockMenuInput;
@@ -1266,7 +1266,7 @@ static void PokeblockAction_Cancel(u8 taskId)
{
s16 *data = gTasks[taskId].data;
- sub_8198070(data[1], FALSE);
+ ClearStdWindowAndFrameToTransparent(data[1], FALSE);
schedule_bg_copy_tilemap_to_vram(1);
sub_81363BC();
gTasks[taskId].func = Task_HandlePokeblockMenuInput;
diff --git a/src/pokeblock_feed.c b/src/pokeblock_feed.c
index 42a71ad52..da803f454 100644
--- a/src/pokeblock_feed.c
+++ b/src/pokeblock_feed.c
@@ -579,7 +579,7 @@ static bool8 TransitionToPokeblockFeedScene(void)
gMain.state++;
break;
case 10:
- SetWindowBorderStyle(0, 1, 1, 14);
+ DrawStdFrameWithCustomTileAndPalette(0, 1, 1, 14);
gMain.state++;
break;
case 11:
@@ -702,7 +702,7 @@ static void HandleInitWindows(void)
DeactivateAllTextPrinters();
LoadUserWindowBorderGfx(0, 1, 0xE0);
LoadPalette(gUnknown_0860F074, 0xF0, 0x20);
- FillWindowPixelBuffer(0, 0);
+ FillWindowPixelBuffer(0, PIXEL_FILL(0));
PutWindowTilemap(0);
schedule_bg_copy_tilemap_to_vram(0);
}
diff --git a/src/pokedex.c b/src/pokedex.c
index 805412c85..4bf8dff6d 100644
--- a/src/pokedex.c
+++ b/src/pokedex.c
@@ -2152,7 +2152,7 @@ static void CreateCaughtBall(u16 a, u8 x, u8 y, u16 unused)
if (a)
BlitBitmapToWindow(0, gUnknown_0855D2BE, x * 8, y * 8, 8, 16);
else
- FillWindowPixelRect(0, 0, x * 8, y * 8, 8, 16);
+ FillWindowPixelRect(0, PIXEL_FILL(0), x * 8, y * 8, 8, 16);
}
static u8 CreateMonName(u16 num, u8 left, u8 top)
@@ -2170,7 +2170,7 @@ static u8 CreateMonName(u16 num, u8 left, u8 top)
void sub_80BD28C(u8 x, u8 y, u16 unused)
{
- FillWindowPixelRect(0, 0, x * 8, y * 8, 0x60, 16);
+ FillWindowPixelRect(0, PIXEL_FILL(0), x * 8, y * 8, 0x60, 16);
}
static void CreateInitialPokemonSprites(u16 selectedMon, u16 b)
@@ -2927,7 +2927,7 @@ void sub_80BEA24(u8 taskId)
case 1:
DecompressAndLoadBgGfxUsingHeap(3, gPokedexMenu_Gfx, 0x2000, 0, 0);
CopyToBgTilemapBuffer(3, gPokedexTilemap_DescriptionScreen, 0, 0);
- FillWindowPixelBuffer(0, 0);
+ FillWindowPixelBuffer(0, PIXEL_FILL(0));
PutWindowTilemap(0);
PutWindowTilemap(1);
sub_80C0D30(1, sPokedexListItem->dexNum);
@@ -3222,7 +3222,7 @@ void sub_80BF250(u8 taskId)
case 1:
DecompressAndLoadBgGfxUsingHeap(3, &gPokedexMenu_Gfx, 0x2000, 0, 0);
CopyToBgTilemapBuffer(3, &gPokedexTilemap_CryScreen, 0, 0);
- FillWindowPixelBuffer(0, 0);
+ FillWindowPixelBuffer(0, PIXEL_FILL(0));
PutWindowTilemap(0);
PutWindowTilemap(3);
PutWindowTilemap(2);
@@ -3416,7 +3416,7 @@ void sub_80BF82C(u8 taskId)
case 1:
DecompressAndLoadBgGfxUsingHeap(3, gPokedexMenu_Gfx, 0x2000, 0, 0);
CopyToBgTilemapBuffer(3, gPokedexTilemap_SizeScreen, 0, 0);
- FillWindowPixelBuffer(0, 0);
+ FillWindowPixelBuffer(0, PIXEL_FILL(0));
PutWindowTilemap(0);
gMain.state++;
break;
@@ -3766,7 +3766,7 @@ void sub_80BFE38(u8 taskId)
case 1:
DecompressAndLoadBgGfxUsingHeap(3, gPokedexMenu_Gfx, 0x2000, 0, 0);
CopyToBgTilemapBuffer(3, gPokedexTilemap_DescriptionScreen, 0, 0);
- FillWindowPixelBuffer(0, 0);
+ FillWindowPixelBuffer(0, PIXEL_FILL(0));
PutWindowTilemap(0);
PutWindowTilemap(1);
sub_80C0D30(1, gTasks[taskId].data[1]);
@@ -4784,7 +4784,7 @@ void sub_80C1270(const u8 *str, u32 left, u32 top)
void sub_80C12B0(u32 x, u32 y, u32 width, u32 height)
{
- FillWindowPixelRect(0, 0, x, y, width, height);
+ FillWindowPixelRect(0, PIXEL_FILL(0), x, y, width, height);
}
void sub_80C12E0(u8 taskId)
diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c
index cdfc4ba6b..c5d40877b 100644
--- a/src/pokemon_storage_system.c
+++ b/src/pokemon_storage_system.c
@@ -1552,7 +1552,7 @@ void sub_80C6D80(const u8 *string, void *dst, u8 arg2, u8 arg3, s32 arg4)
winTemplate.width = 24;
winTemplate.height = 2;
windowId = AddWindow(&winTemplate);
- FillWindowPixelBuffer(windowId, (arg3 << 4) | arg3);
+ FillWindowPixelBuffer(windowId, PIXEL_FILL(arg3));
tileData1 = (u8*) GetWindowAttribute(windowId, WINDOW_TILE_DATA);
tileData2 = (winTemplate.width * 32) + tileData1;
@@ -1599,7 +1599,7 @@ void sub_80C6EAC(const u8 *string, void *dst, u16 arg2, u8 arg3, u8 clr2, u8 clr
winTemplate.height = 2;
var = winTemplate.width * 32;
windowId = AddWindow(&winTemplate);
- FillWindowPixelBuffer(windowId, (arg3 << 4) | arg3);
+ FillWindowPixelBuffer(windowId, PIXEL_FILL(arg3));
tileData1 = (u8*) GetWindowAttribute(windowId, WINDOW_TILE_DATA);
tileData2 = (winTemplate.width * 32) + tileData1;
txtColor[0] = arg3;
@@ -1736,8 +1736,8 @@ static void Task_PokemonStorageSystemPC(u8 taskId)
case 0:
CreatePCMenu(task->data[1], &task->data[15]);
sub_81973A4();
- NewMenuHelpers_DrawDialogueFrame(0, 0);
- FillWindowPixelBuffer(0, 0x11);
+ DrawDialogueFrame(0, 0);
+ FillWindowPixelBuffer(0, PIXEL_FILL(1));
AddTextPrinterParameterized2(0, 1, gUnknown_085716C0[task->data[1]].desc, TEXT_SPEED_FF, NULL, 2, 1, 3);
CopyWindowToVram(0, 3);
CopyWindowToVram(task->data[15], 3);
@@ -1763,13 +1763,13 @@ static void Task_PokemonStorageSystemPC(u8 taskId)
if (task->data[1] != task->data[3])
{
task->data[1] = task->data[3];
- FillWindowPixelBuffer(0, 0x11);
+ FillWindowPixelBuffer(0, PIXEL_FILL(1));
AddTextPrinterParameterized2(0, 1, gUnknown_085716C0[task->data[1]].desc, 0, NULL, 2, 1, 3);
}
break;
case MENU_B_PRESSED:
case 4:
- sub_819746C(task->data[15], TRUE);
+ ClearStdWindowAndFrame(task->data[15], TRUE);
ScriptContext2_Disable();
EnableBothScriptContexts();
RemoveWindow(task->data[15]);
@@ -1778,13 +1778,13 @@ static void Task_PokemonStorageSystemPC(u8 taskId)
default:
if (task->data[2] == 0 && CountPartyMons() == PARTY_SIZE)
{
- FillWindowPixelBuffer(0, 0x11);
+ FillWindowPixelBuffer(0, PIXEL_FILL(1));
AddTextPrinterParameterized2(0, 1, gText_PartyFull, 0, NULL, 2, 1, 3);
task->data[0] = 3;
}
else if (task->data[2] == 1 && CountPartyMons() == 1)
{
- FillWindowPixelBuffer(0, 0x11);
+ FillWindowPixelBuffer(0, PIXEL_FILL(1));
AddTextPrinterParameterized2(0, 1, gText_JustOnePkmn, 0, NULL, 2, 1, 3);
task->data[0] = 3;
}
@@ -1799,7 +1799,7 @@ static void Task_PokemonStorageSystemPC(u8 taskId)
case 3:
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
{
- FillWindowPixelBuffer(0, 0x11);
+ FillWindowPixelBuffer(0, PIXEL_FILL(1));
AddTextPrinterParameterized2(0, 1, gUnknown_085716C0[task->data[1]].desc, 0, NULL, 2, 1, 3);
task->data[0] = 2;
}
@@ -1809,7 +1809,7 @@ static void Task_PokemonStorageSystemPC(u8 taskId)
task->data[1] = 4;
Menu_MoveCursor(-1);
task->data[1] = Menu_GetCursorPos();
- FillWindowPixelBuffer(0, 0x11);
+ FillWindowPixelBuffer(0, PIXEL_FILL(1));
AddTextPrinterParameterized2(0, 1, gUnknown_085716C0[task->data[1]].desc, 0, NULL, 2, 1, 3);
task->data[0] = 2;
}
@@ -1819,7 +1819,7 @@ static void Task_PokemonStorageSystemPC(u8 taskId)
task->data[1] = 0;
Menu_MoveCursor(1);
task->data[1] = Menu_GetCursorPos();
- FillWindowPixelBuffer(0, 0x11);
+ FillWindowPixelBuffer(0, PIXEL_FILL(1));
AddTextPrinterParameterized2(0, 1, gUnknown_085716C0[task->data[1]].desc, 0, NULL, 2, 1, 3);
task->data[0] = 2;
}
@@ -1865,7 +1865,7 @@ static void CreatePCMenu(u8 whichMenu, s16 *windowIdPtr)
winTemplate.width = GetMaxWidthInMenuTable((void *)gUnknown_085716C0, ARRAY_COUNT(gUnknown_085716C0));
windowId = AddWindow(&winTemplate);
- NewMenuHelpers_DrawStdWindowFrame(windowId, FALSE);
+ DrawStdWindowFrame(windowId, FALSE);
PrintMenuTable(windowId, ARRAY_COUNT(gUnknown_085716C0), (void *)gUnknown_085716C0);
InitMenuInUpperLeftCornerPlaySoundWhenAPressed(windowId, ARRAY_COUNT(gUnknown_085716C0), whichMenu);
*windowIdPtr = windowId;
@@ -2103,7 +2103,7 @@ static void sub_80C7BE4(void)
winTemplate.height = 4;
windowId = AddWindow(&winTemplate);
- FillWindowPixelBuffer(windowId, 0x44);
+ FillWindowPixelBuffer(windowId, PIXEL_FILL(4));
center = GetStringCenterAlignXOffset(1, boxName, 64);
AddTextPrinterParameterized3(windowId, 1, center, 1, gUnknown_08571734, TEXT_SPEED_FF, boxName);
@@ -4107,7 +4107,7 @@ static void LoadCursorMonGfx(u16 species, u32 pid)
static void PrintCursorMonInfo(void)
{
- FillWindowPixelBuffer(0, 0x11);
+ FillWindowPixelBuffer(0, PIXEL_FILL(1));
if (sPSSData->boxOption != BOX_OPTION_MOVE_ITEMS)
{
AddTextPrinterParameterized(0, 1, sPSSData->cursorMonNickText, 6, 0, TEXT_SPEED_FF, NULL);
@@ -4416,7 +4416,7 @@ static void PrintStorageActionText(u8 id)
}
DynamicPlaceholderTextUtil_ExpandPlaceholders(sPSSData->field_2190, gPCStorageActionTexts[id].text);
- FillWindowPixelBuffer(1, 0x11);
+ FillWindowPixelBuffer(1, PIXEL_FILL(1));
AddTextPrinterParameterized(1, 1, sPSSData->field_2190, 0, 1, TEXT_SPEED_FF, NULL);
sub_8098858(1, 2, 14);
PutWindowTilemap(1);
@@ -4432,7 +4432,7 @@ static void ShowYesNoWindow(s8 cursorPos)
static void ClearBottomWindow(void)
{
- sub_8198070(1, FALSE);
+ ClearStdWindowAndFrameToTransparent(1, FALSE);
schedule_bg_copy_tilemap_to_vram(0);
}
@@ -6501,7 +6501,7 @@ static void InitCanRelaseMonVars(void)
}
sub_80CE350(sPSSData->field_2176);
- sPSSData->field_2174 = GetMonData(&sPSSData->field_2108, MON_DATA_KNOWN_MOVES, sPSSData->field_2176);
+ sPSSData->field_2174 = GetMonData(&sPSSData->field_2108, MON_DATA_KNOWN_MOVES, (u8*)sPSSData->field_2176);
if (sPSSData->field_2174 != 0)
{
sPSSData->field_216D = 0;
@@ -6559,7 +6559,7 @@ static s8 RunCanReleaseMon(void)
{
if (sPSSData->field_2170 != TOTAL_BOXES_COUNT || sPSSData->field_2171 != i)
{
- knownMoves = GetMonData(gPlayerParty + i, MON_DATA_KNOWN_MOVES, sPSSData->field_2176);
+ knownMoves = GetMonData(gPlayerParty + i, MON_DATA_KNOWN_MOVES, (u8*)sPSSData->field_2176);
sPSSData->field_2174 &= ~(knownMoves);
}
}
@@ -6578,7 +6578,7 @@ static s8 RunCanReleaseMon(void)
case 1:
for (i = 0; i < IN_BOX_COUNT; i++)
{
- knownMoves = GetAndCopyBoxMonDataAt(sPSSData->field_216E, sPSSData->field_216F, MON_DATA_KNOWN_MOVES, sPSSData->field_2176);
+ knownMoves = GetAndCopyBoxMonDataAt(sPSSData->field_216E, sPSSData->field_216F, MON_DATA_KNOWN_MOVES, (u8*)sPSSData->field_2176);
if (knownMoves != 0
&& !(sPSSData->field_2170 == sPSSData->field_216E && sPSSData->field_2171 == sPSSData->field_216F))
{
@@ -8733,7 +8733,7 @@ static void AddMenu(void)
sPSSData->menuWindow.tilemapTop = 15 - sPSSData->menuWindow.height;
sPSSData->field_CB0 = AddWindow(&sPSSData->menuWindow);
ClearWindowTilemap(sPSSData->field_CB0);
- SetWindowBorderStyle(sPSSData->field_CB0, FALSE, 11, 14);
+ DrawStdFrameWithCustomTileAndPalette(sPSSData->field_CB0, FALSE, 11, 14);
PrintMenuTable(sPSSData->field_CB0, sPSSData->menuItemsCount, (void*)sPSSData->menuItems);
InitMenuInUpperLeftCornerPlaySoundWhenAPressed(sPSSData->field_CB0, sPSSData->menuItemsCount, 0);
schedule_bg_copy_tilemap_to_vram(0);
@@ -8787,7 +8787,7 @@ static s16 sub_80D00AC(void)
static void sub_80D013C(void)
{
- sub_8198070(sPSSData->field_CB0, TRUE);
+ ClearStdWindowAndFrameToTransparent(sPSSData->field_CB0, TRUE);
RemoveWindow(sPSSData->field_CB0);
}
@@ -8835,7 +8835,7 @@ static bool8 sub_80D0164(void)
sPSSData->field_2200 = AddWindow8Bit(&gUnknown_0857BB1C);
if (sPSSData->field_2200 != 0xFF)
{
- FillWindowPixelBuffer(sPSSData->field_2200, 0);
+ FillWindowPixelBuffer(sPSSData->field_2200, PIXEL_FILL(0));
return TRUE;
}
}
@@ -8892,7 +8892,7 @@ static bool8 sub_80D024C(void)
ChangeBgX(0, -1024, 0);
ChangeBgY(0, -1024, 0);
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x20, 0x20);
- FillWindowPixelBuffer8Bit(sPSSData->field_2200, 0);
+ FillWindowPixelBuffer8Bit(sPSSData->field_2200, PIXEL_FILL(0));
sub_80D07B0(sMoveMonsPtr->fromRow, sMoveMonsPtr->fromColumn);
SetBgAttribute(0, BG_ATTR_PALETTEMODE, 1);
PutWindowTilemap(sPSSData->field_2200);
@@ -9194,7 +9194,7 @@ static void sub_80D0834(u8 arg0, u8 arg1)
if (species != SPECIES_NONE)
{
FillWindowPixelRect8Bit(sPSSData->field_2200,
- 0,
+ PIXEL_FILL(0),
24 * arg0,
24 * arg1,
32,
@@ -9911,7 +9911,7 @@ static void PrintItemDescription(void)
else
description = ItemId_GetDescription(sPSSData->cursorMonItem);
- FillWindowPixelBuffer(2, 0x11);
+ FillWindowPixelBuffer(2, PIXEL_FILL(1));
AddTextPrinterParameterized5(2, 1, description, 4, 0, 0, NULL, 0, 1);
}
@@ -10357,7 +10357,7 @@ bool32 AnyStorageMonWithMove(u16 moveId)
{
if (GetBoxMonData(&gPokemonStoragePtr->boxes[i][j], MON_DATA_SANITY_HAS_SPECIES)
&& !GetBoxMonData(&gPokemonStoragePtr->boxes[i][j], MON_DATA_SANITY_IS_EGG)
- && GetBoxMonData(&gPokemonStoragePtr->boxes[i][j], MON_DATA_KNOWN_MOVES, moves))
+ && GetBoxMonData(&gPokemonStoragePtr->boxes[i][j], MON_DATA_KNOWN_MOVES, (u8*)moves))
return TRUE;
}
}
diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c
index bd1ae7802..0133e40f1 100644
--- a/src/pokemon_summary_screen.c
+++ b/src/pokemon_summary_screen.c
@@ -1349,7 +1349,7 @@ static bool8 ExtractMonDataToSummaryStruct(struct Pokemon *a)
}
break;
case 3:
- GetMonData(a, MON_DATA_OT_NAME, &sum->OTName);
+ GetMonData(a, MON_DATA_OT_NAME, sum->OTName);
ConvertInternationalString((u8*)&sum->OTName, GetMonData(a, MON_DATA_LANGUAGE));
sum->unk7 = sub_81B205C(a);
sum->OTGender = GetMonData(a, MON_DATA_OT_GENDER);
@@ -2629,7 +2629,7 @@ static void ResetWindows(void)
for (i = 0; i < 20; i++)
{
- FillWindowPixelBuffer(i, 0);
+ FillWindowPixelBuffer(i, PIXEL_FILL(0));
}
for (i = 0; i < ARRAY_COUNT(pssData->windowIds); i++)
{
@@ -2644,9 +2644,9 @@ static void SummaryScreen_PrintTextOnWindow(u8 windowId, const u8 *string, u8 x,
static void sub_81C25E8(void)
{
- FillWindowPixelBuffer(17, 0);
- FillWindowPixelBuffer(18, 0);
- FillWindowPixelBuffer(19, 0);
+ FillWindowPixelBuffer(17, PIXEL_FILL(0));
+ FillWindowPixelBuffer(18, PIXEL_FILL(0));
+ FillWindowPixelBuffer(19, PIXEL_FILL(0));
if (!pssData->summary.isEgg)
sub_81C2628();
else
@@ -2898,7 +2898,7 @@ static u8 AddWindowFromTemplateList(const struct WindowTemplate *template, u8 te
if (*windowIdPtr == 0xFF)
{
*windowIdPtr = AddWindow(&template[templateId]);
- FillWindowPixelBuffer(*windowIdPtr, 0);
+ FillWindowPixelBuffer(*windowIdPtr, PIXEL_FILL(0));
}
return *windowIdPtr;
}
@@ -2920,7 +2920,7 @@ static void PrintPageSpecificText(u8 pageIndex)
for (i = 0; i < ARRAY_COUNT(pssData->windowIds); i++)
{
if (pssData->windowIds[i] != 0xFF)
- FillWindowPixelBuffer(pssData->windowIds[i], 0);
+ FillWindowPixelBuffer(pssData->windowIds[i], PIXEL_FILL(0));
}
sTextPrinterFunctions[pageIndex]();
}
@@ -3469,7 +3469,7 @@ static void PrintMovePowerAndAccuracy(u16 moveIndex)
const u8 *text;
if (moveIndex != 0)
{
- FillWindowPixelRect(14, 0, 53, 0, 19, 32);
+ FillWindowPixelRect(14, PIXEL_FILL(0), 53, 0, 19, 32);
if (gBattleMoves[moveIndex].power < 2)
{
@@ -3567,7 +3567,7 @@ static void PrintContestMoveDescription(u8 moveSlot)
static void PrintMoveDetails(u16 move)
{
u8 windowId = AddWindowFromTemplateList(sPageMovesTemplate, 2);
- FillWindowPixelBuffer(windowId, 0);
+ FillWindowPixelBuffer(windowId, PIXEL_FILL(0));
if (move != MOVE_NONE)
{
if (pssData->currPageIndex == 2)
@@ -3619,7 +3619,7 @@ static void PrintNewMoveDetailsOrCancelText(void)
static void sub_81C4064(void)
{
u8 windowId = AddWindowFromTemplateList(sPageMovesTemplate, 0);
- FillWindowPixelRect(windowId, 0, 0, 66, 72, 16);
+ FillWindowPixelRect(windowId, PIXEL_FILL(0), 0, 66, 72, 16);
CopyWindowToVram(windowId, 2);
}
@@ -3628,11 +3628,11 @@ static void sub_81C40A0(u8 moveIndex1, u8 moveIndex2)
u8 windowId1 = AddWindowFromTemplateList(sPageMovesTemplate, 0);
u8 windowId2 = AddWindowFromTemplateList(sPageMovesTemplate, 1);
- FillWindowPixelRect(windowId1, 0, 0, moveIndex1 * 16, 0x48, 0x10);
- FillWindowPixelRect(windowId1, 0, 0, moveIndex2 * 16, 0x48, 0x10);
+ FillWindowPixelRect(windowId1, PIXEL_FILL(0), 0, moveIndex1 * 16, 0x48, 0x10);
+ FillWindowPixelRect(windowId1, PIXEL_FILL(0), 0, moveIndex2 * 16, 0x48, 0x10);
- FillWindowPixelRect(windowId2, 0, 0, moveIndex1 * 16, 0x30, 0x10);
- FillWindowPixelRect(windowId2, 0, 0, moveIndex2 * 16, 0x30, 0x10);
+ FillWindowPixelRect(windowId2, PIXEL_FILL(0), 0, moveIndex1 * 16, 0x30, 0x10);
+ FillWindowPixelRect(windowId2, PIXEL_FILL(0), 0, moveIndex2 * 16, 0x30, 0x10);
PrintMoveNameAndPP(moveIndex1);
PrintMoveNameAndPP(moveIndex2);
@@ -3641,7 +3641,7 @@ static void sub_81C40A0(u8 moveIndex1, u8 moveIndex2)
static void PrintHMMovesCantBeForgotten(void)
{
u8 windowId = AddWindowFromTemplateList(sPageMovesTemplate, 2);
- FillWindowPixelBuffer(windowId, 0);
+ FillWindowPixelBuffer(windowId, PIXEL_FILL(0));
SummaryScreen_PrintTextOnWindow(windowId, gText_HMMovesCantBeForgotten2, 6, 1, 0, 0);
}
diff --git a/src/pokenav.c b/src/pokenav.c
index 62ec75842..42114a4b2 100644
--- a/src/pokenav.c
+++ b/src/pokenav.c
@@ -1138,8 +1138,8 @@ bool32 IsDma3ManagerBusyWithBgCopy_(void)
void sub_81C7BF8(u32 windowId)
{
- FillWindowPixelBuffer(windowId, 0x44);
- FillWindowPixelRect(windowId, 0x55, 0, 0, 0x80, 1);
+ FillWindowPixelBuffer(windowId, PIXEL_FILL(4));
+ FillWindowPixelRect(windowId, PIXEL_FILL(5), 0, 0, 0x80, 1);
}
void sub_81C7C28(void)
diff --git a/src/record_mixing.c b/src/record_mixing.c
index ce9bacf4c..3a16f817e 100644
--- a/src/record_mixing.c
+++ b/src/record_mixing.c
@@ -292,7 +292,7 @@ static void ReceiveExchangePacket(u32 which)
static void PrintTextOnRecordMixing(const u8 *src)
{
- NewMenuHelpers_DrawDialogueFrame(0, 0);
+ DrawDialogueFrame(0, 0);
AddTextPrinterParameterized(0, 1, src, 0, 1, 0, NULL);
CopyWindowToVram(0, 3);
}
@@ -371,7 +371,7 @@ static void Task_RecordMixing_Main(u8 taskId)
{
CreateTask(sub_80AF2B4, 10);
}
- sub_8197434(0, 1);
+ ClearDialogWindowAndFrame(0, 1);
DestroyTask(taskId);
EnableBothScriptContexts();
}
diff --git a/src/region_map.c b/src/region_map.c
index ff0c19167..8dadc78a7 100644
--- a/src/region_map.c
+++ b/src/region_map.c
@@ -883,7 +883,7 @@ static void RegionMap_InitializeStateBasedOnPlayerLocation(void)
case MAP_TYPE_CITY:
case MAP_TYPE_ROUTE:
case MAP_TYPE_UNDERWATER:
- case MAP_TYPE_6:
+ case MAP_TYPE_OCEAN_ROUTE:
gRegionMap->mapSecId = gMapHeader.regionMapSectionId;
gRegionMap->playerIsInCave = FALSE;
mapWidth = gMapHeader.mapLayout->width;
@@ -896,7 +896,7 @@ static void RegionMap_InitializeStateBasedOnPlayerLocation(void)
}
break;
case MAP_TYPE_UNDERGROUND:
- case MAP_TYPE_7:
+ case MAP_TYPE_UNUSED_2:
if (gMapHeader.flags & 0x02)
{
mapHeader = Overworld_GetMapHeaderByGroupAndId(gSaveBlock1Ptr->escapeWarp.mapGroup, gSaveBlock1Ptr->escapeWarp.mapNum);
@@ -1159,7 +1159,7 @@ static u16 RegionMap_GetTerraCaveMapSecId(void)
{
s16 idx;
- idx = VarGet(VAR_0x4037) - 1;
+ idx = VarGet(VAR_UNUSUAL_WEATHER_LOCATION) - 1;
if (idx < 0 || idx > 15)
{
idx = 0;
@@ -1171,7 +1171,7 @@ static void RegionMap_GetMarineCaveCoords(u16 *x, u16 *y)
{
u16 idx;
- idx = VarGet(VAR_0x4037);
+ idx = VarGet(VAR_UNUSUAL_WEATHER_LOCATION);
if (idx < 9 || idx > 16)
{
idx = 9;
@@ -1622,7 +1622,7 @@ void MCB2_FlyMap(void)
case 7:
LoadPalette(sRegionMapFramePal, 0x10, 0x20);
PutWindowTilemap(2);
- FillWindowPixelBuffer(2, 0x00);
+ FillWindowPixelBuffer(2, PIXEL_FILL(0));
AddTextPrinterParameterized(2, 1, gText_FlyToWhere, 0, 1, 0, NULL);
schedule_bg_copy_tilemap_to_vram(0);
gMain.state++;
@@ -1687,8 +1687,8 @@ static void sub_8124904(void)
{
StringLength(gUnknown_085A1EDC[i].name[sFlyMap->regionMap.posWithinMapSec]);
flag = TRUE;
- sub_8198070(0, FALSE);
- SetWindowBorderStyle(1, FALSE, 0x65, 0x0d);
+ ClearStdWindowAndFrameToTransparent(0, FALSE);
+ DrawStdFrameWithCustomTileAndPalette(1, FALSE, 0x65, 0x0d);
AddTextPrinterParameterized(1, 1, sFlyMap->regionMap.mapSecName, 0, 1, 0, NULL);
name = gUnknown_085A1EDC[i].name[sFlyMap->regionMap.posWithinMapSec];
AddTextPrinterParameterized(1, 1, name, GetStringRightAlignXOffset(1, name, 0x60), 0x11, 0, NULL);
@@ -1702,12 +1702,12 @@ static void sub_8124904(void)
{
if (gUnknown_03001180 == TRUE)
{
- sub_8198070(1, FALSE);
- SetWindowBorderStyle(0, FALSE, 0x65, 0x0d);
+ ClearStdWindowAndFrameToTransparent(1, FALSE);
+ DrawStdFrameWithCustomTileAndPalette(0, FALSE, 0x65, 0x0d);
}
else
{
- FillWindowPixelBuffer(0, 0x11);
+ FillWindowPixelBuffer(0, PIXEL_FILL(1));
}
AddTextPrinterParameterized(0, 1, sFlyMap->regionMap.mapSecName, 0, 1, 0, NULL);
schedule_bg_copy_tilemap_to_vram(0);
@@ -1718,10 +1718,10 @@ static void sub_8124904(void)
{
if (gUnknown_03001180 == TRUE)
{
- sub_8198070(1, FALSE);
- SetWindowBorderStyle(0, FALSE, 0x65, 0x0d);
+ ClearStdWindowAndFrameToTransparent(1, FALSE);
+ DrawStdFrameWithCustomTileAndPalette(0, FALSE, 0x65, 0x0d);
}
- FillWindowPixelBuffer(0, 0x11);
+ FillWindowPixelBuffer(0, PIXEL_FILL(1));
CopyWindowToVram(0, 2);
schedule_bg_copy_tilemap_to_vram(0);
gUnknown_03001180 = FALSE;
diff --git a/src/reset_rtc_screen.c b/src/reset_rtc_screen.c
index 34444cbf4..ce9f5b98b 100644
--- a/src/reset_rtc_screen.c
+++ b/src/reset_rtc_screen.c
@@ -290,7 +290,7 @@ static void FreeCursorPalette(void)
static void HideChooseTimeWindow(u8 windowId)
{
- sub_8198070(windowId, FALSE);
+ ClearStdWindowAndFrameToTransparent(windowId, FALSE);
RemoveWindow(windowId);
schedule_bg_copy_tilemap_to_vram(0);
}
@@ -319,7 +319,7 @@ static void PrintTime(u8 windowId, u8 x, u8 y, u16 days, u8 hours, u8 minutes, u
static void ShowChooseTimeWindow(u8 windowId, u16 days, u8 hours, u8 minutes, u8 seconds)
{
- SetWindowBorderStyle(windowId, FALSE, 0x214, 0xE);
+ DrawStdFrameWithCustomTileAndPalette(windowId, FALSE, 0x214, 0xE);
PrintTime(windowId, 0, 1, days, hours, minutes, seconds);
AddTextPrinterParameterized(windowId, 1, gText_Confirm2, 126, 1, 0, NULL);
schedule_bg_copy_tilemap_to_vram(0);
@@ -495,7 +495,7 @@ static void VBlankCB(void)
static void ShowMessage(const u8 *str)
{
- sub_8197B1C(1, FALSE, 0x200, 0xF);
+ DrawDialogFrameWithCustomTileAndPalette(1, FALSE, 0x200, 0xF);
AddTextPrinterParameterized(1, 1, str, 0, 1, 0, NULL);
schedule_bg_copy_tilemap_to_vram(0);
}
@@ -507,7 +507,7 @@ static void Task_ShowResetRtcPrompt(u8 taskId)
switch (data[0])
{
case 0:
- SetWindowBorderStyle(0, FALSE, 0x214, 0xE);
+ DrawStdFrameWithCustomTileAndPalette(0, FALSE, 0x214, 0xE);
AddTextPrinterParameterized(0, 1, gText_PresentTime, 0, 1, TEXT_SPEED_FF, 0);
PrintTime(
0,
@@ -574,7 +574,7 @@ static void Task_ResetRtcScreen(u8 taskId)
case 2:
if (gTasks[data[1]].isActive != TRUE)
{
- sub_8198070(0, FALSE);
+ ClearStdWindowAndFrameToTransparent(0, FALSE);
ShowMessage(gText_PleaseResetTime);
gLocalTime = gSaveBlock2Ptr->lastBerryTreeUpdate;
data[1] = CreateTask(Task_ResetRtc_0, 80);
diff --git a/src/rom_8011DC0.c b/src/rom_8011DC0.c
index b0e861fac..3d9eab8d7 100644
--- a/src/rom_8011DC0.c
+++ b/src/rom_8011DC0.c
@@ -386,7 +386,7 @@ void nullsub_89(void)
void sub_80124EC(u8 windowId, u8 arg1, u8 stringId)
{
- FillWindowPixelBuffer(windowId, 0x11);
+ FillWindowPixelBuffer(windowId, PIXEL_FILL(1));
switch (arg1 << 8)
{
case 0x200:
@@ -505,17 +505,17 @@ void sub_8012780(u8 taskId)
}
data->field_11 = AddWindow(&gUnknown_082F012C);
- FillWindowPixelBuffer(data->field_10, 0x22);
+ FillWindowPixelBuffer(data->field_10, PIXEL_FILL(2));
sub_80173E0(data->field_10, 0, gUnknown_082EDBC4, 8, 1, 4);
PutWindowTilemap(data->field_10);
CopyWindowToVram(data->field_10, 2);
- NewMenuHelpers_DrawStdWindowFrame(data->listWindowId, FALSE);
+ DrawStdWindowFrame(data->listWindowId, FALSE);
gMultiuseListMenuTemplate = gUnknown_082F015C;
gMultiuseListMenuTemplate.windowId = data->listWindowId;
data->listTaskId = ListMenuInit(&gMultiuseListMenuTemplate, 0, 0);
- NewMenuHelpers_DrawStdWindowFrame(data->field_11, FALSE);
+ DrawStdWindowFrame(data->field_11, FALSE);
PutWindowTilemap(data->field_11);
CopyWindowToVram(data->field_11, 2);
@@ -785,10 +785,10 @@ void sub_8012780(u8 taskId)
void sub_8012F64(struct UnkStruct_Leader *data)
{
ClearWindowTilemap(data->field_11);
- sub_819746C(data->field_11, FALSE);
+ ClearStdWindowAndFrame(data->field_11, FALSE);
DestroyListMenuTask(data->listTaskId, 0, 0);
ClearWindowTilemap(data->field_10);
- sub_819746C(data->listWindowId, FALSE);
+ ClearStdWindowAndFrame(data->listWindowId, FALSE);
CopyBgTilemapBufferToVram(0);
RemoveWindow(data->field_11);
RemoveWindow(data->listWindowId);
@@ -1074,17 +1074,17 @@ void sub_80134E8(u8 taskId)
data->listWindowId = AddWindow(&gUnknown_082F0174);
data->field_D = AddWindow(&gUnknown_082F017C);
- FillWindowPixelBuffer(data->field_C, 0x22);
+ FillWindowPixelBuffer(data->field_C, PIXEL_FILL(2));
sub_80173E0(data->field_C, 0, gUnknown_082EF7DC, 8, 1, 4);
PutWindowTilemap(data->field_C);
CopyWindowToVram(data->field_C, 2);
- NewMenuHelpers_DrawStdWindowFrame(data->listWindowId, FALSE);
+ DrawStdWindowFrame(data->listWindowId, FALSE);
gMultiuseListMenuTemplate = gUnknown_082F0204;
gMultiuseListMenuTemplate.windowId = data->listWindowId;
data->listTaskId = ListMenuInit(&gMultiuseListMenuTemplate, 0, 0);
- NewMenuHelpers_DrawStdWindowFrame(data->field_D, FALSE);
+ DrawStdWindowFrame(data->field_D, FALSE);
PutWindowTilemap(data->field_D);
sub_80125BC(data->field_D);
CopyWindowToVram(data->field_D, 2);
@@ -1253,10 +1253,10 @@ void sub_80134E8(u8 taskId)
case 18:
case 20:
ClearWindowTilemap(data->field_D);
- sub_819746C(data->field_D, FALSE);
+ ClearStdWindowAndFrame(data->field_D, FALSE);
DestroyListMenuTask(data->listTaskId, 0, 0);
ClearWindowTilemap(data->field_C);
- sub_819746C(data->listWindowId, FALSE);
+ ClearStdWindowAndFrame(data->listWindowId, FALSE);
CopyBgTilemapBufferToVram(0);
RemoveWindow(data->field_D);
RemoveWindow(data->listWindowId);
@@ -2154,7 +2154,7 @@ void sub_8014F48(u8 taskId)
data->listTaskId = ListMenuInit(&gMultiuseListMenuTemplate, 0, 0);
sub_8018784(data->field_D);
- FillWindowPixelBuffer(data->field_D, 0x11);
+ FillWindowPixelBuffer(data->field_D, PIXEL_FILL(1));
PutWindowTilemap(data->field_D);
sub_80125BC(data->field_D);
CopyWindowToVram(data->field_D, 2);
diff --git a/src/roulette.c b/src/roulette.c
index 4c20bd0fe..05d5006f0 100644
--- a/src/roulette.c
+++ b/src/roulette.c
@@ -973,7 +973,7 @@ static void sub_81405CC(void)
sub_814372C(6);
sub_81436D0(0);
sub_81424FC(0);
- NewMenuHelpers_DrawStdWindowFrame(gUnknown_0203AB8C, FALSE);
+ DrawStdWindowFrame(gUnknown_0203AB8C, FALSE);
AddTextPrinterParameterized(gUnknown_0203AB8C, 1, gUnknown_082A5B89, 0, 1, TEXT_SPEED_FF, NULL);
CopyWindowToVram(gUnknown_0203AB8C, 3);
gSpriteCoordOffsetX = -60;
@@ -1043,8 +1043,8 @@ static void sub_81408A8(u8 taskId)
static void sub_8140914(u8 taskId)
{
- DisplayYesNoMenu();
- NewMenuHelpers_DrawStdWindowFrame(gUnknown_0203AB8C, 0);
+ DisplayYesNoMenuDefaultYes();
+ DrawStdWindowFrame(gUnknown_0203AB8C, 0);
AddTextPrinterParameterized(gUnknown_0203AB8C, 1, gUnknown_082A5C13, 0, 1, TEXT_SPEED_FF, 0);
CopyWindowToVram(gUnknown_0203AB8C, 3);
DoYesNoFuncWithChoice(taskId, &gUnknown_085B6410);
@@ -1052,7 +1052,7 @@ static void sub_8140914(u8 taskId)
static void sub_8140968(u8 taskId)
{
- sub_819746C(0, TRUE);
+ ClearStdWindowAndFrame(0, TRUE);
gTasks[taskId].func = sub_8140BD0;
}
@@ -1808,14 +1808,14 @@ static void sub_814189C(u8 taskId)
if (gTasks[taskId].data[2] == 12)
{
PlayFanfare(MUS_ME_B_BIG);
- NewMenuHelpers_DrawStdWindowFrame(gUnknown_0203AB8C, FALSE);
+ DrawStdWindowFrame(gUnknown_0203AB8C, FALSE);
AddTextPrinterParameterized(gUnknown_0203AB8C, 1, gUnknown_082A5BD7, 0, 1, TEXT_SPEED_FF, NULL);
CopyWindowToVram(gUnknown_0203AB8C, 3);
}
else
{
PlayFanfare(MUS_ME_B_SMALL);
- NewMenuHelpers_DrawStdWindowFrame(gUnknown_0203AB8C, FALSE);
+ DrawStdWindowFrame(gUnknown_0203AB8C, FALSE);
AddTextPrinterParameterized(gUnknown_0203AB8C, 1, gUnknown_082A5BCB, 0, 1, TEXT_SPEED_FF, NULL);
CopyWindowToVram(gUnknown_0203AB8C, 3);
}
@@ -1823,7 +1823,7 @@ static void sub_814189C(u8 taskId)
case 0:
default:
m4aSongNumStart(SE_HAZURE);
- NewMenuHelpers_DrawStdWindowFrame(gUnknown_0203AB8C, FALSE);
+ DrawStdWindowFrame(gUnknown_0203AB8C, FALSE);
AddTextPrinterParameterized(gUnknown_0203AB8C, 1, gUnknown_082A5BE0, 0, 1, TEXT_SPEED_FF, NULL);
CopyWindowToVram(gUnknown_0203AB8C, 3);
break;
@@ -1867,7 +1867,7 @@ static void sub_8141A18(u8 taskId)
{
ConvertIntToDecimalStringN(gStringVar1, (gUnknown_0203AB88->var19 * gTasks[taskId].data[2]), STR_CONV_MODE_LEFT_ALIGN, 2);
StringExpandPlaceholders(gStringVar4, gUnknown_082A5BEF);
- NewMenuHelpers_DrawStdWindowFrame(gUnknown_0203AB8C, FALSE);
+ DrawStdWindowFrame(gUnknown_0203AB8C, FALSE);
AddTextPrinterParameterized(gUnknown_0203AB8C, 1, gStringVar4, 0, 1, TEXT_SPEED_FF, NULL);
CopyWindowToVram(gUnknown_0203AB8C, 3);
gTasks[taskId].data[1] = (gUnknown_0203AB88->var19 * gTasks[taskId].data[2]);
@@ -1900,14 +1900,14 @@ static void sub_8141B58(u8 taskId)
{
if (gTasks[taskId].data[6] == 6)
{
- NewMenuHelpers_DrawStdWindowFrame(gUnknown_0203AB8C, FALSE);
+ DrawStdWindowFrame(gUnknown_0203AB8C, FALSE);
AddTextPrinterParameterized(gUnknown_0203AB8C, 1, gUnknown_082A5C21, 0, 1, TEXT_SPEED_FF, NULL);
CopyWindowToVram(gUnknown_0203AB8C, 3);
sub_8141F7C(taskId, dp01t_12_3_battle_menu, 0xFFFF, 3);
}
else if (gTasks[taskId].data[13] == 9999)
{
- NewMenuHelpers_DrawStdWindowFrame(gUnknown_0203AB8C, FALSE);
+ DrawStdWindowFrame(gUnknown_0203AB8C, FALSE);
AddTextPrinterParameterized(gUnknown_0203AB8C, 1, gUnknown_082A5C61, 0, 1, TEXT_SPEED_FF, NULL);
CopyWindowToVram(gUnknown_0203AB8C, 3);
sub_8141F7C(taskId, sub_8140914, 0xFFFF, 0x3);
@@ -1919,7 +1919,7 @@ static void sub_8141B58(u8 taskId)
}
else
{
- NewMenuHelpers_DrawStdWindowFrame(gUnknown_0203AB8C, FALSE);
+ DrawStdWindowFrame(gUnknown_0203AB8C, FALSE);
AddTextPrinterParameterized(gUnknown_0203AB8C, 1, gUnknown_082A5C04, 0, 1, TEXT_SPEED_FF, NULL);
CopyWindowToVram(gUnknown_0203AB8C, 3);
sub_8141F7C(taskId, sub_8140994, 0x3C, 0x3);
@@ -1944,7 +1944,7 @@ static void dp01t_12_3_battle_menu(u8 taskId)
if (gTasks[taskId].data[13] == 9999)
{
- NewMenuHelpers_DrawStdWindowFrame(gUnknown_0203AB8C, FALSE);
+ DrawStdWindowFrame(gUnknown_0203AB8C, FALSE);
AddTextPrinterParameterized(gUnknown_0203AB8C, 1, gUnknown_082A5C61, 0, 1, TEXT_SPEED_FF, NULL);
CopyWindowToVram(gUnknown_0203AB8C, 3);
sub_8141F7C(taskId, sub_8140914, 0xFFFF, 3);
@@ -3256,7 +3256,7 @@ static const struct SpriteTemplate gUnknown_085B7AEC =
static void sub_81428C4(u8 r0)
{
- DisplayYesNoMenu();
+ DisplayYesNoMenuDefaultYes();
DoYesNoFuncWithChoice(r0, &gUnknown_085B6408);
}
@@ -3272,7 +3272,7 @@ static void sub_81428E4(u8 taskId)
static void sub_8142918(u8 taskId)
{
- sub_819746C(0, TRUE);
+ ClearStdWindowAndFrame(0, TRUE);
HideCoinsWindow();
FreeAllWindowBuffers();
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK);
@@ -3283,7 +3283,7 @@ static void sub_8142918(u8 taskId)
static void sub_814297C(u8 taskId)
{
- sub_819746C(0, FALSE);
+ ClearStdWindowAndFrame(0, FALSE);
HideCoinsWindow();
ScriptContext2_Disable();
DestroyTask(taskId);
@@ -3296,7 +3296,7 @@ static void sub_81429A0(u8 taskId)
{
gSpecialVar_0x8004 = 1;
HideCoinsWindow();
- sub_819746C(0, TRUE);
+ ClearStdWindowAndFrame(0, TRUE);
ScriptContext2_Disable();
DestroyTask(taskId);
}
@@ -3309,7 +3309,7 @@ static void sub_81429F0(u8 taskId)
u32 temp = gUnknown_085B6344[(gSpecialVar_0x8004 & 1) + (gSpecialVar_0x8004 >> 7 << 1)];
ConvertIntToDecimalStringN(gStringVar1, temp, STR_CONV_MODE_LEADING_ZEROS, 1);
StringExpandPlaceholders(gStringVar4, gUnknown_082A5B12);
- NewMenuHelpers_DrawStdWindowFrame(0, FALSE);
+ DrawStdWindowFrame(0, FALSE);
AddTextPrinterParameterized(0, 1, gStringVar4, 0, 1, TEXT_SPEED_FF, NULL);
CopyWindowToVram(0, 3);
gTasks[taskId].func = sub_81428C4;
@@ -3326,7 +3326,7 @@ static void Task_Roulette_0(u8 taskId)
{
if ((gSpecialVar_0x8004 & 0x80) && (gSpecialVar_0x8004 & 1))
{
- NewMenuHelpers_DrawStdWindowFrame(0, FALSE);
+ DrawStdWindowFrame(0, FALSE);
AddTextPrinterParameterized(0, 1, gUnknown_082A5B6B, 0, 1, TEXT_SPEED_FF, NULL);
CopyWindowToVram(0, 3);
gTasks[taskId].func = sub_81429F0;
@@ -3334,7 +3334,7 @@ static void Task_Roulette_0(u8 taskId)
else
{
StringExpandPlaceholders(gStringVar4, gUnknown_082A5B12);
- NewMenuHelpers_DrawStdWindowFrame(0, FALSE);
+ DrawStdWindowFrame(0, FALSE);
AddTextPrinterParameterized(0, 1, gStringVar4, 0, 1, TEXT_SPEED_FF, NULL);
CopyWindowToVram(0, 3);
gTasks[taskId].func = sub_81428C4;
@@ -3343,7 +3343,7 @@ static void Task_Roulette_0(u8 taskId)
else
{
StringExpandPlaceholders(gStringVar4, gUnknown_082A5B4E);
- NewMenuHelpers_DrawStdWindowFrame(0, FALSE);
+ DrawStdWindowFrame(0, FALSE);
AddTextPrinterParameterized(0, 1, gStringVar4, 0, 1, TEXT_SPEED_FF, NULL);
CopyWindowToVram(0, 3);
gTasks[taskId].func = sub_81429A0;
diff --git a/src/save.c b/src/save.c
index ff26ce460..361a88e1e 100644
--- a/src/save.c
+++ b/src/save.c
@@ -656,10 +656,10 @@ static void UpdateSaveAddresses(void)
u8 HandleSavingData(u8 saveType)
{
u8 i;
- u32 *backupVar = gUnknown_0203CF5C;
+ u32 *backupVar = gTrainerHillVBlankCounter;
u8 *tempAddr;
- gUnknown_0203CF5C = NULL;
+ gTrainerHillVBlankCounter = NULL;
UpdateSaveAddresses();
switch (saveType)
{
@@ -702,7 +702,7 @@ u8 HandleSavingData(u8 saveType)
save_write_to_flash(0xFFFF, gRamSaveSectionLocations);
break;
}
- gUnknown_0203CF5C = backupVar;
+ gTrainerHillVBlankCounter = backupVar;
return 0;
}
diff --git a/src/save_failed_screen.c b/src/save_failed_screen.c
index 2478ebbec..08f193890 100644
--- a/src/save_failed_screen.c
+++ b/src/save_failed_screen.c
@@ -229,10 +229,10 @@ static void CB2_SaveFailedScreen(void)
LoadPalette(sSaveFailedClockPal, 0x100, 0x20);
LoadPalette(gTextWindowFrame1_Pal, 0xE0, 0x20);
LoadPalette(gUnknown_0860F074, 0xF0, 0x20);
- SetWindowBorderStyle(gSaveFailedWindowIds[TEXT_WIN_ID], FALSE, 0x214, 0xE);
- SetWindowBorderStyle(gSaveFailedWindowIds[CLOCK_WIN_ID], FALSE, 0x214, 0xE);
- FillWindowPixelBuffer(gSaveFailedWindowIds[CLOCK_WIN_ID], 0x11); // backwards?
- FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], 0x11);
+ DrawStdFrameWithCustomTileAndPalette(gSaveFailedWindowIds[TEXT_WIN_ID], FALSE, 0x214, 0xE);
+ DrawStdFrameWithCustomTileAndPalette(gSaveFailedWindowIds[CLOCK_WIN_ID], FALSE, 0x214, 0xE);
+ FillWindowPixelBuffer(gSaveFailedWindowIds[CLOCK_WIN_ID], PIXEL_FILL(1)); // backwards?
+ FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], PIXEL_FILL(1));
CopyWindowToVram(gSaveFailedWindowIds[CLOCK_WIN_ID], 2); // again?
CopyWindowToVram(gSaveFailedWindowIds[TEXT_WIN_ID], 1);
SaveFailedScreenTextPrint(gText_SaveFailedCheckingBackup, 1, 0);
@@ -265,19 +265,19 @@ static void CB2_WipeSave(void)
{
if (WipeSectors(gDamagedSaveSectors) != FALSE)
{
- FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], 0x11);
+ FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], PIXEL_FILL(1));
SaveFailedScreenTextPrint(gText_BackupMemoryDamaged, 1, 0);
SetMainCallback2(CB2_GameplayCannotBeContinued);
return;
}
- FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], 0x11);
+ FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], PIXEL_FILL(1));
SaveFailedScreenTextPrint(gText_CheckCompleted, 1, 0);
HandleSavingData(gSaveFailedType);
if (gDamagedSaveSectors != 0)
{
- FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], 0x11);
+ FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], PIXEL_FILL(1));
SaveFailedScreenTextPrint(gText_SaveFailedCheckingBackup, 1, 0);
}
@@ -286,12 +286,12 @@ static void CB2_WipeSave(void)
if (wipeTries == 3)
{
- FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], 0x11);
+ FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], PIXEL_FILL(1));
SaveFailedScreenTextPrint(gText_BackupMemoryDamaged, 1, 0);
}
else
{
- FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], 0x11);
+ FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], PIXEL_FILL(1));
if (gGameContinueCallback == NULL)
SaveFailedScreenTextPrint(gText_SaveCompleteGameCannotContinue, 1, 0);
@@ -308,7 +308,7 @@ static void CB2_GameplayCannotBeContinued(void)
if (gMain.newKeys & A_BUTTON)
{
- FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], 0x11);
+ FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], PIXEL_FILL(1));
SaveFailedScreenTextPrint(gText_GamePlayCannotBeContinued, 1, 0);
SetVBlankCallback(VBlankCB);
SetMainCallback2(CB2_FadeAndReturnToTitleScreen);
diff --git a/src/scrcmd.c b/src/scrcmd.c
index 6df835bad..314504600 100644
--- a/src/scrcmd.c
+++ b/src/scrcmd.c
@@ -1302,7 +1302,7 @@ bool8 ScrCmd_cmdDB(struct ScriptContext *ctx)
if (msg == NULL)
msg = (const u8 *)ctx->data[0];
sub_81973A4();
- NewMenuHelpers_DrawDialogueFrame(0, 1);
+ DrawDialogueFrame(0, 1);
AddTextPrinterParameterized(0, 1, msg, 0, 1, 0, 0);
return FALSE;
}
@@ -1517,9 +1517,9 @@ bool8 ScrCmd_braillemessage(struct ScriptContext *ctx)
winTemplate = CreateWindowTemplate(0, xWindow, yWindow + 1, width, height, 0xF, 0x1);
gUnknown_03000F30 = AddWindow(&winTemplate);
LoadUserWindowBorderGfx(gUnknown_03000F30, 0x214, 0xE0);
- NewMenuHelpers_DrawStdWindowFrame(gUnknown_03000F30, 0);
+ DrawStdWindowFrame(gUnknown_03000F30, 0);
PutWindowTilemap(gUnknown_03000F30);
- FillWindowPixelBuffer(gUnknown_03000F30, 0x11);
+ FillWindowPixelBuffer(gUnknown_03000F30, PIXEL_FILL(1));
AddTextPrinterParameterized(gUnknown_03000F30, 6, gStringVar4, xText, yText, 0xFF, 0x0);
CopyWindowToVram(gUnknown_03000F30, 3);
return FALSE;
@@ -2254,7 +2254,7 @@ bool8 ScrCmd_setmonmetlocation(struct ScriptContext *ctx)
void sub_809BDB4(void)
{
- sub_819746C(gUnknown_03000F30, 1);
+ ClearStdWindowAndFrame(gUnknown_03000F30, 1);
RemoveWindow(gUnknown_03000F30);
}
diff --git a/src/script_menu.c b/src/script_menu.c
index d9dbc770c..c7523a370 100644
--- a/src/script_menu.c
+++ b/src/script_menu.c
@@ -1202,7 +1202,7 @@ bool8 ScriptMenu_YesNo(u8 left, u8 top)
else
{
gSpecialVar_Result = 0xFF;
- DisplayYesNoMenu();
+ DisplayYesNoMenuDefaultYes();
taskId = CreateTask(Task_HandleYesNoInput, 0x50);
return TRUE;
}
@@ -1630,7 +1630,7 @@ u8 CreateWindowFromRect(u8 x, u8 y, u8 width, u8 height)
void sub_80E2A78(u8 windowId)
{
- sub_8198070(windowId, TRUE);
+ ClearStdWindowAndFrameToTransparent(windowId, TRUE);
RemoveWindow(windowId);
}
@@ -1639,27 +1639,27 @@ static void sub_80E2A94(u8 multichoiceId)
switch (multichoiceId)
{
case 77:
- FillWindowPixelBuffer(0, 0x11);
+ FillWindowPixelBuffer(0, PIXEL_FILL(1));
AddTextPrinterParameterized2(0, 1, gUnknown_0858BBAC[Menu_GetCursorPos()], 0, NULL, 2, 1, 3);
break;
case 76:
- FillWindowPixelBuffer(0, 0x11);
+ FillWindowPixelBuffer(0, PIXEL_FILL(1));
AddTextPrinterParameterized2(0, 1, gUnknown_0858BB9C[Menu_GetCursorPos()], 0, NULL, 2, 1, 3);
break;
case 78:
- FillWindowPixelBuffer(0, 0x11);
+ FillWindowPixelBuffer(0, PIXEL_FILL(1));
AddTextPrinterParameterized2(0, 1, gUnknown_0858BBBC[Menu_GetCursorPos()], 0, NULL, 2, 1, 3);
break;
case 79:
- FillWindowPixelBuffer(0, 0x11);
+ FillWindowPixelBuffer(0, PIXEL_FILL(1));
AddTextPrinterParameterized2(0, 1, gUnknown_0858BBCC[Menu_GetCursorPos()], 0, NULL, 2, 1, 3);
break;
case 75:
- FillWindowPixelBuffer(0, 0x11);
+ FillWindowPixelBuffer(0, PIXEL_FILL(1));
AddTextPrinterParameterized2(0, 1, gUnknown_0858BBEC[Menu_GetCursorPos()], 0, NULL, 2, 1, 3);
break;
case 74:
- FillWindowPixelBuffer(0, 0x11);
+ FillWindowPixelBuffer(0, PIXEL_FILL(1));
AddTextPrinterParameterized2(0, 1, gUnknown_0858BBE0[Menu_GetCursorPos()], 0, NULL, 2, 1, 3);
break;
}
diff --git a/src/secret_base.c b/src/secret_base.c
index 8bb216452..4b270e424 100644
--- a/src/secret_base.c
+++ b/src/secret_base.c
@@ -58,7 +58,7 @@ struct SecretBaseRecordMixer {
// Static RAM declarations
EWRAM_DATA u8 sCurSecretBaseId = 0;
-EWRAM_DATA u8 gUnknown_0203A01D = 0;
+EWRAM_DATA bool8 gInFriendSecretBase = FALSE;
EWRAM_DATA struct SecretBaseListMenuBuffer *gUnknown_0203A020 = NULL;
// Static ROM declarations
@@ -405,7 +405,7 @@ void sub_80E9068(void)
bool8 sub_80E909C(void)
{
- if (gMapHeader.mapType == MAP_TYPE_SECRET_BASE && VarGet(VAR_0x4097) == 0)
+ if (gMapHeader.mapType == MAP_TYPE_SECRET_BASE && VarGet(VAR_INIT_SECRET_BASE) == 0)
{
return FALSE;
}
@@ -492,7 +492,7 @@ void sub_80E9238(u8 flagIn)
sub_80E8CB0(&x, &y, 0x220);
MapGridSetMetatileIdAt(x + 7, y + 7, 0x221 | METATILE_COLLISION_MASK);
}
- else if (flagIn == 1 && VarGet(VAR_0x4089) == 1)
+ else if (flagIn == 1 && VarGet(VAR_SECRET_BASE_INITIALIZED) == 1)
{
sub_80E8CB0(&x, &y, 0x220);
MapGridSetMetatileIdAt(x + 7, y + 7, 0x20a | METATILE_COLLISION_MASK);
@@ -550,7 +550,7 @@ void sub_80E933C(void)
metatile = MapGridGetMetatileBehaviorAt(gSpecialVar_0x8006 + 7, gSpecialVar_0x8007 + 7);
if (MetatileBehavior_IsSecretBaseLargeMatEdge(metatile) == TRUE || MetatileBehavior_IsLargeMatCenter(metatile) == TRUE)
{
- gSpecialVar_Result = gMapHeader.events->eventObjects[objIdx].graphicsId + VAR_0x3F20;
+ gSpecialVar_Result = gMapHeader.events->eventObjects[objIdx].graphicsId + UNKNOWN_VAR_OFFSET_3F20;
VarSet(gSpecialVar_Result, gDecorations[roomDecor[decorIdx]].tiles[0]);
gSpecialVar_Result = gMapHeader.events->eventObjects[objIdx].localId;
FlagClear(gSpecialVar_0x8004 + 0xAE);
@@ -869,7 +869,7 @@ void sub_80E9C9C(u8 taskId)
{
data[1] = 0;
data[2] = 0;
- sub_8197434(0, 0);
+ ClearDialogWindowAndFrame(0, 0);
gUnknown_0203A020 = calloc(1, sizeof(struct SecretBaseListMenuBuffer));
data[6] = AddWindow(&gUnknown_0858D06C[0]);
game_continue(taskId);
@@ -961,7 +961,7 @@ void sub_80E9E90(u8 taskId)
PlaySE(SE_SELECT);
DestroyListMenuTask(data[5], NULL, NULL);
RemoveScrollIndicatorArrowPair(data[8]);
- sub_819746C(data[6], 0);
+ ClearStdWindowAndFrame(data[6], 0);
ClearWindowTilemap(data[6]);
RemoveWindow(data[6]);
schedule_bg_copy_tilemap_to_vram(0);
@@ -1018,8 +1018,8 @@ void sub_80E9FFC(u8 taskId)
s16 *data;
data = gTasks[taskId].data;
- sub_819746C(data[6], FALSE);
- sub_819746C(data[7], FALSE);
+ ClearStdWindowAndFrame(data[6], FALSE);
+ ClearStdWindowAndFrame(data[7], FALSE);
ClearWindowTilemap(data[6]);
ClearWindowTilemap(data[7]);
RemoveWindow(data[7]);
@@ -1031,7 +1031,7 @@ void sub_80E9FFC(u8 taskId)
void sub_80EA06C(u8 taskId)
{
- DisplayYesNoMenu();
+ DisplayYesNoMenuDefaultYes();
DoYesNoFuncWithChoice(taskId, &gUnknown_0858D058);
}
@@ -1040,7 +1040,7 @@ void sub_80EA08C(u8 taskId)
s16 *data;
data = gTasks[taskId].data;
- sub_8197434(0, 0);
+ ClearDialogWindowAndFrame(0, 0);
DestroyListMenuTask(data[5], &data[2], &data[1]);
gSaveBlock1Ptr->secretBases[data[4]].sbr_field_1_6 = 0;
game_continue(taskId);
@@ -1059,7 +1059,7 @@ void sub_80EA13C(u8 taskId)
s16 *data;
data = gTasks[taskId].data;
- sub_8197434(0, 0);
+ ClearDialogWindowAndFrame(0, 0);
DestroyListMenuTask(data[5], &data[2], &data[1]);
sub_80E9E00(taskId);
gTasks[taskId].func = sub_80E9E90;
@@ -1071,7 +1071,7 @@ void sub_80EA18C(u8 taskId)
data = gTasks[taskId].data;
sub_80E9E44(taskId);
- sub_819746C(data[7], 0);
+ ClearStdWindowAndFrame(data[7], 0);
ClearWindowTilemap(data[7]);
RemoveWindow(data[7]);
schedule_bg_copy_tilemap_to_vram(0);
@@ -1184,11 +1184,11 @@ void SecretBasePerStepCallback(u8 taskId)
case 0:
if (VarGet(VAR_CURRENT_SECRET_BASE) != 0)
{
- gUnknown_0203A01D = TRUE;
+ gInFriendSecretBase = TRUE;
}
else
{
- gUnknown_0203A01D = FALSE;
+ gInFriendSecretBase = FALSE;
}
PlayerGetDestCoords(&data[2], &data[3]);
data[1] = 1;
@@ -1199,103 +1199,103 @@ void SecretBasePerStepCallback(u8 taskId)
{
data[2] = x;
data[3] = y;
- VarSet(VAR_0x40EC, VarGet(VAR_0x40EC) + 1);
+ VarSet(VAR_SECRET_BASE_STEP_COUNTER, VarGet(VAR_SECRET_BASE_STEP_COUNTER) + 1);
behavior = MapGridGetMetatileBehaviorAt(x, y);
tileId = MapGridGetMetatileIdAt(x, y);
if (tileId == 0x234 || tileId == 0x23C)
{
- if (gUnknown_0203A01D == TRUE)
+ if (gInFriendSecretBase == TRUE)
{
- VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x20);
+ VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x20);
}
}
else if (tileId == 0x2b8 || tileId == 0x2b9 || tileId == 0x2ba || tileId == 0x2c0 || tileId == 0x2c1 || tileId == 0x2c2 || tileId == 0x2c8 || tileId == 0x2c9 || tileId == 0x2ca)
{
- if (gUnknown_0203A01D == TRUE)
+ if (gInFriendSecretBase == TRUE)
{
- VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x01);
+ VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x01);
}
}
else if (tileId == 0x239 || tileId == 0x241 || tileId == 0x251 || tileId == 0x259)
{
- if (gUnknown_0203A01D == TRUE)
+ if (gInFriendSecretBase == TRUE)
{
- VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x04);
+ VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x04);
}
}
else if ((behavior == 0x34 && tileId == 0x26d) || (behavior == 0x35 && MapGridGetMetatileIdAt(x, y) == 0x26a))
{
- if (gUnknown_0203A01D == TRUE)
+ if (gInFriendSecretBase == TRUE)
{
- VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x200);
+ VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x200);
}
}
else if (behavior == 0xc1 && tileId == 0x23d)
{
- if (gUnknown_0203A01D == TRUE)
+ if (gInFriendSecretBase == TRUE)
{
- VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) ^ 0x1000);
- VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x2000);
+ VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) ^ 0x1000);
+ VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x2000);
}
}
else if (behavior == 0x47 && tileId == 0x23e)
{
- if (gUnknown_0203A01D == TRUE)
+ if (gInFriendSecretBase == TRUE)
{
- VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x1000);
- VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) ^ 0x2000);
+ VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x1000);
+ VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) ^ 0x2000);
}
}
else if (MetatileBehavior_IsSecretBaseGlitterMat(behavior) == TRUE)
{
- if (gUnknown_0203A01D == TRUE)
+ if (gInFriendSecretBase == TRUE)
{
- VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x80);
+ VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x80);
}
}
else if (MetatileBehavior_IsSecretBaseBalloon(behavior) == TRUE)
{
PopSecretBaseBalloon(MapGridGetMetatileIdAt(x, y), x, y);
- if (gUnknown_0203A01D == TRUE)
+ if (gInFriendSecretBase == TRUE)
{
switch ((int)MapGridGetMetatileIdAt(x, y))
{
case 0x338:
case 0x33c:
case 0x340:
- VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x02);
+ VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x02);
break;
case 0x228:
- VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x100);
+ VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x100);
break;
}
}
}
else if (MetatileBehavior_IsSecretBaseBreakableDoor(behavior) == TRUE)
{
- if (gUnknown_0203A01D == TRUE)
+ if (gInFriendSecretBase == TRUE)
{
- VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x400);
+ VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x400);
}
ShatterSecretBaseBreakableDoor(x, y);
}
else if (MetatileBehavior_IsSecretBaseSoundMat(behavior) == TRUE){
- if (gUnknown_0203A01D == TRUE) {
- VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x8000);
+ if (gInFriendSecretBase == TRUE) {
+ VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x8000);
}
}
else if (MetatileBehavior_IsSecretBaseJumpMat(behavior) == TRUE)
{
- if (gUnknown_0203A01D == TRUE)
+ if (gInFriendSecretBase == TRUE)
{
- VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x4000);
+ VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x4000);
}
}
else if (MetatileBehavior_IsSecretBaseSpinMat(behavior) == TRUE)
{
- if (gUnknown_0203A01D == TRUE)
+ if (gInFriendSecretBase == TRUE)
{
- VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x02);
+ VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x02);
}
}
}
@@ -1778,33 +1778,33 @@ void sub_80EB18C(struct SecretBaseRecord *bases)
void sub_80EB1AC(void)
{
- VarSet(VAR_0x40EC, 0);
- VarSet(VAR_0x40ED, 0);
- VarSet(VAR_0x40EE, 0);
- VarSet(VAR_0x40EF, 0);
+ VarSet(VAR_SECRET_BASE_STEP_COUNTER, 0);
+ VarSet(VAR_SECRET_BASE_LAST_ITEM_USED, 0);
+ VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, 0);
+ VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, 0);
if (VarGet(VAR_CURRENT_SECRET_BASE) != 0)
{
- VarSet(VAR_0x40F0, TRUE);
+ VarSet(VAR_SECRET_BASE_IS_NOT_LOCAL, TRUE);
}
else
{
- VarSet(VAR_0x40F0, FALSE);
+ VarSet(VAR_SECRET_BASE_IS_NOT_LOCAL, FALSE);
}
- gUnknown_0203A01D = FALSE;
+ gInFriendSecretBase = FALSE;
}
void sub_80EB218(void)
{
- if (VarGet(VAR_0x40F0) && gUnknown_0203A01D == TRUE && !CurrentMapIsSecretBase())
+ if (VarGet(VAR_SECRET_BASE_IS_NOT_LOCAL) && gInFriendSecretBase == TRUE && !CurrentMapIsSecretBase())
{
- VarSet(VAR_0x40F0, FALSE);
- gUnknown_0203A01D = FALSE;
+ VarSet(VAR_SECRET_BASE_IS_NOT_LOCAL, FALSE);
+ gInFriendSecretBase = FALSE;
sub_80EEA70();
- VarSet(VAR_0x40EC, 0);
- VarSet(VAR_0x40ED, 0);
- VarSet(VAR_0x40EE, 0);
- VarSet(VAR_0x40EF, 0);
- VarSet(VAR_0x40F0, FALSE);
+ VarSet(VAR_SECRET_BASE_STEP_COUNTER, 0);
+ VarSet(VAR_SECRET_BASE_LAST_ITEM_USED, 0);
+ VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, 0);
+ VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, 0);
+ VarSet(VAR_SECRET_BASE_IS_NOT_LOCAL, FALSE);
}
}
@@ -1812,7 +1812,7 @@ void sub_80EB290(void)
{
if (VarGet(VAR_CURRENT_SECRET_BASE) != 0)
{
- VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x800);
+ VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x800);
}
}
@@ -1820,7 +1820,7 @@ void sub_80EB2C8(void)
{
if (VarGet(VAR_CURRENT_SECRET_BASE) != 0)
{
- VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x400);
+ VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x400);
}
}
@@ -1828,9 +1828,9 @@ void sub_80EB300(void)
{
if (VarGet(VAR_CURRENT_SECRET_BASE) != 0)
{
- VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) & ~0x3800);
- VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) & ~0x001);
- VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x2000);
+ VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) & ~0x3800);
+ VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) & ~0x001);
+ VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x2000);
}
}
@@ -1838,9 +1838,9 @@ void sub_80EB368(void)
{
if (VarGet(VAR_CURRENT_SECRET_BASE) != 0)
{
- VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) & ~0x3800);
- VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) & ~0x001);
- VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x800);
+ VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) & ~0x3800);
+ VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) & ~0x001);
+ VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x800);
}
}
@@ -1848,9 +1848,9 @@ void sub_80EB3D0(void)
{
if (VarGet(VAR_CURRENT_SECRET_BASE) != 0)
{
- VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) & ~0x3800);
- VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) & ~0x001);
- VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x1000);
+ VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) & ~0x3800);
+ VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) & ~0x001);
+ VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x1000);
}
}
@@ -1858,9 +1858,9 @@ void sub_80EB438(void)
{
if (VarGet(VAR_CURRENT_SECRET_BASE) != 0)
{
- VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) & ~0x3800);
- VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) & ~0x001);
- VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x001);
+ VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) & ~0x3800);
+ VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) & ~0x001);
+ VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x001);
}
}
@@ -1889,7 +1889,7 @@ void sub_80EB498(void)
case 0x334:
if (VarGet(VAR_CURRENT_SECRET_BASE) != 0)
{
- VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x4000);
+ VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x4000);
}
break;
}
@@ -1907,7 +1907,7 @@ void sub_80EB56C(void)
case 0x28b:
if (VarGet(VAR_CURRENT_SECRET_BASE) != 0)
{
- VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x40);
+ VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x40);
}
break;
case 0x2d8:
@@ -1930,21 +1930,21 @@ void sub_80EB56C(void)
case 0x2fb:
if (VarGet(VAR_CURRENT_SECRET_BASE) != 0)
{
- VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x8);
+ VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x8);
}
break;
case 0x22c:
case 0x233:
if (VarGet(VAR_CURRENT_SECRET_BASE) != 0)
{
- VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x40);
+ VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x40);
}
break;
case 0x288:
case 0x289:
if (VarGet(VAR_CURRENT_SECRET_BASE) != 0)
{
- VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x100);
+ VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x100);
}
break;
case 0x22d:
@@ -1952,7 +1952,7 @@ void sub_80EB56C(void)
case 0x22f:
if (VarGet(VAR_CURRENT_SECRET_BASE) != 0)
{
- VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x10);
+ VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x10);
}
break;
case 0x287:
@@ -1980,7 +1980,7 @@ void sub_80EB56C(void)
case 0x2cf:
if (VarGet(VAR_CURRENT_SECRET_BASE) != 0)
{
- VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x8);
+ VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x8);
}
break;
}
@@ -2007,7 +2007,7 @@ void sub_80EB9E0(void)
case 0x2c6:
if (VarGet(VAR_CURRENT_SECRET_BASE) != 0)
{
- VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x8);
+ VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x8);
}
break;
}
@@ -2045,14 +2045,14 @@ void sub_80EBB28(void)
case 0x2c7:
if (VarGet(VAR_CURRENT_SECRET_BASE) != 0)
{
- VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x8);
+ VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x8);
}
break;
case 0x280:
case 0x281:
if (VarGet(VAR_CURRENT_SECRET_BASE) != 0)
{
- VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x100);
+ VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x100);
}
break;
case 0x225:
@@ -2060,7 +2060,7 @@ void sub_80EBB28(void)
case 0x227:
if (VarGet(VAR_CURRENT_SECRET_BASE) != 0)
{
- VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x10);
+ VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x10);
}
break;
}
@@ -2078,7 +2078,7 @@ void sub_80EBE7C(void)
case 0x28e:
if (VarGet(VAR_CURRENT_SECRET_BASE) != 0)
{
- VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x4);
+ VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x4);
}
break;
}
diff --git a/src/shop.c b/src/shop.c
index 8eefd5e97..e03e2ab0c 100755
--- a/src/shop.c
+++ b/src/shop.c
@@ -366,7 +366,7 @@ void CB2_ExitSellMenu(void)
static void Task_HandleShopMenuQuit(u8 taskId)
{
- sub_8198070(gMartInfo.windowId, 2);
+ ClearStdWindowAndFrameToTransparent(gMartInfo.windowId, 2);
RemoveWindow(gMartInfo.windowId);
SaveRecordedItemPurchasesForTVShow();
ScriptContext2_Disable();
@@ -545,7 +545,7 @@ static void BuyMenuPrintItemDescriptionAndShowItemIcon(int item, bool8 onInit, s
description = gText_QuitShopping;
}
- FillWindowPixelBuffer(2, 0);
+ FillWindowPixelBuffer(2, PIXEL_FILL(0));
BuyMenuPrint(2, description, 3, 1, 0, 0);
}
@@ -981,12 +981,12 @@ static void Task_BuyHowManyDialogueInit(u8 taskId)
u16 quantityInBag = CountTotalItemQuantityInBag(tItemId);
u16 maxQuantity;
- SetWindowBorderStyle(3, FALSE, 1, 13);
+ DrawStdFrameWithCustomTileAndPalette(3, FALSE, 1, 13);
ConvertIntToDecimalStringN(gStringVar1, quantityInBag, STR_CONV_MODE_RIGHT_ALIGN, 4);
StringExpandPlaceholders(gStringVar4, gText_InBagVar1);
BuyMenuPrint(3, gStringVar4, 0, 1, 0, 0);
tItemCount = 1;
- SetWindowBorderStyle(4, FALSE, 1, 13);
+ DrawStdFrameWithCustomTileAndPalette(4, FALSE, 1, 13);
BuyMenuPrintItemQuantityAndPrice(taskId);
schedule_bg_copy_tilemap_to_vram(0);
@@ -1018,8 +1018,8 @@ static void Task_BuyHowManyDialogueHandleInput(u8 taskId)
if (gMain.newKeys & A_BUTTON)
{
PlaySE(SE_SELECT);
- sub_8198070(4, 0);
- sub_8198070(3, 0);
+ ClearStdWindowAndFrameToTransparent(4, 0);
+ ClearStdWindowAndFrameToTransparent(3, 0);
ClearWindowTilemap(4);
ClearWindowTilemap(3);
PutWindowTilemap(1);
@@ -1031,8 +1031,8 @@ static void Task_BuyHowManyDialogueHandleInput(u8 taskId)
else if (gMain.newKeys & B_BUTTON)
{
PlaySE(SE_SELECT);
- sub_8198070(4, 0);
- sub_8198070(3, 0);
+ ClearStdWindowAndFrameToTransparent(4, 0);
+ ClearStdWindowAndFrameToTransparent(3, 0);
ClearWindowTilemap(4);
ClearWindowTilemap(3);
BuyMenuReturnToItemList(taskId);
@@ -1131,7 +1131,7 @@ static void BuyMenuReturnToItemList(u8 taskId)
{
s16 *data = gTasks[taskId].data;
- sub_8197DF8(5, 0);
+ ClearDialogWindowAndFrameToTransparent(5, 0);
BuyMenuPrintCursor(tListTaskId, 1);
PutWindowTilemap(1);
PutWindowTilemap(2);
@@ -1144,7 +1144,7 @@ static void BuyMenuPrintItemQuantityAndPrice(u8 taskId)
{
s16 *data = gTasks[taskId].data;
- FillWindowPixelBuffer(4, 0x11);
+ FillWindowPixelBuffer(4, PIXEL_FILL(1));
PrintMoneyAmount(4, 38, 1, gShopDataPtr->totalCost, TEXT_SPEED_FF);
ConvertIntToDecimalStringN(gStringVar1, tItemCount, 2, 2);
StringExpandPlaceholders(gStringVar4, gText_xVar1);
diff --git a/src/siirtc.c b/src/siirtc.c
index f7e85ef4f..5c153a841 100644
--- a/src/siirtc.c
+++ b/src/siirtc.c
@@ -76,19 +76,19 @@ static void DisableGpioPortRead();
static const char AgbLibRtcVersion[] = "SIIRTC_V001";
-void SiiRtcUnprotect()
+void SiiRtcUnprotect(void)
{
EnableGpioPortRead();
sLocked = FALSE;
}
-void SiiRtcProtect()
+void SiiRtcProtect(void)
{
DisableGpioPortRead();
sLocked = TRUE;
}
-u8 SiiRtcProbe()
+u8 SiiRtcProbe(void)
{
u8 errorCode;
struct SiiRtcInfo rtc;
@@ -129,7 +129,7 @@ u8 SiiRtcProbe()
return (errorCode << 4) | 1;
}
-bool8 SiiRtcReset()
+bool8 SiiRtcReset(void)
{
u8 result;
struct SiiRtcInfo rtc;
diff --git a/src/slot_machine.c b/src/slot_machine.c
index fb1c88097..a2e1f1554 100644
--- a/src/slot_machine.c
+++ b/src/slot_machine.c
@@ -1025,7 +1025,7 @@ static bool8 SlotAction_AwaitPlayerInput(struct Task *task)
static bool8 SlotAction_PrintYouDontHaveThreeCoins(struct Task *task)
{
- NewMenuHelpers_DrawDialogueFrame(0, 0);
+ DrawDialogueFrame(0, 0);
AddTextPrinterParameterized(0, 1, gText_YouDontHaveThreeCoins, 0, 1, 0, 0);
CopyWindowToVram(0, 3);
sSlotMachine->state = 7;
@@ -1036,7 +1036,7 @@ static bool8 SlotAction_ExitYouDontHaveThreeCoinsMessage(struct Task *task)
{
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
{
- sub_8197434(0, TRUE);
+ ClearDialogWindowAndFrame(0, TRUE);
sSlotMachine->state = 5;
}
return FALSE;
@@ -1274,7 +1274,7 @@ static bool8 SlotAction_NoMatches(struct Task *task)
static bool8 SlotAction_PrintQuitTheGame(struct Task *task)
{
- NewMenuHelpers_DrawDialogueFrame(0, 0);
+ DrawDialogueFrame(0, 0);
AddTextPrinterParameterized(0, 1, gText_QuitTheGame, 0, 1, 0, 0);
CopyWindowToVram(0, 3);
CreateYesNoMenuParameterized(0x15, 7, 0x214, 0x180, 0xE, 0xF);
@@ -1287,7 +1287,7 @@ static bool8 SlotAction_SeeIfPlayerQuits(struct Task *task)
s8 input = Menu_ProcessInputNoWrapClearOnChoose();
if (input == 0) // player chooses to quit
{
- sub_8197434(0, TRUE);
+ ClearDialogWindowAndFrame(0, TRUE);
sub_8103D8C(0);
sub_8103D8C(1);
sub_8103D8C(2);
@@ -1296,7 +1296,7 @@ static bool8 SlotAction_SeeIfPlayerQuits(struct Task *task)
}
else if (input == 1 || input == -1) // player chooses not to quit
{
- sub_8197434(0, TRUE);
+ ClearDialogWindowAndFrame(0, TRUE);
sSlotMachine->state = 5;
}
return FALSE;
@@ -1304,7 +1304,7 @@ static bool8 SlotAction_SeeIfPlayerQuits(struct Task *task)
static bool8 SlotAction_PrintMessage_9999Coins(struct Task *task)
{
- NewMenuHelpers_DrawDialogueFrame(0, 0);
+ DrawDialogueFrame(0, 0);
AddTextPrinterParameterized(0, 1, gText_YouveGot9999Coins, 0, 1, 0, 0);
CopyWindowToVram(0, 3);
sSlotMachine->state = 24;
@@ -1315,7 +1315,7 @@ static bool8 SlotAction_ExitMessage_9999Coins(struct Task *task)
{
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
{
- sub_8197434(0, TRUE);
+ ClearDialogWindowAndFrame(0, TRUE);
sSlotMachine->state = 5;
}
return FALSE;
@@ -1323,7 +1323,7 @@ static bool8 SlotAction_ExitMessage_9999Coins(struct Task *task)
static bool8 SlotAction_PrintMessage_NoMoreCoins(struct Task *task)
{
- NewMenuHelpers_DrawDialogueFrame(0, 0);
+ DrawDialogueFrame(0, 0);
AddTextPrinterParameterized(0, 1, gText_YouveRunOutOfCoins, 0, 1, 0, 0);
CopyWindowToVram(0, 3);
sSlotMachine->state = 26;
@@ -1334,7 +1334,7 @@ static bool8 SlotAction_ExitMessage_NoMoreCoins(struct Task *task)
{
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
{
- sub_8197434(0, TRUE);
+ ClearDialogWindowAndFrame(0, TRUE);
sSlotMachine->state = 27;
}
return FALSE;
@@ -3120,7 +3120,7 @@ static void InfoBox_8104B80(struct Task *task)
sub_81065DC();
AddWindow(&gUnknown_085A7444);
PutWindowTilemap(1);
- FillWindowPixelBuffer(1, 0);
+ FillWindowPixelBuffer(1, PIXEL_FILL(0));
task->data[0]++;
}
@@ -3136,7 +3136,7 @@ static void InfoBox_AwaitPlayerInput(struct Task *task)
{
if (gMain.newKeys & (B_BUTTON | SELECT_BUTTON))
{
- FillWindowPixelBuffer(1, 0);
+ FillWindowPixelBuffer(1, PIXEL_FILL(0));
ClearWindowTilemap(1);
CopyWindowToVram(1, 1);
RemoveWindow(1);
diff --git a/src/start_menu.c b/src/start_menu.c
index 1052b640c..4822c12e6 100644
--- a/src/start_menu.c
+++ b/src/start_menu.c
@@ -115,7 +115,7 @@ static u8 SaveConfirmSaveCallback(void);
static u8 SaveYesNoCallback(void);
static u8 SaveConfirmInputCallback(void);
static u8 SaveFileExistsCallback(void);
-static u8 SaveConfirmOverwriteNoCallback(void);
+static u8 SaveConfirmOverwriteDefaultNoCallback(void);
static u8 SaveConfirmOverwriteCallback(void);
static u8 SaveOverwriteInputCallback(void);
static u8 SaveSavingMessageCallback(void);
@@ -368,7 +368,7 @@ static void ShowSafariBallsWindow(void)
{
sSafariBallsWindowId = AddWindow(&sSafariBallsWindowTemplate);
PutWindowTilemap(sSafariBallsWindowId);
- NewMenuHelpers_DrawStdWindowFrame(sSafariBallsWindowId, FALSE);
+ DrawStdWindowFrame(sSafariBallsWindowId, FALSE);
ConvertIntToDecimalStringN(gStringVar1, gNumSafariBalls, STR_CONV_MODE_RIGHT_ALIGN, 2);
StringExpandPlaceholders(gStringVar4, gText_SafariBallStock);
AddTextPrinterParameterized(sSafariBallsWindowId, 1, gStringVar4, 0, 1, 0xFF, NULL);
@@ -383,7 +383,7 @@ static void ShowPyramidFloorWindow(void)
sBattlePyramidFloorWindowId = AddWindow(&sPyramidFloorWindowTemplate_2);
PutWindowTilemap(sBattlePyramidFloorWindowId);
- NewMenuHelpers_DrawStdWindowFrame(sBattlePyramidFloorWindowId, FALSE);
+ DrawStdWindowFrame(sBattlePyramidFloorWindowId, FALSE);
StringCopy(gStringVar1, sPyramindFloorNames[gSaveBlock2Ptr->frontier.curChallengeBattleNum]);
StringExpandPlaceholders(gStringVar4, gText_BattlePyramidFloor);
AddTextPrinterParameterized(sBattlePyramidFloorWindowId, 1, gStringVar4, 0, 1, 0xFF, NULL);
@@ -394,13 +394,13 @@ static void RemoveExtraStartMenuWindows(void)
{
if (GetSafariZoneFlag())
{
- sub_8198070(sSafariBallsWindowId, FALSE);
+ ClearStdWindowAndFrameToTransparent(sSafariBallsWindowId, FALSE);
CopyWindowToVram(sSafariBallsWindowId, 2);
RemoveWindow(sSafariBallsWindowId);
}
if (InBattlePyramid())
{
- sub_8198070(sBattlePyramidFloorWindowId, FALSE);
+ ClearStdWindowAndFrameToTransparent(sBattlePyramidFloorWindowId, FALSE);
RemoveWindow(sBattlePyramidFloorWindowId);
}
}
@@ -451,7 +451,7 @@ static bool32 InitStartMenuStep(void)
break;
case 2:
sub_81973A4();
- NewMenuHelpers_DrawStdWindowFrame(sub_81979C4(sNumStartMenuActions), FALSE);
+ DrawStdWindowFrame(sub_81979C4(sNumStartMenuActions), FALSE);
sUnknown_02037619[1] = 0;
sUnknown_02037619[0]++;
break;
@@ -743,7 +743,7 @@ static bool8 StartMenuBattlePyramidRetireCallback(void)
void sub_809FDD4(void)
{
- sub_8197DF8(0, FALSE);
+ ClearDialogWindowAndFrameToTransparent(0, FALSE);
ScriptUnfreezeEventObjects();
CreateStartMenuTask(sub_809FA34);
ScriptContext2_Enable();
@@ -779,13 +779,13 @@ static bool8 SaveCallback(void)
case SAVE_IN_PROGRESS:
return FALSE;
case SAVE_CANCELED: // Back to start menu
- sub_8197DF8(0, FALSE);
+ ClearDialogWindowAndFrameToTransparent(0, FALSE);
InitStartMenu();
gMenuCallback = HandleStartMenuInput;
return FALSE;
case SAVE_SUCCESS:
case SAVE_ERROR: // Close start menu
- sub_8197DF8(0, TRUE);
+ ClearDialogWindowAndFrameToTransparent(0, TRUE);
ScriptUnfreezeEventObjects();
ScriptContext2_Disable();
SoftResetInBattlePyramid();
@@ -822,7 +822,7 @@ static bool8 BattlePyramidRetireCallback(void)
case SAVE_IN_PROGRESS:
return FALSE;
case SAVE_CANCELED: // Yes (Retire from battle pyramid)
- sub_8197DF8(0, TRUE);
+ ClearDialogWindowAndFrameToTransparent(0, TRUE);
ScriptUnfreezeEventObjects();
ScriptContext2_Disable();
ScriptContext1_SetupScript(BattleFrontier_BattlePyramidEmptySquare_EventScript_252C88);
@@ -889,7 +889,7 @@ static void SaveGameTask(u8 taskId)
static void sub_80A0014(void)
{
- sub_8197434(0, TRUE);
+ ClearDialogWindowAndFrame(0, TRUE);
}
static void HideSaveInfoWindow(void)
@@ -935,7 +935,7 @@ static bool8 SaveErrorTimer(void)
static u8 SaveConfirmSaveCallback(void)
{
- sub_819746C(GetStartMenuWindowId(), FALSE);
+ ClearStdWindowAndFrame(GetStartMenuWindowId(), FALSE);
RemoveStartMenuWindow();
ShowSaveInfoWindow();
@@ -953,7 +953,7 @@ static u8 SaveConfirmSaveCallback(void)
static u8 SaveYesNoCallback(void)
{
- DisplayYesNoMenu(); // Show Yes/No menu
+ DisplayYesNoMenuDefaultYes(); // Show Yes/No menu
sSaveDialogCallback = SaveConfirmInputCallback;
return SAVE_IN_PROGRESS;
}
@@ -994,7 +994,7 @@ static u8 SaveFileExistsCallback(void)
{
if (gDifferentSaveFile == TRUE)
{
- ShowSaveMessage(gText_DifferentSaveFile, SaveConfirmOverwriteNoCallback);
+ ShowSaveMessage(gText_DifferentSaveFile, SaveConfirmOverwriteDefaultNoCallback);
}
else
{
@@ -1004,16 +1004,16 @@ static u8 SaveFileExistsCallback(void)
return SAVE_IN_PROGRESS;
}
-static u8 SaveConfirmOverwriteNoCallback(void)
+static u8 SaveConfirmOverwriteDefaultNoCallback(void)
{
- sub_8197948(1); // Show Yes/No menu (No selected as default)
+ DisplayYesNoMenuWithDefault(1); // Show Yes/No menu (No selected as default)
sSaveDialogCallback = SaveOverwriteInputCallback;
return SAVE_IN_PROGRESS;
}
static u8 SaveConfirmOverwriteCallback(void)
{
- DisplayYesNoMenu(); // Show Yes/No menu
+ DisplayYesNoMenuDefaultYes(); // Show Yes/No menu
sSaveDialogCallback = SaveOverwriteInputCallback;
return SAVE_IN_PROGRESS;
}
@@ -1127,7 +1127,7 @@ static void InitBattlePyramidRetire(void)
static u8 BattlePyramidConfirmRetireCallback(void)
{
- sub_819746C(GetStartMenuWindowId(), FALSE);
+ ClearStdWindowAndFrame(GetStartMenuWindowId(), FALSE);
RemoveStartMenuWindow();
ShowSaveMessage(gText_BattlePyramidConfirmRetire, BattlePyramidRetireYesNoCallback);
@@ -1136,7 +1136,7 @@ static u8 BattlePyramidConfirmRetireCallback(void)
static u8 BattlePyramidRetireYesNoCallback(void)
{
- sub_8197948(1); // Show Yes/No menu (No selected as default)
+ DisplayYesNoMenuWithDefault(1); // Show Yes/No menu (No selected as default)
sSaveDialogCallback = BattlePyramidRetireInputCallback;
return SAVE_IN_PROGRESS;
@@ -1224,7 +1224,7 @@ static void sub_80A0550(u8 taskId)
switch (*step)
{
case 0:
- FillWindowPixelBuffer(0, 17);
+ FillWindowPixelBuffer(0, PIXEL_FILL(1));
AddTextPrinterParameterized2(0,
1,
gText_SavingDontTurnOffPower,
@@ -1305,7 +1305,7 @@ static void ShowSaveInfoWindow(void)
}
sSaveInfoWindowId = AddWindow(&saveInfoWindow);
- NewMenuHelpers_DrawStdWindowFrame(sSaveInfoWindowId, FALSE);
+ DrawStdWindowFrame(sSaveInfoWindowId, FALSE);
gender = gSaveBlock2Ptr->playerGender;
color = TEXT_COLOR_RED; // Red when female, blue when male.
@@ -1356,7 +1356,7 @@ static void ShowSaveInfoWindow(void)
static void RemoveSaveInfoWindow(void)
{
- sub_819746C(sSaveInfoWindowId, FALSE);
+ ClearStdWindowAndFrame(sSaveInfoWindowId, FALSE);
RemoveWindow(sSaveInfoWindowId);
}
@@ -1378,7 +1378,7 @@ void sub_80A08CC(void) // Referenced in data/specials.inc and data/scripts/maps/
static void HideStartMenuWindow(void)
{
- sub_819746C(GetStartMenuWindowId(), TRUE);
+ ClearStdWindowAndFrame(GetStartMenuWindowId(), TRUE);
RemoveStartMenuWindow();
ScriptUnfreezeEventObjects();
ScriptContext2_Disable();
diff --git a/src/starter_choose.c b/src/starter_choose.c
index 5a8de3b4a..4ed53539f 100644
--- a/src/starter_choose.c
+++ b/src/starter_choose.c
@@ -469,7 +469,7 @@ static void MainCallback2_StarterChoose(void)
static void Task_StarterChoose1(u8 taskId)
{
CreateStarterPokemonLabel(gTasks[taskId].tStarterSelection);
- SetWindowBorderStyle(0, FALSE, 0x2A8, 0xD);
+ DrawStdFrameWithCustomTileAndPalette(0, FALSE, 0x2A8, 0xD);
AddTextPrinterParameterized(0, 1, gText_BirchInTrouble, 0, 1, 0, NULL);
PutWindowTilemap(0);
schedule_bg_copy_tilemap_to_vram(0);
@@ -523,7 +523,7 @@ static void Task_StarterChoose3(u8 taskId)
static void Task_StarterChoose4(u8 taskId)
{
PlayCry1(GetStarterPokemon(gTasks[taskId].tStarterSelection), 0);
- FillWindowPixelBuffer(0, 0x11);
+ FillWindowPixelBuffer(0, PIXEL_FILL(1));
AddTextPrinterParameterized(0, 1, gText_ConfirmStarterChoice, 0, 1, 0, NULL);
schedule_bg_copy_tilemap_to_vram(0);
CreateYesNoMenu(&gUnknown_085B1DDC, 0x2A8, 0xD, 0);
@@ -579,7 +579,7 @@ static void CreateStarterPokemonLabel(u8 selection)
winTemplate.tilemapTop = gStarterChoose_LabelCoords[selection][1];
sStarterChooseWindowId = AddWindow(&winTemplate);
- FillWindowPixelBuffer(sStarterChooseWindowId, 0);
+ FillWindowPixelBuffer(sStarterChooseWindowId, PIXEL_FILL(0));
width = GetStringCenterAlignXOffset(7, text, 0x68);
AddTextPrinterParameterized3(sStarterChooseWindowId, 7, width, 1, gUnknown_085B1E0C, 0, text);
@@ -600,7 +600,7 @@ static void CreateStarterPokemonLabel(u8 selection)
static void sub_8134604(void)
{
- FillWindowPixelBuffer(sStarterChooseWindowId, 0);
+ FillWindowPixelBuffer(sStarterChooseWindowId, PIXEL_FILL(0));
ClearWindowTilemap(sStarterChooseWindowId);
RemoveWindow(sStarterChooseWindowId);
sStarterChooseWindowId = 0xFF;
diff --git a/src/text.c b/src/text.c
index bdc0f14f7..be4bf2697 100644
--- a/src/text.c
+++ b/src/text.c
@@ -1577,7 +1577,7 @@ u16 RenderText(struct TextPrinter *textPrinter)
textPrinter->printerTemplate.currentChar++;
return 2;
case 15:
- FillWindowPixelBuffer(textPrinter->printerTemplate.windowId, textPrinter->printerTemplate.bgColor | textPrinter->printerTemplate.bgColor << 4);
+ FillWindowPixelBuffer(textPrinter->printerTemplate.windowId, PIXEL_FILL(textPrinter->printerTemplate.bgColor));
textPrinter->printerTemplate.currentX = textPrinter->printerTemplate.x;
textPrinter->printerTemplate.currentY = textPrinter->printerTemplate.y;
return 2;
@@ -1698,7 +1698,7 @@ u16 RenderText(struct TextPrinter *textPrinter)
case 2:
if (TextPrinterWaitWithDownArrow(textPrinter))
{
- FillWindowPixelBuffer(textPrinter->printerTemplate.windowId, (textPrinter->printerTemplate.bgColor << 4) | textPrinter->printerTemplate.bgColor);
+ FillWindowPixelBuffer(textPrinter->printerTemplate.windowId, PIXEL_FILL(textPrinter->printerTemplate.bgColor));
textPrinter->printerTemplate.currentX = textPrinter->printerTemplate.x;
textPrinter->printerTemplate.currentY = textPrinter->printerTemplate.y;
textPrinter->state = 0;
@@ -1720,12 +1720,12 @@ u16 RenderText(struct TextPrinter *textPrinter)
int speed = gWindowVerticalScrollSpeeds[scrollSpeed];
if (textPrinter->scrollDistance < speed)
{
- ScrollWindow(textPrinter->printerTemplate.windowId, 0, textPrinter->scrollDistance, textPrinter->printerTemplate.bgColor << 4 | textPrinter->printerTemplate.bgColor);
+ ScrollWindow(textPrinter->printerTemplate.windowId, 0, textPrinter->scrollDistance, PIXEL_FILL(textPrinter->printerTemplate.bgColor));
textPrinter->scrollDistance = 0;
}
else
{
- ScrollWindow(textPrinter->printerTemplate.windowId, 0, speed, textPrinter->printerTemplate.bgColor << 4 | textPrinter->printerTemplate.bgColor);
+ ScrollWindow(textPrinter->printerTemplate.windowId, 0, speed, PIXEL_FILL(textPrinter->printerTemplate.bgColor));
textPrinter->scrollDistance -= speed;
}
CopyWindowToVram(textPrinter->printerTemplate.windowId, 2);
diff --git a/src/time_events.c b/src/time_events.c
index 9702d321f..bd51f0c2d 100644
--- a/src/time_events.c
+++ b/src/time_events.c
@@ -81,7 +81,7 @@ void UpdateShoalTideFlag(void)
1, // 23
};
- if (is_map_type_1_2_3_5_or_6(GetLastUsedWarpMapType()))
+ if (IsMapTypeOutdoors(GetLastUsedWarpMapType()))
{
RtcCalcLocalTime();
if (tide[gLocalTime.hours])
diff --git a/src/trade.c b/src/trade.c
index 849442ae0..9a9828f34 100644
--- a/src/trade.c
+++ b/src/trade.c
@@ -1418,7 +1418,7 @@ static void sub_80772A4(void)
for (i = 0; i < 18; i++)
{
ClearWindowTilemap(i);
- FillWindowPixelBuffer(i, 0);
+ FillWindowPixelBuffer(i, PIXEL_FILL(0));
}
FillBgTilemapBufferRect(0, 0, 0, 0, 30, 20, 15);
@@ -2461,7 +2461,7 @@ static void sub_8078DBC(void)
if (gUnknown_0203229C->tradeMenuCursorPosition < 6)
{
sub_8098858(1, 1, 14);
- FillWindowPixelBuffer(1, 0x11);
+ FillWindowPixelBuffer(1, PIXEL_FILL(1));
PrintMenuTable(1, 2, gUnknown_0832DEAC);
InitMenuInUpperLeftCornerPlaySoundWhenAPressed(1, 2, 0);
PutWindowTilemap(1);
@@ -2724,7 +2724,7 @@ static void sub_8079408(void)
for (i = 0; i < 4; i++)
{
- FillWindowPixelBuffer(i + 14, 0);
+ FillWindowPixelBuffer(i + 14, PIXEL_FILL(0));
rbox_fill_rectangle(i + 14);
}
@@ -3256,7 +3256,7 @@ static void sub_807A0C4(void)
static void sub_807A19C(u8 a0)
{
- FillWindowPixelBuffer(0, 0x11);
+ FillWindowPixelBuffer(0, PIXEL_FILL(1));
AddTextPrinterParameterized(0, 1, gUnknown_0832DEBC[a0], 0, 1, TEXT_SPEED_FF, NULL);
sub_8098858(0, 20, 12);
PutWindowTilemap(0);
@@ -4185,7 +4185,7 @@ void sub_807B140(void)
void sub_807B154(void)
{
- FillWindowPixelBuffer(0, 0xFF);
+ FillWindowPixelBuffer(0, PIXEL_FILL(15));
PutWindowTilemap(0);
CopyWindowToVram(0, 3);
}
@@ -4263,7 +4263,7 @@ static void sub_807B270(void)
break;
case 8:
sub_807ACFC(1, 1);
- FillWindowPixelBuffer(0, 0xFF);
+ FillWindowPixelBuffer(0, PIXEL_FILL(15));
PutWindowTilemap(0);
CopyWindowToVram(0, 3);
gMain.state++;
@@ -4654,7 +4654,7 @@ static bool8 sub_807BBEC(void)
if (!gPaletteFade.active)
{
sub_807B62C(4);
- FillWindowPixelBuffer(0, 0xFF);
+ FillWindowPixelBuffer(0, PIXEL_FILL(15));
CopyWindowToVram(0, 3);
gUnknown_020322A0->state++;
}
@@ -5146,7 +5146,7 @@ static bool8 sub_807CFC8(void)
if (!gPaletteFade.active)
{
sub_807B62C(4);
- FillWindowPixelBuffer(0, 0xFF);
+ FillWindowPixelBuffer(0, PIXEL_FILL(15));
CopyWindowToVram(0, 3);
gUnknown_020322A0->state++;
}
@@ -6085,7 +6085,7 @@ void sub_807F19C(void)
void sub_807F1A8(u8 windowId, const u8 *str, u8 speed)
{
- FillWindowPixelBuffer(windowId, 0xFF);
+ FillWindowPixelBuffer(windowId, PIXEL_FILL(15));
gUnknown_020322A0->unk_F6[0] = 15;
gUnknown_020322A0->unk_F6[1] = 1;
gUnknown_020322A0->unk_F6[2] = 6;
diff --git a/src/trader.c b/src/trader.c
index b5c159fb9..97bc4626f 100644
--- a/src/trader.c
+++ b/src/trader.c
@@ -73,7 +73,7 @@ void CreateAvailableDecorationsMenu(u8 taskId)
}
windowTemplate.width = convert_pixel_width_to_tile_width(windowWidth);
data[3] = AddWindow(&windowTemplate);
- SetWindowBorderStyle(data[3], FALSE, 0x214, 14);
+ DrawStdFrameWithCustomTileAndPalette(data[3], FALSE, 0x214, 14);
for (i = 0; i < 4; i++)
{
if (trader->decorIds[i] > NUM_DECORATIONS)
@@ -98,7 +98,7 @@ void sub_8133BE4(u8 taskId, u8 decorationId)
gSpecialVar_0x8004 = decorationId;
}
- sub_8198070(data[3], FALSE);
+ ClearStdWindowAndFrameToTransparent(data[3], FALSE);
ClearWindowTilemap(data[3]);
RemoveWindow(data[3]);
schedule_bg_copy_tilemap_to_vram(0);
diff --git a/src/trainer_card.c b/src/trainer_card.c
index 41bf71cd3..01839d598 100755
--- a/src/trainer_card.c
+++ b/src/trainer_card.c
@@ -348,7 +348,7 @@ static void sub_80C2760(u8 taskId)
case 0:
if (!IsDma3ManagerBusyWithBgCopy())
{
- FillWindowPixelBuffer(1, 0);
+ FillWindowPixelBuffer(1, PIXEL_FILL(0));
sData->var_0++;
}
break;
@@ -361,7 +361,7 @@ static void sub_80C2760(u8 taskId)
sData->var_0++;
break;
case 3:
- FillWindowPixelBuffer(2, 0);
+ FillWindowPixelBuffer(2, PIXEL_FILL(0));
sub_80C4FF0();
sub_80C438C(2);
sData->var_0++;
@@ -467,7 +467,7 @@ static void sub_80C2760(u8 taskId)
break;
case 15:
sub_800AC34();
- NewMenuHelpers_DrawDialogueFrame(0, 1);
+ DrawDialogueFrame(0, 1);
AddTextPrinterParameterized(0, 1, gText_WaitingTrainerFinishReading, 0, 1, 255, 0);
CopyWindowToVram(0, 3);
sData->var_0 = 16;
@@ -1101,7 +1101,7 @@ static void PrintTimeOnCard(void)
r10 = width + 30;
r7 -= r10;
- FillWindowPixelRect(1, 0, r7, r4, r10, 15);
+ FillWindowPixelRect(1, PIXEL_FILL(0), r7, r4, r10, 15);
ConvertIntToDecimalStringN(gStringVar4, hours, 1, 3);
AddTextPrinterParameterized3(1, 1, r7, r4, gUnknown_0856FB0C, TEXT_SPEED_FF, gStringVar4);
r7 += 18;
@@ -1632,7 +1632,7 @@ static bool8 sub_80C4B08(struct Task* task)
switch (sData->var_4)
{
case 0:
- FillWindowPixelBuffer(1, 0);
+ FillWindowPixelBuffer(1, PIXEL_FILL(0));
FillBgTilemapBufferRect_Palette0(3, 0, 0, 0, 0x20, 0x20);
break;
case 1:
@@ -1657,7 +1657,7 @@ static bool8 sub_80C4B08(struct Task* task)
if (!sData->var_8)
sub_80C474C();
else
- FillWindowPixelBuffer(2, 0);
+ FillWindowPixelBuffer(2, PIXEL_FILL(0));
break;
case 4:
if (sData->var_8)
diff --git a/src/trainer_hill.c b/src/trainer_hill.c
index 42b196abd..43b29e26e 100644
--- a/src/trainer_hill.c
+++ b/src/trainer_hill.c
@@ -30,6 +30,7 @@
#include "constants/species.h"
#include "constants/trainers.h"
#include "constants/easy_chat.h"
+#include "constants/trainer_hill.h"
extern bool32 sub_81D3B34(void);
@@ -92,16 +93,16 @@ struct TrHillStruct2
// EWRAM
static EWRAM_DATA struct TrHillStruct2 *sHillData = NULL;
static EWRAM_DATA struct TrHillRoomTrainers *sRoomTrainers = NULL;
-EWRAM_DATA u32 *gUnknown_0203CF5C = NULL;
+EWRAM_DATA u32 *gTrainerHillVBlankCounter = NULL;
// This file's functions.
-static void sub_81D581C(void);
+static void TrainerHillStartChallenge(void);
static void sub_81D58D8(void);
static void sub_81D5924(void);
static void sub_81D59D0(void);
-static void sub_81D5A70(void);
-static void sub_81D5AB4(void);
-static void sub_81D5AD0(void);
+static void TrainerHillResumeTimer(void);
+static void TrainerHillSetPlayerLost(void);
+static void TrainerHillGetChallengeStatus(void);
static void sub_81D5B2C(void);
static void sub_81D5BBC(void);
static void sub_81D5C00(void);
@@ -112,7 +113,7 @@ static void sub_81D64DC(void);
static void sub_81D64FC(void);
static void sub_81D6518(void);
static void sub_81D6568(void);
-static void sub_81D65A0(void);
+static void TrainerHillSetTag(void);
static void SetUpDataStruct(void);
static void FreeDataStruct(void);
static void nullsub_2(void);
@@ -263,13 +264,13 @@ static const u8 *const sFloorStrings[] =
static void (* const sHillFunctions[])(void) =
{
- sub_81D581C,
+ TrainerHillStartChallenge,
sub_81D58D8,
sub_81D5924,
sub_81D59D0,
- sub_81D5A70,
- sub_81D5AB4,
- sub_81D5AD0,
+ TrainerHillResumeTimer,
+ TrainerHillSetPlayerLost,
+ TrainerHillGetChallengeStatus,
sub_81D5B2C,
sub_81D5BBC,
sub_81D5C00,
@@ -280,7 +281,7 @@ static void (* const sHillFunctions[])(void) =
sub_81D64FC,
sub_81D6518,
sub_81D6568,
- sub_81D65A0,
+ TrainerHillSetTag,
};
static const u8 *const sTagMatchStrings[] =
@@ -318,7 +319,7 @@ void ResetTrainerHillResults(void)
gSaveBlock2Ptr->frontier.field_EF9_1 = 0;
gSaveBlock2Ptr->frontier.field_EF9_0 = 0;
- gSaveBlock1Ptr->trainerHill.field_3D68 = 0;
+ gSaveBlock1Ptr->trainerHill.bestTime = 0;
for (i = 0; i < 4; i++)
SetTimerValue(&gSaveBlock1Ptr->trainerHillTimes[i], HILL_MAX_TIME);
}
@@ -371,7 +372,7 @@ void InitTrainerHillBattleStruct(void)
}
sRoomTrainers->facilityClass[i] = sHillData->tag.floors[sHillData->floorId].trainers[i].facilityClass;
}
- sub_80008DC(&gSaveBlock1Ptr->trainerHill.field_3D64);
+ SetTrainerHillVBlankCounter(&gSaveBlock1Ptr->trainerHill.timer);
FreeDataStruct();
}
@@ -425,7 +426,7 @@ void CopyTrainerHillTrainerText(u8 which, u16 trainerId)
FreeDataStruct();
}
-static void sub_81D581C(void)
+static void TrainerHillStartChallenge(void)
{
nullsub_2();
if (!sub_81D3B34())
@@ -434,11 +435,11 @@ static void sub_81D581C(void)
gSaveBlock1Ptr->trainerHill.field_3D6E_0f = 0;
gSaveBlock1Ptr->trainerHill.field_3D6C = 0;
- sub_80008DC(&gSaveBlock1Ptr->trainerHill.field_3D64);
- gSaveBlock1Ptr->trainerHill.field_3D64 = 0;
+ SetTrainerHillVBlankCounter(&gSaveBlock1Ptr->trainerHill.timer);
+ gSaveBlock1Ptr->trainerHill.timer = 0;
gSaveBlock1Ptr->trainerHill.field_3D6E_0c = 0;
gSaveBlock1Ptr->trainerHill.field_3D6E_0b = 0;
- gSaveBlock1Ptr->trainerHill.field_3D6E_0e = 0;
+ gSaveBlock1Ptr->trainerHill.maybeECardScanDuringChallenge = 0;
gSaveBlock2Ptr->frontier.field_EE0 = 0;
gBattleOutcome = 0;
gSaveBlock1Ptr->trainerHill.field_3D6E_0a = 0;
@@ -446,7 +447,7 @@ static void sub_81D581C(void)
static void sub_81D58D8(void)
{
- sub_80008E8();
+ ClearTrainerHillVBlankCounter();
gSpecialVar_Result = 0;
if (gSaveBlock1Ptr->trainerHill.field_3D6E_0c)
gSpecialVar_Result++;
@@ -483,10 +484,10 @@ static void sub_81D59D0(void)
{
gSpecialVar_Result = 2;
}
- else if (GetTimerValue(&gSaveBlock1Ptr->trainerHill.field_3D68) > gSaveBlock1Ptr->trainerHill.field_3D64)
+ else if (GetTimerValue(&gSaveBlock1Ptr->trainerHill.bestTime) > gSaveBlock1Ptr->trainerHill.timer)
{
- SetTimerValue(&gSaveBlock1Ptr->trainerHill.field_3D68, gSaveBlock1Ptr->trainerHill.field_3D64);
- gSaveBlock1Ptr->trainerHillTimes[gSaveBlock1Ptr->trainerHill.tag] = gSaveBlock1Ptr->trainerHill.field_3D68;
+ SetTimerValue(&gSaveBlock1Ptr->trainerHill.bestTime, gSaveBlock1Ptr->trainerHill.timer);
+ gSaveBlock1Ptr->trainerHillTimes[gSaveBlock1Ptr->trainerHill.tag] = gSaveBlock1Ptr->trainerHill.bestTime;
gSpecialVar_Result = 0;
}
else
@@ -497,37 +498,40 @@ static void sub_81D59D0(void)
gSaveBlock1Ptr->trainerHill.field_3D6E_0b = 1;
}
-static void sub_81D5A70(void)
+static void TrainerHillResumeTimer(void)
{
if (!gSaveBlock1Ptr->trainerHill.field_3D6E_0c)
{
- if (gSaveBlock1Ptr->trainerHill.field_3D64 >= HILL_MAX_TIME)
- gSaveBlock1Ptr->trainerHill.field_3D64 = HILL_MAX_TIME;
+ if (gSaveBlock1Ptr->trainerHill.timer >= HILL_MAX_TIME)
+ gSaveBlock1Ptr->trainerHill.timer = HILL_MAX_TIME;
else
- sub_80008DC(&gSaveBlock1Ptr->trainerHill.field_3D64);
+ SetTrainerHillVBlankCounter(&gSaveBlock1Ptr->trainerHill.timer);
}
}
-static void sub_81D5AB4(void)
+static void TrainerHillSetPlayerLost(void)
{
- gSaveBlock1Ptr->trainerHill.field_3D6E_0d = 1;
+ gSaveBlock1Ptr->trainerHill.hasLost = 1;
}
-static void sub_81D5AD0(void)
+static void TrainerHillGetChallengeStatus(void)
{
- if (gSaveBlock1Ptr->trainerHill.field_3D6E_0d)
+ if (gSaveBlock1Ptr->trainerHill.hasLost)
{
- gSaveBlock1Ptr->trainerHill.field_3D6E_0d = 0;
- gSpecialVar_Result = 0;
+ // The player lost their last match.
+ gSaveBlock1Ptr->trainerHill.hasLost = 0;
+ gSpecialVar_Result = TRAINER_HILL_PLAYER_STATUS_LOST;
}
- else if (gSaveBlock1Ptr->trainerHill.field_3D6E_0e)
+ else if (gSaveBlock1Ptr->trainerHill.maybeECardScanDuringChallenge)
{
- gSaveBlock1Ptr->trainerHill.field_3D6E_0e = 0;
- gSpecialVar_Result = 1;
+ // Unreachable code. Something relating to eCards?
+ gSaveBlock1Ptr->trainerHill.maybeECardScanDuringChallenge = 0;
+ gSpecialVar_Result = TRAINER_HILL_PLAYER_STATUS_ECARD_SCANNED;
}
else
{
- gSpecialVar_Result = 2;
+ // Continue playing.
+ gSpecialVar_Result = TRAINER_HILL_PLAYER_STATUS_NORMAL;
}
}
@@ -535,7 +539,7 @@ static void sub_81D5B2C(void)
{
s32 total, minutes, secondsWhole, secondsFraction;
- total = gSaveBlock1Ptr->trainerHill.field_3D64;
+ total = gSaveBlock1Ptr->trainerHill.timer;
if (total >= HILL_MAX_TIME)
total = HILL_MAX_TIME;
@@ -575,7 +579,7 @@ static void sub_81D5C00(void)
bool8 sub_81D5C18(void)
{
- if (VarGet(VAR_0x40D6) == 0)
+ if (VarGet(VAR_TRAINER_HILL_IS_ACTIVE) == 0)
return FALSE;
else if (gSaveBlock1Ptr->trainerHill.field_3D6E_0c)
return FALSE;
@@ -609,7 +613,7 @@ void PrintOnTrainerHillRecordsWindow(void)
u32 total, minutes, secondsWhole, secondsFraction;
SetUpDataStruct();
- FillWindowPixelBuffer(0, 0);
+ FillWindowPixelBuffer(0, PIXEL_FILL(0));
x = GetStringCenterAlignXOffset(1, gText_TimeBoard, 0xD0);
AddTextPrinterParameterized3(0, 1, x, 2, sRecordWinColors, TEXT_SPEED_FF, gText_TimeBoard);
@@ -1048,16 +1052,16 @@ bool32 sub_81D6534(void)
static void sub_81D6568(void)
{
- if (gSaveBlock1Ptr->trainerHill.field_3D6E_0d)
+ if (gSaveBlock1Ptr->trainerHill.hasLost)
gSpecialVar_Result = 0;
else
gSpecialVar_Result = 1;
}
-static void sub_81D65A0(void)
+static void TrainerHillSetTag(void)
{
gSaveBlock1Ptr->trainerHill.tag = gSpecialVar_0x8005;
- gSaveBlock1Ptr->trainerHill.field_3D68 = gSaveBlock1Ptr->trainerHillTimes[gSpecialVar_0x8005];
+ gSaveBlock1Ptr->trainerHill.bestTime = gSaveBlock1Ptr->trainerHillTimes[gSpecialVar_0x8005];
}
static u8 sub_81D65E8(u8 arg0)
@@ -1103,7 +1107,7 @@ static u16 sub_81D6640(void)
i = (i + 1) % 10;
ptr = gUnknown_0862A5CC[var2][i];
- minutes = (signed)(gSaveBlock1Ptr->trainerHill.field_3D64) / (60 * 60);
+ minutes = (signed)(gSaveBlock1Ptr->trainerHill.timer) / (60 * 60);
if (minutes < 12)
id = 0;
else if (minutes < 13)
diff --git a/src/tv.c b/src/tv.c
index cfa49d7df..17243a456 100644
--- a/src/tv.c
+++ b/src/tv.c
@@ -2566,13 +2566,13 @@ void sub_80EEA70(void)
show->secretBaseSecrets.kind = TVSHOW_SECRET_BASE_SECRETS;
show->secretBaseSecrets.active = FALSE;
StringCopy(show->secretBaseSecrets.playerName, gSaveBlock2Ptr->playerName);
- show->secretBaseSecrets.stepsInBase = VarGet(VAR_0x40EC);
+ show->secretBaseSecrets.stepsInBase = VarGet(VAR_SECRET_BASE_STEP_COUNTER);
sub_80E980C();
StringCopy(strbuf, gStringVar1);
StripExtCtrlCodes(strbuf);
StringCopy(show->secretBaseSecrets.baseOwnersName, strbuf);
- show->secretBaseSecrets.item = VarGet(VAR_0x40ED);
- show->secretBaseSecrets.flags = VarGet(VAR_0x40EE) + (VarGet(VAR_0x40EF) << 16);
+ show->secretBaseSecrets.item = VarGet(VAR_SECRET_BASE_LAST_ITEM_USED);
+ show->secretBaseSecrets.flags = VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) + (VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) << 16);
tv_store_id_3x(show);
show->secretBaseSecrets.language = gGameLanguage;
if (show->secretBaseSecrets.language == LANGUAGE_JAPANESE || gSaveBlock1Ptr->secretBases[VarGet(VAR_CURRENT_SECRET_BASE)].language == LANGUAGE_JAPANESE)
@@ -7351,7 +7351,7 @@ static void DoTVShowWhatsNo1InHoennToday(void)
ShowFieldMessage(sTVWhatsNo1InHoennTodayTextGroup[state]);
}
-u8 sub_80F5180(TVShow *show)
+u8 TVShowGetFlagCount(TVShow *show)
{
u8 i;
u8 tot;
@@ -7366,7 +7366,7 @@ u8 sub_80F5180(TVShow *show)
return tot;
}
-u8 sub_80F51AC(TVShow *show, u8 a1)
+u8 TVShowGetStateForFlagNumber(TVShow *show, u8 a1)
{
u8 i;
u8 tot;
@@ -7400,7 +7400,7 @@ static void DoTVShowSecretBaseSecrets(void)
case 0:
TVShowConvertInternationalString(gStringVar1, show->secretBaseSecrets.baseOwnersName, show->secretBaseSecrets.baseOwnersNameLanguage);
TVShowConvertInternationalString(gStringVar2, show->secretBaseSecrets.playerName, show->secretBaseSecrets.language);
- bitCount = sub_80F5180(show);
+ bitCount = TVShowGetFlagCount(show);
if (bitCount == 0)
{
sTVShowState = 8;
@@ -7409,12 +7409,12 @@ static void DoTVShowSecretBaseSecrets(void)
{
show->secretBaseSecrets.savedState = 1;
sTVSecretBaseSecretsRandomValues[0] = Random() % bitCount;
- sTVShowState = sub_80F51AC(show, sTVSecretBaseSecretsRandomValues[0]);
+ sTVShowState = TVShowGetStateForFlagNumber(show, sTVSecretBaseSecretsRandomValues[0]);
}
break;
case 1:
TVShowConvertInternationalString(gStringVar2, show->secretBaseSecrets.playerName, show->secretBaseSecrets.language);
- bitCount = sub_80F5180(show);
+ bitCount = TVShowGetFlagCount(show);
switch (bitCount)
{
case 1:
@@ -7424,11 +7424,11 @@ static void DoTVShowSecretBaseSecrets(void)
show->secretBaseSecrets.savedState = 2;
if (sTVSecretBaseSecretsRandomValues[0] == 0)
{
- sTVShowState = sub_80F51AC(show, 1);
+ sTVShowState = TVShowGetStateForFlagNumber(show, 1);
}
else
{
- sTVShowState = sub_80F51AC(show, 0);
+ sTVShowState = TVShowGetStateForFlagNumber(show, 0);
}
break;
default:
@@ -7441,13 +7441,13 @@ static void DoTVShowSecretBaseSecrets(void)
}
}
show->secretBaseSecrets.savedState = 2;
- sTVShowState = sub_80F51AC(show, sTVSecretBaseSecretsRandomValues[1]);
+ sTVShowState = TVShowGetStateForFlagNumber(show, sTVSecretBaseSecretsRandomValues[1]);
break;
}
break;
case 2:
TVShowConvertInternationalString(gStringVar2, show->secretBaseSecrets.playerName, show->secretBaseSecrets.language);
- bitCount = sub_80F5180(show);
+ bitCount = TVShowGetFlagCount(show);
if (bitCount == 2)
{
sTVShowState = 9;
@@ -7463,7 +7463,7 @@ static void DoTVShowSecretBaseSecrets(void)
}
}
show->secretBaseSecrets.savedState = 3;
- sTVShowState = sub_80F51AC(show, sTVSecretBaseSecretsRandomValues[2]);
+ sTVShowState = TVShowGetStateForFlagNumber(show, sTVSecretBaseSecretsRandomValues[2]);
}
break;
case 3:
diff --git a/src/unk_text_util_2.c b/src/unk_text_util_2.c
index 530bd4085..02648bf93 100644
--- a/src/unk_text_util_2.c
+++ b/src/unk_text_util_2.c
@@ -114,7 +114,7 @@ u16 Font6Func(struct TextPrinter *textPrinter)
textPrinter->printerTemplate.currentY = textPrinter->printerTemplate.y + *textPrinter->printerTemplate.currentChar++;
return 2;
case 15:
- FillWindowPixelBuffer(textPrinter->printerTemplate.windowId, textPrinter->printerTemplate.bgColor | (textPrinter->printerTemplate.bgColor << 4));
+ FillWindowPixelBuffer(textPrinter->printerTemplate.windowId, PIXEL_FILL(textPrinter->printerTemplate.bgColor));
return 2;
}
break;
@@ -146,7 +146,7 @@ u16 Font6Func(struct TextPrinter *textPrinter)
case 2:
if (TextPrinterWaitWithDownArrow(textPrinter))
{
- FillWindowPixelBuffer(textPrinter->printerTemplate.windowId, textPrinter->printerTemplate.bgColor | (textPrinter->printerTemplate.bgColor << 4));
+ FillWindowPixelBuffer(textPrinter->printerTemplate.windowId, PIXEL_FILL(textPrinter->printerTemplate.bgColor));
textPrinter->printerTemplate.currentX = textPrinter->printerTemplate.x;
textPrinter->printerTemplate.currentY = textPrinter->printerTemplate.y;
textPrinter->state = 0;
@@ -166,12 +166,12 @@ u16 Font6Func(struct TextPrinter *textPrinter)
{
if (textPrinter->scrollDistance < sUnknown_08616124[gSaveBlock2Ptr->optionsTextSpeed])
{
- ScrollWindow(textPrinter->printerTemplate.windowId, 0, textPrinter->scrollDistance, textPrinter->printerTemplate.bgColor | (textPrinter->printerTemplate.bgColor << 4));
+ ScrollWindow(textPrinter->printerTemplate.windowId, 0, textPrinter->scrollDistance, PIXEL_FILL(textPrinter->printerTemplate.bgColor));
textPrinter->scrollDistance = 0;
}
else
{
- ScrollWindow(textPrinter->printerTemplate.windowId, 0, sUnknown_08616124[gSaveBlock2Ptr->optionsTextSpeed], textPrinter->printerTemplate.bgColor | (textPrinter->printerTemplate.bgColor << 4));
+ ScrollWindow(textPrinter->printerTemplate.windowId, 0, sUnknown_08616124[gSaveBlock2Ptr->optionsTextSpeed], PIXEL_FILL(textPrinter->printerTemplate.bgColor));
textPrinter->scrollDistance -= sUnknown_08616124[gSaveBlock2Ptr->optionsTextSpeed];
}
CopyWindowToVram(textPrinter->printerTemplate.windowId, 2);
diff --git a/src/wallclock.c b/src/wallclock.c
index 546750ba6..d3bbcf7a2 100644
--- a/src/wallclock.c
+++ b/src/wallclock.c
@@ -793,7 +793,7 @@ static void Task_SetClock2(u8 taskId)
static void Task_SetClock3(u8 taskId)
{
- SetWindowBorderStyle(0, FALSE, 0x250, 0x0d);
+ DrawStdFrameWithCustomTileAndPalette(0, FALSE, 0x250, 0x0d);
AddTextPrinterParameterized(0, 1, gText_IsThisTheCorrectTime, 0, 1, 0, NULL);
PutWindowTilemap(0);
schedule_bg_copy_tilemap_to_vram(0);
@@ -812,7 +812,7 @@ static void Task_SetClock4(u8 taskId)
case 1: //B button
case -1: //NO
PlaySE(SE_SELECT);
- sub_8198070(0, FALSE);
+ ClearStdWindowAndFrameToTransparent(0, FALSE);
ClearWindowTilemap(0);
gTasks[taskId].func = Task_SetClock2;
break;
diff --git a/src/window.c b/src/window.c
index 3da529178..fbce57743 100644
--- a/src/window.c
+++ b/src/window.c
@@ -6,7 +6,8 @@
u32 filler_03002F58;
u32 filler_03002F5C;
-u8 gUnknown_03002F60;
+// This global is set to 0 and never changed.
+u8 gTransparentTileNumber;
u32 filler_03002F64;
void *gUnknown_03002F70[4];
extern u32 gUnneededFireRedVariable;
@@ -106,7 +107,7 @@ bool16 InitWindows(const struct WindowTemplate *templates)
}
}
- gUnknown_03002F60 = 0;
+ gTransparentTileNumber = 0;
return TRUE;
}
@@ -359,13 +360,14 @@ void PutWindowRectTilemapOverridePalette(u8 windowId, u8 x, u8 y, u8 width, u8 h
}
}
+// Fills a window with transparent tiles.
void ClearWindowTilemap(u8 windowId)
{
struct Window windowLocal = gWindows[windowId];
FillBgTilemapBufferRect(
windowLocal.window.bg,
- gUnknown_03002F60,
+ gTransparentTileNumber,
windowLocal.window.tilemapLeft,
windowLocal.window.tilemapTop,
windowLocal.window.width,
@@ -451,6 +453,7 @@ void CopyToWindowPixelBuffer(u8 windowId, const void *src, u16 size, u16 tileOff
LZ77UnCompWram(src, gWindows[windowId].tileData + (0x20 * tileOffset));
}
+// Sets all pixels within the window to the fillValue color.
void FillWindowPixelBuffer(u8 windowId, u8 fillValue)
{
int fillSize = gWindows[windowId].window.width * gWindows[windowId].window.height;