aboutsummaryrefslogtreecommitdiffstats
path: root/engine/overworld
diff options
context:
space:
mode:
authorSatoMew <SatoMew@users.noreply.github.com>2023-07-15 23:36:59 +0100
committerGitHub <noreply@github.com>2023-07-15 18:36:59 -0400
commitf46db37d508f0111ad44ad062ed3d83ba3282d1d (patch)
tree170af31852384f5a207918decf05e45a837d95d1 /engine/overworld
parentAdd macros, constants, and labels for map scripts and text (#367) (diff)
downloadpokeyellow-f46db37d508f0111ad44ad062ed3d83ba3282d1d.tar.gz
pokeyellow-f46db37d508f0111ad44ad062ed3d83ba3282d1d.tar.xz
pokeyellow-f46db37d508f0111ad44ad062ed3d83ba3282d1d.zip
Thoroughly document debug code (#410)
Diffstat (limited to 'engine/overworld')
-rw-r--r--engine/overworld/special_warps.asm61
1 files changed, 30 insertions, 31 deletions
diff --git a/engine/overworld/special_warps.asm b/engine/overworld/special_warps.asm
index 61356a03..c538938b 100644
--- a/engine/overworld/special_warps.asm
+++ b/engine/overworld/special_warps.asm
@@ -1,60 +1,60 @@
-SpecialWarpIn::
+PrepareForSpecialWarp::
call LoadSpecialWarpData
predef LoadTilesetHeader
ld hl, wd732
bit 2, [hl] ; dungeon warp or fly warp?
res 2, [hl]
- jr z, .next
-; if dungeon warp or fly warp
+ jr z, .debugNewGameWarp
ld a, [wDestinationMap]
- jr .next2
+ jr .next
+.debugNewGameWarp
+ bit BIT_DEBUG_MODE, [hl]
+ jr z, .setNewGameMatWarp ; apply to StartNewGameDebug only
+ call PrepareNewGameDebug
+.setNewGameMatWarp
+ ; This is called by OakSpeech during StartNewGame and
+ ; loads the first warp event for the specified map index.
+ ld a, PALLET_TOWN
.next
- bit 1, [hl]
- jr z, .next3
- call DebugStart
-.next3
- ld a, 0
-.next2
ld b, a
ld a, [wd72d]
and a
- jr nz, .next4
+ jr nz, .next2
ld a, b
-.next4
+.next2
ld hl, wd732
- bit 4, [hl] ; dungeon warp?
+ bit 4, [hl] ; dungeon warp
ret nz
-; if not dungeon warp
ld [wLastMap], a
ret
-; gets the map ID, tile block map view pointer, tileset, and coordinates
LoadSpecialWarpData:
ld a, [wd72d]
cp TRADE_CENTER
jr nz, .notTradeCenter
- ld hl, TradeCenterSpec1
+ ld hl, TradeCenterPlayerWarp
ldh a, [hSerialConnectionStatus]
- cp USING_INTERNAL_CLOCK ; which gameboy is clocking determines who is on the left and who is on the right
+ cp USING_INTERNAL_CLOCK
jr z, .copyWarpData
- ld hl, TradeCenterSpec2
+ ld hl, TradeCenterFriendWarp
jr .copyWarpData
.notTradeCenter
cp COLOSSEUM
jr nz, .notColosseum
- ld hl, ColosseumSpec1
+ ld hl, ColosseumPlayerWarp
ldh a, [hSerialConnectionStatus]
cp USING_INTERNAL_CLOCK
jr z, .copyWarpData
- ld hl, ColosseumSpec2
+ ld hl, ColosseumFriendWarp
jr .copyWarpData
.notColosseum
ld a, [wd732]
- bit 1, a
- jr nz, .notFirstMap
+ bit BIT_DEBUG_MODE, a
+ ; warp to wLastMap (PALLET_TOWN) for StartNewGameDebug
+ jr nz, .notNewGameWarp
bit 2, a
- jr nz, .notFirstMap
- ld hl, FirstMapSpec
+ jr nz, .notNewGameWarp
+ ld hl, NewGameWarp
.copyWarpData
ld de, wCurMap
ld c, $7
@@ -68,18 +68,17 @@ LoadSpecialWarpData:
ld [wCurMapTileset], a
xor a
jr .done
-.notFirstMap
+.notNewGameWarp
ld a, [wLastMap] ; this value is overwritten before it's ever read
ld hl, wd732
- bit 4, [hl] ; used dungeon warp (jumped down hole/waterfall)?
- jr nz, .usedDunegonWarp
- bit 6, [hl] ; return to last pokemon center (or player's house)?
+ bit 4, [hl] ; dungeon warp
+ jr nz, .usedDungeonWarp
+ bit 6, [hl] ; blacked out
res 6, [hl]
jr z, .otherDestination
-; return to last pokemon center or player's house
ld a, [wLastBlackoutMap]
jr .usedFlyWarp
-.usedDunegonWarp
+.usedDungeonWarp
ld hl, wd72d
res 4, [hl]
ld a, [wDungeonWarpDestinationMap]
@@ -142,7 +141,7 @@ LoadSpecialWarpData:
.done
ld [wYOffsetSinceLastSpecialWarp], a
ld [wXOffsetSinceLastSpecialWarp], a
- ld a, $ff ; the player's coordinates have already been updated using a special warp, so don't use any of the normal warps
+ ld a, -1 ; exclude normal warps
ld [wDestinationWarpID], a
ret