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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Thu Apr 10 23:58:59 CEST 2008


Revision: 31477
          http://scummvm.svn.sourceforge.net/scummvm/?rev=31477&view=rev
Author:   thebluegr
Date:     2008-04-10 14:58:59 -0700 (Thu, 10 Apr 2008)

Log Message:
-----------
Initial attempt at handling non-default AGI game input prompt

Modified Paths:
--------------
    scummvm/trunk/engines/agi/keyboard.cpp
    scummvm/trunk/engines/agi/op_cmd.cpp
    scummvm/trunk/engines/agi/text.cpp

Modified: scummvm/trunk/engines/agi/keyboard.cpp
===================================================================
--- scummvm/trunk/engines/agi/keyboard.cpp	2008-04-10 21:50:41 UTC (rev 31476)
+++ scummvm/trunk/engines/agi/keyboard.cpp	2008-04-10 21:58:59 UTC (rev 31477)
@@ -277,6 +277,7 @@
 	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 @@
 			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 @@
 #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;
 	}
 }

Modified: scummvm/trunk/engines/agi/op_cmd.cpp
===================================================================
--- scummvm/trunk/engines/agi/op_cmd.cpp	2008-04-10 21:50:41 UTC (rev 31476)
+++ scummvm/trunk/engines/agi/op_cmd.cpp	2008-04-10 21:58:59 UTC (rev 31477)
@@ -1373,6 +1373,8 @@
 	if (p0 > MAX_STRINGS)
 		return;
 	strcpy(game.strings[p0], curLogic->texts[p1 - 1]);
+	if (p0 == 0 && game.hasPrompt)
+		g_agi->writePrompt();
 }
 
 cmd(display) {

Modified: scummvm/trunk/engines/agi/text.cpp
===================================================================
--- scummvm/trunk/engines/agi/text.cpp	2008-04-10 21:50:41 UTC (rev 31476)
+++ scummvm/trunk/engines/agi/text.cpp	2008-04-10 21:58:59 UTC (rev 31477)
@@ -93,7 +93,7 @@
 				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::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 @@
 	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();


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