ref: 2cb3f8e1b9e494f01ef2bcb65a0baf463d0efff8
parent: 93f406e8b4b16529a73ed42196b70ca9a7eeef7d
author: yenatch <[email protected]>
date: Wed May 21 12:21:46 EDT 2014
Comment music functions in home.asm.
--- a/constants/misc_constants.asm
+++ b/constants/misc_constants.asm
@@ -2,6 +2,7 @@
; name length
PLAYER_NAME_LENGTH EQU 8
PKMN_NAME_LENGTH EQU 11
+NAME_LENGTH EQU 11
; boxes
NUM_BOXES EQU 14
--- a/engine/scripting.asm
+++ b/engine/scripting.asm
@@ -461,11 +461,11 @@
; script command 0x4e
call YesNoBox
- ld a, $0
+ ld a, 0
jr c, .asm_96ef6 ; 0x96ef2 $2
- ld a, $1
+ ld a, 1
.asm_96ef6
- ld [$c2dd], a
+ ld [ScriptVar], a
ret
; 0x96efa
@@ -500,10 +500,10 @@
call GetScriptByte
and a
- jr nz, .asm_96f1f ; 0x96f1a $3
- ld a, [$c2dd]
-.asm_96f1f
- ld [$d108], a
+ jr nz, .ok
+ ld a, [ScriptVar]
+.ok
+ ld [CurPartySpecies], a
callba Function244e3
ret
; 0x96f29
@@ -522,10 +522,10 @@
ld hl, Function1d81
rst FarCall
ld a, [$cfa9]
- jr nc, .asm_96f3d ; 0x96f3a $1
+ jr nc, .ok
xor a
-.asm_96f3d
- ld [$c2dd], a
+.ok
+ ld [ScriptVar], a
ret
; 0x96f41
@@ -536,10 +536,10 @@
ld hl, Function202a
rst FarCall
ld a, [$cf88]
- jr nc, .asm_96f4e ; 0x96f4b $1
+ jr nc, .ok
xor a
-.asm_96f4e
- ld [$c2dd], a
+.ok
+ ld [ScriptVar], a
ret
; 0x96f52
@@ -607,21 +607,21 @@
call GetScriptByte
cp $ff
- jr nz, .asm_96f98 ; 0x96f93 $3
- ld a, [$c2dd]
-.asm_96f98
- ld [$d106], a
+ jr nz, .ok
+ ld a, [ScriptVar]
+.ok
+ ld [CurItem], a
call GetScriptByte
- call Unknown_0x9769e
+ call Function9769e
ld a, [de]
ld [$d10c], a
- ld hl, $d892
+ ld hl, NumItems
call ReceiveItem
ld a, $1
- jr c, .asm_96fb0 ; 0x96fad $1
+ jr c, .ok2
xor a
-.asm_96fb0
- ld [$c2dd], a
+.ok2
+ ld [ScriptVar], a
call CurItemName
ld de, StringBuffer1
ld a, $1
@@ -745,7 +745,7 @@
; floor_list_pointer (PointerLabelParam)
xor a
- ld [$c2dd], a
+ ld [ScriptVar], a
call GetScriptByte
ld e, a
call GetScriptByte
@@ -755,7 +755,7 @@
callba Function1342d
ret c
ld a, $1
- ld [$c2dd], a
+ ld [ScriptVar], a
ret
; 0x97099
@@ -812,7 +812,7 @@
call GetScriptByte
ld a, $2
.asm_970db
- ld [$c2dd], a
+ ld [ScriptVar], a
ret
; 0x970df
@@ -895,7 +895,7 @@
; action (SingleByteParam)
xor a
- ld [$c2dd], a
+ ld [ScriptVar], a
ld hl, $d041
ld e, [hl]
inc hl
@@ -907,7 +907,7 @@
and a
ret z
ld a, $1
- ld [$c2dd], a
+ ld [ScriptVar], a
ret
; 0x9714c
@@ -943,12 +943,12 @@
; script command 0x67
ld a, $1
- ld [$c2dd], a
+ ld [ScriptVar], a
ld a, [$d04d]
and a
ret nz
xor a
- ld [$c2dd], a
+ ld [ScriptVar], a
ret
; 0x9717a
@@ -964,7 +964,7 @@
Script_playmapmusic: ; 0x97185
; script command 0x82
- call Function3cdf
+ call PlayMapMusic
ret
; 0x97189
@@ -973,7 +973,7 @@
; parameters:
; music_pointer (MultiByteParam)
- ld de, $0000
+ ld de, MUSIC_NONE
call PlayMusic
xor a
ld [$c2a7], a
@@ -993,9 +993,9 @@
; fadetime (SingleByteParam)
call GetScriptByte
- ld [$c2a9], a
+ ld [MusicFadeID], a
call GetScriptByte
- ld [$c2aa], a
+ ld [MusicFadeID + 1], a
call GetScriptByte
and $7f
ld [$c2a7], a
@@ -1041,13 +1041,13 @@
pop af
and a
jr nz, .asm_971df ; 0x971da $3
- ld a, [$c2dd]
+ ld a, [ScriptVar]
.asm_971df
call Function37ce
ret
; 0x971e3
-Unknown_0x971e3: ; 0x971e3
+Function971e3: ; 0x971e3
and a
ret z
cp $fe
@@ -1062,7 +1062,7 @@
; person (SingleByteParam)
call GetScriptByte
- call Unknown_0x971e3
+ call Function971e3
ld [$ffe0], a
ret
; 0x971f3
@@ -1074,7 +1074,7 @@
; data (MovementPointerLabelParam)
call GetScriptByte
- call Unknown_0x971e3
+ call Function971e3
ld c, a
; 971fa
@@ -1084,7 +1084,7 @@
callba Function585c
pop bc
push bc
- call Unknown_0x97221
+ call Function97221
pop bc
call GetScriptByte
ld l, a
@@ -1100,7 +1100,7 @@
ret
; 0x97221
-Unknown_0x97221: ; 0x97221
+Function97221: ; 0x97221
callba Function5897
ret
; 0x97228
@@ -1131,7 +1131,7 @@
ld e, a
ld a, [$ffe0]
ld d, a
- call Unknown_0x9728b
+ call Function9728b
ret
; 0x97248
@@ -1142,7 +1142,7 @@
; person2 (SingleByteParam)
call GetScriptByte
- call Unknown_0x971e3
+ call Function971e3
cp $fe
jr c, .asm_97254 ; 0x97250 $2
ld a, [$ffe0]
@@ -1149,7 +1149,7 @@
.asm_97254
ld e, a
call GetScriptByte
- call Unknown_0x971e3
+ call Function971e3
cp $fe
jr nz, .asm_97261 ; 0x9725d $2
ld a, [$ffe0]
@@ -1164,7 +1164,7 @@
add a
ld e, a
ld d, c
- call Unknown_0x9728b
+ call Function9728b
ret
; 0x97274
@@ -1175,7 +1175,7 @@
; facing (SingleByteParam)
call GetScriptByte
- call Unknown_0x971e3
+ call Function971e3
cp $fe
jr nz, .asm_97280 ; 0x9727c $2
ld a, [$ffe0]
@@ -1185,11 +1185,11 @@
add a
add a
ld e, a
- call Unknown_0x9728b
+ call Function9728b
ret
; 0x9728b
-Unknown_0x9728b: ; 0x9728b
+Function9728b: ; 0x9728b
ld a, d
push de
call Function18de
@@ -1211,7 +1211,7 @@
ld hl, $d0ed
bit 6, [hl]
jr nz, .asm_972b5 ; 0x972b0 $3
- call Unknown_0x972bc
+ call Function972bc
.asm_972b5
call Function1ad2
ret
@@ -1221,7 +1221,7 @@
ret
; 0x972bc
-Unknown_0x972bc: ; 0x972bc
+Function972bc: ; 0x972bc
call Function217a
ld hl, TileMap
ld bc, $0168
@@ -1257,11 +1257,11 @@
; person (SingleByteParam)
call GetScriptByte
- call Unknown_0x971e3
+ call Function971e3
call Function1956
ld a, [$ffaf]
ld b, $0
- call Unknown_0x9730b
+ call Function9730b
ret
; 0x972ee
@@ -1271,7 +1271,7 @@
; person (SingleByteParam)
call GetScriptByte
- call Unknown_0x971e3
+ call Function971e3
cp $fe
jr nz, .asm_972fa ; 0x972f6 $2
ld a, [$ffe0]
@@ -1279,12 +1279,12 @@
call Function199f
ld a, [$ffaf]
ld b, $1
- call Unknown_0x9730b
+ call Function9730b
callba Function5920
ret
; 0x9730b
-Unknown_0x9730b: ; 0x9730b
+Function9730b: ; 0x9730b
push bc
call GetMapObject
ld hl, $000c
@@ -1312,10 +1312,10 @@
; person1 (SingleByteParam)
call GetScriptByte
- call Unknown_0x971e3
+ call Function971e3
ld b, a
call GetScriptByte
- call Unknown_0x971e3
+ call Function971e3
ld c, a
callba Function5803
ret
@@ -1336,7 +1336,7 @@
; y (SingleByteParam)
call GetScriptByte
- call Unknown_0x971e3
+ call Function971e3
ld b, a
call GetScriptByte
add $4
@@ -1354,7 +1354,7 @@
; person (SingleByteParam)
call GetScriptByte
- call Unknown_0x971e3
+ call Function971e3
cp $fe
jr nz, .asm_97367 ; 0x97363 $2
ld a, [$ffe0]
@@ -1371,10 +1371,10 @@
; person1 (SingleByteParam)
call GetScriptByte
- call Unknown_0x971e3
+ call Function971e3
ld b, a
call GetScriptByte
- call Unknown_0x971e3
+ call Function971e3
ld c, a
callba Function839e
ret
@@ -1388,7 +1388,7 @@
call GetScriptByte
cp $ff
jr nz, .asm_9738e ; 0x97389 $3
- ld a, [$c2dd]
+ ld a, [ScriptVar]
.asm_9738e
ld c, a
callba Function1442f
@@ -1403,9 +1403,9 @@
; time (DecimalParam)
call GetScriptByte
- ld [$c2dd], a
+ ld [ScriptVar], a
call GetScriptByte
- call Unknown_0x971e3
+ call Function971e3
cp $fe
jr z, .asm_973a8 ; 0x973a4 $2
ld [$ffe0], a
@@ -1473,7 +1473,7 @@
ld a, $19
ld [$d22e], a
ld a, $5
- ld [$d143], a
+ ld [CurPartyLevel], a
ret
; 0x973fb
@@ -1508,7 +1508,7 @@
call GetScriptByte
ld [$d22e], a
call GetScriptByte
- ld [$d143], a
+ ld [CurPartyLevel], a
ret
; 0x97424
@@ -1535,7 +1535,7 @@
call Predef
ld a, [$d0ee]
and $3f
- ld [$c2dd], a
+ ld [ScriptVar], a
ret
; 0x97447
@@ -1663,7 +1663,7 @@
ret
; 0x974f3
-Unknown_0x974f3:: ; 0x974f3
+Function974f3:: ; 0x974f3
ld a, [ScriptBank]
or $80
ld [ScriptBank], a
@@ -1720,7 +1720,7 @@
; parameters:
; pointer (ScriptPointerLabelParam)
- ld a, [$c2dd]
+ ld a, [ScriptVar]
and a
jp nz, SkipTwoScriptBytes
jp Script_2jump
@@ -1731,7 +1731,7 @@
; parameters:
; pointer (ScriptPointerLabelParam)
- ld a, [$c2dd]
+ ld a, [ScriptVar]
and a
jp nz, Script_2jump
jp SkipTwoScriptBytes
@@ -1744,7 +1744,7 @@
; pointer (ScriptPointerLabelParam)
call GetScriptByte
- ld hl, $c2dd
+ ld hl, ScriptVar
cp [hl]
jr z, Script_2jump ; 0x97547 $b5
jr SkipTwoScriptBytes ; 0x97549 $4b
@@ -1757,7 +1757,7 @@
; pointer (ScriptPointerLabelParam)
call GetScriptByte
- ld hl, $c2dd
+ ld hl, ScriptVar
cp [hl]
jr nz, Script_2jump ; 0x97552 $aa
jr SkipTwoScriptBytes ; 0x97554 $40
@@ -1769,7 +1769,7 @@
; byte (SingleByteParam)
; pointer (ScriptPointerLabelParam)
- ld a, [$c2dd]
+ ld a, [ScriptVar]
ld b, a
call GetScriptByte
cp b
@@ -1785,7 +1785,7 @@
call GetScriptByte
ld b, a
- ld a, [$c2dd]
+ ld a, [ScriptVar]
cp b
jr c, Script_2jump ; 0x9756a $92
jr SkipTwoScriptBytes ; 0x9756c $28
@@ -1866,11 +1866,11 @@
call Function211b
jr z, .asm_975cb ; 0x975c5 $4
- ld [$c2dd], a
+ ld [ScriptVar], a
ret
.asm_975cb
ld a, $ff
- ld [$c2dd], a
+ ld [ScriptVar], a
ret
; 0x975d1
@@ -1889,11 +1889,11 @@
or e
jr z, .asm_975e5 ; 0x975de $5
ld a, [de]
- ld [$c2dd], a
+ ld [ScriptVar], a
ret
.asm_975e5
ld a, $ff
- ld [$c2dd], a
+ ld [ScriptVar], a
ret
; 0x975eb
@@ -1943,7 +1943,7 @@
call GetScriptByte
ld h, a
ld a, [hl]
- ld [$c2dd], a
+ ld [ScriptVar], a
ret
; 0x97616
@@ -1956,7 +1956,7 @@
ld l, a
call GetScriptByte
ld h, a
- ld a, [$c2dd]
+ ld a, [ScriptVar]
ld [hl], a
ret
; 0x97623
@@ -1982,7 +1982,7 @@
; value (SingleByteParam)
call GetScriptByte
- ld [$c2dd], a
+ ld [ScriptVar], a
ret
; 0x97637
@@ -1992,7 +1992,7 @@
; value (SingleByteParam)
call GetScriptByte
- ld hl, $c2dd
+ ld hl, ScriptVar
add [hl]
ld [hl], a
ret
@@ -2004,11 +2004,11 @@
; input (SingleByteParam)
call GetScriptByte
- ld [$c2dd], a
+ ld [ScriptVar], a
and a
ret z
ld c, a
- call Unknown_0x97673
+ call Function97673
and a
jr z, .asm_9765f ; 0x9764d $10
ld b, a
@@ -2030,15 +2030,15 @@
ld a, [$ffe1]
.asm_97666
push af
- ld a, [$c2dd]
+ ld a, [ScriptVar]
ld c, a
pop af
call SimpleDivide
- ld [$c2dd], a
+ ld [ScriptVar], a
ret
; 0x97673
-Unknown_0x97673: ; 0x97673
+Function97673: ; 0x97673
xor a
ld b, a
sub c
@@ -2057,9 +2057,9 @@
; variable_id (SingleByteParam)
call GetScriptByte
- call Unknown_0x9769e
+ call Function9769e
ld a, [de]
- ld [$c2dd], a
+ ld [ScriptVar], a
ret
; 0x97688
@@ -2069,8 +2069,8 @@
; variable_id (SingleByteParam)
call GetScriptByte
- call Unknown_0x9769e
- ld a, [$c2dd]
+ call Function9769e
+ ld a, [ScriptVar]
ld [de], a
ret
; 0x97693
@@ -2082,13 +2082,13 @@
; value (SingleByteParam)
call GetScriptByte
- call Unknown_0x9769e
+ call Function9769e
call GetScriptByte
ld [de], a
ret
; 0x9769e
-Unknown_0x9769e: ; 0x9769e
+Function9769e: ; 0x9769e
ld c, a
callba Function80648
ret
@@ -2098,7 +2098,7 @@
; script command 0x18
ld a, [Version]
- ld [$c2dd], a
+ ld [ScriptVar], a
ret
; 0x976ad
@@ -2115,7 +2115,7 @@
call GetScriptByte
and a
jr nz, .asm_976b7 ; 0x976b2 $3
- ld a, [$c2dd]
+ ld a, [ScriptVar]
.asm_976b7
ld [$d265], a
call GetPokemonName
@@ -2146,7 +2146,7 @@
call GetScriptByte
and a
jr nz, .asm_976de ; 0x976d9 $3
- ld a, [$c2dd]
+ ld a, [ScriptVar]
.asm_976de
ld [$d265], a
call GetItemName
@@ -2228,8 +2228,8 @@
; account (SingleByteParam)
; memory (SingleByteParam)
- call Unknown_0x97771
- call Unknown_0x97861
+ call Function97771
+ call Function97861
ld hl, StringBuffer1
ld bc, $4306
call PrintNum
@@ -2242,7 +2242,7 @@
; parameters:
; memory (SingleByteParam)
- call Unknown_0x97771
+ call Function97771
ld hl, StringBuffer1
ld de, Coins
ld bc, $4206
@@ -2256,8 +2256,8 @@
; parameters:
; memory (SingleByteParam)
- call Unknown_0x97771
- ld de, $c2dd
+ call Function97771
+ ld de, ScriptVar
ld hl, StringBuffer1
ld bc, $4103
call PrintNum
@@ -2265,7 +2265,7 @@
jp Unknown_976c0
; 0x97771
-Unknown_0x97771: ; 0x97771
+Function97771: ; 0x97771
ld hl, StringBuffer1
ld bc, $000b
ld a, "@"
@@ -2337,20 +2337,20 @@
call GetScriptByte
cp $ff
jr nz, .asm_977d4 ; 0x977cf $3
- ld a, [$c2dd]
+ ld a, [ScriptVar]
.asm_977d4
- ld [$d106], a
+ ld [CurItem], a
call GetScriptByte
ld [$d10c], a
- ld hl, $d892
+ ld hl, NumItems
call ReceiveItem
jr nc, .asm_977eb ; 0x977e3 $6
ld a, $1
- ld [$c2dd], a
+ ld [ScriptVar], a
ret
.asm_977eb
xor a
- ld [$c2dd], a
+ ld [ScriptVar], a
ret
; 0x977f0
@@ -2361,18 +2361,18 @@
; quantity (DecimalParam)
xor a
- ld [$c2dd], a
+ ld [ScriptVar], a
call GetScriptByte
- ld [$d106], a
+ ld [CurItem], a
call GetScriptByte
ld [$d10c], a
ld a, $ff
ld [$d107], a
- ld hl, $d892
+ ld hl, NumItems
call TossItem
ret nc
ld a, $1
- ld [$c2dd], a
+ ld [ScriptVar], a
ret
; 0x97812
@@ -2382,14 +2382,14 @@
; item (ItemLabelByte)
xor a
- ld [$c2dd], a
+ ld [ScriptVar], a
call GetScriptByte
- ld [$d106], a
- ld hl, $d892
+ ld [CurItem], a
+ ld hl, NumItems
call CheckItem
ret nc
- ld a, $1
- ld [$c2dd], a
+ ld a, 1
+ ld [ScriptVar], a
ret
; 0x97829
@@ -2399,8 +2399,8 @@
; account (SingleByteParam)
; money (MoneyByteParam)
- call Unknown_0x97861
- call Unknown_0x9786d
+ call Function97861
+ call Function9786d
callba Function15fd7
ret
; 0x97836
@@ -2411,8 +2411,8 @@
; account (SingleByteParam)
; money (MoneyByteParam)
- call Unknown_0x97861
- call Unknown_0x9786d
+ call Function97861
+ call Function9786d
callba Function15ffa
ret
; 0x97843
@@ -2423,27 +2423,27 @@
; account (SingleByteParam)
; money (MoneyByteParam)
- call Unknown_0x97861
- call Unknown_0x9786d
+ call Function97861
+ call Function9786d
callba Function1600b
; 0x9784f
Unknown_9784f: ; 0x9784f
- jr c, .asm_9785b ; 0x9784f $a
- jr z, .asm_97857 ; 0x97851 $4
- ld a, $0
- jr .asm_9785d ; 0x97855 $6
-.asm_97857
- ld a, $1
- jr .asm_9785d ; 0x97859 $2
-.asm_9785b
- ld a, $2
-.asm_9785d
- ld [$c2dd], a
+ jr c, .two
+ jr z, .one
+ ld a, 0
+ jr .done
+.one
+ ld a, 1
+ jr .done
+.two
+ ld a, 2
+.done
+ ld [ScriptVar], a
ret
; 0x97861
-Unknown_0x97861: ; 0x97861
+Function97861: ; 0x97861
call GetScriptByte
and a
ld de, $d84e
@@ -2452,7 +2452,7 @@
ret
; 0x9786d
-Unknown_0x9786d: ; 0x9786d
+Function9786d: ; 0x9786d
ld bc, $ffc3
push bc
call GetScriptByte
@@ -2512,13 +2512,13 @@
; time (SingleByteParam)
xor a
- ld [$c2dd], a
+ ld [ScriptVar], a
callba Functionc000
call GetScriptByte
and c
ret z
ld a, $1
- ld [$c2dd], a
+ ld [ScriptVar], a
ret
; 0x978c3
@@ -2528,14 +2528,14 @@
; pkmn (PokemonParam)
xor a
- ld [$c2dd], a
+ ld [ScriptVar], a
call GetScriptByte
- ld hl, $dcd8
- ld de, $0001
+ ld hl, PartySpecies
+ ld de, 1
call IsInArray
ret nc
- ld a, $1
- ld [$c2dd], a
+ ld a, 1
+ ld [ScriptVar], a
ret
; 0x978da
@@ -2545,13 +2545,13 @@
; person (SingleByteParam)
xor a
- ld [$c2dd], a
+ ld [ScriptVar], a
call GetScriptByte
ld c, a
callba Function90000
ret nc
ld a, $1
- ld [$c2dd], a
+ ld [ScriptVar], a
ret
; 0x978ef
@@ -2561,13 +2561,13 @@
; person (SingleByteParam)
xor a
- ld [$c2dd], a
+ ld [ScriptVar], a
call GetScriptByte
ld c, a
callba Function9000f
ret nc
ld a, $1
- ld [$c2dd], a
+ ld [ScriptVar], a
ret
; 0x97904
@@ -2577,13 +2577,13 @@
; person (SingleByteParam)
xor a
- ld [$c2dd], a
+ ld [ScriptVar], a
call GetScriptByte
ld c, a
callba Function90019
ret nc
ld a, $1
- ld [$c2dd], a
+ ld [ScriptVar], a
ret
; 0x97919
@@ -2604,10 +2604,10 @@
ld a, [$dc31]
and a
- jr z, .asm_9792e ; 0x9792a $2
- ld a, $1
-.asm_9792e
- ld [$c2dd], a
+ jr z, .ok
+ ld a, 1
+.ok
+ ld [ScriptVar], a
ret
; 0x97932
@@ -2622,15 +2622,15 @@
; pkmn_nickname (MultiByteParam)
call GetScriptByte
- ld [$d108], a
+ ld [CurPartySpecies], a
call GetScriptByte
- ld [$d143], a
+ ld [CurPartyLevel], a
call GetScriptByte
- ld [$d106], a
+ ld [CurItem], a
call GetScriptByte
and a
ld b, a
- jr z, .asm_9795d ; 0x97949 $12
+ jr z, .ok
ld hl, ScriptPos
ld e, [hl]
inc hl
@@ -2639,10 +2639,10 @@
call GetScriptByte
call GetScriptByte
call GetScriptByte
-.asm_9795d
+.ok
callba Functione277
ld a, b
- ld [$c2dd], a
+ ld [ScriptVar], a
ret
; 0x97968
@@ -2653,16 +2653,16 @@
; level (DecimalParam)
xor a
- ld [$c2dd], a
+ ld [ScriptVar], a
ld [$cf5f], a
call GetScriptByte
- ld [$d108], a
+ ld [CurPartySpecies], a
call GetScriptByte
- ld [$d143], a
+ ld [CurPartyLevel], a
callba Functiondf8c
ret nc
ld a, $2
- ld [$c2dd], a
+ ld [ScriptVar], a
ret
; 0x97988
@@ -2710,7 +2710,7 @@
jr z, .asm_979b7 ; 0x979b3 $2
ld a, $1
.asm_979b7
- ld [$c2dd], a
+ ld [ScriptVar], a
ret
; 0x979bb
@@ -2724,7 +2724,7 @@
call GetScriptByte
ld d, a
ld b, $1
- call Unknown_0x979ee
+ call Function979ee
ret
; 0x979c9
@@ -2738,7 +2738,7 @@
call GetScriptByte
ld d, a
ld b, $0
- call Unknown_0x979ee
+ call Function979ee
ret
; 0x979d7
@@ -2752,17 +2752,17 @@
call GetScriptByte
ld d, a
ld b, $2
- call Unknown_0x979ee
+ call Function979ee
ld a, c
and a
jr z, .asm_979ea ; 0x979e6 $2
ld a, $1
.asm_979ea
- ld [$c2dd], a
+ ld [ScriptVar], a
ret
; 0x979ee
-Unknown_0x979ee: ; 0x979ee
+Function979ee: ; 0x979ee
callba EngineFlagAction
ret
; 0x979f5
@@ -2911,13 +2911,13 @@
; byte (SingleByteParam)
xor a
- ld [$c2dd], a
+ ld [ScriptVar], a
call GetScriptByte
ld b, a
callba Function97e5c
ret c
ld a, $1
- ld [$c2dd], a
+ ld [ScriptVar], a
ret
; 0x97ab3
@@ -2978,7 +2978,7 @@
ret
; 0x97b01
-Unknown_0x97b01: ; 0x97b01
+Function97b01: ; 0x97b01
callba Function966d0
ret
; 0x97b08
@@ -3227,7 +3227,7 @@
callba Function4cffe
ld a, c
- ld [$c2dd], a
+ ld [ScriptVar], a
ret
; 0x97c20
--- a/home.asm
+++ b/home.asm
@@ -57,6 +57,7 @@
Function2e4e:: ; 2e4e
+; Unreferenced.
scf
ret
; 2e50
@@ -70,11 +71,10 @@
bit 1, a
ret z
ld a, [hJoyDown]
- bit A_BUTTON, a
+ bit 1, a ; B_BUTTON
ret
; 2ec6
-
Function2ec6:: ; 2ec6
xor a
ret
@@ -219,7 +219,7 @@
ld [rSVBK], a
ld hl, TileMap
ld de, $d000
- ld bc, 360
+ ld bc, TileMapEnd - TileMap
call CopyBytes
pop af
ld [rSVBK], a
@@ -242,7 +242,7 @@
ld [rSVBK], a
ld hl, $d000
ld de, TileMap
- ld bc, 360
+ ld bc, TileMapEnd - TileMap
call CopyBytes
pop af
ld [rSVBK], a
@@ -289,8 +289,8 @@
; 30f4
SkipNames:: ; 0x30f4
-; skips n names where n = a
- ld bc, $000b ; name length
+; Skip a names.
+ ld bc, NAME_LENGTH
and a
ret z
.loop
@@ -301,7 +301,7 @@
; 0x30fe
AddNTimes:: ; 0x30fe
-; adds bc n times where n = a
+; Add bc * a to hl.
and a
ret z
.loop
@@ -400,7 +400,7 @@
CopyDataUntil:: ; 318c
-; Copy [hl .. bc) to [de .. de + bc - hl).
+; Copy [hl .. bc) to de.
; In other words, the source data is
; from hl up to but not including bc,
@@ -550,13 +550,14 @@
Function3200:: ; 0x3200
ld a, [hCGB]
and a
- jr z, .asm_320e
+ jr z, .bg0
+
ld a, 2
ld [hBGMapMode], a
ld c, 4
call DelayFrames
-.asm_320e
+.bg0
ld a, 1
ld [hBGMapMode], a
ld c, 4
@@ -575,17 +576,17 @@
Function321c:: ; 321c
ld a, [hCGB]
and a
- jr z, .asm_322e
+ jr z, .dmg
ld a, [$c2ce]
cp 0
- jr z, .asm_322e
+ jr z, .dmg
ld a, 1
ld [hBGMapMode], a
jr Function323d
-.asm_322e
+.dmg
ld a, 1
ld [hBGMapMode], a
ld c, 4
@@ -616,10 +617,11 @@
push af
xor a
ld [$ffde], a
-.asm_3252
+.wait
ld a, [rLY]
cp $7f
- jr c, .asm_3252 ; 3256 $fa
+ jr c, .wait
+
di
ld a, $1
ld [rVBK], a
@@ -629,11 +631,12 @@
ld [rVBK], a
ld hl, TileMap
call Function327b
-.asm_326d
+.wait2
ld a, [rLY]
cp $7f
- jr c, .asm_326d ; 3271 $fa
+ jr c, .wait2
ei
+
pop af
ld [$ffde], a
pop af
@@ -651,10 +654,10 @@
ld [$ffd3], a
ld b, $2
ld c, $41
-.asm_328c
- pop de
-rept 9
+.loop
+rept 10
+ pop de
.loop\@
ld a, [$ff00+c]
and b
@@ -663,27 +666,18 @@
inc l
ld [hl], d
inc l
- pop de
endr
-.asm_32de
- ld a, [$ff00+c]
- and b
- jr nz, .asm_32de
- ld [hl], e
- inc l
- ld [hl], d
- inc l
-
ld de, $000c
add hl, de
ld a, [$ffd3]
dec a
ld [$ffd3], a
- jr nz, .asm_328c
+ jr nz, .loop
+
ld a, [hSPBuffer]
ld l, a
- ld a, [$ffda]
+ ld a, [hSPBuffer + 1]
ld h, a
ld sp, hl
ret
@@ -2464,6 +2458,7 @@
; 3b0c
Function3b0c:: ; 3b0c
+
ld a, [hLCDStatCustom]
and a
ret z
@@ -2486,14 +2481,17 @@
Function3b2a:: ; 3b2a
+
ld [$c3b8], a
ld a, [hROMBank]
push af
+
ld a, BANK(Function8cfd6)
rst Bankswitch
-
ld a, [$c3b8]
+
call Function8cfd6
+
pop af
rst Bankswitch
@@ -2502,14 +2500,17 @@
Function3b3c:: ; 3b3c
+
ld [$c3b8], a
ld a, [hROMBank]
push af
+
ld a, BANK(Function8d120)
rst Bankswitch
-
ld a, [$c3b8]
+
call Function8d120
+
pop af
rst Bankswitch
@@ -2659,7 +2660,7 @@
PlayCryHeader:: ; 3be3
-; Play a cry given parameters in header de
+; Play a cry given parameters at header de
push hl
push de
@@ -2666,16 +2667,14 @@
push bc
push af
-; Save current bank
ld a, [hROMBank]
push af
-; Cry headers are stuck in one bank.
+ ; Cry headers are stuck in one bank.
ld a, BANK(CryHeaders)
ld [hROMBank], a
ld [MBC3RomBank], a
-; Each header is 6 bytes long:
ld hl, CryHeaders
add hl, de
add hl, de
@@ -2696,7 +2695,7 @@
ld a, [hli]
ld [CryLength], a
ld a, [hl]
- ld [CryLength+1], a
+ ld [CryLength + 1], a
ld a, BANK(PlayCry)
ld [hROMBank], a
@@ -2725,13 +2724,14 @@
push bc
push af
-; Is something already playing?
+ ; Is something already playing?
call CheckSFX
jr nc, .play
-; Does it have priority?
+
+ ; Does it have priority?
ld a, [CurSFX]
cp e
- jr c, .quit
+ jr c, .done
.play
ld a, [hROMBank]
@@ -2738,7 +2738,7 @@
push af
ld a, BANK(_PlaySFX)
ld [hROMBank], a
- ld [MBC3RomBank], a ; bankswitch
+ ld [MBC3RomBank], a
ld a, e
ld [CurSFX], a
@@ -2746,8 +2746,9 @@
pop af
ld [hROMBank], a
- ld [MBC3RomBank], a ; bankswitch
-.quit
+ ld [MBC3RomBank], a
+
+.done
pop af
pop bc
pop de
@@ -2768,47 +2769,47 @@
push hl
-.loop
- ; ch5 on?
- ld hl, Channel5 + Channel1Flags - Channel1
+.wait
+ ld hl, Channel5Flags
bit 0, [hl]
- jr nz, .loop
- ; ch6 on?
- ld hl, Channel6 + Channel1Flags - Channel1
+ jr nz, .wait
+ ld hl, Channel6Flags
bit 0, [hl]
- jr nz, .loop
- ; ch7 on?
- ld hl, Channel7 + Channel1Flags - Channel1
+ jr nz, .wait
+ ld hl, Channel7Flags
bit 0, [hl]
- jr nz, .loop
- ; ch8 on?
- ld hl, Channel8 + Channel1Flags - Channel1
+ jr nz, .wait
+ ld hl, Channel8Flags
bit 0, [hl]
- jr nz, .loop
+ jr nz, .wait
pop hl
ret
; 3c74
-Function3c74:: ; 3c74
+IsSFXPlaying:: ; 3c74
+; Return carry if no sound effect is playing.
+; The inverse of CheckSFX.
push hl
- ld hl, $c1cc
+
+ ld hl, Channel5Flags
bit 0, [hl]
- jr nz, .asm_3c94
- ld hl, $c1fe
+ jr nz, .playing
+ ld hl, Channel6Flags
bit 0, [hl]
- jr nz, .asm_3c94
- ld hl, $c230
+ jr nz, .playing
+ ld hl, Channel7Flags
bit 0, [hl]
- jr nz, .asm_3c94
- ld hl, $c262
+ jr nz, .playing
+ ld hl, Channel8Flags
bit 0, [hl]
- jr nz, .asm_3c94
+ jr nz, .playing
+
pop hl
scf
ret
-.asm_3c94
+.playing
pop hl
and a
ret
@@ -2833,36 +2834,38 @@
; 3ca8
Function3ca8:: ; 3ca8
- ld a, $4
+ ld a, 4
ld [MusicFade], a
ret
; 3cae
Function3cae:: ; 3cae
- ld a, $84
+ ld a, 4 | 1 << 7
ld [MusicFade], a
ret
; 3cb4
-Function3cb4:: ; 3cb4
-.asm_3cb4
+SkipMusic:: ; 3cb4
+; Skip a frames of music.
and a
ret z
dec a
call UpdateSound
- jr .asm_3cb4
+ jr SkipMusic
; 3cbc
-Function3cbc:: ; 3cbc
+FadeToMapMusic:: ; 3cbc
push hl
push de
push bc
push af
- call Function3d97
- ld a, [CurMusic]
+
+ call GetMapMusic
+ ld a, [wMapMusic]
cp e
- jr z, .asm_3cda
- ld a, $8
+ jr z, .done
+
+ ld a, 8
ld [MusicFade], a
ld a, e
ld [MusicFadeIDLo], a
@@ -2869,9 +2872,9 @@
ld a, d
ld [MusicFadeIDHi], a
ld a, e
- ld [CurMusic], a
+ ld [wMapMusic], a
-.asm_3cda
+.done
pop af
pop bc
pop de
@@ -2879,15 +2882,17 @@
ret
; 3cdf
-Function3cdf:: ; 3cdf
+PlayMapMusic:: ; 3cdf
push hl
push de
push bc
push af
- call Function3d97
- ld a, [CurMusic]
+
+ call GetMapMusic
+ ld a, [wMapMusic]
cp e
- jr z, .asm_3cfe
+ jr z, .done
+
push de
ld de, MUSIC_NONE
call PlayMusic
@@ -2894,10 +2899,10 @@
call DelayFrame
pop de
ld a, e
- ld [CurMusic], a
+ ld [wMapMusic], a
call PlayMusic
-.asm_3cfe
+.done
pop af
pop bc
pop de
@@ -2905,27 +2910,30 @@
ret
; 3d03
-Function3d03:: ; 3d03
+EnterMapMusic:: ; 3d03
push hl
push de
push bc
push af
+
xor a
ld [$c2c1], a
ld de, MUSIC_BICYCLE
ld a, [PlayerState]
- cp $1
- jr z, .asm_3d18
- call Function3d97
-.asm_3d18
+ cp PLAYER_BIKE
+ jr z, .play
+ call GetMapMusic
+.play
push de
ld de, MUSIC_NONE
call PlayMusic
call DelayFrame
pop de
+
ld a, e
- ld [CurMusic], a
+ ld [wMapMusic], a
call PlayMusic
+
pop af
pop bc
pop de
@@ -2936,9 +2944,9 @@
Function3d2f:: ; 3d2f
ld a, [$c2c1]
and a
- jr z, Function3d47
+ jr z, RestartMapMusic
xor a
- ld [CurMusic], a
+ ld [wMapMusic], a
ld de, MUSIC_NONE
call PlayMusic
call DelayFrame
@@ -2947,7 +2955,7 @@
ret
; 3d47
-Function3d47:: ; 3d47
+RestartMapMusic:: ; 3d47
push hl
push de
push bc
@@ -2955,7 +2963,7 @@
ld de, MUSIC_NONE
call PlayMusic
call DelayFrame
- ld a, [CurMusic]
+ ld a, [wMapMusic]
ld e, a
ld d, 0
call PlayMusic
@@ -2966,52 +2974,58 @@
ret
; 3d62
-Function3d62:: ; 3d62
+SpecialMapMusic:: ; 3d62
ld a, [PlayerState]
- cp $4
- jr z, .asm_3d7b
- cp $8
- jr z, .asm_3d7b
+ cp PLAYER_SURF
+ jr z, .surf
+ cp PLAYER_SURF_PIKA
+ jr z, .surf
+
ld a, [StatusFlags2]
bit 2, a
- jr nz, .asm_3d80
-.asm_3d74
+ jr nz, .contest
+
+.no
and a
ret
- ld de, $0013
+.bike
+ ld de, MUSIC_BICYCLE
scf
ret
-.asm_3d7b
- ld de, $0021
+.surf
+ ld de, MUSIC_SURF
scf
ret
-.asm_3d80
+.contest
ld a, [MapGroup]
- cp $a
- jr nz, .asm_3d74
+ cp GROUP_ROUTE_35_NATIONAL_PARK_GATE
+ jr nz, .no
ld a, [MapNumber]
- cp $f
- jr z, .asm_3d92
- cp $11
- jr nz, .asm_3d74
+ cp MAP_ROUTE_35_NATIONAL_PARK_GATE
+ jr z, .ranking
+ cp MAP_ROUTE_36_NATIONAL_PARK_GATE
+ jr nz, .no
-.asm_3d92
- ld de, $0058
+.ranking
+ ld de, MUSIC_BUG_CATCHING_CONTEST_RANKING
scf
ret
; 3d97
-Function3d97:: ; 3d97
- call Function3d62
+GetMapMusic:: ; 3d97
+ call SpecialMapMusic
ret c
- call Function2cbd
+ call GetMapHeaderMusic
ret
; 3d9f
Function3d9f:: ; 3d9f
+; Places a BCD number at the
+; upper center of the screen.
+; Unreferenced.
ld a, $20
ld [$c498], a
ld [$c49c], a
@@ -3024,22 +3038,22 @@
ld [$c49f], a
ld a, [$c296]
cp $64
- jr nc, .asm_3dd5
- add $1
+ jr nc, .max
+ add 1
daa
ld b, a
swap a
and $f
- add $f6
+ add "0"
ld [$c49a], a
ld a, b
and $f
- add $f6
+ add "0"
ld [$c49e], a
ret
-.asm_3dd5
- ld a, $ff
+.max
+ ld a, "9"
ld [$c49a], a
ld [$c49e], a
ret
@@ -3046,22 +3060,22 @@
; 3dde
CheckSFX:: ; 3dde
-; returns carry if sfx channels are active
- ld a, [$c1cc] ; 1
+; Return carry if any SFX channels are active.
+ ld a, [Channel5Flags]
bit 0, a
- jr nz, .quit
- ld a, [$c1fe] ; 2
+ jr nz, .playing
+ ld a, [Channel6Flags]
bit 0, a
- jr nz, .quit
- ld a, [$c230] ; 3
+ jr nz, .playing
+ ld a, [Channel7Flags]
bit 0, a
- jr nz, .quit
- ld a, [$c262] ; 4
+ jr nz, .playing
+ ld a, [Channel8Flags]
bit 0, a
- jr nz, .quit
+ jr nz, .playing
and a
ret
-.quit
+.playing
scf
ret
; 3dfe
@@ -3083,9 +3097,9 @@
; Quickly turn off music channels
xor a
ld [Channel1Flags], a
- ld [$c136], a
- ld [$c168], a
- ld [$c19a], a
+ ld [Channel2Flags], a
+ ld [Channel3Flags], a
+ ld [Channel4Flags], a
ld [SoundInput], a
ret
; 3e21
@@ -3093,15 +3107,17 @@
SFXChannelsOff:: ; 3e21
; Quickly turn off sound effect channels
xor a
- ld [$c1cc], a
- ld [$c1fe], a
- ld [$c230], a
- ld [$c262], a
+ ld [Channel5Flags], a
+ ld [Channel6Flags], a
+ ld [Channel7Flags], a
+ ld [Channel8Flags], a
ld [SoundInput], a
ret
; 3e32
+
Function3e32:: ; 3e32
+; Mobile
cp $2
ld [$c988], a
ld a, l
@@ -3109,6 +3125,7 @@
ld a, h
ld [$c987], a
jr nz, .asm_3e4f
+
ld [$c982], a
ld a, l
ld [$c981], a
@@ -3130,7 +3147,6 @@
jp Function110030
; 3e60
-
Function3e60:: ; 3e60
ld [$c986], a
ld a, l
@@ -3137,6 +3153,7 @@
ld [$c987], a
ld a, h
ld [$c988], a
+
pop bc
ld a, b
ld [$c981], a
@@ -3151,7 +3168,6 @@
ld a, [$c986]
ret
; 3e80
-
Function3e80:: ; 3e80
ld a, [hROMBank]
--- a/home/init.asm
+++ b/home/init.asm
@@ -172,7 +172,7 @@
call SoundRestart
xor a
- ld [CurMusic], a
+ ld [wMapMusic], a
jp GameInit
; 245
--- a/home/map.asm
+++ b/home/map.asm
@@ -1034,7 +1034,7 @@
; 2674
Function2674:: ; 2674
- callba Unknown_0x974f3
+ callba Function974f3
ld a, [ScriptMode]
push af
ld hl, ScriptFlags
@@ -2021,8 +2021,8 @@
callba Function8c001
call Function2173
call Function2821
- ld a, $9
- call Function3cb4
+ ld a, 9
+ call SkipMusic
pop af
rst Bankswitch
@@ -2259,48 +2259,51 @@
ret
; 0x2cbd
-Function2cbd:: ; 2cbd
+GetMapHeaderMusic:: ; 2cbd
+RADIO_TOWER_MUSIC EQU 7
+
push hl
push bc
- ld de, $0006
+ ld de, 6 ; music
call GetMapHeaderMember
ld a, c
- cp $64
- jr z, .asm_2cee
- bit 7, c
- jr nz, .asm_2cda
+ cp MUSIC_MAHOGANY_MART
+ jr z, .mahoganymart
+ bit RADIO_TOWER_MUSIC, c
+ jr nz, .radiotower
callba Function8b342
ld e, c
- ld d, $0
-.asm_2cd7
+ ld d, 0
+.done
pop bc
pop hl
ret
-.asm_2cda
+.radiotower
ld a, [StatusFlags2]
bit 0, a
- jr z, .asm_2ce6
- ld de, $0056
- jr .asm_2cd7
+ jr z, .clearedradiotower
+ ld de, MUSIC_ROCKET_OVERTURE
+ jr .done
-.asm_2ce6
+.clearedradiotower
+ ; the rest of the byte
ld a, c
- and $7f
+ and 1 << RADIO_TOWER_MUSIC - 1
ld e, a
- ld d, $0
- jr .asm_2cd7
+ ld d, 0
+ jr .done
-.asm_2cee
+.mahoganymart
ld a, [StatusFlags2]
bit 7, a
- jr z, .asm_2cfa
- ld de, $0048
- jr .asm_2cd7
+ jr z, .clearedmahogany
+ ld de, MUSIC_ROCKET_HIDEOUT
+ jr .done
-.asm_2cfa
- ld de, $0026
- jr .asm_2cd7
+.clearedmahogany
+ ld de, MUSIC_CHERRYGROVE_CITY
+ jr .done
; 2cff
Function2cff:: ; 2cff
--- a/main.asm
+++ b/main.asm
@@ -3747,7 +3747,7 @@
call DelayFrame
ld de, MUSIC_MAIN_MENU
ld a, e
- ld [CurMusic], a
+ ld [wMapMusic], a
call PlayMusic
callba MainMenu
jp Function6219
@@ -7940,8 +7940,8 @@
dbw BANK(Functionc230), Functionc230
dbw BANK(SpecialSeenMon), SpecialSeenMon
dbw BANK(WaitSFX),WaitSFX
- dbw BANK(Function3cdf), Function3cdf
- dbw BANK(Function3d47), Function3d47
+ dbw BANK(PlayMapMusic), PlayMapMusic
+ dbw BANK(RestartMapMusic), RestartMapMusic
dbw BANK(Function12324), Function12324
dbw BANK(Function8379), Function8379
dbw BANK(Functionc25a), Functionc25a
@@ -8402,7 +8402,7 @@
; ScriptVar is 1 if the conditions are met, otherwise 0.
; check background music
- ld a, [CurMusic]
+ ld a, [wMapMusic]
cp MUSIC_POKE_FLUTE_CHANNEL
jr nz, .nope
@@ -10774,7 +10774,7 @@
call MaxVolume
ld de, MUSIC_BICYCLE
ld a, e
- ld [CurMusic], a
+ ld [wMapMusic], a
call PlayMusic
ld a, $1
ret
@@ -23072,6 +23072,8 @@
LoadSpriteGFX: ; 14306
+; Bug: b is not preserved, so
+; it's useless as a loop count.
ld hl, UsedSprites
ld b, $20
@@ -25882,11 +25884,11 @@
dbw BANK(EnableLCD), EnableLCD
dbw BANK(DisableLCD), DisableLCD
dbw BANK(SoundRestart), SoundRestart
- dbw BANK(Function3cdf), Function3cdf
- dbw BANK(Function3d47), Function3d47
- dbw BANK(Function3cbc), Function3cbc
+ dbw BANK(PlayMapMusic), PlayMapMusic
+ dbw BANK(RestartMapMusic), RestartMapMusic
+ dbw BANK(FadeToMapMusic), FadeToMapMusic
dbw BANK(Function15574), Function15574
- dbw BANK(Function3d03), Function3d03
+ dbw BANK(EnterMapMusic), EnterMapMusic
dbw BANK(Function15587), Function15587
dbw BANK(Function3cae), Function3cae
dbw BANK(Function24cd), Function24cd
@@ -26045,8 +26047,8 @@
; 15567
Function15567: ; 15567
- ld a, $6
- call Function3cb4
+ ld a, 6
+ call SkipMusic
ret
; 1556d
@@ -29488,12 +29490,12 @@
ld de, UnownDexATile
ld hl, $8ef0
- ld bc, $0501
+ lb bc, BANK(UnownDexBTile), 1
call Request1bpp
ld de, UnownDexBTile
ld hl, $8f50
- ld bc, $0501
+ lb bc, BANK(UnownDexBTile), 1
call Request1bpp
ld hl, TileMap
@@ -29554,7 +29556,7 @@
ld a, [$cf63]
push af
callba Function84560
- call Function3d47
+ call RestartMapMusic
pop af
ld [$cf63], a
jr .asm_16c6b
@@ -29969,7 +29971,7 @@
call Function1d6e
call Function16f70
call Function2b4d
- call Function3d47
+ call RestartMapMusic
jp Function2dcf
; 16f70
@@ -40609,7 +40611,7 @@
Function2a124:: ; 2a124
; Pokemon March and Ruins of Alph signal double encounter rate.
; Pokemon Lullaby halves encounter rate.
- ld a, [CurMusic]
+ ld a, [wMapMusic]
cp MUSIC_POKEMON_MARCH
jr z, .asm_2a135
cp MUSIC_RUINS_OF_ALPH_RADIO
@@ -47388,8 +47390,8 @@
ld hl, PokedexSlowpokeLZ
ld de, VTiles0
call Decompress
- ld a, $6
- call Function3cb4
+ ld a, 6
+ call SkipMusic
call EnableLCD
ret
@@ -47893,7 +47895,7 @@
ret nz
ld a, [$d268]
and a
- call nz, Function3d47
+ call nz, RestartMapMusic
ret
; 42414
@@ -52964,7 +52966,7 @@
MainMenu_Mobile: ; 49efc
call WhiteBGMap
ld a, MUSIC_MOBILE_ADAPTER_MENU
- ld [CurMusic], a
+ ld [wMapMusic], a
ld de, MUSIC_MOBILE_ADAPTER_MENU
call Function4a6c5
Function49f0a: ; 49f0a
@@ -53031,7 +53033,7 @@
call WhiteBGMap
call ClearTileMap
ld a, MUSIC_MAIN_MENU
- ld [CurMusic], a
+ ld [wMapMusic], a
ld de, MUSIC_MAIN_MENU
call Function4a6c5
ret
@@ -57194,7 +57196,7 @@
; no known jump sources
Function4dde6: ; 4dde6 (13:5de6)
- call Function3c74
+ call IsSFXPlaying
ret nc
ld a, [$cf63]
inc a
@@ -62432,7 +62434,7 @@
call CheckLandPermissions
jr c, .asm_801be
- call Function80341
+ call IsNPCInFront
and a
jr z, .asm_801be
cp 2
@@ -62493,7 +62495,7 @@
ld [$d040], a
jr c, .asm_801f1
- call Function80341
+ call IsNPCInFront
ld [$d03f], a
and a
jr z, .asm_801f1
@@ -62511,7 +62513,7 @@
.ExitWater
call WaterToLandSprite
- call Function3cdf ; PlayMapMusic
+ call PlayMapMusic
ld a, STEP_WALK
call DoStep
ld a, 6
@@ -62773,7 +62775,7 @@
; 80341
-Function80341: ; 80341
+IsNPCInFront: ; 80341
ld a, 0
ld [hConnectionStripLength], a
@@ -65883,7 +65885,7 @@
; 84753
Function84753: ; 84753
- call Function3d47
+ call RestartMapMusic
ret
; 84757
@@ -69841,7 +69843,7 @@
call Function89240
ld c, $18
call DelayFrames
- call Function3d47
+ call RestartMapMusic
ret
; 89d4e (22:5d4e)
@@ -81610,8 +81612,8 @@
call Function90c4e
callba Function8cf53
call Function90d32
- ld a, $8
- call Function3cb4
+ ld a, 8
+ call SkipMusic
ld a, $e3
ld [rLCDC], a
call Function90d70
@@ -82923,13 +82925,13 @@
cp $fe
jr z, .asm_914a3
cp $ff
- call z, Function3d03
+ call z, EnterMapMusic
xor a
ld [$c6dc], a
ret
.asm_914a3
- call Function3d47
+ call RestartMapMusic
xor a
ld [$c6dc], a
ret
@@ -83359,7 +83361,7 @@
call PlayMusic
pop de
ld a, e
- ld [CurMusic], a ; $c2c0
+ ld [wMapMusic], a
call PlayMusic
ret
@@ -83446,8 +83448,8 @@
call DisableLCD
call Function90c4e
callba Function8cf53
- ld a, $8
- call Function3cb4
+ ld a, 8
+ call SkipMusic
ld a, $e3
ld [rLCDC], a
call Function90d56
@@ -96955,8 +96957,8 @@
ld hl, PCSelectLZ
ld de, $8000
call Decompress
- ld a, $6
- call Function3cb4
+ ld a, 6
+ call SkipMusic
call EnableLCD
ret
; e3419 (38:7419)
@@ -97617,7 +97619,7 @@
.SetMono
res 5, [hl]
- call Function3d47 ;reload the music
+ call RestartMapMusic
.ToggleMono
ld de, .Mono
@@ -97625,7 +97627,7 @@
.SetStereo
set 5, [hl]
- call Function3d47 ;reload the music
+ call RestartMapMusic
.ToggleStereo
ld de, .Stereo
@@ -101561,7 +101563,7 @@
ld hl, TradedForText
call PrintText
- call Function3d47
+ call RestartMapMusic
ld a, TRADE_COMPLETE
@@ -112685,7 +112687,7 @@
.asm_11b872
call Function2b3c
- call Function3d47
+ call RestartMapMusic
ret
; 11b879
@@ -117747,7 +117749,7 @@
ld [rSVBK], a
ld de, MUSIC_MOBILE_CENTER
ld a, e
- ld [CurMusic], a
+ ld [wMapMusic], a
ld [MusicFadeIDLo], a
ld a, d
ld [MusicFadeIDHi], a
@@ -119158,7 +119160,7 @@
ret z
ld a, $8
ld [MusicFade], a
- ld a, [CurMusic]
+ ld a, [wMapMusic]
ld [MusicFadeIDLo], a
xor a
ld [MusicFadeIDHi], a
--- a/misc/crystal_misc.asm
+++ b/misc/crystal_misc.asm
@@ -257,7 +257,7 @@
; no known jump sources
Function17a81a: ; 17a81a (5e:681a)
- call Function3c74
+ call IsSFXPlaying
ret nc
ld a, [hJoyPressed] ; $ff00+$a7
and $3
--- a/wram.asm
+++ b/wram.asm
@@ -365,8 +365,7 @@
CurSFX:: ; c2bf
; id of sfx currently playing
ds 1
-CurMusic:: ; c2c0
-; id of music currently playing
+wMapMusic:: ; c2c0
ds 1
SECTION "auto",WRAM0[$c2c7]