mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-09-09 09:51:34 -07:00
Upkeep tasks in board menu: auto save game, increase turn, clear wTurnData (#11); also init wCurTurn and wCurSpace in EnterMap
This commit is contained in:
parent
645eef341b
commit
b9ac41feb6
@ -1,5 +1,6 @@
|
|||||||
BoardMenuScript::
|
BoardMenuScript::
|
||||||
opentext
|
opentext
|
||||||
|
callasm .Upkeep
|
||||||
.display_menu
|
.display_menu
|
||||||
callasm BoardMenu
|
callasm BoardMenu
|
||||||
ifequal BOARDMENUITEM_DIE, .Die
|
ifequal BOARDMENUITEM_DIE, .Die
|
||||||
@ -10,6 +11,17 @@ BoardMenuScript::
|
|||||||
closetext
|
closetext
|
||||||
end
|
end
|
||||||
|
|
||||||
|
.Upkeep:
|
||||||
|
; save after opentext to reanchor map first
|
||||||
|
; save before processing variables like wCurTurn due to BoardMenuScript reentry after game reset
|
||||||
|
farcall AutoSaveGameInOverworld
|
||||||
|
ld hl, wCurTurn
|
||||||
|
inc [hl]
|
||||||
|
ld hl, wTurnData
|
||||||
|
ld bc, wTurnDataEnd - wTurnData
|
||||||
|
xor a
|
||||||
|
jp ByteFill
|
||||||
|
|
||||||
.Die:
|
.Die:
|
||||||
callasm BoardMenu_Die
|
callasm BoardMenu_Die
|
||||||
iffalse BoardMenuScript
|
iffalse BoardMenuScript
|
||||||
|
@ -110,6 +110,7 @@ CheckSpaceEffects:
|
|||||||
bit 5, [hl]
|
bit 5, [hl]
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
; on enter overworld loop
|
||||||
StartMap:
|
StartMap:
|
||||||
xor a
|
xor a
|
||||||
ldh [hScriptVar], a
|
ldh [hScriptVar], a
|
||||||
@ -120,8 +121,15 @@ StartMap:
|
|||||||
call ByteFill
|
call ByteFill
|
||||||
farcall InitCallReceiveDelay
|
farcall InitCallReceiveDelay
|
||||||
call ClearJoypad
|
call ClearJoypad
|
||||||
|
; initialize board state
|
||||||
|
xor a
|
||||||
|
ld [wCurTurn], a
|
||||||
|
ld [wCurSpace], a
|
||||||
ld a, BOARDEVENT_DISPLAY_MENU
|
ld a, BOARDEVENT_DISPLAY_MENU
|
||||||
ldh [hCurBoardEvent], a
|
ldh [hCurBoardEvent], a
|
||||||
|
; fallthrough
|
||||||
|
|
||||||
|
; on map reload (e.g. after battle), warps and connections
|
||||||
EnterMap:
|
EnterMap:
|
||||||
xor a
|
xor a
|
||||||
ld [wXYComparePointer], a
|
ld [wXYComparePointer], a
|
||||||
|
@ -2496,6 +2496,9 @@ wYCoord:: db
|
|||||||
wXCoord:: db
|
wXCoord:: db
|
||||||
wScreenSave:: ds SCREEN_META_WIDTH * SCREEN_META_HEIGHT
|
wScreenSave:: ds SCREEN_META_WIDTH * SCREEN_META_HEIGHT
|
||||||
|
|
||||||
|
wCurSpace:: db
|
||||||
|
wCurTurn:: db
|
||||||
|
|
||||||
wCurMapDataEnd::
|
wCurMapDataEnd::
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user