diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/dreamweb/backdrop.cpp | 131 | ||||
-rw-r--r-- | engines/dreamweb/dreambase.h | 10 | ||||
-rw-r--r-- | engines/dreamweb/dreamgen.cpp | 70 | ||||
-rw-r--r-- | engines/dreamweb/dreamgen.h | 409 | ||||
-rw-r--r-- | engines/dreamweb/people.cpp | 16 | ||||
-rw-r--r-- | engines/dreamweb/structs.h | 10 | ||||
-rw-r--r-- | engines/dreamweb/stubs.cpp | 14 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_logic.cpp | 5 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_scenes0.cpp | 358 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_scenes0.h | 36 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_scenes3.cpp | 167 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_scenes3.h | 30 | ||||
-rw-r--r-- | engines/tsage/staticres.cpp | 20 | ||||
-rw-r--r-- | engines/tsage/staticres.h | 14 |
14 files changed, 933 insertions, 357 deletions
diff --git a/engines/dreamweb/backdrop.cpp b/engines/dreamweb/backdrop.cpp index 38ccb0296c..cb72454a41 100644 --- a/engines/dreamweb/backdrop.cpp +++ b/engines/dreamweb/backdrop.cpp @@ -89,41 +89,34 @@ uint8 DreamBase::getYAd(const uint8 *setData, uint8 *result) { return 1; } -uint8 DreamBase::getMapAd(const uint8 *setData) { +uint8 DreamBase::getMapAd(const uint8 *setData, uint16 *x, uint16 *y) { uint8 xad, yad; if (getXAd(setData, &xad) == 0) return 0; - data.word(kObjectx) = xad; + *x = xad; if (getYAd(setData, &yad) == 0) return 0; - data.word(kObjecty) = yad; + *y = yad; return 1; } -void DreamBase::calcFrFrame(uint16 frameNum, uint8* width, uint8* height) { - const Frame *frame = (const Frame *)getSegment(data.word(kFrsegment)).ptr(frameNum * sizeof(Frame), sizeof(Frame)); - data.word(kSavesource) = data.word(kFramesad) + frame->ptr(); - data.byte(kSavesize+0) = frame->width; - data.byte(kSavesize+1) = frame->height; - data.word(kOffsetx) = frame->x; - data.word(kOffsety) = frame->y; +void DreamBase::calcFrFrame(const Frame *frameBase, uint16 frameNum, uint8 *width, uint8 *height, uint16 x, uint16 y, ObjPos *objPos) { + const Frame *frame = frameBase + frameNum; *width = frame->width; *height = frame->height; -} -void DreamBase::finalFrame(uint16 *x, uint16 *y) { - data.byte(kSavex) = (data.word(kObjectx) + data.word(kOffsetx)) & 0xff; - data.byte(kSavey) = (data.word(kObjecty) + data.word(kOffsety)) & 0xff; - *x = data.word(kObjectx); - *y = data.word(kObjecty); + objPos->xMin = (x + frame->x) & 0xff; + objPos->yMin = (y + frame->y) & 0xff; + objPos->xMax = objPos->xMin + frame->width; + objPos->yMax = objPos->yMin + frame->height; } -void DreamBase::makeBackOb(SetObject *objData) { +void DreamBase::makeBackOb(SetObject *objData, uint16 x, uint16 y) { if (data.byte(kNewobs) == 0) return; uint8 priority = objData->priority; uint8 type = objData->type; - Sprite *sprite = makeSprite(data.word(kObjectx), data.word(kObjecty), addr_backobject, data.word(kSetframes), 0); + Sprite *sprite = makeSprite(x, y, addr_backobject, data.word(kSetframes), 0); uint16 objDataOffset = (uint8 *)objData - getSegment(data.word(kSetdat)).ptr(0, 0); assert(objDataOffset % sizeof(SetObject) == 0); @@ -139,40 +132,33 @@ void DreamBase::makeBackOb(SetObject *objData) { } void DreamBase::showAllObs() { - data.word(kListpos) = kSetlist; - memset(getSegment(data.word(kBuffers)).ptr(kSetlist, 0), 0xff, 128 * 5); - data.word(kFrsegment) = data.word(kSetframes); - data.word(kDataad) = kFramedata; - data.word(kFramesad) = kFrames; - - const Frame *frames = (const Frame *)getSegment(data.word(kFrsegment)).ptr(0, 0); - SetObject *setEntries = (SetObject *)getSegment(data.word(kSetdat)).ptr(0, 128 * sizeof(SetObject)); - for (size_t i = 0; i < 128; ++i) { + const unsigned int count = 128; + + ObjPos *objPos = (ObjPos *)getSegment(data.word(kBuffers)).ptr(kSetlist, count * sizeof(ObjPos)); + memset(objPos, 0xff, count * sizeof(ObjPos)); + + const Frame *frameBase = (const Frame *)getSegment(data.word(kSetframes)).ptr(0, 0); + SetObject *setEntries = (SetObject *)getSegment(data.word(kSetdat)).ptr(0, count * sizeof(SetObject)); + for (size_t i = 0; i < count; ++i) { SetObject *setEntry = setEntries + i; - if (getMapAd(setEntry->mapad) == 0) + uint16 x, y; + if (getMapAd(setEntry->mapad, &x, &y) == 0) continue; uint8 currentFrame = setEntry->frames[0]; if (currentFrame == 0xff) continue; uint8 width, height; - calcFrFrame(currentFrame, &width, &height); - uint16 x, y; - finalFrame(&x, &y); + calcFrFrame(frameBase, currentFrame, &width, &height, x, y, objPos); setEntry->index = setEntry->frames[0]; if ((setEntry->type == 0) && (setEntry->priority != 5) && (setEntry->priority != 6)) { x += data.word(kMapadx); y += data.word(kMapady); - showFrame(frames, x, y, currentFrame, 0); + showFrame(frameBase, x, y, currentFrame, 0); } else - makeBackOb(setEntry); + makeBackOb(setEntry, x, y); - ObjPos *objPos = (ObjPos *)getSegment(data.word(kBuffers)).ptr(data.word(kListpos), sizeof(ObjPos)); - objPos->xMin = data.byte(kSavex); - objPos->yMin = data.byte(kSavey); - objPos->xMax = data.byte(kSavex) + data.byte(kSavesize+0); - objPos->yMax = data.byte(kSavey) + data.byte(kSavesize+1); objPos->index = i; - data.word(kListpos) += sizeof(ObjPos); + ++objPos; } } @@ -230,39 +216,29 @@ void DreamBase::calcMapAd() { } void DreamBase::showAllFree() { - data.word(kListpos) = kFreelist; - ObjPos *listPos = (ObjPos *)getSegment(data.word(kBuffers)).ptr(kFreelist, 80 * sizeof(ObjPos)); - memset(listPos, 0xff, 80 * sizeof(ObjPos)); - - data.word(kFrsegment) = data.word(kFreeframes); - data.word(kDataad) = kFrframedata; - data.word(kFramesad) = kFrframes; - data.byte(kCurrentfree) = 0; + const unsigned int count = 80; + + ObjPos *objPos = (ObjPos *)getSegment(data.word(kBuffers)).ptr(kFreelist, count * sizeof(ObjPos)); + memset(objPos, 0xff, count * sizeof(ObjPos)); + const DynObject *freeObjects = (const DynObject *)getSegment(data.word(kFreedat)).ptr(0, 0); - for (size_t i = 0; i < 80; ++i) { - uint8 mapAd = getMapAd(freeObjects[i].mapad); + const Frame *frameBase = (const Frame *)getSegment(data.word(kFreeframes)).ptr(0, 0); + for (size_t i = 0; i < count; ++i) { + uint16 x, y; + uint8 mapAd = getMapAd(freeObjects[i].mapad, &x, &y); if (mapAd != 0) { uint8 width, height; - uint16 currentFrame = 3 * data.byte(kCurrentfree); - calcFrFrame(currentFrame, &width, &height); - uint16 x, y; - finalFrame(&x, &y); + uint16 currentFrame = 3 * i; + calcFrFrame(frameBase, currentFrame, &width, &height, x, y, objPos); if ((width != 0) || (height != 0)) { x += data.word(kMapadx); y += data.word(kMapady); assert(currentFrame < 256); - showFrame((Frame *)getSegment(data.word(kFrsegment)).ptr(0, 0), x, y, currentFrame, 0); - ObjPos *objPos = (ObjPos *)getSegment(data.word(kBuffers)).ptr(data.word(kListpos), sizeof(ObjPos)); - objPos->xMin = data.byte(kSavex); - objPos->yMin = data.byte(kSavey); - objPos->xMax = data.byte(kSavex) + data.byte(kSavesize+0); - objPos->yMax = data.byte(kSavey) + data.byte(kSavesize+1); + showFrame(frameBase, x, y, currentFrame, 0); objPos->index = i; - data.word(kListpos) += sizeof(ObjPos); + ++objPos; } } - - ++data.byte(kCurrentfree); } } @@ -283,37 +259,30 @@ void DreamBase::drawFlags() { } void DreamBase::showAllEx() { - data.word(kListpos) = kExlist; - memset(getSegment(data.word(kBuffers)).ptr(kExlist, 100 * 5), 0xff, 100 * 5); + const unsigned int count = 100; + + ObjPos *objPos = (ObjPos *)getSegment(data.word(kBuffers)).ptr(kExlist, count * sizeof(ObjPos)); + memset(objPos, 0xff, count * sizeof(ObjPos)); - data.word(kFrsegment) = data.word(kExtras); - data.word(kDataad) = kExframedata; - data.word(kFramesad) = kExframes; - data.byte(kCurrentex) = 0; DynObject *objects = (DynObject *)getSegment(data.word(kExtras)).ptr(kExdata, sizeof(DynObject)); - for (size_t i = 0; i < 100; ++i, ++data.byte(kCurrentex)) { + const Frame *frameBase = (const Frame *)getSegment(data.word(kExtras)).ptr(0, 0); + for (size_t i = 0; i < count; ++i) { DynObject *object = objects + i; if (object->mapad[0] == 0xff) continue; if (object->currentLocation != data.byte(kReallocation)) continue; - if (getMapAd(object->mapad) == 0) + uint16 x, y; + if (getMapAd(object->mapad, &x, &y) == 0) continue; uint8 width, height; - uint16 currentFrame = 3 * data.byte(kCurrentex); - calcFrFrame(currentFrame, &width, &height); - uint16 x, y; - finalFrame(&x, &y); + uint16 currentFrame = 3 * i; + calcFrFrame(frameBase, currentFrame, &width, &height, x, y, objPos); if ((width != 0) || (height != 0)) { assert(currentFrame < 256); - showFrame((Frame *)getSegment(data.word(kFrsegment)).ptr(0, 0), x + data.word(kMapadx), y + data.word(kMapady), currentFrame, 0); - ObjPos *objPos = (ObjPos *)getSegment(data.word(kBuffers)).ptr(data.word(kListpos), sizeof(ObjPos)); - objPos->xMin = data.byte(kSavex); - objPos->yMin = data.byte(kSavey); - objPos->xMax = data.byte(kSavesize + 0) + data.byte(kSavex); - objPos->yMax = data.byte(kSavesize + 1) + data.byte(kSavey); + showFrame(frameBase, x + data.word(kMapadx), y + data.word(kMapady), currentFrame, 0); objPos->index = i; - data.word(kListpos) += sizeof(ObjPos); + ++objPos; } } } diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 561237ac6e..e20ee83bac 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -24,6 +24,7 @@ #define DREAMBASE_H #include "common/scummsys.h" +#include "common/list.h" #include "dreamweb/segment.h" @@ -65,6 +66,8 @@ protected: // from people.cpp ReelRoutine _reelRoutines[kNumReelRoutines+1]; + Common::List<People> _peopleList; + ReelRoutine *_personData; public: DreamBase(DreamWeb::DreamWebEngine *en); @@ -74,10 +77,9 @@ public: void doBlocks(); uint8 getXAd(const uint8 *setData, uint8 *result); uint8 getYAd(const uint8 *setData, uint8 *result); - uint8 getMapAd(const uint8 *setData); - void calcFrFrame(uint16 frame, uint8* width, uint8* height); - void finalFrame(uint16 *x, uint16 *y); - void makeBackOb(SetObject *objData); + uint8 getMapAd(const uint8 *setData, uint16 *x, uint16 *y); + void calcFrFrame(const Frame *frameBase, uint16 frameNum, uint8* width, uint8* height, uint16 x, uint16 y, ObjPos *objPos); + void makeBackOb(SetObject *objData, uint16 x, uint16 y); void showAllObs(); bool addAlong(const uint8 *mapFlags); bool addLength(const uint8 *mapFlags); diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index e23a0a7983..265b215af6 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -1448,14 +1448,14 @@ void DreamGenContext::getDestInfo() { push(ax); dx = data; es = dx; - si = 555; + si = 537; _add(si, ax); cl = es.byte(si); ax = pop(); push(cx); dx = data; es = dx; - si = 571; + si = 553; _add(si, ax); ax = pop(); } @@ -1476,7 +1476,7 @@ dirroot: si = offset_rootdir; _inc(si); es = cs; - di = 480; + di = 462; _inc(di); cx = 12; _movsb(cx, true); @@ -1521,7 +1521,7 @@ void DreamGenContext::read() { return; okcom: es = cs; - di = 480; + di = 462; ax = data.word(kTextfile1); data.word(kMonsource) = ax; ds = ax; @@ -1651,7 +1651,7 @@ keyok2: ds = cs; si = offset_operand1+1; es = cs; - di = 480+1; + di = 462+1; cx = 12; _movsb(cx, true); monitorLogo(); @@ -1733,7 +1733,7 @@ void DreamGenContext::parser() { al = '='; _stosb(); ds = cs; - si = 589; + si = 571; notspace1: _lodsw(); _cmp(al, 32); @@ -1870,14 +1870,14 @@ void DreamGenContext::__start() { //0x0080: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0090: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00a0: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00b0: .... .... .... .... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x00, + //0x00c0: .... .... ... ... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x00c0: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x00, - //0x00d0: .... .... .... . . + //0x00d0: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00e0: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -1892,37 +1892,37 @@ void DreamGenContext::__start() { //0x0130: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0140: .... .... .... .... - 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, 0xff, 0xff, //0x0150: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //0x0160: .... .... .... .... 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //0x0170: .... .... .... .... - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0180: .... .... .... .... - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, //0x0190: .... .... .... .... + 0x00, 0x00, 0x00, 0xff, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x56, 0x39, + //0x01a0: .... .DRE AMWE B.V9 + 0x39, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, + //0x01b0: 9. . + 0x22, 0x52, 0x4f, 0x4f, 0x54, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x22, 0x20, + //0x01c0: "ROO T ." + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x0d, 0x0a, 0x0d, 0x0a, + //0x01d0: . .... + 0x24, 0x10, 0x12, 0x12, 0x11, 0x10, 0x10, 0x10, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + //0x01e0: $... .... .... .... + 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x44, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x00, + //0x01f0: .... .... .D:. .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x01a0: .... .... .... .... - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, - //0x01b0: .... ...D REAM WEB. - 0x56, 0x39, 0x39, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - //0x01c0: V99. - 0x20, 0x00, 0x22, 0x52, 0x4f, 0x4f, 0x54, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, - //0x01d0: ."R OOT . - 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x0d, 0x0a, - //0x01e0: " ... - 0x0d, 0x0a, 0x24, 0x10, 0x12, 0x12, 0x11, 0x10, 0x10, 0x10, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - //0x01f0: ..$. .... .... .... - 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x44, 0x3a, 0x00, 0x00, 0x00, - //0x0200: .... .... ...D :... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + //0x0200: .... .... .... .... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, //0x0210: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x02, 0x04, 0x01, 0x0a, //0x0220: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x02, 0x04, + 0x09, 0x08, 0x06, 0x0b, 0x04, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0230: .... .... .... .... - 0x01, 0x0a, 0x09, 0x08, 0x06, 0x0b, 0x04, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0240: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0250: .... .... .... .... @@ -1936,11 +1936,9 @@ void DreamGenContext::__start() { //0x0290: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x02a0: .... .... .... .... - 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, 0xff, 0xff, 0xff, 0xff, //0x02b0: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, - //0x02c0: .... .... .... .... - 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, }; + 0xff, 0x00, 0x00, 0x00, }; ds.assign(src, src + sizeof(src)); dreamweb(); } diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index de710a20d1..f836b58577 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -32,8 +32,8 @@ namespace DreamGen { -static const uint16 offset_operand1 = 0x01c4; -static const uint16 offset_rootdir = 0x01d2; +static const uint16 offset_operand1 = 0x01b2; +static const uint16 offset_rootdir = 0x01c0; static const uint16 kStartvars = 0; static const uint16 kProgresspoints = 1; static const uint16 kWatchon = 2; @@ -156,214 +156,203 @@ static const uint16 kNewscreen = 149; static const uint16 kRyanx = 150; static const uint16 kRyany = 151; static const uint16 kLastflag = 152; -static const uint16 kCurrentex = 153; -static const uint16 kCurrentfree = 154; -static const uint16 kFramesad = 155; -static const uint16 kDataad = 157; -static const uint16 kFrsegment = 159; -static const uint16 kObjectx = 161; -static const uint16 kObjecty = 163; -static const uint16 kOffsetx = 165; -static const uint16 kOffsety = 167; -static const uint16 kSavesize = 169; -static const uint16 kSavesource = 171; -static const uint16 kSavex = 173; -static const uint16 kSavey = 174; -static const uint16 kCurrentob = 175; -static const uint16 kPrioritydep = 176; -static const uint16 kDestpos = 177; -static const uint16 kReallocation = 178; -static const uint16 kRoomnum = 179; -static const uint16 kNowinnewroom = 180; -static const uint16 kResetmanxy = 181; -static const uint16 kNewlocation = 182; -static const uint16 kAutolocation = 183; -static const uint16 kMustload = 184; -static const uint16 kAnswered = 185; -static const uint16 kSaidno = 186; -static const uint16 kDoorcheck1 = 187; -static const uint16 kDoorcheck2 = 188; -static const uint16 kDoorcheck3 = 189; -static const uint16 kDoorcheck4 = 190; -static const uint16 kMousex = 191; -static const uint16 kMousey = 193; -static const uint16 kMousebutton = 195; -static const uint16 kMousebutton1 = 197; -static const uint16 kMousebutton2 = 199; -static const uint16 kMousebutton3 = 201; -static const uint16 kMousebutton4 = 203; -static const uint16 kOldbutton = 205; -static const uint16 kOldx = 207; -static const uint16 kOldy = 209; -static const uint16 kLastbutton = 211; -static const uint16 kOldpointerx = 213; -static const uint16 kOldpointery = 215; -static const uint16 kDelherex = 217; -static const uint16 kDelherey = 219; -static const uint16 kPointerxs = 221; -static const uint16 kPointerys = 222; -static const uint16 kDelxs = 223; -static const uint16 kDelys = 224; -static const uint16 kPointerframe = 225; -static const uint16 kPointerpower = 226; -static const uint16 kAuxpointerframe = 227; -static const uint16 kPointermode = 228; -static const uint16 kPointerspeed = 229; -static const uint16 kPointercount = 230; -static const uint16 kInmaparea = 231; -static const uint16 kSlotdata = 232; -static const uint16 kThisslot = 233; -static const uint16 kSlotflags = 234; -static const uint16 kTalkmode = 235; -static const uint16 kTalkpos = 236; -static const uint16 kCharacter = 237; -static const uint16 kPersondata = 238; -static const uint16 kTalknum = 240; -static const uint16 kNumberinroom = 241; -static const uint16 kCurrentcel = 242; -static const uint16 kOldselection = 243; -static const uint16 kStopwalking = 244; -static const uint16 kMouseon = 245; -static const uint16 kPlayed = 246; -static const uint16 kTimer1 = 248; -static const uint16 kTimer2 = 249; -static const uint16 kTimer3 = 250; -static const uint16 kWholetimer = 251; -static const uint16 kTimer1to = 253; -static const uint16 kTimer2to = 254; -static const uint16 kTimer3to = 255; -static const uint16 kWatchdump = 256; -static const uint16 kLogonum = 257; -static const uint16 kOldlogonum = 258; -static const uint16 kNetseg = 259; -static const uint16 kNetpoint = 261; -static const uint16 kCursorstate = 263; -static const uint16 kPressed = 264; -static const uint16 kPresspointer = 265; -static const uint16 kGraphicpress = 267; -static const uint16 kPresscount = 268; -static const uint16 kLightcount = 269; -static const uint16 kFolderpage = 270; -static const uint16 kDiarypage = 271; -static const uint16 kMenucount = 272; -static const uint16 kSymboltopx = 273; -static const uint16 kSymboltopnum = 274; -static const uint16 kSymboltopdir = 275; -static const uint16 kSymbolbotx = 276; -static const uint16 kSymbolbotnum = 277; -static const uint16 kSymbolbotdir = 278; -static const uint16 kSymboltolight = 279; -static const uint16 kSymbol1 = 280; -static const uint16 kSymbol2 = 281; -static const uint16 kSymbol3 = 282; -static const uint16 kSymbolnum = 283; -static const uint16 kDumpx = 284; -static const uint16 kDumpy = 286; -static const uint16 kWalkandexam = 288; -static const uint16 kWalkexamtype = 289; -static const uint16 kWalkexamnum = 290; -static const uint16 kCurslocx = 291; -static const uint16 kCurslocy = 293; -static const uint16 kCurpos = 295; -static const uint16 kMonadx = 297; -static const uint16 kMonady = 299; -static const uint16 kMonsource = 301; -static const uint16 kNumtodo = 303; -static const uint16 kTimecount = 305; -static const uint16 kCounttotimed = 307; -static const uint16 kTimedseg = 309; -static const uint16 kTimedoffset = 311; -static const uint16 kTimedy = 313; -static const uint16 kTimedx = 314; -static const uint16 kNeedtodumptimed = 315; -static const uint16 kLoadingorsave = 316; -static const uint16 kCurrentslot = 317; -static const uint16 kCursorpos = 318; -static const uint16 kColourpos = 319; -static const uint16 kFadedirection = 320; -static const uint16 kNumtofade = 321; -static const uint16 kFadecount = 322; -static const uint16 kAddtogreen = 323; -static const uint16 kAddtored = 324; -static const uint16 kAddtoblue = 325; -static const uint16 kLastsoundreel = 326; -static const uint16 kSpeechloaded = 328; -static const uint16 kSpeechlength = 329; -static const uint16 kVolume = 331; -static const uint16 kVolumeto = 332; -static const uint16 kVolumedirection = 333; -static const uint16 kVolumecount = 334; -static const uint16 kWongame = 335; -static const uint16 kLasthardkey = 336; -static const uint16 kBufferin = 337; -static const uint16 kBufferout = 339; -static const uint16 kExtras = 341; -static const uint16 kWorkspace = 343; -static const uint16 kMapstore = 345; -static const uint16 kCharset1 = 347; -static const uint16 kBuffers = 349; -static const uint16 kMainsprites = 351; -static const uint16 kBackdrop = 353; -static const uint16 kMapdata = 355; -static const uint16 kSounddata = 357; -static const uint16 kSounddata2 = 359; -static const uint16 kRecordspace = 361; -static const uint16 kFreedat = 363; -static const uint16 kSetdat = 365; -static const uint16 kReel1 = 367; -static const uint16 kReel2 = 369; -static const uint16 kReel3 = 371; -static const uint16 kRoomdesc = 373; -static const uint16 kFreedesc = 375; -static const uint16 kSetdesc = 377; -static const uint16 kBlockdesc = 379; -static const uint16 kSetframes = 381; -static const uint16 kFreeframes = 383; -static const uint16 kPeople = 385; -static const uint16 kReels = 387; -static const uint16 kCommandtext = 389; -static const uint16 kPuzzletext = 391; -static const uint16 kTraveltext = 393; -static const uint16 kTempgraphics = 395; -static const uint16 kTempgraphics2 = 397; -static const uint16 kTempgraphics3 = 399; -static const uint16 kTempsprites = 401; -static const uint16 kTextfile1 = 403; -static const uint16 kTextfile2 = 405; -static const uint16 kTextfile3 = 407; -static const uint16 kBlinkframe = 409; -static const uint16 kBlinkcount = 410; -static const uint16 kReasseschanges = 411; -static const uint16 kPointerspath = 412; -static const uint16 kManspath = 413; -static const uint16 kPointerfirstpath = 414; -static const uint16 kFinaldest = 415; -static const uint16 kDestination = 416; -static const uint16 kLinestartx = 417; -static const uint16 kLinestarty = 419; -static const uint16 kLineendx = 421; -static const uint16 kLineendy = 423; -static const uint16 kLinepointer = 425; -static const uint16 kLinedirection = 426; -static const uint16 kLinelength = 427; -static const uint16 kCh0blockstocopy = 428; -static const uint16 kCh0playing = 430; -static const uint16 kCh0repeat = 431; -static const uint16 kCh1playing = 432; -static const uint16 kCh1blockstocopy = 433; -static const uint16 kSoundbufferwrite = 435; -static const uint16 kCurrentsample = 437; -static const uint16 kRoomssample = 438; -static const uint16 kBasicsample = 439; -static const uint16 kCurrentfile = 480; -static const uint16 kRoomscango = 555; -static const uint16 kRoompics = 571; -static const uint16 kOplist = 586; -static const uint16 kInputline = 589; -static const uint16 kPresslist = 717; -static const uint16 kQuitrequested = 723; -static const uint16 kSubtitles = 724; -static const uint16 kForeignrelease = 725; +static const uint16 kOffsetx = 153; +static const uint16 kOffsety = 155; +static const uint16 kCurrentob = 157; +static const uint16 kPrioritydep = 158; +static const uint16 kDestpos = 159; +static const uint16 kReallocation = 160; +static const uint16 kRoomnum = 161; +static const uint16 kNowinnewroom = 162; +static const uint16 kResetmanxy = 163; +static const uint16 kNewlocation = 164; +static const uint16 kAutolocation = 165; +static const uint16 kMustload = 166; +static const uint16 kAnswered = 167; +static const uint16 kSaidno = 168; +static const uint16 kDoorcheck1 = 169; +static const uint16 kDoorcheck2 = 170; +static const uint16 kDoorcheck3 = 171; +static const uint16 kDoorcheck4 = 172; +static const uint16 kMousex = 173; +static const uint16 kMousey = 175; +static const uint16 kMousebutton = 177; +static const uint16 kMousebutton1 = 179; +static const uint16 kMousebutton2 = 181; +static const uint16 kMousebutton3 = 183; +static const uint16 kMousebutton4 = 185; +static const uint16 kOldbutton = 187; +static const uint16 kOldx = 189; +static const uint16 kOldy = 191; +static const uint16 kLastbutton = 193; +static const uint16 kOldpointerx = 195; +static const uint16 kOldpointery = 197; +static const uint16 kDelherex = 199; +static const uint16 kDelherey = 201; +static const uint16 kPointerxs = 203; +static const uint16 kPointerys = 204; +static const uint16 kDelxs = 205; +static const uint16 kDelys = 206; +static const uint16 kPointerframe = 207; +static const uint16 kPointerpower = 208; +static const uint16 kAuxpointerframe = 209; +static const uint16 kPointermode = 210; +static const uint16 kPointerspeed = 211; +static const uint16 kPointercount = 212; +static const uint16 kInmaparea = 213; +static const uint16 kSlotdata = 214; +static const uint16 kThisslot = 215; +static const uint16 kSlotflags = 216; +static const uint16 kTalkmode = 217; +static const uint16 kTalkpos = 218; +static const uint16 kCharacter = 219; +static const uint16 kPersondata = 220; +static const uint16 kTalknum = 222; +static const uint16 kNumberinroom = 223; +static const uint16 kCurrentcel = 224; +static const uint16 kOldselection = 225; +static const uint16 kStopwalking = 226; +static const uint16 kMouseon = 227; +static const uint16 kPlayed = 228; +static const uint16 kTimer1 = 230; +static const uint16 kTimer2 = 231; +static const uint16 kTimer3 = 232; +static const uint16 kWholetimer = 233; +static const uint16 kTimer1to = 235; +static const uint16 kTimer2to = 236; +static const uint16 kTimer3to = 237; +static const uint16 kWatchdump = 238; +static const uint16 kLogonum = 239; +static const uint16 kOldlogonum = 240; +static const uint16 kNetseg = 241; +static const uint16 kNetpoint = 243; +static const uint16 kCursorstate = 245; +static const uint16 kPressed = 246; +static const uint16 kPresspointer = 247; +static const uint16 kGraphicpress = 249; +static const uint16 kPresscount = 250; +static const uint16 kLightcount = 251; +static const uint16 kFolderpage = 252; +static const uint16 kDiarypage = 253; +static const uint16 kMenucount = 254; +static const uint16 kSymboltopx = 255; +static const uint16 kSymboltopnum = 256; +static const uint16 kSymboltopdir = 257; +static const uint16 kSymbolbotx = 258; +static const uint16 kSymbolbotnum = 259; +static const uint16 kSymbolbotdir = 260; +static const uint16 kSymboltolight = 261; +static const uint16 kSymbol1 = 262; +static const uint16 kSymbol2 = 263; +static const uint16 kSymbol3 = 264; +static const uint16 kSymbolnum = 265; +static const uint16 kDumpx = 266; +static const uint16 kDumpy = 268; +static const uint16 kWalkandexam = 270; +static const uint16 kWalkexamtype = 271; +static const uint16 kWalkexamnum = 272; +static const uint16 kCurslocx = 273; +static const uint16 kCurslocy = 275; +static const uint16 kCurpos = 277; +static const uint16 kMonadx = 279; +static const uint16 kMonady = 281; +static const uint16 kMonsource = 283; +static const uint16 kNumtodo = 285; +static const uint16 kTimecount = 287; +static const uint16 kCounttotimed = 289; +static const uint16 kTimedseg = 291; +static const uint16 kTimedoffset = 293; +static const uint16 kTimedy = 295; +static const uint16 kTimedx = 296; +static const uint16 kNeedtodumptimed = 297; +static const uint16 kLoadingorsave = 298; +static const uint16 kCurrentslot = 299; +static const uint16 kCursorpos = 300; +static const uint16 kColourpos = 301; +static const uint16 kFadedirection = 302; +static const uint16 kNumtofade = 303; +static const uint16 kFadecount = 304; +static const uint16 kAddtogreen = 305; +static const uint16 kAddtored = 306; +static const uint16 kAddtoblue = 307; +static const uint16 kLastsoundreel = 308; +static const uint16 kSpeechloaded = 310; +static const uint16 kSpeechlength = 311; +static const uint16 kVolume = 313; +static const uint16 kVolumeto = 314; +static const uint16 kVolumedirection = 315; +static const uint16 kVolumecount = 316; +static const uint16 kWongame = 317; +static const uint16 kLasthardkey = 318; +static const uint16 kBufferin = 319; +static const uint16 kBufferout = 321; +static const uint16 kExtras = 323; +static const uint16 kWorkspace = 325; +static const uint16 kMapstore = 327; +static const uint16 kCharset1 = 329; +static const uint16 kBuffers = 331; +static const uint16 kMainsprites = 333; +static const uint16 kBackdrop = 335; +static const uint16 kMapdata = 337; +static const uint16 kSounddata = 339; +static const uint16 kSounddata2 = 341; +static const uint16 kRecordspace = 343; +static const uint16 kFreedat = 345; +static const uint16 kSetdat = 347; +static const uint16 kReel1 = 349; +static const uint16 kReel2 = 351; +static const uint16 kReel3 = 353; +static const uint16 kRoomdesc = 355; +static const uint16 kFreedesc = 357; +static const uint16 kSetdesc = 359; +static const uint16 kBlockdesc = 361; +static const uint16 kSetframes = 363; +static const uint16 kFreeframes = 365; +static const uint16 kPeople = 367; +static const uint16 kReels = 369; +static const uint16 kCommandtext = 371; +static const uint16 kPuzzletext = 373; +static const uint16 kTraveltext = 375; +static const uint16 kTempgraphics = 377; +static const uint16 kTempgraphics2 = 379; +static const uint16 kTempgraphics3 = 381; +static const uint16 kTempsprites = 383; +static const uint16 kTextfile1 = 385; +static const uint16 kTextfile2 = 387; +static const uint16 kTextfile3 = 389; +static const uint16 kBlinkframe = 391; +static const uint16 kBlinkcount = 392; +static const uint16 kReasseschanges = 393; +static const uint16 kPointerspath = 394; +static const uint16 kManspath = 395; +static const uint16 kPointerfirstpath = 396; +static const uint16 kFinaldest = 397; +static const uint16 kDestination = 398; +static const uint16 kLinestartx = 399; +static const uint16 kLinestarty = 401; +static const uint16 kLineendx = 403; +static const uint16 kLineendy = 405; +static const uint16 kLinepointer = 407; +static const uint16 kLinedirection = 408; +static const uint16 kLinelength = 409; +static const uint16 kCh0blockstocopy = 410; +static const uint16 kCh0playing = 412; +static const uint16 kCh0repeat = 413; +static const uint16 kCh1playing = 414; +static const uint16 kCh1blockstocopy = 415; +static const uint16 kSoundbufferwrite = 417; +static const uint16 kCurrentsample = 419; +static const uint16 kRoomssample = 420; +static const uint16 kBasicsample = 421; +static const uint16 kCurrentfile = 462; +static const uint16 kRoomscango = 537; +static const uint16 kRoompics = 553; +static const uint16 kOplist = 568; +static const uint16 kInputline = 571; +static const uint16 kPresslist = 699; +static const uint16 kQuitrequested = 705; +static const uint16 kSubtitles = 706; +static const uint16 kForeignrelease = 707; static const uint16 kBlocktextdat = (0); static const uint16 kPersonframes = (0); static const uint16 kDebuglevel1 = (0); diff --git a/engines/dreamweb/people.cpp b/engines/dreamweb/people.cpp index 4d66134e96..32fbbc04e5 100644 --- a/engines/dreamweb/people.cpp +++ b/engines/dreamweb/people.cpp @@ -129,8 +129,7 @@ void DreamBase::setupInitialReelRoutines() { } void DreamBase::updatePeople() { - data.word(kListpos) = kPeoplelist; - memset(getSegment(data.word(kBuffers)).ptr(kPeoplelist, 12 * sizeof(People)), 0xff, 12 * sizeof(People)); + _peopleList.clear(); ++data.word(kMaintimer); for (int i = 0; _reelRoutines[i].reallocation != 255; ++i) { @@ -220,13 +219,12 @@ void DreamBase::madMode() { } void DreamBase::addToPeopleList(ReelRoutine *routine) { - uint16 routinePointer = (const uint8 *)routine - data.ptr(0, 0); + People people; + people._reelPointer = routine->reelPointer(); + people._routinePointer = routine; + people.b4 = routine->b7; - People *people = (People *)getSegment(data.word(kBuffers)).ptr(data.word(kListpos), sizeof(People)); - people->setReelPointer(routine->reelPointer()); - people->setRoutinePointer(routinePointer); - people->b4 = routine->b7; - data.word(kListpos) += sizeof(People); + _peopleList.push_back(people); } bool DreamBase::checkSpeed(ReelRoutine &routine) { @@ -273,7 +271,7 @@ void DreamBase::sparky(ReelRoutine &routine) { if (data.word(kCard1money)) routine.b7 = 3; if (checkSpeed(routine)) { - if (routine.reelPointer() != 34) { + if (routine.reelPointer() == 34) { if (engine->randomNumber() < 30) routine.incReelPointer(); else diff --git a/engines/dreamweb/structs.h b/engines/dreamweb/structs.h index 320ed7e1a8..61400455d1 100644 --- a/engines/dreamweb/structs.h +++ b/engines/dreamweb/structs.h @@ -179,14 +179,8 @@ struct ReelRoutine { }; struct People { - uint8 b0; - uint8 b1; - uint16 reelPointer() const { return READ_LE_UINT16(&b0); } - void setReelPointer(uint16 v) { WRITE_LE_UINT16(&b0, v); } - uint8 b2; - uint8 b3; - uint16 routinePointer() const { return READ_LE_UINT16(&b2); } - void setRoutinePointer(uint16 v) { WRITE_LE_UINT16(&b2, v); } + uint16 _reelPointer; + ReelRoutine *_routinePointer; uint8 b4; }; diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 4ee19fde4d..9969ac775a 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -1157,12 +1157,10 @@ void DreamGenContext::checkIfPerson() { } bool DreamGenContext::checkIfPerson(uint8 x, uint8 y) { - People *people = (People *)getSegment(data.word(kBuffers)).ptr(kPeoplelist, 0); - - for (size_t i = 0; i < 12; ++i, ++people) { - if (people->b4 == 255) - continue; - Reel *reel = getReelStart(people->reelPointer()); + Common::List<People>::iterator i; + for (i = _peopleList.begin(); i != _peopleList.end(); ++i) { + People &people = *i; + Reel *reel = getReelStart(people._reelPointer); if (reel->frame() == 0xffff) ++reel; const Frame *frame = getReelFrameAX(reel->frame()); @@ -1178,8 +1176,8 @@ bool DreamGenContext::checkIfPerson(uint8 x, uint8 y) { continue; if (y >= ymax) continue; - data.word(kPersondata) = people->routinePointer(); - obName(people->b4, 5); + _personData = people._routinePointer; + obName(people.b4, 5); return true; } return false; diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index f7dcc56d42..6f26054423 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -81,7 +81,8 @@ Scene *Ringworld2Game::createScene(int sceneNumber) { // Sick bay return new Scene800(); case 825: - error("Missing scene %d from group 0", sceneNumber); + // Autodoc + return new Scene825(); case 850: // Deck #5 - By Lift return new Scene850(); @@ -202,6 +203,8 @@ Scene *Ringworld2Game::createScene(int sceneNumber) { // Cutscene : Discussions with Dr. Tomko return new Scene3245(); case 3250: + // Room with large stasis field negator + return new Scene3250(); case 3255: case 3260: case 3275: diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index ceca8915d8..a58740394b 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -3183,6 +3183,364 @@ void Scene800::signal() { } } +/*-------------------------------------------------------------------------- + * Scene 825 - Autodoc + * + *--------------------------------------------------------------------------*/ + +Scene825::Button::Button(): SceneObject() { + _buttonId = 0; + _v2 = 0; + _buttonDown = false; +} + +void Scene825::Button::synchronize(Serializer &s) { + SceneObject::synchronize(s); + s.syncAsSint16LE(_buttonId); + s.syncAsSint16LE(_v2); + s.syncAsSint16LE(_buttonDown); +} + +void Scene825::Button::process(Event &event) { + Scene825 *scene = (Scene825 *)R2_GLOBALS._sceneManager._scene; + + if (!event.handled) { + if ((event.eventType == EVENT_BUTTON_DOWN) && _bounds.contains(event.mousePos) && !_buttonDown) { + scene->_sound1.play(14); + setFrame(2); + _buttonDown = true; + event.handled = true; + } + + if ((event.eventType == EVENT_BUTTON_UP) && _buttonDown) { + setFrame(1); + _buttonDown = false; + event.handled = true; + + scene->doButtonPress(_buttonId); + } + } +} + +bool Scene825::Button::startAction(CursorType action, Event &event) { + if (action == CURSOR_USE) + return false; + else + return SceneObject::startAction(action, event); +} + +void Scene825::Button::setButton(int buttonId) { + SceneObject::postInit(); + _v2 = buttonId; + _buttonDown = 0; + _sceneText._color1 = 92; + _sceneText._color2 = 0; + _sceneText._width = 200; + _sceneText.fixPriority(20); + _sceneText._fontNumber = 50; + + switch (buttonId) { + case 1: + _sceneText.setPosition(Common::Point(95, 58)); + break; + case 2: + _sceneText.setPosition(Common::Point(98, 75)); + break; + case 3: + _sceneText.setPosition(Common::Point(102, 95)); + break; + case 4: + _sceneText.setPosition(Common::Point(180, 58)); + _sceneText._textMode = ALIGN_RIGHT; + break; + case 5: + _sceneText.setPosition(Common::Point(177, 75)); + _sceneText._textMode = ALIGN_RIGHT; + break; + case 6: + _sceneText.setPosition(Common::Point(175, 95)); + _sceneText._textMode = ALIGN_RIGHT; + break; + default: + break; + } + + setDetails(825, 6, 7, -1, 2, NULL); +} + +void Scene825::Button::setText(int textId) { + _buttonId = textId; + _lookLineNum = textId; + + _sceneText.remove(); + if (_buttonId != 0) + _sceneText.setup(AUTODOC_ITEMS[textId - 1]); +} + +/*--------------------------------------------------------------------------*/ + +Scene825::Scene825(): SceneExt() { + _menuId = _frame1 = _frame2 = 0; +} + +void Scene825::postInit(SceneObjectList *OwnerList) { + SceneExt::postInit(); + loadScene(825); + R2_GLOBALS._player._uiEnabled = false; + BF_GLOBALS._interfaceY = 200; + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player._effect = 0; + R2_GLOBALS._player.setVisage(10); + R2_GLOBALS._player.hide(); + R2_GLOBALS._player.disableControl(); + + _item2.setDetails(1, 825, 3, 4, 5); + _background.setDetails(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 825, 0, -1, -1, 1, NULL); + + _sceneMode = 10; + signal(); +} + +void Scene825::synchronize(Serializer &s) { + SceneExt::synchronize(s); + + s.syncAsSint16LE(_menuId); + s.syncAsSint16LE(_frame1); + s.syncAsSint16LE(_frame2); +} + +void Scene825::remove() { + SceneExt::remove(); + R2_GLOBALS._player._uiEnabled = true; +} + +void Scene825::signal() { + switch (_sceneMode) { + case 10: + _button1.setButton(1); + _button1.setup(825, 1, 1); + _button1.setPosition(Common::Point(71, 71)); + _button2.setButton(2); + _button2.setup(825, 3, 1); + _button2.setPosition(Common::Point(74, 90)); + _button3.setButton(3); + _button3.setup(825, 5, 1); + _button3.setPosition(Common::Point(78, 109)); + _button4.setButton(4); + _button4.setup(825, 2, 1); + _button4.setPosition(Common::Point(248, 71)); + _button5.setButton(5); + _button5.setup(825, 4, 1); + _button5.setPosition(Common::Point(245, 90)); + _button6.setButton(6); + _button6.setup(825, 6, 1); + _button6.setPosition(Common::Point(241, 109)); + + doButtonPress(1); + R2_GLOBALS._player.enableControl(); + R2_GLOBALS._player._canWalk = false; + break; + case 825: + _object5.remove(); + _sceneText._color1 = 92; + _sceneText._color2 = 0; + _sceneText._width = 200; + _sceneText.fixPriority(20); + _sceneText._fontNumber = 50; + _sceneText.setPosition(Common::Point(120, 75)); + _sceneText.setup(NO_MALADY_DETECTED); + _sceneMode = 826; + setAction(&_sequenceManager1, this, 826, &R2_GLOBALS._player, NULL); + break; + case 826: + _sceneText.remove(); + doButtonPress(1); + R2_GLOBALS._player.enableControl(); + R2_GLOBALS._player._canWalk = false; + break; + case 827: + _object5.remove(); + R2_INVENTORY.setObjectScene(R2_OPTO_DISK, 825); + _sceneText.setPosition(Common::Point(108, 75)); + _sceneText.setup(FOREIGN_OBJECT_EXTRACTED); + _sceneMode = 826; + setAction(&_sequenceManager1, this, 826, &R2_GLOBALS._player, NULL); + break; + default: + R2_GLOBALS._player.enableControl(); + R2_GLOBALS._player._canWalk = false; + break; + } +} + +void Scene825::process(Event &event) { + SceneExt::process(event); + + if (R2_GLOBALS._player._uiEnabled) { + _button1.process(event); + _button2.process(event); + _button3.process(event); + _button4.process(event); + _button5.process(event); + _button6.process(event); + } +} + +void Scene825::dispatch() { + if (R2_GLOBALS._sceneObjects->contains(&_object4) && + ((_object4._frame == 1) || (_object4._frame == 3)) && + (_object4._frame != _frame1)) { + _sound2.play(25); + } + + if (R2_GLOBALS._sceneObjects->contains(&_object1) && + (_object1._frame == 3) && (_object1._frame != _frame2)) { + _sound3.play(26); + } + + _frame1 = _object4._frame; + _frame2 = _object1._frame; + + Scene::dispatch(); +} + +void Scene825::doButtonPress(int buttonId) { + if ((_menuId != 4) || (buttonId == 5)) { + _button1.setText(0); + _button2.setText(0); + _button3.setText(0); + _button4.setText(0); + _button5.setText(0); + _button6.setText(0); + + switch (buttonId) { + case 2: + R2_GLOBALS._player.disableControl(); + _object5.postInit(); + _sceneMode = 825; + setAction(&_sequenceManager1, this, 825, &R2_GLOBALS._player, &_object5, NULL); + break; + case 3: + R2_GLOBALS._player.disableControl(); + _sceneText._color1 = 92; + _sceneText._color2 = 0; + _sceneText._width = 200; + _sceneText.fixPriority(20); + _sceneText._fontNumber = 50; + _sceneText.setPosition(Common::Point(115, 75)); + + if (R2_GLOBALS.getFlag(4)) { + if ((R2_INVENTORY.getObjectScene(R2_READER) != 800) || + (R2_INVENTORY.getObjectScene(R2_OPTICAL_FIBRE) != 800)) { + _sceneText.setPosition(Common::Point(116, 75)); + _sceneText.setup(ACCESS_CODE_REQUIRED); + } else if (R2_INVENTORY.getObjectScene(R2_OPTO_DISK) != 800) { + _sceneText.setPosition(Common::Point(115, 75)); + _sceneText.setup(NO_TREATMENT_REQUIRED); + } else { + _button6._buttonId = 5; + + _object5.postInit(); + setAction(&_sequenceManager1, this, 827, &_object5, NULL); + } + } else { + R2_GLOBALS.setFlag(2); + + if ((R2_INVENTORY.getObjectScene(R2_READER) != 800) || + (R2_INVENTORY.getObjectScene(R2_OPTICAL_FIBRE) != 800)) { + _sceneText.setPosition(Common::Point(116, 75)); + _sceneText.setup(ACCESS_CODE_REQUIRED); + } else { + _sceneText.setPosition(Common::Point(119, 75)); + _sceneText.setup(INVALID_ACCESS_CODE); + } + } + + if (_sceneMode != 827) { + _sceneMode = 826; + setAction(&_sequenceManager1, this, 826, &R2_GLOBALS._player, NULL); + } + break; + case 4: + _sound4.play(27); + _button6._buttonId = 5; + + _object1.postInit(); + _object1.setup(826, 7, 1); + _object1.setPosition(Common::Point(112, 67)); + _object1._numFrames = 1; + _object1.animate(ANIM_MODE_2); + + _object2.postInit(); + _object2.setup(826, 5, 1); + _object2.setPosition(Common::Point(158, 67)); + _object2._numFrames = 5; + _object2.animate(ANIM_MODE_2); + + _object3.postInit(); + _object3.setup(826, 6, 1); + _object3.setPosition(Common::Point(206, 67)); + _object3._numFrames = 1; + _object3.animate(ANIM_MODE_2); + + _object4.postInit(); + _object4.setup(826, 8, 1); + _object4.setPosition(Common::Point(158, 84)); + _object4._numFrames = 1; + _object4.animate(ANIM_MODE_2); + + _object5.postInit(); + _object5.setup(826, 4, 1); + _object5.setPosition(Common::Point(161, 110)); + break; + case 5: + R2_GLOBALS._player.disableControl(); + if (_menuId == 4) { + _menuId = 0; + + _object1.remove(); + _object2.remove(); + _object3.remove(); + _object4.remove(); + _object5.remove(); + + _sound2.stop(); + _sound3.stop(); + _sound4.stop(); + + doButtonPress(1); + R2_GLOBALS._player.enableControl(); + R2_GLOBALS._player._canWalk = false; + } else { + R2_GLOBALS._sceneManager.changeScene(800); + } + break; + case 6: + R2_GLOBALS._player.disableControl(); + _sceneText._color1 = 92; + _sceneText._color2 = 0; + _sceneText._width = 200; + _sceneText.fixPriority(20); + _sceneText._fontNumber = 50; + _sceneText.setPosition(Common::Point(115, 75)); + _sceneText.setup(NO_TREATMENT_REQUIRED); + + _sceneMode = 826; + setAction(&_sequenceManager1, this, 826, &R2_GLOBALS._player, NULL); + break; + default: + _button1.setText(2); + _button2.setText(3); + _button3.setText(4); + _button4.setText(6); + _button6.setText(5); + break; + } + + _menuId = buttonId; + } +} /*-------------------------------------------------------------------------- * Scene 850 - Deck #5 - By Lift diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.h b/engines/tsage/ringworld2/ringworld2_scenes0.h index 6810b5d85a..7a36b8f15f 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.h +++ b/engines/tsage/ringworld2/ringworld2_scenes0.h @@ -419,6 +419,42 @@ public: virtual void signal(); }; +class Scene825: public SceneExt { + /* Objects */ + class Button: public SceneObject { + public: + int _buttonId, _v2; + bool _buttonDown; + SceneText _sceneText; + public: + Button(); + void setButton(int buttonId); + void setText(int textId); + + virtual void synchronize(Serializer &s); + virtual void process(Event &event); + virtual bool startAction(CursorType action, Event &event); + }; +public: + NamedHotspot _background, _item2; + SceneActor _object1, _object2, _object3, _object4, _object5; + Button _button1, _button2, _button3, _button4, _button5, _button6; + ASoundExt _sound1, _sound2, _sound3, _sound4; + SequenceManager _sequenceManager1; + SceneText _sceneText; + int _menuId, _frame1, _frame2; +public: + Scene825(); + virtual void synchronize(Serializer &s); + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void remove(); + virtual void signal(); + virtual void process(Event &event); + virtual void dispatch(); + + void doButtonPress(int buttonId); +}; + class Scene850: public SceneExt { /* Items */ class Indicator: public NamedHotspot { diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp index 65b1622883..298093be3a 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp @@ -1089,5 +1089,172 @@ void Scene3245::signal() { R2_GLOBALS._sceneManager.changeScene(1200); } +/*-------------------------------------------------------------------------- + * Scene 3250 - Room with large stasis field negator + * + *--------------------------------------------------------------------------*/ +bool Scene3250::Item::startAction(CursorType action, Event &event) { + Scene3250 *scene = (Scene3250 *)R2_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + if (_useLineNum != -1) { + SceneItem::display(_resNum, _useLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + return true; + } + break; + case CURSOR_LOOK: + if (_lookLineNum != -1) { + SceneItem::display(_resNum, _lookLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + return true; + } + break; + case CURSOR_TALK: + if (_talkLineNum != -1) { + SceneItem::display(_resNum, _talkLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + return true; + } + break; + default: + break; + } + + return scene->display(action, event); +} + +bool Scene3250::Actor::startAction(CursorType action, Event &event) { + Scene3250 *scene = (Scene3250 *)R2_GLOBALS._sceneManager._scene; + + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + + R2_GLOBALS._player.disableControl(); + + switch(_position.x) { + case 25: + scene->_sceneMode = 3262; + scene->setAction(&scene->_sequenceManager, scene, 3262, &R2_GLOBALS._player, &scene->_actor1, NULL); + break; + case 259: + scene->_sceneMode = 3260; + scene->setAction(&scene->_sequenceManager, scene, 3260, &R2_GLOBALS._player, &scene->_actor2, NULL); + break; + case 302: + scene->_sceneMode = 3261; + scene->setAction(&scene->_sequenceManager, scene, 3261, &R2_GLOBALS._player, &scene->_actor3, NULL); + break; + default: + break; + } + return true; +} + +void Scene3250::postInit(SceneObjectList *OwnerList) { + loadScene(3250); + + if (R2_GLOBALS._sceneManager._previousScene == -1) { + R2_GLOBALS._player._oldCharacterScene[3] = 1200; + R2_GLOBALS._player._characterIndex = R2_MIRANDA; + } + + SceneExt::postInit(); + _actor1.postInit(); + _actor1.setup(3250, 6, 1); + _actor1.setPosition(Common::Point(25, 148)); + _actor1.fixPriority(10); + _actor1.setDetails(3250, 9, 10, -1, 1, NULL); + + _actor2.postInit(); + _actor2.setup(3250, 4, 1); + _actor2.setPosition(Common::Point(259, 126)); + _actor2.fixPriority(10); + _actor2.setDetails(3250, 9, 10, -1, 1, NULL); + + _actor3.postInit(); + _actor3.setup(3250, 5, 1); + _actor3.setPosition(Common::Point(302, 138)); + _actor3.fixPriority(10); + _actor3.setDetails(3250, 9, 10, -1, 1, NULL); + + _item3.setDetails(Rect(119, 111, 149, 168), 3250, 6, 7, 2, 1, NULL); + _item2.setDetails(Rect(58, 85, 231, 138), 3250, 12, 7, 2, 1, NULL); + _item4.setDetails(12, 3250, 3, 1, 2); + _item1.setDetails(Rect(0, 0, 320, 200), 3250, 0, 1, 2, 1, NULL); + + R2_GLOBALS._player.postInit(); + + switch (R2_GLOBALS._player._oldCharacterScene[3]) { + case 1200: + _sceneMode = 3250; + _actor4.postInit(); + R2_GLOBALS._player._effect = 0; + setAction(&_sequenceManager, this, 3250, &R2_GLOBALS._player, &_actor4, NULL); + break; + case 3125: + if (R2_GLOBALS.getFlag(79)) { + _sceneMode = 3254; + _actor5.postInit(); + _actor5._effect = 1; + _actor6.postInit(); + _actor6._effect = 1; + _actor7.postInit(); + _actor7._effect = 1; + setAction(&_sequenceManager, this, 3254, &R2_GLOBALS._player, &_actor3, &_actor5, &_actor6, &_actor7, &_actor1, NULL); + } else { + _sceneMode = 3252; + setAction(&_sequenceManager, this, 3252, &R2_GLOBALS._player, &_actor3, NULL); + } + break; + case 3175: + _sceneMode = 3251; + setAction(&_sequenceManager, this, 3251, &R2_GLOBALS._player, &_actor2, NULL); + break; + case 3255: + _sceneMode = 3253; + setAction(&_sequenceManager, this, 3253, &R2_GLOBALS._player, &_actor1, NULL); + break; + default: + R2_GLOBALS._player.setup(31, 3, 1); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player.setPosition(Common::Point(185, 150)); + R2_GLOBALS._player.enableControl(); + break; + } + + R2_GLOBALS._player._oldCharacterScene[3] = 3250; +} + +void Scene3250::signal() { + switch(_sceneMode) { + case 3250: + R2_GLOBALS._player._effect = 1; + R2_GLOBALS._player.enableControl(); + break; + case 3254: + //No break on purpose + case 3262: + R2_GLOBALS._sceneManager.changeScene(3255); + break; + case 3260: + R2_GLOBALS._sceneManager.changeScene(3175); + break; + case 3261: + R2_GLOBALS._sceneManager.changeScene(3125); + break; + default: + R2_GLOBALS._player.enableControl(); + break; + } +} + +void Scene3250::dispatch() { + if ((R2_GLOBALS._player._visage == 3250) && (R2_GLOBALS._player._strip == 3) && (R2_GLOBALS._player._effect == 0)) { + R2_GLOBALS._player._effect = 6; + R2_GLOBALS._player._shade = 6; + } + + Scene::dispatch(); +} + } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.h b/engines/tsage/ringworld2/ringworld2_scenes3.h index ab98a8d66e..b83f83b1c2 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.h +++ b/engines/tsage/ringworld2/ringworld2_scenes3.h @@ -261,6 +261,36 @@ public: virtual void postInit(SceneObjectList *OwnerList = NULL); virtual void signal(); }; + +class Scene3250 : public SceneExt { + class Item : public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + class Actor : public SceneActor { + virtual bool startAction(CursorType action, Event &event); + }; +public: + + Item _item1; + Item _item2; + Item _item3; + Item _item4; + Actor _actor1; + Actor _actor2; + Actor _actor3; + Actor _actor4; + SceneActor _actor5; + SceneActor _actor6; + SceneActor _actor7; + SequenceManager _sequenceManager; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); + virtual void dispatch(); +}; + } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/staticres.cpp b/engines/tsage/staticres.cpp index 238e7b3049..3be719887f 100644 --- a/engines/tsage/staticres.cpp +++ b/engines/tsage/staticres.cpp @@ -192,6 +192,26 @@ const char *CONSOLE_MESSAGES[] = { "Mozart", "Bach", "Rossini" }; +// Scene 825 Autodoc messages +const char *MAIN_MENU = "main menu"; +const char *DIAGNOSIS = "diagnosis"; +const char *ADVANCED_PROCEDURES = "advanced procedures"; +const char *VITAL_SIGNS = "vital signs"; +const char *OPEN_DOOR = "open door"; +const char *TREATMENTS = "treatments"; +const char *NO_MALADY_DETECTED = "no malady detected"; +const char *NO_TREATMENT_REQUIRED = "no treatment required"; +const char *ACCESS_CODE_REQUIRED = "access code required"; +const char *INVALID_ACCESS_CODE = "invalid access code"; +const char *FOREIGN_OBJECT_EXTRACTED = "foreign object extracted"; + +const char *AUTODOC_ITEMS[11] = { + MAIN_MENU, DIAGNOSIS, ADVANCED_PROCEDURES, VITAL_SIGNS, OPEN_DOOR, TREATMENTS, + NO_MALADY_DETECTED, NO_TREATMENT_REQUIRED, ACCESS_CODE_REQUIRED, INVALID_ACCESS_CODE, + FOREIGN_OBJECT_EXTRACTED +}; + + const char *HELP_MSG = "\x1\rRETURN TO\r RINGWORLD\x14"; const char *CHAR_TITLE = "\x01Select Character:"; const char *CHAR_QUINN_MSG = " Quinn "; diff --git a/engines/tsage/staticres.h b/engines/tsage/staticres.h index faff3f4103..e2afb65b34 100644 --- a/engines/tsage/staticres.h +++ b/engines/tsage/staticres.h @@ -149,6 +149,20 @@ namespace Ringworld2 { // Scene 125 - Console messages extern const char *CONSOLE_MESSAGES[]; +// Scene 825 - Autodoc Messages +extern const char *MAIN_MENU; +extern const char *DIAGNOSIS; +extern const char *ADVANCED_PROCEDURES; +extern const char *VITAL_SIGNS; +extern const char *OPEN_DOOR; +extern const char *TREATMENTS; +extern const char *NO_MALADY_DETECTED; +extern const char *NO_TREATMENT_REQUIRED; +extern const char *ACCESS_CODE_REQUIRED; +extern const char *INVALID_ACCESS_CODE; +extern const char *FOREIGN_OBJECT_EXTRACTED; +extern const char *AUTODOC_ITEMS[11]; + // Dialog messages extern const char *HELP_MSG; extern const char *CHAR_TITLE; |