aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2011-12-03 16:30:51 +0100
committerWillem Jan Palenstijn2011-12-03 16:56:37 +0100
commit23576c8f155833614f5207b14005f9a69f1c8d4f (patch)
treea05af18e02833b85e9c71ba943689b91962db977
parent6ded3f5dc563b6dac88803abc0c33c7180b87c1a (diff)
downloadscummvm-rg350-23576c8f155833614f5207b14005f9a69f1c8d4f.tar.gz
scummvm-rg350-23576c8f155833614f5207b14005f9a69f1c8d4f.tar.bz2
scummvm-rg350-23576c8f155833614f5207b14005f9a69f1c8d4f.zip
DREAMWEB: Clean up
-rw-r--r--engines/dreamweb/saveload.cpp20
-rw-r--r--engines/dreamweb/stubs.cpp4
2 files changed, 9 insertions, 15 deletions
diff --git a/engines/dreamweb/saveload.cpp b/engines/dreamweb/saveload.cpp
index b520150254..6af4071248 100644
--- a/engines/dreamweb/saveload.cpp
+++ b/engines/dreamweb/saveload.cpp
@@ -60,7 +60,7 @@ void DreamGenContext::doLoad() {
namesToOld();
data.byte(kGetback) = 0;
- while (true) {
+ while (data.byte(kGetback) == 0) {
if (quitRequested())
return;
delPointer();
@@ -77,8 +77,6 @@ void DreamGenContext::doLoad() {
{ 0xFFFF,0,0,0,0 }
};
checkCoords(loadlist);
- if (data.byte(kGetback) == 1)
- break; // This signalled that actualLoad loaded a game
if (data.byte(kGetback) == 2)
return; // "quitloaded"
}
@@ -114,8 +112,6 @@ void DreamGenContext::doLoad() {
if (data.word(kTempgraphics) != 0xFFFF)
getRidOfTemp();
- dx = data;
- es = dx;
const Room *room = (const Room *)cs.ptr(kMadeuproomdat, sizeof(Room));
startLoading(*room);
loadRoomsSample();
@@ -160,7 +156,7 @@ void DreamGenContext::saveGame() {
data.word(kBufferout) = 0;
data.byte(kGetback) = 0;
- while (true) {
+ while (data.byte(kGetback) == 0) {
if (quitRequested())
return;
delPointer();
@@ -179,10 +175,6 @@ void DreamGenContext::saveGame() {
{ 0xFFFF,0,0,0,0 }
};
checkCoords(savelist);
- _cmp(data.byte(kGetback), 0);
- if (flags.z())
- continue;
- break;
}
return;
} else {
@@ -340,7 +332,7 @@ void DreamGenContext::savePosition(unsigned int slot, const uint8 *descbuf) {
for (int i = 0; i < 6; ++i)
header.setLen(i, len[i]);
- engine->writeToSaveFile((const uint8 *)&header, kHeaderlen);
+ engine->writeToSaveFile((const uint8 *)&header, sizeof(FileHeader));
engine->writeToSaveFile(descbuf, len[0]);
engine->writeToSaveFile(data.ptr(kStartvars, len[1]), len[1]);
engine->writeToSaveFile(getSegment(data.word(kExtras)).ptr(kExframedata, len[2]), len[2]);
@@ -362,7 +354,7 @@ void DreamGenContext::loadPosition(unsigned int slot) {
FileHeader header;
- engine->readFromSaveFile((uint8 *)&header, kHeaderlen);
+ engine->readFromSaveFile((uint8 *)&header, sizeof(FileHeader));
// read segment lengths from savegame file header
int len[6];
@@ -383,6 +375,8 @@ void DreamGenContext::loadPosition(unsigned int slot) {
engine->readFromSaveFile(getSegment(data.word(kBuffers)).ptr(kListofchanges, len[3]), len[3]);
// len[4] == 48, which is sizeof(Room) plus 16 for 'Roomscango'
+ // Note: the values read into Madeuproomdat are only used in actualLoad,
+ // which is (almost) immediately called after this function
engine->readFromSaveFile(data.ptr(kMadeuproomdat, sizeof(Room)), sizeof(Room));
engine->readFromSaveFile(data.ptr(kRoomscango, 16), 16);
@@ -403,7 +397,7 @@ unsigned int DreamGenContext::scanForNames() {
++count;
- engine->readFromSaveFile((uint8 *)&header, kHeaderlen);
+ engine->readFromSaveFile((uint8 *)&header, sizeof(FileHeader));
if (header.len(0) != 17) {
::warning("Error loading save: description buffer isn't 17 bytes");
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index 4b3428e47d..2db75ee3e5 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -583,7 +583,7 @@ uint16 DreamGenContext::standardLoad(const char *fileName) {
FileHeader header;
engine->openFile(fileName);
- engine->readFromFile((uint8 *)&header, kHeaderlen);
+ engine->readFromFile((uint8 *)&header, sizeof(FileHeader));
uint16 sizeInBytes = header.len(0);
uint16 result = allocateMem((sizeInBytes + 15) / 16);
engine->readFromFile(getSegment(result).ptr(0, 0), sizeInBytes);
@@ -2425,7 +2425,7 @@ void DreamGenContext::loadRoomData(const Room &room, bool skipDat) {
flags._c = false;
FileHeader header;
- engine->readFromFile((uint8 *)&header, kHeaderlen);
+ engine->readFromFile((uint8 *)&header, sizeof(FileHeader));
// read segment lengths from room file header
int len[15];