ScummVM API documentation
room_support.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_ROOM_SUPPORT_H
23 #define HARVESTER_ROOM_SUPPORT_H
24 
25 #include "common/array.h"
26 #include "common/rect.h"
27 #include "common/scummsys.h"
28 #include "common/str.h"
29 #include "harvester/script.h"
30 
31 namespace Graphics {
32 class Font;
33 class Screen;
34 }
35 
36 namespace Harvester {
37 
38 class HarvesterEngine;
39 class ResourceManager;
40 class Entity;
41 class Art;
42 class DialogueSystem;
43 struct IndexedBitmap;
44 
46  RoomSetupState state;
47  byte palette[256 * 3] = { 0 };
48  Common::Array<ObjectRecord> sceneObjects;
49  Common::Array<AnimRecord> sceneAnimations;
50  Common::Array<RegionRecord> sceneRegions;
51  float targetPaletteBrightness = 1.0f;
52 };
53 
55  Entity *entity = nullptr;
56  int centerX = 0;
57  int bottomY = 0;
58  float z = 0.0f;
59  int facing = -1;
60  // Mirrors native RenderEntityRuntime.player_combat_loadout_id (+0x11bc).
61  int combatLoadout = 0;
62  uint32 nextMovementTick = 0;
63  bool hasMoveTarget = false;
64  int targetX = 0;
65  int targetBottomY = 0;
66  float targetZ = 0.0f;
67  bool moveTargetRequiresScreenY = false;
68  bool moveTargetXReached = false;
69  bool moveTargetZReached = false;
70  Common::String currentBlockerName;
71  // Native RenderEntityRuntime keeps these directional blocker-history
72  // pointers at +0x108c..+0x1098 and clears them when no current
73  // opaque blocker overlaps the actor.
74  Common::String upwardBlockerHistory;
75  Common::String downwardBlockerHistory;
76  Common::String leftwardBlockerHistory;
77  Common::String rightwardBlockerHistory;
78  bool turnActive = false;
79  int turnTargetFacing = -1;
80  int turnFirstFrame = -1;
81  int turnLastFrame = -1;
82  int turnEndFrame = -1;
83  bool turnPlayBackwards = false;
84  bool attackActive = false;
85  int attackFirstFrame = -1;
86  int attackLastFrame = -1;
87  int attackContactFrame = -1;
88  int attackResumeFacing = -1;
89  bool attackSoundPlayed = false;
90  int attackSoundPlaybackFrame = -1;
91  bool attackContactResolved = false;
92  // Native room combat tracks the live chase/attack focus through
93  // RenderEntityRuntime.combat_target_entity (+0x11a4).
94  Common::String attackTargetName;
95  int attackTargetClassId = -1;
96  bool hitActive = false;
97  int hitFirstFrame = -1;
98  int hitLastFrame = -1;
99  int hitResumeFacing = -1;
100  int hitKnockbackRemainingX = 0;
101  int hitKnockbackDecayStep = 0;
102  bool deathActive = false;
103  int deathFirstFrame = -1;
104  int deathLastFrame = -1;
105  int deathDamageType = 0;
106 };
107 
109  const ObjectRecord *object = nullptr;
110  const NpcRecord *npc = nullptr;
111  const RegionRecord *region = nullptr;
112  const Entity *playerEntity = nullptr;
113  Common::String promptText;
114  int cursorSequence = 7;
115 };
116 
118  Entity *entity = nullptr;
119  int restoreFacing = -1;
120  uint32 activityTick = 0;
121  uint32 resetTick = 0;
122  uint32 triggerTick = 0;
123  bool active = false;
124  bool loopStarted = false;
125  bool exiting = false;
126 };
127 
128 bool applyRoomActorPlacement(const RoomSetupState &state, Entity &entity,
129  int centerX, int bottomY, float z, const Common::String *entranceName = nullptr);
130 void logScenePaletteSummary(const char *label, const RoomSceneResources &scene, float brightness);
131 bool captureScreenBackdrop(const Graphics::Screen &screen, IndexedBitmap &bitmap);
132 Common::Rect getRoomObjectHotspotBounds(const ObjectRecord &object);
133 bool shouldDisplaySceneAnimation(const AnimRecord &anim);
134 bool loadRoomSceneResources(const RoomSetupState &state, ResourceManager &resources, RoomSceneResources &scene);
135 bool shouldRunStartupRoomProbe();
136 void drawRoomScene(HarvesterEngine &engine, Graphics::Screen &screen, const RoomSceneResources &scene,
137  float brightness);
138 const ObjectRecord *findSceneObjectByName(const Common::Array<ObjectRecord> &objects,
139  const Common::String &objectName);
140 const RegionRecord *findSceneRegionByName(const Common::Array<RegionRecord> &regions,
141  const Common::String &regionName);
142 ObjectRecord *findSceneObjectByName(Common::Array<ObjectRecord> &objects,
143  const Common::String &objectName);
144 const IndexedBitmap *resolveInspectTextboxBitmap(const Art &art, const ResolvedText &text);
145 void drawRoomInspectText(Graphics::Screen &screen, const Art &art, const Graphics::Font &font,
146  const ResolvedText &inspectText, bool useNativeFont);
147 bool unlocksRoomObjectInteractionAfterInitialExamine(const ObjectRecord &object,
148  Script &script);
149 bool doesPlayerFacingMatchRegion(int playerFacing, const RegionRecord &region);
150 bool doesPlayerOverlapRegion(const Entity &playerEntity, const RegionRecord &region);
151 RoomHoverState resolveRoomHoverState(HarvesterEngine &engine, const RoomSetupState &state,
152  const Common::Array<ObjectRecord> &sceneObjects,
153  const Common::Array<NpcRecord> &npcs,
154  const Common::Array<RegionRecord> &regions,
155  const Common::Point &mousePos, const DialogueSystem *dialogue = nullptr);
156 void logStartupRoomProbe(HarvesterEngine &engine, const RoomSceneResources &scene,
157  const Common::String &entranceName, Common::Point &mousePos);
158 
159 } // End of namespace Harvester
160 
161 #endif // HARVESTER_ROOM_SUPPORT_H
Definition: script.h:237
Definition: dialogue.h:44
Definition: str.h:59
Definition: art.h:31
Definition: font.h:83
Definition: room_support.h:45
Definition: script.h:132
Definition: art.h:35
Definition: array.h:52
Definition: script.h:319
Definition: room_support.h:54
Definition: room_support.h:108
Definition: rect.h:536
Definition: script.h:86
Definition: atari-screen.h:58
Definition: screen.h:47
Definition: runtime_entity.h:64
Definition: room_support.h:117
Definition: art.h:50
Definition: script.h:283
Definition: formatinfo.h:28
Definition: rect.h:144
Definition: script.h:113
Definition: resources.h:32
Definition: harvester.h:47
Definition: script.h:164