aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2009-07-22 15:55:33 +0000
committerEugene Sandulenko2009-07-22 15:55:33 +0000
commit483a4c0eebd0eb65fa64c87b935c53fdfe3693fd (patch)
tree84d6a0c07ab410efcc76e1239dd2f9c75cba61f4
parent9bd355acf81ac30c06418ad6026bf39b73e87722 (diff)
downloadscummvm-rg350-483a4c0eebd0eb65fa64c87b935c53fdfe3693fd.tar.gz
scummvm-rg350-483a4c0eebd0eb65fa64c87b935c53fdfe3693fd.tar.bz2
scummvm-rg350-483a4c0eebd0eb65fa64c87b935c53fdfe3693fd.zip
Move functions from agi.cpp to more appropriate files.
svn-id: r42662
-rw-r--r--engines/agi/agi.cpp151
-rw-r--r--engines/agi/detection.cpp15
-rw-r--r--engines/agi/keyboard.cpp22
-rw-r--r--engines/agi/menu.cpp62
-rw-r--r--engines/agi/saveload.cpp54
5 files changed, 153 insertions, 151 deletions
diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp
index 531b0a4ffd..9b6c293b94 100644
--- a/engines/agi/agi.cpp
+++ b/engines/agi/agi.cpp
@@ -271,19 +271,6 @@ void AgiEngine::processEvents() {
}
}
-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 @@ void AgiEngine::pollTimer(void) {
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 @@ void AgiEngine::pause(uint32 msec) {
_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 @@ int AgiEngine::agiDeinit() {
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 @@ static const GameSettings agiSettings[] = {
{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;
diff --git a/engines/agi/detection.cpp b/engines/agi/detection.cpp
index 910f6e0e55..6bd46ea812 100644
--- a/engines/agi/detection.cpp
+++ b/engines/agi/detection.cpp
@@ -1312,4 +1312,19 @@ bool AgiBase::canSaveGameStateCurrently() {
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
diff --git a/engines/agi/keyboard.cpp b/engines/agi/keyboard.cpp
index 6e85ad369e..b47a39e592 100644
--- a/engines/agi/keyboard.cpp
+++ b/engines/agi/keyboard.cpp
@@ -421,4 +421,26 @@ int AgiEngine::waitAnyKey() {
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
diff --git a/engines/agi/menu.cpp b/engines/agi/menu.cpp
index 27e234ebc9..5d30eda81d 100644
--- a/engines/agi/menu.cpp
+++ b/engines/agi/menu.cpp
@@ -493,4 +493,66 @@ void Menu::enableAll() {
}
}
+
+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
diff --git a/engines/agi/saveload.cpp b/engines/agi/saveload.cpp
index 7c84f1dd72..7220dbd162 100644
--- a/engines/agi/saveload.cpp
+++ b/engines/agi/saveload.cpp
@@ -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 @@ int AgiEngine::loadGameSimple() {
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