[Scummvm-cvs-logs] scummvm master -> fba69d5839c3f9ecf1241d90c833106059f7c876

wjp wjp at usecode.org
Sat Dec 3 15:20:36 CET 2011


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
ebeab9f442 DREAMWEB: Move 'scanForNames' out of dreamgen
fba69d5839 DREAMWEB: Convert 'scanForNames'


Commit: ebeab9f4425448446af771943c94c24a7c6cf42d
    https://github.com/scummvm/scummvm/commit/ebeab9f4425448446af771943c94c24a7c6cf42d
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2011-12-03T06:05:57-08:00

Commit Message:
DREAMWEB: Move 'scanForNames' out of dreamgen

Changed paths:
    devtools/tasmrecover/tasm-recover
    engines/dreamweb/dreamgen.cpp
    engines/dreamweb/dreamgen.h
    engines/dreamweb/saveload.cpp
    engines/dreamweb/stubs.h



diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover
index d3cb582..d399fe4 100755
--- a/devtools/tasmrecover/tasm-recover
+++ b/devtools/tasmrecover/tasm-recover
@@ -364,6 +364,7 @@ generator = cpp(context, "DreamGen", blacklist = [
 	'isitright',
 	'addtopresslist',
 	'entercode',
+	'scanfornames',
 	], skip_output = [
 	# These functions are processed but not output
 	'dreamweb',
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index 8ade751..1c5e98b 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -10217,56 +10217,6 @@ afterprintname:
 		goto shownameloop;
 }
 
-void DreamGenContext::scanForNames() {
-	STACK_CHECK;
-	dx = data;
-	es = dx;
-	di = 8579;
-	dx = data;
-	ds = dx;
-	dx = 8698;
-	cx = 7;
-scanloop:
-	push(es);
-	push(ds);
-	push(di);
-	push(dx);
-	push(cx);
-	openFileFromC();
-	if (flags.c())
-		goto notexist;
-	cx = pop();
-	_inc(ch);
-	push(cx);
-	push(di);
-	push(es);
-	dx = data;
-	ds = dx;
-	dx = 6091;
-	cx = (6187-6091);
-	saveFileRead();
-	dx = data;
-	es = dx;
-	di = 6141;
-	ds = pop();
-	dx = pop();
-	loadSeg();
-	bx = data.word(kHandle);
-	closeFile();
-notexist:
-	cx = pop();
-	dx = pop();
-	di = pop();
-	ds = pop();
-	es = pop();
-	_add(dx, 13);
-	_add(di, 17);
-	_dec(cl);
-	if (!flags.z())
-		goto scanloop;
-	al = ch;
-}
-
 void DreamGenContext::decide() {
 	STACK_CHECK;
 	setMode();
diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h
index aaff3fe..06835c4 100644
--- a/engines/dreamweb/dreamgen.h
+++ b/engines/dreamweb/dreamgen.h
@@ -881,7 +881,7 @@ public:
 	void useWindow();
 	void wearShades();
 	void delEverything();
-	void fadeScreenDown();
+	void clearReels();
 	void poolGuard();
 	void openInv();
 	void lookAtPlace();
@@ -1032,7 +1032,7 @@ public:
 	void updateSymbolTop();
 	void allPointer();
 	void checkSoundInt();
-	void clearReels();
+	void fadeScreenDown();
 	void maleFan();
 	void doSaveLoad();
 	void createName();
@@ -1045,7 +1045,6 @@ public:
 	void fadeScreenDowns();
 	void openHotelDoor2();
 	void getRidOfTempsP();
-	void scanForNames();
 	void selectLocation();
 	void underTextLine();
 	void sitDownInBar();
diff --git a/engines/dreamweb/saveload.cpp b/engines/dreamweb/saveload.cpp
index 5cff453..b74fd68 100644
--- a/engines/dreamweb/saveload.cpp
+++ b/engines/dreamweb/saveload.cpp
@@ -368,5 +368,55 @@ void DreamGenContext::loadPosition(unsigned int slot) {
 	closeFile();
 }
 
+void DreamGenContext::scanForNames() {
+	STACK_CHECK;
+	dx = data;
+	es = dx;
+	di = 8579;
+	dx = data;
+	ds = dx;
+	dx = 8698;
+	cx = 7;
+scanloop:
+	push(es);
+	push(ds);
+	push(di);
+	push(dx);
+	push(cx);
+	openFileFromC();
+	if (flags.c())
+		goto notexist;
+	cx = pop();
+	_inc(ch);
+	push(cx);
+	push(di);
+	push(es);
+	dx = data;
+	ds = dx;
+	dx = 6091;
+	cx = (6187-6091);
+	saveFileRead();
+	dx = data;
+	es = dx;
+	di = 6141;
+	ds = pop();
+	dx = pop();
+	loadSeg();
+	bx = data.word(kHandle);
+	closeFile();
+notexist:
+	cx = pop();
+	dx = pop();
+	di = pop();
+	ds = pop();
+	es = pop();
+	_add(dx, 13);
+	_add(di, 17);
+	_dec(cl);
+	if (!flags.z())
+		goto scanloop;
+	al = ch;
+}
+
 } /*namespace dreamgen */
 
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index 3059bc8..ea990d6 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -403,4 +403,5 @@
 	bool isItRight(uint8 digit0, uint8 digit1, uint8 digit2, uint8 digit3);
 	void enterCode(uint8 digit0, uint8 digit1, uint8 digit2, uint8 digit3);
 	void enterCode();
+	void scanForNames();
 


Commit: fba69d5839c3f9ecf1241d90c833106059f7c876
    https://github.com/scummvm/scummvm/commit/fba69d5839c3f9ecf1241d90c833106059f7c876
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2011-12-03T06:19:51-08:00

Commit Message:
DREAMWEB: Convert 'scanForNames'

Changed paths:
    engines/dreamweb/saveload.cpp
    engines/dreamweb/stubs.cpp
    engines/dreamweb/stubs.h



diff --git a/engines/dreamweb/saveload.cpp b/engines/dreamweb/saveload.cpp
index b74fd68..2e79d1d 100644
--- a/engines/dreamweb/saveload.cpp
+++ b/engines/dreamweb/saveload.cpp
@@ -368,54 +368,33 @@ void DreamGenContext::loadPosition(unsigned int slot) {
 	closeFile();
 }
 
-void DreamGenContext::scanForNames() {
-	STACK_CHECK;
-	dx = data;
-	es = dx;
-	di = 8579;
-	dx = data;
-	ds = dx;
-	dx = 8698;
-	cx = 7;
-scanloop:
-	push(es);
-	push(ds);
-	push(di);
-	push(dx);
-	push(cx);
-	openFileFromC();
-	if (flags.c())
-		goto notexist;
-	cx = pop();
-	_inc(ch);
-	push(cx);
-	push(di);
-	push(es);
-	dx = data;
-	ds = dx;
-	dx = 6091;
-	cx = (6187-6091);
-	saveFileRead();
-	dx = data;
-	es = dx;
-	di = 6141;
-	ds = pop();
-	dx = pop();
-	loadSeg();
-	bx = data.word(kHandle);
-	closeFile();
-notexist:
-	cx = pop();
-	dx = pop();
-	di = pop();
-	ds = pop();
-	es = pop();
-	_add(dx, 13);
-	_add(di, 17);
-	_dec(cl);
-	if (!flags.z())
-		goto scanloop;
-	al = ch;
+// Count number of save files, and load their descriptions into kSavenames
+unsigned int DreamGenContext::scanForNames() {
+	unsigned int count = 0;
+
+	for (unsigned int slot = 0; slot < 7; ++slot) {
+
+		if (!openForLoad(slot)) continue;
+
+		++count;
+
+		engine->readFromSaveFile(cs.ptr(kFileheader, kHeaderlen), kHeaderlen);
+
+		if (cs.word(kFiledata) != 17) {
+			::warning("Error loading save: description buffer isn't 17 bytes");
+			closeFile();
+			continue;
+		}
+
+		// NB: Only possible if slot < 7
+		engine->readFromSaveFile(data.ptr(kSavenames + 17*slot, 17), 17);
+
+		closeFile();
+	}
+
+	al = (uint8)count;
+
+	return count;
 }
 
 } /*namespace dreamgen */
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index 6dec0c1..4c36e5e 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -335,7 +335,7 @@ void DreamGenContext::dreamweb() {
 
 	while (true) {
 
-		scanForNames();
+		unsigned int count = scanForNames();
 
 		bool startNewGame = true;
 
@@ -354,7 +354,7 @@ void DreamGenContext::dreamweb() {
 			fadeScreenUp();
 			startNewGame = false;
 
-		} else if (al == 0 && firstLoop) {
+		} else if (count == 0 && firstLoop) {
 
 			// no savegames found, and we're not restarting.
 
@@ -687,11 +687,11 @@ void DreamGenContext::openForSave(unsigned int slot) {
 	engine->openSaveFileForWriting(filename);
 }
 
-void DreamGenContext::openForLoad(unsigned int slot) {
+bool DreamGenContext::openForLoad(unsigned int slot) {
 	//Common::String filename = ConfMan.getActiveDomainName() + Common::String::format(".d%02d", savegameId);
 	Common::String filename = Common::String::format("DREAMWEB.D%02d", slot);
 	debug(1, "openForLoad(%s)", filename.c_str());
-	engine->openSaveFileForReading(filename);
+	return engine->openSaveFileForReading(filename);
 }
 
 void DreamGenContext::openFileNoCheck() {
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index ea990d6..c8532f8 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -350,7 +350,7 @@
 	void loadPosition(unsigned int slot);
 	void savePosition(unsigned int slot, const uint8 *descbuf);
 	void openForSave(unsigned int slot);
-	void openForLoad(unsigned int slot);
+	bool openForLoad(unsigned int slot);
 	uint16 allocateAndLoad(unsigned int size);
 	void clearAndLoad(uint16 seg, uint8 c, unsigned int size, unsigned int maxSize);
 	void loadRoomData(const Room &room, bool skipDat);
@@ -403,5 +403,5 @@
 	bool isItRight(uint8 digit0, uint8 digit1, uint8 digit2, uint8 digit3);
 	void enterCode(uint8 digit0, uint8 digit1, uint8 digit2, uint8 digit3);
 	void enterCode();
-	void scanForNames();
+	unsigned int scanForNames();
 






More information about the Scummvm-git-logs mailing list