battle records decompiled and documented
This commit is contained in:
+51
-51
@@ -25,22 +25,22 @@
|
|||||||
extern void PrintOnTrainerHillRecordsWindow(void); // pokenav.s
|
extern void PrintOnTrainerHillRecordsWindow(void); // pokenav.s
|
||||||
|
|
||||||
// this file's functions
|
// this file's functions
|
||||||
static void sub_813C5EC(u8 taskId);
|
static void Task_CloseTrainerHillRecordsOnButton(u8 taskId);
|
||||||
static void sub_813C62C(u8 taskId);
|
static void Task_BeginPaletteFade(u8 taskId);
|
||||||
static void sub_813C664(u8 taskId);
|
static void Task_ExitTrainerHillRecords(u8 taskId);
|
||||||
static void sub_813C6A8(u8 windowId);
|
static void RemoveTrainerHillRecordsWindow(u8 windowId);
|
||||||
static void sub_813C91C(void);
|
static void CB2_ShowTrainerHillRecords(void);
|
||||||
|
|
||||||
// EWRAM variables
|
// EWRAM variables
|
||||||
EWRAM_DATA u8 gRecordsWindowId = 0;
|
EWRAM_DATA u8 gRecordsWindowId = 0;
|
||||||
EWRAM_DATA static u8 *sUnknown_0203AB78 = NULL;
|
EWRAM_DATA static u8 *sTilemapBuffer = NULL;
|
||||||
|
|
||||||
// const rom data
|
// const rom data
|
||||||
const u32 gUnknown_085B3484[] = INCBIN_U32("graphics/unknown/unknown_5B3484.4bpp");
|
static const u32 sTrainerHillWindowTileset[] = INCBIN_U32("graphics/unknown/unknown_5B3484.4bpp");
|
||||||
const u16 gUnknown_085B3544[] = INCBIN_U16("graphics/unknown/unknown_5B3484.gbapal");
|
static const u16 sTrainerHillWindowPalette[] = INCBIN_U16("graphics/unknown/unknown_5B3484.gbapal");
|
||||||
const u32 gUnknown_085B3564[] = INCBIN_U32("graphics/unknown/unknown_5B3564.bin");
|
static const u32 sTrainerHillWindowTilemap[] = INCBIN_U32("graphics/unknown/unknown_5B3564.bin");
|
||||||
|
|
||||||
const struct BgTemplate gUnknown_085B3D64[] =
|
static const struct BgTemplate sTrainerHillRecordsBgTemplates[] =
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
.bg = 0,
|
.bg = 0,
|
||||||
@@ -62,16 +62,16 @@ const struct BgTemplate gUnknown_085B3D64[] =
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct WindowTemplate gUnknown_085B3D6C[] =
|
static const struct WindowTemplate sTrainerHillRecordsWindowTemplates[] =
|
||||||
{
|
{
|
||||||
{0x0, 0x2, 0x1, 0x1A, 0x12, 0xF, 0x14},
|
{0x0, 0x2, 0x1, 0x1A, 0x12, 0xF, 0x14},
|
||||||
DUMMY_WIN_TEMPLATE
|
DUMMY_WIN_TEMPLATE
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct WindowTemplate gUnknown_085B3D7C = {0x0, 0x2, 0x1, 0x1A, 0x11, 0xF, 0x1};
|
static const struct WindowTemplate sLinkBattleRecordsWindow = {0x0, 0x2, 0x1, 0x1A, 0x11, 0xF, 0x1};
|
||||||
|
|
||||||
const u8 gUnknown_085B3D84[] = _("-------");
|
static const u8 sText_DashesNoPlayer[] = _("-------");
|
||||||
const u8 gUnknown_085B3D8C[] = _("----");
|
static const u8 sText_DashesNoScore[] = _("----");
|
||||||
|
|
||||||
// code
|
// code
|
||||||
static void ClearLinkBattleRecord(struct LinkBattleRecord *record)
|
static void ClearLinkBattleRecord(struct LinkBattleRecord *record)
|
||||||
@@ -274,10 +274,10 @@ static void PrintLinkBattleRecord(struct LinkBattleRecord *record, u8 y, s32 lan
|
|||||||
if (record->wins == 0 && record->losses == 0 && record->draws == 0)
|
if (record->wins == 0 && record->losses == 0 && record->draws == 0)
|
||||||
{
|
{
|
||||||
// empty slot
|
// empty slot
|
||||||
PrintTextOnWindow(gRecordsWindowId, 1, gUnknown_085B3D84, 8, (y * 8) + 1, 0, NULL);
|
PrintTextOnWindow(gRecordsWindowId, 1, sText_DashesNoPlayer, 8, (y * 8) + 1, 0, NULL);
|
||||||
PrintTextOnWindow(gRecordsWindowId, 1, gUnknown_085B3D8C, 80, (y * 8) + 1, 0, NULL);
|
PrintTextOnWindow(gRecordsWindowId, 1, sText_DashesNoScore, 80, (y * 8) + 1, 0, NULL);
|
||||||
PrintTextOnWindow(gRecordsWindowId, 1, gUnknown_085B3D8C, 128, (y * 8) + 1, 0, NULL);
|
PrintTextOnWindow(gRecordsWindowId, 1, sText_DashesNoScore, 128, (y * 8) + 1, 0, NULL);
|
||||||
PrintTextOnWindow(gRecordsWindowId, 1, gUnknown_085B3D8C, 176, (y * 8) + 1, 0, NULL);
|
PrintTextOnWindow(gRecordsWindowId, 1, sText_DashesNoScore, 176, (y * 8) + 1, 0, NULL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -302,7 +302,7 @@ void ShowLinkBattleRecords(void)
|
|||||||
{
|
{
|
||||||
s32 i, x;
|
s32 i, x;
|
||||||
|
|
||||||
gRecordsWindowId = AddWindow(&gUnknown_085B3D7C);
|
gRecordsWindowId = AddWindow(&sLinkBattleRecordsWindow);
|
||||||
NewMenuHelpers_DrawStdWindowFrame(gRecordsWindowId, FALSE);
|
NewMenuHelpers_DrawStdWindowFrame(gRecordsWindowId, FALSE);
|
||||||
FillWindowPixelBuffer(gRecordsWindowId, 0x11);
|
FillWindowPixelBuffer(gRecordsWindowId, 0x11);
|
||||||
StringExpandPlaceholders(gStringVar4, gText_PlayersBattleResults);
|
StringExpandPlaceholders(gStringVar4, gText_PlayersBattleResults);
|
||||||
@@ -329,42 +329,42 @@ void RemoveRecordsWindow(void)
|
|||||||
RemoveWindow(gRecordsWindowId);
|
RemoveWindow(gRecordsWindowId);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_813C5BC(u8 taskId)
|
static void Task_TrainerHillWaitForPaletteFade(u8 taskId)
|
||||||
{
|
{
|
||||||
if (!gPaletteFade.active)
|
if (!gPaletteFade.active)
|
||||||
gTasks[taskId].func = sub_813C5EC;
|
gTasks[taskId].func = Task_CloseTrainerHillRecordsOnButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_813C5EC(u8 taskId)
|
static void Task_CloseTrainerHillRecordsOnButton(u8 taskId)
|
||||||
{
|
{
|
||||||
struct Task *task = &gTasks[taskId];
|
struct Task *task = &gTasks[taskId];
|
||||||
|
|
||||||
if (gMain.newKeys & A_BUTTON || gMain.newKeys & B_BUTTON)
|
if (gMain.newKeys & A_BUTTON || gMain.newKeys & B_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
task->func = sub_813C62C;
|
task->func = Task_BeginPaletteFade;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_813C62C(u8 taskId)
|
static void Task_BeginPaletteFade(u8 taskId)
|
||||||
{
|
{
|
||||||
BeginNormalPaletteFade(-1, 0, 0, 0x10, 0);
|
BeginNormalPaletteFade(-1, 0, 0, 0x10, 0);
|
||||||
gTasks[taskId].func = sub_813C664;
|
gTasks[taskId].func = Task_ExitTrainerHillRecords;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_813C664(u8 taskId)
|
static void Task_ExitTrainerHillRecords(u8 taskId)
|
||||||
{
|
{
|
||||||
if (!gPaletteFade.active)
|
if (!gPaletteFade.active)
|
||||||
{
|
{
|
||||||
SetMainCallback2(CB2_ReturnToFieldContinueScript);
|
SetMainCallback2(CB2_ReturnToFieldContinueScript);
|
||||||
Free(sUnknown_0203AB78);
|
Free(sTilemapBuffer);
|
||||||
sub_813C6A8(0);
|
RemoveTrainerHillRecordsWindow(0);
|
||||||
FreeAllWindowBuffers();
|
FreeAllWindowBuffers();
|
||||||
DestroyTask(taskId);
|
DestroyTask(taskId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_813C6A8(u8 windowId)
|
static void RemoveTrainerHillRecordsWindow(u8 windowId)
|
||||||
{
|
{
|
||||||
FillWindowPixelBuffer(windowId, 0);
|
FillWindowPixelBuffer(windowId, 0);
|
||||||
ClearWindowTilemap(windowId);
|
ClearWindowTilemap(windowId);
|
||||||
@@ -372,7 +372,7 @@ static void sub_813C6A8(u8 windowId)
|
|||||||
RemoveWindow(windowId);
|
RemoveWindow(windowId);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_813C6D4(void)
|
static void ClearVramOamPlttRegs(void)
|
||||||
{
|
{
|
||||||
DmaClearLarge16(3, (void*)(VRAM), VRAM_SIZE, 0x1000);
|
DmaClearLarge16(3, (void*)(VRAM), VRAM_SIZE, 0x1000);
|
||||||
DmaClear32(3, OAM, OAM_SIZE);
|
DmaClear32(3, OAM, OAM_SIZE);
|
||||||
@@ -400,7 +400,7 @@ static void sub_813C6D4(void)
|
|||||||
SetGpuReg(REG_OFFSET_BLDY, 0);
|
SetGpuReg(REG_OFFSET_BLDY, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_813C80C(void)
|
static void ClearTasksAndGraphicalStructs(void)
|
||||||
{
|
{
|
||||||
ScanlineEffect_Stop();
|
ScanlineEffect_Stop();
|
||||||
ResetTasks();
|
ResetTasks();
|
||||||
@@ -421,26 +421,26 @@ static void ResetBgCoordinates(void)
|
|||||||
ChangeBgY(3, 0, 0);
|
ChangeBgY(3, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_813C880(void)
|
static void SetDispcntReg(void)
|
||||||
{
|
{
|
||||||
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_BG0_ON | DISPCNT_BG3_ON | DISPCNT_OBJ_1D_MAP);
|
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_BG0_ON | DISPCNT_BG3_ON | DISPCNT_OBJ_1D_MAP);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_813C890(u8 bgId)
|
static void LoadTrainerHillRecordsWindowGfx(u8 bgId)
|
||||||
{
|
{
|
||||||
LoadBgTiles(bgId, gUnknown_085B3484, sizeof(gUnknown_085B3484), 0);
|
LoadBgTiles(bgId, sTrainerHillWindowTileset, sizeof(sTrainerHillWindowTileset), 0);
|
||||||
CopyToBgTilemapBufferRect(bgId, gUnknown_085B3564, 0, 0, 0x20, 0x20);
|
CopyToBgTilemapBufferRect(bgId, sTrainerHillWindowTilemap, 0, 0, 0x20, 0x20);
|
||||||
LoadPalette(gUnknown_085B3544, 0, 0x20);
|
LoadPalette(sTrainerHillWindowPalette, 0, 0x20);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_813C8D8(void)
|
static void VblankCB_TrainerHillRecords(void)
|
||||||
{
|
{
|
||||||
LoadOam();
|
LoadOam();
|
||||||
ProcessSpriteCopyRequests();
|
ProcessSpriteCopyRequests();
|
||||||
TransferPlttBuffer();
|
TransferPlttBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_813C8EC(void)
|
static void MainCB2_TrainerHillRecords(void)
|
||||||
{
|
{
|
||||||
RunTasks();
|
RunTasks();
|
||||||
AnimateSprites();
|
AnimateSprites();
|
||||||
@@ -451,32 +451,32 @@ static void sub_813C8EC(void)
|
|||||||
void ShowTrainerHillRecords(void)
|
void ShowTrainerHillRecords(void)
|
||||||
{
|
{
|
||||||
SetVBlankCallback(NULL);
|
SetVBlankCallback(NULL);
|
||||||
SetMainCallback2(sub_813C91C);
|
SetMainCallback2(CB2_ShowTrainerHillRecords);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_813C91C(void)
|
static void CB2_ShowTrainerHillRecords(void)
|
||||||
{
|
{
|
||||||
switch (gMain.state)
|
switch (gMain.state)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
SetVBlankCallback(NULL);
|
SetVBlankCallback(NULL);
|
||||||
sub_813C6D4();
|
ClearVramOamPlttRegs();
|
||||||
gMain.state++;
|
gMain.state++;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
sub_813C80C();
|
ClearTasksAndGraphicalStructs();
|
||||||
gMain.state++;
|
gMain.state++;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
sUnknown_0203AB78 = AllocZeroed(0x800);
|
sTilemapBuffer = AllocZeroed(0x800);
|
||||||
ResetBgsAndClearDma3BusyFlags(0);
|
ResetBgsAndClearDma3BusyFlags(0);
|
||||||
InitBgsFromTemplates(0, gUnknown_085B3D64, ARRAY_COUNT(gUnknown_085B3D64));
|
InitBgsFromTemplates(0, sTrainerHillRecordsBgTemplates, ARRAY_COUNT(sTrainerHillRecordsBgTemplates));
|
||||||
SetBgTilemapBuffer(3, sUnknown_0203AB78);
|
SetBgTilemapBuffer(3, sTilemapBuffer);
|
||||||
ResetBgCoordinates();
|
ResetBgCoordinates();
|
||||||
gMain.state++;
|
gMain.state++;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
sub_813C890(3);
|
LoadTrainerHillRecordsWindowGfx(3);
|
||||||
LoadPalette(stdpal_get(0), 0xF0, 0x20);
|
LoadPalette(stdpal_get(0), 0xF0, 0x20);
|
||||||
gMain.state++;
|
gMain.state++;
|
||||||
break;
|
break;
|
||||||
@@ -490,7 +490,7 @@ static void sub_813C91C(void)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
InitWindows(gUnknown_085B3D6C);
|
InitWindows(sTrainerHillRecordsWindowTemplates);
|
||||||
DeactivateAllTextPrinters();
|
DeactivateAllTextPrinters();
|
||||||
gMain.state++;
|
gMain.state++;
|
||||||
break;
|
break;
|
||||||
@@ -499,11 +499,11 @@ static void sub_813C91C(void)
|
|||||||
gMain.state++;
|
gMain.state++;
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
sub_813C880();
|
SetDispcntReg();
|
||||||
SetVBlankCallback(sub_813C8D8);
|
SetVBlankCallback(VblankCB_TrainerHillRecords);
|
||||||
PrintOnTrainerHillRecordsWindow();
|
PrintOnTrainerHillRecordsWindow();
|
||||||
CreateTask(sub_813C5BC, 8);
|
CreateTask(Task_TrainerHillWaitForPaletteFade, 8);
|
||||||
SetMainCallback2(sub_813C8EC);
|
SetMainCallback2(MainCB2_TrainerHillRecords);
|
||||||
gMain.state = 0;
|
gMain.state = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-6
@@ -20,8 +20,10 @@
|
|||||||
#include "tv.h"
|
#include "tv.h"
|
||||||
#include "coins.h"
|
#include "coins.h"
|
||||||
#include "text.h"
|
#include "text.h"
|
||||||
|
#include "overworld.h"
|
||||||
|
#include "mail.h"
|
||||||
|
#include "battle_records.h"
|
||||||
|
|
||||||
extern u8 gPlayerPartyCount;
|
|
||||||
extern u8 gDifferentSaveFile;
|
extern u8 gDifferentSaveFile;
|
||||||
extern u16 gSaveFileStatus;
|
extern u16 gSaveFileStatus;
|
||||||
extern u8 gUnknown_030060B0;
|
extern u8 gUnknown_030060B0;
|
||||||
@@ -29,19 +31,15 @@ extern u8 gUnknown_030060B0;
|
|||||||
// TODO: replace those declarations with file headers
|
// TODO: replace those declarations with file headers
|
||||||
extern u16 GetGeneratedTrainerIdLower(void);
|
extern u16 GetGeneratedTrainerIdLower(void);
|
||||||
extern void ClearContestWinnerPicsInContestHall(void);
|
extern void ClearContestWinnerPicsInContestHall(void);
|
||||||
extern void Overworld_SetWarpDestination(s8 mapBank, s8 mapNo, s8 warpNo, s8 xPos, s8 yPos);
|
|
||||||
extern void warp_in(void);
|
extern void warp_in(void);
|
||||||
extern void sub_80BB358(void);
|
extern void sub_80BB358(void);
|
||||||
extern void ResetBagScrollPositions(void);
|
extern void ResetBagScrollPositions(void);
|
||||||
extern void ResetPokedex(void);
|
extern void ResetPokedex(void);
|
||||||
extern void sub_8084400(void);
|
extern void sub_8084400(void);
|
||||||
extern void ClearMailData(void);
|
|
||||||
extern void ResetGabbyAndTy(void);
|
extern void ResetGabbyAndTy(void);
|
||||||
extern void ResetSecretBases(void);
|
extern void ResetSecretBases(void);
|
||||||
extern void ResetLinkContestBoolean(void);
|
extern void ResetLinkContestBoolean(void);
|
||||||
extern void ResetGameStats(void);
|
|
||||||
extern void sub_8052DA8(void);
|
extern void sub_8052DA8(void);
|
||||||
extern void ClearPlayerLinkBattleRecords(void);
|
|
||||||
extern void ResetPokemonStorageSystem(void);
|
extern void ResetPokemonStorageSystem(void);
|
||||||
extern void ClearBag(void);
|
extern void ClearBag(void);
|
||||||
extern void NewGameInitPCItems(void);
|
extern void NewGameInitPCItems(void);
|
||||||
@@ -58,7 +56,7 @@ extern void ResetContestLinkResults(void);
|
|||||||
extern void ResetPokeJumpResults(void);
|
extern void ResetPokeJumpResults(void);
|
||||||
extern void SetBerryPowder(u32* powder, u32 newValue);
|
extern void SetBerryPowder(u32* powder, u32 newValue);
|
||||||
|
|
||||||
extern u8 EventScript_2715DE[];
|
extern const u8 EventScript_2715DE[];
|
||||||
|
|
||||||
void WriteUnalignedWord(u32 var, u8 *dataPtr)
|
void WriteUnalignedWord(u32 var, u8 *dataPtr)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user