diff options
author | PikalaxALT <pikalaxalt@gmail.com> | 2021-06-25 14:54:21 -0400 |
---|---|---|
committer | PikalaxALT <pikalaxalt@gmail.com> | 2021-06-25 14:54:21 -0400 |
commit | f8bdecb0e1ab13de90ea8f0190710982eb695186 (patch) | |
tree | 59932e27675829988248d0b36909ca1a26308c94 /src | |
parent | f029db52f59614e22a7a2d70eb3da46094bf47f1 (diff) |
Simplify EWRAM for hall_of_fame.c
Diffstat (limited to 'src')
-rw-r--r-- | src/credits.c | 4 | ||||
-rw-r--r-- | src/hall_of_fame.c | 128 | ||||
-rw-r--r-- | src/post_battle_event_funcs.c | 6 |
3 files changed, 69 insertions, 69 deletions
diff --git a/src/credits.c b/src/credits.c index 24321dc61..3f1335cd8 100644 --- a/src/credits.c +++ b/src/credits.c @@ -174,7 +174,7 @@ extern s16 gUnknown_0203935C; static EWRAM_DATA s16 gUnknown_02039320 = 0; static EWRAM_DATA u16 gUnknown_02039322 = 0; // TASK A -EWRAM_DATA u8 gUnknown_02039324 = 0; +EWRAM_DATA u8 gHasHallOfFameRecords = 0; static EWRAM_DATA u8 gUnknown_02039325 = 0; extern u8 gReservedSpritePaletteCount; @@ -433,7 +433,7 @@ static void sub_814395C(void) UpdatePaletteFade(); if ((gMain.heldKeys & B_BUTTON) - && gUnknown_02039324 != 0 + && gHasHallOfFameRecords != 0 && gTasks[gUnknown_02039322].func == task_a_8143B68) { vblank_8143948(); diff --git a/src/hall_of_fame.c b/src/hall_of_fame.c index 3b991c2ea..ca0022b39 100644 --- a/src/hall_of_fame.c +++ b/src/hall_of_fame.c @@ -23,9 +23,9 @@ #include "pc_screen_effect.h" #include "ewram.h" -static EWRAM_DATA u32 sUnknown_0203931C = 0; +static EWRAM_DATA u32 sHofFadePalettes = 0; -extern bool8 gUnknown_02039324; // has hall of fame records +extern bool8 gHasHallOfFameRecords; // has hall of fame records extern void (*gGameContinueCallback)(void); extern struct MusicPlayerInfo gMPlayInfo_BGM; extern u8 gReservedSpritePaletteCount; @@ -54,7 +54,7 @@ struct HallofFameMons static void sub_8141FF8(u8 taskID); static void sub_81422E8(u8 taskID); -static void sub_814217C(u8 taskID); +static void Task_Hof_InitTeamSaveData(u8 taskID); static void sub_8142274(u8 taskID); static void sub_81422B8(u8 taskID); static void sub_8142320(u8 taskID); @@ -150,69 +150,69 @@ static const struct OamData sOamData_840B598 = void* const gUnknown_0840B5A0[] = { - ewram8000, - ewramA000, - ewramC000, - ewramE000, - ewram10000, - ewram14000, - ewram18000_2 + eHofGfxPtr + 0x0000, + eHofGfxPtr + 0x2000, + eHofGfxPtr + 0x4000, + eHofGfxPtr + 0x6000, + eHofGfxPtr + 0x8000, + eHofGfxPtr + 0xC000, + eHofGfxPtr + 0x10000 }; static const struct SpriteFrameImage sSpriteImageTable_840B5BC[] = { - {ewram8000, 0x800}, - {ewram8800, 0x800}, - {ewram9000, 0x800}, - {ewram9800, 0x800} + {eHofGfxPtr + 0x0000, 0x800}, + {eHofGfxPtr + 0x800, 0x800}, + {eHofGfxPtr + 0x1000, 0x800}, + {eHofGfxPtr + 0x1800, 0x800} }; static const struct SpriteFrameImage sSpriteImageTable_840B5DC[] = { - {ewramA000, 0x800}, - {ewramA800, 0x800}, - {ewramB000, 0x800}, - {ewramB800, 0x800} + {eHofGfxPtr + 0x2000, 0x800}, + {eHofGfxPtr + 0x2800, 0x800}, + {eHofGfxPtr + 0x3000, 0x800}, + {eHofGfxPtr + 0x3800, 0x800} }; static const struct SpriteFrameImage sSpriteImageTable_840B5FC[] = { - {ewramC000, 0x800}, - {ewramC800, 0x800}, - {ewramD000, 0x800}, - {ewramD800, 0x800} + {eHofGfxPtr + 0x4000, 0x800}, + {eHofGfxPtr + 0x4800, 0x800}, + {eHofGfxPtr + 0x5000, 0x800}, + {eHofGfxPtr + 0x5800, 0x800} }; static const struct SpriteFrameImage sSpriteImageTable_840B61C[] = { - {ewramE000, 0x800}, - {ewramE800, 0x800}, - {ewramF000, 0x800}, - {ewramF800, 0x800} + {eHofGfxPtr + 0x6000, 0x800}, + {eHofGfxPtr + 0x6800, 0x800}, + {eHofGfxPtr + 0x7000, 0x800}, + {eHofGfxPtr + 0x7800, 0x800} }; static const struct SpriteFrameImage sSpriteImageTable_840B63C[] = { - {ewram10000, 0x800}, - {ewram10800, 0x800}, - {ewram11000, 0x800}, - {ewram11800, 0x800} + {eHofGfxPtr + 0x8000, 0x800}, + {eHofGfxPtr + 0x8800, 0x800}, + {eHofGfxPtr + 0x9000, 0x800}, + {eHofGfxPtr + 0x9800, 0x800} }; static const struct SpriteFrameImage sSpriteImageTable_840B65C[] = { - {ewram14000, 0x800}, - {ewram14800, 0x800}, - {ewram15000, 0x800}, - { eUnzippedContestAudience_Gfx, 0x800} + {eHofGfxPtr + 0xC000, 0x800}, + {eHofGfxPtr + 0xC800, 0x800}, + {eHofGfxPtr + 0xD000, 0x800}, + {eHofGfxPtr + 0xD800, 0x800} }; static const struct SpriteFrameImage sSpriteImageTable_840B67C[] = { - {ewram18000_2, 0x800}, - {ewram18800, 0x800}, - {ewram19000, 0x800}, - {ewram19800, 0x800} + {eHofGfxPtr + 0x10000, 0x800}, + {eHofGfxPtr + 0x10800, 0x800}, + {eHofGfxPtr + 0x11000, 0x800}, + {eHofGfxPtr + 0x11800, 0x800} }; static const struct SpriteFrameImage* const sUnknown_0840B69C[7] = @@ -480,7 +480,7 @@ static void sub_8141FC4(void) static void sub_8141FF8(u8 taskID) { u16 i, j; - struct HallofFameMons* fameMons = eHallOfFameMons1; + struct HallofFameMons* fameMons = eHofMonPtr; gTasks[taskID].tPokesNumber = 0; // valid pokes for (i = 0; i < 6; i++) @@ -508,7 +508,7 @@ static void sub_8141FF8(u8 taskID) fameMons->mons[i].nick[0] = EOS; } } - sUnknown_0203931C = 0; + sHofFadePalettes = 0; gTasks[taskID].tDisplayedPoke = 0; gTasks[taskID].data[4] = 0xFF; for (i = 0; i < 6; i++) @@ -518,19 +518,19 @@ static void sub_8141FF8(u8 taskID) if (gTasks[taskID].data[0]) gTasks[taskID].func = sub_81422E8; else - gTasks[taskID].func = sub_814217C; + gTasks[taskID].func = Task_Hof_InitTeamSaveData; } -static void sub_814217C(u8 taskID) +static void Task_Hof_InitTeamSaveData(u8 taskID) { u16 i; - struct HallofFameMons* fameMons = eHallOfFameMons1; - struct HallofFameMons* lastSavedTeam = eHallOfFameMons2; + struct HallofFameMons* fameMons = eHofMonPtr; + struct HallofFameMons* lastSavedTeam = (struct HallofFameMons *)gDecompressionBuffer; - if (gUnknown_02039324 == FALSE) + if (gHasHallOfFameRecords == FALSE) { for (i = 0; i < 0x2000; i++) - ewram1E000(i) = 0; + gSharedMem[0x1E000 + i] = 0; // gDecompressionBuffer[i] = 0; } else Save_LoadGameData(SAVE_HALL_OF_FAME); @@ -542,12 +542,12 @@ static void sub_814217C(u8 taskID) } if (i >= HALL_OF_FAME_MAX_TEAMS) { - struct HallofFameMons* r5 = eHallOfFameMons2; - struct HallofFameMons* r6 = eHallOfFameMons2; - r5++; - for (i = 0; i < HALL_OF_FAME_MAX_TEAMS - 1; i++, r6++, r5++) + struct HallofFameMons *afterTeam = (struct HallofFameMons *)gDecompressionBuffer; + struct HallofFameMons *beforeTeam = (struct HallofFameMons *)gDecompressionBuffer; + afterTeam++; + for (i = 0; i < HALL_OF_FAME_MAX_TEAMS - 1; i++, beforeTeam++, afterTeam++) { - *r6 = *r5; + *beforeTeam = *afterTeam; } lastSavedTeam--; } @@ -586,7 +586,7 @@ static void sub_8142320(u8 taskID) u8 spriteID; s16 xPos, yPos, field4, field6; - struct HallofFameMons* fameMons = eHallOfFameMons1; + struct HallofFameMons* fameMons = eHofMonPtr; u16 currPokeID = gTasks[taskID].tDisplayedPoke; struct HallofFameMon* currMon = &fameMons->mons[currPokeID]; @@ -617,7 +617,7 @@ static void sub_8142320(u8 taskID) static void sub_8142404(u8 taskID) { - struct HallofFameMons* fameMons = eHallOfFameMons1; + struct HallofFameMons* fameMons = eHofMonPtr; u16 currPokeID = gTasks[taskID].tDisplayedPoke; struct HallofFameMon* currMon = &fameMons->mons[currPokeID]; @@ -633,7 +633,7 @@ static void sub_8142404(u8 taskID) static void sub_8142484(u8 taskID) { - struct HallofFameMons* fameMons = eHallOfFameMons1; + struct HallofFameMons* fameMons = eHofMonPtr; u16 currPokeID = gTasks[taskID].tDisplayedPoke; struct HallofFameMon* currMon = &fameMons->mons[currPokeID]; @@ -641,11 +641,11 @@ static void sub_8142484(u8 taskID) gTasks[taskID].tFrameCount--; else { - sUnknown_0203931C |= (0x10000 << gSprites[gTasks[taskID].tMonSpriteID(currPokeID)].oam.paletteNum); + sHofFadePalettes |= (0x10000 << gSprites[gTasks[taskID].tMonSpriteID(currPokeID)].oam.paletteNum); if (gTasks[taskID].tDisplayedPoke <= 4 && currMon[1].species != 0) // there is another pokemon to display { gTasks[taskID].tDisplayedPoke++; - BeginNormalPaletteFade(sUnknown_0203931C, 0, 12, 12, RGB(31, 26, 28)); + BeginNormalPaletteFade(sHofFadePalettes, 0, 12, 12, RGB(31, 26, 28)); gSprites[gTasks[taskID].tMonSpriteID(currPokeID)].oam.priority = 1; gTasks[taskID].func = sub_8142320; } @@ -687,7 +687,7 @@ static void sub_8142618(u8 taskID) if (gTasks[taskID].tMonSpriteID(i) != 0xFF) gSprites[gTasks[taskID].tMonSpriteID(i)].oam.priority = 1; } - BeginNormalPaletteFade(sUnknown_0203931C, 0, 12, 12, RGB(31, 26, 28)); + BeginNormalPaletteFade(sHofFadePalettes, 0, 12, 12, RGB(31, 26, 28)); Menu_EraseWindowRect(0, 14, 29, 19); gTasks[taskID].tFrameCount = 7; gTasks[taskID].func = sub_81426F8; @@ -836,7 +836,7 @@ static void sub_8142A28(u8 taskID) u16 *vram1, *vram2; u16 i; - struct HallofFameMons* savedTeams = eHallOfFameMons2; + struct HallofFameMons* savedTeams = (struct HallofFameMons *)gDecompressionBuffer; for (i = 0; i < HALL_OF_FAME_MAX_TEAMS; i++, savedTeams++) { if (savedTeams->mons[0].species == 0) @@ -861,7 +861,7 @@ static void sub_8142A28(u8 taskID) static void sub_8142B04(u8 taskID) { - struct HallofFameMons* savedTeams = eHallOfFameMons2; + struct HallofFameMons* savedTeams = (struct HallofFameMons *)gDecompressionBuffer; struct HallofFameMon* currMon; u16 i; u8* stringPtr; @@ -870,7 +870,7 @@ static void sub_8142B04(u8 taskID) savedTeams++; currMon = &savedTeams->mons[0]; - sUnknown_0203931C = 0; + sHofFadePalettes = 0; gTasks[taskID].tCurrPokeID = 0; gTasks[taskID].tPokesNo = 0; @@ -926,7 +926,7 @@ static void sub_8142B04(u8 taskID) static void sub_8142CC8(u8 taskID) { - struct HallofFameMons* savedTeams = eHallOfFameMons2; + struct HallofFameMons* savedTeams = (struct HallofFameMons *)gDecompressionBuffer; struct HallofFameMon* currMon; u16 i; u16 currMonID; @@ -943,8 +943,8 @@ static void sub_8142CC8(u8 taskID) currMonID = gTasks[taskID].tMonSpriteID(gTasks[taskID].tCurrPokeID); gSprites[currMonID].oam.priority = 0; - sUnknown_0203931C = (0x10000 << gSprites[currMonID].oam.paletteNum) ^ 0xFFFF0000; - BlendPalettesUnfaded(sUnknown_0203931C, 12, RGB(31, 26, 28)); + sHofFadePalettes = (0x10000 << gSprites[currMonID].oam.paletteNum) ^ 0xFFFF0000; + BlendPalettesUnfaded(sHofFadePalettes, 12, RGB(31, 26, 28)); currMon = &savedTeams->mons[gTasks[taskID].tCurrPokeID]; if (currMon->species != SPECIES_EGG) @@ -1224,7 +1224,7 @@ static void sub_81433E0(void) *((u16*)(VRAM + 0x3000) + i) = 2; } - DmaFill16Large(3, 0, ewram0_6, 0x4000, 0x1000); + DmaFill16Large(3, 0, gSharedMem, 0x4000, 0x1000); ResetPaletteFade(); LoadPalette(gHallOfFame_Pal, 0, 0x20); } diff --git a/src/post_battle_event_funcs.c b/src/post_battle_event_funcs.c index a30856c3f..7c8c37c9e 100644 --- a/src/post_battle_event_funcs.c +++ b/src/post_battle_event_funcs.c @@ -8,7 +8,7 @@ #include "overworld.h" #include "pokemon.h" -extern u8 gUnknown_02039324; +extern u8 gHasHallOfFameRecords; int GameClear(void) { @@ -19,11 +19,11 @@ int GameClear(void) if (FlagGet(FLAG_SYS_GAME_CLEAR) == TRUE) { - gUnknown_02039324 = 1; + gHasHallOfFameRecords = 1; } else { - gUnknown_02039324 = 0; + gHasHallOfFameRecords = 0; FlagSet(FLAG_SYS_GAME_CLEAR); } |