From 1c860bc4ce508506045e8f37fa4a6cf036577464 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sat, 26 Nov 2011 20:45:59 +0100 Subject: DREAMWEB: Convert 'restorereels' This also allows 'allocateload' to be removed. --- engines/dreamweb/dreamgen.cpp | 12 ----------- engines/dreamweb/dreamgen.h | 3 +-- engines/dreamweb/stubs.cpp | 49 +++++++++++++++++++------------------------ 3 files changed, 23 insertions(+), 41 deletions(-) (limited to 'engines/dreamweb') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 61d9e6f458..cbbfc6df88 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 ddfa97789d..f3c9873b13 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 40c9cd18b0..c336a62307 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(); } -- cgit v1.2.3