ScummVM API documentation
ui.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
23#ifndef SNATCHER_UI_H
24#define SNATCHER_UI_H
25
26
27#include "common/scummsys.h"
28#include "snatcher/saveflags.h"
29
30namespace Common {
31class SeekableReadStream;
32class SeekableWriteStream;
33} // namespace Common
34
35namespace Snatcher {
36
37class CmdQueue;
38class FanTranslationHandler;
39class GraphicsEngine;
40class ResourcePointer;
41class ScriptArray;
42class UI {
43public:
44 UI(GraphicsEngine *gfx, CmdQueue *que, ResourcePointer *scd, FanTranslationHandler *translator);
45 ~UI();
46
47 void setControllerConfig(uint8 cfg) { _controllerCfg = cfg; }
48 void setScriptTextResource(const uint8 *textResource) { _scriptTextResource = textResource; }
49
50 bool displayDialog(int sceneInfo, int sceneTextOffset, uint16 inputFlags);
51
52 bool drawVerbs();
53 bool verbsTabInputPrompt(const SnatcherEngine::Input &input);
54 void moveFlashLight();
55
56 void setScriptVerbsArray(const ScriptArray *verbsArray) { _scriptVerbsArray = verbsArray; }
57 void setScriptSentenceArray(const ScriptArray *sentenceArray) { _scriptSentenceArray = sentenceArray; }
58
59 int8 getSelectedVerb() const { return (int8)_selectedVerb; }
60
61 void resetVerbSelection() { _prevSelectedVerb = 0; }
62
64 FlashLightStatus() : inputFlags(0), posData(0), posX(0), posY(0) {}
65 uint16 inputFlags;
66 int32 posX;
67 int32 posY;
68 uint8 posData;
69 };
70
71 const FlashLightStatus &getFlashLightStatus() const { return _flashLight; }
72
73 void setVerbInterfaceMode(uint16 mode);
74 void setInterpreterMode(uint16 mode) { _verbsInterpreterMode = mode; }
75 void setVideoPhoneMode(uint16 enable) { _videoPhoneMode = enable; }
76 void setInputStringLength(uint16 length) { _textInputColumnMax = length; }
77 void setHeadLineYOffset(int16 offs) { _headLineYOffset = offs; };
78
79 void loadState(Common::SeekableReadStream *in, SaveFlags flags);
80 void saveState(Common::SeekableWriteStream *out, SaveFlags flags);
81 bool canSaveHere() const;
82
83private:
84 void printDialogStringHead();
85 void printDialogStringBody();
86 bool checkStringPrintProgress();
87 bool waitWithCursorAnim(uint16 inputFlags);
88
89 uint8 _textColor;
90 uint8 _textY;
91 int16 _headLineYOffset;
92 uint8 _sceneId;
93 uint8 _textLineBreak;
94 uint8 _textLineEnd;
95 uint16 _sceneTextOffsCur;
96 uint16 _sceneInfo;
97 uint16 _sceneTextOffset;
98 uint16 _sceneTextOffsStart;
99 uint8 _waitCursorFrame;
100 uint8 _waitCursorAnimDelay;
101 uint8 *_dialogTextBuffer;
102
103 const uint8 *_scriptTextResource;
104 const uint8 *_scriptCurText;
105 uint8 _controllerCfg;
106 int16 _progress;
107
108private:
109 uint8 drawVerb(uint8 id);
110 void drawHiliteVerb(uint8 id);
111 bool drawUnderscoreString();
112 void drawUnderscoreCursor();
113 void verbSelect2setResult();
114 void verbsTabHandleInput(const SnatcherEngine::Input &input);
115 bool verbsTabMoveHilite(int &pos);
116 void adjustHilitePos();
117 void verbTabSwapPage();
118 void verbSelect();
119 bool verbSelect2();
120 void virtKeybBackspace();
121 void virtKeybStart();
122 bool verbSelect2checkSelection(uint16 val);
123 void virtKeybPrint();
124 uint8 checkFlashLightPos(int16 x, int16 y);
125 void moveFlashLight(int32 offsX, int32 offsY);
126
127 uint16 _verbsInterpreterMode;
128 uint8 _lastVerbFirstPage;
129 uint8 _numVerbsFirstPage;
130 uint8 _numVerbsLastPage;
131 uint8 _lastVerbLastPage;
132 uint8 _prevSelectedVerb;
133 uint8 _numVerbsMax;
134 uint8 _verbsTabCurPage;
135 int16 _videoPhoneMode;
136 uint8 _textInputMarginLeft;
137 int16 _textInputColumnCur;
138 int16 _textInputColumnMax;
139 uint8 _textInputCursorState;
140 uint8 _textInputCursorBlinkCnt;
141 uint8 _selectedVerb;
142 uint8 _vkeybPosTotal;
143 uint8 _vkeybColumnWidth;
144 uint8 _verbsTabOffsX;
145 uint8 _verbsTabOffsY;
146
147 int8 _lastHiliteVerb;
148 int8 _savedHiliteVerb;
149 int8 _hiliteVerb;
150 uint8 _lastVerbDrawn;
151 uint8 *_verbTextBuffer;
152 uint8 *_underscoreStr;
153 uint8 *_textInputStr;
154 const uint8 *_verbsTabLayoutMap;
155 uint16 _verbInterfaceMode;
156 int16 _hilitePosX;
157 int16 _hilitePosY;
158 bool _vkeybVisible;
159 const ScriptArray *_scriptVerbsArray;
160 const ScriptArray *_scriptSentenceArray;
161 int16 _progress2;
162
163 FlashLightStatus _flashLight;
164
165private:
166 GraphicsEngine *_gfx;
167 CmdQueue *_que;
168 ResourcePointer *_scd;
169 FanTranslationHandler *_translator;
170};
171
172} // End of namespace Snatcher
173
174#endif // SNATCHER_UI_H
Definition: stream.h:745
Definition: stream.h:351
Definition: script.h:44
Definition: fantranslations.h:33
Definition: graphics.h:50
Definition: resource.h:52
Definition: script.h:111
Definition: ui.h:42
Definition: algorithm.h:29
Definition: snatcher.h:126