#include <map_dialogue.h>
Collaboration diagram for hoa_map::private_map::MapDialogue:

Public Member Functions | |
| void | AddText (std::string text, uint32 speaker_id, int32 time=DIALOGUE_INFINITE, int32 action=-1) |
| This method adds a new line of text and optionally an action to the dialogue. | |
| MapDialogue (bool save_state=true) | |
| This is the default contructor. It can take a bool parameter to indicate weither or not the dialogue should reset the speakers to the state at which they were before the dialogue. This parameter is set to true (reset) by default. | |
| bool | ReadNextLine () |
| This method will update the current line of the dialogue. | |
| ~MapDialogue () | |
Class Member Access Functions | |
| ScriptObject * | GetCurrentAction () |
| Returns a pointer to the ScriptObject that will be invoked after the current line of dialogue completes. | |
| uint32 | GetCurrentSpeaker () const |
| Returns the object ID of the speaker of the current line of dialogue. | |
| hoa_utils::ustring | GetCurrentText () const |
| Returns a reference to the unicode text string of the current line of dialogue. | |
| int32 | GetCurrentTime () const |
| Returns the display time of the current line of dialogue. | |
| ScriptObject * | GetLineAction (uint32 line) |
| Returns the actions of a specific line. | |
| uint32 | GetLineSpeaker (uint32 line) const |
| Returns the object id of the speaker of a line. | |
| hoa_utils::ustring | GetLineText (uint32 line) const |
| Returns the text of a specific line. | |
| int32 | GetLineTime (uint32 line) const |
| Returns the maximum time in milliseconds that the current line of dialogue should be displayed. | |
| uint32 | GetNumLines () const |
| This returns the number of line of the dialogue. | |
| VirtualSprite * | GetOwner () const |
| int32 | GetTimesSeen () const |
| This returns the number of times that this dialogue has been seen by the player. | |
| bool | HasAlreadySeen () const |
| Indicates if this dialogue has already been seen by the player. | |
| void | IncrementTimesSeen () |
| This increments the counter that keeps track of how many times the dialogue has been seen by the player. | |
| bool | IsBlocked () const |
| Returns a bool that indicates whether a dialogue is blocked (ignores user input). | |
| bool | IsSaving () const |
| Returns true if a dialogue should load the saved state of the dialogue speakers at the end of the dialogue. | |
| void | ResetTimesSeen () |
| This resets the counter that keeps track of how many times the dialogue has been seen. | |
| void | SetBlock (bool b) |
| This method controls if the dialogue should ignore user input (true) or not (false). | |
| void | SetOwner (VirtualSprite *sprite) |
Private Attributes | |
| std::vector< ScriptObject * > | _actions |
| A list of optional events that may occur after each line. | |
| bool | _blocked |
| When this member is set to true, dialogues will ignore user input and instead execute independently. | |
| uint32 | _current_line |
| An index to the current line to read. | |
| VirtualSprite * | _owner |
| The sprite, if any, which "owns" this dialogue (ie the dialogue can only be initiated by talking to the owner). | |
| bool | _save_state |
| Declares whether or not to reset the status of map sprites after the dialogue completes. | |
| uint32 | _seen |
| This counts the number of time a player has seen this dialogue. | |
| std::vector< uint32 > | _speakers |
| A list of object ID numbers that declare who speaks which lines. | |
| std::vector< hoa_utils::ustring > | _text |
| The text of the conversation, split up into multiple lines. | |
| std::vector< int32 > | _time |
| The maximum display time of each line in the dialogue. A time less than zero indicates infinite time. | |
****************************************************************************
Dialogues consist of multiple lines. Each line of a dialogue contains the following information:
Both the time value and the script function pointer are optional and do not need to be set for every line of dialogue. Dialogues may also be "blocked", which means that they ignore the user's input while the dialogue is executing.
When a dialogue is finished, usually the state of all speaker sprites (status such as the direction they were facing prior to the dialogue) is restored so that they can continue. Also for dialogues which are "owned" by a sprite (where owned simply means that the dialogue instance is retained in the VirtualSprite::_dialogues container), the sprite is informed that the dialogue has finished so that the sprite may re-check whether or not all dialogues that it contains have been seen by the player.
Definition at line 98 of file map_dialogue.h.
| hoa_map::private_map::MapDialogue::MapDialogue | ( | bool | save_state = true |
) |
This is the default contructor. It can take a bool parameter to indicate weither or not the dialogue should reset the speakers to the state at which they were before the dialogue. This parameter is set to true (reset) by default.
Definition at line 182 of file map_dialogue.cpp.
References _save_state.
| hoa_map::private_map::MapDialogue::~MapDialogue | ( | ) |
| void hoa_map::private_map::MapDialogue::AddText | ( | std::string | text, | |
| uint32 | speaker_id, | |||
| int32 | time = DIALOGUE_INFINITE, |
|||
| int32 | action = -1 | |||
| ) |
This method adds a new line of text and optionally an action to the dialogue.
| text | The text to show on the screen | |
| speaker_id | The object ID of the speaker of this line of text (the ID should correspond to a VirtualSprite or dervied class) | |
| time | The maximum time in milliseconds to show the line of dialogue. DIALOGUE_INFINITE (-1) means that it won't disappear unless the user gives an input. | |
| action | An integer key to the map_functions table in the map file that contains the script function to execute when this line completes. A value less than zero indicates that no action is to occur. |
Definition at line 218 of file map_dialogue.cpp.
References _actions, hoa_map::MapMode::_loading_map, hoa_map::MapMode::_map_script, _speakers, _text, _time, hoa_script::ReadScriptDescriptor::CloseTable(), hoa_utils::MakeUnicodeString(), hoa_script::ReadScriptDescriptor::OpenTable(), hoa_script::ReadScriptDescriptor::ReadFunctionPointer(), and ScriptObject.
Here is the call graph for this function:

| ScriptObject* hoa_map::private_map::MapDialogue::GetCurrentAction | ( | ) | [inline] |
Returns a pointer to the ScriptObject that will be invoked after the current line of dialogue completes.
Definition at line 179 of file map_dialogue.h.
References _actions, and _current_line.
Referenced by hoa_map::private_map::DialogueManager::Update().
| uint32 hoa_map::private_map::MapDialogue::GetCurrentSpeaker | ( | ) | const [inline] |
Returns the object ID of the speaker of the current line of dialogue.
Definition at line 171 of file map_dialogue.h.
References _current_line, and _speakers.
Referenced by hoa_map::private_map::DialogueManager::Draw().
| hoa_utils::ustring hoa_map::private_map::MapDialogue::GetCurrentText | ( | ) | const [inline] |
Returns a reference to the unicode text string of the current line of dialogue.
Definition at line 167 of file map_dialogue.h.
References _current_line, and _text.
Referenced by hoa_map::private_map::DialogueManager::Update().
| int32 hoa_map::private_map::MapDialogue::GetCurrentTime | ( | ) | const [inline] |
Returns the display time of the current line of dialogue.
Definition at line 175 of file map_dialogue.h.
References _current_line, and _time.
Referenced by hoa_map::private_map::DialogueManager::Update().
| ScriptObject* hoa_map::private_map::MapDialogue::GetLineAction | ( | uint32 | line | ) | [inline] |
Returns the actions of a specific line.
Definition at line 195 of file map_dialogue.h.
References _actions.
Returns the object id of the speaker of a line.
Definition at line 187 of file map_dialogue.h.
References _speakers.
Referenced by hoa_map::private_map::DialogueManager::Update().
| hoa_utils::ustring hoa_map::private_map::MapDialogue::GetLineText | ( | uint32 | line | ) | const [inline] |
Returns the text of a specific line.
Definition at line 183 of file map_dialogue.h.
References _text.
Returns the maximum time in milliseconds that the current line of dialogue should be displayed.
Definition at line 191 of file map_dialogue.h.
References _time.
| uint32 hoa_map::private_map::MapDialogue::GetNumLines | ( | ) | const [inline] |
This returns the number of line of the dialogue.
Definition at line 163 of file map_dialogue.h.
References _speakers.
Referenced by hoa_map::private_map::DialogueManager::Update().
| VirtualSprite* hoa_map::private_map::MapDialogue::GetOwner | ( | ) | const [inline] |
| int32 hoa_map::private_map::MapDialogue::GetTimesSeen | ( | ) | const [inline] |
This returns the number of times that this dialogue has been seen by the player.
Definition at line 148 of file map_dialogue.h.
References _seen.
| bool hoa_map::private_map::MapDialogue::HasAlreadySeen | ( | ) | const [inline] |
Indicates if this dialogue has already been seen by the player.
Definition at line 133 of file map_dialogue.h.
References _seen.
Referenced by hoa_map::private_map::VirtualSprite::AddDialogue().
| void hoa_map::private_map::MapDialogue::IncrementTimesSeen | ( | ) | [inline] |
This increments the counter that keeps track of how many times the dialogue has been seen by the player.
Definition at line 137 of file map_dialogue.h.
References _seen.
Referenced by ReadNextLine().
| bool hoa_map::private_map::MapDialogue::IsBlocked | ( | ) | const [inline] |
Returns a bool that indicates whether a dialogue is blocked (ignores user input).
Definition at line 152 of file map_dialogue.h.
References _blocked.
Referenced by hoa_map::private_map::DialogueManager::Update().
| bool hoa_map::private_map::MapDialogue::IsSaving | ( | ) | const [inline] |
Returns true if a dialogue should load the saved state of the dialogue speakers at the end of the dialogue.
Definition at line 156 of file map_dialogue.h.
References _save_state.
Referenced by hoa_map::private_map::DialogueManager::Update().
| bool hoa_map::private_map::MapDialogue::ReadNextLine | ( | ) |
This method will update the current line of the dialogue.
Definition at line 202 of file map_dialogue.cpp.
References _current_line, _owner, _text, IncrementTimesSeen(), and hoa_map::private_map::VirtualSprite::UpdateSeenDialogue().
Referenced by hoa_map::private_map::DialogueManager::Update().
Here is the call graph for this function:

| void hoa_map::private_map::MapDialogue::ResetTimesSeen | ( | ) | [inline] |
This resets the counter that keeps track of how many times the dialogue has been seen.
Definition at line 129 of file map_dialogue.h.
References _seen.
| void hoa_map::private_map::MapDialogue::SetBlock | ( | bool | b | ) | [inline] |
This method controls if the dialogue should ignore user input (true) or not (false).
Definition at line 141 of file map_dialogue.h.
References _blocked.
| void hoa_map::private_map::MapDialogue::SetOwner | ( | VirtualSprite * | sprite | ) | [inline] |
Definition at line 144 of file map_dialogue.h.
References _owner.
Referenced by hoa_map::private_map::VirtualSprite::AddDialogue().
std::vector<ScriptObject*> hoa_map::private_map::MapDialogue::_actions [private] |
A list of optional events that may occur after each line.
Definition at line 226 of file map_dialogue.h.
Referenced by AddText(), GetCurrentAction(), GetLineAction(), and ~MapDialogue().
bool hoa_map::private_map::MapDialogue::_blocked [private] |
When this member is set to true, dialogues will ignore user input and instead execute independently.
Definition at line 208 of file map_dialogue.h.
Referenced by IsBlocked(), and SetBlock().
An index to the current line to read.
Definition at line 205 of file map_dialogue.h.
Referenced by GetCurrentAction(), GetCurrentSpeaker(), GetCurrentText(), GetCurrentTime(), and ReadNextLine().
The sprite, if any, which "owns" this dialogue (ie the dialogue can only be initiated by talking to the owner).
Definition at line 214 of file map_dialogue.h.
Referenced by GetOwner(), ReadNextLine(), and SetOwner().
bool hoa_map::private_map::MapDialogue::_save_state [private] |
Declares whether or not to reset the status of map sprites after the dialogue completes.
Definition at line 211 of file map_dialogue.h.
Referenced by IsSaving(), and MapDialogue().
This counts the number of time a player has seen this dialogue.
Definition at line 202 of file map_dialogue.h.
Referenced by GetTimesSeen(), HasAlreadySeen(), IncrementTimesSeen(), and ResetTimesSeen().
std::vector<uint32> hoa_map::private_map::MapDialogue::_speakers [private] |
A list of object ID numbers that declare who speaks which lines.
Definition at line 220 of file map_dialogue.h.
Referenced by AddText(), GetCurrentSpeaker(), GetLineSpeaker(), and GetNumLines().
std::vector<hoa_utils::ustring> hoa_map::private_map::MapDialogue::_text [private] |
The text of the conversation, split up into multiple lines.
Definition at line 217 of file map_dialogue.h.
Referenced by AddText(), GetCurrentText(), GetLineText(), and ReadNextLine().
std::vector<int32> hoa_map::private_map::MapDialogue::_time [private] |
The maximum display time of each line in the dialogue. A time less than zero indicates infinite time.
Definition at line 223 of file map_dialogue.h.
Referenced by AddText(), GetCurrentTime(), and GetLineTime().
1.5.1