Merge pull request #1074 from Sierraffinity/item-menu-cleanup

Begin item_menu.c cleanup
This commit is contained in:
Sierra A 2020-06-10 17:17:35 -07:00 committed by GitHub
commit 46f4a4bbf7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
63 changed files with 885 additions and 798 deletions

View File

@ -16,5 +16,9 @@
#define KEYITEMS_POCKET 4 #define KEYITEMS_POCKET 4
#define POCKETS_COUNT 5 #define POCKETS_COUNT 5
// The TM/HM pocket is the largest pocket, so the maximum amount of items
// in a pocket is its count + 1 for the cancel option
#define MAX_POCKET_ITEMS (BAG_TMHM_COUNT + 1)
#endif // GUARD_ITEM_CONSTANTS_H #endif // GUARD_ITEM_CONSTANTS_H

View File

@ -4,19 +4,35 @@
#include "item.h" #include "item.h"
#include "menu_helpers.h" #include "menu_helpers.h"
#define RETURN_LOCATION_FIELD 0 #define ITEMMENULOCATION_FIELD 0
#define RETURN_LOCATION_BATTLE 1 #define ITEMMENULOCATION_BATTLE 1
#define RETURN_LOCATION_POKEMON_LIST 2 #define ITEMMENULOCATION_PARTY 2
#define RETURN_LOCATION_SHOP 3 #define ITEMMENULOCATION_SHOP 3
#define RETURN_LOCATION_FIELD_2 4 #define ITEMMENULOCATION_BERRY_TREE 4
#define RETURN_LOCATION_FIELD_3 5 #define ITEMMENULOCATION_BERRY_BLENDER_CRUSH 5
#define RETURN_LOCATION_PC 6 #define ITEMMENULOCATION_ITEMPC 6
#define RETURN_LOCATION_FIELD_4 7 #define ITEMMENULOCATION_FAVOR_LADY 7
#define RETURN_LOCATION_FIELD_5 8 #define ITEMMENULOCATION_QUIZ_LADY 8
#define RETURN_LOCATION_FIELD_6 9 #define ITEMMENULOCATION_APPRENTICE 9
#define RETURN_LOCATION_BATTLE_2 10 #define ITEMMENULOCATION_WALLY 10
#define RETURN_LOCATION_PC_2 11 #define ITEMMENULOCATION_PCBOX 11
#define RETURN_LOCATION_UNCHANGED 12 #define ITEMMENULOCATION_LAST 12
#define ITEMMENUACTION_USE 0
#define ITEMMENUACTION_TOSS 1
#define ITEMMENUACTION_REGISTER 2
#define ITEMMENUACTION_GIVE 3
#define ITEMMENUACTION_CANCEL 4
#define ITEMMENUACTION_BATTLE_USE 5
#define ITEMMENUACTION_CHECK 6
#define ITEMMENUACTION_WALK 7
#define ITEMMENUACTION_DESELECT 8
#define ITEMMENUACTION_CHECK_TAG 9
#define ITEMMENUACTION_CONFIRM 10
#define ITEMMENUACTION_SHOW 11
#define ITEMMENUACTION_GIVE_2 12
#define ITEMMENUACTION_CONFIRM_2 13
#define ITEMMENUACTION_DUMMY 14
// Exported type declarations // Exported type declarations
struct BagStruct struct BagStruct
@ -33,29 +49,27 @@ extern struct BagStruct gBagPositionStruct;
struct BagMenuStruct struct BagMenuStruct
{ {
void (*mainCallback2)(void); void (*exitCallback)(void);
u8 tilemapBuffer[0x800]; u8 tilemapBuffer[0x800];
u8 spriteId[12]; u8 spriteId[12];
u8 windowPointers[7]; u8 windowPointers[7];
u8 unk817; u8 unk817;
u8 unk818; u8 unk818;
u8 unk819; u8 unk819;
u8 unk81A; u8 itemOriginalLocation;
u8 unk81B:4; u8 pocketSwitchDisabled:4;
u8 unk81B_1:2; u8 itemIconSlot:2;
u8 unk81B_3:1; u8 inhibitItemDescriptionPrint:1;
u8 hideCloseBagText:1; u8 hideCloseBagText:1;
u8 filler3[2]; u8 filler3[2];
u8 unk81E; u8 pocketScrollArrowsTask;
u8 unk81F; u8 pocketSwitchArrowsTask;
const u8* unk820; const u8* contextMenuItemsPtr;
u8 unk824; u8 contextMenuItemsBuffer[4];
u8 unk825; u8 contextMenuNumItems;
u8 filler[2];
u8 unk828;
u8 numItemStacks[POCKETS_COUNT]; u8 numItemStacks[POCKETS_COUNT];
u8 numShownItems[6]; u8 numShownItems[6];
s16 unk834; s16 graphicsLoadState;
u8 filler4[0xE]; u8 filler4[0xE];
u8 pocketNameBuffer[32][32]; u8 pocketNameBuffer[32][32];
u8 filler2[4]; u8 filler2[4];
@ -68,11 +82,11 @@ extern struct BagMenuStruct *gBagMenu;
extern u16 gSpecialVar_ItemId; extern u16 gSpecialVar_ItemId;
// Exported ROM declarations // Exported ROM declarations
void sub_81AAC14(void); void CB2_GoToItemDepositMenu(void);
void FavorLadyOpenBagMenu(void); void FavorLadyOpenBagMenu(void);
void QuizLadyOpenBagMenu(void); void QuizLadyOpenBagMenu(void);
void ApprenticeOpenBagMenu(void); void ApprenticeOpenBagMenu(void);
void sub_81AABB0(void); void CB2_BagMenuFromBattle(void);
void SetInitialScrollAndCursorPositions(u8 pocketId); void SetInitialScrollAndCursorPositions(u8 pocketId);
void CB2_ReturnToBagMenuPocket(void); void CB2_ReturnToBagMenuPocket(void);
void CB2_BagMenuFromStartMenu(void); void CB2_BagMenuFromStartMenu(void);

View File

@ -10,7 +10,7 @@ extern const struct CompressedSpritePalette gBerryCheckCirclePaletteTable;
void RemoveBagSprite(u8 id); void RemoveBagSprite(u8 id);
void AddBagVisualSprite(u8 bagPocketId); void AddBagVisualSprite(u8 bagPocketId);
void SetBagVisualPocketId(u8 bagPocketId, bool8 isSwitchingPockets); void SetBagVisualPocketId(u8 bagPocketId, bool8 isSwitchingPockets);
void ShakeBagVisual(void); void ShakeBagSprite(void);
void AddSwitchPocketRotatingBallSprite(s16 rotationDirection); void AddSwitchPocketRotatingBallSprite(s16 rotationDirection);
void AddBagItemIconSprite(u16 itemId, u8 id); void AddBagItemIconSprite(u16 itemId, u8 id);
void RemoveBagItemIconSprite(u8 id); void RemoveBagItemIconSprite(u8 id);

View File

@ -49,16 +49,16 @@ void AddTextPrinterParameterized3(u8 windowId, u8 fontId, u8 left, u8 top, const
void ClearStdWindowAndFrameToTransparent(u8 windowId, bool8 copyToVram); void ClearStdWindowAndFrameToTransparent(u8 windowId, bool8 copyToVram);
void SetWindowTemplateFields(struct WindowTemplate* template, u8 priority, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 palNum, u16 baseBlock); void SetWindowTemplateFields(struct WindowTemplate* template, u8 priority, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 palNum, u16 baseBlock);
void DrawStdFrameWithCustomTileAndPalette(u8 windowId, bool8 copyToVram, u16 tileStart, u8 palette); void DrawStdFrameWithCustomTileAndPalette(u8 windowId, bool8 copyToVram, u16 tileStart, u8 palette);
void schedule_bg_copy_tilemap_to_vram(u8 bgNum); void ScheduleBgCopyTilemapToVram(u8 bgNum);
void PrintMenuTable(u8 windowId, u8 itemCount, const struct MenuAction *strs); void PrintMenuTable(u8 windowId, u8 itemCount, const struct MenuAction *strs);
u8 InitMenuInUpperLeftCornerPlaySoundWhenAPressed(u8 windowId, u8 numItems, u8 initialCursorPos); u8 InitMenuInUpperLeftCornerPlaySoundWhenAPressed(u8 windowId, u8 numItems, u8 initialCursorPos);
u8 Menu_GetCursorPos(void); u8 Menu_GetCursorPos(void);
s8 Menu_ProcessInput(void); s8 Menu_ProcessInput(void);
s8 Menu_ProcessInputNoWrap(void); s8 Menu_ProcessInputNoWrap(void);
void blit_move_info_icon(u8 winId, u8 a2, u16 x, u16 y); void blit_move_info_icon(u8 winId, u8 a2, u16 x, u16 y);
void reset_temp_tile_data_buffers(void); void ResetTempTileDataBuffers(void);
void *decompress_and_copy_tile_data_to_vram(u8 bgId, const void *src, u32 size, u16 offset, u8 mode); void *DecompressAndCopyTileDataToVram(u8 bgId, const void *src, u32 size, u16 offset, u8 mode);
bool8 free_temp_tile_data_buffers_if_possible(void); bool8 FreeTempTileDataBuffersIfPossible(void);
struct WindowTemplate CreateWindowTemplate(u8 bg, u8 left, u8 top, u8 width, u8 height, u8 paletteNum, u16 baseBlock); struct WindowTemplate CreateWindowTemplate(u8 bg, u8 left, u8 top, u8 width, u8 height, u8 paletteNum, u16 baseBlock);
void CreateYesNoMenu(const struct WindowTemplate *windowTemplate, u16 borderFirstTileNum, u8 borderPalette, u8 initialCursorPos); void CreateYesNoMenu(const struct WindowTemplate *windowTemplate, u16 borderFirstTileNum, u8 borderPalette, u8 initialCursorPos);
void DecompressAndLoadBgGfxUsingHeap(u8 bgId, const void *src, u32 size, u16 offset, u8 mode); void DecompressAndLoadBgGfxUsingHeap(u8 bgId, const void *src, u32 size, u16 offset, u8 mode);

View File

@ -30,8 +30,8 @@ u8 GetLRKeysPressed(void);
u8 GetLRKeysPressedAndHeld(void); u8 GetLRKeysPressedAndHeld(void);
bool8 sub_8122148(u16 itemId); bool8 sub_8122148(u16 itemId);
bool8 itemid_80BF6D8_mail_related(u16 itemId); bool8 itemid_80BF6D8_mail_related(u16 itemId);
bool8 sub_81221AC(void); bool8 MenuHelpers_LinkSomething(void);
bool8 sub_81221EC(void); bool8 MenuHelpers_CallLinkSomething(void);
void sub_812220C(struct ItemSlot *slots, u8 count, u8 *arg2, u8 *usedSlotsCount, u8 maxUsedSlotsCount); void sub_812220C(struct ItemSlot *slots, u8 count, u8 *arg2, u8 *usedSlotsCount, u8 maxUsedSlotsCount);
void sub_812225C(u16 *scrollOffset, u16 *cursorPos, u8 maxShownItems, u8 numItems); void sub_812225C(u16 *scrollOffset, u16 *cursorPos, u8 maxShownItems, u8 numItems);
void sub_8122298(u16 *arg0, u16 *arg1, u8 arg2, u8 arg3, u8 arg4); void sub_8122298(u16 *arg0, u16 *arg1, u8 arg2, u8 arg3, u8 arg4);

View File

@ -1361,7 +1361,7 @@ static void OpenBagAndChooseItem(void)
gBattlerControllerFuncs[gActiveBattler] = CompleteWhenChoseItem; gBattlerControllerFuncs[gActiveBattler] = CompleteWhenChoseItem;
nullsub_35(); nullsub_35();
FreeAllWindowBuffers(); FreeAllWindowBuffers();
sub_81AABB0(); CB2_BagMenuFromBattle();
} }
} }

View File

@ -415,7 +415,7 @@ static void sub_81C5038(void)
static void sub_81C504C(void) static void sub_81C504C(void)
{ {
while (sub_81221EC() != TRUE && sub_81C5078() != TRUE && sub_81221AC() != TRUE); while (MenuHelpers_CallLinkSomething() != TRUE && sub_81C5078() != TRUE && MenuHelpers_LinkSomething() != TRUE);
} }
static bool8 sub_81C5078(void) static bool8 sub_81C5078(void)
@ -445,7 +445,7 @@ static bool8 sub_81C5078(void)
gMain.state++; gMain.state++;
break; break;
case 5: case 5:
if (!sub_81221AC()) if (!MenuHelpers_LinkSomething())
{ {
ResetTasks(); ResetTasks();
} }
@ -516,7 +516,7 @@ static void sub_81C51DC(void)
InitBgsFromTemplates(0, gUnknown_0861F2B4, ARRAY_COUNT(gUnknown_0861F2B4)); InitBgsFromTemplates(0, gUnknown_0861F2B4, ARRAY_COUNT(gUnknown_0861F2B4));
SetBgTilemapBuffer(2, gPyramidBagResources->tilemapBuffer); SetBgTilemapBuffer(2, gPyramidBagResources->tilemapBuffer);
ResetAllBgsCoordinates(); ResetAllBgsCoordinates();
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0 | SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0 |
DISPCNT_OBJ_1D_MAP | DISPCNT_OBJ_1D_MAP |
DISPCNT_OBJ_ON); DISPCNT_OBJ_ON);
@ -531,12 +531,12 @@ static bool8 sub_81C5238(void)
switch (gPyramidBagResources->state) switch (gPyramidBagResources->state)
{ {
case 0: case 0:
reset_temp_tile_data_buffers(); ResetTempTileDataBuffers();
decompress_and_copy_tile_data_to_vram(2, gBagScreen_Gfx, 0, 0, 0); DecompressAndCopyTileDataToVram(2, gBagScreen_Gfx, 0, 0, 0);
gPyramidBagResources->state++; gPyramidBagResources->state++;
break; break;
case 1: case 1:
if (free_temp_tile_data_buffers_if_possible() != TRUE) if (FreeTempTileDataBuffersIfPossible() != TRUE)
{ {
LZDecompressWram(gBattleFrontierGfx_PyramidBagTileMap, gPyramidBagResources->tilemapBuffer); LZDecompressWram(gBattleFrontierGfx_PyramidBagTileMap, gPyramidBagResources->tilemapBuffer);
gPyramidBagResources->state++; gPyramidBagResources->state++;
@ -837,7 +837,7 @@ static void sub_81C5B4C(u8 taskId)
static void Task_HandlePyramidBagInput(u8 taskId) static void Task_HandlePyramidBagInput(u8 taskId)
{ {
s16 *data = gTasks[taskId].data; s16 *data = gTasks[taskId].data;
if (sub_81221EC() != TRUE && !gPaletteFade.active) if (MenuHelpers_CallLinkSomething() != TRUE && !gPaletteFade.active)
{ {
if (gMain.newKeys & SELECT_BUTTON) if (gMain.newKeys & SELECT_BUTTON)
{ {
@ -940,7 +940,7 @@ static void sub_81C5F08(u8 windowId, u8 horizontalCount, u8 verticalCount)
static void HandleFewMenuActionsInput(u8 taskId) static void HandleFewMenuActionsInput(u8 taskId)
{ {
if (sub_81221EC() != TRUE) if (MenuHelpers_CallLinkSomething() != TRUE)
{ {
s32 id = Menu_ProcessInputNoWrap(); s32 id = Menu_ProcessInputNoWrap();
switch (id) switch (id)
@ -962,7 +962,7 @@ static void HandleFewMenuActionsInput(u8 taskId)
static void HandleMenuActionInput(u8 taskId) static void HandleMenuActionInput(u8 taskId)
{ {
if (sub_81221EC() != TRUE) if (MenuHelpers_CallLinkSomething() != TRUE)
{ {
s8 id = Menu_GetCursorPos(); s8 id = Menu_GetCursorPos();
if (gMain.newKeys & DPAD_UP) if (gMain.newKeys & DPAD_UP)
@ -1049,7 +1049,7 @@ static void BagAction_UseOnField(u8 taskId)
{ {
sub_81C61A8(); sub_81C61A8();
FillWindowPixelBuffer(1, PIXEL_FILL(0)); FillWindowPixelBuffer(1, PIXEL_FILL(0));
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
ItemId_GetFieldFunc(gSpecialVar_ItemId)(taskId); ItemId_GetFieldFunc(gSpecialVar_ItemId)(taskId);
} }
} }
@ -1060,8 +1060,8 @@ static void BagAction_Cancel(u8 taskId)
sub_81C61A8(); sub_81C61A8();
PrintItemDescription(data[1]); PrintItemDescription(data[1]);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
schedule_bg_copy_tilemap_to_vram(1); ScheduleBgCopyTilemapToVram(1);
sub_81C5A98(data[0], 0); sub_81C5A98(data[0], 0);
SetTaskToMainPyramidBagInputHandler(taskId); SetTaskToMainPyramidBagInputHandler(taskId);
} }
@ -1148,7 +1148,7 @@ static void sub_81C64B4(u8 taskId)
PlaySE(SE_SELECT); PlaySE(SE_SELECT);
ClearStdWindowAndFrameToTransparent(3, 0); ClearStdWindowAndFrameToTransparent(3, 0);
ClearWindowTilemap(3); ClearWindowTilemap(3);
schedule_bg_copy_tilemap_to_vram(1); ScheduleBgCopyTilemapToVram(1);
sub_81C6350(taskId); sub_81C6350(taskId);
} }
else if (gMain.newKeys & B_BUTTON) else if (gMain.newKeys & B_BUTTON)
@ -1156,7 +1156,7 @@ static void sub_81C64B4(u8 taskId)
PlaySE(SE_SELECT); PlaySE(SE_SELECT);
ClearStdWindowAndFrameToTransparent(3, 0); ClearStdWindowAndFrameToTransparent(3, 0);
ClearWindowTilemap(3); ClearWindowTilemap(3);
schedule_bg_copy_tilemap_to_vram(1); ScheduleBgCopyTilemapToVram(1);
DontTossItem(taskId); DontTossItem(taskId);
} }
} }
@ -1188,7 +1188,7 @@ static void sub_81C65CC(u8 taskId)
sub_81C59BC(); sub_81C59BC();
SetBagItemsListTemplate(); SetBagItemsListTemplate();
data[0] = ListMenuInit(&gMultiuseListMenuTemplate, *scrollOffset, *selectedRow); data[0] = ListMenuInit(&gMultiuseListMenuTemplate, *scrollOffset, *selectedRow);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
SetTaskToMainPyramidBagInputHandler(taskId); SetTaskToMainPyramidBagInputHandler(taskId);
} }
} }
@ -1275,7 +1275,7 @@ static void Task_BeginItemSwap(u8 taskId)
static void Task_ItemSwapHandleInput(u8 taskId) static void Task_ItemSwapHandleInput(u8 taskId)
{ {
s16 *data = gTasks[taskId].data; s16 *data = gTasks[taskId].data;
if (sub_81221EC() != TRUE) if (MenuHelpers_CallLinkSomething() != TRUE)
{ {
if (gMain.newKeys & SELECT_BUTTON) if (gMain.newKeys & SELECT_BUTTON)
{ {
@ -1400,8 +1400,8 @@ static void sub_81C6BD8(void)
PutWindowTilemap(0); PutWindowTilemap(0);
PutWindowTilemap(1); PutWindowTilemap(1);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
schedule_bg_copy_tilemap_to_vram(1); ScheduleBgCopyTilemapToVram(1);
} }
static void PrintOnWindow_Font1(u8 windowId, const u8 *src, u8 x, u8 y, u8 letterSpacing, u8 lineSpacing, u8 speed, u8 colorTableId) static void PrintOnWindow_Font1(u8 windowId, const u8 *src, u8 x, u8 y, u8 letterSpacing, u8 lineSpacing, u8 speed, u8 colorTableId)
@ -1417,7 +1417,7 @@ static void PrintOnWindow_Font7(u8 windowId, const u8 *src, u8 x, u8 y, u8 lette
static void sub_81C6CEC(u8 windowId) static void sub_81C6CEC(u8 windowId)
{ {
DrawStdFrameWithCustomTileAndPalette(windowId, 0, 1, 0xE); DrawStdFrameWithCustomTileAndPalette(windowId, 0, 1, 0xE);
schedule_bg_copy_tilemap_to_vram(1); ScheduleBgCopyTilemapToVram(1);
} }
static u8 sub_81C6D08(u8 windowArrayId) static u8 sub_81C6D08(u8 windowArrayId)
@ -1432,7 +1432,7 @@ static u8 sub_81C6D24(u8 windowArrayId)
{ {
*windowId = AddWindow(&gUnknown_0861F350[windowArrayId]); *windowId = AddWindow(&gUnknown_0861F350[windowArrayId]);
DrawStdFrameWithCustomTileAndPalette(*windowId, FALSE, 1, 0xE); DrawStdFrameWithCustomTileAndPalette(*windowId, FALSE, 1, 0xE);
schedule_bg_copy_tilemap_to_vram(1); ScheduleBgCopyTilemapToVram(1);
} }
return *windowId; return *windowId;
} }
@ -1445,7 +1445,7 @@ static void sub_81C6D6C(u8 windowArrayId)
ClearStdWindowAndFrameToTransparent(*windowId, FALSE); ClearStdWindowAndFrameToTransparent(*windowId, FALSE);
ClearWindowTilemap(*windowId); ClearWindowTilemap(*windowId);
RemoveWindow(*windowId); RemoveWindow(*windowId);
schedule_bg_copy_tilemap_to_vram(1); ScheduleBgCopyTilemapToVram(1);
*windowId = 0xFF; *windowId = 0xFF;
} }
} }
@ -1459,7 +1459,7 @@ void DisplayItemMessageInBattlePyramid(u8 taskId, const u8 *str, void (*callback
{ {
FillWindowPixelBuffer(2, PIXEL_FILL(1)); FillWindowPixelBuffer(2, PIXEL_FILL(1));
DisplayMessageAndContinueTask(taskId, 2, 0xA, 0xD, 1, GetPlayerTextSpeedDelay(), str, callback); DisplayMessageAndContinueTask(taskId, 2, 0xA, 0xD, 1, GetPlayerTextSpeedDelay(), str, callback);
schedule_bg_copy_tilemap_to_vram(1); ScheduleBgCopyTilemapToVram(1);
} }
static void CloseBattlePyramidBagTextWindow(void) static void CloseBattlePyramidBagTextWindow(void)
@ -1467,7 +1467,7 @@ static void CloseBattlePyramidBagTextWindow(void)
ClearDialogWindowAndFrameToTransparent(2, FALSE); ClearDialogWindowAndFrameToTransparent(2, FALSE);
// This ClearWindowTilemap call is redundant, since ClearDialogWindowAndFrameToTransparent already calls it. // This ClearWindowTilemap call is redundant, since ClearDialogWindowAndFrameToTransparent already calls it.
ClearWindowTilemap(2); ClearWindowTilemap(2);
schedule_bg_copy_tilemap_to_vram(1); ScheduleBgCopyTilemapToVram(1);
} }
#define ITEM_IMAGE_TAG 0x1024 #define ITEM_IMAGE_TAG 0x1024

View File

@ -1031,7 +1031,7 @@ int sub_802104C(void)
SetHBlankCallback(NULL); SetHBlankCallback(NULL);
SetGpuReg(REG_OFFSET_DISPCNT, 0); SetGpuReg(REG_OFFSET_DISPCNT, 0);
ScanlineEffect_Stop(); ScanlineEffect_Stop();
reset_temp_tile_data_buffers(); ResetTempTileDataBuffers();
break; break;
case 1: case 1:
CpuFill16(0, (void *)OAM, OAM_SIZE); CpuFill16(0, (void *)OAM, OAM_SIZE);
@ -1069,10 +1069,10 @@ int sub_802104C(void)
CopyBgTilemapBufferToVram(1); CopyBgTilemapBufferToVram(1);
CopyBgTilemapBufferToVram(2); CopyBgTilemapBufferToVram(2);
CopyBgTilemapBufferToVram(3); CopyBgTilemapBufferToVram(3);
decompress_and_copy_tile_data_to_vram(1, gUnknown_08DE34B8, 0, 0, 0); DecompressAndCopyTileDataToVram(1, gUnknown_08DE34B8, 0, 0, 0);
break; break;
case 6: case 6:
if (free_temp_tile_data_buffers_if_possible()) if (FreeTempTileDataBuffersIfPossible())
return 0; return 0;
InitStandardTextBoxWindows(); InitStandardTextBoxWindows();

View File

@ -201,11 +201,11 @@ static void CB2_InitBerryTagScreen(void)
{ {
while (1) while (1)
{ {
if (sub_81221EC() == TRUE) if (MenuHelpers_CallLinkSomething() == TRUE)
break; break;
if (InitBerryTagScreen() == TRUE) if (InitBerryTagScreen() == TRUE)
break; break;
if (sub_81221AC() == TRUE) if (MenuHelpers_LinkSomething() == TRUE)
break; break;
} }
} }
@ -238,7 +238,7 @@ static bool8 InitBerryTagScreen(void)
gMain.state++; gMain.state++;
break; break;
case 5: case 5:
if (!sub_81221AC()) if (!MenuHelpers_LinkSomething())
ResetTasks(); ResetTasks();
gMain.state++; gMain.state++;
break; break;
@ -301,8 +301,8 @@ static void HandleInitBackgrounds(void)
SetBgTilemapBuffer(2, sBerryTag->tilemapBuffers[0]); SetBgTilemapBuffer(2, sBerryTag->tilemapBuffers[0]);
SetBgTilemapBuffer(3, sBerryTag->tilemapBuffers[1]); SetBgTilemapBuffer(3, sBerryTag->tilemapBuffers[1]);
ResetAllBgsCoordinates(); ResetAllBgsCoordinates();
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
schedule_bg_copy_tilemap_to_vram(3); ScheduleBgCopyTilemapToVram(3);
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_1D_MAP | DISPCNT_OBJ_ON); SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_1D_MAP | DISPCNT_OBJ_ON);
SetGpuReg(REG_OFFSET_BLDCNT, 0); SetGpuReg(REG_OFFSET_BLDCNT, 0);
ShowBg(0); ShowBg(0);
@ -318,12 +318,12 @@ static bool8 LoadBerryTagGfx(void)
switch (sBerryTag->gfxState) switch (sBerryTag->gfxState)
{ {
case 0: case 0:
reset_temp_tile_data_buffers(); ResetTempTileDataBuffers();
decompress_and_copy_tile_data_to_vram(2, gBerryCheck_Gfx, 0, 0, 0); DecompressAndCopyTileDataToVram(2, gBerryCheck_Gfx, 0, 0, 0);
sBerryTag->gfxState++; sBerryTag->gfxState++;
break; break;
case 1: case 1:
if (free_temp_tile_data_buffers_if_possible() != TRUE) if (FreeTempTileDataBuffersIfPossible() != TRUE)
{ {
LZDecompressWram(gBerryTag_Gfx, sBerryTag->tilemapBuffers[0]); LZDecompressWram(gBerryTag_Gfx, sBerryTag->tilemapBuffers[0]);
sBerryTag->gfxState++; sBerryTag->gfxState++;
@ -371,8 +371,8 @@ static void HandleInitWindows(void)
LoadPalette(sFontPalette, 0xF0, 0x20); LoadPalette(sFontPalette, 0xF0, 0x20);
for (i = 0; i < ARRAY_COUNT(sWindowTemplates) - 1; i++) for (i = 0; i < ARRAY_COUNT(sWindowTemplates) - 1; i++)
PutWindowTilemap(i); PutWindowTilemap(i);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
schedule_bg_copy_tilemap_to_vram(1); ScheduleBgCopyTilemapToVram(1);
} }
static void PrintTextInBerryTagScreen(u8 windowId, const u8 *text, u8 x, u8 y, s32 speed, u8 colorStructId) static void PrintTextInBerryTagScreen(u8 windowId, const u8 *text, u8 x, u8 y, s32 speed, u8 colorStructId)
@ -386,7 +386,7 @@ static void AddBerryTagTextToBg0(void)
FillWindowPixelBuffer(WIN_BERRY_TAG, PIXEL_FILL(15)); FillWindowPixelBuffer(WIN_BERRY_TAG, PIXEL_FILL(15));
PrintTextInBerryTagScreen(WIN_BERRY_TAG, gText_BerryTag, GetStringCenterAlignXOffset(1, gText_BerryTag, 0x40), 1, 0, 1); PrintTextInBerryTagScreen(WIN_BERRY_TAG, gText_BerryTag, GetStringCenterAlignXOffset(1, gText_BerryTag, 0x40), 1, 0, 1);
PutWindowTilemap(WIN_BERRY_TAG); PutWindowTilemap(WIN_BERRY_TAG);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
} }
static void PrintAllBerryData(void) static void PrintAllBerryData(void)

View File

@ -265,7 +265,7 @@ static void CableCarMainCallback_Setup(void)
ResetTasks(); ResetTasks();
FreeAllSpritePalettes(); FreeAllSpritePalettes();
ResetPaletteFade(); ResetPaletteFade();
reset_temp_tile_data_buffers(); ResetTempTileDataBuffers();
StartWeather(); StartWeather();
for (i = 0; i < 20; i++) for (i = 0; i < 20; i++)
gWeatherPtr->sprites.s2.ashSprites[i] = NULL; gWeatherPtr->sprites.s2.ashSprites[i] = NULL;
@ -291,11 +291,11 @@ static void CableCarMainCallback_Setup(void)
sCableCar->mountainTilemap = malloc_and_decompress(gCableCarMountainTilemap, &sizeOut); sCableCar->mountainTilemap = malloc_and_decompress(gCableCarMountainTilemap, &sizeOut);
sCableCar->pylonStemTilemap = malloc_and_decompress(gCableCarPylonStemTilemap, &sizeOut); sCableCar->pylonStemTilemap = malloc_and_decompress(gCableCarPylonStemTilemap, &sizeOut);
sCableCar->pylonHookTilemapEntries = gCableCarPylonHookTilemapEntries; sCableCar->pylonHookTilemapEntries = gCableCarPylonHookTilemapEntries;
decompress_and_copy_tile_data_to_vram(0, gUnknown_08DBA5B8, 0, 0, 0); DecompressAndCopyTileDataToVram(0, gUnknown_08DBA5B8, 0, 0, 0);
gMain.state++; gMain.state++;
break; break;
case 3: case 3:
if (!free_temp_tile_data_buffers_if_possible()) if (!FreeTempTileDataBuffersIfPossible())
{ {
LoadPalette(gUnknown_08DBA518, 0, 0x80); LoadPalette(gUnknown_08DBA518, 0, 0x80);
gMain.state++; gMain.state++;

View File

@ -541,7 +541,7 @@ static u8 AddDecorationWindow(u8 windowIndex)
} }
DrawStdFrameWithCustomTileAndPalette(*windowId, FALSE, 0x214, 14); DrawStdFrameWithCustomTileAndPalette(*windowId, FALSE, 0x214, 14);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
return *windowId; return *windowId;
} }
@ -550,7 +550,7 @@ static void RemoveDecorationWindow(u8 windowIndex)
ClearStdWindowAndFrameToTransparent(sDecorMenuWindowIds[windowIndex], FALSE); ClearStdWindowAndFrameToTransparent(sDecorMenuWindowIds[windowIndex], FALSE);
ClearWindowTilemap(sDecorMenuWindowIds[windowIndex]); ClearWindowTilemap(sDecorMenuWindowIds[windowIndex]);
RemoveWindow(sDecorMenuWindowIds[windowIndex]); RemoveWindow(sDecorMenuWindowIds[windowIndex]);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
} }
static void AddDecorationActionsWindow(void) static void AddDecorationActionsWindow(void)
@ -729,7 +729,7 @@ static void PrintDecorationCategoryMenuItems(u8 taskId)
} }
AddTextPrinterParameterized(windowId, 1, gTasks[taskId].tDecorationMenuCommand == DECOR_MENU_TRADE ? gText_Exit : gText_Cancel, 8, i * 16 + 1, 0, NULL); AddTextPrinterParameterized(windowId, 1, gTasks[taskId].tDecorationMenuCommand == DECOR_MENU_TRADE ? gText_Exit : gText_Cancel, 8, i * 16 + 1, 0, NULL);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
} }
static void PrintDecorationCategoryMenuItem(u8 winid, u8 category, u8 x, u8 y, bool8 disabled, u8 speed) static void PrintDecorationCategoryMenuItem(u8 winid, u8 category, u8 x, u8 y, bool8 disabled, u8 speed)

View File

@ -76,9 +76,9 @@ void CB2_ShowDiploma(void)
sDiplomaTilemapPtr = malloc(0x1000); sDiplomaTilemapPtr = malloc(0x1000);
InitDiplomaBg(); InitDiplomaBg();
InitDiplomaWindow(); InitDiplomaWindow();
reset_temp_tile_data_buffers(); ResetTempTileDataBuffers();
decompress_and_copy_tile_data_to_vram(1, &sDiplomaTiles, 0, 0, 0); DecompressAndCopyTileDataToVram(1, &sDiplomaTiles, 0, 0, 0);
while (free_temp_tile_data_buffers_if_possible()) while (FreeTempTileDataBuffersIfPossible())
; ;
LZDecompressWram(sDiplomaTilemap, sDiplomaTilemapPtr); LZDecompressWram(sDiplomaTilemap, sDiplomaTilemapPtr);
CopyBgTilemapBufferToVram(1); CopyBgTilemapBufferToVram(1);

View File

@ -4644,16 +4644,16 @@ static bool32 sub_802A8E8(void)
LoadPalette(gDodrioBerryBgPal1, 0, sizeof(gDodrioBerryBgPal1)); LoadPalette(gDodrioBerryBgPal1, 0, sizeof(gDodrioBerryBgPal1));
break; break;
case 1: case 1:
reset_temp_tile_data_buffers(); ResetTempTileDataBuffers();
break; break;
case 2: case 2:
decompress_and_copy_tile_data_to_vram(3, gDodrioBerryBgGfx1, 0, 0, 0); DecompressAndCopyTileDataToVram(3, gDodrioBerryBgGfx1, 0, 0, 0);
break; break;
case 3: case 3:
decompress_and_copy_tile_data_to_vram(1, gDodrioBerryBgGfx2, 0, 0, 0); DecompressAndCopyTileDataToVram(1, gDodrioBerryBgGfx2, 0, 0, 0);
break; break;
case 4: case 4:
if (free_temp_tile_data_buffers_if_possible() == TRUE) if (FreeTempTileDataBuffersIfPossible() == TRUE)
return FALSE; return FALSE;
break; break;
case 5: case 5:

View File

@ -490,7 +490,7 @@ static void CB2_EggHatch_0(void)
SetVBlankCallback(VBlankCB_EggHatch); SetVBlankCallback(VBlankCB_EggHatch);
gSpecialVar_0x8005 = GetCurrentMapMusic(); gSpecialVar_0x8005 = GetCurrentMapMusic();
reset_temp_tile_data_buffers(); ResetTempTileDataBuffers();
ResetBgsAndClearDma3BusyFlags(0); ResetBgsAndClearDma3BusyFlags(0);
InitBgsFromTemplates(0, sBgTemplates_EggHatch, ARRAY_COUNT(sBgTemplates_EggHatch)); InitBgsFromTemplates(0, sBgTemplates_EggHatch, ARRAY_COUNT(sBgTemplates_EggHatch));

View File

@ -306,9 +306,9 @@ static void DrawMetatile(s32 metatileLayerType, u16 *metatiles, u16 offset)
gBGTilemapBuffers2[offset + 0x21] = metatiles[7]; gBGTilemapBuffers2[offset + 0x21] = metatiles[7];
break; break;
} }
schedule_bg_copy_tilemap_to_vram(1); ScheduleBgCopyTilemapToVram(1);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
schedule_bg_copy_tilemap_to_vram(3); ScheduleBgCopyTilemapToVram(3);
} }
static s32 MapPosToBgTilemapOffset(struct FieldCameraOffset *cameraOffset, s32 x, s32 y) static s32 MapPosToBgTilemapOffset(struct FieldCameraOffset *cameraOffset, s32 x, s32 y)

View File

@ -153,7 +153,7 @@ static void FieldUpdateRegionMap(void)
DrawStdFrameWithCustomTileAndPalette(1, 0, 0x27, 0xd); DrawStdFrameWithCustomTileAndPalette(1, 0, 0x27, 0xd);
offset = GetStringCenterAlignXOffset(1, gText_Hoenn, 0x38); offset = GetStringCenterAlignXOffset(1, gText_Hoenn, 0x38);
AddTextPrinterParameterized(1, 1, gText_Hoenn, offset, 1, 0, NULL); AddTextPrinterParameterized(1, 1, gText_Hoenn, offset, 1, 0, NULL);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
DrawStdFrameWithCustomTileAndPalette(0, 0, 0x27, 0xd); DrawStdFrameWithCustomTileAndPalette(0, 0, 0x27, 0xd);
PrintRegionMapSecName(); PrintRegionMapSecName();
BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK);
@ -208,7 +208,7 @@ static void PrintRegionMapSecName(void)
{ {
FillWindowPixelBuffer(0, PIXEL_FILL(1)); FillWindowPixelBuffer(0, PIXEL_FILL(1));
AddTextPrinterParameterized(0, 1, sFieldRegionMapHandler->regionMap.mapSecName, 0, 1, 0, NULL); AddTextPrinterParameterized(0, 1, sFieldRegionMapHandler->regionMap.mapSecName, 0, 1, 0, NULL);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
} }
else else
{ {

View File

@ -1137,7 +1137,7 @@ static void Task_OrbEffect(u8 taskId)
SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR); SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR);
SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG1 | WINOUT_WIN01_BG2 | WINOUT_WIN01_BG3 | WINOUT_WIN01_OBJ); SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG1 | WINOUT_WIN01_BG2 | WINOUT_WIN01_BG3 | WINOUT_WIN01_OBJ);
SetBgTilemapPalette(0, 0, 0, 0x1E, 0x14, 0xF); SetBgTilemapPalette(0, 0, 0, 0x1E, 0x14, 0xF);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
SetOrbFlashScanlineEffectWindowBoundaries(&gScanlineEffectRegBuffers[0][0], tCenterX, tCenterY, 1); SetOrbFlashScanlineEffectWindowBoundaries(&gScanlineEffectRegBuffers[0][0], tCenterX, tCenterY, 1);
CpuFastSet(&gScanlineEffectRegBuffers[0], &gScanlineEffectRegBuffers[1], 480); CpuFastSet(&gScanlineEffectRegBuffers[0], &gScanlineEffectRegBuffers[1], 480);
ScanlineEffect_SetParams(sFlashEffectParams); ScanlineEffect_SetParams(sFlashEffectParams);

View File

@ -2642,7 +2642,7 @@ static void Task_ShowScrollableMultichoice(u8 taskId)
ScrollableMultichoice_UpdateScrollArrows(taskId); ScrollableMultichoice_UpdateScrollArrows(taskId);
task->tListTaskId = ListMenuInit(&gScrollableMultichoice_ListMenuTemplate, task->tScrollOffset, task->tSelectedRow); task->tListTaskId = ListMenuInit(&gScrollableMultichoice_ListMenuTemplate, task->tScrollOffset, task->tSelectedRow);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
gTasks[taskId].func = ScrollableMultichoice_ProcessInput; gTasks[taskId].func = ScrollableMultichoice_ProcessInput;
} }

View File

@ -950,7 +950,7 @@ void copy_tileset_patterns_to_vram(struct Tileset const *tileset, u16 numTiles,
if (!tileset->isCompressed) if (!tileset->isCompressed)
LoadBgTiles(2, tileset->tiles, numTiles * 32, offset); LoadBgTiles(2, tileset->tiles, numTiles * 32, offset);
else else
decompress_and_copy_tile_data_to_vram(2, tileset->tiles, numTiles * 32, offset, 0); DecompressAndCopyTileDataToVram(2, tileset->tiles, numTiles * 32, offset, 0);
} }
} }

View File

@ -76,7 +76,7 @@ static void Task_DisplayHPRestoredMessage(u8 taskId)
GetMonNickname(&gPlayerParty[gPartyMenu.slotId2], gStringVar1); GetMonNickname(&gPlayerParty[gPartyMenu.slotId2], gStringVar1);
StringExpandPlaceholders(gStringVar4, gText_PkmnHPRestoredByVar2); StringExpandPlaceholders(gStringVar4, gText_PkmnHPRestoredByVar2);
DisplayPartyMenuMessage(gStringVar4, FALSE); DisplayPartyMenuMessage(gStringVar4, FALSE);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
gTasks[taskId].func = Task_FinishSoftboiled; gTasks[taskId].func = Task_FinishSoftboiled;
} }
@ -106,6 +106,6 @@ static void CantUseSoftboiledOnMon(u8 taskId)
{ {
PlaySE(SE_SELECT); PlaySE(SE_SELECT);
DisplayPartyMenuMessage(gText_CantBeUsedOnPkmn, FALSE); DisplayPartyMenuMessage(gText_CantBeUsedOnPkmn, FALSE);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
gTasks[taskId].func = Task_ChooseNewMonForSoftboiled; gTasks[taskId].func = Task_ChooseNewMonForSoftboiled;
} }

View File

@ -698,7 +698,7 @@ static bool32 InitFrontierPass(void)
ResetSpriteData(); ResetSpriteData();
FreeAllSpritePalettes(); FreeAllSpritePalettes();
ResetPaletteFade(); ResetPaletteFade();
reset_temp_tile_data_buffers(); ResetTempTileDataBuffers();
break; break;
case 3: case 3:
AllocateFrontierPassGfx(); AllocateFrontierPassGfx();
@ -719,11 +719,11 @@ static bool32 InitFrontierPass(void)
sPassGfx->unk20 = malloc_and_decompress(gUnknown_085712F8, &sizeOut); sPassGfx->unk20 = malloc_and_decompress(gUnknown_085712F8, &sizeOut);
sPassGfx->unk24 = malloc_and_decompress(gUnknown_08571060, &sizeOut); sPassGfx->unk24 = malloc_and_decompress(gUnknown_08571060, &sizeOut);
sPassGfx->unk28 = malloc_and_decompress(gUnknown_085712C0, &sizeOut); sPassGfx->unk28 = malloc_and_decompress(gUnknown_085712C0, &sizeOut);
decompress_and_copy_tile_data_to_vram(1, gUnknown_08DE08C8, 0, 0, 0); DecompressAndCopyTileDataToVram(1, gUnknown_08DE08C8, 0, 0, 0);
decompress_and_copy_tile_data_to_vram(2, gUnknown_08DE2084, 0, 0, 0); DecompressAndCopyTileDataToVram(2, gUnknown_08DE2084, 0, 0, 0);
break; break;
case 7: case 7:
if (free_temp_tile_data_buffers_if_possible()) if (FreeTempTileDataBuffersIfPossible())
return FALSE; return FALSE;
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 30, 20); FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(1, 0, 0, 0, 30, 20); FillBgTilemapBufferRect_Palette0(1, 0, 0, 0, 30, 20);
@ -1353,7 +1353,7 @@ static bool32 InitFrontierMap(void)
ResetSpriteData(); ResetSpriteData();
FreeAllSpritePalettes(); FreeAllSpritePalettes();
ResetPaletteFade(); ResetPaletteFade();
reset_temp_tile_data_buffers(); ResetTempTileDataBuffers();
break; break;
case 3: case 3:
ResetBgsAndClearDma3BusyFlags(0); ResetBgsAndClearDma3BusyFlags(0);
@ -1372,10 +1372,10 @@ static bool32 InitFrontierMap(void)
InitWindows(sMapWindowTemplates); InitWindows(sMapWindowTemplates);
DeactivateAllTextPrinters(); DeactivateAllTextPrinters();
PrintOnFrontierMap(); PrintOnFrontierMap();
decompress_and_copy_tile_data_to_vram(1, gUnknown_0856FBBC, 0, 0, 0); DecompressAndCopyTileDataToVram(1, gUnknown_0856FBBC, 0, 0, 0);
break; break;
case 5: case 5:
if (free_temp_tile_data_buffers_if_possible()) if (FreeTempTileDataBuffersIfPossible())
return FALSE; return FALSE;
LoadPalette(gUnknown_08DE07C8[0], 0, 0x1A0); LoadPalette(gUnknown_08DE07C8[0], 0, 0x1A0);
LoadPalette(stdpal_get(0), 0xF0, 0x20); LoadPalette(stdpal_get(0), 0xF0, 0x20);

View File

@ -1255,7 +1255,7 @@ static void sub_8174F70(void)
ScanlineEffect_Stop(); ScanlineEffect_Stop();
ResetTasks(); ResetTasks();
ResetSpriteData(); ResetSpriteData();
reset_temp_tile_data_buffers(); ResetTempTileDataBuffers();
ResetAllPicSprites(); ResetAllPicSprites();
FreeAllSpritePalettes(); FreeAllSpritePalettes();
gReservedSpritePaletteCount = 8; gReservedSpritePaletteCount = 8;
@ -1282,10 +1282,10 @@ static bool8 sub_8175024(void)
switch (sHofGfxPtr->state) switch (sHofGfxPtr->state)
{ {
case 0: case 0:
decompress_and_copy_tile_data_to_vram(1, sHallOfFame_Gfx, 0, 0, 0); DecompressAndCopyTileDataToVram(1, sHallOfFame_Gfx, 0, 0, 0);
break; break;
case 1: case 1:
if (free_temp_tile_data_buffers_if_possible()) if (FreeTempTileDataBuffersIfPossible())
return TRUE; return TRUE;
break; break;
case 2: case 2:

File diff suppressed because it is too large Load Diff

View File

@ -19,7 +19,7 @@ struct CompressedTilesPal
// this file's functions // this file's functions
static void SpriteCB_BagVisualSwitchingPockets(struct Sprite *sprite); static void SpriteCB_BagVisualSwitchingPockets(struct Sprite *sprite);
static void SpriteCB_ShakeBagVisual(struct Sprite *sprite); static void SpriteCB_ShakeBagSprite(struct Sprite *sprite);
static void SpriteCB_SwitchPocketRotatingBallInit(struct Sprite *sprite); static void SpriteCB_SwitchPocketRotatingBallInit(struct Sprite *sprite);
static void SpriteCB_SwitchPocketRotatingBallContinue(struct Sprite *sprite); static void SpriteCB_SwitchPocketRotatingBallContinue(struct Sprite *sprite);
@ -456,17 +456,17 @@ static void SpriteCB_BagVisualSwitchingPockets(struct Sprite *sprite)
} }
} }
void ShakeBagVisual(void) void ShakeBagSprite(void)
{ {
struct Sprite *sprite = &gSprites[gBagMenu->spriteId[0]]; struct Sprite *sprite = &gSprites[gBagMenu->spriteId[0]];
if (sprite->affineAnimEnded) if (sprite->affineAnimEnded)
{ {
StartSpriteAffineAnim(sprite, 1); StartSpriteAffineAnim(sprite, 1);
sprite->callback = SpriteCB_ShakeBagVisual; sprite->callback = SpriteCB_ShakeBagSprite;
} }
} }
static void SpriteCB_ShakeBagVisual(struct Sprite *sprite) static void SpriteCB_ShakeBagSprite(struct Sprite *sprite)
{ {
if (sprite->affineAnimEnded) if (sprite->affineAnimEnded)
{ {

View File

@ -107,7 +107,7 @@ static void SetUpItemUseCallback(u8 taskId)
type = ItemId_GetType(gSpecialVar_ItemId) - 1; type = ItemId_GetType(gSpecialVar_ItemId) - 1;
if (!InBattlePyramid()) if (!InBattlePyramid())
{ {
gBagMenu->mainCallback2 = sItemUseCallbacks[type]; gBagMenu->exitCallback = sItemUseCallbacks[type];
Task_FadeAndCloseBagMenu(taskId); Task_FadeAndCloseBagMenu(taskId);
} }
else else
@ -192,7 +192,7 @@ static void CB2_CheckMail(void)
void ItemUseOutOfBattle_Mail(u8 taskId) void ItemUseOutOfBattle_Mail(u8 taskId)
{ {
gBagMenu->mainCallback2 = CB2_CheckMail; gBagMenu->exitCallback = CB2_CheckMail;
Task_FadeAndCloseBagMenu(taskId); Task_FadeAndCloseBagMenu(taskId);
} }
@ -611,13 +611,13 @@ static void Task_StandingOnHiddenItem(u8 taskId)
void ItemUseOutOfBattle_PokeblockCase(u8 taskId) void ItemUseOutOfBattle_PokeblockCase(u8 taskId)
{ {
if (sub_81221AC() == TRUE) // link func if (MenuHelpers_LinkSomething() == TRUE) // link func
{ {
DisplayDadsAdviceCannotUseItemMessage(taskId, gTasks[taskId].tUsingRegisteredKeyItem); DisplayDadsAdviceCannotUseItemMessage(taskId, gTasks[taskId].tUsingRegisteredKeyItem);
} }
else if (gTasks[taskId].tUsingRegisteredKeyItem != TRUE) else if (gTasks[taskId].tUsingRegisteredKeyItem != TRUE)
{ {
gBagMenu->mainCallback2 = CB2_OpenPokeblockCaseOnField; gBagMenu->exitCallback = CB2_OpenPokeblockCaseOnField;
Task_FadeAndCloseBagMenu(taskId); Task_FadeAndCloseBagMenu(taskId);
} }
else else
@ -679,7 +679,7 @@ void ItemUseOutOfBattle_Berry(u8 taskId)
{ {
sItemUseOnFieldCB = ItemUseOnFieldCB_Berry; sItemUseOnFieldCB = ItemUseOnFieldCB_Berry;
gFieldCallback = FieldCB_UseItemOnField; gFieldCallback = FieldCB_UseItemOnField;
gBagMenu->mainCallback2 = CB2_ReturnToField; gBagMenu->exitCallback = CB2_ReturnToField;
Task_FadeAndCloseBagMenu(taskId); Task_FadeAndCloseBagMenu(taskId);
} }
else else
@ -1003,7 +1003,7 @@ static void ItemUseInBattle_ShowPartyMenu(u8 taskId)
{ {
if (!InBattlePyramid()) if (!InBattlePyramid())
{ {
gBagMenu->mainCallback2 = ChooseMonForInBattleItem; gBagMenu->exitCallback = ChooseMonForInBattleItem;
Task_FadeAndCloseBagMenu(taskId); Task_FadeAndCloseBagMenu(taskId);
} }
else else

View File

@ -1657,7 +1657,7 @@ void CB2_LinkError(void)
if (InitWindows(gUnknown_082ED204)) if (InitWindows(gUnknown_082ED204))
{ {
DeactivateAllTextPrinters(); DeactivateAllTextPrinters();
reset_temp_tile_data_buffers(); ResetTempTileDataBuffers();
SetGpuReg(REG_OFFSET_BLDCNT, 0); SetGpuReg(REG_OFFSET_BLDCNT, 0);
SetGpuReg(REG_OFFSET_BLDALPHA, 0); SetGpuReg(REG_OFFSET_BLDALPHA, 0);
SetGpuReg(REG_OFFSET_BG0HOFS, 0); SetGpuReg(REG_OFFSET_BG0HOFS, 0);

View File

@ -323,7 +323,7 @@ static bool8 MailReadBuildGraphics(void)
break; break;
case 5: case 5:
FreeAllSpritePalettes(); FreeAllSpritePalettes();
reset_temp_tile_data_buffers(); ResetTempTileDataBuffers();
SetGpuReg(REG_OFFSET_BG0HOFS, 0); SetGpuReg(REG_OFFSET_BG0HOFS, 0);
SetGpuReg(REG_OFFSET_BG0VOFS, 0); SetGpuReg(REG_OFFSET_BG0VOFS, 0);
SetGpuReg(REG_OFFSET_BG1HOFS, 0); SetGpuReg(REG_OFFSET_BG1HOFS, 0);
@ -346,10 +346,10 @@ static bool8 MailReadBuildGraphics(void)
DeactivateAllTextPrinters(); DeactivateAllTextPrinters();
break; break;
case 8: case 8:
decompress_and_copy_tile_data_to_vram(1, sUnknown_0859F2B8[sMailRead->mailType].tiles, 0, 0, 0); DecompressAndCopyTileDataToVram(1, sUnknown_0859F2B8[sMailRead->mailType].tiles, 0, 0, 0);
break; break;
case 9: case 9:
if (free_temp_tile_data_buffers_if_possible()) if (FreeTempTileDataBuffersIfPossible())
{ {
return FALSE; return FALSE;
} }
@ -438,7 +438,7 @@ static void CB2_InitMailRead(void)
SetMainCallback2(CB2_MailRead); SetMainCallback2(CB2_MailRead);
break; break;
} }
} while (sub_81221AC() != TRUE); } while (MenuHelpers_LinkSomething() != TRUE);
} }
static void sub_8121A1C(void) static void sub_8121A1C(void)

View File

@ -1182,7 +1182,7 @@ static bool32 LoadMatchCallWindowGfx(u8 taskId)
return FALSE; return FALSE;
} }
if (!decompress_and_copy_tile_data_to_vram(0, sPokeNavIconGfx, 0, 0x279, 0)) if (!DecompressAndCopyTileDataToVram(0, sPokeNavIconGfx, 0, 0x279, 0))
{ {
RemoveWindow(taskData[2]); RemoveWindow(taskData[2]);
DestroyTask(taskId); DestroyTask(taskId);
@ -1199,7 +1199,7 @@ static bool32 LoadMatchCallWindowGfx(u8 taskId)
static bool32 MoveMatchCallWindowToVram(u8 taskId) static bool32 MoveMatchCallWindowToVram(u8 taskId)
{ {
s16 *taskData = gTasks[taskId].data; s16 *taskData = gTasks[taskId].data;
if (free_temp_tile_data_buffers_if_possible()) if (FreeTempTileDataBuffersIfPossible())
return FALSE; return FALSE;
PutWindowTilemap(taskData[2]); PutWindowTilemap(taskData[2]);

View File

@ -1742,7 +1742,7 @@ void clear_scheduled_bg_copies_to_vram(void)
memset(gUnknown_0203CDA4, 0, sizeof(gUnknown_0203CDA4)); memset(gUnknown_0203CDA4, 0, sizeof(gUnknown_0203CDA4));
} }
void schedule_bg_copy_tilemap_to_vram(u8 bgId) void ScheduleBgCopyTilemapToVram(u8 bgId)
{ {
gUnknown_0203CDA4[bgId] = TRUE; gUnknown_0203CDA4[bgId] = TRUE;
} }
@ -1771,7 +1771,7 @@ void do_scheduled_bg_tilemap_copies_to_vram(void)
} }
} }
void reset_temp_tile_data_buffers(void) void ResetTempTileDataBuffers(void)
{ {
int i; int i;
for (i = 0; i < (s32)ARRAY_COUNT(gUnknown_0203CDAC); i++) for (i = 0; i < (s32)ARRAY_COUNT(gUnknown_0203CDAC); i++)
@ -1781,7 +1781,7 @@ void reset_temp_tile_data_buffers(void)
gUnknown_0203CDA8 = 0; gUnknown_0203CDA8 = 0;
} }
bool8 free_temp_tile_data_buffers_if_possible(void) bool8 FreeTempTileDataBuffersIfPossible(void)
{ {
int i; int i;
@ -1803,7 +1803,7 @@ bool8 free_temp_tile_data_buffers_if_possible(void)
} }
} }
void *decompress_and_copy_tile_data_to_vram(u8 bgId, const void *src, u32 size, u16 offset, u8 mode) void *DecompressAndCopyTileDataToVram(u8 bgId, const void *src, u32 size, u16 offset, u8 mode)
{ {
u32 sizeOut; u32 sizeOut;
if (gUnknown_0203CDA8 < ARRAY_COUNT(gUnknown_0203CDAC)) if (gUnknown_0203CDA8 < ARRAY_COUNT(gUnknown_0203CDAC))

View File

@ -299,7 +299,7 @@ bool8 itemid_80BF6D8_mail_related(u16 itemId)
return FALSE; return FALSE;
} }
bool8 sub_81221AC(void) bool8 MenuHelpers_LinkSomething(void)
{ {
if (IsUpdateLinkStateCBActive() == TRUE || gReceivedRemoteLinkPlayers == 1) if (IsUpdateLinkStateCBActive() == TRUE || gReceivedRemoteLinkPlayers == 1)
return TRUE; return TRUE;
@ -309,13 +309,13 @@ bool8 sub_81221AC(void)
static bool8 sub_81221D0(void) static bool8 sub_81221D0(void)
{ {
if (!sub_81221AC()) if (!MenuHelpers_LinkSomething())
return FALSE; return FALSE;
else else
return sub_8087598(); return sub_8087598();
} }
bool8 sub_81221EC(void) bool8 MenuHelpers_CallLinkSomething(void)
{ {
if (sub_81221D0() == TRUE) if (sub_81221D0() == TRUE)
return TRUE; return TRUE;

View File

@ -704,7 +704,7 @@ void InitMoveRelearnerWindows(bool8 useContextWindow)
DrawStdFrameWithCustomTileAndPalette(2, 0, 1, 0xE); DrawStdFrameWithCustomTileAndPalette(2, 0, 1, 0xE);
DrawStdFrameWithCustomTileAndPalette(3, 0, 1, 0xE); DrawStdFrameWithCustomTileAndPalette(3, 0, 1, 0xE);
nullsub_79(); nullsub_79();
schedule_bg_copy_tilemap_to_vram(1); ScheduleBgCopyTilemapToVram(1);
} }
static void nullsub_79(void) static void nullsub_79(void)

View File

@ -200,13 +200,13 @@ s32 FadeToWonderCardMenu(void)
CopyBgTilemapBufferToVram(0); CopyBgTilemapBufferToVram(0);
CopyBgTilemapBufferToVram(1); CopyBgTilemapBufferToVram(1);
CopyBgTilemapBufferToVram(2); CopyBgTilemapBufferToVram(2);
decompress_and_copy_tile_data_to_vram(2, sWonderCardData->unk_0170->tiles, 0, 0x008, 0); DecompressAndCopyTileDataToVram(2, sWonderCardData->unk_0170->tiles, 0, 0x008, 0);
sWonderCardData->unk_0176[0] = AddWindow(&gUnknown_082F0E1C[0]); sWonderCardData->unk_0176[0] = AddWindow(&gUnknown_082F0E1C[0]);
sWonderCardData->unk_0176[1] = AddWindow(&gUnknown_082F0E1C[1]); sWonderCardData->unk_0176[1] = AddWindow(&gUnknown_082F0E1C[1]);
sWonderCardData->unk_0176[2] = AddWindow(&gUnknown_082F0E1C[2]); sWonderCardData->unk_0176[2] = AddWindow(&gUnknown_082F0E1C[2]);
break; break;
case 3: case 3:
if (free_temp_tile_data_buffers_if_possible()) if (FreeTempTileDataBuffersIfPossible())
return 0; return 0;
LoadPalette(stdpal_get(1), 0x20, 0x20); LoadPalette(stdpal_get(1), 0x20, 0x20);
gPaletteFade.bufferTransferDisabled = TRUE; gPaletteFade.bufferTransferDisabled = TRUE;
@ -600,12 +600,12 @@ s32 FadeToWonderNewsMenu(void)
CopyBgTilemapBufferToVram(1); CopyBgTilemapBufferToVram(1);
CopyBgTilemapBufferToVram(2); CopyBgTilemapBufferToVram(2);
CopyBgTilemapBufferToVram(3); CopyBgTilemapBufferToVram(3);
decompress_and_copy_tile_data_to_vram(3, sWonderNewsData->unk_01BC->tiles, 0, 8, 0); DecompressAndCopyTileDataToVram(3, sWonderNewsData->unk_01BC->tiles, 0, 8, 0);
sWonderNewsData->unk_01C8[0] = AddWindow(&gUnknown_082F1DE8[0]); sWonderNewsData->unk_01C8[0] = AddWindow(&gUnknown_082F1DE8[0]);
sWonderNewsData->unk_01C8[1] = AddWindow(&gUnknown_082F1DE8[1]); sWonderNewsData->unk_01C8[1] = AddWindow(&gUnknown_082F1DE8[1]);
break; break;
case 3: case 3:
if (free_temp_tile_data_buffers_if_possible()) if (FreeTempTileDataBuffersIfPossible())
return 0; return 0;
LoadPalette(stdpal_get(1), 0x20, 0x20); LoadPalette(stdpal_get(1), 0x20, 0x20);
gPaletteFade.bufferTransferDisabled = TRUE; gPaletteFade.bufferTransferDisabled = TRUE;

View File

@ -796,7 +796,7 @@ static void HandleInput(bool8 showContest)
sMoveRelearnerMenuSate.showContestInfo = FALSE; sMoveRelearnerMenuSate.showContestInfo = FALSE;
} }
schedule_bg_copy_tilemap_to_vram(1); ScheduleBgCopyTilemapToVram(1);
MoveRelearnerShowHideHearts(GetCurrentSelectedMove()); MoveRelearnerShowHideHearts(GetCurrentSelectedMove());
break; break;
case LIST_CANCEL: case LIST_CANCEL:

View File

@ -1858,7 +1858,7 @@ static bool32 map_loading_iteration_3(u8 *state)
(*state)++; (*state)++;
break; break;
case 8: case 8:
if (free_temp_tile_data_buffers_if_possible() != TRUE) if (FreeTempTileDataBuffersIfPossible() != TRUE)
{ {
apply_map_tileset1_tileset2_palette(gMapHeader.mapLayout); apply_map_tileset1_tileset2_palette(gMapHeader.mapLayout);
(*state)++; (*state)++;
@ -1933,7 +1933,7 @@ static bool32 load_map_stuff(u8 *state, u32 a2)
(*state)++; (*state)++;
break; break;
case 8: case 8:
if (free_temp_tile_data_buffers_if_possible() != TRUE) if (FreeTempTileDataBuffersIfPossible() != TRUE)
{ {
apply_map_tileset1_tileset2_palette(gMapHeader.mapLayout); apply_map_tileset1_tileset2_palette(gMapHeader.mapLayout);
(*state)++; (*state)++;
@ -2030,7 +2030,7 @@ static bool32 map_loading_iteration_2_link(u8 *state)
(*state)++; (*state)++;
break; break;
case 7: case 7:
if (free_temp_tile_data_buffers_if_possible() != TRUE) if (FreeTempTileDataBuffersIfPossible() != TRUE)
{ {
apply_map_tileset1_tileset2_palette(gMapHeader.mapLayout); apply_map_tileset1_tileset2_palette(gMapHeader.mapLayout);
(*state)++; (*state)++;
@ -2101,7 +2101,7 @@ static void sub_8086860(void)
static void InitOverworldGraphicsRegisters(void) static void InitOverworldGraphicsRegisters(void)
{ {
clear_scheduled_bg_copies_to_vram(); clear_scheduled_bg_copies_to_vram();
reset_temp_tile_data_buffers(); ResetTempTileDataBuffers();
SetGpuReg(REG_OFFSET_MOSAIC, 0); SetGpuReg(REG_OFFSET_MOSAIC, 0);
SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN1_BG_ALL | WININ_WIN1_OBJ); SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN1_BG_ALL | WININ_WIN1_OBJ);
SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG0 | WINOUT_WINOBJ_BG0); SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG0 | WINOUT_WINOBJ_BG0);
@ -2113,9 +2113,9 @@ static void InitOverworldGraphicsRegisters(void)
| BLDCNT_TGT2_OBJ | BLDCNT_EFFECT_BLEND); | BLDCNT_TGT2_OBJ | BLDCNT_EFFECT_BLEND);
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(13, 7)); SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(13, 7));
InitOverworldBgs(); InitOverworldBgs();
schedule_bg_copy_tilemap_to_vram(1); ScheduleBgCopyTilemapToVram(1);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
schedule_bg_copy_tilemap_to_vram(3); ScheduleBgCopyTilemapToVram(3);
ChangeBgX(0, 0, 0); ChangeBgX(0, 0, 0);
ChangeBgY(0, 0, 0); ChangeBgY(0, 0, 0);
ChangeBgX(1, 0, 0); ChangeBgX(1, 0, 0);

View File

@ -479,7 +479,7 @@ static void CB2_InitPartyMenu(void)
{ {
while (TRUE) while (TRUE)
{ {
if (sub_81221EC() == TRUE || ShowPartyMenu() == TRUE || sub_81221AC() == TRUE) if (MenuHelpers_CallLinkSomething() == TRUE || ShowPartyMenu() == TRUE || MenuHelpers_LinkSomething() == TRUE)
break; break;
} }
} }
@ -512,7 +512,7 @@ static bool8 ShowPartyMenu(void)
gMain.state++; gMain.state++;
break; break;
case 5: case 5:
if (!sub_81221AC()) if (!MenuHelpers_LinkSomething())
ResetTasks(); ResetTasks();
gMain.state++; gMain.state++;
break; break;
@ -645,7 +645,7 @@ static bool8 AllocPartyMenuBg(void)
InitBgsFromTemplates(0, sPartyMenuBgTemplates, ARRAY_COUNT(sPartyMenuBgTemplates)); InitBgsFromTemplates(0, sPartyMenuBgTemplates, ARRAY_COUNT(sPartyMenuBgTemplates));
SetBgTilemapBuffer(1, sPartyBgTilemapBuffer); SetBgTilemapBuffer(1, sPartyBgTilemapBuffer);
ResetAllBgsCoordinates(); ResetAllBgsCoordinates();
schedule_bg_copy_tilemap_to_vram(1); ScheduleBgCopyTilemapToVram(1);
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP); SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP);
SetGpuReg(REG_OFFSET_BLDCNT, 0); SetGpuReg(REG_OFFSET_BLDCNT, 0);
ShowBg(0); ShowBg(0);
@ -759,7 +759,7 @@ static void RenderPartyMenuBox(u8 slot)
LoadPartyBoxPalette(&sPartyMenuBoxes[slot], PARTY_PAL_MULTI_ALT); LoadPartyBoxPalette(&sPartyMenuBoxes[slot], PARTY_PAL_MULTI_ALT);
CopyWindowToVram(sPartyMenuBoxes[slot].windowId, 2); CopyWindowToVram(sPartyMenuBoxes[slot].windowId, 2);
PutWindowTilemap(sPartyMenuBoxes[slot].windowId); PutWindowTilemap(sPartyMenuBoxes[slot].windowId);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
} }
else else
{ {
@ -792,7 +792,7 @@ static void RenderPartyMenuBox(u8 slot)
AnimatePartySlot(slot, 0); AnimatePartySlot(slot, 0);
} }
PutWindowTilemap(sPartyMenuBoxes[slot].windowId); PutWindowTilemap(sPartyMenuBoxes[slot].windowId);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
} }
} }
@ -1086,7 +1086,7 @@ void AnimatePartySlot(u8 slot, u8 animNum)
break; break;
} }
PartyMenuStartSpriteAnim(spriteId, animNum); PartyMenuStartSpriteAnim(spriteId, animNum);
schedule_bg_copy_tilemap_to_vram(1); ScheduleBgCopyTilemapToVram(1);
} }
static u8 GetPartyBoxPaletteFlags(u8 slot, u8 animNum) static u8 GetPartyBoxPaletteFlags(u8 slot, u8 animNum)
@ -1127,7 +1127,7 @@ static void DrawCancelConfirmButtons(void)
{ {
CopyToBgTilemapBufferRect_ChangePalette(1, sConfirmButton_Tilemap, 23, 16, 7, 2, 17); CopyToBgTilemapBufferRect_ChangePalette(1, sConfirmButton_Tilemap, 23, 16, 7, 2, 17);
CopyToBgTilemapBufferRect_ChangePalette(1, sCancelButton_Tilemap, 23, 18, 7, 2, 17); CopyToBgTilemapBufferRect_ChangePalette(1, sCancelButton_Tilemap, 23, 18, 7, 2, 17);
schedule_bg_copy_tilemap_to_vram(1); ScheduleBgCopyTilemapToVram(1);
} }
bool8 IsMultiBattle(void) bool8 IsMultiBattle(void)
@ -1185,7 +1185,7 @@ u8 GetPartyMenuType(void)
void Task_HandleChooseMonInput(u8 taskId) void Task_HandleChooseMonInput(u8 taskId)
{ {
if (!gPaletteFade.active && sub_81221EC() != TRUE) if (!gPaletteFade.active && MenuHelpers_CallLinkSomething() != TRUE)
{ {
s8 *slotPtr = GetCurrentPartySlotPtr(); s8 *slotPtr = GetCurrentPartySlotPtr();
@ -1322,7 +1322,7 @@ static void HandleChooseMonCancel(u8 taskId, s8 *slotPtr)
PlaySE(SE_SELECT); PlaySE(SE_SELECT);
if (DisplayCancelChooseMonYesNo(taskId) != TRUE) if (DisplayCancelChooseMonYesNo(taskId) != TRUE)
{ {
if (!sub_81221AC()) if (!MenuHelpers_LinkSomething())
gSpecialVar_0x8004 = PARTY_SIZE + 1; gSpecialVar_0x8004 = PARTY_SIZE + 1;
gPartyMenuUseExitCallback = FALSE; gPartyMenuUseExitCallback = FALSE;
*slotPtr = PARTY_SIZE + 1; *slotPtr = PARTY_SIZE + 1;
@ -1662,7 +1662,7 @@ bool8 IsPartyMenuTextPrinterActive(void)
static void Task_WaitForLinkAndReturnToChooseMon(u8 taskId) static void Task_WaitForLinkAndReturnToChooseMon(u8 taskId)
{ {
if (sub_81221EC() != TRUE) if (MenuHelpers_CallLinkSomething() != TRUE)
{ {
DisplayPartyMenuStdMessage(PARTY_MSG_CHOOSE_MON); DisplayPartyMenuStdMessage(PARTY_MSG_CHOOSE_MON);
gTasks[taskId].func = Task_HandleChooseMonInput; gTasks[taskId].func = Task_HandleChooseMonInput;
@ -1675,7 +1675,7 @@ static void Task_ReturnToChooseMonAfterText(u8 taskId)
{ {
ClearStdWindowAndFrameToTransparent(6, 0); ClearStdWindowAndFrameToTransparent(6, 0);
ClearWindowTilemap(6); ClearWindowTilemap(6);
if (sub_81221AC() == TRUE) if (MenuHelpers_LinkSomething() == TRUE)
{ {
gTasks[taskId].func = Task_WaitForLinkAndReturnToChooseMon; gTasks[taskId].func = Task_WaitForLinkAndReturnToChooseMon;
} }
@ -1693,7 +1693,7 @@ static void DisplayGaveHeldItemMessage(struct Pokemon *mon, u16 item, bool8 keep
CopyItemName(item, gStringVar2); CopyItemName(item, gStringVar2);
StringExpandPlaceholders(gStringVar4, gText_PkmnWasGivenItem); StringExpandPlaceholders(gStringVar4, gText_PkmnWasGivenItem);
DisplayPartyMenuMessage(gStringVar4, keepOpen); DisplayPartyMenuMessage(gStringVar4, keepOpen);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
} }
static void DisplayTookHeldItemMessage(struct Pokemon *mon, u16 item, bool8 keepOpen) static void DisplayTookHeldItemMessage(struct Pokemon *mon, u16 item, bool8 keepOpen)
@ -1702,7 +1702,7 @@ static void DisplayTookHeldItemMessage(struct Pokemon *mon, u16 item, bool8 keep
CopyItemName(item, gStringVar2); CopyItemName(item, gStringVar2);
StringExpandPlaceholders(gStringVar4, gText_ReceivedItemFromPkmn); StringExpandPlaceholders(gStringVar4, gText_ReceivedItemFromPkmn);
DisplayPartyMenuMessage(gStringVar4, keepOpen); DisplayPartyMenuMessage(gStringVar4, keepOpen);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
} }
static void DisplayAlreadyHoldingItemSwitchMessage(struct Pokemon *mon, u16 item, bool8 keepOpen) static void DisplayAlreadyHoldingItemSwitchMessage(struct Pokemon *mon, u16 item, bool8 keepOpen)
@ -1711,7 +1711,7 @@ static void DisplayAlreadyHoldingItemSwitchMessage(struct Pokemon *mon, u16 item
CopyItemName(item, gStringVar2); CopyItemName(item, gStringVar2);
StringExpandPlaceholders(gStringVar4, gText_PkmnAlreadyHoldingItemSwitch); StringExpandPlaceholders(gStringVar4, gText_PkmnAlreadyHoldingItemSwitch);
DisplayPartyMenuMessage(gStringVar4, keepOpen); DisplayPartyMenuMessage(gStringVar4, keepOpen);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
} }
static void DisplaySwitchedHeldItemMessage(u16 item, u16 item2, bool8 keepOpen) static void DisplaySwitchedHeldItemMessage(u16 item, u16 item2, bool8 keepOpen)
@ -1720,7 +1720,7 @@ static void DisplaySwitchedHeldItemMessage(u16 item, u16 item2, bool8 keepOpen)
CopyItemName(item2, gStringVar2); CopyItemName(item2, gStringVar2);
StringExpandPlaceholders(gStringVar4, gText_SwitchedPkmnItem); StringExpandPlaceholders(gStringVar4, gText_SwitchedPkmnItem);
DisplayPartyMenuMessage(gStringVar4, keepOpen); DisplayPartyMenuMessage(gStringVar4, keepOpen);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
} }
static void GiveItemToMon(struct Pokemon *mon, u16 item) static void GiveItemToMon(struct Pokemon *mon, u16 item)
@ -1919,7 +1919,7 @@ static void TryEnterMonForMinigame(u8 taskId, u8 slot)
{ {
PlaySE(SE_HAZURE); PlaySE(SE_HAZURE);
DisplayPartyMenuMessage(gText_PkmnCantParticipate, FALSE); DisplayPartyMenuMessage(gText_PkmnCantParticipate, FALSE);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
gTasks[taskId].func = Task_ReturnToChooseMonAfterText; gTasks[taskId].func = Task_ReturnToChooseMonAfterText;
} }
} }
@ -1927,7 +1927,7 @@ static void TryEnterMonForMinigame(u8 taskId, u8 slot)
static void CancelParticipationPrompt(u8 taskId) static void CancelParticipationPrompt(u8 taskId)
{ {
DisplayPartyMenuMessage(gText_CancelParticipation, TRUE); DisplayPartyMenuMessage(gText_CancelParticipation, TRUE);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
gTasks[taskId].func = Task_CancelParticipationYesNo; gTasks[taskId].func = Task_CancelParticipationYesNo;
} }
@ -2067,7 +2067,7 @@ static void CreateCancelConfirmWindows(bool8 chooseHalf)
} }
PutWindowTilemap(cancelWindowId); PutWindowTilemap(cancelWindowId);
CopyWindowToVram(cancelWindowId, 2); CopyWindowToVram(cancelWindowId, 2);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
} }
} }
@ -2381,7 +2381,7 @@ static void PartyMenuRemoveWindow(u8 *ptr)
ClearStdWindowAndFrameToTransparent(*ptr, 0); ClearStdWindowAndFrameToTransparent(*ptr, 0);
RemoveWindow(*ptr); RemoveWindow(*ptr);
*ptr = 0xFF; *ptr = 0xFF;
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
} }
} }
@ -2427,7 +2427,7 @@ void DisplayPartyMenuStdMessage(u32 stringId)
DrawStdFrameWithCustomTileAndPalette(*windowPtr, FALSE, 0x4F, 0xD); DrawStdFrameWithCustomTileAndPalette(*windowPtr, FALSE, 0x4F, 0xD);
StringExpandPlaceholders(gStringVar4, sActionStringTable[stringId]); StringExpandPlaceholders(gStringVar4, sActionStringTable[stringId]);
AddTextPrinterParameterized(*windowPtr, 1, gStringVar4, 0, 1, 0, 0); AddTextPrinterParameterized(*windowPtr, 1, gStringVar4, 0, 1, 0, 0);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
} }
} }
@ -2487,7 +2487,7 @@ static u8 DisplaySelectionWindow(u8 windowType)
} }
InitMenuInUpperLeftCorner(sPartyMenuInternal->windowId[0], sPartyMenuInternal->numActions, 0, 1); InitMenuInUpperLeftCorner(sPartyMenuInternal->windowId[0], sPartyMenuInternal->numActions, 0, 1);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
return sPartyMenuInternal->windowId[0]; return sPartyMenuInternal->windowId[0];
} }
@ -2649,7 +2649,7 @@ static bool8 CreateSelectionWindow(u8 taskId)
{ {
StringExpandPlaceholders(gStringVar4, gText_PkmnNotHolding); StringExpandPlaceholders(gStringVar4, gText_PkmnNotHolding);
DisplayPartyMenuMessage(gStringVar4, TRUE); DisplayPartyMenuMessage(gStringVar4, TRUE);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
gTasks[taskId].func = Task_UpdateHeldItemSprite; gTasks[taskId].func = Task_UpdateHeldItemSprite;
return FALSE; return FALSE;
} }
@ -2668,7 +2668,7 @@ static void Task_TryCreateSelectionWindow(u8 taskId)
static void Task_HandleSelectionMenuInput(u8 taskId) static void Task_HandleSelectionMenuInput(u8 taskId)
{ {
if (!gPaletteFade.active && sub_81221EC() != TRUE) if (!gPaletteFade.active && MenuHelpers_CallLinkSomething() != TRUE)
{ {
s8 input; s8 input;
s16 *data = gTasks[taskId].data; s16 *data = gTasks[taskId].data;
@ -2860,7 +2860,7 @@ static void SlidePartyMenuBoxOneStep(u8 taskId)
MoveAndBufferPartySlot(sSlot1TilemapBuffer, tSlot1Left + tSlot1Offset, tSlot1Top, tSlot1Width, tSlot1Height, tSlot1SlideDir); MoveAndBufferPartySlot(sSlot1TilemapBuffer, tSlot1Left + tSlot1Offset, tSlot1Top, tSlot1Width, tSlot1Height, tSlot1SlideDir);
if (tSlot2SlideDir != 0) if (tSlot2SlideDir != 0)
MoveAndBufferPartySlot(sSlot2TilemapBuffer, tSlot2Left + tSlot2Offset, tSlot2Top, tSlot2Width, tSlot2Height, tSlot2SlideDir); MoveAndBufferPartySlot(sSlot2TilemapBuffer, tSlot2Left + tSlot2Offset, tSlot2Top, tSlot2Width, tSlot2Height, tSlot2SlideDir);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
} }
static void Task_SlideSelectedSlotsOffscreen(u8 taskId) static void Task_SlideSelectedSlotsOffscreen(u8 taskId)
@ -2905,7 +2905,7 @@ static void Task_SlideSelectedSlotsOnscreen(u8 taskId)
{ {
PutWindowTilemap(sPartyMenuBoxes[gPartyMenu.slotId].windowId); PutWindowTilemap(sPartyMenuBoxes[gPartyMenu.slotId].windowId);
PutWindowTilemap(sPartyMenuBoxes[gPartyMenu.slotId2].windowId); PutWindowTilemap(sPartyMenuBoxes[gPartyMenu.slotId2].windowId);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
Free(sSlot1TilemapBuffer); Free(sSlot1TilemapBuffer);
Free(sSlot2TilemapBuffer); Free(sSlot2TilemapBuffer);
FinishTwoMonAction(taskId); FinishTwoMonAction(taskId);
@ -3023,7 +3023,7 @@ static void CursorCb_Give(u8 taskId)
static void CB2_SelectBagItemToGive(void) static void CB2_SelectBagItemToGive(void)
{ {
if (InBattlePyramid() == FALSE) if (InBattlePyramid() == FALSE)
GoToBagMenu(RETURN_LOCATION_POKEMON_LIST, POCKETS_COUNT, CB2_GiveHoldItem); GoToBagMenu(ITEMMENULOCATION_PARTY, POCKETS_COUNT, CB2_GiveHoldItem);
else else
GoToBattlePyramidBagMenu(2, CB2_GiveHoldItem); GoToBattlePyramidBagMenu(2, CB2_GiveHoldItem);
} }
@ -3223,7 +3223,7 @@ static void CursorCb_TakeItem(u8 taskId)
DisplayTookHeldItemMessage(mon, item, TRUE); DisplayTookHeldItemMessage(mon, item, TRUE);
break; break;
} }
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
gTasks[taskId].func = Task_UpdateHeldItemSprite; gTasks[taskId].func = Task_UpdateHeldItemSprite;
} }
@ -3640,7 +3640,7 @@ static void CursorCb_FieldMove(u8 taskId)
PartyMenuRemoveWindow(&sPartyMenuInternal->windowId[0]); PartyMenuRemoveWindow(&sPartyMenuInternal->windowId[0]);
PartyMenuRemoveWindow(&sPartyMenuInternal->windowId[1]); PartyMenuRemoveWindow(&sPartyMenuInternal->windowId[1]);
if (sub_81221AC() == TRUE || InUnionRoom() == TRUE) if (MenuHelpers_LinkSomething() == TRUE || InUnionRoom() == TRUE)
{ {
if (fieldMove == FIELD_MOVE_MILK_DRINK || fieldMove == FIELD_MOVE_SOFT_BOILED) if (fieldMove == FIELD_MOVE_MILK_DRINK || fieldMove == FIELD_MOVE_SOFT_BOILED)
DisplayPartyMenuStdMessage(PARTY_MSG_CANT_USE_HERE); DisplayPartyMenuStdMessage(PARTY_MSG_CANT_USE_HERE);
@ -4206,7 +4206,7 @@ void CB2_ShowPartyMenuForItemUse(void)
static void CB2_ReturnToBagMenu(void) static void CB2_ReturnToBagMenu(void)
{ {
if (InBattlePyramid() == FALSE) if (InBattlePyramid() == FALSE)
GoToBagMenu(RETURN_LOCATION_UNCHANGED, POCKETS_COUNT, NULL); GoToBagMenu(ITEMMENULOCATION_LAST, POCKETS_COUNT, NULL);
else else
GoToBattlePyramidBagMenu(4, gPyramidBagCursorData.callback); GoToBattlePyramidBagMenu(4, gPyramidBagCursorData.callback);
} }
@ -4345,7 +4345,7 @@ void ItemUseCB_Medicine(u8 taskId, TaskFunc task)
gPartyMenuUseExitCallback = FALSE; gPartyMenuUseExitCallback = FALSE;
PlaySE(SE_SELECT); PlaySE(SE_SELECT);
DisplayPartyMenuMessage(gText_WontHaveEffect, TRUE); DisplayPartyMenuMessage(gText_WontHaveEffect, TRUE);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
gTasks[taskId].func = task; gTasks[taskId].func = task;
return; return;
} }
@ -4381,7 +4381,7 @@ void ItemUseCB_Medicine(u8 taskId, TaskFunc task)
GetMonNickname(mon, gStringVar1); GetMonNickname(mon, gStringVar1);
GetMedicineItemEffectMessage(item); GetMedicineItemEffectMessage(item);
DisplayPartyMenuMessage(gStringVar4, TRUE); DisplayPartyMenuMessage(gStringVar4, TRUE);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
gTasks[taskId].func = task; gTasks[taskId].func = task;
} }
} }
@ -4391,7 +4391,7 @@ static void Task_DisplayHPRestoredMessage(u8 taskId)
GetMonNickname(&gPlayerParty[gPartyMenu.slotId], gStringVar1); GetMonNickname(&gPlayerParty[gPartyMenu.slotId], gStringVar1);
StringExpandPlaceholders(gStringVar4, gText_PkmnHPRestoredByVar2); StringExpandPlaceholders(gStringVar4, gText_PkmnHPRestoredByVar2);
DisplayPartyMenuMessage(gStringVar4, FALSE); DisplayPartyMenuMessage(gStringVar4, FALSE);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
HandleBattleLowHpMusicChange(); HandleBattleLowHpMusicChange();
gTasks[taskId].func = Task_ClosePartyMenuAfterText; gTasks[taskId].func = Task_ClosePartyMenuAfterText;
} }
@ -4422,7 +4422,7 @@ void ItemUseCB_ReduceEV(u8 taskId, TaskFunc task)
gPartyMenuUseExitCallback = FALSE; gPartyMenuUseExitCallback = FALSE;
PlaySE(SE_SELECT); PlaySE(SE_SELECT);
DisplayPartyMenuMessage(gText_WontHaveEffect, TRUE); DisplayPartyMenuMessage(gText_WontHaveEffect, TRUE);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
gTasks[taskId].func = task; gTasks[taskId].func = task;
} }
else else
@ -4444,7 +4444,7 @@ void ItemUseCB_ReduceEV(u8 taskId, TaskFunc task)
StringExpandPlaceholders(gStringVar4, gText_PkmnAdoresBaseVar2Fell); StringExpandPlaceholders(gStringVar4, gText_PkmnAdoresBaseVar2Fell);
} }
DisplayPartyMenuMessage(gStringVar4, TRUE); DisplayPartyMenuMessage(gStringVar4, TRUE);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
gTasks[taskId].func = task; gTasks[taskId].func = task;
} }
} }
@ -4512,7 +4512,7 @@ static void ShowMoveSelectWindow(u8 slot)
moveCount++; moveCount++;
} }
InitMenuInUpperLeftCornerPlaySoundWhenAPressed(windowId, moveCount, 0); InitMenuInUpperLeftCornerPlaySoundWhenAPressed(windowId, moveCount, 0);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
} }
static void Task_HandleWhichMoveInput(u8 taskId) static void Task_HandleWhichMoveInput(u8 taskId)
@ -4586,7 +4586,7 @@ static void TryUsePPItem(u8 taskId)
gPartyMenuUseExitCallback = FALSE; gPartyMenuUseExitCallback = FALSE;
PlaySE(SE_SELECT); PlaySE(SE_SELECT);
DisplayPartyMenuMessage(gText_WontHaveEffect, TRUE); DisplayPartyMenuMessage(gText_WontHaveEffect, TRUE);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
gTasks[taskId].func = Task_ClosePartyMenuAfterText; gTasks[taskId].func = Task_ClosePartyMenuAfterText;
} }
else else
@ -4599,7 +4599,7 @@ static void TryUsePPItem(u8 taskId)
StringCopy(gStringVar1, gMoveNames[move]); StringCopy(gStringVar1, gMoveNames[move]);
GetMedicineItemEffectMessage(item); GetMedicineItemEffectMessage(item);
DisplayPartyMenuMessage(gStringVar4, TRUE); DisplayPartyMenuMessage(gStringVar4, TRUE);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
gTasks[taskId].func = Task_ClosePartyMenuAfterText; gTasks[taskId].func = Task_ClosePartyMenuAfterText;
} }
} }
@ -4646,7 +4646,7 @@ static void DisplayLearnMoveMessage(const u8 *str)
{ {
StringExpandPlaceholders(gStringVar4, str); StringExpandPlaceholders(gStringVar4, str);
DisplayPartyMenuMessage(gStringVar4, TRUE); DisplayPartyMenuMessage(gStringVar4, TRUE);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
} }
static void DisplayLearnMoveMessageAndClose(u8 taskId, const u8 *str) static void DisplayLearnMoveMessageAndClose(u8 taskId, const u8 *str)
@ -4709,7 +4709,7 @@ static void Task_LearnedMove(u8 taskId)
StringCopy(gStringVar2, gMoveNames[move[0]]); StringCopy(gStringVar2, gMoveNames[move[0]]);
StringExpandPlaceholders(gStringVar4, gText_PkmnLearnedMove3); StringExpandPlaceholders(gStringVar4, gText_PkmnLearnedMove3);
DisplayPartyMenuMessage(gStringVar4, TRUE); DisplayPartyMenuMessage(gStringVar4, TRUE);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
gTasks[taskId].func = Task_DoLearnedMoveFanfareAfterText; gTasks[taskId].func = Task_DoLearnedMoveFanfareAfterText;
} }
@ -4824,7 +4824,7 @@ static void StopLearningMovePrompt(u8 taskId)
StringCopy(gStringVar2, gMoveNames[gPartyMenu.data1]); StringCopy(gStringVar2, gMoveNames[gPartyMenu.data1]);
StringExpandPlaceholders(gStringVar4, gText_StopLearningMove2); StringExpandPlaceholders(gStringVar4, gText_StopLearningMove2);
DisplayPartyMenuMessage(gStringVar4, TRUE); DisplayPartyMenuMessage(gStringVar4, TRUE);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
gTasks[taskId].func = Task_StopLearningMoveYesNo; gTasks[taskId].func = Task_StopLearningMoveYesNo;
} }
@ -4900,7 +4900,7 @@ void ItemUseCB_RareCandy(u8 taskId, TaskFunc task)
{ {
gPartyMenuUseExitCallback = FALSE; gPartyMenuUseExitCallback = FALSE;
DisplayPartyMenuMessage(gText_WontHaveEffect, TRUE); DisplayPartyMenuMessage(gText_WontHaveEffect, TRUE);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
gTasks[taskId].func = task; gTasks[taskId].func = task;
} }
else else
@ -4913,7 +4913,7 @@ void ItemUseCB_RareCandy(u8 taskId, TaskFunc task)
ConvertIntToDecimalStringN(gStringVar2, GetMonData(mon, MON_DATA_LEVEL), STR_CONV_MODE_LEFT_ALIGN, 3); ConvertIntToDecimalStringN(gStringVar2, GetMonData(mon, MON_DATA_LEVEL), STR_CONV_MODE_LEFT_ALIGN, 3);
StringExpandPlaceholders(gStringVar4, gText_PkmnElevatedToLvVar2); StringExpandPlaceholders(gStringVar4, gText_PkmnElevatedToLvVar2);
DisplayPartyMenuMessage(gStringVar4, TRUE); DisplayPartyMenuMessage(gStringVar4, TRUE);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
gTasks[taskId].func = Task_DisplayLevelUpStatsPg1; gTasks[taskId].func = Task_DisplayLevelUpStatsPg1;
} }
} }
@ -4928,7 +4928,7 @@ static void UpdateMonDisplayInfoAfterRareCandy(u8 slot, struct Pokemon *mon)
DisplayPartyPokemonHPBarCheck(mon, &sPartyMenuBoxes[slot]); DisplayPartyPokemonHPBarCheck(mon, &sPartyMenuBoxes[slot]);
UpdatePartyMonHPBar(sPartyMenuBoxes[slot].monSpriteId, mon); UpdatePartyMonHPBar(sPartyMenuBoxes[slot].monSpriteId, mon);
AnimatePartySlot(slot, 1); AnimatePartySlot(slot, 1);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
} }
static void Task_DisplayLevelUpStatsPg1(u8 taskId) static void Task_DisplayLevelUpStatsPg1(u8 taskId)
@ -4958,7 +4958,7 @@ static void DisplayLevelUpStatsPg1(u8 taskId)
arrayPtr[12] = CreateLevelUpStatsWindow(); arrayPtr[12] = CreateLevelUpStatsWindow();
DrawLevelUpWindowPg1(arrayPtr[12], arrayPtr, &arrayPtr[6], TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GREY, TEXT_COLOR_LIGHT_GREY); DrawLevelUpWindowPg1(arrayPtr[12], arrayPtr, &arrayPtr[6], TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GREY, TEXT_COLOR_LIGHT_GREY);
CopyWindowToVram(arrayPtr[12], 2); CopyWindowToVram(arrayPtr[12], 2);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
} }
static void DisplayLevelUpStatsPg2(u8 taskId) static void DisplayLevelUpStatsPg2(u8 taskId)
@ -4967,7 +4967,7 @@ static void DisplayLevelUpStatsPg2(u8 taskId)
DrawLevelUpWindowPg2(arrayPtr[12], &arrayPtr[6], TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GREY, TEXT_COLOR_LIGHT_GREY); DrawLevelUpWindowPg2(arrayPtr[12], &arrayPtr[6], TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GREY, TEXT_COLOR_LIGHT_GREY);
CopyWindowToVram(arrayPtr[12], 2); CopyWindowToVram(arrayPtr[12], 2);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
} }
static void Task_TryLearnNewMoves(u8 taskId) static void Task_TryLearnNewMoves(u8 taskId)
@ -5041,7 +5041,7 @@ static void DisplayMonNeedsToReplaceMove(u8 taskId)
StringCopy(gStringVar2, gMoveNames[gMoveToLearn]); StringCopy(gStringVar2, gMoveNames[gMoveToLearn]);
StringExpandPlaceholders(gStringVar4, gText_PkmnNeedsToReplaceMove); StringExpandPlaceholders(gStringVar4, gText_PkmnNeedsToReplaceMove);
DisplayPartyMenuMessage(gStringVar4, TRUE); DisplayPartyMenuMessage(gStringVar4, TRUE);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
gPartyMenu.data1 = gMoveToLearn; gPartyMenu.data1 = gMoveToLearn;
gTasks[taskId].func = Task_ReplaceMoveYesNo; gTasks[taskId].func = Task_ReplaceMoveYesNo;
} }
@ -5052,7 +5052,7 @@ static void DisplayMonLearnedMove(u8 taskId, u16 move)
StringCopy(gStringVar2, gMoveNames[move]); StringCopy(gStringVar2, gMoveNames[move]);
StringExpandPlaceholders(gStringVar4, gText_PkmnLearnedMove3); StringExpandPlaceholders(gStringVar4, gText_PkmnLearnedMove3);
DisplayPartyMenuMessage(gStringVar4, TRUE); DisplayPartyMenuMessage(gStringVar4, TRUE);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
gPartyMenu.data1 = move; gPartyMenu.data1 = move;
gTasks[taskId].func = Task_DoLearnedMoveFanfareAfterText; gTasks[taskId].func = Task_DoLearnedMoveFanfareAfterText;
} }
@ -5124,7 +5124,7 @@ static void Task_SacredAshLoop(u8 taskId)
{ {
gPartyMenuUseExitCallback = FALSE; gPartyMenuUseExitCallback = FALSE;
DisplayPartyMenuMessage(gText_WontHaveEffect, TRUE); DisplayPartyMenuMessage(gText_WontHaveEffect, TRUE);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
} }
else else
{ {
@ -5146,7 +5146,7 @@ static void Task_SacredAshDisplayHPRestored(u8 taskId)
GetMonNickname(&gPlayerParty[gPartyMenu.slotId], gStringVar1); GetMonNickname(&gPlayerParty[gPartyMenu.slotId], gStringVar1);
StringExpandPlaceholders(gStringVar4, gText_PkmnHPRestoredByVar2); StringExpandPlaceholders(gStringVar4, gText_PkmnHPRestoredByVar2);
DisplayPartyMenuMessage(gStringVar4, FALSE); DisplayPartyMenuMessage(gStringVar4, FALSE);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
gTasks[taskId].func = Task_SacredAshLoop; gTasks[taskId].func = Task_SacredAshLoop;
} }
@ -5162,7 +5162,7 @@ void ItemUseCB_EvolutionStone(u8 taskId, TaskFunc task)
{ {
gPartyMenuUseExitCallback = FALSE; gPartyMenuUseExitCallback = FALSE;
DisplayPartyMenuMessage(gText_WontHaveEffect, TRUE); DisplayPartyMenuMessage(gText_WontHaveEffect, TRUE);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
gTasks[taskId].func = task; gTasks[taskId].func = task;
} }
else else
@ -5440,7 +5440,7 @@ static void Task_HandleSwitchItemsFromBagYesNoInput(u8 taskId)
static void DisplayItemMustBeRemovedFirstMessage(u8 taskId) static void DisplayItemMustBeRemovedFirstMessage(u8 taskId)
{ {
DisplayPartyMenuMessage(gText_RemoveMailBeforeItem, TRUE); DisplayPartyMenuMessage(gText_RemoveMailBeforeItem, TRUE);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
gTasks[taskId].func = Task_UpdateHeldItemSpriteAndClosePartyMenu; gTasks[taskId].func = Task_UpdateHeldItemSpriteAndClosePartyMenu;
} }
@ -5484,7 +5484,7 @@ static void TryGiveMailToSelectedMon(u8 taskId)
ClearMailStruct(mail); ClearMailStruct(mail);
DisplayPartyMenuMessage(gText_MailTransferredFromMailbox, TRUE); DisplayPartyMenuMessage(gText_MailTransferredFromMailbox, TRUE);
} }
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
gTasks[taskId].func = Task_UpdateHeldItemSpriteAndClosePartyMenu; gTasks[taskId].func = Task_UpdateHeldItemSpriteAndClosePartyMenu;
} }

View File

@ -340,7 +340,7 @@ static void InitPlayerPCMenu(u8 taskId)
SetStandardWindowBorderStyle(data[4], 0); SetStandardWindowBorderStyle(data[4], 0);
sub_81995E4(data[4], gPcItemMenuOptionsNum, sPlayerPCMenuActions, gPcItemMenuOptionOrder); sub_81995E4(data[4], gPcItemMenuOptionsNum, sPlayerPCMenuActions, gPcItemMenuOptionOrder);
InitMenuInUpperLeftCornerPlaySoundWhenAPressed(data[4], gPcItemMenuOptionsNum, 0); InitMenuInUpperLeftCornerPlaySoundWhenAPressed(data[4], gPcItemMenuOptionsNum, 0);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
gTasks[taskId].func = PlayerPCProcessMenuInput; gTasks[taskId].func = PlayerPCProcessMenuInput;
} }
@ -364,14 +364,14 @@ static void PlayerPCProcessMenuInput(u8 taskId)
ClearStdWindowAndFrameToTransparent(data[4], FALSE); ClearStdWindowAndFrameToTransparent(data[4], FALSE);
ClearWindowTilemap(data[4]); ClearWindowTilemap(data[4]);
RemoveWindow(data[4]); RemoveWindow(data[4]);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
gTasks[taskId].func = PlayerPC_TurnOff; gTasks[taskId].func = PlayerPC_TurnOff;
break; break;
default: default:
ClearStdWindowAndFrameToTransparent(data[4], FALSE); ClearStdWindowAndFrameToTransparent(data[4], FALSE);
ClearWindowTilemap(data[4]); ClearWindowTilemap(data[4]);
RemoveWindow(data[4]); RemoveWindow(data[4]);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
gTasks[taskId].func = sPlayerPCMenuActions[gPcItemMenuOptionOrder[inputOptionId]].func.void_u8; gTasks[taskId].func = sPlayerPCMenuActions[gPcItemMenuOptionOrder[inputOptionId]].func.void_u8;
break; break;
} }
@ -445,7 +445,7 @@ static void InitItemStorageMenu(u8 taskId, u8 var)
SetStandardWindowBorderStyle(data[4], 0); SetStandardWindowBorderStyle(data[4], 0);
PrintMenuTable(data[4], 4, gPCText_ItemPCOptionsText); PrintMenuTable(data[4], 4, gPCText_ItemPCOptionsText);
InitMenuInUpperLeftCornerPlaySoundWhenAPressed(data[4], 4, var); InitMenuInUpperLeftCornerPlaySoundWhenAPressed(data[4], 4, var);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
ItemStorageMenuPrint(gPCText_OptionDescList[var]); ItemStorageMenuPrint(gPCText_OptionDescList[var]);
} }
@ -492,7 +492,7 @@ static void Task_ItemStorage_Deposit(u8 taskId)
if (!gPaletteFade.active) if (!gPaletteFade.active)
{ {
CleanupOverworldWindowsAndTilemaps(); CleanupOverworldWindowsAndTilemaps();
sub_81AAC14(); CB2_GoToItemDepositMenu();
DestroyTask(taskId); DestroyTask(taskId);
} }
} }
@ -586,7 +586,7 @@ static void sub_816B4DC(u8 taskId)
ClearStdWindowAndFrameToTransparent(data[4], FALSE); ClearStdWindowAndFrameToTransparent(data[4], FALSE);
ClearWindowTilemap(data[4]); ClearWindowTilemap(data[4]);
RemoveWindow(data[4]); RemoveWindow(data[4]);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
} }
static u8 GetMailboxMailCount(void) static u8 GetMailboxMailCount(void)
@ -626,7 +626,7 @@ static void Mailbox_DrawMailboxMenu(u8 taskId)
windowId = sub_81D1C84(0); windowId = sub_81D1C84(0);
sub_81D1C84(1); sub_81D1C84(1);
AddTextPrinterParameterized(windowId, 1, gText_Mailbox, GetStringCenterAlignXOffset(1, gText_Mailbox, 0x40), 1, 0, NULL); AddTextPrinterParameterized(windowId, 1, gText_Mailbox, GetStringCenterAlignXOffset(1, gText_Mailbox, 0x40), 1, 0, NULL);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
gTasks[taskId].data[5] = sub_81D1DC0(&playerPCItemPageInfo); gTasks[taskId].data[5] = sub_81D1DC0(&playerPCItemPageInfo);
sub_81D1E90(&playerPCItemPageInfo); sub_81D1E90(&playerPCItemPageInfo);
} }
@ -655,7 +655,7 @@ static void Mailbox_ProcessInput(u8 taskId)
sub_81D1D04(0); sub_81D1D04(0);
sub_81D1D04(1); sub_81D1D04(1);
DestroyListMenuTask(data[5], &(playerPCItemPageInfo.itemsAbove), &(playerPCItemPageInfo.cursorPos)); DestroyListMenuTask(data[5], &(playerPCItemPageInfo.itemsAbove), &(playerPCItemPageInfo.cursorPos));
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
RemoveScrollIndicatorArrowPair(playerPCItemPageInfo.scrollIndicatorId); RemoveScrollIndicatorArrowPair(playerPCItemPageInfo.scrollIndicatorId);
gTasks[taskId].func = Mailbox_PrintWhatToDoWithPlayerMailText; gTasks[taskId].func = Mailbox_PrintWhatToDoWithPlayerMailText;
break; break;
@ -678,7 +678,7 @@ static void Mailbox_ReturnToPlayerPC(u8 taskId)
sub_81D1D04(0); sub_81D1D04(0);
sub_81D1D04(1); sub_81D1D04(1);
DestroyListMenuTask(data[5], NULL, NULL); DestroyListMenuTask(data[5], NULL, NULL);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
sub_81D1EC0(); sub_81D1EC0();
ReshowPlayerPC(taskId); ReshowPlayerPC(taskId);
} }
@ -688,7 +688,7 @@ static void Mailbox_PrintMailOptions(u8 taskId)
u8 r4 = sub_81D1C84(2); u8 r4 = sub_81D1C84(2);
PrintMenuTable(r4, 4, gMailboxMailOptions); PrintMenuTable(r4, 4, gMailboxMailOptions);
InitMenuInUpperLeftCornerPlaySoundWhenAPressed(r4, 4, 0); InitMenuInUpperLeftCornerPlaySoundWhenAPressed(r4, 4, 0);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
gTasks[taskId].func = Mailbox_MailOptionsProcessInput; gTasks[taskId].func = Mailbox_MailOptionsProcessInput;
} }
@ -865,7 +865,7 @@ static void Mailbox_Cancel(u8 taskId)
sub_81D1D04(2); sub_81D1D04(2);
ClearDialogWindowAndFrame(0, 0); ClearDialogWindowAndFrame(0, 0);
Mailbox_DrawMailboxMenu(taskId); Mailbox_DrawMailboxMenu(taskId);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
gTasks[taskId].func = Mailbox_ProcessInput; gTasks[taskId].func = Mailbox_ProcessInput;
} }
@ -893,7 +893,7 @@ static u8 sub_816BC7C(u8 a)
{ {
*windowIdLoc = AddWindow(&gUnknown_085DFF5C[a]); *windowIdLoc = AddWindow(&gUnknown_085DFF5C[a]);
DrawStdFrameWithCustomTileAndPalette(*windowIdLoc, FALSE, 0x214, 0xE); DrawStdFrameWithCustomTileAndPalette(*windowIdLoc, FALSE, 0x214, 0xE);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
} }
return *windowIdLoc; return *windowIdLoc;
} }
@ -905,7 +905,7 @@ static void sub_816BCC4(u8 a)
{ {
ClearStdWindowAndFrameToTransparent(*windowIdLoc, FALSE); ClearStdWindowAndFrameToTransparent(*windowIdLoc, FALSE);
ClearWindowTilemap(*windowIdLoc); ClearWindowTilemap(*windowIdLoc);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
RemoveWindow(*windowIdLoc); RemoveWindow(*windowIdLoc);
*windowIdLoc = 0xFF; *windowIdLoc = 0xFF;
} }
@ -1076,7 +1076,7 @@ static void ItemStorage_ProcessWithdrawTossInput(u8 taskId)
ItemStorage_RefreshListMenu(); ItemStorage_RefreshListMenu();
data[5] = ListMenuInit(&gMultiuseListMenuTemplate, playerPCItemPageInfo.itemsAbove, playerPCItemPageInfo.cursorPos); data[5] = ListMenuInit(&gMultiuseListMenuTemplate, playerPCItemPageInfo.itemsAbove, playerPCItemPageInfo.cursorPos);
ItemStorage_StartScrollIndicator(); ItemStorage_StartScrollIndicator();
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
gTasks[taskId].func = ItemStorage_ProcessInput; gTasks[taskId].func = ItemStorage_ProcessInput;
} }
@ -1272,7 +1272,7 @@ static void ItemStorage_DoItemSwap(u8 taskId, bool8 a)
sub_81223FC(gUnknown_0203BCC4->spriteIds, 7, 1); sub_81223FC(gUnknown_0203BCC4->spriteIds, 7, 1);
gUnknown_0203BCC4->unk666 = 0xFF; gUnknown_0203BCC4->unk666 = 0xFF;
data[5] = ListMenuInit(&gMultiuseListMenuTemplate, playerPCItemPageInfo.itemsAbove, playerPCItemPageInfo.cursorPos); data[5] = ListMenuInit(&gMultiuseListMenuTemplate, playerPCItemPageInfo.itemsAbove, playerPCItemPageInfo.cursorPos);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
gTasks[taskId].func = ItemStorage_ProcessInput; gTasks[taskId].func = ItemStorage_ProcessInput;
} }

View File

@ -490,11 +490,11 @@ static void CB2_InitPokeblockMenu(void)
{ {
while (1) while (1)
{ {
if (sub_81221EC() == TRUE) if (MenuHelpers_CallLinkSomething() == TRUE)
break; break;
if (InitPokeblockMenu() == TRUE) if (InitPokeblockMenu() == TRUE)
break; break;
if (sub_81221AC() == TRUE) if (MenuHelpers_LinkSomething() == TRUE)
break; break;
} }
} }
@ -606,7 +606,7 @@ static void HandleInitBackgrounds(void)
InitBgsFromTemplates(0, sBgTemplatesForPokeblockMenu, ARRAY_COUNT(sBgTemplatesForPokeblockMenu)); InitBgsFromTemplates(0, sBgTemplatesForPokeblockMenu, ARRAY_COUNT(sBgTemplatesForPokeblockMenu));
SetBgTilemapBuffer(2, sPokeblockMenu->tilemap); SetBgTilemapBuffer(2, sPokeblockMenu->tilemap);
ResetAllBgsCoordinates(); ResetAllBgsCoordinates();
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP); SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP);
@ -622,12 +622,12 @@ static bool8 LoadPokeblockMenuGfx(void)
switch (sPokeblockMenu->gfxState) switch (sPokeblockMenu->gfxState)
{ {
case 0: case 0:
reset_temp_tile_data_buffers(); ResetTempTileDataBuffers();
decompress_and_copy_tile_data_to_vram(2, gMenuPokeblock_Gfx, 0, 0, 0); DecompressAndCopyTileDataToVram(2, gMenuPokeblock_Gfx, 0, 0, 0);
sPokeblockMenu->gfxState++; sPokeblockMenu->gfxState++;
break; break;
case 1: case 1:
if (free_temp_tile_data_buffers_if_possible() != TRUE) if (FreeTempTileDataBuffersIfPossible() != TRUE)
{ {
LZDecompressWram(gMenuPokeblock_Tilemap, sPokeblockMenu->tilemap); LZDecompressWram(gMenuPokeblock_Tilemap, sPokeblockMenu->tilemap);
sPokeblockMenu->gfxState++; sPokeblockMenu->gfxState++;
@ -669,8 +669,8 @@ static void HandleInitWindows(void)
FillWindowPixelBuffer(i, PIXEL_FILL(0)); FillWindowPixelBuffer(i, PIXEL_FILL(0));
} }
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
schedule_bg_copy_tilemap_to_vram(1); ScheduleBgCopyTilemapToVram(1);
} }
static void PrintOnPokeblockWindow(u8 windowId, const u8 *string, s32 x) static void PrintOnPokeblockWindow(u8 windowId, const u8 *string, s32 x)
@ -786,14 +786,14 @@ static void sub_8135FCC(s32 pkblId)
CopyWindowToVram(7, 2); CopyWindowToVram(7, 2);
} }
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
} }
static void HandlePokeblockMenuCursor(u16 cursorPos, u16 arg1) static void HandlePokeblockMenuCursor(u16 cursorPos, u16 arg1)
{ {
FillBgTilemapBufferRect_Palette0(2, arg1, 0xF, (cursorPos * 2) + 1, 0xE, 2); FillBgTilemapBufferRect_Palette0(2, arg1, 0xF, (cursorPos * 2) + 1, 0xE, 2);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
} }
static void CompactPokeblockSlots(void) static void CompactPokeblockSlots(void)
@ -982,7 +982,7 @@ static void Task_HandlePokeblockMenuInput(u8 taskId)
{ {
s16 *data = gTasks[taskId].data; s16 *data = gTasks[taskId].data;
if (!gPaletteFade.active && sub_81221EC() != TRUE) if (!gPaletteFade.active && MenuHelpers_CallLinkSomething() != TRUE)
{ {
if (gMain.newKeys & SELECT_BUTTON) if (gMain.newKeys & SELECT_BUTTON)
{ {
@ -1032,7 +1032,7 @@ static void Task_HandlePokeblocksSwapInput(u8 taskId)
{ {
s16 *data = gTasks[taskId].data; s16 *data = gTasks[taskId].data;
if (sub_81221EC() == TRUE) if (MenuHelpers_CallLinkSomething() == TRUE)
return; return;
if (gMain.newKeys & SELECT_BUTTON) if (gMain.newKeys & SELECT_BUTTON)
@ -1101,7 +1101,7 @@ static void HandlePokeblocksSwap(u8 taskId, bool8 noSwap)
sSavedPokeblockData.lastItemPos--; sSavedPokeblockData.lastItemPos--;
data[0] = ListMenuInit(&gMultiuseListMenuTemplate, sSavedPokeblockData.lastItemPage, sSavedPokeblockData.lastItemPos); data[0] = ListMenuInit(&gMultiuseListMenuTemplate, sSavedPokeblockData.lastItemPage, sSavedPokeblockData.lastItemPos);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
sub_81223FC(sPokeblockMenu->field_E75, FIELD_E75_COUNT, 1); sub_81223FC(sPokeblockMenu->field_E75, FIELD_E75_COUNT, 1);
for (i = 0; i < 9; i++) for (i = 0; i < 9; i++)
@ -1125,7 +1125,7 @@ static void PutPokeblockOptionsWindow(u8 taskId)
sub_81995E4(data[1], sPokeblockMenu->optionsNo, sPokeblockMenuActions, sPokeblockMenu->pokeblockOptionsIds); sub_81995E4(data[1], sPokeblockMenu->optionsNo, sPokeblockMenuActions, sPokeblockMenu->pokeblockOptionsIds);
InitMenuInUpperLeftCornerPlaySoundWhenAPressed(data[1], sPokeblockMenu->optionsNo, 0); InitMenuInUpperLeftCornerPlaySoundWhenAPressed(data[1], sPokeblockMenu->optionsNo, 0);
PutWindowTilemap(data[1]); PutWindowTilemap(data[1]);
schedule_bg_copy_tilemap_to_vram(1); ScheduleBgCopyTilemapToVram(1);
gTasks[taskId].func = Task_HandlePokeblockOptionsInput; gTasks[taskId].func = Task_HandlePokeblockOptionsInput;
} }
@ -1134,7 +1134,7 @@ static void Task_HandlePokeblockOptionsInput(u8 taskId)
{ {
s8 itemId; s8 itemId;
if (sub_81221EC() == TRUE) if (MenuHelpers_CallLinkSomething() == TRUE)
return; return;
itemId = Menu_ProcessInputNoWrap(); itemId = Menu_ProcessInputNoWrap();
@ -1212,8 +1212,8 @@ static void HandleErasePokeblock(u8 taskId)
HandlePokeblockListMenuItems(); HandlePokeblockListMenuItems();
data[0] = ListMenuInit(&gMultiuseListMenuTemplate, *lastPage, *lastPos); data[0] = ListMenuInit(&gMultiuseListMenuTemplate, *lastPage, *lastPos);
HandlePokeblockMenuCursor(*lastPos, 0x1005); HandlePokeblockMenuCursor(*lastPos, 0x1005);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
schedule_bg_copy_tilemap_to_vram(1); ScheduleBgCopyTilemapToVram(1);
TossPokeblockChoice_No(taskId); TossPokeblockChoice_No(taskId);
} }
} }
@ -1221,7 +1221,7 @@ static void HandleErasePokeblock(u8 taskId)
static void TossPokeblockChoice_No(u8 taskId) static void TossPokeblockChoice_No(u8 taskId)
{ {
ClearDialogWindowAndFrameToTransparent(10, FALSE); ClearDialogWindowAndFrameToTransparent(10, FALSE);
schedule_bg_copy_tilemap_to_vram(1); ScheduleBgCopyTilemapToVram(1);
sub_81363BC(); sub_81363BC();
gTasks[taskId].func = Task_HandlePokeblockMenuInput; gTasks[taskId].func = Task_HandlePokeblockMenuInput;
} }
@ -1268,7 +1268,7 @@ static void PokeblockAction_Cancel(u8 taskId)
s16 *data = gTasks[taskId].data; s16 *data = gTasks[taskId].data;
ClearStdWindowAndFrameToTransparent(data[1], FALSE); ClearStdWindowAndFrameToTransparent(data[1], FALSE);
schedule_bg_copy_tilemap_to_vram(1); ScheduleBgCopyTilemapToVram(1);
sub_81363BC(); sub_81363BC();
gTasks[taskId].func = Task_HandlePokeblockMenuInput; gTasks[taskId].func = Task_HandlePokeblockMenuInput;
} }

View File

@ -607,11 +607,11 @@ void CB2_PreparePokeblockFeedScene(void)
{ {
while (1) while (1)
{ {
if (sub_81221EC() == TRUE) if (MenuHelpers_CallLinkSomething() == TRUE)
break; break;
if (TransitionToPokeblockFeedScene() == TRUE) if (TransitionToPokeblockFeedScene() == TRUE)
break; break;
if (sub_81221AC() == TRUE) if (MenuHelpers_LinkSomething() == TRUE)
break; break;
} }
} }
@ -624,7 +624,7 @@ static void HandleInitBackgrounds(void)
InitBgsFromTemplates(0, sBackgroundTemplates, ARRAY_COUNT(sBackgroundTemplates)); InitBgsFromTemplates(0, sBackgroundTemplates, ARRAY_COUNT(sBackgroundTemplates));
SetBgTilemapBuffer(1, sPokeblockFeed->tilemapBuffer); SetBgTilemapBuffer(1, sPokeblockFeed->tilemapBuffer);
ResetAllBgsCoordinates(); ResetAllBgsCoordinates();
schedule_bg_copy_tilemap_to_vram(1); ScheduleBgCopyTilemapToVram(1);
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP); SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP);
@ -676,12 +676,12 @@ static bool8 LoadMonAndSceneGfx(struct Pokemon *mon)
sPokeblockFeed->loadGfxState++; sPokeblockFeed->loadGfxState++;
break; break;
case 6: case 6:
reset_temp_tile_data_buffers(); ResetTempTileDataBuffers();
decompress_and_copy_tile_data_to_vram(1, gBattleTerrainTiles_Building, 0, 0, 0); DecompressAndCopyTileDataToVram(1, gBattleTerrainTiles_Building, 0, 0, 0);
sPokeblockFeed->loadGfxState++; sPokeblockFeed->loadGfxState++;
break; break;
case 7: case 7:
if (free_temp_tile_data_buffers_if_possible() != TRUE) if (FreeTempTileDataBuffersIfPossible() != TRUE)
{ {
LZDecompressWram(gUnknown_08D9BA44, sPokeblockFeed->tilemapBuffer); LZDecompressWram(gUnknown_08D9BA44, sPokeblockFeed->tilemapBuffer);
sPokeblockFeed->loadGfxState++; sPokeblockFeed->loadGfxState++;
@ -704,7 +704,7 @@ static void HandleInitWindows(void)
LoadPalette(gUnknown_0860F074, 0xF0, 0x20); LoadPalette(gUnknown_0860F074, 0xF0, 0x20);
FillWindowPixelBuffer(0, PIXEL_FILL(0)); FillWindowPixelBuffer(0, PIXEL_FILL(0));
PutWindowTilemap(0); PutWindowTilemap(0);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
} }
static void SetPokeblockSpritePal(u8 pokeblockCaseId) static void SetPokeblockSpritePal(u8 pokeblockCaseId)

View File

@ -23,15 +23,15 @@ void LoadPokedexAreaMapGfx(const struct PokedexAreaMapTemplate *template)
if (mode == 0) if (mode == 0)
{ {
SetBgAttribute(template->bg, BG_ATTR_METRIC, 0); SetBgAttribute(template->bg, BG_ATTR_METRIC, 0);
decompress_and_copy_tile_data_to_vram(template->bg, sPokedexAreaMap_Gfx, 0, template->offset, 0); DecompressAndCopyTileDataToVram(template->bg, sPokedexAreaMap_Gfx, 0, template->offset, 0);
sub_8199D3C(decompress_and_copy_tile_data_to_vram(template->bg, sPokedexAreaMap_Tilemap, 0, 0, 1), template->offset, 32, 32, FALSE); sub_8199D3C(DecompressAndCopyTileDataToVram(template->bg, sPokedexAreaMap_Tilemap, 0, 0, 1), template->offset, 32, 32, FALSE);
} }
else else
{ {
SetBgAttribute(template->bg, BG_ATTR_METRIC, 2); SetBgAttribute(template->bg, BG_ATTR_METRIC, 2);
SetBgAttribute(template->bg, BG_ATTR_TYPE, 1); SetBgAttribute(template->bg, BG_ATTR_TYPE, 1);
decompress_and_copy_tile_data_to_vram(template->bg, sPokedexAreaMapAffine_Gfx, 0, template->offset, 0); DecompressAndCopyTileDataToVram(template->bg, sPokedexAreaMapAffine_Gfx, 0, template->offset, 0);
sub_8199D3C(decompress_and_copy_tile_data_to_vram(template->bg, sPokedexAreaMapAffine_Tilemap, 0, 0, 1), template->offset, 64, 64, TRUE); sub_8199D3C(DecompressAndCopyTileDataToVram(template->bg, sPokedexAreaMapAffine_Tilemap, 0, 0, 1), template->offset, 64, 64, TRUE);
} }
ChangeBgX(template->bg, 0, 0); ChangeBgX(template->bg, 0, 0);
@ -43,7 +43,7 @@ void LoadPokedexAreaMapGfx(const struct PokedexAreaMapTemplate *template)
bool32 sub_81C4E90(void) bool32 sub_81C4E90(void)
{ {
if (!free_temp_tile_data_buffers_if_possible()) if (!FreeTempTileDataBuffersIfPossible())
{ {
ShowBg(*sPokedexAreaMapBgNum); ShowBg(*sPokedexAreaMapBgNum);
return FALSE; return FALSE;

View File

@ -310,11 +310,11 @@ static bool8 DrawAreaGlow(void)
BuildAreaGlowTilemap(); BuildAreaGlowTilemap();
break; break;
case 2: case 2:
decompress_and_copy_tile_data_to_vram(2, sAreaGlow_Gfx, 0, 0, 0); DecompressAndCopyTileDataToVram(2, sAreaGlow_Gfx, 0, 0, 0);
LoadBgTilemap(2, sPokedexAreaScreen->areaGlowTilemap, 0x500, 0); LoadBgTilemap(2, sPokedexAreaScreen->areaGlowTilemap, 0x500, 0);
break; break;
case 3: case 3:
if (!free_temp_tile_data_buffers_if_possible()) if (!FreeTempTileDataBuffersIfPossible())
{ {
CpuCopy32(sAreaGlow_Pal, gPlttBufferUnfaded + 0xA0, 0x20); CpuCopy32(sAreaGlow_Pal, gPlttBufferUnfaded + 0xA0, 0x20);
sPokedexAreaScreen->drawAreaGlowState++; sPokedexAreaScreen->drawAreaGlowState++;

View File

@ -2966,18 +2966,18 @@ static void sub_802D150(void)
ResetBgsAndClearDma3BusyFlags(0); ResetBgsAndClearDma3BusyFlags(0);
InitBgsFromTemplates(0, gUnknown_082FE164, ARRAY_COUNT(gUnknown_082FE164)); InitBgsFromTemplates(0, gUnknown_082FE164, ARRAY_COUNT(gUnknown_082FE164));
InitWindows(gUnknown_082FE174); InitWindows(gUnknown_082FE174);
reset_temp_tile_data_buffers(); ResetTempTileDataBuffers();
sub_802C974(gUnknown_02022D00); sub_802C974(gUnknown_02022D00);
sub_802DD08(); sub_802DD08();
LoadPalette(gPkmnJumpBgPal, 0, 0x20); LoadPalette(gPkmnJumpBgPal, 0, 0x20);
decompress_and_copy_tile_data_to_vram(3, gPkmnJumpBgGfx, 0, 0, 0); DecompressAndCopyTileDataToVram(3, gPkmnJumpBgGfx, 0, 0, 0);
decompress_and_copy_tile_data_to_vram(3, gPkmnJumpBgTilemap, 0, 0, 1); DecompressAndCopyTileDataToVram(3, gPkmnJumpBgTilemap, 0, 0, 1);
LoadPalette(gPkmnJumpVenusaurPal, 0x30, 0x20); LoadPalette(gPkmnJumpVenusaurPal, 0x30, 0x20);
decompress_and_copy_tile_data_to_vram(2, gPkmnJumpVenusaurGfx, 0, 0, 0); DecompressAndCopyTileDataToVram(2, gPkmnJumpVenusaurGfx, 0, 0, 0);
decompress_and_copy_tile_data_to_vram(2, gPkmnJumpVenusaurTilemap, 0, 0, 1); DecompressAndCopyTileDataToVram(2, gPkmnJumpVenusaurTilemap, 0, 0, 1);
LoadPalette(gPkmnJumpResultsPal, 0x10, 0x20); LoadPalette(gPkmnJumpResultsPal, 0x10, 0x20);
decompress_and_copy_tile_data_to_vram(1, gPkmnJumpResultsGfx, 0, 0, 0); DecompressAndCopyTileDataToVram(1, gPkmnJumpResultsGfx, 0, 0, 0);
decompress_and_copy_tile_data_to_vram(1, gPkmnJumpResultsTilemap, 0, 0, 1); DecompressAndCopyTileDataToVram(1, gPkmnJumpResultsTilemap, 0, 0, 1);
LoadPalette(gPkmnJumpPal3, 0x20, 0x20); LoadPalette(gPkmnJumpPal3, 0x20, 0x20);
SetBgTilemapBuffer(0, gUnknown_02022D00->tilemapBuffer); SetBgTilemapBuffer(0, gUnknown_02022D00->tilemapBuffer);
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x20, 0x20); FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x20, 0x20);
@ -2991,7 +2991,7 @@ static void sub_802D150(void)
gUnknown_02022D00->unk4++; gUnknown_02022D00->unk4++;
break; break;
case 1: case 1:
if (!free_temp_tile_data_buffers_if_possible()) if (!FreeTempTileDataBuffersIfPossible())
{ {
sub_802DBF8(); sub_802DBF8();
sub_802CE9C(gUnknown_02022D00); sub_802CE9C(gUnknown_02022D00);

View File

@ -3892,7 +3892,7 @@ static void Cb_ChangeScreen(u8 taskId)
break; break;
case SCREEN_CHANGE_ITEM_FROM_BAG: case SCREEN_CHANGE_ITEM_FROM_BAG:
FreePSSData(); FreePSSData();
GoToBagMenu(11, 0, Cb2_ReturnToPSS); GoToBagMenu(ITEMMENULOCATION_PCBOX, 0, Cb2_ReturnToPSS);
break; break;
} }
@ -3944,7 +3944,7 @@ static void LoadPSSMenuGfx(void)
LZ77UnCompWram(gUnknown_085722A0, sPSSData->field_5AC4); LZ77UnCompWram(gUnknown_085722A0, sPSSData->field_5AC4);
SetBgTilemapBuffer(1, sPSSData->field_5AC4); SetBgTilemapBuffer(1, sPSSData->field_5AC4);
ShowBg(1); ShowBg(1);
schedule_bg_copy_tilemap_to_vram(1); ScheduleBgCopyTilemapToVram(1);
} }
static bool8 InitPSSWindows(void) static bool8 InitPSSWindows(void)
@ -4010,7 +4010,7 @@ static void RefreshCursorMonData(void)
LoadCursorMonGfx(sPSSData->cursorMonSpecies, sPSSData->cursorMonPersonality); LoadCursorMonGfx(sPSSData->cursorMonSpecies, sPSSData->cursorMonPersonality);
PrintCursorMonInfo(); PrintCursorMonInfo();
sub_80CA65C(); sub_80CA65C();
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
} }
static void BoxSetMosaic(void) static void BoxSetMosaic(void)
@ -4154,7 +4154,7 @@ static void sub_80CA65C(void)
} }
sub_80D2918(0); sub_80D2918(0);
schedule_bg_copy_tilemap_to_vram(1); ScheduleBgCopyTilemapToVram(1);
} }
static void sub_80CA704(void) static void sub_80CA704(void)
@ -4181,7 +4181,7 @@ static void sub_80CA704(void)
sub_80D2918(2); sub_80D2918(2);
} }
schedule_bg_copy_tilemap_to_vram(1); ScheduleBgCopyTilemapToVram(1);
sPSSData->unk_02C7 = 0; sPSSData->unk_02C7 = 0;
} }
@ -4202,7 +4202,7 @@ static bool8 ShowPartyMenu(void)
sPSSData->field_2C2++; sPSSData->field_2C2++;
sub_80D27F4(1, 3, 1); sub_80D27F4(1, 3, 1);
sub_80D2918(1); sub_80D2918(1);
schedule_bg_copy_tilemap_to_vram(1); ScheduleBgCopyTilemapToVram(1);
sub_80CBAF0(8); sub_80CBAF0(8);
if (++sPSSData->field_2C5 == 20) if (++sPSSData->field_2C5 == 20)
{ {
@ -4236,7 +4236,7 @@ static bool8 HidePartyMenu(void)
sub_80CBAF0(-8); sub_80CBAF0(-8);
if (++sPSSData->field_2C5 != 20) if (++sPSSData->field_2C5 != 20)
{ {
schedule_bg_copy_tilemap_to_vram(1); ScheduleBgCopyTilemapToVram(1);
return TRUE; return TRUE;
} }
else else
@ -4246,7 +4246,7 @@ static bool8 HidePartyMenu(void)
CompactPartySlots(); CompactPartySlots();
sub_80D27AC(2, 0, 0, 9, 2); sub_80D27AC(2, 0, 0, 9, 2);
sub_80D2918(2); sub_80D2918(2);
schedule_bg_copy_tilemap_to_vram(1); ScheduleBgCopyTilemapToVram(1);
return FALSE; return FALSE;
} }
} }
@ -4262,7 +4262,7 @@ static void sub_80CA984(bool8 arg0)
sub_80D27AC(2, 0, 2, 9, 2); sub_80D27AC(2, 0, 2, 9, 2);
sub_80D2918(2); sub_80D2918(2);
schedule_bg_copy_tilemap_to_vram(1); ScheduleBgCopyTilemapToVram(1);
} }
static void sub_80CA9C0(void) static void sub_80CA9C0(void)
@ -4331,7 +4331,7 @@ static void sub_80CAB20(void)
sub_80CAA74(); sub_80CAA74();
sub_80D27AC(1, 0, 0, 12, 22); sub_80D27AC(1, 0, 0, 12, 22);
sub_80D2918(1); sub_80D2918(1);
schedule_bg_copy_tilemap_to_vram(1); ScheduleBgCopyTilemapToVram(1);
} }
static void SetUpDoShowPartyMenu(void) static void SetUpDoShowPartyMenu(void)
@ -4422,7 +4422,7 @@ static void PrintStorageActionText(u8 id)
DrawTextBorderOuter(1, 2, 14); DrawTextBorderOuter(1, 2, 14);
PutWindowTilemap(1); PutWindowTilemap(1);
CopyWindowToVram(1, 2); CopyWindowToVram(1, 2);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
} }
static void ShowYesNoWindow(s8 cursorPos) static void ShowYesNoWindow(s8 cursorPos)
@ -4434,7 +4434,7 @@ static void ShowYesNoWindow(s8 cursorPos)
static void ClearBottomWindow(void) static void ClearBottomWindow(void)
{ {
ClearStdWindowAndFrameToTransparent(1, FALSE); ClearStdWindowAndFrameToTransparent(1, FALSE);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
} }
static void AddWallpaperSetsMenu(void) static void AddWallpaperSetsMenu(void)
@ -7904,7 +7904,7 @@ static void AddMenu(void)
DrawStdFrameWithCustomTileAndPalette(sPSSData->field_CB0, FALSE, 11, 14); DrawStdFrameWithCustomTileAndPalette(sPSSData->field_CB0, FALSE, 11, 14);
PrintMenuTable(sPSSData->field_CB0, sPSSData->menuItemsCount, (void*)sPSSData->menuItems); PrintMenuTable(sPSSData->field_CB0, sPSSData->menuItemsCount, (void*)sPSSData->menuItems);
InitMenuInUpperLeftCornerPlaySoundWhenAPressed(sPSSData->field_CB0, sPSSData->menuItemsCount, 0); InitMenuInUpperLeftCornerPlaySoundWhenAPressed(sPSSData->field_CB0, sPSSData->menuItemsCount, 0);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
sPSSData->field_CAE = 0; sPSSData->field_CAE = 0;
} }
@ -9127,7 +9127,7 @@ static bool8 sub_80D18E4(void)
sub_80D19B4(var); sub_80D19B4(var);
FillBgTilemapBufferRect(0, 0, var + 1, 12, 1, 9, 0x11); FillBgTilemapBufferRect(0, 0, var + 1, 12, 1, 9, 0x11);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
return TRUE; return TRUE;
} }
@ -9141,7 +9141,7 @@ static void sub_80D19B4(u32 arg0)
FillBgTilemapBufferRect(0, 0x13B, arg0, 0xD, 1, 7, 0xFu); FillBgTilemapBufferRect(0, 0x13B, arg0, 0xD, 1, 7, 0xFu);
FillBgTilemapBufferRect(0, 0x13C, arg0, 0xC, 1, 1, 0xFu); FillBgTilemapBufferRect(0, 0x13C, arg0, 0xC, 1, 1, 0xFu);
FillBgTilemapBufferRect(0, 0x13D, arg0, 0x14, 1, 1, 0xFu); FillBgTilemapBufferRect(0, 0x13D, arg0, 0x14, 1, 1, 0xFu);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
} }
static void sub_80D1A48(struct Sprite *sprite) static void sub_80D1A48(struct Sprite *sprite)

View File

@ -1133,7 +1133,7 @@ static void VBlank(void)
static void CB2_InitSummaryScreen(void) static void CB2_InitSummaryScreen(void)
{ {
while (sub_81221EC() != TRUE && LoadGraphics() != TRUE && sub_81221AC() != TRUE); while (MenuHelpers_CallLinkSomething() != TRUE && LoadGraphics() != TRUE && MenuHelpers_LinkSomething() != TRUE);
} }
static bool8 LoadGraphics(void) static bool8 LoadGraphics(void)
@ -1271,9 +1271,9 @@ static void InitBGs(void)
SetBgTilemapBuffer(2, sMonSummaryScreen->bgTilemapBuffers[PSS_PAGE_SKILLS][0]); SetBgTilemapBuffer(2, sMonSummaryScreen->bgTilemapBuffers[PSS_PAGE_SKILLS][0]);
SetBgTilemapBuffer(3, sMonSummaryScreen->bgTilemapBuffers[PSS_PAGE_INFO][0]); SetBgTilemapBuffer(3, sMonSummaryScreen->bgTilemapBuffers[PSS_PAGE_INFO][0]);
ResetAllBgsCoordinates(); ResetAllBgsCoordinates();
schedule_bg_copy_tilemap_to_vram(1); ScheduleBgCopyTilemapToVram(1);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
schedule_bg_copy_tilemap_to_vram(3); ScheduleBgCopyTilemapToVram(3);
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP); SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP);
SetGpuReg(REG_OFFSET_BLDCNT, 0); SetGpuReg(REG_OFFSET_BLDCNT, 0);
ShowBg(0); ShowBg(0);
@ -1287,12 +1287,12 @@ static bool8 DecompressGraphics(void)
switch (sMonSummaryScreen->switchCounter) switch (sMonSummaryScreen->switchCounter)
{ {
case 0: case 0:
reset_temp_tile_data_buffers(); ResetTempTileDataBuffers();
decompress_and_copy_tile_data_to_vram(1, &gStatusScreenBitmap, 0, 0, 0); DecompressAndCopyTileDataToVram(1, &gStatusScreenBitmap, 0, 0, 0);
sMonSummaryScreen->switchCounter++; sMonSummaryScreen->switchCounter++;
break; break;
case 1: case 1:
if (free_temp_tile_data_buffers_if_possible() != 1) if (FreeTempTileDataBuffersIfPossible() != 1)
{ {
LZDecompressWram(gPageInfoTilemap, sMonSummaryScreen->bgTilemapBuffers[PSS_PAGE_INFO][0]); LZDecompressWram(gPageInfoTilemap, sMonSummaryScreen->bgTilemapBuffers[PSS_PAGE_INFO][0]);
sMonSummaryScreen->switchCounter++; sMonSummaryScreen->switchCounter++;
@ -1477,7 +1477,7 @@ static void BeginCloseSummaryScreen(u8 taskId)
static void CloseSummaryScreen(u8 taskId) static void CloseSummaryScreen(u8 taskId)
{ {
if (sub_81221EC() != TRUE && !gPaletteFade.active) if (MenuHelpers_CallLinkSomething() != TRUE && !gPaletteFade.active)
{ {
SetMainCallback2(sMonSummaryScreen->callback); SetMainCallback2(sMonSummaryScreen->callback);
gLastViewedMonIndex = sMonSummaryScreen->curMonIndex; gLastViewedMonIndex = sMonSummaryScreen->curMonIndex;
@ -1495,7 +1495,7 @@ static void CloseSummaryScreen(u8 taskId)
static void Task_HandleInput(u8 taskId) static void Task_HandleInput(u8 taskId)
{ {
if (sub_81221EC() != TRUE && !gPaletteFade.active) if (MenuHelpers_CallLinkSomething() != TRUE && !gPaletteFade.active)
{ {
if (gMain.newKeys & DPAD_UP) if (gMain.newKeys & DPAD_UP)
{ {
@ -1579,7 +1579,7 @@ static void ChangeSummaryPokemon(u8 taskId, s8 delta)
{ {
SetSpriteInvisibility(SPRITE_ARR_ID_STATUS, TRUE); SetSpriteInvisibility(SPRITE_ARR_ID_STATUS, TRUE);
ClearWindowTilemap(PSS_LABEL_WINDOW_POKEMON_SKILLS_STATUS); ClearWindowTilemap(PSS_LABEL_WINDOW_POKEMON_SKILLS_STATUS);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
HandleStatusTilemap(0, 2); HandleStatusTilemap(0, 2);
} }
sMonSummaryScreen->curMonIndex = monId; sMonSummaryScreen->curMonIndex = monId;
@ -1647,7 +1647,7 @@ static void Task_ChangeSummaryMon(u8 taskId)
gSprites[sMonSummaryScreen->spriteIds[SPRITE_ARR_ID_MON]].data[2] = 0; gSprites[sMonSummaryScreen->spriteIds[SPRITE_ARR_ID_MON]].data[2] = 0;
break; break;
default: default:
if (sub_81221EC() == 0 && FuncIsActiveTask(Task_ShowStatusWindow) == 0) if (MenuHelpers_CallLinkSomething() == 0 && FuncIsActiveTask(Task_ShowStatusWindow) == 0)
{ {
data[0] = 0; data[0] = 0;
gTasks[taskId].func = Task_HandleInput; gTasks[taskId].func = Task_HandleInput;
@ -1756,14 +1756,14 @@ static void PssScrollRight(u8 taskId) // Scroll right
data[1] = 1; data[1] = 1;
SetBgAttribute(1, BG_ATTR_PRIORITY, 1); SetBgAttribute(1, BG_ATTR_PRIORITY, 1);
SetBgAttribute(2, BG_ATTR_PRIORITY, 2); SetBgAttribute(2, BG_ATTR_PRIORITY, 2);
schedule_bg_copy_tilemap_to_vram(1); ScheduleBgCopyTilemapToVram(1);
} }
else else
{ {
data[1] = 2; data[1] = 2;
SetBgAttribute(2, BG_ATTR_PRIORITY, 1); SetBgAttribute(2, BG_ATTR_PRIORITY, 1);
SetBgAttribute(1, BG_ATTR_PRIORITY, 2); SetBgAttribute(1, BG_ATTR_PRIORITY, 2);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
} }
ChangeBgX(data[1], 0, 0); ChangeBgX(data[1], 0, 0);
SetBgTilemapBuffer(data[1], sMonSummaryScreen->bgTilemapBuffers[sMonSummaryScreen->currPageIndex][0]); SetBgTilemapBuffer(data[1], sMonSummaryScreen->bgTilemapBuffers[sMonSummaryScreen->currPageIndex][0]);
@ -1813,13 +1813,13 @@ static void PssScrollLeftEnd(u8 taskId) // display left
{ {
SetBgAttribute(1, BG_ATTR_PRIORITY, 1); SetBgAttribute(1, BG_ATTR_PRIORITY, 1);
SetBgAttribute(2, BG_ATTR_PRIORITY, 2); SetBgAttribute(2, BG_ATTR_PRIORITY, 2);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
} }
else else
{ {
SetBgAttribute(2, BG_ATTR_PRIORITY, 1); SetBgAttribute(2, BG_ATTR_PRIORITY, 1);
SetBgAttribute(1, BG_ATTR_PRIORITY, 2); SetBgAttribute(1, BG_ATTR_PRIORITY, 2);
schedule_bg_copy_tilemap_to_vram(1); ScheduleBgCopyTilemapToVram(1);
} }
if (sMonSummaryScreen->currPageIndex > 1) if (sMonSummaryScreen->currPageIndex > 1)
{ {
@ -1865,9 +1865,9 @@ static void SwitchToMoveSelection(u8 taskId)
PrintMoveDetails(move); PrintMoveDetails(move);
PrintNewMoveDetailsOrCancelText(); PrintNewMoveDetailsOrCancelText();
SetNewMoveTypeIcon(); SetNewMoveTypeIcon();
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
schedule_bg_copy_tilemap_to_vram(1); ScheduleBgCopyTilemapToVram(1);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
CreateMoveSelectorSprites(SPRITE_ARR_ID_MOVE_SELECTOR1); CreateMoveSelectorSprites(SPRITE_ARR_ID_MOVE_SELECTOR1);
gTasks[taskId].func = Task_HandleInput_MoveSelect; gTasks[taskId].func = Task_HandleInput_MoveSelect;
} }
@ -1876,7 +1876,7 @@ static void Task_HandleInput_MoveSelect(u8 taskId)
{ {
s16 *data = gTasks[taskId].data; s16 *data = gTasks[taskId].data;
if (sub_81221EC() != 1) if (MenuHelpers_CallLinkSomething() != 1)
{ {
if (gMain.newKeys & DPAD_UP) if (gMain.newKeys & DPAD_UP)
{ {
@ -1950,8 +1950,8 @@ static void ChangeSelectedMove(s16 *taskData, s8 direction, u8 *moveIndexPtr)
break; break;
} }
DrawContestMoveHearts(move); DrawContestMoveHearts(move);
schedule_bg_copy_tilemap_to_vram(1); ScheduleBgCopyTilemapToVram(1);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
PrintMoveDetails(move); PrintMoveDetails(move);
if ((*moveIndexPtr == MAX_MON_MOVES && sMonSummaryScreen->newMove == MOVE_NONE) if ((*moveIndexPtr == MAX_MON_MOVES && sMonSummaryScreen->newMove == MOVE_NONE)
|| taskData[1] == 1) || taskData[1] == 1)
@ -1959,7 +1959,7 @@ static void ChangeSelectedMove(s16 *taskData, s8 direction, u8 *moveIndexPtr)
ClearWindowTilemap(PSS_LABEL_WINDOW_PORTRAIT_SPECIES); ClearWindowTilemap(PSS_LABEL_WINDOW_PORTRAIT_SPECIES);
if (!gSprites[sMonSummaryScreen->spriteIds[SPRITE_ARR_ID_STATUS]].invisible) if (!gSprites[sMonSummaryScreen->spriteIds[SPRITE_ARR_ID_STATUS]].invisible)
ClearWindowTilemap(PSS_LABEL_WINDOW_POKEMON_SKILLS_STATUS); ClearWindowTilemap(PSS_LABEL_WINDOW_POKEMON_SKILLS_STATUS);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
HandlePowerAccTilemap(9, -3); HandlePowerAccTilemap(9, -3);
HandleAppealJamTilemap(9, -3, move); HandleAppealJamTilemap(9, -3, move);
} }
@ -1969,7 +1969,7 @@ static void ChangeSelectedMove(s16 *taskData, s8 direction, u8 *moveIndexPtr)
{ {
ClearWindowTilemap(PSS_LABEL_WINDOW_MOVES_POWER_ACC); ClearWindowTilemap(PSS_LABEL_WINDOW_MOVES_POWER_ACC);
ClearWindowTilemap(PSS_LABEL_WINDOW_MOVES_APPEAL_JAM); ClearWindowTilemap(PSS_LABEL_WINDOW_MOVES_APPEAL_JAM);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
HandlePowerAccTilemap(0, 3); HandlePowerAccTilemap(0, 3);
HandleAppealJamTilemap(0, 3, 0); HandleAppealJamTilemap(0, 3, 0);
} }
@ -1998,9 +1998,9 @@ static void CloseMoveSelectMode(u8 taskId)
HandlePowerAccTilemap(0, 3); HandlePowerAccTilemap(0, 3);
HandleAppealJamTilemap(0, 3, 0); HandleAppealJamTilemap(0, 3, 0);
} }
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
schedule_bg_copy_tilemap_to_vram(1); ScheduleBgCopyTilemapToVram(1);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
gTasks[taskId].func = Task_HandleInput; gTasks[taskId].func = Task_HandleInput;
} }
@ -2016,7 +2016,7 @@ static void Task_HandleInput_MovePositionSwitch(u8 taskId)
{ {
s16* data = gTasks[taskId].data; s16* data = gTasks[taskId].data;
if (sub_81221EC() != TRUE) if (MenuHelpers_CallLinkSomething() != TRUE)
{ {
if (gMain.newKeys & DPAD_UP) if (gMain.newKeys & DPAD_UP)
{ {
@ -2071,8 +2071,8 @@ static void ExitMovePositionSwitchMode(u8 taskId, bool8 swapMoves)
move = sMonSummaryScreen->summary.moves[sMonSummaryScreen->firstMoveIndex]; move = sMonSummaryScreen->summary.moves[sMonSummaryScreen->firstMoveIndex];
PrintMoveDetails(move); PrintMoveDetails(move);
DrawContestMoveHearts(move); DrawContestMoveHearts(move);
schedule_bg_copy_tilemap_to_vram(1); ScheduleBgCopyTilemapToVram(1);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
gTasks[taskId].func = Task_HandleInput_MoveSelect; gTasks[taskId].func = Task_HandleInput_MoveSelect;
} }
@ -2157,7 +2157,7 @@ static void Task_HandleReplaceMoveInput(u8 taskId)
{ {
s16* data = gTasks[taskId].data; s16* data = gTasks[taskId].data;
if (sub_81221EC() != TRUE) if (MenuHelpers_CallLinkSomething() != TRUE)
{ {
if (gPaletteFade.active != TRUE) if (gPaletteFade.active != TRUE)
{ {
@ -2221,7 +2221,7 @@ static void ShowCantForgetHMsWindow(u8 taskId)
{ {
ClearWindowTilemap(PSS_LABEL_WINDOW_MOVES_POWER_ACC); ClearWindowTilemap(PSS_LABEL_WINDOW_MOVES_POWER_ACC);
ClearWindowTilemap(PSS_LABEL_WINDOW_MOVES_APPEAL_JAM); ClearWindowTilemap(PSS_LABEL_WINDOW_MOVES_APPEAL_JAM);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
HandlePowerAccTilemap(0, 3); HandlePowerAccTilemap(0, 3);
HandleAppealJamTilemap(0, 3, 0); HandleAppealJamTilemap(0, 3, 0);
PrintHMMovesCantBeForgotten(); PrintHMMovesCantBeForgotten();
@ -2286,7 +2286,7 @@ static void Task_HandleInputCantForgetHMsMoves(u8 taskId)
ClearWindowTilemap(PSS_LABEL_WINDOW_POKEMON_SKILLS_STATUS); ClearWindowTilemap(PSS_LABEL_WINDOW_POKEMON_SKILLS_STATUS);
move = sMonSummaryScreen->summary.moves[sMonSummaryScreen->firstMoveIndex]; move = sMonSummaryScreen->summary.moves[sMonSummaryScreen->firstMoveIndex];
PrintMoveDetails(move); PrintMoveDetails(move);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
HandlePowerAccTilemap(9, -3); HandlePowerAccTilemap(9, -3);
HandleAppealJamTilemap(9, -3, move); HandleAppealJamTilemap(9, -3, move);
gTasks[taskId].func = Task_HandleReplaceMoveInput; gTasks[taskId].func = Task_HandleReplaceMoveInput;
@ -2362,7 +2362,7 @@ static void DrawPagination(void) // Updates the pagination dots at the top of th
} }
} }
CopyToBgTilemapBufferRect_ChangePalette(3, alloced, 11, 0, 8, 2, 16); CopyToBgTilemapBufferRect_ChangePalette(3, alloced, 11, 0, 8, 2, 16);
schedule_bg_copy_tilemap_to_vram(3); ScheduleBgCopyTilemapToVram(3);
Free(alloced); Free(alloced);
} }
@ -2435,11 +2435,11 @@ static void Task_ShowPowerAccWindow(u8 taskId)
PutWindowTilemap(PSS_LABEL_WINDOW_POKEMON_SKILLS_STATUS); PutWindowTilemap(PSS_LABEL_WINDOW_POKEMON_SKILLS_STATUS);
PutWindowTilemap(PSS_LABEL_WINDOW_PORTRAIT_SPECIES); PutWindowTilemap(PSS_LABEL_WINDOW_PORTRAIT_SPECIES);
} }
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
DestroyTask(taskId); DestroyTask(taskId);
} }
schedule_bg_copy_tilemap_to_vram(1); ScheduleBgCopyTilemapToVram(1);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
} }
static void HandleAppealJamTilemap(u16 a, s16 b, u16 move) static void HandleAppealJamTilemap(u16 a, s16 b, u16 move)
@ -2491,11 +2491,11 @@ static void Task_ShowAppealJamWindow(u8 taskId)
} }
PutWindowTilemap(PSS_LABEL_WINDOW_PORTRAIT_SPECIES); PutWindowTilemap(PSS_LABEL_WINDOW_PORTRAIT_SPECIES);
} }
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
DestroyTask(taskId); DestroyTask(taskId);
} }
schedule_bg_copy_tilemap_to_vram(1); ScheduleBgCopyTilemapToVram(1);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
} }
static void HandleStatusTilemap(u16 a, s16 b) static void HandleStatusTilemap(u16 a, s16 b)
@ -2525,14 +2525,14 @@ static void Task_ShowStatusWindow(u8 taskId)
data[1] = sStatusTilemapCtrl1.field_6; data[1] = sStatusTilemapCtrl1.field_6;
ChangeTilemap(&sStatusTilemapCtrl1, sMonSummaryScreen->bgTilemapBuffers[PSS_PAGE_INFO][0], data[1], FALSE); ChangeTilemap(&sStatusTilemapCtrl1, sMonSummaryScreen->bgTilemapBuffers[PSS_PAGE_INFO][0], data[1], FALSE);
ChangeTilemap(&sStatusTilemapCtrl2, sMonSummaryScreen->bgTilemapBuffers[PSS_PAGE_INFO][0], data[1], FALSE); ChangeTilemap(&sStatusTilemapCtrl2, sMonSummaryScreen->bgTilemapBuffers[PSS_PAGE_INFO][0], data[1], FALSE);
schedule_bg_copy_tilemap_to_vram(3); ScheduleBgCopyTilemapToVram(3);
if (data[1] <= 0 || data[1] >= sStatusTilemapCtrl1.field_6) if (data[1] <= 0 || data[1] >= sStatusTilemapCtrl1.field_6)
{ {
if (data[0] < 0) if (data[0] < 0)
{ {
CreateSetStatusSprite(); CreateSetStatusSprite();
PutWindowTilemap(PSS_LABEL_WINDOW_POKEMON_SKILLS_STATUS); PutWindowTilemap(PSS_LABEL_WINDOW_POKEMON_SKILLS_STATUS);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
} }
DestroyTask(taskId); DestroyTask(taskId);
} }
@ -2576,7 +2576,7 @@ static void DrawPokerusCuredSymbol(struct Pokemon *mon) // This checks if the mo
sMonSummaryScreen->bgTilemapBuffers[PSS_PAGE_INFO][0][0x223] = 0x81A; sMonSummaryScreen->bgTilemapBuffers[PSS_PAGE_INFO][0][0x223] = 0x81A;
sMonSummaryScreen->bgTilemapBuffers[PSS_PAGE_INFO][1][0x223] = 0x81A; sMonSummaryScreen->bgTilemapBuffers[PSS_PAGE_INFO][1][0x223] = 0x81A;
} }
schedule_bg_copy_tilemap_to_vram(3); ScheduleBgCopyTilemapToVram(3);
} }
static void SetDexNumberColor(bool8 isMonShiny) static void SetDexNumberColor(bool8 isMonShiny)
@ -2585,7 +2585,7 @@ static void SetDexNumberColor(bool8 isMonShiny)
SetBgTilemapPalette(3, 1, 4, 8, 8, 0); SetBgTilemapPalette(3, 1, 4, 8, 8, 0);
else else
SetBgTilemapPalette(3, 1, 4, 8, 8, 5); SetBgTilemapPalette(3, 1, 4, 8, 8, 5);
schedule_bg_copy_tilemap_to_vram(3); ScheduleBgCopyTilemapToVram(3);
} }
static void DrawExperienceProgressBar(struct Pokemon *unused) static void DrawExperienceProgressBar(struct Pokemon *unused)
@ -2625,9 +2625,9 @@ static void DrawExperienceProgressBar(struct Pokemon *unused)
} }
if (GetBgTilemapBuffer(1) == sMonSummaryScreen->bgTilemapBuffers[PSS_PAGE_SKILLS][0]) if (GetBgTilemapBuffer(1) == sMonSummaryScreen->bgTilemapBuffers[PSS_PAGE_SKILLS][0])
schedule_bg_copy_tilemap_to_vram(1); ScheduleBgCopyTilemapToVram(1);
else else
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
} }
static void DrawContestMoveHearts(u16 move) static void DrawContestMoveHearts(u16 move)
@ -2698,7 +2698,7 @@ static void PrintMonInfo(void)
PrintNotEggInfo(); PrintNotEggInfo();
else else
PrintEggInfo(); PrintEggInfo();
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
} }
static void PrintNotEggInfo(void) static void PrintNotEggInfo(void)
@ -2886,7 +2886,7 @@ static void PutPageWindowTilemaps(u8 page)
for (i = 0; i < ARRAY_COUNT(sMonSummaryScreen->windowIds); i++) for (i = 0; i < ARRAY_COUNT(sMonSummaryScreen->windowIds); i++)
PutWindowTilemap(sMonSummaryScreen->windowIds[i]); PutWindowTilemap(sMonSummaryScreen->windowIds[i]);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
} }
static void ClearPageWindowTilemaps(u8 page) static void ClearPageWindowTilemaps(u8 page)
@ -2933,7 +2933,7 @@ static void ClearPageWindowTilemaps(u8 page)
for (i = 0; i < ARRAY_COUNT(sMonSummaryScreen->windowIds); i++) for (i = 0; i < ARRAY_COUNT(sMonSummaryScreen->windowIds); i++)
RemoveWindowByIndex(i); RemoveWindowByIndex(i);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
} }
static u8 AddWindowFromTemplateList(const struct WindowTemplate *template, u8 templateId) static u8 AddWindowFromTemplateList(const struct WindowTemplate *template, u8 templateId)
@ -3629,7 +3629,7 @@ static void PrintMoveDetails(u16 move)
ClearWindowTilemap(windowId); ClearWindowTilemap(windowId);
} }
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
} }
static void PrintNewMoveDetailsOrCancelText(void) static void PrintNewMoveDetailsOrCancelText(void)
@ -3712,7 +3712,7 @@ static void SetSpriteInvisibility(u8 spriteArrayId, bool8 invisible)
static void HidePageSpecificSprites(void) static void HidePageSpecificSprites(void)
{ {
// Keeps Pokémon, caught ball and status sprites visible. // Keeps Pok<EFBFBD>mon, caught ball and status sprites visible.
u8 i; u8 i;
for (i = SPRITE_ARR_ID_TYPE; i < ARRAY_COUNT(sMonSummaryScreen->spriteIds); i++) for (i = SPRITE_ARR_ID_TYPE; i < ARRAY_COUNT(sMonSummaryScreen->spriteIds); i++)

View File

@ -208,15 +208,15 @@ u32 sub_81CDE94(s32 state)
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON | DISPCNT_WIN1_ON | DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP | DISPCNT_BG0_ON | DISPCNT_BG3_ON); SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON | DISPCNT_WIN1_ON | DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP | DISPCNT_BG0_ON | DISPCNT_BG3_ON);
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG2 | BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_BG3); SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG2 | BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_BG3);
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(11, 4)); SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(11, 4));
decompress_and_copy_tile_data_to_vram(3, gPokenavCondition_Gfx, 0, 0, 0); DecompressAndCopyTileDataToVram(3, gPokenavCondition_Gfx, 0, 0, 0);
return LT_INC_AND_PAUSE; return LT_INC_AND_PAUSE;
case 2: case 2:
if (free_temp_tile_data_buffers_if_possible()) if (FreeTempTileDataBuffersIfPossible())
return LT_PAUSE; return LT_PAUSE;
decompress_and_copy_tile_data_to_vram(2, gUnknown_08623228, 0, 0, 0); DecompressAndCopyTileDataToVram(2, gUnknown_08623228, 0, 0, 0);
return LT_INC_AND_PAUSE; return LT_INC_AND_PAUSE;
case 3: case 3:
if (free_temp_tile_data_buffers_if_possible()) if (FreeTempTileDataBuffersIfPossible())
return LT_PAUSE; return LT_PAUSE;
LZ77UnCompVram(gPokenavCondition_Tilemap, structPtr->tilemapBuffers[0]); LZ77UnCompVram(gPokenavCondition_Tilemap, structPtr->tilemapBuffers[0]);
@ -230,7 +230,7 @@ u32 sub_81CDE94(s32 state)
structPtr->unk1814 = -80; structPtr->unk1814 = -80;
return LT_INC_AND_PAUSE; return LT_INC_AND_PAUSE;
case 4: case 4:
if (free_temp_tile_data_buffers_if_possible()) if (FreeTempTileDataBuffersIfPossible())
return LT_PAUSE; return LT_PAUSE;
LZ77UnCompVram(gUnknown_0862323C, structPtr->tilemapBuffers[2]); LZ77UnCompVram(gUnknown_0862323C, structPtr->tilemapBuffers[2]);
@ -246,7 +246,7 @@ u32 sub_81CDE94(s32 state)
SetBgTilemapBuffer(1, structPtr->tilemapBuffers[1]); SetBgTilemapBuffer(1, structPtr->tilemapBuffers[1]);
return LT_INC_AND_PAUSE; return LT_INC_AND_PAUSE;
case 6: case 6:
if (free_temp_tile_data_buffers_if_possible()) if (FreeTempTileDataBuffersIfPossible())
return LT_PAUSE; return LT_PAUSE;
structPtr->unk1820 = AddWindow(&gUnknown_08623364); structPtr->unk1820 = AddWindow(&gUnknown_08623364);

View File

@ -408,7 +408,7 @@ static u32 sub_81CF418(s32 state)
{ {
case 0: case 0:
InitBgTemplates(gUnknown_08623590, NELEMS(gUnknown_08623590)); InitBgTemplates(gUnknown_08623590, NELEMS(gUnknown_08623590));
decompress_and_copy_tile_data_to_vram(1, gUnknown_086233E4, 0, 0, 0); DecompressAndCopyTileDataToVram(1, gUnknown_086233E4, 0, 0, 0);
SetBgTilemapBuffer(1, unk->buff); SetBgTilemapBuffer(1, unk->buff);
CopyToBgTilemapBuffer(1, gUnknown_086234AC, 0, 0); CopyToBgTilemapBuffer(1, gUnknown_086234AC, 0, 0);
CopyBgTilemapBufferToVram(1); CopyBgTilemapBufferToVram(1);
@ -416,13 +416,13 @@ static u32 sub_81CF418(s32 state)
CopyBgTilemapBufferToVram(1); CopyBgTilemapBufferToVram(1);
return LT_INC_AND_PAUSE; return LT_INC_AND_PAUSE;
case 1: case 1:
if (free_temp_tile_data_buffers_if_possible()) if (FreeTempTileDataBuffersIfPossible())
return LT_PAUSE; return LT_PAUSE;
if (!sub_81CF0C0()) if (!sub_81CF0C0())
return LT_PAUSE; return LT_PAUSE;
return LT_INC_AND_PAUSE; return LT_INC_AND_PAUSE;
case 2: case 2:
if (free_temp_tile_data_buffers_if_possible()) if (FreeTempTileDataBuffersIfPossible())
return LT_PAUSE; return LT_PAUSE;
CopyPaletteIntoBufferUnfaded(gUnknown_08623570, 0x20, 0x20); CopyPaletteIntoBufferUnfaded(gUnknown_08623570, 0x20, 0x20);
sub_81CF88C(); sub_81CF88C();
@ -434,7 +434,7 @@ static u32 sub_81CF418(s32 state)
PrintHelpBarText(HELPBAR_CONDITION_MON_LIST); PrintHelpBarText(HELPBAR_CONDITION_MON_LIST);
return LT_INC_AND_PAUSE; return LT_INC_AND_PAUSE;
case 4: case 4:
if (free_temp_tile_data_buffers_if_possible()) if (FreeTempTileDataBuffersIfPossible())
return LT_PAUSE; return LT_PAUSE;
ChangeBgX(1, 0, 0); ChangeBgX(1, 0, 0);
ChangeBgY(1, 0, 0); ChangeBgY(1, 0, 0);

View File

@ -342,18 +342,18 @@ static u32 LoopedTask_InitPokenavMenu(s32 a0)
ResetBgsAndClearDma3BusyFlags(0); ResetBgsAndClearDma3BusyFlags(0);
InitBgsFromTemplates(0, gPokenavMainMenuBgTemplates, ARRAY_COUNT(gPokenavMainMenuBgTemplates)); InitBgsFromTemplates(0, gPokenavMainMenuBgTemplates, ARRAY_COUNT(gPokenavMainMenuBgTemplates));
ResetBgPositions(); ResetBgPositions();
reset_temp_tile_data_buffers(); ResetTempTileDataBuffers();
return LT_INC_AND_CONTINUE; return LT_INC_AND_CONTINUE;
case 1: case 1:
structPtr = GetSubstructPtr(0); structPtr = GetSubstructPtr(0);
decompress_and_copy_tile_data_to_vram(0, &gPokenavHeader_Gfx, 0, 0, 0); DecompressAndCopyTileDataToVram(0, &gPokenavHeader_Gfx, 0, 0, 0);
SetBgTilemapBuffer(0, structPtr->tilemapBuffer); SetBgTilemapBuffer(0, structPtr->tilemapBuffer);
CopyToBgTilemapBuffer(0, &gPokenavHeader_Tilemap, 0, 0); CopyToBgTilemapBuffer(0, &gPokenavHeader_Tilemap, 0, 0);
CopyPaletteIntoBufferUnfaded(gPokenavHeader_Pal, 0, 0x20); CopyPaletteIntoBufferUnfaded(gPokenavHeader_Pal, 0, 0x20);
CopyBgTilemapBufferToVram(0); CopyBgTilemapBufferToVram(0);
return LT_INC_AND_PAUSE; return LT_INC_AND_PAUSE;
case 2: case 2:
if (free_temp_tile_data_buffers_if_possible()) if (FreeTempTileDataBuffersIfPossible())
return LT_PAUSE; return LT_PAUSE;
InitHelpBar(); InitHelpBar();

View File

@ -325,7 +325,7 @@ static u32 LoopedTask_OpenMatchCall(s32 taskState)
InitBgTemplates(gUnknown_0862278C, ARRAY_COUNT(gUnknown_0862278C)); InitBgTemplates(gUnknown_0862278C, ARRAY_COUNT(gUnknown_0862278C));
ChangeBgX(2, 0, 0); ChangeBgX(2, 0, 0);
ChangeBgY(2, 0, 0); ChangeBgY(2, 0, 0);
decompress_and_copy_tile_data_to_vram(2, sMatchCallUI_Gfx, 0, 0, 0); DecompressAndCopyTileDataToVram(2, sMatchCallUI_Gfx, 0, 0, 0);
SetBgTilemapBuffer(2, state->unk1024); SetBgTilemapBuffer(2, state->unk1024);
CopyToBgTilemapBuffer(2, sMatchCallUI_Tilemap, 0, 0); CopyToBgTilemapBuffer(2, sMatchCallUI_Tilemap, 0, 0);
CopyBgTilemapBufferToVram(2); CopyBgTilemapBufferToVram(2);
@ -333,7 +333,7 @@ static u32 LoopedTask_OpenMatchCall(s32 taskState)
CopyBgTilemapBufferToVram(2); CopyBgTilemapBufferToVram(2);
return LT_INC_AND_PAUSE; return LT_INC_AND_PAUSE;
case 1: case 1:
if (free_temp_tile_data_buffers_if_possible()) if (FreeTempTileDataBuffersIfPossible())
return LT_PAUSE; return LT_PAUSE;
sub_8199DF0(1, 0, 0, 1); sub_8199DF0(1, 0, 0, 1);
@ -343,16 +343,16 @@ static u32 LoopedTask_OpenMatchCall(s32 taskState)
CopyBgTilemapBufferToVram(1); CopyBgTilemapBufferToVram(1);
return LT_INC_AND_PAUSE; return LT_INC_AND_PAUSE;
case 2: case 2:
if (free_temp_tile_data_buffers_if_possible()) if (FreeTempTileDataBuffersIfPossible())
return LT_PAUSE; return LT_PAUSE;
sub_81CC034(state); sub_81CC034(state);
decompress_and_copy_tile_data_to_vram(3, gUnknown_08622760, 0, 0, 0); DecompressAndCopyTileDataToVram(3, gUnknown_08622760, 0, 0, 0);
CopyPaletteIntoBufferUnfaded(gUnknown_08622700, 0x30, 0x20); CopyPaletteIntoBufferUnfaded(gUnknown_08622700, 0x30, 0x20);
CopyPaletteIntoBufferUnfaded(gUnknown_08622720, 0x50, 0x20); CopyPaletteIntoBufferUnfaded(gUnknown_08622720, 0x50, 0x20);
return LT_INC_AND_PAUSE; return LT_INC_AND_PAUSE;
case 3: case 3:
if (free_temp_tile_data_buffers_if_possible() || !sub_81CAE28()) if (FreeTempTileDataBuffersIfPossible() || !sub_81CAE28())
return LT_PAUSE; return LT_PAUSE;
sub_81CBBB8(); sub_81CBBB8();

View File

@ -410,7 +410,7 @@ static u32 LoopedTask_OpenMenu(s32 state)
{ {
case 0: case 0:
InitBgTemplates(gUnknown_08620194, ARRAY_COUNT(gUnknown_08620194)); InitBgTemplates(gUnknown_08620194, ARRAY_COUNT(gUnknown_08620194));
decompress_and_copy_tile_data_to_vram(1, gPokenavMessageBox_Gfx, 0, 0, 0); DecompressAndCopyTileDataToVram(1, gPokenavMessageBox_Gfx, 0, 0, 0);
SetBgTilemapBuffer(1, unk->bg1TilemapBuffer); SetBgTilemapBuffer(1, unk->bg1TilemapBuffer);
CopyToBgTilemapBuffer(1, gPokenavMessageBox_Tilemap, 0, 0); CopyToBgTilemapBuffer(1, gPokenavMessageBox_Tilemap, 0, 0);
CopyBgTilemapBufferToVram(1); CopyBgTilemapBufferToVram(1);
@ -423,23 +423,23 @@ static u32 LoopedTask_OpenMenu(s32 state)
ChangeBgY(3, 0, 0); ChangeBgY(3, 0, 0);
return LT_INC_AND_PAUSE; return LT_INC_AND_PAUSE;
case 1: case 1:
if (free_temp_tile_data_buffers_if_possible()) if (FreeTempTileDataBuffersIfPossible())
return LT_PAUSE; return LT_PAUSE;
decompress_and_copy_tile_data_to_vram(2, gUnknown_0861FD6C, 0, 0, 0); DecompressAndCopyTileDataToVram(2, gUnknown_0861FD6C, 0, 0, 0);
decompress_and_copy_tile_data_to_vram(2, gUnknown_0861FFF4, 0, 0, 1); DecompressAndCopyTileDataToVram(2, gUnknown_0861FFF4, 0, 0, 1);
CopyPaletteIntoBufferUnfaded(gUnknown_0861FD4C, 0x20, 0x20); CopyPaletteIntoBufferUnfaded(gUnknown_0861FD4C, 0x20, 0x20);
return LT_INC_AND_PAUSE; return LT_INC_AND_PAUSE;
case 2: case 2:
if (free_temp_tile_data_buffers_if_possible()) if (FreeTempTileDataBuffersIfPossible())
return LT_PAUSE; return LT_PAUSE;
decompress_and_copy_tile_data_to_vram(3, gUnknown_0861FC98, 0, 0, 0); DecompressAndCopyTileDataToVram(3, gUnknown_0861FC98, 0, 0, 0);
decompress_and_copy_tile_data_to_vram(3, gUnknown_0861FCAC, 0, 0, 1); DecompressAndCopyTileDataToVram(3, gUnknown_0861FCAC, 0, 0, 1);
CopyPaletteIntoBufferUnfaded(gUnknown_0861FC78, 0x30, 0x20); CopyPaletteIntoBufferUnfaded(gUnknown_0861FC78, 0x30, 0x20);
if (GetPokenavMenuType() == POKENAV_MENU_TYPE_CONDITION || GetPokenavMenuType() == POKENAV_MENU_TYPE_CONDITION_SEARCH) if (GetPokenavMenuType() == POKENAV_MENU_TYPE_CONDITION || GetPokenavMenuType() == POKENAV_MENU_TYPE_CONDITION_SEARCH)
sub_81CA850(); sub_81CA850();
return LT_INC_AND_PAUSE; return LT_INC_AND_PAUSE;
case 3: case 3:
if (free_temp_tile_data_buffers_if_possible()) if (FreeTempTileDataBuffersIfPossible())
return LT_PAUSE; return LT_PAUSE;
AddOptionDescriptionWindow(); AddOptionDescriptionWindow();
sub_81CA7D4(); sub_81CA7D4();

View File

@ -506,7 +506,7 @@ static void LoadPokenavRegionMapGfx(struct Pokenav5Struct_2 *state)
state->infoWindowId = AddWindow(&sMapSecInfoWindowTemplate); state->infoWindowId = AddWindow(&sMapSecInfoWindowTemplate);
LoadUserWindowBorderGfx_(state->infoWindowId, 0x42, 0x40); LoadUserWindowBorderGfx_(state->infoWindowId, 0x42, 0x40);
DrawTextBorderOuter(state->infoWindowId, 0x42, 4); DrawTextBorderOuter(state->infoWindowId, 0x42, 4);
decompress_and_copy_tile_data_to_vram(1, sRegionMapCityZoomTiles_Gfx, 0, 0, 0); DecompressAndCopyTileDataToVram(1, sRegionMapCityZoomTiles_Gfx, 0, 0, 0);
FillWindowPixelBuffer(state->infoWindowId, PIXEL_FILL(1)); FillWindowPixelBuffer(state->infoWindowId, PIXEL_FILL(1));
PutWindowTilemap(state->infoWindowId); PutWindowTilemap(state->infoWindowId);
CopyWindowToVram(state->infoWindowId, 3); CopyWindowToVram(state->infoWindowId, 3);
@ -522,7 +522,7 @@ static void LoadPokenavRegionMapGfx(struct Pokenav5Struct_2 *state)
static bool32 TryFreeTempTileDataBuffers(void) static bool32 TryFreeTempTileDataBuffers(void)
{ {
return free_temp_tile_data_buffers_if_possible(); return FreeTempTileDataBuffersIfPossible();
} }
static void UpdateMapSecInfoWindow(struct Pokenav5Struct_2 *state) static void UpdateMapSecInfoWindow(struct Pokenav5Struct_2 *state)

View File

@ -414,14 +414,14 @@ static u32 sub_81CFEB8(s32 state)
{ {
case 0: case 0:
InitBgTemplates(gUnknown_086237B0, NELEMS(gUnknown_086237B0)); InitBgTemplates(gUnknown_086237B0, NELEMS(gUnknown_086237B0));
decompress_and_copy_tile_data_to_vram(1, gUnknown_08623604, 0, 0, 0); DecompressAndCopyTileDataToVram(1, gUnknown_08623604, 0, 0, 0);
SetBgTilemapBuffer(1, unk->buff); SetBgTilemapBuffer(1, unk->buff);
CopyToBgTilemapBuffer(1, gUnknown_086236CC, 0, 0); CopyToBgTilemapBuffer(1, gUnknown_086236CC, 0, 0);
CopyPaletteIntoBufferUnfaded(gUnknown_086235E4, 0x10, 0x20); CopyPaletteIntoBufferUnfaded(gUnknown_086235E4, 0x10, 0x20);
CopyBgTilemapBufferToVram(1); CopyBgTilemapBufferToVram(1);
return LT_INC_AND_PAUSE; return LT_INC_AND_PAUSE;
case 1: case 1:
if (free_temp_tile_data_buffers_if_possible()) if (FreeTempTileDataBuffersIfPossible())
return LT_PAUSE; return LT_PAUSE;
if (!sub_81CFB18()) if (!sub_81CFB18())
return LT_PAUSE; return LT_PAUSE;
@ -430,7 +430,7 @@ static u32 sub_81CFEB8(s32 state)
ShowBg(1); ShowBg(1);
return LT_INC_AND_PAUSE; return LT_INC_AND_PAUSE;
case 2: case 2:
if (free_temp_tile_data_buffers_if_possible()) if (FreeTempTileDataBuffersIfPossible())
return LT_PAUSE; return LT_PAUSE;
CopyPaletteIntoBufferUnfaded(gUnknown_08623790, 0x20, 0x20); CopyPaletteIntoBufferUnfaded(gUnknown_08623790, 0x20, 0x20);
sub_81D0304(); sub_81D0304();
@ -441,7 +441,7 @@ static u32 sub_81CFEB8(s32 state)
sub_81D024C(unk); sub_81D024C(unk);
return LT_INC_AND_PAUSE; return LT_INC_AND_PAUSE;
case 4: case 4:
if (free_temp_tile_data_buffers_if_possible()) if (FreeTempTileDataBuffersIfPossible())
return LT_PAUSE; return LT_PAUSE;
ShowBg(2); ShowBg(2);
HideBg(3); HideBg(3);

View File

@ -517,17 +517,17 @@ u32 sub_81D0A6C(s32 state)
{ {
case 0: case 0:
InitBgTemplates(gUnknown_08624B98, ARRAY_COUNT(gUnknown_08624B98)); InitBgTemplates(gUnknown_08624B98, ARRAY_COUNT(gUnknown_08624B98));
decompress_and_copy_tile_data_to_vram(2, gUnknown_08DDE030, 0, 0, 0); DecompressAndCopyTileDataToVram(2, gUnknown_08DDE030, 0, 0, 0);
SetBgTilemapBuffer(2, structPtr->tilemapBuffers[0]); SetBgTilemapBuffer(2, structPtr->tilemapBuffers[0]);
CopyToBgTilemapBuffer(2, gUnknown_08DDE12C, 0, 0); CopyToBgTilemapBuffer(2, gUnknown_08DDE12C, 0, 0);
CopyPaletteIntoBufferUnfaded(gUnknown_08DDE010, 0x10, 0x20); CopyPaletteIntoBufferUnfaded(gUnknown_08DDE010, 0x10, 0x20);
CopyBgTilemapBufferToVram(2); CopyBgTilemapBufferToVram(2);
return LT_INC_AND_PAUSE; return LT_INC_AND_PAUSE;
case 1: case 1:
if (!free_temp_tile_data_buffers_if_possible()) if (!FreeTempTileDataBuffersIfPossible())
{ {
sub_8199DF0(1, 0, 0, 1); sub_8199DF0(1, 0, 0, 1);
decompress_and_copy_tile_data_to_vram(1, sRibbonIconsSmall_Gfx, 0, 1, 0); DecompressAndCopyTileDataToVram(1, sRibbonIconsSmall_Gfx, 0, 1, 0);
SetBgTilemapBuffer(1, structPtr->tilemapBuffers[1]); SetBgTilemapBuffer(1, structPtr->tilemapBuffers[1]);
FillBgTilemapBufferRect_Palette0(1, 0, 0, 0, 32, 20); FillBgTilemapBufferRect_Palette0(1, 0, 0, 0, 32, 20);
CopyPaletteIntoBufferUnfaded(gUnknown_08623FF8, 0x20, 0xA0); CopyPaletteIntoBufferUnfaded(gUnknown_08623FF8, 0x20, 0xA0);
@ -537,21 +537,21 @@ u32 sub_81D0A6C(s32 state)
} }
return LT_PAUSE; return LT_PAUSE;
case 2: case 2:
if (!free_temp_tile_data_buffers_if_possible()) if (!FreeTempTileDataBuffersIfPossible())
{ {
sub_81D0E60(structPtr); sub_81D0E60(structPtr);
return LT_INC_AND_PAUSE; return LT_INC_AND_PAUSE;
} }
return LT_PAUSE; return LT_PAUSE;
case 3: case 3:
if (!free_temp_tile_data_buffers_if_possible()) if (!FreeTempTileDataBuffersIfPossible())
{ {
sub_81D0FCC(structPtr); sub_81D0FCC(structPtr);
return LT_INC_AND_PAUSE; return LT_INC_AND_PAUSE;
} }
return LT_PAUSE; return LT_PAUSE;
case 4: case 4:
if (!free_temp_tile_data_buffers_if_possible()) if (!FreeTempTileDataBuffersIfPossible())
{ {
sub_81D10A4(structPtr); sub_81D10A4(structPtr);
return LT_INC_AND_PAUSE; return LT_INC_AND_PAUSE;

View File

@ -1508,9 +1508,9 @@ static void sub_81D6FE0(void)
SetBgTilemapBuffer(1, sRayScene->tilemapBuffers[1]); SetBgTilemapBuffer(1, sRayScene->tilemapBuffers[1]);
SetBgTilemapBuffer(2, sRayScene->tilemapBuffers[2]); SetBgTilemapBuffer(2, sRayScene->tilemapBuffers[2]);
ResetAllBgsCoordinates(); ResetAllBgsCoordinates();
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
schedule_bg_copy_tilemap_to_vram(1); ScheduleBgCopyTilemapToVram(1);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP); SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP);
ShowBg(0); ShowBg(0);
ShowBg(1); ShowBg(1);
@ -1520,9 +1520,9 @@ static void sub_81D6FE0(void)
static void sub_81D706C(void) static void sub_81D706C(void)
{ {
reset_temp_tile_data_buffers(); ResetTempTileDataBuffers();
decompress_and_copy_tile_data_to_vram(0, gRaySceneClouds_Gfx, 0, 0, 0); DecompressAndCopyTileDataToVram(0, gRaySceneClouds_Gfx, 0, 0, 0);
while (free_temp_tile_data_buffers_if_possible()); while (FreeTempTileDataBuffersIfPossible());
LZDecompressWram(gRaySceneClouds2_Tilemap, sRayScene->tilemapBuffers[0]); LZDecompressWram(gRaySceneClouds2_Tilemap, sRayScene->tilemapBuffers[0]);
LZDecompressWram(gRaySceneClouds1_Tilemap, sRayScene->tilemapBuffers[1]); LZDecompressWram(gRaySceneClouds1_Tilemap, sRayScene->tilemapBuffers[1]);
@ -1921,9 +1921,9 @@ static void sub_81D7E10(void)
SetBgTilemapBuffer(1, sRayScene->tilemapBuffers[1]); SetBgTilemapBuffer(1, sRayScene->tilemapBuffers[1]);
SetBgTilemapBuffer(2, sRayScene->tilemapBuffers[2]); SetBgTilemapBuffer(2, sRayScene->tilemapBuffers[2]);
ResetAllBgsCoordinates(); ResetAllBgsCoordinates();
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
schedule_bg_copy_tilemap_to_vram(1); ScheduleBgCopyTilemapToVram(1);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP); SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP);
ShowBg(0); ShowBg(0);
ShowBg(1); ShowBg(1);
@ -1933,11 +1933,11 @@ static void sub_81D7E10(void)
static void sub_81D7E9C(void) static void sub_81D7E9C(void)
{ {
reset_temp_tile_data_buffers(); ResetTempTileDataBuffers();
decompress_and_copy_tile_data_to_vram(0, gRaySceneClouds_Gfx, 0, 0, 0); DecompressAndCopyTileDataToVram(0, gRaySceneClouds_Gfx, 0, 0, 0);
decompress_and_copy_tile_data_to_vram(1, gRaySceneOvercast_Gfx, 0, 0, 0); DecompressAndCopyTileDataToVram(1, gRaySceneOvercast_Gfx, 0, 0, 0);
decompress_and_copy_tile_data_to_vram(2, gRaySceneRayquaza_Gfx, 0, 0, 0); DecompressAndCopyTileDataToVram(2, gRaySceneRayquaza_Gfx, 0, 0, 0);
while (free_temp_tile_data_buffers_if_possible()); while (FreeTempTileDataBuffersIfPossible());
LZDecompressWram(gRaySceneClouds2_Tilemap, sRayScene->tilemapBuffers[0]); LZDecompressWram(gRaySceneClouds2_Tilemap, sRayScene->tilemapBuffers[0]);
LZDecompressWram(gRaySceneOvercast_Tilemap, sRayScene->tilemapBuffers[1]); LZDecompressWram(gRaySceneOvercast_Tilemap, sRayScene->tilemapBuffers[1]);
@ -2090,10 +2090,10 @@ static void sub_81D82B0(void)
SetBgTilemapBuffer(2, sRayScene->tilemapBuffers[2]); SetBgTilemapBuffer(2, sRayScene->tilemapBuffers[2]);
SetBgTilemapBuffer(3, sRayScene->tilemapBuffers[3]); SetBgTilemapBuffer(3, sRayScene->tilemapBuffers[3]);
ResetAllBgsCoordinates(); ResetAllBgsCoordinates();
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
schedule_bg_copy_tilemap_to_vram(1); ScheduleBgCopyTilemapToVram(1);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
schedule_bg_copy_tilemap_to_vram(3); ScheduleBgCopyTilemapToVram(3);
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP); SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP);
ShowBg(0); ShowBg(0);
ShowBg(1); ShowBg(1);
@ -2104,10 +2104,10 @@ static void sub_81D82B0(void)
static void sub_81D8358(void) static void sub_81D8358(void)
{ {
reset_temp_tile_data_buffers(); ResetTempTileDataBuffers();
decompress_and_copy_tile_data_to_vram(0, gRaySceneRayquazaLight_Gfx, 0, 0, 0); DecompressAndCopyTileDataToVram(0, gRaySceneRayquazaLight_Gfx, 0, 0, 0);
decompress_and_copy_tile_data_to_vram(1, gRaySceneOvercast2_Gfx, 0, 0, 0); DecompressAndCopyTileDataToVram(1, gRaySceneOvercast2_Gfx, 0, 0, 0);
while (free_temp_tile_data_buffers_if_possible()); while (FreeTempTileDataBuffersIfPossible());
LZDecompressWram(gRaySceneRayquazaLight_Tilemap, sRayScene->tilemapBuffers[0]); LZDecompressWram(gRaySceneRayquazaLight_Tilemap, sRayScene->tilemapBuffers[0]);
LZDecompressWram(gRaySceneOvercast2_Tilemap, sRayScene->tilemapBuffers[3]); LZDecompressWram(gRaySceneOvercast2_Tilemap, sRayScene->tilemapBuffers[3]);
@ -2312,10 +2312,10 @@ static void sub_81D8828(void)
SetBgTilemapBuffer(2, sRayScene->tilemapBuffers[2]); SetBgTilemapBuffer(2, sRayScene->tilemapBuffers[2]);
SetBgTilemapBuffer(3, sRayScene->tilemapBuffers[3]); SetBgTilemapBuffer(3, sRayScene->tilemapBuffers[3]);
ResetAllBgsCoordinates(); ResetAllBgsCoordinates();
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
schedule_bg_copy_tilemap_to_vram(1); ScheduleBgCopyTilemapToVram(1);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
schedule_bg_copy_tilemap_to_vram(3); ScheduleBgCopyTilemapToVram(3);
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP | DISPCNT_WIN0_ON); SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP | DISPCNT_WIN0_ON);
ShowBg(0); ShowBg(0);
ShowBg(1); ShowBg(1);
@ -2326,11 +2326,11 @@ static void sub_81D8828(void)
static void sub_81D88D0(void) static void sub_81D88D0(void)
{ {
reset_temp_tile_data_buffers(); ResetTempTileDataBuffers();
decompress_and_copy_tile_data_to_vram(1, gRaySceneRayquazaChase_Gfx, 0, 0, 0); DecompressAndCopyTileDataToVram(1, gRaySceneRayquazaChase_Gfx, 0, 0, 0);
decompress_and_copy_tile_data_to_vram(2, gRaySceneChaseStreaks_Gfx, 0, 0, 0); DecompressAndCopyTileDataToVram(2, gRaySceneChaseStreaks_Gfx, 0, 0, 0);
decompress_and_copy_tile_data_to_vram(3, gRaySceneChaseBg_Gfx, 0, 0, 0); DecompressAndCopyTileDataToVram(3, gRaySceneChaseBg_Gfx, 0, 0, 0);
while (free_temp_tile_data_buffers_if_possible()); while (FreeTempTileDataBuffersIfPossible());
LZDecompressWram(gRayChaseRayquazaChase2_Tilemap, sRayScene->tilemapBuffers[0]); LZDecompressWram(gRayChaseRayquazaChase2_Tilemap, sRayScene->tilemapBuffers[0]);
LZDecompressWram(gRayChaseRayquazaChase_Tilemap, sRayScene->tilemapBuffers[1]); LZDecompressWram(gRayChaseRayquazaChase_Tilemap, sRayScene->tilemapBuffers[1]);
@ -2468,9 +2468,9 @@ static void sub_81D8C38(void)
SetBgTilemapBuffer(1, sRayScene->tilemapBuffers[1]); SetBgTilemapBuffer(1, sRayScene->tilemapBuffers[1]);
SetBgTilemapBuffer(2, sRayScene->tilemapBuffers[2]); SetBgTilemapBuffer(2, sRayScene->tilemapBuffers[2]);
ResetAllBgsCoordinates(); ResetAllBgsCoordinates();
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
schedule_bg_copy_tilemap_to_vram(1); ScheduleBgCopyTilemapToVram(1);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP | DISPCNT_WIN0_ON); SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP | DISPCNT_WIN0_ON);
ShowBg(0); ShowBg(0);
ShowBg(1); ShowBg(1);
@ -2480,10 +2480,10 @@ static void sub_81D8C38(void)
static void sub_81D8CC4(void) static void sub_81D8CC4(void)
{ {
reset_temp_tile_data_buffers(); ResetTempTileDataBuffers();
decompress_and_copy_tile_data_to_vram(2, gRaySceneHushRing_Gfx, 0, 0, 0); DecompressAndCopyTileDataToVram(2, gRaySceneHushRing_Gfx, 0, 0, 0);
decompress_and_copy_tile_data_to_vram(0, gRaySceneHushBg_Gfx, 0, 0, 0); DecompressAndCopyTileDataToVram(0, gRaySceneHushBg_Gfx, 0, 0, 0);
while (free_temp_tile_data_buffers_if_possible()); while (FreeTempTileDataBuffersIfPossible());
LZDecompressWram(gRaySceneHushRing_Tilemap, sRayScene->tilemapBuffers[1]); LZDecompressWram(gRaySceneHushRing_Tilemap, sRayScene->tilemapBuffers[1]);
LZDecompressWram(gRaySceneHushBg_Tilemap, sRayScene->tilemapBuffers[0]); LZDecompressWram(gRaySceneHushBg_Tilemap, sRayScene->tilemapBuffers[0]);

View File

@ -547,15 +547,15 @@ bool8 LoadRegionMapGfx(void)
{ {
case 0: case 0:
if (gRegionMap->bgManaged) if (gRegionMap->bgManaged)
decompress_and_copy_tile_data_to_vram(gRegionMap->bgNum, sRegionMapBg_GfxLZ, 0, 0, 0); DecompressAndCopyTileDataToVram(gRegionMap->bgNum, sRegionMapBg_GfxLZ, 0, 0, 0);
else else
LZ77UnCompVram(sRegionMapBg_GfxLZ, (u16 *)BG_CHAR_ADDR(2)); LZ77UnCompVram(sRegionMapBg_GfxLZ, (u16 *)BG_CHAR_ADDR(2));
break; break;
case 1: case 1:
if (gRegionMap->bgManaged) if (gRegionMap->bgManaged)
{ {
if (!free_temp_tile_data_buffers_if_possible()) if (!FreeTempTileDataBuffersIfPossible())
decompress_and_copy_tile_data_to_vram(gRegionMap->bgNum, sRegionMapBg_TilemapLZ, 0, 0, 1); DecompressAndCopyTileDataToVram(gRegionMap->bgNum, sRegionMapBg_TilemapLZ, 0, 0, 1);
} }
else else
{ {
@ -563,7 +563,7 @@ bool8 LoadRegionMapGfx(void)
} }
break; break;
case 2: case 2:
if (!free_temp_tile_data_buffers_if_possible()) if (!FreeTempTileDataBuffersIfPossible())
LoadPalette(sRegionMapBg_Pal, 0x70, 0x60); LoadPalette(sRegionMapBg_Pal, 0x70, 0x60);
break; break;
case 3: case 3:
@ -1710,7 +1710,7 @@ void CB2_OpenFlyMap(void)
PutWindowTilemap(2); PutWindowTilemap(2);
FillWindowPixelBuffer(2, PIXEL_FILL(0)); FillWindowPixelBuffer(2, PIXEL_FILL(0));
AddTextPrinterParameterized(2, 1, gText_FlyToWhere, 0, 1, 0, NULL); AddTextPrinterParameterized(2, 1, gText_FlyToWhere, 0, 1, 0, NULL);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
gMain.state++; gMain.state++;
break; break;
case 8: case 8:
@ -1778,7 +1778,7 @@ static void DrawFlyDestTextWindow(void)
AddTextPrinterParameterized(1, 1, sFlyMap->regionMap.mapSecName, 0, 1, 0, NULL); AddTextPrinterParameterized(1, 1, sFlyMap->regionMap.mapSecName, 0, 1, 0, NULL);
name = sMultiNameFlyDestinations[i].name[sFlyMap->regionMap.posWithinMapSec]; name = sMultiNameFlyDestinations[i].name[sFlyMap->regionMap.posWithinMapSec];
AddTextPrinterParameterized(1, 1, name, GetStringRightAlignXOffset(1, name, 96), 17, 0, NULL); AddTextPrinterParameterized(1, 1, name, GetStringRightAlignXOffset(1, name, 96), 17, 0, NULL);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
gUnknown_03001180 = TRUE; gUnknown_03001180 = TRUE;
} }
break; break;
@ -1796,7 +1796,7 @@ static void DrawFlyDestTextWindow(void)
FillWindowPixelBuffer(0, PIXEL_FILL(1)); FillWindowPixelBuffer(0, PIXEL_FILL(1));
} }
AddTextPrinterParameterized(0, 1, sFlyMap->regionMap.mapSecName, 0, 1, 0, NULL); AddTextPrinterParameterized(0, 1, sFlyMap->regionMap.mapSecName, 0, 1, 0, NULL);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
gUnknown_03001180 = FALSE; gUnknown_03001180 = FALSE;
} }
} }
@ -1809,7 +1809,7 @@ static void DrawFlyDestTextWindow(void)
} }
FillWindowPixelBuffer(0, PIXEL_FILL(1)); FillWindowPixelBuffer(0, PIXEL_FILL(1));
CopyWindowToVram(0, 2); CopyWindowToVram(0, 2);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
gUnknown_03001180 = FALSE; gUnknown_03001180 = FALSE;
} }
} }

View File

@ -293,7 +293,7 @@ static void HideChooseTimeWindow(u8 windowId)
{ {
ClearStdWindowAndFrameToTransparent(windowId, FALSE); ClearStdWindowAndFrameToTransparent(windowId, FALSE);
RemoveWindow(windowId); RemoveWindow(windowId);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
} }
static void PrintTime(u8 windowId, u8 x, u8 y, u16 days, u8 hours, u8 minutes, u8 seconds) static void PrintTime(u8 windowId, u8 x, u8 y, u16 days, u8 hours, u8 minutes, u8 seconds)
@ -323,7 +323,7 @@ static void ShowChooseTimeWindow(u8 windowId, u16 days, u8 hours, u8 minutes, u8
DrawStdFrameWithCustomTileAndPalette(windowId, FALSE, 0x214, 0xE); DrawStdFrameWithCustomTileAndPalette(windowId, FALSE, 0x214, 0xE);
PrintTime(windowId, 0, 1, days, hours, minutes, seconds); PrintTime(windowId, 0, 1, days, hours, minutes, seconds);
AddTextPrinterParameterized(windowId, 1, gText_Confirm2, 126, 1, 0, NULL); AddTextPrinterParameterized(windowId, 1, gText_Confirm2, 126, 1, 0, NULL);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
} }
static bool32 MoveTimeUpDown(s16 *val, int minVal, int maxVal, u16 keys) static bool32 MoveTimeUpDown(s16 *val, int minVal, int maxVal, u16 keys)
@ -470,7 +470,7 @@ static void sub_809F048(void)
clear_scheduled_bg_copies_to_vram(); clear_scheduled_bg_copies_to_vram();
ResetBgsAndClearDma3BusyFlags(0); ResetBgsAndClearDma3BusyFlags(0);
InitBgsFromTemplates(0, sBackgroundTemplates, ARRAY_COUNT(sBackgroundTemplates)); InitBgsFromTemplates(0, sBackgroundTemplates, ARRAY_COUNT(sBackgroundTemplates));
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP); SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP);
ShowBg(0); ShowBg(0);
InitWindows(sUnknown_08510408); InitWindows(sUnknown_08510408);
@ -498,7 +498,7 @@ static void ShowMessage(const u8 *str)
{ {
DrawDialogFrameWithCustomTileAndPalette(1, FALSE, 0x200, 0xF); DrawDialogFrameWithCustomTileAndPalette(1, FALSE, 0x200, 0xF);
AddTextPrinterParameterized(1, 1, str, 0, 1, 0, NULL); AddTextPrinterParameterized(1, 1, str, 0, 1, 0, NULL);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
} }
static void Task_ShowResetRtcPrompt(u8 taskId) static void Task_ShowResetRtcPrompt(u8 taskId)
@ -529,7 +529,7 @@ static void Task_ShowResetRtcPrompt(u8 taskId)
gSaveBlock2Ptr->lastBerryTreeUpdate.seconds); gSaveBlock2Ptr->lastBerryTreeUpdate.seconds);
ShowMessage(gText_ResetRTCConfirmCancel); ShowMessage(gText_ResetRTCConfirmCancel);
CopyWindowToVram(0, 2); CopyWindowToVram(0, 2);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
data[0]++; data[0]++;
case 1: case 1:
if (gMain.newKeys & B_BUTTON) if (gMain.newKeys & B_BUTTON)

View File

@ -943,15 +943,15 @@ static void sub_81405CC(void)
ResetPaletteFade(); ResetPaletteFade();
ResetSpriteData(); ResetSpriteData();
ResetTasks(); ResetTasks();
reset_temp_tile_data_buffers(); ResetTempTileDataBuffers();
break; break;
case 3: case 3:
LoadPalette(&gUnknown_085B5BFC, 0, 0x1C0); LoadPalette(&gUnknown_085B5BFC, 0, 0x1C0);
decompress_and_copy_tile_data_to_vram(1, gRouletteMenuTiles, 0, 0, 0); DecompressAndCopyTileDataToVram(1, gRouletteMenuTiles, 0, 0, 0);
decompress_and_copy_tile_data_to_vram(2, gRouletteWheelTiles, 0, 0, 0); DecompressAndCopyTileDataToVram(2, gRouletteWheelTiles, 0, 0, 0);
break; break;
case 4: case 4:
if (free_temp_tile_data_buffers_if_possible()) if (FreeTempTileDataBuffersIfPossible())
return; return;
sub_8140470(); sub_8140470();

View File

@ -110,7 +110,7 @@ static void DrawMultichoiceMenu(u8 left, u8 top, u8 multichoiceId, bool8 ignoreB
SetStandardWindowBorderStyle(windowId, 0); SetStandardWindowBorderStyle(windowId, 0);
PrintMenuTable(windowId, count, actions); PrintMenuTable(windowId, count, actions);
InitMenuInUpperLeftCornerPlaySoundWhenAPressed(windowId, count, cursorPos); InitMenuInUpperLeftCornerPlaySoundWhenAPressed(windowId, count, cursorPos);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
InitMultichoiceCheckWrap(ignoreBPress, count, windowId, multichoiceId); InitMultichoiceCheckWrap(ignoreBPress, count, windowId, multichoiceId);
} }
@ -595,7 +595,7 @@ bool8 ScriptMenu_ShowPokemonPic(u16 species, u8 x, u8 y)
gSprites[spriteId].callback = SpriteCallbackDummy; gSprites[spriteId].callback = SpriteCallbackDummy;
gSprites[spriteId].oam.priority = 0; gSprites[spriteId].oam.priority = 0;
SetStandardWindowBorderStyle(gTasks[taskId].tWindowId, 1); SetStandardWindowBorderStyle(gTasks[taskId].tWindowId, 1);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
return TRUE; return TRUE;
} }
} }

View File

@ -947,7 +947,7 @@ static void FinalizeRegistryMenu(u8 taskId)
SetStandardWindowBorderStyle(data[6], 0); SetStandardWindowBorderStyle(data[6], 0);
data[5] = ListMenuInit(&gMultiuseListMenuTemplate, data[2], data[1]); data[5] = ListMenuInit(&gMultiuseListMenuTemplate, data[2], data[1]);
AddRegistryMenuScrollArrows(taskId); AddRegistryMenuScrollArrows(taskId);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
} }
static void AddRegistryMenuScrollArrows(u8 taskId) static void AddRegistryMenuScrollArrows(u8 taskId)
@ -975,7 +975,7 @@ static void HandleRegistryMenuInput(u8 taskId)
ClearStdWindowAndFrame(data[6], 0); ClearStdWindowAndFrame(data[6], 0);
ClearWindowTilemap(data[6]); ClearWindowTilemap(data[6]);
RemoveWindow(data[6]); RemoveWindow(data[6]);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
free(sRegistryMenu); free(sRegistryMenu);
GoToSecretBasePCRegisterMenu(taskId); GoToSecretBasePCRegisterMenu(taskId);
break; break;
@ -998,7 +998,7 @@ static void ShowRegistryMenuActions(u8 taskId)
SetStandardWindowBorderStyle(data[7], 0); SetStandardWindowBorderStyle(data[7], 0);
PrintMenuTable(data[7], 2, sRegistryMenuActions); PrintMenuTable(data[7], 2, sRegistryMenuActions);
InitMenuInUpperLeftCornerPlaySoundWhenAPressed(data[7], 2, 0); InitMenuInUpperLeftCornerPlaySoundWhenAPressed(data[7], 2, 0);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
gTasks[taskId].func = HandleRegistryMenuActionsInput; gTasks[taskId].func = HandleRegistryMenuActionsInput;
} }
@ -1028,7 +1028,7 @@ static void ShowRegistryMenuDeleteConfirmation(u8 taskId)
ClearWindowTilemap(data[6]); ClearWindowTilemap(data[6]);
ClearWindowTilemap(data[7]); ClearWindowTilemap(data[7]);
RemoveWindow(data[7]); RemoveWindow(data[7]);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
GetSecretBaseName(gStringVar1, data[4]); GetSecretBaseName(gStringVar1, data[4]);
StringExpandPlaceholders(gStringVar4, gText_OkayToDeleteFromRegistry); StringExpandPlaceholders(gStringVar4, gText_OkayToDeleteFromRegistry);
DisplayItemMessageOnField(taskId, gStringVar4, ShowRegistryMenuDeleteYesNo); DisplayItemMessageOnField(taskId, gStringVar4, ShowRegistryMenuDeleteYesNo);
@ -1073,7 +1073,7 @@ static void ReturnToMainRegistryMenu(u8 taskId)
ClearStdWindowAndFrame(data[7], 0); ClearStdWindowAndFrame(data[7], 0);
ClearWindowTilemap(data[7]); ClearWindowTilemap(data[7]);
RemoveWindow(data[7]); RemoveWindow(data[7]);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
gTasks[taskId].func = HandleRegistryMenuInput; gTasks[taskId].func = HandleRegistryMenuInput;
} }

View File

@ -441,7 +441,7 @@ static void CB2_InitBuyMenu(void)
SetVBlankHBlankCallbacksToNull(); SetVBlankHBlankCallbacksToNull();
CpuFastFill(0, (void *)OAM, OAM_SIZE); CpuFastFill(0, (void *)OAM, OAM_SIZE);
ScanlineEffect_Stop(); ScanlineEffect_Stop();
reset_temp_tile_data_buffers(); ResetTempTileDataBuffers();
FreeAllSpritePalettes(); FreeAllSpritePalettes();
ResetPaletteFade(); ResetPaletteFade();
ResetSpriteData(); ResetSpriteData();
@ -462,7 +462,7 @@ static void CB2_InitBuyMenu(void)
gMain.state++; gMain.state++;
break; break;
case 1: case 1:
if (!free_temp_tile_data_buffers_if_possible()) if (!FreeTempTileDataBuffersIfPossible())
gMain.state++; gMain.state++;
break; break;
default: default:
@ -673,7 +673,7 @@ static void BuyMenuInitBgs(void)
static void BuyMenuDecompressBgGraphics(void) static void BuyMenuDecompressBgGraphics(void)
{ {
decompress_and_copy_tile_data_to_vram(1, gBuyMenuFrame_Gfx, 0x3A0, 0x3E3, 0); DecompressAndCopyTileDataToVram(1, gBuyMenuFrame_Gfx, 0x3A0, 0x3E3, 0);
LZDecompressWram(gBuyMenuFrame_Tilemap, gShopDataPtr->tilemapBuffers[0]); LZDecompressWram(gBuyMenuFrame_Tilemap, gShopDataPtr->tilemapBuffers[0]);
LoadCompressedPalette(gMenuMoneyPal, 0xC0, 0x20); LoadCompressedPalette(gMenuMoneyPal, 0xC0, 0x20);
} }
@ -697,7 +697,7 @@ static void BuyMenuPrint(u8 windowId, const u8 *text, u8 x, u8 y, s8 speed, u8 c
static void BuyMenuDisplayMessage(u8 taskId, const u8 *text, TaskFunc callback) static void BuyMenuDisplayMessage(u8 taskId, const u8 *text, TaskFunc callback)
{ {
DisplayMessageAndContinueTask(taskId, 5, 10, 14, 1, GetPlayerTextSpeedDelay(), text, callback); DisplayMessageAndContinueTask(taskId, 5, 10, 14, 1, GetPlayerTextSpeedDelay(), text, callback);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
} }
static void BuyMenuDrawGraphics(void) static void BuyMenuDrawGraphics(void)
@ -706,10 +706,10 @@ static void BuyMenuDrawGraphics(void)
BuyMenuCopyMenuBgToBg1TilemapBuffer(); BuyMenuCopyMenuBgToBg1TilemapBuffer();
AddMoneyLabelObject(19, 11); AddMoneyLabelObject(19, 11);
PrintMoneyAmountInMoneyBoxWithBorder(0, 1, 13, GetMoney(&gSaveBlock1Ptr->money)); PrintMoneyAmountInMoneyBoxWithBorder(0, 1, 13, GetMoney(&gSaveBlock1Ptr->money));
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
schedule_bg_copy_tilemap_to_vram(1); ScheduleBgCopyTilemapToVram(1);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
schedule_bg_copy_tilemap_to_vram(3); ScheduleBgCopyTilemapToVram(3);
} }
static void BuyMenuDrawMapGraphics(void) static void BuyMenuDrawMapGraphics(void)
@ -990,7 +990,7 @@ static void Task_BuyHowManyDialogueInit(u8 taskId)
tItemCount = 1; tItemCount = 1;
DrawStdFrameWithCustomTileAndPalette(4, FALSE, 1, 13); DrawStdFrameWithCustomTileAndPalette(4, FALSE, 1, 13);
BuyMenuPrintItemQuantityAndPrice(taskId); BuyMenuPrintItemQuantityAndPrice(taskId);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
maxQuantity = GetMoney(&gSaveBlock1Ptr->money) / gShopDataPtr->totalCost; maxQuantity = GetMoney(&gSaveBlock1Ptr->money) / gShopDataPtr->totalCost;
@ -1137,7 +1137,7 @@ static void BuyMenuReturnToItemList(u8 taskId)
BuyMenuPrintCursor(tListTaskId, 1); BuyMenuPrintCursor(tListTaskId, 1);
PutWindowTilemap(1); PutWindowTilemap(1);
PutWindowTilemap(2); PutWindowTilemap(2);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
BuyMenuAddScrollIndicatorArrows(); BuyMenuAddScrollIndicatorArrows();
gTasks[taskId].func = Task_BuyMenu; gTasks[taskId].func = Task_BuyMenu;
} }

View File

@ -487,7 +487,7 @@ static void Task_StarterChoose1(u8 taskId)
DrawStdFrameWithCustomTileAndPalette(0, FALSE, 0x2A8, 0xD); DrawStdFrameWithCustomTileAndPalette(0, FALSE, 0x2A8, 0xD);
AddTextPrinterParameterized(0, 1, gText_BirchInTrouble, 0, 1, 0, NULL); AddTextPrinterParameterized(0, 1, gText_BirchInTrouble, 0, 1, 0, NULL);
PutWindowTilemap(0); PutWindowTilemap(0);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
gTasks[taskId].func = Task_StarterChoose2; gTasks[taskId].func = Task_StarterChoose2;
} }
@ -540,7 +540,7 @@ static void Task_StarterChoose4(u8 taskId)
PlayCry1(GetStarterPokemon(gTasks[taskId].tStarterSelection), 0); PlayCry1(GetStarterPokemon(gTasks[taskId].tStarterSelection), 0);
FillWindowPixelBuffer(0, PIXEL_FILL(1)); FillWindowPixelBuffer(0, PIXEL_FILL(1));
AddTextPrinterParameterized(0, 1, gText_ConfirmStarterChoice, 0, 1, 0, NULL); AddTextPrinterParameterized(0, 1, gText_ConfirmStarterChoice, 0, 1, 0, NULL);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
CreateYesNoMenu(&gUnknown_085B1DDC, 0x2A8, 0xD, 0); CreateYesNoMenu(&gUnknown_085B1DDC, 0x2A8, 0xD, 0);
gTasks[taskId].func = Task_StarterChoose5; gTasks[taskId].func = Task_StarterChoose5;
} }
@ -603,7 +603,7 @@ static void CreateStarterPokemonLabel(u8 selection)
AddTextPrinterParameterized3(sStarterChooseWindowId, 1, width, 0x11, sTextColors, 0, speciesName); AddTextPrinterParameterized3(sStarterChooseWindowId, 1, width, 0x11, sTextColors, 0, speciesName);
PutWindowTilemap(sStarterChooseWindowId); PutWindowTilemap(sStarterChooseWindowId);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
labelLeft = sStarterLabelCoords[selection][0] * 8 - 4; labelLeft = sStarterLabelCoords[selection][0] * 8 - 4;
labelRight = (sStarterLabelCoords[selection][0] + 13) * 8 + 4; labelRight = (sStarterLabelCoords[selection][0] + 13) * 8 + 4;
@ -621,7 +621,7 @@ static void sub_8134604(void)
sStarterChooseWindowId = 0xFF; sStarterChooseWindowId = 0xFF;
SetGpuReg(REG_OFFSET_WIN0H, 0); SetGpuReg(REG_OFFSET_WIN0H, 0);
SetGpuReg(REG_OFFSET_WIN0V, 0); SetGpuReg(REG_OFFSET_WIN0V, 0);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
} }
static void Task_MoveStarterChooseCursor(u8 taskId) static void Task_MoveStarterChooseCursor(u8 taskId)

View File

@ -83,7 +83,7 @@ void CreateAvailableDecorationsMenu(u8 taskId)
} }
AddTextPrinterParameterized(data[3], 1, gText_Exit, 8, 16 * i + 1, 255, NULL); AddTextPrinterParameterized(data[3], 1, gText_Exit, 8, 16 * i + 1, 255, NULL);
InitMenuInUpperLeftCornerPlaySoundWhenAPressed(data[3], 5, 0); InitMenuInUpperLeftCornerPlaySoundWhenAPressed(data[3], 5, 0);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
} }
void Task_BufferDecorSelectionAndCloseWindow(u8 taskId, u8 decorationId) void Task_BufferDecorSelectionAndCloseWindow(u8 taskId, u8 decorationId)
@ -101,7 +101,7 @@ void Task_BufferDecorSelectionAndCloseWindow(u8 taskId, u8 decorationId)
ClearStdWindowAndFrameToTransparent(data[3], FALSE); ClearStdWindowAndFrameToTransparent(data[3], FALSE);
ClearWindowTilemap(data[3]); ClearWindowTilemap(data[3]);
RemoveWindow(data[3]); RemoveWindow(data[3]);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
DestroyTask(taskId); DestroyTask(taskId);
EnableBothScriptContexts(); EnableBothScriptContexts();
} }

View File

@ -518,7 +518,7 @@ void sub_801AC54(void)
ResetTasks(); ResetTasks();
ResetBgsAndClearDma3BusyFlags(0); ResetBgsAndClearDma3BusyFlags(0);
InitBgsFromTemplates(0, gUnknown_082F0DD0, 1); InitBgsFromTemplates(0, gUnknown_082F0DD0, 1);
reset_temp_tile_data_buffers(); ResetTempTileDataBuffers();
if (!InitWindows(gUnknown_082F0DD4)) if (!InitWindows(gUnknown_082F0DD4))
{ {
return; return;

View File

@ -1828,7 +1828,7 @@ static bool8 sub_801F4D0(void)
ResetBgsAndClearDma3BusyFlags(0); ResetBgsAndClearDma3BusyFlags(0);
InitBgsFromTemplates(0, gUnknown_082F2C60, ARRAY_COUNT(gUnknown_082F2C60)); InitBgsFromTemplates(0, gUnknown_082F2C60, ARRAY_COUNT(gUnknown_082F2C60));
InitWindows(gUnknown_082F2C70); InitWindows(gUnknown_082F2C70);
reset_temp_tile_data_buffers(); ResetTempTileDataBuffers();
sub_8020770(); sub_8020770();
sub_801F574(gUnknown_02022C88); sub_801F574(gUnknown_02022C88);
sub_801F580(); sub_801F580();
@ -1916,7 +1916,7 @@ static bool8 sub_801F644(u8 arg0)
bool32 sub_801F658(u8 *state) bool32 sub_801F658(u8 *state)
{ {
if (free_temp_tile_data_buffers_if_possible() == TRUE) if (FreeTempTileDataBuffersIfPossible() == TRUE)
return TRUE; return TRUE;
switch (*state) switch (*state)
@ -2739,7 +2739,7 @@ static void sub_80205B4(void)
{ {
LoadPalette(gUnknown_08DD4BD0, 0x70, 0x20); LoadPalette(gUnknown_08DD4BD0, 0x70, 0x20);
LoadPalette(gUnknown_08DD4BB0, 0xC0, 0x20); LoadPalette(gUnknown_08DD4BB0, 0xC0, 0x20);
decompress_and_copy_tile_data_to_vram(1, gUnknown_08DD4BF0, 0, 0, 0); DecompressAndCopyTileDataToVram(1, gUnknown_08DD4BF0, 0, 0, 0);
CopyToBgTilemapBuffer(1, gUnknown_08DD4C4C, 0, 0); CopyToBgTilemapBuffer(1, gUnknown_08DD4C4C, 0, 0);
CopyBgTilemapBufferToVram(1); CopyBgTilemapBufferToVram(1);
} }
@ -2749,7 +2749,7 @@ static void sub_8020604(void)
u8 *ptr; u8 *ptr;
LoadPalette(gLinkMiscMenu_Pal, 0, 0x20); LoadPalette(gLinkMiscMenu_Pal, 0, 0x20);
ptr = decompress_and_copy_tile_data_to_vram(2, gLinkMiscMenu_Gfx, 0, 0, 0); ptr = DecompressAndCopyTileDataToVram(2, gLinkMiscMenu_Gfx, 0, 0, 0);
if (ptr) if (ptr)
{ {
CpuFastCopy(&ptr[0x220], gUnknown_02022C88->unk2128, 0x20); CpuFastCopy(&ptr[0x220], gUnknown_02022C88->unk2128, 0x20);

View File

@ -724,7 +724,7 @@ void CB2_StartWallClock(void)
AddTextPrinterParameterized(1, 1, gText_Confirm3, 0, 1, 0, NULL); AddTextPrinterParameterized(1, 1, gText_Confirm3, 0, 1, 0, NULL);
PutWindowTilemap(1); PutWindowTilemap(1);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
} }
void CB2_ViewWallClock(void) void CB2_ViewWallClock(void)
@ -772,7 +772,7 @@ void CB2_ViewWallClock(void)
AddTextPrinterParameterized(1, 1, gText_Cancel4, 0, 1, 0, NULL); AddTextPrinterParameterized(1, 1, gText_Cancel4, 0, 1, 0, NULL);
PutWindowTilemap(1); PutWindowTilemap(1);
schedule_bg_copy_tilemap_to_vram(2); ScheduleBgCopyTilemapToVram(2);
} }
static void WallClockMainCallback(void) static void WallClockMainCallback(void)
@ -839,7 +839,7 @@ static void Task_SetClock3(u8 taskId)
DrawStdFrameWithCustomTileAndPalette(0, FALSE, 0x250, 0x0d); DrawStdFrameWithCustomTileAndPalette(0, FALSE, 0x250, 0x0d);
AddTextPrinterParameterized(0, 1, gText_IsThisTheCorrectTime, 0, 1, 0, NULL); AddTextPrinterParameterized(0, 1, gText_IsThisTheCorrectTime, 0, 1, 0, NULL);
PutWindowTilemap(0); PutWindowTilemap(0);
schedule_bg_copy_tilemap_to_vram(0); ScheduleBgCopyTilemapToVram(0);
CreateYesNoMenu(&gUnknown_085B21F4, 0x250, 0x0d, 1); CreateYesNoMenu(&gUnknown_085B21F4, 0x250, 0x0d, 1);
gTasks[taskId].func = Task_SetClock4; gTasks[taskId].func = Task_SetClock4;
} }