Digimon World 3 decomp
The European version, SLES_039.36
Loading...
Searching...
No Matches
text_window.c File Reference
#include "engine/game.h"
Include dependency graph for text_window.c:

Go to the source code of this file.

Functions

void setTextBuffer (TextWindow *obj, TextBuffer *buf, const char *text)
 Copies a string into one of a window's text buffers, growing it as needed (NULL shows STR_NULL_MESSAGE)
 
void textWindowSetText (TextWindow *obj, const char *text)
 Text window method: shows a string.
 
void textWindowSetString (TextWindow *obj, char *text, s32 id)
 Text window method: shows string id of a string table (-1: text itself)
 
void formatNumber (u8 *buf, s32 value)
 Writes a number's decimal digits (0 for zero or less)
 
void textWindowSetNumber (TextWindow *obj, u32 index, s32 value)
 Text window method: puts a number into text buffer index, in the font's digit glyphs.
 
void textWindowSetSubText (TextWindow *obj, const char *text, s32 index)
 Text window method: puts a string into work buffer index (1-5), for control code 5.
 
void textWindowSetSubString (TextWindow *obj, char *text, s32 id, s32 index)
 Text window method: puts string id of a table (-1: text itself) into text buffer index
 
void textWindowDraw (TextWindow *obj)
 Text window method: draws the visible part of the text as sprites, running the control codes.
 
void textWindowShowPage (TextWindow *obj)
 Text window method: makes the whole current page visible at once.
 
void textWindowSetStyle (TextWindow *obj, s32 style)
 Text window method: one of the three font styles (others pick style 1)
 
void textWindowSetTypeDelay (TextWindow *obj, s32 delay)
 Text window method: types the text out a character every delay frames (0 or less: all at once)
 
void textWindowSetPos (TextWindow *obj, s16 x, s16 y)
 Text window method: moves the window.
 
void textWindowSetPalette (TextWindow *obj, u8 palette)
 Text window method: the CLUT row of the glyphs.
 
void textWindowSetBlend (TextWindow *obj, u8 blend)
 Text window method: the glyphs' blending.
 
void textWindowSetSpacing (TextWindow *obj, s16 x, s16 y)
 Text window method: a fixed advance and line height (0, 0: the style's)
 
void textWindowSetVisible (TextWindow *obj, u8 visible)
 Text window method: shows or hides the window (an empty text stays hidden)
 
void textWindowSetRightAlign (TextWindow *obj, u8 type)
 Text window method: aligns the text to its right end, or back to the left.
 
void textWindowInsertPlayerName (TextWindow *obj)
 Text window method: fills the work buffers that control code 8 asks for with the player's name.
 
void textWindowSetTypeSound (TextWindow *obj, s32 sound)
 Text window method: the sound each typed character plays (0 for none)
 
void textWindowSetScale (TextWindow *obj, s32 x, s32 y)
 Text window method: scales the glyphs.
 
void textWindowSetPivot (TextWindow *obj, s32 x, s32 y)
 Text window method: the point the glyphs scale around.
 
void textWindowSetDepth (TextWindow *obj, s32 depth)
 Text window method: the OT depth the glyphs are drawn at.
 
void textWindowSetLines (TextWindow *obj, u8 lines)
 Text window method: the lines of a page.
 
void textWindowSetUnusedC4 (TextWindow *obj, u8 value)
 Text window method: sets unusedC4, which nothing reads.
 
s32 textWindowIsFinished (TextWindow *obj)
 Text window method: whether the end of the text was reached.
 
s32 textWindowIsVisible (TextWindow *obj)
 Text window method: whether the window is shown.
 
s32 textWindowIsWaitingForButton (TextWindow *obj)
 Text window method: whether the text waits for a button (control code 2)
 
s32 processTextChar (TextWindow *obj, TextBuffer *text, TextDraw *draw, s16 *pos)
 Picks the glyph of the next character, or runs its control code; returns what the drawing does next.
 
s32 textCodeDefault (TextWindow *obj, TextBuffer *buf)
 Control codes 0, 7 and 9: show the page, or (code 7) start the text after a speaker's name.
 
s32 textCodeNewLine (TextWindow *obj, TextBuffer *buf, TextDraw *draw)
 Control code 1: a new line, or a new page when the page is full.
 
s32 textCodeWaitButton (TextWindow *obj, TextBuffer *buf)
 Control code 2: waits for one of TEXT_WAIT_BUTTONS.
 
s32 textCodePageBreak (TextWindow *obj, TextBuffer *buf)
 Control code 3: starts a new page.
 
s32 textCodeIgnore (void)
 Control code 4: skipped.
 
s32 textCodeInsert (TextWindow *obj, TextBuffer *buf, TextDraw *draw)
 Control code 5: draws the next character of a work buffer in its place.
 
s32 textCodePause (TextWindow *obj, TextBuffer *buf)
 Control code 6: pauses the typing for some frames, once.
 
s32 textCodePlayerName (TextWindow *obj, TextBuffer *buf)
 Control code 8: puts the player's name into a work buffer, once.
 
void updateTextWindow (TextWindow *obj)
 The text window task: types and draws the text, waits where the control codes say, frees the buffers at the end.
 
TextWindow * createTextWindow (s16 layerId, s16 style, s16 x, s16 y)
 A text window on a layer, in a font style, at (x, y)
 

Variables

const char STR_NULL_MESSAGE []
 "Null message was passed"
 
const char STR_BAD_DIGIT_BUFFER []
 "Digit: the message's work number is not supported"
 
const char STR_BAD_EXT_BUFFER []
 "ExtMess: the message's work number is not supported"
 
const char STR_MESSAGE_NOT_SET []
 "The message is not set"
 
s32(* TEXT_CODE_HANDLERS [11])()
 The handlers of the control codes 0x02 <code> (processTextChar)
 
s32 TEXT_WAIT_BUTTONS [5] = { 13 , 12 , 13 , 14 , 15 }
 The buttons a wait for a button (code 2) can wait for.
 

Function Documentation

◆ setTextBuffer()

void setTextBuffer ( TextWindow *  obj,
TextBuffer *  buf,
const char *  text 
)

Copies a string into one of a window's text buffers, growing it as needed (NULL shows STR_NULL_MESSAGE)

< the current mode's: freed by main whenever the mode task ends

Definition at line 24 of file text_window.c.

Referenced by setTextBuffer(), textWindowSetNumber(), textWindowSetSubString(), textWindowSetSubText(), and textWindowSetText().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ textWindowSetText()

void textWindowSetText ( TextWindow *  obj,
const char *  text 
)

Text window method: shows a string.

Definition at line 68 of file text_window.c.

Referenced by createTextWindow(), textWindowSetNumber(), and textWindowSetSubText().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ textWindowSetString()

void textWindowSetString ( TextWindow *  obj,
char *  text,
s32  id 
)

Text window method: shows string id of a string table (-1: text itself)

Definition at line 73 of file text_window.c.

Referenced by createTextWindow().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ formatNumber()

void formatNumber ( u8 *  buf,
s32  value 
)

Writes a number's decimal digits (0 for zero or less)

Definition at line 78 of file text_window.c.

Referenced by textWindowSetNumber().

Here is the caller graph for this function:

◆ textWindowSetNumber()

void textWindowSetNumber ( TextWindow *  obj,
u32  index,
s32  value 
)

Text window method: puts a number into text buffer index, in the font's digit glyphs.

Definition at line 106 of file text_window.c.

Referenced by createTextWindow().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ textWindowSetSubText()

void textWindowSetSubText ( TextWindow *  obj,
const char *  text,
s32  index 
)

Text window method: puts a string into work buffer index (1-5), for control code 5.

Definition at line 127 of file text_window.c.

Referenced by createTextWindow(), textCodeInsert(), and textWindowInsertPlayerName().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ textWindowSetSubString()

void textWindowSetSubString ( TextWindow *  obj,
char *  text,
s32  id,
s32  index 
)

Text window method: puts string id of a table (-1: text itself) into text buffer index

Definition at line 136 of file text_window.c.

Referenced by createTextWindow(), textCodePlayerName(), and textWindowSetString().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ textWindowDraw()

void textWindowDraw ( TextWindow *  obj)

Text window method: draws the visible part of the text as sprites, running the control codes.

< GTE regards 4096 as 1.0

Definition at line 154 of file text_window.c.

Referenced by createTextWindow(), and updateTextWindow().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ textWindowShowPage()

void textWindowShowPage ( TextWindow *  obj)

Text window method: makes the whole current page visible at once.

Definition at line 309 of file text_window.c.

Referenced by createTextWindow(), textCodeDefault(), and textCodeNewLine().

Here is the caller graph for this function:

◆ textWindowSetStyle()

void textWindowSetStyle ( TextWindow *  obj,
s32  style 
)

Text window method: one of the three font styles (others pick style 1)

Definition at line 381 of file text_window.c.

Referenced by createTextWindow().

Here is the caller graph for this function:

◆ textWindowSetTypeDelay()

void textWindowSetTypeDelay ( TextWindow *  obj,
s32  delay 
)

Text window method: types the text out a character every delay frames (0 or less: all at once)

Definition at line 395 of file text_window.c.

Referenced by createTextWindow(), and setTextBuffer().

Here is the caller graph for this function:

◆ textWindowSetPos()

void textWindowSetPos ( TextWindow *  obj,
s16  x,
s16  y 
)

Text window method: moves the window.

Definition at line 409 of file text_window.c.

Referenced by createTextWindow().

Here is the caller graph for this function:

◆ textWindowSetPalette()

void textWindowSetPalette ( TextWindow *  obj,
u8  palette 
)

Text window method: the CLUT row of the glyphs.

Definition at line 415 of file text_window.c.

Referenced by createTextWindow().

Here is the caller graph for this function:

◆ textWindowSetBlend()

void textWindowSetBlend ( TextWindow *  obj,
u8  blend 
)

Text window method: the glyphs' blending.

An old-style definition, as TextWindow.setBlend's unprototyped callers suit: they pass an int, which it takes as a byte. setSpacing, setRightAlign, setLines and setUnusedC4 are old-style for the same reason.

Definition at line 425 of file text_window.c.

Referenced by createTextWindow().

Here is the caller graph for this function:

◆ textWindowSetSpacing()

void textWindowSetSpacing ( TextWindow *  obj,
s16  x,
s16  y 
)

Text window method: a fixed advance and line height (0, 0: the style's)

Definition at line 433 of file text_window.c.

Referenced by createTextWindow().

Here is the caller graph for this function:

◆ textWindowSetVisible()

void textWindowSetVisible ( TextWindow *  obj,
u8  visible 
)

Text window method: shows or hides the window (an empty text stays hidden)

Definition at line 450 of file text_window.c.

Referenced by createTextWindow().

Here is the caller graph for this function:

◆ textWindowSetRightAlign()

void textWindowSetRightAlign ( TextWindow *  obj,
u8  type 
)

Text window method: aligns the text to its right end, or back to the left.

Definition at line 459 of file text_window.c.

Referenced by createTextWindow().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ textWindowInsertPlayerName()

void textWindowInsertPlayerName ( TextWindow *  obj)

Text window method: fills the work buffers that control code 8 asks for with the player's name.

Definition at line 474 of file text_window.c.

Referenced by createTextWindow().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ textWindowSetTypeSound()

void textWindowSetTypeSound ( TextWindow *  obj,
s32  sound 
)

Text window method: the sound each typed character plays (0 for none)

Definition at line 517 of file text_window.c.

Referenced by createTextWindow().

Here is the caller graph for this function:

◆ textWindowSetScale()

void textWindowSetScale ( TextWindow *  obj,
s32  x,
s32  y 
)

Text window method: scales the glyphs.

< GTE regards 4096 as 1.0

Definition at line 522 of file text_window.c.

Referenced by createTextWindow().

Here is the caller graph for this function:

◆ textWindowSetPivot()

void textWindowSetPivot ( TextWindow *  obj,
s32  x,
s32  y 
)

Text window method: the point the glyphs scale around.

Definition at line 530 of file text_window.c.

Referenced by createTextWindow().

Here is the caller graph for this function:

◆ textWindowSetDepth()

void textWindowSetDepth ( TextWindow *  obj,
s32  depth 
)

Text window method: the OT depth the glyphs are drawn at.

Definition at line 536 of file text_window.c.

Referenced by createTextWindow().

Here is the caller graph for this function:

◆ textWindowSetLines()

void textWindowSetLines ( TextWindow *  obj,
u8  lines 
)

Text window method: the lines of a page.

Definition at line 541 of file text_window.c.

Referenced by createTextWindow().

Here is the caller graph for this function:

◆ textWindowSetUnusedC4()

void textWindowSetUnusedC4 ( TextWindow *  obj,
u8  value 
)

Text window method: sets unusedC4, which nothing reads.

Definition at line 549 of file text_window.c.

Referenced by createTextWindow().

Here is the caller graph for this function:

◆ textWindowIsFinished()

s32 textWindowIsFinished ( TextWindow *  obj)

Text window method: whether the end of the text was reached.

Definition at line 557 of file text_window.c.

Referenced by createTextWindow().

Here is the caller graph for this function:

◆ textWindowIsVisible()

s32 textWindowIsVisible ( TextWindow *  obj)

Text window method: whether the window is shown.

Definition at line 562 of file text_window.c.

Referenced by createTextWindow().

Here is the caller graph for this function:

◆ textWindowIsWaitingForButton()

s32 textWindowIsWaitingForButton ( TextWindow *  obj)

Text window method: whether the text waits for a button (control code 2)

Definition at line 567 of file text_window.c.

Referenced by createTextWindow().

Here is the caller graph for this function:

◆ processTextChar()

s32 processTextChar ( TextWindow *  obj,
TextBuffer *  text,
TextDraw *  draw,
s16 *  pos 
)

Picks the glyph of the next character, or runs its control code; returns what the drawing does next.

Definition at line 575 of file text_window.c.

Referenced by textCodeInsert(), and textWindowDraw().

Here is the caller graph for this function:

◆ textCodeDefault()

s32 textCodeDefault ( TextWindow *  obj,
TextBuffer *  buf 
)

Control codes 0, 7 and 9: show the page, or (code 7) start the text after a speaker's name.

Definition at line 636 of file text_window.c.

Here is the call graph for this function:

◆ textCodeNewLine()

s32 textCodeNewLine ( TextWindow *  obj,
TextBuffer *  buf,
TextDraw *  draw 
)

Control code 1: a new line, or a new page when the page is full.

Definition at line 650 of file text_window.c.

Here is the call graph for this function:

◆ textCodeWaitButton()

s32 textCodeWaitButton ( TextWindow *  obj,
TextBuffer *  buf 
)

Control code 2: waits for one of TEXT_WAIT_BUTTONS.

Definition at line 672 of file text_window.c.

◆ textCodePageBreak()

s32 textCodePageBreak ( TextWindow *  obj,
TextBuffer *  buf 
)

Control code 3: starts a new page.

Definition at line 688 of file text_window.c.

◆ textCodeIgnore()

s32 textCodeIgnore ( void  )

Control code 4: skipped.

Definition at line 722 of file text_window.c.

◆ textCodeInsert()

s32 textCodeInsert ( TextWindow *  obj,
TextBuffer *  buf,
TextDraw *  draw 
)

Control code 5: draws the next character of a work buffer in its place.

Definition at line 727 of file text_window.c.

Here is the call graph for this function:

◆ textCodePause()

s32 textCodePause ( TextWindow *  obj,
TextBuffer *  buf 
)

Control code 6: pauses the typing for some frames, once.

Definition at line 756 of file text_window.c.

◆ textCodePlayerName()

s32 textCodePlayerName ( TextWindow *  obj,
TextBuffer *  buf 
)

Control code 8: puts the player's name into a work buffer, once.

Definition at line 769 of file text_window.c.

Here is the call graph for this function:

◆ updateTextWindow()

void updateTextWindow ( TextWindow *  obj)

The text window task: types and draws the text, waits where the control codes say, frees the buffers at the end.

Definition at line 781 of file text_window.c.

Referenced by createTextWindow().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ createTextWindow()

TextWindow * createTextWindow ( s16  layerId,
s16  style,
s16  x,
s16  y 
)

A text window on a layer, in a font style, at (x, y)

< GTE regards 4096 as 1.0

Definition at line 834 of file text_window.c.

Referenced by CARDGAME_updateDeckWindow(), CARDGAME_updateScreen(), createFieldMenuWindows(), createListMenu(), createMessageBox(), createNameWindows(), createTalkBox(), FIELDSTG_runChoice(), FIELDSTG_showAreaName(), FIGHTSTG_createItemWindows(), FIGHTSTG_createSwitchInWindows(), FIGHTSTG_createSwitchWindows(), FIGHTSTG_createTechWindows(), FIGHTSTG_drawHud(), FIGHTSTG_showCommands(), FIGHTSTG_showConfusedCommands(), FIGHTSTG_showConfusedMessage(), FIGHTSTG_showDigivolveNames(), FIGHTSTG_showFighterNames(), FIGHTSTG_showMessage(), FIGHTSTG_showPageButtons(), FIGHTSTG_showStats(), FIGHTSTG_showTechs(), FIGHTSTG_updateHud(), FIGHTSTG_updateSwitchMenu(), fillEffectLists(), SHOCKTST_updateEditor(), SHOCKTST_updateLoader(), showMenuOptions(), showMenuPageLabel(), showMenuPageTitle(), showMenuTitle(), showPartyTitle(), SOUNDTST_updateSoundTest(), STAGSLCT_showBiosVersion(), STAGSLCT_startStageSelect(), STCRDABM_createWindows(), STCRDDEK_createEditorWindows(), STCRDDEK_createScreenWindows(), STCRDSHP_createBuyWindows(), STCRDSHP_createPackOpenWindows(), STCRDSHP_createShopWindows(), STDGNAME_showMenuWindow(), STFGTREP_createPartnerWindows(), STFGTREP_createWindows(), STGDGLAB_createEntryListWindows(), STGDGLAB_createEntryPanelWindows(), STGDGLAB_createSkillPanelWindows(), STGDGLAB_createSlotScreenWindows(), STGDGLAB_runSlotScreen(), STGDGLAB_showMenuPage(), STGDGLAB_showPartyPage(), STGDGLAB_updateRecipeScreen(), STGMCARD_updateInfo(), STGMCARD_updateMenu(), STGMCARD_updateSaves(), STGTRAIN_createMenuWindows(), STGTRAIN_createResultWindows(), STGTRAIN_createScreenWindows(), STGTRAIN_createSessionWindows(), STITSHOP_createBuyWindows(), STITSHOP_createInfoWindows(), STITSHOP_createItemListWindows(), STITSHOP_createSellWindows(), STITSHOP_createShopWindows(), STPLNMET_createChoiceWindows(), STPLNMET_createConfirmWindows(), STPLNMET_createTabs(), STPLNMET_updateWelcome(), STSTATUS_createCardWindows(), STSTATUS_createDemoWindows(), STSTATUS_createDigivolveWindows(), STSTATUS_createEquipWindows(), STSTATUS_createItemListWindows(), STSTATUS_createItemWindows(), STSTATUS_createSortWindows(), STSTATUS_createStatusWindows(), STSTATUS_createTechWindows(), STSTATUS_updateMapScreen(), updateCursor(), updateEvent1510(), updateEvent1512(), updateEvent1514(), updateEvent1516(), updateEvent1518(), updateEvent1520(), updateEvent9(), updateInn(), updateMenu(), WFIGHTTS_cameraList(), WFIGHTTS_fighterList(), WFIGHTTS_motionList(), and WFIGHTTS_stageList().

Here is the call graph for this function:

Variable Documentation

◆ STR_NULL_MESSAGE

const char STR_NULL_MESSAGE[]
Initial value:
= "\x82\x6D\x82\x95\x82\x8C\x82\x8C\x83\x81\x83\x62\x83\x5A\x81\x5B"
"\x83\x57\x82\xAA\x82\xED\x82\xBD\x82\xB3\x82\xEA\x82\xDC\x82\xB5\x82\xBD"

"Null message was passed"

Definition at line 5 of file text_window.c.

Referenced by setTextBuffer().

◆ STR_BAD_DIGIT_BUFFER

const char STR_BAD_DIGIT_BUFFER[]
Initial value:
= "\x82\x63\x82\x89\x82\x87\x82\x89\x82\x94\x81\x46\x83\x81\x83\x62"
"\x83\x5A\x81\x5B\x83\x57\x82\xCC\x83\x8F\x81\x5B\x83\x4E\x82\xCE"
"\x82\xF1\x82\xB2\x82\xA4\x82\xAA\x82\xDD\x82\xBD\x82\xA2\x82\xA8\x82\xA4"

"Digit: the message's work number is not supported"

Definition at line 8 of file text_window.c.

Referenced by textWindowSetNumber().

◆ STR_BAD_EXT_BUFFER

const char STR_BAD_EXT_BUFFER[]
Initial value:
= "\x82\x64\x82\x98\x82\x94\x82\x6C\x82\x85\x82\x93\x82\x93\x81\x46"
"\x83\x81\x83\x62\x83\x5A\x81\x5B\x83\x57\x82\xCC\x83\x8F\x81\x5B"
"\x83\x4E\x82\xCE\x82\xF1\x82\xB2\x82\xA4\x82\xAA\x82\xDD\x82\xBD"
"\x82\xA2\x82\xA8\x82\xA4"

"ExtMess: the message's work number is not supported"

Definition at line 12 of file text_window.c.

Referenced by textWindowSetSubText().

◆ STR_MESSAGE_NOT_SET

const char STR_MESSAGE_NOT_SET[]
Initial value:
= "\x83\x81\x83\x62\x83\x5A\x81\x5B\x83\x57\x82\xAA\x82\xB9\x82\xC1"
"\x82\xC4\x82\xA2\x82\xB3\x82\xEA\x82\xC4\x82\xA2\x82\xDC\x82\xB9\x82\xF1"

"The message is not set"

Definition at line 17 of file text_window.c.

Referenced by textCodeInsert().

◆ TEXT_CODE_HANDLERS

s32(* TEXT_CODE_HANDLERS[11])() ( )
Initial value:
= {
}
s32 textCodeIgnore(void)
Control code 4: skipped.
s32 textCodePause(TextWindow *obj, TextBuffer *buf)
Control code 6: pauses the typing for some frames, once.
s32 textCodePlayerName(TextWindow *obj, TextBuffer *buf)
Control code 8: puts the player's name into a work buffer, once.
s32 textCodeDefault(TextWindow *obj, TextBuffer *buf)
Control codes 0, 7 and 9: show the page, or (code 7) start the text after a speaker's name.
s32 textCodeInsert(TextWindow *obj, TextBuffer *buf, TextDraw *draw)
Control code 5: draws the next character of a work buffer in its place.
s32 textCodeWaitButton(TextWindow *obj, TextBuffer *buf)
Control code 2: waits for one of TEXT_WAIT_BUTTONS.
s32 textCodeNewLine(TextWindow *obj, TextBuffer *buf, TextDraw *draw)
Control code 1: a new line, or a new page when the page is full.
s32 textCodePageBreak(TextWindow *obj, TextBuffer *buf)
Control code 3: starts a new page.

The handlers of the control codes 0x02 <code> (processTextChar)

(obj, text, wait): most handlers take only the first two

Definition at line 880 of file text_window.c.

Referenced by processTextChar().

◆ TEXT_WAIT_BUTTONS

s32 TEXT_WAIT_BUTTONS[5] = { 13 , 12 , 13 , 14 , 15 }

The buttons a wait for a button (code 2) can wait for.

Definition at line 887 of file text_window.c.

Referenced by updateTextWindow().