aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2011-11-26 17:43:50 +0100
committerWillem Jan Palenstijn2011-11-26 18:21:15 +0100
commit8c830ce1b98a5cd9ab011d2c6599e5f3d9659c80 (patch)
treefcf651b1a8ab180f568f014981b828a605584559
parent77cb6d137550bd1a437577ebb1259fe574b2b4a6 (diff)
downloadscummvm-rg350-8c830ce1b98a5cd9ab011d2c6599e5f3d9659c80.tar.gz
scummvm-rg350-8c830ce1b98a5cd9ab011d2c6599e5f3d9659c80.tar.bz2
scummvm-rg350-8c830ce1b98a5cd9ab011d2c6599e5f3d9659c80.zip
DREAMWEB: Convert 'actualsave'
-rw-r--r--engines/dreamweb/saveload.cpp116
1 files changed, 41 insertions, 75 deletions
diff --git a/engines/dreamweb/saveload.cpp b/engines/dreamweb/saveload.cpp
index 8100a25705..ba338cb297 100644
--- a/engines/dreamweb/saveload.cpp
+++ b/engines/dreamweb/saveload.cpp
@@ -246,32 +246,19 @@ void DreamGenContext::savegame() {
}
// TODO: The below is copied from actualsave
- al = data.byte(kLocation);
- ah = 0;
- cx = 32;
- _mul(cx);
- ds = cs;
- si = kRoomdata;
- _add(si, ax);
- di = kMadeuproomdat;
- bx = di;
+ const Room *currentRoom = (const Room *)cs.ptr(kRoomdata + sizeof(Room)*data.byte(kLocation), sizeof(Room));
+ Room *madeUpRoom = (Room *)cs.ptr(kMadeuproomdat, sizeof(Room));
+
+ *madeUpRoom = *currentRoom;
+ bx = kMadeuproomdat;
es = cs;
- cx = 16;
- _movsw(cx, true);
- al = data.byte(kRoomssample);
- es.byte(bx+13) = al;
- al = data.byte(kMapx);
- es.byte(bx+15) = al;
- al = data.byte(kMapy);
- es.byte(bx+16) = al;
- al = data.byte(kLiftflag);
- es.byte(bx+20) = al;
- al = data.byte(kManspath);
- es.byte(bx+21) = al;
- al = data.byte(kFacing);
- es.byte(bx+22) = al;
- al = 255;
- es.byte(bx+27) = al;
+ madeUpRoom->roomsSample = data.byte(kRoomssample);
+ madeUpRoom->mapX = data.byte(kMapx);
+ madeUpRoom->mapY = data.byte(kMapy);
+ madeUpRoom->liftFlag = data.byte(kLiftflag);
+ madeUpRoom->b21 = data.byte(kManspath);
+ madeUpRoom->facing = data.byte(kFacing);
+ madeUpRoom->b27 = 255;
// TODO: The below is copied from saveposition
makeheader();
@@ -381,59 +368,38 @@ void DreamGenContext::showdiscops() {
}
void DreamGenContext::actualsave() {
- STACK_CHECK;
- _cmp(data.byte(kCommandtype), 222);
- if (flags.z())
- goto alreadyactsave;
- data.byte(kCommandtype) = 222;
- al = 44;
- commandonly();
-alreadyactsave:
- ax = data.word(kMousebutton);
- _and(ax, 1);
- if (flags.z())
- return /* (noactsave) */;
- dx = data;
- ds = dx;
- si = 8579;
- al = data.byte(kCurrentslot);
- ah = 0;
- cx = 17;
- _mul(cx);
- _add(si, ax);
- _inc(si);
- _cmp(ds.byte(si), 0);
- if (flags.z())
- return /* (noactsave) */;
- al = data.byte(kLocation);
- ah = 0;
- cx = 32;
- _mul(cx);
- ds = cs;
- si = 6187;
- _add(si, ax);
- di = 7979;
- bx = di;
+ if (data.byte(kCommandtype) != 222) {
+ data.byte(kCommandtype) = 222;
+ commandonly(44);
+ }
+
+ if (!(data.word(kMousebutton) & 1))
+ return;
+
+ unsigned int slot = data.byte(kCurrentslot);
+
+ const char *desc = (const char *)data.ptr(kSavenames + 17*slot + 1, 16);
+ if (desc[0] == 0)
+ return;
+
+ const Room *currentRoom = (const Room *)cs.ptr(kRoomdata + sizeof(Room)*data.byte(kLocation), sizeof(Room));
+ Room *madeUpRoom = (Room *)cs.ptr(kMadeuproomdat, sizeof(Room));
+
+ *madeUpRoom = *currentRoom;
+ bx = kMadeuproomdat;
es = cs;
- cx = 16;
- _movsw(cx, true);
- al = data.byte(kRoomssample);
- es.byte(bx+13) = al;
- al = data.byte(kMapx);
- es.byte(bx+15) = al;
- al = data.byte(kMapy);
- es.byte(bx+16) = al;
- al = data.byte(kLiftflag);
- es.byte(bx+20) = al;
- al = data.byte(kManspath);
- es.byte(bx+21) = al;
- al = data.byte(kFacing);
- es.byte(bx+22) = al;
- al = 255;
- es.byte(bx+27) = al;
+ madeUpRoom->roomsSample = data.byte(kRoomssample);
+ madeUpRoom->mapX = data.byte(kMapx);
+ madeUpRoom->mapY = data.byte(kMapy);
+ madeUpRoom->liftFlag = data.byte(kLiftflag);
+ madeUpRoom->b21 = data.byte(kManspath);
+ madeUpRoom->facing = data.byte(kFacing);
+ madeUpRoom->b27 = 255;
+
saveposition();
+
getridoftemp();
- restoreall();
+ restoreall(); // reels
data.word(kTextaddressx) = 13;
data.word(kTextaddressy) = 182;
data.byte(kTextlen) = 240;