diff options
author | Willem Jan Palenstijn | 2011-12-27 21:28:37 +0100 |
---|---|---|
committer | Willem Jan Palenstijn | 2011-12-27 23:02:33 +0100 |
commit | e54196f37fbf918976f834680671c12bfce58d23 (patch) | |
tree | 4efaee7fe7e963aeedd08277eaf9f54d5b70f30f | |
parent | 90cb52b7f6364a0d4b83cdc91c76c7edf4fcf79d (diff) | |
download | scummvm-rg350-e54196f37fbf918976f834680671c12bfce58d23.tar.gz scummvm-rg350-e54196f37fbf918976f834680671c12bfce58d23.tar.bz2 scummvm-rg350-e54196f37fbf918976f834680671c12bfce58d23.zip |
DREAMWEB: Remove Extras segment
-rwxr-xr-x | devtools/tasmrecover/tasm-recover | 1 | ||||
-rw-r--r-- | engines/dreamweb/backdrop.cpp | 6 | ||||
-rw-r--r-- | engines/dreamweb/dreambase.h | 11 | ||||
-rw-r--r-- | engines/dreamweb/dreamgen.cpp | 8 | ||||
-rw-r--r-- | engines/dreamweb/dreamgen.h | 71 | ||||
-rw-r--r-- | engines/dreamweb/object.cpp | 64 | ||||
-rw-r--r-- | engines/dreamweb/saveload.cpp | 18 | ||||
-rw-r--r-- | engines/dreamweb/stubs.cpp | 48 | ||||
-rw-r--r-- | engines/dreamweb/vgagrafx.cpp | 6 |
9 files changed, 128 insertions, 105 deletions
diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover index bf0a2c0459..7e636ebb5f 100755 --- a/devtools/tasmrecover/tasm-recover +++ b/devtools/tasmrecover/tasm-recover @@ -255,6 +255,7 @@ p = parser(skip_binary_data = [ 'tempgraphics3', 'tempsprites', 'charset1', + 'extras', # vars.asm - constants 'openinvlist', 'ryaninvlist', diff --git a/engines/dreamweb/backdrop.cpp b/engines/dreamweb/backdrop.cpp index 0dface9acb..e6f5e9ab42 100644 --- a/engines/dreamweb/backdrop.cpp +++ b/engines/dreamweb/backdrop.cpp @@ -259,8 +259,8 @@ void DreamBase::showAllEx() { _exList.clear(); - DynObject *objects = (DynObject *)getSegment(data.word(kExtras)).ptr(kExdata, sizeof(DynObject)); - const Frame *frameBase = (const Frame *)getSegment(data.word(kExtras)).ptr(0, 0); + DynObject *objects = _exData; + const GraphicsFile &frameBase = _exFrames; for (size_t i = 0; i < count; ++i) { DynObject *object = objects + i; if (object->mapad[0] == 0xff) @@ -273,7 +273,7 @@ void DreamBase::showAllEx() { uint8 width, height; ObjPos objPos; uint16 currentFrame = 3 * i; - calcFrFrame(frameBase[currentFrame], &width, &height, x, y, &objPos); + calcFrFrame(frameBase._frames[currentFrame], &width, &height, x, y, &objPos); if ((width != 0) || (height != 0)) { assert(currentFrame < 256); showFrame(frameBase, x + data.word(kMapadx), y + data.word(kMapady), currentFrame, 0); diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 8dd80836e6..d07e74d3f0 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -51,6 +51,7 @@ const unsigned int kLenOfMapStore = 22*8*20*8; const unsigned int kMapWidth = 66; const unsigned int kMapHeight = 60; const unsigned int kLengthOfMap = kMapWidth * kMapHeight; +const unsigned int kNumExObjects = 114; /** * This class is one of the parent classes of DreamGenContext. Its sole purpose @@ -146,6 +147,12 @@ protected: GraphicsFile _setFrames; GraphicsFile _freeFrames; + // Extras segment (NB: this is saved) + GraphicsFile _exFrames; + DynObject _exData[kNumExObjects]; + uint16 _exTextdatLE[kNumExObjects+2]; // TODO: Convert into TextFile + char _exText[18000]; + public: DreamBase(DreamWeb::DreamWebEngine *en); @@ -845,10 +852,10 @@ public: void setMode(); void showPCX(const Common::String &name); void showFrameInternal(const uint8 *pSrc, uint16 x, uint16 y, uint8 effectsFlag, uint8 width, uint8 height); - void showFrame(const GraphicsFile &frameData, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag, uint8 *width, uint8 *height); - void showFrame(const GraphicsFile &frameData, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag); void showFrame(const Frame *frameData, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag, uint8 *width, uint8 *height); void showFrame(const Frame *frameData, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag); + void showFrame(const GraphicsFile &frameData, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag, uint8 *width, uint8 *height); + void showFrame(const GraphicsFile &frameData, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag); bool pixelCheckSet(const ObjPos *pos, uint8 x, uint8 y); void loadPalFromIFF(); void createPanel(); diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 4378841d83..401140e4f3 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -65,13 +65,13 @@ void DreamGenContext::__start() { //0x0100: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0110: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //0x0120: .... .... .... .... - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x17, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0130: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, //0x0140: .... .... .... .... - 0x00, 0xff, }; + }; ds.assign(src, src + sizeof(src)); dreamweb(); } diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 41b30100ab..673800774a 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -249,42 +249,41 @@ static const uint16 kWongame = 274; static const uint16 kLasthardkey = 275; static const uint16 kBufferin = 276; static const uint16 kBufferout = 278; -static const uint16 kExtras = 280; -static const uint16 kWorkspace = 282; -static const uint16 kMainsprites = 284; -static const uint16 kBackdrop = 286; -static const uint16 kRecordspace = 288; -static const uint16 kFreedat = 290; -static const uint16 kSetdat = 292; -static const uint16 kReel1 = 294; -static const uint16 kReel2 = 296; -static const uint16 kReel3 = 298; -static const uint16 kRoomdesc = 300; -static const uint16 kFreedesc = 302; -static const uint16 kSetdesc = 304; -static const uint16 kBlockdesc = 306; -static const uint16 kSetframes = 308; -static const uint16 kFreeframes = 310; -static const uint16 kPeople = 312; -static const uint16 kReels = 314; -static const uint16 kBlinkframe = 316; -static const uint16 kBlinkcount = 317; -static const uint16 kReasseschanges = 318; -static const uint16 kPointerspath = 319; -static const uint16 kManspath = 320; -static const uint16 kPointerfirstpath = 321; -static const uint16 kFinaldest = 322; -static const uint16 kDestination = 323; -static const uint16 kLinestartx = 324; -static const uint16 kLinestarty = 326; -static const uint16 kLineendx = 328; -static const uint16 kLineendy = 330; -static const uint16 kLinepointer = 332; -static const uint16 kLinedirection = 333; -static const uint16 kLinelength = 334; -static const uint16 kCh0playing = 335; -static const uint16 kCh0repeat = 336; -static const uint16 kCh1playing = 337; +static const uint16 kWorkspace = 280; +static const uint16 kMainsprites = 282; +static const uint16 kBackdrop = 284; +static const uint16 kRecordspace = 286; +static const uint16 kFreedat = 288; +static const uint16 kSetdat = 290; +static const uint16 kReel1 = 292; +static const uint16 kReel2 = 294; +static const uint16 kReel3 = 296; +static const uint16 kRoomdesc = 298; +static const uint16 kFreedesc = 300; +static const uint16 kSetdesc = 302; +static const uint16 kBlockdesc = 304; +static const uint16 kSetframes = 306; +static const uint16 kFreeframes = 308; +static const uint16 kPeople = 310; +static const uint16 kReels = 312; +static const uint16 kBlinkframe = 314; +static const uint16 kBlinkcount = 315; +static const uint16 kReasseschanges = 316; +static const uint16 kPointerspath = 317; +static const uint16 kManspath = 318; +static const uint16 kPointerfirstpath = 319; +static const uint16 kFinaldest = 320; +static const uint16 kDestination = 321; +static const uint16 kLinestartx = 322; +static const uint16 kLinestarty = 324; +static const uint16 kLineendx = 326; +static const uint16 kLineendy = 328; +static const uint16 kLinepointer = 330; +static const uint16 kLinedirection = 331; +static const uint16 kLinelength = 332; +static const uint16 kCh0playing = 333; +static const uint16 kCh0repeat = 334; +static const uint16 kCh1playing = 335; static const uint16 kBlocktextdat = (0); static const uint16 kPersonframes = (0); static const uint16 kDebuglevel1 = (0); diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index 4f9d091da6..3054a61d68 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -83,12 +83,11 @@ void DreamBase::obToInv(uint8 index, uint8 flag, uint16 x, uint16 y) { if (index == 0xff) return; - if (flag == kExObjectType) { - Frame *extras = (Frame *)getSegment(data.word(kExtras)).ptr(0, 0); - showFrame(extras, x + 18, y + 19, 3 * index + 1, 128); - } else { + if (flag == kExObjectType) + showFrame(_exFrames, x + 18, y + 19, 3 * index + 1, 128); + else showFrame(_freeFrames, x + 18, y + 19, 3 * index + 1, 128); - } + const DynObject *object = (const DynObject *)getAnyAdDir(index, flag); bool worn = isItWorn(object); if (worn) @@ -99,12 +98,10 @@ void DreamBase::obPicture() { if (data.byte(kObjecttype) == kSetObjectType1) return; uint8 frame = 3 * data.byte(kCommand) + 1; - if (data.byte(kObjecttype) == kExObjectType) { - const Frame *frames = (const Frame *)getSegment(data.word(kExtras)).ptr(0, 0); - showFrame(frames, 160, 68, frame, 0x80); - } else { + if (data.byte(kObjecttype) == kExObjectType) + showFrame(_exFrames, 160, 68, frame, 0x80); + else showFrame(_freeFrames, 160, 68, frame, 0x80); - } } void DreamBase::obIcons() { @@ -254,12 +251,12 @@ void DreamBase::inventory() { } void DreamBase::transferText(uint8 from, uint8 to) { - getSegment(data.word(kExtras)).word(kExtextdat + 2*to) = data.word(kExtextpos); + WRITE_LE_UINT16(&_exTextdatLE[to], data.word(kExtextpos)); uint16 freeTextOffset = 2*from; uint16 srcOffset = getSegment(data.word(kFreedesc)).word(kFreetextdat + freeTextOffset); const char *src = (const char *)getSegment(data.word(kFreedesc)).ptr(kFreetext + srcOffset, 0); - char *dst = (char *)getSegment(data.word(kExtras)).ptr(kExtext + data.word(kExtextpos), 0); + char *dst = _exText + data.word(kExtextpos); size_t len = strlen(src); memcpy(dst, src, len + 1); @@ -429,47 +426,47 @@ void DreamBase::setPickup() { } void DreamBase::deleteExFrame(uint8 frameNum) { - Frame *frame = (Frame *)getSegment(data.word(kExtras)).ptr(kExframedata + sizeof(Frame)*frameNum, sizeof(Frame)); + Frame *frame = &_exFrames._frames[frameNum]; uint16 frameSize = frame->width * frame->height; // Note: the original asm didn't subtract frameSize from remainder uint16 remainder = kExframeslen - frame->ptr() - frameSize; - uint16 startOff = kExframes + frame->ptr(); + uint16 startOff = frame->ptr(); uint16 endOff = startOff + frameSize; // Shift frame data after this one down - memmove(getSegment(data.word(kExtras)).ptr(startOff, remainder), getSegment(data.word(kExtras)).ptr(endOff, remainder), remainder); + memmove(&_exFrames._data[startOff], &_exFrames._data[endOff], remainder); // Combined frame data is now frameSize smaller data.word(kExframepos) -= frameSize; // Adjust all frame pointers pointing into the shifted data for (unsigned int i = 0; i < 3*kNumexobjects; ++i) { - frame = (Frame *)getSegment(data.word(kExtras)).ptr(kExframedata + sizeof(Frame)*i, sizeof(Frame)); + frame = &_exFrames._frames[i]; if (frame->ptr() >= startOff) frame->setPtr(frame->ptr() - frameSize); } } void DreamBase::deleteExText(uint8 textNum) { - uint16 offset = getSegment(data.word(kExtras)).word(kExtextdat + 2*textNum); + uint16 offset = READ_LE_UINT16(&_exTextdatLE[textNum]); - uint16 startOff = kExtext + offset; - uint16 textSize = strlen((char *)getSegment(data.word(kExtras)).ptr(startOff, 0)) + 1; + uint16 startOff = offset; + uint16 textSize = strlen(&_exText[startOff]) + 1; uint16 endOff = startOff + textSize; uint16 remainder = kExtextlen - offset - textSize; // Shift text data after this one down - memmove(getSegment(data.word(kExtras)).ptr(startOff, remainder), getSegment(data.word(kExtras)).ptr(endOff, remainder), remainder); + memmove(&_exText[startOff], &_exText[endOff], remainder); // Combined text data is now frameSize smaller data.word(kExtextpos) -= textSize; // Adjust all text pointers pointing into the shifted data for (unsigned int i = 0; i < kNumexobjects; ++i) { - uint16 t = getSegment(data.word(kExtras)).word(kExtextdat + 2*i); + uint16 t = READ_LE_UINT16(&_exTextdatLE[i]); if (t >= offset + textSize) - getSegment(data.word(kExtras)).word(kExtextdat + 2*i) = t - textSize; + WRITE_LE_UINT16(&_exTextdatLE[i], t - textSize); } } @@ -591,22 +588,26 @@ void DreamBase::purgeALocation(uint8 index) { } const uint8 *DreamBase::getObTextStart() { - uint16 textSeg, textDatOff, textOff; + const uint8 *textBase; + const uint8 *text; + uint16 textOff; if (data.byte(kObjecttype) == kFreeObjectType) { - textSeg = data.word(kFreedesc); - textDatOff = kFreetextdat; + uint16 textSeg = data.word(kFreedesc); + uint16 textDatOff = kFreetextdat; textOff = kFreetext; + textBase = getSegment(textSeg).ptr(textOff, 0); + text = textBase + getSegment(textSeg).word(textDatOff + 2*data.byte(kCommand)); } else if (data.byte(kObjecttype) == kSetObjectType1) { - textSeg = data.word(kSetdesc); - textDatOff = kSettextdat; + uint16 textSeg = data.word(kSetdesc); + uint16 textDatOff = kSettextdat; textOff = kSettext; + textBase = getSegment(textSeg).ptr(textOff, 0); + text = textBase + getSegment(textSeg).word(textDatOff + 2*data.byte(kCommand)); } else { - textSeg = data.word(kExtras); - textDatOff = kExtextdat; + textBase = (const uint8 *)_exText; textOff = kExtext; + text = textBase + READ_LE_UINT16(&_exTextdatLE[data.byte(kCommand)]); } - const uint8 *textBase = getSegment(textSeg).ptr(textOff, 0); - const uint8 *text = textBase + getSegment(textSeg).word(textDatOff + 2*data.byte(kCommand)); if (data.byte(kObjecttype) != kSetObjectType1) return text; @@ -635,6 +636,7 @@ const uint8 *DreamBase::getObTextStart() { text++; // arbitrary give-up counter + // FIXME: Make this more precise to avoid reading out of bounds if (text - (textBase - textOff) >= 8000) { warning("Object description for %d/%d not found", data.byte(kObjecttype), data.byte(kCommand)); return obname; diff --git a/engines/dreamweb/saveload.cpp b/engines/dreamweb/saveload.cpp index 843bee77ac..2c659c4c6e 100644 --- a/engines/dreamweb/saveload.cpp +++ b/engines/dreamweb/saveload.cpp @@ -476,7 +476,14 @@ void DreamBase::savePosition(unsigned int slot, const char *descbuf) { outSaveFile->write((const uint8 *)&header, sizeof(FileHeader)); outSaveFile->write(descbuf, len[0]); outSaveFile->write(data.ptr(kStartvars, len[1]), len[1]); - outSaveFile->write(getSegment(data.word(kExtras)).ptr(kExframedata, len[2]), len[2]); + + // the Extras segment: + outSaveFile->write((const uint8 *)_exFrames._frames, 2080); + outSaveFile->write((const uint8 *)_exFrames._data, kExframeslen); + outSaveFile->write((const uint8 *)_exData, sizeof(DynObject)*kNumexobjects); + outSaveFile->write((const uint8 *)_exTextdatLE, 2*(kNumExObjects+2)); + outSaveFile->write((const uint8 *)_exText, kExtextlen); + outSaveFile->write(_listOfChanges, len[3]); // len[4] == 48, which is sizeof(Room) plus 16 for 'Roomscango' @@ -542,7 +549,14 @@ void DreamBase::loadPosition(unsigned int slot) { inSaveFile->read(namebuf, 17); } inSaveFile->read(data.ptr(kStartvars, len[1]), len[1]); - inSaveFile->read(getSegment(data.word(kExtras)).ptr(kExframedata, len[2]), len[2]); + + // the Extras segment: + inSaveFile->read((uint8 *)_exFrames._frames, 2080); + inSaveFile->read((uint8 *)_exFrames._data, kExframeslen); + inSaveFile->read((uint8 *)_exData, sizeof(DynObject)*kNumexobjects); + inSaveFile->read((uint8 *)_exTextdatLE, 2*(kNumExObjects+2)); + inSaveFile->read((uint8 *)_exText, kExtextlen); + inSaveFile->read(_listOfChanges, len[3]); // len[4] == 48, which is sizeof(Room) plus 16 for 'Roomscango' diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 9ef7dda581..084aa76da7 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -650,6 +650,10 @@ done: // The engine will need some cleaner finalization, let's put it here for n _tempCharset.clear(); _mainSprites.clear(); + _exFrames.clear(); + _setFrames.clear(); + _freeFrames.clear(); + _textFile1.clear(); _textFile2.clear(); _textFile3.clear(); @@ -1226,8 +1230,8 @@ const uint8 *DreamBase::findObName(uint8 type, uint8 index) { uint16 offset = getSegment(data.word(kPeople)).word(kPersontxtdat + i) + kPersontext; return getSegment(data.word(kPeople)).ptr(offset, 0); } else if (type == 4) { - uint16 offset = getSegment(data.word(kExtras)).word(kExtextdat + index * 2) + kExtext; - return getSegment(data.word(kExtras)).ptr(offset, 0); + uint16 offset = READ_LE_UINT16(&_exTextdatLE[index]); + return (const uint8 *)_exText + offset; } else if (type == 2) { uint16 offset = getSegment(data.word(kFreedesc)).word(kFreetextdat + index * 2) + kFreetext; return getSegment(data.word(kFreedesc)).ptr(offset, 0); @@ -1313,7 +1317,7 @@ DynObject *DreamBase::getFreeAd(uint8 index) { } DynObject *DreamBase::getExAd(uint8 index) { - return (DynObject *)getSegment(data.word(kExtras)).ptr(kExdata, 0) + index; + return &_exData[index]; } DynObject *DreamBase::getEitherAdCPP() { @@ -1374,7 +1378,7 @@ void DreamBase::doChange(uint8 index, uint8 value, uint8 type) { } void DreamBase::deleteTaken() { - const DynObject *extraObjects = (const DynObject *)getSegment(data.word(kExtras)).ptr(kExdata, 0); + const DynObject *extraObjects = _exData; DynObject *freeObjects = (DynObject *)getSegment(data.word(kFreedat)).ptr(0, 0); for (size_t i = 0; i < kNumexobjects; ++i) { uint8 location = extraObjects[i].initialLocation; @@ -1386,7 +1390,7 @@ void DreamBase::deleteTaken() { } uint8 DreamBase::getExPos() { - DynObject *objects = (DynObject *)getSegment(data.word(kExtras)).ptr(kExdata, sizeof(DynObject)); + DynObject *objects = _exData; for (size_t i = 0; i < kNumexobjects; ++i) { if (objects[i].mapad[0] == 0xff) return i; @@ -1565,13 +1569,13 @@ void DreamBase::showPointer() { uint16 y = data.word(kMousey); data.word(kOldpointery) = data.word(kMousey); if (data.byte(kPickup) == 1) { - const Frame *frame; - if (data.byte(kObjecttype) != kExObjectType) { - frame = &_freeFrames._frames[(3 * data.byte(kItemframe) + 1)]; - } else { - const Frame *frames = (const Frame *)getSegment(data.word(kExtras)).ptr(0, 0); - frame = frames + (3 * data.byte(kItemframe) + 1); - } + const GraphicsFile *frames; + if (data.byte(kObjecttype) != kExObjectType) + frames = &_freeFrames; + else + frames = &_exFrames; + const Frame *frame = &frames->_frames[(3 * data.byte(kItemframe) + 1)]; + uint8 width = frame->width; uint8 height = frame->height; if (width < 12) @@ -1585,12 +1589,7 @@ void DreamBase::showPointer() { data.word(kOldpointerx) = xMin; data.word(kOldpointery) = yMin; multiGet(_pointerBack, xMin, yMin, width, height); - if (data.byte(kObjecttype) != kExObjectType) { - showFrame(_freeFrames, x, y, 3 * data.byte(kItemframe) + 1, 128); - } else { - const Frame *frames = (const Frame *)getSegment(data.word(kExtras)).ptr(0, 0); - showFrame(frames, x, y, 3 * data.byte(kItemframe) + 1, 128); - } + showFrame(*frames, x, y, 3 * data.byte(kItemframe) + 1, 128); showFrame(_icons1, x, y, 3, 128); } else { const Frame *frame = &_icons1._frames[data.byte(kPointerframe) + 20]; @@ -2498,7 +2497,8 @@ void DreamBase::drawFloor() { } void DreamBase::allocateBuffers() { - data.word(kExtras) = allocateMem(kLengthofextra/16); + _exFrames.clear(); + _exFrames._data = new uint8[kExframeslen]; data.word(kFreedat) = allocateMem(kFreedatlen/16); data.word(kSetdat) = allocateMem(kSetdatlen/16); } @@ -3604,8 +3604,6 @@ void DreamBase::lookAtCard() { } void DreamBase::clearBuffers() { - memset(getSegment(data.word(kExtras)).ptr(0, kLengthofextra), 0xFF, kLengthofextra); - memcpy(_initialVars, data.ptr(kStartvars, kLengthofvars), kLengthofvars); clearChanges(); @@ -3621,7 +3619,11 @@ void DreamBase::clearChanges() { data.word(kExframepos) = 0; data.word(kExtextpos) = 0; - memset(getSegment(data.word(kExtras)).ptr(0, kLengthofextra), 0xFF, kLengthofextra); + memset(_exFrames._frames, 0xFF, 2080); + memset(_exFrames._data, 0xFF, kExframeslen); + memset(_exData, 0xFF, sizeof(DynObject) * kNumexobjects); + memset(_exTextdatLE, 0xFF, 2*(kNumexobjects+2)); + memset(_exText, 0xFF, kExtextlen); const uint8 initialRoomsCanGo[] = { 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; @@ -3710,7 +3712,7 @@ void DreamBase::emergencyPurge() { } void DreamBase::purgeAnItem() { - const DynObject *extraObjects = (const DynObject *)getSegment(data.word(kExtras)).ptr(kExdata, 0); + const DynObject *extraObjects = _exData; for (size_t i = 0; i < kNumexobjects; ++i) { if (extraObjects[i].mapad[0] && extraObjects[i].id[0] == 255 && diff --git a/engines/dreamweb/vgagrafx.cpp b/engines/dreamweb/vgagrafx.cpp index 19abc2b35d..417ccceab3 100644 --- a/engines/dreamweb/vgagrafx.cpp +++ b/engines/dreamweb/vgagrafx.cpp @@ -453,9 +453,7 @@ void DreamBase::showPanel() { void DreamBase::transferFrame(uint8 from, uint8 to, uint8 offset) { const Frame &freeFrame = _freeFrames._frames[3*from + offset]; - - Frame *exFrames = (Frame *)getSegment(data.word(kExtras)).ptr(kExframedata, 0); - Frame &exFrame = exFrames[3*to + offset]; + Frame &exFrame = _exFrames._frames[3*to + offset]; exFrame.width = freeFrame.width; exFrame.height = freeFrame.height; @@ -464,7 +462,7 @@ void DreamBase::transferFrame(uint8 from, uint8 to, uint8 offset) { uint16 byteCount = freeFrame.width * freeFrame.height; const uint8 *src = _freeFrames.getFrameData(3*from + offset); - uint8 *dst = getSegment(data.word(kExtras)).ptr(kExframes + data.word(kExframepos), byteCount); + uint8 *dst = _exFrames._data + data.word(kExframepos); memcpy(dst, src, byteCount); exFrame.setPtr(data.word(kExframepos)); |