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

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Sun Jul 29 18:31:29 CEST 2007


Revision: 28296
          http://scummvm.svn.sourceforge.net/scummvm/?rev=28296&view=rev
Author:   lordhoto
Date:     2007-07-29 09:31:29 -0700 (Sun, 29 Jul 2007)

Log Message:
-----------
Restructure Kyrandia sourcecode (part 2, compiling works again)

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/animator_v1.cpp
    scummvm/trunk/engines/kyra/animator_v1.h
    scummvm/trunk/engines/kyra/debugger.cpp
    scummvm/trunk/engines/kyra/debugger.h
    scummvm/trunk/engines/kyra/gui_v1.cpp
    scummvm/trunk/engines/kyra/items_v1.cpp
    scummvm/trunk/engines/kyra/kyra.cpp
    scummvm/trunk/engines/kyra/kyra.h
    scummvm/trunk/engines/kyra/kyra_v1.cpp
    scummvm/trunk/engines/kyra/kyra_v1.h
    scummvm/trunk/engines/kyra/kyra_v2.cpp
    scummvm/trunk/engines/kyra/kyra_v2.h
    scummvm/trunk/engines/kyra/kyra_v3.cpp
    scummvm/trunk/engines/kyra/kyra_v3.h
    scummvm/trunk/engines/kyra/module.mk
    scummvm/trunk/engines/kyra/saveload_v1.cpp
    scummvm/trunk/engines/kyra/scene_v1.cpp
    scummvm/trunk/engines/kyra/screen.cpp
    scummvm/trunk/engines/kyra/screen.h
    scummvm/trunk/engines/kyra/script_v1.cpp
    scummvm/trunk/engines/kyra/seqplayer.cpp
    scummvm/trunk/engines/kyra/seqplayer.h
    scummvm/trunk/engines/kyra/sequences_v1.cpp
    scummvm/trunk/engines/kyra/sound.cpp
    scummvm/trunk/engines/kyra/sprites.cpp
    scummvm/trunk/engines/kyra/sprites.h
    scummvm/trunk/engines/kyra/staticres.cpp
    scummvm/trunk/engines/kyra/text.cpp
    scummvm/trunk/engines/kyra/timer_v1.cpp

Added Paths:
-----------
    scummvm/trunk/engines/kyra/gui_v2.cpp
    scummvm/trunk/engines/kyra/screen_v1.cpp
    scummvm/trunk/engines/kyra/screen_v1.h
    scummvm/trunk/engines/kyra/screen_v2.cpp
    scummvm/trunk/engines/kyra/screen_v2.h
    scummvm/trunk/engines/kyra/sound_v1.cpp
    scummvm/trunk/engines/kyra/text_v1.cpp

Modified: scummvm/trunk/engines/kyra/animator_v1.cpp
===================================================================
--- scummvm/trunk/engines/kyra/animator_v1.cpp	2007-07-29 16:29:41 UTC (rev 28295)
+++ scummvm/trunk/engines/kyra/animator_v1.cpp	2007-07-29 16:31:29 UTC (rev 28296)
@@ -26,15 +26,15 @@
 #include "common/stdafx.h"
 #include "common/endian.h"
 
-#include "kyra/kyra.h"
+#include "kyra/kyra_v1.h"
 #include "kyra/screen.h"
-#include "kyra/animator.h"
+#include "kyra/animator_v1.h"
 #include "kyra/sprites.h"
 
 #include "common/system.h"
 
 namespace Kyra {
-ScreenAnimator::ScreenAnimator(KyraEngine *vm, OSystem *system) {
+ScreenAnimator::ScreenAnimator(KyraEngine_v1 *vm, OSystem *system) {
 	_vm = vm;
 	_screen = vm->screen();
 	_initOk = false;

Modified: scummvm/trunk/engines/kyra/animator_v1.h
===================================================================
--- scummvm/trunk/engines/kyra/animator_v1.h	2007-07-29 16:29:41 UTC (rev 28295)
+++ scummvm/trunk/engines/kyra/animator_v1.h	2007-07-29 16:31:29 UTC (rev 28296)
@@ -27,7 +27,7 @@
 #define KYRA_ANIMATOR_H
 
 namespace Kyra {
-class KyraEngine;
+class KyraEngine_v1;
 class Screen;
 
 struct AnimObject {
@@ -53,7 +53,7 @@
 
 class ScreenAnimator {
 public:
-	ScreenAnimator(KyraEngine *vm, OSystem *system);
+	ScreenAnimator(KyraEngine_v1 *vm, OSystem *system);
 	virtual ~ScreenAnimator();
 
 	operator bool() const { return _initOk; }
@@ -101,7 +101,7 @@
 	int _brandonScaleY;
 
 protected:
-	KyraEngine *_vm;
+	KyraEngine_v1 *_vm;
 	Screen *_screen;
 	OSystem *_system;
 	bool _initOk;

Modified: scummvm/trunk/engines/kyra/debugger.cpp
===================================================================
--- scummvm/trunk/engines/kyra/debugger.cpp	2007-07-29 16:29:41 UTC (rev 28295)
+++ scummvm/trunk/engines/kyra/debugger.cpp	2007-07-29 16:31:29 UTC (rev 28296)
@@ -27,35 +27,35 @@
 #include "common/config-manager.h"
 #include "common/system.h"
 #include "kyra/debugger.h"
-#include "kyra/kyra.h"
+#include "kyra/kyra_v1.h"
 #include "kyra/screen.h"
 
 namespace Kyra {
 
-Debugger::Debugger(KyraEngine *vm)
-	: GUI::Debugger() {
+Debugger_v1::Debugger_v1(KyraEngine_v1 *vm)
+	: Debugger(vm) {
 	_vm = vm;
 
-	DCmd_Register("continue",			WRAP_METHOD(Debugger, Cmd_Exit));
-	DCmd_Register("enter",				WRAP_METHOD(Debugger, cmd_enterRoom));
-	DCmd_Register("rooms",				WRAP_METHOD(Debugger, cmd_listRooms));
-	DCmd_Register("flags",				WRAP_METHOD(Debugger, cmd_listFlags));
-	DCmd_Register("toggleflag",			WRAP_METHOD(Debugger, cmd_toggleFlag));
-	DCmd_Register("queryflag",			WRAP_METHOD(Debugger, cmd_queryFlag));
-	DCmd_Register("timers",				WRAP_METHOD(Debugger, cmd_listTimers));
-	DCmd_Register("settimercountdown",	WRAP_METHOD(Debugger, cmd_setTimerCountdown));
-	DCmd_Register("give",				WRAP_METHOD(Debugger, cmd_giveItem));
+	DCmd_Register("continue",			WRAP_METHOD(Debugger_v1, Cmd_Exit));
+	DCmd_Register("enter",				WRAP_METHOD(Debugger_v1, cmd_enterRoom));
+	DCmd_Register("rooms",				WRAP_METHOD(Debugger_v1, cmd_listRooms));
+	DCmd_Register("flags",				WRAP_METHOD(Debugger_v1, cmd_listFlags));
+	DCmd_Register("toggleflag",			WRAP_METHOD(Debugger_v1, cmd_toggleFlag));
+	DCmd_Register("queryflag",			WRAP_METHOD(Debugger_v1, cmd_queryFlag));
+	DCmd_Register("timers",				WRAP_METHOD(Debugger_v1, cmd_listTimers));
+	DCmd_Register("settimercountdown",	WRAP_METHOD(Debugger_v1, cmd_setTimerCountdown));
+	DCmd_Register("give",				WRAP_METHOD(Debugger_v1, cmd_giveItem));
 }
 
-void Debugger::preEnter() {
+void Debugger_v1::preEnter() {
 	//_vm->midi.pause(1);
 }
 
-void Debugger::postEnter() {
+void Debugger_v1::postEnter() {
 	//_vm->midi.pause(0);
 }
 
-bool Debugger::cmd_enterRoom(int argc, const char **argv) {
+bool Debugger_v1::cmd_enterRoom(int argc, const char **argv) {
 	uint direction = 0;
 	if (argc > 1) {
 		int room = atoi(argv[1]);
@@ -93,7 +93,7 @@
 	return true;
 }
 
-bool Debugger::cmd_listRooms(int argc, const char **argv) {
+bool Debugger_v1::cmd_listRooms(int argc, const char **argv) {
 	for (int i = 0; i < _vm->_roomTableSize; i++) {
 		DebugPrintf("%-3i: %-10s", i, _vm->_roomFilenameTable[_vm->_roomTable[i].nameIndex]);
 		if (!(i % 8)) 
@@ -104,7 +104,7 @@
 	return true;
 }
 
-bool Debugger::cmd_listFlags(int argc, const char **argv) {
+bool Debugger_v1::cmd_listFlags(int argc, const char **argv) {
 	for (int i = 0; i < (int)sizeof(_vm->_flagsTable)*8; i++) {
 		DebugPrintf("(%-3i): %-5i", i, _vm->queryGameFlag(i));
 		if (!(i % 10)) 
@@ -114,7 +114,7 @@
 	return true;
 }
 
-bool Debugger::cmd_toggleFlag(int argc, const char **argv) {
+bool Debugger_v1::cmd_toggleFlag(int argc, const char **argv) {
 	if (argc > 1) {
 		uint flag = atoi(argv[1]);
 		if (_vm->queryGameFlag(flag))
@@ -129,7 +129,7 @@
 	return true;
 }
 
-bool Debugger::cmd_queryFlag(int argc, const char **argv) {
+bool Debugger_v1::cmd_queryFlag(int argc, const char **argv) {
 	if (argc > 1) {
 		uint flag = atoi(argv[1]);
 		DebugPrintf("Flag %i is %i\n", flag, _vm->queryGameFlag(flag)); 
@@ -140,14 +140,14 @@
 	return true;
 }
 
-bool Debugger::cmd_listTimers(int argc, const char **argv) {
+bool Debugger_v1::cmd_listTimers(int argc, const char **argv) {
 	for (int i = 0; i < ARRAYSIZE(_vm->_timers); i++)
 		DebugPrintf("Timer %-2i: Active: %-3s Countdown: %-6i\n", i, _vm->_timers[i].active ? "Yes" : "No", _vm->_timers[i].countdown);
 
 	return true;
 }
 
-bool Debugger::cmd_setTimerCountdown(int argc, const char **argv) {
+bool Debugger_v1::cmd_setTimerCountdown(int argc, const char **argv) {
 	if (argc > 2) {
 		uint timer = atoi(argv[1]);
 		uint countdown = atoi(argv[2]);
@@ -160,7 +160,7 @@
 	return true;
 }
 
-bool Debugger::cmd_giveItem(int argc, const char **argv) {
+bool Debugger_v1::cmd_giveItem(int argc, const char **argv) {
 	if (argc == 2) {
 		int item = atoi(argv[1]);
 

Modified: scummvm/trunk/engines/kyra/debugger.h
===================================================================
--- scummvm/trunk/engines/kyra/debugger.h	2007-07-29 16:29:41 UTC (rev 28295)
+++ scummvm/trunk/engines/kyra/debugger.h	2007-07-29 16:31:29 UTC (rev 28296)
@@ -31,14 +31,21 @@
 namespace Kyra {
 
 class KyraEngine;
+class KyraEngine_v1;
 
 class Debugger : public GUI::Debugger {
 public:
-	Debugger(KyraEngine *vm);
+	Debugger(KyraEngine *vm) {}
 	virtual ~Debugger() {}  // we need this for __SYMBIAN32__ archaic gcc/UIQ
+};
 
+class Debugger_v1 : public Debugger {
+public:
+	Debugger_v1(KyraEngine_v1 *vm);
+	virtual ~Debugger_v1() {}  // we need this for __SYMBIAN32__ archaic gcc/UIQ
+
 protected:
-	KyraEngine *_vm;
+	KyraEngine_v1 *_vm;
 
 	virtual void preEnter();
 	virtual void postEnter();

Modified: scummvm/trunk/engines/kyra/gui_v1.cpp
===================================================================
--- scummvm/trunk/engines/kyra/gui_v1.cpp	2007-07-29 16:29:41 UTC (rev 28295)
+++ scummvm/trunk/engines/kyra/gui_v1.cpp	2007-07-29 16:31:29 UTC (rev 28296)
@@ -23,11 +23,11 @@
  *
  */
 
-#include "kyra/kyra.h"
+#include "kyra/kyra_v1.h"
 #include "kyra/screen.h"
 #include "kyra/script.h"
 #include "kyra/text.h"
-#include "kyra/animator.h"
+#include "kyra/animator_v1.h"
 #include "kyra/sound.h"
 
 #include "common/config-manager.h"
@@ -37,14 +37,14 @@
 
 namespace Kyra {
 
-void KyraEngine::registerDefaultSettings() {
+void KyraEngine_v1::registerDefaultSettings() {
 	// Most settings already have sensible defaults. This one, however, is
 	// specific to the Kyra engine.
 	ConfMan.registerDefault("walkspeed", 2);
 	ConfMan.registerDefault("cdaudio", _flags.platform == Common::kPlatformFMTowns);
 }
 
-void KyraEngine::readSettings() {
+void KyraEngine_v1::readSettings() {
 	int talkspeed = ConfMan.getInt("talkspeed");
 
 	// The default talk speed is 60. This should be mapped to "Normal".
@@ -78,7 +78,7 @@
 	setWalkspeed(_configWalkspeed);
 }
 
-void KyraEngine::writeSettings() {
+void KyraEngine_v1::writeSettings() {
 	bool speechMute, subtitles;
 	int talkspeed;
 
@@ -130,14 +130,14 @@
 	ConfMan.flushToDisk();
 }
 
-void KyraEngine::initMainButtonList() {
+void KyraEngine_v1::initMainButtonList() {
 	_haveScrollButtons = false;
 	_buttonList = &_buttonData[0];
 	for (int i = 0; _buttonDataListPtr[i]; ++i)
 		_buttonList = initButton(_buttonList, _buttonDataListPtr[i]);
 }
 
-Button *KyraEngine::initButton(Button *list, Button *newButton) {
+Button *KyraEngine_v1::initButton(Button *list, Button *newButton) {
 	if (!newButton)
 		return list;
 	if (!list)
@@ -154,7 +154,7 @@
 	return list;
 }
 
-int KyraEngine::buttonInventoryCallback(Button *caller) {
+int KyraEngine_v1::buttonInventoryCallback(Button *caller) {
 	int itemOffset = caller->specialValue - 2;
 	uint8 inventoryItem = _currentCharacter->inventoryItems[itemOffset];
 	if (_itemInHand == -1) {
@@ -198,7 +198,7 @@
 	return 0;
 }
 
-int KyraEngine::buttonAmuletCallback(Button *caller) {
+int KyraEngine_v1::buttonAmuletCallback(Button *caller) {
 	if (!(_deathHandler & 8))
 		return 1;
 	int jewel = caller->specialValue - 0x14;
@@ -294,7 +294,7 @@
 	return 1;
 }
 
-void KyraEngine::processButtonList(Button *list) {
+void KyraEngine_v1::processButtonList(Button *list) {
 	if (_haveScrollButtons) {
 		if (_mouseWheel < 0)
 			gui_scrollUp(&_scrollUpButton);
@@ -367,7 +367,7 @@
 	}
 }
 
-void KyraEngine::processButton(Button *button) {
+void KyraEngine_v1::processButton(Button *button) {
 	if (!button)
 		return;
 	
@@ -411,7 +411,7 @@
 		(this->*callback)(button);
 }
 
-void KyraEngine::processAllMenuButtons() {
+void KyraEngine_v1::processAllMenuButtons() {
 	if (!_menuButtonList)
 		return;
 
@@ -425,7 +425,7 @@
 	return;
 }
 
-void KyraEngine::processMenuButton(Button *button) {
+void KyraEngine_v1::processMenuButton(Button *button) {
 	if (!_displayMenu)
 		return;
 
@@ -449,7 +449,7 @@
 	processButton(button);
 }
 
-int KyraEngine::drawBoxCallback(Button *button) {
+int KyraEngine_v1::drawBoxCallback(Button *button) {
 	if (!_displayMenu)
 		return 0;
 
@@ -460,7 +460,7 @@
 	return 0;
 }
 
-int KyraEngine::drawShadedBoxCallback(Button *button) {
+int KyraEngine_v1::drawShadedBoxCallback(Button *button) {
 	if (!_displayMenu)
 		return 0;
 	
@@ -471,7 +471,7 @@
 	return 0;
 }
 
-void KyraEngine::setGUILabels() {
+void KyraEngine_v1::setGUILabels() {
 	int offset = 0;
 	int offsetOptions = 0;
 	int offsetMainMenu = 0;
@@ -561,7 +561,7 @@
 	_onCDString = _guiStrings[21];
 }
 
-int KyraEngine::buttonMenuCallback(Button *caller) {
+int KyraEngine_v1::buttonMenuCallback(Button *caller) {
 	_displayMenu = true;
 
 	assert(_guiStrings);
@@ -584,9 +584,9 @@
 	_screen->setPaletteIndex(0xFE, 60, 60, 0);
 	for (int i = 0; i < 6; i++) {
 		_menuButtonData[i].process0 = _menuButtonData[i].process1 = _menuButtonData[i].process2 = 4;
-		_menuButtonData[i].process0PtrCallback = &KyraEngine::drawShadedBoxCallback;
-		_menuButtonData[i].process1PtrCallback = &KyraEngine::drawBoxCallback;
-		_menuButtonData[i].process2PtrCallback = &KyraEngine::drawShadedBoxCallback;
+		_menuButtonData[i].process0PtrCallback = &KyraEngine_v1::drawShadedBoxCallback;
+		_menuButtonData[i].process1PtrCallback = &KyraEngine_v1::drawBoxCallback;
+		_menuButtonData[i].process2PtrCallback = &KyraEngine_v1::drawShadedBoxCallback;
 	}
 
 	_screen->savePageToDisk("SEENPAGE.TMP", 0);
@@ -627,7 +627,7 @@
 	return 0;
 }
 
-void KyraEngine::initMenu(Menu &menu) {
+void KyraEngine_v1::initMenu(Menu &menu) {
 	_menuButtonList = 0;
 
 	_screen->hideMouse();
@@ -707,14 +707,14 @@
 
 		_scrollUpButton.x = menu.scrollUpBtnX + menu.x;
 		_scrollUpButton.y = menu.scrollUpBtnY + menu.y;
-		_scrollUpButton.buttonCallback = &KyraEngine::gui_scrollUp;
+		_scrollUpButton.buttonCallback = &KyraEngine_v1::gui_scrollUp;
 		_scrollUpButton.nextButton = 0;
 		_menuButtonList = initButton(_menuButtonList, &_scrollUpButton);
 		processMenuButton(&_scrollUpButton);
 		
 		_scrollDownButton.x = menu.scrollDownBtnX + menu.x;
 		_scrollDownButton.y = menu.scrollDownBtnY + menu.y;
-		_scrollDownButton.buttonCallback = &KyraEngine::gui_scrollDown;
+		_scrollDownButton.buttonCallback = &KyraEngine_v1::gui_scrollDown;
 		_scrollDownButton.nextButton = 0;
 		_menuButtonList = initButton(_menuButtonList, &_scrollDownButton);
 		processMenuButton(&_scrollDownButton);
@@ -726,7 +726,7 @@
 	_screen->updateScreen();
 }
 
-void KyraEngine::calcCoords(Menu &menu) {
+void KyraEngine_v1::calcCoords(Menu &menu) {
 	assert(menu.nrOfItems < 7);
 
 	int widthBackup = _screen->_charWidth;
@@ -798,7 +798,7 @@
 	_screen->_charWidth = widthBackup;
 }
 
-void KyraEngine::gui_getInput() {
+void KyraEngine_v1::gui_getInput() {
 	Common::Event event;
 	static uint32 lastScreenUpdate = 0;
 	uint32 now = _system->getMillis();
@@ -841,22 +841,22 @@
 	_system->delayMillis(3);
 }
 
-int KyraEngine::gui_resumeGame(Button *button) {
-	debugC(9, kDebugLevelGUI, "KyraEngine::gui_resumeGame()");
+int KyraEngine_v1::gui_resumeGame(Button *button) {
+	debugC(9, kDebugLevelGUI, "KyraEngine_v1::gui_resumeGame()");
 	processMenuButton(button);
 	_displayMenu = false;
 
 	return 0;
 }
 
-const char *KyraEngine::getSavegameFilename(int num) {
+const char *KyraEngine_v1::getSavegameFilename(int num) {
 	static char saveLoadSlot[12];
 
 	sprintf(saveLoadSlot, "%s.%.3d", _targetName.c_str(), num);
 	return saveLoadSlot;
 }
 
-int KyraEngine::getNextSavegameSlot() {
+int KyraEngine_v1::getNextSavegameSlot() {
 	Common::InSaveFile *in;
 
 	for (int i = 1; i < 1000; i++) {
@@ -869,7 +869,7 @@
 	return 0;
 }
 
-void KyraEngine::setupSavegames(Menu &menu, int num) {
+void KyraEngine_v1::setupSavegames(Menu &menu, int num) {
 	Common::InSaveFile *in;
 	static char savenames[5][31];
 	uint8 startSlot;
@@ -900,8 +900,8 @@
 	}
 }
 
-int KyraEngine::gui_saveGameMenu(Button *button) {
-	debugC(9, kDebugLevelGUI, "KyraEngine::gui_saveGameMenu()");
+int KyraEngine_v1::gui_saveGameMenu(Button *button) {
+	debugC(9, kDebugLevelGUI, "KyraEngine_v1::gui_saveGameMenu()");
 	processMenuButton(button);
 	_menu[2].item[5].enabled = true;
 
@@ -911,7 +911,7 @@
 	_menu[2].menuName = _guiStrings[8]; // Select a position to save to:
 	_specialSavegameString = _guiStrings[9]; // [ EMPTY SLOT ]
 	for (int i = 0; i < 5; i++)
-		_menu[2].item[i].callback = &KyraEngine::gui_saveGame;
+		_menu[2].item[i].callback = &KyraEngine_v1::gui_saveGame;
 
 	_savegameOffset = 0;
 	setupSavegames(_menu[2], 5);
@@ -940,8 +940,8 @@
 	return 0;
 }
 
-int KyraEngine::gui_loadGameMenu(Button *button) {
-	debugC(9, kDebugLevelGUI, "KyraEngine::gui_loadGameMenu()");
+int KyraEngine_v1::gui_loadGameMenu(Button *button) {
+	debugC(9, kDebugLevelGUI, "KyraEngine_v1::gui_loadGameMenu()");
 	if (_menuDirectlyToLoad) {
 		_menu[2].item[5].enabled = false;
 	} else {
@@ -955,7 +955,7 @@
 	_specialSavegameString = _newGameString[0]; //[ START A NEW GAME ]
 	_menu[2].menuName = _guiStrings[7]; // Which game would you like to reload?
 	for (int i = 0; i < 5; i++)
-		_menu[2].item[i].callback = &KyraEngine::gui_loadGame;
+		_menu[2].item[i].callback = &KyraEngine_v1::gui_loadGame;
 
 	_savegameOffset = 0;
 	setupSavegames(_menu[2], 5);
@@ -987,7 +987,7 @@
 	return 0;
 }
 
-void KyraEngine::gui_redrawTextfield() {
+void KyraEngine_v1::gui_redrawTextfield() {
 	_screen->fillRect(38, 91, 287, 102, 250);
 	_text->printText(_savegameName, 38, 92, 253, 0, 0);
 
@@ -999,7 +999,7 @@
 	_screen->updateScreen();
 }
 
-void KyraEngine::gui_updateSavegameString() {
+void KyraEngine_v1::gui_updateSavegameString() {
 	int length;
 
 	if (_keyPressed.keycode) {
@@ -1026,8 +1026,8 @@
 	_keyPressed.reset();
 }
 
-int KyraEngine::gui_saveGame(Button *button) {
-	debugC(9, kDebugLevelGUI, "KyraEngine::gui_saveGame()");
+int KyraEngine_v1::gui_saveGame(Button *button) {
+	debugC(9, kDebugLevelGUI, "KyraEngine_v1::gui_saveGame()");
 	processMenuButton(button);
 	_gameToLoad = button->specialValue;
 
@@ -1074,16 +1074,16 @@
 	return 0;
 }
 
-int KyraEngine::gui_savegameConfirm(Button *button) {
-	debugC(9, kDebugLevelGUI, "KyraEngine::gui_savegameConfirm()");
+int KyraEngine_v1::gui_savegameConfirm(Button *button) {
+	debugC(9, kDebugLevelGUI, "KyraEngine_v1::gui_savegameConfirm()");
 	processMenuButton(button);
 	_displaySubMenu = false;
 
 	return 0;
 }
 
-int KyraEngine::gui_loadGame(Button *button) {
-	debugC(9, kDebugLevelGUI, "KyraEngine::gui_loadGame()");
+int KyraEngine_v1::gui_loadGame(Button *button) {
+	debugC(9, kDebugLevelGUI, "KyraEngine_v1::gui_loadGame()");
 	processMenuButton(button);
 	_displaySubMenu = false;
 	_gameToLoad = button->specialValue;
@@ -1091,8 +1091,8 @@
 	return 0;
 }
 
-int KyraEngine::gui_cancelSubMenu(Button *button) {
-	debugC(9, kDebugLevelGUI, "KyraEngine::gui_cancelLoadGameMenu()");
+int KyraEngine_v1::gui_cancelSubMenu(Button *button) {
+	debugC(9, kDebugLevelGUI, "KyraEngine_v1::gui_cancelLoadGameMenu()");
 	processMenuButton(button);
 	_displaySubMenu = false;
 	_cancelSubMenu = true;
@@ -1100,8 +1100,8 @@
 	return 0;
 }
 
-int KyraEngine::gui_quitPlaying(Button *button) {
-	debugC(9, kDebugLevelGUI, "KyraEngine::gui_quitPlaying()");
+int KyraEngine_v1::gui_quitPlaying(Button *button) {
+	debugC(9, kDebugLevelGUI, "KyraEngine_v1::gui_quitPlaying()");
 	processMenuButton(button);
 
 	if (gui_quitConfirm(_guiStrings[14])) { // Are you sure you want to quit playing?
@@ -1114,8 +1114,8 @@
 	return 0;
 }
 
-bool KyraEngine::gui_quitConfirm(const char *str) {
-	debugC(9, kDebugLevelGUI, "KyraEngine::gui_quitConfirm()");
+bool KyraEngine_v1::gui_quitConfirm(const char *str) {
+	debugC(9, kDebugLevelGUI, "KyraEngine_v1::gui_quitConfirm()");
 
 	_screen->loadPageFromDisk("SEENPAGE.TMP", 0);
 	_screen->savePageToDisk("SEENPAGE.TMP", 0);
@@ -1139,8 +1139,8 @@
 	return !_cancelSubMenu;
 }
 
-int KyraEngine::gui_quitConfirmYes(Button *button) {
-	debugC(9, kDebugLevelGUI, "KyraEngine::gui_quitConfirmYes()");
+int KyraEngine_v1::gui_quitConfirmYes(Button *button) {
+	debugC(9, kDebugLevelGUI, "KyraEngine_v1::gui_quitConfirmYes()");
 	processMenuButton(button);
 	_displaySubMenu = false;
 	_cancelSubMenu = false;
@@ -1148,8 +1148,8 @@
 	return 0;
 }
 
-int KyraEngine::gui_quitConfirmNo(Button *button) {
-	debugC(9, kDebugLevelGUI, "KyraEngine::gui_quitConfirmNo()");
+int KyraEngine_v1::gui_quitConfirmNo(Button *button) {
+	debugC(9, kDebugLevelGUI, "KyraEngine_v1::gui_quitConfirmNo()");
 	processMenuButton(button);
 	_displaySubMenu = false;
 	_cancelSubMenu = true;
@@ -1157,8 +1157,8 @@
 	return 0;
 }
 
-int KyraEngine::gui_gameControlsMenu(Button *button) {
-	debugC(9, kDebugLevelGUI, "KyraEngine::gui_gameControlsMenu()");
+int KyraEngine_v1::gui_gameControlsMenu(Button *button) {
+	debugC(9, kDebugLevelGUI, "KyraEngine_v1::gui_gameControlsMenu()");
 
 	readSettings();
 
@@ -1175,14 +1175,14 @@
 		}
 
 		_menu[5].item[3].labelString = _voiceTextString; //"Voice / Text "
-		_menu[5].item[3].callback = &KyraEngine::gui_controlsChangeVoice;
+		_menu[5].item[3].callback = &KyraEngine_v1::gui_controlsChangeVoice;
 
 	} else {
 		//_menu[5].height = 136;
 		//_menu[5].item[5].y = 110;
 		_menu[5].item[4].enabled = 0;
 		_menu[5].item[3].labelString = _textSpeedString; // "Text speed "
-		_menu[5].item[3].callback = &KyraEngine::gui_controlsChangeText;
+		_menu[5].item[3].callback = &KyraEngine_v1::gui_controlsChangeText;
 	}
 
 	gui_setupControls(_menu[5]);
@@ -1208,8 +1208,8 @@
 	return 0;
 }
 
-void KyraEngine::gui_setupControls(Menu &menu) {
-	debugC(9, kDebugLevelGUI, "KyraEngine::gui_setupControls()");
+void KyraEngine_v1::gui_setupControls(Menu &menu) {
+	debugC(9, kDebugLevelGUI, "KyraEngine_v1::gui_setupControls()");
 
 	switch (_configMusic) {
 		case 0:
@@ -1299,8 +1299,8 @@
 	initMenu(menu);
 }
 
-int KyraEngine::gui_controlsChangeMusic(Button *button) {
-	debugC(9, kDebugLevelGUI, "KyraEngine::gui_controlsChangeMusic()");
+int KyraEngine_v1::gui_controlsChangeMusic(Button *button) {
+	debugC(9, kDebugLevelGUI, "KyraEngine_v1::gui_controlsChangeMusic()");
 	processMenuButton(button);
 
 	_configMusic = ++_configMusic % (_flags.platform == Common::kPlatformFMTowns ? 3 : 2);
@@ -1308,8 +1308,8 @@
 	return 0;
 }
 
-int KyraEngine::gui_controlsChangeSounds(Button *button) {
-	debugC(9, kDebugLevelGUI, "KyraEngine::gui_controlsChangeSounds()");
+int KyraEngine_v1::gui_controlsChangeSounds(Button *button) {
+	debugC(9, kDebugLevelGUI, "KyraEngine_v1::gui_controlsChangeSounds()");
 	processMenuButton(button);
 
 	_configSounds = !_configSounds;
@@ -1317,8 +1317,8 @@
 	return 0;
 }
 
-int KyraEngine::gui_controlsChangeWalk(Button *button) {
-	debugC(9, kDebugLevelGUI, "KyraEngine::gui_controlsChangeWalk()");
+int KyraEngine_v1::gui_controlsChangeWalk(Button *button) {
+	debugC(9, kDebugLevelGUI, "KyraEngine_v1::gui_controlsChangeWalk()");
 	processMenuButton(button);
 
 	_configWalkspeed = ++_configWalkspeed % 5;
@@ -1327,8 +1327,8 @@
 	return 0;
 }
 
-int KyraEngine::gui_controlsChangeText(Button *button) {
-	debugC(9, kDebugLevelGUI, "KyraEngine::gui_controlsChangeText()");
+int KyraEngine_v1::gui_controlsChangeText(Button *button) {
+	debugC(9, kDebugLevelGUI, "KyraEngine_v1::gui_controlsChangeText()");
 	processMenuButton(button);
 
 	_configTextspeed = ++_configTextspeed % 4;
@@ -1336,8 +1336,8 @@
 	return 0;
 }
 
-int KyraEngine::gui_controlsChangeVoice(Button *button) {
-	debugC(9, kDebugLevelGUI, "KyraEngine::gui_controlsChangeVoice()");
+int KyraEngine_v1::gui_controlsChangeVoice(Button *button) {
+	debugC(9, kDebugLevelGUI, "KyraEngine_v1::gui_controlsChangeVoice()");
 	processMenuButton(button);
 
 	_configVoice = ++_configVoice % 3;
@@ -1345,14 +1345,14 @@
 	return 0;
 }
 
-int KyraEngine::gui_controlsApply(Button *button) {
-	debugC(9, kDebugLevelGUI, "KyraEngine::gui_controlsApply()");
+int KyraEngine_v1::gui_controlsApply(Button *button) {
+	debugC(9, kDebugLevelGUI, "KyraEngine_v1::gui_controlsApply()");
 	writeSettings();
 	return gui_cancelSubMenu(button);
 }
 
-int KyraEngine::gui_scrollUp(Button *button) {
-	debugC(9, kDebugLevelGUI, "KyraEngine::gui_scrollUp()");
+int KyraEngine_v1::gui_scrollUp(Button *button) {
+	debugC(9, kDebugLevelGUI, "KyraEngine_v1::gui_scrollUp()");
 	processMenuButton(button);
 
 	if (_savegameOffset > 0) {
@@ -1363,8 +1363,8 @@
 	return 0;
 }
 
-int KyraEngine::gui_scrollDown(Button *button) {
-	debugC(9, kDebugLevelGUI, "KyraEngine::gui_scrollDown()");
+int KyraEngine_v1::gui_scrollDown(Button *button) {
+	debugC(9, kDebugLevelGUI, "KyraEngine_v1::gui_scrollDown()");
 	processMenuButton(button);
 
 	_savegameOffset++;
@@ -1374,7 +1374,7 @@
 	return 0;
 }
 
-void KyraEngine::gui_processHighlights(Menu &menu) {
+void KyraEngine_v1::gui_processHighlights(Menu &menu) {
 	int x1, y1, x2, y2;
 
 	Common::Point mouse = getMousePos();
@@ -1403,7 +1403,7 @@
 	}
 }
 
-void KyraEngine::gui_redrawText(Menu menu) {
+void KyraEngine_v1::gui_redrawText(Menu menu) {
 	int textX;
 	int i = menu.highlightedItem;
 
@@ -1422,7 +1422,7 @@
 	_text->printText(menu.item[i].itemString, textX, textY, menu.item[i].textColor, 0, 0);
 }
 
-void KyraEngine::gui_redrawHighlight(Menu menu) {
+void KyraEngine_v1::gui_redrawHighlight(Menu menu) {
 	int textX;
 	int i = menu.highlightedItem;
 
@@ -1441,7 +1441,7 @@
 	_text->printText(menu.item[i].itemString, textX, textY, menu.item[i].highlightColor, 0, 0);
 }
 
-void KyraEngine::gui_fadePalette() {
+void KyraEngine_v1::gui_fadePalette() {
 	if (_flags.platform == Common::kPlatformAmiga)
 		return;
 
@@ -1461,7 +1461,7 @@
 	_screen->fadePalette(_screen->_currentPalette, 2);
 }
 
-void KyraEngine::gui_restorePalette() {
+void KyraEngine_v1::gui_restorePalette() {
 	if (_flags.platform == Common::kPlatformAmiga)
 		return;
 
@@ -1469,172 +1469,5 @@
 	_screen->fadePalette(_screen->_currentPalette, 2);
 }
 
-#pragma mark -
-
-// Kyra 2 and 3 main menu
-
-void KyraEngine::gui_updateMainMenuAnimation() {
-	_screen->updateScreen();
-}
-
-bool KyraEngine::gui_mainMenuGetInput() {
-	Common::Event event;
-
-	while (_eventMan->pollEvent(event)) {
-		switch (event.type) {
-		case Common::EVENT_QUIT:
-			quitGame();
-			break;
-		case Common::EVENT_LBUTTONUP:
-			return true;
-		default:
-			break;
-		}
-	}
-	return false;
-}
-
-int KyraEngine::gui_handleMainMenu() {
-	debugC(9, kDebugLevelMain, "KyraEngine::gui_handleMainMenu()");
-	int command = -1;
-	
-	uint8 colorMap[16];
-	memset(colorMap, 0, sizeof(colorMap));
-	_screen->setTextColorMap(colorMap);
-	
-	const char * const *strings = &_mainMenuStrings[_lang << 2];
-	Screen::FontId oldFont = _screen->setFont(Screen::FID_8_FNT);
-	int charWidthBackUp = _screen->_charWidth;
-	
-	_screen->_charWidth = -2;
-	_screen->setScreenDim(3);
-	int backUpX = _screen->_curDim->sx;
-	int backUpY = _screen->_curDim->sy;
-	int backUpWidth = _screen->_curDim->w;
-	int backUpHeight = _screen->_curDim->h;
-	_screen->copyRegion(backUpX, backUpY, backUpX, backUpY, backUpWidth, backUpHeight, 0, 3);
-
-	int x = _screen->_curDim->sx << 3;
-	int y = _screen->_curDim->sy;
-	int width = _screen->_curDim->w << 3;
-	int height =  _screen->_curDim->h;
-
-	gui_drawMainBox(x, y, width, height, 1);
-	gui_drawMainBox(x + 1, y + 1, width - 2, height - 2, 0);
-	
-	int selected = 0;
-	
-	gui_drawMainMenu(strings, selected);
-
-	_screen->showMouse();
-
-	int fh = _screen->getFontHeight();
-	int textPos = ((_screen->_curDim->w >> 1) + _screen->_curDim->sx) << 3;
-
-	Common::Rect menuRect(x + 16, y + 4, x + width - 16, y + 4 + fh * 4);
-	
-	while (!_quitFlag) {
-		gui_updateMainMenuAnimation();
-		bool mousePressed = gui_mainMenuGetInput();
-
-		Common::Point mouse = getMousePos();
-		if (menuRect.contains(mouse)) {
-			int item = (mouse.y - menuRect.top) / fh;
-
-			if (item != selected) {
-				gui_printString(strings[selected], textPos, menuRect.top + selected * fh, 0x80, 0, 5);
-				gui_printString(strings[item], textPos, menuRect.top + item * fh, 0xFF, 0, 5);
-
-				selected = item;
-			}
-
-			if (mousePressed) {
-				// TODO: Flash the text
-				command = item;
-				break;
-			}
-		}
-		_system->delayMillis(10);
-	}
-	
-	if (_quitFlag)
-		command = -1;
-	
-	_screen->copyRegion(backUpX, backUpY, backUpX, backUpY, backUpWidth, backUpHeight, 3, 0);
-	_screen->_charWidth = charWidthBackUp;
-	_screen->setFont(oldFont);
-	
-	return command;
-}
-
-void KyraEngine::gui_drawMainMenu(const char * const *strings, int select) {
-	debugC(9, kDebugLevelMain, "KyraEngine::gui_drawMainMenu(%p)", (const void*)strings);
-	static const uint16 menuTable[] = { 0x01, 0x04, 0x0C, 0x04, 0x00, 0x80, 0xFF, 0x00, 0x01, 0x02, 0x03 };
-	
-	int top = _screen->_curDim->sy;
-	top += menuTable[1];
-	
-	for (int i = 0; i < menuTable[3]; ++i) {
-		int curY = top + i * _screen->getFontHeight();
-		int color = (i == select) ? menuTable[6] : menuTable[5];
-		gui_printString(strings[i], ((_screen->_curDim->w >> 1) + _screen->_curDim->sx) << 3, curY, color, 0, 5);
-	}
-}
-
-void KyraEngine::gui_drawMainBox(int x, int y, int w, int h, int fill) {
-	debugC(9, kDebugLevelMain, "KyraEngine::gui_drawMainBox(%d, %d, %d, %d, %d)", x, y, w, h, fill);
-	static const uint8 kyra3ColorTable[] = { 0x16, 0x19, 0x1A, 0x16 };
-	static const uint8 kyra2ColorTable[] = { 0x0, 0x19, 0x28, 0xc8 };
-	
-	const uint8 *colorTable;
-	if (_flags.gameID == GI_KYRA3)
-		colorTable = kyra3ColorTable;
-	else
-		colorTable = kyra2ColorTable;
-		
-	--w; --h;
-
-	if (fill)
-		_screen->fillRect(x, y, x+w, y+h, colorTable[0]);
-	
-	_screen->drawClippedLine(x, y+h, x+w, y+h, colorTable[1]);
-	_screen->drawClippedLine(x+w, y, x+w, y+h, colorTable[1]);
-	_screen->drawClippedLine(x, y, x+w, y, colorTable[2]);
-	_screen->drawClippedLine(x, y, x, y+h, colorTable[2]);
-	
-	_screen->setPagePixel(_screen->_curPage, x, y+h, colorTable[3]);
-	_screen->setPagePixel(_screen->_curPage, x+w, y, colorTable[3]);
-}
-
-void KyraEngine::gui_printString(const char *format, int x, int y, int col1, int col2, int flags, ...) {
-	debugC(9, kDebugLevelMain, "KyraEngine::gui_printString('%s', %d, %d, %d, %d, %d, ...)", format, x, y, col1, col2, flags);
-	if (!format)
-		return;
-	
-	char string[512];
-	va_list vaList;
-	va_start(vaList, flags);
-	vsprintf(string, format, vaList);
-	va_end(vaList);
-	
-	if (flags & 1)
-		x -= _screen->getTextWidth(string) >> 1;
-	
-	if (flags & 2)
-		x -= _screen->getTextWidth(string);
-	
-	if (flags & 4) {
-		_screen->printText(string, x - 1, y, 240, col2);
-		_screen->printText(string, x, y + 1, 240, col2);
-	}
-	
-	if (flags & 8) {
-		_screen->printText(string, x - 1, y, 227, col2);
-		_screen->printText(string, x, y + 1, 227, col2);
-	}
-	
-	_screen->printText(string, x, y, col1, col2);
-}
-
 } // end of namespace Kyra
  

Added: scummvm/trunk/engines/kyra/gui_v2.cpp
===================================================================
--- scummvm/trunk/engines/kyra/gui_v2.cpp	                        (rev 0)
+++ scummvm/trunk/engines/kyra/gui_v2.cpp	2007-07-29 16:31:29 UTC (rev 28296)
@@ -0,0 +1,195 @@
+/* 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/kyra_v2.h"
+#include "kyra/screen.h"
+
+namespace Kyra {
+
+void KyraEngine_v2::gui_updateMainMenuAnimation() {
+	_screen->updateScreen();
+}
+
+bool KyraEngine_v2::gui_mainMenuGetInput() {
+	Common::Event event;
+
+	while (_eventMan->pollEvent(event)) {
+		switch (event.type) {
+		case Common::EVENT_QUIT:
+			quitGame();
+			break;
+		case Common::EVENT_LBUTTONUP:
+			return true;
+		default:
+			break;
+		}
+	}
+	return false;
+}
+
+int KyraEngine_v2::gui_handleMainMenu() {
+	debugC(9, kDebugLevelMain, "KyraEngine_v2::gui_handleMainMenu()");
+	int command = -1;
+	
+	uint8 colorMap[16];
+	memset(colorMap, 0, sizeof(colorMap));
+	_screen->setTextColorMap(colorMap);
+	
+	const char * const *strings = &_mainMenuStrings[_lang << 2];
+	Screen::FontId oldFont = _screen->setFont(Screen::FID_8_FNT);
+	int charWidthBackUp = _screen->_charWidth;
+	
+	_screen->_charWidth = -2;
+	_screen->setScreenDim(3);
+	int backUpX = _screen->_curDim->sx;
+	int backUpY = _screen->_curDim->sy;
+	int backUpWidth = _screen->_curDim->w;
+	int backUpHeight = _screen->_curDim->h;
+	_screen->copyRegion(backUpX, backUpY, backUpX, backUpY, backUpWidth, backUpHeight, 0, 3);
+
+	int x = _screen->_curDim->sx << 3;
+	int y = _screen->_curDim->sy;
+	int width = _screen->_curDim->w << 3;
+	int height =  _screen->_curDim->h;
+
+	gui_drawMainBox(x, y, width, height, 1);
+	gui_drawMainBox(x + 1, y + 1, width - 2, height - 2, 0);
+	
+	int selected = 0;
+	
+	gui_drawMainMenu(strings, selected);
+
+	_screen->showMouse();
+
+	int fh = _screen->getFontHeight();
+	int textPos = ((_screen->_curDim->w >> 1) + _screen->_curDim->sx) << 3;
+
+	Common::Rect menuRect(x + 16, y + 4, x + width - 16, y + 4 + fh * 4);
+	
+	while (!_quitFlag) {
+		gui_updateMainMenuAnimation();
+		bool mousePressed = gui_mainMenuGetInput();
+
+		Common::Point mouse = getMousePos();
+		if (menuRect.contains(mouse)) {
+			int item = (mouse.y - menuRect.top) / fh;
+
+			if (item != selected) {
+				gui_printString(strings[selected], textPos, menuRect.top + selected * fh, 0x80, 0, 5);
+				gui_printString(strings[item], textPos, menuRect.top + item * fh, 0xFF, 0, 5);
+
+				selected = item;
+			}
+
+			if (mousePressed) {
+				// TODO: Flash the text
+				command = item;
+				break;
+			}
+		}
+		_system->delayMillis(10);
+	}
+	
+	if (_quitFlag)
+		command = -1;
+	
+	_screen->copyRegion(backUpX, backUpY, backUpX, backUpY, backUpWidth, backUpHeight, 3, 0);
+	_screen->_charWidth = charWidthBackUp;
+	_screen->setFont(oldFont);
+	
+	return command;
+}
+
+void KyraEngine_v2::gui_drawMainMenu(const char * const *strings, int select) {
+	debugC(9, kDebugLevelMain, "KyraEngine_v2::gui_drawMainMenu(%p)", (const void*)strings);
+	static const uint16 menuTable[] = { 0x01, 0x04, 0x0C, 0x04, 0x00, 0x80, 0xFF, 0x00, 0x01, 0x02, 0x03 };
+	
+	int top = _screen->_curDim->sy;
+	top += menuTable[1];
+	
+	for (int i = 0; i < menuTable[3]; ++i) {
+		int curY = top + i * _screen->getFontHeight();
+		int color = (i == select) ? menuTable[6] : menuTable[5];
+		gui_printString(strings[i], ((_screen->_curDim->w >> 1) + _screen->_curDim->sx) << 3, curY, color, 0, 5);
+	}
+}
+
+void KyraEngine_v2::gui_drawMainBox(int x, int y, int w, int h, int fill) {
+	debugC(9, kDebugLevelMain, "KyraEngine_v2::gui_drawMainBox(%d, %d, %d, %d, %d)", x, y, w, h, fill);
+	static const uint8 kyra3ColorTable[] = { 0x16, 0x19, 0x1A, 0x16 };
+	static const uint8 kyra2ColorTable[] = { 0x0, 0x19, 0x28, 0xc8 };
+	
+	const uint8 *colorTable;
+	if (_flags.gameID == GI_KYRA3)
+		colorTable = kyra3ColorTable;
+	else
+		colorTable = kyra2ColorTable;
+		
+	--w; --h;
+
+	if (fill)
+		_screen->fillRect(x, y, x+w, y+h, colorTable[0]);
+	
+	_screen->drawClippedLine(x, y+h, x+w, y+h, colorTable[1]);
+	_screen->drawClippedLine(x+w, y, x+w, y+h, colorTable[1]);
+	_screen->drawClippedLine(x, y, x+w, y, colorTable[2]);
+	_screen->drawClippedLine(x, y, x, y+h, colorTable[2]);
+	
+	_screen->setPagePixel(_screen->_curPage, x, y+h, colorTable[3]);
+	_screen->setPagePixel(_screen->_curPage, x+w, y, colorTable[3]);
+}
+
+void KyraEngine_v2::gui_printString(const char *format, int x, int y, int col1, int col2, int flags, ...) {
+	debugC(9, kDebugLevelMain, "KyraEngine_v2::gui_printString('%s', %d, %d, %d, %d, %d, ...)", format, x, y, col1, col2, flags);
+	if (!format)
+		return;
+	
+	char string[512];
+	va_list vaList;
+	va_start(vaList, flags);
+	vsprintf(string, format, vaList);
+	va_end(vaList);
+	
+	if (flags & 1)
+		x -= _screen->getTextWidth(string) >> 1;
+	
+	if (flags & 2)
+		x -= _screen->getTextWidth(string);
+	
+	if (flags & 4) {
+		_screen->printText(string, x - 1, y, 240, col2);
+		_screen->printText(string, x, y + 1, 240, col2);
+	}
+	
+	if (flags & 8) {
+		_screen->printText(string, x - 1, y, 227, col2);
+		_screen->printText(string, x, y + 1, 227, col2);
+	}
+	
+	_screen->printText(string, x, y, col1, col2);
+}
+
+} // end of namespace Kyra


Property changes on: scummvm/trunk/engines/kyra/gui_v2.cpp
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + Date Rev Author URL Id
Name: svn:eol-style
   + native

Modified: scummvm/trunk/engines/kyra/items_v1.cpp
===================================================================
--- scummvm/trunk/engines/kyra/items_v1.cpp	2007-07-29 16:29:41 UTC (rev 28295)
+++ scummvm/trunk/engines/kyra/items_v1.cpp	2007-07-29 16:31:29 UTC (rev 28296)
@@ -23,14 +23,14 @@
  *
  */
 
-#include "kyra/kyra.h"
+#include "kyra/kyra_v1.h"
 #include "kyra/seqplayer.h"
 #include "kyra/screen.h"
 #include "kyra/resource.h"
 #include "kyra/sound.h"
 #include "kyra/sprites.h"
 #include "kyra/wsamovie.h"
-#include "kyra/animator.h"
+#include "kyra/animator_v1.h"
 #include "kyra/text.h"
 
 #include "common/system.h"
@@ -38,7 +38,7 @@
 
 namespace Kyra {
 
-int KyraEngine::findDuplicateItemShape(int shape) {
+int KyraEngine_v1::findDuplicateItemShape(int shape) {
 	static uint8 dupTable[] = {
 		0x48, 0x46, 0x49, 0x47, 0x4a, 0x46, 0x4b, 0x47,
 		0x4c, 0x46, 0x4d, 0x47, 0x5b, 0x5a, 0x5c, 0x5a,
@@ -55,8 +55,8 @@
 	return -1;
 }
 
-void KyraEngine::addToNoDropRects(int x, int y, int w, int h) {
-	debugC(9, kDebugLevelMain, "KyraEngine::addToNoDropRects(%d, %d, %d, %d)", x, y, w, h);
+void KyraEngine_v1::addToNoDropRects(int x, int y, int w, int h) {
+	debugC(9, kDebugLevelMain, "KyraEngine_v1::addToNoDropRects(%d, %d, %d, %d)", x, y, w, h);
 	for (int rect = 0; rect < 11; ++rect) {
 		if (_noDropRects[rect].x == -1) {
 			_noDropRects[rect].x = x;
@@ -68,13 +68,13 @@
 	}
 }
 
-void KyraEngine::clearNoDropRects() {
-	debugC(9, kDebugLevelMain, "KyraEngine::clearNoDropRects()");
+void KyraEngine_v1::clearNoDropRects() {
+	debugC(9, kDebugLevelMain, "KyraEngine_v1::clearNoDropRects()");
 	memset(_noDropRects, -1, sizeof(_noDropRects));
 }
 
-byte KyraEngine::findFreeItemInScene(int scene) {
-	debugC(9, kDebugLevelMain, "KyraEngine::findFreeItemInScene(%d)", scene);
+byte KyraEngine_v1::findFreeItemInScene(int scene) {
+	debugC(9, kDebugLevelMain, "KyraEngine_v1::findFreeItemInScene(%d)", scene);
 	assert(scene < _roomTableSize);
 	Room *room = &_roomTable[scene];
 	for (int i = 0; i < 12; ++i) {
@@ -84,8 +84,8 @@
 	return 0xFF;
 }
 
-byte KyraEngine::findItemAtPos(int x, int y) {
-	debugC(9, kDebugLevelMain, "KyraEngine::findItemAtPos(%d, %d)", x, y);
+byte KyraEngine_v1::findItemAtPos(int x, int y) {
+	debugC(9, kDebugLevelMain, "KyraEngine_v1::findItemAtPos(%d, %d)", x, y);
 	assert(_currentCharacter->sceneId < _roomTableSize);
 	const uint8 *itemsTable = _roomTable[_currentCharacter->sceneId].itemsTable;
 	const uint16 *xposOffset = _roomTable[_currentCharacter->sceneId].itemsXPos;
@@ -120,8 +120,8 @@
 	return returnValue;
 }
 
-void KyraEngine::placeItemInGenericMapScene(int item, int index) {
-	debugC(9, kDebugLevelMain, "KyraEngine::placeItemInGenericMapScene(%d, %d)", item, index);
+void KyraEngine_v1::placeItemInGenericMapScene(int item, int index) {
+	debugC(9, kDebugLevelMain, "KyraEngine_v1::placeItemInGenericMapScene(%d, %d)", item, index);
 	static const uint16 itemMapSceneMinTable[] = {
 		0x0000, 0x0011, 0x006D, 0x0025, 0x00C7, 0x0000
 	};
@@ -175,32 +175,32 @@
 	}
 }
 
-void KyraEngine::createMouseItem(int item) {
-	debugC(9, kDebugLevelMain, "KyraEngine::createMouseItem(%d)", item);
+void KyraEngine_v1::createMouseItem(int item) {
+	debugC(9, kDebugLevelMain, "KyraEngine_v1::createMouseItem(%d)", item);
 	_screen->hideMouse();
 	setMouseItem(item);
 	_itemInHand = item;
 	_screen->showMouse();
 }
 
-void KyraEngine::destroyMouseItem() {
-	debugC(9, kDebugLevelMain, "KyraEngine::destroyMouseItem()");
+void KyraEngine_v1::destroyMouseItem() {
+	debugC(9, kDebugLevelMain, "KyraEngine_v1::destroyMouseItem()");
 	_screen->hideMouse();
 	_screen->setMouseCursor(1, 1, _shapes[0]);
 	_itemInHand = -1;
 	_screen->showMouse();
 }
 
-void KyraEngine::setMouseItem(int item) {
-	debugC(9, kDebugLevelMain, "KyraEngine::setMouseItem(%d)", item);
+void KyraEngine_v1::setMouseItem(int item) {
+	debugC(9, kDebugLevelMain, "KyraEngine_v1::setMouseItem(%d)", item);
 	if (item == -1)
 		_screen->setMouseCursor(1, 1, _shapes[6]);
 	else
 		_screen->setMouseCursor(8, 15, _shapes[216+item]);
 }
 
-void KyraEngine::wipeDownMouseItem(int xpos, int ypos) {
-	debugC(9, kDebugLevelMain, "KyraEngine::wipeDownMouseItem(%d, %d)", xpos, ypos);
+void KyraEngine_v1::wipeDownMouseItem(int xpos, int ypos) {
+	debugC(9, kDebugLevelMain, "KyraEngine_v1::wipeDownMouseItem(%d, %d)", xpos, ypos);
 	if (_itemInHand == -1)
 		return;
 	xpos -= 8;
@@ -226,8 +226,8 @@
 	_screen->showMouse();
 }
 
-void KyraEngine::setupSceneItems() {
-	debugC(9, kDebugLevelMain, "KyraEngine::setupSceneItems()");
+void KyraEngine_v1::setupSceneItems() {
+	debugC(9, kDebugLevelMain, "KyraEngine_v1::setupSceneItems()");
 	uint16 sceneId = _currentCharacter->sceneId;
 	assert(sceneId < _roomTableSize);
 	Room *currentRoom = &_roomTable[sceneId];
@@ -264,8 +264,8 @@
 	}
 }
 
-int KyraEngine::countItemsInScene(uint16 sceneId) {
-	debugC(9, kDebugLevelMain, "KyraEngine::countItemsInScene(%d)", sceneId);
+int KyraEngine_v1::countItemsInScene(uint16 sceneId) {
+	debugC(9, kDebugLevelMain, "KyraEngine_v1::countItemsInScene(%d)", sceneId);
 	assert(sceneId < _roomTableSize);
 	Room *currentRoom = &_roomTable[sceneId];
 	
@@ -279,8 +279,8 @@
 	return items;
 }
 
-int KyraEngine::processItemDrop(uint16 sceneId, uint8 item, int x, int y, int unk1, int unk2) {
-	debugC(9, kDebugLevelMain, "KyraEngine::processItemDrop(%d, %d, %d, %d, %d, %d)", sceneId, item, x, y, unk1, unk2);
+int KyraEngine_v1::processItemDrop(uint16 sceneId, uint8 item, int x, int y, int unk1, int unk2) {
+	debugC(9, kDebugLevelMain, "KyraEngine_v1::processItemDrop(%d, %d, %d, %d, %d, %d)", sceneId, item, x, y, unk1, unk2);
 	int freeItem = -1;
 	uint8 itemIndex = findItemAtPos(x, y);
 	if (unk1)
@@ -432,8 +432,8 @@
 	return 1;
 }
 
-void KyraEngine::exchangeItemWithMouseItem(uint16 sceneId, int itemIndex) {
-	debugC(9, kDebugLevelMain, "KyraEngine::exchangeItemWithMouseItem(%d, %d)", sceneId, itemIndex);
+void KyraEngine_v1::exchangeItemWithMouseItem(uint16 sceneId, int itemIndex) {
+	debugC(9, kDebugLevelMain, "KyraEngine_v1::exchangeItemWithMouseItem(%d, %d)", sceneId, itemIndex);
 	_screen->hideMouse();
 	_animator->animRemoveGameItem(itemIndex);
 	assert(sceneId < _roomTableSize);
@@ -452,8 +452,8 @@
 	clickEventHandler2();
 }
 
-void KyraEngine::addItemToRoom(uint16 sceneId, uint8 item, int itemIndex, int x, int y) {
-	debugC(9, kDebugLevelMain, "KyraEngine::addItemToRoom(%d, %d, %d, %d, %d)", sceneId, item, itemIndex, x, y);
+void KyraEngine_v1::addItemToRoom(uint16 sceneId, uint8 item, int itemIndex, int x, int y) {
+	debugC(9, kDebugLevelMain, "KyraEngine_v1::addItemToRoom(%d, %d, %d, %d, %d)", sceneId, item, itemIndex, x, y);
 	assert(sceneId < _roomTableSize);
 	Room *currentRoom = &_roomTable[sceneId];
 	currentRoom->itemsTable[itemIndex] = item;
@@ -462,8 +462,8 @@
 	currentRoom->needInit[itemIndex] = 1;
 }
 
-int KyraEngine::checkNoDropRects(int x, int y) {
-	debugC(9, kDebugLevelMain, "KyraEngine::checkNoDropRects(%d, %d)", x, y);
+int KyraEngine_v1::checkNoDropRects(int x, int y) {
+	debugC(9, kDebugLevelMain, "KyraEngine_v1::checkNoDropRects(%d, %d)", x, y);
 	if (_lastProcessedItemHeight < 1 || _lastProcessedItemHeight > 16)
 		_lastProcessedItemHeight = 16;
 	if (_noDropRects[0].x == -1)
@@ -492,8 +492,8 @@
 	return 0;
 }
 
-int KyraEngine::isDropable(int x, int y) {
-	debugC(9, kDebugLevelMain, "KyraEngine::isDropable(%d, %d)", x, y);
+int KyraEngine_v1::isDropable(int x, int y) {
+	debugC(9, kDebugLevelMain, "KyraEngine_v1::isDropable(%d, %d)", x, y);
 	x -= 8;
 	y -= 1;
 	
@@ -507,8 +507,8 @@
 	return 1;
 }
 
-void KyraEngine::itemDropDown(int x, int y, int destX, int destY, byte freeItem, int item) {
-	debugC(9, kDebugLevelMain, "KyraEngine::itemDropDown(%d, %d, %d, %d, %d, %d)", x, y, destX, destY, freeItem, item);
+void KyraEngine_v1::itemDropDown(int x, int y, int destX, int destY, byte freeItem, int item) {
+	debugC(9, kDebugLevelMain, "KyraEngine_v1::itemDropDown(%d, %d, %d, %d, %d, %d)", x, y, destX, destY, freeItem, item);
 	assert(_currentCharacter->sceneId < _roomTableSize);
 	Room *currentRoom = &_roomTable[_currentCharacter->sceneId];
 	if (x == destX && y == destY) {
@@ -591,8 +591,8 @@
 	_screen->showMouse();
 }
 
-void KyraEngine::dropItem(int unk1, int item, int x, int y, int unk2) {
-	debugC(9, kDebugLevelMain, "KyraEngine::dropItem(%d, %d, %d, %d, %d)", unk1, item, x, y, unk2);
+void KyraEngine_v1::dropItem(int unk1, int item, int x, int y, int unk2) {
+	debugC(9, kDebugLevelMain, "KyraEngine_v1::dropItem(%d, %d, %d, %d, %d)", unk1, item, x, y, unk2);
 	if (processItemDrop(_currentCharacter->sceneId, item, x, y, unk1, unk2))
 		return;
 	snd_playSoundEffect(54);
@@ -603,16 +603,16 @@
 		drawSentenceCommand(_noDropList[1], 6);
 }
 
-void KyraEngine::itemSpecialFX(int x, int y, int item) {
-	debugC(9, kDebugLevelMain, "KyraEngine::itemSpecialFX(%d, %d, %d)", x, y, item);
+void KyraEngine_v1::itemSpecialFX(int x, int y, int item) {
+	debugC(9, kDebugLevelMain, "KyraEngine_v1::itemSpecialFX(%d, %d, %d)", x, y, item);
 	if (item == 41)
 		itemSpecialFX1(x, y, item);
 	else
 		itemSpecialFX2(x, y, item);
 }
 
-void KyraEngine::itemSpecialFX1(int x, int y, int item) {
-	debugC(9, kDebugLevelMain, "KyraEngine::itemSpecialFX1(%d, %d, %d)", x, y, item);
+void KyraEngine_v1::itemSpecialFX1(int x, int y, int item) {
+	debugC(9, kDebugLevelMain, "KyraEngine_v1::itemSpecialFX1(%d, %d, %d)", x, y, item);
 	uint8 *shape = _shapes[216+item];
 	x -= 8;
 	int startY = y;
@@ -632,8 +632,8 @@
 	_screen->showMouse();
 }
 
-void KyraEngine::itemSpecialFX2(int x, int y, int item) {
-	debugC(9, kDebugLevelMain, "KyraEngine::itemSpecialFX2(%d, %d, %d)", x, y, item);
+void KyraEngine_v1::itemSpecialFX2(int x, int y, int item) {
+	debugC(9, kDebugLevelMain, "KyraEngine_v1::itemSpecialFX2(%d, %d, %d)", x, y, item);
 	x -= 8;
 	y -= 15;
 	int yAdd = (int8)(((16 - _itemTable[item].height) >> 1) & 0xFF);
@@ -660,8 +660,8 @@
 	restoreItemRect0(x, y);
 }
 
-void KyraEngine::magicOutMouseItem(int animIndex, int itemPos) {
-	debugC(9, kDebugLevelMain, "KyraEngine::magicOutMouseItem(%d, %d)", animIndex, itemPos);
+void KyraEngine_v1::magicOutMouseItem(int animIndex, int itemPos) {
+	debugC(9, kDebugLevelMain, "KyraEngine_v1::magicOutMouseItem(%d, %d)", animIndex, itemPos);
 	int videoPageBackUp = _screen->_curPage;
 	_screen->_curPage = 0;
 	int x = 0, y = 0;
@@ -744,8 +744,8 @@
 	_screen->_curPage = videoPageBackUp;
 }
 
-void KyraEngine::magicInMouseItem(int animIndex, int item, int itemPos) {
-	debugC(9, kDebugLevelMain, "KyraEngine::magicInMouseItem(%d, %d, %d)", animIndex, item, itemPos);
+void KyraEngine_v1::magicInMouseItem(int animIndex, int item, int itemPos) {
+	debugC(9, kDebugLevelMain, "KyraEngine_v1::magicInMouseItem(%d, %d, %d)", animIndex, item, itemPos);
 	int videoPageBackUp = _screen->_curPage;
 	_screen->_curPage = 0;
 	int x = 0, y = 0;
@@ -817,8 +817,8 @@
 	_screen->_curPage = videoPageBackUp;
 }
 
-void KyraEngine::specialMouseItemFX(int shape, int x, int y, int animIndex, int tableIndex, int loopStart, int maxLoops) {
-	debugC(9, kDebugLevelMain, "KyraEngine::specialMouseItemFX(%d, %d, %d, %d, %d, %d, %d)", shape, x, y, animIndex, tableIndex, loopStart, maxLoops);
+void KyraEngine_v1::specialMouseItemFX(int shape, int x, int y, int animIndex, int tableIndex, int loopStart, int maxLoops) {
+	debugC(9, kDebugLevelMain, "KyraEngine_v1::specialMouseItemFX(%d, %d, %d, %d, %d, %d, %d)", shape, x, y, animIndex, tableIndex, loopStart, maxLoops);
 	static const uint8 table1[] = {
 		0x23, 0x45, 0x55, 0x72, 0x84, 0xCF, 0x00, 0x00
 	};
@@ -840,8 +840,8 @@
 	processSpecialMouseItemFX(shape, x, y, tableValue, loopStart, maxLoops);
 }
 
-void KyraEngine::processSpecialMouseItemFX(int shape, int x, int y, int tableValue, int loopStart, int maxLoops) {
-	debugC(9, kDebugLevelMain, "KyraEngine::processSpecialMouseItemFX(%d, %d, %d, %d, %d, %d)", shape, x, y, tableValue, loopStart, maxLoops);
+void KyraEngine_v1::processSpecialMouseItemFX(int shape, int x, int y, int tableValue, int loopStart, int maxLoops) {
+	debugC(9, kDebugLevelMain, "KyraEngine_v1::processSpecialMouseItemFX(%d, %d, %d, %d, %d, %d)", shape, x, y, tableValue, loopStart, maxLoops);
 	uint8 shapeColorTable[16];
 	uint8 *shapePtr = _shapes[shape] + 10;
 	if (_flags.useAltShapeHeader)
@@ -859,8 +859,8 @@
 	_screen->drawShape(0, _shapes[shape], x, y, 0, 0x8000, shapeColorTable);
 }
 
-void KyraEngine::updatePlayerItemsForScene() {
-	debugC(9, kDebugLevelMain, "KyraEngine::updatePlayerItemsForScene()");
+void KyraEngine_v1::updatePlayerItemsForScene() {
+	debugC(9, kDebugLevelMain, "KyraEngine_v1::updatePlayerItemsForScene()");
 	if (_itemInHand >= 29 && _itemInHand < 33) {
 		++_itemInHand;
 		if (_itemInHand > 33)
@@ -900,7 +900,7 @@
 	_screen->showMouse();
 }
 
-void KyraEngine::redrawInventory(int page) {
+void KyraEngine_v1::redrawInventory(int page) {
 	int videoPageBackUp = _screen->_curPage;
 	_screen->_curPage = page;
 	_screen->hideMouse();
@@ -916,26 +916,26 @@
 	_screen->updateScreen();
 }
 
-void KyraEngine::backUpItemRect0(int xpos, int ypos) {
-	debugC(9, kDebugLevelMain, "KyraEngine::backUpItemRect0(%d, %d)", xpos, ypos);
+void KyraEngine_v1::backUpItemRect0(int xpos, int ypos) {
+	debugC(9, kDebugLevelMain, "KyraEngine_v1::backUpItemRect0(%d, %d)", xpos, ypos);
 	_screen->rectClip(xpos, ypos, 3<<3, 24);
 	_screen->copyRegionToBuffer(_screen->_curPage, xpos, ypos, 3<<3, 24, _itemBkgBackUp[0]);
 }
 
-void KyraEngine::restoreItemRect0(int xpos, int ypos) {
-	debugC(9, kDebugLevelMain, "KyraEngine::restoreItemRect0(%d, %d)", xpos, ypos);
+void KyraEngine_v1::restoreItemRect0(int xpos, int ypos) {
+	debugC(9, kDebugLevelMain, "KyraEngine_v1::restoreItemRect0(%d, %d)", xpos, ypos);
 	_screen->rectClip(xpos, ypos, 3<<3, 24);
 	_screen->copyBlockToPage(_screen->_curPage, xpos, ypos, 3<<3, 24, _itemBkgBackUp[0]);
 }
 
-void KyraEngine::backUpItemRect1(int xpos, int ypos) {
-	debugC(9, kDebugLevelMain, "KyraEngine::backUpItemRect1(%d, %d)", xpos, ypos);
+void KyraEngine_v1::backUpItemRect1(int xpos, int ypos) {
+	debugC(9, kDebugLevelMain, "KyraEngine_v1::backUpItemRect1(%d, %d)", xpos, ypos);
 	_screen->rectClip(xpos, ypos, 4<<3, 32);
 	_screen->copyRegionToBuffer(_screen->_curPage, xpos, ypos, 4<<3, 32, _itemBkgBackUp[1]);
 }
 
-void KyraEngine::restoreItemRect1(int xpos, int ypos) {
-	debugC(9, kDebugLevelMain, "KyraEngine::restoreItemRect1(%d, %d)", xpos, ypos);
+void KyraEngine_v1::restoreItemRect1(int xpos, int ypos) {
+	debugC(9, kDebugLevelMain, "KyraEngine_v1::restoreItemRect1(%d, %d)", xpos, ypos);
 	_screen->rectClip(xpos, ypos, 4<<3, 32);
 	_screen->copyBlockToPage(_screen->_curPage, xpos, ypos, 4<<3, 32, _itemBkgBackUp[1]);
 }

Modified: scummvm/trunk/engines/kyra/kyra.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra.cpp	2007-07-29 16:29:41 UTC (rev 28295)
+++ scummvm/trunk/engines/kyra/kyra.cpp	2007-07-29 16:31:29 UTC (rev 28296)
@@ -26,92 +26,32 @@
 #include "common/stdafx.h"
 
 #include "common/config-manager.h"
-#include "common/file.h"
-#include "common/events.h"
-#include "common/system.h"
-#include "common/savefile.h"
 
-#include "sound/mixer.h"
 #include "sound/mididrv.h"
+#include "sound/mixer.h"
 
-#include "gui/message.h"
-
 #include "kyra/kyra.h"
+#include "kyra/sound.h"
 #include "kyra/resource.h"
 #include "kyra/screen.h"
-#include "kyra/script.h"
-#include "kyra/seqplayer.h"
-#include "kyra/sound.h"
-#include "kyra/sprites.h"
-#include "kyra/wsamovie.h"
-#include "kyra/animator.h"
 #include "kyra/text.h"
-#include "kyra/debugger.h"
 
 namespace Kyra {
 
 KyraEngine::KyraEngine(OSystem *system, const GameFlags &flags)
 	: Engine(system) {
-	_flags = flags;
-
-	_seq_Forest = _seq_KallakWriting = _seq_KyrandiaLogo = _seq_KallakMalcolm =
-	_seq_MalcolmTree = _seq_WestwoodLogo = _seq_Demo1 = _seq_Demo2 = _seq_Demo3 =
-	_seq_Demo4 = 0;
-	
-	_seq_WSATable = _seq_CPSTable = _seq_COLTable = _seq_textsTable = 0;
-	_seq_WSATable_Size = _seq_CPSTable_Size = _seq_COLTable_Size = _seq_textsTable_Size = 0;
-	
-	_roomFilenameTable = _characterImageTable = 0;
-	_roomFilenameTableSize = _characterImageTableSize = 0;
-	_itemList = _takenList = _placedList = _droppedList = _noDropList = 0;
-	_itemList_Size = _takenList_Size = _placedList_Size = _droppedList_Size = _noDropList_Size = 0;
-	_putDownFirst = _waitForAmulet = _blackJewel = _poisonGone = _healingTip = 0;
-	_putDownFirst_Size = _waitForAmulet_Size = _blackJewel_Size = _poisonGone_Size = _healingTip_Size = 0;
-	_thePoison = _fluteString = _wispJewelStrings = _magicJewelString = _flaskFull = _fullFlask = 0;
-	_thePoison_Size = _fluteString_Size = _wispJewelStrings_Size = 0;
-	_magicJewelString_Size = _flaskFull_Size = _fullFlask_Size = 0;
-	
-	_defaultShapeTable = 0;
-	_healingShapeTable = _healingShape2Table = 0;
-	_defaultShapeTableSize = _healingShapeTableSize = _healingShape2TableSize = 0;
-	_posionDeathShapeTable = _fluteAnimShapeTable = 0;
-	_posionDeathShapeTableSize = _fluteAnimShapeTableSize = 0;
-	_winterScrollTable = _winterScroll1Table = _winterScroll2Table = 0;
-	_winterScrollTableSize = _winterScroll1TableSize = _winterScroll2TableSize = 0;
-	_drinkAnimationTable = _brandonToWispTable = _magicAnimationTable = _brandonStoneTable = 0;
-	_drinkAnimationTableSize = _brandonToWispTableSize = _magicAnimationTableSize = _brandonStoneTableSize = 0;
-	memset(&_specialPalettes, 0, sizeof(_specialPalettes));
-	_debugger = 0;
-	_sprites = 0;
-	_animator = 0;
 	_screen = 0;
 	_res = 0;
 	_sound = 0;
-	_seq = 0;
-	_scriptInterpreter = 0;
 	_text = 0;
-	_npcScriptData = 0;
-	_scriptMain = 0;
-	_scriptClickData = 0;
-	_scriptClick = 0;
-	_characterList = 0;
-	_movFacingTable = 0;
-	memset(_shapes, 0, sizeof(_shapes));
-	memset(_movieObjects, 0, sizeof(_movieObjects));
-	_finalA = _finalB = _finalC = 0;
-	_endSequenceBackUpRect = 0;
-	memset(_panPagesTable, 0, sizeof(_panPagesTable));
-	_npcScriptData = _scriptClickData = 0;
-	_scrollUpButton.process0PtrShape = _scrollUpButton.process1PtrShape = _scrollUpButton.process2PtrShape = 0;
-	_scrollDownButton.process0PtrShape = _scrollDownButton.process1PtrShape = _scrollDownButton.process2PtrShape = 0;
-	memset(_sceneAnimTable, 0, sizeof(_sceneAnimTable));
+	_staticres = 0;
+	
 	_quitFlag = false;
-	_currHeadShape = 0;
+	
+	_skipFlag = false;
+	
+	memset(_flagsTable, 0, sizeof(_flagsTable));
 
-	_curSfxFile = _curMusicTheme = 0;
-
-	memset(&_itemBkgBackUp, 0, sizeof(_itemBkgBackUp));
-
 	// sets up all engine specific debug levels
 	Common::addSpecialDebugLevel(kDebugLevelScriptFuncs, "ScriptFuncs", "Script function debug level");
 	Common::addSpecialDebugLevel(kDebugLevelScript, "Script", "Script interpreter debug level");
@@ -133,18 +73,10 @@
 	_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"));
-
-	_screen = new Screen(this, _system);
-	assert(_screen);
-	if (!_screen->init())
-		error("_screen->init() failed");
-
-	// for now we prefer Adlib over native MIDI
+	
+		// for now we prefer Adlib over native MIDI
 	int midiDriver = MidiDriver::detectMusicDriver(MDT_MIDI | MDT_ADLIB/* | MDT_PREFER_MIDI*/);
 
-	// TODO: We should play the native Kyra 2 Adlib music, but until that
-	//       is support, we'll use the automagic MIDI -> Adlib converter.
-
 	if (_flags.platform == Common::kPlatformFMTowns) {
 		// no sfx enabled for CD audio music atm
 		// later on here should be a usage of MixedSoundDriver
@@ -183,156 +115,13 @@
 
 	_res = new Resource(this);
 	assert(_res);
-	_sprites = new Sprites(this, _system);
-	assert(_sprites);
-	_seq = new SeqPlayer(this, _system);
-	assert(_seq);
-	_animator = new ScreenAnimator(this, _system);
-	assert(_animator);
-	_animator->init(5, 11, 12);
-	assert(*_animator);
 	_text = new TextDisplayer(this, _screen);
 	assert(_text);
-
 	_staticres = new StaticResource(this);
 	assert(_staticres);
 	if (!_staticres->init())
 		error("_staticres->init() failed");
-	
-	initStaticResource();
-	
-	if (!_sound->init())
-		error("Couldn't init sound");
 
-	if (_flags.platform == Common::kPlatformFMTowns)
-		_sound->setSoundFileList(_soundFilesTowns, _soundFilesTownsCount);
-	else
-		_sound->setSoundFileList(_soundFiles, _soundFilesCount);
-
-	_sound->setVolume(255);
-	_sound->loadSoundFile(0);
-
-	setupOpcodeTable();
-	setupButtonData();
-	setupMenu();
-
-	_paletteChanged = 1;
-	_currentCharacter = 0;
-	_characterList = new Character[11];
-	assert(_characterList);
-	memset(_characterList, 0, sizeof(Character)*11);
-
-	for (int i = 0; i < 11; ++i)
-		memset(_characterList[i].inventoryItems, 0xFF, sizeof(_characterList[i].inventoryItems));
-
-	_characterList[0].sceneId = 5;
-	_characterList[0].height = 48;
-	_characterList[0].facing = 3;
-	_characterList[0].currentAnimFrame = 7;
-	
-	_scriptInterpreter = new ScriptHelper(this);
-	assert(_scriptInterpreter);
-	
-	_npcScriptData = new ScriptData;
-	memset(_npcScriptData, 0, sizeof(ScriptData));
-	assert(_npcScriptData);
-	_npcScript = new ScriptState;
-	assert(_npcScript);
-	memset(_npcScript, 0, sizeof(ScriptState));
-	
-	_scriptMain = new ScriptState;
-	assert(_scriptMain);
-	memset(_scriptMain, 0, sizeof(ScriptState));
-	
-	_scriptClickData = new ScriptData;
-	assert(_scriptClickData);
-	memset(_scriptClickData, 0, sizeof(ScriptData));
-	_scriptClick = new ScriptState;
-	assert(_scriptClick);
-	memset(_scriptClick, 0, sizeof(ScriptState));
-	
-	_debugger = new Debugger(this);
-	assert(_debugger);	
-	memset(_shapes, 0, sizeof(_shapes));
-
-	for (int i = 0; i < ARRAYSIZE(_movieObjects); ++i)
-		_movieObjects[i] = createWSAMovie();
-
-	memset(_flagsTable, 0, sizeof(_flagsTable));
-
-	_abortWalkFlag = false;
-	_abortWalkFlag2 = false;
-	_talkingCharNum = -1;
-	_charSayUnk3 = -1;
-	memset(_currSentenceColor, 0, 3);
-	_startSentencePalIndex = -1;
-	_fadeText = false;
-
-	_cauldronState = 0;
-	_crystalState[0] = _crystalState[1] = -1;
-
-	_brandonStatusBit = 0;
-	_brandonStatusBit0x02Flag = _brandonStatusBit0x20Flag = 10;
-	_brandonPosX = _brandonPosY = -1;
-	_deathHandler = 0xFF;
-	_poisonDeathCounter = 0;
-	
-	memset(_itemTable, 0, sizeof(_itemTable));
-	memset(_exitList, 0xFFFF, sizeof(_exitList));
-	_exitListPtr = 0;
-	_pathfinderFlag = _pathfinderFlag2 = 0;
-	_lastFindWayRet = 0;
-	_sceneChangeState = _loopFlag2 = 0;
-	_timerNextRun = 0;
-
-	_movFacingTable = new int[150];
-	assert(_movFacingTable);
-	_movFacingTable[0] = 8;
-
-	registerDefaultSettings();
-	readSettings();
-
-	_skipFlag = false;
-
-	_marbleVaseItem = -1;
-	memset(_foyerItemTable, -1, sizeof(_foyerItemTable));
-	_mouseState = _itemInHand = -1;
-	_handleInput = false;
-	
-	_currentRoom = 0xFFFF;
-	_scenePhasingFlag = 0;
-	_lastProcessedItem = 0;
-	_lastProcessedItemHeight = 16;
-	
-	_unkScreenVar1 = 1;
-	_unkScreenVar2 = 0;
-	_unkScreenVar3 = 0;
-	_unkAmuletVar = 0;
-	
-	_endSequenceNeedLoading = 1;
-	_malcolmFlag = 0;
-	_beadStateVar = 0;
-	_endSequenceSkipFlag = 0;
-	_unkEndSeqVar2 = 0;
-	_endSequenceBackUpRect = 0;
-	_unkEndSeqVar4 = 0;
-	_unkEndSeqVar5 = 0;
-	_lastDisplayedPanPage = 0;
-	memset(_panPagesTable, 0, sizeof(_panPagesTable));
-	_finalA = _finalB = _finalC = 0;
-	memset(&_kyragemFadingState, 0, sizeof(_kyragemFadingState));	
-	_kyragemFadingState.gOffset = 0x13;
-	_kyragemFadingState.bOffset = 0x13;
-
-	_mousePressFlag = false;
-	
-	_menuDirectlyToLoad = false;
-
-	_lastMusicCommand = 0;
-
-	_gameSpeed = 60;
-	_tickLength = (uint8)(1000.0 / _gameSpeed);
-
 	_lang = 0;
 	Common::Language lang = Common::parseLanguage(ConfMan.get("language"));
 
@@ -363,435 +152,34 @@
 }
 
 KyraEngine::~KyraEngine() {
-	for (int i = 0; i < ARRAYSIZE(_movieObjects); ++i) {
-		if (_movieObjects[i])
-			_movieObjects[i]->close();
-		delete _movieObjects[i];
-		_movieObjects[i] = 0;
-	}
-
-	closeFinalWsa();
-	if (_scriptInterpreter) {
-		_scriptInterpreter->unloadScript(_npcScriptData);
-		_scriptInterpreter->unloadScript(_scriptClickData);
-	}
-
-	Common::clearAllSpecialDebugLevels();
-
-	delete _debugger;
-	delete _sprites;
-	delete _animator;
-	delete _screen;
 	delete _res;
 	delete _sound;
-	delete _seq;
-	delete _scriptInterpreter;
 	delete _text;
-	
-	delete _npcScriptData;
-	delete _scriptMain;
-	
-	delete _scriptClickData;
-	delete _scriptClick;
-	
-	delete [] _characterList;
-	
-	delete [] _movFacingTable;
-
-	delete [] _scrollUpButton.process0PtrShape;
-	delete [] _scrollUpButton.process1PtrShape;
-	delete [] _scrollUpButton.process2PtrShape;
-	delete [] _scrollDownButton.process0PtrShape;
-	delete [] _scrollDownButton.process1PtrShape;
-	delete [] _scrollDownButton.process2PtrShape;
-
-	delete [] _itemBkgBackUp[0];
-	delete [] _itemBkgBackUp[1];	
-
-	for (int i = 0; i < ARRAYSIZE(_shapes); ++i) {
-		if (_shapes[i] != 0) {
-			delete [] _shapes[i];
-			for (int i2 = 0; i2 < ARRAYSIZE(_shapes); i2++) {
-				if (_shapes[i2] == _shapes[i] && i2 != i) {
-					_shapes[i2] = 0;
-				}
-			}
-			_shapes[i] = 0;
-		}
-	}
-
-	for (int i = 0; i < ARRAYSIZE(_sceneAnimTable); ++i)
-		delete [] _sceneAnimTable[i];
 }
 
-int KyraEngine::go() {
-	if (_res->getFileSize("6.FNT"))
-		_screen->loadFont(Screen::FID_6_FNT, "6.FNT");
-	_screen->loadFont(Screen::FID_8_FNT, "8FAT.FNT");
-	_screen->setScreenDim(0);
-
-	_abortIntroFlag = false;
-
-	if (_flags.isDemo) {
-		seq_demo();
-	} else {
-		setGameFlag(0xF3);
-		setGameFlag(0xFD);
-		setGameFlag(0xEF);
-		seq_intro();
-		if (_quitFlag)
-			return 0;
-		if (_skipIntroFlag && _abortIntroFlag)
-			resetGameFlag(0xEF);
-		startup();
-		resetGameFlag(0xEF);
-		mainLoop();
-	}
-	return 0;
-}
-
-
-void KyraEngine::startup() {
-	debugC(9, kDebugLevelMain, "KyraEngine::startup()");
-	static const uint8 colorMap[] = { 0, 0, 0, 0, 12, 12, 12, 0, 0, 0, 0, 0 };
-	_screen->setTextColorMap(colorMap);
-//	_screen->setFont(Screen::FID_6_FNT);
-	_screen->setAnimBlockPtr(3750);
-	memset(_sceneAnimTable, 0, sizeof(_sceneAnimTable));
-	loadMouseShapes();
-	_currentCharacter = &_characterList[0];
-	for (int i = 1; i < 5; ++i)
-		_animator->setCharacterDefaultFrame(i);
-	for (int i = 5; i <= 10; ++i)
-		setCharactersPositions(i);
-	_animator->setCharactersHeight();
-	resetBrandonPoisonFlags();
-	_screen->_curPage = 0;
-	// XXX
-	for (int i = 0; i < 12; ++i) {
-		int size = _screen->getRectSize(3, 24);
-		_shapes[361+i] = new byte[size];
-	}
-
-	_itemBkgBackUp[0] = new uint8[_screen->getRectSize(3, 24)];
-	memset(_itemBkgBackUp[0], 0, _screen->getRectSize(3, 24));
-	_itemBkgBackUp[1] = new uint8[_screen->getRectSize(4, 32)];
-	memset(_itemBkgBackUp[1], 0, _screen->getRectSize(4, 32));
-
-	for (int i = 0; i < _roomTableSize; ++i) {
-		for (int item = 0; item < 12; ++item) {
-			_roomTable[i].itemsTable[item] = 0xFF;
-			_roomTable[i].itemsXPos[item] = 0xFFFF;
-			_roomTable[i].itemsYPos[item] = 0xFF;
-			_roomTable[i].needInit[item] = 0;
-		}
-	}
-
-	loadCharacterShapes();
-	loadSpecialEffectShapes();
-	loadItems();
-	loadButtonShapes();
-	initMainButtonList();
-	loadMainScreen();
-	setupTimers();
-	_screen->loadPalette("PALETTE.COL", _screen->_currentPalette);
-
-	// XXX
-	_animator->initAnimStateList();
-	setCharactersInDefaultScene();
-
-	if (!_scriptInterpreter->loadScript("_STARTUP.EMC", _npcScriptData, &_opcodes))
-		error("Could not load \"_STARTUP.EMC\" script");
-	_scriptInterpreter->initScript(_scriptMain, _npcScriptData);
-
-	if (!_scriptInterpreter->startScript(_scriptMain, 0))
-		error("Could not start script function 0 of script \"_STARTUP.EMC\"");
-
-	while (_scriptInterpreter->validScript(_scriptMain))
-		_scriptInterpreter->runScript(_scriptMain);
-	
-	_scriptInterpreter->unloadScript(_npcScriptData);
-
-	if (!_scriptInterpreter->loadScript("_NPC.EMC", _npcScriptData, &_opcodes))
-		error("Could not load \"_NPC.EMC\" script");
-	
-	snd_playTheme(1);
-	enterNewScene(_currentCharacter->sceneId, _currentCharacter->facing, 0, 0, 1);
-	
-	if (_abortIntroFlag && _skipIntroFlag) {
-		_menuDirectlyToLoad = true;
-		_screen->setMouseCursor(1, 1, _shapes[0]);
-		_screen->showMouse();
-		buttonMenuCallback(0);
-		_menuDirectlyToLoad = false;
-	} else
-		saveGame(getSavegameFilename(0), "New game");
-}
-
-void KyraEngine::mainLoop() {
-	debugC(9, kDebugLevelMain, "KyraEngine::mainLoop()");
-
-	while (!_quitFlag) {
-		int32 frameTime = (int32)_system->getMillis();
-		_skipFlag = false;
-
-		if (_currentCharacter->sceneId == 210) {
-			updateKyragemFading();
-			if (seq_playEnd() && _deathHandler != 8)
-				break;
-		}
-		
-		if (_deathHandler != 0xFF) {
-			snd_playWanderScoreViaMap(0, 1);
-			snd_playSoundEffect(49);
-			_screen->hideMouse();
-			_screen->setMouseCursor(1, 1, _shapes[0]);
-			destroyMouseItem();
-			_screen->showMouse();
-			buttonMenuCallback(0);
-			_deathHandler = 0xFF;
-		}
-		
-		if ((_brandonStatusBit & 2) && _brandonStatusBit0x02Flag)
-			_animator->animRefreshNPC(0);
-
-		if ((_brandonStatusBit & 0x20) && _brandonStatusBit0x20Flag) {
-			_animator->animRefreshNPC(0);
-			_brandonStatusBit0x20Flag = 0;
-		}
-		
-		_screen->showMouse();
-
-		processButtonList(_buttonList);
-		updateMousePointer();
-		updateGameTimers();
-		updateTextFade();
-
-		_handleInput = true;
-		delay((frameTime + _gameSpeed) - _system->getMillis(), true, true);
-		_handleInput = false;
-
-		_sound->process();
-	}
-}
-
 void KyraEngine::quitGame() {
 	debugC(9, kDebugLevelMain, "KyraEngine::quitGame()");
 	_quitFlag = true;
 	// Nothing to do here
 }
 
-void KyraEngine::delayUntil(uint32 timestamp, bool updateTimers, bool update, bool isMainLoop) {
-	while (_system->getMillis() < timestamp && !_quitFlag) {
-		if (updateTimers)
-			updateGameTimers();
-
-		if (timestamp - _system->getMillis() >= 10)
-			delay(10, update, isMainLoop);
-	}
-}
-
-void KyraEngine::delay(uint32 amount, bool update, bool isMainLoop) {
-	Common::Event event;
-	char saveLoadSlot[20];
-	char savegameName[14];
-
-	uint32 start = _system->getMillis();
-	do {
-		while (_eventMan->pollEvent(event)) {
-			switch (event.type) {
-			case Common::EVENT_KEYDOWN:
-				if (event.kbd.keycode >= '1' && event.kbd.keycode <= '9' && 
-						(event.kbd.flags == Common::KBD_CTRL || event.kbd.flags == Common::KBD_ALT) && isMainLoop) {
-					sprintf(saveLoadSlot, "%s.00%d", _targetName.c_str(), event.kbd.keycode - '0');
-					if (event.kbd.flags == Common::KBD_CTRL)
-						loadGame(saveLoadSlot);
-					else {
-						sprintf(savegameName, "Quicksave %d",  event.kbd.keycode - '0');
-						saveGame(saveLoadSlot, savegameName);
-					}
-				} else if (event.kbd.flags == Common::KBD_CTRL) {
-					if (event.kbd.keycode == 'd')
-						_debugger->attach();
-					else if (event.kbd.keycode == 'q')
-						_quitFlag = true;
-				} else if (event.kbd.keycode == '.')
-						_skipFlag = true;
-				else if (event.kbd.keycode == Common::KEYCODE_RETURN || event.kbd.keycode == Common::KEYCODE_SPACE || event.kbd.keycode == Common::KEYCODE_ESCAPE) {
-					_abortIntroFlag = true;
-					_skipFlag = true;
-				}
-
-				break;
-			case Common::EVENT_MOUSEMOVE:
-				_animator->_updateScreen = true;
-				break;
-			case Common::EVENT_QUIT:
-				quitGame();
-				break;
-			case Common::EVENT_LBUTTONDOWN:
-				_mousePressFlag = true;
-				break;
-			case Common::EVENT_LBUTTONUP:
-				_mousePressFlag = false;
-
-				if (_abortWalkFlag2) 
-					_abortWalkFlag = true;
-
-				if (_handleInput) {
-					_handleInput = false;
-					processInput();
-					_handleInput = true;
-				} else
-					_skipFlag = true;
-
-				break;
-			default:
-				break;
-			}
-		}
-
-		if (_debugger->isAttached())
-			_debugger->onFrame();
-
-		if (update) {
-			_sprites->updateSceneAnims();
-			_animator->updateAllObjectShapes();
-			updateTextFade();
-			updateMousePointer();
-		}
-
-		if (_currentCharacter && _currentCharacter->sceneId == 210 && update)
-			updateKyragemFading();
-
-		if (_skipFlag && !_abortIntroFlag && !queryGameFlag(0xFE))
-			_skipFlag = false;
-			
-		if (amount > 0 && !_skipFlag && !_quitFlag)
-			_system->delayMillis(10);
-
-		if (_skipFlag)
-			_sound->voiceStop();
-	} while (!_skipFlag && _system->getMillis() < start + amount && !_quitFlag);
-}
-
 Common::Point KyraEngine::getMousePos() const {
 	Common::Point mouse = _eventMan->getMousePos();
+
 	if (_flags.useHiResOverlay) {
 		mouse.x >>= 1;
 		mouse.y >>= 1;
 	}
+
 	return mouse;
 }
 
-void KyraEngine::waitForEvent() {
-	bool finished = false;
-	Common::Event event;
-
-	while (!finished && !_quitFlag) {
-		while (_eventMan->pollEvent(event)) {
-			switch (event.type) {
-			case Common::EVENT_KEYDOWN:
-				finished = true;
-				break;
-			case Common::EVENT_QUIT:
-				quitGame();
-				break;
-			case Common::EVENT_LBUTTONDOWN:
-				finished = true;
-				_skipFlag = true;
-				break;
-			default:
-				break;
-			}
-		}
-
-		if (_debugger->isAttached())
-			_debugger->onFrame();
-
-		_system->delayMillis(10);
-	}
-}
-
-void KyraEngine::delayWithTicks(int ticks) {
-	uint32 nextTime = _system->getMillis() + ticks * _tickLength;
-
-	while (_system->getMillis() < nextTime) {
-		_sprites->updateSceneAnims();
-		_animator->updateAllObjectShapes();
-
-		if (_currentCharacter->sceneId == 210) {
-			updateKyragemFading();
-			seq_playEnd();
-		}
-
-		if (_skipFlag)
-			break;
-
-		if (nextTime - _system->getMillis() >= 10)
-			delay(10);
-	}
-}
-
-#pragma mark -
-#pragma mark - Animation/shape specific code
-#pragma mark -
-
-void KyraEngine::setupShapes123(const Shape *shapeTable, int endShape, int flags) {
-	debugC(9, kDebugLevelMain, "KyraEngine::setupShapes123(%p, %d, %d)", (const void *)shapeTable, endShape, flags);
-
-	for (int i = 123; i <= 172; ++i)
-		_shapes[i] = 0;
-
-	uint8 curImage = 0xFF;
-	int curPageBackUp = _screen->_curPage;
-	_screen->_curPage = 8;	// we are using page 8 here in the original page 2 was backuped and then used for this stuff
-	int shapeFlags = 2;
-	if (flags)
-		shapeFlags = 3;
-	for (int i = 123; i < 123+endShape; ++i) {
-		uint8 newImage = shapeTable[i-123].imageIndex;
-		if (newImage != curImage && newImage != 0xFF) {
-			assert(_characterImageTable);
-			_screen->loadBitmap(_characterImageTable[newImage], 8, 8, 0);
-			curImage = newImage;
-		}
-		_shapes[i] = _screen->encodeShape(shapeTable[i-123].x<<3, shapeTable[i-123].y, shapeTable[i-123].w<<3, shapeTable[i-123].h, shapeFlags);
-		assert(i-7 < _defaultShapeTableSize);
-		_defaultShapeTable[i-7].xOffset = shapeTable[i-123].xOffset;
-		_defaultShapeTable[i-7].yOffset = shapeTable[i-123].yOffset;
-		_defaultShapeTable[i-7].w = shapeTable[i-123].w;
-		_defaultShapeTable[i-7].h = shapeTable[i-123].h;
-	}
-	_screen->_curPage = curPageBackUp;
-}
-
-void KyraEngine::freeShapes123() {
-	debugC(9, kDebugLevelMain, "KyraEngine::freeShapes123()");
-
-	for (int i = 123; i <= 172; ++i) {
-		delete [] _shapes[i];
-		_shapes[i] = 0;
-	}
-}
-
-#pragma mark -
-#pragma mark - Misc stuff
-#pragma mark -
-
-Movie *KyraEngine::createWSAMovie() {
-	if (_flags.platform == Common::kPlatformAmiga)
-		return new WSAMovieAmiga(this);
-
-	return new WSAMovieV1(this);
-}
-
 int KyraEngine::setGameFlag(int flag) {
 	_flagsTable[flag >> 3] |= (1 << (flag & 7));
 	return 1;
 }
 
-int KyraEngine::queryGameFlag(int flag) {
+int KyraEngine::queryGameFlag(int flag) const {
 	return ((_flagsTable[flag >> 3] >> (flag & 7)) & 1);
 }
 
@@ -800,345 +188,20 @@
 	return 0;
 }
 
-void KyraEngine::setBrandonPoisonFlags(int reset) {
-	debugC(9, kDebugLevelMain, "KyraEngine::setBrandonPoisonFlags(%d)", reset);
-	_brandonStatusBit |= 1;
-
-	if (reset)
-		_poisonDeathCounter = 0;
-
-	for (int i = 0; i < 0x100; ++i)
-		_brandonPoisonFlagsGFX[i] = i;
-
-	_brandonPoisonFlagsGFX[0x99] = 0x34;
-	_brandonPoisonFlagsGFX[0x9A] = 0x35;
-	_brandonPoisonFlagsGFX[0x9B] = 0x37;
-	_brandonPoisonFlagsGFX[0x9C] = 0x38;
-	_brandonPoisonFlagsGFX[0x9D] = 0x2B;
-}
-
-void KyraEngine::resetBrandonPoisonFlags() {
-	debugC(9, kDebugLevelMain, "KyraEngine::resetBrandonPoisonFlags()");
-	_brandonStatusBit = 0;
-
-	for (int i = 0; i < 0x100; ++i)
-		_brandonPoisonFlagsGFX[i] = i;
-}
-
-#pragma mark -
-#pragma mark - Input
-#pragma mark -
-
-void KyraEngine::processInput() {
-	Common::Point mouse = getMousePos();
-	int xpos = mouse.x;
-	int ypos = mouse.y;
-
-	debugC(9, kDebugLevelMain, "KyraEngine::processInput(%d, %d)", xpos, ypos);
-	_abortWalkFlag2 = false;
-
-	if (processInputHelper(xpos, ypos))
-		return;
-
-	uint8 item = findItemAtPos(xpos, ypos);
-	if (item == 0xFF) {
-		_changedScene = false;
-		int handled = clickEventHandler(xpos, ypos);
-		if (_changedScene || handled)
-			return;
-	} 
-	
-	// XXX _deathHandler specific
-	if (ypos <= 158) {
-		uint16 exit = 0xFFFF;
-		if (xpos < 12) {
-			exit = _walkBlockWest;
-		} else if (xpos >= 308) {
-			exit = _walkBlockEast;
-		} else if (ypos >= 136) {
-			exit = _walkBlockSouth;
-		} else if (ypos < 12) {
-			exit = _walkBlockNorth;
-		}
-		
-		if (exit != 0xFFFF) {
-			_abortWalkFlag2 = true;
-			handleSceneChange(xpos, ypos, 1, 1);
-			_abortWalkFlag2 = false;
-			return;
-		} else {
-			int script = checkForNPCScriptRun(xpos, ypos);
-			if (script >= 0) {
-				runNpcScript(script);
-				return;
-			}
-			if (_itemInHand != -1) {
-				if (ypos < 155) {
-					if (hasClickedOnExit(xpos, ypos)) {
-						_abortWalkFlag2 = true;
-						handleSceneChange(xpos, ypos, 1, 1);
-						_abortWalkFlag2 = false;
-						return;
-					}
-					dropItem(0, _itemInHand, xpos, ypos, 1);
-				}
-			} else {
-				if (ypos <= 155) {
-					_abortWalkFlag2 = true;
-					handleSceneChange(xpos, ypos, 1, 1);
-					_abortWalkFlag2 = false;
-				}
-			}
-		}
-	}	
-}
-
-int KyraEngine::processInputHelper(int xpos, int ypos) {
-	debugC(9, kDebugLevelMain, "KyraEngine::processInputHelper(%d, %d)", xpos, ypos);
-	uint8 item = findItemAtPos(xpos, ypos);
-	if (item != 0xFF) {
-		if (_itemInHand == -1) {
-			_screen->hideMouse();
-			_animator->animRemoveGameItem(item);
-			snd_playSoundEffect(53);
-			assert(_currentCharacter->sceneId < _roomTableSize);
-			Room *currentRoom = &_roomTable[_currentCharacter->sceneId];
-			int item2 = currentRoom->itemsTable[item];
-			currentRoom->itemsTable[item] = 0xFF;
-			setMouseItem(item2);
-			assert(_itemList && _takenList);
-			updateSentenceCommand(_itemList[item2], _takenList[0], 179);
-			_itemInHand = item2;
-			_screen->showMouse();
-			clickEventHandler2();
-			return 1;
-		} else {
-			exchangeItemWithMouseItem(_currentCharacter->sceneId, item);
-			return 1;
-		}
+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);
 	}
-	return 0;
 }
 
-int KyraEngine::clickEventHandler(int xpos, int ypos) {
-	debugC(9, kDebugLevelMain, "KyraEngine::clickEventHandler(%d, %d)", xpos, ypos);
-	_scriptInterpreter->initScript(_scriptClick, _scriptClickData);
-	_scriptClick->regs[1] = xpos;
-	_scriptClick->regs[2] = ypos;
-	_scriptClick->regs[3] = 0;
-	_scriptClick->regs[4] = _itemInHand;
-	_scriptInterpreter->startScript(_scriptClick, 1);
-
-	while (_scriptInterpreter->validScript(_scriptClick))
-		_scriptInterpreter->runScript(_scriptClick);
-
-	return _scriptClick->regs[3];
+void KyraEngine::delay(uint32 amount, bool update, bool isMainLoop) {
+	_system->delayMillis(amount);
 }
 
-void KyraEngine::updateMousePointer(bool forceUpdate) {
-	int shape = 0;
-	
-	int newMouseState = 0;
-	int newX = 0;
-	int newY = 0;
-	Common::Point mouse = getMousePos();
-	if (mouse.y <= 158) {
-		if (mouse.x >= 12) {
-			if (mouse.x >= 308) {
-				if (_walkBlockEast == 0xFFFF) {
-					newMouseState = -2;
-				} else {
-					newMouseState = -5;
-					shape = 3;
-					newX = 7;
-					newY = 5;
-				}
-			} else if (mouse.y >= 136) {
-				if (_walkBlockSouth == 0xFFFF) {
-					newMouseState = -2;
-				} else {
-					newMouseState = -4;
-					shape = 4;
-					newX = 5;
-					newY = 7;
-				}
-			} else if (mouse.y < 12) {
-				if (_walkBlockNorth == 0xFFFF) {
-					newMouseState = -2;
-				} else {
-					newMouseState = -6;
-					shape = 2;
-					newX = 5;
-					newY = 1;
-				}
-			}
-		} else {
-			if (_walkBlockWest == 0xFFFF) {
-				newMouseState = -2;
-			} else {
-				newMouseState = -3;
-				newX = 1;
-				newY = shape = 5;
-			}
-		}
-	}
-	
-	if (mouse.x >= _entranceMouseCursorTracks[0] && mouse.y >= _entranceMouseCursorTracks[1]
-		&& mouse.x <= _entranceMouseCursorTracks[2] && mouse.y <= _entranceMouseCursorTracks[3]) {
-		switch (_entranceMouseCursorTracks[4]) {
-		case 0:
-			newMouseState = -6;
-			shape = 2;
-			newX = 5;
-			newY = 1;
-			break;
-
-		case 2:
-			newMouseState = -5;
-			shape = 3;
-			newX = 7;
-			newY = 5;
-			break;
-
-		case 4:
-			newMouseState = -4;
-			shape = 4;
-			newX = 5;
-			newY = 7;
-			break;
-
-		case 6:
-			newMouseState = -3;
-			shape = 5;
-			newX = 1;
-			newY = 5;
-			break;
-
-		default:
-			break;
-		}
-	}
-	
-	if (newMouseState == -2) {
-		shape = 6;
-		newX = 4;
-		newY = 4;
-	}
-	
-	if ((newMouseState && _mouseState != newMouseState) || (newMouseState && forceUpdate)) {
-		_mouseState = newMouseState;
-		_screen->hideMouse();
-		_screen->setMouseCursor(newX, newY, _shapes[shape]);
-		_screen->showMouse();
-	}
-	
-	if (!newMouseState) {
-		if (_mouseState != _itemInHand || forceUpdate) {
-			if (mouse.y > 158 || (mouse.x >= 12 && mouse.x < 308 && mouse.y < 136 && mouse.y >= 12) || forceUpdate) {
-				_mouseState = _itemInHand;
-				_screen->hideMouse();
-				if (_itemInHand == -1) {
-					_screen->setMouseCursor(1, 1, _shapes[0]);
-				} else {
-					_screen->setMouseCursor(8, 15, _shapes[216+_itemInHand]);
-				}
-				_screen->showMouse();
-			}
-		}
-	}
+void KyraEngine::delayWithTicks(int ticks) {
+	delay(ticks * _tickLength);
 }
 
-bool KyraEngine::hasClickedOnExit(int xpos, int ypos) {
-	debugC(9, kDebugLevelMain, "KyraEngine::hasClickedOnExit(%d, %d)", xpos, ypos);
-	if (xpos < 16 || xpos >= 304)
-		return true;
-
-	if (ypos < 8)
-		return true;
-
-	if (ypos < 136 || ypos > 155)
-		return false;
-
-	return true;
-}
-
-void KyraEngine::clickEventHandler2() {
-	debugC(9, kDebugLevelMain, "KyraEngine::clickEventHandler2()");
-
-	Common::Point mouse = getMousePos();
-
-	_scriptInterpreter->initScript(_scriptClick, _scriptClickData);
-	_scriptClick->regs[0] = _currentCharacter->sceneId;
-	_scriptClick->regs[1] = mouse.x;
-	_scriptClick->regs[2] = mouse.y;
-	_scriptClick->regs[4] = _itemInHand;
-	_scriptInterpreter->startScript(_scriptClick, 6);
-	
-	while (_scriptInterpreter->validScript(_scriptClick))
-		_scriptInterpreter->runScript(_scriptClick);
-}
-
-int KyraEngine::checkForNPCScriptRun(int xpos, int ypos) {
-	debugC(9, kDebugLevelMain, "KyraEngine::checkForNPCScriptRun(%d, %d)", xpos, ypos);
-	int returnValue = -1;
-	const Character *currentChar = _currentCharacter;
-	int charLeft = 0, charRight = 0, charTop = 0, charBottom = 0;
-	
-	int scaleFactor = _scaleTable[currentChar->y1];
-	int addX = (((scaleFactor*8)*3)>>8)>>1;
-	int addY = ((scaleFactor*3)<<4)>>8;
-	
-	charLeft = currentChar->x1 - addX;
-	charRight = currentChar->x1 + addX;
-	charTop = currentChar->y1 - addY;
-	charBottom = currentChar->y1;
-	
-	if (xpos >= charLeft && charRight >= xpos && charTop <= ypos && charBottom >= ypos)
-		return 0;
-	
-	if (xpos > 304 || xpos < 16)
-		return -1;
-	
-	for (int i = 1; i < 5; ++i) {
-		currentChar = &_characterList[i];
-		
-		if (currentChar->sceneId != _currentCharacter->sceneId)
-			continue;
-			
-		charLeft = currentChar->x1 - 12;
-		charRight = currentChar->x1 + 11;
-		charTop = currentChar->y1 - 48;
-		// if (!i) {
-		// 	charBottom = currentChar->y2 - 16;
-		// } else {
-		charBottom = currentChar->y1;
-		// }
-		
-		if (xpos < charLeft || xpos > charRight || ypos < charTop || charBottom < ypos)
-			continue;
-		
-		if (returnValue != -1) {
-			if (currentChar->y1 >= _characterList[returnValue].y1)
-				returnValue = i;
-		} else {
-			returnValue = i;
-		}
-	}
-	
-	return returnValue;
-}
-
-void KyraEngine::runNpcScript(int func) {
-	debugC(9, kDebugLevelMain, "KyraEngine::runNpcScript(%d)", func);
-	_scriptInterpreter->initScript(_npcScript, _npcScriptData);
-	_scriptInterpreter->startScript(_npcScript, func);
-	_npcScript->regs[0] = _currentCharacter->sceneId;
-	_npcScript->regs[4] = _itemInHand;
-	_npcScript->regs[5] = func;
-	
-	while (_scriptInterpreter->validScript(_npcScript))
-		_scriptInterpreter->runScript(_npcScript);
-}
-
 } // End of namespace Kyra
 

Modified: scummvm/trunk/engines/kyra/kyra.h
===================================================================
--- scummvm/trunk/engines/kyra/kyra.h	2007-07-29 16:29:41 UTC (rev 28295)
+++ scummvm/trunk/engines/kyra/kyra.h	2007-07-29 16:31:29 UTC (rev 28296)
@@ -33,24 +33,7 @@
 
 namespace Kyra {
 
-class Movie;
-class Sound;
-class SoundDigital;
-class SeqPlayer;
-class Resource;
-class PAKFile;
-class Screen;
-class Sprites;
-class ScriptHelper;
-class Debugger;
-class ScreenAnimator;
-class TextDisplayer;
-class KyraEngine;
-class StaticResource;
-
 struct Opcode;
-struct ScriptState;
-struct ScriptData;
 
 struct GameFlags {
 	Common::Language lang;
@@ -62,6 +45,11 @@
 	byte gameID;
 };
 
+struct Rect {
+	int x, y;
+	int x2, y2;
+};
+
 enum {
 	GI_KYRA1 = 0,
 	GI_KYRA2 = 1,
@@ -83,839 +71,80 @@
 	kDebugLevelMovie = 1 << 9				// prints debug output of movie specific funtions
 };
 
-struct Character {
-	uint16 sceneId;
-	uint8 height;
-	uint8 facing;
-	uint16 currentAnimFrame;
-	uint8 inventoryItems[10];
-	int16 x1, y1, x2, y2;
-};
+class Screen;
+class Resource;
+class Sound;
+class Movie;
+class TextDisplayer;
+class StaticResource;
 
-struct Shape {
-	uint8 imageIndex;
-	int8 xOffset, yOffset;
-	uint8 x, y, w, h;
-};
-
-struct Room {
-	uint8 nameIndex;
-	uint16 northExit;
-	uint16 eastExit;
-	uint16 southExit;
-	uint16 westExit;
-	uint8 itemsTable[12];
-	uint16 itemsXPos[12];
-	uint8 itemsYPos[12];
-	uint8 needInit[12];
-};
-
-struct Rect {
-	int x, y;
-	int x2, y2;
-};
-
-struct Item {
-	uint8 unk1;
-	uint8 height;
-	uint8 unk2;
-	uint8 unk3;
-};
-
-struct SeqLoop {
-	const uint8 *ptr;
-	uint16 count;
-};
-
-struct SceneExits {
-	uint16 northXPos;
-	uint8  northYPos;
-	uint16 eastXPos;
-	uint8  eastYPos;
-	uint16 southXPos;
-	uint8  southYPos;
-	uint16 westXPos;
-	uint8  westYPos;
-};
-
-struct BeadState {
-	int16 x;
-	int16 y;
-	int16 width;
-	int16 height;
-	int16 dstX;
-	int16 dstY;
-	int16 width2;
-	int16 unk8;
-	int16 unk9;
-	int16 tableIndex;
-};
-
-struct Timer {
-	uint8 active;
-	int32 countdown;
-	uint32 nextRun;
-	void (KyraEngine::*func)(int timerNum);
-};
-
-struct Button {
-	Button *nextButton;
-	uint16 specialValue;
-	// uint8 unk[4];
-	uint8 process0;
-	uint8 process1;
-	uint8 process2;
-	// uint8 unk
-	uint16 flags;
-	typedef int (KyraEngine::*ButtonCallback)(Button*);
-	// using 6 pointers instead of 3 as in the orignal here (safer for use with classes)
-	uint8 *process0PtrShape;
-	uint8 *process1PtrShape;
-	uint8 *process2PtrShape;
-	ButtonCallback process0PtrCallback;
-	ButtonCallback process1PtrCallback;
-	ButtonCallback process2PtrCallback;
-	uint16 dimTableIndex;
-	uint16 x;
-	uint16 y;
-	uint16 width;
-	uint16 height;
-	// uint8 unk[8];
-	uint32 flags2;
-	ButtonCallback buttonCallback;
-	// uint8 unk[8];
-};
-
-struct MenuItem {
-	bool enabled;
-	uint16 field_1;
-	uint8 field_3;
-	const char *itemString;
-	int16 x;
-	int16 field_9;
-	uint16 y;
-	uint16 width;
-	uint16 height;
-	uint8 textColor;
-	uint8 highlightColor;
-	int16 field_12;
-	uint8 field_13;
-	uint8 bgcolor;
-	uint8 color1;
-	uint8 color2;
-	int (KyraEngine::*callback)(Button*);
-	int16 field_1b;
-	const char *labelString;
-	uint16 labelX;
-	uint8 labelY;
-	uint8 field_24;
-	uint32 field_25;
-};
-
-struct Menu {
-	int16 x;
-	int16 y;
-	uint16 width;
-	uint16 height;
-	uint8 bgcolor;
-	uint8 color1;
-	uint8 color2;
-	const char *menuName;
-	uint8 textColor;
-	int16 field_10;
-	uint16 field_12;
-	uint16 highlightedItem;
-	uint8 nrOfItems;
-	int16 scrollUpBtnX;
-	int16 scrollUpBtnY;
-	int16 scrollDownBtnX;
-	int16 scrollDownBtnY;
-	MenuItem item[6];
-};
-
 class KyraEngine : public Engine {
-	friend class MusicPlayer;
-	friend class Debugger;
-	friend class ScreenAnimator;
 public:
 	KyraEngine(OSystem *system, const GameFlags &flags);
 	virtual ~KyraEngine();
-
+	
+	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; }
-	Screen *screen() { return _screen; }
-	ScreenAnimator *animator() { return _animator; }
+	virtual Screen *screen() = 0;
 	TextDisplayer *text() { return _text; }
 	Sound *sound() { return _sound; }
 	StaticResource *staticres() { return _staticres; }
+	
 	uint32 tickLength() const { return _tickLength; }
-	virtual Movie *createWSAMovie();
-
-	uint8 game() const { return _flags.gameID; }
-	const GameFlags &gameFlags() const { return _flags; }
-
-	uint8 **shapes() { return _shapes; }
-	Character *currentCharacter() { return _currentCharacter; }
-	Character *characterList() { return _characterList; }
-	uint16 brandonStatus() { return _brandonStatusBit; }
-
-	// TODO: remove me with workaround in animator.cpp l209
-	uint16 getScene() { return _currentRoom; }
-
-	bool quit() const { return _quitFlag; }
-
-	int _paletteChanged;
+	
+	virtual Movie *createWSAMovie() = 0;
+	
 	Common::RandomSource _rnd;
-	int16 _northExitHeight;
-
-	typedef void (KyraEngine::*IntroProc)();
-
-	// static data access
-	const char * const*seqWSATable() { return _seq_WSATable; }
-	const char * const*seqCPSTable() { return _seq_CPSTable; }
-	const char * const*seqCOLTable() { return _seq_COLTable; }
-	const char * const*seqTextsTable() { return _seq_textsTable; }
 	
-	const uint8 * const*palTable1() { return &_specialPalettes[0]; }
-	const uint8 * const*palTable2() { return &_specialPalettes[29]; }
+	// quit handling
+	virtual void quitGame();
 
-	// sequences
-	// -> misc
-	bool seq_skipSequence() const;
-
-protected:
-	// -> demo
-	void seq_demo();
-
-	// -> intro
-	void seq_intro();
-	void seq_introLogos();
-	void seq_introStory();
-	void seq_introMalcolmTree();
-	void seq_introKallakWriting();
-	void seq_introKallakMalcolm();
-
-	// -> ingame animations
-	void seq_createAmuletJewel(int jewel, int page, int noSound, int drawOnly);
-	void seq_brandonHealing();
-	void seq_brandonHealing2();
-	void seq_poisonDeathNow(int now);
-	void seq_poisonDeathNowAnim();
-	void seq_playFluteAnimation();
-	void seq_winterScroll1();
-	void seq_winterScroll2();
-	void seq_makeBrandonInv();
-	void seq_makeBrandonNormal();
-	void seq_makeBrandonNormal2();
-	void seq_makeBrandonWisp();
-	void seq_dispelMagicAnimation();
-	void seq_fillFlaskWithWater(int item, int type);
-	void seq_playDrinkPotionAnim(int item, int unk2, int flags);
-	void seq_brandonToStone();
-
-	// -> end fight
-	int seq_playEnd();
-	void seq_playEnding();
-
-	int handleMalcolmFlag();
-	int handleBeadState();
-	void initBeadState(int x, int y, int x2, int y2, int unk1, BeadState *ptr);
-	int processBead(int x, int y, int &x2, int &y2, BeadState *ptr);
-
-	// -> credits
-	void seq_playCredits();
-
-public:
-	// delay
-	void delayUntil(uint32 timestamp, bool updateGameTimers = false, bool update = false, bool isMainLoop = false);
-	void delay(uint32 millis, bool update = false, bool isMainLoop = false);
-	void delayWithTicks(int ticks);
-	void waitForEvent();
-
-	// TODO
-	void quitGame();
-
-	void registerDefaultSettings();
-	void readSettings();
-	void writeSettings();
-
-	void snd_playTheme(int file, int track = 0);
-	void snd_playVoiceFile(int id);
-	void snd_voiceWaitForFinish(bool ingame = true);
-	bool snd_voiceIsPlaying();
-	void snd_stopVoice();
-	void snd_playSoundEffect(int track);
-	void snd_playWanderScoreViaMap(int command, int restart);
-
-	bool speechEnabled();
-	bool textEnabled();
-	
-	void updateGameTimers();
-	void clearNextEventTickCount();
-	void setTimerCountdown(uint8 timer, int32 countdown);
-	void setTimerDelay(uint8 timer, int32 countdown);
-	int16 getTimerDelay(uint8 timer);
-	void enableTimer(uint8 timer);
-	void disableTimer(uint8 timer);
-
-	void saveGame(const char *fileName, const char *saveName);
-	void loadGame(const char *fileName);
-
-	Common::Point getMousePos() const;
-
+	// game flag handling	
 	int setGameFlag(int flag);
-	int queryGameFlag(int flag);
+	int queryGameFlag(int flag) const;
 	int resetGameFlag(int flag);
-protected:
-	virtual int go();
-	virtual int init();
+	
+	// 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);
 
-	// input
-	void processInput();
-	int processInputHelper(int xpos, int ypos);
-	int clickEventHandler(int xpos, int ypos);
-	void clickEventHandler2();
-	void updateMousePointer(bool forceUpdate = false);
-	bool hasClickedOnExit(int xpos, int ypos);
-
-	// scene
-	// -> init
-	void loadSceneMsc();
-	void startSceneScript(int brandonAlive);
-	void setupSceneItems();
-	void initSceneData(int facing, int unk1, int brandonAlive);
-	void initSceneObjectList(int brandonAlive);
-	void initSceneScreen(int brandonAlive);
-	void setupSceneResource(int sceneId);
-
-	// -> process
-	void enterNewScene(int sceneId, int facing, int unk1, int unk2, int brandonAlive);
-	int handleSceneChange(int xpos, int ypos, int unk1, int frameReset);
-	int processSceneChange(int *table, int unk1, int frameReset);
-	int changeScene(int facing);
-
-	// -> modification
-	void transcendScenes(int roomIndex, int roomName);
-	void setSceneFile(int roomIndex, int roomName);
-
-	// -> pathfinder
-	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);
-	void changePosTowardsFacing(int &x, int &y, int facing);
-	bool lineIsPassable(int x, int y);
-	int getMoveTableSize(int *moveTable);
-
-	// -> item handling 
-	// --> misc
-	void addItemToRoom(uint16 sceneId, uint8 item, int itemIndex, int x, int y);
-
-	// --> drop handling
-	void itemDropDown(int x, int y, int destX, int destY, byte freeItem, int item);
-	int processItemDrop(uint16 sceneId, uint8 item, int x, int y, int unk1, int unk2);
-	void dropItem(int unk1, int item, int x, int y, int unk2);
-
-	// --> dropped item handling
-	int countItemsInScene(uint16 sceneId);
-	void exchangeItemWithMouseItem(uint16 sceneId, int itemIndex);
-	byte findFreeItemInScene(int scene);
-	byte findItemAtPos(int x, int y);
-
-	// --> drop area handling
-	void addToNoDropRects(int x, int y, int w, int h);
-	void clearNoDropRects();
-	int isDropable(int x, int y);
-	int checkNoDropRects(int x, int y);
-
-	// --> player items handling
-	void updatePlayerItemsForScene();
-
-	// --> item GFX handling
-	void backUpItemRect0(int xpos, int ypos);
-	void restoreItemRect0(int xpos, int ypos);
-	void backUpItemRect1(int xpos, int ypos);
-	void restoreItemRect1(int xpos, int ypos);
-
-	// items
-	// -> misc
-	void placeItemInGenericMapScene(int item, int index);
-
-	// -> mouse item
-	void createMouseItem(int item);
-	void destroyMouseItem();
-	void setMouseItem(int item);
-
-	// -> graphics effects
-	void wipeDownMouseItem(int xpos, int ypos);
-	void itemSpecialFX(int x, int y, int item);
-	void itemSpecialFX1(int x, int y, int item);
-	void itemSpecialFX2(int x, int y, int item);
-	void magicOutMouseItem(int animIndex, int itemPos);
-	void magicInMouseItem(int animIndex, int item, int itemPos);
-	void specialMouseItemFX(int shape, int x, int y, int animIndex, int tableIndex, int loopStart, int maxLoops);
-	void processSpecialMouseItemFX(int shape, int x, int y, int tableValue, int loopStart, int maxLoops);
-
-	// character
-	// -> movement
-	void moveCharacterToPos(int character, int facing, int xpos, int ypos);
-	void setCharacterPositionWithUpdate(int character);
-	int setCharacterPosition(int character, int *facingTable);
-	void setCharacterPositionHelper(int character, int *facingTable);
-	int getOppositeFacingDirection(int dir);
-	void setCharactersPositions(int character);
-
-	// -> brandon
-	void setBrandonPoisonFlags(int reset);
-	void resetBrandonPoisonFlags();
-
-	// chat
-	// -> process
-	void characterSays(int vocFile, const char *chatStr, int8 charNum, int8 chatDuration);
-	void waitForChatToFinish(int vocFile, int16 chatDuration, const char *str, uint8 charNum);
-
-	// -> initialization
-	int initCharacterChat(int8 charNum);
-	void backupChatPartnerAnimFrame(int8 charNum);
-	void restoreChatPartnerAnimFrame(int8 charNum);
-	int8 getChatPartnerNum();
-
-	// -> deinitialization
-	void endCharacterChat(int8 charNum, int16 arg_4);
-
-	// graphics
-	// -> misc
-	int findDuplicateItemShape(int shape);
-	void updateKyragemFading();
-
-	// -> interface
-	void loadMainScreen(int page = 3);
-	void redrawInventory(int page);
-public:
-	void drawSentenceCommand(const char *sentence, int unk1);
-	void updateSentenceCommand(const char *str1, const char *str2, int unk1);
-	void updateTextFade();
-
 protected:
-	// -> amulet
-	void drawJewelPress(int jewel, int drawSpecial);
-	void drawJewelsFadeOutStart();
-	void drawJewelsFadeOutEnd(int jewel);
-
-	// -> shape handling
-	void setupShapes123(const Shape *shapeTable, int endShape, int flags);
-	void freeShapes123();
-
-	// misc (TODO)
-	void startup();
-	void mainLoop();
+	virtual int go() = 0;
+	virtual int init();
 	
-	int checkForNPCScriptRun(int xpos, int ypos);
-	void runNpcScript(int func);
-	
-	virtual void setupOpcodeTable() = 0;
-	Common::Array<const Opcode*> _opcodes; 
-	
-	void loadMouseShapes();
-	void loadCharacterShapes();
-	void loadSpecialEffectShapes();
-	void loadItems();
-	void loadButtonShapes();
-	void initMainButtonList();
-	void setCharactersInDefaultScene();
-	void setupPanPages();
-	void freePanPages();
-	void closeFinalWsa();
-	
-	void setTimer19();
-	void setupTimers();
-	void timerUpdateHeadAnims(int timerNum);
-	void timerSetFlags1(int timerNum);
-	void timerSetFlags2(int timerNum);
-	void timerSetFlags3(int timerNum);
-	void timerCheckAnimFlag1(int timerNum);
-	void timerCheckAnimFlag2(int timerNum);
-	void checkAmuletAnimFlags();
-	void timerRedrawAmulet(int timerNum);
-	void timerFadeText(int timerNum);
-	void updateAnimFlag1(int timerNum);
-	void updateAnimFlag2(int timerNum);
-	void drawAmulet();
-	void setTextFadeTimerCountdown(int16 countdown);
-	void setWalkspeed(uint8 newSpeed);
-
-	int buttonInventoryCallback(Button *caller);
-	int buttonAmuletCallback(Button *caller);
-	int buttonMenuCallback(Button *caller);
-	int drawBoxCallback(Button *button);
-	int drawShadedBoxCallback(Button *button);
-	void calcCoords(Menu &menu);
-	void initMenu(Menu &menu);
-	void setGUILabels();
-	
-	Button *initButton(Button *list, Button *newButton);
-	void processButtonList(Button *list);
-	void processButton(Button *button);
-	void processMenuButton(Button *button);
-	void processAllMenuButtons();
-
-	const char *getSavegameFilename(int num);
-	void setupSavegames(Menu &menu, int num);
-	int getNextSavegameSlot();
-
-	int gui_resumeGame(Button *button);
-	int gui_loadGameMenu(Button *button);
-	int gui_saveGameMenu(Button *button);
-	int gui_gameControlsMenu(Button *button);
-	int gui_quitPlaying(Button *button);
-	int gui_quitConfirmYes(Button *button);
-	int gui_quitConfirmNo(Button *button);
-	int gui_loadGame(Button *button);
-	int gui_saveGame(Button *button);
-	int gui_savegameConfirm(Button *button);
-	int gui_cancelSubMenu(Button *button);
-	int gui_scrollUp(Button *button);
-	int gui_scrollDown(Button *button);
-	int gui_controlsChangeMusic(Button *button);
-	int gui_controlsChangeSounds(Button *button);
-	int gui_controlsChangeWalk(Button *button);
-	int gui_controlsChangeText(Button *button);
-	int gui_controlsChangeVoice(Button *button);
-	int gui_controlsApply(Button *button);
-
-	bool gui_quitConfirm(const char *str);
-	void gui_getInput();
-	void gui_redrawText(Menu menu);
-	void gui_redrawHighlight(Menu menu);
-	void gui_processHighlights(Menu &menu);
-	void gui_updateSavegameString();
-	void gui_redrawTextfield();
-	void gui_fadePalette();
-	void gui_restorePalette();
-	void gui_setupControls(Menu &menu);
-
-	// Kyra 2 and 3 main menu
-
-	static const char *_mainMenuStrings[];
-	virtual void gui_initMainMenu() {}
-	int gui_handleMainMenu();
-	virtual void gui_updateMainMenuAnimation();
-	void gui_drawMainMenu(const char * const *strings, int select);
-	void gui_drawMainBox(int x, int y, int w, int h, int fill);
-	bool gui_mainMenuGetInput();
-	
-	void gui_printString(const char *string, int x, int y, int col1, int col2, int flags, ...);
-
-	GameFlags _flags;
+	// quit Handling
 	bool _quitFlag;
-	bool _skipFlag;
-	bool _skipIntroFlag;
-	bool _abortIntroFlag;
-	bool _menuDirectlyToLoad;
-	bool _abortWalkFlag;
-	bool _abortWalkFlag2;
-	bool _mousePressFlag;
-	int8 _mouseWheel;
-	uint8 _flagsTable[69];
-	uint8 *_itemBkgBackUp[2];
-	uint8 *_shapes[373];
-	uint16 _gameSpeed;
-	uint16 _tickLength;
-	int _lang;
-	int8 _itemInHand;
-	int _mouseState;
-	bool _handleInput;
-	bool _changedScene;
-	int _unkScreenVar1, _unkScreenVar2, _unkScreenVar3;
-	int _beadStateVar;
-	int _unkAmuletVar;
-		
-	int _malcolmFlag;
-	int _endSequenceSkipFlag;
-	int _endSequenceNeedLoading;
-	int _unkEndSeqVar2;
-	uint8 *_endSequenceBackUpRect;
-	int _unkEndSeqVar4;
-	int _unkEndSeqVar5;
-	int _lastDisplayedPanPage;
-	uint8 *_panPagesTable[20];
-	Movie *_finalA, *_finalB, *_finalC;
 	
-	Movie *_movieObjects[10];
-
-	uint16 _entranceMouseCursorTracks[8];
-	uint16 _walkBlockNorth;
-	uint16 _walkBlockEast;
-	uint16 _walkBlockSouth;
-	uint16 _walkBlockWest;
-	
-	int32 _scaleMode;
-	int16 _scaleTable[145];
-	
-	Rect _noDropRects[11];
-	
-	int8 _birthstoneGemTable[4];
-	int8 _idolGemsTable[3];
-	
-	int8 _marbleVaseItem;
-	int8 _foyerItemTable[3];
-	
-	int8 _cauldronState;
-	int8 _crystalState[2];
-
-	uint16 _brandonStatusBit;
-	uint8 _brandonStatusBit0x02Flag;
-	uint8 _brandonStatusBit0x20Flag;
-	uint8 _brandonPoisonFlagsGFX[256];
-	uint8 _deathHandler;
-	int16 _brandonInvFlag;
-	uint8 _poisonDeathCounter;
-	int _brandonPosX;
-	int _brandonPosY;
-
-	uint16 _currentChatPartnerBackupFrame;
-	uint16 _currentCharAnimFrame;
-	
-	int8 *_sceneAnimTable[50];
-	
-	Item _itemTable[145];
-	int _lastProcessedItem;
-	int _lastProcessedItemHeight;
-	
-	int16 *_exitListPtr;
-	int16 _exitList[11];
-	SceneExits _sceneExits;
-	uint16 _currentRoom;
-	int _scenePhasingFlag;
-	
-	int _sceneChangeState;
-	int _loopFlag2;
-	
-	int _pathfinderFlag;
-	int _pathfinderFlag2;
-	int _lastFindWayRet;
-	int *_movFacingTable;
-	
-	int8 _talkingCharNum;
-	int8 _charSayUnk2;
-	int8 _charSayUnk3;
-	int8 _currHeadShape;
-	uint8 _currSentenceColor[3];
-	int8 _startSentencePalIndex;
-	bool _fadeText;
-
-	uint8 _configTextspeed;
-	uint8 _configWalkspeed;
-	int _configMusic;
-	bool _configSounds;
-	uint8 _configVoice;
-
-	int _curMusicTheme;
-	int _curSfxFile;
-	int16 _lastMusicCommand;
-
+	// intern
 	Resource *_res;
 	Screen *_screen;
-	ScreenAnimator *_animator;
 	Sound *_sound;
-	SeqPlayer *_seq;
-	Sprites *_sprites;
 	TextDisplayer *_text;
-	ScriptHelper *_scriptInterpreter;
-	Debugger *_debugger;
 	StaticResource *_staticres;
-
-	ScriptState *_scriptMain;
 	
-	ScriptState *_npcScript;
-	ScriptData *_npcScriptData;
+	// game speed
+	bool _skipFlag;
+	uint16 _tickLength;
 	
-	ScriptState *_scriptClick;
-	ScriptData *_scriptClickData;
-	
-	Character *_characterList;
-	Character *_currentCharacter;
-	
-	Button *_buttonList;
-	Button *_menuButtonList;
-	bool _displayMenu;
-	bool _menuRestoreScreen;
-	bool _displaySubMenu;
-	bool _cancelSubMenu;
-	uint8 _toplevelMenu;
-	int _savegameOffset;
-	int _gameToLoad;
-	char _savegameName[31];
-	const char *_specialSavegameString;
-	Common::KeyState _keyPressed;
+	// detection
+	GameFlags _flags;
+	int _lang;
 
-	struct KyragemState {
-		uint16 nextOperation;
-		uint16 rOffset;
-		uint16 gOffset;
-		uint16 bOffset;
-		uint32 timerCount;
-	} _kyragemFadingState;
-
-	// TODO: get rid of all variables having pointers to the static resources if possible
-	// i.e. let them directly use the _staticres functions
-	void initStaticResource();
-
-	const uint8 *_seq_Forest;
-	const uint8 *_seq_KallakWriting;
-	const uint8 *_seq_KyrandiaLogo;
-	const uint8 *_seq_KallakMalcolm;
-	const uint8 *_seq_MalcolmTree;
-	const uint8 *_seq_WestwoodLogo;
-	const uint8 *_seq_Demo1;
-	const uint8 *_seq_Demo2;
-	const uint8 *_seq_Demo3;
-	const uint8 *_seq_Demo4;
-	const uint8 *_seq_Reunion;
+	// opcode
+	virtual void setupOpcodeTable() = 0;
+	Common::Array<const Opcode*> _opcodes;
 	
-	const char * const*_seq_WSATable;
-	const char * const*_seq_CPSTable;
-	const char * const*_seq_COLTable;
-	const char * const*_seq_textsTable;
+	// game flags
+	uint8 _flagsTable[100];	// TODO: check this value
 	
-	int _seq_WSATable_Size;
-	int _seq_CPSTable_Size;
-	int _seq_COLTable_Size;
-	int _seq_textsTable_Size;
-	
-	const char * const*_itemList;
-	const char * const*_takenList;
-	const char * const*_placedList;
-	const char * const*_droppedList;
-	const char * const*_noDropList;
-	const char * const*_putDownFirst;
-	const char * const*_waitForAmulet;
-	const char * const*_blackJewel;
-	const char * const*_poisonGone;
-	const char * const*_healingTip;
-	const char * const*_thePoison;
-	const char * const*_fluteString;
-	const char * const*_wispJewelStrings;
-	const char * const*_magicJewelString;
-	const char * const*_flaskFull;
-	const char * const*_fullFlask;
-	const char * const*_veryClever;
-	const char * const*_homeString;
-	const char * const*_newGameString;
-	
-	const char *_voiceTextString;
-	const char *_textSpeedString;
-	const char *_onString;
-	const char *_offString;
-	const char *_onCDString;
-		
-	int _itemList_Size;
-	int _takenList_Size;
-	int _placedList_Size;
-	int _droppedList_Size;
-	int _noDropList_Size;
-	int _putDownFirst_Size;
-	int _waitForAmulet_Size;
-	int _blackJewel_Size;
-	int _poisonGone_Size;
-	int _healingTip_Size;
-	int _thePoison_Size;
-	int _fluteString_Size;
-	int _wispJewelStrings_Size;
-	int _magicJewelString_Size;
-	int _flaskFull_Size;
-	int _fullFlask_Size;
-	int _veryClever_Size;
-	int _homeString_Size;
-	int _newGameString_Size;
-	
-	const char * const*_characterImageTable;
-	int _characterImageTableSize;
-
-	const char * const*_guiStrings;
-	int _guiStringsSize;
-
-	const char * const*_configStrings;
-	int _configStringsSize;
-	
-	Shape *_defaultShapeTable;
-	int _defaultShapeTableSize;
-	
-	const Shape *_healingShapeTable;
-	int  _healingShapeTableSize;
-	const Shape *_healingShape2Table;
-	int  _healingShape2TableSize;
-	
-	const Shape *_posionDeathShapeTable;
-	int _posionDeathShapeTableSize;
-	
-	const Shape *_fluteAnimShapeTable;
-	int _fluteAnimShapeTableSize;
-	
-	const Shape *_winterScrollTable;
-	int _winterScrollTableSize;
-	const Shape *_winterScroll1Table;
-	int _winterScroll1TableSize;
-	const Shape *_winterScroll2Table;
-	int _winterScroll2TableSize;
-	
-	const Shape *_drinkAnimationTable;
-	int _drinkAnimationTableSize;
-	
-	const Shape *_brandonToWispTable;
-	int _brandonToWispTableSize;
-	
-	const Shape *_magicAnimationTable;
-	int _magicAnimationTableSize;
-	
-	const Shape *_brandonStoneTable;
-	int _brandonStoneTableSize;
-	
-	Room *_roomTable;
-	int _roomTableSize;
-	const char * const*_roomFilenameTable;
-	int _roomFilenameTableSize;
-	
-	const uint8 *_amuleteAnim;
-	
-	const uint8 * const*_specialPalettes;
-
-	Timer _timers[34];
-	uint32 _timerNextRun;
-
-	static const char *_soundFiles[];
-	static const int _soundFilesCount;
-	static const char *_soundFilesTowns[];
-	static const int _soundFilesTownsCount;
-	
-	static const int8 _charXPosTable[];
-	static const int8 _addXPosTable[];
-	static const int8 _charYPosTable[];
-	static const int8 _addYPosTable[];
-
-	// positions of the inventory
-	static const uint16 _itemPosX[];
-	static const uint8 _itemPosY[];
-	
-	void setupButtonData();
-	Button *_buttonData;
-	Button **_buttonDataListPtr;
-	static Button _menuButtonData[];
-	static Button _scrollUpButton;
-	static Button _scrollDownButton;
-
-	bool _haveScrollButtons;
-
-	void setupMenu();
-	Menu *_menu;
-
-	static const uint8 _magicMouseItemStartFrame[];
-	static const uint8 _magicMouseItemEndFrame[];

@@ 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