src/window/window_decode.c
The message decoder: articles, names and numbers written out. More…
Included by window.c.
Structures
| Name | Description | |
|---|---|---|
struct | ARTICLE_TABLE | The article written before a name of each article class. |
struct | ITEM_POSSESSIVE_TABLE | The possessive written before an item's name, chosen by the item's gender or by number. |
Macros
| Name | Description | |
|---|---|---|
#define | ARTICLE_MAX_LETTERS 8 | The most letters of an article mnMessageAppendArticleName writes, and of a possessive or pronoun before an item's name. |
#define | POSSESSIVE_MAX_LETTERS 16 | |
#define | CHARACTER_CODE_MAX 255 | The highest character code outside Japanese: those fonts hold a byte's worth. |
#define | KANA_FIRST_CODE 128 | The Japanese font's first kana (charmap_ja.tsv): its kana run to TEXT_LAST_FONT_CODE, and its kanji start at KANJI_FIRST_CODE (window.h). |
#define | HALTING_SPEECH_MAX_CODES 10 | Halting speech, how a person the Halt Psynergy has stopped answers (fdTalkToActor), breaks off with an ellipsis at its first space, or after this many codes. |
#define | BUTTON_ICON_FIRST_CODE 128 | MESSAGE_BUTTON_ICON's first character code. |
#define | OPERAND_VALUE (stored) ((stored) + (Uint32)(Uint16)-1) | The value of an operand the message stores one above it, taken one down as a halfword. |
#define | UNIT_NAME_WIDEN (out, unitName, i) | Copies the unit name at unitName into out, each byte widened to a character code, through the decoder's cursors nameBytes and nameOutput and its counter i. |
#define | ARTICLE_KINDS BY_LANGUAGE(8, 8, 8, 5, 8, 11) | The article classes a name can take in each European language, and the bits of its class. |
#define | ARTICLE_KIND_MASK BY_LANGUAGE(7, 7, 7, 15, 7, 15) | |
#define | ARTICLE_FORM_INDEFINITE 8 | In Spanish, the form's bit asking for the indefinite article rather than the definite one, above the form. |
#define | ARTICLE_FORM_MASK 7 | |
#define | HALTING_SPEECH_PAUSE TEXT_PAUSE_SHORT | What the decode flags of mnMessageSetDecodeFlags put between characters. |
#define | VOICED_SPEECH_MARK TEXT_MARK_VOICED | With voicedSpeech (English and Japanese), a voiced mark after a kana or the first kanji (KANA_FIRST_CODE to KANJI_FIRST_CODE), other than the kana marks and the Japanese full stop, comma and middle dot, unless the code after it is a kana mark. |
#define | MYSTERY_PERSON_NAME_CODES 10 | The most codes the Japanese decoder takes of the name it gives the Mystery Man or the Mystery Woman in battle. |
Enumerations
| Name | Description | |
|---|---|---|
enum | anonymous enum { MESSAGE_END, MESSAGE_PAGE_BREAK, MESSAGE_END_WAIT, MESSAGE_L … } | The control codes of a message as stored (the PO catalogs' names), which mnMessageDecode expands into decoded text. |
enum | ARTICLE_FORM { ARTICLE_FORM_BARE, ARTICLE_FORM_ARTICLE, ARTICLE_FORM_PLURAL … } | How a name argument is written ({argument_item_name:n} and the like, the catalogs showing the form one above): with or without its article, and singular or plural. |
enum | anonymous enum { LAST_LETTER_OTHER, LAST_LETTER_S, LAST_LETTER_SENTENCE_END } | The state of the text just written, which an article or ending after it follows: a sentence's end capitalises the next article, and a name ending in s (in German, s or z) takes a different possessive or plural ending. |
enum | anonymous enum { ARTICLE_CLASS_NONE, ARTICLE_CLASS_A, ARTICLE_CLASS_AN } | The English article classes mnMessageAppendArticleName chooses between (ArticleTable) when a name's class does not name one. |
Functions
| Name | Description | |
|---|---|---|
Uint32 | mnMessageAppendArticleName (Sint32 inBattleMsg, Uint16 *name, Uint32 writePos, Uint16 *entries, Sint32 articleForm, Sint32 plural, Sint32 *lastLetter) | The German, Spanish, French and Italian form: the bare forms take no article, the others the article of the name's class, capitalised at the start of a sentence. |
Sint32 | mnMessageDecode (Sint32 script, Sint32 clear) | Decodes message script into the ring of decoded text (WIN_STATE.textBuf) and returns where it starts; script -1 returns the last message's start again. |
Variables
| Name | Description | |
|---|---|---|
extern Sint8 | LocalizedWordItemPronoun [] | |
extern const struct ITEM_POSSESSIVE_TABLE | LocalizedWordItemPossessives | The possessive ("your") for each item gender (LocalizedWordItemGenders). |
extern const Sint8 | LocalizedWordItemGenders [] | |
extern Uint8 * | LocalizedWordCountedNouns [] | {singular, plural}: window.c reads [(kind & 7) * 2 + plural]. |
Description
The message decoder: articles, names and numbers written out. Part of
window.c.
Macros in detail
ARTICLE_MAX_LETTERS
#define ARTICLE_MAX_LETTERS 8
The most letters of an article mnMessageAppendArticleName writes, and of a
possessive or pronoun before an item's name.
Referenced by mnMessageAppendArticleName().
Definition at line 6 of file window_decode.c.
POSSESSIVE_MAX_LETTERS
#define POSSESSIVE_MAX_LETTERS 16
Referenced by mnMessageDecode().
Definition at line 7 of file window_decode.c.
CHARACTER_CODE_MAX
#define CHARACTER_CODE_MAX 255
The highest character code outside Japanese: those fonts hold a byte's worth.
Referenced by mnMessageDecode().
Definition at line 9 of file window_decode.c.
KANA_FIRST_CODE
#define KANA_FIRST_CODE 128
The Japanese font's first kana (charmap_ja.tsv): its kana run to
TEXT_LAST_FONT_CODE, and its kanji start at KANJI_FIRST_CODE (window.h).
Referenced by mnMessageDecode().
Definition at line 12 of file window_decode.c.
HALTING_SPEECH_MAX_CODES
#define HALTING_SPEECH_MAX_CODES 10
Halting speech, how a person the Halt Psynergy has stopped answers
(fdTalkToActor), breaks off with an ellipsis at its first space, or after
this many codes.
Referenced by mnMessageDecode().
Definition at line 16 of file window_decode.c.
BUTTON_ICON_FIRST_CODE
#define BUTTON_ICON_FIRST_CODE 128
MESSAGE_BUTTON_ICON's first character code.
Referenced by mnMessageDecode().
Definition at line 18 of file window_decode.c.
OPERAND_VALUE
#define OPERAND_VALUE(stored) ((stored) + (Uint32)(Uint16)-1)
The value of an operand the message stores one above it, taken one down as a halfword.
Referenced by mnMessageDecode().
Definition at line 21 of file window_decode.c.
UNIT_NAME_WIDEN
#define UNIT_NAME_WIDEN(out, unitName, i)
Copies the unit name at unitName into out, each byte widened to a
character code, through the decoder's cursors nameBytes and nameOutput and
its counter i. It is several statements, so it is used only as a whole
statement of a case.
Referenced by mnMessageDecode().
Definition at line 27 of file window_decode.c.
ARTICLE_KINDS
#define ARTICLE_KINDS BY_LANGUAGE(8, 8, 8, 5, 8, 11)
The article classes a name can take in each European language, and the bits of its class.
Definition at line 42 of file window_decode.c.
ARTICLE_KIND_MASK
#define ARTICLE_KIND_MASK BY_LANGUAGE(7, 7, 7, 15, 7, 15)
Referenced by mnMessageAppendArticleName().
Definition at line 43 of file window_decode.c.
ARTICLE_FORM_INDEFINITE
#define ARTICLE_FORM_INDEFINITE 8
In Spanish, the form's bit asking for the indefinite article rather than the definite one, above the form.
Referenced by mnMessageAppendArticleName().
Definition at line 141 of file window_decode.c.
ARTICLE_FORM_MASK
#define ARTICLE_FORM_MASK 7
Referenced by mnMessageAppendArticleName() and mnMessageDecode().
Definition at line 142 of file window_decode.c.
HALTING_SPEECH_PAUSE
#define HALTING_SPEECH_PAUSE TEXT_PAUSE_SHORT
What the decode flags of mnMessageSetDecodeFlags put between characters.
Halting speech pauses before each one.
Referenced by mnMessageDecode().
Definition at line 366 of file window_decode.c.
VOICED_SPEECH_MARK
#define VOICED_SPEECH_MARK TEXT_MARK_VOICED
With voicedSpeech (English and Japanese), a voiced mark after a kana or the
first kanji (KANA_FIRST_CODE to KANJI_FIRST_CODE), other than the kana marks
and the Japanese full stop, comma and middle dot, unless the code after it is
a kana mark. No message is decoded with it.
Referenced by mnMessageDecode().
Definition at line 371 of file window_decode.c.
MYSTERY_PERSON_NAME_CODES
#define MYSTERY_PERSON_NAME_CODES 10
The most codes the Japanese decoder takes of the name it gives the Mystery Man or the Mystery Woman in battle.
Referenced by mnMessageDecode().
Definition at line 952 of file window_decode.c.
Enumerations in detail
anonymous enum
enum { MESSAGE_END, MESSAGE_PAGE_BREAK, MESSAGE_END_WAIT, MESSAGE_LINE_BREAK, … }
The control codes of a message as stored (the PO catalogs' names), which
mnMessageDecode expands into decoded text.
| Enumerator | Value | Description |
|---|---|---|
MESSAGE_END | 0 | Kept as TEXT_END: the window stays open. |
MESSAGE_PAGE_BREAK | 1 | Kept as TEXT_PAGE. |
MESSAGE_END_WAIT | 2 | Kept as TEXT_WAIT_KEY: a button closes the window. |
MESSAGE_LINE_BREAK | 3 | Kept as TEXT_NEWLINE. |
MESSAGE_TEXT_COLOR | 8 | Kept with its operand as TEXT_COLOR. |
MESSAGE_TEXT_EFFECT | 9 | Kept with its operand as TEXT_STYLE: the style of sprite text, 1 outlined (mnTextDrawGlyphPair), 2 to 5 a motion (mnGlyphDraw). |
MESSAGE_LINE_SPACING | 10 | Kept with its operand as TEXT_LINE_SPACING. |
MESSAGE_UNUSED_11 | 11 | Kept with its operand as TEXT_UNUSED_11. |
MESSAGE_UNUSED_12 | 12 | Kept with its operand as TEXT_UNUSED_12. |
MESSAGE_LOCALIZED_WORD | 13 | German: a counted noun; Italian: a gender ending; Spanish and French: the plural suffix |
MESSAGE_UNUSED_14 | 14 | Kept with its two operands as TEXT_UNUSED_14. |
MESSAGE_WINDOW_EFFECT | 15 | Kept with its operand as TEXT_WINDOW_ANIMATION: the window animation to run. |
MESSAGE_PROTAGONIST_NAME | 16 | The name of the unit MainRoutineStateWork.leaderActorId names. |
MESSAGE_ACTOR_NAME | 17 | The name of the unit its operand names. |
MESSAGE_ARGUMENT_ACTOR_NAME | 18 | The argument codes write out the next message argument of their kind (MESSAGE_ARGUMENT_). |
MESSAGE_ARGUMENT_CLASS_NAME | 19 | |
MESSAGE_ARGUMENT_ITEM_NAME | 20 | |
MESSAGE_ARGUMENT_ABILITY_NAME | 21 | |
MESSAGE_ARGUMENT_SIGNED_NUMBER | 22 | The number argument, with a minus |
MESSAGE_ARGUMENT_LOCATION_NAME | 23 | sign when negative; outside Japanese any number but -1, 0 and 1 makes what follows plural. |
MESSAGE_EM_DASH | 24 | A dash: TEXT_EM_DASH_LEAD and a hyphen, and outside English a space after; the Japanese decoder keeps the code as it is. |
MESSAGE_PLURAL_SUFFIX | 25 | English: the plural suffix; German, Spanish, French and Italian: the item's possessive |
MESSAGE_BUTTON_ICON | 26 | A button drawn as two characters, codes 128 + 2 * n and the next for operand value n; the Japanese decoder keeps the code as it is. |
MESSAGE_POSSESSIVE_SUFFIX | 27 | English: an apostrophe, and an s unless the name ended in s; German: an apostrophe after s or z, else an s; nothing in Spanish, French and Italian. The Japanese decoder keeps the code as it is. |
MESSAGE_ARTICLE_CLASS | 29 | The article class of the name it starts, in item and class names, which mnMessageAppendArticleName reads and drops. |
MESSAGE_END_NOW | 30 | Kept as TEXT_END_ALT, which the message ends as it ends TEXT_END. |
Definition at line 55 of file window_decode.c.
ARTICLE_FORM
enum ARTICLE_FORM
How a name argument is written ({argument_item_name:n} and the like, the
catalogs showing the form one above): with or without its article, and
singular or plural.
| Enumerator | Value | Description |
|---|---|---|
ARTICLE_FORM_BARE | 0 | The name alone. |
ARTICLE_FORM_ARTICLE | 1 | The name after its article ("a Herb"). |
ARTICLE_FORM_PLURAL | 2 | English: the name with its plural ending ("Herbs"); the other European languages: the plural name after its article. |
ARTICLE_FORM_BY_NUMBER | 3 | ARTICLE_FORM_ARTICLE or ARTICLE_FORM_PLURAL, by the number argument written before it. |
ARTICLE_FORM_BARE_PLURAL | 4 | Outside English: the plural name alone. |
Definition at line 126 of file window_decode.c.
anonymous enum
enum { LAST_LETTER_OTHER, LAST_LETTER_S, LAST_LETTER_SENTENCE_END }
The state of the text just written, which an article or ending after it follows: a sentence's end capitalises the next article, and a name ending in s (in German, s or z) takes a different possessive or plural ending.
| Enumerator | Value | Description |
|---|---|---|
LAST_LETTER_OTHER | 0 | |
LAST_LETTER_S | 1 | |
LAST_LETTER_SENTENCE_END | 2 |
Definition at line 148 of file window_decode.c.
anonymous enum
enum { ARTICLE_CLASS_NONE, ARTICLE_CLASS_A, ARTICLE_CLASS_AN }
The English article classes mnMessageAppendArticleName chooses between
(ArticleTable) when a name's class does not name one.
| Enumerator | Value | Description |
|---|---|---|
ARTICLE_CLASS_NONE | 0 | |
ARTICLE_CLASS_A | 1 | |
ARTICLE_CLASS_AN | 2 |
Definition at line 270 of file window_decode.c.
Functions in detail
mnMessageAppendArticleName
Uint32 mnMessageAppendArticleName(Sint32 inBattleMsg, Uint16 *name, Uint32 writePos, Uint16 *entries, Sint32 articleForm, Sint32 plural, Sint32 *lastLetter)
extern __inline__ Uint32 mnMessageAppendArticleName(Sint32 inBattleMsg, Uint16 *name, Uint32 writePos, Uint16 *entries, Sint32 articleForm, Sint32 plural, Sint32 *lastLetter)
The German, Spanish, French and Italian form: the bare forms take no article, the others the article of the name's class, capitalised at the start of a sentence.
The English form: the singular takes "a" or "an" (by the name's first letter, unless its class names an article), and the plural adds "s", or "es" after an s.
The Japanese form: Japanese has no articles, so the name is copied as it is.
References ArticleIndefinite, ArticleTable and Sint32.
Referenced by mnMessageDecode().
Definition at lines 165, 280 and 955 of file window_decode.c.
mnMessageDecode
Sint32 mnMessageDecode(Sint32 script, Sint32 clear)
Decodes message script into the ring of decoded text (WIN_STATE.textBuf) and
returns where it starts; script -1 returns the last message's start again.
The Japanese mnMessageDecode: the European decoder's loop without its
articles, plurals, possessives, dashes, button icons and opening quotes. What
only this one does: halting speech breaks off with ・・・。 rather than
"...", a battle message doubles each space and sets off each name with spaces
and line spacing codes (mnMessageAppendArticleName above), and in battle the
Mystery Man and Mystery Woman take their names from MsgMysteryPersonName.
References fdAreaGetNameIndexStub(), gmUnitGetStub(), LocalizedWordCountedNouns, LocalizedWordItemGenders, LocalizedWordItemPossessives, MainRoutineStateWork, mnMessageAppendArticleName(), mnMessageArgumentClearAll(), mnMessageArgumentLookup(), mnMessageDecodeRaw(), mnMessageFind(), mnStringFormatNumber(), Sint32, state, syHeapSlotRelease(), TextDecodeSymbol and TextDecodeSymbolCodeSize.
Referenced by mnBattleMessageOpen(), mnFieldMessageShowCentered(), mnMessageCopyExpanded(), mnMessageDecodeAndClearArguments(), mnMessageOpenDecoded(), mnMessageOpenWindow(), mnTextDrawMessage(), mnTextDrawMessageAsTiles() and mnTextMeasureMessage().