[Scummvm-cvs-logs] SF.net SVN: scummvm:[42662] scummvm/trunk/engines/agi

sev at users.sourceforge.net sev at users.sourceforge.net
Wed Jul 22 17:55:33 CEST 2009


Revision: 42662
          http://scummvm.svn.sourceforge.net/scummvm/?rev=42662&view=rev
Author:   sev
Date:     2009-07-22 15:55:33 +0000 (Wed, 22 Jul 2009)

Log Message:
-----------
Move functions from agi.cpp to more appropriate files.

Modified Paths:
--------------
    scummvm/trunk/engines/agi/agi.cpp
    scummvm/trunk/engines/agi/detection.cpp
    scummvm/trunk/engines/agi/keyboard.cpp
    scummvm/trunk/engines/agi/menu.cpp
    scummvm/trunk/engines/agi/saveload.cpp

Modified: scummvm/trunk/engines/agi/agi.cpp
===================================================================
--- scummvm/trunk/engines/agi/agi.cpp	2009-07-22 12:38:34 UTC (rev 42661)
+++ scummvm/trunk/engines/agi/agi.cpp	2009-07-22 15:55:33 UTC (rev 42662)
@@ -271,19 +271,6 @@
 	}
 }
 
-void AgiEngine::checkQuickLoad() {
-	if (ConfMan.hasKey("save_slot")) {
-		char saveNameBuffer[256];
-
-		snprintf (saveNameBuffer, 256, "%s.%03d", _targetName.c_str(), ConfMan.getInt("save_slot"));
-
-		if (loadGame(saveNameBuffer, false) == errOK) {	 // Do not check game id
-			_game.exitAllLogics = 1;
-			_menu->enableAll();
-		}
-	}
-}
-
 void AgiEngine::pollTimer(void) {
 	static uint32 m = 0;
 	uint32 dm;
@@ -301,40 +288,10 @@
 	m = g_tickTimer;
 }
 
-bool AgiEngine::isKeypress(void) {
-	processEvents();
-	return _keyQueueStart != _keyQueueEnd;
-}
-
-int AgiEngine::getKeypress(void) {
-	int k;
-
-	while (_keyQueueStart == _keyQueueEnd)	// block
-		pollTimer();
-
-	keyDequeue(k);
-
-	return k;
-}
-
-void AgiEngine::clearKeyQueue(void) {
-	while (isKeypress()) {
-		getKeypress();
-	}
-}
-
 void AgiEngine::agiTimerFunctionLow(void *refCon) {
 	g_tickTimer++;
 }
 
-void AgiEngine::clearImageStack(void) {
-	_imageStack.clear();
-}
-
-void AgiEngine::releaseImageStack(void) {
-	_imageStack.clear();
-}
-
 void AgiEngine::pause(uint32 msec) {
 	uint32 endTime = _system->getMillis() + msec;
 
@@ -348,38 +305,6 @@
 	_gfx->setCursor(_renderMode == Common::kRenderAmiga);
 }
 
-void AgiEngine::recordImageStackCall(uint8 type, int16 p1, int16 p2, int16 p3,
-		int16 p4, int16 p5, int16 p6, int16 p7) {
-	ImageStackElement pnew;
-
-	pnew.type = type;
-	pnew.pad = 0;
-	pnew.parm1 = p1;
-	pnew.parm2 = p2;
-	pnew.parm3 = p3;
-	pnew.parm4 = p4;
-	pnew.parm5 = p5;
-	pnew.parm6 = p6;
-	pnew.parm7 = p7;
-
-	_imageStack.push(pnew);
-}
-
-void AgiEngine::replayImageStackCall(uint8 type, int16 p1, int16 p2, int16 p3,
-		int16 p4, int16 p5, int16 p6, int16 p7) {
-	switch (type) {
-	case ADD_PIC:
-		debugC(8, kDebugLevelMain, "--- decoding picture %d ---", p1);
-		agiLoadResource(rPICTURE, p1);
-		_picture->decodePicture(p1, p2, p3 != 0);
-		break;
-	case ADD_VIEW:
-		agiLoadResource(rVIEW, p1);
-		_sprites->addToPic(p1, p2, p3, p4, p5, p6, p7);
-		break;
-	}
-}
-
 void AgiEngine::initPriTable() {
 	int i, p, y = 0;
 
@@ -525,21 +450,6 @@
 	return ec;
 }
 
-int AgiEngine::agiDetectGame() {
-	int ec = errOK;
-
-	assert(_gameDescription != NULL);
-
-	if (getVersion() <= 0x2999) {
-		_loader = new AgiLoader_v2(this);
-	} else {
-		_loader = new AgiLoader_v3(this);
-	}
-	ec = _loader->detectGame();
-
-	return ec;
-}
-
 int AgiEngine::agiLoadResource(int r, int n) {
 	int i;
 
@@ -582,67 +492,6 @@
 	{NULL, NULL, 0, 0, NULL}
 };
 
-AgiTextColor AgiButtonStyle::getColor(bool hasFocus, bool pressed, bool positive) const {
-	if (_amigaStyle) {
-		if (positive) {
-			if (pressed) { // Positive pressed Amiga-style button
-				if (_olderAgi) {
-					return AgiTextColor(amigaBlack, amigaOrange);
-				} else {
-					return AgiTextColor(amigaBlack, amigaPurple);
-				}
-			} else { // Positive unpressed Amiga-style button
-				return AgiTextColor(amigaWhite, amigaGreen);
-			}
-		} else { // _amigaStyle && !positive
-			if (pressed) { // Negative pressed Amiga-style button
-				return AgiTextColor(amigaBlack, amigaCyan);
-			} else { // Negative unpressed Amiga-style button
-				return AgiTextColor(amigaWhite, amigaRed);
-			}
-		}
-	} else { // PC-style button
-		if (hasFocus || pressed) { // A pressed or in focus PC-style button
-			return AgiTextColor(pcWhite, pcBlack);
-		} else { // An unpressed PC-style button without focus
-			return AgiTextColor(pcBlack, pcWhite);
-		}
-	}
-}
-
-AgiTextColor AgiButtonStyle::getColor(bool hasFocus, bool pressed, int baseFgColor, int baseBgColor) const {
-	return getColor(hasFocus, pressed, AgiTextColor(baseFgColor, baseBgColor));
-}
-
-AgiTextColor AgiButtonStyle::getColor(bool hasFocus, bool pressed, const AgiTextColor &baseColor) const {
-	if (hasFocus || pressed)
-		return baseColor.swap();
-	else
-		return baseColor;
-}
-
-int AgiButtonStyle::getTextOffset(bool hasFocus, bool pressed) const {
-	return (pressed && !_amigaStyle) ? 1 : 0;
-}
-
-bool AgiButtonStyle::getBorder(bool hasFocus, bool pressed) const {
-	return _amigaStyle && !_authenticAmiga && (hasFocus || pressed);
-}
-
-void AgiButtonStyle::setAmigaStyle(bool amigaStyle, bool olderAgi, bool authenticAmiga) {
-	_amigaStyle		= amigaStyle;
-	_olderAgi		= olderAgi;
-	_authenticAmiga	= authenticAmiga;
-}
-
-void AgiButtonStyle::setPcStyle(bool pcStyle) {
-	setAmigaStyle(!pcStyle);
-}
-
-AgiButtonStyle::AgiButtonStyle(Common::RenderMode renderMode) {
-	setAmigaStyle(renderMode == Common::kRenderAmiga);
-}
-
 AgiBase::AgiBase(OSystem *syst, const AGIGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) {
 	_noSaveLoadAllowed = false;
 

Modified: scummvm/trunk/engines/agi/detection.cpp
===================================================================
--- scummvm/trunk/engines/agi/detection.cpp	2009-07-22 12:38:34 UTC (rev 42661)
+++ scummvm/trunk/engines/agi/detection.cpp	2009-07-22 15:55:33 UTC (rev 42662)
@@ -1312,4 +1312,19 @@
 	return (!(getGameType() == GType_PreAGI) && getflag(fMenusWork) && !_noSaveLoadAllowed && _game.inputEnabled);
 }
 
+int AgiEngine::agiDetectGame() {
+	int ec = errOK;
+
+	assert(_gameDescription != NULL);
+
+	if (getVersion() <= 0x2999) {
+		_loader = new AgiLoader_v2(this);
+	} else {
+		_loader = new AgiLoader_v3(this);
+	}
+	ec = _loader->detectGame();
+
+	return ec;
+}
+
 } // End of namespace Agi

Modified: scummvm/trunk/engines/agi/keyboard.cpp
===================================================================
--- scummvm/trunk/engines/agi/keyboard.cpp	2009-07-22 12:38:34 UTC (rev 42661)
+++ scummvm/trunk/engines/agi/keyboard.cpp	2009-07-22 15:55:33 UTC (rev 42662)
@@ -421,4 +421,26 @@
 	return key;
 }
 
+bool AgiEngine::isKeypress(void) {
+	processEvents();
+	return _keyQueueStart != _keyQueueEnd;
+}
+
+int AgiEngine::getKeypress(void) {
+	int k;
+
+	while (_keyQueueStart == _keyQueueEnd)	// block
+		pollTimer();
+
+	keyDequeue(k);
+
+	return k;
+}
+
+void AgiEngine::clearKeyQueue(void) {
+	while (isKeypress()) {
+		getKeypress();
+	}
+}
+
 } // End of namespace Agi

Modified: scummvm/trunk/engines/agi/menu.cpp
===================================================================
--- scummvm/trunk/engines/agi/menu.cpp	2009-07-22 12:38:34 UTC (rev 42661)
+++ scummvm/trunk/engines/agi/menu.cpp	2009-07-22 15:55:33 UTC (rev 42662)
@@ -493,4 +493,66 @@
 	}
 }
 
+
+AgiTextColor AgiButtonStyle::getColor(bool hasFocus, bool pressed, bool positive) const {
+	if (_amigaStyle) {
+		if (positive) {
+			if (pressed) { // Positive pressed Amiga-style button
+				if (_olderAgi) {
+					return AgiTextColor(amigaBlack, amigaOrange);
+				} else {
+					return AgiTextColor(amigaBlack, amigaPurple);
+				}
+			} else { // Positive unpressed Amiga-style button
+				return AgiTextColor(amigaWhite, amigaGreen);
+			}
+		} else { // _amigaStyle && !positive
+			if (pressed) { // Negative pressed Amiga-style button
+				return AgiTextColor(amigaBlack, amigaCyan);
+			} else { // Negative unpressed Amiga-style button
+				return AgiTextColor(amigaWhite, amigaRed);
+			}
+		}
+	} else { // PC-style button
+		if (hasFocus || pressed) { // A pressed or in focus PC-style button
+			return AgiTextColor(pcWhite, pcBlack);
+		} else { // An unpressed PC-style button without focus
+			return AgiTextColor(pcBlack, pcWhite);
+		}
+	}
+}
+
+AgiTextColor AgiButtonStyle::getColor(bool hasFocus, bool pressed, int baseFgColor, int baseBgColor) const {
+	return getColor(hasFocus, pressed, AgiTextColor(baseFgColor, baseBgColor));
+}
+
+AgiTextColor AgiButtonStyle::getColor(bool hasFocus, bool pressed, const AgiTextColor &baseColor) const {
+	if (hasFocus || pressed)
+		return baseColor.swap();
+	else
+		return baseColor;
+}
+
+int AgiButtonStyle::getTextOffset(bool hasFocus, bool pressed) const {
+	return (pressed && !_amigaStyle) ? 1 : 0;
+}
+
+bool AgiButtonStyle::getBorder(bool hasFocus, bool pressed) const {
+	return _amigaStyle && !_authenticAmiga && (hasFocus || pressed);
+}
+
+void AgiButtonStyle::setAmigaStyle(bool amigaStyle, bool olderAgi, bool authenticAmiga) {
+	_amigaStyle		= amigaStyle;
+	_olderAgi		= olderAgi;
+	_authenticAmiga	= authenticAmiga;
+}
+
+void AgiButtonStyle::setPcStyle(bool pcStyle) {
+	setAmigaStyle(!pcStyle);
+}
+
+AgiButtonStyle::AgiButtonStyle(Common::RenderMode renderMode) {
+	setAmigaStyle(renderMode == Common::kRenderAmiga);
+}
+
 } // End of namespace Agi

Modified: scummvm/trunk/engines/agi/saveload.cpp
===================================================================
--- scummvm/trunk/engines/agi/saveload.cpp	2009-07-22 12:38:34 UTC (rev 42661)
+++ scummvm/trunk/engines/agi/saveload.cpp	2009-07-22 15:55:33 UTC (rev 42662)
@@ -32,6 +32,7 @@
 
 #include "common/file.h"
 #include "graphics/thumbnail.h"
+#include "common/config-manager.h"
 
 #include "agi/agi.h"
 #include "agi/graphics.h"
@@ -925,4 +926,57 @@
 	return rc;
 }
 
+void AgiEngine::recordImageStackCall(uint8 type, int16 p1, int16 p2, int16 p3,
+		int16 p4, int16 p5, int16 p6, int16 p7) {
+	ImageStackElement pnew;
+
+	pnew.type = type;
+	pnew.pad = 0;
+	pnew.parm1 = p1;
+	pnew.parm2 = p2;
+	pnew.parm3 = p3;
+	pnew.parm4 = p4;
+	pnew.parm5 = p5;
+	pnew.parm6 = p6;
+	pnew.parm7 = p7;
+
+	_imageStack.push(pnew);
+}
+
+void AgiEngine::replayImageStackCall(uint8 type, int16 p1, int16 p2, int16 p3,
+		int16 p4, int16 p5, int16 p6, int16 p7) {
+	switch (type) {
+	case ADD_PIC:
+		debugC(8, kDebugLevelMain, "--- decoding picture %d ---", p1);
+		agiLoadResource(rPICTURE, p1);
+		_picture->decodePicture(p1, p2, p3 != 0);
+		break;
+	case ADD_VIEW:
+		agiLoadResource(rVIEW, p1);
+		_sprites->addToPic(p1, p2, p3, p4, p5, p6, p7);
+		break;
+	}
+}
+
+void AgiEngine::clearImageStack(void) {
+	_imageStack.clear();
+}
+
+void AgiEngine::releaseImageStack(void) {
+	_imageStack.clear();
+}
+
+void AgiEngine::checkQuickLoad() {
+	if (ConfMan.hasKey("save_slot")) {
+		char saveNameBuffer[256];
+
+		snprintf (saveNameBuffer, 256, "%s.%03d", _targetName.c_str(), ConfMan.getInt("save_slot"));
+
+		if (loadGame(saveNameBuffer, false) == errOK) {	 // Do not check game id
+			_game.exitAllLogics = 1;
+			_menu->enableAll();
+		}
+	}
+}
+
 } // End of namespace Agi


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