mirror of
https://github.com/thornAvery/kep-hack.git
synced 2026-02-06 15:45:24 +13:00
Port pokecrystal's formatting of text commands and special characters
This commit is contained in:
parent
2718c36065
commit
139a28ff99
397 changed files with 7398 additions and 7026 deletions
|
|
@ -75,8 +75,8 @@ OverworldLoopLessDelay::
|
|||
bit 3, a ; start button
|
||||
jr z, .startButtonNotPressed
|
||||
; if START is pressed
|
||||
xor a
|
||||
ld [hSpriteIndexOrTextID], a ; start menu text ID
|
||||
xor a ; TEXT_START_MENU
|
||||
ld [hSpriteIndexOrTextID], a
|
||||
jp .displayDialogue
|
||||
.startButtonNotPressed
|
||||
bit 0, a ; A button
|
||||
|
|
|
|||
|
|
@ -1,31 +1,31 @@
|
|||
TextScriptEndingChar::
|
||||
db "@"
|
||||
TextScriptEndingText::
|
||||
text_end
|
||||
|
||||
TextScriptEnd::
|
||||
ld hl, TextScriptEndingChar
|
||||
ld hl, TextScriptEndingText
|
||||
ret
|
||||
|
||||
ExclamationText::
|
||||
TX_FAR _ExclamationText
|
||||
db "@"
|
||||
text_far _ExclamationText
|
||||
text_end
|
||||
|
||||
GroundRoseText::
|
||||
TX_FAR _GroundRoseText
|
||||
db "@"
|
||||
text_far _GroundRoseText
|
||||
text_end
|
||||
|
||||
BoulderText::
|
||||
TX_FAR _BoulderText
|
||||
db "@"
|
||||
text_far _BoulderText
|
||||
text_end
|
||||
|
||||
MartSignText::
|
||||
TX_FAR _MartSignText
|
||||
db "@"
|
||||
text_far _MartSignText
|
||||
text_end
|
||||
|
||||
PokeCenterSignText::
|
||||
TX_FAR _PokeCenterSignText
|
||||
db "@"
|
||||
text_far _PokeCenterSignText
|
||||
text_end
|
||||
|
||||
PickUpItemText::
|
||||
TX_ASM
|
||||
text_asm
|
||||
predef PickUpItem
|
||||
jp TextScriptEnd
|
||||
|
|
|
|||
|
|
@ -342,7 +342,7 @@ PrintStatusConditionNotFainted::
|
|||
; hl = destination address
|
||||
; [wLoadedMonLevel] = level
|
||||
PrintLevel::
|
||||
ld a, $6e ; ":L" tile ID
|
||||
ld a, "<LV>" ; ":L" tile ID
|
||||
ld [hli], a
|
||||
ld c, 2 ; number of digits
|
||||
ld a, [wLoadedMonLevel] ; level
|
||||
|
|
@ -358,7 +358,7 @@ PrintLevel::
|
|||
; hl = destination address
|
||||
; [wLoadedMonLevel] = level
|
||||
PrintLevelFull::
|
||||
ld a, $6e ; ":L" tile ID
|
||||
ld a, "<LV>" ; ":L" tile ID
|
||||
ld [hli], a
|
||||
ld c, 3 ; number of digits
|
||||
ld a, [wLoadedMonLevel] ; level
|
||||
|
|
|
|||
457
home/text.asm
457
home/text.asm
|
|
@ -5,9 +5,9 @@ TextBoxBorder::
|
|||
push hl
|
||||
ld a, "┌"
|
||||
ld [hli], a
|
||||
inc a ; ─
|
||||
call NPlaceChar
|
||||
inc a ; ┐
|
||||
inc a ; "─"
|
||||
call .PlaceChars
|
||||
inc a ; "┐"
|
||||
ld [hl], a
|
||||
pop hl
|
||||
|
||||
|
|
@ -20,7 +20,7 @@ TextBoxBorder::
|
|||
ld a, "│"
|
||||
ld [hli], a
|
||||
ld a, " "
|
||||
call NPlaceChar
|
||||
call .PlaceChars
|
||||
ld [hl], "│"
|
||||
pop hl
|
||||
|
||||
|
|
@ -33,11 +33,11 @@ TextBoxBorder::
|
|||
ld a, "└"
|
||||
ld [hli], a
|
||||
ld a, "─"
|
||||
call NPlaceChar
|
||||
call .PlaceChars
|
||||
ld [hl], "┘"
|
||||
ret
|
||||
|
||||
NPlaceChar::
|
||||
.PlaceChars::
|
||||
; Place char a c times.
|
||||
ld d, c
|
||||
.loop
|
||||
|
|
@ -48,19 +48,19 @@ NPlaceChar::
|
|||
|
||||
PlaceString::
|
||||
push hl
|
||||
|
||||
PlaceNextChar::
|
||||
ld a, [de]
|
||||
|
||||
cp "@"
|
||||
jr nz, Char4ETest
|
||||
jr nz, .NotTerminator
|
||||
ld b, h
|
||||
ld c, l
|
||||
pop hl
|
||||
ret
|
||||
|
||||
Char4ETest::
|
||||
cp $4E ; next
|
||||
jr nz, .char4FTest
|
||||
.NotTerminator
|
||||
cp "<NEXT>"
|
||||
jr nz, .NotNext
|
||||
ld bc, 2 * SCREEN_WIDTH
|
||||
ld a, [hFlagsFFF6]
|
||||
bit 2, a
|
||||
|
|
@ -70,142 +70,101 @@ Char4ETest::
|
|||
pop hl
|
||||
add hl, bc
|
||||
push hl
|
||||
jp PlaceNextChar_inc
|
||||
jp NextChar
|
||||
|
||||
.char4FTest
|
||||
cp $4F ; line
|
||||
jr nz, .next3
|
||||
.NotNext
|
||||
cp "<LINE>"
|
||||
jr nz, .NotLine
|
||||
pop hl
|
||||
coord hl, 1, 16
|
||||
push hl
|
||||
jp PlaceNextChar_inc
|
||||
jp NextChar
|
||||
|
||||
.next3 ; Check against a dictionary
|
||||
dict: macro
|
||||
if \1 == 0
|
||||
and a
|
||||
else
|
||||
cp \1
|
||||
endc
|
||||
jp z, \2
|
||||
endm
|
||||
.NotLine
|
||||
|
||||
dict $00, Char00 ; error
|
||||
dict $4C, Char4C ; autocont
|
||||
dict $4B, Char4B ; cont_
|
||||
dict $51, Char51 ; para
|
||||
dict $49, Char49 ; page
|
||||
dict $52, Char52 ; player
|
||||
dict $53, Char53 ; rival
|
||||
dict $54, Char54 ; POKé
|
||||
dict $5B, Char5B ; PC
|
||||
dict $5E, Char5E ; ROCKET
|
||||
dict $5C, Char5C ; TM
|
||||
dict $5D, Char5D ; TRAINER
|
||||
dict $55, Char55 ; cont
|
||||
dict $56, Char56 ; 6 dots
|
||||
dict $57, Char57 ; done
|
||||
dict $58, Char58 ; prompt
|
||||
dict $4A, Char4A ; PKMN
|
||||
dict $5F, Char5F ; dex
|
||||
dict $59, Char59 ; TARGET
|
||||
dict $5A, Char5A ; USER
|
||||
; Check against a dictionary
|
||||
dict "<NULL>", NullChar
|
||||
dict "<SCROLL>", _ContTextNoPause
|
||||
dict "<_CONT>", _ContText
|
||||
dict "<PARA>", Paragraph
|
||||
dict "<PAGE>", PageChar
|
||||
dict "<PLAYER>", PrintPlayerName
|
||||
dict "<RIVAL>", PrintRivalName
|
||||
dict "#", PlacePOKe
|
||||
dict "<PC>", PCChar
|
||||
dict "<ROCKET>", RocketChar
|
||||
dict "<TM>", TMChar
|
||||
dict "<TRAINER>", TrainerChar
|
||||
dict "<CONT>", ContText
|
||||
dict "<……>", SixDotsChar
|
||||
dict "<DONE>", DoneText
|
||||
dict "<PROMPT>", PromptText
|
||||
dict "<PKMN>", PlacePKMN
|
||||
dict "<DEXEND>", PlaceDexEnd
|
||||
dict "<TARGET>", PlaceMoveTargetsName
|
||||
dict "<USER>", PlaceMoveUsersName
|
||||
|
||||
ld [hli], a
|
||||
call PrintLetterDelay
|
||||
PlaceNextChar_inc::
|
||||
|
||||
NextChar::
|
||||
inc de
|
||||
jp PlaceNextChar
|
||||
|
||||
Char00::
|
||||
NullChar::
|
||||
ld b, h
|
||||
ld c, l
|
||||
pop hl
|
||||
ld de, Char00Text
|
||||
ld de, TextIDErrorText
|
||||
dec de
|
||||
ret
|
||||
|
||||
Char00Text:: ; “%d ERROR.”
|
||||
TX_FAR _Char00Text
|
||||
db "@"
|
||||
TextIDErrorText:: ; "[hSpriteIndexOrTextID] ERROR."
|
||||
text_far _TextIDErrorText
|
||||
text_end
|
||||
|
||||
Char52:: ; player’s name
|
||||
print_name: MACRO
|
||||
push de
|
||||
ld de, wPlayerName
|
||||
jr FinishDTE
|
||||
ld de, \1
|
||||
jr PlaceCommandCharacter
|
||||
ENDM
|
||||
|
||||
Char53:: ; rival’s name
|
||||
push de
|
||||
ld de, wRivalName
|
||||
jr FinishDTE
|
||||
PrintPlayerName:: print_name wPlayerName
|
||||
PrintRivalName:: print_name wRivalName
|
||||
|
||||
Char5D:: ; TRAINER
|
||||
push de
|
||||
ld de, Char5DText
|
||||
jr FinishDTE
|
||||
TrainerChar:: print_name TrainerCharText
|
||||
TMChar:: print_name TMCharText
|
||||
PCChar:: print_name PCCharText
|
||||
RocketChar:: print_name RocketCharText
|
||||
PlacePOKe:: print_name PlacePOKeText
|
||||
SixDotsChar:: print_name SixDotsCharText
|
||||
PlacePKMN:: print_name PlacePKMNText
|
||||
|
||||
Char5C:: ; TM
|
||||
push de
|
||||
ld de, Char5CText
|
||||
jr FinishDTE
|
||||
|
||||
Char5B:: ; PC
|
||||
push de
|
||||
ld de, Char5BText
|
||||
jr FinishDTE
|
||||
|
||||
Char5E:: ; ROCKET
|
||||
push de
|
||||
ld de, Char5EText
|
||||
jr FinishDTE
|
||||
|
||||
Char54:: ; POKé
|
||||
push de
|
||||
ld de, Char54Text
|
||||
jr FinishDTE
|
||||
|
||||
Char56:: ; ……
|
||||
push de
|
||||
ld de, Char56Text
|
||||
jr FinishDTE
|
||||
|
||||
Char4A:: ; PKMN
|
||||
push de
|
||||
ld de, Char4AText
|
||||
jr FinishDTE
|
||||
|
||||
Char59::
|
||||
; depending on whose turn it is, print
|
||||
; enemy active monster’s name, prefixed with “Enemy ”
|
||||
; or
|
||||
; player active monster’s name
|
||||
; (like Char5A but flipped)
|
||||
PlaceMoveTargetsName::
|
||||
ld a, [hWhoseTurn]
|
||||
xor 1
|
||||
jr MonsterNameCharsCommon
|
||||
jr PlaceMoveUsersName.place
|
||||
|
||||
Char5A::
|
||||
; depending on whose turn it is, print
|
||||
; player active monster’s name
|
||||
; or
|
||||
; enemy active monster’s name, prefixed with “Enemy ”
|
||||
PlaceMoveUsersName::
|
||||
ld a, [hWhoseTurn]
|
||||
MonsterNameCharsCommon::
|
||||
|
||||
.place:
|
||||
push de
|
||||
and a
|
||||
jr nz, .Enemy
|
||||
ld de, wBattleMonNick ; player active monster name
|
||||
jr FinishDTE
|
||||
jr nz, .enemy
|
||||
|
||||
.Enemy
|
||||
; print “Enemy ”
|
||||
ld de, Char5AText
|
||||
ld de, wBattleMonNick
|
||||
jr PlaceCommandCharacter
|
||||
|
||||
.enemy
|
||||
ld de, EnemyText
|
||||
call PlaceString
|
||||
ld h, b
|
||||
ld l, c
|
||||
ld de, wEnemyMonNick ; enemy active monster name
|
||||
ld de, wEnemyMonNick
|
||||
; fallthrough
|
||||
|
||||
FinishDTE::
|
||||
PlaceCommandCharacter::
|
||||
call PlaceString
|
||||
ld h, b
|
||||
ld l, c
|
||||
|
|
@ -213,28 +172,20 @@ FinishDTE::
|
|||
inc de
|
||||
jp PlaceNextChar
|
||||
|
||||
Char5CText::
|
||||
db "TM@"
|
||||
Char5DText::
|
||||
db "TRAINER@"
|
||||
Char5BText::
|
||||
db "PC@"
|
||||
Char5EText::
|
||||
db "ROCKET@"
|
||||
Char54Text::
|
||||
db "POKé@"
|
||||
Char56Text::
|
||||
db "……@"
|
||||
Char5AText::
|
||||
db "Enemy @"
|
||||
Char4AText::
|
||||
db $E1,$E2,"@" ; PKMN
|
||||
TMCharText:: db "TM@"
|
||||
TrainerCharText:: db "TRAINER@"
|
||||
PCCharText:: db "PC@"
|
||||
RocketCharText:: db "ROCKET@"
|
||||
PlacePOKeText:: db "POKé@"
|
||||
SixDotsCharText:: db "……@"
|
||||
EnemyText:: db "Enemy @"
|
||||
PlacePKMNText:: db "<PK><MN>@"
|
||||
|
||||
Char55::
|
||||
ContText::
|
||||
push de
|
||||
ld b, h
|
||||
ld c, l
|
||||
ld hl, Char55Text
|
||||
ld hl, ContCharText
|
||||
call TextCommandProcessor
|
||||
ld h, b
|
||||
ld l, c
|
||||
|
|
@ -242,18 +193,16 @@ Char55::
|
|||
inc de
|
||||
jp PlaceNextChar
|
||||
|
||||
Char55Text::
|
||||
; equivalent to Char4B
|
||||
TX_FAR _Char55Text
|
||||
db "@"
|
||||
ContCharText::
|
||||
text_far _ContCharText
|
||||
text_end
|
||||
|
||||
Char5F::
|
||||
; ends a Pokédex entry
|
||||
PlaceDexEnd::
|
||||
ld [hl], "."
|
||||
pop hl
|
||||
ret
|
||||
|
||||
Char58:: ; prompt
|
||||
PromptText::
|
||||
ld a, [wLinkState]
|
||||
cp LINK_STATE_BATTLING
|
||||
jp z, .ok
|
||||
|
|
@ -264,16 +213,17 @@ Char58:: ; prompt
|
|||
call ManualTextScroll
|
||||
ld a, " "
|
||||
Coorda 18, 16
|
||||
Char57:: ; done
|
||||
|
||||
DoneText::
|
||||
pop hl
|
||||
ld de, Char58Text
|
||||
ld de, .stop
|
||||
dec de
|
||||
ret
|
||||
|
||||
Char58Text::
|
||||
db "@"
|
||||
.stop:
|
||||
text_end
|
||||
|
||||
Char51:: ; para
|
||||
Paragraph::
|
||||
push de
|
||||
ld a, "▼"
|
||||
Coorda 18, 16
|
||||
|
|
@ -286,9 +236,9 @@ Char51:: ; para
|
|||
call DelayFrames
|
||||
pop de
|
||||
coord hl, 1, 14
|
||||
jp PlaceNextChar_inc
|
||||
jp NextChar
|
||||
|
||||
Char49::
|
||||
PageChar::
|
||||
push de
|
||||
ld a, "▼"
|
||||
Coorda 18, 16
|
||||
|
|
@ -303,9 +253,9 @@ Char49::
|
|||
pop hl
|
||||
coord hl, 1, 11
|
||||
push hl
|
||||
jp PlaceNextChar_inc
|
||||
jp NextChar
|
||||
|
||||
Char4B::
|
||||
_ContText::
|
||||
ld a, "▼"
|
||||
Coorda 18, 16
|
||||
call ProtectedDelay3
|
||||
|
|
@ -314,14 +264,13 @@ Char4B::
|
|||
pop de
|
||||
ld a, " "
|
||||
Coorda 18, 16
|
||||
;fall through
|
||||
Char4C::
|
||||
_ContTextNoPause::
|
||||
push de
|
||||
call ScrollTextUpOneLine
|
||||
call ScrollTextUpOneLine
|
||||
coord hl, 1, 16
|
||||
pop de
|
||||
jp PlaceNextChar_inc
|
||||
jp NextChar
|
||||
|
||||
; move both rows of text in the normal text box up one row
|
||||
; always called twice in a row
|
||||
|
|
@ -345,7 +294,6 @@ ScrollTextUpOneLine::
|
|||
dec b
|
||||
jr nz, .clearText
|
||||
|
||||
; wait five frames
|
||||
ld b, 5
|
||||
.WaitFrame
|
||||
call DelayFrame
|
||||
|
|
@ -375,18 +323,18 @@ TextCommandProcessor::
|
|||
|
||||
NextTextCommand::
|
||||
ld a, [hli]
|
||||
cp "@" ; terminator
|
||||
jr nz, .doTextCommand
|
||||
cp TX_END
|
||||
jr nz, .TextCommand
|
||||
pop af
|
||||
ld [wLetterPrintingDelayFlags], a
|
||||
ret
|
||||
.doTextCommand
|
||||
|
||||
.TextCommand:
|
||||
push hl
|
||||
cp $17
|
||||
jp z, TextCommand17
|
||||
cp $0e
|
||||
jp nc, TextCommand0B ; if a != 0x17 and a >= 0xE, go to command 0xB
|
||||
; if a < 0xE, use a jump table
|
||||
cp TX_FAR
|
||||
jp z, TextCommand_FAR
|
||||
cp TX_SOUND_POKEDEX_RATING
|
||||
jp nc, TextCommand_SOUND
|
||||
ld hl, TextCommandJumpTable
|
||||
push bc
|
||||
add a
|
||||
|
|
@ -399,12 +347,8 @@ NextTextCommand::
|
|||
ld l, a
|
||||
jp hl
|
||||
|
||||
; draw box
|
||||
; 04AAAABBCC
|
||||
; AAAA = address of upper left corner
|
||||
; BB = height
|
||||
; CC = width
|
||||
TextCommand04::
|
||||
TextCommand_BOX::
|
||||
; draw a box (height, width)
|
||||
pop hl
|
||||
ld a, [hli]
|
||||
ld e, a
|
||||
|
|
@ -421,9 +365,8 @@ TextCommand04::
|
|||
pop hl
|
||||
jr NextTextCommand
|
||||
|
||||
; place string inline
|
||||
; 00{string}
|
||||
TextCommand00::
|
||||
TextCommand_START::
|
||||
; write text until "@"
|
||||
pop hl
|
||||
ld d, h
|
||||
ld e, l
|
||||
|
|
@ -435,10 +378,8 @@ TextCommand00::
|
|||
inc hl
|
||||
jr NextTextCommand
|
||||
|
||||
; place string from RAM
|
||||
; 01AAAA
|
||||
; AAAA = address of string
|
||||
TextCommand01::
|
||||
TextCommand_RAM::
|
||||
; write text from a ram address (little endian)
|
||||
pop hl
|
||||
ld a, [hli]
|
||||
ld e, a
|
||||
|
|
@ -451,13 +392,8 @@ TextCommand01::
|
|||
pop hl
|
||||
jr NextTextCommand
|
||||
|
||||
; print BCD number
|
||||
; 02AAAABB
|
||||
; AAAA = address of BCD number
|
||||
; BB
|
||||
; bits 0-4 = length in bytes
|
||||
; bits 5-7 = unknown flags
|
||||
TextCommand02::
|
||||
TextCommand_BCD::
|
||||
; write bcd from address, typically ram
|
||||
pop hl
|
||||
ld a, [hli]
|
||||
ld e, a
|
||||
|
|
@ -474,10 +410,8 @@ TextCommand02::
|
|||
pop hl
|
||||
jr NextTextCommand
|
||||
|
||||
; repoint destination address
|
||||
; 03AAAA
|
||||
; AAAA = new destination address
|
||||
TextCommand03::
|
||||
TextCommand_MOVE::
|
||||
; move to a new tile
|
||||
pop hl
|
||||
ld a, [hli]
|
||||
ld [wTextDest], a
|
||||
|
|
@ -487,21 +421,17 @@ TextCommand03::
|
|||
ld b, a
|
||||
jp NextTextCommand
|
||||
|
||||
; repoint destination to second line of dialogue text box
|
||||
; 05
|
||||
; (no arguments)
|
||||
TextCommand05::
|
||||
TextCommand_LOW::
|
||||
; write text at (1,16)
|
||||
pop hl
|
||||
coord bc, 1, 16 ; address of second line of dialogue text box
|
||||
coord bc, 1, 16 ; second line of dialogue text box
|
||||
jp NextTextCommand
|
||||
|
||||
; blink arrow and wait for A or B to be pressed
|
||||
; 06
|
||||
; (no arguments)
|
||||
TextCommand06::
|
||||
TextCommand_PROMPT_BUTTON::
|
||||
; wait for button press; show arrow
|
||||
ld a, [wLinkState]
|
||||
cp LINK_STATE_BATTLING
|
||||
jp z, TextCommand0D
|
||||
jp z, TextCommand_LINK_PROMPT_BUTTON
|
||||
ld a, "▼"
|
||||
Coorda 18, 16 ; place down arrow in lower right corner of dialogue text box
|
||||
push bc
|
||||
|
|
@ -512,33 +442,26 @@ TextCommand06::
|
|||
pop hl
|
||||
jp NextTextCommand
|
||||
|
||||
; scroll text up one line
|
||||
; 07
|
||||
; (no arguments)
|
||||
TextCommand07::
|
||||
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.
|
||||
ld a, " "
|
||||
Coorda 18, 16 ; place blank space in lower right corner of dialogue text box
|
||||
call ScrollTextUpOneLine
|
||||
call ScrollTextUpOneLine
|
||||
pop hl
|
||||
coord bc, 1, 16 ; address of second line of dialogue text box
|
||||
coord bc, 1, 16 ; second line of dialogue text box
|
||||
jp NextTextCommand
|
||||
|
||||
; execute asm inline
|
||||
; 08{code}
|
||||
TextCommand08::
|
||||
TextCommand_START_ASM::
|
||||
; run assembly code
|
||||
pop hl
|
||||
ld de, NextTextCommand
|
||||
push de ; return address
|
||||
push de
|
||||
jp hl
|
||||
|
||||
; print decimal number (converted from binary number)
|
||||
; 09AAAABB
|
||||
; AAAA = address of number
|
||||
; BB
|
||||
; bits 0-3 = how many digits to display
|
||||
; bits 4-7 = how long the number is in bytes
|
||||
TextCommand09::
|
||||
TextCommand_NUM::
|
||||
; print a number
|
||||
pop hl
|
||||
ld a, [hli]
|
||||
ld e, a
|
||||
|
|
@ -554,7 +477,7 @@ TextCommand09::
|
|||
ld a, b
|
||||
and $f0
|
||||
swap a
|
||||
set BIT_LEFT_ALIGN,a
|
||||
set BIT_LEFT_ALIGN, a
|
||||
ld b, a
|
||||
call PrintNumber
|
||||
ld b, h
|
||||
|
|
@ -562,45 +485,42 @@ TextCommand09::
|
|||
pop hl
|
||||
jp NextTextCommand
|
||||
|
||||
; wait half a second if the user doesn't hold A or B
|
||||
; 0A
|
||||
; (no arguments)
|
||||
TextCommand0A::
|
||||
TextCommand_PAUSE::
|
||||
; wait for button press or 30 frames
|
||||
push bc
|
||||
call Joypad
|
||||
ld a, [hJoyHeld]
|
||||
and A_BUTTON | B_BUTTON
|
||||
jr nz, .skipDelay
|
||||
ld c, 30
|
||||
jr nz, .done
|
||||
ld c, 30 ; half a second
|
||||
call DelayFrames
|
||||
.skipDelay
|
||||
.done
|
||||
pop bc
|
||||
pop hl
|
||||
jp NextTextCommand
|
||||
|
||||
; plays sounds
|
||||
; this actually handles various command ID's, not just 0B
|
||||
; (no arguments)
|
||||
TextCommand0B::
|
||||
TextCommand_SOUND::
|
||||
; play a sound effect from TextCommandSounds
|
||||
pop hl
|
||||
push bc
|
||||
dec hl
|
||||
ld a, [hli]
|
||||
ld b, a ; b = command number that got us here
|
||||
ld b, a ; b = text command number that got us here
|
||||
push hl
|
||||
ld hl, TextCommandSounds
|
||||
.loop
|
||||
ld a, [hli]
|
||||
cp b
|
||||
jr z, .matchFound
|
||||
jr z, .play
|
||||
inc hl
|
||||
jr .loop
|
||||
.matchFound
|
||||
cp $14
|
||||
|
||||
.play
|
||||
cp TX_SOUND_CRY_NIDORINA
|
||||
jr z, .pokemonCry
|
||||
cp $15
|
||||
cp TX_SOUND_CRY_PIDGEOT
|
||||
jr z, .pokemonCry
|
||||
cp $16
|
||||
cp TX_SOUND_CRY_DEWGONG
|
||||
jr z, .pokemonCry
|
||||
ld a, [hl]
|
||||
call PlaySound
|
||||
|
|
@ -608,6 +528,7 @@ TextCommand0B::
|
|||
pop hl
|
||||
pop bc
|
||||
jp NextTextCommand
|
||||
|
||||
.pokemonCry
|
||||
push de
|
||||
ld a, [hl]
|
||||
|
|
@ -617,29 +538,27 @@ TextCommand0B::
|
|||
pop bc
|
||||
jp NextTextCommand
|
||||
|
||||
; format: text command ID, sound ID or cry ID
|
||||
TextCommandSounds::
|
||||
db $0B, SFX_GET_ITEM_1 ; actually plays SFX_LEVEL_UP when the battle music engine is loaded
|
||||
db $12, SFX_CAUGHT_MON
|
||||
db $0E, SFX_POKEDEX_RATING ; unused?
|
||||
db $0F, SFX_GET_ITEM_1 ; unused?
|
||||
db $10, SFX_GET_ITEM_2
|
||||
db $11, SFX_GET_KEY_ITEM
|
||||
db $13, SFX_DEX_PAGE_ADDED
|
||||
db $14, NIDORINA ; used in OakSpeech
|
||||
db $15, PIDGEOT ; used in SaffronCityText12
|
||||
db $16, DEWGONG ; unused?
|
||||
db TX_SOUND_GET_ITEM_1, SFX_GET_ITEM_1 ; actually plays SFX_LEVEL_UP when the battle music engine is loaded
|
||||
db TX_SOUND_CAUGHT_MON, SFX_CAUGHT_MON
|
||||
db TX_SOUND_POKEDEX_RATING, SFX_POKEDEX_RATING ; unused
|
||||
db TX_SOUND_GET_ITEM_1_DUPLICATE, SFX_GET_ITEM_1 ; unused
|
||||
db TX_SOUND_GET_ITEM_2, SFX_GET_ITEM_2
|
||||
db TX_SOUND_GET_KEY_ITEM, SFX_GET_KEY_ITEM
|
||||
db TX_SOUND_DEX_PAGE_ADDED, SFX_DEX_PAGE_ADDED
|
||||
db TX_SOUND_CRY_NIDORINA, NIDORINA ; used in OakSpeech
|
||||
db TX_SOUND_CRY_PIDGEOT, PIDGEOT ; used in SaffronCityText12
|
||||
db TX_SOUND_CRY_DEWGONG, DEWGONG ; unused
|
||||
|
||||
; draw ellipses
|
||||
; 0CAA
|
||||
; AA = number of ellipses to draw
|
||||
TextCommand0C::
|
||||
TextCommand_DOTS::
|
||||
; wait for button press or 30 frames while printing "…"s
|
||||
pop hl
|
||||
ld a, [hli]
|
||||
ld d, a
|
||||
push hl
|
||||
ld h, b
|
||||
ld l, c
|
||||
|
||||
.loop
|
||||
ld a, "…"
|
||||
ld [hli], a
|
||||
|
|
@ -648,64 +567,66 @@ TextCommand0C::
|
|||
pop de
|
||||
ld a, [hJoyHeld] ; joypad state
|
||||
and A_BUTTON | B_BUTTON
|
||||
jr nz, .skipDelay ; if so, skip the delay
|
||||
jr nz, .next ; if so, skip the delay
|
||||
ld c, 10
|
||||
call DelayFrames
|
||||
.skipDelay
|
||||
.next
|
||||
dec d
|
||||
jr nz, .loop
|
||||
|
||||
ld b, h
|
||||
ld c, l
|
||||
pop hl
|
||||
jp NextTextCommand
|
||||
|
||||
; wait for A or B to be pressed
|
||||
; 0D
|
||||
; (no arguments)
|
||||
TextCommand0D::
|
||||
TextCommand_LINK_PROMPT_BUTTON::
|
||||
; wait for button press; display arrow
|
||||
push bc
|
||||
call ManualTextScroll ; wait for A or B to be pressed
|
||||
call ManualTextScroll
|
||||
pop bc
|
||||
pop hl
|
||||
jp NextTextCommand
|
||||
|
||||
; process text commands in another ROM bank
|
||||
; 17AAAABB
|
||||
; AAAA = address of text commands
|
||||
; BB = bank
|
||||
TextCommand17::
|
||||
TextCommand_FAR::
|
||||
; write text from a different bank (little endian)
|
||||
pop hl
|
||||
ld a, [hLoadedROMBank]
|
||||
push af
|
||||
|
||||
ld a, [hli]
|
||||
ld e, a
|
||||
ld a, [hli]
|
||||
ld d, a
|
||||
ld a, [hli]
|
||||
|
||||
ld [hLoadedROMBank], a
|
||||
ld [MBC1RomBank], a
|
||||
|
||||
push hl
|
||||
ld l, e
|
||||
ld h, d
|
||||
call TextCommandProcessor
|
||||
pop hl
|
||||
|
||||
pop af
|
||||
ld [hLoadedROMBank], a
|
||||
ld [MBC1RomBank], a
|
||||
jp NextTextCommand
|
||||
|
||||
TextCommandJumpTable::
|
||||
dw TextCommand00
|
||||
dw TextCommand01
|
||||
dw TextCommand02
|
||||
dw TextCommand03
|
||||
dw TextCommand04
|
||||
dw TextCommand05
|
||||
dw TextCommand06
|
||||
dw TextCommand07
|
||||
dw TextCommand08
|
||||
dw TextCommand09
|
||||
dw TextCommand0A
|
||||
dw TextCommand0B
|
||||
dw TextCommand0C
|
||||
dw TextCommand0D
|
||||
; entries correspond to TX_* constants (see macros/scripts/text.asm)
|
||||
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_GET_ITEM_1 (also handles other TX_SOUND_* commands)
|
||||
dw TextCommand_DOTS ; TX_DOTS
|
||||
dw TextCommand_LINK_PROMPT_BUTTON ; TX_LINK_PROMPT_BUTTON
|
||||
; greater TX_* constants are handled directly by NextTextCommand
|
||||
|
|
|
|||
|
|
@ -20,16 +20,13 @@ DisplayTextID::
|
|||
ld d, $00
|
||||
ld a, [hSpriteIndexOrTextID] ; text ID
|
||||
ld [wSpriteIndex], a
|
||||
and a
|
||||
jp z, DisplayStartMenu
|
||||
cp TEXT_SAFARI_GAME_OVER
|
||||
jp z, DisplaySafariGameOverText
|
||||
cp TEXT_MON_FAINTED
|
||||
jp z, DisplayPokemonFaintedText
|
||||
cp TEXT_BLACKED_OUT
|
||||
jp z, DisplayPlayerBlackedOutText
|
||||
cp TEXT_REPEL_WORE_OFF
|
||||
jp z, DisplayRepelWoreOffText
|
||||
|
||||
dict TEXT_START_MENU, DisplayStartMenu
|
||||
dict TEXT_SAFARI_GAME_OVER, DisplaySafariGameOverText
|
||||
dict TEXT_MON_FAINTED, DisplayPokemonFaintedText
|
||||
dict TEXT_BLACKED_OUT, DisplayPlayerBlackedOutText
|
||||
dict TEXT_REPEL_WORE_OFF, DisplayRepelWoreOffText
|
||||
|
||||
ld a, [wNumSprites]
|
||||
ld e, a
|
||||
ld a, [hSpriteIndexOrTextID] ; sprite ID
|
||||
|
|
@ -66,29 +63,26 @@ DisplayTextID::
|
|||
ld h, [hl]
|
||||
ld l, a ; hl = address of the text
|
||||
ld a, [hl] ; a = first byte of text
|
||||
|
||||
; check first byte of text for special cases
|
||||
cp $fe ; Pokemart NPC
|
||||
jp z, DisplayPokemartDialogue
|
||||
cp $ff ; Pokemon Center NPC
|
||||
jp z, DisplayPokemonCenterDialogue
|
||||
cp $fc ; Item Storage PC
|
||||
jp z, FuncTX_ItemStoragePC
|
||||
cp $fd ; Bill's PC
|
||||
jp z, FuncTX_BillsPC
|
||||
cp $f9 ; Pokemon Center PC
|
||||
jp z, FuncTX_PokemonCenterPC
|
||||
cp $f5 ; Vending Machine
|
||||
jr nz, .notVendingMachine
|
||||
callba VendingMachineMenu ; jump banks to vending machine routine
|
||||
|
||||
dict2: MACRO
|
||||
cp \1
|
||||
jr nz, .not\@
|
||||
\2
|
||||
jr AfterDisplayingTextID
|
||||
.notVendingMachine
|
||||
cp $f7 ; prize menu
|
||||
jp z, FuncTX_GameCornerPrizeMenu
|
||||
cp $f6 ; cable connection NPC in Pokemon Center
|
||||
jr nz, .notSpecialCase
|
||||
callab CableClubNPC
|
||||
jr AfterDisplayingTextID
|
||||
.notSpecialCase
|
||||
.not\@
|
||||
ENDM
|
||||
|
||||
dict TX_SCRIPT_MART, DisplayPokemartDialogue
|
||||
dict TX_SCRIPT_POKECENTER_NURSE, DisplayPokemonCenterDialogue
|
||||
dict TX_SCRIPT_PLAYERS_PC, TextScript_ItemStoragePC
|
||||
dict TX_SCRIPT_BILLS_PC, TextScript_BillsPC
|
||||
dict TX_SCRIPT_POKECENTER_PC, TextScript_PokemonCenterPC
|
||||
dict2 TX_SCRIPT_VENDING_MACHINE, callba VendingMachineMenu
|
||||
dict TX_SCRIPT_PRIZE_VENDOR, TextScript_GameCornerPrizeMenu
|
||||
dict2 TX_SCRIPT_CABLE_CLUB_RECEPTIONIST, callab CableClubNPC
|
||||
|
||||
call PrintText_NoCreatingTextBox ; display the text
|
||||
ld a, [wDoNotWaitForButtonPressAfterDisplayingText]
|
||||
and a
|
||||
|
|
@ -164,8 +158,8 @@ DisplayPokemartDialogue::
|
|||
jp AfterDisplayingTextID
|
||||
|
||||
PokemartGreetingText::
|
||||
TX_FAR _PokemartGreetingText
|
||||
db "@"
|
||||
text_far _PokemartGreetingText
|
||||
text_end
|
||||
|
||||
LoadItemList::
|
||||
ld a, 1
|
||||
|
|
@ -212,8 +206,8 @@ DisplayPokemonFaintedText::
|
|||
jp AfterDisplayingTextID
|
||||
|
||||
PokemonFaintedText::
|
||||
TX_FAR _PokemonFaintedText
|
||||
db "@"
|
||||
text_far _PokemonFaintedText
|
||||
text_end
|
||||
|
||||
DisplayPlayerBlackedOutText::
|
||||
ld hl, PlayerBlackedOutText
|
||||
|
|
@ -224,8 +218,8 @@ DisplayPlayerBlackedOutText::
|
|||
jp HoldTextDisplayOpen
|
||||
|
||||
PlayerBlackedOutText::
|
||||
TX_FAR _PlayerBlackedOutText
|
||||
db "@"
|
||||
text_far _PlayerBlackedOutText
|
||||
text_end
|
||||
|
||||
DisplayRepelWoreOffText::
|
||||
ld hl, RepelWoreOffText
|
||||
|
|
@ -233,5 +227,5 @@ DisplayRepelWoreOffText::
|
|||
jp AfterDisplayingTextID
|
||||
|
||||
RepelWoreOffText::
|
||||
TX_FAR _RepelWoreOffText
|
||||
db "@"
|
||||
text_far _RepelWoreOffText
|
||||
text_end
|
||||
|
|
@ -371,8 +371,8 @@ GetSavedEndBattleTextPointer::
|
|||
ret
|
||||
|
||||
TrainerEndBattleText::
|
||||
TX_FAR _TrainerNameText
|
||||
TX_ASM
|
||||
text_far _TrainerNameText
|
||||
text_asm
|
||||
call GetSavedEndBattleTextPointer
|
||||
call TextCommandProcessor
|
||||
jp TextScriptEnd
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue