From 35575b57a01bbd5447fbcee3b30050d8d8c3d02e Mon Sep 17 00:00:00 2001 From: garak Date: Sat, 16 Feb 2019 23:51:06 -0500 Subject: [PATCH 1/2] use BG_CHAR_ADDR define --- src/battle_anim.c | 6 +-- src/battle_bg.c | 76 ++++++++++++++++++------------------ src/battle_gfx_sfx_util.c | 2 +- src/contest.c | 16 ++++---- src/field_effect.c | 4 +- src/intro.c | 18 ++++----- src/intro_credits_graphics.c | 8 ++-- src/title_screen.c | 4 +- 8 files changed, 67 insertions(+), 67 deletions(-) diff --git a/src/battle_anim.c b/src/battle_anim.c index f086b1c33..8a03f03b3 100644 --- a/src/battle_anim.c +++ b/src/battle_anim.c @@ -1933,12 +1933,12 @@ void MoveBattlerSpriteToBG(u8 battlerId, bool8 toBG_2, bool8 setSpriteInvisible) if (IsContest() == TRUE) { - RequestDma3Fill(0, (void*)(VRAM + 0x8000), 0x2000, 1); + RequestDma3Fill(0, (void*)(BG_CHAR_ADDR(2)), 0x2000, 1); RequestDma3Fill(0xFF, (void*)(VRAM + 0xF000), 0x1000, 0); } else { - RequestDma3Fill(0, (void*)(VRAM + 0x4000), 0x2000, 1); + RequestDma3Fill(0, (void*)(BG_CHAR_ADDR(1)), 0x2000, 1); RequestDma3Fill(0xFF, (void*)(VRAM + 0xe000), 0x1000, 0); } @@ -2460,7 +2460,7 @@ static void LoadMoveBg(u16 bgId) else { LZDecompressVram(gBattleAnimBackgroundTable[bgId].tilemap, (void *)(VRAM + 0xD000)); - LZDecompressVram(gBattleAnimBackgroundTable[bgId].image, (void *)(VRAM + 0x8000)); + LZDecompressVram(gBattleAnimBackgroundTable[bgId].image, (void *)(BG_CHAR_ADDR(2))); LoadCompressedPalette(gBattleAnimBackgroundTable[bgId].palette, 32, 32); } } diff --git a/src/battle_bg.c b/src/battle_bg.c index 61a914fc9..79618a151 100644 --- a/src/battle_bg.c +++ b/src/battle_bg.c @@ -720,25 +720,25 @@ void DrawMainBattleBackground(void) { if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_FRONTIER | BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_x2000000)) { - LZDecompressVram(gBattleTerrainTiles_Building, (void*)(VRAM + 0x8000)); + LZDecompressVram(gBattleTerrainTiles_Building, (void*)(BG_CHAR_ADDR(2))); LZDecompressVram(gBattleTerrainTilemap_Building, (void*)(VRAM + 0xD000)); LoadCompressedPalette(gBattleTerrainPalette_Frontier, 0x20, 0x60); } else if (gBattleTypeFlags & BATTLE_TYPE_GROUDON) { - LZDecompressVram(gBattleTerrainTiles_Cave, (void*)(VRAM + 0x8000)); + LZDecompressVram(gBattleTerrainTiles_Cave, (void*)(BG_CHAR_ADDR(2))); LZDecompressVram(gBattleTerrainTilemap_Cave, (void*)(VRAM + 0xD000)); LoadCompressedPalette(gBattleTerrainPalette_Groudon, 0x20, 0x60); } else if (gBattleTypeFlags & BATTLE_TYPE_KYOGRE) { - LZDecompressVram(gBattleTerrainTiles_Water, (void*)(VRAM + 0x8000)); + LZDecompressVram(gBattleTerrainTiles_Water, (void*)(BG_CHAR_ADDR(2))); LZDecompressVram(gBattleTerrainTilemap_Water, (void*)(VRAM + 0xD000)); LoadCompressedPalette(gBattleTerrainPalette_Kyogre, 0x20, 0x60); } else if (gBattleTypeFlags & BATTLE_TYPE_RAYQUAZA) { - LZDecompressVram(gBattleTerrainTiles_Rayquaza, (void*)(VRAM + 0x8000)); + LZDecompressVram(gBattleTerrainTiles_Rayquaza, (void*)(BG_CHAR_ADDR(2))); LZDecompressVram(gBattleTerrainTilemap_Rayquaza, (void*)(VRAM + 0xD000)); LoadCompressedPalette(gBattleTerrainPalette_Rayquaza, 0x20, 0x60); } @@ -749,14 +749,14 @@ void DrawMainBattleBackground(void) u8 trainerClass = gTrainers[gTrainerBattleOpponent_A].trainerClass; if (trainerClass == TRAINER_CLASS_LEADER) { - LZDecompressVram(gBattleTerrainTiles_Building, (void*)(VRAM + 0x8000)); + LZDecompressVram(gBattleTerrainTiles_Building, (void*)(BG_CHAR_ADDR(2))); LZDecompressVram(gBattleTerrainTilemap_Building, (void*)(VRAM + 0xD000)); LoadCompressedPalette(gBattleTerrainPalette_BuildingLeader, 0x20, 0x60); return; } else if (trainerClass == TRAINER_CLASS_CHAMPION) { - LZDecompressVram(gBattleTerrainTiles_Stadium, (void*)(VRAM + 0x8000)); + LZDecompressVram(gBattleTerrainTiles_Stadium, (void*)(BG_CHAR_ADDR(2))); LZDecompressVram(gBattleTerrainTilemap_Stadium, (void*)(VRAM + 0xD000)); LoadCompressedPalette(gBattleTerrainPalette_StadiumWallace, 0x20, 0x60); return; @@ -767,47 +767,47 @@ void DrawMainBattleBackground(void) { default: case MAP_BATTLE_SCENE_NORMAL: - LZDecompressVram(gBattleTerrainTable[gBattleTerrain].tileset, (void*)(VRAM + 0x8000)); + LZDecompressVram(gBattleTerrainTable[gBattleTerrain].tileset, (void*)(BG_CHAR_ADDR(2))); LZDecompressVram(gBattleTerrainTable[gBattleTerrain].tilemap, (void*)(VRAM + 0xD000)); LoadCompressedPalette(gBattleTerrainTable[gBattleTerrain].palette, 0x20, 0x60); break; case MAP_BATTLE_SCENE_GYM: - LZDecompressVram(gBattleTerrainTiles_Building, (void*)(VRAM + 0x8000)); + LZDecompressVram(gBattleTerrainTiles_Building, (void*)(BG_CHAR_ADDR(2))); LZDecompressVram(gBattleTerrainTilemap_Building, (void*)(VRAM + 0xD000)); LoadCompressedPalette(gBattleTerrainPalette_BuildingGym, 0x20, 0x60); break; case MAP_BATTLE_SCENE_MAGMA: - LZDecompressVram(gBattleTerrainTiles_Stadium, (void*)(VRAM + 0x8000)); + LZDecompressVram(gBattleTerrainTiles_Stadium, (void*)(BG_CHAR_ADDR(2))); LZDecompressVram(gBattleTerrainTilemap_Stadium, (void*)(VRAM + 0xD000)); LoadCompressedPalette(gBattleTerrainPalette_StadiumMagma, 0x20, 0x60); break; case MAP_BATTLE_SCENE_AQUA: - LZDecompressVram(gBattleTerrainTiles_Stadium, (void*)(VRAM + 0x8000)); + LZDecompressVram(gBattleTerrainTiles_Stadium, (void*)(BG_CHAR_ADDR(2))); LZDecompressVram(gBattleTerrainTilemap_Stadium, (void*)(VRAM + 0xD000)); LoadCompressedPalette(gBattleTerrainPalette_StadiumAqua, 0x20, 0x60); break; case MAP_BATTLE_SCENE_SIDNEY: - LZDecompressVram(gBattleTerrainTiles_Stadium, (void*)(VRAM + 0x8000)); + LZDecompressVram(gBattleTerrainTiles_Stadium, (void*)(BG_CHAR_ADDR(2))); LZDecompressVram(gBattleTerrainTilemap_Stadium, (void*)(VRAM + 0xD000)); LoadCompressedPalette(gBattleTerrainPalette_StadiumSidney, 0x20, 0x60); break; case MAP_BATTLE_SCENE_PHOEBE: - LZDecompressVram(gBattleTerrainTiles_Stadium, (void*)(VRAM + 0x8000)); + LZDecompressVram(gBattleTerrainTiles_Stadium, (void*)(BG_CHAR_ADDR(2))); LZDecompressVram(gBattleTerrainTilemap_Stadium, (void*)(VRAM + 0xD000)); LoadCompressedPalette(gBattleTerrainPalette_StadiumPhoebe, 0x20, 0x60); break; case MAP_BATTLE_SCENE_GLACIA: - LZDecompressVram(gBattleTerrainTiles_Stadium, (void*)(VRAM + 0x8000)); + LZDecompressVram(gBattleTerrainTiles_Stadium, (void*)(BG_CHAR_ADDR(2))); LZDecompressVram(gBattleTerrainTilemap_Stadium, (void*)(VRAM + 0xD000)); LoadCompressedPalette(gBattleTerrainPalette_StadiumGlacia, 0x20, 0x60); break; case MAP_BATTLE_SCENE_DRAKE: - LZDecompressVram(gBattleTerrainTiles_Stadium, (void*)(VRAM + 0x8000)); + LZDecompressVram(gBattleTerrainTiles_Stadium, (void*)(BG_CHAR_ADDR(2))); LZDecompressVram(gBattleTerrainTilemap_Stadium, (void*)(VRAM + 0xD000)); LoadCompressedPalette(gBattleTerrainPalette_StadiumDrake, 0x20, 0x60); break; case MAP_BATTLE_SCENE_FRONTIER: - LZDecompressVram(gBattleTerrainTiles_Building, (void*)(VRAM + 0x8000)); + LZDecompressVram(gBattleTerrainTiles_Building, (void*)(BG_CHAR_ADDR(2))); LZDecompressVram(gBattleTerrainTilemap_Building, (void*)(VRAM + 0xD000)); LoadCompressedPalette(gBattleTerrainPalette_Frontier, 0x20, 0x60); break; @@ -1089,8 +1089,8 @@ void DrawBattleEntryBackground(void) { if (gBattleTypeFlags & BATTLE_TYPE_LINK) { - LZDecompressVram(gUnknown_08D778F0, (void*)(VRAM + 0x4000)); - LZDecompressVram(gUnknown_08D77B0C, (void*)(VRAM + 0x10000)); + LZDecompressVram(gUnknown_08D778F0, (void*)(BG_CHAR_ADDR(1))); + LZDecompressVram(gUnknown_08D77B0C, (void*)(BG_SCREEN_ADDR(2)0)); LoadCompressedPalette(gUnknown_08D77AE4, 0x60, 0x20); SetBgAttribute(1, BG_ATTR_SCREENSIZE, 1); SetGpuReg(REG_OFFSET_BG1CNT, 0x5C04); @@ -1108,7 +1108,7 @@ void DrawBattleEntryBackground(void) { if (!(gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER) || gPartnerTrainerId == TRAINER_STEVEN_PARTNER) { - LZDecompressVram(gBattleTerrainAnimTiles_Building, (void*)(VRAM + 0x4000)); + LZDecompressVram(gBattleTerrainAnimTiles_Building, (void*)(BG_CHAR_ADDR(1))); LZDecompressVram(gBattleTerrainAnimTilemap_Building, (void*)(VRAM + 0xE000)); } else @@ -1123,17 +1123,17 @@ void DrawBattleEntryBackground(void) } else if (gBattleTypeFlags & BATTLE_TYPE_GROUDON) { - LZDecompressVram(gBattleTerrainAnimTiles_Cave, (void*)(VRAM + 0x4000)); + LZDecompressVram(gBattleTerrainAnimTiles_Cave, (void*)(BG_CHAR_ADDR(1))); LZDecompressVram(gBattleTerrainAnimTilemap_Cave, (void*)(VRAM + 0xE000)); } else if (gBattleTypeFlags & BATTLE_TYPE_KYOGRE) { - LZDecompressVram(gBattleTerrainAnimTiles_Underwater, (void*)(VRAM + 0x4000)); + LZDecompressVram(gBattleTerrainAnimTiles_Underwater, (void*)(BG_CHAR_ADDR(1))); LZDecompressVram(gBattleTerrainAnimTilemap_Underwater, (void*)(VRAM + 0xE000)); } else if (gBattleTypeFlags & BATTLE_TYPE_RAYQUAZA) { - LZDecompressVram(gBattleTerrainAnimTiles_Rayquaza, (void*)(VRAM + 0x4000)); + LZDecompressVram(gBattleTerrainAnimTiles_Rayquaza, (void*)(BG_CHAR_ADDR(1))); LZDecompressVram(gBattleTerrainAnimTilemap_Rayquaza, (void*)(VRAM + 0xE000)); } else @@ -1143,13 +1143,13 @@ void DrawBattleEntryBackground(void) u8 trainerClass = gTrainers[gTrainerBattleOpponent_A].trainerClass; if (trainerClass == TRAINER_CLASS_LEADER) { - LZDecompressVram(gBattleTerrainAnimTiles_Building, (void*)(VRAM + 0x4000)); + LZDecompressVram(gBattleTerrainAnimTiles_Building, (void*)(BG_CHAR_ADDR(1))); LZDecompressVram(gBattleTerrainAnimTilemap_Building, (void*)(VRAM + 0xE000)); return; } else if (trainerClass == TRAINER_CLASS_CHAMPION) { - LZDecompressVram(gBattleTerrainAnimTiles_Building, (void*)(VRAM + 0x4000)); + LZDecompressVram(gBattleTerrainAnimTiles_Building, (void*)(BG_CHAR_ADDR(1))); LZDecompressVram(gBattleTerrainAnimTilemap_Building, (void*)(VRAM + 0xE000)); return; } @@ -1157,12 +1157,12 @@ void DrawBattleEntryBackground(void) if (GetCurrentMapBattleScene() == MAP_BATTLE_SCENE_NORMAL) { - LZDecompressVram(gBattleTerrainTable[gBattleTerrain].entryTileset, (void*)(VRAM + 0x4000)); + LZDecompressVram(gBattleTerrainTable[gBattleTerrain].entryTileset, (void*)(BG_CHAR_ADDR(1))); LZDecompressVram(gBattleTerrainTable[gBattleTerrain].entryTilemap, (void*)(VRAM + 0xE000)); } else { - LZDecompressVram(gBattleTerrainAnimTiles_Building, (void*)(VRAM + 0x4000)); + LZDecompressVram(gBattleTerrainAnimTiles_Building, (void*)(BG_CHAR_ADDR(1))); LZDecompressVram(gBattleTerrainAnimTilemap_Building, (void*)(VRAM + 0xE000)); } } @@ -1187,11 +1187,11 @@ bool8 LoadChosenBattleElement(u8 caseId) case 3: if (gBattleTypeFlags & (BATTLE_TYPE_FRONTIER | BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000 | BATTLE_TYPE_EREADER_TRAINER)) { - LZDecompressVram(gBattleTerrainTiles_Building, (void*)(VRAM + 0x8000)); + LZDecompressVram(gBattleTerrainTiles_Building, (void*)(BG_CHAR_ADDR(2))); } else if (gBattleTypeFlags & BATTLE_TYPE_GROUDON) { - LZDecompressVram(gBattleTerrainTiles_Cave, (void*)(VRAM + 0x8000)); + LZDecompressVram(gBattleTerrainTiles_Cave, (void*)(BG_CHAR_ADDR(2))); } else { @@ -1200,12 +1200,12 @@ bool8 LoadChosenBattleElement(u8 caseId) u8 trainerClass = gTrainers[gTrainerBattleOpponent_A].trainerClass; if (trainerClass == TRAINER_CLASS_LEADER) { - LZDecompressVram(gBattleTerrainTiles_Building, (void*)(VRAM + 0x8000)); + LZDecompressVram(gBattleTerrainTiles_Building, (void*)(BG_CHAR_ADDR(2))); break; } else if (trainerClass == TRAINER_CLASS_CHAMPION) { - LZDecompressVram(gBattleTerrainTiles_Stadium, (void*)(VRAM + 0x8000)); + LZDecompressVram(gBattleTerrainTiles_Stadium, (void*)(BG_CHAR_ADDR(2))); break; } } @@ -1214,31 +1214,31 @@ bool8 LoadChosenBattleElement(u8 caseId) { default: case MAP_BATTLE_SCENE_NORMAL: - LZDecompressVram(gBattleTerrainTable[gBattleTerrain].tileset, (void*)(VRAM + 0x8000)); + LZDecompressVram(gBattleTerrainTable[gBattleTerrain].tileset, (void*)(BG_CHAR_ADDR(2))); break; case MAP_BATTLE_SCENE_GYM: - LZDecompressVram(gBattleTerrainTiles_Building, (void*)(VRAM + 0x8000)); + LZDecompressVram(gBattleTerrainTiles_Building, (void*)(BG_CHAR_ADDR(2))); break; case MAP_BATTLE_SCENE_MAGMA: - LZDecompressVram(gBattleTerrainTiles_Stadium, (void*)(VRAM + 0x8000)); + LZDecompressVram(gBattleTerrainTiles_Stadium, (void*)(BG_CHAR_ADDR(2))); break; case MAP_BATTLE_SCENE_AQUA: - LZDecompressVram(gBattleTerrainTiles_Stadium, (void*)(VRAM + 0x8000)); + LZDecompressVram(gBattleTerrainTiles_Stadium, (void*)(BG_CHAR_ADDR(2))); break; case MAP_BATTLE_SCENE_SIDNEY: - LZDecompressVram(gBattleTerrainTiles_Stadium, (void*)(VRAM + 0x8000)); + LZDecompressVram(gBattleTerrainTiles_Stadium, (void*)(BG_CHAR_ADDR(2))); break; case MAP_BATTLE_SCENE_PHOEBE: - LZDecompressVram(gBattleTerrainTiles_Stadium, (void*)(VRAM + 0x8000)); + LZDecompressVram(gBattleTerrainTiles_Stadium, (void*)(BG_CHAR_ADDR(2))); break; case MAP_BATTLE_SCENE_GLACIA: - LZDecompressVram(gBattleTerrainTiles_Stadium, (void*)(VRAM + 0x8000)); + LZDecompressVram(gBattleTerrainTiles_Stadium, (void*)(BG_CHAR_ADDR(2))); break; case MAP_BATTLE_SCENE_DRAKE: - LZDecompressVram(gBattleTerrainTiles_Stadium, (void*)(VRAM + 0x8000)); + LZDecompressVram(gBattleTerrainTiles_Stadium, (void*)(BG_CHAR_ADDR(2))); break; case MAP_BATTLE_SCENE_FRONTIER: - LZDecompressVram(gBattleTerrainTiles_Building, (void*)(VRAM + 0x8000)); + LZDecompressVram(gBattleTerrainTiles_Building, (void*)(BG_CHAR_ADDR(2))); break; } } diff --git a/src/battle_gfx_sfx_util.c b/src/battle_gfx_sfx_util.c index 7c6b74304..668bbf663 100644 --- a/src/battle_gfx_sfx_util.c +++ b/src/battle_gfx_sfx_util.c @@ -923,7 +923,7 @@ void HandleSpeciesGfxDataChange(u8 battlerAtk, u8 battlerDef, bool8 notTransform } src = gMonSpritesGfxPtr->sprites[position]; - dst = (void *)(VRAM + 0x10000 + gSprites[gBattlerSpriteIds[battlerAtk]].oam.tileNum * 32); + dst = (void *)(BG_SCREEN_ADDR(2)0 + gSprites[gBattlerSpriteIds[battlerAtk]].oam.tileNum * 32); DmaCopy32(3, src, dst, 0x800); paletteOffset = 0x100 + battlerAtk * 16; lzPaletteData = GetFrontSpritePalFromSpeciesAndPersonality(targetSpecies, otId, personalityValue); diff --git a/src/contest.c b/src/contest.c index cf084e35e..5fb3f4dd5 100644 --- a/src/contest.c +++ b/src/contest.c @@ -589,8 +589,8 @@ static u8 sub_80D7E44(u8 *a) case 0: gPaletteFade.bufferTransferDisabled = TRUE; RequestDma3Fill(0, (void *)VRAM, 0x8000, 1); - RequestDma3Fill(0, (void *)VRAM + 0x8000, 0x8000, 1); - RequestDma3Fill(0, (void *)VRAM + 0x10000, 0x8000, 1); + RequestDma3Fill(0, (void *)BG_CHAR_ADDR(2), 0x8000, 1); + RequestDma3Fill(0, (void *)BG_SCREEN_ADDR(2)0, 0x8000, 1); break; case 1: LZDecompressVram(gContestMiscGfx, (void *)VRAM); @@ -3340,12 +3340,12 @@ static u8 sub_80DC9EC(u8 a) CpuFill32(0, gContestResources->field_38 + 0x500, 0x300); RequestDma3Copy(gContestResources->field_34, - (u8 *)(VRAM + 0x10000 + gSprites[spriteId1].oam.tileNum * 32), + (u8 *)(BG_SCREEN_ADDR(2)0 + gSprites[spriteId1].oam.tileNum * 32), 0x800, 1); RequestDma3Copy(gContestResources->field_38, - (u8 *)(VRAM + 0x10000 + gSprites[spriteId2].oam.tileNum * 32), + (u8 *)(BG_SCREEN_ADDR(2)0 + gSprites[spriteId2].oam.tileNum * 32), 0x800, 1); @@ -3870,8 +3870,8 @@ static void sub_80DD940(void) src = gContestApplauseMeterGfx + 64; else src = gContestApplauseMeterGfx; - CpuCopy32(src, (void *)(VRAM + 0x10000 + (gSprites[sContest.applauseMeterSpriteId].oam.tileNum + 17 + i) * 32), 32); - CpuCopy32(src + 32, (void *)(VRAM + 0x10000 + (gSprites[sContest.applauseMeterSpriteId].oam.tileNum + 25 + i) * 32), 32); + CpuCopy32(src, (void *)(BG_SCREEN_ADDR(2)0 + (gSprites[sContest.applauseMeterSpriteId].oam.tileNum + 17 + i) * 32), 32); + CpuCopy32(src + 32, (void *)(BG_SCREEN_ADDR(2)0 + (gSprites[sContest.applauseMeterSpriteId].oam.tileNum + 25 + i) * 32), 32); if (sContest.applauseLevel > 4) sub_80DDA20(); @@ -4120,7 +4120,7 @@ static void sub_80DE008(bool8 a) { if (sContestantStatus[i].turnOrderMod != 0 && a) { - CpuCopy32(GetTurnOrderNumberGfx(i), (void *)(VRAM + 0x10000 + (gSprites[gContestResources->field_14[i].unk1].oam.tileNum + 6) * 32), 32); + CpuCopy32(GetTurnOrderNumberGfx(i), (void *)(BG_SCREEN_ADDR(2)0 + (gSprites[gContestResources->field_14[i].unk1].oam.tileNum + 6) * 32), 32); gSprites[gContestResources->field_14[i].unk1].pos1.y = gUnknown_08587A70[gUnknown_02039F26[i]]; gSprites[gContestResources->field_14[i].unk1].invisible = FALSE; } @@ -4212,7 +4212,7 @@ static void sub_80DE350(void) s32 i; u16 bg1Cnt; - RequestDma3Fill(0,(void *)(VRAM + 0x8000), 0x2000, 0x1); + RequestDma3Fill(0,(void *)(BG_CHAR_ADDR(2)), 0x2000, 0x1); CpuFill32(0, gContestResources->field_24[1], 0x1000); Contest_SetBgCopyFlags(1); bg1Cnt = GetGpuReg(REG_OFFSET_BG1CNT); diff --git a/src/field_effect.c b/src/field_effect.c index badf57b16..69c6a1b7d 100644 --- a/src/field_effect.c +++ b/src/field_effect.c @@ -2960,8 +2960,8 @@ u8 sub_80B8F98(void) { for (i = 0; i < 8; i++) { - *(u16*)(VRAM + 0x8000 + (k + 1) * 32 + i * 4) = (gUnknown_0855B630[k * 32 + i * 4 + 1] << 8) + gUnknown_0855B630[k * 32 + i * 4]; - *(u16*)(VRAM + 0x8000 + (k + 1) * 32 + i * 4 + 2) = (gUnknown_0855B630[k * 32 + i * 4 + 3] << 8) + gUnknown_0855B630[k * 32 + i * 4 + 2]; + *(u16*)(BG_CHAR_ADDR(2) + (k + 1) * 32 + i * 4) = (gUnknown_0855B630[k * 32 + i * 4 + 1] << 8) + gUnknown_0855B630[k * 32 + i * 4]; + *(u16*)(BG_CHAR_ADDR(2) + (k + 1) * 32 + i * 4 + 2) = (gUnknown_0855B630[k * 32 + i * 4 + 3] << 8) + gUnknown_0855B630[k * 32 + i * 4 + 2]; } } return spriteId; diff --git a/src/intro.c b/src/intro.c index 4f76faf87..13ceced75 100644 --- a/src/intro.c +++ b/src/intro.c @@ -1092,7 +1092,7 @@ static void Task_IntroLoadPart1Graphics(u8 taskId) SetGpuReg(REG_OFFSET_BG1VOFS, 0x18); SetGpuReg(REG_OFFSET_BG0VOFS, 0x28); LZ77UnCompVram(gIntro1BGLeavesGfx, (void *)VRAM); - LZ77UnCompVram(gIntro1BG0_Tilemap, (void *)(VRAM + 0x8000)); + LZ77UnCompVram(gIntro1BG0_Tilemap, (void *)(BG_CHAR_ADDR(2))); DmaClear16(3, VRAM + 0x8800, 0x800); LZ77UnCompVram(gIntro1BG1_Tilemap, (void *)(VRAM + 0x9000)); DmaClear16(3, VRAM + 0x9800, 0x800); @@ -1549,7 +1549,7 @@ static void Task_IntroLoadPart3Graphics(u8 taskId) { intro_reset_and_hide_bgs(); LZ77UnCompVram(gIntro3Pokeball_Gfx, (void *)VRAM); - LZ77UnCompVram(gIntro3Pokeball_Tilemap, (void *)(VRAM + 0x4000)); + LZ77UnCompVram(gIntro3Pokeball_Tilemap, (void *)(BG_CHAR_ADDR(1))); LoadPalette(gIntro3PokeballPal, 0, 0x200); gTasks[taskId].data[0] = 0; gTasks[taskId].data[1] = 0; @@ -1601,8 +1601,8 @@ static void Task_IntroLoadGroudonScene(u8 taskId) FreeAllSpritePalettes(); gReservedSpritePaletteCount = 8; LZDecompressVram(gIntro3GroudonGfx, (void *)VRAM); - LZDecompressVram(gIntro3GroudonTilemap, (void *)(VRAM + 0xC000)); - LZDecompressVram(gIntro3LegendBgGfx, (void *)(VRAM + 0x4000)); + LZDecompressVram(gIntro3GroudonTilemap, (void *)(BG_CHAR_ADDR(3))); + LZDecompressVram(gIntro3LegendBgGfx, (void *)(BG_CHAR_ADDR(1))); LZDecompressVram(gIntro3GroudonBgTilemap, (void *)(VRAM + 0xE000)); LoadCompressedSpriteSheetUsingHeap(&gBattleAnimPicTable[GET_TRUE_SPRITE_INDEX(ANIM_TAG_ROCKS)]); LoadCompressedSpritePaletteUsingHeap(&gBattleAnimPaletteTable[GET_TRUE_SPRITE_INDEX(ANIM_TAG_ROCKS)]); @@ -1824,7 +1824,7 @@ static void Task_IntroLoadKyogreScene(u8 taskId) { ResetSpriteData(); LZDecompressVram(gIntro3KyogreGfx, (void *)VRAM); - LZDecompressVram(gIntro3KyogreTilemap, (void *)(VRAM + 0xC000)); + LZDecompressVram(gIntro3KyogreTilemap, (void *)(BG_CHAR_ADDR(3))); LZDecompressVram(gIntro3KyogreBgTilemap, (void *)(VRAM + 0xE000)); LoadCompressedSpriteSheet(gUnknown_085E4C88); LoadSpritePalette(gUnknown_085E4C98); @@ -2087,14 +2087,14 @@ static void Task_IntroLoadClouds1(u8 taskId) SetGpuReg(REG_OFFSET_BG2HOFS, 0); SetGpuReg(REG_OFFSET_BG2VOFS, 0); LZDecompressVram(gIntro3CloudsGfx, (void *)VRAM); - LZDecompressVram(gIntro3CloudsGfx, (void *)(VRAM + 0x4000)); + LZDecompressVram(gIntro3CloudsGfx, (void *)(BG_CHAR_ADDR(1))); LZDecompressVram(gIntro3Clouds3Tilemap, (void *)(VRAM + 0xE000)); gTasks[taskId].func = Task_IntroLoadClouds2; } static void Task_IntroLoadClouds2(u8 taskId) { - LZDecompressVram(gIntro3Clouds1Tilemap, (void *)(VRAM + 0xC000)); + LZDecompressVram(gIntro3Clouds1Tilemap, (void *)(BG_CHAR_ADDR(3))); LZDecompressVram(gIntro3Clouds2Tilemap, (void *)(VRAM + 0xD000)); gTasks[taskId].func = Task_IntroLoadClouds3; } @@ -2141,8 +2141,8 @@ static void Task_IntroCloudScene(u8 taskId) static void Task_IntroLoadRayquazaLightningScene(u8 taskId) { LZDecompressVram(gIntro3RayquazaTilemap, (void *)(VRAM + 0xE000)); - LZDecompressVram(gIntro3Clouds4Tilemap, (void *)(VRAM + 0xC000)); - LZDecompressVram(gIntro3RayquazaGfx, (void *)(VRAM + 0x4000)); + LZDecompressVram(gIntro3Clouds4Tilemap, (void *)(BG_CHAR_ADDR(3))); + LZDecompressVram(gIntro3RayquazaGfx, (void *)(BG_CHAR_ADDR(1))); LZDecompressVram(gIntro3Clouds2Gfx, (void *)VRAM); SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0 | DISPCNT_OBJ_1D_MAP diff --git a/src/intro_credits_graphics.c b/src/intro_credits_graphics.c index ba1f56158..4489b64c3 100644 --- a/src/intro_credits_graphics.c +++ b/src/intro_credits_graphics.c @@ -331,7 +331,7 @@ static void sub_817B458(u8); void load_intro_part2_graphics(u8 a) { - LZ77UnCompVram(gUnknown_085F0740, (void *)(VRAM + 0x4000)); + LZ77UnCompVram(gUnknown_085F0740, (void *)(BG_CHAR_ADDR(1))); LZ77UnCompVram(gUnknown_085F0BC0, (void *)(VRAM + 0x7800)); LoadPalette(&gUnknown_085F06E0, 240, 32); switch (a) @@ -438,7 +438,7 @@ void sub_817B150(u8 a) void sub_817B1C8(u8 a) { - LZ77UnCompVram(gUnknown_085F0740, (void *)(VRAM + 0x4000)); + LZ77UnCompVram(gUnknown_085F0740, (void *)(BG_CHAR_ADDR(1))); LZ77UnCompVram(gUnknown_085F0BC0, (void *)(VRAM + 0x7800)); switch (a) { @@ -449,7 +449,7 @@ void sub_817B1C8(u8 a) LZ77UnCompVram(gUnknown_085F1398, (void *)(VRAM + 0x3000)); LoadPalette(&gUnknown_085F0CFC, 0, 96); LoadCompressedSpriteSheet(gUnknown_085F5064); - LZ77UnCompVram(gUnknown_085F16A8, (void *)(VRAM + 0x10000)); + LZ77UnCompVram(gUnknown_085F16A8, (void *)(BG_SCREEN_ADDR(2)0)); LoadPalette(&gUnknown_085F1668, 256, 32); sub_817B76C(); break; @@ -459,7 +459,7 @@ void sub_817B1C8(u8 a) LZ77UnCompVram(gUnknown_085F1398, (void *)(VRAM + 0x3000)); LoadPalette(&gUnknown_085F0D5C, 0, 96); LoadCompressedSpriteSheet(gUnknown_085F5064); - LZ77UnCompVram(gUnknown_085F16A8, (void *)(VRAM + 0x10000)); + LZ77UnCompVram(gUnknown_085F16A8, (void *)(BG_SCREEN_ADDR(2)0)); LoadPalette(&gUnknown_085F1688, 256, 32); sub_817B76C(); break; diff --git a/src/title_screen.c b/src/title_screen.c index 06bb066bb..6e3ba45cf 100644 --- a/src/title_screen.c +++ b/src/title_screen.c @@ -509,9 +509,9 @@ void CB2_InitTitleScreen(void) LZ77UnCompVram(gTitleScreenPokemonLogoGfx, (void *)VRAM); LZ77UnCompVram(gUnknown_08DE0644, (void *)(VRAM + 0x4800)); LoadPalette(gTitleScreenBgPalettes, 0, 0x1E0); - LZ77UnCompVram(sTitleScreenRayquazaGfx, (void *)(VRAM + 0x8000)); + LZ77UnCompVram(sTitleScreenRayquazaGfx, (void *)(BG_CHAR_ADDR(2))); LZ77UnCompVram(sTitleScreenRayquazaTilemap, (void *)(VRAM + 0xD000)); - LZ77UnCompVram(sTitleScreenCloudsGfx, (void *)(VRAM + 0xC000)); + LZ77UnCompVram(sTitleScreenCloudsGfx, (void *)(BG_CHAR_ADDR(3))); LZ77UnCompVram(gUnknown_08DDE458, (void *)(VRAM + 0xD800)); ScanlineEffect_Stop(); ResetTasks(); From 22657c708753df14e84d4bdae4afac0072803447 Mon Sep 17 00:00:00 2001 From: garak Date: Sun, 17 Feb 2019 00:25:48 -0500 Subject: [PATCH 2/2] use BG_SCREEN_ADDR macro for tilemap addresses --- src/battle_anim.c | 18 ++++----- src/battle_bg.c | 76 ++++++++++++++++++------------------ src/battle_gfx_sfx_util.c | 2 +- src/berry_blender.c | 2 +- src/clear_save_data_screen.c | 2 +- src/contest.c | 28 ++++++------- src/contest_painting.c | 14 +++---- src/credits.c | 2 +- src/field_effect.c | 2 +- src/field_effect_helpers.c | 4 +- src/intro.c | 24 ++++++------ src/intro_credits_graphics.c | 20 +++++----- src/main_menu.c | 4 +- src/pokemon_storage_system.c | 2 +- src/save_failed_screen.c | 4 +- src/starter_choose.c | 4 +- src/title_screen.c | 6 +-- 17 files changed, 107 insertions(+), 107 deletions(-) diff --git a/src/battle_anim.c b/src/battle_anim.c index 8a03f03b3..f1cff1de2 100644 --- a/src/battle_anim.c +++ b/src/battle_anim.c @@ -1933,13 +1933,13 @@ void MoveBattlerSpriteToBG(u8 battlerId, bool8 toBG_2, bool8 setSpriteInvisible) if (IsContest() == TRUE) { - RequestDma3Fill(0, (void*)(BG_CHAR_ADDR(2)), 0x2000, 1); - RequestDma3Fill(0xFF, (void*)(VRAM + 0xF000), 0x1000, 0); + RequestDma3Fill(0, (void*)(BG_SCREEN_ADDR(16)), 0x2000, 1); + RequestDma3Fill(0xFF, (void*)(BG_SCREEN_ADDR(30)), 0x1000, 0); } else { - RequestDma3Fill(0, (void*)(BG_CHAR_ADDR(1)), 0x2000, 1); - RequestDma3Fill(0xFF, (void*)(VRAM + 0xe000), 0x1000, 0); + RequestDma3Fill(0, (void*)(BG_SCREEN_ADDR(8)), 0x2000, 1); + RequestDma3Fill(0xFF, (void*)(BG_SCREEN_ADDR(28)), 0x1000, 0); } sub_80A6B30(&animBg); @@ -1978,8 +1978,8 @@ void MoveBattlerSpriteToBG(u8 battlerId, bool8 toBG_2, bool8 setSpriteInvisible) } else { - RequestDma3Fill(0, (void*)(VRAM + 0x6000), 0x2000, 1); - RequestDma3Fill(0, (void*)(VRAM + 0xF000), 0x1000, 1); + RequestDma3Fill(0, (void*)(BG_SCREEN_ADDR(12)), 0x2000, 1); + RequestDma3Fill(0, (void*)(BG_SCREEN_ADDR(30)), 0x1000, 1); sub_80A6B90(&animBg, 2); CpuFill16(0, animBg.bgTiles + 0x1000, 0x1000); CpuFill16(0, animBg.bgTilemap + 0x400, 0x800); @@ -2452,14 +2452,14 @@ static void LoadMoveBg(u16 bgId) LZDecompressWram(tilemap, gDecompressionBuffer); sub_80A4720(sub_80A6D94(), (void*)(gDecompressionBuffer), 0x100, 0); dmaSrc = gDecompressionBuffer; - dmaDest = (void *)(VRAM + 0xD000); + dmaDest = (void *)(BG_SCREEN_ADDR(26)); DmaCopy32(3, dmaSrc, dmaDest, 0x800); - LZDecompressVram(gBattleAnimBackgroundTable[bgId].image, (void *)(VRAM + 0x2000)); + LZDecompressVram(gBattleAnimBackgroundTable[bgId].image, (void *)(BG_SCREEN_ADDR(4))); LoadCompressedPalette(gBattleAnimBackgroundTable[bgId].palette, sub_80A6D94() * 16, 32); } else { - LZDecompressVram(gBattleAnimBackgroundTable[bgId].tilemap, (void *)(VRAM + 0xD000)); + LZDecompressVram(gBattleAnimBackgroundTable[bgId].tilemap, (void *)(BG_SCREEN_ADDR(26))); LZDecompressVram(gBattleAnimBackgroundTable[bgId].image, (void *)(BG_CHAR_ADDR(2))); LoadCompressedPalette(gBattleAnimBackgroundTable[bgId].palette, 32, 32); } diff --git a/src/battle_bg.c b/src/battle_bg.c index 79618a151..9ca0f8b84 100644 --- a/src/battle_bg.c +++ b/src/battle_bg.c @@ -721,25 +721,25 @@ void DrawMainBattleBackground(void) if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_FRONTIER | BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_x2000000)) { LZDecompressVram(gBattleTerrainTiles_Building, (void*)(BG_CHAR_ADDR(2))); - LZDecompressVram(gBattleTerrainTilemap_Building, (void*)(VRAM + 0xD000)); + LZDecompressVram(gBattleTerrainTilemap_Building, (void*)(BG_SCREEN_ADDR(26))); LoadCompressedPalette(gBattleTerrainPalette_Frontier, 0x20, 0x60); } else if (gBattleTypeFlags & BATTLE_TYPE_GROUDON) { LZDecompressVram(gBattleTerrainTiles_Cave, (void*)(BG_CHAR_ADDR(2))); - LZDecompressVram(gBattleTerrainTilemap_Cave, (void*)(VRAM + 0xD000)); + LZDecompressVram(gBattleTerrainTilemap_Cave, (void*)(BG_SCREEN_ADDR(26))); LoadCompressedPalette(gBattleTerrainPalette_Groudon, 0x20, 0x60); } else if (gBattleTypeFlags & BATTLE_TYPE_KYOGRE) { LZDecompressVram(gBattleTerrainTiles_Water, (void*)(BG_CHAR_ADDR(2))); - LZDecompressVram(gBattleTerrainTilemap_Water, (void*)(VRAM + 0xD000)); + LZDecompressVram(gBattleTerrainTilemap_Water, (void*)(BG_SCREEN_ADDR(26))); LoadCompressedPalette(gBattleTerrainPalette_Kyogre, 0x20, 0x60); } else if (gBattleTypeFlags & BATTLE_TYPE_RAYQUAZA) { LZDecompressVram(gBattleTerrainTiles_Rayquaza, (void*)(BG_CHAR_ADDR(2))); - LZDecompressVram(gBattleTerrainTilemap_Rayquaza, (void*)(VRAM + 0xD000)); + LZDecompressVram(gBattleTerrainTilemap_Rayquaza, (void*)(BG_SCREEN_ADDR(26))); LoadCompressedPalette(gBattleTerrainPalette_Rayquaza, 0x20, 0x60); } else @@ -750,14 +750,14 @@ void DrawMainBattleBackground(void) if (trainerClass == TRAINER_CLASS_LEADER) { LZDecompressVram(gBattleTerrainTiles_Building, (void*)(BG_CHAR_ADDR(2))); - LZDecompressVram(gBattleTerrainTilemap_Building, (void*)(VRAM + 0xD000)); + LZDecompressVram(gBattleTerrainTilemap_Building, (void*)(BG_SCREEN_ADDR(26))); LoadCompressedPalette(gBattleTerrainPalette_BuildingLeader, 0x20, 0x60); return; } else if (trainerClass == TRAINER_CLASS_CHAMPION) { LZDecompressVram(gBattleTerrainTiles_Stadium, (void*)(BG_CHAR_ADDR(2))); - LZDecompressVram(gBattleTerrainTilemap_Stadium, (void*)(VRAM + 0xD000)); + LZDecompressVram(gBattleTerrainTilemap_Stadium, (void*)(BG_SCREEN_ADDR(26))); LoadCompressedPalette(gBattleTerrainPalette_StadiumWallace, 0x20, 0x60); return; } @@ -768,47 +768,47 @@ void DrawMainBattleBackground(void) default: case MAP_BATTLE_SCENE_NORMAL: LZDecompressVram(gBattleTerrainTable[gBattleTerrain].tileset, (void*)(BG_CHAR_ADDR(2))); - LZDecompressVram(gBattleTerrainTable[gBattleTerrain].tilemap, (void*)(VRAM + 0xD000)); + LZDecompressVram(gBattleTerrainTable[gBattleTerrain].tilemap, (void*)(BG_SCREEN_ADDR(26))); LoadCompressedPalette(gBattleTerrainTable[gBattleTerrain].palette, 0x20, 0x60); break; case MAP_BATTLE_SCENE_GYM: LZDecompressVram(gBattleTerrainTiles_Building, (void*)(BG_CHAR_ADDR(2))); - LZDecompressVram(gBattleTerrainTilemap_Building, (void*)(VRAM + 0xD000)); + LZDecompressVram(gBattleTerrainTilemap_Building, (void*)(BG_SCREEN_ADDR(26))); LoadCompressedPalette(gBattleTerrainPalette_BuildingGym, 0x20, 0x60); break; case MAP_BATTLE_SCENE_MAGMA: LZDecompressVram(gBattleTerrainTiles_Stadium, (void*)(BG_CHAR_ADDR(2))); - LZDecompressVram(gBattleTerrainTilemap_Stadium, (void*)(VRAM + 0xD000)); + LZDecompressVram(gBattleTerrainTilemap_Stadium, (void*)(BG_SCREEN_ADDR(26))); LoadCompressedPalette(gBattleTerrainPalette_StadiumMagma, 0x20, 0x60); break; case MAP_BATTLE_SCENE_AQUA: LZDecompressVram(gBattleTerrainTiles_Stadium, (void*)(BG_CHAR_ADDR(2))); - LZDecompressVram(gBattleTerrainTilemap_Stadium, (void*)(VRAM + 0xD000)); + LZDecompressVram(gBattleTerrainTilemap_Stadium, (void*)(BG_SCREEN_ADDR(26))); LoadCompressedPalette(gBattleTerrainPalette_StadiumAqua, 0x20, 0x60); break; case MAP_BATTLE_SCENE_SIDNEY: LZDecompressVram(gBattleTerrainTiles_Stadium, (void*)(BG_CHAR_ADDR(2))); - LZDecompressVram(gBattleTerrainTilemap_Stadium, (void*)(VRAM + 0xD000)); + LZDecompressVram(gBattleTerrainTilemap_Stadium, (void*)(BG_SCREEN_ADDR(26))); LoadCompressedPalette(gBattleTerrainPalette_StadiumSidney, 0x20, 0x60); break; case MAP_BATTLE_SCENE_PHOEBE: LZDecompressVram(gBattleTerrainTiles_Stadium, (void*)(BG_CHAR_ADDR(2))); - LZDecompressVram(gBattleTerrainTilemap_Stadium, (void*)(VRAM + 0xD000)); + LZDecompressVram(gBattleTerrainTilemap_Stadium, (void*)(BG_SCREEN_ADDR(26))); LoadCompressedPalette(gBattleTerrainPalette_StadiumPhoebe, 0x20, 0x60); break; case MAP_BATTLE_SCENE_GLACIA: LZDecompressVram(gBattleTerrainTiles_Stadium, (void*)(BG_CHAR_ADDR(2))); - LZDecompressVram(gBattleTerrainTilemap_Stadium, (void*)(VRAM + 0xD000)); + LZDecompressVram(gBattleTerrainTilemap_Stadium, (void*)(BG_SCREEN_ADDR(26))); LoadCompressedPalette(gBattleTerrainPalette_StadiumGlacia, 0x20, 0x60); break; case MAP_BATTLE_SCENE_DRAKE: LZDecompressVram(gBattleTerrainTiles_Stadium, (void*)(BG_CHAR_ADDR(2))); - LZDecompressVram(gBattleTerrainTilemap_Stadium, (void*)(VRAM + 0xD000)); + LZDecompressVram(gBattleTerrainTilemap_Stadium, (void*)(BG_SCREEN_ADDR(26))); LoadCompressedPalette(gBattleTerrainPalette_StadiumDrake, 0x20, 0x60); break; case MAP_BATTLE_SCENE_FRONTIER: LZDecompressVram(gBattleTerrainTiles_Building, (void*)(BG_CHAR_ADDR(2))); - LZDecompressVram(gBattleTerrainTilemap_Building, (void*)(VRAM + 0xD000)); + LZDecompressVram(gBattleTerrainTilemap_Building, (void*)(BG_SCREEN_ADDR(26))); LoadCompressedPalette(gBattleTerrainPalette_Frontier, 0x20, 0x60); break; } @@ -1090,7 +1090,7 @@ void DrawBattleEntryBackground(void) if (gBattleTypeFlags & BATTLE_TYPE_LINK) { LZDecompressVram(gUnknown_08D778F0, (void*)(BG_CHAR_ADDR(1))); - LZDecompressVram(gUnknown_08D77B0C, (void*)(BG_SCREEN_ADDR(2)0)); + LZDecompressVram(gUnknown_08D77B0C, (void*)(VRAM + 0x10000)); LoadCompressedPalette(gUnknown_08D77AE4, 0x60, 0x20); SetBgAttribute(1, BG_ATTR_SCREENSIZE, 1); SetGpuReg(REG_OFFSET_BG1CNT, 0x5C04); @@ -1109,7 +1109,7 @@ void DrawBattleEntryBackground(void) if (!(gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER) || gPartnerTrainerId == TRAINER_STEVEN_PARTNER) { LZDecompressVram(gBattleTerrainAnimTiles_Building, (void*)(BG_CHAR_ADDR(1))); - LZDecompressVram(gBattleTerrainAnimTilemap_Building, (void*)(VRAM + 0xE000)); + LZDecompressVram(gBattleTerrainAnimTilemap_Building, (void*)(BG_SCREEN_ADDR(28))); } else { @@ -1124,17 +1124,17 @@ void DrawBattleEntryBackground(void) else if (gBattleTypeFlags & BATTLE_TYPE_GROUDON) { LZDecompressVram(gBattleTerrainAnimTiles_Cave, (void*)(BG_CHAR_ADDR(1))); - LZDecompressVram(gBattleTerrainAnimTilemap_Cave, (void*)(VRAM + 0xE000)); + LZDecompressVram(gBattleTerrainAnimTilemap_Cave, (void*)(BG_SCREEN_ADDR(28))); } else if (gBattleTypeFlags & BATTLE_TYPE_KYOGRE) { LZDecompressVram(gBattleTerrainAnimTiles_Underwater, (void*)(BG_CHAR_ADDR(1))); - LZDecompressVram(gBattleTerrainAnimTilemap_Underwater, (void*)(VRAM + 0xE000)); + LZDecompressVram(gBattleTerrainAnimTilemap_Underwater, (void*)(BG_SCREEN_ADDR(28))); } else if (gBattleTypeFlags & BATTLE_TYPE_RAYQUAZA) { LZDecompressVram(gBattleTerrainAnimTiles_Rayquaza, (void*)(BG_CHAR_ADDR(1))); - LZDecompressVram(gBattleTerrainAnimTilemap_Rayquaza, (void*)(VRAM + 0xE000)); + LZDecompressVram(gBattleTerrainAnimTilemap_Rayquaza, (void*)(BG_SCREEN_ADDR(28))); } else { @@ -1144,13 +1144,13 @@ void DrawBattleEntryBackground(void) if (trainerClass == TRAINER_CLASS_LEADER) { LZDecompressVram(gBattleTerrainAnimTiles_Building, (void*)(BG_CHAR_ADDR(1))); - LZDecompressVram(gBattleTerrainAnimTilemap_Building, (void*)(VRAM + 0xE000)); + LZDecompressVram(gBattleTerrainAnimTilemap_Building, (void*)(BG_SCREEN_ADDR(28))); return; } else if (trainerClass == TRAINER_CLASS_CHAMPION) { LZDecompressVram(gBattleTerrainAnimTiles_Building, (void*)(BG_CHAR_ADDR(1))); - LZDecompressVram(gBattleTerrainAnimTilemap_Building, (void*)(VRAM + 0xE000)); + LZDecompressVram(gBattleTerrainAnimTilemap_Building, (void*)(BG_SCREEN_ADDR(28))); return; } } @@ -1158,12 +1158,12 @@ void DrawBattleEntryBackground(void) if (GetCurrentMapBattleScene() == MAP_BATTLE_SCENE_NORMAL) { LZDecompressVram(gBattleTerrainTable[gBattleTerrain].entryTileset, (void*)(BG_CHAR_ADDR(1))); - LZDecompressVram(gBattleTerrainTable[gBattleTerrain].entryTilemap, (void*)(VRAM + 0xE000)); + LZDecompressVram(gBattleTerrainTable[gBattleTerrain].entryTilemap, (void*)(BG_SCREEN_ADDR(28))); } else { LZDecompressVram(gBattleTerrainAnimTiles_Building, (void*)(BG_CHAR_ADDR(1))); - LZDecompressVram(gBattleTerrainAnimTilemap_Building, (void*)(VRAM + 0xE000)); + LZDecompressVram(gBattleTerrainAnimTilemap_Building, (void*)(BG_SCREEN_ADDR(28))); } } } @@ -1246,14 +1246,14 @@ bool8 LoadChosenBattleElement(u8 caseId) case 4: if (gBattleTypeFlags & (BATTLE_TYPE_FRONTIER | BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000 | BATTLE_TYPE_EREADER_TRAINER)) { - LZDecompressVram(gBattleTerrainTilemap_Building, (void*)(VRAM + 0xD000)); + LZDecompressVram(gBattleTerrainTilemap_Building, (void*)(BG_SCREEN_ADDR(26))); } else if (gBattleTypeFlags & BATTLE_TYPE_KYOGRE_GROUDON) { if (gGameVersion == VERSION_RUBY) - LZDecompressVram(gBattleTerrainTilemap_Cave, (void*)(VRAM + 0xD000)); + LZDecompressVram(gBattleTerrainTilemap_Cave, (void*)(BG_SCREEN_ADDR(26))); else - LZDecompressVram(gBattleTerrainTilemap_Water, (void*)(VRAM + 0xD000)); + LZDecompressVram(gBattleTerrainTilemap_Water, (void*)(BG_SCREEN_ADDR(26))); } else { @@ -1262,12 +1262,12 @@ bool8 LoadChosenBattleElement(u8 caseId) u8 trainerClass = gTrainers[gTrainerBattleOpponent_A].trainerClass; if (trainerClass == TRAINER_CLASS_LEADER) { - LZDecompressVram(gBattleTerrainTilemap_Building, (void*)(VRAM + 0xD000)); + LZDecompressVram(gBattleTerrainTilemap_Building, (void*)(BG_SCREEN_ADDR(26))); break; } else if (trainerClass == TRAINER_CLASS_CHAMPION) { - LZDecompressVram(gBattleTerrainTilemap_Stadium, (void*)(VRAM + 0xD000)); + LZDecompressVram(gBattleTerrainTilemap_Stadium, (void*)(BG_SCREEN_ADDR(26))); break; } } @@ -1276,31 +1276,31 @@ bool8 LoadChosenBattleElement(u8 caseId) { default: case MAP_BATTLE_SCENE_NORMAL: - LZDecompressVram(gBattleTerrainTable[gBattleTerrain].tilemap, (void*)(VRAM + 0xD000)); + LZDecompressVram(gBattleTerrainTable[gBattleTerrain].tilemap, (void*)(BG_SCREEN_ADDR(26))); break; case MAP_BATTLE_SCENE_GYM: - LZDecompressVram(gBattleTerrainTilemap_Building, (void*)(VRAM + 0xD000)); + LZDecompressVram(gBattleTerrainTilemap_Building, (void*)(BG_SCREEN_ADDR(26))); break; case MAP_BATTLE_SCENE_MAGMA: - LZDecompressVram(gBattleTerrainTilemap_Stadium, (void*)(VRAM + 0xD000)); + LZDecompressVram(gBattleTerrainTilemap_Stadium, (void*)(BG_SCREEN_ADDR(26))); break; case MAP_BATTLE_SCENE_AQUA: - LZDecompressVram(gBattleTerrainTilemap_Stadium, (void*)(VRAM + 0xD000)); + LZDecompressVram(gBattleTerrainTilemap_Stadium, (void*)(BG_SCREEN_ADDR(26))); break; case MAP_BATTLE_SCENE_SIDNEY: - LZDecompressVram(gBattleTerrainTilemap_Stadium, (void*)(VRAM + 0xD000)); + LZDecompressVram(gBattleTerrainTilemap_Stadium, (void*)(BG_SCREEN_ADDR(26))); break; case MAP_BATTLE_SCENE_PHOEBE: - LZDecompressVram(gBattleTerrainTilemap_Stadium, (void*)(VRAM + 0xD000)); + LZDecompressVram(gBattleTerrainTilemap_Stadium, (void*)(BG_SCREEN_ADDR(26))); break; case MAP_BATTLE_SCENE_GLACIA: - LZDecompressVram(gBattleTerrainTilemap_Stadium, (void*)(VRAM + 0xD000)); + LZDecompressVram(gBattleTerrainTilemap_Stadium, (void*)(BG_SCREEN_ADDR(26))); break; case MAP_BATTLE_SCENE_DRAKE: - LZDecompressVram(gBattleTerrainTilemap_Stadium, (void*)(VRAM + 0xD000)); + LZDecompressVram(gBattleTerrainTilemap_Stadium, (void*)(BG_SCREEN_ADDR(26))); break; case MAP_BATTLE_SCENE_FRONTIER: - LZDecompressVram(gBattleTerrainTilemap_Building, (void*)(VRAM + 0xD000)); + LZDecompressVram(gBattleTerrainTilemap_Building, (void*)(BG_SCREEN_ADDR(26))); break; } } diff --git a/src/battle_gfx_sfx_util.c b/src/battle_gfx_sfx_util.c index 668bbf663..7c6b74304 100644 --- a/src/battle_gfx_sfx_util.c +++ b/src/battle_gfx_sfx_util.c @@ -923,7 +923,7 @@ void HandleSpeciesGfxDataChange(u8 battlerAtk, u8 battlerDef, bool8 notTransform } src = gMonSpritesGfxPtr->sprites[position]; - dst = (void *)(BG_SCREEN_ADDR(2)0 + gSprites[gBattlerSpriteIds[battlerAtk]].oam.tileNum * 32); + dst = (void *)(VRAM + 0x10000 + gSprites[gBattlerSpriteIds[battlerAtk]].oam.tileNum * 32); DmaCopy32(3, src, dst, 0x800); paletteOffset = 0x100 + battlerAtk * 16; lzPaletteData = GetFrontSpritePalFromSpeciesAndPersonality(targetSpecies, otId, personalityValue); diff --git a/src/berry_blender.c b/src/berry_blender.c index f2e3c7d14..c85d0e827 100644 --- a/src/berry_blender.c +++ b/src/berry_blender.c @@ -3104,7 +3104,7 @@ static void sub_8083170(u16 a0, u16 a1) s32 var1, var2, var3, var4; u16 *vram; - vram = (u16*)(VRAM + 0x6000); + vram = (u16*)(BG_SCREEN_ADDR(12)); var1 = (a0 * 64) / a1; var2 = var1 / 8; for (var4 = 0; var4 < var2; var4++) diff --git a/src/clear_save_data_screen.c b/src/clear_save_data_screen.c index 72d0daf55..5ec90e10c 100644 --- a/src/clear_save_data_screen.c +++ b/src/clear_save_data_screen.c @@ -153,7 +153,7 @@ static bool8 SetupClearSaveDataScreen(void) ((u16 *)(VRAM + 0x20))[i] = 0x1111; for (i = 0; i < 0x400; i++) - ((u16 *)(VRAM + 0xF000))[i] = 0x0001; + ((u16 *)(BG_SCREEN_ADDR(30)))[i] = 0x0001; ResetTasks(); ResetSpriteData(); ResetBgsAndClearDma3BusyFlags(0); diff --git a/src/contest.c b/src/contest.c index 5fb3f4dd5..7be4aa23b 100644 --- a/src/contest.c +++ b/src/contest.c @@ -318,7 +318,7 @@ void LoadContestBgAfterMoveAnim(void) s32 i; LZDecompressVram(gContestMiscGfx, (void *)VRAM); - LZDecompressVram(gContestAudienceGfx, (void *)(VRAM + 0x2000)); + LZDecompressVram(gContestAudienceGfx, (void *)(BG_SCREEN_ADDR(4))); CopyToBgTilemapBuffer(3, gUnknown_08C16FA8, 0, 0); CopyBgTilemapBufferToVram(3); LoadCompressedPalette(gUnknown_08C16E90, 0, 0x200); @@ -589,15 +589,15 @@ static u8 sub_80D7E44(u8 *a) case 0: gPaletteFade.bufferTransferDisabled = TRUE; RequestDma3Fill(0, (void *)VRAM, 0x8000, 1); - RequestDma3Fill(0, (void *)BG_CHAR_ADDR(2), 0x8000, 1); - RequestDma3Fill(0, (void *)BG_SCREEN_ADDR(2)0, 0x8000, 1); + RequestDma3Fill(0, (void *)VRAM + 0x8000, 0x8000, 1); + RequestDma3Fill(0, (void *)VRAM + 0x10000, 0x8000, 1); break; case 1: LZDecompressVram(gContestMiscGfx, (void *)VRAM); break; case 2: - LZDecompressVram(gContestAudienceGfx, (void *)(VRAM + 0x2000)); - DmaCopyLarge32(3, (void *)(VRAM + 0x2000), shared15800, 0x2000, 0x1000); + LZDecompressVram(gContestAudienceGfx, (void *)(BG_SCREEN_ADDR(4))); + DmaCopyLarge32(3, (void *)(BG_SCREEN_ADDR(4)), shared15800, 0x2000, 0x1000); break; case 3: CopyToBgTilemapBuffer(3, gUnknown_08C16FA8, 0, 0); @@ -3328,24 +3328,24 @@ static u8 sub_80DC9EC(u8 a) CopySpriteTiles(0, 3, (void *)VRAM, - (u16 *)(VRAM + 0xE000 + gUnknown_02039F26[a] * 5 * 64 + 0x26), + (u16 *)(BG_SCREEN_ADDR(28) + gUnknown_02039F26[a] * 5 * 64 + 0x26), gContestResources->field_34); CopySpriteTiles(0, 3, (void *)VRAM, - (u16 *)(VRAM + 0xE000 + gUnknown_02039F26[a] * 5 * 64 + 0x36), + (u16 *)(BG_SCREEN_ADDR(28) + gUnknown_02039F26[a] * 5 * 64 + 0x36), gContestResources->field_38); CpuFill32(0, gContestResources->field_34 + 0x500, 0x300); CpuFill32(0, gContestResources->field_38 + 0x500, 0x300); RequestDma3Copy(gContestResources->field_34, - (u8 *)(BG_SCREEN_ADDR(2)0 + gSprites[spriteId1].oam.tileNum * 32), + (u8 *)(VRAM + 0x10000 + gSprites[spriteId1].oam.tileNum * 32), 0x800, 1); RequestDma3Copy(gContestResources->field_38, - (u8 *)(BG_SCREEN_ADDR(2)0 + gSprites[spriteId2].oam.tileNum * 32), + (u8 *)(VRAM + 0x10000 + gSprites[spriteId2].oam.tileNum * 32), 0x800, 1); @@ -3870,8 +3870,8 @@ static void sub_80DD940(void) src = gContestApplauseMeterGfx + 64; else src = gContestApplauseMeterGfx; - CpuCopy32(src, (void *)(BG_SCREEN_ADDR(2)0 + (gSprites[sContest.applauseMeterSpriteId].oam.tileNum + 17 + i) * 32), 32); - CpuCopy32(src + 32, (void *)(BG_SCREEN_ADDR(2)0 + (gSprites[sContest.applauseMeterSpriteId].oam.tileNum + 25 + i) * 32), 32); + CpuCopy32(src, (void *)(VRAM + 0x10000 + (gSprites[sContest.applauseMeterSpriteId].oam.tileNum + 17 + i) * 32), 32); + CpuCopy32(src + 32, (void *)(VRAM + 0x10000 + (gSprites[sContest.applauseMeterSpriteId].oam.tileNum + 25 + i) * 32), 32); if (sContest.applauseLevel > 4) sub_80DDA20(); @@ -4027,11 +4027,11 @@ static void sub_80DDE30(u8 taskId) gTasks[taskId].data[10] = 0; if (gTasks[taskId].data[11] == 0) { - RequestDma3Copy(shared16800, (void *)(VRAM + 0x2000), 0x1000, 1); + RequestDma3Copy(shared16800, (void *)(BG_SCREEN_ADDR(4)), 0x1000, 1); } else { - RequestDma3Copy(shared15800, (void *)(VRAM + 0x2000), 0x1000, 1); + RequestDma3Copy(shared15800, (void *)(BG_SCREEN_ADDR(4)), 0x1000, 1); gTasks[taskId].data[12]++; } @@ -4120,7 +4120,7 @@ static void sub_80DE008(bool8 a) { if (sContestantStatus[i].turnOrderMod != 0 && a) { - CpuCopy32(GetTurnOrderNumberGfx(i), (void *)(BG_SCREEN_ADDR(2)0 + (gSprites[gContestResources->field_14[i].unk1].oam.tileNum + 6) * 32), 32); + CpuCopy32(GetTurnOrderNumberGfx(i), (void *)(VRAM + 0x10000 + (gSprites[gContestResources->field_14[i].unk1].oam.tileNum + 6) * 32), 32); gSprites[gContestResources->field_14[i].unk1].pos1.y = gUnknown_08587A70[gUnknown_02039F26[i]]; gSprites[gContestResources->field_14[i].unk1].invisible = FALSE; } diff --git a/src/contest_painting.c b/src/contest_painting.c index 71a110aa8..2f0c97764 100644 --- a/src/contest_painting.c +++ b/src/contest_painting.c @@ -554,7 +554,7 @@ static void sub_8130430(u8 arg0, u8 arg1) break; } -#define VRAM_PICTURE_DATA(x, y) (((u16 *)(VRAM + 0x6000))[(y) * 32 + (x)]) +#define VRAM_PICTURE_DATA(x, y) (((u16 *)(BG_SCREEN_ADDR(12)))[(y) * 32 + (x)]) // Set the background for (y = 0; y < 20; y++) @@ -579,7 +579,7 @@ static void sub_8130430(u8 arg0, u8 arg1) else if (arg0 < 8) { RLUnCompVram(gPictureFrameTiles_5, (void *)VRAM); - RLUnCompVram(gPictureFrameTilemap_5, (void *)(VRAM + 0x6000)); + RLUnCompVram(gPictureFrameTilemap_5, (void *)(BG_SCREEN_ADDR(12))); } else { @@ -587,23 +587,23 @@ static void sub_8130430(u8 arg0, u8 arg1) { case CONTEST_CATEGORY_COOL: RLUnCompVram(gPictureFrameTiles_0, (void *)VRAM); - RLUnCompVram(gPictureFrameTilemap_0, (void *)(VRAM + 0x6000)); + RLUnCompVram(gPictureFrameTilemap_0, (void *)(BG_SCREEN_ADDR(12))); break; case CONTEST_CATEGORY_BEAUTY: RLUnCompVram(gPictureFrameTiles_1, (void *)VRAM); - RLUnCompVram(gPictureFrameTilemap_1, (void *)(VRAM + 0x6000)); + RLUnCompVram(gPictureFrameTilemap_1, (void *)(BG_SCREEN_ADDR(12))); break; case CONTEST_CATEGORY_CUTE: RLUnCompVram(gPictureFrameTiles_2, (void *)VRAM); - RLUnCompVram(gPictureFrameTilemap_2, (void *)(VRAM + 0x6000)); + RLUnCompVram(gPictureFrameTilemap_2, (void *)(BG_SCREEN_ADDR(12))); break; case CONTEST_CATEGORY_SMART: RLUnCompVram(gPictureFrameTiles_3, (void *)VRAM); - RLUnCompVram(gPictureFrameTilemap_3, (void *)(VRAM + 0x6000)); + RLUnCompVram(gPictureFrameTilemap_3, (void *)(BG_SCREEN_ADDR(12))); break; case CONTEST_CATEGORY_TOUGH: RLUnCompVram(gPictureFrameTiles_4, (void *)VRAM); - RLUnCompVram(gPictureFrameTilemap_4, (void *)(VRAM + 0x6000)); + RLUnCompVram(gPictureFrameTilemap_4, (void *)(BG_SCREEN_ADDR(12))); break; } } diff --git a/src/credits.c b/src/credits.c index c96c6b4a1..aee5332f5 100644 --- a/src/credits.c +++ b/src/credits.c @@ -1343,7 +1343,7 @@ static void sub_81758E4(u8 taskIdA) FreeAllSpritePalettes(); gReservedSpritePaletteCount = 8; LZ77UnCompVram(gBirchHelpGfx, (void *)VRAM); - LZ77UnCompVram(gBirchGrassTilemap, (void *)(VRAM + 0x3800)); + LZ77UnCompVram(gBirchGrassTilemap, (void *)(BG_SCREEN_ADDR(7))); LoadPalette(gBirchBagGrassPal[0] + 1, 1, 31 * 2); for (i = 0; i < 0x800; i++) diff --git a/src/field_effect.c b/src/field_effect.c index 69c6a1b7d..e7c0b39b9 100644 --- a/src/field_effect.c +++ b/src/field_effect.c @@ -2953,7 +2953,7 @@ u8 sub_80B8F98(void) { for (j = 12; j < 18; j++) { - ((u16*)(VRAM + 0xF800))[i * 32 + j] = 0xBFF4 + i * 6 + j + 1; + ((u16*)(BG_SCREEN_ADDR(31)))[i * 32 + j] = 0xBFF4 + i * 6 + j + 1; } } for (k = 0; k < 90; k++) diff --git a/src/field_effect_helpers.c b/src/field_effect_helpers.c index 53fd87e61..651b2baca 100755 --- a/src/field_effect_helpers.c +++ b/src/field_effect_helpers.c @@ -1418,7 +1418,7 @@ void sub_8155F80(struct Sprite *sprite) { for (j = 12; j < 18; j++) { - ((u16*)(VRAM + 0xF800))[i * 32 + j] = 0xBFF4 + i * 6 + j + 1; + ((u16*)(BG_SCREEN_ADDR(31)))[i * 32 + j] = 0xBFF4 + i * 6 + j + 1; } } } @@ -1504,7 +1504,7 @@ void sub_8155F80(struct Sprite *sprite) { for (j = 12; j < 18; j++) { - ((u16*)(VRAM + 0xF800))[i * 32 + j] = 0; + ((u16*)(BG_SCREEN_ADDR(31)))[i * 32 + j] = 0; } } SetGpuReg(REG_OFFSET_BG0VOFS, 0); diff --git a/src/intro.c b/src/intro.c index 13ceced75..23457f370 100644 --- a/src/intro.c +++ b/src/intro.c @@ -1093,13 +1093,13 @@ static void Task_IntroLoadPart1Graphics(u8 taskId) SetGpuReg(REG_OFFSET_BG0VOFS, 0x28); LZ77UnCompVram(gIntro1BGLeavesGfx, (void *)VRAM); LZ77UnCompVram(gIntro1BG0_Tilemap, (void *)(BG_CHAR_ADDR(2))); - DmaClear16(3, VRAM + 0x8800, 0x800); - LZ77UnCompVram(gIntro1BG1_Tilemap, (void *)(VRAM + 0x9000)); - DmaClear16(3, VRAM + 0x9800, 0x800); - LZ77UnCompVram(gIntro1BG2_Tilemap, (void *)(VRAM + 0xA000)); - DmaClear16(3, VRAM + 0xA800, 0x800); - LZ77UnCompVram(gIntro1BG3_Tilemap, (void *)(VRAM + 0xB000)); - DmaClear16(3, VRAM + 0xB800, 0x800); + DmaClear16(3, BG_SCREEN_ADDR(17), 0x800); + LZ77UnCompVram(gIntro1BG1_Tilemap, (void *)(BG_SCREEN_ADDR(18))); + DmaClear16(3, BG_SCREEN_ADDR(19), 0x800); + LZ77UnCompVram(gIntro1BG2_Tilemap, (void *)(BG_SCREEN_ADDR(20))); + DmaClear16(3, BG_SCREEN_ADDR(21), 0x800); + LZ77UnCompVram(gIntro1BG3_Tilemap, (void *)(BG_SCREEN_ADDR(22))); + DmaClear16(3, BG_SCREEN_ADDR(23), 0x800); LoadPalette(gIntro1BGPals, 0, sizeof(gIntro1BGPals)); SetGpuReg(REG_OFFSET_BG3CNT, BGCNT_PRIORITY(3) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(22) | BGCNT_16COLOR | BGCNT_TXT256x512); SetGpuReg(REG_OFFSET_BG2CNT, BGCNT_PRIORITY(2) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(20) | BGCNT_16COLOR | BGCNT_TXT256x512); @@ -1603,7 +1603,7 @@ static void Task_IntroLoadGroudonScene(u8 taskId) LZDecompressVram(gIntro3GroudonGfx, (void *)VRAM); LZDecompressVram(gIntro3GroudonTilemap, (void *)(BG_CHAR_ADDR(3))); LZDecompressVram(gIntro3LegendBgGfx, (void *)(BG_CHAR_ADDR(1))); - LZDecompressVram(gIntro3GroudonBgTilemap, (void *)(VRAM + 0xE000)); + LZDecompressVram(gIntro3GroudonBgTilemap, (void *)(BG_SCREEN_ADDR(28))); LoadCompressedSpriteSheetUsingHeap(&gBattleAnimPicTable[GET_TRUE_SPRITE_INDEX(ANIM_TAG_ROCKS)]); LoadCompressedSpritePaletteUsingHeap(&gBattleAnimPaletteTable[GET_TRUE_SPRITE_INDEX(ANIM_TAG_ROCKS)]); CpuCopy16(gIntro3BgPal, gPlttBufferUnfaded, sizeof(gIntro3BgPal)); @@ -1825,7 +1825,7 @@ static void Task_IntroLoadKyogreScene(u8 taskId) ResetSpriteData(); LZDecompressVram(gIntro3KyogreGfx, (void *)VRAM); LZDecompressVram(gIntro3KyogreTilemap, (void *)(BG_CHAR_ADDR(3))); - LZDecompressVram(gIntro3KyogreBgTilemap, (void *)(VRAM + 0xE000)); + LZDecompressVram(gIntro3KyogreBgTilemap, (void *)(BG_SCREEN_ADDR(28))); LoadCompressedSpriteSheet(gUnknown_085E4C88); LoadSpritePalette(gUnknown_085E4C98); BeginNormalPaletteFade(0xFFFFFFFE, 0, 0x10, 0, RGB_WHITEALPHA); @@ -2088,14 +2088,14 @@ static void Task_IntroLoadClouds1(u8 taskId) SetGpuReg(REG_OFFSET_BG2VOFS, 0); LZDecompressVram(gIntro3CloudsGfx, (void *)VRAM); LZDecompressVram(gIntro3CloudsGfx, (void *)(BG_CHAR_ADDR(1))); - LZDecompressVram(gIntro3Clouds3Tilemap, (void *)(VRAM + 0xE000)); + LZDecompressVram(gIntro3Clouds3Tilemap, (void *)(BG_SCREEN_ADDR(28))); gTasks[taskId].func = Task_IntroLoadClouds2; } static void Task_IntroLoadClouds2(u8 taskId) { LZDecompressVram(gIntro3Clouds1Tilemap, (void *)(BG_CHAR_ADDR(3))); - LZDecompressVram(gIntro3Clouds2Tilemap, (void *)(VRAM + 0xD000)); + LZDecompressVram(gIntro3Clouds2Tilemap, (void *)(BG_SCREEN_ADDR(26))); gTasks[taskId].func = Task_IntroLoadClouds3; } @@ -2140,7 +2140,7 @@ static void Task_IntroCloudScene(u8 taskId) static void Task_IntroLoadRayquazaLightningScene(u8 taskId) { - LZDecompressVram(gIntro3RayquazaTilemap, (void *)(VRAM + 0xE000)); + LZDecompressVram(gIntro3RayquazaTilemap, (void *)(BG_SCREEN_ADDR(28))); LZDecompressVram(gIntro3Clouds4Tilemap, (void *)(BG_CHAR_ADDR(3))); LZDecompressVram(gIntro3RayquazaGfx, (void *)(BG_CHAR_ADDR(1))); LZDecompressVram(gIntro3Clouds2Gfx, (void *)VRAM); diff --git a/src/intro_credits_graphics.c b/src/intro_credits_graphics.c index 4489b64c3..b98708324 100644 --- a/src/intro_credits_graphics.c +++ b/src/intro_credits_graphics.c @@ -332,14 +332,14 @@ static void sub_817B458(u8); void load_intro_part2_graphics(u8 a) { LZ77UnCompVram(gUnknown_085F0740, (void *)(BG_CHAR_ADDR(1))); - LZ77UnCompVram(gUnknown_085F0BC0, (void *)(VRAM + 0x7800)); + LZ77UnCompVram(gUnknown_085F0BC0, (void *)(BG_SCREEN_ADDR(15))); LoadPalette(&gUnknown_085F06E0, 240, 32); switch (a) { case 0: default: LZ77UnCompVram(gUnknown_085F0DBC, (void *)(VRAM)); - LZ77UnCompVram(gUnknown_085F1398, (void *)(VRAM + 0x3000)); + LZ77UnCompVram(gUnknown_085F1398, (void *)(BG_SCREEN_ADDR(6))); LoadPalette(&gUnknown_085F0CFC, 0, 96); LoadCompressedSpriteSheet(gUnknown_085F5064); LoadPalette(&gUnknown_085F1668, 256, 32); @@ -347,7 +347,7 @@ void load_intro_part2_graphics(u8 a) break; case 1: LZ77UnCompVram(gUnknown_085F1824, (void *)(VRAM)); - LZ77UnCompVram(gUnknown_085F1EAC, (void *)(VRAM + 0x3000)); + LZ77UnCompVram(gUnknown_085F1EAC, (void *)(BG_SCREEN_ADDR(6))); LoadPalette(&gUnknown_085F17E4, 0, 32); LoadCompressedSpriteSheet(gUnknown_085F50EC); LoadPalette(&gUnknown_085F21B0, 256, 32); @@ -439,27 +439,27 @@ void sub_817B150(u8 a) void sub_817B1C8(u8 a) { LZ77UnCompVram(gUnknown_085F0740, (void *)(BG_CHAR_ADDR(1))); - LZ77UnCompVram(gUnknown_085F0BC0, (void *)(VRAM + 0x7800)); + LZ77UnCompVram(gUnknown_085F0BC0, (void *)(BG_SCREEN_ADDR(15))); switch (a) { case 0: default: LoadPalette(&gUnknown_085F06E0, 240, 32); LZ77UnCompVram(gUnknown_085F0DBC, (void *)(VRAM)); - LZ77UnCompVram(gUnknown_085F1398, (void *)(VRAM + 0x3000)); + LZ77UnCompVram(gUnknown_085F1398, (void *)(BG_SCREEN_ADDR(6))); LoadPalette(&gUnknown_085F0CFC, 0, 96); LoadCompressedSpriteSheet(gUnknown_085F5064); - LZ77UnCompVram(gUnknown_085F16A8, (void *)(BG_SCREEN_ADDR(2)0)); + LZ77UnCompVram(gUnknown_085F16A8, (void *)(VRAM + 0x10000)); LoadPalette(&gUnknown_085F1668, 256, 32); sub_817B76C(); break; case 1: LoadPalette(&gUnknown_085F0700, 240, 32); LZ77UnCompVram(gUnknown_085F0DBC, (void *)(VRAM)); - LZ77UnCompVram(gUnknown_085F1398, (void *)(VRAM + 0x3000)); + LZ77UnCompVram(gUnknown_085F1398, (void *)(BG_SCREEN_ADDR(6))); LoadPalette(&gUnknown_085F0D5C, 0, 96); LoadCompressedSpriteSheet(gUnknown_085F5064); - LZ77UnCompVram(gUnknown_085F16A8, (void *)(BG_SCREEN_ADDR(2)0)); + LZ77UnCompVram(gUnknown_085F16A8, (void *)(VRAM + 0x10000)); LoadPalette(&gUnknown_085F1688, 256, 32); sub_817B76C(); break; @@ -467,7 +467,7 @@ void sub_817B1C8(u8 a) case 3: LoadPalette(&gUnknown_085F0700, 240, 32); LZ77UnCompVram(gUnknown_085F1824, (void *)(VRAM)); - LZ77UnCompVram(gUnknown_085F1EAC, (void *)(VRAM + 0x3000)); + LZ77UnCompVram(gUnknown_085F1EAC, (void *)(BG_SCREEN_ADDR(6))); LoadPalette(&gUnknown_085F1804, 0, 32); LoadCompressedSpriteSheet(gUnknown_085F50EC); LoadPalette(&gUnknown_085F1804, 256, 32); @@ -476,7 +476,7 @@ void sub_817B1C8(u8 a) case 4: LoadPalette(&gUnknown_085F0720, 240, 32); LZ77UnCompVram(gUnknown_085F235C, (void *)(VRAM)); - LZ77UnCompVram(gUnknown_085F2568, (void *)(VRAM + 0x3000)); + LZ77UnCompVram(gUnknown_085F2568, (void *)(BG_SCREEN_ADDR(6))); LoadPalette(&gUnknown_085F231C, 0, 64); LoadCompressedSpriteSheet(gUnknown_085F5180); LoadPalette(&gUnknown_085F2548, 256, 32); diff --git a/src/main_menu.c b/src/main_menu.c index 4cd5c8e14..82a30aa59 100644 --- a/src/main_menu.c +++ b/src/main_menu.c @@ -1147,7 +1147,7 @@ static void Task_NewGameBirchSpeech_Init(u8 taskId) SetGpuReg(REG_OFFSET_BLDY, 0); LZ77UnCompVram(sBirchSpeechShadowGfx, (void*)VRAM); - LZ77UnCompVram(sBirchSpeechBgMap, (void*)(VRAM + 0x3800)); + LZ77UnCompVram(sBirchSpeechBgMap, (void*)(BG_SCREEN_ADDR(7))); LoadPalette(sBirchSpeechBgPals, 0, 64); LoadPalette(sBirchSpeechPlatformBlackPal, 1, 16); ScanlineEffect_Stop(); @@ -1687,7 +1687,7 @@ static void CB2_NewGameBirchSpeech_ReturnFromNamingScreen(void) DmaFill16(3, 0, PLTT, PLTT_SIZE); ResetPaletteFade(); LZ77UnCompVram(sBirchSpeechShadowGfx, (u8*)VRAM); - LZ77UnCompVram(sBirchSpeechBgMap, (u8*)(VRAM + 0x3800)); + LZ77UnCompVram(sBirchSpeechBgMap, (u8*)(BG_SCREEN_ADDR(7))); LoadPalette(sBirchSpeechBgPals, 0, 64); LoadPalette(&sBirchSpeechBgGradientPal[1], 1, 16); ResetTasks(); diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index c0aec4ddd..c1ebe91b4 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -3927,7 +3927,7 @@ static void SetScrollingBackground(void) { SetGpuReg(REG_OFFSET_BG3CNT, BGCNT_PRIORITY(3) | BGCNT_CHARBASE(3) | BGCNT_16COLOR | BGCNT_SCREENBASE(31)); DecompressAndLoadBgGfxUsingHeap(3, gPokemonStorageScrollingBGTileset, 0, 0, 0); - LZ77UnCompVram(gPokemonStorageScrollingBGTilemap, (void *)VRAM + 0xF800); + LZ77UnCompVram(gPokemonStorageScrollingBGTilemap, (void *)BG_SCREEN_ADDR(31)); } static void ScrollBackground(void) diff --git a/src/save_failed_screen.c b/src/save_failed_screen.c index c668c1db0..2478ebbec 100644 --- a/src/save_failed_screen.c +++ b/src/save_failed_screen.c @@ -208,8 +208,8 @@ static void CB2_SaveFailedScreen(void) DmaFill32(3, 0, OAM, OAM_SIZE); DmaFill16(3, 0, PLTT, PLTT_SIZE); LZ77UnCompVram(gBirchHelpGfx, (void *)VRAM); - LZ77UnCompVram(gBirchBagTilemap, (void *)(VRAM + 0x7000)); - LZ77UnCompVram(gBirchGrassTilemap, (void *)(VRAM + 0x7800)); + LZ77UnCompVram(gBirchBagTilemap, (void *)(BG_SCREEN_ADDR(14))); + LZ77UnCompVram(gBirchGrassTilemap, (void *)(BG_SCREEN_ADDR(15))); LZ77UnCompVram(sSaveFailedClockGfx, (void *)(VRAM + 0x10020)); ResetBgsAndClearDma3BusyFlags(0); InitBgsFromTemplates(0, gUnknown_085EFD88, 3); diff --git a/src/starter_choose.c b/src/starter_choose.c index 2d4a1b1e1..5a8de3b4a 100644 --- a/src/starter_choose.c +++ b/src/starter_choose.c @@ -393,8 +393,8 @@ void CB2_ChooseStarter(void) DmaFill16(3, 0, PLTT, PLTT_SIZE); LZ77UnCompVram(gBirchHelpGfx, (void *)VRAM); - LZ77UnCompVram(gBirchBagTilemap, (void *)(VRAM + 0x3000)); - LZ77UnCompVram(gBirchGrassTilemap, (void *)(VRAM + 0x3800)); + LZ77UnCompVram(gBirchBagTilemap, (void *)(BG_SCREEN_ADDR(6))); + LZ77UnCompVram(gBirchGrassTilemap, (void *)(BG_SCREEN_ADDR(7))); ResetBgsAndClearDma3BusyFlags(0); InitBgsFromTemplates(0, gUnknown_085B1E00, ARRAY_COUNT(gUnknown_085B1E00)); diff --git a/src/title_screen.c b/src/title_screen.c index 6e3ba45cf..ca34f90f8 100644 --- a/src/title_screen.c +++ b/src/title_screen.c @@ -507,12 +507,12 @@ void CB2_InitTitleScreen(void) break; case 1: LZ77UnCompVram(gTitleScreenPokemonLogoGfx, (void *)VRAM); - LZ77UnCompVram(gUnknown_08DE0644, (void *)(VRAM + 0x4800)); + LZ77UnCompVram(gUnknown_08DE0644, (void *)(BG_SCREEN_ADDR(9))); LoadPalette(gTitleScreenBgPalettes, 0, 0x1E0); LZ77UnCompVram(sTitleScreenRayquazaGfx, (void *)(BG_CHAR_ADDR(2))); - LZ77UnCompVram(sTitleScreenRayquazaTilemap, (void *)(VRAM + 0xD000)); + LZ77UnCompVram(sTitleScreenRayquazaTilemap, (void *)(BG_SCREEN_ADDR(26))); LZ77UnCompVram(sTitleScreenCloudsGfx, (void *)(BG_CHAR_ADDR(3))); - LZ77UnCompVram(gUnknown_08DDE458, (void *)(VRAM + 0xD800)); + LZ77UnCompVram(gUnknown_08DDE458, (void *)(BG_SCREEN_ADDR(27))); ScanlineEffect_Stop(); ResetTasks(); ResetSpriteData();