ref: 700321a7fb2d6c852ffc91cc0b8867526cb76813
parent: c33ba049a5a993fc678fd1698645039ce4974022
parent: 050a0162b89c645c4a2a3ed311c4da791fb3de6c
author: yenatch <[email protected]>
date: Thu Aug 11 11:55:32 EDT 2016
Merge pull request #342 from PikalaxALT/master More label interpretations
--- a/audio/cries.asm
+++ b/audio/cries.asm
@@ -174,7 +174,7 @@
Cry_Entei_Ch5: ; f2e7d
soundinput $ff
- unknownmusic0xde $63
+ sound_duty 3, 0, 2, 1
sound __, 2, $f8, $05f8
sound __, 9, $9f, $04d8
sound __, 7, $f8, $05c4
@@ -184,7 +184,7 @@
; f2e94
Cry_Entei_Ch6: ; f2e94
- unknownmusic0xde $33
+ sound_duty 3, 0, 3, 0
sound __, 2, $c8, $0640
sound __, 7, $ff, $0668
sound __, 8, $a8, $0534
@@ -201,7 +201,7 @@
; f2eb4
Cry_Magcargo_Ch5: ; f2eb4
- unknownmusic0xde $c4
+ sound_duty 0, 1, 0, 3
sound __, 5, $af, $0720
sound __, 3, $f8, $071c
sound __, 3, $f8, $0718
@@ -213,7 +213,7 @@
; f2ed3
Cry_Magcargo_Ch6: ; f2ed3
- unknownmusic0xde $a
+ sound_duty 2, 2, 0, 0
sound __, 2, $b8, $0710
sound __, 4, $d8, $072c
sound __, 5, $d8, $0665
@@ -235,7 +235,7 @@
; f2f03
Cry_Dunsparce_Ch5: ; f2f03
- unknownmusic0xde $22
+ sound_duty 2, 0, 2, 0
sound __, 2, $f8, $05b0
sound __, 2, $f8, $04b4
sound __, 2, $f8, $05b8
@@ -249,7 +249,7 @@
; f2f26
Cry_Dunsparce_Ch6: ; f2f26
- unknownmusic0xde $22
+ sound_duty 2, 0, 2, 0
sound __, 9, $b8, $04c8
sound C#, 1, $b5, $0410
endchannel
@@ -263,7 +263,7 @@
; f2f3b
Cry_Slowking_Ch5: ; f2f3b
- unknownmusic0xde $33
+ sound_duty 3, 0, 3, 0
sound __, 3, $f1, $0550
sound __, 3, $f1, $0530
sound __, 3, $f1, $0510
@@ -275,7 +275,7 @@
; f2f5a
Cry_Slowking_Ch6: ; f2f5a
- unknownmusic0xde $f2
+ sound_duty 2, 0, 3, 3
sound __, 5, $e1, $0620
sound __, 6, $e2, $0500
sound __, 7, $e1, $0620
@@ -312,7 +312,7 @@
; f2fab
Cry_Pichu_Ch6: ; f2fab
- unknownmusic0xde $10
+ sound_duty 0, 0, 1, 0
sound __, 3, $c8, $076d
sound __, 3, $c8, $0771
sound __, 3, $c8, $078d
@@ -331,7 +331,7 @@
; f2fd2
Cry_Marill_Ch5: ; f2fd2
- unknownmusic0xde $22
+ sound_duty 2, 0, 2, 0
sound __, 3, $88, $06d8
sound __, 9, $e2, $06e0
sound __, 3, $61, $06e5
@@ -343,7 +343,7 @@
; f2ff1
Cry_Marill_Ch6: ; f2ff1
- unknownmusic0xde $63
+ sound_duty 3, 0, 2, 1
sound __, 3, $68, $06b1
sound __, 6, $c1, $06b9
sound __, 6, $99, $0760
@@ -367,7 +367,7 @@
tone $0002
Cry_Togepi_Ch6: ; f3022
Cry_Togetic_branch_f3022: ; f3022
- unknownmusic0xde $52
+ sound_duty 2, 0, 1, 1
sound __, 5, $f1, $0796
sound __, 5, $f1, $072d
sound __, 8, $0, 0
@@ -396,7 +396,7 @@
; f305b
Cry_Spinarak_Ch6: ; f305b
- unknownmusic0xde $2a
+ sound_duty 2, 2, 2, 0
sound __, 4, $2c, $07c7
sound __, 2, $0, 0
sound __, 6, $59, $07be
@@ -413,7 +413,7 @@
; f307b
Cry_Raikou_Ch5: ; f307b
- unknownmusic0xde $f8
+ sound_duty 0, 2, 3, 3
sound __, 3, $f1, $04b0
sound __, 3, $f7, $0590
sound __, 9, $f8, $0510
@@ -425,7 +425,7 @@
; f309a
Cry_Raikou_Ch6: ; f309a
- unknownmusic0xde $f2
+ sound_duty 2, 0, 3, 3
sound __, 3, $f1, $0720
sound __, 3, $e1, $0650
sound __, 5, $f1, $0750
@@ -450,7 +450,7 @@
; f30d6
Cry_Hoothoot_Ch5: ; f30d6
- unknownmusic0xde $66
+ sound_duty 2, 1, 2, 1
sound __, 5, $78, $0650
sound __, 5, $f8, $0660
sound __, 5, $f8, $065c
@@ -463,7 +463,7 @@
; f30f9
Cry_Hoothoot_Ch6: ; f30f9
- unknownmusic0xde $22
+ sound_duty 2, 0, 2, 0
Cry_Hoothoot_branch_f30fb: ; f30fb
sound __, 3, $a1, $0600
loopchannel 3, Cry_Hoothoot_branch_f30fb
@@ -490,7 +490,7 @@
; f3129
Cry_Sentret_Ch6: ; f3129
- unknownmusic0xde $1b
+ sound_duty 3, 2, 1, 0
Cry_Sentret_branch_f312b: ; f312b
sound __, 9, $39, $072d
sound __, 9, $f1, $0720
@@ -510,7 +510,7 @@
; f3143
Cry_Mareep_Ch6: ; f3143
- unknownmusic0xde $1
+ sound_duty 1, 0, 0, 0
Cry_Mareep_branch_f3145: ; f3145
Cry_Gligar_branch_f3145: ; f3145
sound __, 5, $3a, $073d
@@ -546,7 +546,7 @@
Cry_Chikorita_Ch5: ; f317f
tone $0020
Cry_Chikorita_Ch6: ; f3182
- unknownmusic0xde $21
+ sound_duty 1, 0, 2, 0
sound __, 3, $c8, $0641
sound __, 3, $48, $0641
sound __, 7, $f8, $0790
@@ -562,7 +562,7 @@
; f31a0
Cry_Gligar_Ch5: ; f31a0
- unknownmusic0xde $a2
+ sound_duty 2, 0, 2, 2
jumpchannel Cry_Gligar_branch_f3145
; f31a5
@@ -573,7 +573,7 @@
; f31ad
Cry_Girafarig_Ch6: ; f31ad
- unknownmusic0xde $41
+ sound_duty 1, 0, 0, 1
Cry_Girafarig_branch_f31af: ; f31af
sound __, 5, $68, $0758
sound __, 3, $e8, $0760
@@ -593,7 +593,7 @@
; f31d4
Cry_Slugma_Ch5: ; f31d4
- unknownmusic0xde $91
+ sound_duty 1, 0, 1, 2
sound __, 13, $f2, $07a6
sound __, 5, $f8, $07b0
sound __, 5, $e8, $03b0
@@ -617,7 +617,7 @@
; f3200
Cry_Ledyba_Ch6: ; f3200
- unknownmusic0xde $1
+ sound_duty 1, 0, 0, 0
Cry_Ledyba_branch_f3202: ; f3202
sound __, 4, $f8, $0791
sound __, 4, $d8, $078d
@@ -652,7 +652,7 @@
Cry_Wooper_Ch6: ; f3249
Cry_Donphan_Ch6: ; f3249
- unknownmusic0xde $7
+ sound_duty 3, 1, 0, 0
sound __, 3, $b9, $0738
sound __, 5, $cb, $0742
sound __, 9, $cb, $0754
@@ -682,7 +682,7 @@
Cry_Typhlosion_Ch5: ; f3284
Cry_Teddiursa_Ch5: ; f3284
- unknownmusic0xde $12
+ sound_duty 2, 0, 1, 0
Cry_Typhlosion_branch_f3286: ; f3286
Cry_Teddiursa_branch_f3286: ; f3286
sound __, 4, $c1, $0791
@@ -711,7 +711,7 @@
Cry_Typhlosion_Ch6: ; f32bb
Cry_Teddiursa_Ch6: ; f32bb
- unknownmusic0xde $78
+ sound_duty 0, 2, 3, 1
sound __, 9, $99, $0740
sound __, 9, $79, $0746
sound C_, 1, $f6, $078d
@@ -731,7 +731,7 @@
; f32e7
Cry_Natu_Ch5: ; f32e7
- unknownmusic0xde $de
+ sound_duty 2, 3, 1, 3
Cry_Mantine_branch_f32e9: ; f32e9
Cry_Sunflora_branch_f32e9: ; f32e9
sound __, 5, $f8, $07b1
@@ -747,7 +747,7 @@
Cry_Mantine_branch_f3302: ; f3302
Cry_Natu_Ch6: ; f3302
Cry_Sunflora_Ch6: ; f3302
- unknownmusic0xde $f2
+ sound_duty 2, 0, 3, 3
sound __, 5, $f8, $07b2
sound __, 5, $f8, $07b1
sound __, 5, $28, $07b0
@@ -802,7 +802,7 @@
; f3353
Cry_Ampharos_Ch5: ; f3353
- unknownmusic0xde $de
+ sound_duty 2, 3, 1, 3
Cry_Ampharos_branch_f3355: ; f3355
sound __, 2, $c1, $0520
sound __, 2, $a1, $0420
@@ -815,7 +815,7 @@
; f3370
Cry_Ampharos_Ch6: ; f3370
- unknownmusic0xde $32
+ sound_duty 2, 0, 3, 0
sound __, 9, $f8, $0700
sound __, 8, $f8, $0720
sound __, 5, $f8, $0790
@@ -835,7 +835,7 @@
; f339a
Cry_Totodile_Ch5: ; f339a
- unknownmusic0xde $32
+ sound_duty 2, 0, 3, 0
sound __, 9, $f8, $0330
sound __, 9, $f8, $0340
sound __, 9, $c8, $07b2
@@ -845,7 +845,7 @@
; f33b1
Cry_Totodile_Ch6: ; f33b1
- unknownmusic0xde $12
+ sound_duty 2, 0, 1, 0
sound __, 9, $e8, $0320
sound __, 9, $e8, $0328
sound __, 9, $98, $0780
@@ -863,7 +863,7 @@
; f33d5
Cry_Cleffa_Ch5: ; f33d5
- unknownmusic0xde $39
+ sound_duty 1, 2, 3, 0
soundinput $ff
sound __, 3, $f8, $0720
sound __, 3, $f8, $0727
@@ -879,7 +879,7 @@
; f33fc
Cry_Cleffa_Ch6: ; f33fc
- unknownmusic0xde $22
+ sound_duty 2, 0, 2, 0
sound __, 7, $b2, $071e
sound __, 6, $92, $0779
sound __, 5, $82, $073e
@@ -898,7 +898,7 @@
; f3422
Cry_Aipom_Ch5: ; f3422
- unknownmusic0xde $d2
+ sound_duty 2, 0, 1, 3
sound __, 4, $f8, $06b0
sound __, 2, $f8, $06a5
sound __, 2, $f8, $069d
@@ -910,7 +910,7 @@
; f3441
Cry_Aipom_Ch6: ; f3441
- unknownmusic0xde $27
+ sound_duty 3, 1, 2, 0
Cry_Aipom_branch_f3443: ; f3443
sound __, 2, $f1, $07b4
loopchannel 8, Cry_Aipom_branch_f3443
@@ -1167,7 +1167,7 @@
; f35d3
Unknown_Cry_Ch5: ; f35d3
- unknownmusic0xde $f0
+ sound_duty 0, 0, 3, 3
sound __, 16, $e0, $0780
sound __, 16, $f0, $0784
sound __, 16, $c3, $05e0
@@ -1178,7 +1178,7 @@
; f35ee
Unknown_Cry_Ch6: ; f35ee
- unknownmusic0xde $5
+ sound_duty 1, 1, 0, 0
sound __, 16, $a0, $0741
sound __, 16, $b0, $0743
sound __, 16, $93, $05b1
@@ -1200,11 +1200,11 @@
; f361f
Cry_Raichu_Ch5: ; f361f
- unknownmusic0xde $f0
+ sound_duty 0, 0, 3, 3
sound __, 16, $f7, $07a0
sound __, 7, $e6, $07a3
sound __, 11, $f4, $07a0
- unknownmusic0xde $a5
+ sound_duty 1, 1, 2, 2
sound __, 11, $f6, $07d8
sound __, 5, $e3, $07d7
sound __, 16, $f2, $07d8
@@ -1212,12 +1212,12 @@
; f363c
Cry_Raichu_Ch6: ; f363c
- unknownmusic0xde $5
+ sound_duty 1, 1, 0, 0
sound __, 3, $8, 0
sound __, 16, $a7, $06a1
sound __, 7, $86, $06a2
sound __, 11, $74, $06a1
- unknownmusic0xde $5f
+ sound_duty 3, 3, 1, 1
sound __, 11, $76, $06d6
sound __, 5, $83, $06d9
sound __, 16, $a2, $06d7
@@ -1237,7 +1237,7 @@
; f3676
Cry_Vileplume_Ch5: ; f3676
- unknownmusic0xde $f0
+ sound_duty 0, 0, 3, 3
sound __, 16, $f7, $07c0
sound __, 7, $e4, $07c1
sound __, 11, $f6, $07c0
@@ -1247,7 +1247,7 @@
; f368d
Cry_Vileplume_Ch6: ; f368d
- unknownmusic0xde $5f
+ sound_duty 3, 3, 1, 1
sound __, 16, $97, $0781
sound __, 7, $84, $0780
sound __, 11, $96, $0781
@@ -1264,7 +1264,7 @@
; f36ad
Cry_Vulpix_Ch5: ; f36ad
- unknownmusic0xde $f0
+ sound_duty 0, 0, 3, 3
sound __, 16, $f7, $0680
sound __, 11, $e6, $0684
sound __, 16, $d7, $0690
@@ -1277,7 +1277,7 @@
; f36d0
Cry_Vulpix_Ch6: ; f36d0
- unknownmusic0xde $5
+ sound_duty 1, 1, 0, 0
sound __, 16, $b7, $0641
sound __, 11, $96, $0642
sound __, 16, $a7, $0651
@@ -1299,7 +1299,7 @@
; f3703
Cry_Rhydon_Ch5: ; f3703
- unknownmusic0xde $f0
+ sound_duty 0, 0, 3, 3
sound __, 7, $f7, $07a0
sound __, 9, $e6, $07a4
sound __, 5, $d6, $07a0
@@ -1311,7 +1311,7 @@
; f3722
Cry_Rhydon_Ch6: ; f3722
- unknownmusic0xde $a
+ sound_duty 2, 2, 0, 0
sound __, 5, $8, 0
sound __, 7, $a7, $0741
sound __, 9, $86, $0743
@@ -1335,7 +1335,7 @@
; f375b
Cry_Weepinbell_Ch5: ; f375b
- unknownmusic0xde $a5
+ sound_duty 1, 1, 2, 2
sound __, 7, $f4, $0740
sound __, 16, $e3, $0730
sound __, 5, $f4, $0740
@@ -1345,7 +1345,7 @@
; f3772
Cry_Weepinbell_Ch6: ; f3772
- unknownmusic0xde $77
+ sound_duty 3, 1, 3, 1
sound __, 7, $c3, $0712
sound __, 16, $b3, $0704
sound __, 4, $c3, $0712
@@ -1363,7 +1363,7 @@
; f3796
Cry_Kangaskhan_Ch5: ; f3796
- unknownmusic0xde $f0
+ sound_duty 0, 0, 3, 3
sound __, 5, $f7, $0608
sound __, 7, $e6, $0600
sound __, 7, $d7, $05f0
@@ -1375,7 +1375,7 @@
; f37b5
Cry_Kangaskhan_Ch6: ; f37b5
- unknownmusic0xde $a
+ sound_duty 2, 2, 0, 0
sound __, 5, $c7, $0504
sound __, 7, $a6, $0502
sound __, 7, $97, $04f1
@@ -1395,7 +1395,7 @@
; f37e1
Cry_Bulbasaur_Ch5: ; f37e1
- unknownmusic0xde $f1
+ sound_duty 1, 0, 3, 3
sound __, 5, $f7, $07c0
sound __, 13, $e6, $07c2
sound __, 7, $b5, $0680
@@ -1406,7 +1406,7 @@
; f37fc
Cry_Bulbasaur_Ch6: ; f37fc
- unknownmusic0xde $cc
+ sound_duty 0, 3, 0, 3
sound __, 4, $c7, $0781
sound __, 13, $b6, $0780
sound __, 7, $a5, $0641
@@ -1426,7 +1426,7 @@
; f3827
Cry_Spearow_Ch5: ; f3827
- unknownmusic0xde $c9
+ sound_duty 1, 2, 0, 3
sound __, 9, $f7, $0680
sound __, 3, $f7, $0660
sound __, 2, $e7, $0640
@@ -1439,7 +1439,7 @@
; f384a
Cry_Spearow_Ch6: ; f384a
- unknownmusic0xde $79
+ sound_duty 1, 2, 3, 1
sound __, 11, $e7, $0682
sound __, 3, $e7, $0662
sound __, 2, $d7, $0642
@@ -1459,7 +1459,7 @@
; f3877
Cry_Nidoran_M_Ch5: ; f3877
- unknownmusic0xde $f5
+ sound_duty 1, 1, 3, 3
sound __, 5, $f3, $0718
sound __, 16, $e5, $0798
sound __, 9, $91, $0758
@@ -1467,7 +1467,7 @@
; f3886
Cry_Nidoran_M_Ch6: ; f3886
- unknownmusic0xde $a0
+ sound_duty 0, 0, 2, 2
sound __, 6, $b3, $0708
sound __, 16, $c5, $0788
sound __, 9, $71, $0748
@@ -1482,7 +1482,7 @@
; f389f
Cry_Pidgey_Ch5: ; f389f
- unknownmusic0xde $a5
+ sound_duty 1, 1, 2, 2
sound __, 5, $e1, $0700
sound __, 5, $f2, $0780
sound __, 3, $92, $0740
@@ -1491,7 +1491,7 @@
; f38b2
Cry_Pidgey_Ch6: ; f38b2
- unknownmusic0xde $a
+ sound_duty 2, 2, 0, 0
sound __, 5, $b1, $06e1
sound __, 4, $c2, $06e1
sound __, 4, $62, $0681
@@ -1507,7 +1507,7 @@
; f38cf
Cry_Voltorb_Ch5: ; f38cf
- unknownmusic0xde $fa
+ sound_duty 2, 2, 3, 3
sound __, 7, $83, $0247
sound __, 16, $62, $0226
sound __, 5, $52, $0245
@@ -1529,7 +1529,7 @@
; f38fd
Cry_Muk_Ch5: ; f38fd
- unknownmusic0xde $f0
+ sound_duty 0, 0, 3, 3
sound __, 5, $f3, $06e0
sound __, 16, $e4, $0640
sound __, 9, $c1, $0620
@@ -1537,7 +1537,7 @@
; f390c
Cry_Muk_Ch6: ; f390c
- unknownmusic0xde $a
+ sound_duty 2, 2, 0, 0
sound __, 4, $c3, $0683
sound __, 15, $b4, $0602
sound __, 9, $a1, $0601
@@ -1552,7 +1552,7 @@
; f3925
Cry_Grimer_Ch5: ; f3925
- unknownmusic0xde $a
+ sound_duty 2, 2, 0, 0
sound __, 7, $e2, $0500
sound __, 7, $e3, $0580
sound __, 7, $d3, $0570
@@ -1561,7 +1561,7 @@
; f3938
Cry_Grimer_Ch6: ; f3938
- unknownmusic0xde $f5
+ sound_duty 1, 1, 3, 3
sound __, 7, $e2, $0482
sound __, 7, $d3, $0501
sound __, 7, $b2, $04e2
@@ -1571,7 +1571,7 @@
; f394b
Cry_Diglett_Ch5: ; f394b
- unknownmusic0xde $cc
+ sound_duty 0, 3, 0, 3
sound __, 5, $f1, $0700
sound __, 5, $e1, $0780
sound __, 5, $d1, $0740
@@ -1586,7 +1586,7 @@
; f3976
Cry_Diglett_Ch6: ; f3976
- unknownmusic0xde $44
+ sound_duty 0, 1, 0, 1
sound __, 13, $8, 0
sound __, 5, $f1, $0701
sound __, 5, $e1, $0782
@@ -1610,7 +1610,7 @@
; f39ae
Cry_Seel_Ch5: ; f39ae
- unknownmusic0xde $cc
+ sound_duty 0, 3, 0, 3
sound __, 9, $f5, $0600
sound __, 3, $d2, $0638
sound __, 3, $c2, $0630
@@ -1624,7 +1624,7 @@
; f39d5
Cry_Seel_Ch6: ; f39d5
- unknownmusic0xde $44
+ sound_duty 0, 1, 0, 1
sound __, 13, $c3, $05c0
sound __, 4, $b1, $05f9
sound __, 3, $a1, $05f1
@@ -1639,7 +1639,7 @@
; f39fc
Cry_Slowpoke_Ch5: ; f39fc
- unknownmusic0xde $0
+ sound_duty 0, 0, 0, 0
sound __, 9, $f5, $0480
sound __, 3, $e1, $05e0
sound __, 9, $d1, $05dc
@@ -1647,7 +1647,7 @@
; f3a0b
Cry_Slowpoke_Ch6: ; f3a0b
- unknownmusic0xde $a5
+ sound_duty 1, 1, 2, 2
sound __, 8, $95, $0441
sound __, 3, $81, $0521
sound __, 9, $61, $051a
@@ -1657,7 +1657,7 @@
Cry_Drowzee_Ch5: ; f3a1a
Cry_Drowzee_branch_f3a1a: ; f3a1a
- unknownmusic0xde $88
+ sound_duty 0, 2, 0, 2
sound __, 6, $f2, $0650
sound __, 10, $d1, $0660
sound __, 6, $e2, $0612
@@ -1669,7 +1669,7 @@
; f3a39
Cry_Drowzee_Ch6: ; f3a39
- unknownmusic0xde $40
+ sound_duty 0, 0, 0, 1
sound __, 5, $8, 0
sound __, 6, $f2, $0651
sound __, 10, $d1, $0661
@@ -1699,7 +1699,7 @@
; f3a87
Cry_Nidoran_F_Ch5: ; f3a87
- unknownmusic0xde $a0
+ sound_duty 0, 0, 2, 2
sound __, 5, $f3, $0600
sound __, 9, $d5, $0760
sound __, 4, $e2, $0720
@@ -1708,7 +1708,7 @@
; f3a9a
Cry_Nidoran_F_Ch6: ; f3a9a
- unknownmusic0xde $5a
+ sound_duty 2, 2, 1, 1
sound __, 6, $b3, $06f1
sound __, 8, $c5, $0752
sound __, 4, $a2, $0711
@@ -1725,7 +1725,7 @@
; f3aba
Cry_Nidoqueen_Ch5: ; f3aba
- unknownmusic0xde $f0
+ sound_duty 0, 0, 3, 3
sound __, 9, $f7, $06e0
sound __, 7, $e6, $06e5
sound __, 4, $f4, $06e0
@@ -1737,7 +1737,7 @@
; f3ad9
Cry_Nidoqueen_Ch6: ; f3ad9
- unknownmusic0xde $5
+ sound_duty 1, 1, 0, 0
sound __, 4, $8, 0
sound __, 9, $a7, $06a1
sound __, 7, $86, $06a3
@@ -1762,7 +1762,7 @@
; f3b15
Cry_Oddish_Ch5: ; f3b15
- unknownmusic0xde $f0
+ sound_duty 0, 0, 3, 3
sound __, 16, $f6, $0565
sound __, 11, $e4, $057c
sound __, 4, $c2, $055c
@@ -1771,7 +1771,7 @@
; f3b28
Cry_Oddish_Ch6: ; f3b28
- unknownmusic0xde $5a
+ sound_duty 2, 2, 1, 1
sound __, 15, $d6, $0503
sound __, 10, $b4, $051b
sound __, 5, $92, $04fa
@@ -1787,7 +1787,7 @@
; f3b45
Cry_Charmander_Ch5: ; f3b45
- unknownmusic0xde $f0
+ sound_duty 0, 0, 3, 3
sound __, 5, $f7, $06a0
sound __, 9, $e6, $06a4
sound __, 5, $d6, $06a0
@@ -1799,7 +1799,7 @@
; f3b64
Cry_Charmander_Ch6: ; f3b64
- unknownmusic0xde $5a
+ sound_duty 2, 2, 1, 1
sound __, 5, $e7, $0601
sound __, 9, $d6, $0603
sound __, 5, $c6, $0601
@@ -1821,7 +1821,7 @@
; f3b96
Cry_Clefairy_Ch5: ; f3b96
- unknownmusic0xde $1b
+ sound_duty 3, 2, 1, 0
sound __, 8, $d2, $0740
sound __, 16, $e5, $0760
sound C_, 9, $c1, $0730
@@ -1829,7 +1829,7 @@
; f3ba5
Cry_Clefairy_Ch6: ; f3ba5
- unknownmusic0xde $81
+ sound_duty 1, 0, 0, 2
sound __, 3, $c2, $0701
sound __, 5, $c2, $0708
sound __, 16, $d7, $0741
@@ -1839,7 +1839,7 @@
; f3bb8
Cry_Caterpie_Ch5: ; f3bb8
- unknownmusic0xde $f0
+ sound_duty 0, 0, 3, 3
sound __, 16, $d7, $0780
sound __, 5, $e6, $07a0
sound __, 16, $d2, $0740
@@ -1847,7 +1847,7 @@
; f3bc7
Cry_Caterpie_Ch6: ; f3bc7
- unknownmusic0xde $5a
+ sound_duty 2, 2, 1, 1
sound __, 16, $c7, $0753
sound __, 6, $b6, $0772
sound __, 16, $c2, $0711
@@ -1862,7 +1862,7 @@
; f3be0
Cry_Lapras_Ch5: ; f3be0
- unknownmusic0xde $f0
+ sound_duty 0, 0, 3, 3
sound __, 7, $f7, $06c0
sound __, 16, $e7, $0700
sound __, 5, $f4, $06f0
@@ -1872,7 +1872,7 @@
; f3bf7
Cry_Lapras_Ch6: ; f3bf7
- unknownmusic0xde $a
+ sound_duty 2, 2, 0, 0
sound __, 8, $e6, $0681
sound __, 15, $d5, $06c1
sound __, 5, $c4, $06b1
@@ -1890,7 +1890,7 @@
; f3c1b
Cry_Golem_Ch5: ; f3c1b
- unknownmusic0xde $a5
+ sound_duty 1, 1, 2, 2
sound __, 13, $f2, $0440
sound __, 16, $e3, $04a0
sound __, 5, $d2, $0490
@@ -1899,7 +1899,7 @@
; f3c2e
Cry_Golem_Ch6: ; f3c2e
- unknownmusic0xde $ee
+ sound_duty 2, 3, 2, 3
sound __, 12, $d2, $0438
sound __, 15, $c6, $0498
sound __, 4, $b2, $0488
@@ -1916,7 +1916,7 @@
; f3c4e
Cry_Blastoise_Ch5: ; f3c4e
- unknownmusic0xde $33
+ sound_duty 3, 0, 3, 0
sound __, 16, $f6, $05c0
sound __, 9, $e3, $05bc
sound __, 7, $d2, $05d0
@@ -1927,7 +1927,7 @@
; f3c69
Cry_Blastoise_Ch6: ; f3c69
- unknownmusic0xde $99
+ sound_duty 1, 2, 1, 2
sound __, 15, $c6, $04b1
sound __, 8, $c3, $04ad
sound __, 6, $b2, $04c1
@@ -1948,7 +1948,7 @@
; f3c97
Cry_Pidgeotto_Ch5: ; f3c97
- unknownmusic0xde $f0
+ sound_duty 0, 0, 3, 3
sound __, 9, $e4, $0790
sound __, 16, $f5, $07c0
sound __, 9, $d1, $07d8
@@ -1956,7 +1956,7 @@
; f3ca6
Cry_Pidgeotto_Ch6: ; f3ca6
- unknownmusic0xde $a5
+ sound_duty 1, 1, 2, 2
sound __, 11, $c4, $0771
sound __, 16, $b6, $07a2
sound __, 9, $a1, $07b7
@@ -1971,7 +1971,7 @@
; f3cbf
Cry_Paras_Ch5: ; f3cbf
- unknownmusic0xde $f0
+ sound_duty 0, 0, 3, 3
sound __, 7, $f2, $0600
sound __, 7, $e2, $0640
sound __, 7, $d2, $0680
@@ -1984,7 +1984,7 @@
; f3ce2
Cry_Paras_Ch6: ; f3ce2
- unknownmusic0xde $11
+ sound_duty 1, 0, 1, 0
sound __, 4, $8, $0001
sound __, 7, $c2, $05c1
sound __, 7, $b2, $0602
@@ -2011,7 +2011,7 @@
; f3d25
Cry_Weedle_Ch5: ; f3d25
- unknownmusic0xde $f0
+ sound_duty 0, 0, 3, 3
sound __, 5, $f3, $0780
sound __, 16, $e7, $0700
sound __, 9, $d3, $0710
@@ -2022,7 +2022,7 @@
; f3d40
Cry_Weedle_Ch6: ; f3d40
- unknownmusic0xde $5a
+ sound_duty 2, 2, 1, 1
sound __, 7, $c3, $0701
sound __, 15, $b7, $0681
sound __, 8, $b3, $0692
@@ -2043,7 +2043,7 @@
; f3d6e
Cry_Ekans_Ch5: ; f3d6e
- unknownmusic0xde $f
+ sound_duty 3, 3, 0, 0
sound __, 16, $f7, $0500
sound __, 16, $e7, $0508
sound __, 9, $b4, $0480
@@ -2052,7 +2052,7 @@
; f3d81
Cry_Ekans_Ch6: ; f3d81
- unknownmusic0xde $44
+ sound_duty 0, 1, 0, 1
sound __, 15, $d7, $0481
sound __, 15, $c7, $0489
sound __, 11, $b4, $0401
@@ -2069,7 +2069,7 @@
; f3da1
Cry_Metapod_Ch5: ; f3da1
- unknownmusic0xde $f5
+ sound_duty 1, 1, 3, 3
sound __, 8, $d6, $07e1
sound __, 7, $c6, $07e2
sound __, 10, $d6, $07e1
@@ -2082,7 +2082,7 @@
; f3dc4
Cry_Metapod_Ch6: ; f3dc4
- unknownmusic0xde $44
+ sound_duty 0, 1, 0, 1
sound __, 7, $c3, $07c9
sound __, 7, $b3, $07c7
sound __, 11, $c4, $07c3
@@ -2102,7 +2102,7 @@
; f3def
Cry_Venonat_Ch5: ; f3def
- unknownmusic0xde $f0
+ sound_duty 0, 0, 3, 3
sound __, 7, $f7, $0740
sound __, 13, $e6, $0744
sound __, 7, $d5, $0750
@@ -2113,7 +2113,7 @@
; f3e0a
Cry_Venonat_Ch6: ; f3e0a
- unknownmusic0xde $a
+ sound_duty 2, 2, 0, 0
sound __, 7, $c7, $0701
sound __, 12, $b6, $0702
sound __, 7, $a5, $0711
@@ -2134,7 +2134,7 @@
; f3e38
Cry_Squirtle_Ch5: ; f3e38
- unknownmusic0xde $f4
+ sound_duty 0, 1, 3, 3
sound __, 16, $f0, $0705
sound __, 11, $e0, $0700
sound __, 7, $b4, $0710
@@ -2145,7 +2145,7 @@
; f3e53
Cry_Squirtle_Ch6: ; f3e53
- unknownmusic0xde $22
+ sound_duty 2, 0, 2, 0
sound __, 16, $b0, $06c3
sound __, 11, $a0, $06c1
sound __, 7, $84, $06d2
@@ -2165,7 +2165,7 @@
; f3e7e
Cry_Fearow_Ch5: ; f3e7e
- unknownmusic0xde $50
+ sound_duty 0, 0, 1, 1
sound __, 11, $f5, $0680
sound __, 4, $e2, $06a0
sound __, 4, $f2, $06c0
@@ -2178,7 +2178,7 @@
; f3ea1
Cry_Fearow_Ch6: ; f3ea1
- unknownmusic0xde $f
+ sound_duty 3, 3, 0, 0
sound __, 10, $d5, $0631
sound __, 4, $d2, $0652
sound __, 4, $e2, $0671
@@ -2201,7 +2201,7 @@
; f3ed7
Cry_Growlithe_Ch5: ; f3ed7
- unknownmusic0xde $a5
+ sound_duty 1, 1, 2, 2
sound __, 4, $f4, $0641
sound __, 14, $d6, $0721
sound __, 9, $f4, $0719
@@ -2210,7 +2210,7 @@
; f3eea
Cry_Growlithe_Ch6: ; f3eea
- unknownmusic0xde $cc
+ sound_duty 0, 3, 0, 3
sound __, 5, $f4, $0580
sound __, 15, $e6, $06e0
sound __, 9, $d5, $06d8
@@ -2227,7 +2227,7 @@
; f3f0a
Cry_Krabby_Ch5: ; f3f0a
- unknownmusic0xde $f0
+ sound_duty 0, 0, 3, 3
sound __, 14, $f1, $0511
sound __, 14, $e1, $0515
sound __, 14, $e1, $0511
@@ -2236,7 +2236,7 @@
; f3f1d
Cry_Krabby_Ch6: ; f3f1d
- unknownmusic0xde $15
+ sound_duty 1, 1, 1, 0
sound __, 13, $e1, $050c
sound __, 13, $d1, $0510
sound __, 15, $c1, $050c
@@ -2253,7 +2253,7 @@
; f3f3d
Cry_Psyduck_Ch5: ; f3f3d
- unknownmusic0xde $1b
+ sound_duty 3, 2, 1, 0
sound __, 4, $f3, $0564
sound __, 3, $e2, $0544
sound __, 6, $d1, $0522
@@ -2266,7 +2266,7 @@
; f3f60
Cry_Psyduck_Ch6: ; f3f60
- unknownmusic0xde $cc
+ sound_duty 0, 3, 0, 3
sound __, 4, $d3, $0560
sound __, 3, $c2, $0540
sound __, 6, $c1, $0520
@@ -2280,7 +2280,7 @@
; f3f83
Cry_Rattata_Ch5: ; f3f83
- unknownmusic0xde $11
+ sound_duty 1, 0, 1, 0
sound __, 3, $3d, $0381
sound __, 8, $f5, $0601
sound __, 2, $c2, $0481
@@ -2289,7 +2289,7 @@
; f3f96
Cry_Rattata_Ch6: ; f3f96
- unknownmusic0xde $ee
+ sound_duty 2, 3, 2, 3
sound __, 3, $3e, $05b0
sound __, 8, $d5, $075d
sound __, 2, $b2, $06b0
--- a/audio/engine.asm
+++ b/audio/engine.asm
@@ -111,7 +111,7 @@
cp $2 ; 1 or 0?
jr c, .noteover
dec [hl]
- jr .asm_e8093
+ jr .continue_sound_update
.noteover
; reset vibrato delay
@@ -124,12 +124,11 @@
; turn vibrato off for now
ld hl, Channel1Flags2 - Channel1
add hl, bc
- res SOUND_UNKN_09, [hl]
+ res SOUND_PITCH_WHEEL, [hl]
; get next note
call ParseMusic
-.asm_e8093
- ;
- call Functione84f9
+.continue_sound_update
+ call ApplyPitchWheel
; duty cycle
ld hl, Channel1DutyCycle - Channel1
add hl, bc
@@ -143,8 +142,8 @@
ld [wCurTrackFrequency], a
ld a, [hl]
ld [wCurTrackFrequency + 1], a
- ;
- call Functione8466 ; handle vibrato and other things
+ ; vibrato, noise
+ call HandleTrackVibrato ; handle vibrato and other things
call HandleNoise
; turn off music when playing sfx?
ld a, [SFXPriority]
@@ -176,12 +175,12 @@
; are we in a sfx channel right now?
ld a, [CurChannel]
cp $4 ; sfx
- jr nc, .asm_e80ee
+ jr nc, .sfx_channel
ld hl, Channel5Flags - Channel1
add hl, bc
bit SOUND_CHANNEL_ON, [hl]
- jr nz, .asm_e80fc
-.asm_e80ee
+ jr nz, .sound_channel_on
+.sfx_channel
call UpdateChannels
ld hl, Channel1Tracks - Channel1
add hl, bc
@@ -188,7 +187,7 @@
ld a, [SoundOutput]
or [hl]
ld [SoundOutput], a
-.asm_e80fc
+.sound_channel_on
; clear note flags
ld hl, Channel1NoteFlags - Channel1
add hl, bc
@@ -232,7 +231,6 @@
ld l, a
jp [hl]
-
.ChannelFnPtrs:
dw .Channel1
dw .Channel2
@@ -644,7 +642,6 @@
dec a
jr .updatevolume
-
.novolume
; make sure volume is off
xor a
@@ -719,16 +716,16 @@
; e83d1
LoadNote: ; e83d1
- ; check mute??
+ ; wait for pitch wheel to finish
ld hl, Channel1Flags2 - Channel1
add hl, bc
- bit SOUND_UNKN_09, [hl]
+ bit SOUND_PITCH_WHEEL, [hl]
ret z
; get note duration
ld hl, Channel1NoteDuration - Channel1
add hl, bc
ld a, [hl]
- ld hl, wc297 ; ????
+ ld hl, wCurNoteDuration
sub [hl]
jr nc, .ok
ld a, 1
@@ -740,8 +737,8 @@
ld e, [hl]
inc hl
ld d, [hl]
- ; ????
- ld hl, Channel1Field0x21 - Channel1
+ ; get direction of pitch wheel
+ ld hl, Channel1PitchWheelTarget - Channel1
add hl, bc
ld a, e
sub [hl]
@@ -749,15 +746,13 @@
ld a, d
sbc a, 0
ld d, a
- ; ????
- ld hl, Channel1Field0x22 - Channel1
+ ld hl, Channel1PitchWheelTarget + 1 - Channel1
add hl, bc
sub [hl]
jr nc, .greater_than
- ; ????
ld hl, Channel1Flags3 - Channel1
add hl, bc
- set SOUND_UNKN_11, [hl]
+ set SOUND_PITCH_WHEEL_DIR, [hl]
; get frequency
ld hl, Channel1Frequency - Channel1
add hl, bc
@@ -765,7 +760,7 @@
inc hl
ld d, [hl]
; ????
- ld hl, Channel1Field0x21 - Channel1
+ ld hl, Channel1PitchWheelTarget - Channel1
add hl, bc
ld a, [hl]
sub e
@@ -774,7 +769,7 @@
sbc a, 0
ld d, a
; ????
- ld hl, Channel1Field0x22 - Channel1
+ ld hl, Channel1PitchWheelTarget + 1 - Channel1
add hl, bc
ld a, [hl]
sub d
@@ -782,10 +777,9 @@
jr .resume
.greater_than
- ; ????
ld hl, Channel1Flags3 - Channel1
add hl, bc
- res SOUND_UNKN_11, [hl]
+ res SOUND_PITCH_WHEEL_DIR, [hl]
; get frequency
ld hl, Channel1Frequency - Channel1
add hl, bc
@@ -792,8 +786,8 @@
ld e, [hl]
inc hl
ld d, [hl]
- ; ????
- ld hl, Channel1Field0x21 - Channel1
+ ; get distance from pitch wheel target
+ ld hl, Channel1PitchWheelTarget - Channel1
add hl, bc
ld a, e
sub [hl]
@@ -801,15 +795,17 @@
ld a, d
sbc a, 0
ld d, a
- ; ????
- ld hl, Channel1Field0x22 - Channel1
+ ld hl, Channel1PitchWheelTarget + 1 - Channel1
add hl, bc
sub [hl]
ld d, a
.resume
+ ; de = x * [wCurNoteDuration] + y
+ ; x + 1 -> d
+ ; y -> a
push bc
- ld hl, wc297
- ld b, 0; loop count
+ ld hl, wCurNoteDuration
+ ld b, 0 ; quotient
.loop
inc b
ld a, e
@@ -823,18 +819,16 @@
jr .loop
.quit
- ld a, e ; result
+ ld a, e ; remainder
add [hl]
- ld d, b ; loop count
- ; ????
+ ld d, b ; quotient
pop bc
- ld hl, Channel1Field0x23 - Channel1
+ ld hl, Channel1PitchWheelAmount - Channel1
add hl, bc
- ld [hl], d
- ld hl, Channel1Field0x24 - Channel1
+ ld [hl], d ; quotient
+ ld hl, Channel1PitchWheelAmountFraction - Channel1
add hl, bc
- ld [hl], a
- ; clear ????
+ ld [hl], a ; remainder
ld hl, Channel1Field0x25 - Channel1
add hl, bc
xor a
@@ -843,14 +837,13 @@
; e8466
-Functione8466: ; e8466
-; handle vibrato and other things
-; unknowns: wCurTrackDuty, wCurTrackFrequency
+HandleTrackVibrato: ; e8466
+; handle duty, cry pitch, and vibrato
ld hl, Channel1Flags2 - Channel1
add hl, bc
bit SOUND_DUTY, [hl] ; duty
jr z, .next
- ld hl, Channel1Field0x1c - Channel1
+ ld hl, Channel1SFXDutyLoop - Channel1
add hl, bc
ld a, [hl]
rlca
@@ -963,11 +956,11 @@
; e84f9
-Functione84f9: ; e84f9
- ; quit if ????
+ApplyPitchWheel: ; e84f9
+ ; quit if pitch wheel inactive
ld hl, Channel1Flags2 - Channel1
add hl, bc
- bit SOUND_UNKN_09, [hl]
+ bit SOUND_PITCH_WHEEL, [hl]
ret z
; de = Frequency
ld hl, Channel1Frequency - Channel1
@@ -975,13 +968,13 @@
ld e, [hl]
inc hl
ld d, [hl]
- ;
+ ; check whether pitch wheel is going up or down
ld hl, Channel1Flags3 - Channel1
add hl, bc
- bit SOUND_UNKN_11, [hl]
- jr z, .next
- ;
- ld hl, Channel1Field0x23 - Channel1
+ bit SOUND_PITCH_WHEEL_DIR, [hl]
+ jr z, .decreasing
+ ; frequency += [Channel*PitchWheelAmount]
+ ld hl, Channel1PitchWheelAmount - Channel1
add hl, bc
ld l, [hl]
ld h, 0
@@ -988,11 +981,11 @@
add hl, de
ld d, h
ld e, l
- ; get ????
- ld hl, Channel1Field0x24 - Channel1
+ ; [Channel*Field0x25] += [Channel*PitchWheelAmountFraction]
+ ; if rollover: Frequency += 1
+ ld hl, Channel1PitchWheelAmountFraction - Channel1
add hl, bc
ld a, [hl]
- ; add it to ????
ld hl, Channel1Field0x25 - Channel1
add hl, bc
add [hl]
@@ -1003,23 +996,26 @@
ld a, 0
adc d
ld d, a
- ;
- ld hl, Channel1Field0x22 - Channel1
+ ; Compare the dw at [Channel*PitchWheelTarget] to de.
+ ; If frequency is greater, we're finished.
+ ; Otherwise, load the frequency and set two flags.
+ ld hl, Channel1PitchWheelTarget + 1 - Channel1
add hl, bc
ld a, [hl]
cp d
- jp c, .quit1
- jr nz, .quit2
- ld hl, Channel1Field0x21 - Channel1
+ jp c, .finished_pitch_wheel
+ jr nz, .continue_pitch_wheel
+ ld hl, Channel1PitchWheelTarget - Channel1
add hl, bc
ld a, [hl]
cp e
- jp c, .quit1
- jr .quit2
+ jp c, .finished_pitch_wheel
+ jr .continue_pitch_wheel
-.next
+.decreasing
+ ; frequency -= [Channel*PitchWheelAmount]
ld a, e
- ld hl, Channel1Field0x23 - Channel1
+ ld hl, Channel1PitchWheelAmount - Channel1
add hl, bc
ld e, [hl]
sub e
@@ -1027,7 +1023,9 @@
ld a, d
sbc a, 0
ld d, a
- ld hl, Channel1Field0x24 - Channel1
+ ; [Channel*Field0x25] *= 2
+ ; if rollover: Frequency -= 1
+ ld hl, Channel1PitchWheelAmountFraction - Channel1
add hl, bc
ld a, [hl]
add a
@@ -1037,28 +1035,31 @@
ld e, a
ld a, d
sbc a, 0
- ld d,a
- ld hl, Channel1Field0x22 - Channel1
+ ld d, a
+ ; Compare the dw at [Channel*PitchWheelTarget] to de.
+ ; If frequency is lower, we're finished.
+ ; Otherwise, load the frequency and set two flags.
+ ld hl, Channel1PitchWheelTarget + 1 - Channel1
add hl, bc
ld a, d
cp [hl]
- jr c, .quit1
- jr nz, .quit2
- ld hl, Channel1Field0x21 - Channel1
+ jr c, .finished_pitch_wheel
+ jr nz, .continue_pitch_wheel
+ ld hl, Channel1PitchWheelTarget - Channel1
add hl, bc
ld a, e
cp [hl]
- jr nc, .quit2
-.quit1
+ jr nc, .continue_pitch_wheel
+.finished_pitch_wheel
ld hl, Channel1Flags2 - Channel1
add hl, bc
- res SOUND_UNKN_09, [hl]
+ res SOUND_PITCH_WHEEL, [hl]
ld hl, Channel1Flags3 - Channel1
add hl, bc
- res SOUND_UNKN_11, [hl]
+ res SOUND_PITCH_WHEEL_DIR, [hl]
ret
-.quit2
+.continue_pitch_wheel
ld hl, Channel1Frequency - Channel1
add hl, bc
ld [hl], e
@@ -1170,9 +1171,9 @@
ld hl, Channel1Flags - Channel1
add hl, bc
bit SOUND_SFX, [hl]
- jp nz, Functione8698
+ jp nz, ParseSFXOrRest
bit SOUND_REST, [hl] ; rest
- jp nz, Functione8698
+ jp nz, ParseSFXOrRest
bit SOUND_NOISE, [hl] ; noise sample
jp nz, GetNoiseSample
; normal note
@@ -1208,8 +1209,6 @@
set NOTE_UNKN_4, [hl]
jp LoadNote
-
-
.rest
; note = rest
ld hl, Channel1NoteFlags - Channel1
@@ -1217,7 +1216,6 @@
set NOTE_REST, [hl] ; Rest
ret
-;
.endchannel
; $ff is reached in music data
ld hl, Channel1Flags - Channel1
@@ -1286,7 +1284,7 @@
; e8698
-Functione8698: ; e8698
+ParseSFXOrRest: ; e8698
; turn noise sampling on
ld hl, Channel1NoteFlags - Channel1
add hl, bc
@@ -1348,9 +1346,8 @@
ld d, 0
; load ptr to noise sample set in hl
ld hl, Drumkits
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -1363,9 +1360,8 @@
; use 'pitch' to seek noise sample set
ld e, a
ld d, 0
-rept 2
add hl, de
-endr
+ add hl, de
; load sample pointer into NoiseSampleAddress
ld a, [hli]
ld [NoiseSampleAddressLo], a
@@ -1387,9 +1383,8 @@
ld d, 0
; seek command pointer
ld hl, MusicCommands
-rept 2
add hl, de
-endr
+ add hl, de
; jump to the new pointer
ld a, [hli]
ld h, [hl]
@@ -1415,9 +1410,9 @@
dw Music_DutyCycle ; duty cycle
dw Music_Intensity ; intensity
dw Music_SoundStatus ; update sound status
- dw MusicDE ; ???? + duty cycle
- dw Music_ToggleSFX ;
- dw MusicE0 ;
+ dw Music_SoundDuty ; sfx duty
+ dw Music_ToggleSFX ; sound on/off
+ dw Music_SlidePitchTo ; pitch wheel
dw Music_Vibrato ; vibrato
dw MusicE2 ; unused
dw Music_ToggleNoise ; music noise sampling
@@ -1443,8 +1438,8 @@
dw MusicF7 ; nothing
dw MusicF8 ; nothing
dw MusicF9 ; unused
- dw Music_SetCondition ;
- dw Music_JumpIf ;
+ dw Music_SetCondition ; setcondition
+ dw Music_JumpIf ; jumpif
dw Music_JumpChannel ; jump
dw Music_LoopChannel ; loop
dw Music_CallChannel ; call
@@ -1639,9 +1634,8 @@
inc hl
ld d, [hl]
; skip pointer
-rept 2
inc de
-endr
+ inc de
; update address
ld [hl], d
dec hl
@@ -1693,9 +1687,8 @@
inc hl
ld d, [hl]
; skip pointer
-rept 2
inc de
-endr
+ inc de
; update address
ld [hl], d
dec hl
@@ -1801,31 +1794,35 @@
; e88bd
-MusicE0: ; e88bd
-; ????
+Music_SlidePitchTo: ; e88bd
+; set the target for pitch wheel
; params: 2
+; note duration
+; target note
call GetMusicByte
- ld [wc297], a
+ ld [wCurNoteDuration], a
call GetMusicByte
+ ; pitch in e
ld d, a
and $f
ld e, a
+ ; octave in d
ld a, d
swap a
and $f
ld d, a
call GetFrequency
- ld hl, Channel1Field0x21 - Channel1
+ ld hl, Channel1PitchWheelTarget - Channel1
add hl, bc
ld [hl], e
- ld hl, Channel1Field0x22 - Channel1
+ ld hl, Channel1PitchWheelTarget + 1 - Channel1
add hl, bc
ld [hl], d
ld hl, Channel1Flags2 - Channel1
add hl, bc
- set SOUND_UNKN_09, [hl]
+ set SOUND_PITCH_WHEEL, [hl]
ret
; e88e4
@@ -1832,7 +1829,7 @@
Music_Tone: ; e88e4
; tone
-; params: 2
+; params: 1 (dw)
ld hl, Channel1Flags2 - Channel1
add hl, bc
set SOUND_CRY_PITCH, [hl]
@@ -1860,18 +1857,17 @@
; e8906
-MusicDE: ; e8906
-; ???? + duty cycle
-; params: 1
- ;
+Music_SoundDuty: ; e8906
+; sequence of 4 duty cycles to be looped
+; params: 1 (4 2-bit duty cycle arguments)
ld hl, Channel1Flags2 - Channel1
add hl, bc
set SOUND_DUTY, [hl] ; duty cycle
- ;
+ ; sound duty sequence
call GetMusicByte
rrca
rrca
- ld hl, Channel1Field0x1c - Channel1
+ ld hl, Channel1SFXDutyLoop - Channel1
add hl, bc
ld [hl], a
; update duty cycle
@@ -2055,7 +2051,7 @@
; this forces all notes up by the starting octave
; params: 1
call GetMusicByte
- ld hl, Channel1StartingOctave - Channel1
+ ld hl, Channel1PitchOffset - Channel1
add hl, bc
ld [hl], a
ret
@@ -2247,7 +2243,7 @@
; get octave
; get starting octave
- ld hl, Channel1StartingOctave - Channel1
+ ld hl, Channel1PitchOffset - Channel1
add hl, bc
ld a, [hl]
swap a ; hi nybble
@@ -2256,7 +2252,7 @@
add d
push af ; we'll use this later
; get starting octave
- ld hl, Channel1StartingOctave - Channel1
+ ld hl, Channel1PitchOffset - Channel1
add hl, bc
ld a, [hl]
and $f ; lo nybble
@@ -2494,9 +2490,9 @@
; 3-byte pointers (bank, address)
ld hl, Cries
-rept 3
add hl, de
-endr
+ add hl, de
+ add hl, de
ld a, [hli]
ld [MusicBank], a
@@ -2574,7 +2570,6 @@
dec a
jr nz, .loop
-
; Cries play at max volume, so we save the current volume for later.
ld a, [LastVolume]
and a
@@ -2694,7 +2689,6 @@
; e8ca6
-
PlayStereoSFX:: ; e8ca6
; play sfx de
@@ -2713,9 +2707,9 @@
; get sfx ptr
ld hl, SFX
-rept 3
add hl, de
-endr
+ add hl, de
+ add hl, de
; bank
ld a, [hli]
@@ -2798,7 +2792,6 @@
; e8d1b
-
LoadChannel: ; e8d1b
; prep channel for use
; input:
@@ -2811,9 +2804,8 @@
ld c, a
ld b, 0
ld hl, ChannelPointers
-rept 2
add hl, bc
-endr
+ add hl, bc
ld c, [hl]
inc hl
ld b, [hl] ; bc = channel pointer
@@ -2891,31 +2883,31 @@
; e8d80
FrequencyTable: ; e8d80
- dw 0 ; filler
- dw $f82c
- dw $f89d
- dw $f907
- dw $f96b
- dw $f9ca
- dw $fa23
- dw $fa77
- dw $fac7
- dw $fb12
- dw $fb58
- dw $fb9b
- dw $fbda
- dw $fc16
- dw $fc4e
- dw $fc83
- dw $fcb5
- dw $fce5
- dw $fd11
- dw $fd3b
- dw $fd63
- dw $fd89
- dw $fdac
- dw $fdcd
- dw $fded
+ dw 0 ; __
+ dw $f82c ; C_
+ dw $f89d ; C#
+ dw $f907 ; D_
+ dw $f96b ; D#
+ dw $f9ca ; E_
+ dw $fa23 ; F_
+ dw $fa77 ; F#
+ dw $fac7 ; G_
+ dw $fb12 ; G#
+ dw $fb58 ; A_
+ dw $fb9b ; A#
+ dw $fbda ; B_
+ dw $fc16 ; C_
+ dw $fc4e ; C#
+ dw $fc83 ; D_
+ dw $fcb5 ; D#
+ dw $fce5 ; E_
+ dw $fd11 ; F_
+ dw $fd3b ; F#
+ dw $fd63 ; G_
+ dw $fd89 ; G#
+ dw $fdac ; A_
+ dw $fdcd ; A#
+ dw $fded ; B_
; e8db2
WaveSamples: ; e8db2
@@ -3282,9 +3274,8 @@
; doesn't seem to be used, but functionally identical to MapSetup_Sound_Off
ld hl, rNR50
xor a
-rept 2
ld [hli], a
-endr
+ ld [hli], a
ld a, $80
ld [hli], a
ld hl, rNR10
--- a/audio/music/clair.asm
+++ b/audio/music/clair.asm
@@ -207,9 +207,9 @@
octave 3
note A#, 16
note __, 4
- forceoctave $c
+ pitchoffset 0, CC
callchannel Music_Clair_branch_1fba6
- forceoctave $0
+ pitchoffset 0, C_
octave 5
note F#, 2
note __, 4
@@ -254,7 +254,7 @@
Music_Clair_Ch3: ; 1fbb9
notetype $c, $14
- forceoctave $c
+ pitchoffset 0, CC
octave 3
note C#, 2
note __, 4
--- a/audio/music/credits.asm
+++ b/audio/music/credits.asm
@@ -142,12 +142,12 @@
note E_, 7
octave 3
note __, 1
- forceoctave $2
+ pitchoffset 0, D_
callchannel Music_Credits_branch_1f483
callchannel Music_Credits_branch_1f4ed
callchannel Music_Credits_branch_1f4f8
callchannel Music_Credits_branch_1f559
- forceoctave $0
+ pitchoffset 0, C_
octave 3
note A_, 12
notetype $8, $a7
@@ -664,11 +664,11 @@
note A_, 4
note G_, 4
notetype $6, $c7
- forceoctave $2
+ pitchoffset 0, D_
callchannel Music_Credits_branch_1f6cb
callchannel Music_Credits_branch_1f73f
callchannel Music_Credits_branch_1f748
- forceoctave $0
+ pitchoffset 0, C_
octave 5
note C#, 1
note D_, 11
@@ -1139,15 +1139,15 @@
note F_, 1
note F#, 7
note G_, 8
- forceoctave $2
+ pitchoffset 0, D_
callchannel Music_Credits_branch_1f8aa
callchannel Music_Credits_branch_1f8db
- forceoctave $12
+ pitchoffset 1, D_
callchannel Music_Credits_branch_1f8e7
- forceoctave $2
+ pitchoffset 0, D_
callchannel Music_Credits_branch_1f934
callchannel Music_Credits_branch_1f94b
- forceoctave $0
+ pitchoffset 0, C_
octave 6
note C#, 2
octave 5
--- a/audio/music/evolution.asm
+++ b/audio/music/evolution.asm
@@ -13,13 +13,13 @@
dutycycle $2
notetype $c, $92
octave 3
- unknownmusic0xe0 $0, 4, A_
+ slidepitchto 1, 4, A_
note C_, 1
- unknownmusic0xe0 $0, 4, A_
+ slidepitchto 1, 4, A_
note G_, 1
- unknownmusic0xe0 $0, 4, A_
+ slidepitchto 1, 4, A_
note C_, 1
- unknownmusic0xe0 $0, 4, A_
+ slidepitchto 1, 4, A_
note G_, 1
note __, 4
dutycycle $3
--- a/audio/music/goldenrodcity.asm
+++ b/audio/music/goldenrodcity.asm
@@ -275,9 +275,8 @@
vibrato $8, $23
notetype $c, $25
Music_GoldenrodCity_branch_eb58c: ; eb58c
-rept 2
callchannel Music_GoldenrodCity_branch_eb5aa
-endr
+ callchannel Music_GoldenrodCity_branch_eb5aa
callchannel Music_GoldenrodCity_branch_eb5d2
note __, 3
octave 3
--- a/audio/music/healpokemon.asm
+++ b/audio/music/healpokemon.asm
@@ -11,16 +11,16 @@
tone $0001
notetype $c, $81
note __, 2
- unknownmusic0xe0 $0, 4, __
+ slidepitchto 1, 4, __
note B_, 2
- unknownmusic0xe0 $0, 5, E_
+ slidepitchto 1, 5, E_
note B_, 2
- unknownmusic0xe0 $0, 4, E_
+ slidepitchto 1, 4, E_
note E_, 2
note __, 4
- unknownmusic0xe0 $0, 3, __
+ slidepitchto 1, 3, __
note E_, 4
- unknownmusic0xe0 $0, 4, __
+ slidepitchto 1, 4, __
note B_, 4
endchannel
; f06c4
--- a/audio/music/johtowildbattle.asm
+++ b/audio/music/johtowildbattle.asm
@@ -492,9 +492,8 @@
note G_, 2
loopchannel 7, Music_JohtoWildBattle_branch_f5fdb
note F#, 4
-rept 2
callchannel Music_JohtoWildBattle_branch_f6055
-endr
+ callchannel Music_JohtoWildBattle_branch_f6055
Music_JohtoWildBattle_branch_f5fe8: ; f5fe8
note D_, 2
note G_, 2
--- a/audio/music/kantotrainerbattle.asm
+++ b/audio/music/kantotrainerbattle.asm
@@ -9,7 +9,7 @@
Music_KantoTrainerBattle_Ch1: ; eca04
tempo 114
volume $77
- forceoctave $1b
+ pitchoffset 1, B_
notetype $c, $b3
vibrato $12, $24
dutycycle $1
@@ -467,7 +467,7 @@
; ecbea
Music_KantoTrainerBattle_Ch2: ; ecbea
- forceoctave $1b
+ pitchoffset 1, B_
vibrato $6, $36
dutycycle $1
notetype $c, $d1
@@ -920,7 +920,7 @@
; ecdd2
Music_KantoTrainerBattle_Ch3: ; ecdd2
- forceoctave $1b
+ pitchoffset 1, B_
vibrato $12, $23
notetype $c, $15
octave 2
--- a/audio/music/kantowildbattle.asm
+++ b/audio/music/kantowildbattle.asm
@@ -325,25 +325,21 @@
note F_, 1
note F#, 1
notetype $6, $b7
-rept 2
callchannel Music_KantoWildBattle_branch_ed307
-endr
- forceoctave $1
-rept 2
callchannel Music_KantoWildBattle_branch_ed307
-endr
- forceoctave $0
+ pitchoffset 0, C#
+ callchannel Music_KantoWildBattle_branch_ed307
+ callchannel Music_KantoWildBattle_branch_ed307
+ pitchoffset 0, C_
rept 4
callchannel Music_KantoWildBattle_branch_ed307
endr
- forceoctave $1
-rept 2
+ pitchoffset 0, C#
callchannel Music_KantoWildBattle_branch_ed307
-endr
- forceoctave $0
-rept 2
callchannel Music_KantoWildBattle_branch_ed307
-endr
+ pitchoffset 0, C_
+ callchannel Music_KantoWildBattle_branch_ed307
+ callchannel Music_KantoWildBattle_branch_ed307
note __, 16
octave 3
note A#, 16
@@ -388,9 +384,9 @@
note G#, 1
notetype $6, $b7
callchannel Music_KantoWildBattle_branch_ed31b
- forceoctave $1
+ pitchoffset 0, C#
callchannel Music_KantoWildBattle_branch_ed31b
- forceoctave $0
+ pitchoffset 0, C_
callchannel Music_KantoWildBattle_branch_ed340
octave 2
note C_, 2
@@ -454,9 +450,9 @@
callchannel Music_KantoWildBattle_branch_ed354
callchannel Music_KantoWildBattle_branch_ed340
callchannel Music_KantoWildBattle_branch_ed354
- forceoctave $1
+ pitchoffset 0, C#
callchannel Music_KantoWildBattle_branch_ed340
- forceoctave $0
+ pitchoffset 0, C_
note C#, 2
note __, 2
octave 3
--- a/audio/music/lookofficer.asm
+++ b/audio/music/lookofficer.asm
@@ -73,9 +73,9 @@
note E_, 2
note G#, 2
loopchannel 2, Music_LookOfficer_branch_ed882
- forceoctave $1
+ pitchoffset 0, C#
callchannel Music_LookOfficer_branch_ed89e
- forceoctave $0
+ pitchoffset 0, C_
callchannel Music_LookOfficer_branch_ed89e
loopchannel 0, Music_LookOfficer_branch_ed882
; ed89e
--- a/audio/music/lookrocket.asm
+++ b/audio/music/lookrocket.asm
@@ -8,7 +8,7 @@
Music_LookRocket_Ch1: ; f74ae
tempo 123
volume $77
- forceoctave $2
+ pitchoffset 0, D_
stereopanning $f
dutycycle $3
vibrato $5, $64
@@ -94,7 +94,7 @@
; f7514
Music_LookRocket_Ch2: ; f7514
- forceoctave $2
+ pitchoffset 0, D_
vibrato $4, $64
dutycycle $3
notetype $c, $b7
@@ -216,7 +216,7 @@
; f7597
Music_LookRocket_Ch3: ; f7597
- forceoctave $2
+ pitchoffset 0, D_
vibrato $4, $22
notetype $c, $14
stereopanning $f0
--- a/audio/music/postcredits.asm
+++ b/audio/music/postcredits.asm
@@ -8,7 +8,7 @@
Music_PostCredits_Ch1: ; cfda5
tempo 271
volume $77
- forceoctave $3
+ pitchoffset 0, D#
dutycycle $2
notetype $c, $93
note __, 8
@@ -133,7 +133,7 @@
; cfe48
Music_PostCredits_Ch2: ; cfe48
- forceoctave $3
+ pitchoffset 0, D#
dutycycle $2
notetype $c, $a3
octave 5
--- a/audio/music/profoak.asm
+++ b/audio/music/profoak.asm
@@ -34,10 +34,10 @@
callchannel Music_ProfOak_branch_f4e58
callchannel Music_ProfOak_branch_f4e6c
callchannel Music_ProfOak_branch_f4e6c
- forceoctave $2
+ pitchoffset 0, D_
callchannel Music_ProfOak_branch_f4e58
callchannel Music_ProfOak_branch_f4e58
- forceoctave $0
+ pitchoffset 0, C_
callchannel Music_ProfOak_branch_f4e6c
callchannel Music_ProfOak_branch_f4e6c
loopchannel 0, Music_ProfOak_branch_f4e22
@@ -241,10 +241,10 @@
callchannel Music_ProfOak_branch_f4f5a
callchannel Music_ProfOak_branch_f4f69
callchannel Music_ProfOak_branch_f4f69
- forceoctave $2
+ pitchoffset 0, D_
callchannel Music_ProfOak_branch_f4f5a
callchannel Music_ProfOak_branch_f4f5a
- forceoctave $0
+ pitchoffset 0, C_
callchannel Music_ProfOak_branch_f4f69
callchannel Music_ProfOak_branch_f4f69
loopchannel 0, Music_ProfOak_branch_f4f1d
--- a/audio/music/ssaqua.asm
+++ b/audio/music/ssaqua.asm
@@ -276,9 +276,9 @@
octave 4
note C#, 1
note E_, 1
- forceoctave $c
+ pitchoffset 0, CC
callchannel Music_SSAqua_branch_eafe0
- forceoctave $0
+ pitchoffset 0, C_
octave 3
note B_, 1
note __, 1
--- a/audio/music/surf.asm
+++ b/audio/music/surf.asm
@@ -425,7 +425,7 @@
note B_, 16
octave 4
note C#, 8
- forceoctave $c
+ pitchoffset 0, CC
dutycycle $3
callchannel Music_Surf_branch_f53d6
intensity $b8
@@ -436,7 +436,7 @@
intensity $b8
dutycycle $1
callchannel Music_Surf_branch_f5404
- forceoctave $0
+ pitchoffset 0, C_
notetype $c, $b8
octave 4
note B_, 12
--- a/audio/music/wildpokemonvictory.asm
+++ b/audio/music/wildpokemonvictory.asm
@@ -29,7 +29,7 @@
intensity $78
octave 3
note G_, 4
- forceoctave $1
+ pitchoffset 0, C#
callchannel Music_WildPokemonVictory_branch_f455c
note F#, 2
note F#, 2
@@ -36,7 +36,7 @@
note F#, 4
callchannel Music_WildPokemonVictory_branch_f455c
note G#, 4
- forceoctave $0
+ pitchoffset 0, C_
intensity $78
octave 3
note F#, 4
@@ -97,7 +97,7 @@
note E_, 1
note G_, 1
note A#, 1
- forceoctave $1
+ pitchoffset 0, C#
callchannel Music_WildPokemonVictory_branch_f45b5
octave 4
note B_, 2
@@ -106,7 +106,7 @@
callchannel Music_WildPokemonVictory_branch_f45b5
octave 4
note B_, 4
- forceoctave $0
+ pitchoffset 0, C_
intensity $81
octave 3
note B_, 1
@@ -156,7 +156,7 @@
note E_, 2
note __, 2
note C_, 4
- forceoctave $1
+ pitchoffset 0, C#
callchannel Music_WildPokemonVictory_branch_f45f4
note D#, 2
note C#, 2
@@ -166,7 +166,7 @@
callchannel Music_WildPokemonVictory_branch_f45f4
note E_, 2
note __, 2
- forceoctave $0
+ pitchoffset 0, C_
octave 2
note B_, 4
loopchannel 0, Music_WildPokemonVictory_branch_f45cf
--- a/audio/sfx.asm
+++ b/audio/sfx.asm
@@ -1957,9 +1957,9 @@
note F_, 3
callchannel Sfx_GetBadge_branch_f11aa
note A#, 3
- forceoctave $2
+ pitchoffset 0, D_
callchannel Sfx_GetBadge_branch_f11aa
- forceoctave $0
+ pitchoffset 0, C_
intensity $a7
note A_, 16
note __, 6
@@ -2322,7 +2322,7 @@
; f133a
Sfx_Aeroblast_Ch5: ; f133a
- unknownmusic0xde $f2
+ sound_duty 2, 0, 3, 3
soundinput $f5
sound C_, 13, $f8, $0580
soundinput $8
@@ -4762,7 +4762,7 @@
; f21fc
Sfx_Supersonic_Ch6: ; f21fc
- unknownmusic0xde $b3
+ sound_duty 3, 0, 3, 2
sound __, 16, $2f, $07c8
Sfx_Supersonic_branch_f2202: ; f2202
sound __, 16, $cf, $07c7
@@ -4790,7 +4790,7 @@
Sfx_Leer_Ch6: ; f2229
Sfx_Leer_branch_f2229: ; f2229
- unknownmusic0xde $b3
+ sound_duty 3, 0, 3, 2
sound __, 1, $e1, $07c1
sound __, 1, $e1, $0701
loopchannel 12, Sfx_Leer_branch_f2229
@@ -4807,7 +4807,7 @@
Sfx_Ember_Ch5: ; f2243
Sfx_Ember_branch_f2243: ; f2243
- unknownmusic0xde $c9
+ sound_duty 1, 2, 0, 3
sound __, 12, $f3, $0120
sound __, 10, $d3, $0150
loopchannel 5, Sfx_Ember_branch_f2243
@@ -4829,7 +4829,7 @@
Sfx_Bubblebeam_Ch5: ; f226e
Sfx_Bubblebeam_branch_f226e: ; f226e
- unknownmusic0xde $39
+ sound_duty 1, 2, 3, 0
sound __, 5, $f4, $0600
sound __, 4, $c4, $0500
sound __, 6, $b5, $0600
@@ -4841,7 +4841,7 @@
Sfx_Bubblebeam_Ch6: ; f2289
Sfx_Bubblebeam_branch_f2289: ; f2289
- unknownmusic0xde $8d
+ sound_duty 1, 3, 0, 2
sound __, 6, $e4, $05e0
sound __, 5, $b4, $04e0
sound __, 7, $a5, $05e8
@@ -4862,7 +4862,7 @@
Sfx_HydroPump_Ch5: ; f22b1
Sfx_HydroPump_branch_f22b1: ; f22b1
- unknownmusic0xde $d2
+ sound_duty 2, 0, 1, 3
sound __, 4, $81, $0300
sound __, 4, $c1, $0400
sound __, 4, $f1, $0500
@@ -4887,7 +4887,7 @@
Sfx_Surf_Ch5: ; f22e7
Sfx_Surf_branch_f22e7: ; f22e7
- unknownmusic0xde $39
+ sound_duty 1, 2, 3, 0
sound __, 16, $f4, $0500
sound __, 16, $c4, $0400
sound __, 16, $e2, $05c0
@@ -4897,7 +4897,7 @@
Sfx_Surf_Ch6: ; f22fa
Sfx_Surf_branch_f22fa: ; f22fa
- unknownmusic0xde $8d
+ sound_duty 1, 3, 0, 2
sound __, 8, $e4, $0430
sound __, 16, $b4, $0330
sound __, 16, $a2, $0438
@@ -4917,7 +4917,7 @@
Sfx_Psybeam_Ch5: ; f231e
Sfx_Psybeam_branch_f231e: ; f231e
- unknownmusic0xde $a1
+ sound_duty 1, 0, 2, 2
sound __, 11, $f1, $0640
sound __, 11, $f3, $0680
sound __, 11, $f2, $0620
@@ -4928,7 +4928,7 @@
Sfx_Psybeam_Ch6: ; f2335
Sfx_Psybeam_branch_f2335: ; f2335
- unknownmusic0xde $b3
+ sound_duty 3, 0, 3, 2
sound __, 11, $f3, $0571
sound __, 8, $e3, $0531
sound __, 11, $f1, $0551
@@ -4958,7 +4958,7 @@
Sfx_Charge_Ch6: ; f236e
Sfx_Charge_branch_f236e: ; f236e
- unknownmusic0xde $b3
+ sound_duty 3, 0, 3, 2
sound __, 3, $e1, $0302
sound __, 4, $e1, $07f2
sound __, 5, $e1, $0602
@@ -4979,7 +4979,7 @@
Sfx_Thundershock_Ch5: ; f2396
Sfx_Thundershock_branch_f2396: ; f2396
- unknownmusic0xde $2b
+ sound_duty 3, 2, 2, 0
sound __, 4, $f1, $07f0
sound __, 5, $f2, $0200
loopchannel 8, Sfx_Thundershock_branch_f2396
@@ -4988,7 +4988,7 @@
Sfx_Thundershock_Ch6: ; f23a5
Sfx_Thundershock_branch_f23a5: ; f23a5
- unknownmusic0xde $b3
+ sound_duty 3, 0, 3, 2
sound __, 5, $e2, $0202
sound __, 5, $e1, $07e2
loopchannel 9, Sfx_Thundershock_branch_f23a5
@@ -5092,7 +5092,7 @@
; f247a
Sfx_EggBomb_Ch5: ; f247a
- unknownmusic0xde $ed
+ sound_duty 1, 3, 2, 3
sound __, 9, $ff, $03f8
sound __, 16, $ff, $0400
sound __, 16, $f3, $0400
@@ -5100,7 +5100,7 @@
; f2489
Sfx_EggBomb_Ch6: ; f2489
- unknownmusic0xde $b4
+ sound_duty 0, 1, 3, 2
sound __, 9, $ef, $03c0
sound __, 16, $ef, $03c0
sound __, 16, $e3, $03c0
@@ -5168,7 +5168,7 @@
; f2509
Sfx_HyperBeam_Ch6: ; f2509
- unknownmusic0xde $b3
+ sound_duty 3, 0, 3, 2
sound __, 3, $f1, $0781
sound __, 3, $f1, $0701
sound __, 3, $f1, $0791
--- a/audio/sfx_crystal.asm
+++ b/audio/sfx_crystal.asm
@@ -169,7 +169,7 @@
dutycycle $2
notetype $2, $b1
soundinput $ff
- forceoctave $1a
+ pitchoffset 1, A#
octave 5
note C_, 2
note E_, 2
@@ -194,7 +194,7 @@
Sfx_Tingle_Ch5: ; 179964
togglesfx
dutycycle $1
- forceoctave $b
+ pitchoffset 0, B_
notetype $1, $b1
Sfx_Tingle_branch_17996c: ; 17996c
octave 5
@@ -234,7 +234,7 @@
togglesfx
dutycycle $2
notetype $2, $e8
- forceoctave $2
+ pitchoffset 0, D_
octave 4
note C_, 2
intensity $48
@@ -279,7 +279,7 @@
Sfx_Twinkle_Ch5: ; 1799ce
togglesfx
dutycycle $0
- forceoctave $2
+ pitchoffset 0, D_
notetype $2, $e1
octave 3
note G_, 2
--- a/battle/ai/items.asm
+++ b/battle/ai/items.asm
@@ -196,9 +196,9 @@
jr z, .has_item
dec de
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
jr .loop
.has_item
@@ -216,9 +216,8 @@
pop de
pop hl
-rept 2
inc hl
-endr
+ inc hl
jr c, .loop
.used_item
@@ -572,13 +571,13 @@
EnemyUsedMaxPotion: ; 383ae (e:43ae)
ld a, MAX_POTION
- ld [wd1f1], a
+ ld [CurEnemyItem], a
jr FullRestoreContinue
EnemyUsedFullRestore: ; 383b5 (e:43b5)
call AI_HealStatus
ld a, FULL_RESTORE
- ld [wd1f1], a
+ ld [CurEnemyItem], a
ld hl, EnemySubStatus3
res SUBSTATUS_CONFUSED, [hl]
xor a
@@ -585,7 +584,7 @@
ld [EnemyConfuseCount], a
FullRestoreContinue: ; 383c6
- ld de, wd1ec
+ ld de, wCurHPAnimOldHP
ld hl, EnemyMonHP + 1
ld a, [hld]
ld [de], a
@@ -597,11 +596,11 @@
ld a, [hld]
ld [de], a
inc de
- ld [Buffer1], a
+ ld [wCurHPAnimMaxHP], a
ld [EnemyMonHP + 1], a
ld a, [hl]
ld [de], a
- ld [Buffer2], a
+ ld [wCurHPAnimMaxHP + 1], a
ld [EnemyMonHP], a
jr EnemyPotionFinish
; 383e8 (e:43e8)
@@ -621,20 +620,20 @@
ld b, 200
EnemyPotionContinue: ; 383f8
- ld [wd1f1], a
+ ld [CurEnemyItem], a
ld hl, EnemyMonHP + 1
ld a, [hl]
- ld [wd1ec], a
+ ld [wCurHPAnimOldHP], a
add b
ld [hld], a
- ld [wd1ee], a
+ ld [wCurHPAnimNewHP], a
ld a, [hl]
- ld [wd1ec + 1], a
- ld [wd1ee + 1], a
+ ld [wCurHPAnimOldHP + 1], a
+ ld [wCurHPAnimNewHP + 1], a
jr nc, .ok
inc a
ld [hl], a
- ld [wd1ee + 1], a
+ ld [wCurHPAnimNewHP + 1], a
.ok
inc hl
ld a, [hld]
@@ -642,12 +641,12 @@
ld de, EnemyMonMaxHP + 1
ld a, [de]
dec de
- ld [Buffer1], a
+ ld [wCurHPAnimMaxHP], a
sub b
ld a, [hli]
ld b, a
ld a, [de]
- ld [Buffer2], a
+ ld [wCurHPAnimMaxHP + 1], a
sbc b
jr nc, EnemyPotionFinish
inc de
@@ -654,10 +653,10 @@
ld a, [de]
dec de
ld [hld], a
- ld [wd1ee], a
+ ld [wCurHPAnimNewHP], a
ld a, [de]
ld [hl], a
- ld [wd1ef], a
+ ld [wCurHPAnimNewHP + 1], a
EnemyPotionFinish: ; 38436
call PrintText_UsedItemOn
@@ -726,7 +725,7 @@
.skiptext
ld a, 1
- ld [wAISwitch], a
+ ld [wBattleHasJustStarted], a
callab NewEnemyMonStatus
callab ResetEnemyStatLevels
ld hl, PlayerSubStatus1
@@ -734,7 +733,7 @@
callba EnemySwitch
callba ResetBattleParticipants
xor a
- ld [wAISwitch], a
+ ld [wBattleHasJustStarted], a
ld a, [wLinkMode]
and a
ret nz
@@ -844,7 +843,7 @@
; a = ITEM_CONSTANT
; b = BATTLE_CONSTANT (ATTACK, DEFENSE, SPEED, SP_ATTACK, SP_DEFENSE, ACCURACY, EVASION)
EnemyUsedXItem:
- ld [wd1f1], a
+ ld [CurEnemyItem], a
push bc
call PrintText_UsedItemOn
pop bc
@@ -856,13 +855,13 @@
; Parameter
; a = ITEM_CONSTANT
PrintText_UsedItemOn_AND_AIUpdateHUD: ; 38568
- ld [wd1f1], a
+ ld [CurEnemyItem], a
call PrintText_UsedItemOn
jp AIUpdateHUD
; 38571
PrintText_UsedItemOn: ; 38571
- ld a, [wd1f1]
+ ld a, [CurEnemyItem]
ld [wd265], a
call GetItemName
ld hl, StringBuffer1
--- a/battle/ai/move.asm
+++ b/battle/ai/move.asm
@@ -19,9 +19,9 @@
; The default score is 20. Unusable moves are given a score of 80.
ld a, 20
ld hl, Buffer1
-rept 3
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
ld [hl], a
; Don't pick disabled moves.
@@ -107,9 +107,8 @@
ld hl, AIScoringPointers
dec c
ld b, 0
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
--- a/battle/ai/scoring.asm
+++ b/battle/ai/scoring.asm
@@ -133,9 +133,8 @@
call AI_50_50
jr c, .checkmove
-rept 2
dec [hl]
-endr
+ dec [hl]
jr .checkmove
.discourage
@@ -142,9 +141,8 @@
call Random
cp 30
jr c, .checkmove
-rept 2
inc [hl]
-endr
+ inc [hl]
jr .checkmove
; 38635
@@ -264,9 +262,8 @@
and a
jr nz, .checkmove
-rept 2
inc [hl]
-endr
+ inc [hl]
jr .checkmove
; 386be
@@ -420,9 +417,8 @@
.asm_387f0
call AI_50_50
ret c
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
; 387f7
@@ -533,9 +529,8 @@
call AI_50_50
ret c
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
.asm_38882
@@ -560,9 +555,8 @@
cp 180
jr nc, .asm_3888b
-rept 2
dec [hl]
-endr
+ dec [hl]
jr .asm_3888b
.asm_388a2
@@ -602,9 +596,9 @@
ret c
.asm_388c6
-rept 3
inc [hl]
-endr
+ inc [hl]
+ inc [hl]
ret
; 388ca
@@ -616,9 +610,9 @@
call Random
cp 25
ret c
-rept 3
dec [hl]
-endr
+ dec [hl]
+ dec [hl]
ret
; 388d4
@@ -645,9 +639,8 @@
jr nc, .asm_38911
.asm_388ef
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
.asm_388f2
@@ -676,9 +669,8 @@
jr c, .asm_38911
.asm_3890f
-rept 2
inc [hl]
-endr
+ inc [hl]
; 30% chance to end up here if enemy's HP is full and player is not badly poisoned.
; 77% chance to end up here if enemy's HP is above 50% but not full.
@@ -722,9 +714,8 @@
call Random
cp $50
ret c
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
; Player is seeded.
@@ -756,9 +747,8 @@
call AI_80_20
ret c
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
; 3895b
@@ -828,9 +818,8 @@
jr nc, .asm_389bf
.asm_3899d
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
.asm_389a0
@@ -859,9 +848,8 @@
jr c, .asm_389bf
.asm_389bd
-rept 2
inc [hl]
-endr
+ inc [hl]
; We only end up here if the move has not been already encouraged.
.asm_389bf
@@ -900,9 +888,8 @@
call Random
cp $50
ret c
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
; Player is seeded.
@@ -1010,9 +997,8 @@
call Random
cp $19
ret c
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
; 38a4e
@@ -1093,9 +1079,8 @@
ret nc
call AI_50_50
ret c
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
; 38a9c
@@ -1200,9 +1185,8 @@
.asm_38b09
call AI_80_20
ret c
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
.asm_38b10
@@ -1224,9 +1208,9 @@
call AICompareSpeed
ret nc
-rept 3
dec [hl]
-endr
+ dec [hl]
+ dec [hl]
ret
; 38b20
@@ -1255,9 +1239,8 @@
ret nc
call AI_80_20
ret c
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
.asm_38b3a
@@ -1289,9 +1272,8 @@
call Random
cp 30
ret c
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
; 38b5c
@@ -1528,15 +1510,14 @@
call Random
cp $46
ret c
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
.asm_38c81
-rept 3
inc [hl]
-endr
+ inc [hl]
+ inc [hl]
ret
.EncoreMoves:
@@ -1606,15 +1587,15 @@
cp $1
jr z, .asm_38cc7
-rept 3
dec [hl]
-endr
+ dec [hl]
+ dec [hl]
ret
.asm_38cc7
-rept 3
inc [hl]
-endr
+ inc [hl]
+ inc [hl]
ret
; 38ccb
@@ -1626,9 +1607,9 @@
ld a, [EnemyMonStatus]
and $20
ret z
-rept 3
dec [hl]
-endr
+ dec [hl]
+ dec [hl]
ret
; 38cd5
@@ -1685,9 +1666,8 @@
call Random
cp $64
ret c
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
; 38d16
@@ -1728,9 +1708,9 @@
jr z, .next
; status
-rept 3
dec hl
-endr
+ dec hl
+ dec hl
ld a, [hl]
or c
ld c, a
@@ -1755,9 +1735,8 @@
ret z
call AI_50_50
ret c
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
.no_status
@@ -1795,9 +1774,9 @@
ld a, [BattleMonHP]
sbc b
ret nc
-rept 3
dec [hl]
-endr
+ dec [hl]
+ dec [hl]
ret
; 38d93
@@ -1921,9 +1900,9 @@
.asm_38e26
call AI_80_20
ret c
-rept 3
dec [hl]
-endr
+ dec [hl]
+ dec [hl]
ret
; 38e2e
@@ -2007,15 +1986,13 @@
ret nc
call AI_80_20
ret c
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
.asm_38e90
-rept 2
inc [hl]
-endr
+ inc [hl]
.asm_38e92
inc [hl]
.asm_38e93
@@ -2065,9 +2042,8 @@
call AI_50_50
ret c
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
; 38ed2
@@ -2119,9 +2095,8 @@
call Random
cp 20
ret c
-rept 2
inc [hl]
-endr
+ inc [hl]
ret
; 38f1d
@@ -2151,9 +2126,8 @@
call Random
cp 100
ret c
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
; 38f4a
@@ -2259,9 +2233,9 @@
call AI_80_20
ret c
-rept 3
dec [hl]
-endr
+ dec [hl]
+ dec [hl]
ret
.asm_38fcb
@@ -2272,9 +2246,8 @@
call AI_50_50
ret c
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
.asm_38fd8
@@ -2296,15 +2269,14 @@
cp 2
jr c, .end
-rept 2
dec [hl]
-endr
+ dec [hl]
cp 3
jr c, .end
-rept 3
dec [hl]
-endr
+ dec [hl]
+ dec [hl]
.end
@@ -2344,9 +2316,8 @@
call Random
cp 200
ret nc
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
.asm_39020
@@ -2406,9 +2377,8 @@
call AICompareSpeed
ret nc
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
.could_dig
@@ -2455,9 +2425,8 @@
.asm_3907d
call AI_50_50
ret c
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
; 39084
@@ -2482,9 +2451,8 @@
call AI_80_20
ret c
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
; 3909e
@@ -2611,9 +2579,9 @@
; 3911e
AIBadWeatherType: ; 3911e
-rept 3
inc [hl]
-endr
+ inc [hl]
+ inc [hl]
ret
; 39122
@@ -2636,9 +2604,8 @@
ret nz
.good
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
; 39134
@@ -2733,9 +2700,8 @@
ret
.asm_39188
-rept 2
inc [hl]
-endr
+ inc [hl]
ret
; 3918b
@@ -2820,9 +2786,8 @@
call AICompareSpeed
ret nc
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
; Try to predict if the player will use Fly this turn.
@@ -2849,9 +2814,8 @@
and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
ret z
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
; 39200
@@ -2886,9 +2850,8 @@
cp 25 ; 1/10
ret c
-rept 2
inc [hl]
-endr
+ inc [hl]
ret
.asm_3921e
@@ -2895,9 +2858,8 @@
call AI_80_20
ret c
-rept 2
dec [hl]
-endr
+ dec [hl]
ret
; 39225
@@ -2991,9 +2953,8 @@
ld c, [hl]
sla c
rl b
-rept 2
inc hl
-endr
+ inc hl
ld a, [hld]
cp c
ld a, [hl]
@@ -3013,9 +2974,8 @@
ld c, [hl]
sla c
rl b
-rept 2
inc hl
-endr
+ inc hl
ld a, [hld]
cp c
ld a, [hl]
@@ -3039,9 +2999,8 @@
rl b
sla c
rl b
-rept 2
inc hl
-endr
+ inc hl
ld a, [hld]
cp c
ld a, [hl]
@@ -3063,9 +3022,8 @@
rl b
sla c
rl b
-rept 2
inc hl
-endr
+ inc hl
ld a, [hld]
cp c
ld a, [hl]
--- a/battle/ai/switch.asm
+++ b/battle/ai/switch.asm
@@ -136,9 +136,11 @@
jr c, .loop2
; neutral
-rept 5
inc c
-endr
+ inc c
+ inc c
+ inc c
+ inc c
cp 10
jr z, .loop2
@@ -161,11 +163,6 @@
.doubledown
call .DecreaseScore
-
- ; fallthrough
-; 34931
-
-
.DecreaseScore: ; 34931
ld a, [wEnemyAISwitchScore]
dec a
@@ -173,7 +170,6 @@
ret
; 34939
-
.IncreaseScore: ; 34939
ld a, [wEnemyAISwitchScore]
inc a
@@ -198,9 +194,9 @@
; Perish count is 1
call FindAliveEnemyMons
- call FindEnemyMonsWithEnoughHP
+ call FindEnemyMonsWithAtLeastQuarterMaxHP
call FindEnemyMonsThatResistPlayer
- call Function34a85
+ call FindAliveEnemyMonsWithASuperEffectiveMove
ld a, e
cp 2
@@ -207,7 +203,7 @@
jr nz, .not_2
ld a, [wEnemyAISwitchScore]
- add $30
+ add $30 ; maximum chance
ld [wEnemySwitchMonParam], a
ret
@@ -223,12 +219,11 @@
jr nc, .loop1
ld a, b
- add $30
+ add $30 ; maximum chance
ld [wEnemySwitchMonParam], a
ret
.no_perish
-
call CheckPlayerMoveTypeMatchups
ld a, [wEnemyAISwitchScore]
cp 11
@@ -238,13 +233,13 @@
and a
jr z, .no_last_counter_move
- call Function34a2a
+ call FindEnemyMonsImmuneToLastCounterMove
ld a, [wEnemyAISwitchScore]
and a
jr z, .no_last_counter_move
ld c, a
- call Function34aa7
+ call FindEnemyMonsWithASuperEffectiveMove
ld a, [wEnemyAISwitchScore]
cp $ff
ret z
@@ -285,9 +280,9 @@
ret nc
call FindAliveEnemyMons
- call FindEnemyMonsWithEnoughHP
+ call FindEnemyMonsWithAtLeastQuarterMaxHP
call FindEnemyMonsThatResistPlayer
- call Function34a85
+ call FindAliveEnemyMonsWithASuperEffectiveMove
ld a, e
cp $2
@@ -352,7 +347,7 @@
; 34a2a
-Function34a2a: ; 34a2a
+FindEnemyMonsImmuneToLastCounterMove: ; 34a2a
ld hl, OTPartyMon1
ld a, [OTPartyCount]
ld b, a
@@ -361,14 +356,16 @@
xor a
ld [wEnemyAISwitchScore], a
-.asm_34a39
+.loop
ld a, [CurOTMon]
cp d
push hl
- jr z, .asm_34a77
+ jr z, .next
push hl
push bc
+
+ ; If the Pokemon has at least 1 HP...
ld bc, MON_HP
add hl, bc
pop bc
@@ -375,18 +372,21 @@
ld a, [hli]
or [hl]
pop hl
- jr z, .asm_34a77
+ jr z, .next
ld a, [hl]
ld [CurSpecies], a
call GetBaseData
+
+ ; the enemy's last move is damaging...
ld a, [LastEnemyCounterMove]
dec a
ld hl, Moves + MOVE_POWER
call GetMoveAttr
and a
- jr z, .asm_34a77
+ jr z, .next
+ ; and the Pokemon is immune to it...
inc hl
call GetMoveByte
ld hl, BaseType
@@ -393,12 +393,13 @@
call CheckTypeMatchup
ld a, [wTypeMatchup]
and a
- jr nz, .asm_34a77
+ jr nz, .next
+ ; ... encourage that Pokemon.
ld a, [wEnemyAISwitchScore]
or c
ld [wEnemyAISwitchScore], a
-.asm_34a77
+.next
pop hl
dec b
ret z
@@ -410,11 +411,11 @@
inc d
srl c
- jr .asm_34a39
+ jr .loop
; 34a85
-Function34a85: ; 34a85
+FindAliveEnemyMonsWithASuperEffectiveMove: ; 34a85
push bc
ld a, [OTPartyCount]
ld e, a
@@ -444,13 +445,9 @@
and c
ld c, a
+FindEnemyMonsWithASuperEffectiveMove: ; 34aa7
- ; fallthrough
-; 34aa7
-
-Function34aa7: ; 34aa7
-
- ld a, $ff
+ ld a, -1
ld [wEnemyAISwitchScore], a
ld hl, OTPartyMon1Moves
ld b, 1 << (PARTY_LENGTH - 1)
@@ -463,14 +460,17 @@
push hl
push bc
+ ; for move on mon:
ld b, NUM_MOVES
ld c, 0
.loop3
+ ; if move is None: break
ld a, [hli]
and a
push hl
jr z, .break3
+ ; if move has no power: continue
dec a
ld hl, Moves + MOVE_POWER
call GetMoveAttr
@@ -477,18 +477,23 @@
and a
jr z, .nope
+ ; check type matchups
inc hl
call GetMoveByte
ld hl, BattleMonType1
call CheckTypeMatchup
+
+ ; if immune or not very effective: continue
ld a, [wTypeMatchup]
cp 10
jr c, .nope
+ ; if neutral: load 1 and continue
ld e, 1
cp 10 + 1
jr c, .nope
+ ; if super-effective: load 2 and break
ld e, 2
jr .break3
@@ -505,18 +510,19 @@
ld a, e
pop bc
pop hl
- cp $2
- jr z, .done2
+ cp 2
+ jr z, .done2 ; at least one move is super-effective
+ cp 1
+ jr nz, .next ; no move does more than half damage
- cp $1
- jr nz, .next
-
+ ; encourage this pokemon
ld a, d
or b
ld d, a
- jr .next
+ jr .next ; such a long jump
.next
+ ; next pokemon?
push bc
ld bc, PARTYMON_STRUCT_LENGTH
add hl, bc
@@ -524,6 +530,7 @@
srl b
jr nc, .loop
+ ; if no pokemon has a super-effective move: return
ld a, d
ld b, a
and a
@@ -530,6 +537,7 @@
ret z
.done2
+ ; convert the bit flag to an int and return
push bc
sla b
sla b
@@ -608,7 +616,7 @@
; 34b77
-FindEnemyMonsWithEnoughHP: ; 34b77
+FindEnemyMonsWithAtLeastQuarterMaxHP: ; 34b77
push bc
ld de, OTPartySpecies
ld b, 1 << (PARTY_LENGTH - 1)
@@ -626,17 +634,15 @@
ld b, [hl]
inc hl
ld c, [hl]
-rept 2
inc hl
-endr
+ inc hl
; hl = MaxHP + 1
-; b = (4 * b) % $100 + (c & 3)
-; c = c / 4
+; bc = [CurHP] * 4
srl c
rl b
srl c
rl b
-; a = (MaxHP / $100) - b - (1 if c > (MaxHP % $100) else 0)
+; if bc >= [hl], encourage
ld a, [hld]
cp c
ld a, [hl]
--- a/battle/anim_commands.asm
+++ b/battle/anim_commands.asm
@@ -108,7 +108,7 @@
call RunBattleAnimCommand
call _ExecuteBGEffects
call BattleAnim_UpdateOAM_All
- call Function3b0c
+ call PushLYOverrides
call BattleAnimRequestPals
; Speed up Rollout's animation.
@@ -265,9 +265,9 @@
ld a, [hl]
and $f0
ld [hli], a
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
dec c
jr nz, .loop
ret
@@ -382,7 +382,7 @@
dw BattleAnimCmd_EB ; dummy
dw BattleAnimCmd_EC ; dummy
dw BattleAnimCmd_ED ; dummy
- dw BattleAnimCmd_JumpAnd
+ dw BattleAnimCmd_IfParamAnd
dw BattleAnimCmd_JumpUntil
dw BattleAnimCmd_BGEffect
dw BattleAnimCmd_BGP
@@ -392,10 +392,10 @@
dw BattleAnimCmd_F5
dw BattleAnimCmd_F6
dw BattleAnimCmd_F7
- dw BattleAnimCmd_JumpIf
+ dw BattleAnimCmd_IfParamEqual
dw BattleAnimCmd_SetVar
dw BattleAnimCmd_IncVar
- dw BattleAnimCmd_JumpVar
+ dw BattleAnimCmd_IfVarEqual
dw BattleAnimCmd_Jump
dw BattleAnimCmd_Loop
dw BattleAnimCmd_Call
@@ -535,7 +535,7 @@
inc [hl]
ret
-BattleAnimCmd_JumpVar: ; cc3b2 (33:43b2)
+BattleAnimCmd_IfVarEqual: ; cc3b2 (33:43b2)
call GetBattleAnimByte
ld hl, BattleAnimVar
cp [hl]
@@ -563,7 +563,7 @@
ld [hl], d
ret
-BattleAnimCmd_JumpIf: ; cc3d6 (33:43d6)
+BattleAnimCmd_IfParamEqual: ; cc3d6 (33:43d6)
call GetBattleAnimByte
ld hl, wBattleAnimParam
cp [hl]
@@ -591,7 +591,7 @@
ld [hl], d
ret
-BattleAnimCmd_JumpAnd: ; cc3fa (33:43fa)
+BattleAnimCmd_IfParamAnd: ; cc3fa (33:43fa)
call GetBattleAnimByte
ld e, a
ld a, [wBattleAnimParam]
@@ -608,6 +608,7 @@
dec hl
ld [hl], e
ret
+
.jump
call GetBattleAnimByte
ld e, a
--- a/battle/anims.asm
+++ b/battle/anims.asm
@@ -303,10 +303,10 @@
; c92c1
BattleAnim_ThrowPokeBall
- anim_jumpif NO_ITEM, .TheTrainerBlockedTheBall
- anim_jumpif MASTER_BALL, .MasterBall
- anim_jumpif ULTRA_BALL, .UltraBall
- anim_jumpif GREAT_BALL, .GreatBall
+ anim_if_param_equal NO_ITEM, .TheTrainerBlockedTheBall
+ anim_if_param_equal MASTER_BALL, .MasterBall
+ anim_if_param_equal ULTRA_BALL, .UltraBall
+ anim_if_param_equal GREAT_BALL, .GreatBall
; any other ball
anim_2gfx ANIM_GFX_POKE_BALL, ANIM_GFX_SMOKE
anim_sound 6, 2, SFX_THROW_BALL
@@ -316,7 +316,7 @@
anim_setobj $2, $7
anim_wait 16
anim_sound 0, 1, SFX_BALL_POOF
- anim_obj ANIM_OBJ_1C, -15, 0, 8, 0, $10
+ anim_obj ANIM_OBJ_BALL_POOF, -15, 0, 8, 0, $10
anim_wait 16
anim_jump .Shake
; c92f2
@@ -324,7 +324,7 @@
.TheTrainerBlockedTheBall:
anim_2gfx ANIM_GFX_POKE_BALL, ANIM_GFX_HIT
anim_sound 6, 2, SFX_THROW_BALL
- anim_obj ANIM_OBJ_16, 8, 0, 11, 4, $20
+ anim_obj ANIM_OBJ_POKE_BALL_BLOCKED, 8, 0, 11, 4, $20
anim_wait 20
anim_obj ANIM_OBJ_01, 14, 0, 5, 0, $0
anim_wait 32
@@ -340,7 +340,7 @@
anim_setobj $2, $7
anim_wait 16
anim_sound 0, 1, SFX_BALL_POOF
- anim_obj ANIM_OBJ_1C, -15, 0, 8, 0, $10
+ anim_obj ANIM_OBJ_BALL_POOF, -15, 0, 8, 0, $10
anim_wait 16
anim_jump .Shake
; c9326
@@ -354,7 +354,7 @@
anim_setobj $2, $7
anim_wait 16
anim_sound 0, 1, SFX_BALL_POOF
- anim_obj ANIM_OBJ_1C, -15, 0, 8, 0, $10
+ anim_obj ANIM_OBJ_BALL_POOF, -15, 0, 8, 0, $10
anim_wait 16
anim_jump .Shake
; c9347
@@ -368,17 +368,17 @@
anim_setobj $2, $7
anim_wait 16
anim_sound 0, 1, SFX_BALL_POOF
- anim_obj ANIM_OBJ_1C, -15, 0, 8, 0, $10
+ anim_obj ANIM_OBJ_BALL_POOF, -15, 0, 8, 0, $10
anim_wait 24
anim_sound 0, 1, SFX_MASTER_BALL
- anim_obj ANIM_OBJ_2B, -15, 0, 7, 0, $30
- anim_obj ANIM_OBJ_2B, -15, 0, 7, 0, $31
- anim_obj ANIM_OBJ_2B, -15, 0, 7, 0, $32
- anim_obj ANIM_OBJ_2B, -15, 0, 7, 0, $33
- anim_obj ANIM_OBJ_2B, -15, 0, 7, 0, $34
- anim_obj ANIM_OBJ_2B, -15, 0, 7, 0, $35
- anim_obj ANIM_OBJ_2B, -15, 0, 7, 0, $36
- anim_obj ANIM_OBJ_2B, -15, 0, 7, 0, $37
+ anim_obj ANIM_OBJ_MASTER_BALL_SPARKLE, -15, 0, 7, 0, $30
+ anim_obj ANIM_OBJ_MASTER_BALL_SPARKLE, -15, 0, 7, 0, $31
+ anim_obj ANIM_OBJ_MASTER_BALL_SPARKLE, -15, 0, 7, 0, $32
+ anim_obj ANIM_OBJ_MASTER_BALL_SPARKLE, -15, 0, 7, 0, $33
+ anim_obj ANIM_OBJ_MASTER_BALL_SPARKLE, -15, 0, 7, 0, $34
+ anim_obj ANIM_OBJ_MASTER_BALL_SPARKLE, -15, 0, 7, 0, $35
+ anim_obj ANIM_OBJ_MASTER_BALL_SPARKLE, -15, 0, 7, 0, $36
+ anim_obj ANIM_OBJ_MASTER_BALL_SPARKLE, -15, 0, 7, 0, $37
anim_wait 64
.Shake:
anim_bgeffect ANIM_BG_RETURN_MON, $0, $0, $0
@@ -397,8 +397,8 @@
.Loop:
anim_wait 48
anim_checkpokeball
- anim_jumpvar $1, .Click
- anim_jumpvar $2, .BreakFree
+ anim_if_var_equal $1, .Click
+ anim_if_var_equal $2, .BreakFree
anim_incobj 1
anim_sound 0, 1, SFX_BALL_WIGGLE
anim_jump .Loop
@@ -412,7 +412,7 @@
.BreakFree:
anim_setobj $1, $b
anim_sound 0, 1, SFX_BALL_POOF
- anim_obj ANIM_OBJ_1C, -15, 0, 8, 0, $10
+ anim_obj ANIM_OBJ_BALL_POOF, -15, 0, 8, 0, $10
anim_wait 2
anim_bgeffect ANIM_BG_ENTER_MON, $0, $0, $0
anim_wait 32
@@ -420,9 +420,9 @@
; c93d1
BattleAnim_SendOutMon: ; c93d1
- anim_jumpif $0, .Normal
- anim_jumpif $1, .Shiny
- anim_jumpif $2, .Unknown
+ anim_if_param_equal $0, .Normal
+ anim_if_param_equal $1, .Shiny
+ anim_if_param_equal $2, .Unknown
anim_1gfx ANIM_GFX_SMOKE
anim_call BattleAnim_FollowEnemyFeet_0
anim_bgeffect ANIM_BG_2B, $0, $1, $0
@@ -482,7 +482,7 @@
.Normal:
anim_1gfx ANIM_GFX_SMOKE
anim_sound 0, 0, SFX_BALL_POOF
- anim_obj ANIM_OBJ_1C, 5, 4, 12, 0, $0
+ anim_obj ANIM_OBJ_BALL_POOF, 5, 4, 12, 0, $0
anim_wait 4
anim_bgeffect ANIM_BG_ENTER_MON, $0, $1, $0
anim_wait 32
@@ -543,13 +543,13 @@
BattleAnim_Sap: ; c94da
anim_1gfx ANIM_GFX_CHARGE
anim_sound 6, 3, SFX_WATER_GUN
- anim_obj ANIM_OBJ_45, 16, 0, 6, 0, $2
+ anim_obj ANIM_OBJ_ABSORB, 16, 0, 6, 0, $2
anim_wait 6
anim_sound 6, 3, SFX_WATER_GUN
- anim_obj ANIM_OBJ_45, -15, 0, 8, 0, $3
+ anim_obj ANIM_OBJ_ABSORB, -15, 0, 8, 0, $3
anim_wait 6
anim_sound 6, 3, SFX_WATER_GUN
- anim_obj ANIM_OBJ_45, -15, 0, 4, 0, $4
+ anim_obj ANIM_OBJ_ABSORB, -15, 0, 4, 0, $4
anim_wait 16
anim_ret
; c94f8
@@ -711,7 +711,7 @@
BattleAnim_Doubleslap: ; c9605
anim_1gfx ANIM_GFX_HIT
- anim_jumpif $1, BattleAnim_Doubleslap_branch_c961b
+ anim_if_param_equal $1, BattleAnim_Doubleslap_branch_c961b
anim_sound 0, 1, SFX_DOUBLESLAP
anim_obj ANIM_OBJ_08, -14, 0, 6, 0, $0
anim_wait 6
@@ -731,7 +731,7 @@
BattleAnim_CometPunch: ; c962b
anim_1gfx ANIM_GFX_HIT
- anim_jumpif $1, BattleAnim_CometPunch_branch_c9641
+ anim_if_param_equal $1, BattleAnim_CometPunch_branch_c9641
anim_sound 0, 1, SFX_COMET_PUNCH
anim_obj ANIM_OBJ_06, -14, 0, 6, 0, $0
anim_wait 6
@@ -788,7 +788,7 @@
BattleAnim_DoubleKick: ; c96a7
anim_1gfx ANIM_GFX_HIT
- anim_jumpif $1, BattleAnim_DoubleKick_branch_c96bd
+ anim_if_param_equal $1, BattleAnim_DoubleKick_branch_c96bd
anim_sound 0, 1, SFX_DOUBLE_KICK
anim_obj ANIM_OBJ_07, -14, 0, 6, 0, $0
anim_wait 6
@@ -808,7 +808,7 @@
BattleAnim_JumpKick: ; c96cd
anim_1gfx ANIM_GFX_HIT
- anim_jumpif $1, BattleAnim_JumpKick_branch_c96f1
+ anim_if_param_equal $1, BattleAnim_JumpKick_branch_c96f1
anim_sound 0, 1, SFX_JUMP_KICK
anim_obj ANIM_OBJ_07, 14, 0, 9, 0, $0
anim_obj ANIM_OBJ_07, 12, 4, 7, 4, $0
@@ -832,7 +832,7 @@
BattleAnim_HiJumpKick: ; c96fc
anim_1gfx ANIM_GFX_HIT
anim_bgeffect ANIM_BG_1F, $40, $2, $0
- anim_jumpif $1, BattleAnim_HiJumpKick_branch_c971e
+ anim_if_param_equal $1, BattleAnim_HiJumpKick_branch_c971e
anim_wait 32
anim_sound 0, 1, SFX_JUMP_KICK
anim_obj ANIM_OBJ_07, 14, 0, 9, 0, $0
@@ -1041,13 +1041,13 @@
anim_1gfx ANIM_GFX_ICE
.loop
anim_sound 6, 2, SFX_SHINE
- anim_obj ANIM_OBJ_13, 8, 0, 11, 4, $4
+ anim_obj ANIM_OBJ_ICE_BEAM, 8, 0, 11, 4, $4
anim_wait 4
anim_loop 5, .loop
- anim_obj ANIM_OBJ_29, -15, 0, 9, 2, $10
+ anim_obj ANIM_OBJ_ICE_BUILDUP, -15, 0, 9, 2, $10
.loop2
anim_sound 6, 2, SFX_SHINE
- anim_obj ANIM_OBJ_13, 8, 0, 11, 4, $4
+ anim_obj ANIM_OBJ_ICE_BEAM, 8, 0, 11, 4, $4
anim_wait 4
anim_loop 15, .loop2
anim_wait 48
@@ -1062,18 +1062,18 @@
anim_1gfx ANIM_GFX_ICE
.loop
anim_sound 6, 2, SFX_SHINE
- anim_obj ANIM_OBJ_11, 8, 0, 11, 0, $63
+ anim_obj ANIM_OBJ_BLIZZARD, 8, 0, 11, 0, $63
anim_wait 2
anim_sound 6, 2, SFX_SHINE
- anim_obj ANIM_OBJ_11, 8, 0, 10, 0, $64
+ anim_obj ANIM_OBJ_BLIZZARD, 8, 0, 10, 0, $64
anim_wait 2
anim_sound 6, 2, SFX_SHINE
- anim_obj ANIM_OBJ_11, 8, 0, 12, 0, $63
+ anim_obj ANIM_OBJ_BLIZZARD, 8, 0, 12, 0, $63
anim_wait 2
anim_loop 3, .loop
anim_bgeffect ANIM_BG_WHITE_HUES, $0, $8, $0
anim_wait 32
- anim_obj ANIM_OBJ_29, -15, 0, 9, 2, $10
+ anim_obj ANIM_OBJ_ICE_BUILDUP, -15, 0, 9, 2, $10
anim_wait 128
anim_sound 0, 1, SFX_SHINE
anim_wait 8
@@ -1085,13 +1085,13 @@
BattleAnim_Bubble: ; c991e
anim_1gfx ANIM_GFX_BUBBLE
anim_sound 32, 2, SFX_WATER_GUN
- anim_obj ANIM_OBJ_21, 8, 0, 11, 4, $c1
+ anim_obj ANIM_OBJ_BUBBLE, 8, 0, 11, 4, $c1
anim_wait 6
anim_sound 32, 2, SFX_WATER_GUN
- anim_obj ANIM_OBJ_21, 8, 0, 11, 4, $e1
+ anim_obj ANIM_OBJ_BUBBLE, 8, 0, 11, 4, $e1
anim_wait 6
anim_sound 32, 2, SFX_WATER_GUN
- anim_obj ANIM_OBJ_21, 8, 0, 11, 4, $d1
+ anim_obj ANIM_OBJ_BUBBLE, 8, 0, 11, 4, $d1
anim_wait 128
anim_wait 32
anim_ret
@@ -1101,13 +1101,13 @@
anim_1gfx ANIM_GFX_BUBBLE
.loop
anim_sound 16, 2, SFX_BUBBLEBEAM
- anim_obj ANIM_OBJ_21, 8, 0, 11, 4, $92
+ anim_obj ANIM_OBJ_BUBBLE, 8, 0, 11, 4, $92
anim_wait 6
anim_sound 16, 2, SFX_BUBBLEBEAM
- anim_obj ANIM_OBJ_21, 8, 0, 11, 4, $b3
+ anim_obj ANIM_OBJ_BUBBLE, 8, 0, 11, 4, $b3
anim_wait 6
anim_sound 16, 2, SFX_BUBBLEBEAM
- anim_obj ANIM_OBJ_21, 8, 0, 11, 4, $f4
+ anim_obj ANIM_OBJ_BUBBLE, 8, 0, 11, 4, $f4
anim_wait 8
anim_loop 3, .loop
anim_wait 64
@@ -1213,13 +1213,13 @@
BattleAnim_LeechSeed: ; c9a5a
anim_1gfx ANIM_GFX_PLANT
anim_sound 16, 2, SFX_VINE_WHIP
- anim_obj ANIM_OBJ_4A, 6, 0, 10, 0, $20
+ anim_obj ANIM_OBJ_LEECH_SEED, 6, 0, 10, 0, $20
anim_wait 8
anim_sound 16, 2, SFX_VINE_WHIP
- anim_obj ANIM_OBJ_4A, 6, 0, 10, 0, $30
+ anim_obj ANIM_OBJ_LEECH_SEED, 6, 0, 10, 0, $30
anim_wait 8
anim_sound 16, 2, SFX_VINE_WHIP
- anim_obj ANIM_OBJ_4A, 6, 0, 10, 0, $28
+ anim_obj ANIM_OBJ_LEECH_SEED, 6, 0, 10, 0, $28
anim_wait 32
anim_sound 0, 1, SFX_CHARGE
anim_wait 128
@@ -1229,17 +1229,17 @@
BattleAnim_RazorLeaf: ; c9a7c
anim_1gfx ANIM_GFX_PLANT
anim_sound 0, 0, SFX_VINE_WHIP
- anim_obj ANIM_OBJ_14, 6, 0, 10, 0, $28
- anim_obj ANIM_OBJ_14, 6, 0, 10, 0, $5c
- anim_obj ANIM_OBJ_14, 6, 0, 10, 0, $10
- anim_obj ANIM_OBJ_14, 6, 0, 10, 0, $e8
- anim_obj ANIM_OBJ_14, 6, 0, 10, 0, $9c
- anim_obj ANIM_OBJ_14, 6, 0, 10, 0, $d0
+ anim_obj ANIM_OBJ_RAZOR_LEAF, 6, 0, 10, 0, $28
+ anim_obj ANIM_OBJ_RAZOR_LEAF, 6, 0, 10, 0, $5c
+ anim_obj ANIM_OBJ_RAZOR_LEAF, 6, 0, 10, 0, $10
+ anim_obj ANIM_OBJ_RAZOR_LEAF, 6, 0, 10, 0, $e8
+ anim_obj ANIM_OBJ_RAZOR_LEAF, 6, 0, 10, 0, $9c
+ anim_obj ANIM_OBJ_RAZOR_LEAF, 6, 0, 10, 0, $d0
anim_wait 6
- anim_obj ANIM_OBJ_14, 6, 0, 10, 0, $1c
- anim_obj ANIM_OBJ_14, 6, 0, 10, 0, $50
- anim_obj ANIM_OBJ_14, 6, 0, 10, 0, $dc
- anim_obj ANIM_OBJ_14, 6, 0, 10, 0, $90
+ anim_obj ANIM_OBJ_RAZOR_LEAF, 6, 0, 10, 0, $1c
+ anim_obj ANIM_OBJ_RAZOR_LEAF, 6, 0, 10, 0, $50
+ anim_obj ANIM_OBJ_RAZOR_LEAF, 6, 0, 10, 0, $dc
+ anim_obj ANIM_OBJ_RAZOR_LEAF, 6, 0, 10, 0, $90
anim_wait 80
anim_sound 16, 2, SFX_VINE_WHIP
anim_incobj 3
@@ -1275,7 +1275,8 @@
; c9af2
BattleAnim_Solarbeam: ; c9af2
- anim_jumpif $0, BattleAnim_Solarbeam_branch_c9b30
+ anim_if_param_equal $0, .FireSolarBeam
+ ; charge turn
anim_1gfx ANIM_GFX_CHARGE
anim_sound 0, 0, SFX_CHARGE
anim_obj ANIM_OBJ_3D, 6, 0, 10, 4, $0
@@ -1293,7 +1294,7 @@
anim_ret
; c9b30
-BattleAnim_Solarbeam_branch_c9b30: ; c9b30
+.FireSolarBeam
anim_1gfx ANIM_GFX_BEAM
anim_bgeffect ANIM_BG_06, $0, $2, $0
anim_call BattleAnim_Solarbeam_branch_cbb39
@@ -1362,7 +1363,7 @@
; c9bbd
BattleAnim_RazorWind: ; c9bbd
- anim_jumpif $1, BattleAnim_RazorWind_branch_c9fb5
+ anim_if_param_equal $1, BattleAnim_RazorWind_branch_c9fb5
anim_1gfx ANIM_GFX_WHIP
anim_bgeffect ANIM_BG_06, $0, $1, $0
.loop
@@ -1430,7 +1431,7 @@
BattleAnim_Selfdestruct: ; c9c53
anim_1gfx ANIM_GFX_EXPLOSION
anim_bgeffect ANIM_BG_FLASH_INVERTED, $0, $8, $24
- anim_jumpif $1, .loop
+ anim_if_param_equal $1, .loop
anim_call BattleAnim_Selfdestruct_branch_cbb8f
anim_wait 16
anim_ret
@@ -1449,7 +1450,7 @@
anim_1gfx ANIM_GFX_EXPLOSION
anim_bgeffect ANIM_BG_1F, $60, $4, $10
anim_bgeffect ANIM_BG_FLASH_INVERTED, $0, $8, $24
- anim_jumpif $1, .loop
+ anim_if_param_equal $1, .loop
anim_call BattleAnim_Explosion_branch_cbb8f
anim_wait 16
anim_ret
@@ -1604,7 +1605,7 @@
BattleAnim_FurySwipes: ; c9dbc
anim_1gfx ANIM_GFX_CUT
- anim_jumpif $1, BattleAnim_FurySwipes_branch_c9dd9
+ anim_if_param_equal $1, BattleAnim_FurySwipes_branch_c9dd9
anim_sound 0, 1, SFX_SCRATCH
anim_obj ANIM_OBJ_37, -14, 0, 6, 0, $0
anim_obj ANIM_OBJ_37, -15, 4, 5, 4, $0
@@ -1685,8 +1686,8 @@
; c9e6f
BattleAnim_Fly: ; c9e6f
- anim_jumpif $1, BattleAnim_Fly_branch_c9e89
- anim_jumpif $2, BattleAnim_Fly_branch_c9e82
+ anim_if_param_equal $1, BattleAnim_Fly_branch_c9e89
+ anim_if_param_equal $2, BattleAnim_Fly_branch_c9e82
anim_1gfx ANIM_GFX_HIT
anim_sound 0, 1, SFX_WING_ATTACK
anim_obj ANIM_OBJ_01, -15, 0, 7, 0, $0
@@ -1742,13 +1743,13 @@
anim_obj ANIM_OBJ_3D, 5, 4, 11, 0, $0
.loop
anim_sound 6, 3, SFX_WATER_GUN
- anim_obj ANIM_OBJ_45, 16, 0, 6, 0, $2
+ anim_obj ANIM_OBJ_ABSORB, 16, 0, 6, 0, $2
anim_wait 6
anim_sound 6, 3, SFX_WATER_GUN
- anim_obj ANIM_OBJ_45, -15, 0, 8, 0, $3
+ anim_obj ANIM_OBJ_ABSORB, -15, 0, 8, 0, $3
anim_wait 6
anim_sound 6, 3, SFX_WATER_GUN
- anim_obj ANIM_OBJ_45, -15, 0, 4, 0, $4
+ anim_obj ANIM_OBJ_ABSORB, -15, 0, 4, 0, $4
anim_wait 6
anim_loop 5, .loop
anim_wait 32
@@ -1762,17 +1763,17 @@
anim_setvar $0
.loop
anim_sound 6, 3, SFX_WATER_GUN
- anim_obj ANIM_OBJ_45, 16, 0, 6, 0, $2
+ anim_obj ANIM_OBJ_ABSORB, 16, 0, 6, 0, $2
anim_wait 6
anim_sound 6, 3, SFX_WATER_GUN
- anim_obj ANIM_OBJ_45, -15, 0, 8, 0, $3
+ anim_obj ANIM_OBJ_ABSORB, -15, 0, 8, 0, $3
anim_wait 6
anim_sound 6, 3, SFX_WATER_GUN
- anim_obj ANIM_OBJ_45, -15, 0, 4, 0, $4
+ anim_obj ANIM_OBJ_ABSORB, -15, 0, 4, 0, $4
anim_wait 6
anim_incvar
- anim_jumpvar $7, .done
- anim_jumpvar $2, .spawn
+ anim_if_var_equal $7, .done
+ anim_if_var_equal $2, .spawn
anim_jump .loop
; c9f46
@@ -1861,7 +1862,7 @@
; c9ffc
BattleAnim_Bide: ; c9ffc
- anim_jumpif $0, BattleAnim_Bide_branch_c9651
+ anim_if_param_equal $0, BattleAnim_Bide_branch_c9651
anim_1gfx ANIM_GFX_HIT
anim_call BattleAnim_FollowEnemyFeet_0
anim_sound 0, 0, SFX_ESCAPE_ROPE
@@ -1982,7 +1983,7 @@
anim_wait 16
anim_loop 3, .loop
anim_wait 16
- anim_jumpif $0, .done
+ anim_if_param_equal $0, .done
anim_bgeffect ANIM_BG_27, $0, $0, $0
anim_wait 64
.done
@@ -2142,8 +2143,8 @@
BattleAnim_Dig: ; ca24b
anim_2gfx ANIM_GFX_SAND, ANIM_GFX_HIT
- anim_jumpif $0, .hit
- anim_jumpif $2, .fail
+ anim_if_param_equal $0, .hit
+ anim_if_param_equal $2, .fail
anim_call BattleAnim_FollowPlayerHead_0
anim_bgeffect ANIM_BG_DIG, $0, $1, $1
anim_obj ANIM_OBJ_57, 9, 0, 13, 0, $0
@@ -2312,7 +2313,7 @@
anim_incobj 9
anim_sound 16, 2, SFX_WHIRLWIND
anim_wait 128
- anim_jumpif $0, .done
+ anim_if_param_equal $0, .done
anim_bgeffect ANIM_BG_27, $0, $0, $0
anim_wait 64
.done
@@ -2335,8 +2336,8 @@
anim_1gfx ANIM_GFX_HAZE
anim_sound 0, 1, SFX_SURF
.loop
- anim_obj ANIM_OBJ_5B, 6, 0, 7, 0, $0
- anim_obj ANIM_OBJ_5B, -16, 4, 2, 0, $0
+ anim_obj ANIM_OBJ_HAZE, 6, 0, 7, 0, $0
+ anim_obj ANIM_OBJ_HAZE, -16, 4, 2, 0, $0
anim_wait 12
anim_loop 5, .loop
anim_wait 96
@@ -2348,7 +2349,7 @@
anim_1gfx ANIM_GFX_HAZE
anim_sound 0, 0, SFX_SURF
.loop
- anim_obj ANIM_OBJ_5C, 6, 0, 7, 0, $0
+ anim_obj ANIM_OBJ_MIST, 6, 0, 7, 0, $0
anim_wait 8
anim_loop 10, .loop
anim_wait 96
@@ -2359,7 +2360,7 @@
anim_1gfx ANIM_GFX_HAZE
anim_sound 0, 1, SFX_BUBBLEBEAM
.loop
- anim_obj ANIM_OBJ_5D, -16, 4, 2, 0, $0
+ anim_obj ANIM_OBJ_SMOG, -16, 4, 2, 0, $0
anim_wait 8
anim_loop 10, .loop
anim_wait 96
@@ -2370,7 +2371,7 @@
anim_1gfx ANIM_GFX_HAZE
anim_sound 16, 2, SFX_BUBBLEBEAM
.loop
- anim_obj ANIM_OBJ_5E, 5, 4, 10, 0, $2
+ anim_obj ANIM_OBJ_POISON_GAS, 5, 4, 10, 0, $2
anim_wait 8
anim_loop 10, .loop
anim_wait 128
@@ -2379,7 +2380,7 @@
BattleAnim_HornAttack: ; ca439
anim_2gfx ANIM_GFX_HORN, ANIM_GFX_HIT
- anim_obj ANIM_OBJ_5F, 9, 0, 10, 0, $1
+ anim_obj ANIM_OBJ_HORN, 9, 0, 10, 0, $1
anim_wait 16
anim_sound 0, 1, SFX_HORN_ATTACK
anim_obj ANIM_OBJ_01, -15, 0, 7, 0, $0
@@ -2389,17 +2390,17 @@
BattleAnim_FuryAttack: ; ca44c
anim_2gfx ANIM_GFX_HORN, ANIM_GFX_HIT
- anim_obj ANIM_OBJ_5F, 9, 0, 9, 0, $2
+ anim_obj ANIM_OBJ_HORN, 9, 0, 9, 0, $2
anim_wait 8
anim_sound 0, 1, SFX_HORN_ATTACK
anim_obj ANIM_OBJ_04, 16, 0, 5, 0, $0
anim_wait 8
- anim_obj ANIM_OBJ_5F, 10, 0, 11, 0, $2
+ anim_obj ANIM_OBJ_HORN, 10, 0, 11, 0, $2
anim_wait 8
anim_sound 0, 1, SFX_HORN_ATTACK
anim_obj ANIM_OBJ_04, -15, 0, 7, 0, $0
anim_wait 8
- anim_obj ANIM_OBJ_5F, 9, 4, 10, 0, $2
+ anim_obj ANIM_OBJ_HORN, 9, 4, 10, 0, $2
anim_wait 8
anim_sound 0, 1, SFX_HORN_ATTACK
anim_obj ANIM_OBJ_04, -16, 4, 6, 0, $0
@@ -2410,7 +2411,7 @@
BattleAnim_HornDrill: ; ca47d
anim_2gfx ANIM_GFX_HORN, ANIM_GFX_HIT
anim_bgeffect ANIM_BG_FLASH_INVERTED, $0, $8, $40
- anim_obj ANIM_OBJ_5F, 9, 0, 10, 0, $3
+ anim_obj ANIM_OBJ_HORN, 9, 0, 10, 0, $3
anim_wait 8
.loop
anim_sound 0, 1, SFX_HORN_ATTACK
@@ -2608,7 +2609,7 @@
; ca63f
BattleAnim_SkullBash: ; ca63f
- anim_jumpif $1, BattleAnim_SkullBash_branch_c9fb5
+ anim_if_param_equal $1, BattleAnim_SkullBash_branch_c9fb5
anim_1gfx ANIM_GFX_HIT
anim_bgeffect ANIM_BG_1F, $14, $2, $0
anim_wait 32
@@ -2714,14 +2715,14 @@
BattleAnim_Substitute: ; ca73c
anim_sound 0, 0, SFX_SURF
- anim_jumpif $3, BattleAnim_Substitute_branch_ca77c
- anim_jumpif $2, BattleAnim_Substitute_branch_ca76e
- anim_jumpif $1, BattleAnim_Substitute_branch_ca760
+ anim_if_param_equal $3, BattleAnim_Substitute_branch_ca77c
+ anim_if_param_equal $2, BattleAnim_Substitute_branch_ca76e
+ anim_if_param_equal $1, BattleAnim_Substitute_branch_ca760
anim_1gfx ANIM_GFX_SMOKE
anim_bgeffect ANIM_BG_27, $0, $1, $0
anim_wait 48
anim_raisesub
- anim_obj ANIM_OBJ_1C, 6, 0, 12, 0, $0
+ anim_obj ANIM_OBJ_BALL_POOF, 6, 0, 12, 0, $0
anim_bgeffect ANIM_BG_ENTER_MON, $0, $1, $0
anim_wait 32
anim_ret
@@ -2769,7 +2770,7 @@
; ca7a1
BattleAnim_SkyAttack: ; ca7a1
- anim_jumpif $1, BattleAnim_SkyAttack_branch_c9fb5
+ anim_if_param_equal $1, BattleAnim_SkyAttack_branch_c9fb5
anim_1gfx ANIM_GFX_SKY_ATTACK
anim_bgeffect ANIM_BG_27, $0, $1, $0
anim_wait 32
@@ -2826,14 +2827,14 @@
BattleAnim_Withdraw: ; ca80c
anim_1gfx ANIM_GFX_REFLECT
anim_call BattleAnim_FollowPlayerHead_0
- anim_bgeffect ANIM_BG_21, $0, $1, $50
+ anim_bgeffect ANIM_BG_WITHDRAW, $0, $1, $50
anim_wait 48
anim_sound 0, 0, SFX_SHINE
- anim_obj ANIM_OBJ_70, 6, 0, 11, 0, $0
+ anim_obj ANIM_OBJ_WITHDRAW, 6, 0, 11, 0, $0
anim_wait 64
anim_incobj 2
anim_wait 1
- anim_incbgeffect ANIM_BG_21
+ anim_incbgeffect ANIM_BG_WITHDRAW
anim_call BattleAnim_ShowMon_0
anim_ret
; ca829
@@ -2965,7 +2966,7 @@
anim_wait 24
anim_incobj 1
anim_sound 0, 1, SFX_BALL_POOF
- anim_obj ANIM_OBJ_1C, 13, 4, 8, 6, $10
+ anim_obj ANIM_OBJ_BALL_POOF, 13, 4, 8, 6, $10
anim_wait 8
.loop
anim_sound 0, 1, SFX_MENU
@@ -3324,8 +3325,8 @@
BattleAnim_TripleKick: ; cac7b
anim_1gfx ANIM_GFX_HIT
- anim_jumpif $1, BattleAnim_TripleKick_branch_cac95
- anim_jumpif $2, BattleAnim_TripleKick_branch_caca5
+ anim_if_param_equal $1, BattleAnim_TripleKick_branch_cac95
+ anim_if_param_equal $2, BattleAnim_TripleKick_branch_caca5
anim_sound 0, 1, SFX_MEGA_KICK
anim_obj ANIM_OBJ_07, -14, 0, 6, 0, $0
anim_wait 6
@@ -3447,7 +3448,7 @@
; cad86
BattleAnim_Curse: ; cad86
- anim_jumpif $1, .NotGhost
+ anim_if_param_equal $1, .NotGhost
anim_2gfx ANIM_GFX_HIT, ANIM_GFX_OBJECTS
anim_obj ANIM_OBJ_A5, 8, 4, 9, 0, $0
anim_sound 0, 0, SFX_CURSE
@@ -3551,7 +3552,7 @@
anim_1gfx ANIM_GFX_MISC
anim_sound 0, 1, SFX_POWDER
.loop ; cae8b
- anim_obj ANIM_OBJ_81, -16, 4, 4, 0, $0
+ anim_obj ANIM_OBJ_COTTON_SPORE, -16, 4, 4, 0, $0
anim_wait 8
anim_loop 5, .loop
anim_wait 96
@@ -3750,9 +3751,9 @@
anim_sound 6, 2, SFX_SLUDGE_BOMB
anim_obj ANIM_OBJ_8C, 8, 0, 11, 4, $4
anim_wait 16
- anim_obj ANIM_OBJ_1C, -16, 4, 7, 0, $10
+ anim_obj ANIM_OBJ_BALL_POOF, -16, 4, 7, 0, $10
anim_wait 8
- anim_jumpif $0, .done
+ anim_if_param_equal $0, .done
.loop
anim_obj ANIM_OBJ_74, -16, 4, 7, 4, $20
anim_wait 8
@@ -3810,7 +3811,7 @@
anim_1gfx ANIM_GFX_ANGELS
anim_bgp $1b
anim_obp0 $0
- anim_jumpif $1, BattleAnim_DestinyBond_branch_cb104
+ anim_if_param_equal $1, BattleAnim_DestinyBond_branch_cb104
anim_sound 6, 2, SFX_WHIRLWIND
anim_obj ANIM_OBJ_9B, 5, 4, 15, 0, $2
anim_wait 128
@@ -4097,7 +4098,7 @@
anim_1gfx ANIM_GFX_CUT
.loop
anim_sound 0, 1, SFX_CUT
- anim_jumpand $1, .obj1
+ anim_if_param_and %00000001, .obj1
anim_obj ANIM_OBJ_3A, -13, 0, 5, 0, $0
anim_jump .okay
@@ -4223,7 +4224,7 @@
anim_obj ANIM_OBJ_53, 13, 0, 6, 0, $0
anim_wait 48
anim_incobj 2
- anim_jumpif $3, .heal
+ anim_if_param_equal $3, .heal
anim_incobj 1
anim_wait 1
anim_1gfx ANIM_GFX_EXPLOSION
@@ -4356,7 +4357,7 @@
anim_bgeffect ANIM_BG_1F, $40, $2, $0
anim_wait 48
anim_bgeffect ANIM_BG_FLASH_INVERTED, $0, $8, $3
- anim_obj ANIM_OBJ_5F, 9, 0, 10, 0, $1
+ anim_obj ANIM_OBJ_HORN, 9, 0, 10, 0, $1
anim_sound 0, 1, SFX_HORN_ATTACK
anim_wait 16
anim_obj ANIM_OBJ_00, -15, 0, 7, 0, $0
@@ -4399,7 +4400,7 @@
BattleAnim_Pursuit: ; cb61b
anim_1gfx ANIM_GFX_HIT
- anim_jumpif $1, BattleAnim_Pursuit_branch_cb62b
+ anim_if_param_equal $1, BattleAnim_Pursuit_branch_cb62b
anim_sound 0, 1, SFX_COMET_PUNCH
anim_obj ANIM_OBJ_01, -15, 0, 7, 0, $0
anim_wait 16
@@ -4534,7 +4535,7 @@
anim_wait 6
anim_loop 5, .loop
anim_wait 32
- anim_jumpif $0, .zero
+ anim_if_param_equal 0, .zero
anim_call BattleAnim_MorningSun_branch_cbc6a
anim_ret
; cb756
@@ -4553,12 +4554,12 @@
anim_wait 72
anim_incbgeffect ANIM_BG_18
anim_call BattleAnim_ShowMon_0
- anim_jumpif $1, BattleAnim_Synthesis_branch_cb77a
+ anim_if_param_equal $1, .one
anim_call BattleAnim_Synthesis_branch_cbc6a
anim_ret
; cb77a
-BattleAnim_Synthesis_branch_cb77a: ; cb77a
+.one
anim_call BattleAnim_Synthesis_branch_cbc80
anim_ret
; cb77e
@@ -4592,12 +4593,11 @@
anim_wait 1
anim_sound 0, 0, SFX_MOONLIGHT
anim_wait 63
- anim_jumpif $3, BattleAnim_Moonlight_branch_cb7d7
+ anim_if_param_equal $3, .three
anim_call BattleAnim_Moonlight_branch_cbc6a
anim_ret
-; cb7d7
-BattleAnim_Moonlight_branch_cb7d7: ; cb7d7
+.three
anim_call BattleAnim_Moonlight_branch_cbc80
anim_ret
; cb7db
@@ -4811,7 +4811,7 @@
anim_sound 6, 2, SFX_SLUDGE_BOMB
anim_obj ANIM_OBJ_B4, 8, 0, 11, 4, $2
anim_wait 32
- anim_obj ANIM_OBJ_1C, -16, 4, 7, 0, $10
+ anim_obj ANIM_OBJ_BALL_POOF, -16, 4, 7, 0, $10
anim_wait 24
anim_ret
; cb9db
@@ -4877,7 +4877,7 @@
; cba84
BattleAnim_BeatUp: ; cba84
- anim_jumpif $0, .current_mon
+ anim_if_param_equal $0, .current_mon
anim_sound 0, 0, SFX_BALL_POOF
anim_bgeffect ANIM_BG_RETURN_MON, $0, $1, $0
anim_wait 16
--- a/battle/bg_effects.asm
+++ b/battle/bg_effects.asm
@@ -111,7 +111,7 @@
dw BattleBGEffect_1e
dw BattleBGEffect_1f
dw BattleBGEffect_20
- dw BattleBGEffect_21
+ dw BattleBGEffect_Withdraw
dw BattleBGEffect_BounceDown
dw BattleBGEffect_Dig
dw BattleBGEffect_Tackle
@@ -738,9 +738,9 @@
ld l, a
ld a, [wBattleAnimTemp2]
ld h, a
-rept 3
add hl, de
-endr
+ add hl, de
+ add hl, de
ld a, [hl]
cp -1
jr z, .end
@@ -805,9 +805,9 @@
ld e, [hl]
ld d, 0
ld hl, .BGSquares
-rept 3
add hl, de
-endr
+ add hl, de
+ add hl, de
ld a, [hli]
ld b, a
and $f
@@ -933,7 +933,7 @@
call InitSurfWaves
.one
- ld a, [hFFC6]
+ ld a, [hLCDCPointer]
and a
ret z
push bc
@@ -963,7 +963,7 @@
ld hl, wSurfWaveBGEffect
ld bc, $0
.loop2
- ld a, [hFFC7]
+ ld a, [hLYOverrideStart]
cp e
jr nc, .load_zero
push hl
@@ -997,12 +997,12 @@
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
- ld a, $42
- ld [hFFC6], a
+ ld a, rSCY - $ff00
+ ld [hLCDCPointer], a
xor a
- ld [hFFC7], a
+ ld [hLYOverrideStart], a
ld a, $5e
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
lb de, 2, 2
call Functionc8f2e
ret
@@ -1017,7 +1017,7 @@
BattleBGEffect_30: ; c85c2 (32:45c2)
call BattleBGEffects_ClearLYOverrides
- ld a, $42
+ ld a, rSCY - $ff00
call BattleBGEffect_SetLCDStatCustoms1
call EndBattleBGEffect
ret
@@ -1071,12 +1071,12 @@
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
- ld a, $43
- ld [hFFC6], a
+ ld a, rSCX - $ff00
+ ld [hLCDCPointer], a
xor a
- ld [hFFC7], a
+ ld [hLYOverrideStart], a
ld a, $5f
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
lb de, 6, 5
call Functionc8f2e
ld hl, BG_EFFECT_STRUCT_03
@@ -1109,7 +1109,7 @@
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
- ld a, $43
+ ld a, rSCX - $ff00
call BattleBGEffect_SetLCDStatCustoms1
lb de, 6, 5
call Functionc8f2e
@@ -1134,7 +1134,7 @@
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
- ld a, $42
+ ld a, rSCY - $ff00
call BattleBGEffect_SetLCDStatCustoms1
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
@@ -1165,11 +1165,11 @@
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
- ld a, $43
+ ld a, rSCX - $ff00
call BattleBGEffect_SetLCDStatCustoms1
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
inc a
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
add hl, bc
ld [hl], $0
@@ -1224,9 +1224,9 @@
inc a
ld d, a
ld h, LYOverridesBackup / $100
- ld a, [hFFC7]
+ ld a, [hLYOverrideStart]
ld l, a
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
sub l
srl a
push af
@@ -1257,7 +1257,7 @@
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
- ld a, $42
+ ld a, rSCY - $ff00
call BattleBGEffect_SetLCDStatCustoms1
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
@@ -1264,8 +1264,8 @@
ld e, [hl]
ld d, 2
call Functionc8f2e
- ld h, $d2
- ld a, [hFFC8]
+ ld h, LYOverridesBackup / $100
+ ld a, [hLYOverrideEnd]
ld l, a
ld [hl], $0
dec l
@@ -1273,9 +1273,9 @@
ret
.one
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
ld l, a
- ld h, $d2
+ ld h, LYOverridesBackup / $100
ld e, l
ld d, h
dec de
@@ -1283,11 +1283,11 @@
ld a, [de]
dec de
ld [hld], a
- ld a, [hFFC7]
+ ld a, [hLYOverrideStart]
cp l
jr nz, .loop
ld [hl], $90
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
ld l, a
ld a, [hl]
cp $1
@@ -1309,7 +1309,7 @@
call BattleAnim_ResetLCDStatCustom
ret
-BattleBGEffect_21: ; c8761 (32:4761)
+BattleBGEffect_Withdraw: ; c8761 (32:4761)
call BattleBGEffects_AnonJumptable
.anon_dw
dw .zero
@@ -1320,11 +1320,11 @@
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
- ld a, $42
+ ld a, rSCY - $ff00
call BattleBGEffect_SetLCDStatCustoms1
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
inc a
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
add hl, bc
ld [hl], $1
@@ -1341,7 +1341,7 @@
ld a, [hl]
cp d
ret nc
- call Functionc901b
+ call BGEffect_DisplaceLYOverridesBackup
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld a, [hl]
@@ -1370,11 +1370,11 @@
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
- ld a, $42
+ ld a, rSCY - $ff00
call BattleBGEffect_SetLCDStatCustoms1
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
inc a
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
add hl, bc
ld [hl], $2
@@ -1396,9 +1396,9 @@
ld [hl], $10
call BattleBGEffects_IncrementJumptable
.two
- ld a, [hFFC7]
+ ld a, [hLYOverrideStart]
ld l, a
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
sub l
dec a
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
@@ -1414,7 +1414,7 @@
dec [hl]
.skip
pop af
- call Functionc901b
+ call BGEffect_DisplaceLYOverridesBackup
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
add hl, bc
inc [hl]
@@ -1437,11 +1437,11 @@
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
- ld a, $43
+ ld a, rSCX - $ff00
call BattleBGEffect_SetLCDStatCustoms1
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
inc a
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld [hl], $0
@@ -1472,11 +1472,11 @@
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
- ld a, $43
+ ld a, rSCX - $ff00
call BattleBGEffect_SetLCDStatCustoms2
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
inc a
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld [hl], $0
@@ -1546,12 +1546,12 @@
jr z, .rollout
.not_rollout
pop af
- jp Functionc900b
+ jp BGEffect_FillLYOverridesBackup
.rollout
- ld a, [hFFC7]
+ ld a, [hLYOverrideStart]
ld d, a
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
sub d
ld d, a
ld h, LYOverridesBackup / $100
@@ -1558,7 +1558,7 @@
ld a, [hSCY]
or a
jr nz, .skip1
- ld a, [hFFC7]
+ ld a, [hLYOverrideStart]
or a
jr z, .skip2
dec a
@@ -1567,7 +1567,7 @@
jr .skip2
.skip1
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
dec a
ld l, a
ld [hl], $0
@@ -1574,7 +1574,7 @@
.skip2
ld a, [hSCY]
ld l, a
- ld a, [hFFC7]
+ ld a, [hLYOverrideStart]
sub l
jr nc, .skip3
xor a
@@ -1604,11 +1604,11 @@
BGEffect2d_2f_zero:
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
- ld a, $43
+ ld a, rSCX - $ff00
call BattleBGEffect_SetLCDStatCustoms1
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
inc a
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld [hl], $0
@@ -1648,11 +1648,11 @@
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
- ld a, $43
+ ld a, rSCX - $ff00
call BattleBGEffect_SetLCDStatCustoms1
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
inc a
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld [hl], $0
@@ -1664,7 +1664,7 @@
ld a, [hl]
ld d, $8
call BattleBGEffects_Sine
- call Functionc900b
+ call BGEffect_FillLYOverridesBackup
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld a, [hl]
@@ -1687,11 +1687,11 @@
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
- ld a, $43
+ ld a, rSCX - $ff00
call BattleBGEffect_SetLCDStatCustoms1
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
inc a
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
xor a
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
add hl, bc
@@ -1714,7 +1714,7 @@
ld e, a
pop af
add e
- call Functionc900b
+ call BGEffect_FillLYOverridesBackup
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
add hl, bc
ld a, [hl]
@@ -1742,7 +1742,7 @@
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
- ld a, $43
+ ld a, rSCX - $ff00
call BattleBGEffect_SetLCDStatCustoms1
ret
@@ -1785,11 +1785,11 @@
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
- ld a, $42
+ ld a, rSCY - $ff00
call BattleBGEffect_SetLCDStatCustoms2
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
inc a
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
add hl, bc
ld [hl], $1
@@ -1814,7 +1814,7 @@
ld d, a
pop af
add d
- call Functionc901b
+ call BGEffect_DisplaceLYOverridesBackup
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
inc [hl]
@@ -1841,14 +1841,14 @@
call BattleBGEffects_SetLYOverrides
ld a, $47
call BattleBGEffect_SetLCDStatCustoms1
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
inc a
- ld [hFFC8], a
- ld a, [hFFC7]
+ ld [hLYOverrideEnd], a
+ ld a, [hLYOverrideStart]
ld l, a
- ld h, $d2
+ ld h, LYOverridesBackup / $100
.loop
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
cp l
jr z, .done
xor a
@@ -1873,9 +1873,9 @@
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld [hl], $0
- ld a, [hFFC7]
+ ld a, [hLYOverrideStart]
inc a
- ld [hFFC7], a
+ ld [hLYOverrideStart], a
call BattleBGEffects_IncrementJumptable
ret
@@ -1883,7 +1883,7 @@
call .GetLYOverride
jr nc, .finish
call .SetLYOverridesBackup
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
dec a
ld l, a
ld [hl], e
@@ -1895,9 +1895,9 @@
.SetLYOverridesBackup:
ld e, a
- ld a, [hFFC7]
+ ld a, [hLYOverrideStart]
ld l, a
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
sub l
srl a
ld h, LYOverridesBackup / $100
@@ -1944,7 +1944,7 @@
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
- ld a, $43
+ ld a, rSCX - $ff00
call BattleBGEffect_SetLCDStatCustoms1
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
add hl, bc
@@ -1986,12 +1986,12 @@
call BattleBGEffects_IncrementJumptable
ld a, $e4
call BattleBGEffects_SetLYOverrides
- ld a, $47
- ld [hFFC6], a
+ ld a, rBGP - $ff00
+ ld [hLCDCPointer], a
xor a
- ld [hFFC7], a
+ ld [hLYOverrideStart], a
ld a, $60
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
ret
.one
@@ -2221,11 +2221,11 @@
.zero ; c8c68 (32:4c68)
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
- ld a, $43
+ ld a, rSCX - $ff00
call BattleBGEffect_SetLCDStatCustoms1
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
inc a
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
add hl, bc
ld [hl], $1
@@ -2249,7 +2249,7 @@
xor $ff
inc a
ld [hl], a
- call Functionc900b
+ call BGEffect_FillLYOverridesBackup
ret
.finish
@@ -2267,12 +2267,12 @@
.zero ; c8cab (32:4cab)
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
- ld a, $43
- ld [hFFC6], a
+ ld a, rSCX - $ff00
+ ld [hLCDCPointer], a
xor a
- ld [hFFC7], a
+ ld [hLYOverrideStart], a
ld a, $37
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld [hl], $0
@@ -2286,7 +2286,7 @@
jr nc, .two
ld d, $6
call BattleBGEffects_Sine
- call Functionc900b
+ call BGEffect_FillLYOverridesBackup
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld a, [hl]
@@ -2435,9 +2435,9 @@
call BattleBGEffects_SetLYOverrides
ld a, $47
call BattleBGEffect_SetLCDStatCustoms1
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
inc a
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld a, [hl]
@@ -2463,7 +2463,7 @@
ld [hl], a
call BattleBGEffect_GetFirstDMGPal
jr c, .okay_2_dmg
- call Functionc900b
+ call BGEffect_FillLYOverridesBackup
ret
.okay_2_dmg
@@ -2655,7 +2655,7 @@
BattleBGEffects_ClearLYOverrides: ; c8eca (32:4eca)
xor a
BattleBGEffects_SetLYOverrides: ; c8ecb (32:4ecb)
- ld hl, LYOverrides ; wd100
+ ld hl, LYOverrides ; wListPointer
ld e, $99
.loop1
ld [hli], a
@@ -2670,7 +2670,7 @@
ret
BattleBGEffect_SetLCDStatCustoms1: ; c8ede (32:4ede)
- ld [hFFC6], a
+ ld [hLCDCPointer], a
call BGEffect_CheckBattleTurn
jr nz, .player_turn
lb de, $00, $36
@@ -2680,13 +2680,13 @@
lb de, $2f, $5e
.okay
ld a, d
- ld [hFFC7], a
+ ld [hLYOverrideStart], a
ld a, e
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
ret
BattleBGEffect_SetLCDStatCustoms2: ; c8ef4 (32:4ef4)
- ld [hFFC6], a
+ ld [hLCDCPointer], a
call BGEffect_CheckBattleTurn
jr nz, .player_turn
lb de, $00, $36
@@ -2696,30 +2696,30 @@
lb de, $2d, $5e
.okay
ld a, d
- ld [hFFC7], a
+ ld [hLYOverrideStart], a
ld a, e
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
ret
BattleAnim_ResetLCDStatCustom: ; c8f0a (32:4f0a)
xor a
- ld [hFFC7], a
- ld [hFFC8], a
+ ld [hLYOverrideStart], a
+ ld [hLYOverrideEnd], a
call BattleBGEffects_ClearLYOverrides
xor a
- ld [hFFC6], a
+ ld [hLCDCPointer], a
call EndBattleBGEffect
ret
BattleBGEffects_ResetVideoHRAM: ; c8f19 (32:4f19)
xor a
- ld [hFFC6], a
+ ld [hLCDCPointer], a
ld a, %11100100
ld [rBGP], a
ld [wBGP], a
ld [wOBP1], a
- ld [hFFC7], a
- ld [hFFC8], a
+ ld [hLYOverrideStart], a
+ ld [hLYOverrideEnd], a
call BattleBGEffects_ClearLYOverrides
ret
@@ -2735,10 +2735,10 @@
ld [wBattleAnimTemp3], a
ld bc, LYOverridesBackup
.loop
- ld a, [hFFC7]
+ ld a, [hLYOverrideStart]
cp c
jr nc, .next
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
cp c
jr c, .next
ld a, [wBattleAnimTemp2]
@@ -2812,7 +2812,7 @@
call BattleBGEffects_Sine
ld e, a
pop hl
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
cp c
jr c, .skip1
ld a, e
@@ -2819,7 +2819,7 @@
ld [bc], a
inc bc
.skip1
- ld a, [hFFC7]
+ ld a, [hLYOverrideStart]
cp l
jr nc, .skip2
ld [hl], e
@@ -2837,7 +2837,7 @@
ret
.GetLYOverrideBackupAddrOffset:
- ld a, [hFFC7]
+ ld a, [hLYOverrideStart]
ld e, a
ld a, [wBattleAnimTemp0]
add e
@@ -2847,13 +2847,13 @@
BattleBGEffect_WavyScreenFX: ; c8fef (32:4fef)
push bc
- ld a, [hFFC7]
+ ld a, [hLYOverrideStart]
ld l, a
inc a
ld e, a
- ld h, $d2
+ ld h, LYOverridesBackup / $100
ld d, h
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
sub l
and a
jr z, .done
@@ -2872,44 +2872,45 @@
pop bc
ret
-Functionc900b: ; c900b (32:500b)
+BGEffect_FillLYOverridesBackup: ; c900b (32:500b)
push af
- ld h, $d2
- ld a, [hFFC7]
+ ld h, LYOverridesBackup / $100
+ ld a, [hLYOverrideStart]
ld l, a
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
sub l
ld d, a
pop af
-.asm_c9016
+.loop
ld [hli], a
dec d
- jr nz, .asm_c9016
+ jr nz, .loop
ret
-Functionc901b: ; c901b (32:501b)
+BGEffect_DisplaceLYOverridesBackup: ; c901b (32:501b)
+ ; e = a; d = [hLYOverrideEnd] - [hLYOverrideStart] - a
push af
ld e, a
- ld a, [hFFC7]
+ ld a, [hLYOverrideStart]
ld l, a
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
sub l
sub e
ld d, a
- ld h, $d2
- ld a, [hFFC7]
+ ld h, LYOverridesBackup / $100
+ ld a, [hLYOverrideStart]
ld l, a
ld a, $90
-.asm_c902c
+.loop
ld [hli], a
dec e
- jr nz, .asm_c902c
+ jr nz, .loop
pop af
xor $ff
-.asm_c9033
+.loop2
ld [hli], a
dec d
- jr nz, .asm_c9033
+ jr nz, .loop2
ret
BGEffect_CheckBattleTurn: ; c9038 (32:5038)
--- a/battle/core.asm
+++ b/battle/core.asm
@@ -7,7 +7,7 @@
ld [wPlayerAction], a
ld [BattleEnded], a
inc a
- ld [wAISwitch], a
+ ld [wBattleHasJustStarted], a
ld hl, OTPartyMon1HP
ld bc, PARTYMON_STRUCT_LENGTH - 1
ld d, BATTLEACTION_SWITCH1 - 1
@@ -116,8 +116,6 @@
jp BattleMenu
; 3c0e5
-
-
WildFled_EnemyFled_LinkBattleCanceled: ; 3c0e5
call Call_LoadTempTileMapToTileMap
ld a, [wBattleResult]
@@ -160,7 +158,6 @@
ret
; 3c12f
-
BattleTurn: ; 3c12f
.loop
call MobileFn_3c1bf
@@ -170,7 +167,7 @@
xor a
ld [wPlayerIsSwitching], a
ld [wEnemyIsSwitching], a
- ld [wAISwitch], a
+ ld [wBattleHasJustStarted], a
ld [wPlayerJustGotFrozen], a
ld [wEnemyJustGotFrozen], a
ld [CurDamage], a
@@ -183,7 +180,7 @@
call IsMobileBattle
jr nz, .not_disconnected
callba Function100da5
- callba Function100641
+ callba StartMobileInactivityTimer
callba Function100dd8
jp c, .quit
.not_disconnected
@@ -252,7 +249,6 @@
ret
; 3c1d6
-
HandleBetweenTurnEffects: ; 3c1d6
ld a, [hLinkPlayerNumber]
cp $1
@@ -769,7 +765,6 @@
jp StdBattleTextBox
; 3c543
-
TryEnemyFlee: ; 3c543
ld a, [wBattleMode]
dec a
@@ -861,7 +856,6 @@
db -1
; 3c5b4
-
CompareMovePriority: ; 3c5b4
; Compare the priority of the player and enemy's moves.
; Return carry if the player goes first, or z if they match.
@@ -915,7 +909,6 @@
db -1
; 3c5ec
-
GetMoveEffect: ; 3c5ec
ld a, b
dec a
@@ -928,7 +921,6 @@
ret
; 3c5fe
-
Battle_EnemyFirst: ; 3c5fe
call LoadTileMapToTempTileMap
call TryEnemyFlee
@@ -1695,7 +1687,6 @@
ld hl, BattleText_SafeguardFaded
jp StdBattleTextBox
-
HandleScreens: ; 3cb36
ld a, [hLinkPlayerNumber]
cp 1
@@ -1739,7 +1730,6 @@
db "Enemy@"
; 3cb80
-
.LightScreenTick: ; 3cb80
ld a, [de]
dec a
@@ -1878,7 +1868,6 @@
jp UpdateHPBarBattleHuds
; 3cc45
-
SubtractHP: ; 3cc45
ld hl, BattleMonHP
ld a, [hBattleTurn]
@@ -1925,7 +1914,6 @@
ret
; 3cc83
-
GetEighthMaxHP: ; 3cc83
; output: bc
call GetQuarterMaxHP
@@ -1941,7 +1929,6 @@
ret
; 3cc8e
-
GetQuarterMaxHP: ; 3cc8e
; output: bc
call GetMaxHP
@@ -1962,7 +1949,6 @@
ret
; 3cc9f
-
GetHalfMaxHP: ; 3cc9f
; output: bc
call GetMaxHP
@@ -1980,7 +1966,6 @@
ret
; 3ccac
-
GetMaxHP: ; 3ccac
; output: bc, Buffer1-2
@@ -2036,7 +2021,6 @@
ret
; 3ccef
-
RestoreHP ; 3ccef
ld hl, EnemyMonMaxHP
ld a, [hBattleTurn]
@@ -2349,8 +2333,6 @@
ret
; 3ceec
-
-
StopDangerSound: ; 3ceec
xor a
ld [Danger], a
@@ -2503,8 +2485,8 @@
call BattleWinSlideInEnemyTrainerFrontpic
ld c, 40
call DelayFrames
- ld c, $4
- callba Function4ea0a
+ ld c, $4 ; win
+ callba Mobile_PrintOpponentBattleMessage
ret
.battle_tower
@@ -2622,7 +2604,6 @@
dw SentAllToMomText
; 3d0b1
-
.CheckMaxedOutMomMoney: ; 3d0b1
ld hl, wMomsMoney + 2
ld a, [hld]
@@ -2705,8 +2686,6 @@
ret
; 3d123
-
-
; These functions check if the current opponent is a gym leader or one of a
; few other special trainers.
@@ -2760,7 +2739,6 @@
db BLUE
db -1
-
HandlePlayerMonFaint: ; 3d14e
call FaintYourPokemon
ld hl, EnemyMonHP
@@ -2961,7 +2939,6 @@
jp SpikesDamage
; 3d2e0
-
CheckMobileBattleError: ; 3d2e0
ld a, [wLinkMode]
cp LINK_MOBILE
@@ -3060,7 +3037,6 @@
jr .pick
; 3d375
-
PickSwitchMonInBattle: ; 3d375
.pick
call PickPartyMonInBattle
@@ -3085,7 +3061,6 @@
ret
; 3d38e
-
LostBattle: ; 3d38e
ld a, 1
ld [BattleEnded], a
@@ -3176,13 +3151,12 @@
ld c, 40
call DelayFrames
- ld c, $3
- callba Function4ea0a
+ ld c, $3 ; lost
+ callba Mobile_PrintOpponentBattleMessage
scf
ret
; 3d432
-
EnemyMonFaintedAnimation: ; 3d432
hlcoord 12, 5
decoord 12, 6
@@ -3250,7 +3224,6 @@
db " @"
; 3d490
-
SlideBattlePicOut: ; 3d490
ld [hMapObjectIndexBuffer], a
ld c, a
@@ -3297,7 +3270,6 @@
ret
; 3d4c3
-
ForceEnemySwitch: ; 3d4c3
call ResetEnemyBattleVars
ld a, [wEnemySwitchMonIndex]
@@ -3313,7 +3285,6 @@
ret
; 3d4e1
-
EnemySwitch: ; 3d4e1
call CheckWhetherToAskSwitch
jr nc, EnemySwitch_SetMode
@@ -3372,14 +3343,14 @@
.not_linked
ld a, [wEnemySwitchMonIndex]
and a
- jr z, .check_wAISwitch
+ jr z, .check_wBattleHasJustStarted
dec a
ld b, a
jr .return_carry
-.check_wAISwitch
- ld a, [wAISwitch]
+.check_wBattleHasJustStarted
+ ld a, [wBattleHasJustStarted]
and a
ld b, $0
jr nz, .return_carry
@@ -3655,7 +3626,7 @@
; 3d714
CheckWhetherToAskSwitch: ; 3d714
- ld a, [wAISwitch]
+ ld a, [wBattleHasJustStarted]
dec a
jp z, .return_nc
ld a, [PartyCount]
@@ -3846,7 +3817,6 @@
ret
; 3d887
-
CheckIfCurPartyMonIsFitToFight: ; 3d887
ld a, [CurPartyMon]
ld hl, PartyMon1HP
@@ -3855,7 +3825,7 @@
or [hl]
ret nz
- ld a, [wAISwitch]
+ ld a, [wBattleHasJustStarted]
and a
jr nz, .finish_fail
ld hl, PartySpecies
@@ -3878,7 +3848,6 @@
ret
; 3d8b3
-
TryToRunAwayFromBattle: ; 3d8b3
; Run away from battle, with or without item
ld a, [BattleType]
@@ -4068,7 +4037,6 @@
ret
; 3da0d
-
InitBattleMon: ; 3da0d
ld a, MON_SPECIES
call GetPartyParamLocation
@@ -4080,9 +4048,9 @@
ld de, BattleMonDVs
ld bc, MON_PKRUS - MON_DVS
call CopyBytes
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
ld de, BattleMonLevel
ld bc, PARTYMON_STRUCT_LENGTH - MON_LEVEL
call CopyBytes
@@ -4159,7 +4127,6 @@
ret
; 3dabd
-
InitEnemyMon: ; 3dabd
ld a, [CurPartyMon]
ld hl, OTPartyMon1Species
@@ -4172,9 +4139,9 @@
ld de, EnemyMonDVs
ld bc, MON_PKRUS - MON_DVS
call CopyBytes
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
ld de, EnemyMonLevel
ld bc, PARTYMON_STRUCT_LENGTH - MON_LEVEL
call CopyBytes
@@ -4213,7 +4180,6 @@
ret
; 3db32
-
SwitchPlayerMon: ; 3db32
call ClearSprites
ld a, [CurBattleMon]
@@ -4234,7 +4200,6 @@
ret
; 3db5f
-
SendOutPlayerMon: ; 3db5f
ld hl, BattleMonDVs
predef GetUnownLetter
@@ -4302,9 +4267,9 @@
endr
ld [hl], a
ld hl, PlayerUsedMoves
-rept 3
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
ld [hl], a
ld [PlayerDisableCount], a
ld [PlayerFuryCutterCount], a
@@ -4580,7 +4545,6 @@
jp StdBattleTextBox
; 3ddc8
-
ItemRecoveryAnim: ; 3ddc8
push hl
push de
@@ -4665,7 +4629,6 @@
db $ff
; 3de51
-
UseConfusionHealingItem: ; 3de51
ld a, BATTLE_VARS_SUBSTATUS3_OPP
call GetBattleVar
@@ -4790,7 +4753,6 @@
db $ff
; 3df12
-
GetPartymonItem: ; 3df12
ld hl, PartyMon1Item
ld a, [CurBattleMon]
@@ -4824,8 +4786,6 @@
ret
; 3df48
-
-
UpdatePlayerHUD:: ; 3df48
push hl
push de
@@ -4939,7 +4899,7 @@
pop hl
dec hl
- ld a, BREEDMON
+ ld a, TEMPMON
ld [MonType], a
callab GetGender
ld a, " "
@@ -5017,7 +4977,7 @@
ld a, [hl]
ld [de], a
- ld a, BREEDMON
+ ld a, TEMPMON
ld [MonType], a
callab GetGender
ld a, " "
@@ -5164,7 +5124,6 @@
jr z, .skip_dude_pack_select
callba _DudeAutoInput_DownA
.skip_dude_pack_select
-
call LoadBattleMenu2
ret c
@@ -5383,15 +5342,19 @@
Battle_StatsScreen: ; 3e308
call DisableLCD
+
ld hl, VTiles2 tile $31
ld de, VTiles0
- ld bc, $0110
+ ld bc, $11 tiles
call CopyBytes
+
ld hl, VTiles2
ld de, VTiles0 tile $11
ld bc, $31 tiles
call CopyBytes
+
call EnableLCD
+
call ClearSprites
call LowVolume
xor a ; PARTYMON
@@ -5398,20 +5361,23 @@
ld [MonType], a
callba BattleStatsScreenInit
call MaxVolume
+
call DisableLCD
+
ld hl, VTiles0
ld de, VTiles2 tile $31
ld bc, $11 tiles
call CopyBytes
+
ld hl, VTiles0 tile $11
ld de, VTiles2
ld bc, $31 tiles
call CopyBytes
+
call EnableLCD
ret
; 3e358
-
TryPlayerSwitch: ; 3e358
ld a, [CurBattleMon]
ld d, a
@@ -5566,7 +5532,6 @@
jp SpikesDamage
; 3e489
-
BattleMenu_Run: ; 3e489
call Call_LoadTempTileMapToTileMap
ld a, $3
@@ -5583,7 +5548,6 @@
jp BattleMenu
; 3e4a8
-
CheckAmuletCoin: ; 3e4a8
ld a, [BattleMonItem]
ld b, a
@@ -5990,7 +5954,6 @@
db "TYPE/@"
; 3e75f
-
.PrintPP: ; 3e75f
hlcoord 5, 11
ld a, [wLinkMode] ; What's the point of this check?
@@ -6048,7 +6011,7 @@
jr .loop
.done
- and a
+ and a ; This is probably a bug, and will result in a move with PP Up confusing the game.
ret nz
.force_struggle
@@ -6060,8 +6023,6 @@
ret
; 3e7c1
-
-
ParseEnemyAction: ; 3e7c1
ld a, [wEnemyIsSwitching]
and a
@@ -6242,7 +6203,6 @@
ret
; 3e8eb
-
LoadEnemyMon: ; 3e8eb
; Initialize enemy monster parameters
; To do this we pull the species from TempEnemyMonSpecies
@@ -6275,7 +6235,6 @@
; Grab the BaseData for this species
call GetBaseData
-
; Let's get the item:
; Is the item predetermined?
@@ -6290,7 +6249,6 @@
ld a, [hl]
jr .UpdateItem
-
.WildItem:
; In a wild battle, we pull from the item slots in BaseData
@@ -6320,11 +6278,9 @@
jr nc, .UpdateItem
ld a, [BaseItems+1]
-
.UpdateItem:
ld [EnemyMonItem], a
-
; Initialize DVs
; If we're in a trainer battle, DVs are predetermined
@@ -6346,7 +6302,6 @@
ld [de], a
jp .Happiness
-
.InitDVs:
; Trainer DVs
@@ -6359,7 +6314,6 @@
dec a
jr nz, .UpdateDVs
-
; Wild DVs
; Here's where the fun starts
@@ -6402,7 +6356,6 @@
; We're done with DVs
jr .UpdateDVs
-
.NotRoaming:
; Register a contains BattleType
@@ -6429,16 +6382,13 @@
ld [hli], a
ld [hl], c
-
; We've still got more to do if we're dealing with a wild monster
ld a, [wBattleMode]
dec a
jr nz, .Happiness
-
; Species-specfic:
-
; Unown
ld a, [TempEnemyMonSpecies]
cp a, UNOWN
@@ -6452,7 +6402,6 @@
call CheckUnownLetter
jr c, .GenerateDVs ; try again
-
.Magikarp:
; Skimming this part recommended
@@ -6513,7 +6462,6 @@
cp a, 1024 >> 8
jr c, .GenerateDVs ; try again
-
; Finally done with DVs
.Happiness:
@@ -6526,7 +6474,7 @@
; Fill stats
ld de, EnemyMonMaxHP
ld b, FALSE
- ld hl, LinkBattleRNs + 7 ; ?
+ ld hl, EnemyMonDVs - (MON_DVS - MON_STAT_EXP + 1) ; LinkBattleRNs + 7 ; ?
predef CalcPkmnStats
; If we're in a trainer battle,
@@ -6588,7 +6536,6 @@
ld [hl], a
jr .Moves
-
.OpponentParty:
; Get HP from the party struct
ld hl, (OTPartyMon1HP + 1)
@@ -6608,7 +6555,6 @@
ld a, [hl] ; OTPartyMonStatus
ld [EnemyMonStatus], a
-
.Moves:
ld hl, BaseType1
ld de, EnemyMonType1
@@ -6637,9 +6583,9 @@
xor a
ld h, d
ld l, e
-rept 3
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
ld [hl], a
; Make sure the predef knows this isn't a partymon
ld [MagikarpLength], a
@@ -6718,7 +6664,6 @@
ret
; 3eb38
-
CheckSleepingTreeMon: ; 3eb38
; Return carry if species is in the list
; for the current time of day
@@ -6779,7 +6724,6 @@
db -1 ; end
; 3eb75
-
CheckUnownLetter: ; 3eb75
; Return carry if the Unown letter hasn't been unlocked yet
@@ -6848,7 +6792,6 @@
; 3ebc7
-
SwapBattlerLevels: ; 3ebc7
; unreferenced
push bc
@@ -6924,7 +6867,6 @@
ret
; 3ec2c
-
ApplyStatusEffectOnPlayerStats: ; 3ec2c
ld a, 1
jr ApplyStatusEffectOnStats
@@ -7143,7 +7085,6 @@
db 4, 1 ; 400%
; 3ed45
-
BadgeStatBoosts: ; 3ed45
; Raise BattleMon stats depending on which badges have been obtained.
@@ -7202,7 +7143,6 @@
ret
; 3ed7c
-
BoostStat: ; 3ed7c
; Raise stat at hl by 1/8.
@@ -7235,7 +7175,6 @@
ret
; 3ed9f
-
_LoadBattleFontsHPBar: ; 3ed9f
callab LoadBattleFontsHPBar
ret
@@ -7246,7 +7185,6 @@
ret
; 3edad
-
LoadHPExpBarGFX: ; unreferenced
ld de, EnemyHPBarBorderGFX
ld hl, VTiles2 tile $6c
@@ -7262,7 +7200,6 @@
jp Get2bpp
; 3edd1
-
EmptyBattleTextBox: ; 3edd1
ld hl, .empty
jp BattleTextBox
@@ -7270,7 +7207,6 @@
db "@"
; 3edd8
-
_BattleRandom:: ; 3edd8
; If the normal RNG is used in a link battle it'll desync.
; To circumvent this a shared PRNG is used instead.
@@ -7340,7 +7276,6 @@
ret
; 3ee0f
-
Call_PlayBattleAnim_OnlyIfVisible: ; 3ee0f
ld a, BATTLE_VARS_SUBSTATUS3
call GetBattleVar
@@ -7373,7 +7308,6 @@
ret
; 3ee3b
-
GiveExperiencePoints: ; 3ee3b
; Give experience.
; Don't give experience if linked or in the Battle Tower.
@@ -7832,7 +7766,6 @@
db "@"
; 3f136
-
AnimateExpBar: ; 3f136
push bc
@@ -8019,8 +7952,6 @@
ld [hBGMapMode], a
ret
-
-
SendOutPkmnText: ; 3f26d
ld a, [wLinkMode]
and a
@@ -8028,7 +7959,7 @@
ld hl, JumpText_GoPkmn ; If we're in a LinkBattle print just "Go <PlayerMon>"
- ld a, [wAISwitch] ; unless this (unidentified) variable is set
+ ld a, [wBattleHasJustStarted] ; unless this (unidentified) variable is set
and a
jr nz, .skip_to_textbox
@@ -8083,7 +8014,6 @@
jp BattleTextBox
; 3f2d1
-
JumpText_GoPkmn: ; 3f2d1
text_jump Text_GoPkmn
start_asm
@@ -8197,7 +8127,6 @@
db "@"
; 3f360
-
HandleSafariAngerEatingStatus: ; unreferenced
ld hl, wSafariMonEating
ld a, [hl]
@@ -8230,7 +8159,6 @@
jp StdBattleTextBox
; 3f390
-
FillInExpBar: ; 3f390
push hl
call CalcExpBar
@@ -8447,7 +8375,6 @@
ret
; 3f4c1
-
StartBattle: ; 3f4c1
; This check prevents you from entering a battle without any Pokemon.
; Those using walk-through-walls to bypass getting a Pokemon experience
@@ -8467,7 +8394,6 @@
ret
; 3f4d9
-
_DoBattle: ; 3f4d9
; unreferenced
call DoBattle
@@ -8474,7 +8400,6 @@
ret
; 3f4dd
-
BattleIntro: ; 3f4dd
callba MobileFn_106050 ; mobile
call LoadTrainerOrWildMonPic
@@ -8702,7 +8627,6 @@
ret
; 3f69e
-
ExitBattle: ; 3f69e
call .HandleEndOfBattle
call CleanUpBattleRAM
@@ -8881,7 +8805,6 @@
db " DRAW@"
; 3f80f
-
.Mobile_InvalidBattle: ; 3f80f
hlcoord 6, 8
ld de, .Invalid
@@ -8896,7 +8819,6 @@
db "INVALID BATTLE@"
; 3f830
-
IsMobileBattle2: ; 3f830
ld a, [wLinkMode]
cp LINK_MOBILE
@@ -8903,7 +8825,6 @@
ret
; 3f836
-
DisplayLinkRecord: ; 3f836
ld a, BANK(sLinkBattleStats)
call GetSRAMBank
@@ -8916,7 +8837,7 @@
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
call ByteFill
call WaitBGMap2
- ld b, SCGB_08
+ ld b, SCGB_DIPLOMA
call GetSGBLayout
call SetPalettes
ld c, 8
@@ -8925,7 +8846,6 @@
ret
; 3f85f
-
ReadAndPrintLinkBattleRecord: ; 3f85f
call ClearTileMap
call ClearSprites
@@ -9060,7 +8980,6 @@
db "TOTAL WIN LOSE DRAW@"
; 3f998
-
BattleEnd_HandleRoamMons: ; 3f998
ld a, [BattleType]
cp BATTLETYPE_ROAMING
@@ -9168,7 +9087,6 @@
ret
; 3fa42
-
AddLastMobileBattleToLinkRecord: ; 3fa42
ld hl, OTPlayerID
ld de, StringBuffer1
@@ -9429,7 +9347,7 @@
ld [rSVBK], a
ld hl, wDecompressScratch
- ld bc, wBackupAttrMap - wDecompressScratch
+ ld bc, wScratchAttrMap - wDecompressScratch
ld a, " "
call ByteFill
@@ -9449,7 +9367,6 @@
ret
; 3fbff
-
GetTrainerBackpic: ; 3fbff
; Load the player character's backpic (6x6) into VRAM starting from VTiles2 tile $31.
@@ -9484,7 +9401,6 @@
ret
; 3fc30
-
CopyBackpic: ; 3fc30
ld a, [rSVBK]
push af
@@ -9543,7 +9459,6 @@
ret
; 3fc8b
-
BattleStartMessage: ; 3fc8b
ld a, [wBattleMode]
dec a
@@ -9621,8 +9536,8 @@
call IsMobileBattle2
ret nz
- ld c, $2
- callba Function4ea0a
+ ld c, $2 ; start
+ callba Mobile_PrintOpponentBattleMessage
ret
; 3fd26
--- a/battle/effect_commands.asm
+++ b/battle/effect_commands.asm
@@ -1541,11 +1541,6 @@
and a
jr z, CheckTypeMatchup
ld hl, BattleMonType1
-
- ; fallthrough
-; 347d3
-
-
CheckTypeMatchup: ; 347d3
push hl
push de
@@ -2837,11 +2832,11 @@
call GetDamageStatsCritical
jr c, .thickclub
- ld hl, EnemyStats + 2
+ ld hl, EnemyDefense
ld a, [hli]
ld b, a
ld c, [hl]
- ld hl, PlayerStats
+ ld hl, PlayerAttack
jr .thickclub
.special
@@ -2861,11 +2856,11 @@
call GetDamageStatsCritical
jr c, .lightball
- ld hl, EnemyStats + SP_DEFENSE * 2
+ ld hl, EnemySpDef
ld a, [hli]
ld b, a
ld c, [hl]
- ld hl, PlayerStats + SP_ATTACK * 2
+ ld hl, PlayerSpAtk
.lightball
; Note: Returns player special attack at hl in hl.
@@ -3103,11 +3098,11 @@
call GetDamageStatsCritical
jr c, .thickclub
- ld hl, PlayerStats + 2
+ ld hl, PlayerDefense
ld a, [hli]
ld b, a
ld c, [hl]
- ld hl, EnemyStats
+ ld hl, EnemyAttack
jr .thickclub
.Special:
@@ -3126,11 +3121,11 @@
ld hl, EnemyMonSpclAtk
call GetDamageStatsCritical
jr c, .lightball
- ld hl, PlayerStats + 8
+ ld hl, PlayerSpDef
ld a, [hli]
ld b, a
ld c, [hl]
- ld hl, EnemyStats + 6
+ ld hl, EnemySpAtk
.lightball
call LightBallBoost
@@ -3407,9 +3402,9 @@
sla c
rl b
.mimic_screen
-rept 3
dec hl
-endr
+ dec hl
+ dec hl
ld a, [hli]
ld l, [hl]
ld h, a
@@ -3953,9 +3948,9 @@
set SUBSTATUS_ENCORED, [hl]
call BattleRandom
and $3
-rept 3
inc a
-endr
+ inc a
+ inc a
ld [de], a
call CheckOpponentWentFirst
jr nz, .finish_move
@@ -4094,12 +4089,12 @@
ld a, [CurDamage + 1]
rr a
ld [CurDamage + 1], a
-rept 3
inc hl
-endr
-rept 3
+ inc hl
+ inc hl
inc de
-endr
+ inc de
+ inc de
.EnemyShareHP: ; 359ac
ld c, [hl]
@@ -7447,9 +7442,9 @@
ret nz
call BattleRandom
and 3
-rept 3
inc a
-endr
+ inc a
+ inc a
ld [hl], a
ld a, BATTLE_VARS_MOVE_ANIM
call GetBattleVar
--- a/battle/hidden_power.asm
+++ b/battle/hidden_power.asm
@@ -45,9 +45,8 @@
; Multiply by 5
ld b, a
-rept 2
add a
-endr
+ add a
add b
; Add Special & 3
@@ -75,9 +74,8 @@
ld a, [hl]
and 3 << 4
swap a
-rept 2
add a
-endr
+ add a
or b
; Skip Normal
--- /dev/null
+++ b/battle/link_result.asm
@@ -1,0 +1,162 @@
+DetermineLinkBattleResult: ; 2b930
+ callba UpdateEnemyMonInParty
+ ld hl, PartyMon1HP
+ call .CountMonsRemaining
+ push bc
+ ld hl, OTPartyMon1HP
+ call .CountMonsRemaining
+ ld a, c
+ pop bc
+ cp c
+ jr z, .even_number_of_mons_remaining
+ jr c, .defeat
+ jr .victory
+
+.even_number_of_mons_remaining
+ call .BothSides_CheckNumberMonsAtFullHealth
+ jr z, .drawn
+ ld a, e
+ cp $1
+ jr z, .victory
+ cp $2
+ jr z, .defeat
+ ld hl, PartyMon1HP
+ call .CalcPercentHPRemaining
+ push de
+ ld hl, OTPartyMon1HP
+ call .CalcPercentHPRemaining
+ pop hl
+ ld a, d
+ cp h
+ jr c, .victory
+ jr z, .compare_lo
+ jr .defeat
+
+.compare_lo
+ ld a, e
+ cp l
+ jr z, .drawn
+ jr nc, .defeat
+
+.victory
+ ld a, [wBattleResult]
+ and $f0
+ ld [wBattleResult], a
+ ret
+
+.defeat
+ ld a, [wBattleResult]
+ and $f0
+ add $1
+ ld [wBattleResult], a
+ ret
+
+.drawn
+ ld a, [wBattleResult]
+ and $f0
+ add $2
+ ld [wBattleResult], a
+ ret
+
+.CountMonsRemaining: ; 2b995
+ ld c, 0
+ ld b, 3
+ ld de, PARTYMON_STRUCT_LENGTH - 1
+.loop
+ ld a, [hli]
+ or [hl]
+ jr nz, .not_fainted
+ inc c
+
+.not_fainted
+ add hl, de
+ dec b
+ jr nz, .loop
+ ret
+
+.CalcPercentHPRemaining: ; 2b9a6
+ ld de, 0
+ ld c, $3
+.loop2
+ ld a, [hli]
+ or [hl]
+ jr z, .next
+ dec hl
+ xor a
+ ld [hDividend + 0], a
+ ld a, [hli]
+ ld [hDividend + 1], a
+ ld a, [hli]
+ ld [hDividend + 2], a
+ xor a
+ ld [hDividend + 3], a
+ ld a, [hli]
+ ld b, a
+ ld a, [hld]
+ srl b
+ rr a
+ srl b
+ rr a
+ ld [hDivisor], a
+ ld b, $4
+ call Divide
+ ld a, [hQuotient + 2]
+ add e
+ ld e, a
+ ld a, [hQuotient + 1]
+ adc d
+ ld d, a
+ dec hl
+
+.next
+ push de
+ ld de, $2f
+ add hl, de
+ pop de
+ dec c
+ jr nz, .loop2
+ ret
+
+.BothSides_CheckNumberMonsAtFullHealth: ; 2b9e1
+ ld hl, PartyMon1HP
+ call .CheckFaintedOrFullHealth
+ jr nz, .finish ; we have a pokemon that's neither fainted nor at full health
+ ld hl, OTPartyMon1HP
+ call .CheckFaintedOrFullHealth
+ ld e, $1
+ ret
+
+.finish
+ ld hl, OTPartyMon1HP
+ call .CheckFaintedOrFullHealth
+ ld e, $0
+ ret nz ; we both have pokemon that are neither fainted nor at full health
+ ld e, $2
+ ld a, $1
+ and a
+ ret
+
+.CheckFaintedOrFullHealth: ; 2ba01
+ ld d, 3
+.loop3
+ ld a, [hli]
+ ld b, a
+ ld a, [hli]
+ ld c, a
+ or b
+ jr z, .fainted_or_full_health
+ ld a, [hli]
+ cp b
+ ret nz
+ ld a, [hld]
+ cp c
+ ret nz
+
+.fainted_or_full_health
+ push de
+ ld de, PARTYMON_STRUCT_LENGTH - 2
+ add hl, de
+ pop de
+ dec d
+ jr nz, .loop3
+ ret
--- a/battle/magikarp_length.asm
+++ b/battle/magikarp_length.asm
@@ -141,9 +141,8 @@
; hl = de * 10
ld h, d
ld l, e
-rept 2
add hl, hl
-endr
+ add hl, hl
add hl, de
add hl, hl
--- a/battle/misc.asm
+++ b/battle/misc.asm
@@ -72,9 +72,8 @@
jr z, .ApplyModifier
.NextWeatherType:
-rept 2
inc de
-endr
+ inc de
jr .CheckWeatherType
@@ -99,9 +98,8 @@
jr z, .ApplyModifier
.NextWeatherMove:
-rept 2
inc de
-endr
+ inc de
jr .CheckWeatherMove
.ApplyModifier:
--- a/battle/objects/data.asm
+++ b/battle/objects/data.asm
@@ -57,22 +57,22 @@
; ANIM_OBJ_BURNED
battleanimobj $01, $90, BATTLEANIMFRAMESET_11, BATTLEANIMFUNC_03, $04, $03
-; ANIM_OBJ_11
+; ANIM_OBJ_BLIZZARD
battleanimobj $01, $90, BATTLEANIMFRAMESET_12, BATTLEANIMFUNC_08, $06, $0a
; ANIM_OBJ_12
battleanimobj $01, $90, BATTLEANIMFRAMESET_13, BATTLEANIMFUNC_00, $06, $0a
-; ANIM_OBJ_13
+; ANIM_OBJ_ICE_BEAM
battleanimobj $01, $90, BATTLEANIMFRAMESET_14, BATTLEANIMFUNC_01, $06, $0a
-; ANIM_OBJ_14
- battleanimobj $21, $78, BATTLEANIMFRAMESET_16, BATTLEANIMFUNC_0B, $05, $06
+; ANIM_OBJ_RAZOR_LEAF
+ battleanimobj $21, $78, BATTLEANIMFRAMESET_16, BATTLEANIMFUNC_RAZOR_LEAF, $05, $06
; ANIM_OBJ_POKE_BALL
battleanimobj $00, $00, BATTLEANIMFRAMESET_09, BATTLEANIMFUNC_12, $04, $0b
-; ANIM_OBJ_16
+; ANIM_OBJ_POKE_BALL_BLOCKED
battleanimobj $00, $00, BATTLEANIMFRAMESET_09, BATTLEANIMFUNC_13, $04, $0b
; ANIM_OBJ_17
@@ -90,7 +90,7 @@
; ANIM_OBJ_1B
battleanimobj $01, $90, BATTLEANIMFRAMESET_08, BATTLEANIMFUNC_00, $02, $07
-; ANIM_OBJ_1C
+; ANIM_OBJ_BALL_POOF
battleanimobj $01, $a0, BATTLEANIMFRAMESET_08, BATTLEANIMFUNC_00, $02, $07
; ANIM_OBJ_1D
@@ -105,7 +105,7 @@
; ANIM_OBJ_20
battleanimobj $01, $b0, BATTLEANIMFRAMESET_84, BATTLEANIMFUNC_36, $06, $21
-; ANIM_OBJ_21
+; ANIM_OBJ_BUBBLE
battleanimobj $01, $90, BATTLEANIMFRAMESET_21, BATTLEANIMFUNC_0C, $06, $0d
; ANIM_OBJ_22
@@ -129,13 +129,13 @@
; ANIM_OBJ_28
battleanimobj $61, $98, BATTLEANIMFRAMESET_2D, BATTLEANIMFUNC_09, $03, $10
-; ANIM_OBJ_29
+; ANIM_OBJ_ICE_BUILDUP
battleanimobj $01, $b8, BATTLEANIMFRAMESET_2E, BATTLEANIMFUNC_00, $06, $0a
; ANIM_OBJ_FROZEN
battleanimobj $01, $b8, BATTLEANIMFRAMESET_2F, BATTLEANIMFUNC_00, $06, $0a
-; ANIM_OBJ_2B
+; ANIM_OBJ_MASTER_BALL_SPARKLE
battleanimobj $01, $b8, BATTLEANIMFRAMESET_30, BATTLEANIMFUNC_14, $07, $11
; ANIM_OBJ_2C
@@ -213,7 +213,7 @@
; ANIM_OBJ_44
battleanimobj $21, $80, BATTLEANIMFRAMESET_4B, BATTLEANIMFUNC_00, $03, $11
-; ANIM_OBJ_45
+; ANIM_OBJ_ABSORB
battleanimobj $01, $88, BATTLEANIMFRAMESET_4C, BATTLEANIMFUNC_1C, $05, $12
; ANIM_OBJ_46
@@ -228,8 +228,8 @@
; ANIM_OBJ_49
battleanimobj $21, $ff, BATTLEANIMFRAMESET_54, BATTLEANIMFUNC_1F, $05, $16
-; ANIM_OBJ_4A
- battleanimobj $21, $68, BATTLEANIMFRAMESET_56, BATTLEANIMFUNC_20, $05, $06
+; ANIM_OBJ_LEECH_SEED
+ battleanimobj $21, $68, BATTLEANIMFRAMESET_56, BATTLEANIMFUNC_LEECH_SEED, $05, $06
; ANIM_OBJ_4B
battleanimobj $21, $90, BATTLEANIMFRAMESET_59, BATTLEANIMFUNC_21, $02, $0e
@@ -279,20 +279,20 @@
; ANIM_OBJ_5A
battleanimobj $21, $90, BATTLEANIMFRAMESET_6A, BATTLEANIMFUNC_27, $02, $1b
-; ANIM_OBJ_5B
- battleanimobj $00, $00, BATTLEANIMFRAMESET_6F, BATTLEANIMFUNC_29, $02, $1c
+; ANIM_OBJ_HAZE
+ battleanimobj $00, $00, BATTLEANIMFRAMESET_6F, BATTLEANIMFUNC_SPRIAL_DESCENT, $02, $1c
-; ANIM_OBJ_5C
- battleanimobj $21, $48, BATTLEANIMFRAMESET_70, BATTLEANIMFUNC_29, $02, $1c
+; ANIM_OBJ_MIST
+ battleanimobj $21, $48, BATTLEANIMFRAMESET_70, BATTLEANIMFUNC_SPRIAL_DESCENT, $02, $1c
-; ANIM_OBJ_5D
- battleanimobj $21, $48, BATTLEANIMFRAMESET_6F, BATTLEANIMFUNC_29, $02, $1c
+; ANIM_OBJ_SMOG
+ battleanimobj $21, $48, BATTLEANIMFRAMESET_6F, BATTLEANIMFUNC_SPRIAL_DESCENT, $02, $1c
-; ANIM_OBJ_5E
- battleanimobj $21, $78, BATTLEANIMFRAMESET_6F, BATTLEANIMFUNC_2A, $02, $1c
+; ANIM_OBJ_POISON_GAS
+ battleanimobj $21, $78, BATTLEANIMFRAMESET_6F, BATTLEANIMFUNC_POISON_GAS, $02, $1c
-; ANIM_OBJ_5F
- battleanimobj $61, $90, BATTLEANIMFRAMESET_71, BATTLEANIMFUNC_2B, $02, $1d
+; ANIM_OBJ_HORN
+ battleanimobj $61, $90, BATTLEANIMFRAMESET_71, BATTLEANIMFUNC_HORN, $02, $1d
; ANIM_OBJ_60
battleanimobj $61, $90, BATTLEANIMFRAMESET_72, BATTLEANIMFUNC_2C, $02, $1d
@@ -313,7 +313,7 @@
battleanimobj $01, $80, BATTLEANIMFRAMESET_30, BATTLEANIMFUNC_2F, $02, $11
; ANIM_OBJ_66
- battleanimobj $01, $78, BATTLEANIMFRAMESET_76, BATTLEANIMFUNC_2A, $04, $23
+ battleanimobj $01, $78, BATTLEANIMFRAMESET_76, BATTLEANIMFUNC_POISON_GAS, $04, $23
; ANIM_OBJ_67
battleanimobj $01, $80, BATTLEANIMFRAMESET_77, BATTLEANIMFUNC_30, $02, $1f
@@ -342,7 +342,7 @@
; ANIM_OBJ_LICK
battleanimobj $21, $98, BATTLEANIMFRAMESET_7C, BATTLEANIMFUNC_00, $02, $04
-; ANIM_OBJ_70
+; ANIM_OBJ_WITHDRAW
battleanimobj $21, $80, BATTLEANIMFRAMESET_7D, BATTLEANIMFUNC_00, $02, $18
; ANIM_OBJ_71
@@ -393,8 +393,8 @@
; ANIM_OBJ_80
battleanimobj $01, $a8, BATTLEANIMFRAMESET_0F, BATTLEANIMFUNC_3C, $04, $03
-; ANIM_OBJ_81
- battleanimobj $21, $68, BATTLEANIMFRAMESET_89, BATTLEANIMFUNC_29, $02, $1f
+; ANIM_OBJ_COTTON_SPORE
+ battleanimobj $21, $68, BATTLEANIMFRAMESET_89, BATTLEANIMFUNC_SPRIAL_DESCENT, $02, $1f
; ANIM_OBJ_82
battleanimobj $21, $b0, BATTLEANIMFRAMESET_8A, BATTLEANIMFUNC_00, $02, $1f
--- a/battle/objects/functions.asm
+++ b/battle/objects/functions.asm
@@ -13,18 +13,18 @@
; ccfce
.Jumptable:
- dw BattleAnimFunction_00 ; 00
+ dw BattleAnimFunction_Null ; 00
dw BattleAnimFunction_01 ; 01
dw BattleAnimFunction_02 ; 02
dw BattleAnimFunction_03 ; 03
dw BattleAnimFunction_04 ; 04
- dw BattleAnimFunction_05 ; 05
- dw BattleAnimFunction_06 ; 06
+ dw BattleAnimFunction_ThrowFromPlayerToEnemy ; 05
+ dw BattleAnimFunction_ThrowFromPlayerToEnemyAndDisappear ; 06
dw BattleAnimFunction_07 ; 07
dw BattleAnimFunction_08 ; 08
dw BattleAnimFunction_09 ; 09
dw BattleAnimFunction_0A ; 0a
- dw BattleAnimFunction_0B ; 0b
+ dw BattleAnimFunction_RazorLeaf ; 0b
dw BattleAnimFunction_0C ; 0c
dw BattleAnimFunction_0D ; 0d
dw BattleAnimFunction_0E ; 0e
@@ -31,8 +31,8 @@
dw BattleAnimFunction_0F ; 0f
dw BattleAnimFunction_10 ; 10
dw BattleAnimFunction_11 ; 11
- dw BattleAnimFunction_12 ; 12
- dw BattleAnimFunction_13 ; 13
+ dw BattleAnimFunction_PokeBall ; 12
+ dw BattleAnimFunction_PokeBallBlocked ; 13
dw BattleAnimFunction_14 ; 14
dw BattleAnimFunction_15 ; 15
dw BattleAnimFunction_16 ; 16
@@ -45,7 +45,7 @@
dw BattleAnimFunction_1D ; 1d
dw BattleAnimFunction_1E ; 1e
dw BattleAnimFunction_1F ; 1f
- dw BattleAnimFunction_20 ; 20
+ dw BattleAnimFunction_LeechSeed ; 20
dw BattleAnimFunction_21 ; 21
dw BattleAnimFunction_22 ; 22
dw BattleAnimFunction_23 ; 23
@@ -54,9 +54,9 @@
dw BattleAnimFunction_26 ; 26
dw BattleAnimFunction_27 ; 27
dw BattleAnimFunction_28 ; 28
- dw BattleAnimFunction_29 ; 29
- dw BattleAnimFunction_2A ; 2a
- dw BattleAnimFunction_2B ; 2b
+ dw BattleAnimFunction_SpiralDescent ; 29
+ dw BattleAnimFunction_PoisonGas ; 2a
+ dw BattleAnimFunction_Horn ; 2b
dw BattleAnimFunction_2C ; 2c
dw BattleAnimFunction_2D ; 2d
dw BattleAnimFunction_2E ; 2e
@@ -94,7 +94,7 @@
dw BattleAnimFunction_4E ; 4e
dw BattleAnimFunction_4F ; 4f
-BattleAnimFunction_00: ; cd06e (33:506e)
+BattleAnimFunction_Null: ; cd06e (33:506e)
call BattleAnim_AnonJumptable
.anon_dw
dw .zero
@@ -104,34 +104,41 @@
.zero
ret
-BattleAnimFunction_06: ; cd079 (33:5079)
- call BattleAnimFunction_05
+BattleAnimFunction_ThrowFromPlayerToEnemyAndDisappear: ; cd079 (33:5079)
+ call BattleAnimFunction_ThrowFromPlayerToEnemy
ret c
call DeinitBattleAnimation
ret
-BattleAnimFunction_05: ; cd081 (33:5081)
+BattleAnimFunction_ThrowFromPlayerToEnemy: ; cd081 (33:5081)
+ ; If x coord at $88 or beyond, abort.
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
cp $88
ret nc
+ ; Move right 2 pixels
add $2
ld [hl], a
+ ; Move down 1 pixel
ld hl, BATTLEANIMSTRUCT_YCOORD
add hl, bc
dec [hl]
+ ; Decrease ??? and hold onto its previous value (argument of the sine function)
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
dec [hl]
+ ; Get ???, which is the amplitude of the sine function
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld d, [hl]
call BattleAnim_Sine
+ ; Store the result in the Y offset
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
+ ; Carry flag denotes success
scf
ret
@@ -153,9 +160,10 @@
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
-rept 4
inc [hl]
-endr
+ inc [hl]
+ inc [hl]
+ inc [hl]
ld d, $10
push af
push de
@@ -258,7 +266,7 @@
call DeinitBattleAnimation
ret
-BattleAnimFunction_12: ; cd15c (33:515c)
+BattleAnimFunction_PokeBall: ; cd15c (33:515c)
call BattleAnim_AnonJumptable
.anon_dw
dw .zero
@@ -273,13 +281,13 @@
dw .nine
dw .ten
dw .eleven
-.zero
+.zero ; init
call GetBallAnimPal
call BattleAnim_IncAnonJumptableIndex
ret
.one
- call BattleAnimFunction_05
+ call BattleAnimFunction_ThrowFromPlayerToEnemy
ret c
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
@@ -288,7 +296,7 @@
add hl, bc
add [hl]
ld [hl], a
- ld a, $b
+ ld a, BATTLEANIMFRAMESET_0B
call ReinitBattleAnimFrameset
call BattleAnim_IncAnonJumptableIndex
ret
@@ -295,7 +303,7 @@
.three
call BattleAnim_IncAnonJumptableIndex
- ld a, $9
+ ld a, BATTLEANIMFRAMESET_09
call ReinitBattleAnimFrameset
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
@@ -325,13 +333,13 @@
sub $4
ld [hl], a
ret nz
- ld a, $c
+ ld a, BATTLEANIMFRAMESET_0C
call ReinitBattleAnimFrameset
call BattleAnim_IncAnonJumptableIndex
ret
.six
- ld a, $d
+ ld a, BATTLEANIMFRAMESET_0D
call ReinitBattleAnimFrameset
ld hl, BATTLEANIMSTRUCT_ANON_JT_INDEX
add hl, bc
@@ -343,7 +351,7 @@
.seven
call GetBallAnimPal
- ld a, $a
+ ld a, BATTLEANIMFRAMESET_0A
call ReinitBattleAnimFrameset
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_10
@@ -375,7 +383,7 @@
call DeinitBattleAnimation
ret
-BattleAnimFunction_13: ; cd212 (33:5212)
+BattleAnimFunction_PokeBallBlocked: ; cd212 (33:5212)
call BattleAnim_AnonJumptable
.anon_dw
dw .zero
@@ -392,7 +400,7 @@
ld a, [hl]
cp $70
jr nc, .next
- call BattleAnimFunction_05
+ call BattleAnimFunction_ThrowFromPlayerToEnemy
ret
.next
@@ -493,7 +501,7 @@
.three
call BattleAnim_IncAnonJumptableIndex
- ld a, $f
+ ld a, BATTLEANIMFRAMESET_0F
call ReinitBattleAnimFrameset
.four
ret
@@ -727,7 +735,7 @@
ld [hl], a
cp $7
jr z, .seven
- ld a, $11
+ ld a, BATTLEANIMFRAMESET_11
call ReinitBattleAnimFrameset
ret
@@ -746,7 +754,7 @@
.set_up_eight
call BattleAnim_IncAnonJumptableIndex
- ld a, $10
+ ld a, BATTLEANIMFRAMESET_10
call ReinitBattleAnimFrameset
.eight
ld hl, BATTLEANIMSTRUCT_0F
@@ -801,7 +809,7 @@
.six
ret
-BattleAnimFunction_0B: ; cd478 (33:5478)
+BattleAnimFunction_RazorLeaf: ; cd478 (33:5478)
call BattleAnim_AnonJumptable
.anon_dw
dw .zero
@@ -830,7 +838,7 @@
add hl, bc
ld [hli], a
ld [hl], a
- ld a, $17
+ ld a, BATTLEANIMFRAMESET_17
call ReinitBattleAnimFrameset
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
@@ -926,7 +934,7 @@
ret
.three
- ld a, $16
+ ld a, BATTLEANIMFRAMESET_16
call ReinitBattleAnimFrameset
ld hl, BATTLEANIMSTRUCT_01
add hl, bc
@@ -1077,7 +1085,7 @@
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $0
- ld a, $22
+ ld a, BATTLEANIMFRAMESET_22
call ReinitBattleAnimFrameset
.two
ld hl, BATTLEANIMSTRUCT_XCOORD
@@ -1142,12 +1150,12 @@
dw .four
.zero
call BattleAnim_IncAnonJumptableIndex
- ld a, $42
- ld [hFFC6], a
+ ld a, rSCY - $ff00
+ ld [hLCDCPointer], a
ld a, $58
- ld [hFFC7], a
+ ld [hLYOverrideStart], a
ld a, $5e
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
ret
.one
@@ -1161,7 +1169,7 @@
jr nc, .asm_cd69b
call BattleAnim_IncAnonJumptableIndex
xor a
- ld [hFFC7], a
+ ld [hLYOverrideStart], a
ret
.asm_cd69b
@@ -1180,7 +1188,7 @@
add [hl]
sub $10
ret c
- ld [hFFC7], a
+ ld [hLYOverrideStart], a
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
ld a, [hl]
@@ -1201,9 +1209,9 @@
cp $70
jr c, asm_cd6da
xor a
- ld [hFFC6], a
- ld [hFFC7], a
- ld [hFFC8], a
+ ld [hLCDCPointer], a
+ ld [hLYOverrideStart], a
+ ld [hLYOverrideEnd], a
.four
call DeinitBattleAnimation
ret
@@ -1214,7 +1222,7 @@
ld [hl], a
sub $10
ret c
- ld [hFFC7], a
+ ld [hLYOverrideStart], a
ret
BattleAnimFunction_0E: ; cd6e3 (33:56e3)
@@ -1226,8 +1234,8 @@
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
- ld a, $24
- add [hl]
+ ld a, BATTLEANIMFRAMESET_24
+ add [hl] ; offset
call ReinitBattleAnimFrameset
Functioncd6f7: ; cd6f7 (33:56f7)
ld hl, BATTLEANIMSTRUCT_XCOORD
@@ -1282,7 +1290,7 @@
.asm_cd747
call BattleAnim_IncAnonJumptableIndex
- ld a, $28
+ ld a, BATTLEANIMFRAMESET_28
call ReinitBattleAnimFrameset
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
@@ -1306,7 +1314,7 @@
.asm_cd76e
call BattleAnim_IncAnonJumptableIndex
- ld a, $29
+ ld a, BATTLEANIMFRAMESET_29
call ReinitBattleAnimFrameset
Functioncd776: ; cd776 (33:5776)
ret
@@ -1419,7 +1427,7 @@
dw Functioncd820
Functioncd817: ; cd817 (33:5817)
call BattleAnim_IncAnonJumptableIndex
- ld a, $35
+ ld a, BATTLEANIMFRAMESET_35
call ReinitBattleAnimFrameset
Functioncd81f: ; cd81f (33:581f)
ret
@@ -1477,18 +1485,18 @@
add hl, bc
ld [hl], a
bit 7, a
- jr nz, .asm_cd87e
+ jr nz, .load_no_inc
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld a, [hl]
inc a
- jr .asm_cd883
+ jr .reinit
-.asm_cd87e
+.load_no_inc
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld a, [hl]
-.asm_cd883
+.reinit
call ReinitBattleAnimFrameset
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
@@ -1800,14 +1808,14 @@
Functioncda4c: ; cda4c (33:5a4c)
ret
-BattleAnimFunction_20: ; cda4d (33:5a4d)
+BattleAnimFunction_LeechSeed: ; cda4d (33:5a4d)
call BattleAnim_AnonJumptable
.anon_dw
- dw Functioncda58
- dw Functioncda62
- dw Functioncda7a
- dw Functioncda8c
-Functioncda58: ; cda58 (33:5a58)
+ dw .zero
+ dw .one
+ dw .two
+ dw .three
+.zero: ; cda58 (33:5a58)
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
@@ -1814,36 +1822,36 @@
ld [hl], $40
ret
-Functioncda62: ; cda62 (33:5a62)
+.one: ; cda62 (33:5a62)
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld a, [hl]
cp $20
- jr c, .asm_cda6f
+ jr c, .sprout
call Functioncda8d
ret
-.asm_cda6f
+.sprout
ld [hl], $40
- ld a, $57
+ ld a, BATTLEANIMFRAMESET_57
call ReinitBattleAnimFrameset
call BattleAnim_IncAnonJumptableIndex
ret
-Functioncda7a: ; cda7a (33:5a7a)
+.two: ; cda7a (33:5a7a)
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld a, [hl]
and a
- jr z, .asm_cda84
+ jr z, .flutter
dec [hl]
ret
-.asm_cda84
+.flutter
call BattleAnim_IncAnonJumptableIndex
- ld a, $58
+ ld a, BATTLEANIMFRAMESET_58
call ReinitBattleAnimFrameset
-Functioncda8c: ; cda8c (33:5a8c)
+.three: ; cda8c (33:5a8c)
ret
Functioncda8d: ; cda8d (33:5a8d)
@@ -2124,7 +2132,7 @@
ret
Functioncdc1e: ; cdc1e (33:5c1e)
- ld a, $4e
+ ld a, BATTLEANIMFRAMESET_4E
call ReinitBattleAnimFrameset
call BattleAnim_IncAnonJumptableIndex
ret
@@ -2143,7 +2151,7 @@
ret
Functioncdc39: ; cdc39 (33:5c39)
- ld a, $50
+ ld a, BATTLEANIMFRAMESET_50
call ReinitBattleAnimFrameset
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
@@ -2152,7 +2160,7 @@
ret
Functioncdc48: ; cdc48 (33:5c48)
- ld a, $4f
+ ld a, BATTLEANIMFRAMESET_4F
call ReinitBattleAnimFrameset
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F
@@ -2258,7 +2266,7 @@
ld [hl], $8
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
- ld a, $59
+ ld a, BATTLEANIMFRAMESET_59
add [hl]
call ReinitBattleAnimFrameset
ret
@@ -2330,7 +2338,7 @@
and $80
rlca
ld [hl], a
- add $5d
+ add BATTLEANIMFRAMESET_5D
call ReinitBattleAnimFrameset
ret
@@ -2456,7 +2464,7 @@
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
- add $63
+ add BATTLEANIMFRAMESET_63
call ReinitBattleAnimFrameset
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
@@ -2540,7 +2548,7 @@
add hl, bc
set 6, [hl]
.asm_cde83
- add $6a
+ add BATTLEANIMFRAMESET_6A
call ReinitBattleAnimFrameset
Functioncde88: ; cde88 (33:5e88)
ret
@@ -2578,7 +2586,7 @@
xor $ff
inc a
ld [hl], a
- ld a, $6e
+ ld a, BATTLEANIMFRAMESET_6E
call ReinitBattleAnimFrameset
ret
@@ -2606,7 +2614,7 @@
ld [hl], a
ret
-BattleAnimFunction_29: ; cdedd (33:5edd)
+BattleAnimFunction_SpiralDescent: ; cdedd (33:5edd)
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
@@ -2639,11 +2647,11 @@
add hl, bc
ld a, [hl]
cp $28
- jr nc, .asm_cdf17
+ jr nc, .delete
inc [hl]
ret
-.asm_cdf17
+.delete
call DeinitBattleAnimation
ret
@@ -2688,17 +2696,17 @@
call DeinitBattleAnimation
ret
-BattleAnimFunction_2A: ; cdf59 (33:5f59)
+BattleAnimFunction_PoisonGas: ; cdf59 (33:5f59)
call BattleAnim_AnonJumptable
.anon_dw
dw Functioncdf60
- dw BattleAnimFunction_29
+ dw BattleAnimFunction_SpiralDescent
Functioncdf60: ; cdf60 (33:5f60)
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
cp $84
- jr nc, .asm_cdf88
+ jr nc, .next
inc [hl]
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
@@ -2719,7 +2727,7 @@
dec [hl]
ret
-.asm_cdf88
+.next
call BattleAnim_IncAnonJumptableIndex
ret
@@ -2865,14 +2873,14 @@
call DeinitBattleAnimation
ret
-BattleAnimFunction_2B: ; ce063 (33:6063)
+BattleAnimFunction_Horn: ; ce063 (33:6063)
call BattleAnim_AnonJumptable
.anon_dw
- dw Functionce06e
- dw Functionce083
- dw Functionce091
+ dw .zero
+ dw .one
+ dw .two
dw Functionce09e
-Functionce06e: ; ce06e (33:606e)
+.zero: ; ce06e (33:606e)
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
@@ -2887,7 +2895,7 @@
ld [hl], a
ret
-Functionce083: ; ce083 (33:6083)
+.one: ; ce083 (33:6083)
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
@@ -2897,7 +2905,7 @@
call Functionce70a
ret
-Functionce091: ; ce091 (33:6091)
+.two: ; ce091 (33:6091)
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld a, [hl]
@@ -3395,7 +3403,7 @@
add hl, bc
ld a, [hl]
and $7f
- add $81
+ add BATTLEANIMFRAMESET_81
call ReinitBattleAnimFrameset
Functionce375: ; ce375 (33:6375)
ld hl, BATTLEANIMSTRUCT_0B
@@ -3437,7 +3445,7 @@
.asm_ce3a6
call BattleAnim_IncAnonJumptableIndex
- ld a, $20
+ ld a, BATTLEANIMFRAMESET_20
call ReinitBattleAnimFrameset
Functionce3ae: ; ce3ae (33:63ae)
ld hl, BATTLEANIMSTRUCT_YOFFSET
@@ -3611,7 +3619,7 @@
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
- ld a, $24
+ ld a, BATTLEANIMFRAMESET_24
add [hl]
call ReinitBattleAnimFrameset
Functionce4b0: ; ce4b0 (33:64b0)
@@ -3832,13 +3840,14 @@
add hl, bc
ld a, [hl]
cp $d0
- jr z, .asm_ce5ea
-rept 4
+ jr z, .disappear
dec [hl]
-endr
+ dec [hl]
+ dec [hl]
+ dec [hl]
ret
-.asm_ce5ea
+.disappear
call DeinitBattleAnimation
ret
@@ -3865,9 +3874,10 @@
ld a, [hl]
cp $4
jr z, Functionce618
-rept 4
inc [hl]
-endr
+ inc [hl]
+ inc [hl]
+ inc [hl]
ret
Functionce618: ; ce618 (33:6618)
@@ -3883,9 +3893,10 @@
ld a, [hl]
cp $d8
ret z
-rept 4
dec [hl]
-endr
+ dec [hl]
+ dec [hl]
+ dec [hl]
ret
BattleAnimFunction_4A: ; ce62f (33:662f)
@@ -4085,6 +4096,7 @@
BattleAnim_Cosine: ; ce732 (33:6732)
add $10
BattleAnim_Sine: ; ce734 (33:6734)
+; a = d sin a
and $3f
cp $20
jr nc, .negative
--- a/battle/sliding_intro.asm
+++ b/battle/sliding_intro.asm
@@ -5,10 +5,10 @@
ld [rSVBK], a
call .subfunction1
ld a, rSCX - $ff00
- ld [hFFC6], a
+ ld [hLCDCPointer], a
call .subfunction2
xor a
- ld [hFFC6], a
+ ld [hLCDCPointer], a
pop af
ld [rSVBK], a
ret
@@ -39,12 +39,10 @@
ld a, d
ld [hSCX], a
call .subfunction5
-rept 2
inc e
-endr
-rept 2
+ inc e
dec d
-endr
+ dec d
pop af
push af
cp $1
@@ -66,9 +64,8 @@
ld c, $12 ; 18
ld de, $4
.loop3
-rept 2
dec [hl]
-endr
+ dec [hl]
add hl, de
dec c
jr nz, .loop3
--- a/battle/trainer_huds.asm
+++ b/battle/trainer_huds.asm
@@ -81,9 +81,9 @@
jr z, .fainted
.got_hp
-rept 3
dec hl
-endr
+ dec hl
+ dec hl
ld a, [hl]
and a
ld b, $32 ; statused
@@ -92,9 +92,9 @@
jr .load
.fainted
-rept 3
dec hl
-endr
+ dec hl
+ dec hl
.load
ld a, b
@@ -260,7 +260,7 @@
ld [hli], a
ld [hl], $6a ; "S"
callba LinkBattle_TrainerHuds ; no need to callba
- ld b, SCGB_08
+ ld b, SCGB_DIPLOMA
call GetSGBLayout
call SetPalettes
ld a, $e4
--- a/constants.asm
+++ b/constants.asm
@@ -33,3 +33,4 @@
INCLUDE "constants/battle_tower_constants.asm"
INCLUDE "constants/cry_constants.asm"
INCLUDE "constants/audio_constants.asm"
+INCLUDE "constants/printer_constants.asm"
--- a/constants/animation_constants.asm
+++ b/constants/animation_constants.asm
@@ -5,484 +5,484 @@
const BATTLEANIMSTRUCT_FRAMESET_ID
const BATTLEANIMSTRUCT_FUNCTION
const BATTLEANIMSTRUCT_PALETTE
- const BATTLEANIMSTRUCT_TILEID
- const BATTLEANIMSTRUCT_XCOORD
- const BATTLEANIMSTRUCT_YCOORD
- const BATTLEANIMSTRUCT_XOFFSET
- const BATTLEANIMSTRUCT_YOFFSET
- const BATTLEANIMSTRUCT_0B
- const BATTLEANIMSTRUCT_DURATION
- const BATTLEANIMSTRUCT_FRAME
- const BATTLEANIMSTRUCT_ANON_JT_INDEX
- const BATTLEANIMSTRUCT_0F
- const BATTLEANIMSTRUCT_10
- const BATTLEANIMSTRUCT_11
- const BATTLEANIMSTRUCT_12
- const BATTLEANIMSTRUCT_13
- const BATTLEANIMSTRUCT_14
- const BATTLEANIMSTRUCT_15
- const BATTLEANIMSTRUCT_16
- const BATTLEANIMSTRUCT_17
+ const BATTLEANIMSTRUCT_TILEID
+ const BATTLEANIMSTRUCT_XCOORD
+ const BATTLEANIMSTRUCT_YCOORD
+ const BATTLEANIMSTRUCT_XOFFSET
+ const BATTLEANIMSTRUCT_YOFFSET
+ const BATTLEANIMSTRUCT_0B
+ const BATTLEANIMSTRUCT_DURATION
+ const BATTLEANIMSTRUCT_FRAME
+ const BATTLEANIMSTRUCT_ANON_JT_INDEX
+ const BATTLEANIMSTRUCT_0F
+ const BATTLEANIMSTRUCT_10
+ const BATTLEANIMSTRUCT_11
+ const BATTLEANIMSTRUCT_12
+ const BATTLEANIMSTRUCT_13
+ const BATTLEANIMSTRUCT_14
+ const BATTLEANIMSTRUCT_15
+ const BATTLEANIMSTRUCT_16
+ const BATTLEANIMSTRUCT_17
BATTLEANIMSTRUCT_LENGTH EQU const_value
const_def
const ANIM_OBJ_00
- const ANIM_OBJ_01
- const ANIM_OBJ_02
- const ANIM_OBJ_03
- const ANIM_OBJ_04
- const ANIM_OBJ_05
- const ANIM_OBJ_06
- const ANIM_OBJ_07
- const ANIM_OBJ_08
- const ANIM_OBJ_09
- const ANIM_OBJ_0A
- const ANIM_OBJ_0B
- const ANIM_OBJ_0C
- const ANIM_OBJ_0D
- const ANIM_OBJ_0E
- const ANIM_OBJ_0F
- const ANIM_OBJ_BURNED
- const ANIM_OBJ_11
- const ANIM_OBJ_12
- const ANIM_OBJ_13
- const ANIM_OBJ_14
- const ANIM_OBJ_POKE_BALL
- const ANIM_OBJ_16
- const ANIM_OBJ_17
- const ANIM_OBJ_18
- const ANIM_OBJ_19
- const ANIM_OBJ_1A
- const ANIM_OBJ_1B
- const ANIM_OBJ_1C
- const ANIM_OBJ_1D
- const ANIM_OBJ_1E
- const ANIM_OBJ_1F
- const ANIM_OBJ_20
- const ANIM_OBJ_21
- const ANIM_OBJ_22
- const ANIM_OBJ_23
- const ANIM_OBJ_24
- const ANIM_OBJ_25
- const ANIM_OBJ_26
- const ANIM_OBJ_27
- const ANIM_OBJ_28
- const ANIM_OBJ_29
- const ANIM_OBJ_FROZEN
- const ANIM_OBJ_2B
- const ANIM_OBJ_2C
- const ANIM_OBJ_2D
- const ANIM_OBJ_2E
- const ANIM_OBJ_2F
- const ANIM_OBJ_30
- const ANIM_OBJ_31
- const ANIM_OBJ_LIGHTNING_BOLT
- const ANIM_OBJ_33
- const ANIM_OBJ_34
- const ANIM_OBJ_35
- const ANIM_OBJ_36
- const ANIM_OBJ_37
- const ANIM_OBJ_38
- const ANIM_OBJ_39
- const ANIM_OBJ_3A
- const ANIM_OBJ_3B
- const ANIM_OBJ_3C
- const ANIM_OBJ_3D
- const ANIM_OBJ_GUST
- const ANIM_OBJ_3F
- const ANIM_OBJ_40
- const ANIM_OBJ_41
- const ANIM_OBJ_42
- const ANIM_OBJ_43
- const ANIM_OBJ_44
- const ANIM_OBJ_45
- const ANIM_OBJ_46
- const ANIM_OBJ_47
- const ANIM_OBJ_48
- const ANIM_OBJ_49
- const ANIM_OBJ_4A
- const ANIM_OBJ_4B
- const ANIM_OBJ_4C
- const ANIM_OBJ_4D
- const ANIM_OBJ_4E
- const ANIM_OBJ_4F
- const ANIM_OBJ_50
- const ANIM_OBJ_51
- const ANIM_OBJ_CHICK
- const ANIM_OBJ_53
- const ANIM_OBJ_54
- const ANIM_OBJ_SKULL
- const ANIM_OBJ_56
- const ANIM_OBJ_57
- const ANIM_OBJ_58
- const ANIM_OBJ_PARALYZED
- const ANIM_OBJ_5A
- const ANIM_OBJ_5B
- const ANIM_OBJ_5C
- const ANIM_OBJ_5D
- const ANIM_OBJ_5E
- const ANIM_OBJ_5F
- const ANIM_OBJ_60
- const ANIM_OBJ_61
- const ANIM_OBJ_62
- const ANIM_OBJ_63
- const ANIM_OBJ_64
- const ANIM_OBJ_65
- const ANIM_OBJ_66
- const ANIM_OBJ_67
- const ANIM_OBJ_68
- const ANIM_OBJ_69
- const ANIM_OBJ_6A
- const ANIM_OBJ_6B
- const ANIM_OBJ_6C
- const ANIM_OBJ_6D
- const ANIM_OBJ_SKY_ATTACK_FEAROW
- const ANIM_OBJ_LICK
- const ANIM_OBJ_70
- const ANIM_OBJ_71
- const ANIM_OBJ_72
- const ANIM_OBJ_73
- const ANIM_OBJ_74
- const ANIM_OBJ_75
- const ANIM_OBJ_76
- const ANIM_OBJ_77
- const ANIM_OBJ_78
- const ANIM_OBJ_79
- const ANIM_OBJ_7A
- const ANIM_OBJ_7B
- const ANIM_OBJ_7C
- const ANIM_OBJ_7D
- const ANIM_OBJ_HEART
- const ANIM_OBJ_7F
- const ANIM_OBJ_80
- const ANIM_OBJ_81
- const ANIM_OBJ_82
- const ANIM_OBJ_83
- const ANIM_OBJ_84
- const ANIM_OBJ_85
- const ANIM_OBJ_86
- const ANIM_OBJ_87
- const ANIM_OBJ_88
- const ANIM_OBJ_89
- const ANIM_OBJ_8A
- const ANIM_OBJ_8B
- const ANIM_OBJ_8C
- const ANIM_OBJ_8D
- const ANIM_OBJ_SPIKES
- const ANIM_OBJ_8F
- const ANIM_OBJ_90
- const ANIM_OBJ_91
- const ANIM_OBJ_92
- const ANIM_OBJ_93
- const ANIM_OBJ_94
- const ANIM_OBJ_95
- const ANIM_OBJ_96
- const ANIM_OBJ_97
- const ANIM_OBJ_98
- const ANIM_OBJ_99
- const ANIM_OBJ_9A
- const ANIM_OBJ_9B
- const ANIM_OBJ_9C
- const ANIM_OBJ_9D
- const ANIM_OBJ_9E
- const ANIM_OBJ_9F
- const ANIM_OBJ_A0
- const ANIM_OBJ_A1
- const ANIM_OBJ_A2
- const ANIM_OBJ_A3
- const ANIM_OBJ_A4
- const ANIM_OBJ_A5
- const ANIM_OBJ_PERISH_SONG
- const ANIM_OBJ_A7
- const ANIM_OBJ_A8
- const ANIM_OBJ_A9
- const ANIM_OBJ_AA
- const ANIM_OBJ_AB
- const ANIM_OBJ_AC
- const ANIM_OBJ_AD
- const ANIM_OBJ_AE
- const ANIM_OBJ_AF
- const ANIM_OBJ_B0
- const ANIM_OBJ_B1
- const ANIM_OBJ_B2
- const ANIM_OBJ_B3
- const ANIM_OBJ_B4
- const ANIM_OBJ_B5
- const ANIM_OBJ_FLOWER
- const ANIM_OBJ_COTTON
- const ANIM_OBJ_PLAYERFEETFOLLOW
- const ANIM_OBJ_ENEMYFEETFOLLOW
- const ANIM_OBJ_BA
- const ANIM_OBJ_BB
+ const ANIM_OBJ_01
+ const ANIM_OBJ_02
+ const ANIM_OBJ_03
+ const ANIM_OBJ_04
+ const ANIM_OBJ_05
+ const ANIM_OBJ_06
+ const ANIM_OBJ_07
+ const ANIM_OBJ_08
+ const ANIM_OBJ_09
+ const ANIM_OBJ_0A
+ const ANIM_OBJ_0B
+ const ANIM_OBJ_0C
+ const ANIM_OBJ_0D
+ const ANIM_OBJ_0E
+ const ANIM_OBJ_0F
+ const ANIM_OBJ_BURNED
+ const ANIM_OBJ_BLIZZARD
+ const ANIM_OBJ_12
+ const ANIM_OBJ_ICE_BEAM
+ const ANIM_OBJ_RAZOR_LEAF
+ const ANIM_OBJ_POKE_BALL
+ const ANIM_OBJ_POKE_BALL_BLOCKED
+ const ANIM_OBJ_17
+ const ANIM_OBJ_18
+ const ANIM_OBJ_19
+ const ANIM_OBJ_1A
+ const ANIM_OBJ_1B
+ const ANIM_OBJ_BALL_POOF
+ const ANIM_OBJ_1D
+ const ANIM_OBJ_1E
+ const ANIM_OBJ_1F
+ const ANIM_OBJ_20
+ const ANIM_OBJ_BUBBLE
+ const ANIM_OBJ_22
+ const ANIM_OBJ_23
+ const ANIM_OBJ_24
+ const ANIM_OBJ_25
+ const ANIM_OBJ_26
+ const ANIM_OBJ_27
+ const ANIM_OBJ_28
+ const ANIM_OBJ_ICE_BUILDUP
+ const ANIM_OBJ_FROZEN
+ const ANIM_OBJ_MASTER_BALL_SPARKLE
+ const ANIM_OBJ_2C
+ const ANIM_OBJ_2D
+ const ANIM_OBJ_2E
+ const ANIM_OBJ_2F
+ const ANIM_OBJ_30
+ const ANIM_OBJ_31
+ const ANIM_OBJ_LIGHTNING_BOLT
+ const ANIM_OBJ_33
+ const ANIM_OBJ_34
+ const ANIM_OBJ_35
+ const ANIM_OBJ_36
+ const ANIM_OBJ_37
+ const ANIM_OBJ_38
+ const ANIM_OBJ_39
+ const ANIM_OBJ_3A
+ const ANIM_OBJ_3B
+ const ANIM_OBJ_3C
+ const ANIM_OBJ_3D
+ const ANIM_OBJ_GUST
+ const ANIM_OBJ_3F
+ const ANIM_OBJ_40
+ const ANIM_OBJ_41
+ const ANIM_OBJ_42
+ const ANIM_OBJ_43
+ const ANIM_OBJ_44
+ const ANIM_OBJ_ABSORB
+ const ANIM_OBJ_46
+ const ANIM_OBJ_47
+ const ANIM_OBJ_48
+ const ANIM_OBJ_49
+ const ANIM_OBJ_LEECH_SEED
+ const ANIM_OBJ_4B
+ const ANIM_OBJ_4C
+ const ANIM_OBJ_4D
+ const ANIM_OBJ_4E
+ const ANIM_OBJ_4F
+ const ANIM_OBJ_50
+ const ANIM_OBJ_51
+ const ANIM_OBJ_CHICK
+ const ANIM_OBJ_53
+ const ANIM_OBJ_54
+ const ANIM_OBJ_SKULL
+ const ANIM_OBJ_56
+ const ANIM_OBJ_57
+ const ANIM_OBJ_58
+ const ANIM_OBJ_PARALYZED
+ const ANIM_OBJ_5A
+ const ANIM_OBJ_HAZE
+ const ANIM_OBJ_MIST
+ const ANIM_OBJ_SMOG
+ const ANIM_OBJ_POISON_GAS
+ const ANIM_OBJ_HORN
+ const ANIM_OBJ_60
+ const ANIM_OBJ_61
+ const ANIM_OBJ_62
+ const ANIM_OBJ_63
+ const ANIM_OBJ_64
+ const ANIM_OBJ_65
+ const ANIM_OBJ_66
+ const ANIM_OBJ_67
+ const ANIM_OBJ_68
+ const ANIM_OBJ_69
+ const ANIM_OBJ_6A
+ const ANIM_OBJ_6B
+ const ANIM_OBJ_6C
+ const ANIM_OBJ_6D
+ const ANIM_OBJ_SKY_ATTACK_FEAROW
+ const ANIM_OBJ_LICK
+ const ANIM_OBJ_WITHDRAW
+ const ANIM_OBJ_71
+ const ANIM_OBJ_72
+ const ANIM_OBJ_73
+ const ANIM_OBJ_74
+ const ANIM_OBJ_75
+ const ANIM_OBJ_76
+ const ANIM_OBJ_77
+ const ANIM_OBJ_78
+ const ANIM_OBJ_79
+ const ANIM_OBJ_7A
+ const ANIM_OBJ_7B
+ const ANIM_OBJ_7C
+ const ANIM_OBJ_7D
+ const ANIM_OBJ_HEART
+ const ANIM_OBJ_7F
+ const ANIM_OBJ_80
+ const ANIM_OBJ_COTTON_SPORE
+ const ANIM_OBJ_82
+ const ANIM_OBJ_83
+ const ANIM_OBJ_84
+ const ANIM_OBJ_85
+ const ANIM_OBJ_86
+ const ANIM_OBJ_87
+ const ANIM_OBJ_88
+ const ANIM_OBJ_89
+ const ANIM_OBJ_8A
+ const ANIM_OBJ_8B
+ const ANIM_OBJ_8C
+ const ANIM_OBJ_8D
+ const ANIM_OBJ_SPIKES
+ const ANIM_OBJ_8F
+ const ANIM_OBJ_90
+ const ANIM_OBJ_91
+ const ANIM_OBJ_92
+ const ANIM_OBJ_93
+ const ANIM_OBJ_94
+ const ANIM_OBJ_95
+ const ANIM_OBJ_96
+ const ANIM_OBJ_97
+ const ANIM_OBJ_98
+ const ANIM_OBJ_99
+ const ANIM_OBJ_9A
+ const ANIM_OBJ_9B
+ const ANIM_OBJ_9C
+ const ANIM_OBJ_9D
+ const ANIM_OBJ_9E
+ const ANIM_OBJ_9F
+ const ANIM_OBJ_A0
+ const ANIM_OBJ_A1
+ const ANIM_OBJ_A2
+ const ANIM_OBJ_A3
+ const ANIM_OBJ_A4
+ const ANIM_OBJ_A5
+ const ANIM_OBJ_PERISH_SONG
+ const ANIM_OBJ_A7
+ const ANIM_OBJ_A8
+ const ANIM_OBJ_A9
+ const ANIM_OBJ_AA
+ const ANIM_OBJ_AB
+ const ANIM_OBJ_AC
+ const ANIM_OBJ_AD
+ const ANIM_OBJ_AE
+ const ANIM_OBJ_AF
+ const ANIM_OBJ_B0
+ const ANIM_OBJ_B1
+ const ANIM_OBJ_B2
+ const ANIM_OBJ_B3
+ const ANIM_OBJ_B4
+ const ANIM_OBJ_B5
+ const ANIM_OBJ_FLOWER
+ const ANIM_OBJ_COTTON
+ const ANIM_OBJ_PLAYERFEETFOLLOW
+ const ANIM_OBJ_ENEMYFEETFOLLOW
+ const ANIM_OBJ_BA
+ const ANIM_OBJ_BB
const_def
const BATTLEANIMFUNC_00
- const BATTLEANIMFUNC_01
- const BATTLEANIMFUNC_02
- const BATTLEANIMFUNC_03
- const BATTLEANIMFUNC_04
- const BATTLEANIMFUNC_05
- const BATTLEANIMFUNC_06
- const BATTLEANIMFUNC_07
- const BATTLEANIMFUNC_08
- const BATTLEANIMFUNC_09
- const BATTLEANIMFUNC_0A
- const BATTLEANIMFUNC_0B
- const BATTLEANIMFUNC_0C
- const BATTLEANIMFUNC_0D
- const BATTLEANIMFUNC_0E
- const BATTLEANIMFUNC_0F
- const BATTLEANIMFUNC_10
- const BATTLEANIMFUNC_11
- const BATTLEANIMFUNC_12
- const BATTLEANIMFUNC_13
- const BATTLEANIMFUNC_14
- const BATTLEANIMFUNC_15
- const BATTLEANIMFUNC_16
- const BATTLEANIMFUNC_17
- const BATTLEANIMFUNC_18
- const BATTLEANIMFUNC_19
- const BATTLEANIMFUNC_1A
- const BATTLEANIMFUNC_1B
- const BATTLEANIMFUNC_1C
- const BATTLEANIMFUNC_1D
- const BATTLEANIMFUNC_1E
- const BATTLEANIMFUNC_1F
- const BATTLEANIMFUNC_20
- const BATTLEANIMFUNC_21
- const BATTLEANIMFUNC_22
- const BATTLEANIMFUNC_23
- const BATTLEANIMFUNC_24
- const BATTLEANIMFUNC_25
- const BATTLEANIMFUNC_26
- const BATTLEANIMFUNC_27
- const BATTLEANIMFUNC_28
- const BATTLEANIMFUNC_29
- const BATTLEANIMFUNC_2A
- const BATTLEANIMFUNC_2B
- const BATTLEANIMFUNC_2C
- const BATTLEANIMFUNC_2D
- const BATTLEANIMFUNC_2E
- const BATTLEANIMFUNC_2F
- const BATTLEANIMFUNC_30
- const BATTLEANIMFUNC_31
- const BATTLEANIMFUNC_32
- const BATTLEANIMFUNC_33
- const BATTLEANIMFUNC_34
- const BATTLEANIMFUNC_35
- const BATTLEANIMFUNC_36
- const BATTLEANIMFUNC_37
- const BATTLEANIMFUNC_38
- const BATTLEANIMFUNC_39
- const BATTLEANIMFUNC_3A
- const BATTLEANIMFUNC_3B
- const BATTLEANIMFUNC_3C
- const BATTLEANIMFUNC_3D
- const BATTLEANIMFUNC_3E
- const BATTLEANIMFUNC_3F
- const BATTLEANIMFUNC_40
- const BATTLEANIMFUNC_41
- const BATTLEANIMFUNC_42
- const BATTLEANIMFUNC_43
- const BATTLEANIMFUNC_44
- const BATTLEANIMFUNC_45
- const BATTLEANIMFUNC_46
- const BATTLEANIMFUNC_47
- const BATTLEANIMFUNC_48
- const BATTLEANIMFUNC_49
- const BATTLEANIMFUNC_4A
- const BATTLEANIMFUNC_4B
- const BATTLEANIMFUNC_4C
- const BATTLEANIMFUNC_4D
- const BATTLEANIMFUNC_4E
- const BATTLEANIMFUNC_4F
+ const BATTLEANIMFUNC_01
+ const BATTLEANIMFUNC_02
+ const BATTLEANIMFUNC_03
+ const BATTLEANIMFUNC_04
+ const BATTLEANIMFUNC_05
+ const BATTLEANIMFUNC_06
+ const BATTLEANIMFUNC_07
+ const BATTLEANIMFUNC_08
+ const BATTLEANIMFUNC_09
+ const BATTLEANIMFUNC_0A
+ const BATTLEANIMFUNC_RAZOR_LEAF
+ const BATTLEANIMFUNC_0C
+ const BATTLEANIMFUNC_0D
+ const BATTLEANIMFUNC_0E
+ const BATTLEANIMFUNC_0F
+ const BATTLEANIMFUNC_10
+ const BATTLEANIMFUNC_11
+ const BATTLEANIMFUNC_12
+ const BATTLEANIMFUNC_13
+ const BATTLEANIMFUNC_14
+ const BATTLEANIMFUNC_15
+ const BATTLEANIMFUNC_16
+ const BATTLEANIMFUNC_17
+ const BATTLEANIMFUNC_18
+ const BATTLEANIMFUNC_19
+ const BATTLEANIMFUNC_1A
+ const BATTLEANIMFUNC_1B
+ const BATTLEANIMFUNC_1C
+ const BATTLEANIMFUNC_1D
+ const BATTLEANIMFUNC_1E
+ const BATTLEANIMFUNC_1F
+ const BATTLEANIMFUNC_LEECH_SEED
+ const BATTLEANIMFUNC_21
+ const BATTLEANIMFUNC_22
+ const BATTLEANIMFUNC_23
+ const BATTLEANIMFUNC_24
+ const BATTLEANIMFUNC_25
+ const BATTLEANIMFUNC_26
+ const BATTLEANIMFUNC_27
+ const BATTLEANIMFUNC_28
+ const BATTLEANIMFUNC_SPRIAL_DESCENT
+ const BATTLEANIMFUNC_POISON_GAS
+ const BATTLEANIMFUNC_HORN
+ const BATTLEANIMFUNC_2C
+ const BATTLEANIMFUNC_2D
+ const BATTLEANIMFUNC_2E
+ const BATTLEANIMFUNC_2F
+ const BATTLEANIMFUNC_30
+ const BATTLEANIMFUNC_31
+ const BATTLEANIMFUNC_32
+ const BATTLEANIMFUNC_33
+ const BATTLEANIMFUNC_34
+ const BATTLEANIMFUNC_35
+ const BATTLEANIMFUNC_36
+ const BATTLEANIMFUNC_37
+ const BATTLEANIMFUNC_38
+ const BATTLEANIMFUNC_39
+ const BATTLEANIMFUNC_3A
+ const BATTLEANIMFUNC_3B
+ const BATTLEANIMFUNC_3C
+ const BATTLEANIMFUNC_3D
+ const BATTLEANIMFUNC_3E
+ const BATTLEANIMFUNC_3F
+ const BATTLEANIMFUNC_40
+ const BATTLEANIMFUNC_41
+ const BATTLEANIMFUNC_42
+ const BATTLEANIMFUNC_43
+ const BATTLEANIMFUNC_44
+ const BATTLEANIMFUNC_45
+ const BATTLEANIMFUNC_46
+ const BATTLEANIMFUNC_47
+ const BATTLEANIMFUNC_48
+ const BATTLEANIMFUNC_49
+ const BATTLEANIMFUNC_4A
+ const BATTLEANIMFUNC_4B
+ const BATTLEANIMFUNC_4C
+ const BATTLEANIMFUNC_4D
+ const BATTLEANIMFUNC_4E
+ const BATTLEANIMFUNC_4F
const_def
const BATTLEANIMFRAMESET_00
- const BATTLEANIMFRAMESET_01
- const BATTLEANIMFRAMESET_02
- const BATTLEANIMFRAMESET_03
- const BATTLEANIMFRAMESET_04
- const BATTLEANIMFRAMESET_05
- const BATTLEANIMFRAMESET_06
- const BATTLEANIMFRAMESET_07
- const BATTLEANIMFRAMESET_08
- const BATTLEANIMFRAMESET_09
- const BATTLEANIMFRAMESET_0A
- const BATTLEANIMFRAMESET_0B
- const BATTLEANIMFRAMESET_0C
- const BATTLEANIMFRAMESET_0D
- const BATTLEANIMFRAMESET_0E
- const BATTLEANIMFRAMESET_0F
- const BATTLEANIMFRAMESET_10
- const BATTLEANIMFRAMESET_11
- const BATTLEANIMFRAMESET_12
- const BATTLEANIMFRAMESET_13
- const BATTLEANIMFRAMESET_14
- const BATTLEANIMFRAMESET_15
- const BATTLEANIMFRAMESET_16
- const BATTLEANIMFRAMESET_17
- const BATTLEANIMFRAMESET_18
- const BATTLEANIMFRAMESET_19
- const BATTLEANIMFRAMESET_1A
- const BATTLEANIMFRAMESET_1B
- const BATTLEANIMFRAMESET_1C
- const BATTLEANIMFRAMESET_1D
- const BATTLEANIMFRAMESET_1E
- const BATTLEANIMFRAMESET_1F
- const BATTLEANIMFRAMESET_20
- const BATTLEANIMFRAMESET_21
- const BATTLEANIMFRAMESET_22
- const BATTLEANIMFRAMESET_23
- const BATTLEANIMFRAMESET_24
- const BATTLEANIMFRAMESET_25
- const BATTLEANIMFRAMESET_26
- const BATTLEANIMFRAMESET_27
- const BATTLEANIMFRAMESET_28
- const BATTLEANIMFRAMESET_29
- const BATTLEANIMFRAMESET_2A
- const BATTLEANIMFRAMESET_2B
- const BATTLEANIMFRAMESET_2C
- const BATTLEANIMFRAMESET_2D
- const BATTLEANIMFRAMESET_2E
- const BATTLEANIMFRAMESET_2F
- const BATTLEANIMFRAMESET_30
- const BATTLEANIMFRAMESET_31
- const BATTLEANIMFRAMESET_32
- const BATTLEANIMFRAMESET_33
- const BATTLEANIMFRAMESET_34
- const BATTLEANIMFRAMESET_35
- const BATTLEANIMFRAMESET_36
- const BATTLEANIMFRAMESET_37
- const BATTLEANIMFRAMESET_38
- const BATTLEANIMFRAMESET_39
- const BATTLEANIMFRAMESET_3A
- const BATTLEANIMFRAMESET_3B
- const BATTLEANIMFRAMESET_3C
- const BATTLEANIMFRAMESET_3D
- const BATTLEANIMFRAMESET_3E
- const BATTLEANIMFRAMESET_3F
- const BATTLEANIMFRAMESET_40
- const BATTLEANIMFRAMESET_41
- const BATTLEANIMFRAMESET_42
- const BATTLEANIMFRAMESET_43
- const BATTLEANIMFRAMESET_44
- const BATTLEANIMFRAMESET_45
- const BATTLEANIMFRAMESET_46
- const BATTLEANIMFRAMESET_47
- const BATTLEANIMFRAMESET_48
- const BATTLEANIMFRAMESET_49
- const BATTLEANIMFRAMESET_4A
- const BATTLEANIMFRAMESET_4B
- const BATTLEANIMFRAMESET_4C
- const BATTLEANIMFRAMESET_4D
- const BATTLEANIMFRAMESET_4E
- const BATTLEANIMFRAMESET_4F
- const BATTLEANIMFRAMESET_50
- const BATTLEANIMFRAMESET_51
- const BATTLEANIMFRAMESET_52
- const BATTLEANIMFRAMESET_53
- const BATTLEANIMFRAMESET_54
- const BATTLEANIMFRAMESET_55
- const BATTLEANIMFRAMESET_56
- const BATTLEANIMFRAMESET_57
- const BATTLEANIMFRAMESET_58
- const BATTLEANIMFRAMESET_59
- const BATTLEANIMFRAMESET_5A
- const BATTLEANIMFRAMESET_5B
- const BATTLEANIMFRAMESET_5C
- const BATTLEANIMFRAMESET_5D
- const BATTLEANIMFRAMESET_5E
- const BATTLEANIMFRAMESET_5F
- const BATTLEANIMFRAMESET_60
- const BATTLEANIMFRAMESET_61
- const BATTLEANIMFRAMESET_62
- const BATTLEANIMFRAMESET_63
- const BATTLEANIMFRAMESET_64
- const BATTLEANIMFRAMESET_65
- const BATTLEANIMFRAMESET_66
- const BATTLEANIMFRAMESET_67
- const BATTLEANIMFRAMESET_68
- const BATTLEANIMFRAMESET_69
- const BATTLEANIMFRAMESET_6A
- const BATTLEANIMFRAMESET_6B
- const BATTLEANIMFRAMESET_6C
- const BATTLEANIMFRAMESET_6D
- const BATTLEANIMFRAMESET_6E
- const BATTLEANIMFRAMESET_6F
- const BATTLEANIMFRAMESET_70
- const BATTLEANIMFRAMESET_71
- const BATTLEANIMFRAMESET_72
- const BATTLEANIMFRAMESET_73
- const BATTLEANIMFRAMESET_74
- const BATTLEANIMFRAMESET_75
- const BATTLEANIMFRAMESET_76
- const BATTLEANIMFRAMESET_77
- const BATTLEANIMFRAMESET_78
- const BATTLEANIMFRAMESET_79
- const BATTLEANIMFRAMESET_7A
- const BATTLEANIMFRAMESET_7B
- const BATTLEANIMFRAMESET_7C
- const BATTLEANIMFRAMESET_7D
- const BATTLEANIMFRAMESET_7E
- const BATTLEANIMFRAMESET_7F
- const BATTLEANIMFRAMESET_80
- const BATTLEANIMFRAMESET_81
- const BATTLEANIMFRAMESET_82
- const BATTLEANIMFRAMESET_83
- const BATTLEANIMFRAMESET_84
- const BATTLEANIMFRAMESET_85
- const BATTLEANIMFRAMESET_86
- const BATTLEANIMFRAMESET_87
- const BATTLEANIMFRAMESET_88
- const BATTLEANIMFRAMESET_89
- const BATTLEANIMFRAMESET_8A
- const BATTLEANIMFRAMESET_8B
- const BATTLEANIMFRAMESET_8C
- const BATTLEANIMFRAMESET_8D
- const BATTLEANIMFRAMESET_8E
- const BATTLEANIMFRAMESET_8F
- const BATTLEANIMFRAMESET_90
- const BATTLEANIMFRAMESET_91
- const BATTLEANIMFRAMESET_92
- const BATTLEANIMFRAMESET_93
- const BATTLEANIMFRAMESET_94
- const BATTLEANIMFRAMESET_95
- const BATTLEANIMFRAMESET_96
- const BATTLEANIMFRAMESET_97
- const BATTLEANIMFRAMESET_98
- const BATTLEANIMFRAMESET_99
- const BATTLEANIMFRAMESET_9A
- const BATTLEANIMFRAMESET_9B
- const BATTLEANIMFRAMESET_9C
- const BATTLEANIMFRAMESET_9D
- const BATTLEANIMFRAMESET_9E
- const BATTLEANIMFRAMESET_9F
- const BATTLEANIMFRAMESET_A0
- const BATTLEANIMFRAMESET_A1
- const BATTLEANIMFRAMESET_A2
- const BATTLEANIMFRAMESET_A3
- const BATTLEANIMFRAMESET_A4
- const BATTLEANIMFRAMESET_A5
- const BATTLEANIMFRAMESET_A6
- const BATTLEANIMFRAMESET_A7
- const BATTLEANIMFRAMESET_A8
- const BATTLEANIMFRAMESET_A9
- const BATTLEANIMFRAMESET_AA
- const BATTLEANIMFRAMESET_AB
- const BATTLEANIMFRAMESET_AC
- const BATTLEANIMFRAMESET_AD
- const BATTLEANIMFRAMESET_AE
- const BATTLEANIMFRAMESET_AF
- const BATTLEANIMFRAMESET_B0
- const BATTLEANIMFRAMESET_B1
- const BATTLEANIMFRAMESET_B2
- const BATTLEANIMFRAMESET_B3
- const BATTLEANIMFRAMESET_B4
- const BATTLEANIMFRAMESET_B5
- const BATTLEANIMFRAMESET_B6
- const BATTLEANIMFRAMESET_B7
- const BATTLEANIMFRAMESET_B8
+ const BATTLEANIMFRAMESET_01
+ const BATTLEANIMFRAMESET_02
+ const BATTLEANIMFRAMESET_03
+ const BATTLEANIMFRAMESET_04
+ const BATTLEANIMFRAMESET_05
+ const BATTLEANIMFRAMESET_06
+ const BATTLEANIMFRAMESET_07
+ const BATTLEANIMFRAMESET_08
+ const BATTLEANIMFRAMESET_09
+ const BATTLEANIMFRAMESET_0A
+ const BATTLEANIMFRAMESET_0B
+ const BATTLEANIMFRAMESET_0C
+ const BATTLEANIMFRAMESET_0D
+ const BATTLEANIMFRAMESET_0E
+ const BATTLEANIMFRAMESET_0F
+ const BATTLEANIMFRAMESET_10
+ const BATTLEANIMFRAMESET_11
+ const BATTLEANIMFRAMESET_12
+ const BATTLEANIMFRAMESET_13
+ const BATTLEANIMFRAMESET_14
+ const BATTLEANIMFRAMESET_15
+ const BATTLEANIMFRAMESET_16
+ const BATTLEANIMFRAMESET_17
+ const BATTLEANIMFRAMESET_18
+ const BATTLEANIMFRAMESET_19
+ const BATTLEANIMFRAMESET_1A
+ const BATTLEANIMFRAMESET_1B
+ const BATTLEANIMFRAMESET_1C
+ const BATTLEANIMFRAMESET_1D
+ const BATTLEANIMFRAMESET_1E
+ const BATTLEANIMFRAMESET_1F
+ const BATTLEANIMFRAMESET_20
+ const BATTLEANIMFRAMESET_21
+ const BATTLEANIMFRAMESET_22
+ const BATTLEANIMFRAMESET_23
+ const BATTLEANIMFRAMESET_24
+ const BATTLEANIMFRAMESET_25
+ const BATTLEANIMFRAMESET_26
+ const BATTLEANIMFRAMESET_27
+ const BATTLEANIMFRAMESET_28
+ const BATTLEANIMFRAMESET_29
+ const BATTLEANIMFRAMESET_2A
+ const BATTLEANIMFRAMESET_2B
+ const BATTLEANIMFRAMESET_2C
+ const BATTLEANIMFRAMESET_2D
+ const BATTLEANIMFRAMESET_2E
+ const BATTLEANIMFRAMESET_2F
+ const BATTLEANIMFRAMESET_30
+ const BATTLEANIMFRAMESET_31
+ const BATTLEANIMFRAMESET_32
+ const BATTLEANIMFRAMESET_33
+ const BATTLEANIMFRAMESET_34
+ const BATTLEANIMFRAMESET_35
+ const BATTLEANIMFRAMESET_36
+ const BATTLEANIMFRAMESET_37
+ const BATTLEANIMFRAMESET_38
+ const BATTLEANIMFRAMESET_39
+ const BATTLEANIMFRAMESET_3A
+ const BATTLEANIMFRAMESET_3B
+ const BATTLEANIMFRAMESET_3C
+ const BATTLEANIMFRAMESET_3D
+ const BATTLEANIMFRAMESET_3E
+ const BATTLEANIMFRAMESET_3F
+ const BATTLEANIMFRAMESET_40
+ const BATTLEANIMFRAMESET_41
+ const BATTLEANIMFRAMESET_42
+ const BATTLEANIMFRAMESET_43
+ const BATTLEANIMFRAMESET_44
+ const BATTLEANIMFRAMESET_45
+ const BATTLEANIMFRAMESET_46
+ const BATTLEANIMFRAMESET_47
+ const BATTLEANIMFRAMESET_48
+ const BATTLEANIMFRAMESET_49
+ const BATTLEANIMFRAMESET_4A
+ const BATTLEANIMFRAMESET_4B
+ const BATTLEANIMFRAMESET_4C
+ const BATTLEANIMFRAMESET_4D
+ const BATTLEANIMFRAMESET_4E
+ const BATTLEANIMFRAMESET_4F
+ const BATTLEANIMFRAMESET_50
+ const BATTLEANIMFRAMESET_51
+ const BATTLEANIMFRAMESET_52
+ const BATTLEANIMFRAMESET_53
+ const BATTLEANIMFRAMESET_54
+ const BATTLEANIMFRAMESET_55
+ const BATTLEANIMFRAMESET_56
+ const BATTLEANIMFRAMESET_57
+ const BATTLEANIMFRAMESET_58
+ const BATTLEANIMFRAMESET_59
+ const BATTLEANIMFRAMESET_5A
+ const BATTLEANIMFRAMESET_5B
+ const BATTLEANIMFRAMESET_5C
+ const BATTLEANIMFRAMESET_5D
+ const BATTLEANIMFRAMESET_5E
+ const BATTLEANIMFRAMESET_5F
+ const BATTLEANIMFRAMESET_60
+ const BATTLEANIMFRAMESET_61
+ const BATTLEANIMFRAMESET_62
+ const BATTLEANIMFRAMESET_63
+ const BATTLEANIMFRAMESET_64
+ const BATTLEANIMFRAMESET_65
+ const BATTLEANIMFRAMESET_66
+ const BATTLEANIMFRAMESET_67
+ const BATTLEANIMFRAMESET_68
+ const BATTLEANIMFRAMESET_69
+ const BATTLEANIMFRAMESET_6A
+ const BATTLEANIMFRAMESET_6B
+ const BATTLEANIMFRAMESET_6C
+ const BATTLEANIMFRAMESET_6D
+ const BATTLEANIMFRAMESET_6E
+ const BATTLEANIMFRAMESET_6F
+ const BATTLEANIMFRAMESET_70
+ const BATTLEANIMFRAMESET_71
+ const BATTLEANIMFRAMESET_72
+ const BATTLEANIMFRAMESET_73
+ const BATTLEANIMFRAMESET_74
+ const BATTLEANIMFRAMESET_75
+ const BATTLEANIMFRAMESET_76
+ const BATTLEANIMFRAMESET_77
+ const BATTLEANIMFRAMESET_78
+ const BATTLEANIMFRAMESET_79
+ const BATTLEANIMFRAMESET_7A
+ const BATTLEANIMFRAMESET_7B
+ const BATTLEANIMFRAMESET_7C
+ const BATTLEANIMFRAMESET_7D
+ const BATTLEANIMFRAMESET_7E
+ const BATTLEANIMFRAMESET_7F
+ const BATTLEANIMFRAMESET_80
+ const BATTLEANIMFRAMESET_81
+ const BATTLEANIMFRAMESET_82
+ const BATTLEANIMFRAMESET_83
+ const BATTLEANIMFRAMESET_84
+ const BATTLEANIMFRAMESET_85
+ const BATTLEANIMFRAMESET_86
+ const BATTLEANIMFRAMESET_87
+ const BATTLEANIMFRAMESET_88
+ const BATTLEANIMFRAMESET_89
+ const BATTLEANIMFRAMESET_8A
+ const BATTLEANIMFRAMESET_8B
+ const BATTLEANIMFRAMESET_8C
+ const BATTLEANIMFRAMESET_8D
+ const BATTLEANIMFRAMESET_8E
+ const BATTLEANIMFRAMESET_8F
+ const BATTLEANIMFRAMESET_90
+ const BATTLEANIMFRAMESET_91
+ const BATTLEANIMFRAMESET_92
+ const BATTLEANIMFRAMESET_93
+ const BATTLEANIMFRAMESET_94
+ const BATTLEANIMFRAMESET_95
+ const BATTLEANIMFRAMESET_96
+ const BATTLEANIMFRAMESET_97
+ const BATTLEANIMFRAMESET_98
+ const BATTLEANIMFRAMESET_99
+ const BATTLEANIMFRAMESET_9A
+ const BATTLEANIMFRAMESET_9B
+ const BATTLEANIMFRAMESET_9C
+ const BATTLEANIMFRAMESET_9D
+ const BATTLEANIMFRAMESET_9E
+ const BATTLEANIMFRAMESET_9F
+ const BATTLEANIMFRAMESET_A0
+ const BATTLEANIMFRAMESET_A1
+ const BATTLEANIMFRAMESET_A2
+ const BATTLEANIMFRAMESET_A3
+ const BATTLEANIMFRAMESET_A4
+ const BATTLEANIMFRAMESET_A5
+ const BATTLEANIMFRAMESET_A6
+ const BATTLEANIMFRAMESET_A7
+ const BATTLEANIMFRAMESET_A8
+ const BATTLEANIMFRAMESET_A9
+ const BATTLEANIMFRAMESET_AA
+ const BATTLEANIMFRAMESET_AB
+ const BATTLEANIMFRAMESET_AC
+ const BATTLEANIMFRAMESET_AD
+ const BATTLEANIMFRAMESET_AE
+ const BATTLEANIMFRAMESET_AF
+ const BATTLEANIMFRAMESET_B0
+ const BATTLEANIMFRAMESET_B1
+ const BATTLEANIMFRAMESET_B2
+ const BATTLEANIMFRAMESET_B3
+ const BATTLEANIMFRAMESET_B4
+ const BATTLEANIMFRAMESET_B5
+ const BATTLEANIMFRAMESET_B6
+ const BATTLEANIMFRAMESET_B7
+ const BATTLEANIMFRAMESET_B8
const_def
const BATTLEANIMOAMSET_00
@@ -735,7 +735,7 @@
const ANIM_BG_1E
const ANIM_BG_1F
const ANIM_BG_20
- const ANIM_BG_21
+ const ANIM_BG_WITHDRAW
const ANIM_BG_BOUNCE_DOWN
const ANIM_BG_DIG
const ANIM_BG_TACKLE
--- a/constants/audio_constants.asm
+++ b/constants/audio_constants.asm
@@ -15,6 +15,7 @@
const A_
const A#
const B_
+ const CC ; used for pitchoffset
; channel
const_def
@@ -41,7 +42,7 @@
; Flags2
SOUND_VIBRATO EQU 0
-SOUND_UNKN_09 EQU 1
+SOUND_PITCH_WHEEL EQU 1
SOUND_DUTY EQU 2
SOUND_UNKN_0B EQU 3
SOUND_CRY_PITCH EQU 4
@@ -51,7 +52,7 @@
; Flags3
SOUND_VIBRATO_DIR EQU 0
-SOUND_UNKN_11 EQU 1
+SOUND_PITCH_WHEEL_DIR EQU 1
; NoteFlags
NOTE_UNKN_0 EQU 0
--- a/constants/cgb_constants.asm
+++ b/constants/cgb_constants.asm
@@ -7,13 +7,13 @@
const SCGB_SLOT_MACHINE
const SCGB_06
const SCGB_07
- const SCGB_08
+ const SCGB_DIPLOMA
const SCGB_MAPPALS
- const SCGB_0A
- const SCGB_0B
+ const SCGB_PARTY_MENU
+ const SCGB_EVOLUTION
const SCGB_0C
const SCGB_0D
- const SCGB_0E
+ const SCGB_MOVE_LIST
const SCGB_0F
const SCGB_POKEDEX_SEARCH_OPTION
const SCGB_11
@@ -22,13 +22,13 @@
const SCGB_PACKPALS
const SCGB_TRAINER_CARD
const SCGB_POKEDEX_UNOWN_MODE
- const SCGB_17
- const SCGB_18
- const SCGB_19
- const SCGB_1A
- const SCGB_1B
- const SCGB_FRONTPICPALS
- const SCGB_1D
+ const SCGB_BILLS_PC
+ const SCGB_UNOWN_PUZZLE
+ const SCGB_GAMEFREAK_LOGO
+ const SCGB_PLAYER_OR_MON_FRONTPIC_PALS
+ const SCGB_TRADE_TUBE
+ const SCGB_TRAINER_OR_MON_FRONTPIC_PALS
+ const SCGB_MYSTERY_GIFT
const SCGB_1E
SCGB_PARTY_MENU_HP_PALS EQU -4
--- a/constants/map_constants.asm
+++ b/constants/map_constants.asm
@@ -518,39 +518,39 @@
; object struct
const_def
- const OBJECT_SPRITE
- const OBJECT_MAP_OBJECT_INDEX
- const OBJECT_SPRITE_TILE
- const OBJECT_MOVEMENTTYPE
- const OBJECT_FLAGS1
- const OBJECT_FLAGS2
- const OBJECT_PALETTE
- const OBJECT_DIRECTION_WALKING
- const OBJECT_FACING
- const OBJECT_STEP_TYPE
- const OBJECT_STEP_DURATION
- const OBJECT_ACTION
- const OBJECT_STEP_FRAME
- const OBJECT_FACING_STEP
- const OBJECT_NEXT_TILE
- const OBJECT_STANDING_TILE
- const OBJECT_NEXT_MAP_X
- const OBJECT_NEXT_MAP_Y
- const OBJECT_MAP_X
- const OBJECT_MAP_Y
- const OBJECT_INIT_X
- const OBJECT_INIT_Y
- const OBJECT_RADIUS
- const OBJECT_SPRITE_X
- const OBJECT_SPRITE_Y
- const OBJECT_SPRITE_X_OFFSET
- const OBJECT_SPRITE_Y_OFFSET
- const OBJECT_MOVEMENT_BYTE_INDEX
- const OBJECT_28
- const OBJECT_29
- const OBJECT_30
- const OBJECT_31
- const OBJECT_RANGE
+ const OBJECT_SPRITE ; 00
+ const OBJECT_MAP_OBJECT_INDEX ; 01
+ const OBJECT_SPRITE_TILE ; 02
+ const OBJECT_MOVEMENTTYPE ; 03
+ const OBJECT_FLAGS1 ; 04
+ const OBJECT_FLAGS2 ; 05
+ const OBJECT_PALETTE ; 06
+ const OBJECT_DIRECTION_WALKING ; 07
+ const OBJECT_FACING ; 08
+ const OBJECT_STEP_TYPE ; 09
+ const OBJECT_STEP_DURATION ; 0a
+ const OBJECT_ACTION ; 0b
+ const OBJECT_STEP_FRAME ; 0c
+ const OBJECT_FACING_STEP ; 0d
+ const OBJECT_NEXT_TILE ; 0e
+ const OBJECT_STANDING_TILE ; 0f
+ const OBJECT_NEXT_MAP_X ; 10
+ const OBJECT_NEXT_MAP_Y ; 11
+ const OBJECT_MAP_X ; 12
+ const OBJECT_MAP_Y ; 13
+ const OBJECT_INIT_X ; 14
+ const OBJECT_INIT_Y ; 15
+ const OBJECT_RADIUS ; 16
+ const OBJECT_SPRITE_X ; 17
+ const OBJECT_SPRITE_Y ; 18
+ const OBJECT_SPRITE_X_OFFSET ; 19
+ const OBJECT_SPRITE_Y_OFFSET ; 1a
+ const OBJECT_MOVEMENT_BYTE_INDEX ; 1b
+ const OBJECT_28 ; 1c
+ const OBJECT_29 ; 1d
+ const OBJECT_30 ; 1e
+ const OBJECT_31 ; 1f
+ const OBJECT_RANGE ; 20
; 33-39 are not used
; map object struct
--- a/constants/misc_constants.asm
+++ b/constants/misc_constants.asm
@@ -18,10 +18,12 @@
; GetName types
PKMN_NAME EQU 1
MOVE_NAME EQU 2
+; dummied out EQU 3
ITEM_NAME EQU 4
PARTY_OT_NAME EQU 5
ENEMY_OT_NAME EQU 6
TRAINER_NAME EQU 7
+; broken ptr EQU 8
; hp
HP_GREEN EQU 0
@@ -213,6 +215,22 @@
NUM_BADGES EQU NUM_JOHTO_BADGES + NUM_KANTO_BADGES
NUM_KANA EQU $2d
+ const_def
+ const EZCHAT_POKEMON
+ const EZCHAT_TYPES
+ const EZCHAT_GREETINGS
+ const EZCHAT_PEOPLE
+ const EZCHAT_BATTLE
+ const EZCHAT_EXCLAMATIONS
+ const EZCHAT_CONVERSATION
+ const EZCHAT_FEELINGS
+ const EZCHAT_CONDITIONS
+ const EZCHAT_LIFE
+ const EZCHAT_HOBBIES
+ const EZCHAT_ACTIONS
+ const EZCHAT_TIME
+ const EZCHAT_FAREWELLS
+ const EZCHAT_THISANDTHAT
SWARM_DUNSPARCE EQU 0
SWARM_YANMA EQU 1
@@ -235,3 +253,9 @@
const FISHGROUP_QWILFISH
const FISHGROUP_REMORAID
const FISHGROUP_QWILFISH_NO_SWARM
+
+INIT_ENEMYOT_LIST EQU 1
+INIT_BAG_ITEM_LIST EQU 2
+INIT_OTHER_ITEM_LIST EQU 3
+INIT_PLAYEROT_LIST EQU 4
+INIT_MON_LIST EQU 5
--- /dev/null
+++ b/constants/printer_constants.asm
@@ -1,0 +1,9 @@
+const_value SET 1
+
+ const PRINTER_STATUS_CHECKING
+ const PRINTER_STATUS_TRANSMITTING
+ const PRINTER_STATUS_PRINTING
+ const PRINTER_ERROR_1
+ const PRINTER_ERROR_2
+ const PRINTER_ERROR_3
+ const PRINTER_ERROR_4
--- a/constants/sprite_constants.asm
+++ b/constants/sprite_constants.asm
@@ -349,22 +349,22 @@
const FACING_1F
const_def
- const SPRITEANIMSTRUCT_INDEX ; 0
- const SPRITEANIMSTRUCT_FRAMESET_ID ; 1
- const SPRITEANIMSTRUCT_ANIM_SEQ_ID ; 2
- const SPRITEANIMSTRUCT_TILE_ID ; 3
- const SPRITEANIMSTRUCT_XCOORD ; 4
- const SPRITEANIMSTRUCT_YCOORD ; 5
- const SPRITEANIMSTRUCT_XOFFSET ; 6
- const SPRITEANIMSTRUCT_YOFFSET ; 7
- const SPRITEANIMSTRUCT_DURATION ; 8
- const SPRITEANIMSTRUCT_DURATIONOFFSET ; 9
- const SPRITEANIMSTRUCT_FRAME ; a
- const SPRITEANIMSTRUCT_0B ; b
- const SPRITEANIMSTRUCT_0C ; c
- const SPRITEANIMSTRUCT_0D ; d
- const SPRITEANIMSTRUCT_0E ; e
- const SPRITEANIMSTRUCT_0F ; f
+ const SPRITEANIMSTRUCT_INDEX ; 0
+ const SPRITEANIMSTRUCT_FRAMESET_ID ; 1
+ const SPRITEANIMSTRUCT_ANIM_SEQ_ID ; 2
+ const SPRITEANIMSTRUCT_TILE_ID ; 3
+ const SPRITEANIMSTRUCT_XCOORD ; 4
+ const SPRITEANIMSTRUCT_YCOORD ; 5
+ const SPRITEANIMSTRUCT_XOFFSET ; 6
+ const SPRITEANIMSTRUCT_YOFFSET ; 7
+ const SPRITEANIMSTRUCT_DURATION ; 8
+ const SPRITEANIMSTRUCT_DURATIONOFFSET ; 9
+ const SPRITEANIMSTRUCT_FRAME ; a
+ const SPRITEANIMSTRUCT_JUMPTABLE_INDEX ; b
+ const SPRITEANIMSTRUCT_0C ; c
+ const SPRITEANIMSTRUCT_0D ; d
+ const SPRITEANIMSTRUCT_0E ; e
+ const SPRITEANIMSTRUCT_0F ; f
const_def
const SPRITE_ANIM_FRAMESET_00
@@ -390,8 +390,8 @@
const SPRITE_ANIM_FRAMESET_14
const SPRITE_ANIM_FRAMESET_15
const SPRITE_ANIM_FRAMESET_16
- const SPRITE_ANIM_FRAMESET_17
- const SPRITE_ANIM_FRAMESET_18
+ const SPRITE_ANIM_FRAMESET_TRADEMON_ICON
+ const SPRITE_ANIM_FRAMESET_TRADEMON_BUBBLE
const SPRITE_ANIM_FRAMESET_19
const SPRITE_ANIM_FRAMESET_1A
const SPRITE_ANIM_FRAMESET_1B
@@ -453,7 +453,7 @@
const SPRITE_ANIM_SEQ_0F
const SPRITE_ANIM_SEQ_10
const SPRITE_ANIM_SEQ_11
- const SPRITE_ANIM_SEQ_12
+ const SPRITE_ANIM_SEQ_TRADEMON_IN_TUBE
const SPRITE_ANIM_SEQ_13
const SPRITE_ANIM_SEQ_14
const SPRITE_ANIM_SEQ_15
@@ -489,8 +489,8 @@
const SPRITE_ANIM_INDEX_0E
const SPRITE_ANIM_INDEX_0F
const SPRITE_ANIM_INDEX_10
- const SPRITE_ANIM_INDEX_11
- const SPRITE_ANIM_INDEX_12
+ const SPRITE_ANIM_INDEX_TRADEMON_ICON
+ const SPRITE_ANIM_INDEX_TRADEMON_BUBBLE
const SPRITE_ANIM_INDEX_13
const SPRITE_ANIM_INDEX_14
const SPRITE_ANIM_INDEX_15
@@ -517,3 +517,146 @@
const SPRITE_ANIM_INDEX_2A
const SPRITE_ANIM_INDEX_2B
const SPRITE_ANIM_INDEX_2C
+
+ const_def
+
+ const SPRITE_ANIM_FRAME_IDX_00
+ const SPRITE_ANIM_FRAME_IDX_01
+ const SPRITE_ANIM_FRAME_IDX_02
+ const SPRITE_ANIM_FRAME_IDX_03
+ const SPRITE_ANIM_FRAME_IDX_04
+ const SPRITE_ANIM_FRAME_IDX_05
+ const SPRITE_ANIM_FRAME_IDX_06
+ const SPRITE_ANIM_FRAME_IDX_07
+ const SPRITE_ANIM_FRAME_IDX_08
+ const SPRITE_ANIM_FRAME_IDX_09
+ const SPRITE_ANIM_FRAME_IDX_0A
+ const SPRITE_ANIM_FRAME_IDX_0B
+ const SPRITE_ANIM_FRAME_IDX_0C
+ const SPRITE_ANIM_FRAME_IDX_0D
+ const SPRITE_ANIM_FRAME_IDX_0E
+ const SPRITE_ANIM_FRAME_IDX_0F
+ const SPRITE_ANIM_FRAME_IDX_10
+ const SPRITE_ANIM_FRAME_IDX_11
+ const SPRITE_ANIM_FRAME_IDX_12
+ const SPRITE_ANIM_FRAME_IDX_13
+ const SPRITE_ANIM_FRAME_IDX_14
+ const SPRITE_ANIM_FRAME_IDX_15
+ const SPRITE_ANIM_FRAME_IDX_16
+ const SPRITE_ANIM_FRAME_IDX_17
+ const SPRITE_ANIM_FRAME_IDX_18
+ const SPRITE_ANIM_FRAME_IDX_19
+ const SPRITE_ANIM_FRAME_IDX_1A
+ const SPRITE_ANIM_FRAME_IDX_1B
+ const SPRITE_ANIM_FRAME_IDX_1C
+ const SPRITE_ANIM_FRAME_IDX_1D
+ const SPRITE_ANIM_FRAME_IDX_1E
+ const SPRITE_ANIM_FRAME_IDX_1F
+ const SPRITE_ANIM_FRAME_IDX_20
+ const SPRITE_ANIM_FRAME_IDX_21
+ const SPRITE_ANIM_FRAME_IDX_22
+ const SPRITE_ANIM_FRAME_IDX_23
+ const SPRITE_ANIM_FRAME_IDX_24
+ const SPRITE_ANIM_FRAME_IDX_25
+ const SPRITE_ANIM_FRAME_IDX_26
+ const SPRITE_ANIM_FRAME_IDX_27
+ const SPRITE_ANIM_FRAME_IDX_28
+ const SPRITE_ANIM_FRAME_IDX_29
+ const SPRITE_ANIM_FRAME_IDX_2A
+ const SPRITE_ANIM_FRAME_IDX_2B
+ const SPRITE_ANIM_FRAME_IDX_2C
+ const SPRITE_ANIM_FRAME_IDX_2D
+ const SPRITE_ANIM_FRAME_IDX_2E
+ const SPRITE_ANIM_FRAME_IDX_2F
+ const SPRITE_ANIM_FRAME_IDX_30
+ const SPRITE_ANIM_FRAME_IDX_31
+ const SPRITE_ANIM_FRAME_IDX_32
+ const SPRITE_ANIM_FRAME_IDX_33
+ const SPRITE_ANIM_FRAME_IDX_34
+ const SPRITE_ANIM_FRAME_IDX_35
+ const SPRITE_ANIM_FRAME_IDX_36
+ const SPRITE_ANIM_FRAME_IDX_37
+ const SPRITE_ANIM_FRAME_IDX_38
+ const SPRITE_ANIM_FRAME_IDX_39
+ const SPRITE_ANIM_FRAME_IDX_3A
+ const SPRITE_ANIM_FRAME_IDX_3B
+ const SPRITE_ANIM_FRAME_IDX_3C
+ const SPRITE_ANIM_FRAME_IDX_3D
+ const SPRITE_ANIM_FRAME_IDX_3E
+ const SPRITE_ANIM_FRAME_IDX_3F
+ const SPRITE_ANIM_FRAME_IDX_40
+ const SPRITE_ANIM_FRAME_IDX_41
+ const SPRITE_ANIM_FRAME_IDX_42
+ const SPRITE_ANIM_FRAME_IDX_43
+ const SPRITE_ANIM_FRAME_IDX_44
+ const SPRITE_ANIM_FRAME_IDX_45
+ const SPRITE_ANIM_FRAME_IDX_46
+ const SPRITE_ANIM_FRAME_IDX_47
+ const SPRITE_ANIM_FRAME_IDX_48
+ const SPRITE_ANIM_FRAME_IDX_49
+ const SPRITE_ANIM_FRAME_IDX_4A
+ const SPRITE_ANIM_FRAME_IDX_4B
+ const SPRITE_ANIM_FRAME_IDX_4C
+ const SPRITE_ANIM_FRAME_IDX_4D
+ const SPRITE_ANIM_FRAME_IDX_4E
+ const SPRITE_ANIM_FRAME_IDX_4F
+ const SPRITE_ANIM_FRAME_IDX_50
+ const SPRITE_ANIM_FRAME_IDX_51
+ const SPRITE_ANIM_FRAME_IDX_52
+ const SPRITE_ANIM_FRAME_IDX_53
+ const SPRITE_ANIM_FRAME_IDX_54
+ const SPRITE_ANIM_FRAME_IDX_55
+ const SPRITE_ANIM_FRAME_IDX_56
+ const SPRITE_ANIM_FRAME_IDX_57
+ const SPRITE_ANIM_FRAME_IDX_58
+ const SPRITE_ANIM_FRAME_IDX_59
+ const SPRITE_ANIM_FRAME_IDX_5A
+ const SPRITE_ANIM_FRAME_IDX_5B
+ const SPRITE_ANIM_FRAME_IDX_5C
+ const SPRITE_ANIM_FRAME_IDX_5D
+ const SPRITE_ANIM_FRAME_IDX_5E
+ const SPRITE_ANIM_FRAME_IDX_5F
+ const SPRITE_ANIM_FRAME_IDX_60
+ const SPRITE_ANIM_FRAME_IDX_61
+ const SPRITE_ANIM_FRAME_IDX_62
+ const SPRITE_ANIM_FRAME_IDX_63
+ const SPRITE_ANIM_FRAME_IDX_64
+ const SPRITE_ANIM_FRAME_IDX_65
+ const SPRITE_ANIM_FRAME_IDX_66
+ const SPRITE_ANIM_FRAME_IDX_67
+ const SPRITE_ANIM_FRAME_IDX_68
+ const SPRITE_ANIM_FRAME_IDX_69
+ const SPRITE_ANIM_FRAME_IDX_6A
+ const SPRITE_ANIM_FRAME_IDX_6B
+ const SPRITE_ANIM_FRAME_IDX_6C
+ const SPRITE_ANIM_FRAME_IDX_6D
+ const SPRITE_ANIM_FRAME_IDX_6E
+ const SPRITE_ANIM_FRAME_IDX_6F
+ const SPRITE_ANIM_FRAME_IDX_70
+ const SPRITE_ANIM_FRAME_IDX_71
+ const SPRITE_ANIM_FRAME_IDX_72
+ const SPRITE_ANIM_FRAME_IDX_73
+ const SPRITE_ANIM_FRAME_IDX_74
+ const SPRITE_ANIM_FRAME_IDX_75
+ const SPRITE_ANIM_FRAME_IDX_76
+ const SPRITE_ANIM_FRAME_IDX_77
+ const SPRITE_ANIM_FRAME_IDX_78
+ const SPRITE_ANIM_FRAME_IDX_79
+ const SPRITE_ANIM_FRAME_IDX_7A
+ const SPRITE_ANIM_FRAME_IDX_7B
+ const SPRITE_ANIM_FRAME_IDX_7C
+ const SPRITE_ANIM_FRAME_IDX_7D
+ const SPRITE_ANIM_FRAME_IDX_7E
+ const SPRITE_ANIM_FRAME_IDX_7F
+ const SPRITE_ANIM_FRAME_IDX_80
+ const SPRITE_ANIM_FRAME_IDX_81
+ const SPRITE_ANIM_FRAME_IDX_82
+ const SPRITE_ANIM_FRAME_IDX_83
+ const SPRITE_ANIM_FRAME_IDX_84
+ const SPRITE_ANIM_FRAME_IDX_85
+ const SPRITE_ANIM_FRAME_IDX_86
+ const SPRITE_ANIM_FRAME_IDX_87
+ const SPRITE_ANIM_FRAME_IDX_88
+ const SPRITE_ANIM_FRAME_IDX_89
+ const SPRITE_ANIM_FRAME_IDX_8A
+ const SPRITE_ANIM_FRAME_IDX_8B
--- a/constants/wram_constants.asm
+++ b/constants/wram_constants.asm
@@ -3,7 +3,7 @@
PARTYMON EQU 0
OTPARTYMON EQU 1
BOXMON EQU 2
-BREEDMON EQU 3
+TEMPMON EQU 3
WILDMON EQU 4
; Options: ; cfcc
--- a/data/map_objects.asm
+++ b/data/map_objects.asm
@@ -25,20 +25,20 @@
sprite_movement_data SPRITEMOVEFN_0E, DOWN, PERSON_ACTION_STAND, $00, $00, %0000 ; 12
sprite_movement_data SPRITEMOVEFN_FOLLOW, DOWN, PERSON_ACTION_STAND, $02, $00, %0000 ; 13
sprite_movement_data SPRITEMOVEFN_SCRIPTED, DOWN, PERSON_ACTION_STAND, $02, $00, %0000 ; 14
- sprite_movement_data SPRITEMOVEFN_BIG_SNORLAX, DOWN, PERSON_ACTION_09, $2e, $01, %1100 ; 15
- sprite_movement_data SPRITEMOVEFN_BOUNCE, DOWN, PERSON_ACTION_0A, $2e, $00, %0000 ; 16
+ sprite_movement_data SPRITEMOVEFN_BIG_SNORLAX, DOWN, PERSON_ACTION_09, $2e, $01, %1100 ; 15
+ sprite_movement_data SPRITEMOVEFN_BOUNCE, DOWN, PERSON_ACTION_0A, $2e, $00, %0000 ; 16
sprite_movement_data SPRITEMOVEFN_STANDING, DOWN, PERSON_ACTION_STAND, $0c, $00, %0000 ; 17
sprite_movement_data SPRITEMOVEFN_STANDING, DOWN, PERSON_ACTION_STAND, $2e, $10, %0000 ; 18
sprite_movement_data SPRITEMOVEFN_STRENGTH, DOWN, PERSON_ACTION_STAND, $2e, $00, %0100 ; 19
sprite_movement_data SPRITEMOVEFN_FOLLOWNOTEXACT, DOWN, PERSON_ACTION_STAND, $02, $00, %0000 ; 1a
- sprite_movement_data SPRITEMOVEFN_SHADOW, DOWN, PERSON_ACTION_00, $8e, $01, %0000 ; 1b
+ sprite_movement_data SPRITEMOVEFN_SHADOW, DOWN, PERSON_ACTION_00, $8e, $01, %0000 ; 1b
sprite_movement_data SPRITEMOVEFN_EMOTE, DOWN, PERSON_ACTION_EMOTE, $8e, $02, %0000 ; 1c
- sprite_movement_data SPRITEMOVEFN_SCREENSHAKE, DOWN, PERSON_ACTION_00, $82, $00, %0000 ; 1d
+ sprite_movement_data SPRITEMOVEFN_SCREENSHAKE, DOWN, PERSON_ACTION_00, $82, $00, %0000 ; 1d
sprite_movement_data SPRITEMOVEFN_SPIN_COUNTERCLOCKWISE, LEFT, PERSON_ACTION_STAND, $00, $00, %0000 ; 1e
sprite_movement_data SPRITEMOVEFN_SPIN_CLOCKWISE, RIGHT, PERSON_ACTION_STAND, $00, $00, %0000 ; 1f
- sprite_movement_data SPRITEMOVEFN_STRENGTH, DOWN, PERSON_ACTION_0C, $2e, $01, %1100 ; 20
- sprite_movement_data SPRITEMOVEFN_STRENGTH, DOWN, PERSON_ACTION_0D, $2e, $01, %1100 ; 21
- sprite_movement_data SPRITEMOVEFN_BOULDERDUST, DOWN, PERSON_ACTION_0E, $8e, $01, %0000 ; 22
- sprite_movement_data SPRITEMOVEFN_GRASS, DOWN, PERSON_ACTION_0F, $8e, $02, %0000 ; 23
+ sprite_movement_data SPRITEMOVEFN_STRENGTH, DOWN, PERSON_ACTION_0C, $2e, $01, %1100 ; 20
+ sprite_movement_data SPRITEMOVEFN_STRENGTH, DOWN, PERSON_ACTION_0D, $2e, $01, %1100 ; 21
+ sprite_movement_data SPRITEMOVEFN_BOULDERDUST, DOWN, PERSON_ACTION_0E, $8e, $01, %0000 ; 22
+ sprite_movement_data SPRITEMOVEFN_GRASS, DOWN, PERSON_ACTION_0F, $8e, $02, %0000 ; 23
sprite_movement_data SPRITEMOVEFN_RANDOM_WALK_XY, DOWN, PERSON_ACTION_STAND, $00, $00, %0010 ; 24
sprite_movement_data SPRITEMOVEFN_00, DOWN, PERSON_ACTION_STAND, $00, $00, %0000 ; 25
\ No newline at end of file
--- a/data/pokedex/entry_pointers.asm
+++ b/data/pokedex/entry_pointers.asm
@@ -1,3 +1,75 @@
+GetDexEntryPointer: ; 44333
+; return dex entry pointer b:de
+ push hl
+ ld hl, PokedexDataPointerTable
+ ld a, b
+ dec a
+ ld d, 0
+ ld e, a
+ add hl, de
+ add hl, de
+ ld e, [hl]
+ inc hl
+ ld d, [hl]
+ push de
+ rlca
+ rlca
+ and $3
+ ld hl, .PokedexEntryBanks
+ ld d, 0
+ ld e, a
+ add hl, de
+ ld b, [hl]
+ pop de
+ pop hl
+ ret
+
+.PokedexEntryBanks: ; 44351
+
+GLOBAL PokedexEntries1
+GLOBAL PokedexEntries2
+GLOBAL PokedexEntries3
+GLOBAL PokedexEntries4
+
+ db BANK(PokedexEntries1)
+ db BANK(PokedexEntries2)
+ db BANK(PokedexEntries3)
+ db BANK(PokedexEntries4)
+
+GetDexEntryPagePointer: ; 44355
+ call GetDexEntryPointer ; b:de
+ push hl
+ ld h, d
+ ld l, e
+; skip species name
+.loop1
+ ld a, b
+ call GetFarByte
+ inc hl
+ cp "@"
+ jr nz, .loop1
+; skip height and weight
+rept 4
+ inc hl
+endr
+; if c != 1: skip entry
+ dec c
+ jr z, .done
+; skip entry
+.loop2
+ ld a, b
+ call GetFarByte
+ inc hl
+ cp "@"
+ jr nz, .loop2
+
+.done
+ ld d, h
+ ld e, l
+ pop hl
+ ret
+
+PokedexDataPointerTable: ; 0x44378
; Pointers to all the Pokedex entries.
dw BulbasaurPokedexEntry
--- a/data/sprite_engine.asm
+++ b/data/sprite_engine.asm
@@ -66,417 +66,435 @@
dw .Frameset_40 ; 40 celebi on the left
dw .Frameset_41 ; 41 celebi on the right
; 8d76a
-; OAM idx (see SpriteAnimOAMData), flip flags/duration
+
.Frameset_00:
- db $00, $20
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_00, 32
+ endanim
.Frameset_01:
- db $00, $08
- db $01, $08
- db -2
+ frame SPRITE_ANIM_FRAME_IDX_00, 8
+ frame SPRITE_ANIM_FRAME_IDX_01, 8
+ dorestart
.Frameset_02:
- db $3d, $08
- db $3e, $08
- db -2
+ frame SPRITE_ANIM_FRAME_IDX_3D, 8
+ frame SPRITE_ANIM_FRAME_IDX_3E, 8
+ dorestart
.Frameset_03:
- db $3f, $08
- db $40, $08
- db -2
+ frame SPRITE_ANIM_FRAME_IDX_3F, 8
+ frame SPRITE_ANIM_FRAME_IDX_40, 8
+ dorestart
.Frameset_04:
- db $00, $04
- db $01, $04
- db -2
+ frame SPRITE_ANIM_FRAME_IDX_00, 4
+ frame SPRITE_ANIM_FRAME_IDX_01, 4
+ dorestart
.Frameset_05:
- db $3d, $04
- db $3e, $04
- db -2
+ frame SPRITE_ANIM_FRAME_IDX_3D, 4
+ frame SPRITE_ANIM_FRAME_IDX_3E, 4
+ dorestart
.Frameset_06:
- db $3f, $04
- db $40, $04
- db -2
+ frame SPRITE_ANIM_FRAME_IDX_3F, 4
+ frame SPRITE_ANIM_FRAME_IDX_40, 4
+ dorestart
.Frameset_11:
- db $00, $08
- db $01, $08
- db $00, $08
- db $01, $48
- db -2
+ frame SPRITE_ANIM_FRAME_IDX_00, 8
+ frame SPRITE_ANIM_FRAME_IDX_01, 8
+ frame SPRITE_ANIM_FRAME_IDX_00, 8
+ frame SPRITE_ANIM_FRAME_IDX_01, 8, OAM_X_FLIP
+ dorestart
.Frameset_2d:
- db $63, $08
- db $64, $08
- db $63, $08
- db $64, $48
- db -2
+ frame SPRITE_ANIM_FRAME_IDX_63, 8
+ frame SPRITE_ANIM_FRAME_IDX_64, 8
+ frame SPRITE_ANIM_FRAME_IDX_63, 8
+ frame SPRITE_ANIM_FRAME_IDX_64, 8, OAM_X_FLIP
+ dorestart
.Frameset_2e:
- db $65, $08
- db $66, $08
- db $65, $08
- db $66, $48
- db -2
+ frame SPRITE_ANIM_FRAME_IDX_65, 8
+ frame SPRITE_ANIM_FRAME_IDX_66, 8
+ frame SPRITE_ANIM_FRAME_IDX_65, 8
+ frame SPRITE_ANIM_FRAME_IDX_66, 8, OAM_X_FLIP
+ dorestart
.Frameset_07:
- db $1e, $01
- db $1f, $01
- db -2
+ frame SPRITE_ANIM_FRAME_IDX_1E, 1
+ frame SPRITE_ANIM_FRAME_IDX_1F, 1
+ dorestart
.Frameset_08:
- db $20, $01
- db -3, $01
- db -2
+ frame SPRITE_ANIM_FRAME_IDX_20, 1
+ dorepeat 1
+ dorestart
.Frameset_09:
- db $21, $01
- db -3, $01
- db -2
+ frame SPRITE_ANIM_FRAME_IDX_21, 1
+ dorepeat 1
+ dorestart
.Frameset_0a:
- db $81, $0c
- db $82, $01
- db $83, $01
- db $82, $04
- db $81, $0c
- db $82, $0c
- db $83, $04
- db $84, $20
- db $85, $03
- db $86, $03
- db $87, $04
- db $88, $04
- db $89, $04
- db $8a, $0a
- db $8b, $07
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_81, 12
+ frame SPRITE_ANIM_FRAME_IDX_82, 1
+ frame SPRITE_ANIM_FRAME_IDX_83, 1
+ frame SPRITE_ANIM_FRAME_IDX_82, 4
+ frame SPRITE_ANIM_FRAME_IDX_81, 12
+ frame SPRITE_ANIM_FRAME_IDX_82, 12
+ frame SPRITE_ANIM_FRAME_IDX_83, 4
+ frame SPRITE_ANIM_FRAME_IDX_84, 32
+ frame SPRITE_ANIM_FRAME_IDX_85, 3
+ frame SPRITE_ANIM_FRAME_IDX_86, 3
+ frame SPRITE_ANIM_FRAME_IDX_87, 4
+ frame SPRITE_ANIM_FRAME_IDX_88, 4
+ frame SPRITE_ANIM_FRAME_IDX_89, 4
+ frame SPRITE_ANIM_FRAME_IDX_8A, 10
+ frame SPRITE_ANIM_FRAME_IDX_8B, 7
+ endanim
.Frameset_0b:
- db $23, $03
- db $23, $83
- db -2
+ frame SPRITE_ANIM_FRAME_IDX_23, 3
+ frame SPRITE_ANIM_FRAME_IDX_23, 3, OAM_Y_FLIP
+ dorestart
.Frameset_0c:
- db $24, $02
- db $25, $02
- db $26, $02
- db $25, $02
- db -2
+ frame SPRITE_ANIM_FRAME_IDX_24, 2
+ frame SPRITE_ANIM_FRAME_IDX_25, 2
+ frame SPRITE_ANIM_FRAME_IDX_26, 2
+ frame SPRITE_ANIM_FRAME_IDX_25, 2
+ dorestart
.Frameset_0d:
- db $27, $07
- db $28, $07
- db $27, $87
- db $28, $47
- db -2
+ frame SPRITE_ANIM_FRAME_IDX_27, 7
+ frame SPRITE_ANIM_FRAME_IDX_28, 7
+ frame SPRITE_ANIM_FRAME_IDX_27, 7, OAM_Y_FLIP
+ frame SPRITE_ANIM_FRAME_IDX_28, 7, OAM_X_FLIP
+ dorestart
.Frameset_0e:
- db $29, $07
- db $2a, $07
- db $29, $07
- db $2b, $07
- db -2
+ frame SPRITE_ANIM_FRAME_IDX_29, 7
+ frame SPRITE_ANIM_FRAME_IDX_2A, 7
+ frame SPRITE_ANIM_FRAME_IDX_29, 7
+ frame SPRITE_ANIM_FRAME_IDX_2B, 7
+ dorestart
.Frameset_0f:
- db $29, $07
- db $2c, $07
- db $2d, $07
- db $2c, $07
- db $29, $07
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_29, 7
+ frame SPRITE_ANIM_FRAME_IDX_2C, 7
+ frame SPRITE_ANIM_FRAME_IDX_2D, 7
+ frame SPRITE_ANIM_FRAME_IDX_2C, 7
+ frame SPRITE_ANIM_FRAME_IDX_29, 7
+ endanim
.Frameset_10:
- db $2e, $14
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_2E, 20
+ endanim
.Frameset_12:
- db $2f, $20
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_2F, 32
+ endanim
.Frameset_13:
- db $30, $20
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_30, 32
+ endanim
.Frameset_14:
- db $30, $03
- db $31, $03
- db $30, $03
- db $31, $43
- db -2
+ frame SPRITE_ANIM_FRAME_IDX_30, 3
+ frame SPRITE_ANIM_FRAME_IDX_31, 3
+ frame SPRITE_ANIM_FRAME_IDX_30, 3
+ frame SPRITE_ANIM_FRAME_IDX_31, 3, OAM_X_FLIP
+ dorestart
.Frameset_15:
- db $32, $04
- db $33, $04
- db $34, $04
- db -4
+ frame SPRITE_ANIM_FRAME_IDX_32, 4
+ frame SPRITE_ANIM_FRAME_IDX_33, 4
+ frame SPRITE_ANIM_FRAME_IDX_34, 4
+ delanim
.Frameset_16:
- db $35, $03
- db $36, $03
- db -2
+ frame SPRITE_ANIM_FRAME_IDX_35, 3
+ frame SPRITE_ANIM_FRAME_IDX_36, 3
+ dorestart
.Frameset_17:
- db $37, $07
- db $38, $07
- db -2
+ frame SPRITE_ANIM_FRAME_IDX_37, 7
+ frame SPRITE_ANIM_FRAME_IDX_38, 7
+ dorestart
.Frameset_18:
- db $39, $20
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_39, 32
+ endanim
.Frameset_19:
- db $3b, $02
- db $3a, $02
- db $3b, $02
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_3B, 2
+ frame SPRITE_ANIM_FRAME_IDX_3A, 2
+ frame SPRITE_ANIM_FRAME_IDX_3B, 2
+ endanim
.Frameset_1a:
- db $3c, $20
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_3C, 32
+ endanim
.Frameset_1b:
- db $41, $08
- db $42, $08
- db $41, $08
- db $42, $48
- db -2
- db $43, $08
- db $44, $08
- db -2
- db $45, $08
- db $46, $08
- db -2
- db $47, $08
- db $48, $08
- db -2
- db $49, $01
- db $49, $41
- db $49, $c1
- db $49, $81
- db -2
- db $4a, $20
- db -1
- db $4b, $20
- db -1
- db $4c, $20
- db -1
- db $4d, $20
- db -1
- db $4e, $03
- db -3, $03
- db -2
+ frame SPRITE_ANIM_FRAME_IDX_41, 8
+ frame SPRITE_ANIM_FRAME_IDX_42, 8
+ frame SPRITE_ANIM_FRAME_IDX_41, 8
+ frame SPRITE_ANIM_FRAME_IDX_42, 8, OAM_X_FLIP
+ dorestart
+; XXX
+ frame SPRITE_ANIM_FRAME_IDX_43, 8
+ frame SPRITE_ANIM_FRAME_IDX_44, 8
+ dorestart
+
+; XXX
+ frame SPRITE_ANIM_FRAME_IDX_45, 8
+ frame SPRITE_ANIM_FRAME_IDX_46, 8
+ dorestart
+
+; XXX
+ frame SPRITE_ANIM_FRAME_IDX_47, 8
+ frame SPRITE_ANIM_FRAME_IDX_48, 8
+ dorestart
+
+; XXX
+ frame SPRITE_ANIM_FRAME_IDX_49, 1
+ frame SPRITE_ANIM_FRAME_IDX_49, 1, OAM_X_FLIP
+ frame SPRITE_ANIM_FRAME_IDX_49, 1, OAM_X_FLIP, OAM_Y_FLIP
+ frame SPRITE_ANIM_FRAME_IDX_49, 1, OAM_Y_FLIP
+ dorestart
+
+; XXX
+ frame SPRITE_ANIM_FRAME_IDX_4A, 32
+ endanim
+
+; XXX
+ frame SPRITE_ANIM_FRAME_IDX_4B, 32
+ endanim
+
+; XXX
+ frame SPRITE_ANIM_FRAME_IDX_4C, 32
+ endanim
+
+; XXX
+ frame SPRITE_ANIM_FRAME_IDX_4D, 32
+ endanim
+
+; XXX
+ frame SPRITE_ANIM_FRAME_IDX_4E, 3
+ dorepeat 3
+ dorestart
+
.Frameset_1c:
- db -3, $20
- db -1
+ dorepeat 32
+ endanim
.Frameset_1d:
- db $4f, $20
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_4F, 32
+ endanim
.Frameset_1e:
- db $50, $02
- db $51, $10
- db -3, $01
- db $52, $01
- db -3, $01
- db $53, $01
- db -4
+ frame SPRITE_ANIM_FRAME_IDX_50, 2
+ frame SPRITE_ANIM_FRAME_IDX_51, 16
+ dorepeat 1
+ frame SPRITE_ANIM_FRAME_IDX_52, 1
+ dorepeat 1
+ frame SPRITE_ANIM_FRAME_IDX_53, 1
+ delanim
.Frameset_1f:
- db $54, $20
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_54, 32
+ endanim
.Frameset_20:
- db $55, $20
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_55, 32
+ endanim
.Frameset_21:
- db $55, $60
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_55, 32, OAM_X_FLIP
+ endanim
.Frameset_22:
- db $55, $a0
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_55, 32, OAM_Y_FLIP
+ endanim
.Frameset_23:
- db $55, $e0
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_55, 32, OAM_X_FLIP, OAM_Y_FLIP
+ endanim
.Frameset_24:
- db $56, $0a
- db $57, $09
- db $58, $0a
- db $59, $0a
- db $58, $09
- db $5a, $0a
- db -2
+ frame SPRITE_ANIM_FRAME_IDX_56, 10
+ frame SPRITE_ANIM_FRAME_IDX_57, 9
+ frame SPRITE_ANIM_FRAME_IDX_58, 10
+ frame SPRITE_ANIM_FRAME_IDX_59, 10
+ frame SPRITE_ANIM_FRAME_IDX_58, 9
+ frame SPRITE_ANIM_FRAME_IDX_5A, 10
+ dorestart
.Frameset_25:
- db $50, $02
- db $5b, $02
- db $50, $02
- db $5b, $42
- db -2
+ frame SPRITE_ANIM_FRAME_IDX_50, 2
+ frame SPRITE_ANIM_FRAME_IDX_5B, 2
+ frame SPRITE_ANIM_FRAME_IDX_50, 2
+ frame SPRITE_ANIM_FRAME_IDX_5B, 2, OAM_X_FLIP
+ dorestart
.Frameset_26:
- db $5c, $02
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_5C, 2
+ endanim
.Frameset_27:
- db $5d, $02
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_5D, 2
+ endanim
.Frameset_28:
- db $5e, $02
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_5E, 2
+ endanim
.Frameset_29:
- db $5f, $02
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_5F, 2
+ endanim
.Frameset_2a:
- db $60, $02
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_60, 2
+ endanim
.Frameset_2b:
- db $61, $02
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_61, 2
+ endanim
.Frameset_2c:
- db $62, $02
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_62, 2
+ endanim
.Frameset_2f:
- db $32, $03
- db $33, $03
- db $34, $03
- db $30, $03
- db $31, $03
- db $30, $03
- db $31, $43
- db $30, $03
- db $31, $03
- db $30, $03
- db $31, $43
- db $30, $03
- db $31, $03
- db $30, $03
- db $31, $43
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_32, 3
+ frame SPRITE_ANIM_FRAME_IDX_33, 3
+ frame SPRITE_ANIM_FRAME_IDX_34, 3
+ frame SPRITE_ANIM_FRAME_IDX_30, 3
+ frame SPRITE_ANIM_FRAME_IDX_31, 3
+ frame SPRITE_ANIM_FRAME_IDX_30, 3
+ frame SPRITE_ANIM_FRAME_IDX_31, 3, OAM_X_FLIP
+ frame SPRITE_ANIM_FRAME_IDX_30, 3
+ frame SPRITE_ANIM_FRAME_IDX_31, 3
+ frame SPRITE_ANIM_FRAME_IDX_30, 3
+ frame SPRITE_ANIM_FRAME_IDX_31, 3, OAM_X_FLIP
+ frame SPRITE_ANIM_FRAME_IDX_30, 3
+ frame SPRITE_ANIM_FRAME_IDX_31, 3
+ frame SPRITE_ANIM_FRAME_IDX_30, 3
+ frame SPRITE_ANIM_FRAME_IDX_31, 3, OAM_X_FLIP
+ endanim
.Frameset_30:
- db $30, $03
- db $31, $03
- db $30, $03
- db $31, $43
- db $30, $03
- db $31, $03
- db $30, $03
- db $31, $43
- db $30, $03
- db $31, $03
- db $30, $03
- db $31, $43
- db $32, $03
- db $33, $03
- db $34, $03
- db -4
+ frame SPRITE_ANIM_FRAME_IDX_30, 3
+ frame SPRITE_ANIM_FRAME_IDX_31, 3
+ frame SPRITE_ANIM_FRAME_IDX_30, 3
+ frame SPRITE_ANIM_FRAME_IDX_31, 3, OAM_X_FLIP
+ frame SPRITE_ANIM_FRAME_IDX_30, 3
+ frame SPRITE_ANIM_FRAME_IDX_31, 3
+ frame SPRITE_ANIM_FRAME_IDX_30, 3
+ frame SPRITE_ANIM_FRAME_IDX_31, 3, OAM_X_FLIP
+ frame SPRITE_ANIM_FRAME_IDX_30, 3
+ frame SPRITE_ANIM_FRAME_IDX_31, 3
+ frame SPRITE_ANIM_FRAME_IDX_30, 3
+ frame SPRITE_ANIM_FRAME_IDX_31, 3, OAM_X_FLIP
+ frame SPRITE_ANIM_FRAME_IDX_32, 3
+ frame SPRITE_ANIM_FRAME_IDX_33, 3
+ frame SPRITE_ANIM_FRAME_IDX_34, 3
+ delanim
.Frameset_31:
- db $67, $03
- db $68, $03
- db -2
+ frame SPRITE_ANIM_FRAME_IDX_67, 3
+ frame SPRITE_ANIM_FRAME_IDX_68, 3
+ dorestart
.Frameset_32:
- db $6c, $03
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_6C, 3
+ endanim
.Frameset_33:
- db $6d, $03
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_6D, 3
+ endanim
.Frameset_34:
- db $69, $02
- db $6a, $02
- db $6b, $02
- db -4
+ frame SPRITE_ANIM_FRAME_IDX_69, 2
+ frame SPRITE_ANIM_FRAME_IDX_6A, 2
+ frame SPRITE_ANIM_FRAME_IDX_6B, 2
+ delanim
.Frameset_35:
- db $6e, $03
- db $6f, $03
- db $70, $03
- db $71, $03
- db -2
+ frame SPRITE_ANIM_FRAME_IDX_6E, 3
+ frame SPRITE_ANIM_FRAME_IDX_6F, 3
+ frame SPRITE_ANIM_FRAME_IDX_70, 3
+ frame SPRITE_ANIM_FRAME_IDX_71, 3
+ dorestart
.Frameset_36:
- db $71, $03
- db $6e, $07
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_71, 3
+ frame SPRITE_ANIM_FRAME_IDX_6E, 7
+ endanim
.Frameset_37:
- db $72, $20
- db $73, $07
- db $74, $07
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_72, 32
+ frame SPRITE_ANIM_FRAME_IDX_73, 7
+ frame SPRITE_ANIM_FRAME_IDX_74, 7
+ endanim
.Frameset_38:
- db $75, $03
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_75, 3
+ endanim
.Frameset_39:
- db $76, $03
- db $77, $03
- db $78, $07
- db -4
+ frame SPRITE_ANIM_FRAME_IDX_76, 3
+ frame SPRITE_ANIM_FRAME_IDX_77, 3
+ frame SPRITE_ANIM_FRAME_IDX_78, 7
+ delanim
.Frameset_3a:
- db $76, $43
- db $77, $43
- db $78, $47
- db -4
+ frame SPRITE_ANIM_FRAME_IDX_76, 3, OAM_X_FLIP
+ frame SPRITE_ANIM_FRAME_IDX_77, 3, OAM_X_FLIP
+ frame SPRITE_ANIM_FRAME_IDX_78, 7, OAM_X_FLIP
+ delanim
.Frameset_3b:
- db $76, $83
- db $77, $83
- db $78, $87
- db -4
+ frame SPRITE_ANIM_FRAME_IDX_76, 3, OAM_Y_FLIP
+ frame SPRITE_ANIM_FRAME_IDX_77, 3, OAM_Y_FLIP
+ frame SPRITE_ANIM_FRAME_IDX_78, 7, OAM_Y_FLIP
+ delanim
.Frameset_3c:
- db $76, $c3
- db $77, $c3
- db $78, $c7
- db -4
+ frame SPRITE_ANIM_FRAME_IDX_76, 3, OAM_X_FLIP, OAM_Y_FLIP
+ frame SPRITE_ANIM_FRAME_IDX_77, 3, OAM_X_FLIP, OAM_Y_FLIP
+ frame SPRITE_ANIM_FRAME_IDX_78, 7, OAM_X_FLIP, OAM_Y_FLIP
+ delanim
.Frameset_3d:
- db $79, $03
- db $7a, $03
- db $7b, $03
- db $7c, $07
- db $7d, $07
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_79, 3
+ frame SPRITE_ANIM_FRAME_IDX_7A, 3
+ frame SPRITE_ANIM_FRAME_IDX_7B, 3
+ frame SPRITE_ANIM_FRAME_IDX_7C, 7
+ frame SPRITE_ANIM_FRAME_IDX_7D, 7
+ endanim
.Frameset_3e:
- db $7e, $03
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_7E, 3
+ endanim
.Frameset_3f:
- db -3, $00
- db -1
+ dorepeat 0
+ endanim
.Frameset_40:
- db $7f, $08
- db $80, $08
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_7F, 8
+ frame SPRITE_ANIM_FRAME_IDX_80, 8
+ endanim
.Frameset_41:
- db $7f, $48
- db $80, $48
- db -1
+ frame SPRITE_ANIM_FRAME_IDX_7F, 8, OAM_X_FLIP
+ frame SPRITE_ANIM_FRAME_IDX_80, 8, OAM_X_FLIP
+ endanim
; 8d94d
SpriteAnimOAMData: ; 8d94d
--- a/engine/anim_hp_bar.asm
+++ b/engine/anim_hp_bar.asm
@@ -41,10 +41,10 @@
; d65f
.IsMaximumMoreThan48Pixels: ; d65f
- ld a, [Buffer2]
+ ld a, [wCurHPAnimMaxHP + 1]
and a
jr nz, .player
- ld a, [Buffer1]
+ ld a, [wCurHPAnimMaxHP]
cp 6 * 8
jr nc, .player
and a
@@ -56,11 +56,8 @@
; d670
.ComputePixels: ; d670
-; Buffer1-2: Max HP
-; Buffer3-4: Old HP
-; Buffer5-6: New HP
push hl
- ld hl, Buffer1
+ ld hl, wCurHPAnimMaxHP
ld a, [hli]
ld e, a
ld a, [hli]
@@ -74,13 +71,13 @@
ld a, e
ld [wCurHPBarPixels], a
- ld a, [Buffer5]
+ ld a, [wCurHPAnimNewHP]
ld c, a
- ld a, [Buffer6]
+ ld a, [wCurHPAnimNewHP + 1]
ld b, a
- ld a, [Buffer1]
+ ld a, [wCurHPAnimMaxHP]
ld e, a
- ld a, [Buffer2]
+ ld a, [wCurHPAnimMaxHP + 1]
ld d, a
call ComputeHPBarPixels
ld a, e
@@ -87,7 +84,7 @@
ld [wNewHPBarPixels], a
push hl
- ld hl, Buffer3
+ ld hl, wCurHPAnimOldHP
ld a, [hli]
ld c, a
ld a, [hli]
@@ -104,18 +101,18 @@
sbc b
ld d, a
jr c, .negative
- ld a, [Buffer3]
- ld [wd1f5], a
- ld a, [Buffer5]
- ld [wd1f6], a
+ ld a, [wCurHPAnimOldHP]
+ ld [wCurHPAnimLowHP], a
+ ld a, [wCurHPAnimNewHP]
+ ld [wCurHPAnimHighHP], a
ld bc, 1
jr .got_direction
.negative
- ld a, [Buffer3]
- ld [wd1f6], a
- ld a, [Buffer5]
- ld [wd1f5], a
+ ld a, [wCurHPAnimOldHP]
+ ld [wCurHPAnimHighHP], a
+ ld a, [wCurHPAnimNewHP]
+ ld [wCurHPAnimLowHP], a
ld a, e
xor $ff
inc a
@@ -126,9 +123,9 @@
ld bc, -1
.got_direction
ld a, d
- ld [wd1f3], a
+ ld [wCurHPAnimDeltaHP], a
ld a, e
- ld [wd1f4], a
+ ld [wCurHPAnimDeltaHP + 1], a
ret
; d6e2
@@ -151,7 +148,7 @@
LongAnim_UpdateVariables: ; d6f5
.loop
- ld hl, Buffer3
+ ld hl, wCurHPAnimOldHP
ld a, [hli]
ld e, a
ld a, [hli]
@@ -171,13 +168,13 @@
ld h, d
add hl, bc
ld a, l
- ld [Buffer3], a
+ ld [wCurHPAnimOldHP], a
ld a, h
- ld [Buffer4], a
+ ld [wCurHPAnimOldHP + 1], a
push hl
push de
push bc
- ld hl, Buffer1
+ ld hl, wCurHPAnimMaxHP
ld a, [hli]
ld e, a
ld a, [hli]
@@ -222,13 +219,13 @@
LongHPBarAnim_UpdateTiles: ; d749
call HPBarAnim_UpdateHPRemaining
- ld a, [Buffer3]
+ ld a, [wCurHPAnimOldHP]
ld c, a
- ld a, [Buffer4]
+ ld a, [wCurHPAnimOldHP + 1]
ld b, a
- ld a, [Buffer1]
+ ld a, [wCurHPAnimMaxHP]
ld e, a
- ld a, [Buffer2]
+ ld a, [wCurHPAnimMaxHP + 1]
ld d, a
call ComputeHPBarPixels
ld c, e
@@ -273,14 +270,13 @@
push hl
add hl, de
ld a, " "
-rept 2
ld [hli], a
-endr
+ ld [hli], a
ld [hld], a
dec hl
- ld a, [Buffer3]
+ ld a, [wCurHPAnimOldHP]
ld [StringBuffer2 + 1], a
- ld a, [Buffer4]
+ ld a, [wCurHPAnimOldHP + 1]
ld [StringBuffer2], a
ld de, StringBuffer2
lb bc, 2, 3
@@ -293,9 +289,9 @@
ld a, [hCGB]
and a
ret z
- ld hl, wd1f0
+ ld hl, wCurHPAnimPal
call SetHPPal
- ld a, [wd1f0]
+ ld a, [wCurHPAnimPal]
ld c, a
callba ApplyHPBarPals
ret
@@ -376,7 +372,7 @@
; d839
ShortHPBar_CalcPixelFrame: ; d839
- ld a, [Buffer1]
+ ld a, [wCurHPAnimMaxHP]
ld c, a
ld b, 0
ld hl, 0
@@ -412,24 +408,24 @@
jr c, .no_carry
inc b
.no_carry
- ld a, [wd1f5]
+ ld a, [wCurHPAnimLowHP]
cp b
jr nc, .finish
- ld a, [wd1f6]
+ ld a, [wCurHPAnimHighHP]
cp b
jr c, .finish
ld a, b
.finish
- ld [Buffer3], a
+ ld [wCurHPAnimOldHP], a
ret
.return_zero
xor a
- ld [Buffer3], a
+ ld [wCurHPAnimOldHP], a
ret
.return_max
- ld a, [Buffer1]
- ld [Buffer3], a
+ ld a, [wCurHPAnimMaxHP]
+ ld [wCurHPAnimOldHP], a
ret
; d88c
--- a/engine/battle_start.asm
+++ b/engine/battle_start.asm
@@ -39,9 +39,9 @@
call DmgToCgbBGPals
call DelayFrame
xor a
- ld [hFFC6], a
- ld [hFFC7], a
- ld [hFFC8], a
+ ld [hLCDCPointer], a
+ ld [hLYOverrideStart], a
+ ld [hLYOverrideEnd], a
ld [hSCY], a
ld a, $1
@@ -56,7 +56,7 @@
ld a, [wLinkMode]
cp LINK_MOBILE
jr z, .mobile
- callba Function6454
+ callba ReanchorBGMap_NoOAMUpdate
call UpdateSprites
call DelayFrame
call .NonMobile_LoadPokeballTiles
@@ -84,7 +84,7 @@
.NonMobile_LoadPokeballTiles: ; 8c2a0
call LoadTrainerBattlePokeballTiles
hlbgcoord 0, 0
- call Function8c2cf
+ call ConvertTrainerBattlePokeballTilesTo2bpp
ret
; 8c2aa
@@ -113,7 +113,7 @@
ret
; 8c2cf
-Function8c2cf: ; 8c2cf
+ConvertTrainerBattlePokeballTilesTo2bpp: ; 8c2cf
ld a, [rSVBK]
push af
ld a, $6
@@ -132,7 +132,7 @@
pop hl
ld de, wDecompressScratch
- ld b, BANK(Function8c2cf) ; BANK(@)
+ ld b, BANK(ConvertTrainerBattlePokeballTilesTo2bpp) ; BANK(@)
ld c, $28
call Request2bpp
pop af
@@ -302,12 +302,12 @@
call StartTrainerBattle_NextScene
- ld a, $43
- ld [hFFC6], a
+ ld a, rSCX - $ff00
+ ld [hLCDCPointer], a
xor a
- ld [hFFC7], a
+ ld [hLYOverrideStart], a
ld a, $90
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
xor a
ld [wcf64], a
ld [wcf65], a
--- a/engine/billspc.asm
+++ b/engine/billspc.asm
@@ -64,7 +64,7 @@
call PCMonInfo
ld a, $ff
ld [CurPartySpecies], a
- ld a, SCGB_17
+ ld a, SCGB_BILLS_PC
call BillsPC_ApplyPalettes
call WaitBGMap
call BillsPC_UpdateSelectionCursor
@@ -120,7 +120,7 @@
call ClearSprites
call BillsPC_GetSelectedPokemonSpecies
ld [CurPartySpecies], a
- ld a, SCGB_17
+ ld a, SCGB_BILLS_PC
call BillsPC_ApplyPalettes
ld de, PCString_WhatsUp
call BillsPC_PlaceString
@@ -142,9 +142,8 @@
ld e, a
ld d, 0
ld hl, BillsPCDepositJumptable
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -182,7 +181,7 @@
call PCMonInfo
call BillsPC_GetSelectedPokemonSpecies
ld [CurPartySpecies], a
- ld a, SCGB_17
+ ld a, SCGB_BILLS_PC
call BillsPC_ApplyPalettes
ret
@@ -334,7 +333,7 @@
call PCMonInfo
ld a, $ff
ld [CurPartySpecies], a
- ld a, SCGB_17
+ ld a, SCGB_BILLS_PC
call BillsPC_ApplyPalettes
call WaitBGMap
call BillsPC_UpdateSelectionCursor
@@ -389,7 +388,7 @@
call ClearSprites
call BillsPC_GetSelectedPokemonSpecies
ld [CurPartySpecies], a
- ld a, SCGB_17
+ ld a, SCGB_BILLS_PC
call BillsPC_ApplyPalettes
ld de, PCString_WhatsUp
call BillsPC_PlaceString
@@ -411,9 +410,8 @@
ld e, a
ld d, 0
ld hl, .dw
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -449,7 +447,7 @@
call PCMonInfo
call BillsPC_GetSelectedPokemonSpecies
ld [CurPartySpecies], a
- ld a, SCGB_17
+ ld a, SCGB_BILLS_PC
call BillsPC_ApplyPalettes
ret
@@ -586,7 +584,7 @@
call PCMonInfo
ld a, $ff
ld [CurPartySpecies], a
- ld a, SCGB_17
+ ld a, SCGB_BILLS_PC
call BillsPC_ApplyPalettes
call WaitBGMap
call BillsPC_UpdateSelectionCursor
@@ -652,7 +650,7 @@
call ClearSprites
call BillsPC_GetSelectedPokemonSpecies
ld [CurPartySpecies], a
- ld a, SCGB_17
+ ld a, SCGB_BILLS_PC
call BillsPC_ApplyPalettes
ld de, PCString_WhatsUp
call BillsPC_PlaceString
@@ -675,9 +673,8 @@
ld e, a
ld d, 0
ld hl, .Jumptable2
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -711,7 +708,7 @@
call PCMonInfo
call BillsPC_GetSelectedPokemonSpecies
ld [CurPartySpecies], a
- ld a, SCGB_17
+ ld a, SCGB_BILLS_PC
call BillsPC_ApplyPalettes
ret
; e28bd
@@ -1162,10 +1159,10 @@
add [hl]
ld e, a
ld d, $0
- ld hl, wBillsPCPokemonList + 1
-rept 3
+ ld hl, wBillsPCPokemonList + 1 ; box number
add hl, de
-endr
+ add hl, de
+ add hl, de
ld a, [hl]
and a
jr z, .party
@@ -1277,9 +1274,9 @@
ld e, a
ld d, 0
ld hl, wBillsPCPokemonList
-rept 3
add hl, de
-endr
+ add hl, de
+ add hl, de
ld e, l
ld d, h
hlcoord 9, 4
@@ -1293,9 +1290,9 @@
ld de, 2 * SCREEN_WIDTH
add hl, de
pop de
-rept 3
inc de
-endr
+ inc de
+ inc de
pop af
dec a
jr nz, .loop
@@ -1496,9 +1493,9 @@
ld e, a
ld d, $0
ld hl, wBillsPCPokemonList
-rept 3
add hl, de
-endr
+ add hl, de
+ add hl, de
ld a, [hl]
ret
@@ -2010,9 +2007,8 @@
.moving_to_box
ld hl, .Jumptable
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
@@ -2024,7 +2020,7 @@
.dw_return ; e322a
pop af
ld e, a
- callba Function14ad5
+ callba MovePkmnWOMail_InsertMon_SaveGame
ret
; e3233
@@ -2059,10 +2055,10 @@
.PartyToBox: ; e3267
call .CopyFromParty
ld a, $1
- ld [wc2cd], a
+ ld [wGameLogicPaused], a
callba SaveGameData
xor a
- ld [wc2cd], a
+ ld [wGameLogicPaused], a
call .CopyToBox
ret
; e327d
@@ -2143,7 +2139,7 @@
ld hl, wBillsPC_ScrollPosition
add [hl]
ld [CurPartyMon], a
- callba Function51322
+ callba InsertPokemonIntoBox
ret
; e3316
@@ -2172,7 +2168,7 @@
ld hl, wBillsPC_ScrollPosition
add [hl]
ld [CurPartyMon], a
- callba Function5138b
+ callba InsertPokemonIntoParty
ret
; e3357
@@ -2215,9 +2211,9 @@
ld c, b
ld b, 0
ld hl, .boxes
-rept 3
add hl, bc
-endr
+ add hl, bc
+ add hl, bc
ld a, [hli]
ld b, a
ld a, [hli]
@@ -2256,9 +2252,8 @@
BillsPC_Jumptable: ; e33df (38:73df)
ld e, a
ld d, $0
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -2434,9 +2429,9 @@
ld c, a
ld b, 0
ld hl, .boxbanks
-rept 3
add hl, bc
-endr
+ add hl, bc
+ add hl, bc
ld a, [hli]
ld b, a
call GetSRAMBank
--- a/engine/breeding/egg.asm
+++ b/engine/breeding/egg.asm
@@ -8,7 +8,7 @@
ld [TempMonDVs], a
ld a, [wBreedMon1DVs + 1]
ld [TempMonDVs + 1], a
- ld a, BREEDMON
+ ld a, TEMPMON
ld [MonType], a
predef GetGender
jr c, .genderless
@@ -442,9 +442,8 @@
ld c, a
ld b, 0
ld hl, EggMovePointers
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, BANK(EggMovePointers)
call GetFarHalfword
.loop
@@ -477,9 +476,8 @@
ld c, a
ld b, 0
ld hl, EvosAttacksPointers
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, BANK(EvosAttacksPointers)
call GetFarHalfword
.loop3
@@ -590,7 +588,7 @@
ld [TempMonDVs], a
ld a, [wBreedMon2DVs + 1]
ld [TempMonDVs + 1], a
- ld a, BREEDMON
+ ld a, TEMPMON
ld [MonType], a
predef GetGender
jr c, .inherit_mon2_moves
@@ -606,7 +604,7 @@
ld [TempMonDVs], a
ld a, [wBreedMon1DVs + 1]
ld [TempMonDVs + 1], a
- ld a, BREEDMON
+ ld a, TEMPMON
ld [MonType], a
predef GetGender
jr c, .inherit_mon1_moves
@@ -788,7 +786,7 @@
Hatch_LoadFrontpicPal: ; 17363 (5:7363)
ld [PlayerHPPal], a
- ld b, SCGB_0B
+ ld b, SCGB_EVOLUTION
ld c, $0
jp GetSGBLayout
@@ -849,7 +847,7 @@
add [hl]
ld [hl], a
- ld hl, SPRITEANIMSTRUCT_0B
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
ld [hl], d
--- a/engine/buy_sell_toss.asm
+++ b/engine/buy_sell_toss.asm
@@ -48,7 +48,7 @@
; 2500e
BuySellToss_InterpretJoypad: ; 2500e
- call Function354b ; get joypad
+ call JoyTextDelay_ForcehJoyDown ; get joypad
bit B_BUTTON_F, c
jr nz, .b
bit A_BUTTON_F, c
--- a/engine/card_flip.asm
+++ b/engine/card_flip.asm
@@ -71,9 +71,8 @@
ld e, a
ld d, 0
ld hl, .Jumptable
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -276,9 +275,8 @@
ld e, a
ld d, 0
ld hl, wDeck
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [wCardFlipWhichCard]
ld e, a
add hl, de
@@ -442,9 +440,8 @@
ld e, a
ld d, 0
ld hl, .Deck
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld e, a
ld d, [hl]
@@ -675,9 +672,8 @@
and a
jr nz, .discarded2
hlcoord 13, 3
-rept 2
add hl, bc
-endr
+ add hl, bc
ld [hl], $36
ld bc, SCREEN_WIDTH
add hl, bc
@@ -686,9 +682,8 @@
.discarded2
hlcoord 13, 3
-rept 2
add hl, bc
-endr
+ add hl, bc
ld [hl], $36
ld bc, SCREEN_WIDTH
add hl, bc
@@ -703,9 +698,8 @@
and a
jr nz, .discarded1
hlcoord 13, 4
-rept 2
add hl, bc
-endr
+ add hl, bc
ld [hl], $3b
ld bc, SCREEN_WIDTH
add hl, bc
@@ -714,9 +708,8 @@
.discarded1
hlcoord 13, 4
-rept 2
add hl, bc
-endr
+ add hl, bc
ld [hl], $3d
ld bc, SCREEN_WIDTH
add hl, bc
@@ -731,9 +724,8 @@
and a
jr nz, .discarded4
hlcoord 13, 6
-rept 2
add hl, bc
-endr
+ add hl, bc
ld [hl], $36
ld bc, SCREEN_WIDTH
add hl, bc
@@ -742,9 +734,8 @@
.discarded4
hlcoord 13, 6
-rept 2
add hl, bc
-endr
+ add hl, bc
ld [hl], $36
ld bc, SCREEN_WIDTH
add hl, bc
@@ -759,9 +750,8 @@
and a
jr nz, .discarded3
hlcoord 13, 7
-rept 2
add hl, bc
-endr
+ add hl, bc
ld [hl], $3c
ld bc, SCREEN_WIDTH
add hl, bc
@@ -770,9 +760,8 @@
.discarded3
hlcoord 13, 7
-rept 2
add hl, bc
-endr
+ add hl, bc
ld [hl], $3d
ld bc, SCREEN_WIDTH
add hl, bc
@@ -787,9 +776,8 @@
and a
jr nz, .discarded6
hlcoord 13, 9
-rept 2
add hl, bc
-endr
+ add hl, bc
ld [hl], $36
ld bc, SCREEN_WIDTH
add hl, bc
@@ -798,9 +786,8 @@
.discarded6
hlcoord 13, 9
-rept 2
add hl, bc
-endr
+ add hl, bc
ld [hl], $36
ld bc, SCREEN_WIDTH
add hl, bc
@@ -815,9 +802,8 @@
and a
jr nz, .discarded5
hlcoord 13, 10
-rept 2
add hl, bc
-endr
+ add hl, bc
ld [hl], $3c
ld bc, SCREEN_WIDTH
add hl, bc
@@ -826,9 +812,8 @@
.discarded5
hlcoord 13, 10
-rept 2
add hl, bc
-endr
+ add hl, bc
ld [hl], $3d
ld bc, SCREEN_WIDTH
add hl, bc
@@ -1296,9 +1281,8 @@
ld [hl], a
cp $3
jr c, .left_to_number_gp
-rept 2
dec [hl]
-endr
+ dec [hl]
jp .play_sound
.left_to_number_gp
@@ -1326,9 +1310,8 @@
ld [hl], a
cp $4
ret nc
-rept 2
inc [hl]
-endr
+ inc [hl]
jr .play_sound
.d_up ; e090a
@@ -1357,9 +1340,8 @@
ld [hl], a
cp $3
jr c, .up_to_mon_group
-rept 2
dec [hl]
-endr
+ dec [hl]
jr .play_sound
.up_to_mon_group
@@ -1387,9 +1369,8 @@
ld [hl], a
cp $6
ret nc
-rept 2
inc [hl]
-endr
+ inc [hl]
.play_sound ; e0959
ld de, SFX_POKEBALLS_PLACED_ON_TABLE
@@ -1408,9 +1389,8 @@
.skip
call CollapseCursorPosition
-rept 2
add hl, hl
-endr
+ add hl, hl
ld de, .OAMData
add hl, de
ld a, [hli]
--- a/engine/clock_reset.asm
+++ b/engine/clock_reset.asm
@@ -121,7 +121,7 @@
; 0x200ba
.joy_loop
- call Function354b
+ call JoyTextDelay_ForcehJoyDown
ld c, a
push af
call .PrintTime
--- a/engine/color.asm
+++ b/engine/color.asm
@@ -79,6 +79,7 @@
ret
Function8aa4:
+; XXX
push de
push bc
ld hl, PalPacket_9ce6
@@ -96,9 +97,9 @@
ld a, d
ld [wSGBPals + 6], a
ld hl, wSGBPals
- call Function9809
+ call PushSGBPals_
ld hl, BlkPacket_9a86
- call Function9809
+ call PushSGBPals_
ret
InitPartyMenuPalettes:
@@ -138,6 +139,7 @@
; Unreferenced
call CheckCGB
ret z
+; CGB only
ld hl, .BGPal
ld de, UnknBGPals
ld bc, 1 palettes
@@ -175,9 +177,10 @@
and a
ret z
ld hl, BlkPacket_9a86
- jp Function9809
+ jp PushSGBPals_
Function8b4d:
+; XXX
call CheckCGB
jr nz, .cgb
ld a, [hSGB]
@@ -184,7 +187,7 @@
and a
ret z
ld hl, PalPacket_9c26
- jp Function9809
+ jp PushSGBPals_
.cgb
ld de, UnknOBPals
@@ -193,6 +196,7 @@
jp LoadHLPaletteIntoDE
Function8b67:
+; XXX
call CheckCGB
jr nz, .cgb
ld a, [hSGB]
@@ -199,7 +203,7 @@
and a
ret z
ld hl, PalPacket_9c36
- jp Function9809
+ jp PushSGBPals_
.cgb
ld de, UnknOBPals
@@ -208,8 +212,9 @@
jp LoadHLPaletteIntoDE
Function8b81:
+; XXX
call CheckCGB
- jr nz, .asm_8bb2
+ jr nz, .cgb
ld a, [hSGB]
and a
ret z
@@ -230,9 +235,9 @@
ld a, [hl]
ld [wSGBPals + 6], a
ld hl, wSGBPals
- jp Function9809
+ jp PushSGBPals_
-.asm_8bb2
+.cgb
ld de, UnknOBPals
ld a, c
call GetMonPalettePointer_
@@ -239,36 +244,36 @@
call LoadPalette_White_Col1_Col2_Black
ret
-Function8bbd:
+LoadTrainerClassPaletteAsNthBGPal:
ld a, [TrainerClass]
call GetTrainerPalettePointer
ld a, e
- jr asm_8bd7
+ jr got_palette_pointer_8bd7
-Function8bc6:
+LoadMonPaletteAsNthBGPal:
ld a, [CurPartySpecies]
call GetMonPalettePointer
ld a, e
bit 7, a
- jr z, .asm_8bd7
+ jr z, got_palette_pointer_8bd7
and $7f
-rept 4
inc hl
-endr
-.asm_8bd7
+ inc hl
+ inc hl
+ inc hl
-asm_8bd7
+got_palette_pointer_8bd7
push hl
ld hl, UnknBGPals
- ld de, $8
-.asm_8bde
+ ld de, 1 palettes
+.loop
and a
- jr z, .asm_8be5
+ jr z, .got_addr
add hl, de
dec a
- jr .asm_8bde
+ jr .loop
-.asm_8be5
+.got_addr
ld e, l
ld d, h
pop hl
@@ -276,30 +281,31 @@
ret
Function8bec:
+; XXX
ld a, [hCGB]
and a
- jr nz, .asm_8bf7
+ jr nz, .cgb
ld hl, PlayerLightScreenCount
- jp Function9809
+ jp PushSGBPals_
-.asm_8bf7
- ld a, [EnemyLightScreenCount]
+.cgb
+ ld a, [EnemyLightScreenCount] ; col
ld c, a
- ld a, [EnemyReflectCount]
+ ld a, [EnemyReflectCount] ; row
hlcoord 0, 0, AttrMap
- ld de, $14
-.asm_8c04
+ ld de, SCREEN_WIDTH
+.loop
and a
- jr z, .asm_8c0b
+ jr z, .done
add hl, de
dec a
- jr .asm_8c04
+ jr .loop
-.asm_8c0b
+.done
ld b, $0
add hl, bc
lb bc, 6, 4
- ld a, [EnemySafeguardCount]
+ ld a, [EnemySafeguardCount] ; value
and $3
call FillBoxCGB
call LoadEDTile
@@ -401,16 +407,16 @@
ld a, $1
ret
-Function8cb4:
+LoadMailPalettes:
ld l, e
ld h, 0
-rept 3
add hl, hl
-endr
- ld de, Palettes_8d05
+ add hl, hl
+ add hl, hl
+ ld de, .MailPals
add hl, de
call CheckCGB
- jr nz, .asm_8cf0
+ jr nz, .cgb
push hl
ld hl, PalPacket_9ce6
ld de, wSGBPals
@@ -428,12 +434,12 @@
ld a, [hli]
ld [wSGBPals + 6], a
ld hl, wSGBPals
- call Function9809
+ call PushSGBPals_
ld hl, BlkPacket_9a86
- call Function9809
+ call PushSGBPals_
ret
-.asm_8cf0
+.cgb
ld de, UnknBGPals
ld bc, 1 palettes
ld a, $5
@@ -443,7 +449,7 @@
call ApplyAttrMap
ret
-Palettes_8d05:
+.MailPals:
RGB 20, 31, 11
RGB 31, 19, 00
RGB 31, 10, 09
@@ -497,7 +503,8 @@
INCLUDE "predef/cgb.asm"
Function95f0:
- ld hl, Palette_9608
+; XXX
+ ld hl, .Palette
ld de, UnknBGPals
ld bc, 8
ld a, $5
@@ -507,7 +514,7 @@
call ApplyAttrMap
ret
-Palette_9608:
+.Palette:
RGB 31, 31, 31
RGB 09, 31, 31
RGB 10, 12, 31
@@ -534,9 +541,9 @@
GetPredefPal:
ld l, a
ld h, $0
-rept 3 ; multiply by 8
add hl, hl
-endr
+ add hl, hl
+ add hl, hl
ld bc, Palettes_9df6
add hl, bc
ret
@@ -604,30 +611,36 @@
jr nz, .row
ret
-Function9673:
+ResetBGPals:
push af
push bc
push de
push hl
+
ld a, [rSVBK]
push af
ld a, $5
ld [rSVBK], a
+
ld hl, UnknBGPals
ld c, 8
.loop
ld a, $ff
-rept 4
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
+ ld [hli], a
xor a
-rept 4
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
+ ld [hli], a
dec c
jr nz, .loop
+
pop af
ld [rSVBK], a
+
pop hl
pop de
pop bc
@@ -769,8 +782,8 @@
GetTrainerPalettePointer:
ld l, a
ld h, 0
- add hl,hl
- add hl,hl
+ add hl, hl
+ add hl, hl
ld bc, TrainerPalettes
add hl, bc
ret
@@ -830,6 +843,7 @@
RGB 00, 00, 00
Function97cc:
+; XXX
call CheckCGB
ret z
ld a, $90
@@ -836,13 +850,13 @@
ld [rOBPI], a
ld a, $1c
call GetPredefPal
- call Function97e5
+ call .PushPalette
ld a, $21
call GetPredefPal
- call Function97e5
+ call .PushPalette
ret
-Function97e5:
+.PushPalette:
ld c, 1 palettes
.loop
ld a, [hli]
@@ -854,9 +868,9 @@
GetMonPalettePointer:
ld l, a
ld h, $0
-rept 3
add hl, hl
-endr
+ add hl, hl
+ add hl, hl
ld bc, PokemonPalettes
add hl, bc
ret
@@ -874,7 +888,7 @@
endr
ret
-Function9809:
+PushSGBPals_:
ld a, [wcfbe]
push af
set 7, a
@@ -924,9 +938,10 @@
jr nz, .loop
ret
-Function9853:
+InitSGBBorder:
call CheckCGB
ret nz
+; SGB/DMG only
di
ld a, [wcfbe]
push af
@@ -935,29 +950,30 @@
xor a
ld [rJOYP], a
ld [hSGB], a
- call Function994a
- jr nc, .asm_988a
+ call PushSGBBorderPalsAndWait
+ jr nc, .skip
ld a, $1
ld [hSGB], a
- call Function98eb
- call Function99b4
+ call _InitSGBBorderPals
+ call SGBBorder_PushBGPals
call SGBDelayCycles
- call Function993f
- call Function992c
+ call SGB_ClearVRAM
+ call PushSGBBorder
call SGBDelayCycles
- call Function993f
+ call SGB_ClearVRAM
ld hl, PalPacket_9d66
call PushSGBPals
-.asm_988a
+.skip
pop af
ld [wcfbe], a
ei
ret
-Function9890::
+InitCGBPals::
call CheckCGB
ret z
+; CGB only
ld a, $1
ld [rVBK], a
ld hl, VTiles0
@@ -1009,7 +1025,7 @@
jr nz, .loop
ret
-Function98eb:
+_InitSGBBorderPals:
ld hl, .PalPacketPointerTable
ld c, 9
.loop
@@ -1038,25 +1054,26 @@
dw PalPacket_9de6
Function9911:
+; XXX
di
xor a
ld [rJOYP], a
ld hl, PalPacket_9d56
call PushSGBPals
- call Function992c
+ call PushSGBBorder
call SGBDelayCycles
- call Function993f
+ call SGB_ClearVRAM
ld hl, PalPacket_9d66
call PushSGBPals
ei
ret
-Function992c:
+PushSGBBorder:
call .LoadSGBBorderPointers
push de
- call Function9a24
+ call SGBBorder_YetMorePalPushing
pop hl
- call Function99d8
+ call SGBBorder_MorePalPushing
ret
.LoadSGBBorderPointers:
@@ -1064,7 +1081,7 @@
ld de, SGBBorderMap
ret
-Function993f:
+SGB_ClearVRAM:
ld hl, VTiles0
ld bc, $2000
xor a
@@ -1071,7 +1088,7 @@
call ByteFill
ret
-Function994a:
+PushSGBBorderPalsAndWait:
ld hl, PalPacket_9d26
call PushSGBPals
call SGBDelayCycles
@@ -1078,7 +1095,7 @@
ld a, [rJOYP]
and $3
cp $3
- jr nz, .asm_99a6
+ jr nz, .carry
ld a, $20
ld [rJOYP], a
ld a, [rJOYP]
@@ -1098,32 +1115,32 @@
call SGBDelayCycles
ld a, $30
ld [rJOYP], a
-rept 3
ld a, [rJOYP]
-endr
+ ld a, [rJOYP]
+ ld a, [rJOYP]
call SGBDelayCycles
call SGBDelayCycles
ld a, [rJOYP]
and $3
cp $3
- jr nz, .asm_99a6
- call Function99ab
+ jr nz, .carry
+ call .FinalPush
and a
ret
-.asm_99a6
- call Function99ab
+.carry
+ call .FinalPush
scf
ret
-Function99ab:
+.FinalPush:
ld hl, PalPacket_9d16
call PushSGBPals
jp SGBDelayCycles
-Function99b4:
+SGBBorder_PushBGPals:
call DisableLCD
- ld a, $e4
+ ld a, %11100100
ld [rBGP], a
ld hl, Palettes_9df6
ld de, VTiles1
@@ -1138,7 +1155,7 @@
ld [rBGP], a
ret
-Function99d8:
+SGBBorder_MorePalPushing:
call DisableLCD
ld a, $e4
ld [rBGP], a
@@ -1146,7 +1163,7 @@
ld bc, 20 tiles
call CopyData
ld b, 18
-.asm_99ea
+.loop
push bc
ld bc, $c
call CopyData
@@ -1156,7 +1173,7 @@
call CopyData
pop bc
dec b
- jr nz, .asm_99ea
+ jr nz, .loop
ld bc, $140
call CopyData
ld bc, Start
@@ -1172,13 +1189,13 @@
ld [rBGP], a
ret
-Function9a24:
+SGBBorder_YetMorePalPushing:
call DisableLCD
ld a, %11100100
ld [rBGP], a
ld de, VTiles1
ld b, $80
-.asm_9a30
+.loop
push bc
ld bc, 1 tiles
call CopyData
@@ -1186,7 +1203,7 @@
call ClearBytes
pop bc
dec b
- jr nz, .asm_9a30
+ jr nz, .loop
call DrawDefaultTiles
ld a, $e3
ld [rLCDC], a
@@ -1198,6 +1215,7 @@
CopyData: ; 0x9a52
; copy bc bytes of data from hl to de
+.loop
ld a, [hli]
ld [de], a
inc de
@@ -1204,12 +1222,13 @@
dec bc
ld a, c
or b
- jr nz, CopyData
+ jr nz, .loop
ret
; 0x9a5b
ClearBytes: ; 0x9a5b
; clear bc bytes of data starting from de
+.loop
xor a
ld [de], a
inc de
@@ -1216,7 +1235,7 @@
dec bc
ld a, c
or b
- jr nz, ClearBytes
+ jr nz, .loop
ret
; 0x9a64
@@ -1729,34 +1748,34 @@
RGB 31, 31, 31
SGBBorderMap:
- db $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $14,$14, $15,$14, $16,$14, $17,$14, $17,$54, $16,$54, $15,$54, $14,$54, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14
- db $01,$14, $02,$14, $03,$14, $03,$54, $02,$54, $01,$54, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $24,$14, $25,$14, $26,$14, $07,$14, $07,$54, $26,$54, $25,$54, $24,$54, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$54, $01,$14, $02,$14, $03,$14, $03,$54, $02,$54, $01,$54
- db $11,$14, $12,$14, $13,$14, $13,$54, $12,$54, $11,$54, $10,$54, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $24,$14, $34,$14, $35,$14, $35,$54, $34,$54, $33,$54, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $10,$14, $11,$14, $12,$14, $13,$14, $13,$54, $12,$54, $11,$54
- db $21,$14, $22,$14, $23,$14, $23,$54, $22,$54, $21,$54, $20,$54, $07,$14, $08,$14, $09,$14, $0a,$14, $0b,$14, $0c,$14, $0d,$14, $07,$14, $07,$14, $18,$14, $09,$14, $1a,$14, $1b,$14, $0d,$14, $0c,$14, $1c,$14, $29,$14, $07,$14, $20,$14, $21,$14, $22,$14, $23,$14, $23,$54, $22,$54, $21,$54
- db $31,$14, $32,$14, $07,$14, $07,$14, $32,$54, $36,$10, $38,$10, $38,$10, $38,$10, $38,$10, $38,$10, $38,$10, $38,$10, $38,$10, $38,$10, $38,$10, $38,$10, $38,$10, $38,$10, $38,$10, $38,$10, $38,$10, $38,$10, $38,$10, $38,$10, $38,$10, $27,$10, $32,$14, $07,$54, $07,$54, $32,$54, $31,$54
- db $05,$14, $06,$14, $07,$14, $07,$54, $06,$54, $1f,$10, $37,$10, $06,$14, $07,$14, $07,$54, $06,$54, $05,$54
- db $15,$14, $16,$14, $17,$14, $17,$54, $16,$54, $1f,$10, $37,$10, $16,$14, $17,$14, $17,$54, $16,$54, $15,$54
- db $25,$14, $26,$14, $07,$14, $07,$54, $26,$54, $1f,$10, $37,$10, $26,$14, $07,$14, $07,$54, $26,$54, $25,$54
- db $33,$14, $34,$14, $35,$14, $35,$54, $34,$54, $1f,$10, $37,$10, $34,$14, $35,$14, $35,$54, $34,$54, $33,$54
- db $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $1f,$10, $37,$10, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14
- db $02,$54, $01,$54, $07,$54, $07,$14, $07,$14, $1f,$10, $37,$10, $07,$14, $07,$14, $07,$14, $01,$14, $02,$14
- db $12,$54, $11,$54, $10,$54, $07,$14, $07,$14, $1f,$10, $37,$10, $07,$14, $07,$14, $10,$14, $11,$14, $12,$14
- db $22,$54, $21,$54, $20,$54, $07,$14, $07,$14, $1f,$10, $37,$10, $07,$14, $07,$14, $20,$14, $21,$14, $22,$14
- db $32,$54, $31,$54, $30,$54, $07,$14, $07,$14, $1f,$10, $37,$10, $07,$14, $07,$14, $30,$14, $31,$14, $32,$14
- db $06,$54, $05,$54, $04,$54, $07,$14, $07,$14, $1f,$10, $37,$10, $07,$14, $07,$14, $04,$14, $05,$14, $06,$14
- db $16,$54, $15,$54, $14,$54, $07,$14, $07,$14, $1f,$10, $37,$10, $07,$14, $07,$14, $14,$14, $15,$14, $16,$14
- db $26,$54, $25,$54, $24,$54, $07,$14, $07,$14, $1f,$10, $37,$10, $07,$14, $07,$14, $24,$14, $25,$14, $26,$14
- db $34,$54, $33,$54, $07,$54, $07,$14, $07,$14, $1f,$10, $37,$10, $07,$14, $07,$14, $07,$14, $33,$14, $34,$14
- db $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $1f,$10, $37,$10, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14
- db $01,$14, $02,$14, $03,$14, $03,$54, $02,$54, $1f,$10, $37,$10, $02,$14, $03,$14, $03,$54, $02,$54, $01,$54
- db $11,$14, $12,$14, $13,$14, $13,$54, $12,$54, $1f,$10, $37,$10, $12,$14, $13,$14, $13,$54, $12,$54, $11,$54
- db $21,$14, $22,$14, $23,$14, $23,$54, $22,$54, $1f,$10, $37,$10, $22,$14, $23,$14, $23,$54, $22,$54, $21,$54
- db $31,$14, $32,$14, $07,$14, $07,$14, $32,$54, $1f,$10, $37,$10, $32,$14, $07,$54, $07,$54, $32,$54, $31,$54
- db $05,$14, $06,$14, $07,$14, $07,$54, $06,$54, $2e,$10, $2f,$10, $2f,$10, $2f,$10, $2f,$10, $2f,$10, $2f,$10, $2f,$10, $2f,$10, $2f,$10, $2f,$10, $2f,$10, $2f,$10, $2f,$10, $2f,$10, $2f,$10, $2f,$10, $2f,$10, $2f,$10, $2f,$10, $2f,$10, $2d,$10, $06,$14, $07,$14, $07,$54, $06,$54, $05,$54
- db $15,$14, $16,$14, $17,$14, $17,$54, $16,$54, $15,$54, $14,$54, $07,$14, $07,$14, $39,$14, $0e,$14, $09,$14, $0f,$14, $28,$14, $07,$14, $19,$14, $0c,$14, $1c,$14, $29,$14, $2a,$14, $2b,$14, $2c,$14, $39,$14, $07,$14, $07,$14, $14,$14, $15,$14, $16,$14, $17,$14, $17,$54, $16,$54, $15,$54
- db $25,$14, $26,$14, $07,$14, $07,$54, $26,$54, $25,$54, $24,$54, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $01,$14, $02,$14, $03,$14, $03,$54, $02,$54, $01,$54, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $24,$14, $25,$14, $26,$14, $07,$14, $07,$54, $26,$54, $25,$54
- db $33,$14, $34,$14, $35,$14, $35,$54, $34,$54, $24,$54, $07,$54, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $10,$14, $11,$14, $12,$14, $13,$14, $13,$54, $12,$54, $11,$54, $10,$54, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $24,$14, $34,$14, $35,$14, $35,$54, $34,$54, $33,$54
- db $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $20,$14, $21,$14, $22,$14, $23,$14, $23,$54, $22,$54, $21,$54, $20,$54, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14
+ db $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $14, $14, $15, $14, $16, $14, $17, $14, $17, $54, $16, $54, $15, $54, $14, $54, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14
+ db $01, $14, $02, $14, $03, $14, $03, $54, $02, $54, $01, $54, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $24, $14, $25, $14, $26, $14, $07, $14, $07, $54, $26, $54, $25, $54, $24, $54, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $54, $01, $14, $02, $14, $03, $14, $03, $54, $02, $54, $01, $54
+ db $11, $14, $12, $14, $13, $14, $13, $54, $12, $54, $11, $54, $10, $54, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $24, $14, $34, $14, $35, $14, $35, $54, $34, $54, $33, $54, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $10, $14, $11, $14, $12, $14, $13, $14, $13, $54, $12, $54, $11, $54
+ db $21, $14, $22, $14, $23, $14, $23, $54, $22, $54, $21, $54, $20, $54, $07, $14, $08, $14, $09, $14, $0a, $14, $0b, $14, $0c, $14, $0d, $14, $07, $14, $07, $14, $18, $14, $09, $14, $1a, $14, $1b, $14, $0d, $14, $0c, $14, $1c, $14, $29, $14, $07, $14, $20, $14, $21, $14, $22, $14, $23, $14, $23, $54, $22, $54, $21, $54
+ db $31, $14, $32, $14, $07, $14, $07, $14, $32, $54, $36, $10, $38, $10, $38, $10, $38, $10, $38, $10, $38, $10, $38, $10, $38, $10, $38, $10, $38, $10, $38, $10, $38, $10, $38, $10, $38, $10, $38, $10, $38, $10, $38, $10, $38, $10, $38, $10, $38, $10, $38, $10, $27, $10, $32, $14, $07, $54, $07, $54, $32, $54, $31, $54
+ db $05, $14, $06, $14, $07, $14, $07, $54, $06, $54, $1f, $10, $37, $10, $06, $14, $07, $14, $07, $54, $06, $54, $05, $54
+ db $15, $14, $16, $14, $17, $14, $17, $54, $16, $54, $1f, $10, $37, $10, $16, $14, $17, $14, $17, $54, $16, $54, $15, $54
+ db $25, $14, $26, $14, $07, $14, $07, $54, $26, $54, $1f, $10, $37, $10, $26, $14, $07, $14, $07, $54, $26, $54, $25, $54
+ db $33, $14, $34, $14, $35, $14, $35, $54, $34, $54, $1f, $10, $37, $10, $34, $14, $35, $14, $35, $54, $34, $54, $33, $54
+ db $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $1f, $10, $37, $10, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14
+ db $02, $54, $01, $54, $07, $54, $07, $14, $07, $14, $1f, $10, $37, $10, $07, $14, $07, $14, $07, $14, $01, $14, $02, $14
+ db $12, $54, $11, $54, $10, $54, $07, $14, $07, $14, $1f, $10, $37, $10, $07, $14, $07, $14, $10, $14, $11, $14, $12, $14
+ db $22, $54, $21, $54, $20, $54, $07, $14, $07, $14, $1f, $10, $37, $10, $07, $14, $07, $14, $20, $14, $21, $14, $22, $14
+ db $32, $54, $31, $54, $30, $54, $07, $14, $07, $14, $1f, $10, $37, $10, $07, $14, $07, $14, $30, $14, $31, $14, $32, $14
+ db $06, $54, $05, $54, $04, $54, $07, $14, $07, $14, $1f, $10, $37, $10, $07, $14, $07, $14, $04, $14, $05, $14, $06, $14
+ db $16, $54, $15, $54, $14, $54, $07, $14, $07, $14, $1f, $10, $37, $10, $07, $14, $07, $14, $14, $14, $15, $14, $16, $14
+ db $26, $54, $25, $54, $24, $54, $07, $14, $07, $14, $1f, $10, $37, $10, $07, $14, $07, $14, $24, $14, $25, $14, $26, $14
+ db $34, $54, $33, $54, $07, $54, $07, $14, $07, $14, $1f, $10, $37, $10, $07, $14, $07, $14, $07, $14, $33, $14, $34, $14
+ db $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $1f, $10, $37, $10, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14
+ db $01, $14, $02, $14, $03, $14, $03, $54, $02, $54, $1f, $10, $37, $10, $02, $14, $03, $14, $03, $54, $02, $54, $01, $54
+ db $11, $14, $12, $14, $13, $14, $13, $54, $12, $54, $1f, $10, $37, $10, $12, $14, $13, $14, $13, $54, $12, $54, $11, $54
+ db $21, $14, $22, $14, $23, $14, $23, $54, $22, $54, $1f, $10, $37, $10, $22, $14, $23, $14, $23, $54, $22, $54, $21, $54
+ db $31, $14, $32, $14, $07, $14, $07, $14, $32, $54, $1f, $10, $37, $10, $32, $14, $07, $54, $07, $54, $32, $54, $31, $54
+ db $05, $14, $06, $14, $07, $14, $07, $54, $06, $54, $2e, $10, $2f, $10, $2f, $10, $2f, $10, $2f, $10, $2f, $10, $2f, $10, $2f, $10, $2f, $10, $2f, $10, $2f, $10, $2f, $10, $2f, $10, $2f, $10, $2f, $10, $2f, $10, $2f, $10, $2f, $10, $2f, $10, $2f, $10, $2f, $10, $2d, $10, $06, $14, $07, $14, $07, $54, $06, $54, $05, $54
+ db $15, $14, $16, $14, $17, $14, $17, $54, $16, $54, $15, $54, $14, $54, $07, $14, $07, $14, $39, $14, $0e, $14, $09, $14, $0f, $14, $28, $14, $07, $14, $19, $14, $0c, $14, $1c, $14, $29, $14, $2a, $14, $2b, $14, $2c, $14, $39, $14, $07, $14, $07, $14, $14, $14, $15, $14, $16, $14, $17, $14, $17, $54, $16, $54, $15, $54
+ db $25, $14, $26, $14, $07, $14, $07, $54, $26, $54, $25, $54, $24, $54, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $01, $14, $02, $14, $03, $14, $03, $54, $02, $54, $01, $54, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $24, $14, $25, $14, $26, $14, $07, $14, $07, $54, $26, $54, $25, $54
+ db $33, $14, $34, $14, $35, $14, $35, $54, $34, $54, $24, $54, $07, $54, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $10, $14, $11, $14, $12, $14, $13, $14, $13, $54, $12, $54, $11, $54, $10, $54, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $24, $14, $34, $14, $35, $14, $35, $54, $34, $54, $33, $54
+ db $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $20, $14, $21, $14, $22, $14, $23, $14, $23, $54, $22, $54, $21, $54, $20, $54, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14
SGBBorderPalettes:
RGB 24, 06, 06
@@ -1941,9 +1960,9 @@
ld a, [MapGroup]
ld l, a
ld h, 0
-rept 3
- add hl,hl
-endr
+ add hl, hl
+ add hl, hl
+ add hl, hl
ld de, RoofPals
add hl, de
ld a, [TimeOfDayPal]
@@ -2016,7 +2035,7 @@
RoofPals:
INCLUDE "tilesets/roof.pal"
-Palettes_b641:
+DiplomaPalettes:
RGB 27, 31, 27
RGB 21, 21, 21
RGB 13, 13, 13
--- a/engine/credits.asm
+++ b/engine/credits.asm
@@ -183,7 +183,7 @@
call ByteFill
ld a, rSCX - $ff00
- ld [hFFC6], a
+ ld [hLCDCPointer], a
call GetCreditsPalette
call SetPalettes
@@ -211,7 +211,7 @@
.exit_credits
call ClearBGPalettes
xor a
- ld [hFFC6], a
+ ld [hLCDCPointer], a
ld [hBGMapAddress], a
pop af
ld [hVBlank], a
@@ -258,9 +258,8 @@
ld e, a
ld d, 0
ld hl, .Jumptable
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -326,9 +325,8 @@
cp $30
jr c, Credits_LYOverride
ld a, [wCreditsLYOverride]
-rept 2
dec a
-endr
+ dec a
ld [wCreditsLYOverride], a
ld hl, LYOverrides + $1f
call .Fill
@@ -398,9 +396,8 @@
ld e, a
ld d, 0
ld hl, CreditsStrings
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld d, [hl]
ld e, a
@@ -741,9 +738,8 @@
ld [hl], a
ld a, [wCreditsBorderMon]
and 3
-rept 2
add a
-endr
+ add a
add e
add a
ld e, a
--- a/engine/crystal_intro.asm
+++ b/engine/crystal_intro.asm
@@ -13,7 +13,7 @@
ld a, $90
ld [hWY], a
call WaitBGMap
- ld b, SCGB_19
+ ld b, SCGB_GAMEFREAK_LOGO
call GetSGBLayout
call SetPalettes
ld c, 10
@@ -82,13 +82,13 @@
depixel 10, 11, 4, 0
ld a, SPRITE_ANIM_INDEX_GAMEFREAK_LOGO
call _InitSpriteAnimStruct
- ld hl, $7
+ ld hl, SPRITEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], $a0
- ld hl, $c
+ ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld [hl], $60
- ld hl, $d
+ ld hl, SPRITEANIMSTRUCT_0D
add hl, bc
ld [hl], $30
xor a
@@ -101,7 +101,7 @@
ld [hBGMapMode], a
ld a, $90
ld [hWY], a
- ld de, $e4e4
+ lb de, %11100100, %11100100
call DmgToCgbObjPals
ret
; e465e
@@ -120,9 +120,8 @@
ld e, a
ld d, 0
ld hl, .dw
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -213,14 +212,13 @@
GameFreakLogoJumper: ; e46ed (39:46ed)
- ld hl, SPRITEANIMSTRUCT_0B
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
ld e, [hl]
ld d, 0
ld hl, GameFreakLogoScenes
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -234,7 +232,7 @@
dw GameFreakLogoScene5
GameFreakLogoScene1: ; e4707 (39:4707)
- ld hl, SPRITEANIMSTRUCT_0B
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
inc [hl]
ret
@@ -275,7 +273,7 @@
ret
.asm_e4747
- ld hl, SPRITEANIMSTRUCT_0B
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
inc [hl]
ld hl, SPRITEANIMSTRUCT_0D
@@ -295,7 +293,7 @@
ret
.asm_e4764
- ld hl, SPRITEANIMSTRUCT_0B
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
inc [hl]
ld hl, SPRITEANIMSTRUCT_0D
@@ -317,9 +315,8 @@
ld e, a
ld d, $0
ld hl, GameFreakLogoPalettes
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [rSVBK]
push af
ld a, $5
@@ -335,7 +332,7 @@
ret
.asm_e47a3
- ld hl, SPRITEANIMSTRUCT_0B
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
inc [hl]
call PlaceGameFreakPresents_AdvanceIndex
@@ -436,9 +433,8 @@
ld e, a
ld d, 0
ld hl, IntroScenes
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -625,7 +621,7 @@
call ClearTileMap
xor a
ld [hBGMapMode], a
- ld [hFFC6], a
+ ld [hLCDCPointer], a
ld a, $1
ld [rVBK], a
ld hl, IntroTilemap005
@@ -819,7 +815,7 @@
IntroScene9: ; e4c04 (39:4c04)
; Set up the next scene (same bg).
xor a
- ld [hFFC6], a
+ ld [hLCDCPointer], a
call ClearSprites
hlcoord 0, 0, AttrMap
; first 12 rows have palette 1
@@ -893,7 +889,7 @@
call ClearTileMap
xor a
ld [hBGMapMode], a
- ld [hFFC6], a
+ ld [hLCDCPointer], a
ld a, $1
ld [rVBK], a
ld hl, IntroTilemap007
@@ -986,9 +982,8 @@
ret z
cp c
jr z, .playsound
-rept 2
inc hl
-endr
+ inc hl
jr .loop
.playsound
ld a, [hli]
@@ -1660,16 +1655,15 @@
ret
CrystalIntro_UnownFade: ; e5223 (39:5223)
-rept 3
add a
-endr
+ add a
+ add a
ld e, a
ld d, $0
ld hl, BGPals
add hl, de
-rept 2
inc hl
-endr
+ inc hl
ld a, [wcf65]
and $3f
cp $1f
@@ -1698,9 +1692,8 @@
push hl
ld hl, .BWFade
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld d, [hl]
ld e, a
@@ -1712,9 +1705,8 @@
push hl
ld hl, .BlackLBlueFade
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld d, [hl]
ld e, a
@@ -1726,9 +1718,8 @@
push hl
ld hl, .BlackBlueFade
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld d, [hl]
ld e, a
@@ -1786,9 +1777,9 @@
.got_pointer
ld a, [wcf65]
and $7
-rept 3
add a
-endr
+ add a
+ add a
ld c, a
ld a, [rSVBK]
push af
@@ -1844,9 +1835,9 @@
; e539d
Intro_FadeUnownWordPals: ; e539d (39:539d)
-rept 3
add a
-endr
+ add a
+ add a
ld e, a
ld d, $0
ld hl, BGPals
@@ -2102,8 +2093,8 @@
pop af
ld [rSVBK], a
- ld a, $43
- ld [hFFC6], a
+ ld a, rSCX - $ff00
+ ld [hLCDCPointer], a
ret
Intro_PerspectiveScrollBG: ; e552f (39:552f)
@@ -2127,9 +2118,8 @@
; grass in the front
ld hl, LYOverrides + $5f
ld a, [hl]
-rept 2
inc a
-endr
+ inc a
ld bc, $31
call ByteFill
ld a, [LYOverrides + 0]
--- a/engine/debug.asm
+++ b/engine/debug.asm
@@ -300,9 +300,8 @@
ld e, a
ld d, 0
ld hl, Jumptable_81acf
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -482,9 +481,8 @@
inc a
ld l, a
ld h, $0
-rept 2
add hl, hl
-endr
+ add hl, hl
ld de, OverworldMap
add hl, de
ld de, wc608
@@ -558,9 +556,8 @@
ld a, [wc608 + 3]
ld [hli], a
xor a
-rept 2
ld [hli], a
-endr
+ ld [hli], a
ld [hl], a
ld hl, wSGBPals
call Function81f0c
@@ -576,9 +573,9 @@
; 81ca7
Function81ca7: ; 81ca7
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
ld a, [de]
call Function81cbc
ld a, [de]
@@ -609,9 +606,8 @@
ld e, a
ld d, 0
ld hl, Jumptable_81d02
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -855,9 +851,8 @@
Function81e55: ; 81e55
cp $32
jr c, .asm_81e5b
-rept 2
inc a
-endr
+ inc a
.asm_81e5b
add $bf
@@ -938,9 +933,8 @@
inc a
ld l, a
ld h, $0
-rept 2
add hl, hl
-endr
+ add hl, hl
ld de, OverworldMap
add hl, de
ld e, l
@@ -970,9 +964,8 @@
inc de
ld [hli], a
xor a
-rept 2
ld [hli], a
-endr
+ ld [hli], a
dec c
jr nz, .asm_81ee3
ret
@@ -1108,9 +1101,8 @@
ld a, b
ld [hli], a
ld a, [de]
-rept 2
add a
-endr
+ add a
add $18
ld [hli], a
xor a
@@ -1241,9 +1233,9 @@
ld a, [wcf64]
ld l, a
ld h, $0
-rept 3
add hl, hl
-endr
+ add hl, hl
+ add hl, hl
ld de, UnknBGPals
add hl, de
ld de, wc608
@@ -1356,9 +1348,8 @@
ld e, a
ld d, 0
ld hl, .dw
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -1400,9 +1391,8 @@
ld e, a
ld d, $0
ld hl, wc608
-rept 2
add hl, de
-endr
+ add hl, de
ld e, l
ld d, h
call Function81ea5
@@ -1500,9 +1490,8 @@
ld c, a
ld b, $0
ld hl, wc608
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, e
ld [hli], a
ld [hl], d
--- /dev/null
+++ b/engine/delete_save_change_clock.asm
@@ -1,0 +1,298 @@
+_ResetClock: ; 4d3b1
+ callba BlankScreen
+ ld b, SCGB_DIPLOMA
+ call GetSGBLayout
+ call LoadStandardFont
+ call LoadFontsExtra
+ ld de, MUSIC_MAIN_MENU
+ call PlayMusic
+ ld hl, .text_askreset
+ call PrintText
+ ld hl, .NoYes_MenuDataHeader
+ call CopyMenuDataHeader
+ call VerticalMenu
+ ret c
+ ld a, [wMenuCursorY]
+ cp $1
+ ret z
+ call ClockResetPassword
+ jr c, .wrongpassword
+ ld a, BANK(sRTCStatusFlags)
+ call GetSRAMBank
+ ld a, $80
+ ld [sRTCStatusFlags], a
+ call CloseSRAM
+ ld hl, .text_okay
+ call PrintText
+ ret
+
+.wrongpassword
+ ld hl, .text_wrong
+ call PrintText
+ ret
+
+.text_okay ; 0x4d3fe
+ ; Password OK. Select CONTINUE & reset settings.
+ text_jump UnknownText_0x1c55db
+ db "@"
+
+.text_wrong ; 0x4d403
+ ; Wrong password!
+ text_jump UnknownText_0x1c560b
+ db "@"
+
+.text_askreset ; 0x4d408
+ ; Reset the clock?
+ text_jump UnknownText_0x1c561c
+ db "@"
+
+.NoYes_MenuDataHeader: ; 0x4d40d
+ db $00 ; flags
+ db 07, 14 ; start coords
+ db 11, 19 ; end coords
+ dw .NoYes_MenuData2
+ db 1 ; default option
+
+.NoYes_MenuData2: ; 0x4d415
+ db $c0 ; flags
+ db 2 ; items
+ db "NO@"
+ db "YES@"
+
+ClockResetPassword: ; 4d41e
+ call .CalculatePassword
+ push de
+ ld hl, StringBuffer2
+ ld bc, 5
+ xor a
+ call ByteFill
+ ld a, $4
+ ld [StringBuffer2 + 5], a
+ ld hl, .pleaseenterpasswordtext
+ call PrintText
+.loop
+ call .updateIDdisplay
+.loop2
+ call JoyTextDelay
+ ld a, [hJoyLast]
+ ld b, a
+ and A_BUTTON
+ jr nz, .confirm
+ ld a, b
+ and D_PAD
+ jr z, .loop2
+ call .dpadinput
+ ld c, 3
+ call DelayFrames
+ jr .loop
+
+.confirm
+ call .ConvertDecIDToBytes
+ pop de
+ ld a, e
+ cp l
+ jr nz, .nope
+ ld a, d
+ cp h
+ jr nz, .nope
+ and a
+ ret
+
+.nope
+ scf
+ ret
+
+.pleaseenterpasswordtext ; 0x4d463
+ ; Please enter the password.
+ text_jump UnknownText_0x1c562e
+ db "@"
+
+.updateIDdisplay ; 4d468
+ hlcoord 14, 15
+ ld de, StringBuffer2
+ ld c, 5
+.loop3
+ ld a, [de]
+ add "0"
+ ld [hli], a
+ inc de
+ dec c
+ jr nz, .loop3
+ hlcoord 14, 16
+ ld bc, 5
+ ld a, " "
+ call ByteFill
+ hlcoord 14, 16
+ ld a, [StringBuffer2 + 5]
+ ld e, a
+ ld d, $0
+ add hl, de
+ ld [hl], $61
+ ret
+
+.dpadinput ; 4d490
+ ld a, b
+ and D_LEFT
+ jr nz, .left
+ ld a, b
+ and D_RIGHT
+ jr nz, .right
+ ld a, b
+ and D_UP
+ jr nz, .up
+ ld a, b
+ and D_DOWN
+ jr nz, .down
+ ret
+
+.left
+ ld a, [StringBuffer2 + 5]
+ and a
+ ret z
+ dec a
+ ld [StringBuffer2 + 5], a
+ ret
+
+.right
+ ld a, [StringBuffer2 + 5]
+ cp $4
+ ret z
+ inc a
+ ld [StringBuffer2 + 5], a
+ ret
+
+.up
+ call .getcurrentdigit
+ ld a, [hl]
+ cp 9
+ jr z, .wraparound_up
+ inc a
+ ld [hl], a
+ ret
+
+.wraparound_up
+ ld [hl], $0
+ ret
+
+.down
+ call .getcurrentdigit
+ ld a, [hl]
+ and a
+ jr z, .wraparound_down
+ dec a
+ ld [hl], a
+ ret
+
+.wraparound_down
+ ld [hl], 9
+ ret
+
+.getcurrentdigit ; 4d4d5
+ ld a, [StringBuffer2 + 5]
+ ld e, a
+ ld d, $0
+ ld hl, StringBuffer2
+ add hl, de
+ ret
+
+.ConvertDecIDToBytes: ; 4d4e0
+ ld hl, 0
+ ld de, StringBuffer2 + 4
+ ld bc, 1
+ call .ConvertToBytes
+ ld bc, 10
+ call .ConvertToBytes
+ ld bc, 100
+ call .ConvertToBytes
+ ld bc, 1000
+ call .ConvertToBytes
+ ld bc, 10000
+.ConvertToBytes: ; 4d501
+ ld a, [de]
+ dec de
+ push hl
+ ld hl, 0
+ call AddNTimes
+ ld c, l
+ ld b, h
+ pop hl
+ add hl, bc
+ ret
+
+.CalculatePassword: ; 4d50f
+ ld a, BANK(sPlayerData)
+ call GetSRAMBank
+ ld de, 0
+ ld hl, sPlayerData + (PlayerID - wPlayerData)
+ ld c, $2
+ call .ComponentFromNumber
+ ld hl, sPlayerData + (PlayerName - wPlayerData)
+ ld c, $5 ; PLAYER_NAME_LENGTH_J
+ call .ComponentFromString
+ ld hl, sPlayerData + (Money - wPlayerData)
+ ld c, $3
+ call .ComponentFromNumber
+ call CloseSRAM
+ ret
+
+.ComponentFromNumber: ; 4d533
+ ld a, [hli]
+ add e
+ ld e, a
+ ld a, $0
+ adc d
+ ld d, a
+ dec c
+ jr nz, .ComponentFromNumber
+ ret
+
+.ComponentFromString: ; 4d53e
+ ld a, [hli]
+ cp "@"
+ ret z
+ add e
+ ld e, a
+ ld a, $0
+ adc d
+ ld d, a
+ dec c
+ jr nz, .ComponentFromString
+ ret
+
+_DeleteSaveData: ; 4d54c
+ callba BlankScreen
+ ld b, SCGB_DIPLOMA
+ call GetSGBLayout
+ call LoadStandardFont
+ call LoadFontsExtra
+ ld de, MUSIC_MAIN_MENU
+ call PlayMusic
+ ld hl, .Text_ClearAllSaveData
+ call PrintText
+ ld hl, .NoYesMenuDataHeader
+ call CopyMenuDataHeader
+ call VerticalMenu
+ ret c
+ ld a, [wMenuCursorY]
+ cp $1
+ ret z
+ callba EmptyAllSRAMBanks
+ ret
+
+.Text_ClearAllSaveData: ; 0x4d580
+ ; Clear all save data?
+ text_jump UnknownText_0x1c564a
+ db "@"
+
+.NoYesMenuDataHeader: ; 0x4d585
+ db $00 ; flags
+ db 07, 14 ; start coords
+ db 11, 19 ; end coords
+ dw .MenuData2
+ db 1 ; default option
+
+.MenuData2: ; 0x4d58d
+ db $c0 ; flags
+ db 2 ; items
+ db "NO@"
+ db "YES@"
--- a/engine/diploma.asm
+++ b/engine/diploma.asm
@@ -1,37 +1,37 @@
_Diploma: ; 1dd702
- call Function1dd709
+ call PlaceDiplomaOnScreen
call WaitPressAorB_BlinkCursor
ret
; 1dd709
-Function1dd709: ; 1dd709
+PlaceDiplomaOnScreen: ; 1dd709
call ClearBGPalettes
call ClearTileMap
call ClearSprites
call DisableLCD
- ld hl, LZ_1dd805
+ ld hl, DiplomaGFX
ld de, VTiles2
call Decompress
- ld hl, Tilemap_1ddc4b
+ ld hl, DiplomaPage1Tilemap
decoord 0, 0
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
call CopyBytes
- ld de, String_1dd760
+ ld de, .Player
hlcoord 2, 5
call PlaceString
- ld de, String_1dd767
+ ld de, .EmptyString
hlcoord 15, 5
call PlaceString
ld de, PlayerName
hlcoord 9, 5
call PlaceString
- ld de, String_1dd768
+ ld de, .Certification
hlcoord 2, 8
call PlaceString
call EnableLCD
call WaitBGMap
- ld b, SCGB_08
+ ld b, SCGB_DIPLOMA
call GetSGBLayout
call SetPalettes
call DelayFrame
@@ -38,13 +38,13 @@
ret
; 1dd760
-String_1dd760:
+.Player:
db "PLAYER@"
-String_1dd767:
+.EmptyString:
db "@"
-String_1dd768:
+.Certification:
db "This certifies"
next "that you have"
next "completed the"
@@ -53,19 +53,19 @@
db "@"
; 1dd7ae
-Function1dd7ae: ; 1dd7ae
+PrintDiplomaPage2: ; 1dd7ae
hlcoord 0, 0
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
ld a, $7f
call ByteFill
- ld hl, Tilemap_1dddb3
+ ld hl, DiplomaPage2Tilemap
decoord 0, 0
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
call CopyBytes
- ld de, String_1dd7fa
+ ld de, .GameFreak
hlcoord 8, 0
call PlaceString
- ld de, String_1dd7f0
+ ld de, .PlayTime
hlcoord 3, 15
call PlaceString
hlcoord 12, 15
@@ -72,7 +72,7 @@
ld de, GameTimeHours
lb bc, 2, 4
call PrintNum
- ld [hl], $67
+ ld [hl], $67 ; colon
inc hl
ld de, GameTimeMinutes
lb bc, PRINTNUM_LEADINGZEROS | 1, 2
@@ -80,15 +80,15 @@
ret
; 1dd7f0
-String_1dd7f0: db "PLAY TIME@"
-String_1dd7fa: db "GAME FREAK@"
+.PlayTime: db "PLAY TIME@"
+.GameFreak: db "GAME FREAK@"
; 1dd805
-LZ_1dd805: ; 1dd805
+DiplomaGFX: ; 1dd805
INCBIN "gfx/unknown/1dd805.2bpp.lz"
-Tilemap_1ddc4b: ; 1ddc4b
+DiplomaPage1Tilemap: ; 1ddc4b
INCBIN "gfx/unknown/1ddc4b.tilemap"
-Tilemap_1dddb3: ; 1dddb3
+DiplomaPage2Tilemap: ; 1dddb3
INCBIN "gfx/unknown/1dddb3.tilemap"
--- a/engine/dummy_game.asm
+++ b/engine/dummy_game.asm
@@ -8,7 +8,7 @@
.LoadGFXAndPals:
call DisableLCD
- ld b, SCGB_08
+ ld b, SCGB_DIPLOMA
call GetSGBLayout
callab ClearSpriteAnims
ld hl, LZ_e2221
--- a/engine/events.asm
+++ b/engine/events.asm
@@ -167,10 +167,10 @@
cp 2 ; HandleMap
ret nz
- call Function967d1
+ call HandleMapObjects
call NextOverworldFrame
- call Function967e1
- call Function967f4
+ call HandleMapBackground
+ call CheckPlayerState
ret
; 96795
@@ -226,7 +226,7 @@
ret
; 967d1
-Function967d1: ; 967d1
+HandleMapObjects: ; 967d1
callba HandleNPCStep ; engine/map_objects.asm
callba _HandlePlayerStep
call _CheckObjectEnteringVisibleRange
@@ -233,7 +233,7 @@
ret
; 967e1
-Function967e1: ; 967e1
+HandleMapBackground: ; 967e1
callba _UpdateSprites
callba ScrollScreen
callba PlaceMapNameSign
@@ -240,7 +240,7 @@
ret
; 967f4
-Function967f4: ; 967f4
+CheckPlayerState: ; 967f4
ld a, [wPlayerStepFlags]
bit 5, a ; in the middle of step
jr z, .events
@@ -547,7 +547,7 @@
.Action:
push af
- callba Function80422
+ callba StopPlayerForEvent
pop af
scf
ret
@@ -1030,9 +1030,9 @@
ld c, a
ld b, 0
ld hl, PlayerEventScriptPointers
-rept 3
add hl, bc
-endr
+ add hl, bc
+ add hl, bc
ld a, [hli]
ld [ScriptBank], a
ld a, [hli]
--- a/engine/events_2.asm
+++ b/engine/events_2.asm
@@ -458,10 +458,10 @@
.okay
ld e, a
ld d, 0
- ld hl, .Jumptable_ba
-rept 3
+ ld hl, .Jumptable
add hl, de
-endr
+ add hl, de
+ add hl, de
ld a, [hli]
push af
ld a, [hli]
@@ -472,7 +472,7 @@
ret
; 97e94
-.Jumptable_ba: ; 97e94
+.Jumptable: ; 97e94
dba CmdQueue_Null
dba CmdQueue_Null2
dba CmdQueue_StoneTable
@@ -531,9 +531,9 @@
ld a, [hl]
dec a
ld [hl], a
- jr z, .asm_97eee
+ jr z, .finish
and $1
- jr z, .asm_97ee4
+ jr z, .add
ld hl, 2
add hl, bc
ld a, [hSCY]
@@ -541,7 +541,7 @@
ld [hSCY], a
ret
-.asm_97ee4
+.add
ld hl, 2
add hl, bc
ld a, [hSCY]
@@ -549,7 +549,7 @@
ld [hSCY], a
ret
-.asm_97eee
+.finish
ld hl, 4
add hl, bc
ld a, [hl]
--- a/engine/events_3.asm
+++ b/engine/events_3.asm
@@ -45,7 +45,7 @@
ld [wLandmarkSignTimer], a
call LoadMapNameSignGFX
call InitMapNameFrame
- callba Function104303
+ callba HDMATransfer_OnlyTopFourRows
ret
.dont_do_map_sign
@@ -55,7 +55,7 @@
ld [rWY], a
ld [hWY], a
xor a
- ld [hFFC6], a
+ ld [hLCDCPointer], a
ret
; b8064
@@ -65,7 +65,7 @@
ld a, [wPreviousLandmark]
cp c
ret z
- cp $0
+ cp SPECIAL_MAP
ret
; b8070
@@ -113,7 +113,7 @@
jr nz, .skip2
call InitMapNameFrame
call PlaceMapNameCenterAlign
- callba Function104303
+ callba HDMATransfer_OnlyTopFourRows
.skip2
ld a, $80
ld a, $70
@@ -126,7 +126,7 @@
ld [rWY], a
ld [hWY], a
xor a
- ld [hFFC6], a
+ ld [hLCDCPointer], a
ret
@@ -184,12 +184,10 @@
InitMapSignAttrMap: ; b8115
ld de, AttrMap - TileMap
add hl, de
-rept 2
inc b
-endr
-rept 2
+ inc b
inc c
-endr
+ inc c
ld a, $87
.loop
push bc
@@ -261,15 +259,13 @@
jr .enterloop
.continueloop
-rept 2
ld [hli], a
-endr
+ ld [hli], a
.enterloop
inc a
-rept 2
ld [hli], a
-endr
+ ld [hli], a
dec a
dec c
jr nz, .continueloop
@@ -280,13 +276,13 @@
; Checks to see if there are hidden items on the screen that have not yet been found. If it finds one, returns carry.
call GetMapScriptHeaderBank
ld [Buffer1], a
-; Get the coordinate of the bottom right corner of the screen, and load it in wd1ec/wd1ed.
+; Get the coordinate of the bottom right corner of the screen, and load it in Buffer3/Buffer4.
ld a, [XCoord]
add SCREEN_WIDTH / 4
- ld [wd1ed], a
+ ld [Buffer4], a
ld a, [YCoord]
add SCREEN_HEIGHT / 4
- ld [wd1ec], a
+ ld [Buffer3], a
; Get the pointer for the first signpost header in the map...
ld hl, wCurrentMapSignpostHeaderPointer
ld a, [hli]
@@ -305,7 +301,7 @@
call .GetFarByte
ld e, a
; Is the Y coordinate of the signpost on the screen? If not, go to the next signpost.
- ld a, [wd1ec]
+ ld a, [Buffer3]
sub e
jr c, .next
cp SCREEN_HEIGHT / 2
@@ -313,7 +309,7 @@
; Is the X coordinate of the signpost on the screen? If not, go to the next signpost.
call .GetFarByte
ld d, a
- ld a, [wd1ed]
+ ld a, [Buffer4]
sub d
jr c, .next
cp SCREEN_WIDTH / 2
@@ -522,9 +518,8 @@
ld e, a
ld d, 0
ld hl, TreeMons
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
@@ -709,9 +704,9 @@
.loop
sub [hl]
jr c, .ok
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
jr .loop
.ok
--- a/engine/evolution_animation.asm
+++ b/engine/evolution_animation.asm
@@ -21,7 +21,7 @@
pop de
pop hl
- ld a, [Buffer4]
+ ld a, [wEvolutionCanceled]
and a
ret z
@@ -30,7 +30,7 @@
; 4e607
.EvolutionAnimation: ; 4e607
- ld a, $e4
+ ld a, %11100100
ld [rOBP0], a
ld de, MUSIC_NONE
@@ -48,12 +48,12 @@
call WaitBGMap
xor a
ld [hBGMapMode], a
- ld a, [Buffer1]
+ ld a, [wEvolutionOldSpecies]
ld [PlayerHPPal], a
ld c, $0
call .GetSGBLayout
- ld a, [Buffer1]
+ ld a, [wEvolutionOldSpecies]
ld [CurPartySpecies], a
ld [CurSpecies], a
call .PlaceFrontpic
@@ -60,17 +60,17 @@
ld de, VTiles2
ld hl, VTiles2 tile $31
- ld bc, $31
+ ld bc, 7 * 7
call Request2bpp
- ld a, $31
- ld [wd1ec], a
+ ld a, 7 * 7
+ ld [wEvolutionPicOffset], a
call .ReplaceFrontpic
- ld a, [Buffer2]
+ ld a, [wEvolutionNewSpecies]
ld [CurPartySpecies], a
ld [CurSpecies], a
call .LoadFrontpic
- ld a, [Buffer1]
+ ld a, [wEvolutionOldSpecies]
ld [CurPartySpecies], a
ld [CurSpecies], a
@@ -79,7 +79,7 @@
call .check_statused
jr c, .skip_cry
- ld a, [Buffer1]
+ ld a, [wEvolutionOldSpecies]
call PlayCry
.skip_cry
@@ -95,13 +95,12 @@
jr c, .cancel_evo
ld a, -7 * 7
- ld [wd1ec], a
-
+ ld [wEvolutionPicOffset], a
call .ReplaceFrontpic
xor a
- ld [Buffer4], a
+ ld [wEvolutionCanceled], a
- ld a, [Buffer2]
+ ld a, [wEvolutionNewSpecies]
ld [PlayerHPPal], a
ld c, $0
@@ -136,9 +135,9 @@
.cancel_evo
ld a, $1
- ld [Buffer4], a
+ ld [wEvolutionCanceled], a
- ld a, [Buffer1]
+ ld a, [wEvolutionOldSpecies]
ld [PlayerHPPal], a
ld c, $0
@@ -154,7 +153,7 @@
; 4e703
.GetSGBLayout: ; 4e703
- ld b, SCGB_0B
+ ld b, SCGB_EVOLUTION
jp GetSGBLayout
; 4e708
@@ -187,9 +186,8 @@
call .Flash
pop bc
inc b
-rept 2
dec c
-endr
+ dec c
jr nz, .loop
and a
ret
@@ -201,10 +199,10 @@
.Flash: ; 4e741
ld a, -7 * 7 ; new stage
- ld [wd1ec], a
+ ld [wEvolutionPicOffset], a
call .ReplaceFrontpic
ld a, 7 * 7 ; previous stage
- ld [wd1ec], a
+ ld [wEvolutionPicOffset], a
call .ReplaceFrontpic
dec b
jr nz, .Flash
@@ -221,7 +219,7 @@
.loop1
push bc
.loop2
- ld a, [wd1ec]
+ ld a, [wEvolutionPicOffset]
add [hl]
ld [hli], a
dec c
@@ -270,7 +268,7 @@
; 4e7a6
.PlayEvolvedSFX: ; 4e7a6
- ld a, [Buffer4]
+ ld a, [wEvolutionCanceled]
and a
ret nz
ld de, SFX_EVOLVED
@@ -320,7 +318,7 @@
depixel 9, 11
ld a, SPRITE_ANIM_INDEX_13
call _InitSpriteAnimStruct
- ld hl, SPRITEANIMSTRUCT_0B
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
ld a, [wJumptableIndex]
and %1110
@@ -344,9 +342,8 @@
ld a, [hVBlankCounter]
and %1110
srl a
-rept 2
inc a
-endr
+ inc a
and $7
ld b, a
ld hl, Sprites + 3 ; attributes
@@ -355,9 +352,9 @@
ld a, [hl]
or b
ld [hli], a
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
dec c
jr nz, .loop6
pop bc
--- a/engine/evolve.asm
+++ b/engine/evolve.asm
@@ -29,7 +29,7 @@
cp $ff
jp z, .ReturnToMap
- ld [Buffer1], a
+ ld [wEvolutionOldSpecies], a
push hl
ld a, [CurPartyMon]
@@ -41,14 +41,13 @@
and a
jp z, EvolveAfterBattle_MasterLoop
- ld a, [Buffer1]
+ ld a, [wEvolutionOldSpecies]
dec a
ld b, 0
ld c, a
ld hl, EvosAttacksPointers
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
@@ -205,7 +204,7 @@
push hl
ld a, [hl]
- ld [Buffer2], a
+ ld [wEvolutionNewSpecies], a
ld a, [CurPartyMon]
ld hl, PartyMonNicknames
call GetNick
@@ -241,7 +240,7 @@
ld a, [hl]
ld [CurSpecies], a
ld [TempMonSpecies], a
- ld [Buffer2], a
+ ld [wEvolutionNewSpecies], a
ld [wd265], a
call GetPokemonName
@@ -437,9 +436,8 @@
ld b, 0
ld c, a
ld hl, EvosAttacksPointers
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
@@ -532,7 +530,7 @@
ld a, [CurPartyLevel]
cp b
jp c, .done
- ld a, [Buffer1]
+ ld a, [wEvolutionOldSpecies]
and a
jr z, .CheckMove
ld a, [wd002]
@@ -565,7 +563,7 @@
ld h, d
ld l, e
call ShiftMoves
- ld a, [Buffer1]
+ ld a, [wEvolutionOldSpecies]
and a
jr z, .ShiftedMove
push de
@@ -582,7 +580,7 @@
.LearnMove:
ld a, [hl]
ld [de], a
- ld a, [Buffer1]
+ ld a, [wEvolutionOldSpecies]
and a
jr z, .NextMove
push hl
@@ -638,9 +636,8 @@
.loop ; For each Pokemon...
ld hl, EvosAttacksPointers
ld b, 0
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
--- a/engine/fish.asm
+++ b/engine/fish.asm
@@ -38,9 +38,8 @@
inc hl
ld e, b
ld d, 0
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -51,9 +50,9 @@
cp [hl]
jr z, .ok
jr c, .ok
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
jr .loop
.ok
inc hl
@@ -84,9 +83,8 @@
and 3
cp NITE
jr c, .time_species
-rept 2
inc hl
-endr
+ inc hl
.time_species
ld d, [hl]
--- a/engine/fruit_trees.asm
+++ b/engine/fruit_trees.asm
@@ -66,9 +66,9 @@
ResetFruitTrees: ; 4406a
xor a
ld hl, FruitTreeFlags
-rept 3
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
ld [hl], a
ld hl, DailyFlags
set 4, [hl]
--- a/engine/healmachineanim.asm
+++ b/engine/healmachineanim.asm
@@ -25,9 +25,8 @@
ld e, a
ld d, 0
ld hl, .Pointers
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -219,9 +218,9 @@
ld [hld], a
ld a, e
ld [hli], a
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
dec c
jr nz, .palette_loop_2
pop de
--- a/engine/intro_menu.asm
+++ b/engine/intro_menu.asm
@@ -140,7 +140,7 @@
ld [wSecretID + 1], a
ld hl, PartyCount
- call InitList
+ call .InitList
xor a
ld [wCurBox], a
@@ -151,20 +151,20 @@
ld a, BANK(sBoxCount)
call GetSRAMBank
ld hl, sBoxCount
- call InitList
+ call .InitList
call CloseSRAM
ld hl, NumItems
- call InitList
+ call .InitList
ld hl, NumKeyItems
- call InitList
+ call .InitList
ld hl, NumBalls
- call InitList
+ call .InitList
ld hl, PCItems
- call InitList
+ call .InitList
xor a
ld [wRoamMon1Species], a
@@ -232,7 +232,7 @@
ret
; 5ca1
-InitList: ; 5ca1
+.InitList: ; 5ca1
; Loads 0 in the count and -1 in the first item or mon slot.
xor a
ld [hli], a
@@ -688,7 +688,7 @@
ld [TrainerClass], a
call Intro_PrepTrainerPic
- ld b, SCGB_FRONTPICPALS
+ ld b, SCGB_TRAINER_OR_MON_FRONTPIC_PALS
call GetSGBLayout
call Intro_RotatePalettesLeftFrontpic
@@ -709,7 +709,7 @@
ld [TempMonDVs], a
ld [TempMonDVs + 1], a
- ld b, SCGB_FRONTPICPALS
+ ld b, SCGB_TRAINER_OR_MON_FRONTPIC_PALS
call GetSGBLayout
call Intro_WipeInFrontpic
@@ -726,7 +726,7 @@
ld [TrainerClass], a
call Intro_PrepTrainerPic
- ld b, SCGB_FRONTPICPALS
+ ld b, SCGB_TRAINER_OR_MON_FRONTPIC_PALS
call GetSGBLayout
call Intro_RotatePalettesLeftFrontpic
@@ -739,7 +739,7 @@
ld [CurPartySpecies], a
callba DrawIntroPlayerPic
- ld b, SCGB_FRONTPICPALS
+ ld b, SCGB_TRAINER_OR_MON_FRONTPIC_PALS
call GetSGBLayout
call Intro_RotatePalettesLeftFrontpic
@@ -809,7 +809,7 @@
ld [CurPartySpecies], a
callba DrawIntroPlayerPic
- ld b, SCGB_FRONTPICPALS
+ ld b, SCGB_TRAINER_OR_MON_FRONTPIC_PALS
call GetSGBLayout
call RotateThreePalettesLeft
@@ -1041,7 +1041,7 @@
call ClearScreen
call WaitBGMap2
xor a
- ld [hFFC6], a
+ ld [hLCDCPointer], a
ld [hSCX], a
ld [hSCY], a
ld a, $7
@@ -1048,7 +1048,7 @@
ld [hWX], a
ld a, $90
ld [hWY], a
- ld b, SCGB_08
+ ld b, SCGB_DIPLOMA
call GetSGBLayout
call UpdateTimePals
ld a, [wcf64]
@@ -1172,7 +1172,7 @@
ld hl, wJumptableIndex
inc [hl]
xor a
- ld [hFFC6], a
+ ld [hLCDCPointer], a
; Play the title screen music.
ld de, MUSIC_TITLE
--- a/engine/landmarks.asm
+++ b/engine/landmarks.asm
@@ -3,9 +3,8 @@
push hl
ld l, e
ld h, 0
-rept 2
add hl, hl
-endr
+ add hl, hl
ld de, Landmarks
add hl, de
ld a, [hli]
@@ -24,9 +23,8 @@
ld l, e
ld h, 0
-rept 2
add hl, hl
-endr
+ add hl, hl
ld de, Landmarks + 2
add hl, de
ld a, [hli]
--- a/engine/link.asm
+++ b/engine/link.asm
@@ -25,7 +25,7 @@
hlcoord 4, 10
ld de, String_PleaseWait
call PlaceString
- call Function28eff
+ call SetTradeRoomBGPals
call WaitBGMap2
ld hl, wcf5d
xor a
@@ -41,7 +41,7 @@
call FixDataForLinkTransfer
xor a
ld [wPlayerLinkAction], a
- call Function87d
+ call WaitLinkTransfer
ld a, [hLinkPlayerNumber]
cp $2
jr nz, .player_1
@@ -163,9 +163,9 @@
ld hl, wTimeCapsulePartyMon1Species
call Function2868a
ld a, OTPartyMonOT % $100
- ld [wd102], a
+ ld [wUnusedD102], a
ld a, OTPartyMonOT / $100
- ld [wd103], a
+ ld [wUnusedD102 + 1], a
ld de, MUSIC_NONE
call PlayMusic
ld a, [hLinkPlayerNumber]
@@ -404,9 +404,9 @@
ld bc, OTPartyDataEnd - OTPartyMons
call CopyBytes
ld a, OTPartyMonOT % $100
- ld [wd102], a
+ ld [wUnusedD102], a
ld a, OTPartyMonOT / $100
- ld [wd103], a
+ ld [wUnusedD102 + 1], a
ld de, MUSIC_NONE
call PlayMusic
ld a, [hLinkPlayerNumber]
@@ -431,10 +431,12 @@
ld bc, NAME_LENGTH
call CopyBytes
call ReturnToMapFromSubmenu
- ld a, [wc2d7]
+
+ ; LET'S DO THIS
+ ld a, [wDisableTextAcceleration]
push af
- ld a, $1
- ld [wc2d7], a
+ ld a, 1
+ ld [wDisableTextAcceleration], a
ld a, [rIE]
push af
ld a, [rIF]
@@ -446,7 +448,9 @@
ld [rIE], a
pop af
ld [rIF], a
+
predef StartBattle
+
ld a, [rIF]
ld h, a
xor a
@@ -456,7 +460,7 @@
ld a, h
ld [rIF], a
pop af
- ld [wc2d7], a
+ ld [wDisableTextAcceleration], a
pop af
ld [Options], a
callba LoadPokemonData
@@ -491,10 +495,10 @@
pop de
pop hl
bccoord 1, 14
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
call RotateThreePalettesRight
call ClearScreen
- ld b, SCGB_08
+ ld b, SCGB_DIPLOMA
call GetSGBLayout
call WaitBGMap2
ret
@@ -575,9 +579,9 @@
jr nz, .loop2
ld hl, wMisc
ld a, $fd
-rept 3
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
ld b, $c8
xor a
.loop3
@@ -1094,14 +1098,12 @@
ld a, $46
ld [hli], a
xor a
-rept 2
ld [hli], a
-endr
+ ld [hli], a
ld [hl], a
pop hl
-rept 2
inc de
-endr
+ inc de
ret
; 28771
@@ -1211,9 +1213,9 @@
callba InitTradeSpeciesList
xor a
ld hl, wOtherPlayerLinkMode
-rept 3
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
ld [hl], a
ld a, 1
ld [wMenuCursorY], a
@@ -1252,8 +1254,8 @@
bit A_BUTTON_F, a
jr z, .not_a_button
ld a, $1
- ld [wd263], a
- callab Function50db9
+ ld [wInitListType], a
+ callab InitList
ld hl, OTPartyMon1Species
callba LinkMonStatsScreen
jp LinkTradePartiesMenuMasterLoop
@@ -1445,8 +1447,8 @@
pop af
ld [wMenuCursorY], a
ld a, $4
- ld [wd263], a
- callab Function50db9
+ ld [wInitListType], a
+ callab InitList
callba LinkMonStatsScreen
call Call_LoadTempTileMapToTileMap
hlcoord 6, 1
@@ -1488,7 +1490,7 @@
callba Link_WaitBGMap
ld hl, .Text_CantTradeLastMon
bccoord 1, 14
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
jr .cancel_trade
.abnormal
@@ -1510,7 +1512,7 @@
callba Link_WaitBGMap
ld hl, .Text_Abnormal
bccoord 1, 14
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
.cancel_trade
hlcoord 0, 12
@@ -1595,7 +1597,7 @@
Function28b22: ; 28b22
call RotateThreePalettesRight
call ClearScreen
- ld b, SCGB_08
+ ld b, SCGB_DIPLOMA
call GetSGBLayout
call WaitBGMap2
xor a
@@ -1686,7 +1688,7 @@
call GetPokemonName
ld hl, UnknownText_0x28eb8
bccoord 1, 14
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
call LoadStandardMenuDataHeader
hlcoord 10, 7
ld b, 3
@@ -1900,7 +1902,7 @@
call DelayFrames
call ClearTileMap
call LoadFontsBattleExtra
- ld b, SCGB_08
+ ld b, SCGB_DIPLOMA
call GetSGBLayout
ld a, [hLinkPlayerNumber]
cp $1
@@ -1934,26 +1936,26 @@
callab EvolvePokemon
call ClearScreen
call LoadTradeScreenBorder
- call Function28eff
+ call SetTradeRoomBGPals
callba Link_WaitBGMap
ld b, $1
pop af
ld c, a
cp MEW
- jr z, .asm_28e49
+ jr z, .loop
ld a, [CurPartySpecies]
cp MEW
- jr z, .asm_28e49
+ jr z, .loop
ld b, $2
ld a, c
cp CELEBI
- jr z, .asm_28e49
+ jr z, .loop
ld a, [CurPartySpecies]
cp CELEBI
- jr z, .asm_28e49
+ jr z, .loop
ld b, $0
-.asm_28e49
+.loop
ld a, b
ld [wPlayerLinkAction], a
push bc
@@ -1961,16 +1963,16 @@
pop bc
ld a, [wLinkMode]
cp LINK_TIMECAPSULE
- jr z, .asm_28e63
+ jr z, .save
ld a, b
and a
- jr z, .asm_28e63
+ jr z, .save
ld a, [wOtherPlayerLinkAction]
cp b
- jr nz, .asm_28e49
+ jr nz, .loop
-.asm_28e63
- callba Function14a58
+.save
+ callba SaveAfterLinkTrade
callba MobileFn_1060af
callba BackupMobileEventIndex
ld c, 40
@@ -2027,8 +2029,8 @@
ret
; 28eff
-Function28eff: ; 28eff
- callba Function16d6a7
+SetTradeRoomBGPals: ; 28eff
+ callba LoadTradeRoomBGPals_ ; just a nested farcall; so wasteful
call SetPalettes
ret
; 28f09
@@ -2148,7 +2150,7 @@
ld c, 10
call DelayFrames
ld a, $4
- call Function29f17
+ call Link_EnsureSync
ld c, 40
call DelayFrames
xor a
@@ -2197,7 +2199,7 @@
ld [rIE], a
pop af
ld [rIF], a
- ld hl, wcf5b
+ ld hl, wLinkTimeoutFrames
xor a
ld [hli], a
ld [hl], a
@@ -2238,7 +2240,7 @@
Special_WaitForLinkedFriend: ; 29d11
ld a, [wPlayerLinkAction]
and a
- jr z, .asm_29d2f
+ jr z, .no_link_action
ld a, $2
ld [rSB], a
xor a
@@ -2251,17 +2253,17 @@
call DelayFrame
call DelayFrame
-.asm_29d2f
+.no_link_action
ld a, $2
- ld [wcf5c], a
+ ld [wLinkTimeoutFrames + 1], a
ld a, $ff
- ld [wcf5b], a
-.asm_29d39
+ ld [wLinkTimeoutFrames], a
+.loop
ld a, [hLinkPlayerNumber]
cp $2
- jr z, .asm_29d79
+ jr z, .connected
cp $1
- jr z, .asm_29d79
+ jr z, .connected
ld a, -1
ld [hLinkPlayerNumber], a
ld a, $2
@@ -2272,16 +2274,16 @@
ld [rSC], a
ld a, $80
ld [rSC], a
- ld a, [wcf5b]
+ ld a, [wLinkTimeoutFrames]
dec a
- ld [wcf5b], a
- jr nz, .asm_29d68
- ld a, [wcf5c]
+ ld [wLinkTimeoutFrames], a
+ jr nz, .not_done
+ ld a, [wLinkTimeoutFrames + 1]
dec a
- ld [wcf5c], a
- jr z, .asm_29d8d
+ ld [wLinkTimeoutFrames + 1], a
+ jr z, .done
-.asm_29d68
+.not_done
ld a, $1
ld [rSB], a
ld a, $1
@@ -2289,19 +2291,19 @@
ld a, $81
ld [rSC], a
call DelayFrame
- jr .asm_29d39
+ jr .loop
-.asm_29d79
+.connected
call LinkDataReceived
call DelayFrame
call LinkDataReceived
- ld c, $32
+ ld c, 50
call DelayFrames
ld a, $1
ld [ScriptVar], a
ret
-.asm_29d8d
+.done
xor a
ld [ScriptVar], a
ret
@@ -2310,7 +2312,7 @@
Special_CheckLinkTimeout: ; 29d92
ld a, $1
ld [wPlayerLinkAction], a
- ld hl, wcf5b
+ ld hl, wLinkTimeoutFrames
ld a, $3
ld [hli], a
xor a
@@ -2320,19 +2322,19 @@
ld [hVBlank], a
call DelayFrame
call DelayFrame
- call Function29e0c
+ call Link_CheckCommunicationError
xor a
ld [hVBlank], a
ld a, [ScriptVar]
and a
ret nz
- jp Function29f04
+ jp Link_ResetSerialRegistersAfterLinkClosure
; 29dba
Function29dba: ; 29dba
ld a, $5
ld [wPlayerLinkAction], a
- ld hl, wcf5b
+ ld hl, wLinkTimeoutFrames
ld a, $3
ld [hli], a
xor a
@@ -2342,7 +2344,7 @@
ld [hVBlank], a
call DelayFrame
call DelayFrame
- call Function29e0c
+ call Link_CheckCommunicationError
ld a, [ScriptVar]
and a
jr z, .vblank
@@ -2357,11 +2359,11 @@
jr nz, .script_var
ld a, $6
ld [wPlayerLinkAction], a
- ld hl, wcf5b
+ ld hl, wLinkTimeoutFrames
ld a, $1
ld [hli], a
ld [hl], $32
- call Function29e0c
+ call Link_CheckCommunicationError
ld a, [wOtherPlayerLinkMode]
cp $6
jr z, .vblank
@@ -2377,31 +2379,31 @@
ret
; 29e0c
-Function29e0c: ; 29e0c
+Link_CheckCommunicationError: ; 29e0c
xor a
ld [hFFCA], a
- ld a, [wcf5b]
+ ld a, [wLinkTimeoutFrames]
ld h, a
- ld a, [wcf5c]
+ ld a, [wLinkTimeoutFrames + 1]
ld l, a
push hl
- call Function29e3b
+ call .CheckConnected
pop hl
- jr nz, .asm_29e2f
- call Function29e47
- call Function29e53
- call Function29e3b
- jr nz, .asm_29e2f
- call Function29e47
+ jr nz, .load_true
+ call .AcknowledgeSerial
+ call .ConvertDW
+ call .CheckConnected
+ jr nz, .load_true
+ call .AcknowledgeSerial
xor a
- jr .asm_29e31
+ jr .load_scriptvar
-.asm_29e2f
+.load_true
ld a, $1
-.asm_29e31
+.load_scriptvar
ld [ScriptVar], a
- ld hl, wcf5b
+ ld hl, wLinkTimeoutFrames
xor a
ld [hli], a
ld [hl], a
@@ -2408,9 +2410,9 @@
ret
; 29e3b
-Function29e3b: ; 29e3b
- call Function87d
- ld hl, wcf5b
+.CheckConnected: ; 29e3b
+ call WaitLinkTransfer
+ ld hl, wLinkTimeoutFrames
ld a, [hli]
inc a
ret nz
@@ -2419,17 +2421,19 @@
ret
; 29e47
-Function29e47: ; 29e47
- ld b, $a
-.asm_29e49
+.AcknowledgeSerial: ; 29e47
+ ld b, 10
+.loop
call DelayFrame
call LinkDataReceived
dec b
- jr nz, .asm_29e49
+ jr nz, .loop
ret
; 29e53
-Function29e53: ; 29e53
+.ConvertDW: ; 29e53
+ ; [wLinkTimeoutFrames] = ((hl - $100) / 4) + $100
+ ; = (hl / 4) + $c0
dec h
srl h
rr l
@@ -2437,9 +2441,9 @@
rr l
inc h
ld a, h
- ld [wcf5b], a
+ ld [wLinkTimeoutFrames], a
ld a, l
- ld [wcf5c], a
+ ld [wLinkTimeoutFrames + 1], a
ret
; 29e66
@@ -2448,12 +2452,11 @@
push af
callba Link_SaveGame
ld a, $1
- jr nc, .asm_29e75
+ jr nc, .return_result
xor a
-
-.asm_29e75
+.return_result
ld [ScriptVar], a
- ld c, $1e
+ ld c, 30
call DelayFrames
pop af
ld [wd265], a
@@ -2462,7 +2465,7 @@
Special_CheckBothSelectedSameRoom: ; 29e82
ld a, [wd265]
- call Function29f17
+ call Link_EnsureSync
push af
call LinkDataReceived
call DelayFrame
@@ -2523,9 +2526,9 @@
Special_CloseLink: ; 29eee
xor a
ld [wLinkMode], a
- ld c, $3
+ ld c, 3
call DelayFrames
- jp Function29f04
+ jp Link_ResetSerialRegistersAfterLinkClosure
; 29efa
Special_FailedLinkToPast: ; 29efa
@@ -2532,10 +2535,10 @@
ld c, 40
call DelayFrames
ld a, $e
- jp Function29f17
+ jp Link_EnsureSync
; 29f04
-Function29f04: ; 29f04
+Link_ResetSerialRegistersAfterLinkClosure: ; 29f04
ld c, 3
call DelayFrames
ld a, -1
@@ -2548,7 +2551,7 @@
ret
; 29f17
-Function29f17: ; 29f17
+Link_EnsureSync: ; 29f17
add $d0
ld [wPlayerLinkAction], a
ld [wcf57], a
--- a/engine/link_trade.asm
+++ b/engine/link_trade.asm
@@ -25,7 +25,7 @@
call ClearSprites
callba __LoadTradeScreenBorder ; useless to farcall
callba Function16d42e ; useless to farcall
- ld b, SCGB_08
+ ld b, SCGB_DIPLOMA
call GetSGBLayout
call SetPalettes
call WaitBGMap
@@ -145,8 +145,8 @@
ret
; 16d6a7
-Function16d6a7: ; 16d6a7
- callba Function49811
+LoadTradeRoomBGPals_: ; 16d6a7
+ callba LoadTradeRoomBGPals
ret
; 16d6ae
@@ -171,7 +171,7 @@
Function16d6ce: ; 16d6ce
call LoadStandardMenuDataHeader
call Function16d6e1
- callba Function87d
+ callba WaitLinkTransfer
call Call_ExitMenu
call WaitBGMap2
ret
--- a/engine/main_menu.asm
+++ b/engine/main_menu.asm
@@ -4,9 +4,9 @@
MainMenu: ; 49cdc
xor a
- ld [wc2d7], a
+ ld [wDisableTextAcceleration], a
call Function49ed0
- ld b, SCGB_08
+ ld b, SCGB_DIPLOMA
call GetSGBLayout
call SetPalettes
ld hl, GameTimerPause
--- a/engine/map_object_action.asm
+++ b/engine/map_object_action.asm
@@ -274,12 +274,12 @@
Function45c5: ; 45c5
ld a, [VariableSprites + SPRITE_BIG_DOLL - SPRITE_VARS]
- ld d, FACING_17
+ ld d, FACING_17 ; symmetric
cp SPRITE_BIG_SNORLAX
jr z, .ok
cp SPRITE_BIG_LAPRAS
jr z, .ok
- ld d, FACING_16
+ ld d, FACING_16 ; asymmetric
.ok
ld hl, OBJECT_FACING_STEP
--- a/engine/map_objects.asm
+++ b/engine/map_objects.asm
@@ -137,7 +137,7 @@
cp STEP_TYPE_SLEEP
ret z
.ok3
- ld hl, Pointers4b45
+ ld hl, StepTypesJumptable
rst JumpTable
ret
@@ -268,9 +268,9 @@
ld [hl], a
ld hl, OBJECT_MOVEMENT_BYTE_INDEX
add hl, bc
-rept 3
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
ld [hl], a ; OBJECT_30
ld hl, OBJECT_DIRECTION_WALKING
add hl, bc
@@ -1084,7 +1084,7 @@
ret
; 4b45
-Pointers4b45: ; 4b45
+StepTypesJumptable: ; 4b45
; These pointers use OBJECT_STEP_TYPE. See constants/sprite_constants.asm
dw ObjectMovementReset ; 00
dw MapObjectMovementPattern ; unused
@@ -1876,8 +1876,8 @@
ld a, [wPlayerNextMovement]
ld hl, wPlayerMovement
ld [hl], a
-; load [wPlayerNextMovement] with movement_step_sleep_1
- ld a, movement_step_sleep_1
+; load [wPlayerNextMovement] with movement_step_sleep
+ ld a, movement_step_sleep
ld [wPlayerNextMovement], a
; recover the previous value of [wPlayerNextMovement]
ld a, [hl]
@@ -1987,7 +1987,7 @@
cp d
ret nz
ld a, e
- cp movement_step_sleep_1
+ cp movement_step_sleep
ret z
cp movement_step_end
ret z
@@ -1995,7 +1995,7 @@
ret z
cp movement_step_bump
ret z
- cp movement_turn_step_right + 1
+ cp movement_slow_step
ret c
push af
ld hl, wFollowerMovementQueueLength
@@ -2034,7 +2034,7 @@
.done
call .CancelFollowIfLeaderMissing
ret c
- ld a, movement_step_sleep_1
+ ld a, movement_step_sleep
ret
.CancelFollowIfLeaderMissing:
@@ -2209,7 +2209,7 @@
xor a
.loop
ld [hMapObjectIndexBuffer], a
- call GetObjectSprite
+ call DoesObjectHaveASprite
jr z, .ok
call Function565c
.ok
@@ -2260,7 +2260,7 @@
cp NUM_OBJECT_STRUCTS
ret nc
call GetObjectStruct
- call GetObjectSprite
+ call DoesObjectHaveASprite
ret z
call Function5673
ret
@@ -2363,7 +2363,7 @@
; 56cd
Function56cd: ; 56cd
- ld a, [wFollowNotExactPersonX]
+ ld a, [wPlayerBGMapOffsetX]
ld d, a
ld hl, OBJECT_SPRITE_X_OFFSET
add hl, bc
@@ -2392,7 +2392,7 @@
sub $20
.ok3
ld [hUsedSpriteIndex], a
- ld a, [wFollowNotExactPersonY]
+ ld a, [wPlayerBGMapOffsetY]
ld e, a
ld hl, OBJECT_SPRITE_Y_OFFSET
add hl, bc
@@ -2489,7 +2489,7 @@
xor a
.loop
ld [hMapObjectIndexBuffer], a
- call GetObjectSprite
+ call DoesObjectHaveASprite
jr z, .next
call Function437b
.next
@@ -2505,11 +2505,11 @@
; 579d
RefreshPlayerSprite: ; 579d
- ld a, movement_step_sleep_1
+ ld a, movement_step_sleep
ld [wPlayerNextMovement], a
ld [wPlayerMovement], a
xor a
- ld [wd04e], a
+ ld [wPlayerTurningDirection], a
ld [PlayerObjectStepFrame], a
call .TryResetPlayerAction
callba CheckWarpFacingDown
@@ -2662,7 +2662,7 @@
xor a
.loop
push af
- call GetObjectSprite
+ call DoesObjectHaveASprite
jr z, .next
ld hl, OBJECT_FLAGS2
add hl, bc
@@ -2707,7 +2707,7 @@
xor a
.loop
push af
- call GetObjectSprite
+ call DoesObjectHaveASprite
jr z, .next
ld hl, OBJECT_FLAGS2
add hl, bc
@@ -2817,19 +2817,19 @@
ret
; 5958
-Function5958: ; 5958
+ApplyBGMapAnchorToObjects: ; 5958
push hl
push de
push bc
- ld a, [wFollowNotExactPersonX]
+ ld a, [wPlayerBGMapOffsetX]
ld d, a
- ld a, [wFollowNotExactPersonY]
+ ld a, [wPlayerBGMapOffsetY]
ld e, a
ld bc, ObjectStructs
ld a, NUM_OBJECT_STRUCTS
.loop
push af
- call GetObjectSprite
+ call DoesObjectHaveASprite
jr z, .skip
ld hl, OBJECT_SPRITE_X
add hl, bc
@@ -2850,8 +2850,8 @@
dec a
jr nz, .loop
xor a
- ld [wFollowNotExactPersonX], a
- ld [wFollowNotExactPersonY], a
+ ld [wPlayerBGMapOffsetX], a
+ ld [wPlayerBGMapOffsetY], a
pop bc
pop de
pop hl
@@ -2881,7 +2881,7 @@
ld hl, wMovementPointer
.loop
push hl
- call GetObjectSprite
+ call DoesObjectHaveASprite
jr z, .skip
ld hl, OBJECT_FACING_STEP
add hl, bc
@@ -2986,7 +2986,7 @@
add [hl]
add 8
ld e, a
- ld a, [wFollowNotExactPersonX]
+ ld a, [wPlayerBGMapOffsetX]
add e
ld [hFFBF], a
ld hl, OBJECT_SPRITE_Y
@@ -2997,7 +2997,7 @@
add [hl]
add 12
ld e, a
- ld a, [wFollowNotExactPersonY]
+ ld a, [wPlayerBGMapOffsetY]
add e
ld [hFFC0], a
ld hl, OBJECT_FACING_STEP
--- a/engine/map_setup.asm
+++ b/engine/map_setup.asm
@@ -204,9 +204,9 @@
ld c, a
ld b, 0
ld hl, MapSetupCommands
-rept 3
add hl, bc
-endr
+ add hl, bc
+ add hl, bc
; bank
ld b, [hl]
@@ -258,8 +258,8 @@
dba LoadMapPalettes ; 11
dba LoadWildMonData ; 12
dba RefreshMapSprites ; 13
- dba RunCallback_05_03 ; 14
- dba RunCallback_03 ; 15
+ dba HandleNewMap ; 14
+ dba InitCommandQueue ; 15
dba LoadObjectsRunCallback_02 ; 16
dba LoadSpawnPoint ; 17
dba EnterMapConnection ; 18
@@ -289,7 +289,7 @@
DontScrollText: ; 154ca
xor a
- ld [wc2d7], a
+ ld [wDisableTextAcceleration], a
ret
; 154cf
--- a/engine/mart.asm
+++ b/engine/mart.asm
@@ -145,9 +145,8 @@
.IsAMart:
ld hl, Marts
-rept 2
add hl, de
-endr
+ add hl, de
ld e, [hl]
inc hl
ld d, [hl]
@@ -393,9 +392,8 @@
pop af
ld e, a
ld d, 0
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -405,9 +403,8 @@
MartAskPurchaseQuantity: ; 15c91
call GetMartDialogGroup ; gets a pointer from GetMartDialogGroup.MartTextFunctionPointers
-rept 2
inc hl
-endr
+ inc hl
ld a, [hl]
and a
jp z, StandardMartAskPurchaseQuantity
@@ -421,9 +418,9 @@
ld e, a
ld d, 0
ld hl, .MartTextFunctionPointers
-rept 3
add hl, de
-endr
+ add hl, de
+ add hl, de
ret
; 15cb0
@@ -579,9 +576,9 @@
ld h, [hl]
ld l, a
inc hl
-rept 3
add hl, de
-endr
+ add hl, de
+ add hl, de
inc hl
ld a, [hli]
ld [hMoneyTemp + 2], a
@@ -620,9 +617,9 @@
ld h, [hl]
ld l, a
inc hl
-rept 3
add hl, de
-endr
+ add hl, de
+ add hl, de
inc hl
ld e, [hl]
inc hl
@@ -666,9 +663,9 @@
ld c, a
ld b, 0
ld hl, wMartItem1BCD
-rept 3
add hl, bc
-endr
+ add hl, bc
+ add hl, bc
push de
ld d, h
ld e, l
--- a/engine/menu.asm
+++ b/engine/menu.asm
@@ -296,7 +296,7 @@
call Place2DMenuCursor
.loop
call Move2DMenuCursor
- call Function10402d ; BUG: This function is in another bank.
+ call HDMATransferTileMapToWRAMBank3 ; BUG: This function is in another bank.
; Pointer in current bank (9) is bogus.
call .loop2
jr nc, .done
@@ -319,7 +319,7 @@
ret c
ld c, 1
ld b, 3
- call Function10062d ; BUG: This function is in another bank.
+ call AdvanceMobileInactivityTimerAndCheckExpired ; BUG: This function is in another bank.
; Pointer in current bank (9) is bogus.
ret c
callba Function100337
@@ -836,8 +836,8 @@
ld [hli], a
; wCursorOffCharacter, wCursorCurrentTile
xor a
-rept 3
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
ret
; 244c3
--- a/engine/mon_icons.asm
+++ b/engine/mon_icons.asm
@@ -38,11 +38,11 @@
.Jumptable: ; 8e854 (23:6854)
- dw Function8e8d5 ; party menu
- dw Function8e961 ; naming screen
- dw Function8e97d ; moves (?)
+ dw PartyMenu_InitAnimatedMonIcon ; party menu
+ dw NamingScreen_InitAnimatedMonIcon ; naming screen
+ dw MoveList_InitAnimatedMonIcon ; moves (?)
dw Trade_LoadMonIconGFX ; trade
- dw Function8e898 ; mobile
+ dw Mobile_InitAnimatedMonIcon ; mobile
dw Mobile_InitPartyMenuBGPal71 ; mobile
dw .GetPartyMenuMonIcon ; unused
@@ -84,8 +84,8 @@
ld [hl], a
ret
-Function8e898: ; 8e898 (23:6898)
- call Function8e8d5
+Mobile_InitAnimatedMonIcon: ; 8e898 (23:6898)
+ call PartyMenu_InitAnimatedMonIcon
ld hl, SPRITEANIMSTRUCT_ANIM_SEQ_ID
add hl, bc
ld a, SPRITE_ANIM_SEQ_NULL
@@ -121,7 +121,7 @@
ld [wc608 + 1], a
ret
-Function8e8d5: ; 8e8d5 (23:68d5)
+PartyMenu_InitAnimatedMonIcon: ; 8e8d5 (23:68d5)
call InitPartyMenuIcon
call .SpawnItemIcon
call SetPartyMonIconAnimSpeed
@@ -144,11 +144,11 @@
pop bc
pop hl
jr c, .mail
- ld a, $3
+ ld a, SPRITE_ANIM_FRAMESET_03
jr .okay
- ld a, $2
+ ld a, SPRITE_ANIM_FRAMESET_02
.okay
ld hl, SPRITEANIMSTRUCT_FRAMESET_ID
add hl, bc
@@ -169,9 +169,10 @@
call GetMemIconGFX
ld a, [hObjectStructIndexBuffer]
; y coord
-rept 4
add a
-endr
+ add a
+ add a
+ add a
add $1c
ld d, a
; x coord
@@ -217,7 +218,7 @@
db $00, $40, $80
; 8e961
-Function8e961: ; 8e961 (23:6961)
+NamingScreen_InitAnimatedMonIcon: ; 8e961 (23:6961)
ld a, [wd265]
call ReadMonMenuIcon
ld [CurIcon], a
@@ -231,7 +232,7 @@
ld [hl], SPRITE_ANIM_SEQ_NULL
ret
-Function8e97d: ; 8e97d (23:697d)
+MoveList_InitAnimatedMonIcon: ; 8e97d (23:697d)
ld a, [wd265]
call ReadMonMenuIcon
ld [CurIcon], a
--- a/engine/move_mon.asm
+++ b/engine/move_mon.asm
@@ -266,15 +266,15 @@
ld [de], a
inc de
ld hl, EnemyMonStatus
- ; Copy EnemyMonStatus
+ ; Copy EnemyMonStatus
ld a, [hli]
ld [de], a
inc de
- ; Copy EnemyMonUnused
+ ; Copy EnemyMonUnused
ld a, [hli]
ld [de], a
inc de
- ; Copy EnemyMonHP
+ ; Copy EnemyMonHP
ld a, [hli]
ld [de], a
inc de
@@ -452,8 +452,8 @@
ld hl, wBreedMon1Species
jr z, .breedmon
- ; we want to sent a Pkmn into the Box
- ; so check if there's enough space
+ ; we want to sent a Pkmn into the Box
+ ; so check if there's enough space
ld hl, sBoxCount
ld a, [hl]
cp MONS_PER_BOX
@@ -654,7 +654,7 @@
ld a, [sBoxCount]
dec a
ld b, a
- call Functiondcb6
+ call RestorePPofDepositedPokemon
.CloseSRAM_And_ClearCarryFlag:
call CloseSRAM
and a
@@ -667,7 +667,7 @@
ret
; dcb6
-Functiondcb6: ; dcb6
+RestorePPofDepositedPokemon: ; dcb6
ld a, b
ld hl, sBoxMons
ld bc, BOXMON_STRUCT_LENGTH
@@ -696,10 +696,10 @@
ld a, [MonType]
push af
ld b, 0
-.asm_dcec
+.loop
ld a, [hli]
and a
- jr z, .asm_dd18
+ jr z, .done
ld [TempMonMoves], a
ld a, BOXMON
ld [MonType], a
@@ -722,9 +722,9 @@
inc b
ld a, b
cp NUM_MOVES
- jr c, .asm_dcec
+ jr c, .loop
-.asm_dd18
+.done
pop af
ld [MonType], a
pop af
@@ -973,7 +973,7 @@
ld [de], a
inc de
- ; Set all 5 Experience Values to 0
+ ; Set all 5 Experience Values to 0
xor a
ld b, 2 * 5
.loop2
@@ -1025,7 +1025,7 @@
call CopyBytes
ld b, 0
- call Functiondcb6
+ call RestorePPofDepositedPokemon
call CloseSRAM
scf
@@ -1459,9 +1459,9 @@
ld a, [hl]
swap a
and $1
-rept 3
add a
-endr
+ add a
+ add a
ld b, a
ld a, [hli]
and $1
--- /dev/null
+++ b/engine/move_mon_wo_mail.asm
@@ -1,0 +1,133 @@
+InsertPokemonIntoBox: ; 51322
+ ld a, BANK(sBoxCount)
+ call GetSRAMBank
+ ld hl, sBoxCount
+ call InsertSpeciesIntoBoxOrParty
+ ld a, [sBoxCount]
+ dec a
+ ld [wd265], a
+ ld hl, sBoxMonNicknames
+ ld bc, PKMN_NAME_LENGTH
+ ld de, wBufferMonNick
+ call InsertDataIntoBoxOrParty
+ ld a, [sBoxCount]
+ dec a
+ ld [wd265], a
+ ld hl, sBoxMonOT
+ ld bc, NAME_LENGTH
+ ld de, wBufferMonOT
+ call InsertDataIntoBoxOrParty
+ ld a, [sBoxCount]
+ dec a
+ ld [wd265], a
+ ld hl, sBoxMons
+ ld bc, BOXMON_STRUCT_LENGTH
+ ld de, wBufferMon
+ call InsertDataIntoBoxOrParty
+ ld hl, wBufferMonMoves
+ ld de, TempMonMoves
+ ld bc, NUM_MOVES
+ call CopyBytes
+ ld hl, wBufferMonPP
+ ld de, TempMonPP
+ ld bc, NUM_MOVES
+ call CopyBytes
+ ld a, [CurPartyMon]
+ ld b, a
+ callba RestorePPofDepositedPokemon
+ jp CloseSRAM
+
+InsertPokemonIntoParty: ; 5138b
+ ld hl, PartyCount
+ call InsertSpeciesIntoBoxOrParty
+ ld a, [PartyCount]
+ dec a
+ ld [wd265], a
+ ld hl, PartyMonNicknames
+ ld bc, PKMN_NAME_LENGTH
+ ld de, wBufferMonNick
+ call InsertDataIntoBoxOrParty
+ ld a, [PartyCount]
+ dec a
+ ld [wd265], a
+ ld hl, PartyMonOT
+ ld bc, NAME_LENGTH
+ ld de, wBufferMonOT
+ call InsertDataIntoBoxOrParty
+ ld a, [PartyCount]
+ dec a
+ ld [wd265], a
+ ld hl, PartyMons
+ ld bc, PARTYMON_STRUCT_LENGTH
+ ld de, wBufferMon
+ call InsertDataIntoBoxOrParty
+ ret
+
+InsertSpeciesIntoBoxOrParty: ; 513cb
+ inc [hl]
+ inc hl
+ ld a, [CurPartyMon]
+ ld c, a
+ ld b, 0
+ add hl, bc
+ ld a, [CurPartySpecies]
+ ld c, a
+.loop
+ ld a, [hl]
+ ld [hl], c
+ inc hl
+ inc c
+ ld c, a
+ jr nz, .loop
+ ret
+
+InsertDataIntoBoxOrParty: ; 513e0
+ push de
+ push hl
+ push bc
+ ld a, [wd265]
+ dec a
+ call AddNTimes
+ push hl
+ add hl, bc
+ ld d, h
+ ld e, l
+ pop hl
+.loop
+ push bc
+ ld a, [wd265]
+ ld b, a
+ ld a, [CurPartyMon]
+ cp b
+ pop bc
+ jr z, .insert
+ push hl
+ push de
+ push bc
+ call CopyBytes
+ pop bc
+ pop de
+ pop hl
+ push hl
+ ld a, l
+ sub c
+ ld l, a
+ ld a, h
+ sbc b
+ ld h, a
+ pop de
+ ld a, [wd265]
+ dec a
+ ld [wd265], a
+ jr .loop
+
+.insert
+ pop bc
+ pop hl
+ ld a, [CurPartyMon]
+ call AddNTimes
+ ld d, h
+ ld e, l
+ pop hl
+ call CopyBytes
+ ret
--- a/engine/movement.asm
+++ b/engine/movement.asm
@@ -55,8 +55,8 @@
dw Movement_fast_jump_step_up ; 35
dw Movement_fast_jump_step_left ; 36
dw Movement_fast_jump_step_right ; 37
- dw Movement_remove_sliding ; 38
- dw Movement_set_sliding ; 39
+ dw Movement_remove_sliding ; 38
+ dw Movement_set_sliding ; 39
dw Movement_remove_fixed_facing ; 3a
dw Movement_fix_facing ; 3b
dw Movement_show_person ; 3c
@@ -85,10 +85,10 @@
dw Movement_hide_emote ; 53
dw Movement_show_emote ; 54
dw Movement_step_shake ; 55
- dw Movement_tree_shake ; 56
+ dw Movement_tree_shake ; 56
dw Movement_rock_smash ; 57
dw Movement_return_dig ; 58
- dw Movement_skyfall_top ; 59
+ dw Movement_skyfall_top ; 59
; 5129
--- a/engine/mysterygift.asm
+++ b/engine/mysterygift.asm
@@ -2,13 +2,13 @@
call ClearTileMap
call ClearSprites
call WaitBGMap
- call Function105153
+ call InitMysteryGiftLayout
hlcoord 3, 8
ld de, .String_PressAToLink_BToCancel
call PlaceString
call WaitBGMap
- callba Function2c642
- call Function1050fb
+ callba PrepMysteryGiftDataToSend
+ call MysteryGift_ClearTrainerData
ld a, $2
ld [wca01], a
ld a, $14
@@ -27,7 +27,7 @@
call ClearTileMap
call EnableLCD
call WaitBGMap
- ld b, SCGB_08
+ ld b, SCGB_DIPLOMA
call GetSGBLayout
call SetPalettes
pop de
@@ -239,14 +239,16 @@
di
callba ClearChannels
call Function104d5e
+
.loop2
call Function104d96
call Function104ddd
- ld a, [hPrintNum10]
+ ld a, [hMGStatusFlags]
cp $10
jp z, Function104bd0
cp $6c
jr nz, .loop2
+
ld a, [hPrintNum9]
cp $2
jr z, Function104b22
@@ -256,7 +258,8 @@
jr nz, .ly_loop
call Function104b49
jp nz, Function104bd0
- jr asm_104b0a
+ jr Function104b0a
+ ; Delay frame
.ly_loop
ld a, [rLY]
cp $90
@@ -264,12 +267,15 @@
ld c, rRP % $100
ld a, $c0
ld [$ff00+c], a
- ld b, $f0
+ ld b, 240 ; This might have been intended as a 4-second timeout buffer.
+ ; However, it is reset with each frame.
.loop3
push bc
- call Function105038
+ call MysteryGift_ReadJoypad
+
ld b, $2
ld c, rRP % $100
+ ; Delay frame
.ly_loop2
ld a, [$ff00+c]
and b
@@ -284,24 +290,25 @@
ld a, [rLY]
cp $90
jr c, .ly_loop3
+
ld a, b
pop bc
dec b
- jr z, .loop2
+ jr z, .loop2 ; we never jump here
or a
jr nz, .loop2
- ld a, [hMoneyTemp + 1]
- bit 1, a
+ ; Check if we've pressed the B button
+ ld a, [hMGJoypadReleased]
+ bit B_BUTTON_F, a
jr z, .loop3
ld a, $10
- ld [hPrintNum10], a
+ ld [hMGStatusFlags], a
jp Function104bd0
Function104b04: ; 104b04 (41:4b04)
call Function104b40
jp nz, Function104bd0
-
-asm_104b0a: ; 104b0a (41:4b0a)
+Function104b0a: ; 104b0a (41:4b0a)
call Function104d38
jp nz, Function104bd0
call Function104b88
@@ -331,7 +338,7 @@
Function104b49: ; 104b49 (41:4b49)
call Function105033
- ld a, [hPrintNum10]
+ ld a, [hMGStatusFlags]
cp $6c
ret nz
ld a, [hPrintNum1]
@@ -346,7 +353,7 @@
call Function104d4e
ret nz
call Function10502e
- ld a, [hPrintNum10]
+ ld a, [hMGStatusFlags]
cp $6c
ret nz
call Function104d43
@@ -357,7 +364,7 @@
call Function104d56
ret nz
call Function105033
- ld a, [hPrintNum10]
+ ld a, [hMGStatusFlags]
cp $6c
ret
@@ -369,7 +376,7 @@
call Function104d4e
ret nz
call Function10502e
- ld a, [hPrintNum10]
+ ld a, [hMGStatusFlags]
cp $6c
ret nz
call Function104d43
@@ -379,7 +386,7 @@
call Function104d56
ret nz
call Function105033
- ld a, [hPrintNum10]
+ ld a, [hMGStatusFlags]
cp $6c
ret nz
ld a, [hPrintNum1]
@@ -393,20 +400,20 @@
call Function104d4e
ret nz
call Function10502e
- ld a, [hPrintNum10]
+ ld a, [hMGStatusFlags]
cp $6c
ret
Function104bd0: ; 104bd0 (41:4bd0)
nop
- ld a, [hPrintNum10]
+ ld a, [hMGStatusFlags]
cp $10
- jr z, .asm_104c18
+ jr z, .quit
cp $6c
- jr nz, .asm_104c18
+ jr nz, .quit
ld hl, wca01
dec [hl]
- jr z, .asm_104c18
+ jr z, .quit
ld hl, wMysteryGiftTrainerData
ld de, wMysteryGiftPartnerData
ld bc, wMysteryGiftPartnerDataEnd - wMysteryGiftPartnerData
@@ -413,9 +420,9 @@
call CopyBytes
ld a, [wMysteryGiftTrainerData]
cp $3
- jr nc, .asm_104c18
+ jr nc, .quit
callba StagePartyDataForMysteryGift
- call Function1050fb
+ call MysteryGift_ClearTrainerData
ld a, $26
ld [wca02], a
ld a, [hPrintNum9]
@@ -424,12 +431,14 @@
call Function104d43
jr nz, Function104bd0
jp Function104b04
+
.asm_104c10
call Function104d38
jr nz, Function104bd0
jp Function104b22
-.asm_104c18
- ld a, [hPrintNum10]
+
+.quit
+ ld a, [hMGStatusFlags]
push af
call Function104da0
xor a
@@ -449,7 +458,7 @@
.asm_104c37
call Function104d96
call Function104ddd
- ld a, [hPrintNum10]
+ ld a, [hMGStatusFlags]
cp $10
jp z, Function104d1c
cp $6c
@@ -485,7 +494,7 @@
call Function104d56
ret nz
call Function105033
- ld a, [hPrintNum10]
+ ld a, [hMGStatusFlags]
cp $6c
ret nz
ld a, [hPrintNum1]
@@ -500,7 +509,7 @@
call Function104d4e
ret nz
call Function10502e
- ld a, [hPrintNum10]
+ ld a, [hMGStatusFlags]
cp $6c
ret nz
call Function104d43
@@ -511,7 +520,7 @@
call Function104d56
ret nz
call Function105033
- ld a, [hPrintNum10]
+ ld a, [hMGStatusFlags]
cp $6c
ret
@@ -523,7 +532,7 @@
call Function104d4e
ret nz
call Function10502e
- ld a, [hPrintNum10]
+ ld a, [hMGStatusFlags]
cp $6c
ret nz
call Function104d43
@@ -533,7 +542,7 @@
call Function104d56
ret nz
call Function105033
- ld a, [hPrintNum10]
+ ld a, [hMGStatusFlags]
cp $6c
ret nz
ld a, [hPrintNum1]
@@ -548,13 +557,13 @@
call Function104d4e
ret nz
call Function10502e
- ld a, [hPrintNum10]
+ ld a, [hMGStatusFlags]
cp $6c
ret
Function104d1c: ; 104d1c (41:4d1c)
nop
- ld a, [hPrintNum10]
+ ld a, [hMGStatusFlags]
push af
call Function104da0
xor a
@@ -569,7 +578,7 @@
Function104d32: ; 104d32 (41:4d32)
ld a, $80
- ld [hPrintNum10], a
+ ld [hMGStatusFlags], a
and a
ret
@@ -576,7 +585,7 @@
Function104d38: ; 104d38 (41:4d38)
call Function104d96
call Function104e46
- ld a, [hPrintNum10]
+ ld a, [hMGStatusFlags]
cp $6c
ret
@@ -583,19 +592,19 @@
Function104d43: ; 104d43 (41:4d43)
call Function104d96
call Function104dfe
- ld a, [hPrintNum10]
+ ld a, [hMGStatusFlags]
cp $6c
ret
Function104d4e: ; 104d4e (41:4d4e)
call Function104e93
- ld a, [hPrintNum10]
+ ld a, [hMGStatusFlags]
cp $6c
ret
Function104d56: ; 104d56 (41:4d56)
call Function104f57
- ld a, [hPrintNum10]
+ ld a, [hMGStatusFlags]
cp $6c
ret
@@ -704,19 +713,19 @@
ld a, $1
ld [hPrintNum9], a
.loop
- call Function105038
+ call MysteryGift_ReadJoypad
ld b, $2
ld c, rRP % $100
- ld a, [hMoneyTemp + 1]
- bit 1, a
+ ld a, [hMGJoypadReleased]
+ bit B_BUTTON_F, a
jr z, .next
ld a, $10
- ld [hPrintNum10], a
+ ld [hMGStatusFlags], a
ret
.next
bit 0, a
- jr nz, asm_104e3a
+ jr nz, Function104e3a
ld a, [$ff00+c]
and b
jr nz, .loop
@@ -735,7 +744,7 @@
call Function104da9
jp z, Function104f42
ld a, $6c
- ld [hPrintNum10], a
+ ld [hMGStatusFlags], a
ld d, $3d
call Function104dd1
ld d, $5
@@ -748,17 +757,17 @@
call Function104dd1
ret
-asm_104e3a: ; 104e3a (41:4e3a)
+Function104e3a: ; 104e3a (41:4e3a)
+ ; Wait a random amount of time
call Random
ld e, a
and $f
ld d, a
-.asm_104e41
+.loop
dec de
ld a, d
or e
- jr nz, .asm_104e41
-
+ jr nz, .loop
Function104e46: ; 104e46 (41:4e46)
ld a, $2
ld [hPrintNum9], a
@@ -788,13 +797,13 @@
ld d, $3d
call Function104dd1
ld a, $6c
- ld [hPrintNum10], a
+ ld [hMGStatusFlags], a
ret
Function104e8c: ; 104e8c (41:4e8c)
ld [rRP], a
ld a, $ff
- ld [hPrintNum10], a
+ ld [hMGStatusFlags], a
ret
Function104e93: ; 104e93 (41:4e93)
@@ -824,7 +833,7 @@
ld hl, hPrintNum2 ; $ffb4 (aliases: hMultiplicand)
ld b, $2
call Function104ed6
- ld hl, hPrintNum10
+ ld hl, hMGStatusFlags
ld b, $1
call Function104faf
ld a, [hPrintNum2]
@@ -902,21 +911,21 @@
ret
Function104f42: ; 104f42 (41:4f42)
- ld a, [hPrintNum10]
+ ld a, [hMGStatusFlags]
or $2
- ld [hPrintNum10], a
+ ld [hMGStatusFlags], a
ret
Function104f49: ; 104f49 (41:4f49)
- ld a, [hPrintNum10]
+ ld a, [hMGStatusFlags]
or $1
- ld [hPrintNum10], a
+ ld [hMGStatusFlags], a
ret
Function104f50: ; 104f50 (41:4f50)
- ld a, [hPrintNum10]
+ ld a, [hMGStatusFlags]
or $80
- ld [hPrintNum10], a
+ ld [hMGStatusFlags], a
ret
Function104f57: ; 104f57 (41:4f57)
@@ -960,7 +969,7 @@
push de
ld d, $3d
call Function104dd1
- ld hl, hPrintNum10
+ ld hl, hMGStatusFlags
ld b, $1
call Function104ed6
pop de
@@ -986,7 +995,7 @@
cpl
ld b, a
xor a
- ld [hMoneyTemp + 2], a
+ ld [hMGJoypadPressed + 2], a
call Function104d86
.asm_104fd2
inc b
@@ -1009,10 +1018,10 @@
bit 1, a
jr nz, .asm_104fe5
.asm_104fed
- ld a, [hMoneyTemp + 2]
+ ld a, [hMGJoypadPressed + 2]
ld d, a
ld a, [rTIMA]
- ld [hMoneyTemp + 2], a
+ ld [hMGJoypadPressed + 2], a
sub d
cp $12
jr c, .asm_104ffd
@@ -1058,31 +1067,48 @@
ld b, $0
jp Function104f57
-Function105038: ; 105038 (41:5038)
- ld a, $20
+MysteryGift_ReadJoypad: ; 105038 (41:5038)
+; We can only get four inputs at a time.
+; We take d-pad first for no particular reason.
+ ld a, R_DPAD
ld [rJOYP], a
+; Read twice to give the request time to take.
ld a, [rJOYP]
ld a, [rJOYP]
+
+; The Joypad register output is in the lo nybble (inversed).
+; We make the hi nybble of our new container d-pad input.
cpl
and $f
swap a
+
+; We'll keep this in b for now.
ld b, a
- ld a, $10
+
+; Buttons make 8 total inputs (A, B, Select, Start).
+; We can fit this into one byte.
+ ld a, R_BUTTONS
ld [rJOYP], a
+; Wait for input to stabilize.
rept 6
ld a, [rJOYP]
endr
+; Buttons take the lo nybble.
cpl
and $f
or b
ld c, a
- ld a, [hMoneyTemp]
+; To get the delta we xor the last frame's input with the new one.
+ ld a, [hMGJoypadPressed]
xor c
+; Released this frame:
and c
- ld [hMoneyTemp + 1], a
+ ld [hMGJoypadReleased], a
+; Pressed this frame:
ld a, c
- ld [hMoneyTemp], a
+ ld [hMGJoypadPressed], a
ld a, $30
+; Reset the joypad register since we're done with it.
ld [rJOYP], a
ret
@@ -1179,7 +1205,7 @@
ld [de], a
jp CloseSRAM
-Function1050fb: ; 1050fb (41:50fb)
+MysteryGift_ClearTrainerData: ; 1050fb (41:50fb)
ld hl, wMysteryGiftTrainerData
xor a
ld b, wMysteryGiftTrainerDataEnd - wMysteryGiftTrainerData
@@ -1247,7 +1273,7 @@
ld [wca00], a
jp CloseSRAM
-Function105153: ; 105153 (41:5153)
+InitMysteryGiftLayout: ; 105153 (41:5153)
call ClearBGPalettes
call DisableLCD
ld hl, MysteryGiftGFX
@@ -1333,7 +1359,7 @@
ld [hl], $41
call EnableLCD
call WaitBGMap
- ld b, SCGB_1D
+ ld b, SCGB_MYSTERY_GIFT
call GetSGBLayout
call SetPalettes
ret
@@ -1398,7 +1424,7 @@
call PlaceString
call WaitBGMap
call Function10578c
- call Function1050fb
+ call MysteryGift_ClearTrainerData
ld a, $24
ld [wca02], a
ld a, [rIE]
@@ -1511,7 +1537,7 @@
call ClearTileMap
call EnableLCD
call WaitBGMap
- ld b, SCGB_08
+ ld b, SCGB_DIPLOMA
call GetSGBLayout
call SetPalettes
ret
--- a/engine/mysterygift2.asm
+++ b/engine/mysterygift2.asm
@@ -1,4 +1,4 @@
-Function2c642: ; 2c642 (b:4642)
+PrepMysteryGiftDataToSend: ; 2c642 (b:4642)
ld de, wMysteryGiftStaging
ld a, $1
ld [de], a
--- a/engine/namingscreen.asm
+++ b/engine/namingscreen.asm
@@ -43,7 +43,7 @@
.SetUpNamingScreen: ; 116f8
call ClearBGPalettes
- ld b, SCGB_08
+ ld b, SCGB_DIPLOMA
call GetSGBLayout
call DisableLCD
call LoadNamingScreenGFX
@@ -65,9 +65,8 @@
ld e, a
ld d, 0
ld hl, .Jumptable
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -401,9 +400,8 @@
ld e, a
ld d, $0
ld hl, .Jumptable
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -662,9 +660,8 @@
jr nz, .asm_11ade
ld a, $4
.asm_11ade
-rept 2
dec a
-endr
+ dec a
ld e, a
add a
add e
@@ -989,15 +986,15 @@
; 11e5d
GFX_11e5d: ; ????
-INCBIN "gfx/unknown/011e5d.2bpp"
+INCBIN "gfx/unknown/011e5d.1bpp"
; 11e6d
NamingScreenGFX_MiddleLine:
-INCBIN "gfx/unknown/011e65.2bpp"
+INCBIN "gfx/unknown/011e65.1bpp"
; 11e6d
NamingScreenGFX_UnderLine: ; 11e6d
-INCBIN "gfx/unknown/011e6d.2bpp"
+INCBIN "gfx/unknown/011e6d.1bpp"
; 11e75
_ComposeMailMessage: ; 11e75 (mail?)
@@ -1052,7 +1049,7 @@
ld a, $e3
ld [rLCDC], a
call .initwNamingScreenMaxNameLength
- ld b, SCGB_08
+ ld b, SCGB_DIPLOMA
call GetSGBLayout
call WaitBGMap
call WaitTop
@@ -1164,9 +1161,8 @@
ld e, a
ld d, 0
ld hl, .Jumptable
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -1391,9 +1387,8 @@
jr nz, .wrap_around_command_left
ld a, $4
.wrap_around_command_left
-rept 2
dec a
-endr
+ dec a
ld e, a
add a
add e
@@ -1476,9 +1471,8 @@
jr nz, .asm_121c3
push hl
ld hl, wNamingScreenCurrNameLength
-rept 2
dec [hl]
-endr
+ dec [hl]
jr .asm_121c8
.asm_121c3
--- a/engine/npc_movement.asm
+++ b/engine/npc_movement.asm
@@ -320,7 +320,7 @@
xor a
.loop
ld [hObjectStructIndexBuffer], a
- call GetObjectSprite
+ call DoesObjectHaveASprite
jr z, .next
ld hl, OBJECT_FLAGS1
@@ -490,7 +490,7 @@
xor a
.loop
ld [hObjectStructIndexBuffer], a
- call GetObjectSprite
+ call DoesObjectHaveASprite
jr z, .next
ld hl, OBJECT_MOVEMENTTYPE
add hl, bc
--- a/engine/npctrade.asm
+++ b/engine/npctrade.asm
@@ -311,9 +311,8 @@
ld e, a
ld d, 0
ld hl, NPCTrades
-rept 2
add hl, de
-endr
+ add hl, de
pop de
add hl, de
ret
@@ -458,9 +457,8 @@
call AddNTimes
ld a, [wcf64]
ld c, a
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
--- a/engine/options_menu.asm
+++ b/engine/options_menu.asm
@@ -32,7 +32,7 @@
inc a
ld [hBGMapMode], a
call WaitBGMap
- ld b, SCGB_08
+ ld b, SCGB_DIPLOMA
call GetSGBLayout
call SetPalettes
@@ -85,9 +85,8 @@
ld e, a ; copy it to de
ld d, 0
ld hl, .Pointers
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -143,9 +142,8 @@
.NonePressed:
ld b, 0
ld hl, .Strings
-rept 2
add hl, bc
-endr
+ add hl, bc
ld e, [hl]
inc hl
ld d, [hl]
@@ -363,9 +361,8 @@
.NonePressed:
ld b, $0
ld hl, .Strings
-rept 2
add hl, bc
-endr
+ add hl, bc
ld e, [hl]
inc hl
ld d, [hl]
--- a/engine/overworld.asm
+++ b/engine/overworld.asm
@@ -23,7 +23,7 @@
push af
res 7, [hl]
set 6, [hl]
- call RunCallback_04
+ call MapCallbackSprites_LoadUsedSpritesGFX
pop af
ld [wSpriteFlags], a
ret
@@ -35,7 +35,7 @@
push af
set 7, [hl]
res 6, [hl]
- call RunCallback_04
+ call MapCallbackSprites_LoadUsedSpritesGFX
pop af
ld [wSpriteFlags], a
ret
@@ -43,7 +43,7 @@
RefreshSprites:: ; 14168
call .Refresh
- call RunCallback_04
+ call MapCallbackSprites_LoadUsedSpritesGFX
ret
; 1416f
@@ -147,9 +147,8 @@
ld c, a
ld b, 0
ld hl, OutdoorSprites
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
@@ -165,7 +164,7 @@
; 14209
-RunCallback_04: ; 14209
+MapCallbackSprites_LoadUsedSpritesGFX: ; 14209
ld a, MAPCALLBACK_SPRITES
call RunMapCallback
call GetUsedSprites
@@ -364,9 +363,8 @@
jr z, .exists
and a
jr z, .new
-rept 2
inc hl
-endr
+ inc hl
dec c
jr nz, .loop
@@ -428,9 +426,8 @@
ld a, [de]
and a
jr nz, .FoundLastSprite
-rept 2
dec de
-endr
+ dec de
dec c
jr nz, .FindLastSprite
.FoundLastSprite:
@@ -472,16 +469,14 @@
; Keep doing this until everything's in order.
.loop
-rept 2
dec de
-endr
+ dec de
dec c
jr nz, .CheckFollowing
pop hl
-rept 2
inc hl
-endr
+ inc hl
pop de
pop bc
dec c
--- a/engine/pack.asm
+++ b/engine/pack.asm
@@ -1252,9 +1252,8 @@
Pack_GetJumptablePointer: ; 1086b
ld e, a
ld d, 0
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -1300,9 +1299,8 @@
jr nz, .female
.male_dude
ld hl, PackGFXPointers
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld e, a
ld d, [hl]
--- a/engine/party_menu.asm
+++ b/engine/party_menu.asm
@@ -20,7 +20,7 @@
call ClearBGPalettes
call InitPartyMenuLayout
call WaitBGMap
- ld b, SCGB_0A
+ ld b, SCGB_PARTY_MENU
call GetSGBLayout
call SetPalettes
call DelayFrame
@@ -110,9 +110,8 @@
jr nz, .loop
.end
-rept 2
dec hl
-endr
+ dec hl
ld de, .CANCEL
call PlaceString
ret
@@ -161,7 +160,7 @@
inc b
dec c
jr nz, .loop
- ld b, SCGB_0A
+ ld b, SCGB_PARTY_MENU
call GetSGBLayout
ret
; 50117
@@ -219,9 +218,8 @@
pop de
ld a, "/"
ld [hli], a
-rept 2
inc de
-endr
+ inc de
lb bc, 2, 3
call PrintNum
@@ -390,9 +388,8 @@
ld e, a
ld d, 0
ld hl, EvosAttacksPointers
-rept 2
add hl, de
-endr
+ add hl, de
call .DetermineCompatibility
pop hl
call PlaceString
@@ -426,19 +423,16 @@
ld a, [hli]
and a
jr z, .nope
-rept 2
inc hl
-endr
+ inc hl
cp EVOLVE_ITEM
jr nz, .loop2
-rept 2
dec hl
-endr
+ dec hl
ld a, [CurItem]
cp [hl]
-rept 2
inc hl
-endr
+ inc hl
jr nz, .loop2
ld de, .string_able
ret
@@ -613,9 +607,8 @@
ld e, a
ld d, 0
ld hl, .Pointers
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -794,9 +787,8 @@
ld hl, PartyMenuStrings
ld e, a
ld d, $0
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld d, [hl]
ld e, a
@@ -932,9 +924,8 @@
.PrintText: ; 505c1
ld e, a
ld d, 0
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
--- a/engine/phone.asm
+++ b/engine/phone.asm
@@ -266,9 +266,8 @@
jr nc, .NoPhoneCall
call .DoSpecialPhoneCall
-rept 2
inc hl
-endr
+ inc hl
ld a, [hli]
ld e, a
push hl
@@ -520,9 +519,8 @@
call Phone_CallerTextbox
hlcoord 1, 2
ld [hl], $62
-rept 2
inc hl
-endr
+ inc hl
ld a, [PhoneScriptBank]
ld b, a
ld a, [PhoneCallerLo]
@@ -621,9 +619,8 @@
call Phone_CallerTextbox
hlcoord 1, 1
ld [hl], $62
-rept 2
inc hl
-endr
+ inc hl
ld d, h
ld e, l
pop bc
@@ -699,9 +696,8 @@
ld c, b
ld b, 0
ld hl, NonTrainerCallerNames
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld e, a
ld d, [hl]
--- a/engine/player_movement.asm
+++ b/engine/player_movement.asm
@@ -1,7 +1,7 @@
DoPlayerMovement:: ; 80000
call .GetDPad
- ld a, movement_step_sleep_1
+ ld a, movement_step_sleep
ld [MovementAnimation], a
xor a
ld [wd041], a
@@ -233,12 +233,12 @@
; If the player is turning, change direction first. This also lets
; the player change facing without moving by tapping a direction.
- ld a, [wd04e]
+ ld a, [wPlayerTurningDirection]
cp 0
- jr nz, .asm_80169
+ jr nz, .not_turning
ld a, [WalkingDirection]
cp STANDING
- jr z, .asm_80169
+ jr z, .not_turning
ld e, a
ld a, [PlayerDirection]
@@ -246,7 +246,7 @@
rrca
and 3
cp e
- jr z, .asm_80169
+ jr z, .not_turning
ld a, STEP_TURN
call .DoStep
@@ -254,7 +254,7 @@
scf
ret
-.asm_80169
+.not_turning
xor a
ret
; 8016b
@@ -465,10 +465,10 @@
ld a, [hl]
ld [MovementAnimation], a
- ld hl, .InPlace
+ ld hl, .FinishFacing
add hl, de
ld a, [hl]
- ld [wd04e], a
+ ld [wPlayerTurningDirection], a
ld a, 4
ret
@@ -481,54 +481,54 @@
dw .SlideStep
dw .TurningStep
dw .BackJumpStep
- dw .InPlace
+ dw .FinishFacing
.SlowStep:
- slow_step_down
- slow_step_up
- slow_step_left
- slow_step_right
+ slow_step DOWN
+ slow_step UP
+ slow_step LEFT
+ slow_step RIGHT
.NormalStep:
- step_down
- step_up
- step_left
- step_right
+ step DOWN
+ step UP
+ step LEFT
+ step RIGHT
.FastStep:
- big_step_down
- big_step_up
- big_step_left
- big_step_right
+ big_step DOWN
+ big_step UP
+ big_step LEFT
+ big_step RIGHT
.JumpStep:
- jump_step_down
- jump_step_up
- jump_step_left
- jump_step_right
+ jump_step DOWN
+ jump_step UP
+ jump_step LEFT
+ jump_step RIGHT
.SlideStep:
- fast_slide_step_down
- fast_slide_step_up
- fast_slide_step_left
- fast_slide_step_right
+ fast_slide_step DOWN
+ fast_slide_step UP
+ fast_slide_step LEFT
+ fast_slide_step RIGHT
.BackJumpStep:
- jump_step_up
- jump_step_down
- jump_step_right
- jump_step_left
+ jump_step UP
+ jump_step DOWN
+ jump_step RIGHT
+ jump_step LEFT
.TurningStep:
- turn_step_down
- turn_step_up
- turn_step_left
- turn_step_right
-.InPlace:
- db $80 + movement_turn_head_down
- db $80 + movement_turn_head_up
- db $80 + movement_turn_head_left
- db $80 + movement_turn_head_right
+ turn_step DOWN
+ turn_step UP
+ turn_step LEFT
+ turn_step RIGHT
+.FinishFacing:
+ db $80 + DOWN
+ db $80 + UP
+ db $80 + LEFT
+ db $80 + RIGHT
; 802b3
.StandInPlace: ; 802b3
ld a, 0
- ld [wd04e], a
- ld a, movement_step_sleep_1
+ ld [wPlayerTurningDirection], a
+ ld a, movement_step_sleep
ld [MovementAnimation], a
xor a
ret
@@ -536,7 +536,7 @@
._WalkInPlace: ; 802bf
ld a, 0
- ld [wd04e], a
+ ld [wPlayerTurningDirection], a
ld a, movement_step_bump
ld [MovementAnimation], a
xor a
@@ -549,7 +549,7 @@
call CheckStandingOnIce
ret nc
- ld a, [wd04e]
+ ld a, [wPlayerTurningDirection]
cp 0
ret z
@@ -812,7 +812,7 @@
; 80404
CheckStandingOnIce:: ; 80404
- ld a, [wd04e]
+ ld a, [wPlayerTurningDirection]
cp 0
jr z, .not_ice
cp $f0
@@ -833,14 +833,14 @@
ret
; 80422
-Function80422:: ; 80422
+StopPlayerForEvent:: ; 80422
ld hl, wPlayerNextMovement
- ld a, movement_step_sleep_1
+ ld a, movement_step_sleep
cp [hl]
ret z
ld [hl], a
ld a, 0
- ld [wd04e], a
+ ld [wPlayerTurningDirection], a
ret
; 80430
--- a/engine/player_object.asm
+++ b/engine/player_object.asm
@@ -474,7 +474,7 @@
sub [hl]
and $f
swap a
- ld hl, wFollowNotExactPersonY
+ ld hl, wPlayerBGMapOffsetY
sub [hl]
ld hl, OBJECT_SPRITE_Y
add hl, de
@@ -492,7 +492,7 @@
sub [hl]
and $f
swap a
- ld hl, wFollowNotExactPersonX
+ ld hl, wPlayerBGMapOffsetX
sub [hl]
ld hl, OBJECT_SPRITE_X
add hl, de
@@ -516,7 +516,7 @@
TrainerWalkToPlayer: ; 831e
ld a, [hLastTalked]
call InitMovementBuffer
- ld a, movement_step_sleep_1
+ ld a, movement_step_sleep
call AppendToMovementBuffer
ld a, [wd03f]
dec a
@@ -598,10 +598,10 @@
ret
.movement_data
- slow_step_down
- slow_step_up
- slow_step_left
- slow_step_right
+ slow_step DOWN
+ slow_step UP
+ slow_step LEFT
+ slow_step RIGHT
FollowNotExact:: ; 839e
push bc
@@ -660,7 +660,7 @@
sub [hl]
and $f
swap a
- ld hl, wFollowNotExactPersonX
+ ld hl, wPlayerBGMapOffsetX
sub [hl]
ld hl, OBJECT_SPRITE_X
add hl, de
@@ -673,7 +673,7 @@
sub [hl]
and $f
swap a
- ld hl, wFollowNotExactPersonY
+ ld hl, wPlayerBGMapOffsetY
sub [hl]
ld hl, OBJECT_SPRITE_Y
add hl, de
@@ -827,12 +827,12 @@
jr z, .check_y
jr c, .left
and a
- ld a, movement_step_right
+ ld a, movement_step + RIGHT
ret
.left
and a
- ld a, movement_step_left
+ ld a, movement_step + LEFT
ret
.check_y
@@ -843,12 +843,12 @@
jr z, .same_xy
jr c, .up
and a
- ld a, movement_step_down
+ ld a, movement_step + DOWN
ret
.up
and a
- ld a, movement_step_up
+ ld a, movement_step + UP
ret
.same_xy
--- a/engine/player_step.asm
+++ b/engine/player_step.asm
@@ -26,12 +26,12 @@
ld d, a
ld a, [wPlayerStepVectorY]
ld e, a
- ld a, [wFollowNotExactPersonX]
+ ld a, [wPlayerBGMapOffsetX]
sub d
- ld [wFollowNotExactPersonX], a
- ld a, [wFollowNotExactPersonY]
+ ld [wPlayerBGMapOffsetX], a
+ ld a, [wPlayerBGMapOffsetY]
sub e
- ld [wFollowNotExactPersonY], a
+ ld [wPlayerBGMapOffsetY], a
ret
ScrollScreen:: ; d4d2 (3:54d2)
--- a/engine/pokedex.asm
+++ b/engine/pokedex.asm
@@ -694,9 +694,9 @@
.show_search_results
ld [wDexListingEnd], a
ld a, [wDexListingScrollOffset]
- ld [wc7e0], a
+ ld [wDexListingScrollOffsetBackup], a
ld a, [wDexListingCursor]
- ld [wc7e1], a
+ ld [wDexListingCursorBackup], a
ld a, [wLastDexEntry]
ld [wcf65], a
xor a
@@ -777,9 +777,9 @@
ret
.return_to_search_screen
- ld a, [wc7e0]
+ ld a, [wDexListingScrollOffsetBackup]
ld [wDexListingScrollOffset], a
- ld a, [wc7e1]
+ ld a, [wDexListingCursorBackup]
ld [wDexListingCursor], a
ld a, [wcf65]
ld [wLastDexEntry], a
@@ -823,7 +823,7 @@
call DelayFrame
call Pokedex_CheckSGB
jr nz, .decompress
- callba Function1ddf26
+ callba LoadSGBPokedexGFX2
jr .done
.decompress
@@ -2385,9 +2385,8 @@
Pokedex_LoadPointer: ; 41432
ld e, a
ld d, 0
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
--- a/engine/pokegear.asm
+++ b/engine/pokegear.asm
@@ -516,7 +516,7 @@
callba PrintHoursMins
ld hl, .DayText
bccoord 6, 6
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
ret
; 90fa8 (24:4fa8)
@@ -711,7 +711,7 @@
push de
callba GetLandmarkName
pop de
- callba Function1de2c5
+ callba TownMap_ConvertLineBreakCharacters
hlcoord 8, 0
ld [hl], $34
ret
--- a/engine/predef.asm
+++ b/engine/predef.asm
@@ -12,9 +12,9 @@
ld e, a
ld d, 0
ld hl, PredefPointers
-rept 3
- add hl,de
-endr
+ add hl, de
+ add hl, de
+ add hl, de
pop de
ld a, [hli]
@@ -64,7 +64,7 @@
add_predef CopyPkmnToTempMon
add_predef ListMoves ; $20
add_predef PlaceNonFaintStatus
- add_predef Function50cdb
+ add_predef Predef22
add_predef ListMovePP
add_predef GetGender
add_predef StatsScreenInit
@@ -78,7 +78,7 @@
add_predef GetUnownLetter
add_predef LoadPoisonBGPals
add_predef Predef2F
- add_predef Function9853 ; $30
+ add_predef InitSGBBorder ; $30
add_predef Predef_LoadSGBLayout
add_predef _Area
add_predef CheckContestMon
@@ -102,7 +102,7 @@
add_predef PlaceStatusString
add_predef LoadMonAnimation
add_predef AnimateFrontpic
- add_predef Functiond0669 ; $48
+ add_predef Predef48 ; $48
add_predef HOF_AnimateFrontpic
- dbw $ff, Function2d43 ; ????
+ dbw $ff, InexplicablyEmptyFunction ; ???
; 864c
--- a/engine/printer.asm
+++ b/engine/printer.asm
@@ -1,670 +1,63 @@
-Function84000: ; 84000
- ld hl, OverworldMap
- lb bc, 4, 12
- xor a
- call Function842ab
- xor a
- ld [rSB], a
- ld [rSC], a
- ld [wc2d5], a
- ld hl, wc2d4
- set 0, [hl]
- ld a, [GBPrinter]
- ld [wcbfb], a
- xor a
- ld [wJumptableIndex], a
- ret
-; 84022
+INCLUDE "engine/printer/serial.asm"
-Function84022: ; 84022
- ld a, [wJumptableIndex]
- ld e, a
- ld d, 0
- ld hl, .Jumptable
-rept 2
- add hl, de
-endr
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp [hl]
-; 84031
-
-
-.Jumptable: ; 84031 (21:4031)
-
- dw Function84077
- dw Function84143
- dw Function84120
- dw Function84099
- dw Function84180
- dw Function8412e
- dw Function840c5
- dw Function84180
- dw Function84120
- dw Function840de
- dw Function84180
- dw Function84120
- dw Function841a1
- dw Function84063
- dw Function8406d
- dw Function84120
- dw Function84103
- dw Function84071
- dw Function841b0
- dw Function841b3
-
-
-Function84059: ; 84059 (21:4059)
- ld hl, wJumptableIndex
- inc [hl]
- ret
-
-Function8405e: ; 8405e (21:405e)
- ld hl, wJumptableIndex
- dec [hl]
- ret
-
-Function84063: ; 84063 (21:4063)
- xor a
- ld [wca89], a
- ld hl, wJumptableIndex
- set 7, [hl]
- ret
-
-Function8406d: ; 8406d (21:406d)
- call Function84059
- ret
-
-Function84071: ; 84071 (21:4071)
- ld a, $1
- ld [wJumptableIndex], a
- ret
-
-Function84077: ; 84077 (21:4077)
- call Function841fb
- ld hl, Unknown_842b7
- call Function841e2
- xor a
- ld [wca8e], a
- ld [wca8f], a
- ld a, [wcf65]
- ld [wca81], a
- call Function84059
- call Function841c3
- ld a, $1
- ld [wcbf8], a
- ret
-
-Function84099: ; 84099 (21:4099)
- call Function841fb
- ld hl, wca81
- ld a, [hl]
- and a
- jr z, Function840c5
- ld hl, Unknown_842c3
- call Function841e2
- call Function84260
- ld a, $80
- ld [wca8e], a
- ld a, $2
- ld [wca8f], a
- call Function84219
- call Function84059
- call Function841c3
- ld a, $2
- ld [wcbf8], a
- ret
-
-Function840c5: ; 840c5 (21:40c5)
- ld a, $6
- ld [wJumptableIndex], a
- ld hl, Unknown_842c9
- call Function841e2
- xor a
- ld [wca8e], a
- ld [wca8f], a
- call Function84059
- call Function841c3
- ret
-
-Function840de: ; 840de (21:40de)
- call Function841fb
- ld hl, Unknown_842bd
- call Function841e2
- call Function84249
- ld a, $4
- ld [wca8e], a
- ld a, $0
- ld [wca8f], a
- call Function84219
- call Function84059
- call Function841c3
- ld a, $3
- ld [wcbf8], a
- ret
-
-Function84103: ; 84103 (21:4103)
- call Function841fb
- ld hl, Unknown_842b7
- call Function841e2
- xor a
- ld [wca8e], a
- ld [wca8f], a
- ld a, [wcf65]
- ld [wca81], a
- call Function84059
- call Function841c3
- ret
-
-Function84120: ; 84120 (21:4120)
- ld hl, wca8b
- inc [hl]
- ld a, [hl]
- cp $6
- ret c
- xor a
- ld [hl], a
- call Function84059
- ret
-
-Function8412e: ; 8412e (21:412e)
- ld hl, wca8b
- inc [hl]
- ld a, [hl]
- cp $6
- ret c
- xor a
- ld [hl], a
- ld hl, wca81
- dec [hl]
- call Function8405e
- call Function8405e
- ret
-
-Function84143: ; 84143 (21:4143)
- ld a, [wc2d5]
- and a
- ret nz
- ld a, [wca88]
- cp $ff
- jr nz, .printer_connected
- ld a, [wca89]
- cp $ff
- jr z, .printer_error
-
-.printer_connected
- ld a, [wca88]
- cp $81
- jr nz, .printer_error
- ld a, [wca89]
- cp $0
- jr nz, .printer_error
- ld hl, wc2d4
- set 1, [hl]
- ld a, $5
- ld [wca8a], a
- call Function84059
- ret
-
-.printer_error
- ld a, $ff
- ld [wca88], a
- ld [wca89], a
- ld a, $e
- ld [wJumptableIndex], a
- ret
-
-Function84180: ; 84180 (21:4180)
- ld a, [wc2d5]
- and a
- ret nz
- ld a, [wca89]
- and $f0
- jr nz, .asm_8419b
- ld a, [wca89]
- and $1
- jr nz, .asm_84197
- call Function84059
- ret
-.asm_84197
- call Function8405e
- ret
-.asm_8419b
- ld a, $12
- ld [wJumptableIndex], a
- ret
-
-Function841a1: ; 841a1 (21:41a1)
- ld a, [wc2d5]
- and a
- ret nz
- ld a, [wca89]
- and $f3
- ret nz
- call Function84059
- ret
-
-Function841b0: ; 841b0 (21:41b0)
- call Function84059
-
-Function841b3: ; 841b3 (21:41b3)
- ld a, [wc2d5]
- and a
- ret nz
- ld a, [wca89]
- and $f0
- ret nz
- xor a
- ld [wJumptableIndex], a
- ret
-
-Function841c3: ; 841c3 (21:41c3)
- ld a, [wc2d5]
- and a
- jr nz, Function841c3
- xor a
- ld [wca8c], a
- ld [wca8d], a
- ld a, $1
- ld [wc2d5], a
- ld a, $88
- ld [rSB], a
- ld a, $1
- ld [rSC], a
- ld a, $81
- ld [rSC], a
- ret
-
-Function841e2: ; 841e2 (21:41e2)
- ld a, [hli]
- ld [wca82], a
- ld a, [hli]
- ld [wca83], a
- ld a, [hli]
- ld [wca84], a
- ld a, [hli]
- ld [wca85], a
- ld a, [hli]
- ld [wca86], a
- ld a, [hl]
- ld [wca87], a
- ret
-
-Function841fb: ; 841fb (21:41fb)
- xor a
- ld hl, wca82
-rept 3
- ld [hli], a
-endr
- ld [hl], a
- ld hl, wca86
- ld [hli], a
- ld [hl], a
- xor a
- ld [wca8e], a
- ld [wca8f], a
- ld hl, OverworldMap
- ld bc, $280
- call Function842ab
- ret
-
-Function84219: ; 84219 (21:4219)
- ld hl, 0
- ld bc, $4
- ld de, wca82
- call Function8423c
- ld a, [wca8e]
- ld c, a
- ld a, [wca8f]
- ld b, a
- ld de, OverworldMap
- call Function8423c
- ld a, l
- ld [wca86], a
- ld a, h
- ld [wca87], a
- ret
-
-Function8423c: ; 8423c (21:423c)
- ld a, [de]
- inc de
- add l
- jr nc, .asm_84242
- inc h
-.asm_84242
- ld l, a
- dec bc
- ld a, c
- or b
- jr nz, Function8423c
- ret
-
-Function84249: ; 84249 (21:4249)
- ld a, $1
- ld [OverworldMap], a
- ld a, [wcbfa]
- ld [wc801], a
- ld a, $e4
- ld [wc802], a
- ld a, [wcbfb]
- ld [wc803], a
- ret
-
-Function84260: ; 84260 (21:4260)
- ld a, [wca81]
- xor $ff
- ld d, a
- ld a, [wcf65]
- inc a
- add d
- ld hl, wca90
- ld de, $28
-.asm_84271
- and a
- jr z, .asm_84278
- add hl, de
- dec a
- jr .asm_84271
-.asm_84278
- ld e, l
- ld d, h
- ld hl, OverworldMap
- ld c, $28
-.asm_8427f
- ld a, [de]
- inc de
- push bc
- push de
- push hl
- swap a
- ld d, a
- and $f0
- ld e, a
- ld a, d
- and $f
- ld d, a
- and $8
- ld a, d
- jr nz, .asm_84297
- or $90
- jr .asm_84299
-.asm_84297
- or $80
-.asm_84299
- ld d, a
- lb bc, $21, 1
- call Request2bpp
- pop hl
- ld de, $10
- add hl, de
- pop de
- pop bc
- dec c
- jr nz, .asm_8427f
- ret
-
-Function842ab: ; 842ab
- push de
- ld e, a
-.asm_842ad
- ld [hl], e
- inc hl
- dec bc
- ld a, c
- or b
- jr nz, .asm_842ad
- ld a, e
- pop de
- ret
-; 842b7
-
-Unknown_842b7: db 1, 0, $00, 0, 1, 0
-Unknown_842bd: db 2, 0, $04, 0, 0, 0
-Unknown_842c3: db 4, 0, $80, 2, 0, 0
-Unknown_842c9: db 4, 0, $00, 0, 4, 0
-Unknown_842cf: db 8, 0, $00, 0, 8, 0 ; unused
-Unknown_842d5: db 15, 0, $00, 0, 15, 0 ; unused
-; 842db
-
-
-_PrinterReceive:: ; 842db
- ld a, [wc2d5]
- add a
- ld e, a
- ld d, 0
- ld hl, .Jumptable
- add hl, de
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp [hl]
-; 842ea
-
-
-.Jumptable: ; 842ea (21:42ea)
-
- dw Function8432f
- dw Function84330
- dw Function84339
- dw Function84343
- dw Function8434d
- dw Function84357
- dw Function84361
- dw Function8438b
- dw Function84395
- dw Function8439f
- dw Function843a8
- dw Function843b6
- dw Function84330
- dw Function843c0
- dw Function843c9
- dw Function843c9
- dw Function843c9
- dw Function843c0
- dw Function843c9
- dw Function8439f
- dw Function843a8
- dw Function843e6
- dw Function84330
- dw Function843d2
- dw Function843c9
- dw Function843c9
- dw Function843c9
- dw Function843d2
- dw Function843c9
- dw Function8439f
- dw Function843a8
- dw Function843b6
-
-
-Function8432a: ; 8432a (21:432a)
- ld hl, wc2d5
- inc [hl]
- ret
-
-Function8432f: ; 8432f (21:432f)
- ret
-
-Function84330: ; 84330 (21:4330)
- ld a, $33
- call Function843db
- call Function8432a
- ret
-
-Function84339: ; 84339 (21:4339)
- ld a, [wca82]
- call Function843db
- call Function8432a
- ret
-
-Function84343: ; 84343 (21:4343)
- ld a, [wca83]
- call Function843db
- call Function8432a
- ret
-
-Function8434d: ; 8434d (21:434d)
- ld a, [wca84]
- call Function843db
- call Function8432a
- ret
-
-Function84357: ; 84357 (21:4357)
- ld a, [wca85]
- call Function843db
- call Function8432a
- ret
-
-Function84361: ; 84361 (21:4361)
- ld hl, wca8e
- ld a, [hli]
- ld d, [hl]
- ld e, a
- or d
- jr z, .asm_84388
- dec de
- ld [hl], d
- dec hl
- ld [hl], e
- ld a, [wca8c]
- ld e, a
- ld a, [wca8d]
- ld d, a
- ld hl, OverworldMap
- add hl, de
- inc de
- ld a, e
- ld [wca8c], a
- ld a, d
- ld [wca8d], a
- ld a, [hl]
- call Function843db
- ret
-.asm_84388
- call Function8432a
-
-Function8438b: ; 8438b (21:438b)
- ld a, [wca86]
- call Function843db
- call Function8432a
- ret
-
-Function84395: ; 84395 (21:4395)
- ld a, [wca87]
- call Function843db
- call Function8432a
- ret
-
-Function8439f: ; 8439f (21:439f)
- ld a, $0
- call Function843db
- call Function8432a
- ret
-
-Function843a8: ; 843a8 (21:43a8)
- ld a, [rSB]
- ld [wca88], a
- ld a, $0
- call Function843db
- call Function8432a
- ret
-
-Function843b6: ; 843b6 (21:43b6)
- ld a, [rSB]
- ld [wca89], a
- xor a
- ld [wc2d5], a
- ret
-
-Function843c0: ; 843c0 (21:43c0)
- ld a, $f
- call Function843db
- call Function8432a
- ret
-
-Function843c9: ; 843c9 (21:43c9)
- ld a, $0
- call Function843db
- call Function8432a
- ret
-
-Function843d2: ; 843d2 (21:43d2)
- ld a, $8
- call Function843db
- call Function8432a
- ret
-
-Function843db: ; 843db (21:43db)
- ld [rSB], a
- ld a, $1
- ld [rSC], a
- ld a, $81
- ld [rSC], a
- ret
-
-Function843e6: ; 843e6 (21:43e6)
- ld a, [rSB]
- ld [wca89], a
- xor a
- ld [wc2d5], a
- ret
-
-Function843f0: ; 843f0
-.asm_843f0
+SendScreenToPrinter: ; 843f0
+.loop
call JoyTextDelay
- call Function846f6
- jr c, .asm_8440f
+ call CheckCancelPrint
+ jr c, .cancel
ld a, [wJumptableIndex]
bit 7, a
- jr nz, .asm_8440d
- call Function84022
- call Function84757
- call Function84785
+ jr nz, .finished
+ call PrinterJumptableIteration
+ call CheckPrinterStatus
+ call PlacePrinterStatusString
call DelayFrame
- jr .asm_843f0
+ jr .loop
-.asm_8440d
+.finished
and a
ret
-.asm_8440f
+.cancel
scf
ret
; 84411
-Function84411: ; 84411
+Printer_CleanUpAfterSend: ; 84411
xor a
- ld [wc2d4], a
- ld [wc2d5], a
+ ld [wPrinterConnectionOpen], a
+ ld [wPrinterOpcode], a
ret
; 84419
-Function84419: ; 84419
+Printer_PrepareTileMapForPrint: ; 84419
push af
- call Function84000
+ call Printer_StartTransmission
pop af
ld [wcbfa], a
- call Function84728
+ call Printer_CopyTileMapToBuffer
ret
; 84425
-Function84425: ; 84425
+Printer_ExitPrinter: ; 84425
call ReturnToMapFromSubmenu
- call Function84753
+ call Printer_RestartMapMusic
ret
; 8442c
PrintDexEntry: ; 8442c
- ld a, [wcf65]
+ ld a, [wPrinterQueueLength]
push af
+
ld hl, VTiles1
ld de, FontInversed
lb bc, BANK(FontInversed), $80
call Request1bpp
+
xor a
ld [hPrinter], a
- call Function8474c
+ call Printer_PlayMusic
+
ld a, [rIE]
push af
xor a
@@ -671,144 +64,164 @@
ld [rIF], a
ld a, $9
ld [rIE], a
- call Function84000
+
+ call Printer_StartTransmission
ld a, $10
ld [wcbfa], a
callba PrintPage1
call ClearTileMap
- ld a, $e4
+ ld a, %11100100
call DmgToCgbBGPals
call DelayFrame
+
ld hl, hVBlank
ld a, [hl]
push af
ld [hl], $4
- ld a, $8
- ld [wcf65], a
- call Function84742
- call Function843f0
- jr c, .asm_8449d
- call Function84411
+
+ ld a, 8 ; 16 rows
+ ld [wPrinterQueueLength], a
+ call Printer_ResetJoypadRegisters
+ call SendScreenToPrinter
+ jr c, .skip_second_page ; canceled or got an error
+
+ call Printer_CleanUpAfterSend
ld c, 12
call DelayFrames
xor a
ld [hBGMapMode], a
- call Function84000
+
+ call Printer_StartTransmission
ld a, $3
ld [wcbfa], a
callba PrintPage2
- call Function84742
- ld a, $4
- ld [wcf65], a
- call Function843f0
+ call Printer_ResetJoypadRegisters
+ ld a, 4
+ ld [wPrinterQueueLength], a
+ call SendScreenToPrinter
-.asm_8449d
+.skip_second_page
pop af
ld [hVBlank], a
- call Function84411
+ call Printer_CleanUpAfterSend
+
xor a
ld [rIF], a
pop af
ld [rIE], a
- call Function84425
- ld c, $8
-.asm_844ae
+
+ call Printer_ExitPrinter
+ ld c, 8
+.low_volume_delay_frames
call LowVolume
call DelayFrame
dec c
- jr nz, .asm_844ae
+ jr nz, .low_volume_delay_frames
+
pop af
- ld [wcf65], a
+ ld [wPrinterQueueLength], a
ret
; 844bc
PrintPCBox: ; 844bc (21:44bc)
- ld a, [wcf65]
+ ld a, [wPrinterQueueLength]
push af
- ld a, $9
- ld [wcf65], a
+ ld a, 18 / 2
+ ld [wPrinterQueueLength], a
+
ld a, e
- ld [wd004], a
+ ld [wAddrOfBoxToPrint], a
ld a, d
- ld [wd005], a
+ ld [wAddrOfBoxToPrint + 1], a
ld a, b
- ld [wd006], a
+ ld [wBankOfBoxToPrint], a
ld a, c
- ld [wd007], a
+ ld [wWhichBoxToPrint], a
+
xor a
ld [hPrinter], a
- ld [wd003], a
- call Function8474c
+ ld [wFinishedPrintingBox], a
+ call Printer_PlayMusic
+
ld a, [rIE]
push af
xor a
ld [rIF], a
- ld a, $9
+ ld a, %1001
ld [rIE], a
+
ld hl, hVBlank
ld a, [hl]
push af
- ld [hl], $4
+ ld [hl], %0100
+
xor a
ld [hBGMapMode], a
- call Function84817
- ld a, $10
- call Function84419
- call Function84559
- jr c, .asm_84545
- call Function84411
+ call PrintPCBox_Page1
+ ld a, $10 ; to be loaded to wcbfa
+ call Printer_PrepareTileMapForPrint
+ call Printer_ResetRegistersAndStartDataSend
+ jr c, .cancel
+
+ call Printer_CleanUpAfterSend
ld c, 12
call DelayFrames
xor a
ld [hBGMapMode], a
- call Function8486f
- ld a, $0
- call Function84419
- call Function84559
- jr c, .asm_84545
- call Function84411
+ call PrintPCBox_Page2
+ ld a, $0 ; to be loaded to wcbfa
+ call Printer_PrepareTileMapForPrint
+ call Printer_ResetRegistersAndStartDataSend
+ jr c, .cancel
+
+ call Printer_CleanUpAfterSend
ld c, 12
call DelayFrames
+
xor a
ld [hBGMapMode], a
- call Function84893
- ld a, $0
- call Function84419
- call Function84559
- jr c, .asm_84545
- call Function84411
+ call PrintPCBox_Page3
+ ld a, $0 ; to be loaded to wcbfa
+ call Printer_PrepareTileMapForPrint
+ call Printer_ResetRegistersAndStartDataSend
+ jr c, .cancel
+
+ call Printer_CleanUpAfterSend
ld c, 12
call DelayFrames
+
xor a
ld [hBGMapMode], a
- call Function848b7
- ld a, $3
- call Function84419
- call Function84559
-.asm_84545
+ call PrintPCBox_Page4
+ ld a, $3 ; to be loaded to wcbfa
+ call Printer_PrepareTileMapForPrint
+ call Printer_ResetRegistersAndStartDataSend
+.cancel
pop af
ld [hVBlank], a
- call Function84411
+ call Printer_CleanUpAfterSend
+
xor a
ld [rIF], a
pop af
ld [rIE], a
- call Function84425
+ call Printer_ExitPrinter
+
pop af
- ld [wcf65], a
+ ld [wPrinterQueueLength], a
ret
-Function84559: ; 84559 (21:4559)
- call Function84742
- call Function843f0
+Printer_ResetRegistersAndStartDataSend: ; 84559 (21:4559)
+ call Printer_ResetJoypadRegisters
+ call SendScreenToPrinter
ret
PrintUnownStamp: ; 84560
- ld a, [wcf65]
+ ld a, [wPrinterQueueLength]
push af
xor a
ld [hPrinter], a
- call Function8474c
+ call Printer_PlayMusic
ld a, [rIE]
push af
xor a
@@ -822,37 +235,37 @@
xor a
ld [hBGMapMode], a
call LoadTileMapToTempTileMap
- callba Function16dac
- ld a, $0
- call Function84419
+ callba PlaceUnownPrinterFrontpic
+ ld a, $0 ; to be loaded to wcbfa
+ call Printer_PrepareTileMapForPrint
call Call_LoadTempTileMapToTileMap
- call Function84742
- ld a, $9
- ld [wcf65], a
-.asm_84597
+ call Printer_ResetJoypadRegisters
+ ld a, 18 / 2
+ ld [wPrinterQueueLength], a
+.loop
call JoyTextDelay
- call Function846f6
- jr c, .asm_845c0
+ call CheckCancelPrint
+ jr c, .done
ld a, [wJumptableIndex]
bit 7, a
- jr nz, .asm_845c0
- call Function84022
+ jr nz, .done
+ call PrinterJumptableIteration
ld a, [wJumptableIndex]
cp $2
- jr nc, .asm_845b5
- ld a, $3
- ld [wca81], a
+ jr nc, .check_status
+ ld a, 6 / 2
+ ld [wPrinterRowIndex], a
-.asm_845b5
- call Function84757
- call Function84785
+.check_status
+ call CheckPrinterStatus
+ call PlacePrinterStatusString
call DelayFrame
- jr .asm_84597
+ jr .loop
-.asm_845c0
+.done
pop af
ld [hVBlank], a
- call Function84411
+ call Printer_CleanUpAfterSend
call Call_LoadTempTileMapToTileMap
xor a
ld [rIF], a
@@ -859,176 +272,202 @@
pop af
ld [rIE], a
pop af
- ld [wcf65], a
+ ld [wPrinterQueueLength], a
ret
; 845d4
PrintMail: ; 845d4
- call Function845db
- call Function84425
+ call PrintMail_
+ call Printer_ExitPrinter
ret
; 845db
-Function845db: ; 845db
- ld a, [wcf65]
+PrintMail_: ; 845db
+ ld a, [wPrinterQueueLength]
push af
xor a
ld [hPrinter], a
- call Function8474c
+ call Printer_PlayMusic
+
ld a, [rIE]
push af
xor a
ld [rIF], a
- ld a, $9
+ ld a, %1001
ld [rIE], a
+
xor a
ld [hBGMapMode], a
- ld a, $13
- call Function84419
+
+ ld a, $13 ; to be loaded to wcbfa
+ call Printer_PrepareTileMapForPrint
ld hl, hVBlank
ld a, [hl]
push af
- ld [hl], $4
- ld a, $9
- ld [wcf65], a
- call Function843f0
+ ld [hl], %0100
+
+ ld a, 18 / 2
+ ld [wPrinterQueueLength], a
+ call SendScreenToPrinter
+
pop af
ld [hVBlank], a
- call Function84411
- call Function84735
+ call Printer_CleanUpAfterSend
+ call Printer_CopyBufferToTileMap
+
xor a
ld [rIF], a
pop af
ld [rIE], a
+
pop af
- ld [wcf65], a
+ ld [wPrinterQueueLength], a
ret
; 8461a
PrintPartymon: ; 8461a
- ld a, [wcf65]
+ ld a, [wPrinterQueueLength]
push af
xor a
ld [hPrinter], a
- call Function8474c
+ call Printer_PlayMusic
+
ld a, [rIE]
push af
xor a
ld [rIF], a
- ld a, $9
+ ld a, %1001
ld [rIE], a
+
xor a
ld [hBGMapMode], a
- callba Function1dc381
- ld a, $10
- call Function84419
+ callba PrintPartyMonPage1
+ ld a, $10 ; to be loaded to wcbfa
+ call Printer_PrepareTileMapForPrint
+
ld hl, hVBlank
ld a, [hl]
push af
- ld [hl], $4
- ld a, $8
- ld [wcf65], a
- call Function84742
- call Function843f0
- jr c, .asm_84671
- call Function84411
+ ld [hl], %0100
+
+ ld a, 16 / 2
+ ld [wPrinterQueueLength], a
+ call Printer_ResetJoypadRegisters
+ call SendScreenToPrinter
+ jr c, .cancel
+
+ call Printer_CleanUpAfterSend
ld c, 12
call DelayFrames
+
xor a
ld [hBGMapMode], a
- callba Function1dc47b
- ld a, $3
- call Function84419
- ld a, $9
- ld [wcf65], a
- call Function84742
- call Function843f0
+ callba PrintPartyMonPage2
+ ld a, $3 ; to be loaded to wcbfa
+ call Printer_PrepareTileMapForPrint
-.asm_84671
+ ld a, 18 / 2
+ ld [wPrinterQueueLength], a
+ call Printer_ResetJoypadRegisters
+ call SendScreenToPrinter
+.cancel
pop af
ld [hVBlank], a
- call Function84411
- call Function84735
+ call Printer_CleanUpAfterSend
+
+ call Printer_CopyBufferToTileMap
xor a
ld [rIF], a
pop af
ld [rIE], a
- call Function84425
+ call Printer_ExitPrinter
+
pop af
- ld [wcf65], a
+ ld [wPrinterQueueLength], a
ret
; 84688
_PrintDiploma: ; 84688
- ld a, [wcf65]
+ ld a, [wPrinterQueueLength]
push af
- callba Function1dd709
+
+ callba PlaceDiplomaOnScreen
+
xor a
ld [hPrinter], a
- call Function8474c
+ call Printer_PlayMusic
+
ld a, [rIE]
push af
xor a
ld [rIF], a
- ld a, $9
+ ld a, %1001
ld [rIE], a
+
ld hl, hVBlank
ld a, [hl]
push af
- ld [hl], $4
- ld a, $10
- call Function84419
- call Function84742
- ld a, $9
- ld [wcf65], a
- call Function843f0
- jr c, .asm_846e2
- call Function84411
+ ld [hl], %0100
+
+ ld a, $10 ; to be loaded to wcbfa
+ call Printer_PrepareTileMapForPrint
+ call Printer_ResetJoypadRegisters
+
+ ld a, 18 / 2
+ ld [wPrinterQueueLength], a
+ call SendScreenToPrinter
+ jr c, .cancel
+ call Printer_CleanUpAfterSend
ld c, 12
call DelayFrames
+
call LoadTileMapToTempTileMap
xor a
ld [hBGMapMode], a
- callba Function1dd7ae
- ld a, $3
- call Function84419
+
+ callba PrintDiplomaPage2
+
+ ld a, $3 ; to be loaded to wcbfa
+ call Printer_PrepareTileMapForPrint
call Call_LoadTempTileMapToTileMap
- call Function84742
- ld a, $9
- ld [wcf65], a
- call Function843f0
+ call Printer_ResetJoypadRegisters
-.asm_846e2
+ ld a, 18 / 2
+ ld [wPrinterQueueLength], a
+ call SendScreenToPrinter
+.cancel
pop af
ld [hVBlank], a
- call Function84411
+ call Printer_CleanUpAfterSend
+
xor a
ld [rIF], a
pop af
ld [rIE], a
- call Function84425
+ call Printer_ExitPrinter
+
pop af
- ld [wcf65], a
+ ld [wPrinterQueueLength], a
ret
; 846f6
-Function846f6: ; 846f6
+CheckCancelPrint: ; 846f6
ld a, [hJoyDown]
and B_BUTTON
- jr nz, .asm_846fe
+ jr nz, .pressed_b
and a
ret
-.asm_846fe
+.pressed_b
ld a, [wca80]
cp $c
- jr nz, .asm_84722
-.asm_84705
- ld a, [wc2d5]
+ jr nz, .cancel
+.loop
+ ld a, [wPrinterOpcode]
and a
- jr nz, .asm_84705
- ld a, $16
- ld [wc2d5], a
+ jr nz, .loop
+ ld a, $16 ; cancel
+ ld [wPrinterOpcode], a
ld a, $88
ld [rSB], a
ld a, $1
@@ -1035,12 +474,12 @@
ld [rSC], a
ld a, $81
ld [rSC], a
-.asm_8471c
- ld a, [wc2d5]
+.loop2
+ ld a, [wPrinterOpcode]
and a
- jr nz, .asm_8471c
+ jr nz, .loop2
-.asm_84722
+.cancel
ld a, $1
ld [hPrinter], a
scf
@@ -1047,16 +486,16 @@
ret
; 84728
-Function84728: ; 84728
+Printer_CopyTileMapToBuffer: ; 84728
hlcoord 0, 0
- ld de, wca90
+ ld de, wPrinterTileMapBuffer
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
call CopyBytes
ret
; 84735
-Function84735: ; 84735
- ld hl, wca90
+Printer_CopyBufferToTileMap: ; 84735
+ ld hl, wPrinterTileMapBuffer
decoord 0, 0
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
call CopyBytes
@@ -1063,7 +502,7 @@
ret
; 84742
-Function84742: ; 84742
+Printer_ResetJoypadRegisters: ; 84742
xor a
ld [hJoyReleased], a
ld [hJoyPressed], a
@@ -1072,27 +511,29 @@
ret
; 8474c
-Function8474c: ; 8474c
+Printer_PlayMusic: ; 8474c
ld de, MUSIC_PRINTER
call PlayMusic2
ret
; 84753
-Function84753: ; 84753
+Printer_RestartMapMusic: ; 84753
call RestartMapMusic
ret
; 84757
-Function84757: ; 84757
- ld a, [wca88]
+CheckPrinterStatus: ; 84757
+; Check for printer errors
+; If [ca88] == -1, we're disconnected
+ ld a, [wPrinterHandshake]
cp -1
jr nz, .printer_connected
- ld a, [wca89]
+ ld a, [wPrinterStatusFlags]
cp -1
jr z, .error_2
-
.printer_connected
- ld a, [wca89]
+; ca89 contains printer status flags
+ ld a, [wPrinterStatusFlags]
and %11100000
ret z ; no error
@@ -1100,27 +541,31 @@
jr nz, .error_1
bit 6, a
jr nz, .error_4
- ld a, 6 ; error 3
+ ; paper error
+ ld a, PRINTER_ERROR_3
jr .load_text_index
.error_4
- ld a, 7 ; error 4
+ ; temperature error
+ ld a, PRINTER_ERROR_4
jr .load_text_index
.error_1
- ld a, 4 ; error 1
+ ; printer battery low
+ ld a, PRINTER_ERROR_1
jr .load_text_index
.error_2
- ld a, 5 ; error 2
-
+ ; connection error
+ ld a, PRINTER_ERROR_2
.load_text_index
- ld [wcbf8], a
+ ld [wPrinterStatus], a
ret
; 84785
-Function84785: ; 84785
- ld a, [wcbf8]
+PlacePrinterStatusString: ; 84785
+; Print nonzero printer status
+ ld a, [wPrinterStatus]
and a
ret z
push af
@@ -1133,9 +578,8 @@
ld e, a
ld d, 0
ld hl, PrinterStatusStringPointers
-rept 2
add hl, de
-endr
+ add hl, de
ld e, [hl]
inc hl
ld d, [hl]
@@ -1148,12 +592,13 @@
ld a, $1
ld [hBGMapMode], a
xor a
- ld [wcbf8], a
+ ld [wPrinterStatus], a
ret
; 847bd
Function847bd: ; 847bd
- ld a, [wcbf8]
+; XXX
+ ld a, [wPrinterStatus]
and a
ret z
push af
@@ -1166,9 +611,8 @@
ld e, a
ld d, 0
ld hl, PrinterStatusStringPointers
-rept 2
add hl, de
-endr
+ add hl, de
ld e, [hl]
inc hl
ld d, [hl]
@@ -1181,7 +625,7 @@
ld a, $1
ld [hBGMapMode], a
xor a
- ld [wcbf8], a
+ ld [wPrinterStatus], a
ret
; 847f5
@@ -1190,34 +634,38 @@
; 84807
PrinterStatusStringPointers: ; 84807
- dw String_1dc275 ; @
- dw String_1dc276 ; CHECKING LINK
- dw String_1dc289 ; TRANSMITTING
- dw String_1dc29c ; PRINTING
- dw String_1dc2ad ; error 1
- dw String_1dc2e2 ; error 2
- dw String_1dc317 ; error 3
- dw String_1dc34c ; error 4
+ dw GBPrinterString_Null ; @
+ dw GBPrinterString_CheckingLink ; CHECKING LINK
+ dw GBPrinterString_Transmitting ; TRANSMITTING
+ dw GBPrinterString_Printing ; PRINTING
+ dw GBPrinterString_PrinterError1 ; error 1
+ dw GBPrinterString_PrinterError2 ; error 2
+ dw GBPrinterString_PrinterError3 ; error 3
+ dw GBPrinterString_PrinterError4 ; error 4
; 84817
-Function84817: ; 84817 (21:4817)
+PrintPCBox_Page1: ; 84817 (21:4817)
xor a
- ld [wd002], a
+ ld [wWhichBoxMonToPrint], a
hlcoord 0, 0
ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
ld a, " "
call ByteFill
call Printer_PlaceEmptyBoxSlotString
+
hlcoord 0, 0
ld bc, 9 * SCREEN_WIDTH
ld a, " "
call ByteFill
+
call Printer_PlaceSideBorders
call Printer_PlaceTopBorder
+
hlcoord 4, 3
ld de, .String_PokemonList
call PlaceString
- ld a, [wd007]
+
+ ld a, [wWhichBoxToPrint]
ld bc, BOX_NAME_LENGTH
ld hl, wBoxNames
call AddNTimes
@@ -1225,11 +673,11 @@
ld e, l
hlcoord 6, 5
call PlaceString
- ld a, $1
- call Function849c6
+ ld a, 1
+ call Printer_GetBoxMonSpecies
hlcoord 2, 9
- ld c, $3
- call Function848e7
+ ld c, 3
+ call Printer_PrintBoxListSegment
ret
; 84865 (21:4865)
@@ -1237,7 +685,7 @@
db "#MON LIST@"
; 8486f
-Function8486f: ; 8486f (21:486f)
+PrintPCBox_Page2: ; 8486f (21:486f)
hlcoord 0, 0
ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
ld a, " "
@@ -1244,17 +692,17 @@
call ByteFill
call Printer_PlaceEmptyBoxSlotString
call Printer_PlaceSideBorders
- ld a, [wd003]
+ ld a, [wFinishedPrintingBox]
and a
ret nz
- ld a, $4
- call Function849c6
+ ld a, 4
+ call Printer_GetBoxMonSpecies
hlcoord 2, 0
- ld c, $6
- call Function848e7
+ ld c, 6
+ call Printer_PrintBoxListSegment
ret
-Function84893: ; 84893 (21:4893)
+PrintPCBox_Page3: ; 84893 (21:4893)
hlcoord 0, 0
ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
ld a, " "
@@ -1261,17 +709,17 @@
call ByteFill
call Printer_PlaceEmptyBoxSlotString
call Printer_PlaceSideBorders
- ld a, [wd003]
+ ld a, [wFinishedPrintingBox]
and a
ret nz
- ld a, $a
- call Function849c6
+ ld a, 10
+ call Printer_GetBoxMonSpecies
hlcoord 2, 0
- ld c, $6
- call Function848e7
+ ld c, 6
+ call Printer_PrintBoxListSegment
ret
-Function848b7: ; 848b7 (21:48b7)
+PrintPCBox_Page4: ; 848b7 (21:48b7)
hlcoord 0, 0
ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
ld a, " "
@@ -1282,41 +730,44 @@
call ClearBox
call Printer_PlaceSideBorders
call Printer_PlaceBottomBorders
- ld a, [wd003]
+ ld a, [wFinishedPrintingBox]
and a
ret nz
- ld a, $10
- call Function849c6
+ ld a, 16
+ call Printer_GetBoxMonSpecies
hlcoord 2, 0
- ld c, $5
- call Function848e7
+ ld c, 5
+ call Printer_PrintBoxListSegment
ret
-Function848e7: ; 848e7 (21:48e7)
- ld a, [wd006]
+Printer_PrintBoxListSegment: ; 848e7 (21:48e7)
+ ld a, [wBankOfBoxToPrint]
call GetSRAMBank
-
-Function848ed: ; 848ed (21:48ed)
+.loop
ld a, c
and a
- jp z, Function84986
+ jp z, .max_length
dec c
ld a, [de]
cp $ff
- jp z, Function84981
+ jp z, .finish
ld [wd265], a
ld [CurPartySpecies], a
+
push bc
push hl
push de
+
push hl
- ld bc, $10
+ ld bc, 16
ld a, " "
call ByteFill
pop hl
+
push hl
call GetBasePokemonName
pop hl
+
push hl
call PlaceString
ld a, [CurPartySpecies]
@@ -1323,78 +774,82 @@
cp EGG
pop hl
jr z, .ok2
- ld bc, $b
+
+ ld bc, PKMN_NAME_LENGTH
add hl, bc
- call Function8498a
- ld bc, $9
+ call Printer_GetMonGender
+ ld bc, SCREEN_WIDTH - PKMN_NAME_LENGTH
add hl, bc
ld a, "/"
ld [hli], a
+
push hl
- ld bc, $e
+ ld bc, 14
ld a, " "
call ByteFill
pop hl
+
push hl
- ld a, [wd004]
+ ld a, [wAddrOfBoxToPrint]
ld l, a
- ld a, [wd005]
+ ld a, [wAddrOfBoxToPrint + 1]
ld h, a
- ld bc, $372
+ ld bc, sBoxMonNicknames - sBox
add hl, bc
- ld bc, $b
- ld a, [wd002]
+ ld bc, PKMN_NAME_LENGTH
+ ld a, [wWhichBoxMonToPrint]
call AddNTimes
ld e, l
ld d, h
pop hl
+
push hl
call PlaceString
pop hl
- ld bc, $b
+
+ ld bc, PKMN_NAME_LENGTH
add hl, bc
push hl
- ld a, [wd004]
+ ld a, [wAddrOfBoxToPrint]
ld l, a
- ld a, [wd005]
+ ld a, [wAddrOfBoxToPrint + 1]
ld h, a
- ld bc, $35
+ ld bc, 2 + MONS_PER_BOX + MON_LEVEL
add hl, bc
- ld bc, $20
- ld a, [wd002]
+ ld bc, BOXMON_STRUCT_LENGTH
+ ld a, [wWhichBoxMonToPrint]
call AddNTimes
ld a, [hl]
pop hl
- call Function383d
+ call PrintLevel_Force3Digits
.ok2
- ld hl, wd002
+ ld hl, wWhichBoxMonToPrint
inc [hl]
pop de
pop hl
- ld bc, $3c
+ ld bc, 3 * SCREEN_WIDTH
add hl, bc
pop bc
inc de
- jp Function848ed
+ jp .loop
-Function84981: ; 84981 (21:4981)
+.finish
ld a, $1
- ld [wd003], a
-
-Function84986: ; 84986 (21:4986)
+ ld [wFinishedPrintingBox], a
+.max_length
call CloseSRAM
ret
-Function8498a: ; 8498a (21:498a)
+Printer_GetMonGender: ; 8498a (21:498a)
push hl
- ld a, [wd004]
+ ld a, [wAddrOfBoxToPrint]
ld l, a
- ld a, [wd005]
+ ld a, [wAddrOfBoxToPrint + 1]
ld h, a
ld bc, $2b
add hl, bc
- ld bc, $20
- ld a, [wd002]
+ ld bc, BOXMON_STRUCT_LENGTH
+ ld a, [wWhichBoxMonToPrint]
call AddNTimes
ld de, TempMonDVs
ld a, [hli]
@@ -1402,28 +857,28 @@
inc de
ld a, [hli]
ld [de], a
- ld a, [wd002]
+ ld a, [wWhichBoxMonToPrint]
ld [CurPartyMon], a
- ld a, $3
+ ld a, TEMPMON
ld [MonType], a
callba GetGender
- ld a, $7f
- jr c, .asm_849c3
- ld a, $ef
- jr nz, .asm_849c3
- ld a, $f5
-.asm_849c3
+ ld a, " "
+ jr c, .got_gender
+ ld a, "♂"
+ jr nz, .got_gender
+ ld a, "♀"
+.got_gender
pop hl
ld [hli], a
ret
-Function849c6: ; 849c6 (21:49c6)
+Printer_GetBoxMonSpecies: ; 849c6 (21:49c6)
push hl
ld e, a
ld d, $0
- ld a, [wd004]
+ ld a, [wAddrOfBoxToPrint]
ld l, a
- ld a, [wd005]
+ ld a, [wAddrOfBoxToPrint + 1]
ld h, a
add hl, de
ld e, l
--- /dev/null
+++ b/engine/printer/serial.asm
@@ -1,0 +1,645 @@
+Printer_StartTransmission: ; 84000
+ ld hl, wGameboyPrinterRAM
+ ld bc, wGameboyPrinterRAMEnd - wGameboyPrinterRAM
+ xor a
+ call Printer_ByteFill
+ xor a
+ ld [rSB], a
+ ld [rSC], a
+ ld [wPrinterOpcode], a
+ ld hl, wPrinterConnectionOpen
+ set 0, [hl]
+ ld a, [GBPrinter]
+ ld [wGBPrinterSettings], a
+ xor a
+ ld [wJumptableIndex], a
+ ret
+; 84022
+
+PrinterJumptableIteration: ; 84022
+ ld a, [wJumptableIndex]
+ ld e, a
+ ld d, 0
+ ld hl, .Jumptable
+ add hl, de
+ add hl, de
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ jp [hl]
+; 84031
+
+
+.Jumptable: ; 84031 (21:4031)
+
+ dw Print_InitPrinterHandshake ; 00
+ dw Printer_CheckConnectionStatus ; 01
+ dw Printer_WaitSerial ; 02
+ dw Printer_StartTransmittingTilemap ; 03
+ dw Printer_TransmissionLoop ; 04
+ dw Printer_WaitSerialAndLoopBack2 ; 05
+
+ dw Printer_EndTilemapTransmission ; 06
+ dw Printer_TransmissionLoop ; 07
+ dw Printer_WaitSerial ; 08
+ dw Printer_SignalSendHeader ; 09
+ dw Printer_TransmissionLoop ; 0a
+ dw Printer_WaitSerial ; 0b
+ dw Printer_WaitUntilFinished ; 0c
+ dw Printer_Quit ; 0d
+
+ dw Printer_NextSection_ ; 0e
+ dw Printer_WaitSerial ; 0f
+ dw Printer_SignalLoopBack ; 10
+ dw Printer_SectionOne ; 11
+ dw Printer_WaitLoopBack ; 12
+ dw Printer_WaitLoopBack_ ; 13
+
+
+Printer_NextSection: ; 84059 (21:4059)
+ ld hl, wJumptableIndex
+ inc [hl]
+ ret
+
+Printer_PrevSection: ; 8405e (21:405e)
+ ld hl, wJumptableIndex
+ dec [hl]
+ ret
+
+Printer_Quit: ; 84063 (21:4063)
+ xor a
+ ld [wPrinterStatusFlags], a
+ ld hl, wJumptableIndex
+ set 7, [hl]
+ ret
+
+Printer_NextSection_: ; 8406d (21:406d)
+ call Printer_NextSection
+ ret
+
+Printer_SectionOne: ; 84071 (21:4071)
+ ld a, $1
+ ld [wJumptableIndex], a
+ ret
+
+Print_InitPrinterHandshake: ; 84077 (21:4077)
+ call Printer_ResetData
+ ld hl, PrinterDataPacket1
+ call Printer_CopyPacket
+ xor a
+ ld [wPrinterSendByteCounter], a
+ ld [wPrinterSendByteCounter + 1], a
+ ld a, [wPrinterQueueLength]
+ ld [wPrinterRowIndex], a
+ call Printer_NextSection
+ call Printer_WaitHandshake
+ ld a, PRINTER_STATUS_CHECKING
+ ld [wPrinterStatus], a
+ ret
+
+Printer_StartTransmittingTilemap: ; 84099 (21:4099)
+ call Printer_ResetData
+ ; check ???
+ ld hl, wPrinterRowIndex
+ ld a, [hl]
+ and a
+ jr z, Printer_EndTilemapTransmission
+ ; send packet 3
+ ld hl, PrinterDataPacket3 ; signal start of transmission
+ call Printer_CopyPacket
+ ; prepare to send 40 tiles
+ call Printer_Convert2RowsTo2bpp
+ ld a, (40 tiles) % $100
+ ld [wPrinterSendByteCounter], a
+ ld a, (40 tiles) / $100
+ ld [wPrinterSendByteCounter + 1], a
+ ; compute the checksum
+ call Printer_ComputeChecksum
+ call Printer_NextSection
+ call Printer_WaitHandshake
+ ld a, PRINTER_STATUS_TRANSMITTING
+ ld [wPrinterStatus], a
+ ret
+
+Printer_EndTilemapTransmission: ; 840c5 (21:40c5)
+ ; ensure that we go from here to routine 7
+ ld a, $6
+ ld [wJumptableIndex], a
+ ; send packet 4
+ ld hl, PrinterDataPacket4 ; signal no transmission
+ call Printer_CopyPacket
+ ; send no tile data
+ xor a
+ ld [wPrinterSendByteCounter], a
+ ld [wPrinterSendByteCounter + 1], a
+ call Printer_NextSection
+ call Printer_WaitHandshake
+ ret
+
+Printer_SignalSendHeader: ; 840de (21:40de)
+ call Printer_ResetData
+ ld hl, PrinterDataPacket2 ; signal request print
+ call Printer_CopyPacket
+ ; prepare to send 1 tile
+ call Printer_StageHeaderForSend
+ ld a, 4 % $100
+ ld [wPrinterSendByteCounter], a
+ ld a, 4 / $100
+ ld [wPrinterSendByteCounter + 1], a
+ ; compute the checksum
+ call Printer_ComputeChecksum
+ call Printer_NextSection
+ call Printer_WaitHandshake
+ ld a, PRINTER_STATUS_PRINTING
+ ld [wPrinterStatus], a
+ ret
+
+Printer_SignalLoopBack: ; 84103 (21:4103)
+ call Printer_ResetData
+ ; send packet 1
+ ld hl, PrinterDataPacket1 ; signal no transmission
+ call Printer_CopyPacket
+ ; send no tile data
+ xor a
+ ld [wPrinterSendByteCounter], a
+ ld [wPrinterSendByteCounter + 1], a
+ ld a, [wPrinterQueueLength]
+ ld [wPrinterRowIndex], a
+ call Printer_NextSection
+ call Printer_WaitHandshake
+ ret
+
+Printer_WaitSerial: ; 84120 (21:4120)
+ ld hl, wPrinterSerialFrameDelay
+ inc [hl]
+ ld a, [hl]
+ cp $6
+ ret c
+ xor a
+ ld [hl], a
+ call Printer_NextSection
+ ret
+
+Printer_WaitSerialAndLoopBack2: ; 8412e (21:412e)
+ ld hl, wPrinterSerialFrameDelay
+ inc [hl]
+ ld a, [hl]
+ cp $6
+ ret c
+ xor a
+ ld [hl], a
+ ld hl, wPrinterRowIndex
+ dec [hl]
+ call Printer_PrevSection
+ call Printer_PrevSection
+ ret
+
+Printer_CheckConnectionStatus: ; 84143 (21:4143)
+ ld a, [wPrinterOpcode]
+ and a
+ ret nz
+ ld a, [wPrinterHandshake]
+ cp $ff
+ jr nz, .printer_connected
+ ld a, [wPrinterStatusFlags]
+ cp $ff
+ jr z, .printer_error
+
+.printer_connected
+ ld a, [wPrinterHandshake]
+ cp $81
+ jr nz, .printer_error
+ ld a, [wPrinterStatusFlags]
+ cp $0
+ jr nz, .printer_error
+ ld hl, wPrinterConnectionOpen
+ set 1, [hl]
+ ld a, $5
+ ld [wHandshakeFrameDelay], a
+ call Printer_NextSection
+ ret
+
+.printer_error
+ ld a, $ff
+ ld [wPrinterHandshake], a
+ ld [wPrinterStatusFlags], a
+ ld a, $e
+ ld [wJumptableIndex], a
+ ret
+
+Printer_TransmissionLoop: ; 84180 (21:4180)
+ ld a, [wPrinterOpcode]
+ and a
+ ret nz
+ ld a, [wPrinterStatusFlags]
+ and $f0
+ jr nz, .enter_wait_loop
+ ld a, [wPrinterStatusFlags]
+ and $1
+ jr nz, .cycle_back
+ call Printer_NextSection
+ ret
+
+.cycle_back
+ call Printer_PrevSection
+ ret
+
+.enter_wait_loop
+ ld a, $12 ; Printer_WaitLoopBack
+ ld [wJumptableIndex], a
+ ret
+
+Printer_WaitUntilFinished: ; 841a1 (21:41a1)
+ ld a, [wPrinterOpcode]
+ and a
+ ret nz
+ ld a, [wPrinterStatusFlags]
+ and $f3
+ ret nz
+ call Printer_NextSection
+ ret
+
+Printer_WaitLoopBack: ; 841b0 (21:41b0)
+ call Printer_NextSection
+Printer_WaitLoopBack_: ; 841b3 (21:41b3)
+ ld a, [wPrinterOpcode]
+ and a
+ ret nz
+ ld a, [wPrinterStatusFlags]
+ and $f0
+ ret nz
+ xor a
+ ld [wJumptableIndex], a
+ ret
+
+Printer_WaitHandshake: ; 841c3 (21:41c3)
+.loop
+ ld a, [wPrinterOpcode]
+ and a
+ jr nz, .loop
+ xor a
+ ld [wPrinterSendByteOffset], a
+ ld [wPrinterSendByteOffset + 1], a
+ ld a, $1
+ ld [wPrinterOpcode], a
+ ld a, $88
+ ld [rSB], a
+ ld a, $1
+ ld [rSC], a
+ ld a, $81
+ ld [rSC], a
+ ret
+
+Printer_CopyPacket: ; 841e2 (21:41e2)
+ ld a, [hli]
+ ld [wca82], a
+ ld a, [hli]
+ ld [wca83], a
+ ld a, [hli]
+ ld [wca84], a
+ ld a, [hli]
+ ld [wca85], a
+ ld a, [hli]
+ ld [wPrinterChecksum], a
+ ld a, [hl]
+ ld [wPrinterChecksum + 1], a
+ ret
+
+Printer_ResetData: ; 841fb (21:41fb)
+ xor a
+ ld hl, wca82
+ ld [hli], a
+ ld [hli], a
+ ld [hli], a
+ ld [hl], a
+ ld hl, wPrinterChecksum
+ ld [hli], a
+ ld [hl], a
+ xor a
+ ld [wPrinterSendByteCounter], a
+ ld [wPrinterSendByteCounter + 1], a
+ ld hl, wGameboyPrinterRAM
+ ld bc, wGameboyPrinter2bppSourceEnd - wGameboyPrinter2bppSource
+ call Printer_ByteFill
+ ret
+
+Printer_ComputeChecksum: ; 84219 (21:4219)
+ ld hl, 0
+ ld bc, 4
+ ld de, wca82
+ call .ComputeChecksum
+ ld a, [wPrinterSendByteCounter]
+ ld c, a
+ ld a, [wPrinterSendByteCounter + 1]
+ ld b, a
+ ld de, wGameboyPrinterRAM
+ call .ComputeChecksum
+ ld a, l
+ ld [wPrinterChecksum], a
+ ld a, h
+ ld [wPrinterChecksum + 1], a
+ ret
+
+.ComputeChecksum: ; 8423c (21:423c)
+.loop
+ ld a, [de]
+ inc de
+ add l
+ jr nc, .no_overflow
+ inc h
+.no_overflow
+ ld l, a
+ dec bc
+ ld a, c
+ or b
+ jr nz, .loop
+ ret
+
+Printer_StageHeaderForSend: ; 84249 (21:4249)
+ ld a, $1
+ ld [wGameboyPrinter2bppSource + 0], a
+ ld a, [wcbfa]
+ ld [wGameboyPrinter2bppSource + 1], a
+ ld a, %11100100
+ ld [wGameboyPrinter2bppSource + 2], a
+ ld a, [wGBPrinterSettings]
+ ld [wGameboyPrinter2bppSource + 3], a
+ ret
+
+Printer_Convert2RowsTo2bpp: ; 84260 (21:4260)
+ ; de = wPrinterTileMapBuffer + 2 * SCREEN_WIDTH * ([wPrinterQueueLength] - [wPrinterRowIndex])
+ ld a, [wPrinterRowIndex]
+ xor $ff
+ ld d, a
+ ld a, [wPrinterQueueLength]
+ inc a
+ add d
+ ld hl, wPrinterTileMapBuffer
+ ld de, 2 * SCREEN_WIDTH
+.loop1
+ and a
+ jr z, .okay1
+ add hl, de
+ dec a
+ jr .loop1
+.okay1
+ ld e, l
+ ld d, h
+ ld hl, wGameboyPrinter2bppSource
+ ld c, 2 * SCREEN_WIDTH
+.loop2
+ ld a, [de]
+ inc de
+ push bc
+ push de
+ push hl
+ ; convert tile index to vram address
+ swap a
+ ld d, a
+ and $f0
+ ld e, a
+ ld a, d
+ and $f
+ ld d, a
+ and $8
+ ld a, d
+ jr nz, .vtiles_8xxx
+ or $90
+ jr .got_vtile_addr
+
+.vtiles_8xxx
+ or $80
+.got_vtile_addr
+ ld d, a
+ ; copy 1 vtile to hl
+ lb bc, BANK(Printer_Convert2RowsTo2bpp), 1
+ call Request2bpp
+ pop hl
+ ld de, 1 tiles
+ add hl, de
+ pop de
+ pop bc
+ dec c
+ jr nz, .loop2
+ ret
+
+Printer_ByteFill: ; 842ab
+ push de
+ ld e, a
+.loop
+ ld [hl], e
+ inc hl
+ dec bc
+ ld a, c
+ or b
+ jr nz, .loop
+ ld a, e
+ pop de
+ ret
+; 842b7
+
+PrinterDataPacket1:
+ db 1, 0, $00, 0
+ dw 1
+PrinterDataPacket2:
+ db 2, 0, $04, 0
+ dw 0
+PrinterDataPacket3:
+ db 4, 0, $80, 2
+ dw 0
+PrinterDataPacket4:
+ db 4, 0, $00, 0
+ dw 4
+PrinterDataPacket5: ; unused
+ db 8, 0, $00, 0
+ dw 8
+PrinterDataPacket6: ; unused
+ db 15, 0, $00, 0
+ dw 15
+; 842db
+
+_PrinterReceive:: ; 842db
+ ld a, [wPrinterOpcode]
+ add a
+ ld e, a
+ ld d, 0
+ ld hl, .Jumptable
+ add hl, de
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ jp [hl]
+; 842ea
+
+
+.Jumptable: ; 842ea (21:42ea)
+ dw Printer_DoNothing ; 00
+
+ dw Printer_Send0x33 ; 01
+ dw Printer_Sendwca82 ; 02
+ dw Printer_Sendwca83 ; 03
+ dw Printer_Sendwca84 ; 04
+ dw Printer_Sendwca85 ; 05
+ dw Printer_SendNextByte ; 06
+ dw Printer_SendwPrinterChecksumLo ; 07
+ dw Printer_SendwPrinterChecksumHi ; 08
+ dw Printer_Send0x00 ; 09
+ dw Printer_ReceiveTowPrinterHandshakeAndSend0x00 ; 0a
+ dw Printer_ReceiveTowPrinterStatusFlagsAndExitSendLoop ; 0b
+
+ dw Printer_Send0x33 ; 0c triggered by AskSerial
+ dw Printer_Send0x0f ; 0d
+ dw Printer_Send0x00_ ; 0e
+ dw Printer_Send0x00_ ; 0f
+ dw Printer_Send0x00_ ; 10
+ dw Printer_Send0x0f ; 11
+ dw Printer_Send0x00_ ; 12
+ dw Printer_Send0x00 ; 13
+ dw Printer_ReceiveTowPrinterHandshakeAndSend0x00 ; 14
+ dw Printer_ReceiveTowPrinterStatusFlagsAndExitSendLoop_ ; 15
+
+ dw Printer_Send0x33 ; 16 triggered by pressing B
+ dw Printer_Send0x08 ; 17
+ dw Printer_Send0x00_ ; 18
+ dw Printer_Send0x00_ ; 19
+ dw Printer_Send0x00_ ; 1a
+ dw Printer_Send0x08 ; 1b
+ dw Printer_Send0x00_ ; 1c
+ dw Printer_Send0x00 ; 1d
+ dw Printer_ReceiveTowPrinterHandshakeAndSend0x00 ; 1e
+ dw Printer_ReceiveTowPrinterStatusFlagsAndExitSendLoop ; 1f
+
+
+Printer_NextInstruction: ; 8432a (21:432a)
+ ld hl, wPrinterOpcode
+ inc [hl]
+ ret
+
+Printer_DoNothing: ; 8432f (21:432f)
+ ret
+
+Printer_Send0x33: ; 84330 (21:4330)
+ ld a, $33
+ call Printer_SerialSend
+ call Printer_NextInstruction
+ ret
+
+Printer_Sendwca82: ; 84339 (21:4339)
+ ld a, [wca82]
+ call Printer_SerialSend
+ call Printer_NextInstruction
+ ret
+
+Printer_Sendwca83: ; 84343 (21:4343)
+ ld a, [wca83]
+ call Printer_SerialSend
+ call Printer_NextInstruction
+ ret
+
+Printer_Sendwca84: ; 8434d (21:434d)
+ ld a, [wca84]
+ call Printer_SerialSend
+ call Printer_NextInstruction
+ ret
+
+Printer_Sendwca85: ; 84357 (21:4357)
+ ld a, [wca85]
+ call Printer_SerialSend
+ call Printer_NextInstruction
+ ret
+
+Printer_SendNextByte: ; 84361 (21:4361)
+ ; decrement 16-bit counter
+ ld hl, wPrinterSendByteCounter
+ ld a, [hli]
+ ld d, [hl]
+ ld e, a
+ or d
+ jr z, .done
+ dec de
+ ld [hl], d
+ dec hl
+ ld [hl], e
+
+ ld a, [wPrinterSendByteOffset]
+ ld e, a
+ ld a, [wPrinterSendByteOffset + 1]
+ ld d, a
+ ld hl, wGameboyPrinterRAM
+ add hl, de
+ inc de
+ ld a, e
+ ld [wPrinterSendByteOffset], a
+ ld a, d
+ ld [wPrinterSendByteOffset + 1], a
+ ld a, [hl]
+ call Printer_SerialSend
+ ret
+
+.done
+ call Printer_NextInstruction
+Printer_SendwPrinterChecksumLo: ; 8438b (21:438b)
+ ld a, [wPrinterChecksum]
+ call Printer_SerialSend
+ call Printer_NextInstruction
+ ret
+
+Printer_SendwPrinterChecksumHi: ; 84395 (21:4395)
+ ld a, [wPrinterChecksum + 1]
+ call Printer_SerialSend
+ call Printer_NextInstruction
+ ret
+
+Printer_Send0x00: ; 8439f (21:439f)
+ ld a, $0
+ call Printer_SerialSend
+ call Printer_NextInstruction
+ ret
+
+Printer_ReceiveTowPrinterHandshakeAndSend0x00: ; 843a8 (21:43a8)
+ ld a, [rSB]
+ ld [wPrinterHandshake], a
+ ld a, $0
+ call Printer_SerialSend
+ call Printer_NextInstruction
+ ret
+
+Printer_ReceiveTowPrinterStatusFlagsAndExitSendLoop: ; 843b6 (21:43b6)
+ ld a, [rSB]
+ ld [wPrinterStatusFlags], a
+ xor a
+ ld [wPrinterOpcode], a
+ ret
+
+Printer_Send0x0f: ; 843c0 (21:43c0)
+ ld a, $f
+ call Printer_SerialSend
+ call Printer_NextInstruction
+ ret
+
+Printer_Send0x00_: ; 843c9 (21:43c9)
+ ld a, $0
+ call Printer_SerialSend
+ call Printer_NextInstruction
+ ret
+
+Printer_Send0x08: ; 843d2 (21:43d2)
+ ld a, $8
+ call Printer_SerialSend
+ call Printer_NextInstruction
+ ret
+
+Printer_SerialSend: ; 843db (21:43db)
+ ld [rSB], a
+ ld a, $1 ; switch to internal clock
+ ld [rSC], a
+ ld a, $81 ; start transfer
+ ld [rSC], a
+ ret
+
+Printer_ReceiveTowPrinterStatusFlagsAndExitSendLoop_: ; 843e6 (21:43e6)
+ ld a, [rSB]
+ ld [wPrinterStatusFlags], a
+ xor a
+ ld [wPrinterOpcode], a
+ ret
--- a/engine/radio.asm
+++ b/engine/radio.asm
@@ -139,7 +139,7 @@
cp 2
jr nz, .print
bccoord 1, 16
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
jr .skip
call PrintTextBoxText
@@ -201,10 +201,11 @@
OaksPkmnTalk4:
; Choose a random route, and a random Pokemon from that route.
+.sample
call Random
and $1f
- cp $f
- jr nc, OaksPkmnTalk4
+ cp $f ; so wasteful
+ jr nc, .sample
; We now have a number between 0 and 14.
ld hl, .routes
ld c, a
@@ -1576,7 +1577,8 @@
; There are only 11 groups to choose from.
.greater_than_11
call Random
- and $f
+ maskbits NUM_PASSWORD_CATEGORIES
+ and x
cp NUM_PASSWORD_CATEGORIES
jr nc, .greater_than_11
; Store it in the high nybble of e.
--- a/engine/rtc.asm
+++ b/engine/rtc.asm
@@ -35,9 +35,8 @@
cp [hl]
jr c, .match
; else, get the next entry
-rept 2
inc hl
-endr
+ inc hl
; try again
jr .check
--- a/engine/save.asm
+++ b/engine/save.asm
@@ -4,14 +4,14 @@
call SpeechTextBox
call UpdateSprites
callba SaveMenu_LoadEDTile
- ld hl, UnknownText_0x15283
+ ld hl, Text_WouldYouLikeToSaveTheGame
call SaveTheGame_yesorno
jr nz, .refused
call AskOverwriteSaveFile
jr c, .refused
- call SetWRAMStateForSave
+ call PauseGameLogic
call _SavingDontTurnOffThePower
- call ClearWRAMStateAfterSave
+ call ResumeGameLogic
call ExitMenu
and a
ret
@@ -23,8 +23,8 @@
scf
ret
-Function14a58: ; 14a58
- call SetWRAMStateForSave
+SaveAfterLinkTrade: ; 14a58
+ call PauseGameLogic
callba StageRTCTimeForSave
callba BackupMysteryGift
call SavePokemonData
@@ -33,7 +33,7 @@
call SaveBackupChecksum
callba BackupPartyMonMail
callba SaveRTC
- call ClearWRAMStateAfterSave
+ call ResumeGameLogic
ret
; 14a83
@@ -40,7 +40,7 @@
ChangeBoxSaveGame: ; 14a83 (5:4a83)
push de
- ld hl, UnknownText_0x152a1
+ ld hl, Text_SaveOnBoxSwitch
call MenuTextBox
call YesNoBox
call ExitMenu
@@ -47,7 +47,7 @@
jr c, .refused
call AskOverwriteSaveFile
jr c, .refused
- call SetWRAMStateForSave
+ call PauseGameLogic
call SavingDontTurnOffThePower
call SaveBox
pop de
@@ -55,7 +55,7 @@
ld [wCurBox], a
call LoadBox
call SavedTheGame
- call ClearWRAMStateAfterSave
+ call ResumeGameLogic
and a
ret
.refused
@@ -65,9 +65,9 @@
Link_SaveGame: ; 14ab2
call AskOverwriteSaveFile
jr c, .refused
- call SetWRAMStateForSave
+ call PauseGameLogic
call _SavingDontTurnOffThePower
- call ClearWRAMStateAfterSave
+ call ResumeGameLogic
and a
.refused
@@ -75,7 +75,7 @@
; 14ac2
MovePkmnWOMail_SaveGame: ; 14ac2
- call SetWRAMStateForSave
+ call PauseGameLogic
push de
call SaveBox
pop de
@@ -82,12 +82,12 @@
ld a, e
ld [wCurBox], a
call LoadBox
- call ClearWRAMStateAfterSave
+ call ResumeGameLogic
ret
; 14ad5
-Function14ad5: ; 14ad5
- call SetWRAMStateForSave
+MovePkmnWOMail_InsertMon_SaveGame: ; 14ad5
+ call PauseGameLogic
push de
call SaveBox
pop de
@@ -111,7 +111,7 @@
callba BackupMobileEventIndex
callba SaveRTC
call LoadBox
- call ClearWRAMStateAfterSave
+ call ResumeGameLogic
ld de, SFX_SAVE
call PlaySFX
ld c, 24
@@ -120,7 +120,7 @@
; 14b34
StartMovePkmnWOMail_SaveGame: ; 14b34
- ld hl, UnknownText_0x152a6
+ ld hl, Text_SaveOnMovePkmnWOMail
call MenuTextBox
call YesNoBox
call ExitMenu
@@ -127,9 +127,9 @@
jr c, .refused
call AskOverwriteSaveFile
jr c, .refused
- call SetWRAMStateForSave
+ call PauseGameLogic
call _SavingDontTurnOffThePower
- call ClearWRAMStateAfterSave
+ call ResumeGameLogic
and a
ret
@@ -138,15 +138,15 @@
ret
; 14b54
-SetWRAMStateForSave: ; 14b54
+PauseGameLogic: ; 14b54
ld a, $1
- ld [wc2cd], a
+ ld [wGameLogicPaused], a
ret
; 14b5a
-ClearWRAMStateAfterSave: ; 14b5a
+ResumeGameLogic: ; 14b5a
xor a
- ld [wc2cd], a
+ ld [wGameLogicPaused], a
ret
; 14b5f
@@ -184,13 +184,13 @@
jr z, .erase
call CompareLoadedAndSavedPlayerID
jr z, .yoursavefile
- ld hl, UnknownText_0x15297
+ ld hl, Text_AnotherSaveFile
call SaveTheGame_yesorno
jr nz, .refused
jr .erase
.yoursavefile
- ld hl, UnknownText_0x15292
+ ld hl, Text_AlreadyASaveFile
call SaveTheGame_yesorno
jr nz, .refused
jr .ok
@@ -208,7 +208,7 @@
; 14baf
SaveTheGame_yesorno: ; 14baf
- ld b, BANK(UnknownText_0x15283)
+ ld b, BANK(Text_WouldYouLikeToSaveTheGame)
call MapTextbox
call LoadMenuTextBox
lb bc, 0, 7
@@ -253,7 +253,7 @@
ld a, 3
ld [Options], a
; <PLAYER> saved the game!
- ld hl, UnknownText_0x1528d
+ ld hl, Text_PlayerSavedTheGame
call PrintText
; restore the original text speed setting
pop af
@@ -355,7 +355,7 @@
ld a, $3
ld [Options], a
; SAVING... DON'T TURN OFF THE POWER.
- ld hl, UnknownText_0x15288
+ ld hl, Text_SavingDontTurnOffThePower
call PrintText
; Restore the text speed setting
pop af
@@ -416,17 +416,18 @@
; 14d18
Function14d18: ; 14d18
-; copy Unknown_14d2c to SRA4:a007
+; XXX
+; copy .Data to SRA4:a007
ld a, $4
call GetSRAMBank
- ld hl, Unknown_14d2c
+ ld hl, .Data
ld de, $a007
- ld bc, 48
+ ld bc, .DataEnd - .Data
call CopyBytes
jp CloseSRAM
; 14d2c
-Unknown_14d2c: ; 14d2c
+.Data: ; 14d2c
db $0d, $02, $00, $05, $00, $00
db $22, $02, $01, $05, $00, $00
db $03, $04, $05, $08, $03, $05
@@ -436,6 +437,7 @@
db $0f, $05, $14, $07, $05, $05
db $11, $0c, $0c, $06, $06, $04
; 14d5c
+.DataEnd
EraseBattleTowerStatus: ; 14d5c
ld a, BANK(sBattleTowerChallengeState)
@@ -451,6 +453,7 @@
; 14d6c
Function14d6c: ; 14d6c
+; XXX
ld a, $4
call GetSRAMBank
ld a, [$a60b]
@@ -467,6 +470,7 @@
; 14d83
Function14d83: ; 14d83
+; XXX
ld a, $4
call GetSRAMBank
xor a
@@ -477,6 +481,7 @@
; 14d93
Function14d93: ; 14d93
+; XXX
ld a, $7
call GetSRAMBank
xor a
@@ -664,7 +669,7 @@
push af
set NO_TEXT_SCROLL, a
ld [Options], a
- ld hl, UnknownText_0x1529c
+ ld hl, Text_SaveFileCorrupted
call PrintText
pop af
ld [Options], a
@@ -1156,49 +1161,49 @@
; 15283
-UnknownText_0x15283: ; 0x15283
+Text_WouldYouLikeToSaveTheGame: ; 0x15283
; Would you like to save the game?
text_jump UnknownText_0x1c454b
db "@"
; 0x15288
-UnknownText_0x15288: ; 0x15288
+Text_SavingDontTurnOffThePower: ; 0x15288
; SAVING… DON'T TURN OFF THE POWER.
text_jump UnknownText_0x1c456d
db "@"
; 0x1528d
-UnknownText_0x1528d: ; 0x1528d
+Text_PlayerSavedTheGame: ; 0x1528d
; saved the game.
text_jump UnknownText_0x1c4590
db "@"
; 0x15292
-UnknownText_0x15292: ; 0x15292
+Text_AlreadyASaveFile: ; 0x15292
; There is already a save file. Is it OK to overwrite?
text_jump UnknownText_0x1c45a3
db "@"
; 0x15297
-UnknownText_0x15297: ; 0x15297
+Text_AnotherSaveFile: ; 0x15297
; There is another save file. Is it OK to overwrite?
text_jump UnknownText_0x1c45d9
db "@"
; 0x1529c
-UnknownText_0x1529c: ; 0x1529c
+Text_SaveFileCorrupted: ; 0x1529c
; The save file is corrupted!
text_jump UnknownText_0x1c460d
db "@"
; 0x152a1
-UnknownText_0x152a1: ; 0x152a1
+Text_SaveOnBoxSwitch: ; 0x152a1
; When you change a #MON BOX, data will be saved. OK?
text_jump UnknownText_0x1c462a
db "@"
; 0x152a6
-UnknownText_0x152a6: ; 0x152a6
+Text_SaveOnMovePkmnWOMail: ; 0x152a6
; Each time you move a #MON, data will be saved. OK?
text_jump UnknownText_0x1c465f
db "@"
--- a/engine/scripting.asm
+++ b/engine/scripting.asm
@@ -1427,12 +1427,12 @@
.Show:
show_emote
- step_sleep_1
+ step_sleep 1
step_end
.Hide:
hide_emote
- step_sleep_1
+ step_sleep 1
step_end
; 973c7
@@ -1652,9 +1652,9 @@
inc [hl]
ld d, $0
ld hl, wScriptStack
-rept 3
add hl, de
-endr
+ add hl, de
+ add hl, de
pop de
ld a, [ScriptBank]
ld [hli], a
@@ -1825,9 +1825,9 @@
call GetScriptByte
ld d, a
ld hl, StdScripts
-rept 3
add hl, de
-endr
+ add hl, de
+ add hl, de
ld a, BANK(StdScripts)
call GetFarByte
ld b, a
@@ -3054,7 +3054,7 @@
Script_closetext: ; 97b2f
; script command 0x49
- call Function2e20
+ call _OpenAndCloseMenu_HDMATransferTileMapAndAttrMap
call CloseText
ret
; 97b36
@@ -3160,9 +3160,9 @@
ld e, [hl]
ld d, $0
ld hl, wScriptStack
-rept 3
add hl,de
-endr
+ add hl,de
+ add hl,de
ld a, [hli]
ld b, a
and " "
--- a/engine/search.asm
+++ b/engine/search.asm
@@ -117,9 +117,9 @@
; Load the box.
ld hl, BoxAddressTable1
ld b, 0
-rept 3
add hl, bc
-endr
+ add hl, bc
+ add hl, bc
ld a, [hli]
call GetSRAMBank
ld a, [hli]
--- /dev/null
+++ b/engine/search2.asm
@@ -1,0 +1,134 @@
+_FindGreaterThanThatLevel: ; 4dbd2
+ ld hl, PartyMon1Level
+ call FindGreaterThanThatLevel
+ ret
+
+_FindAtLeastThatHappy: ; 4dbd9
+ ld hl, PartyMon1Happiness
+ call FindAtLeastThatHappy
+ ret
+
+_FindThatSpecies: ; 4dbe0
+ ld hl, PartyMon1Species
+ jp FindThatSpecies
+
+_FindThatSpeciesYourTrainerID: ; 4dbe6
+ ld hl, PartyMon1Species
+ call FindThatSpecies
+ ret z
+ ld a, c
+ ld hl, PartyMon1ID
+ ld bc, PARTYMON_STRUCT_LENGTH
+ call AddNTimes
+ ld a, [PlayerID]
+ cp [hl]
+ jr nz, .nope
+ inc hl
+ ld a, [PlayerID + 1]
+ cp [hl]
+ jr nz, .nope
+ ld a, $1
+ and a
+ ret
+
+.nope
+ xor a
+ ret
+
+FindAtLeastThatHappy: ; 4dc0a
+; Sets the bits for the Pokemon that have a happiness greater than or equal to b.
+; The lowest bits are used. Sets z if no Pokemon in your party is at least that happy.
+ ld c, $0
+ ld a, [PartyCount]
+ ld d, a
+.loop
+ ld a, d
+ dec a
+ push hl
+ push bc
+ ld bc, PARTYMON_STRUCT_LENGTH
+ call AddNTimes
+ pop bc
+ ld a, b
+ cp [hl]
+ pop hl
+ jr z, .greater_equal
+ jr nc, .lower
+
+.greater_equal
+ ld a, c
+ or $1
+ ld c, a
+
+.lower
+ sla c
+ dec d
+ jr nz, .loop
+ call RetroactivelyIgnoreEggs
+ ld a, c
+ and a
+ ret
+
+FindGreaterThanThatLevel: ; 4dc31
+ ld c, $0
+ ld a, [PartyCount]
+ ld d, a
+.loop
+ ld a, d
+ dec a
+ push hl
+ push bc
+ ld bc, PARTYMON_STRUCT_LENGTH
+ call AddNTimes
+ pop bc
+ ld a, b
+ cp [hl]
+ pop hl
+ jr c, .greater
+ ld a, c
+ or $1
+ ld c, a
+
+.greater
+ sla c
+ dec d
+ jr nz, .loop
+ call RetroactivelyIgnoreEggs
+ ld a, c
+ and a
+ ret
+
+FindThatSpecies: ; 4dc56
+; Find species b in your party.
+; If you have no Pokemon, returns c = -1 and z.
+; If that species is in your party, returns its location in c, and nz.
+; Otherwise, returns z.
+ ld c, -1
+ ld hl, PartySpecies
+.loop
+ ld a, [hli]
+ cp -1
+ ret z
+ inc c
+ cp b
+ jr nz, .loop
+ ld a, $1
+ and a
+ ret
+
+RetroactivelyIgnoreEggs: ; 4dc67
+ ld e, -2
+ ld hl, PartySpecies
+.loop
+ ld a, [hli]
+ cp -1
+ ret z
+ cp EGG
+ jr nz, .skip_notegg
+ ld a, c
+ and e
+ ld c, a
+
+.skip_notegg
+ rlc e
+ jr .loop
--- a/engine/selectmenu.asm
+++ b/engine/selectmenu.asm
@@ -45,9 +45,8 @@
inc hl
ld e, a
ld d, 0
-rept 2
add hl, de
-endr
+ add hl, de
call .IsSameItem
jr c, .NoRegisteredItem
and a
@@ -71,9 +70,8 @@
inc hl
ld e, a
ld d, 0
-rept 2
add hl, de
-endr
+ add hl, de
call .IsSameItem
jr c, .NoRegisteredItem
ret
--- a/engine/slot_machine.asm
+++ b/engine/slot_machine.asm
@@ -201,9 +201,9 @@
ld a, [hl]
xor $20
ld [hli], a
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
dec c
jr nz, .loop
ret
@@ -686,9 +686,9 @@
ld a, [hl]
add d
ld [hli], a
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
dec e
jr nz, .loop
ret
@@ -1844,9 +1844,9 @@
ld e, a
ld d, 0
ld hl, .PayoutStrings
-rept 3
add hl, de
-endr
+ add hl, de
+ add hl, de
ld de, StringBuffer2
ld bc, 4
call CopyBytes
@@ -1948,7 +1948,7 @@
; 9321d
SlotMachine_AnimateGolem: ; 9321d (24:721d)
- ld hl, SPRITEANIMSTRUCT_0B
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
ld e, [hl]
ld d, 0
@@ -1982,7 +1982,7 @@
.retain
dec [hl]
- ld hl, SPRITEANIMSTRUCT_0B
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
inc [hl]
ld hl, SPRITEANIMSTRUCT_0C
@@ -2009,7 +2009,7 @@
ret
.play_sound
- ld hl, SPRITEANIMSTRUCT_0B
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
inc [hl]
ld hl, SPRITEANIMSTRUCT_0D
@@ -2041,7 +2041,7 @@
ret
.restart
- ld hl, SPRITEANIMSTRUCT_0B
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
xor a
ld [hl], a
@@ -2049,7 +2049,7 @@
ret
Slots_AnimateChansey: ; 932ac (24:72ac)
- ld hl, SPRITEANIMSTRUCT_0B
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
ld e, [hl]
ld d, 0
@@ -2082,7 +2082,7 @@
ret
.limit
- ld hl, SPRITEANIMSTRUCT_0B
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
inc [hl]
ld a, $1
@@ -2100,7 +2100,7 @@
ret
.retain
- ld hl, SPRITEANIMSTRUCT_0B
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
inc [hl]
ld hl, SPRITEANIMSTRUCT_0C
@@ -2116,7 +2116,7 @@
ret
.spawn_egg
- ld hl, SPRITEANIMSTRUCT_0B
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
dec [hl]
push bc
--- a/engine/specials.asm
+++ b/engine/specials.asm
@@ -2,9 +2,9 @@
Special:: ; c01b
; Run script special de.
ld hl, SpecialsPointers
-rept 3
add hl,de
-endr
+ add hl,de
+ add hl,de
ld b, [hl]
inc hl
ld a, [hli]
@@ -114,7 +114,7 @@
add_special RandomPhoneRareWildMon
add_special RandomPhoneWildMon
add_special RandomPhoneMon
- add_special RunCallback_04
+ add_special MapCallbackSprites_LoadUsedSpritesGFX
add_special PlaySlowCry
add_special SpecialSnorlaxAwake
add_special Special_YoungerHaircutBrother
--- a/engine/sprite_anims.asm
+++ b/engine/sprite_anims.asm
@@ -133,17 +133,17 @@
ret
.four ; 8d302 (23:5302)
- call .anonymous_dw
+ call .AnonymousJumptable
jp [hl]
; 8d306 (23:5306)
-; Anonymous dw (see .anonymous_dw)
+; Anonymous dw (see .AnonymousJumptable)
dw .four_zero
dw .four_one
; 8d30a
.four_zero ; 8d30a
- call .IncrementSpriteAnimStruct0B
+ call .IncrementJumptableIndex
ld hl, SPRITEANIMSTRUCT_INDEX
add hl, bc
@@ -245,7 +245,7 @@
add hl, bc
dec [hl]
.asm_8d395
- ld hl, SPRITEANIMSTRUCT_0B
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
ld a, [hl]
push af
@@ -267,7 +267,7 @@
add hl, bc
ld a, [hl]
- ld hl, SPRITEANIMSTRUCT_0B
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
add [hl]
ld [hl], a
@@ -290,7 +290,7 @@
add hl, bc
ld d, [hl]
- ld hl, SPRITEANIMSTRUCT_0B
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
ld a, [hl]
push af
@@ -345,7 +345,7 @@
inc hl
ld [hl], d
- ld hl, SPRITEANIMSTRUCT_0B
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
ld a, [hl]
xor $20
@@ -372,7 +372,7 @@
ret
.SlotsChanseyEgg: ; 8d43e (23:543e)
- ld hl, SPRITEANIMSTRUCT_0B
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
ld a, [hl]
dec [hl]
@@ -417,11 +417,11 @@
ret
.sixteen ; 8d483 (23:5483)
- call .anonymous_dw
+ call .AnonymousJumptable
jp [hl]
; 8d487 (23:5487)
-; Anonymous dw (see .anonymous_dw)
+; Anonymous dw (see .AnonymousJumptable)
dw .sixteen_zero
dw .sixteen_one
dw .sixteen_two
@@ -434,7 +434,7 @@
ld a, $14
call _ReinitSpriteAnimFrame
- ld hl, SPRITEANIMSTRUCT_0B
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
ld [hl], $2
@@ -454,7 +454,7 @@
ret
.asm_8d4af
- call .IncrementSpriteAnimStruct0B
+ call .IncrementJumptableIndex
ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
@@ -482,7 +482,7 @@
; 8d4d5
.sixteen_one ; 8d4d5
- ld hl, SPRITEANIMSTRUCT_0B
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
ld [hl], $4
@@ -539,7 +539,7 @@
ld hl, SPRITEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
- call .IncrementSpriteAnimStruct0B
+ call .IncrementJumptableIndex
ret
.sixteen_five ; 8d526
@@ -554,7 +554,7 @@
inc [hl]
inc [hl]
cp $b0
- jr nc, .asm_8d53f
+ jr nc, .delete
and $3
ret nz
ld de, SFX_POKEBALLS_PLACED_ON_TABLE
@@ -561,12 +561,12 @@
call PlaySFX
ret
-.asm_8d53f
+.delete
call DeinitializeSprite
ret
.eighteen ; 8d543 (23:5543)
- callab Function29676
+ callab TradeAnim_AnimateTrademonInTube
ret
.EggShell: ; 8d54a (23:554a)
@@ -579,7 +579,7 @@
add $8
ld [hl], a
- ld hl, SPRITEANIMSTRUCT_0B
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
ld a, [hl]
xor $20
@@ -630,9 +630,9 @@
ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, [hl]
-rept 3
inc [hl]
-endr
+ inc [hl]
+ inc [hl]
push af
push de
call .Sprites_Sine
@@ -804,12 +804,12 @@
ret
.thirtytwo ; 8d680 (23:5680)
- ld hl, SPRITEANIMSTRUCT_0B
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
ld d, [hl]
-rept 3
inc [hl]
-endr
+ inc [hl]
+ inc [hl]
ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
@@ -847,7 +847,7 @@
ret
.twentysix ; 8d6b7 (23:56b7)
- callba Function11d0b6
+ callba AnimateEZChatCursor
ret
.thirtyone ; 8d6be (23:56be)
@@ -854,7 +854,7 @@
callba UpdateCelebiPosition
ret
-.anonymous_dw ; 8d6c5 (23:56c5)
+.AnonymousJumptable: ; 8d6c5 (23:56c5)
ld hl, [sp+$0]
ld e, [hl]
inc hl
@@ -861,7 +861,7 @@
ld d, [hl]
inc de
- ld hl, SPRITEANIMSTRUCT_0B
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
ld l, [hl]
ld h, $0
@@ -873,8 +873,8 @@
ret
; 8d6d8 (23:56d8)
-.IncrementSpriteAnimStruct0B: ; 8d6d8
- ld hl, SPRITEANIMSTRUCT_0B
+.IncrementJumptableIndex: ; 8d6d8
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
inc [hl]
ret
--- a/engine/sprites.asm
+++ b/engine/sprites.asm
@@ -154,9 +154,9 @@
ld e, a
ld d, 0
ld hl, SpriteAnimSeqData
-rept 3
add hl, de
-endr
+ add hl, de
+ add hl, de
ld e, l
ld d, h
; Set hl to the first field (field 0) in the current structure.
@@ -341,7 +341,7 @@
push hl
ld a, [hl]
ld hl, wCurrSpriteAddSubFlags
- bit 5, [hl]
+ bit 5, [hl] ; x flip
jr z, .ok
; 8 - a
add $8
@@ -521,9 +521,9 @@
ld e, a
ld d, 0
ld hl, SpriteAnimOAMData
-rept 3
add hl, de
-endr
+ add hl, de
+ add hl, de
ret
; 8d1ac
@@ -556,8 +556,8 @@
db SPRITE_ANIM_FRAMESET_07, SPRITE_ANIM_SEQ_04, $00 ; 01
db SPRITE_ANIM_FRAMESET_08, SPRITE_ANIM_SEQ_05, $05 ; 02
db SPRITE_ANIM_FRAMESET_GAMEFREAK_LOGO, SPRITE_ANIM_SEQ_GAMEFREAK_LOGO, $00 ; 03
- db SPRITE_ANIM_FRAMESET_0B, SPRITE_ANIM_SEQ_07, $06 ; 04
- db SPRITE_ANIM_FRAMESET_0C, SPRITE_ANIM_SEQ_08, $06 ; 05
+ db SPRITE_ANIM_FRAMESET_0B, SPRITE_ANIM_SEQ_07, $06 ; 04 gs intro star
+ db SPRITE_ANIM_FRAMESET_0C, SPRITE_ANIM_SEQ_08, $06 ; 05 gs intro sparkle
db SPRITE_ANIM_FRAMESET_SLOT_GOLEM, SPRITE_ANIM_SEQ_SLOT_GOLEM, $07 ; 06 slots golem
db SPRITE_ANIM_FRAMESET_SLOTS_CHANSEY, SPRITE_ANIM_SEQ_SLOTS_CHANSEY, $07 ; 07 slots chansey
db SPRITE_ANIM_FRAMESET_SLOTS_EGG, SPRITE_ANIM_SEQ_SLOTS_EGG, $07 ; 08 slots egg
@@ -569,11 +569,11 @@
db SPRITE_ANIM_FRAMESET_13, SPRITE_ANIM_SEQ_10, $00 ; 0e
db SPRITE_ANIM_FRAMESET_15, SPRITE_ANIM_SEQ_NULL, $00 ; 0f
db SPRITE_ANIM_FRAMESET_16, SPRITE_ANIM_SEQ_11, $00 ; 10
- db SPRITE_ANIM_FRAMESET_17, SPRITE_ANIM_SEQ_12, $00 ; 11
- db SPRITE_ANIM_FRAMESET_18, SPRITE_ANIM_SEQ_12, $00 ; 12
+ db SPRITE_ANIM_FRAMESET_TRADEMON_ICON, SPRITE_ANIM_SEQ_TRADEMON_IN_TUBE, $00 ; 11
+ db SPRITE_ANIM_FRAMESET_TRADEMON_BUBBLE, SPRITE_ANIM_SEQ_TRADEMON_IN_TUBE, $00 ; 12
db SPRITE_ANIM_FRAMESET_19, SPRITE_ANIM_SEQ_13, $00 ; 13
db SPRITE_ANIM_FRAMESET_1A, SPRITE_ANIM_SEQ_14, $00 ; 14 radio tuning knob
- db SPRITE_ANIM_FRAMESET_1B, SPRITE_ANIM_SEQ_NULL, $00 ; 15
+ db SPRITE_ANIM_FRAMESET_1B, SPRITE_ANIM_SEQ_NULL, $00 ; 15 chris on magnet train
db SPRITE_ANIM_FRAMESET_LEAF, SPRITE_ANIM_SEQ_15, $00 ; 16 leaves when cutting down a tree
db SPRITE_ANIM_FRAMESET_1E, SPRITE_ANIM_SEQ_NULL, $00 ; 17
db SPRITE_ANIM_FRAMESET_LEAF, SPRITE_ANIM_SEQ_FLY_LEAF, $00 ; 18 flying leaves
@@ -582,8 +582,8 @@
db SPRITE_ANIM_FRAMESET_25, SPRITE_ANIM_SEQ_NULL, $00 ; 1b headbutt
db SPRITE_ANIM_FRAMESET_20, SPRITE_ANIM_SEQ_13, $00 ; 1c
db SPRITE_ANIM_FRAMESET_26, SPRITE_ANIM_SEQ_1A, $00 ; 1d
- db SPRITE_ANIM_FRAMESET_2D, SPRITE_ANIM_SEQ_NULL, $00 ; 1e
- db SPRITE_ANIM_FRAMESET_2E, SPRITE_ANIM_SEQ_NULL, $00 ; 1f
+ db SPRITE_ANIM_FRAMESET_2D, SPRITE_ANIM_SEQ_NULL, $00 ; 1e kris on map
+ db SPRITE_ANIM_FRAMESET_2E, SPRITE_ANIM_SEQ_NULL, $00 ; 1f kris on magnet train
db SPRITE_ANIM_FRAMESET_2F, SPRITE_ANIM_SEQ_NULL, $00 ; 20
db SPRITE_ANIM_FRAMESET_30, SPRITE_ANIM_SEQ_NULL, $00 ; 21
db SPRITE_ANIM_FRAMESET_31, SPRITE_ANIM_SEQ_NULL, $00 ; 22
--- a/engine/startmenu.asm
+++ b/engine/startmenu.asm
@@ -5,7 +5,7 @@
ld de, SFX_MENU
call PlaySFX
- callba Function6454
+ callba ReanchorBGMap_NoOAMUpdate
ld hl, StatusFlags2
bit 2, [hl] ; bug catching contest
@@ -19,11 +19,11 @@
ld a, [wd0d2]
ld [wMenuCursorBuffer], a
call .DrawMenuAccount_
- call MenuFunc_1e7f
+ call DrawVariableLengthMenuBox
call .DrawBugContestStatusBox
- call Function2e31
- call Function2e20
- callba Function64bf
+ call SafeUpdateSprites
+ call _OpenAndCloseMenu_HDMATransferTileMapAndAttrMap
+ callba LoadFonts_NoOAMUpdate
call .DrawBugContestStatus
call UpdateTimePals
jr .Select
@@ -142,7 +142,7 @@
call Call_ExitMenu
call ReloadTilesetAndPalettes
call .DrawMenuAccount_
- call MenuFunc_1e7f
+ call DrawVariableLengthMenuBox
call .DrawBugContestStatus
call UpdateSprites
call ret_d90
@@ -194,31 +194,31 @@
.QuitString: db "QUIT@"
.PokedexDesc: db "#MON"
- next "database@"
+ next "database@"
.PartyDesc: db "Party ", $4a
- next "status@"
+ next "status@"
.PackDesc: db "Contains"
- next "items@"
+ next "items@"
.PokegearDesc: db "Trainer's"
- next "key device@"
+ next "key device@"
.StatusDesc: db "Your own"
- next "status@"
+ next "status@"
.SaveDesc: db "Save your"
- next "progress@"
+ next "progress@"
.OptionDesc: db "Change"
- next "settings@"
+ next "settings@"
.ExitDesc: db "Close this"
- next "menu@"
+ next "menu@"
.QuitDesc: db "Quit and"
- next "be judged.@"
+ next "be judged.@"
.OpenMenu: ; 127e5
@@ -1457,7 +1457,7 @@
push af
set NO_TEXT_SCROLL, [hl]
call LoadFontsBattleExtra
- call .asm_12f73
+ call .ChooseMoveToDelete
pop bc
ld a, b
ld [Options], a
@@ -1467,7 +1467,7 @@
ret
; 12f73
-.asm_12f73
+.ChooseMoveToDelete
call SetUpMoveScreenBG
ld de, DeleteMoveScreenAttrs
call SetMenuAttributes
@@ -1474,29 +1474,29 @@
call SetUpMoveList
ld hl, w2DMenuFlags1
set 6, [hl]
- jr .asm_12f93
+ jr .enter_loop
-.asm_12f86
+.loop
call ScrollingMenuJoypad
- bit 1, a
- jp nz, .asm_12f9f
- bit 0, a
- jp nz, .asm_12f9c
+ bit B_BUTTON_F, a
+ jp nz, .b_button
+ bit A_BUTTON_F, a
+ jp nz, .a_button
-.asm_12f93
+.enter_loop
call PrepareToPlaceMoveData
call PlaceMoveData
- jp .asm_12f86
+ jp .loop
; 12f9c
-.asm_12f9c
+.a_button
and a
- jr .asm_12fa0
+ jr .finish
-.asm_12f9f
+.b_button
scf
-.asm_12fa0
+.finish
push af
xor a
ld [wSwitchMon], a
@@ -1762,7 +1762,7 @@
call ClearSprites
xor a
ld [hBGMapMode], a
- callba Functionfb571
+ callba LoadStatsScreenPageTilesGFX
callba ClearSpriteAnims2
ld a, [CurPartyMon]
ld e, a
@@ -1797,7 +1797,7 @@
call PrintLevel
ld hl, PlayerHPPal
call SetHPPal
- ld b, SCGB_0E
+ ld b, SCGB_MOVE_LIST
call GetSGBLayout
hlcoord 16, 0
lb bc, 1, 3
--- a/engine/stats_screen.asm
+++ b/engine/stats_screen.asm
@@ -6,14 +6,14 @@
ld a, [wBattleMode] ; wd22d (aliases: EnemyMonEnd)
and a
jr z, StatsScreenInit
- jr _BattleStatsScreenInit
+ jr _MobileStatsScreenInit
StatsScreenInit: ; 4dc8a
ld hl, StatsScreenMain
jr StatsScreenInit_gotaddress
-_BattleStatsScreenInit: ; 4dc8f
- ld hl, StatsScreenBattle
+_MobileStatsScreenInit: ; 4dc8f
+ ld hl, StatsScreenMobile
jr StatsScreenInit_gotaddress
StatsScreenInit_gotaddress: ; 4dc94
@@ -33,7 +33,7 @@
call ClearBGPalettes
call ClearTileMap
call UpdateSprites
- callba Functionfb53e
+ callba StatsScreen_LoadFont
pop hl
call _hl_
call ClearBGPalettes
@@ -73,7 +73,7 @@
ret
; 0x4dcf7
-StatsScreenBattle: ; 4dcf7
+StatsScreenMobile: ; 4dcf7
xor a
ld [wJumptableIndex], a
; stupid interns
@@ -89,7 +89,7 @@
ld hl, StatsScreenPointerTable
rst JumpTable
call StatsScreen_WaitAnim
- callba Function100dfd
+ callba MobileComms_CheckInactivityTimer
jr c, .exit
ld a, [wJumptableIndex]
bit 7, a
@@ -100,7 +100,6 @@
; 4dd2a
StatsScreenPointerTable: ; 4dd2a
-
dw MonStatsInit ; regular pokémon
dw EggStatsInit ; egg
dw StatsScreenWaitCry
@@ -129,7 +128,7 @@
.finish
ld hl, wcf64
res 5, [hl]
- callba Function10402d
+ callba HDMATransferTileMapToWRAMBank3
ret
StatsScreen_SetJumptableIndex: ; 4dd62 (13:5d62)
@@ -149,7 +148,7 @@
res 6, [hl]
call ClearBGPalettes
call ClearTileMap
- callba Function10402d
+ callba HDMATransferTileMapToWRAMBank3
call StatsScreen_CopyToTempMon
ld a, [CurPartySpecies]
cp EGG
@@ -223,7 +222,7 @@
StatsScreen_CopyToTempMon: ; 4ddf2 (13:5df2)
ld a, [MonType]
- cp BREEDMON
+ cp TEMPMON
jr nz, .breedmon
ld a, [wBufferMon]
ld [CurSpecies], a
@@ -250,7 +249,7 @@
StatsScreen_GetJoypad: ; 4de2c (13:5e2c)
call GetJoypad
ld a, [MonType]
- cp BREEDMON
+ cp TEMPMON
jr nz, .notbreedmon
push hl
push de
@@ -641,9 +640,8 @@
inc a
ld d, a
callba CalcExpAtLevel
-rept 2
ld hl, TempMonExp + 2
-endr
+ ld hl, TempMonExp + 2
ld a, [hQuotient + 2]
sub [hl]
dec hl
@@ -660,9 +658,8 @@
.AlreadyAtMaxLevel:
ld hl, Buffer1 ; wd1ea (aliases: MagikarpLength)
xor a
-rept 2
ld [hli], a
-endr
+ ld [hli], a
ld [hl], a
ret
; 4e119 (13:6119)
@@ -1016,7 +1013,7 @@
call DelayFrame
hlcoord 0, 0
call PrepMonFrontpic
- callba Function10402d
+ callba HDMATransferTileMapToWRAMBank3
call StatsScreen_AnimateEgg
ld a, [TempMonHappiness]
@@ -1147,7 +1144,7 @@
ld h, [hl]
ld l, a
ld a, [MonType]
- cp BREEDMON
+ cp TEMPMON
ret z
ld a, [CurPartyMon]
jp SkipNames
--- a/engine/std_scripts.asm
+++ b/engine/std_scripts.asm
@@ -1907,8 +1907,8 @@
end
Movement_ContestResults_WalkAfterWarp: ; bcea1
- step_right
- step_down
- turn_head_up
+ step RIGHT
+ step DOWN
+ turn_head UP
step_end
; bcea5
--- a/engine/switch_items.asm
+++ b/engine/switch_items.asm
@@ -231,9 +231,8 @@
ld c, a
ld b, 0
ld hl, .spacing_dws
-rept 2
add hl, bc
-endr
+ add hl, bc
ld c, [hl]
inc hl
ld b, [hl]
--- a/engine/time.asm
+++ b/engine/time.asm
@@ -102,9 +102,9 @@
ret nc
xor a
ld hl, DailyFlags
-rept 3
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
ld [hl], a
ld hl, wDailyRematchFlags
rept 4
@@ -374,17 +374,16 @@
; 115d6
CalcMinsHoursDaysSince: ; 115d6
-rept 2
inc hl
-endr
+ inc hl
xor a
jr _CalcMinsHoursDaysSince
; 115db
CalcSecsMinsHoursDaysSince: ; 115db
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
ld a, [hSeconds]
ld c, a
sub [hl]
--- a/engine/time_capsule/conversion.asm
+++ b/engine/time_capsule/conversion.asm
@@ -46,9 +46,8 @@
ld [CurSpecies], a
call GetBaseData
ld hl, wLinkOTPartyMonTypes
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [BaseType1]
cp [hl]
jr nz, .abnormal
@@ -384,7 +383,7 @@
ld [TempMonDVs], a
ld a, [hl]
ld [TempMonDVs + 1], a
- ld b, SCGB_FRONTPICPALS
+ ld b, SCGB_TRAINER_OR_MON_FRONTPIC_PALS
call GetSGBLayout
call SetPalettes
ret
--- a/engine/timeofdaypals.asm
+++ b/engine/timeofdaypals.asm
@@ -140,9 +140,9 @@
ld b, $4
.asm_8c09c
call DmgToCgbTimePals
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
ld c, $7
call DelayFrames
dec b
@@ -245,9 +245,8 @@
ld e, a
ld d, 0
ld hl, .TimePalettes
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -305,9 +304,9 @@
ConvertTimePalsIncHL: ; 8c15e
.loop
call DmgToCgbTimePals
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
ld c, 2
call DelayFrames
dec b
@@ -318,9 +317,9 @@
ConvertTimePalsDecHL: ; 8c16d
.loop
call DmgToCgbTimePals
-rept 3
dec hl
-endr
+ dec hl
+ dec hl
ld c, 2
call DelayFrames
dec b
@@ -346,9 +345,8 @@
ld c, a
ld b, $0
ld hl, .dmgfades
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
--- a/engine/timeset.asm
+++ b/engine/timeset.asm
@@ -18,7 +18,7 @@
call RotateFourPalettesLeft
call ClearTileMap
call ClearSprites
- ld b, SCGB_08
+ ld b, SCGB_DIPLOMA
call GetSGBLayout
xor a
ld [hBGMapMode], a
@@ -200,9 +200,8 @@
push hl
call DisplayHourOClock
pop de
-rept 2
inc de
-endr
+ inc de
ld a, ":"
ld [de], a
inc de
@@ -216,9 +215,9 @@
ld [hl], a
pop hl
call DisplayMinutesWithMinString
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
ret
; 90810
@@ -521,9 +520,8 @@
ld e, a
ld d, 0
ld hl, .WeekdayStrings
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld d, [hl]
ld e, a
@@ -579,7 +577,7 @@
lb bc, 3, 18
call ClearBox
ld hl, .Text
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
ret
; 90a6c
@@ -610,7 +608,7 @@
lb bc, 3, 18
call ClearBox
ld hl, .Text
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
ret
; 90aa0
@@ -638,7 +636,7 @@
lb bc, 3, SCREEN_WIDTH - 2
call ClearBox
ld hl, .Text
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
ret
; 90acc
--- a/engine/title.asm
+++ b/engine/title.asm
@@ -188,8 +188,8 @@
call ByteFill
; Let LCD Stat know we're messing around with SCX
- ld a, rSCX - rJOYP
- ld [hFFC6], a
+ ld a, rSCX - $ff00
+ ld [hLCDCPointer], a
pop af
ld [rSVBK], a
@@ -351,9 +351,8 @@
ld b, a
ld a, e
ld [hli], a
-rept 2
inc e
-endr
+ inc e
ld a, $80
ld [hli], a
dec c
@@ -378,9 +377,9 @@
ld a, [hl]
add 2
ld [hli], a
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
dec c
jr nz, .loop
--- a/engine/tmhm2.asm
+++ b/engine/tmhm2.asm
@@ -423,9 +423,9 @@
.NotTMHM:
call TMHMPocket_GetCurrentLineCoord
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
push de
ld de, TMHM_String_Cancel
call PlaceString
@@ -581,9 +581,8 @@
dec a
ld c, a
ld b, 0
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld e, a
ld d, [hl]
--- a/engine/trade/animation.asm
+++ b/engine/trade/animation.asm
@@ -7,10 +7,10 @@
ld hl, wPlayerTrademonSpecies
ld de, wOTTrademonSpecies
call LinkTradeAnim_LoadTradeMonSpecies
- ld de, .data_28f3f
- jr RunTradeAnimSequence
+ ld de, .script
+ jr RunTradeAnimScript
-.data_28f3f
+.script
tradeanim_setup_givemon_scroll
tradeanim_show_givemon_data
tradeanim_do_givemon_scroll
@@ -22,7 +22,7 @@
tradeanim_wait_anim
tradeanim_bulge_through_tube
tradeanim_wait_anim
- tradeanim_1e
+ tradeanim_textbox_scroll
tradeanim_give_trademon_sfx
tradeanim_tube_to_ot
tradeanim_sent_to_ot_text
@@ -41,10 +41,10 @@
tradeanim_show_getmon_data
tradeanim_poof
tradeanim_wait_anim
- tradeanim_1d
+ tradeanim_frontpic_scroll
tradeanim_animate_frontpic
tradeanim_wait_80_if_ot_egg
- tradeanim_1e
+ tradeanim_textbox_scroll
tradeanim_take_care_of_text
tradeanim_scroll_out_right
tradeanim_end
@@ -58,10 +58,10 @@
ld hl, wOTTrademonSpecies
ld de, wPlayerTrademonSpecies
call LinkTradeAnim_LoadTradeMonSpecies
- ld de, .data_28f7e
- jr RunTradeAnimSequence
+ ld de, .script
+ jr RunTradeAnimScript
-.data_28f7e
+.script
tradeanim_ot_sends_text_2
tradeanim_ot_bids_farewell
tradeanim_wait_40
@@ -75,10 +75,10 @@
tradeanim_show_getmon_data
tradeanim_poof
tradeanim_wait_anim
- tradeanim_1d
+ tradeanim_frontpic_scroll
tradeanim_animate_frontpic
tradeanim_wait_180_if_ot_egg
- tradeanim_1e
+ tradeanim_textbox_scroll
tradeanim_take_care_of_text
tradeanim_scroll_out_right
@@ -92,7 +92,7 @@
tradeanim_wait_anim
tradeanim_bulge_through_tube
tradeanim_wait_anim
- tradeanim_1e
+ tradeanim_textbox_scroll
tradeanim_give_trademon_sfx
tradeanim_tube_to_player
tradeanim_sent_to_ot_text
@@ -99,7 +99,7 @@
tradeanim_scroll_out_right
tradeanim_end
-RunTradeAnimSequence: ; 28fa1
+RunTradeAnimScript: ; 28fa1
ld hl, wTradeAnimPointer
ld [hl], e
inc hl
@@ -132,6 +132,7 @@
pop af
ld [hMapAnims], a
ret
+
; 28fdb
.TradeAnimLayout: ; 28fdb
@@ -197,8 +198,9 @@
ld a, [wOTTrademonSpecies]
ld de, wOTTrademonSpeciesName
call TradeAnim_GetNickname
- call Function297ed
+ call TradeAnim_NormalPals
ret
+
; 29082
DoTradeAnimation: ; 29082
@@ -217,6 +219,7 @@
call LoadStandardFont
scf
ret
+
; 290a0
.DoTradeAnimCommand: ; 290a0
@@ -224,9 +227,8 @@
ld e, a
ld d, 0
ld hl, .JumpTable
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -234,63 +236,64 @@
; 290af
.JumpTable: ; 290af
- dw TradeAnim_Next ; 00
- dw TradeAnim_ShowGivemonData ; 01
- dw TradeAnim_ShowGetmonData ; 02
- dw TradeAnim_EnterLinkTube ; 03
- dw TradeAnim_04 ; 04
- dw TradeAnim_ExitLinkTube ; 05
- dw TradeAnim_TubeToOT1 ; 06
- dw TradeAnim_TubeToOT2 ; 07
- dw TradeAnim_TubeToOT3 ; 08
- dw TradeAnim_TubeToOT4 ; 09
- dw TradeAnim_TubeToOT5 ; 0a
- dw TradeAnim_TubeToOT6 ; 0b
- dw TradeAnim_TubeToOT7 ; 0c
- dw TradeAnim_TubeToOT8 ; 0d
- dw TradeAnim_TubeToPlayer1 ; 0e
- dw TradeAnim_TubeToPlayer2 ; 0f
- dw TradeAnim_TubeToPlayer3 ; 10
- dw TradeAnim_TubeToPlayer4 ; 11
- dw TradeAnim_TubeToPlayer5 ; 12
- dw TradeAnim_TubeToPlayer6 ; 13
- dw TradeAnim_TubeToPlayer7 ; 14
- dw TradeAnim_TubeToPlayer8 ; 15
- dw TradeAnim_SentToOTText ; 16
- dw TradeAnim_OTBidsFarewell ; 17
- dw TradeAnim_TakeCareOfText ; 18
- dw TradeAnim_OTSendsText1 ; 19
- dw TradeAnim_OTSendsText2 ; 1a
- dw TradeAnim_SetupGivemonScroll ; 1b
- dw TradeAnim_DoGivemonScroll ; 1c
- dw TradeAnim_1d ; 1d
- dw TradeAnim_1e ; 1e
- dw TradeAnim_ScrollOutRight ; 1f
- dw TradeAnim_ScrollOutRight2 ; 20
- dw TraideAnim_Wait80 ; 21
- dw TraideAnim_Wait40 ; 22
- dw TradeAnim_RockingBall ; 23
- dw TradeAnim_DropBall ; 24
- dw TradeAnim_WaitAnim ; 25
- dw TradeAnim_WaitAnim2 ; 26
- dw TradeAnim_Poof ; 27
+ dw TradeAnim_AdvanceScriptPointer ; 00
+ dw TradeAnim_ShowGivemonData ; 01
+ dw TradeAnim_ShowGetmonData ; 02
+ dw TradeAnim_EnterLinkTube1 ; 03
+ dw TradeAnim_EnterLinkTube2 ; 04
+ dw TradeAnim_ExitLinkTube ; 05
+ dw TradeAnim_TubeToOT1 ; 06
+ dw TradeAnim_TubeToOT2 ; 07
+ dw TradeAnim_TubeToOT3 ; 08
+ dw TradeAnim_TubeToOT4 ; 09
+ dw TradeAnim_TubeToOT5 ; 0a
+ dw TradeAnim_TubeToOT6 ; 0b
+ dw TradeAnim_TubeToOT7 ; 0c
+ dw TradeAnim_TubeToOT8 ; 0d
+ dw TradeAnim_TubeToPlayer1 ; 0e
+ dw TradeAnim_TubeToPlayer2 ; 0f
+ dw TradeAnim_TubeToPlayer3 ; 10
+ dw TradeAnim_TubeToPlayer4 ; 11
+ dw TradeAnim_TubeToPlayer5 ; 12
+ dw TradeAnim_TubeToPlayer6 ; 13
+ dw TradeAnim_TubeToPlayer7 ; 14
+ dw TradeAnim_TubeToPlayer8 ; 15
+ dw TradeAnim_SentToOTText ; 16
+ dw TradeAnim_OTBidsFarewell ; 17
+ dw TradeAnim_TakeCareOfText ; 18
+ dw TradeAnim_OTSendsText1 ; 19
+ dw TradeAnim_OTSendsText2 ; 1a
+ dw TradeAnim_SetupGivemonScroll ; 1b
+ dw TradeAnim_DoGivemonScroll ; 1c
+ dw TradeAnim_FrontpicScrollStart ; 1d
+ dw TradeAnim_TextboxScrollStart ; 1e
+ dw TradeAnim_ScrollOutRight ; 1f
+ dw TradeAnim_ScrollOutRight2 ; 20
+ dw TraideAnim_Wait80 ; 21
+ dw TraideAnim_Wait40 ; 22
+ dw TradeAnim_RockingBall ; 23
+ dw TradeAnim_DropBall ; 24
+ dw TradeAnim_WaitAnim ; 25
+ dw TradeAnim_WaitAnim2 ; 26
+ dw TradeAnim_Poof ; 27
dw TradeAnim_BulgeThroughTube ; 28
- dw TradeAnim_GiveTrademonSFX ; 29
- dw TradeAnim_GetTrademonSFX ; 2a
- dw TradeAnim_End ; 2b
- dw TradeAnim_AnimateFrontpic ; 2c
- dw TraideAnim_Wait96 ; 2d
- dw TraideAnim_Wait80IfOTEgg ; 2e
- dw TraideAnim_Wait180IfOTEgg ; 2f
+ dw TradeAnim_GiveTrademonSFX ; 29
+ dw TradeAnim_GetTrademonSFX ; 2a
+ dw TradeAnim_End ; 2b
+ dw TradeAnim_AnimateFrontpic ; 2c
+ dw TraideAnim_Wait96 ; 2d
+ dw TraideAnim_Wait80IfOTEgg ; 2e
+ dw TraideAnim_Wait180IfOTEgg ; 2f
; 2910f
-NextTradeAnim: ; 2910f
+TradeAnim_IncrementJumptableIndex: ; 2910f
ld hl, wJumptableIndex
inc [hl]
ret
+
; 29114
-TradeAnim_Next: ; 29114
+TradeAnim_AdvanceScriptPointer: ; 29114
ld hl, wTradeAnimPointer
ld e, [hl]
inc hl
@@ -302,6 +305,7 @@
dec hl
ld [hl], e
ret
+
; 29123
TradeAnim_End: ; 29123
@@ -308,41 +312,44 @@
ld hl, wJumptableIndex
set 7, [hl]
ret
+
; 29129
TradeAnim_TubeToOT1: ; 29129
- ld a, $ed
- call Function292f6
+ ld a, $ed ; >>>>>>>>
+ call TradeAnim_PlaceTrademonStatsOnTubeAnim
ld a, [wLinkTradeSendmonSpecies]
ld [wd265], a
xor a
depixel 5, 11, 4, 0
ld b, $0
- jr Function2914e
+ jr TradeAnim_InitTubeAnim
TradeAnim_TubeToPlayer1: ; 2913c
- ld a, $ee
- call Function292f6
+ ld a, $ee ; <<<<<<<<
+ call TradeAnim_PlaceTrademonStatsOnTubeAnim
ld a, [wLinkTradeGetmonSpecies]
ld [wd265], a
ld a, $2
depixel 9, 18, 4, 4
ld b, $4
-
-Function2914e: ; 2914e
+TradeAnim_InitTubeAnim: ; 2914e
push bc
push de
push bc
push de
+
push af
call DisableLCD
callab ClearSpriteAnims
hlbgcoord 20, 3
- ld bc, $c
+ ld bc, 12
ld a, $60
call ByteFill
pop af
- call Function29281
+
+ call TradeAnim_TubeAnimJumptable
+
xor a
ld [hSCX], a
ld a, $7
@@ -351,35 +358,42 @@
ld [hWY], a
call EnableLCD
call LoadTradeBubbleGFX
+
pop de
- ld a, SPRITE_ANIM_INDEX_11
+ ld a, SPRITE_ANIM_INDEX_TRADEMON_ICON
call _InitSpriteAnimStruct
- ld hl, $b
+
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
pop bc
ld [hl], b
+
pop de
- ld a, SPRITE_ANIM_INDEX_12
+ ld a, SPRITE_ANIM_INDEX_TRADEMON_BUBBLE
call _InitSpriteAnimStruct
- ld hl, $b
+
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
pop bc
ld [hl], b
+
call WaitBGMap
- ld b, SCGB_1B
+ ld b, SCGB_TRADE_TUBE
call GetSGBLayout
ld a, %11100100 ; 3,2,1,0
call DmgToCgbBGPals
- ld a, $d0
+ ld a, %11010000
call DmgToCgbObjPal0
- call NextTradeAnim
+
+ call TradeAnim_IncrementJumptableIndex
ld a, $5c
ld [wcf64], a
ret
+
; 291af
TradeAnim_TubeToOT2: ; 291af
- call Function2981d
+ call TradeAnim_FlashBGPals
ld a, [hSCX]
add $2
ld [hSCX], a
@@ -386,13 +400,14 @@
cp $50
ret nz
ld a, $1
- call Function29281
- call NextTradeAnim
+ call TradeAnim_TubeAnimJumptable
+ call TradeAnim_IncrementJumptableIndex
ret
+
; 291c4
TradeAnim_TubeToOT3: ; 291c4
- call Function2981d
+ call TradeAnim_FlashBGPals
ld a, [hSCX]
add $2
ld [hSCX], a
@@ -399,24 +414,26 @@
cp $a0
ret nz
ld a, $2
- call Function29281
- call NextTradeAnim
+ call TradeAnim_TubeAnimJumptable
+ call TradeAnim_IncrementJumptableIndex
ret
+
; 291d9
TradeAnim_TubeToOT4: ; 291d9
- call Function2981d
+ call TradeAnim_FlashBGPals
ld a, [hSCX]
add $2
ld [hSCX], a
and a
ret nz
- call NextTradeAnim
+ call TradeAnim_IncrementJumptableIndex
ret
+
; 291e8
TradeAnim_TubeToPlayer3: ; 291e8
- call Function2981d
+ call TradeAnim_FlashBGPals
ld a, [hSCX]
sub $2
ld [hSCX], a
@@ -423,13 +440,14 @@
cp $b0
ret nz
ld a, $1
- call Function29281
- call NextTradeAnim
+ call TradeAnim_TubeAnimJumptable
+ call TradeAnim_IncrementJumptableIndex
ret
+
; 291fd
TradeAnim_TubeToPlayer4: ; 291fd
- call Function2981d
+ call TradeAnim_FlashBGPals
ld a, [hSCX]
sub $2
ld [hSCX], a
@@ -436,20 +454,22 @@
cp $60
ret nz
xor a
- call Function29281
- call NextTradeAnim
+ call TradeAnim_TubeAnimJumptable
+ call TradeAnim_IncrementJumptableIndex
ret
+
; 29211
TradeAnim_TubeToPlayer5: ; 29211
- call Function2981d
+ call TradeAnim_FlashBGPals
ld a, [hSCX]
sub $2
ld [hSCX], a
and a
ret nz
- call NextTradeAnim
+ call TradeAnim_IncrementJumptableIndex
ret
+
; 29220
TradeAnim_TubeToOT6:
@@ -456,8 +476,9 @@
TradeAnim_TubeToPlayer6: ; 29220
ld a, $80
ld [wcf64], a
- call NextTradeAnim
+ call TradeAnim_IncrementJumptableIndex
ret
+
; 29229
TradeAnim_TubeToOT8:
@@ -478,9 +499,10 @@
call EnableLCD
call LoadTradeBallAndCableGFX
call WaitBGMap
- call Function297ed
- call TradeAnim_Next
+ call TradeAnim_NormalPals
+ call TradeAnim_AdvanceScriptPointer
ret
+
; 2925d
TradeAnim_TubeToOT5:
@@ -487,7 +509,7 @@
TradeAnim_TubeToOT7:
TradeAnim_TubeToPlayer2:
TradeAnim_TubeToPlayer7: ; 2925d
- call Function2981d
+ call TradeAnim_FlashBGPals
ld hl, wcf64
ld a, [hl]
and a
@@ -496,32 +518,34 @@
ret
.done
- call NextTradeAnim
+ call TradeAnim_IncrementJumptableIndex
ret
+
; 2926d
TradeAnim_GiveTrademonSFX: ; 2926d
- call TradeAnim_Next
+ call TradeAnim_AdvanceScriptPointer
ld de, SFX_GIVE_TRADEMON
call PlaySFX
ret
+
; 29277
TradeAnim_GetTrademonSFX: ; 29277
- call TradeAnim_Next
+ call TradeAnim_AdvanceScriptPointer
ld de, SFX_GET_TRADEMON
call PlaySFX
ret
+
; 29281
-Function29281: ; 29281
+TradeAnim_TubeAnimJumptable: ; 29281
and 3
ld e, a
ld d, 0
- ld hl, Jumptable_2928f
-rept 2
+ ld hl, .Jumptable
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -528,15 +552,16 @@
jp [hl]
; 2928f
-Jumptable_2928f: ; 2928f
- dw Function29297
- dw Function292af
- dw Function292be
- dw Function29297
+.Jumptable: ; 2928f
+ dw .Zero
+ dw .One
+ dw .Two
+ dw .Three
; 29297
-Function29297: ; 29297
- call Function297cf
+.Zero: ; 29297
+.Three: ; 29297
+ call TradeAnim_BlankTileMap
hlcoord 9, 3
ld [hl], $5b
inc hl
@@ -544,21 +569,23 @@
ld a, $60
call ByteFill
hlcoord 3, 2
- call Function292ec
+ call TradeAnim_CopyTradeGameBoyTilemap
ret
+
; 292af
-Function292af: ; 292af
- call Function297cf
+.One: ; 292af
+ call TradeAnim_BlankTileMap
hlcoord 0, 3
ld bc, SCREEN_WIDTH
ld a, $60
call ByteFill
ret
+
; 292be
-Function292be: ; 292be
- call Function297cf
+.Two: ; 292be
+ call TradeAnim_BlankTileMap
hlcoord 0, 3
ld bc, $11
ld a, $60
@@ -582,18 +609,20 @@
ld a, $5b
ld [hl], a
hlcoord 10, 6
- call Function292ec
+ call TradeAnim_CopyTradeGameBoyTilemap
ret
+
; 292ec
-Function292ec: ; 292ec
+TradeAnim_CopyTradeGameBoyTilemap: ; 292ec
ld de, TradeGameBoyTilemap
lb bc, 8, 6
- call Function297db
+ call TradeAnim_CopyBoxFromDEtoHL
ret
+
; 292f6
-Function292f6: ; 292f6
+TradeAnim_PlaceTrademonStatsOnTubeAnim: ; 292f6
push af
call ClearBGPalettes
call WaitTop
@@ -631,9 +660,10 @@
ld [hBGMapAddress + 1], a
call ClearTileMap
ret
+
; 29348
-TradeAnim_EnterLinkTube: ; 29348
+TradeAnim_EnterLinkTube1: ; 29348
call ClearTileMap
call WaitTop
ld a, $a0
@@ -640,11 +670,11 @@
ld [hSCX], a
call DelayFrame
hlcoord 8, 2
- ld de, Tilemap_298f7
+ ld de, TradeLinkTubeTilemap
lb bc, 3, 12
- call Function297db
+ call TradeAnim_CopyBoxFromDEtoHL
call WaitBGMap
- ld b, SCGB_1B
+ ld b, SCGB_TRADE_TUBE
call GetSGBLayout
ld a, %11100100 ; 3,2,1,0
call DmgToCgbBGPals
@@ -652,11 +682,12 @@
call DmgToCgbObjPals
ld de, SFX_POTION
call PlaySFX
- call NextTradeAnim
+ call TradeAnim_IncrementJumptableIndex
ret
+
; 2937e
-TradeAnim_04: ; 2937e
+TradeAnim_EnterLinkTube2: ; 2937e
ld a, [hSCX]
and a
jr z, .done
@@ -667,24 +698,26 @@
.done
ld c, 80
call DelayFrames
- call TradeAnim_Next
+ call TradeAnim_AdvanceScriptPointer
ret
+
; 29391
TradeAnim_ExitLinkTube: ; 29391
ld a, [hSCX]
cp $a0
- jr z, .asm_2939c
+ jr z, .done
sub $4
ld [hSCX], a
ret
-.asm_2939c
+.done
call ClearTileMap
xor a
ld [hSCX], a
- call TradeAnim_Next
+ call TradeAnim_AdvanceScriptPointer
ret
+
; 293a6
TradeAnim_SetupGivemonScroll: ; 293a6
@@ -694,8 +727,9 @@
ld [hSCX], a
ld a, $50
ld [hWY], a
- call TradeAnim_Next
+ call TradeAnim_AdvanceScriptPointer
ret
+
; 293b6
TradeAnim_DoGivemonScroll: ; 293b6
@@ -714,26 +748,29 @@
ld [hWX], a
xor a
ld [hSCX], a
- call TradeAnim_Next
+ call TradeAnim_AdvanceScriptPointer
ret
+
; 293d2
-TradeAnim_1d: ; 293d2
+TradeAnim_FrontpicScrollStart: ; 293d2
ld a, $7
ld [hWX], a
ld a, $50
ld [hWY], a
- call TradeAnim_Next
+ call TradeAnim_AdvanceScriptPointer
ret
+
; 293de
-TradeAnim_1e: ; 293de
+TradeAnim_TextboxScrollStart: ; 293de
ld a, $7
ld [hWX], a
ld a, $90
ld [hWY], a
- call TradeAnim_Next
+ call TradeAnim_AdvanceScriptPointer
ret
+
; 293ea
TradeAnim_ScrollOutRight: ; 293ea
@@ -750,8 +787,9 @@
ld a, VBGMap0 / $100
ld [hBGMapAddress + 1], a
call ClearTileMap
- call NextTradeAnim
+ call TradeAnim_IncrementJumptableIndex
ret
+
; 2940c
TradeAnim_ScrollOutRight2: ; 2940c
@@ -772,12 +810,13 @@
ld [hWY], a
ld a, VBGMap0 / $100
ld [hBGMapAddress + 1], a
- call TradeAnim_Next
+ call TradeAnim_AdvanceScriptPointer
ret
+
; 2942e
TradeAnim_ShowGivemonData: ; 2942e
- call Function2951f
+ call ShowPlayerTrademonStats
ld a, [wPlayerTrademonSpecies]
ld [CurPartySpecies], a
ld a, [wPlayerTrademonDVs]
@@ -784,7 +823,7 @@
ld [TempMonDVs], a
ld a, [wPlayerTrademonDVs + 1]
ld [TempMonDVs + 1], a
- ld b, SCGB_1A
+ ld b, SCGB_PLAYER_OR_MON_FRONTPIC_PALS
call GetSGBLayout
ld a, %11100100 ; 3,2,1,0
call DmgToCgbBGPals
@@ -798,12 +837,13 @@
call PlayCryHeader
.skip_cry
- call TradeAnim_Next
+ call TradeAnim_AdvanceScriptPointer
ret
+
; 29461
TradeAnim_ShowGetmonData: ; 29461
- call Function29549
+ call ShowOTTrademonStats
ld a, [wOTTrademonSpecies]
ld [CurPartySpecies], a
ld a, [wOTTrademonDVs]
@@ -810,19 +850,21 @@
ld [TempMonDVs], a
ld a, [wOTTrademonDVs + 1]
ld [TempMonDVs + 1], a
- ld b, SCGB_1A
+ ld b, SCGB_PLAYER_OR_MON_FRONTPIC_PALS
call GetSGBLayout
ld a, %11100100 ; 3,2,1,0
call DmgToCgbBGPals
call TradeAnim_ShowGetmonFrontpic
- call TradeAnim_Next
+ call TradeAnim_AdvanceScriptPointer
ret
+
; 29487
TradeAnim_AnimateFrontpic: ; 29487
callba AnimateTrademonFrontpic
- call TradeAnim_Next
+ call TradeAnim_AdvanceScriptPointer
ret
+
; 29491
TradeAnim_GetFrontpic: ; 29491
@@ -836,6 +878,7 @@
pop de
predef GetFrontpic
ret
+
; 294a9
TradeAnim_GetNickname: ; 294a9
@@ -847,6 +890,7 @@
ld bc, NAME_LENGTH
call CopyBytes
ret
+
; 294bb
TradeAnim_ShowGivemonFrontpic: ; 294bb
@@ -861,7 +905,7 @@
lb bc, 10, $31
call Request2bpp
call WaitTop
- call Function297cf
+ call TradeAnim_BlankTileMap
hlcoord 7, 2
xor a
ld [hGraphicStartTile], a
@@ -869,27 +913,31 @@
predef PlaceGraphic
call WaitBGMap
ret
+
; 294e7
TraideAnim_Wait80: ; 294e7
ld c, 80
call DelayFrames
- call TradeAnim_Next
+ call TradeAnim_AdvanceScriptPointer
ret
+
; 294f0
TraideAnim_Wait40: ; 294f0
ld c, 40
call DelayFrames
- call TradeAnim_Next
+ call TradeAnim_AdvanceScriptPointer
ret
+
; 294f9
TraideAnim_Wait96: ; 294f9
ld c, 96
call DelayFrames
- call TradeAnim_Next
+ call TradeAnim_AdvanceScriptPointer
ret
+
; 29502
TraideAnim_Wait80IfOTEgg: ; 29502
@@ -898,6 +946,7 @@
ld c, 80
call DelayFrames
ret
+
; 2950c
TraideAnim_Wait180IfOTEgg: ; 2950c
@@ -906,55 +955,59 @@
ld c, 180
call DelayFrames
ret
+
; 29516
IsOTTrademonEgg: ; 29516
- call TradeAnim_Next
+ call TradeAnim_AdvanceScriptPointer
ld a, [wOTTrademonSpecies]
cp EGG
ret
+
; 2951f
-Function2951f: ; 2951f
+ShowPlayerTrademonStats: ; 2951f
ld de, wPlayerTrademonSpecies
ld a, [de]
cp EGG
- jr z, Function295a1
- call Function29573
+ jr z, TrademonStats_Egg
+ call TrademonStats_MonTemplate
ld de, wPlayerTrademonSpecies
- call Function295e3
+ call TrademonStats_PrintSpeciesNumber
ld de, wPlayerTrademonSpeciesName
- call Function295ef
+ call TrademonStats_PrintSpeciesName
ld a, [wPlayerTrademonCaughtData]
ld de, wPlayerTrademonOTName
- call Function295f6
- ld de, PlayerScreens
- call Function29611
- call Function295d8
+ call TrademonStats_PrintOTName
+ ld de, wPlayerTrademonID
+ call TrademonStats_PrintTrademonID
+ call TrademonStats_WaitBGMap
ret
+
; 29549
-Function29549: ; 29549
+ShowOTTrademonStats: ; 29549
ld de, wOTTrademonSpecies
ld a, [de]
cp EGG
- jr z, Function295a1
- call Function29573
+ jr z, TrademonStats_Egg
+ call TrademonStats_MonTemplate
ld de, wOTTrademonSpecies
- call Function295e3
+ call TrademonStats_PrintSpeciesNumber
ld de, wOTTrademonSpeciesName
- call Function295ef
+ call TrademonStats_PrintSpeciesName
ld a, [wOTTrademonCaughtData]
ld de, wOTTrademonOTName
- call Function295f6
+ call TrademonStats_PrintOTName
ld de, wOTTrademonID
- call Function29611
- call Function295d8
+ call TrademonStats_PrintTrademonID
+ call TrademonStats_WaitBGMap
ret
+
; 29573
-Function29573: ; 29573
+TrademonStats_MonTemplate: ; 29573
call WaitTop
- call Function297cf
+ call TradeAnim_BlankTileMap
ld a, VBGMap1 / $100
ld [hBGMapAddress + 1], a
hlcoord 3, 0
@@ -962,12 +1015,13 @@
ld c, $d
call TextBox
hlcoord 4, 0
- ld de, String29591
+ ld de, .OTMonData
call PlaceString
ret
+
; 29591
-String29591: ; 29591
+.OTMonData: ; 29591
db "─── №."
next ""
next "OT/"
@@ -974,62 +1028,65 @@
next "<ID>№.@"
; 295a1
-Function295a1: ; 295a1
+TrademonStats_Egg: ; 295a1
call WaitTop
- call Function297cf
+ call TradeAnim_BlankTileMap
ld a, VBGMap1 / $100
ld [hBGMapAddress + 1], a
hlcoord 3, 0
- ld b, $6
- ld c, $d
+ ld b, 6
+ ld c, 13
call TextBox
hlcoord 4, 2
- ld de, String295c2
+ ld de, .EggData
call PlaceString
- call Function295d8
+ call TrademonStats_WaitBGMap
ret
+
; 295c2
-String295c2: ; 295c2
+.EggData: ; 295c2
db "EGG"
next "OT/?????"
next "<ID>№.?????@"
; 295d8
-Function295d8: ; 295d8
+TrademonStats_WaitBGMap: ; 295d8
call WaitBGMap
call WaitTop
ld a, VBGMap0 / $100
ld [hBGMapAddress + 1], a
ret
+
; 295e3
-Function295e3: ; 295e3
+TrademonStats_PrintSpeciesNumber: ; 295e3
hlcoord 10, 0
lb bc, PRINTNUM_LEADINGZEROS | 1, 3
call PrintNum
ld [hl], " "
ret
+
; 295ef
-Function295ef: ; 295ef
+TrademonStats_PrintSpeciesName: ; 295ef
hlcoord 4, 2
call PlaceString
ret
+
; 295f6
-Function295f6: ; 295f6
+TrademonStats_PrintOTName: ; 295f6
cp 3
- jr c, .asm_295fb
+ jr c, .caught_gender_okay
xor a
-
-.asm_295fb
+.caught_gender_okay
push af
hlcoord 7, 4
call PlaceString
inc bc
pop af
- ld hl, Unknown_2960e
+ ld hl, .Gender
ld d, 0
ld e, a
add hl, de
@@ -1036,17 +1093,19 @@
ld a, [hl]
ld [bc], a
ret
+
; 2960e
-Unknown_2960e: ; 2960e
+.Gender: ; 2960e
db " ", "♂", "♀"
; 29611
-Function29611: ; 29611
+TrademonStats_PrintTrademonID: ; 29611
hlcoord 7, 6
lb bc, PRINTNUM_LEADINGZEROS | 2, 5
call PrintNum
ret
+
; 2961b
TradeAnim_RockingBall: ; 2961b
@@ -1053,10 +1112,11 @@
depixel 10, 11, 4, 0
ld a, SPRITE_ANIM_INDEX_0E
call _InitSpriteAnimStruct
- call TradeAnim_Next
+ call TradeAnim_AdvanceScriptPointer
ld a, $20
ld [wcf64], a
ret
+
; 2962c
TradeAnim_DropBall: ; 2962c
@@ -1063,16 +1123,17 @@
depixel 10, 11, 4, 0
ld a, SPRITE_ANIM_INDEX_0E
call _InitSpriteAnimStruct
- ld hl, $b
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
ld [hl], $1
- ld hl, $7
+ ld hl, SPRITEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], $dc
- call TradeAnim_Next
+ call TradeAnim_AdvanceScriptPointer
ld a, $38
ld [wcf64], a
ret
+
; 29649
TradeAnim_Poof: ; 29649
@@ -1079,12 +1140,13 @@
depixel 10, 11, 4, 0
ld a, SPRITE_ANIM_INDEX_0F
call _InitSpriteAnimStruct
- call TradeAnim_Next
+ call TradeAnim_AdvanceScriptPointer
ld a, $10
ld [wcf64], a
ld de, SFX_BALL_POOF
call PlaySFX
ret
+
; 29660
TradeAnim_BulgeThroughTube: ; 29660
@@ -1093,21 +1155,21 @@
depixel 5, 11
ld a, SPRITE_ANIM_INDEX_10
call _InitSpriteAnimStruct
- call TradeAnim_Next
+ call TradeAnim_AdvanceScriptPointer
ld a, $40
ld [wcf64], a
ret
+
; 29676
-Function29676: ; 29676 (a:5676)
- ld hl, $b
+TradeAnim_AnimateTrademonInTube: ; 29676 (a:5676)
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
ld e, [hl]
ld d, 0
- ld hl, Jumptable_29686
-rept 2
+ ld hl, .Jumptable
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -1114,100 +1176,105 @@
jp [hl]
; 29686
-Jumptable_29686: ; 29686 (a:5686)
- dw Function2969a
- dw Function296a4
- dw Function296af
- dw Function296bd
- dw Function296cf
- dw Function296dd
- dw Function296f2
+.Jumptable: ; 29686 (a:5686)
+ dw .InitTimer
+ dw .WaitTimer1
+ dw .MoveRight
+ dw .MoveDown
+ dw .MoveUp
+ dw .MoveLeft
+ dw .WaitTimer2
; 2969a
-Function29694: ; 29694 (a:5694)
- ld hl, $b
+.JumptableNext: ; 29694 (a:5694)
+ ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
inc [hl]
ret
-Function2969a: ; 2969a (a:569a)
- call Function29694
- ld hl, $c
+.InitTimer: ; 2969a (a:569a)
+ call .JumptableNext
+ ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld [hl], $80
ret
-Function296a4: ; 296a4 (a:56a4)
- ld hl, $c
+.WaitTimer1: ; 296a4 (a:56a4)
+ ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, [hl]
dec [hl]
and a
ret nz
- call Function29694
+ call .JumptableNext
-Function296af: ; 296af (a:56af)
- ld hl, $4
+.MoveRight: ; 296af (a:56af)
+ ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
cp $94
- jr nc, .asm_296ba
+ jr nc, .done_move_right
inc [hl]
ret
-.asm_296ba
- call Function29694
-Function296bd: ; 296bd (a:56bd)
- ld hl, $5
+.done_move_right
+ call .JumptableNext
+
+.MoveDown: ; 296bd (a:56bd)
+ ld hl, SPRITEANIMSTRUCT_YCOORD
add hl, bc
ld a, [hl]
cp $4c
- jr nc, .asm_296c8
+ jr nc, .done_move_down
inc [hl]
ret
-.asm_296c8
- ld hl, $
+
+.done_move_down
+ ld hl, SPRITEANIMSTRUCT_INDEX
add hl, bc
ld [hl], $0
ret
-Function296cf: ; 296cf (a:56cf)
- ld hl, $5
+.MoveUp: ; 296cf (a:56cf)
+ ld hl, SPRITEANIMSTRUCT_YCOORD
add hl, bc
ld a, [hl]
cp $2c
- jr z, .asm_296da
+ jr z, .done_move_up
dec [hl]
ret
-.asm_296da
- call Function29694
-Function296dd: ; 296dd (a:56dd)
- ld hl, $4
+.done_move_up
+ call .JumptableNext
+
+.MoveLeft: ; 296dd (a:56dd)
+ ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
cp $58
- jr z, .asm_296e8
+ jr z, .done_move_left
dec [hl]
ret
-.asm_296e8
- call Function29694
- ld hl, $c
+
+.done_move_left
+ call .JumptableNext
+ ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld [hl], $80
ret
-Function296f2: ; 296f2 (a:56f2)
- ld hl, $c
+.WaitTimer2: ; 296f2 (a:56f2)
+ ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, [hl]
dec [hl]
and a
ret nz
- ld hl, $
+ ld hl, SPRITEANIMSTRUCT_INDEX
add hl, bc
ld [hl], $0
ret
+
; 29701 (a:5701)
TradeAnim_SentToOTText: ; 29701
@@ -1214,33 +1281,34 @@
ld a, [wLinkMode]
cp LINK_TIMECAPSULE
jr z, .time_capsule
- ld hl, UnknownText_0x29737
+ ld hl, .Text_MonName
call PrintText
ld c, 189
call DelayFrames
- ld hl, UnknownText_0x29732
+ ld hl, .Text_WasSentTo
call PrintText
- call Function297c9
+ call TradeAnim_Wait80Frames
ld c, 128
call DelayFrames
- call TradeAnim_Next
+ call TradeAnim_AdvanceScriptPointer
ret
.time_capsule
- ld hl, UnknownText_0x29732
+ ld hl, .Text_WasSentTo
call PrintText
- call Function297c9
- call TradeAnim_Next
+ call TradeAnim_Wait80Frames
+ call TradeAnim_AdvanceScriptPointer
ret
+
; 29732
-UnknownText_0x29732: ; 0x29732
+.Text_WasSentTo: ; 0x29732
; was sent to @ .
text_jump UnknownText_0x1bc6e9
db "@"
; 0x29737
-UnknownText_0x29737: ; 0x29737
+.Text_MonName: ; 0x29737
;
text_jump UnknownText_0x1bc701
db "@"
@@ -1247,23 +1315,24 @@
; 0x2973c
TradeAnim_OTBidsFarewell: ; 2973c
- ld hl, UnknownText_0x29752
+ ld hl, .Text_BidsFarewellToMon
call PrintText
- call Function297c9
- ld hl, UnknownText_0x29757
+ call TradeAnim_Wait80Frames
+ ld hl, .Text_MonName
call PrintText
- call Function297c9
- call TradeAnim_Next
+ call TradeAnim_Wait80Frames
+ call TradeAnim_AdvanceScriptPointer
ret
+
; 29752
-UnknownText_0x29752: ; 0x29752
+.Text_BidsFarewellToMon: ; 0x29752
; bids farewell to
text_jump UnknownText_0x1bc703
db "@"
; 0x29757
-UnknownText_0x29757: ; 0x29757
+.Text_MonName: ; 0x29757
; .
text_jump UnknownText_0x1bc719
db "@"
@@ -1276,14 +1345,15 @@
ld a, " "
call ByteFill
call WaitBGMap
- ld hl, UnknownText_0x2977a
+ ld hl, .Text_TakeGoodCareOfMon
call PrintText
- call Function297c9
- call TradeAnim_Next
+ call TradeAnim_Wait80Frames
+ call TradeAnim_AdvanceScriptPointer
ret
+
; 2977a
-UnknownText_0x2977a: ; 0x2977a
+.Text_TakeGoodCareOfMon: ; 0x2977a
; Take good care of @ .
text_jump UnknownText_0x1bc71f
db "@"
@@ -1290,25 +1360,26 @@
; 0x2977f
TradeAnim_OTSendsText1: ; 2977f
- ld hl, UnknownText_0x2979a
+ ld hl, .Text_ForYourMon
call PrintText
- call Function297c9
- ld hl, UnknownText_0x2979f
+ call TradeAnim_Wait80Frames
+ ld hl, .Text_OTSends
call PrintText
- call Function297c9
+ call TradeAnim_Wait80Frames
ld c, 14
call DelayFrames
- call TradeAnim_Next
+ call TradeAnim_AdvanceScriptPointer
ret
+
; 2979a
-UnknownText_0x2979a: ; 0x2979a
+.Text_ForYourMon: ; 0x2979a
; For @ 's @ ,
text_jump UnknownText_0x1bc739
db "@"
; 0x2979f
-UnknownText_0x2979f: ; 0x2979f
+.Text_OTSends: ; 0x2979f
; sends @ .
text_jump UnknownText_0x1bc74c
db "@"
@@ -1315,64 +1386,68 @@
; 0x297a4
TradeAnim_OTSendsText2: ; 297a4
- ld hl, UnknownText_0x297bf
+ ld hl, .Text_WillTrade
call PrintText
- call Function297c9
- ld hl, UnknownText_0x297c4
+ call TradeAnim_Wait80Frames
+ ld hl, .Text_ForYourMon
call PrintText
- call Function297c9
+ call TradeAnim_Wait80Frames
ld c, 14
call DelayFrames
- call TradeAnim_Next
+ call TradeAnim_AdvanceScriptPointer
ret
+
; 297bf
-UnknownText_0x297bf: ; 0x297bf
+.Text_WillTrade: ; 0x297bf
; will trade @ @
text_jump UnknownText_0x1bc75e
db "@"
; 0x297c4
-UnknownText_0x297c4: ; 0x297c4
+.Text_ForYourMon: ; 0x297c4
; for @ 's @ .
text_jump UnknownText_0x1bc774
db "@"
; 0x297c9
-Function297c9: ; 297c9
+TradeAnim_Wait80Frames: ; 297c9
ld c, 80
call DelayFrames
ret
+
; 297cf
-Function297cf: ; 297cf
+TradeAnim_BlankTileMap: ; 297cf
hlcoord 0, 0
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
ld a, " "
call ByteFill
ret
+
; 297db
-Function297db: ; 297db
-.asm_297db
+TradeAnim_CopyBoxFromDEtoHL: ; 297db
+.row
push bc
push hl
-.asm_297dd
+.col
ld a, [de]
inc de
ld [hli], a
dec c
- jr nz, .asm_297dd
+ jr nz, .col
pop hl
ld bc, SCREEN_WIDTH
add hl, bc
pop bc
dec b
- jr nz, .asm_297db
+ jr nz, .row
ret
+
; 297ed
-Function297ed: ; 297ed
+TradeAnim_NormalPals: ; 297ed
ld a, [hSGB]
and a
ld a, %11100100 ; 3,2,1,0
@@ -1384,6 +1459,7 @@
ld a, %11100100 ; 3,2,1,0
call DmgToCgbBGPals
ret
+
; 297ff
LinkTradeAnim_LoadTradePlayerNames: ; 297ff
@@ -1396,6 +1472,7 @@
ld bc, NAME_LENGTH
call CopyBytes
ret
+
; 29814
LinkTradeAnim_LoadTradeMonSpecies: ; 29814
@@ -1404,16 +1481,18 @@
ld a, [de]
ld [wLinkTradeGetmonSpecies], a
ret
+
; 2981d
-Function2981d: ; 2981d
+TradeAnim_FlashBGPals: ; 2981d
ld a, [wcf65]
and $7
ret nz
ld a, [rBGP]
- xor $3c
+ xor %00111100
call DmgToCgbBGPals
ret
+
; 2982b
LoadTradeBallAndCableGFX: ; 2982b
@@ -1435,6 +1514,7 @@
ld [hli], a
ld [hl], $62
ret
+
; 2985a
LoadTradeBubbleGFX: ; 2985a
@@ -1450,6 +1530,7 @@
ld [hli], a
ld [hl], $62
ret
+
; 29879
TradeAnim_WaitAnim: ; 29879
@@ -1461,8 +1542,9 @@
ret
.done
- call TradeAnim_Next
+ call TradeAnim_AdvanceScriptPointer
ret
+
; 29886
TradeAnim_WaitAnim2: ; 29886
@@ -1474,8 +1556,9 @@
ret
.done
- call TradeAnim_Next
+ call TradeAnim_AdvanceScriptPointer
ret
+
; 29893
@@ -1484,7 +1567,7 @@
; It was meant for use in Japanese versions, so the
; constant used for copy length was changed by accident.
- ld hl, Unknown_298b5
+ ld hl, .DebugTradeData
ld a, [hli]
ld [wPlayerTrademonSpecies], a
@@ -1508,9 +1591,10 @@
dec c
jr nz, .loop2
ret
+
; 298b5
-Unknown_298b5: ; 298b5
+.DebugTradeData: ; 298b5
db VENUSAUR, "ゲーフり@@", $23, $01 ; GAME FREAK
db CHARIZARD, "クりーチャ@", $56, $04 ; Creatures Inc.
; 298c7
@@ -1528,7 +1612,7 @@
db $4f, $50, $50, $50, $51, $52
; 297f7
-Tilemap_298f7: ; 297f7
+TradeLinkTubeTilemap: ; 297f7
; 12x3
db $43, $55, $56, $53, $53, $53, $53, $53, $53, $53, $53, $53
db $43, $57, $58, $54, $54, $54, $54, $54, $54, $54, $54, $54
--- a/engine/trainer_card.asm
+++ b/engine/trainer_card.asm
@@ -62,9 +62,9 @@
call WaitBGMap
ld hl, wJumptableIndex
xor a
-rept 3
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
ld [hl], a
ret
--- a/engine/unown_puzzle.asm
+++ b/engine/unown_puzzle.asm
@@ -47,7 +47,7 @@
ld a, $93
ld [rLCDC], a
call WaitBGMap
- ld b, SCGB_18
+ ld b, SCGB_UNOWN_PUZZLE
call GetSGBLayout
ld a, $e4
call DmgToCgbBGPals
@@ -178,9 +178,8 @@
ld e, a
ld d, 0
ld hl, .Jumptable
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -840,9 +839,8 @@
ld e, a
ld d, 0
ld hl, .LZPointers
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
--- a/engine/unowndex.asm
+++ b/engine/unowndex.asm
@@ -34,9 +34,8 @@
ld e, a
ld d, 0
ld hl, UnownWords
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld e, a
ld d, [hl]
--- a/engine/variables.asm
+++ b/engine/variables.asm
@@ -7,9 +7,9 @@
ld c, a
ld b, 0
ld hl, .VarActionTable
-rept 3
add hl, bc
-endr
+ add hl, bc
+ add hl, bc
ld e, [hl]
inc hl
ld d, [hl]
--- a/engine/warp_connection.asm
+++ b/engine/warp_connection.asm
@@ -1,5 +1,5 @@
-RunCallback_05_03: ; 1045b0
+HandleNewMap: ; 1045b0
call Clearwc7e8
call ResetMapBufferEventFlags
call ResetFlashIfOutOfCave
@@ -7,7 +7,7 @@
call ResetBikeFlags
ld a, MAPCALLBACK_NEWMAP
call RunMapCallback
-RunCallback_03: ; 1045c4
+InitCommandQueue: ; 1045c4
callba ClearCmdQueue
ld a, MAPCALLBACK_CMDQUEUE
call RunMapCallback
@@ -20,18 +20,16 @@
; Return carry if a connection has been entered.
ld a, [wPlayerStepDirection]
and a
- jp z, EnterSouthConnection
- cp 1
- jp z, EnterNorthConnection
- cp 2
- jp z, EnterWestConnection
- cp 3
- jp z, EnterEastConnection
+ jp z, .south
+ cp UP
+ jp z, .north
+ cp LEFT
+ jp z, .west
+ cp RIGHT
+ jp z, .east
ret
-; 1045ed
-
-EnterWestConnection: ; 1045ed
+.west
ld a, [WestConnectedMapGroup]
ld [MapGroup], a
ld a, [WestConnectedMapNumber]
@@ -64,11 +62,9 @@
ld [wOverworldMapAnchor], a
ld a, h
ld [wOverworldMapAnchor + 1], a
- jp EnteredConnection
-; 104629
+ jp .done
-
-EnterEastConnection: ; 104629
+.east
ld a, [EastConnectedMapGroup]
ld [MapGroup], a
ld a, [EastConnectedMapNumber]
@@ -85,27 +81,25 @@
ld h, [hl]
ld l, a
srl c
- jr z, .skip_to_load
+ jr z, .skip_to_load2
ld a, [EastConnectedMapWidth]
add 6
ld e, a
ld d, 0
-.loop
+.loop2
add hl, de
dec c
- jr nz, .loop
+ jr nz, .loop2
-.skip_to_load
+.skip_to_load2
ld a, l
ld [wOverworldMapAnchor], a
ld a, h
ld [wOverworldMapAnchor + 1], a
- jp EnteredConnection
-; 104665
+ jp .done
-
-EnterNorthConnection: ; 104665
+.north
ld a, [NorthConnectedMapGroup]
ld [MapGroup], a
ld a, [NorthConnectedMapNumber]
@@ -128,11 +122,9 @@
ld [wOverworldMapAnchor], a
ld a, h
ld [wOverworldMapAnchor + 1], a
- jp EnteredConnection
-; 104696
+ jp .done
-
-EnterSouthConnection: ; 104696
+.south
ld a, [SouthConnectedMapGroup]
ld [MapGroup], a
ld a, [SouthConnectedMapNumber]
@@ -155,10 +147,7 @@
ld [wOverworldMapAnchor], a
ld a, h
ld [wOverworldMapAnchor + 1], a
- ; fallthrough
-; 1046c4
-
-EnteredConnection: ; 1046c4
+.done
scf
ret
; 1046c6
@@ -239,11 +228,11 @@
callba ReplaceTimeOfDayPals
callba UpdateTimeOfDayPal
call OverworldTextModeSwitch
- call Function104770
- call Function1047a3
+ call .ClearBGMap
+ call .PushAttrMap
ret
-Function104770: ; 104770 (41:4770)
+.ClearBGMap: ; 104770 (41:4770)
ld a, VBGMap0 / $100
ld [wBGMapAnchor + 1], a
xor a
@@ -250,17 +239,21 @@
ld [wBGMapAnchor], a
ld [hSCY], a
ld [hSCX], a
- callba Function5958
+ callba ApplyBGMapAnchorToObjects
+
ld a, [rVBK]
push af
ld a, $1
ld [rVBK], a
+
xor a
ld bc, VBGMap1 - VBGMap0
hlbgcoord 0, 0
call ByteFill
+
pop af
ld [rVBK], a
+
ld a, $60
ld bc, VBGMap1 - VBGMap0
hlbgcoord 0, 0
@@ -267,7 +260,7 @@
call ByteFill
ret
-Function1047a3: ; 1047a3 (41:47a3)
+.PushAttrMap: ; 1047a3 (41:47a3)
decoord 0, 0
call .copy
ld a, [hCGB]
@@ -326,7 +319,7 @@
jr nz, .skip
ld hl, VramState
set 0, [hl]
- call Function2e31
+ call SafeUpdateSprites
.skip
ld a, [wPlayerSpriteSetupFlags]
and %00011100
@@ -369,7 +362,7 @@
.left
ld a, [PlayerStandingMapX]
- sub $4
+ sub 4
cp -1
jr z, .ok
and a
--- a/engine/wildmons.asm
+++ b/engine/wildmons.asm
@@ -62,9 +62,9 @@
ld b, a
ld a, [hli]
ld c, a
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
ld a, NUM_WILDMONS_PER_AREA_TIME_OF_DAY * 3
call .SearchMapForMon
jr nc, .next_grass
@@ -108,9 +108,8 @@
ld a, [wNamedObjectIndexBuffer]
cp [hl]
jr z, .found
-rept 2
inc hl
-endr
+ inc hl
pop af
dec a
jr nz, .ScanMapLoop
@@ -268,15 +267,14 @@
call CheckEncounterRoamMon
jp c, .startwildbattle
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
call CheckOnWater
ld de, .WaterMonTable
jr z, .watermon
-rept 2
inc hl
-endr
+ inc hl
ld a, [TimeOfDay]
ld bc, $e
call AddNTimes
@@ -597,9 +595,9 @@
cp [hl]
jr nz, .DontEncounterRoamMon
; We've decided to take on a beast, so stage its information for battle.
-rept 3
dec hl
-endr
+ dec hl
+ dec hl
ld a, [hli]
ld [TempWildMonSpecies], a
ld a, [hl]
@@ -702,9 +700,8 @@
inc hl
ld c, a
ld b, $0
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [wRoamMons_LastMapGroup]
cp [hl]
jr nz, .done
@@ -866,9 +863,8 @@
dec a
ld c, a
ld b, $0
-rept 2
add hl, bc
-endr
+ add hl, bc
; We now have the pointer to one of the last (rarest) three wild Pokemon found in that area.
inc hl
ld c, [hl] ; Contains the species index of this rare Pokemon
@@ -942,9 +938,8 @@
and $3
ld c, a
ld b, $0
-rept 2
add hl, bc
-endr
+ add hl, bc
inc hl
ld a, [hl]
ld [wNamedObjectIndexBuffer], a
@@ -963,9 +958,8 @@
dec a
ld c, a
ld b, 0
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, BANK(TrainerGroups)
call GetFarHalfword
--- a/event/battle_tower.asm
+++ b/event/battle_tower.asm
@@ -157,9 +157,9 @@
; 8b281
.GetTextPointers: ; 8b281
-rept 3
inc de
-endr
+ inc de
+ inc de
ld a, [de]
ld l, a
inc de
@@ -200,13 +200,11 @@
.PrintNthText: ; 8b2a9
push bc
call .GetTextPointers
-rept 2
inc hl
-endr
+ inc hl
ld b, $0
-rept 2
add hl, bc
-endr
+ add hl, bc
call .LoadTextPointer
call PrintText
pop bc
--- a/event/buena.asm
+++ b/event/buena.asm
@@ -322,9 +322,8 @@
ld hl, .prizes
ld b, 0
ld c, a
-rept 2
add hl, bc
-endr
+ add hl, bc
ret
; 8b15e
--- a/event/bug_contest_2.asm
+++ b/event/bug_contest_2.asm
@@ -13,9 +13,8 @@
ld b, RESET_FLAG
call EventFlagAction
pop hl
-rept 2
inc hl
-endr
+ inc hl
pop bc
dec c
jr nz, .loop1
@@ -34,9 +33,8 @@
ld e, b
ld d, 0
ld hl, BugCatchingContestantEventFlagTable
-rept 2
add hl, de
-endr
+ add hl, de
ld e, [hl]
inc hl
ld d, [hl]
@@ -66,9 +64,8 @@
ld hl, BugCatchingContestantEventFlagTable
ld e, a
ld d, 0
-rept 2
add hl, de
-endr
+ add hl, de
ld e, [hl]
inc hl
ld d, [hl]
--- a/event/bug_contest_judging.asm
+++ b/event/bug_contest_judging.asm
@@ -85,9 +85,8 @@
ld c, a
ld b, 0
ld hl, BugContestantPointers
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
@@ -320,23 +319,20 @@
pop de
jr nz, .done
ld a, e
-rept 2
inc a
-endr
+ inc a
ld [wBugContestTempPersonID], a
dec a
ld c, a
ld b, 0
ld hl, BugContestantPointers
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
-rept 2
inc hl
-endr
+ inc hl
.loop2
call Random
and 3
@@ -344,9 +340,9 @@
jr z, .loop2
ld c, a
ld b, 0
-rept 3
add hl, bc
-endr
+ add hl, bc
+ add hl, bc
ld a, [hli]
ld [wBugContestTempMon], a
ld a, [hli]
@@ -412,9 +408,8 @@
ld a, [wContestMonDVs + 0]
ld b, a
and 2
-rept 2
add a
-endr
+ add a
ld c, a
swap b
@@ -433,12 +428,10 @@
ld a, b
and 2
srl a
-rept 2
add c
-endr
-rept 2
+ add c
add d
-endr
+ add d
call .AddContestStat
--- a/event/celebi.asm
+++ b/event/celebi.asm
@@ -55,9 +55,9 @@
ld c, $4
.OAMloop:
ld [hli], a
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
inc a
dec c
jr nz, .OAMloop
@@ -259,9 +259,8 @@
ld a, d
ld d, $0
ld hl, .sinewave
-rept 2
add hl, de
-endr
+ add hl, de
ld e, [hl]
inc hl
ld d, [hl]
--- a/event/daycare.asm
+++ b/event/daycare.asm
@@ -723,7 +723,7 @@
ld a, [wBreedMon2Species]
cp DITTO
jr z, .GotDVs
- ld a, BREEDMON
+ ld a, TEMPMON
ld [MonType], a
push hl
callba GetGender
--- a/event/dratini.asm
+++ b/event/dratini.asm
@@ -37,9 +37,8 @@
; get address of mon's first move
pop de
-rept 2
inc de
-endr
+ inc de
.GiveMoves:
ld a, [hl]
--- a/event/elevator.asm
+++ b/event/elevator.asm
@@ -70,9 +70,8 @@
call GetFarByte
cp -1
jr z, .fail
-rept 2
inc hl
-endr
+ inc hl
ld a, [wElevatorPointerBank]
call GetFarByte
inc hl
@@ -222,9 +221,8 @@
ld e, a
ld d, 0
ld hl, .floors
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
--- a/event/field_moves.asm
+++ b/event/field_moves.asm
@@ -164,9 +164,8 @@
ld e, a
ld d, 0
ld hl, .dw
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -192,9 +191,8 @@
ld [wcf64], a
; Cut_StartWaiting
ld hl, wJumptableIndex
-rept 2
inc [hl]
-endr
+ inc [hl]
ret
Cut_SpawnAnimateLeaves: ; 8ca3c (23:4a3c)
@@ -269,9 +267,8 @@
add e
ld e, a
ld hl, .Coords
-rept 2
add hl, de
-endr
+ add hl, de
ld e, [hl]
inc hl
ld d, [hl]
@@ -401,9 +398,9 @@
ld c, $4
.loop2
ld [hli], a
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
inc a
dec c
jr nz, .loop2
--- a/event/forced_movement.asm
+++ b/event/forced_movement.asm
@@ -29,32 +29,32 @@
.MovementData_up: ; 0x12564
step_dig 16
- turn_in_down
+ turn_in DOWN
step_dig 16
- turn_head_down
+ turn_head DOWN
step_end
; 0x1256b
.MovementData_down: ; 0x1256b
step_dig 16
- turn_in_up
+ turn_in UP
step_dig 16
- turn_head_up
+ turn_head UP
step_end
; 0x12572
.MovementData_right: ; 0x12572
step_dig 16
- turn_in_left
+ turn_in LEFT
step_dig 16
- turn_head_left
+ turn_head LEFT
step_end
; 0x12579
.MovementData_left: ; 0x12579
step_dig 16
- turn_in_right
+ turn_in RIGHT
step_dig 16
- turn_head_right
+ turn_head RIGHT
step_end
; 0x12580
--- a/event/halloffame.asm
+++ b/event/halloffame.asm
@@ -3,7 +3,7 @@
ld a, [StatusFlags]
push af
ld a, 1
- ld [wc2cd], a
+ ld [wGameLogicPaused], a
call DisableSpriteUpdates
ld a, SPAWN_LANCE
ld [wSpawnAfterChampion], a
@@ -25,7 +25,7 @@
callba AddHallOfFameEntry
xor a
- ld [wc2cd], a
+ ld [wGameLogicPaused], a
call AnimateHallOfFame
pop af
ld b, a
@@ -44,7 +44,7 @@
xor a
ld [VramState], a
ld [hMapAnims], a
- callba Function4e8c2
+ callba InitDisplayForRedCredits
ld c, 8
call DelayFrames
call DisableSpriteUpdates
@@ -67,7 +67,7 @@
xor a
ld [VramState], a
ld [hMapAnims], a
- callba Function4e881
+ callba InitDisplayForHallOfFame
ld c, 100
jp DelayFrames
; 864b4
@@ -230,14 +230,13 @@
AnimateHOFMonEntrance: ; 865b5
push hl
call ClearBGPalettes
- callba Function4e906
+ callba ResetDisplayBetweenHallOfFameMons
pop hl
ld a, [hli]
ld [TempMonSpecies], a
ld [CurPartySpecies], a
-rept 2
inc hl
-endr
+ inc hl
ld a, [hli]
ld [TempMonDVs], a
ld a, [hli]
@@ -262,7 +261,7 @@
call WaitBGMap
xor a
ld [hBGMapMode], a
- ld b, SCGB_1A
+ ld b, SCGB_PLAYER_OR_MON_FRONTPIC_PALS
call GetSGBLayout
call SetPalettes
call HOF_SlideBackpic
@@ -298,9 +297,8 @@
ld a, [hSCX]
and a
ret z
-rept 2
dec a
-endr
+ dec a
ld [hSCX], a
call DelayFrame
jr .frontpicloop
@@ -398,7 +396,7 @@
ld de, .EmptyString
call PlaceString
call WaitBGMap
- ld b, SCGB_1A
+ ld b, SCGB_PLAYER_OR_MON_FRONTPIC_PALS
call GetSGBLayout
call SetPalettes
decoord 6, 5
@@ -497,7 +495,7 @@
call GetBasePokemonName
hlcoord 7, 13
call PlaceString
- ld a, BREEDMON
+ ld a, TEMPMON
ld [MonType], a
callba GetGender
ld a, " "
@@ -555,7 +553,7 @@
xor a
ld [hBGMapMode], a
ld [CurPartySpecies], a
- ld b, SCGB_1A
+ ld b, SCGB_PLAYER_OR_MON_FRONTPIC_PALS
call GetSGBLayout
call SetPalettes
call HOF_SlideBackpic
--- a/event/happiness_egg.asm
+++ b/event/happiness_egg.asm
@@ -67,9 +67,9 @@
dec c
ld b, 0
ld hl, .Actions
-rept 3
add hl, bc
-endr
+ add hl, bc
+ add hl, bc
ld d, 0
add hl, de
ld a, [hl]
--- a/event/kurt.asm
+++ b/event/kurt.asm
@@ -362,9 +362,8 @@
inc hl
ld c, a
ld b, $0
-rept 2
add hl, bc
-endr
+ add hl, bc
inc hl
ld a, [hl]
pop bc
@@ -379,9 +378,8 @@
ld c, a
ld b, $0
inc hl
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [CurItem]
ld c, a
ld a, [hli]
--- a/event/magikarp.asm
+++ b/event/magikarp.asm
@@ -250,9 +250,8 @@
; hl = de × 10
ld h, d
ld l, e
-rept 2
add hl, hl
-endr
+ add hl, hl
add hl, de
add hl, hl
--- a/event/magnet_train.asm
+++ b/event/magnet_train.asm
@@ -48,7 +48,7 @@
callab PlaySpriteAnimations
call MagnetTrain_Jumptable
call MagnetTrain_UpdateLYOverrides
- call Function3b0c
+ call PushLYOverrides
call DelayFrame
jr .loop
@@ -61,9 +61,9 @@
ld [hVBlank], a
call ClearBGPalettes
xor a
- ld [hFFC6], a
- ld [hFFC7], a
- ld [hFFC8], a
+ ld [hLCDCPointer], a
+ ld [hLYOverrideStart], a
+ ld [hLYOverrideEnd], a
ld [hSCX], a
ld [Requested2bppSource], a
ld [Requested2bppSource + 1], a
@@ -101,9 +101,8 @@
ld d, a
ld hl, wcf64
ld a, [hl]
-rept 2
add d
-endr
+ add d
ld [hl], a
ret
@@ -150,9 +149,9 @@
xor a
ld [hli], a
ld a, [wMagnetTrainInitPosition]
-rept 3
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
ld de, MUSIC_MAGNET_TRAIN
call PlayMusic2
ret
@@ -211,9 +210,8 @@
ld e, a
ld d, 0
ld hl, MagnetTrainBGTiles
-rept 2
add hl, de
-endr
+ add hl, de
ld e, [hl]
inc hl
ld d, [hl]
@@ -253,8 +251,8 @@
ld bc, LYOverridesBackupEnd - LYOverridesBackup
ld a, [wMagnetTrainInitPosition]
call ByteFill
- ld a, $43
- ld [hFFC6], a
+ ld a, rSCX - $ff00
+ ld [hLCDCPointer], a
ret
; 8cdc3
@@ -296,9 +294,8 @@
ld e, a
ld d, 0
ld hl, .Jumptable
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -398,17 +395,15 @@
inc a
ld d, a
ld a, e
-rept 2
add d
-endr
+ add d
ld [wcf65], a
ld hl, wGlobalAnimXOffset
ld a, [wMagnetTrainDirection]
ld d, a
ld a, [hl]
-rept 2
add d
-endr
+ add d
ld [hl], a
ret
@@ -431,7 +426,7 @@
callba PlaySpriteAnimations
call MagnetTrain_Jumptable
call MagnetTrain_UpdateLYOverrides
- call Function3b0c
+ call PushLYOverrides
call DelayFrame
ld a, [rSVBK]
push af
--- a/event/mom.asm
+++ b/event/mom.asm
@@ -23,9 +23,8 @@
ld e, a
ld d, 0
ld hl, .dw
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -143,16 +142,15 @@
call PrintText
xor a
ld hl, StringBuffer2
-rept 2
ld [hli], a
-endr
+ ld [hli], a
ld [hl], a
ld a, $5
ld [wcf64], a
call LoadStandardMenuDataHeader
- call Function16517
- call Function1656b
- call Function16571
+ call Mom_SetUpDepositMenu
+ call Mom_Wait10Frames
+ call Mom_WithdrawDepositMenuJoypad
call CloseWindow
jr c, .CancelDeposit
ld hl, StringBuffer2
@@ -211,16 +209,15 @@
call PrintText
xor a
ld hl, StringBuffer2
-rept 2
ld [hli], a
-endr
+ ld [hli], a
ld [hl], a
ld a, $5
ld [wcf64], a
call LoadStandardMenuDataHeader
- call Function16512
- call Function1656b
- call Function16571
+ call Mom_SetUpWithdrawMenu
+ call Mom_Wait10Frames
+ call Mom_WithdrawDepositMenuJoypad
call CloseWindow
jr c, .CancelWithdraw
ld hl, StringBuffer2
@@ -324,13 +321,13 @@
call .ClearBox
bccoord 1, 14
ld hl, .Text_AdjustClock
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
call YesNoBox
ret c
call .ClearBox
bccoord 1, 14
ld hl, .Text_LostInstructionBooklet
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
ret
.loop
@@ -340,7 +337,7 @@
bit 7, a
jr z, .SetDST
ld hl, .Text_IsDSTOver
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
call YesNoBox
ret c
ld a, [wDST]
@@ -350,12 +347,12 @@
call .ClearBox
bccoord 1, 14
ld hl, .Text_SetClockBack
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
ret
.SetDST:
ld hl, .Text_SwitchToDST
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
call YesNoBox
ret c
ld a, [wDST]
@@ -365,7 +362,7 @@
call .ClearBox
bccoord 1, 14
ld hl, .Text_SetClockForward
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
ret
; 164b9
@@ -444,14 +441,13 @@
db "@"
; 0x16512
-Function16512: ; 16512
- ld de, String_1669f
- jr Function1651a
+Mom_SetUpWithdrawMenu: ; 16512
+ ld de, Mon_WithdrawString
+ jr Mom_ContinueMenuSetup
-Function16517: ; 16517
- ld de, String_166a8
-
-Function1651a: ; 1651a
+Mom_SetUpDepositMenu: ; 16517
+ ld de, Mom_DepositString
+Mom_ContinueMenuSetup: ; 1651a
push de
xor a
ld [hBGMapMode], a
@@ -459,7 +455,7 @@
lb bc, 6, 18
call TextBox
hlcoord 1, 2
- ld de, String_16699
+ ld de, Mom_SavedString
call PlaceString
hlcoord 12, 2
ld de, wMomsMoney
@@ -466,7 +462,7 @@
lb bc, PRINTNUM_MONEY | 3, 6
call PrintNum
hlcoord 1, 4
- ld de, String_166b0
+ ld de, Mom_HeldString
call PlaceString
hlcoord 12, 4
ld de, Money
@@ -484,13 +480,13 @@
ret
; 1656b
-Function1656b: ; 1656b
+Mom_Wait10Frames: ; 1656b
ld c, 10
call DelayFrames
ret
; 16571
-Function16571: ; 16571
+Mom_WithdrawDepositMenuJoypad: ; 16571
.loop
call JoyTextDelay
ld hl, hJoyPressed
@@ -532,9 +528,8 @@
.pressedA
and a
ret
-; 165b9
-.dpadaction ; 165b9
+.dpadaction
ld hl, hJoyLast
ld a, [hl]
and D_UP
@@ -584,16 +579,15 @@
ld de, StringBuffer2
callba TakeMoney
ret
-; 16607
-.getdigitquantity ; 16607
+.getdigitquantity
ld a, [wMomBankDigitCursorPosition]
push de
ld e, a
ld d, 0
-rept 3
add hl, de
-endr
+ add hl, de
+ add hl, de
pop de
ret
; 16613
@@ -717,19 +711,19 @@
db "@"
; 0x16699
-String_16699: ; 16699
+Mom_SavedString: ; 16699
db "SAVED@"
; 1669f
-String_1669f: ; 1669f
+Mon_WithdrawString: ; 1669f
db "WITHDRAW@"
; 166a8
-String_166a8: ; 166a8
+Mom_DepositString: ; 166a8
db "DEPOSIT@"
; 166b0
-String_166b0: ; 166b0
+Mom_HeldString: ; 166b0
db "HELD@"
; 166b5
--- a/event/overworld.asm
+++ b/event/overworld.asm
@@ -751,7 +751,7 @@
ret
.WaterfallStep: ; cb4f
- turn_waterfall_up
+ turn_waterfall UP
step_end
.Text_UsedWaterfall: ; 0xcb51
@@ -1632,7 +1632,7 @@
fish_got_bite
fish_got_bite
fish_got_bite
- step_sleep_1
+ step_sleep 1
show_emote
step_end
--- a/event/photo.asm
+++ b/event/photo.asm
@@ -59,7 +59,7 @@
ld [TempMonDVs], a
ld [TempMonDVs + 1], a
- ld b, SCGB_FRONTPICPALS
+ ld b, SCGB_TRAINER_OR_MON_FRONTPIC_PALS
call GetSGBLayout
call SetPalettes
@@ -132,7 +132,7 @@
.UpdateUnownFrontpic: ; 16cc8
ld a, [wJumptableIndex]
cp 26
- jr z, Function16d20
+ jr z, .vacant
inc a
ld [UnownLetter], a
ld a, UNOWN
@@ -141,7 +141,7 @@
ld [wBoxAlignment], a
ld de, VTiles2
predef GetFrontpic
- call Function16cff
+ call .Load2bppToSRAM
hlcoord 1, 6
xor a
ld [hGraphicStartTile], a
@@ -148,11 +148,10 @@
lb bc, 7, 7
predef PlaceGraphic
ld de, VTiles2 tile $31
- callba Functione0000
+ callba RotateUnownFrontpic
ret
-; 16cff
-Function16cff: ; 16cff
+.Load2bppToSRAM: ; 16cff
ld a, [rSVBK]
push af
ld a, $6
@@ -171,9 +170,8 @@
pop af
ld [rSVBK], a
ret
-; 16d20
-Function16d20: ; 16d20
+.vacant
hlcoord 1, 6
lb bc, 7, 7
call ClearBox
@@ -221,7 +219,7 @@
INCBIN "gfx/unknown/016da4.1bpp"
; 16dac
-Function16dac: ; 16dac
+PlaceUnownPrinterFrontpic: ; 16dac
hlcoord 0, 0
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
ld a, " "
--- a/event/poke_seer.asm
+++ b/event/poke_seer.asm
@@ -298,9 +298,8 @@
ld e, a
ld d, 0
ld hl, SeerTexts
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
--- a/event/special.asm
+++ b/event/special.asm
@@ -188,9 +188,9 @@
.loop
sub [hl]
jr c, .ok
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
jr .loop
.ok
--- a/event/squirtbottle.asm
+++ b/event/squirtbottle.asm
@@ -1,50 +1,46 @@
_Squirtbottle: ; 50730
- ld hl, UnknownScript_0x5073c
+ ld hl, .SquirtbottleScript
call QueueScript
ld a, $1
ld [wItemEffectSucceeded], a
ret
-; 5073c
-UnknownScript_0x5073c: ; 0x5073c
+.SquirtbottleScript:
reloadmappart
special UpdateTimePals
- callasm Function50753
- iffalse UnknownScript_0x5074b
+ callasm .CheckCanUseSquirtbottle
+ iffalse .NothingHappenedScript
farjump WateredWeirdTreeScript
-; 0x5074b
-UnknownScript_0x5074b: ; 0x5074b
- jumptext UnknownText_0x5074e
-; 0x5074e
+.NothingHappenedScript:
+ jumptext .NothingHappenedText
-UnknownText_0x5074e: ; 0x5074e
+.NothingHappenedText:
; sprinkled water. But nothing happened…
text_jump UnknownText_0x1c0b3b
db "@"
-; 0x50753
-Function50753: ; 50753
+.CheckCanUseSquirtbottle:
ld a, [MapGroup]
cp GROUP_ROUTE_36
- jr nz, .asm_50774
+ jr nz, .nope
ld a, [MapNumber]
cp MAP_ROUTE_36
- jr nz, .asm_50774
+ jr nz, .nope
callba GetFacingObject
- jr c, .asm_50774
+ jr c, .nope
ld a, d
- cp $17
- jr nz, .asm_50774
+ cp SPRITEMOVEDATA_SUDOWOODO
+ jr nz, .nope
- ld a, $1
+ ld a, 1
ld [ScriptVar], a
ret
-.asm_50774
+.nope
xor a
ld [ScriptVar], a
ret
--- a/event/unown.asm
+++ b/event/unown.asm
@@ -107,18 +107,18 @@
Special_DisplayUnownWords: ; 8ae68
ld a, [ScriptVar]
- ld hl, MenuDataHeader_0x8aed5
+ ld hl, .MenuDataHeader_Escape
and a
- jr z, .asm_8ae79
+ jr z, .load
ld d, $0
ld e, $5
-.asm_8ae75
+.loop
add hl, de
dec a
- jr nz, .asm_8ae75
+ jr nz, .loop
-.asm_8ae79
+.load
call LoadMenuDataHeader
xor a
ld [hBGMapMode], a
@@ -127,29 +127,27 @@
call ApplyTilemap
call MenuBoxCoord2Tile
inc hl
- ld d, $0
- ld e, $14
-rept 2
+ ld d, 0
+ ld e, SCREEN_WIDTH
add hl, de
-endr
+ add hl, de
ld a, [ScriptVar]
ld c, a
- ld de, Unknown_8aebc
+ ld de, .UnownText
and a
- jr z, .asm_8aea5
-.asm_8ae9c
+ jr z, .copy
+.loop2
ld a, [de]
inc de
cp $ff
- jr nz, .asm_8ae9c
+ jr nz, .loop2
dec c
- jr nz, .asm_8ae9c
-
-.asm_8aea5
- call Function8af09
+ jr nz, .loop2
+.copy
+ call .CopyWord
ld bc, AttrMap - TileMap
add hl, bc
- call Function8aee9
+ call .FillAttr
call WaitBGMap2
call JoyWaitAorB
call PlayClickSFX
@@ -157,59 +155,91 @@
ret
; 8aebc
-Unknown_8aebc: ; 8aebc
- db $08, $44, $04, $00, $2e, $08, $ff
- db $26, $20, $0c, $0e, $46, $ff
- db $4c, $00, $46, $08, $42, $ff
- db $0e, $2c, $64, $2c, $0e, $ff
+.UnownText: ; 8aebc
+
+unownwall: MACRO
+rept _NARG
+if \1 == "-"
+x = $64
+else
+if \1 >= "Y"
+x = 2 * (\1 - "Y") + $60
+else
+if \1 >= "Q"
+x = 2 * (\1 - "Q") + $40
+else
+if \1 >= "I"
+x = 2 * (\1 - "I") + $20
+else
+x = 2 * (\1 - "A")
+endc
+endc
+endc
+endc
+ db x
+shift
+endr
+ db $ff
+endm
+
+.UnownText_Escape:
+ ; db $08, $44, $04, $00, $2e, $08, $ff
+ unownwall "E", "S", "C", "A", "P", "E"
+.UnownText_Light:
+ ; db $26, $20, $0c, $0e, $46, $ff
+ unownwall "L", "I", "G", "H", "T"
+.UnownText_Water:
+ ; db $4c, $00, $46, $08, $42, $ff
+ unownwall "W", "A", "T", "E", "R"
+.UnownText_Ho_Oh:
+ ; db $0e, $2c, $64, $2c, $0e, $ff
+ unownwall "H", "O", "-", "O", "H"
; 8aed5
-MenuDataHeader_0x8aed5: ; 0x8aed5
+.MenuDataHeader_Escape: ; 0x8aed5
db $40 ; flags
db 04, 03 ; start coords
db 09, 16 ; end coords
-MenuDataHeader_0x8aeda: ; 0x8aeda
+.MenuDataHeader_Light: ; 0x8aeda
db $40 ; flags
db 04, 04 ; start coords
db 09, 15 ; end coords
-MenuDataHeader_0x8aedf: ; 0x8aedf
+.MenuDataHeader_Water: ; 0x8aedf
db $40 ; flags
db 04, 04 ; start coords
db 09, 15 ; end coords
-MenuDataHeader_0x8aee4: ; 0x8aee4
+.MenuDataHeader_Ho_Oh: ; 0x8aee4
db $40 ; flags
db 04, 04 ; start coords
db 09, 15 ; end coords
; 8aee9
-Function8aee9: ; 8aee9
-.asm_8aee9
+.FillAttr: ; 8aee9
ld a, [de]
cp $ff
ret z
cp $60
- ld a, $d
- jr c, .asm_8aef5
- ld a, $5
+ ld a, (1 << 3) | PAL_BG_BROWN
+ jr c, .got_pal
+ ld a, PAL_BG_BROWN
-.asm_8aef5
- call Function8aefd
-rept 2
+.got_pal
+ call .PlaceSquare
inc hl
-endr
+ inc hl
inc de
- jr .asm_8aee9
+ jr .FillAttr
; 8aefd
-Function8aefd: ; 8aefd
+.PlaceSquare: ; 8aefd
push hl
ld [hli], a
ld [hld], a
- ld b, $0
- ld c, $14
+ ld b, 0
+ ld c, SCREEN_WIDTH
add hl, bc
ld [hli], a
ld [hl], a
@@ -217,42 +247,41 @@
ret
; 8af09
-Function8af09: ; 8af09
+.CopyWord: ; 8af09
push hl
push de
-.asm_8af0b
+.word_loop
ld a, [de]
cp $ff
- jr z, .asm_8af19
+ jr z, .word_done
ld c, a
- call Function8af1c
-rept 2
+ call .ConvertChar
inc hl
-endr
+ inc hl
inc de
- jr .asm_8af0b
+ jr .word_loop
-.asm_8af19
+.word_done
pop de
pop hl
ret
; 8af1c
-Function8af1c: ; 8af1c
+.ConvertChar: ; 8af1c
push hl
ld a, c
cp $60
- jr z, .asm_8af3b
+ jr z, .Tile60
cp $62
- jr z, .asm_8af4b
+ jr z, .Tile62
cp $64
- jr z, .asm_8af5b
+ jr z, .Tile64
ld [hli], a
inc a
ld [hld], a
dec a
- ld b, $0
- ld c, $14
+ ld b, 0
+ ld c, SCREEN_WIDTH
add hl, bc
ld c, $10
add c
@@ -262,11 +291,11 @@
pop hl
ret
-.asm_8af3b
+.Tile60:
ld [hl], $5b
inc hl
ld [hl], $5c
- ld bc, $0013
+ ld bc, SCREEN_WIDTH - 1
add hl, bc
ld [hl], $4d
inc hl
@@ -274,11 +303,11 @@
pop hl
ret
-.asm_8af4b
+.Tile62:
ld [hl], $4e
inc hl
ld [hl], $4f
- ld bc, $0013
+ ld bc, SCREEN_WIDTH - 1
add hl, bc
ld [hl], $5e
inc hl
@@ -286,11 +315,11 @@
pop hl
ret
-.asm_8af5b
+.Tile64:
ld [hl], $2
inc hl
ld [hl], $3
- ld bc, $0013
+ ld bc, SCREEN_WIDTH - 1
add hl, bc
ld [hl], $3
inc hl
--- a/gfx.py
+++ b/gfx.py
@@ -8,164 +8,170 @@
# Graphics with inverted tilemaps that aren't covered by filepath_rules.
pics = [
- 'gfx/shrink1',
- 'gfx/shrink2',
+ 'gfx/shrink1',
+ 'gfx/shrink2',
]
def recursive_read(filename):
- def recurse(filename_):
- lines = []
- for line in open(filename_):
- if 'include "' in line.lower():
- lines += recurse(line.split('"')[1])
- else:
- lines += [line]
- return lines
- lines = recurse(filename)
- return ''.join(lines)
+ def recurse(filename_):
+ lines = []
+ for line in open(filename_):
+ if 'include "' in line.lower():
+ lines += recurse(line.split('"')[1])
+ else:
+ lines += [line]
+ return lines
+ lines = recurse(filename)
+ return ''.join(lines)
base_stats = None
def get_base_stats():
- global base_stats
- if not base_stats:
- base_stats = recursive_read('data/base_stats.asm')
- return base_stats
+ global base_stats
+ if not base_stats:
+ base_stats = recursive_read('data/base_stats.asm')
+ return base_stats
def get_pokemon_dimensions(name):
- try:
- if name == 'egg':
- return 5, 5
- if name == 'questionmark':
- return 7, 7
- if name.startswith('unown_'):
- name = 'unown'
- base_stats = get_base_stats()
- start = base_stats.find('\tdb ' + name.upper())
- start = base_stats.find('\tdn ', start)
- end = base_stats.find('\n', start)
- line = base_stats[start:end].replace(',', ' ')
- w, h = map(int, line.split()[1:3])
- return w, h
- except:
- return 7, 7
+ try:
+ if name == 'egg':
+ return 5, 5
+ if name == 'questionmark':
+ return 7, 7
+ if name.startswith('unown_'):
+ name = 'unown'
+ base_stats = get_base_stats()
+ start = base_stats.find('\tdb ' + name.upper())
+ start = base_stats.find('\tdn ', start)
+ end = base_stats.find('\n', start)
+ line = base_stats[start:end].replace(',', ' ')
+ w, h = map(int, line.split()[1:3])
+ return w, h
+ except:
+ return 7, 7
def filepath_rules(filepath):
- """Infer attributes of certain graphics by their location in the filesystem."""
- args = {}
+ """Infer attributes of certain graphics by their location in the filesystem."""
+ args = {}
- filedir, filename = os.path.split(filepath)
- if filedir.startswith('./'):
- filedir = filedir[2:]
+ filedir, filename = os.path.split(filepath)
+ if filedir.startswith('./'):
+ filedir = filedir[2:]
- name, ext = os.path.splitext(filename)
- if ext == '.lz':
- name, ext = os.path.splitext(name)
+ name, ext = os.path.splitext(filename)
+ if ext == '.lz':
+ name, ext = os.path.splitext(name)
- pokemon_name = ''
+ pokemon_name = ''
- if 'gfx/pics/' in filedir:
- pokemon_name = filedir.split('/')[-1]
- if pokemon_name.startswith('unown_'):
- index = filedir.find(pokemon_name)
- if index != -1:
- filedir = filedir[:index + len('unown')] + filedir[index + len('unown_a'):]
- if name == 'front':
- args['pal_file'] = os.path.join(filedir, 'normal.pal')
- args['pic'] = True
- args['animate'] = True
- elif name == 'back':
- args['pal_file'] = os.path.join(filedir, 'shiny.pal')
- args['pic'] = True
+ if 'gfx/pics/' in filedir:
+ pokemon_name = filedir.split('/')[-1]
+ if pokemon_name.startswith('unown_'):
+ index = filedir.find(pokemon_name)
+ if index != -1:
+ filedir = filedir[:index + len('unown')] + filedir[index + len('unown_a'):]
+ if name == 'front':
+ args['pal_file'] = os.path.join(filedir, 'normal.pal')
+ args['pic'] = True
+ args['animate'] = True
+ elif name == 'back':
+ args['pal_file'] = os.path.join(filedir, 'shiny.pal')
+ args['pic'] = True
- elif 'gfx/trainers' in filedir:
- args['pic'] = True
+ elif 'gfx/trainers' in filedir:
+ args['pic'] = True
- elif os.path.join(filedir, name) in pics:
- args['pic'] = True
+ elif os.path.join(filedir, name) in pics:
+ args['pic'] = True
- if args.get('pal_file'):
- if os.path.exists(args['pal_file']):
- args['palout'] = args['pal_file']
- else:
- del args['pal_file']
+ elif filedir == 'gfx/tilesets':
+ args['tileset'] = True
- if args.get('pic'):
- if ext == '.png':
- w, h = gfx.png.Reader(filepath).asRGBA8()[:2]
- w = min(w/8, h/8)
- args['pic_dimensions'] = w, w
- elif ext == '.2bpp':
- if pokemon_name and name == 'front':
- w, h = get_pokemon_dimensions(pokemon_name)
- args['pic_dimensions'] = w, w
- elif pokemon_name and name == 'back':
- args['pic_dimensions'] = 6, 6
- else:
- args['pic_dimensions'] = 7, 7
- return args
+ if args.get('pal_file'):
+ if os.path.exists(args['pal_file']):
+ args['palout'] = args['pal_file']
+ else:
+ del args['pal_file']
+ if args.get('pic'):
+ if ext == '.png':
+ w, h = gfx.png.Reader(filepath).asRGBA8()[:2]
+ w = min(w/8, h/8)
+ args['pic_dimensions'] = w, w
+ elif ext == '.2bpp':
+ if pokemon_name and name == 'front':
+ w, h = get_pokemon_dimensions(pokemon_name)
+ args['pic_dimensions'] = w, w
+ elif pokemon_name and name == 'back':
+ args['pic_dimensions'] = 6, 6
+ else:
+ args['pic_dimensions'] = 7, 7
+ if args.get('tileset'):
+ args['width'] = 128
+ return args
+
+
def to_1bpp(filename, **kwargs):
- name, ext = os.path.splitext(filename)
- if ext == '.1bpp': pass
- elif ext == '.2bpp': gfx.export_2bpp_to_1bpp(filename, **kwargs)
- elif ext == '.png': gfx.export_png_to_1bpp(filename, **kwargs)
- elif ext == '.lz':
- decompress(filename, **kwargs)
- to_1bpp(name, **kwargs)
+ name, ext = os.path.splitext(filename)
+ if ext == '.1bpp': pass
+ elif ext == '.2bpp': gfx.export_2bpp_to_1bpp(filename, **kwargs)
+ elif ext == '.png': gfx.export_png_to_1bpp(filename, **kwargs)
+ elif ext == '.lz':
+ decompress(filename, **kwargs)
+ to_1bpp(name, **kwargs)
def to_2bpp(filename, **kwargs):
- name, ext = os.path.splitext(filename)
- if ext == '.1bpp': gfx.export_1bpp_to_2bpp(filename, **kwargs)
- elif ext == '.2bpp': pass
- elif ext == '.png': gfx.export_png_to_2bpp(filename, **kwargs)
- elif ext == '.lz':
- decompress(filename, **kwargs)
- to_2bpp(name, **kwargs)
+ name, ext = os.path.splitext(filename)
+ if ext == '.1bpp': gfx.export_1bpp_to_2bpp(filename, **kwargs)
+ elif ext == '.2bpp': pass
+ elif ext == '.png': gfx.export_png_to_2bpp(filename, **kwargs)
+ elif ext == '.lz':
+ decompress(filename, **kwargs)
+ to_2bpp(name, **kwargs)
def to_png(filename, **kwargs):
- name, ext = os.path.splitext(filename)
- if ext == '.1bpp': gfx.export_1bpp_to_png(filename, **kwargs)
- elif ext == '.2bpp': gfx.export_2bpp_to_png(filename, **kwargs)
- elif ext == '.png': pass
- elif ext == '.lz':
- decompress(filename, **kwargs)
- to_png(name, **kwargs)
+ name, ext = os.path.splitext(filename)
+ if ext == '.1bpp': gfx.export_1bpp_to_png(filename, **kwargs)
+ elif ext == '.2bpp': gfx.export_2bpp_to_png(filename, **kwargs)
+ elif ext == '.png': pass
+ elif ext == '.lz':
+ decompress(filename, **kwargs)
+ to_png(name, **kwargs)
def compress(filename, **kwargs):
- data = open(filename, 'rb').read()
- lz_data = lz.Compressed(data).output
- open(filename + '.lz', 'wb').write(bytearray(lz_data))
+ data = open(filename, 'rb').read()
+ lz_data = lz.Compressed(data).output
+ open(filename + '.lz', 'wb').write(bytearray(lz_data))
def decompress(filename, **kwargs):
- lz_data = open(filename, 'rb').read()
- data = lz.Decompressed(lz_data).output
- name, ext = os.path.splitext(filename)
- open(name, 'wb').write(bytearray(data))
+ lz_data = open(filename, 'rb').read()
+ data = lz.Decompressed(lz_data).output
+ name, ext = os.path.splitext(filename)
+ open(name, 'wb').write(bytearray(data))
methods = {
- '2bpp': to_2bpp,
- '1bpp': to_1bpp,
- 'png': to_png,
- 'lz': compress,
- 'unlz': decompress,
+ '2bpp': to_2bpp,
+ '1bpp': to_1bpp,
+ 'png': to_png,
+ 'lz': compress,
+ 'unlz': decompress,
}
def main(method_name, filenames=None):
- if filenames is None: filenames = []
- for filename in filenames:
- args = filepath_rules(filename)
- method = methods.get(method_name)
- if method:
- method(filename, **args)
+ if filenames is None: filenames = []
+ for filename in filenames:
+ args = filepath_rules(filename)
+ method = methods.get(method_name)
+ if method:
+ method(filename, **args)
def get_args():
- ap = argparse.ArgumentParser()
- ap.add_argument('method_name')
- ap.add_argument('filenames', nargs='*')
- args = ap.parse_args()
- return args
+ ap = argparse.ArgumentParser()
+ ap.add_argument('method_name')
+ ap.add_argument('filenames', nargs='*')
+ args = ap.parse_args()
+ return args
if __name__ == '__main__':
- main(**get_args().__dict__)
+ main(**get_args().__dict__)
--- a/gfx/font.asm
+++ b/gfx/font.asm
@@ -21,14 +21,16 @@
; TODO: Various misc graphics here.
-GFX_f89b0: ; f89b0
+StatsScreenPageTilesGFX: ; f89b0
INCBIN "gfx/unknown/0f89b0.2bpp"
; f8a90
ShinyIcon: ; f8a90
+; also part of StatsScreenPageTilesGFX
INCBIN "gfx/stats/shiny.2bpp"
-GFX_f8aa0: ; f8aa0
+StatsScreenPageTilesGFX_Part2: ; f8aa0
+; not referenced on its own, but part of StatsScreenPageTilesGFX
INCBIN "gfx/unknown/0f8aa0.2bpp"
; f8ac0
@@ -48,7 +50,7 @@
INCBIN "gfx/misc/town_map.2bpp.lz"
; f8ea4
-GFX_f8ea4: ; unused
+GFX_f8ea4: ; unused kanji
INCBIN "gfx/unknown/0f8ea4.2bpp"
; f8f24
@@ -56,8 +58,8 @@
INCBIN "gfx/mobile/overworld_phone_icon.2bpp"
; f8f34
-GFX_f8f34: ; unused
-INCBIN "gfx/unknown/0f8f34.2bpp"
+GFX_f8f34: ; unused bold letters + unown chars
+INCBIN "gfx/unknown/0f8f34.w64.1bpp"
; f9204
TextBoxSpaceGFX: ; f9204
@@ -72,7 +74,7 @@
INCBIN "gfx/frames/map_entry_sign.2bpp"
; f9424
-GFX_f9424: ; f9424
+FontsExtra2_UpArrowGFX: ; f9424
INCBIN "gfx/unknown/0f9424.2bpp"
; f9434
@@ -81,6 +83,7 @@
; fb434
; This and the following two functions are unreferenced.
+; Debug, perhaps?
Unknown_fb434:
db 0
@@ -143,9 +146,9 @@
; fb4b0
_LoadFontsExtra2:: ; fb4b0
- ld de, GFX_f9424
+ ld de, FontsExtra2_UpArrowGFX
ld hl, VTiles2 tile $61
- ld b, BANK(GFX_f9424)
+ ld b, BANK(FontsExtra2_UpArrowGFX)
ld c, 1
call Get2bpp_2
ret
@@ -208,7 +211,7 @@
ret
; fb53e
-Functionfb53e: ; fb53e
+StatsScreen_LoadFont: ; fb53e
call _LoadFontsBattleExtra
ld de, EnemyHPBarBorderGFX
ld hl, VTiles2 tile $6c
@@ -226,11 +229,10 @@
ld hl, VTiles2 tile $55
lb bc, BANK(ExpBarGFX), 8
call Get2bpp_2
-
-Functionfb571: ; fb571
- ld de, GFX_f89b0
+LoadStatsScreenPageTilesGFX: ; fb571
+ ld de, StatsScreenPageTilesGFX
ld hl, VTiles2 tile $31
- lb bc, BANK(GFX_f89b0), $11
+ lb bc, BANK(StatsScreenPageTilesGFX), $11
call Get2bpp_2
ret
; fb57e
--- a/gfx/mail.asm
+++ b/gfx/mail.asm
@@ -32,12 +32,12 @@
lb bc, BANK(StandardEnglishFont), $80
call Get1bpp
pop de
- call Functionb92b8
+ call .LoadGFX
call EnableLCD
call WaitBGMap
ld a, [Buffer3]
ld e, a
- callba Function8cb4
+ callba LoadMailPalettes
call SetPalettes
xor a
ld [hJoyPressed], a
@@ -65,7 +65,7 @@
jr .loop
; b92b8
-Functionb92b8: ; b92b8
+.LoadGFX: ; b92b8
ld h, d
ld l, e
push hl
@@ -83,7 +83,7 @@
call CloseSRAM
ld hl, MailGFXPointers
ld c, 0
-.loop
+.loop2
ld a, [hli]
cp b
jr z, .got_pointer
@@ -90,10 +90,9 @@
cp -1
jr z, .invalid
inc c
-rept 2
inc hl
-endr
- jr .loop
+ inc hl
+ jr .loop2
.invalid
ld hl, MailGFXPointers
@@ -727,6 +726,7 @@
; b984e
Functionb984e: ; b984e
+; XXX
.loop
ld a, [hl]
xor $ff
@@ -931,9 +931,8 @@
.loop
ld a, [de]
inc de
-rept 2
ld [hli], a
-endr
+ ld [hli], a
dec c
jr nz, .loop
ret
--- a/gfx/pics/animation.asm
+++ b/gfx/pics/animation.asm
@@ -99,7 +99,7 @@
.loop
call SetUpPokeAnim
push af
- callba Function10402d
+ callba HDMATransferTileMapToWRAMBank3
pop af
jr nc, .loop
ret
@@ -110,14 +110,13 @@
ld c, e
ld b, 0
ld hl, PokeAnims
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld b, [hl]
ld c, a
pop hl
- call Functiond01d6
+ call PokeAnim_InitPicAttributes
ret
; d00b4
@@ -153,7 +152,7 @@
\1_: dw \1
endm
setup_command PokeAnim_Finish
- setup_command PokeAnim_Nop
+ setup_command PokeAnim_BasePic
setup_command PokeAnim_SetWait
setup_command PokeAnim_Wait
setup_command PokeAnim_Setup
@@ -186,8 +185,8 @@
PokeAnim_Setup: ; d010b
ld c, FALSE
ld b, 0
- call Functiond0228
- call Functiond0504
+ call PokeAnim_InitAnim
+ call PokeAnim_SetVBank1
ld a, [wPokeAnimSceneIndex]
inc a
ld [wPokeAnimSceneIndex], a
@@ -197,8 +196,8 @@
PokeAnim_Setup2: ; d011d
ld c, FALSE
ld b, 4
- call Functiond0228
- call Functiond0504
+ call PokeAnim_InitAnim
+ call PokeAnim_SetVBank1
ld a, [wPokeAnimSceneIndex]
inc a
ld [wPokeAnimSceneIndex], a
@@ -208,8 +207,8 @@
PokeAnim_Extra: ; d012f
ld c, TRUE
ld b, 0
- call Functiond0228
- call Functiond0504
+ call PokeAnim_InitAnim
+ call PokeAnim_SetVBank1
ld a, [wPokeAnimSceneIndex]
inc a
ld [wPokeAnimSceneIndex], a
@@ -217,11 +216,11 @@
; d0141
PokeAnim_Play: ; d0141
- call Functiond0250
- ld a, [w2_d17e]
+ call PokeAnim_DoAnimScript
+ ld a, [wPokeAnimJumptableIndex]
bit 7, a
ret z
- call Functiond04bd
+ call PokeAnim_PlaceGraphic
ld a, [wPokeAnimSceneIndex]
inc a
ld [wPokeAnimSceneIndex], a
@@ -229,8 +228,8 @@
; d0155
PokeAnim_Play2: ; d0155
- call Functiond0250
- ld a, [w2_d17e]
+ call PokeAnim_DoAnimScript
+ ld a, [wPokeAnimJumptableIndex]
bit 7, a
ret z
ld a, [wPokeAnimSceneIndex]
@@ -239,8 +238,8 @@
ret
; d0166
-PokeAnim_Nop: ; d0166
- call Functiond01a9
+PokeAnim_BasePic: ; d0166
+ call PokeAnim_DeinitFrames
ld a, [wPokeAnimSceneIndex]
inc a
ld [wPokeAnimSceneIndex], a
@@ -248,7 +247,7 @@
; d0171
PokeAnim_Finish: ; d0171
- call Functiond01a9
+ call PokeAnim_DeinitFrames
ld hl, wPokeAnimSceneIndex
set 7, [hl]
ret
@@ -283,15 +282,15 @@
ret
; d01a9
-Functiond01a9: ; d01a9
+PokeAnim_DeinitFrames: ; d01a9
ld a, [rSVBK]
push af
ld a, $2
ld [rSVBK], a
- call Functiond04bd
- callba Function10402d
- call Functiond0536
- callba Function104047
+ call PokeAnim_PlaceGraphic
+ callba HDMATransferTileMapToWRAMBank3
+ call PokeAnim_SetVBank0
+ callba HDMATransferAttrMapToWRAMBank3
pop af
ld [rSVBK], a
ret
@@ -311,7 +310,7 @@
ret
; d01d6
-Functiond01d6: ; d01d6
+PokeAnim_InitPicAttributes: ; d01d6
ld a, [rSVBK]
push af
ld a, $2
@@ -338,28 +337,33 @@
ld [wPokeAnimCoord], a
ld a, h
ld [wPokeAnimCoord + 1], a
-; d = ?????
+; d = start tile
ld a, d
- ld [w2_d16e], a
+ ld [wPokeAnimGraphicStartTile], a
+
ld a, $1
ld hl, CurPartySpecies
call GetFarWRAMByte
ld [wPokeAnimSpecies], a
+
ld a, $1
ld hl, UnownLetter
call GetFarWRAMByte
ld [wPokeAnimUnownLetter], a
+
call PokeAnim_GetSpeciesOrUnown
ld [wPokeAnimSpeciesOrUnown], a
+
call PokeAnim_GetFrontpicDims
ld a, c
ld [wPokeAnimFrontpicHeight], a
+
pop af
ld [rSVBK], a
ret
; d0228
-Functiond0228: ; d0228
+PokeAnim_InitAnim: ; d0228
ld a, [rSVBK]
push af
ld a, $2
@@ -371,7 +375,7 @@
call ByteFill
pop bc
ld a, b
- ld [w2_d173], a
+ ld [wPokeAnimSpeed], a
ld a, c
ld [wPokeAnimExtraFlag], a
call GetMonAnimPointer
@@ -382,54 +386,52 @@
ret
; d0250
-Functiond0250: ; d0250
+PokeAnim_DoAnimScript: ; d0250
xor a
ld [hBGMapMode], a
-
-Functiond0253: ; d0253
- ld a, [w2_d17e]
+.loop
+ ld a, [wPokeAnimJumptableIndex]
and $7f
- ld hl, Tabled025d
+ ld hl, .Jumptable
rst JumpTable
ret
; d025d
-Tabled025d: ; d025d
- dw Functiond0261
- dw Functiond0282
+.Jumptable: ; d025d
+ dw .RunAnim
+ dw .WaitAnim
; d0261
-Functiond0261: ; d0261
- call Functiond02f8
- ld a, [w2_d182]
- cp $ff
+.RunAnim: ; d0261
+ call PokeAnim_GetPointer
+ ld a, [wPokeAnimCommand]
+ cp -1
jr z, PokeAnim_End
- cp $fe
- jr z, PokeAnim_SetRepeat
- cp $fd
- jr z, PokeAnim_DoRepeat
- call Functiond02c8
- ld a, [w2_d183]
- call Functiond02ae
+ cp -2
+ jr z, .SetRepeat
+ cp -3
+ jr z, .DoRepeat
+ call PokeAnim_GetFrame
+ ld a, [wPokeAnimParameter]
+ call PokeAnim_GetDuration
ld [wPokeAnimWaitCounter], a
- call Functiond02dc
-
-Functiond0282: ; d0282
+ call PokeAnim_StartWaitAnim
+.WaitAnim: ; d0282
ld a, [wPokeAnimWaitCounter]
dec a
ld [wPokeAnimWaitCounter], a
ret nz
- call Functiond02e4
+ call PokeAnim_StopWaitAnim
ret
; d028e
-PokeAnim_SetRepeat: ; d028e
- ld a, [w2_d183]
+.SetRepeat: ; d028e
+ ld a, [wPokeAnimParameter]
ld [wPokeAnimRepeatTimer], a
- jr Functiond0253
+ jr .loop
; d0296
-PokeAnim_DoRepeat: ; d0296
+.DoRepeat: ; d0296
ld a, [wPokeAnimRepeatTimer]
and a
ret z
@@ -436,22 +438,23 @@
dec a
ld [wPokeAnimRepeatTimer], a
ret z
- ld a, [w2_d183]
- ld [w2_d17d], a
- jr Functiond0253
+ ld a, [wPokeAnimParameter]
+ ld [wPokeAnimFrame], a
+ jr .loop
; d02a8
PokeAnim_End: ; d02a8
- ld hl, w2_d17e
+ ld hl, wPokeAnimJumptableIndex
set 7, [hl]
ret
; d02ae
-Functiond02ae: ; d02ae
+PokeAnim_GetDuration: ; d02ae
+; a * (1 + [wPokeAnimSpeed] / 16)
ld c, a
ld b, $0
ld hl, 0
- ld a, [w2_d173]
+ ld a, [wPokeAnimSpeed]
call AddNTimes
ld a, h
swap a
@@ -465,30 +468,30 @@
ret
; d02c8
-Functiond02c8: ; d02c8
- call Functiond04bd
- ld a, [w2_d182]
+PokeAnim_GetFrame: ; d02c8
+ call PokeAnim_PlaceGraphic
+ ld a, [wPokeAnimCommand]
and a
ret z
- call Functiond031b
+ call PokeAnim_GetBitmaskIndex
push hl
- call Functiond033b
+ call PokeAnim_CopyBitmaskToBuffer
pop hl
- call Functiond036b
+ call PokeAnim_ConvertAndApplyBitmask
ret
; d02dc
-Functiond02dc: ; d02dc
- ld a, [w2_d17e]
+PokeAnim_StartWaitAnim: ; d02dc
+ ld a, [wPokeAnimJumptableIndex]
inc a
- ld [w2_d17e], a
+ ld [wPokeAnimJumptableIndex], a
ret
; d02e4
-Functiond02e4: ; d02e4
- ld a, [w2_d17e]
+PokeAnim_StopWaitAnim: ; d02e4
+ ld a, [wPokeAnimJumptableIndex]
dec a
- ld [w2_d17e], a
+ ld [wPokeAnimJumptableIndex], a
ret
; d02ec
@@ -504,9 +507,9 @@
ret
; d02f8
-Functiond02f8: ; d02f8
+PokeAnim_GetPointer: ; d02f8
push hl
- ld a, [w2_d17d]
+ ld a, [wPokeAnimFrame]
ld e, a
ld d, $0
ld hl, wPokeAnimPointerAddr
@@ -513,23 +516,22 @@
ld a, [hli]
ld h, [hl]
ld l, a
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [wPokeAnimPointerBank]
call GetFarHalfword
ld a, l
- ld [w2_d182], a
+ ld [wPokeAnimCommand], a
ld a, h
- ld [w2_d183], a
- ld hl, w2_d17d
+ ld [wPokeAnimParameter], a
+ ld hl, wPokeAnimFrame
inc [hl]
pop hl
ret
; d031b
-Functiond031b: ; d031b
- ld a, [w2_d182]
+PokeAnim_GetBitmaskIndex: ; d031b
+ ld a, [wPokeAnimCommand]
dec a
ld c, a
ld b, $0
@@ -537,41 +539,40 @@
ld a, [hli]
ld h, [hl]
ld l, a
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [wPokeAnimFramesBank]
call GetFarHalfword
ld a, [wPokeAnimFramesBank]
call GetFarByte
- ld [w2_d180], a
+ ld [wPokeAnimCurBitmask], a
inc hl
ret
; d033b
-Functiond033b: ; d033b
- call Functiond0356
+PokeAnim_CopyBitmaskToBuffer: ; d033b
+ call .GetSize
push bc
ld hl, wPokeAnimBitmaskAddr
ld a, [hli]
ld h, [hl]
ld l, a
- ld a, [w2_d180]
+ ld a, [wPokeAnimCurBitmask]
call AddNTimes
pop bc
- ld de, w2_d188
+ ld de, wPokeAnimBitmaskBuffer
ld a, [wPokeAnimBitmaskBank]
call FarCopyBytes
ret
; d0356
-Functiond0356: ; d0356
+.GetSize: ; d0356
push hl
ld a, [wPokeAnimFrontpicHeight]
- sub 5
+ sub 5 ; to get a number 0, 1, or 2
ld c, a
ld b, 0
- ld hl, Unknown_d0368
+ ld hl, .Sizes
add hl, bc
ld c, [hl]
ld b, 0
@@ -579,16 +580,28 @@
ret
; d0368
-Unknown_d0368: db 4, 5, 7
+.Sizes: db 4, 5, 7
-Functiond036b: ; d036b
+poke_anim_box: MACRO
+y = 7
+rept \1
+x = 7 +- \1
+rept \1
+ db x + y
+x = x + 1
+endr
+y = y + 7
+endr
+endm
+
+PokeAnim_ConvertAndApplyBitmask: ; d036b
xor a
- ld [w2_d187], a
- ld [w2_d186], a
- ld [w2_d185], a
+ ld [wPokeAnimBitmaskCurBit], a
+ ld [wPokeAnimBitmaskCurRow], a
+ ld [wPokeAnimBitmaskCurCol], a
.loop
push hl
- call Functiond0392
+ call .IsCurBitSet
pop hl
ld a, b
and a
@@ -598,19 +611,20 @@
call GetFarByte
inc hl
push hl
- call Functiond03bd
+ call .ApplyFrame
pop hl
.next
push hl
- call Functiond0499
+ call .NextBit
pop hl
jr nc, .loop
ret
; d0392
-Functiond0392: ; d0392
- ld a, [w2_d187]
+.IsCurBitSet: ; d0392
+; which byte
+ ld a, [wPokeAnimBitmaskCurBit]
and $f8
rrca
rrca
@@ -617,19 +631,20 @@
rrca
ld e, a
ld d, 0
- ld hl, w2_d188
+ ld hl, wPokeAnimBitmaskBuffer
add hl, de
ld b, [hl]
- ld a, [w2_d187]
- and 7
+; which bit
+ ld a, [wPokeAnimBitmaskCurBit]
+ and $7
jr z, .skip
ld c, a
ld a, b
-.loop
+.loop2
rrca
dec c
- jr nz, .loop
+ jr nz, .loop2
ld b, a
.skip
@@ -640,18 +655,18 @@
.finish
ld b, a
- ld hl, w2_d187
+ ld hl, wPokeAnimBitmaskCurBit
inc [hl]
ret
; d03bd
-Functiond03bd: ; d03bd
+.ApplyFrame: ; d03bd
push af
- call Functiond03cd
+ call .GetCoord
pop af
push hl
- call Functiond03f7
- ld hl, w2_d16e
+ call .GetTilemap
+ ld hl, wPokeAnimGraphicStartTile
add [hl]
pop hl
ld [hl], a
@@ -658,22 +673,22 @@
ret
; d03cd
-Functiond03cd: ; d03cd
- call Functiond046c
- ld a, [w2_d186]
+.GetCoord: ; d03cd
+ call .GetStartCoord
+ ld a, [wPokeAnimBitmaskCurRow]
ld bc, SCREEN_WIDTH
call AddNTimes
ld a, [wBoxAlignment]
and a
jr nz, .go
- ld a, [w2_d185]
+ ld a, [wPokeAnimBitmaskCurCol]
ld e, a
ld d, 0
add hl, de
- jr .skip
+ jr .skip2
.go
- ld a, [w2_d185]
+ ld a, [wPokeAnimBitmaskCurCol]
ld e, a
ld a, l
sub e
@@ -682,13 +697,14 @@
sbc 0
ld h, a
-.skip
+.skip2
ret
; d03f4
-Unknown_d03f4: db 6, 5, 4
+; XXX
+ db 6, 5, 4
-Functiond03f7: ; d03f7
+.GetTilemap: ; d03f7
push af
ld a, [wPokeAnimFrontpicHeight]
cp 5
@@ -704,7 +720,7 @@
jr nc, .add_24
push hl
push de
- ld hl, Unknown_d042f
+ ld hl, ._5by5
ld e, a
ld d, 0
add hl, de
@@ -723,7 +739,7 @@
jr nc, .add_13
push hl
push de
- ld hl, Unknown_d0448
+ ld hl, ._6by6
ld e, a
ld d, 0
add hl, de
@@ -737,20 +753,8 @@
ret
; d042f
-macro_d042f: MACRO
-y = 7
-rept 7 +- \1
-x = \1
-rept 7 +- \1
- db x + y
-x = x + 1
-endr
-y = y + 7
-endr
-endm
-
-Unknown_d042f:
- macro_d042f 2
+._5by5:
+ poke_anim_box 5
; db 9, 10, 11, 12, 13
; db 16, 17, 18, 19, 20
; db 23, 24, 25, 26, 27
@@ -757,8 +761,8 @@
; db 30, 31, 32, 33, 34
; db 37, 38, 39, 40, 41
-Unknown_d0448:
- macro_d042f 1
+._6by6:
+ poke_anim_box 6
; db 8, 9, 10, 11, 12, 13
; db 15, 16, 17, 18, 19, 20
; db 22, 23, 24, 25, 26, 27
@@ -767,7 +771,7 @@
; db 43, 44, 45, 46, 47, 48
-Functiond046c: ; d046c
+.GetStartCoord: ; d046c
ld hl, wPokeAnimCoord
ld a, [hli]
ld h, [hl]
@@ -778,12 +782,12 @@
ld bc, 6
cp 7
jr z, .okay
- ld de, 21
- ld bc, 25
+ ld de, SCREEN_WIDTH + 1
+ ld bc, SCREEN_WIDTH + 5
cp 6
jr z, .okay
- ld de, 41
- ld bc, 45
+ ld de, 2 * SCREEN_WIDTH + 1
+ ld bc, 2 * SCREEN_WIDTH + 5
.okay
ld a, [wBoxAlignment]
@@ -797,19 +801,19 @@
ret
; d0499
-Functiond0499: ; d0499
- ld a, [w2_d186]
+.NextBit: ; d0499
+ ld a, [wPokeAnimBitmaskCurRow]
inc a
- ld [w2_d186], a
+ ld [wPokeAnimBitmaskCurRow], a
ld c, a
ld a, [wPokeAnimFrontpicHeight]
cp c
jr nz, .no_carry
xor a
- ld [w2_d186], a
- ld a, [w2_d185]
+ ld [wPokeAnimBitmaskCurRow], a
+ ld a, [wPokeAnimBitmaskCurCol]
inc a
- ld [w2_d185], a
+ ld [wPokeAnimBitmaskCurCol], a
ld c, a
ld a, [wPokeAnimFrontpicHeight]
cp c
@@ -822,16 +826,16 @@
ret
; d04bd
-Functiond04bd: ; d04bd
- call Functiond04f6
+PokeAnim_PlaceGraphic: ; d04bd
+ call .ClearBox
ld a, [wBoxAlignment]
and a
- jr nz, .minus_one_and_six
+ jr nz, .flipped
ld de, 1
ld bc, 0
jr .okay
-.minus_one_and_six
+.flipped
ld de, -1
ld bc, 6
@@ -843,7 +847,7 @@
add hl, bc
ld c, 7
ld b, 7
- ld a, [w2_d16e]
+ ld a, [wPokeAnimGraphicStartTile]
.loop
push bc
push hl
@@ -864,7 +868,7 @@
ret
; d04f6
-Functiond04f6: ; d04f6
+.ClearBox: ; d04f6
ld hl, wPokeAnimCoord
ld a, [hli]
ld h, [hl]
@@ -875,7 +879,7 @@
ret
; d0504
-Functiond0504: ; d0504
+PokeAnim_SetVBank1: ; d0504
ld a, [rSVBK]
push af
ld a, $2
@@ -882,60 +886,60 @@
ld [rSVBK], a
xor a
ld [hBGMapMode], a
- call Functiond051b
- callba Function104047
+ call .SetFlag
+ callba HDMATransferAttrMapToWRAMBank3
pop af
ld [rSVBK], a
ret
; d051b
-Functiond051b: ; d051b
- call Functiond0551
+.SetFlag: ; d051b
+ call PokeAnim_GetAttrMapCoord
ld b, 7
ld c, 7
- ld de, $0014
-.asm_d0525
+ ld de, SCREEN_WIDTH
+.row
push bc
push hl
-.asm_d0527
+.col
ld a, [hl]
or 8
ld [hl], a
add hl, de
dec c
- jr nz, .asm_d0527
+ jr nz, .col
pop hl
inc hl
pop bc
dec b
- jr nz, .asm_d0525
+ jr nz, .row
ret
; d0536
-Functiond0536: ; d0536
- call Functiond0551
+PokeAnim_SetVBank0: ; d0536
+ call PokeAnim_GetAttrMapCoord
ld b, 7
ld c, 7
- ld de, $0014
-.asm_d0540
+ ld de, SCREEN_WIDTH
+.row
push bc
push hl
-.asm_d0542
+.col
ld a, [hl]
and $f7
ld [hl], a
add hl, de
dec c
- jr nz, .asm_d0542
+ jr nz, .col
pop hl
inc hl
pop bc
dec b
- jr nz, .asm_d0540
+ jr nz, .row
ret
; d0551
-Functiond0551: ; d0551
+PokeAnim_GetAttrMapCoord: ; d0551
ld hl, wPokeAnimCoord
ld a, [hli]
ld h, [hl]
@@ -970,9 +974,8 @@
dec a
ld e, a
ld d, 0
-rept 2
add hl, de
-endr
+ add hl, de
ld a, c
ld [wPokeAnimPointerBank], a
call GetFarHalfword
@@ -1041,9 +1044,8 @@
dec a
ld e, a
ld d, 0
-rept 2
add hl, de
-endr
+ add hl, de
ld a, b
call GetFarHalfword
ld a, l
@@ -1081,9 +1083,8 @@
dec a
ld e, a
ld d, 0
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [wPokeAnimBitmaskBank]
call GetFarHalfword
ld a, l
@@ -1115,10 +1116,9 @@
ret
; d0669
-Functiond0669: ; d0669 Predef 48
+Predef48: ; d0669 Predef 48
ld a, $1
ld [wBoxAlignment], a
-
HOF_AnimateFrontpic: ; d066e Predef 49
call AnimateMon_CheckIfPokemon
jr c, .fail
--- /dev/null
+++ b/gfx/unknown/011e5d.1bpp
@@ -1,0 +1,1 @@
+�����
\ No newline at end of file
--- a/gfx/unknown/011e5d.2bpp
+++ /dev/null
@@ -1,1 +1,0 @@
-�����
\ No newline at end of file
binary files /dev/null b/gfx/unknown/011e65.1bpp differ
binary files a/gfx/unknown/011e65.2bpp /dev/null differ
binary files /dev/null b/gfx/unknown/011e6d.1bpp differ
binary files a/gfx/unknown/011e6d.2bpp /dev/null differ
binary files a/gfx/unknown/0f8f34.2bpp /dev/null differ
binary files /dev/null b/gfx/unknown/0f8f34.w64.1bpp differ
--- /dev/null
+++ b/gfx/unknown/16c903.pal
@@ -1,0 +1,39 @@
+ RGB 31, 31, 31
+ RGB 04, 10, 20
+ RGB 16, 19, 25
+ RGB 25, 27, 29
+
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+ RGB 31, 31, 31
--- a/home.asm
+++ b/home.asm
@@ -37,7 +37,7 @@
INCLUDE "home/game_time.asm"
INCLUDE "home/map.asm"
-Function2d43:: ; 2d43
+InexplicablyEmptyFunction:: ; 2d43
; Inexplicably empty.
; Seen in PredefPointers.
rept 16
@@ -49,13 +49,6 @@
INCLUDE "home/farcall.asm"
INCLUDE "home/predef.asm"
INCLUDE "home/window.asm"
-
-Function2e4e:: ; 2e4e
-; Unreferenced.
- scf
- ret
-; 2e50
-
INCLUDE "home/flag.asm"
Function2ebb:: ; 2ebb
@@ -342,7 +335,7 @@
call GetJoypad
; input override
- ld a, [wc2d7]
+ ld a, [wDisableTextAcceleration]
and a
jr nz, .wait
@@ -393,28 +386,12 @@
; 0x3198
PrintNum:: ; 3198
- ld a, [hROMBank]
- push af
- ld a, BANK(_PrintNum)
- rst Bankswitch
-
- call _PrintNum
-
- pop af
- rst Bankswitch
+ homecall _PrintNum
ret
; 31a4
MobilePrintNum:: ; 31a4
- ld a, [hROMBank]
- push af
- ld a, BANK(_MobilePrintNum)
- rst Bankswitch
-
- call _MobilePrintNum
-
- pop af
- rst Bankswitch
+ homecall _MobilePrintNum
ret
; 31b0
@@ -570,7 +547,7 @@
; 323f
; XXX
- callba Function104000
+ callba HDMATransferAttrMapAndTileMapToWRAMBank3
ret
; 3246
@@ -744,10 +721,10 @@
ld d, HP_GREEN
ld a, e
- cp 24
+ cp (50 * 48 / 100)
ret nc
inc d ; yellow
- cp 10
+ cp (21 * 48 / 100)
ret nc
inc d ; red
ret
@@ -798,12 +775,7 @@
dbw 0, PartyMonOT
dbw 0, OTPartyMonOT
dba TrainerClassNames
-; 33c0
-
-Function33c0:
- inc b
- ld d, d
- ld c, e
+ dbw $4, $4b52 ; within PackMenuGFX
; 33c3
GetName:: ; 33c3
@@ -834,9 +806,9 @@
ld e, a
ld d, 0
ld hl, NamesPointers
-rept 3
add hl, de
-endr
+ add hl, de
+ add hl, de
ld a, [hli]
rst Bankswitch
ld a, [hli]
@@ -853,9 +825,9 @@
.done
ld a, e
- ld [wd102], a
+ ld [wUnusedD102], a
ld a, d
- ld [wd103], a
+ ld [wUnusedD102 + 1], a
pop de
pop bc
@@ -1142,7 +1114,7 @@
jp TextBox
; 354b
-Function354b:: ; 354b joypad
+JoyTextDelay_ForcehJoyDown:: ; 354b joypad
call DelayFrame
ld a, [hInMenu]
@@ -1692,15 +1664,15 @@
; How many digits?
ld c, 2
cp 100
- jr c, Function3842
+ jr c, Print8BitNumRightAlign
; 3-digit numbers overwrite the :L.
dec hl
inc c
- jr Function3842
+ jr Print8BitNumRightAlign
; 383d
-Function383d:: ; 383d
+PrintLevel_Force3Digits:: ; 383d
; Print :L and all 3 digits
ld [hl], "<LV>"
inc hl
@@ -1707,7 +1679,7 @@
ld c, 3
; 3842
-Function3842:: ; 3842
+Print8BitNumRightAlign:: ; 3842
ld [wd265], a
ld de, wd265
ld b, PRINTNUM_RIGHTALIGN | 1
@@ -1715,6 +1687,8 @@
; 384d
Function384d:: ; 384d
+; XXX
+; GetNthMove
ld hl, wListMoves_MoveIndicesBuffer
ld c, a
ld b, 0
@@ -1907,6 +1881,10 @@
; 392d
Function392d:: ; 392d
+; XXX
+; GetDexNumber
+; Probably used in gen 1 to convert index number to dex number
+; Not required in gen 2 because index number == dex number
push hl
ld a, b
dec a
@@ -1913,7 +1891,7 @@
ld b, 0
add hl, bc
ld hl, BaseData + 0
- ld bc, $0020
+ ld bc, BaseData1 - BaseData0
call AddNTimes
ld a, BANK(BaseData)
call GetFarHalfword
@@ -1925,9 +1903,9 @@
INCLUDE "home/battle.asm"
-Function3b0c:: ; 3b0c
+PushLYOverrides:: ; 3b0c
- ld a, [hFFC6]
+ ld a, [hLCDCPointer]
and a
ret z
--- a/home/battle.asm
+++ b/home/battle.asm
@@ -153,9 +153,8 @@
ld hl, .battlevarpairs
ld c, a
ld b, 0
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld h, [hl]
@@ -175,9 +174,8 @@
ld b, 0
ld hl, .vars
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld h, [hl]
--- a/home/copy.asm
+++ b/home/copy.asm
@@ -6,13 +6,7 @@
bit 7, a
jp z, Copy2bpp
- ld a, [hROMBank]
- push af
- ld a, BANK(_Get2bpp)
- rst Bankswitch
- call _Get2bpp
- pop af
- rst Bankswitch
+ homecall _Get2bpp
ret
; ddc
@@ -22,13 +16,7 @@
bit 7, a
jp z, Copy1bpp
- ld a, [hROMBank]
- push af
- ld a, BANK(_Get1bpp)
- rst Bankswitch
- call _Get1bpp
- pop af
- rst Bankswitch
+ homecall _Get1bpp
ret
; def
@@ -205,9 +193,8 @@
.loop
ld a, [de]
inc de
-rept 2
ld [hli], a
-endr
+ ld [hli], a
.dec
dec c
jr nz, .loop
@@ -422,9 +409,9 @@
push af
ld h, 0
ld l, c
-rept 3
add hl, hl
-endr
+ add hl, hl
+ add hl, hl
ld b, h
ld c, l
pop af
--- a/home/decompress.asm
+++ b/home/decompress.asm
@@ -99,7 +99,7 @@
add a ; << 3
add a
- ; This is our new control code.
+ ; This is our new control code.
and LZ_CMD
push af
--- a/home/fade.asm
+++ b/home/fade.asm
@@ -2,6 +2,8 @@
Function48c:: ; 48c
+; XXX
+; TimeOfDayFade
ld a, [TimeOfDayPal]
ld b, a
ld hl, IncGradGBPalTable_11
--- a/home/game_time.asm
+++ b/home/game_time.asm
@@ -33,7 +33,7 @@
; Don't update if game logic is paused.
- ld a, [wc2cd]
+ ld a, [wGameLogicPaused]
and a
ret nz
--- a/home/handshake.asm
+++ b/home/handshake.asm
@@ -1,28 +1,22 @@
PrinterReceive:: ; 2057
- ld a, [hROMBank]
- push af
- ld a, BANK(_PrinterReceive)
- rst Bankswitch
+ homecall _PrinterReceive
- call _PrinterReceive
- pop af
- rst Bankswitch
-
ret
; 2063
AskSerial:: ; 2063
; send out a handshake while serial int is off
- ld a, [wc2d4]
+ ld a, [wPrinterConnectionOpen]
bit 0, a
ret z
- ld a, [wc2d5]
+; if we're still interpreting data, don't try to receive
+ ld a, [wPrinterOpcode]
and a
ret nz
; once every 6 frames
- ld hl, wca8a
+ ld hl, wHandshakeFrameDelay
inc [hl]
ld a, [hl]
cp 6
@@ -31,8 +25,8 @@
xor a
ld [hl], a
- ld a, $c
- ld [wc2d5], a
+ ld a, 12
+ ld [wPrinterOpcode], a
; handshake
ld a, $88
--- a/home/init.asm
+++ b/home/init.asm
@@ -100,7 +100,7 @@
ld [rSVBK], a
call ClearVRAM
call ClearSprites
- call Function270
+ call ClearsScratch
ld a, BANK(LoadPushOAM)
@@ -139,7 +139,7 @@
ld a, -1
ld [hLinkPlayerNumber], a
- callba Function9890
+ callba InitCGBPals
ld a, VBGMap1 / $100
ld [hBGMapAddress + 1], a
@@ -154,9 +154,9 @@
ld a, [hCGB]
and a
- jr z, .asm_22b
+ jr z, .no_double_speed
call NormalSpeed
-.asm_22b
+.no_double_speed
xor a
ld [rIF], a
@@ -166,7 +166,7 @@
call DelayFrame
- predef Function9853
+ predef InitSGBBorder ; SGB init
call MapSetup_Sound_Off
xor a
@@ -194,9 +194,10 @@
ClearWRAM:: ; 25a
; Wipe swappable WRAM banks (1-7)
+; Assumes CGB or AGB
ld a, 1
-.asm_25c
+.bank_loop
push af
ld [rSVBK], a
xor a
@@ -206,15 +207,17 @@
pop af
inc a
cp 8
- jr nc, .asm_25c
+ jr nc, .bank_loop ; Should be jr c
ret
; 270
-Function270:: ; 270
- ld a, $0
+ClearsScratch:: ; 270
+; Wipe the first 32 bytes of sScratch
+
+ ld a, BANK(sScratch)
call GetSRAMBank
- ld hl, $a000
- ld bc, $0020
+ ld hl, sScratch
+ ld bc, $20
xor a
call ByteFill
call CloseSRAM
--- a/home/joypad.asm
+++ b/home/joypad.asm
@@ -33,7 +33,7 @@
ret nz
; If we're saving, input is disabled.
- ld a, [wc2cd]
+ ld a, [wGameLogicPaused]
and a
ret nz
@@ -42,9 +42,8 @@
ld a, R_DPAD
ld [rJOYP], a
; Read twice to give the request time to take.
-rept 2
ld a, [rJOYP]
-endr
+ ld a, [rJOYP]
; The Joypad register output is in the lo nybble (inversed).
; We make the hi nybble of our new container d-pad input.
@@ -209,9 +208,8 @@
jr nz, .next
; The current input is overwritten.
-rept 2
dec hl
-endr
+ dec hl
ld b, NO_INPUT
jr .finishauto
--- a/home/lcd.asm
+++ b/home/lcd.asm
@@ -3,7 +3,7 @@
Function547:: ; 547
; Unreferenced
- ld a, [hFFC6]
+ ld a, [hLCDCPointer]
cp rSCX - $ff00
ret nz
ld c, a
@@ -15,7 +15,7 @@
LCD:: ; 552
push af
- ld a, [hFFC6]
+ ld a, [hLCDCPointer]
and a
jr z, .done
@@ -26,7 +26,7 @@
ld b, LYOverrides >> 8
ld a, [bc]
ld b, a
- ld a, [hFFC6]
+ ld a, [hLCDCPointer]
ld c, a
ld a, b
ld [$ff00+c], a
--- a/home/map.asm
+++ b/home/map.asm
@@ -155,9 +155,9 @@
add a
ld l, a
ld h, 0
-rept 3
add hl, hl
-endr
+ add hl, hl
+ add hl, hl
ld a, [TilesetBlocksAddress]
add l
ld l, a
@@ -694,9 +694,9 @@
ld a, [hli]
ld h, [hl]
ld l, a
-rept 3
inc hl ; get to the warp coords
-endr
+ inc hl ; get to the warp coords
+ inc hl ; get to the warp coords
ld a, [WarpNumber]
dec a
ld c, a
@@ -751,9 +751,9 @@
ld [hConnectionStripLength], a
ld c, a
ld b, 0
-rept 3
add hl, bc
-endr
+ add hl, bc
+ add hl, bc
ld c, 3
add hl, bc
ld a, [MapBlockDataBank]
@@ -1072,7 +1072,7 @@
push hl
call SpeechTextBox
- call Function2e31
+ call SafeUpdateSprites
ld a, 1
ld [hOAMUpdate], a
call ApplyTilemap
@@ -1382,7 +1382,7 @@
; unreferenced
ld hl, BGMapBuffer
- ld bc, SGBPredef - BGMapBuffer
+ ld bc, BGMapBufferEnd - BGMapBuffer
xor a
call ByteFill
ret
--- a/home/map_objects.asm
+++ b/home/map_objects.asm
@@ -28,9 +28,8 @@
.loop
cp [hl]
jr z, .found
-rept 2
inc hl
-endr
+ inc hl
dec c
jr nz, .loop
ld a, [UsedSprites + 1]
@@ -503,9 +502,8 @@
endr
ld a, BANK(SpriteMovementData)
call GetFarByte
-rept 2
add a
-endr
+ add a
and $c
pop de
pop bc
@@ -638,7 +636,7 @@
ret
; 1af1
-GetObjectSprite:: ; 1af1
+DoesObjectHaveASprite:: ; 1af1
ld hl, OBJECT_SPRITE
add hl, bc
ld a, [hl]
--- a/home/math.asm
+++ b/home/math.asm
@@ -59,15 +59,7 @@
push hl
push de
push bc
- ld a, [hROMBank]
- push af
- ld a, BANK(_Divide)
- rst Bankswitch
-
- call _Divide
-
- pop af
- rst Bankswitch
+ homecall _Divide
pop bc
pop de
pop hl
--- a/home/menu.asm
+++ b/home/menu.asm
@@ -229,9 +229,9 @@
; 1e5d
DoNthMenu:: ; 1e5d
- call MenuFunc_1e7f
+ call DrawVariableLengthMenuBox
call MenuWriteText
- call Function1eff
+ call InitMenuCursorAndButtonPermissions
call GetStaticMenuJoypad
call GetMenuJoypad
call MenuClickSound
@@ -239,17 +239,17 @@
; 1e70
SetUpMenu:: ; 1e70
- call MenuFunc_1e7f ; ???
+ call DrawVariableLengthMenuBox ; ???
call MenuWriteText
- call Function1eff ; set up selection pointer
+ call InitMenuCursorAndButtonPermissions ; set up selection pointer
ld hl, w2DMenuFlags1
set 7, [hl]
ret
-MenuFunc_1e7f::
+DrawVariableLengthMenuBox::
call CopyMenuData2
call GetMenuIndexSet
- call Function1ea6
+ call AutomaticGetMenuBottomCoord
call MenuBox
ret
@@ -257,8 +257,8 @@
xor a
ld [hBGMapMode], a
call GetMenuIndexSet ; sort out the text
- call Function1eda ; actually write it
- call Function2e31
+ call RunMenuItemPrintingFunction ; actually write it
+ call SafeUpdateSprites
ld a, [hOAMUpdate]
push af
ld a, $1
@@ -269,7 +269,7 @@
ret
; 0x1ea6
-Function1ea6:: ; 1ea6
+AutomaticGetMenuBottomCoord:: ; 1ea6
ld a, [wMenuBorderLeftCoord]
ld c, a
ld a, [wMenuBorderRightCoord]
@@ -310,7 +310,7 @@
ret
; 1eda
-Function1eda:: ; 1eda
+RunMenuItemPrintingFunction:: ; 1eda
call MenuBoxCoord2Tile
ld bc, 2 * SCREEN_WIDTH + 2
add hl, bc
@@ -325,7 +325,7 @@
ld d, h
ld e, l
ld hl, wMenuData2DisplayFunctionPointer
- call .__wMenuData2DisplayFunction__
+ call ._hl_
pop hl
ld de, 2 * SCREEN_WIDTH
add hl, de
@@ -333,7 +333,7 @@
jr .loop
; 1efb
-.__wMenuData2DisplayFunction__ ; 1efb
+._hl_ ; 1efb
ld a, [hli]
ld h, [hl]
ld l, a
@@ -340,7 +340,7 @@
jp [hl]
; 1eff
-Function1eff:: ; 1eff
+InitMenuCursorAndButtonPermissions:: ; 1eff
call InitVerticalMenuCursor
ld hl, wMenuJoypadFilter
ld a, [wMenuData2Flags]
--- a/home/mobile.asm
+++ b/home/mobile.asm
@@ -6,7 +6,7 @@
ld [$c986], a
ld a, h
ld [$c987], a
- jr nz, .asm_3e4f
+ jr nz, .okay
ld [$c982], a
ld a, l
@@ -17,7 +17,7 @@
ld a, b
ld [hl], a
-.asm_3e4f
+.okay
ld hl, $c822
set 6, [hl]
ld a, [hROMBank]
@@ -30,6 +30,7 @@
; 3e60
Function3e60:: ; 3e60
+; Return from Function110030
ld [$c986], a
ld a, l
ld [$c987], a
--- a/home/movement.asm
+++ b/home/movement.asm
@@ -107,9 +107,8 @@
push hl
ld l, b
ld h, 0
-rept 2
add hl, hl
-endr
+ add hl, hl
ld e, a
ld d, 0
add hl, de
@@ -122,18 +121,18 @@
; 1ba5
.MovementData:
- slow_step_down
- slow_step_up
- slow_step_left
- slow_step_right
- step_down
- step_up
- step_left
- step_right
- big_step_down
- big_step_up
- big_step_left
- big_step_right
+ slow_step DOWN
+ slow_step UP
+ slow_step LEFT
+ slow_step RIGHT
+ step DOWN
+ step UP
+ step LEFT
+ step RIGHT
+ big_step DOWN
+ big_step UP
+ big_step LEFT
+ big_step RIGHT
; 1bb1
SetMenuAttributes:: ; 1bb1
@@ -148,13 +147,12 @@
dec b
jr nz, .loop
ld a, $1
-rept 2
ld [hli], a
-endr
+ ld [hli], a
xor a
-rept 3
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
pop bc
pop hl
ret
--- a/home/palettes.asm
+++ b/home/palettes.asm
@@ -341,25 +341,11 @@
FarCallSwapTextboxPalettes:: ; db1
- ld a, [hROMBank]
- push af
- ld a, BANK(SwapTextboxPalettes)
- rst Bankswitch
- call SwapTextboxPalettes
- pop af
- rst Bankswitch
+ homecall SwapTextboxPalettes
ret
; dbd
FarCallScrollBGMapPalettes:: ; dbd
- ld a, [hROMBank]
- push af
- ld a, BANK(ScrollBGMapPalettes)
- rst Bankswitch
-
- call ScrollBGMapPalettes
-
- pop af
- rst Bankswitch
+ homecall ScrollBGMapPalettes
ret
; dc9
--- a/home/serial.asm
+++ b/home/serial.asm
@@ -10,7 +10,7 @@
and a
jr nz, .mobile
- ld a, [wc2d4]
+ ld a, [wPrinterConnectionOpen]
bit 0, a
jr nz, .printer
@@ -78,7 +78,7 @@
.player2
ld a, $1
ld [hFFCA], a
- ld a, -2
+ ld a, $fe
ld [hSerialSend], a
.end
@@ -126,92 +126,95 @@
; 78a
Function78a:: ; 78a
+.loop
xor a
ld [hFFCA], a
ld a, [hLinkPlayerNumber]
cp $2
- jr nz, .asm_79b
+ jr nz, .not_player_2
ld a, $1
ld [rSC], a
ld a, $81
ld [rSC], a
-
-.asm_79b
+.not_player_2
+.loop2
ld a, [hFFCA]
and a
- jr nz, .asm_7e5
+ jr nz, .reset_ffca
ld a, [hLinkPlayerNumber]
cp $1
- jr nz, .asm_7c0
- call Function82b
- jr z, .asm_7c0
- call .asm_825
+ jr nz, .not_player_1_or_wLinkTimeoutFrames_zero
+ call CheckwLinkTimeoutFramesNonzero
+ jr z, .not_player_1_or_wLinkTimeoutFrames_zero
+ call .delay_15_cycles
push hl
- ld hl, wcf5c
+ ld hl, wLinkTimeoutFrames + 1
inc [hl]
- jr nz, .asm_7b7
+ jr nz, .no_rollover_up
dec hl
inc [hl]
-.asm_7b7
+.no_rollover_up
pop hl
- call Function82b
- jr nz, .asm_79b
- jp Function833
+ call CheckwLinkTimeoutFramesNonzero
+ jr nz, .loop2
+ jp SerialDisconnected
-.asm_7c0
+.not_player_1_or_wLinkTimeoutFrames_zero
ld a, [rIE]
and $f
cp $8
- jr nz, .asm_79b
+ jr nz, .loop2
ld a, [wcf5d]
dec a
ld [wcf5d], a
- jr nz, .asm_79b
+ jr nz, .loop2
ld a, [wcf5d + 1]
dec a
ld [wcf5d + 1], a
- jr nz, .asm_79b
+ jr nz, .loop2
ld a, [hLinkPlayerNumber]
cp $1
- jr z, .asm_7e5
- ld a, $ff
-.asm_7e2
+ jr z, .reset_ffca
+
+ ld a, 255
+.delay_255_cycles
dec a
- jr nz, .asm_7e2
+ jr nz, .delay_255_cycles
-.asm_7e5
+.reset_ffca
xor a
ld [hFFCA], a
ld a, [rIE]
and $f
sub $8
- jr nz, .asm_7f8
+ jr nz, .rIE_not_equal_8
+
ld [wcf5d], a
ld a, $50
ld [wcf5d + 1], a
-.asm_7f8
+.rIE_not_equal_8
ld a, [hSerialReceive]
cp $fe
ret nz
- call Function82b
- jr z, .asm_813
+ call CheckwLinkTimeoutFramesNonzero
+ jr z, .wLinkTimeoutFrames_zero
push hl
- ld hl, wcf5c
+ ld hl, wLinkTimeoutFrames + 1
ld a, [hl]
dec a
ld [hld], a
inc a
- jr nz, .asm_80d
+ jr nz, .no_rollover
dec [hl]
-.asm_80d
+.no_rollover
pop hl
- call Function82b
- jr z, Function833
+ call CheckwLinkTimeoutFramesNonzero
+ jr z, SerialDisconnected
-.asm_813
+.wLinkTimeoutFrames_zero
ld a, [rIE]
and $f
cp $8
@@ -220,19 +223,19 @@
ld a, [hl]
ld [hSerialSend], a
call DelayFrame
- jp Function78a
+ jp .loop
-.asm_825
- ld a, $f
-.asm_827
+.delay_15_cycles
+ ld a, 15
+.delay_cycles
dec a
- jr nz, .asm_827
+ jr nz, .delay_cycles
ret
; 82b
-Function82b:: ; 82b
+CheckwLinkTimeoutFramesNonzero:: ; 82b
push hl
- ld hl, wcf5b
+ ld hl, wLinkTimeoutFrames
ld a, [hli]
or [hl]
pop hl
@@ -239,10 +242,10 @@
ret
; 833
-Function833:: ; 833
+SerialDisconnected:: ; 833
dec a
- ld [wcf5b], a
- ld [wcf5c], a
+ ld [wLinkTimeoutFrames], a
+ ld [wLinkTimeoutFrames + 1], a
ret
; 83b
@@ -275,7 +278,7 @@
Function862:: ; 862
call LoadTileMapToTempTileMap
callab PlaceWaitingText
- call Function87d
+ call WaitLinkTransfer
jp Call_LoadTempTileMapToTileMap
; 871
@@ -283,29 +286,30 @@
Function871:: ; 871
call LoadTileMapToTempTileMap
callab PlaceWaitingText
- jp Function87d
+ jp WaitLinkTransfer
; 87d
; One "giant" leap for machinekind
-Function87d:: ; 87d
+WaitLinkTransfer:: ; 87d
ld a, $ff
ld [wOtherPlayerLinkAction], a
.loop
call LinkTransfer
call DelayFrame
- call Function82b
+ call CheckwLinkTimeoutFramesNonzero
jr z, .check
push hl
- ld hl, wcf5c
+ ld hl, wLinkTimeoutFrames + 1
dec [hl]
jr nz, .skip
dec hl
dec [hl]
jr nz, .skip
+ ; We might be disconnected
pop hl
xor a
- jp Function833
+ jp SerialDisconnected
.skip
pop hl
@@ -395,6 +399,7 @@
; 919
Function919:: ; 919
+; XXX
ld a, [wLinkMode]
and a
ret nz
--- a/home/sine.asm
+++ b/home/sine.asm
@@ -8,14 +8,6 @@
ld e, a
- ld a, [hROMBank]
- push af
- ld a, BANK(_Sine)
- rst Bankswitch
-
- call _Sine
-
- pop af
- rst Bankswitch
+ homecall _Sine
ret
; 1b1e
--- a/home/string.asm
+++ b/home/string.asm
@@ -8,8 +8,6 @@
; Intended for names, so this function is limited to ten characters.
push hl
ld c, 10
-; 2efc
-
_InitString:: ; 2efc
; if the string pointed to by hl is empty (defined as "zero or more spaces
; followed by a null"), then initialize it to the string pointed to by de.
@@ -31,6 +29,7 @@
inc c
call CopyBytes
ret
+
.notblank
pop bc
pop hl
--- a/home/text.asm
+++ b/home/text.asm
@@ -129,12 +129,10 @@
; Fill text box width c height b at hl with pal 7
ld de, AttrMap - TileMap
add hl, de
-rept 2
inc b
-endr
-rept 2
+ inc b
inc c
-endr
+ inc c
ld a, TEXTBOX_PAL
.col
push bc
@@ -184,7 +182,7 @@
PrintTextBoxText:: ; 1065
bccoord TEXTBOX_INNERX, TEXTBOX_INNERY
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
ret
; 106c
@@ -527,7 +525,7 @@
call LoadBlinkingCursor
.linkbattle
- call Function13b6
+ call Text_WaitBGMap
call ButtonSound
hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY
lb bc, TEXTBOX_INNERH - 1, TEXTBOX_INNERW
@@ -548,7 +546,7 @@
call LoadBlinkingCursor
.communication
- call Function13b6
+ call Text_WaitBGMap
push de
call ButtonSound
@@ -600,7 +598,7 @@
call LoadBlinkingCursor
.ok
- call Function13b6
+ call Text_WaitBGMap
call ButtonSound
ld a, [wLinkMode]
cp LINK_COLOSSEUM
@@ -640,12 +638,10 @@
dec c
jr nz, .row
-rept 2
inc de
-endr
-rept 2
+ inc de
inc hl
-endr
+ inc hl
pop af
dec a
jr nz, .col
@@ -659,7 +655,7 @@
ret
; 13b6
-Function13b6:: ; 13b6
+Text_WaitBGMap:: ; 13b6
push bc
ld a, [hOAMUpdate]
push af
@@ -712,7 +708,7 @@
; 13e5
-PlaceWholeStringInBoxAtOnce:: ; 13e5
+PlaceHLTextAtBC:: ; 13e5
ld a, [TextBoxFlags]
push af
set 1, a
@@ -738,9 +734,8 @@
ld c, a
ld b, 0
ld hl, TextCommands
-rept 2
add hl, bc
-endr
+ add hl, bc
ld e, [hl]
inc hl
ld d, [hl]
@@ -1014,9 +1009,8 @@
jr z, .done
cp b
jr z, .play
-rept 2
inc hl
-endr
+ inc hl
jr .loop
.play
@@ -1035,6 +1029,8 @@
; 1522
Function1522:: ; 1522
+; XXX
+; TX_CRY
push de
ld e, [hl]
inc hl
@@ -1113,9 +1109,8 @@
ld e, a
ld d, 0
ld hl, StringBufferPointers
-rept 2
add hl, de
-endr
+ add hl, de
ld a, BANK(StringBufferPointers)
call GetFarHalfword
ld d, h
@@ -1136,9 +1131,8 @@
ld c, a
ld b, 0
ld hl, .Days
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
--- a/home/time.asm
+++ b/home/time.asm
@@ -48,17 +48,20 @@
ld [hl], RTC_S
ld a, [de]
- and $3f
+ maskbits 60
+ and x
ld [hRTCSeconds], a
ld [hl], RTC_M
ld a, [de]
- and $3f
+ maskbits 60
+ and x
ld [hRTCMinutes], a
ld [hl], RTC_H
ld a, [de]
- and $1f
+ maskbits 24
+ and x
ld [hRTCHours], a
ld [hl], RTC_DL
--- a/home/vblank.asm
+++ b/home/vblank.asm
@@ -19,9 +19,8 @@
ld e, a
ld d, 0
ld hl, .VBlanks
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
--- a/home/window.asm
+++ b/home/window.asm
@@ -3,12 +3,12 @@
call ClearWindowData
ld a, [hROMBank]
push af
- ld a, BANK(Function6454) ; and BANK(Function64bf)
+ ld a, BANK(ReanchorBGMap_NoOAMUpdate) ; and BANK(LoadFonts_NoOAMUpdate)
rst Bankswitch
- call Function6454
- call Function2e20
- call Function64bf
+ call ReanchorBGMap_NoOAMUpdate
+ call _OpenAndCloseMenu_HDMATransferTileMapAndAttrMap
+ call LoadFonts_NoOAMUpdate
pop af
rst Bankswitch
@@ -36,10 +36,10 @@
xor a
ld [hBGMapMode], a
call OverworldTextModeSwitch
- call Function2e20
+ call _OpenAndCloseMenu_HDMATransferTileMapAndAttrMap
xor a
ld [hBGMapMode], a
- call Function2e31
+ call SafeUpdateSprites
ld a, $90
ld [hWY], a
call ReplaceKrisSprite
@@ -52,13 +52,13 @@
call ClearWindowData
ld a, [hROMBank]
push af
- ld a, BANK(Function6454) ; and BANK(Function64bf)
+ ld a, BANK(ReanchorBGMap_NoOAMUpdate) ; and BANK(LoadFonts_NoOAMUpdate)
rst Bankswitch
- call Function6454 ; clear bgmap
+ call ReanchorBGMap_NoOAMUpdate ; clear bgmap
call SpeechTextBox
- call Function2e20 ; anchor bgmap
- call Function64bf ; load font
+ call _OpenAndCloseMenu_HDMATransferTileMapAndAttrMap ; anchor bgmap
+ call LoadFonts_NoOAMUpdate ; load font
pop af
rst Bankswitch
@@ -65,13 +65,13 @@
ret
; 2e20
-Function2e20:: ; 2e20
+_OpenAndCloseMenu_HDMATransferTileMapAndAttrMap:: ; 2e20
ld a, [hOAMUpdate]
push af
ld a, $1
ld [hOAMUpdate], a
- callba Function104110
+ callba OpenAndCloseMenu_HDMATransferTileMapAndAttrMap
pop af
ld [hOAMUpdate], a
@@ -78,7 +78,7 @@
ret
; 2e31
-Function2e31:: ; 2e31
+SafeUpdateSprites:: ; 2e31
ld a, [hOAMUpdate]
push af
ld a, [hBGMapMode]
@@ -87,7 +87,9 @@
ld [hBGMapMode], a
ld a, $1
ld [hOAMUpdate], a
+
call UpdateSprites
+
xor a
ld [hOAMUpdate], a
call DelayFrame
@@ -96,4 +98,8 @@
pop af
ld [hOAMUpdate], a
ret
-; 2e4e
+
+; XXX
+ scf
+ ret
+; 2e50
--- a/hram.asm
+++ b/hram.asm
@@ -1,5 +1,5 @@
HRAM_START EQU $ff80
-hPushOAM EQU $ff80
+hPushOAM EQU $ff80 ; 10 bytes
hROMBankBackup EQU $ff8a
hBuffer EQU $ff8b
@@ -69,6 +69,8 @@
hPrintNum9 EQU $ffbb
hPrintNum10 EQU $ffbc
+hMGStatusFlags EQU $ffbc
+
hUsedSpriteIndex EQU $ffbd
hUsedSpriteTile EQU $ffbe
hFFBF EQU $ffbf
@@ -77,9 +79,12 @@
hFFC2 EQU $ffc2
hMoneyTemp EQU $ffc3
-hFFC6 EQU $ffc6
-hFFC7 EQU $ffc7
-hFFC8 EQU $ffc8
+hMGJoypadPressed EQU $ffc3
+hMGJoypadReleased EQU $ffc4
+
+hLCDCPointer EQU $ffc6
+hLYOverrideStart EQU $ffc7
+hLYOverrideEnd EQU $ffc8
hMobileReceive EQU $ffc9
hFFCA EQU $ffca
hLinkPlayerNumber EQU $ffcb
--- a/items/item_descriptions.asm
+++ b/items/item_descriptions.asm
@@ -21,9 +21,8 @@
dec a
ld c, a
ld b, 0
-rept 2
add hl, bc
-endr
+ add hl, bc
ld e, [hl]
inc hl
ld d, [hl]
--- a/items/item_effects.asm
+++ b/items/item_effects.asm
@@ -253,9 +253,8 @@
jr z, .skip_or_return_from_ball_fn
cp c
jr z, .call_ball_function
-rept 2
inc hl
-endr
+ inc hl
jr .get_multiplier_loop
.call_ball_function
@@ -288,9 +287,8 @@
ld h, d
ld l, e
-rept 2
add hl, de
-endr
+ add hl, de
ld d, h
ld e, l
ld a, d
@@ -805,9 +803,8 @@
dec a
ld e, a
ld d, 0
-rept 2
add hl, de
-endr
+ add hl, de
ld a, BANK(PokedexDataPointerTable)
call GetFarHalfword
@@ -820,9 +817,8 @@
call GetPokedexEntryBank
push bc
-rept 2
inc hl
-endr
+ inc hl
call GetFarHalfword
srl h
@@ -868,9 +864,8 @@
ld a, c
cp [hl]
jr c, .heavymon
-rept 2
inc hl
-endr
+ inc hl
jr .lookup
.heavymon
@@ -929,9 +924,8 @@
ld c, a
ld b, 0
ld hl, EvosAttacksPointers
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, BANK(EvosAttacksPointers)
call GetFarHalfword
pop bc
@@ -943,9 +937,9 @@
pop bc
ret nz
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
; Moon Stone's constant from Pokémon Red is used.
; No Pokémon evolve with Burn Heal,
@@ -2127,9 +2121,8 @@
jr z, .NotFound
cp d
jr z, .done
-rept 2
inc hl
-endr
+ inc hl
jr .next
.NotFound:
@@ -2335,9 +2328,8 @@
.loop
cp [hl]
jr z, .got_it
-rept 2
inc hl
-endr
+ inc hl
jr .loop
.got_it
@@ -2488,20 +2480,20 @@
OldRod: ; f5a5
ld e, $0
- jr Function_0xf5b1
+ jr UseRod
; f5a9
GoodRod: ; f5a9
ld e, $1
- jr Function_0xf5b1
+ jr UseRod
; f5ad
SuperRod: ; f5ad
ld e, $2
- jr Function_0xf5b1
+ jr UseRod
; f5b1
-Function_0xf5b1: ; f5b1
+UseRod: ; f5b1
callba FishFunction
ret
; f5b8
@@ -2523,7 +2515,7 @@
ld [wd002], a
.loop
- ; Party Screen opens to choose on which Pkmn to use the Item
+ ; Party Screen opens to choose on which Pkmn to use the Item
ld b, PARTYMENUACTION_HEALING_ITEM
call UseItem_SelectMon
jp c, PPRestoreItem_Cancel
@@ -2937,7 +2929,7 @@
ret
; f789
-UseItemText ; f789
+UseItemText: ; f789
ld hl, UsedItemText
call PrintText
call Play_SFX_FULL_HEAL
@@ -3250,11 +3242,11 @@
ld hl, TempMonMoves ; Wasted cycles
dec a
- jr z, .got_nonpartymon ; BREEDMON
+ jr z, .got_nonpartymon ; TEMPMON
ld hl, BattleMonMoves ; WILDMON
-.got_nonpartymon ; BOXMON, BREEDMON, WILDMON
+.got_nonpartymon ; BOXMON, TEMPMON, WILDMON
call GetMthMoveOfCurrentMon
jr .gotdatmove
--- a/lib/mobile/main.asm
+++ b/lib/mobile/main.asm
@@ -75,7 +75,7 @@
Function110030:: ; 110030 (44:4030)
; Use the byte at $c988 as a parameter
; for a dw.
-; If [$c988] in {12, 14, 16},
+; If [$c988] not in {12, 14, 16},
; clear [$c835].
push de
ld a, [$c988]
@@ -89,24 +89,29 @@
ld [$c835], a
ld a, [$c988]
.noreset
- ld d, $0
+ ; Get the pointer
+ ld d, 0
ld e, a
ld hl, .dw
add hl, de
+ ; Store the low byte in [$c988]
ld a, [hli]
ld [$c988], a
ld a, [hl]
+ ; restore de
pop de
- ld hl, Function3e60
+ ld hl, Function3e60 ; return here
push hl
+ ; If the destination function is not Function110236,
+ ; call Function1100b4.
ld h, a
ld a, [$c988]
ld l, a
push hl
- ld a, $36
+ ld a, Function110236 % $100
cp l
jr nz, .okay
- ld a, $42
+ ld a, Function110236 / $100
cp h
.okay
call nz, Function1100b4
@@ -681,9 +686,8 @@
ld hl, Unknown_112037
ld de, $cb74
call Function110000
-rept 2
inc de
-endr
+ inc de
pop hl
ld bc, 0
call Function110007
@@ -741,9 +745,9 @@
ld a, $c8
ld [hli], a
xor a
-rept 3
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
ld [hl], a
ld a, $ff
ld [$c86e], a
@@ -964,9 +968,9 @@
ld a, $c8
ld [hli], a
xor a
-rept 3
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
ld [hl], a
ld a, $ff
ld [$c86e], a
@@ -1127,9 +1131,8 @@
ld hl, Unknown_112072
ld b, $5
call Function110000
-rept 2
inc de
-endr
+ inc de
ld bc, $0001
ld hl, Unknown_11209e
call Function110007
@@ -1395,9 +1398,8 @@
ld hl, Unknown_112072
ld b, $5
call Function110000
-rept 2
inc de
-endr
+ inc de
ld hl, Unknown_1120c8
call Function110007
pop hl
@@ -1561,12 +1563,10 @@
ld [hli], a
ld a, d
ld [hli], a
-rept 2
inc de
-endr
-rept 2
+ inc de
dec bc
-endr
+ dec bc
ld hl, $c98f
ld a, e
ld [hli], a
@@ -1586,9 +1586,8 @@
xor a
ld [hli], a
xor a
-rept 2
ld [hli], a
-endr
+ ld [hli], a
xor a
ld [$c86b], a
ld de, $cb47
@@ -1628,9 +1627,8 @@
ld [hli], a
ld a, d
ld [hli], a
-rept 2
inc de
-endr
+ inc de
ld a, e
ld [hli], a
ld a, d
@@ -1641,9 +1639,8 @@
ld [$c86e], a
ld [$c86f], a
jr z, .asm_110b5c
-rept 2
dec bc
-endr
+ dec bc
ld a, [$c993]
or a
jp nz, .asm_110bd5
@@ -1909,12 +1906,10 @@
ld [hli], a
ld a, d
ld [hli], a
-rept 2
inc de
-endr
-rept 2
+ inc de
dec bc
-endr
+ dec bc
ld hl, $c98f
ld a, e
ld [hli], a
@@ -1934,9 +1929,8 @@
xor a
ld [hli], a
xor a
-rept 2
ld [hli], a
-endr
+ ld [hli], a
xor a
ld [$c86b], a
ld de, $cb47
@@ -2151,16 +2145,14 @@
ld [$c833], a
ld a, [hli]
ld [$c834], a
-rept 2
inc hl
-endr
+ inc hl
ld a, l
ld [$c97f], a
ld a, h
ld [$c980], a
-rept 2
dec hl
-endr
+ dec hl
ld a, [hli]
ld h, [hl]
ld l, a
@@ -2282,9 +2274,9 @@
.asm_110ee3
ld hl, $c98b
xor a
-rept 3
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
ld [hl], a
pop bc
pop de
@@ -2302,9 +2294,8 @@
ld [hli], a
ld a, d
ld [hli], a
-rept 2
inc hl
-endr
+ inc hl
xor a
ld [$c994], a
@@ -2350,9 +2341,8 @@
ld hl, $c866
ld b, $4
call Function110000
-rept 2
inc de
-endr
+ inc de
ld b, $6
call Function111f63
ld a, [$cabc]
@@ -2424,9 +2414,8 @@
ld [hli], a
ld a, d
ld [hli], a
-rept 2
inc de
-endr
+ inc de
ld a, e
ld [hli], a
ld a, d
@@ -2436,9 +2425,8 @@
or c
ld [$c86e], a
ld [$c86f], a
-rept 2
dec bc
-endr
+ dec bc
jp z, Function1111ca
ld a, [$c991]
or a
@@ -2741,16 +2729,14 @@
ld [$c833], a
ld a, [hli]
ld [$c834], a
-rept 2
inc hl
-endr
+ inc hl
ld a, l
ld [$c97f], a
ld a, h
ld [$c980], a
-rept 2
dec hl
-endr
+ dec hl
ld a, [hli]
ld h, [hl]
ld l, a
@@ -2828,9 +2814,8 @@
ld a, [hld]
cp $2f
jr nz, .asm_1112a4
-rept 2
inc hl
-endr
+ inc hl
ld a, [hl]
cp $30
jr c, .asm_1112cc
@@ -2884,9 +2869,8 @@
ld [hli], a
ld a, d
ld [hli], a
-rept 2
inc hl
-endr
+ inc hl
ld a, e
ld [hli], a
ld a, d
@@ -2904,9 +2888,8 @@
ld [$c9ac], a
ld a, [hli]
ld [$c9ad], a
-rept 2
inc hl
-endr
+ inc hl
ld a, [hli]
ld [$c876], a
ld a, [hl]
@@ -2922,9 +2905,8 @@
ld a, [hli]
ld h, [hl]
ld l, a
-rept 2
inc hl
-endr
+ inc hl
ld a, [hli]
ld h, [hl]
ld l, a
@@ -3099,9 +3081,9 @@
push hl
ld hl, $c829
xor a
-rept 3
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
ld [hl], a
ld de, $cb47
ld hl, Unknown_112072
@@ -3114,9 +3096,8 @@
cp $81
jr nc, .asm_111485
ld c, a
-rept 2
inc a
-endr
+ inc a
ld [de], a
inc de
ld a, $ff
@@ -3128,9 +3109,8 @@
ld b, c
call Function110000
ld b, c
-rept 2
inc b
-endr
+ inc b
call Function111f63
ld hl, $c822
set 7, [hl]
@@ -3457,9 +3437,8 @@
ld a, b
srl a
srl a
-rept 2
add b
-endr
+ add b
ld [hl], a
ret
@@ -3599,9 +3578,9 @@
ld [$c800], a
xor a
ld hl, $c80a
-rept 3
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
ld hl, $c81f
ld a, [hli]
ld b, a
@@ -4126,9 +4105,8 @@
ld [$c800], a
xor a
ld hl, $c80a
-rept 2
ld [hli], a
-endr
+ ld [hli], a
ld [hl], a
ld hl, $c815
ld a, [$c820]
@@ -4331,9 +4309,8 @@
.asm_111c52
ld b, a
ld a, [$ca3f]
-rept 2
dec a
-endr
+ dec a
cp b
jr c, .asm_111c6e
.asm_111c5b
@@ -5604,9 +5581,8 @@
xor a
ld [hli], a
xor a
-rept 2
ld [hli], a
-endr
+ ld [hli], a
pop de
ld a, $1
ld [$c994], a
@@ -5731,24 +5707,21 @@
ld [hli], a
ld a, d
ld [hli], a
-rept 2
inc de
-endr
+ inc de
ld a, $80
ld [hli], a
ld a, $c8
ld [hli], a
-rept 2
dec bc
-endr
+ dec bc
ld a, $fa
ld [hli], a
ld a, $0
ld [hli], a
xor a
-rept 2
ld [hli], a
-endr
+ ld [hli], a
ld de, $cb47
ld hl, Unknown_112072
ld b, $6
@@ -6236,9 +6209,8 @@
ld de, $cb4c
ld a, $1
ld [de], a
-rept 2
inc de
-endr
+ inc de
ld b, $1
call Function111f63
jr .asm_112941
@@ -6471,9 +6443,8 @@
ld a, [hli]
ld h, [hl]
ld l, a
-rept 2
inc hl
-endr
+ inc hl
ld a, e
ld [hli], a
ld a, d
@@ -6970,9 +6941,8 @@
ld hl, $c821
res 2, [hl]
ld hl, $c86b
-rept 2
dec [hl]
-endr
+ dec [hl]
.asm_112d82
ld hl, $c86b
@@ -7131,9 +7101,8 @@
cp $1
ld a, $32
jr z, .asm_112e95
-rept 2
inc de
-endr
+ inc de
inc a
.asm_112e95
@@ -7512,9 +7481,8 @@
.asm_1130d6
ld a, [$c82b]
ld c, a
-rept 2
dec b
-endr
+ dec b
ld a, b
ld [$c82d], a
jr z, .asm_11310d
@@ -7522,9 +7490,8 @@
ld d, a
ld a, [$c872]
ld e, a
-rept 2
dec de
-endr
+ dec de
xor a
or d
jr nz, .asm_1130f5
@@ -7543,9 +7510,8 @@
ld e, a
ld a, [$c875]
ld d, a
-rept 2
inc de
-endr
+ inc de
call Function110000
.asm_11310d
@@ -7658,9 +7624,8 @@
ld a, b
ld [de], a
inc de
-rept 2
dec b
-endr
+ dec b
call Function110000
xor a
ld [de], a
@@ -7682,9 +7647,8 @@
inc b
cp $a
jr nz, .asm_1131b7
-rept 2
inc hl
-endr
+ inc hl
dec b
ld c, b
call Function110000
@@ -7728,9 +7692,8 @@
ld hl, $c821
res 2, [hl]
ld hl, $c86b
-rept 2
dec [hl]
-endr
+ dec [hl]
ld a, $4
ret
; 113206
@@ -7753,9 +7716,8 @@
ld e, a
ld a, [$c875]
ld d, a
-rept 2
inc de
-endr
+ inc de
call Function110000
ld a, [$c991]
ld [$c993], a
@@ -8026,9 +7988,8 @@
ld a, [hli]
ld h, [hl]
ld l, a
-rept 2
inc hl
-endr
+ inc hl
ld a, [hli]
ld h, [hl]
ld l, a
@@ -8039,9 +8000,8 @@
ld a, [hld]
cp $2f
jr nz, .asm_11344c
-rept 2
inc hl
-endr
+ inc hl
ld e, l
ld d, h
.asm_113455
@@ -8059,9 +8019,8 @@
ld a, [hli]
ld h, [hl]
ld l, a
-rept 2
inc hl
-endr
+ inc hl
ld a, [hli]
ld h, [hl]
ld l, a
@@ -8158,9 +8117,8 @@
ret
.asm_1134f0
-rept 2
inc [hl]
-endr
+ inc [hl]
jr .asm_1134fc
.asm_1134f4
@@ -9185,9 +9143,9 @@
ld bc, $0003
.asm_113ccf
-rept 3
dec bc
-endr
+ dec bc
+ dec bc
ld a, c
ld [$cc10], a
ld a, b
@@ -9223,9 +9181,8 @@
ld a, $3f
and c
ld [hld], a
-rept 2
dec hl
-endr
+ dec hl
pop de
ld b, h
ld c, l
@@ -9572,9 +9529,8 @@
ld a, [hli]
ld h, [hl]
ld l, a
-rept 2
inc hl
-endr
+ inc hl
ld a, [hld]
dec hl
xor $80
@@ -9615,9 +9571,8 @@
ld l, a
ld e, l
ld d, h
-rept 2
add hl, de
-endr
+ add hl, de
ld e, l
ld d, h
ld hl, $c815
@@ -9677,9 +9632,8 @@
ld l, a
ld e, l
ld d, h
-rept 2
add hl, de
-endr
+ add hl, de
ld e, l
ld d, h
ld hl, $c815
--- a/macros.asm
+++ b/macros.asm
@@ -140,7 +140,14 @@
; pic animations
frame: MACRO
db \1
- db \2
+x = \2
+IF _NARG > 2
+rept _NARG +- 2
+x = x | (1 << (\3 + 1))
+ shift
+endr
+endc
+ db x
ENDM
setrepeat: MACRO
db $fe
@@ -155,6 +162,12 @@
ENDM
+delanim: MACRO
+ db $fc
+ ENDM
+dorestart: MACRO
+ db $fe
+ ENDM
sine_wave: MACRO
; \1: amplitude
@@ -244,9 +257,9 @@
bcbgcoord EQUS "bgcoord bc,"
bgrows EQUS "* $20"
-palred EQUS "$0400 *"
+palred EQUS "$0001 *"
palgreen EQUS "$0020 *"
-palblue EQUS "$0001 *"
+palblue EQUS "$0400 *"
dsprite: MACRO
; conditional segment is there because not every instance of
@@ -270,3 +283,34 @@
ld l, a
jp [hl]
endm
+
+maskbits: macro
+; returns to x
+; usage in rejection sampling
+; .loop
+; call Random
+; maskbits 30
+; and x
+; cp 30
+; jr nc, .loop
+
+x = 1
+rept 8
+IF \1 > x
+x = (x + 1) * 2 +- 1
+ENDC
+endr
+endm
+
+homecall: MACRO
+ ld a, [hROMBank]
+ push af
+ ld a, BANK(\1)
+ rst Bankswitch
+
+ call \1
+
+ pop af
+ rst Bankswitch
+ENDM
+
--- a/macros/move_anim.asm
+++ b/macros/move_anim.asm
@@ -183,9 +183,9 @@
db anim_0xed_command
endm
- enum anim_jumpand_command ; ee
-anim_jumpand: macro
- db anim_jumpand_command
+ enum anim_if_param_and_command ; ee
+anim_if_param_and: macro
+ db anim_if_param_and_command
db \1 ; value
dw \2 ; address
endm
@@ -243,9 +243,9 @@
db anim_0xf7_command
endm
- enum anim_jumpif_command ; f8
-anim_jumpif: macro
- db anim_jumpif_command
+ enum anim_if_param_equal_command ; f8
+anim_if_param_equal: macro
+ db anim_if_param_equal_command
db \1 ; value
dw \2 ; address
endm
@@ -261,9 +261,9 @@
db anim_incvar_command
endm
- enum anim_jumpvar_command ; fb
-anim_jumpvar: macro
- db anim_jumpvar_command
+ enum anim_if_var_equal_command ; fb
+anim_if_var_equal: macro
+ db anim_if_var_equal_command
db \1 ; value
dw \2 ; address
endm
--- a/macros/movement.asm
+++ b/macros/movement.asm
@@ -1,286 +1,106 @@
-
enum_start
- enum movement_turn_head_down
-turn_head_down: macro
- db movement_turn_head_down ; $00
- endm
+; Directional movements
- enum movement_turn_head_up
-turn_head_up: macro
- db movement_turn_head_up ; $01
+ enum movement_turn_head
+turn_head: macro
+ db movement_turn_head | \1 ; $00
endm
- enum movement_turn_head_left
-turn_head_left: macro
- db movement_turn_head_left ; $02
- endm
+__enum__ = __enum__ + 3
- enum movement_turn_head_right
-turn_head_right: macro
- db movement_turn_head_right ; $03
+ enum movement_turn_step
+turn_step: macro
+ db movement_turn_step | \1 ; $04
endm
- enum movement_turn_step_down
-turn_step_down: macro
- db movement_turn_step_down ; $04
- endm
+__enum__ = __enum__ + 3
- enum movement_turn_step_up
-turn_step_up: macro
- db movement_turn_step_up ; $05
+ enum movement_slow_step
+slow_step: macro
+ db movement_slow_step | \1; $08
endm
- enum movement_turn_step_left
-turn_step_left: macro
- db movement_turn_step_left ; $06
- endm
+__enum__ = __enum__ + 3
- enum movement_turn_step_right
-turn_step_right: macro
- db movement_turn_step_right ; $07
+ enum movement_step
+step: macro
+ db movement_step | \1 ; $0c
endm
- enum movement_slow_step_down
-slow_step_down: macro
- db movement_slow_step_down ; $08
- endm
+__enum__ = __enum__ + 3
- enum movement_slow_step_up
-slow_step_up: macro
- db movement_slow_step_up ; $09
+ enum movement_big_step
+big_step: macro
+ db movement_big_step | \1 ; $10
endm
- enum movement_slow_step_left
-slow_step_left: macro
- db movement_slow_step_left ; $0a
- endm
+__enum__ = __enum__ + 3
- enum movement_slow_step_right
-slow_step_right: macro
- db movement_slow_step_right ; $0b
- endm
-
- enum movement_step_down
-step_down: macro
- db movement_step_down ; $0c
- endm
-
- enum movement_step_up
-step_up: macro
- db movement_step_up ; $0d
- endm
-
- enum movement_step_left
-step_left: macro
- db movement_step_left ; $0e
- endm
-
- enum movement_step_right
-step_right: macro
- db movement_step_right ; $0f
- endm
-
- enum movement_big_step_down
-big_step_down: macro
- db movement_big_step_down ; $10
- endm
-
- enum movement_big_step_up
-big_step_up: macro
- db movement_big_step_up ; $11
- endm
-
- enum movement_big_step_left
-big_step_left: macro
- db movement_big_step_left ; $12
- endm
-
- enum movement_big_step_right
-big_step_right: macro
- db movement_big_step_right ; $13
- endm
-
- enum movement_slow_slide_step_down
-slow_slide_step_down: macro
- db movement_slow_slide_step_down ; $14
- endm
-
- enum movement_slow_slide_step_up
-slow_slide_step_up: macro
- db movement_slow_slide_step_up ; $15
- endm
-
- enum movement_slow_slide_step_left
-slow_slide_step_left: macro
- db movement_slow_slide_step_left ; $16
- endm
-
- enum movement_slow_slide_step_right
-slow_slide_step_right: macro
- db movement_slow_slide_step_right ; $17
- endm
-
- enum movement_slide_step_down
-slide_step_down: macro
- db movement_slide_step_down ; $18
- endm
-
- enum movement_slide_step_up
-slide_step_up: macro
- db movement_slide_step_up ; $19
+ enum movement_slow_slide_step
+slow_slide_step: macro
+ db movement_slow_slide_step | \1 ; $14
endm
- enum movement_slide_step_left
-slide_step_left: macro
- db movement_slide_step_left ; $1a
- endm
+__enum__ = __enum__ + 3
- enum movement_slide_step_right
-slide_step_right: macro
- db movement_slide_step_right ; $1b
+ enum movement_slide_step
+slide_step: macro
+ db movement_slide_step | \1 ; $18
endm
- enum movement_fast_slide_step_down
-fast_slide_step_down: macro
- db movement_fast_slide_step_down ; $1c
- endm
+__enum__ = __enum__ + 3
- enum movement_fast_slide_step_up
-fast_slide_step_up: macro
- db movement_fast_slide_step_up ; $1d
+ enum movement_fast_slide_step
+fast_slide_step: macro
+ db movement_fast_slide_step | \1 ; $1c
endm
- enum movement_fast_slide_step_left
-fast_slide_step_left: macro
- db movement_fast_slide_step_left ; $1e
- endm
+__enum__ = __enum__ + 3
- enum movement_fast_slide_step_right
-fast_slide_step_right: macro
- db movement_fast_slide_step_right ; $1f
+ enum movement_turn_away
+turn_away: macro
+ db movement_turn_away | \1 ; $20
endm
- enum movement_turn_away_down
-turn_away_down: macro
- db movement_turn_away_down ; $20
- endm
+__enum__ = __enum__ + 3
- enum movement_turn_away_up
-turn_away_up: macro
- db movement_turn_away_up ; $21
+ enum movement_turn_in
+turn_in: macro
+ db movement_turn_in | \1 ; $24
endm
- enum movement_turn_away_left
-turn_away_left: macro
- db movement_turn_away_left ; $22
- endm
+__enum__ = __enum__ + 3
- enum movement_turn_away_right
-turn_away_right: macro
- db movement_turn_away_right ; $23
+ enum movement_turn_waterfall
+turn_waterfall: macro
+ db movement_turn_waterfall | \1 ; $28
endm
- enum movement_turn_in_down
-turn_in_down: macro
- db movement_turn_in_down ; $24
- endm
+__enum__ = __enum__ + 3
- enum movement_turn_in_up
-turn_in_up: macro
- db movement_turn_in_up ; $25
+ enum movement_slow_jump_step
+slow_jump_step: macro
+ db movement_slow_jump_step | \1 ; $2c
endm
- enum movement_turn_in_left
-turn_in_left: macro
- db movement_turn_in_left ; $26
- endm
+__enum__ = __enum__ + 3
- enum movement_turn_in_right
-turn_in_right: macro
- db movement_turn_in_right ; $27
+ enum movement_jump_step
+jump_step: macro
+ db movement_jump_step | \1 ; $30
endm
- enum movement_turn_waterfall_down
-turn_waterfall_down: macro
- db movement_turn_waterfall_down ; $28
- endm
+__enum__ = __enum__ + 3
- enum movement_turn_waterfall_up
-turn_waterfall_up: macro
- db movement_turn_waterfall_up ; $29
+ enum movement_fast_jump_step
+fast_jump_step: macro
+ db movement_fast_jump_step | \1 ; $34
endm
- enum movement_turn_waterfall_left
-turn_waterfall_left: macro
- db movement_turn_waterfall_left ; $2a
- endm
+__enum__ = __enum__ + 3
- enum movement_turn_waterfall_right
-turn_waterfall_right: macro
- db movement_turn_waterfall_right ; $2b
- endm
-
- enum movement_slow_jump_step_down
-slow_jump_step_down: macro
- db movement_slow_jump_step_down ; $2c
- endm
-
- enum movement_slow_jump_step_up
-slow_jump_step_up: macro
- db movement_slow_jump_step_up ; $2d
- endm
-
- enum movement_slow_jump_step_left
-slow_jump_step_left: macro
- db movement_slow_jump_step_left ; $2e
- endm
-
- enum movement_slow_jump_step_right
-slow_jump_step_right: macro
- db movement_slow_jump_step_right ; $2f
- endm
-
- enum movement_jump_step_down
-jump_step_down: macro
- db movement_jump_step_down ; $30
- endm
-
- enum movement_jump_step_up
-jump_step_up: macro
- db movement_jump_step_up ; $31
- endm
-
- enum movement_jump_step_left
-jump_step_left: macro
- db movement_jump_step_left ; $32
- endm
-
- enum movement_jump_step_right
-jump_step_right: macro
- db movement_jump_step_right ; $33
- endm
-
- enum movement_fast_jump_step_down
-fast_jump_step_down: macro
- db movement_fast_jump_step_down ; $34
- endm
-
- enum movement_fast_jump_step_up
-fast_jump_step_up: macro
- db movement_fast_jump_step_up ; $35
- endm
-
- enum movement_fast_jump_step_left
-fast_jump_step_left: macro
- db movement_fast_jump_step_left ; $36
- endm
-
- enum movement_fast_jump_step_right
-fast_jump_step_right: macro
- db movement_fast_jump_step_right ; $37
- endm
-
+; Control
enum movement_remove_sliding
remove_sliding: macro
db movement_remove_sliding ; $38
@@ -311,52 +131,19 @@
db movement_hide_person ; $3d
endm
- enum movement_step_sleep_1
-step_sleep_1: macro
- db movement_step_sleep_1 ; $3e
- endm
+; Sleep
- enum movement_step_sleep_2
-step_sleep_2: macro
- db movement_step_sleep_2 ; $3f
- endm
-
- enum movement_step_sleep_3
-step_sleep_3: macro
- db movement_step_sleep_3 ; $40
- endm
-
- enum movement_step_sleep_4
-step_sleep_4: macro
- db movement_step_sleep_4 ; $41
- endm
-
- enum movement_step_sleep_5
-step_sleep_5: macro
- db movement_step_sleep_5 ; $42
- endm
-
- enum movement_step_sleep_6
-step_sleep_6: macro
- db movement_step_sleep_6 ; $43
- endm
-
- enum movement_step_sleep_7
-step_sleep_7: macro
- db movement_step_sleep_7 ; $44
- endm
-
- enum movement_step_sleep_8
-step_sleep_8: macro
- db movement_step_sleep_8 ; $45
- endm
-
enum movement_step_sleep
step_sleep: macro
- db movement_step_sleep ; $46
- db \1 ; duration
- endm
+if \1 <= 8
+ db movement_step_sleep + \1 - 1
+else
+ db movement_step_sleep + 8, \1
+endc
+endm
+__enum__ = __enum__ + 8
+
enum movement_step_end
step_end: macro
db movement_step_end ; $47
@@ -363,8 +150,11 @@
endm
; Whatever Movement_48 is, it takes a one-byte parameter
-
-__enum__ = $49
+ enum movement_step_48
+step_48: macro
+ db movement_step_48
+ db \1
+ endm
enum movement_remove_person
remove_person: macro
--- a/macros/sound.asm
+++ b/macros/sound.asm
@@ -37,10 +37,10 @@
endc
endm
- enum forceoctave_cmd
-forceoctave: macro
- db forceoctave_cmd
- db \1 ; octave
+ enum pitchoffset_cmd
+pitchoffset: macro
+ db pitchoffset_cmd
+ dn \1, \2 - 1 ; octave, key
endm
enum tempo_cmd
@@ -67,10 +67,10 @@
db \1 ; input
endm
- enum unknownmusic0xde_cmd
-unknownmusic0xde: macro
- db unknownmusic0xde_cmd
- db \1 ; unknown
+ enum sound_duty_cmd
+sound_duty: macro
+ db sound_duty_cmd
+ db \1 | (\2 << 2) | (\3 << 4) | (\4 << 6) ; duty sequence
endm
enum togglesfx_cmd
@@ -78,11 +78,10 @@
db togglesfx_cmd
endm
- enum unknownmusic0xe0_cmd
-unknownmusic0xe0: macro
- db unknownmusic0xe0_cmd
- db \1 ; unknown
- ; db \2 ; unknown
+ enum slidepitchto_cmd
+slidepitchto: macro
+ db slidepitchto_cmd
+ db \1 - 1 ; duration
dn \2, \3 ; octave, pitch
endm
--- a/macros/trade_anim.asm
+++ b/macros/trade_anim.asm
@@ -75,14 +75,14 @@
db tradeanim_do_givemon_scroll_command ; 1c
endm
- enum tradeanim_1d_command
-tradeanim_1d: macro
- db tradeanim_1d_command ; 1d
+ enum tradeanim_frontpic_scroll_command
+tradeanim_frontpic_scroll: macro
+ db tradeanim_frontpic_scroll_command ; 1d
endm
- enum tradeanim_1e_command
-tradeanim_1e: macro
- db tradeanim_1e_command ; 1e
+ enum tradeanim_textbox_scroll_command
+tradeanim_textbox_scroll: macro
+ db tradeanim_textbox_scroll_command ; 1e
endm
enum tradeanim_scroll_out_right_command
--- a/macros/wram.asm
+++ b/macros/wram.asm
@@ -134,7 +134,7 @@
\1FrequencyHi:: db
\1Pitch:: db ; 0:rest 1-c:note
\1Octave:: db ; 7-0 (0 is highest)
-\1StartingOctave:: db ; raises existing octaves (to repeat phrases)
+\1PitchOffset:: db ; raises existing octaves (to repeat phrases)
\1NoteDuration:: db ; frames remaining for the current note
\1Field0x16:: ds 1 ; c117
ds 1 ; c118
@@ -141,15 +141,14 @@
\1LoopCount:: db
\1Tempo:: dw
\1Tracks:: db ; hi:left lo:right
-\1Field0x1c:: ds 1 ; c11d
+\1SFXDutyLoop:: ds 1 ; c11d
\1VibratoDelayCount:: db ; initialized by \1VibratoDelay
\1VibratoDelay:: db ; number of frames a note plays until vibrato starts
\1VibratoExtent:: db
\1VibratoRate:: db ; hi:frames for each alt lo:frames to the next alt
-\1Field0x21:: ds 1 ; c122
-\1Field0x22:: ds 1 ; c123
-\1Field0x23:: ds 1 ; c124
-\1Field0x24:: ds 1 ; c125
+\1PitchWheelTarget:: dw ; frequency endpoint for pitch wheel
+\1PitchWheelAmount:: db ; c124
+\1PitchWheelAmountFraction:: db ; c125
\1Field0x25:: ds 1 ; c126
ds 1 ; c127
\1CryPitch:: dw
@@ -199,6 +198,21 @@
\1End::
endm
+roam_struct: MACRO
+\1Species:: db
+\1Level:: db
+\1MapGroup:: db
+\1MapNumber:: db
+\1HP:: ds 1
+\1DVs:: ds 2
+ENDM
+
+bugcontestwinner: macro
+\1PersonID:: ds 1
+\1Mon:: ds 1
+\1Score:: ds 2
+endm
+
hall_of_fame: MACRO
\1::
\1WinCount:: ds 1
@@ -248,4 +262,113 @@
\1Slot0d:: ds 1
\1Slot0e:: ds 1
\1Slot0f:: ds 1
-endm
\ No newline at end of file
+endm
+
+object_struct: MACRO
+\1Struct::
+\1Sprite:: ds 1
+\1MapObjectIndex:: ds 1
+\1SpriteTile:: ds 1
+\1MovementType:: ds 1
+\1Flags:: ds 2
+\1Palette:: ds 1
+\1Walking:: ds 1
+\1Direction:: ds 1
+\1StepType:: ds 1
+\1StepDuration:: ds 1
+\1Action:: ds 1
+\1ObjectStepFrame:: ds 1
+\1Facing:: ds 1
+\1StandingTile:: ds 1 ; collision
+\1LastTile:: ds 1 ; collision
+\1StandingMapX:: ds 1
+\1StandingMapY:: ds 1
+\1LastMapX:: ds 1
+\1LastMapY:: ds 1
+\1ObjectInitX:: ds 1
+\1ObjectInitY:: ds 1
+\1Radius:: ds 1
+\1SpriteX:: ds 1
+\1SpriteY:: ds 1
+\1SpriteXOffset:: ds 1
+\1SpriteYOffset:: ds 1
+\1MovementByteIndex:: ds 1
+\1Object28:: ds 1
+\1Object29:: ds 1
+\1Object30:: ds 1
+\1Object31:: ds 1
+\1Range:: ds 1
+ ds 7
+\1StructEnd::
+ENDM
+
+map_object: MACRO
+\1Object::
+\1ObjectStructID:: ds 1
+\1ObjectSprite:: ds 1
+\1ObjectYCoord:: ds 1
+\1ObjectXCoord:: ds 1
+\1ObjectMovement:: ds 1
+\1ObjectRadius:: ds 1
+\1ObjectHour:: ds 1
+\1ObjectTimeOfDay:: ds 1
+\1ObjectColor:: ds 1
+\1ObjectRange:: ds 1
+\1ObjectScript:: ds 2
+\1ObjectEventFlag:: ds 2
+ ds 2
+endm
+
+sprite_anim_struct: MACRO
+\1Index:: ds 1 ; 0
+\1FramesetID:: ds 1 ; 1
+\1AnimSeqID:: ds 1 ; 2
+\1TileID:: ds 1 ; 3
+\1XCoord:: ds 1 ; 4
+\1YCoord:: ds 1 ; 5
+\1XOffset:: ds 1 ; 6
+\1YOffset:: ds 1 ; 7
+\1Duration:: ds 1 ; 8
+\1DurationOffset:: ds 1 ; 9
+\1FrameIndex:: ds 1 ; a
+\1Sprite0b:: ds 1
+\1Sprite0c:: ds 1
+\1Sprite0d:: ds 1
+\1Sprite0e:: ds 1
+\1Sprite0f:: ds 1
+ENDM
+
+battle_anim_struct: MACRO
+; Placeholder until we can figure out what it all means
+\1_Index:: ds 1
+\1_Anim01:: ds 1
+\1_Anim02:: ds 1
+\1_FramesetIndex:: ds 1
+\1_FunctionIndex:: ds 1
+\1_Anim05:: ds 1
+\1_TileID:: ds 1
+\1_XCoord:: ds 1
+\1_YCoord:: ds 1
+\1_XOffset:: ds 1
+\1_YOffset:: ds 1
+\1_Anim0b:: ds 1
+\1_Anim0c:: ds 1
+\1_Anim0d:: ds 1
+\1_AnonJumptableIndex:: ds 1
+\1_Anim0f:: ds 1
+\1_Anim10:: ds 1
+\1_Anim11:: ds 1
+\1_Anim12:: ds 1
+\1_Anim13:: ds 1
+\1_Anim14:: ds 1
+\1_Anim15:: ds 1
+\1_Anim16:: ds 1
+\1_Anim17:: ds 1
+endm
+
+battle_bg_effect: MACRO
+\1_Function:: ds 1
+\1_01:: ds 1
+\1_02:: ds 1
+\1_03:: ds 1
+endm
--- a/main.asm
+++ b/main.asm
@@ -42,7 +42,7 @@
PushOAM: ; 403f
ld a, Sprites / $100
ld [rDMA], a
- ld a, 40
+ ld a, (SpritesEnd - Sprites) / 4 ; 40
.loop
dec a
jr nz, .loop
@@ -53,7 +53,7 @@
INCLUDE "engine/intro_menu.asm"
-Function6454:: ; 6454
+ReanchorBGMap_NoOAMUpdate:: ; 6454
call DelayFrame
ld a, [hOAMUpdate]
push af
@@ -64,8 +64,9 @@
push af
xor a
ld [hBGMapMode], a
- call .Function6473
+ call .ReanchorBGMap
+
pop af
ld [hBGMapMode], a
pop af
@@ -74,16 +75,16 @@
set 6, [hl]
ret
-.Function6473:
+.ReanchorBGMap:
xor a
- ld [hFFC6], a
+ ld [hLCDCPointer], a
ld [hBGMapMode], a
ld a, $90
ld [hWY], a
call OverworldTextModeSwitch
ld a, VBGMap1 / $100
- call .Function64b9
- call Function2e20
+ call .LoadBGMapAddrIntoHRAM
+ call _OpenAndCloseMenu_HDMATransferTileMapAndAttrMap
callba LoadOW_BGPal7
callba ApplyPals
ld a, $1
@@ -91,9 +92,9 @@
xor a
ld [hBGMapMode], a
ld [hWY], a
- callba Function64db ; no need to farcall
+ callba HDMATransfer_FillBGMap0WithTile60 ; no need to farcall
ld a, VBGMap0 / $100
- call .Function64b9
+ call .LoadBGMapAddrIntoHRAM
xor a
ld [wBGMapAnchor], a
ld a, VBGMap0 / $100
@@ -101,36 +102,36 @@
xor a
ld [hSCX], a
ld [hSCY], a
- call Function5958
+ call ApplyBGMapAnchorToObjects
ret
-.Function64b9: ; 64b9
+.LoadBGMapAddrIntoHRAM: ; 64b9
ld [hBGMapAddress + 1], a
xor a
ld [hBGMapAddress], a
ret
-Function64bf:: ; 64bf
+LoadFonts_NoOAMUpdate:: ; 64bf
ld a, [hOAMUpdate]
push af
ld a, $1
ld [hOAMUpdate], a
- call .Function64cd
+ call .LoadGFX
pop af
ld [hOAMUpdate], a
ret
-.Function64cd:
+.LoadGFX:
call LoadFontsExtra
ld a, $90
ld [hWY], a
- call Function2e31
+ call SafeUpdateSprites
call LoadStandardFont
ret
-Function64db: ; 64db
+HDMATransfer_FillBGMap0WithTile60: ; 64db
ld a, [rSVBK]
push af
ld a, $6
@@ -138,7 +139,7 @@
ld a, $60
ld hl, wDecompressScratch
- ld bc, wBackupAttrMap - wDecompressScratch
+ ld bc, wScratchAttrMap - wDecompressScratch
call ByteFill
ld a, wDecompressScratch / $100
ld [rHDMA1], a
@@ -932,8 +933,8 @@
ld h, b
ld l, c
inc hl
- ld c, $3
- call Function3842
+ ld c, 3
+ call Print8BitNumRightAlign
.skip_level
pop af
@@ -1174,170 +1175,8 @@
ret
INCLUDE "engine/wildmons.asm"
+INCLUDE "battle/link_result.asm"
-DetermineLinkBattleResult: ; 2b930
- callba UpdateEnemyMonInParty
- ld hl, PartyMon1HP
- call .CountMonsRemaining
- push bc
- ld hl, OTPartyMon1HP
- call .CountMonsRemaining
- ld a, c
- pop bc
- cp c
- jr z, .even_number_of_mons_remaining
- jr c, .defeat
- jr .victory
-
-.even_number_of_mons_remaining
- call .BothSides_CheckNumberMonsAtFullHealth
- jr z, .drawn
- ld a, e
- cp $1
- jr z, .victory
- cp $2
- jr z, .defeat
- ld hl, PartyMon1HP
- call .CalcPercentHPRemaining
- push de
- ld hl, OTPartyMon1HP
- call .CalcPercentHPRemaining
- pop hl
- ld a, d
- cp h
- jr c, .victory
- jr z, .compare_lo
- jr .defeat
-
-.compare_lo
- ld a, e
- cp l
- jr z, .drawn
- jr nc, .defeat
-
-.victory
- ld a, [wBattleResult]
- and $f0
- ld [wBattleResult], a
- ret
-
-.defeat
- ld a, [wBattleResult]
- and $f0
- add $1
- ld [wBattleResult], a
- ret
-
-.drawn
- ld a, [wBattleResult]
- and $f0
- add $2
- ld [wBattleResult], a
- ret
-
-.CountMonsRemaining: ; 2b995
- ld c, 0
- ld b, 3
- ld de, PARTYMON_STRUCT_LENGTH - 1
-.loop
- ld a, [hli]
- or [hl]
- jr nz, .not_fainted
- inc c
-
-.not_fainted
- add hl, de
- dec b
- jr nz, .loop
- ret
-
-.CalcPercentHPRemaining: ; 2b9a6
- ld de, 0
- ld c, $3
-.loop2
- ld a, [hli]
- or [hl]
- jr z, .next
- dec hl
- xor a
- ld [hDividend + 0], a
- ld a, [hli]
- ld [hDividend + 1], a
- ld a, [hli]
- ld [hDividend + 2], a
- xor a
- ld [hDividend + 3], a
- ld a, [hli]
- ld b, a
- ld a, [hld]
- srl b
- rr a
- srl b
- rr a
- ld [hDivisor], a
- ld b, $4
- call Divide
- ld a, [hQuotient + 2]
- add e
- ld e, a
- ld a, [hQuotient + 1]
- adc d
- ld d, a
- dec hl
-
-.next
- push de
- ld de, $2f
- add hl, de
- pop de
- dec c
- jr nz, .loop2
- ret
-
-.BothSides_CheckNumberMonsAtFullHealth: ; 2b9e1
- ld hl, PartyMon1HP
- call .CheckFaintedOrFullHealth
- jr nz, .finish ; we have a pokemon that's neither fainted nor at full health
- ld hl, OTPartyMon1HP
- call .CheckFaintedOrFullHealth
- ld e, $1
- ret
-
-.finish
- ld hl, OTPartyMon1HP
- call .CheckFaintedOrFullHealth
- ld e, $0
- ret nz ; we both have pokemon that are neither fainted nor at full health
- ld e, $2
- ld a, $1
- and a
- ret
-
-.CheckFaintedOrFullHealth: ; 2ba01
- ld d, 3
-.loop3
- ld a, [hli]
- ld b, a
- ld a, [hli]
- ld c, a
- or b
- jr z, .fainted_or_full_health
- ld a, [hli]
- cp b
- ret nz
- ld a, [hld]
- cp c
- ret nz
-
-.fainted_or_full_health
- push de
- ld de, PARTYMON_STRUCT_LENGTH - 2
- add hl, de
- pop de
- dec d
- jr nz, .loop3
- ret
-
ChrisBackpic: ; 2ba1a
INCBIN "gfx/misc/player.6x6.2bpp.lz"
@@ -1678,9 +1517,9 @@
ld [wBattleResult], a
ld hl, wPartyMenuCursor
-rept 3
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
ld [hl], a
ld [wMenuScrollPosition], a
@@ -2103,78 +1942,6 @@
String_44331: ; 44331
db "#@"
-GetDexEntryPointer: ; 44333
-; return dex entry pointer b:de
- push hl
- ld hl, PokedexDataPointerTable
- ld a, b
- dec a
- ld d, 0
- ld e, a
- add hl, de
- add hl, de
- ld e, [hl]
- inc hl
- ld d, [hl]
- push de
- rlca
- rlca
- and $3
- ld hl, .PokedexEntryBanks
- ld d, 0
- ld e, a
- add hl, de
- ld b, [hl]
- pop de
- pop hl
- ret
-
-.PokedexEntryBanks: ; 44351
-
-GLOBAL PokedexEntries1
-GLOBAL PokedexEntries2
-GLOBAL PokedexEntries3
-GLOBAL PokedexEntries4
-
- db BANK(PokedexEntries1)
- db BANK(PokedexEntries2)
- db BANK(PokedexEntries3)
- db BANK(PokedexEntries4)
-
-GetDexEntryPagePointer: ; 44355
- call GetDexEntryPointer ; b:de
- push hl
- ld h, d
- ld l, e
-; skip species name
-.loop1
- ld a, b
- call GetFarByte
- inc hl
- cp "@"
- jr nz, .loop1
-; skip height and weight
-rept 4
- inc hl
-endr
-; if c != 1: skip entry
- dec c
- jr z, .done
-; skip entry
-.loop2
- ld a, b
- call GetFarByte
- inc hl
- cp "@"
- jr nz, .loop2
-
-.done
- ld d, h
- ld e, l
- pop hl
- ret
-
-PokedexDataPointerTable: ; 0x44378
INCLUDE "data/pokedex/entry_pointers.asm"
INCLUDE "engine/mail.asm"
@@ -2505,7 +2272,7 @@
and a
jp z, WaitBGMap
-; The following is a modified version of Function3246.
+; The following is a modified version of LoadEDTile.
ld a, [hBGMapMode]
push af
xor a
@@ -2646,7 +2413,7 @@
cp $0
jp z, WaitBGMap
-; What follows is a modified version of Function3246 (LoadEDTile).
+; What follows is a modified version of LoadEDTile.
ld a, [hBGMapMode]
push af
xor a
@@ -2740,7 +2507,7 @@
callba LoadTradeScreenBorder
callba Link_WaitBGMap
callba InitTradeSpeciesList
- callba Function28eff
+ callba SetTradeRoomBGPals
call WaitBGMap2
ret
@@ -2817,305 +2584,8 @@
jr nz, .row_loop
ret
-_ResetClock: ; 4d3b1
- callba BlankScreen
- ld b, SCGB_08
- call GetSGBLayout
- call LoadStandardFont
- call LoadFontsExtra
- ld de, MUSIC_MAIN_MENU
- call PlayMusic
- ld hl, .text_askreset
- call PrintText
- ld hl, .NoYes_MenuDataHeader
- call CopyMenuDataHeader
- call VerticalMenu
- ret c
- ld a, [wMenuCursorY]
- cp $1
- ret z
- call ClockResetPassword
- jr c, .wrongpassword
- ld a, BANK(sRTCStatusFlags)
- call GetSRAMBank
- ld a, $80
- ld [sRTCStatusFlags], a
- call CloseSRAM
- ld hl, .text_okay
- call PrintText
- ret
+INCLUDE "engine/delete_save_change_clock.asm"
-.wrongpassword
- ld hl, .text_wrong
- call PrintText
- ret
-
-.text_okay ; 0x4d3fe
- ; Password OK. Select CONTINUE & reset settings.
- text_jump UnknownText_0x1c55db
- db "@"
-
-.text_wrong ; 0x4d403
- ; Wrong password!
- text_jump UnknownText_0x1c560b
- db "@"
-
-.text_askreset ; 0x4d408
- ; Reset the clock?
- text_jump UnknownText_0x1c561c
- db "@"
-
-.NoYes_MenuDataHeader: ; 0x4d40d
- db $00 ; flags
- db 07, 14 ; start coords
- db 11, 19 ; end coords
- dw .NoYes_MenuData2
- db 1 ; default option
-
-.NoYes_MenuData2: ; 0x4d415
- db $c0 ; flags
- db 2 ; items
- db "NO@"
- db "YES@"
-
-ClockResetPassword: ; 4d41e
- call .CalculatePassword
- push de
- ld hl, StringBuffer2
- ld bc, 5
- xor a
- call ByteFill
- ld a, $4
- ld [StringBuffer2 + 5], a
- ld hl, .pleaseenterpasswordtext
- call PrintText
-.loop
- call .updateIDdisplay
-.loop2
- call JoyTextDelay
- ld a, [hJoyLast]
- ld b, a
- and A_BUTTON
- jr nz, .confirm
- ld a, b
- and D_PAD
- jr z, .loop2
- call .dpadinput
- ld c, 3
- call DelayFrames
- jr .loop
-
-.confirm
- call .ConvertDecIDToBytes
- pop de
- ld a, e
- cp l
- jr nz, .nope
- ld a, d
- cp h
- jr nz, .nope
- and a
- ret
-
-.nope
- scf
- ret
-
-.pleaseenterpasswordtext ; 0x4d463
- ; Please enter the password.
- text_jump UnknownText_0x1c562e
- db "@"
-
-.updateIDdisplay ; 4d468
- hlcoord 14, 15
- ld de, StringBuffer2
- ld c, 5
-.loop3
- ld a, [de]
- add "0"
- ld [hli], a
- inc de
- dec c
- jr nz, .loop3
- hlcoord 14, 16
- ld bc, 5
- ld a, " "
- call ByteFill
- hlcoord 14, 16
- ld a, [StringBuffer2 + 5]
- ld e, a
- ld d, $0
- add hl, de
- ld [hl], $61
- ret
-
-.dpadinput ; 4d490
- ld a, b
- and D_LEFT
- jr nz, .left
- ld a, b
- and D_RIGHT
- jr nz, .right
- ld a, b
- and D_UP
- jr nz, .up
- ld a, b
- and D_DOWN
- jr nz, .down
- ret
-
-.left
- ld a, [StringBuffer2 + 5]
- and a
- ret z
- dec a
- ld [StringBuffer2 + 5], a
- ret
-
-.right
- ld a, [StringBuffer2 + 5]
- cp $4
- ret z
- inc a
- ld [StringBuffer2 + 5], a
- ret
-
-.up
- call .getcurrentdigit
- ld a, [hl]
- cp 9
- jr z, .wraparound_up
- inc a
- ld [hl], a
- ret
-
-.wraparound_up
- ld [hl], $0
- ret
-
-.down
- call .getcurrentdigit
- ld a, [hl]
- and a
- jr z, .wraparound_down
- dec a
- ld [hl], a
- ret
-
-.wraparound_down
- ld [hl], 9
- ret
-
-.getcurrentdigit ; 4d4d5
- ld a, [StringBuffer2 + 5]
- ld e, a
- ld d, $0
- ld hl, StringBuffer2
- add hl, de
- ret
-
-.ConvertDecIDToBytes: ; 4d4e0
- ld hl, 0
- ld de, StringBuffer2 + 4
- ld bc, 1
- call .ConvertToBytes
- ld bc, 10
- call .ConvertToBytes
- ld bc, 100
- call .ConvertToBytes
- ld bc, 1000
- call .ConvertToBytes
- ld bc, 10000
-.ConvertToBytes: ; 4d501
- ld a, [de]
- dec de
- push hl
- ld hl, 0
- call AddNTimes
- ld c, l
- ld b, h
- pop hl
- add hl, bc
- ret
-
-.CalculatePassword: ; 4d50f
- ld a, BANK(sPlayerData)
- call GetSRAMBank
- ld de, 0
- ld hl, sPlayerData + (PlayerID - wPlayerData)
- ld c, $2
- call .ComponentFromNumber
- ld hl, sPlayerData + (PlayerName - wPlayerData)
- ld c, $5 ; PLAYER_NAME_LENGTH_J
- call .ComponentFromString
- ld hl, sPlayerData + (Money - wPlayerData)
- ld c, $3
- call .ComponentFromNumber
- call CloseSRAM
- ret
-
-.ComponentFromNumber: ; 4d533
- ld a, [hli]
- add e
- ld e, a
- ld a, $0
- adc d
- ld d, a
- dec c
- jr nz, .ComponentFromNumber
- ret
-
-.ComponentFromString: ; 4d53e
- ld a, [hli]
- cp "@"
- ret z
- add e
- ld e, a
- ld a, $0
- adc d
- ld d, a
- dec c
- jr nz, .ComponentFromString
- ret
-
-_DeleteSaveData: ; 4d54c
- callba BlankScreen
- ld b, SCGB_08
- call GetSGBLayout
- call LoadStandardFont
- call LoadFontsExtra
- ld de, MUSIC_MAIN_MENU
- call PlayMusic
- ld hl, .Text_ClearAllSaveData
- call PrintText
- ld hl, .NoYesMenuDataHeader
- call CopyMenuDataHeader
- call VerticalMenu
- ret c
- ld a, [wMenuCursorY]
- cp $1
- ret z
- callba EmptyAllSRAMBanks
- ret
-
-.Text_ClearAllSaveData: ; 0x4d580
- ; Clear all save data?
- text_jump UnknownText_0x1c564a
- db "@"
-
-.NoYesMenuDataHeader: ; 0x4d585
- db $00 ; flags
- db 07, 14 ; start coords
- db 11, 19 ; end coords
- dw .MenuData2
- db 1 ; default option
-
-.MenuData2: ; 0x4d58d
- db $c0 ; flags
- db 2 ; items
- db "NO@"
- db "YES@"
-
Tilesets::
INCLUDE "tilesets/tileset_headers.asm"
@@ -3209,7 +2679,7 @@
ld a, [wOTTrademonSpecies]
call IsAPokemon
ret c
- callba Function29549
+ callba ShowOTTrademonStats
ld a, [wOTTrademonSpecies]
ld [CurPartySpecies], a
ld a, [wOTTrademonDVs]
@@ -3216,7 +2686,7 @@
ld [TempMonDVs], a
ld a, [wOTTrademonDVs + 1]
ld [TempMonDVs + 1], a
- ld b, SCGB_1A
+ ld b, SCGB_PLAYER_OR_MON_FRONTPIC_PALS
call GetSGBLayout
ld a, %11100100 ; 3,2,1,0
call DmgToCgbBGPals
@@ -3312,9 +2782,9 @@
jr z, .SkipBox
ld hl, .BoxBankAddresses
ld b, 0
-rept 3
add hl, bc
-endr
+ add hl, bc
+ add hl, bc
ld a, [hli]
call GetSRAMBank
ld a, [hli]
@@ -3587,7 +3057,7 @@
ld de, wBufferMonOT
ld bc, NAME_LENGTH
call CopyBytes
- callab Function51322
+ callab InsertPokemonIntoBox
ld a, [CurPartySpecies]
ld [wd265], a
call GetPokemonName
@@ -3730,141 +3200,7 @@
ld [CurPartyLevel], a
ret
-_FindGreaterThanThatLevel: ; 4dbd2
- ld hl, PartyMon1Level
- call FindGreaterThanThatLevel
- ret
-
-_FindAtLeastThatHappy: ; 4dbd9
- ld hl, PartyMon1Happiness
- call FindAtLeastThatHappy
- ret
-
-_FindThatSpecies: ; 4dbe0
- ld hl, PartyMon1Species
- jp FindThatSpecies
-
-_FindThatSpeciesYourTrainerID: ; 4dbe6
- ld hl, PartyMon1Species
- call FindThatSpecies
- ret z
- ld a, c
- ld hl, PartyMon1ID
- ld bc, PARTYMON_STRUCT_LENGTH
- call AddNTimes
- ld a, [PlayerID]
- cp [hl]
- jr nz, .nope
- inc hl
- ld a, [PlayerID + 1]
- cp [hl]
- jr nz, .nope
- ld a, $1
- and a
- ret
-
-.nope
- xor a
- ret
-
-FindAtLeastThatHappy: ; 4dc0a
-; Sets the bits for the Pokemon that have a happiness greater than or equal to b.
-; The lowest bits are used. Sets z if no Pokemon in your party is at least that happy.
- ld c, $0
- ld a, [PartyCount]
- ld d, a
-.loop
- ld a, d
- dec a
- push hl
- push bc
- ld bc, PARTYMON_STRUCT_LENGTH
- call AddNTimes
- pop bc
- ld a, b
- cp [hl]
- pop hl
- jr z, .greater_equal
- jr nc, .lower
-
-.greater_equal
- ld a, c
- or $1
- ld c, a
-
-.lower
- sla c
- dec d
- jr nz, .loop
- call RetroactivelyIgnoreEggs
- ld a, c
- and a
- ret
-
-FindGreaterThanThatLevel: ; 4dc31
- ld c, $0
- ld a, [PartyCount]
- ld d, a
-.loop
- ld a, d
- dec a
- push hl
- push bc
- ld bc, PARTYMON_STRUCT_LENGTH
- call AddNTimes
- pop bc
- ld a, b
- cp [hl]
- pop hl
- jr c, .greater
- ld a, c
- or $1
- ld c, a
-
-.greater
- sla c
- dec d
- jr nz, .loop
- call RetroactivelyIgnoreEggs
- ld a, c
- and a
- ret
-
-FindThatSpecies: ; 4dc56
-; Find species b in your party.
-; If you have no Pokemon, returns c = -1 and z.
-; If that species is in your party, returns its location in c, and nz.
-; Otherwise, returns z.
- ld c, -1
- ld hl, PartySpecies
-.loop
- ld a, [hli]
- cp -1
- ret z
- inc c
- cp b
- jr nz, .loop
- ld a, $1
- and a
- ret
-
-RetroactivelyIgnoreEggs: ; 4dc67
- ld e, -2
- ld hl, PartySpecies
-.loop
- ld a, [hli]
- cp -1
- ret z
- cp EGG
- jr nz, .skip_notegg
- ld a, c
- and e
- ld c, a
-
-.skip_notegg
- rlc e
- jr .loop
-
+INCLUDE "engine/search2.asm"
INCLUDE "engine/stats_screen.asm"
CatchTutorial:: ; 4e554
@@ -3951,7 +3287,7 @@
INCLUDE "engine/evolution_animation.asm"
-Function4e881: ; 4e881
+InitDisplayForHallOfFame: ; 4e881
call ClearBGPalettes
call ClearTileMap
call ClearSprites
@@ -3981,7 +3317,7 @@
text_jump UnknownText_0x1bd39e
db "@"
-Function4e8c2: ; 4e8c2
+InitDisplayForRedCredits: ; 4e8c2
call ClearBGPalettes
call ClearTileMap
call ClearSprites
@@ -3997,7 +3333,7 @@
xor a
call ByteFill
ld hl, wd000 ; UnknBGPals
- ld c, 4 * $10
+ ld c, 4 tiles
.load_white_palettes
ld a, (palred 31 + palgreen 31 + palblue 31) % $100
ld [hli], a
@@ -4013,32 +3349,32 @@
call SetPalettes
ret
-Function4e906: ; 4e906
+ResetDisplayBetweenHallOfFameMons: ; 4e906
ld a, [rSVBK]
push af
ld a, $6
ld [rSVBK], a
ld hl, wDecompressScratch
- ld bc, wBackupAttrMap - wDecompressScratch
+ ld bc, wScratchAttrMap - wDecompressScratch
ld a, " "
call ByteFill
hlbgcoord 0, 0
ld de, wDecompressScratch
- ld b, $0
- ld c, $40
+ ld b, 0
+ ld c, 4 tiles
call Request2bpp
pop af
ld [rSVBK], a
ret
-Function4e929: ; mobile function
+GetMobileOTTrainerClass: ; mobile function
ld h, b
ld l, c
- call Function4e930
+ call .GetMobileOTTrainerClass
ld c, a
ret
-Function4e930: ; 4e930
+.GetMobileOTTrainerClass: ; 4e930
ld a, [hli]
xor [hl]
ld c, a
@@ -4119,7 +3455,7 @@
INCLUDE "battle/sliding_intro.asm"
-Function4ea0a: ; 4ea0a
+Mobile_PrintOpponentBattleMessage: ; 4ea0a
ld a, c
push af
call SpeechTextBox
@@ -4127,11 +3463,11 @@
pop af
dec a
ld bc, $c
- ld hl, w5_dc1a
+ ld hl, w5_MobileOpponentBattleMessages
call AddNTimes
- ld de, wcd53
+ ld de, wMobileOpponentBattleMessage
ld bc, $c
- ld a, $5 ; BANK(w5_dc1a)
+ ld a, $5 ; BANK(w5_MobileOpponentBattleMessages)
call FarCopyWRAM
ld a, [rSVBK]
@@ -4139,9 +3475,9 @@
ld a, $1
ld [rSVBK], a
- ld bc, wcd53
+ ld bc, wMobileOpponentBattleMessage
decoord 1, 14
- callba Function11c0c6
+ callba PrintEZChatBattleMessage
pop af
ld [rSVBK], a
@@ -4169,7 +3505,7 @@
.mobile
ld a, [wcd2f]
and a
- jr nz, .asm_4ea72
+ jr nz, .from_wram
ld a, $4
call GetSRAMBank
@@ -4184,7 +3520,7 @@
and a
ret
-.asm_4ea72
+.from_wram
ld a, $5
ld hl, w5_dc00
call GetFarWRAMByte
@@ -4307,7 +3643,7 @@
jr z, .otpartymon
cp BOXMON
jr z, .boxmon
- cp BREEDMON
+ cp TEMPMON
jr z, .breedmon
; WILDMON
@@ -4343,7 +3679,8 @@
INCLUDE "text/types.asm"
Function50a28: ; 50a28
- ld hl, Strings50a42
+; XXX
+ ld hl, .Strings
ld a, [TrainerClass]
dec a
ld c, a
@@ -4362,7 +3699,7 @@
jr nz, .copy
ret
-Strings50a42: ; 50a42
+.Strings: ; 50a42
; Untranslated trainer class names from Red.
dw .Youngster
dw .BugCatcher
@@ -4445,9 +3782,10 @@
ld [wWhichHPBar], a
push hl
push bc
+ ; box mons have full HP
ld a, [MonType]
cp BOXMON
- jr z, .asm_50b30
+ jr z, .at_least_1_hp
ld a, [TempMonHP]
ld b, a
@@ -4456,7 +3794,7 @@
; Any HP?
or b
- jr nz, .asm_50b30
+ jr nz, .at_least_1_hp
xor a
ld c, a
@@ -4463,9 +3801,9 @@
ld e, a
ld a, 6
ld d, a
- jp .asm_50b4a
+ jp .fainted
-.asm_50b30
+.at_least_1_hp
ld a, [TempMonMaxHP]
ld d, a
ld a, [TempMonMaxHP + 1]
@@ -4472,18 +3810,18 @@
ld e, a
ld a, [MonType]
cp BOXMON
- jr nz, .asm_50b41
+ jr nz, .not_boxmon
ld b, d
ld c, e
-.asm_50b41
+.not_boxmon
predef ComputeHPBarPixels
ld a, 6
ld d, a
ld c, a
-.asm_50b4a
+.fainted
ld a, c
pop bc
ld c, a
@@ -4495,14 +3833,14 @@
pop hl
; Print HP
- ld bc, $15 ; move (1,1)
+ bccoord 1, 1, 0
add hl, bc
ld de, TempMonHP
ld a, [MonType]
cp BOXMON
- jr nz, .asm_50b66
+ jr nz, .not_boxmon_2
ld de, TempMonMaxHP
-.asm_50b66
+.not_boxmon_2
lb bc, 2, 3
call PrintNum
@@ -4692,9 +4030,9 @@
.skip
pop hl
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
ld d, h
ld e, l
ld hl, TempMonMoves
@@ -4760,7 +4098,8 @@
ret
Function50cd0: ; 50cd0
-.asm_50cd0
+; XXX
+.loop
ld [hl], $32
inc hl
ld [hl], $3e
@@ -4767,10 +4106,10 @@
dec hl
add hl, de
dec c
- jr nz, .asm_50cd0
+ jr nz, .loop
ret
-Function50cdb: ; unreferenced predef
+Predef22: ; unreferenced predef
push hl
push hl
ld hl, PartyMonNicknames
@@ -4782,7 +4121,7 @@
pop hl
ld a, [CurPartySpecies]
cp EGG
- jr z, .asm_50d09
+ jr z, .egg
push hl
ld bc, -12
add hl, bc
@@ -4795,7 +4134,7 @@
call PrintLevel
pop de
-.asm_50d09
+.egg
ret
PlaceStatusString: ; 50d0a
@@ -4919,60 +4258,59 @@
.done
ret
-Function50db9: ; 50db9
- ld a, [wd263]
+InitList: ; 50db9
+ ld a, [wInitListType]
- cp $1
+ cp INIT_ENEMYOT_LIST
jr nz, .check_party_ot_name
ld hl, OTPartyCount
ld de, OTPartyMonOT
ld a, ENEMY_OT_NAME
jr .done
-.check_party_ot_name
- cp $4
+.check_party_ot_name
+ cp INIT_PLAYEROT_LIST
jr nz, .check_mon_name
ld hl, PartyCount
ld de, PartyMonOT
ld a, PARTY_OT_NAME
jr .done
-.check_mon_name
- cp $5
+.check_mon_name
+ cp INIT_MON_LIST
jr nz, .check_item_name
ld hl, CurMart
ld de, PokemonNames
ld a, PKMN_NAME
jr .done
-.check_item_name
- cp $2
+.check_item_name
+ cp INIT_BAG_ITEM_LIST
jr nz, .check_ob_item_name
ld hl, NumItems
ld de, ItemNames
ld a, ITEM_NAME
jr .done
-.check_ob_item_name
+.check_ob_item_name
ld hl, CurMart
ld de, ItemNames
ld a, ITEM_NAME
-
.done
- ld [wNamedObjectTypeBuffer], a
+ ld [wNamedObjectTypeBuffer], a ; d265
ld a, l
- ld [wd100], a
+ ld [wListPointer], a
ld a, h
- ld [wd101], a
+ ld [wListPointer + 1], a
ld a, e
- ld [wd102], a
+ ld [wUnusedD102], a
ld a, d
- ld [wd103], a
- ld bc, ItemAttributes
+ ld [wUnusedD102 + 1], a
+ ld bc, ItemAttributes ; ParseEnemyAction, HandleMapTimeAndJoypad, Music_LakeOfRage_Ch3, String_11a7c1 $67c1
ld a, c
- ld [wd104], a
+ ld [wItemAttributesPtr], a
ld a, b
- ld [wd105], a
+ ld [wItemAttributesPtr + 1], a
ret
CalcLevel: ; 50e1b
@@ -5303,141 +4641,7 @@
ret
INCLUDE "gfx/load_pics.asm"
-
-Function51322: ; 51322
- ld a, BANK(sBoxCount)
- call GetSRAMBank
- ld hl, sBoxCount
- call Function513cb
- ld a, [sBoxCount]
- dec a
- ld [wd265], a
- ld hl, sBoxMonNicknames
- ld bc, PKMN_NAME_LENGTH
- ld de, wBufferMonNick
- call Function513e0
- ld a, [sBoxCount]
- dec a
- ld [wd265], a
- ld hl, sBoxMonOT
- ld bc, NAME_LENGTH
- ld de, wBufferMonOT
- call Function513e0
- ld a, [sBoxCount]
- dec a
- ld [wd265], a
- ld hl, sBoxMons
- ld bc, BOXMON_STRUCT_LENGTH
- ld de, wBufferMon
- call Function513e0
- ld hl, wBufferMonMoves
- ld de, TempMonMoves
- ld bc, NUM_MOVES
- call CopyBytes
- ld hl, wBufferMonPP
- ld de, TempMonPP
- ld bc, NUM_MOVES
- call CopyBytes
- ld a, [CurPartyMon]
- ld b, a
- callba Functiondcb6
- jp CloseSRAM
-
-Function5138b: ; 5138b
- ld hl, PartyCount
- call Function513cb
- ld a, [PartyCount]
- dec a
- ld [wd265], a
- ld hl, PartyMonNicknames
- ld bc, PKMN_NAME_LENGTH
- ld de, wBufferMonNick
- call Function513e0
- ld a, [PartyCount]
- dec a
- ld [wd265], a
- ld hl, PartyMonOT
- ld bc, NAME_LENGTH
- ld de, wBufferMonOT
- call Function513e0
- ld a, [PartyCount]
- dec a
- ld [wd265], a
- ld hl, PartyMons
- ld bc, PARTYMON_STRUCT_LENGTH
- ld de, wBufferMon
- call Function513e0
- ret
-
-Function513cb: ; 513cb
- inc [hl]
- inc hl
- ld a, [CurPartyMon]
- ld c, a
- ld b, 0
- add hl, bc
- ld a, [CurPartySpecies]
- ld c, a
-.asm_513d8
- ld a, [hl]
- ld [hl], c
- inc hl
- inc c
- ld c, a
- jr nz, .asm_513d8
- ret
-
-Function513e0: ; 513e0
- push de
- push hl
- push bc
- ld a, [wd265]
- dec a
- call AddNTimes
- push hl
- add hl, bc
- ld d, h
- ld e, l
- pop hl
-.asm_513ef
- push bc
- ld a, [wd265]
- ld b, a
- ld a, [CurPartyMon]
- cp b
- pop bc
- jr z, .asm_51415
- push hl
- push de
- push bc
- call CopyBytes
- pop bc
- pop de
- pop hl
- push hl
- ld a, l
- sub c
- ld l, a
- ld a, h
- sbc b
- ld h, a
- pop de
- ld a, [wd265]
- dec a
- ld [wd265], a
- jr .asm_513ef
-
-.asm_51415
- pop bc
- pop hl
- ld a, [CurPartyMon]
- call AddNTimes
- ld d, h
- ld e, l
- pop hl
- call CopyBytes
- ret
-
+INCLUDE "engine/move_mon_wo_mail.asm"
BaseData::
INCLUDE "data/base_stats.asm"
@@ -5492,6 +4696,7 @@
INCLUDE "event/kurt.asm"
Function88248: ; 88248
+; XXX
ld c, CAL
ld a, [PlayerGender]
bit 0, a
@@ -5773,7 +4978,8 @@
INCLUDE "engine/timeofdaypals.asm"
INCLUDE "engine/battle_start.asm"
-Function8c7c9: ; unreferenced
+Function8c7c9:
+; XXX
ld a, $1
ld [hBGMapMode], a
call WaitBGMap
@@ -5895,7 +5101,7 @@
ld a, [hCGB]
and a
ret nz
- ret
+ ret ; ????
.LoadPals: ; cbce5
ld a, [hCGB]
@@ -5904,9 +5110,9 @@
ld a, [TimeOfDayPal]
and $3
cp $3
- ld a, $0
+ ld a, %00000000
jr z, .convert_pals
- ld a, $aa
+ ld a, %10101010
.convert_pals
call DmgToCgbBGPals
@@ -5923,10 +5129,10 @@
ld hl, BGPals
ld c, $20
.loop
-; RGB 31, 21, 28
- ld a, (palred 31 + palgreen 21 + palblue 28) % $100
+; RGB 28, 21, 31
+ ld a, (palred 28 + palgreen 21 + palblue 31) % $100
ld [hli], a
- ld a, (palred 31 + palgreen 21 + palblue 28) / $100
+ ld a, (palred 28 + palgreen 21 + palblue 31) / $100
ld [hli], a
dec c
jr nz, .loop
@@ -6021,7 +5227,7 @@
ld [Options], a
call WaitBGMap
- ld b, SCGB_08
+ ld b, SCGB_DIPLOMA
call GetSGBLayout
call SetPalettes
ret
@@ -6118,7 +5324,7 @@
SECTION "bank38", ROMX, BANK[$38]
-Functione0000: ; e0000
+RotateUnownFrontpic: ; e0000
; something to do with Unown printer
push de
xor a
@@ -6131,8 +5337,8 @@
push bc
ld de, wd002
call .Copy
- call .Decompress
- ld hl, Unknown_e008b
+ call .Rotate
+ ld hl, UnownPrinter_OverworldMapRectangle
pop bc
add hl, bc
add hl, bc
@@ -6147,16 +5353,16 @@
pop bc
inc c
ld a, c
- cp $31
+ cp 7 * 7
jr c, .loop
ld hl, OverworldMap
ld de, sScratch
- ld bc, $31 tiles
+ ld bc, 7 * 7 tiles
call CopyBytes
pop hl
ld de, sScratch
- ld c, $31
+ ld c, 7 * 7
ld a, [hROMBank]
ld b, a
call Get2bpp
@@ -6173,7 +5379,7 @@
jr nz, .loop_copy
ret
-.Decompress: ; e0057
+.Rotate: ; e0057
ld hl, wd012
ld e, %10000000
ld d, 8
@@ -6215,13 +5421,12 @@
jr nz, .loop_count
ret
-overworldmaptile EQUS "dw OverworldMap + $10 *"
overworldmaprect: MACRO
y = 0
rept \1
x = \1 * (\2 +- 1) + y
rept \2
- overworldmaptile x
+ dw OverworldMap tile x
x = x +- \2
endr
y = y + 1
@@ -6228,7 +5433,7 @@
endr
endm
-Unknown_e008b: ; e008b
+UnownPrinter_OverworldMapRectangle: ; e008b
overworldmaprect 7, 7
Unknown_e00ed:
@@ -6388,6 +5593,7 @@
SECTION "bank77_2", ROMX, BANK[$77]
Function1dd6a9: ; 1dd6a9
+; XXX
ld a, b
ld b, c
ld c, a
@@ -6454,19 +5660,19 @@
INCLUDE "engine/diploma.asm"
LoadSGBPokedexGFX: ; 1ddf1c
- ld hl, LZ_1ddf33
+ ld hl, SGBPokedexGFX_LZ
ld de, VTiles2 tile $31
call Decompress
ret
-Function1ddf26: ; 1ddf26 (77:5f26)
- ld hl, LZ_1ddf33
+LoadSGBPokedexGFX2: ; 1ddf26 (77:5f26)
+ ld hl, SGBPokedexGFX_LZ
ld de, VTiles2 tile $31
- lb bc, BANK(LZ_1ddf33), $3a
+ lb bc, BANK(SGBPokedexGFX_LZ), $3a
call DecompressRequest2bpp
ret
-LZ_1ddf33: ; 1ddf33
+SGBPokedexGFX_LZ: ; 1ddf33
INCBIN "gfx/pokedex/sgb.2bpp.lz"
LoadQuestionMarkPic: ; 1de0d7
@@ -6568,7 +5774,8 @@
.esults_D ; 1de23c
; (SEARCH R)
- db "ESULTS<NEXT>"
+ db "ESULTS"
+ next ""
; (### FOUN)
next "D!@"
@@ -6659,7 +5866,7 @@
db A_BUTTON, $00
db NO_INPUT, $ff ; end
-Function1de2c5: ; 1de2c5
+TownMap_ConvertLineBreakCharacters: ; 1de2c5
ld hl, StringBuffer1
.loop
ld a, [hl]
@@ -6831,9 +6038,10 @@
db $cc, $6b, $1e ; XXX
Function1f4003: ; 1f4003
+; XXX
ld a, $6
call GetSRAMBank
- ld hl, Unknown_1f4018
+ ld hl, .unknown_data
ld de, $a000
ld bc, $1000
call CopyBytes
@@ -6840,13 +6048,14 @@
call CloseSRAM
ret
-Unknown_1f4018:
+.unknown_data
INCBIN "unknown/1f4018.bin"
Function1f4dbe: ; 1f4dbe
+; XXX
ld a, $6
call GetSRAMBank
- ld hl, Unknown_1f4dd3
+ ld hl, .unknown_data
ld de, $a000
ld bc, $1000
call CopyBytes
@@ -6853,13 +6062,13 @@
call CloseSRAM
ret
-Unknown_1f4dd3:
+.unknown_data
INCBIN "unknown/1f4dd3.bin"
Function1f5d9f: ; 1f5d9f
ld a, $6
call GetSRAMBank
- ld hl, Unknown_1f5db4
+ ld hl, .unknown_data
ld de, $a000
ld bc, $1000
call CopyBytes
@@ -6866,7 +6075,7 @@
call CloseSRAM
ret
-Unknown_1f5db4:
+.unknown_data
INCBIN "unknown/1f5db4.bin"
SECTION "bank7E", ROMX, BANK[$7E]
--- a/maps/AzaleaTown.asm
+++ b/maps/AzaleaTown.asm
@@ -219,36 +219,36 @@
AzaleaTownRivalBattleApproachMovement1:
- step_left
- step_left
- step_left
- step_left
- step_left
- step_left
- turn_head_up
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ turn_head UP
step_end
AzaleaTownRivalBattleApproachMovement2:
- step_left
- step_left
- step_left
- step_left
- step_left
- step_left
- turn_head_down
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ turn_head DOWN
step_end
AzaleaTownRivalBattleExitMovement:
- step_left
- step_left
- step_left
+ step LEFT
+ step LEFT
+ step LEFT
step_end
Movement_PlayerWalksOutOfKurtsHouse:
- step_left
- step_left
- step_up
- turn_head_left
+ step LEFT
+ step LEFT
+ step UP
+ turn_head LEFT
step_end
AzaleaTownRivalBeforeText:
--- a/maps/BattleTower1F.asm
+++ b/maps/BattleTower1F.asm
@@ -168,7 +168,6 @@
closetext
end
-
UnreferencedScript_0x9e4be:
writetext Text_SaveBeforeEnteringBattleRoom
yesorno
@@ -268,87 +267,87 @@
jumptextfaceplayer Text_BattleTowerGranny
MovementData_BattleTower1FWalkToElevator:
- step_up
- step_up
- step_up
- step_up
- step_up
+ step UP
+ step UP
+ step UP
+ step UP
+ step UP
MovementData_BattleTowerHallwayPlayerEntersBattleRoom:
- step_up
+ step UP
step_end
MovementData_BattleTowerElevatorExitElevator:
- step_down
+ step DOWN
step_end
MovementData_BattleTowerHallwayWalkTo1020Room:
- step_right
- step_right
+ step RIGHT
+ step RIGHT
MovementData_BattleTowerHallwayWalkTo3040Room:
- step_right
- step_right
- step_up
- step_right
- turn_head_left
+ step RIGHT
+ step RIGHT
+ step UP
+ step RIGHT
+ turn_head LEFT
step_end
MovementData_BattleTowerHallwayWalkTo90100Room:
- step_left
- step_left
+ step LEFT
+ step LEFT
MovementData_BattleTowerHallwayWalkTo7080Room:
- step_left
- step_left
+ step LEFT
+ step LEFT
MovementData_BattleTowerHallwayWalkTo5060Room:
- step_left
- step_left
- step_up
- step_left
- turn_head_right
+ step LEFT
+ step LEFT
+ step UP
+ step LEFT
+ turn_head RIGHT
step_end
MovementData_BattleTowerBattleRoomPlayerWalksIn:
- step_up
- step_up
- step_up
- step_up
- turn_head_right
+ step UP
+ step UP
+ step UP
+ step UP
+ turn_head RIGHT
step_end
MovementData_BattleTowerBattleRoomOpponentWalksIn:
- slow_step_down
- slow_step_down
- slow_step_down
- turn_head_left
+ slow_step DOWN
+ slow_step DOWN
+ slow_step DOWN
+ turn_head LEFT
step_end
MovementData_BattleTowerBattleRoomOpponentWalksOut:
- turn_head_up
- slow_step_up
- slow_step_up
- slow_step_up
+ turn_head UP
+ slow_step UP
+ slow_step UP
+ slow_step UP
step_end
MovementData_BattleTowerBattleRoomReceptionistWalksToPlayer:
- slow_step_right
- slow_step_right
- slow_step_up
- slow_step_up
+ slow_step RIGHT
+ slow_step RIGHT
+ slow_step UP
+ slow_step UP
step_end
MovementData_BattleTowerBattleRoomReceptionistWalksAway:
- slow_step_down
- slow_step_down
- slow_step_left
- slow_step_left
- turn_head_right
+ slow_step DOWN
+ slow_step DOWN
+ slow_step LEFT
+ slow_step LEFT
+ turn_head RIGHT
step_end
MovementData_BattleTowerBattleRoomPlayerTurnsToFaceReceptionist:
- turn_head_down
+ turn_head DOWN
step_end
MovementData_BattleTowerBattleRoomPlayerTurnsToFaceNextOpponent:
- turn_head_right
+ turn_head RIGHT
step_end
Text_BattleTowerWelcomesYou: ; 0x9e5ab
--- a/maps/BattleTowerElevator.asm
+++ b/maps/BattleTowerElevator.asm
@@ -38,12 +38,12 @@
end
MovementData_BattleTowerElevatorReceptionistWalksIn:
- step_right
- turn_head_down
+ step RIGHT
+ turn_head DOWN
step_end
MovementData_BattleTowerElevatorPlayerWalksIn:
- turn_head_down
+ turn_head DOWN
step_end
BattleTowerElevator_MapEventHeader:
--- a/maps/BrunosRoom.asm
+++ b/maps/BrunosRoom.asm
@@ -79,10 +79,10 @@
end
MovementData_0x1809f9:
- step_up
- step_up
- step_up
- step_up
+ step UP
+ step UP
+ step UP
+ step UP
step_end
UnknownText_0x1809fe:
--- a/maps/BurnedTower1F.asm
+++ b/maps/BurnedTower1F.asm
@@ -147,11 +147,11 @@
itemball HP_UP
BurnedTowerMovement_PlayerWalksToSilver:
- step_left
+ step LEFT
step_end
BurnedTowerMovement_SilverWalksToPlayer:
- step_right
+ step RIGHT
step_end
BurnedTower1FMovement_PlayerStartsToFall:
@@ -159,11 +159,11 @@
step_end
BurnedTower1FEusineMovement:
- step_down
- step_left
- step_left
- step_left
- step_down
+ step DOWN
+ step LEFT
+ step LEFT
+ step LEFT
+ step DOWN
step_end
BurnedTowerSilver_BeforeText:
--- a/maps/BurnedTowerB1F.asm
+++ b/maps/BurnedTowerB1F.asm
@@ -131,70 +131,70 @@
BurnedTowerRaikouMovement:
set_sliding
- fast_jump_step_down
- fast_jump_step_left
+ fast_jump_step DOWN
+ fast_jump_step LEFT
remove_sliding
step_end
BurnedTowerEnteiMovement:
set_sliding
- fast_jump_step_right
- fast_jump_step_down
- fast_jump_step_right
+ fast_jump_step RIGHT
+ fast_jump_step DOWN
+ fast_jump_step RIGHT
remove_sliding
step_end
BurnedTowerSuicuneMovement1:
set_sliding
- fast_jump_step_right
- fast_jump_step_down
- fast_jump_step_down
- fast_jump_step_left
+ fast_jump_step RIGHT
+ fast_jump_step DOWN
+ fast_jump_step DOWN
+ fast_jump_step LEFT
remove_sliding
step_end
BurnedTowerSuicuneMovement2:
set_sliding
- fast_jump_step_left
- fast_jump_step_up
- big_step_up
- fast_jump_step_right
+ fast_jump_step LEFT
+ fast_jump_step UP
+ big_step UP
+ fast_jump_step RIGHT
remove_sliding
step_end
MovementData_0x18624f:
set_sliding
- big_step_down
+ big_step DOWN
remove_sliding
step_end
BurnedTowerSuicuneMovement3:
set_sliding
- big_step_up
- fast_jump_step_right
- fast_jump_step_down
- fast_jump_step_down
- fast_jump_step_down
- fast_jump_step_down
+ big_step UP
+ fast_jump_step RIGHT
+ fast_jump_step DOWN
+ fast_jump_step DOWN
+ fast_jump_step DOWN
+ fast_jump_step DOWN
remove_sliding
step_end
BurnedTowerB1FEusineMovement2:
- step_left
- step_left
- step_down
- step_down
- step_left
- step_down
+ step LEFT
+ step LEFT
+ step DOWN
+ step DOWN
+ step LEFT
+ step DOWN
step_end
BurnedTowerB1FEusineMovement1:
- step_down
- step_left
- step_left
- step_left
- step_down
- step_down
+ step DOWN
+ step LEFT
+ step LEFT
+ step LEFT
+ step DOWN
+ step DOWN
step_end
BurnedTowerB1FEusineText:
--- a/maps/CeladonGameCorner.asm
+++ b/maps/CeladonGameCorner.asm
@@ -145,8 +145,8 @@
MovementData_0x721cd:
; Unreferenced.
- step_right
- turn_head_left
+ step RIGHT
+ turn_head LEFT
step_end
UnknownText_0x721d0:
--- a/maps/CeladonPokeCenter1F.asm
+++ b/maps/CeladonPokeCenter1F.asm
@@ -58,18 +58,18 @@
end
.Movement2:
- step_left
- step_down
- step_down
- step_down
- step_down
+ step LEFT
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
step_end
.Movement1:
- step_down
- step_down
- step_down
- step_down
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
step_end
UnknownText_0x71e70:
--- a/maps/CeruleanGym.asm
+++ b/maps/CeruleanGym.asm
@@ -167,36 +167,36 @@
jumpstd gymstatue2
MovementData_0x1884e3:
- big_step_down
- big_step_down
- big_step_down
- big_step_down
+ big_step DOWN
+ big_step DOWN
+ big_step DOWN
+ big_step DOWN
step_end
MovementData_0x1884e8:
- big_step_right
- big_step_down
+ big_step RIGHT
+ big_step DOWN
step_end
MovementData_0x1884eb:
fix_facing
db $39 ; movement
- jump_step_up
+ jump_step UP
db $38 ; movement
remove_fixed_facing
- step_sleep_8
- step_sleep_8
- step_down
- step_down
+ step_sleep 8
+ step_sleep 8
+ step DOWN
+ step DOWN
step_end
MovementData_0x1884f5:
- big_step_down
+ big_step DOWN
step_end
MovementData_0x1884f7:
fix_facing
- slow_step_up
+ slow_step UP
remove_fixed_facing
step_end
--- a/maps/CherrygroveCity.asm
+++ b/maps/CherrygroveCity.asm
@@ -242,101 +242,101 @@
jumpstd martsign
GuideGentMovement1:
- step_left
- step_left
- step_up
- step_left
- turn_head_up
+ step LEFT
+ step LEFT
+ step UP
+ step LEFT
+ turn_head UP
step_end
GuideGentMovement2:
- step_left
- step_left
- step_left
- step_left
- step_left
- step_left
- turn_head_up
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ turn_head UP
step_end
GuideGentMovement3:
- step_left
- step_left
- step_left
- step_left
- step_left
- step_left
- step_left
- turn_head_up
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ turn_head UP
step_end
GuideGentMovement4:
- step_left
- step_left
- step_left
- step_down
- step_left
- step_left
- step_left
- step_down
- turn_head_left
+ step LEFT
+ step LEFT
+ step LEFT
+ step DOWN
+ step LEFT
+ step LEFT
+ step LEFT
+ step DOWN
+ turn_head LEFT
step_end
GuideGentMovement5:
- step_down
- step_down
- step_right
- step_right
- step_right
- step_right
- step_right
- step_right
- step_right
- step_right
- step_right
- step_right
- step_down
- step_down
- step_right
- step_right
- step_right
- step_right
- step_right
- turn_head_up
+ step DOWN
+ step DOWN
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step DOWN
+ step DOWN
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ turn_head UP
step_end
GuideGentMovement6:
- step_up
- step_up
+ step UP
+ step UP
step_end
CherrygroveCity_RivalWalksToYou:
- step_left
- step_left
- step_left
- step_left
- step_left
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
step_end
CherrygroveCity_RivalPushesYouOutOfTheWay:
- big_step_down
- turn_head_up
+ big_step DOWN
+ turn_head UP
step_end
CherrygroveCity_UnusedMovementData:
- step_left
- turn_head_down
+ step LEFT
+ turn_head DOWN
step_end
CherrygroveCity_RivalExitsStageLeft:
- big_step_left
- big_step_left
- big_step_left
- big_step_left
- big_step_up
- big_step_up
- big_step_left
- big_step_left
+ big_step LEFT
+ big_step LEFT
+ big_step LEFT
+ big_step LEFT
+ big_step UP
+ big_step UP
+ big_step LEFT
+ big_step LEFT
step_end
GuideGentIntroText:
--- a/maps/CianwoodCity.asm
+++ b/maps/CianwoodCity.asm
@@ -156,33 +156,33 @@
MovementData_0x1a00da:
db $39 ; movement
- fast_jump_step_down
- fast_jump_step_down
- fast_jump_step_right
+ fast_jump_step DOWN
+ fast_jump_step DOWN
+ fast_jump_step RIGHT
db $38 ; movement
step_end
MovementData_0x1a00e0:
db $39 ; movement
- fast_jump_step_right
- fast_jump_step_up
- fast_jump_step_right
- fast_jump_step_right
+ fast_jump_step RIGHT
+ fast_jump_step UP
+ fast_jump_step RIGHT
+ fast_jump_step RIGHT
db $38 ; movement
step_end
MovementData_0x1a00e7:
- step_up
- step_up
- step_up
- step_up
+ step UP
+ step UP
+ step UP
+ step UP
step_end
MovementData_0x1a00ec:
- step_down
- step_down
- step_down
- step_down
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
step_end
UnknownText_0x1a00f1:
--- a/maps/CianwoodGym.asm
+++ b/maps/CianwoodGym.asm
@@ -143,9 +143,9 @@
CianwoodGymMovement_ChuckChucksBoulder:
set_sliding
- big_step_left
- big_step_up
- fast_jump_step_right
+ big_step LEFT
+ big_step UP
+ fast_jump_step RIGHT
remove_sliding
step_end
--- a/maps/CopycatsHouse2F.asm
+++ b/maps/CopycatsHouse2F.asm
@@ -1,10 +1,10 @@
const_value set 2
- const COPYCATSHOUSE2F_COPYCAT1
+ const COPYCATSHOUSE2F_COPYCAT1 ; if player is male
const COPYCATSHOUSE2F_DODRIO
- const COPYCATSHOUSE2F_FAIRYDOLL
+ const COPYCATSHOUSE2F_FAIRYDOLL ; lost item
const COPYCATSHOUSE2F_MONSTERDOLL
const COPYCATSHOUSE2F_BIRDDOLL
- const COPYCATSHOUSE2F_COPYCAT2
+ const COPYCATSHOUSE2F_COPYCAT2 ; if player is female
CopycatsHouse2F_MapScriptHeader:
.MapTriggers:
@@ -15,15 +15,15 @@
; callbacks
- dbw MAPCALLBACK_OBJECTS, CopycatsHouse2FCallback
+ dbw MAPCALLBACK_OBJECTS, .Callback
-CopycatsHouse2FCallback:
+.Callback:
checkflag ENGINE_PLAYER_IS_FEMALE
- iftrue .Part1
+ iftrue .Female
disappear COPYCATSHOUSE2F_COPYCAT2
appear COPYCATSHOUSE2F_COPYCAT1
jump .Done
-.Part1:
+.Female:
disappear COPYCATSHOUSE2F_COPYCAT1
appear COPYCATSHOUSE2F_COPYCAT2
.Done:
@@ -32,146 +32,146 @@
Copycat:
faceplayer
checkevent EVENT_GOT_PASS_FROM_COPYCAT
- iftrue .Part15
+ iftrue .GotPass
checkevent EVENT_RETURNED_LOST_ITEM_TO_COPYCAT
- iftrue .Part13
+ iftrue .TryGivePassAgain
checkitem LOST_ITEM
- iftrue .Part12
+ iftrue .ReturnLostItem
checkflag ENGINE_PLAYER_IS_FEMALE
- iftrue .Part1
- applymovement COPYCATSHOUSE2F_COPYCAT1, MovementData_0x18afd0
+ iftrue .Default_Female_1
+ applymovement COPYCATSHOUSE2F_COPYCAT1, CopycatSpinAroundMovementData
faceplayer
variablesprite SPRITE_COPYCAT, SPRITE_CHRIS
- jump .Part2
+ jump .Default_Merge_1
-.Part1:
- applymovement COPYCATSHOUSE2F_COPYCAT2, MovementData_0x18afd0
+.Default_Female_1:
+ applymovement COPYCATSHOUSE2F_COPYCAT2, CopycatSpinAroundMovementData
faceplayer
variablesprite SPRITE_COPYCAT, SPRITE_KRIS
-.Part2:
- special RunCallback_04
+.Default_Merge_1:
+ special MapCallbackSprites_LoadUsedSpritesGFX
checkevent EVENT_RETURNED_MACHINE_PART
- iftrue .Part7
+ iftrue .TalkAboutLostItem
opentext
checkflag ENGINE_PLAYER_IS_FEMALE
- iftrue .Part3
- writetext UnknownText_0x18afda
- jump .Part4
+ iftrue .Default_Female_2a
+ writetext CopycatText_Male_1
+ jump .Default_Merge_2a
-.Part3:
- writetext UnknownText_0x18b316
-.Part4:
+.Default_Female_2a:
+ writetext CopycatText_Female_1
+.Default_Merge_2a:
waitbutton
closetext
checkflag ENGINE_PLAYER_IS_FEMALE
- iftrue .Part5
- applymovement COPYCATSHOUSE2F_COPYCAT1, MovementData_0x18afd0
- jump .Part6
+ iftrue .Default_Female_3a
+ applymovement COPYCATSHOUSE2F_COPYCAT1, CopycatSpinAroundMovementData
+ jump .Default_Merge_3a
-.Part5:
- applymovement COPYCATSHOUSE2F_COPYCAT2, MovementData_0x18afd0
-.Part6:
+.Default_Female_3a:
+ applymovement COPYCATSHOUSE2F_COPYCAT2, CopycatSpinAroundMovementData
+.Default_Merge_3a:
faceplayer
variablesprite SPRITE_COPYCAT, SPRITE_LASS
- special RunCallback_04
+ special MapCallbackSprites_LoadUsedSpritesGFX
opentext
- writetext UnknownText_0x18b028
+ writetext CopycatText_QuickMimicking
waitbutton
closetext
end
-.Part7:
+.TalkAboutLostItem:
opentext
checkflag ENGINE_PLAYER_IS_FEMALE
- iftrue .Part8
- writetext UnknownText_0x18b064
- jump .Part9
+ iftrue .Default_Female_2b
+ writetext CopycatText_Male_2
+ jump .Default_Merge_2b
-.Part8:
- writetext UnknownText_0x18b366
-.Part9:
+.Default_Female_2b:
+ writetext CopycatText_Female_2
+.Default_Merge_2b:
waitbutton
closetext
checkflag ENGINE_PLAYER_IS_FEMALE
- iftrue .Part10
- applymovement COPYCATSHOUSE2F_COPYCAT1, MovementData_0x18afd0
- jump .Part11
+ iftrue .Default_Female_3b
+ applymovement COPYCATSHOUSE2F_COPYCAT1, CopycatSpinAroundMovementData
+ jump .Default_Merge_3b
-.Part10:
- applymovement COPYCATSHOUSE2F_COPYCAT2, MovementData_0x18afd0
-.Part11:
+.Default_Female_3b:
+ applymovement COPYCATSHOUSE2F_COPYCAT2, CopycatSpinAroundMovementData
+.Default_Merge_3b:
faceplayer
variablesprite SPRITE_COPYCAT, SPRITE_LASS
- special RunCallback_04
+ special MapCallbackSprites_LoadUsedSpritesGFX
opentext
- writetext UnknownText_0x18b116
+ writetext CopycatText_Worried
waitbutton
closetext
setevent EVENT_MET_COPYCAT_FOUND_OUT_ABOUT_LOST_ITEM
end
-.Part12:
+.ReturnLostItem:
opentext
- writetext UnknownText_0x18b17f
+ writetext CopycatText_GiveDoll
buttonsound
takeitem LOST_ITEM
setevent EVENT_RETURNED_LOST_ITEM_TO_COPYCAT
clearevent EVENT_COPYCATS_HOUSE_2F_DOLL
- jump .Part14
+ jump .GivePass
-.Part13:
+.TryGivePassAgain:
opentext
-.Part14:
- writetext UnknownText_0x18b1e2
+.GivePass:
+ writetext CopycatText_GivePass
buttonsound
verbosegiveitem PASS
- iffalse .Part22
+ iffalse .Cancel
setevent EVENT_GOT_PASS_FROM_COPYCAT
- writetext UnknownText_0x18b214
+ writetext CopycatText_ExplainPass
waitbutton
closetext
end
-.Part15:
+.GotPass:
checkflag ENGINE_PLAYER_IS_FEMALE
- iftrue .Part16
- applymovement COPYCATSHOUSE2F_COPYCAT1, MovementData_0x18afd0
+ iftrue .GotPass_Female_1
+ applymovement COPYCATSHOUSE2F_COPYCAT1, CopycatSpinAroundMovementData
faceplayer
variablesprite SPRITE_COPYCAT, SPRITE_CHRIS
- jump .Part17
+ jump .GotPass_Merge_1
-.Part16:
- applymovement COPYCATSHOUSE2F_COPYCAT2, MovementData_0x18afd0
+.GotPass_Female_1:
+ applymovement COPYCATSHOUSE2F_COPYCAT2, CopycatSpinAroundMovementData
faceplayer
variablesprite SPRITE_COPYCAT, SPRITE_KRIS
-.Part17:
- special RunCallback_04
+.GotPass_Merge_1:
+ special MapCallbackSprites_LoadUsedSpritesGFX
opentext
checkflag ENGINE_PLAYER_IS_FEMALE
- iftrue .Part18
- writetext UnknownText_0x18b298
- jump .Part19
+ iftrue .GotPass_Female_2
+ writetext CopycatText_Male_3
+ jump .GotPass_Merge_2
-.Part18:
- writetext UnknownText_0x18b415
-.Part19:
+.GotPass_Female_2:
+ writetext CopycatText_Female_3
+.GotPass_Merge_2:
waitbutton
closetext
checkflag ENGINE_PLAYER_IS_FEMALE
- iftrue .Part20
- applymovement COPYCATSHOUSE2F_COPYCAT1, MovementData_0x18afd0
- jump .Part21
+ iftrue .GotPass_Female_3
+ applymovement COPYCATSHOUSE2F_COPYCAT1, CopycatSpinAroundMovementData
+ jump .GotPass_Merge_3
-.Part20:
- applymovement COPYCATSHOUSE2F_COPYCAT2, MovementData_0x18afd0
-.Part21:
+.GotPass_Female_3:
+ applymovement COPYCATSHOUSE2F_COPYCAT2, CopycatSpinAroundMovementData
+.GotPass_Merge_3:
faceplayer
variablesprite SPRITE_COPYCAT, SPRITE_LASS
- special RunCallback_04
+ special MapCallbackSprites_LoadUsedSpritesGFX
opentext
- writetext UnknownText_0x18b2f5
+ writetext CopycatText_ItsAScream
waitbutton
-.Part22:
+.Cancel:
closetext
end
@@ -191,19 +191,19 @@
CopycatsHouse2FBookshelf:
jumpstd picturebookshelf
-MovementData_0x18afd0:
- turn_head_down
- turn_head_left
- turn_head_up
- turn_head_right
- turn_head_down
- turn_head_left
- turn_head_up
- turn_head_right
- turn_head_down
+CopycatSpinAroundMovementData:
+ turn_head DOWN
+ turn_head LEFT
+ turn_head UP
+ turn_head RIGHT
+ turn_head DOWN
+ turn_head LEFT
+ turn_head UP
+ turn_head RIGHT
+ turn_head DOWN
step_end
-UnknownText_0x18afda:
+CopycatText_Male_1:
text "<PLAYER>: Hi! Do"
line "you like #MON?"
@@ -214,7 +214,7 @@
line "You're strange!"
done
-UnknownText_0x18b028:
+CopycatText_QuickMimicking:
text "COPYCAT: Hmm?"
line "Quit mimicking?"
@@ -222,7 +222,7 @@
line "favorite hobby!"
done
-UnknownText_0x18b064:
+CopycatText_Male_2:
text "<PLAYER>: Hi!"
line "I heard that you"
@@ -241,7 +241,7 @@
cont "to VERMILION CITY?"
done
-UnknownText_0x18b116:
+CopycatText_Worried:
text "COPYCAT: Pardon?"
para "I shouldn't decide"
@@ -253,7 +253,7 @@
cont "someone finds it?"
done
-UnknownText_0x18b17f:
+CopycatText_GiveDoll:
text "COPYCAT: Yay!"
line "That's my CLEFAIRY"
cont "# DOLL!"
@@ -265,13 +265,13 @@
line "proof!"
done
-UnknownText_0x18b1e2:
+CopycatText_GivePass:
text "OK. Here's the"
line "MAGNET TRAIN PASS"
cont "like I promised!"
done
-UnknownText_0x18b214:
+CopycatText_ExplainPass:
text "COPYCAT: That's"
line "the PASS for the"
cont "MAGNET TRAIN."
@@ -284,7 +284,7 @@
cont "for the STATION."
done
-UnknownText_0x18b298:
+CopycatText_Male_3:
text "<PLAYER>: Hi!"
line "Thanks a lot for"
cont "the rail PASS!"
@@ -296,12 +296,12 @@
cont "my every move?"
done
-UnknownText_0x18b2f5:
+CopycatText_ItsAScream:
text "COPYCAT: You bet!"
line "It's a scream!"
done
-UnknownText_0x18b316:
+CopycatText_Female_1:
text "<PLAYER>: Hi. You"
line "must like #MON."
@@ -312,7 +312,7 @@
line "You're weird!"
done
-UnknownText_0x18b366:
+CopycatText_Female_2:
text "<PLAYER>: Hi. Did"
line "you really lose"
cont "your # DOLL?"
@@ -331,7 +331,7 @@
cont "in VERMILION?"
done
-UnknownText_0x18b415:
+CopycatText_Female_3:
text "<PLAYER>: Thank you"
line "for the rail PASS!"
--- a/maps/DragonShrine.asm
+++ b/maps/DragonShrine.asm
@@ -344,66 +344,66 @@
MovementData_0x18d2bf:
- slow_step_up
- slow_step_up
- slow_step_up
- slow_step_right
- slow_step_up
- slow_step_up
- slow_step_up
+ slow_step UP
+ slow_step UP
+ slow_step UP
+ slow_step RIGHT
+ slow_step UP
+ slow_step UP
+ slow_step UP
step_end
MovementData_0x18d2c7:
- slow_step_down
+ slow_step DOWN
step_end
MovementData_0x18d2c9:
- slow_step_left
- slow_step_left
- slow_step_left
- turn_head_down
+ slow_step LEFT
+ slow_step LEFT
+ slow_step LEFT
+ turn_head DOWN
step_end
MovementData_0x18d2ce:
- slow_step_right
- slow_step_right
+ slow_step RIGHT
+ slow_step RIGHT
step_end
MovementData_0x18d2d1:
- slow_step_right
- turn_head_down
+ slow_step RIGHT
+ turn_head DOWN
step_end
MovementData_0x18d2d4:
- slow_step_up
- slow_step_up
- slow_step_up
- slow_step_up
- slow_step_up
+ slow_step UP
+ slow_step UP
+ slow_step UP
+ slow_step UP
+ slow_step UP
step_end
MovementData_0x18d2da:
fix_facing
- big_step_left
+ big_step LEFT
step_end
MovementData_0x18d2dd:
- slow_step_left
+ slow_step LEFT
remove_fixed_facing
step_end
MovementData_0x18d2e0:
- slow_step_right
- slow_step_right
+ slow_step RIGHT
+ slow_step RIGHT
step_end
MovementData_0x18d2e3:
- step_down
- step_down
- step_down
- step_down
- step_down
- step_down
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
step_end
UnknownText_0x18d2ea:
--- a/maps/DragonsDenB1F.asm
+++ b/maps/DragonsDenB1F.asm
@@ -197,17 +197,17 @@
dwb EVENT_DRAGONS_DEN_B1F_HIDDEN_MAX_ELIXER, MAX_ELIXER
MovementDragonsDen_ClairWalksToYou:
- slow_step_right
- slow_step_right
- slow_step_right
- slow_step_right
+ slow_step RIGHT
+ slow_step RIGHT
+ slow_step RIGHT
+ slow_step RIGHT
step_end
MovementDragonsDen_ClairWalksAway:
- slow_step_left
- slow_step_left
- slow_step_left
- slow_step_left
+ slow_step LEFT
+ slow_step LEFT
+ slow_step LEFT
+ slow_step LEFT
step_end
ClairText_Wait:
--- a/maps/EarlsPokemonAcademy.asm
+++ b/maps/EarlsPokemonAcademy.asm
@@ -149,19 +149,19 @@
jumpstd difficultbookshelf
MovementData_0x68b2d:
- turn_head_down
- turn_head_left
- turn_head_up
- turn_head_right
- turn_head_down
- turn_head_left
- turn_head_up
- turn_head_right
- turn_head_down
- turn_head_left
- turn_head_up
- turn_head_right
- turn_head_down
+ turn_head DOWN
+ turn_head LEFT
+ turn_head UP
+ turn_head RIGHT
+ turn_head DOWN
+ turn_head LEFT
+ turn_head UP
+ turn_head RIGHT
+ turn_head DOWN
+ turn_head LEFT
+ turn_head UP
+ turn_head RIGHT
+ turn_head DOWN
step_end
UnknownText_0x68b3b:
--- a/maps/EcruteakGym.asm
+++ b/maps/EcruteakGym.asm
@@ -168,17 +168,17 @@
jumpstd gymstatue2
MovementData_0x99e5d:
- step_up
+ step UP
step_end
MovementData_0x99e5f:
fix_facing
- slow_step_down
+ slow_step DOWN
remove_fixed_facing
step_end
MovementData_0x99e63:
- slow_step_down
+ slow_step DOWN
step_end
UnknownText_0x99e65:
--- a/maps/EcruteakHouse.asm
+++ b/maps/EcruteakHouse.asm
@@ -144,16 +144,16 @@
MovementData_0x980c7:
fix_facing
- big_step_left
+ big_step LEFT
remove_fixed_facing
- turn_head_down
+ turn_head DOWN
step_end
MovementData_0x980cc:
fix_facing
- big_step_right
+ big_step RIGHT
remove_fixed_facing
- turn_head_down
+ turn_head DOWN
step_end
UnknownText_0x980d1:
--- a/maps/EcruteakPokeCenter1F.asm
+++ b/maps/EcruteakPokeCenter1F.asm
@@ -77,28 +77,28 @@
jumptextfaceplayer EcruteakPokeCenter1FGymGuyText
EcruteakPokeCenter1FBillMovement1:
- step_up
- step_up
- step_up
- step_up
- step_right
- step_right
- step_right
- turn_head_up
+ step UP
+ step UP
+ step UP
+ step UP
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ turn_head UP
step_end
EcruteakPokeCenter1FBillMovement2:
- step_right
- step_down
- step_down
- step_down
- step_down
+ step RIGHT
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
step_end
EcruteakPokeCenter1FPlayerMovement1:
- step_up
- step_up
- step_up
+ step UP
+ step UP
+ step UP
step_end
EcruteakPokeCenter1F_BillText1:
--- a/maps/ElmsLab.asm
+++ b/maps/ElmsLab.asm
@@ -616,118 +616,118 @@
jumpstd difficultbookshelf
ElmsLab_WalkUpToElmMovement:
- step_up
- step_up
- step_up
- step_up
- step_up
- step_up
- step_up
- turn_head_left
+ step UP
+ step UP
+ step UP
+ step UP
+ step UP
+ step UP
+ step UP
+ turn_head LEFT
step_end
MovementData_0x78f70:
- step_up
+ step UP
step_end
MeetCopScript2_StepLeft:
- step_left
+ step LEFT
step_end
MeetCopScript_WalkUp:
- step_up
- step_up
- turn_head_right
+ step UP
+ step UP
+ turn_head RIGHT
step_end
OfficerLeavesMovement:
- step_down
- step_down
- step_down
- step_down
- step_down
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
step_end
AideWalksRight1:
- step_right
- step_right
- turn_head_up
+ step RIGHT
+ step RIGHT
+ turn_head UP
step_end
AideWalksRight2:
- step_right
- step_right
- step_right
- turn_head_up
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ turn_head UP
step_end
AideWalksLeft1:
- step_left
- step_left
- turn_head_down
+ step LEFT
+ step LEFT
+ turn_head DOWN
step_end
AideWalksLeft2:
- step_left
- step_left
- step_left
- turn_head_down
+ step LEFT
+ step LEFT
+ step LEFT
+ turn_head DOWN
step_end
ElmJumpUpMovement:
fix_facing
- big_step_up
+ big_step UP
remove_fixed_facing
step_end
ElmJumpDownMovement:
fix_facing
- big_step_down
+ big_step DOWN
remove_fixed_facing
step_end
ElmJumpLeftMovement:
fix_facing
- big_step_left
+ big_step LEFT
remove_fixed_facing
step_end
ElmJumpRightMovement:
fix_facing
- big_step_right
+ big_step RIGHT
remove_fixed_facing
step_end
ElmsLab_ElmToDefaultPositionMovement1:
- step_up
+ step UP
step_end
ElmsLab_ElmToDefaultPositionMovement2:
- step_right
- step_right
- step_up
- turn_head_down
+ step RIGHT
+ step RIGHT
+ step UP
+ turn_head DOWN
step_end
AfterCyndaquilMovement:
- step_left
- step_up
- turn_head_up
+ step LEFT
+ step UP
+ turn_head UP
step_end
AfterTotodileMovement:
- step_left
- step_left
- step_up
- turn_head_up
+ step LEFT
+ step LEFT
+ step UP
+ turn_head UP
step_end
AfterChikoritaMovement:
- step_left
- step_left
- step_left
- step_up
- turn_head_up
+ step LEFT
+ step LEFT
+ step LEFT
+ step UP
+ turn_head UP
step_end
ElmText_Intro:
--- a/maps/FastShip1F.asm
+++ b/maps/FastShip1F.asm
@@ -141,72 +141,72 @@
end
MovementData_0x7520e:
- slow_step_left
- turn_head_right
+ slow_step LEFT
+ turn_head RIGHT
step_end
MovementData_0x75211:
- slow_step_right
- turn_head_down
+ slow_step RIGHT
+ turn_head DOWN
step_end
MovementData_0x75214:
- slow_step_down
- turn_head_up
+ slow_step DOWN
+ turn_head UP
step_end
MovementData_0x75217:
- step_down
- step_down
- turn_head_down
+ step DOWN
+ step DOWN
+ turn_head DOWN
step_end
MovementData_0x7521b:
- big_step_right
- big_step_right
- big_step_right
- big_step_right
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
step_end
MovementData_0x75220:
- step_right
+ step RIGHT
step_end
MovementData_0x75222:
- big_step_down
- big_step_right
- big_step_right
- big_step_right
- big_step_right
- big_step_right
- big_step_right
- big_step_down
- big_step_down
- big_step_down
- big_step_down
+ big_step DOWN
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step DOWN
+ big_step DOWN
+ big_step DOWN
+ big_step DOWN
step_end
MovementData_0x7522e:
- big_step_right
- turn_head_left
+ big_step RIGHT
+ turn_head LEFT
step_end
MovementData_0x75231:
- step_up
+ step UP
step_end
MovementData_0x75233:
- step_down
+ step DOWN
step_end
MovementData_0x75235:
- step_up
- step_up
+ step UP
+ step UP
step_end
MovementData_0x75238:
- step_right
- step_up
+ step RIGHT
+ step UP
step_end
UnknownText_0x7523b:
--- a/maps/FastShipB1F.asm
+++ b/maps/FastShipB1F.asm
@@ -210,16 +210,16 @@
MovementData_0x76871:
fix_facing
- big_step_right
+ big_step RIGHT
remove_fixed_facing
- turn_head_down
+ turn_head DOWN
step_end
MovementData_0x76876:
fix_facing
- big_step_left
+ big_step LEFT
remove_fixed_facing
- turn_head_down
+ turn_head DOWN
step_end
UnknownText_0x7687b:
--- a/maps/FastShipCabins_NNW_NNE_NE.asm
+++ b/maps/FastShipCabins_NNW_NNE_NE.asm
@@ -118,19 +118,19 @@
jumpstd trashcan
MovementData_0x75637:
- step_left
- step_left
- step_up
- step_up
+ step LEFT
+ step LEFT
+ step UP
+ step UP
step_end
MovementData_0x7563c:
- step_down
- step_left
- step_left
- step_up
- step_up
- step_up
+ step DOWN
+ step LEFT
+ step LEFT
+ step UP
+ step UP
+ step UP
step_end
CooltrainermSeanSeenText:
--- a/maps/FastShipCabins_SE_SSE_CaptainsCabin.asm
+++ b/maps/FastShipCabins_SE_SSE_CaptainsCabin.asm
@@ -221,23 +221,23 @@
jumpstd trashcan
MovementData_0x76004:
- big_step_right
- big_step_up
- big_step_up
- big_step_up
- big_step_up
- big_step_up
- big_step_up
+ big_step RIGHT
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step UP
step_end
MovementData_0x7600c:
- step_up
- step_up
- turn_head_left
+ step UP
+ step UP
+ turn_head LEFT
step_end
MovementData_0x76010:
- step_down
+ step DOWN
step_end
UnknownText_0x76012:
--- a/maps/FuchsiaGym.asm
+++ b/maps/FuchsiaGym.asm
@@ -35,7 +35,7 @@
variablesprite SPRITE_FUCHSIA_GYM_2, SPRITE_LASS
variablesprite SPRITE_FUCHSIA_GYM_3, SPRITE_LASS
variablesprite SPRITE_FUCHSIA_GYM_4, SPRITE_YOUNGSTER
- special RunCallback_04
+ special MapCallbackSprites_LoadUsedSpritesGFX
opentext
writetext UnknownText_0x195feb
playsound SFX_GET_BADGE
@@ -65,7 +65,7 @@
applymovement FUCHSIAGYM_FUCHSIA_GYM_1, MovementData_0x195f27
faceplayer
variablesprite SPRITE_FUCHSIA_GYM_1, SPRITE_LASS
- special RunCallback_04
+ special MapCallbackSprites_LoadUsedSpritesGFX
UnknownScript_0x195e2c:
faceplayer
opentext
@@ -99,7 +99,7 @@
applymovement FUCHSIAGYM_FUCHSIA_GYM_2, MovementData_0x195f27
faceplayer
variablesprite SPRITE_FUCHSIA_GYM_2, SPRITE_LASS
- special RunCallback_04
+ special MapCallbackSprites_LoadUsedSpritesGFX
UnknownScript_0x195e66:
faceplayer
opentext
@@ -133,7 +133,7 @@
applymovement FUCHSIAGYM_FUCHSIA_GYM_3, MovementData_0x195f27
faceplayer
variablesprite SPRITE_FUCHSIA_GYM_3, SPRITE_LASS
- special RunCallback_04
+ special MapCallbackSprites_LoadUsedSpritesGFX
UnknownScript_0x195ea0:
faceplayer
opentext
@@ -167,7 +167,7 @@
applymovement FUCHSIAGYM_FUCHSIA_GYM_4, MovementData_0x195f27
faceplayer
variablesprite SPRITE_FUCHSIA_GYM_4, SPRITE_YOUNGSTER
- special RunCallback_04
+ special MapCallbackSprites_LoadUsedSpritesGFX
UnknownScript_0x195eda:
faceplayer
opentext
@@ -220,19 +220,19 @@
jumpstd gymstatue2
MovementData_0x195f27:
- turn_head_down
- turn_head_left
- turn_head_up
- turn_head_right
- turn_head_down
- turn_head_left
- turn_head_up
- turn_head_right
- turn_head_down
- turn_head_left
- turn_head_up
- turn_head_right
- turn_head_down
+ turn_head DOWN
+ turn_head LEFT
+ turn_head UP
+ turn_head RIGHT
+ turn_head DOWN
+ turn_head LEFT
+ turn_head UP
+ turn_head RIGHT
+ turn_head DOWN
+ turn_head LEFT
+ turn_head UP
+ turn_head RIGHT
+ turn_head DOWN
step_end
UnknownText_0x195f35:
--- a/maps/FuchsiaPokeCenter1F.asm
+++ b/maps/FuchsiaPokeCenter1F.asm
@@ -35,7 +35,7 @@
applymovement FUCHSIAPOKECENTER1F_JANINE_IMPERSONATOR, MovementData_0x196486
faceplayer
variablesprite SPRITE_JANINE_IMPERSONATOR, SPRITE_JANINE
- special RunCallback_04
+ special MapCallbackSprites_LoadUsedSpritesGFX
opentext
writetext UnknownText_0x19654e
waitbutton
@@ -43,23 +43,23 @@
applymovement FUCHSIAPOKECENTER1F_JANINE_IMPERSONATOR, MovementData_0x196486
faceplayer
variablesprite SPRITE_JANINE_IMPERSONATOR, SPRITE_LASS
- special RunCallback_04
+ special MapCallbackSprites_LoadUsedSpritesGFX
end
MovementData_0x196486:
- turn_head_down
- turn_head_left
- turn_head_up
- turn_head_right
- turn_head_down
- turn_head_left
- turn_head_up
- turn_head_right
- turn_head_down
- turn_head_left
- turn_head_up
- turn_head_right
- turn_head_down
+ turn_head DOWN
+ turn_head LEFT
+ turn_head UP
+ turn_head RIGHT
+ turn_head DOWN
+ turn_head LEFT
+ turn_head UP
+ turn_head RIGHT
+ turn_head DOWN
+ turn_head LEFT
+ turn_head UP
+ turn_head RIGHT
+ turn_head DOWN
step_end
UnknownText_0x196494:
--- a/maps/GoldenrodCity.asm
+++ b/maps/GoldenrodCity.asm
@@ -275,17 +275,17 @@
jumptext GoldenrodCityFlowerShopSignText
MovementData_0x198a5f:
- step_right
- step_right
- step_up
+ step RIGHT
+ step RIGHT
+ step UP
step_end
MovementData_0x198a63:
- step_down
- step_right
- step_right
- step_up
- step_up
+ step DOWN
+ step RIGHT
+ step RIGHT
+ step UP
+ step UP
step_end
UnknownText_0x198a69:
--- a/maps/GoldenrodGym.asm
+++ b/maps/GoldenrodGym.asm
@@ -177,13 +177,13 @@
jumpstd gymstatue2
BridgetWalksUpMovement:
- step_left
- turn_head_up
+ step LEFT
+ turn_head UP
step_end
BridgetWalksAwayMovement:
- step_right
- turn_head_left
+ step RIGHT
+ turn_head LEFT
step_end
UnknownText_0x54122:
--- a/maps/GoldenrodMagnetTrainStation.asm
+++ b/maps/GoldenrodMagnetTrainStation.asm
@@ -45,7 +45,7 @@
end
.MovementBoardTheTrain:
- turn_head_down
+ turn_head DOWN
step_end
.PassNotInBag:
@@ -74,37 +74,37 @@
jumptextfaceplayer UnknownText_0x552a3
MovementData_0x55146:
- step_up
- step_up
- step_right
- turn_head_left
+ step UP
+ step UP
+ step RIGHT
+ turn_head LEFT
step_end
MovementData_0x5514b:
- step_left
- step_down
- step_down
+ step LEFT
+ step DOWN
+ step DOWN
step_end
MovementData_0x5514f:
- step_up
- step_up
- step_up
- step_left
- step_left
- step_left
- step_up
- step_up
+ step UP
+ step UP
+ step UP
+ step LEFT
+ step LEFT
+ step LEFT
+ step UP
+ step UP
step_end
MovementData_0x55158:
- step_left
- step_left
- step_down
- step_down
- step_down
- step_down
- turn_head_up
+ step LEFT
+ step LEFT
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ turn_head UP
step_end
UnknownText_0x55160:
--- a/maps/GoldenrodPokeCenter1F.asm
+++ b/maps/GoldenrodPokeCenter1F.asm
@@ -120,35 +120,35 @@
end
MovementData_0x6105a:
- step_up
- step_right
- step_right
- step_right
- turn_head_down
+ step UP
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ turn_head DOWN
step_end
MovementData_0x61060:
- step_left
- step_left
- step_left
- step_down
+ step LEFT
+ step LEFT
+ step LEFT
+ step DOWN
step_end
MovementData_0x61065:
- step_up
- step_right
- step_right
- step_right
- step_right
- turn_head_down
+ step UP
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ turn_head DOWN
step_end
MovementData_0x6106c:
- step_left
- step_left
- step_left
- step_left
- step_down
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ step DOWN
step_end
; unused
--- a/maps/HallOfFame.asm
+++ b/maps/HallOfFame.asm
@@ -50,20 +50,20 @@
end
HallOfFame_WalkUpWithLance:
- step_up
- step_up
- step_up
- step_up
- step_up
- step_up
- step_up
- step_up
- step_right
- turn_head_left
+ step UP
+ step UP
+ step UP
+ step UP
+ step UP
+ step UP
+ step UP
+ step UP
+ step RIGHT
+ turn_head LEFT
step_end
HallOfFame_SlowlyApproachMachine:
- slow_step_up
+ slow_step UP
step_end
HallOfFame_LanceText:
--- a/maps/IlexForest.asm
+++ b/maps/IlexForest.asm
@@ -489,257 +489,257 @@
end
MovementData_Farfetchd_Pos1_Pos2:
- big_step_up
- big_step_up
- big_step_up
- big_step_up
- big_step_up
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step UP
step_end
MovementData_Farfetchd_Pos2_Pos3:
- big_step_up
- big_step_up
- big_step_right
- big_step_right
- big_step_right
- big_step_right
- big_step_right
- big_step_down
+ big_step UP
+ big_step UP
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step DOWN
step_end
MovementData_Farfetchd_Pos2_Pos8:
- big_step_down
- big_step_down
- big_step_down
- big_step_down
- big_step_down
+ big_step DOWN
+ big_step DOWN
+ big_step DOWN
+ big_step DOWN
+ big_step DOWN
step_end
MovementData_Farfetchd_Pos3_Pos4:
- big_step_right
- big_step_right
- big_step_right
- big_step_right
- big_step_right
- big_step_right
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
step_end
MovementData_Farfetchd_Pos3_Pos2:
- big_step_up
- big_step_left
- big_step_left
- big_step_left
- big_step_left
+ big_step UP
+ big_step LEFT
+ big_step LEFT
+ big_step LEFT
+ big_step LEFT
step_end
MovementData_Farfetchd_Pos4_Pos5:
- big_step_down
- big_step_down
- big_step_down
- big_step_down
- big_step_down
- big_step_down
+ big_step DOWN
+ big_step DOWN
+ big_step DOWN
+ big_step DOWN
+ big_step DOWN
+ big_step DOWN
step_end
MovementData_Farfetchd_Pos4_Pos3:
- big_step_left
- jump_step_left
- big_step_left
- big_step_left
+ big_step LEFT
+ jump_step LEFT
+ big_step LEFT
+ big_step LEFT
step_end
MovementData_Farfetchd_Pos5_Pos6:
- big_step_down
- big_step_down
- big_step_down
- big_step_down
- big_step_down
- big_step_left
- big_step_left
- big_step_left
- big_step_left
+ big_step DOWN
+ big_step DOWN
+ big_step DOWN
+ big_step DOWN
+ big_step DOWN
+ big_step LEFT
+ big_step LEFT
+ big_step LEFT
+ big_step LEFT
step_end
MovementData_Farfetchd_Pos5_Pos7:
- big_step_left
- big_step_left
- big_step_left
- big_step_left
+ big_step LEFT
+ big_step LEFT
+ big_step LEFT
+ big_step LEFT
step_end
MovementData_Farfetched_Pos5_Pos4_Up:
- big_step_up
- big_step_up
- big_step_up
- big_step_right
- big_step_up
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step RIGHT
+ big_step UP
step_end
MovementData_Farfetched_Pos5_Pos4_Right:
- big_step_right
- turn_head_up
- step_sleep_1
- turn_head_down
- step_sleep_1
- turn_head_up
- step_sleep_1
- big_step_down
- big_step_down
+ big_step RIGHT
+ turn_head UP
+ step_sleep 1
+ turn_head DOWN
+ step_sleep 1
+ turn_head UP
+ step_sleep 1
+ big_step DOWN
+ big_step DOWN
fix_facing
- jump_step_up
- step_sleep_8
- step_sleep_8
+ jump_step UP
+ step_sleep 8
+ step_sleep 8
remove_fixed_facing
- big_step_up
- big_step_up
- big_step_up
- big_step_up
- big_step_up
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step UP
step_end
MovementData_Farfetched_Pos6_Pos7:
- big_step_left
- big_step_left
- big_step_left
- big_step_up
- big_step_up
- big_step_right
- big_step_up
- big_step_up
+ big_step LEFT
+ big_step LEFT
+ big_step LEFT
+ big_step UP
+ big_step UP
+ big_step RIGHT
+ big_step UP
+ big_step UP
step_end
MovementData_Farfetched_Pos6_Pos5:
- big_step_right
- big_step_right
- big_step_right
- big_step_right
- big_step_up
- big_step_up
- big_step_up
- big_step_up
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step UP
step_end
MovementData_Farfetched_Pos7_Pos8:
- big_step_up
- big_step_up
- big_step_left
- big_step_left
- big_step_left
- big_step_left
- big_step_left
+ big_step UP
+ big_step UP
+ big_step LEFT
+ big_step LEFT
+ big_step LEFT
+ big_step LEFT
+ big_step LEFT
step_end
MovementData_Farfetched_Pos7_Pos6:
- big_step_down
- big_step_down
- big_step_left
- big_step_down
- big_step_down
- big_step_right
- big_step_right
- big_step_right
+ big_step DOWN
+ big_step DOWN
+ big_step LEFT
+ big_step DOWN
+ big_step DOWN
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
step_end
MovementData_Farfetched_Pos7_Pos5:
- big_step_right
- big_step_right
- big_step_right
- big_step_right
- big_step_right
- big_step_right
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
step_end
MovementData_Farfetched_Pos8_Pos9:
- big_step_down
- big_step_left
- big_step_down
- big_step_down
- big_step_down
- big_step_down
- big_step_down
+ big_step DOWN
+ big_step LEFT
+ big_step DOWN
+ big_step DOWN
+ big_step DOWN
+ big_step DOWN
+ big_step DOWN
step_end
MovementData_Farfetched_Pos8_Pos7:
- big_step_right
- big_step_right
- big_step_right
- big_step_right
- big_step_right
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
step_end
MovementData_Farfetched_Pos8_Pos2:
- big_step_up
- big_step_up
- big_step_up
- big_step_up
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step UP
step_end
MovementData_Farfetched_Pos9_Pos10:
- big_step_left
- big_step_left
+ big_step LEFT
+ big_step LEFT
fix_facing
- jump_step_right
- step_sleep_8
- step_sleep_8
+ jump_step RIGHT
+ step_sleep 8
+ step_sleep 8
remove_fixed_facing
- big_step_left
- big_step_left
- big_step_up
- big_step_up
- big_step_up
- big_step_up
- big_step_up
- big_step_up
+ big_step LEFT
+ big_step LEFT
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step UP
step_end
MovementData_Farfetched_Pos9_Pos8_Right:
- big_step_right
- big_step_right
- big_step_right
- big_step_right
- big_step_up
- big_step_up
- big_step_up
- big_step_up
- big_step_up
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step UP
step_end
MovementData_Farfetched_Pos9_Pos8_Down:
- big_step_left
- big_step_left
+ big_step LEFT
+ big_step LEFT
fix_facing
- jump_step_right
- step_sleep_8
- step_sleep_8
+ jump_step RIGHT
+ step_sleep 8
+ step_sleep 8
remove_fixed_facing
- big_step_right
- big_step_right
- big_step_right
- big_step_right
- big_step_up
- big_step_up
- big_step_up
- big_step_up
- big_step_up
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step UP
step_end
MovementData_0x6ef4e:
- step_up
- step_up
- step_up
- step_up
+ step UP
+ step UP
+ step UP
+ step UP
step_end
MovementData_0x6ef53:
- step_down
- step_down
- step_down
- step_down
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
step_end
MovementData_0x6ef58:
fix_facing
- slow_step_down
+ slow_step DOWN
remove_fixed_facing
step_end
--- a/maps/IndigoPlateauPokeCenter1F.asm
+++ b/maps/IndigoPlateauPokeCenter1F.asm
@@ -183,29 +183,29 @@
end
PlateauRivalMovement1:
- step_up
- step_up
- step_up
- step_up
- step_up
- turn_head_left
+ step UP
+ step UP
+ step UP
+ step UP
+ step UP
+ turn_head LEFT
step_end
PlateauRivalMovement2:
- step_up
- step_up
- step_up
- step_up
- step_up
- turn_head_right
+ step UP
+ step UP
+ step UP
+ step UP
+ step UP
+ turn_head RIGHT
step_end
PlateauRivalLeavesMovement:
- step_down
- step_down
- step_down
- step_down
- step_down
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
step_end
UnknownText_0x180178:
--- a/maps/KarensRoom.asm
+++ b/maps/KarensRoom.asm
@@ -79,10 +79,10 @@
end
MovementData_0x180c22:
- step_up
- step_up
- step_up
- step_up
+ step UP
+ step UP
+ step UP
+ step UP
step_end
UnknownText_0x180c27:
--- a/maps/KogasRoom.asm
+++ b/maps/KogasRoom.asm
@@ -79,10 +79,10 @@
end
MovementData_0x18078e:
- step_up
- step_up
- step_up
- step_up
+ step UP
+ step UP
+ step UP
+ step UP
step_end
UnknownText_0x180793:
--- a/maps/KrissHouse1F.asm
+++ b/maps/KrissHouse1F.asm
@@ -199,19 +199,19 @@
jumptext FridgeText
MovementData_0x7a5fc:
- turn_head_right
+ turn_head RIGHT
step_end
MovementData_0x7a5fe:
- slow_step_right
+ slow_step RIGHT
step_end
MovementData_0x7a600:
- turn_head_left
+ turn_head LEFT
step_end
MovementData_0x7a602:
- slow_step_left
+ slow_step LEFT
step_end
UnknownText_0x7a604:
--- a/maps/KurtsHouse.asm
+++ b/maps/KurtsHouse.asm
@@ -437,20 +437,20 @@
jumpstd radio2
MovementData_0x18e466:
- big_step_down
- big_step_down
- big_step_down
- big_step_down
- big_step_down
+ big_step DOWN
+ big_step DOWN
+ big_step DOWN
+ big_step DOWN
+ big_step DOWN
step_end
MovementData_0x18e46c:
- big_step_right
- big_step_down
- big_step_down
- big_step_down
- big_step_down
- big_step_down
+ big_step RIGHT
+ big_step DOWN
+ big_step DOWN
+ big_step DOWN
+ big_step DOWN
+ big_step DOWN
step_end
UnknownText_0x18e473:
--- a/maps/LancesRoom.asm
+++ b/maps/LancesRoom.asm
@@ -136,79 +136,79 @@
end
LancesRoom_PlayerWalksInMovementData:
- step_up
- step_up
- step_up
- step_up
+ step UP
+ step UP
+ step UP
+ step UP
step_end
MovementData_ApproachLanceFromLeft:
- step_up
- step_up
- turn_head_right
+ step UP
+ step UP
+ turn_head RIGHT
step_end
MovementData_ApproachLanceFromRight:
- step_up
- step_left
- step_up
- turn_head_right
+ step UP
+ step LEFT
+ step UP
+ turn_head RIGHT
step_end
LancesRoomMovementData_MaryRushesIn:
- big_step_up
- big_step_up
- big_step_up
- turn_head_down
+ big_step UP
+ big_step UP
+ big_step UP
+ turn_head DOWN
step_end
LancesRoomMovementData_OakWalksIn:
- step_up
- step_up
+ step UP
+ step UP
step_end
LancesRoomMovementData_MaryYieldsToOak:
- step_left
- turn_head_right
+ step LEFT
+ turn_head RIGHT
step_end
LancesRoomMovementData_MaryInterviewChampion:
- big_step_up
- turn_head_right
+ big_step UP
+ turn_head RIGHT
step_end
LancesRoomMovementData_LancePositionsSelfToGuidePlayerAway:
- step_up
- step_left
- turn_head_down
+ step UP
+ step LEFT
+ turn_head DOWN
step_end
LancesRoomMovementData_LanceLeadsPlayerToHallOfFame:
- step_up
+ step UP
step_end
LancesRoomMovementData_PlayerExits:
- step_up
+ step UP
step_end
LancesRoomMovementData_MaryTriesToFollow:
- step_up
- step_right
- turn_head_up
+ step UP
+ step RIGHT
+ turn_head UP
step_end
LancesRoomMovementData_MaryRunsBackAndForth:
- big_step_right
- big_step_right
- big_step_left
- big_step_left
- big_step_left
- big_step_right
- big_step_right
- big_step_right
- big_step_left
- big_step_left
- turn_head_up
+ big_step RIGHT
+ big_step RIGHT
+ big_step LEFT
+ big_step LEFT
+ big_step LEFT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step LEFT
+ big_step LEFT
+ turn_head UP
step_end
LanceBattleIntroText:
--- a/maps/MahoganyMart1F.asm
+++ b/maps/MahoganyMart1F.asm
@@ -119,46 +119,46 @@
MovementData_0x6c3f6:
fix_facing
- big_step_left
- big_step_right
+ big_step LEFT
+ big_step RIGHT
remove_fixed_facing
step_end
MovementData_0x6c3fb:
fix_facing
- big_step_left
+ big_step LEFT
remove_fixed_facing
- turn_head_down
- turn_head_left
- turn_head_up
- turn_head_right
+ turn_head DOWN
+ turn_head LEFT
+ turn_head UP
+ turn_head RIGHT
step_end
MovementData_0x6c403:
fix_facing
- big_step_left
+ big_step LEFT
remove_fixed_facing
step_end
MovementData_0x6c407:
- slow_step_left
- turn_head_down
+ slow_step LEFT
+ turn_head DOWN
step_end
MovementData_0x6c40a:
- slow_step_right
- slow_step_up
- slow_step_up
+ slow_step RIGHT
+ slow_step UP
+ slow_step UP
step_end
MovementData_0x6c40e:
- slow_step_up
- slow_step_right
- slow_step_right
+ slow_step UP
+ slow_step RIGHT
+ slow_step RIGHT
step_end
MovementData_0x6c412:
- slow_step_right
+ slow_step RIGHT
step_end
UnknownText_0x6c414:
--- a/maps/MahoganyTown.asm
+++ b/maps/MahoganyTown.asm
@@ -126,22 +126,22 @@
jumpstd pokecentersign
MovementData_0x1900a4:
- step_down
- big_step_up
- turn_head_down
+ step DOWN
+ big_step UP
+ turn_head DOWN
MovementData_0x1900a7:
- step_left
+ step LEFT
step_end
MovementData_0x1900a9:
- step_right
- step_down
- turn_head_left
+ step RIGHT
+ step DOWN
+ turn_head LEFT
step_end
MovementData_0x1900ad:
- step_up
- turn_head_down
+ step UP
+ turn_head DOWN
step_end
UnknownText_0x1900b0:
--- a/maps/MountMoon.asm
+++ b/maps/MountMoon.asm
@@ -74,19 +74,19 @@
end
MountMoonSilverMovementBefore:
- step_left
- step_left
- step_left
+ step LEFT
+ step LEFT
+ step LEFT
step_end
MountMoonSilverMovementAfter:
- step_right
- step_right
- step_down
- step_down
- step_down
- step_down
- step_down
+ step RIGHT
+ step RIGHT
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
step_end
MountMoonSilverTextBefore:
--- a/maps/MountMoonSquare.asm
+++ b/maps/MountMoonSquare.asm
@@ -8,7 +8,7 @@
db 1
; triggers
- dw UnknownScript_0x77092, 0
+ dw .Trigger0, 0
.MapCallbacks:
db 2
@@ -15,18 +15,17 @@
; callbacks
- dbw MAPCALLBACK_NEWMAP, UnknownScript_0x77093
+ dbw MAPCALLBACK_NEWMAP, .DisappearMoonStone
+ dbw MAPCALLBACK_OBJECTS, .DisappearRock
- dbw MAPCALLBACK_OBJECTS, UnknownScript_0x77097
-
-UnknownScript_0x77092:
+.Trigger0:
end
-UnknownScript_0x77093:
+.DisappearMoonStone:
setevent EVENT_MOUNT_MOON_SQUARE_HIDDEN_MOON_STONE
return
-UnknownScript_0x77097:
+.DisappearRock:
disappear MOUNTMOONSQUARE_ROCK
return
@@ -39,7 +38,7 @@
iffalse .NoDancing
appear MOUNTMOONSQUARE_FAIRY1
appear MOUNTMOONSQUARE_FAIRY2
- applymovement PLAYER, MovementData_0x77121
+ applymovement PLAYER, PlayerWalksUpToDancingClefairies
pause 15
appear MOUNTMOONSQUARE_ROCK
spriteface MOUNTMOONSQUARE_FAIRY1, RIGHT
@@ -48,19 +47,19 @@
pause 30
follow MOUNTMOONSQUARE_FAIRY1, MOUNTMOONSQUARE_FAIRY2
cry CLEFAIRY
- applymovement MOUNTMOONSQUARE_FAIRY1, MovementData_0x77123
+ applymovement MOUNTMOONSQUARE_FAIRY1, ClefairyDanceStep1
cry CLEFAIRY
- applymovement MOUNTMOONSQUARE_FAIRY1, MovementData_0x77126
+ applymovement MOUNTMOONSQUARE_FAIRY1, ClefairyDanceStep2
cry CLEFAIRY
- applymovement MOUNTMOONSQUARE_FAIRY1, MovementData_0x77128
+ applymovement MOUNTMOONSQUARE_FAIRY1, ClefairyDanceStep3
cry CLEFAIRY
- applymovement MOUNTMOONSQUARE_FAIRY1, MovementData_0x7712b
+ applymovement MOUNTMOONSQUARE_FAIRY1, ClefairyDanceStep4
cry CLEFAIRY
- applymovement MOUNTMOONSQUARE_FAIRY1, MovementData_0x7712d
+ applymovement MOUNTMOONSQUARE_FAIRY1, ClefairyDanceStep5
stopfollow
- applymovement MOUNTMOONSQUARE_FAIRY2, MovementData_0x77130
+ applymovement MOUNTMOONSQUARE_FAIRY2, ClefairyDanceStep6
follow MOUNTMOONSQUARE_FAIRY1, MOUNTMOONSQUARE_FAIRY2
- applymovement MOUNTMOONSQUARE_FAIRY1, MovementData_0x77132
+ applymovement MOUNTMOONSQUARE_FAIRY1, ClefairyDanceStep7
stopfollow
spriteface MOUNTMOONSQUARE_FAIRY1, DOWN
pause 10
@@ -69,7 +68,7 @@
cry CLEFAIRY
pause 15
follow MOUNTMOONSQUARE_FAIRY1, MOUNTMOONSQUARE_FAIRY2
- applymovement MOUNTMOONSQUARE_FAIRY1, MovementData_0x77134
+ applymovement MOUNTMOONSQUARE_FAIRY1, ClefairyFleeMovement
disappear MOUNTMOONSQUARE_FAIRY1
disappear MOUNTMOONSQUARE_FAIRY2
stopfollow
@@ -90,48 +89,48 @@
MtMoonSquareRock:
jumpstd smashrock
-MovementData_0x77121:
- step_up
+PlayerWalksUpToDancingClefairies:
+ step UP
step_end
-MovementData_0x77123:
- slow_step_down
- slow_jump_step_down
+ClefairyDanceStep1:
+ slow_step DOWN
+ slow_jump_step DOWN
step_end
-MovementData_0x77126:
- slow_jump_step_right
+ClefairyDanceStep2:
+ slow_jump_step RIGHT
step_end
-MovementData_0x77128:
- slow_step_up
- slow_jump_step_up
+ClefairyDanceStep3:
+ slow_step UP
+ slow_jump_step UP
step_end
-MovementData_0x7712b:
- slow_jump_step_left
+ClefairyDanceStep4:
+ slow_jump_step LEFT
step_end
-MovementData_0x7712d:
- slow_step_down
- slow_jump_step_down
+ClefairyDanceStep5:
+ slow_step DOWN
+ slow_jump_step DOWN
step_end
-MovementData_0x77130:
- slow_step_down
+ClefairyDanceStep6:
+ slow_step DOWN
step_end
-MovementData_0x77132:
- slow_step_right
+ClefairyDanceStep7:
+ slow_step RIGHT
step_end
-MovementData_0x77134:
- step_right
- step_right
- step_right
- jump_step_right
- step_right
- step_right
+ClefairyFleeMovement:
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ jump_step RIGHT
+ step RIGHT
+ step RIGHT
step_end
DontLitterSignText:
--- a/maps/MrPokemonsHouse.asm
+++ b/maps/MrPokemonsHouse.asm
@@ -157,20 +157,20 @@
jumptext MrPokemonsHouse_StrangeCoinsText
MrPokemonsHouse_PlayerWalksToMrPokemon:
- step_right
- step_up
+ step RIGHT
+ step UP
step_end
MrPokemonsHouse_OakWalksToPlayer:
- step_down
- step_left
- step_left
+ step DOWN
+ step LEFT
+ step LEFT
step_end
MrPokemonsHouse_OakExits:
- step_down
- step_left
- turn_head_down
+ step DOWN
+ step LEFT
+ turn_head DOWN
db $3f ; movement
step_end
--- a/maps/NewBarkTown.asm
+++ b/maps/NewBarkTown.asm
@@ -144,52 +144,52 @@
jumptext ElmsHouseSignText
Movement_TeacherRunsToYou1_NBT:
- step_left
- step_left
- step_left
- step_left
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
step_end
Movement_TeacherRunsToYou2_NBT:
- step_left
- step_left
- step_left
- step_left
- step_left
- turn_head_down
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ turn_head DOWN
step_end
Movement_TeacherBringsYouBack1_NBT:
- step_right
- step_right
- step_right
- step_right
- turn_head_left
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ turn_head LEFT
step_end
Movement_TeacherBringsYouBack2_NBT:
- step_right
- step_right
- step_right
- step_right
- step_right
- turn_head_left
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ turn_head LEFT
step_end
Movement_SilverPushesYouAway_NBT:
- turn_head_up
- step_down
+ turn_head UP
+ step DOWN
step_end
Movement_SilverShovesYouOut_NBT:
- turn_head_up
+ turn_head UP
fix_facing
- jump_step_down
+ jump_step DOWN
remove_fixed_facing
step_end
Movement_SilverReturnsToTheShadows_NBT:
- step_right
+ step RIGHT
step_end
Text_GearIsImpressive:
--- a/maps/OlivineCity.asm
+++ b/maps/OlivineCity.asm
@@ -49,7 +49,7 @@
disappear OLIVINECITY_OLIVINE_RIVAL
special RestartMapMusic
variablesprite SPRITE_OLIVINE_RIVAL, SPRITE_SWIMMER_GUY
- special RunCallback_04
+ special MapCallbackSprites_LoadUsedSpritesGFX
end
UnknownScript_0x1a886b:
@@ -73,7 +73,7 @@
dotrigger $1
special RestartMapMusic
variablesprite SPRITE_OLIVINE_RIVAL, SPRITE_SWIMMER_GUY
- special RunCallback_04
+ special MapCallbackSprites_LoadUsedSpritesGFX
end
SailorScript_0x1a88a3:
@@ -120,55 +120,55 @@
jumpstd martsign
MovementData_0x1a88d2:
- step_down
- step_right
- step_right
+ step DOWN
+ step RIGHT
+ step RIGHT
step_end
MovementData_0x1a88d6:
- step_down
- step_down
- step_right
- step_right
+ step DOWN
+ step DOWN
+ step RIGHT
+ step RIGHT
step_end
MovementData_0x1a88db:
- step_right
- step_right
- step_right
- step_right
- step_right
- step_right
- step_up
- step_up
- step_up
- step_up
- step_up
- step_up
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step UP
+ step UP
+ step UP
+ step UP
+ step UP
+ step UP
step_end
MovementData_0x1a88e8:
- step_right
- step_right
- step_right
- step_right
- step_right
- step_right
- step_up
- step_up
- step_up
- step_up
- step_up
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step UP
+ step UP
+ step UP
+ step UP
+ step UP
step_end
MovementData_0x1a88f4:
- step_down
- turn_head_up
+ step DOWN
+ turn_head UP
step_end
MovementData_0x1a88f7:
- step_up
- turn_head_down
+ step UP
+ turn_head DOWN
step_end
UnknownText_0x1a88fa:
--- a/maps/OlivineLighthouse6F.asm
+++ b/maps/OlivineLighthouse6F.asm
@@ -131,34 +131,34 @@
itemball SUPER_POTION
MovementData_0x60c68:
- slow_step_up
- slow_step_up
- slow_step_right
- slow_step_up
- slow_step_up
- step_sleep_8
- step_sleep_8
+ slow_step UP
+ slow_step UP
+ slow_step RIGHT
+ slow_step UP
+ slow_step UP
+ step_sleep 8
+ step_sleep 8
step_end
MovementData_0x60c70:
- slow_step_down
- slow_step_right
- slow_step_right
- slow_step_right
- slow_step_up
- slow_step_right
- slow_step_right
- slow_step_right
+ slow_step DOWN
+ slow_step RIGHT
+ slow_step RIGHT
+ slow_step RIGHT
+ slow_step UP
+ slow_step RIGHT
+ slow_step RIGHT
+ slow_step RIGHT
step_end
MovementData_0x60c79:
- slow_step_up
- slow_step_up
- slow_step_right
- slow_step_up
- slow_step_up
- slow_step_up
- step_sleep_8
+ slow_step UP
+ slow_step UP
+ slow_step RIGHT
+ slow_step UP
+ slow_step UP
+ slow_step UP
+ step_sleep 8
step_end
UnknownText_0x60c81:
--- a/maps/OlivinePort.asm
+++ b/maps/OlivinePort.asm
@@ -240,52 +240,52 @@
MovementData_0x74a30:
- step_down
+ step DOWN
step_end
MovementData_0x74a32:
- step_up
+ step UP
step_end
MovementData_0x74a34:
- step_right
- turn_head_left
+ step RIGHT
+ turn_head LEFT
step_end
MovementData_0x74a37:
- step_down
- step_down
- step_down
- step_down
- step_down
- step_down
- step_down
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
step_end
MovementData_0x74a3f:
- step_right
- step_down
- step_down
- step_down
- step_down
- step_down
- step_down
- step_down
- step_down
+ step RIGHT
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
step_end
MovementData_0x74a49:
- step_up
- step_right
- step_right
- step_down
- step_down
- step_down
- step_down
- step_down
- step_down
- step_down
- step_down
+ step UP
+ step RIGHT
+ step RIGHT
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
step_end
UnknownText_0x74a55:
--- a/maps/PokeCenter2F.asm
+++ b/maps/PokeCenter2F.asm
@@ -625,180 +625,180 @@
end
PokeCenter2FMovementData_ReceptionistWalksUpAndLeft_LookRight:
- slow_step_up
- slow_step_left
- turn_head_right
+ slow_step UP
+ slow_step LEFT
+ turn_head RIGHT
step_end
PokeCenter2FMobileMobileMovementData_ReceptionistWalksUpAndLeft_LookDown:
- slow_step_up
- slow_step_left
- turn_head_down
+ slow_step UP
+ slow_step LEFT
+ turn_head DOWN
step_end
PokeCenter2FMovementData_ReceptionistStepsLeftLooksDown:
- slow_step_left
- turn_head_down
+ slow_step LEFT
+ turn_head DOWN
step_end
PokeCenter2FMovementData_ReceptionistStepsRightLooksDown:
- slow_step_right
- turn_head_down
+ slow_step RIGHT
+ turn_head DOWN
step_end
PokeCenter2FMovementData_ReceptionistWalksUpAndLeft_LookRight_2:
- slow_step_up
- slow_step_left
- turn_head_right
+ slow_step UP
+ slow_step LEFT
+ turn_head RIGHT
step_end
PokeCenter2FMovementData_ReceptionistLooksRight:
- turn_head_right
+ turn_head RIGHT
step_end
PokeCenter2FMovementData_PlayerTakesThreeStepsUp:
- step_up
- step_up
- step_up
+ step UP
+ step UP
+ step UP
step_end
PokeCenter2FMovementData_PlayerTakesTwoStepsUp:
- step_up
- step_up
+ step UP
+ step UP
step_end
PokeCenter2FMovementData_PlayerTakesOneStepUp:
- step_up
+ step UP
step_end
PokeCenter2FMobileMovementData_PlayerWalksIntoMobileBattleRoom:
- step_up
- step_up
- step_right
- step_up
+ step UP
+ step UP
+ step RIGHT
+ step UP
step_end
PokeCenter2FMovementData_PlayerTakesTwoStepsUp_2:
- step_up
- step_up
+ step UP
+ step UP
step_end
PokeCenter2FMovementData_PlayerWalksLeftAndUp:
- step_left
- step_up
+ step LEFT
+ step UP
step_end
PokeCenter2FMovementData_PlayerWalksRightAndUp:
- step_right
- step_up
+ step RIGHT
+ step UP
step_end
PokeCenter2FMovementData_PlayerTakesThreeStepsDown:
- step_down
- step_down
- step_down
+ step DOWN
+ step DOWN
+ step DOWN
step_end
PokeCenter2FMovementData_PlayerTakesTwoStepsDown:
- step_down
- step_down
+ step DOWN
+ step DOWN
step_end
PokeCenter2FMovementData_PlayerTakesOneStepDown:
- step_down
+ step DOWN
step_end
PokeCenter2FMovementData_ReceptionistStepsRightAndDown:
- slow_step_right
- slow_step_down
+ slow_step RIGHT
+ slow_step DOWN
step_end
PokeCenter2FMovementData_ReceptionistStepsRightLooksDown_2:
- slow_step_right
- turn_head_down
+ slow_step RIGHT
+ turn_head DOWN
step_end
PokeCenter2FMovementData_ReceptionistStepsRightLooksDown_3:
- slow_step_up
- slow_step_left
- turn_head_right
+ slow_step UP
+ slow_step LEFT
+ turn_head RIGHT
step_end
PokeCenter2FMovementData_ReceptionistStepsLeftLooksRight:
- slow_step_left
- turn_head_right
+ slow_step LEFT
+ turn_head RIGHT
step_end
PokeCenter2FMobileMovementData_ReceptionistWalksUpAndLeft:
- slow_step_up
- slow_step_left
- turn_head_right
+ slow_step UP
+ slow_step LEFT
+ turn_head RIGHT
step_end
PokeCenter2FMovementData_PlayerWalksOutOfMobileRoom:
- step_down
- step_left
- step_down
- step_down
+ step DOWN
+ step LEFT
+ step DOWN
+ step DOWN
step_end
PokeCenter2FMobileMovementData_ReceptionistWalksRightAndDown:
- slow_step_right
- slow_step_down
+ slow_step RIGHT
+ slow_step DOWN
step_end
PokeCenter2FMovementData_PlayerSpinsClockwiseEndsFacingRight:
- turn_head_down
- turn_head_left
- turn_head_up
- turn_head_right
+ turn_head DOWN
+ turn_head LEFT
+ turn_head UP
+ turn_head RIGHT
step_end
PokeCenter2FMovementData_PlayerSpinsClockwiseEndsFacingLeft:
- turn_head_down
- turn_head_left
- turn_head_up
- turn_head_right
- turn_head_left
+ turn_head DOWN
+ turn_head LEFT
+ turn_head UP
+ turn_head RIGHT
+ turn_head LEFT
step_end
PokeCenter2FMovementData_PlayerSpinsClockwiseEndsFacingDown:
- turn_head_down
- turn_head_left
- turn_head_up
- turn_head_right
- turn_head_down
+ turn_head DOWN
+ turn_head LEFT
+ turn_head UP
+ turn_head RIGHT
+ turn_head DOWN
step_end
PokeCenter2FMovementData_PlayerTakesOneStepDown_2:
- step_down
+ step DOWN
step_end
PokeCenter2FMovementData_PlayerTakesTwoStepsDown_2:
- step_down
- step_down
+ step DOWN
+ step DOWN
step_end
PokeCenter2FMovementData_PlayerTakesOneStepUp_2:
- step_up
+ step UP
step_end
PokeCenter2FMovementData_PlayerTakesOneStepRight:
- step_right
+ step RIGHT
step_end
PokeCenter2FMovementData_PlayerTakesOneStepLeft:
- step_left
+ step LEFT
step_end
PokeCenter2FMovementData_ReceptionistStepsLeftLooksRight_2:
- slow_step_left
- turn_head_right
+ slow_step LEFT
+ turn_head RIGHT
step_end
PokeCenter2FMovementData_ReceptionistStepsRightLooksLeft_2:
- slow_step_right
- turn_head_left
+ slow_step RIGHT
+ turn_head LEFT
step_end
Text_BattleReceptionistMobile:
--- a/maps/PowerPlant.asm
+++ b/maps/PowerPlant.asm
@@ -202,18 +202,18 @@
jumpstd difficultbookshelf
MovementData_0x188ed5:
- step_right
- step_right
- step_up
- step_up
+ step RIGHT
+ step RIGHT
+ step UP
+ step UP
step_end
MovementData_0x188eda:
- step_down
- step_down
- step_left
- step_left
- turn_head_down
+ step DOWN
+ step DOWN
+ step LEFT
+ step LEFT
+ turn_head DOWN
step_end
UnknownText_0x188ee0:
--- a/maps/RadioTower1F.asm
+++ b/maps/RadioTower1F.asm
@@ -203,13 +203,13 @@
jumptext UnknownText_0x5d631
MovementData_0x5ce71:
- step_right
- turn_head_up
+ step RIGHT
+ turn_head UP
step_end
MovementData_0x5ce74:
- step_left
- turn_head_up
+ step LEFT
+ turn_head UP
step_end
UnknownText_0x5ce77:
--- a/maps/RadioTower2F.asm
+++ b/maps/RadioTower2F.asm
@@ -339,8 +339,8 @@
jumpstd magazinebookshelf
MovementData_0x5d921:
- slow_step_down
- slow_step_right
+ slow_step DOWN
+ slow_step RIGHT
step_end
UnknownText_0x5d924:
--- a/maps/RadioTower5F.asm
+++ b/maps/RadioTower5F.asm
@@ -156,42 +156,42 @@
jumpstd magazinebookshelf
FakeDirectorMovement:
- step_left
- step_left
- step_left
- step_up
- step_up
+ step LEFT
+ step LEFT
+ step LEFT
+ step UP
+ step UP
step_end
RadioTower5FDirectorWalksIn:
- step_down
- step_down
- step_right
- step_right
- step_right
- step_right
- step_down
- step_down
- step_down
- step_left
+ step DOWN
+ step DOWN
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step DOWN
+ step DOWN
+ step DOWN
+ step LEFT
step_end
RadioTower5FDirectorWalksOut:
- step_right
- step_up
- step_up
- step_up
- step_left
- step_left
- step_left
- step_left
- step_up
- step_up
+ step RIGHT
+ step UP
+ step UP
+ step UP
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ step UP
+ step UP
step_end
MovementData_0x60125:
- step_left
- step_left
+ step LEFT
+ step LEFT
step_end
FakeDirectorTextBefore1:
--- a/maps/Route16Gate.asm
+++ b/maps/Route16Gate.asm
@@ -33,8 +33,8 @@
end
MovementData_0x73405:
- step_right
- turn_head_left
+ step RIGHT
+ turn_head LEFT
step_end
UnknownText_0x73408:
--- a/maps/Route1718Gate.asm
+++ b/maps/Route1718Gate.asm
@@ -33,8 +33,8 @@
end
MovementData_0x73629:
- step_right
- turn_head_left
+ step RIGHT
+ turn_head LEFT
step_end
UnknownText_0x7362c:
--- a/maps/Route25.asm
+++ b/maps/Route25.asm
@@ -197,47 +197,47 @@
MovementData_0x19efe8:
- big_step_down
+ big_step DOWN
step_end
MovementData_0x19efea:
- big_step_down
- big_step_down
+ big_step DOWN
+ big_step DOWN
step_end
MovementData_0x19efed:
- step_up
- step_up
- step_up
- step_left
- step_left
- step_left
+ step UP
+ step UP
+ step UP
+ step LEFT
+ step LEFT
+ step LEFT
step_end
MovementData_0x19eff4:
- step_up
- step_up
- step_left
- step_left
- step_left
+ step UP
+ step UP
+ step LEFT
+ step LEFT
+ step LEFT
step_end
MovementData_0x19effa:
- step_down
- step_left
+ step DOWN
+ step LEFT
step_end
MovementData_0x19effd:
- step_up
- step_left
+ step UP
+ step LEFT
step_end
MovementData_0x19f000:
- step_left
- step_left
- step_left
- step_left
- step_left
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
step_end
UnknownText_0x19f006:
--- a/maps/Route27.asm
+++ b/maps/Route27.asm
@@ -310,12 +310,12 @@
itemball RARE_CANDY
MovementData_0x1a0a66:
- step_left
- step_left
+ step LEFT
+ step LEFT
step_end
MovementData_0x1a0a69:
- step_left
+ step LEFT
step_end
UnknownText_0x1a0a6b:
--- a/maps/Route29.asm
+++ b/maps/Route29.asm
@@ -220,37 +220,37 @@
itemball POTION
DudeMovementData1a:
- step_up
- step_up
- step_up
- step_up
- step_right
- step_right
+ step UP
+ step UP
+ step UP
+ step UP
+ step RIGHT
+ step RIGHT
step_end
DudeMovementData2a:
- step_up
- step_up
- step_up
- step_right
- step_right
+ step UP
+ step UP
+ step UP
+ step RIGHT
+ step RIGHT
step_end
DudeMovementData1b:
- step_left
- step_left
- step_down
- step_down
- step_down
- step_down
+ step LEFT
+ step LEFT
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
step_end
DudeMovementData2b:
- step_left
- step_left
- step_down
- step_down
- step_down
+ step LEFT
+ step LEFT
+ step DOWN
+ step DOWN
+ step DOWN
step_end
UnknownText_0x1a10a7:
--- a/maps/Route30.asm
+++ b/maps/Route30.asm
@@ -253,14 +253,14 @@
Route30_JoeysRattataAttacksMovement:
fix_facing
- big_step_up
- big_step_down
+ big_step UP
+ big_step DOWN
step_end
Route30_MikeysRattataAttacksMovement:
fix_facing
- big_step_down
- big_step_up
+ big_step DOWN
+ big_step UP
step_end
Text_UseTackle:
--- a/maps/Route32.asm
+++ b/maps/Route32.asm
@@ -519,16 +519,16 @@
Movement_Route32CooltrainerMPushesYouBackToViolet:
- step_up
- step_up
+ step UP
+ step UP
step_end
Movement_Route32CooltrainerMReset1:
- step_down
+ step DOWN
step_end
Movement_Route32CooltrainerMReset2:
- step_right
+ step RIGHT
step_end
Route32CooltrainerMText_WhatsTheHurry:
--- a/maps/Route34.asm
+++ b/maps/Route34.asm
@@ -499,17 +499,17 @@
Route34MovementData_DayCareManWalksBackInside:
- slow_step_left
- slow_step_left
- slow_step_up
+ slow_step LEFT
+ slow_step LEFT
+ slow_step UP
step_end
Route34MovementData_DayCareManWalksBackInside_WalkAroundPlayer:
- slow_step_down
- slow_step_left
- slow_step_left
- slow_step_up
- slow_step_up
+ slow_step DOWN
+ slow_step LEFT
+ slow_step LEFT
+ slow_step UP
+ slow_step UP
step_end
YoungsterSamuelSeenText:
--- a/maps/Route34IlexForestGate.asm
+++ b/maps/Route34IlexForestGate.asm
@@ -82,13 +82,13 @@
jumptextfaceplayer UnknownText_0x62e97
MovementData_0x62d97:
- step_up
- step_up
+ step UP
+ step UP
step_end
MovementData_0x62d9a:
- step_down
- step_right
+ step DOWN
+ step RIGHT
step_end
UnknownText_0x62d9d:
--- a/maps/Route35NationalParkgate.asm
+++ b/maps/Route35NationalParkgate.asm
@@ -216,18 +216,18 @@
end
MovementData_0x6a2e2:
- step_down
- turn_head_left
+ step DOWN
+ turn_head LEFT
step_end
MovementData_0x6a2e5:
- step_right
- step_up
- step_up
+ step RIGHT
+ step UP
+ step UP
step_end
MovementData_0x6a2e9:
- step_up
+ step UP
step_end
UnknownText_0x6a2eb:
--- a/maps/Route36.asm
+++ b/maps/Route36.asm
@@ -99,7 +99,7 @@
applymovement ROUTE36_WEIRD_TREE, WeirdTreeMovement_Flee
disappear ROUTE36_WEIRD_TREE
variablesprite SPRITE_WEIRD_TREE, SPRITE_TWIN
- special RunCallback_04
+ special MapCallbackSprites_LoadUsedSpritesGFX
special RefreshSprites
end
@@ -376,42 +376,42 @@
step_end
WeirdTreeMovement_Flee:
- fast_jump_step_up
- fast_jump_step_up
+ fast_jump_step UP
+ fast_jump_step UP
step_end
FloriaMovement1:
- step_down
- step_down
- step_down
- step_left
- step_left
- step_left
- step_left
- step_left
- step_left
+ step DOWN
+ step DOWN
+ step DOWN
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
step_end
FloriaMovement2:
- step_left
- step_down
- step_down
- step_down
- step_left
- step_left
- step_left
- step_left
- step_left
+ step LEFT
+ step DOWN
+ step DOWN
+ step DOWN
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
step_end
Route36SuicuneMovement:
set_sliding
- fast_jump_step_down
- fast_jump_step_down
- fast_jump_step_down
- fast_jump_step_right
- fast_jump_step_right
- fast_jump_step_right
+ fast_jump_step DOWN
+ fast_jump_step DOWN
+ fast_jump_step DOWN
+ fast_jump_step RIGHT
+ fast_jump_step RIGHT
+ fast_jump_step RIGHT
remove_sliding
step_end
--- a/maps/Route36NationalParkgate.asm
+++ b/maps/Route36NationalParkgate.asm
@@ -475,9 +475,9 @@
jumptext UnknownText_0x6b84c
MovementData_0x6add1:
- big_step_down
- big_step_right
- turn_head_up
+ big_step DOWN
+ big_step RIGHT
+ turn_head UP
step_end
UnknownText_0x6add5:
--- a/maps/Route40.asm
+++ b/maps/Route40.asm
@@ -141,28 +141,28 @@
dwb EVENT_ROUTE_40_HIDDEN_HYPER_POTION, HYPER_POTION
MovementData_0x1a621c:
- step_right
- step_up
- step_up
- step_up
- step_up
- step_up
- step_up
+ step RIGHT
+ step UP
+ step UP
+ step UP
+ step UP
+ step UP
+ step UP
step_end
MovementData_0x1a6224:
- step_up
- step_up
- step_up
- step_up
- step_up
+ step UP
+ step UP
+ step UP
+ step UP
+ step UP
step_end
MovementData_0x1a622a:
- step_up
- step_up
- step_up
- step_up
+ step UP
+ step UP
+ step UP
+ step UP
step_end
SwimmermSimonSeenText:
--- a/maps/Route42.asm
+++ b/maps/Route42.asm
@@ -219,12 +219,12 @@
MovementData_0x1a9356:
db $39 ; movement
- fast_jump_step_up
- fast_jump_step_up
- fast_jump_step_up
- fast_jump_step_right
- fast_jump_step_right
- fast_jump_step_right
+ fast_jump_step UP
+ fast_jump_step UP
+ fast_jump_step UP
+ fast_jump_step RIGHT
+ fast_jump_step RIGHT
+ fast_jump_step RIGHT
db $38 ; movement
step_end
--- a/maps/Route43Gate.asm
+++ b/maps/Route43Gate.asm
@@ -132,69 +132,69 @@
end
MovementData_0x19aca2:
- step_down
+ step DOWN
step_end
MovementData_0x19aca4:
- big_step_up
- big_step_up
- big_step_right
- big_step_right
- turn_head_up
+ big_step UP
+ big_step UP
+ big_step RIGHT
+ big_step RIGHT
+ turn_head UP
step_end
MovementData_0x19acaa:
- big_step_left
- big_step_left
- big_step_down
- big_step_down
+ big_step LEFT
+ big_step LEFT
+ big_step DOWN
+ big_step DOWN
step_end
MovementData_0x19acaf:
- big_step_down
- big_step_down
- big_step_right
- big_step_right
- turn_head_down
+ big_step DOWN
+ big_step DOWN
+ big_step RIGHT
+ big_step RIGHT
+ turn_head DOWN
step_end
MovementData_0x19acb5:
- big_step_left
- big_step_left
- big_step_up
- big_step_up
- turn_head_down
+ big_step LEFT
+ big_step LEFT
+ big_step UP
+ big_step UP
+ turn_head DOWN
step_end
MovementData_0x19acbb:
- big_step_up
- big_step_up
- big_step_left
- big_step_left
- turn_head_up
+ big_step UP
+ big_step UP
+ big_step LEFT
+ big_step LEFT
+ turn_head UP
step_end
MovementData_0x19acc1:
- big_step_right
- big_step_right
- big_step_down
- big_step_down
- turn_head_up
+ big_step RIGHT
+ big_step RIGHT
+ big_step DOWN
+ big_step DOWN
+ turn_head UP
step_end
MovementData_0x19acc7:
- big_step_down
- big_step_down
- big_step_left
- big_step_left
- turn_head_down
+ big_step DOWN
+ big_step DOWN
+ big_step LEFT
+ big_step LEFT
+ turn_head DOWN
step_end
MovementData_0x19accd:
- big_step_right
- big_step_right
- big_step_up
- big_step_up
+ big_step RIGHT
+ big_step RIGHT
+ big_step UP
+ big_step UP
step_end
UnknownText_0x19acd2:
--- a/maps/RuinsofAlphOutside.asm
+++ b/maps/RuinsofAlphOutside.asm
@@ -140,20 +140,20 @@
jumptext UnknownText_0x58362
MovementData_0x580ba:
- step_right
- step_right
- step_right
- step_right
- step_up
- step_up
- step_right
- step_right
- step_up
- step_up
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step UP
+ step UP
+ step RIGHT
+ step RIGHT
+ step UP
+ step UP
step_end
MovementData_0x580c5:
- step_up
+ step UP
step_end
UnknownText_0x580c7:
--- a/maps/RuinsofAlphResearchCenter.asm
+++ b/maps/RuinsofAlphResearchCenter.asm
@@ -181,18 +181,18 @@
jumptext UnknownText_0x59886
MovementData_0x5926f:
- step_up
- step_up
- step_left
- turn_head_up
+ step UP
+ step UP
+ step LEFT
+ turn_head UP
step_end
MovementData_0x59274:
- step_down
+ step DOWN
step_end
MovementData_0x59276:
- step_up
+ step UP
step_end
UnknownText_0x59278:
--- a/maps/SaffronTrainStation.asm
+++ b/maps/SaffronTrainStation.asm
@@ -47,7 +47,7 @@
end
.MovementBoardTheTrain:
- turn_head_down
+ turn_head DOWN
step_end
.PassNotInBag:
@@ -95,37 +95,37 @@
jumptextfaceplayer UnknownText_0x18ab20
MovementData_0x18a88f:
- step_up
- step_up
- step_right
- turn_head_left
+ step UP
+ step UP
+ step RIGHT
+ turn_head LEFT
step_end
MovementData_0x18a894:
- step_left
- step_down
- step_down
+ step LEFT
+ step DOWN
+ step DOWN
step_end
MovementData_0x18a898:
- step_up
- step_up
- step_up
- step_left
- step_left
- step_left
- step_up
- step_up
+ step UP
+ step UP
+ step UP
+ step LEFT
+ step LEFT
+ step LEFT
+ step UP
+ step UP
step_end
MovementData_0x18a8a1:
- step_left
- step_left
- step_down
- step_down
- step_down
- step_down
- turn_head_up
+ step LEFT
+ step LEFT
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ turn_head UP
step_end
UnknownText_0x18a8a9:
--- a/maps/SlowpokeWellB1F.asm
+++ b/maps/SlowpokeWellB1F.asm
@@ -127,21 +127,21 @@
itemball SUPER_POTION
KurtSlowpokeWellVictoryMovementData:
- step_left
- step_left
- step_left
- step_left
- step_up
- step_sleep_8
- step_sleep_8
- step_sleep_8
- step_left
- step_up
- step_up
- step_sleep_8
- step_sleep_8
- step_sleep_8
- turn_head_left
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ step UP
+ step_sleep 8
+ step_sleep 8
+ step_sleep 8
+ step LEFT
+ step UP
+ step UP
+ step_sleep 8
+ step_sleep 8
+ step_sleep 8
+ turn_head LEFT
step_end
UnknownText_0x5a6b5:
--- a/maps/SproutTower3F.asm
+++ b/maps/SproutTower3F.asm
@@ -140,19 +140,19 @@
itemball ESCAPE_ROPE
MovementData_0x184a1d:
- step_up
- step_up
- step_up
- step_up
+ step UP
+ step UP
+ step UP
+ step UP
step_end
MovementData_0x184a22:
- step_up
+ step UP
step_end
MovementData_0x184a24:
- step_right
- step_down
+ step RIGHT
+ step DOWN
step_end
UnknownText_0x184a27:
--- a/maps/TeamRocketBaseB1F.asm
+++ b/maps/TeamRocketBaseB1F.asm
@@ -549,91 +549,91 @@
SecurityCameraMovement1:
- big_step_right
- big_step_right
- big_step_right
- big_step_right
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
step_end
SecurityCameraMovement2:
- big_step_up
- big_step_right
- big_step_up
- big_step_up
- big_step_up
- big_step_up
- turn_head_right
+ big_step UP
+ big_step RIGHT
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step UP
+ turn_head RIGHT
step_end
SecurityCameraMovement3:
- big_step_left
- big_step_left
- big_step_left
- big_step_up
- big_step_up
- big_step_up
- big_step_left
- big_step_left
+ big_step LEFT
+ big_step LEFT
+ big_step LEFT
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step LEFT
+ big_step LEFT
step_end
SecurityCameraMovement4:
; he jumps over a trap
- jump_step_up
- big_step_right
- big_step_up
- big_step_up
- big_step_up
- turn_head_right
+ jump_step UP
+ big_step RIGHT
+ big_step UP
+ big_step UP
+ big_step UP
+ turn_head RIGHT
step_end
SecurityCameraMovement5:
- big_step_left
- big_step_left
- big_step_left
- big_step_up
- big_step_up
- big_step_left
- big_step_left
+ big_step LEFT
+ big_step LEFT
+ big_step LEFT
+ big_step UP
+ big_step UP
+ big_step LEFT
+ big_step LEFT
step_end
SecurityCameraMovement6:
- big_step_up
- big_step_up
- big_step_right
- big_step_up
- big_step_up
- big_step_up
- big_step_left
+ big_step UP
+ big_step UP
+ big_step RIGHT
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step LEFT
step_end
SecurityCameraMovement7:
- big_step_up
- big_step_up
- big_step_up
- big_step_right
- big_step_up
- big_step_up
- big_step_left
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step RIGHT
+ big_step UP
+ big_step UP
+ big_step LEFT
step_end
SecurityCameraMovement8:
- big_step_down
- big_step_down
- big_step_right
- big_step_down
- big_step_down
- big_step_down
- big_step_left
- big_step_left
- big_step_left
+ big_step DOWN
+ big_step DOWN
+ big_step RIGHT
+ big_step DOWN
+ big_step DOWN
+ big_step DOWN
+ big_step LEFT
+ big_step LEFT
+ big_step LEFT
step_end
SecurityCameraMovement9:
- big_step_left
- big_step_left
- big_step_left
- big_step_left
- big_step_left
+ big_step LEFT
+ big_step LEFT
+ big_step LEFT
+ big_step LEFT
+ big_step LEFT
step_end
CameraGrunt1SeenText:
--- a/maps/TeamRocketBaseB2F.asm
+++ b/maps/TeamRocketBaseB2F.asm
@@ -367,204 +367,204 @@
MovementData_0x6d212:
- step_right
- step_right
- step_right
- step_right
- step_right
- step_right
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
step_end
MovementData_0x6d219:
- step_right
- step_right
- step_right
- step_right
- step_right
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
step_end
MovementData_0x6d21f:
- step_down
- step_down
- step_down
- turn_head_right
+ step DOWN
+ step DOWN
+ step DOWN
+ turn_head RIGHT
step_end
MovementData_0x6d224:
- big_step_left
- big_step_left
- big_step_up
- big_step_up
- big_step_up
- big_step_left
- big_step_left
- big_step_left
- big_step_left
- turn_head_down
+ big_step LEFT
+ big_step LEFT
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step LEFT
+ big_step LEFT
+ big_step LEFT
+ big_step LEFT
+ turn_head DOWN
step_end
MovementData_0x6d22f:
- big_step_left
- big_step_left
- big_step_up
- big_step_up
- big_step_left
- big_step_left
+ big_step LEFT
+ big_step LEFT
+ big_step UP
+ big_step UP
+ big_step LEFT
+ big_step LEFT
step_end
MovementData_0x6d236:
- big_step_right
- big_step_right
- big_step_right
- big_step_right
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
step_end
MovementData_0x6d23b:
fix_facing
db $39 ; movement
- jump_step_right
+ jump_step RIGHT
db $38 ; movement
remove_fixed_facing
step_end
MovementData_0x6d241:
- slow_step_down
- turn_head_left
+ slow_step DOWN
+ turn_head LEFT
step_end
MovementData_0x6d244:
- step_right
- step_right
- step_right
+ step RIGHT
+ step RIGHT
+ step RIGHT
step_end
MovementData_0x6d248:
- big_step_left
+ big_step LEFT
step_end
MovementData_0x6d24a:
- big_step_left
+ big_step LEFT
step_end
MovementData_0x6d24c:
- big_step_left
- big_step_up
- turn_head_left
+ big_step LEFT
+ big_step UP
+ turn_head LEFT
step_end
MovementData_0x6d250:
- step_right
- step_right
- turn_head_down
+ step RIGHT
+ step RIGHT
+ turn_head DOWN
step_end
MovementData_0x6d254:
- step_up
- step_up
- step_up
+ step UP
+ step UP
+ step UP
step_end
MovementData_0x6d258:
- step_sleep_8
- step_left
- step_left
- turn_head_up
- step_sleep_8
- step_right
- step_right
- step_right
- step_right
- turn_head_up
- step_sleep_8
- step_left
- step_left
- turn_head_down
+ step_sleep 8
+ step LEFT
+ step LEFT
+ turn_head UP
+ step_sleep 8
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ turn_head UP
+ step_sleep 8
+ step LEFT
+ step LEFT
+ turn_head DOWN
step_end
MovementData_0x6d267:
- step_right
- step_right
- step_right
- step_right
- step_up
- step_up
- step_up
- step_up
- step_up
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step UP
+ step UP
+ step UP
+ step UP
+ step UP
step_end
MovementData_0x6d271:
- step_up
- step_left
- step_left
- step_left
- step_left
- turn_head_up
+ step UP
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ turn_head UP
step_end
MovementData_0x6d278:
- step_left
+ step LEFT
step_end
MovementData_0x6d27a:
- step_down
- step_down
- step_down
- step_down
- step_down
- step_left
- step_left
- step_left
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step LEFT
+ step LEFT
+ step LEFT
step_end
MovementData_0x6d283:
- step_down
- step_down
- step_left
- step_left
- step_left
- step_left
- step_left
- step_left
+ step DOWN
+ step DOWN
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
step_end
MovementData_0x6d28c:
- step_right
- step_right
- step_down
- step_down
- step_down
- step_down
- step_down
- step_down
- step_right
- step_right
- step_right
- step_right
+ step RIGHT
+ step RIGHT
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
step_end
MovementData_0x6d299:
- step_right
- step_right
- step_down
- step_down
- step_down
- step_down
- step_right
- step_right
- step_right
- step_right
+ step RIGHT
+ step RIGHT
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
step_end
MovementData_0x6d2a4:
- step_right
- step_right
- step_down
- step_down
- step_right
- step_right
- step_right
- step_right
+ step RIGHT
+ step RIGHT
+ step DOWN
+ step DOWN
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
step_end
UnknownText_0x6d2ad:
--- a/maps/TeamRocketBaseB3F.asm
+++ b/maps/TeamRocketBaseB3F.asm
@@ -226,101 +226,101 @@
itemball ULTRA_BALL
MovementData_0x6e12a:
- step_right
+ step RIGHT
step_end
MovementData_0x6e12c:
- step_down
- step_left
- step_left
- step_left
- step_left
- step_left
+ step DOWN
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
step_end
MovementData_0x6e133:
- step_up
- step_up
- step_up
- step_left
- step_left
- turn_head_up
+ step UP
+ step UP
+ step UP
+ step LEFT
+ step LEFT
+ turn_head UP
step_end
MovementData_0x6e13a:
- step_up
- step_up
- step_left
- step_up
- step_left
- step_left
- turn_head_up
+ step UP
+ step UP
+ step LEFT
+ step UP
+ step LEFT
+ step LEFT
+ turn_head UP
step_end
MovementData_0x6e142:
- step_down
+ step DOWN
step_end
MovementData_0x6e144:
- big_step_right
- big_step_right
+ big_step RIGHT
+ big_step RIGHT
step_end
MovementData_0x6e147:
fix_facing
- fast_jump_step_left
+ fast_jump_step LEFT
remove_fixed_facing
- step_sleep_8
- step_sleep_8
- slow_step_right
- big_step_down
- big_step_down
- big_step_down
- big_step_right
- big_step_down
- big_step_down
- big_step_down
- big_step_left
- big_step_left
- big_step_left
- big_step_left
- big_step_left
- big_step_up
- big_step_up
- big_step_up
- big_step_up
- big_step_up
- big_step_up
- big_step_up
- big_step_up
- big_step_left
- big_step_left
+ step_sleep 8
+ step_sleep 8
+ slow_step RIGHT
+ big_step DOWN
+ big_step DOWN
+ big_step DOWN
+ big_step RIGHT
+ big_step DOWN
+ big_step DOWN
+ big_step DOWN
+ big_step LEFT
+ big_step LEFT
+ big_step LEFT
+ big_step LEFT
+ big_step LEFT
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step UP
+ big_step LEFT
+ big_step LEFT
step_end
RocketBaseRivalEnterMovement:
- step_down
- step_down
- step_down
- step_down
- step_down
- step_right
- step_right
- step_right
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step RIGHT
+ step RIGHT
+ step RIGHT
step_end
RocketBaseRivalLeaveMovement:
- step_left
- step_left
- step_up
- step_up
- step_up
- step_up
- step_up
+ step LEFT
+ step LEFT
+ step UP
+ step UP
+ step UP
+ step UP
+ step UP
step_end
RocketBaseRivalShovesPlayerMovement:
fix_facing
- big_step_right
+ big_step RIGHT
remove_fixed_facing
step_end
--- a/maps/TinTower1F.asm
+++ b/maps/TinTower1F.asm
@@ -236,83 +236,83 @@
jumptextfaceplayer TinTowerEusineHoOhText
TinTowerPlayerMovement1:
- slow_step_up
- slow_step_up
- slow_step_up
- slow_step_up
+ slow_step UP
+ slow_step UP
+ slow_step UP
+ slow_step UP
step_end
TinTowerRaikouMovement1:
set_sliding
- fast_jump_step_down
+ fast_jump_step DOWN
remove_sliding
step_end
TinTowerRaikouMovement2:
set_sliding
- fast_jump_step_down
- fast_jump_step_right
- fast_jump_step_down
+ fast_jump_step DOWN
+ fast_jump_step RIGHT
+ fast_jump_step DOWN
remove_sliding
step_end
TinTowerEnteiMovement1:
set_sliding
- fast_jump_step_down
+ fast_jump_step DOWN
remove_sliding
step_end
TinTowerEnteiMovement2:
set_sliding
- fast_jump_step_down
- fast_jump_step_left
- fast_jump_step_down
+ fast_jump_step DOWN
+ fast_jump_step LEFT
+ fast_jump_step DOWN
remove_sliding
step_end
TinTowerSuicuneMovement:
set_sliding
- fast_jump_step_down
+ fast_jump_step DOWN
remove_sliding
step_end
TinTowerPlayerMovement2:
fix_facing
- big_step_down
+ big_step DOWN
remove_fixed_facing
step_end
MovementData_0x1851ec:
- step_up
- step_up
- step_up
- turn_head_left
+ step UP
+ step UP
+ step UP
+ turn_head LEFT
step_end
MovementData_0x1851f1:
- step_down
- step_down
- step_down
+ step DOWN
+ step DOWN
+ step DOWN
step_end
MovementData_0x1851f5:
- step_up
- step_up
- step_left
- step_left
- turn_head_up
+ step UP
+ step UP
+ step LEFT
+ step LEFT
+ turn_head UP
step_end
MovementData_0x1851fb:
- step_up
- step_up
+ step UP
+ step UP
step_end
MovementData_0x1851fe:
- step_up
- step_right
- step_right
- step_up
+ step UP
+ step RIGHT
+ step RIGHT
+ step UP
step_end
TinTowerEusineSuicuneText:
--- a/maps/TrainerHouseB1F.asm
+++ b/maps/TrainerHouseB1F.asm
@@ -77,40 +77,40 @@
end
Movement_EnterTrainerHouseBattleRoom:
- step_left
- step_left
- step_left
- step_down
- step_down
- step_down
- step_down
- step_down
- step_down
- step_down
- step_down
- step_left
- turn_head_right
+ step LEFT
+ step LEFT
+ step LEFT
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step LEFT
+ turn_head RIGHT
step_end
Movement_ExitTrainerHouseBattleRoom:
- step_up
- step_up
- step_up
- step_right
- step_up
- step_up
- step_up
- step_up
- step_up
- step_right
- step_right
- step_right
- step_right
+ step UP
+ step UP
+ step UP
+ step RIGHT
+ step UP
+ step UP
+ step UP
+ step UP
+ step UP
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
step_end
Movement_TrainerHouseTurnBack:
- step_right
- turn_head_left
+ step RIGHT
+ turn_head LEFT
step_end
TrainerHouseB1FIntroText:
--- a/maps/UndergroundPathSwitchRoomEntrances.asm
+++ b/maps/UndergroundPathSwitchRoomEntrances.asm
@@ -643,33 +643,33 @@
UndergroundSilverApproachMovement1:
- step_down
- step_left
- step_left
- step_left
+ step DOWN
+ step LEFT
+ step LEFT
+ step LEFT
step_end
UndergroundSilverApproachMovement2:
- step_down
- step_down
- step_left
- step_left
- step_left
+ step DOWN
+ step DOWN
+ step LEFT
+ step LEFT
+ step LEFT
step_end
UndergroundSilverRetreatMovement1:
- step_right
- step_right
- step_right
- step_up
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step UP
step_end
UndergroundSilverRetreatMovement2:
- step_right
- step_right
- step_right
- step_up
- step_up
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step UP
+ step UP
step_end
UndergroundSilverBeforeText:
--- a/maps/VermilionPort.asm
+++ b/maps/VermilionPort.asm
@@ -203,34 +203,34 @@
MovementData_0x74ef1:
- step_down
+ step DOWN
step_end
MovementData_0x74ef3:
- step_up
+ step UP
step_end
MovementData_0x74ef5:
- step_right
- turn_head_left
+ step RIGHT
+ turn_head LEFT
step_end
MovementData_0x74ef8:
- step_down
- step_down
- step_down
- step_down
- step_down
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
step_end
MovementData_0x74efe:
- step_right
- step_down
- step_down
- step_down
- step_down
- step_down
- step_down
+ step RIGHT
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
step_end
UnknownText_0x74f06:
--- a/maps/VictoryRoad.asm
+++ b/maps/VictoryRoad.asm
@@ -122,49 +122,49 @@
MovementData_0x74539:
- step_left
- step_left
- step_left
- step_left
- step_left
- step_left
- step_up
- step_up
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ step UP
+ step UP
step_end
MovementData_0x74542:
- step_up
- step_up
- step_left
- step_left
- step_left
- step_left
- step_left
- step_up
- step_up
+ step UP
+ step UP
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ step LEFT
+ step UP
+ step UP
step_end
MovementData_0x7454c:
- step_down
- step_down
- step_right
- step_right
- step_right
- step_right
- step_right
- step_right
+ step DOWN
+ step DOWN
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
step_end
MovementData_0x74555:
- step_down
- step_down
- step_right
- step_right
- step_right
- step_right
- step_right
- step_down
- step_down
+ step DOWN
+ step DOWN
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step RIGHT
+ step DOWN
+ step DOWN
step_end
UnknownText_0x7455f:
--- a/maps/VictoryRoadGate.asm
+++ b/maps/VictoryRoadGate.asm
@@ -52,7 +52,7 @@
jumptextfaceplayer UnknownText_0x9bb37
MovementData_0x9ba27:
- step_down
+ step DOWN
step_end
UnknownText_0x9ba29:
--- a/maps/VioletCity.asm
+++ b/maps/VioletCity.asm
@@ -103,82 +103,82 @@
dwb EVENT_VIOLET_CITY_HIDDEN_HYPER_POTION, HYPER_POTION
VioletCityFollowEarl_MovementData:
- big_step_down
- big_step_down
- turn_head_down
- turn_head_left
- turn_head_up
- turn_head_right
- turn_head_down
- turn_head_left
- turn_head_up
- turn_head_right
- big_step_right
- big_step_right
- big_step_right
- big_step_right
- big_step_right
- big_step_right
- big_step_right
- big_step_right
- big_step_right
- turn_head_right
- turn_head_down
- turn_head_left
- turn_head_up
- turn_head_right
- turn_head_down
- turn_head_left
- turn_head_up
- turn_head_right
- turn_head_down
- big_step_down
- turn_head_down
- turn_head_left
- turn_head_up
- turn_head_right
- turn_head_down
- turn_head_left
- turn_head_up
- turn_head_right
- big_step_right
- big_step_right
- big_step_right
- big_step_right
- big_step_right
- big_step_right
- big_step_right
- big_step_right
- turn_head_right
- turn_head_down
- turn_head_left
- turn_head_up
- turn_head_right
- turn_head_down
- turn_head_left
- turn_head_up
- big_step_up
- turn_head_down
+ big_step DOWN
+ big_step DOWN
+ turn_head DOWN
+ turn_head LEFT
+ turn_head UP
+ turn_head RIGHT
+ turn_head DOWN
+ turn_head LEFT
+ turn_head UP
+ turn_head RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ turn_head RIGHT
+ turn_head DOWN
+ turn_head LEFT
+ turn_head UP
+ turn_head RIGHT
+ turn_head DOWN
+ turn_head LEFT
+ turn_head UP
+ turn_head RIGHT
+ turn_head DOWN
+ big_step DOWN
+ turn_head DOWN
+ turn_head LEFT
+ turn_head UP
+ turn_head RIGHT
+ turn_head DOWN
+ turn_head LEFT
+ turn_head UP
+ turn_head RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ big_step RIGHT
+ turn_head RIGHT
+ turn_head DOWN
+ turn_head LEFT
+ turn_head UP
+ turn_head RIGHT
+ turn_head DOWN
+ turn_head LEFT
+ turn_head UP
+ big_step UP
+ turn_head DOWN
step_end
VioletCityFinishFollowEarl_MovementData:
- step_up
+ step UP
step_end
VioletCitySpinningEarl_MovementData:
- turn_head_down
- turn_head_left
- turn_head_up
- turn_head_right
- turn_head_down
- turn_head_left
- turn_head_up
- turn_head_right
- turn_head_down
- turn_head_left
- turn_head_up
- turn_head_right
- turn_head_down
+ turn_head DOWN
+ turn_head LEFT
+ turn_head UP
+ turn_head RIGHT
+ turn_head DOWN
+ turn_head LEFT
+ turn_head UP
+ turn_head RIGHT
+ turn_head DOWN
+ turn_head LEFT
+ turn_head UP
+ turn_head RIGHT
+ turn_head DOWN
step_end
Text_EarlAsksIfYouBeatFalkner:
--- a/maps/VioletPokeCenter1F.asm
+++ b/maps/VioletPokeCenter1F.asm
@@ -88,21 +88,21 @@
jumptextfaceplayer UnknownText_0x698b8
MovementData_AideWalksStraightOutOfPokecenter:
- step_down
- step_down
- step_down
- step_down
+ step DOWN
+ step DOWN
+ step DOWN
+ step DOWN
step_end
MovementData_AideWalksLeftToExitPokecenter:
- step_left
- step_down
+ step LEFT
+ step DOWN
step_end
MovementData_AideFinishesLeavingPokecenter:
- step_down
- step_down
- step_down
+ step DOWN
+ step DOWN
+ step DOWN
step_end
UnknownText_0x69555:
--- a/maps/WillsRoom.asm
+++ b/maps/WillsRoom.asm
@@ -79,10 +79,10 @@
end
MovementData_0x18052c:
- step_up
- step_up
- step_up
- step_up
+ step UP
+ step UP
+ step UP
+ step UP
step_end
UnknownText_0x180531:
--- a/maps/WiseTriosRoom.asm
+++ b/maps/WiseTriosRoom.asm
@@ -121,18 +121,18 @@
end
MovementData_0x98622:
- step_left
- step_left
+ step LEFT
+ step LEFT
step_end
MovementData_0x98625:
- step_right
- step_down
+ step RIGHT
+ step DOWN
step_end
MovementData_0x98628:
- step_right
- step_down
+ step RIGHT
+ step DOWN
step_end
UnknownText_0x9862b:
--- a/misc/battle_tower_47.asm
+++ b/misc/battle_tower_47.asm
@@ -61,9 +61,8 @@
.okay2
push af
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld c, a
ld a, [hl]
@@ -72,9 +71,8 @@
pop af
ld c, a
ld b, 0
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld c, a
ld a, [hl]
@@ -83,7 +81,7 @@
bccoord 1, 14
pop af
ld [rSVBK], a
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
ret
; 11c05d
--- a/misc/battle_tower_5c.asm
+++ b/misc/battle_tower_5c.asm
@@ -111,7 +111,7 @@
call CopyBytes
ld bc, PlayerID
ld de, PlayerGender
- callba Function4e929
+ callba GetMobileOTTrainerClass
ld de, wBT_OTTempPkmn1CaughtGender
ld a, c
ld [de], a
@@ -217,9 +217,8 @@
ld e, a
ld d, 0
ld hl, .dw
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -459,9 +458,8 @@
ld a, POUND
ld [hli], a
xor a
-rept 2
ld [hli], a
-endr
+ ld [hli], a
ld [hl], a
jr .done_moves
@@ -489,9 +487,8 @@
predef CalcPkmnStats
pop de
pop hl
-rept 2
dec de
-endr
+ dec de
ld a, [hli]
ld [de], a
inc de
@@ -690,9 +687,8 @@
ld e, a
ld d, 0
ld hl, .dw
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -908,9 +904,8 @@
ld [hli], a
dec c
jr nz, .clearbox_column
-rept 2
inc hl
-endr
+ inc hl
dec b
jr nz, .clearbox_row
ret
@@ -947,9 +942,8 @@
ld e, a
ld d, 0
ld hl, .dw
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -1393,9 +1387,8 @@
dec hl
endr
ld a, "@"
-rept 2
ld [hli], a
-endr
+ ld [hli], a
pop hl
ld a, EGG_TICKET
ld [CurItem], a
@@ -1445,9 +1438,8 @@
ld e, a
ld d, 0
ld hl, Jumptable_1709e7
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
--- a/misc/crystal_misc.asm
+++ b/misc/crystal_misc.asm
@@ -47,7 +47,7 @@
call Function17aba0
callba Function106464
call Function17ac0c
- callba Function104000
+ callba HDMATransferAttrMapAndTileMapToWRAMBank3
call Function17abcf
callba LoadOW_BGPal7
callba Function49420
@@ -169,7 +169,7 @@
bit 7, [hl]
res 7, [hl]
jr nz, .asm_17a79f
- callba Function10402d
+ callba HDMATransferTileMapToWRAMBank3
ret
.asm_17a79f
@@ -576,16 +576,16 @@
push de
ld a, $3
call Function17aae0
-rept 3
add a
-endr
+ add a
+ add a
add $0
push af
ld a, $4
call Function17aae0
-rept 3
add a
-endr
+ add a
+ add a
add $8
ld c, a
pop af
@@ -682,15 +682,13 @@
Function17aac3: ; 17aac3 (5e:6ac3)
ld a, $b
push hl
-rept 2
ld [hli], a
-endr
+ ld [hli], a
pop hl
ld de, SCREEN_WIDTH
add hl, de
-rept 2
ld [hli], a
-endr
+ ld [hli], a
ret
Function17aad0: ; 17aad0 (5e:6ad0)
--- a/misc/fixed_words.asm
+++ b/misc/fixed_words.asm
@@ -4,24 +4,23 @@
Function11c05d: ; 11c05d
ld a, e
or d
- jr z, .asm_11c071
+ jr z, .error
ld a, e
and d
cp $ff
- jr z, .asm_11c071
+ jr z, .error
push hl
- call Function11c156
+ call CopyMobileEZChatToC608
pop hl
call PlaceString
and a
ret
-.asm_11c071
+.error
ld c, l
ld b, h
scf
ret
-
; 11c075
Function11c075: ; 11c075
@@ -32,18 +31,17 @@
ld bc, wcd36
call Function11c08f
ret
-
; 11c082
Function11c082: ; 11c082
+; XXX
push de
ld a, c
call Function11c254
pop de
ld bc, wcd36
- call Function11c0c6
+ call PrintEZChatBattleMessage
ret
-
; 11c08f
Function11c08f: ; 11c08f
@@ -50,8 +48,8 @@
ld l, e
ld h, d
push hl
- ld a, $3
-.asm_11c094
+ ld a, 3
+.loop
push af
ld a, [bc]
ld e, a
@@ -61,21 +59,21 @@
inc bc
push bc
call Function11c05d
- jr c, .asm_11c0a2
+ jr c, .okay
inc bc
-.asm_11c0a2
+.okay
ld l, c
ld h, b
pop bc
pop af
dec a
- jr nz, .asm_11c094
+ jr nz, .loop
pop hl
- ld de, $0028
+ ld de, 2 * SCREEN_WIDTH
add hl, de
ld a, $3
-.asm_11c0b0
+.loop2
push af
ld a, [bc]
ld e, a
@@ -85,38 +83,43 @@
inc bc
push bc
call Function11c05d
- jr c, .asm_11c0be
+ jr c, .okay2
inc bc
-.asm_11c0be
+.okay2
ld l, c
ld h, b
pop bc
pop af
dec a
- jr nz, .asm_11c0b0
+ jr nz, .loop2
ret
-
; 11c0c6
-
-Function11c0c6: ; 11c0c6
+PrintEZChatBattleMessage: ; 11c0c6
+; Use up to 6 words from bc to print text starting at de.
+ ; Preserve $cf63, $cf64
ld a, [wJumptableIndex]
ld l, a
ld a, [wcf64]
ld h, a
push hl
- ld hl, $c608 + 16
+ ; reset value at c618 (not preserved)
+ ld hl, $c618
ld a, $0
ld [hli], a
+ ; preserve de
push de
+ ; $cf63 keeps track of which line we're on (0, 1, or 2)
+ ; $cf64 keeps track of how much room we have left in the current line
xor a
ld [wJumptableIndex], a
- ld a, $12
+ ld a, 18
ld [wcf64], a
- ld a, $6
-.asm_11c0e1
+ ld a, $6 ; up to 6 times
+.loop
push af
+ ; load the 2-byte word data pointed to by bc
ld a, [bc]
ld e, a
inc bc
@@ -123,68 +126,85 @@
ld a, [bc]
ld d, a
inc bc
+ ; if $0000, we're done
or e
- jr z, .asm_11c133
+ jr z, .done
+ ; preserving hl and bc, get the length of the word
push hl
push bc
- call Function11c156
- call Function11c14a
+ call CopyMobileEZChatToC608
+ call GetLengthOfWordAtC608
ld e, c
pop bc
pop hl
+ ; if the functions return 0, we're done
ld a, e
or a
- jr z, .asm_11c133
-.asm_11c0fa
+ jr z, .done
+.loop2
+ ; e contains the length of the word
+ ; add 1 for the space, unless we're at the start of the line
ld a, [wcf64]
- cp $12
- jr z, .asm_11c102
+ cp 18
+ jr z, .skip_inc
inc e
-.asm_11c102
+.skip_inc
+ ; if the word fits, put it on the same line
cp e
- jr nc, .asm_11c11c
+ jr nc, .same_line
+ ; otherwise, go to the next line
ld a, [wJumptableIndex]
inc a
ld [wJumptableIndex], a
- ld [hl], $4e
+ ; if we're on line 2, insert "<NEXT>"
+ ld [hl], "<NEXT>"
rra
- jr c, .asm_11c113
- ld [hl], $55
+ jr c, .got_line_terminator
+ ; else, insert "<CONT>"
+ ld [hl], "<CONT>"
-.asm_11c113
+.got_line_terminator
inc hl
- ld a, $12
+ ; init the next line, holding on to the same word
+ ld a, 18
ld [wcf64], a
dec e
- jr .asm_11c0fa
+ jr .loop2
-.asm_11c11c
- cp $12
- jr z, .asm_11c123
- ld [hl], $7f
+.same_line
+ ; add the space, unless we're at the start of the line
+ cp 18
+ jr z, .skip_space
+ ld [hl], " "
inc hl
-.asm_11c123
+.skip_space
+ ; deduct the length of the word
sub e
ld [wcf64], a
ld de, $c608
-.asm_11c12a
+.place_string_loop
+ ; load the string from de to hl
ld a, [de]
- cp $50
- jr z, .asm_11c133
+ cp "@"
+ jr z, .done
inc de
ld [hli], a
- jr .asm_11c12a
+ jr .place_string_loop
-.asm_11c133
+.done
+ ; next word?
pop af
dec a
- jr nz, .asm_11c0e1
- ld [hl], $57
+ jr nz, .loop
+ ; we're finished, place "<DONE>"
+ ld [hl], "<DONE>"
+ ; now, let's place the string from c618 to bc
pop bc
- ld hl, $c608 + 16
- call PlaceWholeStringInBoxAtOnce
+ ld hl, $c618
+ call PlaceHLTextAtBC
+ ; restore the original values of $cf63 and $cf64
pop hl
ld a, l
ld [wJumptableIndex], a
@@ -191,33 +211,32 @@
ld a, h
ld [wcf64], a
ret
-
; 11c14a
-Function11c14a: ; 11c14a
+GetLengthOfWordAtC608: ; 11c14a
ld c, $0
ld hl, $c608
-.asm_11c14f
+.loop
ld a, [hli]
- cp $50
+ cp "@"
ret z
inc c
- jr .asm_11c14f
+ jr .loop
; 11c156
-Function11c156: ; 11c156
+CopyMobileEZChatToC608: ; 11c156
ld a, [rSVBK]
push af
ld a, $1
ld [rSVBK], a
- ld a, $50
+ ld a, "@"
ld hl, $c608
- ld bc, $000b
+ ld bc, NAME_LENGTH
call ByteFill
ld a, d
and a
jr z, .get_name
- ld hl, MobileFixedWordCategoryPointers
+ ld hl, MobileEZChatCategoryPointers
dec d
sla d
ld c, d
@@ -239,7 +258,7 @@
rl b
add hl, bc
ld bc, 5 ; length of a string
-.loop
+.copy_string
ld de, $c608
call CopyBytes
ld de, $c608
@@ -253,7 +272,7 @@
call GetPokemonName
ld hl, StringBuffer1
ld bc, PKMN_NAME_LENGTH - 1
- jr .loop
+ jr .copy_string
; 11c1ab
Function11c1ab: ; 11c1ab
@@ -265,23 +284,21 @@
pop af
ld [hInMenu], a
ret
-
; 11c1b9
Function11c1b9: ; 11c1b9
- call Function11c1ca
+ call .InitKanaMode
ld a, [rSVBK]
push af
ld a, $5
ld [rSVBK], a
- call Function11c283
+ call EZChat_MasterLoop
pop af
ld [rSVBK], a
ret
-
; 11c1ca
-Function11c1ca: ; 11c1ca
+.InitKanaMode: ; 11c1ca
xor a
ld [wJumptableIndex], a
ld [wcf64], a
@@ -326,10 +343,9 @@
call CopyBytes
pop af
ld [rSVBK], a
- call Function11d4aa
- call Function11d3ba
+ call EZChat_GetCategoryWordsByKana
+ call EZChat_GetSeenPokemonByKana
ret
-
; 11c254
Function11c254: ; 11c254
@@ -347,15 +363,13 @@
ld b, $0
add hl, bc
ld de, wcd36
- ld bc, $000c
+ ld bc, 12
call CopyBytes
call CloseSRAM
ret
-
; 11c277
-
-Function11c277: ; 11c277 (47:4277)
+EZChat_ClearBottom12Rows: ; 11c277 (47:4277)
ld a, " "
hlcoord 0, 6
ld bc, (SCREEN_HEIGHT - 6) * SCREEN_WIDTH
@@ -362,7 +376,7 @@
call ByteFill
ret
-Function11c283: ; 11c283
+EZChat_MasterLoop: ; 11c283
.loop
call JoyTextDelay
ld a, [hJoyPressed]
@@ -379,7 +393,6 @@
callba ClearSpriteAnims
call ClearSprites
ret
-
; 11c2ac
.DoJumptableFunction: ; 11c2ac
@@ -386,10 +399,9 @@
jumptable .Jumptable, wJumptableIndex
; 11c2bb
-
.Jumptable: ; 11c2bb (47:42bb)
- dw Function11c2e9 ; 00
- dw Function11c346 ; 01
+ dw .SpawnObjects ; 00
+ dw .InitRAM ; 01
dw Function11c35f ; 02
dw Function11c373 ; 03
dw Function11c3c2 ; 04
@@ -412,52 +424,57 @@
dw Function11ce0b ; 15
dw Function11ce2b ; 16
-
-Function11c2e9: ; 11c2e9 (47:42e9)
+.SpawnObjects: ; 11c2e9 (47:42e9)
depixel 3, 1, 2, 5
ld a, SPRITE_ANIM_INDEX_1D
call _InitSpriteAnimStruct
depixel 8, 1, 2, 5
+
ld a, SPRITE_ANIM_INDEX_1D
call _InitSpriteAnimStruct
- ld hl, $c
+ ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, $1
ld [hl], a
+
depixel 9, 2, 2, 0
ld a, SPRITE_ANIM_INDEX_1D
call _InitSpriteAnimStruct
- ld hl, $c
+ ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, $3
ld [hl], a
+
depixel 10, 16
ld a, SPRITE_ANIM_INDEX_1D
call _InitSpriteAnimStruct
- ld hl, $c
+ ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, $4
ld [hl], a
+
depixel 10, 4
ld a, SPRITE_ANIM_INDEX_1D
call _InitSpriteAnimStruct
- ld hl, $c
+ ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, $5
ld [hl], a
+
depixel 10, 2
ld a, SPRITE_ANIM_INDEX_1D
call _InitSpriteAnimStruct
- ld hl, $c
+ ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, $2
ld [hl], a
+
ld hl, wcd23
set 1, [hl]
set 2, [hl]
jp Function11cfb5
-Function11c346: ; 11c346 (47:4346)
+.InitRAM: ; 11c346 (47:4346)
ld a, $9
ld [wcd2d], a
ld a, $2
@@ -535,7 +552,6 @@
dec a
jr nz, .asm_11c392
ret
-
; 11c3bc (47:43bc)
String_11c3bc: ; 11c3bc
@@ -543,7 +559,7 @@
; 11c3c2
Function11c3c2: ; 11c3c2 (47:43c2)
- call Function11c277
+ call EZChat_ClearBottom12Rows
ld de, Unknown_11cfbe
call Function11d035
hlcoord 1, 7
@@ -560,7 +576,7 @@
call Function11cfb5
Function11c3ed: ; 11c3ed (47:43ed)
- ld hl, wcd20 ; wcd20 (aliases: CreditsPos)
+ ld hl, wcd20 ; wcd20
ld de, hJoypadPressed ; $ffa3
ld a, [de]
and $8
@@ -595,11 +611,11 @@
jr .asm_11c475
.asm_11c426
ld a, $8
- ld [wcd20], a ; wcd20 (aliases: CreditsPos)
+ ld [wcd20], a ; wcd20
ret
.asm_11c42c
- ld a, [wcd20] ; wcd20 (aliases: CreditsPos)
+ ld a, [wcd20] ; wcd20
cp $6
jr c, .asm_11c472
sub $6
@@ -705,7 +721,6 @@
call ByteFill
callba ReloadMapPart
ret
-
; 11c4db (47:44db)
String_11c4db: ; 11c4db
@@ -721,8 +736,8 @@
; 11c52c
Function11c52c: ; 11c52c (47:452c)
- call Function11c277
- call Function11c5f0
+ call EZChat_ClearBottom12Rows
+ call EZChat_PlaceCategoryNames
call Function11c618
ld hl, wcd24
res 1, [hl]
@@ -770,12 +785,12 @@
.a
ld a, [wcd21]
- cp $f
- jr c, .asm_11c59d
+ cp 15
+ jr c, .got_category
sub $f
- jr z, .asm_11c5ab
+ jr z, .done
dec a
- jr z, .asm_11c599
+ jr z, .mode
jr .b
.start
@@ -782,11 +797,11 @@
ld hl, wcd24
set 0, [hl]
ld a, $8
- ld [wcd20], a ; wcd20 (aliases: CreditsPos)
+ ld [wcd20], a ; wcd20
.b
ld a, $4
- jr .asm_11c59f
+ jr .go_to_function
.select
ld a, [wcd2b]
@@ -793,16 +808,16 @@
xor $1
ld [wcd2b], a
ld a, $15
- jr .asm_11c59f
+ jr .go_to_function
-.asm_11c599
+.mode
ld a, $13
- jr .asm_11c59f
+ jr .go_to_function
-.asm_11c59d
+.got_category
ld a, $8
-.asm_11c59f
+.go_to_function
ld hl, wcd24
set 1, [hl]
ld [wJumptableIndex], a
@@ -809,8 +824,8 @@
call PlayClickSFX
ret
-.asm_11c5ab
- ld a, [wcd20] ; wcd20 (aliases: CreditsPos)
+.done
+ ld a, [wcd20] ; wcd20
call Function11ca6a
call PlayClickSFX
ret
@@ -820,7 +835,7 @@
cp $3
ret c
sub $3
- jr .asm_11c5ee
+ jr .finish_dpad
.down
ld a, [hl]
@@ -827,7 +842,7 @@
cp $f
ret nc
add $3
- jr .asm_11c5ee
+ jr .finish_dpad
.left
ld a, [hl]
@@ -844,7 +859,7 @@
cp $f
ret z
dec a
- jr .asm_11c5ee
+ jr .finish_dpad
.right
ld a, [hl]
@@ -862,17 +877,16 @@
ret z
inc a
-.asm_11c5ee
+.finish_dpad
ld [hl], a
ret
-
; 11c5f0
-Function11c5f0: ; 11c5f0 (47:45f0)
- ld de, MobileFixedWordCategoryNames
- ld bc, Unknown_11c63a
- ld a, $f
-.asm_11c5f8
+EZChat_PlaceCategoryNames: ; 11c5f0 (47:45f0)
+ ld de, MobileEZChatCategoryNames
+ ld bc, Coords_11c63a
+ ld a, 15
+.loop
push af
ld a, [bc]
inc bc
@@ -882,17 +896,20 @@
ld h, a
push bc
call PlaceString
-.asm_11c603
+ ; The category names are padded with "@".
+ ; To find the next category, the system must
+ ; find the first character at de that is not "@".
+.find_next_string_loop
inc de
ld a, [de]
- cp $50
- jr z, .asm_11c603
+ cp "@"
+ jr z, .find_next_string_loop
pop bc
pop af
dec a
- jr nz, .asm_11c5f8
+ jr nz, .loop
hlcoord 1, 17
- ld de, String_11c62a
+ ld de, EZChatString_Stop_Mode_Cancel
call PlaceString
ret
@@ -903,14 +920,13 @@
call ByteFill
callba ReloadMapPart
ret
-
; 11c62a (47:462a)
-String_11c62a: ; 11c62a
+EZChatString_Stop_Mode_Cancel: ; 11c62a
db "けす モード やめる@"
; 11c63a
-Unknown_11c63a: ; 11c63a
+Coords_11c63a: ; 11c63a
dwcoord 1, 7
dwcoord 7, 7
dwcoord 13, 7
@@ -929,7 +945,7 @@
; 11c658
Function11c658: ; 11c658 (47:4658)
- call Function11c277
+ call EZChat_ClearBottom12Rows
call Function11c770
ld de, Unknown_11cfc2
call Function11d035
@@ -941,7 +957,7 @@
call Function11cfb5
Function11c675: ; 11c675 (47:4675)
- ld hl, wcd25
+ ld hl, wMobileCommsJumptableIndex
ld de, hJoypadPressed ; $ffa3
ld a, [de]
and A_BUTTON
@@ -975,7 +991,7 @@
ld [wcd26], a
ld a, [hl]
ld b, a
- ld hl, wcd25
+ ld hl, wMobileCommsJumptableIndex
ld a, [wcd26]
add [hl]
jr c, .asm_11c6b9
@@ -986,7 +1002,7 @@
ld hl, wcd26
sub [hl]
dec a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
.asm_11c6c4
call Function11c992
call Function11c7bc
@@ -1101,18 +1117,19 @@
Function11c770: ; 11c770 (47:4770)
xor a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ld [wcd26], a
ld [wcd27], a
ld a, [wcd2b]
and a
- jr nz, .asm_11c7ab
+ jr nz, .cd2b_is_nonzero
ld a, [wcd21]
and a
- jr z, .asm_11c799
+ jr z, .cd21_is_zero
+ ; load from data array
dec a
sla a
- ld hl, Unknown_11f220
+ ld hl, MobileEZChatData_WordAndPageCounts
ld c, a
ld b, 0
add hl, bc
@@ -1119,24 +1136,27 @@
ld a, [hli]
ld [wcd28], a
ld a, [hl]
-.asm_11c795
+.load
ld [wcd29], a
ret
-.asm_11c799
+.cd21_is_zero
+ ; compute from [wc7d2]
ld a, [wc7d2]
ld [wcd28], a
-.asm_11c79f
- ld c, $c
+.div_12
+ ld c, 12
call SimpleDivide
and a
- jr nz, .asm_11c7a8
+ jr nz, .no_need_to_floor
dec b
-.asm_11c7a8
+.no_need_to_floor
ld a, b
- jr .asm_11c795
-.asm_11c7ab
- ld hl, $c68a + 30
+ jr .load
+
+.cd2b_is_nonzero
+ ; compute from [c6a8 + 2 * [cd22]]
+ ld hl, $c6a8 ; $c68a + 30
ld a, [wcd22]
ld c, a
ld b, 0
@@ -1144,7 +1164,7 @@
add hl, bc
ld a, [hl]
ld [wcd28], a
- jr .asm_11c79f
+ jr .div_12
Function11c7bc: ; 11c7bc (47:47bc)
ld bc, Unknown_11c854
@@ -1179,7 +1199,7 @@
ret
.asm_11c7e9
- ld hl, wd100
+ ld hl, wListPointer
ld a, [wcd26]
ld e, a
add hl, de
@@ -1265,7 +1285,6 @@
pop hl
pop de
ret
-
; 11c854 (47:4854)
Unknown_11c854: ; 11c854
@@ -1339,7 +1358,6 @@
dec c
jr nz, .asm_11c8c2
ret
-
; 11c8c7 (47:48c7)
BCD2String: ; 11c8c7
@@ -1363,7 +1381,6 @@
add "0"
ld [hli], a
ret
-
; 11c8ec
MobileString_Page: ; 11c8ec
@@ -1379,7 +1396,7 @@
; 11c8f6
Function11c8f6: ; 11c8f6 (47:48f6)
- ld a, [wcd20] ; wcd20 (aliases: CreditsPos)
+ ld a, [wcd20] ; wcd20
call Function11c95d
push hl
ld a, [wcd2b]
@@ -1390,7 +1407,7 @@
and a
jr z, .asm_11c927
ld hl, wcd26
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
add [hl]
.asm_11c911
ld e, a
@@ -1399,7 +1416,7 @@
push de
call Function11c05d
pop de
- ld a, [wcd20] ; wcd20 (aliases: CreditsPos)
+ ld a, [wcd20] ; wcd20
ld c, a
ld b, $0
ld hl, wcd36
@@ -1412,11 +1429,11 @@
.asm_11c927
ld hl, wcd26
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
add [hl]
ld c, a
ld b, $0
- ld hl, wd100
+ ld hl, wListPointer
add hl, bc
ld a, [hl]
jr .asm_11c911
@@ -1438,7 +1455,7 @@
ld d, $0
add hl, de
add hl, de
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
ld e, a
add hl, de
add hl, de
@@ -1480,7 +1497,6 @@
jr nz, .asm_11c980
pop hl
ret
-
; 11c986 (47:4986)
Unknown_11c986:
@@ -1544,7 +1560,7 @@
jr nz, .asm_11c9e9
call Function11ca5e
xor a
- ld [wcd20], a ; wcd20 (aliases: CreditsPos)
+ ld [wcd20], a ; wcd20
.asm_11c9e9
ld hl, wcd24
set 4, [hl]
@@ -1606,7 +1622,6 @@
jr nz, .asm_11ca22
callba ReloadMapPart
ret
-
; 11ca38 (47:4a38)
String_11ca38: ; 11ca38
@@ -1621,13 +1636,13 @@
Function11ca5e: ; 11ca5e (47:4a5e)
xor a
-.asm_11ca5f
+.loop
push af
call Function11ca6a
pop af
inc a
cp $6
- jr nz, .asm_11ca5f
+ jr nz, .loop
ret
Function11ca6a: ; 11ca6a (47:4a6a)
@@ -1736,7 +1751,6 @@
ret nz
inc [hl]
ret
-
; 11cb1c (47:4b1c)
String_11cb1c: ; 11cb1c
@@ -1867,7 +1881,6 @@
dec hl
set 7, [hl]
ret
-
; 11cc01 (47:4c01)
Unknown_11cc01: ; 11cc01
@@ -1933,7 +1946,6 @@
ld a, $4
ld [wJumptableIndex], a
ret
-
; 11cd10 (47:4d10)
String_11cd10: ; 11cd10
@@ -1941,7 +1953,7 @@
; 11cd20
Function11cd20: ; 11cd20 (47:4d20)
- call Function11c277
+ call EZChat_ClearBottom12Rows
ld de, Unknown_11cfc6
call Function11cfce
hlcoord 1, 14
@@ -2033,7 +2045,6 @@
call ByteFill
callba ReloadMapPart
ret
-
; 11cdc7 (47:4dc7)
String_11cdc7: ; 11cdc7
@@ -2054,12 +2065,12 @@
; 11ce0b
Function11ce0b: ; 11ce0b (47:4e0b)
- call Function11c277
+ call EZChat_ClearBottom12Rows
hlcoord 1, 7
ld de, String_11cf79
call PlaceString
hlcoord 1, 17
- ld de, String_11c62a
+ ld de, EZChatString_Stop_Mode_Cancel
call PlaceString
call Function11c618
ld hl, wcd24
@@ -2110,9 +2121,9 @@
cp NUM_KANA
jr c, .place
sub NUM_KANA
- jr z, .asm_11cea4
+ jr z, .done
dec a
- jr z, .asm_11ce96
+ jr z, .mode
jr .b
.start
@@ -2119,7 +2130,7 @@
ld hl, wcd24
set 0, [hl]
ld a, $8
- ld [wcd20], a ; wcd20 (aliases: CreditsPos)
+ ld [wcd20], a ; wcd20
.b
ld a, $4
jr .load
@@ -2135,7 +2146,7 @@
ld a, $8
jr .load
-.asm_11ce96
+.mode
ld a, $13
.load
ld [wJumptableIndex], a
@@ -2144,8 +2155,8 @@
call PlayClickSFX
ret
-.asm_11cea4
- ld a, [wcd20] ; wcd20 (aliases: CreditsPos)
+.done
+ ld a, [wcd20] ; wcd20
call Function11ca6a
call PlayClickSFX
ret
@@ -2162,7 +2173,6 @@
ret z
ld [wcd22], a
ret
-
; 11ceb9 (47:4eb9)
Unknown_11ceb9: ; 11ceb9
@@ -2278,7 +2288,6 @@
ld hl, wJumptableIndex
inc [hl]
ret
-
; 11cfba (47:4fba)
Unknown_11cfba:
@@ -2304,7 +2313,7 @@
Function11cfce: ; 11cfce (47:4fce)
hlcoord 0, 0
- ld bc, $14
+ ld bc, SCREEN_WIDTH
ld a, [de]
inc de
push af
@@ -2311,12 +2320,12 @@
ld a, [de]
inc de
and a
-.asm_11cfda
- jr z, .asm_11cfe0
+.add_n_times
+ jr z, .done_add_n_times
add hl, bc
dec a
- jr .asm_11cfda
-.asm_11cfe0
+ jr .add_n_times
+.done_add_n_times
pop af
ld c, a
ld b, 0
@@ -2328,26 +2337,26 @@
inc de
dec a
dec a
- jr z, .asm_11cff6
+ jr z, .skip_fill
ld c, a
ld a, $7a
-.asm_11cff2
+.fill_loop
ld [hli], a
dec c
- jr nz, .asm_11cff2
-.asm_11cff6
+ jr nz, .fill_loop
+.skip_fill
ld a, $7b
ld [hl], a
pop hl
- ld bc, $14
+ ld bc, SCREEN_WIDTH
add hl, bc
ld a, [de]
dec de
dec a
dec a
- jr z, .asm_11d022
+ jr z, .skip_section
ld b, a
-.asm_11d005
+.loop
push hl
ld a, $7c
ld [hli], a
@@ -2354,37 +2363,37 @@
ld a, [de]
dec a
dec a
- jr z, .asm_11d015
+ jr z, .skip_row
ld c, a
ld a, $7f
-.asm_11d011
+.row_loop
ld [hli], a
dec c
- jr nz, .asm_11d011
-.asm_11d015
+ jr nz, .row_loop
+.skip_row
ld a, $7c
ld [hl], a
pop hl
push bc
- ld bc, $14
+ ld bc, SCREEN_WIDTH
add hl, bc
pop bc
dec b
- jr nz, .asm_11d005
-.asm_11d022
+ jr nz, .loop
+.skip_section
ld a, $7d
ld [hli], a
ld a, [de]
dec a
dec a
- jr z, .asm_11d031
+ jr z, .skip_remainder
ld c, a
ld a, $7a
-.asm_11d02d
+.final_loop
ld [hli], a
dec c
- jr nz, .asm_11d02d
-.asm_11d031
+ jr nz, .final_loop
+.skip_remainder
ld a, $7e
ld [hl], a
ret
@@ -2391,7 +2400,7 @@
Function11d035: ; 11d035 (47:5035)
hlcoord 0, 0
- ld bc, $14
+ ld bc, SCREEN_WIDTH
ld a, [de]
inc de
push af
@@ -2398,12 +2407,12 @@
ld a, [de]
inc de
and a
-.asm_11d041
- jr z, .asm_11d047
+.add_n_times
+ jr z, .done_add_n_times
add hl, bc
dec a
- jr .asm_11d041
-.asm_11d047
+ jr .add_n_times
+.done_add_n_times
pop af
ld c, a
ld b, $0
@@ -2420,12 +2429,12 @@
add hl, bc
ld a, $7b
ld [hl], a
- call Function11d0ac
+ call .AddNMinusOneTimes
ld a, $7e
ld [hl], a
pop hl
push hl
- call Function11d0ac
+ call .AddNMinusOneTimes
ld a, $7d
ld [hl], a
pop hl
@@ -2432,15 +2441,15 @@
push hl
inc hl
push hl
- call Function11d0ac
+ call .AddNMinusOneTimes
pop bc
dec de
ld a, [de]
cp $2
- jr z, .asm_11d082
+ jr z, .skip
dec a
dec a
-.asm_11d078
+.loop
push af
ld a, $7a
ld [hli], a
@@ -2448,8 +2457,8 @@
inc bc
pop af
dec a
- jr nz, .asm_11d078
-.asm_11d082
+ jr nz, .loop
+.skip
pop hl
ld bc, $14
add hl, bc
@@ -2470,32 +2479,32 @@
ld c, a
ld b, a
ld de, $14
-.asm_11d09c
+.loop2
ld a, $7c
ld [hl], a
add hl, de
dec c
- jr nz, .asm_11d09c
+ jr nz, .loop2
pop hl
-.asm_11d0a4
+.loop3
ld a, $7c
ld [hl], a
add hl, de
dec b
- jr nz, .asm_11d0a4
+ jr nz, .loop3
ret
-Function11d0ac: ; 11d0ac (47:50ac)
+.AddNMinusOneTimes: ; 11d0ac (47:50ac)
ld a, [de]
dec a
- ld bc, $14
-.asm_11d0b1
+ ld bc, SCREEN_WIDTH
+.add_n_minus_one_times
add hl, bc
dec a
- jr nz, .asm_11d0b1
+ jr nz, .add_n_minus_one_times
ret
-Function11d0b6: ; 11d0b6 (47:50b6)
+AnimateEZChatCursor: ; 11d0b6 (47:50b6)
ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, [hl]
@@ -2522,11 +2531,10 @@
dw .nine
dw .ten
-
.zero ; 11d0dd (47:50dd)
- ld a, [wcd20] ; wcd20 (aliases: CreditsPos)
+ ld a, [wcd20] ; wcd20
sla a
- ld hl, Unknown_11d208
+ ld hl, .Coords_Zero
ld e, $1
jr .load
@@ -2533,12 +2541,12 @@
.one ; 11d0e9 (47:50e9)
ld a, [wcd21]
sla a
- ld hl, Unknown_11d21a
+ ld hl, .Coords_One
ld e, $2
jr .load
.two ; 11d0f5 (47:50f5)
- ld hl, Unknown_11d2be
+ ld hl, .FramesetsIDs_Two
ld a, [wcd22]
ld e, a
ld d, $0
@@ -2545,9 +2553,10 @@
add hl, de
ld a, [hl]
call ReinitSpriteAnimFrame
+
ld a, [wcd22]
sla a
- ld hl, Unknown_11d23e
+ ld hl, .Coords_Two
ld e, $4
jr .load
@@ -2554,9 +2563,9 @@
.three ; 11d10f (47:510f)
ld a, SPRITE_ANIM_FRAMESET_27
call ReinitSpriteAnimFrame
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
sla a
- ld hl, Unknown_11d29e
+ ld hl, .Coords_Three
ld e, $8
.load ; 11d11e (47:511e)
push de
@@ -2574,7 +2583,7 @@
ld [hl], a
pop de
ld a, e
- call Function11d2ee
+ call .UpdateObjectFlags
ret
.four ; 11d134 (47:5134)
@@ -2582,7 +2591,7 @@
call ReinitSpriteAnimFrame
ld a, [wcd2a]
sla a
- ld hl, Unknown_11d2b6
+ ld hl, .Coords_Four
ld e, $10
jr .load
@@ -2591,7 +2600,7 @@
call ReinitSpriteAnimFrame
ld a, [wcd2c]
sla a
- ld hl, Unknown_11d2ba
+ ld hl, .Coords_Five
ld e, $20
jr .load
@@ -2598,35 +2607,40 @@
.six ; 11d156 (47:5156)
ld a, SPRITE_ANIM_FRAMESET_2A
call ReinitSpriteAnimFrame
+ ; X = [wcd4a] * 8 + 24
ld a, [wcd4a]
sla a
sla a
sla a
add $18
- ld hl, $4
+ ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc
ld [hli], a
+ ; Y = 48
ld a, $30
ld [hl], a
+
ld a, $1
ld e, a
- call Function11d2ee
+ call .UpdateObjectFlags
ret
.seven ; 11d175 (47:5175)
- ld a, [wcd4d]
+ ld a, [wEZChatCursorYCoord]
cp $4
- jr z, .asm_11d180
+ jr z, .frameset_26
ld a, SPRITE_ANIM_FRAMESET_28
- jr .asm_11d182
-.asm_11d180
+ jr .got_frameset
+
+.frameset_26
ld a, SPRITE_ANIM_FRAMESET_26
-.asm_11d182
+.got_frameset
call ReinitSpriteAnimFrame
- ld a, [wcd4d]
+ ld a, [wEZChatCursorYCoord]
cp $4
jr z, .asm_11d1b1
- ld a, [wcd4c]
+ ; X = [wEZChatCursorXCoord] * 8 + 32
+ ld a, [wEZChatCursorXCoord]
sla a
sla a
sla a
@@ -2634,7 +2648,8 @@
ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc
ld [hli], a
- ld a, [wcd4d]
+ ; Y = [wEZChatCursorYCoord] * 16 + 72
+ ld a, [wEZChatCursorYCoord]
sla a
sla a
sla a
@@ -2643,11 +2658,12 @@
ld [hl], a
ld a, $2
ld e, a
- call Function11d2ee
+ call .UpdateObjectFlags
ret
.asm_11d1b1
- ld a, [wcd4c]
+ ; X = [wEZChatCursorXCoord] * 40 + 24
+ ld a, [wEZChatCursorXCoord]
sla a
sla a
sla a
@@ -2659,11 +2675,12 @@
ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc
ld [hli], a
+ ; Y = 138
ld a, $8a
ld [hl], a
ld a, $2
ld e, a
- call Function11d2ee
+ call .UpdateObjectFlags
ret
.nine ; 11d1d1 (47:51d1)
@@ -2692,7 +2709,7 @@
ld [hl], a
ld a, $4
ld e, a
- call Function11d2ee
+ call .UpdateObjectFlags
ret
.ten ; 11d1fc (47:51fc)
@@ -2700,141 +2717,164 @@
call ReinitSpriteAnimFrame
ld a, $8
ld e, a
- call Function11d2ee
+ call .UpdateObjectFlags
ret
-
; 11d208 (47:5208)
-Unknown_11d208: ; 11d208
- db $0d, $1a
- db $3d, $1a
- db $6d, $1a
- db $0d, $2a
- db $3d, $2a
- db $6d, $2a
- db $0d, $8a
- db $3d, $8a
- db $6d, $8a
+.Coords_Zero: ; 11d208
+ dbpixel 1, 3, 5, 2
+ dbpixel 7, 3, 5, 2
+ dbpixel 13, 3, 5, 2
+ dbpixel 1, 5, 5, 2
+ dbpixel 7, 5, 5, 2
+ dbpixel 13, 5, 5, 2
+ dbpixel 1, 17, 5, 2
+ dbpixel 7, 17, 5, 2
+ dbpixel 13, 17, 5, 2
-Unknown_11d21a: ; 11d21a
- db $0d, $42
- db $3d, $42
- db $6d, $42
- db $0d, $52
- db $3d, $52
- db $6d, $52
- db $0d, $62
- db $3d, $62
- db $6d, $62
- db $0d, $72
- db $3d, $72
- db $6d, $72
- db $0d, $82
- db $3d, $82
- db $6d, $82
- db $0d, $92
- db $3d, $92
- db $6d, $92
+.Coords_One: ; 11d21a
+ dbpixel 1, 8, 5, 2
+ dbpixel 7, 8, 5, 2
+ dbpixel 13, 8, 5, 2
+ dbpixel 1, 10, 5, 2
+ dbpixel 7, 10, 5, 2
+ dbpixel 13, 10, 5, 2
+ dbpixel 1, 12, 5, 2
+ dbpixel 7, 12, 5, 2
+ dbpixel 13, 12, 5, 2
+ dbpixel 1, 14, 5, 2
+ dbpixel 7, 14, 5, 2
+ dbpixel 13, 14, 5, 2
+ dbpixel 1, 16, 5, 2
+ dbpixel 7, 16, 5, 2
+ dbpixel 13, 16, 5, 2
+ dbpixel 1, 18, 5, 2
+ dbpixel 7, 18, 5, 2
+ dbpixel 13, 18, 5, 2
-Unknown_11d23e: ; 11d23e
- db $10, $48
- db $18, $48
- db $20, $48
- db $28, $48
- db $30, $48
- db $10, $58
- db $18, $58
- db $20, $58
- db $28, $58
- db $30, $58
- db $10, $68
- db $18, $68
- db $20, $68
- db $28, $68
- db $30, $68
- db $10, $78
- db $18, $78
- db $20, $78
- db $28, $78
- db $30, $78
- db $40, $48
- db $48, $48
- db $50, $48
- db $58, $48
- db $60, $48
- db $40, $58
- db $48, $58
- db $50, $58
- db $58, $58
- db $60, $58
- db $40, $68
- db $48, $68
- db $50, $68
- db $58, $68
- db $60, $68
- db $70, $48
- db $80, $48
- db $90, $48
- db $40, $78
- db $48, $78
- db $50, $78
- db $58, $78
- db $60, $78
- db $70, $58
- db $70, $68
- db $0d, $92
- db $3d, $92
- db $6d, $92
+.Coords_Two: ; 11d23e
+ dbpixel 2, 9 ; 00
+ dbpixel 3, 9 ; 01
+ dbpixel 4, 9 ; 02
+ dbpixel 5, 9 ; 03
+ dbpixel 6, 9 ; 04
+ dbpixel 2, 11 ; 05
+ dbpixel 3, 11 ; 06
+ dbpixel 4, 11 ; 07
+ dbpixel 5, 11 ; 08
+ dbpixel 6, 11 ; 09
+ dbpixel 2, 13 ; 0a
+ dbpixel 3, 13 ; 0b
+ dbpixel 4, 13 ; 0c
+ dbpixel 5, 13 ; 0d
+ dbpixel 6, 13 ; 0e
+ dbpixel 2, 15 ; 0f
+ dbpixel 3, 15 ; 10
+ dbpixel 4, 15 ; 11
+ dbpixel 5, 15 ; 12
+ dbpixel 6, 15 ; 13
+ dbpixel 8, 9 ; 14
+ dbpixel 9, 9 ; 15
+ dbpixel 10, 9 ; 16
+ dbpixel 11, 9 ; 17
+ dbpixel 12, 9 ; 18
+ dbpixel 8, 11 ; 19
+ dbpixel 9, 11 ; 1a
+ dbpixel 10, 11 ; 1b
+ dbpixel 11, 11 ; 1c
+ dbpixel 12, 11 ; 1d
+ dbpixel 8, 13 ; 1e
+ dbpixel 9, 13 ; 1f
+ dbpixel 10, 13 ; 20
+ dbpixel 11, 13 ; 21
+ dbpixel 12, 13 ; 22
+ dbpixel 14, 9 ; 23
+ dbpixel 16, 9 ; 24
+ dbpixel 18, 9 ; 25
+ dbpixel 8, 15 ; 26
+ dbpixel 9, 15 ; 27
+ dbpixel 10, 15 ; 28
+ dbpixel 11, 15 ; 29
+ dbpixel 12, 15 ; 2a
+ dbpixel 14, 11 ; 2b
+ dbpixel 14, 13 ; 2c
+ dbpixel 1, 18, 5, 2 ; 2d
+ dbpixel 7, 18, 5, 2 ; 2e
+ dbpixel 13, 18, 5, 2 ; 2f
-Unknown_11d29e: ; 11d29e
- db $10, $50
- db $40, $50
- db $70, $50
- db $10, $60
- db $40, $60
- db $70, $60
- db $10, $70
- db $40, $70
- db $70, $70
- db $10, $80
- db $40, $80
- db $70, $80
+.Coords_Three: ; 11d29e
+ dbpixel 2, 10
+ dbpixel 8, 10
+ dbpixel 14, 10
+ dbpixel 2, 12
+ dbpixel 8, 12
+ dbpixel 14, 12
+ dbpixel 2, 14
+ dbpixel 8, 14
+ dbpixel 14, 14
+ dbpixel 2, 16
+ dbpixel 8, 16
+ dbpixel 14, 16
-Unknown_11d2b6: ; 11d2b6
- db $80, $50
- db $80, $60
+.Coords_Four: ; 11d2b6
+ dbpixel 16, 10
+ dbpixel 16, 12
-Unknown_11d2ba: ; 11d2ba
- db $20, $50
- db $20, $60
+.Coords_Five: ; 11d2ba
+ dbpixel 4, 10
+ dbpixel 4, 12
-Unknown_11d2be: ; 11d2be
- db $28, $28
- db $28, $28
- db $28, $28
- db $28, $28
- db $28, $28
- db $28, $28
- db $28, $28
- db $28, $28
- db $28, $28
- db $28, $28
- db $28, $28
- db $28, $28
- db $28, $28
- db $28, $28
- db $28, $28
- db $28, $28
- db $28, $28
- db $28, $28
- db $28, $28
- db $28, $28
- db $28, $28
- db $28, $28
- db $29, $26
- db $26, $26
+.FramesetsIDs_Two: ; 11d2be
+ db SPRITE_ANIM_FRAMESET_28 ; 00
+ db SPRITE_ANIM_FRAMESET_28 ; 01
+ db SPRITE_ANIM_FRAMESET_28 ; 02
+ db SPRITE_ANIM_FRAMESET_28 ; 03
+ db SPRITE_ANIM_FRAMESET_28 ; 04
+ db SPRITE_ANIM_FRAMESET_28 ; 05
+ db SPRITE_ANIM_FRAMESET_28 ; 06
+ db SPRITE_ANIM_FRAMESET_28 ; 07
+ db SPRITE_ANIM_FRAMESET_28 ; 08
+ db SPRITE_ANIM_FRAMESET_28 ; 09
+ db SPRITE_ANIM_FRAMESET_28 ; 0a
+ db SPRITE_ANIM_FRAMESET_28 ; 0b
+ db SPRITE_ANIM_FRAMESET_28 ; 0c
+ db SPRITE_ANIM_FRAMESET_28 ; 0d
+ db SPRITE_ANIM_FRAMESET_28 ; 0e
+ db SPRITE_ANIM_FRAMESET_28 ; 0f
+ db SPRITE_ANIM_FRAMESET_28 ; 10
+ db SPRITE_ANIM_FRAMESET_28 ; 11
+ db SPRITE_ANIM_FRAMESET_28 ; 12
+ db SPRITE_ANIM_FRAMESET_28 ; 13
+ db SPRITE_ANIM_FRAMESET_28 ; 14
+ db SPRITE_ANIM_FRAMESET_28 ; 15
+ db SPRITE_ANIM_FRAMESET_28 ; 16
+ db SPRITE_ANIM_FRAMESET_28 ; 17
+ db SPRITE_ANIM_FRAMESET_28 ; 18
+ db SPRITE_ANIM_FRAMESET_28 ; 19
+ db SPRITE_ANIM_FRAMESET_28 ; 1a
+ db SPRITE_ANIM_FRAMESET_28 ; 1b
+ db SPRITE_ANIM_FRAMESET_28 ; 1c
+ db SPRITE_ANIM_FRAMESET_28 ; 1d
+ db SPRITE_ANIM_FRAMESET_28 ; 1e
+ db SPRITE_ANIM_FRAMESET_28 ; 1f
+ db SPRITE_ANIM_FRAMESET_28 ; 20
+ db SPRITE_ANIM_FRAMESET_28 ; 21
+ db SPRITE_ANIM_FRAMESET_28 ; 22
+ db SPRITE_ANIM_FRAMESET_28 ; 23
+ db SPRITE_ANIM_FRAMESET_28 ; 24
+ db SPRITE_ANIM_FRAMESET_28 ; 25
+ db SPRITE_ANIM_FRAMESET_28 ; 26
+ db SPRITE_ANIM_FRAMESET_28 ; 27
+ db SPRITE_ANIM_FRAMESET_28 ; 28
+ db SPRITE_ANIM_FRAMESET_28 ; 29
+ db SPRITE_ANIM_FRAMESET_28 ; 2a
+ db SPRITE_ANIM_FRAMESET_28 ; 2b
+ db SPRITE_ANIM_FRAMESET_29 ; 2c
+ db SPRITE_ANIM_FRAMESET_26 ; 2d
+ db SPRITE_ANIM_FRAMESET_26 ; 2e
+ db SPRITE_ANIM_FRAMESET_26 ; 2f
-Function11d2ee: ; 11d2ee (47:52ee)
+.UpdateObjectFlags: ; 11d2ee (47:52ee)
ld hl, wcd24
and [hl]
jr nz, .update_y_offset
@@ -2887,7 +2927,6 @@
pop af
ld [rSVBK], a
ret
-
; 11d33a
Palette_11d33a:
@@ -2970,10 +3009,9 @@
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
-
; 11d3ba
-Function11d3ba: ; 11d3ba
+EZChat_GetSeenPokemonByKana: ; 11d3ba
ld a, [rSVBK]
push af
ld hl, $c648
@@ -2999,16 +3037,18 @@
ld a, $c64a / $100
ld [wcd34], a
- ld hl, Unknown_11f23c
- ld a, (Unknown_11f23cEnd - Unknown_11f23c) / 4
+ ld hl, EZChat_SortedWords
+ ld a, (EZChat_SortedWordsEnd - EZChat_SortedWords) / 4
.MasterLoop: ; 11d3ef
push af
; read row
+; offset
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
+; size
ld a, [hli]
ld c, a
ld a, [hli]
@@ -3015,7 +3055,7 @@
ld b, a
; save the pointer to the next row
push hl
-; add de to hl
+; add de to w3_d000
ld hl, w3_d000
add hl, de
; recover de from wcd2d (default: w5_d800)
@@ -3052,6 +3092,7 @@
ld a, c
or b
jr nz, .loop1
+
; recover the pointer from wcd2f (default: SortedPokemon)
ld a, [wcd2f]
ld l, a
@@ -3146,7 +3187,6 @@
pop af
ld [rSVBK], a
ret
-
; 11d493
.CheckSeenMon: ; 11d493
@@ -3165,49 +3205,71 @@
pop bc
pop hl
ret
-
; 11d4aa
-Function11d4aa: ; 11d4aa
+EZChat_GetCategoryWordsByKana: ; 11d4aa
ld a, [rSVBK]
push af
ld a, $3
ld [rSVBK], a
- ld hl, MobileFixedWordCategoryPointers
- ld bc, Unknown_11f220
+
+ ; load pointers
+ ld hl, MobileEZChatCategoryPointers
+ ld bc, MobileEZChatData_WordAndPageCounts
+
+ ; init WRAM registers
xor a
ld [wcd2d], a
inc a
ld [wcd2e], a
- ld a, $e
+
+ ; enter the first loop
+ ld a, 14
.loop1
push af
+
+ ; load the pointer to the category
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
push hl
+
+ ; skip to the attributes
ld hl, 5 ; length of a string
add hl, de
- ld a, [bc]
+
+ ; get the number of words in the category
+ ld a, [bc] ; number of entries to copy
inc bc
inc bc
push bc
+
.loop2
push af
push hl
+
+ ; load offset at [hl]
ld a, [hli]
ld e, a
ld a, [hl]
ld d, a
+
+ ; add to w3_d000
ld hl, w3_d000
add hl, de
+
+ ; copy from wcd2d and increment [wcd2d] in place
ld a, [wcd2d]
ld [hli], a
inc a
ld [wcd2d], a
+
+ ; copy from wcd2e
ld a, [wcd2e]
ld [hl], a
+
+ ; next entry
pop hl
ld de, 8
add hl, de
@@ -3214,6 +3276,8 @@
pop af
dec a
jr nz, .loop2
+
+ ; reset and go to next category
ld hl, wcd2d
xor a
ld [hli], a
@@ -3226,10 +3290,8 @@
pop af
ld [rSVBK], a
ret
-
; 11d4fe
-
SortedPokemon:
; Pokemon sorted by kana.
; Notably, Rhydon is missing.
@@ -3377,7 +3439,7 @@
INCBIN "gfx/pokedex/slowpoke.2bpp.lz"
; 11da52
-MobileFixedWordCategoryNames: ; 11da52
+MobileEZChatCategoryNames: ; 11da52
; Fixed message categories
db "ポケモン@@" ; 00
db "タイプ@@@" ; 01
@@ -3396,7 +3458,7 @@
db "あれこれ@@" ; 0e
; 11daac
-MobileFixedWordCategoryPointers: ; 11daac
+MobileEZChatCategoryPointers: ; 11daac
dw .Types ; 01
dw .Greetings ; 02
dw .People ; 03
@@ -4188,72 +4250,87 @@
db "なんの@@", $2, $4, $0
; 11f220
-Unknown_11f220:
- db $12, $01 ; 01
- db $24, $02 ; 02
- db $45, $05 ; 03
- db $45, $05 ; 04
- db $42, $05 ; 05
- db $42, $05 ; 06
- db $45, $05 ; 07
- db $42, $05 ; 08
- db $27, $03 ; 09
- db $27, $03 ; 0a
- db $45, $05 ; 0b
- db $27, $03 ; 0c
- db $42, $05 ; 0d
- db $24, $02 ; 0e
+MobileEZChatData_WordAndPageCounts:
+macro_11f220: macro
+; parameter: number of words
+ db \1
+; 12 words per page (0-based indexing)
+x = \1 / 12
+if \1 % 12 == 0
+x = x +- 1
+endc
+ db x
+endm
+ macro_11f220 18 ; 01: Types
+ macro_11f220 36 ; 02: Greetings
+ macro_11f220 69 ; 03: People
+ macro_11f220 69 ; 04: Battle
+ macro_11f220 66 ; 05: Exclamations
+ macro_11f220 66 ; 06: Conversation
+ macro_11f220 69 ; 07: Feelings
+ macro_11f220 66 ; 08: Conditions
+ macro_11f220 39 ; 09: Life
+ macro_11f220 39 ; 0a: Hobbies
+ macro_11f220 69 ; 0b: Actions
+ macro_11f220 39 ; 0c: Time
+ macro_11f220 66 ; 0d: Farewells
+ macro_11f220 36 ; 0e: ThisAndThat
-Unknown_11f23c:
+EZChat_SortedWords:
+; Addresses in WRAM bank 3 where EZChat words beginning
+; with the given kana are sorted in memory, and the pre-
+; allocated size for each.
+; These arrays are expanded dynamically to accomodate
+; any Pokemon you've seen that starts with each kana.\
macro_11f23c: macro
dw x - w3_d000, \1
x = x + 2 * \1
endm
x = $d012
- macro_11f23c $2f
- macro_11f23c $1e
- macro_11f23c $11
- macro_11f23c $09
- macro_11f23c $2e
- macro_11f23c $24
- macro_11f23c $1b
- macro_11f23c $09
- macro_11f23c $07
- macro_11f23c $1c
- macro_11f23c $12
- macro_11f23c $2b
- macro_11f23c $10
- macro_11f23c $08
- macro_11f23c $0c
- macro_11f23c $2c
- macro_11f23c $09
- macro_11f23c $12
- macro_11f23c $1b
- macro_11f23c $1a
- macro_11f23c $1c
- macro_11f23c $05
- macro_11f23c $02
- macro_11f23c $05
- macro_11f23c $07
- macro_11f23c $16
- macro_11f23c $0e
- macro_11f23c $0c
- macro_11f23c $05
- macro_11f23c $16
- macro_11f23c $19
- macro_11f23c $0e
- macro_11f23c $08
- macro_11f23c $07
- macro_11f23c $09
- macro_11f23c $0d
- macro_11f23c $04
- macro_11f23c $14
- macro_11f23c $0b
- macro_11f23c $01
- macro_11f23c $02
- macro_11f23c $02
- macro_11f23c $02
- macro_11f23c $15
+ macro_11f23c $2f ; a
+ macro_11f23c $1e ; i
+ macro_11f23c $11 ; u
+ macro_11f23c $09 ; e
+ macro_11f23c $2e ; o
+ macro_11f23c $24 ; ka_ga
+ macro_11f23c $1b ; ki_gi
+ macro_11f23c $09 ; ku_gu
+ macro_11f23c $07 ; ke_ge
+ macro_11f23c $1c ; ko_go
+ macro_11f23c $12 ; sa_za
+ macro_11f23c $2b ; shi_ji
+ macro_11f23c $10 ; su_zu
+ macro_11f23c $08 ; se_ze
+ macro_11f23c $0c ; so_zo
+ macro_11f23c $2c ; ta_da
+ macro_11f23c $09 ; chi_dhi
+ macro_11f23c $12 ; tsu_du
+ macro_11f23c $1b ; te_de
+ macro_11f23c $1a ; to_do
+ macro_11f23c $1c ; na
+ macro_11f23c $05 ; ni
+ macro_11f23c $02 ; nu
+ macro_11f23c $05 ; ne
+ macro_11f23c $07 ; no
+ macro_11f23c $16 ; ha_ba_pa
+ macro_11f23c $0e ; hi_bi_pi
+ macro_11f23c $0c ; fu_bu_pu
+ macro_11f23c $05 ; he_be_pe
+ macro_11f23c $16 ; ho_bo_po
+ macro_11f23c $19 ; ma
+ macro_11f23c $0e ; mi
+ macro_11f23c $08 ; mu
+ macro_11f23c $07 ; me
+ macro_11f23c $09 ; mo
+ macro_11f23c $0d ; ya
+ macro_11f23c $04 ; yu
+ macro_11f23c $14 ; yo
+ macro_11f23c $0b ; ra
+ macro_11f23c $01 ; ri
+ macro_11f23c $02 ; ru
+ macro_11f23c $02 ; re
+ macro_11f23c $02 ; ro
+ macro_11f23c $15 ; wa
x = $d000
- macro_11f23c $09
-Unknown_11f23cEnd:
+ macro_11f23c $09 ; end
+EZChat_SortedWordsEnd:
--- a/misc/gfx_41.asm
+++ b/misc/gfx_41.asm
@@ -1,52 +1,52 @@
-Function104000:: ; 104000
+HDMATransferAttrMapAndTileMapToWRAMBank3:: ; 104000
ld hl, .Function
jp CallInSafeGFXMode
.Function:
decoord 0, 0, AttrMap
- ld hl, wBackupAttrMap
+ ld hl, wScratchAttrMap
call CutAndPasteAttrMap
decoord 0, 0
- ld hl, wDecompressScratch
+ ld hl, wScratchTileMap
call CutAndPasteTilemap
ld a, $0
ld [rVBK], a
- ld hl, wDecompressScratch
- call Function10419d
+ ld hl, wScratchTileMap
+ call HDMATransferToWRAMBank3
ld a, $1
ld [rVBK], a
- ld hl, wBackupAttrMap
- call Function10419d
+ ld hl, wScratchAttrMap
+ call HDMATransferToWRAMBank3
ret
; 10402d
-Function10402d:: ; 10402d
+HDMATransferTileMapToWRAMBank3:: ; 10402d
ld hl, .Function
jp CallInSafeGFXMode
.Function:
decoord 0, 0
- ld hl, wDecompressScratch
+ ld hl, wScratchTileMap
call CutAndPasteTilemap
ld a, $0
ld [rVBK], a
- ld hl, wDecompressScratch
- call Function10419d
+ ld hl, wScratchTileMap
+ call HDMATransferToWRAMBank3
ret
; 104047
-Function104047: ; 104047
+HDMATransferAttrMapToWRAMBank3: ; 104047
ld hl, .Function
jp CallInSafeGFXMode
.Function:
decoord 0, 0, AttrMap
- ld hl, wBackupAttrMap
+ ld hl, wScratchAttrMap
call CutAndPasteAttrMap
ld a, $1
ld [rVBK], a
- ld hl, wBackupAttrMap
- call Function10419d
+ ld hl, wScratchAttrMap
+ call HDMATransferToWRAMBank3
ret
; 104061
@@ -56,29 +56,31 @@
.Function:
decoord 0, 0, AttrMap
- ld hl, wBackupAttrMap
+ ld hl, wScratchAttrMap
call CutAndPasteAttrMap
decoord 0, 0
- ld hl, wDecompressScratch
+ ld hl, wScratchTileMap
call CutAndPasteTilemap
call DelayFrame
+
di
ld a, [rVBK]
push af
ld a, $1
ld [rVBK], a
- ld hl, wBackupAttrMap
- call Function1041ad
+ ld hl, wScratchAttrMap
+ call HDMATransfer_Wait127Scanlines_toBGMap
ld a, $0
ld [rVBK], a
- ld hl, wDecompressScratch
- call Function1041ad
+ ld hl, wScratchTileMap
+ call HDMATransfer_Wait127Scanlines_toBGMap
pop af
ld [rVBK], a
ei
+
ret
-Function104099: ; 104099
+Mobile_ReloadMapPart: ; 104099
ld hl, ReloadMapPart ; useless
ld hl, .Function
jp CallInSafeGFXMode
@@ -85,34 +87,36 @@
.Function:
decoord 0, 0, AttrMap
- ld hl, wBackupAttrMap
+ ld hl, wScratchAttrMap
call CutAndPasteAttrMap
decoord 0, 0
- ld hl, wDecompressScratch
+ ld hl, wScratchTileMap
call CutAndPasteTilemap
call DelayFrame
+
di
ld a, [rVBK]
push af
ld a, $1
ld [rVBK], a
- ld hl, wBackupAttrMap
- call Function1041c1
+ ld hl, wScratchAttrMap
+ call HDMATransfer_NoDI
ld a, $0
ld [rVBK], a
- ld hl, wDecompressScratch
- call Function1041c1
+ ld hl, wScratchTileMap
+ call HDMATransfer_NoDI
pop af
ld [rVBK], a
ei
+
ret
; 1040d4
-Function1040d4: ; 1040d4
- ld hl, .Function
+; XXX
+ ld hl, .unreferenced_1040da
jp CallInSafeGFXMode
-.Function:
+.unreferenced_1040da
ld a, $1
ld [rVBK], a
ld a, $3
@@ -132,31 +136,34 @@
ret
; 1040fb
-Function1040fb: ; 1040fb
- ld hl, .Function
+; XXX
+ ld hl, .unreferenced_104101
jp CallInSafeGFXMode
-.Function:
+.unreferenced_104101
ld a, $1
ld [rVBK], a
ld a, $3
ld [rSVBK], a
ld hl, w3_d800
- call Function10419d
+ call HDMATransferToWRAMBank3
ret
; 104110
-Function104110:: ; 104110
+OpenAndCloseMenu_HDMATransferTileMapAndAttrMap:: ; 104110
; OpenText
ld hl, .Function
jp CallInSafeGFXMode
.Function:
+ ; Transfer AttrMap and Tilemap to BGMap
+ ; Fill vBGAttrs with $00
+ ; Fill vBGTiles with " "
decoord 0, 0, AttrMap
- ld hl, wBackupAttrMap
+ ld hl, wScratchAttrMap
call CutAndPasteAttrMap
decoord 0, 0
- ld hl, wDecompressScratch
+ ld hl, wScratchTileMap
call CutAndPasteTilemap
call DelayFrame
@@ -165,12 +172,12 @@
push af
ld a, $1
ld [rVBK], a
- ld hl, wBackupAttrMap
- call Function1041b7
+ ld hl, wScratchAttrMap
+ call HDMATransfer_Wait123Scanlines_toBGMap
ld a, $0
ld [rVBK], a
- ld hl, wDecompressScratch
- call Function1041b7
+ ld hl, wScratchTileMap
+ call HDMATransfer_Wait123Scanlines_toBGMap
pop af
ld [rVBK], a
ei
@@ -177,26 +184,30 @@
ret
; 104148
-Function104148: ; 104148 (41:4148)
+Mobile_OpenAndCloseMenu_HDMATransferTileMapAndAttrMap: ; 104148 (41:4148)
ld hl, .Function
jp CallInSafeGFXMode
.Function:
+ ; Transfer AttrMap and Tilemap to BGMap
+ ; Fill vBGAttrs with $00
+ ; Fill vBGTiles with $ff
decoord 0, 0, AttrMap
- ld hl, wBackupAttrMap
+ ld hl, wScratchAttrMap
call CutAndPasteAttrMap
ld c, $ff
decoord 0, 0
- ld hl, wDecompressScratch
+ ld hl, wScratchTileMap
call CutAndPasteMap
+
ld a, $1
ld [rVBK], a
- ld hl, wBackupAttrMap
- call Function1041ad
+ ld hl, wScratchAttrMap
+ call HDMATransfer_Wait127Scanlines_toBGMap
ld a, $0
ld [rVBK], a
- ld hl, wDecompressScratch
- call Function1041ad
+ ld hl, wScratchTileMap
+ call HDMATransfer_Wait127Scanlines_toBGMap
ret
; 104177
@@ -233,8 +244,8 @@
; 10419d
-Function10419d: ; 10419d (41:419d)
- call Function10424e
+HDMATransferToWRAMBank3: ; 10419d (41:419d)
+ call _LoadHDMAParameters
ld a, $23
ld [hDMATransfer], a
@@ -246,37 +257,47 @@
jr nz, .loop
ret
-Function1041ad: ; 1041ad (41:41ad)
+HDMATransfer_Wait127Scanlines_toBGMap: ; 1041ad (41:41ad)
+; HDMA transfer from hl to [hBGMapAddress]
+; hBGMapAddress -> de
+; 2 * SCREEN_HEIGHT -> c
ld a, [hBGMapAddress + 1]
ld d, a
ld a, [hBGMapAddress]
ld e, a
- ld c, $24
- jr Function104209
+ ld c, 2 * SCREEN_HEIGHT
+ jr HDMATransfer_Wait127Scanlines
-Function1041b7: ; 1041b7 (41:41b7)
+HDMATransfer_Wait123Scanlines_toBGMap: ; 1041b7 (41:41b7)
+; HDMA transfer from hl to [hBGMapAddress]
; hBGMapAddress -> de
-; $24 -> c
+; 2 * SCREEN_HEIGHT -> c
; $7b --> b
ld a, [hBGMapAddress + 1]
ld d, a
ld a, [hBGMapAddress]
ld e, a
- ld c, $24
- jr asm_104205
+ ld c, 2 * SCREEN_HEIGHT
+ jr HDMATransfer_Wait123Scanlines
; 1041c1 (41:41c1)
-Function1041c1: ; 1041c1
+HDMATransfer_NoDI: ; 1041c1
+; HDMA transfer from hl to [hBGMapAddress]
+; [hBGMapAddress] --> de
+; 2 * SCREEN_HEIGHT --> c
ld a, [hBGMapAddress + 1]
ld d, a
ld a, [hBGMapAddress]
ld e, a
- ld c, $24
+ ld c, 2 * SCREEN_HEIGHT
+
+ ; [rHDMA1, rHDMA2] = hl & $fff0
ld a, h
ld [rHDMA1], a
ld a, l
and $f0
ld [rHDMA2], a
+ ; [rHDMA3, rHDMA4] = de & $1ff0
ld a, d
and $1f
ld [rHDMA3], a
@@ -283,23 +304,29 @@
ld a, e
and $f0
ld [rHDMA4], a
+ ; b = c | %10000000
ld a, c
dec c
or $80
ld b, a
+ ; d = $7f - c + 1
ld a, $7f
sub c
ld d, a
+ ; while [rLY] >= d: pass
.loop1
ld a, [rLY]
cp d
jr nc, .loop1
+ ; while not [rSTAT] & 3: pass
.loop2
ld a, [rSTAT]
and $3
jr z, .loop2
+ ; load the 5th byte of HDMA
ld a, b
ld [rHDMA5], a
+ ; wait until rLY advances (c + 1) times
ld a, [rLY]
inc c
ld hl, rLY
@@ -314,20 +341,22 @@
ret
; 104205
-asm_104205:
+HDMATransfer_Wait123Scanlines:
ld b, $7b
- jr asm_10420b
+ jr _continue_HDMATransfer
-Function104209:
-; LY magic
+HDMATransfer_Wait127Scanlines:
ld b, $7f
-asm_10420b:
+_continue_HDMATransfer:
+; a lot of waiting around for hardware registers
+ ; [rHDMA1, rHDMA2] = hl & $fff0
ld a, h
ld [rHDMA1], a
ld a, l
and $f0 ; high nybble
ld [rHDMA2], a
+ ; [rHDMA3, rHDMA4] = de & $1ff0
ld a, d
and $1f ; lower 5 bits
ld [rHDMA3], a
@@ -334,13 +363,16 @@
ld a, e
and $f0 ; high nybble
ld [rHDMA4], a
+ ; e = c | %10000000
ld a, c
dec c
- or $80 ; set 7, a
+ or $80
ld e, a
+ ; d = b - c + 1
ld a, b
sub c
ld d, a
+ ; while [rLY] >= d: pass
.ly_loop
ld a, [rLY]
cp d
@@ -347,16 +379,20 @@
jr nc, .ly_loop
di
+ ; while [rSTAT] & 3: pass
.rstat_loop_1
ld a, [rSTAT]
and $3
jr nz, .rstat_loop_1
+ ; while not [rSTAT] & 3: pass
.rstat_loop_2
ld a, [rSTAT]
and $3
jr z, .rstat_loop_2
+ ; load the 5th byte of HDMA
ld a, e
ld [rHDMA5], a
+ ; wait until rLY advances (c + 1) times
ld a, [rLY]
inc c
ld hl, rLY
@@ -374,7 +410,7 @@
; 10424e
-Function10424e: ; 10424e (41:424e)
+_LoadHDMAParameters: ; 10424e (41:424e)
ld a, h
ld [rHDMA1], a
ld a, l
@@ -415,7 +451,7 @@
; load the original value of c into hl 12 times
ld a, [hMapObjectIndexBuffer]
- ld b, 12
+ ld b, BG_MAP_WIDTH - SCREEN_WIDTH
.loop3
ld [hli], a
dec b
@@ -441,18 +477,20 @@
push bc
push hl
- ; Copy c tiles of the 2bpp from b:de to wDecompressScratch
+ ; Copy c tiles of the 2bpp from b:de to wScratchTileMap
ld a, b ; bank
ld l, c ; number of tiles
ld h, $0
-rept 4
- add hl, hl ; multiply by 16 (16 bytes of a 2bpp = 8 x 8 tile)
-endr
+ ; multiply by 16 (16 bytes of a 2bpp = 8 x 8 tile)
+ add hl, hl
+ add hl, hl
+ add hl, hl
+ add hl, hl
ld b, h
ld c, l
ld h, d ; address
ld l, e
- ld de, wDecompressScratch
+ ld de, wScratchTileMap
call FarCopyBytes
pop hl
@@ -464,8 +502,8 @@
ld d, h
ld e, l
- ld hl, wDecompressScratch
- call Function104209
+ ld hl, wScratchTileMap
+ call HDMATransfer_Wait127Scanlines
; restore the previous bank
pop af
@@ -512,14 +550,14 @@
ld a, b
ld l, c
ld h, $0
-rept 3
add hl, hl ; multiply by 8
-endr
+ add hl, hl ; multiply by 8
+ add hl, hl ; multiply by 8
ld c, l
ld b, h
ld h, d
ld l, e
- ld de, wDecompressScratch
+ ld de, wScratchTileMap
call FarCopyBytesDouble_DoubleBankSwitch
pop hl
@@ -531,8 +569,8 @@
ld d, h
ld e, l
- ld hl, wDecompressScratch
- call Function104209
+ ld hl, wScratchTileMap
+ call HDMATransfer_Wait127Scanlines
pop af
ld [rSVBK], a
@@ -539,33 +577,33 @@
ret
; 104303
-Function104303: ; 104303
- ld hl, Function104309
+HDMATransfer_OnlyTopFourRows: ; 104303
+ ld hl, .Function
jp CallInSafeGFXMode
; 104309
-Function104309:
- ld hl, wDecompressScratch
+.Function:
+ ld hl, wScratchTileMap
decoord 0, 0
- call Function10433a
- ld hl, wDecompressScratch + $80
+ call .Copy
+ ld hl, wScratchTileMap + $80
decoord 0, 0, AttrMap
- call Function10433a
+ call .Copy
ld a, $1
ld [rVBK], a
ld c, $8
- ld hl, wDecompressScratch + $80
+ ld hl, wScratchTileMap + $80
debgcoord 0, 0, VBGMap1
- call Function104209
+ call HDMATransfer_Wait127Scanlines
ld a, $0
ld [rVBK], a
ld c, $8
- ld hl, wDecompressScratch
+ ld hl, wScratchTileMap
debgcoord 0, 0, VBGMap1
- call Function104209
+ call HDMATransfer_Wait127Scanlines
ret
-Function10433a: ; 10433a (41:433a)
+.Copy: ; 10433a (41:433a)
ld b, 4
.outer_loop
ld c, SCREEN_WIDTH
@@ -576,7 +614,7 @@
dec c
jr nz, .inner_loop
ld a, l
- add $20 - SCREEN_WIDTH
+ add BG_MAP_WIDTH - SCREEN_WIDTH
ld l, a
ld a, h
adc $0
--- a/misc/mobile_12.asm
+++ b/misc/mobile_12.asm
@@ -11,7 +11,7 @@
call Function48d3d
ld a, [wd479]
bit 1, a
- jr z, .asm_4805a
+ jr z, .not_yet_initialized
ld a, [wd003]
set 0, a
set 1, a
@@ -18,7 +18,7 @@
set 2, a
set 3, a
ld [wd003], a
-.asm_4805a
+.not_yet_initialized
call Function486bf
call LoadFontsExtra
ld de, GFX_488c3
@@ -125,22 +125,22 @@
ld hl, wMenuCursorY
ld b, [hl]
push bc
-
asm_4815f: ; 4815f (12:415f)
- bit 0, a
+ bit A_BUTTON_F, a
jp nz, Function4820d
ld b, a
ld a, [wd002]
bit 6, a
- jr z, .asm_48177
+ jr z, .dont_check_b_button
ld hl, wd479
bit 1, [hl]
- jr z, .asm_48177
- bit 1, b
- jr nz, .asm_4817a
-.asm_48177
+ jr z, .dont_check_b_button
+ bit B_BUTTON_F, b
+ jr nz, .b_button
+.dont_check_b_button
jp Function48272
-.asm_4817a
+
+.b_button
call ClearBGPalettes
call Function48d30
pop bc
@@ -258,7 +258,7 @@
call Function48d30
pop bc
call ClearTileMap
- ld b, SCGB_08
+ ld b, SCGB_DIPLOMA
call GetSGBLayout
ld hl, wd479
set 1, [hl]
@@ -359,7 +359,7 @@
ld a, $29
.asm_4833f
ld [wMenuScrollPosition], a
- callba Function104148
+ callba Mobile_OpenAndCloseMenu_HDMATransferTileMapAndAttrMap
.asm_48348
call ScrollingMenu
ld de, $629
@@ -385,7 +385,7 @@
ld [wd003], a
.asm_48377
call Function48187
- callba Function104148
+ callba Mobile_OpenAndCloseMenu_HDMATransferTileMapAndAttrMap
jp Function4840c
Function48383: ; 48383 (12:4383)
@@ -497,13 +497,14 @@
ld [hl], b
ld a, [wd002]
bit 6, a
- jr nz, .asm_48437
+ jr nz, .narrower_box
ld b, 9
ld c, 1
hlcoord 1, 4
call ClearBox
jp Function48157
-.asm_48437
+
+.narrower_box
ld b, 7
ld c, 1
hlcoord 1, 6
@@ -667,13 +668,13 @@
call GetMysteryGift_MobileAdapterLayout
call ClearBGPalettes
hlcoord 0, 0
- ld b, $4
- ld c, $14
+ ld b, 4
+ ld c, SCREEN_WIDTH
call ClearBox
hlcoord 0, 2
ld a, $c
ld [hl], a
- ld bc, $13
+ ld bc, SCREEN_WIDTH - 1
add hl, bc
ld [hl], a
ld de, MobileProfileString
@@ -689,121 +690,139 @@
ld hl, w2DMenuCursorInitY
ld a, [wd002]
bit 6, a
- jr nz, .asm_486ce
- ld a, $4
+ jr nz, .start_at_6
+ ld a, 4
ld [hli], a
- jr .asm_486d1
-.asm_486ce
- ld a, $6
+ jr .got_init_y
+
+.start_at_6
+ ld a, 6
ld [hli], a
-.asm_486d1
- ld a, $1
- ld [hli], a
+.got_init_y
+ ld a, 1
+ ld [hli], a ; init x
ld a, [wd002]
bit 6, a
- jr nz, .asm_486e7
+ jr nz, .check_wd479
call Function48725
- ld a, $4
- jr nc, .asm_486e4
- ld a, $5
-.asm_486e4
+ ld a, 4
+ jr nc, .got_num_rows_1
+ ld a, 5
+.got_num_rows_1
ld [hli], a
- jr .asm_486fb
-.asm_486e7
+ jr .got_num_rows_2
+
+.check_wd479
ld a, [wd479]
bit 1, a
- jr nz, .asm_486f8
+ jr nz, .four_rows
call Function48725
- jr c, .asm_486f8
- ld a, $3
+ jr c, .four_rows
+ ld a, 3
ld [hli], a
- jr .asm_486fb
-.asm_486f8
- ld a, $4
+ jr .got_num_rows_2
+
+.four_rows
+ ld a, 4
ld [hli], a
-.asm_486fb
- ld a, $1
- ld [hli], a
- ld [hl], $0
+.got_num_rows_2
+ ld a, 1
+ ld [hli], a ; num cols
+ ld [hl], $0 ; flags 1
set 5, [hl]
inc hl
xor a
- ld [hli], a
+ ld [hli], a ; flags 2
ld a, $20
- ld [hli], a
- ld a, $1
- add $40
- add $80
+ ld [hli], a ; cursor offsets
+ ld a, A_BUTTON
+ add D_UP
+ add D_DOWN
push af
ld a, [wd002]
bit 6, a
- jr z, .asm_4871a
+ jr z, .got_joypad_mask
pop af
- add $2
+ add B_BUTTON
push af
-.asm_4871a
+.got_joypad_mask
pop af
ld [hli], a
ld a, $1
- ld [hli], a
- ld [hli], a
+ ld [hli], a ; cursor y
+ ld [hli], a ; cursor x
xor a
-rept 3
- ld [hli], a
-endr
+ ld [hli], a ; off char
+ ld [hli], a ; cursor tile
+ ld [hli], a ; cursor tile + 1
ret
Function48725: ; 48725 (12:4725)
+; ld a, [wd003]
+; and $f
+; cp $f
+; jr nz, .clear_carry
+; scf
+; ret
+; .clear_carry
+; and a
+; ret
+
ld a, [wd003]
bit 0, a
- jr z, .asm_4873a
+ jr z, .clear_carry
bit 1, a
- jr z, .asm_4873a
+ jr z, .clear_carry
bit 2, a
- jr z, .asm_4873a
+ jr z, .clear_carry
bit 3, a
- jr z, .asm_4873a
+ jr z, .clear_carry
scf
ret
-.asm_4873a
+
+.clear_carry
and a
ret
Function4873c: ; 4873c (12:473c)
ld hl, w2DMenuCursorInitY
- ld a, $4
+ ld a, 4
ld [hli], a
- ld a, $c
- ld [hli], a
- ld a, $2
- ld [hli], a
- ld a, $1
- ld [hli], a
- ld [hl], $0
+ ld a, 12
+ ld [hli], a ; init x
+ ld a, 2
+ ld [hli], a ; num rows
+ ld a, 1
+ ld [hli], a ; num cols
+ ld [hl], $0 ; flags 1
set 5, [hl]
inc hl
xor a
- ld [hli], a
- ld a, $20
- ld [hli], a
- ld a, $1
- add $2
- ld [hli], a
+ ld [hli], a ; flags 2
+ ln a, 2, 0
+ ld [hli], a ; cursor offsets
+ ld a, A_BUTTON
+ add B_BUTTON
+ ld [hli], a ; joypad filter
+ ; ld a, [PlayerGender]
+ ; xor 1
+ ; inc a
ld a, [PlayerGender]
and a
- jr z, .asm_48764
- ld a, $2
- jr .asm_48766
-.asm_48764
+ jr z, .male
+ ld a, 2
+ jr .okay_gender
+
+.male
+ ld a, 1
+.okay_gender
+ ld [hli], a ; cursor y
ld a, $1
-.asm_48766
- ld [hli], a
- ld a, $1
- ld [hli], a
+ ld [hli], a ; cursor x
xor a
-rept 3
- ld [hli], a
-endr
+ ld [hli], a ; off char
+ ld [hli], a ; cursor tile
+ ld [hli], a ; cursor tile + 1
ret
Function4876f: ; 4876f (12:476f)
--- a/misc/mobile_12_2.asm
+++ b/misc/mobile_12_2.asm
@@ -53,9 +53,9 @@
jr z, .asm_4a8d1
ld hl, .BoxAddrs
ld b, 0
-rept 3
add hl, bc
-endr
+ add hl, bc
+ add hl, bc
ld a, [hli]
call GetSRAMBank
ld a, [hli]
@@ -616,9 +616,8 @@
ld a, [wMenuCursorY]
ld [wMenuCursorY], a
ld a, [PartyCount]
-rept 2
inc a
-endr
+ inc a
ld b, a
ld a, [wMenuCursorY]
cp b
--- a/misc/mobile_22.asm
+++ b/misc/mobile_22.asm
@@ -45,7 +45,9 @@
ret
Function89185: ; 89185 (22:5185)
-; Compares c bytes starting at de and hl and incrementing together until a match is found.
+; strcmp(hl, de, c)
+; Compares c bytes starting at de and hl and incrementing together until a mismatch is found.
+; Preserves hl and de.
push de
push hl
.loop
@@ -62,7 +64,9 @@
ret
Function89193: ; 89193
+; copy(hl, de, 4)
; Copies c bytes from hl to de.
+; Preserves hl and de.
push de
push hl
.loop
@@ -92,14 +96,14 @@
ret
Function891ab: ; 891ab
- call Function89240
+ call Mobile22_SetBGMapMode1
callba ReloadMapPart
- call Function8923c
+ call Mobile22_SetBGMapMode0
ret
; 891b8
Function891b8: ; 891b8
- call Function8923c
+ call Mobile22_SetBGMapMode0
hlcoord 0, 0
ld a, " "
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
@@ -125,7 +129,7 @@
ret
Function891de: ; 891de
- call Function8923c
+ call Mobile22_SetBGMapMode0
call ClearPalettes
hlcoord 0, 0, AttrMap
ld a, $7
@@ -193,18 +197,18 @@
pop de
ret
-Function89235: ; 89235 (22:5235)
+Mobile22_ButtonSound: ; 89235 (22:5235)
call JoyWaitAorB
call PlayClickSFX
ret
-Function8923c: ; 8923c
+Mobile22_SetBGMapMode0: ; 8923c
xor a
ld [hBGMapMode], a
ret
; 89240
-Function89240: ; 89240
+Mobile22_SetBGMapMode1: ; 89240
ld a, $1
ld [hBGMapMode], a
ret
@@ -249,7 +253,7 @@
pop af
ld [wMenuCursorBuffer], a
call PushWindow
- call Function8923c
+ call Mobile22_SetBGMapMode0
call Function89209
call VerticalMenu
push af
@@ -355,10 +359,10 @@
Function8931b: ; 8931b
push hl
- ld hl, $a03b
+ ld hl, $a03b ; 4:a03b
ld a, [MenuSelection]
dec a
- ld bc, $0025
+ ld bc, 37
call AddNTimes
ld b, h
ld c, l
@@ -371,7 +375,9 @@
add hl, bc
Function89331: ; 89331
-; Scans up to 5 characters starting at hl, looking for a nonspace character up to the next terminator. Sets carry if it does not find a nonspace character. Returns the location of the following character in hl.
+; Scans up to 5 characters starting at hl, looking for a nonspace character up to the next terminator.
+; Sets carry if it does not find a nonspace character.
+; Returns the location of the following character in hl.
push bc
ld c, 5
.loop
@@ -669,9 +675,8 @@
ld c, d
ld b, 0
ld hl, .PalettePointers
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
@@ -770,7 +775,7 @@
add hl, bc
ld b, h
ld c, l
- callba Function4e929
+ callba GetMobileOTTrainerClass
ld a, c
ld [TrainerClass], a
ld a, [rSVBK]
@@ -787,9 +792,8 @@
ld a, [TrainerClass]
ld h, 0
ld l, a
-rept 2
add hl, hl
-endr
+ add hl, hl
ld de, TrainerPalettes
add hl, de
ld a, [rSVBK]
@@ -1043,9 +1047,8 @@
Function896f5: ; 896f5
call Function8971f
call Function89736
-rept 2
inc hl
-endr
+ inc hl
ld b, 2
ClearScreenArea: ; 0x896ff
@@ -1071,9 +1074,8 @@
jr nz, .loop
dec hl
-rept 2
inc c
-endr
+ inc c
.asm_89713
ld a, $36
ld [hli], a
@@ -1107,9 +1109,8 @@
Function89736: ; 89736
push hl
-rept 2
inc hl
-endr
+ inc hl
ld e, c
ld d, $0
add hl, de
@@ -1145,9 +1146,8 @@
ld [hli], a
ld a, $d
ld [hl], a
-rept 2
dec hl
-endr
+ dec hl
ld a, $4
ld e, $3
.asm_89769
@@ -1220,7 +1220,7 @@
add hl, bc
ld b, h
ld c, l
- callba Function4e929
+ callba GetMobileOTTrainerClass
ld a, c
ld [TrainerClass], a
xor a
@@ -1655,44 +1655,44 @@
; 89a57
Function89a57: ; 89a57
- call Function354b
- bit 6, c
- jr nz, .asm_89a78
- bit 7, c
- jr nz, .asm_89a81
- bit 0, c
- jr nz, .asm_89a70
- bit 1, c
- jr nz, .asm_89a70
- bit 3, c
- jr nz, .asm_89a74
+ call JoyTextDelay_ForcehJoyDown ; joypad
+ bit D_UP_F, c
+ jr nz, .d_up
+ bit D_DOWN_F, c
+ jr nz, .d_down
+ bit A_BUTTON_F, c
+ jr nz, .a_b_button
+ bit B_BUTTON_F, c
+ jr nz, .a_b_button
+ bit START_F, c
+ jr nz, .start_button
scf
ret
-.asm_89a70
+.a_b_button
ld a, $1
and a
ret
-.asm_89a74
+.start_button
ld a, $2
and a
ret
-.asm_89a78
- call Function89a9b
- call nc, Function89a8a
+.d_up
+ call .MoveCursorUp
+ call nc, .PlayPocketSwitchSFX
ld a, $0
ret
-.asm_89a81
- call Function89a93
- call nc, Function89a8a
+.d_down
+ call .MoveCursorDown
+ call nc, .PlayPocketSwitchSFX
ld a, $0
ret
; 89a8a
-Function89a8a: ; 89a8a
+.PlayPocketSwitchSFX: ; 89a8a
push af
ld de, SFX_SWITCH_POCKETS
call PlaySFX
@@ -1700,42 +1700,42 @@
ret
; 89a93
-Function89a93: ; 89a93
- ld d, $28
- ld e, $1
- call Function89aa3
+.MoveCursorDown: ; 89a93
+ ld d, 40
+ ld e, 1
+ call .ApplyCursorMovement
ret
; 89a9b
-Function89a9b: ; 89a9b
- ld d, $1
- ld e, $ff
- call Function89aa3
+.MoveCursorUp: ; 89a9b
+ ld d, 1
+ ld e, -1
+ call .ApplyCursorMovement
ret
; 89aa3
-Function89aa3: ; 89aa3
+.ApplyCursorMovement: ; 89aa3
ld a, [MenuSelection]
ld c, a
push bc
-.asm_89aa8
+.loop
ld a, [MenuSelection]
cp d
- jr z, .asm_89ac0
+ jr z, .equal_to_d
add e
- jr nz, .asm_89ab2
+ jr nz, .not_zero
inc a
-.asm_89ab2
+.not_zero
ld [MenuSelection], a
- call Function89ac7
- jr nc, .asm_89aa8
- call Function89ae6
+ call .Function89ac7 ; BCD conversion of data in SRAM?
+ jr nc, .loop
+ call .Function89ae6 ; split [MenuSelection] into [wd030] + [wd031] where [wd030] <= 5
pop bc
and a
ret
-.asm_89ac0
+.equal_to_d
pop bc
ld a, c
ld [MenuSelection], a
@@ -1743,48 +1743,48 @@
ret
; 89ac7
-Function89ac7: ; 89ac7
+.Function89ac7: ; 89ac7
call OpenSRAMBank4
call Function8931b
- call Function89ad4
+ call .Function89ad4
call CloseSRAM
ret
; 89ad4
-Function89ad4: ; 89ad4
+.Function89ad4: ; 89ad4
push de
- call Function8932d
- jr c, .asm_89ae3
- ld hl, $0011
+ call Function8932d ; find a non-space character within 5 bytes of bc
+ jr c, .no_nonspace_character
+ ld hl, 17
add hl, bc
call Function89b45
- jr c, .asm_89ae4
+ jr c, .finish_decode
-.asm_89ae3
+.no_nonspace_character
and a
-.asm_89ae4
+.finish_decode
pop de
ret
; 89ae6
-Function89ae6: ; 89ae6
+.Function89ae6: ; 89ae6
ld hl, wd031
xor a
ld [hl], a
ld a, [MenuSelection]
-.asm_89aee
- cp $6
- jr c, .asm_89afc
- sub $5
+.loop2
+ cp 6
+ jr c, .load_and_ret
+ sub 5
ld c, a
ld a, [hl]
- add $5
+ add 5
ld [hl], a
ld a, c
- jr .asm_89aee
+ jr .loop2
-.asm_89afc
+.load_and_ret
ld [wd030], a
ret
; 89b00
@@ -1796,7 +1796,7 @@
; 89b07 (22:5b07)
Function89b07: ; 89b07
- call Function8923c
+ call Mobile22_SetBGMapMode0
call DelayFrame
callba Function4a3a7
ret
@@ -1824,53 +1824,55 @@
ret
Function89b3b: ; 89b3b (22:5b3b)
- call Function8923c
+ call Mobile22_SetBGMapMode0
callba Function48cda
ret
Function89b45: ; 89b45
+ ; some sort of decoder?
+ ; BCD?
push hl
push bc
ld c, $10
ld e, $0
-.asm_89b4b
+.loop
ld a, [hli]
ld b, a
and $f
- cp $a
- jr c, .asm_89b5a
+ cp 10
+ jr c, .low_nybble_less_than_10
ld a, c
cp $b
- jr nc, .asm_89b74
- jr .asm_89b71
+ jr nc, .clear_carry
+ jr .set_carry
-.asm_89b5a
+.low_nybble_less_than_10
dec c
swap b
inc e
ld a, b
and $f
- cp $a
- jr c, .asm_89b6c
+ cp 10
+ jr c, .high_nybble_less_than_10
ld a, c
cp $b
- jr nc, .asm_89b74
- jr .asm_89b71
+ jr nc, .clear_carry
+ jr .set_carry
-.asm_89b6c
+.high_nybble_less_than_10
inc e
dec c
- jr nz, .asm_89b4b
+ jr nz, .loop
dec e
-.asm_89b71
+.set_carry
scf
- jr .asm_89b75
+ jr .finish
-.asm_89b74
+.clear_carry
and a
-.asm_89b75
+.finish
pop bc
pop hl
ret
@@ -1912,9 +1914,8 @@
and a
jr z, .asm_89bae
.asm_89ba9
-rept 2
inc hl
-endr
+ inc hl
dec a
jr nz, .asm_89ba9
.asm_89bae
@@ -2034,56 +2035,59 @@
ret
Function89c67: ; 89c67 (22:5c67)
- call Function354b
+; menu scrolling?
+ call JoyTextDelay_ForcehJoyDown ; joypad
ld b, $0
- bit 0, c
- jr z, .asm_89c74
+ bit A_BUTTON_F, c
+ jr z, .not_a_button
ld b, $1
and a
ret
-.asm_89c74
- bit 1, c
- jr z, .asm_89c7a
+
+.not_a_button
+ bit B_BUTTON_F, c
+ jr z, .not_b_button
scf
ret
-.asm_89c7a
+
+.not_b_button
xor a
- bit 6, c
- jr z, .asm_89c81
+ bit D_UP_F, c
+ jr z, .not_d_up
ld a, $1
-.asm_89c81
- bit 7, c
- jr z, .asm_89c87
+.not_d_up
+ bit D_DOWN_F, c
+ jr z, .not_d_down
ld a, $2
-.asm_89c87
- bit 5, c
- jr z, .asm_89c8d
+.not_d_down
+ bit D_LEFT_F, c
+ jr z, .not_d_left
ld a, $3
-.asm_89c8d
- bit 4, c
- jr z, .asm_89c93
+.not_d_left
+ bit D_RIGHT_F, c
+ jr z, .not_d_right
ld a, $4
-.asm_89c93
+.not_d_right
and a
- ret z
+ ret z ; no dpad pressed
dec a
ld c, a
ld d, $0
- ld hl, Unknown_89cbf
+ ld hl, .ScrollData0
ld a, [wd02f]
and a
- jr z, .asm_89ca5
- ld hl, Unknown_89ccf
-.asm_89ca5
+ jr z, .got_data
+ ld hl, .ScrollData1
+.got_data
ld a, [wd011]
and a
- jr z, .asm_89cb1
+ jr z, .got_row
ld e, $4
-.asm_89cad
+.add_n_times
add hl, de
dec a
- jr nz, .asm_89cad
-.asm_89cb1
+ jr nz, .add_n_times
+.got_row
ld e, c
add hl, de
ld a, [hl]
@@ -2096,13 +2100,13 @@
ret
; 89cbf (22:5cbf)
-Unknown_89cbf: ; 89cbf
+.ScrollData0: ; 89cbf
db 0, 2, 0, 0
db 1, 3, 0, 0
db 2, 4, 0, 0
db 3, 0, 0, 0
-Unknown_89ccf: ; 89ccf
+.ScrollData1: ; 89ccf
db 0, 0, 0, 0
db 0, 3, 0, 0
db 2, 4, 0, 0
@@ -2148,37 +2152,41 @@
ret
Function89d0d: ; 89d0d (22:5d0d)
- call Function8923c
+ call Mobile22_SetBGMapMode0
ld a, [rSVBK]
push af
ld a, $5
ld [rSVBK], a
- ld c, $8
+
+ ld c, 8
ld de, UnknBGPals
-.asm_89d1c
+.loop
push bc
- ld hl, Palette_89d4e
- ld bc, $8
+ ld hl, .Palette1
+ ld bc, 1 palettes
call CopyBytes
pop bc
dec c
- jr nz, .asm_89d1c
- ld hl, Palette_89d56
- ld de, wd010
- ld bc, $8
+ jr nz, .loop
+
+ ld hl, .Palette2
+ ld de, UnknBGPals + 2 palettes
+ ld bc, 1 palettes
call CopyBytes
+
pop af
ld [rSVBK], a
+
call SetPalettes
- callba Function845db
- call Function89240
- ld c, $18
+ callba PrintMail_
+ call Mobile22_SetBGMapMode1
+ ld c, 24
call DelayFrames
call RestartMapMusic
ret
; 89d4e (22:5d4e)
-Palette_89d4e: ; 89d4e
+.Palette1: ; 89d4e
RGB 31, 31, 31
RGB 19, 19, 19
RGB 15, 15, 15
@@ -2185,7 +2193,7 @@
RGB 00, 00, 00
; 89d56
-Palette_89d56: ; 89d56
+.Palette2: ; 89d56
RGB 31, 31, 31
RGB 19, 19, 19
RGB 19, 19, 19
@@ -2197,7 +2205,7 @@
call CopyMenuDataHeader
pop af
ld [wMenuCursorBuffer], a
- call Function8923c
+ call Mobile22_SetBGMapMode0
call PlaceVerticalMenuItems
call InitVerticalMenuCursor
ld hl, w2DMenuFlags1
@@ -2206,21 +2214,21 @@
Function89d75: ; 89d75 (22:5d75)
push hl
- call Function8923c
+ call Mobile22_SetBGMapMode0
call _hl_
- callba Function104148
+ callba Mobile_OpenAndCloseMenu_HDMATransferTileMapAndAttrMap
pop hl
jr asm_89d90
Function89d85: ; 89d85 (22:5d85)
push hl
- call Function8923c
+ call Mobile22_SetBGMapMode0
call _hl_
call CGBOnly_LoadEDTile
pop hl
asm_89d90: ; 89d90 (22:5d90)
- call Function8923c
+ call Mobile22_SetBGMapMode0
push hl
call _hl_
call Function89dab
@@ -2238,9 +2246,9 @@
ret
Function89dab: ; 89dab (22:5dab)
- call Function8923c
+ call Mobile22_SetBGMapMode0
callba MobileMenuJoypad
- call Function8923c
+ call Mobile22_SetBGMapMode0
ld a, c
ld hl, wMenuJoypadFilter
and [hl]
@@ -2312,7 +2320,7 @@
Function89e1e: ; 89e1e (22:5e1e)
call OpenSRAMBank4
- ld bc, $a037
+ ld bc, $a037 ; 4:a037
call Function8b36c
call CloseSRAM
xor a
@@ -2418,7 +2426,7 @@
Function89ee1: ; 89ee1 (22:5ee1)
call ClearBGPalettes
call Function893e2
- call Function8923c
+ call Mobile22_SetBGMapMode0
callba Function4a3a7
callba MG_Mobile_Layout_CreatePalBoxes
hlcoord 1, 0
@@ -2523,9 +2531,8 @@
ld [hli], a
ld a, c
ld [hli], a
-rept 2
inc hl
-endr
+ inc hl
ld a, $8
add c
ld c, a
@@ -2625,7 +2632,7 @@
call Function89a0c
call CloseSRAM
call Function891ab
- call Function89235
+ call Mobile22_ButtonSound
jp Function89e36
Function8a03d: ; 8a03d (22:603d)
@@ -2656,9 +2663,9 @@
ld a, $5
call Function8a5a3
pop hl
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
ld a, $6
call Function8a5a3
call CGBOnly_LoadEDTile
@@ -2680,7 +2687,7 @@
jp Function89e36
Function8a0a1: ; 8a0a1 (22:60a1)
- call Function8923c
+ call Mobile22_SetBGMapMode0
push bc
call Function8a0c9
ld e, $6
@@ -2781,7 +2788,7 @@
ld hl, MenuDataHeader_0x8a176
call LoadMenuDataHeader
.asm_8a121
- call Function8923c
+ call Mobile22_SetBGMapMode0
call Function8a17b
jr c, .asm_8a16b
ld a, [wMenuCursorY]
@@ -2948,7 +2955,7 @@
Function8a262: ; 8a262 (22:6262)
call ClearBGPalettes
call Function893e2
- call Function8923c
+ call Mobile22_SetBGMapMode0
callba Function4a3a7
callba MG_Mobile_Layout_CreatePalBoxes
hlcoord 1, 0
@@ -3042,7 +3049,7 @@
Function8a31c: ; 8a31c (22:631c)
push bc
- call Function8923c
+ call Mobile22_SetBGMapMode0
callba Function4a3a7
callba MG_Mobile_Layout_CreatePalBoxes
hlcoord 1, 0
@@ -3060,7 +3067,7 @@
set 7, [hl]
.asm_8a34e
call Function8a3a2
- call Function8923c
+ call Mobile22_SetBGMapMode0
call Function8a453
call Function8a4d3
call Function8a4fc
@@ -3585,7 +3592,7 @@
call Function8a765
call CloseSRAM
jr nc, .asm_8a73f
- call Function8923c
+ call Mobile22_SetBGMapMode0
call Function89448
call Function89a23
hlcoord 1, 13
@@ -3804,7 +3811,7 @@
call Function892b4
call CloseSRAM
call Function89a23
- call Function8923c
+ call Mobile22_SetBGMapMode0
hlcoord 1, 13
ld de, String_8a926
call PlaceString
@@ -4069,7 +4076,7 @@
; 8aaf0 (22:6af0)
String_8aaf0: ; 8aaf0
- db "あたらしい めいし", $4a, "できまし", $22, "@"
+ db "あたらしい めいし<PKMN>できまし<LNBRK>@"
; 8ab00
Function8ab00: ; 8ab00
@@ -4077,7 +4084,7 @@
hlcoord 1, 13
call PlaceString
call WaitBGMap
- call Function89235
+ call Mobile22_ButtonSound
and a
ret
@@ -4104,6 +4111,7 @@
ret
Function8ab3b: ; 8ab3b (22:6b3b)
+.pressed_start
call Function891fe
call ClearBGPalettes
call Function893cc
@@ -4122,23 +4130,24 @@
call Function89a0c
call CloseSRAM
call Function891ab
- call Function8ab77
- jr c, Function8ab3b
+ call .JoypadLoop
+ jr c, .pressed_start
ret
-Function8ab77: ; 8ab77 (22:6b77)
- call Function354b
- bit 0, c
- jr nz, .asm_8ab8e
- bit 1, c
- jr nz, .asm_8ab8e
- bit 3, c
- jr z, Function8ab77
+.JoypadLoop: ; 8ab77 (22:6b77)
+ call JoyTextDelay_ForcehJoyDown
+ bit A_BUTTON_F, c
+ jr nz, .a_b_button
+ bit B_BUTTON_F, c
+ jr nz, .a_b_button
+ bit START_F, c
+ jr z, .JoypadLoop
call PlayClickSFX
call Function89d0d
scf
ret
-.asm_8ab8e
+
+.a_b_button
call PlayClickSFX
and a
ret
@@ -4363,7 +4372,7 @@
jr z, .asm_8ad0b
cp $2
jr z, .asm_8ad37
- call Function8923c
+ call Mobile22_SetBGMapMode0
push bc
hlcoord 0, 12
ld b, $4
@@ -4375,7 +4384,7 @@
ld a, $2
call Function8925e
jr c, .asm_8ad87
- call Function8923c
+ call Mobile22_SetBGMapMode0
hlcoord 0, 12
ld b, $4
ld c, $12
--- a/misc/mobile_22_2.asm
+++ b/misc/mobile_22_2.asm
@@ -54,10 +54,11 @@
; 8b36c
Function8b36c: ; 8b36c (22:736c)
+ ; [bc + (0:4)] = -1
push bc
ld h, b
ld l, c
- ld bc, $4
+ ld bc, 4
ld a, -1
call ByteFill
pop bc
@@ -64,6 +65,7 @@
ret
Function8b379: ; 8b379 (22:7379)
+ ; d = [bc + e]
push bc
ld a, c
add e
@@ -77,6 +79,7 @@
ret
Function8b385: ; 8b385 (22:7385)
+ ; [bc + e] = d
push bc
ld a, c
add e
@@ -90,29 +93,32 @@
ret
Function8b391: ; 8b391 (22:7391)
+ ; find first e in range(4) such that [bc + e] == -1
+ ; if none exist, return carry
push bc
- ld e, $0
- ld d, $4
-.asm_8b396
+ ld e, 0
+ ld d, 4
+.loop
ld a, [bc]
inc bc
- cp $ff
- jr z, .asm_8b3a2
+ cp -1
+ jr z, .done
inc e
dec d
- jr nz, .asm_8b396
+ jr nz, .loop
dec e
scf
-.asm_8b3a2
+.done
pop bc
ret
Function8b3a4: ; 8b3a4 (22:73a4)
+ ; strcmp(hl, bc, 4)
push de
push bc
ld d, b
ld e, c
- ld c, $4
+ ld c, 4
call Function89185
pop bc
pop de
@@ -119,7 +125,7 @@
ret
Function8b3b0: ; 8b3b0 (22:73b0)
- ld bc, $a037
+ ld bc, $a037 ; 4:a037
ld a, [$a60b]
and a
jr z, .asm_8b3c2
@@ -153,82 +159,88 @@
Function8b3dd: ; 8b3dd (22:73dd)
push de
push bc
- call Function354b
+ call JoyTextDelay_ForcehJoyDown ; joypad
ld a, c
pop bc
pop de
- bit 0, a
- jr nz, .asm_8b3f7
- bit 1, a
- jr nz, .asm_8b40e
- bit 6, a
- jr nz, .asm_8b429
- bit 7, a
- jr nz, .asm_8b443
+ bit A_BUTTON_F, a
+ jr nz, .a_button
+ bit B_BUTTON_F, a
+ jr nz, .b_button
+ bit D_UP_F, a
+ jr nz, .d_up
+ bit D_DOWN_F, a
+ jr nz, .d_down
and a
ret
-.asm_8b3f7
+
+.a_button
ld a, e
cp $3
- jr z, .asm_8b407
+ jr z, .e_is_zero
inc e
- ld d, $0
+ ld d, 0
call Function8b385
xor a
ld [wd010], a
ret
-.asm_8b407
+
+.e_is_zero
call PlayClickSFX
ld d, $0
scf
ret
-.asm_8b40e
+
+.b_button
ld a, e
and a
- jr nz, .asm_8b41e
+ jr nz, .e_is_not_zero
call PlayClickSFX
- ld d, $ff
+ ld d, -1
call Function8b385
- ld d, $1
+ ld d, 1
scf
ret
-.asm_8b41e
- ld d, $ff
+
+.e_is_not_zero
+ ld d, -1
call Function8b385
dec e
xor a
ld [wd010], a
ret
-.asm_8b429
+
+.d_up
call Function8b379
ld a, d
cp $a
- jr c, .asm_8b433
+ jr c, .less_than_10_up_1
ld d, $9
-.asm_8b433
+.less_than_10_up_1
inc d
ld a, d
cp $a
- jr c, .asm_8b43b
+ jr c, .less_than_10_up_2
ld d, $0
-.asm_8b43b
+.less_than_10_up_2
call Function8b385
xor a
ld [wd010], a
ret
-.asm_8b443
+
+.d_down
call Function8b379
ld a, d
cp $a
- jr c, .asm_8b44d
+ jr c, .less_than_10_down
ld d, $0
-.asm_8b44d
+.less_than_10_down
ld a, d
dec d
and a
- jr nz, .asm_8b454
+ jr nz, .nonzero_down
ld d, $9
-.asm_8b454
+.nonzero_down
call Function8b385
xor a
ld [wd010], a
@@ -243,7 +255,7 @@
ld d, $0
call Function8b385
.asm_8b46e
- call Function8923c
+ call Mobile22_SetBGMapMode0
call Function8b493
call Function8b4cc
call Function8b518
@@ -264,7 +276,7 @@
Function8b493: ; 8b493 (22:7493)
push bc
- call Function8923c
+ call Mobile22_SetBGMapMode0
call Function8b521
ld hl, Jumptable_8b4a0
pop bc
@@ -314,9 +326,8 @@
ld hl, Unknown_8b529
call Function8b50a
push hl
-rept 2
inc hl
-endr
+ inc hl
ld a, [hli]
ld b, a
ld a, [hl]
@@ -331,9 +342,8 @@
ld hl, Unknown_8b529
call Function8b50a
push hl
-rept 2
inc hl
-endr
+ inc hl
ld a, [hli]
ld b, a
ld a, [hl]
@@ -405,6 +415,7 @@
ret
Function8b555: ; 8b555 (22:7555)
+.loop
ld hl, UnknownText_0x8b5ce
call PrintText
ld bc, wd017
@@ -418,17 +429,18 @@
jr nz, .asm_8b57c
ld hl, UnknownText_0x8b5e2
call PrintText
- jr Function8b555
+ jr .loop
+
.asm_8b57c
ld hl, UnknownText_0x8b5d3
call PrintText
ld bc, wd013
call Function8b45c
- jr c, Function8b555
+ jr c, .loop
ld bc, wd017
ld hl, wd013
call Function8b3a4
- jr z, .asm_8b5a6
+ jr z, .strings_equal
call Function89448
ld bc, wd013
call Function8b493
@@ -435,10 +447,11 @@
ld hl, UnknownText_0x8b5d8
call PrintText
jr .asm_8b57c
-.asm_8b5a6
+
+.strings_equal
call OpenSRAMBank4
ld hl, wd013
- ld de, $a037
+ ld de, $a037 ; 4:a037
ld bc, $4
call CopyBytes
call CloseSRAM
@@ -506,7 +519,7 @@
ld bc, wd013
call Function8b493
call OpenSRAMBank4
- ld hl, $a037
+ ld hl, $a037 ; 4:a037
call Function8b3a4
call CloseSRAM
jr z, .asm_8b635
@@ -644,7 +657,7 @@
; 8b703
Function8b703: ; 8b703
- call Function8923c
+ call Mobile22_SetBGMapMode0
push hl
ld a, $c
ld [hli], a
@@ -698,12 +711,10 @@
Function8b744: ; 8b744
ld de, AttrMap - TileMap
add hl, de
-rept 2
inc b
-endr
-rept 2
+ inc b
inc c
-endr
+ inc c
xor a
.asm_8b74d
push bc
@@ -722,7 +733,7 @@
; 8b75d
Function8b75d: ; 8b75d
- call Function8923c
+ call Mobile22_SetBGMapMode0
hlcoord 0, 0
ld a, $1
ld bc, SCREEN_WIDTH
@@ -975,9 +986,8 @@
ld b, 0
ld c, a
ld hl, Unknown_8b903
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
--- a/misc/mobile_40.asm
+++ b/misc/mobile_40.asm
@@ -4,7 +4,7 @@
; bc: addr
ld a, [rSVBK]
push af
- ld a, $01
+ ld a, 1
ld [rSVBK], a
call Function100022
@@ -26,7 +26,7 @@
Function100022: ; 100022
push de
push bc
- call Function100063
+ call SetRAMStateForMobile
pop bc
pop de
ld a, d
@@ -47,7 +47,7 @@
; 100057
Function100057: ; 100057
- call Function1000a4
+ call DisableMobile
call ReturnToMapFromSubmenu
ld hl, VramState
res 1, [hl]
@@ -54,7 +54,7 @@
ret
; 100063
-Function100063: ; 100063
+SetRAMStateForMobile: ; 100063
xor a
ld hl, BGMapBuffer
ld bc, $65
@@ -67,15 +67,16 @@
ld [BGMapBuffer], a
xor a
ld [hMapAnims], a
- ld [hFFC6], a
+ ld [hLCDCPointer], a
ret
; 100082
-Function100082: ; 100082
+EnableMobile: ; 100082
xor a
ld hl, OverworldMap
ld bc, OverworldMapEnd - OverworldMap
call ByteFill
+
di
call DoubleSpeed
xor a
@@ -84,15 +85,16 @@
ld [rIE], a
xor a
ld [hMapAnims], a
- ld [hFFC6], a
+ ld [hLCDCPointer], a
ld a, $01
ld [hMobileReceive], a
ld [hMobile], a
ei
+
ret
; 0x1000a4
-Function1000a4: ; 1000a4
+DisableMobile: ; 1000a4
di
xor a
ld [hMobileReceive], a
@@ -110,12 +112,12 @@
Function1000ba: ; 1000ba
.loop
- ; call [wcd22]:([wcd23][wcd24] + [wcd25])
+ ; call [wcd22]:([wcd23][wcd24] + [wMobileCommsJumptableIndex])
ld hl, wcd23
ld a, [hli]
ld h, [hl]
ld l, a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
ld e, a
ld d, 0
add hl, de
@@ -202,7 +204,7 @@
ret z
res 2, [hl]
res 6, [hl]
- callba Function10402d
+ callba HDMATransferTileMapToWRAMBank3
ret
; 100163
@@ -445,12 +447,12 @@
; 100320
Function100320: ; 100320
- callba Function104099
+ callba Mobile_ReloadMapPart
ret
; 100327
Function100327: ; 100327
- callba Function10402d
+ callba HDMATransferTileMapToWRAMBank3
ret
; 100327
@@ -984,32 +986,32 @@
db "まつ@"
; 10060d
-Function10060d: ; 10060d
+Mobile_CommunicationStandby: ; 10060d
hlcoord 3, 10
- ld b, $01
- ld c, $0b
+ ld b, 1
+ ld c, 11
call Function3eea
- ld de, String_100621
+ ld de, .String
hlcoord 4, 11
call PlaceString
ret
; 100621
-String_100621: ; 100621
+.String: ; 100621
db "つうしんたいきちゅう!@"
; 10062d
-Function10062d: ; 10062d
+AdvanceMobileInactivityTimerAndCheckExpired: ; 10062d
push bc
- call Function10064e
+ call IncrementMobileInactivityTimerByCFrames
pop bc
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
cp b
- jr nc, .asm_10063a
+ jr nc, .timed_out
and a
ret
-.asm_10063a
+.timed_out
ld a, $fa
ld [wcd2b], a
scf
@@ -1016,35 +1018,34 @@
ret
; 100641
-Function100641: ; 100641
+StartMobileInactivityTimer: ; 100641
xor a
- ld [wcd44], a
- ld [wcd45], a
- ld [wcd46], a
+ ld [wMobileInactivityTimerMinutes], a
+ ld [wMobileInactivityTimerSeconds], a
+ ld [wMobileInactivityTimerFrames], a
ret
; 10064c
-Function10064c: ; 10064c
+IncrementMobileInactivityTimerBy1Frame: ; 10064c
ld c, 1
-
-Function10064e: ; 10064e
- ld hl, wcd46
+IncrementMobileInactivityTimerByCFrames: ; 10064e
+ ld hl, wMobileInactivityTimerFrames ; timer?
ld a, [hl]
add c
- cp $3c
- jr c, .asm_100658
+ cp 60
+ jr c, .seconds
xor a
-.asm_100658
+.seconds
ld [hld], a
ret c
ld a, [hl]
inc a
- cp $3c
- jr c, .asm_100661
+ cp 60
+ jr c, .minutes
xor a
-.asm_100661
+.minutes
ld [hld], a
ret c
inc [hl]
@@ -1166,9 +1167,9 @@
ld hl, $a800
call GetSRAMBank
xor a
-rept 3
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
call CloseSRAM
ret
; 10070d
@@ -1266,35 +1267,35 @@
Function10079c: ; 10079c
ld a, [wcd21]
cp $01
- jr nz, .asm_1007f4
+ jr nz, .dont_quit
ld hl, wcd2a
bit 5, [hl]
- jr nz, .asm_1007f4
+ jr nz, .dont_quit
ld hl, wcd2a
bit 6, [hl]
- jr nz, .asm_1007f4
+ jr nz, .dont_quit
ld a, [wcd6a]
add c
- cp $3c
- jr nc, .asm_1007be
+ cp 60
+ jr nc, .overflow
ld [wcd6a], a
and a
ret
-.asm_1007be
- sub $3c
+.overflow
+ sub 60
ld [wcd6a], a
ld d, b
push de
call Function1007f6
pop de
- jr c, .asm_1007e5
+ jr c, .quit
ld a, c
and a
- jr nz, .asm_1007e5
+ jr nz, .quit
ld a, b
- cp $0a
- jr nc, .asm_1007e5
+ cp 10
+ jr nc, .quit
ld a, d
and a
ret z
@@ -1307,7 +1308,7 @@
and a
ret
-.asm_1007e5
+.quit
call Function1008e0
ld hl, wcd2a
set 4, [hl]
@@ -1316,7 +1317,7 @@
scf
ret
-.asm_1007f4
+.dont_quit
and a
ret
; 1007f6
@@ -1702,7 +1703,7 @@
.MobileBattle_SendReceiveAction: ; 100a87
call Function100acf
- call Function100641
+ call StartMobileInactivityTimer
ld a, 0
ld [wcd27], a
.asm_100a92
@@ -1712,7 +1713,7 @@
ld c, $01
ld b, $03
push bc
- call Function10062d
+ call AdvanceMobileInactivityTimerAndCheckExpired
pop bc
jr c, .asm_100ac7
ld b, $01
@@ -1821,7 +1822,7 @@
call Mobile_SetOverworldDelay
callba MobileMenuJoypad
push bc
- callba Function10402d
+ callba HDMATransferTileMapToWRAMBank3
call Function100e2d
pop bc
jr c, .asm_100b6b
@@ -1882,7 +1883,7 @@
call Mobile_SetOverworldDelay
callba MobileMenuJoypad
push bc
- callba Function10402d
+ callba HDMATransferTileMapToWRAMBank3
call Function100e2d
pop bc
jr c, .b_button
@@ -2016,8 +2017,8 @@
callba MobileMenuJoypad
push bc
callba PlaySpriteAnimations
- callba Function10402d
- call Function100dfd
+ callba HDMATransferTileMapToWRAMBank3
+ call MobileComms_CheckInactivityTimer
pop bc
jr c, .done
ld a, [wMenuJoypadFilter]
@@ -2070,8 +2071,8 @@
callba MobileMenuJoypad
push bc
callba PlaySpriteAnimations
- callba Function10402d
- call Function100dfd
+ callba HDMATransferTileMapToWRAMBank3
+ call MobileComms_CheckInactivityTimer
pop bc
jr c, .asm_100d54
ld a, [wMenuJoypadFilter]
@@ -2178,7 +2179,7 @@
Function100dd8: ; 100dd8
ld c, $01
ld b, $03
- callba Function10062d
+ callba AdvanceMobileInactivityTimerAndCheckExpired
jr c, .asm_100dfb
ld c, $3c
ld b, $01
@@ -2196,7 +2197,7 @@
ret
; 100dfd
-Function100dfd: ; 100dfd
+MobileComms_CheckInactivityTimer: ; 100dfd
ld a, [OverworldDelay]
ld c, a
ld a, 30
@@ -2204,22 +2205,22 @@
ld c, a
ld b, 3
push bc
- callba Function10062d
+ callba AdvanceMobileInactivityTimerAndCheckExpired ; useless to farcall
pop bc
- jr c, .asm_100e2b
+ jr c, .quit
ld b, 1
call Function10079c
- jr c, .asm_100e2b
+ jr c, .quit
call Function1009f3
- jr c, .asm_100e2b
- callba Function10032e
+ jr c, .quit
+ callba Function10032e ; useless to farcall
ld a, [wcd2b]
and a
- jr nz, .asm_100e2b
+ jr nz, .quit
xor a
ret
-.asm_100e2b
+.quit
scf
ret
; 100e2d
@@ -2232,7 +2233,7 @@
ld c, a
ld b, 3
push bc
- callba Function10062d
+ callba AdvanceMobileInactivityTimerAndCheckExpired
pop bc
jr c, .asm_100e61
ld b, 1
@@ -2641,53 +2642,55 @@
ret
; 1010f2
-Function1010f2: ; 1010f2
+LoadSelectedPartiesForColosseum: ; 1010f2
xor a
ld hl, StringBuffer2
ld bc, 9
call ByteFill
- ld hl, wdc5c
+ ld hl, wPlayerMonSelection
ld de, PartyCount
- call Function101145
- ld hl, wdc5c
+ call .CopyThreeSpecies
+ ld hl, wPlayerMonSelection
ld de, PartyMon1Species
- call Function10117c
- ld hl, wdc5c
+ call .CopyPartyStruct
+ ld hl, wPlayerMonSelection
ld de, PartyMonOT
- call Function101181
- ld hl, wdc5c
+ call .CopyName
+ ld hl, wPlayerMonSelection
ld de, PartyMonNicknames
- call Function101181
- ld hl, wcd75
+ call .CopyName
+ ld hl, wOTMonSelection
ld de, OTPartyCount
- call Function101145
- ld hl, wcd75
+ call .CopyThreeSpecies
+ ld hl, wOTMonSelection
ld de, OTPartyMon1Species
- call Function10117c
- ld hl, wcd75
+ call .CopyPartyStruct
+ ld hl, wOTMonSelection
ld de, OTPartyMonOT
- call Function101181
- ld hl, wcd75
+ call .CopyName
+ ld hl, wOTMonSelection
ld de, OTPartyMonNicknames
- call Function101181
+ call .CopyName
ret
; 101145
-Function101145: ; 101145
+.CopyThreeSpecies: ; 101145
+; Load the 3 choices to the buffer
push de
ld bc, StringBuffer2 + 6
xor a
-.asm_10114a
+.party_loop
push af
- call Function101168
+ call .GetNthSpecies
ld [bc], a
inc bc
pop af
inc a
- cp $03
- jr nz, .asm_10114a
+ cp 3
+ jr nz, .party_loop
pop de
- ld a, $03
+; Copy the 3 choices to the party
+ ld a, 3
ld [de], a
inc de
ld hl, StringBuffer2 + 6
@@ -2698,7 +2701,9 @@
ret
; 101168
-Function101168: ; 101168
+.GetNthSpecies: ; 101168
+; Preserves hl and de
+; Get the index of the Nth selection
push hl
add l
ld l, a
@@ -2707,6 +2712,7 @@
ld h, a
ld a, [hl]
pop hl
+; Get the corresponding species
push de
inc de
add e
@@ -2719,34 +2725,38 @@
ret
; 10117c
-Function10117c: ; 10117c
- ld bc, $30
- jr asm_101184
+.CopyPartyStruct: ; 10117c
+ ld bc, PARTYMON_STRUCT_LENGTH
+ jr .ContinueCopy
-Function101181: ; 101181
- ld bc, 11
+.CopyName: ; 101181
+ ld bc, NAME_LENGTH
-asm_101184:
+.ContinueCopy:
+ ; Copy, via wc608...
ld a, wc608 % $100
ld [StringBuffer2], a
ld a, wc608 / $100
ld [StringBuffer2 + 1], a
+ ; ... bc bytes...
ld a, c
ld [StringBuffer2 + 2], a
ld a, b
ld [StringBuffer2 + 3], a
+ ; ... to de...
ld a, e
ld [StringBuffer2 + 4], a
ld a, d
ld [StringBuffer2 + 5], a
- ld a, $03
-.asm_1011a0
+ ; ... 3 times.
+ ld a, 3
+.big_copy_loop
push af
ld a, [hli]
push hl
push af
- call Function1011df
- call Function1011e8
+ call .GetDestinationAddress
+ call .GetCopySize
pop af
call AddNTimes
ld a, [StringBuffer2]
@@ -2761,14 +2771,14 @@
pop hl
pop af
dec a
- jr nz, .asm_1011a0
- call Function1011e8
+ jr nz, .big_copy_loop
+ call .GetCopySize
ld a, 3
ld hl, 0
call AddNTimes
ld b, h
ld c, l
- call Function1011df
+ call .GetDestinationAddress
ld d, h
ld e, l
ld hl, wc608
@@ -2776,7 +2786,7 @@
ret
; 1011df
-Function1011df: ; 1011df
+.GetDestinationAddress: ; 1011df
ld a, [StringBuffer2 + 4]
ld l, a
ld a, [StringBuffer2 + 5]
@@ -2784,7 +2794,7 @@
ret
; 1011e8
-Function1011e8: ; 1011e8
+.GetCopySize: ; 1011e8
ld a, [StringBuffer2 + 2]
ld c, a
ld a, [StringBuffer2 + 3]
@@ -2889,146 +2899,144 @@
Function10127e: ; 10127e
ld a, [wdc5f]
and a
- jr z, .asm_101290
- cp $01
+ jr z, .zero
+ cp 1
ld c, $27
- jr z, .asm_101292
- cp $02
+ jr z, .load
+ cp 2
ld c, $37
- jr z, .asm_101292
-
-.asm_101290
+ jr z, .load
+.zero
ld c, 0
-
-.asm_101292
+.load
ld a, c
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101297
Jumptable_101297: ; 101297
- dw Function101a97
- dw Function101ab4
- dw Function101475
- dw Function101b0f
- dw Function101438
- dw Function101b2b
- dw Function101b59
- dw Function101475
- dw Function101b70
- dw Function101438
- dw Function101b8f
- dw Function101d7b
- dw Function101d95
- dw Function101475
- dw Function101db2
- dw Function101e4f
- dw Function101475
- dw Function101e64
- dw Function101e4f
- dw Function101475
- dw Function101e64
- dw Function101d95
- dw Function101475
- dw Function101db2
- dw Function101dd0
- dw Function101de3
- dw Function101e39
- dw Function101e09
- dw Function101e4f
- dw Function101475
- dw Function101e64
- dw Function101d95
- dw Function101475
- dw Function101db2
- dw Function101e09
- dw Function101e31
- dw Function101bc8
- dw Function101438
- dw Function101be5
- dw Function101ac6
- dw Function101ab4
- dw Function101475
- dw Function101c11
- dw Function1014f4
- dw Function101cc8
- dw Function1014e2
- dw Function1014e2
- dw Function101d10
- dw Function101d2a
- dw Function101d2a
- dw Function101507
- dw Function10156d
- dw Function101557
- dw Function10158a
- dw Function101c42
- dw Function101aed
- dw Function101ab4
- dw Function101475
- dw Function101c2b
- dw Function1014f4
- dw Function101cdf
- dw Function1014e2
- dw Function1014e2
- dw Function101d1e
- dw Function101d2a
- dw Function101d2a
- dw Function101507
- dw Function10156d
- dw Function101544
- dw Function10158a
- dw Function101c42
- dw Function101c50
- dw Function1014ce
- dw Function101cf6
- dw Function101826
- dw Function1017e4
- dw Function1017f1
- dw Function1018a8
- dw Function1018d6
- dw Function1017e4
- dw Function1017f1
- dw Function1018e1
- dw Function1015df
- dw Function10167d
- dw Function10168a
- dw Function10162a
- dw Function1015be
- dw Function10167d
- dw Function10168a
- dw Function10161f
- dw Function10159d
- dw Function10167d
- dw Function10168a
- dw Function101600
- dw Function101d03
- dw Function101d6b
- dw Function10159d
- dw Function1014ce
- dw Function10168e
- dw Function101600
- dw Function101913
- dw Function10194b
- dw Function10196d
- dw Function1017e4
- dw Function1017f5
- dw Function1019ab
- dw Function101537
- dw Function101571
- dw Function101c92
- dw Function10152a
- dw Function101571
- dw Function101a4f
- dw Function101cbc
- dw Function101c62
- dw Function101537
- dw Function101571
- dw Function101c92
- dw Function10152a
- dw Function101571
- dw Function101ca0
- dw Function101475
- dw Function101cbc
+ dw Function101a97 ; 00
+ dw Function101ab4 ; 01
+ dw Function101475 ; 02
+ dw Function101b0f ; 03
+ dw Function101438 ; 04
+ dw Function101b2b ; 05
+ dw Function101b59 ; 06
+ dw Function101475 ; 07
+ dw Function101b70 ; 08
+ dw Function101438 ; 09
+ dw Function101b8f ; 0a
+ dw Function101d7b ; 0b
+ dw Function101d95 ; 0c
+ dw Function101475 ; 0d
+ dw Function101db2 ; 0e
+ dw Function101e4f ; 0f
+ dw Function101475 ; 10
+ dw Function101e64 ; 11
+ dw Function101e4f ; 12
+ dw Function101475 ; 13
+ dw Function101e64 ; 14
+ dw Function101d95 ; 15
+ dw Function101475 ; 16
+ dw Function101db2 ; 17
+ dw Function101dd0 ; 18
+ dw Function101de3 ; 19
+ dw Function101e39 ; 1a
+ dw Function101e09 ; 1b
+ dw Function101e4f ; 1c
+ dw Function101475 ; 1d
+ dw Function101e64 ; 1e
+ dw Function101d95 ; 1f
+ dw Function101475 ; 20
+ dw Function101db2 ; 21
+ dw Function101e09 ; 22
+ dw Function101e31 ; 23
+ dw Function101bc8 ; 24
+ dw Function101438 ; 25
+ dw Function101be5 ; 26
+ dw Function101ac6 ; 27
+ dw Function101ab4 ; 28
+ dw Function101475 ; 29
+ dw Function101c11 ; 2a
+ dw Function1014f4 ; 2b
+ dw Function101cc8 ; 2c
+ dw Function1014e2 ; 2d
+ dw Function1014e2 ; 2e
+ dw Function101d10 ; 2f
+ dw Function101d2a ; 30
+ dw Function101d2a ; 31
+ dw Function101507 ; 32
+ dw Function10156d ; 33
+ dw Function101557 ; 34
+ dw Function10158a ; 35
+ dw Function101c42 ; 36
+ dw Function101aed ; 37
+ dw Function101ab4 ; 38
+ dw Function101475 ; 39
+ dw Function101c2b ; 3a
+ dw Function1014f4 ; 3b
+ dw Function101cdf ; 3c
+ dw Function1014e2 ; 3d
+ dw Function1014e2 ; 3e
+ dw Function101d1e ; 3f
+ dw Function101d2a ; 40
+ dw Function101d2a ; 41
+ dw Function101507 ; 42
+ dw Function10156d ; 43
+ dw Function101544 ; 44
+ dw Function10158a ; 45
+ dw Function101c42 ; 46
+ dw Function101c50 ; 47
+ dw Function1014ce ; 48
+ dw Function101cf6 ; 49
+ dw Function101826 ; 4a
+ dw Function1017e4 ; 4b
+ dw Function1017f1 ; 4c
+ dw Function1018a8 ; 4d
+ dw Function1018d6 ; 4e
+ dw Function1017e4 ; 4f
+ dw Function1017f1 ; 50
+ dw Function1018e1 ; 51
+ dw Function1015df ; 52
+ dw Function10167d ; 53
+ dw Function10168a ; 54
+ dw Function10162a ; 55
+ dw Function1015be ; 56
+ dw Function10167d ; 57
+ dw Function10168a ; 58
+ dw Function10161f ; 59
+ dw Function10159d ; 5a
+ dw Function10167d ; 5b
+ dw Function10168a ; 5c
+ dw Function101600 ; 5d
+ dw Function101d03 ; 5e
+ dw Function101d6b ; 5f
+ dw Function10159d ; 60
+ dw Function1014ce ; 61
+ dw Function10168e ; 62
+ dw Function101600 ; 63
+ dw Function101913 ; 64
+ dw Function10194b ; 65
+ dw _SelectMonsForMobileBattle ; 66
+ dw Function1017e4 ; 67
+ dw Function1017f5 ; 68
+ dw _StartMobileBattle ; 69
+ dw Function101537 ; 6a
+ dw Function101571 ; 6b
+ dw Function101c92 ; 6c
+ dw Function10152a ; 6d
+ dw Function101571 ; 6e
+ dw Function101a4f ; 6f
+ dw Function101cbc ; 70
+ dw Function101c62 ; 71
+ dw Function101537 ; 72
+ dw Function101571 ; 73
+ dw Function101c92 ; 74
+ dw Function10152a ; 75
+ dw Function101571 ; 76
+ dw Function101ca0 ; 77
+ dw Function101475 ; 78
+ dw Function101cbc ; 79
; 10138b
Function10138b: ; 10138b
@@ -3074,7 +3082,7 @@
; 1013d6
Function1013d6: ; 1013d6
- callba Function104000
+ callba HDMATransferAttrMapAndTileMapToWRAMBank3
ret
; 1013dd
@@ -3182,9 +3190,9 @@
ret z
ld a, 0
ld [wcd26], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101457
@@ -3221,9 +3229,9 @@
ret z
ld a, 0
ld [wcd26], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101494
@@ -3268,10 +3276,10 @@
Function1014ce: ; 1014ce
callba Function100720
- callba Function100641
- ld a, [wcd25]
+ callba StartMobileInactivityTimer
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 1014e2
@@ -3280,19 +3288,19 @@
set 6, [hl]
ld a, 0
ld [wcd26], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 1014f4
Function1014f4: ; 1014f4
- callba Function100082
+ callba EnableMobile
ld hl, wcd29
set 6, [hl]
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101507
@@ -3302,9 +3310,9 @@
ld bc, $40
ld a, $02
call Function3e32
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 10151d
@@ -3311,9 +3319,9 @@
Function10151d: ; 10151d ; unreferenced
ld a, $34
call Function3e32
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 10152a
@@ -3320,9 +3328,9 @@
Function10152a: ; 10152a
ld a, $36
call Function3e32
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101537
@@ -3329,30 +3337,30 @@
Function101537: ; 101537
ld a, $0a
call Function3e32
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101544
Function101544: ; 101544
- callba Function100641
+ callba StartMobileInactivityTimer
ld a, $12
call Function3e32
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101557
Function101557: ; 101557
- callba Function100641
+ callba StartMobileInactivityTimer
ld hl, wcd53
ld a, $08
call Function3e32
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 10156d
@@ -3371,15 +3379,15 @@
ret
.asm_101582
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 10158a
Function10158a: ; 10158a
- callba Function10064c
- ld a, [wcd44]
+ callba IncrementMobileInactivityTimerBy1Frame
+ ld a, [wMobileInactivityTimerMinutes]
cp $0a
jr c, Function10156d
ld a, $fb
@@ -3396,9 +3404,9 @@
call Function10174c
ld a, 0
ld [wcd26], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 1015be
@@ -3411,9 +3419,9 @@
call Function10174c
ld a, 0
ld [wcd26], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 1015df
@@ -3426,9 +3434,9 @@
call Function10174c
ld a, 0
ld [wcd26], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101600
@@ -3440,25 +3448,25 @@
call FarCopyWRAM
ld de, wc608
callba Function100ee6
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 10161f
Function10161f: ; 10161f
call Function101649
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 10162a
Function10162a: ; 10162a
call Function101663
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101635
@@ -3513,9 +3521,9 @@
Function10167d: ; 10167d
ld a, 0
ld [wcd26], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 10168a
@@ -3530,7 +3538,7 @@
ret c
ld c, $01
ld b, $03
- callba Function10062d
+ callba AdvanceMobileInactivityTimerAndCheckExpired
ret c
ld a, [wcd26]
ld hl, Jumptable_1016c3
@@ -3542,9 +3550,9 @@
ret z
ld a, 0
ld [wcd26], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 1016c3
@@ -3746,9 +3754,9 @@
Function1017e4: ; 1017e4
ld a, 0
ld [wcd27], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 1017f1
@@ -3763,20 +3771,20 @@
ret c
ld c, $01
ld b, $03
- callba Function10062d
+ callba AdvanceMobileInactivityTimerAndCheckExpired
ret c
callba Function100382
ld a, [wcd27]
bit 7, a
- jr nz, .asm_10181e
+ jr nz, .next
ld hl, wcd29
set 6, [hl]
ret
-.asm_10181e
- ld a, [wcd25]
+.next
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101826
@@ -3792,9 +3800,9 @@
ld hl, Unknown_10186f
ld de, wccb4
call Function1013f5
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_101844
@@ -3811,9 +3819,9 @@
.asm_10185b
ld de, wccb4
call Function1013f5
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_101869
@@ -3857,9 +3865,9 @@
ld a, $06
call Function101406
jr c, .asm_1018ca
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_1018ca
@@ -3875,17 +3883,17 @@
Function1018d6: ; 1018d6
call Function1018ec
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 1018e1
Function1018e1: ; 1018e1
call Function1018fb
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 1018ec
@@ -3938,17 +3946,17 @@
cp $02
jr z, .asm_101945
ld a, $71
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_10193f
ld a, $66
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_101945
ld a, $65
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 10194b
@@ -3961,18 +3969,18 @@
jr nz, .asm_101967
call Function1013c0
ld a, $71
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_101967
ld a, $60
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 10196d
-Function10196d: ; 10196d
+_SelectMonsForMobileBattle: ; 10196d
callba BlankScreen
- callba Function10060d
+ callba Mobile_CommunicationStandby
ld hl, wcd29
set 5, [hl]
ld hl, wcd2a
@@ -3979,7 +3987,7 @@
set 6, [hl]
ld a, $06
ld [wccb4], a
- ld hl, wdc5c
+ ld hl, wPlayerMonSelection
ld de, wccb5
ld bc, 3
call CopyBytes
@@ -3990,14 +3998,14 @@
ld [wccb9], a
ld a, [hl]
ld [wccba], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 1019ab
-Function1019ab: ; 1019ab
- call Function101a75
+_StartMobileBattle: ; 1019ab
+ call CopyOtherPlayersBattleMonSelection
callba Function100754
xor a
ld [wdc5f], a
@@ -4005,33 +4013,32 @@
callba BlankScreen
call SpeechTextBox
callba Function100846
- ld c, $78
+ ld c, 120
call DelayFrames
callba ClearTileMap
- call Function1019ee
- call Function101a21
+ call .CopyOTDetails
+ call StartMobileBattle
ld a, [wcd2b]
cp $fc
jr nz, .asm_1019e6
xor a
ld [wcd2b], a
-
.asm_1019e6
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 1019ee
-Function1019ee: ; 1019ee
+.CopyOTDetails: ; 1019ee
ld a, [rSVBK]
push af
- ld a, $05
+ ld a, 5
ld [rSVBK], a
ld bc, w5_dc0d
ld de, w5_dc11
- callba Function4e929
+ callba GetMobileOTTrainerClass
pop af
ld [rSVBK], a
@@ -4044,29 +4051,29 @@
call CopyBytes
ld a, [wcd2f]
and a
- ld a, $02
- jr z, .asm_101a1e
- ld a, $01
-
-.asm_101a1e
+ ld a, 2
+ jr z, .got_link_player_number
+ ld a, 1
+.got_link_player_number
ld [hLinkPlayerNumber], a
ret
; 101a21
-Function101a21: ; 101a21
+StartMobileBattle: ; 101a21
+ ; force stereo and fast text speed
ld hl, Options
ld a, [hl]
push af
- and $20
- or $01
+ and (1 << STEREO)
+ or 1 ; 1 frame per character i.e. fast text
ld [hl], a
- ld a, $01
- ld [wc2d7], a
+ ld a, 1
+ ld [wDisableTextAcceleration], a
callba BattleIntro
callba DoBattle
callba ShowLinkBattleParticipantsAfterEnd
xor a
- ld [wc2d7], a
+ ld [wDisableTextAcceleration], a
ld a, $ff
ld [hLinkPlayerNumber], a
pop af
@@ -4075,29 +4082,29 @@
; 101a4f
Function101a4f: ; 101a4f
- ld a, $01
- ld [wc2d7], a
+ ld a, 1
+ ld [wDisableTextAcceleration], a
callba DetermineMobileBattleResult
xor a
- ld [wc2d7], a
+ ld [wDisableTextAcceleration], a
callba CleanUpBattleRAM
callba LoadPokemonData
call Function1013c0
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101a75
-Function101a75: ; 101a75
+CopyOtherPlayersBattleMonSelection: ; 101a75
ld hl, wcc61
- ld de, wcd75
+ ld de, wOTMonSelection
ld bc, 3
call CopyBytes
ld de, wcc64
callba Function100772
callba Function101050
- callba Function1010f2
+ callba LoadSelectedPartiesForColosseum
ret
; 101a97
@@ -4109,9 +4116,9 @@
call Function10142c
ld hl, wcd29
set 6, [hl]
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101ab4
@@ -4120,9 +4127,9 @@
call Function101ee4
ld hl, wcd29
set 5, [hl]
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101ac6
@@ -4138,9 +4145,9 @@
ld [wcd2f], a
ld de, wdc42
call Function102068
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101aed
@@ -4154,9 +4161,9 @@
set 6, [hl]
ld a, $01
ld [wcd2f], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101b0f
@@ -4167,9 +4174,9 @@
call Function101ee4
ld hl, wcd29
set 5, [hl]
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ld a, 0
ld [wcd26], a
ret
@@ -4193,9 +4200,9 @@
ret
.asm_101b51
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101b59
@@ -4206,9 +4213,9 @@
call Function101ee4
ld hl, wcd29
set 5, [hl]
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101b70
@@ -4220,9 +4227,9 @@
ld hl, wcd29
set 5, [hl]
call UpdateSprites
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ld a, 0
ld [wcd26], a
ret
@@ -4243,17 +4250,17 @@
jr z, .asm_101bbc
ld a, $01
ld [wcd2f], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_101bbc
xor a
ld [wcd2f], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101bc8
@@ -4266,9 +4273,9 @@
call Function1013dd
ld a, 0
ld [wcd26], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101be5
@@ -4286,7 +4293,7 @@
cp $01
jr nz, .asm_101c0b
ld a, $2a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_101c0b
@@ -4303,9 +4310,9 @@
call Function102048
ld hl, wcd29
set 5, [hl]
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101c2b
@@ -4316,9 +4323,9 @@
call Function101ee4
ld hl, wcd29
set 5, [hl]
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101c42
@@ -4327,7 +4334,7 @@
set 1, [hl]
call Function100665
ld a, $47
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101c50
@@ -4336,9 +4343,9 @@
call Function101ee4
ld hl, wcd29
set 2, [hl]
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101c62
@@ -4356,9 +4363,9 @@
call Function101ee4
ld hl, wcd29
set 5, [hl]
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ld a, 0
ld [wcd26], a
ret
@@ -4366,9 +4373,9 @@
Function101c92: ; 101c92
callba Function100675
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101ca0
@@ -4379,9 +4386,9 @@
call Function101ee4
ld hl, wcd29
set 5, [hl]
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ld a, 0
ld [wcd26], a
ret
@@ -4406,9 +4413,9 @@
ld [wc30d], a
ld hl, wcd29
set 4, [hl]
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101cdf
@@ -4419,9 +4426,9 @@
ld [wc30d], a
ld hl, wcd29
set 4, [hl]
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101cf6
@@ -4428,9 +4435,9 @@
Function101cf6: ; 101cf6
ld a, $0b
ld [wc314 + 1], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101d03
@@ -4437,9 +4444,9 @@
Function101d03: ; 101d03
ld a, $0e
ld [wc314 + 1], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101d10
@@ -4446,17 +4453,17 @@
Function101d10: ; 101d10
ld c, $01
call Function10142c
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
jr Function101d2a
Function101d1e: ; 101d1e
ld c, $03
call Function10142c
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
Function101d2a: ; 101d2a
call Function101418
@@ -4471,9 +4478,9 @@
ret z
ld a, 0
ld [wcd26], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101d4d
@@ -4506,7 +4513,7 @@
ld hl, wcd29
res 4, [hl]
ld a, $64
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101d7b
@@ -4517,7 +4524,7 @@
add hl, bc
ld c, [hl]
ld a, c
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101d8d
@@ -4532,9 +4539,9 @@
call Function101ee4
ld hl, wcd29
set 5, [hl]
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ld a, 0
ld [wcd26], a
ret
@@ -4546,9 +4553,9 @@
ld hl, wcd29
set 5, [hl]
jr c, .asm_101dca
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_101dca
@@ -4562,12 +4569,12 @@
bit 1, [hl]
jr nz, .asm_101ddd
ld a, $19
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_101ddd
ld a, $1b
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101de3
@@ -4575,17 +4582,17 @@
call Function101ecc
call Function101ead
jr c, .asm_101df3
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_101df3
call Function101e98
jr c, .asm_101e00
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_101e00
@@ -4598,9 +4605,9 @@
Function101e09: ; 101e09
call Function101ead
jr c, .asm_101e16
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_101e16
@@ -4610,9 +4617,9 @@
call Function101ed3
pop af
jr c, .asm_101e2b
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_101e2b
@@ -4623,7 +4630,7 @@
Function101e31: ; 101e31
ld a, $3a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
jp Function101c2b
; 101e39
@@ -4634,7 +4641,7 @@
pop af
jr c, .asm_101e49
ld a, $2a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_101e49
@@ -4647,9 +4654,9 @@
ld e, $06
call Function101ee4
call Function1013d6
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ld a, 0
ld [wcd26], a
ret
@@ -4663,7 +4670,7 @@
pop af
jr c, .asm_101e77
ld a, $24
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_101e77
@@ -4676,17 +4683,17 @@
Function101e82: ; 101e82 ; unreferenced
call Function101ecc
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101e8d
Function101e8d: ; 101e8d ; unreferenced
call Function101ed3
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101e98
@@ -5182,7 +5189,7 @@
.asm_10225e
res 1, [hl]
res 2, [hl]
- callba Function104099
+ callba Mobile_ReloadMapPart
scf
ret
; 10226a
@@ -5269,7 +5276,7 @@
sub c
ld c, a
ld b, $03
- callba Function10062d
+ callba AdvanceMobileInactivityTimerAndCheckExpired
jr c, .asm_1022f3
xor a
ret
@@ -5444,7 +5451,7 @@
Function102423: ; 102423
call Function102921
ret nc
- callba Function14a58
+ callba SaveAfterLinkTrade
callba MobileFn_1060af
callba BackupMobileEventIndex
ld hl, wcd4b
@@ -6145,7 +6152,7 @@
ld hl, wcd4b
res 6, [hl]
ld [wcd50], a
- callba Function100641
+ callba StartMobileInactivityTimer
ld a, 0
ld [wcd4a], a
ret
@@ -6549,7 +6556,7 @@
ld [CurPartyMon], a
call LowVolume
call ClearSprites
- callba _BattleStatsScreenInit
+ callba _MobileStatsScreenInit
ld a, [CurPartyMon]
inc a
ld [wMenuCursorY], a
@@ -6809,7 +6816,7 @@
hlcoord 0, 0, AttrMap
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
call ByteFill
- callba Function104000
+ callba HDMATransferAttrMapAndTileMapToWRAMBank3
ret
; 102db7
@@ -7204,9 +7211,9 @@
ld a, [wcf44]
ld l, a
ld h, 0
-rept 3
add hl, hl
-endr
+ add hl, hl
+ add hl, hl
ld bc, Unknown_103112
add hl, bc
ld b, $30
@@ -7390,7 +7397,7 @@
ld [wd1ee], a
call Function1034be
call UpdateSprites
- callba Function104000
+ callba HDMATransferAttrMapAndTileMapToWRAMBank3
ld a, $01
ld [wd1f0], a
call Function10339a
@@ -7404,7 +7411,7 @@
call Function1033af
call Function10339a
call Function10342c
- callba Function10402d
+ callba HDMATransferTileMapToWRAMBank3
ld a, [Buffer2]
bit 7, a
jr z, .asm_103362
@@ -7443,17 +7450,17 @@
Function1033af: ; 1033af
call GetJoypad
ld a, [hJoyPressed]
- bit 5, a
+ bit D_LEFT_F, a
jr nz, .left
- bit 4, a
+ bit D_RIGHT_F, a
jr nz, .right
- bit 1, a
+ bit B_BUTTON_F, a
jr nz, .b
- bit 0, a
+ bit A_BUTTON_F, a
jr nz, .a
- bit 6, a
+ bit D_UP_F, a
jr nz, .up
- bit 7, a
+ bit D_DOWN_F, a
jr nz, .down
ret
@@ -7461,7 +7468,7 @@
ld a, [wd1f0]
dec a
ld [wd1f0], a
- cp $01
+ cp 1
ret nc
ld a, [wd1ee]
ld [wd1f0], a
@@ -7475,7 +7482,7 @@
ld a, [wd1ee]
cp c
ret nc
- ld a, $01
+ ld a, 1
ld [wd1f0], a
ret
@@ -7487,8 +7494,8 @@
.a
ld a, [wd1f3]
- cp $03
- jr nz, .asm_103412
+ cp 3
+ jr nz, .a_return
ld de, SFX_TRANSACTION
call PlaySFX
ld hl, Buffer2
@@ -7499,9 +7506,9 @@
.left
.right
-.asm_103412
+.a_return
ld a, [wd1f3]
- cp $03
+ cp 3
ret z
ld de, SFX_PUSH_BUTTON
call PlaySFX
@@ -8101,7 +8108,7 @@
ld a, $01
ld [wdc60], a
xor a
- ld hl, wdc5c
+ ld hl, wPlayerMonSelection
ld [hli], a
ld [hli], a
ld [hl], a
@@ -8112,7 +8119,7 @@
callba Function4a94e
jr c, .asm_103870
ld hl, wd002
- ld de, wdc5c
+ ld de, wPlayerMonSelection
ld bc, 3
call CopyBytes
xor a
--- a/misc/mobile_41.asm
+++ b/misc/mobile_41.asm
@@ -181,9 +181,9 @@
inc [hl]
jr nz, .asm_106001
ld a, $ff
-rept 3
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
ld [hl], a
.asm_106001
@@ -211,9 +211,9 @@
inc [hl]
jr nz, .asm_106027
ld a, $ff
-rept 3
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
ld [hl], a
.asm_106027
@@ -606,12 +606,11 @@
ld de, ._9
.three_to_nine_digits
-rept 3
inc de
-endr
-rept 2
+ inc de
+ inc de
dec a
-endr
+ dec a
.digit_loop
push af
@@ -690,9 +689,9 @@
sbc b
ld [hPrintNum6], a
ld a, [de]
-rept 3
inc de
-endr
+ inc de
+ inc de
ld b, a
ld a, [hPrintNum1]
sbc b
@@ -807,17 +806,17 @@
; 10635c
Function10635c: ; 10635c
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
bit 7, a
ret nz
- ld a, [wcd25]
- ld hl, Jumptable_10636a
+ ld a, [wMobileCommsJumptableIndex]
+ ld hl, .Jumptable
rst JumpTable
ret
; 10636a
-Jumptable_10636a: ; 10636a
- dw Function10637c
+.Jumptable: ; 10636a
+ dw .init
dw Function106392
dw Function1063cc
dw Function1063d8
@@ -828,15 +827,15 @@
dw Function106453
; 10637c
-Function10637c: ; 10637c
+.init: ; 10637c
ld de, wcd30
ld hl, $41
ld bc, $41
ld a, $40
call Function3e32
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 106392
@@ -858,7 +857,7 @@
ld a, $b
ld [wcf64], a
ld a, $7
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_1063b4
@@ -865,15 +864,15 @@
ld a, $7
ld [wcf64], a
ld a, $7
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_1063bf
ld a, $1
ld [wcf64], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 1063cc
@@ -880,17 +879,17 @@
Function1063cc: ; 1063cc
ld a, $78
ld [wcd42], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
Function1063d8: ; 1063d8
ld hl, wcd42
dec [hl]
ret nz
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 1063e5
@@ -898,9 +897,9 @@
ld a, [wcf64]
cp $3
ret nz
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 1063f3
@@ -908,9 +907,9 @@
ld de, wcd31
ld a, $32
call Function3e32
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 106403
@@ -931,9 +930,9 @@
inc a
ld c, a
call MobileFn_106314
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_106426
@@ -941,17 +940,17 @@
ld a, c
and a
jr z, .asm_106435
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_106435
ld c, $0
call MobileFn_106314
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 106442
@@ -961,14 +960,14 @@
xor a
ld [hMobile], a
ld [hMobileReceive], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
Function106453: ; 106453
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
set 7, a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
nop
ld a, $4
ld [wcf64], a
@@ -984,9 +983,9 @@
ld hl, VTiles2 tile $60
lb bc, BANK(MobilePhoneTilesGFX), 1
call Get2bpp
- ld de, GFX_f9424
+ ld de, FontsExtra2_UpArrowGFX
ld hl, VTiles2 tile $61
- lb bc, BANK(GFX_f9424), 1
+ lb bc, BANK(FontsExtra2_UpArrowGFX), 1
call Get2bpp
ld de, GFX_106514
ld hl, VTiles2 tile $62
--- a/misc/mobile_42.asm
+++ b/misc/mobile_42.asm
@@ -372,9 +372,8 @@
ld e, a
ld d, 0
ld hl, .Jumptable
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -446,7 +445,7 @@
.loop
callba PlaySpriteAnimations
callba SetUpPokeAnim
- callba Function10402d
+ callba HDMATransferTileMapToWRAMBank3
jr nc, .loop
ret
; 1082f0
@@ -493,7 +492,7 @@
ld [TempMonDVs], a
ld a, [wPlayerTrademonDVs + 1]
ld [TempMonDVs + 1], a
- ld b, SCGB_1A
+ ld b, SCGB_PLAYER_OR_MON_FRONTPIC_PALS
call GetSGBLayout
ld a, %11100100 ; 3,2,1,0
call DmgToCgbBGPals
@@ -586,7 +585,7 @@
ld [TempMonDVs], a
ld a, [wOTTrademonDVs + 1]
ld [TempMonDVs + 1], a
- ld b, SCGB_1A
+ ld b, SCGB_PLAYER_OR_MON_FRONTPIC_PALS
call GetSGBLayout
ld a, %11100100 ; 3,2,1,0
call DmgToCgbBGPals
@@ -628,7 +627,7 @@
ld [TempMonDVs], a
ld a, [wPlayerTrademonDVs + 1]
ld [TempMonDVs + 1], a
- ld b, SCGB_1A
+ ld b, SCGB_PLAYER_OR_MON_FRONTPIC_PALS
call GetSGBLayout
ld a, %11100100 ; 3,2,1,0
call DmgToCgbBGPals
@@ -730,7 +729,7 @@
ld [TempMonDVs], a
ld a, [wOTTrademonDVs + 1]
ld [TempMonDVs + 1], a
- ld b, SCGB_1A
+ ld b, SCGB_PLAYER_OR_MON_FRONTPIC_PALS
call GetSGBLayout
ld a, %11100100 ; 3,2,1,0
call DmgToCgbBGPals
@@ -799,7 +798,7 @@
ld [TempMonDVs], a
ld a, [wOTTrademonDVs + 1]
ld [TempMonDVs + 1], a
- ld b, SCGB_1A
+ ld b, SCGB_PLAYER_OR_MON_FRONTPIC_PALS
call GetSGBLayout
ld a, %11100100 ; 3,2,1,0
call DmgToCgbBGPals
@@ -955,9 +954,8 @@
ld a, [hSCX]
cp $e0
jr z, .loop2
-rept 2
dec a
-endr
+ dec a
ld [hSCX], a
cp $f8
jr nz, .next
@@ -974,9 +972,8 @@
ld a, [hSCY]
cp $f8
jr z, .done
-rept 2
dec a
-endr
+ dec a
ld [hSCY], a
cp $40
jr z, .init
@@ -1125,9 +1122,8 @@
ld a, [hSCY]
cp $78
jr z, .asm_1088ee
-rept 2
inc a
-endr
+ inc a
ld [hSCY], a
cp $30
jr z, .asm_1088c5
@@ -1166,9 +1162,8 @@
ld a, [hSCX]
cp $c
jr z, .asm_108906
-rept 2
inc a
-endr
+ inc a
ld [hSCX], a
cp -8
jr nz, .asm_1088e7
--- a/misc/mobile_45.asm
+++ b/misc/mobile_45.asm
@@ -153,9 +153,8 @@
Function11425c: ; 11425c
ld [$dc02], a
pop af
-rept 2
ld [hFF8C], a
-endr
+ ld [hFF8C], a
ld [MBC3SRamBank], a
ret
@@ -632,13 +631,12 @@
Function1144d1: ; 1144d1
call Function114561
-rept 2
dec de
-endr
+ dec de
push de
-rept 3
inc de
-endr
+ inc de
+ inc de
inc hl
ld a, [de]
ld [hli], a
@@ -1006,9 +1004,8 @@
and a
jr nz, .asm_1146e8
.asm_1146da
-rept 2
dec bc
-endr
+ dec bc
call Function1149cc
and a
jr nz, .asm_1146e4
@@ -1095,9 +1092,8 @@
ld a, [$dc0e]
cp $3
jr nz, .asm_114773
-rept 2
dec bc
-endr
+ dec bc
.asm_114773
call Function1149cc
@@ -2069,9 +2065,8 @@
inc de
cp $3f
jr nz, .asm_114c62
-rept 2
dec de
-endr
+ dec de
.asm_114c75
ld a, [hli]
cp $3f
@@ -2091,9 +2086,8 @@
ld a, [hli]
cp $3d
jr nz, .asm_114c84
-rept 2
dec bc
-endr
+ dec bc
ld a, l
ld [$dc03], a
ld a, h
@@ -2360,9 +2354,8 @@
add hl, de
ld b, h
ld c, l
-rept 2
inc bc
-endr
+ inc bc
xor a
ret
@@ -2563,9 +2556,8 @@
ld a, b
ld [hli], a
ld a, c
-rept 2
ld [hli], a
-endr
+ ld [hli], a
ld a, [de]
ld [hli], a
inc de
@@ -2970,9 +2962,8 @@
.asm_11510b
pop hl
-rept 2
dec hl
-endr
+ dec hl
push de
call Function1158c2
pop de
@@ -3499,9 +3490,8 @@
ld e, [hl]
inc hl
ld d, [hl]
-rept 2
inc hl
-endr
+ inc hl
ld a, [de]
ld [hli], a
inc de
@@ -4470,9 +4460,9 @@
ld bc, $0003
.asm_115914
-rept 3
dec bc
-endr
+ dec bc
+ dec bc
ld a, c
ld [$dc19], a
ld a, b
@@ -4523,9 +4513,8 @@
ld a, $3f
and c
ld [hld], a
-rept 2
dec hl
-endr
+ dec hl
pop de
ld b, h
ld c, l
@@ -4581,9 +4570,8 @@
ld a, [hli]
ld c, a
ld b, [hl]
-rept 2
inc bc
-endr
+ inc bc
ld a, b
ld [hld], a
ld [hl], c
@@ -4864,9 +4852,8 @@
ld a, [wStartDay]
cp $4
jr z, .asm_115b43
-rept 2
inc hl
-endr
+ inc hl
jr .asm_115b43
.asm_115b36
@@ -5048,9 +5035,8 @@
ret
.asm_115c33
-rept 2
dec hl
-endr
+ dec hl
xor a
ld [hl], a
ld a, $1
@@ -5153,9 +5139,9 @@
ld e, [hl]
inc hl
ld d, [hl]
-rept 3
inc de
-endr
+ inc de
+ inc de
ld [hl], d
dec hl
ld [hl], e
@@ -5406,9 +5392,8 @@
ld e, a
ld d, 0
ld hl, Jumptable_1165af
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -6941,9 +6926,8 @@
ld e, a
ld d, 0
ld hl, Jumptable_117728
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -7396,7 +7380,7 @@
call ClearBGPalettes
call ClearSprites
callba Function172e78
- callba Function104000
+ callba HDMATransferAttrMapAndTileMapToWRAMBank3
ret
; 0x117ab4
@@ -7417,7 +7401,7 @@
bit 7, a
jr nz, .asm_117ae2
call Function117ae9
- callba Function104000
+ callba HDMATransferAttrMapAndTileMapToWRAMBank3
jr Function117acd
.asm_117ae2
@@ -7430,9 +7414,8 @@
ld e, a
ld d, $0
ld hl, .Jumptable
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
--- a/misc/mobile_45_sprite_engine.asm
+++ b/misc/mobile_45_sprite_engine.asm
@@ -375,9 +375,8 @@
ld e, a
ld d, 0
ld hl, .Jumptable
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
--- a/misc/mobile_46.asm
+++ b/misc/mobile_46.asm
@@ -1067,7 +1067,7 @@
ld [wcd3c], a
call Function119e2e
ld a, [wcd33]
- ld [wcd45], a
+ ld [wMobileInactivityTimerSeconds], a
Function118880: ; 118880 (46:4880)
call Function119ed8
@@ -1344,7 +1344,7 @@
ld a, $7
ld [wcf66], a
ld a, $0
- ld [wcd46], a
+ ld [wMobileInactivityTimerFrames], a
ret
@@ -1615,7 +1615,7 @@
ld a, $9
ld [wcd3c], a
ld a, $12
- ld [wcd45], a
+ ld [wMobileInactivityTimerSeconds], a
call Function119e2e
Function118d9b:
@@ -1830,9 +1830,9 @@
ld a, $1d
ld [wcd3c], a
ld a, $24
- ld [wcd45], a
+ ld [wMobileInactivityTimerSeconds], a
ld a, $11
- ld [wcd46], a
+ ld [wMobileInactivityTimerFrames], a
ld a, $1c
ld [wcd47], a
jp Function119e2e
@@ -1871,9 +1871,9 @@
ld a, $9
ld [wcd3c], a
ld a, $24
- ld [wcd45], a
+ ld [wMobileInactivityTimerSeconds], a
ld a, $13
- ld [wcd46], a
+ ld [wMobileInactivityTimerFrames], a
ld a, $1c
ld [wcd47], a
jp Function119e2e
@@ -2518,7 +2518,7 @@
ld a, $9
ld [wcd3c], a
ld a, $10
- ld [wcd45], a
+ ld [wMobileInactivityTimerSeconds], a
call Function119e2e
Function1193a0:
@@ -2565,7 +2565,7 @@
ld a, $9
ld [wcd3c], a
ld a, $11
- ld [wcd45], a
+ ld [wMobileInactivityTimerSeconds], a
call Function119e2e
Function1193fb:
@@ -2895,9 +2895,9 @@
ld a, $11
ld [wcd3c], a
ld a, $1c
- ld [wcd45], a
+ ld [wMobileInactivityTimerSeconds], a
ld a, $f
- ld [wcd46], a
+ ld [wMobileInactivityTimerFrames], a
ld a, $14
ld [wcd47], a
call Function119e2e
@@ -2907,9 +2907,9 @@
ld a, $14
ld [wcd3c], a
ld a, $1c
- ld [wcd45], a
+ ld [wMobileInactivityTimerSeconds], a
ld a, $10
- ld [wcd46], a
+ ld [wMobileInactivityTimerFrames], a
ld a, $14
ld [wcd47], a
jp Function119e2e
@@ -2925,7 +2925,7 @@
ld a, $9
ld [wcd3c], a
ld a, $1c
- ld [wcd45], a
+ ld [wMobileInactivityTimerSeconds], a
ld a, $14
ld [wcd47], a
call Function119e2e
@@ -3219,7 +3219,7 @@
ld a, $9
ld [wcd3c], a
ld a, $12
- ld [wcd45], a
+ ld [wMobileInactivityTimerSeconds], a
call Function119e2e
Function1197dc:
@@ -3767,9 +3767,9 @@
ld [hld], a
dec hl
pop de
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
ld a, h
cp $e0
jr c, .asm_119b93
@@ -3943,7 +3943,7 @@
Function119cec:
call Function119ed8
ret c
- ld a, [wcd46]
+ ld a, [wMobileInactivityTimerFrames]
ld [wcf66], a
ret
; 119cf7
@@ -4301,16 +4301,16 @@
ld de, String_11a661
call PlaceString
ld a, $80
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 119f56
Function119f56: ; 119f56
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr z, .asm_119f62
dec a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
scf
ret
@@ -4320,16 +4320,16 @@
ld de, String_11a6aa
call PlaceString
ld a, $80
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 119f76
Function119f76: ; 119f76
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr z, .asm_119f82
dec a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
scf
ret
@@ -4340,7 +4340,7 @@
call PlaceString
call Function11a5f5
xor a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 119f98
@@ -4348,7 +4348,7 @@
call Function11a536
ret c
call PlayClickSFX
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr nz, .asm_119fef
call ExitMenu
@@ -4385,7 +4385,7 @@
call ExitMenu
call ExitMenu
callba ReloadMapPart
- ld a, [wcd45]
+ ld a, [wMobileInactivityTimerSeconds]
ld [wcf66], a
callba Function115dc3
ld a, $a
@@ -4504,12 +4504,12 @@
Function11a129: ; 11a129
ld a, $80
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 11a131
Function11a131: ; 11a131
- ld hl, wcd44
+ ld hl, wMobileInactivityTimerMinutes
dec [hl]
ret nz
ld a, [wcd3c]
@@ -4541,16 +4541,16 @@
ld de, String_11a6f1
call PlaceString
ld a, $80
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 11a16d
Function11a16d: ; 11a16d
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr z, .asm_11a179
dec a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
scf
ret
@@ -4562,7 +4562,7 @@
call PlaceString
call Function11a5f5
xor a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 11a192
@@ -4570,7 +4570,7 @@
call Function11a536
ret c
call PlayClickSFX
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr nz, .asm_11a1b6
call ExitMenu
@@ -4585,7 +4585,7 @@
.asm_11a1b6
call ExitMenu
callba ReloadMapPart
- ld a, [wcd45]
+ ld a, [wMobileInactivityTimerSeconds]
ld [wcf66], a
ld [wcd80], a
call Function11a63c
@@ -4649,7 +4649,7 @@
ld a, $ed
ld [hl], a
xor a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 11a235
@@ -4676,11 +4676,11 @@
xor a
ld [wcd8a], a
ld [wcd8b], a
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr z, .asm_11a24c
xor a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
hlcoord 15, 8
ld a, $ed
ld [hl], a
@@ -4693,11 +4693,11 @@
xor a
ld [wcd8a], a
ld [wcd8b], a
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr nz, .asm_11a24c
inc a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
hlcoord 15, 8
ld a, $7f
ld [hl], a
@@ -4711,12 +4711,12 @@
ld [wcd8a], a
ld [wcd8b], a
call PlayClickSFX
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr nz, .asm_11a2c4
call ExitMenu
callba ReloadMapPart
- ld a, [wcd46]
+ ld a, [wMobileInactivityTimerFrames]
cp $0
jr z, .asm_11a2b4
ld a, [wcd47]
@@ -4774,16 +4774,16 @@
ld de, String_11a71e
call PlaceString
ld a, $80
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 11a302
Function11a302: ; 11a302
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr z, .asm_11a30e
dec a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
scf
ret
@@ -4801,16 +4801,16 @@
lb bc, PRINTNUM_LEADINGZEROS | 1, 2
call PrintNum
ld a, $80
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 11a33a
Function11a33a: ; 11a33a
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr z, .asm_11a346
dec a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
scf
ret
@@ -4828,16 +4828,16 @@
ld de, String_11a743
call PlaceString
ld a, $80
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 11a36b
Function11a36b: ; 11a36b
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr z, .asm_11a377
dec a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
scf
ret
@@ -4848,7 +4848,7 @@
call PlaceString
call Function11a5f5
xor a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 11a38d
@@ -4856,7 +4856,7 @@
call Function11a536
ret c
call PlayClickSFX
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr nz, .asm_11a3b1
call ExitMenu
@@ -4871,7 +4871,7 @@
.asm_11a3b1
call ExitMenu
callba ReloadMapPart
- ld a, [wcd45]
+ ld a, [wMobileInactivityTimerSeconds]
ld [wcf66], a
ld [wcd80], a
scf
@@ -4884,16 +4884,16 @@
ld de, String_11a762
call PlaceString
ld a, $80
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 11a3d9
Function11a3d9: ; 11a3d9
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr z, .asm_11a3e5
dec a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
scf
ret
@@ -4903,16 +4903,16 @@
ld de, String_11a779
call PlaceString
ld a, $80
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 11a3f9
Function11a3f9: ; 11a3f9
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr z, .asm_11a405
dec a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
scf
ret
@@ -4923,7 +4923,7 @@
call PlaceString
call Function11a5f5
xor a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 11a41b
@@ -4931,7 +4931,7 @@
call Function11a536
ret c
call PlayClickSFX
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr nz, .asm_11a43f
call ExitMenu
@@ -4959,7 +4959,7 @@
ld de, String_11a791
call PlaceString
ld a, $80
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 11a466
@@ -4969,16 +4969,16 @@
ld de, String_11a7c1
call PlaceString
ld a, $80
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 11a47a
Function11a47a: ; 11a47a
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr z, .asm_11a486
dec a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
scf
ret
@@ -4994,7 +4994,7 @@
call PlaceString
call Function11a5f5
xor a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 11a49e
@@ -5002,7 +5002,7 @@
call Function11a536
ret c
call PlayClickSFX
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr nz, .asm_11a4c7
call ExitMenu
@@ -5019,7 +5019,7 @@
.asm_11a4c7
call ExitMenu
callba ReloadMapPart
- ld a, [wcd46]
+ ld a, [wMobileInactivityTimerFrames]
ld [wcf66], a
ld [wcd80], a
scf
@@ -5041,7 +5041,7 @@
call PlaceString
call Function11a5f5
xor a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
jp Function11a5b0
; 11a4fe
@@ -5049,7 +5049,7 @@
call Function11a536
ret c
call PlayClickSFX
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr nz, .asm_11a522
call ExitMenu
@@ -5064,7 +5064,7 @@
.asm_11a522
call ExitMenu
callba ReloadMapPart
- ld a, [wcd45]
+ ld a, [wMobileInactivityTimerSeconds]
ld [wcf66], a
ld [wcd80], a
scf
@@ -5102,11 +5102,11 @@
xor a
ld [wcd8a], a
ld [wcd8b], a
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr z, .asm_11a54d
xor a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
hlcoord 15, 7
ld a, $ed
ld [hl], a
@@ -5119,11 +5119,11 @@
xor a
ld [wcd8a], a
ld [wcd8b], a
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
and a
jr nz, .asm_11a54d
inc a
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
hlcoord 15, 7
ld a, $7f
ld [hl], a
@@ -5134,7 +5134,7 @@
.asm_11a5a2
ld a, $1
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
.asm_11a5a7
xor a
@@ -5308,7 +5308,7 @@
next "ちゅうし しますか?@"
; 11a7c1
-String_11a7c1: ; 11a7c1
+String_11a7c1: ; 11a7c1 ; new news?
db "あたらしい ニュースは"
next "ありません でした@"
; 11a7d7
@@ -7331,7 +7331,7 @@
ld [wPokemonWithdrawDepositParameter], a
callba RemoveMonFromPartyOrBox
callba Function170807
- callba Function14a58
+ callba SaveAfterLinkTrade
jp Function11ad8a
; 11b5e0
@@ -7616,7 +7616,7 @@
callba EvolvePokemon
xor a
ld [wLinkMode], a
- callba Function14a58
+ callba SaveAfterLinkTrade
ld a, $5
call GetSRAMBank
ld a, $5
@@ -7781,7 +7781,7 @@
ld a, $c64b / $100
ld [wMobileMonMailPointerBuffer + 1], a
call AddMobileMonToParty
- callba Function14a58
+ callba SaveAfterLinkTrade
ret
; 11b98f
--- a/misc/mobile_5b.asm
+++ b/misc/mobile_5b.asm
@@ -1,48 +1,56 @@
Function16c000: ; 16c000
+; unreferenced
+ ; Only for CGB
ld a, [hCGB]
and a
ret z
+ ; Only do this once per boot cycle
ld a, [hFFEA]
and a
ret z
+ ; Set some flag, preserving the old state
ld a, [wcfbe]
push af
set 7, a
ld [wcfbe], a
- call Function16c108
- callba Function100063
- callba Function100082
- call Function16c031
- callba Function1000a4
+ ; Do stuff
+ call MobileSystemSplashScreen_InitGFX ; Load GFX
+ callba SetRAMStateForMobile
+ callba EnableMobile
+ call .RunJumptable
+ callba DisableMobile
+ ; Prevent this routine from running again
+ ; until the next time the syatem is turned on
xor a
ld [hFFEA], a
+ ; Restore the flag state
pop af
ld [wcfbe], a
ret
; 16c031
-Function16c031: ; 16c031
+.RunJumptable: ; 16c031
xor a
ld [wJumptableIndex], a
ld [wcf64], a
ld [wd002], a
ld [wd003], a
-.asm_16c03e
+.loop
call DelayFrame
callba Function10635c
ld a, [wd002]
- ld hl, Jumptable_16c05c
+ ld hl, .Jumptable
rst JumpTable
call Function16cb2e
call Function16cbae
ld a, [wd002]
cp $ff
- jr nz, .asm_16c03e
+ jr nz, .loop
ret
; 16c05c
-Jumptable_16c05c: ; 16c05c
- dw Function16c074
+.Jumptable: ; 16c05c
+ dw .init
dw Function16c0ba
dw Function16c089
dw Function16c09e
@@ -53,10 +61,10 @@
dw Function16c0ca
dw Function16c0dc
dw Function16c0ec
- dw Function16c081
+ dw .quit
; 16c074
-Function16c074: ; 16c074
+.init ; 16c074
ld a, [wcf64]
and a
ret z
@@ -66,7 +74,7 @@
ret
; 16c081
-Function16c081: ; 16c081
+.quit ; 16c081
push af
ld a, $ff
ld [wd002], a
@@ -160,15 +168,15 @@
ret
; 16c108
-Function16c108: ; 16c108
+MobileSystemSplashScreen_InitGFX: ; 16c108
call DisableLCD
ld hl, VTiles2
- ld de, GFX_16c173
- lb bc, BANK(GFX_16c173), $68
+ ld de, .Tiles
+ lb bc, BANK(.Tiles), $68
call Get2bpp
- call Function16c130
- call Function16c145
- call Function16c15c
+ call .LoadPals
+ call .LoadTileMap
+ call .LoadAttrMap
hlbgcoord 0, 0
call Function16cc73
call Function16cc02
@@ -178,9 +186,9 @@
ret
; 16c130
-Function16c130: ; 16c130
+.LoadPals: ; 16c130
ld de, UnknBGPals
- ld hl, Unknown_16c903
+ ld hl, UnknownMobilePalettes_16c903
ld bc, 8
ld a, $5
call FarCopyWRAM
@@ -188,12 +196,12 @@
ret
; 16c145
-Function16c145: ; 16c145
+.LoadTileMap: ; 16c145
hlcoord 0, 0
ld bc, 20
xor a
call ByteFill
- ld hl, Tilemap_16c633
+ ld hl, .TileMap
decoord 0, 1
ld bc, $0154
call CopyBytes
@@ -200,12 +208,12 @@
ret
; 16c15c
-Function16c15c: ; 16c15c
+.LoadAttrMap: ; 16c15c
hlcoord 0, 0, AttrMap
ld bc, SCREEN_WIDTH
xor a
call ByteFill
- ld hl, Tilemap_16c79b
+ ld hl, .AttrMap
decoord 0, 1, AttrMap
ld bc, 17 * SCREEN_WIDTH
call CopyBytes
@@ -212,56 +220,18 @@
ret
; 16c173
-GFX_16c173:
+.Tiles:
INCBIN "gfx/unknown/16c173.2bpp"
-Tilemap_16c633:
+.TileMap:
INCBIN "gfx/unknown/16c633.tilemap"
-Tilemap_16c79b:
+.AttrMap:
INCBIN "gfx/unknown/16c79b.tilemap"
-Unknown_16c903:
- RGB 31, 31, 31
- RGB 04, 10, 20
- RGB 16, 19, 25
- RGB 25, 27, 29
+UnknownMobilePalettes_16c903: ; 16c903
+INCLUDE "gfx/unknown/16c903.pal"
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
-
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
-
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
-
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
-
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
-
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
-
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
-
; 16c943
Function16c943: ; 16c943
@@ -287,7 +257,7 @@
ld e, $0
ld a, $0
.asm_16c969
- ld hl, Unknown_16c903
+ ld hl, UnknownMobilePalettes_16c903
call Function16cab6
call Function16cabb
ld d, a
@@ -310,7 +280,7 @@
call Function16cadc
.asm_16c991
- ld hl, Unknown_16c903
+ ld hl, UnknownMobilePalettes_16c903
call Function16cab6
call Function16cad8
ld d, a
@@ -333,7 +303,7 @@
call Function16cb08
.asm_16c9b9
- ld hl, Unknown_16c903
+ ld hl, UnknownMobilePalettes_16c903
call Function16cab6
call Function16cac4
ld d, a
@@ -356,9 +326,8 @@
call Function16cae8
.asm_16c9e1
-rept 2
inc e
-endr
+ inc e
ld a, e
cp $8
jr nz, .asm_16c969
@@ -459,9 +428,8 @@
call Function16cae8
.asm_16ca88
-rept 2
inc e
-endr
+ inc e
ld a, e
cp $8
jr nz, .asm_16ca28
--- a/misc/mobile_5c.asm
+++ b/misc/mobile_5c.asm
@@ -111,9 +111,8 @@
inc [hl]
.asm_170c15
-rept 2
inc hl
-endr
+ inc hl
ld a, [$a89b]
add [hl]
ld [hld], a
@@ -138,9 +137,8 @@
ld a, [hli]
ld b, a
ld c, [hl]
-rept 2
inc hl
-endr
+ inc hl
ld a, [hld]
sub c
ld c, a
@@ -370,9 +368,8 @@
ld e, a
ld d, 0
ld hl, Jumptable_171a45
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -498,9 +495,9 @@
.asm_171b34
pop hl
ld bc, $14
-rept 3
add hl, bc
-endr
+ add hl, bc
+ add hl, bc
pop af
dec a
jr nz, .asm_171b1b
@@ -519,24 +516,27 @@
depixel 8, 2
ld a, SPRITE_ANIM_INDEX_1D
call _InitSpriteAnimStruct
- ld hl, $c
+ ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, $8
ld [hl], a
+
depixel 8, 19
ld a, SPRITE_ANIM_INDEX_1D
call _InitSpriteAnimStruct
- ld hl, $c
+ ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, $9
ld [hl], a
+
depixel 17, 14, 2, 0
ld a, SPRITE_ANIM_INDEX_1D
call _InitSpriteAnimStruct
- ld hl, $c
+ ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, $a
ld [hl], a
+
ld a, $4
ld [wcd23], a
ld a, $8
@@ -732,9 +732,8 @@
Function171cf0: ; 171cf0 (5c:5cf0)
xor a
hlcoord 4, 15
-rept 2
ld [hli], a
-endr
+ ld [hli], a
ld a, [wcd4b]
xor $1
ld [wcd4b], a
--- a/misc/mobile_5f.asm
+++ b/misc/mobile_5f.asm
@@ -180,7 +180,7 @@
CheckStringForErrors: ; 17d073
; Valid character ranges:
-; $00, $05 - $13, $19 - $1c, $26 - $34, $3a - $3e, $40 - $48, $60 - $ff
+; $0, $5 - $13, $19 - $1c, $26 - $34, $3a - $3e, $40 - $48, $60 - $ff
.loop
ld a, [de]
inc de
@@ -308,7 +308,7 @@
callba EvolvePokemon
xor a
ld [wLinkMode], a
- callba Function14a58
+ callba SaveAfterLinkTrade
ld a, $5
call GetSRAMBank
ld a, $5
@@ -612,7 +612,7 @@
call GetSRAMBank
xor a
ld hl, $aa73
- ld bc, $000c
+ ld bc, $c
call ByteFill
call CloseSRAM
ld a, $2
@@ -747,7 +747,7 @@
Function17d48d: ; 17d48d
ld hl, Palette_17eff6
ld de, $c608
- ld bc, $0040
+ ld bc, $40
call CopyBytes
ld hl, TileAttrmap_17eb8e
decoord 0, 0
@@ -775,7 +775,7 @@
jr nz, .asm_17d4a8
pop hl
push bc
- ld bc, $0040
+ ld bc, $40
add hl, bc
pop bc
pop af
@@ -876,7 +876,7 @@
dec a
jr nz, .asm_17d53a
ld de, CreditsTimer
- ld bc, $000c
+ ld bc, $c
call CopyBytes
xor a
ld [wcd2e], a
@@ -885,7 +885,7 @@
ld [wcd30], a
ld [wcd31], a
ld de, wcd32
- ld bc, $0010
+ ld bc, $10
call CopyBytes
ld a, [hli]
ld [wcd42], a
@@ -892,11 +892,11 @@
ld a, [hli]
ld [wcd43], a
ld a, [hli]
- ld [wcd44], a
+ ld [wMobileInactivityTimerMinutes], a
ld a, [hli]
- ld [wcd45], a
+ ld [wMobileInactivityTimerSeconds], a
ld a, [hli]
- ld [wcd46], a
+ ld [wMobileInactivityTimerFrames], a
ld a, [hli]
and a
jr z, .asm_17d58a
@@ -987,7 +987,7 @@
call GetSRAMBank
ld hl, $b1d3
ld de, $c608
- ld bc, $0020
+ ld bc, $20
call CopyBytes
ld a, [$b1b1]
ld c, a
@@ -1012,7 +1012,7 @@
ld a, h
ld [de], a
inc de
- ld bc, $000a
+ ld bc, $a
add hl, bc
pop bc
ld a, [hli]
@@ -1102,12 +1102,12 @@
ld a, h
ld [wcd5f], a
ld de, wcd60
- ld bc, $0004
+ ld bc, $4
call CopyBytes
inc hl
inc hl
ld de, wcd64
- ld bc, $0004
+ ld bc, $4
call CopyBytes
ld a, [hli]
ld [wcd69], a
@@ -1478,7 +1478,7 @@
Function17d93a: ; 17d93a
call Function17e415
ld de, $c708
- ld bc, $0005
+ ld bc, $5
call CopyBytes
call Function17e41e
call Function17e32b
@@ -1492,7 +1492,7 @@
ld [CurPartySpecies], a
ld a, [$c70c]
ld e, a
- callba Function8bc6
+ callba LoadMonPaletteAsNthBGPal
call SetPalettes
ld a, [$c708]
ld l, a
@@ -1514,7 +1514,7 @@
Function17d98b: ; 17d98b
call Function17e415
ld de, $c708
- ld bc, $0004
+ ld bc, $4
call CopyBytes
call Function17e41e
call Function17e32b
@@ -1528,7 +1528,7 @@
ld [TrainerClass], a
ld a, [$c70b]
ld e, a
- callba Function8bbd
+ callba LoadTrainerClassPaletteAsNthBGPal
call SetPalettes
ld a, [$c708]
ld e, a
@@ -1540,7 +1540,7 @@
pop hl
decoord 0, 0
add hl, de
- ld bc, $0707
+ ld bc, $707
predef PlaceGraphic
pop af
ld [rSVBK], a
@@ -1551,7 +1551,7 @@
Function17d9e3: ; 17d9e3
call Function17e415
ld de, $c708
- ld bc, $0007
+ ld bc, $7
call CopyBytes
call Function17e41e
ld a, [$c70b]
@@ -1597,7 +1597,7 @@
Function17da31: ; 17da31
call Function17e415
ld de, $c708
- ld bc, $0004
+ ld bc, $4
call CopyBytes
call Function17e41e
ld a, [$c709]
@@ -1888,7 +1888,7 @@
Function17dc1f: ; 17dc1f
call Function17e415
ld de, $c688
- ld bc, $0006
+ ld bc, $6
call CopyBytes
call Function17e32b
ld a, [rSVBK]
@@ -1968,7 +1968,7 @@
ld a, $5
ld [rSVBK], a
ld hl, UnknBGPals
- ld de, $0008
+ ld de, $8
ld c, $8
.asm_17dcbb
push hl
@@ -2050,7 +2050,7 @@
push hl
pop bc
pop hl
- call PlaceWholeStringInBoxAtOnce
+ call PlaceHLTextAtBC
ret
; 17dd30
@@ -2076,7 +2076,7 @@
Function17dd49: ; 17dd49
call Function17e415
ld de, $c708
- ld bc, $000a
+ ld bc, $a
call CopyBytes
ld a, [$c711]
ld c, a
@@ -2157,7 +2157,7 @@
Function17ddcd: ; 17ddcd
call Function17e415
ld de, $c708
- ld bc, $0008
+ ld bc, $8
call CopyBytes
ld a, [$c70a]
cp $c0
@@ -2219,7 +2219,7 @@
Function17de32: ; 17de32
call Function17e415
ld de, $c708
- ld bc, $0009
+ ld bc, $9
call CopyBytes
ld a, [$c710]
ld c, a
@@ -2278,7 +2278,7 @@
Function17de91: ; 17de91
call Function17e415
ld de, $c708
- ld bc, $0007
+ ld bc, $7
call CopyBytes
ld a, $6
call GetSRAMBank
@@ -2321,7 +2321,7 @@
Function17ded9: ; 17ded9
call Function17e415
ld de, $c708
- ld bc, $001f
+ ld bc, $1f
call CopyBytes
call Function17e32b
ld a, [rSVBK]
@@ -2363,7 +2363,7 @@
jr .asm_17df37
.asm_17df33
- ld de, $0006
+ ld de, $6
add hl, de
.asm_17df37
@@ -2388,7 +2388,7 @@
jr .asm_17df5e
.asm_17df5a
- ld de, $0007
+ ld de, $7
add hl, de
.asm_17df5e
@@ -2502,7 +2502,7 @@
ld e, l
pop hl
push de
- ld bc, $0004
+ ld bc, $4
call CopyBytes
pop de
push hl
@@ -2520,7 +2520,7 @@
jp asm_17e0ee
.asm_17e01f
- ld de, $0004
+ ld de, $4
add hl, de
jp asm_17e0ee
; 17e026
@@ -2546,7 +2546,7 @@
bit 1, b
jr z, .asm_17e067
push bc
- ld bc, $000b
+ ld bc, $b
ld de, sBoxMonNicknames
call CopyBytes
pop bc
@@ -2553,7 +2553,7 @@
jr .asm_17e06b
.asm_17e067
- ld de, $0006
+ ld de, $6
add hl, de
.asm_17e06b
@@ -2560,7 +2560,7 @@
bit 2, b
jr z, .asm_17e08e
push bc
- ld bc, $0006
+ ld bc, $6
ld de, sBoxMonOT
call CopyBytes
ld a, [hli]
@@ -2575,7 +2575,7 @@
jr .asm_17e092
.asm_17e08e
- ld de, $0007
+ ld de, $7
add hl, de
.asm_17e092
@@ -2623,7 +2623,7 @@
jr z, .asm_17e0e1
push bc
ld de, sBoxMon1Moves
- ld bc, $0004
+ ld bc, $4
call CopyBytes
push hl
ld hl, sBoxMon1Moves
@@ -2638,12 +2638,12 @@
.asm_17e0e1
call CloseSRAM
- ld de, $0006
+ ld de, $6
add hl, de
jr asm_17e0ee
.asm_17e0ea
- ld bc, $001a
+ ld bc, $1a
add hl, bc
asm_17e0ee
@@ -2662,7 +2662,7 @@
Function17e0fd: ; 17e0fd
call Function17e415
ld de, $c708
- ld bc, $0006
+ ld bc, $6
call CopyBytes
ld a, [rSVBK]
push af
@@ -2696,7 +2696,7 @@
Function17e133: ; 17e133
call Function17e415
ld de, $c708
- ld bc, $0005
+ ld bc, $5
call CopyBytes
ld a, [rSVBK]
push af
@@ -2727,7 +2727,7 @@
Function17e165: ; 17e165
call Function17e415
ld de, $c708
- ld bc, $0005
+ ld bc, $5
call CopyBytes
ld a, [rSVBK]
push af
@@ -2764,7 +2764,7 @@
Function17e1a1: ; 17e1a1
call Function17e415
ld de, $c708
- ld bc, $000d
+ ld bc, $d
call CopyBytes
ld a, [$c70a]
cp $c0
@@ -2978,7 +2978,7 @@
call GetSRAMBank
ld hl, $aa73
ld de, $aa7f
- ld bc, $000c
+ ld bc, $c
call CopyBytes
call CloseSRAM
ret
@@ -3016,10 +3016,10 @@
call GetSRAMBank
ld hl, $c608
ld de, $b0b1
- ld bc, $0040
+ ld bc, $40
call CopyBytes
ld hl, BGMapBuffer
- ld bc, $005b
+ ld bc, $5b
call CopyBytes
call CloseSRAM
ret
@@ -3030,10 +3030,10 @@
call GetSRAMBank
ld hl, $b0b1
ld de, $c608
- ld bc, $0040
+ ld bc, $40
call CopyBytes
ld de, BGMapBuffer
- ld bc, $005b
+ ld bc, $5b
call CopyBytes
call CloseSRAM
ret
@@ -3059,7 +3059,7 @@
push af
ld a, $1
ld [rSVBK], a
- callba Function14a58
+ callba SaveAfterLinkTrade
pop af
ld [rSVBK], a
ret
@@ -3216,7 +3216,7 @@
add hl, bc
push hl
hlcoord 0, 0
- ld bc, $0014
+ ld bc, $14
ld a, [wcd23]
call AddNTimes
ld a, [CreditsTimer]
@@ -3224,7 +3224,7 @@
ld b, $0
add hl, bc
pop bc
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
.asm_17e48b
push af
push hl
@@ -3267,7 +3267,7 @@
jr nz, .asm_17e490
pop hl
ld a, [wcd27]
- ld de, $0014
+ ld de, $14
.asm_17e4cb
add hl, de
dec a
@@ -3294,7 +3294,7 @@
ret z
ld a, [wcd29]
hlcoord 0, 0
- ld bc, $0014
+ ld bc, $14
call AddNTimes
ld a, [wcd28]
ld c, a
@@ -3308,7 +3308,7 @@
.asm_17e4ff
ld a, [wcd2a]
- ld bc, $0014
+ ld bc, $14
call AddNTimes
ld a, [wcd42]
ld c, a
@@ -3331,7 +3331,7 @@
inc a
ld [wcd4f], a
hlcoord 0, 0
- ld bc, $0014
+ ld bc, $14
ld a, [wcd23]
dec a
call AddNTimes
@@ -3339,7 +3339,7 @@
ld c, a
ld b, $0
add hl, bc
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
ld c, a
ld a, [wcd27]
call SimpleMultiply
@@ -3352,7 +3352,7 @@
ld a, $7f
call ByteFill
pop hl
- ld bc, $0014
+ ld bc, $14
add hl, bc
pop af
dec a
@@ -3381,7 +3381,7 @@
Function17e571: ; 17e571
push af
hlcoord 0, 0
- ld bc, $0014
+ ld bc, $14
ld a, [wcd23]
call AddNTimes
ld a, [CreditsTimer]
@@ -3397,7 +3397,7 @@
call SimpleMultiply
ld l, $0
ld h, l
- ld bc, $0014
+ ld bc, $14
call AddNTimes
ld a, [wcd30]
dec a
@@ -3420,16 +3420,16 @@
ret z
ld a, [wcd43]
ld l, a
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
ld h, a
bccoord 0, 0
add hl, bc
ld bc, $ffec
add hl, bc
- ld a, [wcd45]
+ ld a, [wMobileInactivityTimerSeconds]
ld c, a
ld b, $0
- ld a, [wcd46]
+ ld a, [wMobileInactivityTimerFrames]
call Function17e600
ld a, [wcd2e]
ld c, a
@@ -3453,7 +3453,7 @@
pop de
ld a, [wcd43]
ld l, a
- ld a, [wcd44]
+ ld a, [wMobileInactivityTimerMinutes]
ld h, a
bccoord 0, 0
add hl, bc
@@ -3470,7 +3470,7 @@
call ByteFill
pop bc
pop hl
- ld de, $0014
+ ld de, $14
add hl, de
pop af
dec a
@@ -3481,7 +3481,7 @@
Function17e613: ; 17e613
push hl
hlcoord 0, 0
- ld bc, $0014
+ ld bc, $14
ld a, [de]
inc de
push af
@@ -3520,7 +3520,7 @@
add $2
ld [hl], a
pop hl
- ld bc, $0014
+ ld bc, $14
add hl, bc
ld a, [de]
dec de
@@ -3550,7 +3550,7 @@
ld [hl], a
pop hl
push bc
- ld bc, $0014
+ ld bc, $14
add hl, bc
pop bc
dec b
@@ -3583,7 +3583,7 @@
Function17e691: ; 17e691
push hl
ld hl, NULL
- ld bc, $0014
+ ld bc, $14
ld a, [de]
inc de
push af
@@ -3636,7 +3636,7 @@
dec a
jr nz, .asm_17e6af
pop hl
- ld bc, $0014
+ ld bc, $14
add hl, bc
pop af
dec a
@@ -3663,7 +3663,7 @@
dec c
jr nz, .asm_17e6f1
pop hl
- ld de, $0014
+ ld de, $14
add hl, de
dec b
jr nz, .asm_17e6ee
@@ -3733,14 +3733,14 @@
ld a, [de]
inc de
cp $50
- jr z, .asm_17f05f
+ jr z, .finished
cp $10
- jr nc, .asm_17f05f
+ jr nc, .finished
dec a
push de
ld e, a
ld d, 0
- ld hl, Jumptable_17f061
+ ld hl, .Jumptable
add hl, de
add hl, de
ld a, [hli]
@@ -3748,28 +3748,28 @@
ld l, a
jp [hl]
-.asm_17f05f
+.finished
scf
ret
; 17f061
-Jumptable_17f061: ; 17f061
- dw Function17f081
- dw Function17f0f8
- dw Function17f154
- dw Function17f181
- dw Function17f1d0
- dw Function17f220
- dw Function17f27b
- dw Function17f2cb
- dw Function17f2ff
- dw Function17f334
- dw Function17f382
- dw Function17f3c9
- dw Function17f3f0
- dw Function17f41d
- dw Function17f44f
- dw Function17f44f
+.Jumptable: ; 17f061
+ dw Function17f081 ; 0
+ dw Function17f0f8 ; 1
+ dw Function17f154 ; 2
+ dw Function17f181 ; 3
+ dw Function17f1d0 ; 4
+ dw Function17f220 ; 5
+ dw Function17f27b ; 6
+ dw Function17f2cb ; 7
+ dw Function17f2ff ; 8
+ dw Function17f334 ; 9
+ dw Function17f382 ; a
+ dw Function17f3c9 ; b
+ dw Function17f3f0 ; c
+ dw Function17f41d ; d
+ dw Function17f44f ; e
+ dw Function17f44f ; f
; 17f081
Function17f081: ; 17f081
@@ -3776,7 +3776,7 @@
pop hl
call Function17f524
jr c, .asm_17f09f
- ld de, $0004
+ ld de, 4
add hl, de
ld a, [hli]
inc hl
@@ -3801,7 +3801,7 @@
.asm_17f09f
push bc
ld de, wcd54
- ld bc, $0007
+ ld bc, 7
call CopyBytes
pop bc
push hl
@@ -3864,7 +3864,7 @@
pop hl
call Function17f524
jr c, .asm_17f114
- ld de, $0003
+ ld de, $3
add hl, de
ld a, [hli]
ld e, l
@@ -3887,7 +3887,7 @@
.asm_17f114
push bc
ld de, wcd54
- ld bc, $0004
+ ld bc, $4
call CopyBytes
pop bc
push hl
@@ -3963,7 +3963,7 @@
pop hl
call Function17f524
jr c, .asm_17f19d
- ld de, $0002
+ ld de, $2
add hl, de
ld a, [hli]
ld e, l
@@ -4018,7 +4018,7 @@
pop hl
call Function17f524
jr c, .asm_17f1ec
- ld de, $0002
+ ld de, $2
add hl, de
ld a, [hli]
ld e, l
@@ -4075,7 +4075,7 @@
pop hl
call Function17f524
jr c, .asm_17f23c
- ld de, $0002
+ ld de, $2
add hl, de
ld a, [hli]
ld e, l
@@ -4139,7 +4139,7 @@
pop hl
call Function17f524
jr c, .asm_17f297
- ld de, $0002
+ ld de, $2
add hl, de
ld a, [hli]
ld e, l
@@ -4236,7 +4236,7 @@
ld [rSVBK], a
ld hl, PlayerName
ld de, $c608
- ld bc, $0006
+ ld bc, $6
call CopyBytes
ld a, $4
ld [rSVBK], a
@@ -4346,7 +4346,7 @@
push bc
ld hl, wcd36
ld de, $c708
- ld bc, $000c
+ ld bc, 12
call CopyBytes
pop de
ld c, $0
@@ -4354,7 +4354,7 @@
push hl
ld hl, $c708
ld de, wcd36
- ld bc, $000c
+ ld bc, $c
call CopyBytes
pop bc
pop de
@@ -4393,9 +4393,9 @@
pop hl
add hl, de
add hl, de
-rept 3
inc hl
-endr
+ inc hl
+ inc hl
ld e, l
ld d, h
ld l, c
@@ -4453,7 +4453,7 @@
pop hl
call Function17f524
jr c, .asm_17f46d
- ld de, $0005
+ ld de, $5
add hl, de
ld a, [hli]
inc hl
@@ -4478,7 +4478,7 @@
.asm_17f46d
push bc
ld de, wcd54
- ld bc, $0008
+ ld bc, $8
call CopyBytes
pop bc
push hl
@@ -4647,7 +4647,7 @@
ld a, [wc303]
bit 7, a
jr nz, .quit
- callba Function104000
+ callba HDMATransferAttrMapAndTileMapToWRAMBank3
jr .loop
.quit
@@ -4716,7 +4716,7 @@
Function17f5d2: ; 17f5d2
call Function17f5e4
- callba Function104000
+ callba HDMATransferAttrMapAndTileMapToWRAMBank3
call SetPalettes
ld a, $1
ld [wc303], a
--- a/misc/mobile_menu.asm
+++ b/misc/mobile_menu.asm
@@ -280,7 +280,7 @@
call ClearBox
hlcoord 1, 14
call PlaceString
- callba Function104148
+ callba Mobile_OpenAndCloseMenu_HDMATransferTileMapAndAttrMap
call SetPalettes
call StaticMenuJoypad
ld hl, wMenuCursorY
@@ -403,7 +403,7 @@
hlcoord 14, 1
ld de, String_4a34b
call PlaceString
- callba Function104148
+ callba Mobile_OpenAndCloseMenu_HDMATransferTileMapAndAttrMap
call Function4a118
call ScrollingMenuJoypad
push af
@@ -432,7 +432,7 @@
ld b, 3
ld c, 4
call TextBox
- callba Function104148
+ callba Mobile_OpenAndCloseMenu_HDMATransferTileMapAndAttrMap
ld hl, DeletePassword_YesNo_MenuDataHeader
call LoadMenuDataHeader
call VerticalMenu
@@ -455,7 +455,7 @@
call ExitMenu
.quit
call Call_ExitMenu
- callba Function104148
+ callba Mobile_OpenAndCloseMenu_HDMATransferTileMapAndAttrMap
xor a
ret
; 4a346 (12:6346)
@@ -836,9 +836,9 @@
ld [hli], a
ld [hli], a
xor a
-rept 3
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
ret
Function4a6ab: ; 4a6ab (12:66ab)
@@ -845,7 +845,7 @@
ld a, $2
call MenuClickSound
call ClearBGPalettes
- ld b, SCGB_08
+ ld b, SCGB_DIPLOMA
call GetSGBLayout
callba Function11c1ab
pop bc
--- a/misc/printer_77.asm
+++ b/misc/printer_77.asm
@@ -1,27 +1,27 @@
PrintPage1: ; 1dc1b0
hlcoord 0, 0
- ld de, wca90
+ decoord 0, 0, wPrinterTileMapBuffer
ld bc, 17 * SCREEN_WIDTH
call CopyBytes
- ld hl, wcab5
+ hlcoord 17, 1, wPrinterTileMapBuffer
ld a, $62
ld [hli], a
inc a
ld [hl], a
- ld hl, wcac9
+ hlcoord 17, 2, wPrinterTileMapBuffer
ld a, $64
ld [hli], a
inc a
ld [hl], a
- ld hl, wcb45
+ hlcoord 1, 9, wPrinterTileMapBuffer
ld a, " "
ld [hli], a
ld [hl], a
- ld hl, wcb59
+ hlcoord 1, 10, wPrinterTileMapBuffer
ld a, $61
ld [hli], a
ld [hl], a
- ld hl, wcb6e
+ hlcoord 2, 11, wPrinterTileMapBuffer
lb bc, 5, 18
call ClearBox
ld a, [wd265]
@@ -34,9 +34,9 @@
callba GetDexEntryPagePointer
pop af
ld a, b
- ld hl, wcb6d
+ hlcoord 1, 11, wPrinterTileMapBuffer
call nz, FarString
- ld hl, wcaa3
+ hlcoord 19, 0, wPrinterTileMapBuffer
ld [hl], $35
ld de, SCREEN_WIDTH
add hl, de
@@ -51,19 +51,19 @@
; 1dc213
PrintPage2: ; 1dc213
- ld hl, wca90
- ld bc, $a0
+ hlcoord 0, 0, wPrinterTileMapBuffer
+ ld bc, 8 * SCREEN_WIDTH
ld a, " "
call ByteFill
- ld hl, wca90
+ hlcoord 0, 0, wPrinterTileMapBuffer
ld a, $36
- ld b, $6
+ ld b, 6
call .FillColumn
- ld hl, wcaa3
+ hlcoord 19, 0, wPrinterTileMapBuffer
ld a, $37
- ld b, $6
+ ld b, 6
call .FillColumn
- ld hl, wcb08
+ hlcoord 0, 6, wPrinterTileMapBuffer
ld [hl], $38
inc hl
ld a, $39
@@ -70,7 +70,7 @@
ld bc, SCREEN_HEIGHT
call ByteFill
ld [hl], $3a
- ld hl, wcb1c
+ hlcoord 0, 7, wPrinterTileMapBuffer
ld bc, SCREEN_WIDTH
ld a, $32
call ByteFill
@@ -83,7 +83,7 @@
ld c, 2 ; get page 2
callba GetDexEntryPagePointer
pop af
- ld hl, wcaa5
+ hlcoord 1, 1, wPrinterTileMapBuffer
ld a, b
call nz, FarString
ret
@@ -102,29 +102,29 @@
; 1dc275
GBPrinterStrings:
-String_1dc275: db "@"
-String_1dc276: next " CHECKING LINK...@"
-String_1dc289: next " TRANSMITTING...@"
-String_1dc29c: next " PRINTING...@"
-String_1dc2ad:
+GBPrinterString_Null: db "@"
+GBPrinterString_CheckingLink: next " CHECKING LINK...@"
+GBPrinterString_Transmitting: next " TRANSMITTING...@"
+GBPrinterString_Printing: next " PRINTING...@"
+GBPrinterString_PrinterError1:
db " Printer Error 1"
next ""
next "Check the Game Boy"
next "Printer Manual."
db "@"
-String_1dc2e2:
+GBPrinterString_PrinterError2:
db " Printer Error 2"
next ""
next "Check the Game Boy"
next "Printer Manual."
db "@"
-String_1dc317:
+GBPrinterString_PrinterError3:
db " Printer Error 3"
next ""
next "Check the Game Boy"
next "Printer Manual."
db "@"
-String_1dc34c:
+GBPrinterString_PrinterError4:
db " Printer Error 4"
next ""
next "Check the Game Boy"
@@ -132,7 +132,7 @@
db "@"
; 1dc381
-Function1dc381: ; 1dc381
+PrintPartyMonPage1: ; 1dc381
call ClearBGPalettes
call ClearTileMap
call ClearSprites
@@ -164,7 +164,7 @@
call TextBox
hlcoord 8, 2
ld a, [TempMonLevel]
- call Function383d
+ call PrintLevel_Force3Digits
hlcoord 12, 2
ld [hl], "◀" ; Filled left triangle
inc hl
@@ -232,7 +232,7 @@
ret
; 1dc47b
-Function1dc47b: ; 1dc47b
+PrintPartyMonPage2: ; 1dc47b
call ClearBGPalettes
call ClearTileMap
call ClearSprites
--- a/misc/unused_title.asm
+++ b/misc/unused_title.asm
@@ -10,9 +10,9 @@
ld [hBGMapMode], a
ld hl, wJumptableIndex
-rept 3
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
ld [hl], a
ld hl, UnusedTitleBG_GFX
--- a/predef/cgb.asm
+++ b/predef/cgb.asm
@@ -14,7 +14,7 @@
.not_ram
cp SCGB_PARTY_MENU_HP_PALS
jp z, CGB_ApplyPartyMenuHPPals
- call Function9673
+ call ResetBGPals
ld l, a
ld h, 0
add hl, hl
@@ -41,13 +41,13 @@
dw _CGB_SlotMachine
dw _CGB06
dw _CGB07
- dw _CGB08
+ dw _CGB_Diploma
dw _CGB_MapPals
- dw _CGB0a
- dw _CGB0b
+ dw _CGB_PartyMenu
+ dw _CGB_Evolution
dw _CGB0c
dw _CGB0d
- dw _CGB0e
+ dw _CGB_MoveList
dw _CGB0f
dw _CGB_PokedexSearchOption
dw _CGB11
@@ -56,13 +56,13 @@
dw _CGB_PackPals
dw _CGB_TrainerCard
dw _CGB_PokedexUnownMode
- dw _CGB17
- dw _CGB18
- dw _CGB19
- dw _CGB1a
- dw _CGB1b
- dw _CGB_FrontpicPals
- dw _CGB1d
+ dw _CGB_BillsPC
+ dw _CGB_UnownPuzzle
+ dw _CGB_GamefreakLogo ; called before copyright
+ dw _CGB_PlayerOrMonFrontpicPals
+ dw _CGB_TradeTube
+ dw _CGB_TrainerOrMonFrontpicPals
+ dw _CGB_MysteryGift
dw _CGB1e
; 8db8
@@ -329,7 +329,7 @@
RGB 00, 00, 00
; 8fca
-_CGB17: ; 8fca
+_CGB_BillsPC: ; 8fca
ld de, UnknBGPals
ld a, $1d
call GetPredefPal
@@ -568,8 +568,8 @@
ret
; 91ad
-_CGB08: ; 91ad
- ld hl, Palettes_b641
+_CGB_Diploma: ; 91ad
+ ld hl, DiplomaPalettes
ld de, UnknBGPals
ld bc, 16 palettes
ld a, $5
@@ -589,7 +589,7 @@
ret
; 91d1
-_CGB0a: ; 91d1
+_CGB_PartyMenu: ; 91d1
ld hl, PalPacket_9c56 + 1
call CopyFourPalettes
call InitPartyMenuBGPal0
@@ -599,7 +599,7 @@
ret
; 91e4
-_CGB0b: ; 91e4
+_CGB_Evolution: ; 91e4
ld de, UnknBGPals
ld a, c
and a
@@ -645,7 +645,7 @@
ld bc, 2 palettes
ld a, $5
call FarCopyWRAM
- ld a, SCGB_08
+ ld a, SCGB_DIPLOMA
ld [SGBPredef], a
call ApplyPals
ld a, $1
@@ -661,7 +661,7 @@
ret
; 925e
-_CGB18: ; 925e
+_CGB_UnownPuzzle: ; 925e
ld hl, PalPacket_9bc6 + 1
call CopyFourPalettes
ld de, UnknOBPals
@@ -786,7 +786,7 @@
ret
; 9373
-_CGB0e: ; 9373
+_CGB_MoveList: ; 9373
ld de, UnknBGPals
ld a, $10
call GetPredefPal
@@ -1002,7 +1002,7 @@
ret
; 94fa
-_CGB19: ; 94fa
+_CGB_GamefreakLogo: ; 94fa
ld de, UnknBGPals
ld a, $4e
call GetPredefPal
@@ -1026,7 +1026,7 @@
RGB 00, 00, 00
; 9529
-_CGB1a: ; 9529
+_CGB_PlayerOrMonFrontpicPals: ; 9529
ld de, UnknBGPals
ld a, [CurPartySpecies]
ld bc, TempMonDVs
@@ -1048,7 +1048,7 @@
ret
; 9555
-_CGB1b: ; 9555
+_CGB_TradeTube: ; 9555
ld hl, PalPacket_9cc6 + 1
call CopyFourPalettes
ld hl, Palettes_b681
@@ -1064,7 +1064,7 @@
ret
; 9578
-_CGB_FrontpicPals: ; 9578
+_CGB_TrainerOrMonFrontpicPals: ; 9578
ld de, UnknBGPals
ld a, [CurPartySpecies]
ld bc, TempMonDVs
@@ -1076,7 +1076,7 @@
ret
; 9591
-_CGB1d: ; 9591
+_CGB_MysteryGift: ; 9591
ld hl, .Palettes
ld de, UnknBGPals
ld bc, 2 palettes
--- a/predef/crystal.asm
+++ b/predef/crystal.asm
@@ -5,7 +5,7 @@
ld a, [SGBPredef]
.not_ram
push af
- callba Function9673
+ callba ResetBGPals
pop af
ld l, a
ld h, 0
@@ -554,9 +554,9 @@
hlcoord 2, 16, AttrMap
ld [hli], a
ld a, $7
-rept 3
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
ld a, $2
ld [hl], a
hlcoord 2, 17, AttrMap
@@ -566,7 +566,7 @@
ret
; 49811
-Function49811: ; 49811
+LoadTradeRoomBGPals: ; 49811
ld hl, Palette_49826
ld de, UnknBGPals + $10
ld bc, $30
--- a/predef/sgb.asm
+++ b/predef/sgb.asm
@@ -32,13 +32,13 @@
dw .SGB_SlotMachine
dw .SGB06
dw .SGB07
- dw .SGB08
+ dw .SGB_Diploma
dw .SGB_MapPals
- dw .SGB0a
- dw .SGB0b
+ dw .SGB_PartyMenu
+ dw .SGB_Evolution
dw .SGB0c
dw .SGB0d
- dw .SGB0e
+ dw .SGB_MoveList
dw .SGB0f
dw .SGB_PokedexSearchOption
dw .SGB11
@@ -47,13 +47,13 @@
dw .SGB_PackPals
dw .SGB_TrainerCard
dw .SGB_PokedexUnownMode
- dw .SGB17
- dw .SGB18
+ dw .SGB_BillsPC
+ dw .SGB_UnownPuzzle
dw .SGB19
- dw .SGB1a
- dw .SGB1b
- dw .SGB_FrontpicPals
- dw .SGB1d
+ dw .SGB_PlayerOrMonFrontpicPals
+ dw .SGB_TradeTube
+ dw .SGB_TrainerOrMonFrontpicPals
+ dw .SGB_MysteryGift
dw .SGB1e
; 86ad
@@ -65,7 +65,7 @@
.SGB_BattleColors: ; 86b4
ld hl, BlkPacket_9aa6
- call Function9809
+ call PushSGBPals_
ld hl, PalPacket_9ce6
ld de, wSGBPals
@@ -75,9 +75,8 @@
ld a, [PlayerHPPal]
ld l, a
ld h, 0
-rept 2
add hl, hl
-endr
+ add hl, hl
ld de, Palettes_a8be
add hl, de
@@ -93,9 +92,8 @@
ld a, [EnemyHPPal]
ld l, a
ld h, 0
-rept 2
add hl, hl
-endr
+ add hl, hl
ld de, Palettes_a8be
add hl, de
@@ -140,7 +138,7 @@
ret
; 873c
-.SGB0e: ; 873c
+.SGB_MoveList: ; 873c
ld hl, PalPacket_9bd6
ld de, wSGBPals
ld bc, $10
@@ -148,9 +146,8 @@
ld hl, wSGBPals + 1
ld [hl], $10
-rept 2
inc hl
-endr
+ inc hl
ld a, [PlayerHPPal]
add $2f
@@ -174,9 +171,8 @@
ld a, [wcda1]
ld l, a
ld h, 0
-rept 2
add hl, hl
-endr
+ add hl, hl
ld de, Palettes_a8be
add hl, de
ld a, [hli]
@@ -203,7 +199,7 @@
ret
; 87ab
-.SGB0a: ; 87ab
+.SGB_PartyMenu: ; 87ab
ld hl, PalPacket_9c56
ld de, wSGBPals + 1
ret
@@ -237,7 +233,7 @@
ret
; 87e9
-.SGB17: ; 87e9
+.SGB_BillsPC: ; 87e9
ld hl, PalPacket_9ce6
ld de, wSGBPals
ld bc, $10
@@ -308,8 +304,8 @@
ret
; 8860
-.SGB08:
-.SGB1d: ; 8860
+.SGB_Diploma:
+.SGB_MysteryGift: ; 8860
ld hl, PalPacket_9cb6
ld de, BlkPacket_9a86
ret
@@ -340,7 +336,7 @@
.SGB0c: ; 8884
ld hl, PalPacket_9b96
ld de, BlkPacket_9b56
- ld a, SCGB_08
+ ld a, SCGB_DIPLOMA
ld [SGBPredef], a
ret
; 8890
@@ -381,7 +377,7 @@
ret
; 88cd
-.SGB0b: ; 88cd
+.SGB_Evolution: ; 88cd
push bc
ld hl, PalPacket_9ce6
ld de, wSGBPals
@@ -391,11 +387,14 @@
ld a, c
and a
jr z, .partymon
+ ; Egg
ld hl, wSGBPals + 3
+ ; RGB 7, 7, 7
ld [hl], $e7
inc hl
ld [hl], $1c
inc hl
+ ; RGB 2, 3, 3
ld [hl], $62
inc hl
ld [hl], $c
@@ -432,7 +431,7 @@
ret
; 8921
-.SGB18: ; 8921
+.SGB_UnownPuzzle: ; 8921
ld hl, PalPacket_9bc6
ld de, BlkPacket_9a86
ret
@@ -476,9 +475,9 @@
ld a, [CurPartySpecies]
ld l, a
ld h, 0
-rept 3
add hl, hl
-endr
+ add hl, hl
+ add hl, hl
ld de, PokemonPalettes
add hl, de
ld a, [wcf65]
@@ -507,7 +506,7 @@
ret
; 89ad
-.SGB1a: ; 89ad
+.SGB_PlayerOrMonFrontpicPals: ; 89ad
ld hl, PalPacket_9ce6
ld de, wSGBPals
ld bc, $10
@@ -528,13 +527,13 @@
ret
; 89d9
-.SGB1b: ; 89d9
+.SGB_TradeTube: ; 89d9
ld hl, PalPacket_9cc6
ld de, BlkPacket_9a86
ret
; 89e0
-.SGB_FrontpicPals: ; 89e0
+.SGB_TrainerOrMonFrontpicPals: ; 89e0
ld hl, PalPacket_9ce6
ld de, wSGBPals
ld bc, $10
@@ -631,7 +630,7 @@
.Finish: ; 8a60
push de
- call Function9809
+ call PushSGBPals_
pop hl
- jp Function9809
+ jp PushSGBPals_
; 8a68
--- a/rst.asm
+++ b/rst.asm
@@ -22,9 +22,8 @@
push de
ld e, a
ld d, 0
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
--- a/sram.asm
+++ b/sram.asm
@@ -83,7 +83,7 @@
s0_b208:: ds 1 ; loaded with 99, used to check save corruption
-sBackupGameData::
+sBackupGameData:: ; b209
sBackupPlayerData:: ds wPlayerDataEnd - wPlayerData
sBackupMapData:: ds wMapDataEnd - wMapData
sBackupPokemonData:: ds wPokemonDataEnd - wPokemonData
@@ -104,7 +104,7 @@
s1_a008:: ds 1 ; loaded with 99, used to check save corruption
-sGameData::
+sGameData:: ; a009
sPlayerData:: ds wPlayerDataEnd - wPlayerData
sMapData:: ds wMapDataEnd - wMapData
sPokemonData:: ds wPokemonDataEnd - wPokemonData
--- a/text/trainer_class_names.asm
+++ b/text/trainer_class_names.asm
@@ -64,4 +64,4 @@
db "LEADER@"
db "OFFICER@"
db "ROCKET@"
- db "MYSTICALMAN@"
\ No newline at end of file
+ db "MYSTICALMAN@"
--- a/text/types.asm
+++ b/text/types.asm
@@ -85,9 +85,8 @@
ld hl, TypeNames
ld e, a
ld d, 0
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
--- a/tilesets/animations.asm
+++ b/tilesets/animations.asm
@@ -16,9 +16,8 @@
ld [hTileAnimFrame], a
ld h, 0
-rept 2
add hl, hl
-endr
+ add hl, hl
add hl, de
; 2-byte parameter
@@ -473,9 +472,9 @@
and 3 << 1
; 2 x 8 = 16 bytes per tile
-rept 3
add a
-endr
+ add a
+ add a
add WaterTileFrames % $100
ld l, a
@@ -512,9 +511,9 @@
.asm_fc46c
ld a, [TileAnimationTimer]
call GetForestTreeFrame
-rept 3
add a
-endr
+ add a
+ add a
add ForestTreeLeftFrames % $100
ld l, a
ld a, 0
@@ -554,9 +553,9 @@
.asm_fc4d4
ld a, [TileAnimationTimer]
call GetForestTreeFrame
-rept 3
add a
-endr
+ add a
+ add a
add ForestTreeLeftFrames % $100
ld l, a
ld a, 0
@@ -590,9 +589,9 @@
ld a, [TileAnimationTimer]
call GetForestTreeFrame
xor 2
-rept 3
add a
-endr
+ add a
+ add a
add ForestTreeLeftFrames % $100
ld l, a
ld a, 0
@@ -622,9 +621,9 @@
ld a, [TileAnimationTimer]
call GetForestTreeFrame
xor 2
-rept 3
add a
-endr
+ add a
+ add a
add ForestTreeLeftFrames % $100
ld l, a
ld a, 0
@@ -714,9 +713,8 @@
ld a, [TileAnimationTimer]
and 6
srl a
-rept 2
inc a
-endr
+ inc a
and 3
swap a
ld e, a
@@ -736,9 +734,9 @@
ld c, l
ld a, [TileAnimationTimer]
and 6
-rept 3
add a
-endr
+ add a
+ add a
ld e, a
ld d, 0
ld hl, SafariFountainFrames
--- a/trainers/dvs.asm
+++ b/trainers/dvs.asm
@@ -8,9 +8,8 @@
ld b, 0
ld hl, TrainerClassDVs
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld b, a
--- a/trainers/read_party.asm
+++ b/trainers/read_party.asm
@@ -32,9 +32,8 @@
ld c, a
ld b, 0
ld hl, TrainerGroups
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
@@ -62,9 +61,8 @@
ld d, h
ld e, l
ld hl, TrainerTypes
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
@@ -312,9 +310,9 @@
ComputeTrainerReward: ; 3991b (e:591b)
ld hl, hProduct
xor a
-rept 3
ld [hli], a
-endr
+ ld [hli], a
+ ld [hli], a
ld a, [wEnemyTrainerBaseReward]
ld [hli], a
ld a, [CurPartyLevel]
@@ -364,9 +362,8 @@
push bc
ld b, 0
ld hl, TrainerGroups
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
--- a/unknown/013a47.asm
+++ b/unknown/013a47.asm
@@ -1,4 +1,4 @@
-Function13a47: ; unreferenced
+CorrectErrorsInPlayerParty: ; unreferenced
ld hl, PartyCount
ld a, [hl]
and a
@@ -5,24 +5,24 @@
ret z
cp PARTY_LENGTH + 1
- jr c, .asm_13a54
+ jr c, .party_length_okay
ld a, PARTY_LENGTH
ld [hl], a
-.asm_13a54
+.party_length_okay
inc hl
ld b, a
ld c, 0
-.asm_13a58
+.loop1
ld a, [hl]
and a
- jr z, .asm_13a64
- cp $fc
- jr z, .asm_13a64
- cp $fe
- jr c, .asm_13a73
+ jr z, .invalid_species
+ cp NUM_POKEMON + 1
+ jr z, .invalid_species
+ cp EGG + 1
+ jr c, .next_species
-.asm_13a64
+.invalid_species
ld [hl], SMEARGLE
push hl
push bc
@@ -33,11 +33,11 @@
pop bc
pop hl
-.asm_13a73
+.next_species
inc hl
inc c
dec b
- jr nz, .asm_13a58
+ jr nz, .loop1
ld [hl], $ff
ld hl, PartyMon1
@@ -44,7 +44,7 @@
ld a, [PartyCount]
ld d, a
ld e, 0
-.asm_13a83
+.loop2
push de
push hl
ld b, h
@@ -51,11 +51,11 @@
ld c, l
ld a, [hl]
and a
- jr z, .asm_13a8f
+ jr z, .invalid_species_2
cp NUM_POKEMON + 1
- jr c, .asm_13a9c
+ jr c, .check_level
-.asm_13a8f
+.invalid_species_2
ld [hl], SMEARGLE
push de
ld d, 0
@@ -65,7 +65,7 @@
ld a, SMEARGLE
ld [hl], a
-.asm_13a9c
+.check_level
ld [CurSpecies], a
call GetBaseData
ld hl, MON_LEVEL
@@ -73,14 +73,14 @@
ld a, [hl]
cp MIN_LEVEL
ld a, MIN_LEVEL
- jr c, .asm_13ab4
+ jr c, .invalid_level
ld a, [hl]
cp MAX_LEVEL
- jr c, .asm_13ab5
+ jr c, .load_level
ld a, MAX_LEVEL
-.asm_13ab4
+.invalid_level
ld [hl], a
-.asm_13ab5
+.load_level
ld [CurPartyLevel], a
ld hl, MON_MAXHP
@@ -97,20 +97,20 @@
pop de
inc e
dec d
- jr nz, .asm_13a83
+ jr nz, .loop2
ld de, PartyMonNicknames
ld a, [PartyCount]
ld b, a
ld c, 0
-.asm_13adc
+.loop3
push bc
- call Function13b71
+ call .GetLengthOfStringWith6CharCap
push de
callba CheckStringForErrors
pop hl
pop bc
- jr nc, .asm_13b0e
+ jr nc, .valid_nickname
push bc
push hl
@@ -122,77 +122,77 @@
ld a, [hl]
cp EGG
ld hl, .TAMAGO
- jr z, .asm_13b06
+ jr z, .got_nickname
ld [wd265], a
call GetPokemonName
ld hl, StringBuffer1
-.asm_13b06
+.got_nickname
pop de
ld bc, PKMN_NAME_LENGTH
call CopyBytes
pop bc
-.asm_13b0e
+.valid_nickname
inc c
dec b
- jr nz, .asm_13adc
+ jr nz, .loop3
ld de, PartyMonOT
ld a, [PartyCount]
ld b, a
ld c, 0
-.asm_13b1b
+.loop4
push bc
- call Function13b71
+ call .GetLengthOfStringWith6CharCap
push de
callba CheckStringForErrors
pop hl
- jr nc, .asm_13b34
+ jr nc, .valid_ot_name
ld d, h
ld e, l
ld hl, PlayerName
ld bc, NAME_LENGTH
call CopyBytes
-.asm_13b34
+.valid_ot_name
pop bc
inc c
dec b
- jr nz, .asm_13b1b
+ jr nz, .loop4
ld hl, PartyMon1Moves
ld a, [PartyCount]
ld b, a
-.asm_13b40
+.loop5
push hl
ld c, NUM_MOVES
ld a, [hl]
and a
- jr z, .asm_13b4b
+ jr z, .invalid_move
cp NUM_ATTACKS + 1
- jr c, .asm_13b4d
-.asm_13b4b
+ jr c, .moves_loop
+.invalid_move
ld [hl], POUND
-.asm_13b4d
+.moves_loop
ld a, [hl]
and a
- jr z, .asm_13b55
+ jr z, .fill_invalid_moves
cp NUM_ATTACKS + 1
- jr c, .asm_13b5c
+ jr c, .next_move
-.asm_13b55
+.fill_invalid_moves
xor a
ld [hli], a
dec c
- jr nz, .asm_13b55
- jr .asm_13b60
+ jr nz, .fill_invalid_moves
+ jr .next_pokemon
-.asm_13b5c
+.next_move
inc hl
dec c
- jr nz, .asm_13b4d
+ jr nz, .moves_loop
-.asm_13b60
+.next_pokemon
pop hl
push bc
ld bc, PARTYMON_STRUCT_LENGTH
@@ -199,7 +199,7 @@
add hl, bc
pop bc
dec b
- jr nz, .asm_13b40
+ jr nz, .loop5
ret
; 13b6b
@@ -207,11 +207,11 @@
db "タマゴ@@@"
; 13b71
-Function13b71: ; 13b71
+.GetLengthOfStringWith6CharCap: ; 13b71
push de
ld c, 1
ld b, 6
-.loop
+.search_loop
ld a, [de]
cp "@"
jr z, .done
@@ -218,12 +218,11 @@
inc de
inc c
dec b
- jr nz, .loop
+ jr nz, .search_loop
dec c
dec de
ld a, "@"
ld [de], a
-
.done
pop de
ret
--- a/wram.asm
+++ b/wram.asm
@@ -34,7 +34,7 @@
wCurTrackIntensity:: ds 1
wCurTrackFrequency:: dw
wc296:: ds 1 ; BCD value, dummied out
-wc297:: ds 1 ; used in MusicE0 and LoadNote
+wCurNoteDuration:: ds 1 ; used in MusicE0 and LoadNote
CurMusicByte:: ; c298
ds 1
@@ -152,15 +152,15 @@
ds 1
wMonStatusFlags:: ds 1
-wc2cd:: ds 1
+wGameLogicPaused:: ds 1 ; c2cd
wSpriteUpdatesEnabled:: ds 1
wc2cf:: ds 1
wMapTimeOfDay:: ds 1
ds 3
-wc2d4:: ds 1
-wc2d5:: ds 1
+wPrinterConnectionOpen:: ds 1
+wPrinterOpcode:: ds 1
wLastDexEntry:: ds 1
-wc2d7:: ds 1
+wDisableTextAcceleration:: ds 1
wPreviousLandmark:: ds 1
wCurrentLandmark:: ds 1
wLandmarkSignTimer:: ds 2
@@ -242,26 +242,6 @@
wc312:: ds 1
wc313:: ds 1
wSpriteAnimationStructs::
-
-sprite_anim_struct: MACRO
-\1Index:: ds 1 ; 0
-\1FramesetID:: ds 1 ; 1
-\1AnimSeqID:: ds 1 ; 2
-\1TileID:: ds 1 ; 3
-\1XCoord:: ds 1 ; 4
-\1YCoord:: ds 1 ; 5
-\1XOffset:: ds 1 ; 6
-\1YOffset:: ds 1 ; 7
-\1Duration:: ds 1 ; 8
-\1DurationOffset:: ds 1 ; 9
-\1FrameIndex:: ds 1 ; a
-\1Sprite0b:: ds 1
-\1Sprite0c:: ds 1
-\1Sprite0d:: ds 1
-\1Sprite0e:: ds 1
-\1Sprite0f:: ds 1
-ENDM
-
; Field 0: Index
; Fields 1-3: Loaded from SpriteAnimSeqData
wc314::
@@ -374,7 +354,9 @@
wMisc:: ; ds (SCREEN_WIDTH + 4) * (SCREEN_HEIGHT + 2)
ds 10
wc612::
- ds 10
+ ds 6
+wc618::
+ ds 4
wInitHourBuffer:: ; c61c
ds 10
wc626::
@@ -554,10 +536,18 @@
ds 1
PlayerStats:: ; c6b6
- ds 10
+PlayerAttack:: ds 2
+PlayerDefense:: ds 2
+PlayerSpeed:: ds 2
+PlayerSpAtk:: ds 2
+PlayerSpDef:: ds 2
ds 1
EnemyStats:: ; c6c1
- ds 10
+EnemyAttack:: ds 2
+EnemyDefense:: ds 2
+EnemySpeed:: ds 2
+EnemySpAtk:: ds 2
+EnemySpDef:: ds 2
ds 1
PlayerStatLevels:: ; c6cc
@@ -885,8 +875,8 @@
wDexCurrentUnownIndex:: ds 1
wDexUnownCount:: ds 1
wDexConvertedMonType:: ds 1 ; mon type converted from dex search mon type
-wc7e0:: ds 1
-wc7e1:: ds 1
+wDexListingScrollOffsetBackup:: ds 1
+wDexListingCursorBackup:: ds 1
wBackupDexListingCursor::
wc7e2:: ds 1
wBackupDexListingPage::
@@ -906,7 +896,7 @@
wMiscEnd::
-wc7e8:: ds 24
+wc7e8:: ds 24 ; ????
SECTION "Overworld Map", WRAM0 [$c800]
@@ -915,7 +905,47 @@
OverworldMapEnd::
ds OverworldMap - @
-wBillsPCPokemonList::
+wGameboyPrinterRAM::
+wGameboyPrinterScreen:: ds SCREEN_HEIGHT * SCREEN_WIDTH ; c800
+wGameboyPrinterScreenEnd:: ; c968
+ ds wGameboyPrinterScreen - @
+wGameboyPrinter2bppSource::
+ ds 40 tiles
+wGameboyPrinter2bppSourceEnd::
+wca80:: ds 1
+wPrinterRowIndex:: ds 1
+
+; Printer data header
+wca82:: ds 1
+wca83:: ds 1
+wca84:: ds 1
+wca85:: ds 1
+wPrinterChecksum:: dw ; ca86
+wPrinterHandshake:: ds 1
+wPrinterStatusFlags::
+; bit 7: set if error 1 (battery low)
+; bit 6: set if error 4 (too hot or cold)
+; bit 5: set if error 3 (paper jammed or empty)
+; if this and the previous byte are both $ff: error 2 (connection error)
+ ds 1
+
+wHandshakeFrameDelay:: ds 1
+wPrinterSerialFrameDelay:: ds 1
+wPrinterSendByteOffset:: dw
+wPrinterSendByteCounter:: dw
+
+; tilemap backup?
+wPrinterTileMapBuffer:: ds SCREEN_HEIGHT * SCREEN_WIDTH ; ca90
+wPrinterTileMapBufferEnd::
+wPrinterStatus:: ds 1 ; cbf8
+ ds 1
+wcbfa:: ds 1
+wGBPrinterSettings:: ds 1
+ ds 16
+wGameboyPrinterRAMEnd::
+ ds wGameboyPrinterRAM - @
+
+wBillsPCPokemonList:: ; c800
; Pokemon, box number, list index
wMysteryGiftPartyTemp:: ; ds PARTY_LENGTH * (1 + 1 + NUM_MOVES)
@@ -1036,44 +1066,14 @@
wca50:: ds 16
wca60:: ds 16
wca70:: ds 16
-wca80:: ds 1
-wca81:: ds 1
-wca82:: ds 1
-wca83:: ds 1
-wca84:: ds 1
-wca85:: ds 1
-wca86:: ds 1
-wca87:: ds 1
-; Gameboy Printer
-wca88:: ds 1
-wca89::
-; bit 7: set if error 1
-; bit 6: set if error 4
-; bit 5: set if error 3
- ds 1
+ ds 35
-wca8a:: ds 1
-wca8b:: ds 1
-wca8c:: ds 1
-wca8d:: ds 1
-wca8e:: ds 1
-wca8f:: ds 1
-
-; tilemap backup?
-wca90:: ds 16
-wcaa0:: ds 3
-wcaa3:: ds 2
-wcaa5:: ds 11
-wcab0:: ds 5
+wcaa3:: ds 2 ; caa3
+wcaa5:: ds 16
wcab5:: ds 10
-wcabf:: ds 1
-wcac0:: ds 9
-wcac9:: ds 7
-wcad0:: ds 16
-wcae0:: ds 16
-wcaf0:: ds 16
-wcb00:: ds 8
+wcabf:: ds 10
+wcac9:: ds 63
wcb08:: ds 6
wcb0e:: ds 5
wcb13:: ds 9
@@ -1096,11 +1096,8 @@
wcbe8:: dw
wLinkOTPartyMonTypes::
ds 2 * PARTY_LENGTH
- ds 2
+ ds 84
-wcbf8:: ds 2
-wcbfa:: ds 1
-wcbfb:: ds 79
wcc4a:: ds 22
wcc60:: ds 1
wcc61:: ds 1
@@ -1132,7 +1129,7 @@
wcd23:: ds 1
wcd24:: ds 1
-wcd25:: ds 1
+wMobileCommsJumptableIndex:: ds 1 ; cd25
wcd26:: ds 1
wcd27:: ds 1
wcd28:: ds 1
@@ -1151,8 +1148,12 @@
wcd33:: ds 1
wcd34:: ds 1
wcd35:: ds 1
-wcd36:: ds 2
-wcd38:: ds 1
+
+; current time for link/mobile?
+wcd36:: ds 1 ; hours
+wcd37:: ds 1 ; mins
+wcd38:: ds 1 ; secs
+
wcd39:: ds 1
wcd3a:: ds 1
wcd3b:: ds 1
@@ -1164,9 +1165,12 @@
wcd41:: ds 1
wcd42:: ds 1
wcd43:: ds 1
-wcd44:: ds 1
-wcd45:: ds 1
-wcd46:: ds 1
+
+; some sort of timer in link battles
+wMobileInactivityTimerMinutes:: ds 1 ; mins
+wMobileInactivityTimerSeconds:: ds 1 ; secs
+wMobileInactivityTimerFrames:: ds 1 ; frames
+
wcd47:: ds 1
BGMapPalBuffer:: ; cd48
@@ -1176,7 +1180,9 @@
wcd49:: ds 1
wcd4a:: ds 1
wcd4b:: ds 1
+wEZChatCursorXCoord::
wcd4c:: ds 1
+wEZChatCursorYCoord::
wcd4d:: ds 1
wcd4e:: ds 1
wcd4f:: ds 1
@@ -1183,6 +1189,7 @@
wcd50:: ds 1
wcd51:: ds 1
wcd52:: ds 1
+wMobileOpponentBattleMessage:: ; dc $c
wcd53:: ds 1
wcd54:: ds 1
wcd55:: ds 1
@@ -1220,8 +1227,8 @@
wcd72:: ds 1
wcd73:: ds 1
wcd74:: ds 1
-wcd75:: ds 2
-wcd77:: ds 1
+wOTMonSelection:: ds 2 ; ds 3
+wcd77:: ds 1
wcd78:: ds 1
wcd79:: ds 1
wcd7a:: ds 2
@@ -1238,6 +1245,7 @@
wcd8b:: ds 1
wcd8c:: ds 1
wcd8d:: ds 11
+BGMapBufferEnd::
SGBPredef:: ; cd98
ds 1
@@ -1251,10 +1259,14 @@
wSGBPals:: ds 48 ; cda9
AttrMap:: ; cdd9
-; 20x18 grid of palettes for 8x8 tiles
+; 20x18 grid of bg tile attributes for 8x8 tiles
; read horizontally from the top row
-; bit 3: vram bank
-; bit 0-2: palette id
+; bit 7: priority
+; bit 6: y flip
+; bit 5: x flip
+; bit 4: pal # (non-cgb)
+; bit 3: vram bank (cgb only)
+; bit 2-0: pal # (cgb only)
ds SCREEN_WIDTH * SCREEN_HEIGHT
AttrMapEnd::
ds 1
@@ -1269,8 +1281,7 @@
wOtherPlayerLinkAction:: ds 4
wPlayerLinkAction:: ds 1
wcf57:: ds 4
-wcf5b:: ds 1
-wcf5c:: ds 1
+wLinkTimeoutFrames:: dw ; cf5b
wcf5d:: ds 2
MonType:: ; cf5f
@@ -1301,6 +1312,7 @@
wUnownPuzzleCursorPosition::
wCardFlipCursorX::
wCurrPocket::
+wPrinterQueueLength::
wcf65:: ds 1
wCreditsLYOverride::
wTitleScreenTimerHi::
@@ -1524,18 +1536,13 @@
wSeerCaughtGender:: ds 1
ds wSeerAction - @
-wBufferMonNick:: ds PKMN_NAME_LENGTH
-wBufferMonOT:: ds NAME_LENGTH
-wBufferMon:: party_struct wBufferMon
+wBufferMonNick:: ds PKMN_NAME_LENGTH ; d002
+wBufferMonOT:: ds NAME_LENGTH ; d00d
+wBufferMon:: party_struct wBufferMon ; d018
ds 8
wMonOrItemNameBuffer::
ds wBufferMonNick - @
-bugcontestwinner: macro
-\1PersonID:: ds 1
-\1Mon:: ds 1
-\1Score:: ds 2
-endm
wBugContestResults::
bugcontestwinner wBugContestFirstPlace
bugcontestwinner wBugContestSecondPlace
@@ -1555,6 +1562,7 @@
wCurrentRadioLine::
wMovementBufferCount::
wMartItem1BCD::
+wWhichBoxMonToPrint::
ds 1
wd003::
LuckyNumberDigit2Buffer::
@@ -1562,6 +1570,7 @@
wNextRadioLine::
wMovementBufferPerson::
wPlaceBallsDirection::
+wFinishedPrintingBox::
ds 1
wd004::
LuckyNumberDigit3Buffer::
@@ -1568,6 +1577,7 @@
PhoneCallerHi::
wRadioTextDelay::
wTrainerHUDTiles::
+wAddrOfBoxToPrint::
ds 1
wd005::
LuckyNumberDigit4Buffer::
@@ -1580,9 +1590,11 @@
LuckyNumberDigit5Buffer::
EndFlypoint:: ; d006
wOaksPkmnTalkSegmentCounter::
+wBankOfBoxToPrint::
ds 1
wd007::
+wWhichBoxToPrint::
MovementBuffer:: ; d007
ds 1
@@ -1701,8 +1713,9 @@
wRunningTrainerBattleScript:: ds 1
MenuItemsListEnd::
wTempTrainerHeaderEnd::
-wd04e:: ds 24
-wTMHMMoveNameBackup:: ds MOVE_NAME_LENGTH
+wPlayerTurningDirection:: ; d04e
+ ds 24
+wTMHMMoveNameBackup:: ds MOVE_NAME_LENGTH ; d066
StringBuffer1:: ; d073
ds 19
@@ -1782,12 +1795,9 @@
wMailboxEnd:: ds 1 ; d0fe
ds 2
-wd100:: ds 1
-wd101:: ds 1
-wd102:: ds 1
-wd103:: ds 1
-wd104:: ds 1
-wd105:: ds 1
+wListPointer:: dw ; d100
+wUnusedD102:: dw ; d102
+wItemAttributesPtr:: dw ; d104
CurItem:: ds 1 ; d106
CurItemQuantity:: ; d107
@@ -1845,8 +1855,8 @@
wPrevMapNumber:: ds 1
; d14c
-wFollowNotExactPersonX:: ds 1 ; used in FollowNotExact
-wFollowNotExactPersonY:: ds 1 ; used in FollowNotExact
+wPlayerBGMapOffsetX:: ds 1 ; used in FollowNotExact; unit is pixels
+wPlayerBGMapOffsetY:: ds 1 ; used in FollowNotExact; unit is pixels
; Player movement
wPlayerStepVectorX:: ds 1 ; d14e
@@ -1868,7 +1878,7 @@
wd154:: ; d154
ds 31 ; 64
-wd173:: ds 1
+wd173:: ds 1 ; related to command queue type 3
ds 13
wd181:: ds 1
wd182:: ds 1
@@ -2012,16 +2022,32 @@
EvolvableFlags:: ; d1e8
flag_array PARTY_LENGTH
-wForceEvolution:: ds 1
+wForceEvolution:: db ; d1e9
+
+; HP bar animations
+wCurHPAnimMaxHP:: dw ; d1ea
+wCurHPAnimOldHP:: dw ; d1ec
+wCurHPAnimNewHP:: dw ; d1ee
+wCurHPAnimPal:: db ; d1f0
+wCurHPBarPixels:: db ; d1f1
+wNewHPBarPixels:: db ; d1f2
+wCurHPAnimDeltaHP:: dw ; d1f3
+wCurHPAnimLowHP:: db ; d1f5
+wCurHPAnimHighHP:: db ; d1f6
+ ds wCurHPAnimMaxHP - @
+
MagikarpLength::
+wEvolutionOldSpecies::
Buffer1:: ; d1ea
ds 1
MovementType::
+wEvolutionNewSpecies::
Buffer2:: ; d1eb
ds 1
-
+wEvolutionPicOffset::
Buffer3::
wd1ec:: ds 1
+wEvolutionCanceled::
Buffer4::
wd1ed:: ds 1
Buffer5::
@@ -2029,14 +2055,14 @@
Buffer6::
wd1ef:: ds 1
wd1f0:: ds 1
-wCurHPBarPixels::
+CurEnemyItem::
wd1f1:: ds 1
-wNewHPBarPixels::
wd1f2:: ds 1
wd1f3:: ds 1
wd1f4:: ds 1
wd1f5:: ds 1
-wd1f6:: ds 4
+wd1f6::
+ ds 4
LinkBattleRNs:: ; d1fa
ds 10
@@ -2151,8 +2177,8 @@
wWaterEncounterRate:: ds 1 ; d25d
wListMoves_MoveIndicesBuffer:: ds NUM_MOVES
wPutativeTMHMMove:: ds 1
-wd263:: ds 1
-wAISwitch:: ds 1
+wInitListType:: ds 1
+wBattleHasJustStarted:: ds 1
wFoundMatchingIDInParty::
wNamedObjectIndexBuffer::
wCurTMHM::
@@ -2351,44 +2377,6 @@
wFollowMovementQueue:: ds 5
ObjectStructs:: ; d4d6
-object_struct: MACRO
-\1Struct::
-\1Sprite:: ds 1
-\1MapObjectIndex:: ds 1
-\1SpriteTile:: ds 1
-\1MovementType:: ds 1
-\1Flags:: ds 2
-\1Palette:: ds 1
-\1Walking:: ds 1
-\1Direction:: ds 1
-\1StepType:: ds 1
-\1StepDuration:: ds 1
-\1Action:: ds 1
-\1ObjectStepFrame:: ds 1
-\1Facing:: ds 1
-\1StandingTile:: ds 1 ; collision
-\1LastTile:: ds 1 ; collision
-\1StandingMapX:: ds 1
-\1StandingMapY:: ds 1
-\1LastMapX:: ds 1
-\1LastMapY:: ds 1
-\1ObjectInitX:: ds 1
-\1ObjectInitY:: ds 1
-\1Radius:: ds 1
-\1SpriteX:: ds 1
-\1SpriteY:: ds 1
-\1SpriteXOffset:: ds 1
-\1SpriteYOffset:: ds 1
-\1MovementByteIndex:: ds 1
-\1Object28:: ds 1
-\1Object29:: ds 1
-\1Object30:: ds 1
-\1Object31:: ds 1
-\1Range:: ds 1
- ds 7
-\1StructEnd::
-ENDM
-
object_struct Player
object_struct Object1
object_struct Object2
@@ -2408,23 +2396,6 @@
ds $28
MapObjects:: ; d71e
-map_object: MACRO
-\1Object::
-\1ObjectStructID:: ds 1
-\1ObjectSprite:: ds 1
-\1ObjectYCoord:: ds 1
-\1ObjectXCoord:: ds 1
-\1ObjectMovement:: ds 1
-\1ObjectRadius:: ds 1
-\1ObjectHour:: ds 1
-\1ObjectTimeOfDay:: ds 1
-\1ObjectColor:: ds 1
-\1ObjectRange:: ds 1
-\1ObjectScript:: ds 2
-\1ObjectEventFlag:: ds 2
- ds 2
-endm
-
map_object Player
map_object Map1
map_object Map2
@@ -2741,7 +2712,7 @@
wWhichMomItemSet:: ds 1 ; dc18
MomItemTriggerBalance:: ds 3 ; dc19
-wDailyResetTimer:: ds 2
+wDailyResetTimer:: ds 2 ; dc1c
DailyFlags:: ds 1
WeeklyFlags:: ds 1
SwarmFlags:: ds 1
@@ -2753,9 +2724,9 @@
ds 2
-wLuckyNumberDayBuffer:: ds 2
+wLuckyNumberDayBuffer:: ds 2 ; dc2d
ds 2
-wSpecialPhoneCallID:: ds 1
+wSpecialPhoneCallID:: ds 1 ; dc31
ds 3
wBugContestStartTime:: ds 4 ; day, hour, min, sec ; dc35
wUnusedTwoDayTimerOn:: ds 1 ; dc39
@@ -2773,7 +2744,7 @@
wKenjiBreakTimer:: ds 2 ; Kenji
wYanmaMapGroup:: ds 1 ; dc5a
wYanmaMapNumber:: ds 1
-wdc5c:: ds 3
+wPlayerMonSelection:: ds 3
wdc5f:: ds 1
wdc60:: ds 19
@@ -2921,15 +2892,6 @@
wDunsparceMapNumber:: ds 1
wFishingSwarmFlag:: ds 1
-roam_struct: MACRO
-\1Species:: db
-\1Level:: db
-\1MapGroup:: db
-\1MapNumber:: db
-\1HP:: ds 1
-\1DVs:: ds 2
-ENDM
-
wRoamMon1:: roam_struct wRoamMon1 ; dfcf
wRoamMon2:: roam_struct wRoamMon2 ; dfd6
wRoamMon3:: roam_struct wRoamMon3 ; dfdd
@@ -2956,12 +2918,12 @@
wPokeAnimSpecies:: ds 1
wPokeAnimUnownLetter:: ds 1
wPokeAnimSpeciesOrUnown:: ds 1
-w2_d16e:: ds 1
+wPokeAnimGraphicStartTile:: ds 1
wPokeAnimCoord:: ds 2
wPokeAnimFrontpicHeight:: ds 1
; PokeAnim Data
wPokeAnimExtraFlag:: ds 1
-w2_d173:: ds 1
+wPokeAnimSpeed:: ds 1
wPokeAnimPointerBank:: ds 1
wPokeAnimPointerAddr:: ds 2
wPokeAnimFramesBank:: ds 1
@@ -2968,19 +2930,19 @@
wPokeAnimFramesAddr:: ds 2
wPokeAnimBitmaskBank:: ds 1
wPokeAnimBitmaskAddr:: ds 2
-w2_d17d:: ds 1
-w2_d17e:: ds 1
+wPokeAnimFrame:: ds 1
+wPokeAnimJumptableIndex:: ds 1
wPokeAnimRepeatTimer:: ds 1
-w2_d180:: ds 1
+wPokeAnimCurBitmask:: ds 1
wPokeAnimWaitCounter:: ds 1
-w2_d182:: ds 1
-w2_d183:: ds 1
-w2_d184:: ds 1
-w2_d185:: ds 1
-w2_d186:: ds 1
-w2_d187:: ds 1
-w2_d188:: ds 1
- ds 8
+wPokeAnimCommand:: ds 1
+wPokeAnimParameter:: ds 1
+ ds 1
+wPokeAnimBitmaskCurCol:: ds 1
+wPokeAnimBitmaskCurRow:: ds 1
+wPokeAnimBitmaskCurBit:: ds 1
+wPokeAnimBitmaskBuffer:: ds 7
+ ds 2
wPokeAnimStructEnd::
@@ -3053,7 +3015,7 @@
wMagnetTrainHoldPosition:: ds 1
wMagnetTrainFinalPosition:: ds 1
wMagnetTrainPlayerSpriteInitX:: ds 1
-ds 106
+ ds 106
LYOverridesBackup:: ; d200
ds SCREEN_HEIGHT_PX
@@ -3064,34 +3026,6 @@
wBattleAnimTileDict:: ds 10
-battle_anim_struct: MACRO
-; Placeholder until we can figure out what it all means
-\1_Index:: ds 1
-\1_Anim01:: ds 1
-\1_Anim02:: ds 1
-\1_FramesetIndex:: ds 1
-\1_FunctionIndex:: ds 1
-\1_Anim05:: ds 1
-\1_TileID:: ds 1
-\1_XCoord:: ds 1
-\1_YCoord:: ds 1
-\1_XOffset:: ds 1
-\1_YOffset:: ds 1
-\1_Anim0b:: ds 1
-\1_Anim0c:: ds 1
-\1_Anim0d:: ds 1
-\1_AnonJumptableIndex:: ds 1
-\1_Anim0f:: ds 1
-\1_Anim10:: ds 1
-\1_Anim11:: ds 1
-\1_Anim12:: ds 1
-\1_Anim13:: ds 1
-\1_Anim14:: ds 1
-\1_Anim15:: ds 1
-\1_Anim16:: ds 1
-\1_Anim17:: ds 1
-endm
-
ActiveAnimObjects:: ; d30a
AnimObject01:: battle_anim_struct AnimObject01
AnimObject02:: battle_anim_struct AnimObject02
@@ -3105,13 +3039,6 @@
AnimObject10:: battle_anim_struct AnimObject10
ActiveAnimObjectsEnd:: ; d3aa
-battle_bg_effect: MACRO
-\1_Function:: ds 1
-\1_01:: ds 1
-\1_02:: ds 1
-\1_03:: ds 1
-endm
-
ActiveBGEffects:: ; d3fa
BGEffect1:: battle_bg_effect BGEffect1
BGEffect2:: battle_bg_effect BGEffect2
@@ -3166,15 +3093,17 @@
w5_dc00:: ds $d
w5_dc0d:: ds 4
w5_dc11:: ds 9
-w5_dc1a:: ds $c
-w5_dc26:: ds $c
-w5_dc32:: ds $c
-w5_dc3e:: ds $c
+w5_MobileOpponentBattleMessages:: ds $c ; dc1a
+w5_MobileOpponentBattleStartMessage:: ds $c ; dc26
+w5_MobileOpponentBattleWinMessage:: ds $c ; dc32
+w5_MobileOpponentBattleLossMessage:: ds $c ; dc3e
SECTION "WRAM 6", WRAMX, BANK [6]
-wDecompressScratch:: ds $400
-wBackupAttrMap:: ds $200
+wDecompressScratch::
+wScratchTileMap::
+ ds BG_MAP_WIDTH * BG_MAP_HEIGHT
+wScratchAttrMap:: ds $200
w6_d600:: ds $200
w6_d800::