aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine/features.h
diff options
context:
space:
mode:
authorFilippos Karapetis2010-02-03 11:02:43 +0000
committerFilippos Karapetis2010-02-03 11:02:43 +0000
commit2fb37063a4ef85aa862b8fdf035d03f6b801679e (patch)
treeb79cdb9e904ffa954d3ff86fef5eee5b616e10d5 /engines/sci/engine/features.h
parentbaf6b53431bbb1b5a630fd153fe3df350e3d16fd (diff)
downloadscummvm-rg350-2fb37063a4ef85aa862b8fdf035d03f6b801679e.tar.gz
scummvm-rg350-2fb37063a4ef85aa862b8fdf035d03f6b801679e.tar.bz2
scummvm-rg350-2fb37063a4ef85aa862b8fdf035d03f6b801679e.zip
Placed all the game feature detection code in a separate class
svn-id: r47850
Diffstat (limited to 'engines/sci/engine/features.h')
-rw-r--r--engines/sci/engine/features.h121
1 files changed, 121 insertions, 0 deletions
diff --git a/engines/sci/engine/features.h b/engines/sci/engine/features.h
new file mode 100644
index 0000000000..11948a5987
--- /dev/null
+++ b/engines/sci/engine/features.h
@@ -0,0 +1,121 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#ifndef SCI_INCLUDE_FEATURES_H
+#define SCI_INCLUDE_FEATURES_H
+
+#include "sci/resource.h"
+#include "sci/engine/seg_manager.h"
+
+namespace Sci {
+
+enum FeatureDetection {
+ kDetectGfxFunctions = 0,
+ kDetectMoveCountType = 1,
+ kDetectSoundType = 2,
+ kDetectSetCursorType = 3,
+ kDetectLofsType = 4,
+ kDetectSci21KernelTable = 5
+};
+
+class GameFeatures {
+public:
+ GameFeatures(SegManager *segMan, Kernel *kernel);
+ ~GameFeatures() {}
+
+ void setGameInfo(reg_t gameObj, Common::String gameId);
+
+ /**
+ * Autodetects the DoSound type
+ * @return DoSound type, SCI_VERSION_0_EARLY / SCI_VERSION_0_LATE /
+ * SCI_VERSION_1_EARLY / SCI_VERSION_1_LATE
+ */
+ SciVersion detectDoSoundType();
+
+ /**
+ * Autodetects the SetCursor type
+ * @return SetCursor type, SCI_VERSION_0_EARLY / SCI_VERSION_1_1
+ */
+ SciVersion detectSetCursorType();
+
+ /**
+ * Autodetects the Lofs type
+ * @return Lofs type, SCI_VERSION_0_EARLY / SCI_VERSION_1_MIDDLE / SCI_VERSION_1_1
+ */
+ SciVersion detectLofsType();
+
+ /**
+ * Autodetects the graphics functions used
+ * @return Graphics functions type, SCI_VERSION_0_EARLY / SCI_VERSION_0_LATE
+ */
+ SciVersion detectGfxFunctionsType();
+
+#ifdef ENABLE_SCI32
+ /**
+ * Autodetects the kernel functions used in SCI2.1
+ * @return Graphics functions type, SCI_VERSION_2 / SCI_VERSION_2_1
+ */
+ SciVersion detectSci21KernelType();
+#endif
+
+ /**
+ * Applies to all versions before 0.000.502
+ * Old SCI versions used to interpret the third DrawPic() parameter inversely,
+ * with the opposite default value (obviously).
+ * Also, they used 15 priority zones from 42 to 200 instead of 14 priority
+ * zones from 42 to 190.
+ */
+ bool usesOldGfxFunctions() { return detectGfxFunctionsType() == SCI_VERSION_0_EARLY; }
+
+ /**
+ * Autodetects the Bresenham routine used in the actor movement functions
+ * @return Move count type, kIncrementMoveCnt / kIgnoreMoveCnt
+ */
+ MoveCountType detectMoveCountType();
+
+ bool handleMoveCount() { return detectMoveCountType() == kIncrementMoveCount; }
+
+ bool usesCdTrack() { return _usesCdTrack; }
+
+private:
+ bool autoDetectFeature(FeatureDetection featureDetection, int methodNum = -1);
+
+ SciVersion _doSoundType, _setCursorType, _lofsType, _gfxFunctionsType;
+#ifdef ENABLE_SCI32
+ SciVersion _sci21KernelType;
+#endif
+
+ MoveCountType _moveCountType;
+ bool _usesCdTrack;
+
+ SegManager *_segMan;
+ Kernel *_kernel;
+ reg_t _gameObj;
+ Common::String _gameId;
+};
+
+} // End of namespace Sci
+
+#endif // SCI_INCLUDE_ENGINE_H