#include <textparser.h>
Public Types | |
| enum | Filter { FILTER_NONE = 0, FILTER_CROSS_EXAMINE } |
| Filters for trigger classification. More... | |
Public Member Functions | |
| TextParser (Game *game) | |
| Constructor. | |
| void | setBlock (const ustring &block) |
| Set a text block to parse. | |
| void | reset () |
| Reset the parser. | |
| bool | paused () const |
| See if parsing the block has paused. | |
| bool | done () const |
| See if this parser is done with the current block. | |
| bool | isBlocking () const |
| See if this block's dialogue can't be skipped. | |
| bool | dialogueDone () const |
| See if the current dialogue string is still being drawn. | |
| void | lockTalk (bool t) |
| Manually lock/unlock the speaking character's _talk animation. | |
| bool | talkLocked () const |
| See if the script requests that dialogue not be spoken (disable _talk animation). | |
| void | setSpeaker (const ustring &speaker) |
| Manually set the speaker. | |
| ustring | getSpeaker () const |
| Return the currently speaking character, if any. | |
| ustring | parse (bool drawDialogue) |
| Parse the given control block. | |
| void | nextStep () |
| Move on to the next break point. | |
Static Public Attributes | |
| static const int | NORMAL_FONT_SPEED = 50 |
| Regular text speed. | |
| static const uchar | TEXT_SPEED_INCR_CHAR = '[' |
| Character to increase text speed. | |
| static const uchar | TEXT_SPEED_DECR_CHAR = ']' |
| Character to decrease text speed. | |
| static const uchar | TEXT_SPEED_NORM_CHAR = '|' |
| Character to normalize text speed. | |
| static const uchar | SHAKE_SCREEN_CHAR = '#' |
| Character to shake the screen. | |
Private Member Functions | |
| bool | shouldPlayDialogueEffect (uchar prev, uchar ch, uchar next) |
| See if a dialogue sound effect should be played for a given character. | |
| bool | preparseTrigger (const ustring &trigger) |
| See if a trigger should be executed right away. | |
| bool | filterTrigger (const ustring &trigger, const Filter &filter) |
| See if a trigger matches a filter. | |
| void | parseTag (const ustring &tag) |
| Parse a tag and apply styling. | |
| void | clearFormatting () |
| Clear current font formatting. | |
| void | executeNextTrigger () |
| Execute the next scheduled trigger. | |
| ustring | doTrigger (const ustring &trigger, const ustring &command) |
| Execute a trigger. | |
Private Attributes | |
| ustring | m_Block |
| The current block. | |
| ustring | m_NextBlock |
| The next block to parse. | |
| ustring | m_Speaker |
| Internal name of current speaking character. | |
| Character::Gender | m_SpeakerGender |
| Gender of the current speaking character. | |
| int | m_BreakPoint |
| Position in block where parser was paused. | |
| bool | m_Pause |
| Whether or not the parser is paused. | |
| bool | m_Done |
| Whether or not the parser is done with the current block. | |
| bool | m_Direct |
| Flag if the parser should go right to the next block. | |
| bool | m_BlockDiag |
| Flag if the dialogue should be blocked from being skipped. | |
| bool | m_TalkLocked |
| Flag if the speaking character's _talk animation should be disabled. | |
| ustring | m_Dialogue |
| Current dialogue string data. | |
| int | m_StrPos |
| Position in current dialogue. | |
| int | m_LastChar |
| The last time the previous character was drawn. | |
| int | m_Speed |
| Speed of font drawing. | |
| bool | m_TagOpen |
| Flag whether or not the a styling tag is open. | |
| ustring | m_CurTag |
| The current styling tag, if any. | |
| FontStyle | m_FontStyle |
| Current font formatting. | |
| std::queue< StringPair > | m_QueuedTriggers |
| Triggers to be executed in a linear manner. | |
| ustring | m_QueuedFade |
| Scheduled fade out. | |
| ustring | m_QueuedTestimony |
| Scheduled testimony sprite sequence. | |
| ustring | m_QueuedExamination |
| Scheduled cross examination sprite sequence. | |
| ustring | m_QueuedResume |
| Scheduled cross examination to resume. | |
| int | m_TimedGoto |
| Wait time before parsing block. | |
| Game * | m_Game |
| Pointer to Game engine object. | |
| ustring | m_QueuedEvent |
| Generic scheduled events to perform. | |
| ustring | m_QueuedEventArgs |
| Generic scheduled events to perform. | |
The TextParser class forms the foundation of the entire game engine. It handles text blocks, extracts and draws dialogue strings with correct timing, and executes triggers.
| enum TextParser::Filter |
| TextParser::TextParser | ( | Game * | game | ) |
| void TextParser::setBlock | ( | const ustring & | block | ) |
Set a text block to parse.
| block | The block to parse |
| bool TextParser::paused | ( | ) | const [inline] |
See if parsing the block has paused.
| bool TextParser::done | ( | ) | const [inline] |
See if this parser is done with the current block.
| bool TextParser::isBlocking | ( | ) | const [inline] |
See if this block's dialogue can't be skipped.
| bool TextParser::dialogueDone | ( | ) | const [inline] |
See if the current dialogue string is still being drawn.
| void TextParser::lockTalk | ( | bool | t | ) | [inline] |
Manually lock/unlock the speaking character's _talk animation.
| t | true to lock the animation, false to unlock |
| bool TextParser::talkLocked | ( | ) | const [inline] |
See if the script requests that dialogue not be spoken (disable _talk animation).
| void TextParser::setSpeaker | ( | const ustring & | speaker | ) | [inline] |
Manually set the speaker.
| speaker | ID of the speaking character |
| ustring TextParser::getSpeaker | ( | ) | const [inline] |
Return the currently speaking character, if any.
| ustring TextParser::parse | ( | bool | drawDialogue | ) |
Parse the given control block.
| drawDialogue | Flag whether or not to draw the dialogue text |
| bool TextParser::shouldPlayDialogueEffect | ( | uchar | prev, | |
| uchar | ch, | |||
| uchar | next | |||
| ) | [private] |
See if a dialogue sound effect should be played for a given character.
| prev | The previous character | |
| ch | The current character | |
| next | The next character |
| bool TextParser::preparseTrigger | ( | const ustring & | trigger | ) | [private] |
See if a trigger should be executed right away.
| trigger | The trigger to test |
| bool TextParser::filterTrigger | ( | const ustring & | trigger, | |
| const Filter & | filter | |||
| ) | [private] |
See if a trigger matches a filter.
| trigger | The trigger to test | |
| filter | The filter to test against |
| void TextParser::parseTag | ( | const ustring & | tag | ) | [private] |
Parse a tag and apply styling.
| tag | The tag to handle |
| ustring TextParser::doTrigger | ( | const ustring & | trigger, | |
| const ustring & | command | |||
| ) | [private] |
Execute a trigger.
| trigger | The trigger to execute | |
| command | The trigger parameters |
1.5.3