-
Notifications
You must be signed in to change notification settings - Fork 811
/
radio.asm
1820 lines (1574 loc) · 31.1 KB
/
radio.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
PlayRadioShow:
; If we're already in the radio program proper, we don't need to be here.
ld a, [wCurRadioLine]
cp POKE_FLUTE_RADIO
jr nc, .ok
; If Team Rocket is not occupying the radio tower, we don't need to be here.
ld a, [wStatusFlags2]
bit STATUSFLAGS2_ROCKETS_IN_RADIO_TOWER_F, a
jr z, .ok
; If we're in Kanto, we don't need to be here.
call IsInJohto
and a
jr nz, .ok
; Team Rocket broadcasts on all stations.
ld a, ROCKET_RADIO
ld [wCurRadioLine], a
.ok
; Jump to the currently loaded station. The index to which we need to jump is in wCurRadioLine.
jumptable RadioJumptable, wCurRadioLine
RadioJumptable:
; entries correspond to constants/radio_constants.asm
table_width 2, RadioJumptable
dw OaksPKMNTalk1 ; $00
dw PokedexShow1 ; $01
dw BenMonMusic1 ; $02
dw LuckyNumberShow1 ; $03
dw BuenasPassword1 ; $04
dw PeoplePlaces1 ; $05
dw FernMonMusic1 ; $06
dw RocketRadio1 ; $07
dw PokeFluteRadio ; $08
dw UnownRadio ; $09
dw EvolutionRadio ; $0a
assert_table_length NUM_RADIO_CHANNELS
; OaksPKMNTalk
dw OaksPKMNTalk2 ; $0b
dw OaksPKMNTalk3 ; $0c
dw OaksPKMNTalk4 ; $0d
dw OaksPKMNTalk5 ; $0e
dw OaksPKMNTalk6 ; $0f
dw OaksPKMNTalk7 ; $10
dw OaksPKMNTalk8 ; $11
dw OaksPKMNTalk9 ; $12
dw PokedexShow2 ; $13
dw PokedexShow3 ; $14
dw PokedexShow4 ; $15
dw PokedexShow5 ; $16
; Ben Music
dw BenMonMusic2 ; $17
dw BenMonMusic3 ; $18
dw BenFernMusic4 ; $19
dw BenFernMusic5 ; $1a
dw BenFernMusic6 ; $1b
dw BenFernMusic7 ; $1c
dw FernMonMusic2 ; $1d
; Lucky Number Show
dw LuckyNumberShow2 ; $1e
dw LuckyNumberShow3 ; $1f
dw LuckyNumberShow4 ; $20
dw LuckyNumberShow5 ; $21
dw LuckyNumberShow6 ; $22
dw LuckyNumberShow7 ; $23
dw LuckyNumberShow8 ; $24
dw LuckyNumberShow9 ; $25
dw LuckyNumberShow10 ; $26
dw LuckyNumberShow11 ; $27
dw LuckyNumberShow12 ; $28
dw LuckyNumberShow13 ; $29
dw LuckyNumberShow14 ; $2a
dw LuckyNumberShow15 ; $2b
; People & Places
dw PeoplePlaces2 ; $2c
dw PeoplePlaces3 ; $2d
dw PeoplePlaces4 ; $2e
dw PeoplePlaces5 ; $2f
dw PeoplePlaces6 ; $30
dw PeoplePlaces7 ; $31
; Rocket Radio
dw RocketRadio2 ; $32
dw RocketRadio3 ; $33
dw RocketRadio4 ; $34
dw RocketRadio5 ; $35
dw RocketRadio6 ; $36
dw RocketRadio7 ; $37
dw RocketRadio8 ; $38
dw RocketRadio9 ; $39
dw RocketRadio10 ; $3a
; More Pokemon Channel stuff
dw OaksPKMNTalk10 ; $3b
dw OaksPKMNTalk11 ; $3c
dw OaksPKMNTalk12 ; $3d
dw OaksPKMNTalk13 ; $3e
dw OaksPKMNTalk14 ; $3f
; Buenas Password
dw BuenasPassword2 ; $40
dw BuenasPassword3 ; $41
dw BuenasPassword4 ; $42
dw BuenasPassword5 ; $43
dw BuenasPassword6 ; $44
dw BuenasPassword7 ; $45
dw BuenasPassword8 ; $46
dw BuenasPassword9 ; $47
dw BuenasPassword10 ; $48
dw BuenasPassword11 ; $49
dw BuenasPassword12 ; $4a
dw BuenasPassword13 ; $4b
dw BuenasPassword14 ; $4c
dw BuenasPassword15 ; $4d
dw BuenasPassword16 ; $4e
dw BuenasPassword17 ; $4f
dw BuenasPassword18 ; $50
dw BuenasPassword19 ; $51
dw BuenasPassword20 ; $52
dw BuenasPassword21 ; $53
dw RadioScroll ; $54
; More Pokemon Channel stuff
dw PokedexShow6 ; $55
dw PokedexShow7 ; $56
dw PokedexShow8 ; $57
assert_table_length NUM_RADIO_SEGMENTS
PrintRadioLine:
ld [wNextRadioLine], a
ld hl, wRadioText
ld a, [wNumRadioLinesPrinted]
cp 2
jr nc, .print
inc hl
ld [hl], TX_START
inc a
ld [wNumRadioLinesPrinted], a
cp 2
jr nz, .print
bccoord 1, 16
call PrintTextboxTextAt
jr .skip
.print
call PrintTextboxText
.skip
ld a, RADIO_SCROLL
ld [wCurRadioLine], a
ld a, 100
ld [wRadioTextDelay], a
ret
ReplacePeriodsWithSpaces: ; unreferenced
push hl
ld b, SCREEN_WIDTH * 2
.loop
ld a, [hl]
cp "."
jr nz, .next
ld [hl], " "
.next
inc hl
dec b
jr nz, .loop
pop hl
ret
RadioScroll:
ld hl, wRadioTextDelay
ld a, [hl]
and a
jr z, .proceed
dec [hl]
ret
.proceed
ld a, [wNextRadioLine]
ld [wCurRadioLine], a
ld a, [wNumRadioLinesPrinted]
cp 1
call nz, CopyBottomLineToTopLine
jp ClearBottomLine
OaksPKMNTalk1:
ld a, 5
ld [wOaksPKMNTalkSegmentCounter], a
call StartRadioStation
ld hl, OPT_IntroText1
ld a, OAKS_POKEMON_TALK_2
jp NextRadioLine
OaksPKMNTalk2:
ld hl, OPT_IntroText2
ld a, OAKS_POKEMON_TALK_3
jp NextRadioLine
OaksPKMNTalk3:
ld hl, OPT_IntroText3
ld a, OAKS_POKEMON_TALK_4
jp NextRadioLine
OaksPKMNTalk4:
; Choose a random route, and a random Pokemon from that route.
.sample
call Random
and %11111
cp (OaksPKMNTalkRoutes.End - OaksPKMNTalkRoutes) / 2
jr nc, .sample
ld hl, OaksPKMNTalkRoutes
ld c, a
ld b, 0
add hl, bc
add hl, bc
ld b, [hl]
inc hl
ld c, [hl]
; bc now contains the chosen map's group and number indices.
push bc
; Search the JohtoGrassWildMons array for the chosen map.
ld hl, JohtoGrassWildMons
.loop
ld a, BANK(JohtoGrassWildMons)
call GetFarByte
cp -1
jr z, .overflow
inc hl
cp b
jr nz, .next
ld a, BANK(JohtoGrassWildMons)
call GetFarByte
cp c
jr z, .done
.next
dec hl
ld de, GRASS_WILDDATA_LENGTH
add hl, de
jr .loop
.done
; Point hl to the list of morning Pokémon., skipping percentages
rept 4
inc hl
endr
; Generate a number, either 0, 1, or 2, to choose a time of day.
.loop2
call Random
maskbits NUM_DAYTIMES
cp DARKNESS_F
jr z, .loop2
ld bc, 2 * NUM_GRASSMON
call AddNTimes
.loop3
; Choose one of the middle three Pokemon.
call Random
maskbits NUM_GRASSMON
cp 2
jr c, .loop3
cp 5
jr nc, .loop3
ld e, a
ld d, 0
add hl, de
add hl, de
inc hl ; skip level
ld a, BANK(JohtoGrassWildMons)
call GetFarByte
ld [wNamedObjectIndex], a
ld [wCurPartySpecies], a
call GetPokemonName
ld hl, wStringBuffer1
ld de, wMonOrItemNameBuffer
ld bc, MON_NAME_LENGTH
call CopyBytes
; Now that we've chosen our wild Pokemon,
; let's recover the map index info and get its name.
pop bc
call GetWorldMapLocation
ld e, a
farcall GetLandmarkName
ld hl, OPT_OakText1
call CopyRadioTextToRAM
ld a, OAKS_POKEMON_TALK_5
jp PrintRadioLine
.overflow
pop bc
ld a, OAKS_POKEMON_TALK
jp PrintRadioLine
INCLUDE "data/radio/oaks_pkmn_talk_routes.asm"
OaksPKMNTalk5:
ld hl, OPT_OakText2
ld a, OAKS_POKEMON_TALK_6
jp NextRadioLine
OaksPKMNTalk6:
ld hl, OPT_OakText3
ld a, OAKS_POKEMON_TALK_7
jp NextRadioLine
OPT_IntroText1:
text_far _OPT_IntroText1
text_end
OPT_IntroText2:
text_far _OPT_IntroText2
text_end
OPT_IntroText3:
text_far _OPT_IntroText3
text_end
OPT_OakText1:
text_far _OPT_OakText1
text_end
OPT_OakText2:
text_far _OPT_OakText2
text_end
OPT_OakText3:
text_far _OPT_OakText3
text_end
OaksPKMNTalk7:
ld a, [wCurPartySpecies]
ld [wNamedObjectIndex], a
call GetPokemonName
ld hl, OPT_MaryText1
ld a, OAKS_POKEMON_TALK_8
jp NextRadioLine
OPT_MaryText1:
text_far _OPT_MaryText1
text_end
OaksPKMNTalk8:
; 0-15 are all valid indexes into .Adverbs,
; so no need for a retry loop
call Random
maskbits NUM_OAKS_POKEMON_TALK_ADVERBS
assert_power_of_2 NUM_OAKS_POKEMON_TALK_ADVERBS
ld e, a
ld d, 0
ld hl, .Adverbs
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
ld a, OAKS_POKEMON_TALK_9
jp NextRadioLine
.Adverbs:
table_width 2, OaksPKMNTalk8.Adverbs
dw .OPT_SweetAdorablyText
dw .OPT_WigglySlicklyText
dw .OPT_AptlyNamedText
dw .OPT_UndeniablyKindOfText
dw .OPT_UnbearablyText
dw .OPT_WowImpressivelyText
dw .OPT_AlmostPoisonouslyText
dw .OPT_SensuallyText
dw .OPT_MischievouslyText
dw .OPT_TopicallyText
dw .OPT_AddictivelyText
dw .OPT_LooksInWaterText
dw .OPT_EvolutionMustBeText
dw .OPT_ProvocativelyText
dw .OPT_FlippedOutText
dw .OPT_HeartMeltinglyText
assert_table_length NUM_OAKS_POKEMON_TALK_ADVERBS
.OPT_SweetAdorablyText:
text_far _OPT_SweetAdorablyText
text_end
.OPT_WigglySlicklyText:
text_far _OPT_WigglySlicklyText
text_end
.OPT_AptlyNamedText:
text_far _OPT_AptlyNamedText
text_end
.OPT_UndeniablyKindOfText:
text_far _OPT_UndeniablyKindOfText
text_end
.OPT_UnbearablyText:
text_far _OPT_UnbearablyText
text_end
.OPT_WowImpressivelyText:
text_far _OPT_WowImpressivelyText
text_end
.OPT_AlmostPoisonouslyText:
text_far _OPT_AlmostPoisonouslyText
text_end
.OPT_SensuallyText:
text_far _OPT_SensuallyText
text_end
.OPT_MischievouslyText:
text_far _OPT_MischievouslyText
text_end
.OPT_TopicallyText:
text_far _OPT_TopicallyText
text_end
.OPT_AddictivelyText:
text_far _OPT_AddictivelyText
text_end
.OPT_LooksInWaterText:
text_far _OPT_LooksInWaterText
text_end
.OPT_EvolutionMustBeText:
text_far _OPT_EvolutionMustBeText
text_end
.OPT_ProvocativelyText:
text_far _OPT_ProvocativelyText
text_end
.OPT_FlippedOutText:
text_far _OPT_FlippedOutText
text_end
.OPT_HeartMeltinglyText:
text_far _OPT_HeartMeltinglyText
text_end
OaksPKMNTalk9:
; 0-15 are all valid indexes into .Adjectives,
; so no need for a retry loop
call Random
maskbits NUM_OAKS_POKEMON_TALK_ADJECTIVES
assert_power_of_2 NUM_OAKS_POKEMON_TALK_ADJECTIVES
ld e, a
ld d, 0
ld hl, .Adjectives
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [wOaksPKMNTalkSegmentCounter]
dec a
ld [wOaksPKMNTalkSegmentCounter], a
ld a, OAKS_POKEMON_TALK_4
jr nz, .ok
ld a, 5
ld [wOaksPKMNTalkSegmentCounter], a
ld a, OAKS_POKEMON_TALK_10
.ok
jp NextRadioLine
.Adjectives:
table_width 2, OaksPKMNTalk9.Adjectives
dw .OPT_CuteText
dw .OPT_WeirdText
dw .OPT_PleasantText
dw .OPT_BoldSortOfText
dw .OPT_FrighteningText
dw .OPT_SuaveDebonairText
dw .OPT_PowerfulText
dw .OPT_ExcitingText
dw .OPT_GroovyText
dw .OPT_InspiringText
dw .OPT_FriendlyText
dw .OPT_HotHotHotText
dw .OPT_StimulatingText
dw .OPT_GuardedText
dw .OPT_LovelyText
dw .OPT_SpeedyText
assert_table_length NUM_OAKS_POKEMON_TALK_ADJECTIVES
.OPT_CuteText:
text_far _OPT_CuteText
text_end
.OPT_WeirdText:
text_far _OPT_WeirdText
text_end
.OPT_PleasantText:
text_far _OPT_PleasantText
text_end
.OPT_BoldSortOfText:
text_far _OPT_BoldSortOfText
text_end
.OPT_FrighteningText:
text_far _OPT_FrighteningText
text_end
.OPT_SuaveDebonairText:
text_far _OPT_SuaveDebonairText
text_end
.OPT_PowerfulText:
text_far _OPT_PowerfulText
text_end
.OPT_ExcitingText:
text_far _OPT_ExcitingText
text_end
.OPT_GroovyText:
text_far _OPT_GroovyText
text_end
.OPT_InspiringText:
text_far _OPT_InspiringText
text_end
.OPT_FriendlyText:
text_far _OPT_FriendlyText
text_end
.OPT_HotHotHotText:
text_far _OPT_HotHotHotText
text_end
.OPT_StimulatingText:
text_far _OPT_StimulatingText
text_end
.OPT_GuardedText:
text_far _OPT_GuardedText
text_end
.OPT_LovelyText:
text_far _OPT_LovelyText
text_end
.OPT_SpeedyText:
text_far _OPT_SpeedyText
text_end
OaksPKMNTalk10:
farcall RadioMusicRestartPokemonChannel
ld hl, OPT_RestartText
call PrintText
call WaitBGMap
ld hl, OPT_PokemonChannelText
call PrintText
ld a, OAKS_POKEMON_TALK_11
ld [wCurRadioLine], a
ld a, 100
ld [wRadioTextDelay], a
ret
OPT_PokemonChannelText:
text_far _OPT_PokemonChannelText
text_end
OPT_RestartText:
text_end
OaksPKMNTalk11:
ld hl, wRadioTextDelay
dec [hl]
ret nz
hlcoord 9, 14
ld de, .pokemon_string
ld a, OAKS_POKEMON_TALK_12
jp PlaceRadioString
.pokemon_string
db "#MON@"
OaksPKMNTalk12:
ld hl, wRadioTextDelay
dec [hl]
ret nz
hlcoord 1, 16
ld de, .pokemon_channel_string
ld a, OAKS_POKEMON_TALK_13
jp PlaceRadioString
.pokemon_channel_string
db "#MON Channel@"
OaksPKMNTalk13:
ld hl, wRadioTextDelay
dec [hl]
ret nz
hlcoord 12, 16
ld de, .terminator
ld a, OAKS_POKEMON_TALK_14
jp PlaceRadioString
.terminator
db "@"
OaksPKMNTalk14:
ld hl, wRadioTextDelay
dec [hl]
ret nz
ld de, MUSIC_POKEMON_TALK
callfar RadioMusicRestartDE
ld hl, .terminator
call PrintText
ld a, OAKS_POKEMON_TALK_4
ld [wNextRadioLine], a
xor a
ld [wNumRadioLinesPrinted], a
ld a, RADIO_SCROLL
ld [wCurRadioLine], a
ld a, 10
ld [wRadioTextDelay], a
ret
.terminator
db "@"
PlaceRadioString:
ld [wCurRadioLine], a
ld a, 100
ld [wRadioTextDelay], a
jp PlaceString
CopyBottomLineToTopLine:
hlcoord 0, 15
decoord 0, 13
ld bc, SCREEN_WIDTH * 2
jp CopyBytes
ClearBottomLine:
hlcoord 1, 15
ld bc, SCREEN_WIDTH - 2
ld a, " "
call ByteFill
hlcoord 1, 16
ld bc, SCREEN_WIDTH - 2
ld a, " "
jp ByteFill
PokedexShow_GetDexEntryBank:
push hl
push de
ld a, [wCurPartySpecies]
dec a
rlca
rlca
maskbits NUM_DEX_ENTRY_BANKS
ld hl, .PokedexEntryBanks
ld d, 0
ld e, a
add hl, de
ld a, [hl]
pop de
pop hl
ret
.PokedexEntryBanks:
db BANK("Pokedex Entries 001-064")
db BANK("Pokedex Entries 065-128")
db BANK("Pokedex Entries 129-192")
db BANK("Pokedex Entries 193-251")
PokedexShow1:
call StartRadioStation
.loop
call Random
cp NUM_POKEMON
jr nc, .loop
ld c, a
push bc
ld a, c
call CheckCaughtMon
pop bc
jr z, .loop
inc c
ld a, c
ld [wCurPartySpecies], a
ld [wNamedObjectIndex], a
call GetPokemonName
ld hl, PokedexShowText
ld a, POKEDEX_SHOW_2
jp NextRadioLine
PokedexShow2:
ld a, [wCurPartySpecies]
dec a
ld hl, PokedexDataPointerTable
ld c, a
ld b, 0
add hl, bc
add hl, bc
ld a, BANK(PokedexDataPointerTable)
call GetFarWord
call PokedexShow_GetDexEntryBank
push af
push hl
call CopyDexEntryPart1
dec hl
ld [hl], "<DONE>"
ld hl, wPokedexShowPointerAddr
call CopyRadioTextToRAM
pop hl
pop af
call CopyDexEntryPart2
rept 4
inc hl
endr
ld a, l
ld [wPokedexShowPointerAddr], a
ld a, h
ld [wPokedexShowPointerAddr + 1], a
ld a, POKEDEX_SHOW_3
jp PrintRadioLine
PokedexShow3:
call CopyDexEntry
ld a, POKEDEX_SHOW_4
jp PrintRadioLine
PokedexShow4:
call CopyDexEntry
ld a, POKEDEX_SHOW_5
jp PrintRadioLine
PokedexShow5:
call CopyDexEntry
ld a, POKEDEX_SHOW_6
jp PrintRadioLine
PokedexShow6:
call CopyDexEntry
ld a, POKEDEX_SHOW_7
jp PrintRadioLine
PokedexShow7:
call CopyDexEntry
ld a, POKEDEX_SHOW_8
jp PrintRadioLine
PokedexShow8:
call CopyDexEntry
ld a, POKEDEX_SHOW
jp PrintRadioLine
CopyDexEntry:
ld a, [wPokedexShowPointerAddr]
ld l, a
ld a, [wPokedexShowPointerAddr + 1]
ld h, a
ld a, [wPokedexShowPointerBank]
push af
push hl
call CopyDexEntryPart1
dec hl
ld [hl], "<DONE>"
ld hl, wPokedexShowPointerAddr
call CopyRadioTextToRAM
pop hl
pop af
call CopyDexEntryPart2
ret
CopyDexEntryPart1:
ld de, wPokedexShowPointerBank
ld bc, SCREEN_WIDTH - 1
call FarCopyBytes
ld hl, wPokedexShowPointerAddr
ld [hl], TX_START
inc hl
ld [hl], "<LINE>"
inc hl
.loop
ld a, [hli]
cp "@"
ret z
cp "<NEXT>"
ret z
cp "<DEXEND>"
ret z
jr .loop
CopyDexEntryPart2:
ld d, a
.loop
ld a, d
call GetFarByte
inc hl
cp "@"
jr z, .okay
cp "<NEXT>"
jr z, .okay
cp "<DEXEND>"
jr nz, .loop
.okay
ld a, l
ld [wPokedexShowPointerAddr], a
ld a, h
ld [wPokedexShowPointerAddr + 1], a
ld a, d
ld [wPokedexShowPointerBank], a
ret
PokedexShowText:
text_far _PokedexShowText
text_end
BenMonMusic1:
call StartPokemonMusicChannel
ld hl, BenIntroText1
ld a, POKEMON_MUSIC_2
jp NextRadioLine
BenMonMusic2:
ld hl, BenIntroText2
ld a, POKEMON_MUSIC_3
jp NextRadioLine
BenMonMusic3:
ld hl, BenIntroText3
ld a, POKEMON_MUSIC_4
jp NextRadioLine
FernMonMusic1:
call StartPokemonMusicChannel
ld hl, FernIntroText1
ld a, LETS_ALL_SING_2
jp NextRadioLine
FernMonMusic2:
ld hl, FernIntroText2
ld a, POKEMON_MUSIC_4
jp NextRadioLine
BenFernMusic4:
ld hl, BenFernText1
ld a, POKEMON_MUSIC_5
jp NextRadioLine
BenFernMusic5:
call GetWeekday
and 1
ld hl, BenFernText2A
jr z, .SunTueThurSun
ld hl, BenFernText2B
.SunTueThurSun:
ld a, POKEMON_MUSIC_6
jp NextRadioLine
BenFernMusic6:
call GetWeekday
and 1
ld hl, BenFernText3A
jr z, .SunTueThurSun
ld hl, BenFernText3B
.SunTueThurSun:
ld a, POKEMON_MUSIC_7
jp NextRadioLine
BenFernMusic7:
ret
StartPokemonMusicChannel:
call RadioTerminator
call PrintText
ld de, MUSIC_POKEMON_MARCH
call GetWeekday
and 1
jr z, .SunTueThurSun
ld de, MUSIC_POKEMON_LULLABY
.SunTueThurSun:
callfar RadioMusicRestartDE
ret
BenIntroText1:
text_far _BenIntroText1
text_end
BenIntroText2:
text_far _BenIntroText2
text_end
BenIntroText3:
text_far _BenIntroText3
text_end
FernIntroText1:
text_far _FernIntroText1
text_end
FernIntroText2:
text_far _FernIntroText2
text_end
BenFernText1:
text_far _BenFernText1
text_end
BenFernText2A:
text_far _BenFernText2A
text_end
BenFernText2B:
text_far _BenFernText2B
text_end
BenFernText3A:
text_far _BenFernText3A
text_end
BenFernText3B:
text_far _BenFernText3B
text_end
LuckyNumberShow1:
call StartRadioStation
callfar CheckLuckyNumberShowFlag
jr nc, .dontreset
callfar ResetLuckyNumberShowFlag
.dontreset
ld hl, LC_Text1
ld a, LUCKY_NUMBER_SHOW_2
jp NextRadioLine
LuckyNumberShow2:
ld hl, LC_Text2
ld a, LUCKY_NUMBER_SHOW_3
jp NextRadioLine
LuckyNumberShow3:
ld hl, LC_Text3
ld a, LUCKY_NUMBER_SHOW_4
jp NextRadioLine
LuckyNumberShow4:
ld hl, LC_Text4
ld a, LUCKY_NUMBER_SHOW_5
jp NextRadioLine
LuckyNumberShow5:
ld hl, LC_Text5
ld a, LUCKY_NUMBER_SHOW_6
jp NextRadioLine
LuckyNumberShow6:
ld hl, LC_Text6
ld a, LUCKY_NUMBER_SHOW_7
jp NextRadioLine
LuckyNumberShow7:
ld hl, LC_Text7
ld a, LUCKY_NUMBER_SHOW_8
jp NextRadioLine
LuckyNumberShow8:
ld hl, wStringBuffer1
ld de, wLuckyIDNumber
lb bc, PRINTNUM_LEADINGZEROS | 2, 5
call PrintNum
ld a, "@"
ld [wStringBuffer1 + 5], a
ld hl, LC_Text8
ld a, LUCKY_NUMBER_SHOW_9
jp NextRadioLine
LuckyNumberShow9:
ld hl, LC_Text9
ld a, LUCKY_NUMBER_SHOW_10
jp NextRadioLine
LuckyNumberShow10:
ld hl, LC_Text7
ld a, LUCKY_NUMBER_SHOW_11
jp NextRadioLine
LuckyNumberShow11:
ld hl, LC_Text8
ld a, LUCKY_NUMBER_SHOW_12
jp NextRadioLine
LuckyNumberShow12:
ld hl, LC_Text10
ld a, LUCKY_NUMBER_SHOW_13
jp NextRadioLine
LuckyNumberShow13:
ld hl, LC_Text11
call Random
and a
ld a, LUCKY_CHANNEL
jr nz, .okay
ld a, LUCKY_NUMBER_SHOW_14
.okay
jp NextRadioLine
LuckyNumberShow14:
ld hl, LC_DragText1
ld a, LUCKY_NUMBER_SHOW_15