ref: edf42a54d5b95780725e50605672fec29a9936f1
parent: 7176eff7aafda5378305a593c459d158ac27601f
author: PikalaxALT <[email protected]>
date: Wed Oct 7 09:19:41 EDT 2015
More labels, including fns responsible for partymon generation
--- a/battle/ai/items.asm
+++ b/battle/ai/items.asm
@@ -787,17 +787,17 @@
; 3851e
Function3851e: ; 3851e
- ld [hMultiplier], a
+ ld [hDivisor], a
ld hl, EnemyMonMaxHP
ld a, [hli]
- ld [hProduct], a
+ ld [hDividend], a
ld a, [hl]
- ld [hMultiplicand], a
+ ld [hDividend + 1], a
ld b, $2
call Divide
- ld a, [$ffb6]
+ ld a, [hQuotient + 2]
ld c, a
- ld a, [$ffb5]
+ ld a, [hQuotient + 1]
ld b, a
ld hl, EnemyMonHP + 1
ld a, [hld]
--- a/battle/anim_commands.asm
+++ b/battle/anim_commands.asm
@@ -240,7 +240,7 @@
ld a, $80
ld [hBGMapAddress], a
ld a, $9a
- ld [$ffd7], a
+ ld [hBGMapAddress + 1], a
call Function3200
ld a, $60
ld [hWY], a
@@ -247,7 +247,7 @@
xor a
ld [hBGMapAddress], a
ld a, $98
- ld [$ffd7], a
+ ld [hBGMapAddress + 1], a
call BattleAnimDelayFrame
ret
; cc23d
--- a/battle/anim_objects.asm
+++ b/battle/anim_objects.asm
@@ -1696,9 +1696,9 @@
ld a, $42
ld [hLCDStatCustom], a ; $ff00+$c6
ld a, $58
- ld [$ffc7], a
+ ld [hLCDStatCustom + 1], a
ld a, $5e
- ld [$ffc8], a
+ ld [hLCDStatCustom + 2], a
ret
Functioncd687: ; cd687 (33:5687)
@@ -1712,7 +1712,7 @@
jr nc, .asm_cd69b
call Functionce72c
xor a
- ld [$ffc7], a
+ ld [hLCDStatCustom + 1], a
ret
.asm_cd69b
dec a
@@ -1730,7 +1730,7 @@
add [hl]
sub $10
ret c
- ld [$ffc7], a
+ ld [hLCDStatCustom + 1], a
ld hl, $9
add hl, bc
ld a, [hl]
@@ -1754,8 +1754,8 @@
jr c, asm_cd6da
xor a
ld [hLCDStatCustom], a ; $ff00+$c6
- ld [$ffc7], a
- ld [$ffc8], a
+ ld [hLCDStatCustom + 1], a
+ ld [hLCDStatCustom + 2], a
Functioncd6d6: ; cd6d6 (33:56d6)
call Functioncc9bd
@@ -1767,7 +1767,7 @@
ld [hl], a
sub $10
ret c
- ld [$ffc7], a
+ ld [hLCDStatCustom + 1], a
ret
Functioncd6e3: ; cd6e3 (33:56e3)
--- a/battle/bg_effects.asm
+++ b/battle/bg_effects.asm
@@ -932,7 +932,7 @@
ld hl, w5_d422
ld bc, $0
.asm_c8580
- ld a, [$ffc7]
+ ld a, [hLCDStatCustom + 1]
cp e
jr nc, .asm_c858b
push hl
@@ -969,9 +969,9 @@
ld a, $42
ld [hLCDStatCustom], a ; $ff00+$c6
xor a
- ld [$ffc7], a
+ ld [hLCDStatCustom + 1], a
ld a, $5e
- ld [$ffc8], a
+ ld [hLCDStatCustom + 2], a
ld de, $202
call Functionc8f2e
ret
@@ -1044,9 +1044,9 @@
ld a, $43
ld [hLCDStatCustom], a ; $ff00+$c6
xor a
- ld [$ffc7], a
+ ld [hLCDStatCustom + 1], a
ld a, $5f
- ld [$ffc8], a
+ ld [hLCDStatCustom + 2], a
ld de, $605
call Functionc8f2e
ld hl, $3
@@ -1140,9 +1140,9 @@
call Functionc8eca
ld a, $43
call Functionc8ede
- ld a, [$ffc8]
+ ld a, [hLCDStatCustom + 2]
inc a
- ld [$ffc8], a
+ ld [hLCDStatCustom + 2], a
ld hl, $2
add hl, bc
ld [hl], $0
@@ -1196,9 +1196,9 @@
inc a
ld d, a
ld h, $d2
- ld a, [$ffc7]
+ ld a, [hLCDStatCustom + 1]
ld l, a
- ld a, [$ffc8]
+ ld a, [hLCDStatCustom + 2]
sub l
srl a
push af
@@ -1238,7 +1238,7 @@
ld d, $2
call Functionc8f2e
ld h, $d2
- ld a, [$ffc8]
+ ld a, [hLCDStatCustom + 2]
ld l, a
ld [hl], $0
dec l
@@ -1246,7 +1246,7 @@
ret
Functionc8732: ; c8732 (32:4732)
- ld a, [$ffc8]
+ ld a, [hLCDStatCustom + 2]
ld l, a
ld h, $d2
ld e, l
@@ -1256,11 +1256,11 @@
ld a, [de]
dec de
ld [hld], a
- ld a, [$ffc7]
+ ld a, [hLCDStatCustom + 1]
cp l
jr nz, .asm_c873a
ld [hl], $90
- ld a, [$ffc8]
+ ld a, [hLCDStatCustom + 2]
ld l, a
ld a, [hl]
cp $1
@@ -1296,9 +1296,9 @@
call Functionc8eca
ld a, $42
call Functionc8ede
- ld a, [$ffc8]
+ ld a, [hLCDStatCustom + 2]
inc a
- ld [$ffc8], a
+ ld [hLCDStatCustom + 2], a
ld hl, $2
add hl, bc
ld [hl], $1
@@ -1347,9 +1347,9 @@
call Functionc8eca
ld a, $42
call Functionc8ede
- ld a, [$ffc8]
+ ld a, [hLCDStatCustom + 2]
inc a
- ld [$ffc8], a
+ ld [hLCDStatCustom + 2], a
ld hl, $2
add hl, bc
ld [hl], $2
@@ -1371,9 +1371,9 @@
call Functionc80e5
Functionc87de: ; c87de (32:47de)
- ld a, [$ffc7]
+ ld a, [hLCDStatCustom + 1]
ld l, a
- ld a, [$ffc8]
+ ld a, [hLCDStatCustom + 2]
sub l
dec a
ld hl, $2
@@ -1416,9 +1416,9 @@
call Functionc8eca
ld a, $43
call Functionc8ede
- ld a, [$ffc8]
+ ld a, [hLCDStatCustom + 2]
inc a
- ld [$ffc8], a
+ ld [hLCDStatCustom + 2], a
ld hl, $3
add hl, bc
ld [hl], $0
@@ -1451,9 +1451,9 @@
call Functionc8eca
ld a, $43
call Functionc8ef4
- ld a, [$ffc8]
+ ld a, [hLCDStatCustom + 2]
inc a
- ld [$ffc8], a
+ ld [hLCDStatCustom + 2], a
ld hl, $3
add hl, bc
ld [hl], $0
@@ -1524,9 +1524,9 @@
pop af
jp Functionc900b
.asm_c88b7
- ld a, [$ffc7]
+ ld a, [hLCDStatCustom + 1]
ld d, a
- ld a, [$ffc8]
+ ld a, [hLCDStatCustom + 2]
sub d
ld d, a
ld h, LYOverridesBackup / $100
@@ -1533,7 +1533,7 @@
ld a, [hSCY] ; $ff00+$d0
or a
jr nz, .asm_c88d0
- ld a, [$ffc7]
+ ld a, [hLCDStatCustom + 1]
or a
jr z, .asm_c88d6
dec a
@@ -1541,7 +1541,7 @@
ld [hl], $0
jr .asm_c88d6
.asm_c88d0
- ld a, [$ffc8]
+ ld a, [hLCDStatCustom + 2]
dec a
ld l, a
ld [hl], $0
@@ -1548,7 +1548,7 @@
.asm_c88d6
ld a, [hSCY] ; $ff00+$d0
ld l, a
- ld a, [$ffc7]
+ ld a, [hLCDStatCustom + 1]
sub l
jr nc, .asm_c88e0
xor a
@@ -1581,9 +1581,9 @@
call Functionc8eca
ld a, $43
call Functionc8ede
- ld a, [$ffc8]
+ ld a, [hLCDStatCustom + 2]
inc a
- ld [$ffc8], a
+ ld [hLCDStatCustom + 2], a
ld hl, $3
add hl, bc
ld [hl], $0
@@ -1628,9 +1628,9 @@
call Functionc8eca
ld a, $43
call Functionc8ede
- ld a, [$ffc8]
+ ld a, [hLCDStatCustom + 2]
inc a
- ld [$ffc8], a
+ ld [hLCDStatCustom + 2], a
ld hl, $3
add hl, bc
ld [hl], $0
@@ -1668,9 +1668,9 @@
call Functionc8eca
ld a, $43
call Functionc8ede
- ld a, [$ffc8]
+ ld a, [hLCDStatCustom + 2]
inc a
- ld [$ffc8], a
+ ld [hLCDStatCustom + 2], a
xor a
ld hl, $2
add hl, bc
@@ -1767,9 +1767,9 @@
call Functionc8eca
ld a, $42
call Functionc8ef4
- ld a, [$ffc8]
+ ld a, [hLCDStatCustom + 2]
inc a
- ld [$ffc8], a
+ ld [hLCDStatCustom + 2], a
ld hl, $2
add hl, bc
ld [hl], $1
@@ -1824,14 +1824,14 @@
call Functionc8ecb
ld a, $47
call Functionc8ede
- ld a, [$ffc8]
+ ld a, [hLCDStatCustom + 2]
inc a
- ld [$ffc8], a
- ld a, [$ffc7]
+ ld [hLCDStatCustom + 2], a
+ ld a, [hLCDStatCustom + 1]
ld l, a
ld h, $d2
.asm_c8a60
- ld a, [$ffc8]
+ ld a, [hLCDStatCustom + 2]
cp l
jr z, .asm_c8a69
xor a
@@ -1854,9 +1854,9 @@
ld hl, $3
add hl, bc
ld [hl], $0
- ld a, [$ffc7]
+ ld a, [hLCDStatCustom + 1]
inc a
- ld [$ffc7], a
+ ld [hLCDStatCustom + 1], a
call Functionc80e5
ret
@@ -1864,7 +1864,7 @@
call Functionc8ab0
jr nc, .asm_c8a96
call Functionc8a9a
- ld a, [$ffc8]
+ ld a, [hLCDStatCustom + 2]
dec a
ld l, a
ld [hl], e
@@ -1875,9 +1875,9 @@
Functionc8a9a: ; c8a9a (32:4a9a)
ld e, a
- ld a, [$ffc7]
+ ld a, [hLCDStatCustom + 1]
ld l, a
- ld a, [$ffc8]
+ ld a, [hLCDStatCustom + 2]
sub l
srl a
ld h, $d2
@@ -1971,9 +1971,9 @@
ld a, $47
ld [hLCDStatCustom], a ; $ff00+$c6
xor a
- ld [$ffc7], a
+ ld [hLCDStatCustom + 1], a
ld a, $60
- ld [$ffc8], a
+ ld [hLCDStatCustom + 2], a
ret
Functionc8b22: ; c8b22 (32:4b22)
@@ -2221,9 +2221,9 @@
call Functionc8eca
ld a, $43
call Functionc8ede
- ld a, [$ffc8]
+ ld a, [hLCDStatCustom + 2]
inc a
- ld [$ffc8], a
+ ld [hLCDStatCustom + 2], a
ld hl, $2
add hl, bc
ld [hl], $1
@@ -2268,9 +2268,9 @@
ld a, $43
ld [hLCDStatCustom], a ; $ff00+$c6
xor a
- ld [$ffc7], a
+ ld [hLCDStatCustom + 1], a
ld a, $37
- ld [$ffc8], a
+ ld [hLCDStatCustom + 2], a
ld hl, $3
add hl, bc
ld [hl], $0
@@ -2431,9 +2431,9 @@
call Functionc8ecb
ld a, $47
call Functionc8ede
- ld a, [$ffc8]
+ ld a, [hLCDStatCustom + 2]
inc a
- ld [$ffc8], a
+ ld [hLCDStatCustom + 2], a
ld hl, $3
add hl, bc
ld a, [hl]
@@ -2669,9 +2669,9 @@
ld de, $2f5e
.asm_c8eed
ld a, d
- ld [$ffc7], a
+ ld [hLCDStatCustom + 1], a
ld a, e
- ld [$ffc8], a
+ ld [hLCDStatCustom + 2], a
ret
Functionc8ef4: ; c8ef4 (32:4ef4)
@@ -2684,15 +2684,15 @@
ld de, $2d5e
.asm_c8f03
ld a, d
- ld [$ffc7], a
+ ld [hLCDStatCustom + 1], a
ld a, e
- ld [$ffc8], a
+ ld [hLCDStatCustom + 2], a
ret
Functionc8f0a: ; c8f0a (32:4f0a)
xor a
- ld [$ffc7], a
- ld [$ffc8], a
+ ld [hLCDStatCustom + 1], a
+ ld [hLCDStatCustom + 2], a
call Functionc8eca
xor a
ld [hLCDStatCustom], a ; $ff00+$c6
@@ -2706,8 +2706,8 @@
ld [rBGP], a ; $ff00+$47
ld [wcfc7], a
ld [wcfc9], a
- ld [$ffc7], a
- ld [$ffc8], a
+ ld [hLCDStatCustom + 1], a
+ ld [hLCDStatCustom + 2], a
call Functionc8eca
ret
@@ -2723,10 +2723,10 @@
ld [BattleAnimTemps + 3], a
ld bc, LYOverridesBackup
.asm_c8f43
- ld a, [$ffc7]
+ ld a, [hLCDStatCustom + 1]
cp c
jr nc, .asm_c8f58
- ld a, [$ffc8]
+ ld a, [hLCDStatCustom + 2]
cp c
jr c, .asm_c8f58
ld a, [BattleAnimTemps + 2]
@@ -2800,7 +2800,7 @@
call Functionc905d
ld e, a
pop hl
- ld a, [$ffc8]
+ ld a, [hLCDStatCustom + 2]
cp c
jr c, .asm_c8fcf
ld a, e
@@ -2807,7 +2807,7 @@
ld [bc], a
inc bc
.asm_c8fcf
- ld a, [$ffc7]
+ ld a, [hLCDStatCustom + 1]
cp l
jr nc, .asm_c8fd6
ld [hl], e
@@ -2824,7 +2824,7 @@
ret
Functionc8fe4: ; c8fe4 (32:4fe4)
- ld a, [$ffc7]
+ ld a, [hLCDStatCustom + 1]
ld e, a
ld a, [BattleAnimTemps]
add e
@@ -2834,13 +2834,13 @@
Functionc8fef: ; c8fef (32:4fef)
push bc
- ld a, [$ffc7]
+ ld a, [hLCDStatCustom + 1]
ld l, a
inc a
ld e, a
ld h, $d2
ld d, h
- ld a, [$ffc8]
+ ld a, [hLCDStatCustom + 2]
sub l
and a
jr z, .asm_c9009
@@ -2862,9 +2862,9 @@
Functionc900b: ; c900b (32:500b)
push af
ld h, $d2
- ld a, [$ffc7]
+ ld a, [hLCDStatCustom + 1]
ld l, a
- ld a, [$ffc8]
+ ld a, [hLCDStatCustom + 2]
sub l
ld d, a
pop af
@@ -2877,14 +2877,14 @@
Functionc901b: ; c901b (32:501b)
push af
ld e, a
- ld a, [$ffc7]
+ ld a, [hLCDStatCustom + 1]
ld l, a
- ld a, [$ffc8]
+ ld a, [hLCDStatCustom + 2]
sub l
sub e
ld d, a
ld h, $d2
- ld a, [$ffc7]
+ ld a, [hLCDStatCustom + 1]
ld l, a
ld a, $90
.asm_c902c
--- a/battle/core.asm
+++ b/battle/core.asm
@@ -3233,7 +3233,7 @@
Function3d490: ; 3d490
- ld [$ffaf], a
+ ld [hConnectionStripLength], a
ld c, a
.asm_3d493
push bc
@@ -3257,7 +3257,7 @@
; 3d4ae
Function3d4ae: ; 3d4ae
- ld a, [$ffaf]
+ ld a, [hConnectionStripLength]
ld c, a
cp $8
jr nz, .back
@@ -9442,7 +9442,7 @@
Function3fc5b: ; 3fc5b
ld hl, Sprites
xor a
- ld [$ffaf], a
+ ld [hConnectionStripLength], a
ld b, $6
ld e, $a8
.asm_3fc65
@@ -9453,10 +9453,10 @@
inc hl
ld [hl], e
inc hl
- ld a, [$ffaf]
+ ld a, [hConnectionStripLength]
ld [hli], a
inc a
- ld [$ffaf], a
+ ld [hConnectionStripLength], a
ld a, $1
ld [hli], a
ld a, d
@@ -9464,9 +9464,9 @@
ld d, a
dec c
jr nz, .asm_3fc69
- ld a, [$ffaf]
+ ld a, [hConnectionStripLength]
add $3
- ld [$ffaf], a
+ ld [hConnectionStripLength], a
ld a, e
add $8
ld e, a
--- a/battle/effect_commands.asm
+++ b/battle/effect_commands.asm
@@ -1390,7 +1390,7 @@
cp c
jr z, .stab
- jr .asm_3473a
+ jr .SkipStab
.stab
ld hl, CurDamage + 1
@@ -1412,13 +1412,13 @@
ld hl, TypeModifier
set 7, [hl]
-.asm_3473a
+.SkipStab
ld a, BATTLE_VARS_MOVE_TYPE
call GetBattleVar
ld b, a
ld hl, TypeMatchup
-.asm_34743
+.TypesLoop
ld a, [hli]
cp $ff
@@ -1426,25 +1426,25 @@
; foresight
cp $fe
- jr nz, .asm_34757
+ jr nz, .SkipForesightCheck
ld a, BATTLE_VARS_SUBSTATUS1_OPP
call GetBattleVar
bit SUBSTATUS_IDENTIFIED, a
jr nz, .end
- jr .asm_34743
+ jr .TypesLoop
-.asm_34757
+.SkipForesightCheck
cp b
- jr nz, .asm_347b3
+ jr nz, .SkipType
ld a, [hl]
cp d
- jr z, .asm_34763
+ jr z, .GotMatchup
cp e
- jr z, .asm_34763
- jr .asm_347b3
+ jr z, .GotMatchup
+ jr .SkipType
-.asm_34763
+.GotMatchup
push hl
push bc
inc hl
@@ -1451,13 +1451,14 @@
ld a, [TypeModifier]
and %10000000
ld b, a
+; If the target is immune to the move, treat it as a miss and calculate the damage as 0
ld a, [hl]
and a
- jr nz, .asm_34775
+ jr nz, .NotImmune
inc a
ld [AttackMissed], a
xor a
-.asm_34775
+.NotImmune
ld [hMultiplier], a
add b
ld [TypeModifier], a
@@ -1480,34 +1481,35 @@
ld b, a
ld a, [hProduct + 3]
or b
- jr z, .asm_347ab
+ jr z, .ok ; This is a very convoluted way to get back that we've essentially dealt no damage.
- ld a, $a
+; Take the product and divide it by 10.
+ ld a, 10
ld [hDivisor], a
- ld b, $4
+ ld b, 4
call Divide
ld a, [hQuotient + 1]
ld b, a
ld a, [hQuotient + 2]
or b
- jr nz, .asm_347ab
+ jr nz, .ok
- ld a, $1
- ld [$ffb6], a
+ ld a, 1
+ ld [hMultiplicand + 2], a
-.asm_347ab
- ld a, [$ffb5]
+.ok
+ ld a, [hMultiplicand + 1]
ld [hli], a
- ld a, [$ffb6]
+ ld a, [hMultiplicand + 2]
ld [hl], a
pop bc
pop hl
-.asm_347b3
+.SkipType
rept 2
inc hl
endr
- jr .asm_34743
+ jr .TypesLoop
.end
call Function347c8
@@ -1545,32 +1547,32 @@
ld a, 10 ; 1.0
ld [wd265], a
ld hl, TypeMatchup
-.asm_347e7
+.TypesLoop
ld a, [hli]
cp $ff
- jr z, .asm_3482f
+ jr z, .End
cp $fe
- jr nz, .asm_347fb
+ jr nz, .Next
ld a, BATTLE_VARS_SUBSTATUS1_OPP
call GetBattleVar
bit SUBSTATUS_IDENTIFIED, a
- jr nz, .asm_3482f
- jr .asm_347e7
-.asm_347fb
+ jr nz, .End
+ jr .TypesLoop
+.Next
cp d
- jr nz, .asm_34807
+ jr nz, .Nope
ld a, [hli]
cp b
- jr z, .asm_3480b
+ jr z, .Yup
cp c
- jr z, .asm_3480b
- jr .asm_34808
-.asm_34807
+ jr z, .Yup
+ jr .Nope2
+.Nope
inc hl
-.asm_34808
+.Nope2
inc hl
- jr .asm_347e7
-.asm_3480b
+ jr .TypesLoop
+.Yup
xor a
ld [hDividend + 0], a
ld [hMultiplicand + 0], a
@@ -1588,9 +1590,9 @@
pop bc
ld a, [hQuotient + 2]
ld [wd265], a
- jr .asm_347e7
+ jr .TypesLoop
-.asm_3482f
+.End
pop bc
pop de
pop hl
@@ -1603,7 +1605,7 @@
ld a, [wd265]
and a
ld a, 10 ; 1.0
- jr nz, .asm_3484a
+ jr nz, .skip
call ResetDamage
xor a
ld [TypeModifier], a
@@ -1610,7 +1612,7 @@
inc a
ld [AttackMissed], a
ret
-.asm_3484a
+.skip
ld [wd265], a
ret
; 3484e
--- a/constants/wram_constants.asm
+++ b/constants/wram_constants.asm
@@ -72,3 +72,7 @@
OBJECT_STRUCT_LENGTH EQU 40
NUM_OBJECT_STRUCTS EQU 13
+
+; After-Champion Spawn
+SPAWN_LANCE EQU 1
+SPAWN_RED EQU 2
--- a/engine/events.asm
+++ b/engine/events.asm
@@ -121,7 +121,7 @@
xor a
ld [ScriptRunning], a
ld hl, MapStatus
- ld bc, $3e
+ ld bc, $3e ; 62
call ByteFill
callba Function113e5
call ClearJoypad
@@ -137,13 +137,13 @@
callba RunMapSetupScript
call ClearAllScriptFlags3
- ld a, [$ff9f]
+ ld a, [hMapEntryMethod]
cp $f7
jr nz, .dontset
call SetAll_ScriptFlags3
.dontset
- ld a, [$ff9f]
+ ld a, [hMapEntryMethod]
cp $f3
jr nz, .dontresetpoison
xor a
@@ -151,7 +151,7 @@
.dontresetpoison
xor a
- ld [$ff9f], a
+ ld [hMapEntryMethod], a
ld a, 2 ; HandleMap
ld [MapStatus], a
ret
--- a/engine/map_objects.asm
+++ b/engine/map_objects.asm
@@ -1499,7 +1499,7 @@
add hl, bc
ld [hl], 2
ld hl, wd4cf
- ld a, [$ffaf]
+ ld a, [hConnectionStripLength]
cp [hl]
jr z, .ok
ld hl, OBJECT_09
@@ -2508,7 +2508,7 @@
ret z
ld a, [wd4cd]
ld d, a
- ld a, [$ffaf]
+ ld a, [hConnectionStripLength]
cp d
ret nz
ld a, e
@@ -2651,7 +2651,7 @@
Function5579: ; 5579
push bc
- ld a, [$ffaf]
+ ld a, [hConnectionStripLength]
ld c, a
call Function5582
pop bc
@@ -2712,7 +2712,7 @@
ld [hli], a
ld a, [de]
ld [hli], a
- ld a, [$ffaf]
+ ld a, [hConnectionStripLength]
ld [hli], a
push hl
ld hl, OBJECT_MAP_X
@@ -2737,7 +2737,7 @@
ld bc, ObjectStructs
xor a
.loop
- ld [$ffaf], a
+ ld [hConnectionStripLength], a
call GetObjectSprite
jr z, .ok
call Function565c
@@ -2747,7 +2747,7 @@
add hl, bc
ld b, h
ld c, l
- ld a, [$ffaf]
+ ld a, [hConnectionStripLength]
inc a
cp NUM_OBJECT_STRUCTS
jr nz, .loop
@@ -2801,13 +2801,13 @@
xor a
ld bc, ObjectStructs
.loop
- ld [$ffaf], a
+ ld [hConnectionStripLength], a
call Function5680
ld hl, OBJECT_STRUCT_LENGTH
add hl, bc
ld b, h
ld c, l
- ld a, [$ffaf]
+ ld a, [hConnectionStripLength]
inc a
cp NUM_OBJECT_STRUCTS
jr nz, .loop
@@ -3032,7 +3032,7 @@
ld bc, ObjectStructs
xor a
.loop
- ld [$ffaf], a
+ ld [hConnectionStripLength], a
call GetObjectSprite
jr z, .next
call Function437b
@@ -3042,7 +3042,7 @@
add hl, bc
ld b, h
ld c, l
- ld a, [$ffaf]
+ ld a, [hConnectionStripLength]
inc a
cp NUM_OBJECT_STRUCTS
jr nz, .loop
--- a/engine/map_setup.asm
+++ b/engine/map_setup.asm
@@ -1,6 +1,6 @@
RunMapSetupScript:: ; 15363
- ld a, [$ff9f]
+ ld a, [hMapEntryMethod]
and $f
dec a
ld c, a
--- a/engine/predef.asm
+++ b/engine/predef.asm
@@ -36,7 +36,7 @@
add_predef FlagPredef
add_predef Functionc699
add_predef FillPP
- add_predef Functiond88c
+ add_predef TryAddMonToParty
add_predef Functionda96
add_predef Functiondb3f ; $8
add_predef SentPkmnIntoBox
--- a/engine/scripting.asm
+++ b/engine/scripting.asm
@@ -1258,7 +1258,7 @@
call GetScriptByte
call GetScriptPerson
call _CopyObjectStruct
- ld a, [$ffaf]
+ ld a, [hConnectionStripLength]
ld b, 0 ; clear
call ApplyEventActionAppearDisappear
ret
@@ -1276,7 +1276,7 @@
ld a, [hLastTalked]
.ok
call DeleteObjectStruct
- ld a, [$ffaf]
+ ld a, [hConnectionStripLength]
ld b, 1 ; set
call ApplyEventActionAppearDisappear
callba RefreshMapAppearDisappear
@@ -1584,7 +1584,7 @@
xor a
ld [wd459], a
ld a, $f3
- ld [$ff9f], a
+ ld [hMapEntryMethod], a
ld a, $1
call LoadMapStatus
call StopScript
@@ -2839,7 +2839,7 @@
ld a, -1
ld [wd001], a
ld a, -15
- ld [$ff9f], a
+ ld [hMapEntryMethod], a
ld a, 1
call LoadMapStatus
call StopScript
@@ -2851,7 +2851,7 @@
ld a, -1
ld [wd001], a
ld a, -5
- ld [$ff9f], a
+ ld [hMapEntryMethod], a
ld a, 1
call LoadMapStatus
call StopScript
@@ -2994,7 +2994,7 @@
; which_method (SingleByteParam)
call GetScriptByte
- ld [$ff9f], a
+ ld [hMapEntryMethod], a
ld a, 1
call LoadMapStatus
call StopScript
@@ -3198,7 +3198,7 @@
Script_credits: ; 0x97bf3
; script command 0xa2
- callba Function86455
+ callba RedCredits
; fallthrough
DisplayCredits:
--- a/home/joypad.asm
+++ b/home/joypad.asm
@@ -354,12 +354,12 @@
; a80
Functiona80:: ; a80
- ld a, [$ffaf]
+ ld a, [hConnectionStripLength]
push af
ld a, [$ffb0]
push af
xor a
- ld [$ffaf], a
+ ld [hConnectionStripLength], a
ld a, $6
ld [$ffb0], a
.asm_a8d
@@ -374,7 +374,7 @@
pop af
ld [$ffb0], a
pop af
- ld [$ffaf], a
+ ld [hConnectionStripLength], a
ret
; aa5
@@ -452,9 +452,9 @@
cp b
pop bc
jr nz, .asm_b27
- ld a, [$ffaf]
+ ld a, [hConnectionStripLength]
dec a
- ld [$ffaf], a
+ ld [hConnectionStripLength], a
ret nz
ld a, [$ffb0]
dec a
@@ -463,20 +463,20 @@
ld a, $7a
ld [hl], a
ld a, $ff
- ld [$ffaf], a
+ ld [hConnectionStripLength], a
ld a, $6
ld [$ffb0], a
ret
.asm_b27
- ld a, [$ffaf]
+ ld a, [hConnectionStripLength]
and a
ret z
dec a
- ld [$ffaf], a
+ ld [hConnectionStripLength], a
ret nz
dec a
- ld [$ffaf], a
+ ld [hConnectionStripLength], a
ld a, [$ffb0]
dec a
ld [$ffb0], a
--- a/home/map.asm
+++ b/home/map.asm
@@ -207,10 +207,10 @@
Function222a:: ; 222a
ld a, $fa
- ld [$ff9f], a
+ ld [hMapEntryMethod], a
callba RunMapSetupScript
xor a
- ld [$ff9f], a
+ ld [hMapEntryMethod], a
ret
; 2238
--- a/hram.asm
+++ b/hram.asm
@@ -17,6 +17,7 @@
hROMBank EQU $ff9d
hVBlank EQU $ff9e
+hMapEntryMethod EQU $ff9f
hJoypadReleased EQU $ffa2
hJoypadPressed EQU $ffa3
--- a/items/item_effects.asm
+++ b/items/item_effects.asm
@@ -562,7 +562,7 @@
ld [MonType], a
call ClearSprites
- predef Functiond88c
+ predef TryAddMonToParty
callba Function4db49
@@ -691,7 +691,7 @@
jr .asm_ebe2
.asm_ebd1
- callba Functione6ce
+ callba BugContest_SetCaughtContestMon
jr .asm_ebe2
.asm_ebd9
--- a/main.asm
+++ b/main.asm
@@ -142,8 +142,8 @@
ld [wd001], a
ld a, $f1
- ld [$ff9f], a
- jp Function5e5d
+ ld [hMapEntryMethod], a
+ jp FinishContinueFunction
; 5b8f
Function5b8f: ; 5b8f
@@ -421,18 +421,18 @@
ld [hBGMapMode], a
ld c, $14
call DelayFrames
- call Function5e34
- jr nc, .asm_5d8c
+ call ConfirmContinue
+ jr nc, .Check1Pass
call WriteBackup
jr .FailToLoad
-.asm_5d8c
+.Check1Pass
call Function5e48
- jr nc, .asm_5d96
+ jr nc, .Check2Pass
call WriteBackup
jr .FailToLoad
-.asm_5d96
+.Check2Pass
ld a, $8
ld [MusicFade], a
ld a, MUSIC_NONE % $100
@@ -443,38 +443,38 @@
call Function5df0
call WriteBackup
call ClearTileMap
- ld c, $14
+ ld c, 20
call DelayFrames
callba JumpRoamMons
callba Function105091
callba Function140ae
- ld a, [wd4b5]
- cp $1
- jr z, .asm_5dd7
+ ld a, [wSpawnAfterChampion]
+ cp SPAWN_LANCE
+ jr z, .SpawnAfterE4
ld a, $f2
- ld [$ff9f], a
- jp Function5e5d
+ ld [hMapEntryMethod], a
+ jp FinishContinueFunction
.FailToLoad
ret
-.asm_5dd7
+.SpawnAfterE4
ld a, SPAWN_NEW_BARK
ld [wd001], a
- call Function5de7
- jp Function5e5d
+ call PostCreditsSpawn
+ jp FinishContinueFunction
; 5de2
-Function5de2: ; 5de2
+SpawnAfterRed: ; 5de2
ld a, SPAWN_MT_SILVER
ld [wd001], a
; 5de7
-Function5de7: ; 5de7
+PostCreditsSpawn: ; 5de7
xor a
- ld [wd4b5], a
+ ld [wSpawnAfterChampion], a
ld a, $f1
- ld [$ff9f], a
+ ld [hMapEntryMethod], a
ret
; 5df0
@@ -506,19 +506,19 @@
ret
; 5e34
-Function5e34: ; 5e34
-.asm_5e34
+ConfirmContinue: ; 5e34
+.loop
call DelayFrame
call GetJoypad
ld hl, hJoyPressed
bit 0, [hl]
- jr nz, .asm_5e47
+ jr nz, .PressA
bit 1, [hl]
- jr z, .asm_5e34
+ jr z, .loop
scf
ret
-.asm_5e47
+.PressA
ret
; 5e48
@@ -525,21 +525,21 @@
Function5e48: ; 5e48
call Function6e3
and $80
- jr z, .asm_5e5b
+ jr z, .pass
callba Function20021
ld a, c
and a
- jr z, .asm_5e5b
+ jr z, .pass
scf
ret
-.asm_5e5b
+.pass
xor a
ret
; 5e5d
-Function5e5d: ; 5e5d
-.asm_5e5d
+FinishContinueFunction: ; 5e5d
+.loop
xor a
ld [wc2c1], a
ld [InLinkBattle], a
@@ -549,14 +549,14 @@
ld hl, wd83e
set 1, [hl]
callba OverworldLoop
- ld a, [wd4b5]
- cp $2
- jr z, .asm_5e80
+ ld a, [wSpawnAfterChampion]
+ cp SPAWN_RED
+ jr z, .AfterRed
jp Reset
-.asm_5e80
- call Function5de2
- jr .asm_5e5d
+.AfterRed
+ call SpawnAfterRed
+ jr .loop
; 5e85
Function5e85: ; 5e85
@@ -2354,7 +2354,7 @@
.asm_6ff1
ld bc, ObjectStructs ; redundant
ld a, 0
- ld [$ffaf], a
+ ld [hConnectionStripLength], a
call Function7041
ret nc
ld hl, OBJECT_DIRECTION_WALKING
@@ -2382,7 +2382,7 @@
; 7015
Function7015: ; 7015
- ld a, [$ffaf]
+ ld a, [hConnectionStripLength]
call GetObjectStruct
call Function7021
call Function7041
@@ -2450,7 +2450,7 @@
jr nz, .ok
.ok2
- ld a, [$ffaf]
+ ld a, [hConnectionStripLength]
ld l, a
ld a, [$ffb0]
cp l
@@ -2467,7 +2467,7 @@
ld a, [hl]
cp e
jr nz, .nope
- ld a, [$ffaf]
+ ld a, [hConnectionStripLength]
ld l, a
ld a, [$ffb0]
cp l
@@ -2932,7 +2932,7 @@
ld a, 15
ld [CurPartyLevel], a
- predef Functiond88c
+ predef TryAddMonToParty
jr nc, .NotGiven
; Caught data.
@@ -3205,7 +3205,7 @@
.ok
ld [hl], e
ld a, $0
- ld [$ffaf], a
+ ld [hConnectionStripLength], a
ld bc, MapObjects
ld a, $0
ld [$ffb0], a
@@ -3262,7 +3262,7 @@
ld hl, OBJECT_MAP_Y
add hl, bc
ld e, [hl]
- ld a, [$ffaf]
+ ld a, [hConnectionStripLength]
ld b, a
call Function807e
and a
@@ -3343,7 +3343,7 @@
ld hl, MAPOBJECT_OBJECT_STRUCT_ID
add hl, bc
ld [hl], a
- ld a, [$ffaf]
+ ld a, [hConnectionStripLength]
ld [wc2f0], a
ld hl, MAPOBJECT_SPRITE
add hl, bc
@@ -3391,7 +3391,7 @@
ld bc, MapObjects + OBJECT_LENGTH
ld a, 1
.loop
- ld [$ffaf], a
+ ld [hConnectionStripLength], a
ld hl, MAPOBJECT_SPRITE
add hl, bc
ld a, [hl]
@@ -3432,7 +3432,7 @@
add hl, bc
ld b, h
ld c, l
- ld a, [$ffaf]
+ ld a, [hConnectionStripLength]
inc a
cp NUM_OBJECTS
jr nz, .loop
@@ -3476,7 +3476,7 @@
ld bc, MapObjects + OBJECT_LENGTH
ld a, 1
.loop
- ld [$ffaf], a
+ ld [hConnectionStripLength], a
ld hl, MAPOBJECT_SPRITE
add hl, bc
ld a, [hl]
@@ -3511,7 +3511,7 @@
add hl, bc
ld b, h
ld c, l
- ld a, [$ffaf]
+ ld a, [hConnectionStripLength]
inc a
cp NUM_OBJECTS
jr nz, .loop
@@ -3534,7 +3534,7 @@
ld bc, MapObjects + OBJECT_LENGTH
ld a, 1
.loop
- ld [$ffaf], a
+ ld [hConnectionStripLength], a
ld hl, MAPOBJECT_SPRITE
add hl, bc
ld a, [hl]
@@ -3569,7 +3569,7 @@
add hl, bc
ld b, h
ld c, l
- ld a, [$ffaf]
+ ld a, [hConnectionStripLength]
inc a
cp NUM_OBJECTS
jr nz, .loop
@@ -7915,40 +7915,47 @@
; d88c
-Functiond88c: ; d88c
+TryAddMonToParty: ; d88c
+ ; Whose is it?
ld de, PartyCount
ld a, [MonType]
and $f
- jr z, .asm_d899
+ jr z, .getpartylocation
ld de, OTPartyCount
-.asm_d899
+.getpartylocation
+ ; Do we have room for it?
ld a, [de]
inc a
cp PARTY_LENGTH + 1
ret nc
+ ; Increase the party count
ld [de], a
- ld a, [de]
- ld [$ffae], a
+ ld a, [de] ; Why are we doing this?
+ ld [$ffae], a ; HRAM backup
add e
ld e, a
- jr nc, .asm_d8a7
+ jr nc, .loadspecies
inc d
-.asm_d8a7
+.loadspecies
+ ; Load the species of the Pokemon into the party list.
+ ; The terminator is usually here, but it'll be back.
ld a, [CurPartySpecies]
ld [de], a
+ ; Load the terminator into the next slot.
inc de
- ld a, $ff
+ ld a, -1
ld [de], a
+ ; Now let's load the OT name.
ld hl, PartyMonOT
ld a, [MonType]
and $f
- jr z, .asm_d8bc
+ jr z, .loadOTname
ld hl, OTPartyMonOT
-.asm_d8bc
- ld a, [$ffae]
+.loadOTname
+ ld a, [$ffae] ; Restore index from backup
dec a
call SkipNames
ld d, h
@@ -7958,7 +7965,7 @@
call CopyBytes
ld a, [MonType]
and a
- jr nz, .asm_d8f0
+ jr nz, .skipnickname
ld a, [CurPartySpecies]
ld [wd265], a
call GetPokemonName
@@ -7972,19 +7979,19 @@
ld bc, PKMN_NAME_LENGTH
call CopyBytes
-.asm_d8f0
+.skipnickname
ld hl, PartyMon1Species
ld a, [MonType]
and $f
- jr z, .asm_d8fd
+ jr z, .initializeStats
ld hl, OTPartyMon1Species
-.asm_d8fd
+.initializeStats
ld a, [$ffae]
dec a
ld bc, PartyMon2 - PartyMon1
call AddNTimes
-Functiond906: ; d906
+GeneratePartyMonStats: ; d906
ld e, l
ld d, h
push hl
@@ -7997,10 +8004,10 @@
ld a, [IsInBattle]
and a
ld a, $0
- jr z, .asm_d922
+ jr z, .skipitem
ld a, [EnemyMonItem]
-.asm_d922
+.skipitem
ld [de], a
inc de
push de
@@ -8008,10 +8015,10 @@
ld l, e
ld a, [IsInBattle]
and a
- jr z, .asm_d943
+ jr z, .randomlygeneratemoves
ld a, [MonType]
and a
- jr nz, .asm_d943
+ jr nz, .randomlygeneratemoves
ld de, EnemyMonMoves
rept NUM_MOVES + -1
ld a, [de]
@@ -8020,9 +8027,9 @@
endr
ld a, [de]
ld [hl], a
- jr .asm_d950
+ jr .next
-.asm_d943
+.randomlygeneratemoves
xor a
rept NUM_MOVES + -1
ld [hli], a
@@ -8031,7 +8038,7 @@
ld [Buffer1], a
predef FillMoves
-.asm_d950
+.next
pop de
rept 4
inc de
@@ -8058,22 +8065,22 @@
inc de
xor a
ld b, $a
-.asm_d97a
+.loop
ld [de], a
inc de
dec b
- jr nz, .asm_d97a
+ jr nz, .loop
pop hl
push hl
ld a, [MonType]
and $f
- jr z, .asm_d992
+ jr z, .generateDVs
push hl
callba GetTrainerDVs
pop hl
- jr .asm_d9b5
+ jr .initializetrainermonstats
-.asm_d992
+.generateDVs
ld a, [CurPartySpecies]
ld [wd265], a
dec a
@@ -8087,13 +8094,13 @@
push hl
ld a, [IsInBattle]
and a
- jr nz, .asm_d9f3
+ jr nz, .copywildmonstats
call Random
ld b, a
call Random
ld c, a
-.asm_d9b5
+.initializetrainermonstats
ld a, b
ld [de], a
inc de
@@ -8111,7 +8118,7 @@
rept 4
inc de
endr
- ld a, $46
+ ld a, 70
ld [de], a
inc de
xor a
@@ -8129,7 +8136,7 @@
inc de
ld [de], a
inc de
- ld bc, $000a
+ ld bc, 10
add hl, bc
ld a, $1
ld c, a
@@ -8141,9 +8148,9 @@
ld a, [$ffb6]
ld [de], a
inc de
- jr .asm_da29
+ jr .next2
-.asm_d9f3
+.copywildmonstats
ld a, [EnemyMonDVs]
ld [de], a
inc de
@@ -8154,12 +8161,12 @@
push hl
ld hl, EnemyMonPP
ld b, NUM_MOVES
-.asm_da03
+.wildmonpploop
ld a, [hli]
ld [de], a
inc de
dec b
- jr nz, .asm_da03
+ jr nz, .wildmonpploop
pop hl
ld a, BASE_HAPPINESS
@@ -8189,17 +8196,17 @@
ld [de], a
inc de
-.asm_da29
+.next2
ld a, [IsInBattle]
dec a
- jr nz, .asm_da3b
+ jr nz, .generatestats
ld hl, EnemyMonMaxHP
- ld bc, $000c
+ ld bc, 12
call CopyBytes
pop hl
- jr .asm_da45
+ jr .next3
-.asm_da3b
+.generatestats
pop hl
ld bc, $000a
add hl, bc
@@ -8206,13 +8213,13 @@
ld b, $0
call Functione167
-.asm_da45
+.next3
ld a, [MonType]
and $f
- jr nz, .asm_da6b
+ jr nz, .done
ld a, [CurPartySpecies]
cp UNOWN
- jr nz, .asm_da6b
+ jr nz, .done
ld hl, PartyMon1DVs
ld a, [PartyCount]
dec a
@@ -8221,8 +8228,8 @@
predef GetUnownLetter
callab Functionfba18
-.asm_da6b
- scf
+.done
+ scf ; When this function returns, the carry flag indicates success vs failure.
ret
; da6d
@@ -8992,7 +8999,7 @@
push bc
call CheckSeenMon
push bc
- call Functiond88c
+ call TryAddMonToParty
pop bc
ld a, c
and a
@@ -9463,8 +9470,8 @@
push bc
xor a
ld [MonType], a
- call Functiond88c
- jr nc, .asm_e2b0
+ call TryAddMonToParty
+ jr nc, .failed
ld hl, PartyMonNicknames
ld a, [PartyCount]
dec a
@@ -9489,7 +9496,7 @@
ld [hl], a
jr .asm_e2e1
-.asm_e2b0
+.failed
ld a, [CurPartySpecies]
ld [TempEnemyMonSpecies], a
callab LoadEnemyMon
@@ -10113,28 +10120,28 @@
; e6ce
-Functione6ce: ; e6ce
- ld a, [wdf9c]
+BugContest_SetCaughtContestMon: ; e6ce
+ ld a, [wContestMon]
and a
- jr z, .asm_e6ea
+ jr z, .firstcatch
ld [wd265], a
- callba Functioncc0c7
- callba Functioncc000
+ callba DisplayAlreadyCaughtText
+ callba DisplayCaughtContestMonStats
lb bc, 14, 7
call PlaceYesNoBox
ret c
-.asm_e6ea
- call Functione6fd
+.firstcatch
+ call .generatestats
ld a, [TempEnemyMonSpecies]
ld [wd265], a
call GetPokemonName
- ld hl, UnknownText_0xe71d
+ ld hl, .caughttext
call PrintText
ret
; e6fd
-Functione6fd: ; e6fd
+.generatestats: ; e6fd
ld a, [TempEnemyMonSpecies]
ld [CurSpecies], a
ld [CurPartySpecies], a
@@ -10141,15 +10148,15 @@
call GetBaseData
xor a
ld bc, PartyMon2 - PartyMon1
- ld hl, wdf9c
+ ld hl, wContestMon
call ByteFill
xor a
ld [MonType], a
- ld hl, wdf9c
- jp Functiond906
+ ld hl, wContestMon
+ jp GeneratePartyMonStats
; e71d
-UnknownText_0xe71d: ; 0xe71d
+.caughttext: ; 0xe71d
; Caught @ !
text_jump UnknownText_0x1c10c0
db "@"
@@ -14837,7 +14844,7 @@
Special_GiveParkBalls: ; 135db
xor a
- ld [wdf9c], a
+ ld [wContestMon], a
ld a, 20
ld [wdc79], a
callba Function11490
@@ -15230,7 +15237,7 @@
ld hl, wd00e
ld a, 1
ld [hli], a
- ld a, [wdf9c]
+ ld a, [wContestMon]
ld [hli], a
ld a, [hProduct]
ld [hli], a
@@ -24671,7 +24678,7 @@
hlcoord 1, 1
ld de, String24c4b
call PlaceString
- ld a, [wdf9c]
+ ld a, [wContestMon]
and a
ld de, String24c59
jr z, .asm_24c1e
@@ -24681,7 +24688,7 @@
.asm_24c1e
hlcoord 8, 1
call PlaceString
- ld a, [wdf9c]
+ ld a, [wContestMon]
and a
jr z, .asm_24c3e
hlcoord 1, 3
@@ -35216,7 +35223,7 @@
ld a, OTPARTYMON
ld [MonType], a
push hl
- predef Functiond88c
+ predef TryAddMonToParty
pop hl
jr .loop
; 39806
@@ -35237,7 +35244,7 @@
ld [MonType], a
push hl
- predef Functiond88c
+ predef TryAddMonToParty
ld a, [OTPartyCount]
dec a
ld hl, OTPartyMon1Moves
@@ -35313,7 +35320,7 @@
ld a, OTPARTYMON
ld [MonType], a
push hl
- predef Functiond88c
+ predef TryAddMonToParty
ld a, [OTPartyCount]
dec a
ld hl, OTPartyMon1Item
@@ -35344,7 +35351,7 @@
ld [MonType], a
push hl
- predef Functiond88c
+ predef TryAddMonToParty
ld a, [OTPartyCount]
dec a
ld hl, OTPartyMon1Item
@@ -44308,7 +44315,7 @@
; 4d9e5
CheckPartyFullAfterContest: ; 4d9e5
- ld a, [wdf9c]
+ ld a, [wContestMon]
and a
jp z, Function4db35
ld [CurPartySpecies], a
@@ -44323,7 +44330,7 @@
ld c, a
ld b, $0
add hl, bc
- ld a, [wdf9c]
+ ld a, [wContestMon]
ld [hli], a
ld [CurSpecies], a
ld a, $ff
@@ -44335,7 +44342,7 @@
call AddNTimes
ld d, h
ld e, l
- ld hl, wdf9c
+ ld hl, wContestMon
ld bc, PartyMon2 - PartyMon1
call CopyBytes
ld a, [PartyCount]
@@ -44389,7 +44396,7 @@
or b
ld [hl], a
xor a
- ld [wdf9c], a
+ ld [wContestMon], a
and a
ld [ScriptVar], a
ret
@@ -44405,7 +44412,7 @@
jr nc, .asm_4db08
xor a
ld [CurPartyMon], a
- ld hl, wdf9c
+ ld hl, wContestMon
ld de, wd018
ld bc, sBoxMon2 - sBoxMon1
call CopyBytes
@@ -44451,7 +44458,7 @@
ld [hl], a
call CloseSRAM
xor a
- ld [wdf9c], a
+ ld [wContestMon], a
ld a, $1
ld [ScriptVar], a
ret
@@ -50505,7 +50512,7 @@
IsNPCInFront: ; 80341
ld a, 0
- ld [$ffaf], a
+ ld [hConnectionStripLength], a
ld a, [MapX]
ld d, a
ld a, [WalkingX]
@@ -53994,8 +54001,8 @@
ld a, 1
ld [wc2cd], a
call Function2ed3
- ld a, 1
- ld [wd4b5], a
+ ld a, SPAWN_LANCE
+ ld [wSpawnAfterChampion], a
; Enable the Pokégear map to cycle through all of Kanto
ld hl, StatusFlags
@@ -54022,7 +54029,7 @@
ret
; 0x86455
-Function86455:: ; 86455
+RedCredits:: ; 86455
ld a, MUSIC_NONE % $100
ld [MusicFadeIDLo], a
ld a, MUSIC_NONE / $100
@@ -54037,8 +54044,8 @@
ld c, $8
call DelayFrames
call Function2ed3
- ld a, $2
- ld [wd4b5], a
+ ld a, SPAWN_RED
+ ld [wSpawnAfterChampion], a
ld a, [StatusFlags]
ld b, a
callba Function109847
@@ -62349,8 +62356,8 @@
call DelayFrame
xor a
ld [hLCDStatCustom], a
- ld [$ffc7], a
- ld [$ffc8], a
+ ld [hLCDStatCustom + 1], a
+ ld [hLCDStatCustom + 2], a
ld [hSCY], a
ld a, $1
ld [rSVBK], a
@@ -62600,9 +62607,9 @@
ld a, $43
ld [hLCDStatCustom], a ; $ff00+$c6
xor a
- ld [$ffc7], a
+ ld [hLCDStatCustom + 1], a
ld a, $90
- ld [$ffc8], a
+ ld [hLCDStatCustom + 2], a
xor a
ld [wcf64], a
ld [wcf65], a
@@ -63654,8 +63661,8 @@
call WhiteBGMap
xor a
ld [hLCDStatCustom], a
- ld [$ffc7], a
- ld [$ffc8], a
+ ld [hLCDStatCustom + 1], a
+ ld [hLCDStatCustom + 2], a
ld [hSCX], a
ld [Requested2bppSource], a
ld [Requested2bppSource + 1], a
@@ -76437,7 +76444,7 @@
SECTION "bank33", ROMX, BANK[$33]
-Functioncc000: ; cc000
+DisplayCaughtContestMonStats: ; cc000
call WhiteBGMap
call ClearTileMap
@@ -76475,7 +76482,7 @@
ld de, .Health
call PlaceString
- ld a, [wdf9c]
+ ld a, [wContestMon]
ld [wd265], a
call GetPokemonName
ld de, StringBuffer1
@@ -76533,13 +76540,13 @@
db "@"
; cc0c7
-Functioncc0c7: ; cc0c7
+DisplayAlreadyCaughtText: ; cc0c7
call GetPokemonName
- ld hl, AlreadyCaughtText
+ ld hl, .AlreadyCaughtText
jp PrintText
; cc0d0
-AlreadyCaughtText: ; 0xcc0d0
+.AlreadyCaughtText: ; 0xcc0d0
; You already caught a @ .
text_jump UnknownText_0x1c10dd
db "@"
@@ -87300,7 +87307,7 @@
ld [MonType], a
ld [wd10b], a
callab Functione039
- predef Functiond88c
+ predef TryAddMonToParty
ld e, TRADE_DIALOG
call GetTradeAttribute
@@ -88399,10 +88406,10 @@
ld c, $0
Function104265: ; 104265 (41:4265)
- ld a, [$ffaf]
+ ld a, [hConnectionStripLength]
push af
ld a, c
- ld [$ffaf], a
+ ld [hConnectionStripLength], a
ld c, $12
.asm_10426d
ld b, $14
@@ -88412,7 +88419,7 @@
ld [hli], a
dec b
jr nz, .asm_10426f
- ld a, [$ffaf]
+ ld a, [hConnectionStripLength]
ld b, $c
.asm_104279
ld [hli], a
@@ -88421,7 +88428,7 @@
dec c
jr nz, .asm_10426d
pop af
- ld [$ffaf], a
+ ld [hConnectionStripLength], a
ret
--- a/misc/mobile_40.asm
+++ b/misc/mobile_40.asm
@@ -407,10 +407,10 @@
Function1002dc: ; 1002dc
ld a, $f8
- ld [$ff9f], a
+ ld [hMapEntryMethod], a
callba RunMapSetupScript
xor a
- ld [$ff9f], a
+ ld [hMapEntryMethod], a
call Functione51
ret
; 1002ed
--- a/misc/mobile_5f.asm
+++ b/misc/mobile_5f.asm
@@ -2359,7 +2359,7 @@
ld [MonType], a
push hl
push bc
- predef Functiond88c
+ predef TryAddMonToParty
callba Function4db49
pop bc
pop hl
--- a/wram.asm
+++ b/wram.asm
@@ -1842,7 +1842,7 @@
wd262:: ds 1
wd263:: ds 1
wd264:: ds 1
-GetPokemonName_Parameter::
+wNamedObjectIndexBuffer::
wd265:: ds 1
wd266:: ds 1
wd267:: ds 1
@@ -1956,7 +1956,7 @@
GreensName:: ds NAME_LENGTH ; d4a9
wd4b4:: ds 1
-wd4b5:: ds 1
+wSpawnAfterChampion:: ds 1
; init time set at newgame
StartDay:: ; d4b6