ScummVM API documentation
dialogue_menu.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 HOLLYWOOD_MONSTERS_GAMEPLAY_DIALOGUE_MENU_H
23#define HOLLYWOOD_MONSTERS_GAMEPLAY_DIALOGUE_MENU_H
24
25#include "common/array.h"
26#include "common/str.h"
27#include "common/types.h"
28
29namespace Hollywood {
30
31class HollywoodEngine;
32
34 byte enabled = 0; // Visible in the menu.
35 byte nextNodeIndex = 0;
36 byte transitionMode = 0;
37 byte playerTextRowId = 0;
38 byte responseFrameIndex = 0;
39 byte disableAfterUse = 0;
40 byte selectable = 1; // Clickable/selectable when visible.
41};
42
44 Common::String text;
45 byte choiceIndex = 0;
46 bool firstLineOfChoice = false;
47 bool selectable = true;
48};
49
51 void clear();
52 bool visible() const { return lineCount != 0; }
53 byte choiceForLine(byte lineIndex) const;
54
56 byte lineCount = 0;
57 byte highlightedLineIndex = 0xff;
58};
59
67public:
68 virtual ~DialogueMenuDelegate();
69
70 virtual Common::String dialogueMenuText(byte stageId, byte textRowId) const = 0;
71 // Returning another visible choice moves the cursor to it before selection.
72 virtual byte redirectDialogueMenuChoice(byte depthIndex, byte nodeIndex, byte choiceIndex) const;
73 virtual void advanceDialogueMenu(uint32 deltaMillis) = 0;
74 virtual void drawDialogueMenuFrame() = 0;
75 virtual void presentDialogueMenuFrame(const DialogueMenuState &state) = 0;
76};
77
85public:
86 enum {
87 kCancelledChoice = 0xff
88 };
89
91
92 byte choose(byte stageId, const Common::Array<DialogueChoiceRecord> &records,
93 byte depthIndex, byte nodeIndex);
94
95private:
96 enum {
97 kChoicesPerNode = 7,
98 kNodesPerDepth = 10,
99 kMaxDepthCount = 10,
100 kMaxVisibleLines = 10
101 };
102
103 bool build(byte stageId, const Common::Array<DialogueChoiceRecord> &records,
104 byte depthIndex, byte nodeIndex, byte &selectableChoiceCount);
105 void appendWrappedChoiceText(byte choiceIndex, const Common::String &text, bool selectable);
106 bool pollEvents(bool &selected, bool &cancelled);
107 bool animateChoiceRedirect(byte choiceIndex);
108 bool waitForChoiceRedirect(uint32 millis);
109 void updateHoverFromCursor();
110 byte lineAt(uint16 cursorY) const;
111
112 HollywoodEngine *_vm;
113 DialogueMenuDelegate *_delegate;
114 DialogueMenuState _state;
115};
116
117} // End of namespace Hollywood
118
119#endif // HOLLYWOOD_MONSTERS_GAMEPLAY_DIALOGUE_MENU_H
Definition: array.h:52
Definition: str.h:59
Definition: dialogue_menu.h:66
Definition: dialogue_menu.h:84
Definition: hollywood.h:47
Definition: dialogue_menu.h:33
Definition: dialogue_menu.h:43
Definition: dialogue_menu.h:50