24 #ifndef SAGA_INTERFACE_H 25 #define SAGA_INTERFACE_H 27 #include "common/keyboard.h" 28 #include "common/savefile.h" 30 #include "saga/displayinfo.h" 31 #include "saga/sprite.h" 32 #include "saga/script.h" 36 enum InterfaceUpdateFlags {
38 UPDATE_LEFTBUTTONCLICK = 2,
39 UPDATE_RIGHTBUTTONCLICK = 4,
40 UPDATE_MOUSECLICK = UPDATE_LEFTBUTTONCLICK | UPDATE_RIGHTBUTTONCLICK,
45 #define CONVERSE_MAX_TEXTS 64 46 #define CONVERSE_MAX_WORK_STRING 256 48 #define ITE_INVENTORY_SIZE 24 50 #define VERB_STRLIMIT 32 52 #define STATUS_TEXT_LEN 128 53 #define STATUS_TEXT_INPUT_MAX 256 55 #define RID_IHNM_BOSS_SCREEN 19 // not in demo 56 #define RID_ITE_TYCHO_MAP 1686 57 #define RID_ITE_SPR_CROSSHAIR (73 + 9) 58 #define TIMETOSAVE (1000000 * 60 * 30) // 30 minutes 59 #define TIMETOBLINK_ITE (1000000 * 1) 60 #define TIMETOBLINK_IHNM (1000000 / 10) 76 kPanelSceneSubstitute,
77 kPanelChapterSelection,
104 imageWidth = imageHeight = 0;
105 currentButton = NULL;
111 if ((index >= 0) && (index < buttonsCount)) {
112 return &buttons[index];
117 void getRect(
Rect &rect) {
125 rect.
left = x + panelButton->xOffset;
126 rect.
right = rect.
left + panelButton->width;
127 rect.top = y + panelButton->yOffset;
128 rect.bottom = rect.top + panelButton->height;
135 for (i = 0; i < buttonsCount; i++) {
136 panelButton = &buttons[i];
137 if (panelButton != NULL) {
138 if ((panelButton->type & buttonType) > 0) {
139 calcPanelButtonRect(panelButton, rect);
149 void zeroAllButtonState() {
151 for (i = 0; i < buttonsCount; i++) {
152 buttons[i].state = 0;
170 enum StatusTextInputState {
171 kStatusTextInputFirstRun,
172 kStatusTextInputEntered,
173 kStatusTextInputAborted
183 void setSaveReminderState(
int state) {
184 _saveReminderState = state;
187 int getSaveReminderState() {
188 return _saveReminderState;
190 bool isActive() {
return _active; }
191 void setMode(
int mode);
192 int getMode()
const {
return _panelMode; }
193 void setFadeMode(
int fadeMode) {
194 _fadeMode = fadeMode;
197 int getFadeMode()
const {
201 void restoreMode(
bool draw_ =
true);
202 bool isInMainMode() {
return _inMainMode; }
203 void setStatusText(
const char *text,
int statusColor = -1);
204 void loadScenePortraits(
int resourceId);
205 void setLeftPortrait(
int portrait) {
206 _leftPortrait = portrait;
209 void setRightPortrait(
int portrait) {
210 _rightPortrait = portrait;
213 void setPortraitBgColor(
int red,
int green,
int blue) {
214 _portraitBgColor.red = red;
215 _portraitBgColor.green = green;
216 _portraitBgColor.blue = blue;
225 void update(
const Point& mousePoint,
int updateFlag);
226 void drawStatusBar();
227 void setVerbState(
int verb,
int state);
234 void disableAbortSpeeches(
bool d) { _disableAbortSpeeches = d; }
236 static void saveReminderCallback(
void *refCon);
237 void updateSaveReminder();
241 bool _statusTextInput;
242 StatusTextInputState _statusTextInputState;
243 char _statusTextInputString[STATUS_TEXT_INPUT_MAX];
244 void enterStatusString() {
245 _statusTextInput =
true;
246 _statusTextInputPos = 0;
247 _statusTextInputString[0] = 0;
248 setStatusText(_statusTextInputString);
252 void drawInventory();
253 void updateInventory(
int pos);
254 void inventoryChangePos(
int chg);
255 void inventorySetPos(
int key);
258 void refreshInventory() {
259 updateInventory(_inventoryCount);
262 void addToInventory(
int objectId);
263 void removeFromInventory(
int objectId);
264 void clearInventory();
265 int inventoryItemPosition(
int objectId);
266 int getInventoryContentByPanelButton(
PanelButton * panelButton) {
267 int cell = _inventoryStart + panelButton->id;
268 if (cell >= _inventoryCount) {
271 return _inventory[cell];
275 return _mainPanel.hitTest(mousePoint, kPanelButtonInventory);
278 return _mainPanel.hitTest(mousePoint, kPanelButtonVerb);
283 void mapPanelDrawCrossHair();
285 int32 getProtectHash() {
return _protectHash; }
287 void resetSaveReminder();
290 void handleMainUpdate(
const Point& mousePoint);
291 void handleMainClick(
const Point& mousePoint);
294 return _conversePanel.hitTest(mousePoint, kPanelAllButtons);
296 void handleConverseUpdate(
const Point& mousePoint);
297 void handleConverseClick(
const Point& mousePoint);
300 return _optionPanel.hitTest(mousePoint, kPanelButtonOptionSaveFiles | kPanelButtonOption | kPanelButtonOptionSlider);
302 void handleOptionUpdate(
const Point& mousePoint);
303 void handleOptionClick(
const Point& mousePoint);
306 return _quitPanel.hitTest(mousePoint, kPanelAllButtons);
308 void handleQuitUpdate(
const Point& mousePoint);
309 void handleQuitClick(
const Point& mousePoint);
312 return _loadPanel.hitTest(mousePoint, kPanelAllButtons);
314 void handleLoadUpdate(
const Point& mousePoint);
315 void handleLoadClick(
const Point& mousePoint);
318 return _savePanel.hitTest(mousePoint, kPanelAllButtons);
320 void handleSaveUpdate(
const Point& mousePoint);
321 void handleSaveClick(
const Point& mousePoint);
323 void handleChapterSelectionUpdate(
const Point& mousePoint);
324 void handleChapterSelectionClick(
const Point& mousePoint);
327 void mapPanelClean();
329 void lockMode() { _lockedMode = _panelMode; }
330 void unlockMode() { _panelMode = _lockedMode; }
345 void drawButtonBox(
const Rect &rect, ButtonKind kind,
bool down);
347 void drawVerbPanelText(
PanelButton *panelButton, KnownColor textKnownColor, KnownColor textShadowKnownColor);
349 void calcOptionSaveSlider();
354 void converseClear();
355 bool converseAddText(
const char *text,
int strId,
int replyId, byte replyFlags,
int replyBit);
356 void converseDisplayText();
357 void converseSetTextLines(
int row);
358 void converseChangePos(
int chg);
359 void converseSetPos(
int key);
362 void converseDisplayTextLines();
364 if ((verb < 0) || (verb >= kVerbTypeIdsMax)) {
365 error(
"Interface::getPanelButtonByVerbType wrong verb");
367 return _verbTypeToPanelButton[verb];
370 void validateOptionButtons() {
371 if (!_vm->isSaveListFull() && (_optionSaveFileTitleNumber == 0) && (_optionPanel.currentButton != NULL)) {
372 if (_optionPanel.currentButton->id == kTextLoad) {
373 _optionPanel.currentButton = NULL;
377 void validateSaveButtons() {
378 if ((_textInputStringLength == 0) && (_savePanel.currentButton != NULL)) {
379 if (_savePanel.currentButton->id == kTextSave) {
380 _savePanel.currentButton = NULL;
400 PanelButton *_verbTypeToPanelButton[kVerbTypeIdsMax];
411 bool _disableAbortSpeeches;
413 int _saveReminderState;
421 char _statusText[STATUS_TEXT_LEN];
422 int _statusOnceColor;
426 Point _lastMousePoint;
435 char _converseWorkString[CONVERSE_MAX_WORK_STRING];
436 Converse _converseText[CONVERSE_MAX_TEXTS];
437 int _converseTextCount;
438 int _converseStrCount;
439 int _converseStartPos;
443 uint _optionSaveFileTop;
444 uint _optionSaveFileTitleNumber;
445 int16 _optionSaveFileMouseOff;
446 Rect _optionSaveRectTop;
447 Rect _optionSaveRectSlider;
448 Rect _optionSaveRectBottom;
450 char _textInputString[SAVE_TITLE_SIZE];
451 uint _textInputStringLength;
453 uint _textInputMaxWidth;
455 uint _statusTextInputPos;
458 bool _mapPanelCrossHairState;
Definition: resource.h:105
void setHeight(int16 aHeight)
Definition: rect.h:198
Definition: savefile.h:54
bool contains(int16 x, int16 y) const
Definition: rect.h:210
int16 right
Definition: rect.h:146
uint32 CustomEventType
Definition: events.h:193
Definition: interface.h:159
void setWidth(int16 aWidth)
Definition: rect.h:194
Definition: interface.h:90
int16 left
Definition: rect.h:145
void NORETURN_PRE error(MSVC_PRINTF const char *s,...) GCC_PRINTF(1
Definition: keyboard.h:294
Definition: interface.h:176