summaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
Diffstat (limited to 'engine')
-rwxr-xr-xengine/battle/core.asm16
-rw-r--r--engine/battle/wild_encounters.asm2
-rw-r--r--engine/bcd.asm215
-rwxr-xr-xengine/cable_club.asm8
-rwxr-xr-xengine/give_pokemon.asm2
-rwxr-xr-xengine/hidden_object_functions3.asm72
-rwxr-xr-xengine/hp_bar.asm28
-rwxr-xr-xengine/items/items.asm22
-rwxr-xr-xengine/learn_move.asm12
-rw-r--r--engine/menu/bills_pc.asm10
-rwxr-xr-xengine/menu/main_menu.asm2
-rwxr-xr-xengine/menu/party_menu.asm8
-rwxr-xr-xengine/menu/start_sub_menus.asm2
-rwxr-xr-xengine/menu/status_screen.asm2
-rwxr-xr-xengine/overworld/cut.asm2
-rwxr-xr-xengine/overworld/doors.asm2
-rwxr-xr-xengine/overworld/ledges.asm2
-rwxr-xr-xengine/overworld/player_animations.asm2
-rwxr-xr-xengine/palettes.asm6
-rwxr-xr-xengine/save.asm4
20 files changed, 316 insertions, 103 deletions
diff --git a/engine/battle/core.asm b/engine/battle/core.asm
index 8a46c705..e5fd98f8 100755
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -2557,13 +2557,13 @@ MoveSelectionMenu: ; 3d219 (f:5219)
.writemoves
ld de, wMovesString
- ld a, [hFlags_0xFFF6]
+ ld a, [hFlags_0xFFFA]
set 2, a
- ld [hFlags_0xFFF6], a
+ ld [hFlags_0xFFFA], a
call PlaceString
- ld a, [hFlags_0xFFF6]
+ ld a, [hFlags_0xFFFA]
res 2, a
- ld [hFlags_0xFFF6], a
+ ld [hFlags_0xFFFA], a
ret
.regularmenu
@@ -2682,10 +2682,10 @@ SelectMenuItem: ; 3d2fe (f:52fe)
call AddNTimes
ld [hl], $ec
.select
- ld hl, hFlags_0xFFF6
+ ld hl, hFlags_0xFFFA
set 1, [hl]
call HandleMenuInput
- ld hl, hFlags_0xFFF6
+ ld hl, hFlags_0xFFFA
res 1, [hl]
bit 6, a
jp nz, CursorUp ; up
@@ -4053,7 +4053,7 @@ CheckForDisobedience: ; 3dc88 (f:5c88)
; it was traded
.monIsTraded
; what level might disobey?
- ld hl, W_OBTAINEDBADGES
+ ld hl, wObtainedBadges
bit 7, [hl]
ld a, 101
jr nz, .next
@@ -6660,7 +6660,7 @@ ApplyBadgeStatBoosts: ; 3ee19 (f:6e19)
ld a, [wLinkState]
cp LINK_STATE_BATTLING
ret z ; return if link battle
- ld a, [W_OBTAINEDBADGES]
+ ld a, [wObtainedBadges]
ld b, a
ld hl, wBattleMonAttack
ld c, $4
diff --git a/engine/battle/wild_encounters.asm b/engine/battle/wild_encounters.asm
index 144234bb..908bd493 100644
--- a/engine/battle/wild_encounters.asm
+++ b/engine/battle/wild_encounters.asm
@@ -41,7 +41,7 @@ TryDoWildEncounter: ; 13870 (4:7870)
ld a, [W_CURMAP]
cp REDS_HOUSE_1F ; is this an indoor map?
jr c, .CantEncounter2
- ld a, [W_CURMAPTILESET]
+ ld a, [wCurMapTileset]
cp FOREST ; Viridian Forest/Safari Zone
jr z, .CantEncounter2
ld a, [W_GRASSRATE]
diff --git a/engine/bcd.asm b/engine/bcd.asm
new file mode 100644
index 00000000..a5322702
--- /dev/null
+++ b/engine/bcd.asm
@@ -0,0 +1,215 @@
+; divide hMoney by hDivideBCDDivisor
+; return output in hDivideBCDQuotient (same as hDivideBCDDivisor)
+; used only to halve player money upon losing a fight
+DivideBCDPredef:: ; f5a4 (3:75a4)
+DivideBCDPredef2::
+DivideBCDPredef3:: ; only used function
+DivideBCDPredef4::
+ call GetPredefRegisters
+
+DivideBCD:: ; f5a8 (3:75a8)
+ xor a
+ ld [hDivideBCDBuffer], a
+ ld [hDivideBCDBuffer + 1], a
+ ld [hDivideBCDBuffer + 2], a
+ ld d, $1
+.asm_f5b0
+ ld a, [hDivideBCDDivisor]
+ and $f0
+ jr nz, .asm_f5e1
+ inc d
+ ld a, [hDivideBCDDivisor]
+ swap a
+ and $f0
+ ld b, a
+ ld a, [hDivideBCDDivisor + 1]
+ swap a
+ ld [hDivideBCDDivisor + 1], a
+ and $f
+ or b
+ ld [hDivideBCDDivisor], a
+ ld a, [hDivideBCDDivisor + 1]
+ and $f0
+ ld b, a
+ ld a, [hDivideBCDDivisor + 2]
+ swap a
+ ld [hDivideBCDDivisor + 2], a
+ and $f
+ or b
+ ld [hDivideBCDDivisor + 1], a
+ ld a, [hDivideBCDDivisor + 2]
+ and $f0
+ ld [hDivideBCDDivisor + 2], a
+ jr .asm_f5b0
+.asm_f5e1
+ push de
+ push de
+ call DivideBCD_f686
+ pop de
+ ld a, b
+ swap a
+ and $f0
+ ld [hDivideBCDBuffer], a
+ dec d
+ jr z, .asm_f642
+ push de
+ call DivideBCD_f65d
+ call DivideBCD_f686
+ pop de
+ ld a, [hDivideBCDBuffer]
+ or b
+ ld [hDivideBCDBuffer], a
+ dec d
+ jr z, .asm_f642
+ push de
+ call DivideBCD_f65d
+ call DivideBCD_f686
+ pop de
+ ld a, b
+ swap a
+ and $f0
+ ld [hDivideBCDBuffer + 1], a
+ dec d
+ jr z, .asm_f642
+ push de
+ call DivideBCD_f65d
+ call DivideBCD_f686
+ pop de
+ ld a, [hDivideBCDBuffer + 1]
+ or b
+ ld [hDivideBCDBuffer + 1], a
+ dec d
+ jr z, .asm_f642
+ push de
+ call DivideBCD_f65d
+ call DivideBCD_f686
+ pop de
+ ld a, b
+ swap a
+ and $f0
+ ld [hDivideBCDBuffer + 2], a
+ dec d
+ jr z, .asm_f642
+ push de
+ call DivideBCD_f65d
+ call DivideBCD_f686
+ pop de
+ ld a, [hDivideBCDBuffer + 2]
+ or b
+ ld [hDivideBCDBuffer + 2], a
+.asm_f642
+ ld a, [hDivideBCDBuffer]
+ ld [hDivideBCDQuotient], a
+ ld a, [hDivideBCDBuffer + 1]
+ ld [hDivideBCDQuotient + 1], a
+ ld a, [hDivideBCDBuffer + 2]
+ ld [hDivideBCDQuotient + 2], a
+ pop de
+ ld a, $6
+ sub d
+ and a
+ ret z
+.asm_f654
+ push af
+ call DivideBCD_f65d
+ pop af
+ dec a
+ jr nz, .asm_f654
+ ret
+
+DivideBCD_f65d: ; f65d (3:765d)
+ ld a, [hDivideBCDDivisor + 2]
+ swap a
+ and $f
+ ld b, a
+ ld a, [hDivideBCDDivisor + 1]
+ swap a
+ ld [hDivideBCDDivisor + 1], a
+ and $f0
+ or b
+ ld [hDivideBCDDivisor + 2], a
+ ld a, [hDivideBCDDivisor + 1]
+ and $f
+ ld b, a
+ ld a, [hDivideBCDDivisor]
+ swap a
+ ld [hDivideBCDDivisor], a
+ and $f0
+ or b
+ ld [hDivideBCDDivisor + 1], a
+ ld a, [hDivideBCDDivisor]
+ and $f
+ ld [hDivideBCDDivisor], a
+ ret
+
+DivideBCD_f686: ; f686 (3:7686)
+ ld bc, $3
+.asm_f689
+ ld de, hMoney
+ ld hl, hDivideBCDDivisor
+ push bc
+ call StringCmp
+ pop bc
+ ret c
+ inc b
+ ld de, hMoney + 2
+ ld hl, hDivideBCDDivisor + 2
+ push bc
+ call SubBCD
+ pop bc
+ jr .asm_f689
+
+
+AddBCDPredef:: ; f6a3 (3:76a3)
+ call GetPredefRegisters
+
+AddBCD:: ; f6a6 (3:76a6)
+ and a
+ ld b, c
+.add
+ ld a, [de]
+ adc [hl]
+ daa
+ ld [de], a
+ dec de
+ dec hl
+ dec c
+ jr nz, .add
+ jr nc, .done
+ ld a, $99
+ inc de
+.fill
+ ld [de], a
+ inc de
+ dec b
+ jr nz, .fill
+.done
+ ret
+
+
+SubBCDPredef:: ; f6bc (3:76bc)
+ call GetPredefRegisters
+
+SubBCD:: ; f6bf (3:76bf)
+ and a
+ ld b, c
+.sub
+ ld a, [de]
+ sbc [hl]
+ daa
+ ld [de], a
+ dec de
+ dec hl
+ dec c
+ jr nz, .sub
+ jr nc, .done
+ ld a, $00
+ inc de
+.fill
+ ld [de], a
+ inc de
+ dec b
+ jr nz, .fill
+ scf
+.done
+ ret \ No newline at end of file
diff --git a/engine/cable_club.asm b/engine/cable_club.asm
index 465561ca..059b309a 100755
--- a/engine/cable_club.asm
+++ b/engine/cable_club.asm
@@ -338,10 +338,10 @@ TradeCenter_SelectMon:
ld a, 1
ld [wTopMenuItemX], a
.enemyMonMenu_HandleInput
- ld hl, hFlags_0xFFF6
+ ld hl, hFlags_0xFFFA
set 1, [hl]
call HandleMenuInput
- ld hl, hFlags_0xFFF6
+ ld hl, hFlags_0xFFFA
res 1, [hl]
and a
jp z, .getNewInput
@@ -403,10 +403,10 @@ TradeCenter_SelectMon:
lb bc, 6, 1
call ClearScreenArea
.playerMonMenu_HandleInput
- ld hl, hFlags_0xFFF6
+ ld hl, hFlags_0xFFFA
set 1, [hl]
call HandleMenuInput
- ld hl, hFlags_0xFFF6
+ ld hl, hFlags_0xFFFA
res 1, [hl]
and a ; was anything pressed?
jr nz, .playerMonMenu_SomethingPressed
diff --git a/engine/give_pokemon.asm b/engine/give_pokemon.asm
index 410c9c33..7de90e55 100755
--- a/engine/give_pokemon.asm
+++ b/engine/give_pokemon.asm
@@ -7,7 +7,7 @@ _GivePokemon: ; f66fa (3d:66fa)
ld a, [wPartyCount]
cp PARTY_LENGTH
jr c, .addToParty
- ld a, [W_NUMINBOX]
+ ld a, [wNumInBox]
cp MONS_PER_BOX
jr nc, .boxFull
; add to box
diff --git a/engine/hidden_object_functions3.asm b/engine/hidden_object_functions3.asm
index 80251b94..ba6d1fd3 100755
--- a/engine/hidden_object_functions3.asm
+++ b/engine/hidden_object_functions3.asm
@@ -1,10 +1,10 @@
; prints text for bookshelves in buildings without sign events
-PrintBookshelfText: ; fb50 (3:7b50)
+PrintBookshelfText: ; f9de (3:79de)
ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction
cp SPRITE_FACING_UP
jr nz, .noMatch
; facing up
- ld a, [W_CURMAPTILESET]
+ ld a, [wCurMapTileset]
ld b, a
aCoord 8, 7
ld c, a
@@ -37,95 +37,95 @@ PrintBookshelfText: ; fb50 (3:7b50)
jpba PrintCardKeyText
; format: db tileset id, bookshelf tile id, text id
-BookshelfTileIDs: ; fb8b (3:7b8b)
+BookshelfTileIDs: ; fa19 (3:7a19)
db PLATEAU, $30
- db (IndigoPlateauStatues_id - TextPredefs) / 2 + 1
+ db_tx_pre IndigoPlateauStatues
db HOUSE, $3D
- db (TownMapText_id - TextPredefs) / 2 + 1
+ db_tx_pre TownMapText
db HOUSE, $1E
- db (BookOrSculptureText_id - TextPredefs) / 2 + 1
+ db_tx_pre BookOrSculptureText
db MANSION, $32
- db (BookOrSculptureText_id - TextPredefs) / 2 + 1
+ db_tx_pre BookOrSculptureText
db REDS_HOUSE_1, $32
- db (BookOrSculptureText_id - TextPredefs) / 2 + 1
+ db_tx_pre BookOrSculptureText
db LAB, $28
- db (BookOrSculptureText_id - TextPredefs) / 2 + 1
+ db_tx_pre BookOrSculptureText
db LOBBY, $16
- db (ElevatorText_id - TextPredefs) / 2 + 1
+ db_tx_pre ElevatorText
db GYM, $1D
- db (BookOrSculptureText_id - TextPredefs) / 2 + 1
+ db_tx_pre BookOrSculptureText
db DOJO, $1D
- db (BookOrSculptureText_id - TextPredefs) / 2 + 1
+ db_tx_pre BookOrSculptureText
db GATE, $22
- db (BookOrSculptureText_id - TextPredefs) / 2 + 1
+ db_tx_pre BookOrSculptureText
db MART, $54
- db (PokemonStuffText_id - TextPredefs) / 2 + 1
+ db_tx_pre PokemonStuffText
db MART, $55
- db (PokemonStuffText_id - TextPredefs) / 2 + 1
+ db_tx_pre PokemonStuffText
db POKECENTER, $54
- db (PokemonStuffText_id - TextPredefs) / 2 + 1
+ db_tx_pre PokemonStuffText
db POKECENTER, $55
- db (PokemonStuffText_id - TextPredefs) / 2 + 1
+ db_tx_pre PokemonStuffText
db LOBBY, $50
- db (PokemonStuffText_id - TextPredefs) / 2 + 1
+ db_tx_pre PokemonStuffText
db LOBBY, $52
- db (PokemonStuffText_id - TextPredefs) / 2 + 1
+ db_tx_pre PokemonStuffText
db SHIP, $36
- db (BookOrSculptureText_id - TextPredefs) / 2 + 1
+ db_tx_pre BookOrSculptureText
db $FF
-IndigoPlateauStatues: ; fbbf (3:7bbf)
+IndigoPlateauStatues: ; fa4d (3:7a4d)
TX_ASM
ld hl, IndigoPlateauStatuesText1
call PrintText
ld a, [W_XCOORD]
bit 0, a
ld hl, IndigoPlateauStatuesText2
- jr nz, .asm_fbd3
+ jr nz, .asm_fa61
ld hl, IndigoPlateauStatuesText3
-.asm_fbd3
+.asm_fa61
call PrintText
jp TextScriptEnd
-IndigoPlateauStatuesText1: ; fbd9 (3:7bd9)
+IndigoPlateauStatuesText1: ; fa67 (3:7a67)
TX_FAR _IndigoPlateauStatuesText1
db "@"
-IndigoPlateauStatuesText2: ; fbde (3:7bde)
+IndigoPlateauStatuesText2: ; fa6c (3:7a6c)
TX_FAR _IndigoPlateauStatuesText2
db "@"
-IndigoPlateauStatuesText3: ; fbe3 (3:7be3)
+IndigoPlateauStatuesText3: ; fa71 (3:7a71)
TX_FAR _IndigoPlateauStatuesText3
db "@"
-BookOrSculptureText: ; fbe8 (3:7be8)
+BookOrSculptureText: ; fa76 (3:7a76)
TX_ASM
ld hl, PokemonBooksText
- ld a, [W_CURMAPTILESET]
+ ld a, [wCurMapTileset]
cp MANSION ; Celadon Mansion tileset
- jr nz, .asm_fbfd
+ jr nz, .asm_fa8b
aCoord 8, 6
cp $38
- jr nz, .asm_fbfd
+ jr nz, .asm_fa8b
ld hl, DiglettSculptureText
-.asm_fbfd
+.asm_fa8b
call PrintText
jp TextScriptEnd
-PokemonBooksText: ; fc03 (3:7c03)
+PokemonBooksText: ; fa91 (3:7a91)
TX_FAR _PokemonBooksText
db "@"
-DiglettSculptureText: ; fc08 (3:7c08)
+DiglettSculptureText: ; fa96 (3:7a96)
TX_FAR _DiglettSculptureText
db "@"
-ElevatorText: ; fc0d (3:7c0d)
+ElevatorText: ; fa9b (3:7a9b)
TX_FAR _ElevatorText
db "@"
-TownMapText: ; fc12 (3:7c12)
+TownMapText: ; faa0 (3:7aa0)
TX_FAR _TownMapText
db $06
TX_ASM
@@ -148,6 +148,6 @@ TownMapText: ; fc12 (3:7c12)
push af
jp CloseTextDisplay
-PokemonStuffText: ; fc45 (3:7c45)
+PokemonStuffText: ; fad3 (3:7ad3)
TX_FAR _PokemonStuffText
db "@"
diff --git a/engine/hp_bar.asm b/engine/hp_bar.asm
index 792661ab..789f1bd7 100755
--- a/engine/hp_bar.asm
+++ b/engine/hp_bar.asm
@@ -1,9 +1,9 @@
-HPBarLength: ; f9dc (3:79dc)
+HPBarLength: ; f86c (3:786c)
call GetPredefRegisters
; calculates bc * 48 / de, the number of pixels the HP bar has
; the result is always at least 1
-GetHPBarLength: ; f9df (3:79df)
+GetHPBarLength: ; f86f (3:786f)
push hl
xor a
ld hl, H_MULTIPLICAND
@@ -45,7 +45,7 @@ GetHPBarLength: ; f9df (3:79df)
ret
; predef $48
-UpdateHPBar: ; fa1d (3:7a1d)
+UpdateHPBar: ; f8ad (3:78ad)
UpdateHPBar2:
push hl
ld hl, wHPBarOldHP
@@ -95,7 +95,7 @@ UpdateHPBar2:
call UpdateHPBar_CalcOldNewHPBarPixels
ld a, e
sub d ; calc pixel difference
- jr .asm_fa7e
+ jr .asm_f90e
.HPIncrease
inc bc ; add 1 HP
ld a, c
@@ -105,7 +105,7 @@ UpdateHPBar2:
call UpdateHPBar_CalcOldNewHPBarPixels
ld a, d
sub e ; calc pixel difference
-.asm_fa7e
+.asm_f90e
call UpdateHPBar_PrintHPNumber
and a
jr z, .noPixelDifference
@@ -136,7 +136,7 @@ UpdateHPBar2:
; animates the HP bar going up or down for (a) ticks (two waiting frames each)
; stops prematurely if bar is filled up
; e: current health (in pixels) to start with
-UpdateHPBar_AnimateHPBar: ; fab1 (3:7ab1)
+UpdateHPBar_AnimateHPBar: ; f941 (3:7941)
push hl
.barAnimationLoop
push af
@@ -162,7 +162,7 @@ UpdateHPBar_AnimateHPBar: ; fab1 (3:7ab1)
ret
; compares old HP and new HP and sets c and z flags accordingly
-UpdateHPBar_CompareNewHPToOldHP: ; fad1 (3:7ad1)
+UpdateHPBar_CompareNewHPToOldHP: ; f961 (3:7961)
ld a, d
sub b
ret nz
@@ -171,7 +171,7 @@ UpdateHPBar_CompareNewHPToOldHP: ; fad1 (3:7ad1)
ret
; calcs HP difference between bc and de (into de)
-UpdateHPBar_CalcHPDifference: ; fad7 (3:7ad7)
+UpdateHPBar_CalcHPDifference: ; f967 (3:7967)
ld a, d
sub b
jr c, .oldHPGreater
@@ -200,7 +200,7 @@ UpdateHPBar_CalcHPDifference: ; fad7 (3:7ad7)
ld de, $0
ret
-UpdateHPBar_PrintHPNumber: ; faf5 (3:7af5)
+UpdateHPBar_PrintHPNumber: ; f985 (3:7985)
push af
push de
ld a, [wHPBarType]
@@ -212,13 +212,11 @@ UpdateHPBar_PrintHPNumber: ; faf5 (3:7af5)
ld a, [wHPBarOldHP + 1]
ld [wHPBarTempHP], a
push hl
- ld a, [hFlags_0xFFF6]
+ ld de, $15
+ ld a, [hFlags_0xFFFA]
bit 0, a
- jr z, .asm_fb15
+ jr z, .next
ld de, $9
- jr .next
-.asm_fb15
- ld de, $15
.next
add hl, de
push hl
@@ -240,7 +238,7 @@ UpdateHPBar_PrintHPNumber: ; faf5 (3:7af5)
; calcs number of HP bar pixels for old and new HP value
; d: new pixels
; e: old pixels
-UpdateHPBar_CalcOldNewHPBarPixels: ; fb30 (3:7b30)
+UpdateHPBar_CalcOldNewHPBarPixels: ; f9be (3:79be)
push hl
ld hl, wHPBarMaxHP
ld a, [hli] ; max HP into de
diff --git a/engine/items/items.asm b/engine/items/items.asm
index 533da448..3afae425 100755
--- a/engine/items/items.asm
+++ b/engine/items/items.asm
@@ -114,7 +114,7 @@ ItemUseBall: ; d3ad (3:53ad)
ld a,[wPartyCount] ;is Party full?
cp a,PARTY_LENGTH
jr nz,.UseBall
- ld a,[W_NUMINBOX] ;is Box full?
+ ld a,[wNumInBox] ;is Box full?
cp a,MONS_PER_BOX
jp z,BoxFullCannotThrowBall
.UseBall
@@ -1483,7 +1483,7 @@ ItemUseEscapeRope: ; ddcf (3:5dcf)
jr z,.notUsable
cp a,POKEMON_FAN_CLUB
jr z,.notUsable
- ld a,[W_CURMAPTILESET]
+ ld a,[wCurMapTileset]
ld b,a
ld hl,EscapeRopeTilesets
.loop
@@ -2800,7 +2800,7 @@ IsKeyItem_: ; e6a8 (3:66a8)
INCLUDE "data/key_items.asm"
SendNewMonToBox: ; e6e8 (3:66e8)
- ld de, W_NUMINBOX
+ ld de, wNumInBox
ld a, [de]
inc a
ld [de], a
@@ -2819,7 +2819,7 @@ SendNewMonToBox: ; e6e8 (3:66e8)
call GetMonHeader
ld hl, wBoxMonOT
ld bc, NAME_LENGTH
- ld a, [W_NUMINBOX]
+ ld a, [wNumInBox]
dec a
jr z, .asm_e732
dec a
@@ -2830,7 +2830,7 @@ SendNewMonToBox: ; e6e8 (3:66e8)
ld d, h
ld e, l
pop hl
- ld a, [W_NUMINBOX]
+ ld a, [wNumInBox]
dec a
ld b, a
.asm_e71f
@@ -2851,7 +2851,7 @@ SendNewMonToBox: ; e6e8 (3:66e8)
ld de, wBoxMonOT
ld bc, NAME_LENGTH
call CopyData
- ld a, [W_NUMINBOX]
+ ld a, [wNumInBox]
dec a
jr z, .asm_e76e
ld hl, wBoxMonNicks
@@ -2864,7 +2864,7 @@ SendNewMonToBox: ; e6e8 (3:66e8)
ld d, h
ld e, l
pop hl
- ld a, [W_NUMINBOX]
+ ld a, [wNumInBox]
dec a
ld b, a
.asm_e75b
@@ -2885,7 +2885,7 @@ SendNewMonToBox: ; e6e8 (3:66e8)
ld a, NAME_MON_SCREEN
ld [wNamingScreenType], a
predef AskName
- ld a, [W_NUMINBOX]
+ ld a, [wNumInBox]
dec a
jr z, .asm_e7ab
ld hl, wBoxMons
@@ -2898,7 +2898,7 @@ SendNewMonToBox: ; e6e8 (3:66e8)
ld d, h
ld e, l
pop hl
- ld a, [W_NUMINBOX]
+ ld a, [wNumInBox]
dec a
ld b, a
.asm_e798
@@ -2975,13 +2975,13 @@ SendNewMonToBox: ; e6e8 (3:66e8)
; used for surfing and fishing
; unsets carry if it is, sets carry if not
IsNextTileShoreOrWater: ; e808 (3:6808)
- ld a, [W_CURMAPTILESET]
+ ld a, [wCurMapTileset]
ld hl, WaterTilesets
ld de,1
call IsInArray ; does the current map allow surfing?
ret nc ; if not, return
ld hl,WaterTile
- ld a, [W_CURMAPTILESET]
+ ld a, [wCurMapTileset]
cp SHIP_PORT ; Vermilion Dock tileset
jr z, .skipShoreTiles ; if it's the Vermilion Dock tileset
cp GYM ; eastern shore tile in Safari Zone
diff --git a/engine/learn_move.asm b/engine/learn_move.asm
index c0ced4a0..ba96f29f 100755
--- a/engine/learn_move.asm
+++ b/engine/learn_move.asm
@@ -126,13 +126,13 @@ TryingToLearn: ; 6f07 (1:6f07)
call TextBoxBorder
coord hl, 6, 8
ld de, wMovesString
- ld a, [hFlags_0xFFF6]
+ ld a, [hFlags_0xFFFA]
set 2, a
- ld [hFlags_0xFFF6], a
+ ld [hFlags_0xFFFA], a
call PlaceString
- ld a, [hFlags_0xFFF6]
+ ld a, [hFlags_0xFFFA]
res 2, a
- ld [hFlags_0xFFF6], a
+ ld [hFlags_0xFFFA], a
ld hl, wTopMenuItemY
ld a, 8
ld [hli], a ; wTopMenuItemY
@@ -146,10 +146,10 @@ TryingToLearn: ; 6f07 (1:6f07)
ld a, A_BUTTON | B_BUTTON
ld [hli], a ; wMenuWatchedKeys
ld [hl], 0 ; wLastMenuItem
- ld hl, hFlags_0xFFF6
+ ld hl, hFlags_0xFFFA
set 1, [hl]
call HandleMenuInput
- ld hl, hFlags_0xFFF6
+ ld hl, hFlags_0xFFFA
res 1, [hl]
push af
call LoadScreenTilesFromBuffer1
diff --git a/engine/menu/bills_pc.asm b/engine/menu/bills_pc.asm
index 3f0db4ea..4a274871 100644
--- a/engine/menu/bills_pc.asm
+++ b/engine/menu/bills_pc.asm
@@ -218,7 +218,7 @@ BillsPCDeposit: ; 2156d (8:556d)
call PrintText
jp BillsPCMenu
.partyLargeEnough
- ld a, [W_NUMINBOX]
+ ld a, [wNumInBox]
cp MONS_PER_BOX
jr nz, .boxNotFull
ld hl, BoxFullText
@@ -279,7 +279,7 @@ SleepingPikachuText2: ; 2160e (8:560e)
db "@"
BillsPCWithdraw: ; 21613 (8:5613)
- ld a, [W_NUMINBOX]
+ ld a, [wNumInBox]
and a
jr nz, .boxNotEmpty
ld hl, NoMonText
@@ -293,7 +293,7 @@ BillsPCWithdraw: ; 21613 (8:5613)
call PrintText
jp BillsPCMenu
.partyNotFull
- ld hl, W_NUMINBOX
+ ld hl, wNumInBox
call DisplayMonListMenu
jp c, BillsPCMenu
call DisplayDepositWithdrawMenu
@@ -322,14 +322,14 @@ BillsPCWithdraw: ; 21613 (8:5613)
jp BillsPCMenu
BillsPCRelease: ; 21690 (8:5690)
- ld a, [W_NUMINBOX]
+ ld a, [wNumInBox]
and a
jr nz, .loop
ld hl, NoMonText
call PrintText
jp BillsPCMenu
.loop
- ld hl, W_NUMINBOX
+ ld hl, wNumInBox
call DisplayMonListMenu
jp c, BillsPCMenu
callab Func_fce0d
diff --git a/engine/menu/main_menu.asm b/engine/menu/main_menu.asm
index 6c109cec..98f1efdd 100755
--- a/engine/menu/main_menu.asm
+++ b/engine/menu/main_menu.asm
@@ -392,7 +392,7 @@ PrintSaveScreenText: ; 5def (1:5def)
PrintNumBadges: ; 5e2f (1:5e2f)
push hl
- ld hl, W_OBTAINEDBADGES
+ ld hl, wObtainedBadges
ld b, $1
call CountSetBits
pop hl
diff --git a/engine/menu/party_menu.asm b/engine/menu/party_menu.asm
index f3e1a138..293ed255 100755
--- a/engine/menu/party_menu.asm
+++ b/engine/menu/party_menu.asm
@@ -88,14 +88,14 @@ RedrawPartyMenu_: ; 12ce3 (4:6ce3)
pop hl
push hl
ld bc,20 + 1 ; down 1 row and right 1 column
- ld a,[hFlags_0xFFF6]
+ ld a,[hFlags_0xFFFA]
set 0,a
- ld [hFlags_0xFFF6],a
+ ld [hFlags_0xFFFA],a
add hl,bc
predef DrawHP2 ; draw HP bar and prints current / max HP
- ld a,[hFlags_0xFFF6]
+ ld a,[hFlags_0xFFFA]
res 0,a
- ld [hFlags_0xFFF6],a
+ ld [hFlags_0xFFFA],a
call SetPartyMenuHPBarColor ; color the HP bar (on SGB)
pop hl
jr .printLevel
diff --git a/engine/menu/start_sub_menus.asm b/engine/menu/start_sub_menus.asm
index ab8c8756..dcbee277 100755
--- a/engine/menu/start_sub_menus.asm
+++ b/engine/menu/start_sub_menus.asm
@@ -117,7 +117,7 @@ StartMenu_Pokemon: ; 130a9 (4:70a9)
ld a,[hli]
ld h,[hl]
ld l,a
- ld a,[W_OBTAINEDBADGES] ; badges obtained
+ ld a,[wObtainedBadges] ; badges obtained
jp [hl]
.outOfBattleMovePointers
dw .cut
diff --git a/engine/menu/status_screen.asm b/engine/menu/status_screen.asm
index c91d5eda..8775a8d9 100755
--- a/engine/menu/status_screen.asm
+++ b/engine/menu/status_screen.asm
@@ -40,7 +40,7 @@ DrawHP_: ; 128fb (4:68fb)
push hl
call DrawHPBar
pop hl
- ld a, [hFlags_0xFFF6]
+ ld a, [hFlags_0xFFFA]
bit 0, a
jr z, .printFractionBelowBar
ld bc, $9 ; right of bar
diff --git a/engine/overworld/cut.asm b/engine/overworld/cut.asm
index 276ec93e..8c863bf2 100755
--- a/engine/overworld/cut.asm
+++ b/engine/overworld/cut.asm
@@ -1,7 +1,7 @@
UsedCut: ; edd1 (3:6dd1)
xor a
ld [wActionResultOrTookBattleTurn], a ; initialise to failure value
- ld a, [W_CURMAPTILESET]
+ ld a, [wCurMapTileset]
and a ; OVERWORLD
jr z, .overworld
cp GYM
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/ledges.asm b/engine/overworld/ledges.asm
index df4273fd..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
diff --git a/engine/overworld/player_animations.asm b/engine/overworld/player_animations.asm
index 6488eaac..ff579a04 100755
--- a/engine/overworld/player_animations.asm
+++ b/engine/overworld/player_animations.asm
@@ -357,7 +357,7 @@ GetPlayerTeleportAnimFrameDelay: ; 707df (1c:47df)
IsPlayerStandingOnWarpPadOrHole: ; 707e7 (1c:47e7)
ld b, 0
ld hl, .warpPadAndHoleData
- ld a, [W_CURMAPTILESET]
+ ld a, [wCurMapTileset]
ld c, a
.loop
ld a, [hli]
diff --git a/engine/palettes.asm b/engine/palettes.asm
index 8182315c..722b7804 100755
--- a/engine/palettes.asm
+++ b/engine/palettes.asm
@@ -147,7 +147,7 @@ SetPal_Overworld: ; 71fa5 (1c:5fa5)
ld de, wPalPacket
ld bc, $10
call CopyData
- ld a, [W_CURMAPTILESET]
+ ld a, [wCurMapTileset]
cp CEMETERY
jr z, .PokemonTowerOrAgatha
cp CAVERN
@@ -222,7 +222,7 @@ SetPal_TrainerCard: ; 72025 (1c:6025)
call CopyData
ld de, BadgeBlkDataLengths
ld hl, wTrainerCardBlkPacket + 2
- ld a, [W_OBTAINEDBADGES]
+ ld a, [wObtainedBadges]
ld c, 8
.badgeLoop
srl a
@@ -391,7 +391,7 @@ Func_720e3:: ; 720e3 (1c:60e3)
Func_7213b:: ; 7213b (1c:613b)
; similar to SetPal_Overworld
- ld a, [W_CURMAPTILESET]
+ ld a, [wCurMapTileset]
cp CEMETERY
jr z, .PokemonTowerOrAgatha
cp CAVERN
diff --git a/engine/save.asm b/engine/save.asm
index a75ec41c..bd557135 100755
--- a/engine/save.asm
+++ b/engine/save.asm
@@ -61,7 +61,7 @@ LoadSAV0: ; 73994 (1c:7994)
ld de, wMainDataStart
ld bc, wMainDataEnd - wMainDataStart
call CopyData
- ld hl, W_CURMAPTILESET
+ ld hl, wCurMapTileset
set 7, [hl]
ld hl, sSpriteData
ld de, wSpriteDataStart
@@ -554,7 +554,7 @@ GetMonCountsForAllBoxes: ; 73a84 (1c:7a84)
ld c, a
ld b, 0
add hl, bc
- ld a, [W_NUMINBOX]
+ ld a, [wNumInBox]
ld [hl], a
ret