diff options
author | Willem Jan Palenstijn | 2011-12-03 14:54:00 +0100 |
---|---|---|
committer | Willem Jan Palenstijn | 2011-12-03 14:55:54 +0100 |
commit | 908ba272f8c14ed4ab018f2dd834c17a3a4b0599 (patch) | |
tree | 218e0a048820369a0ab847e2544ac2cb97d942cc | |
parent | ab2e5015afe136ce4ef37edbba0faa58c8a9cc61 (diff) | |
download | scummvm-rg350-908ba272f8c14ed4ab018f2dd834c17a3a4b0599.tar.gz scummvm-rg350-908ba272f8c14ed4ab018f2dd834c17a3a4b0599.tar.bz2 scummvm-rg350-908ba272f8c14ed4ab018f2dd834c17a3a4b0599.zip |
DREAMWEB: Move roomData out of opaque data segment
-rw-r--r-- | engines/dreamweb/saveload.cpp | 4 | ||||
-rw-r--r-- | engines/dreamweb/structs.h | 1 | ||||
-rw-r--r-- | engines/dreamweb/stubs.cpp | 332 | ||||
-rw-r--r-- | engines/dreamweb/stubs.h | 6 |
4 files changed, 304 insertions, 39 deletions
diff --git a/engines/dreamweb/saveload.cpp b/engines/dreamweb/saveload.cpp index 17c05cd5c3..5cff4533d6 100644 --- a/engines/dreamweb/saveload.cpp +++ b/engines/dreamweb/saveload.cpp @@ -112,8 +112,8 @@ void DreamGenContext::doLoad() { dx = data; es = dx; - const Room *room = (Room *)cs.ptr(kMadeuproomdat, sizeof(Room)); - startLoading(room); + const Room *room = (const Room *)cs.ptr(kMadeuproomdat, sizeof(Room)); + startLoading(*room); loadRoomsSample(); data.byte(kRoomloaded) = 1; data.byte(kNewlocation) = 255; diff --git a/engines/dreamweb/structs.h b/engines/dreamweb/structs.h index 62f4be6a5c..2440d182be 100644 --- a/engines/dreamweb/structs.h +++ b/engines/dreamweb/structs.h @@ -208,6 +208,7 @@ struct Room { uint8 b30; uint8 realLocation; }; +extern const Room g_RoomData[]; struct Rain { uint8 x; diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index bfd766c0e8..edb8887a2d 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -26,6 +26,278 @@ namespace DreamGen { +const Room g_roomData[] = { + { "DREAMWEB.R00", // Ryan's apartment + 5,255,33,10, + 255,255,255,0, + 1,6,2,255,3,255,255,255,255,255,0 }, + + { "DREAMWEB.R01", + 1,255,44,10, + 255,255,255,0, + 7,2,255,255,255,255,6,255,255,255,1 }, + + { "DREAMWEB.R02", + 2,255,33,0, + 255,255,255,0, + 1,0,255,255,1,255,3,255,255,255,2 }, + + { "DREAMWEB.R03", + 5,255,33,10, + 255,255,255,0, + 2,2,0,2,4,255,0,255,255,255,3 }, + + { "DREAMWEB.R04", + 23,255,11,30, + 255,255,255,0, + 1,4,0,5,255,255,3,255,255,255,4 }, + + { "DREAMWEB.R05", + 5,255,22,30, // if demo: 22,255,22,30, + 255,255,255,0, + 1,2,0,4,255,255,3,255,255,255,5 }, + + { "DREAMWEB.R06", + 5,255,11,30, + 255,255,255,0, + 1,0,0,1,2,255,0,255,255,255,6 }, + + { "DREAMWEB.R07", + 255,255,0,20, + 255,255,255,0, + 2,2,255,255,255,255,0,255,255,255,7 }, + + { "DREAMWEB.R08", + 8,255,0,10, + 255,255,255,0, + 1,2,255,255,255,255,0,11,40,0,8 }, + + { "DREAMWEB.R09", + 9,255,22,10, + 255,255,255,0, + 4,6,255,255,255,255,0,255,255,255,9 }, + + { "DREAMWEB.R10", + 10,255,33,30, + 255,255,255,0, + 2,0,255,255,2,2,4,22,30,255,10 }, // 22,30,0 switches + // off path 0 in skip + { "DREAMWEB.R11", + 11,255,11,20, + 255,255,255,0, + 0,4,255,255,255,255,255,255,255,255,11 }, + + { "DREAMWEB.R12", + 12,255,22,20, + 255,255,255,0, + 1,4,255,255,255,255,255,255,255,255,12 }, + + { "DREAMWEB.R13", + 12,255,22,20, + 255,255,255,0, + 1,4,255,255,255,255,255,255,255,255,13 }, + + { "DREAMWEB.R14", + 14,255,44,20, + 255,255,255,0, + 0,6,255,255,255,255,255,255,255,255,14 }, + + { "", 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }, + { "", 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }, + { "", 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }, + { "", 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }, + + { "DREAMWEB.R19", + 19,255,0,0, + 255,255,255,0, + 0,4,255,255,255,255,255,255,255,255,19 }, + + { "DREAMWEB.R20", + 22,255,0,20, + 255,255,255,0, + 1,4,2,15,255,255,255,255,255,255,20 }, + + { "DREAMWEB.R21", + 5,255,11,10, // if demo: 22,255,11,10, + 255,255,255,0, + 1,4,2,15,1,255,255,255,255,255,21 }, + + { "DREAMWEB.R22", + 22,255,22,10, + 255,255,255,0, + 0,4,255,255,1,255,255,255,255,255,22 }, + + { "DREAMWEB.R23", + 23,255,22,30, + 255,255,255,0, + 1,4,2,15,3,255,255,255,255,255,23 }, + + { "DREAMWEB.R24", + 5,255,44,0, + 255,255,255,0, + 1,6,2,15,255,255,255,255,255,255,24 }, + + { "DREAMWEB.R25", + 22,255,11,40, + 255,255,255,0, + 1,0,255,255,255,255,255,255,255,255,25 }, + + { "DREAMWEB.R26", + 9,255,22,20, + 255,255,255,0, + 4,2,255,255,255,255,255,255,255,255,26 }, + + { "DREAMWEB.R27", + 22,255,11,20, + 255,255,255,0, + 0,6,255,255,255,255,255,255,255,255,27 }, + + { "DREAMWEB.R28", + 5,255,11,30, + 255,255,255,0, + 0,0,255,255,2,255,255,255,255,255,28 }, + + { "DREAMWEB.R29", + 22,255,11,10, + 255,255,255,0, + 0,2,255,255,255,255,255,255,255,255,29 }, + + + + { "DREAMWEB.R05", // Duplicate of hotel lobby, but emerging from the lift. + 5,255,22,10, // if demo: 22,255,22,10 + 255,255,255,0, + 1,4,1,15,255,255,255,255,255,255,5 }, + + { "DREAMWEB.R04", // Duplicate of pool hall lobby, + 23,255,22,20, // but emerging from the lift. + 255,255,255,0, + 1,4,2,15,255,255,255,255,255,255,4 }, + + { "DREAMWEB.R10", // entering alley via skip + 10,255,22,30, + 255,255,255,0, + 3,6,255,255,255,255,255,255,255,255,10 }, + + { "DREAMWEB.R12", // on the beach, getting up. + 12,255,22,20, + 255,255,255,0, + 0,2,255,255,255,255,255,255,255,255,12 }, + + { "DREAMWEB.R03", // Duplicate of Eden's lobby + 5,255,44,0, // but emerging from the lift + 255,255,255,0, + 1,6,2,255,4,255,255,255,255,255,3 }, + + { "DREAMWEB.R24", // Duplicate of Eden's flat + 5,255,22,0, // but starting on the bed + 255,255,255,0, + 3,6,0,255,255,255,255,33,0,3,24 }, // 33,0,3 turns off path for lift + + { "DREAMWEB.R22", // Duplicate + 22,255,22,20, // of hotel but in pool room + 255,255,255,0, + 1,4,255,255,255,255,255,255,255,255,22 }, + + { "DREAMWEB.R22", // Duplicate + 22,255,22,20, // of hotel but in pool room + 255,255,255,0, // coming out of bedroom + 0,2,255,255,255,255,255,255,255,255,22 }, + + { "DREAMWEB.R11", // Duplicate + 11,255,22,30, // of carpark but getting + 255,255,255,0, // up off the floor + 0,0,255,255,255,255,255,255,255,255,11 }, + + { "DREAMWEB.R28", + 5,255,11,20, + 255,255,255,0, + 0,6,255,255,2,255,255,255,255,255,28 }, + + { "DREAMWEB.R21", + 5,255,11,10, // if demo: 22,255,11,10 + 255,255,255,0, + 1,4,2,15,1,255,255,255,255,255,21 }, + + { "DREAMWEB.R26", + 9,255,0,40, + 255,255,255,0, + 0,0,255,255,255,255,255,255,255,255,26 }, + + { "DREAMWEB.R19", + 19,255,0,0, + 255,255,255,0, + 2,2,255,255,255,255,255,255,255,255,19 }, + + { "DREAMWEB.R08", // leaving tvstudio into street + 8,255,11,40, + 255,255,255,0, + 0,4,255,255,255,255,255,255,255,255,8 }, + + { "DREAMWEB.R01", + 1,255,44,10, + 255,255,255,0, + 3,6,255,255,255,255,255,255,255,255,1 }, + + + { "DREAMWEB.R45", // Dream room + 35,255,22,30, + 255,255,255,0, + 0,6,255,255,255,255,255,255,255,255,45 }, + + { "DREAMWEB.R46", // Dream room + 35,255,22,40, + 255,255,255,0, + 0,4,255,255,255,255,255,255,255,255,46 }, + + { "DREAMWEB.R47", // Dream room + 35,255,0,0, + 255,255,255,0, + 0,0,255,255,255,255,255,255,255,255,47 }, + + { "DREAMWEB.R45", // Dream room + 35,255,22,30, + 255,255,255,0, + 4,0,255,255,255,255,255,255,255,255,45 }, + + { "DREAMWEB.R46", // Dream room + 35,255,22,50, + 255,255,255,0, + 0,4,255,255,255,255,255,255,255,255,46 }, + + + + { "DREAMWEB.R50", // Intro sequence one + 35,255,22,30, + 255,255,255,0, + 0,0,255,255,255,255,255,255,255,255,50 }, + + { "DREAMWEB.R51", // Intro sequence two + 35,255,11,30, + 255,255,255,0, + 0,0,255,255,255,255,255,255,255,255,51 }, + + { "DREAMWEB.R52", // Intro sequence three + 35,255,22,30, + 255,255,255,0, + 0,0,255,255,255,255,255,255,255,255,52 }, + + { "DREAMWEB.R53", // Intro sequence four + 35,255,33,0, + 255,255,255,0, + 0,0,255,255,255,255,255,255,255,255,53 }, + + { "DREAMWEB.R54", // Intro sequence five - wasteland + 35,255,0,0, + 255,255,255,0, + 0,0,255,255,255,255,255,255,255,255,54 }, + + { "DREAMWEB.R55", // End sequence + 14,255,44,0, + 255,255,255,0, + 0,0,255,255,255,255,255,255,255,255,55 } +}; + void DreamGenContext::dreamweb() { STACK_CHECK; @@ -815,15 +1087,6 @@ void DreamGenContext::makeBackOb(SetObject *objData) { sprite->animFrame = 0; } -void DreamGenContext::getRoomData() { - Room *room = getRoomData(al); - bx = (uint8 *)room - cs.ptr(0, 0); -} - -Room *DreamGenContext::getRoomData(uint8 room) { - return (Room *)cs.ptr(kRoomdata, 0) + room; -} - void DreamGenContext::readHeader() { ax = engine->readFromFile(cs.ptr(kFileheader, kHeaderlen), kHeaderlen); es = cs; @@ -845,23 +1108,23 @@ void DreamGenContext::clearAndLoad(uint16 seg, uint8 c, engine->readFromFile(buf, size); } -void DreamGenContext::startLoading(const Room *room) { +void DreamGenContext::startLoading(const Room &room) { data.byte(kCombatcount) = 0; - data.byte(kRoomssample) = room->roomsSample; - data.byte(kMapx) = room->mapX; - data.byte(kMapy) = room->mapY; - data.byte(kLiftflag) = room->liftFlag; - data.byte(kManspath) = room->b21; - data.byte(kDestination) = room->b21; - data.byte(kFinaldest) = room->b21; - data.byte(kFacing) = room->facing; - data.byte(kTurntoface) = room->facing; - data.byte(kCounttoopen) = room->countToOpen; - data.byte(kLiftpath) = room->liftPath; - data.byte(kDoorpath) = room->doorPath; + data.byte(kRoomssample) = room.roomsSample; + data.byte(kMapx) = room.mapX; + data.byte(kMapy) = room.mapY; + data.byte(kLiftflag) = room.liftFlag; + data.byte(kManspath) = room.b21; + data.byte(kDestination) = room.b21; + data.byte(kFinaldest) = room.b21; + data.byte(kFacing) = room.facing; + data.byte(kTurntoface) = room.facing; + data.byte(kCounttoopen) = room.countToOpen; + data.byte(kLiftpath) = room.liftPath; + data.byte(kDoorpath) = room.doorPath; data.byte(kLastweapon) = (uint8)-1; ah = data.byte(kReallocation); - data.byte(kReallocation) = room->realLocation; + data.byte(kReallocation) = room.realLocation; loadRoomData(room, false); @@ -869,15 +1132,18 @@ void DreamGenContext::startLoading(const Room *room) { deleteTaken(); setAllChanges(); autoAppear(); - Room *newRoom = getRoomData(data.byte(kNewlocation)); - bx = (uint8 *)newRoom - cs.ptr(0, 0); +// const Room &newRoom = g_roomData[data.byte(kNewlocation)]; + bx = 0x7fff; // TODO: bx used to be set to the offset of newRoom + // It seems to be unused (like newRoom itself), but set it + // to an invalid value to catch any missed use of it. + // (The push/pop of bx below is likely also unnecessary) data.byte(kLastweapon) = (uint8)-1; data.byte(kMandead) = 0; data.word(kLookcounter) = 160; data.byte(kNewlocation) = 255; data.byte(kLinepointer) = 254; - if (room->b27 != 255) { - data.byte(kManspath) = room->b27; + if (room.b27 != 255) { + data.byte(kManspath) = room.b27; push(bx); autoSetWalk(); bx = pop(); @@ -1991,7 +2257,7 @@ void DreamGenContext::loadRoom() { data.word(kTextaddressy) = 182; data.byte(kTextlen) = 240; data.byte(kLocation) = data.byte(kNewlocation); - Room *room = getRoomData(data.byte(kNewlocation)); + const Room &room = g_roomData[data.byte(kNewlocation)]; startLoading(room); loadRoomsSample(); switchRyanOn(); @@ -2160,8 +2426,8 @@ void DreamGenContext::useTempCharset() { } // if skipDat, skip clearing and loading Setdat and Freedat -void DreamGenContext::loadRoomData(const Room* room, bool skipDat) { - engine->openFile(room->name); +void DreamGenContext::loadRoomData(const Room &room, bool skipDat) { + engine->openFile(room.name); cs.word(kHandle) = 1; //only one handle flags._c = false; readHeader(); @@ -2201,7 +2467,7 @@ void DreamGenContext::loadRoomData(const Room* room, bool skipDat) { } void DreamGenContext::restoreAll() { - const Room *room = getRoomData(data.byte(kLocation)); + const Room &room = g_roomData[data.byte(kLocation)]; loadRoomData(room, true); setAllChanges(); } @@ -2210,9 +2476,9 @@ void DreamGenContext::restoreReels() { if (data.byte(kRoomloaded) == 0) return; - const Room *room = getRoomData(data.byte(kReallocation)); + const Room &room = g_roomData[data.byte(kReallocation)]; - engine->openFile(room->name); + engine->openFile(room.name); cs.word(kHandle) = 1; //only one handle flags._c = false; readHeader(); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index d12f398ba5..694313889f 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -91,11 +91,9 @@ void oldToNames(); void namesToOld(); void loadPalFromIFF(); - void getRoomData(); - Room *getRoomData(uint8 room); void readHeader(); void fillSpace(); - void startLoading(const Room *room); + void startLoading(const Room &room); Sprite *spriteTable(); void showFrame(); void showFrame(const Frame *frameData, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag, uint8 *width, uint8 *height); @@ -351,7 +349,7 @@ void openForLoad(unsigned int slot); uint16 allocateAndLoad(unsigned int size); void clearAndLoad(uint16 seg, uint8 c, unsigned int size, unsigned int maxSize); - void loadRoomData(const Room* room, bool skipDat); + void loadRoomData(const Room &room, bool skipDat); void restoreAll(); void restoreReels(); void viewFolder(); |