summaryrefslogtreecommitdiff
path: root/engine/overworld/init_map.asm
diff options
context:
space:
mode:
authormid-kid <esteve.varela@gmail.com>2018-03-13 13:07:16 +0100
committermid-kid <esteve.varela@gmail.com>2018-03-13 13:21:40 +0100
commitbaa0dc5a963a79843b37888bcfe1d2dfe833ade9 (patch)
tree968c86105bd67a3121d8f3f20018bfc59191f4c9 /engine/overworld/init_map.asm
parent12070ca50067d3abe36a730190f88ee43f2cace9 (diff)
Organize the engine/ directory
This is an informed attempt at reorganizing the engine/ directory by creating categorized subdirectories, in order to make it easier to navigate and find things. The directories created are as follows: * engine/game: Contains all "minigames", things like the unown puzzle and slot machine. * engine/gfx: Contains all handling of graphics. From loading palettes to playing animations. * engine/link: Contains all multiplayer functionality. * engine/menu: Contains all generic/misc. menus and menu code. Other, more specialized menus are in their own subdirectories (pokedex, pokegear, party menu, etc). * engine/overworld: Contains all handling of the overworld. From loading and connecting maps to wild encounters and the scripting engine. * engine/pokegear: In the same vein as engine/pokedex, except it could use some more splitting up. * engine/pokemon: Contains everything related to manipulating pokemon data. From the pokemon storage system to evolution and mail. * engine/printer: Contains everything related to printing things as well as the printer communication. * engine/title: Contains intro sequences, title screens and credits.
Diffstat (limited to 'engine/overworld/init_map.asm')
-rw-r--r--engine/overworld/init_map.asm103
1 files changed, 103 insertions, 0 deletions
diff --git a/engine/overworld/init_map.asm b/engine/overworld/init_map.asm
new file mode 100644
index 000000000..2eb4998a6
--- /dev/null
+++ b/engine/overworld/init_map.asm
@@ -0,0 +1,103 @@
+ReanchorBGMap_NoOAMUpdate:: ; 6454
+ call DelayFrame
+ ld a, [hOAMUpdate]
+ push af
+
+ ld a, $1
+ ld [hOAMUpdate], a
+ ld a, [hBGMapMode]
+ push af
+ xor a
+ ld [hBGMapMode], a
+
+ call .ReanchorBGMap
+
+ pop af
+ ld [hBGMapMode], a
+ pop af
+ ld [hOAMUpdate], a
+ ld hl, wVramState
+ set 6, [hl]
+ ret
+
+.ReanchorBGMap:
+ xor a
+ ld [hLCDCPointer], a
+ ld [hBGMapMode], a
+ ld a, $90
+ ld [hWY], a
+ call OverworldTextModeSwitch
+ ld a, HIGH(vBGMap1)
+ call .LoadBGMapAddrIntoHRAM
+ call _OpenAndCloseMenu_HDMATransferTileMapAndAttrMap
+ farcall LoadOW_BGPal7
+ farcall ApplyPals
+ ld a, $1
+ ld [hCGBPalUpdate], a
+ xor a
+ ld [hBGMapMode], a
+ ld [hWY], a
+ farcall HDMATransfer_FillBGMap0WithBlack ; no need to farcall
+ ld a, HIGH(vBGMap0)
+ call .LoadBGMapAddrIntoHRAM
+ xor a ; LOW(vBGMap0)
+ ld [wBGMapAnchor], a
+ ld a, HIGH(vBGMap0)
+ ld [wBGMapAnchor + 1], a
+ xor a
+ ld [hSCX], a
+ ld [hSCY], a
+ call ApplyBGMapAnchorToObjects
+ ret
+
+.LoadBGMapAddrIntoHRAM: ; 64b9
+ ld [hBGMapAddress + 1], a
+ xor a
+ ld [hBGMapAddress], a
+ ret
+
+LoadFonts_NoOAMUpdate:: ; 64bf
+ ld a, [hOAMUpdate]
+ push af
+ ld a, $1
+ ld [hOAMUpdate], a
+
+ call .LoadGFX
+
+ pop af
+ ld [hOAMUpdate], a
+ ret
+
+.LoadGFX:
+ call LoadFontsExtra
+ ld a, $90
+ ld [hWY], a
+ call SafeUpdateSprites
+ call LoadStandardFont
+ ret
+
+HDMATransfer_FillBGMap0WithBlack: ; 64db
+ ld a, [rSVBK]
+ push af
+ ld a, BANK(wDecompressScratch)
+ ld [rSVBK], a
+
+ ld a, "■"
+ ld hl, wDecompressScratch
+ ld bc, wScratchAttrMap - wDecompressScratch
+ call ByteFill
+ ld a, HIGH(wDecompressScratch)
+ ld [rHDMA1], a
+ ld a, LOW(wDecompressScratch)
+ ld [rHDMA2], a
+ ld a, HIGH(vBGMap0 % $8000)
+ ld [rHDMA3], a
+ ld a, LOW(vBGMap0 % $8000)
+ ld [rHDMA4], a
+ ld a, $3f
+ ld [hDMATransfer], a
+ call DelayFrame
+
+ pop af
+ ld [rSVBK], a
+ ret