diff options
author | luckytyphlosion <10688458+luckytyphlosion@users.noreply.github.com> | 2018-07-08 21:21:12 -0400 |
---|---|---|
committer | luckytyphlosion <10688458+luckytyphlosion@users.noreply.github.com> | 2018-07-08 21:21:12 -0400 |
commit | 3b704c267c4810b0d7ec2048300fcd08bad21a53 (patch) | |
tree | 8392fd35b664fb5a5a7674238da42c60379e0378 /engine/menu | |
parent | 16d95f657647ddf20e4b2bfa3a882a88988f761f (diff) | |
parent | 5ec276e7c77244befe0b6c9931cda191aa3818b6 (diff) |
Merge branch 'master' into section-reorg
Diffstat (limited to 'engine/menu')
-rw-r--r-- | engine/menu/main_menu.asm | 89 |
1 files changed, 87 insertions, 2 deletions
diff --git a/engine/menu/main_menu.asm b/engine/menu/main_menu.asm index 75fd00a..e32aa3d 100644 --- a/engine/menu/main_menu.asm +++ b/engine/menu/main_menu.asm @@ -1,6 +1,91 @@ INCLUDE "constants.asm" -SECTION "engine/menu/main_menu.asm", ROMX +SECTION "engine/menu/main_menu.asm@Initialize new game WRAM", ROMX +; TODO: Move this to another file when surrounding +; functions have been disassembled. +InitializeNewGameWRAM: + ld a, [wSGB] + push af + + ; Clear a lot of in-game WRAM. + + ld hl, wVirtualOAM + ld bc, (wcd3f + 1) - wVirtualOAM + xor a + call ByteFill + + ld hl, wPlayerName + ld bc, $1164 + xor a + call ByteFill + + ; Lots of other setup. + + pop af + ld [wSGB], a + + ldh a, [rLY] + ldh [hRTCRandom], a + call DelayFrame + + ldh a, [hRandomSub] + ld [wce73], a + ldh a, [rLY] + ldh [hRTCRandom], a + call DelayFrame + + ldh a, [hRandomAdd] + ld [wce74], a + + ld hl, wPartyCount + call InitializeByteList + ld hl, wUnknownListLengthda83 + call InitializeByteList + ld hl, wNumBagItems + call InitializeByteList + ld hl, wNumKeyItems + call InitializeByteList + ld hl, wUnknownListLengthd1ea + call InitializeByteList + + xor a + ld [wMonType], a + ld [wd163], a + ld [wd164], a + ld [wd15b], a + ld [wd15c], a + ld [wd15d], a + + ld a, $0B + ld [wd15e], a + + ld a, $B8 + ld [wd15f], a + + ld hl, wUnknownListLengthd1ea + ld a, ITEM_REPEL + ld [wCurItem], a + ld a, 1 + ld [wItemQuantity], a + call ReceiveItem + + ld a, MAP_SILENT_HILL + ld [wMapId], a + ld a, GROUP_SILENT_HILL + ld [wMapGroup], a + + ret + +; Initializes a 0xFF-terminated list preceded by a length to +; length 0, with an immediate terminator. +InitializeByteList: + xor a + ld [hli], a + dec a + ld [hl], a + ret + +SECTION "engine/menu/main_menu.asm@MainMenu", ROMX MainMenu:: ; 01:53CC ld hl, wd4a9 @@ -197,7 +282,7 @@ StartNewGame:: ; 555C call LoadFontExtra xor a ldh [hBGMapMode], a - callba Function52f9 + callba InitializeNewGameWRAM call ClearTileMap call ClearWindowData xor a |