2018-06-24 07:09:41 -07:00
|
|
|
ClearBox::
|
2013-08-20 12:58:08 -07:00
|
|
|
; Fill a c*b box at hl with blank tiles.
|
|
|
|
ld a, " "
|
2017-12-26 19:36:01 -08:00
|
|
|
; fallthrough
|
2014-08-14 23:50:39 -07:00
|
|
|
|
2015-10-13 09:46:40 -07:00
|
|
|
FillBoxWithByte::
|
2015-10-16 10:35:43 -07:00
|
|
|
.row
|
2013-08-20 12:58:08 -07:00
|
|
|
push bc
|
|
|
|
push hl
|
2015-10-16 10:35:43 -07:00
|
|
|
.col
|
2013-08-20 12:58:08 -07:00
|
|
|
ld [hli], a
|
|
|
|
dec c
|
2015-10-16 10:35:43 -07:00
|
|
|
jr nz, .col
|
2013-08-20 12:58:08 -07:00
|
|
|
pop hl
|
2014-08-14 23:50:39 -07:00
|
|
|
ld bc, SCREEN_WIDTH
|
2013-08-20 12:58:08 -07:00
|
|
|
add hl, bc
|
|
|
|
pop bc
|
|
|
|
dec b
|
2015-10-16 10:35:43 -07:00
|
|
|
jr nz, .row
|
2013-08-20 12:58:08 -07:00
|
|
|
ret
|
|
|
|
|
2020-02-13 09:30:13 -08:00
|
|
|
ClearTilemap::
|
|
|
|
; Fill wTilemap with blank tiles.
|
2013-08-20 12:58:08 -07:00
|
|
|
|
2015-07-22 12:57:02 -07:00
|
|
|
hlcoord 0, 0
|
2013-08-20 12:58:08 -07:00
|
|
|
ld a, " "
|
2020-02-13 09:30:13 -08:00
|
|
|
ld bc, wTilemapEnd - wTilemap
|
2013-08-20 12:58:08 -07:00
|
|
|
call ByteFill
|
2016-04-10 11:42:14 -07:00
|
|
|
|
2014-08-14 23:50:39 -07:00
|
|
|
; Update the BG Map.
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [rLCDC]
|
2017-12-29 09:53:21 -08:00
|
|
|
bit rLCDC_ENABLE, a
|
2013-08-20 12:58:08 -07:00
|
|
|
ret z
|
|
|
|
jp WaitBGMap
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
ClearScreen::
|
2017-12-13 21:36:24 -08:00
|
|
|
ld a, PAL_BG_TEXT
|
2020-02-13 09:30:13 -08:00
|
|
|
hlcoord 0, 0, wAttrmap
|
2014-08-14 23:50:39 -07:00
|
|
|
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
|
2013-08-20 12:58:08 -07:00
|
|
|
call ByteFill
|
2020-02-13 09:30:13 -08:00
|
|
|
jr ClearTilemap
|
2013-08-20 12:58:08 -07:00
|
|
|
|
2019-04-08 05:15:10 -07:00
|
|
|
Textbox::
|
2018-01-10 15:10:01 -08:00
|
|
|
; 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
|
2015-10-16 10:35:43 -07:00
|
|
|
; text black-and-white scheme.
|
2013-08-20 12:58:08 -07:00
|
|
|
push bc
|
|
|
|
push hl
|
2019-04-08 05:15:10 -07:00
|
|
|
call TextboxBorder
|
2013-08-20 12:58:08 -07:00
|
|
|
pop hl
|
|
|
|
pop bc
|
2019-04-08 05:15:10 -07:00
|
|
|
jr TextboxPalette
|
2013-08-20 12:58:08 -07:00
|
|
|
|
2019-04-08 05:15:10 -07:00
|
|
|
TextboxBorder::
|
2014-08-14 23:50:39 -07:00
|
|
|
; Top
|
2013-08-20 12:58:08 -07:00
|
|
|
push hl
|
|
|
|
ld a, "┌"
|
|
|
|
ld [hli], a
|
|
|
|
inc a ; "─"
|
2014-08-14 23:50:39 -07:00
|
|
|
call .PlaceChars
|
2013-08-20 12:58:08 -07:00
|
|
|
inc a ; "┐"
|
|
|
|
ld [hl], a
|
|
|
|
pop hl
|
2014-08-14 23:50:39 -07:00
|
|
|
|
|
|
|
; Middle
|
|
|
|
ld de, SCREEN_WIDTH
|
2013-08-20 12:58:08 -07:00
|
|
|
add hl, de
|
2014-08-14 23:50:39 -07:00
|
|
|
.row
|
2013-08-20 12:58:08 -07:00
|
|
|
push hl
|
|
|
|
ld a, "│"
|
|
|
|
ld [hli], a
|
|
|
|
ld a, " "
|
2014-08-14 23:50:39 -07:00
|
|
|
call .PlaceChars
|
2013-08-20 12:58:08 -07:00
|
|
|
ld [hl], "│"
|
|
|
|
pop hl
|
2014-08-14 23:50:39 -07:00
|
|
|
|
|
|
|
ld de, SCREEN_WIDTH
|
2013-08-20 12:58:08 -07:00
|
|
|
add hl, de
|
|
|
|
dec b
|
2014-08-14 23:50:39 -07:00
|
|
|
jr nz, .row
|
2013-08-20 12:58:08 -07:00
|
|
|
|
2014-08-14 23:50:39 -07:00
|
|
|
; Bottom
|
2013-08-20 12:58:08 -07:00
|
|
|
ld a, "└"
|
|
|
|
ld [hli], a
|
|
|
|
ld a, "─"
|
2014-08-14 23:50:39 -07:00
|
|
|
call .PlaceChars
|
2013-08-20 12:58:08 -07:00
|
|
|
ld [hl], "┘"
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.PlaceChars:
|
2014-08-14 23:50:39 -07:00
|
|
|
; Place char a c times.
|
|
|
|
ld d, c
|
2013-08-20 12:58:08 -07:00
|
|
|
.loop
|
2014-08-14 23:50:39 -07:00
|
|
|
ld [hli], a
|
2013-08-20 12:58:08 -07:00
|
|
|
dec d
|
|
|
|
jr nz, .loop
|
|
|
|
ret
|
|
|
|
|
2019-04-08 05:15:10 -07:00
|
|
|
TextboxPalette::
|
2013-08-20 12:58:08 -07:00
|
|
|
; Fill text box width c height b at hl with pal 7
|
2020-02-13 09:30:13 -08:00
|
|
|
ld de, wAttrmap - wTilemap
|
2013-08-20 12:58:08 -07:00
|
|
|
add hl, de
|
|
|
|
inc b
|
2016-05-04 08:46:23 -07:00
|
|
|
inc b
|
|
|
|
inc c
|
2013-08-20 12:58:08 -07:00
|
|
|
inc c
|
2017-12-13 21:36:24 -08:00
|
|
|
ld a, PAL_BG_TEXT
|
2014-08-14 23:50:39 -07:00
|
|
|
.col
|
2013-08-20 12:58:08 -07:00
|
|
|
push bc
|
|
|
|
push hl
|
2014-08-14 23:50:39 -07:00
|
|
|
.row
|
2013-08-20 12:58:08 -07:00
|
|
|
ld [hli], a
|
|
|
|
dec c
|
2014-08-14 23:50:39 -07:00
|
|
|
jr nz, .row
|
2013-08-20 12:58:08 -07:00
|
|
|
pop hl
|
2014-08-14 23:50:39 -07:00
|
|
|
ld de, SCREEN_WIDTH
|
2013-08-20 12:58:08 -07:00
|
|
|
add hl, de
|
|
|
|
pop bc
|
|
|
|
dec b
|
2014-08-14 23:50:39 -07:00
|
|
|
jr nz, .col
|
2013-08-20 12:58:08 -07:00
|
|
|
ret
|
|
|
|
|
2019-04-08 05:15:10 -07:00
|
|
|
SpeechTextbox::
|
2013-08-20 12:58:08 -07:00
|
|
|
; Standard textbox.
|
2014-08-14 23:50:39 -07:00
|
|
|
hlcoord TEXTBOX_X, TEXTBOX_Y
|
|
|
|
ld b, TEXTBOX_INNERH
|
|
|
|
ld c, TEXTBOX_INNERW
|
2019-04-08 05:15:10 -07:00
|
|
|
jp Textbox
|
2013-08-20 12:58:08 -07:00
|
|
|
|
2020-06-21 13:27:43 -07:00
|
|
|
GameFreakText:: ; unreferenced
|
|
|
|
text "ゲームフりーク!" ; "GAMEFREAK!"
|
2014-08-14 23:50:39 -07:00
|
|
|
done
|
2013-08-20 12:58:08 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
RadioTerminator::
|
2014-08-14 23:50:39 -07:00
|
|
|
ld hl, .stop
|
2013-08-20 12:58:08 -07:00
|
|
|
ret
|
2018-11-17 10:33:03 -08:00
|
|
|
|
|
|
|
.stop:
|
|
|
|
text_end
|
2013-08-20 12:58:08 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
PrintText::
|
2019-04-08 05:15:10 -07:00
|
|
|
call SetUpTextbox
|
2018-06-24 07:09:41 -07:00
|
|
|
BuenaPrintText::
|
2013-08-20 12:58:08 -07:00
|
|
|
push hl
|
2014-08-14 23:50:39 -07:00
|
|
|
hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY
|
|
|
|
lb bc, TEXTBOX_INNERH - 1, TEXTBOX_INNERW
|
2013-08-20 12:58:08 -07:00
|
|
|
call ClearBox
|
|
|
|
pop hl
|
|
|
|
|
2019-04-08 05:15:10 -07:00
|
|
|
PrintTextboxText::
|
2014-08-14 23:50:39 -07:00
|
|
|
bccoord TEXTBOX_INNERX, TEXTBOX_INNERY
|
2016-05-08 11:11:24 -07:00
|
|
|
call PlaceHLTextAtBC
|
2013-08-20 12:58:08 -07:00
|
|
|
ret
|
|
|
|
|
2019-04-08 05:15:10 -07:00
|
|
|
SetUpTextbox::
|
2013-08-20 12:58:08 -07:00
|
|
|
push hl
|
2019-04-08 05:15:10 -07:00
|
|
|
call SpeechTextbox
|
2015-07-22 12:57:02 -07:00
|
|
|
call UpdateSprites
|
2015-11-25 07:16:29 -08:00
|
|
|
call ApplyTilemap
|
2013-08-20 12:58:08 -07:00
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
PlaceString::
|
2013-08-20 12:58:08 -07:00
|
|
|
push hl
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
PlaceNextChar::
|
2013-08-20 12:58:08 -07:00
|
|
|
ld a, [de]
|
|
|
|
cp "@"
|
|
|
|
jr nz, CheckDict
|
|
|
|
ld b, h
|
|
|
|
ld c, l
|
|
|
|
pop hl
|
|
|
|
ret
|
2020-05-05 06:55:19 -07:00
|
|
|
|
|
|
|
pop de ; unused
|
2013-08-20 12:58:08 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
NextChar::
|
2013-08-20 12:58:08 -07:00
|
|
|
inc de
|
|
|
|
jp PlaceNextChar
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
CheckDict::
|
2017-12-28 04:23:44 -08:00
|
|
|
dict: MACRO
|
2018-07-17 14:08:04 -07:00
|
|
|
if \1 == "<NULL>"
|
2013-08-20 12:58:08 -07:00
|
|
|
and a
|
2014-08-14 23:50:39 -07:00
|
|
|
else
|
|
|
|
cp \1
|
|
|
|
endc
|
2015-10-04 11:14:51 -07:00
|
|
|
|
2018-07-17 14:08:04 -07:00
|
|
|
if STRSUB("\2", 1, 1) == "\""
|
|
|
|
; Replace a character with another one
|
2016-03-02 21:07:17 -08:00
|
|
|
jr nz, ._\@
|
2015-10-04 11:14:51 -07:00
|
|
|
ld a, \2
|
2016-03-02 21:07:17 -08:00
|
|
|
._\@:
|
2018-07-17 14:08:04 -07:00
|
|
|
elif STRSUB("\2", 1, 1) == "."
|
|
|
|
; Locals can use a short jump
|
|
|
|
jr z, \2
|
|
|
|
else
|
|
|
|
jp z, \2
|
|
|
|
endc
|
2017-12-28 13:31:16 -08:00
|
|
|
ENDM
|
2015-10-04 11:14:51 -07:00
|
|
|
|
2018-07-17 14:08:04 -07:00
|
|
|
dict "<MOBILE>", MobileScriptChar
|
2017-12-14 21:38:52 -08:00
|
|
|
dict "<LINE>", LineChar
|
|
|
|
dict "<NEXT>", NextLineChar
|
2018-07-17 14:08:04 -07:00
|
|
|
dict "<CR>", CarriageReturnChar
|
|
|
|
dict "<NULL>", NullChar
|
2018-01-18 17:40:32 -08:00
|
|
|
dict "<SCROLL>", _ContTextNoPause
|
|
|
|
dict "<_CONT>", _ContText
|
2017-12-14 21:38:52 -08:00
|
|
|
dict "<PARA>", Paragraph
|
|
|
|
dict "<MOM>", PrintMomsName
|
|
|
|
dict "<PLAYER>", PrintPlayerName
|
|
|
|
dict "<RIVAL>", PrintRivalName
|
2018-01-18 15:34:20 -08:00
|
|
|
dict "<ROUTE>", PlaceJPRoute
|
|
|
|
dict "<WATASHI>", PlaceWatashi
|
|
|
|
dict "<KOKO_WA>", PlaceKokoWa
|
2017-12-14 21:38:52 -08:00
|
|
|
dict "<RED>", PrintRedsName
|
|
|
|
dict "<GREEN>", PrintGreensName
|
|
|
|
dict "#", PlacePOKe
|
|
|
|
dict "<PC>", PCChar
|
|
|
|
dict "<ROCKET>", RocketChar
|
|
|
|
dict "<TM>", TMChar
|
2018-01-18 19:06:51 -08:00
|
|
|
dict "<TRAINER>", TrainerChar
|
2017-12-14 21:38:52 -08:00
|
|
|
dict "<KOUGEKI>", PlaceKougeki
|
2018-07-17 14:08:04 -07:00
|
|
|
dict "<LF>", LineFeedChar
|
2017-12-14 21:38:52 -08:00
|
|
|
dict "<CONT>", ContText
|
2018-01-18 23:30:19 -08:00
|
|
|
dict "<……>", SixDotsChar
|
2017-12-14 21:38:52 -08:00
|
|
|
dict "<DONE>", DoneText
|
|
|
|
dict "<PROMPT>", PromptText
|
|
|
|
dict "<PKMN>", PlacePKMN
|
|
|
|
dict "<POKE>", PlacePOKE
|
|
|
|
dict "%", NextChar
|
2018-07-17 14:08:04 -07:00
|
|
|
dict "¯", " "
|
2017-12-14 21:38:52 -08:00
|
|
|
dict "<DEXEND>", PlaceDexEnd
|
|
|
|
dict "<TARGET>", PlaceMoveTargetsName
|
|
|
|
dict "<USER>", PlaceMoveUsersName
|
|
|
|
dict "<ENEMY>", PlaceEnemysName
|
|
|
|
dict "<PLAY_G>", PlaceGenderedPlayerName
|
2018-07-17 14:08:04 -07:00
|
|
|
dict "゚", .place ; should be .diacritic
|
|
|
|
dict "゙", .place ; should be .diacritic
|
2016-03-04 10:21:14 -08:00
|
|
|
jr .not_diacritic
|
2014-08-14 23:50:39 -07:00
|
|
|
|
2016-03-04 10:21:14 -08:00
|
|
|
.diacritic
|
2013-08-20 12:58:08 -07:00
|
|
|
ld b, a
|
2014-08-14 23:50:39 -07:00
|
|
|
call Diacritic
|
2013-08-20 12:58:08 -07:00
|
|
|
jp NextChar
|
2014-08-14 23:50:39 -07:00
|
|
|
|
2016-03-04 10:21:14 -08:00
|
|
|
.not_diacritic
|
2018-01-18 15:34:20 -08:00
|
|
|
cp FIRST_REGULAR_TEXT_CHAR
|
2014-08-14 23:50:39 -07:00
|
|
|
jr nc, .place
|
|
|
|
|
2016-03-02 21:07:17 -08:00
|
|
|
cp "パ"
|
2014-08-14 23:50:39 -07:00
|
|
|
jr nc, .handakuten
|
|
|
|
|
|
|
|
.dakuten
|
2018-01-18 15:34:20 -08:00
|
|
|
cp FIRST_HIRAGANA_DAKUTEN_CHAR
|
|
|
|
jr nc, .hiragana_dakuten
|
2016-03-02 21:07:17 -08:00
|
|
|
add "カ" - "ガ"
|
2018-01-18 15:34:20 -08:00
|
|
|
jr .katakana_dakuten
|
|
|
|
.hiragana_dakuten
|
2016-03-02 21:07:17 -08:00
|
|
|
add "か" - "が"
|
2018-01-18 15:34:20 -08:00
|
|
|
.katakana_dakuten
|
2016-03-02 21:07:17 -08:00
|
|
|
ld b, "゙" ; dakuten
|
2014-08-14 23:50:39 -07:00
|
|
|
call Diacritic
|
|
|
|
jr .place
|
|
|
|
|
|
|
|
.handakuten
|
|
|
|
cp "ぱ"
|
2018-01-18 15:34:20 -08:00
|
|
|
jr nc, .hiragana_handakuten
|
2014-08-14 23:50:39 -07:00
|
|
|
add "ハ" - "パ"
|
2018-01-18 15:34:20 -08:00
|
|
|
jr .katakana_handakuten
|
|
|
|
.hiragana_handakuten
|
2014-08-14 23:50:39 -07:00
|
|
|
add "は" - "ぱ"
|
2018-01-18 15:34:20 -08:00
|
|
|
.katakana_handakuten
|
2016-03-02 21:07:17 -08:00
|
|
|
ld b, "゚" ; handakuten
|
2014-08-14 23:50:39 -07:00
|
|
|
call Diacritic
|
|
|
|
|
|
|
|
.place
|
2013-08-20 12:58:08 -07:00
|
|
|
ld [hli], a
|
|
|
|
call PrintLetterDelay
|
|
|
|
jp NextChar
|
|
|
|
|
2018-07-17 14:08:04 -07:00
|
|
|
MobileScriptChar::
|
2013-08-20 12:58:08 -07:00
|
|
|
ld c, l
|
|
|
|
ld b, h
|
2018-07-17 14:08:04 -07:00
|
|
|
farcall RunMobileScript
|
2013-08-20 12:58:08 -07:00
|
|
|
jp PlaceNextChar
|
|
|
|
|
2017-12-28 04:23:44 -08:00
|
|
|
print_name: MACRO
|
2013-08-20 12:58:08 -07:00
|
|
|
push de
|
2014-08-14 23:50:39 -07:00
|
|
|
ld de, \1
|
2015-10-04 11:14:51 -07:00
|
|
|
jp PlaceCommandCharacter
|
2017-12-28 13:31:16 -08:00
|
|
|
ENDM
|
2014-08-14 23:50:39 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
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::
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hBattleTurn]
|
2014-08-14 23:50:39 -07:00
|
|
|
xor 1
|
2018-01-18 21:07:13 -08:00
|
|
|
jr PlaceMoveUsersName.place
|
2013-08-20 12:58:08 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
PlaceMoveUsersName::
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hBattleTurn]
|
2013-08-20 12:58:08 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.place:
|
2013-08-20 12:58:08 -07:00
|
|
|
push de
|
|
|
|
and a
|
2014-08-14 23:50:39 -07:00
|
|
|
jr nz, .enemy
|
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld de, wBattleMonNick
|
2015-10-04 11:14:51 -07:00
|
|
|
jr PlaceCommandCharacter
|
2014-08-14 23:50:39 -07:00
|
|
|
|
|
|
|
.enemy
|
2018-01-18 15:34:20 -08:00
|
|
|
ld de, EnemyText
|
2013-08-20 12:58:08 -07:00
|
|
|
call PlaceString
|
|
|
|
ld h, b
|
|
|
|
ld l, c
|
2018-01-23 14:39:09 -08:00
|
|
|
ld de, wEnemyMonNick
|
2015-10-04 11:14:51 -07:00
|
|
|
jr PlaceCommandCharacter
|
2014-08-14 23:50:39 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
PlaceEnemysName::
|
2013-08-20 12:58:08 -07:00
|
|
|
push de
|
2014-08-14 23:50:39 -07:00
|
|
|
|
2015-10-19 07:23:58 -07:00
|
|
|
ld a, [wLinkMode]
|
2013-08-20 12:58:08 -07:00
|
|
|
and a
|
|
|
|
jr nz, .linkbattle
|
2014-08-14 23:50:39 -07:00
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wTrainerClass]
|
2014-03-02 22:28:54 -08:00
|
|
|
cp RIVAL1
|
2014-08-14 23:50:39 -07:00
|
|
|
jr z, .rival
|
2014-03-02 22:28:54 -08:00
|
|
|
cp RIVAL2
|
2014-08-14 23:50:39 -07:00
|
|
|
jr z, .rival
|
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld de, wOTClassName
|
2013-08-20 12:58:08 -07:00
|
|
|
call PlaceString
|
|
|
|
ld h, b
|
|
|
|
ld l, c
|
2018-01-18 15:34:20 -08:00
|
|
|
ld de, String_Space
|
2013-08-20 12:58:08 -07:00
|
|
|
call PlaceString
|
|
|
|
push bc
|
2017-12-24 09:47:30 -08:00
|
|
|
callfar Battle_GetTrainerName
|
2013-08-20 12:58:08 -07:00
|
|
|
pop hl
|
2018-01-23 14:39:09 -08:00
|
|
|
ld de, wStringBuffer1
|
2015-10-04 11:14:51 -07:00
|
|
|
jr PlaceCommandCharacter
|
2014-08-14 23:50:39 -07:00
|
|
|
|
|
|
|
.rival
|
2018-01-23 14:39:09 -08:00
|
|
|
ld de, wRivalName
|
2015-10-04 11:14:51 -07:00
|
|
|
jr PlaceCommandCharacter
|
2014-08-14 23:50:39 -07:00
|
|
|
|
2013-08-20 12:58:08 -07:00
|
|
|
.linkbattle
|
2018-01-23 14:39:09 -08:00
|
|
|
ld de, wOTClassName
|
2015-10-04 11:14:51 -07:00
|
|
|
jr PlaceCommandCharacter
|
2014-08-14 23:50:39 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
PlaceGenderedPlayerName::
|
2013-08-20 12:58:08 -07:00
|
|
|
push de
|
2018-01-23 14:39:09 -08:00
|
|
|
ld de, wPlayerName
|
2013-08-20 12:58:08 -07:00
|
|
|
call PlaceString
|
|
|
|
ld h, b
|
|
|
|
ld l, c
|
2017-12-28 04:15:46 -08:00
|
|
|
ld a, [wPlayerGender]
|
2018-01-22 11:34:55 -08:00
|
|
|
bit PLAYERGENDER_FEMALE_F, a
|
2018-01-18 15:34:20 -08:00
|
|
|
ld de, KunSuffixText
|
2015-10-04 11:14:51 -07:00
|
|
|
jr z, PlaceCommandCharacter
|
2018-01-18 15:34:20 -08:00
|
|
|
ld de, ChanSuffixText
|
2015-10-04 11:14:51 -07:00
|
|
|
jr PlaceCommandCharacter
|
2014-08-14 23:50:39 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
PlaceCommandCharacter::
|
2013-08-20 12:58:08 -07:00
|
|
|
call PlaceString
|
|
|
|
ld h, b
|
|
|
|
ld l, c
|
|
|
|
pop de
|
|
|
|
jp NextChar
|
|
|
|
|
2018-01-18 18:48:52 -08:00
|
|
|
TMCharText:: db "TM@"
|
2018-01-18 15:34:20 -08:00
|
|
|
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 "@"
|
2013-08-20 12:58:08 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
NextLineChar::
|
2013-08-20 12:58:08 -07:00
|
|
|
pop hl
|
2014-08-14 23:50:39 -07:00
|
|
|
ld bc, SCREEN_WIDTH * 2
|
2013-08-20 12:58:08 -07:00
|
|
|
add hl, bc
|
|
|
|
push hl
|
|
|
|
jp NextChar
|
|
|
|
|
2018-07-17 14:08:04 -07:00
|
|
|
LineFeedChar::
|
2013-08-20 12:58:08 -07:00
|
|
|
pop hl
|
2014-08-14 23:50:39 -07:00
|
|
|
ld bc, SCREEN_WIDTH
|
2013-08-20 12:58:08 -07:00
|
|
|
add hl, bc
|
|
|
|
push hl
|
|
|
|
jp NextChar
|
|
|
|
|
2018-07-17 14:08:04 -07:00
|
|
|
CarriageReturnChar::
|
2013-08-20 12:58:08 -07:00
|
|
|
pop hl
|
|
|
|
push de
|
2020-02-13 09:30:13 -08:00
|
|
|
ld bc, -wTilemap + $10000
|
2013-08-20 12:58:08 -07:00
|
|
|
add hl, bc
|
2014-08-14 23:50:39 -07:00
|
|
|
ld de, -SCREEN_WIDTH
|
|
|
|
ld c, 1
|
2015-10-19 07:23:58 -07:00
|
|
|
.loop
|
2013-08-20 12:58:08 -07:00
|
|
|
ld a, h
|
|
|
|
and a
|
2015-10-19 07:23:58 -07:00
|
|
|
jr nz, .next
|
2013-08-20 12:58:08 -07:00
|
|
|
ld a, l
|
2014-08-14 23:50:39 -07:00
|
|
|
cp SCREEN_WIDTH
|
2015-10-19 07:23:58 -07:00
|
|
|
jr c, .done
|
2013-08-20 12:58:08 -07:00
|
|
|
|
2015-10-19 07:23:58 -07:00
|
|
|
.next
|
2013-08-20 12:58:08 -07:00
|
|
|
add hl, de
|
|
|
|
inc c
|
2015-10-19 07:23:58 -07:00
|
|
|
jr .loop
|
2013-08-20 12:58:08 -07:00
|
|
|
|
2015-10-19 07:23:58 -07:00
|
|
|
.done
|
2015-07-22 12:57:02 -07:00
|
|
|
hlcoord 0, 0
|
2014-08-14 23:50:39 -07:00
|
|
|
ld de, SCREEN_WIDTH
|
2013-08-20 12:58:08 -07:00
|
|
|
ld a, c
|
2015-10-19 07:23:58 -07:00
|
|
|
.loop2
|
2013-08-20 12:58:08 -07:00
|
|
|
and a
|
2015-10-19 07:23:58 -07:00
|
|
|
jr z, .done2
|
2013-08-20 12:58:08 -07:00
|
|
|
add hl, de
|
|
|
|
dec a
|
2015-10-19 07:23:58 -07:00
|
|
|
jr .loop2
|
2013-08-20 12:58:08 -07:00
|
|
|
|
2015-10-19 07:23:58 -07:00
|
|
|
.done2
|
2013-08-20 12:58:08 -07:00
|
|
|
pop de
|
|
|
|
inc de
|
|
|
|
ld a, [de]
|
|
|
|
ld c, a
|
2014-08-14 23:50:39 -07:00
|
|
|
ld b, 0
|
2013-08-20 12:58:08 -07:00
|
|
|
add hl, bc
|
|
|
|
push hl
|
|
|
|
jp NextChar
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
LineChar::
|
2013-08-20 12:58:08 -07:00
|
|
|
pop hl
|
2014-08-14 23:50:39 -07:00
|
|
|
hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY + 2
|
2013-08-20 12:58:08 -07:00
|
|
|
push hl
|
|
|
|
jp NextChar
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
Paragraph::
|
2013-08-20 12:58:08 -07:00
|
|
|
push de
|
2014-08-14 23:50:39 -07:00
|
|
|
|
2015-10-19 07:23:58 -07:00
|
|
|
ld a, [wLinkMode]
|
|
|
|
cp LINK_COLOSSEUM
|
|
|
|
jr z, .linkbattle
|
|
|
|
cp LINK_MOBILE
|
|
|
|
jr z, .linkbattle
|
|
|
|
call LoadBlinkingCursor
|
2014-08-14 23:50:39 -07:00
|
|
|
|
2015-10-19 07:23:58 -07:00
|
|
|
.linkbattle
|
2016-05-10 09:31:49 -07:00
|
|
|
call Text_WaitBGMap
|
2019-11-03 09:48:54 -08:00
|
|
|
call PromptButton
|
2014-08-14 23:50:39 -07:00
|
|
|
hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY
|
|
|
|
lb bc, TEXTBOX_INNERH - 1, TEXTBOX_INNERW
|
2013-08-20 12:58:08 -07:00
|
|
|
call ClearBox
|
2015-10-19 07:23:58 -07:00
|
|
|
call UnloadBlinkingCursor
|
2014-08-14 23:50:39 -07:00
|
|
|
ld c, 20
|
2013-08-20 12:58:08 -07:00
|
|
|
call DelayFrames
|
2014-08-14 23:50:39 -07:00
|
|
|
hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY
|
2013-08-20 12:58:08 -07:00
|
|
|
pop de
|
|
|
|
jp NextChar
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
_ContText::
|
2015-10-19 07:23:58 -07:00
|
|
|
ld a, [wLinkMode]
|
2013-08-20 12:58:08 -07:00
|
|
|
or a
|
2015-10-19 07:23:58 -07:00
|
|
|
jr nz, .communication
|
|
|
|
call LoadBlinkingCursor
|
2014-08-14 23:50:39 -07:00
|
|
|
|
2015-10-19 07:23:58 -07:00
|
|
|
.communication
|
2016-05-10 09:31:49 -07:00
|
|
|
call Text_WaitBGMap
|
2013-08-20 12:58:08 -07:00
|
|
|
|
|
|
|
push de
|
2019-11-03 09:48:54 -08:00
|
|
|
call PromptButton
|
2013-08-20 12:58:08 -07:00
|
|
|
pop de
|
|
|
|
|
2015-10-19 07:23:58 -07:00
|
|
|
ld a, [wLinkMode]
|
2013-08-20 12:58:08 -07:00
|
|
|
or a
|
2015-10-19 07:23:58 -07:00
|
|
|
call z, UnloadBlinkingCursor
|
2018-01-18 15:34:20 -08:00
|
|
|
; fallthrough
|
2013-08-20 12:58:08 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
_ContTextNoPause::
|
2013-08-20 12:58:08 -07:00
|
|
|
push de
|
2015-10-19 07:23:58 -07:00
|
|
|
call TextScroll
|
|
|
|
call TextScroll
|
2014-08-14 23:50:39 -07:00
|
|
|
hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY + 2
|
2013-08-20 12:58:08 -07:00
|
|
|
pop de
|
|
|
|
jp NextChar
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
ContText::
|
2013-08-20 12:58:08 -07:00
|
|
|
push de
|
2014-08-14 23:50:39 -07:00
|
|
|
ld de, .cont
|
2013-08-20 12:58:08 -07:00
|
|
|
ld b, h
|
|
|
|
ld c, l
|
|
|
|
call PlaceString
|
|
|
|
ld h, b
|
|
|
|
ld l, c
|
|
|
|
pop de
|
|
|
|
jp NextChar
|
|
|
|
|
2018-01-18 17:40:32 -08:00
|
|
|
.cont: db "<_CONT>@"
|
2013-08-20 12:58:08 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
PlaceDexEnd::
|
2018-02-02 18:15:15 -08:00
|
|
|
; Ends a Pokédex entry in Gen 1.
|
2014-08-14 23:50:39 -07:00
|
|
|
; Dex entries are now regular strings.
|
2013-08-20 12:58:08 -07:00
|
|
|
ld [hl], "."
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
PromptText::
|
2015-10-19 07:23:58 -07:00
|
|
|
ld a, [wLinkMode]
|
|
|
|
cp LINK_COLOSSEUM
|
2014-08-14 23:50:39 -07:00
|
|
|
jr z, .ok
|
2015-10-19 07:23:58 -07:00
|
|
|
cp LINK_MOBILE
|
2014-08-14 23:50:39 -07:00
|
|
|
jr z, .ok
|
2015-10-19 07:23:58 -07:00
|
|
|
call LoadBlinkingCursor
|
2013-08-20 12:58:08 -07:00
|
|
|
|
2015-10-19 07:23:58 -07:00
|
|
|
.ok
|
2016-05-10 09:31:49 -07:00
|
|
|
call Text_WaitBGMap
|
2019-11-03 09:48:54 -08:00
|
|
|
call PromptButton
|
2015-10-19 07:23:58 -07:00
|
|
|
ld a, [wLinkMode]
|
|
|
|
cp LINK_COLOSSEUM
|
2014-08-14 23:50:39 -07:00
|
|
|
jr z, DoneText
|
2015-10-19 07:23:58 -07:00
|
|
|
cp LINK_MOBILE
|
2014-08-14 23:50:39 -07:00
|
|
|
jr z, DoneText
|
2015-10-19 07:23:58 -07:00
|
|
|
call UnloadBlinkingCursor
|
2013-08-20 12:58:08 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
DoneText::
|
2013-08-20 12:58:08 -07:00
|
|
|
pop hl
|
2014-08-14 23:50:39 -07:00
|
|
|
ld de, .stop
|
2013-08-20 12:58:08 -07:00
|
|
|
dec de
|
|
|
|
ret
|
2018-01-18 15:34:20 -08:00
|
|
|
|
2018-11-17 10:33:03 -08:00
|
|
|
.stop:
|
|
|
|
text_end
|
2013-08-20 12:58:08 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
NullChar::
|
2014-08-14 23:50:39 -07:00
|
|
|
ld a, "?"
|
2013-08-20 12:58:08 -07:00
|
|
|
ld [hli], a
|
|
|
|
call PrintLetterDelay
|
|
|
|
jp NextChar
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
TextScroll::
|
2014-08-14 23:50:39 -07:00
|
|
|
hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY
|
|
|
|
decoord TEXTBOX_INNERX, TEXTBOX_INNERY - 1
|
|
|
|
ld a, TEXTBOX_INNERH - 1
|
2015-10-19 07:23:58 -07:00
|
|
|
|
2014-08-14 23:50:39 -07:00
|
|
|
.col
|
2013-08-20 12:58:08 -07:00
|
|
|
push af
|
2014-08-14 23:50:39 -07:00
|
|
|
ld c, TEXTBOX_INNERW
|
2015-10-19 07:23:58 -07:00
|
|
|
|
2014-08-14 23:50:39 -07:00
|
|
|
.row
|
2013-08-20 12:58:08 -07:00
|
|
|
ld a, [hli]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
dec c
|
2014-08-14 23:50:39 -07:00
|
|
|
jr nz, .row
|
2015-10-19 07:23:58 -07:00
|
|
|
|
2013-08-20 12:58:08 -07:00
|
|
|
inc de
|
2016-05-04 08:46:23 -07:00
|
|
|
inc de
|
|
|
|
inc hl
|
2013-08-20 12:58:08 -07:00
|
|
|
inc hl
|
|
|
|
pop af
|
|
|
|
dec a
|
2014-08-14 23:50:39 -07:00
|
|
|
jr nz, .col
|
2015-10-19 07:23:58 -07:00
|
|
|
|
2014-08-14 23:50:39 -07:00
|
|
|
hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY + 2
|
|
|
|
ld a, " "
|
|
|
|
ld bc, TEXTBOX_INNERW
|
2013-08-20 12:58:08 -07:00
|
|
|
call ByteFill
|
2014-08-14 23:50:39 -07:00
|
|
|
ld c, 5
|
2013-08-20 12:58:08 -07:00
|
|
|
call DelayFrames
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
Text_WaitBGMap::
|
2013-08-20 12:58:08 -07:00
|
|
|
push bc
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hOAMUpdate]
|
2013-08-20 12:58:08 -07:00
|
|
|
push af
|
2014-08-14 23:50:39 -07:00
|
|
|
ld a, 1
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hOAMUpdate], a
|
2015-10-19 07:23:58 -07:00
|
|
|
|
2013-08-20 12:58:08 -07:00
|
|
|
call WaitBGMap
|
2015-10-19 07:23:58 -07:00
|
|
|
|
2013-08-20 12:58:08 -07:00
|
|
|
pop af
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hOAMUpdate], a
|
2013-08-20 12:58:08 -07:00
|
|
|
pop bc
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
Diacritic::
|
2013-08-20 12:58:08 -07:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
LoadBlinkingCursor::
|
2014-08-14 23:50:39 -07:00
|
|
|
ld a, "▼"
|
2015-10-19 07:23:58 -07:00
|
|
|
ldcoord_a 18, 17
|
2013-08-20 12:58:08 -07:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
UnloadBlinkingCursor::
|
2015-10-19 07:23:58 -07:00
|
|
|
lda_coord 17, 17
|
|
|
|
ldcoord_a 18, 17
|
2013-08-20 12:58:08 -07:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
FarString::
|
2013-08-20 12:58:08 -07:00
|
|
|
ld b, a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hROMBank]
|
2013-08-20 12:58:08 -07:00
|
|
|
push af
|
2014-08-14 23:50:39 -07:00
|
|
|
|
2013-08-20 12:58:08 -07:00
|
|
|
ld a, b
|
|
|
|
rst Bankswitch
|
|
|
|
call PlaceString
|
2014-08-14 23:50:39 -07:00
|
|
|
|
2013-08-20 12:58:08 -07:00
|
|
|
pop af
|
|
|
|
rst Bankswitch
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
PokeFluteTerminatorCharacter::
|
2014-08-14 23:50:39 -07:00
|
|
|
ld hl, .stop
|
2013-08-20 12:58:08 -07:00
|
|
|
ret
|
|
|
|
|
2018-11-17 10:33:03 -08:00
|
|
|
.stop:
|
|
|
|
text_end
|
2013-08-20 12:58:08 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
PlaceHLTextAtBC::
|
2019-04-08 05:15:10 -07:00
|
|
|
ld a, [wTextboxFlags]
|
2013-08-20 12:58:08 -07:00
|
|
|
push af
|
2017-12-29 10:18:17 -08:00
|
|
|
set NO_TEXT_DELAY_F, a
|
2019-04-08 05:15:10 -07:00
|
|
|
ld [wTextboxFlags], a
|
2014-08-14 23:50:39 -07:00
|
|
|
|
2015-10-19 07:23:58 -07:00
|
|
|
call DoTextUntilTerminator
|
2014-08-14 23:50:39 -07:00
|
|
|
|
2013-08-20 12:58:08 -07:00
|
|
|
pop af
|
2019-04-08 05:15:10 -07:00
|
|
|
ld [wTextboxFlags], a
|
2013-08-20 12:58:08 -07:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
DoTextUntilTerminator::
|
2013-08-20 12:58:08 -07:00
|
|
|
ld a, [hli]
|
2018-11-17 10:33:03 -08:00
|
|
|
cp TX_END
|
2013-08-20 12:58:08 -07:00
|
|
|
ret z
|
2014-08-14 23:50:39 -07:00
|
|
|
call .TextCommand
|
2015-10-19 07:23:58 -07:00
|
|
|
jr DoTextUntilTerminator
|
2013-08-20 12:58:08 -07:00
|
|
|
|
2014-08-14 23:50:39 -07:00
|
|
|
.TextCommand:
|
2013-08-20 12:58:08 -07:00
|
|
|
push hl
|
|
|
|
push bc
|
|
|
|
ld c, a
|
|
|
|
ld b, 0
|
|
|
|
ld hl, TextCommands
|
|
|
|
add hl, bc
|
2016-05-04 08:46:23 -07:00
|
|
|
add hl, bc
|
2013-08-20 12:58:08 -07:00
|
|
|
ld e, [hl]
|
|
|
|
inc hl
|
|
|
|
ld d, [hl]
|
|
|
|
pop bc
|
|
|
|
pop hl
|
2014-08-14 23:50:39 -07:00
|
|
|
|
|
|
|
; jp de
|
2013-08-20 12:58:08 -07:00
|
|
|
push de
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
TextCommands::
|
2018-01-18 19:06:51 -08:00
|
|
|
; entries correspond to TX_* constants (see macros/scripts/text.asm)
|
2019-11-03 09:48:54 -08:00
|
|
|
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_NUM ; TX_NUM
|
|
|
|
dw TextCommand_PAUSE ; TX_PAUSE
|
|
|
|
dw TextCommand_SOUND ; TX_SOUND_DEX_FANFARE_50_79
|
|
|
|
dw TextCommand_DOTS ; TX_DOTS
|
|
|
|
dw TextCommand_LINK_PROMPT_BUTTON ; TX_LINK_PROMPT_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
|
2018-07-17 14:11:17 -07:00
|
|
|
|
|
|
|
TextCommand_START::
|
2013-08-20 12:58:08 -07:00
|
|
|
; 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
|
|
|
|
|
2018-07-17 14:11:17 -07:00
|
|
|
TextCommand_RAM::
|
2020-06-21 13:27:43 -07:00
|
|
|
; write text from a ram address (little endian)
|
2013-08-20 12:58:08 -07:00
|
|
|
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
|
|
|
|
|
2018-07-17 14:11:17 -07:00
|
|
|
TextCommand_FAR::
|
2020-06-21 13:27:43 -07:00
|
|
|
; write text from a different bank (little endian)
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hROMBank]
|
2013-08-20 12:58:08 -07:00
|
|
|
push af
|
|
|
|
|
|
|
|
ld a, [hli]
|
|
|
|
ld e, a
|
|
|
|
ld a, [hli]
|
|
|
|
ld d, a
|
|
|
|
ld a, [hli]
|
|
|
|
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hROMBank], a
|
2013-08-20 12:58:08 -07:00
|
|
|
ld [MBC3RomBank], a
|
|
|
|
|
|
|
|
push hl
|
|
|
|
ld h, d
|
|
|
|
ld l, e
|
2015-10-19 07:23:58 -07:00
|
|
|
call DoTextUntilTerminator
|
2013-08-20 12:58:08 -07:00
|
|
|
pop hl
|
|
|
|
|
|
|
|
pop af
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hROMBank], a
|
2013-08-20 12:58:08 -07:00
|
|
|
ld [MBC3RomBank], a
|
|
|
|
ret
|
|
|
|
|
2018-07-17 14:11:17 -07:00
|
|
|
TextCommand_BCD::
|
2014-08-14 23:50:39 -07:00
|
|
|
; write bcd from address, typically ram
|
2013-08-20 12:58:08 -07:00
|
|
|
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
|
|
|
|
|
2018-07-17 14:11:17 -07:00
|
|
|
TextCommand_MOVE::
|
2013-08-20 12:58:08 -07:00
|
|
|
; move to a new tile
|
|
|
|
ld a, [hli]
|
2015-11-23 13:04:53 -08:00
|
|
|
ld [wMenuScrollPosition + 2], a
|
2013-08-20 12:58:08 -07:00
|
|
|
ld c, a
|
|
|
|
ld a, [hli]
|
2015-11-23 13:04:53 -08:00
|
|
|
ld [wMenuScrollPosition + 2 + 1], a
|
2013-08-20 12:58:08 -07:00
|
|
|
ld b, a
|
|
|
|
ret
|
|
|
|
|
2018-07-17 14:11:17 -07:00
|
|
|
TextCommand_BOX::
|
2020-06-21 13:27:43 -07:00
|
|
|
; draw a box (height, width)
|
2013-08-20 12:58:08 -07:00
|
|
|
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
|
2019-04-08 05:15:10 -07:00
|
|
|
call Textbox
|
2013-08-20 12:58:08 -07:00
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
|
2018-07-17 14:11:17 -07:00
|
|
|
TextCommand_LOW::
|
2013-08-20 12:58:08 -07:00
|
|
|
; write text at (1,16)
|
2014-08-14 23:50:39 -07:00
|
|
|
bccoord TEXTBOX_INNERX, TEXTBOX_INNERY + 2
|
2013-08-20 12:58:08 -07:00
|
|
|
ret
|
|
|
|
|
2019-11-03 09:48:54 -08:00
|
|
|
TextCommand_PROMPT_BUTTON::
|
2020-06-21 13:27:43 -07:00
|
|
|
; wait for button press; show arrow
|
2015-10-19 07:23:58 -07:00
|
|
|
ld a, [wLinkMode]
|
|
|
|
cp LINK_COLOSSEUM
|
2019-11-03 09:48:54 -08:00
|
|
|
jp z, TextCommand_LINK_PROMPT_BUTTON
|
2015-10-19 07:23:58 -07:00
|
|
|
cp LINK_MOBILE
|
2019-11-03 09:48:54 -08:00
|
|
|
jp z, TextCommand_LINK_PROMPT_BUTTON
|
2014-08-14 23:50:39 -07:00
|
|
|
|
2013-08-20 12:58:08 -07:00
|
|
|
push hl
|
2015-10-19 07:23:58 -07:00
|
|
|
call LoadBlinkingCursor
|
2013-08-20 12:58:08 -07:00
|
|
|
push bc
|
2019-11-03 09:48:54 -08:00
|
|
|
call PromptButton
|
2013-08-20 12:58:08 -07:00
|
|
|
pop bc
|
2015-10-19 07:23:58 -07:00
|
|
|
call UnloadBlinkingCursor
|
2013-08-20 12:58:08 -07:00
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
|
2018-07-17 14:11:17 -07:00
|
|
|
TextCommand_SCROLL::
|
2015-10-19 07:23:58 -07:00
|
|
|
; pushes text up two lines and sets the BC cursor to the border tile
|
|
|
|
; below the first character column of the text box.
|
2013-08-20 12:58:08 -07:00
|
|
|
push hl
|
2015-10-19 07:23:58 -07:00
|
|
|
call UnloadBlinkingCursor
|
|
|
|
call TextScroll
|
|
|
|
call TextScroll
|
2013-08-20 12:58:08 -07:00
|
|
|
pop hl
|
2014-08-14 23:50:39 -07:00
|
|
|
bccoord TEXTBOX_INNERX, TEXTBOX_INNERY + 2
|
2013-08-20 12:58:08 -07:00
|
|
|
ret
|
|
|
|
|
2018-07-17 14:11:17 -07:00
|
|
|
TextCommand_START_ASM::
|
2020-06-21 13:27:43 -07:00
|
|
|
; run assembly code
|
2013-08-20 12:58:08 -07:00
|
|
|
bit 7, h
|
2014-08-14 23:50:39 -07:00
|
|
|
jr nz, .not_rom
|
2017-06-09 14:01:10 -07:00
|
|
|
jp hl
|
2013-08-20 12:58:08 -07:00
|
|
|
|
2014-08-14 23:50:39 -07:00
|
|
|
.not_rom
|
2018-11-17 10:33:03 -08:00
|
|
|
ld a, TX_END
|
2013-08-20 12:58:08 -07:00
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
|
2018-07-17 14:11:17 -07:00
|
|
|
TextCommand_NUM::
|
2020-06-21 13:27:43 -07:00
|
|
|
; print a number
|
2013-08-20 12:58:08 -07:00
|
|
|
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
|
2019-11-03 17:17:04 -08:00
|
|
|
set PRINTNUM_LEFTALIGN_F, a
|
2013-08-20 12:58:08 -07:00
|
|
|
ld b, a
|
|
|
|
call PrintNum
|
|
|
|
ld b, h
|
|
|
|
ld c, l
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
|
2018-11-17 10:33:03 -08:00
|
|
|
TextCommand_PAUSE::
|
2020-06-21 13:27:43 -07:00
|
|
|
; wait for button press or 30 frames
|
2013-08-20 12:58:08 -07:00
|
|
|
push hl
|
|
|
|
push bc
|
2013-12-22 14:30:35 -08:00
|
|
|
call GetJoypad
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hJoyDown]
|
2013-09-07 20:49:20 -07:00
|
|
|
and A_BUTTON | B_BUTTON
|
2014-08-14 23:50:39 -07:00
|
|
|
jr nz, .done
|
2013-08-20 12:58:08 -07:00
|
|
|
ld c, 30
|
|
|
|
call DelayFrames
|
2014-08-14 23:50:39 -07:00
|
|
|
.done
|
2013-08-20 12:58:08 -07:00
|
|
|
pop bc
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
|
2018-07-17 14:11:17 -07:00
|
|
|
TextCommand_SOUND::
|
2020-06-21 13:27:43 -07:00
|
|
|
; play a sound effect from TextSFX
|
2013-08-20 12:58:08 -07:00
|
|
|
push bc
|
|
|
|
dec hl
|
|
|
|
ld a, [hli]
|
|
|
|
ld b, a
|
|
|
|
push hl
|
|
|
|
ld hl, TextSFX
|
2014-08-14 23:50:39 -07:00
|
|
|
.loop
|
2013-08-20 12:58:08 -07:00
|
|
|
ld a, [hli]
|
2014-08-14 23:50:39 -07:00
|
|
|
cp -1
|
|
|
|
jr z, .done
|
2013-08-20 12:58:08 -07:00
|
|
|
cp b
|
2014-08-14 23:50:39 -07:00
|
|
|
jr z, .play
|
2013-08-20 12:58:08 -07:00
|
|
|
inc hl
|
2016-05-04 08:46:23 -07:00
|
|
|
inc hl
|
2014-08-14 23:50:39 -07:00
|
|
|
jr .loop
|
2013-08-20 12:58:08 -07:00
|
|
|
|
2014-08-14 23:50:39 -07:00
|
|
|
.play
|
2013-08-20 12:58:08 -07:00
|
|
|
push de
|
|
|
|
ld e, [hl]
|
|
|
|
inc hl
|
|
|
|
ld d, [hl]
|
2013-10-08 10:10:36 -07:00
|
|
|
call PlaySFX
|
2013-08-20 12:58:08 -07:00
|
|
|
call WaitSFX
|
|
|
|
pop de
|
|
|
|
|
2014-08-14 23:50:39 -07:00
|
|
|
.done
|
2013-08-20 12:58:08 -07:00
|
|
|
pop hl
|
|
|
|
pop bc
|
|
|
|
ret
|
|
|
|
|
2020-06-21 13:27:43 -07:00
|
|
|
TextCommand_CRY:: ; unreferenced
|
|
|
|
; play a pokemon cry
|
2013-08-20 12:58:08 -07:00
|
|
|
push de
|
|
|
|
ld e, [hl]
|
|
|
|
inc hl
|
|
|
|
ld d, [hl]
|
2018-01-16 20:47:45 -08:00
|
|
|
call PlayMonCry
|
2013-08-20 12:58:08 -07:00
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
pop bc
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
TextSFX::
|
2018-01-18 19:06:51 -08:00
|
|
|
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
|
2014-08-14 23:50:39 -07:00
|
|
|
db -1
|
2013-08-20 12:58:08 -07:00
|
|
|
|
2018-07-17 14:11:17 -07:00
|
|
|
TextCommand_DOTS::
|
2020-06-21 13:27:43 -07:00
|
|
|
; wait for button press or 30 frames while printing "…"s
|
2013-08-20 12:58:08 -07:00
|
|
|
ld a, [hli]
|
|
|
|
ld d, a
|
|
|
|
push hl
|
|
|
|
ld h, b
|
|
|
|
ld l, c
|
2015-10-19 07:23:58 -07:00
|
|
|
|
2014-08-14 23:50:39 -07:00
|
|
|
.loop
|
2013-08-20 12:58:08 -07:00
|
|
|
push de
|
|
|
|
ld a, "…"
|
|
|
|
ld [hli], a
|
2013-12-22 14:30:35 -08:00
|
|
|
call GetJoypad
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hJoyDown]
|
2013-09-07 20:49:20 -07:00
|
|
|
and A_BUTTON | B_BUTTON
|
2014-08-14 23:50:39 -07:00
|
|
|
jr nz, .next
|
2013-08-20 12:58:08 -07:00
|
|
|
ld c, 10
|
|
|
|
call DelayFrames
|
2014-08-14 23:50:39 -07:00
|
|
|
.next
|
2013-08-20 12:58:08 -07:00
|
|
|
pop de
|
|
|
|
dec d
|
2014-08-14 23:50:39 -07:00
|
|
|
jr nz, .loop
|
2015-10-19 07:23:58 -07:00
|
|
|
|
2013-08-20 12:58:08 -07:00
|
|
|
ld b, h
|
|
|
|
ld c, l
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
|
2019-11-03 09:48:54 -08:00
|
|
|
TextCommand_LINK_PROMPT_BUTTON::
|
2020-06-21 13:27:43 -07:00
|
|
|
; wait for button press; display arrow
|
2013-08-20 12:58:08 -07:00
|
|
|
push hl
|
|
|
|
push bc
|
2019-11-03 09:48:54 -08:00
|
|
|
call PromptButton
|
2013-08-20 12:58:08 -07:00
|
|
|
pop bc
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
|
2018-07-17 14:11:17 -07:00
|
|
|
TextCommand_STRINGBUFFER::
|
2014-02-24 18:51:20 -08:00
|
|
|
; Print a string from one of the following:
|
2018-01-23 14:39:09 -08:00
|
|
|
; 0: wStringBuffer3
|
|
|
|
; 1: wStringBuffer4
|
|
|
|
; 2: wStringBuffer5
|
|
|
|
; 3: wStringBuffer2
|
|
|
|
; 4: wStringBuffer1
|
|
|
|
; 5: wEnemyMonNick
|
|
|
|
; 6: wBattleMonNick
|
2013-08-20 12:58:08 -07:00
|
|
|
ld a, [hli]
|
|
|
|
push hl
|
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
2015-10-30 07:34:35 -07:00
|
|
|
ld hl, StringBufferPointers
|
2013-08-20 12:58:08 -07:00
|
|
|
add hl, de
|
2016-05-04 08:46:23 -07:00
|
|
|
add hl, de
|
2015-10-30 07:34:35 -07:00
|
|
|
ld a, BANK(StringBufferPointers)
|
2013-08-20 12:58:08 -07:00
|
|
|
call GetFarHalfword
|
|
|
|
ld d, h
|
|
|
|
ld e, l
|
|
|
|
ld h, b
|
|
|
|
ld l, c
|
|
|
|
call PlaceString
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
|
2018-07-17 14:11:17 -07:00
|
|
|
TextCommand_DAY::
|
2020-06-21 13:27:43 -07:00
|
|
|
; print the day of the week
|
2013-08-20 12:58:08 -07:00
|
|
|
call GetWeekday
|
|
|
|
push hl
|
|
|
|
push bc
|
|
|
|
ld c, a
|
|
|
|
ld b, 0
|
|
|
|
ld hl, .Days
|
|
|
|
add hl, bc
|
2016-05-04 08:46:23 -07:00
|
|
|
add hl, bc
|
2013-08-20 12:58:08 -07:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
ld d, h
|
|
|
|
ld e, l
|
|
|
|
pop hl
|
|
|
|
call PlaceString
|
|
|
|
ld h, b
|
|
|
|
ld l, c
|
|
|
|
ld de, .Day
|
|
|
|
call PlaceString
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.Days:
|
2013-08-20 12:58:08 -07:00
|
|
|
dw .Sun
|
|
|
|
dw .Mon
|
|
|
|
dw .Tues
|
|
|
|
dw .Wednes
|
|
|
|
dw .Thurs
|
|
|
|
dw .Fri
|
|
|
|
dw .Satur
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.Sun: db "SUN@"
|
|
|
|
.Mon: db "MON@"
|
|
|
|
.Tues: db "TUES@"
|
|
|
|
.Wednes: db "WEDNES@"
|
|
|
|
.Thurs: db "THURS@"
|
|
|
|
.Fri: db "FRI@"
|
|
|
|
.Satur: db "SATUR@"
|
|
|
|
.Day: db "DAY@"
|