aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/dreamweb/dreambase.h4
-rw-r--r--engines/dreamweb/stubs.cpp13
-rw-r--r--engines/dreamweb/stubs.h3
-rw-r--r--engines/dreamweb/vgagrafx.cpp9
4 files changed, 13 insertions, 16 deletions
diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h
index b75231c31f..cea7dc2512 100644
--- a/engines/dreamweb/dreambase.h
+++ b/engines/dreamweb/dreambase.h
@@ -59,7 +59,6 @@ public:
data(kDefaultDataSegment, _realData) {
}
-
public:
// from print.cpp
uint8 getNextWord(const Frame *charSet, const uint8 *string, uint8 *totalWidth, uint8 *charCount);
@@ -70,6 +69,9 @@ public:
void volumeAdjust();
// from vgagrafx.cpp
+ uint8 _workspace[(0x1000 + 2) * 16];
+ uint8 *workspace() { return _workspace; }
+
void printUnderMon();
void cls();
void frameOutV(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, int16 x, int16 y);
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index 165585b974..d2cc525376 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -1215,14 +1215,20 @@ uint16 DreamGenContext::allocateAndLoad(unsigned int size) {
return result;
}
-void DreamGenContext::clearAndLoad(uint16 seg, uint8 c,
+void DreamGenContext::clearAndLoad(uint8 *buf, uint8 c,
unsigned int size, unsigned int maxSize) {
assert(size <= maxSize);
- uint8 *buf = getSegment(seg).ptr(0, maxSize);
memset(buf, c, maxSize);
engine->readFromFile(buf, size);
}
+void DreamGenContext::clearAndLoad(uint16 seg, uint8 c,
+ unsigned int size, unsigned int maxSize) {
+ assert(size <= maxSize);
+ uint8 *buf = getSegment(seg).ptr(0, maxSize);
+ clearAndLoad(buf, c, size, maxSize);
+}
+
void DreamGenContext::startLoading(const Room &room) {
data.byte(kCombatcount) = 0;
data.byte(kRoomssample) = room.roomsSample;
@@ -2638,7 +2644,7 @@ void DreamGenContext::loadRoomData(const Room &room, bool skipDat) {
len[i] = header.len(i);
data.word(kBackdrop) = allocateAndLoad(len[0]);
- clearAndLoad(data.word(kWorkspace), 0, len[1], 132*66); // 132*66 = maplen
+ clearAndLoad(workspace(), 0, len[1], 132*66); // 132*66 = maplen
sortOutMap();
data.word(kSetframes) = allocateAndLoad(len[2]);
if (!skipDat)
@@ -2950,7 +2956,6 @@ void DreamGenContext::allocateBuffers() {
data.word(kFreedat) = allocateMem(kFreedatlen/16);
data.word(kSetdat) = allocateMem(kSetdatlen/16);
data.word(kMapstore) = allocateMem(kLenofmapstore/16);
- allocateWork();
data.word(kSounddata) = allocateMem(2048/16);
data.word(kSounddata2) = allocateMem(2048/16);
}
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index e896acdd98..88d6b071cc 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -30,9 +30,7 @@
void switchRyanOff();
uint16 allocateMem(uint16 paragraphs);
void deallocateMem(uint16 segment);
- uint8 *workspace();
uint8 *textUnder();
- void allocateWork();
void clearWork();
uint16 standardLoad(const char *fileName, uint16 *outSizeInBytes = NULL); // Returns a segment handle which needs to be freed with deallocatemem for symmetry
void *standardLoadCPP(const char *fileName, uint16 *outSizeInBytes = NULL); // And this one should be 'free'd
@@ -354,6 +352,7 @@
void openForSave(unsigned int slot);
bool openForLoad(unsigned int slot);
uint16 allocateAndLoad(unsigned int size);
+ void clearAndLoad(uint8 *buf, uint8 c, unsigned int size, unsigned int maxSize);
void clearAndLoad(uint16 seg, uint8 c, unsigned int size, unsigned int maxSize);
void loadRoomData(const Room &room, bool skipDat);
void restoreAll();
diff --git a/engines/dreamweb/vgagrafx.cpp b/engines/dreamweb/vgagrafx.cpp
index 20eb840628..54c737d07f 100644
--- a/engines/dreamweb/vgagrafx.cpp
+++ b/engines/dreamweb/vgagrafx.cpp
@@ -27,15 +27,6 @@
namespace DreamGen {
-uint8 *DreamGenContext::workspace() {
- uint8 *result = getSegment(data.word(kWorkspace)).ptr(0, 0);
- return result;
-}
-
-void DreamGenContext::allocateWork() {
- data.word(kWorkspace) = allocateMem(0x1000);
-}
-
void DreamGenContext::multiGet() {
multiGet(ds.ptr(si, 0), di, bx, cl, ch);
si += cl * ch;