ref: 0fcef5fc087dc30817410d7692d53e2c382828d5
parent: 894955f9d922de5fc33e6c0aa7af9795dbcbc158
author: PikalaxALT <PikalaxALT@gmail.com>
date: Fri Jul 17 13:17:10 EDT 2015
More annotations and interpretations of functions and scripts
--- a/constants/event_flags.asm
+++ b/constants/event_flags.asm
@@ -1,8 +1,8 @@
const_def
- const EVENT_CHRIS1_IN_CABLE_CLUB
- const EVENT_CHRIS2_IN_CABLE_CLUB
+ const EVENT_000
+ const EVENT_001
const EVENT_002
const EVENT_003
const EVENT_004
@@ -1648,6 +1648,9 @@
const EVENT_63D
const EVENT_63E
const EVENT_63F
+; Sprite visibility: When these events are cleared, the sprite becomes visible; when set, the sprite is hidden.
+; The map script command macros `disappear` and `appear` set/clear these flags and immediately apply the effect on visibility.
+; The map script command macros `setevent` and `clearevent` set/clear these flags, and their effects will be seen when the map is reloaded.
const EVENT_CYNDAQUIL_POKEBALL_IN_ELMS_LAB
const EVENT_TOTODILE_POKEBALL_IN_ELMS_LAB
const EVENT_CHIKORITA_POKEBALL_IN_ELMS_LAB
@@ -1824,8 +1827,8 @@
const EVENT_6ED
const EVENT_6EE
const EVENT_6EF
- const EVENT_6F0
- const EVENT_6F1
+ const EVENT_GOLDENROD_SALE_OFF
+ const EVENT_GOLDENROD_SALE_ON
const EVENT_6F2
const EVENT_6F3
const EVENT_6F4
--- a/constants/map_constants.asm
+++ b/constants/map_constants.asm
@@ -580,61 +580,61 @@
const_value SET $80
SPRITE_POKEMON EQU const_value
- const SPRITE_UNOWN
- const SPRITE_GEODUDE
- const SPRITE_GROWLITHE
- const SPRITE_WEEDLE
- const SPRITE_SHELLDER
- const SPRITE_ODDISH
- const SPRITE_GENGAR
- const SPRITE_ZUBAT
- const SPRITE_MAGIKARP
- const SPRITE_SQUIRTLE
- const SPRITE_TOGEPI
- const SPRITE_BUTTERFREE
- const SPRITE_DIGLETT
- const SPRITE_POLIWAG
- const SPRITE_PIKACHU
- const SPRITE_CLEFAIRY
- const SPRITE_CHARMANDER
- const SPRITE_JYNX
- const SPRITE_STARMIE
- const SPRITE_BULBASAUR
- const SPRITE_JIGGLYPUFF
- const SPRITE_GRIMER
- const SPRITE_EKANS
- const SPRITE_PARAS
- const SPRITE_TENTACOOL
- const SPRITE_TAUROS
- const SPRITE_MACHOP
- const SPRITE_VOLTORB
- const SPRITE_LAPRAS
- const SPRITE_RHYDON
- const SPRITE_MOLTRES
- const SPRITE_SNORLAX
- const SPRITE_GYARADOS
- const SPRITE_LUGIA
- const SPRITE_HO_OH
+ const SPRITE_UNOWN ; 80
+ const SPRITE_GEODUDE ; 81
+ const SPRITE_GROWLITHE ; 82
+ const SPRITE_WEEDLE ; 83
+ const SPRITE_SHELLDER ; 84
+ const SPRITE_ODDISH ; 85
+ const SPRITE_GENGAR ; 86
+ const SPRITE_ZUBAT ; 87
+ const SPRITE_MAGIKARP ; 88
+ const SPRITE_SQUIRTLE ; 89
+ const SPRITE_TOGEPI ; 8a
+ const SPRITE_BUTTERFREE ; 8b
+ const SPRITE_DIGLETT ; 8c
+ const SPRITE_POLIWAG ; 8d
+ const SPRITE_PIKACHU ; 8e
+ const SPRITE_CLEFAIRY ; 8f
+ const SPRITE_CHARMANDER ; 90
+ const SPRITE_JYNX ; 91
+ const SPRITE_STARMIE ; 92
+ const SPRITE_BULBASAUR ; 93
+ const SPRITE_JIGGLYPUFF ; 94
+ const SPRITE_GRIMER ; 95
+ const SPRITE_EKANS ; 96
+ const SPRITE_PARAS ; 97
+ const SPRITE_TENTACOOL ; 98
+ const SPRITE_TAUROS ; 99
+ const SPRITE_MACHOP ; 9a
+ const SPRITE_VOLTORB ; 9b
+ const SPRITE_LAPRAS ; 9c
+ const SPRITE_RHYDON ; 9d
+ const SPRITE_MOLTRES ; 9e
+ const SPRITE_SNORLAX ; 9f
+ const SPRITE_GYARADOS ; a0
+ const SPRITE_LUGIA ; a1
+ const SPRITE_HO_OH ; a2
const_value SET $e0
- const SPRITE_DAYCARE_MON_1
- const SPRITE_DAYCARE_MON_2
+ const SPRITE_DAYCARE_MON_1 ; e0
+ const SPRITE_DAYCARE_MON_2 ; e1
const_value SET $f0
SPRITE_VARS EQU const_value
- const SPRITE_CONSOLE
- const SPRITE_DOLL_1
- const SPRITE_DOLL_2
- const SPRITE_BIG_DOLL
- const SPRITE_WEIRD_TREE
- const SPRITE_OLIVINE_RIVAL
- const SPRITE_AZALEA_ROCKET
- const SPRITE_FUCHSIA_GYM_1
- const SPRITE_FUCHSIA_GYM_2
- const SPRITE_FUCHSIA_GYM_3
- const SPRITE_FUCHSIA_GYM_4
- const SPRITE_COPYCAT
- const SPRITE_JANINE_IMPERSONATOR
+ const SPRITE_CONSOLE ; f0
+ const SPRITE_DOLL_1 ; f1
+ const SPRITE_DOLL_2 ; f2
+ const SPRITE_BIG_DOLL ; f3
+ const SPRITE_WEIRD_TREE ; f4
+ const SPRITE_OLIVINE_RIVAL ; f5
+ const SPRITE_AZALEA_ROCKET ; f6
+ const SPRITE_FUCHSIA_GYM_1 ; f7
+ const SPRITE_FUCHSIA_GYM_2 ; f8
+ const SPRITE_FUCHSIA_GYM_3 ; f9
+ const SPRITE_FUCHSIA_GYM_4 ; fa
+ const SPRITE_COPYCAT ; fb
+ const SPRITE_JANINE_IMPERSONATOR ; fc
; sprite types
const_value SET 1
@@ -716,8 +716,8 @@
const MAPOBJECT_POINTER_HI ; b
const MAPOBJECT_FLAG_LO ; c
const MAPOBJECT_FLAG_HI ; d
- const MAPOBJECT_E
- const MAPOBJECT_F
+ const MAPOBJECT_E ; unused
+ const MAPOBJECT_F ; unused
MAPOBJECT_NOT_VISIBLE EQU -1
MAPOBJECT_SCREEN_HEIGHT EQU 11
--- a/constants/misc_constants.asm
+++ b/constants/misc_constants.asm
@@ -98,3 +98,71 @@
SWITCH_RARELY EQU 1 << SWITCH_RARELY_F
SWITCH_OFTEN EQU 1 << SWITCH_OFTEN_F
SPRITE_GFX_LIST_CAPACITY EQU $20
+
+const_value = 1
+ const MOM_ITEM
+ const MOM_DOLL
+
+ const_def
+ const DECO_BED
+ const DECO_CARPET
+ const DECO_PLANT
+ const DECO_POSTER
+ const DECO_CONSOLE
+ const DECO_ORNAMENT
+ const DECO_BIGDOLL
+
+ const_def
+ const CARPET_00
+ const CARPET_01
+ const PLANT_02
+ const PLANT_03
+ const PLANT_04
+ const PLANT_05
+ const CARPET_06
+ const POSTER_07
+ const POSTER_08
+ const POSTER_09
+ const POSTER_0A
+ const CARPET_0B
+ const CARPET_0C
+ const CARPET_0D
+ const CARPET_0E
+ const CARPET_0F
+ const CARPET_10
+ const CONSOLE_11
+ const CONSOLE_12
+ const CONSOLE_13
+ const CARPET_14
+ const CARPET_FAMICOM
+ const CONSTENT_SNES
+ const CARPET_N64
+ const CARPET_VIRTUAL_BOY
+ const CARPET_19
+ const BIGDOLL_SNORLAX
+ const BIGDOLL_ONIX
+ const BIGDOLL_LAPRAS
+ const CARPET_1D
+ const DOLL_PIKACHU
+ const DOLL_SURFING_PIKACHU
+ const DOLL_CLEFAIRY
+ const DOLL_JIGGLYPUFF
+ const DOLL_BULBASAUR
+ const DOLL_CHARMANDER
+ const DOLL_SQUIRTLE
+ const DOLL_POLIWAG
+ const DOLL_DIGLETT
+ const DOLL_STARMIE
+ const DOLL_MAGIKARP
+ const DOLL_ODDISH
+ const DOLL_GENGAR
+ const DOLL_SHELLDER
+ const DOLL_GRIMER
+ const DOLL_VOLTORM
+ const DOLL_WEEDLE
+ const DOLL_UNOWN
+ const DOLL_GEODUDE
+ const DOLL_MACHOP
+ const DOLL_TENTACOOL
+ const CARPET_GOLD_TROPHY
+ const CARPET_SILVER_TROPHY
--- a/engine/events_2.asm
+++ b/engine/events_2.asm
@@ -271,21 +271,21 @@
Function97db5: ; 97db5
ld hl, StatusFlags2
bit 4, [hl]
- jr z, .asm_97df7
+ jr z, .NoCall
ld a, [PlayerState]
- cp $1
- jr nz, .asm_97df7
+ cp 1
+ jr nz, .NoCall
call Function2d05
and a
- jr nz, .asm_97df7
+ jr nz, .NoCall
ld hl, wdca1 + 1
ld a, [hli]
ld d, a
ld e, [hl]
- cp $ff
+ cp -1
jr nz, .asm_97dd8
ld a, e
- cp $ff
+ cp -1
jr z, .asm_97ddc
.asm_97dd8
@@ -297,20 +297,20 @@
.asm_97ddc
ld a, d
cp $4
- jr c, .asm_97df7
- ld a, [wdc31]
+ jr c, .NoCall
+ ld a, [wSpecialPhoneCallID]
and a
- jr nz, .asm_97df7
- ld a, $6
- ld [wdc31], a
+ jr nz, .NoCall
+ ld a, 6
+ ld [wSpecialPhoneCallID], a
xor a
- ld [wdc31 + 1], a
+ ld [wSpecialPhoneCallID + 1], a
ld hl, StatusFlags2
res 4, [hl]
scf
ret
-.asm_97df7
+.NoCall
xor a
ret
; 97df9
@@ -317,14 +317,14 @@
Function97df9:: ; 97df9
ld hl, wd6de
- ld de, $0006
- ld c, $4
+ ld de, 6
+ ld c, 4
xor a
-.asm_97e02
+.loop
ld [hl], a
add hl, de
dec c
- jr nz, .asm_97e02
+ jr nz, .loop
ret
; 97e08
--- a/engine/more_phone_scripts.asm
+++ b/engine/more_phone_scripts.asm
@@ -1656,5 +1656,5 @@
UnknownScript_0xa0b09:
farwritetext UnknownText_0x174000
clearflag ENGINE_BIKE_SHOP_CALL_ENABLED
- specialphonecall $0000
+ specialphonecall ELMCALL_NONE
end
--- a/engine/phone_scripts.asm
+++ b/engine/phone_scripts.asm
@@ -139,7 +139,7 @@
MomPhoneLectureScript: ; 0xbcfb1
setevent EVENT_TALKED_TO_MOM_AFTER_MYSTERY_EGG_QUEST
setflag ENGINE_DST
- specialphonecall $0000
+ specialphonecall ELMCALL_NONE
farwritetext MomPhoneLectureText
yesorno
iftrue MomPhoneSaveMoneyScript
@@ -247,7 +247,7 @@
.pokerus ; 0xbd079
farwritetext ElmPhonePokerusText
- specialphonecall $0000
+ specialphonecall ELMCALL_NONE
end
ElmPhoneScript2: ; 0xbd081
@@ -258,18 +258,18 @@
if_equal $5, .gift
if_equal $8, .gift
farwritetext ElmPhonePokerusText
- specialphonecall $0000
+ specialphonecall ELMCALL_NONE
end
.disaster ; 0xbd09f
farwritetext ElmPhoneDisasterText
- specialphonecall $0000
+ specialphonecall ELMCALL_NONE
setevent EVENT_ELM_CALLED_ABOUT_STOLEN_POKEMON
end
.assistant ; 0xbd0aa
farwritetext ElmPhoneEggAssistantText
- specialphonecall $0000
+ specialphonecall ELMCALL_NONE
clearevent EVENT_ELMS_AIDE_IN_VIOLET_POKEMON_CENTER
setevent EVENT_ELMS_AIDE_IN_LAB
end
@@ -276,17 +276,17 @@
.rocket ; 0xbd0b8
farwritetext ElmPhoneRocketText
- specialphonecall $0000
+ specialphonecall ELMCALL_NONE
end
.gift ; 0xbd0c0
farwritetext ElmPhoneGiftText
- specialphonecall $0000
+ specialphonecall ELMCALL_NONE
end
.unused ; 0xbd0c8
farwritetext ElmPhoneUnusedText
- specialphonecall $0000
+ specialphonecall ELMCALL_NONE
end
; bd0d0
--- a/engine/scripting.asm
+++ b/engine/scripting.asm
@@ -2450,7 +2450,7 @@
; 0x9786d
LoadMoneyAmountToMem: ; 0x9786d
- ld bc, $ffc3
+ ld bc, hMoneyTemp
push bc
call GetScriptByte
ld [bc], a
@@ -2498,8 +2498,8 @@
call GetScriptByte
ld [$ffc4], a
call GetScriptByte
- ld [$ffc3], a
- ld bc, $ffc3
+ ld [hMoneyTemp], a
+ ld bc, hMoneyTemp
ret
; 0x978ae
@@ -2572,6 +2572,7 @@
; script command 0x2a
; parameters:
; person (SingleByteParam)
+; returns false if the cell number is not in your phone
xor a
ld [ScriptVar], a
@@ -2590,16 +2591,17 @@
; call_id (MultiByteParam)
call GetScriptByte
- ld [wdc31], a
+ ld [wSpecialPhoneCallID], a
call GetScriptByte
- ld [wdc31 + 1], a
+ ld [wSpecialPhoneCallID + 1], a
ret
; 0x97926
Script_checkphonecall: ; 0x97926
; script command 0x9d
+; returns false if no special phone call is stored
- ld a, [wdc31]
+ ld a, [wSpecialPhoneCallID]
and a
jr z, .ok
ld a, 1
@@ -2648,6 +2650,7 @@
; parameters:
; pkmn (PokemonParam)
; level (DecimalParam)
+; if no room in the party, return 0 in ScriptVar; else, return 2
xor a
ld [ScriptVar], a
@@ -2658,7 +2661,7 @@
ld [CurPartyLevel], a
callba GiveEgg
ret nc
- ld a, $2
+ ld a, 2
ld [ScriptVar], a
ret
; 0x97988
@@ -2672,7 +2675,7 @@
ld e, a
call GetScriptByte
ld d, a
- ld b, $1
+ ld b, 1 ; set
call EventFlagAction
ret
; 0x97996
@@ -2686,7 +2689,7 @@
ld e, a
call GetScriptByte
ld d, a
- ld b, $0
+ ld b, 0 ; clear
call EventFlagAction
ret
; 0x979a4
@@ -2700,13 +2703,13 @@
ld e, a
call GetScriptByte
ld d, a
- ld b, $2
+ ld b, 2 ; check
call EventFlagAction
ld a, c
and a
- jr z, .asm_979b7 ; 0x979b3 $2
- ld a, $1
-.asm_979b7
+ jr z, .false ; 0x979b3 $2
+ ld a, 1
+.false
ld [ScriptVar], a
ret
; 0x979bb
@@ -2720,7 +2723,7 @@
ld e, a
call GetScriptByte
ld d, a
- ld b, $1
+ ld b, 1 ; set
call _EngineFlagAction
ret
; 0x979c9
@@ -2734,7 +2737,7 @@
ld e, a
call GetScriptByte
ld d, a
- ld b, $0
+ ld b, 0 ; clear
call _EngineFlagAction
ret
; 0x979d7
@@ -2748,13 +2751,13 @@
ld e, a
call GetScriptByte
ld d, a
- ld b, $2
+ ld b, 2 ; check
call _EngineFlagAction
ld a, c
and a
- jr z, .asm_979ea ; 0x979e6 $2
- ld a, $1
-.asm_979ea
+ jr z, .false ; 0x979e6 $2
+ ld a, 1
+.false
ld [ScriptVar], a
ret
; 0x979ee
@@ -2808,7 +2811,7 @@
set 5, a
or c
ld [wd45b], a
-; 0x97a1d
+; fall through
Script_warp: ; 0x97a1d
; script command 0x3c
@@ -2818,6 +2821,7 @@
; x (SingleByteParam)
; y (SingleByteParam)
+; This seems to be some sort of error handling case.
call GetScriptByte
and a
jr z, .not_ok ; 0x97a21 $27
@@ -2828,11 +2832,11 @@
ld [XCoord], a
call GetScriptByte
ld [YCoord], a
- ld a, $ff
+ ld a, -1
ld [wd001], a
- ld a, $f1
+ ld a, -15
ld [$ff9f], a
- ld a, $1
+ ld a, 1
call LoadMapStatus
call StopScript
ret
@@ -2840,11 +2844,11 @@
call GetScriptByte
call GetScriptByte
call GetScriptByte
- ld a, $ff
+ ld a, -1
ld [wd001], a
- ld a, $fb
+ ld a, -5
ld [$ff9f], a
- ld a, $1
+ ld a, 1
call LoadMapStatus
call StopScript
ret
@@ -2882,7 +2886,7 @@
Script_reloadmapmusic: ; 0x97a85
; script command 0x83
- ld a, $1
+ ld a, 1
ld [wc2c1], a
ret
; 0x97a8b
@@ -2913,7 +2917,7 @@
ld b, a
callba Function97e5c
ret c
- ld a, $1
+ ld a, 1
ld [ScriptVar], a
ret
; 0x97ab3
@@ -2942,10 +2946,10 @@
; block (SingleByteParam)
call GetScriptByte
- add $4
+ add 4
ld d, a
call GetScriptByte
- add $4
+ add 4
ld e, a
call GetBlockLocation
call GetScriptByte
@@ -2987,7 +2991,7 @@
call GetScriptByte
ld [$ff9f], a
- ld a, $1
+ ld a, 1
call LoadMapStatus
call StopScript
ret
@@ -3064,14 +3068,14 @@
call GetScriptByte
and a
- jr z, .asm_97b50 ; 0x97b4b $3
+ jr z, .loop ; 0x97b4b $3
ld [ScriptDelay], a
-.asm_97b50
+.loop
ld c, 2
call DelayFrames
ld hl, ScriptDelay
dec [hl]
- jr nz, .asm_97b50 ; 0x97b59 $f5
+ jr nz, .loop ; 0x97b59 $f5
ret
; 0x97b5c
@@ -3082,9 +3086,9 @@
call GetScriptByte
and a
- jr z, .asm_97b65 ; 0x97b60 $3
+ jr z, .no_time ; 0x97b60 $3
ld [ScriptDelay], a
-.asm_97b65
+.no_time
ld a, SCRIPT_WAIT
ld [ScriptMode], a
call StopScript
@@ -3104,9 +3108,9 @@
; script command 0x91
call ExitScriptSubroutine
- jr c, .asm_97b7a
+ jr c, .resume
ret
-.asm_97b7a
+.resume
xor a
ld [ScriptRunning], a
ld a, SCRIPT_OFF
@@ -3121,8 +3125,8 @@
; script command 0x90
call ExitScriptSubroutine
- jr c, .asm_97b91
-.asm_97b91
+ jr c, .dummy
+.dummy
ld hl, ScriptFlags
res 0, [hl]
call StopScript
@@ -3135,17 +3139,15 @@
ld hl, wd43c
ld a, [hl]
and a
- jr z, .asm_97bbe ; 0x97b9f $1d
+ jr z, .done ; 0x97b9f $1d
dec [hl]
ld e, [hl]
ld d, $0
ld hl, wd43d
- add hl, de
- add hl, de
- add hl, de
+ add_n_times hl, de, 3
ld a, [hli]
ld b, a
- and $7f
+ and " "
ld [ScriptBank], a
ld a, [hli]
ld e, a
@@ -3155,7 +3157,7 @@
ld [ScriptPos + 1], a
and a
ret
-.asm_97bbe
+.done
scf
ret
; 0x97bc0
@@ -3208,13 +3210,13 @@
push bc
call GetScriptByte
-.asm_97c09
+.loop
push af
ld c, 6
call DelayFrames
pop af
dec a
- jr nz, .asm_97c09 ; 0x97c11 $f6
+ jr nz, .loop ; 0x97c11 $f6
pop bc
ret
; 0x97c15
@@ -3229,7 +3231,7 @@
; 0x97c20
-Function97c20: ; 97c20
+Function97c20: ; 97c20 unreferenced
ld a, [.byte]
ld [ScriptVar], a
ret
--- a/engine/std_scripts.asm
+++ b/engine/std_scripts.asm
@@ -159,7 +159,7 @@
.pokerus_done
setflag ENGINE_POKERUS
- specialphonecall 1 ; elm calls about pokerus
+ specialphonecall ELMCALL_POKERUS
end
DifficultBookshelfScript:
@@ -297,7 +297,7 @@
clearevent EVENT_6CE
clearevent EVENT_USED_THE_CARD_KEY_IN_THE_RADIO_TOWER
setevent EVENT_756
- specialphonecall $0004
+ specialphonecall ELMCALL_WEIRDBROADCAST
domaptrigger GROUP_MAHOGANY_TOWN, MAP_MAHOGANY_TOWN, $1
end
@@ -383,7 +383,7 @@
; 0xbc31e
BugContestResults_FirstPlace ; 0xbc31e
- setevent EVENT_CHRIS1_IN_CABLE_CLUB
+ setevent EVENT_000
itemtotext SUN_STONE, $1
farwritetext ContestResults_PlayerWonAPrizeText
closetext
@@ -581,7 +581,7 @@
setevent EVENT_7A5
setevent EVENT_6EC
setevent EVENT_6ED
- setevent EVENT_6F0
+ setevent EVENT_GOLDENROD_SALE_OFF
setevent EVENT_7A9
setevent EVENT_EUSINE_IN_BURNED_TOWER
setevent EVENT_6C8
--- a/hram.asm
+++ b/hram.asm
@@ -41,6 +41,8 @@
hMathBuffer EQU $ffb8
+hMoneyTemp EQU $ffc3
+
hLCDStatCustom EQU $ffc6
hSerialSend EQU $ffcd
--- a/items/item_effects.asm
+++ b/items/item_effects.asm
@@ -2810,7 +2810,7 @@
; f769
Function_0xf769: ; f769
- callba Function26f02
+ callba SetSpecificDecorationFlag
ld hl, UnknownText_0xf778
call PrintText
--- a/main.asm
+++ b/main.asm
@@ -11,15 +11,15 @@
ld a, [IsInBattle]
and a
- jr z, .asm_4012
+ jr z, .notinbattle
call TextBox
- jr .asm_4017
+ jr .continue
-.asm_4012
+.notinbattle
predef Function28eef
-.asm_4017
+.continue
hlcoord 4, 11
ld de, .Waiting
call PlaceString
@@ -130,12 +130,12 @@
NewGame: ; 5b6b
xor a
ld [wc2cc], a
- call Function5ba7
+ call ResetWRAM
call Function5b44
call Function5b8f
call OakSpeech
call InitializeWorld
- ld a, $1
+ ld a, 1
ld [wc2d8], a
ld a, 0 ; SPAWN_HOME
@@ -148,24 +148,24 @@
Function5b8f: ; 5b8f
callba Function10632f
- jr c, .asm_5b9e
+ jr c, .ok
callba Function48dcb
ret
-.asm_5b9e
- ld c, $0
+.ok
+ ld c, 0
callba Function4802f
ret
; 5ba7
-Function5ba7: ; 5ba7
+ResetWRAM: ; 5ba7
xor a
ld [hBGMapMode], a
- call Function5bae
+ call _ResetWRAM
ret
; 5bae
-Function5bae: ; 5bae
+_ResetWRAM: ; 5bae
ld hl, Sprites
ld bc, Options - Sprites
@@ -986,7 +986,7 @@
call DelayFrame
ld a, $e4
call DmgToCgbBGPals
-.asm_618e
+.loop
call DelayFrame
ld a, [hWX]
sub $8
@@ -993,7 +993,7 @@
cp $ff
ret z
ld [hWX], a
- jr .asm_618e
+ jr .loop
; 619c
Function619c: ; 619c
@@ -1002,7 +1002,7 @@
xor a
ld [$ffad], a
hlcoord 6, 4
- ld bc, $0707
+ lb bc, 7, 7
predef FillBox
ret
; 61b4
@@ -1014,7 +1014,7 @@
xor a
ld [$ffad], a
hlcoord 6, 4
- ld bc, $0707
+ lb bc, 7, 7
predef FillBox
ret
; 61cd
@@ -1032,7 +1032,7 @@
inc de
ld c, a
-.asm_61e4
+.loop
ld a, [de]
inc de
ld [hli], a
@@ -1046,14 +1046,14 @@
ld b, 0
ld a, [PlayerGender]
bit 0, a
- jr z, .asm_61f8
+ jr z, .male
ld b, 1
-.asm_61f8
+.male
ld a, b
ld [hli], a
dec c
- jr nz, .asm_61e4
+ jr nz, .loop
ret
; 61fe
@@ -1078,9 +1078,9 @@
ld [rSVBK], a
call TitleScreen
call DelayFrame
-.asm_6226
+.loop
call Function627b
- jr nc, .asm_6226
+ jr nc, .loop
call ClearSprites
call WhiteBGMap
pop af
@@ -1102,14 +1102,13 @@
call UpdateTimePals
ld a, [wcf64]
cp $5
- jr c, .asm_625e
+ jr c, .ok
xor a
-.asm_625e
+.ok
ld e, a
ld d, 0
- ld hl, .data_626a
- add hl, de
- add hl, de
+ ld hl, .jumptable_626a
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -1116,7 +1115,7 @@
jp [hl]
; 626a
-.data_626a
+.jumptable_626a
dw Function5ae8
dw Function6389
dw Function620b
@@ -1133,7 +1132,7 @@
Function627b: ; 627b
ld a, [wcf63]
bit 7, a
- jr nz, .asm_6290
+ jr nz, .true
call TitleScreenScene
callba Function10eea7
call DelayFrame
@@ -1140,7 +1139,7 @@
and a
ret
-.asm_6290
+.true
scf
ret
; 6292
@@ -1161,8 +1160,7 @@
ld e, a
ld d, 0
ld hl, .scenes
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -1202,7 +1200,7 @@
; Reversed signage for every other line's position.
; This is responsible for the interlaced effect.
ld a, e
- xor $ff
+ xor -1
inc a
ld b, 8 * 10 / 2 ; logo height / 2
@@ -1389,8 +1387,7 @@
add hl, bc
ld l, [hl]
ld h, 0
- add hl, hl
- add hl, hl
+ add_n_times hl, hl, 2
ld de, Data63ca
add hl, de
ld a, [wcf65]
@@ -1399,8 +1396,7 @@
srl a
ld e, a
ld d, 0
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
and a
ret z
@@ -3163,11 +3159,11 @@
ld [hBGMapMode], a
call WhiteBGMap
call ClearSprites
- ld hl, TileMap
+ hlcoord 0, 0
ld bc, TileMapEnd - TileMap
ld a, " "
call ByteFill
- ld hl, AttrMap
+ hlcoord 0, 0, AttrMap
ld bc, AttrMapEnd - AttrMap
ld a, $7
call ByteFill
@@ -4022,8 +4018,7 @@
ld a, d
ld d, 0
ld hl, SineWave
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld e, [hl]
inc hl
ld d, [hl]
@@ -4063,9 +4058,7 @@
ld e, a
ld d, 0
ld hl, PredefPointers
- add hl, de
- add hl, de
- add hl, de
+ add_n_times hl, de, 3
pop de
ld a, [hli]
@@ -4498,7 +4491,7 @@
ld hl, PartySpecies
.loop
ld a, [hli]
- cp $ff
+ cp -1
jr z, .done
cp EGG
jr z, .next
@@ -10005,8 +9998,8 @@
ld [hBGMapMode], a
call WhiteBGMap
call ClearSprites
- ld hl, TileMap
- ld bc, 18 * 20
+ hlcoord 0, 0
+ ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
ld a, " "
call ByteFill
hlcoord 0,0
@@ -11001,8 +10994,7 @@
ld e, a
ld d, 0
ld hl, Jumptable_1172e
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -11210,8 +11202,8 @@
Function118a8: ; 118a8
call WaitTop
- ld hl, TileMap
- ld bc, $0168
+ hlcoord 0, 0
+ ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
ld a, $60
call ByteFill
hlcoord 1, 1
@@ -11322,8 +11314,7 @@
ld e, a
ld d, $0
ld hl, Jumptable_11977
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -11783,7 +11774,7 @@
srl a
srl a
ld d, a
- ld hl, TileMap
+ hlcoord 0, 0
ld bc, $14
.asm_11c43
ld a, d
@@ -11975,7 +11966,7 @@
Function11f84: ; 11f84 (4:5f84)
call WaitTop
- ld hl, TileMap
+ hlcoord 0, 0
ld bc, $78
ld a, $60
call ByteFill
@@ -12474,8 +12465,7 @@
ld e, a
ld d, 0
ld hl, Unknown_12365
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -12978,8 +12968,7 @@
ld hl, .MenuReturns
ld e, a
ld d, 0
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -14926,8 +14915,7 @@
inc hl
ld e, a
ld d, 0
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
call .IsSameItem
jr c, .NoRegisteredItem
and a
@@ -14951,8 +14939,7 @@
inc hl
ld e, a
ld d, 0
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
call .IsSameItem
jr c, .NoRegisteredItem
ret
@@ -15228,7 +15215,7 @@
ld a, [hl]
push af
set 4, [hl]
- ld hl, TileMap
+ hlcoord 0, 0
ld b, $4
ld c, $8
call TextBox
@@ -15295,8 +15282,7 @@
ld e, a
ld d, 0
ld hl, .floors
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -17240,10 +17226,7 @@
pop bc
ld l, c
ld h, $0
- add hl, hl
- add hl, hl
- add hl, hl
- add hl, hl
+ add_n_times hl, hl, 4
pop de
add hl, de
ld d, h
@@ -17270,10 +17253,7 @@
and $7f
ld l, a
ld h, $0
- add hl, hl
- add hl, hl
- add hl, hl
- add hl, hl
+ add_n_times hl, hl, 4
ld a, l
add $0
ld l, a
@@ -19128,11 +19108,7 @@
ld e, a
ld d, 0
ld hl, Unknown_1522d
- add hl, de
- add hl, de
- add hl, de
- add hl, de
- add hl, de
+ add_n_times hl, de, 5
ld a, [hli]
push af
ld a, [hli]
@@ -20099,7 +20075,7 @@
call GetMart
ld a, c
ld [EngineBuffer1], a
- call Function15b10
+ call LoadMartPointer
ld a, [EngineBuffer1]
ld hl, .dialogs
rst JumpTable
@@ -20111,7 +20087,7 @@
dw HerbShop
dw BargainShop
dw Pharmacist
- dw VendingMachine
+ dw RooftopSale
; 15a61
MartDialog: ; 15a61
@@ -20135,9 +20111,9 @@
; 15a84
BargainShop: ; 15a84
- ld b, BANK(Unknown_15c51)
- ld de, Unknown_15c51
- call Function15b10
+ ld b, BANK(BargainShopData)
+ ld de, BargainShopData
+ call LoadMartPointer
call Function15c25
call Function1d6e
ld hl, UnknownText_0x15e6d
@@ -20167,17 +20143,17 @@
ret
; 15ac4
-VendingMachine: ; 15ac4
- ld b, BANK(Unknown_15aee)
- ld de, Unknown_15aee
+RooftopSale: ; 15ac4
+ ld b, BANK(RooftopSaleData1)
+ ld de, RooftopSaleData1
ld hl, StatusFlags
- bit 6, [hl]
- jr z, .asm_15ad5
- ld b, BANK(Unknown_15aff)
- ld de, Unknown_15aff
+ bit 6, [hl] ; hall of fame
+ jr z, .ok
+ ld b, BANK(RooftopSaleData2)
+ ld de, RooftopSaleData2
-.asm_15ad5
- call Function15b10
+.ok
+ call LoadMartPointer
call Function15c25
call Function1d6e
ld hl, UnknownText_0x15f83
@@ -20188,15 +20164,27 @@
ret
; 15aee
-Unknown_15aee: ; 15aee
- db $05, $05, $96, $00, $04, $f4, $01, $11, $f4, $01, $26, $f4, $01, $27, $b0, $04, $ff
-Unknown_15aff: ; 15aff
- db $05, $10, $e8, $03, $0e, $d0, $07, $26, $f4, $01, $02, $e8, $03, $1b, $78, $1e, $ff
+RooftopSaleData1: ; 15aee
+ db 5
+ dbw POKE_BALL, 150
+ dbw GREAT_BALL, 500
+ dbw SUPER_POTION, 500
+ dbw FULL_HEAL, 500
+ dbw REVIVE, 1200
+ db -1
+RooftopSaleData2: ; 15aff
+ db 5
+ dbw HYPER_POTION, 1000
+ dbw FULL_RESTORE, 2000
+ dbw FULL_HEAL, 500
+ dbw ULTRA_BALL, 1000
+ dbw PROTEIN, 7800
+ db -1
; 15b10
-Function15b10: ; 15b10
+LoadMartPointer: ; 15b10
ld a, b
- ld [wd03f], a
+ ld [MartPointerBank], a
ld a, e
ld [MartPointer], a
ld a, d
@@ -20222,8 +20210,7 @@
.IsAMart
ld hl, Marts
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld e, [hl]
inc hl
ld d, [hl]
@@ -20323,7 +20310,7 @@
ld [de], a
inc hl
inc de
- cp $ff
+ cp -1
jr nz, .CopyMart
ld hl, DefaultFlypoint
ld de, CurMart + 1
@@ -20357,13 +20344,13 @@
ld [StringBuffer2 + 1], a
ld hl, StringBuffer1
ld de, StringBuffer2
- ld bc, $82 << 8 + 6 ; 6 digits
+ lb bc, $82, 6 ; 6 digits
call PrintNum
pop hl
ld de, StringBuffer1
ld c, 6 / 2 ; 6 digits
-.asm_15c0b
+.loop
call .TileToNum
swap a
ld b, a
@@ -20371,7 +20358,7 @@
or b
ld [hli], a
dec c
- jr nz, .asm_15c0b
+ jr nz, .loop
ret
; 15c1a
@@ -20396,12 +20383,12 @@
inc hl
ld bc, wd002
ld de, CurMart + 1
-.asm_15c33
+.loop
ld a, [hli]
ld [de], a
inc de
- cp $ff
- jr z, .asm_15c4b
+ cp -1
+ jr z, .done
push de
ld a, [hli]
@@ -20416,9 +20403,9 @@
ld c, l
pop hl
pop de
- jr .asm_15c33
+ jr .loop
-.asm_15c4b
+.done
pop hl
ld a, [hl]
ld [CurMart], a
@@ -20425,8 +20412,14 @@
ret
; 15c51
-Unknown_15c51: ; 15c51
- db $05, $24, $94, $11, $6e, $8a, $02, $6f, $ac, $0d, $83, $84, $03, $84, $f8, $11, $ff
+BargainShopData: ; 15c51
+ db 5
+ dbw NUGGET, 4500
+ dbw PEARL, 650
+ dbw BIG_PEARL, 3500
+ dbw STARDUST, 900
+ dbw STAR_PIECE, 4600
+ db -1
; 15c62
@@ -20453,8 +20446,7 @@
pop af
ld e, a
ld d, 0
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -20479,9 +20471,7 @@
ld e, a
ld d, 0
ld hl, .data_15cb0
- add hl, de
- add hl, de
- add hl, de
+ add_n_times hl, de, 3
ret
; 15cb0
@@ -20554,7 +20544,7 @@
call Function15d97
jr c, .asm_15d68
ld de, Money
- ld bc, $ffc3
+ ld bc, hMoneyTemp
ld a, $3
call CheckMoney
jr c, .asm_15d79
@@ -20569,7 +20559,7 @@
call FlagAction
call Function15fc3
ld de, Money
- ld bc, $ffc3
+ ld bc, hMoneyTemp
call TakeMoney
ld a, $4
call Function15c7d
@@ -20637,9 +20627,7 @@
ld h, [hl]
ld l, a
inc hl
- add hl, de
- add hl, de
- add hl, de
+ add_n_times hl, de, 3
inc hl
ld a, [hli]
ld [$ffc5], a
@@ -20646,7 +20634,7 @@
ld a, [hl]
ld [$ffc4], a
xor a
- ld [$ffc3], a
+ ld [hMoneyTemp], a
and a
ret
@@ -20678,9 +20666,7 @@
ld h, [hl]
ld l, a
inc hl
- add hl, de
- add hl, de
- add hl, de
+ add_n_times hl, de, 3
inc hl
ld e, [hl]
inc hl
@@ -20945,7 +20931,7 @@
call YesNoBox
jr c, .asm_15f6e
ld de, Money
- ld bc, $ffc3
+ ld bc, hMoneyTemp
call GiveMoney
ld a, [wd107]
ld hl, NumItems
@@ -21296,8 +21282,7 @@
ld e, a
ld d, 0
ld hl, Jumptable_16242
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -21724,7 +21709,7 @@
push de
xor a
ld [hBGMapMode], a
- ld hl, TileMap
+ hlcoord 0, 0
ld bc, $0612
call TextBox
hlcoord 1, 2
@@ -21860,9 +21845,7 @@
push de
ld e, a
ld d, 0
- add hl, de
- add hl, de
- add hl, de
+ add_n_times hl, de, 3
pop de
ret
; 16613
@@ -22273,8 +22256,7 @@
ld e, a
ld d, 0
ld hl, TextTable_168aa
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -22812,12 +22794,12 @@
lb bc, BANK(UnownDexBTile), 1
call Request1bpp
- ld hl, TileMap
+ hlcoord 0, 0
ld bc, $0312
call TextBox
hlcoord 0, 5
- ld bc, $0707
+ lb bc, 7, 7
call TextBox
hlcoord 0, 14
@@ -22935,7 +22917,7 @@
hlcoord 1, 6
xor a
ld [$ffad], a
- ld bc, $0707
+ lb bc, 7, 7
predef FillBox
ld de, $9310
callba Functione0000
@@ -22963,7 +22945,7 @@
Function16d20: ; 16d20
hlcoord 1, 6
- ld bc, $0707
+ lb bc, 7, 7
call ClearBox
hlcoord 1, 9
ld de, UnownDexVacantString
@@ -23009,14 +22991,14 @@
; 16dac
Function16dac: ; 16dac
- ld hl, TileMap
- ld bc, $0168
+ hlcoord 0, 0
+ ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
ld a, $7f
call ByteFill
hlcoord 7, 11
ld a, $31
ld [$ffad], a
- ld bc, $0707
+ lb bc, 7, 7
predef FillBox
ret
; 16dc7
@@ -23740,7 +23722,7 @@
call WaitTop
push hl
push bc
- ld hl, TileMap
+ hlcoord 0, 0
ld bc, $168
ld a, $7f
call ByteFill
@@ -24083,10 +24065,7 @@
ld e, a
ld d, 0
ld hl, Unknown_20015
- add hl, de
- add hl, de
- add hl, de
- add hl, de
+ add_n_times hl, de, 4
ld e, [hl]
inc hl
ld d, [hl]
@@ -25002,7 +24981,7 @@
dec c
jr nz, .asm_243d7
pop hl
- ld bc, $0014
+ ld bc, SCREEN_WIDTH
add hl, bc
pop bc
dec b
@@ -25059,9 +25038,9 @@
ret z
xor a
call GetSRAMBank
- ld hl, TileMap
+ hlcoord 0, 0
ld de, $a000
- ld bc, $0168
+ ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
call CopyBytes
call CloseSRAM
call Function2173
@@ -25068,8 +25047,8 @@
xor a
call GetSRAMBank
ld hl, $a000
- ld de, TileMap
- ld bc, $0168
+ decoord 0, 0
+ ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
.asm_2444c
ld a, [hl]
cp $61
@@ -25206,7 +25185,7 @@
call GetTileCoord
ld a, $80
ld [$ffad], a
- ld bc, $0707
+ lb bc, 7, 7
predef FillBox
call WaitBGMap
ret
@@ -26245,7 +26224,7 @@
ld a, [hl]
push af
set 4, [hl]
- ld hl, TileMap
+ hlcoord 0, 0
ld b, $3
ld c, $7
call TextBox
@@ -26275,7 +26254,7 @@
; 24bdc
Function24bdc: ; 24bdc
- ld hl, TileMap
+ hlcoord 0, 0
ld b, $5
ld c, $11
call TextBox
@@ -27069,7 +27048,7 @@
Function250d1: ; 250d1
push hl
- ld hl, $ffc3
+ ld hl, hMoneyTemp
ld a, [hMultiplicand]
ld [hli], a
ld a, [$ffb5]
@@ -27078,7 +27057,7 @@
ld [hl], a
pop hl
inc hl
- ld de, $ffc3
+ ld de, hMoneyTemp
ld bc, $2306
call PrintNum
call WaitBGMap
@@ -27177,8 +27156,7 @@
ld e, a
ld d, $0
ld hl, Jumptable_2519d
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -27328,7 +27306,7 @@
ret
Function25299: ; 25299 (9:5299)
- ld hl, TileMap
+ hlcoord 0, 0
ld d, $5
call Function253b0
hlcoord 2, 2
@@ -27389,7 +27367,7 @@
hlcoord 2, 8
ld de, Tilemap_25366
call Function253a8
- ld a, [StatusFlags]
+ ld a, [StatusFlags] ; pokedex
bit 0, a
ret nz
hlcoord 1, 9
@@ -28103,25 +28081,25 @@
Function2683a: ; 2683a (9:683a)
ld hl, Jumptable_26855
-.asm_2683d
+.loop
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
or e
- jr z, .asm_26854
+ jr z, .done
push hl
call _de_
pop hl
- jr nc, .asm_26851
+ jr nc, .next
ld a, [hl]
push hl
call Function26830
pop hl
-.asm_26851
+.next
inc hl
- jr .asm_2683d
-.asm_26854
+ jr .loop
+.done
ret
; 26855 (9:6855)
@@ -28140,21 +28118,21 @@
xor a
ld hl, DefaultFlypoint
ld [hli], a
- ld a, $ff
+ ld a, -1
ld bc, $0010
call ByteFill
ret
; 2687a
-Function2687a: ; 2687a
-.asm_2687a
+CheckAllDecorationFlags: ; 2687a
+.loop
ld a, [hli]
- cp $ff
- jr z, .asm_26890
+ cp -1
+ jr z, .done
push hl
push af
- ld b, $2
- call Function26a3b
+ ld b, 2 ; check
+ call DecorationFlagAction
ld a, c
and a
pop bc
@@ -28161,9 +28139,9 @@
ld a, b
call nz, Function26891
pop hl
- jr .asm_2687a
+ jr .loop
-.asm_26890
+.done
ret
; 26891
@@ -28182,7 +28160,7 @@
push hl
call Function2686c
pop hl
- call Function2687a
+ call CheckAllDecorationFlags
pop bc
ld a, [DefaultFlypoint]
and a
@@ -28296,7 +28274,7 @@
Unknown_2692d: ; 2692d
db 30, 31, 32, 33, 34, 35, 36, 37, 38, 39
db 40, 41, 42, 43, 44, 45, 46, 47, 48, 49
- db 50, 51, 52, $ff
+ db 50, 51, 52, -1
; 26945
Function26945: ; 26945
@@ -28313,7 +28291,7 @@
; 26955
Unknown_26955: ; 26955
- db 26, 27, 28, $ff
+ db 26, 27, 28, -1
; 26959
Function26959: ; 26959
@@ -28324,28 +28302,28 @@
Function2695b: ; 2695b
ld a, [DefaultFlypoint]
and a
- jr z, .asm_269a9
- cp $8
- jr nc, .asm_2697b
+ jr z, .empty
+ cp 8
+ jr nc, .beyond_eight
xor a
ld [wcf76], a
ld hl, MenuDataHeader_0x269b5
call LoadMenuDataHeader
call Function1e5d
- jr c, .asm_26977
- call Function26a02
+ jr c, .no_action_1
+ call DoDecorationAction2
-.asm_26977
+.no_action_1
call Function1c07
ret
-.asm_2697b
+.beyond_eight
ld hl, DefaultFlypoint
ld e, [hl]
dec [hl]
- ld d, $0
+ ld d, 0
add hl, de
- ld [hl], $ff
+ ld [hl], -1
call Function1d6e
ld hl, MenuDataHeader_0x269c5
call CopyMenuDataHeader
@@ -28356,15 +28334,15 @@
ld [wd0e4], a
call Function350c
ld a, [wcf73]
- cp $2
- jr z, .asm_269a5
- call Function26a02
+ cp 2
+ jr z, .no_action_2
+ call DoDecorationAction2
-.asm_269a5
+.no_action_2
call Function1c07
ret
-.asm_269a9
+.empty
ld hl, UnknownText_0x269b0
call Function1d67
ret
@@ -28411,9 +28389,9 @@
; 269dd
-Function269dd: ; 269dd
+GetDecorationData: ; 269dd
ld hl, DecorationAttributes
- ld bc, $0006
+ ld bc, 6
call AddNTimes
ret
; 269e7
@@ -28420,8 +28398,8 @@
Function269e7: ; 269e7
push hl
- call Function269dd
- call Function26c72
+ call GetDecorationData
+ call GetDecorationType
pop hl
call CopyName2
ret
@@ -28430,17 +28408,17 @@
Function269f3: ; 269f3
ld a, [MenuSelection]
push de
- call Function269dd
- call Function26c72
+ call GetDecorationData
+ call GetDecorationType
pop hl
call PlaceString
ret
; 26a02
-Function26a02: ; 26a02
+DoDecorationAction2: ; 26a02
ld a, [MenuSelection]
- call Function269dd
- ld de, $0002
+ call GetDecorationData
+ ld de, 2
add hl, de
ld a, [hl]
ld hl, Jumptable_26a12
@@ -28467,9 +28445,9 @@
; 26a30
-Function26a30: ; 26a30
- call Function269dd
- ld de, $0003
+GetDecorationFlag: ; 26a30
+ call GetDecorationData
+ ld de, 3
add hl, de
ld a, [hli]
ld d, [hl]
@@ -28477,9 +28455,9 @@
ret
; 26a3b
-Function26a3b: ; 26a3b
+DecorationFlagAction: ; 26a3b
push bc
- call Function26a30
+ call GetDecorationFlag
pop bc
call EventFlagAction
ret
@@ -28487,8 +28465,8 @@
Function26a44: ; 26a44
ld a, c
- call Function269dd
- ld de, $0005
+ call GetDecorationData
+ ld de, 5
add hl, de
ld a, [hl]
ld c, a
@@ -28495,60 +28473,67 @@
ret
; 26a4f
+decoration: MACRO
+ ; type, ??, event flag, sprite
+ db \1, \2, \3
+ dw \4
+ db \5
+ENDM
+
DecorationAttributes: ; 26a4f
- db $01, $00, $00, $00, $00, $00
- db $01, $01, $02, $00, $00, $00
- db $02, $12, $01, $a4, $02, $1b
- db $02, $14, $01, $a5, $02, $1c
- db $02, $15, $01, $a6, $02, $1d
- db $02, $13, $01, $a7, $02, $1e
- db $01, $01, $04, $00, $00, $00
- db $03, $16, $03, $a8, $02, $08
- db $03, $17, $03, $a9, $02, $0b
- db $03, $18, $03, $aa, $02, $0e
- db $03, $19, $03, $ab, $02, $11
- db $01, $01, $06, $00, $00, $00
- db $01, $02, $05, $ac, $02, $20
- db $01, $03, $05, $ad, $02, $21
- db $01, $04, $05, $ae, $02, $22
- db $01, $01, $08, $00, $00, $00
- db $01, $05, $07, $af, $02, $1f
- db $04, $19, $07, $b0, $02, $23
- db $04, $23, $07, $b1, $02, $24
- db $04, $27, $07, $b2, $02, $25
- db $01, $01, $0a, $00, $00, $00
- db $01, $06, $09, $b3, $02, $5c
- db $01, $07, $09, $b4, $02, $5b
- db $01, $08, $09, $b5, $02, $51
- db $01, $09, $09, $b6, $02, $57
- db $01, $01, $0c, $00, $00, $00
- db $06, $8f, $0b, $cf, $02, $33
- db $06, $5f, $0b, $d0, $02, $50
- db $06, $83, $0b, $d1, $02, $47
- db $01, $01, $0e, $00, $00, $00
- db $05, $19, $0d, $b7, $02, $8e
- db $01, $0c, $0d, $b8, $02, $34
- db $05, $23, $0d, $b9, $02, $8f
- db $05, $27, $0d, $ba, $02, $94
- db $05, $01, $0d, $bb, $02, $93
- db $05, $04, $0d, $bc, $02, $90
- db $05, $07, $0d, $bd, $02, $89
- db $05, $3c, $0d, $be, $02, $8d
- db $05, $32, $0d, $bf, $02, $8c
- db $05, $78, $0d, $c0, $02, $92
- db $05, $81, $0d, $c1, $02, $88
- db $05, $2b, $0d, $c2, $02, $85
- db $05, $5e, $0d, $c3, $02, $86
- db $05, $5a, $0d, $c4, $02, $84
- db $05, $58, $0d, $c5, $02, $95
- db $05, $64, $0d, $c6, $02, $9b
- db $05, $0d, $0d, $c7, $02, $83
- db $05, $c9, $0d, $c8, $02, $80
- db $05, $4a, $0d, $c9, $02, $81
- db $05, $42, $0d, $ca, $02, $9a
- db $05, $48, $0d, $cb, $02, $98
- db $01, $0a, $0d, $cd, $02, $5e
- db $01, $0b, $0d, $ce, $02, $5f
+ decoration DECO_CARPET, $00, 0, EVENT_000, SPRITE_NONE ; 00
+ decoration DECO_CARPET, $01, 2, EVENT_000, SPRITE_NONE ; 01
+ decoration DECO_PLANT, $12, 1, EVENT_2A4, $1b ; 02
+ decoration DECO_PLANT, $14, 1, EVENT_2A5, $1c ; 03
+ decoration DECO_PLANT, $15, 1, EVENT_2A6, $1d ; 04
+ decoration DECO_PLANT, $13, 1, EVENT_2A7, $1e ; 05
+ decoration DECO_CARPET, $01, 4, EVENT_000, SPRITE_NONE ; 06
+ decoration DECO_POSTER, $16, 3, EVENT_2A8, $08 ; 07
+ decoration DECO_POSTER, $17, 3, EVENT_2A9, $0b ; 08
+ decoration DECO_POSTER, $18, 3, EVENT_2AA, $0e ; 09
+ decoration DECO_POSTER, $19, 3, EVENT_2AB, $11 ; 0a
+ decoration DECO_CARPET, $01, 6, EVENT_000, SPRITE_NONE ; 0b
+ decoration DECO_CARPET, $02, 5, EVENT_2AC, SPRITE_ERIKA ; 0c
+ decoration DECO_CARPET, $03, 5, EVENT_2AD, SPRITE_KOGA ; 0d
+ decoration DECO_CARPET, $04, 5, EVENT_2AE, SPRITE_SABRINA ; 0e
+ decoration DECO_CARPET, $01, 8, EVENT_000, SPRITE_NONE ; 0f
+ decoration DECO_CARPET, $05, 7, EVENT_2AF, SPRITE_SURGE ; 10
+ decoration DECO_CONSOLE, $19, 7, EVENT_2B0, SPRITE_COOLTRAINER_M ; 11
+ decoration DECO_CONSOLE, $23, 7, EVENT_2B1, SPRITE_COOLTRAINER_F ; 12
+ decoration DECO_CONSOLE, $27, 7, EVENT_2B2, SPRITE_BUG_CATCHER ; 13
+ decoration DECO_CARPET, $01, 10, EVENT_000, SPRITE_NONE ; 14
+ decoration DECO_CARPET, $06, 9, EVENT_2B3, SPRITE_FAMICOM ; 15
+ decoration DECO_CARPET, $07, 9, EVENT_2B4, SPRITE_SNES ; 16
+ decoration DECO_CARPET, $08, 9, EVENT_2B5, SPRITE_N64 ; 17
+ decoration DECO_CARPET, $09, 9, EVENT_2B6, SPRITE_VIRTUAL_BOY ; 18
+ decoration DECO_CARPET, $01, 12, EVENT_000, SPRITE_NONE ; 19
+ decoration DECO_BIGDOLL, $8f, 11, EVENT_2CF, SPRITE_BIG_SNORLAX ; 1a
+ decoration DECO_BIGDOLL, $5f, 11, EVENT_2D0, SPRITE_BIG_ONIX ; 1b
+ decoration DECO_BIGDOLL, $83, 11, EVENT_2D1, SPRITE_BIG_LAPRAS ; 1c
+ decoration DECO_CARPET, $01, 14, EVENT_000, SPRITE_NONE ; 1d
+ decoration DECO_ORNAMENT, $19, 13, EVENT_2B7, SPRITE_PIKACHU ; 1e
+ decoration DECO_CARPET, $0c, 13, EVENT_2B8, SPRITE_SURFING_PIKACHU ; 1f
+ decoration DECO_ORNAMENT, $23, 13, EVENT_2B9, SPRITE_CLEFAIRY ; 20
+ decoration DECO_ORNAMENT, $27, 13, EVENT_2BA, SPRITE_JIGGLYPUFF ; 21
+ decoration DECO_ORNAMENT, $01, 13, EVENT_2BB, SPRITE_BULBASAUR ; 22
+ decoration DECO_ORNAMENT, $04, 13, EVENT_2BC, SPRITE_CHARMANDER ; 23
+ decoration DECO_ORNAMENT, $07, 13, EVENT_2BD, SPRITE_SQUIRTLE ; 24
+ decoration DECO_ORNAMENT, $3c, 13, EVENT_2BE, SPRITE_POLIWAG ; 25
+ decoration DECO_ORNAMENT, $32, 13, EVENT_2BF, SPRITE_DIGLETT ; 26
+ decoration DECO_ORNAMENT, $78, 13, EVENT_2C0, SPRITE_STARMIE ; 27
+ decoration DECO_ORNAMENT, $81, 13, EVENT_2C1, SPRITE_MAGIKARP ; 28
+ decoration DECO_ORNAMENT, $2b, 13, EVENT_2C2, SPRITE_ODDISH ; 29
+ decoration DECO_ORNAMENT, $5e, 13, EVENT_2C3, SPRITE_GENGAR ; 2a
+ decoration DECO_ORNAMENT, $5a, 13, EVENT_2C4, SPRITE_SHELLDER ; 2b
+ decoration DECO_ORNAMENT, $58, 13, EVENT_2C5, SPRITE_GRIMER ; 2c
+ decoration DECO_ORNAMENT, $64, 13, EVENT_2C6, SPRITE_VOLTORB ; 2d
+ decoration DECO_ORNAMENT, $0d, 13, EVENT_2C7, SPRITE_WEEDLE ; 2e
+ decoration DECO_ORNAMENT, $c9, 13, EVENT_2C8, SPRITE_UNOWN ; 2f
+ decoration DECO_ORNAMENT, $4a, 13, EVENT_2C9, SPRITE_GEODUDE ; 30
+ decoration DECO_ORNAMENT, $42, 13, EVENT_2CA, SPRITE_MACHOP; 31
+ decoration DECO_ORNAMENT, $48, 13, EVENT_2CB, SPRITE_TENTACOOL; 32
+ decoration DECO_CARPET, $0a, 13, EVENT_2CD, SPRITE_GOLD_TROPHY; 33
+ decoration DECO_CARPET, $0b, 13, EVENT_2CE, SPRITE_SILVER_TROPHY; 34
; 26b8d
@@ -28581,7 +28566,7 @@
db "GREEN@"
; 26c72
-Function26c72: ; 26c72
+GetDecorationType: ; 26c72
ld a, [hli]
ld e, [hl]
ld bc, StringBuffer2
@@ -28656,10 +28641,10 @@
jr Function26cda
Function26cca: ; 26cca
- call Function26ccf
+ call GetDecorationName
jr Function26cda
-Function26ccf: ; 26ccf
+GetDecorationName: ; 26ccf
push bc
ld hl, DecorationNames
call GetNthString
@@ -29037,13 +29022,13 @@
Function26ef1: ; 26ef1
ld a, c
- jp Function26a3b
+ jp DecorationFlagAction
; 26ef5
Function26ef5: ; 26ef5 (9:6ef5)
ld a, c
- call Function26f0c
+ call GetDecorationID
ld hl, StringBuffer1
push hl
call Function269e7
@@ -29051,20 +29036,20 @@
ret
-Function26f02: ; 26f02
+SetSpecificDecorationFlag: ; 26f02
ld a, c
- call Function26f0c
- ld b, $1
- call Function26a3b
+ call GetDecorationID
+ ld b, 1 ; set
+ call DecorationFlagAction
ret
; 26f0c
-Function26f0c: ; 26f0c
+GetDecorationID: ; 26f0c
push hl
push de
ld e, a
ld d, 0
- ld hl, Unknown_26f2b
+ ld hl, DecorationIDs
add hl, de
ld a, [hl]
pop de
@@ -29072,33 +29057,69 @@
ret
; 26f19
-Function26f19: ; 26f19
- ld hl, Unknown_26f2b
-.asm_26f1c
+SetAllDecorationFlags: ; 26f19
+ ld hl, DecorationIDs
+.loop
ld a, [hli]
- cp $ff
- jr z, .asm_26f2a
+ cp -1
+ jr z, .done
push hl
- ld b, $1
- call Function26a3b
+ ld b, 1 ; set
+ call DecorationFlagAction
pop hl
- jr .asm_26f1c
+ jr .loop
-.asm_26f2a
+.done
ret
; 26f2b
-Unknown_26f2b: ; 26f2b
- db $02, $03, $04, $05, $07
- db $08, $09, $0a, $0c, $0d
- db $0e, $10, $11, $12, $13
- db $15, $16, $17, $18, $1e
- db $1f, $20, $21, $22, $23
- db $24, $25, $26, $27, $28
- db $29, $2a, $2b, $2c, $2d
- db $2e, $2f, $30, $31, $32
- db $1a, $1b, $1c, $33, $34
- db $ff
+DecorationIDs: ; 26f2b
+ db $02
+ db $03
+ db $04
+ db $05
+ db $07
+ db $08
+ db $09
+ db $0a
+ db $0c
+ db $0d
+ db $0e
+ db $10
+ db $11
+ db $12
+ db $13
+ db $15
+ db $16
+ db $17
+ db $18
+ db $1e
+ db $1f
+ db $20
+ db $21
+ db $22
+ db $23
+ db $24
+ db $25
+ db $26
+ db $27
+ db $28
+ db $29
+ db $2a
+ db $2b
+ db $2c
+ db $2d
+ db $2e
+ db $2f
+ db $30
+ db $31
+ db $32
+ db $1a
+ db $1b
+ db $1c
+ db $33
+ db $34
+ db -1
; 26f59
DescribeDecoration:: ; 26f59
@@ -31100,7 +31121,7 @@
call ByteFill
hlcoord 1, 16
ld a, $7f
- ld bc, $0012
+ ld bc, SCREEN_HEIGHT
call ByteFill
hlcoord 2, 16
ld de, String_28b61
@@ -31114,7 +31135,7 @@
Function28b68: ; 28b68
ld a, [wcf51]
hlcoord 6, 9
- ld bc, $0014
+ ld bc, SCREEN_WIDTH
call AddNTimes
ld [hl], $ec
ret
@@ -31129,7 +31150,7 @@
dec c
jr nz, .asm_28b79
pop hl
- ld bc, $0014
+ ld bc, SCREEN_WIDTH
add hl, bc
pop bc
dec b
@@ -31752,8 +31773,7 @@
ld e, a
ld d, 0
ld hl, JumpTable290af
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -32041,8 +32061,7 @@
ld e, a
ld d, 0
ld hl, Jumptable_2928f
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -32072,7 +32091,7 @@
Function292af: ; 292af
call Function297cf
hlcoord 0, 3
- ld bc, $0014
+ ld bc, SCREEN_WIDTH
ld a, $60
call ByteFill
ret
@@ -32088,7 +32107,7 @@
ld a, $5d
ld [hl], a
ld a, $61
- ld de, $0014
+ ld de, SCREEN_WIDTH
ld c, $3
.asm_292d9
add hl, de
@@ -32119,8 +32138,8 @@
ld a, $9c
ld [$ffd7], a
call ClearTileMap
- ld hl, TileMap
- ld bc, $0014
+ hlcoord 0, 0
+ ld bc, SCREEN_WIDTH
ld a, $7a
call ByteFill
hlcoord 0, 1
@@ -32385,7 +32404,7 @@
hlcoord 7, 2
xor a
ld [$ffad], a
- ld bc, $0707
+ lb bc, 7, 7
predef FillBox
call WaitBGMap
ret
@@ -32626,8 +32645,7 @@
ld e, [hl]
ld d, 0
ld hl, Jumptable_29686
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -32866,8 +32884,8 @@
; 297cf
Function297cf: ; 297cf
- ld hl, TileMap
- ld bc, $0168
+ hlcoord 0, 0
+ ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
ld a, $7f
call ByteFill
ret
@@ -32884,7 +32902,7 @@
dec c
jr nz, .asm_297dd
pop hl
- ld bc, $0014
+ ld bc, SCREEN_WIDTH
add hl, bc
pop bc
dec b
@@ -33645,14 +33663,14 @@
ret
Function2a01f: ; 2a01f
- ld hl, TileMap
- ld bc, $0168
+ hlcoord 0, 0
+ ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
xor a
call ByteFill
ld a, e
and a
jr nz, .asm_2a043
- ld de, TileMap
+ decoord 0, 0
ld hl, WildMons1
call Function2a052
ld hl, WildMons2
@@ -33662,7 +33680,7 @@
ret
.asm_2a043
- ld de, TileMap
+ decoord 0, 0
ld hl, WildMons3
call Function2a052
ld hl, WildMons4
@@ -33743,8 +33761,8 @@
push de
call GetWorldMapLocation
ld c, a
- ld hl, TileMap
- ld de, $0168
+ hlcoord 0, 0
+ ld de, SCREEN_WIDTH * SCREEN_HEIGHT
.asm_2a0a7
ld a, [hli]
cp c
@@ -34999,7 +35017,7 @@
Function2c0f1: ; 2c0f1
ld a, [wd004]
ld [hl], a
- ld bc, $0014
+ ld bc, SCREEN_WIDTH
add hl, bc
ld a, [StartFlypoint]
ld [hl], a
@@ -37353,7 +37371,7 @@
xor a
ld [hBGMapMode], a
- ld hl, TileMap
+ hlcoord 0, 0
lb bc, 12, 20
call ClearBox
@@ -38261,8 +38279,7 @@
dec a
ld d, 0
ld e, a
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld e, [hl]
inc hl
ld d, [hl]
@@ -38986,7 +39003,7 @@
ld b, $1
call Function4930f
call WhiteBGMap
- ld hl, TileMap
+ hlcoord 0, 0
ld b, $2
ld c, $14
call ClearBox
@@ -39604,7 +39621,7 @@
ld b, $1
call Function4930f
call WhiteBGMap
- ld hl, TileMap
+ hlcoord 0, 0
ld b, $4
ld c, $14
call ClearBox
@@ -40817,11 +40834,11 @@
call WhiteBGMap
call Function48000
call Functione5f
- ld hl, TileMap
+ hlcoord 0, 0
ld bc, $168
ld a, $0
call ByteFill
- ld hl, AttrMap
+ hlcoord 0, 0, AttrMap
ld bc, $168
xor a
call ByteFill
@@ -40858,8 +40875,7 @@
Function48e81: ; 48e81
ld hl, PackFGFXPointers
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld e, a
ld d, [hl]
@@ -41029,7 +41045,7 @@
dec c
jr nz, .asm_49338
pop hl
- ld bc, $0014
+ ld bc, SCREEN_WIDTH
add hl, bc
pop bc
dec b
@@ -41039,7 +41055,7 @@
Function49346: ; 49346 (12:5346)
- ld hl, AttrMap
+ hlcoord 0, 0, AttrMap
ld bc, $168
xor a
call ByteFill
@@ -41067,7 +41083,7 @@
ret
Function49384: ; 49384 (12:5384)
- ld hl, AttrMap
+ hlcoord 0, 0, AttrMap
ld bc, $401
ld a, $1
call Function49336
@@ -41165,8 +41181,8 @@
ld a, $5 ; BANK(Unkn1Pals)
call FarCopyWRAM
call Function49346
- ld hl, AttrMap
- ld bc, $0168
+ hlcoord 0, 0, AttrMap
+ ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
xor a
call ByteFill
hlcoord 0, 14, AttrMap
@@ -41198,7 +41214,7 @@
; 49480
Function49480: ; 49480
- ld hl, AttrMap
+ hlcoord 0, 0, AttrMap
ld bc, $0414
ld a, $7
call Function49336
@@ -41211,7 +41227,7 @@
; 49496
Function49496: ; 49496
- ld hl, AttrMap
+ hlcoord 0, 0, AttrMap
ld bc, $0214
ld a, $7
call Function49336
@@ -41508,13 +41524,13 @@
; 49797
Function49797: ; 49797
- ld hl, AttrMap
+ hlcoord 0, 0, AttrMap
ld bc, $1002
ld a, $4
call Function49336
ld a, $3
- ld [AttrMap + 0 + 1 * SCREEN_WIDTH], a
- ld [AttrMap + 0 + 14 * SCREEN_WIDTH], a
+ ld [AttrMap + 0 + 1 * SCREEN_WIDTH], a ; (0, 1)
+ ld [AttrMap + 0 + 14 * SCREEN_WIDTH], a ; (0, 14)
hlcoord 2, 0, AttrMap
ld bc, $0812
ld a, $5
@@ -41639,10 +41655,10 @@
ld a, $a0
ld [wcf64], a
ld d, $0
-.asm_498ca
+.loop
ld a, [wcf63]
bit 7, a
- jr nz, .asm_498ee
+ jr nz, .done
push bc
call Function49bae
inc d
@@ -41655,9 +41671,9 @@
call DelayFrames
pop de
pop bc
- jr .asm_498ca
+ jr .loop
-.asm_498ee
+.done
pop af
ld [VramState], a
call Function498f9
@@ -41669,7 +41685,7 @@
ld hl, Sprites + 2
xor a
ld c, $4
-.asm_498ff
+.loop
ld [hli], a
inc hl
inc hl
@@ -41676,7 +41692,7 @@
inc hl
inc a
dec c
- jr nz, .asm_498ff
+ jr nz, .loop
ld hl, Sprites + $10
ld bc, $0090
xor a
@@ -41862,8 +41878,7 @@
ld a, d
ld d, $0
ld hl, Unknown_49b6e
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld e, [hl]
inc hl
ld d, [hl]
@@ -42124,11 +42139,11 @@
nop
ld a, [wcfcd]
and a
- jr nz, .asm_49db0
+ jr nz, .next
ld a, $0
ret
-.asm_49db0
+.next
ld a, [hCGB]
cp $1
ld a, $1
@@ -42138,30 +42153,30 @@
ld a, [$abe5]
cp $ff
call CloseSRAM
- jr nz, .asm_49dd6
+ jr nz, .done
ld a, [StatusFlags]
bit 7, a
ld a, $1
- jr z, .asm_49dd1
- jr .asm_49dd1
+ jr z, .ok
+ jr .ok
-.asm_49dd1
- jr .asm_49dd3
+.ok
+ jr .ok2
-.asm_49dd3
+.ok2
ld a, $1
ret
-.asm_49dd6
+.done
ld a, [StatusFlags]
bit 7, a
- jr z, .asm_49ddf
- jr .asm_49ddf
+ jr z, .ok3
+ jr .ok3
-.asm_49ddf
- jr .asm_49de1
+.ok3
+ jr .ok4
-.asm_49de1
+.ok4
ld a, $6
ret
; 49de4
@@ -42870,7 +42885,7 @@
Function4a3a7: ; 4a3a7 (12:63a7)
call Function4a485
Function4a3aa: ; 4a3aa
- ld hl, TileMap
+ hlcoord 0, 0
ld bc, $301
xor a
call Function4a6d8
@@ -42936,7 +42951,7 @@
Function4a449: ; 4a449
ld bc, $003c
ld a, $0
- ld hl, TileMap
+ hlcoord 0, 0
call ByteFill
ld bc, $0028
ld a, $1
@@ -42947,13 +42962,13 @@
ld bc, $0028
ld a, $1
call ByteFill
- ld bc, $0014
+ ld bc, SCREEN_WIDTH
ld a, $2
call ByteFill
- ld bc, $0014
+ ld bc, SCREEN_WIDTH
ld a, $3
call ByteFill
- ld bc, $0014
+ ld bc, SCREEN_WIDTH
ld a, $7f
call ByteFill
ret
@@ -44496,8 +44511,8 @@
SECTION "bank13", ROMX, BANK[$13]
Function4c000:: ; 4c000
- ld hl, TileMap
- ld de, AttrMap
+ hlcoord 0, 0
+ decoord 0, 0, AttrMap
ld b, $12
.asm_4c008
push bc
@@ -44672,11 +44687,11 @@
di
ld a, $1
ld [rVBK], a ; $ff00+$4f
- ld hl, AttrMap
+ hlcoord 0, 0, AttrMap
call Function4cf80
ld a, $0
ld [rVBK], a ; $ff00+$4f
- ld hl, TileMap
+ hlcoord 0, 0
call Function4cf80
.asm_4cf72
ld a, [rLY] ; $ff00+$44
@@ -44846,7 +44861,7 @@
inc hl
.asm_4d170
- ld de, TileMap
+ decoord 0, 0
ld b, SCREEN_HEIGHT
.asm_4d175
ld c, SCREEN_WIDTH
@@ -44890,11 +44905,11 @@
di
ld a, $1
ld [rVBK], a
- ld hl, AttrMap
+ hlcoord 0, 0, AttrMap
call Function4d1cb
ld a, $0
ld [rVBK], a
- ld hl, TileMap
+ hlcoord 0, 0
call Function4d1cb
.asm_4d1bd
ld a, [rLY]
@@ -45080,7 +45095,7 @@
dec c
jr nz, .asm_4d370
pop hl
- ld de, $0014
+ ld de, SCREEN_WIDTH
add hl, de
pop bc
dec b
@@ -45097,7 +45112,7 @@
inc a
ld [hl], a
pop hl
- ld de, $0014
+ ld de, SCREEN_WIDTH
add hl, de
.asm_4d38d
push hl
@@ -45107,7 +45122,7 @@
call Function4d3ab
ld [hl], $7a
pop hl
- ld de, $0014
+ ld de, SCREEN_WIDTH
add hl, de
dec b
jr nz, .asm_4d38d
@@ -47036,13 +47051,13 @@
ld a, [CurPartySpecies]
cp UNOWN
jr z, .asm_4e266
- ld hl, TileMap
+ hlcoord 0, 0
call Function3786
ret
.asm_4e266
xor a
ld [wc2c6], a
- ld hl, TileMap
+ hlcoord 0, 0
call Function378b
ret
@@ -47067,7 +47082,7 @@
call Function4e307
ld de, $9000
predef Function5108b
- ld hl, TileMap
+ hlcoord 0, 0
ld d, $0
ld e, $2
predef Functiond00a3
@@ -47210,7 +47225,7 @@
set 5, [hl]
call Function32f9 ; pals
call DelayFrame
- ld hl, TileMap
+ hlcoord 0, 0
call Function3786
callba Function10402d
call Function4e497
@@ -47271,7 +47286,7 @@
ld de, $9000
predef Function5108b
pop de
- ld hl, TileMap
+ hlcoord 0, 0
ld d, $0
predef Functiond00a3
ld hl, wcf64
@@ -47672,7 +47687,7 @@
xor a
ld [hBGMapMode], a
hlcoord 7, 2
- ld bc, $0707
+ lb bc, 7, 7
ld de, $000d
.asm_4e762
push bc
@@ -47836,8 +47851,8 @@
ld bc, $400
ld a, $7f
call ByteFill
- ld hl, AttrMap
- ld bc, $0168
+ hlcoord 0, 0, AttrMap
+ ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
xor a
call ByteFill
xor a
@@ -47869,8 +47884,8 @@
ld bc, $400
ld a, $7f
call ByteFill
- ld hl, AttrMap
- ld bc, $0168
+ hlcoord 0, 0, AttrMap
+ ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
xor a
call ByteFill
ld hl, wd000
@@ -48250,8 +48265,8 @@
set 4, [hl] ; Disable text delay
xor a
ld [hBGMapMode], a
- ld hl, TileMap
- ld bc, $0168
+ hlcoord 0, 0
+ ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
ld a, " "
call ByteFill ; blank the tilemap
call Function50396 ; This reads from a pointer table???
@@ -48584,8 +48599,7 @@
ld e, a
ld d, 0
ld hl, EvosAttacksPointers
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
call Function50268
pop hl
call PlaceString
@@ -48803,8 +48817,7 @@
ld e, a
ld d, 0
ld hl, Unknown_503b2
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -48977,8 +48990,7 @@
ld hl, PartyMenuStrings
ld e, a
ld d, $0
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld d, [hl]
ld e, a
@@ -49114,8 +49126,7 @@
Function505c1: ; 505c1
ld e, a
ld d, 0
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -51837,8 +51848,7 @@
ld e, a
ld d, 0
ld hl, .Steps
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -52257,8 +52267,7 @@
.read
ld hl, EngineFlags
; location
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
; bit
add hl, de
@@ -52368,7 +52377,7 @@
dwb wd46c, $00
dwb XCoord, $00
dwb YCoord, $00
- dwb wdc31, $00
+ dwb wSpecialPhoneCallID, $00
dwb wcf64, $00
dwb wdca4, $00
dwb wdbf9, $40
@@ -52580,12 +52589,12 @@
ld bc, $2000
xor a
call ByteFill
- ld hl, AttrMap
- ld bc, $0168
+ hlcoord 0, 0, AttrMap
+ ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
xor a
call ByteFill
- ld hl, TileMap
- ld bc, $0168
+ hlcoord 0, 0
+ ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
xor a
call ByteFill
call ClearSprites
@@ -52766,8 +52775,7 @@
ld e, a
ld d, 0
ld hl, Jumptable_81acf
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -52825,8 +52833,8 @@
Function81adb: ; 81adb
xor a
ld [hBGMapMode], a
- ld hl, TileMap
- ld bc, $0168
+ hlcoord 0, 0
+ ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
ld a, $6f
call ByteFill
hlcoord 1, 3
@@ -52900,7 +52908,7 @@
ld [TempEnemyMonSpecies], a
ld [$ffad], a
hlcoord 2, 3
- ld bc, $0707
+ lb bc, 7, 7
predef FillBox
.asm_81ba9
@@ -52947,8 +52955,7 @@
inc a
ld l, a
ld h, $0
- add hl, hl
- add hl, hl
+ add_n_times hl, hl, 2
ld de, OverworldMap
add hl, de
ld de, wc608
@@ -53072,8 +53079,7 @@
ld e, a
ld d, 0
ld hl, Jumptable_81d02
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -53399,8 +53405,7 @@
inc a
ld l, a
ld h, $0
- add hl, hl
- add hl, hl
+ add_n_times hl, hl, 2
ld de, OverworldMap
add hl, de
ld e, l
@@ -53446,7 +53451,7 @@
dec c
jr nz, .asm_81efe
pop hl
- ld bc, $0014
+ ld bc, SCREEN_WIDTH
add hl, bc
pop bc
dec b
@@ -53619,12 +53624,12 @@
call Request2bpp
ld a, $9c
ld [$ffd7], a
- ld hl, TileMap
- ld bc, $0168
+ hlcoord 0, 0
+ ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
ld a, $6f
call ByteFill
- ld hl, AttrMap
- ld bc, $0168
+ hlcoord 0, 0, AttrMap
+ ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
ld a, $7
call ByteFill
ld de, $0015
@@ -53649,12 +53654,12 @@
; 821d2
Function821d2: ; 821d2
- ld hl, TileMap
+ hlcoord 0, 0
call Function821de
Function821d8: ; 821d8
ld a, [wcf64]
- ld hl, AttrMap
+ hlcoord 0, 0, AttrMap
Function821de: ; 821de
add hl, de
@@ -53701,9 +53706,7 @@
ld a, [wcf64]
ld l, a
ld h, $0
- add hl, hl
- add hl, hl
- add hl, hl
+ add_n_times hl, hl, 3
ld de, Unkn1Pals
add hl, de
ld de, wc608
@@ -53816,8 +53819,7 @@
ld e, a
ld d, 0
ld hl, Jumptable_82301
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -53859,8 +53861,7 @@
ld e, a
ld d, $0
ld hl, wc608
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld e, l
ld d, h
call Function81ea5
@@ -53999,8 +54000,7 @@
ld e, a
ld d, 0
ld hl, Jumptable_84031
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -55021,9 +55021,9 @@
; 84728
Function84728: ; 84728
- ld hl, TileMap
+ hlcoord 0, 0
ld de, wca90
- ld bc, $0168
+ ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
call CopyBytes
ret
; 84735
@@ -55030,8 +55030,8 @@
Function84735: ; 84735
ld hl, wca90
- ld de, TileMap
- ld bc, $0168
+ decoord 0, 0
+ ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
call CopyBytes
ret
; 84742
@@ -55105,8 +55105,7 @@
ld e, a
ld d, 0
ld hl, Unknown_84807
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld e, [hl]
inc hl
ld d, [hl]
@@ -55137,8 +55136,7 @@
ld e, a
ld d, 0
ld hl, Unknown_84807
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld e, [hl]
inc hl
ld d, [hl]
@@ -55173,12 +55171,12 @@
Function84817: ; 84817 (21:4817)
xor a
ld [wd002], a
- ld hl, TileMap
+ hlcoord 0, 0
ld bc, $168
ld a, $7f
call ByteFill
call Function84a0e
- ld hl, TileMap
+ hlcoord 0, 0
ld bc, $b4
ld a, $7f
call ByteFill
@@ -55208,7 +55206,7 @@
; 8486f
Function8486f: ; 8486f (21:486f)
- ld hl, TileMap
+ hlcoord 0, 0
ld bc, $168
ld a, $7f
call ByteFill
@@ -55225,7 +55223,7 @@
ret
Function84893: ; 84893 (21:4893)
- ld hl, TileMap
+ hlcoord 0, 0
ld bc, $168
ld a, $7f
call ByteFill
@@ -55242,7 +55240,7 @@
ret
Function848b7: ; 848b7 (21:48b7)
- ld hl, TileMap
+ hlcoord 0, 0
ld bc, $168
ld a, $7f
call ByteFill
@@ -55402,7 +55400,7 @@
ret
Function849d7: ; 849d7 (21:49d7)
- ld hl, TileMap
+ hlcoord 0, 0
ld a, $79
ld [hli], a
ld a, $7a
@@ -55416,7 +55414,7 @@
ret
Function849e9: ; 849e9 (21:49e9)
- ld hl, TileMap
+ hlcoord 0, 0
ld de, $13
ld c, $12
.asm_849f1
@@ -55472,23 +55470,23 @@
call Function8648e
ld a, [StatusFlags]
push af
- ld a, $1
+ ld a, 1
ld [wc2cd], a
call Function2ed3
- ld a, $1
+ ld a, 1
ld [wd4b5], a
; Enable the Pokégear map to cycle through all of Kanto
ld hl, StatusFlags
- set 6, [hl]
+ set 6, [hl] ; hall of fame
callba Function14da0
ld hl, wd95e
ld a, [hl]
- cp $c8
- jr nc, .asm_86436 ; 0x86433 $1
+ cp 200
+ jr nc, .ok ; 0x86433 $1
inc [hl]
-.asm_86436
+.ok
callba Function14b85
call Function8653f
callba Function14b5f
@@ -55529,7 +55527,7 @@
ld [MusicFadeIDLo], a
ld a, MUSIC_NONE / $100
ld [MusicFadeIDHi], a
- ld a, $a
+ ld a, 10
ld [MusicFade], a
callba Function8c084
xor a
@@ -55536,7 +55534,7 @@
ld [VramState], a
ld [$ffde], a
callba Function4e881
- ld c, $64
+ ld c, 100
jp DelayFrames
; 864b4
@@ -55554,31 +55552,31 @@
xor a
ld [wcf63], a
call Function8671c
- jr c, .asm_864fb
- ld de, $0014
+ jr c, .done
+ ld de, SCREEN_WIDTH
call Function864b4
xor a
ld [wcf64], a
-.asm_864d6
+.loop
ld a, [wcf64]
- cp $6
- jr nc, .asm_864fb
+ cp 6
+ jr nc, .done
ld hl, wc608 + 1
ld bc, $0010
call AddNTimes
ld a, [hl]
- cp $ff
- jr z, .asm_864fb
+ cp -1
+ jr z, .done
push hl
call Function865b5
pop hl
call Function8650c
- jr c, .asm_864fb
+ jr c, .done
ld hl, wcf64
inc [hl]
- jr .asm_864d6
+ jr .loop
-.asm_864fb
+.done
call Function86810
ld a, $4
ld [MusicFade], a
@@ -55704,8 +55702,8 @@
ld [TempMonDVs + 1], a
ld hl, TempMonDVs
predef GetUnownLetter
- ld hl, TileMap
- ld bc, $0168
+ hlcoord 0, 0
+ ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
ld a, $7f
call ByteFill
ld de, $9310
@@ -55728,8 +55726,8 @@
call Function86635
xor a
ld [wc2c6], a
- ld hl, TileMap
- ld bc, $0168
+ hlcoord 0, 0
+ ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
ld a, $7f
call ByteFill
hlcoord 6, 5
@@ -55929,11 +55927,11 @@
call CopyBytes
ld a, $50
ld [StringBuffer2 + 10], a
- ld hl, TileMap
- ld bc, $0168
+ hlcoord 0, 0
+ ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
ld a, $7f
call ByteFill
- ld hl, TileMap
+ hlcoord 0, 0
ld bc, $0312
call TextBox
hlcoord 0, 12
@@ -56002,8 +56000,8 @@
ld de, FontExtra + $d0
lb bc, BANK(FontExtra), 1
call Request2bpp
- ld hl, TileMap
- ld bc, $0168
+ hlcoord 0, 0
+ ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
ld a, $7f
call ByteFill
callba GetPlayerBackpic
@@ -56026,8 +56024,8 @@
call Function86635
xor a
ld [wc2c6], a
- ld hl, TileMap
- ld bc, $0168
+ hlcoord 0, 0
+ ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
ld a, $7f
call ByteFill
callba Function88840
@@ -56034,7 +56032,7 @@
xor a
ld [$ffad], a
hlcoord 12, 5
- ld bc, $0707
+ lb bc, 7, 7
predef FillBox
ld a, $c0
ld [hSCX], a
@@ -56521,7 +56519,7 @@
push de
xor a
ld [hBGMapMode], a
- ld bc, $0707
+ lb bc, 7, 7
predef FillBox
xor a
ld [hBGMapThird], a
@@ -56541,7 +56539,7 @@
ld a, h
sbc d
ld h, a
- ld bc, $0707
+ lb bc, 7, 7
call ClearBox
pop bc
pop hl
@@ -56749,7 +56747,7 @@
xor a
ld [$ffad], a
hlcoord 6, 4
- ld bc, $0707
+ lb bc, 7, 7
predef FillBox
ret
; 888a9
@@ -56883,9 +56881,9 @@
Function891b8: ; 891b8
call Function8923c
- ld hl, TileMap
+ hlcoord 0, 0
ld a, $7f
- ld bc, $0168
+ ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
call ByteFill
call DelayFrame
ret
@@ -56910,13 +56908,13 @@
Function891de: ; 891de
call Function8923c
call ClearPalettes
- ld hl, AttrMap
+ hlcoord 0, 0, AttrMap
ld a, $7
- ld bc, $0168
+ ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
call ByteFill
- ld hl, TileMap
+ hlcoord 0, 0
ld a, $7f
- ld bc, $0168
+ ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
call ByteFill
call Function891ab
ret
@@ -57617,8 +57615,8 @@
Function895e6: ; 895e6
ld a, 7
- ld hl, AttrMap
- ld bc, $0168
+ hlcoord 0, 0, AttrMap
+ ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
call ByteFill
ret
; 895f2
@@ -57626,8 +57624,8 @@
Function895f2: ; 895f2
push bc
xor a
- ld hl, AttrMap
- ld bc, $0168
+ hlcoord 0, 0, AttrMap
+ ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
call ByteFill
call Function89605
call Function89655
@@ -57677,7 +57675,7 @@
hlcoord 12, 3, AttrMap
ld a, 6
ld de, SCREEN_WIDTH
- ld bc, $0707
+ lb bc, 7, 7
.loop
push hl
ld c, 7
@@ -57732,7 +57730,7 @@
ret
Function89688: ; 89688
- ld hl, TileMap
+ hlcoord 0, 0
ld a, 1
ld e, SCREEN_WIDTH
call Function896e1
@@ -57867,7 +57865,7 @@
ld a, $2d
ld [hld], a
push hl
- ld de, $0014
+ ld de, SCREEN_WIDTH
add hl, de
ld a, $31
ld [hli], a
@@ -57891,7 +57889,7 @@
ld [hli], a
ld a, $30
ld [hld], a
- ld de, $0014
+ ld de, SCREEN_WIDTH
add hl, de
ld a, $33
ld [hli], a
@@ -57967,7 +57965,7 @@
push bc
ld a, $e
ld [hl], a
- ld bc, $0014
+ ld bc, SCREEN_WIDTH
add hl, bc
ld a, $11
ld [hli], a
@@ -58010,8 +58008,8 @@
jr nc, .asm_897f3
hlcoord 12, 3, AttrMap
xor a
- ld de, $0014
- ld bc, $0707
+ ld de, SCREEN_WIDTH
+ lb bc, 7, 7
.asm_897e5
push hl
ld c, $7
@@ -58030,7 +58028,7 @@
ld a, $37
ld [$ffad], a
hlcoord 12, 3
- ld bc, $0707
+ lb bc, 7, 7
predef FillBox
call Function8963d
pop bc
@@ -58244,7 +58242,7 @@
Function8994e: ; 8994e
push hl
push de
- ld de, $0014
+ ld de, SCREEN_WIDTH
ld a, l
sub e
ld l, a
@@ -59482,7 +59480,7 @@
Function8a0c9: ; 8a0c9 (22:60c9)
push bc
- ld hl, TileMap
+ hlcoord 0, 0
ld de, $14
ld a, b
and a
@@ -61338,8 +61336,7 @@
inc hl
ld d, $0
ld e, $14
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [ScriptVar]
ld c, a
ld de, Unknown_8aebc
@@ -62821,7 +62818,7 @@
; 8b6ed
Function8b6ed: ; 8b6ed
- ld hl, AttrMap
+ hlcoord 0, 0, AttrMap
ld bc, $012c
xor a
call ByteFill
@@ -62844,7 +62841,7 @@
pop hl
push hl
push bc
- ld de, $0014
+ ld de, SCREEN_WIDTH
add hl, de
.asm_8b717
push hl
@@ -62855,7 +62852,7 @@
ld a, $11
ld [hl], a
pop hl
- ld de, $0014
+ ld de, SCREEN_WIDTH
add hl, de
dec b
jr nz, .asm_8b717
@@ -62900,7 +62897,7 @@
dec c
jr nz, .asm_8b74f
pop hl
- ld de, $0014
+ ld de, SCREEN_WIDTH
add hl, de
pop bc
dec b
@@ -62910,9 +62907,9 @@
Function8b75d: ; 8b75d
call Function8923c
- ld hl, TileMap
+ hlcoord 0, 0
ld a, $1
- ld bc, $0014
+ ld bc, SCREEN_WIDTH
call ByteFill
hlcoord 0, 1
ld a, $2
@@ -63588,8 +63585,7 @@
ld e, a
ld d, 0
ld hl, .TimePalettes
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -63898,8 +63894,7 @@
ld e, a
ld d, 0
ld hl, Jumptable_8c323
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -64108,13 +64103,9 @@
ld e, a
ld d, 0
ld hl, Unknown_8c490
- add hl, de
- add hl, de
- add hl, de
- add hl, de
- add hl, de
+ add_n_times hl, de, 5
ld a, [hli]
- cp $ff
+ cp -1
jr z, .asm_8c47a
ld [wcf65], a
call Function8c4f5
@@ -64296,7 +64287,7 @@
jp z, Function8c673
xor a
ld [hBGMapMode], a ; $ff00+$d4
- ld hl, AttrMap
+ hlcoord 0, 0, AttrMap
ld bc, $168
inc b
inc c
@@ -64486,8 +64477,7 @@
ld a, d
ld d, 0
ld hl, Unknown_8c728
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld e, [hl]
inc hl
ld d, [hl]
@@ -64677,7 +64667,7 @@
ld a, $5
ld [hli], a
ld [hld], a
- ld bc, $0014
+ ld bc, SCREEN_WIDTH
add hl, bc
ld [hli], a
ld [hld], a
@@ -64743,8 +64733,7 @@
ld e, a
ld d, 0
ld hl, Jumptable_8ca1b
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -64842,8 +64831,7 @@
add e
ld e, a
ld hl, Unknown_8cab3
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld e, [hl]
inc hl
ld d, [hl]
@@ -65247,8 +65235,7 @@
ld e, a
ld d, 0
ld hl, MagnetTrainBGTiles
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld e, [hl]
inc hl
ld d, [hl]
@@ -65331,8 +65318,7 @@
ld e, a
ld d, 0
ld hl, Jumptable_8ce06
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -65645,9 +65631,7 @@
ld e, a
ld d, 0
ld hl, Unknown_8d1c4
- add hl, de
- add hl, de
- add hl, de
+ add_n_times hl, de, 3
ld e, l
ld d, h
ld hl, $0000
@@ -65963,8 +65947,7 @@
ld e, [hl]
ld d, 0
ld hl, Unknown_8d6e6
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld e, [hl]
inc hl
ld d, [hl]
@@ -65981,9 +65964,7 @@
ld e, a
ld d, 0
ld hl, Unknown_8d94d
- add hl, de
- add hl, de
- add hl, de
+ add_n_times hl, de, 3
ret
; 8d1ac
@@ -65991,8 +65972,7 @@
push hl
ld l, a
ld h, 0
- add hl, hl
- add hl, hl
+ add_n_times hl, hl, 2
ld de, Unknown_8e706
add hl, de
ld c, [hl]
@@ -66064,8 +66044,7 @@
ld e, [hl]
ld d, 0
ld hl, Jumptable_8d25b
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -68259,8 +68238,7 @@
ld a, d
ld d, 0
ld hl, Unknown_8e75d
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld e, [hl]
inc hl
ld d, [hl]
@@ -68399,8 +68377,7 @@
Function8e849: ; 8e849
ld d, 0
ld hl, Jumptable_8e854
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -68690,10 +68667,7 @@
; Load icon graphics into VRAM starting from tile hl.
; One tile is 16 bytes long.
- add hl, hl
- add hl, hl
- add hl, hl
- add hl, hl
+ add_n_times hl, hl, 4
ld de, VTiles0
add hl, de
@@ -69061,7 +69035,7 @@
ret
Function90136:: ; 90136 (24:4136)
- ld a, [wdc31]
+ ld a, [wSpecialPhoneCallID]
and a
jr z, .asm_90171
dec a
@@ -69108,7 +69082,7 @@
; 0x90178
Function90178: ; 90178 (24:4178)
- ld a, [wdc31]
+ ld a, [wSpecialPhoneCallID]
dec a
ld c, a
ld b, 0
@@ -69434,7 +69408,7 @@
Phone_CallerTextbox: ; 90375
- ld hl, TileMap
+ hlcoord 0, 0
ld b, $2
ld c, $12
call TextBox
@@ -69794,7 +69768,7 @@
Function90783: ; 90783 (24:4783)
xor a
ld [hBGMapMode], a ; $ff00+$d4
- ld hl, TileMap
+ hlcoord 0, 0
ld bc, $168
xor a
call ByteFill
@@ -70193,8 +70167,7 @@
ld e, a
ld d, 0
ld hl, Unknown_909f2
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld d, [hl]
ld e, a
@@ -70671,7 +70644,7 @@
Function90da8: ; 90da8 (24:4da8)
xor a
ld [hBGMapMode], a
- ld hl, TileMap
+ hlcoord 0, 0
ld bc, TileMapEnd - TileMap
ld a, $4f
call ByteFill
@@ -70821,7 +70794,7 @@
ret
Function90eb0: ; 90eb0 (24:4eb0)
- ld hl, TileMap
+ hlcoord 0, 0
ld bc, $8
ld a, $4f
call ByteFill
@@ -70839,7 +70812,7 @@
ld a, [de]
bit 1, a
call nz, Function90ef2
- ld hl, TileMap
+ hlcoord 0, 0
ld a, $46
call Function90ef7
ret
@@ -70875,8 +70848,7 @@
ld e, a
ld d, 0
ld hl, Jumptable_90f13
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -71662,8 +71634,7 @@
ld a, [wc6d4]
ld e, a
ld d, 0
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -71809,7 +71780,7 @@
ret
Function914bb: ; 914bb (24:54bb)
- ld hl, TileMap
+ hlcoord 0, 0
.asm_914be
ld a, [de]
cp $ff
@@ -72421,7 +72392,7 @@
ld bc, $0006
hlcoord 1, 0
call ByteFill
- ld hl, TileMap
+ hlcoord 0, 0
ld [hl], $6
hlcoord 7, 0
ld [hl], $17
@@ -72479,8 +72450,7 @@
ld [EnemyTurnsTaken], a
ld hl, Jumptable_91ab9
ld d, $0
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -72666,7 +72636,7 @@
; Draw the bubble containing the location text in the town map HUD
; Top-left corner
- ld hl, TileMap + 1 ; (1,0)
+ hlcoord 1, 0
ld a, $30
ld [hli], a
@@ -72678,7 +72648,7 @@
; Top-right corner
ld a, $31
ld [hl], a
- ld hl, TileMap + 1 + 20 ; (1,1)
+ hlcoord 1, 1
; Middle row
@@ -72688,7 +72658,7 @@
; Bottom-left corner
- ld hl, TileMap + 1 + 40 ; (1,2)
+ hlcoord 1, 2
ld a, $32
ld [hli], a
@@ -72703,7 +72673,7 @@
; Print "Where?"
- ld hl, TileMap + 2 ; (2,0)
+ hlcoord 2, 0
ld de, .Where
call PlaceString
@@ -72711,7 +72681,7 @@
call .Name
; Up/down arrows
- ld hl, TileMap + 18 + 20 ; (18,1)
+ hlcoord 18, 1
ld [hl], $34
ret
@@ -72730,7 +72700,7 @@
callba GetLandmarkName
- ld hl, TileMap + 2 + 20 ; (2,1)
+ hlcoord 2, 1
ld de, StringBuffer1
call PlaceString
ret
@@ -73066,7 +73036,7 @@
ret
.asm_91ddc
- ld hl, TileMap
+ hlcoord 0, 0
ld de, Sprites
ld bc, $00a0
call CopyBytes
@@ -73074,14 +73044,14 @@
; 91de9
Function91de9: ; 91de9
- ld hl, TileMap
- ld bc, $0014
+ hlcoord 0, 0
+ ld bc, SCREEN_WIDTH
ld a, $7f
call ByteFill
hlcoord 0, 1
ld a, $6
ld [hli], a
- ld bc, $0012
+ ld bc, SCREEN_HEIGHT
ld a, $7
call ByteFill
ld [hl], $17
@@ -73103,7 +73073,7 @@
ld [wd003], a
ld e, a
callba Function2a01f
- ld de, TileMap
+ decoord 0, 0
ld hl, Sprites
.asm_91e2e
ld a, [de]
@@ -73130,7 +73100,7 @@
.asm_91e4d
ld hl, Sprites
- ld de, TileMap
+ decoord 0, 0
ld bc, $00a0
call CopyBytes
ret
@@ -73280,7 +73250,7 @@
ld de, KantoMap
FillTownMap: ; 91f07
- ld hl, TileMap
+ hlcoord 0, 0
.loop
ld a, [de]
cp $ff
@@ -73294,8 +73264,8 @@
TownMapPals: ; 91f13
; Assign palettes based on tile ids
- ld hl, TileMap
- ld de, AttrMap
+ hlcoord 0, 0
+ decoord 0, 0, AttrMap
ld bc, 360
.loop
; Current tile
@@ -73651,7 +73621,7 @@
ld de, $9250
call Decompress
ld hl, SlotsTilemap
- ld de, TileMap
+ decoord 0, 0
ld bc, 20 * 12
call CopyBytes
ld hl, rLCDC ; $ff40
@@ -73795,8 +73765,7 @@
ld e, a
ld d, 0
ld hl, Jumptable_92853
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -74373,8 +74342,7 @@
ld e, [hl]
ld d, 0
ld hl, Jumptable_92be4
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -74873,8 +74841,7 @@
ld e, a
ld d, 0
ld hl, Jumptable_92ebd
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -74975,8 +74942,7 @@
ld e, a
ld d, 0
ld hl, Jumptable_92f48
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -75383,9 +75349,7 @@
ld e, a
ld d, 0
ld hl, Unknown_93195
- add hl, de
- add hl, de
- add hl, de
+ add_n_times hl, de, 3
ld de, StringBuffer2
ld bc, $4
call CopyBytes
@@ -75496,8 +75460,7 @@
ld e, [hl]
ld d, 0
ld hl, Jumptable_9322d
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -75593,8 +75556,7 @@
ld e, [hl]
ld d, 0
ld hl, Jumptable_932bc
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -75876,7 +75838,7 @@
; b80d3
Functionb80d3: ; b80d3
- ld hl, TileMap
+ hlcoord 0, 0
ld b, $2
ld c, $12
call Functionb8115
@@ -75934,7 +75896,7 @@
dec c
jr nz, .asm_b8121
pop hl
- ld de, $0014
+ ld de, SCREEN_WIDTH
add hl, de
pop bc
dec b
@@ -75943,7 +75905,7 @@
; b812f
Functionb812f: ; b812f
- ld hl, TileMap
+ hlcoord 0, 0
ld a, $61
ld [hli], a
ld a, $62
@@ -76230,8 +76192,7 @@
ld e, a
ld d, 0
ld hl, TreeMons
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
@@ -76588,8 +76549,7 @@
ld e, a
ld d, 0
ld hl, Jumptable_b863a
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -76818,8 +76778,7 @@
jr nc, .loop2
ld e, a
ld d, 0
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
inc hl
ld a, BANK(WildMons1)
call GetFarByte
@@ -76932,8 +76891,7 @@
ld e, a
ld d, 0
ld hl, Unknown_b8869
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -77062,8 +77020,7 @@
ld e, a
ld d, 0
ld hl, Unknown_b88fe
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -77826,13 +77783,13 @@
ld hl, Unknown_b8d3e
ld a, [StatusFlags]
bit 6, a
- jr z, .asm_b8d14
+ jr z, .NotMet
ld hl, Unknown_b8d43
ld a, [KantoBadges]
cp %11111111
- jr nz, .asm_b8d14
+ jr nz, .NotMet
ld hl, Unknown_b8d4b
-.asm_b8d14
+.NotMet
pop af
ld c, a
ld de, $1
@@ -77870,8 +77827,7 @@
ld e, a
ld d, 0
ld hl, Unknown_b8d7d
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -78047,8 +78003,7 @@
ld e, a
ld d, 0
ld hl, Unknown_b8e52
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -78287,8 +78242,7 @@
ld hl, Unknown_b8ff9
ld d, 0
ld e, a
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -78302,8 +78256,7 @@
push hl
ld hl, Jumptable_b8fb8
ld e, b
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -78919,7 +78872,7 @@
ld c, $8
call Functionb9915
ld a, $31
- ld hl, TileMap
+ hlcoord 0, 0
call Functionb98a8
hlcoord 1, 17
call Functionb98a8
@@ -79108,7 +79061,7 @@
ld c, $8
call Functionb990c
ld a, $31
- ld hl, TileMap
+ hlcoord 0, 0
call Functionb98dc
hlcoord 0, 1
call Functionb98e3
@@ -79270,7 +79223,7 @@
ld c, $8
call Functionb990c
ld a, $31
- ld hl, TileMap
+ hlcoord 0, 0
call Functionb98a8
hlcoord 1, 17
call Functionb98a8
@@ -79410,7 +79363,7 @@
; b9858
Functionb9858: ; b9858
- ld hl, TileMap
+ hlcoord 0, 0
ld a, $31
ld [hli], a
inc a
@@ -79432,7 +79385,7 @@
; b987b
Functionb987b: ; b987b
- ld hl, TileMap
+ hlcoord 0, 0
ld a, $31
ld [hli], a
inc a
@@ -79489,7 +79442,7 @@
Functionb98bd: ; b98bd
ld [hl], a
- ld de, $0014
+ ld de, SCREEN_WIDTH
add hl, de
inc a
ld [hl], a
@@ -79530,7 +79483,7 @@
Functionb98e3: ; b98e3
ld b, $10
- ld de, $0014
+ ld de, SCREEN_WIDTH
.asm_b98e8
ld [hl], a
add hl, de
@@ -79560,7 +79513,7 @@
ld [hli], a
inc a
ld [hl], a
- ld bc, $0012
+ ld bc, SCREEN_HEIGHT
add hl, bc
inc a
ld [hli], a
@@ -80213,8 +80166,7 @@
ld e, a
ld d, 0
ld hl, Jumptable_e01a0
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -80304,11 +80256,11 @@
Functione0217: ; e0217
xor a
ld [hBGMapMode], a
- ld hl, TileMap
+ hlcoord 0, 0
ld bc, $0c09
call Functione04e5
hlcoord 9, 0
- ld bc, $0014
+ ld bc, SCREEN_WIDTH
ld a, [wc6e8]
call AddNTimes
ld [hl], $f5
@@ -80416,8 +80368,7 @@
ld e, a
ld d, $0
ld hl, wc6d0
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [wcf66]
ld e, a
add hl, de
@@ -80578,8 +80529,7 @@
ld e, a
ld d, 0
ld hl, Unknown_e0459
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld e, a
ld d, [hl]
@@ -80587,10 +80537,10 @@
ld bc, $0017
add hl, bc
ld [hl], e
- ld bc, $0012
+ ld bc, SCREEN_HEIGHT
add hl, bc
ld a, d
- ld de, $0014
+ ld de, SCREEN_WIDTH
ld b, $3
.asm_e0418
push hl
@@ -80670,7 +80620,7 @@
Functione04c1: ; e04c1 (38:44c1)
xor a
ld [hBGMapMode], a ; $ff00+$d4
- ld hl, TileMap
+ hlcoord 0, 0
ld bc, $168
ld a, $29
call ByteFill
@@ -80799,7 +80749,7 @@
add hl, bc
add hl, bc
ld [hl], $36
- ld bc, $0014
+ ld bc, SCREEN_WIDTH
add hl, bc
ld [hl], $37
ret
@@ -80809,7 +80759,7 @@
add hl, bc
add hl, bc
ld [hl], $36
- ld bc, $0014
+ ld bc, SCREEN_WIDTH
add hl, bc
ld [hl], $3d
ret
@@ -80825,7 +80775,7 @@
add hl, bc
add hl, bc
ld [hl], $3b
- ld bc, $0014
+ ld bc, SCREEN_WIDTH
add hl, bc
ld [hl], $3a
ret
@@ -80835,7 +80785,7 @@
add hl, bc
add hl, bc
ld [hl], $3d
- ld bc, $0014
+ ld bc, SCREEN_WIDTH
add hl, bc
ld [hl], $3a
ret
@@ -80851,7 +80801,7 @@
add hl, bc
add hl, bc
ld [hl], $36
- ld bc, $0014
+ ld bc, SCREEN_WIDTH
add hl, bc
ld [hl], $38
ret
@@ -80861,7 +80811,7 @@
add hl, bc
add hl, bc
ld [hl], $36
- ld bc, $0014
+ ld bc, SCREEN_WIDTH
add hl, bc
ld [hl], $3d
ret
@@ -80877,7 +80827,7 @@
add hl, bc
add hl, bc
ld [hl], $3c
- ld bc, $0014
+ ld bc, SCREEN_WIDTH
add hl, bc
ld [hl], $3a
ret
@@ -80887,7 +80837,7 @@
add hl, bc
add hl, bc
ld [hl], $3d
- ld bc, $0014
+ ld bc, SCREEN_WIDTH
add hl, bc
ld [hl], $3a
ret
@@ -80903,7 +80853,7 @@
add hl, bc
add hl, bc
ld [hl], $36
- ld bc, $0014
+ ld bc, SCREEN_WIDTH
add hl, bc
ld [hl], $39
ret
@@ -80913,7 +80863,7 @@
add hl, bc
add hl, bc
ld [hl], $36
- ld bc, $0014
+ ld bc, SCREEN_WIDTH
add hl, bc
ld [hl], $3d
ret
@@ -80929,7 +80879,7 @@
add hl, bc
add hl, bc
ld [hl], $3c
- ld bc, $0014
+ ld bc, SCREEN_WIDTH
add hl, bc
ld [hl], $3a
ret
@@ -80939,7 +80889,7 @@
add hl, bc
add hl, bc
ld [hl], $3d
- ld bc, $0014
+ ld bc, SCREEN_WIDTH
add hl, bc
ld [hl], $3a
ret
@@ -81500,8 +81450,7 @@
.asm_e096d
call Functione0398
- add hl, hl
- add hl, hl
+ add_n_times hl, hl, 2
ld de, Unknown_e0981
add hl, de
ld a, [hli]
@@ -81720,7 +81669,7 @@
ld a, [hCGB] ; $ff00+$e6
and a
ret z
- ld hl, AttrMap
+ hlcoord 0, 0, AttrMap
ld bc, $168
xor a
call ByteFill
@@ -81857,8 +81806,8 @@
ld de, $8ed0
call Decompress
call Functione17a3
- ld hl, TileMap
- ld bc, $0168
+ hlcoord 0, 0
+ ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
ld a, $ee
call ByteFill
hlcoord 4, 3
@@ -82002,8 +81951,7 @@
ld e, a
ld d, 0
ld hl, Jumptable_e12d9
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -82183,7 +82131,7 @@
; e13ee
Functione13ee: ; e13ee
- ld de, $0014
+ ld de, SCREEN_WIDTH
.asm_e13f1
push bc
push hl
@@ -82233,7 +82181,7 @@
push hl
call Functione1481
pop hl
- ld de, $0014
+ ld de, SCREEN_WIDTH
ld b, $3
.asm_e1431
ld c, $3
@@ -82262,7 +82210,7 @@
call Functione1463
ld a, [hl]
pop hl
- ld de, $0014
+ ld de, SCREEN_WIDTH
ld b, $3
.asm_e1456
ld c, $3
@@ -82285,12 +82233,8 @@
add hl, de
ld a, [wcf65]
ld e, a
- add hl, de
- add hl, de
- add hl, de
- add hl, de
- add hl, de
- add hl, de
+ add_n_times hl, de, 4
+ add_n_times hl, de, 2
ret
; e1475
@@ -82650,8 +82594,7 @@
ld e, a
ld d, 0
ld hl, Unknown_e17bd
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -82711,7 +82654,7 @@
ld hl, wc300
ld [hli], a
ld [hl], $0
- ld hl, TileMap
+ hlcoord 0, 0
ld bc, $168
xor a
call ByteFill
@@ -82748,8 +82691,7 @@
ld e, a
ld d, 0
ld hl, Jumptable_e1ee1
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -83107,9 +83049,7 @@
dec a
ld l, a
ld h, 0
- add hl, hl
- add hl, hl
- add hl, hl
+ add_n_times hl, hl, 3
ld de, Unknown_e2110
add hl, de
ret
@@ -83130,7 +83070,7 @@
inc a
ld [hld], a
inc a
- ld bc, $0014
+ ld bc, SCREEN_WIDTH
add hl, bc
ld [hli], a
inc a
@@ -83144,7 +83084,7 @@
ld a, $1
ld [hli], a
ld [hld], a
- ld bc, $0014
+ ld bc, SCREEN_WIDTH
add hl, bc
ld [hli], a
ld [hl], a
@@ -83154,11 +83094,11 @@
; e2152
Functione2152: ; e2152
- ld hl, TileMap
- ld bc, $0168
+ hlcoord 0, 0
+ ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
ld a, $1
call ByteFill
- ld hl, TileMap
+ hlcoord 0, 0
ld de, String_e2177
call PlaceString
hlcoord 15, 0
@@ -83437,8 +83377,7 @@
ld e, a
ld d, 0
ld hl, BillsPCDepositJumptable
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -83541,7 +83480,7 @@
; 0xe2564 (38:6564)
Functione2564: ; e2564
- ld hl, TileMap
+ hlcoord 0, 0
ld b, $4
ld c, $8
call ClearBox
@@ -83701,8 +83640,7 @@
ld e, a
ld d, 0
ld hl, BillsPCWithdrawJumptable
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -83962,8 +83900,7 @@
ld e, a
ld d, 0
ld hl, Jumptable_e2881
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -84450,9 +84387,7 @@
ld e, a
ld d, $0
ld hl, wc801
- add hl, de
- add hl, de
- add hl, de
+ add_n_times hl, de, 3
ld a, [hl]
and a
jr z, .asm_e2bc6
@@ -84559,9 +84494,7 @@
ld e, a
ld d, 0
ld hl, OverworldMap
- add hl, de
- add hl, de
- add hl, de
+ add_n_times hl, de, 3
ld e, l
ld d, h
hlcoord 9, 4
@@ -84816,9 +84749,7 @@
ld e, a
ld d, $0
ld hl, OverworldMap
- add hl, de
- add hl, de
- add hl, de
+ add_n_times hl, de, 3
ld a, [hl]
ret
@@ -84931,7 +84862,7 @@
dec c
jr nz, .asm_e2ed7
pop hl
- ld bc, $0014
+ ld bc, SCREEN_WIDTH
add hl, bc
pop bc
dec b
@@ -85157,7 +85088,7 @@
callba Functione039
ld a, [CurPartySpecies]
call PlayCry
- ld hl, TileMap
+ hlcoord 0, 0
ld bc, $f08
call ClearBox
hlcoord 8, 14
@@ -85211,7 +85142,7 @@
callba Functione039
ld a, [CurPartySpecies]
call PlayCry
- ld hl, TileMap
+ hlcoord 0, 0
ld bc, $f08
call ClearBox
hlcoord 8, 14
@@ -85246,7 +85177,7 @@
ret
Functione3180: ; e3180 (38:7180)
- ld hl, TileMap
+ hlcoord 0, 0
ld bc, $f08
call ClearBox
hlcoord 8, 14
@@ -85569,8 +85500,7 @@
Functione33df: ; e33df (38:73df)
ld e, a
ld d, $0
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -85648,7 +85578,7 @@
Functione35e2: ; e35e2 (38:75e2)
xor a
ld [hBGMapMode], a ; $ff00+$d4
- ld hl, TileMap
+ hlcoord 0, 0
ld bc, $168
ld a, $7f
call ByteFill
@@ -85789,7 +85719,7 @@
; e36cf
Functione36cf: ; e36cf (38:76cf)
- ld hl, TileMap
+ hlcoord 0, 0
ld b, $2
ld c, $12
call TextBox
@@ -85953,7 +85883,7 @@
push af
ld [hl], $1
call WhiteBGMap
- ld hl, TileMap
+ hlcoord 0, 0
ld b, $10
ld c, $12
call TextBox
@@ -86031,8 +85961,7 @@
ld e, a ;copy it to de
ld d, 0
ld hl, .Pointers
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -86512,7 +86441,7 @@
Functione455c: ; e455c
hlcoord 1, 1
- ld de, $0014
+ ld de, SCREEN_WIDTH
ld c, $10
.asm_e4564
ld [hl], $7f
@@ -86644,8 +86573,7 @@
ld e, a
ld d, 0
ld hl, Jumptable_e467f
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -86742,8 +86670,7 @@
ld e, [hl]
ld d, 0
ld hl, Jumptable_e46fd
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -86839,8 +86766,7 @@
ld e, a
ld d, $0
ld hl, Unknown_e47ac
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [rSVBK] ; $ff00+$70
push af
ld a, $5
@@ -86954,8 +86880,7 @@
ld e, a
ld d, 0
ld hl, IntroScenes
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld h, [hl]
ld l, a
@@ -87324,7 +87249,7 @@
xor a
ld [hLCDStatCustom], a ; $ff00+$c6
call ClearSprites
- ld hl, AttrMap
+ hlcoord 0, 0, AttrMap
ld bc, $f0
ld a, $1
call ByteFill
@@ -88386,7 +88311,7 @@
ld a, $6
ld [rSVBK], a ; $ff00+$70
ld hl, Unkn1Pals
- ld de, TileMap
+ decoord 0, 0
ld b, $12
.asm_e542a
ld c, $14
@@ -88421,7 +88346,7 @@
ret
Functione5451: ; e5451 (39:5451)
- ld hl, TileMap
+ hlcoord 0, 0
ld bc, $168
.asm_e5457
ld a, [hl]
@@ -89405,7 +89330,7 @@
pop de
inc de
pop hl
- ld bc, $0014
+ ld bc, SCREEN_WIDTH
add hl, bc
pop bc
inc c
@@ -89986,8 +89911,7 @@
ld e, a
ld d, 0
ld hl, UnownWords
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [hli]
ld e, a
ld d, [hl]
@@ -90759,8 +90683,7 @@
ld e, a
ld d, 0
ld hl, NPCTrades
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
pop de
add hl, de
ret
@@ -91079,7 +91002,7 @@
ret nz
xor a
ld [wdc18], a
- call Functionfd044
+ call CheckBalance_MomItem2
ret nc
call Functionfd0c3
ret nc
@@ -91096,23 +91019,23 @@
; 0xfd017
Functionfd017: ; fd017
- call Functionfd0a6
+ call MomBuysItem_DeductFunds
call Functionfd0eb
ld a, [wdc18]
and a
- jr nz, .asm_fd027
+ jr nz, .ok
ld hl, wdc17
inc [hl]
-.asm_fd027
- ld a, $1
+.ok
+ ld a, 1
ld [wdbf9], a
ld bc, wd03f
- ld hl, $0
+ ld hl, 0
add hl, bc
- ld [hl], $0
+ ld [hl], 0
inc hl
- ld [hl], $1
- ld hl, $9
+ ld [hl], 1
+ ld hl, 9
add hl, bc
ld a, $3f
ld [hli], a
@@ -91123,50 +91046,50 @@
ret
; fd044
-Functionfd044: ; fd044
+CheckBalance_MomItem2: ; fd044
ld a, [wdc17]
- cp $a
- jr nc, .asm_fd065
- call Functionfd117
+ cp 10
+ jr nc, .nope
+ call GetItemFromMom
ld a, [hli]
- ld [$ffc3], a
+ ld [hMoneyTemp], a
ld a, [hli]
ld [$ffc4], a
ld a, [hli]
ld [$ffc5], a
ld de, wd851
- ld bc, $ffc3
+ ld bc, hMoneyTemp
callba CheckMoney
- jr nc, .asm_fd067
+ jr nc, .have_enough_money
-.asm_fd065
- jr .asm_fd069
+.nope
+ jr .check_have_2300
-.asm_fd067
+.have_enough_money
scf
ret
-.asm_fd069
- ld hl, $ffc3
- ld [hl], $0
+.check_have_2300
+ ld hl, hMoneyTemp
+ ld [hl], (2300 / $10000) ; $00
inc hl
- ld [hl], $8
+ ld [hl], ((2300 % $10000) / $100) ; $08
inc hl
- ld [hl], $fc
-.asm_fd074
+ ld [hl], (2300 % $100) ; $fc
+.loop
ld de, wdc19
ld bc, wd851
callba CheckMoney
- jr z, .asm_fd08b
- jr nc, .asm_fd089
+ jr z, .exact
+ jr nc, .less_than
call Functionfd099
- jr .asm_fd074
+ jr .loop
-.asm_fd089
+.less_than
xor a
ret
-.asm_fd08b
+.exact
call Functionfd099
ld a, 5
call RandomRange
@@ -91178,43 +91101,43 @@
Functionfd099: ; fd099
ld de, wdc19
- ld bc, $ffc3
+ ld bc, hMoneyTemp
callba Function16053
ret
; fd0a6
-Functionfd0a6: ; fd0a6 (3f:50a6)
- call Functionfd117
- ld de, $3
+MomBuysItem_DeductFunds: ; fd0a6 (3f:50a6)
+ call GetItemFromMom
+ ld de, 3
add hl, de
ld a, [hli]
- ld [$ffc3], a
+ ld [hMoneyTemp], a
ld a, [hli]
ld [$ffc4], a
ld a, [hli]
ld [$ffc5], a
ld de, wd851
- ld bc, $ffc3
+ ld bc, hMoneyTemp
callba TakeMoney
ret
Functionfd0c3: ; fd0c3
- call Functionfd117
- ld de, $0006
+ call GetItemFromMom
+ ld de, 6
add hl, de
ld a, [hli]
- cp $1
- jr z, .asm_fd0db
+ cp 1
+ jr z, .not_doll
ld a, [hl]
ld c, a
- ld b, $1
+ ld b, 1
callba Function26ef1
scf
ret
-.asm_fd0db
+.not_doll
ld a, [hl]
ld [CurItem], a
ld a, $1
@@ -91226,115 +91149,121 @@
Functionfd0eb: ; fd0eb (3f:50eb)
- call Functionfd117
- ld de, $6
+ call GetItemFromMom
+ ld de, 6 ; field
add hl, de
ld a, [hli]
- ld de, UnknownScript_0xfd0fd
- cp $1
+ ld de, Script_MomBoughtItem
+ cp 1
ret z
- ld de, UnknownScript_0xfd10a
+ ld de, Script_MomBoughtDoll
ret
; fd0fd (3f:50fd)
-UnknownScript_0xfd0fd: ; 0xfd0fd
- writetext UnknownText_0xfd1b1
- writetext UnknownText_0xfd1b6
- writetext UnknownText_0xfd1bb
- writetext UnknownText_0xfd1c0
+Script_MomBoughtItem: ; 0xfd0fd
+ writetext _MomText_HiHowAreYou
+ writetext _MomText_FoundAnItem
+ writetext _MomText_BoughtWithYourMoney
+ writetext _MomText_ItsInPC
end
; 0xfd10a
-UnknownScript_0xfd10a: ; 0xfd10a
- writetext UnknownText_0xfd1b1
- writetext UnknownText_0xfd1c5
- writetext UnknownText_0xfd1bb
- writetext UnknownText_0xfd1ca
+Script_MomBoughtDoll: ; 0xfd10a
+ writetext _MomText_HiHowAreYou
+ writetext _MomText_FoundADoll
+ writetext _MomText_BoughtWithYourMoney
+ writetext _MomText_ItsInRoom
end
; 0xfd117
-Functionfd117: ; fd117
+GetItemFromMom: ; fd117
ld a, [wdc18]
and a
- jr z, .asm_fd123
+ jr z, .zero
dec a
- ld de, Unknown_fd136
- jr .asm_fd12e
+ ld de, MomItems_1
+ jr .continue
-.asm_fd123
+.zero
ld a, [wdc17]
- cp $a
- jr c, .asm_fd12b
+ cp 10 ; length of MomItems_2
+ jr c, .ok
xor a
-.asm_fd12b
- ld de, Unknown_fd15e
+.ok
+ ld de, MomItems_2
-.asm_fd12e
+.continue
ld l, a
ld h, 0
- add hl, hl
- add hl, hl
- add hl, hl
+ add_n_times hl, hl, 3 ; multiply hl by 8
add hl, de
ret
; fd136
-Unknown_fd136: ; fd136
- db $00, $00, $00, $00, $02, $58, $01, SUPER_POTION
- db $00, $00, $00, $00, $00, $5a, $01, ANTIDOTE
- db $00, $00, $00, $00, $00, $b4, $01, POKE_BALL
- db $00, $00, $00, $00, $01, $c2, $01, ESCAPE_ROPE
- db $00, $00, $00, $00, $01, $f4, $01, GREAT_BALL
+momitem: macro
+; money to trigger, cost, kind, item
+ dt \1
+ dt \2
+ db \3, \4
+ENDM
+
+
+MomItems_1: ; fd136
+ momitem 0, 600, MOM_ITEM, SUPER_POTION
+ momitem 0, 90, MOM_ITEM, ANTIDOTE
+ momitem 0, 180, MOM_ITEM, POKE_BALL
+ momitem 0, 450, MOM_ITEM, ESCAPE_ROPE
+ momitem 0, 500, MOM_ITEM, GREAT_BALL
; fd15e
-Unknown_fd15e: ; fd15e
- db $00, $03, $84, $00, $02, $58, $01, SUPER_POTION
- db $00, $0f, $a0, $00, $01, $0e, $01, REPEL
- db $00, $1b, $58, $00, $02, $58, $01, SUPER_POTION
- db $00, $27, $10, $00, $07, $08, $02, $23 ; CHARMANDER_DOLL
- db $00, $3a, $98, $00, $0b, $b8, $01, MOON_STONE
- db $00, $4a, $38, $00, $02, $58, $01, SUPER_POTION
- db $00, $75, $30, $00, $12, $c0, $02, $20 ; CLEFAIRY_DOLL
- db $00, $9c, $40, $00, $03, $84, $01, HYPER_POTION
- db $00, $c3, $50, $00, $1f, $40, $02, $1e ; PIKACHU_DOLL
- db $01, $86, $a0, $00, $59, $10, $02, $1a ; SNORLAX_DOLL
+MomItems_2: ; fd15e
+ momitem 900, 600, MOM_ITEM, SUPER_POTION
+ momitem 4000, 270, MOM_ITEM, REPEL
+ momitem 7000, 600, MOM_ITEM, SUPER_POTION
+ momitem 10000, 1800, MOM_DOLL, DOLL_CHARMANDER
+ momitem 15000, 3000, MOM_ITEM, MOON_STONE
+ momitem 19000, 600, MOM_ITEM, SUPER_POTION
+ momitem 30000, 4800, MOM_DOLL, DOLL_CLEFAIRY
+ momitem 40000, 900, MOM_ITEM, HYPER_POTION
+ momitem 50000, 8000, MOM_DOLL, DOLL_PIKACHU
+ momitem 100000, 22800, MOM_DOLL, BIGDOLL_SNORLAX
; fd1ae
db 0, 0, 0 ; XXX
-UnknownText_0xfd1b1: ; 0xfd1b1
+_MomText_HiHowAreYou: ; 0xfd1b1
; Hi, ! How are you?
text_jump UnknownText_0x1bc615
db "@"
; 0xfd1b6
-UnknownText_0xfd1b6: ; 0xfd1b6
+_MomText_FoundAnItem: ; 0xfd1b6
; I found a useful item shopping, so
text_jump UnknownText_0x1bc62a
db "@"
; 0xfd1bb
-UnknownText_0xfd1bb: ; 0xfd1bb
+_MomText_BoughtWithYourMoney: ; 0xfd1bb
; I bought it with your money. Sorry!
text_jump UnknownText_0x1bc64e
db "@"
; 0xfd1c0
-UnknownText_0xfd1c0: ; 0xfd1c0
+_MomText_ItsInPC: ; 0xfd1c0
; It's in your PC. You'll like it!
text_jump UnknownText_0x1bc673
db "@"
; 0xfd1c5
-UnknownText_0xfd1c5: ; 0xfd1c5
+_MomText_FoundADoll: ; 0xfd1c5
; While shopping today, I saw this adorable doll, so
text_jump UnknownText_0x1bc693
db "@"
; 0xfd1ca
-UnknownText_0xfd1ca: ; 0xfd1ca
+_MomText_ItsInRoom: ; 0xfd1ca
; It's in your room. You'll love it!
text_jump UnknownText_0x1bc6c7
db "@"
@@ -91360,10 +91289,10 @@
; 104006
Function104006: ; 104006
- ld de, AttrMap
+ decoord 0, 0, AttrMap
ld hl, w6_d000 + $400
call Function104263
- ld de, TileMap
+ decoord 0, 0
ld hl, w6_d000
call Function10425f
ld a, $0
@@ -91383,7 +91312,7 @@
; 104033
Function104033: ; 104033
- ld de, TileMap
+ decoord 0, 0
ld hl, w6_d000
call Function10425f
ld a, $0
@@ -91399,7 +91328,7 @@
; 10404d
Function10404d: ; 10404d
- ld de, AttrMap
+ decoord 0, 0, AttrMap
ld hl, $d400
call Function104263
ld a, $1
@@ -91415,10 +91344,10 @@
; 104067
Function104067: ; 104067
- ld de, AttrMap
+ decoord 0, 0, AttrMap
ld hl, $d400
call Function104263
- ld de, TileMap
+ decoord 0, 0
ld hl, w6_d000
call Function10425f
call DelayFrame
@@ -91445,10 +91374,10 @@
; 1040a2
Function1040a2: ; 1040a2
- ld de, AttrMap
+ decoord 0, 0, AttrMap
ld hl, $d400
call Function104263
- ld de, TileMap
+ decoord 0, 0
ld hl, w6_d000
call Function10425f
call DelayFrame
@@ -91515,10 +91444,10 @@
; 104116
Function104116: ; 104116
- ld de, AttrMap
+ decoord 0, 0, AttrMap
ld hl, $d400
call Function104263
- ld de, TileMap
+ decoord 0, 0
ld hl, w6_d000
call Function10425f
call DelayFrame
@@ -91545,11 +91474,11 @@
; 10414e (41:414e)
Function10414e: ; 10414e
- ld de, AttrMap
+ decoord 0, 0, AttrMap
ld hl, $d400
call Function104263
ld c, $ff
- ld de, TileMap
+ decoord 0, 0
ld hl, w6_d000
call Function104265
ld a, $1
@@ -91785,10 +91714,7 @@
ld a, b
ld l, c
ld h, $0
- add hl, hl
- add hl, hl
- add hl, hl
- add hl, hl
+ add_n_times hl, hl, 4
ld b, h
ld c, l
ld h, d
@@ -91845,9 +91771,7 @@
ld a, b
ld l, c
ld h, $0
- add hl, hl
- add hl, hl
- add hl, hl
+ add_n_times hl, hl, 3
ld c, l
ld b, h
ld h, d
@@ -91875,10 +91799,10 @@
Function104309:
ld hl, w6_d000
- ld de, TileMap
+ decoord 0, 0
call Function10433a
ld hl, w6_d000 + $80
- ld de, AttrMap
+ decoord 0, 0, AttrMap
call Function10433a
ld a, $1
ld [rVBK], a ; $ff00+$4f
@@ -92196,12 +92120,12 @@
ret
Function1047a3: ; 1047a3 (41:47a3)
- ld de, TileMap
+ decoord 0, 0
call Function1047b4
ld a, [hCGB] ; $ff00+$e6
and a
ret z
- ld de, AttrMap
+ decoord 0, 0, AttrMap
ld a, $1
ld [rVBK], a ; $ff00+$4f
@@ -92572,8 +92496,7 @@
ld hl, $abe6
ld e, a
ld d, $0
- add hl, de
- add hl, de
+ add_n_times hl, de, 2
ld a, [wc901]
ld [hli], a
ld a, [wc902]
@@ -93439,12 +93362,12 @@
and $f
or b
ld c, a
- ld a, [$ffc3]
+ ld a, [hMoneyTemp]
xor c
and c
ld [$ffc4], a
ld a, c
- ld [$ffc3], a
+ ld [hMoneyTemp], a
ld a, $30
ld [rJOYP], a ; $ff00+$0
ret
@@ -93485,7 +93408,7 @@
pop bc
jr z, .asm_1050b0
push bc
- callab Function26f02
+ callab SetSpecificDecorationFlag
pop bc
.asm_1050b0
inc c
@@ -93614,7 +93537,7 @@
ld a, BANK(MysteryGiftGFX)
ld bc, $430
call FarCopyBytes
- ld hl, TileMap
+ hlcoord 0, 0
ld a, $42
ld bc, $168
call ByteFill
@@ -93621,7 +93544,7 @@
hlcoord 3, 7
ld bc, $90f
call ClearBox
- ld hl, TileMap
+ hlcoord 0, 0
ld a, $0
ld [hli], a
inc a
@@ -93919,7 +93842,7 @@
ld a, BANK(MysteryGiftJP_GFX)
ld bc, $80
call FarCopyBytes
- ld hl, TileMap
+ hlcoord 0, 0
ld a, $3f
ld bc, $168
call ByteFill
@@ -93926,7 +93849,7 @@
hlcoord 3, 7
ld bc, $90f
call ClearBox
- ld hl, TileMap
+ hlcoord 0, 0
ld a, $0
ld [hli], a
inc a
@@ -95613,7 +95536,7 @@
; 1dc1b0
Function1dc1b0: ; 1dc1b0
- ld hl, TileMap
+ hlcoord 0, 0
ld de, wca90
ld bc, $0154
call CopyBytes
@@ -95652,7 +95575,7 @@
call nz, FarString
ld hl, wcaa3
ld [hl], $35
- ld de, $0014
+ ld de, SCREEN_WIDTH
add hl, de
ld b, $f
.asm_1dc20a
@@ -95681,11 +95604,11 @@
ld [hl], $38
inc hl
ld a, $39
- ld bc, $0012
+ ld bc, SCREEN_HEIGHT
call ByteFill
ld [hl], $3a
ld hl, wcb1c
- ld bc, $0014
+ ld bc, SCREEN_WIDTH
ld a, $32
call ByteFill
ld a, [wd265]
@@ -95705,7 +95628,7 @@
Function1dc26a: ; 1dc26a
push de
- ld de, $0014
+ ld de, SCREEN_WIDTH
.asm_1dc26e
ld [hl], a
add hl, de
@@ -95837,7 +95760,7 @@
inc [hl]
.asm_1dc469
- ld hl, TileMap
+ hlcoord 0, 0
call Function378b
call WaitBGMap
ld b, $3
@@ -95856,12 +95779,12 @@
xor a
ld [MonType], a
callba Function5084a
- ld hl, TileMap
+ hlcoord 0, 0
ld b, 15
ld c, 18
call TextBox
ld bc, SCREEN_WIDTH
- ld de, TileMap
+ decoord 0, 0
hlcoord 0, 1
call CopyBytes
hlcoord 7, 0
@@ -96093,7 +96016,7 @@
ld bc, $f0b
call ClearBox
ld a, $34
- ld hl, TileMap
+ hlcoord 0, 0
ld bc, $b
call ByteFill
ld a, $39
@@ -96128,7 +96051,7 @@
Function1de1d1: ; 1de1d1 (77:61d1)
ld a, $34
- ld hl, TileMap
+ hlcoord 0, 0
ld bc, $b
call ByteFill
ld a, $39
@@ -96213,7 +96136,7 @@
Function1de27f: ; 1de27f
push de
- ld de, $0014
+ ld de, SCREEN_WIDTH
.asm_1de283
ld [hl], a
add hl, de
--- a/maps/BillsHouse.asm
+++ b/maps/BillsHouse.asm
@@ -8,7 +8,7 @@
GrampsScript_0x189538:
faceplayer
loadfont
- checkevent EVENT_CHRIS1_IN_CABLE_CLUB
+ checkevent EVENT_000
iftrue UnknownScript_0x1896ba
checkevent EVENT_GOT_THUNDERSTONE_FROM_BILLS_GRANDPA
iftrue UnknownScript_0x1896c0
@@ -120,7 +120,7 @@
verbosegiveitem EVERSTONE, 1
iffalse UnknownScript_0x1896cc
setevent EVENT_GOT_EVERSTONE_FROM_BILLS_GRANDPA
- setevent EVENT_CHRIS1_IN_CABLE_CLUB
+ setevent EVENT_000
loadmovesprites
end
@@ -131,7 +131,7 @@
verbosegiveitem LEAF_STONE, 1
iffalse UnknownScript_0x1896cc
setevent EVENT_GOT_LEAF_STONE_FROM_BILLS_GRANDPA
- setevent EVENT_CHRIS1_IN_CABLE_CLUB
+ setevent EVENT_000
loadmovesprites
end
@@ -142,7 +142,7 @@
verbosegiveitem WATER_STONE, 1
iffalse UnknownScript_0x1896cc
setevent EVENT_GOT_WATER_STONE_FROM_BILLS_GRANDPA
- setevent EVENT_CHRIS1_IN_CABLE_CLUB
+ setevent EVENT_000
loadmovesprites
end
@@ -153,7 +153,7 @@
verbosegiveitem FIRE_STONE, 1
iffalse UnknownScript_0x1896cc
setevent EVENT_GOT_FIRE_STONE_FROM_BILLS_GRANDPA
- setevent EVENT_CHRIS1_IN_CABLE_CLUB
+ setevent EVENT_000
loadmovesprites
end
--- a/maps/Colosseum.asm
+++ b/maps/Colosseum.asm
@@ -83,5 +83,5 @@
; people-events
db 2
- person_event SPRITE_CHRIS, 8, 7, LEFT << 2 | $1, $0, -1, -1, $0, 0, ChrisScript_0x193499, EVENT_CHRIS1_IN_CABLE_CLUB
- person_event SPRITE_CHRIS, 8, 10, LEFT << 2 | $0, $0, -1, -1, $0, 0, ChrisScript_0x193499, EVENT_CHRIS2_IN_CABLE_CLUB
+ person_event SPRITE_CHRIS, 8, 7, LEFT << 2 | $1, $0, -1, -1, $0, 0, ChrisScript_0x193499, EVENT_000
+ person_event SPRITE_CHRIS, 8, 10, LEFT << 2 | $0, $0, -1, -1, $0, 0, ChrisScript_0x193499, EVENT_001
--- a/maps/DragonShrine.asm
+++ b/maps/DragonShrine.asm
@@ -3,38 +3,38 @@
db 2
; triggers
- dw UnknownScript_0x18d01e, $0000
- dw UnknownScript_0x18d022, $0000
+ dw .Trigger1, $0000
+ dw .Trigger2, $0000
; callback count
db 0
-UnknownScript_0x18d01e:
- priorityjump UnknownScript_0x18d023
+.Trigger1:
+ priorityjump DragonShrineTestScript
end
-UnknownScript_0x18d022:
+.Trigger2:
end
-UnknownScript_0x18d023:
+DragonShrineTestScript:
applymovement $0, MovementData_0x18d2bf
applymovement $2, MovementData_0x18d2c7
loadfont
writetext UnknownText_0x18d2ea
keeptextopen
-UnknownScript_0x18d030:
- setevent EVENT_CHRIS2_IN_CABLE_CLUB
+.Question1:
+ setevent EVENT_001
writetext UnknownText_0x18d3bc
keeptextopen
loadmenudata MenuDataHeader_0x18d215
interpretmenu2
writebackup
- if_equal $1, UnknownScript_0x18d0a9
- if_equal $2, UnknownScript_0x18d0cb
- if_equal $3, UnknownScript_0x18d0a9
+ if_equal $1, .RightAnswer
+ if_equal $2, .WrongAnswer
+ if_equal $3, .RightAnswer
end
-UnknownScript_0x18d049:
+.Question2:
setevent EVENT_002
writetext UnknownText_0x18d3d3
keeptextopen
@@ -41,10 +41,10 @@
loadmenudata MenuDataHeader_0x18d234
interpretmenu2
writebackup
- if_equal $1, UnknownScript_0x18d0a9
- if_equal $2, UnknownScript_0x18d0a9
- if_equal $3, UnknownScript_0x18d0cb
-UnknownScript_0x18d061:
+ if_equal $1, .RightAnswer
+ if_equal $2, .RightAnswer
+ if_equal $3, .WrongAnswer
+.Question3:
setevent EVENT_003
writetext UnknownText_0x18d3f3
keeptextopen
@@ -51,10 +51,10 @@
loadmenudata MenuDataHeader_0x18d258
interpretmenu2
writebackup
- if_equal $1, UnknownScript_0x18d0cb
- if_equal $2, UnknownScript_0x18d0a9
- if_equal $3, UnknownScript_0x18d0a9
-UnknownScript_0x18d079:
+ if_equal $1, .WrongAnswer
+ if_equal $2, .RightAnswer
+ if_equal $3, .RightAnswer
+.Question4:
setevent EVENT_004
writetext UnknownText_0x18d420
keeptextopen
@@ -61,10 +61,10 @@
loadmenudata MenuDataHeader_0x18d283
interpretmenu2
writebackup
- if_equal $1, UnknownScript_0x18d0a9
- if_equal $2, UnknownScript_0x18d0cb
- if_equal $3, UnknownScript_0x18d0a9
-UnknownScript_0x18d091:
+ if_equal $1, .RightAnswer
+ if_equal $2, .WrongAnswer
+ if_equal $3, .RightAnswer
+.Question5:
setevent EVENT_005
writetext UnknownText_0x18d44a
keeptextopen
@@ -71,23 +71,23 @@
loadmenudata MenuDataHeader_0x18d2a5
interpretmenu2
writebackup
- if_equal $1, UnknownScript_0x18d0cb
- if_equal $2, UnknownScript_0x18d0a9
- if_equal $3, UnknownScript_0x18d0cb
-UnknownScript_0x18d0a9:
+ if_equal $1, .WrongAnswer
+ if_equal $2, .RightAnswer
+ if_equal $3, .WrongAnswer
+.RightAnswer:
checkevent EVENT_005
- iftrue UnknownScript_0x18d100
+ iftrue .PassedTheTest
writetext UnknownText_0x18d82d
keeptextopen
checkevent EVENT_004
- iftrue UnknownScript_0x18d091
+ iftrue .Question5
checkevent EVENT_003
- iftrue UnknownScript_0x18d079
+ iftrue .Question4
checkevent EVENT_002
- iftrue UnknownScript_0x18d061
- checkevent EVENT_CHRIS2_IN_CABLE_CLUB
- iftrue UnknownScript_0x18d049
-UnknownScript_0x18d0cb:
+ iftrue .Question3
+ checkevent EVENT_001
+ iftrue .Question2
+.WrongAnswer:
loadmovesprites
spriteface $2, LEFT
loadfont
@@ -102,16 +102,16 @@
setevent EVENT_ANSWERED_DRAGON_MASTER_QUIZ_WRONG
loadfont
checkevent EVENT_005
- iftrue UnknownScript_0x18d091
+ iftrue .Question5
checkevent EVENT_004
- iftrue UnknownScript_0x18d079
+ iftrue .Question4
checkevent EVENT_003
- iftrue UnknownScript_0x18d061
+ iftrue .Question3
checkevent EVENT_002
- iftrue UnknownScript_0x18d049
- checkevent EVENT_CHRIS2_IN_CABLE_CLUB
- iftrue UnknownScript_0x18d030
-UnknownScript_0x18d100:
+ iftrue .Question2
+ checkevent EVENT_001
+ iftrue .Question1
+.PassedTheTest:
writetext UnknownText_0x18d47c
closetext
loadmovesprites
@@ -160,7 +160,7 @@
playsound SFX_GET_BADGE
waitbutton
special RestartMapMusic
- specialphonecall $8
+ specialphonecall ELMCALL_MASTERBALL
dotrigger $1
domaptrigger GROUP_DRAGONS_DEN_B1F, MAP_DRAGONS_DEN_B1F, $1
writetext UnknownText_0x18d9f2
@@ -184,30 +184,30 @@
playsound SFX_ENTER_DOOR
disappear $5
waitbutton
- setevent EVENT_CHRIS1_IN_CABLE_CLUB
+ setevent EVENT_000
end
ElderScript_0x18d1a5:
faceplayer
loadfont
- checkevent EVENT_CHRIS1_IN_CABLE_CLUB
- iftrue UnknownScript_0x18d1f9
+ checkevent EVENT_000
+ iftrue .DontGiveDratiniYet
checkevent EVENT_006
- iftrue UnknownScript_0x18d1ff
+ iftrue .ReceivedDratini
checkevent EVENT_GOT_DRATINI
- iffalse UnknownScript_0x18d1c5
+ iffalse .GiveDratini
checkevent EVENT_BEAT_RIVAL_IN_MT_MOON
- iftrue UnknownScript_0x18d1f3
+ iftrue .BeatRivalInMtMoon
writetext UnknownText_0x18d724
closetext
loadmovesprites
end
-UnknownScript_0x18d1c5:
+.GiveDratini:
writetext UnknownText_0x18d604
closetext
checkcode VAR_PARTYCOUNT
- if_equal $6, UnknownScript_0x18d1ed
+ if_equal 6, .PartyFull
writetext UnknownText_0x18d697
playsound SFX_CAUGHT_MON
waitbutton
@@ -221,25 +221,25 @@
loadmovesprites
end
-UnknownScript_0x18d1ed:
+.PartyFull:
writetext UnknownText_0x18d6ac
closetext
loadmovesprites
end
-UnknownScript_0x18d1f3:
+.BeatRivalInMtMoon:
writetext UnknownText_0x18d782
closetext
loadmovesprites
end
-UnknownScript_0x18d1f9:
+.DontGiveDratiniYet:
writetext UnknownText_0x18d5e5
closetext
loadmovesprites
end
-UnknownScript_0x18d1ff:
+.ReceivedDratini:
writetext UnknownText_0x18d6ca
closetext
loadmovesprites
@@ -681,7 +681,7 @@
; people-events
db 4
- person_event SPRITE_ELDER, 5, 9, UP << 2 | $2, $0, -1, -1, $0, 0, ElderScript_0x18d1a5, EVENT_CHRIS1_IN_CABLE_CLUB
- person_event SPRITE_ELDER, 8, 6, LEFT << 2 | $1, $0, -1, -1, $0, 0, ElderScript_0x18d205, EVENT_CHRIS1_IN_CABLE_CLUB
- person_event SPRITE_ELDER, 8, 11, LEFT << 2 | $0, $0, -1, -1, $0, 0, ElderScript_0x18d20d, EVENT_CHRIS1_IN_CABLE_CLUB
+ person_event SPRITE_ELDER, 5, 9, UP << 2 | $2, $0, -1, -1, $0, 0, ElderScript_0x18d1a5, EVENT_000
+ person_event SPRITE_ELDER, 8, 6, LEFT << 2 | $1, $0, -1, -1, $0, 0, ElderScript_0x18d205, EVENT_000
+ person_event SPRITE_ELDER, 8, 11, LEFT << 2 | $0, $0, -1, -1, $0, 0, ElderScript_0x18d20d, EVENT_000
person_event SPRITE_CLAIR, 12, 8, UP << 2 | $3, $0, -1, -1, (PAL_OW_BLUE << 4) | $80, 0, ObjectEvent, EVENT_790
--- a/maps/DragonsDenB1F.asm
+++ b/maps/DragonsDenB1F.asm
@@ -212,12 +212,12 @@
playmusic MUSIC_RIVAL_ENCOUNTER
faceplayer
loadfont
- checkevent EVENT_CHRIS1_IN_CABLE_CLUB
+ checkevent EVENT_000
iftrue UnknownScript_0x18c995
writetext UnknownText_0x18cc83
closetext
loadmovesprites
- setevent EVENT_CHRIS1_IN_CABLE_CLUB
+ setevent EVENT_000
special RestartMapMusic
end
--- a/maps/EcruteakHouse.asm
+++ b/maps/EcruteakHouse.asm
@@ -86,7 +86,7 @@
UnknownScript_0x9807c:
checkevent EVENT_KOJI_ALLOWS_YOU_PASSAGE_TO_TIN_TOWER
iftrue UnknownScript_0x980a4
- checkevent EVENT_CHRIS1_IN_CABLE_CLUB
+ checkevent EVENT_000
iftrue UnknownScript_0x980aa
checkitem CLEAR_BELL
iftrue UnknownScript_0x98093
@@ -102,7 +102,7 @@
dotrigger $1
setevent EVENT_RANG_CLEAR_BELL
clearevent EVENT_766
- setevent EVENT_CHRIS1_IN_CABLE_CLUB
+ setevent EVENT_000
end
UnknownScript_0x980a4:
--- a/maps/GoldenrodDeptStoreRoof.asm
+++ b/maps/GoldenrodDeptStoreRoof.asm
@@ -7,30 +7,30 @@
; callbacks
- dbw 1, UnknownScript_0x5671b
+ dbw 1, .CheckSaleChangeBlock
- dbw 2, UnknownScript_0x5672b
+ dbw 2, .CheckSaleChangeClerk
-UnknownScript_0x5671b:
+.CheckSaleChangeBlock:
checkflag ENGINE_GOLDENROD_DEPT_STORE_SALE_IS_ON
- iftrue UnknownScript_0x56722
+ iftrue .ChangeBlock
return
-UnknownScript_0x56722:
+.ChangeBlock:
changeblock $0, $2, $3f
changeblock $0, $4, $f
return
-UnknownScript_0x5672b:
+.CheckSaleChangeClerk:
checkflag ENGINE_GOLDENROD_DEPT_STORE_SALE_IS_ON
- iftrue UnknownScript_0x56738
- setevent EVENT_6F0
- clearevent EVENT_6F1
+ iftrue .ChangeClerk
+ setevent EVENT_GOLDENROD_SALE_OFF
+ clearevent EVENT_GOLDENROD_SALE_ON
return
-UnknownScript_0x56738:
- clearevent EVENT_6F0
- setevent EVENT_6F1
+.ChangeClerk:
+ clearevent EVENT_GOLDENROD_SALE_OFF
+ setevent EVENT_GOLDENROD_SALE_ON
return
ClerkScript_0x5673f:
@@ -225,11 +225,11 @@
; people-events
db 8
- person_event SPRITE_CLERK, 8, 5, LEFT << 2 | $1, $0, -1, -1, $0, 0, ClerkScript_0x5673f, EVENT_6F0
+ person_event SPRITE_CLERK, 8, 5, LEFT << 2 | $1, $0, -1, -1, $0, 0, ClerkScript_0x5673f, EVENT_GOLDENROD_SALE_OFF
person_event SPRITE_POKEFAN_F, 7, 14, UP << 2 | $1, $1, -1, -1, (PAL_OW_RED << 4) | $80, 0, PokefanFScript_0x56746, -1
person_event SPRITE_FISHER, 5, 6, UP << 2 | $3, $0, -1, -1, (PAL_OW_BLUE << 4) | $80, 0, FisherScript_0x56749, -1
- person_event SPRITE_TWIN, 8, 7, DOWN << 2 | $2, $11, -1, -1, (PAL_OW_GREEN << 4) | $80, 0, TwinScript_0x56754, EVENT_6F1
- person_event SPRITE_SUPER_NERD, 10, 18, LEFT << 2 | $1, $0, -1, -1, (PAL_OW_GREEN << 4) | $80, 0, SuperNerdScript_0x56757, EVENT_6F1
- person_event SPRITE_POKEFAN_M, 4, 11, UP << 2 | $1, $1, -1, -1, $0, 0, PokefanMScript_0x5676a, EVENT_6F0
- person_event SPRITE_TEACHER, 7, 9, DOWN << 2 | $2, $11, -1, -1, (PAL_OW_GREEN << 4) | $80, 0, TeacherScript_0x5676d, EVENT_6F0
- person_event SPRITE_BUG_CATCHER, 10, 5, UP << 2 | $3, $0, -1, -1, (PAL_OW_RED << 4) | $80, 0, BugCatcherScript_0x56770, EVENT_6F0
+ person_event SPRITE_TWIN, 8, 7, DOWN << 2 | $2, $11, -1, -1, (PAL_OW_GREEN << 4) | $80, 0, TwinScript_0x56754, EVENT_GOLDENROD_SALE_ON
+ person_event SPRITE_SUPER_NERD, 10, 18, LEFT << 2 | $1, $0, -1, -1, (PAL_OW_GREEN << 4) | $80, 0, SuperNerdScript_0x56757, EVENT_GOLDENROD_SALE_ON
+ person_event SPRITE_POKEFAN_M, 4, 11, UP << 2 | $1, $1, -1, -1, $0, 0, PokefanMScript_0x5676a, EVENT_GOLDENROD_SALE_OFF
+ person_event SPRITE_TEACHER, 7, 9, DOWN << 2 | $2, $11, -1, -1, (PAL_OW_GREEN << 4) | $80, 0, TeacherScript_0x5676d, EVENT_GOLDENROD_SALE_OFF
+ person_event SPRITE_BUG_CATCHER, 10, 5, UP << 2 | $3, $0, -1, -1, (PAL_OW_RED << 4) | $80, 0, BugCatcherScript_0x56770, EVENT_GOLDENROD_SALE_OFF
--- a/maps/HallOfFame.asm
+++ b/maps/HallOfFame.asm
@@ -40,9 +40,9 @@
domaptrigger GROUP_SPROUT_TOWER_3F, MAP_SPROUT_TOWER_3F, $1
special HealParty
checkevent EVENT_GOT_SS_TICKET_FROM_ELM
- iftrue HallOfFame_SkipPhoneCall
- specialphonecall $5
-HallOfFame_SkipPhoneCall:
+ iftrue .SkipPhoneCall
+ specialphonecall ELMCALL_SSTICKET
+.SkipPhoneCall:
halloffame
end
--- a/maps/KrissHouse1F.asm
+++ b/maps/KrissHouse1F.asm
@@ -16,13 +16,13 @@
end
UnknownScript_0x7a4d8:
- setevent EVENT_CHRIS1_IN_CABLE_CLUB
+ setevent EVENT_000
UnknownScript_0x7a4db:
playmusic MUSIC_MOM
showemote EMOTE_SHOCK, $2, 15
spriteface $0, LEFT
- checkevent EVENT_CHRIS1_IN_CABLE_CLUB
+ checkevent EVENT_000
iffalse UnknownScript_0x7a4f2
applymovement $2, MovementData_0x7a5fc
jump UnknownScript_0x7a4f6
@@ -77,9 +77,9 @@
writetext UnknownText_0x7a850
closetext
loadmovesprites
- checkevent EVENT_CHRIS1_IN_CABLE_CLUB
+ checkevent EVENT_000
iftrue UnknownScript_0x7a55d
- checkevent EVENT_CHRIS2_IN_CABLE_CLUB
+ checkevent EVENT_001
iffalse UnknownScript_0x7a564
jump UnknownScript_0x7a56b
@@ -109,7 +109,7 @@
MomScript_0x7a582:
faceplayer
- setevent EVENT_CHRIS2_IN_CABLE_CLUB
+ setevent EVENT_001
checktriggers
iffalse UnknownScript_0x7a572
loadfont
--- a/maps/KurtsHouse.asm
+++ b/maps/KurtsHouse.asm
@@ -70,7 +70,7 @@
iffalse UnknownScript_0x18e2b2
setevent EVENT_035
UnknownScript_0x18e1cc:
- checkevent EVENT_CHRIS1_IN_CABLE_CLUB
+ checkevent EVENT_000
iftrue UnknownScript_0x18e29f
checkevent EVENT_258
iftrue UnknownScript_0x18e2b4
@@ -89,7 +89,7 @@
checkevent EVENT_CAN_GIVE_GS_BALL_TO_KURT
iftrue UnknownScript_0x18e34e
UnknownScript_0x18e202:
- checkevent EVENT_CHRIS2_IN_CABLE_CLUB
+ checkevent EVENT_001
iftrue UnknownScript_0x18e212
checkevent EVENT_002
iftrue UnknownScript_0x18e212
@@ -110,7 +110,7 @@
iftrue UnknownScript_0x18e249
checkitem PNK_APRICORN
iftrue UnknownScript_0x18e249
- checkevent EVENT_CHRIS2_IN_CABLE_CLUB
+ checkevent EVENT_001
iftrue UnknownScript_0x18e2ae
checkevent EVENT_002
iftrue UnknownScript_0x18e243
@@ -163,7 +163,7 @@
jump UnknownScript_0x18e299
UnknownScript_0x18e299:
- setevent EVENT_CHRIS1_IN_CABLE_CLUB
+ setevent EVENT_000
setflag ENGINE_KURT_MAKING_BALLS
UnknownScript_0x18e29f:
writetext UnknownText_0x18e779
@@ -178,7 +178,7 @@
end
UnknownScript_0x18e2ab:
- setevent EVENT_CHRIS2_IN_CABLE_CLUB
+ setevent EVENT_001
UnknownScript_0x18e2ae:
writetext UnknownText_0x18e82a
closetext
@@ -349,9 +349,9 @@
KurtsGranddaughter1:
faceplayer
- checkevent EVENT_CHRIS1_IN_CABLE_CLUB
+ checkevent EVENT_000
iftrue KurtsGranddaughter2Subscript
- checkevent EVENT_CHRIS2_IN_CABLE_CLUB
+ checkevent EVENT_001
iftrue KurtsGranddaughterFunScript
checkevent EVENT_FOREST_IS_RESTLESS
iftrue .Lonely
--- a/maps/MrPokemonsHouse.asm
+++ b/maps/MrPokemonsHouse.asm
@@ -126,7 +126,7 @@
dotrigger $1
domaptrigger GROUP_CHERRYGROVE_CITY, MAP_CHERRYGROVE_CITY, $1
domaptrigger GROUP_ELMS_LAB, MAP_ELMS_LAB, $3
- specialphonecall $2
+ specialphonecall ELMCALL_ROBBED
clearevent EVENT_COP_IN_ELMS_LAB
checkevent EVENT_GOT_TOTODILE_FROM_ELM
iftrue UnknownScript_0x196f49
--- a/maps/OlivinePort.asm
+++ b/maps/OlivinePort.asm
@@ -20,7 +20,7 @@
applymovement $0, MovementData_0x74a32
appear $2
dotrigger $0
- setevent EVENT_CHRIS1_IN_CABLE_CLUB
+ setevent EVENT_000
blackoutmod GROUP_OLIVINE_CITY, MAP_OLIVINE_CITY
end
@@ -27,7 +27,7 @@
SailorScript_0x748c0:
faceplayer
loadfont
- checkevent EVENT_CHRIS1_IN_CABLE_CLUB
+ checkevent EVENT_000
iftrue UnknownScript_0x74919
writetext UnknownText_0x74a55
closetext
@@ -69,9 +69,9 @@
UnknownScript_0x7491f:
spriteface $4, RIGHT
- checkevent EVENT_CHRIS1_IN_CABLE_CLUB
+ checkevent EVENT_000
iftrue UnknownScript_0x7498b
- checkevent EVENT_CHRIS2_IN_CABLE_CLUB
+ checkevent EVENT_001
iftrue UnknownScript_0x7498b
spriteface $0, LEFT
loadfont
@@ -94,7 +94,7 @@
writetext UnknownText_0x74b11
closetext
loadmovesprites
- setevent EVENT_CHRIS2_IN_CABLE_CLUB
+ setevent EVENT_001
applymovement $0, MovementData_0x74a37
jump SailorScript_0x748c0
@@ -138,7 +138,7 @@
SailorScript_0x7499c:
faceplayer
loadfont
- checkevent EVENT_CHRIS1_IN_CABLE_CLUB
+ checkevent EVENT_000
iftrue UnknownScript_0x74919
checkevent EVENT_030
iffalse UnknownScript_0x749c0
@@ -159,7 +159,7 @@
writetext UnknownText_0x74b11
closetext
loadmovesprites
- setevent EVENT_CHRIS2_IN_CABLE_CLUB
+ setevent EVENT_001
checkcode VAR_FACING
if_equal $3, UnknownScript_0x749e5
applymovement $0, MovementData_0x74a3f
--- a/maps/PokeCenter2F.asm
+++ b/maps/PokeCenter2F.asm
@@ -17,7 +17,7 @@
special Special_CheckMysteryGift
if_equal $0, .Trigger1Done
clearevent EVENT_MYSTERY_GIFT_DELIVERY_GUY
- checkevent EVENT_CHRIS2_IN_CABLE_CLUB
+ checkevent EVENT_001
iftrue .Trigger1Done
priorityjump PokeCenter2F_AppearMysteryGiftDeliveryGuy
@@ -46,7 +46,7 @@
PokeCenter2F_AppearMysteryGiftDeliveryGuy:
appear $5
- setevent EVENT_CHRIS2_IN_CABLE_CLUB
+ setevent EVENT_001
end
Script_TradeCenterClosed:
--- a/maps/Route31.asm
+++ b/maps/Route31.asm
@@ -15,7 +15,7 @@
return
UnknownScript_0x1a5443:
- specialphonecall $7
+ specialphonecall MOMCALL_WORRIED
return
TrainerBug_catcherWade1:
--- a/maps/Route36NationalParkgate.asm
+++ b/maps/Route36NationalParkgate.asm
@@ -300,7 +300,7 @@
YoungsterScript_0x6ad06:
faceplayer
loadfont
- checkevent EVENT_CHRIS1_IN_CABLE_CLUB
+ checkevent EVENT_000
iffalse UnknownScript_0x6ad14
writetext UnknownText_0x6b399
closetext
@@ -316,7 +316,7 @@
YoungsterScript_0x6ad1a:
faceplayer
loadfont
- checkevent EVENT_CHRIS1_IN_CABLE_CLUB
+ checkevent EVENT_000
iffalse UnknownScript_0x6ad28
writetext UnknownText_0x6b40f
closetext
@@ -332,7 +332,7 @@
RockerScript_0x6ad2e:
faceplayer
loadfont
- checkevent EVENT_CHRIS1_IN_CABLE_CLUB
+ checkevent EVENT_000
iffalse UnknownScript_0x6ad3c
writetext UnknownText_0x6b462
closetext
@@ -348,7 +348,7 @@
PokefanMScript_0x6ad42:
faceplayer
loadfont
- checkevent EVENT_CHRIS1_IN_CABLE_CLUB
+ checkevent EVENT_000
iffalse UnknownScript_0x6ad50
writetext UnknownText_0x6b4da
closetext
@@ -364,7 +364,7 @@
YoungsterScript_0x6ad56:
faceplayer
loadfont
- checkevent EVENT_CHRIS1_IN_CABLE_CLUB
+ checkevent EVENT_000
iffalse UnknownScript_0x6ad64
writetext UnknownText_0x6b54e
closetext
@@ -380,7 +380,7 @@
YoungsterScript_0x6ad6a:
faceplayer
loadfont
- checkevent EVENT_CHRIS1_IN_CABLE_CLUB
+ checkevent EVENT_000
iffalse UnknownScript_0x6ad78
writetext UnknownText_0x6b5b0
closetext
@@ -396,7 +396,7 @@
LassScript_0x6ad7e:
faceplayer
loadfont
- checkevent EVENT_CHRIS1_IN_CABLE_CLUB
+ checkevent EVENT_000
iffalse UnknownScript_0x6ad8c
writetext UnknownText_0x6b64b
closetext
@@ -412,7 +412,7 @@
YoungsterScript_0x6ad92:
faceplayer
loadfont
- checkevent EVENT_CHRIS1_IN_CABLE_CLUB
+ checkevent EVENT_000
iffalse UnknownScript_0x6ada0
writetext UnknownText_0x6b6b8
closetext
@@ -428,7 +428,7 @@
YoungsterScript_0x6ada6:
faceplayer
loadfont
- checkevent EVENT_CHRIS1_IN_CABLE_CLUB
+ checkevent EVENT_000
iffalse UnknownScript_0x6adb4
writetext UnknownText_0x6b71b
closetext
@@ -444,7 +444,7 @@
YoungsterScript_0x6adba:
faceplayer
loadfont
- checkevent EVENT_CHRIS1_IN_CABLE_CLUB
+ checkevent EVENT_000
iffalse UnknownScript_0x6adc8
writetext UnknownText_0x6b76f
closetext
--- a/maps/TimeCapsule.asm
+++ b/maps/TimeCapsule.asm
@@ -73,5 +73,5 @@
; people-events
db 2
- person_event SPRITE_CHRIS, 8, 7, LEFT << 2 | $1, $0, -1, -1, $0, 0, ChrisScript_0x19351a, EVENT_CHRIS1_IN_CABLE_CLUB
- person_event SPRITE_CHRIS, 8, 10, LEFT << 2 | $0, $0, -1, -1, $0, 0, ChrisScript_0x19351a, EVENT_CHRIS2_IN_CABLE_CLUB
+ person_event SPRITE_CHRIS, 8, 7, LEFT << 2 | $1, $0, -1, -1, $0, 0, ChrisScript_0x19351a, EVENT_000
+ person_event SPRITE_CHRIS, 8, 10, LEFT << 2 | $0, $0, -1, -1, $0, 0, ChrisScript_0x19351a, EVENT_001
--- a/maps/TradeCenter.asm
+++ b/maps/TradeCenter.asm
@@ -73,5 +73,5 @@
; people-events
db 2
- person_event SPRITE_CHRIS, 8, 7, LEFT << 2 | $1, $0, -1, -1, $0, 0, ChrisScript_0x193499, EVENT_CHRIS1_IN_CABLE_CLUB
- person_event SPRITE_CHRIS, 8, 10, LEFT << 2 | $0, $0, -1, -1, $0, 0, ChrisScript_0x193499, EVENT_CHRIS2_IN_CABLE_CLUB
+ person_event SPRITE_CHRIS, 8, 7, LEFT << 2 | $1, $0, -1, -1, $0, 0, ChrisScript_0x193499, EVENT_000
+ person_event SPRITE_CHRIS, 8, 10, LEFT << 2 | $0, $0, -1, -1, $0, 0, ChrisScript_0x193499, EVENT_001
--- a/maps/VermilionPort.asm
+++ b/maps/VermilionPort.asm
@@ -32,7 +32,7 @@
setevent EVENT_739
clearevent EVENT_733
setevent EVENT_030
- setevent EVENT_CHRIS1_IN_CABLE_CLUB
+ setevent EVENT_000
blackoutmod GROUP_VERMILION_CITY, MAP_VERMILION_CITY
end
@@ -39,7 +39,7 @@
SailorScript_0x74dc4:
faceplayer
loadfont
- checkevent EVENT_CHRIS1_IN_CABLE_CLUB
+ checkevent EVENT_000
iftrue UnknownScript_0x74e1a
writetext UnknownText_0x74f06
closetext
@@ -79,9 +79,9 @@
UnknownScript_0x74e20:
spriteface $3, RIGHT
- checkevent EVENT_CHRIS1_IN_CABLE_CLUB
+ checkevent EVENT_000
iftrue UnknownScript_0x74e86
- checkevent EVENT_CHRIS2_IN_CABLE_CLUB
+ checkevent EVENT_001
iftrue UnknownScript_0x74e86
spriteface $0, LEFT
loadfont
@@ -101,7 +101,7 @@
writetext UnknownText_0x74fc2
closetext
loadmovesprites
- setevent EVENT_CHRIS2_IN_CABLE_CLUB
+ setevent EVENT_001
applymovement $0, MovementData_0x74ef8
jump SailorScript_0x74dc4
@@ -145,7 +145,7 @@
SailorScript_0x74e97:
faceplayer
loadfont
- checkevent EVENT_CHRIS1_IN_CABLE_CLUB
+ checkevent EVENT_000
iftrue UnknownScript_0x74e1a
checkcode VAR_WEEKDAY
if_equal MONDAY, UnknownScript_0x74eda
@@ -163,7 +163,7 @@
writetext UnknownText_0x74fc2
closetext
loadmovesprites
- setevent EVENT_CHRIS2_IN_CABLE_CLUB
+ setevent EVENT_001
applymovement $0, MovementData_0x74efe
jump SailorScript_0x74dc4
--- a/maps/VioletGym.asm
+++ b/maps/VioletGym.asm
@@ -27,15 +27,15 @@
scall VioletGymTriggerRockets
.FightDone
checkevent EVENT_GOT_TM31_MUD_SLAP
- iftrue UnknownScript_0x68412
+ iftrue .SpeechAfterTM
setevent EVENT_BEAT_BIRD_KEEPER_ROD
setevent EVENT_BEAT_BIRD_KEEPER_ABE
domaptrigger GROUP_ELMS_LAB, MAP_ELMS_LAB, $2
- specialphonecall $3
+ specialphonecall ELMCALL_ASSISTANT
writetext UnknownText_0x685c8
keeptextopen
verbosegiveitem TM_MUD_SLAP, 1
- iffalse UnknownScript_0x68416
+ iffalse .NoRoomForMudSlap
setevent EVENT_GOT_TM31_MUD_SLAP
writetext UnknownText_0x68648
closetext
@@ -42,10 +42,10 @@
loadmovesprites
end
-UnknownScript_0x68412:
+.SpeechAfterTM:
writetext UnknownText_0x68735
closetext
-UnknownScript_0x68416:
+.NoRoomForMudSlap:
loadmovesprites
end
--- a/maps/WarehouseEntrance.asm
+++ b/maps/WarehouseEntrance.asm
@@ -265,20 +265,20 @@
jump UnknownScript_0x7c1c1
UnknownScript_0x7c1a9:
- setevent EVENT_CHRIS1_IN_CABLE_CLUB
- clearevent EVENT_CHRIS2_IN_CABLE_CLUB
+ setevent EVENT_000
+ clearevent EVENT_001
clearevent EVENT_002
jump UnknownScript_0x7c1cd
UnknownScript_0x7c1b5:
- clearevent EVENT_CHRIS1_IN_CABLE_CLUB
- setevent EVENT_CHRIS2_IN_CABLE_CLUB
+ clearevent EVENT_000
+ setevent EVENT_001
clearevent EVENT_002
jump UnknownScript_0x7c1cd
UnknownScript_0x7c1c1:
- clearevent EVENT_CHRIS1_IN_CABLE_CLUB
- clearevent EVENT_CHRIS2_IN_CABLE_CLUB
+ clearevent EVENT_000
+ clearevent EVENT_001
setevent EVENT_002
jump UnknownScript_0x7c1cd
@@ -296,9 +296,9 @@
loadfont
writetext UnknownText_0x7c6d8
closetext
- checkevent EVENT_CHRIS1_IN_CABLE_CLUB
+ checkevent EVENT_000
iftrue UnknownScript_0x7c2bb
- checkevent EVENT_CHRIS2_IN_CABLE_CLUB
+ checkevent EVENT_001
iftrue UnknownScript_0x7c2c4
jump UnknownScript_0x7c2cd
@@ -348,20 +348,20 @@
jump UnknownScript_0x7c26e
UnknownScript_0x7c256:
- setevent EVENT_CHRIS1_IN_CABLE_CLUB
- clearevent EVENT_CHRIS2_IN_CABLE_CLUB
+ setevent EVENT_000
+ clearevent EVENT_001
clearevent EVENT_002
jump UnknownScript_0x7c27a
UnknownScript_0x7c262:
- clearevent EVENT_CHRIS1_IN_CABLE_CLUB
- setevent EVENT_CHRIS2_IN_CABLE_CLUB
+ clearevent EVENT_000
+ setevent EVENT_001
clearevent EVENT_002
jump UnknownScript_0x7c27a
UnknownScript_0x7c26e:
- clearevent EVENT_CHRIS1_IN_CABLE_CLUB
- clearevent EVENT_CHRIS2_IN_CABLE_CLUB
+ clearevent EVENT_000
+ clearevent EVENT_001
setevent EVENT_002
jump UnknownScript_0x7c27a
@@ -379,9 +379,9 @@
loadfont
writetext UnknownText_0x7c82a
closetext
- checkevent EVENT_CHRIS1_IN_CABLE_CLUB
+ checkevent EVENT_000
iftrue UnknownScript_0x7c2bb
- checkevent EVENT_CHRIS2_IN_CABLE_CLUB
+ checkevent EVENT_001
iftrue UnknownScript_0x7c2c4
jump UnknownScript_0x7c2cd
--- a/text/common_4.asm
+++ b/text/common_4.asm
@@ -542,7 +542,7 @@
text_from_ram StringBuffer2
text "(S)"
line "will be ¥@"
- deciram $ffc3, $36
+ deciram hMoneyTemp, $36
text "."
done
; 0x1c4c28
@@ -574,7 +574,7 @@
text_from_ram StringBuffer2
text "(S)"
line "will be ¥@"
- deciram $ffc3, $36
+ deciram hMoneyTemp, $36
text "."
done
; 0x1c4cce
@@ -619,7 +619,7 @@
text_from_ram StringBuffer2
text " costs"
line "¥@"
- deciram $ffc3, $36
+ deciram hMoneyTemp, $36
text ". Want it?"
done
; 0x1c4dcd
@@ -671,7 +671,7 @@
text_from_ram StringBuffer2
text "(S)"
line "will cost ¥@"
- deciram $ffc3, $36
+ deciram hMoneyTemp, $36
text "."
done
; 0x1c4eab
@@ -713,7 +713,7 @@
UnknownText_0x1c4f3e: ; 0x1c4f3e
text "I can pay you"
line "¥@"
- deciram $ffc3, $36
+ deciram hMoneyTemp, $36
text "."
para "Is that OK?"
@@ -763,7 +763,7 @@
UnknownText_0x1c502e: ; 0x1c502e
text "Got ¥@"
- deciram $ffc3, $36
+ deciram hMoneyTemp, $36
text " for"
line "@"
text_from_ram StringBuffer2
--- a/wram.asm
+++ b/wram.asm
@@ -1381,6 +1381,7 @@
ds 1
wd03f::
CurFruit:: ; d03f
+MartPointerBank::
ds 1
wd040::
@@ -2346,7 +2347,8 @@
ds 5
wdc2d:: ds 4
-wdc31:: ds 4
+wSpecialPhoneCallID:: ds 2
+wdc33:: ds 2
wdc35:: ds 4
wdc39:: ds 1
wdc3a:: ds 1