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

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Tue Dec 16 18:40:35 CET 2008


Revision: 35393
          http://scummvm.svn.sourceforge.net/scummvm/?rev=35393&view=rev
Author:   lordhoto
Date:     2008-12-16 17:40:34 +0000 (Tue, 16 Dec 2008)

Log Message:
-----------
Switched kyra1 to use the same input functionality as kyra2 and kyra3.

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/gui.cpp
    scummvm/trunk/engines/kyra/gui.h
    scummvm/trunk/engines/kyra/gui_lok.cpp
    scummvm/trunk/engines/kyra/gui_lok.h
    scummvm/trunk/engines/kyra/gui_v2.cpp
    scummvm/trunk/engines/kyra/gui_v2.h
    scummvm/trunk/engines/kyra/kyra_hof.h
    scummvm/trunk/engines/kyra/kyra_lok.cpp
    scummvm/trunk/engines/kyra/kyra_lok.h
    scummvm/trunk/engines/kyra/kyra_mr.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/saveload_lok.cpp
    scummvm/trunk/engines/kyra/scene_lok.cpp
    scummvm/trunk/engines/kyra/script_lok.cpp
    scummvm/trunk/engines/kyra/sequences_lok.cpp
    scummvm/trunk/engines/kyra/sound_lok.cpp
    scummvm/trunk/engines/kyra/text_lok.cpp

Modified: scummvm/trunk/engines/kyra/gui.cpp
===================================================================
--- scummvm/trunk/engines/kyra/gui.cpp	2008-12-16 13:19:43 UTC (rev 35392)
+++ scummvm/trunk/engines/kyra/gui.cpp	2008-12-16 17:40:34 UTC (rev 35393)
@@ -335,6 +335,54 @@
 	return 0;
 }
 
+void GUI::checkTextfieldInput() {
+	Common::Event event;
+
+	uint32 now = _vm->_system->getMillis();
+
+	bool running = true;
+	int keys = 0;
+	while (_vm->_eventMan->pollEvent(event) && running) {
+		switch (event.type) {
+		case Common::EVENT_KEYDOWN:
+			if (event.kbd.keycode == 'q' && event.kbd.flags == Common::KBD_CTRL)
+				_vm->quitGame();
+			else
+				_keyPressed = event.kbd; 
+			running = false;
+			break;
+
+		case Common::EVENT_LBUTTONDOWN:
+		case Common::EVENT_LBUTTONUP: {
+			Common::Point pos = _vm->getMousePos();
+			_vm->_mouseX = pos.x;
+			_vm->_mouseY = pos.y;
+			keys = event.type == Common::EVENT_LBUTTONDOWN ? 199 : (200 | 0x800);
+			running = false;
+			} break;
+
+		case Common::EVENT_MOUSEMOVE: {
+			Common::Point pos = _vm->getMousePos();
+			_vm->_mouseX = pos.x;
+			_vm->_mouseY = pos.y;
+			_screen->updateScreen();
+			_lastScreenUpdate = now;
+			} break;
+
+		default:
+			break;
+		}
+	}
+
+	if (now - _lastScreenUpdate > 50) {
+		_vm->_system->updateScreen();
+		_lastScreenUpdate = now;
+	}
+
+	processButtonList(_menuButtonList, keys | 0x8000, 0);
+	_vm->_system->delayMillis(3);
+}
+
 #pragma mark -
 
 MainMenu::MainMenu(KyraEngine_v1 *vm) : _vm(vm), _screen(0) {

Modified: scummvm/trunk/engines/kyra/gui.h
===================================================================
--- scummvm/trunk/engines/kyra/gui.h	2008-12-16 13:19:43 UTC (rev 35392)
+++ scummvm/trunk/engines/kyra/gui.h	2008-12-16 17:40:34 UTC (rev 35393)
@@ -194,6 +194,10 @@
 	Common::Array<int> _saveSlots;
 	void updateSaveList();
 	int getNextSavegameSlot();
+
+	uint32 _lastScreenUpdate;
+	Common::KeyState _keyPressed;
+	void checkTextfieldInput();
 };
 
 class Movie;

Modified: scummvm/trunk/engines/kyra/gui_lok.cpp
===================================================================
--- scummvm/trunk/engines/kyra/gui_lok.cpp	2008-12-16 13:19:43 UTC (rev 35392)
+++ scummvm/trunk/engines/kyra/gui_lok.cpp	2008-12-16 17:40:34 UTC (rev 35393)
@@ -191,6 +191,7 @@
 GUI_LoK::GUI_LoK(KyraEngine_LoK *vm, Screen_LoK *screen) : GUI(vm), _vm(vm), _screen(screen) {
 	_lastScreenUpdate = 0;
 	_menu = 0;
+	_pressFlag = false;
 	initStaticResource();
 	_scrollUpFunctor = BUTTON_FUNCTOR(GUI_LoK, this, &GUI_LoK::scrollUp);
 	_scrollDownFunctor = BUTTON_FUNCTOR(GUI_LoK, this, &GUI_LoK::scrollDown);
@@ -213,6 +214,12 @@
 }
 
 int GUI_LoK::processButtonList(Button *list, uint16 inputFlag, int8 mouseWheel) {
+	if ((inputFlag & 0xFF) == 199)
+		_pressFlag = true;
+	else if ((inputFlag & 0xFF) == 200)
+		_pressFlag = false;
+
+	int returnValue = 0;
 	while (list) {
 		if (list->flags & 8) {
 			list = list->nextButton;
@@ -220,51 +227,47 @@
 		}
 
 		if (mouseWheel && list->mouseWheel == mouseWheel && list->buttonCallback) {
-			if ((*list->buttonCallback.get())(list)) {
+			if ((*list->buttonCallback.get())(list))
 				break;
-			}
 		}
 
 		int x = list->x;
 		int y = list->y;
 		assert(_screen->getScreenDim(list->dimTableIndex) != 0);
-		if (x < 0) {
+
+		if (x < 0)
 			x += _screen->getScreenDim(list->dimTableIndex)->w << 3;
-		}
 		x += _screen->getScreenDim(list->dimTableIndex)->sx << 3;
 
-		if (y < 0) {
+		if (y < 0)
 			y += _screen->getScreenDim(list->dimTableIndex)->h;
-		}
 		y += _screen->getScreenDim(list->dimTableIndex)->sy;
 
-		Common::Point mouse = _vm->getMousePos();
-		if (mouse.x >= x && mouse.y >= y && x + list->width >= mouse.x && y + list->height >= mouse.y) {
+		if (_vm->_mouseX >= x && _vm->_mouseY >= y && x + list->width >= _vm->_mouseX && y + list->height >= _vm->_mouseY) {
 			int processMouseClick = 0;
 			if (list->flags & 0x400) {
-				if (_vm->_mousePressFlag) {
+				if ((inputFlag & 0xFF) == 199 || _pressFlag) {
 					if (!(list->flags2 & 1)) {
 						list->flags2 |= 1;
 						list->flags2 |= 4;
 						processButton(list);
 						_screen->updateScreen();
+						inputFlag = 0;
 					}
-				} else {
+				} else if ((inputFlag & 0xFF) == 200) {
 					if (list->flags2 & 1) {
 						list->flags2 &= 0xFFFE;
 						processButton(list);
 						processMouseClick = 1;
+						inputFlag = 0;
 					}
 				}
-			} else if (_vm->_mousePressFlag) {
-				processMouseClick = 1;
 			}
 
 			if (processMouseClick) {
 				if (list->buttonCallback) {
-					if ((*list->buttonCallback.get())(list)) {
+					if ((*list->buttonCallback.get())(list))
 						break;
-					}
 				}
 			}
 		} else {
@@ -272,18 +275,21 @@
 				list->flags2 &= 0xFFFE;
 				processButton(list);
 			}
+			
 			if (list->flags2 & 4) {
 				list->flags2 &= 0xFFFB;
 				processButton(list);
 				_screen->updateScreen();
 			}
-			list = list->nextButton;
-			continue;
 		}
 
 		list = list->nextButton;
 	}
-	return 0;
+
+	if (!returnValue)
+		returnValue = inputFlag & 0xFF;
+
+	return returnValue;
 }
 
 void GUI_LoK::processButton(Button *button) {
@@ -460,7 +466,6 @@
 
 	_menuRestoreScreen = true;
 	_keyPressed.reset();
-	_vm->_mousePressFlag = false;
 
 	_toplevelMenu = 0;
 	if (_vm->_menuDirectlyToLoad) {
@@ -474,9 +479,7 @@
 	}
 
 	while (_displayMenu && !_vm->shouldQuit()) {
-		Common::Point mouse = _vm->getMousePos();
-		processHighlights(_menu[_toplevelMenu], mouse.x, mouse.y);
-		processButtonList(_menuButtonList, 0, 0);
+		processHighlights(_menu[_toplevelMenu], _vm->_mouseX, _vm->_mouseY);
 		getInput();
 	}
 
@@ -495,32 +498,8 @@
 	Common::Event event;
 	uint32 now = _vm->_system->getMillis();
 
-	_mouseWheel = 0;
-	while (_vm->_eventMan->pollEvent(event)) {
-		switch (event.type) {
-		case Common::EVENT_LBUTTONDOWN:
-			_vm->_mousePressFlag = true;
-			break;
-		case Common::EVENT_LBUTTONUP:
-			_vm->_mousePressFlag = false;
-			break;
-		case Common::EVENT_MOUSEMOVE:
-			_vm->_system->updateScreen();
-			_lastScreenUpdate = now;
-			break;
-		case Common::EVENT_WHEELUP:
-			_mouseWheel = -1;
-			break;
-		case Common::EVENT_WHEELDOWN:
-			_mouseWheel = 1;
-			break;
-		case Common::EVENT_KEYDOWN:
-			_keyPressed = event.kbd;
-			break;
-		default:
-			break;
-		}
-	}
+	_vm->checkInput(_menuButtonList);
+	_vm->removeInputTop();
 
 	if (now - _lastScreenUpdate > 50) {
 		_vm->_system->updateScreen();
@@ -594,10 +573,8 @@
 	_cancelSubMenu = false;
 
 	while (_displaySubMenu && !_vm->shouldQuit()) {
+		processHighlights(_menu[2], _vm->_mouseX, _vm->_mouseY);
 		getInput();
-		Common::Point mouse = _vm->getMousePos();
-		processHighlights(_menu[2], mouse.x, mouse.y);
-		processButtonList(_menuButtonList, 0, _mouseWheel);
 	}
 
 	_screen->loadPageFromDisk("SEENPAGE.TMP", 0);
@@ -643,10 +620,8 @@
 	_vm->_gameToLoad = -1;
 
 	while (_displaySubMenu && !_vm->shouldQuit()) {
+		processHighlights(_menu[2], _vm->_mouseX, _vm->_mouseY);
 		getInput();
-		Common::Point mouse = _vm->getMousePos();
-		processHighlights(_menu[2], mouse.x, mouse.y);
-		processButtonList(_menuButtonList, 0, _mouseWheel);
 	}
 
 	_screen->loadPageFromDisk("SEENPAGE.TMP", 0);
@@ -731,11 +706,9 @@
 	redrawTextfield();
 
 	while (_displaySubMenu && !_vm->shouldQuit()) {
-		getInput();
+		checkTextfieldInput();
 		updateSavegameString();
-		Common::Point mouse = _vm->getMousePos();
-		processHighlights(_menu[3], mouse.x, mouse.y);
-		processButtonList(_menuButtonList, 0, 0);
+		processHighlights(_menu[3], _vm->_mouseX, _vm->_mouseY);
 	}
 
 	if (_cancelSubMenu) {
@@ -811,10 +784,8 @@
 	_cancelSubMenu = true;
 
 	while (_displaySubMenu && !_vm->shouldQuit()) {
+		processHighlights(_menu[1], _vm->_mouseX, _vm->_mouseY);
 		getInput();
-		Common::Point mouse = _vm->getMousePos();
-		processHighlights(_menu[1], mouse.x, mouse.y);
-		processButtonList(_menuButtonList, 0, 0);
 	}
 
 	_screen->loadPageFromDisk("SEENPAGE.TMP", 0);
@@ -877,10 +848,8 @@
 	_cancelSubMenu = false;
 
 	while (_displaySubMenu && !_vm->shouldQuit()) {
+		processHighlights(_menu[5], _vm->_mouseX, _vm->_mouseY);
 		getInput();
-		Common::Point mouse = _vm->getMousePos();
-		processHighlights(_menu[5], mouse.x, mouse.y);
-		processButtonList(_menuButtonList, 0, 0);
 	}
 
 	_screen->loadPageFromDisk("SEENPAGE.TMP", 0);

Modified: scummvm/trunk/engines/kyra/gui_lok.h
===================================================================
--- scummvm/trunk/engines/kyra/gui_lok.h	2008-12-16 13:19:43 UTC (rev 35392)
+++ scummvm/trunk/engines/kyra/gui_lok.h	2008-12-16 17:40:34 UTC (rev 35393)
@@ -117,6 +117,8 @@
 
 	Menu *_menu;
 
+	bool _pressFlag;
+
 	void setGUILabels();
 
 	void setupSavegames(Menu &menu, int num);
@@ -159,15 +161,11 @@
 	KyraEngine_LoK *_vm;
 	Screen_LoK *_screen;
 
-	uint32 _lastScreenUpdate;
-
 	bool _menuRestoreScreen;
 	uint8 _toplevelMenu;
 	int _savegameOffset;
 	char _savegameName[35];
 	const char *_specialSavegameString;
-	Common::KeyState _keyPressed;
-	int8 _mouseWheel;
 
 	Button::Callback _scrollUpFunctor;
 	Button::Callback _scrollDownFunctor;

Modified: scummvm/trunk/engines/kyra/gui_v2.cpp
===================================================================
--- scummvm/trunk/engines/kyra/gui_v2.cpp	2008-12-16 13:19:43 UTC (rev 35392)
+++ scummvm/trunk/engines/kyra/gui_v2.cpp	2008-12-16 17:40:34 UTC (rev 35393)
@@ -36,6 +36,7 @@
 	_backUpButtonList = _unknownButtonList = 0;
 	_buttonListChanged = false;
 	_lastScreenUpdate = 0;
+	_flagsModifier = 0;
 
 	_currentMenu = 0;
 	_isDeathMenu = false;
@@ -142,8 +143,6 @@
 }
 
 int GUI_v2::processButtonList(Button *buttonList, uint16 inputFlag, int8 mouseWheel) {
-	static uint16 flagsModifier = 0;
-
 	if (!buttonList)
 		return inputFlag & 0x7FFF;
 
@@ -179,10 +178,10 @@
 
 		flags |= temp;
 
-		flagsModifier &= ~((temp & 0x4400) >> 1);
-		flagsModifier |= (temp & 0x1100) * 2;
-		flags |= flagsModifier;
-		flags |= (flagsModifier << 2) ^ 0x8800;
+		_flagsModifier &= ~((temp & 0x4400) >> 1);
+		_flagsModifier |= (temp & 0x1100) * 2;
+		flags |= _flagsModifier;
+		flags |= (_flagsModifier << 2) ^ 0x8800;
 	}
 
 	buttonList = _backUpButtonList;
@@ -750,8 +749,8 @@
 	_keyPressed.reset();
 	_cancelNameInput = _finishNameInput = false;
 	while (running && !_vm->shouldQuit()) {
-		processHighlights(_savenameMenu, _vm->_mouseX, _vm->_mouseY);
 		checkTextfieldInput();
+		processHighlights(_savenameMenu, _vm->_mouseX, _vm->_mouseY);
 		if (_keyPressed.keycode == Common::KEYCODE_RETURN || _keyPressed.keycode == Common::KEYCODE_KP_ENTER || _finishNameInput) {
 			if (checkSavegameDescription(buffer, curPos)) {
 				buffer[curPos] = 0;
@@ -823,54 +822,6 @@
 	return width;
 }
 
-void GUI_v2::checkTextfieldInput() {
-	Common::Event event;
-
-	uint32 now = _vm->_system->getMillis();
-
-	bool running = true;
-	int keys = 0;
-	while (_vm->_eventMan->pollEvent(event) && running) {
-		switch (event.type) {
-		case Common::EVENT_KEYDOWN:
-			if (event.kbd.keycode == 'q' && event.kbd.flags == Common::KBD_CTRL)
-				_vm->quitGame();
-			else
-				_keyPressed = event.kbd; 
-			running = false;
-			break;
-
-		case Common::EVENT_LBUTTONDOWN:
-		case Common::EVENT_LBUTTONUP: {
-			Common::Point pos = _vm->getMousePos();
-			_vm->_mouseX = pos.x;
-			_vm->_mouseY = pos.y;
-			keys = event.type == Common::EVENT_LBUTTONDOWN ? 199 : (200 | 0x800);
-			running = false;
-			} break;
-
-		case Common::EVENT_MOUSEMOVE: {
-			Common::Point pos = _vm->getMousePos();
-			_vm->_mouseX = pos.x;
-			_vm->_mouseY = pos.y;
-			_screen->updateScreen();
-			_lastScreenUpdate = now;
-			} break;
-
-		default:
-			break;
-		}
-	}
-
-	if (now - _lastScreenUpdate > 50) {
-		_vm->_system->updateScreen();
-		_lastScreenUpdate = now;
-	}
-
-	processButtonList(_menuButtonList, keys | 0x8000, 0);
-	_vm->_system->delayMillis(3);
-}
-
 void GUI_v2::drawTextfieldBlock(int x, int y, uint8 c) {
 	_screen->fillRect(x+1, y+1, x+7, y+8, c);
 }

Modified: scummvm/trunk/engines/kyra/gui_v2.h
===================================================================
--- scummvm/trunk/engines/kyra/gui_v2.h	2008-12-16 13:19:43 UTC (rev 35392)
+++ scummvm/trunk/engines/kyra/gui_v2.h	2008-12-16 17:40:34 UTC (rev 35393)
@@ -121,6 +121,7 @@
 	bool _buttonListChanged;
 	Button *_backUpButtonList;
 	Button *_unknownButtonList;
+	uint16 _flagsModifier;
 
 protected:
 	virtual void setupPalette() {}
@@ -212,8 +213,6 @@
 
 	// savename menu
 	bool _finishNameInput, _cancelNameInput;
-	Common::KeyState _keyPressed;
-	uint32 _lastScreenUpdate;
 
 	const char *nameInputProcess(char *buffer, int x, int y, uint8 c1, uint8 c2, uint8 c3, int bufferSize);
 	int finishSavename(Button *caller);
@@ -221,7 +220,6 @@
 
 	bool checkSavegameDescription(const char *buffer, int size);
 	int getCharWidth(uint8 c);
-	void checkTextfieldInput();
 	void drawTextfieldBlock(int x, int y, uint8 c);
 
 	// choice menu

Modified: scummvm/trunk/engines/kyra/kyra_hof.h
===================================================================
--- scummvm/trunk/engines/kyra/kyra_hof.h	2008-12-16 13:19:43 UTC (rev 35392)
+++ scummvm/trunk/engines/kyra/kyra_hof.h	2008-12-16 17:40:34 UTC (rev 35393)
@@ -200,7 +200,7 @@
 
 	Screen *screen() { return _screen; }
 	Screen_v2 *screen_v2() const { return _screen; }
-	GUI_v2 *gui_v2() const { return _gui; }
+	GUI *gui() const { return _gui; }
 	virtual TextDisplayer *text() { return _text; }
 	int language() const { return _lang; }
 protected:

Modified: scummvm/trunk/engines/kyra/kyra_lok.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra_lok.cpp	2008-12-16 13:19:43 UTC (rev 35392)
+++ scummvm/trunk/engines/kyra/kyra_lok.cpp	2008-12-16 17:40:34 UTC (rev 35393)
@@ -48,7 +48,6 @@
 
 KyraEngine_LoK::KyraEngine_LoK(OSystem *system, const GameFlags &flags)
 	: KyraEngine_v1(system, flags) {
-	_skipFlag = false;
 
 	_seq_Forest = _seq_KallakWriting = _seq_KyrandiaLogo = _seq_KallakMalcolm =
 	_seq_MalcolmTree = _seq_WestwoodLogo = _seq_Demo1 = _seq_Demo2 = _seq_Demo3 =
@@ -220,8 +219,6 @@
 
 	memset(_flagsTable, 0, sizeof(_flagsTable));
 
-	_abortWalkFlag = false;
-	_abortWalkFlag2 = false;
 	_talkingCharNum = -1;
 	_charSayUnk3 = -1;
 	memset(_currSentenceColor, 0, 3);
@@ -247,12 +244,9 @@
 	assert(_movFacingTable);
 	_movFacingTable[0] = 8;
 
-	_skipFlag = false;
-
 	_marbleVaseItem = -1;
 	memset(_foyerItemTable, -1, sizeof(_foyerItemTable));
 	_itemInHand = -1;
-	_handleInput = false;
 
 	_currentRoom = 0xFFFF;
 	_scenePhasingFlag = 0;
@@ -279,8 +273,6 @@
 	_kyragemFadingState.gOffset = 0x13;
 	_kyragemFadingState.bOffset = 0x13;
 
-	_mousePressFlag = false;
-
 	_menuDirectlyToLoad = false;
 
 	_lastMusicCommand = 0;
@@ -297,18 +289,23 @@
 	_abortIntroFlag = false;
 
 	if (_flags.isDemo) {
+		_seqPlayerFlag = true;
 		seq_demo();
+		_seqPlayerFlag = false;
 	} else {
 		setGameFlag(0xF3);
 		setGameFlag(0xFD);
 		if (_gameToLoad == -1) {
 			setGameFlag(0xEF);
+			_seqPlayerFlag = true;
 			seq_intro();
 			if (shouldQuit())
 				return Common::kNoError;
 			if (_skipIntroFlag && _abortIntroFlag)
 				resetGameFlag(0xEF);
+			_seqPlayerFlag = false;
 		}
+		_eventList.clear();
 		startup();
 		resetGameFlag(0xEF);
 		mainLoop();
@@ -403,9 +400,10 @@
 void KyraEngine_LoK::mainLoop() {
 	debugC(9, kDebugLevelMain, "KyraEngine_LoK::mainLoop()");
 
+	_eventList.clear();
+
 	while (!shouldQuit()) {
 		int32 frameTime = (int32)_system->getMillis();
-		_skipFlag = false;
 
 		checkAutosave();
 
@@ -434,18 +432,24 @@
 			_brandonStatusBit0x20Flag = 0;
 		}
 
+		// FIXME: Why is this here?
 		_screen->showMouse();
 
-		_gui->processButtonList(_buttonList, 0, 0);
+		int inputFlag = checkInput(_buttonList, true);
+		removeInputTop();
+
 		updateMousePointer();
 		_timer->update();
+		_sound->process();
 		updateTextFade();
 
-		_handleInput = true;
-		delay((frameTime + _gameSpeed) - _system->getMillis(), true, true);
-		_handleInput = false;
+		if (inputFlag == 198 || inputFlag == 199)
+			processInput(_mouseX, _mouseY);
 
-		_sound->process();
+		if (skipFlag())
+			resetSkipFlag();
+
+		delay((frameTime + _gameSpeed) - _system->getMillis(), true, true);
 	}
 }
 
@@ -464,69 +468,9 @@
 
 	uint32 start = _system->getMillis();
 	do {
-		if (isMainLoop)
-			_isSaveAllowed = true;
-
-		while (_eventMan->pollEvent(event)) {
-			_isSaveAllowed = false;
-
-			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) {
-					int saveLoadSlot = 9 - (event.kbd.keycode - '0') + 990;
-
-					if (event.kbd.flags == Common::KBD_CTRL)
-						loadGameStateCheck(saveLoadSlot);
-					else {
-						char savegameName[14];
-						sprintf(savegameName, "Quicksave %d", event.kbd.keycode - '0');
-						saveGameState(saveLoadSlot, savegameName, 0);
-					}
-				} else if (event.kbd.flags == Common::KBD_CTRL) {
-					if (event.kbd.keycode == 'd')
-						_debugger->attach();
-					else if (event.kbd.keycode == 'q')
-						quitGame();
-				} else if (event.kbd.keycode == '.') {
-					_skipFlag = true;
+				/*} else if (event.kbd.keycode == '.') {
 				} 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_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 (isMainLoop)
-				_isSaveAllowed = true;
-		}
-
-		if (_debugger->isAttached())
-			_debugger->onFrame();
-
+					_abortIntroFlag = true;*/
 		if (update) {
 			_sprites->updateSceneAnims();
 			_animator->updateAllObjectShapes();
@@ -534,44 +478,33 @@
 			updateMousePointer();
 		}
 
+		updateInput();
+
 		if (_currentCharacter && _currentCharacter->sceneId == 210 && update)
 			updateKyragemFading();
 
-		if (_skipFlag && !_abortIntroFlag && !queryGameFlag(0xFE))
-			_skipFlag = false;
-
-		if (amount > 0 && !_skipFlag && !shouldQuit())
+		if (amount > 0 && !skipFlag() && !shouldQuit())
 			_system->delayMillis(10);
 
-		if (_skipFlag)
-			_sound->voiceStop();
-	} while (!_skipFlag && _system->getMillis() < start + amount && !shouldQuit());
-}
-
-void KyraEngine_LoK::waitForEvent() {
-	bool finished = false;
-	Common::Event event;
-
-	while (!finished && !shouldQuit()) {
-		while (_eventMan->pollEvent(event)) {
-			switch (event.type) {
-			case Common::EVENT_KEYDOWN:
-				finished = true;
-				break;
-			case Common::EVENT_LBUTTONDOWN:
-				finished = true;
-				_skipFlag = true;
-				break;
-			default:
-				break;
+		// FIXME: Major hackery to allow skipping the intro
+		if (_seqPlayerFlag) {
+			for (Common::List<Event>::iterator i = _eventList.begin(); i != _eventList.end(); ++i) {
+				if (i->causedSkip) {
+					if (i->event.type == Common::EVENT_KEYDOWN && i->event.kbd.keycode == Common::KEYCODE_ESCAPE)
+						_abortIntroFlag = true;
+					else
+						i->causedSkip = false;
+				}
 			}
 		}
 
-		if (_debugger->isAttached())
-			_debugger->onFrame();
+		if (skipFlag())
+			_sound->voiceStop();
+	} while (!skipFlag() && _system->getMillis() < start + amount && !shouldQuit());
+}
 
-		_system->delayMillis(10);
-	}
+bool KyraEngine_LoK::skipFlag() const {
+	return KyraEngine_v1::skipFlag() || shouldQuit();
 }
 
 void KyraEngine_LoK::delayWithTicks(int ticks) {
@@ -586,7 +519,7 @@
 			seq_playEnd();
 		}
 
-		if (_skipFlag)
+		if (skipFlag())
 			break;
 
 		if (nextTime - _system->getMillis() >= 10)
@@ -676,13 +609,8 @@
 #pragma mark - Input
 #pragma mark -
 
-void KyraEngine_LoK::processInput() {
-	Common::Point mouse = getMousePos();
-	int xpos = mouse.x;
-	int ypos = mouse.y;
-
+void KyraEngine_LoK::processInput(int xpos, int ypos) {
 	debugC(9, kDebugLevelMain, "KyraEngine_LoK::processInput(%d, %d)", xpos, ypos);
-	_abortWalkFlag2 = false;
 
 	if (processInputHelper(xpos, ypos))
 		return;
@@ -698,20 +626,18 @@
 	// XXX _deathHandler specific
 	if (ypos <= 158) {
 		uint16 exit = 0xFFFF;
-		if (xpos < 12) {
+
+		if (xpos < 12)
 			exit = _walkBlockWest;
-		} else if (xpos >= 308) {
+		else if (xpos >= 308)
 			exit = _walkBlockEast;
-		} else if (ypos >= 136) {
+		else if (ypos >= 136)
 			exit = _walkBlockSouth;
-		} else if (ypos < 12) {
+		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);
@@ -722,19 +648,14 @@
 			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;
+				if (ypos <= 155)
 					handleSceneChange(xpos, ypos, 1, 1);
-					_abortWalkFlag2 = false;
-				}
 			}
 		}
 	}

Modified: scummvm/trunk/engines/kyra/kyra_lok.h
===================================================================
--- scummvm/trunk/engines/kyra/kyra_lok.h	2008-12-16 13:19:43 UTC (rev 35392)
+++ scummvm/trunk/engines/kyra/kyra_lok.h	2008-12-16 17:40:34 UTC (rev 35393)
@@ -119,6 +119,7 @@
 
 	Screen *screen() { return _screen; }
 	Animator_LoK *animator() { return _animator; }
+	GUI *gui() const { return _gui; }
 	virtual Movie *createWSAMovie();
 
 	uint8 **shapes() { return _shapes; }
@@ -198,8 +199,9 @@
 	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();
 
+	bool skipFlag() const;
+
 	// TODO
 	void registerDefaultSettings();
 	void readSettings();
@@ -218,17 +220,13 @@
 	Common::Error loadGameState(int slot);
 protected:
 	// input
-	void processInput();
+	void processInput(int xpos, int ypos);
 	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);
 
-	bool _skipFlag;
-	bool skipFlag() const { return _skipFlag; }
-	void resetSkipFlag(bool removeEvent = true) { _skipFlag = false; }
-
 	// scene
 	// -> init
 	void loadSceneMsc();
@@ -389,16 +387,14 @@
 	int buttonInventoryCallback(Button *caller);
 	int buttonAmuletCallback(Button *caller);
 
+	bool _seqPlayerFlag;
 	bool _skipIntroFlag;
 	bool _abortIntroFlag;
+
 	bool _menuDirectlyToLoad;
-	bool _abortWalkFlag;
-	bool _abortWalkFlag2;
-	bool _mousePressFlag;
 	uint8 *_itemBkgBackUp[2];
 	uint8 *_shapes[373];
 	int8 _itemInHand;
-	bool _handleInput;
 	bool _changedScene;
 	int _unkScreenVar1, _unkScreenVar2, _unkScreenVar3;
 	int _beadStateVar;

Modified: scummvm/trunk/engines/kyra/kyra_mr.h
===================================================================
--- scummvm/trunk/engines/kyra/kyra_mr.h	2008-12-16 13:19:43 UTC (rev 35392)
+++ scummvm/trunk/engines/kyra/kyra_mr.h	2008-12-16 17:40:34 UTC (rev 35393)
@@ -57,7 +57,7 @@
 
 	Screen *screen() { return _screen; }
 	Screen_v2 *screen_v2() const { return _screen; }
-	GUI_v2 *gui_v2() const { return _gui; }
+	GUI *gui() const { return _gui; }
 	SoundDigital *soundDigital() { return _soundDigital; }
 	int language() const { return _lang; }
 	bool heliumMode() const { return _configHelium; }

Modified: scummvm/trunk/engines/kyra/kyra_v1.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v1.cpp	2008-12-16 13:19:43 UTC (rev 35392)
+++ scummvm/trunk/engines/kyra/kyra_v1.cpp	2008-12-16 17:40:34 UTC (rev 35393)
@@ -222,6 +222,148 @@
 	_system->warpMouse(x, y);
 }
 
+int KyraEngine_v1::checkInput(Button *buttonList, bool mainLoop) {
+	debugC(9, kDebugLevelMain, "KyraEngine_v1::checkInput(%p, %d)", (const void*)buttonList, mainLoop);
+	if (mainLoop)
+		_isSaveAllowed = true;
+
+	updateInput();
+
+	_isSaveAllowed = false;
+
+	int keys = 0;
+	int8 mouseWheel = 0;
+
+	while (_eventList.size()) {
+		Common::Event event = *_eventList.begin();
+		bool breakLoop = false;
+
+		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) && mainLoop) {
+				int saveLoadSlot = 9 - (event.kbd.keycode - '0') + 990;
+
+				if (event.kbd.flags == Common::KBD_CTRL) {
+					loadGameStateCheck(saveLoadSlot);
+					_eventList.clear();
+					breakLoop = true;
+				} else {
+					char savegameName[14];
+					sprintf(savegameName, "Quicksave %d", event.kbd.keycode - '0');
+					saveGameState(saveLoadSlot, savegameName, 0);
+				}
+			} else if (event.kbd.flags == Common::KBD_CTRL) {
+				if (event.kbd.keycode == 'd')
+					_debugger->attach();
+				else if (event.kbd.keycode == 'q')
+					quitGame();
+			}
+			break;
+
+		case Common::EVENT_MOUSEMOVE: {
+			Common::Point pos = getMousePos();
+			_mouseX = pos.x;
+			_mouseY = pos.y;
+			} break;
+
+		case Common::EVENT_LBUTTONDOWN:
+		case Common::EVENT_LBUTTONUP: {
+			Common::Point pos = getMousePos();
+			_mouseX = pos.x;
+			_mouseY = pos.y;
+			keys = (event.type == Common::EVENT_LBUTTONDOWN ? 199 : (200 | 0x800));
+			breakLoop = true;
+			} break;
+
+		case Common::EVENT_WHEELUP:
+			mouseWheel = -1;
+			break;
+
+		case Common::EVENT_WHEELDOWN:
+			mouseWheel = 1;
+			break;
+
+		default:
+			break;
+		}
+
+		if (_debugger->isAttached())
+			_debugger->onFrame();
+
+		if (breakLoop)
+			break;
+
+		_eventList.erase(_eventList.begin());
+	}
+
+	GUI *guiInstance = gui();
+	if (guiInstance)
+		return guiInstance->processButtonList(buttonList, keys | 0x8000, mouseWheel);
+	else
+		return keys;
+}
+
+void KyraEngine_v1::updateInput() {
+	Common::Event event;
+
+	while (_eventMan->pollEvent(event)) {
+		switch (event.type) {
+		case Common::EVENT_KEYDOWN:
+			if (event.kbd.keycode == '.' || event.kbd.keycode == Common::KEYCODE_ESCAPE)
+				_eventList.push_back(Event(event, true));
+			else if (event.kbd.keycode == 'q' && event.kbd.flags == Common::KBD_CTRL)
+				quitGame();
+			else
+				_eventList.push_back(event);
+			break;
+
+		case Common::EVENT_LBUTTONDOWN:
+			_eventList.push_back(Event(event, true));
+			break;
+
+		case Common::EVENT_MOUSEMOVE:
+			screen()->updateScreen();
+			// fall through
+
+		case Common::EVENT_LBUTTONUP:
+		case Common::EVENT_WHEELUP:
+		case Common::EVENT_WHEELDOWN:
+			_eventList.push_back(event);
+			break;
+
+		default:
+			break;
+		}
+	}
+}
+
+void KyraEngine_v1::removeInputTop() {
+	if (!_eventList.empty())
+		_eventList.erase(_eventList.begin());
+}
+
+bool KyraEngine_v1::skipFlag() const {
+	for (Common::List<Event>::const_iterator i = _eventList.begin(); i != _eventList.end(); ++i) {
+		if (i->causedSkip)
+			return true;
+	}
+	return false;
+}
+
+void KyraEngine_v1::resetSkipFlag(bool removeEvent) {
+	for (Common::List<Event>::iterator i = _eventList.begin(); i != _eventList.end(); ++i) {
+		if (i->causedSkip) {
+			if (removeEvent)
+				_eventList.erase(i);
+			else
+				i->causedSkip = false;
+			return;
+		}
+	}
+}
+
+
 int KyraEngine_v1::setGameFlag(int flag) {
 	_flagsTable[flag >> 3] |= (1 << (flag & 7));
 	return 1;

Modified: scummvm/trunk/engines/kyra/kyra_v1.h
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v1.h	2008-12-16 13:19:43 UTC (rev 35392)
+++ scummvm/trunk/engines/kyra/kyra_v1.h	2008-12-16 17:40:34 UTC (rev 35393)
@@ -105,7 +105,10 @@
 class StaticResource;
 class TimerManager;
 class Debugger;
+class GUI;
 
+struct Button;
+
 class KyraEngine_v1 : public Engine {
 friend class Debugger;
 friend class ::KyraMetaEngine;
@@ -115,7 +118,6 @@
 	KyraEngine_v1(OSystem *system, const GameFlags &flags);
 	virtual ~KyraEngine_v1();
 
-
 	uint8 game() const { return _flags.gameID; }
 	const GameFlags &gameFlags() const { return _flags; }
 
@@ -123,6 +125,7 @@
 	Resource *resource() { return _res; }
 	virtual Screen *screen() = 0;
 	virtual TextDisplayer *text() { return _text; }
+	virtual GUI *gui() const { return 0; }
 	Sound *sound() { return _sound; }
 	StaticResource *staticres() { return _staticres; }
 	TimerManager *timer() { return _timer; }
@@ -185,6 +188,25 @@
 	EMCInterpreter *_emc;
 	Debugger *_debugger;
 
+	// input
+	void updateInput();
+	int checkInput(Button *buttonList, bool mainLoop = false);
+	void removeInputTop();
+
+	int _mouseX, _mouseY;
+
+	struct Event {
+		Common::Event event;
+		bool causedSkip;
+
+		Event() : event(), causedSkip(false) {}
+		Event(Common::Event e) : event(e), causedSkip(false) {}
+		Event(Common::Event e, bool skip) : event(e), causedSkip(skip) {}
+
+		operator Common::Event() const { return event; }
+	};
+	Common::List<Event> _eventList;
+
 	// config specific
 	virtual void registerDefaultSettings();
 	virtual void readSettings();
@@ -197,8 +219,8 @@
 	uint8 _configVoice;
 
 	// game speed
-	virtual bool skipFlag() const = 0;
-	virtual void resetSkipFlag(bool removeEvent = true) = 0;
+	virtual bool skipFlag() const;
+	virtual void resetSkipFlag(bool removeEvent = true);
 
 	uint16 _tickLength;
 	uint16 _gameSpeed;

Modified: scummvm/trunk/engines/kyra/kyra_v2.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v2.cpp	2008-12-16 13:19:43 UTC (rev 35392)
+++ scummvm/trunk/engines/kyra/kyra_v2.cpp	2008-12-16 17:40:34 UTC (rev 35393)
@@ -162,141 +162,6 @@
 	} while (!skipFlag() && _system->getMillis() < start + amount && !shouldQuit());
 }
 
-int KyraEngine_v2::checkInput(Button *buttonList, bool mainLoop) {
-	debugC(9, kDebugLevelMain, "KyraEngine_v2::checkInput(%p, %d)", (const void*)buttonList, mainLoop);
-	if (mainLoop)
-		_isSaveAllowed = true;
-
-	updateInput();
-
-	_isSaveAllowed = false;
-
-	int keys = 0;
-	int8 mouseWheel = 0;
-
-	while (_eventList.size()) {
-		Common::Event event = *_eventList.begin();
-		bool breakLoop = false;
-
-		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) && mainLoop) {
-				int saveLoadSlot = 9 - (event.kbd.keycode - '0') + 990;
-
-				if (event.kbd.flags == Common::KBD_CTRL) {
-					loadGameStateCheck(saveLoadSlot);
-					_eventList.clear();
-					breakLoop = true;
-				} else {
-					char savegameName[14];
-					sprintf(savegameName, "Quicksave %d", event.kbd.keycode - '0');
-					saveGameState(saveLoadSlot, savegameName, 0);
-				}
-			} else if (event.kbd.flags == Common::KBD_CTRL) {
-				if (event.kbd.keycode == 'd')
-					_debugger->attach();
-			}
-			break;
-
-		case Common::EVENT_MOUSEMOVE: {
-			Common::Point pos = getMousePos();
-			_mouseX = pos.x;
-			_mouseY = pos.y;
-			} break;
-
-		case Common::EVENT_LBUTTONDOWN:
-		case Common::EVENT_LBUTTONUP: {
-			Common::Point pos = getMousePos();
-			_mouseX = pos.x;
-			_mouseY = pos.y;
-			keys = (event.type == Common::EVENT_LBUTTONDOWN ? 199 : (200 | 0x800));
-			breakLoop = true;
-			} break;
-
-		case Common::EVENT_WHEELUP:
-			mouseWheel = -1;
-			break;
-
-		case Common::EVENT_WHEELDOWN:
-			mouseWheel = 1;
-			break;
-
-		default:
-			break;
-		}
-
-		if (_debugger->isAttached())
-			_debugger->onFrame();
-
-		if (breakLoop)
-			break;
-
-		_eventList.erase(_eventList.begin());
-	}
-
-	return gui_v2()->processButtonList(buttonList, keys | 0x8000, mouseWheel);
-}
-
-void KyraEngine_v2::updateInput() {
-	Common::Event event;
-
-	while (_eventMan->pollEvent(event)) {
-		switch (event.type) {
-		case Common::EVENT_KEYDOWN:
-			if (event.kbd.keycode == '.' || event.kbd.keycode == Common::KEYCODE_ESCAPE)
-				_eventList.push_back(Event(event, true));
-			else if (event.kbd.keycode == 'q' && event.kbd.flags == Common::KBD_CTRL)
-				quitGame();
-			else
-				_eventList.push_back(event);
-			break;
-
-		case Common::EVENT_LBUTTONDOWN:
-			_eventList.push_back(Event(event, true));
-			break;
-
-		case Common::EVENT_MOUSEMOVE:
-			screen_v2()->updateScreen();
-			// fall through
-
-		case Common::EVENT_LBUTTONUP:
-		case Common::EVENT_WHEELUP:
-		case Common::EVENT_WHEELDOWN:
-			_eventList.push_back(event);
-			break;
-
-		default:
-			break;
-		}
-	}
-}
-
-void KyraEngine_v2::removeInputTop() {
-	if (!_eventList.empty())
-		_eventList.erase(_eventList.begin());
-}
-
-bool KyraEngine_v2::skipFlag() const {
-	for (Common::List<Event>::const_iterator i = _eventList.begin(); i != _eventList.end(); ++i) {
-		if (i->causedSkip)
-			return true;
-	}
-	return false;
-}
-
-void KyraEngine_v2::resetSkipFlag(bool removeEvent) {
-	for (Common::List<Event>::iterator i = _eventList.begin(); i != _eventList.end(); ++i) {
-		if (i->causedSkip) {
-			if (removeEvent)
-				_eventList.erase(i);
-			else
-				i->causedSkip = false;
-			return;
-		}
-	}
-}
-
 bool KyraEngine_v2::checkSpecialSceneExit(int num, int x, int y) {
 	if (_specialExitTable[0+num] > x || _specialExitTable[5+num] > y ||
 		_specialExitTable[10+num] < x || _specialExitTable[15+num] < y)

Modified: scummvm/trunk/engines/kyra/kyra_v2.h
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v2.h	2008-12-16 13:19:43 UTC (rev 35392)
+++ scummvm/trunk/engines/kyra/kyra_v2.h	2008-12-16 17:40:34 UTC (rev 35393)
@@ -78,7 +78,6 @@
 	virtual void pauseEngineIntern(bool pause);
 
 	virtual Screen_v2 *screen_v2() const = 0;
-	virtual GUI *gui_v2() const = 0;
 
 	void delay(uint32 time, bool update = false, bool isMainLoop = false);
 
@@ -103,27 +102,6 @@
 	// Input
 	virtual int inputSceneChange(int x, int y, int unk1, int unk2) = 0;
 
-	void updateInput();
-	int checkInput(Button *buttonList, bool mainLoop = false);
-	void removeInputTop();
-
-	int _mouseX, _mouseY;
-
-	struct Event {
-		Common::Event event;
-		bool causedSkip;
-
-		Event() : event(), causedSkip(false) {}
-		Event(Common::Event e) : event(e), causedSkip(false) {}
-		Event(Common::Event e, bool skip) : event(e), causedSkip(skip) {}
-
-		operator Common::Event() const { return event; }
-	};
-	Common::List<Event> _eventList;
-
-	virtual bool skipFlag() const;
-	virtual void resetSkipFlag(bool removeEvent = true);
-
 	// Animator
 	struct AnimObj {
 		uint16 index;

Modified: scummvm/trunk/engines/kyra/saveload_lok.cpp
===================================================================
--- scummvm/trunk/engines/kyra/saveload_lok.cpp	2008-12-16 13:19:43 UTC (rev 35392)
+++ scummvm/trunk/engines/kyra/saveload_lok.cpp	2008-12-16 17:40:34 UTC (rev 35393)
@@ -202,9 +202,6 @@
 	_screen->_disableScreen = false;
 	_screen->updateScreen();
 
-	_abortWalkFlag = true;
-	_abortWalkFlag2 = false;
-	_mousePressFlag = false;
 	setMousePos(brandonX, brandonY);
 	
 	if (in->err() || in->eos()) {

Modified: scummvm/trunk/engines/kyra/scene_lok.cpp
===================================================================
--- scummvm/trunk/engines/kyra/scene_lok.cpp	2008-12-16 13:19:43 UTC (rev 35392)
+++ scummvm/trunk/engines/kyra/scene_lok.cpp	2008-12-16 17:40:34 UTC (rev 35393)
@@ -44,9 +44,6 @@
 	debugC(9, kDebugLevelMain, "KyraEngine_LoK::enterNewScene(%d, %d, %d, %d, %d)", sceneId, facing, unk1, unk2, brandonAlive);
 	int unkVar1 = 1;
 	_screen->hideMouse();
-	_handleInput = false;
-	_abortWalkFlag = false;
-	_abortWalkFlag2 = false;
 
 	// TODO: Check how the original handled sfx still playing
 	_sound->stopAllSoundEffects();
@@ -923,18 +920,8 @@
 	bool running = true;
 	int returnValue = 0;
 	uint32 nextFrame = 0;
-	_abortWalkFlag = false;
-	_mousePressFlag = false;
 
 	while (running) {
-		if (_abortWalkFlag) {
-			*table = 8;
-			_currentCharacter->currentAnimFrame = 7;
-			_animator->animRefreshNPC(0);
-			_animator->updateAllObjectShapes();
-			processInput();
-			return 0;
-		}
 		bool forceContinue = false;
 		switch (*table) {
 		case 0: case 1: case 2:
@@ -955,13 +942,12 @@
 		}
 
 		returnValue = changeScene(_currentCharacter->facing);
-		if (returnValue) {
+		if (returnValue)
 			running = false;
-			_abortWalkFlag = false;
-		}
 
 		if (unk1) {
-			if (_mousePressFlag) {
+			if (skipFlag()) {
+				resetSkipFlag(false);
 				running = false;
 				_sceneChangeState = 1;
 			}

Modified: scummvm/trunk/engines/kyra/script_lok.cpp
===================================================================
--- scummvm/trunk/engines/kyra/script_lok.cpp	2008-12-16 13:19:43 UTC (rev 35392)
+++ scummvm/trunk/engines/kyra/script_lok.cpp	2008-12-16 17:40:34 UTC (rev 35393)
@@ -44,7 +44,7 @@
 }
 
 int KyraEngine_LoK::o1_characterSays(EMCState *script) {
-	_skipFlag = false;
+	resetSkipFlag();
 	if (_flags.isTalkie) {
 		debugC(3, kDebugLevelScriptFuncs, "KyraEngine_LoK::o1_characterSays(%p) (%d, '%s', %d, %d)", (const void *)script, stackPos(0), stackPosString(1), stackPos(2), stackPos(3));
 		characterSays(stackPos(0), stackPosString(1), stackPos(2), stackPos(3));
@@ -330,11 +330,11 @@
 		}
 	} else {
 		debugC(3, kDebugLevelScriptFuncs, "KyraEngine_LoK::o1_delaySecs(%p) (%d)", (const void *)script, stackPos(0));
-		if (stackPos(0) >= 0 && !_skipFlag)
+		if (stackPos(0) >= 0 && !skipFlag())
 			delay(stackPos(0)*1000, true);
 	}
 
-	_skipFlag = false;
+	resetSkipFlag();
 	return 0;
 }
 
@@ -470,7 +470,7 @@
 	while (_system->getMillis() < continueTime) {
 		_sprites->updateSceneAnims();
 		_animator->updateAllObjectShapes();
-		if (_skipFlag)
+		if (skipFlag())
 			break;
 
 		if (continueTime - _system->getMillis() >= 10)
@@ -607,12 +607,12 @@
 			snd_playVoiceFile(stackPos(0));
 		}
 
-		_skipFlag = false;
+		resetSkipFlag();
 		if (textEnabled())
 			_text->printTalkTextMessage(stackPosString(1), stackPos(2), stackPos(3), stackPos(4) & 0xFF, 0, 2);
 	} else {
 		debugC(3, kDebugLevelScriptFuncs, "KyraEngine_LoK::o1_customPrintTalkString(%p) ('%s', %d, %d, %d)", (const void *)script, stackPosString(0), stackPos(1), stackPos(2), stackPos(3) & 0xFF);
-		_skipFlag = false;
+		resetSkipFlag();
 		_text->printTalkTextMessage(stackPosString(0), stackPos(1), stackPos(2), stackPos(3) & 0xFF, 0, 2);
 	}
 	_screen->updateScreen();
@@ -699,7 +699,7 @@
 	while (_system->getMillis() < continueTime) {
 		_sprites->updateSceneAnims();
 		_animator->updateAllObjectShapes();
-		if (_skipFlag)
+		if (skipFlag())
 			break;
 
 		if (continueTime - _system->getMillis() >= 10)
@@ -787,7 +787,7 @@
 				while (_system->getMillis() < continueTime) {
 					_sprites->updateSceneAnims();
 					_animator->updateAllObjectShapes();
-					if (_skipFlag)
+					if (skipFlag())
 						break;
 
 					if (continueTime - _system->getMillis() >= 10)
@@ -805,7 +805,7 @@
 				while (_system->getMillis() < continueTime) {
 					_sprites->updateSceneAnims();
 					_animator->updateAllObjectShapes();
-					if (_skipFlag)
+					if (skipFlag())
 						break;
 
 					if (continueTime - _system->getMillis() >= 10)
@@ -815,7 +815,7 @@
 			}
 		}
 
-		if (_skipFlag)
+		if (skipFlag())
 			break;
 		else
 			++curTime;
@@ -927,7 +927,17 @@
 
 int KyraEngine_LoK::o1_getKey(EMCState *script) {
 	debugC(3, kDebugLevelScriptFuncs, "KyraEngine_LoK::o1_getKey(%p) ()", (const void *)script);
-	waitForEvent();
+
+	// TODO: Check this implementation
+
+	while (true) {
+		delay(10);
+
+		if (skipFlag())
+			break;
+	}
+
+	resetSkipFlag();
 	return 0;
 }
 
@@ -1338,26 +1348,25 @@
 
 int KyraEngine_LoK::o1_waitForConfirmationMouseClick(EMCState *script) {
 	debugC(3, kDebugLevelScriptFuncs, "KyraEngine_LoK::o1_waitForConfirmationMouseClick(%p) ()", (const void *)script);
-	// if (mouseEnabled) {
-	while (!_mousePressFlag) {
+
+	while (true) {
 		updateMousePointer();
 		_sprites->updateSceneAnims();
 		_animator->updateAllObjectShapes();
+
+		updateInput();
+		
+		int input = checkInput(_buttonList, false) & 0xFF;
+		removeInputTop();
+		if (input == 200)
+			break;
+
 		delay(10);
 	}
 
-	while (_mousePressFlag) {
-		updateMousePointer();
-		_sprites->updateSceneAnims();
-		_animator->updateAllObjectShapes();
-		delay(10);
-	}
-	// }
-	_gui->processButtonList(_buttonList, 0, 0);
-	_skipFlag = false;
-	Common::Point mouse = getMousePos();
-	script->regs[1] = mouse.x;
-	script->regs[2] = mouse.y;
+	script->regs[1] = _mouseX;
+	script->regs[2] = _mouseY;
+
 	return 0;
 }
 

Modified: scummvm/trunk/engines/kyra/sequences_lok.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sequences_lok.cpp	2008-12-16 13:19:43 UTC (rev 35392)
+++ scummvm/trunk/engines/kyra/sequences_lok.cpp	2008-12-16 17:40:34 UTC (rev 35393)
@@ -107,8 +107,9 @@
 	if ((in = _saveFileMan->openForLoading(getSavegameFilename(0)))) {
 		delete in;
 		_skipIntroFlag = true;
-	} else
+	} else {
 		_skipIntroFlag = false;
+	}
 
 	_seq->setCopyViewOffs(true);
 	_screen->setFont(Screen::FID_8_FNT);
@@ -163,7 +164,7 @@
 	_screen->updateScreen();
 	_screen->fadeFromBlack();
 
-	if (_seq->playSequence(_seq_WestwoodLogo, _skipFlag) || shouldQuit()) {
+	if (_seq->playSequence(_seq_WestwoodLogo, skipFlag()) || shouldQuit()) {
 		_screen->fadeToBlack();
 		_screen->clearPage(0);
 		return;
@@ -175,7 +176,7 @@
 		_screen->setScreenPalette(_screen->_currentPalette);
 	}
 
-	if ((_seq->playSequence(_seq_KyrandiaLogo, _skipFlag) && !seq_skipSequence()) || shouldQuit()) {
+	if ((_seq->playSequence(_seq_KyrandiaLogo, skipFlag()) && !seq_skipSequence()) || shouldQuit()) {
 		_screen->fadeToBlack();
 		_screen->clearPage(0);
 		return;
@@ -274,7 +275,7 @@
 	}
 
 	_screen->updateScreen();
-	//debugC(0, kDebugLevelMain, "skipFlag %i, %i", _skipFlag, _tickLength);
+	//debugC(0, kDebugLevelMain, "skipFlag %i, %i", skipFlag(), _tickLength);
 	delay(360 * _tickLength);
 }
 

Modified: scummvm/trunk/engines/kyra/sound_lok.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sound_lok.cpp	2008-12-16 13:19:43 UTC (rev 35392)
+++ scummvm/trunk/engines/kyra/sound_lok.cpp	2008-12-16 17:40:34 UTC (rev 35393)
@@ -82,7 +82,7 @@
 
 void KyraEngine_LoK::snd_voiceWaitForFinish(bool ingame) {
 	debugC(9, kDebugLevelMain | kDebugLevelSound, "KyraEngine_LoK::snd_voiceWaitForFinish(%d)", ingame);
-	while (_sound->voiceIsPlaying() && !_skipFlag) {
+	while (_sound->voiceIsPlaying() && !skipFlag()) {
 		if (ingame)
 			delay(10, true);
 		else

Modified: scummvm/trunk/engines/kyra/text_lok.cpp
===================================================================
--- scummvm/trunk/engines/kyra/text_lok.cpp	2008-12-16 13:19:43 UTC (rev 35392)
+++ scummvm/trunk/engines/kyra/text_lok.cpp	2008-12-16 17:40:34 UTC (rev 35393)
@@ -114,22 +114,11 @@
 		uint32 nextTime = loopStart + _tickLength;
 
 		while (_system->getMillis() < nextTime) {
-			while (_eventMan->pollEvent(event)) {
-				switch (event.type) {
-				case Common::EVENT_KEYDOWN:
-					if (event.kbd.keycode == '.')
-						_skipFlag = true;
-					break;
-				case Common::EVENT_RTL:
-				case Common::EVENT_QUIT:
-					runLoop = false;
-					break;
-				case Common::EVENT_LBUTTONDOWN:
-					runLoop = false;
-					break;
-				default:
-					break;
-				}
+			updateInput();
+
+			if (skipFlag()) {
+				runLoop = false;
+				break;
 			}
 
 			if (nextTime - _system->getMillis() >= 10) {
@@ -137,13 +126,12 @@
 				_system->updateScreen();
 			}
 		}
-
-		if (_skipFlag)
-			runLoop = false;
 	}
 
-	if (_skipFlag)
+	if (skipFlag()) {
+		resetSkipFlag();
 		snd_stopVoice();
+	}
 
 	_timer->enable(14);
 	_timer->enable(15);


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