aboutsummaryrefslogtreecommitdiff
path: root/engines/agi
diff options
context:
space:
mode:
authorFilippos Karapetis2008-04-10 21:58:59 +0000
committerFilippos Karapetis2008-04-10 21:58:59 +0000
commit58b78bae07b208874d62db6d6c35a22ae07aa950 (patch)
tree3f1f60399f27b83fd42663abb7698f250f592c51 /engines/agi
parentbaf3d985132e016f9ad7b0d429c8b1c3ce211dc1 (diff)
downloadscummvm-rg350-58b78bae07b208874d62db6d6c35a22ae07aa950.tar.gz
scummvm-rg350-58b78bae07b208874d62db6d6c35a22ae07aa950.tar.bz2
scummvm-rg350-58b78bae07b208874d62db6d6c35a22ae07aa950.zip
Initial attempt at handling non-default AGI game input prompt
svn-id: r31477
Diffstat (limited to 'engines/agi')
-rw-r--r--engines/agi/keyboard.cpp9
-rw-r--r--engines/agi/op_cmd.cpp2
-rw-r--r--engines/agi/text.cpp9
3 files changed, 12 insertions, 8 deletions
diff --git a/engines/agi/keyboard.cpp b/engines/agi/keyboard.cpp
index aa917b6e90..6df7dd83ba 100644
--- a/engines/agi/keyboard.cpp
+++ b/engines/agi/keyboard.cpp
@@ -277,6 +277,7 @@ void AgiEngine::handleKeys(int key) {
static uint8 formatedEntry[256];
int l = _game.lineUserInput;
int fg = _game.colorFg, bg = _game.colorBg;
+ int promptLength = strlen(agiSprintf(_game.strings[0]));
setvar(vWordNotFound, 0);
@@ -329,10 +330,10 @@ void AgiEngine::handleKeys(int key) {
break;
/* erase cursor */
- _gfx->printCharacter(_game.cursorPos + 1, l, ' ', fg, bg);
+ _gfx->printCharacter(_game.cursorPos + promptLength, l, ' ', fg, bg);
_game.inputBuffer[--_game.cursorPos] = 0;
/* Print cursor */
- _gfx->printCharacter(_game.cursorPos + 1, l, _game.cursorChar, fg, bg);
+ _gfx->printCharacter(_game.cursorPos + promptLength, l, _game.cursorChar, fg, bg);
#ifdef __DS__
DS::findWordCompletions((char *) _game.inputBuffer);
@@ -355,10 +356,10 @@ void AgiEngine::handleKeys(int key) {
#endif
/* echo */
- _gfx->printCharacter(_game.cursorPos, l, _game.inputBuffer[_game.cursorPos - 1], fg, bg);
+ _gfx->printCharacter(_game.cursorPos + promptLength - 1, l, _game.inputBuffer[_game.cursorPos - 1], fg, bg);
/* Print cursor */
- _gfx->printCharacter(_game.cursorPos + 1, l, _game.cursorChar, fg, bg);
+ _gfx->printCharacter(_game.cursorPos + promptLength, l, _game.cursorChar, fg, bg);
break;
}
}
diff --git a/engines/agi/op_cmd.cpp b/engines/agi/op_cmd.cpp
index 01ec081315..c30b5b52f7 100644
--- a/engines/agi/op_cmd.cpp
+++ b/engines/agi/op_cmd.cpp
@@ -1373,6 +1373,8 @@ cmd(set_string) {
if (p0 > MAX_STRINGS)
return;
strcpy(game.strings[p0], curLogic->texts[p1 - 1]);
+ if (p0 == 0 && game.hasPrompt)
+ g_agi->writePrompt();
}
cmd(display) {
diff --git a/engines/agi/text.cpp b/engines/agi/text.cpp
index dca745ffc5..63cea67072 100644
--- a/engines/agi/text.cpp
+++ b/engines/agi/text.cpp
@@ -93,7 +93,7 @@ void AgiEngine::printText2(int l, const char *msg, int foff, int xoff, int yoff,
x1++;
/* DF: changed the len-1 to len... */
- if (x1 == len && m[1] != '\n')
+ if (x1 == len && m[len] != '\n')
y1++, x1 = foff = 0;
} else {
y1++;
@@ -627,6 +627,7 @@ void AgiEngine::writeStatus() {
*/
void AgiEngine::writePrompt() {
int l, fg, bg, pos;
+ int promptLength = strlen(agiSprintf(_game.strings[0]));
if (!_game.inputEnabled || _game.inputMode != INPUT_NORMAL)
return;
@@ -640,9 +641,9 @@ void AgiEngine::writePrompt() {
clearLines(l, l, _game.colorBg);
debugC(4, kDebugLevelText, "prompt = '%s'", agiSprintf(_game.strings[0]));
- printText(_game.strings[0], 0, 0, l, 1, fg, bg);
- printText((char *)_game.inputBuffer, 0, 1, l, pos + 1, fg, bg);
- _gfx->printCharacter(pos + 1, l, _game.cursorChar, fg, bg);
+ printText(_game.strings[0], 0, 0, l, promptLength + 1, fg, bg);
+ printText((char *)_game.inputBuffer, 0, promptLength, l, pos + 1, fg, bg);
+ _gfx->printCharacter(pos + promptLength, l, _game.cursorChar, fg, bg);
flushLines(l, l);
_gfx->doUpdate();