[Scummvm-cvs-logs] SF.net SVN: scummvm:[52190] scummvm/trunk/engines/hugo

strangerke at users.sourceforge.net strangerke at users.sourceforge.net
Wed Aug 18 18:44:12 CEST 2010


Revision: 52190
          http://scummvm.svn.sourceforge.net/scummvm/?rev=52190&view=rev
Author:   strangerke
Date:     2010-08-18 16:44:12 +0000 (Wed, 18 Aug 2010)

Log Message:
-----------
Hugo - Add F6 Inventory. This is a DOS only feature, but quite convenient as the iconic inventory is not available atm.

Modified Paths:
--------------
    scummvm/trunk/engines/hugo/parser.cpp
    scummvm/trunk/engines/hugo/parser.h

Modified: scummvm/trunk/engines/hugo/parser.cpp
===================================================================
--- scummvm/trunk/engines/hugo/parser.cpp	2010-08-18 16:14:38 UTC (rev 52189)
+++ scummvm/trunk/engines/hugo/parser.cpp	2010-08-18 16:44:12 UTC (rev 52190)
@@ -89,11 +89,13 @@
 			_vm.screen().userHelp();
 			_checkDoubleF1Fl = true;
 		break;
+	case Common::KEYCODE_F6:                        // Inventory
+		showDosInventory();
+		break;
 	case Common::KEYCODE_F2:                        // Toggle sound
 	case Common::KEYCODE_F3:                        // Repeat last line
 	case Common::KEYCODE_F4:                        // Save game
 	case Common::KEYCODE_F5:                        // Restore game
-	case Common::KEYCODE_F6:                        // Inventory
 	case Common::KEYCODE_F8:                        // Turbo mode
 	case Common::KEYCODE_F9:                        // Boss button
 		warning("STUB: KeyHandler() - F2-F9 (DOS)");
@@ -674,4 +676,42 @@
 	return true;
 }
 
+void Parser::showDosInventory() {
+// Show user all objects being carried in a variable width 2 column format
+static char *intro  = "You are carrying:";
+static char *outro  = "\nPress ESCAPE to continue";
+static char *blanks = "                                        ";
+uint16 index, len, len1 = 0, len2 = 0;
+char buffer[XBYTES * NUM_ROWS] = "\0";
+
+	index = 0;
+	for (int i = 0; i < _vm._numObj; i++)     /* Find widths of 2 columns */
+		if (_vm._objects[i].carriedFl) {
+			len = strlen(_vm._arrayNouns[_vm._objects[i].nounIndex][1]);
+			if (index++ & 1)                    /* Right hand column */
+				len2 = len > len2 ? len : len2;
+			else
+				len1 = len > len1 ? len : len1;
+		}
+	len1 += 1;                                  /* For gap between columns */
+
+	if (len1 + len2 < (uint16)strlen(outro))
+		len1 = strlen(outro);
+
+	strncat (buffer, blanks, (len1 + len2 - strlen(intro)) / 2);
+	strcat (strcat (buffer, intro), "\n");
+	index = 0;
+	for (int i = 0; i < _vm._numObj; i++)     /* Assign strings */
+		if (_vm._objects[i].carriedFl)
+			if (index++ & 1)
+				strcat (strcat (buffer, _vm._arrayNouns[_vm._objects[i].nounIndex][1]), "\n");
+			else
+				strncat (strcat (buffer, _vm._arrayNouns[_vm._objects[i].nounIndex][1]), blanks, len1 - strlen(_vm._arrayNouns[_vm._objects[i].nounIndex][1]));
+	if (index & 1) strcat (buffer, "\n");
+	strcat (buffer, outro);
+
+	Utils::Box(BOX_ANY, buffer);
+}
+
+
 } // end of namespace Hugo

Modified: scummvm/trunk/engines/hugo/parser.h
===================================================================
--- scummvm/trunk/engines/hugo/parser.h	2010-08-18 16:14:38 UTC (rev 52189)
+++ scummvm/trunk/engines/hugo/parser.h	2010-08-18 16:44:12 UTC (rev 52190)
@@ -88,6 +88,7 @@
 	char *strlwr(char *buffer);
 
 	void  dropObject(object_t *obj);
+	void  showDosInventory();
 	void  showTakeables();
 	void  takeObject(object_t *obj);
 };


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