[Scummvm-cvs-logs] scummvm master -> 1c860bc4ce508506045e8f37fa4a6cf036577464

wjp wjp at usecode.org
Sat Nov 26 20:49:25 CET 2011


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

Summary:
139a868d37 DREAMWEB: Fix Room struct
c1659e2aad DREAMWEB: Move 'restoreall' from dreamgen
122986f6ee DREAMWEB: Convert 'restoreall' and simplify 'startloading'
900fc7d50e DREAMWEB: Move 'restorereels' from dreamgen
1c860bc4ce DREAMWEB: Convert 'restorereels'


Commit: 139a868d375abbb93c71a557a2b943f4d4d0c82c
    https://github.com/scummvm/scummvm/commit/139a868d375abbb93c71a557a2b943f4d4d0c82c
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2011-11-26T11:18:56-08:00

Commit Message:
DREAMWEB: Fix Room struct

Room::name is a zero terminated 8.3 filename, so 13 bytes long.

Changed paths:
    engines/dreamweb/structs.h



diff --git a/engines/dreamweb/structs.h b/engines/dreamweb/structs.h
index 8b00301..5073612 100644
--- a/engines/dreamweb/structs.h
+++ b/engines/dreamweb/structs.h
@@ -183,10 +183,7 @@ struct People {
 };
 
 struct Room {
-	char  name[10];
-	uint8 b10;
-	uint8 b11;
-	uint8 b12;
+	char  name[13];
 	uint8 roomsSample;
 	uint8 b14;
 	uint8 mapX;


Commit: c1659e2aadeaf6af6a036b940433bd08df535653
    https://github.com/scummvm/scummvm/commit/c1659e2aadeaf6af6a036b940433bd08df535653
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2011-11-26T11:24:23-08:00

Commit Message:
DREAMWEB: Move 'restoreall' from dreamgen

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



diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover
index 0f098c5..7bf66cb 100755
--- a/devtools/tasmrecover/tasm-recover
+++ b/devtools/tasmrecover/tasm-recover
@@ -298,6 +298,7 @@ generator = cpp(context, "DreamGen", blacklist = [
 	'makeheader',
 	'savefilewrite',
 	'storeit',
+	'restoreall',
 	], skip_output = [
 	# These functions are processed but not output
 	'dreamweb',
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index 1cf5429..5160117 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -12747,86 +12747,6 @@ void DreamGenContext::restorereels() {
 	closefile();
 }
 
-void DreamGenContext::restoreall() {
-	STACK_CHECK;
-	al = data.byte(kLocation);
-	getroomdata();
-	dx = bx;
-	openfile();
-	readheader();
-	allocateload();
-	ds = ax;
-	data.word(kBackdrop) = ax;
-	dx = (0);
-	loadseg();
-	ds = data.word(kWorkspace);
-	dx = (0);
-	cx = 132*66;
-	al = 0;
-	fillspace();
-	loadseg();
-	sortoutmap();
-	allocateload();
-	data.word(kSetframes) = ax;
-	ds = ax;
-	dx = (0);
-	loadseg();
-	dontloadseg();
-	allocateload();
-	data.word(kReel1) = ax;
-	ds = ax;
-	dx = 0;
-	loadseg();
-	allocateload();
-	data.word(kReel2) = ax;
-	ds = ax;
-	dx = 0;
-	loadseg();
-	allocateload();
-	data.word(kReel3) = ax;
-	ds = ax;
-	dx = 0;
-	loadseg();
-	allocateload();
-	data.word(kReels) = ax;
-	ds = ax;
-	dx = 0;
-	loadseg();
-	allocateload();
-	data.word(kPeople) = ax;
-	ds = ax;
-	dx = 0;
-	loadseg();
-	allocateload();
-	data.word(kSetdesc) = ax;
-	ds = ax;
-	dx = 0;
-	loadseg();
-	allocateload();
-	data.word(kBlockdesc) = ax;
-	ds = ax;
-	dx = 0;
-	loadseg();
-	allocateload();
-	data.word(kRoomdesc) = ax;
-	ds = ax;
-	dx = 0;
-	loadseg();
-	allocateload();
-	data.word(kFreeframes) = ax;
-	ds = ax;
-	dx = 0;
-	loadseg();
-	dontloadseg();
-	allocateload();
-	data.word(kFreedesc) = ax;
-	ds = ax;
-	dx = (0);
-	loadseg();
-	closefile();
-	setallchanges();
-}
-
 void DreamGenContext::allocateload() {
 	STACK_CHECK;
 	push(es);
diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h
index 886b8d5..5c9d860 100644
--- a/engines/dreamweb/dreamgen.h
+++ b/engines/dreamweb/dreamgen.h
@@ -55,7 +55,6 @@ public:
 	static const uint16 addr_getridoftemp = 0xcb70;
 	static const uint16 addr_allocateload = 0xcb68;
 	static const uint16 addr_dontloadseg = 0xcb64;
-	static const uint16 addr_restoreall = 0xcb44;
 	static const uint16 addr_restorereels = 0xcb40;
 	static const uint16 addr_getridofall = 0xcb3c;
 	static const uint16 addr_getridofreels = 0xcb38;
@@ -1399,7 +1398,7 @@ public:
 	void wearwatch();
 	void runintroseq();
 	//void doblocks();
-	void restoreall();
+	void nextcolon();
 	//void delpointer();
 	void attendant();
 	void nextsymbol();
@@ -1417,7 +1416,6 @@ public:
 	//void frameoutfx();
 	void blank();
 	void drinker();
-	void nextcolon();
 	void placefreeobject();
 	void allpalette();
 	//void loopchannel0();
@@ -1836,6 +1834,7 @@ public:
 	//void placesetobject();
 	//void drawflags();
 	void zoomonoff();
+	//void restoreall();
 	void updatesymboltop();
 	//void showryanpage();
 	//void printlogo();
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index 01a7657..275b402 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -2334,5 +2334,85 @@ void DreamGenContext::usetempcharset() {
 	data.word(kCurrentset) = data.word(kTempcharset);
 }
 
+void DreamGenContext::restoreall() {
+	STACK_CHECK;
+	al = data.byte(kLocation);
+	getroomdata();
+	dx = bx;
+	openfile();
+	readheader();
+	allocateload();
+	ds = ax;
+	data.word(kBackdrop) = ax;
+	dx = (0);
+	loadseg();
+	ds = data.word(kWorkspace);
+	dx = (0);
+	cx = 132*66;
+	al = 0;
+	fillspace();
+	loadseg();
+	sortoutmap();
+	allocateload();
+	data.word(kSetframes) = ax;
+	ds = ax;
+	dx = (0);
+	loadseg();
+	dontloadseg();
+	allocateload();
+	data.word(kReel1) = ax;
+	ds = ax;
+	dx = 0;
+	loadseg();
+	allocateload();
+	data.word(kReel2) = ax;
+	ds = ax;
+	dx = 0;
+	loadseg();
+	allocateload();
+	data.word(kReel3) = ax;
+	ds = ax;
+	dx = 0;
+	loadseg();
+	allocateload();
+	data.word(kReels) = ax;
+	ds = ax;
+	dx = 0;
+	loadseg();
+	allocateload();
+	data.word(kPeople) = ax;
+	ds = ax;
+	dx = 0;
+	loadseg();
+	allocateload();
+	data.word(kSetdesc) = ax;
+	ds = ax;
+	dx = 0;
+	loadseg();
+	allocateload();
+	data.word(kBlockdesc) = ax;
+	ds = ax;
+	dx = 0;
+	loadseg();
+	allocateload();
+	data.word(kRoomdesc) = ax;
+	ds = ax;
+	dx = 0;
+	loadseg();
+	allocateload();
+	data.word(kFreeframes) = ax;
+	ds = ax;
+	dx = 0;
+	loadseg();
+	dontloadseg();
+	allocateload();
+	data.word(kFreedesc) = ax;
+	ds = ax;
+	dx = (0);
+	loadseg();
+	closefile();
+	setallchanges();
+}
+
 } /*namespace dreamgen */
 
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index c4f126a..5eca504 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -349,4 +349,5 @@
 	void saveposition(unsigned int slot, const uint8 *descbuf);
 	void openforsave(unsigned int slot);
 	void openforload(unsigned int slot);
+	void restoreall();
 


Commit: 122986f6ee2a72f25c3819b23172e6839f50d414
    https://github.com/scummvm/scummvm/commit/122986f6ee2a72f25c3819b23172e6839f50d414
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2011-11-26T11:36:56-08:00

Commit Message:
DREAMWEB: Convert 'restoreall' and simplify 'startloading'

They shared a large amount of loading code that is now in loadRoomData.

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



diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index 275b402..f80fad4 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -881,6 +881,21 @@ void DreamGenContext::readheader() {
 	di = kFiledata;
 }
 
+uint16 DreamGenContext::allocateAndLoad(unsigned int size) {
+	// allocatemem adds 32 bytes, so it doesn't matter that size/16 rounds down
+	uint16 result = allocatemem(size / 16);
+	engine->readFromFile(segRef(result).ptr(0, size), size);
+	return result;
+}
+
+void DreamGenContext::clearAndLoad(uint16 seg, uint8 c,
+                                   unsigned int size, unsigned int maxSize) {
+	assert(size <= maxSize);
+	uint8 *buf = segRef(seg).ptr(0, maxSize);
+	memset(buf, c, maxSize);
+	engine->readFromFile(buf, size);
+}
+
 void DreamGenContext::startloading(const Room *room) {
 	data.byte(kCombatcount) = 0;
 	data.byte(kRoomssample) = room->roomsSample;
@@ -898,91 +913,9 @@ void DreamGenContext::startloading(const Room *room) {
 	data.byte(kLastweapon) = (uint8)-1;
 	ah = data.byte(kReallocation);
 	data.byte(kReallocation) = room->realLocation;
-	Common::String name = room->name;
-	engine->openFile(name);
-	cs.word(kHandle) = 1; //only one handle
-	flags._c = false;
-	readheader();
-	allocateload();
-	ds = ax;
-	data.word(kBackdrop) = ax;
-	dx = kFlags;
-	loadseg();
-	ds = data.word(kWorkspace);
-	dx = kMap;
-	cx = 132*66;
-	al = 0;
-	fillspace();
-	loadseg();
-	sortoutmap();
-	allocateload();
-	data.word(kSetframes) = ax;
-	ds = ax;
-	dx = kFramedata;
-	loadseg();
-	ds = data.word(kSetdat);
-	dx = 0;
-	cx = kSetdatlen;
-	al = 255;
-	fillspace();
-	loadseg();
-	allocateload();
-	data.word(kReel1) = ax;
-	ds = ax;
-	dx = 0;
-	loadseg();
-	allocateload();
-	data.word(kReel2) = ax;
-	ds = ax;
-	dx = 0;
-	loadseg();
-	allocateload();
-	data.word(kReel3) = ax;
-	ds = ax;
-	dx = 0;
-	loadseg();
-	allocateload();
-	data.word(kReels) = ax;
-	ds = ax;
-	dx = 0;
-	loadseg();
-	allocateload();
-	data.word(kPeople) = ax;
-	ds = ax;
-	dx = 0;
-	loadseg();
-	allocateload();
-	data.word(kSetdesc) = ax;
-	ds = ax;
-	dx = 0;
-	loadseg();
-	allocateload();
-	data.word(kBlockdesc) = ax;
-	ds = ax;
-	dx = 0;
-	loadseg();
-	allocateload();
-	data.word(kRoomdesc) = ax;
-	ds = ax;
-	dx = 0;
-	loadseg();
-	allocateload();
-	data.word(kFreeframes) = ax;
-	ds = ax;
-	dx = 0;
-	loadseg();
-	ds = data.word(kFreedat);
-	dx = 0;
-	cx = kFreedatlen;
-	al = 255;
-	fillspace();
-	loadseg();
-	allocateload();
-	data.word(kFreedesc) = ax;
-	ds = ax;
-	dx = kFreetextdat;
-	loadseg();
-	closefile();
+
+	loadRoomData(room, false);
+
 	findroominloc();
 	deletetaken();
 	setallchanges();
@@ -2334,83 +2267,50 @@ void DreamGenContext::usetempcharset() {
 	data.word(kCurrentset) = data.word(kTempcharset);
 }
 
-void DreamGenContext::restoreall() {
-	STACK_CHECK;
-	al = data.byte(kLocation);
-	getroomdata();
-	dx = bx;
-	openfile();
+// if skipDat, skip clearing and loading Setdat and Freedat
+void DreamGenContext::loadRoomData(const Room* room, bool skipDat) {
+	engine->openFile(room->name);
+	cs.word(kHandle) = 1; //only one handle
+	flags._c = false;
 	readheader();
-	allocateload();
-	ds = ax;
-	data.word(kBackdrop) = ax;
-	dx = (0);
-	loadseg();
-	ds = data.word(kWorkspace);
-	dx = (0);
-	cx = 132*66;
-	al = 0;
-	fillspace();
-	loadseg();
+
+	// read segment lengths from room file header
+	int len[15];
+	for (int i = 0; i < 15; ++i)
+		len[i] = cs.word(kFiledata + 2*i);
+
+	data.word(kBackdrop) = allocateAndLoad(len[0]);
+	clearAndLoad(data.word(kWorkspace), 0, len[1], 132*66); // 132*66 = maplen
 	sortoutmap();
-	allocateload();
-	data.word(kSetframes) = ax;
-	ds = ax;
-	dx = (0);
-	loadseg();
-	dontloadseg();
-	allocateload();
-	data.word(kReel1) = ax;
-	ds = ax;
-	dx = 0;
-	loadseg();
-	allocateload();
-	data.word(kReel2) = ax;
-	ds = ax;
-	dx = 0;
-	loadseg();
-	allocateload();
-	data.word(kReel3) = ax;
-	ds = ax;
-	dx = 0;
-	loadseg();
-	allocateload();
-	data.word(kReels) = ax;
-	ds = ax;
-	dx = 0;
-	loadseg();
-	allocateload();
-	data.word(kPeople) = ax;
-	ds = ax;
-	dx = 0;
-	loadseg();
-	allocateload();
-	data.word(kSetdesc) = ax;
-	ds = ax;
-	dx = 0;
-	loadseg();
-	allocateload();
-	data.word(kBlockdesc) = ax;
-	ds = ax;
-	dx = 0;
-	loadseg();
-	allocateload();
-	data.word(kRoomdesc) = ax;
-	ds = ax;
-	dx = 0;
-	loadseg();
-	allocateload();
-	data.word(kFreeframes) = ax;
-	ds = ax;
-	dx = 0;
-	loadseg();
-	dontloadseg();
-	allocateload();
-	data.word(kFreedesc) = ax;
-	ds = ax;
-	dx = (0);
-	loadseg();
+	data.word(kSetframes) = allocateAndLoad(len[2]);
+	if (!skipDat)
+		clearAndLoad(data.word(kSetdat), 255, len[3], kSetdatlen);
+	else
+		engine->skipBytes(len[3]);
+	// NB: The skipDat version of this function as called by restoreall
+	// had a 'call bloc' instead of 'call loadseg' for reel1,
+	// but 'bloc' was not defined.
+	data.word(kReel1) = allocateAndLoad(len[4]);
+	data.word(kReel2) = allocateAndLoad(len[5]);
+	data.word(kReel3) = allocateAndLoad(len[6]);
+	data.word(kReels) = allocateAndLoad(len[7]);
+	data.word(kPeople) = allocateAndLoad(len[8]);
+	data.word(kSetdesc) = allocateAndLoad(len[9]);
+	data.word(kBlockdesc) = allocateAndLoad(len[10]);
+	data.word(kRoomdesc) = allocateAndLoad(len[11]);
+	data.word(kFreeframes) = allocateAndLoad(len[12]);
+	if (!skipDat)
+		clearAndLoad(data.word(kFreedat), 255, len[13], kFreedatlen);
+	else
+		engine->skipBytes(len[13]);
+	data.word(kFreedesc) = allocateAndLoad(len[14]);
+
 	closefile();
+}
+
+void DreamGenContext::restoreall() {
+	const Room *room = getroomdata(data.byte(kLocation));
+	loadRoomData(room, true);
 	setallchanges();
 }
 
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index 5eca504..ddf89da 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -349,5 +349,8 @@
 	void saveposition(unsigned int slot, const uint8 *descbuf);
 	void openforsave(unsigned int slot);
 	void 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);
 	void restoreall();
 


Commit: 900fc7d50e2688a83029578eb284483299465b2f
    https://github.com/scummvm/scummvm/commit/900fc7d50e2688a83029578eb284483299465b2f
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2011-11-26T11:45:23-08:00

Commit Message:
DREAMWEB: Move 'restorereels' from dreamgen

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



diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover
index 7bf66cb..3c3267b 100755
--- a/devtools/tasmrecover/tasm-recover
+++ b/devtools/tasmrecover/tasm-recover
@@ -299,6 +299,7 @@ generator = cpp(context, "DreamGen", blacklist = [
 	'savefilewrite',
 	'storeit',
 	'restoreall',
+	'restorereels',
 	], skip_output = [
 	# These functions are processed but not output
 	'dreamweb',
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index 5160117..61d9e6f 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -12715,38 +12715,6 @@ void DreamGenContext::getridofall() {
 	deallocatemem();
 }
 
-void DreamGenContext::restorereels() {
-	STACK_CHECK;
-	_cmp(data.byte(kRoomloaded), 0);
-	if (flags.z())
-		return /* (dontrestore) */;
-	al = data.byte(kReallocation);
-	getroomdata();
-	dx = bx;
-	openfile();
-	readheader();
-	dontloadseg();
-	dontloadseg();
-	dontloadseg();
-	dontloadseg();
-	allocateload();
-	data.word(kReel1) = ax;
-	ds = ax;
-	dx = 0;
-	loadseg();
-	allocateload();
-	data.word(kReel2) = ax;
-	ds = ax;
-	dx = 0;
-	loadseg();
-	allocateload();
-	data.word(kReel3) = ax;
-	ds = ax;
-	dx = 0;
-	loadseg();
-	closefile();
-}
-
 void DreamGenContext::allocateload() {
 	STACK_CHECK;
 	push(es);
diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h
index 5c9d860..ddfa977 100644
--- a/engines/dreamweb/dreamgen.h
+++ b/engines/dreamweb/dreamgen.h
@@ -55,7 +55,6 @@ public:
 	static const uint16 addr_getridoftemp = 0xcb70;
 	static const uint16 addr_allocateload = 0xcb68;
 	static const uint16 addr_dontloadseg = 0xcb64;
-	static const uint16 addr_restorereels = 0xcb40;
 	static const uint16 addr_getridofall = 0xcb3c;
 	static const uint16 addr_getridofreels = 0xcb38;
 	static const uint16 addr_loadtemptext = 0xcb2c;
@@ -1704,7 +1703,7 @@ public:
 	void newgame();
 	//void showwatch();
 	//void turnanypathon();
-	void restorereels();
+	//void restorereels();
 	void setwalk();
 	//void useroutine();
 	//void zoomicon();
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index f80fad4..40c9cd1 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -2314,5 +2314,37 @@ void DreamGenContext::restoreall() {
 	setallchanges();
 }
 
+void DreamGenContext::restorereels() {
+	STACK_CHECK;
+	_cmp(data.byte(kRoomloaded), 0);
+	if (flags.z())
+		return /* (dontrestore) */;
+	al = data.byte(kReallocation);
+	getroomdata();
+	dx = bx;
+	openfile();
+	readheader();
+	dontloadseg();
+	dontloadseg();
+	dontloadseg();
+	dontloadseg();
+	allocateload();
+	data.word(kReel1) = ax;
+	ds = ax;
+	dx = 0;
+	loadseg();
+	allocateload();
+	data.word(kReel2) = ax;
+	ds = ax;
+	dx = 0;
+	loadseg();
+	allocateload();
+	data.word(kReel3) = ax;
+	ds = ax;
+	dx = 0;
+	loadseg();
+	closefile();
+}
+
 } /*namespace dreamgen */
 
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index ddf89da..cbad64b 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -353,4 +353,5 @@
 	void clearAndLoad(uint16 seg, uint8 c, unsigned int size, unsigned int maxSize);
 	void loadRoomData(const Room* room, bool skipDat);
 	void restoreall();
+	void restorereels();
 


Commit: 1c860bc4ce508506045e8f37fa4a6cf036577464
    https://github.com/scummvm/scummvm/commit/1c860bc4ce508506045e8f37fa4a6cf036577464
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2011-11-26T11:47:54-08:00

Commit Message:
DREAMWEB: Convert 'restorereels'

This also allows 'allocateload' to be removed.

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



diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover
index 3c3267b..adcd5a2 100755
--- a/devtools/tasmrecover/tasm-recover
+++ b/devtools/tasmrecover/tasm-recover
@@ -300,6 +300,7 @@ generator = cpp(context, "DreamGen", blacklist = [
 	'storeit',
 	'restoreall',
 	'restorereels',
+	'allocateload',
 	], skip_output = [
 	# These functions are processed but not output
 	'dreamweb',
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index 61d9e6f..cbbfc6d 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -12715,18 +12715,6 @@ void DreamGenContext::getridofall() {
 	deallocatemem();
 }
 
-void DreamGenContext::allocateload() {
-	STACK_CHECK;
-	push(es);
-	push(di);
-	bx = es.word(di);
-	cl = 4;
-	_shr(bx, cl);
-	allocatemem();
-	di = pop();
-	es = pop();
-}
-
 void DreamGenContext::getridoftemp() {
 	STACK_CHECK;
 	es = data.word(kTempgraphics);
diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h
index ddfa977..f3c9873 100644
--- a/engines/dreamweb/dreamgen.h
+++ b/engines/dreamweb/dreamgen.h
@@ -53,7 +53,6 @@ public:
 	static const uint16 addr_getridoftemp2 = 0xcb78;
 	static const uint16 addr_getridoftemptext = 0xcb74;
 	static const uint16 addr_getridoftemp = 0xcb70;
-	static const uint16 addr_allocateload = 0xcb68;
 	static const uint16 addr_dontloadseg = 0xcb64;
 	static const uint16 addr_getridofall = 0xcb3c;
 	static const uint16 addr_getridofreels = 0xcb38;
@@ -1799,7 +1798,7 @@ public:
 	//void getnextword();
 	void generalerror();
 	//void actualload();
-	void allocateload();
+	//void allocateload();
 	//void saveposition();
 	void mode640x480();
 	void openeden();
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index 40c9cd1..c336a62 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -2315,34 +2315,29 @@ void DreamGenContext::restoreall() {
 }
 
 void DreamGenContext::restorereels() {
-	STACK_CHECK;
-	_cmp(data.byte(kRoomloaded), 0);
-	if (flags.z())
-		return /* (dontrestore) */;
-	al = data.byte(kReallocation);
-	getroomdata();
-	dx = bx;
-	openfile();
+	if (data.byte(kRoomloaded) == 0)
+		return;
+
+	const Room *room = getroomdata(data.byte(kReallocation));
+
+	engine->openFile(room->name);
+	cs.word(kHandle) = 1; //only one handle
+	flags._c = false;
 	readheader();
-	dontloadseg();
-	dontloadseg();
-	dontloadseg();
-	dontloadseg();
-	allocateload();
-	data.word(kReel1) = ax;
-	ds = ax;
-	dx = 0;
-	loadseg();
-	allocateload();
-	data.word(kReel2) = ax;
-	ds = ax;
-	dx = 0;
-	loadseg();
-	allocateload();
-	data.word(kReel3) = ax;
-	ds = ax;
-	dx = 0;
-	loadseg();
+
+	// read segment lengths from room file header
+	int len[15];
+	for (int i = 0; i < 15; ++i)
+		len[i] = cs.word(kFiledata + 2*i);
+
+	engine->skipBytes(len[0]);
+	engine->skipBytes(len[1]);
+	engine->skipBytes(len[2]);
+	engine->skipBytes(len[3]);
+	data.word(kReel1) = allocateAndLoad(len[4]);
+	data.word(kReel2) = allocateAndLoad(len[5]);
+	data.word(kReel3) = allocateAndLoad(len[6]);
+
 	closefile();
 }
 






More information about the Scummvm-git-logs mailing list