ScummVM API documentation
features.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 SCI_ENGINE_FEATURES_H
23 #define SCI_ENGINE_FEATURES_H
24 
25 #include "sci/resource/resource.h"
26 #include "sci/engine/seg_manager.h"
27 
28 namespace Sci {
29 
30 enum MoveCountType {
31  kMoveCountUninitialized,
32  kIgnoreMoveCount,
33  kIncrementMoveCount
34 };
35 
36 enum PseudoMouseAbilityType {
37  kPseudoMouseAbilityUninitialized,
38  kPseudoMouseAbilityFalse,
39  kPseudoMouseAbilityTrue
40 };
41 
42 enum MessageTypeSyncStrategy {
43  kMessageTypeSyncStrategyNone,
44  kMessageTypeSyncStrategyDefault
45 #ifdef ENABLE_SCI32
46  ,
47  kMessageTypeSyncStrategyLSL6Hires,
48  kMessageTypeSyncStrategyShivers
49 #endif
50 };
51 
52 enum {
53  kSpeedThrottleDefaultDelay = 30 // kGameIsRestarting default max delay in ms
54 };
55 
56 class GameFeatures {
57 public:
58  GameFeatures(SegManager *segMan, Kernel *kernel);
59  ~GameFeatures() {}
60 
67 
73 
79 
85 
91 
92 #ifdef ENABLE_SCI32
93 
97  SciVersion detectSci21KernelType();
98 
99  inline bool usesModifiedAudioAttenuation() const {
100  switch (g_sci->getGameId()) {
101  // Assuming MGDX uses modified attenuation since SQ6 does and it was
102  // released earlier, but not verified (Phar Lap Windows-only release)
103  case GID_MOTHERGOOSEHIRES:
104  case GID_PQ4:
105  case GID_SQ6:
106  return true;
107  case GID_KQ7:
108  // KQ7 1.51 (SCI2.1early) uses the non-standard attenuation, but
109  // 2.00b (SCI2.1mid) does not
110  return getSciVersion() == SCI_VERSION_2_1_EARLY;
111  default:
112  return false;
113  }
114  }
115 
116  inline bool gameScriptsControlMasterVolume() const {
117  switch (g_sci->getGameId()) {
118  case GID_LSL7:
119  case GID_PHANTASMAGORIA2:
120  case GID_TORIN:
121  return true;
122  default:
123  return false;
124  }
125  }
126 
127  inline bool hasSci3Audio() const {
128  return getSciVersion() == SCI_VERSION_3 || g_sci->getGameId() == GID_GK2;
129  }
130 
131  inline bool hasTransparentPicturePlanes() const {
132  const SciGameId &gid = g_sci->getGameId();
133 
134  // MGDX is assumed to not have transparent picture planes since it
135  // was released before SQ6, but this has not been verified since it
136  // cannot be disassembled at the moment (Phar Lap Windows-only release)
137  return getSciVersion() >= SCI_VERSION_2_1_MIDDLE &&
138  gid != GID_SQ6 &&
139  gid != GID_MOTHERGOOSEHIRES;
140  }
141 
142  inline bool hasMidPaletteCode() const {
143  return getSciVersion() >= SCI_VERSION_2_1_MIDDLE || g_sci->getGameId() == GID_KQ7;
144  }
145 
146  inline bool hasLatePaletteCode() const {
147  return getSciVersion() > SCI_VERSION_2_1_MIDDLE ||
148  g_sci->getGameId() == GID_GK2 ||
149  g_sci->getGameId() == GID_PQSWAT ||
150  // Guessing that Shivers has the late palette code because it has a
151  // brightness slider
152  g_sci->getGameId() == GID_SHIVERS ||
153  g_sci->getGameId() == GID_TORIN;
154  }
155 
156  inline bool VMDOpenStopsAudio() const {
157  // Of the games that use VMDs:
158  // Yes: Phant1, Shivers, Torin
159  // No: SQ6
160  // TODO: Optional extra flag to kPlayVMD which defaults to Yes: PQ:SWAT
161  // TODO: SCI3, GK2 (GK2's VMD code is closer to SCI3 than SCI21)
162  return getSciVersion() == SCI_VERSION_2_1_MIDDLE &&
163  g_sci->getGameId() != GID_SQ6 &&
164  g_sci->getGameId() != GID_GK2;
165  }
166 
167  inline bool useDoSoundMac32() const {
168  // Several SCI 2.1 Middle Mac games use a modified kDoSound with
169  // different subop numbers.
170  return g_sci->getPlatform() == Common::kPlatformMacintosh &&
171  (g_sci->getGameId() == GID_HOYLE5 ||
172  g_sci->getGameId() == GID_PHANTASMAGORIA ||
173  g_sci->getGameId() == GID_PQSWAT ||
174  g_sci->getGameId() == GID_SHIVERS ||
175  g_sci->getGameId() == GID_SQ6);
176  }
177 
178  inline bool useMacGammaLevel() const {
179  // SCI32 Mac interpreters were hard-coded to use gamma level 2 until
180  // Torin's Passage, PQSWAT, and the 2.1 Late games. The colors in
181  // the game resources are significantly darker than their PC versions.
182  // Confirmed in disassembly of all Mac interpreters.
183  return g_sci->getPlatform() == Common::kPlatformMacintosh &&
184  getSciVersion() >= SCI_VERSION_2 &&
185  getSciVersion() < SCI_VERSION_2_1_LATE &&
186  g_sci->getGameId() != GID_PQSWAT &&
187  g_sci->getGameId() != GID_TORIN;
188  }
189 
190  inline bool usesAlternateSelectors() const {
191  return g_sci->getGameId() == GID_PHANTASMAGORIA2;
192  }
193 #endif
194 
198  bool supportsSpeechWithSubtitles() const;
199 
203  bool supportsTextSpeed() const {
204  switch (g_sci->getGameId()) {
205  case GID_GK1:
206  case GID_SQ6:
207  return true;
208  default:
209  return false;
210  }
211  }
212 
217  bool audioVolumeSyncUsesGlobals() const;
218 
223  MessageTypeSyncStrategy getMessageTypeSyncStrategy() const;
224 
232  bool usesOldGfxFunctions() { return detectGfxFunctionsType() == SCI_VERSION_0_EARLY; }
233 
238  MoveCountType detectMoveCountType();
239 
240  int detectPlaneIdBase();
241 
242  bool handleMoveCount() { return detectMoveCountType() == kIncrementMoveCount; }
243 
244  bool usesCdTrack() { return _usesCdTrack; }
245 
251  bool useAltWinGMSound();
252 
256  bool generalMidiOnly();
257 
262  void forceDOSTracks() { _forceDOSTracks = true; }
263 
264  bool useWindowsCursors() { return _useWindowsCursors; }
265 
270  PseudoMouseAbilityType detectPseudoMouseAbility();
271 
272  bool useEarlyGetLongestTextCalculations() const;
273 
280  bool hasScriptObjectNames() const;
281 
287  bool canSaveFromGMM() const;
288 
295  uint16 getGameFlagsGlobal() const;
296 
302  bool isGameFlagBitOrderNormal() const;
303 
304 private:
305  reg_t getDetectionAddr(const Common::String &objName, Selector slc, int methodNum = -1);
306 
307  bool autoDetectLofsType(const Common::String& gameSuperClassName, int methodNum);
308  bool autoDetectGfxFunctionsType(int methodNum = -1);
309  bool autoDetectSoundType();
310  bool autoDetectMoveCountType();
311 #ifdef ENABLE_SCI32
312  bool autoDetectSci21KernelType();
313 #endif
314 
315  SciVersion _doSoundType, _setCursorType, _lofsType, _gfxFunctionsType, _messageFunctionType;
316 #ifdef ENABLE_SCI32
317  SciVersion _sci21KernelType;
318 #endif
319 
320  MoveCountType _moveCountType;
321  bool _usesCdTrack;
322  bool _forceDOSTracks;
323  bool _useWindowsCursors;
324 
325  PseudoMouseAbilityType _pseudoMouseAbility;
326 
327  SegManager *_segMan;
328  Kernel *_kernel;
329 };
330 
331 } // End of namespace Sci
332 
333 #endif // SCI_ENGINE_FEATURES_H
SciVersion detectSetCursorType()
Definition: str.h:59
uint16 getGameFlagsGlobal() const
bool isGameFlagBitOrderNormal() const
SciVersion
Definition: detection.h:133
SciEngine * g_sci
SciVersion detectGfxFunctionsType()
Definition: kernel.h:157
SciVersion detectMessageFunctionType()
bool supportsSpeechWithSubtitles() const
bool usesOldGfxFunctions()
Definition: features.h:232
bool canSaveFromGMM() const
Common::Platform getPlatform() const
bool hasScriptObjectNames() const
SciVersion detectDoSoundType()
bool supportsTextSpeed() const
Definition: features.h:203
Definition: console.h:28
PseudoMouseAbilityType detectPseudoMouseAbility()
Definition: seg_manager.h:48
bool audioVolumeSyncUsesGlobals() const
MoveCountType detectMoveCountType()
SciVersion detectLofsType()
MessageTypeSyncStrategy getMessageTypeSyncStrategy() const
Definition: features.h:56
Definition: vm_types.h:39
void forceDOSTracks()
Definition: features.h:262