ScummVM API documentation
dialogue_session.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#ifndef HARVESTER_DIALOGUE_SESSION_H
23#define HARVESTER_DIALOGUE_SESSION_H
24
25#include "common/ptr.h"
26#include "common/rect.h"
27#include "harvester/bitmap.h"
28#include "harvester/cft_font.h"
29#include "harvester/npc/dialogue_runtime.h"
30
31namespace Common {
32struct Event;
33}
34
35namespace Graphics {
36class Screen;
37}
38
39namespace Harvester {
40
41class Art;
42class EntityManager;
43class ResourceManager;
44struct MenuTextConfig;
45
47public:
49 Common::String text;
51 char hotkey = 0;
52 int rowStart = 0;
53 int rowCount = 0;
54 };
55
57 const IndexedBitmap &backdrop, const byte *palette, float paletteBrightness,
58 const NpcRecord &npc);
59 bool isValid() const;
60 const Common::String &getGenericByeTopic() const;
61 Common::Error playDialogueLineWithVariant(int wavId, const Common::String &speakerId,
62 int headVariant) override;
63 Common::Error playDialogueLine(int wavId, const Common::String &speakerId) override;
64 Common::Error playDialogueEntrySequence(const DialogueLineEntry *lines, uint count) override;
65 Common::Error playDialogueFst(const Common::String &path) override;
66 Common::Error clearScreenToBlack() override;
67 Common::Error showCdChangePrompt(int discNumber) override;
68 Common::Error runKeywordMenu(const Common::String &topicBuffer, int topicBufferLineIndex,
69 Common::String &selectedTopic,
70 DialogueKeywordMenuSelectionState &selection) override;
71 Common::Error runResponseMenu(int responseLineIndex, int &selectedIndex) override;
72 Common::Error runResponseMenuText(const Common::String &responseLine, int &selectedIndex) override;
73 Common::Error runGameOverScreen() override;
74 void assignTopicBuffer(Common::String &topicBuffer, int &topicBufferLineIndex,
75 int responseLineIndex, const char *) override;
76 bool matchesResponseLine(const Common::String &selectedTopic, int responseLineIndex) override;
77 bool matchesAnyResponseLine(const Common::String &selectedTopic,
78 const int *responseLineIndices, uint responseLineCount) override;
79 void queueDialogueInteractionIfNeeded(const InteractionResult &interaction) override;
80 void applyImmediateDialogueInteractionEffects(InteractionResult &interaction) override;
81 int getRandomNumber(int maxValue) override;
82 void setActiveSpeakerPortrait(const Common::String &speakerId, int headVariant) override;
83
84private:
85 Graphics::Screen *getActiveScreen() const;
86 Common::Error waitForPointerRelease();
87 Common::Error waitForDialogueContinue(const IndexedBitmap *textboxBitmap,
88 const Common::Array<Common::String> *subtitleLines);
89 Common::Error activateDialogueDisc(ResourceManager &resources, int discNumber, int previousDisc);
90 void drawFontString(const Graphics::Font &font, bool usesCft, const Common::String &text,
91 int x, int y, int width, byte color);
92 void ensureSpeakerPortrait(const Common::String &speakerId, int headVariant);
93 void drawDialogueOverlay(const IndexedBitmap *overlayBitmap,
94 const Common::Array<Common::String> *subtitleLines, const Common::Array<Common::String> *topics,
95 int hoveredTopicIndex, bool hoverOther, const Common::String *textEntryValue,
96 bool textEntryCursorVisible = false);
97 bool handleKeywordTextEntry(const Common::Event &event, Common::String &typedTopic,
98 bool &editingOther, Common::String &selectedTopic, DialogueKeywordMenuSelectionState &selection);
99 bool selectResponseMenuHotkey(const Common::Event &event,
100 const Common::Array<DialogueResponseOptionLayout> &options, int responseLineIndex,
101 int &selectedIndex);
102 void parseResponseMenuLine(const Common::String &responseLine,
103 Common::Array<DialogueResponseOptionLayout> &options, uint &totalRows);
104 int getResponseMenuItemAt(const Common::Array<DialogueResponseOptionLayout> &options,
105 uint totalRows, const Common::Point &mousePos);
106 void drawDialogueResponseMenu(const IndexedBitmap *textboxBitmap,
107 const Common::Array<DialogueResponseOptionLayout> &options, int hoveredOptionIndex);
108 Common::Error runResponseMenuTextInternal(const Common::String &responseLine, int responseLineIndex,
109 int &selectedIndex);
110
111 HarvesterEngine &_engine;
112 Common::Point &_mousePos;
113 Flow &_flow;
114 const MenuTextConfig &_menuTextConfig;
115 const IndexedBitmap &_backdrop;
116 const byte *_palette;
117 const float _paletteBrightness;
118 const NpcRecord &_npc;
119 Script *_script;
120 Text *_text;
121 Art *_art;
122 EntityManager *_entityManager;
123 const Graphics::Font *_fallbackFont;
126 const Graphics::Font *_subtitleFont;
127 const Graphics::Font *_menuFont;
128 const Graphics::Font *_highlightFont;
129 bool _subtitleFontUsesCft;
130 bool _menuFontUsesCft;
131 bool _highlightFontUsesCft;
132 IndexedBitmap _keywordBitmap;
133 Common::String _genericByeTopic;
134 IndexedBitmap _leftHeadBitmap;
135 IndexedBitmap _rightHeadBitmap;
136 Common::String _leftHeadSpeakerId;
137 Common::String _rightHeadSpeakerId;
138 bool _leftHeadVisible;
139 bool _rightHeadVisible;
140};
141
142} // End of namespace Harvester
143
144#endif // HARVESTER_DIALOGUE_SESSION_H
Definition: error.h:81
Definition: ptr.h:572
Definition: str.h:59
Definition: font.h:83
Definition: screen.h:47
Definition: art.h:35
Definition: dialogue_runtime.h:30
Definition: entity.h:184
Definition: flow.h:45
Definition: harvester.h:47
Definition: resources.h:32
Definition: dialogue_session.h:46
Definition: script.h:342
Definition: text.h:55
Definition: algorithm.h:29
Definition: formatinfo.h:28
Definition: events.h:218
Definition: rect.h:144
Definition: dialogue_runtime.h:20
Definition: dialogue_runtime.h:14
Definition: bitmap.h:33
Definition: script.h:311
Definition: menu.h:45
Definition: script.h:132
Definition: atari-screen.h:58