[Scummvm-cvs-logs] SF.net SVN: scummvm: [24282] scummvm/trunk/engines/agos

kirben at users.sourceforge.net kirben at users.sourceforge.net
Wed Oct 11 17:11:05 CEST 2006


Revision: 24282
          http://svn.sourceforge.net/scummvm/?rev=24282&view=rev
Author:   kirben
Date:     2006-10-11 08:10:59 -0700 (Wed, 11 Oct 2006)

Log Message:
-----------
Cleanup

Modified Paths:
--------------
    scummvm/trunk/engines/agos/agos.cpp
    scummvm/trunk/engines/agos/agos.h
    scummvm/trunk/engines/agos/event.cpp

Modified: scummvm/trunk/engines/agos/agos.cpp
===================================================================
--- scummvm/trunk/engines/agos/agos.cpp	2006-10-11 15:01:35 UTC (rev 24281)
+++ scummvm/trunk/engines/agos/agos.cpp	2006-10-11 15:10:59 UTC (rev 24282)
@@ -28,8 +28,6 @@
 #include "common/fs.h"
 #include "common/system.h"
 
-#include "gui/about.h"
-
 #include "agos/debugger.h"
 #include "agos/intern.h"
 #include "agos/agos.h"
@@ -1333,7 +1331,7 @@
 			if (getGameType() != GType_FF && getGameType() != GType_PP && _keyPressed == 35)
 				displayBoxStars();
 			if (getGameType() == GType_PP) {
-				if (checkArrows() != 0) {
+				if (processSpecialKeys() != 0) {
 					_needHitAreaRecalc++;
 					return;
 				}
@@ -1990,30 +1988,9 @@
 	return false;
 }
 
-bool AGOSEngine::checkArrows() {
+bool AGOSEngine::processSpecialKeys() {
 	switch (_keyPressed) {
 	case 17: // Up
-		_verbHitArea = 302;
-		break;
-	case 18: // Down
-		_verbHitArea = 304;
-		break;
-	case 19: // Right
-		_verbHitArea = 303;
-		break;
-	case 20: // Left
-		_verbHitArea = 301;
-		break;
-	}
-
-	bool result = (_keyPressed != 0);
-	_keyPressed = 0;
-	return result;
-}
-
-void AGOSEngine::processSpecialKeys() {
-	switch (_keyPressed) {
-	case 17: // Up
 		if (getGameType() == GType_PP)
 			_verbHitArea = 302;
 		break;
@@ -2127,7 +2104,9 @@
 		break;
 	}
 
+	bool result = (_keyPressed != 0);
 	_keyPressed = 0;
+	return result;
 }
 
 void AGOSEngine::pause() {
@@ -2355,125 +2334,6 @@
 	_system->quit();
 }
 
-void AGOSEngine::delay(uint amount) {
-	OSystem::Event event;
-
-	uint32 start = _system->getMillis();
-	uint32 cur = start;
-	uint this_delay, vga_period;
-
-	if (_debugger->isAttached())
-		_debugger->onFrame();
-
-	if (_fastMode)
-	 	vga_period = 10;
-	else if (getGameType() == GType_SIMON2)
-		vga_period = 45;
-	else
-		vga_period = 50;
-
-	_rnd.getRandomNumber(2);
-
-	do {
-		while (!_inCallBack && cur >= _lastVgaTick + vga_period && !_pause) {
-			_lastVgaTick += vga_period;
-
-			// don't get too many frames behind
-			if (cur >= _lastVgaTick + vga_period * 2)
-				_lastVgaTick = cur;
-
-			_inCallBack = true;
-			timer_callback();
-			_inCallBack = false;
-		}
-
-		while (_system->pollEvent(event)) {
-			switch (event.type) {
-			case OSystem::EVENT_KEYDOWN:
-				if (event.kbd.keycode >= '0' && event.kbd.keycode <='9'
-					&& (event.kbd.flags == OSystem::KBD_ALT ||
-						event.kbd.flags == OSystem::KBD_CTRL)) {
-					_saveLoadSlot = event.kbd.keycode - '0';
-
-					// There is no save slot 0
-					if (_saveLoadSlot == 0)
-						_saveLoadSlot = 10;
-
-					sprintf(_saveLoadName, "Quicksave %d", _saveLoadSlot);
-					_saveLoadType = (event.kbd.flags == OSystem::KBD_ALT) ? 1 : 2;
-
-					// We should only allow a load or save when it was possible in original
-					// This stops load/save during copy protection, conversations and cut scenes
-					if (!_mouseHideCount && !_showPreposition)
-						quickLoadOrSave();
-				} else if (event.kbd.flags == OSystem::KBD_CTRL) {
-					if (event.kbd.keycode == 'a') {
-						GUI::Dialog *_aboutDialog;
-						_aboutDialog = new GUI::AboutDialog();
-						_aboutDialog->runModal();
-					} else if (event.kbd.keycode == 'f')
-						_fastMode ^= 1;
-					else if (event.kbd.keycode == 'd')
-						_debugger->attach();
-				} 
-
-				if (getGameType() == GType_PP) {
-					if (event.kbd.flags == OSystem::KBD_SHIFT)
-						_variableArray[41] = 0;
-					else
-						_variableArray[41] = 1;
-				}
-
-				// Make sure backspace works right (this fixes a small issue on OS X)
-				if (event.kbd.keycode == 8)
-					_keyPressed = 8;
-				else
-					_keyPressed = (byte)event.kbd.ascii;
-				break;
-			case OSystem::EVENT_MOUSEMOVE:
-				_sdlMouseX = event.mouse.x;
-				_sdlMouseY = event.mouse.y;
-				break;
-			case OSystem::EVENT_LBUTTONDOWN:
-				if (getGameType() == GType_FF)
-					setBitFlag(89, true);
-				_leftButtonDown++;
-#if defined (_WIN32_WCE) || defined(PALMOS_MODE)
-				_sdlMouseX = event.mouse.x;
-				_sdlMouseY = event.mouse.y;
-#endif
-				break;
-			case OSystem::EVENT_LBUTTONUP:
-				if (getGameType() == GType_FF)
-					setBitFlag(89, false);
-				break;
-			case OSystem::EVENT_RBUTTONDOWN:
-				if (getGameType() == GType_FF)
-					setBitFlag(92, false);
-				_rightButtonDown++;
-				break;
-			case OSystem::EVENT_QUIT:
-				shutdown();
-				return;
-			default:
-				break;
-			}
-		}
-
-		_system->updateScreen();
-
-		if (amount == 0)
-			break;
-
-		this_delay = _fastMode ? 1 : 20;
-		if (this_delay > amount)
-			this_delay = amount;
-		_system->delayMillis(this_delay);
-
-		cur = _system->getMillis();
-	} while (cur < start + amount);
-}
-
 void AGOSEngine::loadMusic(uint music) {
 	char buf[4];
 

Modified: scummvm/trunk/engines/agos/agos.h
===================================================================
--- scummvm/trunk/engines/agos/agos.h	2006-10-11 15:01:35 UTC (rev 24281)
+++ scummvm/trunk/engines/agos/agos.h	2006-10-11 15:10:59 UTC (rev 24282)
@@ -740,8 +740,7 @@
 	void loadIconData();	
 	void loadIconFile();
 
-	bool checkArrows();
-	void processSpecialKeys();
+	bool processSpecialKeys();
 	void hitarea_stuff_helper();
 
 	void permitInput();

Modified: scummvm/trunk/engines/agos/event.cpp
===================================================================
--- scummvm/trunk/engines/agos/event.cpp	2006-10-11 15:01:35 UTC (rev 24281)
+++ scummvm/trunk/engines/agos/event.cpp	2006-10-11 15:10:59 UTC (rev 24282)
@@ -24,8 +24,13 @@
 #include "common/stdafx.h"
 
 #include "agos/agos.h"
+#include "agos/debugger.h"
 #include "agos/intern.h"
 
+#include "common/system.h"
+
+#include "gui/about.h"
+
 namespace AGOS {
 
 void AGOSEngine::addTimeEvent(uint timeout, uint subroutine_id) {
@@ -302,6 +307,125 @@
 	}
 }
 
+void AGOSEngine::delay(uint amount) {
+	OSystem::Event event;
+
+	uint32 start = _system->getMillis();
+	uint32 cur = start;
+	uint this_delay, vga_period;
+
+	if (_debugger->isAttached())
+		_debugger->onFrame();
+
+	if (_fastMode)
+	 	vga_period = 10;
+	else if (getGameType() == GType_SIMON2)
+		vga_period = 45;
+	else
+		vga_period = 50;
+
+	_rnd.getRandomNumber(2);
+
+	do {
+		while (!_inCallBack && cur >= _lastVgaTick + vga_period && !_pause) {
+			_lastVgaTick += vga_period;
+
+			// don't get too many frames behind
+			if (cur >= _lastVgaTick + vga_period * 2)
+				_lastVgaTick = cur;
+
+			_inCallBack = true;
+			timer_callback();
+			_inCallBack = false;
+		}
+
+		while (_system->pollEvent(event)) {
+			switch (event.type) {
+			case OSystem::EVENT_KEYDOWN:
+				if (event.kbd.keycode >= '0' && event.kbd.keycode <='9'
+					&& (event.kbd.flags == OSystem::KBD_ALT ||
+						event.kbd.flags == OSystem::KBD_CTRL)) {
+					_saveLoadSlot = event.kbd.keycode - '0';
+
+					// There is no save slot 0
+					if (_saveLoadSlot == 0)
+						_saveLoadSlot = 10;
+
+					sprintf(_saveLoadName, "Quicksave %d", _saveLoadSlot);
+					_saveLoadType = (event.kbd.flags == OSystem::KBD_ALT) ? 1 : 2;
+
+					// We should only allow a load or save when it was possible in original
+					// This stops load/save during copy protection, conversations and cut scenes
+					if (!_mouseHideCount && !_showPreposition)
+						quickLoadOrSave();
+				} else if (event.kbd.flags == OSystem::KBD_CTRL) {
+					if (event.kbd.keycode == 'a') {
+						GUI::Dialog *_aboutDialog;
+						_aboutDialog = new GUI::AboutDialog();
+						_aboutDialog->runModal();
+					} else if (event.kbd.keycode == 'f')
+						_fastMode ^= 1;
+					else if (event.kbd.keycode == 'd')
+						_debugger->attach();
+				} 
+
+				if (getGameType() == GType_PP) {
+					if (event.kbd.flags == OSystem::KBD_SHIFT)
+						_variableArray[41] = 0;
+					else
+						_variableArray[41] = 1;
+				}
+
+				// Make sure backspace works right (this fixes a small issue on OS X)
+				if (event.kbd.keycode == 8)
+					_keyPressed = 8;
+				else
+					_keyPressed = (byte)event.kbd.ascii;
+				break;
+			case OSystem::EVENT_MOUSEMOVE:
+				_sdlMouseX = event.mouse.x;
+				_sdlMouseY = event.mouse.y;
+				break;
+			case OSystem::EVENT_LBUTTONDOWN:
+				if (getGameType() == GType_FF)
+					setBitFlag(89, true);
+				_leftButtonDown++;
+#if defined (_WIN32_WCE) || defined(PALMOS_MODE)
+				_sdlMouseX = event.mouse.x;
+				_sdlMouseY = event.mouse.y;
+#endif
+				break;
+			case OSystem::EVENT_LBUTTONUP:
+				if (getGameType() == GType_FF)
+					setBitFlag(89, false);
+				break;
+			case OSystem::EVENT_RBUTTONDOWN:
+				if (getGameType() == GType_FF)
+					setBitFlag(92, false);
+				_rightButtonDown++;
+				break;
+			case OSystem::EVENT_QUIT:
+				shutdown();
+				return;
+			default:
+				break;
+			}
+		}
+
+		_system->updateScreen();
+
+		if (amount == 0)
+			break;
+
+		this_delay = _fastMode ? 1 : 20;
+		if (this_delay > amount)
+			this_delay = amount;
+		_system->delayMillis(this_delay);
+
+		cur = _system->getMillis();
+	} while (cur < start + amount);
+}
+
 void AGOSEngine::timer_callback() {
 	if (_timer5 != 0) {
 		_syncFlag2 = true;


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