diff options
Diffstat (limited to 'engines/dreamweb')
-rw-r--r-- | engines/dreamweb/backdrop.cpp | 10 | ||||
-rw-r--r-- | engines/dreamweb/dreambase.h | 3 | ||||
-rw-r--r-- | engines/dreamweb/dreamgen.cpp | 4 | ||||
-rw-r--r-- | engines/dreamweb/dreamgen.h | 38 | ||||
-rw-r--r-- | engines/dreamweb/sprite.cpp | 3 | ||||
-rw-r--r-- | engines/dreamweb/structs.h | 3 | ||||
-rw-r--r-- | engines/dreamweb/stubs.cpp | 28 |
7 files changed, 37 insertions, 52 deletions
diff --git a/engines/dreamweb/backdrop.cpp b/engines/dreamweb/backdrop.cpp index e6f5e9ab42..295be471f0 100644 --- a/engines/dreamweb/backdrop.cpp +++ b/engines/dreamweb/backdrop.cpp @@ -116,10 +116,7 @@ void DreamBase::makeBackOb(SetObject *objData, uint16 x, uint16 y) { uint8 type = objData->type; Sprite *sprite = makeSprite(x, y, addr_backobject, &_setFrames, 0); - uint16 objDataOffset = (uint8 *)objData - getSegment(data.word(kSetdat)).ptr(0, 0); - assert(objDataOffset % sizeof(SetObject) == 0); - assert(objDataOffset < 128 * sizeof(SetObject)); - sprite->_objData = objDataOffset; + sprite->_objData = objData; if (priority == 255) priority = 0; sprite->priority = priority; @@ -135,9 +132,8 @@ void DreamBase::showAllObs() { _setList.clear(); const GraphicsFile &frameBase = _setFrames; - SetObject *setEntries = (SetObject *)getSegment(data.word(kSetdat)).ptr(0, count * sizeof(SetObject)); for (size_t i = 0; i < count; ++i) { - SetObject *setEntry = setEntries + i; + SetObject *setEntry = &_setDat[i]; uint16 x, y; if (getMapAd(setEntry->mapad, &x, &y) == 0) continue; @@ -216,7 +212,7 @@ void DreamBase::showAllFree() { _freeList.clear(); - const DynObject *freeObjects = (const DynObject *)getSegment(data.word(kFreedat)).ptr(0, 0); + const DynObject *freeObjects = _freeDat; const GraphicsFile &frameBase = _freeFrames; for (size_t i = 0; i < count; ++i) { uint16 x, y; diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index a9b0f57119..77a32bbe60 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -157,6 +157,8 @@ protected: uint16 _personFramesLE[12]; RoomPaths _pathData[36]; Reel *_reelList; + SetObject _setDat[128]; + DynObject _freeDat[80]; // Extras segment (NB: this is saved) GraphicsFile _exFrames; @@ -530,7 +532,6 @@ public: void loadTravelText(); void loadTempText(const char *fileName); 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 sortOutMap(); void loadRoomData(const Room &room, bool skipDat); void useTempCharset(); diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 4dc099a0b9..8b69c84a1c 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -65,9 +65,9 @@ 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, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0120: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, }; + 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, }; ds.assign(src, src + sizeof(src)); dreamweb(); } diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 1ea497281c..d283cd1c35 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -253,26 +253,24 @@ 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 kBlinkframe = 292; -static const uint16 kBlinkcount = 293; -static const uint16 kReasseschanges = 294; -static const uint16 kPointerspath = 295; -static const uint16 kManspath = 296; -static const uint16 kPointerfirstpath = 297; -static const uint16 kFinaldest = 298; -static const uint16 kDestination = 299; -static const uint16 kLinestartx = 300; -static const uint16 kLinestarty = 302; -static const uint16 kLineendx = 304; -static const uint16 kLineendy = 306; -static const uint16 kLinepointer = 308; -static const uint16 kLinedirection = 309; -static const uint16 kLinelength = 310; -static const uint16 kCh0playing = 311; -static const uint16 kCh0repeat = 312; -static const uint16 kCh1playing = 313; +static const uint16 kBlinkframe = 288; +static const uint16 kBlinkcount = 289; +static const uint16 kReasseschanges = 290; +static const uint16 kPointerspath = 291; +static const uint16 kManspath = 292; +static const uint16 kPointerfirstpath = 293; +static const uint16 kFinaldest = 294; +static const uint16 kDestination = 295; +static const uint16 kLinestartx = 296; +static const uint16 kLinestarty = 298; +static const uint16 kLineendx = 300; +static const uint16 kLineendy = 302; +static const uint16 kLinepointer = 304; +static const uint16 kLinedirection = 305; +static const uint16 kLinelength = 306; +static const uint16 kCh0playing = 307; +static const uint16 kCh0repeat = 308; +static const uint16 kCh1playing = 309; static const uint16 kBlocktextdat = (0); static const uint16 kPersonframes = (0); static const uint16 kDebuglevel1 = (0); diff --git a/engines/dreamweb/sprite.cpp b/engines/dreamweb/sprite.cpp index cc48ca13b2..d1b7934a2e 100644 --- a/engines/dreamweb/sprite.cpp +++ b/engines/dreamweb/sprite.cpp @@ -82,6 +82,7 @@ Sprite *DreamBase::makeSprite(uint8 x, uint8 y, uint16 updateCallback, const Gra sprite->w2 = 0xffff; sprite->frameNumber = 0; sprite->delay = 0; + sprite->_objData = 0; return sprite; } @@ -225,7 +226,7 @@ void DreamBase::aboutTurn(Sprite *sprite) { } void DreamBase::backObject(Sprite *sprite) { - SetObject *objData = (SetObject *)getSegment(data.word(kSetdat)).ptr(sprite->_objData, 0); + SetObject *objData = sprite->_objData; if (sprite->delay != 0) { --sprite->delay; diff --git a/engines/dreamweb/structs.h b/engines/dreamweb/structs.h index 0b7a81b6eb..db1e51fafc 100644 --- a/engines/dreamweb/structs.h +++ b/engines/dreamweb/structs.h @@ -29,6 +29,7 @@ namespace DreamGen { struct GraphicsFile; +struct SetObject; struct Sprite { uint16 _updateCallback; @@ -45,7 +46,7 @@ struct Sprite { uint8 b17; uint8 delay; uint8 animFrame; // index into SetObject::frames - uint16 _objData; + SetObject *_objData; uint8 speed; uint8 priority; uint16 w24; diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 0137fd2f85..f62e651b1b 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -1016,7 +1016,7 @@ void DreamBase::eraseOldObs() { Common::List<Sprite>::iterator i; for (i = _spriteTable.begin(); i != _spriteTable.end(); ) { Sprite &sprite = *i; - if (sprite._objData != 0xffff) + if (sprite._objData) i = _spriteTable.erase(i); else ++i; @@ -1056,13 +1056,6 @@ void DreamBase::clearAndLoad(uint8 *buf, uint8 c, engine->readFromFile(buf, size); } -void DreamBase::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 DreamBase::startLoading(const Room &room) { data.byte(kCombatcount) = 0; _roomsSample = room.roomsSample; @@ -1303,7 +1296,7 @@ void DreamBase::setAllChanges() { } DynObject *DreamBase::getFreeAd(uint8 index) { - return (DynObject *)getSegment(data.word(kFreedat)).ptr(0, 0) + index; + return &_freeDat[index]; } DynObject *DreamBase::getExAd(uint8 index) { @@ -1350,7 +1343,7 @@ void *DreamBase::getAnyAdDir(uint8 index, uint8 flag) { } SetObject *DreamBase::getSetAd(uint8 index) { - return (SetObject *)getSegment(data.word(kSetdat)).ptr(0, 0) + index; + return &_setDat[index]; } void DreamBase::doChange(uint8 index, uint8 value, uint8 type) { @@ -1366,13 +1359,11 @@ void DreamBase::doChange(uint8 index, uint8 value, uint8 type) { } void DreamBase::deleteTaken() { - 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; + uint8 location = _exData[i].initialLocation; if (location == data.byte(kReallocation)) { - uint8 index = extraObjects[i].index; - freeObjects[index].mapad[0] = 0xfe; + uint8 index = _exData[i].index; + _freeDat[index].mapad[0] = 0xfe; } } } @@ -2191,7 +2182,7 @@ void DreamBase::loadRoomData(const Room &room, bool skipDat) { loadGraphicsSegment(_setFrames, len[2]); if (!skipDat) - clearAndLoad(data.word(kSetdat), 255, len[3], kSetdatlen); + clearAndLoad((uint8 *)_setDat, 255, len[3], kSetdatlen); else engine->skipBytes(len[3]); // NB: The skipDat version of this function as called by restoreall @@ -2218,7 +2209,7 @@ void DreamBase::loadRoomData(const Room &room, bool skipDat) { loadTextSegment(_roomDesc, len[11]); loadGraphicsSegment(_freeFrames, len[12]); if (!skipDat) - clearAndLoad(data.word(kFreedat), 255, len[13], kFreedatlen); + clearAndLoad((uint8 *)_freeDat, 255, len[13], kFreedatlen); else engine->skipBytes(len[13]); loadTextSegment(_freeDesc, len[14]); @@ -2484,9 +2475,6 @@ void DreamBase::allocateBuffers() { _exFrames._data = new uint8[kExframeslen]; _exText.clear(); _exText._text = new char[kExtextlen]; - - data.word(kFreedat) = allocateMem(kFreedatlen/16); - data.word(kSetdat) = allocateMem(kSetdatlen/16); } void DreamBase::workToScreenM() { |