1 #ifndef HARVESTER_NPC_DIALOGUE_RUNTIME_H 2 #define HARVESTER_NPC_DIALOGUE_RUNTIME_H 4 #include "common/error.h" 5 #include "common/str.h" 6 #include "harvester/script.h" 10 class HarvesterEngine;
16 const char *speakerId;
22 : fromTypedInput(
false), fromEscape(
false), fromGenericBye(
false) {
43 virtual Common::Error runResponseMenu(
int responseLineIndex,
int &responseIndex) = 0;
46 virtual void assignTopicBuffer(
Common::String &topicBuffer,
int &topicBufferLineIndex,
47 int responseLineIndex,
const char *label) = 0;
48 virtual bool matchesResponseLine(
const Common::String &selectedTopic,
int responseLineIndex) = 0;
49 virtual bool matchesAnyResponseLine(
const Common::String &selectedTopic,
50 const int *responseLineIndices, uint responseLineCount) = 0;
51 virtual void queueDialogueInteractionIfNeeded(
const InteractionResult &interaction) = 0;
52 virtual void applyImmediateDialogueInteractionEffects(
InteractionResult &interaction) = 0;
53 virtual int getRandomNumber(
int maxValue) = 0;
54 virtual void setActiveSpeakerPortrait(
const Common::String &speakerId,
int headVariant) = 0;
65 : _engine(engine), _script(script), _text(text),
66 _flow(flow), _currentRoomName(currentRoomName),
67 _genericByeTopic(genericByeTopic),
68 _callbacks(callbacks) {
72 Script &startupScript()
const {
return _script; }
73 Text &startupText()
const {
return _text; }
74 Flow &startupFlow()
const {
return _flow; }
75 const Common::String ¤tRoomName()
const {
return _currentRoomName; }
76 const Common::String &genericByeTopic()
const {
return _genericByeTopic; }
78 bool allowTransitions =
true)
const {
79 return _script.executeActionTag(tag, result, allowTransitions, _currentRoomName);
83 int headVariant)
const {
84 return _callbacks.playDialogueLineWithVariant(wavId, speakerId, headVariant);
87 return _callbacks.playDialogueLine(wavId, speakerId);
90 return _callbacks.playDialogueEntrySequence(lines, count);
93 Common::Error clearScreenToBlack()
const {
return _callbacks.clearScreenToBlack(); }
94 Common::Error showCdChangePrompt(
int discNumber)
const {
return _callbacks.showCdChangePrompt(discNumber); }
97 _lastKeywordSelection = KeywordMenuSelectionState();
98 return _callbacks.runKeywordMenu(topicBuffer, topicBufferLineIndex, selectedTopic, _lastKeywordSelection);
100 Common::Error runResponseMenu(
int responseLineIndex,
int &responseIndex)
const {
101 return _callbacks.runResponseMenu(responseLineIndex, responseIndex);
104 return _callbacks.runResponseMenuText(responseLine, responseIndex);
106 Common::Error runGameOverScreen()
const {
return _callbacks.runGameOverScreen(); }
107 void assignTopicBuffer(
Common::String &topicBuffer,
int &topicBufferLineIndex,
108 int responseLineIndex,
const char *label)
const {
109 _callbacks.assignTopicBuffer(topicBuffer, topicBufferLineIndex, responseLineIndex, label);
111 bool matchesResponseLine(
const Common::String &selectedTopic,
int responseLineIndex)
const {
112 return _callbacks.matchesResponseLine(selectedTopic, responseLineIndex);
115 const int *responseLineIndices, uint responseLineCount)
const {
116 return _callbacks.matchesAnyResponseLine(selectedTopic, responseLineIndices, responseLineCount);
118 bool lastKeywordSelectionWasTypedInput()
const {
return _lastKeywordSelection.fromTypedInput; }
119 bool lastKeywordSelectionWasGenericBye()
const {
return _lastKeywordSelection.fromGenericBye; }
120 void queueDialogueInteractionIfNeeded(
const InteractionResult &interaction)
const {
121 _callbacks.queueDialogueInteractionIfNeeded(interaction);
123 void applyImmediateDialogueInteractionEffects(
InteractionResult &interaction)
const {
124 _callbacks.applyImmediateDialogueInteractionEffects(interaction);
126 int getRandomNumber(
int maxValue)
const {
return _callbacks.getRandomNumber(maxValue); }
127 void setActiveSpeakerPortrait(
const Common::String &speakerId,
int headVariant)
const {
128 _callbacks.setActiveSpeakerPortrait(speakerId, headVariant);
139 mutable KeywordMenuSelectionState _lastKeywordSelection;
144 #endif // HARVESTER_NPC_DIALOGUE_RUNTIME_H Definition: dialogue_runtime.h:30
Definition: dialogue_runtime.h:57
Definition: dialogue_runtime.h:14
Definition: harvester.h:47