summaryrefslogtreecommitdiff
path: root/engine/overworld
diff options
context:
space:
mode:
Diffstat (limited to 'engine/overworld')
-rwxr-xr-xengine/overworld/card_key.asm12
-rwxr-xr-xengine/overworld/cinnabar_lab.asm26
-rwxr-xr-xengine/overworld/cut.asm12
-rwxr-xr-xengine/overworld/doors.asm2
-rwxr-xr-xengine/overworld/elevator.asm2
-rwxr-xr-xengine/overworld/emotion_bubbles.asm2
-rwxr-xr-xengine/overworld/healing_machine.asm42
-rwxr-xr-xengine/overworld/hidden_items.asm4
-rwxr-xr-xengine/overworld/hidden_objects.asm14
-rw-r--r--engine/overworld/is_player_just_outside_map.asm8
-rw-r--r--engine/overworld/item.asm4
-rwxr-xr-xengine/overworld/ledges.asm5
-rwxr-xr-xengine/overworld/map_sprites.asm28
-rw-r--r--engine/overworld/movement.asm29
-rwxr-xr-xengine/overworld/npc_movement.asm24
-rwxr-xr-xengine/overworld/oaks_aide.asm34
-rwxr-xr-xengine/overworld/pewter_guys.asm4
-rwxr-xr-xengine/overworld/player_animations.asm4
-rwxr-xr-xengine/overworld/pokecenter.asm12
-rwxr-xr-xengine/overworld/ssanne.asm3
-rwxr-xr-xengine/overworld/trainers.asm2
21 files changed, 140 insertions, 133 deletions
diff --git a/engine/overworld/card_key.asm b/engine/overworld/card_key.asm
index cc9fe3a7..49d99575 100755
--- a/engine/overworld/card_key.asm
+++ b/engine/overworld/card_key.asm
@@ -1,6 +1,6 @@
PrintCardKeyText: ; 52673 (14:6673)
ld hl, SilphCoMapList
- ld a, [W_CURMAP]
+ ld a, [wCurMap]
ld b, a
.silphCoMapListLoop
ld a, [hli]
@@ -15,7 +15,7 @@ PrintCardKeyText: ; 52673 (14:6673)
cp $24
jr z, .cardKeyDoorInFrontOfPlayer
ld b, a
- ld a, [W_CURMAP]
+ ld a, [wCurMap]
cp SILPH_CO_11F
ret nz
ld a, b
@@ -39,7 +39,7 @@ PrintCardKeyText: ; 52673 (14:6673)
ld a, e
ld c, a
ld [wCardKeyDoorX], a
- ld a, [W_CURMAP]
+ ld a, [wCurMap]
cp SILPH_CO_11F
jr nz, .notSilphCo11F
ld a, $3
@@ -49,7 +49,7 @@ PrintCardKeyText: ; 52673 (14:6673)
.replaceCardKeyDoorTileBlock
ld [wNewTileBlockID], a
predef ReplaceTileBlock
- ld hl, wd126
+ ld hl, wCurrentMapScriptFlags
set 5, [hl]
ld a, SFX_GO_INSIDE
jp PlaySound
@@ -84,9 +84,9 @@ CardKeyFailText: ; 526f8 (14:66f8)
; d = Y
; e = X
GetCoordsInFrontOfPlayer: ; 526fd (14:66fd)
- ld a, [W_YCOORD]
+ ld a, [wYCoord]
ld d, a
- ld a, [W_XCOORD]
+ ld a, [wXCoord]
ld e, a
ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction
and a
diff --git a/engine/overworld/cinnabar_lab.asm b/engine/overworld/cinnabar_lab.asm
index 5337255c..f7c5e326 100755
--- a/engine/overworld/cinnabar_lab.asm
+++ b/engine/overworld/cinnabar_lab.asm
@@ -5,14 +5,14 @@ GiveFossilToCinnabarLab: ; 61006 (18:5006)
ld [wCurrentMenuItem], a
ld a, A_BUTTON | B_BUTTON
ld [wMenuWatchedKeys], a
- ld a, [wcd37]
+ ld a, [wFilteredBagItemsCount]
dec a
ld [wMaxMenuItem], a
ld a, 2
ld [wTopMenuItemY], a
ld a, 1
ld [wTopMenuItemX], a
- ld a, [wcd37]
+ ld a, [wFilteredBagItemsCount]
dec a
ld bc, 2
ld hl, 3
@@ -29,9 +29,9 @@ GiveFossilToCinnabarLab: ; 61006 (18:5006)
call HandleMenuInput
bit 1, a ; pressed B?
jr nz, .cancelledGivingFossil
- ld hl, wcc5b
+ ld hl, wFilteredBagItems
ld a, [wCurrentMenuItem]
- ld d, $0
+ ld d, 0
ld e, a
add hl, de
ld a, [hl]
@@ -48,9 +48,9 @@ GiveFossilToCinnabarLab: ; 61006 (18:5006)
.choseDomeFossil
ld b, KABUTO
.fossilSelected
- ld [W_FOSSILITEM], a
+ ld [wFossilItem], a
ld a, b
- ld [W_FOSSILMON], a
+ ld [wFossilMon], a
call LoadFossilItemAndMonName
ld hl, LabFossil_610ae
call PrintText
@@ -60,7 +60,7 @@ GiveFossilToCinnabarLab: ; 61006 (18:5006)
jr nz, .cancelledGivingFossil
ld hl, LabFossil_610b3
call PrintText
- ld a, [W_FOSSILITEM]
+ ld a, [wFossilItem]
ld [hItemToRemoveID], a
callba RemoveItemByID
ld hl, LabFossil_610b8
@@ -90,9 +90,9 @@ LabFossil_610bd: ; 610bd (18:50bd)
PrintFossilsInBag: ; 610c2 (18:50c2)
; Prints each fossil in the player's bag on a separate line in the menu.
- ld hl, wcc5b
+ ld hl, wFilteredBagItems
xor a
- ld [hFossilCounter], a
+ ld [hItemCounter], a
.loop
ld a, [hli]
cp $ff
@@ -101,23 +101,23 @@ PrintFossilsInBag: ; 610c2 (18:50c2)
ld [wd11e], a
call GetItemName
coord hl, 2, 2
- ld a, [hFossilCounter]
+ ld a, [hItemCounter]
ld bc, SCREEN_WIDTH * 2
call AddNTimes
ld de, wcd6d
call PlaceString
- ld hl, hFossilCounter
+ ld hl, hItemCounter
inc [hl]
pop hl
jr .loop
; loads the names of the fossil item and the resulting mon
LoadFossilItemAndMonName: ; 610eb (18:50eb)
- ld a, [W_FOSSILMON]
+ ld a, [wFossilMon]
ld [wd11e], a
call GetMonName
call CopyStringToCF4B
- ld a, [W_FOSSILITEM]
+ ld a, [wFossilItem]
ld [wd11e], a
call GetItemName
ret
diff --git a/engine/overworld/cut.asm b/engine/overworld/cut.asm
index 30aedbc1..8a0513b2 100755
--- a/engine/overworld/cut.asm
+++ b/engine/overworld/cut.asm
@@ -1,7 +1,7 @@
UsedCut: ; ef54 (3:6f54)
xor a
ld [wActionResultOrTookBattleTurn], a ; initialise to failure value
- ld a, [W_CURMAPTILESET]
+ ld a, [wCurMapTileset]
and a ; OVERWORLD
jr z, .overworld
cp GYM
@@ -177,7 +177,7 @@ ReplaceTreeTileBlock: ; f09f (3:709f)
; player (i.e. where the tree is) and replace it with the corresponding tile
; block that doesn't have the tree.
push de
- ld a, [W_CURMAPWIDTH]
+ ld a, [wCurMapWidth]
add 6
ld c, a
ld b, 0
@@ -195,22 +195,22 @@ ReplaceTreeTileBlock: ; f09f (3:709f)
cp SPRITE_FACING_LEFT
jr z, .left
; right
- ld a, [W_XBLOCKCOORD]
+ ld a, [wXBlockCoord]
and a
jr z, .centerTileBlock
jr .rightOfCenter
.down
- ld a, [W_YBLOCKCOORD]
+ ld a, [wYBlockCoord]
and a
jr z, .centerTileBlock
jr .belowCenter
.up
- ld a, [W_YBLOCKCOORD]
+ ld a, [wYBlockCoord]
and a
jr z, .aboveCenter
jr .centerTileBlock
.left
- ld a, [W_XBLOCKCOORD]
+ ld a, [wXBlockCoord]
and a
jr z, .leftOfCenter
jr .centerTileBlock
diff --git a/engine/overworld/doors.asm b/engine/overworld/doors.asm
index 641c021f..6b0c0464 100755
--- a/engine/overworld/doors.asm
+++ b/engine/overworld/doors.asm
@@ -2,7 +2,7 @@
IsPlayerStandingOnDoorTile: ; 1a609 (6:6609)
push de
ld hl, DoorTileIDPointers
- ld a, [W_CURMAPTILESET]
+ ld a, [wCurMapTileset]
ld de, $3
call IsInArray
pop de
diff --git a/engine/overworld/elevator.asm b/engine/overworld/elevator.asm
index eb62fee7..05a9cc4e 100755
--- a/engine/overworld/elevator.asm
+++ b/engine/overworld/elevator.asm
@@ -33,7 +33,7 @@ ShakeElevator: ; 7bf15 (1e:7f15)
ld a, SFX_SAFARI_ZONE_PA
call PlayMusic
.musicLoop
- ld a, [wc02a]
+ ld a, [wChannelSoundIDs + CH4]
cp $b9
jr z, .musicLoop
call UpdateSprites
diff --git a/engine/overworld/emotion_bubbles.asm b/engine/overworld/emotion_bubbles.asm
index ebd441aa..f8665dd6 100755
--- a/engine/overworld/emotion_bubbles.asm
+++ b/engine/overworld/emotion_bubbles.asm
@@ -9,7 +9,7 @@ EmotionBubble: ; 17c47 (5:7c47)
inc hl
ld d, [hl]
ld hl, vChars1 + $780
- lb bc, BANK(EmotionBubblesPointerTable), $04
+ lb bc, BANK(EmotionBubbles), $04
call CopyVideoData
ld a, [wUpdateSpritesEnabled]
push af
diff --git a/engine/overworld/healing_machine.asm b/engine/overworld/healing_machine.asm
index d3513b0d..bf7130cb 100755
--- a/engine/overworld/healing_machine.asm
+++ b/engine/overworld/healing_machine.asm
@@ -1,7 +1,7 @@
AnimateHealingMachine: ; 70433 (1c:4433)
ld de, PokeCenterFlashingMonitorAndHealBall
ld hl, vChars0 + $7c0
- lb bc, BANK(PokeCenterFlashingMonitorAndHealBall), $03
+ lb bc, BANK(PokeCenterFlashingMonitorAndHealBall), $03 ; loads one too many tiles
call CopyVideoData
ld hl, wUpdateSpritesEnabled
ld a, [hl]
@@ -15,44 +15,44 @@ AnimateHealingMachine: ; 70433 (1c:4433)
ld hl, wOAMBuffer + $84
ld de, PokeCenterOAMData
call CopyHealingMachineOAM
- ld a, $4
- ld [wMusicHeaderPointer], a
+ ld a, 4
+ ld [wAudioFadeOutControl], a
ld a, $ff
- ld [wc0ee], a
+ ld [wNewSoundID], a
call PlaySound
-.asm_70464
- ld a, [wMusicHeaderPointer]
- and a
- jr nz, .asm_70464
+.waitLoop
+ ld a, [wAudioFadeOutControl]
+ and a ; is fade-out finished?
+ jr nz, .waitLoop ; if not, check again
ld a, [wPartyCount]
ld b, a
-.asm_7046e
+.partyLoop
call CopyHealingMachineOAM
ld a, SFX_HEALING_MACHINE
call PlaySound
ld c, 30
call DelayFrames
dec b
- jr nz, .asm_7046e
- ld a, [wc0ef]
+ jr nz, .partyLoop
+ ld a, [wAudioROMBank]
cp BANK(Audio3_UpdateMusic)
- ld [wc0f0], a
- jr nz, .asm_70495
+ ld [wAudioSavedROMBank], a
+ jr nz, .next
ld a, $ff
- ld [wc0ee], a
+ ld [wNewSoundID], a
call PlaySound
ld a, BANK(Music_PkmnHealed)
- ld [wc0ef], a
-.asm_70495
+ ld [wAudioROMBank], a
+.next
ld a, MUSIC_PKMN_HEALED
- ld [wc0ee], a
+ ld [wNewSoundID], a
call PlaySound
ld d, $28
call FlashSprite8Times
-.asm_704a2
- ld a, [wc026]
- cp MUSIC_PKMN_HEALED
- jr z, .asm_704a2
+.waitLoop2
+ ld a, [wChannelSoundIDs]
+ cp MUSIC_PKMN_HEALED ; is the healed music still playing?
+ jr z, .waitLoop2 ; if so, check gain
ld c, 32
call DelayFrames
pop af
diff --git a/engine/overworld/hidden_items.asm b/engine/overworld/hidden_items.asm
index 1203dd2a..f7f81070 100755
--- a/engine/overworld/hidden_items.asm
+++ b/engine/overworld/hidden_items.asm
@@ -51,7 +51,7 @@ HiddenItemBagFullText: ; 76794 (1d:6794)
HiddenCoins: ; 76799 (1d:6799)
ld b, COIN_CASE
- predef IsItemInBag_
+ predef GetQuantityOfItemInBag
ld a, b
and a
ret z
@@ -135,7 +135,7 @@ FindHiddenItemOrCoinsIndex: ; 76857 (1d:6857)
ld d, a
ld a, [wHiddenObjectX]
ld e, a
- ld a, [W_CURMAP]
+ ld a, [wCurMap]
ld b, a
ld c, -1
.loop
diff --git a/engine/overworld/hidden_objects.asm b/engine/overworld/hidden_objects.asm
index cabfc093..1fc20e5c 100755
--- a/engine/overworld/hidden_objects.asm
+++ b/engine/overworld/hidden_objects.asm
@@ -29,7 +29,7 @@ CheckForHiddenObject: ; 469a0 (11:69a0)
ld b, a
cp $ff
jr z, .noMatch
- ld a, [W_CURMAP]
+ ld a, [wCurMap]
cp b
jr z, .foundMatchingMap
inc de
@@ -95,30 +95,30 @@ CheckIfCoordsInFrontOfPlayerMatch: ; 46a01 (11:6a01)
cp SPRITE_FACING_RIGHT
jr z, .facingRight
; facing down
- ld a, [W_YCOORD]
+ ld a, [wYCoord]
inc a
jr .upDownCommon
.facingUp
- ld a, [W_YCOORD]
+ ld a, [wYCoord]
dec a
.upDownCommon
cp b
jr nz, .didNotMatch
- ld a, [W_XCOORD]
+ ld a, [wXCoord]
cp c
jr nz, .didNotMatch
jr .matched
.facingLeft
- ld a, [W_XCOORD]
+ ld a, [wXCoord]
dec a
jr .leftRightCommon
.facingRight
- ld a, [W_XCOORD]
+ ld a, [wXCoord]
inc a
.leftRightCommon
cp c
jr nz, .didNotMatch
- ld a, [W_YCOORD]
+ ld a, [wYCoord]
cp b
jr nz, .didNotMatch
.matched
diff --git a/engine/overworld/is_player_just_outside_map.asm b/engine/overworld/is_player_just_outside_map.asm
index 24e434b3..e9ba204a 100644
--- a/engine/overworld/is_player_just_outside_map.asm
+++ b/engine/overworld/is_player_just_outside_map.asm
@@ -1,13 +1,13 @@
; returns whether the player is one tile outside the map in Z
IsPlayerJustOutsideMap: ; 128d8 (4:68d8)
- ld a, [W_YCOORD]
+ ld a, [wYCoord]
ld b, a
- ld a, [W_CURMAPHEIGHT]
+ ld a, [wCurMapHeight]
call .compareCoordWithMapDimension
ret z
- ld a, [W_XCOORD]
+ ld a, [wXCoord]
ld b, a
- ld a, [W_CURMAPWIDTH]
+ ld a, [wCurMapWidth]
.compareCoordWithMapDimension
add a
cp b
diff --git a/engine/overworld/item.asm b/engine/overworld/item.asm
index 6fbe823d..63eecef9 100644
--- a/engine/overworld/item.asm
+++ b/engine/overworld/item.asm
@@ -3,7 +3,7 @@ PickUpItem:
ld a, [hSpriteIndexOrTextID]
ld b, a
- ld hl, W_MISSABLEOBJECTLIST
+ ld hl, wMissableObjectList
.missableObjectsListLoop
ld a, [hli]
cp $ff
@@ -17,7 +17,7 @@ PickUpItem:
ld a, [hl]
ld [$ffdb], a
- ld hl, W_MAPSPRITEEXTRADATA
+ ld hl, wMapSpriteExtraData
ld a, [hSpriteIndexOrTextID]
dec a
add a
diff --git a/engine/overworld/ledges.asm b/engine/overworld/ledges.asm
index 5a3bfbe0..b04f6332 100755
--- a/engine/overworld/ledges.asm
+++ b/engine/overworld/ledges.asm
@@ -2,7 +2,7 @@ HandleLedges: ; 1a672 (6:6672)
ld a, [wd736]
bit 6, a ; already jumping down ledge
ret nz
- ld a, [W_CURMAPTILESET]
+ ld a, [wCurMapTileset]
and a ; OVERWORLD
ret nz
predef GetTileAndCoordsInFrontOfPlayer
@@ -69,7 +69,7 @@ LedgeTiles: ; 1a6cf (6:66cf)
LoadHoppingShadowOAM: ; 1a6f0 (6:66f0)
ld hl, vChars1 + $7f0
ld de, LedgeHoppingShadow
- lb bc, BANK(LedgeHoppingShadow), $01
+ lb bc, BANK(LedgeHoppingShadow), (LedgeHoppingShadowEnd - LedgeHoppingShadow) / $8
call CopyVideoDataDouble
ld a, $9
lb bc, $54, $48 ; b, c = y, x coordinates of shadow
@@ -79,6 +79,7 @@ LoadHoppingShadowOAM: ; 1a6f0 (6:66f0)
LedgeHoppingShadow: ; 1a708 (6:6708)
INCBIN "gfx/ledge_hopping_shadow.1bpp"
+LedgeHoppingShadowEnd:
LedgeHoppingShadowOAM: ; 1a710 (6:6710)
db $FF,$10,$FF,$20
diff --git a/engine/overworld/map_sprites.asm b/engine/overworld/map_sprites.asm
index 33411dfc..bdd3320b 100755
--- a/engine/overworld/map_sprites.asm
+++ b/engine/overworld/map_sprites.asm
@@ -30,12 +30,12 @@ InitMapSprites: ; 1785b (5:785b)
; InitOutsideMapSprites.
; Loads tile pattern data for sprites into VRAM.
LoadMapSpriteTilePatterns: ; 17871 (5:7871)
- ld a,[W_NUMSPRITES]
+ ld a,[wNumSprites]
and a ; are there any sprites?
jr nz,.spritesExist
ret
.spritesExist
- ld c,a ; c = [W_NUMSPRITES]
+ ld c,a ; c = [wNumSprites]
ld b,$10 ; number of sprite slots
ld hl,wSpriteStateData2 + $0d
xor a
@@ -251,7 +251,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)
- ld a,[W_CURMAP]
+ 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
ld hl,MapSpriteSets
@@ -267,12 +267,12 @@ InitOutsideMapSprites: ; 1797b (5:797b)
ld a,[wFontLoaded]
bit 0,a ; reloading upper half of tile patterns after displaying text?
jr nz,.loadSpriteSet ; if so, forcibly reload the sprite set
- ld a,[W_SPRITESETID]
+ ld a,[wSpriteSetID]
cp b ; has the sprite set ID changed?
jr z,.skipLoadingSpriteSet ; if not, don't load it again
.loadSpriteSet
ld a,b
- ld [W_SPRITESETID],a
+ ld [wSpriteSetID],a
dec a
ld b,a
sla a
@@ -291,7 +291,7 @@ InitOutsideMapSprites: ; 1797b (5:797b)
ld hl,wSpriteStateData2 + $0d
ld a,SPRITE_RED
ld [hl],a
- ld bc,W_SPRITESET
+ ld bc,wSpriteSet
; Load the sprite set into RAM.
; This loop also fills $C2XD (sprite picture ID) where X is from $0 to $A
; with picture ID's. This is done so that LoadMapSpriteTilePatterns will
@@ -317,13 +317,13 @@ InitOutsideMapSprites: ; 1797b (5:797b)
ld [hl],a ; $C2XD (sprite picture ID)
dec b
jr nz,.zeroRemainingSlotsLoop
- ld a,[W_NUMSPRITES]
+ ld a,[wNumSprites]
push af ; save number of sprites
ld a,11 ; 11 sprites in sprite set
- ld [W_NUMSPRITES],a
+ ld [wNumSprites],a
call LoadMapSpriteTilePatterns
pop af
- ld [W_NUMSPRITES],a ; restore number of sprites
+ ld [wNumSprites],a ; restore number of sprites
ld hl,wSpriteStateData2 + $1e
ld b,$0f
; The VRAM tile pattern slots that LoadMapSpriteTilePatterns set are in the
@@ -352,7 +352,7 @@ InitOutsideMapSprites: ; 1797b (5:797b)
and a ; is the sprite slot used?
jr z,.skipGettingPictureIndex ; if the sprite slot is not used
ld b,a ; b = picture ID
- ld de,W_SPRITESET
+ ld de,wSpriteSet
; Loop to find the index of the sprite's picture ID within the sprite set.
.getPictureIndexLoop
inc c
@@ -399,10 +399,10 @@ GetSplitMapSpriteSetID: ; 17a1a (5:7a1a)
ld b,a
jr z,.eastWestDivide
.northSouthDivide
- ld a,[W_YCOORD]
+ ld a,[wYCoord]
jr .compareCoord
.eastWestDivide
- ld a,[W_XCOORD]
+ ld a,[wXCoord]
.compareCoord
cp b
jr c,.loadSpriteSetID
@@ -415,7 +415,7 @@ GetSplitMapSpriteSetID: ; 17a1a (5:7a1a)
; Route 20 is a special case because the two map sections have a more complex
; shape instead of the map simply being split horizontally or vertically.
.route20
- ld hl,W_XCOORD
+ ld hl,wXCoord
ld a,[hl]
cp a,$2b
ld a,$01
@@ -430,7 +430,7 @@ GetSplitMapSpriteSetID: ; 17a1a (5:7a1a)
jr nc,.next
ld b,$0d
.next
- ld a,[W_YCOORD]
+ ld a,[wYCoord]
cp b
ld a,$0a
ret c
diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm
index be10fd69..c89406d1 100644
--- a/engine/overworld/movement.asm
+++ b/engine/overworld/movement.asm
@@ -89,7 +89,7 @@ UpdatePlayerSprite: ; 4e31 (1:4e31)
; bit set by later logic.
ld a, [hTilePlayerStandingOn]
ld c, a
- ld a, [W_GRASSTILE]
+ ld a, [wGrassTile]
cp c
ld a, $0
jr nz, .next2
@@ -114,7 +114,7 @@ UpdateNPCSprite: ; 4ed1 (1:4ed1)
swap a
dec a
add a
- ld hl, W_MAPSPRITEDATA
+ ld hl, wMapSpriteData
add l
ld l, a
ld a, [hl] ; read movement byte 2
@@ -133,8 +133,8 @@ UpdateNPCSprite: ; 4ed1 (1:4ed1)
ld l, a
inc l
ld a, [hl] ; c1x1
- bit 7, a
- jp nz, InitializeSpriteFacingDirection ; c1x1 >= $80
+ bit 7, a ; is the face player flag set?
+ jp nz, MakeNPCFacePlayer
ld b, a
ld a, [wFontLoaded]
bit 0, a
@@ -400,10 +400,15 @@ notYetMoving: ; 5073 (1:5073)
ld [hl], $0 ; c1x8 = 0 (walk animation frame)
jp UpdateSpriteImage
-InitializeSpriteFacingDirection: ; 507f (1:507f)
+MakeNPCFacePlayer: ; 507f (1:507f)
+; 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
+; disabled. This is only done when rubbing the S.S. Anne captain's back.
ld a, [wd72d]
bit 5, a
jr nz, notYetMoving
+
res 7, [hl]
ld a, [wPlayerDirection]
bit PLAYER_DIR_BIT_UP, a
@@ -448,7 +453,7 @@ InitializeSpriteScreenPosition: ; 50bd (1:50bd)
ld a, [H_CURRENTSPRITEOFFSET]
add $4
ld l, a
- ld a, [W_YCOORD]
+ ld a, [wYCoord]
ld b, a
ld a, [hl] ; c2x4 (Y position + 4)
sub b ; relative to player position
@@ -457,7 +462,7 @@ InitializeSpriteScreenPosition: ; 50bd (1:50bd)
dec h
ld [hli], a ; c1x4 (screen Y position)
inc h
- ld a, [W_XCOORD]
+ ld a, [wXCoord]
ld b, a
ld a, [hli] ; c2x6 (X position + 4)
sub b ; relative to player position
@@ -483,7 +488,7 @@ CheckSpriteAvailability: ; 50dc (1:50dc)
add $4
ld l, a
ld b, [hl] ; c2x4: Y pos (+4)
- ld a, [W_YCOORD]
+ ld a, [wYCoord]
cp b
jr z, .skipYVisibilityTest
jr nc, .spriteInvisible ; above screen region
@@ -493,7 +498,7 @@ CheckSpriteAvailability: ; 50dc (1:50dc)
.skipYVisibilityTest
inc l
ld b, [hl] ; c2x5: X pos (+4)
- ld a, [W_XCOORD]
+ ld a, [wXCoord]
cp b
jr z, .skipXVisibilityTest
jr nc, .spriteInvisible ; left of screen region
@@ -537,7 +542,7 @@ CheckSpriteAvailability: ; 50dc (1:50dc)
ld a, [H_CURRENTSPRITEOFFSET]
add $7
ld l, a
- ld a, [W_GRASSTILE]
+ ld a, [wGrassTile]
cp c
ld a, $0
jr nz, .notInGrass
@@ -585,9 +590,9 @@ CanWalkOntoTile: ; 516e (1:516e)
and a
ret
.notScripted
- ld a, [W_TILESETCOLLISIONPTR]
+ ld a, [wTileSetCollisionPtr]
ld l, a
- ld a, [W_TILESETCOLLISIONPTR+1]
+ ld a, [wTileSetCollisionPtr+1]
ld h, a
.tilePassableLoop
ld a, [hli]
diff --git a/engine/overworld/npc_movement.asm b/engine/overworld/npc_movement.asm
index 0c01e38c..719c8835 100755
--- a/engine/overworld/npc_movement.asm
+++ b/engine/overworld/npc_movement.asm
@@ -52,7 +52,7 @@ PalletMovementScriptPointerTable: ; 1a442 (6:6442)
dw PalletMovementScript_Done
PalletMovementScript_OakMoveLeft: ; 1a44c (6:644c)
- ld a, [W_XCOORD]
+ ld a, [wXCoord]
sub $a
ld [wNumStepsToTake], a
jr z, .playerOnLeftTile
@@ -79,7 +79,7 @@ PalletMovementScript_OakMoveLeft: ; 1a44c (6:644c)
ld a, $3
ld [wNPCMovementScriptFunctionNum], a
.done
- ld hl, W_FLAGS_D733
+ ld hl, wFlags_D733
set 1, [hl]
ld a, $fc
ld [wJoyIgnore], a
@@ -163,10 +163,10 @@ PewterMuseumGuyMovementScriptPointerTable: ; 1a510 (6:6510)
PewterMovementScript_WalkToMuseum: ; 1a514 (6:6514)
ld a, BANK(Music_MuseumGuy)
- ld [wc0ef], a
- ld [wc0f0], a
+ ld [wAudioROMBank], a
+ ld [wAudioSavedROMBank], a
ld a, MUSIC_MUSEUM_GUY
- ld [wc0ee], a
+ ld [wNewSoundID], a
call PlaySound
ld a, [wSpriteIndex]
swap a
@@ -219,10 +219,10 @@ PewterGymGuyMovementScriptPointerTable: ; 1a57d (6:657d)
PewterMovementScript_WalkToGym: ; 1a581 (6:6581)
ld a, BANK(Music_MuseumGuy)
- ld [wc0ef], a
- ld [wc0f0], a
+ ld [wAudioROMBank], a
+ ld [wAudioSavedROMBank], a
ld a, MUSIC_MUSEUM_GUY
- ld [wc0ee], a
+ ld [wNewSoundID], a
call PlaySound
ld a, [wSpriteIndex]
swap a
@@ -267,7 +267,7 @@ RLEList_PewterGymGuy: ; 1a5da (6:65da)
db $FF
FreezeEnemyTrainerSprite: ; 1a5e7 (6:65e7)
- ld a, [W_CURMAP]
+ ld a, [wCurMap]
cp POKEMONTOWER_7
ret z ; the Rockets on Pokemon Tower 7F leave after battling, so don't freeze them
ld hl, RivalIDs
@@ -286,7 +286,7 @@ FreezeEnemyTrainerSprite: ; 1a5e7 (6:65e7)
jp SetSpriteMovementBytesToFF
RivalIDs: ; 1a605 (6:6605)
- db SONY1 + $c8
- db SONY2 + $c8
- db SONY3 + $c8
+ db OPP_SONY1
+ db OPP_SONY2
+ db OPP_SONY3
db $ff
diff --git a/engine/overworld/oaks_aide.asm b/engine/overworld/oaks_aide.asm
index 00f6ea82..8ac456d2 100755
--- a/engine/overworld/oaks_aide.asm
+++ b/engine/overworld/oaks_aide.asm
@@ -4,45 +4,45 @@ OaksAideScript: ; 0x59035
call YesNoChoice
ld a, [wCurrentMenuItem]
and a
- jr nz, .asm_59086
+ jr nz, .choseNo
ld hl, wPokedexOwned
ld b, wPokedexOwnedEnd - wPokedexOwned
call CountSetBits
- ld a, [wd11e]
- ld [$ffdd], a
+ ld a, [wNumSetBits]
+ ld [hOaksAideNumMonsOwned], a
ld b, a
- ld a, [$ffdb]
+ ld a, [hOaksAideRequirement]
cp b
- jr z, .asm_59059
- jr nc, .asm_5907c
-.asm_59059
+ jr z, .giveItem
+ jr nc, .notEnoughOwnedMons
+.giveItem
ld hl, OaksAideHereYouGoText
call PrintText
- ld a, [$ffdc]
+ ld a, [hOaksAideRewardItem]
ld b, a
ld c, 1
call GiveItem
- jr nc, .BagFull
+ jr nc, .bagFull
ld hl, OaksAideGotItemText
call PrintText
ld a, $1
- jr .asm_5908e
-.BagFull
+ jr .done
+.bagFull
ld hl, OaksAideNoRoomText
call PrintText
xor a
- jr .asm_5908e
-.asm_5907c
+ jr .done
+.notEnoughOwnedMons
ld hl, OaksAideUhOhText
call PrintText
ld a, $80
- jr .asm_5908e
-.asm_59086
+ jr .done
+.choseNo
ld hl, OaksAideComeBackText
call PrintText
ld a, $ff
-.asm_5908e
- ld [$ffdb], a
+.done
+ ld [hOaksAideResult], a
ret
OaksAideHiText: ; 59091 (16:5091)
diff --git a/engine/overworld/pewter_guys.asm b/engine/overworld/pewter_guys.asm
index 4ac60e00..543dac91 100755
--- a/engine/overworld/pewter_guys.asm
+++ b/engine/overworld/pewter_guys.asm
@@ -17,9 +17,9 @@ PewterGuys: ; 37ca1 (d:7ca1)
ld a, [hli]
ld h, [hl]
ld l, a
- ld a, [W_YCOORD]
+ ld a, [wYCoord]
ld b, a
- ld a, [W_XCOORD]
+ ld a, [wXCoord]
ld c, a
.findMatchingCoordsLoop
ld a, [hli]
diff --git a/engine/overworld/player_animations.asm b/engine/overworld/player_animations.asm
index 74762b00..de36eeaf 100755
--- a/engine/overworld/player_animations.asm
+++ b/engine/overworld/player_animations.asm
@@ -5,7 +5,7 @@ EnterMapAnim: ; 70510 (1c:4510)
call Delay3
push hl
call GBFadeInFromWhite
- ld hl, W_FLAGS_D733
+ ld hl, wFlags_D733
bit 7, [hl] ; used fly out of battle?
res 7, [hl]
jr nz, .flyAnimation
@@ -350,7 +350,7 @@ GetPlayerTeleportAnimFrameDelay: ; 7077f (1c:477f)
IsPlayerStandingOnWarpPadOrHole: ; 70787 (1c:4787)
ld b, 0
ld hl, .warpPadAndHoleData
- ld a, [W_CURMAPTILESET]
+ ld a, [wCurMapTileset]
ld c, a
.loop
ld a, [hli]
diff --git a/engine/overworld/pokecenter.asm b/engine/overworld/pokecenter.asm
index 5b2e4cbb..f302d994 100755
--- a/engine/overworld/pokecenter.asm
+++ b/engine/overworld/pokecenter.asm
@@ -24,12 +24,12 @@ DisplayPokemonCenterDialogue_: ; 6fe6 (1:6fe6)
predef HealParty
callba AnimateHealingMachine ; do the healing machine animation
xor a
- ld [wMusicHeaderPointer], a
- ld a, [wc0f0]
- ld [wc0ef], a
- ld a, [wd35b]
- ld [wcfca], a
- ld [wc0ee], a
+ ld [wAudioFadeOutControl], a
+ ld a, [wAudioSavedROMBank]
+ ld [wAudioROMBank], a
+ ld a, [wMapMusicSoundID]
+ ld [wLastMusicSoundID], a
+ ld [wNewSoundID], a
call PlaySound
ld hl, PokemonFightingFitText
call PrintText
diff --git a/engine/overworld/ssanne.asm b/engine/overworld/ssanne.asm
index 1dccd026..e631bbfa 100755
--- a/engine/overworld/ssanne.asm
+++ b/engine/overworld/ssanne.asm
@@ -85,8 +85,9 @@ LoadSmokeTileFourTimes: ; 79fc0 (1e:5fc0)
LoadSmokeTile: ; 79fd4 (1e:5fd4)
ld de, SSAnneSmokePuffTile
- lb bc, BANK(SSAnneSmokePuffTile), $01
+ lb bc, BANK(SSAnneSmokePuffTile), (SSAnneSmokePuffTileEnd - SSAnneSmokePuffTile) / $10
jp CopyVideoData
SSAnneSmokePuffTile: ; 79fdd (1e:5fdd)
INCBIN "gfx/ss_anne_smoke_puff.2bpp"
+SSAnneSmokePuffTileEnd:
diff --git a/engine/overworld/trainers.asm b/engine/overworld/trainers.asm
index 7d2ec0dd..66ae20ce 100755
--- a/engine/overworld/trainers.asm
+++ b/engine/overworld/trainers.asm
@@ -291,7 +291,7 @@ CheckSpriteCanSeePlayer: ; 569af (15:69af)
; tests if the player is in front of the sprite (rather than behind it)
CheckPlayerIsInFrontOfSprite: ; 569e3 (15:69e3)
- ld a, [W_CURMAP]
+ ld a, [wCurMap]
cp POWER_PLANT
jp z, .engage ; bypass this for power plant to get voltorb fake items to work
ld a, [wTrainerSpriteOffset]