2007-05-30 21:56:52 +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.
|
2004-04-09 12:36:06 +00:00
|
|
|
*
|
|
|
|
* 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
|
2005-01-09 16:06:29 +00:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2004-04-09 12:36:06 +00:00
|
|
|
* 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
|
2005-10-18 01:30:26 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2004-04-09 12:36:06 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2008-05-11 23:16:50 +00:00
|
|
|
#ifndef KYRA_KYRA_V1_H
|
|
|
|
#define KYRA_KYRA_V1_H
|
2004-04-09 12:36:06 +00:00
|
|
|
|
2006-09-23 00:42:35 +00:00
|
|
|
#include "engines/engine.h"
|
2008-04-20 15:47:11 +00:00
|
|
|
|
2007-05-05 12:18:02 +00:00
|
|
|
#include "common/array.h"
|
2011-04-24 08:34:27 +00:00
|
|
|
#include "common/error.h"
|
2007-06-22 23:03:12 +00:00
|
|
|
#include "common/events.h"
|
2010-05-04 12:00:16 +00:00
|
|
|
#include "common/hashmap.h"
|
2012-02-22 14:33:29 +00:00
|
|
|
#include "common/random.h"
|
|
|
|
#include "common/rendermode.h"
|
2005-10-12 19:15:32 +00:00
|
|
|
|
2011-02-09 01:09:01 +00:00
|
|
|
#include "audio/mixer.h"
|
2009-05-24 01:29:09 +00:00
|
|
|
|
2008-04-20 15:47:11 +00:00
|
|
|
#include "kyra/script.h"
|
2010-10-22 02:11:50 +00:00
|
|
|
#include "kyra/item.h"
|
2005-08-19 22:12:09 +00:00
|
|
|
|
2008-03-17 18:10:52 +00:00
|
|
|
namespace Common {
|
2008-08-04 11:38:25 +00:00
|
|
|
class SeekableReadStream;
|
|
|
|
class WriteStream;
|
2009-10-04 21:26:33 +00:00
|
|
|
} // End of namespace Common
|
2008-03-17 18:10:52 +00:00
|
|
|
|
2011-04-24 08:34:27 +00:00
|
|
|
namespace Graphics {
|
|
|
|
struct Surface;
|
|
|
|
}
|
|
|
|
|
2008-03-27 18:03:00 +00:00
|
|
|
class KyraMetaEngine;
|
|
|
|
|
2009-11-24 22:10:14 +00:00
|
|
|
/**
|
|
|
|
* This is the namespace of the Kyra engine.
|
|
|
|
*
|
2009-11-26 19:50:09 +00:00
|
|
|
* Status of this engine:
|
|
|
|
*
|
2011-10-29 01:26:18 +00:00
|
|
|
* The KYRA engine supports all three Kyrandia games by Westwood. It also
|
|
|
|
* supports Westwood's Lands of Lore. There are various platform ports of
|
|
|
|
* the different games, almost all of them are fully supported. Only the
|
|
|
|
* Macintosh port of Kyrandia 1 makes a difference here, which lacks support
|
|
|
|
* for sound effects and music.
|
2009-11-26 19:50:09 +00:00
|
|
|
*
|
2011-10-29 01:26:18 +00:00
|
|
|
* The different translations of the games are mostly supported, since every
|
|
|
|
* translation requires some work for kyra.dat for example, it is almost
|
|
|
|
* impossible to support translations, without owning them. There a currently
|
|
|
|
* a few reported unsupported translations:
|
2009-11-26 19:50:09 +00:00
|
|
|
*
|
2009-11-26 20:33:27 +00:00
|
|
|
* - Official translations
|
2009-11-26 19:50:09 +00:00
|
|
|
* None known.
|
|
|
|
* - Probably official translations (currently no sources are known to verify this)
|
|
|
|
* Kyrandia 2 Spanish (feature request #2499966 "KYRA2: Add support for Spanish floppy version")
|
|
|
|
* - Doubtful official translations (no sources here either, but less likely to be official)
|
|
|
|
* Kyrandia 1 Korean (feature request #1758252 "KYRA1: Add support for Korean/DOS version")
|
|
|
|
* Kyrandia 2 Polish (feature request #2146192 "KYRA2: Add support for Polish floppy version")
|
|
|
|
* - Fan translations:
|
|
|
|
* Kyrandia 3 Russian (feature request #2812792 "Kyrandia3 Russian")
|
2010-01-25 01:39:44 +00:00
|
|
|
*
|
2011-10-29 01:26:18 +00:00
|
|
|
* The primary maintainer for the engine is LordHoto, although some parts are
|
|
|
|
* maintained by _athrxx. If you have questions about parts of the code, the
|
|
|
|
* following rough description might help in determining who you should ask:
|
|
|
|
* _athrxx is the maintainer for the Lands of Lore subengine, he also
|
|
|
|
* maintains most of the FM-TOWNS and PC98 specific code (especially the sound
|
|
|
|
* code, also some ingame code) and the Kyrandia 2 sequence player code.
|
|
|
|
* LordHoto is responsible for the rest of the codebase, he also worked on the
|
|
|
|
* graphics output for 16 color PC98 games.
|
2009-11-26 19:50:09 +00:00
|
|
|
*
|
2011-10-29 01:26:18 +00:00
|
|
|
* Other people who worked on this engine include cyx, who initially started
|
|
|
|
* to work on Kyrandia 1 support. Vinterstum, who did various things for
|
|
|
|
* Kyrandia 1 and started to work on the Kyrandia 2 sequence player code and
|
|
|
|
* also on the TIM script code. Eriktorbjorn, who helped out naming our AdLib
|
|
|
|
* player code and also contributed a work around for a music bug in the
|
|
|
|
* "Pool of Sorrow" scene of Kyrandia 1, which is also present in the original.
|
|
|
|
* He also contributed the VQA player for Kyrandia 3.
|
2009-11-26 19:50:09 +00:00
|
|
|
*
|
2011-10-29 01:26:18 +00:00
|
|
|
* The engine is mostly finished code wise. A possible remaining task is
|
|
|
|
* proper refactoring, which might help in reducing binary size and along with
|
|
|
|
* it runtime memory use, but of course might lead to regressions (since the
|
|
|
|
* current code makes no problems on our low end ports, it is pretty minor
|
|
|
|
* priority though, since the benefit would be mostly nicer code). The biggest
|
2011-06-25 17:25:56 +00:00
|
|
|
* task left is the kyra.dat handling.
|
2009-11-24 22:10:14 +00:00
|
|
|
*
|
2010-10-15 12:48:19 +00:00
|
|
|
* Games using this engine:
|
2009-11-26 19:50:09 +00:00
|
|
|
* - The Legend of Kyrandia (fully supported, except for Macintosh port, which lacks sound)
|
|
|
|
* - (The) Hand of Fate (fully supported)
|
|
|
|
* - Malcolm's Revenge (fully supported)
|
2011-06-10 20:19:43 +00:00
|
|
|
* - Lands of Lore: The Throne of Chaos (fully supported)
|
2009-11-24 22:10:14 +00:00
|
|
|
*/
|
2007-07-29 16:33:11 +00:00
|
|
|
namespace Kyra {
|
2006-01-22 09:34:12 +00:00
|
|
|
|
2006-09-17 20:21:40 +00:00
|
|
|
struct GameFlags {
|
|
|
|
Common::Language lang;
|
2008-06-30 23:39:56 +00:00
|
|
|
|
|
|
|
// language overwrites of fan translations (only needed for multilingual games)
|
|
|
|
Common::Language fanLang;
|
|
|
|
Common::Language replacedLang;
|
|
|
|
|
2006-09-17 20:21:40 +00:00
|
|
|
Common::Platform platform;
|
2008-04-29 14:22:04 +00:00
|
|
|
|
2009-10-04 17:54:08 +00:00
|
|
|
bool isDemo : 1;
|
|
|
|
bool useAltShapeHeader : 1; // alternative shape header (uses 2 bytes more, those are unused though)
|
|
|
|
bool isTalkie : 1;
|
2011-07-27 14:38:31 +00:00
|
|
|
bool isOldFloppy : 1;
|
2012-03-05 19:02:05 +00:00
|
|
|
bool useHiRes : 1;
|
2009-10-04 17:54:08 +00:00
|
|
|
bool use16ColorMode : 1;
|
|
|
|
bool useDigSound : 1;
|
|
|
|
bool useInstallerPackage : 1;
|
2008-04-29 14:22:04 +00:00
|
|
|
|
2006-09-17 20:21:40 +00:00
|
|
|
byte gameID;
|
2004-11-11 13:37:35 +00:00
|
|
|
};
|
|
|
|
|
2010-02-17 16:08:47 +00:00
|
|
|
struct KeyCodeHash : public Common::UnaryFunction<Common::KeyCode, uint> {
|
|
|
|
uint operator()(Common::KeyCode val) const { return (uint)val; }
|
|
|
|
};
|
|
|
|
|
2004-11-11 13:37:35 +00:00
|
|
|
enum {
|
2006-05-01 00:25:41 +00:00
|
|
|
GI_KYRA1 = 0,
|
2006-05-12 23:57:53 +00:00
|
|
|
GI_KYRA2 = 1,
|
2008-07-31 10:47:15 +00:00
|
|
|
GI_KYRA3 = 2,
|
2011-11-06 13:57:01 +00:00
|
|
|
GI_LOL = 4,
|
|
|
|
GI_EOB1 = 5,
|
|
|
|
GI_EOB2 = 6
|
2004-10-15 06:06:47 +00:00
|
|
|
};
|
|
|
|
|
2006-02-14 01:19:30 +00:00
|
|
|
// TODO: this is just the start of makeing the debug output of the kyra engine a bit more useable
|
|
|
|
// in the future we maybe merge some flags and/or create new ones
|
2009-10-04 17:54:08 +00:00
|
|
|
enum DebugLevels {
|
|
|
|
kDebugLevelScriptFuncs = 1 << 0, ///< debug level for o#_* functions
|
|
|
|
kDebugLevelScript = 1 << 1, ///< debug level for "EMCInterpreter" functions
|
|
|
|
kDebugLevelSprites = 1 << 2, ///< debug level for "Sprites" functions
|
|
|
|
kDebugLevelScreen = 1 << 3, ///< debug level for "Screen" functions
|
|
|
|
kDebugLevelSound = 1 << 4, ///< debug level for "Sound" functions
|
|
|
|
kDebugLevelAnimator = 1 << 5, ///< debug level for "ScreenAnimator" functions
|
|
|
|
kDebugLevelMain = 1 << 6, ///< debug level for common "KyraEngine(_v#)" functions && "TextDisplayer" functions
|
|
|
|
kDebugLevelGUI = 1 << 7, ///< debug level for "KyraEngine*" gui functions
|
|
|
|
kDebugLevelSequence = 1 << 8, ///< debug level for "SeqPlayer" functions
|
|
|
|
kDebugLevelMovie = 1 << 9, ///< debug level for movie specific funtions
|
|
|
|
kDebugLevelTimer = 1 << 10 ///< debug level for "TimerManager" functions
|
2006-02-14 01:19:30 +00:00
|
|
|
};
|
|
|
|
|
2012-11-11 02:01:39 +00:00
|
|
|
enum AudioResourceSet {
|
2008-03-21 16:18:27 +00:00
|
|
|
kMusicIntro = 0,
|
|
|
|
kMusicIngame,
|
|
|
|
kMusicFinale
|
|
|
|
};
|
|
|
|
|
2007-07-29 16:31:29 +00:00
|
|
|
class Screen;
|
|
|
|
class Resource;
|
|
|
|
class Sound;
|
|
|
|
class TextDisplayer;
|
|
|
|
class StaticResource;
|
2007-07-29 16:33:11 +00:00
|
|
|
class TimerManager;
|
2008-05-06 20:50:27 +00:00
|
|
|
class Debugger;
|
2011-11-16 18:16:19 +00:00
|
|
|
class GUI;
|
2008-12-16 17:40:34 +00:00
|
|
|
|
|
|
|
struct Button;
|
2006-01-22 09:34:12 +00:00
|
|
|
|
2008-05-11 23:16:50 +00:00
|
|
|
class KyraEngine_v1 : public Engine {
|
2008-03-27 16:12:48 +00:00
|
|
|
friend class Debugger;
|
2008-03-27 18:03:00 +00:00
|
|
|
friend class ::KyraMetaEngine;
|
2011-11-16 18:16:19 +00:00
|
|
|
friend class GUI;
|
2011-06-23 20:42:12 +00:00
|
|
|
friend class GUI_v1;
|
2011-12-27 01:51:14 +00:00
|
|
|
friend class GUI_EoB;
|
2009-10-04 17:54:08 +00:00
|
|
|
friend class SoundMidiPC; // For _eventMan
|
2012-11-11 13:07:58 +00:00
|
|
|
friend class SeqPlayer_HOF; // For skipFlag()
|
2011-12-27 01:51:14 +00:00
|
|
|
friend class TransferPartyWiz; // For save state API
|
2004-10-15 06:06:47 +00:00
|
|
|
public:
|
2008-05-11 23:16:50 +00:00
|
|
|
KyraEngine_v1(OSystem *system, const GameFlags &flags);
|
|
|
|
virtual ~KyraEngine_v1();
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:31:29 +00:00
|
|
|
uint8 game() const { return _flags.gameID; }
|
|
|
|
const GameFlags &gameFlags() const { return _flags; }
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:31:29 +00:00
|
|
|
// access to Kyra specific functionallity
|
2005-08-19 22:12:09 +00:00
|
|
|
Resource *resource() { return _res; }
|
2007-07-29 16:31:29 +00:00
|
|
|
virtual Screen *screen() = 0;
|
2008-03-30 18:27:46 +00:00
|
|
|
virtual TextDisplayer *text() { return _text; }
|
2011-11-16 18:16:19 +00:00
|
|
|
virtual GUI *gui() const { return 0; }
|
2006-01-13 23:06:04 +00:00
|
|
|
Sound *sound() { return _sound; }
|
2006-03-18 14:43:18 +00:00
|
|
|
StaticResource *staticres() { return _staticres; }
|
2007-07-29 16:33:11 +00:00
|
|
|
TimerManager *timer() { return _timer; }
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2006-01-03 19:03:09 +00:00
|
|
|
uint32 tickLength() const { return _tickLength; }
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:31:29 +00:00
|
|
|
Common::RandomSource _rnd;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2008-04-12 23:17:21 +00:00
|
|
|
// input
|
2008-04-16 20:28:27 +00:00
|
|
|
void setMousePos(int x, int y);
|
2012-02-21 20:14:28 +00:00
|
|
|
Common::Point getMousePos();
|
2008-04-12 23:17:21 +00:00
|
|
|
|
2008-03-23 20:55:42 +00:00
|
|
|
// config specific
|
|
|
|
bool speechEnabled();
|
|
|
|
bool textEnabled();
|
|
|
|
|
2008-04-04 18:02:50 +00:00
|
|
|
enum kVolumeEntry {
|
|
|
|
kVolumeMusic = 0,
|
|
|
|
kVolumeSfx = 1,
|
|
|
|
kVolumeSpeech = 2
|
|
|
|
};
|
|
|
|
|
2009-06-21 19:00:50 +00:00
|
|
|
// volume reaches per default from 2 to 97
|
2008-04-04 18:02:50 +00:00
|
|
|
void setVolume(kVolumeEntry vol, uint8 value);
|
|
|
|
uint8 getVolume(kVolumeEntry vol);
|
|
|
|
|
2008-11-09 12:07:20 +00:00
|
|
|
virtual void syncSoundSettings();
|
|
|
|
|
2008-01-27 19:47:41 +00:00
|
|
|
// game flag handling
|
2007-01-31 23:48:12 +00:00
|
|
|
int setGameFlag(int flag);
|
2007-07-29 16:31:29 +00:00
|
|
|
int queryGameFlag(int flag) const;
|
2007-01-31 23:48:12 +00:00
|
|
|
int resetGameFlag(int flag);
|
2007-10-10 09:06:15 +00:00
|
|
|
|
|
|
|
// sound
|
2008-04-10 15:41:06 +00:00
|
|
|
virtual void snd_playTheme(int file, int track);
|
2008-04-29 14:08:08 +00:00
|
|
|
virtual void snd_playSoundEffect(int id, int volume=0xFF);
|
2007-10-10 09:06:15 +00:00
|
|
|
virtual void snd_playWanderScoreViaMap(int command, int restart);
|
2007-10-13 06:57:47 +00:00
|
|
|
virtual void snd_playVoiceFile(int id) = 0;
|
|
|
|
virtual bool snd_voiceIsPlaying();
|
|
|
|
virtual void snd_stopVoice();
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:31:29 +00:00
|
|
|
// delay functionallity
|
|
|
|
virtual void delayUntil(uint32 timestamp, bool updateGameTimers = false, bool update = false, bool isMainLoop = false);
|
|
|
|
virtual void delay(uint32 millis, bool update = false, bool isMainLoop = false);
|
|
|
|
virtual void delayWithTicks(int ticks);
|
2006-03-08 13:15:13 +00:00
|
|
|
|
2007-07-29 16:31:29 +00:00
|
|
|
protected:
|
2008-11-04 16:11:40 +00:00
|
|
|
// Engine APIs
|
2008-11-06 17:05:54 +00:00
|
|
|
virtual Common::Error init();
|
2009-03-01 04:30:55 +00:00
|
|
|
virtual Common::Error go() = 0;
|
2009-06-25 01:29:55 +00:00
|
|
|
|
2009-03-01 04:30:55 +00:00
|
|
|
virtual Common::Error run() {
|
|
|
|
Common::Error err;
|
2009-06-25 01:29:55 +00:00
|
|
|
registerDefaultSettings();
|
2009-03-01 04:30:55 +00:00
|
|
|
err = init();
|
2011-04-18 15:39:31 +00:00
|
|
|
if (err.getCode() != Common::kNoError)
|
2009-03-01 04:30:55 +00:00
|
|
|
return err;
|
|
|
|
return go();
|
|
|
|
}
|
2009-06-25 01:29:55 +00:00
|
|
|
|
2008-11-04 16:11:40 +00:00
|
|
|
virtual ::GUI::Debugger *getDebugger();
|
|
|
|
virtual bool hasFeature(EngineFeature f) const;
|
|
|
|
virtual void pauseEngineIntern(bool pause);
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:31:29 +00:00
|
|
|
// intern
|
2005-08-19 22:12:09 +00:00
|
|
|
Resource *_res;
|
2006-01-13 23:06:04 +00:00
|
|
|
Sound *_sound;
|
2006-01-02 22:58:59 +00:00
|
|
|
TextDisplayer *_text;
|
2006-03-18 14:43:18 +00:00
|
|
|
StaticResource *_staticres;
|
2007-07-29 16:33:11 +00:00
|
|
|
TimerManager *_timer;
|
2008-04-29 15:12:09 +00:00
|
|
|
EMCInterpreter *_emc;
|
2008-05-06 20:50:27 +00:00
|
|
|
Debugger *_debugger;
|
2008-01-27 15:30:53 +00:00
|
|
|
|
2008-12-16 17:40:34 +00:00
|
|
|
// input
|
2009-10-03 20:42:26 +00:00
|
|
|
void setupKeyMap();
|
2008-12-16 17:40:34 +00:00
|
|
|
void updateInput();
|
2009-05-24 14:33:41 +00:00
|
|
|
int checkInput(Button *buttonList, bool mainLoop = false, int eventFlag = 0x8000);
|
2008-12-16 17:40:34 +00:00
|
|
|
void removeInputTop();
|
|
|
|
|
|
|
|
int _mouseX, _mouseY;
|
|
|
|
|
|
|
|
struct Event {
|
|
|
|
Common::Event event;
|
|
|
|
bool causedSkip;
|
|
|
|
|
|
|
|
Event() : event(), causedSkip(false) {}
|
|
|
|
Event(Common::Event e) : event(e), causedSkip(false) {}
|
|
|
|
Event(Common::Event e, bool skip) : event(e), causedSkip(skip) {}
|
|
|
|
|
|
|
|
operator Common::Event() const { return event; }
|
|
|
|
};
|
|
|
|
Common::List<Event> _eventList;
|
2010-02-17 16:08:47 +00:00
|
|
|
typedef Common::HashMap<Common::KeyCode, int16, KeyCodeHash> KeyMap;
|
2009-11-07 15:06:25 +00:00
|
|
|
KeyMap _keyMap;
|
2008-12-16 17:40:34 +00:00
|
|
|
|
2008-01-27 15:30:53 +00:00
|
|
|
// config specific
|
|
|
|
virtual void registerDefaultSettings();
|
|
|
|
virtual void readSettings();
|
|
|
|
virtual void writeSettings();
|
|
|
|
|
|
|
|
uint8 _configWalkspeed;
|
|
|
|
|
|
|
|
int _configMusic;
|
|
|
|
bool _configSounds;
|
|
|
|
uint8 _configVoice;
|
|
|
|
|
2012-02-13 17:39:50 +00:00
|
|
|
Common::RenderMode _configRenderMode;
|
|
|
|
|
2007-07-29 16:31:29 +00:00
|
|
|
// game speed
|
2008-12-16 17:40:34 +00:00
|
|
|
virtual bool skipFlag() const;
|
|
|
|
virtual void resetSkipFlag(bool removeEvent = true);
|
2008-03-16 14:32:49 +00:00
|
|
|
|
2007-07-29 16:31:29 +00:00
|
|
|
uint16 _tickLength;
|
2007-07-29 16:33:11 +00:00
|
|
|
uint16 _gameSpeed;
|
2008-01-27 15:30:53 +00:00
|
|
|
|
2008-05-12 12:57:42 +00:00
|
|
|
// run
|
|
|
|
int8 _deathHandler;
|
|
|
|
|
2008-01-27 15:30:53 +00:00
|
|
|
// timer
|
2008-01-27 15:56:56 +00:00
|
|
|
virtual void setupTimers() = 0;
|
|
|
|
|
2008-01-27 15:30:53 +00:00
|
|
|
virtual void setWalkspeed(uint8 speed) = 0;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:31:29 +00:00
|
|
|
// detection
|
|
|
|
GameFlags _flags;
|
2007-01-29 18:15:14 +00:00
|
|
|
|
2007-07-29 16:31:29 +00:00
|
|
|
// opcode
|
|
|
|
virtual void setupOpcodeTable() = 0;
|
2012-02-15 06:06:13 +00:00
|
|
|
Common::Array<const Opcode *> _opcodes;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2008-05-12 12:42:10 +00:00
|
|
|
int o1_queryGameFlag(EMCState *script);
|
|
|
|
int o1_setGameFlag(EMCState *script);
|
|
|
|
int o1_resetGameFlag(EMCState *script);
|
|
|
|
int o1_getRand(EMCState *script);
|
|
|
|
int o1_hideMouse(EMCState *script);
|
|
|
|
int o1_showMouse(EMCState *script);
|
|
|
|
int o1_setMousePos(EMCState *script);
|
|
|
|
int o1_setHandItem(EMCState *script);
|
|
|
|
int o1_removeHandItem(EMCState *script);
|
|
|
|
int o1_getMouseState(EMCState *script);
|
2008-05-12 12:57:42 +00:00
|
|
|
int o1_setDeathHandler(EMCState *script);
|
|
|
|
int o1_playWanderScoreViaMap(EMCState *script);
|
2008-05-18 13:22:06 +00:00
|
|
|
int o1_fillRect(EMCState *script);
|
2008-05-12 13:11:42 +00:00
|
|
|
int o1_blockInWalkableRegion(EMCState *script);
|
|
|
|
int o1_blockOutWalkableRegion(EMCState *script);
|
|
|
|
int o1_playSoundEffect(EMCState *script);
|
2008-05-12 12:42:10 +00:00
|
|
|
|
|
|
|
// items
|
|
|
|
int _mouseState;
|
|
|
|
|
2010-10-22 02:11:50 +00:00
|
|
|
virtual void setHandItem(Item item) = 0;
|
2008-05-12 12:42:10 +00:00
|
|
|
virtual void removeHandItem() = 0;
|
|
|
|
|
2007-07-29 16:31:29 +00:00
|
|
|
// game flags
|
2009-10-04 17:54:08 +00:00
|
|
|
uint8 _flagsTable[100]; // TODO: check this value
|
2007-10-10 09:06:15 +00:00
|
|
|
|
|
|
|
// sound
|
2009-05-24 01:29:09 +00:00
|
|
|
Audio::SoundHandle _speechHandle;
|
2008-03-21 16:18:27 +00:00
|
|
|
|
2007-10-10 09:06:15 +00:00
|
|
|
int _curMusicTheme;
|
|
|
|
int _curSfxFile;
|
|
|
|
int16 _lastMusicCommand;
|
|
|
|
|
|
|
|
const int8 *_trackMap;
|
|
|
|
int _trackMapSize;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2009-06-21 20:10:45 +00:00
|
|
|
virtual int convertVolumeToMixer(int value);
|
|
|
|
virtual int convertVolumeFromMixer(int value);
|
2009-06-21 19:00:50 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
// pathfinder
|
|
|
|
virtual int findWay(int x, int y, int toX, int toY, int *moveTable, int moveTableSize);
|
|
|
|
int findSubPath(int x, int y, int toX, int toY, int *moveTable, int start, int end);
|
|
|
|
int getFacingFromPointToPoint(int x, int y, int toX, int toY);
|
|
|
|
int getOppositeFacingDirection(int dir);
|
|
|
|
void changePosTowardsFacing(int &x, int &y, int facing);
|
|
|
|
int getMoveTableSize(int *moveTable);
|
|
|
|
virtual bool lineIsPassable(int x, int y) = 0;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
static const int8 _addXPosTable[];
|
|
|
|
static const int8 _addYPosTable[];
|
2008-03-17 18:10:52 +00:00
|
|
|
|
2008-05-18 21:11:19 +00:00
|
|
|
// Character
|
2009-01-01 15:06:43 +00:00
|
|
|
|
2008-05-18 21:11:19 +00:00
|
|
|
static const int8 _charAddXPosTable[];
|
|
|
|
static const int8 _charAddYPosTable[];
|
|
|
|
|
2008-03-17 18:10:52 +00:00
|
|
|
// save/load
|
2008-03-28 00:53:54 +00:00
|
|
|
int _gameToLoad;
|
|
|
|
|
2008-09-14 19:48:40 +00:00
|
|
|
uint32 _lastAutosave;
|
|
|
|
void checkAutosave();
|
|
|
|
|
2008-11-03 19:51:34 +00:00
|
|
|
bool _isSaveAllowed;
|
|
|
|
|
|
|
|
bool canLoadGameStateCurrently() { return _isSaveAllowed; }
|
|
|
|
bool canSaveGameStateCurrently() { return _isSaveAllowed; }
|
|
|
|
|
2008-03-17 18:10:52 +00:00
|
|
|
const char *getSavegameFilename(int num);
|
2010-09-05 22:56:25 +00:00
|
|
|
Common::String _savegameFilename;
|
2008-09-14 21:41:27 +00:00
|
|
|
static Common::String getSavegameFilename(const Common::String &target, int num);
|
2008-03-28 00:53:54 +00:00
|
|
|
bool saveFileLoadable(int slot);
|
2008-03-27 18:03:00 +00:00
|
|
|
|
|
|
|
struct SaveHeader {
|
|
|
|
Common::String description;
|
|
|
|
uint32 version;
|
|
|
|
byte gameID;
|
|
|
|
uint32 flags;
|
|
|
|
|
2009-10-04 17:54:08 +00:00
|
|
|
bool originalSave; // savegame from original interpreter
|
|
|
|
bool oldHeader; // old scummvm save header
|
2008-08-20 14:03:34 +00:00
|
|
|
|
|
|
|
Graphics::Surface *thumbnail;
|
2008-03-27 18:03:00 +00:00
|
|
|
};
|
|
|
|
|
2012-11-23 01:56:26 +00:00
|
|
|
enum ReadSaveHeaderError {
|
2008-03-27 18:03:00 +00:00
|
|
|
kRSHENoError = 0,
|
|
|
|
kRSHEInvalidType = 1,
|
|
|
|
kRSHEInvalidVersion = 2,
|
|
|
|
kRSHEIoError = 3
|
|
|
|
};
|
2008-03-28 00:53:54 +00:00
|
|
|
|
2012-11-23 01:56:26 +00:00
|
|
|
static ReadSaveHeaderError readSaveHeader(Common::SeekableReadStream *file, bool loadThumbnail, SaveHeader &header);
|
2008-03-27 18:03:00 +00:00
|
|
|
|
2008-11-09 13:12:38 +00:00
|
|
|
void loadGameStateCheck(int slot);
|
2008-11-09 13:00:40 +00:00
|
|
|
virtual Common::Error loadGameState(int slot) = 0;
|
2011-06-05 02:28:33 +00:00
|
|
|
Common::Error saveGameState(int slot, const Common::String &desc) { return saveGameStateIntern(slot, desc.c_str(), 0); }
|
2010-10-28 23:57:24 +00:00
|
|
|
virtual Common::Error saveGameStateIntern(int slot, const char *saveName, const Graphics::Surface *thumbnail) = 0;
|
2008-09-14 19:48:40 +00:00
|
|
|
|
2011-12-13 21:04:06 +00:00
|
|
|
Common::SeekableReadStream *openSaveForReading(const char *filename, SaveHeader &header, bool checkID = true);
|
2008-08-20 14:03:34 +00:00
|
|
|
Common::WriteStream *openSaveForWriting(const char *filename, const char *saveName, const Graphics::Surface *thumbnail) const;
|
2009-10-04 17:38:15 +00:00
|
|
|
|
|
|
|
// TODO: Consider moving this to Screen
|
|
|
|
virtual Graphics::Surface *generateSaveThumbnail() const { return 0; }
|
2004-04-09 12:36:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // End of namespace Kyra
|
|
|
|
|
|
|
|
#endif
|