through sub_808CF10

This commit is contained in:
PikalaxALT
2020-03-11 17:03:57 -04:00
parent 6b4b6a54af
commit 5422315db5
15 changed files with 406 additions and 331 deletions
+106
View File
@@ -1,3 +1,109 @@
#include "global.h"
#include "gflib.h"
#include "box_party_pokemon_dropdown.h"
#include "help_system.h"
#include "new_menu_helpers.h"
#include "pokemon_storage_system_internal.h"
#include "task.h"
#include "constants/help_system.h"
EWRAM_DATA struct PokemonStorageSystemData *sPSSData = NULL;
EWRAM_DATA bool8 sInPartyMenu = 0;
EWRAM_DATA u8 sCurrentBoxOption = 0;
EWRAM_DATA u8 gUnknown_20397B6 = 0;
EWRAM_DATA u8 sWhichToReshow = 0;
EWRAM_DATA u8 sLastUsedBox = 0;
EWRAM_DATA u16 gUnknown_20397BA = 0;
void sub_808EFC8(void);
void sub_808F99C(void);
void sub_8096BF8(void);
void task_box_related_3(u8 taskId);
void sub_8096BE4(struct UnkStruct_2000020 *arg0, struct UnkStruct_2000028 *arg1, u32 arg2);
extern const u16 gUnknown_83CE6F8[];
void VblankCb_PSS(void)
{
LoadOam();
ProcessSpriteCopyRequests();
sub_8096BF8();
TransferPlttBuffer();
SetGpuReg(REG_OFFSET_BG2HOFS, sPSSData->bg2_X);
}
void Cb2_PSS(void)
{
RunTasks();
DoScheduledBgTilemapCopiesToVram();
sub_808EFC8();
sub_808F99C();
AnimateSprites();
BuildOamBuffer();
}
void Cb2_EnterPSS(u8 boxOption)
{
ResetTasks();
sCurrentBoxOption = boxOption;
sPSSData = Alloc(sizeof(struct PokemonStorageSystemData));
if (sPSSData == NULL)
SetMainCallback2(Cb2_ExitPSS);
else
{
sPSSData->boxOption = boxOption;
sPSSData->isReshowingPSS = FALSE;
gUnknown_20397BA = 0;
sPSSData->state = 0;
sPSSData->taskId = CreateTask(task_box_related_3, 3);
SetHelpContext(HELPCONTEXT_BILLS_PC);
sLastUsedBox = StorageGetCurrentBox();
SetMainCallback2(Cb2_PSS);
}
}
void Cb2_ReturnToPSS(void)
{
ResetTasks();
sPSSData = Alloc(sizeof(struct PokemonStorageSystemData));
if (sPSSData == NULL)
SetMainCallback2(Cb2_ExitPSS);
else
{
sPSSData->boxOption = sCurrentBoxOption;
sPSSData->isReshowingPSS = TRUE;
sPSSData->state = 0;
sPSSData->taskId = CreateTask(task_box_related_3, 3);
SetHelpContext(HELPCONTEXT_BILLS_PC);
SetMainCallback2(Cb2_PSS);
}
}
void ResetAllBgCoords(void)
{
SetGpuReg(REG_OFFSET_BG0HOFS, 0);
SetGpuReg(REG_OFFSET_BG0VOFS, 0);
SetGpuReg(REG_OFFSET_BG1HOFS, 0);
SetGpuReg(REG_OFFSET_BG1VOFS, 0);
SetGpuReg(REG_OFFSET_BG2HOFS, 0);
SetGpuReg(REG_OFFSET_BG2VOFS, 0);
SetGpuReg(REG_OFFSET_BG3HOFS, 0);
SetGpuReg(REG_OFFSET_BG3VOFS, 0);
}
void sub_808CF10(void)
{
ResetPaletteFade();
ResetSpriteData();
FreeSpriteTileRanges();
FreeAllSpritePalettes();
ClearDma3Requests();
gReservedSpriteTileCount = 0x280;
sub_8096BE4(&sPSSData->unk_0020, sPSSData->unk_0028, 8);
gKeyRepeatStartDelay = 20;
ClearScheduledBgCopiesToVram();
AllocBoxPartyPokemonDropdowns(3);
SetBoxPartyPokemonDropdownMap2(0, 1, gUnknown_83CE6F8, 8, 4);
SetBoxPartyPokemonDropdownMap2Pos(0, 1, 0);
sPSSData->unk_02C7 = 0;
}