ScummVM API documentation
site.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 EEM_SITE_H
23 #define EEM_SITE_H
24 
25 #include "common/events.h"
26 #include "common/rect.h"
27 #include "common/scummsys.h"
28 
29 #include "graphics/managed_surface.h"
30 
31 #include "eem/resource.h" // Picture / Animation
32 
33 namespace EEM {
34 
35 class EEMEngine;
36 class Mystery;
37 
43 uint partnerFrameAtTick(uint16 seqnum, uint numFrames, uint32 tickMs);
44 
46 uint oneShotFrameAtTick(uint16 seqnum, uint numFrames, uint32 tickMs);
47 
49 uint32 oneShotDurationMs(uint16 seqnum, uint numFrames);
50 
54 void setLondonAnimScripts(bool enabled);
55 
59 uint bigMapPartnerFrameAtTick(uint numFrames, uint32 elapsedMs, bool london);
60 
63 uint bigMapDetailPartnerFrameAtTick(uint numFrames, uint32 elapsedMs);
64 
67 void blitAnimFrameAnchored(Graphics::Surface *screen, const Picture &p,
68  int anchorX, int anchorY);
69 
71  byte white;
72  byte black;
73 };
74 
77 MacSpritePaletteMap getMacSpritePaletteMap();
78 byte mapMacSpriteColor(byte color, const MacSpritePaletteMap &paletteMap);
79 void blitMacMaskedSurface(Graphics::Surface *dst, const Picture &p,
80  int x, int y, bool flipX = false);
81 void blitMacMaskedSurface(Graphics::Surface *dst, const Picture &p,
82  int x, int y, bool flipX,
83  const MacSpritePaletteMap &paletteMap);
84 void blitMacAnimFrameAnchored(Graphics::Surface *dst, const Picture &p,
85  int anchorX, int anchorY);
86 void blitMacAnimFrameAnchored(Graphics::Surface *dst, const Picture &p,
87  int anchorX, int anchorY,
88  const MacSpritePaletteMap &paletteMap);
89 
94 void remapMacSurfaceEndpoints(Graphics::ManagedSurface &surface,
95  const MacSpritePaletteMap &paletteMap);
96 
98 void cyclePaletteRange(uint8 start, uint8 end);
99 
102 void cyclePaletteRangeReverse(uint8 start, uint8 end);
103 
105 void applyHotspotGlowPalette();
106 
108 struct Hotspot {
109  int16 x1, y1, x2, y2;
110  uint16 clueOffset;
111  uint16 hotspotIndex;
112  uint16 extra;
113 
114  Common::Rect rect() const { return Common::Rect(x1, y1, x2, y2); }
115 };
116 
119 public:
120  SiteScreen(EEMEngine *vm, Mystery *mystery)
121  : _vm(vm), _mystery(mystery) {}
122 
124  void enter(uint siteNum, bool resetPartnerMood = true);
125 
127  void run();
128 
129 private:
130  bool notifyEvent(const Common::Event &event) override;
131 
132  void renderBackground(uint siteNum);
133  void renderHotspots(uint siteNum);
134  int hotspotAtPoint(uint siteNum, int x, int y) const;
136  int hotspotCursorId(uint siteNum, int idx) const;
137  void updateHotspotCursor(uint siteNum, int x, int y);
138  void onHotspotClicked(uint siteNum, uint hotIdx);
142  void displayClueAndAutosave(const byte *clueBlock, bool forceSave = false);
143  void initImpatienceCounter();
144  bool checkImpatienceCounter();
145  void notePartnerActivity();
146  bool playLondonTravelAnimation(uint fromSite, uint toSite);
147 
149  bool enterSiteAnim();
150 
152  void renderPartner(uint siteNum, uint32 tickMs);
153 
157  bool partnerIdleAnimParams(uint siteNum, uint16 &animId, int &x, int &y);
158 
160  bool renderFloppyHotspotPartnerPose(uint siteNum);
161 
162  void renderStaticDrops(uint siteNum);
163  void renderFloppyDrops(uint siteNum);
164  void renderAnimatedDrops(uint siteNum, uint32 tickMs);
165 
168  void captureBgSnapshot();
169 
171  void restoreBgSnapshot();
172 
177  void syncCompositedScreen();
178 
181  void scanColorCycles(uint siteNum);
182 
184  void applyColorCycles();
185 
186  EEMEngine *_vm;
187  Mystery *_mystery;
188  enum PartnerWaitMood {
189  kPartnerWaitDefault,
190  kPartnerWaitPatient,
191  kPartnerWaitImpatient
192  };
193  int _snapshotSite = -1;
194  Graphics::ManagedSurface _bgSnapshot;
195  uint32 _lastTickMs = 0;
196  uint32 _impatientDeadlineMs = 0;
197  PartnerWaitMood _partnerWaitMood = kPartnerWaitDefault;
198 
200  uint32 _waitPhaseAnchor = 0;
201 
203  struct ColorCycleRange { uint8 start, end; };
204  Common::Array<ColorCycleRange> _colorCycles;
205 };
206 
207 } // End of namespace EEM
208 
209 #endif
Definition: managed_surface.h:51
uint16 clueOffset
+8: byte offset of ClueBlock in the mystery file
Definition: site.h:110
Definition: surface.h:67
uint16 hotspotIndex
+10: zero-based mystery-wide seen ordinal
Definition: site.h:111
Definition: mystery.h:50
One hotspot (search rectangle) within a site, 14 bytes on disk.
Definition: site.h:108
uint16 extra
+12: CD cursor ID for _SwitchMouse; shipped data uses 0
Definition: site.h:112
Definition: site.h:70
Definition: rect.h:524
Definition: resource.h:46
Definition: events.h:329
Definition: animation.h:30
Definition: events.h:210
Definition: eem.h:123
int16 y2
rectangle in screen coordinates
Definition: site.h:109
Site / scene controller.
Definition: site.h:118