ScummVM API documentation
scene.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_SCENE_H
23#define HARVESTER_SCENE_H
24
25#include "common/error.h"
26#include "common/str.h"
27#include "harvester/combat/combat.h"
28#include "harvester/scene/input.h"
29#include "harvester/player/player.h"
30#include "harvester/scene/interaction.h"
31#include "harvester/scene/room_presentation.h"
32#include "harvester/scene/scene_entities.h"
33#include "harvester/scene/room_support.h"
34#include "harvester/entity.h"
35
36namespace Harvester {
37
38class EntityManager;
39class Flow;
40class InventorySystem;
41
43public:
45 CheatSystem &cheats);
46
47 Common::Error runRoomLoop(Flow &flow, const Common::String &targetName, bool targetIsRoomName);
48
49private:
50 HarvesterEngine &_engine;
51 InventorySystem &_inventory;
52 CheatSystem &_cheats;
53};
54
56 Common::String roomName;
57 bool isRoomName = false;
58 bool usesSavedRoomState = false;
59 SaveRoomState savedRoomState;
60};
61
63public:
64 Scene(HarvesterEngine &engine, Flow &flow, SceneState &scene, EntityManager *entityManager,
65 InventorySystem &inventory, CheatSystem &cheats, const RoomViewResources &view, bool canExitCloseupToParent);
66
67 Player &getPlayer() { return _player; }
68 InputState &getInputState() { return _inputState; }
69
70 void initializePlayerState();
71 InputResult runRoomEntryInteraction(const InteractionResult &interaction);
72 InputResult runRoomFrames(const Common::String &currentRoomTarget);
73 const RoomPendingTransition &getPendingTransition() const { return _pendingTransition; }
74 void clearPendingRegionInteraction() { _pendingRegionName.clear(); }
75 void capturePlayerAttackTarget(const Common::Point &mousePos, const NpcRecord *npc);
76 Common::Error killDebugActiveMonster(const Common::Point &mousePos, bool &needsRedraw);
77
78 void syncGlobalTimerEntities(const Common::Array<TimerRecord> &previousTimerRecords) override;
79 bool captureDialogueBackdrop(IndexedBitmap &backdrop) override;
80 Common::Error showCdChangePrompt(int discNumber) override;
81 Common::Error runRoomExitCommands() override;
82 Common::Error applyLightingCommand(StartupLightingCommand command) override;
83 void applyPlayerGotoXZ(int x, int z) override;
84 Common::Error runModalShowText(const ResolvedText &text) override;
85 void startPlayerDefeatSequence(const char *reason, const Common::String &sourceName, int damageType) override;
86 void resetIdleState() override;
87 void notePlayerActivity() override;
88 bool isPlayerCombatLocked() const;
89 bool cancelPlayerAttackAnimation();
90 void stopPlayerRegionInteraction() override;
91 void syncPlayerPlacement();
92 void captureCurrentSaveState();
93 bool applyCurrentRoomRuntimeMutationsInPlace(bool preservePaletteState) override;
94 bool refreshCurrentScene(bool preservePlayerPlacement) override;
95
96private:
97 struct PlayerControlState {
98 bool alive;
99 bool paused;
100 bool canAct;
101 };
102
103 void syncAnimatedRoomActorPlacement();
104 void requestPlayerGameOver(const char *reason, const Common::String &sourceName);
105 void updateRoomInterface(bool &needsRedraw);
106 InputResult drawRoomFrame(bool &needsRedraw);
107 InputResult pollRoomEvents(Input &input, bool &needsRedraw);
108 PlayerControlState preparePlayerControlState();
109 Common::Error tryActivatePendingRegion(bool &needsRedraw);
110 Common::Error tryActivatePassiveRegion(bool &needsRedraw);
111 void advanceRuntimeEntities(bool &needsRedraw);
112 Common::Error resolvePlayerAttackContact(bool &needsRedraw);
113 void updatePlayerCombatAnimations(bool &needsRedraw);
114 void updatePlayerControls(const PlayerControlState &control, bool &needsRedraw);
115 Common::Error updateRoomMonsterCombat(bool &needsRedraw);
116 void syncCombatHitEffects(bool &needsRedraw);
117 void updatePlayerDeath(bool &needsRedraw);
118 void pruneCombatEffects(bool &needsRedraw);
119 InputResult dispatchExpiredTimers(bool &needsRedraw);
120 void updateIdleAnimation(bool &needsRedraw);
121
122 HarvesterEngine &_engine;
123 Flow &_flow;
124 SceneState &_scene;
125 EntityManager *_entityManager;
126 InventorySystem &_inventory;
127 SceneEntities _sceneRuntime;
128 Player _player;
129 CombatEffects _combatEffects;
130 InputState _inputState;
131 Common::String _pendingRegionName;
132 CheatSystem &_cheats;
133 const RoomViewResources _view;
134 bool _canExitCloseupToParent;
135 RoomPresentationState _presentationState;
136 RoomPendingTransition _pendingTransition;
137 ItemInteractions _roomItems;
138 RoomPresentation _presentation;
139 Interaction _interactionProcessor;
140 Combat _combat;
141};
142
143} // End of namespace Harvester
144
145#endif // HARVESTER_SCENE_H
Definition: array.h:52
Definition: error.h:81
Definition: str.h:59
Definition: cheats.h:52
Definition: combat.h:233
Definition: combat.h:132
Definition: entity.h:184
Definition: flow.h:45
Definition: harvester.h:47
Definition: input.h:110
Definition: interaction.h:43
Definition: interaction.h:104
Definition: inventory.h:54
Definition: interaction.h:63
Definition: player.h:105
Definition: room_presentation.h:61
Definition: scene_entities.h:31
Definition: scene.h:62
Definition: scene.h:42
Definition: rect.h:144
Definition: bitmap.h:33
Definition: input.h:98
Definition: input.h:74
Definition: script.h:311
Definition: script.h:132
Definition: script.h:306
Definition: scene.h:55
Definition: room_presentation.h:51
Definition: room_presentation.h:42
Definition: saveload.h:29
Definition: room_support.h:46