mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-11-16 11:27:33 -08:00
Ensure anchor points are applied when landing after warp by creating a new setup script
This commit is contained in:
parent
429aad6798
commit
af9ab166c4
@ -53,3 +53,4 @@ MapSetupCommands:
|
||||
add_mapsetup EnableOverworldHUD ; 2e
|
||||
add_mapsetup SpawnInCustomFacing ; 2f
|
||||
add_mapsetup ResetLevelScopedEventFlags ; 30
|
||||
add_mapsetup AnchorPointAfterWarp ; 31
|
||||
|
@ -78,6 +78,7 @@ MapSetupScript_Warp:
|
||||
mapsetup FadeInPalettesFromWhite
|
||||
mapsetup ActivateMapAnims
|
||||
mapsetup LoadWildMonData
|
||||
mapsetup AnchorPointAfterWarp
|
||||
db -1 ; end
|
||||
|
||||
MapSetupScript_BadWarp:
|
||||
@ -102,6 +103,7 @@ MapSetupScript_BadWarp:
|
||||
mapsetup FadeInPalettesFromWhite
|
||||
mapsetup ActivateMapAnims
|
||||
mapsetup LoadWildMonData
|
||||
mapsetup AnchorPointAfterWarp
|
||||
db -1 ; end
|
||||
|
||||
MapSetupScript_Connection:
|
||||
@ -147,6 +149,7 @@ MapSetupScript_Train:
|
||||
mapsetup ActivateMapAnims
|
||||
mapsetup LoadWildMonData
|
||||
mapsetup UpdateRoamMons
|
||||
mapsetup AnchorPointAfterWarp
|
||||
db -1 ; end
|
||||
|
||||
MapSetupScript_ReloadMap:
|
||||
|
2
engine/board/menu.asm
Executable file → Normal file
2
engine/board/menu.asm
Executable file → Normal file
@ -93,7 +93,7 @@ BoardMenuScript::
|
||||
res 2, [hl]
|
||||
ld a, BOARDEVENT_VIEW_MAP_MODE
|
||||
ldh [hCurBoardEvent], a
|
||||
ld a, TRUE
|
||||
ld a, 100
|
||||
ld [wViewMapModeRange], a
|
||||
ld a, [wMapGroup]
|
||||
ld [wBeforeViewMapMapGroup], a
|
||||
|
2
engine/board/spaces.asm
Executable file → Normal file
2
engine/board/spaces.asm
Executable file → Normal file
@ -271,7 +271,7 @@ PromptPlayerToChooseBranchDirection:
|
||||
.EnterViewMapMode:
|
||||
ld a, BOARDEVENT_VIEW_MAP_MODE
|
||||
ldh [hCurBoardEvent], a
|
||||
ld a, TRUE
|
||||
ld a, 100
|
||||
ld [wViewMapModeRange], a
|
||||
ld a, [wMapGroup]
|
||||
ld [wBeforeViewMapMapGroup], a
|
||||
|
@ -412,3 +412,24 @@ GetMapScreenCoords::
|
||||
and 1
|
||||
ld [wPlayerMetatileX], a
|
||||
ret
|
||||
|
||||
AnchorPointAfterWarp:
|
||||
; if wCurSpaceNextSpace is not an anchor point, override any anchor point we pass through
|
||||
ld a, [wCurSpaceNextSpace]
|
||||
cp NEXT_SPACE_IS_ANCHOR_POINT
|
||||
ret c
|
||||
ld a, [wCurMapAnchorEventCount]
|
||||
and a
|
||||
ret z
|
||||
; if we have arrived to an anchor point, load its associated next space to wCurSpaceNextSpace right now.
|
||||
; note that the next space of an anchor point could be another anchor point.
|
||||
ld c, a
|
||||
ld hl, wCurMapAnchorEventsPointer
|
||||
ld a, [hli]
|
||||
ld h, [hl]
|
||||
ld l, a
|
||||
ld a, [wXCoord]
|
||||
ld d, a
|
||||
ld a, [wYCoord]
|
||||
ld e, a
|
||||
jp CheckAndApplyAnchorPoint
|
||||
|
@ -1807,7 +1807,7 @@ CheckAndApplyAnchorPoint::
|
||||
; e = [wYCoord]
|
||||
; hl = [wCurMapAnchorEventsPointer]
|
||||
; if currently at coords of any anchor point, copy its next space byte to wCurSpaceNextSpace.
|
||||
; return carry if anchor point matched, nc otherwise.
|
||||
; return nc if anchor point matched, carry otherwise.
|
||||
ldh a, [hROMBank]
|
||||
push af
|
||||
call SwitchToMapScriptsBank
|
||||
|
Loading…
Reference in New Issue
Block a user