summaryrefslogtreecommitdiff
path: root/engine/overworld
diff options
context:
space:
mode:
Diffstat (limited to 'engine/overworld')
-rwxr-xr-xengine/overworld/cable_club_npc.asm21
-rwxr-xr-xengine/overworld/card_key.asm12
-rwxr-xr-xengine/overworld/cinnabar_lab.asm14
-rwxr-xr-xengine/overworld/cut.asm24
-rwxr-xr-xengine/overworld/cut2.asm6
-rwxr-xr-xengine/overworld/doors.asm26
-rwxr-xr-xengine/overworld/elevator.asm8
-rwxr-xr-xengine/overworld/emotion_bubbles.asm16
-rwxr-xr-xengine/overworld/healing_machine.asm10
-rwxr-xr-xengine/overworld/hidden_items.asm39
-rwxr-xr-xengine/overworld/hidden_objects.asm6
-rw-r--r--engine/overworld/is_player_just_outside_map.asm2
-rw-r--r--engine/overworld/item.asm2
-rwxr-xr-xengine/overworld/ledges.asm10
-rwxr-xr-xengine/overworld/map_sprites.asm10
-rw-r--r--engine/overworld/movement.asm69
-rwxr-xr-xengine/overworld/npc_movement.asm42
-rwxr-xr-xengine/overworld/oaks_aide.asm16
-rw-r--r--engine/overworld/oam.asm4
-rwxr-xr-xengine/overworld/pewter_guys.asm8
-rwxr-xr-xengine/overworld/player_animations.asm54
-rwxr-xr-xengine/overworld/pokecenter.asm16
-rwxr-xr-xengine/overworld/pokemart.asm26
-rwxr-xr-xengine/overworld/saffron_guards.asm4
-rwxr-xr-xengine/overworld/ssanne.asm12
-rwxr-xr-xengine/overworld/trainers.asm74
26 files changed, 266 insertions, 265 deletions
diff --git a/engine/overworld/cable_club_npc.asm b/engine/overworld/cable_club_npc.asm
index a2feba06..08067412 100755
--- a/engine/overworld/cable_club_npc.asm
+++ b/engine/overworld/cable_club_npc.asm
@@ -1,4 +1,4 @@
-CableClubNPC: ; 71c5 (1:71c5)
+CableClubNPC:
ld hl, CableClubNPCWelcomeText
call PrintText
CheckEvent EVENT_GOT_POKEDEX
@@ -109,35 +109,36 @@ CableClubNPC: ; 71c5 (1:71c5)
ld [hl], a
jpab LinkMenu
-CableClubNPCAreaReservedFor2FriendsLinkedByCableText: ; 72b3 (1:72b3)
+CableClubNPCAreaReservedFor2FriendsLinkedByCableText:
TX_FAR _CableClubNPCAreaReservedFor2FriendsLinkedByCableText
db "@"
-CableClubNPCWelcomeText: ; 72b8 (1:72b8)
+CableClubNPCWelcomeText:
TX_FAR _CableClubNPCWelcomeText
db "@"
-CableClubNPCPleaseApplyHereHaveToSaveText: ; 72bd (1:72bd)
+CableClubNPCPleaseApplyHereHaveToSaveText:
TX_FAR _CableClubNPCPleaseApplyHereHaveToSaveText
db "@"
-CableClubNPCPleaseWaitText: ; 72c2 (1:72c2)
+CableClubNPCPleaseWaitText:
TX_FAR _CableClubNPCPleaseWaitText
- db $a, "@"
+ TX_DELAY
+ db "@"
-CableClubNPCLinkClosedBecauseOfInactivityText: ; 72c8 (1:72c8)
+CableClubNPCLinkClosedBecauseOfInactivityText:
TX_FAR _CableClubNPCLinkClosedBecauseOfInactivityText
db "@"
-CableClubNPCPleaseComeAgainText: ; 72cd (1:72cd)
+CableClubNPCPleaseComeAgainText:
TX_FAR _CableClubNPCPleaseComeAgainText
db "@"
-CableClubNPCMakingPreparationsText: ; 72d2 (1:72d2)
+CableClubNPCMakingPreparationsText:
TX_FAR _CableClubNPCMakingPreparationsText
db "@"
-CloseLinkConnection: ; 72d7 (1:72d7)
+CloseLinkConnection:
call Delay3
ld a, CONNECTION_NOT_ESTABLISHED
ld [hSerialConnectionStatus], a
diff --git a/engine/overworld/card_key.asm b/engine/overworld/card_key.asm
index 49d99575..35495c82 100755
--- a/engine/overworld/card_key.asm
+++ b/engine/overworld/card_key.asm
@@ -1,4 +1,4 @@
-PrintCardKeyText: ; 52673 (14:6673)
+PrintCardKeyText:
ld hl, SilphCoMapList
ld a, [wCurMap]
ld b, a
@@ -58,7 +58,7 @@ PrintCardKeyText: ; 52673 (14:6673)
ld [hSpriteIndexOrTextID], a
jp PrintPredefTextID
-SilphCoMapList: ; 526e3 (14:66e3)
+SilphCoMapList:
db SILPH_CO_2F
db SILPH_CO_3F
db SILPH_CO_4F
@@ -71,19 +71,19 @@ SilphCoMapList: ; 526e3 (14:66e3)
db SILPH_CO_11F
db $FF
-CardKeySuccessText: ; 526ee (14:66ee)
+CardKeySuccessText:
TX_FAR _CardKeySuccessText1
- db $0b
+ TX_SFX_ITEM_1
TX_FAR _CardKeySuccessText2
db "@"
-CardKeyFailText: ; 526f8 (14:66f8)
+CardKeyFailText:
TX_FAR _CardKeyFailText
db "@"
; d = Y
; e = X
-GetCoordsInFrontOfPlayer: ; 526fd (14:66fd)
+GetCoordsInFrontOfPlayer:
ld a, [wYCoord]
ld d, a
ld a, [wXCoord]
diff --git a/engine/overworld/cinnabar_lab.asm b/engine/overworld/cinnabar_lab.asm
index c83add51..03974684 100755
--- a/engine/overworld/cinnabar_lab.asm
+++ b/engine/overworld/cinnabar_lab.asm
@@ -1,4 +1,4 @@
-GiveFossilToCinnabarLab: ; 61006 (18:5006)
+GiveFossilToCinnabarLab:
ld hl, wd730
set 6, [hl]
xor a
@@ -72,23 +72,23 @@ GiveFossilToCinnabarLab: ; 61006 (18:5006)
call PrintText
ret
-LabFossil_610ae: ; 610ae (18:50ae)
+LabFossil_610ae:
TX_FAR _Lab4Text_610ae
db "@"
-LabFossil_610b3: ; 610b3 (18:50b3)
+LabFossil_610b3:
TX_FAR _Lab4Text_610b3
db "@"
-LabFossil_610b8: ; 610b8 (18:50b8)
+LabFossil_610b8:
TX_FAR _Lab4Text_610b8
db "@"
-LabFossil_610bd: ; 610bd (18:50bd)
+LabFossil_610bd:
TX_FAR _Lab4Text_610bd
db "@"
-PrintFossilsInBag: ; 610c2 (18:50c2)
+PrintFossilsInBag:
; Prints each fossil in the player's bag on a separate line in the menu.
ld hl, wFilteredBagItems
xor a
@@ -112,7 +112,7 @@ PrintFossilsInBag: ; 610c2 (18:50c2)
jr .loop
; loads the names of the fossil item and the resulting mon
-LoadFossilItemAndMonName: ; 610eb (18:50eb)
+LoadFossilItemAndMonName:
ld a, [wFossilMon]
ld [wd11e], a
call GetMonName
diff --git a/engine/overworld/cut.asm b/engine/overworld/cut.asm
index 8a0513b2..f6ae6468 100755
--- a/engine/overworld/cut.asm
+++ b/engine/overworld/cut.asm
@@ -1,4 +1,4 @@
-UsedCut: ; ef54 (3:6f54)
+UsedCut:
xor a
ld [wActionResultOrTookBattleTurn], a ; initialise to failure value
ld a, [wCurMapTileset]
@@ -67,14 +67,14 @@ UsedCut: ; ef54 (3:6f54)
call UpdateSprites
jp RedrawMapView
-UsedCutText: ; eff2 (3:6ff2)
+UsedCutText:
TX_FAR _UsedCutText
db "@"
-InitCutAnimOAM: ; eff7 (3:6ff7)
+InitCutAnimOAM:
xor a
ld [wWhichAnimationOffsets], a
- ld a, $e4
+ ld a, %11100100
ld [rOBP1], a
ld a, [wCutTile]
cp $52
@@ -111,22 +111,22 @@ InitCutAnimOAM: ; eff7 (3:6ff7)
jr nz, .loop
ret
-LoadCutGrassAnimationTilePattern: ; f04c (3:704c)
+LoadCutGrassAnimationTilePattern:
ld de, AnimationTileset2 + $60 ; tile depicting a leaf
lb bc, BANK(AnimationTileset2), $01
jp CopyVideoData
-WriteCutOrBoulderDustAnimationOAMBlock: ; f055 (3:7055)
+WriteCutOrBoulderDustAnimationOAMBlock:
call GetCutOrBoulderDustAnimationOffsets
ld a, $9
ld de, CutOrBoulderDustAnimationTilesAndAttributes
jp WriteOAMBlock
-CutOrBoulderDustAnimationTilesAndAttributes: ; f060 (3:7060)
+CutOrBoulderDustAnimationTilesAndAttributes:
db $FC,$10,$FD,$10
db $FE,$10,$FF,$10
-GetCutOrBoulderDustAnimationOffsets: ; f068 (3:7068)
+GetCutOrBoulderDustAnimationOffsets:
ld hl, wSpriteStateData1 + 4
ld a, [hli] ; player's sprite screen Y position
ld b, a
@@ -157,14 +157,14 @@ GetCutOrBoulderDustAnimationOffsets: ; f068 (3:7068)
ld c, a
ret
-CutAnimationOffsets: ; f08f (3:708f)
+CutAnimationOffsets:
; Each pair represents the x and y pixels offsets from the player of where the cut tree animation should be drawn
db 8, 36 ; player is facing down
db 8, 4 ; player is facing up
db -8, 20 ; player is facing left
db 24, 20 ; player is facing right
-BoulderDustAnimationOffsets: ; f097 (3:7097)
+BoulderDustAnimationOffsets:
; Each pair represents the x and y pixels offsets from the player of where the cut tree animation should be drawn
; These offsets represent 2 blocks away from the player
db 8, 52 ; player is facing down
@@ -172,7 +172,7 @@ BoulderDustAnimationOffsets: ; f097 (3:7097)
db -24, 20 ; player is facing left
db 40, 20 ; player is facing right
-ReplaceTreeTileBlock: ; f09f (3:709f)
+ReplaceTreeTileBlock:
; Determine the address of the tile block that contains the tile in front of the
; player (i.e. where the tree is) and replace it with the corresponding tile
; block that doesn't have the tree.
@@ -248,7 +248,7 @@ ReplaceTreeTileBlock: ; f09f (3:709f)
ld [hl], a
ret
-CutTreeBlockSwaps: ; f100 (3:7100)
+CutTreeBlockSwaps:
; first byte = tileset block containing the cut tree
; second byte = corresponding tileset block after the cut animation happens
db $32, $6D
diff --git a/engine/overworld/cut2.asm b/engine/overworld/cut2.asm
index 1cf832b5..f16fed66 100755
--- a/engine/overworld/cut2.asm
+++ b/engine/overworld/cut2.asm
@@ -1,4 +1,4 @@
-AnimCut: ; 79e96 (1e:5e96)
+AnimCut:
ld a, [wCutTile]
cp $52
jr z, .grass
@@ -43,7 +43,7 @@ AnimCut: ; 79e96 (1e:5e96)
jr nz, .cutGrassLoop
ret
-AnimCutGrass_UpdateOAMEntries: ; 79eed (1e:5eed)
+AnimCutGrass_UpdateOAMEntries:
push bc
ld hl, wOAMBuffer + $91
ld a, 1
@@ -74,7 +74,7 @@ AnimCutGrass_UpdateOAMEntries: ; 79eed (1e:5eed)
jr nz, AnimCutGrass_UpdateOAMEntries
ret
-AnimCutGrass_SwapOAMEntries: ; 79f30 (1e:5f30)
+AnimCutGrass_SwapOAMEntries:
ld hl, wOAMBuffer + $90
ld de, wBuffer
ld bc, $8
diff --git a/engine/overworld/doors.asm b/engine/overworld/doors.asm
index 3145c3c6..c39e096d 100755
--- a/engine/overworld/doors.asm
+++ b/engine/overworld/doors.asm
@@ -1,5 +1,5 @@
; returns whether the player is standing on a door tile in carry
-IsPlayerStandingOnDoorTile: ; 1a609 (6:6609)
+IsPlayerStandingOnDoorTile:
push de
ld hl, DoorTileIDPointers
ld a, [wCurMapTileset]
@@ -25,7 +25,7 @@ IsPlayerStandingOnDoorTile: ; 1a609 (6:6609)
and a
ret
-DoorTileIDPointers: ; 1a62c (6:662c)
+DoorTileIDPointers:
dbw OVERWORLD, OverworldDoorTileIDs
dbw FOREST, ForestDoorTileIDs
dbw MART, MartDoorTileIDs
@@ -41,35 +41,35 @@ DoorTileIDPointers: ; 1a62c (6:662c)
dbw PLATEAU, PlateauDoorTileIDs
db $ff
-OverworldDoorTileIDs: ; 1a654 (6:6654)
+OverworldDoorTileIDs:
db $1B,$58,$00
-ForestDoorTileIDs: ; 1a657 (6:6657)
+ForestDoorTileIDs:
db $3a,$00
-MartDoorTileIDs: ; 1a659 (6:6659)
+MartDoorTileIDs:
db $5e,$00
-HouseDoorTileIDs: ; 1a65b (6:665b)
+HouseDoorTileIDs:
db $54,$00
-TilesetMuseumDoorTileIDs: ; 1a65d (6:665d)
+TilesetMuseumDoorTileIDs:
db $3b,$00
-ShipDoorTileIDs: ; 1a65f (6:665f)
+ShipDoorTileIDs:
db $1e,$00
-LobbyDoorTileIDs: ; 1a661 (6:6661)
+LobbyDoorTileIDs:
db $1c,$38,$1a,$00
-MansionDoorTileIDs: ; 1a665 (6:6665)
+MansionDoorTileIDs:
db $1a,$1c,$53,$00
-LabDoorTileIDs: ; 1a669 (6:6669)
+LabDoorTileIDs:
db $34,$00
-FacilityDoorTileIDs: ; 1a66b (6:666b)
+FacilityDoorTileIDs:
db $43,$58,$1b,$00
-PlateauDoorTileIDs: ; 1a66f (6:666f)
+PlateauDoorTileIDs:
db $3b,$1b,$00
diff --git a/engine/overworld/elevator.asm b/engine/overworld/elevator.asm
index 05a9cc4e..929e4f22 100755
--- a/engine/overworld/elevator.asm
+++ b/engine/overworld/elevator.asm
@@ -1,4 +1,4 @@
-ShakeElevator: ; 7bf15 (1e:7f15)
+ShakeElevator:
ld de, -$20
call ShakeElevatorRedrawRow
ld de, SCREEN_HEIGHT * $20
@@ -34,12 +34,12 @@ ShakeElevator: ; 7bf15 (1e:7f15)
call PlayMusic
.musicLoop
ld a, [wChannelSoundIDs + CH4]
- cp $b9
+ cp SFX_SAFARI_ZONE_PA
jr z, .musicLoop
call UpdateSprites
jp PlayDefaultMusic
-ShakeElevatorRedrawRow: ; 7bf64 (1e:7f64)
+ShakeElevatorRedrawRow:
; This function is used to redraw certain portions of the screen, but it does
; not appear to ever result in any visible effect, so this function seems to
; be pointless.
@@ -56,7 +56,7 @@ ShakeElevatorRedrawRow: ; 7bf64 (1e:7f64)
add hl, de
ld a, h
and $3
- or $98
+ or vBGMap0 / $100
ld d, a
ld a, l
pop hl
diff --git a/engine/overworld/emotion_bubbles.asm b/engine/overworld/emotion_bubbles.asm
index f8665dd6..ac4276bd 100755
--- a/engine/overworld/emotion_bubbles.asm
+++ b/engine/overworld/emotion_bubbles.asm
@@ -1,4 +1,4 @@
-EmotionBubble: ; 17c47 (5:7c47)
+EmotionBubble:
ld a, [wWhichEmotionBubble]
ld c, a
ld b, 0
@@ -17,11 +17,11 @@ EmotionBubble: ; 17c47 (5:7c47)
ld [wUpdateSpritesEnabled], a
ld a, [wd736]
bit 6, a ; are the last 4 OAM entries reserved for a shadow or fishing rod?
- ld hl, wOAMBuffer + $8f
- ld de, wOAMBuffer + $9f
+ ld hl, wOAMBuffer + 4 * 35 + $3 ; $8f
+ ld de, wOAMBuffer + 4 * 39 + $3 ; $9f
jr z, .next
- ld hl, wOAMBuffer + $7f
- ld de, wOAMBuffer + $8f
+ ld hl, wOAMBuffer + 4 * 31 + $3 ; $7f
+ ld de, wOAMBuffer + 4 * 35 + $3 ; $8f
; Copy OAM data 16 bytes forward to make room for emotion bubble OAM data at the
; start of the OAM buffer.
@@ -61,14 +61,14 @@ EmotionBubble: ; 17c47 (5:7c47)
call DelayFrame
jp UpdateSprites
-EmotionBubblesPointerTable: ; 17caf (5:7caf)
+EmotionBubblesPointerTable:
dw EmotionBubbles
dw EmotionBubbles + $40
dw EmotionBubbles + $80
-EmotionBubblesOAM: ; 17cb5 (5:7cb5)
+EmotionBubblesOAM:
db $F8,$00,$F9,$00
db $FA,$00,$FB,$00
-EmotionBubbles: ; 17cbd (5:7cbd)
+EmotionBubbles:
INCBIN "gfx/emotion_bubbles.2bpp"
diff --git a/engine/overworld/healing_machine.asm b/engine/overworld/healing_machine.asm
index bf7130cb..38a44cfb 100755
--- a/engine/overworld/healing_machine.asm
+++ b/engine/overworld/healing_machine.asm
@@ -1,4 +1,4 @@
-AnimateHealingMachine: ; 70433 (1c:4433)
+AnimateHealingMachine:
ld de, PokeCenterFlashingMonitorAndHealBall
ld hl, vChars0 + $7c0
lb bc, BANK(PokeCenterFlashingMonitorAndHealBall), $03 ; loads one too many tiles
@@ -62,10 +62,10 @@ AnimateHealingMachine: ; 70433 (1c:4433)
ld [hl], a
jp UpdateSprites
-PokeCenterFlashingMonitorAndHealBall: ; 704b7 (1c:44b7)
+PokeCenterFlashingMonitorAndHealBall:
INCBIN "gfx/pokecenter_ball.2bpp"
-PokeCenterOAMData: ; 704d7 (1c:44d7)
+PokeCenterOAMData:
db $24,$34,$7C,$10 ; heal machine monitor
db $2B,$30,$7D,$10 ; pokeballs 1-6
db $2B,$38,$7D,$30
@@ -75,7 +75,7 @@ PokeCenterOAMData: ; 704d7 (1c:44d7)
db $35,$38,$7D,$30
; d = value to xor with palette
-FlashSprite8Times: ; 704f3 (1c:44f3)
+FlashSprite8Times:
ld b, 8
.loop
ld a, [rOBP1]
@@ -87,7 +87,7 @@ FlashSprite8Times: ; 704f3 (1c:44f3)
jr nz, .loop
ret
-CopyHealingMachineOAM: ; 70503 (1c:4503)
+CopyHealingMachineOAM:
; copy one OAM entry and advance the pointers
ld a, [de]
inc de
diff --git a/engine/overworld/hidden_items.asm b/engine/overworld/hidden_items.asm
index f7f81070..32783f83 100755
--- a/engine/overworld/hidden_items.asm
+++ b/engine/overworld/hidden_items.asm
@@ -1,4 +1,4 @@
-HiddenItems: ; 76688 (1d:6688)
+HiddenItems:
ld hl, HiddenItemCoords
call FindHiddenItemOrCoinsIndex
ld [wHiddenItemOrCoinsIndex], a
@@ -20,14 +20,14 @@ HiddenItems: ; 76688 (1d:6688)
INCLUDE "data/hidden_item_coords.asm"
-FoundHiddenItemText: ; 7675b (1d:675b)
+FoundHiddenItemText:
TX_FAR _FoundHiddenItemText
TX_ASM
ld a, [wHiddenObjectFunctionArgument] ; item ID
ld b, a
ld c, 1
call GiveItem
- jr nc, .BagFull
+ jr nc, .bagFull
ld hl, wObtainedHiddenItemsFlags
ld a, [wHiddenItemOrCoinsIndex]
ld c, a
@@ -37,7 +37,7 @@ FoundHiddenItemText: ; 7675b (1d:675b)
call PlaySoundWaitForCurrent
call WaitForSoundToFinish
jp TextScriptEnd
-.BagFull
+.bagFull
call WaitForTextScrollButtonPress ; wait for button press
xor a
ld [wDoNotWaitForButtonPressAfterDisplayingText], a
@@ -45,11 +45,11 @@ FoundHiddenItemText: ; 7675b (1d:675b)
call PrintText
jp TextScriptEnd
-HiddenItemBagFullText: ; 76794 (1d:6794)
+HiddenItemBagFullText:
TX_FAR _HiddenItemBagFullText
db "@"
-HiddenCoins: ; 76799 (1d:6799)
+HiddenCoins:
ld b, COIN_CASE
predef GetQuantityOfItemInBag
ld a, b
@@ -77,24 +77,24 @@ HiddenCoins: ; 76799 (1d:6799)
cp 20
jr z, .bcd20
cp 40
- jr z, .bcd20
+ jr z, .bcd20 ; should be bcd40
jr .bcd100
.bcd10
ld a, $10
ld [hCoins + 1], a
- jr .bcddone
+ jr .bcdDone
.bcd20
ld a, $20
ld [hCoins + 1], a
- jr .bcddone
+ jr .bcdDone
.bcd40 ; due to a typo, this is never used
ld a, $40
ld [hCoins + 1], a
- jr .bcddone
+ jr .bcdDone
.bcd100
ld a, $1
ld [hCoins], a
-.bcddone
+.bcdDone
ld de, wPlayerCoins + 1
ld hl, hCoins + 1
ld c, $2
@@ -107,30 +107,31 @@ HiddenCoins: ; 76799 (1d:6799)
call EnableAutoTextBoxDrawing
ld a, [wPlayerCoins]
cp $99
- jr nz, .RoomInCoinCase
+ jr nz, .roomInCoinCase
ld a, [wPlayerCoins + 1]
cp $99
- jr nz, .RoomInCoinCase
+ jr nz, .roomInCoinCase
tx_pre_id DroppedHiddenCoinsText
jr .done
-.RoomInCoinCase
+.roomInCoinCase
tx_pre_id FoundHiddenCoinsText
.done
jp PrintPredefTextID
INCLUDE "data/hidden_coins.asm"
-FoundHiddenCoinsText: ; 76847 (1d:6847)
+FoundHiddenCoinsText:
TX_FAR _FoundHiddenCoinsText
- db $10,"@"
+ TX_SFX_ITEM_2
+ db "@"
-DroppedHiddenCoinsText: ; 7684d (1d:684d)
+DroppedHiddenCoinsText:
TX_FAR _FoundHiddenCoins2Text
- db $10
+ TX_SFX_ITEM_2
TX_FAR _DroppedHiddenCoinsText
db "@"
-FindHiddenItemOrCoinsIndex: ; 76857 (1d:6857)
+FindHiddenItemOrCoinsIndex:
ld a, [wHiddenObjectY]
ld d, a
ld a, [wHiddenObjectX]
diff --git a/engine/overworld/hidden_objects.asm b/engine/overworld/hidden_objects.asm
index 1fc20e5c..dcdf8537 100755
--- a/engine/overworld/hidden_objects.asm
+++ b/engine/overworld/hidden_objects.asm
@@ -1,4 +1,4 @@
-IsPlayerOnDungeonWarp: ; 46981 (11:6981)
+IsPlayerOnDungeonWarp:
xor a
ld [wWhichDungeonWarp], a
ld a, [wd72d]
@@ -15,7 +15,7 @@ IsPlayerOnDungeonWarp: ; 46981 (11:6981)
ret
; if a hidden object was found, stores $00 in [$ffee], else stores $ff
-CheckForHiddenObject: ; 469a0 (11:69a0)
+CheckForHiddenObject:
ld hl, $ffeb
xor a
ld [hli], a
@@ -86,7 +86,7 @@ CheckForHiddenObject: ; 469a0 (11:69a0)
; checks if the coordinates in front of the player's sprite match Y in b and X in c
; [hCoordsInFrontOfPlayerMatch] = $00 if they match, $ff if they don't match
-CheckIfCoordsInFrontOfPlayerMatch: ; 46a01 (11:6a01)
+CheckIfCoordsInFrontOfPlayerMatch:
ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction
cp SPRITE_FACING_UP
jr z, .facingUp
diff --git a/engine/overworld/is_player_just_outside_map.asm b/engine/overworld/is_player_just_outside_map.asm
index e9ba204a..44690db0 100644
--- a/engine/overworld/is_player_just_outside_map.asm
+++ b/engine/overworld/is_player_just_outside_map.asm
@@ -1,5 +1,5 @@
; returns whether the player is one tile outside the map in Z
-IsPlayerJustOutsideMap: ; 128d8 (4:68d8)
+IsPlayerJustOutsideMap:
ld a, [wYCoord]
ld b, a
ld a, [wCurMapHeight]
diff --git a/engine/overworld/item.asm b/engine/overworld/item.asm
index 63eecef9..9f19100a 100644
--- a/engine/overworld/item.asm
+++ b/engine/overworld/item.asm
@@ -46,7 +46,7 @@ PickUpItem:
FoundItemText:
TX_FAR _FoundItemText
- db $0B
+ TX_SFX_ITEM_1
db "@"
NoMoreRoomForItemText:
diff --git a/engine/overworld/ledges.asm b/engine/overworld/ledges.asm
index b04f6332..342540b2 100755
--- a/engine/overworld/ledges.asm
+++ b/engine/overworld/ledges.asm
@@ -1,4 +1,4 @@
-HandleLedges: ; 1a672 (6:6672)
+HandleLedges:
ld a, [wd736]
bit 6, a ; already jumping down ledge
ret nz
@@ -55,7 +55,7 @@ HandleLedges: ; 1a672 (6:6672)
ret
; (player direction) (tile player standing on) (ledge tile) (input required)
-LedgeTiles: ; 1a6cf (6:66cf)
+LedgeTiles:
db SPRITE_FACING_DOWN, $2C,$37,D_DOWN
db SPRITE_FACING_DOWN, $39,$36,D_DOWN
db SPRITE_FACING_DOWN, $39,$37,D_DOWN
@@ -66,7 +66,7 @@ LedgeTiles: ; 1a6cf (6:66cf)
db SPRITE_FACING_RIGHT,$39,$0D,D_RIGHT
db $FF
-LoadHoppingShadowOAM: ; 1a6f0 (6:66f0)
+LoadHoppingShadowOAM:
ld hl, vChars1 + $7f0
ld de, LedgeHoppingShadow
lb bc, BANK(LedgeHoppingShadow), (LedgeHoppingShadowEnd - LedgeHoppingShadow) / $8
@@ -77,10 +77,10 @@ LoadHoppingShadowOAM: ; 1a6f0 (6:66f0)
call WriteOAMBlock
ret
-LedgeHoppingShadow: ; 1a708 (6:6708)
+LedgeHoppingShadow:
INCBIN "gfx/ledge_hopping_shadow.1bpp"
LedgeHoppingShadowEnd:
-LedgeHoppingShadowOAM: ; 1a710 (6:6710)
+LedgeHoppingShadowOAM:
db $FF,$10,$FF,$20
db $FF,$40,$FF,$60
diff --git a/engine/overworld/map_sprites.asm b/engine/overworld/map_sprites.asm
index bdd3320b..05588321 100755
--- a/engine/overworld/map_sprites.asm
+++ b/engine/overworld/map_sprites.asm
@@ -8,7 +8,7 @@
; fields, respectively, within loops. The X is the loop index.
; If there is an inner loop, Y is the inner loop index, i.e. $C1Y* and $C2Y*
; denote fields of the sprite slots interated over in the inner loop.
-InitMapSprites: ; 1785b (5:785b)
+InitMapSprites:
call InitOutsideMapSprites
ret c ; return if the map is an outside map (already handled by above call)
; if the map is an inside map (i.e. mapID >= $25)
@@ -29,7 +29,7 @@ InitMapSprites: ; 1785b (5:785b)
; This is used for both inside and outside maps, since it is called by
; InitOutsideMapSprites.
; Loads tile pattern data for sprites into VRAM.
-LoadMapSpriteTilePatterns: ; 17871 (5:7871)
+LoadMapSpriteTilePatterns:
ld a,[wNumSprites]
and a ; are there any sprites?
jr nz,.spritesExist
@@ -236,7 +236,7 @@ LoadMapSpriteTilePatterns: ; 17871 (5:7871)
; de = pointer to sprite sheet
; bc = length in bytes
; a = ROM bank
-ReadSpriteSheetData: ; 17971 (5:7971)
+ReadSpriteSheetData:
ld a,[hli]
ld e,a
ld a,[hli]
@@ -250,7 +250,7 @@ ReadSpriteSheetData: ; 17971 (5:7971)
; Loads sprite set for outside maps (cities and routes) and sets VRAM slots.
; sets carry if the map is a city or route, unsets carry if not
-InitOutsideMapSprites: ; 1797b (5:797b)
+InitOutsideMapSprites:
ld a,[wCurMap]
cp a,REDS_HOUSE_1F ; is the map a city or a route (map ID less than $25)?
ret nc ; if not, return
@@ -380,7 +380,7 @@ InitOutsideMapSprites: ; 1797b (5:797b)
; Chooses the correct sprite set ID depending on the player's position within
; the map for maps with two sprite sets.
-GetSplitMapSpriteSetID: ; 17a1a (5:7a1a)
+GetSplitMapSpriteSetID:
cp a,$f8
jr z,.route20
ld hl,SplitMapSpriteSets
diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm
index 7f92a243..fc421c81 100644
--- a/engine/overworld/movement.asm
+++ b/engine/overworld/movement.asm
@@ -1,4 +1,4 @@
-UpdatePlayerSprite: ; 4e31 (1:4e31)
+UpdatePlayerSprite:
ld a, [wSpriteStateData2]
and a
jr z, .checkIfTextBoxInFrontOfSprite
@@ -98,7 +98,7 @@ UpdatePlayerSprite: ; 4e31 (1:4e31)
ld [wSpriteStateData2 + 7], a
ret
-UnusedReadSpriteDataFunction: ; 4ec7 (1:4ec7)
+UnusedReadSpriteDataFunction:
push bc
push af
ld a, [H_CURRENTSPRITEOFFSET]
@@ -109,7 +109,7 @@ UnusedReadSpriteDataFunction: ; 4ec7 (1:4ec7)
pop bc
ret
-UpdateNPCSprite: ; 4ed1 (1:4ed1)
+UpdateNPCSprite:
ld a, [H_CURRENTSPRITEOFFSET]
swap a
dec a
@@ -249,7 +249,7 @@ UpdateNPCSprite: ; 4ed1 (1:4ed1)
jr TryWalking
; changes facing direction by zeroing the movement delta and calling TryWalking
-ChangeFacingDirection: ; 4fc8 (1:4fc8)
+ChangeFacingDirection:
ld de, $0
; fall through
@@ -259,7 +259,7 @@ ChangeFacingDirection: ; 4fc8 (1:4fc8)
; e: X movement delta (-1, 0 or 1)
; hl: pointer to tile the sprite would walk onto
; set carry on failure, clears carry on success
-TryWalking: ; 4fcb (1:4fcb)
+TryWalking:
push hl
ld h, $c1
ld a, [H_CURRENTSPRITEOFFSET]
@@ -298,7 +298,7 @@ TryWalking: ; 4fcb (1:4fcb)
jp UpdateSpriteImage
; update the walking animation parameters for a sprite that is currently walking
-UpdateSpriteInWalkingAnimation: ; 4ffe (1:4ffe)
+UpdateSpriteInWalkingAnimation:
ld a, [H_CURRENTSPRITEOFFSET]
add $7
ld l, a
@@ -371,7 +371,7 @@ UpdateSpriteInWalkingAnimation: ; 4ffe (1:4ffe)
ret
; update delay value (c2x8) for sprites in the delayed state (c1x1)
-UpdateSpriteMovementDelay: ; 5057 (1:5057)
+UpdateSpriteMovementDelay:
ld h, $c2
ld a, [H_CURRENTSPRITEOFFSET]
add $6
@@ -392,15 +392,15 @@ UpdateSpriteMovementDelay: ; 5057 (1:5057)
inc a
ld l, a
ld [hl], $1 ; c1x1 = 1 (mark as ready to move)
-notYetMoving: ; 5073 (1:5073)
- ld h, $c1
+notYetMoving:
+ ld h, wSpriteStateData1 / $100
ld a, [H_CURRENTSPRITEOFFSET]
add $8
ld l, a
ld [hl], $0 ; c1x8 = 0 (walk animation frame)
jp UpdateSpriteImage
-MakeNPCFacePlayer: ; 507f (1:507f)
+MakeNPCFacePlayer:
; Make an NPC face the player if the player has spoken to him or her.
; Check if the behaviour of the NPC facing the player when spoken to is
@@ -408,7 +408,6 @@ MakeNPCFacePlayer: ; 507f (1:507f)
ld a, [wd72d]
bit 5, a
jr nz, notYetMoving
-
res 7, [hl]
ld a, [wPlayerDirection]
bit PLAYER_DIR_BIT_UP, a
@@ -434,7 +433,7 @@ MakeNPCFacePlayer: ; 507f (1:507f)
ld [hl], c ; c1x9: set facing direction
jr notYetMoving
-InitializeSpriteStatus: ; 50ad (1:50ad)
+InitializeSpriteStatus:
ld [hl], $1 ; $c1x1: set movement status to ready
inc l
ld [hl], $ff ; $c1x2: set sprite image to $ff (invisible/off screen)
@@ -449,8 +448,8 @@ InitializeSpriteStatus: ; 50ad (1:50ad)
ret
; calculates the spprite's scrren position form its map position and the player position
-InitializeSpriteScreenPosition: ; 50bd (1:50bd)
- ld h, $c2
+InitializeSpriteScreenPosition:
+ ld h, wSpriteStateData2 / $100
ld a, [H_CURRENTSPRITEOFFSET]
add $4
ld l, a
@@ -485,12 +484,12 @@ Func_515D: ; 515D (1:515D)
ret
; tests if sprite is off screen or otherwise unable to do anything
-CheckSpriteAvailability: ; 50dc (1:50dc)
+CheckSpriteAvailability:
predef IsObjectHidden
ld a, [$ffe5]
and a
jp nz, .spriteInvisible
- ld h, $c2
+ ld h, wSpriteStateData2 / $100
ld a, [H_CURRENTSPRITEOFFSET]
add $6
ld l, a
@@ -538,7 +537,7 @@ CheckSpriteAvailability: ; 50dc (1:50dc)
cp d
jr c, .spriteVisible ; standing on tile with ID >=$60 (top right tile)
.spriteInvisible
- ld h, $c1
+ ld h, wSpriteStateData1 / $100
ld a, [H_CURRENTSPRITEOFFSET]
add $2
ld l, a
@@ -566,7 +565,7 @@ CheckSpriteAvailability: ; 50dc (1:50dc)
.done
ret
-UpdateSpriteImage: ; 5157 (1:5157)
+UpdateSpriteImage:
ld h, $c1
ld a, [H_CURRENTSPRITEOFFSET]
add $8
@@ -591,8 +590,8 @@ UpdateSpriteImage: ; 5157 (1:5157)
; d: Y movement delta (-1, 0 or 1)
; e: X movement delta (-1, 0 or 1)
; set carry on failure, clears carry on success
-CanWalkOntoTile: ; 516e (1:516e)
- ld h, $c2
+CanWalkOntoTile:
+ ld h, wSpriteStateData2 / $100
ld a, [H_CURRENTSPRITEOFFSET]
add $6
ld l, a
@@ -603,9 +602,9 @@ CanWalkOntoTile: ; 516e (1:516e)
and a
ret
.notScripted
- ld a, [wTileSetCollisionPtr]
+ ld a, [wTilesetCollisionPtr]
ld l, a
- ld a, [wTileSetCollisionPtr+1]
+ ld a, [wTilesetCollisionPtr+1]
ld h, a
.tilePassableLoop
ld a, [hli]
@@ -620,7 +619,7 @@ CanWalkOntoTile: ; 516e (1:516e)
ld a, [hl] ; $c2x6 (movement byte 1)
inc a
jr z, .impassable ; if $ff, no movement allowed (however, changing direction is)
- ld h, $c1
+ ld h, wSpriteStateData1 / $100
ld a, [H_CURRENTSPRITEOFFSET]
add $4
ld l, a
@@ -639,14 +638,14 @@ CanWalkOntoTile: ; 516e (1:516e)
call DetectCollisionBetweenSprites
pop bc
pop de
- ld h, $c1
+ ld h, wSpriteStateData1 / $100
ld a, [H_CURRENTSPRITEOFFSET]
add $c
ld l, a
ld a, [hl] ; c1xc (directions in which sprite collision would occur)
and b ; check against chosen direction (1,2,4 or 8)
jr nz, .impassable ; collision between sprites, don't go there
- ld h, $c2
+ ld h, wSpriteStateData2 / $100
ld a, [H_CURRENTSPRITEOFFSET]
add $2
ld l, a
@@ -702,8 +701,8 @@ CanWalkOntoTile: ; 516e (1:516e)
; calculates the tile pointer pointing to the tile the current sprite stancs on
; this is always the lower left tile of the 2x2 tile blocks all sprites are snapped to
; hl: output pointer
-GetTileSpriteStandsOn: ; 5207 (1:5207)
- ld h, $c1
+GetTileSpriteStandsOn:
+ ld h, wSpriteStateData1 / $100
ld a, [H_CURRENTSPRITEOFFSET]
add $4
ld l, a
@@ -731,7 +730,7 @@ GetTileSpriteStandsOn: ; 5207 (1:5207)
ret
; loads [de+a] into a
-LoadDEPlusA: ; 522f (1:522f)
+LoadDEPlusA:
add e
ld e, a
jr nc, .noCarry
@@ -740,7 +739,7 @@ LoadDEPlusA: ; 522f (1:522f)
ld a, [de]
ret
-DoScriptedNPCMovement: ; 5236 (1:5236)
+DoScriptedNPCMovement:
; This is an alternative method of scripting an NPC's movement and is only used
; a few times in the game. It is used when the NPC and player must walk together
; in sync, such as when the player is following the NPC somewhere. An NPC can't
@@ -811,23 +810,23 @@ DoScriptedNPCMovement: ; 5236 (1:5236)
inc [hl]
ret
-InitScriptedNPCMovement: ; 52a6 (1:52a6)
+InitScriptedNPCMovement:
xor a
ld [wNPCMovementDirections2Index], a
ld a, 8
ld [wScriptedNPCWalkCounter], a
jp AnimScriptedNPCMovement
-GetSpriteScreenYPointer: ; 52b2 (1:52b2)
+GetSpriteScreenYPointer:
ld a, $4
ld b, a
jr GetSpriteScreenXYPointerCommon
-GetSpriteScreenXPointer: ; 52b7 (1:52b7)
+GetSpriteScreenXPointer:
ld a, $6
ld b, a
-GetSpriteScreenXYPointerCommon: ; 52ba (1:52ba)
+GetSpriteScreenXYPointerCommon:
ld hl, wSpriteStateData1
ld a, [H_CURRENTSPRITEOFFSET]
add l
@@ -835,7 +834,7 @@ GetSpriteScreenXYPointerCommon: ; 52ba (1:52ba)
ld l, a
ret
-AnimScriptedNPCMovement: ; 52c3 (1:52c3)
+AnimScriptedNPCMovement:
ld hl, wSpriteStateData2
ld a, [H_CURRENTSPRITEOFFSET]
add $e
@@ -874,7 +873,7 @@ AnimScriptedNPCMovement: ; 52c3 (1:52c3)
ld [hl], a
ret
-AdvanceScriptedNPCAnimFrameCounter: ; 5301 (1:5301)
+AdvanceScriptedNPCAnimFrameCounter:
ld a, [H_CURRENTSPRITEOFFSET]
add $7
ld l, a
diff --git a/engine/overworld/npc_movement.asm b/engine/overworld/npc_movement.asm
index 719c8835..98d1b7a7 100755
--- a/engine/overworld/npc_movement.asm
+++ b/engine/overworld/npc_movement.asm
@@ -1,4 +1,4 @@
-PlayerStepOutFromDoor: ; 1a3e0 (6:63e0)
+PlayerStepOutFromDoor:
ld hl, wd730
res 1, [hl]
call IsPlayerStandingOnDoorTile
@@ -27,7 +27,7 @@ PlayerStepOutFromDoor: ; 1a3e0 (6:63e0)
res 7, [hl]
ret
-_EndNPCMovementScript: ; 1a41d (6:641d)
+_EndNPCMovementScript:
ld hl, wd730
res 7, [hl]
ld hl, wd72e
@@ -44,14 +44,14 @@ _EndNPCMovementScript: ; 1a41d (6:641d)
ld [wSimulatedJoypadStatesEnd], a
ret
-PalletMovementScriptPointerTable: ; 1a442 (6:6442)
+PalletMovementScriptPointerTable:
dw PalletMovementScript_OakMoveLeft
dw PalletMovementScript_PlayerMoveLeft
dw PalletMovementScript_WaitAndWalkToLab
dw PalletMovementScript_WalkToLab
dw PalletMovementScript_Done
-PalletMovementScript_OakMoveLeft: ; 1a44c (6:644c)
+PalletMovementScript_OakMoveLeft:
ld a, [wXCoord]
sub $a
ld [wNumStepsToTake], a
@@ -85,7 +85,7 @@ PalletMovementScript_OakMoveLeft: ; 1a44c (6:644c)
ld [wJoyIgnore], a
ret
-PalletMovementScript_PlayerMoveLeft: ; 1a485 (6:6485)
+PalletMovementScript_PlayerMoveLeft:
ld a, [wd730]
bit 0, a ; is an NPC being moved by a script?
ret nz ; return if Oak is still moving
@@ -98,12 +98,12 @@ PalletMovementScript_PlayerMoveLeft: ; 1a485 (6:6485)
ld [wNPCMovementScriptFunctionNum], a
ret
-PalletMovementScript_WaitAndWalkToLab: ; 1a4a1 (6:64a1)
+PalletMovementScript_WaitAndWalkToLab:
ld a, [wSimulatedJoypadStatesIndex]
and a ; is the player done moving left yet?
ret nz
-PalletMovementScript_WalkToLab: ; 1a4a6 (6:64a6)
+PalletMovementScript_WalkToLab:
xor a
ld [wOverrideSimulatedJoypadStatesMask], a
ld a, [wSpriteIndex]
@@ -127,7 +127,7 @@ PalletMovementScript_WalkToLab: ; 1a4a6 (6:64a6)
ld [wNPCMovementScriptFunctionNum], a
ret
-RLEList_ProfOakWalkToLab: ; 1a4dc (6:64dc)
+RLEList_ProfOakWalkToLab:
db NPC_MOVEMENT_DOWN, $05
db NPC_MOVEMENT_LEFT, $01
db NPC_MOVEMENT_DOWN, $05
@@ -136,7 +136,7 @@ RLEList_ProfOakWalkToLab: ; 1a4dc (6:64dc)
db $E0, $01 ; stand still
db $FF
-RLEList_PlayerWalkToLab: ; 1a4e9 (6:64e9)
+RLEList_PlayerWalkToLab:
db D_UP, $02
db D_RIGHT, $03
db D_DOWN, $05
@@ -144,7 +144,7 @@ RLEList_PlayerWalkToLab: ; 1a4e9 (6:64e9)
db D_DOWN, $06
db $FF
-PalletMovementScript_Done: ; 1a4f4 (6:64f4)
+PalletMovementScript_Done:
ld a, [wSimulatedJoypadStatesIndex]
and a
ret nz
@@ -157,11 +157,11 @@ PalletMovementScript_Done: ; 1a4f4 (6:64f4)
res 7, [hl]
jp EndNPCMovementScript
-PewterMuseumGuyMovementScriptPointerTable: ; 1a510 (6:6510)
+PewterMuseumGuyMovementScriptPointerTable:
dw PewterMovementScript_WalkToMuseum
dw PewterMovementScript_Done
-PewterMovementScript_WalkToMuseum: ; 1a514 (6:6514)
+PewterMovementScript_WalkToMuseum:
ld a, BANK(Music_MuseumGuy)
ld [wAudioROMBank], a
ld [wAudioSavedROMBank], a
@@ -189,21 +189,21 @@ PewterMovementScript_WalkToMuseum: ; 1a514 (6:6514)
ld [wNPCMovementScriptFunctionNum], a
ret
-RLEList_PewterMuseumPlayer: ; 1a559 (6:6559)
+RLEList_PewterMuseumPlayer:
db 0, $01
db D_UP, $03
db D_LEFT, $0D
db D_UP, $06
db $FF
-RLEList_PewterMuseumGuy: ; 1a562 (6:6562)
+RLEList_PewterMuseumGuy:
db NPC_MOVEMENT_UP, $06
db NPC_MOVEMENT_LEFT, $0D
db NPC_MOVEMENT_UP, $03
db NPC_MOVEMENT_LEFT, $01
db $FF
-PewterMovementScript_Done: ; 1a56b (6:656b)
+PewterMovementScript_Done:
ld a, [wSimulatedJoypadStatesIndex]
and a
ret nz
@@ -213,11 +213,11 @@ PewterMovementScript_Done: ; 1a56b (6:656b)
res 7, [hl]
jp EndNPCMovementScript
-PewterGymGuyMovementScriptPointerTable: ; 1a57d (6:657d)
+PewterGymGuyMovementScriptPointerTable:
dw PewterMovementScript_WalkToGym
dw PewterMovementScript_Done
-PewterMovementScript_WalkToGym: ; 1a581 (6:6581)
+PewterMovementScript_WalkToGym:
ld a, BANK(Music_MuseumGuy)
ld [wAudioROMBank], a
ld [wAudioSavedROMBank], a
@@ -248,7 +248,7 @@ PewterMovementScript_WalkToGym: ; 1a581 (6:6581)
ld [wNPCMovementScriptFunctionNum], a
ret
-RLEList_PewterGymPlayer: ; 1a5cd (6:65cd)
+RLEList_PewterGymPlayer:
db 0, $01
db D_RIGHT, $02
db D_DOWN, $05
@@ -257,7 +257,7 @@ RLEList_PewterGymPlayer: ; 1a5cd (6:65cd)
db D_LEFT, $0F
db $FF
-RLEList_PewterGymGuy: ; 1a5da (6:65da)
+RLEList_PewterGymGuy:
db NPC_MOVEMENT_DOWN, $02
db NPC_MOVEMENT_LEFT, $0F
db NPC_MOVEMENT_UP, $05
@@ -266,7 +266,7 @@ RLEList_PewterGymGuy: ; 1a5da (6:65da)
db NPC_MOVEMENT_RIGHT, $03
db $FF
-FreezeEnemyTrainerSprite: ; 1a5e7 (6:65e7)
+FreezeEnemyTrainerSprite:
ld a, [wCurMap]
cp POKEMONTOWER_7
ret z ; the Rockets on Pokemon Tower 7F leave after battling, so don't freeze them
@@ -285,7 +285,7 @@ FreezeEnemyTrainerSprite: ; 1a5e7 (6:65e7)
ld [H_SPRITEINDEX], a
jp SetSpriteMovementBytesToFF
-RivalIDs: ; 1a605 (6:6605)
+RivalIDs:
db OPP_SONY1
db OPP_SONY2
db OPP_SONY3
diff --git a/engine/overworld/oaks_aide.asm b/engine/overworld/oaks_aide.asm
index 8ac456d2..f5068fda 100755
--- a/engine/overworld/oaks_aide.asm
+++ b/engine/overworld/oaks_aide.asm
@@ -1,4 +1,4 @@
-OaksAideScript: ; 0x59035
+OaksAideScript:
ld hl, OaksAideHiText
call PrintText
call YesNoChoice
@@ -45,27 +45,27 @@ OaksAideScript: ; 0x59035
ld [hOaksAideResult], a
ret
-OaksAideHiText: ; 59091 (16:5091)
+OaksAideHiText:
TX_FAR _OaksAideHiText
db "@"
-OaksAideUhOhText: ; 59096 (16:5096)
+OaksAideUhOhText:
TX_FAR _OaksAideUhOhText
db "@"
-OaksAideComeBackText: ; 5909b (16:509b)
+OaksAideComeBackText:
TX_FAR _OaksAideComeBackText
db "@"
-OaksAideHereYouGoText: ; 590a0 (16:50a0)
+OaksAideHereYouGoText:
TX_FAR _OaksAideHereYouGoText
db "@"
-OaksAideGotItemText: ; 590a5 (16:50a5)
+OaksAideGotItemText:
TX_FAR _OaksAideGotItemText
- db $0b
+ TX_SFX_ITEM_1
db "@"
-OaksAideNoRoomText: ; 590ab (16:50ab)
+OaksAideNoRoomText:
TX_FAR _OaksAideNoRoomText
db "@"
diff --git a/engine/overworld/oam.asm b/engine/overworld/oam.asm
index 41360965..2c2a3dff 100644
--- a/engine/overworld/oam.asm
+++ b/engine/overworld/oam.asm
@@ -6,7 +6,7 @@ PrepareOAMData:
dec a
jr z, .updateEnabled
- cp 0 - 1
+ cp -1
ret nz
ld [wUpdateSpritesEnabled], a
jp HideSprites
@@ -166,7 +166,7 @@ PrepareOAMData:
add hl, de
jr .clear
-GetSpriteScreenXY: ; 4bd1 (1:4bd1)
+GetSpriteScreenXY:
inc e
inc e
ld a, [de] ; c1x4
diff --git a/engine/overworld/pewter_guys.asm b/engine/overworld/pewter_guys.asm
index 543dac91..532fa4bf 100755
--- a/engine/overworld/pewter_guys.asm
+++ b/engine/overworld/pewter_guys.asm
@@ -1,4 +1,4 @@
-PewterGuys: ; 37ca1 (d:7ca1)
+PewterGuys:
ld hl, wSimulatedJoypadStatesEnd
ld a, [wSimulatedJoypadStatesIndex]
dec a ; this decrement causes it to overwrite the last byte before $FF in the list
@@ -48,14 +48,14 @@ PewterGuys: ; 37ca1 (d:7ca1)
inc hl
jr .findMatchingCoordsLoop
-PointerTable_37ce6: ; 37ce6 (d:7ce6)
+PointerTable_37ce6:
dw PewterMuseumGuyCoords
dw PewterGymGuyCoords
; these are the four coordinates of the spaces below, above, to the left and
; to the right of the museum guy, and pointers to different movements for
; the player to make to get positioned before the main movement.
-PewterMuseumGuyCoords: ; 37cea (d:7cea)
+PewterMuseumGuyCoords:
db 18, 27
dw .down
db 16, 27
@@ -78,7 +78,7 @@ PewterMuseumGuyCoords: ; 37cea (d:7cea)
; different movements for the player to make to get positioned before the
; main movement
; $00 is a pause
-PewterGymGuyCoords: ; 37d06 (d:7d06)
+PewterGymGuyCoords:
db 16, 34
dw .one
db 17, 35
diff --git a/engine/overworld/player_animations.asm b/engine/overworld/player_animations.asm
index de36eeaf..a17e67bd 100755
--- a/engine/overworld/player_animations.asm
+++ b/engine/overworld/player_animations.asm
@@ -1,4 +1,4 @@
-EnterMapAnim: ; 70510 (1c:4510)
+EnterMapAnim:
call InitFacingDirectionList
ld a, $ec
ld [wSpriteStateData1 + 4], a ; player's sprite Y screen position
@@ -63,7 +63,7 @@ EnterMapAnim: ; 70510 (1c:4510)
call LoadPlayerSpriteGraphics
jr .restoreDefaultMusic
-FlyAnimationEnterScreenCoords: ; 70592 (1c:4592)
+FlyAnimationEnterScreenCoords:
; y, x pairs
; This is the sequence of screen coordinates used by the overworld
; Fly animation when the player is entering a map.
@@ -80,7 +80,7 @@ FlyAnimationEnterScreenCoords: ; 70592 (1c:4592)
db $3C, $48
db $3C, $40
-PlayerSpinWhileMovingDown: ; 705aa (1c:45aa)
+PlayerSpinWhileMovingDown:
ld hl, wPlayerSpinWhileMovingUpOrDownAnimDeltaY
ld a, $10
ld [hli], a ; wPlayerSpinWhileMovingUpOrDownAnimDeltaY
@@ -90,7 +90,7 @@ PlayerSpinWhileMovingDown: ; 705aa (1c:45aa)
ld [hl], a ; wPlayerSpinWhileMovingUpOrDownAnimFrameDelay
jp PlayerSpinWhileMovingUpOrDown
-_LeaveMapAnim: ; 705ba (1c:45ba)
+_LeaveMapAnim:
call InitFacingDirectionList
call IsPlayerStandingOnWarpPadOrHole
ld a, b
@@ -167,7 +167,7 @@ _LeaveMapAnim: ; 705ba (1c:45ba)
call GBFadeOutToWhite
jp RestoreFacingDirectionAndYScreenPos
-FlyAnimationScreenCoords1: ; 7064f (1c:464f)
+FlyAnimationScreenCoords1:
; y, x pairs
; This is the sequence of screen coordinates used by the first part
; of the Fly overworld animation.
@@ -184,7 +184,7 @@ FlyAnimationScreenCoords1: ; 7064f (1c:464f)
db $2A, $98
db $27, $A0
-FlyAnimationScreenCoords2: ; 70667 (1c:4667)
+FlyAnimationScreenCoords2:
; y, x pairs
; This is the sequence of screen coordinates used by the second part
; of the Fly overworld animation.
@@ -201,7 +201,7 @@ FlyAnimationScreenCoords2: ; 70667 (1c:4667)
db $F0, $00
-LeaveMapThroughHoleAnim: ; 7067d (1c:467d)
+LeaveMapThroughHoleAnim:
ld a, $ff
ld [wUpdateSpritesEnabled], a ; disable UpdateSprites
; shift upper half of player's sprite down 8 pixels and hide lower half
@@ -223,7 +223,7 @@ LeaveMapThroughHoleAnim: ; 7067d (1c:467d)
ld [wUpdateSpritesEnabled], a ; enable UpdateSprites
jp RestoreFacingDirectionAndYScreenPos
-DoFlyAnimation: ; 706ae (1c:46ae)
+DoFlyAnimation:
ld a, [wFlyAnimBirdSpriteImageIndex]
xor $1 ; make the bird flap its wings
ld [wFlyAnimBirdSpriteImageIndex], a
@@ -247,7 +247,7 @@ DoFlyAnimation: ; 706ae (1c:46ae)
jr nz, DoFlyAnimation
ret
-LoadBirdSpriteGraphics: ; 706d7 (1c:46d7)
+LoadBirdSpriteGraphics:
ld de, BirdSprite
ld hl, vNPCSprites
lb bc, BANK(BirdSprite), $0c
@@ -257,7 +257,7 @@ LoadBirdSpriteGraphics: ; 706d7 (1c:46d7)
lb bc, BANK(BirdSprite), $0c
jp CopyVideoData
-InitFacingDirectionList: ; 706ef (1c:46ef)
+InitFacingDirectionList:
ld a, [wSpriteStateData1 + 2] ; player's sprite facing direction (image index is locked to standing images)
ld [wSavedPlayerFacingDirection], a
ld a, [wSpriteStateData1 + 4] ; player's sprite Y screen position
@@ -276,12 +276,12 @@ InitFacingDirectionList: ; 706ef (1c:46ef)
dec hl
ret
-PlayerSpinningFacingOrder: ; 70713 (1c:4713)
+PlayerSpinningFacingOrder:
; The order of the direction the player's sprite is facing when teleporting
; away. Creates a spinning effect.
db SPRITE_FACING_DOWN, SPRITE_FACING_LEFT, SPRITE_FACING_UP, SPRITE_FACING_RIGHT
-SpinPlayerSprite: ; 70717 (1c:4717)
+SpinPlayerSprite:
; copy the current value from the list into the sprite data and rotate the list
ld a, [hl]
ld [wSpriteStateData1 + 2], a ; player's sprite facing direction (image index is locked to standing images)
@@ -295,7 +295,7 @@ SpinPlayerSprite: ; 70717 (1c:4717)
pop hl
ret
-PlayerSpinInPlace: ; 70730 (1c:4730)
+PlayerSpinInPlace:
call SpinPlayerSprite
ld a, [wPlayerSpinInPlaceAnimFrameDelay]
ld c, a
@@ -316,7 +316,7 @@ PlayerSpinInPlace: ; 70730 (1c:4730)
call DelayFrames
jr PlayerSpinInPlace
-PlayerSpinWhileMovingUpOrDown: ; 70755 (1c:4755)
+PlayerSpinWhileMovingUpOrDown:
call SpinPlayerSprite
ld a, [wPlayerSpinWhileMovingUpOrDownAnimDeltaY]
ld c, a
@@ -332,7 +332,7 @@ PlayerSpinWhileMovingUpOrDown: ; 70755 (1c:4755)
call DelayFrames
jr PlayerSpinWhileMovingUpOrDown
-RestoreFacingDirectionAndYScreenPos: ; 70772 (1c:4772)
+RestoreFacingDirectionAndYScreenPos:
ld a, [wSavedPlayerScreenY]
ld [wSpriteStateData1 + 4], a
ld a, [wSavedPlayerFacingDirection]
@@ -340,14 +340,14 @@ RestoreFacingDirectionAndYScreenPos: ; 70772 (1c:4772)
ret
; if SGB, 2 frames, else 3 frames
-GetPlayerTeleportAnimFrameDelay: ; 7077f (1c:477f)
+GetPlayerTeleportAnimFrameDelay:
ld a, [wOnSGB]
xor $1
inc a
inc a
ret
-IsPlayerStandingOnWarpPadOrHole: ; 70787 (1c:4787)
+IsPlayerStandingOnWarpPadOrHole:
ld b, 0
ld hl, .warpPadAndHoleData
ld a, [wCurMapTileset]
@@ -374,21 +374,21 @@ IsPlayerStandingOnWarpPadOrHole: ; 70787 (1c:4787)
ret
; format: db tileset id, tile id, value to be put in [wStandingOnWarpPadOrHole]
-.warpPadAndHoleData: ; 707a9 (1c:47a9)
+.warpPadAndHoleData:
db FACILITY, $20, 1 ; warp pad
db FACILITY, $11, 2 ; hole
db CAVERN, $22, 2 ; hole
db INTERIOR, $55, 1 ; warp pad
db $FF
-FishingAnim: ; 707b6 (1c:47b6)
+FishingAnim:
ld c, 10
call DelayFrames
ld hl, wd736
set 6, [hl] ; reserve the last 4 OAM entries
ld de, RedSprite
ld hl, vNPCSprites
- lb bc, BANK(RedSprite), $0c
+ lb bc, BANK(RedSprite), $c
call CopyVideoData
ld a, $4
ld hl, RedFishingTiles
@@ -462,19 +462,19 @@ FishingAnim: ; 707b6 (1c:47b6)
ld [hl], a
ret
-NoNibbleText: ; 70847 (1c:4847)
+NoNibbleText:
TX_FAR _NoNibbleText
db "@"
-NothingHereText: ; 7084c (1c:484c)
+NothingHereText:
TX_FAR _NothingHereText
db "@"
-ItsABiteText: ; 70851 (1c:4851)
+ItsABiteText:
TX_FAR _ItsABiteText
db "@"
-FishingRodOAM: ; 70856 (1c:4856)
+FishingRodOAM:
; specifies how the fishing rod should be drawn on the screen
; first byte = screen y coordinate
; second byte = screen x coordinate
@@ -485,7 +485,7 @@ FishingRodOAM: ; 70856 (1c:4856)
db $50, $40, $FE, $00 ; player facing left
db $50, $58, $FE, $20 ; player facing right ($20 means "horizontally flip the tile")
-RedFishingTiles: ; 70866 (1c:4866)
+RedFishingTiles:
dw RedFishingTilesFront
db 2, BANK(RedFishingTilesFront)
dw vNPCSprites + $20
@@ -502,7 +502,7 @@ RedFishingTiles: ; 70866 (1c:4866)
db 3, BANK(RedFishingRodTiles)
dw vNPCSprites2 + $7d0
-_HandleMidJump: ; 7087e (1c:487e)
+_HandleMidJump:
ld a, [wPlayerJumpingYScreenCoordsIndex]
ld c, a
inc a
@@ -534,6 +534,6 @@ _HandleMidJump: ; 7087e (1c:487e)
ld [wJoyIgnore], a
ret
-PlayerJumpingYScreenCoords: ; 708ba (1c:48ba)
+PlayerJumpingYScreenCoords:
; Sequence of y screen coordinates for player's sprite when jumping over a ledge.
db $38, $36, $34, $32, $31, $30, $30, $30, $31, $32, $33, $34, $36, $38, $3C, $3C
diff --git a/engine/overworld/pokecenter.asm b/engine/overworld/pokecenter.asm
index f302d994..f26bedf8 100755
--- a/engine/overworld/pokecenter.asm
+++ b/engine/overworld/pokecenter.asm
@@ -1,4 +1,4 @@
-DisplayPokemonCenterDialogue_: ; 6fe6 (1:6fe6)
+DisplayPokemonCenterDialogue_:
call SaveScreenTilesToBuffer1 ; save screen
ld hl, PokemonCenterWelcomeText
call PrintText
@@ -45,24 +45,24 @@ DisplayPokemonCenterDialogue_: ; 6fe6 (1:6fe6)
call PrintText
jp UpdateSprites
-PokemonCenterWelcomeText: ; 705d (1:705d)
+PokemonCenterWelcomeText:
TX_FAR _PokemonCenterWelcomeText
db "@"
-ShallWeHealYourPokemonText: ; 7062 (1:7062)
- db $a
+ShallWeHealYourPokemonText:
+ TX_DELAY
TX_FAR _ShallWeHealYourPokemonText
db "@"
-NeedYourPokemonText: ; 7068 (1:7068)
+NeedYourPokemonText:
TX_FAR _NeedYourPokemonText
db "@"
-PokemonFightingFitText: ; 706d (1:706d)
+PokemonFightingFitText:
TX_FAR _PokemonFightingFitText
db "@"
-PokemonCenterFarewellText: ; 7072 (1:7072)
- db $a
+PokemonCenterFarewellText:
+ TX_DELAY
TX_FAR _PokemonCenterFarewellText
db "@"
diff --git a/engine/overworld/pokemart.asm b/engine/overworld/pokemart.asm
index 725bd6a4..606e0581 100755
--- a/engine/overworld/pokemart.asm
+++ b/engine/overworld/pokemart.asm
@@ -1,4 +1,4 @@
-DisplayPokemartDialogue_: ; 6c20 (1:6c20)
+DisplayPokemartDialogue_:
ld a,[wListScrollOffset]
ld [wSavedListScrollOffset],a
call UpdateSprites
@@ -85,7 +85,7 @@ DisplayPokemartDialogue_: ; 6c20 (1:6c20)
lb bc, 14, 1 ; location that PrintText always prints to, this is useless
call PrintText
coord hl, 14, 7
- lb bc, 08, 15
+ lb bc, 8, 15
ld a,TWO_OPTION_MENU
ld [wTextBoxID],a
call DisplayTextBoxID ; yes/no menu
@@ -227,46 +227,46 @@ DisplayPokemartDialogue_: ; 6c20 (1:6c20)
ld [wListScrollOffset],a
ret
-PokemartBuyingGreetingText: ; 6e0c (1:6e0c)
+PokemartBuyingGreetingText:
TX_FAR _PokemartBuyingGreetingText
db "@"
-PokemartTellBuyPriceText: ; 6e11 (1:6e11)
+PokemartTellBuyPriceText:
TX_FAR _PokemartTellBuyPriceText
db "@"
-PokemartBoughtItemText: ; 6e16 (1:6e16)
+PokemartBoughtItemText:
TX_FAR _PokemartBoughtItemText
db "@"
-PokemartNotEnoughMoneyText: ; 6e1b (1:6e1b)
+PokemartNotEnoughMoneyText:
TX_FAR _PokemartNotEnoughMoneyText
db "@"
-PokemartItemBagFullText: ; 6e20 (1:6e20)
+PokemartItemBagFullText:
TX_FAR _PokemartItemBagFullText
db "@"
-PokemonSellingGreetingText: ; 6e25 (1:6e25)
+PokemonSellingGreetingText:
TX_FAR _PokemonSellingGreetingText
db "@"
-PokemartTellSellPriceText: ; 6e2a (1:6e2a)
+PokemartTellSellPriceText:
TX_FAR _PokemartTellSellPriceText
db "@"
-PokemartItemBagEmptyText: ; 6e2f (1:6e2f)
+PokemartItemBagEmptyText:
TX_FAR _PokemartItemBagEmptyText
db "@"
-PokemartUnsellableItemText: ; 6e34 (1:6e34)
+PokemartUnsellableItemText:
TX_FAR _PokemartUnsellableItemText
db "@"
-PokemartThankYouText: ; 6e39 (1:6e39)
+PokemartThankYouText:
TX_FAR _PokemartThankYouText
db "@"
-PokemartAnythingElseText: ; 6e3e (1:6e3e)
+PokemartAnythingElseText:
TX_FAR _PokemartAnythingElseText
db "@"
diff --git a/engine/overworld/saffron_guards.asm b/engine/overworld/saffron_guards.asm
index c0d6a985..3b26b6f8 100755
--- a/engine/overworld/saffron_guards.asm
+++ b/engine/overworld/saffron_guards.asm
@@ -1,4 +1,4 @@
-RemoveGuardDrink: ; 5a59f (16:659f)
+RemoveGuardDrink:
ld hl, GuardDrinksList
.drinkLoop
ld a, [hli]
@@ -12,5 +12,5 @@ RemoveGuardDrink: ; 5a59f (16:659f)
jr z, .drinkLoop
jpba RemoveItemByID
-GuardDrinksList: ; 5a5b7 (16:65b7)
+GuardDrinksList:
db FRESH_WATER, SODA_POP, LEMONADE, $00
diff --git a/engine/overworld/ssanne.asm b/engine/overworld/ssanne.asm
index e631bbfa..712c53ed 100755
--- a/engine/overworld/ssanne.asm
+++ b/engine/overworld/ssanne.asm
@@ -1,4 +1,4 @@
-AnimateBoulderDust: ; 79f54 (1e:5f54)
+AnimateBoulderDust:
ld a, $1
ld [wWhichAnimationOffsets], a ; select the boulder dust offsets
ld a, [wUpdateSpritesEnabled]
@@ -29,7 +29,7 @@ AnimateBoulderDust: ; 79f54 (1e:5f54)
ld [wUpdateSpritesEnabled], a
jp LoadPlayerSpriteGraphics
-GetMoveBoulderDustFunctionPointer: ; 79f92 (1e:5f92)
+GetMoveBoulderDustFunctionPointer:
ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction
ld hl, MoveBoulderDustFunctionPointerTable
ld c, a
@@ -51,7 +51,7 @@ GetMoveBoulderDustFunctionPointer: ; 79f92 (1e:5f92)
pop hl
ret
-MoveBoulderDustFunctionPointerTable: ; 79fb0 (1e:5fb0)
+MoveBoulderDustFunctionPointerTable:
; facing down
db $FF,$00
dw AdjustOAMBlockYPos
@@ -68,7 +68,7 @@ MoveBoulderDustFunctionPointerTable: ; 79fb0 (1e:5fb0)
db $FF,$01
dw AdjustOAMBlockXPos
-LoadSmokeTileFourTimes: ; 79fc0 (1e:5fc0)
+LoadSmokeTileFourTimes:
ld hl, vChars1 + $7c0
ld c, $4
.loop
@@ -83,11 +83,11 @@ LoadSmokeTileFourTimes: ; 79fc0 (1e:5fc0)
jr nz, .loop
ret
-LoadSmokeTile: ; 79fd4 (1e:5fd4)
+LoadSmokeTile:
ld de, SSAnneSmokePuffTile
lb bc, BANK(SSAnneSmokePuffTile), (SSAnneSmokePuffTileEnd - SSAnneSmokePuffTile) / $10
jp CopyVideoData
-SSAnneSmokePuffTile: ; 79fdd (1e:5fdd)
+SSAnneSmokePuffTile:
INCBIN "gfx/ss_anne_smoke_puff.2bpp"
SSAnneSmokePuffTileEnd:
diff --git a/engine/overworld/trainers.asm b/engine/overworld/trainers.asm
index 66ae20ce..655c6b2a 100755
--- a/engine/overworld/trainers.asm
+++ b/engine/overworld/trainers.asm
@@ -1,23 +1,23 @@
-_GetSpritePosition1: ; 567f9 (15:67f9)
+_GetSpritePosition1:
ld hl, wSpriteStateData1
ld de, $4
ld a, [wSpriteIndex]
ld [H_SPRITEINDEX], a
call GetSpriteDataPointer
- ld a, [hli]
+ ld a, [hli] ; c1x4 (screen Y pos)
ld [$ffeb], a
inc hl
- ld a, [hl]
+ ld a, [hl] ; c1x6 (screen X pos)
ld [$ffec], a
- ld de, $fe
+ ld de, (wSpriteStateData2 + $4) - (wSpriteStateData1 + $6)
add hl, de
- ld a, [hli]
+ ld a, [hli] ; c2x4 (map Y pos)
ld [$ffed], a
- ld a, [hl]
+ ld a, [hl] ; c2x5 (map X pos)
ld [$ffee], a
ret
-_GetSpritePosition2: ; 56819 (15:6819)
+_GetSpritePosition2:
ld hl, wSpriteStateData1
ld de, $4
ld a, [wSpriteIndex]
@@ -28,7 +28,7 @@ _GetSpritePosition2: ; 56819 (15:6819)
inc hl
ld a, [hl] ; c1x6 (screen X pos)
ld [wSavedSpriteScreenX], a
- ld de, $104 - $6
+ ld de, (wSpriteStateData2 + $4) - (wSpriteStateData1 + $6)
add hl, de
ld a, [hli] ; c2x4 (map Y pos)
ld [wSavedSpriteMapY], a
@@ -36,7 +36,7 @@ _GetSpritePosition2: ; 56819 (15:6819)
ld [wSavedSpriteMapX], a
ret
-_SetSpritePosition1: ; 5683d (15:683d)
+_SetSpritePosition1:
ld hl, wSpriteStateData1
ld de, $4
ld a, [wSpriteIndex]
@@ -47,7 +47,7 @@ _SetSpritePosition1: ; 5683d (15:683d)
inc hl
ld a, [$ffec] ; c1x6 (screen X pos)
ld [hl], a
- ld de, $104 - $6
+ ld de, (wSpriteStateData2 + $4) - (wSpriteStateData1 + $6)
add hl, de
ld a, [$ffed] ; c2x4 (map Y pos)
ld [hli], a
@@ -55,36 +55,36 @@ _SetSpritePosition1: ; 5683d (15:683d)
ld [hl], a
ret
-_SetSpritePosition2: ; 5685d (15:685d)
+_SetSpritePosition2:
ld hl, wSpriteStateData1
- ld de, $0004
+ ld de, 4
ld a, [wSpriteIndex]
ld [H_SPRITEINDEX], a
call GetSpriteDataPointer
ld a, [wSavedSpriteScreenY]
- ld [hli], a
+ ld [hli], a ; c1x4 (screen Y pos)
inc hl
ld a, [wSavedSpriteScreenX]
- ld [hl], a
- ld de, $00fe
+ ld [hl], a ; c1x6 (screen X pos)
+ ld de, (wSpriteStateData2 + $4) - (wSpriteStateData1 + $6)
add hl, de
ld a, [wSavedSpriteMapY]
- ld [hli], a
+ ld [hli], a ; c2x4 (map Y pos)
ld a, [wSavedSpriteMapX]
- ld [hl], a
+ ld [hl], a ; c2x5 (map X pos)
ret
-TrainerWalkUpToPlayer: ; 56881 (15:6881)
+TrainerWalkUpToPlayer:
ld a, [wSpriteIndex]
swap a
ld [wTrainerSpriteOffset], a
call ReadTrainerScreenPosition
ld a, [wTrainerFacingDirection]
- and a
+ and a ; SPRITE_FACING_DOWN
jr z, .facingDown
- cp $4
+ cp SPRITE_FACING_UP
jr z, .facingUp
- cp $8
+ cp SPRITE_FACING_LEFT
jr z, .facingLeft
jr .facingRight
.facingDown
@@ -148,8 +148,8 @@ TrainerWalkUpToPlayer: ; 56881 (15:6881)
jp MoveSprite_
; input: de = offset within sprite entry
-; output: de = pointer to sprite data
-GetSpriteDataPointer: ; 56903 (15:6903)
+; output: hl = pointer to sprite data
+GetSpriteDataPointer:
push de
add hl, de
ld a, [H_SPRITEINDEX]
@@ -161,7 +161,7 @@ GetSpriteDataPointer: ; 56903 (15:6903)
ret
; tests if this trainer is in the right position to engage the player and do so if she is.
-TrainerEngage: ; 5690f (15:690f)
+TrainerEngage:
push hl
push de
ld a, [wTrainerSpriteOffset]
@@ -225,21 +225,21 @@ TrainerEngage: ; 5690f (15:690f)
set 0, [hl]
call EngageMapTrainer
ld a, $ff
-.noEngage: ; 56988 (15:6988)
+.noEngage
ld [wTrainerSpriteOffset], a
pop de
pop hl
ret
; reads trainer's Y position to wTrainerScreenY and X position to wTrainerScreenX
-ReadTrainerScreenPosition: ; 5698e (15:698e)
+ReadTrainerScreenPosition:
ld a, [wTrainerSpriteOffset]
add $4
ld d, $0
ld e, a
ld hl, wSpriteStateData1
add hl, de
- ld a, [hl]
+ ld a, [hl] ; c1x4 (sprite Y pos)
ld [wTrainerScreenY], a
ld a, [wTrainerSpriteOffset]
add $6
@@ -247,14 +247,14 @@ ReadTrainerScreenPosition: ; 5698e (15:698e)
ld e, a
ld hl, wSpriteStateData1
add hl, de
- ld a, [hl]
+ ld a, [hl] ; c1x6 (sprite X pos)
ld [wTrainerScreenX], a
ret
; checks if the sprite is properly lined up with the player with respect to the direction it's looking. Also checks the distance between player and sprite
; note that this does not necessarily mean the sprite is seeing the player, he could be behind it's back
; a: distance player to sprite
-CheckSpriteCanSeePlayer: ; 569af (15:69af)
+CheckSpriteCanSeePlayer:
ld b, a
ld a, [wTrainerEngageDistance] ; how far the trainer can see
cp b
@@ -262,13 +262,13 @@ CheckSpriteCanSeePlayer: ; 569af (15:69af)
jr .notInLine ; player too far away
.checkIfLinedUp
ld a, [wTrainerFacingDirection] ; sprite facing direction
- cp $0 ; down
+ cp SPRITE_FACING_DOWN
jr z, .checkXCoord
- cp $4 ; up
+ cp SPRITE_FACING_UP
jr z, .checkXCoord
- cp $8 ; left
+ cp SPRITE_FACING_LEFT
jr z, .checkYCoord
- cp $c ; right
+ cp SPRITE_FACING_RIGHT
jr z, .checkYCoord
jr .notInLine
.checkXCoord
@@ -290,7 +290,7 @@ CheckSpriteCanSeePlayer: ; 569af (15:69af)
ret
; tests if the player is in front of the sprite (rather than behind it)
-CheckPlayerIsInFrontOfSprite: ; 569e3 (15:69e3)
+CheckPlayerIsInFrontOfSprite:
ld a, [wCurMap]
cp POWER_PLANT
jp z, .engage ; bypass this for power plant to get voltorb fake items to work
@@ -315,21 +315,21 @@ CheckPlayerIsInFrontOfSprite: ; 569e3 (15:69e3)
ld a, [hl] ; c1x6 (sprite screen X pos)
ld [wTrainerScreenX], a
ld a, [wTrainerFacingDirection] ; facing direction
- cp $0
+ cp SPRITE_FACING_DOWN
jr nz, .notFacingDown
ld a, [wTrainerScreenY] ; sprite screen Y pos
cp $3c
jr c, .engage ; sprite above player
jr .noEngage ; sprite below player
.notFacingDown
- cp $4
+ cp SPRITE_FACING_UP
jr nz, .notFacingUp
ld a, [wTrainerScreenY] ; sprite screen Y pos
cp $3c
jr nc, .engage ; sprite below player
jr .noEngage ; sprite above player
.notFacingUp
- cp $8
+ cp SPRITE_FACING_LEFT
jr nz, .notFacingLeft
ld a, [wTrainerScreenX] ; sprite screen X pos
cp $40