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#ifndef HOLLYWOOD_RUNAWAY_UI_H
23#define HOLLYWOOD_RUNAWAY_UI_H
24
25#include "common/random.h"
26#include "hollywood/runaway/audio.h"
27#include "hollywood/runaway/detection.h"
28#include "hollywood/runaway/font.h"
29#include "hollywood/runaway/graphics.h"
30#include "hollywood/runaway/inventory.h"
31
32namespace Hollywood {
33
34class RunawayUI {
35public:
36 struct Command {
37 enum Type { kNone, kRoom, kExamineItem, kCombine, kSkipSpeech, kOpenMenu, kChooseDialogue };
38 Type type = kNone;
39 RunawayVerb verb = kVerbWalk;
40 Common::Point mouse;
41 byte item = 0, target = 0;
42 };
43 RunawayUI(Audio::Mixer *mixer, RunawayInventory &inventory, const RunawayStrings &strings) :
44 _audio(mixer), _inventory(inventory), _strings(strings), _random("runaway-ui") {}
45 ~RunawayUI();
46 bool load(RunawayGameType game, byte chapter);
47 bool loadChapter(byte chapter);
48 void update(uint32 now, Common::Point mouse, byte roomHotspot, bool blocked, bool speaking,
49 bool inventoryPresentation = false, byte speechFrame = 0, bool roomHasVerbs = true,
50 byte actionCursor = 0, bool preferLook = false);
51 void setDialogueChoices(const Common::Array<Common::U32String> &choices);
52 Command click(bool right);
53 void toggleInventory();
54 bool cancel();
55 bool inventoryOpen() const { return _inventoryOpen; }
56 bool busy() const { return _pickupItem != 0; }
57 RunawayVerb verb() const { return _verb; }
58 byte hovered() const { return _hovered; }
59 void captureState(RunawaySaveState &state) const;
60 void restoreState(const RunawaySaveState &state, uint32 now);
61 void setPointerSound(bool enabled) { _pointerSound = enabled; }
62 void drawSubtitle(Graphics::ManagedSurface &screen, const Common::U32String &text) const;
63 void draw(Graphics::ManagedSurface &screen, const Common::U32String &roomCaption,
64 const Common::U32String &committedCaption, const Common::U32String &subtitle, bool showSubtitles);
65
66private:
67 Common::Rect itemRect(uint slot) const;
68 byte itemAt(Common::Point mouse) const;
69 bool overButton() const;
70 bool overOptions() const;
71 bool inViewport() const;
72 void setInventoryOpen(bool open);
73 void setVerb(RunawayVerb verb, byte actionCursor = 0);
74 void updateCursor();
75 Common::U32String inventoryCaption() const;
76 void drawInventory(Graphics::ManagedSurface &screen);
77
78 RunawayAudio _audio;
79 RunawayInventory &_inventory;
80 const RunawayStrings &_strings;
81 bool _museum = false;
83 RunawayFont _font;
84 Graphics::ManagedSurface _cursors, _demoLogo, _cursor, _inventoryButton, _returnButton, _optionsButton;
85 Graphics::ManagedSurface _inventoryBackground, _inventoryTexture, _icons;
86 RunawayAnimation _portrait, _idlePortrait;
87 Common::Point _mouse;
89 Common::Array<Common::Rect> _choiceRects;
90 RunawayVerb _verb = kVerbWalk;
91 byte _cursorType = 0, _previousCursor = 0, _actionCursor = 0;
92 bool _preferLook = false;
93 byte _hovered = 0, _buttonFrame = 0, _optionsFrame = 0, _pickupItem = 0;
94 bool _inventoryOpen = false, _enteredInventory = false, _returnAfterPickup = false;
95 bool _inventoryPresentation = false;
96 bool _roomHasVerbs = true;
97 bool _pointerSound = true;
98 bool _pickupSoundPlayed = false;
99 bool _blocked = false, _speaking = false, _cursorPushed = false;
100 uint32 _now = 0, _buttonTick = 0, _verbStarted = 0, _portraitTick = 0;
101 uint32 _blinkUntil = 0, _idleStarted = 0, _lastInteraction = 0, _pickupStarted = 0;
102 uint _mouth = 0;
103 int _cursorKey = -1;
104};
105
106} // End of namespace Hollywood
107
108#endif
Definition: mixer.h:70
Definition: random.h:44
Definition: ustr.h:57
Definition: managed_surface.h:51
Definition: inventory.h:41
Definition: strings.h:37
Definition: ui.h:34
Definition: rect.h:144
Definition: rect.h:536