[Scummvm-cvs-logs] SF.net SVN: scummvm: [21007] scummvm/trunk/engines/scumm

kirben at users.sourceforge.net kirben at users.sourceforge.net
Thu Mar 2 02:32:06 CET 2006


Revision: 21007
Author:   kirben
Date:     2006-03-02 02:31:11 -0800 (Thu, 02 Mar 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm?rev=21007&view=rev

Log Message:
-----------
Add sentence line to C64 maniac

Modified Paths:
--------------
    scummvm/trunk/engines/scumm/intern.h
    scummvm/trunk/engines/scumm/script_c64.cpp
    scummvm/trunk/engines/scumm/verbs.cpp
Modified: scummvm/trunk/engines/scumm/intern.h
===================================================================
--- scummvm/trunk/engines/scumm/intern.h	2006-03-02 09:34:48 UTC (rev 21006)
+++ scummvm/trunk/engines/scumm/intern.h	2006-03-02 10:31:11 UTC (rev 21007)
@@ -415,8 +415,10 @@
 	virtual void initScummVars();
 	virtual void decodeParseString();
 
+	virtual void checkExecVerbs();
+	virtual void handleMouseOver(bool updateInventory);
 	void initC64Verbs();
-	virtual void checkExecVerbs();
+	void drawSentence();
 
 	virtual int getVarOrDirectWord(byte mask);
 	virtual uint fetchScriptWord();

Modified: scummvm/trunk/engines/scumm/script_c64.cpp
===================================================================
--- scummvm/trunk/engines/scumm/script_c64.cpp	2006-03-02 09:34:48 UTC (rev 21006)
+++ scummvm/trunk/engines/scumm/script_c64.cpp	2006-03-02 10:31:11 UTC (rev 21007)
@@ -459,6 +459,100 @@
 	}
 }
 
+void ScummEngine_c64::drawSentence() {
+	Common::Rect sentenceline;
+	static char sentence[256];
+	const byte *temp;
+	int sentencePrep = 0;
+
+	if (!(_userState & 32))
+		return;
+
+	if (getResourceAddress(rtVerb, _activeVerb)) {
+		strcpy(sentence, (char*)getResourceAddress(rtVerb, _activeVerb));
+	} else {
+		return;
+	}
+
+	if (_activeObject > 0) {
+		temp = getObjOrActorName(_activeObject);
+		if (temp) {
+			strcat(sentence, " ");
+			strcat(sentence, (const char*)temp);
+		}
+
+		if (_verbs[_activeVerb].prep == 0xFF) {
+			byte *ptr = getOBCDFromObject(_activeObject);
+			assert(ptr);
+			sentencePrep = (*(ptr + 11) >> 5);
+		} else {
+			sentencePrep = _verbs[_activeVerb].prep;
+		}
+	}
+
+	if (sentencePrep > 0 && sentencePrep <= 4) {
+		printf("sentencePrep is %d\n", sentencePrep);
+
+		// The prepositions, like the fonts, were hard code in the engine. Thus
+		// we have to do that, too, and provde localized versions for all the
+		// languages MM/Zak are available in.
+		//
+		// The order here matches the one defined in gameDetector.h
+		const char *prepositions[][5] = {
+			{ " ", " in", " with", " on", " to" },	// English
+			{ " ", " mit", " mit", " mit", " zu" },	// German
+			{ " ", " dans", " avec", " sur", " <" },// French
+			{ " ", " in", " con", " su", " a" },	// Italian
+			{ " ", " in", " with", " on", " to" },	// Portugese
+			{ " ", " en", " con", " en", " a" },	// Spanish
+			{ " ", " in", " with", " on", " to" },	// Japanese
+			{ " ", " in", " with", " on", " to" },	// Chinese
+			{ " ", " in", " with", " on", " to" }	// Korean
+			};
+		int lang = (_language <= 8) ? _language : 0;	// Default to english
+		strcat(sentence, prepositions[lang][sentencePrep]);
+	}
+
+	/* if (_activeObject2 > 0) {
+		temp = getObjOrActorName(_activeObject2);
+		if (temp) {
+			strcat(sentence, " ");
+			strcat(sentence, (const char*)temp);
+		}
+	} */
+
+	_string[2].charset = 1;
+	_string[2].ypos = virtscr[kVerbVirtScreen].topline;
+	_string[2].xpos = 0;
+	_string[2].color = 16;
+
+	byte string[80];
+	char *ptr = sentence;
+	int i = 0, len = 0;
+
+	// Maximum length of printable characters
+	int maxChars = 40;
+	while (*ptr) {
+		if (*ptr != '@')
+			len++;
+		if (len > maxChars) {
+			break;
+		}
+
+		string[i++] = *ptr++;
+
+	}
+	string[i] = 0;
+
+	sentenceline.top = virtscr[kVerbVirtScreen].topline;
+	sentenceline.bottom = virtscr[kVerbVirtScreen].topline + 8;
+	sentenceline.left = 0;
+	sentenceline.right = 319;
+	restoreBG(sentenceline);
+
+	drawString(2, (byte*)string);
+}
+
 void ScummEngine_c64::o_setState08() {
 	int obj = getObjectFlag();
 	putState(obj, getState(obj) | 0x08);

Modified: scummvm/trunk/engines/scumm/verbs.cpp
===================================================================
--- scummvm/trunk/engines/scumm/verbs.cpp	2006-03-02 09:34:48 UTC (rev 21006)
+++ scummvm/trunk/engines/scumm/verbs.cpp	2006-03-02 10:31:11 UTC (rev 21007)
@@ -42,26 +42,27 @@
 	int id;
 	int x_pos;
 	int y_pos;
+	int prep;
 	const char *name;
 };
 
 static const VerbSettings C64VerbTable[] =
 {
-	{ 1,  8, 0, "Open"},
-	{ 2,  8, 1, "Close"},
-	{ 3,  0, 2, "Give"},
-	{ 4, 32, 0, "Turn On"},
-	{ 5, 32, 1, "Turn Off"},
-	{ 6, 32, 2, "Fix"},
-	{ 7, 24, 0, "New Kid"},
-	{ 8, 24, 1, "Unlock"},
-	{ 9,  0, 0, "Push"},
-	{10,  0, 1, "Pull"},
-	{11, 24, 2, "Use"},
-	{12,  8, 2, "Read"},
-	{13, 15, 0, "Walk To"},
-	{14, 15, 1, "Pick Up"},
-	{15, 15, 2, "What Is"}
+	{ 1,  8, 0,   0, "Open"},
+	{ 2,  8, 1,   0, "Close"},
+	{ 3,  0, 2,   4, "Give"},
+	{ 4, 32, 0,   0, "Turn On"},
+	{ 5, 32, 1,   0, "Turn Off"},
+	{ 6, 32, 2,   2, "Fix"},
+	{ 7, 24, 0,   0, "New Kid"},
+	{ 8, 24, 1,   2, "Unlock"},
+	{ 9,  0, 0,   0, "Push"},
+	{10,  0, 1,   0, "Pull"},
+	{11, 24, 2, 255, "Use"},
+	{12,  8, 2,   0, "Read"},
+	{13, 15, 0,   0, "Walk To"},
+	{14, 15, 1,   0, "Pick Up"},
+	{15, 15, 2,   0, "What Is"}
 };
 
 void ScummEngine_c64::initC64Verbs() {
@@ -82,6 +83,7 @@
 		vs->key = 0;
 		vs->center = 0;
 		vs->imgindex = 0;
+		vs->prep = C64VerbTable[i - 1].prep;
 
 		vs->curRect.left = C64VerbTable[i - 1].x_pos * 8;
 		vs->curRect.top = C64VerbTable[i - 1].y_pos * 8 + virt->topline + 8;
@@ -431,6 +433,12 @@
 	checkV2MouseOver(_mouse);
 }
 
+void ScummEngine_c64::handleMouseOver(bool updateInventory) {
+	ScummEngine_v2::handleMouseOver(updateInventory);
+
+	drawSentence();
+}
+
 void ScummEngine::checkExecVerbs() {
 	int i, over;
 	VerbSlot *vs;







More information about the Scummvm-git-logs mailing list