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

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Thu Apr 17 16:26:52 CEST 2008


Revision: 31536
          http://scummvm.svn.sourceforge.net/scummvm/?rev=31536&view=rev
Author:   lordhoto
Date:     2008-04-17 07:26:50 -0700 (Thu, 17 Apr 2008)

Log Message:
-----------
Implemented kyra3 timer code.

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/kyra_v3.cpp
    scummvm/trunk/engines/kyra/kyra_v3.h
    scummvm/trunk/engines/kyra/module.mk
    scummvm/trunk/engines/kyra/scene_v3.cpp

Added Paths:
-----------
    scummvm/trunk/engines/kyra/timer_v3.cpp

Modified: scummvm/trunk/engines/kyra/kyra_v3.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v3.cpp	2008-04-17 13:38:44 UTC (rev 31535)
+++ scummvm/trunk/engines/kyra/kyra_v3.cpp	2008-04-17 14:26:50 UTC (rev 31536)
@@ -85,7 +85,7 @@
 	_lastCharPalLayer = -1;
 	_charPalUpdate = false;
 	_runFlag = false;
-	_unkInputFlag = false;
+	_unk5 = 0;
 	_unkSceneScreenFlag1 = false;
 	_noScriptEnter = true;
 	_itemInHand = _handItemSet = -1;
@@ -706,12 +706,20 @@
 		_text->printText(string, x, _commandLineY, c0, c1, 0);
 		_screen->_curPage = pageBackUp;
 		_screen->updateScreen();
-		//setCommandLineRestoreTimer(7);
+		setCommandLineRestoreTimer(7);
 	}
 
 	_screen->showMouse();
 }
 
+void KyraEngine_v3::updateCommandLine() {
+	debugC(9, kDebugLevelMain, "KyraEngine_v3::updateCommandLine()");
+	if (_restoreCommandLine) {
+		restoreCommandLine();
+		_restoreCommandLine = false;
+	}
+}
+
 void KyraEngine_v3::restoreCommandLine() {
 	debugC(9, kDebugLevelMain, "KyraEngine_v3::restoreCommandLine()");
 	int y = _inventoryState ? 144 : 188;
@@ -910,6 +918,7 @@
 	musicUpdate(0);
 	//XXX
 	updateSpecialSceneScripts();
+	updateCommandLine();
 	//XXX
 	musicUpdate(0);
 

Modified: scummvm/trunk/engines/kyra/kyra_v3.h
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v3.h	2008-04-17 13:38:44 UTC (rev 31535)
+++ scummvm/trunk/engines/kyra/kyra_v3.h	2008-04-17 14:26:50 UTC (rev 31536)
@@ -69,7 +69,6 @@
 
 	// run
 	bool _runFlag;
-	bool _unkInputFlag;
 
 	void runLoop();
 	void handleInput(int x, int y);
@@ -130,9 +129,15 @@
 	MainMenu *_menu;
 
 	// timer
-	void setupTimers() {}
-	void setWalkspeed(uint8) {}
+	void setupTimers();
 
+	void setWalkspeed(uint8);
+	void setCommandLineRestoreTimer(int secs);
+
+	void timerRestoreCommandLine(int arg);
+	void timerRunSceneScript7(int arg);
+	void timerFleaDeath(int arg);
+
 	// pathfinder
 	bool lineIsPassable(int, int) { return false; }
 
@@ -198,6 +203,7 @@
 	void loadInterface();
 
 	void showMessage(const char *string, uint8 c0, uint8 c1);
+	void updateCommandLine();
 	void restoreCommandLine();
 
 	int _commandLineY;
@@ -394,7 +400,7 @@
 	uint8 *_gfxBackUpRect;
 	uint8 *_paletteOverlay;
 
-	int _unk3, _unk4;
+	int _unk3, _unk4, _unk5;
 
 	void loadCostPal();
 	void loadShadowShape();

Modified: scummvm/trunk/engines/kyra/module.mk
===================================================================
--- scummvm/trunk/engines/kyra/module.mk	2008-04-17 13:38:44 UTC (rev 31535)
+++ scummvm/trunk/engines/kyra/module.mk	2008-04-17 14:26:50 UTC (rev 31536)
@@ -50,6 +50,7 @@
 	timer.o \
 	timer_v1.o \
 	timer_v2.o \
+	timer_v3.o \
 	vqa.o \
 	wsamovie.o
 

Modified: scummvm/trunk/engines/kyra/scene_v3.cpp
===================================================================
--- scummvm/trunk/engines/kyra/scene_v3.cpp	2008-04-17 13:38:44 UTC (rev 31535)
+++ scummvm/trunk/engines/kyra/scene_v3.cpp	2008-04-17 14:26:50 UTC (rev 31536)
@@ -150,14 +150,14 @@
 
 	enterNewSceneUnk1(facing, unk2, unk3);
 	musicUpdate(0);
-	//XXX setCommandLineRestoreTimer(-1);
+	setCommandLineRestoreTimer(-1);
 	_sceneScriptState.regs[3] = 1;
 	enterNewSceneUnk2(unk3);
 	if (queryGameFlag(0)) {
 		_runFlag = false;
 	} else {
 		if (!--_enterNewSceneLock)
-			_unkInputFlag = false;
+			_unk5 = 0;
 		//XXX
 		if (_itemInHand <= 0) {
 			_itemInHand = -1;

Added: scummvm/trunk/engines/kyra/timer_v3.cpp
===================================================================
--- scummvm/trunk/engines/kyra/timer_v3.cpp	                        (rev 0)
+++ scummvm/trunk/engines/kyra/timer_v3.cpp	2008-04-17 14:26:50 UTC (rev 31536)
@@ -0,0 +1,87 @@
+/* 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_v3.h"
+#include "kyra/timer.h"
+
+namespace Kyra {
+
+#define TimerV3(x) new Functor1Mem<int, void, KyraEngine_v3>(this, &KyraEngine_v3::x)
+
+void KyraEngine_v3::setupTimers() {
+	debugC(9, kDebugLevelMain | kDebugLevelTimer, "KyraEngine_v3::setupTimers()");
+
+	_timer->addTimer(0, TimerV3(timerRestoreCommandLine), -1, 1);
+	for (int i = 1; i <= 3; ++i)
+		_timer->addTimer(i, TimerV3(timerRunSceneScript7), -1, 0);
+	_timer->addTimer(4, TimerV3(timerFleaDeath), -1, 0);
+	for (int i = 5; i <= 11; ++i)
+		_timer->addTimer(i, TimerV3(timerRunSceneScript7), -1, 0);
+	for (int i = 12; i <= 13; ++i)
+		_timer->addTimer(i, TimerV3(timerRunSceneScript7), 0, 0);
+}
+
+void KyraEngine_v3::timerRestoreCommandLine(int arg) {
+	debugC(9, kDebugLevelMain | kDebugLevelTimer, "KyraEngine_v3::timerRestoreCommandLine(%d)", arg);
+	if (_shownMessage)
+		_restoreCommandLine = true;
+}
+
+void KyraEngine_v3::timerRunSceneScript7(int arg) {
+	debugC(9, kDebugLevelMain | kDebugLevelTimer, "KyraEngine_v3::timerRunSceneScript7(%d)", arg);
+	_sceneScriptState.regs[1] = _mouseX;
+	_sceneScriptState.regs[2] = _mouseY;
+	_sceneScriptState.regs[3] = 0;
+	_sceneScriptState.regs[4] = _itemInHand;
+	_scriptInterpreter->startScript(&_sceneScriptState, 7);
+
+	while (_scriptInterpreter->validScript(&_sceneScriptState))
+		_scriptInterpreter->runScript(&_sceneScriptState);
+}
+
+void KyraEngine_v3::timerFleaDeath(int arg) {
+	debugC(9, kDebugLevelMain | kDebugLevelTimer, "KyraEngine_v3::timerFleaDeath(%d)", arg);
+	warning("STUB timerFleaDeath");
+}
+
+void KyraEngine_v3::setWalkspeed(uint8 speed) {
+	debugC(9, kDebugLevelMain | kDebugLevelTimer, "KyraEngine_v3::setWalkspeed(%d)", speed);
+
+	if (speed < 5)
+		speed = 3;
+	else
+		speed = 5;
+
+	_mainCharacter.walkspeed = speed;
+}
+
+void KyraEngine_v3::setCommandLineRestoreTimer(int secs) {
+	debugC(9, kDebugLevelMain | kDebugLevelTimer, "KyraEngine_v3::setCommandLineRestoreTimer(%d)", secs);
+	if (secs == -1)
+		secs = 32000;
+	_timer->setCountdown(0, secs*60);
+}
+
+} // end of namespace Kyra


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


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