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 
51 void setAnimScripts(bool london, bool macTalkie);
52 uint animationFramePeriodMs();
53 
57 uint bigMapPartnerFrameAtTick(uint numFrames, uint32 elapsedMs, bool london);
58 
61 uint bigMapDetailPartnerFrameAtTick(uint numFrames, uint32 elapsedMs);
62 
65 void blitAnimFrameAnchored(Graphics::Surface *screen, const Picture &p,
66  int anchorX, int anchorY);
67 
69  byte white;
70  byte black;
71 };
72 
75 MacSpritePaletteMap getMacSpritePaletteMap();
76 byte mapMacSpriteColor(byte color, const MacSpritePaletteMap &paletteMap);
77 void blitMacMaskedSurface(Graphics::Surface *dst, const Picture &p,
78  int x, int y, bool flipX = false);
79 void blitMacMaskedSurface(Graphics::Surface *dst, const Picture &p,
80  int x, int y, bool flipX,
81  const MacSpritePaletteMap &paletteMap);
82 void blitMacAnimFrameAnchored(Graphics::Surface *dst, const Picture &p,
83  int anchorX, int anchorY);
84 void blitMacAnimFrameAnchored(Graphics::Surface *dst, const Picture &p,
85  int anchorX, int anchorY,
86  const MacSpritePaletteMap &paletteMap);
87 
92 void remapMacSurfaceEndpoints(Graphics::ManagedSurface &surface,
93  const MacSpritePaletteMap &paletteMap);
94 
96 void cyclePaletteRange(uint8 start, uint8 end);
97 
100 void cyclePaletteRangeReverse(uint8 start, uint8 end);
101 
103 void applyHotspotGlowPalette(bool macCD = false);
104 
106 struct Hotspot {
107  int16 x1, y1, x2, y2;
108  uint16 clueOffset;
109  uint16 hotspotIndex;
110  uint16 extra;
111 
112  Common::Rect rect() const { return Common::Rect(x1, y1, x2, y2); }
113 };
114 
117 public:
118  SiteScreen(EEMEngine *vm, Mystery *mystery)
119  : _vm(vm), _mystery(mystery) {}
120 
122  void enter(uint siteNum, bool resetPartnerMood = true);
123 
125  void run();
126 
127 private:
128  bool notifyEvent(const Common::Event &event) override;
129 
130  void renderBackground(uint siteNum);
131  void renderHotspots(uint siteNum);
132  int hotspotAtPoint(uint siteNum, int x, int y) const;
134  int hotspotCursorId(uint siteNum, int idx) const;
135  void updateHotspotCursor(uint siteNum, int x, int y);
136  void onHotspotClicked(uint siteNum, uint hotIdx);
140  void displayClueAndAutosave(const byte *clueBlock, bool forceSave = false);
141  void initImpatienceCounter();
142  bool checkImpatienceCounter();
143  void notePartnerActivity();
144  bool playLondonTravelAnimation(uint fromSite, uint toSite);
145 
147  bool enterSiteAnim();
148  bool enterMacSiteAnim(const Graphics::ManagedSurface &bg);
149 
151  void renderPartner(uint siteNum, uint32 tickMs);
152 
156  bool partnerIdleAnimParams(uint siteNum, uint16 &animId, int &x, int &y);
157 
159  bool renderFloppyHotspotPartnerPose(uint siteNum);
160 
161  void renderStaticDrops(uint siteNum);
162  void renderFloppyDrops(uint siteNum);
163  void renderAnimatedDrops(uint siteNum, uint32 tickMs);
164 
167  void captureBgSnapshot();
168 
170  void restoreBgSnapshot();
171 
176  void syncCompositedScreen();
177 
180  void scanColorCycles(uint siteNum);
181 
183  void applyColorCycles();
184 
185  EEMEngine *_vm;
186  Mystery *_mystery;
187  enum PartnerWaitMood {
188  kPartnerWaitDefault,
189  kPartnerWaitPatient,
190  kPartnerWaitImpatient
191  };
192  int _snapshotSite = -1;
193  Graphics::ManagedSurface _bgSnapshot;
194  uint32 _lastTickMs = 0;
195  uint32 _impatientDeadlineMs = 0;
196  PartnerWaitMood _partnerWaitMood = kPartnerWaitDefault;
197 
199  uint32 _waitPhaseAnchor = 0;
200 
202  struct ColorCycleRange { uint8 start, end; };
203  Common::Array<ColorCycleRange> _colorCycles;
204 };
205 
206 } // End of namespace EEM
207 
208 #endif
Definition: managed_surface.h:51
uint16 clueOffset
+8: byte offset of ClueBlock in the mystery file
Definition: site.h:108
Definition: surface.h:67
uint16 hotspotIndex
+10: zero-based mystery-wide seen ordinal
Definition: site.h:109
Definition: mystery.h:50
One hotspot (search rectangle) within a site, 14 bytes on disk.
Definition: site.h:106
uint16 extra
+12: CD cursor ID for _SwitchMouse; shipped data uses 0
Definition: site.h:110
Definition: site.h:68
Definition: rect.h:536
Definition: resource.h:48
Definition: events.h:337
Definition: animation.h:30
Definition: events.h:218
Definition: eem.h:141
int16 y2
rectangle in screen coordinates
Definition: site.h:107
Site / scene controller.
Definition: site.h:116