aboutsummaryrefslogtreecommitdiff
path: root/engines/agi/preagi_common.cpp
diff options
context:
space:
mode:
authorEugene Sandulenko2007-09-18 16:20:44 +0000
committerEugene Sandulenko2007-09-18 16:20:44 +0000
commit13a73a70b6309323e5d5efc8f417c679e630ba9a (patch)
tree07bdb67e096b91629ae0c0f84ee24c26569e32d3 /engines/agi/preagi_common.cpp
parent9b528826f89beb69caf7484719c64000d824c7ed (diff)
downloadscummvm-rg350-13a73a70b6309323e5d5efc8f417c679e630ba9a.tar.gz
scummvm-rg350-13a73a70b6309323e5d5efc8f417c679e630ba9a.tar.bz2
scummvm-rg350-13a73a70b6309323e5d5efc8f417c679e630ba9a.zip
WIP for Troll's Tale
svn-id: r28939
Diffstat (limited to 'engines/agi/preagi_common.cpp')
-rw-r--r--engines/agi/preagi_common.cpp41
1 files changed, 25 insertions, 16 deletions
diff --git a/engines/agi/preagi_common.cpp b/engines/agi/preagi_common.cpp
index 8f1285e68b..164cc775f2 100644
--- a/engines/agi/preagi_common.cpp
+++ b/engines/agi/preagi_common.cpp
@@ -26,32 +26,34 @@
#include "common/stdafx.h"
#include "common/events.h"
-#include "agi/agi.h"
+#include "agi/preagi.h"
#include "agi/font.h"
#include "agi/graphics.h"
#include "agi/keyboard.h"
-// preagi engines
-#include "agi/preagi_mickey.h"
-
-// default attributes
-#define IDA_DEFAULT 0x0F
-#define IDA_DEFAULT_REV 0xF0
-
-#define IDI_MAX_ROW_PIC 20
+#include "agi/preagi_common.h"
namespace Agi {
// Screen functions
-void PreAgiEngine::clearScreen(int attr) {
+void PreAgiEngine::clearScreen(int attr) {
+ _defaultColor = attr;
+
_gfx->clearScreen((attr & 0xF0) / 0x10);
}
+void PreAgiEngine::clearGfxScreen(int attr) {
+ _gfx->drawRectangle(0, 0, GFX_WIDTH - 1, IDI_MAX_ROW_PIC * 8 -1, (attr & 0xF0) / 0x10);
+}
+
// String functions
void PreAgiEngine::drawStr(int row, int col, int attr, const char *buffer) {
int code;
+ if (attr == kColorDefault)
+ attr = _defaultColor;
+
for (int iChar = 0; iChar < (int)strlen(buffer); iChar++) {
code = buffer[iChar];
@@ -112,7 +114,7 @@ void PreAgiEngine::printStrXOR(char *szMsg) {
// Input functions
-int PreAgiEngine::getSelection(int type) {
+int PreAgiEngine::getSelection(SelectionTypes type) {
Common::Event event;
// Selection types:
@@ -131,13 +133,13 @@ int PreAgiEngine::getSelection(int type) {
case Common::EVENT_KEYDOWN:
switch (event.kbd.keycode) {
case Common::KEYCODE_y:
- if (type == 0)
+ if (type == kSelYesNo)
return 1;
case Common::KEYCODE_n:
- if (type == 0)
+ if (type == kSelYesNo)
return 0;
case Common::KEYCODE_ESCAPE:
- if (type == 1)
+ if (type == kSelNumber)
return 0;
case Common::KEYCODE_1:
case Common::KEYCODE_2:
@@ -148,10 +150,13 @@ int PreAgiEngine::getSelection(int type) {
case Common::KEYCODE_7:
case Common::KEYCODE_8:
case Common::KEYCODE_9:
- if (type == 1)
+ if (type == kSelNumber)
return event.kbd.keycode - Common::KEYCODE_1 + 1;
+ case Common::KEYCODE_SPACE:
+ if (type == kSelSpace)
+ return 1;
default:
- if (type == 0) {
+ if (type == kSelYesNo) {
return 2;
} else {
return 10;
@@ -162,6 +167,8 @@ int PreAgiEngine::getSelection(int type) {
break;
}
}
+ _system->updateScreen();
+ _system->delayMillis(10);
}
return 0;
}
@@ -190,6 +197,8 @@ bool PreAgiEngine::waitAnyKeyChoice() {
break;
}
}
+ _system->updateScreen();
+ _system->delayMillis(10);
}
}