2009-02-16 01:58:30 +00:00
|
|
|
/* 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.
|
|
|
|
*
|
2009-02-17 15:20:21 +00:00
|
|
|
* $URL$
|
|
|
|
* $Id$
|
2009-02-16 01:58:30 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2009-02-15 06:10:59 +00:00
|
|
|
#ifndef SCI_H
|
|
|
|
#define SCI_H
|
|
|
|
|
|
|
|
#include "engines/engine.h"
|
2010-05-04 11:56:52 +00:00
|
|
|
#include "common/util.h"
|
2010-06-10 07:32:05 +00:00
|
|
|
#include "engine/vm_types.h" // for Selector
|
2009-11-23 23:55:19 +00:00
|
|
|
|
|
|
|
struct ADGameDescription;
|
2009-02-21 09:45:34 +00:00
|
|
|
|
2009-11-24 22:10:14 +00:00
|
|
|
/**
|
|
|
|
* This is the namespace of the SCI engine.
|
|
|
|
*
|
|
|
|
* Status of this engine: ???
|
|
|
|
*
|
|
|
|
* Supported games:
|
|
|
|
* - ???
|
|
|
|
*/
|
2009-02-20 14:45:28 +00:00
|
|
|
namespace Sci {
|
2009-02-15 06:10:59 +00:00
|
|
|
|
2009-12-19 16:19:53 +00:00
|
|
|
// Uncomment this to use old music functions
|
2010-01-05 00:25:49 +00:00
|
|
|
//#define USE_OLD_MUSIC_FUNCTIONS
|
2009-10-28 13:20:30 +00:00
|
|
|
|
2009-05-14 12:38:50 +00:00
|
|
|
struct EngineState;
|
2009-07-11 23:45:54 +00:00
|
|
|
class Vocabulary;
|
2009-08-30 01:37:27 +00:00
|
|
|
class ResourceManager;
|
2010-02-13 17:44:58 +00:00
|
|
|
class Kernel;
|
|
|
|
class GameFeatures;
|
|
|
|
class Console;
|
2009-11-04 09:36:18 +00:00
|
|
|
class AudioPlayer;
|
2010-06-09 07:59:42 +00:00
|
|
|
class EventManager;
|
2009-05-11 13:31:17 +00:00
|
|
|
|
2010-02-13 17:43:31 +00:00
|
|
|
class GfxAnimate;
|
|
|
|
class GfxCache;
|
|
|
|
class GfxCompare;
|
|
|
|
class GfxControls;
|
|
|
|
class GfxCoordAdjuster;
|
|
|
|
class GfxCursor;
|
|
|
|
class GfxMenu;
|
|
|
|
class GfxPaint;
|
|
|
|
class GfxPaint16;
|
|
|
|
class GfxPalette;
|
|
|
|
class GfxPorts;
|
|
|
|
class GfxScreen;
|
|
|
|
class SciGui;
|
2010-05-24 21:47:06 +00:00
|
|
|
class GfxMacIconBar;
|
2010-02-13 17:43:31 +00:00
|
|
|
|
|
|
|
#ifdef ENABLE_SCI32
|
|
|
|
class SciGui32;
|
|
|
|
class GfxFrameout;
|
|
|
|
#endif
|
|
|
|
|
2009-02-15 06:10:59 +00:00
|
|
|
// our engine debug levels
|
2009-02-20 20:11:12 +00:00
|
|
|
enum kDebugLevels {
|
|
|
|
kDebugLevelError = 1 << 0,
|
|
|
|
kDebugLevelNodes = 1 << 1,
|
|
|
|
kDebugLevelGraphics = 1 << 2,
|
|
|
|
kDebugLevelStrings = 1 << 3,
|
2009-05-30 15:40:49 +00:00
|
|
|
kDebugLevelMemory = 1 << 4,
|
2009-02-20 20:11:12 +00:00
|
|
|
kDebugLevelFuncCheck = 1 << 5,
|
|
|
|
kDebugLevelBresen = 1 << 6,
|
|
|
|
kDebugLevelSound = 1 << 7,
|
|
|
|
kDebugLevelGfxDriver = 1 << 8,
|
|
|
|
kDebugLevelBaseSetter = 1 << 9,
|
|
|
|
kDebugLevelParser = 1 << 10,
|
2009-07-04 11:33:51 +00:00
|
|
|
kDebugLevelMenu = 1 << 11,
|
|
|
|
kDebugLevelSaid = 1 << 12,
|
|
|
|
kDebugLevelFile = 1 << 13,
|
|
|
|
kDebugLevelTime = 1 << 14,
|
|
|
|
kDebugLevelRoom = 1 << 15,
|
|
|
|
kDebugLevelAvoidPath = 1 << 16,
|
|
|
|
kDebugLevelDclInflate = 1 << 17,
|
|
|
|
kDebugLevelVM = 1 << 18,
|
2009-07-06 10:39:22 +00:00
|
|
|
kDebugLevelScripts = 1 << 19,
|
2009-09-06 21:56:49 +00:00
|
|
|
kDebugLevelGC = 1 << 20,
|
2009-10-10 00:07:19 +00:00
|
|
|
kDebugLevelSci0Pic = 1 << 21,
|
2010-01-29 01:31:05 +00:00
|
|
|
kDebugLevelResMan = 1 << 22,
|
|
|
|
kDebugLevelOnStartup = 1 << 23
|
2009-02-15 06:10:59 +00:00
|
|
|
};
|
|
|
|
|
2009-08-30 01:37:27 +00:00
|
|
|
/** SCI versions */
|
|
|
|
enum SciVersion {
|
2010-01-03 22:50:39 +00:00
|
|
|
SCI_VERSION_NONE,
|
2009-08-30 01:37:27 +00:00
|
|
|
SCI_VERSION_0_EARLY, // Early KQ4, 1988 xmas card
|
|
|
|
SCI_VERSION_0_LATE, // KQ4, LSL2, LSL3, SQ3 etc
|
|
|
|
SCI_VERSION_01, // KQ1 and multilingual games (S.old.*)
|
|
|
|
SCI_VERSION_1_EGA, // EGA with parser, QFG2
|
|
|
|
SCI_VERSION_1_EARLY, // KQ5. (EGA/VGA)
|
|
|
|
SCI_VERSION_1_MIDDLE, // LSL1, JONESCD. (EGA?/VGA)
|
|
|
|
SCI_VERSION_1_LATE, // ECO1, LSL5. (EGA/VGA)
|
|
|
|
SCI_VERSION_1_1, // KQ6, ECO2
|
|
|
|
SCI_VERSION_2, // GK1, PQ4 (Floppy), QFG4 (Floppy)
|
|
|
|
SCI_VERSION_2_1, // GK2, KQ7, SQ6, Torin
|
|
|
|
SCI_VERSION_3 // LSL7, RAMA, Lighthouse
|
|
|
|
};
|
|
|
|
|
2010-02-13 17:46:44 +00:00
|
|
|
/** Supported languages */
|
|
|
|
enum kLanguage {
|
|
|
|
K_LANG_NONE = 0,
|
|
|
|
K_LANG_ENGLISH = 1,
|
|
|
|
K_LANG_FRENCH = 33,
|
|
|
|
K_LANG_SPANISH = 34,
|
|
|
|
K_LANG_ITALIAN = 39,
|
|
|
|
K_LANG_GERMAN = 49,
|
|
|
|
K_LANG_JAPANESE = 81,
|
|
|
|
K_LANG_PORTUGUESE = 351
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-02-15 06:10:59 +00:00
|
|
|
class SciEngine : public Engine {
|
2009-06-07 23:04:34 +00:00
|
|
|
friend class Console;
|
2009-02-15 22:43:13 +00:00
|
|
|
public:
|
2009-10-09 23:19:53 +00:00
|
|
|
SciEngine(OSystem *syst, const ADGameDescription *desc);
|
2009-02-15 22:43:13 +00:00
|
|
|
~SciEngine();
|
2009-02-15 06:10:59 +00:00
|
|
|
|
2009-03-01 04:42:46 +00:00
|
|
|
// Engine APIs
|
|
|
|
virtual Common::Error run();
|
2009-10-11 15:51:43 +00:00
|
|
|
bool hasFeature(EngineFeature f) const;
|
2009-06-02 19:03:43 +00:00
|
|
|
void pauseEngineIntern(bool pause);
|
2009-05-11 13:31:17 +00:00
|
|
|
virtual GUI::Debugger *getDebugger();
|
2009-07-03 14:22:50 +00:00
|
|
|
Console *getSciDebugger();
|
2009-10-11 15:51:43 +00:00
|
|
|
Common::Error loadGameState(int slot);
|
|
|
|
Common::Error saveGameState(int slot, const char *desc);
|
|
|
|
bool canLoadGameStateCurrently();
|
|
|
|
bool canSaveGameStateCurrently();
|
2010-01-12 00:51:37 +00:00
|
|
|
void syncSoundSettings();
|
2009-02-21 09:45:34 +00:00
|
|
|
|
2009-02-18 20:08:49 +00:00
|
|
|
const char* getGameID() const;
|
2009-02-22 03:40:51 +00:00
|
|
|
int getResourceVersion() const;
|
2009-02-18 20:08:49 +00:00
|
|
|
Common::Language getLanguage() const;
|
|
|
|
Common::Platform getPlatform() const;
|
|
|
|
uint32 getFlags() const;
|
2010-02-13 17:44:19 +00:00
|
|
|
bool isDemo() const;
|
|
|
|
|
2010-02-13 17:45:40 +00:00
|
|
|
inline ResourceManager *getResMan() const { return _resMan; }
|
|
|
|
inline Kernel *getKernel() const { return _kernel; }
|
|
|
|
inline EngineState *getEngineState() const { return _gamestate; }
|
|
|
|
inline Vocabulary *getVocabulary() const { return _vocabulary; }
|
2010-06-09 07:59:42 +00:00
|
|
|
inline EventManager *getEventManager() const { return _eventMan; }
|
2010-06-10 08:11:38 +00:00
|
|
|
inline reg_t getGameObject() const { return _gameObj; }
|
2009-02-27 01:17:24 +00:00
|
|
|
|
2009-02-20 23:41:15 +00:00
|
|
|
Common::String getSavegameName(int nr) const;
|
2009-02-27 01:17:24 +00:00
|
|
|
Common::String getSavegamePattern() const;
|
|
|
|
|
2010-01-01 09:40:28 +00:00
|
|
|
Common::String getFilePrefix() const;
|
|
|
|
|
2009-02-27 01:17:24 +00:00
|
|
|
/** Prepend 'TARGET-' to the given filename. */
|
|
|
|
Common::String wrapFilename(const Common::String &name) const;
|
|
|
|
|
|
|
|
/** Remove the 'TARGET-' prefix of the given filename, if present. */
|
|
|
|
Common::String unwrapFilename(const Common::String &name) const;
|
|
|
|
|
2010-02-13 17:46:44 +00:00
|
|
|
public:
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Processes a multilanguage string based on the current language settings and
|
|
|
|
* returns a string that is ready to be displayed.
|
|
|
|
* @param str the multilanguage string
|
|
|
|
* @param sep optional seperator between main language and subtitle language,
|
|
|
|
* if NULL is passed no subtitle will be added to the returned string
|
|
|
|
* @return processed string
|
|
|
|
*/
|
|
|
|
Common::String strSplit(const char *str, const char *sep = "\r----------\r");
|
|
|
|
|
|
|
|
kLanguage getSciLanguage();
|
2010-06-10 11:18:10 +00:00
|
|
|
void setSciLanguage(kLanguage lang);
|
|
|
|
void setSciLanguage();
|
2010-02-13 17:46:44 +00:00
|
|
|
|
2010-04-18 00:56:04 +00:00
|
|
|
Common::String getSciLanguageString(const char *str, kLanguage lang, kLanguage *lang2 = NULL) const;
|
2010-02-13 17:46:44 +00:00
|
|
|
|
2010-02-13 17:43:31 +00:00
|
|
|
public:
|
|
|
|
GfxAnimate *_gfxAnimate; // Animate for 16-bit gfx
|
|
|
|
GfxCache *_gfxCache;
|
|
|
|
GfxCompare *_gfxCompare;
|
|
|
|
GfxControls *_gfxControls; // Controls for 16-bit gfx
|
|
|
|
GfxCoordAdjuster *_gfxCoordAdjuster;
|
|
|
|
GfxCursor *_gfxCursor;
|
|
|
|
GfxMenu *_gfxMenu; // Menu for 16-bit gfx
|
|
|
|
GfxPalette *_gfxPalette;
|
|
|
|
GfxPaint *_gfxPaint;
|
|
|
|
GfxPaint16 *_gfxPaint16; // Painting in 16-bit gfx
|
|
|
|
GfxPorts *_gfxPorts; // Port managment for 16-bit gfx
|
|
|
|
GfxScreen *_gfxScreen;
|
|
|
|
SciGui *_gui; /* Currently active Gui */
|
2010-05-24 21:47:06 +00:00
|
|
|
GfxMacIconBar *_gfxMacIconBar; // Mac Icon Bar manager
|
2010-02-13 17:43:31 +00:00
|
|
|
|
|
|
|
#ifdef ENABLE_SCI32
|
|
|
|
SciGui32 *_gui32; // GUI for SCI32 games
|
|
|
|
GfxFrameout *_gfxFrameout; // kFrameout and the like for 32-bit gfx
|
|
|
|
#endif
|
|
|
|
|
2010-02-14 12:23:22 +00:00
|
|
|
AudioPlayer *_audio;
|
2010-02-13 17:44:58 +00:00
|
|
|
GameFeatures *_features;
|
|
|
|
|
2009-02-15 22:43:13 +00:00
|
|
|
private:
|
2010-06-10 07:32:05 +00:00
|
|
|
/**
|
|
|
|
* Initializes a SCI game
|
|
|
|
* This function must be run before script_run() is executed. Graphics data
|
|
|
|
* is initialized iff s->gfx_state != NULL.
|
|
|
|
* @param[in] s The state to operate on
|
2010-06-15 12:33:20 +00:00
|
|
|
* @return true on success, false if an error occurred.
|
2010-06-10 07:32:05 +00:00
|
|
|
*/
|
|
|
|
bool initGame();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Runs a SCI game
|
|
|
|
* This is the main function for SCI games. It takes a valid state, loads
|
|
|
|
* script 0 to it, finds the game object, allocates a stack, and runs the
|
|
|
|
* init method of the game object. In layman's terms, this runs a SCI game.
|
|
|
|
* @param[in] s Pointer to the pointer of the state to operate on
|
|
|
|
*/
|
|
|
|
void runGame();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Uninitializes an initialized SCI game
|
|
|
|
* This function should be run after each script_run() call.
|
|
|
|
* @param[in] s The state to operate on
|
|
|
|
*/
|
|
|
|
void exitGame();
|
|
|
|
|
|
|
|
#ifdef USE_OLD_MUSIC_FUNCTIONS
|
|
|
|
/**
|
|
|
|
* Initializes the sound part of a SCI game
|
|
|
|
* This function may only be called if game_init() did not initialize
|
|
|
|
* the sound data.
|
|
|
|
* @param[in] s The state to initialize the sound in
|
|
|
|
* @param[in] sound_flags Flags to pass to the sound subsystem
|
|
|
|
* @param[in] soundVersion sound-version that got detected during game init
|
|
|
|
*/
|
2010-06-10 07:41:48 +00:00
|
|
|
void initGameSound(int sound_flags, SciVersion soundVersion);
|
2010-06-10 07:32:05 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
void initStackBaseWithSelector(Selector selector);
|
|
|
|
|
2009-10-09 23:19:53 +00:00
|
|
|
const ADGameDescription *_gameDescription;
|
2010-02-13 17:44:19 +00:00
|
|
|
ResourceManager *_resMan; /**< The resource manager */
|
2009-06-03 14:09:25 +00:00
|
|
|
EngineState *_gamestate;
|
2009-07-11 23:45:54 +00:00
|
|
|
Kernel *_kernel;
|
|
|
|
Vocabulary *_vocabulary;
|
2010-06-09 07:59:42 +00:00
|
|
|
EventManager *_eventMan;
|
2010-06-10 08:11:38 +00:00
|
|
|
reg_t _gameObj; /**< Pointer to the game object */
|
2009-06-03 14:09:25 +00:00
|
|
|
Console *_console;
|
2009-10-03 20:49:18 +00:00
|
|
|
OSystem *_system;
|
2009-02-15 06:10:59 +00:00
|
|
|
};
|
|
|
|
|
2010-02-13 17:42:49 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Global instance of the SciEngine class, similar to g_engine.
|
|
|
|
* This is a hackish way to make all central components available
|
|
|
|
* everywhere. Ideally, we would get rid of this again in the future,
|
|
|
|
* but for now it's a pragmatic and simple way to achieve the goal.
|
|
|
|
*/
|
|
|
|
extern SciEngine *g_sci;
|
|
|
|
|
2009-09-17 16:50:53 +00:00
|
|
|
/**
|
|
|
|
* Convenience function to obtain the active SCI version.
|
|
|
|
*/
|
2009-09-23 12:12:37 +00:00
|
|
|
SciVersion getSciVersion();
|
2009-09-17 16:50:53 +00:00
|
|
|
|
2010-02-13 11:58:15 +00:00
|
|
|
/**
|
|
|
|
* Convenience function converting an SCI version into a human-readable string.
|
|
|
|
*/
|
|
|
|
const char *getSciVersionDesc(SciVersion version);
|
2009-09-17 16:50:53 +00:00
|
|
|
|
2009-02-20 14:45:28 +00:00
|
|
|
} // End of namespace Sci
|
2009-02-15 06:10:59 +00:00
|
|
|
|
|
|
|
#endif // SCI_H
|