ScummVM API documentation
flow.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_FLOW_H
23 #define HARVESTER_FLOW_H
24 
25 #include "common/array.h"
26 #include "common/error.h"
27 #include "common/rect.h"
28 #include "common/str.h"
29 #include "harvester/cheats.h"
30 #include "harvester/dialogue.h"
31 #include "harvester/inventory.h"
32 #include "harvester/menu.h"
33 #include "harvester/room.h"
34 #include "harvester/script.h"
35 
36 namespace Common {
37 struct Event;
38 }
39 
40 namespace Harvester {
41 
42 class HarvesterEngine;
43 class DialogueFlowAccess;
44 class RoomInteractionProcessor;
45 struct IndexedBitmap;
46 
47 class Flow {
48 public:
49  explicit Flow(HarvesterEngine &engine);
50 
51  bool load();
52  bool buildDialogueSaveStateBlob(Common::Array<byte> &blob, uint32 saveVersion);
53  bool loadDialogueSaveStateBlob(const Common::Array<byte> &blob, uint32 saveVersion);
54  Common::Error run();
55 
56 private:
57  friend class HarvesterEngine;
58  friend class DialogueFlowAccess;
59  friend class DialogueSystem;
60  friend class InventorySystem;
61  friend class MenuSystem;
62  friend class RoomInteractionProcessor;
63  friend class RoomSystem;
64 
65  bool loadQuickTips();
66  bool loadMenuItems();
67  Common::Error runQuickTips();
68  Common::Error runDemoIntroduction();
69  Common::Error runDemoEnding();
70  Common::Error runMainMenuStub();
71  Common::Error runRoomMenuStub(const IndexedBitmap &backdrop, const byte *palette,
72  float paletteBrightness, bool canSaveGame);
73  Common::Error runRoomNpcDialogue(const IndexedBitmap &backdrop, const byte *palette,
74  float paletteBrightness, const NpcRecord &npc, const Common::String &usedItemName);
75  Common::Error runTownMapSelector(const Common::String &mapEntryName, Common::String &destinationEntranceName);
76  Common::Error runRoomLoop(const Common::String &entranceName);
77  Common::Error resolveRoomTransitionTarget(const Common::String &targetName, Common::String &resolvedTargetName);
78  bool ensureCursorEntity();
79  bool populateRoomSceneEntities(RoomSetupState &state,
80  const Common::Array<ObjectRecord> &drawableObjects,
81  const Common::Array<AnimRecord> &drawableAnimations);
82  Common::Error beginRoomSetupTransition();
83  Common::Error waitForRoomSetupTransitionHold();
84  Common::Error fadeInRoomScene(const byte *palette, float targetBrightness);
85  Common::Error fadePalette(const byte *palette, float fromBrightness, float toBrightness);
86  bool pumpTransitionEvents(Common::Error &result);
87  void executeStartupAudioCommands(const Common::Array<AudioCommand> &commands);
88  void queueDialogueInteraction(const InteractionResult &interaction);
89  bool takeQueuedDialogueInteraction(InteractionResult &interaction);
90  bool hasQueuedDebugInteraction() const { return _hasQueuedDebugInteraction; }
91  bool queueDebugInteraction(const InteractionResult &interaction);
92  bool takeQueuedDebugInteraction(InteractionResult &interaction);
93  void prepareForNewGame();
94  void requestNewGameRestart();
95  bool hasPendingNewGameRestart() const;
96  bool takePendingNewGameRestart();
97  void clearPendingNewGameRestart();
98  void requestGameOverReturn();
99  bool hasPendingGameOverReturn() const;
100  bool takePendingGameOverReturn();
101  void clearPendingGameOverReturn();
102  void requestMainMenuReturn();
103  bool hasPendingMainMenuReturn() const;
104  bool takePendingMainMenuReturn();
105  void clearPendingMainMenuReturn();
106  void requestCloseupParentRestart();
107  bool hasPendingCloseupParentRestart() const;
108  bool takePendingCloseupParentRestart();
109  void clearPendingCloseupParentRestart();
110  bool requestDebugRoomChange(const Common::String &roomName);
111  bool hasPendingDebugRoomChange() const { return !_pendingDebugRoomName.empty(); }
112  Common::String takePendingDebugRoomChange();
113  void resetRoomNpcDialogueState();
114  void resetCursorAnimationSequence();
115  bool tickRuntimeEntities();
116  bool handleSystemEvent(const Common::Event &event, Common::Error &result);
117 
118  HarvesterEngine &_engine;
121  MenuTextConfig _menuTextConfig;
122  Common::Point _mousePos;
123  DialogueSystem _dialogue;
124  InventorySystem _inventory;
125  MenuSystem _menu;
126  CheatSystem _cheats;
127  RoomSystem _room;
128  InteractionResult _queuedDialogueInteraction;
129  bool _hasQueuedDialogueInteraction = false;
130  InteractionResult _queuedDebugInteraction;
131  bool _hasQueuedDebugInteraction = false;
132  bool _pendingNewGameRestart = false;
133  bool _pendingGameOverReturn = false;
134  bool _pendingMainMenuReturn = false;
135  bool _pendingCloseupParentRestart = false;
136  Common::String _pendingDebugRoomName;
137  uint _roomLoopDepth = 0;
138  uint32 _roomSetupTransitionShownTick = 0;
139 };
140 
141 } // End of namespace Harvester
142 
143 #endif // HARVESTER_FLOW_H
Definition: flow.h:47
Definition: script.h:237
Definition: dialogue.h:44
Definition: str.h:59
Definition: art.h:31
Definition: menu.h:85
Definition: room_interaction.h:56
Definition: script.h:132
Definition: error.h:81
Definition: art.h:35
Definition: room.h:36
Definition: inventory.h:54
Definition: menu.h:40
Definition: events.h:218
Definition: algorithm.h:29
Definition: rect.h:144
Definition: harvester.h:47
Definition: cheats.h:51
Definition: script.h:288