-
Notifications
You must be signed in to change notification settings - Fork 818
/
text.asm
1060 lines (932 loc) · 16 KB
/
text.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
ClearBox::
; Fill a c*b box at hl with blank tiles.
ld a, " "
; fallthrough
FillBoxWithByte::
.row
push bc
push hl
.col
ld [hli], a
dec c
jr nz, .col
pop hl
ld bc, SCREEN_WIDTH
add hl, bc
pop bc
dec b
jr nz, .row
ret
ClearTilemap::
; Fill wTilemap with blank tiles.
hlcoord 0, 0
ld a, " "
ld bc, wTilemapEnd - wTilemap
call ByteFill
; Update the BG Map.
ldh a, [rLCDC]
bit rLCDC_ENABLE, a
ret z
jp WaitBGMap
ClearScreen::
ld a, PAL_BG_TEXT
hlcoord 0, 0, wAttrmap
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
call ByteFill
jr ClearTilemap
Textbox::
; Draw a text box at hl with room for b lines of c characters each.
; Places a border around the textbox, then switches the palette to the
; text black-and-white scheme.
push bc
push hl
call TextboxBorder
pop hl
pop bc
jr TextboxPalette
TextboxBorder::
; Top
push hl
ld a, "┌"
ld [hli], a
inc a ; "─"
call .PlaceChars
inc a ; "┐"
ld [hl], a
pop hl
; Middle
ld de, SCREEN_WIDTH
add hl, de
.row
push hl
ld a, "│"
ld [hli], a
ld a, " "
call .PlaceChars
ld [hl], "│"
pop hl
ld de, SCREEN_WIDTH
add hl, de
dec b
jr nz, .row
; Bottom
ld a, "└"
ld [hli], a
ld a, "─"
call .PlaceChars
ld [hl], "┘"
ret
.PlaceChars:
; Place char a c times.
ld d, c
.loop
ld [hli], a
dec d
jr nz, .loop
ret
TextboxPalette::
; Fill text box width c height b at hl with pal 7
ld de, wAttrmap - wTilemap
add hl, de
inc b
inc b
inc c
inc c
ld a, PAL_BG_TEXT
.col
push bc
push hl
.row
ld [hli], a
dec c
jr nz, .row
pop hl
ld de, SCREEN_WIDTH
add hl, de
pop bc
dec b
jr nz, .col
ret
SpeechTextbox::
; Standard textbox.
hlcoord TEXTBOX_X, TEXTBOX_Y
ld b, TEXTBOX_INNERH
ld c, TEXTBOX_INNERW
jp Textbox
GameFreakText:: ; unreferenced
text "ゲームフりーク!" ; "GAMEFREAK!"
done
RadioTerminator::
ld hl, .stop
ret
.stop:
text_end
PrintText::
call SetUpTextbox
; fallthrough
BuenaPrintText::
push hl
hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY
lb bc, TEXTBOX_INNERH - 1, TEXTBOX_INNERW
call ClearBox
pop hl
; fallthrough
PrintTextboxText::
bccoord TEXTBOX_INNERX, TEXTBOX_INNERY
call PlaceHLTextAtBC
ret
SetUpTextbox::
push hl
call SpeechTextbox
call UpdateSprites
call ApplyTilemap
pop hl
ret
PlaceString::
push hl
; fallthrough
PlaceNextChar::
ld a, [de]
cp "@"
jr nz, CheckDict
ld b, h
ld c, l
pop hl
ret
DummyChar:: ; unreferenced
pop de
; fallthrough
NextChar::
inc de
jp PlaceNextChar
CheckDict::
MACRO dict
assert CHARLEN(\1) == 1
if \1 == 0
and a
else
cp \1
endc
if ISCONST(\2)
; Replace a character with another one
jr nz, .not\@
ld a, \2
.not\@:
elif !STRCMP(STRSUB("\2", 1, 1), ".")
; Locals can use a short jump
jr z, \2
else
jp z, \2
endc
ENDM
dict "<MOBILE>", MobileScriptChar
dict "<LINE>", LineChar
dict "<NEXT>", NextLineChar
dict "<CR>", CarriageReturnChar
dict "<NULL>", NullChar
dict "<SCROLL>", _ContTextNoPause
dict "<_CONT>", _ContText
dict "<PARA>", Paragraph
dict "<MOM>", PrintMomsName
dict "<PLAYER>", PrintPlayerName
dict "<RIVAL>", PrintRivalName
dict "<ROUTE>", PlaceJPRoute
dict "<WATASHI>", PlaceWatashi
dict "<KOKO_WA>", PlaceKokoWa
dict "<RED>", PrintRedsName
dict "<GREEN>", PrintGreensName
dict "#", PlacePOKe
dict "<PC>", PCChar
dict "<ROCKET>", RocketChar
dict "<TM>", TMChar
dict "<TRAINER>", TrainerChar
dict "<KOUGEKI>", PlaceKougeki
dict "<LF>", LineFeedChar
dict "<CONT>", ContText
dict "<……>", SixDotsChar
dict "<DONE>", DoneText
dict "<PROMPT>", PromptText
dict "<PKMN>", PlacePKMN
dict "<POKE>", PlacePOKE
dict "<WBR>", NextChar
dict "<BSP>", " "
dict "<DEXEND>", PlaceDexEnd
dict "<TARGET>", PlaceMoveTargetsName
dict "<USER>", PlaceMoveUsersName
dict "<ENEMY>", PlaceEnemysName
dict "<PLAY_G>", PlaceGenderedPlayerName
dict "゚", .place ; should be .diacritic
dict "゙", .place ; should be .diacritic
jr .not_diacritic
.diacritic ; unreferenced
ld b, a
call Diacritic
jp NextChar
.not_diacritic
cp FIRST_REGULAR_TEXT_CHAR
jr nc, .place
; dakuten or handakuten
cp "パ"
jr nc, .handakuten
; dakuten
cp FIRST_HIRAGANA_DAKUTEN_CHAR
jr nc, .hiragana_dakuten
; katakana dakuten
add "カ" - "ガ"
jr .place_dakuten
.hiragana_dakuten
add "か" - "が"
.place_dakuten
ld b, "゙" ; dakuten
call Diacritic
jr .place
.handakuten
cp "ぱ"
jr nc, .hiragana_handakuten
; katakana handakuten
add "ハ" - "パ"
jr .place_handakuten
.hiragana_handakuten
add "は" - "ぱ"
.place_handakuten
ld b, "゚" ; handakuten
call Diacritic
.place
ld [hli], a
call PrintLetterDelay
jp NextChar
MobileScriptChar::
ld c, l
ld b, h
farcall RunMobileScript
jp PlaceNextChar
MACRO print_name
push de
ld de, \1
jp PlaceCommandCharacter
ENDM
PrintMomsName: print_name wMomsName
PrintPlayerName: print_name wPlayerName
PrintRivalName: print_name wRivalName
PrintRedsName: print_name wRedsName
PrintGreensName: print_name wGreensName
TrainerChar: print_name TrainerCharText
TMChar: print_name TMCharText
PCChar: print_name PCCharText
RocketChar: print_name RocketCharText
PlacePOKe: print_name PlacePOKeText
PlaceKougeki: print_name KougekiText
SixDotsChar: print_name SixDotsCharText
PlacePKMN: print_name PlacePKMNText
PlacePOKE: print_name PlacePOKEText
PlaceJPRoute: print_name PlaceJPRouteText
PlaceWatashi: print_name PlaceWatashiText
PlaceKokoWa: print_name PlaceKokoWaText
PlaceMoveTargetsName::
ldh a, [hBattleTurn]
xor 1
jr PlaceBattlersName
PlaceMoveUsersName::
ldh a, [hBattleTurn]
; fallthrough
PlaceBattlersName:
push de
and a
jr nz, .enemy
ld de, wBattleMonNickname
jr PlaceCommandCharacter
.enemy
ld de, EnemyText
call PlaceString
ld h, b
ld l, c
ld de, wEnemyMonNickname
jr PlaceCommandCharacter
PlaceEnemysName::
push de
ld a, [wLinkMode]
and a
jr nz, .linkbattle
ld a, [wTrainerClass]
cp RIVAL1
jr z, .rival
cp RIVAL2
jr z, .rival
ld de, wOTClassName
call PlaceString
ld h, b
ld l, c
ld de, String_Space
call PlaceString
push bc
callfar Battle_GetTrainerName
pop hl
ld de, wStringBuffer1
jr PlaceCommandCharacter
.rival
ld de, wRivalName
jr PlaceCommandCharacter
.linkbattle
ld de, wOTClassName
jr PlaceCommandCharacter
PlaceGenderedPlayerName::
push de
ld de, wPlayerName
call PlaceString
ld h, b
ld l, c
ld a, [wPlayerGender]
bit PLAYERGENDER_FEMALE_F, a
ld de, KunSuffixText
jr z, PlaceCommandCharacter
ld de, ChanSuffixText
jr PlaceCommandCharacter
PlaceCommandCharacter::
call PlaceString
ld h, b
ld l, c
pop de
jp NextChar
TMCharText:: db "TM@"
TrainerCharText:: db "TRAINER@"
PCCharText:: db "PC@"
RocketCharText:: db "ROCKET@"
PlacePOKeText:: db "POKé@"
KougekiText:: db "こうげき@"
SixDotsCharText:: db "……@"
EnemyText:: db "Enemy @"
PlacePKMNText:: db "<PK><MN>@"
PlacePOKEText:: db "<PO><KE>@"
String_Space:: db " @"
; These strings have been dummied out.
PlaceJPRouteText::
PlaceWatashiText::
PlaceKokoWaText:: db "@"
KunSuffixText:: db "@"
ChanSuffixText:: db "@"
NextLineChar::
pop hl
ld bc, SCREEN_WIDTH * 2
add hl, bc
push hl
jp NextChar
LineFeedChar::
pop hl
ld bc, SCREEN_WIDTH
add hl, bc
push hl
jp NextChar
CarriageReturnChar::
pop hl
push de
ld bc, -wTilemap + $10000
add hl, bc
ld de, -SCREEN_WIDTH
ld c, 1
.loop
ld a, h
and a
jr nz, .next
ld a, l
cp SCREEN_WIDTH
jr c, .done
.next
add hl, de
inc c
jr .loop
.done
hlcoord 0, 0
ld de, SCREEN_WIDTH
ld a, c
.loop2
and a
jr z, .done2
add hl, de
dec a
jr .loop2
.done2
pop de
inc de
ld a, [de]
ld c, a
ld b, 0
add hl, bc
push hl
jp NextChar
LineChar::
pop hl
hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY + 2
push hl
jp NextChar
Paragraph::
push de
ld a, [wLinkMode]
cp LINK_COLOSSEUM
jr z, .linkbattle
cp LINK_MOBILE
jr z, .linkbattle
call LoadBlinkingCursor
.linkbattle
call Text_WaitBGMap
call PromptButton
hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY
lb bc, TEXTBOX_INNERH - 1, TEXTBOX_INNERW
call ClearBox
call UnloadBlinkingCursor
ld c, 20
call DelayFrames
hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY
pop de
jp NextChar
_ContText::
ld a, [wLinkMode]
or a
jr nz, .communication
call LoadBlinkingCursor
.communication
call Text_WaitBGMap
push de
call PromptButton
pop de
ld a, [wLinkMode]
or a
call z, UnloadBlinkingCursor
; fallthrough
_ContTextNoPause::
push de
call TextScroll
call TextScroll
hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY + 2
pop de
jp NextChar
ContText::
push de
ld de, .cont
ld b, h
ld c, l
call PlaceString
ld h, b
ld l, c
pop de
jp NextChar
.cont: db "<_CONT>@"
PlaceDexEnd::
; Ends a Pokédex entry in Gen 1.
; Dex entries are now regular strings.
ld [hl], "."
pop hl
ret
PromptText::
ld a, [wLinkMode]
cp LINK_COLOSSEUM
jr z, .ok
cp LINK_MOBILE
jr z, .ok
call LoadBlinkingCursor
.ok
call Text_WaitBGMap
call PromptButton
ld a, [wLinkMode]
cp LINK_COLOSSEUM
jr z, DoneText
cp LINK_MOBILE
jr z, DoneText
call UnloadBlinkingCursor
DoneText::
pop hl
ld de, .stop
dec de
ret
.stop:
text_end
NullChar::
ld a, "?"
ld [hli], a
call PrintLetterDelay
jp NextChar
TextScroll::
hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY
decoord TEXTBOX_INNERX, TEXTBOX_INNERY - 1
ld a, TEXTBOX_INNERH - 1
.col
push af
ld c, TEXTBOX_INNERW
.row
ld a, [hli]
ld [de], a
inc de
dec c
jr nz, .row
inc de
inc de
inc hl
inc hl
pop af
dec a
jr nz, .col
hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY + 2
ld a, " "
ld bc, TEXTBOX_INNERW
call ByteFill
ld c, 5
call DelayFrames
ret
Text_WaitBGMap::
push bc
ldh a, [hOAMUpdate]
push af
ld a, 1
ldh [hOAMUpdate], a
call WaitBGMap
pop af
ldh [hOAMUpdate], a
pop bc
ret
Diacritic::
ret
LoadBlinkingCursor::
ld a, "▼"
ldcoord_a 18, 17
ret
UnloadBlinkingCursor::
lda_coord 17, 17
ldcoord_a 18, 17
ret
PlaceFarString::
ld b, a
ldh a, [hROMBank]
push af
ld a, b
rst Bankswitch
call PlaceString
pop af
rst Bankswitch
ret
PokeFluteTerminator::
ld hl, .stop
ret
.stop:
text_end
PlaceHLTextAtBC::
ld a, [wTextboxFlags]
push af
set NO_TEXT_DELAY_F, a
ld [wTextboxFlags], a
call DoTextUntilTerminator
pop af
ld [wTextboxFlags], a
ret
DoTextUntilTerminator::
ld a, [hli]
cp TX_END
ret z
call .TextCommand
jr DoTextUntilTerminator
.TextCommand:
push hl
push bc
ld c, a
ld b, 0
ld hl, TextCommands
add hl, bc
add hl, bc
ld e, [hl]
inc hl
ld d, [hl]
pop bc
pop hl
; jp de
push de
ret
TextCommands::
; entries correspond to TX_* constants (see macros/scripts/text.asm)
table_width 2, TextCommands
dw TextCommand_START ; TX_START
dw TextCommand_RAM ; TX_RAM
dw TextCommand_BCD ; TX_BCD
dw TextCommand_MOVE ; TX_MOVE
dw TextCommand_BOX ; TX_BOX
dw TextCommand_LOW ; TX_LOW
dw TextCommand_PROMPT_BUTTON ; TX_PROMPT_BUTTON
dw TextCommand_SCROLL ; TX_SCROLL
dw TextCommand_START_ASM ; TX_START_ASM
dw TextCommand_DECIMAL ; TX_DECIMAL
dw TextCommand_PAUSE ; TX_PAUSE
dw TextCommand_SOUND ; TX_SOUND_DEX_FANFARE_50_79
dw TextCommand_DOTS ; TX_DOTS
dw TextCommand_WAIT_BUTTON ; TX_WAIT_BUTTON
dw TextCommand_SOUND ; TX_SOUND_DEX_FANFARE_20_49
dw TextCommand_SOUND ; TX_SOUND_ITEM
dw TextCommand_SOUND ; TX_SOUND_CAUGHT_MON
dw TextCommand_SOUND ; TX_SOUND_DEX_FANFARE_80_109
dw TextCommand_SOUND ; TX_SOUND_FANFARE
dw TextCommand_SOUND ; TX_SOUND_SLOT_MACHINE_START
dw TextCommand_STRINGBUFFER ; TX_STRINGBUFFER
dw TextCommand_DAY ; TX_DAY
dw TextCommand_FAR ; TX_FAR
assert_table_length NUM_TEXT_CMDS
TextCommand_START::
; write text until "@"
ld d, h
ld e, l
ld h, b
ld l, c
call PlaceString
ld h, d
ld l, e
inc hl
ret
TextCommand_RAM::
; write text from a ram address (little endian)
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
push hl
ld h, b
ld l, c
call PlaceString
pop hl
ret
TextCommand_FAR::
; write text from a different bank (little endian)
ldh a, [hROMBank]
push af
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
ld a, [hli]
ldh [hROMBank], a
ld [MBC3RomBank], a
push hl
ld h, d
ld l, e
call DoTextUntilTerminator
pop hl
pop af
ldh [hROMBank], a
ld [MBC3RomBank], a
ret
TextCommand_BCD::
; write bcd from address, typically ram
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
ld a, [hli]
push hl
ld h, b
ld l, c
ld c, a
call PrintBCDNumber
ld b, h
ld c, l
pop hl
ret
TextCommand_MOVE::
; move to a new tile
ld a, [hli]
ld [wMenuScrollPosition + 2], a
ld c, a
ld a, [hli]
ld [wMenuScrollPosition + 2 + 1], a
ld b, a
ret
TextCommand_BOX::
; draw a box (height, width)
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
ld a, [hli]
ld b, a
ld a, [hli]
ld c, a
push hl
ld h, d
ld l, e
call Textbox
pop hl
ret
TextCommand_LOW::
; write text at (1,16)
bccoord TEXTBOX_INNERX, TEXTBOX_INNERY + 2
ret
TextCommand_PROMPT_BUTTON::
; wait for button press; show arrow
ld a, [wLinkMode]
cp LINK_COLOSSEUM
jp z, TextCommand_WAIT_BUTTON
cp LINK_MOBILE
jp z, TextCommand_WAIT_BUTTON
push hl
call LoadBlinkingCursor
push bc
call PromptButton
pop bc
call UnloadBlinkingCursor
pop hl
ret
TextCommand_SCROLL::
; pushes text up two lines and sets the BC cursor to the border tile
; below the first character column of the text box.
push hl
call UnloadBlinkingCursor
call TextScroll
call TextScroll
pop hl
bccoord TEXTBOX_INNERX, TEXTBOX_INNERY + 2
ret
TextCommand_START_ASM::
; run assembly code
bit 7, h
jr nz, .not_rom
jp hl
.not_rom
ld a, TX_END
ld [hl], a
ret
TextCommand_DECIMAL::
; print a decimal number
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
ld a, [hli]
push hl
ld h, b
ld l, c
ld b, a
and $f
ld c, a
ld a, b
and $f0
swap a
set PRINTNUM_LEFTALIGN_F, a
ld b, a
call PrintNum
ld b, h
ld c, l
pop hl
ret
TextCommand_PAUSE::
; wait for button press or 30 frames
push hl
push bc
call GetJoypad
ldh a, [hJoyDown]
and A_BUTTON | B_BUTTON
jr nz, .done
ld c, 30
call DelayFrames
.done
pop bc
pop hl
ret
TextCommand_SOUND::
; play a sound effect from TextSFX
push bc
dec hl
ld a, [hli]
ld b, a
push hl
ld hl, TextSFX
.loop
ld a, [hli]
cp -1
jr z, .done
cp b
jr z, .play
inc hl
inc hl
jr .loop
.play
push de
ld e, [hl]
inc hl
ld d, [hl]
call PlaySFX
call WaitSFX
pop de
.done
pop hl
pop bc
ret
TextCommand_CRY:: ; unreferenced
; play a pokemon cry
push de
ld e, [hl]
inc hl
ld d, [hl]
call PlayMonCry
pop de
pop hl
pop bc
ret
TextSFX::
dbw TX_SOUND_DEX_FANFARE_50_79, SFX_DEX_FANFARE_50_79
dbw TX_SOUND_FANFARE, SFX_FANFARE
dbw TX_SOUND_DEX_FANFARE_20_49, SFX_DEX_FANFARE_20_49
dbw TX_SOUND_ITEM, SFX_ITEM
dbw TX_SOUND_CAUGHT_MON, SFX_CAUGHT_MON
dbw TX_SOUND_DEX_FANFARE_80_109, SFX_DEX_FANFARE_80_109
dbw TX_SOUND_SLOT_MACHINE_START, SFX_SLOT_MACHINE_START
db -1
TextCommand_DOTS::
; wait for button press or 30 frames while printing "…"s
ld a, [hli]
ld d, a
push hl
ld h, b
ld l, c
.loop
push de
ld a, "…"
ld [hli], a
call GetJoypad
ldh a, [hJoyDown]
and A_BUTTON | B_BUTTON
jr nz, .next
ld c, 10
call DelayFrames
.next
pop de
dec d
jr nz, .loop
ld b, h
ld c, l
pop hl
ret
TextCommand_WAIT_BUTTON::
; wait for button press; don't show arrow
push hl
push bc
call PromptButton
pop bc
pop hl
ret
TextCommand_STRINGBUFFER::
; Print a string from one of the following:
; 0: wStringBuffer3
; 1: wStringBuffer4
; 2: wStringBuffer5
; 3: wStringBuffer2
; 4: wStringBuffer1