[Scummvm-cvs-logs] SF.net SVN: scummvm: [32044] scummvm/trunk/engines/kyra

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Mon May 12 01:16:50 CEST 2008


Revision: 32044
          http://scummvm.svn.sourceforge.net/scummvm/?rev=32044&view=rev
Author:   lordhoto
Date:     2008-05-11 16:16:50 -0700 (Sun, 11 May 2008)

Log Message:
-----------
- Renamed KyraEngine to KyraEngine_v1
- kyra.* -> kyra_v1.*
- scene.cpp -> scene_v1.cpp

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/debugger.cpp
    scummvm/trunk/engines/kyra/debugger.h
    scummvm/trunk/engines/kyra/detection.cpp
    scummvm/trunk/engines/kyra/gui.cpp
    scummvm/trunk/engines/kyra/gui.h
    scummvm/trunk/engines/kyra/gui_hof.cpp
    scummvm/trunk/engines/kyra/gui_lok.cpp
    scummvm/trunk/engines/kyra/gui_mr.cpp
    scummvm/trunk/engines/kyra/gui_v2.cpp
    scummvm/trunk/engines/kyra/kyra_hof.cpp
    scummvm/trunk/engines/kyra/kyra_lok.cpp
    scummvm/trunk/engines/kyra/kyra_lok.h
    scummvm/trunk/engines/kyra/kyra_mr.cpp
    scummvm/trunk/engines/kyra/kyra_v2.cpp
    scummvm/trunk/engines/kyra/kyra_v2.h
    scummvm/trunk/engines/kyra/module.mk
    scummvm/trunk/engines/kyra/resource.cpp
    scummvm/trunk/engines/kyra/resource.h
    scummvm/trunk/engines/kyra/saveload.cpp
    scummvm/trunk/engines/kyra/scene_lok.cpp
    scummvm/trunk/engines/kyra/scene_v2.cpp
    scummvm/trunk/engines/kyra/screen.cpp
    scummvm/trunk/engines/kyra/screen.h
    scummvm/trunk/engines/kyra/screen_v2.cpp
    scummvm/trunk/engines/kyra/screen_v2.h
    scummvm/trunk/engines/kyra/script.cpp
    scummvm/trunk/engines/kyra/script.h
    scummvm/trunk/engines/kyra/script_tim.cpp
    scummvm/trunk/engines/kyra/script_tim.h
    scummvm/trunk/engines/kyra/sequences_hof.cpp
    scummvm/trunk/engines/kyra/sound.cpp
    scummvm/trunk/engines/kyra/sound.h
    scummvm/trunk/engines/kyra/sound_adlib.cpp
    scummvm/trunk/engines/kyra/sound_lok.cpp
    scummvm/trunk/engines/kyra/sound_towns.cpp
    scummvm/trunk/engines/kyra/staticres.cpp
    scummvm/trunk/engines/kyra/text.cpp
    scummvm/trunk/engines/kyra/text.h
    scummvm/trunk/engines/kyra/timer.cpp
    scummvm/trunk/engines/kyra/timer.h
    scummvm/trunk/engines/kyra/timer_lok.cpp
    scummvm/trunk/engines/kyra/vqa.cpp
    scummvm/trunk/engines/kyra/vqa.h
    scummvm/trunk/engines/kyra/wsamovie.cpp
    scummvm/trunk/engines/kyra/wsamovie.h

Added Paths:
-----------
    scummvm/trunk/engines/kyra/kyra_v1.cpp
    scummvm/trunk/engines/kyra/kyra_v1.h
    scummvm/trunk/engines/kyra/scene_v1.cpp

Removed Paths:
-------------
    scummvm/trunk/engines/kyra/kyra.cpp
    scummvm/trunk/engines/kyra/kyra.h
    scummvm/trunk/engines/kyra/scene.cpp

Modified: scummvm/trunk/engines/kyra/debugger.cpp
===================================================================
--- scummvm/trunk/engines/kyra/debugger.cpp	2008-05-11 22:45:12 UTC (rev 32043)
+++ scummvm/trunk/engines/kyra/debugger.cpp	2008-05-11 23:16:50 UTC (rev 32044)
@@ -36,7 +36,7 @@
 
 namespace Kyra {
 
-Debugger::Debugger(KyraEngine *vm)
+Debugger::Debugger(KyraEngine_v1 *vm)
 	: ::GUI::Debugger() {
 	_vm = vm;
 

Modified: scummvm/trunk/engines/kyra/debugger.h
===================================================================
--- scummvm/trunk/engines/kyra/debugger.h	2008-05-11 22:45:12 UTC (rev 32043)
+++ scummvm/trunk/engines/kyra/debugger.h	2008-05-11 23:16:50 UTC (rev 32044)
@@ -30,18 +30,18 @@
 
 namespace Kyra {
 
-class KyraEngine;
+class KyraEngine_v1;
 class KyraEngine_LoK;
 class KyraEngine_v2;
 class KyraEngine_HoF;
 
 class Debugger : public ::GUI::Debugger {
 public:
-	Debugger(KyraEngine *vm);
+	Debugger(KyraEngine_v1 *vm);
 	virtual ~Debugger() {}  // we need this for __SYMBIAN32__ archaic gcc/UIQ
 
 protected:
-	KyraEngine *_vm;
+	KyraEngine_v1 *_vm;
 
 	bool cmd_setScreenDebug(int argc, const char **argv);
 	bool cmd_loadPalette(int argc, const char **argv);

Modified: scummvm/trunk/engines/kyra/detection.cpp
===================================================================
--- scummvm/trunk/engines/kyra/detection.cpp	2008-05-11 22:45:12 UTC (rev 32043)
+++ scummvm/trunk/engines/kyra/detection.cpp	2008-05-11 23:16:50 UTC (rev 32044)
@@ -22,7 +22,7 @@
  * $Id$
  */
 
-#include "kyra/kyra.h"
+#include "kyra/kyra_v1.h"
 #include "kyra/kyra_lok.h"
 #include "kyra/kyra_hof.h"
 #include "kyra/kyra_mr.h"
@@ -524,7 +524,7 @@
 
 SaveStateList KyraMetaEngine::listSaves(const char *target) const {
 	Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
-	Kyra::KyraEngine::SaveHeader header;
+	Kyra::KyraEngine_v1::SaveHeader header;
 	Common::String pattern = target;
 	pattern += ".???";
 
@@ -540,7 +540,7 @@
 		if (slotNum >= 0 && slotNum <= 999) {
 			Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str());
 			if (in) {
-				if (Kyra::KyraEngine::readSaveHeader(in, header) == Kyra::KyraEngine::kRSHENoError)
+				if (Kyra::KyraEngine_v1::readSaveHeader(in, header) == Kyra::KyraEngine_v1::kRSHENoError)
 					saveList.push_back(SaveStateDescriptor(slotNum, header.description, *file));
 				delete in;
 			}

Modified: scummvm/trunk/engines/kyra/gui.cpp
===================================================================
--- scummvm/trunk/engines/kyra/gui.cpp	2008-05-11 22:45:12 UTC (rev 32043)
+++ scummvm/trunk/engines/kyra/gui.cpp	2008-05-11 23:16:50 UTC (rev 32044)
@@ -33,7 +33,7 @@
 
 namespace Kyra {
 
-GUI::GUI(KyraEngine *kyra)
+GUI::GUI(KyraEngine_v1 *kyra)
 	: _vm(kyra), _screen(kyra->screen()), _text(kyra->text()) {
 	_menuButtonList = 0;
 
@@ -339,7 +339,7 @@
 
 #pragma mark -
 
-MainMenu::MainMenu(KyraEngine *vm) : _vm(vm), _screen(0) {
+MainMenu::MainMenu(KyraEngine_v1 *vm) : _vm(vm), _screen(0) {
 	_screen = _vm->screen();
 	_nextUpdate = 0;
 	_system = g_system;

Modified: scummvm/trunk/engines/kyra/gui.h
===================================================================
--- scummvm/trunk/engines/kyra/gui.h	2008-05-11 22:45:12 UTC (rev 32043)
+++ scummvm/trunk/engines/kyra/gui.h	2008-05-11 23:16:50 UTC (rev 32044)
@@ -26,7 +26,7 @@
 #ifndef KYRA_GUI_H
 #define KYRA_GUI_H
 
-#include "kyra/kyra.h"
+#include "kyra/kyra_v1.h"
 
 #include "common/ptr.h"
 #include "common/array.h"
@@ -135,7 +135,7 @@
 
 class GUI {
 public:
-	GUI(KyraEngine *vm);
+	GUI(KyraEngine_v1 *vm);
 	virtual ~GUI() {}
 
 	// button specific
@@ -154,7 +154,7 @@
 	void processHighlights(Menu &menu, int mouseX, int mouseY);
 
 protected:
-	KyraEngine *_vm;
+	KyraEngine_v1 *_vm;
 	Screen *_screen;
 	TextDisplayer *_text;
 
@@ -196,7 +196,7 @@
 
 class MainMenu {
 public:
-	MainMenu(KyraEngine *vm);
+	MainMenu(KyraEngine_v1 *vm);
 	virtual ~MainMenu() {}
 
 	struct Animation {
@@ -219,7 +219,7 @@
 	void init(StaticData data, Animation anim);
 	int handle(int dim);
 private:
-	KyraEngine *_vm;
+	KyraEngine_v1 *_vm;
 	Screen *_screen;
 	OSystem *_system;
 

Modified: scummvm/trunk/engines/kyra/gui_hof.cpp
===================================================================
--- scummvm/trunk/engines/kyra/gui_hof.cpp	2008-05-11 22:45:12 UTC (rev 32043)
+++ scummvm/trunk/engines/kyra/gui_hof.cpp	2008-05-11 23:16:50 UTC (rev 32044)
@@ -23,7 +23,7 @@
  *
  */
 
-#include "kyra/kyra.h"
+#include "kyra/kyra_v1.h"
 #include "kyra/kyra_hof.h"
 #include "kyra/screen.h"
 #include "kyra/wsamovie.h"
@@ -827,10 +827,10 @@
 
 	int position = 0;
 	if (_vm->gameFlags().isTalkie) {
-		position = _vm->getVolume(KyraEngine::kVolumeEntry(slider));
+		position = _vm->getVolume(KyraEngine_v1::kVolumeEntry(slider));
 	} else {
 		if (slider < 2)
-			position = _vm->getVolume(KyraEngine::kVolumeEntry(slider));
+			position = _vm->getVolume(KyraEngine_v1::kVolumeEntry(slider));
 		else if (slider == 2)
 			position = (_vm->_configWalkspeed == 3) ? 97 : 2;
 		else if (slider == 3)
@@ -900,7 +900,7 @@
 
 	restorePage1(_vm->_screenBuffer);
 	backUpPage1(_vm->_screenBuffer);
-	if (speechEnabled && !_vm->textEnabled() && (!_vm->speechEnabled() || _vm->getVolume(KyraEngine::kVolumeSpeech) == 2)) {
+	if (speechEnabled && !_vm->textEnabled() && (!_vm->speechEnabled() || _vm->getVolume(KyraEngine_v1::kVolumeSpeech) == 2)) {
 		_vm->_configVoice = 0;
 		choiceDialog(0x1D, 0);
 	}
@@ -978,7 +978,7 @@
 
 	if (textEnabled && !_vm->textEnabled() && !_vm->speechEnabled()) {
 		_vm->_configVoice = 1;
-		_vm->setVolume(KyraEngine::kVolumeSpeech, 75);
+		_vm->setVolume(KyraEngine_v1::kVolumeSpeech, 75);
 		choiceDialog(0x1E, 0);
 	}
 
@@ -1054,10 +1054,10 @@
 	int oldVolume = 0;
 	
 	if (_vm->gameFlags().isTalkie) {
-		oldVolume = _vm->getVolume(KyraEngine::kVolumeEntry(button));
+		oldVolume = _vm->getVolume(KyraEngine_v1::kVolumeEntry(button));
 	} else {
 		if (button < 2)
-			oldVolume = _vm->getVolume(KyraEngine::kVolumeEntry(button));
+			oldVolume = _vm->getVolume(KyraEngine_v1::kVolumeEntry(button));
 		else if (button == 2)
 			oldVolume = (_vm->_configWalkspeed == 3) ? 97 : 2;
 		else if (button == 3)
@@ -1092,7 +1092,7 @@
 				_vm->_configVoice = 1;
 		}
 
-		_vm->setVolume(KyraEngine::kVolumeEntry(button), newVolume);
+		_vm->setVolume(KyraEngine_v1::kVolumeEntry(button), newVolume);
 
 		switch (button) {
 		case 0:
@@ -1112,7 +1112,7 @@
 		}
 	} else {
 		if (button < 2) {
-			_vm->setVolume(KyraEngine::kVolumeEntry(button), newVolume);
+			_vm->setVolume(KyraEngine_v1::kVolumeEntry(button), newVolume);
 			if (button == 0)
 				lastMusicCommand = _vm->_lastMusicCommand;
 			else

Modified: scummvm/trunk/engines/kyra/gui_lok.cpp
===================================================================
--- scummvm/trunk/engines/kyra/gui_lok.cpp	2008-05-11 22:45:12 UTC (rev 32043)
+++ scummvm/trunk/engines/kyra/gui_lok.cpp	2008-05-11 23:16:50 UTC (rev 32044)
@@ -544,7 +544,7 @@
 	for (int i = startSlot; i < num; ++i)
 		menu.item[i].enabled = 0;
 
-	KyraEngine::SaveHeader header;
+	KyraEngine_v1::SaveHeader header;
 	for (int i = startSlot; i < num && uint(_savegameOffset + i) < _saveSlots.size(); i++) {
 		if ((in = _vm->openSaveForReading(_vm->getSavegameFilename(_saveSlots[i + _savegameOffset]), header))) {
 			strncpy(savenames[i], header.description.c_str(), 31);

Modified: scummvm/trunk/engines/kyra/gui_mr.cpp
===================================================================
--- scummvm/trunk/engines/kyra/gui_mr.cpp	2008-05-11 22:45:12 UTC (rev 32043)
+++ scummvm/trunk/engines/kyra/gui_mr.cpp	2008-05-11 23:16:50 UTC (rev 32044)
@@ -1444,7 +1444,7 @@
 
 	if (textEnabled && !_vm->textEnabled() && !_vm->speechEnabled()) {
 		_vm->_configVoice = 1;
-		_vm->setVolume(KyraEngine::kVolumeSpeech, 75);
+		_vm->setVolume(KyraEngine_v1::kVolumeSpeech, 75);
 		choiceDialog(0x1E, 0);
 	}
 
@@ -1597,7 +1597,7 @@
 
 	restorePage1(_vm->_screenBuffer);
 	backUpPage1(_vm->_screenBuffer);
-	if (speechEnabled && !_vm->textEnabled() && (!_vm->speechEnabled() || _vm->getVolume(KyraEngine::kVolumeSpeech) == 2)) {
+	if (speechEnabled && !_vm->textEnabled() && (!_vm->speechEnabled() || _vm->getVolume(KyraEngine_v1::kVolumeSpeech) == 2)) {
 		_vm->_configVoice = 0;
 		choiceDialog(0x1D, 0);
 	}
@@ -1620,7 +1620,7 @@
 
 	assert(button >= 0 && button <= 3);
 
-	int oldVolume = _vm->getVolume(KyraEngine::kVolumeEntry(button));
+	int oldVolume = _vm->getVolume(KyraEngine_v1::kVolumeEntry(button));
 	int newVolume = oldVolume;
 
 	if (caller->index >= 24 && caller->index <= 27)
@@ -1648,7 +1648,7 @@
 			_vm->_configVoice = 1;
 	}
 
-	_vm->setVolume(KyraEngine::kVolumeEntry(button), newVolume);
+	_vm->setVolume(KyraEngine_v1::kVolumeEntry(button), newVolume);
 
 	switch (button) {
 	case 0:
@@ -1685,7 +1685,7 @@
 	int x = menuX + _sliderBarsPosition[slider*2+0] + 10;
 	int y = menuY + _sliderBarsPosition[slider*2+1];
 
-	int position = _vm->getVolume(KyraEngine::kVolumeEntry(slider));
+	int position = _vm->getVolume(KyraEngine_v1::kVolumeEntry(slider));
 
 	position = MAX(2, position);
 	position = MIN(97, position);

Modified: scummvm/trunk/engines/kyra/gui_v2.cpp
===================================================================
--- scummvm/trunk/engines/kyra/gui_v2.cpp	2008-05-11 22:45:12 UTC (rev 32043)
+++ scummvm/trunk/engines/kyra/gui_v2.cpp	2008-05-11 23:16:50 UTC (rev 32044)
@@ -451,7 +451,7 @@
 	if (_isSaveMenu && _savegameOffset == 0)
 		startSlot = 1;
 
-	KyraEngine::SaveHeader header;
+	KyraEngine_v1::SaveHeader header;
 	Common::InSaveFile *in;
 	for (int i = startSlot; i < num && uint(_savegameOffset + i) < _saveSlots.size(); ++i) {
 		if ((in = _vm->openSaveForReading(_vm->getSavegameFilename(_saveSlots[i + _savegameOffset]), header)) != 0) {

Deleted: scummvm/trunk/engines/kyra/kyra.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra.cpp	2008-05-11 22:45:12 UTC (rev 32043)
+++ scummvm/trunk/engines/kyra/kyra.cpp	2008-05-11 23:16:50 UTC (rev 32044)
@@ -1,400 +0,0 @@
-/* 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$
- *
- */
-
-#include "common/config-manager.h"
-
-#include "sound/mididrv.h"
-#include "sound/mixer.h"
-
-#include "kyra/kyra.h"
-#include "kyra/sound.h"
-#include "kyra/resource.h"
-#include "kyra/screen.h"
-#include "kyra/text.h"
-#include "kyra/timer.h"
-#include "kyra/script.h"
-#include "kyra/debugger.h"
-
-namespace Kyra {
-
-KyraEngine::KyraEngine(OSystem *system, const GameFlags &flags)
-	: Engine(system), _flags(flags) {
-	_res = 0;
-	_sound = 0;
-	_text = 0;
-	_staticres = 0;
-	_timer = 0;
-	_emc = 0;
-	_debugger = 0;
-
-	_gameSpeed = 60;
-	_tickLength = (uint8)(1000.0 / _gameSpeed);
-
-	_quitFlag = false;
-
-	_speechFile = "";
-	_trackMap = 0;
-	_trackMapSize = 0;
-	_lastMusicCommand = -1;
-	_curSfxFile = _curMusicTheme = -1;
-
-	_gameToLoad = -1;
-
-	memset(_flagsTable, 0, sizeof(_flagsTable));
-
-	// sets up all engine specific debug levels
-	Common::addSpecialDebugLevel(kDebugLevelScriptFuncs, "ScriptFuncs", "Script function debug level");
-	Common::addSpecialDebugLevel(kDebugLevelScript, "Script", "Script interpreter debug level");
-	Common::addSpecialDebugLevel(kDebugLevelSprites, "Sprites", "Sprite debug level");
-	Common::addSpecialDebugLevel(kDebugLevelScreen, "Screen", "Screen debug level");
-	Common::addSpecialDebugLevel(kDebugLevelSound, "Sound", "Sound debug level");
-	Common::addSpecialDebugLevel(kDebugLevelAnimator, "Animator", "Animator debug level");
-	Common::addSpecialDebugLevel(kDebugLevelMain, "Main", "Generic debug level");
-	Common::addSpecialDebugLevel(kDebugLevelGUI, "GUI", "GUI debug level");
-	Common::addSpecialDebugLevel(kDebugLevelSequence, "Sequence", "Sequence debug level");
-	Common::addSpecialDebugLevel(kDebugLevelMovie, "Movie", "Movie debug level");
-	Common::addSpecialDebugLevel(kDebugLevelTimer, "Timer", "Timer debug level");
-
-	system->getEventManager()->registerRandomSource(_rnd, "kyra");
-}
-
-::GUI::Debugger *KyraEngine::getDebugger() {
-	return _debugger;
-}
-
-int KyraEngine::init() {
-	registerDefaultSettings();
-
-	// Setup mixer
-	_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume"));
-	_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume"));
-	_mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, ConfMan.getInt("speech_volume"));
-
-	if (!_flags.useDigSound) {
-		// We prefer AdLib over native MIDI, since our AdLib playback code is much
-		// more mature than our MIDI player. For example we are missing MT-32 support
-		// and it seems our MIDI playback code has threading issues (see bug #1506583
-		// "KYRA1: Crash on exceeded polyphony" for more information).
-		int midiDriver = MidiDriver::detectMusicDriver(MDT_MIDI | MDT_ADLIB/* | MDT_PREFER_MIDI*/);
-
-		if (_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98) {
-			// TODO: currently we don't support the PC98 sound data,
-			// but since it has the FM-Towns data files, we just use the
-			// FM-Towns driver
-			if (_flags.gameID == GI_KYRA1)
-				_sound = new SoundTowns(this, _mixer);
-			else
-				_sound = new SoundTowns_v2(this, _mixer);
-		} else if (midiDriver == MD_ADLIB) {
-			_sound = new SoundAdlibPC(this, _mixer);
-			assert(_sound);
-		} else {
-			bool native_mt32 = ((midiDriver == MD_MT32) || ConfMan.getBool("native_mt32"));
-
-			MidiDriver *driver = MidiDriver::createMidi(midiDriver);
-			assert(driver);
-			if (native_mt32)
-				driver->property(MidiDriver::PROP_CHANNEL_MASK, 0x03FE);
-
-			SoundMidiPC *soundMidiPc = new SoundMidiPC(this, _mixer, driver);
-			_sound = soundMidiPc;
-			assert(_sound);
-			soundMidiPc->hasNativeMT32(native_mt32);
-
-			// Unlike some SCUMM games, it's not that the MIDI sounds are
-			// missing. It's just that at least at the time of writing they
-			// are decidedly inferior to the Adlib ones.
-			if (ConfMan.getBool("multi_midi")) {
-				SoundAdlibPC *adlib = new SoundAdlibPC(this, _mixer);
-				assert(adlib);
-
-				_sound = new MixedSoundDriver(this, _mixer, soundMidiPc, adlib);
-				assert(_sound);
-			}
-		}
-	}
-
-	if (_sound)
-		_sound->updateVolumeSettings();
-
-	_res = new Resource(this);
-	assert(_res);
-	_res->reset();
-	_staticres = new StaticResource(this);
-	assert(_staticres);
-	if (!_staticres->init())
-		error("_staticres->init() failed");
-	if (!screen()->init())
-		error("screen()->init() failed");
-	_timer = new TimerManager(this, _system);
-	assert(_timer);
-	setupTimers();
-	_emc = new EMCInterpreter(this);
-	assert(_emc);
-
-	setupOpcodeTable();
-	readSettings();
-
-	if (ConfMan.hasKey("save_slot")) {
-		_gameToLoad = ConfMan.getInt("save_slot");
-		if (!saveFileLoadable(_gameToLoad))
-			_gameToLoad = -1;
-	}
-
-	_lang = 0;
-	Common::Language lang = Common::parseLanguage(ConfMan.get("language"));
-
-	if (_flags.gameID == GI_KYRA2 || _flags.gameID == GI_KYRA3) {
-		switch (lang) {
-		case Common::EN_ANY:
-		case Common::EN_USA:
-		case Common::EN_GRB:
-			_lang = 0;
-			break;
-
-		case Common::FR_FRA:
-			_lang = 1;
-			break;
-
-		case Common::DE_DEU:
-			_lang = 2;
-			break;
-
-		case Common::JA_JPN:
-			_lang = 3;
-			break;
-
-		default:
-			warning("unsupported language, switching back to English");
-			_lang = 0;
-			break;
-		}
-	}
-
-	return 0;
-}
-
-KyraEngine::~KyraEngine() {
-	for (Common::Array<const Opcode*>::iterator i = _opcodes.begin(); i != _opcodes.end(); ++i)
-		delete *i;
-	_opcodes.clear();
-
-	delete _res;
-	delete _staticres;
-	delete _sound;
-	delete _text;
-	delete _timer;
-	delete _emc;
-	delete _debugger;
-}
-
-void KyraEngine::quitGame() {
-	debugC(9, kDebugLevelMain, "KyraEngine::quitGame()");
-	_quitFlag = true;
-	// Nothing to do here
-}
-
-Common::Point KyraEngine::getMousePos() const {
-	Common::Point mouse = _eventMan->getMousePos();
-
-	if (_flags.useHiResOverlay) {
-		mouse.x >>= 1;
-		mouse.y >>= 1;
-	}
-
-	return mouse;
-}
-
-void KyraEngine::setMousePos(int x, int y) {
-	if (_flags.useHiResOverlay) {
-		x <<= 1;
-		y <<= 1;
-	}
-	_system->warpMouse(x, y);
-}
-
-int KyraEngine::setGameFlag(int flag) {
-	_flagsTable[flag >> 3] |= (1 << (flag & 7));
-	return 1;
-}
-
-int KyraEngine::queryGameFlag(int flag) const {
-	return ((_flagsTable[flag >> 3] >> (flag & 7)) & 1);
-}
-
-int KyraEngine::resetGameFlag(int flag) {
-	_flagsTable[flag >> 3] &= ~(1 << (flag & 7));
-	return 0;
-}
-
-void KyraEngine::delayUntil(uint32 timestamp, bool updateTimers, bool update, bool isMainLoop) {
-	while (_system->getMillis() < timestamp && !_quitFlag) {
-		if (timestamp - _system->getMillis() >= 10)
-			delay(10, update, isMainLoop);
-	}
-}
-
-void KyraEngine::delay(uint32 amount, bool update, bool isMainLoop) {
-	_system->delayMillis(amount);
-}
-
-void KyraEngine::delayWithTicks(int ticks) {
-	delay(ticks * _tickLength);
-}
-
-void KyraEngine::registerDefaultSettings() {
-	if (_flags.gameID != GI_KYRA3)
-		ConfMan.registerDefault("cdaudio", (_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98));
-}
-
-void KyraEngine::readSettings() {
-	_configWalkspeed = ConfMan.getInt("walkspeed");
-	_configMusic = 0;
-	
-	if (!ConfMan.getBool("music_mute")) {
-		_configMusic = 1;
-		if (_flags.gameID != GI_KYRA3 && ConfMan.getBool("cdaudio") && (_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98))
-			_configMusic = 2;
-	}
-	_configSounds = ConfMan.getBool("sfx_mute") ? 0 : 1;
-
-	if (_sound) {
-		_sound->enableMusic(_configMusic);
-		_sound->enableSFX(_configSounds);
-	}
-
-	bool speechMute = ConfMan.getBool("speech_mute");
-	bool subtitles = ConfMan.getBool("subtitles");
-
-	if (!speechMute && subtitles)
-		_configVoice = 2;	// Voice & Text
-	else if (!speechMute && !subtitles)
-		_configVoice = 1;	// Voice only
-	else
-		_configVoice = 0;	// Text only
-
-	setWalkspeed(_configWalkspeed);
-}
-
-void KyraEngine::writeSettings() {
-	bool speechMute, subtitles;
-
-	ConfMan.setInt("walkspeed", _configWalkspeed);
-	ConfMan.setBool("music_mute", _configMusic == 0);
-	if (_flags.gameID != GI_KYRA3)
-		ConfMan.setBool("cdaudio", _configMusic == 2);
-	ConfMan.setBool("sfx_mute", _configSounds == 0);
-
-	switch (_configVoice) {
-	case 0:		// Text only
-		speechMute = true;
-		subtitles = true;
-		break;
-	case 1:		// Voice only
-		speechMute = false;
-		subtitles = false;
-		break;
-	default:	// Voice & Text
-		speechMute = false;
-		subtitles = true;
-		break;
-	}
-
-	if (_sound) {
-		if (!_configMusic)
-			_sound->beginFadeOut();
-		_sound->enableMusic(_configMusic);
-		_sound->enableSFX(_configSounds);
-	}
-
-	ConfMan.setBool("speech_mute", speechMute);
-	ConfMan.setBool("subtitles", subtitles);
-
-	ConfMan.flushToDisk();
-}
-
-bool KyraEngine::speechEnabled() {
-	return _flags.isTalkie && (_configVoice == 1 || _configVoice == 2);
-}
-
-bool KyraEngine::textEnabled() {
-	return !_flags.isTalkie || (_configVoice == 0 || _configVoice == 2);
-}
-
-inline int convertValueToMixer(int value) {
-	value -= 2;
-	return (value * Audio::Mixer::kMaxMixerVolume) / 95;
-}
-
-inline int convertValueFromMixer(int value) {
-	return (value * 95) / Audio::Mixer::kMaxMixerVolume + 2;
-}
-
-void KyraEngine::setVolume(kVolumeEntry vol, uint8 value) {
-	switch (vol) {
-	case kVolumeMusic:
-		ConfMan.setInt("music_volume", convertValueToMixer(value));
-		break;
-
-	case kVolumeSfx:
-		ConfMan.setInt("sfx_volume", convertValueToMixer(value));
-		break;
-	
-	case kVolumeSpeech:
-		ConfMan.setInt("speech_volume", convertValueToMixer(value));
-		break;
-	}
-
-	// Resetup mixer
-	_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume"));
-	_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume"));
-	_mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, ConfMan.getInt("speech_volume"));
-	if (_sound)
-		_sound->updateVolumeSettings();
-}
-
-uint8 KyraEngine::getVolume(kVolumeEntry vol) {
-	switch (vol) {
-	case kVolumeMusic:
-		return convertValueFromMixer(ConfMan.getInt("music_volume"));
-		break;
-
-	case kVolumeSfx:
-		return convertValueFromMixer(ConfMan.getInt("sfx_volume"));
-		break;
-	
-	case kVolumeSpeech:
-		if (speechEnabled())
-			return convertValueFromMixer(ConfMan.getInt("speech_volume"));
-		else
-			return 2;
-		break;
-	}
-
-	return 2;
-}
-
-} // End of namespace Kyra
-

Deleted: scummvm/trunk/engines/kyra/kyra.h
===================================================================
--- scummvm/trunk/engines/kyra/kyra.h	2008-05-11 22:45:12 UTC (rev 32043)
+++ scummvm/trunk/engines/kyra/kyra.h	2008-05-11 23:16:50 UTC (rev 32044)
@@ -1,272 +0,0 @@
-/* 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 KYRA_KYRA_H
-#define KYRA_KYRA_H
-
-#include "engines/engine.h"
-
-#include "common/array.h"
-#include "common/events.h"
-
-#include "kyra/script.h"
-
-namespace Common {
-class InSaveFile;
-class OutSaveFile;
-} // end of namespace Common
-
-class KyraMetaEngine;
-
-namespace Kyra {
-
-struct GameFlags {
-	Common::Language lang;
-	Common::Platform platform;
-
-	bool isDemo				: 1;
-	bool useAltShapeHeader	: 1;	// alternative shape header (uses 2 bytes more, those are unused though)
-	bool isTalkie			: 1;
-	bool useHiResOverlay	: 1;
-	bool useDigSound		: 1;
-
-	byte gameID;
-};
-
-enum {
-	GI_KYRA1 = 0,
-	GI_KYRA2 = 1,
-	GI_KYRA3 = 2
-};
-
-struct AudioDataStruct {
-	const char * const *_fileList;
-	const int _fileListLen;
-	const void * const _cdaTracks;
-	const int _cdaNumTracks;
-};
-
-// 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
-enum kDebugLevels {
-	kDebugLevelScriptFuncs = 1 << 0,		// prints debug output of o#_* functions
-	kDebugLevelScript = 1 << 1,				// prints debug output of "EMCInterpreter" functions
-	kDebugLevelSprites = 1 << 2,			// prints debug output of "Sprites" functions
-	kDebugLevelScreen = 1 << 3,				// prints debug output of "Screen" functions
-	kDebugLevelSound = 1 << 4,				// prints debug output of "Sound" functions
-	kDebugLevelAnimator = 1 << 5,			// prints debug output of "ScreenAnimator" functions
-	kDebugLevelMain = 1 << 6,				// prints debug output of common "KyraEngine(_v#)" functions && "TextDisplayer" functions
-	kDebugLevelGUI = 1 << 7,				// prints debug output of "KyraEngine*" gui functions
-	kDebugLevelSequence = 1 << 8,			// prints debug output of "SeqPlayer" functions
-	kDebugLevelMovie = 1 << 9,				// prints debug output of movie specific funtions
-	kDebugLevelTimer = 1 << 10				// prints debug output of "TimerManager" functions
-};
-
-enum kMusicDataID {
-	kMusicIntro = 0,
-	kMusicIngame,
-	kMusicFinale
-};
-
-class Screen;
-class Resource;
-class Sound;
-class Movie;
-class TextDisplayer;
-class StaticResource;
-class TimerManager;
-class Debugger;
-
-class KyraEngine : public Engine {
-friend class Debugger;
-friend class ::KyraMetaEngine;
-friend class GUI;
-public:
-	KyraEngine(OSystem *system, const GameFlags &flags);
-	virtual ~KyraEngine();
-
-	::GUI::Debugger *getDebugger();
-
-	bool quit() const { return _quitFlag; }
-
-	uint8 game() const { return _flags.gameID; }
-	const GameFlags &gameFlags() const { return _flags; }
-
-	// access to Kyra specific functionallity
-	Resource *resource() { return _res; }
-	virtual Screen *screen() = 0;
-	virtual TextDisplayer *text() { return _text; }
-	Sound *sound() { return _sound; }
-	StaticResource *staticres() { return _staticres; }
-	TimerManager *timer() { return _timer; }
-
-	uint32 tickLength() const { return _tickLength; }
-
-	Common::RandomSource _rnd;
-
-	// input
-	void setMousePos(int x, int y);
-	Common::Point getMousePos() const;
-
-	// config specific
-	bool speechEnabled();
-	bool textEnabled();
-
-	enum kVolumeEntry {
-		kVolumeMusic = 0,
-		kVolumeSfx = 1,
-		kVolumeSpeech = 2
-	};
-
-	// volume reaches from 2 to 97
-	void setVolume(kVolumeEntry vol, uint8 value);
-	uint8 getVolume(kVolumeEntry vol);
-
-	// quit handling
-	virtual void quitGame();
-
-	// game flag handling
-	int setGameFlag(int flag);
-	int queryGameFlag(int flag) const;
-	int resetGameFlag(int flag);
-
-	// sound
-	virtual void snd_playTheme(int file, int track);
-	virtual void snd_playSoundEffect(int id, int volume=0xFF);
-	virtual void snd_playWanderScoreViaMap(int command, int restart);
-	virtual void snd_playVoiceFile(int id) = 0;
-	virtual bool snd_voiceIsPlaying();
-	virtual void snd_stopVoice();
-
-	// 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);
-
-protected:
-	virtual int go() = 0;
-	virtual int init();
-
-	// quit Handling
-	bool _quitFlag;
-
-	// intern
-	Resource *_res;
-	Sound *_sound;
-	TextDisplayer *_text;
-	StaticResource *_staticres;
-	TimerManager *_timer;
-	EMCInterpreter *_emc;
-	Debugger *_debugger;
-
-	// config specific
-	virtual void registerDefaultSettings();
-	virtual void readSettings();
-	virtual void writeSettings();
-
-	uint8 _configWalkspeed;
-
-	int _configMusic;
-	bool _configSounds;
-	uint8 _configVoice;
-
-	// game speed
-	virtual bool skipFlag() const = 0;
-	virtual void resetSkipFlag(bool removeEvent = true) = 0;
-
-	uint16 _tickLength;
-	uint16 _gameSpeed;
-
-	// timer
-	virtual void setupTimers() = 0;
-
-	virtual void setWalkspeed(uint8 speed) = 0;
-
-	// detection
-	GameFlags _flags;
-	int _lang;
-
-	// opcode
-	virtual void setupOpcodeTable() = 0;
-	Common::Array<const Opcode*> _opcodes;
-
-	// game flags
-	uint8 _flagsTable[100];	// TODO: check this value
-
-	// sound
-	Common::String _speechFile;
-
-	int _curMusicTheme;
-	int _curSfxFile;
-	int16 _lastMusicCommand;
-
-	const int8 *_trackMap;
-	int _trackMapSize;
-
-	// 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;
-
-	static const int8 _addXPosTable[];
-	static const int8 _addYPosTable[];
-
-	// save/load
-	int _gameToLoad;
-
-	const char *getSavegameFilename(int num);
-	bool saveFileLoadable(int slot);
-
-	struct SaveHeader {
-		Common::String description;
-		uint32 version;
-		byte gameID;
-		uint32 flags;
-
-		bool originalSave;	// savegame from original interpreter
-		bool oldHeader;		// old scummvm save header
-	};
-
-	enum kReadSaveHeaderError {
-		kRSHENoError = 0,
-		kRSHEInvalidType = 1,
-		kRSHEInvalidVersion = 2,
-		kRSHEIoError = 3
-	};
-
-	static kReadSaveHeaderError readSaveHeader(Common::InSaveFile *file, SaveHeader &header);
-
-	Common::InSaveFile *openSaveForReading(const char *filename, SaveHeader &header);
-	Common::OutSaveFile *openSaveForWriting(const char *filename, const char *saveName) const;
-};
-
-} // End of namespace Kyra
-
-#endif
-

Modified: scummvm/trunk/engines/kyra/kyra_hof.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra_hof.cpp	2008-05-11 22:45:12 UTC (rev 32043)
+++ scummvm/trunk/engines/kyra/kyra_hof.cpp	2008-05-11 23:16:50 UTC (rev 32044)
@@ -23,7 +23,7 @@
  *
  */
 
-#include "kyra/kyra.h"
+#include "kyra/kyra_v1.h"
 #include "kyra/kyra_hof.h"
 #include "kyra/screen.h"
 #include "kyra/resource.h"
@@ -182,7 +182,7 @@
 	assert(_screen);
 	_screen->setResolution();
 
-	KyraEngine::init();
+	KyraEngine_v1::init();
 	initStaticResource();
 
 	_debugger = new Debugger_HoF(this);
@@ -1526,7 +1526,7 @@
 	else if (_flags.platform == Common::kPlatformPC)
 		// TODO ?? Maybe there is a way to let users select whether they want
 		// voc, midi or adl sfx (even though it makes no sense to choose anything but voc).
-		KyraEngine::snd_playSoundEffect(track);
+		KyraEngine_v1::snd_playSoundEffect(track);
 }
 
 #pragma mark -
@@ -1954,7 +1954,7 @@
 #pragma mark -
 
 void KyraEngine_HoF::registerDefaultSettings() {
-	KyraEngine::registerDefaultSettings();
+	KyraEngine_v1::registerDefaultSettings();
 
 	// Most settings already have sensible defaults. This one, however, is
 	// specific to the Kyra engine.
@@ -1985,13 +1985,13 @@
 
 	ConfMan.set("language", Common::getLanguageCode(_flags.lang));
 
-	KyraEngine::writeSettings();
+	KyraEngine_v1::writeSettings();
 }
 
 void KyraEngine_HoF::readSettings() {
 	int talkspeed = ConfMan.getInt("talkspeed");
 	_configTextspeed = (talkspeed*95)/255 + 2;
-	KyraEngine::readSettings();
+	KyraEngine_v1::readSettings();
 }
 
 } // end of namespace Kyra

Modified: scummvm/trunk/engines/kyra/kyra_lok.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra_lok.cpp	2008-05-11 22:45:12 UTC (rev 32043)
+++ scummvm/trunk/engines/kyra/kyra_lok.cpp	2008-05-11 23:16:50 UTC (rev 32044)
@@ -47,7 +47,7 @@
 namespace Kyra {
 
 KyraEngine_LoK::KyraEngine_LoK(OSystem *system, const GameFlags &flags)
-	: KyraEngine(system, flags) {
+	: KyraEngine_v1(system, flags) {
 	_skipFlag = false;
 
 	_seq_Forest = _seq_KallakWriting = _seq_KyrandiaLogo = _seq_KallakMalcolm =
@@ -156,7 +156,7 @@
 	assert(_screen);
 	_screen->setResolution();
 
-	KyraEngine::init();
+	KyraEngine_v1::init();
 
 	_sprites = new Sprites(this, _system);
 	assert(_sprites);
@@ -994,7 +994,7 @@
 #pragma mark -
 
 void KyraEngine_LoK::registerDefaultSettings() {
-	KyraEngine::registerDefaultSettings();
+	KyraEngine_v1::registerDefaultSettings();
 
 	// Most settings already have sensible defaults. This one, however, is
 	// specific to the Kyra engine.
@@ -1015,7 +1015,7 @@
 	else
 		_configTextspeed = 2;	// Fast
 
-	KyraEngine::readSettings();
+	KyraEngine_v1::readSettings();
 }
 
 void KyraEngine_LoK::writeSettings() {
@@ -1038,7 +1038,7 @@
 
 	ConfMan.setInt("talkspeed", talkspeed);
 
-	KyraEngine::writeSettings();
+	KyraEngine_v1::writeSettings();
 }
 
 } // end of namespace Kyra

Modified: scummvm/trunk/engines/kyra/kyra_lok.h
===================================================================
--- scummvm/trunk/engines/kyra/kyra_lok.h	2008-05-11 22:45:12 UTC (rev 32043)
+++ scummvm/trunk/engines/kyra/kyra_lok.h	2008-05-11 23:16:50 UTC (rev 32044)
@@ -23,10 +23,10 @@
  *
  */
 
-#ifndef KYRA_KYRA_V1_H
-#define KYRA_KYRA_V1_H
+#ifndef KYRA_KYRA_LOK_H
+#define KYRA_KYRA_LOK_H
 
-#include "kyra/kyra.h"
+#include "kyra/kyra_v1.h"
 #include "kyra/script.h"
 #include "kyra/screen_lok.h"
 #include "kyra/gui_lok.h"
@@ -104,7 +104,7 @@
 	int16 tableIndex;
 };
 
-class KyraEngine_LoK : public KyraEngine {
+class KyraEngine_LoK : public KyraEngine_v1 {
 	friend class MusicPlayer;
 	friend class Debugger_LoK;
 	friend class Animator_LoK;

Modified: scummvm/trunk/engines/kyra/kyra_mr.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra_mr.cpp	2008-05-11 22:45:12 UTC (rev 32043)
+++ scummvm/trunk/engines/kyra/kyra_mr.cpp	2008-05-11 23:16:50 UTC (rev 32044)
@@ -23,7 +23,7 @@
  *
  */
 
-#include "kyra/kyra.h"
+#include "kyra/kyra_v1.h"
 #include "kyra/kyra_mr.h"
 #include "kyra/screen_mr.h"
 #include "kyra/wsamovie.h"
@@ -205,7 +205,7 @@
 	assert(_screen);
 	_screen->setResolution();
 
-	KyraEngine::init();
+	KyraEngine_v1::init();
 	
 	_debugger = new Debugger_v2(this);
 	assert(_debugger);
@@ -214,7 +214,7 @@
 	assert(_soundDigital);
 	if (!_soundDigital->init())
 		error("_soundDigital->init() failed");
-	KyraEngine::_text = _text = new TextDisplayer_MR(this, _screen);
+	KyraEngine_v1::_text = _text = new TextDisplayer_MR(this, _screen);
 	assert(_text);
 	_gui = new GUI_MR(this);
 	assert(_gui);
@@ -1509,7 +1509,7 @@
 
 void KyraEngine_MR::registerDefaultSettings() {
 	debugC(9, kDebugLevelMain, "KyraEngine_MR::registerDefaultSettings()");
-	KyraEngine::registerDefaultSettings();
+	KyraEngine_v1::registerDefaultSettings();
 
 	// Most settings already have sensible defaults. This one, however, is
 	// specific to the Kyra engine.
@@ -1542,12 +1542,12 @@
 	ConfMan.setBool("skip_support", _configSkip);
 	ConfMan.setBool("helium_mode", _configHelium);
 
-	KyraEngine::writeSettings();
+	KyraEngine_v1::writeSettings();
 }
 
 void KyraEngine_MR::readSettings() {
 	debugC(9, kDebugLevelMain, "KyraEngine_MR::readSettings()");
-	KyraEngine::readSettings();
+	KyraEngine_v1::readSettings();
 
 	_configStudio = ConfMan.getBool("studio_audience");
 	_configSkip = ConfMan.getBool("skip_support");

Copied: scummvm/trunk/engines/kyra/kyra_v1.cpp (from rev 32043, scummvm/trunk/engines/kyra/kyra.cpp)
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v1.cpp	                        (rev 0)
+++ scummvm/trunk/engines/kyra/kyra_v1.cpp	2008-05-11 23:16:50 UTC (rev 32044)
@@ -0,0 +1,400 @@
+/* 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$
+ *
+ */
+
+#include "common/config-manager.h"
+
+#include "sound/mididrv.h"
+#include "sound/mixer.h"
+
+#include "kyra/kyra_v1.h"
+#include "kyra/sound.h"
+#include "kyra/resource.h"
+#include "kyra/screen.h"
+#include "kyra/text.h"
+#include "kyra/timer.h"
+#include "kyra/script.h"
+#include "kyra/debugger.h"
+
+namespace Kyra {
+
+KyraEngine_v1::KyraEngine_v1(OSystem *system, const GameFlags &flags)
+	: Engine(system), _flags(flags) {
+	_res = 0;
+	_sound = 0;
+	_text = 0;
+	_staticres = 0;
+	_timer = 0;
+	_emc = 0;
+	_debugger = 0;
+
+	_gameSpeed = 60;
+	_tickLength = (uint8)(1000.0 / _gameSpeed);
+
+	_quitFlag = false;
+
+	_speechFile = "";
+	_trackMap = 0;
+	_trackMapSize = 0;
+	_lastMusicCommand = -1;
+	_curSfxFile = _curMusicTheme = -1;
+
+	_gameToLoad = -1;
+
+	memset(_flagsTable, 0, sizeof(_flagsTable));
+
+	// sets up all engine specific debug levels
+	Common::addSpecialDebugLevel(kDebugLevelScriptFuncs, "ScriptFuncs", "Script function debug level");
+	Common::addSpecialDebugLevel(kDebugLevelScript, "Script", "Script interpreter debug level");
+	Common::addSpecialDebugLevel(kDebugLevelSprites, "Sprites", "Sprite debug level");
+	Common::addSpecialDebugLevel(kDebugLevelScreen, "Screen", "Screen debug level");
+	Common::addSpecialDebugLevel(kDebugLevelSound, "Sound", "Sound debug level");
+	Common::addSpecialDebugLevel(kDebugLevelAnimator, "Animator", "Animator debug level");
+	Common::addSpecialDebugLevel(kDebugLevelMain, "Main", "Generic debug level");
+	Common::addSpecialDebugLevel(kDebugLevelGUI, "GUI", "GUI debug level");
+	Common::addSpecialDebugLevel(kDebugLevelSequence, "Sequence", "Sequence debug level");
+	Common::addSpecialDebugLevel(kDebugLevelMovie, "Movie", "Movie debug level");
+	Common::addSpecialDebugLevel(kDebugLevelTimer, "Timer", "Timer debug level");
+
+	system->getEventManager()->registerRandomSource(_rnd, "kyra");
+}
+
+::GUI::Debugger *KyraEngine_v1::getDebugger() {
+	return _debugger;
+}
+
+int KyraEngine_v1::init() {
+	registerDefaultSettings();
+
+	// Setup mixer
+	_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume"));
+	_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume"));
+	_mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, ConfMan.getInt("speech_volume"));
+
+	if (!_flags.useDigSound) {
+		// We prefer AdLib over native MIDI, since our AdLib playback code is much
+		// more mature than our MIDI player. For example we are missing MT-32 support
+		// and it seems our MIDI playback code has threading issues (see bug #1506583
+		// "KYRA1: Crash on exceeded polyphony" for more information).
+		int midiDriver = MidiDriver::detectMusicDriver(MDT_MIDI | MDT_ADLIB/* | MDT_PREFER_MIDI*/);
+
+		if (_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98) {
+			// TODO: currently we don't support the PC98 sound data,
+			// but since it has the FM-Towns data files, we just use the
+			// FM-Towns driver
+			if (_flags.gameID == GI_KYRA1)
+				_sound = new SoundTowns(this, _mixer);
+			else
+				_sound = new SoundTowns_v2(this, _mixer);
+		} else if (midiDriver == MD_ADLIB) {
+			_sound = new SoundAdlibPC(this, _mixer);
+			assert(_sound);
+		} else {
+			bool native_mt32 = ((midiDriver == MD_MT32) || ConfMan.getBool("native_mt32"));
+
+			MidiDriver *driver = MidiDriver::createMidi(midiDriver);
+			assert(driver);
+			if (native_mt32)
+				driver->property(MidiDriver::PROP_CHANNEL_MASK, 0x03FE);
+
+			SoundMidiPC *soundMidiPc = new SoundMidiPC(this, _mixer, driver);
+			_sound = soundMidiPc;
+			assert(_sound);
+			soundMidiPc->hasNativeMT32(native_mt32);
+
+			// Unlike some SCUMM games, it's not that the MIDI sounds are
+			// missing. It's just that at least at the time of writing they
+			// are decidedly inferior to the Adlib ones.
+			if (ConfMan.getBool("multi_midi")) {
+				SoundAdlibPC *adlib = new SoundAdlibPC(this, _mixer);
+				assert(adlib);
+
+				_sound = new MixedSoundDriver(this, _mixer, soundMidiPc, adlib);
+				assert(_sound);
+			}
+		}
+	}
+
+	if (_sound)
+		_sound->updateVolumeSettings();
+
+	_res = new Resource(this);
+	assert(_res);
+	_res->reset();
+	_staticres = new StaticResource(this);
+	assert(_staticres);
+	if (!_staticres->init())
+		error("_staticres->init() failed");
+	if (!screen()->init())
+		error("screen()->init() failed");
+	_timer = new TimerManager(this, _system);
+	assert(_timer);
+	setupTimers();
+	_emc = new EMCInterpreter(this);
+	assert(_emc);
+
+	setupOpcodeTable();
+	readSettings();
+
+	if (ConfMan.hasKey("save_slot")) {
+		_gameToLoad = ConfMan.getInt("save_slot");
+		if (!saveFileLoadable(_gameToLoad))
+			_gameToLoad = -1;
+	}
+
+	_lang = 0;
+	Common::Language lang = Common::parseLanguage(ConfMan.get("language"));
+
+	if (_flags.gameID == GI_KYRA2 || _flags.gameID == GI_KYRA3) {
+		switch (lang) {
+		case Common::EN_ANY:
+		case Common::EN_USA:
+		case Common::EN_GRB:
+			_lang = 0;
+			break;
+
+		case Common::FR_FRA:
+			_lang = 1;
+			break;
+
+		case Common::DE_DEU:
+			_lang = 2;
+			break;
+
+		case Common::JA_JPN:
+			_lang = 3;
+			break;
+
+		default:
+			warning("unsupported language, switching back to English");
+			_lang = 0;
+			break;
+		}
+	}
+
+	return 0;
+}
+
+KyraEngine_v1::~KyraEngine_v1() {
+	for (Common::Array<const Opcode*>::iterator i = _opcodes.begin(); i != _opcodes.end(); ++i)
+		delete *i;
+	_opcodes.clear();
+
+	delete _res;
+	delete _staticres;
+	delete _sound;
+	delete _text;
+	delete _timer;
+	delete _emc;
+	delete _debugger;
+}
+
+void KyraEngine_v1::quitGame() {
+	debugC(9, kDebugLevelMain, "KyraEngine_v1::quitGame()");
+	_quitFlag = true;
+	// Nothing to do here
+}
+
+Common::Point KyraEngine_v1::getMousePos() const {
+	Common::Point mouse = _eventMan->getMousePos();
+
+	if (_flags.useHiResOverlay) {
+		mouse.x >>= 1;
+		mouse.y >>= 1;
+	}
+
+	return mouse;
+}
+
+void KyraEngine_v1::setMousePos(int x, int y) {
+	if (_flags.useHiResOverlay) {
+		x <<= 1;
+		y <<= 1;
+	}
+	_system->warpMouse(x, y);
+}
+
+int KyraEngine_v1::setGameFlag(int flag) {
+	_flagsTable[flag >> 3] |= (1 << (flag & 7));
+	return 1;
+}
+
+int KyraEngine_v1::queryGameFlag(int flag) const {
+	return ((_flagsTable[flag >> 3] >> (flag & 7)) & 1);
+}
+
+int KyraEngine_v1::resetGameFlag(int flag) {
+	_flagsTable[flag >> 3] &= ~(1 << (flag & 7));
+	return 0;
+}
+
+void KyraEngine_v1::delayUntil(uint32 timestamp, bool updateTimers, bool update, bool isMainLoop) {
+	while (_system->getMillis() < timestamp && !_quitFlag) {
+		if (timestamp - _system->getMillis() >= 10)
+			delay(10, update, isMainLoop);
+	}
+}
+
+void KyraEngine_v1::delay(uint32 amount, bool update, bool isMainLoop) {
+	_system->delayMillis(amount);
+}
+
+void KyraEngine_v1::delayWithTicks(int ticks) {
+	delay(ticks * _tickLength);
+}
+
+void KyraEngine_v1::registerDefaultSettings() {
+	if (_flags.gameID != GI_KYRA3)
+		ConfMan.registerDefault("cdaudio", (_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98));
+}
+
+void KyraEngine_v1::readSettings() {
+	_configWalkspeed = ConfMan.getInt("walkspeed");
+	_configMusic = 0;
+	
+	if (!ConfMan.getBool("music_mute")) {
+		_configMusic = 1;
+		if (_flags.gameID != GI_KYRA3 && ConfMan.getBool("cdaudio") && (_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98))
+			_configMusic = 2;
+	}
+	_configSounds = ConfMan.getBool("sfx_mute") ? 0 : 1;
+
+	if (_sound) {
+		_sound->enableMusic(_configMusic);
+		_sound->enableSFX(_configSounds);
+	}
+
+	bool speechMute = ConfMan.getBool("speech_mute");
+	bool subtitles = ConfMan.getBool("subtitles");
+
+	if (!speechMute && subtitles)
+		_configVoice = 2;	// Voice & Text
+	else if (!speechMute && !subtitles)
+		_configVoice = 1;	// Voice only
+	else
+		_configVoice = 0;	// Text only
+
+	setWalkspeed(_configWalkspeed);
+}
+
+void KyraEngine_v1::writeSettings() {
+	bool speechMute, subtitles;
+
+	ConfMan.setInt("walkspeed", _configWalkspeed);
+	ConfMan.setBool("music_mute", _configMusic == 0);
+	if (_flags.gameID != GI_KYRA3)
+		ConfMan.setBool("cdaudio", _configMusic == 2);
+	ConfMan.setBool("sfx_mute", _configSounds == 0);
+
+	switch (_configVoice) {
+	case 0:		// Text only
+		speechMute = true;
+		subtitles = true;
+		break;
+	case 1:		// Voice only
+		speechMute = false;
+		subtitles = false;
+		break;
+	default:	// Voice & Text
+		speechMute = false;
+		subtitles = true;
+		break;
+	}
+
+	if (_sound) {
+		if (!_configMusic)
+			_sound->beginFadeOut();
+		_sound->enableMusic(_configMusic);
+		_sound->enableSFX(_configSounds);
+	}
+
+	ConfMan.setBool("speech_mute", speechMute);
+	ConfMan.setBool("subtitles", subtitles);
+
+	ConfMan.flushToDisk();
+}
+
+bool KyraEngine_v1::speechEnabled() {
+	return _flags.isTalkie && (_configVoice == 1 || _configVoice == 2);
+}
+
+bool KyraEngine_v1::textEnabled() {
+	return !_flags.isTalkie || (_configVoice == 0 || _configVoice == 2);
+}
+
+inline int convertValueToMixer(int value) {
+	value -= 2;
+	return (value * Audio::Mixer::kMaxMixerVolume) / 95;
+}
+
+inline int convertValueFromMixer(int value) {
+	return (value * 95) / Audio::Mixer::kMaxMixerVolume + 2;
+}
+
+void KyraEngine_v1::setVolume(kVolumeEntry vol, uint8 value) {
+	switch (vol) {
+	case kVolumeMusic:
+		ConfMan.setInt("music_volume", convertValueToMixer(value));
+		break;
+
+	case kVolumeSfx:
+		ConfMan.setInt("sfx_volume", convertValueToMixer(value));
+		break;
+	
+	case kVolumeSpeech:
+		ConfMan.setInt("speech_volume", convertValueToMixer(value));
+		break;
+	}
+
+	// Resetup mixer
+	_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume"));
+	_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume"));
+	_mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, ConfMan.getInt("speech_volume"));
+	if (_sound)
+		_sound->updateVolumeSettings();
+}
+
+uint8 KyraEngine_v1::getVolume(kVolumeEntry vol) {
+	switch (vol) {
+	case kVolumeMusic:
+		return convertValueFromMixer(ConfMan.getInt("music_volume"));
+		break;
+
+	case kVolumeSfx:
+		return convertValueFromMixer(ConfMan.getInt("sfx_volume"));
+		break;
+	
+	case kVolumeSpeech:
+		if (speechEnabled())
+			return convertValueFromMixer(ConfMan.getInt("speech_volume"));
+		else
+			return 2;
+		break;
+	}
+
+	return 2;
+}
+
+} // End of namespace Kyra
+

Copied: scummvm/trunk/engines/kyra/kyra_v1.h (from rev 32043, scummvm/trunk/engines/kyra/kyra.h)
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v1.h	                        (rev 0)
+++ scummvm/trunk/engines/kyra/kyra_v1.h	2008-05-11 23:16:50 UTC (rev 32044)
@@ -0,0 +1,272 @@
+/* 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 KYRA_KYRA_V1_H
+#define KYRA_KYRA_V1_H
+
+#include "engines/engine.h"
+
+#include "common/array.h"
+#include "common/events.h"
+
+#include "kyra/script.h"
+
+namespace Common {
+class InSaveFile;
+class OutSaveFile;
+} // end of namespace Common
+
+class KyraMetaEngine;
+
+namespace Kyra {
+
+struct GameFlags {
+	Common::Language lang;
+	Common::Platform platform;
+
+	bool isDemo				: 1;
+	bool useAltShapeHeader	: 1;	// alternative shape header (uses 2 bytes more, those are unused though)
+	bool isTalkie			: 1;
+	bool useHiResOverlay	: 1;
+	bool useDigSound		: 1;
+
+	byte gameID;
+};
+
+enum {
+	GI_KYRA1 = 0,
+	GI_KYRA2 = 1,
+	GI_KYRA3 = 2
+};
+
+struct AudioDataStruct {
+	const char * const *_fileList;
+	const int _fileListLen;
+	const void * const _cdaTracks;
+	const int _cdaNumTracks;
+};
+
+// 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
+enum kDebugLevels {
+	kDebugLevelScriptFuncs = 1 << 0,		// prints debug output of o#_* functions
+	kDebugLevelScript = 1 << 1,				// prints debug output of "EMCInterpreter" functions
+	kDebugLevelSprites = 1 << 2,			// prints debug output of "Sprites" functions
+	kDebugLevelScreen = 1 << 3,				// prints debug output of "Screen" functions
+	kDebugLevelSound = 1 << 4,				// prints debug output of "Sound" functions
+	kDebugLevelAnimator = 1 << 5,			// prints debug output of "ScreenAnimator" functions
+	kDebugLevelMain = 1 << 6,				// prints debug output of common "KyraEngine(_v#)" functions && "TextDisplayer" functions
+	kDebugLevelGUI = 1 << 7,				// prints debug output of "KyraEngine*" gui functions
+	kDebugLevelSequence = 1 << 8,			// prints debug output of "SeqPlayer" functions
+	kDebugLevelMovie = 1 << 9,				// prints debug output of movie specific funtions
+	kDebugLevelTimer = 1 << 10				// prints debug output of "TimerManager" functions
+};
+
+enum kMusicDataID {
+	kMusicIntro = 0,
+	kMusicIngame,
+	kMusicFinale
+};
+
+class Screen;
+class Resource;
+class Sound;
+class Movie;
+class TextDisplayer;
+class StaticResource;
+class TimerManager;
+class Debugger;
+
+class KyraEngine_v1 : public Engine {
+friend class Debugger;
+friend class ::KyraMetaEngine;
+friend class GUI;
+public:
+	KyraEngine_v1(OSystem *system, const GameFlags &flags);
+	virtual ~KyraEngine_v1();
+
+	::GUI::Debugger *getDebugger();
+
+	bool quit() const { return _quitFlag; }
+
+	uint8 game() const { return _flags.gameID; }
+	const GameFlags &gameFlags() const { return _flags; }
+
+	// access to Kyra specific functionallity
+	Resource *resource() { return _res; }
+	virtual Screen *screen() = 0;
+	virtual TextDisplayer *text() { return _text; }
+	Sound *sound() { return _sound; }
+	StaticResource *staticres() { return _staticres; }
+	TimerManager *timer() { return _timer; }
+
+	uint32 tickLength() const { return _tickLength; }
+
+	Common::RandomSource _rnd;
+
+	// input
+	void setMousePos(int x, int y);
+	Common::Point getMousePos() const;
+
+	// config specific
+	bool speechEnabled();
+	bool textEnabled();
+
+	enum kVolumeEntry {
+		kVolumeMusic = 0,
+		kVolumeSfx = 1,
+		kVolumeSpeech = 2
+	};
+
+	// volume reaches from 2 to 97
+	void setVolume(kVolumeEntry vol, uint8 value);
+	uint8 getVolume(kVolumeEntry vol);
+
+	// quit handling
+	virtual void quitGame();
+
+	// game flag handling
+	int setGameFlag(int flag);
+	int queryGameFlag(int flag) const;
+	int resetGameFlag(int flag);
+
+	// sound
+	virtual void snd_playTheme(int file, int track);
+	virtual void snd_playSoundEffect(int id, int volume=0xFF);
+	virtual void snd_playWanderScoreViaMap(int command, int restart);
+	virtual void snd_playVoiceFile(int id) = 0;
+	virtual bool snd_voiceIsPlaying();
+	virtual void snd_stopVoice();
+
+	// 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);
+
+protected:
+	virtual int go() = 0;
+	virtual int init();
+
+	// quit Handling
+	bool _quitFlag;
+
+	// intern
+	Resource *_res;
+	Sound *_sound;
+	TextDisplayer *_text;
+	StaticResource *_staticres;
+	TimerManager *_timer;
+	EMCInterpreter *_emc;
+	Debugger *_debugger;
+
+	// config specific
+	virtual void registerDefaultSettings();
+	virtual void readSettings();
+	virtual void writeSettings();
+
+	uint8 _configWalkspeed;
+
+	int _configMusic;
+	bool _configSounds;
+	uint8 _configVoice;
+
+	// game speed
+	virtual bool skipFlag() const = 0;
+	virtual void resetSkipFlag(bool removeEvent = true) = 0;
+
+	uint16 _tickLength;
+	uint16 _gameSpeed;
+
+	// timer
+	virtual void setupTimers() = 0;
+
+	virtual void setWalkspeed(uint8 speed) = 0;
+
+	// detection
+	GameFlags _flags;
+	int _lang;
+
+	// opcode
+	virtual void setupOpcodeTable() = 0;
+	Common::Array<const Opcode*> _opcodes;
+
+	// game flags
+	uint8 _flagsTable[100];	// TODO: check this value
+
+	// sound
+	Common::String _speechFile;
+
+	int _curMusicTheme;
+	int _curSfxFile;
+	int16 _lastMusicCommand;
+
+	const int8 *_trackMap;
+	int _trackMapSize;
+
+	// 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;
+
+	static const int8 _addXPosTable[];
+	static const int8 _addYPosTable[];
+
+	// save/load
+	int _gameToLoad;
+
+	const char *getSavegameFilename(int num);
+	bool saveFileLoadable(int slot);
+
+	struct SaveHeader {
+		Common::String description;
+		uint32 version;
+		byte gameID;
+		uint32 flags;
+
+		bool originalSave;	// savegame from original interpreter
+		bool oldHeader;		// old scummvm save header
+	};
+
+	enum kReadSaveHeaderError {
+		kRSHENoError = 0,
+		kRSHEInvalidType = 1,
+		kRSHEInvalidVersion = 2,
+		kRSHEIoError = 3
+	};
+
+	static kReadSaveHeaderError readSaveHeader(Common::InSaveFile *file, SaveHeader &header);
+
+	Common::InSaveFile *openSaveForReading(const char *filename, SaveHeader &header);
+	Common::OutSaveFile *openSaveForWriting(const char *filename, const char *saveName) const;
+};
+
+} // End of namespace Kyra
+
+#endif
+

Modified: scummvm/trunk/engines/kyra/kyra_v2.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v2.cpp	2008-05-11 22:45:12 UTC (rev 32043)
+++ scummvm/trunk/engines/kyra/kyra_v2.cpp	2008-05-11 23:16:50 UTC (rev 32044)
@@ -29,7 +29,7 @@
 
 namespace Kyra {
 
-KyraEngine_v2::KyraEngine_v2(OSystem *system, const GameFlags &flags, const EngineDesc &desc) : KyraEngine(system, flags), _desc(desc) {
+KyraEngine_v2::KyraEngine_v2(OSystem *system, const GameFlags &flags, const EngineDesc &desc) : KyraEngine_v1(system, flags), _desc(desc) {
 	memset(&_sceneAnims, 0, sizeof(_sceneAnims));
 	memset(&_sceneAnimMovie, 0, sizeof(_sceneAnimMovie));
 

Modified: scummvm/trunk/engines/kyra/kyra_v2.h
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v2.h	2008-05-11 22:45:12 UTC (rev 32043)
+++ scummvm/trunk/engines/kyra/kyra_v2.h	2008-05-11 23:16:50 UTC (rev 32044)
@@ -26,7 +26,7 @@
 #ifndef KYRA_KYRA_V2_H
 #define KYRA_KYRA_V2_H
 
-#include "kyra/kyra.h"
+#include "kyra/kyra_v1.h"
 #include "kyra/gui.h"
 #include "kyra/wsamovie.h"
 
@@ -53,7 +53,7 @@
 
 class Screen_v2;
 
-class KyraEngine_v2 : public KyraEngine {
+class KyraEngine_v2 : public KyraEngine_v1 {
 friend class Debugger_v2;
 friend class GUI_v2;
 public:

Modified: scummvm/trunk/engines/kyra/module.mk
===================================================================
--- scummvm/trunk/engines/kyra/module.mk	2008-05-11 22:45:12 UTC (rev 32043)
+++ scummvm/trunk/engines/kyra/module.mk	2008-05-11 23:16:50 UTC (rev 32044)
@@ -16,7 +16,7 @@
 	items_v2.o \
 	items_hof.o \
 	items_mr.o \
-	kyra.o \
+	kyra_v1.o \
 	kyra_lok.o \
 	kyra_v2.o \
 	kyra_hof.o \
@@ -26,7 +26,7 @@
 	saveload_lok.o \
 	saveload_hof.o \
 	saveload_mr.o \
-	scene.o \
+	scene_v1.o \
 	scene_lok.o \
 	scene_v2.o \
 	scene_hof.o \

Modified: scummvm/trunk/engines/kyra/resource.cpp
===================================================================
--- scummvm/trunk/engines/kyra/resource.cpp	2008-05-11 22:45:12 UTC (rev 32043)
+++ scummvm/trunk/engines/kyra/resource.cpp	2008-05-11 23:16:50 UTC (rev 32044)
@@ -36,7 +36,7 @@
 
 namespace Kyra {
 
-Resource::Resource(KyraEngine *vm) : _loaders(), _map(), _vm(vm) {
+Resource::Resource(KyraEngine_v1 *vm) : _loaders(), _map(), _vm(vm) {
 	initializeLoaders();
 }
 

Modified: scummvm/trunk/engines/kyra/resource.h
===================================================================
--- scummvm/trunk/engines/kyra/resource.h	2008-05-11 22:45:12 UTC (rev 32043)
+++ scummvm/trunk/engines/kyra/resource.h	2008-05-11 23:16:50 UTC (rev 32044)
@@ -36,7 +36,7 @@
 #include "common/stream.h"
 #include "common/ptr.h"
 
-#include "kyra/kyra.h"
+#include "kyra/kyra_v1.h"
 #include "kyra/kyra_hof.h"
 
 namespace Kyra {
@@ -88,7 +88,7 @@
 
 class Resource {
 public:
-	Resource(KyraEngine *vm);
+	Resource(KyraEngine_v1 *vm);
 	~Resource();
 
 	bool reset();
@@ -122,7 +122,7 @@
 	LoaderList _loaders;
 	ResFileMap _map;
 
-	KyraEngine *_vm;
+	KyraEngine_v1 *_vm;
 };
 
 // TODO?: maybe prefix all things here with 'kKyra1' instead of 'k'
@@ -239,7 +239,7 @@
 public:
 	static const Common::String staticDataFilename() { return "kyra.dat"; }
 
-	StaticResource(KyraEngine *vm) : _vm(vm), _resList(), _fileLoader(0), _builtIn(0), _filenameTable(0) {}
+	StaticResource(KyraEngine_v1 *vm) : _vm(vm), _resList(), _fileLoader(0), _builtIn(0), _filenameTable(0) {}
 	~StaticResource() { deinit(); }
 
 	static bool checkKyraDat();
@@ -265,7 +265,7 @@
 private:
 	void outputError();
 
-	KyraEngine *_vm;
+	KyraEngine_v1 *_vm;
 
 	struct FilenameTable;
 	struct ResData;

Modified: scummvm/trunk/engines/kyra/saveload.cpp
===================================================================
--- scummvm/trunk/engines/kyra/saveload.cpp	2008-05-11 22:45:12 UTC (rev 32043)
+++ scummvm/trunk/engines/kyra/saveload.cpp	2008-05-11 23:16:50 UTC (rev 32044)
@@ -27,7 +27,7 @@
 #include "common/savefile.h"
 #include "common/system.h"
 
-#include "kyra/kyra.h"
+#include "kyra/kyra_v1.h"
 
 #define CURRENT_SAVE_VERSION 13
 
@@ -37,7 +37,7 @@
 
 namespace Kyra {
 
-KyraEngine::kReadSaveHeaderError KyraEngine::readSaveHeader(Common::InSaveFile *in, SaveHeader &header) {
+KyraEngine_v1::kReadSaveHeaderError KyraEngine_v1::readSaveHeader(Common::InSaveFile *in, SaveHeader &header) {
 	uint32 type = in->readUint32BE();
 	header.originalSave = false;
 	header.oldHeader = false;
@@ -108,14 +108,14 @@
 	return (in->ioFailed() ? kRSHEIoError : kRSHENoError);
 }
 
-Common::InSaveFile *KyraEngine::openSaveForReading(const char *filename, SaveHeader &header) {
-	debugC(9, kDebugLevelMain, "KyraEngine::openSaveForReading('%s', -)", filename);
+Common::InSaveFile *KyraEngine_v1::openSaveForReading(const char *filename, SaveHeader &header) {
+	debugC(9, kDebugLevelMain, "KyraEngine_v1::openSaveForReading('%s', -)", filename);
 
 	Common::InSaveFile *in = 0;
 	if (!(in = _saveFileMan->openForLoading(filename)))
 		return 0;
 
-	kReadSaveHeaderError errorCode = KyraEngine::readSaveHeader(in, header);
+	kReadSaveHeaderError errorCode = KyraEngine_v1::readSaveHeader(in, header);
 	if (errorCode != kRSHENoError) {
 		if (errorCode == kRSHEInvalidType)
 			warning("No ScummVM Kyra engine savefile header.");
@@ -159,8 +159,8 @@
 	return in;
 }
 
-Common::OutSaveFile *KyraEngine::openSaveForWriting(const char *filename, const char *saveName) const {
-	debugC(9, kDebugLevelMain, "KyraEngine::openSaveForWriting('%s', '%s')", filename, saveName);
+Common::OutSaveFile *KyraEngine_v1::openSaveForWriting(const char *filename, const char *saveName) const {
+	debugC(9, kDebugLevelMain, "KyraEngine_v1::openSaveForWriting('%s', '%s')", filename, saveName);
 	if (_quitFlag)
 		return 0;
 
@@ -191,7 +191,7 @@
 	return out;
 }
 
-const char *KyraEngine::getSavegameFilename(int num) {
+const char *KyraEngine_v1::getSavegameFilename(int num) {
 	static Common::String filename;
 
 	assert(num >= 0 && num <= 999);
@@ -204,7 +204,7 @@
 	return filename.c_str();
 }
 
-bool KyraEngine::saveFileLoadable(int slot) {
+bool KyraEngine_v1::saveFileLoadable(int slot) {
 	if (slot < 0 || slot > 999)
 		return false;
 

Deleted: scummvm/trunk/engines/kyra/scene.cpp
===================================================================
--- scummvm/trunk/engines/kyra/scene.cpp	2008-05-11 22:45:12 UTC (rev 32043)
+++ scummvm/trunk/engines/kyra/scene.cpp	2008-05-11 23:16:50 UTC (rev 32044)
@@ -1,383 +0,0 @@
-/* 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$
- *
- */
-
-#include "kyra/kyra.h"
-#include "kyra/screen.h"
-
-namespace Kyra {
-
-int KyraEngine::findWay(int x, int y, int toX, int toY, int *moveTable, int moveTableSize) {
-	debugC(9, kDebugLevelMain, "KyraEngine::findWay(%d, %d, %d, %d, %p, %d)", x, y, toX, toY, (const void *)moveTable, moveTableSize);
-	x &= 0xFFFC; toX &= 0xFFFC;
-	y &= 0xFFFE; toY &= 0xFFFE;
-	x = (int16)x; y = (int16)y; toX = (int16)toX; toY = (int16)toY;
-
-	if (x == toY && y == toY) {
-		moveTable[0] = 8;
-		return 0;
-	}
-
-	int curX = x;
-	int curY = y;
-	int tempValue = 0;
-	int lastUsedEntry = 0;
-	int *pathTable1 = new int[0x7D0];
-	int *pathTable2 = new int[0x7D0];
-	assert(pathTable1 && pathTable2);
-
-	while (true) {
-		int newFacing = getFacingFromPointToPoint(x, y, toX, toY);
-		changePosTowardsFacing(curX, curY, newFacing);
-
-		if (curX == toX && curY == toY) {
-			if (!lineIsPassable(curX, curY))
-				break;
-			moveTable[lastUsedEntry++] = newFacing;
-			break;
-		}
-
-		if (lineIsPassable(curX, curY)) {
-			if (lastUsedEntry == moveTableSize) {
-				delete[] pathTable1;
-				delete[] pathTable2;
-				return 0x7D00;
-			}
-			// debug drawing
-			/*if (curX >= 0 && curY >= 0 && curX < 320 && curY < 200) {
-				screen()->setPagePixel(0, curX, curY, 11);
-				screen()->updateScreen();
-				delayWithTicks(5);
-			}*/
-			moveTable[lastUsedEntry++] = newFacing;
-			x = curX;
-			y = curY;
-			continue;
-		}
-
-		int temp = 0;
-		while (true) {
-			newFacing = getFacingFromPointToPoint(curX, curY, toX, toY);
-			changePosTowardsFacing(curX, curY, newFacing);
-			// debug drawing
-			/*if (curX >= 0 && curY >= 0 && curX < 320 && curY < 200) {
-				screen()->setPagePixel(0, curX, curY, 8);
-				screen()->updateScreen();
-				delayWithTicks(5);
-			}*/
-
-			if (!lineIsPassable(curX, curY)) {
-				if (curX != toX || curY != toY)
-					continue;
-			}
-
-			if (curX == toX && curY == toY) {
-				if (!lineIsPassable(curX, curY)) {
-					tempValue = 0;
-					temp = 0;
-					break;
-				}
-			}
-
-			temp = findSubPath(x, y, curX, curY, pathTable1, 1, 0x7D0);
-			tempValue = findSubPath(x, y, curX, curY, pathTable2, 0, 0x7D0);
-			if (curX == toX && curY == toY) {
-				if (temp == 0x7D00 && tempValue == 0x7D00) {
-					delete[] pathTable1;
-					delete[] pathTable2;
-					return 0x7D00;
-				}
-			}
-
-			if (temp != 0x7D00 || tempValue != 0x7D00)
-				break;
-		}
-
-		if (temp < tempValue) {
-			if (lastUsedEntry + temp > moveTableSize) {
-				delete[] pathTable1;
-				delete[] pathTable2;
-				return 0x7D00;
-			}
-			memcpy(&moveTable[lastUsedEntry], pathTable1, temp*sizeof(int));
-			lastUsedEntry += temp;
-		} else {
-			if (lastUsedEntry + tempValue > moveTableSize) {
-				delete[] pathTable1;
-				delete[] pathTable2;
-				return 0x7D00;
-			}
-			memcpy(&moveTable[lastUsedEntry], pathTable2, tempValue*sizeof(int));
-			lastUsedEntry += tempValue;
-		}
-		x = curX;
-		y = curY;
-		if (curX == toX && curY == toY)
-			break;
-	}
-
-	delete[] pathTable1;
-	delete[] pathTable2;
-	moveTable[lastUsedEntry] = 8;
-	return lastUsedEntry;
-}
-
-int KyraEngine::findSubPath(int x, int y, int toX, int toY, int *moveTable, int start, int end) {
-	debugC(9, kDebugLevelMain, "KyraEngine::findSubPath(%d, %d, %d, %d, %p, %d, %d)", x, y, toX, toY, (const void *)moveTable, start, end);
-	// only used for debug specific code
-	//static uint16 unkTable[] = { 8, 5 };
-	static const int8 facingTable1[] = {  7,  0,  1,  2,  3,  4,  5,  6,  1,  2,  3,  4,  5,  6,  7,  0 };
-	static const int8 facingTable2[] = { -1,  0, -1,  2, -1,  4, -1,  6, -1,  2, -1,  4, -1,  6, -1,  0 };
-	static const int8 facingTable3[] = {  2,  4,  4,  6,  6,  0,  0,  2,  6,  6,  0,  0,  2,  2,  4,  4 };
-	static const int8 addPosTableX[] = { -1,  0, -1,  4, -1,  0, -1, -4, -1, -4, -1,  0, -1,  4, -1,  0 };
-	static const int8 addPosTableY[] = { -1,  2, -1,  0, -1, -2, -1,  0, -1,  0, -1,  2, -1,  0, -1, -2 };
-
-	// debug specific
-	/*++unkTable[start];
-	while (screen()->getPalette(0)[unkTable[start]] != 0x0F) {
-		++unkTable[start];
-	}*/
-
-	int xpos1 = x, xpos2 = x;
-	int ypos1 = y, ypos2 = y;
-	int newFacing = getFacingFromPointToPoint(x, y, toX, toY);
-	int position = 0;
-
-	while (position != end) {
-		int newFacing2 = newFacing;
-		while (true) {
-			changePosTowardsFacing(xpos1, ypos1, facingTable1[start*8 + newFacing2]);
-			if (!lineIsPassable(xpos1, ypos1)) {
-				if (facingTable1[start*8 + newFacing2] == newFacing)
-					return 0x7D00;
-				newFacing2 = facingTable1[start*8 + newFacing2];
-				xpos1 = x;
-				ypos1 = y;
-				continue;
-			}
-			newFacing = facingTable1[start*8 + newFacing2];
-			break;
-		}
-		// debug drawing
-		/*if (xpos1 >= 0 && ypos1 >= 0 && xpos1 < 320 && ypos1 < 200) {
-			screen()->setPagePixel(0, xpos1, ypos1, unkTable[start]);
-			screen()->updateScreen();
-			delayWithTicks(5);
-		}*/
-		if (newFacing & 1) {
-			int temp = xpos1 + addPosTableX[newFacing + start * 8];
-			if (toX == temp) {
-				temp = ypos1 + addPosTableY[newFacing + start * 8];
-				if (toY == temp) {
-					moveTable[position++] = facingTable2[newFacing + start * 8];
-					return position;
-				}
-			}
-		}
-
-		moveTable[position++] = newFacing;
-		x = xpos1;
-		y = ypos1;
-
-		if (x == toX && y == toY)
-			return position;
-
-		if (xpos1 == xpos2 && ypos1 == ypos2)
-			break;
-
-		newFacing = facingTable3[start*8 + newFacing];
-	}
-
-	return 0x7D00;
-}
-
-int KyraEngine::getFacingFromPointToPoint(int x, int y, int toX, int toY) {
-	debugC(9, kDebugLevelMain, "KyraEngine::getFacingFromPointToPoint(%d, %d, %d, %d)", x, y, toX, toY);
-	static const int facingTable[] = {
-		1, 0, 1, 2, 3, 4, 3, 2, 7, 0, 7, 6, 5, 4, 5, 6
-	};
-
-	int facingEntry = 0;
-	int ydiff = y - toY;
-	if (ydiff < 0) {
-		++facingEntry;
-		ydiff = -ydiff;
-	}
-	facingEntry <<= 1;
-
-	int xdiff = toX - x;
-	if (xdiff < 0) {
-		++facingEntry;
-		xdiff = -xdiff;
-	}
-
-	if (xdiff >= ydiff) {
-		int temp = ydiff;
-		ydiff = xdiff;
-		xdiff = temp;
-
-		facingEntry <<= 1;
-	} else {
-		facingEntry <<= 1;
-		facingEntry += 1;
-	}
-	int temp = (ydiff + 1) >> 1;
-
-	if (xdiff < temp) {
-		facingEntry <<= 1;
-		facingEntry += 1;
-	} else {
-		facingEntry <<= 1;
-	}
-
-	assert(facingEntry < ARRAYSIZE(facingTable));
-	return facingTable[facingEntry];
-}
-
-
-int KyraEngine::getOppositeFacingDirection(int dir) {
-	debugC(9, kDebugLevelMain, "KyraEngine::getOppositeFacingDirection(%d)", dir);
-	switch (dir) {
-	case 0:
-		return 2;
-	case 1:
-		return 1;
-	case 3:
-		return 7;
-	case 4:
-		return 6;
-	case 5:
-		return 5;
-	case 6:
-		return 4;
-	case 7:
-		return 3;
-	default:
-		break;
-	}
-	return 0;
-}
-
-void KyraEngine::changePosTowardsFacing(int &x, int &y, int facing) {
-	debugC(9, kDebugLevelMain, "KyraEngine::changePosTowardsFacing(%d, %d, %d)", x, y, facing);
-	x += _addXPosTable[facing];
-	y += _addYPosTable[facing];
-}
-
-int KyraEngine::getMoveTableSize(int *moveTable) {
-	debugC(9, kDebugLevelMain, "KyraEngine::getMoveTableSize(%p)", (const void *)moveTable);
-	int retValue = 0;
-	if (moveTable[0] == 8)
-		return 0;
-
-	static const int facingTable[] = {
-		4, 5, 6, 7, 0, 1, 2, 3
-	};
-	static const int unkTable[] = {
-		-1, -1,  1,  2, -1,  6,  7, -1,
-		-1, -1, -1, -1,  2, -1,  0, -1,
-		 1, -1, -1, -1,  3,  4, -1,  0,
-		 2, -1, -1, -1, -1, -1,  4, -1,
-		-1,  2,  3, -1, -1, -1,  5,  6,
-		 6, -1,  4, -1, -1, -1, -1, -1,
-		 7,  0, -1,  4,  5, -1, -1, -1,
-		-1, -1,  0, -1,  6, -1, -1, -1
-	};
-
-	int *oldPosition = moveTable;
-	int *tempPosition = moveTable;
-	int *curPosition = moveTable + 1;
-	retValue = 1;
-
-	while (*curPosition != 8) {
-		if (*oldPosition == facingTable[*curPosition]) {
-			retValue -= 2;
-			*oldPosition = 9;
-			*curPosition = 9;
-
-			while (tempPosition != moveTable) {
-				--tempPosition;
-				if (*tempPosition != 9)
-					break;
-			}
-
-			if (tempPosition == moveTable && *tempPosition == 9) {
-				while (*tempPosition != 8 && *tempPosition == 9)
-					++tempPosition;
-
-				if (*tempPosition == 8)
-					return 0;
-			}
-
-			oldPosition = tempPosition;
-			curPosition = oldPosition+1;
-
-			while (*curPosition != 8 && *curPosition == 9)
-				++curPosition;
-
-			continue;
-		}
-
-		if (unkTable[*curPosition+((*oldPosition)*8)] != -1) {
-			--retValue;
-			*oldPosition = unkTable[*curPosition+((*oldPosition)*8)];
-			*curPosition = 9;
-
-			if (tempPosition != oldPosition) {
-				curPosition = oldPosition;
-				oldPosition = tempPosition;
-				while (true) {
-					if (tempPosition == moveTable)
-						break;
-
-					--tempPosition;
-					if (*tempPosition != 9)
-						break;
-
-				}
-			} else {
-				while (true) {
-					++curPosition;
-					if (*curPosition != 9)
-						break;
-				}
-			}
-			continue;
-		}
-
-		tempPosition = oldPosition;
-		oldPosition = curPosition;
-		++retValue;
-
-		while (true) {
-			++curPosition;
-			if (*curPosition != 9)
-				break;
-		}
-	}
-
-	return retValue;
-}
-
-} // end of namespace Kyra

Modified: scummvm/trunk/engines/kyra/scene_lok.cpp
===================================================================
--- scummvm/trunk/engines/kyra/scene_lok.cpp	2008-05-11 22:45:12 UTC (rev 32043)
+++ scummvm/trunk/engines/kyra/scene_lok.cpp	2008-05-11 23:16:50 UTC (rev 32044)
@@ -1166,7 +1166,7 @@
 
 int KyraEngine_LoK::findWay(int x, int y, int toX, int toY, int *moveTable, int moveTableSize) {
 	debugC(9, kDebugLevelMain, "KyraEngine_LoK::findWay(%d, %d, %d, %d, %p, %d)", x, y, toX, toY, (const void *)moveTable, moveTableSize);
-	int ret = KyraEngine::findWay(x, y, toX, toY, moveTable, moveTableSize);
+	int ret = KyraEngine_v1::findWay(x, y, toX, toY, moveTable, moveTableSize);
 	if (ret == 0x7D00)
 		return 0;
 	return getMoveTableSize(moveTable);

Copied: scummvm/trunk/engines/kyra/scene_v1.cpp (from rev 32043, scummvm/trunk/engines/kyra/scene.cpp)
===================================================================
--- scummvm/trunk/engines/kyra/scene_v1.cpp	                        (rev 0)
+++ scummvm/trunk/engines/kyra/scene_v1.cpp	2008-05-11 23:16:50 UTC (rev 32044)
@@ -0,0 +1,383 @@
+/* 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$
+ *
+ */
+
+#include "kyra/kyra_v1.h"
+#include "kyra/screen.h"
+
+namespace Kyra {
+
+int KyraEngine_v1::findWay(int x, int y, int toX, int toY, int *moveTable, int moveTableSize) {
+	debugC(9, kDebugLevelMain, "KyraEngine_v1::findWay(%d, %d, %d, %d, %p, %d)", x, y, toX, toY, (const void *)moveTable, moveTableSize);
+	x &= 0xFFFC; toX &= 0xFFFC;
+	y &= 0xFFFE; toY &= 0xFFFE;
+	x = (int16)x; y = (int16)y; toX = (int16)toX; toY = (int16)toY;
+
+	if (x == toY && y == toY) {
+		moveTable[0] = 8;
+		return 0;
+	}
+
+	int curX = x;
+	int curY = y;
+	int tempValue = 0;
+	int lastUsedEntry = 0;
+	int *pathTable1 = new int[0x7D0];
+	int *pathTable2 = new int[0x7D0];
+	assert(pathTable1 && pathTable2);
+
+	while (true) {
+		int newFacing = getFacingFromPointToPoint(x, y, toX, toY);
+		changePosTowardsFacing(curX, curY, newFacing);
+
+		if (curX == toX && curY == toY) {
+			if (!lineIsPassable(curX, curY))
+				break;
+			moveTable[lastUsedEntry++] = newFacing;
+			break;
+		}
+
+		if (lineIsPassable(curX, curY)) {
+			if (lastUsedEntry == moveTableSize) {
+				delete[] pathTable1;
+				delete[] pathTable2;
+				return 0x7D00;
+			}
+			// debug drawing
+			/*if (curX >= 0 && curY >= 0 && curX < 320 && curY < 200) {
+				screen()->setPagePixel(0, curX, curY, 11);
+				screen()->updateScreen();
+				delayWithTicks(5);
+			}*/
+			moveTable[lastUsedEntry++] = newFacing;
+			x = curX;
+			y = curY;
+			continue;
+		}
+
+		int temp = 0;
+		while (true) {
+			newFacing = getFacingFromPointToPoint(curX, curY, toX, toY);
+			changePosTowardsFacing(curX, curY, newFacing);
+			// debug drawing
+			/*if (curX >= 0 && curY >= 0 && curX < 320 && curY < 200) {
+				screen()->setPagePixel(0, curX, curY, 8);
+				screen()->updateScreen();
+				delayWithTicks(5);
+			}*/
+
+			if (!lineIsPassable(curX, curY)) {
+				if (curX != toX || curY != toY)
+					continue;
+			}
+
+			if (curX == toX && curY == toY) {
+				if (!lineIsPassable(curX, curY)) {
+					tempValue = 0;
+					temp = 0;
+					break;
+				}
+			}
+
+			temp = findSubPath(x, y, curX, curY, pathTable1, 1, 0x7D0);
+			tempValue = findSubPath(x, y, curX, curY, pathTable2, 0, 0x7D0);
+			if (curX == toX && curY == toY) {
+				if (temp == 0x7D00 && tempValue == 0x7D00) {
+					delete[] pathTable1;
+					delete[] pathTable2;
+					return 0x7D00;
+				}
+			}
+
+			if (temp != 0x7D00 || tempValue != 0x7D00)
+				break;
+		}
+
+		if (temp < tempValue) {
+			if (lastUsedEntry + temp > moveTableSize) {
+				delete[] pathTable1;
+				delete[] pathTable2;
+				return 0x7D00;
+			}
+			memcpy(&moveTable[lastUsedEntry], pathTable1, temp*sizeof(int));
+			lastUsedEntry += temp;
+		} else {
+			if (lastUsedEntry + tempValue > moveTableSize) {
+				delete[] pathTable1;
+				delete[] pathTable2;
+				return 0x7D00;
+			}
+			memcpy(&moveTable[lastUsedEntry], pathTable2, tempValue*sizeof(int));
+			lastUsedEntry += tempValue;
+		}
+		x = curX;
+		y = curY;
+		if (curX == toX && curY == toY)
+			break;
+	}
+
+	delete[] pathTable1;
+	delete[] pathTable2;
+	moveTable[lastUsedEntry] = 8;
+	return lastUsedEntry;
+}
+
+int KyraEngine_v1::findSubPath(int x, int y, int toX, int toY, int *moveTable, int start, int end) {
+	debugC(9, kDebugLevelMain, "KyraEngine_v1::findSubPath(%d, %d, %d, %d, %p, %d, %d)", x, y, toX, toY, (const void *)moveTable, start, end);
+	// only used for debug specific code
+	//static uint16 unkTable[] = { 8, 5 };
+	static const int8 facingTable1[] = {  7,  0,  1,  2,  3,  4,  5,  6,  1,  2,  3,  4,  5,  6,  7,  0 };
+	static const int8 facingTable2[] = { -1,  0, -1,  2, -1,  4, -1,  6, -1,  2, -1,  4, -1,  6, -1,  0 };
+	static const int8 facingTable3[] = {  2,  4,  4,  6,  6,  0,  0,  2,  6,  6,  0,  0,  2,  2,  4,  4 };
+	static const int8 addPosTableX[] = { -1,  0, -1,  4, -1,  0, -1, -4, -1, -4, -1,  0, -1,  4, -1,  0 };
+	static const int8 addPosTableY[] = { -1,  2, -1,  0, -1, -2, -1,  0, -1,  0, -1,  2, -1,  0, -1, -2 };
+
+	// debug specific
+	/*++unkTable[start];
+	while (screen()->getPalette(0)[unkTable[start]] != 0x0F) {
+		++unkTable[start];
+	}*/
+
+	int xpos1 = x, xpos2 = x;
+	int ypos1 = y, ypos2 = y;
+	int newFacing = getFacingFromPointToPoint(x, y, toX, toY);
+	int position = 0;
+
+	while (position != end) {
+		int newFacing2 = newFacing;
+		while (true) {
+			changePosTowardsFacing(xpos1, ypos1, facingTable1[start*8 + newFacing2]);
+			if (!lineIsPassable(xpos1, ypos1)) {
+				if (facingTable1[start*8 + newFacing2] == newFacing)
+					return 0x7D00;
+				newFacing2 = facingTable1[start*8 + newFacing2];
+				xpos1 = x;
+				ypos1 = y;
+				continue;
+			}
+			newFacing = facingTable1[start*8 + newFacing2];
+			break;
+		}
+		// debug drawing
+		/*if (xpos1 >= 0 && ypos1 >= 0 && xpos1 < 320 && ypos1 < 200) {
+			screen()->setPagePixel(0, xpos1, ypos1, unkTable[start]);
+			screen()->updateScreen();
+			delayWithTicks(5);
+		}*/
+		if (newFacing & 1) {
+			int temp = xpos1 + addPosTableX[newFacing + start * 8];
+			if (toX == temp) {
+				temp = ypos1 + addPosTableY[newFacing + start * 8];
+				if (toY == temp) {
+					moveTable[position++] = facingTable2[newFacing + start * 8];
+					return position;
+				}
+			}
+		}
+
+		moveTable[position++] = newFacing;
+		x = xpos1;
+		y = ypos1;
+
+		if (x == toX && y == toY)
+			return position;
+
+		if (xpos1 == xpos2 && ypos1 == ypos2)
+			break;
+
+		newFacing = facingTable3[start*8 + newFacing];
+	}
+
+	return 0x7D00;
+}
+
+int KyraEngine_v1::getFacingFromPointToPoint(int x, int y, int toX, int toY) {
+	debugC(9, kDebugLevelMain, "KyraEngine_v1::getFacingFromPointToPoint(%d, %d, %d, %d)", x, y, toX, toY);
+	static const int facingTable[] = {
+		1, 0, 1, 2, 3, 4, 3, 2, 7, 0, 7, 6, 5, 4, 5, 6
+	};
+
+	int facingEntry = 0;
+	int ydiff = y - toY;
+	if (ydiff < 0) {
+		++facingEntry;
+		ydiff = -ydiff;
+	}
+	facingEntry <<= 1;
+
+	int xdiff = toX - x;
+	if (xdiff < 0) {
+		++facingEntry;
+		xdiff = -xdiff;
+	}
+
+	if (xdiff >= ydiff) {
+		int temp = ydiff;
+		ydiff = xdiff;
+		xdiff = temp;
+
+		facingEntry <<= 1;
+	} else {
+		facingEntry <<= 1;
+		facingEntry += 1;
+	}
+	int temp = (ydiff + 1) >> 1;
+
+	if (xdiff < temp) {
+		facingEntry <<= 1;
+		facingEntry += 1;
+	} else {
+		facingEntry <<= 1;
+	}
+
+	assert(facingEntry < ARRAYSIZE(facingTable));
+	return facingTable[facingEntry];
+}
+
+
+int KyraEngine_v1::getOppositeFacingDirection(int dir) {
+	debugC(9, kDebugLevelMain, "KyraEngine_v1::getOppositeFacingDirection(%d)", dir);
+	switch (dir) {
+	case 0:
+		return 2;
+	case 1:
+		return 1;
+	case 3:
+		return 7;
+	case 4:
+		return 6;
+	case 5:
+		return 5;
+	case 6:
+		return 4;
+	case 7:
+		return 3;
+	default:
+		break;
+	}
+	return 0;
+}
+
+void KyraEngine_v1::changePosTowardsFacing(int &x, int &y, int facing) {
+	debugC(9, kDebugLevelMain, "KyraEngine_v1::changePosTowardsFacing(%d, %d, %d)", x, y, facing);
+	x += _addXPosTable[facing];
+	y += _addYPosTable[facing];
+}
+
+int KyraEngine_v1::getMoveTableSize(int *moveTable) {
+	debugC(9, kDebugLevelMain, "KyraEngine_v1::getMoveTableSize(%p)", (const void *)moveTable);
+	int retValue = 0;
+	if (moveTable[0] == 8)
+		return 0;
+
+	static const int facingTable[] = {
+		4, 5, 6, 7, 0, 1, 2, 3
+	};
+	static const int unkTable[] = {
+		-1, -1,  1,  2, -1,  6,  7, -1,
+		-1, -1, -1, -1,  2, -1,  0, -1,
+		 1, -1, -1, -1,  3,  4, -1,  0,
+		 2, -1, -1, -1, -1, -1,  4, -1,
+		-1,  2,  3, -1, -1, -1,  5,  6,
+		 6, -1,  4, -1, -1, -1, -1, -1,
+		 7,  0, -1,  4,  5, -1, -1, -1,
+		-1, -1,  0, -1,  6, -1, -1, -1
+	};
+
+	int *oldPosition = moveTable;
+	int *tempPosition = moveTable;
+	int *curPosition = moveTable + 1;
+	retValue = 1;
+
+	while (*curPosition != 8) {
+		if (*oldPosition == facingTable[*curPosition]) {
+			retValue -= 2;
+			*oldPosition = 9;
+			*curPosition = 9;
+
+			while (tempPosition != moveTable) {
+				--tempPosition;
+				if (*tempPosition != 9)
+					break;
+			}
+
+			if (tempPosition == moveTable && *tempPosition == 9) {
+				while (*tempPosition != 8 && *tempPosition == 9)
+					++tempPosition;
+
+				if (*tempPosition == 8)
+					return 0;
+			}
+
+			oldPosition = tempPosition;
+			curPosition = oldPosition+1;
+
+			while (*curPosition != 8 && *curPosition == 9)
+				++curPosition;
+
+			continue;
+		}
+
+		if (unkTable[*curPosition+((*oldPosition)*8)] != -1) {
+			--retValue;
+			*oldPosition = unkTable[*curPosition+((*oldPosition)*8)];
+			*curPosition = 9;
+
+			if (tempPosition != oldPosition) {
+				curPosition = oldPosition;
+				oldPosition = tempPosition;
+				while (true) {
+					if (tempPosition == moveTable)
+						break;
+
+					--tempPosition;
+					if (*tempPosition != 9)
+						break;
+
+				}
+			} else {
+				while (true) {
+					++curPosition;
+					if (*curPosition != 9)
+						break;
+				}
+			}
+			continue;
+		}
+
+		tempPosition = oldPosition;
+		oldPosition = curPosition;
+		++retValue;
+
+		while (true) {
+			++curPosition;
+			if (*curPosition != 9)
+				break;
+		}
+	}
+
+	return retValue;
+}
+
+} // end of namespace Kyra

Modified: scummvm/trunk/engines/kyra/scene_v2.cpp
===================================================================
--- scummvm/trunk/engines/kyra/scene_v2.cpp	2008-05-11 22:45:12 UTC (rev 32043)
+++ scummvm/trunk/engines/kyra/scene_v2.cpp	2008-05-11 23:16:50 UTC (rev 32044)
@@ -90,7 +90,7 @@
 	debugC(9, kDebugLevelMain, "KyraEngine_v2::findWay(%d, %d, %d, %d, %p, %d)", x, y, toX, toY, (const void *)moveTable, moveTableSize);
 	x &= ~3; toX &= ~3;
 	y &= ~1; toY &= ~1;
-	int size = KyraEngine::findWay(x, y, toX, toY, moveTable, moveTableSize);
+	int size = KyraEngine_v1::findWay(x, y, toX, toY, moveTable, moveTableSize);
 	static bool usePostProcess = false;
 	if (size && !usePostProcess) {
 		usePostProcess = true;

Modified: scummvm/trunk/engines/kyra/screen.cpp
===================================================================
--- scummvm/trunk/engines/kyra/screen.cpp	2008-05-11 22:45:12 UTC (rev 32043)
+++ scummvm/trunk/engines/kyra/screen.cpp	2008-05-11 23:16:50 UTC (rev 32044)
@@ -28,12 +28,12 @@
 #include "common/system.h"
 #include "graphics/cursorman.h"
 #include "kyra/screen.h"
-#include "kyra/kyra.h"
+#include "kyra/kyra_v1.h"
 #include "kyra/resource.h"
 
 namespace Kyra {
 
-Screen::Screen(KyraEngine *vm, OSystem *system)
+Screen::Screen(KyraEngine_v1 *vm, OSystem *system)
 	: _system(system), _vm(vm), _sjisInvisibleColor(0) {
 	_debugEnabled = false;
 }
@@ -2644,7 +2644,7 @@
 }
 
 void Screen::loadBitmap(const char *filename, int tempPage, int dstPage, uint8 *palData, bool skip) {
-	debugC(9, kDebugLevelScreen, "KyraEngine::loadBitmap('%s', %d, %d, %p, %d)", filename, tempPage, dstPage, (void *)palData, skip);
+	debugC(9, kDebugLevelScreen, "KyraEngine_v1::loadBitmap('%s', %d, %d, %p, %d)", filename, tempPage, dstPage, (void *)palData, skip);
 	uint32 fileSize;
 	uint8 *srcData = _vm->resource()->fileData(filename, &fileSize);
 

Modified: scummvm/trunk/engines/kyra/screen.h
===================================================================
--- scummvm/trunk/engines/kyra/screen.h	2008-05-11 22:45:12 UTC (rev 32043)
+++ scummvm/trunk/engines/kyra/screen.h	2008-05-11 23:16:50 UTC (rev 32044)
@@ -35,7 +35,7 @@
 
 typedef Common::Functor0<void> UpdateFunctor;
 
-class KyraEngine;
+class KyraEngine_v1;
 
 struct Rect {
 	int x, y;
@@ -96,7 +96,7 @@
 		FID_NUM
 	};
 
-	Screen(KyraEngine *vm, OSystem *system);
+	Screen(KyraEngine_v1 *vm, OSystem *system);
 	virtual ~Screen();
 
 	// init
@@ -301,7 +301,7 @@
 	void addDirtyRect(int x, int y, int w, int h);
 
 	OSystem *_system;
-	KyraEngine *_vm;
+	KyraEngine_v1 *_vm;
 
 	// shape
 	int drawShapeMarginNoScaleUpwind(uint8 *&dst, const uint8 *&src, int &cnt);

Modified: scummvm/trunk/engines/kyra/screen_v2.cpp
===================================================================
--- scummvm/trunk/engines/kyra/screen_v2.cpp	2008-05-11 22:45:12 UTC (rev 32043)
+++ scummvm/trunk/engines/kyra/screen_v2.cpp	2008-05-11 23:16:50 UTC (rev 32044)
@@ -29,7 +29,7 @@
 
 namespace Kyra {
 
-Screen_v2::Screen_v2(KyraEngine *vm, OSystem *system) : Screen(vm, system), _wsaFrameAnimBuffer(0) {
+Screen_v2::Screen_v2(KyraEngine_v1 *vm, OSystem *system) : Screen(vm, system), _wsaFrameAnimBuffer(0) {
 	_wsaFrameAnimBuffer = new uint8[1024];
 	assert(_wsaFrameAnimBuffer);
 }

Modified: scummvm/trunk/engines/kyra/screen_v2.h
===================================================================
--- scummvm/trunk/engines/kyra/screen_v2.h	2008-05-11 22:45:12 UTC (rev 32043)
+++ scummvm/trunk/engines/kyra/screen_v2.h	2008-05-11 23:16:50 UTC (rev 32044)
@@ -33,7 +33,7 @@
 
 class Screen_v2 : public Screen {
 public:
-	Screen_v2(KyraEngine *vm, OSystem *system);
+	Screen_v2(KyraEngine_v1 *vm, OSystem *system);
 	~Screen_v2();
 
 	// screen page handling

Modified: scummvm/trunk/engines/kyra/script.cpp
===================================================================
--- scummvm/trunk/engines/kyra/script.cpp	2008-05-11 22:45:12 UTC (rev 32043)
+++ scummvm/trunk/engines/kyra/script.cpp	2008-05-11 23:16:50 UTC (rev 32044)
@@ -28,12 +28,12 @@
 #include "common/stream.h"
 #include "common/util.h"
 #include "common/system.h"
-#include "kyra/kyra.h"
+#include "kyra/kyra_v1.h"
 #include "kyra/resource.h"
 #include "kyra/script.h"
 
 namespace Kyra {
-EMCInterpreter::EMCInterpreter(KyraEngine *vm) : _vm(vm) {
+EMCInterpreter::EMCInterpreter(KyraEngine_v1 *vm) : _vm(vm) {
 #define COMMAND(x) { &EMCInterpreter::x, #x }
 	static CommandEntry commandProcs[] = {
 		// 0x00

Modified: scummvm/trunk/engines/kyra/script.h
===================================================================
--- scummvm/trunk/engines/kyra/script.h	2008-05-11 22:45:12 UTC (rev 32043)
+++ scummvm/trunk/engines/kyra/script.h	2008-05-11 23:16:50 UTC (rev 32044)
@@ -27,6 +27,7 @@
 #define KYRA_SCRIPT_H
 
 #include "common/stream.h"
+#include "common/array.h"
 #include "common/func.h"
 
 namespace Kyra {
@@ -63,7 +64,7 @@
 #define AVTL_CHUNK 0x4C545641
 
 class Resource;
-class KyraEngine;
+class KyraEngine_v1;
 
 class ScriptFileParser {
 public:
@@ -89,7 +90,7 @@
 
 class EMCInterpreter {
 public:
-	EMCInterpreter(KyraEngine *vm);
+	EMCInterpreter(KyraEngine_v1 *vm);
 
 	bool load(const char *filename, EMCData *data, const Common::Array<const Opcode*> *opcodes);
 	void unload(EMCData *data);
@@ -101,7 +102,7 @@
 
 	bool run(EMCState *script);
 protected:
-	KyraEngine *_vm;
+	KyraEngine_v1 *_vm;
 	int16 _parameter;
 
 	typedef void (EMCInterpreter::*CommandProc)(EMCState*);

Modified: scummvm/trunk/engines/kyra/script_tim.cpp
===================================================================
--- scummvm/trunk/engines/kyra/script_tim.cpp	2008-05-11 22:45:12 UTC (rev 32043)
+++ scummvm/trunk/engines/kyra/script_tim.cpp	2008-05-11 23:16:50 UTC (rev 32044)
@@ -31,7 +31,7 @@
 
 namespace Kyra {
 
-TIMInterpreter::TIMInterpreter(KyraEngine *vm, OSystem *system) : _vm(vm), _system(system), _currentTim(0) {
+TIMInterpreter::TIMInterpreter(KyraEngine_v1 *vm, OSystem *system) : _vm(vm), _system(system), _currentTim(0) {
 #define COMMAND(x) { &TIMInterpreter::x, #x }
 #define COMMAND_UNIMPL() { 0, 0 }
 	static CommandEntry commandProcs[] = {

Modified: scummvm/trunk/engines/kyra/script_tim.h
===================================================================
--- scummvm/trunk/engines/kyra/script_tim.h	2008-05-11 22:45:12 UTC (rev 32043)
+++ scummvm/trunk/engines/kyra/script_tim.h	2008-05-11 23:16:50 UTC (rev 32044)
@@ -26,7 +26,7 @@
 #ifndef KYRA_SCRIPT_TIM_H
 #define KYRA_SCRIPT_TIM_H
 
-#include "kyra/kyra.h"
+#include "kyra/kyra_v1.h"
 
 #include "common/array.h"
 #include "common/func.h"
@@ -57,7 +57,7 @@
 
 class TIMInterpreter {
 public:
-	TIMInterpreter(KyraEngine *vm, OSystem *system);
+	TIMInterpreter(KyraEngine_v1 *vm, OSystem *system);
 
 	TIM *load(const char *filename, const Common::Array<const TIMOpcode*> *opcodes);
 	void unload(TIM *&tim) const;
@@ -70,7 +70,7 @@
 
 	void play(const char *filename);
 private:
-	KyraEngine *_vm;
+	KyraEngine_v1 *_vm;
 	OSystem *_system;
 
 	TIM *_currentTim;

Modified: scummvm/trunk/engines/kyra/sequences_hof.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sequences_hof.cpp	2008-05-11 22:45:12 UTC (rev 32043)
+++ scummvm/trunk/engines/kyra/sequences_hof.cpp	2008-05-11 23:16:50 UTC (rev 32044)
@@ -23,7 +23,7 @@
  *
  */
 
-#include "kyra/kyra.h"
+#include "kyra/kyra_v1.h"
 #include "kyra/kyra_hof.h"
 #include "kyra/screen.h"
 #include "kyra/wsamovie.h"

Modified: scummvm/trunk/engines/kyra/sound.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sound.cpp	2008-05-11 22:45:12 UTC (rev 32043)
+++ scummvm/trunk/engines/kyra/sound.cpp	2008-05-11 23:16:50 UTC (rev 32044)
@@ -40,7 +40,7 @@
 
 namespace Kyra {
 
-Sound::Sound(KyraEngine *vm, Audio::Mixer *mixer)
+Sound::Sound(KyraEngine_v1 *vm, Audio::Mixer *mixer)
 	: _vm(vm), _mixer(mixer), _soundChannels(), _musicEnabled(1),
 	_sfxEnabled(true), _soundDataList(0) {
 }
@@ -145,7 +145,7 @@
 
 #pragma mark -
 
-SoundMidiPC::SoundMidiPC(KyraEngine *vm, Audio::Mixer *mixer, MidiDriver *driver) : Sound(vm, mixer) {
+SoundMidiPC::SoundMidiPC(KyraEngine_v1 *vm, Audio::Mixer *mixer, MidiDriver *driver) : Sound(vm, mixer) {
 	_driver = driver;
 	_passThrough = false;
 
@@ -467,8 +467,8 @@
 
 #pragma mark -
 
-void KyraEngine::snd_playTheme(int file, int track) {
-	debugC(9, kDebugLevelMain | kDebugLevelSound, "KyraEngine::snd_playTheme(%d, %d)", file, track);
+void KyraEngine_v1::snd_playTheme(int file, int track) {
+	debugC(9, kDebugLevelMain | kDebugLevelSound, "KyraEngine_v1::snd_playTheme(%d, %d)", file, track);
 	if (_curMusicTheme == file)
 		return;
 
@@ -478,13 +478,13 @@
 		_sound->playTrack(track);
 }
 
-void KyraEngine::snd_playSoundEffect(int track, int volume) {
-	debugC(9, kDebugLevelMain | kDebugLevelSound, "KyraEngine::snd_playSoundEffect(%d, %d)", track, volume);
+void KyraEngine_v1::snd_playSoundEffect(int track, int volume) {
+	debugC(9, kDebugLevelMain | kDebugLevelSound, "KyraEngine_v1::snd_playSoundEffect(%d, %d)", track, volume);
 	_sound->playSoundEffect(track);
 }
 
-void KyraEngine::snd_playWanderScoreViaMap(int command, int restart) {
-	debugC(9, kDebugLevelMain | kDebugLevelSound, "KyraEngine::snd_playWanderScoreViaMap(%d, %d)", command, restart);
+void KyraEngine_v1::snd_playWanderScoreViaMap(int command, int restart) {
+	debugC(9, kDebugLevelMain | kDebugLevelSound, "KyraEngine_v1::snd_playWanderScoreViaMap(%d, %d)", command, restart);
 	if (restart)
 		_lastMusicCommand = -1;
 
@@ -527,13 +527,13 @@
 	_lastMusicCommand = command;
 }
 
-void KyraEngine::snd_stopVoice() {
-	debugC(9, kDebugLevelMain | kDebugLevelSound, "KyraEngine::snd_stopVoice()");
+void KyraEngine_v1::snd_stopVoice() {
+	debugC(9, kDebugLevelMain | kDebugLevelSound, "KyraEngine_v1::snd_stopVoice()");
 	_sound->voiceStop(_speechFile.empty() ? 0 : _speechFile.c_str());
 }
 
-bool KyraEngine::snd_voiceIsPlaying() {
-	debugC(9, kDebugLevelMain | kDebugLevelSound, "KyraEngine::snd_voiceIsPlaying()");
+bool KyraEngine_v1::snd_voiceIsPlaying() {
+	debugC(9, kDebugLevelMain | kDebugLevelSound, "KyraEngine_v1::snd_voiceIsPlaying()");
 	return _sound->voiceIsPlaying(_speechFile.empty() ? 0 : _speechFile.c_str());
 }
 

Modified: scummvm/trunk/engines/kyra/sound.h
===================================================================
--- scummvm/trunk/engines/kyra/sound.h	2008-05-11 22:45:12 UTC (rev 32043)
+++ scummvm/trunk/engines/kyra/sound.h	2008-05-11 23:16:50 UTC (rev 32044)
@@ -42,7 +42,7 @@
 #ifndef KYRA_SOUND_H
 #define KYRA_SOUND_H
 
-#include "kyra/kyra.h"
+#include "kyra/kyra_v1.h"
 
 #include "common/scummsys.h"
 #include "common/file.h"
@@ -66,7 +66,7 @@
  */
 class Sound {
 public:
-	Sound(KyraEngine *vm, Audio::Mixer *mixer);
+	Sound(KyraEngine_v1 *vm, Audio::Mixer *mixer);
 	virtual ~Sound();
 
 	enum kType {
@@ -209,7 +209,7 @@
 
 	int _currentTheme;
 
-	KyraEngine *_vm;
+	KyraEngine_v1 *_vm;
 	Audio::Mixer *_mixer;
 
 private:
@@ -243,7 +243,7 @@
  */
 class SoundAdlibPC : public Sound {
 public:
-	SoundAdlibPC(KyraEngine *vm, Audio::Mixer *mixer);
+	SoundAdlibPC(KyraEngine_v1 *vm, Audio::Mixer *mixer);
 	~SoundAdlibPC();
 
 	kType getMusicType() const { return kAdlib; }
@@ -298,7 +298,7 @@
  */
 class SoundMidiPC : public MidiDriver, public Sound {
 public:
-	SoundMidiPC(KyraEngine *vm, Audio::Mixer *mixer, MidiDriver *driver);
+	SoundMidiPC(KyraEngine_v1 *vm, Audio::Mixer *mixer, MidiDriver *driver);
 	~SoundMidiPC();
 
 	kType getMusicType() const { return isMT32() ? kMidiMT32 : kMidiGM; }
@@ -378,7 +378,7 @@
 class SoundTowns_EuphonyDriver;
 class SoundTowns : public MidiDriver, public Sound {
 public:
-	SoundTowns(KyraEngine *vm, Audio::Mixer *mixer);
+	SoundTowns(KyraEngine_v1 *vm, Audio::Mixer *mixer);
 	~SoundTowns();
 
 	kType getMusicType() const { return kTowns; }
@@ -435,7 +435,7 @@
 //class SoundTowns_v2_TwnDriver;
 class SoundTowns_v2 : public Sound {
 public:
-	SoundTowns_v2(KyraEngine *vm, Audio::Mixer *mixer);
+	SoundTowns_v2(KyraEngine_v1 *vm, Audio::Mixer *mixer);
 	~SoundTowns_v2();
 
 	kType getMusicType() const { return kTowns; }
@@ -463,7 +463,7 @@
 
 class MixedSoundDriver : public Sound {
 public:
-	MixedSoundDriver(KyraEngine *vm, Audio::Mixer *mixer, Sound *music, Sound *sfx) : Sound(vm, mixer), _music(music), _sfx(sfx) {}
+	MixedSoundDriver(KyraEngine_v1 *vm, Audio::Mixer *mixer, Sound *music, Sound *sfx) : Sound(vm, mixer), _music(music), _sfx(sfx) {}
 	~MixedSoundDriver() { delete _music; delete _sfx; }
 
 	kType getMusicType() const { return _music->getMusicType(); }

Modified: scummvm/trunk/engines/kyra/sound_adlib.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sound_adlib.cpp	2008-05-11 22:45:12 UTC (rev 32043)
+++ scummvm/trunk/engines/kyra/sound_adlib.cpp	2008-05-11 23:16:50 UTC (rev 32044)
@@ -2210,7 +2210,7 @@
 
 const int SoundAdlibPC::_kyra1NumSoundTriggers = ARRAYSIZE(SoundAdlibPC::_kyra1SoundTriggers);
 
-SoundAdlibPC::SoundAdlibPC(KyraEngine *vm, Audio::Mixer *mixer)
+SoundAdlibPC::SoundAdlibPC(KyraEngine_v1 *vm, Audio::Mixer *mixer)
 	: Sound(vm, mixer), _driver(0), _trackEntries(), _soundDataPtr(0) {
 	memset(_trackEntries, 0, sizeof(_trackEntries));
 	_v2 = (_vm->gameFlags().gameID == GI_KYRA2);

Modified: scummvm/trunk/engines/kyra/sound_lok.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sound_lok.cpp	2008-05-11 22:45:12 UTC (rev 32043)
+++ scummvm/trunk/engines/kyra/sound_lok.cpp	2008-05-11 23:16:50 UTC (rev 32044)
@@ -35,7 +35,7 @@
 		return;
 	}
 
-	KyraEngine::snd_playSoundEffect(track);
+	KyraEngine_v1::snd_playSoundEffect(track);
 }
 
 void KyraEngine_LoK::snd_playWanderScoreViaMap(int command, int restart) {
@@ -57,7 +57,7 @@
 			_sound->haltTrack();
 		}
 	} else {
-		KyraEngine::snd_playWanderScoreViaMap(command, restart);
+		KyraEngine_v1::snd_playWanderScoreViaMap(command, restart);
 	}
 }
 

Modified: scummvm/trunk/engines/kyra/sound_towns.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sound_towns.cpp	2008-05-11 22:45:12 UTC (rev 32043)
+++ scummvm/trunk/engines/kyra/sound_towns.cpp	2008-05-11 23:16:50 UTC (rev 32044)
@@ -1084,7 +1084,7 @@
 	_driver->send(0x79B0);
 }
 
-SoundTowns::SoundTowns(KyraEngine *vm, Audio::Mixer *mixer)
+SoundTowns::SoundTowns(KyraEngine_v1 *vm, Audio::Mixer *mixer)
 	: Sound(vm, mixer), _lastTrack(-1), _currentSFX(0), _sfxFileData(0),
 	_sfxFileIndex((uint)-1), _sfxWDTable(0), _sfxBTTable(0), _parser(0) {
 
@@ -1357,7 +1357,7 @@
 
 //	KYRA 2
 
-SoundTowns_v2::SoundTowns_v2(KyraEngine *vm, Audio::Mixer *mixer)
+SoundTowns_v2::SoundTowns_v2(KyraEngine_v1 *vm, Audio::Mixer *mixer)
 	: Sound(vm, mixer), _lastTrack(-1), _currentSFX(0), /*_driver(0),*/
 	 _twnTrackData(0) {
 }

Modified: scummvm/trunk/engines/kyra/staticres.cpp
===================================================================
--- scummvm/trunk/engines/kyra/staticres.cpp	2008-05-11 22:45:12 UTC (rev 32043)
+++ scummvm/trunk/engines/kyra/staticres.cpp	2008-05-11 23:16:50 UTC (rev 32044)
@@ -26,7 +26,7 @@
 
 #include "common/endian.h"
 #include "common/md5.h"
-#include "kyra/kyra.h"
+#include "kyra/kyra_v1.h"
 #include "kyra/kyra_lok.h"
 #include "kyra/kyra_v2.h"
 #include "kyra/kyra_hof.h"
@@ -1338,11 +1338,11 @@
 
 const int Screen_MR::_screenDimTableCount = ARRAYSIZE(Screen_MR::_screenDimTable);
 
-const int8 KyraEngine::_addXPosTable[] = {
+const int8 KyraEngine_v1::_addXPosTable[] = {
 	 4,  4,  0, -4, -4, -4,  0,  4
 };
 
-const int8 KyraEngine::_addYPosTable[] = {
+const int8 KyraEngine_v1::_addYPosTable[] = {
 	 0, -2, -2, -2,  0,  2,  2,  2
 };
 

Modified: scummvm/trunk/engines/kyra/text.cpp
===================================================================
--- scummvm/trunk/engines/kyra/text.cpp	2008-05-11 22:45:12 UTC (rev 32043)
+++ scummvm/trunk/engines/kyra/text.cpp	2008-05-11 23:16:50 UTC (rev 32044)
@@ -25,7 +25,7 @@
 
 
 
-#include "kyra/kyra.h"
+#include "kyra/kyra_v1.h"
 #include "kyra/screen.h"
 #include "kyra/text.h"
 
@@ -35,7 +35,7 @@
 
 namespace Kyra {
 
-TextDisplayer::TextDisplayer(KyraEngine *vm, Screen *screen) {
+TextDisplayer::TextDisplayer(KyraEngine_v1 *vm, Screen *screen) {
 	_screen = screen;
 	_vm = vm;
 

Modified: scummvm/trunk/engines/kyra/text.h
===================================================================
--- scummvm/trunk/engines/kyra/text.h	2008-05-11 22:45:12 UTC (rev 32043)
+++ scummvm/trunk/engines/kyra/text.h	2008-05-11 23:16:50 UTC (rev 32044)
@@ -31,11 +31,11 @@
 #include "kyra/screen.h"
 
 namespace Kyra {
-class KyraEngine;
+class KyraEngine_v1;
 
 class TextDisplayer {
 public:
-	TextDisplayer(KyraEngine *vm, Screen *screen);
+	TextDisplayer(KyraEngine_v1 *vm, Screen *screen);
 	virtual ~TextDisplayer() {}
 
 	int maxSubstringLen() const { return TALK_SUBSTRING_LEN; }
@@ -60,7 +60,7 @@
 	bool printed() const { return _talkMessagePrinted; }
 protected:
 	Screen *_screen;
-	KyraEngine *_vm;
+	KyraEngine_v1 *_vm;
 
 	struct TalkCoords {
 		uint16 y, x, w;

Modified: scummvm/trunk/engines/kyra/timer.cpp
===================================================================
--- scummvm/trunk/engines/kyra/timer.cpp	2008-05-11 22:45:12 UTC (rev 32043)
+++ scummvm/trunk/engines/kyra/timer.cpp	2008-05-11 23:16:50 UTC (rev 32044)
@@ -23,7 +23,7 @@
  *
  */
 
-#include "kyra/kyra.h"
+#include "kyra/kyra_v1.h"
 #include "kyra/timer.h"
 
 #include "common/func.h"
@@ -34,7 +34,7 @@
 namespace {
 struct TimerResync : public Common::UnaryFunction<TimerEntry&, void> {
 	uint32 _tickLength, _curTime;
-	TimerResync(KyraEngine *vm, uint32 curTime) : _tickLength(vm->tickLength()), _curTime(curTime) {}
+	TimerResync(KyraEngine_v1 *vm, uint32 curTime) : _tickLength(vm->tickLength()), _curTime(curTime) {}
 
 	void operator()(TimerEntry &entry) const {
 		if (entry.lastUpdate < 0) {

Modified: scummvm/trunk/engines/kyra/timer.h
===================================================================
--- scummvm/trunk/engines/kyra/timer.h	2008-05-11 22:45:12 UTC (rev 32043)
+++ scummvm/trunk/engines/kyra/timer.h	2008-05-11 23:16:50 UTC (rev 32044)
@@ -26,7 +26,7 @@
 #ifndef KYRA_TIMER_H
 #define KYRA_TIMER_H
 
-#include "kyra/kyra.h"
+#include "kyra/kyra_v1.h"
 
 #include "common/list.h"
 #include "common/stream.h"
@@ -49,7 +49,7 @@
 
 class TimerManager {
 public:
-	TimerManager(KyraEngine *vm, OSystem *sys) : _vm(vm), _system(sys), _timers(), _nextRun(0), _isPaused(0), _pauseStart(0) {}
+	TimerManager(KyraEngine_v1 *vm, OSystem *sys) : _vm(vm), _system(sys), _timers(), _nextRun(0), _isPaused(0), _pauseStart(0) {}
 	~TimerManager() { reset(); }
 
 	void pause(bool p);
@@ -79,7 +79,7 @@
 private:
 	void resync();
 
-	KyraEngine *_vm;
+	KyraEngine_v1 *_vm;
 	OSystem *_system;
 	Common::List<TimerEntry> _timers;
 	uint32 _nextRun;

Modified: scummvm/trunk/engines/kyra/timer_lok.cpp
===================================================================
--- scummvm/trunk/engines/kyra/timer_lok.cpp	2008-05-11 22:45:12 UTC (rev 32043)
+++ scummvm/trunk/engines/kyra/timer_lok.cpp	2008-05-11 23:16:50 UTC (rev 32044)
@@ -23,7 +23,7 @@
  *
  */
 
-#include "kyra/kyra.h"
+#include "kyra/kyra_v1.h"
 #include "kyra/kyra_lok.h"
 #include "kyra/screen.h"
 #include "kyra/animator_lok.h"

Modified: scummvm/trunk/engines/kyra/vqa.cpp
===================================================================
--- scummvm/trunk/engines/kyra/vqa.cpp	2008-05-11 22:45:12 UTC (rev 32043)
+++ scummvm/trunk/engines/kyra/vqa.cpp	2008-05-11 23:16:50 UTC (rev 32044)
@@ -42,7 +42,7 @@
 
 namespace Kyra {
 
-VQAMovie::VQAMovie(KyraEngine *vm, OSystem *system) {
+VQAMovie::VQAMovie(KyraEngine_v1 *vm, OSystem *system) {
 	_system = system;
 	_vm = vm;
 	_opened = false;

Modified: scummvm/trunk/engines/kyra/vqa.h
===================================================================
--- scummvm/trunk/engines/kyra/vqa.h	2008-05-11 22:45:12 UTC (rev 32043)
+++ scummvm/trunk/engines/kyra/vqa.h	2008-05-11 23:16:50 UTC (rev 32044)
@@ -30,11 +30,11 @@
 
 namespace Kyra {
 
-class KyraEngine;
+class KyraEngine_v1;
 
 class VQAMovie {
 public:
-	VQAMovie(KyraEngine *vm, OSystem *system);
+	VQAMovie(KyraEngine_v1 *vm, OSystem *system);
 	~VQAMovie();
 
 	bool opened() { return _opened; }
@@ -54,7 +54,7 @@
 
 protected:
 	OSystem *_system;
-	KyraEngine *_vm;
+	KyraEngine_v1 *_vm;
 
 	bool _opened;
 	int _x, _y;

Modified: scummvm/trunk/engines/kyra/wsamovie.cpp
===================================================================
--- scummvm/trunk/engines/kyra/wsamovie.cpp	2008-05-11 22:45:12 UTC (rev 32043)
+++ scummvm/trunk/engines/kyra/wsamovie.cpp	2008-05-11 23:16:50 UTC (rev 32044)
@@ -27,7 +27,7 @@
 #include "common/endian.h"
 #include "common/system.h"
 
-#include "kyra/kyra.h"
+#include "kyra/kyra_v1.h"
 #include "kyra/kyra_v2.h"
 #include "kyra/screen.h"
 #include "kyra/screen_v2.h"
@@ -35,7 +35,7 @@
 #include "kyra/resource.h"
 
 namespace Kyra {
-WSAMovie_v1::WSAMovie_v1(KyraEngine *vm) : Movie(vm) {}
+WSAMovie_v1::WSAMovie_v1(KyraEngine_v1 *vm) : Movie(vm) {}
 WSAMovie_v1::~WSAMovie_v1() { close(); }
 
 int WSAMovie_v1::open(const char *filename, int offscreenDecode, uint8 *palBuf) {
@@ -213,7 +213,7 @@
 
 #pragma mark -
 
-WSAMovieAmiga::WSAMovieAmiga(KyraEngine *vm) : WSAMovie_v1(vm), _buffer(0) {}
+WSAMovieAmiga::WSAMovieAmiga(KyraEngine_v1 *vm) : WSAMovie_v1(vm), _buffer(0) {}
 
 int WSAMovieAmiga::open(const char *filename, int offscreenDecode, uint8 *palBuf) {
 	debugC(9, kDebugLevelMovie, "WSAMovieAmiga::open('%s', %d, %p)", filename, offscreenDecode, (const void *)palBuf);
@@ -342,7 +342,7 @@
 
 #pragma mark -
 
-WSAMovie_v2::WSAMovie_v2(KyraEngine *vm, Screen_v2 *screen) : WSAMovie_v1(vm), _screen(screen), _xAdd(0), _yAdd(0) {}

@@ Diff output truncated at 100000 characters. @@

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list