7#if (LANGUAGE != LANGUAGE_JAPANESE)
8#if (LANGUAGE == LANGUAGE_ITALIAN)
9#define ARTICLE_KINDS 11
10#define ARTICLE_KIND_MASK 15
11#elif (LANGUAGE == LANGUAGE_SPANISH)
12#define ARTICLE_KINDS 5
13#define ARTICLE_KIND_MASK 15
15#define ARTICLE_KINDS 8
16#define ARTICLE_KIND_MASK 7
36#if (LANGUAGE == LANGUAGE_GERMAN) || (LANGUAGE == LANGUAGE_SPANISH) || \
37 (LANGUAGE == LANGUAGE_FRENCH) || (LANGUAGE == LANGUAGE_ITALIAN)
44 u16 *entries,
s32 articleForm,
s32 plural,
47#if (LANGUAGE == LANGUAGE_SPANISH)
59#if (LANGUAGE == LANGUAGE_SPANISH)
60 count = articleForm & 7;
61 indefinite = articleForm & 8;
64 entries[writePosition] =
' ';
65 writePosition = (writePosition + 1) & 0x1ff;
66 entries[writePosition] = 0x0a;
67 writePosition = (writePosition + 1) & 0x1ff;
68 entries[writePosition] = 0x0a;
69 writePosition = (writePosition + 1) & 0x1ff;
71#if (LANGUAGE == LANGUAGE_SPANISH)
72 if (count == 0 || count == 4) {
74 if (articleForm == 0 || articleForm == 4) {
82#if (LANGUAGE == LANGUAGE_SPANISH)
89#if (LANGUAGE == LANGUAGE_SPANISH)
97 for (cnt = 0; cnt < 8; cnt++) {
100 if (cnt == 0 && *suffix == 2)
102 entries[writePosition] = c8;
103 writePosition = (writePosition + 1) & 0x1ff;
108 entries[writePosition] = code;
109 writePosition = (writePosition + 1) & 0x1ff;
110#if (LANGUAGE == LANGUAGE_GERMAN)
111 if (code ==
's' || code ==
'S' || code ==
'z' || code ==
'Z')
115#elif (LANGUAGE == LANGUAGE_SPANISH) || (LANGUAGE == LANGUAGE_FRENCH)
116 if (code ==
's' || code ==
'S')
123 entries[writePosition] = 0x0a;
124 writePosition = (writePosition + 1) & 0x1ff;
125 entries[writePosition] = 0x08;
126 writePosition = (writePosition + 1) & 0x1ff;
127 entries[writePosition] =
' ';
128 writePosition = (writePosition + 1) & 0x1ff;
130 return writePosition;
134#if (LANGUAGE == LANGUAGE_ENGLISH)
141 u16 *entries,
s32 articleForm,
s32 plural,
152 entries[writePosition] =
' ';
153 writePosition = (writePosition + 1) & 0x1ff;
154 entries[writePosition] = 0x0a;
155 writePosition = (writePosition + 1) & 0x1ff;
156 entries[writePosition] = 0x0a;
157 writePosition = (writePosition + 1) & 0x1ff;
159 if (articleForm == 1 || (articleForm == 3 && plural == 0)) {
168 if (head ==
'A' || head ==
'I' || head ==
'U' || head ==
'E' ||
174 p = table.
text[kind & 7];
175 for (cnt = 0; cnt < 8; cnt++) {
176 if ((c8 = *p++) == 0)
178 entries[writePosition] = c8;
179 writePosition = (writePosition + 1) & 0x1ff;
188 entries[writePosition] = code;
189 writePosition = (writePosition + 1) & 0x1ff;
190 if (code ==
'S' || code ==
's')
195 if (articleForm == 2 || (articleForm == 3 && plural != 0)) {
197 entries[writePosition] =
'e';
198 writePosition = (writePosition + 1) & 0x1ff;
200 entries[writePosition] =
's';
201 writePosition = (writePosition + 1) & 0x1ff;
204 entries[writePosition] = 0x0a;
205 writePosition = (writePosition + 1) & 0x1ff;
206 entries[writePosition] = 0x08;
207 writePosition = (writePosition + 1) & 0x1ff;
208 entries[writePosition] =
' ';
209 writePosition = (writePosition + 1) & 0x1ff;
211 return writePosition;
246#define ENTRY_NARROW_GAP TEXT_PAUSE_SHORT
247#define ENTRY_WIDE_GAP TEXT_VOICED_MARK
249#if (LANGUAGE == LANGUAGE_ENGLISH) || (LANGUAGE == LANGUAGE_GERMAN) || \
250 (LANGUAGE == LANGUAGE_SPANISH) || (LANGUAGE == LANGUAGE_FRENCH) || \
251 (LANGUAGE == LANGUAGE_ITALIAN)
253#if (LANGUAGE == LANGUAGE_GERMAN) || (LANGUAGE == LANGUAGE_SPANISH) || \
254 (LANGUAGE == LANGUAGE_FRENCH) || (LANGUAGE == LANGUAGE_ITALIAN)
255#if (LANGUAGE == LANGUAGE_FRENCH)
256extern s8 gUiText_ItemPronoun[];
260struct ItemPossessiveTable {
263extern const struct ItemPossessiveTable gUiText_ItemPossessives;
264extern const s8 gUiText_ItemGenders[];
265extern u8 *gUiText_NumberWords[];
279#if (LANGUAGE == LANGUAGE_ENGLISH)
284 u32 decodedCount = 0;
286#if !(LANGUAGE == LANGUAGE_GERMAN) && !(LANGUAGE == LANGUAGE_ITALIAN)
289#if (LANGUAGE == LANGUAGE_ENGLISH)
290 u32 writePosition = start;
294#if (LANGUAGE == LANGUAGE_SPANISH)
295 struct ItemPossessiveTable possessives;
299#if (LANGUAGE == LANGUAGE_GERMAN) || (LANGUAGE == LANGUAGE_ITALIAN)
304 u32 writePosition = start;
315#if (LANGUAGE == LANGUAGE_ITALIAN)
330#if (LANGUAGE == LANGUAGE_GERMAN) || (LANGUAGE == LANGUAGE_ITALIAN)
331 struct ItemPossessiveTable possessives;
357#if (LANGUAGE == LANGUAGE_ENGLISH)
360 code = (
u32)decode(&reader);
420 && lineStart == 0 && code != 222 && code != 223
427#if (LANGUAGE == LANGUAGE_ENGLISH)
428 if (work->
spacingAfter != 0 && lineStart == 0 && code != 222 &&
440 if (work->
spacingBefore != 0 && (code == 32 || decodedCount > 10)) {
441 entry[writePosition] =
'.';
443 entry[writePosition] =
'.';
445 entry[writePosition] =
'.';
448 if (decodedCount > 10)
456 entry[writePosition] = (
u16)code;
458#if (LANGUAGE == LANGUAGE_ENGLISH)
463 && code != 161 && code != 191
467 if (code ==
'.' || code ==
'!' || code ==
'?')
469 if (code ==
's' || code ==
'S'
471 || code ==
'z' || code ==
'Z'
489 entry[writePosition] = (
u16)code;
491 entry[writePosition] = decode(&reader) + 0xFFFFU;
501 magnitude = 0U - (
u32)value;
509 i = numberText - numberBuffer;
510 while (i != 16 && numberBuffer[i] != 0) {
511 entry[writePosition] = numberBuffer[i];
517 no = decode(&reader) - 1;
522 0, name, writePosition, entry, no, plural, &suffix);
525 no = decode(&reader) - 1;
526#if (LANGUAGE == LANGUAGE_SPANISH)
530#if (LANGUAGE == LANGUAGE_GERMAN) || (LANGUAGE == LANGUAGE_SPANISH) || \
531 (LANGUAGE == LANGUAGE_FRENCH) || (LANGUAGE == LANGUAGE_ITALIAN)
533#if (LANGUAGE == LANGUAGE_SPANISH)
534 if (form == 2 || (form == 3 && plural != 0) || form == 4)
536 if (no == 2 || (no == 3 && plural != 0) || no == 4)
548 0, name, writePosition, entry, no, plural, &suffix);
555 nextPosition = writePosition;
557 entry[nextPosition] = *p;
561 writePosition = nextPosition;
570 nextPosition = writePosition;
572 entry[nextPosition] = *p;
576 writePosition = nextPosition;
583 *nameOutput = *nameBytes;
589 entry, 0, 0, &suffix);
592 no = decode(&reader) - 1;
598 *nameOutput = *nameBytes;
604 0, name, writePosition, entry, no, plural, &suffix);
607 argument = decode(&reader) - 1;
612 *nameOutput = *nameBytes;
618 entry, 0, 0, &suffix);
621 argument = ((decode(&reader) - 1) << 1) + 128;
622 entry[writePosition] = argument;
624 entry[writePosition] = argument + 1;
630 entry[writePosition] =
'-';
632#if (LANGUAGE == LANGUAGE_GERMAN) || (LANGUAGE == LANGUAGE_SPANISH) || \
633 (LANGUAGE == LANGUAGE_FRENCH) || (LANGUAGE == LANGUAGE_ITALIAN)
634 entry[writePosition] =
' ';
638#if (LANGUAGE == LANGUAGE_GERMAN)
640 no = decode(&reader) - 1;
641 nameBytes = gUiText_NumberWords[(no & 7) * 2 + plural];
642 while (*nameBytes != 0) {
643 entry[writePosition] = *nameBytes++;
648#if (LANGUAGE == LANGUAGE_ITALIAN)
650 ending = decode(&reader) - 1;
653 entry[writePosition] =
'o';
655 entry[writePosition] =
'i';
656 }
else if (plural == 0)
657 entry[writePosition] =
'a';
659 entry[writePosition] =
'e';
662#elif (LANGUAGE == LANGUAGE_SPANISH) || (LANGUAGE == LANGUAGE_FRENCH)
664#elif (LANGUAGE == LANGUAGE_ENGLISH)
667#if !(LANGUAGE == LANGUAGE_GERMAN) && !(LANGUAGE == LANGUAGE_ITALIAN)
670 entry[writePosition] =
'e';
673 entry[writePosition] =
's';
678#if (LANGUAGE == LANGUAGE_SPANISH) || (LANGUAGE == LANGUAGE_ITALIAN)
680#if (LANGUAGE == LANGUAGE_SPANISH)
682 possessives = gUiText_ItemPossessives;
683 word = possessives.text[plural];
687 possessives = gUiText_ItemPossessives;
688 kind = gUiText_ItemGenders[argument];
689 word = possessives.text[kind & 3];
694 for (value = 0; (
u32)value < 16; value++) {
695 if ((c8 = *word++) == 0)
697 if (value == 0 && suffix == 2)
699 entry[writePosition] = c8;
704#if (LANGUAGE == LANGUAGE_GERMAN) || (LANGUAGE == LANGUAGE_FRENCH)
706#if (LANGUAGE == LANGUAGE_GERMAN)
709 possessives = gUiText_ItemPossessives;
710 kind = gUiText_ItemGenders[argument];
711 word = possessives.text[kind & 3];
714 word = gUiText_ItemPronoun;
716 for (i = 0; i < 16; i++) {
717 if ((c8 = *word++) == 0)
719 if (i == 0 && suffix == 2)
721 entry[writePosition] = c8;
728#if (LANGUAGE == LANGUAGE_GERMAN)
730 entry[writePosition] =
'\'';
732 entry[writePosition] =
's';
734#elif (LANGUAGE == LANGUAGE_ENGLISH)
735 entry[writePosition] =
'\'';
738 entry[writePosition] =
's';
747#if (LANGUAGE == LANGUAGE_ENGLISH)
753 entry[writePosition] = (
u16)code;
755#if (LANGUAGE == LANGUAGE_ENGLISH)
756 if (code ==
's' || code ==
'S')
768 entry[writePosition] = (
u16)code;
770 entry[writePosition] = 0;
785#if (LANGUAGE == LANGUAGE_JAPANESE)
791 u32 writePosition,
u16 *entries,
792 s32 articleForm,
s32 plural,
797 entries[writePosition] =
' ';
799 entries[writePosition] = 10;
801 entries[writePosition] = 10;
806 entries[writePosition] = code;
810 entries[writePosition] = 10;
812 entries[writePosition] = 8;
814 entries[writePosition] =
' ';
817 return writePosition;
828 u32 decodedCount = 0;
830 u32 writePosition = start;
872 code = (
u32)decode(&reader);
921 if (work->
spacingBefore != 0 && lineStart == 0 && code != 222 &&
923 entry[writePosition] = 5;
926 if (work->
spacingAfter != 0 && lineStart == 0 && code != 222 &&
930 entry[writePosition] = 222;
936 if (mode != 0 && code ==
' ') {
937 entry[writePosition] = code;
940 if (work->
spacingBefore != 0 && (code == 32 || decodedCount > 10)) {
941 entry[writePosition] = 165;
943 entry[writePosition] = 165;
945 entry[writePosition] = 165;
947 entry[writePosition] = 161;
950 if (decodedCount > 10)
953 entry[writePosition] = (
u16)code;
967 entry[writePosition] = (
u16)code;
969 entry[writePosition] = decode(&reader) + 0xffffU;
975 i = numberText - numberBuffer;
976 while (i != 16 && numberBuffer[i] != 0) {
977 entry[writePosition] = numberBuffer[i];
1017 *nameOutput = *nameBytes;
1029 message = MsgMysteryPersonName;
1034 mode, name, writePosition, entry, 0, 0, 0);
1036 nameBytes = unit->
name;
1040 *nameOutput = *nameBytes;
1046 mode, name, writePosition, entry, 0, 0, 0);
1050 argument = decode(&reader) - 1;
1055 *nameOutput = *nameBytes;
1071 entry[writePosition] = (
u16)code;
1079 entry[writePosition] = (
u16)code;
1081 entry[writePosition] = 0;
const s8 *const gUiText_ArticleTable[8]
The article of each article class.
#define ENTRY_NARROW_GAP
What halting speech (UiWork_SetBusyFlags) puts between characters.
#define ARTICLE_KIND_MASK
s32 UiText_BuildRenderEntries(s32 script, s32 clear)
Decodes message script into the ring of decoded text (UiRenderWork.entries) and returns where it star...
u32 UiText_AppendArticleName(s32 mode, u16 *name, u32 writePosition, u16 *entries, s32 articleForm, s32 plural, s32 *suffix)
The English form: form 1 (or 3 with a single item) takes "a" or "an" (by the name's first letter unle...
@ MSG_ARGUMENT_SIGNED_NUMBER
@ MSG_PLURAL_SUFFIX
English: the plural suffix; German, Spanish, French and Italian: the item's possessive.
@ MSG_ARGUMENT_ABILITY_NAME
@ MSG_ARGUMENT_ACTOR_NAME
@ MSG_LOCALIZED_WORD
German: a counted noun; Italian: a gender ending; Spanish and French: the plural suffix.
@ MSG_ARGUMENT_LOCATION_NAME
@ MSG_ARGUMENT_CLASS_NAME
static __inline__ void Dma_Set(const volatile void *source, volatile void *destination, u32 control, volatile u32 *channel)
Starts a DMA transfer: stores the source, destination and control words into channel's registers with...
struct BattleUnit * UnitGetFar(u32 owner)
s32 Scene_GetAreaNameIndexFar(s32 scene, s32 entrance)
struct GameState gGameState
u8 * UiText_FormatNumber(u8 *buffer, s32 input, s32 width)
Writes value as decimal text into buffer (14 bytes) and returns where the text starts.
const u8 Text_DecodeSymbol[]
const struct ArticleTable gUiText_IndefiniteArticles
u8 Text_DecodeSymbolCodeSize[]
void * Runtime_AllocateHeapBlock(s32 kind, s32 size)
Returns heap slot kind's block, first allocating size bytes for it (rounded up to words),...
void Runtime_ReleaseHeapBlock(s32 slot)
The article written before a name of each article class.
A unit in battle: a party member's or an enemy's stats, Psynergy, items, Djinn and ailments.
u8 name[0x0f]
The name, one byte a character, ending in 0.
u8 classId
Who the unit is: a character's id (ISAAC to JENNA, below 8) or an enemy's id (BattleUnitSet).
s32 selectedActor
the leader: its unit and its actor
A position in a Huffman-coded message: the previous code, which picks the next symbol's tree,...
The window system's work: the windows' tilemap, the windows, the three text channels,...
u8 mode
Set while Mind Read shows thoughts: round frame corners, colour 8 text with no shadow,...
u8 spacingBefore
1 for halting speech: a pause before each character, broken off with an ellipsis after the first word...
u16 entries[RENDER_ENTRY_MASK+1]
decoded text, a ring of codes
u16 count
where the next code goes in entries
u8 menuState
1 from the work's setup; 2 while a battle message is decoded.
u8 spacingAfter
1 puts code 222 after certain characters in English and Japanese (UiWork_SetBusyFlags bit 1).
u16 messageStart
where the last decoded message began in entries
#define RENDER_ENTRY_MASK
#define DMA_COPY32(count)
The DMA control word that copies count words.
void UiText_LookupMessage(struct TextReader *reader, s32 message)
Points reader at the start of message (its compressed bits and first context), running the ARM lookup...
u32 UiText_LookupArgument(u32 kind, u32 clear)
Returns the value of the first message argument of kind (MSG_ARG_), or 0 when there is none.
void UiText_DecodeMessage(s32 message, u16 *text, s32 capacity)
Decodes message into text as a zero-terminated string of 16-bit codes, with at most capacity entries,...
void UiWork_ClearValueNameTables(void)
Empties the table of message arguments.
What every part of the window object shares: its includes, edition values, macros and the codes of de...
#define ITEM_POSSESSIVE_TEXT_COUNT
#define UI_NUMBER_BUFFER_SIZE
#define UI_MESSAGE_NAME_HALFWORDS
#define TEXT_ARGUMENT_SPACE
#define TEXT_WORK_BLOCK
The heap block the message decoder routine is copied into to run.