[Scummvm-cvs-logs] CVS: scummvm/sword2 module.mk,1.6,1.7 startup.cpp,1.34,1.35 sword2.h,1.42,1.43 tony_gsdk.cpp,1.18,NONE

Torbj?rn Andersson eriktorbjorn at users.sourceforge.net
Tue Nov 18 00:18:11 CET 2003


Update of /cvsroot/scummvm/scummvm/sword2
In directory sc8-pr-cvs1:/tmp/cvs-serv22537

Modified Files:
	module.mk startup.cpp sword2.h 
Removed Files:
	tony_gsdk.cpp 
Log Message:
The readFile() function was only used once, for creating the debugger start
menu, and wasn't even necessary there so I've removed it. That means the
tony_gsdk.cpp file is no longer necessary. Sorry Tony, but at least you
still have your own debugger command! ;-)


Index: module.mk
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/module.mk,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- module.mk	13 Nov 2003 07:59:52 -0000	1.6
+++ module.mk	18 Nov 2003 08:17:36 -0000	1.7
@@ -26,7 +26,6 @@
 	sword2/startup.o \
 	sword2/sword2.o \
 	sword2/sync.o \
-	sword2/tony_gsdk.o \
 	sword2/walker.o \
 	sword2/driver/d_draw.o \
 	sword2/driver/d_sound.o \

Index: startup.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/startup.cpp,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- startup.cpp	16 Nov 2003 14:18:29 -0000	1.34
+++ startup.cpp	18 Nov 2003 08:17:36 -0000	1.35
@@ -18,6 +18,7 @@
  */
 
 #include "common/stdafx.h"
+#include "common/file.h"
 #include "sword2/sword2.h"
 
 namespace Sword2 {
@@ -30,10 +31,9 @@
 	// We query each in turn and setup an array of start structures.
 	// If the file doesn't exist then we say so and return a 0.
 
-	uint32 end;
-	mem *temp;
+	File fp;
+
 	uint32 pos = 0;
-	uint32 j = 0;
 	char *raw_script;
 	uint32 null_pc;
 
@@ -45,30 +45,45 @@
 
 	debug(5, "initialising start menu");
 
-	if (!(end = _vm->readFile("startup.inf", &temp, UID_temp))) {
-		debug(5, "Init_start_menu cannot open startup.inf");
-		return 0;	// meaning no start menu available
+	if (!fp.open("startup.inf")) {
+		warning("initStartMenu: cannot open startup.inf - the debugger won't have a start menu");
+		return 0;
 	}
 
-	// Ok, we've loaded in the startup.inf file which contains a list of
-	// all the files now extract the filenames
+	// The startup.inf file which contains a list of all the files. Now
+	// extract the filenames
 
-	do {
-		while (temp->ad[j] != 13) {	// item must have an #0d0a
-			ascii_start_ids[_totalScreenManagers][pos] = temp->ad[j];
-			j++;
+	while (1) {
+		bool done = false;
+
+		while (1) {
+			byte b = fp.readByte();
+
+			if (fp.ioFailed()) {
+				done = true;
+				break;
+			}
+
+			// Each item ends with CRLF
+			if (b == 13) {
+				fp.readByte();
+				break;
+			}
+
+			if (pos < 7)
+				ascii_start_ids[_totalScreenManagers][pos] = b;
 			pos++;
 		}
 
+		if (done)
+			break;
+
 		// NULL terminate our extracted string
 		ascii_start_ids[_totalScreenManagers][pos] = 0;
 
 		// reset position in current slot between entries
 		pos = 0;
 
-		// past the 0a
-		j += 2;
-
 		// done another
 		_totalScreenManagers++;
 
@@ -76,7 +91,9 @@
 			debug(5, "WARNING MAX_starts exceeded!");
 			break;
 		}
-	} while (j <end);
+	}
+
+	fp.close();
 
 	// using this method the Gode generated resource.inf must have #0d0a
 	// on the last entry
@@ -88,8 +105,8 @@
 	// instance a startup could be set for later in the game where
 	// specific vars are set
 
-	for (j = 0; j < _totalScreenManagers; j++) {
-		_startRes = atoi(ascii_start_ids[j]);
+	for (uint i = 0; i < _totalScreenManagers; i++) {
+		_startRes = atoi(ascii_start_ids[i]);
 
 		debug(5, "+querying screen manager %d", _startRes);
 
@@ -110,8 +127,6 @@
 		} else
 			debug(5, "- resource %d invalid", _startRes);
 	}
-
-	_vm->_memory->freeMemory(temp);
 
 	return 1;
 }

Index: sword2.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/sword2.h,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- sword2.h	16 Nov 2003 14:18:29 -0000	1.42
+++ sword2.h	18 Nov 2003 08:17:36 -0000	1.43
@@ -361,8 +361,6 @@
 
 	void sleepUntil(uint32 time);
 
-	uint32 readFile(const char *name, mem **membloc, uint32 uid);
-
 	void errorString(const char *buf_input, char *buf_output);
 	void initialiseFontResourceFlags(void);
 	void initialiseFontResourceFlags(uint8 language);

--- tony_gsdk.cpp DELETED ---





More information about the Scummvm-git-logs mailing list