ref: b509b48a7f5a9a80225b9c030d7334b26b521c62
parent: 822bb2bd21110cc5dc7875d70f8c36c15d13cbaf
author: dannye <corrnondacqb@yahoo.com>
date: Mon Jul 13 20:21:03 EDT 2015
Use more *Coord also town map code relabelling YamaArashi just did town map relabelling but oh well I aleady made the changes and don't feel like redoing it
--- a/data/town_map_order.asm
+++ b/data/town_map_order.asm
@@ -46,3 +46,4 @@
db VICTORY_ROAD_3
db INDIGO_PLATEAU
db POWER_PLANT
+TownMapOrderEnd:
--- a/engine/HoF_room_pc.asm
+++ b/engine/HoF_room_pc.asm
@@ -14,10 +14,10 @@
ld bc, $10
ld a, $ff
call FillMemory
- ld hl, wTileMap
- call Func_7417b
+ hlCoord 0, 0
+ call FillFourRowsWithBlack
hlCoord 0, 14
- call Func_7417b
+ call FillFourRowsWithBlack
ld a, $c0
ld [rBGP], a
call EnableLCD
@@ -34,7 +34,7 @@
jp Credits
Func_740ba: ; 740ba (1d:40ba)
- ld hl, DataTable_74160
+ ld hl, HoFGBPalettes
ld b, $4
.asm_740bf
ld a, [hli]
@@ -123,8 +123,11 @@
jr z, .asm_7415a
ret
-DataTable_74160: ; 74160 (1d:4160)
- db $C0,$D0,$E0,$F0
+HoFGBPalettes: ; 74160 (1d:4160)
+ db %11000000
+ db %11010000
+ db %11100000
+ db %11110000
Func_74164: ; 74164 (1d:4164)
ld a, l
@@ -145,14 +148,14 @@
jr nz, Func_74171
ret
-Func_7417b: ; 7417b (1d:417b)
- ld bc, $50
+FillFourRowsWithBlack: ; 7417b (1d:417b)
+ ld bc, SCREEN_WIDTH * 4
ld a, $7e
jp FillMemory
FillMiddleOfScreenWithWhite: ; 74183 (1d:4183)
hlCoord 0, 4
- ld bc, $c8 ; 10 rows of 20 tiles each
+ ld bc, SCREEN_WIDTH * 10
ld a, $7f ; blank white tile
jp FillMemory
@@ -254,5 +257,5 @@
INCLUDE "text/credits_text.asm"
-TheEndGfx: ; 7473e (1d:473e) ; 473E (473F on blue)
+TheEndGfx: ; 7473e (1d:473e) (7473f on blue)
INCBIN "gfx/theend.interleave.2bpp"
--- a/engine/battle/animations.asm
+++ b/engine/battle/animations.asm
@@ -2184,7 +2184,7 @@
push bc
ld e, a
ld d, $0
- ld hl, wTileMap
+ hlCoord 0, 0
add hl, de
ld bc, $707
call ClearScreenArea
@@ -2206,7 +2206,7 @@
.enemyTurn
ld a, 12
.next
- ld hl, wTileMap
+ hlCoord 0, 0
ld e, a
ld d, 0
add hl, de
--- a/engine/battle/battle_transitions.asm
+++ b/engine/battle/battle_transitions.asm
@@ -231,7 +231,7 @@
BattleTransition_InwardSpiral: ; 70aaa (1c:4aaa)
ld a, $7
ld [wWhichTrade], a
- ld hl, wTileMap
+ hlCoord 0, 0
ld c, $11
ld de, $14
call BattleTransition_InwardSpiral_
@@ -410,7 +410,7 @@
ld bc, $ffd8
call BattleTransition_CopyTiles1
hlCoord 0, 1
- ld de, wTileMap
+ deCoord 0, 0
ld bc, $28
call BattleTransition_CopyTiles1
hlCoord 18, 0
@@ -418,7 +418,7 @@
ld bc, $fffe
call BattleTransition_CopyTiles2
hlCoord 1, 0
- ld de, wTileMap
+ deCoord 0, 0
ld bc, $2
call BattleTransition_CopyTiles2
call BattleTransition_TransferDelay3
@@ -514,7 +514,7 @@
; used for high level wild dungeon battles
BattleTransition_VerticalStripes: ; 70c7e (1c:4c7e)
ld c, $12
- ld hl, wTileMap
+ hlCoord 0, 0
deCoord 1, 17
xor a
ld [H_AUTOBGTRANSFERENABLED], a
@@ -553,7 +553,7 @@
; used for low level wild dungeon battles
BattleTransition_HorizontalStripes: ; 70cb4 (1c:4cb4)
ld c, $14
- ld hl, wTileMap
+ hlCoord 0, 0
deCoord 19, 1
xor a
ld [H_AUTOBGTRANSFERENABLED], a
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -117,7 +117,7 @@
or c
jr nz, .clearBackgroundLoop
; copy the work RAM tile map to VRAM
- ld hl, wTileMap
+ hlCoord 0, 0
ld de, vBGMap0
ld b, 18 ; number of rows
.copyRowLoop
@@ -855,7 +855,7 @@
hlCoord 12, 5
deCoord 12, 6
call SlideDownFaintedMonPic
- ld hl, wTileMap
+ hlCoord 0, 0
ld bc, $40b
call ClearScreenArea
ld a, [W_ISINBATTLE]
@@ -1214,7 +1214,7 @@
ld a, [W_CUROPPONENT]
cp $c8 + SONY1
jr nz, .notSony1Battle
- ld hl, wTileMap ; sony 1 battle
+ hlCoord 0, 0 ; sony 1 battle
ld bc, $815
call ClearScreenArea
call ScrollTrainerPicAfterBattle
@@ -1489,7 +1489,7 @@
call LoadScreenTilesFromBuffer1
.next4
call ClearSprites
- ld hl,wTileMap
+ hlCoord 0, 0
ld bc,$040B
call ClearScreenArea
ld b,1
@@ -1952,7 +1952,7 @@
DrawEnemyHUDAndHPBar: ; 3cdec (f:4dec)
xor a
ld [H_AUTOBGTRANSFERENABLED], a
- ld hl, wTileMap
+ hlCoord 0, 0
ld bc, $40c
call ClearScreenArea
callab PlaceEnemyHUDTiles
--- a/engine/evos_moves.asm
+++ b/engine/evos_moves.asm
@@ -121,7 +121,7 @@
call DelayFrames
xor a
ld [H_AUTOBGTRANSFERENABLED], a
- ld hl, wTileMap
+ hlCoord 0, 0
ld bc, $c14
call ClearScreenArea
ld a, $1
--- a/engine/hidden_object_functions17.asm
+++ b/engine/hidden_object_functions17.asm
@@ -109,11 +109,11 @@
.asm_5c51
ld hl, wd730
set 6, [hl]
- ld hl, wTileMap
+ hlCoord 0, 0
ld b, $8
ld c, $d
call TextBoxBorder
- ld hl, wTileMap + $2a
+ hlCoord 2, 2
ld de, HowToLinkText
call PlaceString
ld hl, LinkCableHelpText2
@@ -193,13 +193,13 @@
.asm_5dd15
ld hl, wd730
set 6, [hl]
- ld hl, wTileMap
+ hlCoord 0, 0
ld bc, $060a
call TextBoxBorder
- ld hl, wTileMap + $29
+ hlCoord 1, 2
ld de, StatusAilmentText1
call PlaceString
- ld hl, wTileMap + $2e
+ hlCoord 6, 2
ld de, StatusAilmentText2
call PlaceString
ld hl, ViridianSchoolBlackboardText2
--- a/engine/hidden_object_functions3.asm
+++ b/engine/hidden_object_functions3.asm
@@ -107,7 +107,7 @@
ld a, [W_CURMAPTILESET]
cp MANSION ; Celadon Mansion tileset
jr nz, .asm_fbfd
- ld a, [wTileMap + $80]
+ aCoord 8, 6
cp $38
jr nz, .asm_fbfd
ld hl, DiglettSculptureText
--- a/engine/hidden_object_functions7.asm
+++ b/engine/hidden_object_functions7.asm
@@ -401,11 +401,11 @@
.asm_1ec2d
ld hl, wd730
set 6, [hl]
- ld hl, wTileMap
+ hlCoord 0, 0
ld b, $a
ld c, $9
call TextBoxBorder
- ld hl, wTileMap + $2a
+ hlCoord 2, 2
ld de, BillsMonListText
call PlaceString
ld hl, BillsHousePokemonListText2
--- a/engine/intro.asm
+++ b/engine/intro.asm
@@ -330,7 +330,7 @@
Func_418e9: ; 418e9 (10:58e9)
call Func_417f0
- ld hl, wTileMap
+ hlCoord 0, 0
ld c, $50
call Func_41807
hlCoord 0, 14
--- a/engine/menu/bills_pc.asm
+++ b/engine/menu/bills_pc.asm
@@ -11,17 +11,17 @@
ld a, [wd5a2]
and a
jr nz, .asm_213f3
- ld hl, wTileMap
+ hlCoord 0, 0
ld b, $8
ld c, $e
jr .asm_213fa
.asm_213ea
- ld hl, wTileMap
+ hlCoord 0, 0
ld b, $6
ld c, $e
jr .asm_213fa
.asm_213f3
- ld hl, wTileMap
+ hlCoord 0, 0
ld b, $a
ld c, $e
.asm_213fa
@@ -122,7 +122,7 @@
ld bc, (BANK(PokeballTileGraphics) << 8) + $01
call CopyVideoData
call LoadScreenTilesFromBuffer2DisableBGTransfer
- ld hl, wTileMap
+ hlCoord 0, 0
ld b, $a
ld c, $c
call TextBoxBorder
--- a/engine/menu/diploma.asm
+++ b/engine/menu/diploma.asm
@@ -12,7 +12,7 @@
ld bc, $0010
ld a, BANK(CircleTile)
call FarCopyData2
- ld hl, wTileMap
+ hlCoord 0, 0
ld bc, $1012
predef Diploma_TextBoxBorder
ld hl, DiplomaTextPointersAndCoords
@@ -77,15 +77,15 @@
DiplomaTextPointersAndCoords: ; 56784 (15:6784)
dw DiplomaText
- dw wTileMap + $2d
+ dwCoord 5, 2
dw DiplomaPlayer
- dw wTileMap + $53
+ dwCoord 3, 4
dw DiplomaEmptyText
- dw wTileMap + $5f
+ dwCoord 15, 4
dw DiplomaCongrats
- dw wTileMap + $7a
+ dwCoord 2, 6
dw DiplomaGameFreak
- dw wTileMap + $149
+ dwCoord 9, 16
DiplomaText:
db $70,"Diploma",$70,"@"
--- a/engine/menu/main_menu.asm
+++ b/engine/menu/main_menu.asm
@@ -363,23 +363,23 @@
PrintSaveScreenText: ; 5def (1:5def)
xor a
ld [H_AUTOBGTRANSFERENABLED], a
- ld hl, wTileMap + $4
+ hlCoord 4, 0
ld b, $8
ld c, $e
call TextBoxBorder
call LoadTextBoxTilePatterns
call UpdateSprites
- ld hl, wTileMap + $2d
+ hlCoord 5, 2
ld de, SaveScreenInfoText
call PlaceString
- ld hl, wTileMap + $34
+ hlCoord 12, 2
ld de, wPlayerName
call PlaceString
- ld hl, wTileMap + $61
+ hlCoord 17, 4
call Func_5e2f
- ld hl, wTileMap + $88
+ hlCoord 16, 6
call Func_5e42
- ld hl, wTileMap + $ad
+ hlCoord 13, 8
call Func_5e55
ld a, $1
ld [H_AUTOBGTRANSFERENABLED], a
--- a/engine/menu/naming_screen.asm
+++ b/engine/menu/naming_screen.asm
@@ -4,7 +4,7 @@
push hl
ld a, [W_ISINBATTLE]
dec a
- ld hl, wTileMap
+ hlCoord 0, 0
ld b, $4
ld c, $b
call z, ClearScreenArea ; only if in wild batle
--- a/engine/menu/players_pc.asm
+++ b/engine/menu/players_pc.asm
@@ -21,7 +21,7 @@
ld hl, wFlags_0xcd60
set 5, [hl]
call LoadScreenTilesFromBuffer2
- ld hl, wTileMap
+ hlCoord 0, 0
ld b, $8
ld c, $e
call TextBoxBorder
--- a/engine/menu/prize_menu.asm
+++ b/engine/menu/prize_menu.asm
@@ -21,12 +21,12 @@
ld [wTopMenuItemY],a
ld a,$01
ld [wTopMenuItemX],a
- call PrintPrizePrice ; 687A
+ call PrintPrizePrice
hlCoord 0, 2
ld b,$08
ld c,$10
call TextBoxBorder
- call GetPrizeMenuId ;678E
+ call GetPrizeMenuId
call UpdateSprites
ld hl,WhichPrizeTextPtr
call PrintText
@@ -36,7 +36,7 @@
ld a,[wCurrentMenuItem]
cp a,$03 ; "NO,THANKS" choice
jr z,.NoChoice
- call HandlePrizeChoice ; 14:68C6
+ call HandlePrizeChoice
.NoChoice
ld hl,wd730
res 6,[hl]
@@ -106,7 +106,7 @@
hlCoord 2, 8
call PlaceString
jr .putNoThanksText
-.putMonName ; 14:67EC
+.putMonName
ld a,[W_PRIZE1]
ld [wd11e],a
call GetMonName
@@ -122,7 +122,7 @@
call GetMonName
hlCoord 2, 8
call PlaceString
-.putNoThanksText ; 14:6819
+.putNoThanksText
hlCoord 2, 10
ld de,NoThanksText
call PlaceString
@@ -135,7 +135,7 @@
ld c,(1 << 7 | 2)
; Function $15CD displays BCD value (same routine
; used by text-command $02)
- call PrintBCDNumber ; Print_BCD
+ call PrintBCDNumber
ld de,wd143
hlCoord 13, 7
ld c,(%1 << 7 | 2)
@@ -165,10 +165,10 @@
call PrintBCDNumber
ret
-.CoinText ; 14:68A5
+.CoinText
db "COIN@"
-.SixSpacesText ; 14:68AA
+.SixSpacesText
db " @"
LoadCoinsToSubtract: ; 528b1 (14:68b1)
@@ -200,9 +200,9 @@
jr nz,.GetMonName
call GetItemName
jr .GivePrize
-.GetMonName ; 14:68E3
+.GetMonName
call GetMonName
-.GivePrize ; 14:68E6
+.GivePrize
ld hl,SoYouWantPrizeTextPtr
call PrintText
call YesNoChoice ; yes/no textbox
@@ -219,14 +219,14 @@
ld b,a
ld a,1
ld c,a
- call GiveItem ; GiveItem
+ call GiveItem
jr nc,.BagFull
jr .SubtractCoins
-.GiveMon ; 14:6912
+.GiveMon
ld a,[wd11e]
ld [wcf91],a
push af
- call GetPrizeMonLevel ; 14:6977
+ call GetPrizeMonLevel
ld c,a
pop af
ld b,a
@@ -237,7 +237,7 @@
call z,WaitForTextScrollButtonPress
pop af
ret nc
-.SubtractCoins ; 14:692C
+.SubtractCoins
call LoadCoinsToSubtract
ld hl,$FFA1
ld de,wPlayerCoins + 1
@@ -247,10 +247,10 @@
.BagFull
ld hl,PrizeRoomBagIsFullTextPtr
jp PrintText
-.NotEnoughCoins ; 14:6945
+.NotEnoughCoins
ld hl,SorryNeedMoreCoinsText
jp PrintText
-.PrintOhFineThen ; 14:694B
+.PrintOhFineThen
ld hl,OhFineThenTextPtr
jp PrintText
@@ -286,13 +286,13 @@
ld a,[wcf91]
ld b,a
ld hl,PrizeMonLevelDictionary
-.loop ; 14:697E
+.loop
ld a,[hli]
cp b
jr z,.matchFound
inc hl
jr .loop
-.matchFound ; 14:6985
+.matchFound
ld a,[hl]
ld [W_CURENEMYLVL],a
ret
--- a/engine/menu/start_sub_menus.asm
+++ b/engine/menu/start_sub_menus.asm
@@ -713,7 +713,7 @@
SwitchPartyMon_OAM: ; 13625 (4:7625)
push af
- ld hl, wTileMap
+ hlCoord 0, 0
ld bc, $28
call AddNTimes
ld c, $28
--- a/engine/oak_speech2.asm
+++ b/engine/oak_speech2.asm
@@ -66,7 +66,7 @@
Func_69ec: ; 69ec (1:69ec)
push de
- ld hl, wTileMap
+ hlCoord 0, 0
ld bc, $c0b
call ClearScreenArea
ld c, 10
@@ -155,7 +155,7 @@
DisplayIntroNameTextBox: ; 6a6c (1:6a6c)
push de
- ld hl, wTileMap
+ hlCoord 0, 0
ld b, $a
ld c, $9
call TextBoxBorder
--- a/engine/overworld/cinnabar_lab.asm
+++ b/engine/overworld/cinnabar_lab.asm
@@ -20,7 +20,7 @@
dec l
ld b, l
ld c, $d
- ld hl, wTileMap
+ hlCoord 0, 0
call TextBoxBorder
call UpdateSprites
call Func_610c2
--- a/engine/overworld/movement.asm
+++ b/engine/overworld/movement.asm
@@ -694,7 +694,7 @@
add $14 ; screen X tile + 20
ld d, $0
ld e, a
- ld hl, wTileMap
+ hlCoord 0, 0
add hl, bc
add hl, bc
add hl, bc
--- a/engine/save.asm
+++ b/engine/save.asm
@@ -426,7 +426,7 @@
and $7f
ld [wCurrentMenuItem], a
ld [wLastMenuItem], a
- ld hl, wTileMap
+ hlCoord 0, 0
ld b, $2
ld c, $9
call TextBoxBorder
--- a/engine/slot_machine.asm
+++ b/engine/slot_machine.asm
@@ -133,7 +133,7 @@
.skip2
ld hl, OneMoreGoSlotMachineText
call PrintText
- ld hl, wTileMap + $fe
+ hlCoord 14, 12
ld bc, $0d0f
xor a ; YES_NO_MENU
ld [wTwoOptionMenuID], a
@@ -836,7 +836,7 @@
ld a, BANK(SlotMachineTiles2)
call FarCopyData2
ld hl, SlotMachineMap
- ld de, wTileMap
+ deCoord 0, 0
ld bc, $00f0
call CopyData
call EnableLCD
--- a/engine/town_map.asm
+++ b/engine/town_map.asm
@@ -25,10 +25,10 @@
xor a
ld [wWhichTrade], a
pop af
- jr Func_70e92
+ jr .enterLoop
-Func_70e7e: ; 70e7e (1c:4e7e)
- ld hl, wTileMap
+.townMapLoop
+ hlCoord 0, 0
ld bc, $114
call ClearScreenArea
ld hl, TownMapOrder
@@ -37,13 +37,12 @@
ld b, $0
add hl, bc
ld a, [hl]
-
-Func_70e92: ; 70e92 (1c:4e92)
+.enterLoop
ld de, wHPBarMaxHP
- call Func_712f1
+ call FindTownMapCoords
ld a, [de]
push hl
- call Func_71258
+ call SetTownMapOAMCoords
ld a, $4
ld [wcd5b], a
ld hl, wOAMBuffer + $10
@@ -63,46 +62,46 @@
ld de, wTileMapBackup + 16
ld bc, $10
call CopyData
-.asm_70ec8
+.inputLoop
call TownMapSpriteBlinkingAnimation
call JoypadLowSensitivity
ld a, [hJoy5]
ld b, a
- and $c3
- jr z, .asm_70ec8
+ and A_BUTTON | B_BUTTON | D_UP | D_DOWN
+ jr z, .inputLoop
ld a, (SFX_02_3c - SFX_Headers_02) / 3
call PlaySound
bit 6, b
- jr nz, .asm_70ef2
+ jr nz, .upPressed
bit 7, b
- jr nz, .asm_70f01
+ jr nz, .downPressed
xor a
ld [wTownMapSpriteBlinkingEnabled], a
ld [hJoy7], a
ld [wTownMapSpriteBlinkingCounter], a
- call Func_711ab
+ call ExitTownMap
pop hl
pop af
ld [hl], a
ret
-.asm_70ef2
+.upPressed
ld a, [wWhichTrade]
inc a
- cp $2f
- jr nz, .asm_70efb
+ cp TownMapOrderEnd - TownMapOrder ; number of list items + 1
+ jr nz, .noOverflow
xor a
-.asm_70efb
+.noOverflow
ld [wWhichTrade], a
- jp Func_70e7e
-.asm_70f01
+ jp .townMapLoop
+.downPressed
ld a, [wWhichTrade]
dec a
cp $ff
- jr nz, .asm_70f0b
- ld a, $2e
-.asm_70f0b
+ jr nz, .noUnderflow
+ ld a, TownMapOrderEnd - TownMapOrder - 1 ; number of list items
+.noUnderflow
ld [wWhichTrade], a
- jp Func_70e7e
+ jp .townMapLoop
INCLUDE "data/town_map_order.asm"
@@ -116,7 +115,7 @@
push af
ld [hl], $ff
push hl
- call Func_711ef
+ call DisplayWildLocations
call GetMonName
hlCoord 1, 0
call PlaceString
@@ -125,7 +124,7 @@
ld de, MonsNestText
call PlaceString
call WaitForTextScrollButtonPress
- call Func_711ab
+ call ExitTownMap
pop hl
pop af
ld [hl], a
@@ -147,13 +146,13 @@
ld hl, vChars1 + $6d0
ld bc, (BANK(TownMapUpArrow) << 8) + $01
call CopyVideoDataDouble
- call Func_71070
+ call SetupVisitedTownsList
ld hl, wUpdateSpritesEnabled
ld a, [hl]
push af
ld [hl], $ff
push hl
- ld hl, wTileMap
+ hlCoord 0, 0
ld de, ToText
call PlaceString
ld a, [W_CURMAP]
@@ -184,7 +183,7 @@
hlCoord 19, 0
ld [hl], $ee
pop hl
-.asm_71004
+.inputLoop
push hl
call DelayFrame
call JoypadLowSensitivity
@@ -191,18 +190,18 @@
ld a, [hJoy5]
ld b, a
pop hl
- and $c3
- jr z, .asm_71004
+ and A_BUTTON | B_BUTTON | D_UP | D_DOWN
+ jr z, .inputLoop
bit 0, b
- jr nz, .asm_71026
+ jr nz, .aButtonPressed
ld a, (SFX_02_3c - SFX_Headers_02) / 3
call PlaySound
bit 6, b
- jr nz, .asm_71042
+ jr nz, .upPressed
bit 7, b
- jr nz, .asm_71058
- jr .asm_71037
-.asm_71026
+ jr nz, .downPressed
+ jr .bButtonPressed
+.aButtonPressed
ld a, (SFX_02_3e - SFX_Headers_02) / 3
call PlaySound
ld a, [hl]
@@ -211,7 +210,7 @@
set 3, [hl]
inc hl
set 7, [hl]
-.asm_71037
+.bButtonPressed
xor a
ld [wTownMapSpriteBlinkingEnabled], a
call GBPalWhiteOutWithDelay3
@@ -219,7 +218,7 @@
pop af
ld [hl], a
ret
-.asm_71042
+.upPressed
deCoord 18, 0
inc hl
ld a, [hl]
@@ -226,12 +225,12 @@
cp $ff
jr z, .asm_71052
cp $fe
- jr z, .asm_71042
+ jr z, .upPressed
jp .townMapFlyLoop
.asm_71052
ld hl, wTrainerEngageDistance
jp .townMapFlyLoop
-.asm_71058
+.downPressed
deCoord 19, 0
dec hl
ld a, [hl]
@@ -238,16 +237,16 @@
cp $ff
jr z, .asm_71068
cp $fe
- jr z, .asm_71058
+ jr z, .downPressed
jp .townMapFlyLoop
.asm_71068
ld hl, wcd49
- jr .asm_71058
+ jr .downPressed
ToText: ; 7106d (1c:506d)
db "To@"
-Func_71070: ; 71070 (1c:5070)
+SetupVisitedTownsList: ; 71070 (1c:5070)
ld hl, wWhichTrade
ld [hl], $ff
inc hl
@@ -255,19 +254,19 @@
ld e, a
ld a, [W_TOWNVISITEDFLAG + 1]
ld d, a
- ld bc, $b
-.asm_71081
+ ld bc, SAFFRON_CITY + 1
+.loop
srl d
rr e
ld a, $fe
- jr nc, .asm_7108a
+ jr nc, .notVisited
ld a, b
-.asm_7108a
+.notVisited
ld [hl], a
inc hl
inc b
dec c
- jr nz, .asm_71081
+ jr nz, .loop
ld [hl], $ff
ret
@@ -278,7 +277,7 @@
call GBPalWhiteOutWithDelay3
call ClearScreen
call UpdateSprites
- ld hl, wTileMap
+ hlCoord 0, 0
ld b, $12
ld c, $12
call TextBoxBorder
@@ -293,12 +292,12 @@
ld bc, $8
ld a, BANK(MonNestIcon)
call FarCopyDataDouble
- ld hl, wTileMap
+ hlCoord 0, 0
ld de, CompressedMap
-.asm_710d3
+.nextTile
ld a, [de]
and a
- jr z, .asm_710e9
+ jr z, .done
ld b, a
and $f
ld c, a
@@ -306,13 +305,13 @@
swap a
and $f
add $60
-.asm_710e2
+.uncompressTile
ld [hli], a
dec c
- jr nz, .asm_710e2
+ jr nz, .uncompressTile
inc de
- jr .asm_710d3
-.asm_710e9
+ jr .nextTile
+.done
call EnableLCD
ld b, $2
call GoPAL_SET
@@ -328,7 +327,7 @@
; you can decompress this file with the redrle program in the extras/ dir
INCBIN "gfx/town_map.rle"
-Func_711ab: ; 711ab (1c:51ab)
+ExitTownMap: ; 711ab (1c:51ab)
xor a
ld [wTownMapSpriteBlinkingEnabled], a
call GBPalWhiteOut
@@ -345,10 +344,10 @@
ld [wcd5b], a
pop af
ld de, wHPBarMaxHP
- call Func_712f1
+ call FindTownMapCoords
ld a, [de]
push hl
- call Func_71258
+ call SetTownMapOAMCoords
call Func_7126d
pop hl
ld de, wcd6d
@@ -363,35 +362,35 @@
ld bc, $a0
jp CopyData
-Func_711ef: ; 711ef (1c:51ef)
+DisplayWildLocations: ; 711ef (1c:51ef)
callba FindWildLocationsOfMon
call Func_712d9
ld hl, wOAMBuffer
ld de, wBuffer
-.asm_71200
+.loop
ld a, [de]
cp $ff
- jr z, .asm_7121d
+ jr z, .exitLoop
and a
- jr z, .asm_7121a
+ jr z, .next
push hl
- call Func_712f1
+ call FindTownMapCoords
pop hl
ld a, [de]
cp $19
- jr z, .asm_7121a
- call Func_71258
- ld a, $4
+ jr z, .next
+ call SetTownMapOAMCoords
+ ld a, $4 ; nest icon tile no.
ld [hli], a
xor a
ld [hli], a
-.asm_7121a
+.next
inc de
- jr .asm_71200
-.asm_7121d
+ jr .loop
+.exitLoop
ld a, l
and a
- jr nz, .asm_71236
+ jr nz, .locationKnown
hlCoord 1, 7
ld b, $2
ld c, $f
@@ -399,12 +398,12 @@
hlCoord 2, 9
ld de, AreaUnknownText
call PlaceString
- jr .asm_7123e
-.asm_71236
+ jr .done
+.locationKnown
ld a, [W_CURMAP]
ld b, $0
call Func_711c4
-.asm_7123e
+.done
ld hl, wOAMBuffer
ld de, wTileMapBackup
ld bc, $a0
@@ -413,7 +412,7 @@
AreaUnknownText: ; 7124a (1c:524a)
db " AREA UNKNOWN@"
-Func_71258: ; 71258 (1c:5258)
+SetTownMapOAMCoords: ; 71258 (1c:5258)
push af
and $f0
srl a
@@ -541,20 +540,20 @@
inc hl
jr .asm_712e4
-Func_712f1: ; 712f1 (1c:52f1)
+FindTownMapCoords: ; 712f1 (1c:52f1)
cp REDS_HOUSE_1F
- jr c, .asm_71304
+ jr c, .townOrRoute
ld bc, $4
ld hl, InternalMapEntries
-.asm_712fb
+.loop
cp [hl]
- jr c, .asm_71301
+ jr c, .match
add hl, bc
- jr .asm_712fb
-.asm_71301
+ jr .loop
+.match
inc hl
- jr .asm_7130d
-.asm_71304
+ jr .done
+.townOrRoute
ld hl, ExternalMapEntries
ld c, a
ld b, $0
@@ -561,7 +560,7 @@
add hl, bc
add hl, bc
add hl, bc
-.asm_7130d
+.done
ld a, [hli]
ld [de], a
ld a, [hli]
--- a/engine/trade.asm
+++ b/engine/trade.asm
@@ -148,7 +148,7 @@
jp DelayFrames
Trade_ClearTileMap: ; 41196 (10:5196)
- ld hl, wTileMap
+ hlCoord 0, 0
ld bc, 20 * 18
ld a, " "
jp FillMemory
--- a/home.asm
+++ b/home.asm
@@ -3171,7 +3171,7 @@
SaveScreenTilesToBuffer2:: ; 36f4 (0:36f4)
- ld hl, wTileMap
+ hlCoord 0, 0
ld de, wTileMapBackup2
ld bc, $168
call CopyData
@@ -3188,13 +3188,13 @@
xor a
ld [H_AUTOBGTRANSFERENABLED], a
ld hl, wTileMapBackup2
- ld de, wTileMap
+ deCoord 0, 0
ld bc, $168
call CopyData
ret
SaveScreenTilesToBuffer1:: ; 3719 (0:3719)
- ld hl, wTileMap
+ hlCoord 0, 0
ld de, wTileMapBackup
ld bc, $168
jp CopyData
@@ -3203,7 +3203,7 @@
xor a
ld [H_AUTOBGTRANSFERENABLED], a
ld hl, wTileMapBackup
- ld de, wTileMap
+ deCoord 0, 0
ld bc, $168
call CopyData
ld a, $1
@@ -4032,7 +4032,7 @@
ld a,[wTopMenuItemY]
and a ; is the y coordinate 0?
jr z,.adjustForXCoord
- ld hl,wTileMap
+ hlCoord 0, 0
ld bc,SCREEN_WIDTH
.topMenuItemLoop
add hl,bc
--- a/home/copy2.asm
+++ b/home/copy2.asm
@@ -184,17 +184,17 @@
ld c, 6
ld hl, $600 * 0
- ld de, wTileMap + 20 * 6 * 0
+ deCoord 0, 6 * 0
call .setup
call DelayFrame
ld hl, $600 * 1
- ld de, wTileMap + 20 * 6 * 1
+ deCoord 0, 6 * 1
call .setup
call DelayFrame
ld hl, $600 * 2
- ld de, wTileMap + 20 * 6 * 2
+ deCoord 0, 6 * 2
call .setup
jp DelayFrame
@@ -217,7 +217,7 @@
; for the bg map to update.
ld bc, 20 * 18
inc b
- ld hl, wTileMap
+ hlCoord 0, 0
ld a, $7f
.loop
ld [hli], a
--- a/home/overworld.asm
+++ b/home/overworld.asm
@@ -1420,10 +1420,10 @@
ld bc,$0002
add hl,bc
.copyToVisibleAreaBuffer
- ld de,wTileMap ; base address for the tiles that are directly transfered to VRAM during V-blank
- ld b,$12
+ deCoord 0, 0 ; base address for the tiles that are directly transfered to VRAM during V-blank
+ ld b, SCREEN_HEIGHT
.rowLoop2
- ld c,$14
+ ld c, SCREEN_WIDTH
.rowInnerLoop2
ld a,[hli]
ld [de],a
@@ -2323,7 +2323,7 @@
call LoadTilesetTilePatternData
call LoadCurrentMapView
; copy current map view to VRAM
- ld hl,wTileMap
+ hlCoord 0, 0
ld de,vBGMap0
ld b,18
.vramCopyLoop
--- a/home/text.asm
+++ b/home/text.asm
@@ -207,7 +207,7 @@
ld de,wBattleMonNick ; player active monster name
jr FinishDTE
-.Enemy ; 1A40
+.Enemy
; print “Enemy ”
ld de,Char5AText
call PlaceString
--- a/main.asm
+++ b/main.asm
@@ -1276,7 +1276,7 @@
; hl = address of upper left corner of text box
GetAddressOfScreenCoords: ; 7375 (1:7375)
push bc
- ld hl,wTileMap
+ hlCoord 0, 0
ld bc,20
.loop ; loop to add d rows to the base address
ld a,d
@@ -2298,7 +2298,7 @@
ret c
cp UNKNOWN_DUNGEON_2
ret nc
- ld hl, wTileMap
+ hlCoord 0, 0
ld b, $3
ld c, $7
call TextBoxBorder
--- a/scripts/bikeshop.asm
+++ b/scripts/bikeshop.asm
@@ -51,7 +51,7 @@
ld [wTopMenuItemX], a
ld hl, wd730
set 6, [hl]
- ld hl, wTileMap
+ hlCoord 0, 0
ld b, $4
ld c, $f
call TextBoxBorder
--- a/scripts/celadonmartroof.asm
+++ b/scripts/celadonmartroof.asm
@@ -63,7 +63,7 @@
dec l
ld b, l
ld c, $c
- ld hl, wTileMap
+ hlCoord 0, 0
call TextBoxBorder
call UpdateSprites
call CeladonMartRoofScript_48532
--- a/scripts/redshouse1f.asm
+++ b/scripts/redshouse1f.asm
@@ -5,7 +5,7 @@
dw RedsHouse1FText1
dw RedsHouse1FText2
-RedsHouse1FText1: ; 4816f (12:416f) ; 416F Mom
+RedsHouse1FText1: ; 4816f (12:416f) Mom
TX_ASM
ld a, [wd72e]
bit 3, a