summaryrefslogtreecommitdiff
path: root/engine/town_map.asm
diff options
context:
space:
mode:
Diffstat (limited to 'engine/town_map.asm')
-rwxr-xr-xengine/town_map.asm104
1 files changed, 60 insertions, 44 deletions
diff --git a/engine/town_map.asm b/engine/town_map.asm
index 225de2b8..ee282b49 100755
--- a/engine/town_map.asm
+++ b/engine/town_map.asm
@@ -1,4 +1,4 @@
-DisplayTownMap: ; 70e3e (1c:4e3e)
+DisplayTownMap: ; 70eb7 (1c:4eb7)
call LoadTownMap
ld hl, wUpdateSpritesEnabled
ld a, [hl]
@@ -27,7 +27,7 @@ DisplayTownMap: ; 70e3e (1c:4e3e)
pop af
jr .enterLoop
-.townMapLoop
+.townMapLoop ; 70ef4 (1c:4ef4)
coord hl, 0, 0
lb bc, 1, 20
call ClearScreenArea
@@ -37,7 +37,7 @@ DisplayTownMap: ; 70e3e (1c:4e3e)
ld b, 0
add hl, bc
ld a, [hl]
-.enterLoop
+.enterLoop ; 70f08 (1c:4f08)
ld de, wTownMapCoords
call LoadTownMapEntry
ld a, [de]
@@ -69,7 +69,7 @@ DisplayTownMap: ; 70e3e (1c:4e3e)
ld b, a
and A_BUTTON | B_BUTTON | D_UP | D_DOWN
jr z, .inputLoop
- ld a, SFX_TINK
+ ld a, $8c
call PlaySound
bit 6, b
jr nz, .pressedUp
@@ -84,6 +84,7 @@ DisplayTownMap: ; 70e3e (1c:4e3e)
pop af
ld [hl], a
ret
+
.pressedUp
ld a, [wWhichTownMapLocation]
inc a
@@ -103,13 +104,20 @@ DisplayTownMap: ; 70e3e (1c:4e3e)
ld [wWhichTownMapLocation], a
jp .townMapLoop
+.asm_70f87
+ ld a,[hJoy5]
+ and D_DOWN | D_UP
+ ret z
+ callab Func_f0000
+ ret
+
INCLUDE "data/town_map_order.asm"
-TownMapCursor: ; 70f40 (1c:4f40)
+TownMapCursor: ; 70fc4 (1c:4fc4)
INCBIN "gfx/town_map_cursor.1bpp"
TownMapCursorEnd:
-LoadTownMap_Nest: ; 70f60 (1c:4f60)
+LoadTownMap_Nest: ; 70fe4 (1c:4fe4)
call LoadTownMap
ld hl, wUpdateSpritesEnabled
ld a, [hl]
@@ -131,17 +139,20 @@ LoadTownMap_Nest: ; 70f60 (1c:4f60)
ld [hl], a
ret
-MonsNestText: ; 70f89 (1c:4f89)
+MonsNestText: ; 7100d (1c:500d)
db "'s NEST@"
-LoadTownMap_Fly: ; 70f90 (1c:4f90)
+LoadTownMap_Fly: ; 71014 (1c:5014)
call ClearSprites
call LoadTownMap
+ ld a, $1
+ ld [hJoy7], a
call LoadPlayerSpriteGraphics
call LoadFontTilePatterns
- ld de, BirdSprite
+ ld de, BirdSprite ; $4d80
+ ld b, BANK(BirdSprite)
+ ld c, $c
ld hl, vSprites + $40
- lb bc, BANK(BirdSprite), $0c
call CopyVideoData
ld de, TownMapUpArrow
ld hl, vChars1 + $6d0
@@ -179,7 +190,7 @@ LoadTownMap_Fly: ; 70f90 (1c:4f90)
ld c, 15
call DelayFrames
coord hl, 18, 0
- ld [hl], $ed
+ ld [hl], "▶"
coord hl, 19, 0
ld [hl], $ee
pop hl
@@ -194,7 +205,7 @@ LoadTownMap_Fly: ; 70f90 (1c:4f90)
jr z, .inputLoop
bit 0, b
jr nz, .pressedA
- ld a, SFX_TINK
+ ld a, $8c ; SFX_TINK
call PlaySound
bit 6, b
jr nz, .pressedUp
@@ -202,7 +213,7 @@ LoadTownMap_Fly: ; 70f90 (1c:4f90)
jr nz, .pressedDown
jr .pressedB
.pressedA
- ld a, SFX_HEAL_AILMENT
+ ld a, $8e ; SFX_HEAL_AILMENT
call PlaySound
ld a, [hl]
ld [wDestinationMap], a
@@ -213,6 +224,7 @@ LoadTownMap_Fly: ; 70f90 (1c:4f90)
.pressedB
xor a
ld [wTownMapSpriteBlinkingEnabled], a
+ ld [hJoy7], a
call GBPalWhiteOutWithDelay3
pop hl
pop af
@@ -243,10 +255,10 @@ LoadTownMap_Fly: ; 70f90 (1c:4f90)
ld hl, wFlyLocationsList + 11
jr .pressedDown
-ToText: ; 7106d (1c:506d)
+ToText: ; 710f8 (1c:50f8)
db "To@"
-BuildFlyLocationsList: ; 71070 (1c:5070)
+BuildFlyLocationsList: ; 710fb (1c:50fb)
ld hl, wFlyLocationsList - 1
ld [hl], $ff
inc hl
@@ -270,25 +282,24 @@ BuildFlyLocationsList: ; 71070 (1c:5070)
ld [hl], $ff
ret
-TownMapUpArrow: ; 71093 (1c:5093)
+TownMapUpArrow: ; 7111e (1c:511e)
INCBIN "gfx/up_arrow.1bpp"
TownMapUpArrowEnd:
-LoadTownMap: ; 7109b (1c:509b)
+LoadTownMap: ; 71126 (1c:5126)
call GBPalWhiteOutWithDelay3
call ClearScreen
call UpdateSprites
coord hl, 0, 0
- ld b, $12
- ld c, $12
+ lb bc, $12, $12
call TextBoxBorder
call DisableLCD
ld hl, WorldMapTileGraphics
ld de, vChars2 + $600
ld bc, WorldMapTileGraphicsEnd - WorldMapTileGraphics
ld a, BANK(WorldMapTileGraphics)
- call FarCopyData2
- ld hl, MonNestIcon
+ call FarCopyData
+ ld hl, MonNestIcon ; $574b
ld de, vSprites + $40
ld bc, MonNestIconEnd - MonNestIcon
ld a, BANK(MonNestIcon)
@@ -324,11 +335,11 @@ LoadTownMap: ; 7109b (1c:509b)
ld [wTownMapSpriteBlinkingEnabled], a
ret
-CompressedMap: ; 71100 (1c:5100)
+CompressedMap: ; 7118a (1c:518a)
; you can decompress this file with the redrle program in the extras/ dir
INCBIN "gfx/town_map.rle"
-ExitTownMap: ; 711ab (1c:51ab)
+ExitTownMap: ; 71235 (1c:5235)
; clear town map graphics data and load usual graphics data
xor a
ld [wTownMapSpriteBlinkingEnabled], a
@@ -340,7 +351,7 @@ ExitTownMap: ; 711ab (1c:51ab)
call UpdateSprites
jp RunDefaultPaletteCommand
-DrawPlayerOrBirdSprite: ; 711c4 (1c:51c4)
+DrawPlayerOrBirdSprite: ; 7124e (1c:524e)
; a = map number
; b = OAM base tile
push af
@@ -355,18 +366,19 @@ DrawPlayerOrBirdSprite: ; 711c4 (1c:51c4)
call WritePlayerOrBirdSpriteOAM
pop hl
ld de, wcd6d
-.asm_711dc
+.asm_71266
ld a, [hli]
ld [de], a
inc de
- cp $50
- jr nz, .asm_711dc
+ cp "@"
+ jr nz, .asm_71266
ld hl, wOAMBuffer
ld de, wTileMapBackup
ld bc, $a0
jp CopyData
-DisplayWildLocations: ; 711ef (1c:51ef)
+<<<<<<< HEAD
+DisplayWildLocations: ; 71279 (1c:5279)
callba FindWildLocationsOfMon
call ZeroOutDuplicatesInList
ld hl, wOAMBuffer
@@ -397,8 +409,7 @@ DisplayWildLocations: ; 711ef (1c:51ef)
jr nz, .drawPlayerSprite
; if no OAM entries were written, print area unknown text
coord hl, 1, 7
- ld b, $2
- ld c, $f
+ lb bc, $20f
call TextBoxBorder
coord hl, 2, 9
ld de, AreaUnknownText
@@ -414,10 +425,10 @@ DisplayWildLocations: ; 711ef (1c:51ef)
ld bc, $a0
jp CopyData
-AreaUnknownText: ; 7124a (1c:524a)
+AreaUnknownText: ; 712d3 (1c:52d3)
db " AREA UNKNOWN@"
-TownMapCoordsToOAMCoords: ; 71258 (1c:5258)
+TownMapCoordsToOAMCoords: ; 712e1 (1c:52e1)
; in: lower nybble of a = x, upper nybble of a = y
; out: b and [hl] = (y * 8) + 24, c and [hl+1] = (x * 8) + 24
push af
@@ -435,14 +446,14 @@ TownMapCoordsToOAMCoords: ; 71258 (1c:5258)
ld [hli], a
ret
-WritePlayerOrBirdSpriteOAM: ; 7126d (1c:526d)
+WritePlayerOrBirdSpriteOAM: ; 712f6 (1c:52f6)
ld a, [wOAMBaseTile]
and a
ld hl, wOAMBuffer + $90 ; for player sprite
jr z, WriteTownMapSpriteOAM
ld hl, wOAMBuffer + $80 ; for bird sprite
-WriteTownMapSpriteOAM: ; 71279 (1c:5279)
+WriteTownMapSpriteOAM: ; 71302 (1c:5302)
push hl
lb hl, -4, -4
add hl, bc ; subtract 4 from c (X coord) and 4 from b (Y coord)
@@ -450,8 +461,8 @@ WriteTownMapSpriteOAM: ; 71279 (1c:5279)
ld c, l
pop hl
-WriteAsymmetricMonPartySpriteOAM: ; 71281 (1c:5281)
-; Writes 4 OAM blocks for a helix mon party sprite, since it does not have
+WriteAsymmetricMonPartySpriteOAM: ; 7130a (1c:530a)
+; Writes 4 OAM blocks for a helix mon party sprite, since is does not have
; a vertical line of symmetry.
lb de, 2, 2
.loop
@@ -483,7 +494,7 @@ WriteAsymmetricMonPartySpriteOAM: ; 71281 (1c:5281)
jr nz, .loop
ret
-WriteSymmetricMonPartySpriteOAM: ; 712a6 (1c:52a6)
+WriteSymmetricMonPartySpriteOAM: ; 7132f (1c:532f)
; Writes 4 OAM blocks for a mon party sprite other than a helix. All the
; sprites other than the helix one have a vertical line of symmetry which allows
; the X-flip OAM bit to be used so that only 2 rather than 4 tile patterns are
@@ -525,7 +536,7 @@ WriteSymmetricMonPartySpriteOAM: ; 712a6 (1c:52a6)
jr nz, .loop
ret
-ZeroOutDuplicatesInList: ; 712d9 (1c:52d9)
+ZeroOutDuplicatesInList: ; 71362 (1c:5362)
; replace duplicate bytes in the list of wild pokemon locations with 0
ld de, wBuffer
.loop
@@ -548,7 +559,7 @@ ZeroOutDuplicatesInList: ; 712d9 (1c:52d9)
inc hl
jr .zeroDuplicatesLoop
-LoadTownMapEntry: ; 712f1 (1c:52f1)
+LoadTownMapEntry: ; 7137a (1c:537a)
; in: a = map number
; out: lower nybble of [de] = x, upper nybble of [de] = y, hl = address of name
cp REDS_HOUSE_1F
@@ -577,16 +588,21 @@ LoadTownMapEntry: ; 712f1 (1c:52f1)
ld h, [hl]
ld l, a
ret
+
+ExternalMapEntries: ; 7139c (1c:539c)
+ dr $7139c,$7140b
+InternalMapEntries: ; 7140b (1c:540b)
+ dr $7140b,$7174b
+
+;INCLUDE "data/town_map_entries.asm"
-INCLUDE "data/town_map_entries.asm"
-
-INCLUDE "text/map_names.asm"
+;INCLUDE "text/map_names.asm" ; TODO: relabel addresses
-MonNestIcon: ; 716be (1c:56be)
+MonNestIcon: ; 7174b (1c:574b)
INCBIN "gfx/mon_nest_icon.1bpp"
MonNestIconEnd:
-TownMapSpriteBlinkingAnimation: ; 716c6 (1c:56c6)
+TownMapSpriteBlinkingAnimation: ; 71753 (1c:5753)
ld a, [wAnimCounter]
inc a
cp 25