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  case GID_PQ4:
102  case GID_QFG4:
103  return g_sci->isCD();
104  case GID_MOTHERGOOSEHIRES:
105  case GID_SQ6:
106  // SQ6 1.0 uses modified attenuation, 1.11 does not.
107  // The interpreters are different even though they both have the
108  // same date and version string. ("May 24 1995", "2.100.002")
109  return true;
110  case GID_KQ7:
111  // KQ7 1.51 (SCI2.1early) uses the non-standard attenuation, but
112  // 2.00b (SCI2.1mid) does not
113  return getSciVersion() == SCI_VERSION_2_1_EARLY;
114  default:
115  return false;
116  }
117  }
118 
119  inline bool gameScriptsControlMasterVolume() const {
120  switch (g_sci->getGameId()) {
121  case GID_LSL7:
122  case GID_PHANTASMAGORIA2:
123  case GID_TORIN:
124  return true;
125  default:
126  return false;
127  }
128  }
129 
130  inline bool hasSci3Audio() const {
131  return getSciVersion() == SCI_VERSION_3 || g_sci->getGameId() == GID_GK2;
132  }
133 
134  inline bool hasTransparentPicturePlanes() const {
135  const SciGameId &gid = g_sci->getGameId();
136 
137  // MGDX is assumed to not have transparent picture planes since it
138  // was released before SQ6, but this has not been verified since it
139  // cannot be disassembled at the moment (Phar Lap Windows-only release)
140  return getSciVersion() >= SCI_VERSION_2_1_MIDDLE &&
141  gid != GID_SQ6 &&
142  gid != GID_MOTHERGOOSEHIRES;
143  }
144 
145  inline bool hasMidPaletteCode() const {
146  return getSciVersion() >= SCI_VERSION_2_1_MIDDLE || g_sci->getGameId() == GID_KQ7;
147  }
148 
149  inline bool hasLatePaletteCode() const {
150  return getSciVersion() > SCI_VERSION_2_1_MIDDLE ||
151  g_sci->getGameId() == GID_GK2 ||
152  g_sci->getGameId() == GID_PQSWAT ||
153  // Guessing that Shivers has the late palette code because it has a
154  // brightness slider
155  g_sci->getGameId() == GID_SHIVERS ||
156  g_sci->getGameId() == GID_TORIN;
157  }
158 
159  inline bool VMDOpenStopsAudio() const {
160  // Of the games that use VMDs:
161  // Yes: Phant1, Shivers, Torin
162  // No: SQ6
163  // TODO: Optional extra flag to kPlayVMD which defaults to Yes: PQ:SWAT
164  // TODO: SCI3, GK2 (GK2's VMD code is closer to SCI3 than SCI21)
165  return getSciVersion() == SCI_VERSION_2_1_MIDDLE &&
166  g_sci->getGameId() != GID_SQ6 &&
167  g_sci->getGameId() != GID_GK2;
168  }
169 
170  inline bool useDoSoundMac32() const {
171  // Several SCI 2.1 Middle Mac games use a modified kDoSound with
172  // different subop numbers.
173  return g_sci->getPlatform() == Common::kPlatformMacintosh &&
174  (g_sci->getGameId() == GID_HOYLE5 ||
175  g_sci->getGameId() == GID_PHANTASMAGORIA ||
176  g_sci->getGameId() == GID_PQSWAT ||
177  g_sci->getGameId() == GID_SHIVERS ||
178  g_sci->getGameId() == GID_SQ6);
179  }
180 
181  inline bool useMacGammaLevel() const {
182  // SCI32 Mac interpreters were hard-coded to use gamma level 2 until
183  // Torin's Passage, PQSWAT, and the 2.1 Late games. The colors in
184  // the game resources are significantly darker than their PC versions.
185  // Confirmed in disassembly of all Mac interpreters.
186  return g_sci->getPlatform() == Common::kPlatformMacintosh &&
187  getSciVersion() >= SCI_VERSION_2 &&
188  getSciVersion() < SCI_VERSION_2_1_LATE &&
189  g_sci->getGameId() != GID_PQSWAT &&
190  g_sci->getGameId() != GID_TORIN;
191  }
192 
193  inline bool usesAlternateSelectors() const {
194  return g_sci->getGameId() == GID_PHANTASMAGORIA2;
195  }
196 #endif
197 
201  bool supportsSpeechWithSubtitles() const;
202 
206  bool supportsTextSpeed() const {
207  switch (g_sci->getGameId()) {
208  case GID_GK1:
209  case GID_SQ6:
210  return true;
211  default:
212  return false;
213  }
214  }
215 
220  bool audioVolumeSyncUsesGlobals() const;
221 
226  MessageTypeSyncStrategy getMessageTypeSyncStrategy() const;
227 
235  bool usesOldGfxFunctions() { return detectGfxFunctionsType() == SCI_VERSION_0_EARLY; }
236 
241  MoveCountType detectMoveCountType();
242 
243  int detectPlaneIdBase();
244 
245  bool handleMoveCount() { return detectMoveCountType() == kIncrementMoveCount; }
246 
247  bool usesCdTrack() { return _usesCdTrack; }
248 
254  bool useAltWinGMSound();
255 
259  bool generalMidiOnly();
260 
265  void forceDOSTracks() { _forceDOSTracks = true; }
266 
267  bool useWindowsCursors() { return _useWindowsCursors; }
268 
273  PseudoMouseAbilityType detectPseudoMouseAbility();
274 
275  bool useEarlyGetLongestTextCalculations() const;
276 
283  bool hasScriptObjectNames() const;
284 
290  bool canSaveFromGMM() const;
291 
298  uint16 getGameFlagsGlobal() const;
299 
305  bool isGameFlagBitOrderNormal() const;
306 
307 private:
308  reg_t getDetectionAddr(const Common::String &objName, Selector slc, int methodNum = -1);
309 
310  bool autoDetectLofsType(const Common::String& gameSuperClassName, int methodNum);
311  bool autoDetectGfxFunctionsType(int methodNum = -1);
312  bool autoDetectSoundType();
313  bool autoDetectMoveCountType();
314 #ifdef ENABLE_SCI32
315  bool autoDetectSci21KernelType();
316 #endif
317 
318  SciVersion _doSoundType, _setCursorType, _lofsType, _gfxFunctionsType, _messageFunctionType;
319 #ifdef ENABLE_SCI32
320  SciVersion _sci21KernelType;
321 #endif
322 
323  MoveCountType _moveCountType;
324  bool _usesCdTrack;
325  bool _forceDOSTracks;
326  bool _useWindowsCursors;
327 
328  PseudoMouseAbilityType _pseudoMouseAbility;
329 
330  SegManager *_segMan;
331  Kernel *_kernel;
332 };
333 
334 } // End of namespace Sci
335 
336 #endif // SCI_ENGINE_FEATURES_H
SciVersion detectSetCursorType()
Definition: str.h:59
uint16 getGameFlagsGlobal() const
bool isGameFlagBitOrderNormal() const
SciVersion
Definition: detection.h:134
SciEngine * g_sci
SciVersion detectGfxFunctionsType()
Definition: kernel.h:157
SciVersion detectMessageFunctionType()
bool supportsSpeechWithSubtitles() const
bool usesOldGfxFunctions()
Definition: features.h:235
bool canSaveFromGMM() const
Common::Platform getPlatform() const
bool hasScriptObjectNames() const
SciVersion detectDoSoundType()
bool supportsTextSpeed() const
Definition: features.h:206
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:265