From c619b8d981393bed9958179ea5d2f0a557d41087 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Thu, 8 Dec 2011 03:10:17 +0000 Subject: TOON: Replace usage of 'goto'. --- engines/toon/path.cpp | 9 ++++----- engines/toon/toon.cpp | 12 +++--------- 2 files changed, 7 insertions(+), 14 deletions(-) (limited to 'engines') diff --git a/engines/toon/path.cpp b/engines/toon/path.cpp index 60ca007930..2dd5fc45e2 100644 --- a/engines/toon/path.cpp +++ b/engines/toon/path.cpp @@ -322,9 +322,10 @@ int32 PathFinding::findPath(int32 x, int32 y, int32 destx, int32 desty) { int32 endY = MIN(curY + 1, _height - 1); int32 startX = MAX(curX - 1, 0); int32 startY = MAX(curY - 1, 0); + bool next = false; - for (int32 px = startX; px <= endX; px++) { - for (int py = startY; py <= endY; py++) { + for (int32 px = startX; px <= endX && !next; px++) { + for (int py = startY; py <= endY && !next; py++) { if (px != curX || py != curY) { wei = ((abs(px - curX) + abs(py - curY))); @@ -336,7 +337,7 @@ int32 PathFinding::findPath(int32 x, int32 y, int32 destx, int32 desty) { sq[curPNode] = sum; _heap->push(px, py, sq[curPNode] + newWeight); if (!newWeight) - goto next; // we found it ! + next = true; // we found it ! } } } @@ -344,8 +345,6 @@ int32 PathFinding::findPath(int32 x, int32 y, int32 destx, int32 desty) { } } -next: - // let's see if we found a result ! if (!_gridTemp[destx + desty * _width]) { // didn't find anything diff --git a/engines/toon/toon.cpp b/engines/toon/toon.cpp index 13f702e3dd..99932362af 100644 --- a/engines/toon/toon.cpp +++ b/engines/toon/toon.cpp @@ -2297,8 +2297,7 @@ void ToonEngine::processConversationClick(Conversation *conv, int32 status) { if (v8 == -1) { _gameState->_mouseHidden = false; } else { -retry: - while (1) { + while (v8 != -1) { v7 += 1; int16 *v14 = (int16 *)((char *)_conversationData + v8); @@ -2315,15 +2314,10 @@ retry: v8 = READ_LE_INT16(v7); if (v8 == -1) return; - - goto retry; + else + break; // restarts while loop; } } - - if (v8 != -1) - continue; - - break; } } } -- cgit v1.2.3 From d3a187c298decc7b8e0125a3cdc46162f65ea3bb Mon Sep 17 00:00:00 2001 From: D G Turner Date: Thu, 8 Dec 2011 03:31:29 +0000 Subject: DRACI: Replace usage of 'goto'. --- engines/draci/walking.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'engines') diff --git a/engines/draci/walking.cpp b/engines/draci/walking.cpp index 9a66c6163a..f1ae769d80 100644 --- a/engines/draci/walking.cpp +++ b/engines/draci/walking.cpp @@ -729,20 +729,18 @@ Movement WalkingState::transitionBetweenAnimations(Movement previous, Movement n Movement WalkingState::animationForSightDirection(SightDirection dir, const Common::Point &hero, const Common::Point &mouse, const WalkingPath &path, Movement startingDirection) { switch (dir) { + case kDirectionLeft: + return kStopLeft; + case kDirectionRight: + return kStopRight; case kDirectionMouse: if (mouse.x < hero.x) { return kStopLeft; } else if (mouse.x > hero.x) { return kStopRight; - } else { - goto defaultCase; } - case kDirectionLeft: - return kStopLeft; - case kDirectionRight: - return kStopRight; + // fall-through here intentional default: { -defaultCase: // Find the last horizontal direction on the path. int i = path.size() - 1; while (i >= 0 && path[i].x == hero.x) { -- cgit v1.2.3 From 111f5806766a322de7f18da89dd0e72aa7cdc609 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Thu, 8 Dec 2011 14:27:28 +0000 Subject: TINSEL: Replace usage of 'goto'. --- engines/tinsel/saveload.cpp | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) (limited to 'engines') diff --git a/engines/tinsel/saveload.cpp b/engines/tinsel/saveload.cpp index a0801d8247..8664cd5f15 100644 --- a/engines/tinsel/saveload.cpp +++ b/engines/tinsel/saveload.cpp @@ -486,6 +486,16 @@ static bool DoRestore() { return !failed; } +static void SaveFailure(Common::OutSaveFile *f) { + if (f) { + delete f; + _vm->getSaveFileMan()->removeSavefile(SaveSceneName); + SaveSceneName = NULL; // Invalidate save name + } + GUI::MessageDialog dialog(_("Failed to save game state to file.")); + dialog.runModal(); +} + /** * DoSave */ @@ -524,8 +534,10 @@ static void DoSave() { f = _vm->getSaveFileMan()->openForSaving(SaveSceneName); Common::Serializer s(0, f); - if (f == NULL) - goto save_failure; + if (f == NULL) { + SaveFailure(f); + return; + } // Write out a savegame header SaveGameHeader hdr; @@ -536,29 +548,22 @@ static void DoSave() { hdr.desc[SG_DESC_LEN - 1] = 0; g_system->getTimeAndDate(hdr.dateTime); if (!syncSaveGameHeader(s, hdr) || f->err()) { - goto save_failure; + SaveFailure(f); + return; } DoSync(s); // Write out the special Id for Discworld savegames f->writeUint32LE(0xFEEDFACE); - if (f->err()) - goto save_failure; + if (f->err()) { + SaveFailure(f); + return; + } f->finalize(); delete f; SaveSceneName = NULL; // Invalidate save name - return; - -save_failure: - if (f) { - delete f; - _vm->getSaveFileMan()->removeSavefile(SaveSceneName); - SaveSceneName = NULL; // Invalidate save name - } - GUI::MessageDialog dialog(_("Failed to save game state to file.")); - dialog.runModal(); } /** -- cgit v1.2.3 From 4a59c954fd07c62c779759f44d2212e1ef459d7e Mon Sep 17 00:00:00 2001 From: D G Turner Date: Thu, 8 Dec 2011 14:54:18 +0000 Subject: DRASCULA: Replace usage of 'goto'. --- engines/drascula/animation.cpp | 49 ++++++++++++++++++++++++++---------------- engines/drascula/drascula.h | 1 + 2 files changed, 31 insertions(+), 19 deletions(-) (limited to 'engines') diff --git a/engines/drascula/animation.cpp b/engines/drascula/animation.cpp index c4a8d3eb01..43799f7944 100644 --- a/engines/drascula/animation.cpp +++ b/engines/drascula/animation.cpp @@ -748,6 +748,19 @@ void DrasculaEngine::animation_14_2() { loadPic(99, backSurface); } +void DrasculaEngine::asco() { + loadPic(roomDisk, drawSurface3); + loadPic(roomNumber, bgSurface, HALF_PAL); + black(); + updateRoom(); + updateScreen(); + fadeFromBlack(0); + if (roomMusic != 0) + playMusic(roomMusic); + else + stopMusic(); +} + // The drunk tells us about Von Braun void DrasculaEngine::animation_16_2() { debug(4, "animation_16_2()"); @@ -763,8 +776,10 @@ void DrasculaEngine::animation_16_2() { else playMusic(32); - if (getScan() != 0) - goto asco; + if (getScan() != 0) { + asco(); + return; + } color_abc(kColorDarkGreen); @@ -778,16 +793,20 @@ void DrasculaEngine::animation_16_2() { centerText(_texthis[i], 180, 180); updateScreen(); - if (getScan() != 0) - goto asco; + if (getScan() != 0) { + asco(); + return; + } delay(3000); if (i < 4) { fadeToBlack(1); - if (getScan() != 0) - goto asco; + if (getScan() != 0) { + asco(); + return; + } clearRoom(); } @@ -800,25 +819,17 @@ void DrasculaEngine::animation_16_2() { copyBackground(0, 0, 0, l, 320, 200 - l, drawSurface3, screenSurface); copyBackground(0, 200 - l, 0, 0, 320, l, bgSurface, screenSurface); updateScreen(); - if (getScan() != 0) - goto asco; + if (getScan() != 0) { + asco(); + return; + } } pause(5); fadeToBlack(2); clearRoom(); -asco: - loadPic(roomDisk, drawSurface3); - loadPic(roomNumber, bgSurface, HALF_PAL); - black(); - updateRoom(); - updateScreen(); - fadeFromBlack(0); - if (roomMusic != 0) - playMusic(roomMusic); - else - stopMusic(); + asco(); } void DrasculaEngine::animation_20_2() { diff --git a/engines/drascula/drascula.h b/engines/drascula/drascula.h index 6f98c50fdc..2d1954e3ca 100644 --- a/engines/drascula/drascula.h +++ b/engines/drascula/drascula.h @@ -664,6 +664,7 @@ public: void animation_12_2(); void animation_13_2(); void animation_14_2(); + void asco(); void animation_16_2(); void animation_20_2(); void animation_23_2(); -- cgit v1.2.3 From 7a0aabccbe9dc9cb7db60a113867a103320ea501 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Thu, 8 Dec 2011 19:24:42 +0000 Subject: SWORD25: Reduce usage of 'goto'. Have refrained from changing the usage of 'goto' in the embedded LUA interpreter code for the time being, as this is still in flux due to the savegame issues. --- engines/sword25/gfx/image/art.cpp | 136 +++++++++++++++++--------------------- 1 file changed, 61 insertions(+), 75 deletions(-) (limited to 'engines') diff --git a/engines/sword25/gfx/image/art.cpp b/engines/sword25/gfx/image/art.cpp index 2ba102e779..3944a207c8 100644 --- a/engines/sword25/gfx/image/art.cpp +++ b/engines/sword25/gfx/image/art.cpp @@ -328,18 +328,6 @@ static void art_vpath_render_bez(ArtVpath **p_vpath, int *pn, int *pn_max, double x2, double y2, double x3, double y3, double flatness) { - double x3_0, y3_0; - double z3_0_dot; - double z1_dot, z2_dot; - double z1_perp, z2_perp; - double max_perp_sq; - - double x_m, y_m; - double xa1, ya1; - double xa2, ya2; - double xb1, yb1; - double xb2, yb2; - /* It's possible to optimize this routine a fair amount. First, once the _dot conditions are met, they will also be met in @@ -363,11 +351,13 @@ static void art_vpath_render_bez(ArtVpath **p_vpath, int *pn, int *pn_max, */ - x3_0 = x3 - x0; - y3_0 = y3 - y0; + bool subDivide = false; + + double x3_0 = x3 - x0; + double y3_0 = y3 - y0; - /* z3_0_dot is dist z0-z3 squared */ - z3_0_dot = x3_0 * x3_0 + y3_0 * y3_0; + // z3_0_dot is dist z0-z3 squared + double z3_0_dot = x3_0 * x3_0 + y3_0 * y3_0; if (z3_0_dot < 0.001) { /* if start and end point are almost identical, the flatness tests @@ -375,72 +365,68 @@ static void art_vpath_render_bez(ArtVpath **p_vpath, int *pn, int *pn_max, * the other two control points are the same as the start point, * too. */ - if (hypot(x1 - x0, y1 - y0) < 0.001 - && hypot(x2 - x0, y2 - y0) < 0.001) - goto nosubdivide; - else - goto subdivide; - } - - /* we can avoid subdivision if: - - z1 has distance no more than flatness from the z0-z3 line - - z1 is no more z0'ward than flatness past z0-z3 - - z1 is more z0'ward than z3'ward on the line traversing z0-z3 - - and correspondingly for z2 */ - - /* perp is distance from line, multiplied by dist z0-z3 */ - max_perp_sq = flatness * flatness * z3_0_dot; - - z1_perp = (y1 - y0) * x3_0 - (x1 - x0) * y3_0; - if (z1_perp * z1_perp > max_perp_sq) - goto subdivide; + if (!(hypot(x1 - x0, y1 - y0) < 0.001 + && hypot(x2 - x0, y2 - y0) < 0.001)) + subDivide = true; + } else { + /* we can avoid subdivision if: - z2_perp = (y3 - y2) * x3_0 - (x3 - x2) * y3_0; - if (z2_perp * z2_perp > max_perp_sq) - goto subdivide; + z1 has distance no more than flatness from the z0-z3 line - z1_dot = (x1 - x0) * x3_0 + (y1 - y0) * y3_0; - if (z1_dot < 0 && z1_dot * z1_dot > max_perp_sq) - goto subdivide; + z1 is no more z0'ward than flatness past z0-z3 - z2_dot = (x3 - x2) * x3_0 + (y3 - y2) * y3_0; - if (z2_dot < 0 && z2_dot * z2_dot > max_perp_sq) - goto subdivide; + z1 is more z0'ward than z3'ward on the line traversing z0-z3 - if (z1_dot + z1_dot > z3_0_dot) - goto subdivide; + and correspondingly for z2 */ - if (z2_dot + z2_dot > z3_0_dot) - goto subdivide; + // perp is distance from line, multiplied by dist z0-z3 + double max_perp_sq = flatness * flatness * z3_0_dot; + double z1_perp = (y1 - y0) * x3_0 - (x1 - x0) * y3_0; + if (z1_perp * z1_perp > max_perp_sq) { + subDivide = true; + } else { + double z2_perp = (y3 - y2) * x3_0 - (x3 - x2) * y3_0; + if (z2_perp * z2_perp > max_perp_sq) { + subDivide = true; + } else { + double z1_dot = (x1 - x0) * x3_0 + (y1 - y0) * y3_0; + if (z1_dot < 0 && z1_dot * z1_dot > max_perp_sq) { + subDivide = true; + } else { + double z2_dot = (x3 - x2) * x3_0 + (y3 - y2) * y3_0; + if (z2_dot < 0 && z2_dot * z2_dot > max_perp_sq) + subDivide = true; + else if (z1_dot + z1_dot > z3_0_dot) + subDivide = true; + else if (z2_dot + z2_dot > z3_0_dot) + subDivide = true; + } + } + } + } -nosubdivide: - /* don't subdivide */ - art_vpath_add_point(p_vpath, pn, pn_max, - ART_LINETO, x3, y3); - return; - -subdivide: - - xa1 = (x0 + x1) * 0.5; - ya1 = (y0 + y1) * 0.5; - xa2 = (x0 + 2 * x1 + x2) * 0.25; - ya2 = (y0 + 2 * y1 + y2) * 0.25; - xb1 = (x1 + 2 * x2 + x3) * 0.25; - yb1 = (y1 + 2 * y2 + y3) * 0.25; - xb2 = (x2 + x3) * 0.5; - yb2 = (y2 + y3) * 0.5; - x_m = (xa2 + xb1) * 0.5; - y_m = (ya2 + yb1) * 0.5; - - art_vpath_render_bez(p_vpath, pn, pn_max, - x0, y0, xa1, ya1, xa2, ya2, x_m, y_m, flatness); - art_vpath_render_bez(p_vpath, pn, pn_max, - x_m, y_m, xb1, yb1, xb2, yb2, x3, y3, flatness); + if (subDivide) { + double xa1 = (x0 + x1) * 0.5; + double ya1 = (y0 + y1) * 0.5; + double xa2 = (x0 + 2 * x1 + x2) * 0.25; + double ya2 = (y0 + 2 * y1 + y2) * 0.25; + double xb1 = (x1 + 2 * x2 + x3) * 0.25; + double yb1 = (y1 + 2 * y2 + y3) * 0.25; + double xb2 = (x2 + x3) * 0.5; + double yb2 = (y2 + y3) * 0.5; + double x_m = (xa2 + xb1) * 0.5; + double y_m = (ya2 + yb1) * 0.5; + + art_vpath_render_bez(p_vpath, pn, pn_max, + x0, y0, xa1, ya1, xa2, ya2, x_m, y_m, flatness); + art_vpath_render_bez(p_vpath, pn, pn_max, + x_m, y_m, xb1, yb1, xb2, yb2, x3, y3, flatness); + } else { + // don't subdivide + art_vpath_add_point(p_vpath, pn, pn_max, + ART_LINETO, x3, y3); + } } /** -- cgit v1.2.3 From e5d6801c99b5ef2307e3f2924e8427ba32145d53 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Thu, 8 Dec 2011 20:36:16 +0000 Subject: SKY: Replace usage of 'goto'. --- engines/sky/logic.cpp | 340 +++++++++++++++++++++++++------------------------- 1 file changed, 173 insertions(+), 167 deletions(-) (limited to 'engines') diff --git a/engines/sky/logic.cpp b/engines/sky/logic.cpp index a69ba793f2..86c8828e5a 100644 --- a/engines/sky/logic.cpp +++ b/engines/sky/logic.cpp @@ -1232,191 +1232,197 @@ uint16 Logic::mouseScript(uint32 scrNum, Compact *scriptComp) { * @return 0 if script finished. Else offset where to continue. */ uint16 Logic::script(uint16 scriptNo, uint16 offset) { -script: - /// process a script - /// low level interface to interpreter + bool restartScript; - uint16 moduleNo = scriptNo >> 12; - uint16 *scriptData = _moduleList[moduleNo]; // get module address + do { + restartScript = false; - if (!scriptData) { // We need to load the script module - _moduleList[moduleNo] = _skyDisk->loadScriptFile(moduleNo + F_MODULE_0); - scriptData = _moduleList[moduleNo]; // module has been loaded - } + /// process a script + /// low level interface to interpreter - uint16 *moduleStart = scriptData; + uint16 moduleNo = scriptNo >> 12; + uint16 *scriptData = _moduleList[moduleNo]; // get module address - debug(3, "Doing Script: %d:%d:%x", moduleNo, scriptNo & 0xFFF, offset ? (offset - moduleStart[scriptNo & 0xFFF]) : 0); + if (!scriptData) { // We need to load the script module + _moduleList[moduleNo] = _skyDisk->loadScriptFile(moduleNo + F_MODULE_0); + scriptData = _moduleList[moduleNo]; // module has been loaded + } - // WORKAROUND for bug #3149412: "Invalid Mode when giving shades to travel agent" - // Using the dark glasses on Trevor (travel agent) multiple times in succession would - // wreck the trevor compact's mode, as the script in question doesn't account for using - // this item at this point in the game (you will only have it here if you play the game - // in an unusual way) and thus would loop indefinitely / never drop out. - // To prevent this, we trigger the generic response by pretending we're using an item - // which the script /does/ handle. - if (scriptNo == TREVOR_SPEECH && _scriptVariables[OBJECT_HELD] == IDO_SHADES) - _scriptVariables[OBJECT_HELD] = IDO_GLASS; + uint16 *moduleStart = scriptData; + debug(3, "Doing Script: %d:%d:%x", moduleNo, scriptNo & 0xFFF, offset ? (offset - moduleStart[scriptNo & 0xFFF]) : 0); - // Check whether we have an offset or what - if (offset) - scriptData = moduleStart + offset; - else - scriptData += scriptData[scriptNo & 0x0FFF]; + // WORKAROUND for bug #3149412: "Invalid Mode when giving shades to travel agent" + // Using the dark glasses on Trevor (travel agent) multiple times in succession would + // wreck the trevor compact's mode, as the script in question doesn't account for using + // this item at this point in the game (you will only have it here if you play the game + // in an unusual way) and thus would loop indefinitely / never drop out. + // To prevent this, we trigger the generic response by pretending we're using an item + // which the script /does/ handle. + if (scriptNo == TREVOR_SPEECH && _scriptVariables[OBJECT_HELD] == IDO_SHADES) + _scriptVariables[OBJECT_HELD] = IDO_GLASS; - uint32 a = 0, b = 0, c = 0; - uint16 command, s; - for (;;) { - command = *scriptData++; // get a command - Debug::script(command, scriptData); - - switch (command) { - case 0: // push_variable - push( _scriptVariables[*scriptData++ / 4] ); - break; - case 1: // less_than - a = pop(); - b = pop(); - if (a > b) - push(1); - else - push(0); - break; - case 2: // push_number - push(*scriptData++); - break; - case 3: // not_equal - a = pop(); - b = pop(); - if (a != b) - push(1); - else - push(0); - break; - case 4: // if_and - a = pop(); - b = pop(); - if (a && b) - push(1); - else - push(0); - break; - case 5: // skip_zero - s = *scriptData++; - - a = pop(); - if (!a) - scriptData += s / 2; - break; - case 6: // pop_var - b = _scriptVariables[*scriptData++ / 4] = pop(); - break; - case 7: // minus - a = pop(); - b = pop(); - push(b-a); - break; - case 8: // plus - a = pop(); - b = pop(); - push(b+a); - break; - case 9: // skip_always - s = *scriptData++; - scriptData += s / 2; - break; - case 10: // if_or - a = pop(); - b = pop(); - if (a || b) - push(1); - else - push(0); - break; - case 11: // call_mcode - { - a = *scriptData++; - assert(a <= 3); - // No, I did not forget the "break"s - switch (a) { - case 3: - c = pop(); - case 2: - b = pop(); - case 1: - a = pop(); - } - - uint16 mcode = *scriptData++ / 4; // get mcode number - Debug::mcode(mcode, a, b, c); + // Check whether we have an offset or what + if (offset) + scriptData = moduleStart + offset; + else + scriptData += scriptData[scriptNo & 0x0FFF]; - Compact *saveCpt = _compact; - bool ret = (this->*_mcodeTable[mcode]) (a, b, c); - _compact = saveCpt; + uint32 a = 0, b = 0, c = 0; + uint16 command, s; - if (!ret) - return (scriptData - moduleStart); - } - break; - case 12: // more_than - a = pop(); - b = pop(); - if (a < b) - push(1); - else - push(0); - break; - case 14: // switch - c = s = *scriptData++; // get number of cases + while(!restartScript) { + command = *scriptData++; // get a command + Debug::script(command, scriptData); - a = pop(); // and value to switch on + switch (command) { + case 0: // push_variable + push( _scriptVariables[*scriptData++ / 4] ); + break; + case 1: // less_than + a = pop(); + b = pop(); + if (a > b) + push(1); + else + push(0); + break; + case 2: // push_number + push(*scriptData++); + break; + case 3: // not_equal + a = pop(); + b = pop(); + if (a != b) + push(1); + else + push(0); + break; + case 4: // if_and + a = pop(); + b = pop(); + if (a && b) + push(1); + else + push(0); + break; + case 5: // skip_zero + s = *scriptData++; - do { - if (a == *scriptData) { - scriptData += scriptData[1] / 2; - scriptData++; - break; + a = pop(); + if (!a) + scriptData += s / 2; + break; + case 6: // pop_var + b = _scriptVariables[*scriptData++ / 4] = pop(); + break; + case 7: // minus + a = pop(); + b = pop(); + push(b-a); + break; + case 8: // plus + a = pop(); + b = pop(); + push(b+a); + break; + case 9: // skip_always + s = *scriptData++; + scriptData += s / 2; + break; + case 10: // if_or + a = pop(); + b = pop(); + if (a || b) + push(1); + else + push(0); + break; + case 11: // call_mcode + { + a = *scriptData++; + assert(a <= 3); + // No, I did not forget the "break"s + switch (a) { + case 3: + c = pop(); + case 2: + b = pop(); + case 1: + a = pop(); + } + + uint16 mcode = *scriptData++ / 4; // get mcode number + Debug::mcode(mcode, a, b, c); + + Compact *saveCpt = _compact; + bool ret = (this->*_mcodeTable[mcode]) (a, b, c); + _compact = saveCpt; + + if (!ret) + return (scriptData - moduleStart); } - scriptData += 2; - } while (--s); - - if (s == 0) - scriptData += *scriptData / 2; // use the default - break; - case 15: // push_offset - push( *(uint16 *)_skyCompact->getCompactElem(_compact, *scriptData++) ); - break; - case 16: // pop_offset - // pop a value into a compact - *(uint16 *)_skyCompact->getCompactElem(_compact, *scriptData++) = (uint16)pop(); - break; - case 17: // is_equal - a = pop(); - b = pop(); - if (a == b) - push(1); - else - push(0); - break; - case 18: { // skip_nz - int16 t = *scriptData++; + break; + case 12: // more_than + a = pop(); + b = pop(); + if (a < b) + push(1); + else + push(0); + break; + case 14: // switch + c = s = *scriptData++; // get number of cases + + a = pop(); // and value to switch on + + do { + if (a == *scriptData) { + scriptData += scriptData[1] / 2; + scriptData++; + break; + } + scriptData += 2; + } while (--s); + + if (s == 0) + scriptData += *scriptData / 2; // use the default + break; + case 15: // push_offset + push( *(uint16 *)_skyCompact->getCompactElem(_compact, *scriptData++) ); + break; + case 16: // pop_offset + // pop a value into a compact + *(uint16 *)_skyCompact->getCompactElem(_compact, *scriptData++) = (uint16)pop(); + break; + case 17: // is_equal a = pop(); - if (a) - scriptData += t / 2; + b = pop(); + if (a == b) + push(1); + else + push(0); + break; + case 18: { // skip_nz + int16 t = *scriptData++; + a = pop(); + if (a) + scriptData += t / 2; + break; + } + case 13: + case 19: // script_exit + return 0; + case 20: // restart_script + offset = 0; + restartScript = true; break; + default: + error("Unknown script command: %d", command); } - case 13: - case 19: // script_exit - return 0; - case 20: // restart_script - offset = 0; - goto script; - default: - error("Unknown script command: %d", command); } - } + } while (restartScript); } bool Logic::fnCacheChip(uint32 a, uint32 b, uint32 c) { -- cgit v1.2.3 From 1cb4af9c4c16c37f5fb9b65d2076e17602ffee84 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Thu, 8 Dec 2011 23:21:40 +0000 Subject: LURE: Reduce usage of 'goto'. Have refrained from changing the usage of 'goto' in the PictureDecoder class (decode.cpp) for the time being, as this class is using these in pseudo-x86 code which is complex and should be replaced anyway. --- engines/lure/hotspots.cpp | 295 +++++++++++++++++++++++----------------------- engines/lure/menu.cpp | 63 +++++----- 2 files changed, 185 insertions(+), 173 deletions(-) (limited to 'engines') diff --git a/engines/lure/hotspots.cpp b/engines/lure/hotspots.cpp index 207c125a0c..2f6d0f23aa 100644 --- a/engines/lure/hotspots.cpp +++ b/engines/lure/hotspots.cpp @@ -4164,6 +4164,7 @@ PathFinderResult PathFinder::process() { bool altFlag; uint16 *pCurrent; PathFinderResult result = PF_UNFINISHED; + bool skipToFinalStep = false; if (!_inProgress) { // Following code only done during first call to method @@ -4186,188 +4187,190 @@ PathFinderResult PathFinder::process() { _inProgress = false; result = PF_OK; - goto final_step; - } - - // Path finding + skipToFinalStep = true; + } else { + // Path finding - _destX >>= 3; - _destY >>= 3; - _pSrc = &_layer[(_yCurrent + 1) * DECODED_PATHS_WIDTH + 1 + _xCurrent]; - _pDest = &_layer[(_yDestCurrent + 1) * DECODED_PATHS_WIDTH + 1 + _xDestCurrent]; + _destX >>= 3; + _destY >>= 3; + _pSrc = &_layer[(_yCurrent + 1) * DECODED_PATHS_WIDTH + 1 + _xCurrent]; + _pDest = &_layer[(_yDestCurrent + 1) * DECODED_PATHS_WIDTH + 1 + _xDestCurrent]; - // Flag starting/ending cells - *_pSrc = 1; - _destOccupied = *_pDest != 0; - result = _destOccupied ? PF_DEST_OCCUPIED : PF_OK; - *_pDest = 0; + // Flag starting/ending cells + *_pSrc = 1; + _destOccupied = *_pDest != 0; + result = _destOccupied ? PF_DEST_OCCUPIED : PF_OK; + *_pDest = 0; - // Set up the current pointer, adjusting away from edges if necessary + // Set up the current pointer, adjusting away from edges if necessary - if (_xCurrent >= _xDestCurrent) { - _xChangeInc = -1; - _xChangeStart = ROOM_PATHS_WIDTH; - } else { - _xChangeInc = 1; - _xChangeStart = 1; - } + if (_xCurrent >= _xDestCurrent) { + _xChangeInc = -1; + _xChangeStart = ROOM_PATHS_WIDTH; + } else { + _xChangeInc = 1; + _xChangeStart = 1; + } - if (_yCurrent >= _yDestCurrent) { - _yChangeInc = -1; - _yChangeStart = ROOM_PATHS_HEIGHT; - } else { - _yChangeInc = 1; - _yChangeStart = 1; + if (_yCurrent >= _yDestCurrent) { + _yChangeInc = -1; + _yChangeStart = ROOM_PATHS_HEIGHT; + } else { + _yChangeInc = 1; + _yChangeStart = 1; + } } } - // Major loop to populate data - _cellPopulated = false; - - while (1) { - // Loop through to process cells in the given area - if (!returnFlag) _yCtr = 0; - while (returnFlag || (_yCtr < ROOM_PATHS_HEIGHT)) { - if (!returnFlag) _xCtr = 0; + if (!skipToFinalStep) { + // Major loop to populate data + _cellPopulated = false; - while (returnFlag || (_xCtr < ROOM_PATHS_WIDTH)) { - if (!returnFlag) { - processCell(&_layer[(_yChangeStart + _yCtr * _yChangeInc) * DECODED_PATHS_WIDTH + - (_xChangeStart + _xCtr * _xChangeInc)]); - if (breakFlag && (_countdownCtr <= 0)) return PF_UNFINISHED; - } else { - returnFlag = false; + while (1) { + // Loop through to process cells in the given area + if (!returnFlag) _yCtr = 0; + while (returnFlag || (_yCtr < ROOM_PATHS_HEIGHT)) { + if (!returnFlag) _xCtr = 0; + + while (returnFlag || (_xCtr < ROOM_PATHS_WIDTH)) { + if (!returnFlag) { + processCell(&_layer[(_yChangeStart + _yCtr * _yChangeInc) * DECODED_PATHS_WIDTH + + (_xChangeStart + _xCtr * _xChangeInc)]); + if (breakFlag && (_countdownCtr <= 0)) return PF_UNFINISHED; + } else { + returnFlag = false; + } + ++_xCtr; } - ++_xCtr; + ++_yCtr; } - ++_yCtr; - } - // If the destination cell has been filled in, then break out of loop - if (*_pDest != 0) break; + // If the destination cell has been filled in, then break out of loop + if (*_pDest != 0) break; - if (_cellPopulated) { - // At least one cell populated, so go repeat loop - _cellPopulated = false; - } else { - result = PF_PART_PATH; - scanFlag = true; - break; + if (_cellPopulated) { + // At least one cell populated, so go repeat loop + _cellPopulated = false; + } else { + result = PF_PART_PATH; + scanFlag = true; + break; + } } - } - _inProgress = false; + _inProgress = false; - if (scanFlag || _destOccupied) { - // Adjust the end point if necessary to stop character walking into occupied area + if (scanFlag || _destOccupied) { + // Adjust the end point if necessary to stop character walking into occupied area - // Restore destination's occupied state if necessary - if (_destOccupied) { - *_pDest = 0xffff; - _destOccupied = false; - } + // Restore destination's occupied state if necessary + if (_destOccupied) { + *_pDest = 0xffff; + _destOccupied = false; + } - // Scan through lines - v = 0xff; - pTemp = _pDest; - scanLine(_destX, -1, pTemp, v); - scanLine(ROOM_PATHS_WIDTH - _destX, 1, pTemp, v); - scanLine(_destY, -DECODED_PATHS_WIDTH, pTemp, v); - scanLine(ROOM_PATHS_HEIGHT - _destY, DECODED_PATHS_WIDTH, pTemp, v); + // Scan through lines + v = 0xff; + pTemp = _pDest; + scanLine(_destX, -1, pTemp, v); + scanLine(ROOM_PATHS_WIDTH - _destX, 1, pTemp, v); + scanLine(_destY, -DECODED_PATHS_WIDTH, pTemp, v); + scanLine(ROOM_PATHS_HEIGHT - _destY, DECODED_PATHS_WIDTH, pTemp, v); + + if (pTemp == _pDest) { + clear(); + return PF_NO_WALK; + } - if (pTemp == _pDest) { - clear(); - return PF_NO_WALK; + _pDest = pTemp; } - _pDest = pTemp; - } + // ****DEBUG**** + if (_hotspot->hotspotId() == PLAYER_ID) { + for (int ctr = 0; ctr < DECODED_PATHS_WIDTH * DECODED_PATHS_HEIGHT; ++ctr) + Room::getReference().tempLayer[ctr] = _layer[ctr]; + } - // ****DEBUG**** - if (_hotspot->hotspotId() == PLAYER_ID) { - for (int ctr = 0; ctr < DECODED_PATHS_WIDTH * DECODED_PATHS_HEIGHT; ++ctr) - Room::getReference().tempLayer[ctr] = _layer[ctr]; - } + // Determine the walk path by working backwards from the destination, adding in the + // walking steps in reverse order until source is reached + int stageCtr; + for (stageCtr = 0; stageCtr < 3; ++stageCtr) { + // Clear out any previously determined directions + clear(); - // Determine the walk path by working backwards from the destination, adding in the - // walking steps in reverse order until source is reached - int stageCtr; - for (stageCtr = 0; stageCtr < 3; ++stageCtr) { - // Clear out any previously determined directions - clear(); + altFlag = stageCtr == 1; + pCurrent = _pDest; + + numSteps = 0; + currDirection = NO_DIRECTION; + while (1) { + v = *pCurrent - 1; + if (v == 0) break; + + newDirection = NO_DIRECTION; + if (!altFlag && (currDirection != LEFT) && (currDirection != RIGHT)) { + // Standard order direction checking + if (*(pCurrent - DECODED_PATHS_WIDTH) == v) newDirection = DOWN; + else if (*(pCurrent + DECODED_PATHS_WIDTH) == v) newDirection = UP; + else if (*(pCurrent + 1) == v) newDirection = LEFT; + else if (*(pCurrent - 1) == v) newDirection = RIGHT; + } else { + // Alternate order direction checking + if (*(pCurrent + 1) == v) newDirection = LEFT; + else if (*(pCurrent - 1) == v) newDirection = RIGHT; + else if (*(pCurrent - DECODED_PATHS_WIDTH) == v) newDirection = DOWN; + else if (*(pCurrent + DECODED_PATHS_WIDTH) == v) newDirection = UP; + } + if (newDirection == NO_DIRECTION) + error("Path finding process failed"); - altFlag = stageCtr == 1; - pCurrent = _pDest; + // Process for the specified direction + if (newDirection != currDirection) add(newDirection, 0); - numSteps = 0; - currDirection = NO_DIRECTION; - while (1) { - v = *pCurrent - 1; - if (v == 0) break; - - newDirection = NO_DIRECTION; - if (!altFlag && (currDirection != LEFT) && (currDirection != RIGHT)) { - // Standard order direction checking - if (*(pCurrent - DECODED_PATHS_WIDTH) == v) newDirection = DOWN; - else if (*(pCurrent + DECODED_PATHS_WIDTH) == v) newDirection = UP; - else if (*(pCurrent + 1) == v) newDirection = LEFT; - else if (*(pCurrent - 1) == v) newDirection = RIGHT; - } else { - // Alternate order direction checking - if (*(pCurrent + 1) == v) newDirection = LEFT; - else if (*(pCurrent - 1) == v) newDirection = RIGHT; - else if (*(pCurrent - DECODED_PATHS_WIDTH) == v) newDirection = DOWN; - else if (*(pCurrent + DECODED_PATHS_WIDTH) == v) newDirection = UP; - } - if (newDirection == NO_DIRECTION) - error("Path finding process failed"); - - // Process for the specified direction - if (newDirection != currDirection) add(newDirection, 0); + switch (newDirection) { + case UP: + pCurrent += DECODED_PATHS_WIDTH; + break; - switch (newDirection) { - case UP: - pCurrent += DECODED_PATHS_WIDTH; - break; + case DOWN: + pCurrent -= DECODED_PATHS_WIDTH; + break; - case DOWN: - pCurrent -= DECODED_PATHS_WIDTH; - break; + case LEFT: + ++pCurrent; + break; - case LEFT: - ++pCurrent; - break; + case RIGHT: + --pCurrent; + break; - case RIGHT: - --pCurrent; - break; + default: + break; + } - default: - break; + ++numSteps; + top().rawSteps() += 8; + currDirection = newDirection; } - ++numSteps; - top().rawSteps() += 8; - currDirection = newDirection; + if (stageCtr == 0) + // Save the number of steps needed + savedSteps = numSteps; + if ((stageCtr == 1) && (numSteps <= savedSteps)) + // Less steps were needed, so break out + break; } - if (stageCtr == 0) - // Save the number of steps needed - savedSteps = numSteps; - if ((stageCtr == 1) && (numSteps <= savedSteps)) - // Less steps were needed, so break out - break; - } - - // Add final movement if necessary + // Add final movement if necessary - if (result == PF_OK) { - if (_xDestPos < 0) - addBack(LEFT, -_xDestPos); - else if (_xDestPos > 0) - addBack(RIGHT, _xDestPos); + if (result == PF_OK) { + if (_xDestPos < 0) + addBack(LEFT, -_xDestPos); + else if (_xDestPos > 0) + addBack(RIGHT, _xDestPos); + } } -final_step: + // Final Step if (_xPos < 0) add(RIGHT, -_xPos); else if (_xPos > 0) add(LEFT, _xPos); diff --git a/engines/lure/menu.cpp b/engines/lure/menu.cpp index 9919471c76..61de2bf165 100644 --- a/engines/lure/menu.cpp +++ b/engines/lure/menu.cpp @@ -515,7 +515,9 @@ uint16 PopupMenu::Show(int numEntries, const char *actions[]) { r.top = Surface::textY(); r.bottom = s->height() - Surface::textY() + 1; - for (;;) { + bool bailOut = false; + + while (!bailOut) { if (refreshFlag) { // Set up the contents of the menu s->fillRect(r, bgColor); @@ -546,8 +548,8 @@ uint16 PopupMenu::Show(int numEntries, const char *actions[]) { while (e.pollEvent()) { if (engine.shouldQuit()) { selectedIndex = 0xffff; - goto bail_out; - + bailOut = true; + break; } else if (e.type() == Common::EVENT_WHEELUP) { // Scroll upwards if (selectedIndex > 0) { @@ -571,10 +573,12 @@ uint16 PopupMenu::Show(int numEntries, const char *actions[]) { ++selectedIndex; refreshFlag = true; } else if ((keycode == Common::KEYCODE_RETURN) || (keycode == Common::KEYCODE_KP_ENTER)) { - goto bail_out; + bailOut = true; + break; } else if (keycode == Common::KEYCODE_ESCAPE) { selectedIndex = 0xffff; - goto bail_out; + bailOut = true; + break; } #ifdef LURE_CLICKABLE_MENUS @@ -586,46 +590,51 @@ uint16 PopupMenu::Show(int numEntries, const char *actions[]) { if (r.contains(x, y)) { selectedIndex = (y - r.top) / FONT_HEIGHT; if (e.type() == Common::EVENT_LBUTTONDOWN) - goto bail_out; + bailOut = true; + break; } #else } else if ((e.type() == Common::EVENT_LBUTTONDOWN) || (e.type() == Common::EVENT_MBUTTONDOWN)) { //mouse.waitForRelease(); - goto bail_out; + bailOut = true; + break; #endif } else if (e.type() == Common::EVENT_RBUTTONDOWN) { mouse.waitForRelease(); selectedIndex = 0xffff; - goto bail_out; + bailOut = true; + break; } } + if (!bailOut) { #ifndef LURE_CLICKABLE_MENUS - // Warping the mouse to "neutral" even if the top/bottom menu - // entry has been reached has both pros and cons. It makes the - // menu behave a bit more sensibly, but it also makes it harder - // to move the mouse pointer out of the ScummVM window. - - if (mouse.y() < yMiddle - POPMENU_CHANGE_SENSITIVITY) { - if (selectedIndex > 0) { - --selectedIndex; - refreshFlag = true; - } - mouse.setPosition(FULL_SCREEN_WIDTH / 2, yMiddle); - } else if (mouse.y() > yMiddle + POPMENU_CHANGE_SENSITIVITY) { - if (selectedIndex < numEntries - 1) { - ++selectedIndex; - refreshFlag = true; + // Warping the mouse to "neutral" even if the top/bottom menu + // entry has been reached has both pros and cons. It makes the + // menu behave a bit more sensibly, but it also makes it harder + // to move the mouse pointer out of the ScummVM window. + + if (mouse.y() < yMiddle - POPMENU_CHANGE_SENSITIVITY) { + if (selectedIndex > 0) { + --selectedIndex; + refreshFlag = true; + } + mouse.setPosition(FULL_SCREEN_WIDTH / 2, yMiddle); + } else if (mouse.y() > yMiddle + POPMENU_CHANGE_SENSITIVITY) { + if (selectedIndex < numEntries - 1) { + ++selectedIndex; + refreshFlag = true; + } + mouse.setPosition(FULL_SCREEN_WIDTH / 2, yMiddle); } - mouse.setPosition(FULL_SCREEN_WIDTH / 2, yMiddle); - } #endif - system.delayMillis(20); + system.delayMillis(20); + } } -bail_out: + // bailOut delete s; #ifndef LURE_CLICKABLE_MENUS -- cgit v1.2.3 From f722542ceea557e906699c60b10b3ace1f41c238 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Sat, 10 Dec 2011 20:12:35 +0000 Subject: AGI: Replace usage of 'goto'. --- engines/agi/cycle.cpp | 75 +++++++++-------- engines/agi/menu.cpp | 129 ++++++++++++++-------------- engines/agi/preagi_winnie.cpp | 61 ++++++++------ engines/agi/predictive.cpp | 34 ++++---- engines/agi/saveload.cpp | 189 +++++++++++++++++++++--------------------- engines/agi/text.cpp | 22 +++-- 6 files changed, 265 insertions(+), 245 deletions(-) (limited to 'engines') diff --git a/engines/agi/cycle.cpp b/engines/agi/cycle.cpp index 99649fb437..5daadbd1df 100644 --- a/engines/agi/cycle.cpp +++ b/engines/agi/cycle.cpp @@ -248,44 +248,47 @@ int AgiEngine::mainCycle() { if (kascii) setvar(vKey, kascii); -process_key: - - switch (_game.inputMode) { - case INPUT_NORMAL: - if (!handleController(key)) { - if (key == 0 || !_game.inputEnabled) - break; - handleKeys(key); - - // if ESC pressed, activate menu before - // accept.input from the interpreter cycle - // sets the input mode to normal again - // (closes: #540856) - if (key == KEY_ESCAPE) { - key = 0; - goto process_key; + bool restartProcessKey; + do { + restartProcessKey = false; + + switch (_game.inputMode) { + case INPUT_NORMAL: + if (!handleController(key)) { + if (key == 0 || !_game.inputEnabled) + break; + handleKeys(key); + + // if ESC pressed, activate menu before + // accept.input from the interpreter cycle + // sets the input mode to normal again + // (closes: #540856) + if (key == KEY_ESCAPE) { + key = 0; + restartProcessKey = true; + } + + // commented out to close Sarien bug #438872 + //if (key) + // _game.keypress = key; } - - // commented out to close Sarien bug #438872 - //if (key) - // _game.keypress = key; + break; + case INPUT_GETSTRING: + handleController(key); + handleGetstring(key); + setvar(vKey, 0); // clear ENTER key + break; + case INPUT_MENU: + _menu->keyhandler(key); + _gfx->doUpdate(); + return false; + case INPUT_NONE: + handleController(key); + if (key) + _game.keypress = key; + break; } - break; - case INPUT_GETSTRING: - handleController(key); - handleGetstring(key); - setvar(vKey, 0); // clear ENTER key - break; - case INPUT_MENU: - _menu->keyhandler(key); - _gfx->doUpdate(); - return false; - case INPUT_NONE: - handleController(key); - if (key) - _game.keypress = key; - break; - } + } while (restartProcessKey); _gfx->doUpdate(); if (_game.msgBoxTicks > 0) diff --git a/engines/agi/menu.cpp b/engines/agi/menu.cpp index b504cd3e30..cac1701596 100644 --- a/engines/agi/menu.cpp +++ b/engines/agi/menu.cpp @@ -279,6 +279,7 @@ bool Menu::keyhandler(int key) { static int clockVal; static int menuActive = false; static int buttonUsed = 0; + bool exitMenu = false; if (!_vm->getflag(fMenusWork) && !(_vm->getFeatures() & GF_MENUS)) return false; @@ -288,9 +289,8 @@ bool Menu::keyhandler(int key) { _vm->_game.clockEnabled = false; drawMenuBar(); } - // + // Mouse handling - // if (_vm->_mouse.button) { int hmenu, vmenu; @@ -372,83 +372,84 @@ bool Menu::keyhandler(int key) { debugC(6, kDebugLevelMenu | kDebugLevelInput, "event %d registered", d->event); _vm->_game.controllerOccured[d->event] = true; _vm->_menuSelected = true; - - goto exit_menu; + break; } } } - goto exit_menu; + exitMenu = true; } } - if (!menuActive) { - if (_hCurMenu >= 0) { - drawMenuHilite(_hCurMenu); - drawMenuOption(_hCurMenu); - if (!buttonUsed && _vCurMenu >= 0) - drawMenuOptionHilite(_hCurMenu, _vCurMenu); + if (!exitMenu) { + if (!menuActive) { + if (_hCurMenu >= 0) { + drawMenuHilite(_hCurMenu); + drawMenuOption(_hCurMenu); + if (!buttonUsed && _vCurMenu >= 0) + drawMenuOptionHilite(_hCurMenu, _vCurMenu); + } + menuActive = true; } - menuActive = true; - } - switch (key) { - case KEY_ESCAPE: - debugC(6, kDebugLevelMenu | kDebugLevelInput, "KEY_ESCAPE"); - goto exit_menu; - case KEY_ENTER: - { - debugC(6, kDebugLevelMenu | kDebugLevelInput, "KEY_ENTER"); - AgiMenuOption* d = getMenuOption(_hCurMenu, _vCurMenu); - - if (d->enabled) { - debugC(6, kDebugLevelMenu | kDebugLevelInput, "event %d registered", d->event); - _vm->_game.controllerOccured[d->event] = true; - _vm->_menuSelected = true; - goto exit_menu; + switch (key) { + case KEY_ESCAPE: + debugC(6, kDebugLevelMenu | kDebugLevelInput, "KEY_ESCAPE"); + exitMenu = true; + break; + case KEY_ENTER: + { + debugC(6, kDebugLevelMenu | kDebugLevelInput, "KEY_ENTER"); + AgiMenuOption* d = getMenuOption(_hCurMenu, _vCurMenu); + + if (d->enabled) { + debugC(6, kDebugLevelMenu | kDebugLevelInput, "event %d registered", d->event); + _vm->_game.controllerOccured[d->event] = true; + _vm->_menuSelected = true; + exitMenu = true; + } + break; } - break; - } - case KEY_DOWN: - case KEY_UP: - _vCurMenu += key == KEY_DOWN ? 1 : -1; + case KEY_DOWN: + case KEY_UP: + _vCurMenu += key == KEY_DOWN ? 1 : -1; - if (_vCurMenu < 0) - _vCurMenu = _vMaxMenu[_hCurMenu]; - if (_vCurMenu > _vMaxMenu[_hCurMenu]) - _vCurMenu = 0; + if (_vCurMenu < 0) + _vCurMenu = _vMaxMenu[_hCurMenu]; + if (_vCurMenu > _vMaxMenu[_hCurMenu]) + _vCurMenu = 0; - drawMenuOption(_hCurMenu); - drawMenuOptionHilite(_hCurMenu, _vCurMenu); - break; - case KEY_RIGHT: - case KEY_LEFT: - _hCurMenu += key == KEY_RIGHT ? 1 : -1; - - if (_hCurMenu < 0) - _hCurMenu = _hMaxMenu; - if (_hCurMenu > _hMaxMenu) - _hCurMenu = 0; - - _vCurMenu = 0; - newMenuSelected(_hCurMenu); - drawMenuOptionHilite(_hCurMenu, _vCurMenu); - break; - } + drawMenuOption(_hCurMenu); + drawMenuOptionHilite(_hCurMenu, _vCurMenu); + break; + case KEY_RIGHT: + case KEY_LEFT: + _hCurMenu += key == KEY_RIGHT ? 1 : -1; - return true; + if (_hCurMenu < 0) + _hCurMenu = _hMaxMenu; + if (_hCurMenu > _hMaxMenu) + _hCurMenu = 0; -exit_menu: - buttonUsed = 0; - _picture->showPic(); - _vm->writeStatus(); + _vCurMenu = 0; + newMenuSelected(_hCurMenu); + drawMenuOptionHilite(_hCurMenu, _vCurMenu); + break; + } + } - _vm->setvar(vKey, 0); - _vm->_game.keypress = 0; - _vm->_game.clockEnabled = clockVal; - _vm->oldInputMode(); + if (exitMenu) { + buttonUsed = 0; + _picture->showPic(); + _vm->writeStatus(); - debugC(3, kDebugLevelMenu, "exit_menu: input mode reset to %d", _vm->_game.inputMode); - menuActive = false; + _vm->setvar(vKey, 0); + _vm->_game.keypress = 0; + _vm->_game.clockEnabled = clockVal; + _vm->oldInputMode(); + + debugC(3, kDebugLevelMenu, "exit_menu: input mode reset to %d", _vm->_game.inputMode); + menuActive = false; + } return true; } diff --git a/engines/agi/preagi_winnie.cpp b/engines/agi/preagi_winnie.cpp index cc5c2470ae..53863a8c7e 100644 --- a/engines/agi/preagi_winnie.cpp +++ b/engines/agi/preagi_winnie.cpp @@ -1006,36 +1006,47 @@ void WinnieEngine::gameLoop() { WTP_ROOM_HDR hdr; uint8 *roomdata = (uint8 *)malloc(4096); int iBlock; + uint8 decodePhase = 0; -phase0: - if (!_gameStateWinnie.nObjMiss && (_room == IDI_WTP_ROOM_PICNIC)) - _room = IDI_WTP_ROOM_PARTY; + while (!shouldQuit()) { + if (decodePhase == 0) { + if (!_gameStateWinnie.nObjMiss && (_room == IDI_WTP_ROOM_PICNIC)) + _room = IDI_WTP_ROOM_PARTY; - readRoom(_room, roomdata, hdr); - drawRoomPic(); - _gfx->doUpdate(); + readRoom(_room, roomdata, hdr); + drawRoomPic(); + _gfx->doUpdate(); + decodePhase = 1; + } -phase1: - if (getObjInRoom(_room)) { - printObjStr(getObjInRoom(_room), IDI_WTP_OBJ_DESC); - getSelection(kSelAnyKey); - } + if (decodePhase == 1) { + if (getObjInRoom(_room)) { + printObjStr(getObjInRoom(_room), IDI_WTP_OBJ_DESC); + getSelection(kSelAnyKey); + } + decodePhase = 2; + } -phase2: - for (iBlock = 0; iBlock < IDI_WTP_MAX_BLOCK; iBlock++) { - if (parser(hdr.ofsDesc[iBlock] - _roomOffset, iBlock, roomdata) == IDI_WTP_PAR_BACK) - goto phase1; - } + if (decodePhase == 2) { + for (iBlock = 0; iBlock < IDI_WTP_MAX_BLOCK; iBlock++) { + if (parser(hdr.ofsDesc[iBlock] - _roomOffset, iBlock, roomdata) == IDI_WTP_PAR_BACK) { + decodePhase = 1; + break; + } + } + if (decodePhase == 2) + decodePhase = 3; + } - while (!shouldQuit()) { - for (iBlock = 0; iBlock < IDI_WTP_MAX_BLOCK; iBlock++) { - switch (parser(hdr.ofsBlock[iBlock] - _roomOffset, iBlock, roomdata)) { - case IDI_WTP_PAR_GOTO: - goto phase0; - break; - case IDI_WTP_PAR_BACK: - goto phase2; - break; + if (decodePhase == 3) { + for (iBlock = 0; iBlock < IDI_WTP_MAX_BLOCK; iBlock++) { + if (parser(hdr.ofsBlock[iBlock] - _roomOffset, iBlock, roomdata) == IDI_WTP_PAR_GOTO) { + decodePhase = 0; + break; + } else if (parser(hdr.ofsBlock[iBlock] - _roomOffset, iBlock, roomdata) == IDI_WTP_PAR_BACK) { + decodePhase = 2; + break; + } } } } diff --git a/engines/agi/predictive.cpp b/engines/agi/predictive.cpp index edfe83b1cb..3290068d5a 100644 --- a/engines/agi/predictive.cpp +++ b/engines/agi/predictive.cpp @@ -96,8 +96,6 @@ void bringWordtoTop(char *str, int wordnum) { } bool AgiEngine::predictiveDialog() { - int key = 0, active = -1, lastactive = 0; - bool rc = false; uint8 x; int y; int bx[17], by[17]; @@ -105,7 +103,6 @@ bool AgiEngine::predictiveDialog() { char temp[MAXWORDLEN + 1], repeatcount[MAXWORDLEN]; AgiBlock tmpwindow; bool navigationwithkeys = false; - bool processkey; const char *buttonStr[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "0" }; const char *buttons[] = { @@ -189,8 +186,11 @@ bool AgiEngine::predictiveDialog() { int mode = kModePre; bool needRefresh = true; - - while (!shouldQuit()) { + int active = -1, lastactive = 0; + bool rc = false; + bool closeDialog = false; + bool enterPredictiveResult = false; + while (!closeDialog && !shouldQuit()) { if (needRefresh) { for (int i = 0; buttons[i]; i++) { int color1 = colors[i * 2]; @@ -234,9 +234,10 @@ bool AgiEngine::predictiveDialog() { _gfx->doUpdate(); } + bool processkey = false; + pollTimer(); - key = doPollKeyboard(); - processkey = false; + int key = doPollKeyboard(); switch (key) { case KEY_ENTER: if (navigationwithkeys) { @@ -251,7 +252,8 @@ bool AgiEngine::predictiveDialog() { break; case KEY_ESCAPE: rc = false; - goto getout; + closeDialog = true; + break; case BUTTON_LEFT: navigationwithkeys = false; for (int i = 0; buttons[i]; i++) { @@ -361,7 +363,7 @@ bool AgiEngine::predictiveDialog() { break; } - if (processkey) { + if (processkey && !closeDialog) { if (active >= 0) { needRefresh = true; lastactive = active; @@ -442,7 +444,8 @@ bool AgiEngine::predictiveDialog() { if (mode == kModePre && _predictiveDictActLine && numMatchingWords > 1 && _wordNumber != 0) bringWordtoTop(_predictiveDictActLine, _wordNumber); rc = true; - goto press; + enterPredictiveResult = true; + closeDialog = true; } else if (active == 14) { // Mode mode++; if (mode > kModeAbc) @@ -456,17 +459,18 @@ bool AgiEngine::predictiveDialog() { _currentWord.clear(); memset(repeatcount, 0, sizeof(repeatcount)); } else { - goto press; + enterPredictiveResult = true; + closeDialog = true; } } } } - press: - Common::strlcpy(_predictiveResult, prefix.c_str(), sizeof(_predictiveResult)); - Common::strlcat(_predictiveResult, _currentWord.c_str(), sizeof(_predictiveResult)); + if (enterPredictiveResult) { + Common::strlcpy(_predictiveResult, prefix.c_str(), sizeof(_predictiveResult)); + Common::strlcat(_predictiveResult, _currentWord.c_str(), sizeof(_predictiveResult)); + } - getout: // if another window was shown, bring it up again if (!tmpwindow.active) closeWindow(); diff --git a/engines/agi/saveload.cpp b/engines/agi/saveload.cpp index 1bcabd507f..00d6a1c8dd 100644 --- a/engines/agi/saveload.cpp +++ b/engines/agi/saveload.cpp @@ -609,8 +609,8 @@ int AgiEngine::selectSlot() { AllowSyntheticEvents on(this); int oldFirstSlot = _firstSlot + 1; int oldActive = active + 1; - - while (!(shouldQuit() || _restartGame)) { + bool exitSelectSlot = false; + while (!exitSelectSlot && !(shouldQuit() || _restartGame)) { int sbPos = 0; // Use the extreme scrollbar positions only if the extreme @@ -661,119 +661,122 @@ int AgiEngine::selectSlot() { // out of the dead loop if (getflag(fRestoreJustRan)) { rc = -2; - goto getout; + exitSelectSlot = true; } - switch (key) { - case KEY_ENTER: - rc = active; - strncpy(_game.strings[MAX_STRINGS], desc[i], MAX_STRINGLEN); - goto press; - case KEY_ESCAPE: - rc = -1; - goto getout; - case BUTTON_LEFT: - if (_gfx->testButton(buttonX[0], buttonY, buttonText[0])) { + if (!exitSelectSlot) { + switch (key) { + case KEY_ENTER: rc = active; strncpy(_game.strings[MAX_STRINGS], desc[i], MAX_STRINGLEN); - goto press; - } - if (_gfx->testButton(buttonX[1], buttonY, buttonText[1])) { + debugC(8, kDebugLevelMain | kDebugLevelInput, "Button pressed: %d", rc); + exitSelectSlot = true; + break; + case KEY_ESCAPE: rc = -1; - goto getout; - } - slotClicked = ((int)_mouse.y - 1) / CHAR_COLS - (vm + 4); - xmin = (hm + 1) * CHAR_COLS; - xmax = xmin + CHAR_COLS * 34; - if ((int)_mouse.x >= xmin && (int)_mouse.x <= xmax) { - if (slotClicked >= 0 && slotClicked < NUM_VISIBLE_SLOTS) - active = slotClicked; - } - xmin = (hm + 36) * CHAR_COLS; - xmax = xmin + CHAR_COLS; - if ((int)_mouse.x >= xmin && (int)_mouse.x <= xmax) { - if (slotClicked >= 0 && slotClicked < NUM_VISIBLE_SLOTS) { - if (slotClicked == 0) - keyEnqueue(KEY_UP); - else if (slotClicked == NUM_VISIBLE_SLOTS - 1) - keyEnqueue(KEY_DOWN); - else if (slotClicked < sbPos) - keyEnqueue(KEY_UP_RIGHT); - else if (slotClicked > sbPos) - keyEnqueue(KEY_DOWN_RIGHT); + exitSelectSlot = true; + break; + case BUTTON_LEFT: + if (_gfx->testButton(buttonX[0], buttonY, buttonText[0])) { + rc = active; + strncpy(_game.strings[MAX_STRINGS], desc[i], MAX_STRINGLEN); + debugC(8, kDebugLevelMain | kDebugLevelInput, "Button pressed: %d", rc); + exitSelectSlot = true; + } else if (_gfx->testButton(buttonX[1], buttonY, buttonText[1])) { + rc = -1; + exitSelectSlot = true; + } else { + slotClicked = ((int)_mouse.y - 1) / CHAR_COLS - (vm + 4); + xmin = (hm + 1) * CHAR_COLS; + xmax = xmin + CHAR_COLS * 34; + if ((int)_mouse.x >= xmin && (int)_mouse.x <= xmax) { + if (slotClicked >= 0 && slotClicked < NUM_VISIBLE_SLOTS) + active = slotClicked; + } + xmin = (hm + 36) * CHAR_COLS; + xmax = xmin + CHAR_COLS; + if ((int)_mouse.x >= xmin && (int)_mouse.x <= xmax) { + if (slotClicked >= 0 && slotClicked < NUM_VISIBLE_SLOTS) { + if (slotClicked == 0) + keyEnqueue(KEY_UP); + else if (slotClicked == NUM_VISIBLE_SLOTS - 1) + keyEnqueue(KEY_DOWN); + else if (slotClicked < sbPos) + keyEnqueue(KEY_UP_RIGHT); + else if (slotClicked > sbPos) + keyEnqueue(KEY_DOWN_RIGHT); + } + } } - } - break; - case KEY_DOWN: - active++; - if (active >= NUM_VISIBLE_SLOTS) { - if (_firstSlot + NUM_VISIBLE_SLOTS < NUM_SLOTS) { + break; + + case KEY_DOWN: + active++; + if (active >= NUM_VISIBLE_SLOTS) { + if (_firstSlot + NUM_VISIBLE_SLOTS < NUM_SLOTS) { + _firstSlot++; + for (i = 1; i < NUM_VISIBLE_SLOTS; i++) + memcpy(desc[i - 1], desc[i], sizeof(desc[0])); + getSavegameDescription(_firstSlot + NUM_VISIBLE_SLOTS - 1, desc[NUM_VISIBLE_SLOTS - 1]); + } + active = NUM_VISIBLE_SLOTS - 1; + } + break; + case KEY_UP: + active--; + if (active < 0) { + active = 0; + if (_firstSlot > 0) { + _firstSlot--; + for (i = NUM_VISIBLE_SLOTS - 1; i > 0; i--) + memcpy(desc[i], desc[i - 1], sizeof(desc[0])); + getSavegameDescription(_firstSlot, desc[0]); + } + } + break; + + // Page Up/Down and mouse wheel scrolling all leave 'active' + // unchanged so that a visible slot will remain selected. + + case WHEEL_DOWN: + if (_firstSlot < NUM_SLOTS - NUM_VISIBLE_SLOTS) { _firstSlot++; for (i = 1; i < NUM_VISIBLE_SLOTS; i++) memcpy(desc[i - 1], desc[i], sizeof(desc[0])); getSavegameDescription(_firstSlot + NUM_VISIBLE_SLOTS - 1, desc[NUM_VISIBLE_SLOTS - 1]); } - active = NUM_VISIBLE_SLOTS - 1; - } - break; - case KEY_UP: - active--; - if (active < 0) { - active = 0; + break; + case WHEEL_UP: if (_firstSlot > 0) { _firstSlot--; for (i = NUM_VISIBLE_SLOTS - 1; i > 0; i--) memcpy(desc[i], desc[i - 1], sizeof(desc[0])); getSavegameDescription(_firstSlot, desc[0]); } + break; + case KEY_DOWN_RIGHT: + // This is probably triggered by Page Down. + _firstSlot += NUM_VISIBLE_SLOTS; + if (_firstSlot > NUM_SLOTS - NUM_VISIBLE_SLOTS) { + _firstSlot = NUM_SLOTS - NUM_VISIBLE_SLOTS; + } + for (i = 0; i < NUM_VISIBLE_SLOTS; i++) + getSavegameDescription(_firstSlot + i, desc[i]); + break; + case KEY_UP_RIGHT: + // This is probably triggered by Page Up. + _firstSlot -= NUM_VISIBLE_SLOTS; + if (_firstSlot < 0) { + _firstSlot = 0; + } + for (i = 0; i < NUM_VISIBLE_SLOTS; i++) + getSavegameDescription(_firstSlot + i, desc[i]); + break; } - break; - - // Page Up/Down and mouse wheel scrolling all leave 'active' - // unchanged so that a visible slot will remain selected. - - case WHEEL_DOWN: - if (_firstSlot < NUM_SLOTS - NUM_VISIBLE_SLOTS) { - _firstSlot++; - for (i = 1; i < NUM_VISIBLE_SLOTS; i++) - memcpy(desc[i - 1], desc[i], sizeof(desc[0])); - getSavegameDescription(_firstSlot + NUM_VISIBLE_SLOTS - 1, desc[NUM_VISIBLE_SLOTS - 1]); - } - break; - case WHEEL_UP: - if (_firstSlot > 0) { - _firstSlot--; - for (i = NUM_VISIBLE_SLOTS - 1; i > 0; i--) - memcpy(desc[i], desc[i - 1], sizeof(desc[0])); - getSavegameDescription(_firstSlot, desc[0]); - } - break; - case KEY_DOWN_RIGHT: - // This is probably triggered by Page Down. - _firstSlot += NUM_VISIBLE_SLOTS; - if (_firstSlot > NUM_SLOTS - NUM_VISIBLE_SLOTS) { - _firstSlot = NUM_SLOTS - NUM_VISIBLE_SLOTS; - } - for (i = 0; i < NUM_VISIBLE_SLOTS; i++) - getSavegameDescription(_firstSlot + i, desc[i]); - break; - case KEY_UP_RIGHT: - // This is probably triggered by Page Up. - _firstSlot -= NUM_VISIBLE_SLOTS; - if (_firstSlot < 0) { - _firstSlot = 0; - } - for (i = 0; i < NUM_VISIBLE_SLOTS; i++) - getSavegameDescription(_firstSlot + i, desc[i]); - break; } _gfx->doUpdate(); } -press: - debugC(8, kDebugLevelMain | kDebugLevelInput, "Button pressed: %d", rc); - -getout: closeWindow(); _noSaveLoadAllowed = false; diff --git a/engines/agi/text.cpp b/engines/agi/text.cpp index 3247862e32..1886a74ab1 100644 --- a/engines/agi/text.cpp +++ b/engines/agi/text.cpp @@ -340,8 +340,6 @@ int AgiEngine::messageBox(const char *s) { int AgiEngine::selectionBox(const char *m, const char **b) { int numButtons = 0; int x, y, i, s; - int key, active = 0; - int rc = -1; int bx[5], by[5]; _noSaveLoadAllowed = true; @@ -380,7 +378,9 @@ int AgiEngine::selectionBox(const char *m, const char **b) { AllowSyntheticEvents on(this); debugC(4, kDebugLevelText, "selectionBox(): waiting..."); - while (!(shouldQuit() || _restartGame)) { + int key, active = 0; + int rc = -1; + while (rc == -1 && !(shouldQuit() || _restartGame)) { for (i = 0; b[i]; i++) _gfx->drawCurrentStyleButton(bx[i], by[i], b[i], i == active, false, i == 0); @@ -389,10 +389,8 @@ int AgiEngine::selectionBox(const char *m, const char **b) { switch (key) { case KEY_ENTER: rc = active; - goto press; - case KEY_ESCAPE: - rc = -1; - goto getout; + debugC(4, kDebugLevelText, "selectionBox(): Button pressed: %d", rc); + break; case KEY_RIGHT: active++; if (active >= numButtons) @@ -407,7 +405,8 @@ int AgiEngine::selectionBox(const char *m, const char **b) { for (i = 0; b[i]; i++) { if (_gfx->testButton(bx[i], by[i], b[i])) { rc = active = i; - goto press; + debugC(4, kDebugLevelText, "selectionBox(): Button pressed: %d", rc); + break; } } break; @@ -418,12 +417,11 @@ int AgiEngine::selectionBox(const char *m, const char **b) { break; } _gfx->doUpdate(); - } -press: - debugC(4, kDebugLevelText, "selectionBox(): Button pressed: %d", rc); + if (key == KEY_ESCAPE) + break; + } -getout: closeWindow(); debugC(2, kDebugLevelText, "selectionBox(): Result = %d", rc); -- cgit v1.2.3 From 1f96dc550c554e5481496b729434e0b36fa2eaa7 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 12 Dec 2011 16:17:15 +0100 Subject: TSAGE: Remove unused method --- engines/tsage/core.h | 1 - 1 file changed, 1 deletion(-) (limited to 'engines') diff --git a/engines/tsage/core.h b/engines/tsage/core.h index cbd3d9f77c..060ffee121 100644 --- a/engines/tsage/core.h +++ b/engines/tsage/core.h @@ -421,7 +421,6 @@ public: virtual void destroy() {} virtual bool startAction(CursorType action, Event &event); virtual void doAction(int action); - virtual bool performAction(CursorType action, Event &event) { return startAction(action, event); } bool contains(const Common::Point &pt); void setBounds(const Rect &newBounds) { _bounds = newBounds; } -- cgit v1.2.3 From 30909b1ae455a7cb615720d5a65616925c3172a3 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 12 Dec 2011 16:17:30 +0100 Subject: TSAGE: Fix warning about hidden remove() method from parent class --- engines/tsage/blue_force/blueforce_logic.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'engines') diff --git a/engines/tsage/blue_force/blueforce_logic.h b/engines/tsage/blue_force/blueforce_logic.h index d0d0e0ee40..f5a3938f2b 100644 --- a/engines/tsage/blue_force/blueforce_logic.h +++ b/engines/tsage/blue_force/blueforce_logic.h @@ -65,6 +65,9 @@ public: void add(EventHandler *obj); void remove(EventHandler *obj); + // The following line prevents compiler warnings about hiding the remove() + // method from the parent class. + virtual void remove() { EventHandler::remove(); } }; class Timer: public EventHandler { -- cgit v1.2.3 From f485450758ffa37c789beb6bd038782dec8d97ad Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 12 Dec 2011 16:22:55 +0100 Subject: HUGO: Fix warning about hidden pause() method from parent class --- engines/hugo/sound.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'engines') diff --git a/engines/hugo/sound.h b/engines/hugo/sound.h index 1e504fbdea..cb6d4e3168 100644 --- a/engines/hugo/sound.h +++ b/engines/hugo/sound.h @@ -43,6 +43,12 @@ public: void pause(bool p); void play(uint8 *stream, uint16 size); + // The following line prevents compiler warnings about hiding the pause() + // method from the parent class. + // FIXME: Maybe the pause(bool p) method should be removed and the + // pause/resume methods of the parent class be used instead? + virtual void pause() { Audio::MidiPlayer::pause(); } + uint32 getBaseTempo(); // Overload Audio::MidiPlayer method -- cgit v1.2.3 From 6310cce74e224818dab3d714afd08a6cf6789874 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 12 Dec 2011 17:17:45 +0100 Subject: AGI: Remove two unused pure virtual methods This avoid warnings, as these methods were being hidden by methods in subclasses with differing signatures. --- engines/agi/agi.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'engines') diff --git a/engines/agi/agi.h b/engines/agi/agi.h index 6bb3beec78..e9923aba2e 100644 --- a/engines/agi/agi.h +++ b/engines/agi/agi.h @@ -809,8 +809,6 @@ public: virtual void replayImageStackCall(uint8 type, int16 p1, int16 p2, int16 p3, int16 p4, int16 p5, int16 p6, int16 p7) = 0; virtual void releaseImageStack() = 0; - virtual int saveGame(const Common::String &fileName, const Common::String &saveName) = 0; - virtual int loadGame(const Common::String &fileName, bool checkId = true) = 0; int _soundemu; -- cgit v1.2.3 From 00e6ab43f8db3b79486f324dfb11febbd4ad8c6b Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 12 Dec 2011 17:24:06 +0100 Subject: AGI: Add FIXME to cmdCallV1 --- engines/agi/op_cmd.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'engines') diff --git a/engines/agi/op_cmd.cpp b/engines/agi/op_cmd.cpp index 41d9cc3ac9..7e04328a67 100644 --- a/engines/agi/op_cmd.cpp +++ b/engines/agi/op_cmd.cpp @@ -1702,6 +1702,9 @@ void cmdSetItemView(AgiGame *state, uint8 *p) { void cmdCallV1(AgiGame *state, uint8 *p) { state->_vm->agiLoadResource(rLOGIC, p0); + // FIXME: The following instruction looks incomplete. + // Maybe something is meant to be assigned to, or read from, + // the logic_list entry? state->logic_list[++state->max_logics]; _v[13] = 1; } -- cgit v1.2.3 From 30b2c37e53852fba8ee73f692492f489b4d86e5a Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 12 Dec 2011 20:00:45 +0200 Subject: DREAMWEB: Convert 'setuptimeduse', 'entrytexts' to C++ and move priestText() to DreamBase --- engines/dreamweb/dreambase.h | 3 ++ engines/dreamweb/dreamgen.cpp | 101 ------------------------------------------ engines/dreamweb/dreamgen.h | 2 - engines/dreamweb/people.cpp | 13 +----- engines/dreamweb/stubs.cpp | 46 +++++++++++++++++++ engines/dreamweb/stubs.h | 2 +- 6 files changed, 52 insertions(+), 115 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 3d5c9ce88b..7ef6a9219e 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -115,6 +115,7 @@ public: const Frame *getReelFrameAX(uint16 frame); void soundOnReels(uint16 reelPointer); void rollEndCredits(); + void priestText(ReelRoutine &routine); // from stubs.cpp void crosshair(); @@ -154,6 +155,7 @@ public: // from use.cpp void placeFreeObject(uint8 index); void removeFreeObject(uint8 index); + void setupTimedUse(uint16 offset, uint16 countToTimed, uint16 timeCount, byte x, byte y); // from vgafades.cpp uint8 *mainPalette(); @@ -209,6 +211,7 @@ public: void createPanel(); void createPanel2(); void showPanel(); + void entryTexts(); }; diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 6d3da6d0f2..76fbf92d83 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -4531,28 +4531,6 @@ void DreamGenContext::removeFreeObject() { es = pop(); } -void DreamGenContext::setupTimedUse() { - STACK_CHECK; - _cmp(data.word(kTimecount), 0); - if (!flags.z()) - return /* (cantsetup) */; - data.byte(kTimedy) = bh; - data.byte(kTimedx) = bl; - data.word(kCounttotimed) = cx; - _add(dx, cx); - data.word(kTimecount) = dx; - bl = al; - bh = 0; - _add(bx, bx); - es = data.word(kPuzzletext); - cx = (66*2); - ax = es.word(bx); - _add(ax, cx); - bx = ax; - data.word(kTimedseg) = es; - data.word(kTimedoffset) = bx; -} - void DreamGenContext::useGun() { STACK_CHECK; _cmp(data.byte(kObjecttype), 4); @@ -5051,85 +5029,6 @@ nomatchslot: goto slotloop; } -void DreamGenContext::entryTexts() { - STACK_CHECK; - _cmp(data.byte(kLocation), 21); - if (!flags.z()) - goto notloc15; - al = 28; - cx = 60; - dx = 11; - bl = 68; - bh = 64; - setupTimedUse(); - return; -notloc15: - _cmp(data.byte(kLocation), 30); - if (!flags.z()) - goto notloc43; - al = 27; - cx = 60; - dx = 11; - bl = 68; - bh = 64; - setupTimedUse(); - return; -notloc43: - _cmp(data.byte(kLocation), 23); - if (!flags.z()) - goto notloc23; - al = 29; - cx = 60; - dx = 11; - bl = 68; - bh = 64; - setupTimedUse(); - return; -notloc23: - _cmp(data.byte(kLocation), 31); - if (!flags.z()) - goto notloc44; - al = 30; - cx = 60; - dx = 11; - bl = 68; - bh = 64; - setupTimedUse(); - return; -notloc44: - _cmp(data.byte(kLocation), 20); - if (!flags.z()) - goto notsarters2; - al = 31; - cx = 60; - dx = 11; - bl = 68; - bh = 64; - setupTimedUse(); - return; -notsarters2: - _cmp(data.byte(kLocation), 24); - if (!flags.z()) - goto notedenlob; - al = 32; - cx = 60; - dx = 3; - bl = 68; - bh = 64; - setupTimedUse(); - return; -notedenlob: - _cmp(data.byte(kLocation), 34); - if (!flags.z()) - return /* (noteden2) */; - al = 33; - cx = 60; - dx = 3; - bl = 68; - bh = 64; - setupTimedUse(); -} - void DreamGenContext::entryAnims() { STACK_CHECK; data.word(kReeltowatch) = -1; diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index ae9bf3bb06..c0c7407f3f 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -491,7 +491,6 @@ public: void useOpenBox(); void clearBuffers(); void getObTextStart(); - void entryTexts(); void putUnderCentre(); void checkObjectSize(); void findText1(); @@ -580,7 +579,6 @@ public: void checkInside(); void findPathOfPoint(); void getDestInfo(); - void setupTimedUse(); void makeCaps(); void read(); void additionalText(); diff --git a/engines/dreamweb/people.cpp b/engines/dreamweb/people.cpp index 889a430a22..efb9a028b6 100644 --- a/engines/dreamweb/people.cpp +++ b/engines/dreamweb/people.cpp @@ -629,25 +629,16 @@ void DreamGenContext::priest(ReelRoutine &routine) { if (checkSpeed(routine)) { routine.incReelPointer(); - push(es); - push(bx); priestText(routine); - bx = pop(); - es = pop(); } } -void DreamGenContext::priestText(ReelRoutine &routine) { +void DreamBase::priestText(ReelRoutine &routine) { uint16 reel = routine.reelPointer(); if (reel < 2 || reel >= 7 || (reel & 1)) return; // nopriesttext - al = ((reel & 0xFF) >> 1) + 50; - bl = 72; - bh = 80; - cx = 54; - dx = 1; - setupTimedUse(); + setupTimedUse((reel >> 1) + 50, 54, 1, 72, 80); } void DreamGenContext::monkAndRyan(ReelRoutine &routine) { diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 162152ccda..e4c9a7514d 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -4317,4 +4317,50 @@ void DreamGenContext::quitKey() { data.byte(kGetback) = 1; } +void DreamGenContext::setupTimedUse() { + DreamBase::setupTimedUse(al, cx, dx, bl, bh); +} + +void DreamBase::setupTimedUse(uint16 textIndex, uint16 countToTimed, uint16 timeCount, byte x, byte y) { + if (data.word(kTimecount) != 0) + return; // can't setup + + data.byte(kTimedy) = y; + data.byte(kTimedx) = x; + data.word(kCounttotimed) = countToTimed; + data.word(kTimecount) = timeCount + countToTimed; + data.word(kTimedseg) = data.word(kPuzzletext); + data.word(kTimedoffset) = kTextstart + getSegment(data.word(kPuzzletext)).word(textIndex * 2); + const uint8 *string = getSegment(data.word(kPuzzletext)).ptr(data.word(kTimedoffset), 0); + debug(1, "setupTimedUse: %d => '%s'", textIndex, string); +} + +void DreamBase::entryTexts() { + switch (data.byte(kLocation)) { + case 21: + setupTimedUse(28, 60, 11, 68, 64); + break; + case 30: + setupTimedUse(27, 60, 11, 68, 64); + break; + case 23: + setupTimedUse(29, 60, 11, 68, 64); + break; + case 31: + setupTimedUse(30, 60, 11, 68, 64); + break; + case 20: + setupTimedUse(31, 60, 11, 68, 64); + break; + case 24: + setupTimedUse(32, 60, 3, 68, 64); + break; + case 34: + setupTimedUse(33, 60, 3, 68, 64); + break; + default: + break; + } +} + } // End of namespace DreamGen diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 4308bd54ea..661eba3633 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -408,7 +408,6 @@ void louisChair(ReelRoutine &routine); void bossMan(ReelRoutine &routine); void priest(ReelRoutine &routine); - void priestText(ReelRoutine &routine); void monkAndRyan(ReelRoutine &routine); void copper(ReelRoutine &routine); void introMonks1(ReelRoutine &routine); @@ -568,5 +567,6 @@ void useButtonA(); void autoAppear(); void quitKey(); + void setupTimedUse(); #endif -- cgit v1.2.3 From b04af6dc314969e4a0ae824dbe39fb385536594b Mon Sep 17 00:00:00 2001 From: Bastien Bouclet Date: Mon, 12 Dec 2011 19:28:18 +0100 Subject: MOHAWK: Display the weight up after resetting the clock puzzle in Myst ME --- engines/mohawk/myst_stacks/myst.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'engines') diff --git a/engines/mohawk/myst_stacks/myst.cpp b/engines/mohawk/myst_stacks/myst.cpp index b6c0a3212f..b3222e0322 100644 --- a/engines/mohawk/myst_stacks/myst.cpp +++ b/engines/mohawk/myst_stacks/myst.cpp @@ -2978,15 +2978,17 @@ void Myst::clockReset() { } void Myst::clockResetWeight() { - // Set video bounds, weight going up + _clockWeightVideo = _vm->_video->playMovie(_vm->wrapMovieFilename("cl1wlfch", kMystStack) , 124, 0); + if (!(_vm->getFeatures() & GF_ME)) { - _clockWeightVideo = _vm->_video->playMovie(_vm->wrapMovieFilename("cl1wlfch", kMystStack) , 124, 0); + // Set video bounds, weight going up _vm->_video->setVideoBounds(_clockWeightVideo, Audio::Timestamp(0, 2214 * 2 - _clockWeightPosition, 600), Audio::Timestamp(0, 2214 * 2, 600)); } else { - //FIXME: Needs QT backwards playing + //FIXME: Needs QT backwards playing, for now just display the weight up warning("Weight going back up not implemented"); + _vm->_video->drawVideoFrame(_clockWeightVideo, Audio::Timestamp(0, 0, 600)); } // Reset position -- cgit v1.2.3 From 6507853b87023ef4b5bab2519b5764fa2ac57bca Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 12 Dec 2011 21:51:25 +0200 Subject: DREAMWEB: Port 'entryanims' to C++ --- engines/dreamweb/dreamgen.cpp | 131 ------------------------------------------ engines/dreamweb/dreamgen.h | 1 - engines/dreamweb/stubs.cpp | 84 ++++++++++++++++++++++++++- engines/dreamweb/stubs.h | 1 + 4 files changed, 82 insertions(+), 135 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 76fbf92d83..f449b8f38e 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -5029,137 +5029,6 @@ nomatchslot: goto slotloop; } -void DreamGenContext::entryAnims() { - STACK_CHECK; - data.word(kReeltowatch) = -1; - data.byte(kWatchmode) = -1; - _cmp(data.byte(kLocation), 33); - if (!flags.z()) - goto notinthebeach; - switchRyanOff(); - data.word(kWatchingtime) = 76*2; - data.word(kReeltowatch) = 0; - data.word(kEndwatchreel) = 76; - data.byte(kWatchspeed) = 1; - data.byte(kSpeedcount) = 1; - return; -notinthebeach: - _cmp(data.byte(kLocation), 44); - if (!flags.z()) - goto notsparkys; - al = 8; - resetLocation(); - data.word(kWatchingtime) = 50*2; - data.word(kReeltowatch) = 247; - data.word(kEndwatchreel) = 297; - data.byte(kWatchspeed) = 1; - data.byte(kSpeedcount) = 1; - switchRyanOff(); - return; -notsparkys: - _cmp(data.byte(kLocation), 22); - if (!flags.z()) - goto notinthelift; - data.word(kWatchingtime) = 31*2; - data.word(kReeltowatch) = 0; - data.word(kEndwatchreel) = 30; - data.byte(kWatchspeed) = 1; - data.byte(kSpeedcount) = 1; - switchRyanOff(); - return; -notinthelift: - _cmp(data.byte(kLocation), 26); - if (!flags.z()) - goto notunderchurch; - data.byte(kSymboltopnum) = 2; - data.byte(kSymbolbotnum) = 1; - return; -notunderchurch: - _cmp(data.byte(kLocation), 45); - if (!flags.z()) - goto notenterdream; - data.byte(kKeeperflag) = 0; - data.word(kWatchingtime) = 296; - data.word(kReeltowatch) = 45; - data.word(kEndwatchreel) = 198; - data.byte(kWatchspeed) = 1; - data.byte(kSpeedcount) = 1; - switchRyanOff(); - return; -notenterdream: - _cmp(data.byte(kReallocation), 46); - if (!flags.z()) - goto notcrystal; - _cmp(data.byte(kSartaindead), 1); - if (!flags.z()) - goto notcrystal; - al = 0; - removeFreeObject(); - return; -notcrystal: - _cmp(data.byte(kLocation), 9); - if (!flags.z()) - goto nottopchurch; - al = 2; - checkIfPathIsOn(); - if (flags.z()) - goto nottopchurch; - _cmp(data.byte(kAidedead), 0); - if (flags.z()) - goto nottopchurch; - al = 3; - checkIfPathIsOn(); - if (!flags.z()) - goto makedoorsopen; - al = 2; - turnPathOn(); -makedoorsopen: - al = 4; - removeSetObject(); - al = 5; - placeSetObject(); - return; -nottopchurch: - _cmp(data.byte(kLocation), 47); - if (!flags.z()) - goto notdreamcentre; - al = 4; - placeSetObject(); - al = 5; - placeSetObject(); - return; -notdreamcentre: - _cmp(data.byte(kLocation), 38); - if (!flags.z()) - goto notcarpark; - data.word(kWatchingtime) = 57*2; - data.word(kReeltowatch) = 4; - data.word(kEndwatchreel) = 57; - data.byte(kWatchspeed) = 1; - data.byte(kSpeedcount) = 1; - switchRyanOff(); - return; -notcarpark: - _cmp(data.byte(kLocation), 32); - if (!flags.z()) - goto notalley; - data.word(kWatchingtime) = 66*2; - data.word(kReeltowatch) = 0; - data.word(kEndwatchreel) = 66; - data.byte(kWatchspeed) = 1; - data.byte(kSpeedcount) = 1; - switchRyanOff(); - return; -notalley: - _cmp(data.byte(kLocation), 24); - if (!flags.z()) - return /* (notedensagain) */; - al = 2; - ah = data.byte(kRoomnum); - _dec(ah); - turnAnyPathOn(); -} - void DreamGenContext::clearBuffers() { STACK_CHECK; es = data.word(kBuffers); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index c0c7407f3f..337a33152c 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -522,7 +522,6 @@ public: void inToInv(); void adjustLeft(); void deleteExText(); - void entryAnims(); void getFreeAd(); void removeObFromInv(); void heavy(); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index e4c9a7514d..20d2b64268 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -4349,13 +4349,13 @@ void DreamBase::entryTexts() { case 31: setupTimedUse(30, 60, 11, 68, 64); break; - case 20: + case 20: // Sarter's 2 setupTimedUse(31, 60, 11, 68, 64); break; - case 24: + case 24: // Eden's lobby setupTimedUse(32, 60, 3, 68, 64); break; - case 34: + case 34: // Eden 2 setupTimedUse(33, 60, 3, 68, 64); break; default: @@ -4363,4 +4363,82 @@ void DreamBase::entryTexts() { } } +void DreamGenContext::entryAnims() { + data.word(kReeltowatch) = 0xFFFF; + data.byte(kWatchmode) = (byte)-1; + + switch (data.byte(kLocation)) { + case 33: // beach + switchRyanOff(); + data.word(kWatchingtime) = 76 * 2; + data.word(kReeltowatch) = 0; + data.word(kEndwatchreel) = 76; + data.byte(kWatchspeed) = 1; + data.byte(kSpeedcount) = 1; + break; + case 44: // Sparky's + al = 8; + resetLocation(); + data.word(kWatchingtime) = 50*2; + data.word(kReeltowatch) = 247; + data.word(kEndwatchreel) = 297; + data.byte(kWatchspeed) = 1; + data.byte(kSpeedcount) = 1; + switchRyanOff(); + break; + case 22: // lift + data.word(kWatchingtime) = 31 * 2; + data.word(kReeltowatch) = 0; + data.word(kEndwatchreel) = 30; + data.byte(kWatchspeed) = 1; + data.byte(kSpeedcount) = 1; + switchRyanOff(); + break; + case 26: // under church + data.byte(kSymboltopnum) = 2; + data.byte(kSymbolbotnum) = 1; + break; + case 45: // entered Dreamweb + data.byte(kKeeperflag) = 0; + data.word(kWatchingtime) = 296; + data.word(kReeltowatch) = 45; + data.word(kEndwatchreel) = 198; + data.byte(kWatchspeed) = 1; + data.byte(kSpeedcount) = 1; + switchRyanOff(); + break; + default: + if (data.byte(kReallocation) == 46 && data.byte(kSartaindead) == 1) { // Crystal + removeFreeObject(0); + } else if (data.byte(kLocation) == 9 && checkIfPathIsOn(2) && data.byte(kAidedead) == 0) { + // Top of church + if (checkIfPathIsOn(3)) + turnPathOn(2); + + // Make doors open + removeSetObject(4); + placeSetObject(5); + } else if (data.byte(kLocation) == 47) { // Dream centre + placeSetObject(4); + placeSetObject(5); + } else if (data.byte(kLocation) == 38) { // Car park + data.word(kWatchingtime) = 57 * 2; + data.word(kReeltowatch) = 4; + data.word(kEndwatchreel) = 57; + data.byte(kWatchspeed) = 1; + data.byte(kSpeedcount) = 1; + switchRyanOff(); + } else if (data.byte(kLocation) == 32) { // Alley + data.word(kWatchingtime) = 66 * 2; + data.word(kReeltowatch) = 0; + data.word(kEndwatchreel) = 66; + data.byte(kWatchspeed) = 1; + data.byte(kSpeedcount) = 1; + switchRyanOff(); + } else if (data.byte(kLocation) == 24) { // Eden's again + turnAnyPathOn(2, data.byte(kRoomnum) - 1); + } + } +} + } // End of namespace DreamGen diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 661eba3633..ca1b68f219 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -568,5 +568,6 @@ void autoAppear(); void quitKey(); void setupTimedUse(); + void entryAnims(); #endif -- cgit v1.2.3 From fc9a1b840707086064692992c5b02e17d7da065d Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 12 Dec 2011 22:43:03 +0200 Subject: DREAMWEB: Port 'getundercentre', 'processtrigger', 'putundercentre', 'triggermessage' to C++ --- engines/dreamweb/dreamgen.cpp | 84 ------------------------------------------- engines/dreamweb/dreamgen.h | 4 --- engines/dreamweb/stubs.cpp | 39 ++++++++++++++++++++ engines/dreamweb/stubs.h | 4 +++ 4 files changed, 43 insertions(+), 88 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index f449b8f38e..d98b238797 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -2821,28 +2821,6 @@ _tmp2: workToScreenM(); } -void DreamGenContext::getUnderCentre() { - STACK_CHECK; - di = 58; - bx = 72; - ds = data.word(kMapstore); - si = 0; - cl = 254; - ch = 110; - multiGet(); -} - -void DreamGenContext::putUnderCentre() { - STACK_CHECK; - di = 58; - bx = 72; - ds = data.word(kMapstore); - si = 0; - cl = 254; - ch = 110; - multiPut(); -} - void DreamGenContext::locationPic() { STACK_CHECK; getDestInfo(); @@ -3544,68 +3522,6 @@ finishpars: di = offset_operand1; } -void DreamGenContext::processTrigger() { - STACK_CHECK; - _cmp(data.byte(kLasttrigger), '1'); - if (!flags.z()) - goto notfirsttrigger; - al = 8; - setLocation(); - al = 45; - triggerMessage(); - return; -notfirsttrigger: - _cmp(data.byte(kLasttrigger), '2'); - if (!flags.z()) - goto notsecondtrigger; - al = 9; - setLocation(); - al = 55; - triggerMessage(); - return; -notsecondtrigger: - _cmp(data.byte(kLasttrigger), '3'); - if (!flags.z()) - return /* (notthirdtrigger) */; - al = 2; - setLocation(); - al = 59; - triggerMessage(); -} - -void DreamGenContext::triggerMessage() { - STACK_CHECK; - push(ax); - di = 174; - bx = 153; - cl = 200; - ch = 63; - ds = data.word(kMapstore); - si = 0; - multiGet(); - ax = pop(); - findPuzText(); - di = 174; - bx = 156; - dl = 141; - ah = 16; - printDirect(); - cx = 140; - hangOn(); - workToScreen(); - cx = 340; - hangOn(); - di = 174; - bx = 153; - cl = 200; - ch = 63; - ds = data.word(kMapstore); - si = 0; - multiPut(); - workToScreen(); - data.byte(kLasttrigger) = 0; -} - void DreamGenContext::runTap() { STACK_CHECK; _cmp(data.byte(kWithobject), 255); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 337a33152c..746f306b3d 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -491,7 +491,6 @@ public: void useOpenBox(); void clearBuffers(); void getObTextStart(); - void putUnderCentre(); void checkObjectSize(); void findText1(); void isRyanHolding(); @@ -544,7 +543,6 @@ public: void purgeALocation(); void notHeldError(); void getSetAd(); - void getUnderCentre(); void showKeys(); void printmessage2(); void findOpenPos(); @@ -572,7 +570,6 @@ public: void useOpened(); void signOn(); void locationPic(); - void triggerMessage(); void swapWithOpen(); void dreamweb(); void checkInside(); @@ -603,7 +600,6 @@ public: void getPersonText(); void parser(); void emergencyPurge(); - void processTrigger(); void transferConToEx(); void adjustDown(); void withWhat(); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 20d2b64268..1521dddfe8 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -862,6 +862,45 @@ void DreamGenContext::putUnderTimed() { multiPut(ds.ptr(si, 0), data.byte(kTimedx), y, 240, kUndertimedysize); } +void DreamGenContext::getUnderCentre() { + ds = data.word(kMapstore); + si = 0; + multiGet(ds.ptr(si, 0), 58, 72, 254, 110); +} + +void DreamGenContext::putUnderCentre() { + ds = data.word(kMapstore); + si = 0; + multiPut(ds.ptr(si, 0), 58, 72, 254, 110); +} + +void DreamGenContext::triggerMessage(uint16 index) { + multiGet(mapStore(), 174, 153, 200, 63); + uint16 offset = kTextstart + getSegment(data.word(kPuzzletext)).word(index * 2); + const uint8 *string = getSegment(data.word(kPuzzletext)).ptr(offset, 0); + uint16 y = 156; + printDirect(&string, 174, &y, 141, true); + hangOn(140); + workToScreenCPP(); + hangOn(340); + multiPut(mapStore(), 174, 153, 200, 63); + workToScreenCPP(); + data.byte(kLasttrigger) = 0; +} + +void DreamGenContext::processTrigger() { + if (data.byte(kLasttrigger) == '1') { + setLocation(8); + triggerMessage(45); + } else if (data.byte(kLasttrigger) == '2') { + setLocation(9); + triggerMessage(55); + } else if (data.byte(kLasttrigger) == '3') { + setLocation(2); + triggerMessage(59); + } +} + void DreamGenContext::useTimedText() { if (data.word(kTimecount) == 0) return; diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index ca1b68f219..5cf0466560 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -569,5 +569,9 @@ void quitKey(); void setupTimedUse(); void entryAnims(); + void getUnderCentre(); + void putUnderCentre(); + void triggerMessage(uint16 index); + void processTrigger(); #endif -- cgit v1.2.3 From d41c89124f035f4922615ea02e9e8e74f6e3ddf6 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 12 Dec 2011 22:43:56 +0200 Subject: DREAMWEB: Fix regression in entryAnims() --- engines/dreamweb/stubs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 1521dddfe8..4a870fa42c 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -4449,7 +4449,7 @@ void DreamGenContext::entryAnims() { default: if (data.byte(kReallocation) == 46 && data.byte(kSartaindead) == 1) { // Crystal removeFreeObject(0); - } else if (data.byte(kLocation) == 9 && checkIfPathIsOn(2) && data.byte(kAidedead) == 0) { + } else if (data.byte(kLocation) == 9 && !checkIfPathIsOn(2) && data.byte(kAidedead) != 0) { // Top of church if (checkIfPathIsOn(3)) turnPathOn(2); -- cgit v1.2.3 From a682734bce80f45dba5e9309cf71a00be9fe50d0 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 12 Dec 2011 22:46:28 +0200 Subject: DREAMWEB: Set volumeDirection as a negative integer, where this is used, instead of 0xFF --- engines/dreamweb/sprite.cpp | 2 +- engines/dreamweb/stubs.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/sprite.cpp b/engines/dreamweb/sprite.cpp index e93a77f3ff..aca935cde9 100644 --- a/engines/dreamweb/sprite.cpp +++ b/engines/dreamweb/sprite.cpp @@ -763,7 +763,7 @@ void DreamBase::rollEndCredits() { playChannel0(16, 255); data.byte(kVolume) = 7; data.byte(kVolumeto) = 0; - data.byte(kVolumedirection) = 0xFF; + data.byte(kVolumedirection) = (byte)-1; multiGet(mapStore(), 75, 20, 160, 160); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 4a870fa42c..4f0661e499 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -576,7 +576,7 @@ void DreamGenContext::dreamweb() { data.byte(kLastflag) = 32; startup1(); data.byte(kVolumeto) = 0; - data.byte(kVolumedirection) = (uint8)-1; + data.byte(kVolumedirection) = (byte)-1; data.byte(kCommandtype) = 255; } @@ -3070,7 +3070,7 @@ void DreamGenContext::intro() { clearPalette(); loadIntroRoom(); data.byte(kVolume) = 7; - data.byte(kVolumedirection) = (uint8)-1; + data.byte(kVolumedirection) = (byte)-1; data.byte(kVolumeto) = 4; playChannel0(12, 255); fadeScreenUps(); @@ -3286,7 +3286,7 @@ void DreamGenContext::gettingShot() { loadIntroRoom(); fadeScreenUps(); data.byte(kVolumeto) = 0; - data.byte(kVolumedirection) = 0xFF; + data.byte(kVolumedirection) = (byte)-1; runEndSeq(); clearBeforeLoad(); } @@ -3935,7 +3935,7 @@ void DreamGenContext::talk() { workToScreenM(); if (data.byte(kSpeechloaded) == 1) { cancelCh1(); - data.byte(kVolumedirection) = 0xFF; + data.byte(kVolumedirection) = (byte)-1; data.byte(kVolumeto) = 0; } } @@ -4258,7 +4258,7 @@ void DreamGenContext::monkSpeaking() { showFrame(tempGraphics(), 160, 72, 0, 128); // show monk workToScreen(); data.byte(kVolume) = 7; - data.byte(kVolumedirection) = 0xFF; + data.byte(kVolumedirection) = (byte)-1; data.byte(kVolumeto) = 5; playChannel0(12, 255); fadeScreenUps(); -- cgit v1.2.3 From e685a171d337e13123f48789780b7f8869b2eb7c Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 12 Dec 2011 22:55:29 +0200 Subject: DREAMWEB: Simplify getUnderCentre(), putUnderCentre() and move some functions to DreamBase --- engines/dreamweb/dreambase.h | 4 ++++ engines/dreamweb/people.cpp | 2 +- engines/dreamweb/stubs.cpp | 42 +++++++++++++++++++----------------------- engines/dreamweb/stubs.h | 4 ---- 4 files changed, 24 insertions(+), 28 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 7ef6a9219e..c7e9546069 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -184,6 +184,10 @@ public: inline uint8 *workspace() { return _workspace; } void clearWork(); + uint8 getLocation(uint8 index); + void setLocation(uint8 index); + void getUnderCentre(); + void putUnderCentre(); uint8 *mapStore(); void panelToMap(); void mapToPanel(); diff --git a/engines/dreamweb/people.cpp b/engines/dreamweb/people.cpp index efb9a028b6..84f6543a19 100644 --- a/engines/dreamweb/people.cpp +++ b/engines/dreamweb/people.cpp @@ -321,7 +321,7 @@ void DreamGenContext::madmansTelly(ReelRoutine &routine) { void DreamGenContext::smokeBloke(ReelRoutine &routine) { if (data.byte(kRockstardead) == 0) { if (routine.b7 & 128) - setLocation(5); + DreamBase::setLocation(5); } if (checkSpeed(routine)) { if (routine.reelPointer() == 100) { diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 4f0661e499..e52ccf03f3 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -862,16 +862,12 @@ void DreamGenContext::putUnderTimed() { multiPut(ds.ptr(si, 0), data.byte(kTimedx), y, 240, kUndertimedysize); } -void DreamGenContext::getUnderCentre() { - ds = data.word(kMapstore); - si = 0; - multiGet(ds.ptr(si, 0), 58, 72, 254, 110); +void DreamBase::getUnderCentre() { + multiGet(mapStore(), 58, 72, 254, 110); } -void DreamGenContext::putUnderCentre() { - ds = data.word(kMapstore); - si = 0; - multiPut(ds.ptr(si, 0), 58, 72, 254, 110); +void DreamBase::putUnderCentre() { + multiPut(mapStore(), 58, 72, 254, 110); } void DreamGenContext::triggerMessage(uint16 index) { @@ -890,13 +886,13 @@ void DreamGenContext::triggerMessage(uint16 index) { void DreamGenContext::processTrigger() { if (data.byte(kLasttrigger) == '1') { - setLocation(8); + DreamBase::setLocation(8); triggerMessage(45); } else if (data.byte(kLasttrigger) == '2') { - setLocation(9); + DreamBase::setLocation(9); triggerMessage(55); } else if (data.byte(kLasttrigger) == '3') { - setLocation(2); + DreamBase::setLocation(2); triggerMessage(59); } } @@ -2505,20 +2501,20 @@ void DreamGenContext::examIcon() { showFrame(engine->icons2(), 254, 5, 3, 0); } -uint8 DreamGenContext::getLocation(uint8 index) { +uint8 DreamBase::getLocation(uint8 index) { return data.byte(kRoomscango + index); } void DreamGenContext::getLocation() { - al = getLocation(al); + al = DreamBase::getLocation(al); } -void DreamGenContext::setLocation(uint8 index) { +void DreamBase::setLocation(uint8 index) { data.byte(kRoomscango + index) = 1; } void DreamGenContext::setLocation() { - setLocation(al); + DreamBase::setLocation(al); } const uint8 *DreamBase::getTextInFile1(uint16 index) { @@ -2581,8 +2577,8 @@ void DreamGenContext::lastFolder() { void DreamGenContext::folderHints() { if (data.byte(kFolderpage) == 5) { - if ((data.byte(kAidedead) != 1) && (getLocation(13) != 1)) { - setLocation(13); + if ((data.byte(kAidedead) != 1) && (DreamBase::getLocation(13) != 1)) { + DreamBase::setLocation(13); showFolder(); const uint8 *string = getTextInFile1(30); printDirect(string, 0, 86, 141, true); @@ -2590,8 +2586,8 @@ void DreamGenContext::folderHints() { hangOnP(200); } } else if (data.byte(kFolderpage) == 9) { - if (getLocation(7) != 1) { - setLocation(7); + if (DreamBase::getLocation(7) != 1) { + DreamBase::setLocation(7); showFolder(); const uint8 *string = getTextInFile1(31); printDirect(string, 0, 86, 141, true); @@ -3353,8 +3349,8 @@ void DreamGenContext::obsThatDoThings() { if (!compare(data.byte(kCommand), data.byte(kObjecttype), id)) return; // notlouiscard - if (getLocation(4) != 1) { - setLocation(4); + if (DreamBase::getLocation(4) != 1) { + DreamBase::setLocation(4); lookAtCard(); } } @@ -4306,7 +4302,7 @@ void DreamGenContext::autoAppear() { // In alley al = 5; resetLocation(); - setLocation(10); + DreamBase::setLocation(10); data.byte(kDestpos) = 10; return; } @@ -4337,7 +4333,7 @@ void DreamGenContext::autoAppear() { data.byte(kNewsitem) = 3; al = 6; resetLocation(); - setLocation(11); + DreamBase::setLocation(11); data.byte(kDestpos) = 11; } else { if (data.byte(kReallocation) == 2 && data.byte(kRockstardead) != 0) diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 5cf0466560..7142bec373 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -362,9 +362,7 @@ void lastFolder(); void folderHints(); void folderExit(); - uint8 getLocation(uint8 index); void getLocation(); - void setLocation(uint8 index); void setLocation(); void loadTempText(); void loadTempText(const char *fileName); @@ -569,8 +567,6 @@ void quitKey(); void setupTimedUse(); void entryAnims(); - void getUnderCentre(); - void putUnderCentre(); void triggerMessage(uint16 index); void processTrigger(); -- cgit v1.2.3 From 47c4b2b7dee13ade60c7810e0d4f216a5ee69e3a Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 12 Dec 2011 23:30:08 +0200 Subject: DREAMWEB: Port 'usecontrol' to C++ --- engines/dreamweb/dreamgen.cpp | 96 ------------------------------------------- engines/dreamweb/dreamgen.h | 1 - engines/dreamweb/stubs.h | 1 + engines/dreamweb/use.cpp | 57 +++++++++++++++++++++++++ 4 files changed, 58 insertions(+), 97 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index d98b238797..3cc0c4e862 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -3955,102 +3955,6 @@ numberpoke3: cs.byte(bx) = al; } -void DreamGenContext::useControl() { - STACK_CHECK; - _cmp(data.byte(kWithobject), 255); - if (!flags.z()) - goto gotcontrolwith; - withWhat(); - return; -gotcontrolwith: - al = data.byte(kWithobject); - ah = data.byte(kWithtype); - cl = 'K'; - ch = 'E'; - dl = 'Y'; - dh = 'A'; - compare(); - if (flags.z()) - goto rightkey; - _cmp(data.byte(kReallocation), 21); - if (!flags.z()) - goto balls; - al = data.byte(kWithobject); - ah = data.byte(kWithtype); - cl = 'K'; - ch = 'N'; - dl = 'F'; - dh = 'E'; - compare(); - if (flags.z()) - goto jimmycontrols; - al = data.byte(kWithobject); - ah = data.byte(kWithtype); - cl = 'A'; - ch = 'X'; - dl = 'E'; - dh = 'D'; - compare(); - if (flags.z()) - goto axeoncontrols; -balls: - showFirstUse(); - putBackObStuff(); - return; -rightkey: - al = 16; - playChannel1(); - _cmp(data.byte(kLocation), 21); - if (flags.z()) - goto goingdown; - cx = 300; - al = 0; - showPuzText(); - data.byte(kNewlocation) = 21; - data.byte(kCounttoclose) = 8; - data.byte(kCounttoopen) = 0; - data.word(kWatchingtime) = 80; - data.byte(kGetback) = 1; - return; -goingdown: - cx = 300; - al = 3; - showPuzText(); - data.byte(kNewlocation) = 30; - data.byte(kCounttoclose) = 8; - data.byte(kCounttoopen) = 0; - data.word(kWatchingtime) = 80; - data.byte(kGetback) = 1; - return; -jimmycontrols: - al = 50; - placeSetObject(); - al = 51; - placeSetObject(); - al = 26; - placeSetObject(); - al = 30; - placeSetObject(); - al = 16; - removeSetObject(); - al = 17; - removeSetObject(); - al = 14; - playChannel1(); - cx = 300; - al = 10; - showPuzText(); - _inc(data.byte(kProgresspoints)); - data.byte(kGetback) = 1; - return; -axeoncontrols: - cx = 300; - al = 16; - showPuzText(); - _inc(data.byte(kProgresspoints)); - putBackObStuff(); -} - void DreamGenContext::useHandle() { STACK_CHECK; al = 'C'; diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 746f306b3d..b87d9c64de 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -593,7 +593,6 @@ public: void updateSymbolBot(); void findPuzText(); void swapWithInv(); - void useControl(); void adjustRight(); void transferToEx(); void updateSymbolTop(); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 7142bec373..a6e29f2192 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -349,6 +349,7 @@ void usePoolReader(); void useCooker(); void useWire(); + void useControl(); bool defaultUseHandler(const char *id); void openTVDoor(); void wearWatch(); diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp index 0990e5ba5e..eb3281150d 100644 --- a/engines/dreamweb/use.cpp +++ b/engines/dreamweb/use.cpp @@ -1224,4 +1224,61 @@ void DreamGenContext::useDiary() { workToScreenM(); } +void DreamGenContext::useControl() { + if (data.byte(kWithobject) == 255) { + withWhat(); + return; + } + + char key[4] = { 'K', 'E', 'Y', 'A' }; // TODO: convert to string with trailing zero + if (compare(data.byte(kWithobject), data.byte(kWithtype), key)) { // Right key + playChannel1(16); + if (data.byte(kLocation) == 21) { // Going down + showPuzText(3, 300); + data.byte(kNewlocation) = 30; + } else { + showPuzText(0, 300); + data.byte(kNewlocation) = 21; + } + + data.byte(kCounttoclose) = 8; + data.byte(kCounttoopen) = 0; + data.word(kWatchingtime) = 80; + data.byte(kGetback) = 1; + return; + } + + if (data.byte(kReallocation) == 21) { + char knife[4] = { 'K', 'N', 'F', 'E' }; // TODO: convert to string with trailing zero + char axe[4] = { 'A', 'X', 'E', 'D' }; // TODO: convert to string with trailing zero + + if (compare(data.byte(kWithobject), data.byte(kWithtype), knife)) { + // Jimmy controls + placeSetObject(50); + placeSetObject(51); + placeSetObject(26); + placeSetObject(30); + removeSetObject(16); + removeSetObject(17); + playChannel1(14); + showPuzText(10, 300); + data.byte(kProgresspoints)++; + data.byte(kGetback) = 1; + } else if (compare(data.byte(kWithobject), data.byte(kWithtype), axe)) { + // Axe on controls + showPuzText(16, 300); + data.byte(kProgresspoints)++; + putBackObStuff(); + } else { + // Balls + showFirstUse(); + putBackObStuff(); + } + } else { + // Balls + showFirstUse(); + putBackObStuff(); + } +} + } // End of namespace DreamGen -- cgit v1.2.3 From 27f5661dfc5d49571499501e68db96fe30d272de Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 12 Dec 2011 23:39:29 +0200 Subject: DREAMWEB: Port 'useslab' to C++ --- engines/dreamweb/dreamgen.cpp | 50 ------------------------------------------- engines/dreamweb/dreamgen.h | 1 - engines/dreamweb/stubs.h | 1 + engines/dreamweb/use.cpp | 33 ++++++++++++++++++++++++++++ 4 files changed, 34 insertions(+), 51 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 3cc0c4e862..a2d8c2c70f 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -3637,56 +3637,6 @@ alreadyfull: putBackObStuff(); } -void DreamGenContext::useSLab() { - STACK_CHECK; - _cmp(data.byte(kWithobject), 255); - if (!flags.z()) - goto slabwith; - withWhat(); - return; -slabwith: - al = data.byte(kWithobject); - ah = data.byte(kWithtype); - cl = 'J'; - ch = 'E'; - dl = 'W'; - dh = 'L'; - compare(); - if (flags.z()) - goto nextslab; - cx = 300; - al = 14; - showPuzText(); - putBackObStuff(); - return; -nextslab: - al = data.byte(kWithobject); - getExAd(); - es.byte(bx+2) = 0; - al = data.byte(kCommand); - push(ax); - removeSetObject(); - ax = pop(); - _inc(al); - push(ax); - placeSetObject(); - ax = pop(); - _cmp(al, 54); - if (!flags.z()) - goto notlastslab; - al = 0; - turnPathOn(); - data.word(kWatchingtime) = 22; - data.word(kReeltowatch) = 35; - data.word(kEndwatchreel) = 48; - data.byte(kWatchspeed) = 1; - data.byte(kSpeedcount) = 1; -notlastslab: - _inc(data.byte(kProgresspoints)); - showFirstUse(); - data.byte(kGetback) = 1; -} - void DreamGenContext::useOpenBox() { STACK_CHECK; _cmp(data.byte(kWithobject), 255); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index b87d9c64de..6e8400b58e 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -508,7 +508,6 @@ public: void dirCom(); void endGameSeq(); void findFirstPath(); - void useSLab(); void useAltar(); void startTalk(); void getAnyAd(); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index a6e29f2192..ff7c1106a6 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -331,6 +331,7 @@ void useWindow(); void useHatch(); void useLighter(); + void useSLab(); void wheelSound(); void callHotelLift(); void useShield(); diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp index eb3281150d..f6d6b2f494 100644 --- a/engines/dreamweb/use.cpp +++ b/engines/dreamweb/use.cpp @@ -1281,4 +1281,37 @@ void DreamGenContext::useControl() { } } +void DreamGenContext::useSLab() { + if (data.byte(kWithobject) == 255) { + withWhat(); + return; + } + + char id[4] = { 'J', 'E', 'W', 'L' }; // TODO: convert to string with trailing zero + if (!compare(data.byte(kWithobject), data.byte(kWithtype), id)) { + showPuzText(14, 300); + putBackObStuff(); + return; + } + + DynObject *exObject = getExAd(data.byte(kWithobject)); + exObject->mapad[0] = 0; + + removeSetObject(data.byte(kCommand)); + placeSetObject(data.byte(kCommand) + 1); + if (data.byte(kCommand) + 1 == 54) { + // Last slab + turnPathOn(0); + data.word(kWatchingtime) = 22; + data.word(kReeltowatch) = 35; + data.word(kEndwatchreel) = 48; + data.byte(kWatchspeed) = 1; + data.byte(kSpeedcount) = 1; + } + + data.byte(kProgresspoints)++; + showFirstUse(); + data.byte(kGetback) = 1; +} + } // End of namespace DreamGen -- cgit v1.2.3 From ef94b2d15a543493a7d11ed208c74c5c2c37214c Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 12 Dec 2011 23:51:40 +0200 Subject: DREAMWEB: Port 'usepipe' to C++ --- engines/dreamweb/dreamgen.cpp | 47 ------------------------------------------- engines/dreamweb/dreamgen.h | 1 - engines/dreamweb/stubs.h | 1 + engines/dreamweb/use.cpp | 27 +++++++++++++++++++++++++ 4 files changed, 28 insertions(+), 48 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index a2d8c2c70f..0a0aa7a91c 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -3590,53 +3590,6 @@ void DreamGenContext::notHeldError() { putBackObStuff(); } -void DreamGenContext::usePipe() { - STACK_CHECK; - _cmp(data.byte(kWithobject), 255); - if (!flags.z()) - goto pipewith; - withWhat(); - return; -pipewith: - al = data.byte(kWithobject); - ah = data.byte(kWithtype); - cl = 'C'; - ch = 'U'; - dl = 'P'; - dh = 'E'; - compare(); - if (flags.z()) - goto fillcup; - al = data.byte(kWithobject); - ah = data.byte(kWithtype); - cl = 'C'; - ch = 'U'; - dl = 'P'; - dh = 'F'; - compare(); - if (flags.z()) - goto alreadyfull; - cx = 300; - al = 14; - showPuzText(); - putBackObStuff(); - return; -fillcup: - cx = 300; - al = 36; - showPuzText(); - putBackObStuff(); - al = data.byte(kWithobject); - getExAd(); - es.byte(bx+15) = 'F'-'A'; - return; -alreadyfull: - cx = 300; - al = 35; - showPuzText(); - putBackObStuff(); -} - void DreamGenContext::useOpenBox() { STACK_CHECK; _cmp(data.byte(kWithobject), 255); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 6e8400b58e..bbdd70e455 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -511,7 +511,6 @@ public: void useAltar(); void startTalk(); void getAnyAd(); - void usePipe(); void reminders(); void runTap(); void dumpDiaryKeys(); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index ff7c1106a6..2946327699 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -332,6 +332,7 @@ void useHatch(); void useLighter(); void useSLab(); + void usePipe(); void wheelSound(); void callHotelLift(); void useShield(); diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp index f6d6b2f494..b8d7b7ca75 100644 --- a/engines/dreamweb/use.cpp +++ b/engines/dreamweb/use.cpp @@ -1314,4 +1314,31 @@ void DreamGenContext::useSLab() { data.byte(kGetback) = 1; } +void DreamGenContext::usePipe() { + if (data.byte(kWithobject) == 255) { + withWhat(); + return; + } + + char cupEmpty[4] = { 'C', 'U', 'P', 'E' }; // TODO: convert to string with trailing zero + char cupFull[4] = { 'C', 'U', 'P', 'F' }; // TODO: convert to string with trailing zero + + if (compare(data.byte(kWithobject), data.byte(kWithtype), cupEmpty)) { + // Fill cup + showPuzText(36, 300); + putBackObStuff(); + DynObject *exObject = getExAd(data.byte(kWithobject)); + exObject->id[3] = 'F'-'A'; // CUPE (empty cup) -> CUPF (full cup) + return; + } else if (compare(data.byte(kWithobject), data.byte(kWithtype), cupFull)) { + // Already full + showPuzText(14, 300); + showPuzText(); + putBackObStuff(); + } else { + showPuzText(35, 300); + putBackObStuff(); + } +} + } // End of namespace DreamGen -- cgit v1.2.3 From 9480b21840cd0e5e0d40ab8a88e0f7b5dac9be03 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 12 Dec 2011 23:58:20 +0200 Subject: DREAMWEB: Port 'useopenbox' to C++ --- engines/dreamweb/dreamgen.cpp | 52 ------------------------------------------- engines/dreamweb/dreamgen.h | 1 - engines/dreamweb/stubs.h | 1 + engines/dreamweb/use.cpp | 35 +++++++++++++++++++++++++++++ 4 files changed, 36 insertions(+), 53 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 0a0aa7a91c..851cca77fe 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -3590,58 +3590,6 @@ void DreamGenContext::notHeldError() { putBackObStuff(); } -void DreamGenContext::useOpenBox() { - STACK_CHECK; - _cmp(data.byte(kWithobject), 255); - if (!flags.z()) - goto openboxwith; - withWhat(); - return; -openboxwith: - al = data.byte(kWithobject); - ah = data.byte(kWithtype); - cl = 'C'; - ch = 'U'; - dl = 'P'; - dh = 'F'; - compare(); - if (flags.z()) - goto destoryopenbox; - al = data.byte(kWithobject); - ah = data.byte(kWithtype); - cl = 'C'; - ch = 'U'; - dl = 'P'; - dh = 'E'; - compare(); - if (flags.z()) - goto openboxwrong; - showFirstUse(); - return; -destoryopenbox: - _inc(data.byte(kProgresspoints)); - cx = 300; - al = 37; - showPuzText(); - al = data.byte(kWithobject); - getExAd(); - es.byte(bx+15) = 'E'-'A'; - data.word(kWatchingtime) = 140; - data.word(kReeltowatch) = 105; - data.word(kEndwatchreel) = 181; - data.byte(kWatchspeed) = 1; - data.byte(kSpeedcount) = 1; - al = 4; - turnPathOn(); - data.byte(kGetback) = 1; - return; -openboxwrong: - cx = 300; - al = 38; - showPuzText(); - putBackObStuff(); -} - void DreamGenContext::useAltar() { STACK_CHECK; al = 'C'; diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index bbdd70e455..7be848813e 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -488,7 +488,6 @@ public: void identifyOb(); void runEndSeq(); - void useOpenBox(); void clearBuffers(); void getObTextStart(); void checkObjectSize(); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 2946327699..18d90ff499 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -333,6 +333,7 @@ void useLighter(); void useSLab(); void usePipe(); + void useOpenBox(); void wheelSound(); void callHotelLift(); void useShield(); diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp index b8d7b7ca75..0ede2f485a 100644 --- a/engines/dreamweb/use.cpp +++ b/engines/dreamweb/use.cpp @@ -1341,4 +1341,39 @@ void DreamGenContext::usePipe() { } } +void DreamGenContext::useOpenBox() { + if (data.byte(kWithobject) == 255) { + withWhat(); + return; + } + + char cupEmpty[4] = { 'C', 'U', 'P', 'E' }; // TODO: convert to string with trailing zero + char cupFull[4] = { 'C', 'U', 'P', 'F' }; // TODO: convert to string with trailing zero + + if (compare(data.byte(kWithobject), data.byte(kWithtype), cupFull)) { + // Destroy open box + data.byte(kProgresspoints)++; + showPuzText(37, 300); + DynObject *exObject = getExAd(data.byte(kWithobject)); + exObject->id[3] = 'E'-'A'; // CUPF (full cup) -> CUPE (empty cup) + data.word(kWatchingtime) = 140; + data.word(kReeltowatch) = 105; + data.word(kEndwatchreel) = 181; + data.byte(kWatchspeed) = 1; + data.byte(kSpeedcount) = 1; + turnPathOn(4); + data.byte(kGetback) = 1; + return; + } + + if (compare(data.byte(kWithobject), data.byte(kWithtype), cupEmpty)) { + // Open box wrong + showPuzText(38, 300); + putBackObStuff(); + return; + } + + showFirstUse(); +} + } // End of namespace DreamGen -- cgit v1.2.3 From 90c1793d4771a71af737d10dad8a2761c4696794 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 13 Dec 2011 00:11:05 +0200 Subject: DREAMWEB: Port 'useaxe', 'usekey' to C++ --- engines/dreamweb/dreamgen.cpp | 83 ------------------------------------------- engines/dreamweb/dreamgen.h | 2 -- engines/dreamweb/stubs.h | 2 ++ engines/dreamweb/use.cpp | 63 ++++++++++++++++++++++++++++++++ 4 files changed, 65 insertions(+), 85 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 851cca77fe..b917f58e87 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -3830,58 +3830,6 @@ havecutwire: data.byte(kGetback) = 1; } -void DreamGenContext::useKey() { - STACK_CHECK; - _cmp(data.byte(kLocation), 5); - if (flags.z()) - goto usekey1; - _cmp(data.byte(kLocation), 30); - if (flags.z()) - goto usekey1; - _cmp(data.byte(kLocation), 21); - if (flags.z()) - goto usekey2; - cx = 200; - al = 1; - showPuzText(); - putBackObStuff(); - return; -usekey1: - _cmp(data.byte(kMapx), 22); - if (!flags.z()) - goto wrongroom1; - _cmp(data.byte(kMapy), 10); - if (!flags.z()) - goto wrongroom1; - cx = 300; - al = 0; - showPuzText(); - data.byte(kCounttoclose) = 100; - data.byte(kGetback) = 1; - return; -usekey2: - _cmp(data.byte(kMapx), 11); - if (!flags.z()) - goto wrongroom1; - _cmp(data.byte(kMapy), 10); - if (!flags.z()) - goto wrongroom1; - cx = 300; - al = 3; - showPuzText(); - data.byte(kNewlocation) = 30; - al = 2; - fadeScreenDown(); - showFirstUse(); - putBackObStuff(); - return; -wrongroom1: - cx = 200; - al = 2; - showPuzText(); - putBackObStuff(); -} - void DreamGenContext::useStereo() { STACK_CHECK; _cmp(data.byte(kLocation), 0); @@ -3944,37 +3892,6 @@ stereoon: putBackObStuff(); } -void DreamGenContext::useAxe() { - STACK_CHECK; - _cmp(data.byte(kReallocation), 22); - if (!flags.z()) - goto notinpool; - _cmp(data.byte(kMapy), 10); - if (flags.z()) - goto axeondoor; - showSecondUse(); - _inc(data.byte(kProgresspoints)); - data.byte(kLastweapon) = 2; - data.byte(kGetback) = 1; - removeObFromInv(); - return; -notinpool: - showFirstUse(); - return; -/*continuing to unbounded code: axeondoor from useelvdoor:19-30*/ -axeondoor: - al = 15; - cx = 300; - showPuzText(); - _inc(data.byte(kProgresspoints)); - data.word(kWatchingtime) = 46*2; - data.word(kReeltowatch) = 31; - data.word(kEndwatchreel) = 77; - data.byte(kWatchspeed) = 1; - data.byte(kSpeedcount) = 1; - data.byte(kGetback) = 1; -} - void DreamGenContext::withWhat() { STACK_CHECK; createPanel(); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 7be848813e..f146649b61 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -521,7 +521,6 @@ public: void getFreeAd(); void removeObFromInv(); void heavy(); - void useKey(); void dirFile(); void pickupConts(); void nextColon(); @@ -549,7 +548,6 @@ public: void rollEm(); void poolGuard(); void lookAtPlace(); - void useAxe(); void findAllOpen(); void fillOpen(); void findSetObject(); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 18d90ff499..4376f5b42d 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -334,6 +334,8 @@ void useSLab(); void usePipe(); void useOpenBox(); + void useAxe(); + void useKey(); void wheelSound(); void callHotelLift(); void useShield(); diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp index 0ede2f485a..531f465010 100644 --- a/engines/dreamweb/use.cpp +++ b/engines/dreamweb/use.cpp @@ -1376,4 +1376,67 @@ void DreamGenContext::useOpenBox() { showFirstUse(); } +void DreamGenContext::useAxe() { + if (data.byte(kReallocation) != 22) { + // Not in pool + showFirstUse(); + return; + } + + if (data.byte(kMapy) == 10) { + // Axe on door + al = 15; + cx = 300; + showPuzText(15, 300); + data.byte(kProgresspoints)++; + data.word(kWatchingtime) = 46*2; + data.word(kReeltowatch) = 31; + data.word(kEndwatchreel) = 77; + data.byte(kWatchspeed) = 1; + data.byte(kSpeedcount) = 1; + data.byte(kGetback) = 1; + return; + } + + showSecondUse(); + data.byte(kProgresspoints)++; + data.byte(kLastweapon) = 2; + data.byte(kGetback) = 1; + removeObFromInv(); +} + +void DreamGenContext::useKey() { + switch(data.byte(kLocation)) { + case 5: + case 30: + if (data.byte(kMapx) == 22 && data.byte(kMapy) == 10) { + showPuzText(0, 300); + data.byte(kCounttoclose) = 100; + data.byte(kGetback) = 1; + } else { + // Wrong room + showPuzText(2, 200); + putBackObStuff(); + } + break; + case 21: + if (data.byte(kMapx) == 11 && data.byte(kMapy) == 10) { + showPuzText(3, 300); + data.byte(kNewlocation) = 30; + al = 2; + fadeScreenDown(); + showFirstUse(); + putBackObStuff(); + } else { + // Wrong room + showPuzText(2, 200); + putBackObStuff(); + } + default: + showPuzText(1, 200); + putBackObStuff(); + break; + } +} + } // End of namespace DreamGen -- cgit v1.2.3 From d5b69f0c0218bd83f8e246541e2094b807435852 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 12 Dec 2011 23:47:46 +0100 Subject: TSAGE: R2R - Implement scene 2525 --- engines/tsage/ringworld2/ringworld2_logic.cpp | 2 + engines/tsage/ringworld2/ringworld2_scenes2.cpp | 140 ++++++++++++++++++++++++ engines/tsage/ringworld2/ringworld2_scenes2.h | 31 ++++++ 3 files changed, 173 insertions(+) (limited to 'engines') diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index dca3dcead5..8f85bbdea3 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -128,6 +128,8 @@ Scene *Ringworld2Game::createScene(int sceneNumber) { // Maze: Large Cave return new Scene2500(); case 2525: + // Maze: Furnace room + return new Scene2525(); case 2530: case 2535: case 2600: diff --git a/engines/tsage/ringworld2/ringworld2_scenes2.cpp b/engines/tsage/ringworld2/ringworld2_scenes2.cpp index 18fd6e6bde..d15763fb29 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes2.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes2.cpp @@ -2503,5 +2503,145 @@ void Scene2500::signal() { } } +/*-------------------------------------------------------------------------- + * Scene 2525 - Furnace room + * + *--------------------------------------------------------------------------*/ +bool Scene2525::Item5::startAction(CursorType action, Event &event) { + Scene2525 *scene = (Scene2525 *)R2_GLOBALS._sceneManager._scene; + + if ((action == R2_20) && (!R2_GLOBALS.getFlag(74))) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 2526; + scene->setAction(&scene->_sequenceManager, scene, 2526, &R2_GLOBALS._player, NULL); + return true; + } + + return SceneItem::startAction(action, event); +} + +bool Scene2525::Actor3::startAction(CursorType action, Event &event) { + Scene2525 *scene = (Scene2525 *)R2_GLOBALS._sceneManager._scene; + + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + + if (R2_GLOBALS._player._characterIndex == 2) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 2525; + scene->setAction(&scene->_sequenceManager, scene, 2525, &R2_GLOBALS._player, &scene->_actor3, NULL); + } else { + SceneItem::display(2530, 33, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + } + return true; +} + +void Scene2525::Exit1::changeScene() { + Scene2525 *scene = (Scene2525 *)R2_GLOBALS._sceneManager._scene; + + _enabled = false; + R2_GLOBALS._events.setCursor(CURSOR_ARROW); + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 11; + + Common::Point pt(R2_GLOBALS._player._position.x, 200); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); +} + +void Scene2525::postInit(SceneObjectList *OwnerList) { + loadScene(2525); + SceneExt::postInit(); + R2_GLOBALS._sound1.play(200); + R2_GLOBALS._sound2.play(207); + + _exit1.setDetails(Rect(86, 155, 228, 168), EXITCURSOR_S, 2000); + + if (R2_INVENTORY.getObjectScene(29) == 2525) { + _actor3.postInit(); + _actor3.setup(2435, 1, 2); + _actor3.setPosition(Common::Point(78, 155)); + _actor3.fixPriority(155); + _actor3.setDetails(2525, 27, -1, -1, 1, NULL); + } + + _actor2.postInit(); + _actor2.setup(2525, 1, 1); + _actor2.setPosition(Common::Point(183, 114)); + _actor2.setDetails(2525, 15, -1, -1, 1, NULL); + _actor2.animate(ANIM_MODE_2, NULL); + _actor2._numFrames = 3; + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + if (R2_GLOBALS._player._characterIndex == 1) { + R2_GLOBALS._player.setup(2008, 3, 1); + R2_GLOBALS._player._moveDiff = Common::Point(3, 2); + } else { + R2_GLOBALS._player.setup(20, 3, 1); + R2_GLOBALS._player._moveDiff = Common::Point(5, 3); + } + + if (R2_GLOBALS._player._characterScene[1] == R2_GLOBALS._player._characterScene[2]) { + _actor1.postInit(); + if (R2_GLOBALS._player._characterIndex == 1) { + _actor1.setup(20, 5, 1); + _actor1.setDetails(9002, 0, 4, 3, 1, NULL); + } else { + _actor1.setup(2008, 5, 1); + _actor1.setDetails(9001, 0, 5, 3, 1, NULL); + } + _actor1.setPosition(Common::Point(209, 162)); + + R2_GLOBALS._walkRegions.enableRegion(4); + } + + _item5.setDetails(Rect(125, 73, 140, 86), 2525, 6, -1, -1, 1, NULL); + _item3.setDetails(Rect(137, 11, 163, 72), 2525, 12, -1, -1, 1, NULL); + _item4.setDetails(Rect(204, 20, 234, 78), 2525, 12, -1, -1, 1, NULL); + _item2.setDetails(Rect(102, 62, 230, 134), 2525, 0, -1, -1, 1, NULL); + _item1.setDetails(Rect(0, 0, 320, 200), 2525, 24, -1, -1, 1, NULL); + + R2_GLOBALS._player.disableControl(); + + if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 2000) { + R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] = 2525; + R2_GLOBALS._player.setPosition(Common::Point(160, 200)); + Common::Point pt(160, 150); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } else { + R2_GLOBALS._player.setPosition(Common::Point(160, 150)); + R2_GLOBALS._player.setStrip(3); + R2_GLOBALS._player.enableControl(); + } +} + +void Scene2525::remove() { + R2_GLOBALS._sound1.fadeOut2(NULL); + R2_GLOBALS._sound2.fadeOut2(NULL); + SceneExt::remove(); +} + +void Scene2525::signal() { + switch (_sceneMode) { + case 11: + g_globals->_sceneManager.changeScene(2000); + break; + case 2525: + _actor3.remove(); + R2_INVENTORY.setObjectScene(29, 2); + R2_GLOBALS._player.enableControl(); + break; + case 2526: + R2_GLOBALS.setFlag(74); + R2_GLOBALS._player.enableControl(); + break; + default: + R2_GLOBALS._player.enableControl(); + break; + } +} + } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_scenes2.h b/engines/tsage/ringworld2/ringworld2_scenes2.h index 82898a45dd..b906921842 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes2.h +++ b/engines/tsage/ringworld2/ringworld2_scenes2.h @@ -383,6 +383,37 @@ public: virtual void signal(); }; +class Scene2525 : public SceneExt { + class Item5 : public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + class Actor3 : public SceneActor { + public: + bool startAction(CursorType action, Event &event); + }; + + class Exit1 : public SceneExit { + public: + virtual void changeScene(); + }; +public: + NamedHotspot _item1; + NamedHotspot _item2; + NamedHotspot _item3; + NamedHotspot _item4; + Item5 _item5; + SceneActor _actor1; + SceneActor _actor2; + Actor3 _actor3; + Exit1 _exit1; + SequenceManager _sequenceManager; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void remove(); + virtual void signal(); +}; } // End of namespace Ringworld2 } // End of namespace TsAGE -- cgit v1.2.3 From 6d2723400662c2b7d75bf6317807770b4d370caf Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Mon, 12 Dec 2011 23:41:45 +0100 Subject: DREAMWEB: Fix regression in usePipe --- engines/dreamweb/use.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp index 531f465010..f62daf9c9a 100644 --- a/engines/dreamweb/use.cpp +++ b/engines/dreamweb/use.cpp @@ -1332,11 +1332,11 @@ void DreamGenContext::usePipe() { return; } else if (compare(data.byte(kWithobject), data.byte(kWithtype), cupFull)) { // Already full - showPuzText(14, 300); - showPuzText(); + showPuzText(35, 300); putBackObStuff(); } else { - showPuzText(35, 300); + showPuzText(14, 300); + showPuzText(); putBackObStuff(); } } @@ -1385,8 +1385,6 @@ void DreamGenContext::useAxe() { if (data.byte(kMapy) == 10) { // Axe on door - al = 15; - cx = 300; showPuzText(15, 300); data.byte(kProgresspoints)++; data.word(kWatchingtime) = 46*2; -- cgit v1.2.3 From c452bf9c1268155bd896b2f42c003c8eda110e84 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 13 Dec 2011 00:53:36 +0200 Subject: DREAMWEB: Port 'selectslot' to C++ --- engines/dreamweb/dreamgen.cpp | 52 ------------------------------------------- engines/dreamweb/dreamgen.h | 1 - engines/dreamweb/stubs.cpp | 35 +++++++++++++++++++++++++++++ engines/dreamweb/stubs.h | 1 + 4 files changed, 36 insertions(+), 53 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index b917f58e87..7ab361b264 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -4532,58 +4532,6 @@ void DreamGenContext::findText1() { si = ax; } -void DreamGenContext::selectSlot() { - STACK_CHECK; - _cmp(data.byte(kCommandtype), 244); - if (flags.z()) - goto alreadysel; - data.byte(kCommandtype) = 244; - al = 45; - commandOnly(); -alreadysel: - ax = data.word(kMousebutton); - _cmp(ax, 1); - if (!flags.z()) - return /* (noselslot) */; - _cmp(ax, data.word(kOldbutton)); - if (flags.z()) - return /* (noselslot) */; - _cmp(data.byte(kLoadingorsave), 3); - if (!flags.z()) - goto notnocurs; - _dec(data.byte(kLoadingorsave)); -notnocurs: - oldToNames(); - ax = data.word(kMousey); - _sub(ax, (52)+4); - cl = -1; -getslotnum: - _inc(cl); - _sub(ax, 11); - if (!flags.c()) - goto getslotnum; - data.byte(kCurrentslot) = cl; - delPointer(); - showOpBox(); - showSlots(); - showNames(); - _cmp(data.byte(kLoadingorsave), 1); - if (flags.z()) - goto isloadmode; - showSaveOps(); - readMouse(); - showPointer(); - workToScreen(); - delPointer(); - return; -isloadmode: - showLoadOps(); - readMouse(); - showPointer(); - workToScreen(); - delPointer(); -} - void DreamGenContext::showSlots() { STACK_CHECK; di = (60)+7; diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index f146649b61..3bb554e8f7 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -528,7 +528,6 @@ public: void getKeyAndLogo(); void selectOb(); void receptionist(); - void selectSlot(); void fadeUpMon(); void showDiaryPage(); void reExFromInv(); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index e52ccf03f3..97dad08298 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -4476,4 +4476,39 @@ void DreamGenContext::entryAnims() { } } +void DreamGenContext::selectSlot() { + if (data.byte(kCommandtype) != 244) { + data.byte(kCommandtype) = 244; + commandOnly(45); + } + + if (data.word(kMousebutton) != 1 || data.word(kMousebutton) == data.word(kOldbutton)) + return; // noselslot + if (data.byte(kLoadingorsave) == 3) + data.byte(kLoadingorsave)--; + + oldToNames(); + uint16 y = data.word(kMousey) - (kOpsy + 4); + byte currentSlot = (byte)-1; + + do { + currentSlot++; + y -= 11; + } while (y >= 11); + + data.byte(kCurrentslot) = currentSlot; + delPointer(); + showOpBox(); + showSlots(); + showNames(); + if (data.byte(kLoadingorsave) == 1) + showLoadOps(); + else + showSaveOps(); + readMouse(); + showPointer(); + workToScreen(); + delPointer(); +} + } // End of namespace DreamGen diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 4376f5b42d..b32f5460ec 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -476,6 +476,7 @@ void afterIntroRoom(); void gettingShot(); void redrawMainScrn(); + void selectSlot(); void selectSlot2(); void blank(); void allPointer(); -- cgit v1.2.3 From b27a6e72ad63441c561866682bdebb0059db56a3 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 13 Dec 2011 01:02:41 +0200 Subject: DREAMWEB: Port 'runtap' to C++ --- engines/dreamweb/dreamgen.cpp | 49 ------------------------------------------- engines/dreamweb/dreamgen.h | 1 - engines/dreamweb/stubs.h | 1 + engines/dreamweb/use.cpp | 30 ++++++++++++++++++++++++++ 4 files changed, 31 insertions(+), 50 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 7ab361b264..09ea14583d 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -3522,55 +3522,6 @@ finishpars: di = offset_operand1; } -void DreamGenContext::runTap() { - STACK_CHECK; - _cmp(data.byte(kWithobject), 255); - if (!flags.z()) - goto tapwith; - withWhat(); - return; -tapwith: - al = data.byte(kWithobject); - ah = data.byte(kWithtype); - cl = 'C'; - ch = 'U'; - dl = 'P'; - dh = 'E'; - compare(); - if (flags.z()) - goto fillcupfromtap; - al = data.byte(kWithobject); - ah = data.byte(kWithtype); - cl = 'C'; - ch = 'U'; - dl = 'P'; - dh = 'F'; - compare(); - if (flags.z()) - goto cupfromtapfull; - cx = 300; - al = 56; - showPuzText(); - putBackObStuff(); - return; -fillcupfromtap: - al = data.byte(kWithobject); - getExAd(); - es.byte(bx+15) = 'F'-'A'; - al = 8; - playChannel1(); - cx = 300; - al = 57; - showPuzText(); - putBackObStuff(); - return; -cupfromtapfull: - cx = 300; - al = 58; - showPuzText(); - putBackObStuff(); -} - void DreamGenContext::notHeldError() { STACK_CHECK; createPanel(); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 3bb554e8f7..92c6f82e12 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -511,7 +511,6 @@ public: void startTalk(); void getAnyAd(); void reminders(); - void runTap(); void dumpDiaryKeys(); void checkForExit(); void lookInInterface(); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index b32f5460ec..ed45e40b8d 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -492,6 +492,7 @@ void useCart(); void useTrainer(); void useHole(); + void runTap(); void chewy(); void sLabDoorA(); void sLabDoorB(); diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp index f62daf9c9a..c591eca826 100644 --- a/engines/dreamweb/use.cpp +++ b/engines/dreamweb/use.cpp @@ -1376,6 +1376,36 @@ void DreamGenContext::useOpenBox() { showFirstUse(); } +void DreamGenContext::runTap() { + if (data.byte(kWithobject) == 255) { + withWhat(); + return; + } + + char cupEmpty[4] = { 'C', 'U', 'P', 'E' }; // TODO: convert to string with trailing zero + char cupFull[4] = { 'C', 'U', 'P', 'F' }; // TODO: convert to string with trailing zero + + if (compare(data.byte(kWithobject), data.byte(kWithtype), cupEmpty)) { + // Fill cup from tap + DynObject *exObject = getExAd(data.byte(kWithobject)); + exObject->id[3] = 'F'-'A'; // CUPE (empty cup) -> CUPF (full cup) + playChannel1(8); + showPuzText(57, 300); + putBackObStuff(); + return; + } + + if (compare(data.byte(kWithobject), data.byte(kWithtype), cupFull)) { + // Cup from tap full + showPuzText(58, 300); + putBackObStuff(); + return; + } + + showPuzText(56, 300); + putBackObStuff(); +} + void DreamGenContext::useAxe() { if (data.byte(kReallocation) != 22) { // Not in pool -- cgit v1.2.3 From 1994bf73ce382057b166b49db203f19d5ac25cb6 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 13 Dec 2011 01:14:26 +0200 Subject: DREAMWEB: 'lineroutine', 'increment1', 'increment2' are only used inside bresenhams() --- engines/dreamweb/dreamgen.cpp | 230 +++++++++++++++++++++--------------------- engines/dreamweb/dreamgen.h | 71 +++++++------ engines/dreamweb/pathfind.cpp | 20 ++-- 3 files changed, 160 insertions(+), 161 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 09ea14583d..681bb79085 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -2876,14 +2876,14 @@ void DreamGenContext::getDestInfo() { push(ax); dx = data; es = dx; - si = 1249; + si = 1244; _add(si, ax); cl = es.byte(si); ax = pop(); push(cx); dx = data; es = dx; - si = 1265; + si = 1260; _add(si, ax); ax = pop(); } @@ -2935,7 +2935,7 @@ clearedlocations: bx = ax; dx = data; es = dx; - _add(bx, 1249); + _add(bx, 1244); es.byte(bx) = 0; } @@ -2971,7 +2971,7 @@ void DreamGenContext::execCommand() { es = cs; bx = offset_comlist; ds = cs; - si = 1283; + si = 1278; al = ds.byte(si); _cmp(al, 0); if (!flags.z()) @@ -3064,7 +3064,7 @@ dirroot: si = offset_rootdir; _inc(si); es = cs; - di = 1125; + di = 1120; _inc(di); cx = 12; _movsb(cx, true); @@ -3166,7 +3166,7 @@ notyetassigned: push(bx); _add(bx, 2); ds = cs; - si = 1283; + si = 1278; checkpass: _lodsw(); ah = es.byte(bx); @@ -3237,7 +3237,7 @@ void DreamGenContext::read() { return; okcom: es = cs; - di = 1125; + di = 1120; ax = data.word(kTextfile1); data.word(kMonsource) = ax; ds = ax; @@ -3367,7 +3367,7 @@ keyok2: ds = cs; si = offset_operand1+1; es = cs; - di = 1125+1; + di = 1120+1; cx = 12; _movsb(cx, true); monitorLogo(); @@ -3494,7 +3494,7 @@ void DreamGenContext::parser() { al = '='; _stosb(); ds = cs; - si = 1283; + si = 1278; notspace1: _lodsw(); _cmp(al, 32); @@ -4519,7 +4519,7 @@ nomatchslot: void DreamGenContext::clearBuffers() { STACK_CHECK; es = data.word(kBuffers); - cx = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+916-459+68-0)/2; + cx = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+911-454+68-0)/2; ax = 0; di = 0; _stosw(cx, true); @@ -4531,11 +4531,11 @@ void DreamGenContext::clearBuffers() { es = data.word(kBuffers); di = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)); ds = cs; - si = 459; - cx = (916-459); + si = 454; + cx = (911-454); _movsb(cx, true); es = data.word(kBuffers); - di = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+916-459); + di = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+911-454); ds = cs; si = 0; cx = (68-0); @@ -4553,11 +4553,11 @@ void DreamGenContext::clearChanges() { ds = data.word(kBuffers); si = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)); es = cs; - di = 459; - cx = (916-459); + di = 454; + cx = (911-454); _movsb(cx, true); ds = data.word(kBuffers); - si = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+916-459); + si = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+911-454); es = cs; di = 0; cx = (68-0); @@ -4571,7 +4571,7 @@ void DreamGenContext::clearChanges() { di = 0; _stosw(cx, true); es = cs; - di = 1249; + di = 1244; al = 1; _stosb(2); al = 0; @@ -4818,111 +4818,111 @@ void DreamGenContext::__start() { //0x0190: .... .... .... .... 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x01a0: .... .... .... .... - 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, //0x01b0: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x01, 0x2c, 0x00, 0x14, 0x00, - //0x01c0: .... .... .... ,... - 0x02, 0x00, 0x01, 0x01, 0x37, 0x00, 0x00, 0x00, 0x32, 0x14, 0x00, 0x18, 0x16, 0x00, 0x4a, 0x00, - //0x01d0: .... 7... 2... ..J. - 0x01, 0x00, 0x00, 0x18, 0x21, 0x0a, 0x4b, 0x00, 0x01, 0x00, 0x01, 0x01, 0x2c, 0x00, 0x1b, 0x00, - //0x01e0: .... !.K. .... ,... - 0x02, 0x00, 0x02, 0x01, 0x2c, 0x00, 0x60, 0x00, 0x03, 0x00, 0x04, 0x01, 0x2c, 0x00, 0x76, 0x00, - //0x01f0: .... ,.`. .... ,.v. - 0x02, 0x00, 0x05, 0x01, 0x2c, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x00, 0x05, 0x16, 0x14, 0x35, 0x00, - //0x0200: .... ,... .... ..5. - 0x03, 0x00, 0x00, 0x05, 0x16, 0x14, 0x28, 0x00, 0x01, 0x00, 0x02, 0x05, 0x16, 0x14, 0x32, 0x00, - //0x0210: .... ..(. .... ..2. - 0x01, 0x00, 0x03, 0x02, 0x0b, 0x0a, 0xc0, 0x00, 0x01, 0x00, 0x00, 0x02, 0x0b, 0x0a, 0xb6, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x01, 0x2c, 0x00, 0x14, 0x00, 0x02, 0x00, 0x01, 0x01, 0x37, + //0x01c0: .... ..., .... ...7 + 0x00, 0x00, 0x00, 0x32, 0x14, 0x00, 0x18, 0x16, 0x00, 0x4a, 0x00, 0x01, 0x00, 0x00, 0x18, 0x21, + //0x01d0: ...2 .... .J.. ...! + 0x0a, 0x4b, 0x00, 0x01, 0x00, 0x01, 0x01, 0x2c, 0x00, 0x1b, 0x00, 0x02, 0x00, 0x02, 0x01, 0x2c, + //0x01e0: .K.. ..., .... ..., + 0x00, 0x60, 0x00, 0x03, 0x00, 0x04, 0x01, 0x2c, 0x00, 0x76, 0x00, 0x02, 0x00, 0x05, 0x01, 0x2c, + //0x01f0: .`.. ..., .v.. ..., + 0x0a, 0x00, 0x00, 0x02, 0x00, 0x00, 0x05, 0x16, 0x14, 0x35, 0x00, 0x03, 0x00, 0x00, 0x05, 0x16, + //0x0200: .... .... .5.. .... + 0x14, 0x28, 0x00, 0x01, 0x00, 0x02, 0x05, 0x16, 0x14, 0x32, 0x00, 0x01, 0x00, 0x03, 0x02, 0x0b, + //0x0210: .(.. .... .2.. .... + 0x0a, 0xc0, 0x00, 0x01, 0x00, 0x00, 0x02, 0x0b, 0x0a, 0xb6, 0x00, 0x02, 0x00, 0x01, 0x08, 0x0b, //0x0220: .... .... .... .... - 0x02, 0x00, 0x01, 0x08, 0x0b, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x01, 0x17, 0x00, 0x32, 0x00, 0x00, - //0x0230: .... .... .... .2.. - 0x03, 0x00, 0x00, 0x1c, 0x0b, 0x14, 0xfa, 0x00, 0x04, 0x00, 0x00, 0x17, 0x00, 0x32, 0x2b, 0x00, - //0x0240: .... .... .... .2+. - 0x02, 0x00, 0x08, 0x17, 0x0b, 0x28, 0x82, 0x00, 0x02, 0x00, 0x01, 0x17, 0x16, 0x28, 0x7a, 0x00, - //0x0250: .... .(.. .... .(z. - 0x02, 0x00, 0x02, 0x17, 0x16, 0x28, 0x69, 0x00, 0x02, 0x00, 0x03, 0x17, 0x16, 0x28, 0x51, 0x00, - //0x0260: .... .(i. .... .(Q. - 0x02, 0x00, 0x04, 0x17, 0x0b, 0x28, 0x87, 0x00, 0x02, 0x00, 0x05, 0x17, 0x16, 0x28, 0x91, 0x00, - //0x0270: .... .(.. .... .(.. - 0x02, 0x00, 0x06, 0x04, 0x16, 0x1e, 0x00, 0x00, 0x02, 0x00, 0x00, 0x2d, 0x16, 0x1e, 0xc8, 0x00, - //0x0280: .... .... ...- .... - 0x00, 0x00, 0x14, 0x2d, 0x16, 0x1e, 0x27, 0x00, 0x02, 0x00, 0x00, 0x2d, 0x16, 0x1e, 0x19, 0x00, - //0x0290: ...- ..'. ...- .... - 0x02, 0x00, 0x00, 0x08, 0x16, 0x28, 0x20, 0x00, 0x02, 0x00, 0x00, 0x07, 0x0b, 0x14, 0x40, 0x00, - //0x02a0: .... .( . .... ..@. - 0x02, 0x00, 0x00, 0x16, 0x16, 0x14, 0x52, 0x00, 0x02, 0x00, 0x00, 0x1b, 0x0b, 0x1e, 0x00, 0x00, - //0x02b0: .... ..R. .... .... - 0x02, 0x00, 0x00, 0x14, 0x00, 0x1e, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0e, 0x21, 0x28, 0x15, 0x00, - //0x02c0: .... .... .... !(.. - 0x01, 0x00, 0x00, 0x1d, 0x0b, 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0x16, 0x00, 0x02, 0x00, + 0x0a, 0x00, 0x00, 0x02, 0x00, 0x01, 0x17, 0x00, 0x32, 0x00, 0x00, 0x03, 0x00, 0x00, 0x1c, 0x0b, + //0x0230: .... .... 2... .... + 0x14, 0xfa, 0x00, 0x04, 0x00, 0x00, 0x17, 0x00, 0x32, 0x2b, 0x00, 0x02, 0x00, 0x08, 0x17, 0x0b, + //0x0240: .... .... 2+.. .... + 0x28, 0x82, 0x00, 0x02, 0x00, 0x01, 0x17, 0x16, 0x28, 0x7a, 0x00, 0x02, 0x00, 0x02, 0x17, 0x16, + //0x0250: (... .... (z.. .... + 0x28, 0x69, 0x00, 0x02, 0x00, 0x03, 0x17, 0x16, 0x28, 0x51, 0x00, 0x02, 0x00, 0x04, 0x17, 0x0b, + //0x0260: (i.. .... (Q.. .... + 0x28, 0x87, 0x00, 0x02, 0x00, 0x05, 0x17, 0x16, 0x28, 0x91, 0x00, 0x02, 0x00, 0x06, 0x04, 0x16, + //0x0270: (... .... (... .... + 0x1e, 0x00, 0x00, 0x02, 0x00, 0x00, 0x2d, 0x16, 0x1e, 0xc8, 0x00, 0x00, 0x00, 0x14, 0x2d, 0x16, + //0x0280: .... ..-. .... ..-. + 0x1e, 0x27, 0x00, 0x02, 0x00, 0x00, 0x2d, 0x16, 0x1e, 0x19, 0x00, 0x02, 0x00, 0x00, 0x08, 0x16, + //0x0290: .'.. ..-. .... .... + 0x28, 0x20, 0x00, 0x02, 0x00, 0x00, 0x07, 0x0b, 0x14, 0x40, 0x00, 0x02, 0x00, 0x00, 0x16, 0x16, + //0x02a0: ( .. .... .@.. .... + 0x14, 0x52, 0x00, 0x02, 0x00, 0x00, 0x1b, 0x0b, 0x1e, 0x00, 0x00, 0x02, 0x00, 0x00, 0x14, 0x00, + //0x02b0: .R.. .... .... .... + 0x1e, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0e, 0x21, 0x28, 0x15, 0x00, 0x01, 0x00, 0x00, 0x1d, 0x0b, + //0x02c0: .... ...! (... .... + 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0x16, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x19, 0x00, //0x02d0: .... .... .... .... - 0x02, 0x00, 0x00, 0x19, 0x00, 0x32, 0x04, 0x00, 0x02, 0x00, 0x00, 0x32, 0x16, 0x1e, 0x79, 0x00, - //0x02e0: .... .2.. ...2 ..y. - 0x02, 0x00, 0x00, 0x32, 0x16, 0x1e, 0x00, 0x00, 0x14, 0x00, 0x00, 0x34, 0x16, 0x1e, 0xc0, 0x00, - //0x02f0: ...2 .... ...4 .... - 0x02, 0x00, 0x00, 0x34, 0x16, 0x1e, 0xe9, 0x00, 0x02, 0x00, 0x00, 0x32, 0x16, 0x28, 0x68, 0x00, - //0x0300: ...4 .... ...2 .(h. - 0x37, 0x00, 0x00, 0x35, 0x21, 0x00, 0x63, 0x00, 0x02, 0x00, 0x00, 0x32, 0x16, 0x28, 0x00, 0x00, - //0x0310: 7..5 !.c. ...2 .(.. - 0x03, 0x00, 0x00, 0x32, 0x16, 0x1e, 0xa2, 0x00, 0x02, 0x00, 0x00, 0x34, 0x16, 0x1e, 0x39, 0x00, - //0x0320: ...2 .... ...4 ..9. - 0x02, 0x00, 0x00, 0x34, 0x16, 0x1e, 0x00, 0x00, 0x02, 0x00, 0x00, 0x36, 0x00, 0x00, 0x48, 0x00, - //0x0330: ...4 .... ...6 ..H. - 0x03, 0x00, 0x00, 0x37, 0x2c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, - //0x0340: ...7 ,... .... .... - 0x1c, 0x00, 0x00, 0x0e, 0x16, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x0e, 0x16, 0x00, 0x2c, 0x01, - //0x0350: .... .... .... ..,. - 0x01, 0x00, 0x00, 0x0a, 0x16, 0x1e, 0xae, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x16, 0x14, 0x00, 0x00, + 0x32, 0x04, 0x00, 0x02, 0x00, 0x00, 0x32, 0x16, 0x1e, 0x79, 0x00, 0x02, 0x00, 0x00, 0x32, 0x16, + //0x02e0: 2... ..2. .y.. ..2. + 0x1e, 0x00, 0x00, 0x14, 0x00, 0x00, 0x34, 0x16, 0x1e, 0xc0, 0x00, 0x02, 0x00, 0x00, 0x34, 0x16, + //0x02f0: .... ..4. .... ..4. + 0x1e, 0xe9, 0x00, 0x02, 0x00, 0x00, 0x32, 0x16, 0x28, 0x68, 0x00, 0x37, 0x00, 0x00, 0x35, 0x21, + //0x0300: .... ..2. (h.7 ..5! + 0x00, 0x63, 0x00, 0x02, 0x00, 0x00, 0x32, 0x16, 0x28, 0x00, 0x00, 0x03, 0x00, 0x00, 0x32, 0x16, + //0x0310: .c.. ..2. (... ..2. + 0x1e, 0xa2, 0x00, 0x02, 0x00, 0x00, 0x34, 0x16, 0x1e, 0x39, 0x00, 0x02, 0x00, 0x00, 0x34, 0x16, + //0x0320: .... ..4. .9.. ..4. + 0x1e, 0x00, 0x00, 0x02, 0x00, 0x00, 0x36, 0x00, 0x00, 0x48, 0x00, 0x03, 0x00, 0x00, 0x37, 0x2c, + //0x0330: .... ..6. .H.. ..7, + 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x0e, 0x16, + //0x0340: .... .... .... .... + 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x0e, 0x16, 0x00, 0x2c, 0x01, 0x01, 0x00, 0x00, 0x0a, 0x16, + //0x0350: .... .... .,.. .... + 0x1e, 0xae, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x16, 0x14, 0x00, 0x00, 0x01, 0x00, 0x00, 0x0b, 0x0b, //0x0360: .... .... .... .... - 0x01, 0x00, 0x00, 0x0b, 0x0b, 0x14, 0x00, 0x00, 0x32, 0x14, 0x00, 0x0b, 0x0b, 0x1e, 0x00, 0x00, - //0x0370: .... .... 2... .... - 0x32, 0x14, 0x00, 0x0b, 0x16, 0x14, 0x00, 0x00, 0x32, 0x14, 0x00, 0x0e, 0x21, 0x28, 0x00, 0x00, - //0x0380: 2... .... 2... !(.. - 0x32, 0x14, 0x00, 0xff, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x56, 0x39, 0x39, - //0x0390: 2... DREA MWEB .V99 - 0x00, 0x00, 0x01, 0x45, 0x58, 0x49, 0x54, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x48, 0x45, 0x4c, - //0x03a0: ...E XIT HEL - 0x50, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x4c, 0x49, 0x53, 0x54, 0x20, 0x20, 0x20, 0x20, 0x20, - //0x03b0: P L IST - 0x20, 0x52, 0x45, 0x41, 0x44, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x4c, 0x4f, 0x47, 0x4f, 0x4e, - //0x03c0: REA D L OGON - 0x20, 0x20, 0x20, 0x20, 0x20, 0x4b, 0x45, 0x59, 0x53, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x01, - //0x03d0: KEY S . - 0x00, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x50, 0x55, 0x42, - //0x03e0: .PUB LIC PUB - 0x4c, 0x49, 0x43, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x42, 0x4c, 0x41, 0x43, 0x4b, - //0x03f0: LIC ...B LACK - 0x44, 0x52, 0x41, 0x47, 0x4f, 0x4e, 0x20, 0x52, 0x59, 0x41, 0x4e, 0x20, 0x20, 0x20, 0x20, 0x20, - //0x0400: DRAG ON R YAN - 0x20, 0x20, 0x00, 0x00, 0x00, 0x48, 0x45, 0x4e, 0x44, 0x52, 0x49, 0x58, 0x20, 0x20, 0x20, 0x20, - //0x0410: .. .HEN DRIX - 0x20, 0x4c, 0x4f, 0x55, 0x49, 0x53, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x53, - //0x0420: LOU IS ...S - 0x45, 0x50, 0x54, 0x49, 0x4d, 0x55, 0x53, 0x20, 0x20, 0x20, 0x20, 0x42, 0x45, 0x43, 0x4b, 0x45, - //0x0430: EPTI MUS B ECKE - 0x54, 0x54, 0x20, 0x20, 0x20, 0x20, 0x00, 0xff, 0xff, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - //0x0440: TT .. . - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x22, 0x52, 0x4f, 0x4f, 0x54, 0x20, 0x20, 0x20, 0x20, - //0x0450: ." ROOT - 0x20, 0x20, 0x20, 0x20, 0x00, 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - //0x0460: ." - 0x20, 0x20, 0x00, 0x30, 0x30, 0x30, 0x30, 0x00, 0x30, 0x30, 0x00, 0x0d, 0x0a, 0x0d, 0x0a, 0x24, - //0x0470: .0 000. 00.. ...$ - 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x20, 0x4e, 0x41, 0x4d, 0x45, 0x20, 0x4f, 0x4e, 0x45, 0x20, - //0x0480: OBJE CT N AME ONE + 0x14, 0x00, 0x00, 0x32, 0x14, 0x00, 0x0b, 0x0b, 0x1e, 0x00, 0x00, 0x32, 0x14, 0x00, 0x0b, 0x16, + //0x0370: ...2 .... ...2 .... + 0x14, 0x00, 0x00, 0x32, 0x14, 0x00, 0x0e, 0x21, 0x28, 0x00, 0x00, 0x32, 0x14, 0x00, 0xff, 0x44, + //0x0380: ...2 ...! (..2 ...D + 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x56, 0x39, 0x39, 0x00, 0x00, 0x01, 0x45, 0x58, + //0x0390: REAM WEB. V99. ..EX + 0x49, 0x54, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x48, 0x45, 0x4c, 0x50, 0x20, 0x20, 0x20, 0x20, + //0x03a0: IT HELP + 0x20, 0x20, 0x4c, 0x49, 0x53, 0x54, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x52, 0x45, 0x41, 0x44, + //0x03b0: LI ST READ + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x4c, 0x4f, 0x47, 0x4f, 0x4e, 0x20, 0x20, 0x20, 0x20, 0x20, + //0x03c0: LO GON + 0x4b, 0x45, 0x59, 0x53, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x01, 0x00, 0x50, 0x55, 0x42, 0x4c, + //0x03d0: KEYS .. PUBL + 0x49, 0x43, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x20, 0x20, + //0x03e0: IC PUBL IC + 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x42, 0x4c, 0x41, 0x43, 0x4b, 0x44, 0x52, 0x41, 0x47, 0x4f, + //0x03f0: . ..BL ACKD RAGO + 0x4e, 0x20, 0x52, 0x59, 0x41, 0x4e, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, + //0x0400: N RY AN ... + 0x48, 0x45, 0x4e, 0x44, 0x52, 0x49, 0x58, 0x20, 0x20, 0x20, 0x20, 0x20, 0x4c, 0x4f, 0x55, 0x49, + //0x0410: HEND RIX LOUI + 0x53, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x53, 0x45, 0x50, 0x54, 0x49, 0x4d, + //0x0420: S . ..SE PTIM + 0x55, 0x53, 0x20, 0x20, 0x20, 0x20, 0x42, 0x45, 0x43, 0x4b, 0x45, 0x54, 0x54, 0x20, 0x20, 0x20, + //0x0430: US BE CKET T + 0x20, 0x00, 0xff, 0xff, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + //0x0440: ... + 0x20, 0x00, 0x22, 0x52, 0x4f, 0x4f, 0x54, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, + //0x0450: ."R OOT . + 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x30, 0x30, + //0x0460: " .00 + 0x30, 0x30, 0x00, 0x30, 0x30, 0x00, 0x0d, 0x0a, 0x0d, 0x0a, 0x24, 0x4f, 0x42, 0x4a, 0x45, 0x43, + //0x0470: 00.0 0... ..$O BJEC + 0x54, 0x20, 0x4e, 0x41, 0x4d, 0x45, 0x20, 0x4f, 0x4e, 0x45, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + //0x0480: T NA ME O NE 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, //0x0490: - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x10, 0x12, 0x12, 0x11, 0x10, 0x10, 0x10, - //0x04a0: .... .... - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, - //0x04b0: .... .... .... .... - 0x02, 0x44, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x04c0: .D:. .... .... .... + 0x20, 0x20, 0x20, 0x00, 0x10, 0x12, 0x12, 0x11, 0x10, 0x10, 0x10, 0x01, 0x01, 0x01, 0x01, 0x01, + //0x04a0: . .... .... .... + 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x44, 0x3a, 0x00, 0x00, + //0x04b0: .... .... .... D:.. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + //0x04c0: .... .... .... .... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, //0x04d0: .... .... .... .... - 0x00, 0x01, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x02, //0x04e0: .... .... .... .... - 0x00, 0x05, 0x00, 0x03, 0x02, 0x04, 0x01, 0x0a, 0x09, 0x08, 0x06, 0x0b, 0x04, 0x07, 0x07, 0x00, + 0x04, 0x01, 0x0a, 0x09, 0x08, 0x06, 0x0b, 0x04, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x04f0: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0500: .... .... .... .... @@ -4938,9 +4938,9 @@ void DreamGenContext::__start() { //0x0550: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0560: .... .... .... .... - 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, 0xff, //0x0570: .... .... .... .... - 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, }; + 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, }; ds.assign(src, src + sizeof(src)); dreamweb(); } diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 92c6f82e12..3b9c2cf034 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -32,14 +32,14 @@ namespace DreamGen { -static const uint16 offset_rootdir = 0x0457; -static const uint16 offset_money2poke = 0x0478; -static const uint16 offset_keys = 0x03df; -static const uint16 offset_money1poke = 0x0473; -static const uint16 offset_comlist = 0x03a3; -static const uint16 offset_openchangesize = 0x03a1; -static const uint16 offset_commandline = 0x0480; -static const uint16 offset_operand1 = 0x0449; +static const uint16 offset_money1poke = 0x046e; +static const uint16 offset_operand1 = 0x0444; +static const uint16 offset_comlist = 0x039e; +static const uint16 offset_commandline = 0x047b; +static const uint16 offset_rootdir = 0x0452; +static const uint16 offset_money2poke = 0x0473; +static const uint16 offset_openchangesize = 0x039c; +static const uint16 offset_keys = 0x03da; static const uint16 kStartvars = 0; static const uint16 kProgresspoints = 1; static const uint16 kWatchon = 2; @@ -359,32 +359,29 @@ static const uint16 kLinestartx = 431; static const uint16 kLinestarty = 433; static const uint16 kLineendx = 435; static const uint16 kLineendy = 437; -static const uint16 kIncrement1 = 439; -static const uint16 kIncrement2 = 441; -static const uint16 kLineroutine = 443; -static const uint16 kLinepointer = 444; -static const uint16 kLinedirection = 445; -static const uint16 kLinelength = 446; -static const uint16 kLiftsoundcount = 447; -static const uint16 kCh0blockstocopy = 448; -static const uint16 kCh0playing = 450; -static const uint16 kCh0repeat = 451; -static const uint16 kCh1playing = 452; -static const uint16 kCh1blockstocopy = 453; -static const uint16 kSoundbufferwrite = 455; -static const uint16 kCurrentsample = 457; -static const uint16 kRoomssample = 458; -static const uint16 kReelroutines = 459; -static const uint16 kBasicsample = 916; -static const uint16 kCurrentfile = 1125; -static const uint16 kRoomscango = 1249; -static const uint16 kRoompics = 1265; -static const uint16 kOplist = 1280; -static const uint16 kInputline = 1283; -static const uint16 kPresslist = 1411; -static const uint16 kQuitrequested = 1417; -static const uint16 kSubtitles = 1418; -static const uint16 kForeignrelease = 1419; +static const uint16 kLinepointer = 439; +static const uint16 kLinedirection = 440; +static const uint16 kLinelength = 441; +static const uint16 kLiftsoundcount = 442; +static const uint16 kCh0blockstocopy = 443; +static const uint16 kCh0playing = 445; +static const uint16 kCh0repeat = 446; +static const uint16 kCh1playing = 447; +static const uint16 kCh1blockstocopy = 448; +static const uint16 kSoundbufferwrite = 450; +static const uint16 kCurrentsample = 452; +static const uint16 kRoomssample = 453; +static const uint16 kReelroutines = 454; +static const uint16 kBasicsample = 911; +static const uint16 kCurrentfile = 1120; +static const uint16 kRoomscango = 1244; +static const uint16 kRoompics = 1260; +static const uint16 kOplist = 1275; +static const uint16 kInputline = 1278; +static const uint16 kPresslist = 1406; +static const uint16 kQuitrequested = 1412; +static const uint16 kSubtitles = 1413; +static const uint16 kForeignrelease = 1414; static const uint16 kBlocktextdat = (0); static const uint16 kPersonframes = (0); static const uint16 kDebuglevel1 = (0); @@ -423,8 +420,8 @@ static const uint16 kListofchanges = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768 static const uint16 kUndertimedtext = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)); static const uint16 kRainlist = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)); static const uint16 kInitialreelrouts = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)); -static const uint16 kInitialvars = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+916-459); -static const uint16 kLengthofbuffer = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+916-459+68-0); +static const uint16 kInitialvars = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+911-454); +static const uint16 kLengthofbuffer = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+911-454+68-0); static const uint16 kReellist = (0+(36*144)); static const uint16 kIntext = (0+(38*2)); static const uint16 kLengthofmap = (0+(66*60)); @@ -475,7 +472,7 @@ static const uint16 kKeypady = (72); static const uint16 kZoomx = (8); static const uint16 kInventx = (80); static const uint16 kMenux = (80+40); -static const uint16 kLenofreelrouts = (916-459); +static const uint16 kLenofreelrouts = (911-454); static const uint16 kHeaderlen = (96); diff --git a/engines/dreamweb/pathfind.cpp b/engines/dreamweb/pathfind.cpp index f6591d4666..212d61e6e2 100644 --- a/engines/dreamweb/pathfind.cpp +++ b/engines/dreamweb/pathfind.cpp @@ -230,33 +230,35 @@ void DreamBase::bresenhams() { } uint16 delta1, delta2; + byte lineRoutine; + if (deltaY > deltaX) { - data.byte(kLineroutine) = 1; + lineRoutine = 1; delta1 = deltaY; delta2 = deltaX; } else { - data.byte(kLineroutine) = 0; + lineRoutine = 0; delta1 = deltaX; delta2 = deltaY; } - data.word(kIncrement1) = delta2 * 2; + uint16 increment1 = delta2 * 2; + uint16 increment2 = delta2 * 2 - delta1 * 2; int16 remainder = delta2 * 2 - delta1; - data.word(kIncrement2) = delta2 * 2 - delta1 * 2; ++delta1; int8 x = (int8)startX; int8 y = (int8)startY; data.byte(kLinelength) = delta1; - if (data.byte(kLineroutine) != 1) { + if (lineRoutine != 1) { for (; delta1; --delta1) { lineData->x = x; lineData->y = y; ++lineData; ++x; if (remainder < 0) { - remainder += data.word(kIncrement1); + remainder += increment1; } else { - remainder += data.word(kIncrement2); + remainder += increment2; y += increment; } } @@ -267,9 +269,9 @@ void DreamBase::bresenhams() { ++lineData; y += increment; if (remainder < 0) { - remainder += data.word(kIncrement1); + remainder += increment1; } else { - remainder += data.word(kIncrement2); + remainder += increment2; ++x; } } -- cgit v1.2.3 From 8a9eaa58dfc163da4e1588dcf45faae5f1e62f15 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 13 Dec 2011 01:29:05 +0100 Subject: TSAGE: R2R - Implement scene 2530 --- engines/tsage/ringworld2/ringworld2_logic.cpp | 2 + engines/tsage/ringworld2/ringworld2_scenes2.cpp | 157 ++++++++++++++++++++++++ engines/tsage/ringworld2/ringworld2_scenes2.h | 30 +++++ 3 files changed, 189 insertions(+) (limited to 'engines') diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index 8f85bbdea3..296da52da5 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -131,6 +131,8 @@ Scene *Ringworld2Game::createScene(int sceneNumber) { // Maze: Furnace room return new Scene2525(); case 2530: + // Maze: Well + return new Scene2530(); case 2535: case 2600: case 2700: diff --git a/engines/tsage/ringworld2/ringworld2_scenes2.cpp b/engines/tsage/ringworld2/ringworld2_scenes2.cpp index d15763fb29..cbb6dbc42e 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes2.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes2.cpp @@ -2643,5 +2643,162 @@ void Scene2525::signal() { } } +/*-------------------------------------------------------------------------- + * Scene 2530 - Maze: Well + * + *--------------------------------------------------------------------------*/ +bool Scene2530::Actor2::startAction(CursorType action, Event &event) { + Scene2530 *scene = (Scene2530 *)R2_GLOBALS._sceneManager._scene; + + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + + if (R2_GLOBALS._player._characterIndex == 2) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 2530; + scene->setAction(&scene->_sequenceManager, scene, 2530, &R2_GLOBALS._player, &scene->_actor2, NULL); + } else { + SceneItem::display(2530, 33, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + } + + return true; +} + +bool Scene2530::Actor3::startAction(CursorType action, Event &event) { + Scene2530 *scene = (Scene2530 *)R2_GLOBALS._sceneManager._scene; + + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + + if (R2_GLOBALS._player._characterIndex == 1) { + if (R2_GLOBALS.getFlag(73)) + SceneItem::display(2530, 35, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + else { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 2532; + scene->setAction(&scene->_sequenceManager, scene, 2532, &R2_GLOBALS._player, &scene->_actor3, NULL); + } + } else { + if (R2_GLOBALS.getFlag(73)) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 2533; + scene->setAction(&scene->_sequenceManager, scene, 2533, &R2_GLOBALS._player, &scene->_actor3, NULL); + } else { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 2531; + scene->setAction(&scene->_sequenceManager, scene, 2531, &R2_GLOBALS._player, &scene->_actor3, NULL); + } + } + + return true; +} + +void Scene2530::Exit1::changeScene() { + Scene2530 *scene = (Scene2530 *)R2_GLOBALS._sceneManager._scene; + + _enabled = false; + R2_GLOBALS._events.setCursor(CURSOR_ARROW); + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 11; + + Common::Point pt(108, 200); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); +} + +void Scene2530::postInit(SceneObjectList *OwnerList) { + loadScene(2530); + SceneExt::postInit(); + + _exit1.setDetails(Rect(68, 155, 147, 168), EXITCURSOR_S, 2000); + _exit1.setDest(Common::Point(108, 160)); + + if (R2_INVENTORY.getObjectScene(33) == 2530) { + _actor2.postInit(); + _actor2.setup(2435, 1, 3); + _actor2.setPosition(Common::Point(299, 80)); + _actor2.fixPriority(80); + _actor2.setDetails(2530, 28, -1, -1, 1, NULL); + } + + _actor3.postInit(); + if (R2_GLOBALS.getFlag(73)) { + _actor3.setup(2531, 4, 2); + _actor3.setPosition(Common::Point(154, 130)); + } else { + _actor3.setup(2531, 4, 1); + _actor3.setPosition(Common::Point(173, 131)); + } + _actor3.setDetails(2530, 22, -1, -1, 1, NULL); + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + + if (R2_GLOBALS._player._characterIndex == 1) { + R2_GLOBALS._player.setVisage(2008); + R2_GLOBALS._player._moveDiff = Common::Point(3, 2); + } else { + R2_GLOBALS._player.setVisage(20); + R2_GLOBALS._player._moveDiff = Common::Point(5, 3); + } + R2_GLOBALS._player.setPosition(Common::Point(100, 200)); + + if (R2_GLOBALS._player._characterScene[1] == R2_GLOBALS._player._characterScene[2]) { + _actor1.postInit(); + if (R2_GLOBALS._player._characterIndex == 1) { + _actor1.setup(20, 5, 1); + _actor1.setDetails(9002, 0, 4, 3, 1, NULL); + } else { + _actor1.setup(2008, 5, 1); + _actor1.setDetails(9001, 0, 5, 3, 1, NULL); + } + _actor1.setPosition(Common::Point(20, 130)); + R2_GLOBALS._walkRegions.enableRegion(1); + } + + _item2.setDetails(Rect(108, 90, 135, 205), 2530, 22, -1, -1, 1, NULL); + _item5.setDetails(Rect(115, 112, 206, 130), 2530, 25, -1, 27, 1, NULL); + _item3.setDetails(Rect(256, 64, 311, 85), 2530, 31, -1, 33, 1, NULL); + _item1.setDetails(Rect(0, 0, 320, 200), 2530, 0, 1, -1, 1, NULL); + + R2_GLOBALS._player.disableControl(); + + if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 2000) { + R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] = 2530; + Common::Point pt(108, 150); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } else { + R2_GLOBALS._player.setPosition(Common::Point(105, 145)); + R2_GLOBALS._player.setStrip(3); + R2_GLOBALS._player.enableControl(); + } +} + +void Scene2530::signal() { + switch (_sceneMode) { + case 11: + g_globals->_sceneManager.changeScene(2000); + break; + case 2530: + R2_INVENTORY.setObjectScene(33, 2); + _actor2.remove(); + break; + case 2531: + // No break on purpose + case 2532: + R2_GLOBALS.setFlag(73); + R2_GLOBALS._player.enableControl(); + break; + case 2533: + R2_GLOBALS.clearFlag(73); + R2_GLOBALS._player.enableControl(); + break; + default: + R2_GLOBALS._player.enableControl(); + break; + } +} + } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_scenes2.h b/engines/tsage/ringworld2/ringworld2_scenes2.h index b906921842..bef1fc9ea8 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes2.h +++ b/engines/tsage/ringworld2/ringworld2_scenes2.h @@ -414,6 +414,36 @@ public: virtual void remove(); virtual void signal(); }; + +class Scene2530 : public SceneExt { + class Actor2 : public SceneActor { + public: + bool startAction(CursorType action, Event &event); + }; + class Actor3 : public SceneActor { + public: + bool startAction(CursorType action, Event &event); + }; + + class Exit1 : public SceneExit { + public: + virtual void changeScene(); + }; +public: + NamedHotspot _item1; + NamedHotspot _item2; + NamedHotspot _item3; + NamedHotspot _item4; + NamedHotspot _item5; + SceneActor _actor1; + Actor2 _actor2; + Actor3 _actor3; + Exit1 _exit1; + SequenceManager _sequenceManager; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); +}; } // End of namespace Ringworld2 } // End of namespace TsAGE -- cgit v1.2.3 From 22d3118aff380aa301443275953fb1af7624d136 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 13 Dec 2011 00:38:57 +0000 Subject: AGI: Fix bug #3095169: AGI inventory items --- engines/agi/objects.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/agi/objects.cpp b/engines/agi/objects.cpp index 94eef92579..447cff2a3f 100644 --- a/engines/agi/objects.cpp +++ b/engines/agi/objects.cpp @@ -52,7 +52,7 @@ int AgiEngine::decodeObjects(uint8 *mem, uint32 flen) { // alloc memory for object list // byte 3 = number of animated objects. this is ignored.. ?? - if (READ_LE_UINT16(mem) / padsize >= 256) { + if (READ_LE_UINT16(mem) / padsize > 256) { // die with no error! AGDS game needs not to die to work!! :( return errOK; } -- cgit v1.2.3 From 38ff68e4492df227f49f3932f16d7b3a5a5c9231 Mon Sep 17 00:00:00 2001 From: Tarek Soliman Date: Mon, 12 Dec 2011 20:16:09 -0600 Subject: KYRA: Use Common::KeyActionEntry table for LoL game keymap This is for the keymapper keymap --- engines/kyra/lol.cpp | 54 +++++++++++++++++++--------------------------------- 1 file changed, 20 insertions(+), 34 deletions(-) (limited to 'engines') diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp index 538e88aa90..7d73526411 100644 --- a/engines/kyra/lol.cpp +++ b/engines/kyra/lol.cpp @@ -568,41 +568,27 @@ void LoLEngine::initKeymap() { Common::Action *act; Common::Keymap *engineKeyMap = new Common::Keymap(kKeymapName); - act = new Common::Action(engineKeyMap, "AT1", _("Attack 1"), Common::kGenericActionType, Common::kActionKeyType); - act->addKeyEvent(Common::KeyState(Common::KEYCODE_F1, Common::ASCII_F1 , 0)); - - act = new Common::Action(engineKeyMap, "AT2", _("Attack 2"), Common::kGenericActionType, Common::kActionKeyType); - act->addKeyEvent(Common::KeyState(Common::KEYCODE_F2, Common::ASCII_F2 , 0)); - - act = new Common::Action(engineKeyMap, "AT3", _("Attack 3"), Common::kGenericActionType, Common::kActionKeyType); - act->addKeyEvent(Common::KeyState(Common::KEYCODE_F3, Common::ASCII_F3 , 0)); - - act = new Common::Action(engineKeyMap, "MVF", _("Move Forward"), Common::kGenericActionType, Common::kActionKeyType); - act->addKeyEvent(Common::KeyState(Common::KEYCODE_UP)); - - act = new Common::Action(engineKeyMap, "MVB", _("Move Back"), Common::kGenericActionType, Common::kActionKeyType); - act->addKeyEvent(Common::KeyState(Common::KEYCODE_DOWN)); - - act = new Common::Action(engineKeyMap, "SLL", _("Slide Left"), Common::kGenericActionType, Common::kActionKeyType); - act->addKeyEvent(Common::KeyState(Common::KEYCODE_LEFT)); - - act = new Common::Action(engineKeyMap, "SLR", _("Slide Right"), Common::kGenericActionType, Common::kActionKeyType); - act->addKeyEvent(Common::KeyState(Common::KEYCODE_RIGHT)); - - act = new Common::Action(engineKeyMap, "TL", _("Turn Left"), Common::kGenericActionType, Common::kActionKeyType); - act->addKeyEvent(Common::KeyState(Common::KEYCODE_HOME)); - - act = new Common::Action(engineKeyMap, "TR", _("Turn Right"), Common::kGenericActionType, Common::kActionKeyType); - act->addKeyEvent(Common::KeyState(Common::KEYCODE_PAGEUP)); - - act = new Common::Action(engineKeyMap, "RST", _("Rest"), Common::kGenericActionType, Common::kActionKeyType); - act->addKeyEvent(Common::KeyState(Common::KEYCODE_r)); - - act = new Common::Action(engineKeyMap, "OPT", _("Options"), Common::kGenericActionType, Common::kActionKeyType); - act->addKeyEvent(Common::KeyState(Common::KEYCODE_o)); + const Common::KeyActionEntry keyActionEntries[] = { + {Common::KeyState(Common::KEYCODE_F1, Common::ASCII_F1 , 0), "AT1", _("Attack 1")}, + {Common::KeyState(Common::KEYCODE_F2, Common::ASCII_F2 , 0), "AT2", _("Attack 2")}, + {Common::KeyState(Common::KEYCODE_F3, Common::ASCII_F2 , 0), "AT3", _("Attack 3")}, + {Common::KeyState(Common::KEYCODE_UP), "MVF", _("Move Forward")}, + {Common::KeyState(Common::KEYCODE_DOWN), "MVB", _("Move Back")}, + {Common::KeyState(Common::KEYCODE_LEFT), "SLL", _("Slide Left")}, + {Common::KeyState(Common::KEYCODE_RIGHT), "SLR", _("Slide Right")}, + {Common::KeyState(Common::KEYCODE_HOME), "TL", _("Turn Left")}, + {Common::KeyState(Common::KEYCODE_PAGEUP), "TR", _("Turn Right")}, + {Common::KeyState(Common::KEYCODE_r), "RST", _("Rest")}, + {Common::KeyState(Common::KEYCODE_o), "OPT", _("Options")}, + {Common::KeyState(Common::KEYCODE_SLASH), "SPL", _("Choose Spell")}, + {Common::KeyState(), 0, 0} + }; - act = new Common::Action(engineKeyMap, "SPL", _("Choose Spell"), Common::kGenericActionType, Common::kActionKeyType); - act->addKeyEvent(Common::KeyState(Common::KEYCODE_SLASH)); + const Common::KeyActionEntry *entry; + for (entry = keyActionEntries; entry->id; ++entry) { + act = new Common::Action(engineKeyMap, entry->id, Common::String(entry->description), Common::kGenericActionType, Common::kActionKeyType); + act->addKeyEvent(Common::KeyState(entry->ks)); + } mapper->addGameKeymap(engineKeyMap); -- cgit v1.2.3 From 1305c5ab315c6468076eac07ac8b78c24d695eac Mon Sep 17 00:00:00 2001 From: Tarek Soliman Date: Mon, 12 Dec 2011 22:37:36 -0600 Subject: KYRA: Fix whitespace --- engines/kyra/lol.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'engines') diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp index 7d73526411..120900537b 100644 --- a/engines/kyra/lol.cpp +++ b/engines/kyra/lol.cpp @@ -569,9 +569,9 @@ void LoLEngine::initKeymap() { Common::Keymap *engineKeyMap = new Common::Keymap(kKeymapName); const Common::KeyActionEntry keyActionEntries[] = { - {Common::KeyState(Common::KEYCODE_F1, Common::ASCII_F1 , 0), "AT1", _("Attack 1")}, - {Common::KeyState(Common::KEYCODE_F2, Common::ASCII_F2 , 0), "AT2", _("Attack 2")}, - {Common::KeyState(Common::KEYCODE_F3, Common::ASCII_F2 , 0), "AT3", _("Attack 3")}, + {Common::KeyState(Common::KEYCODE_F1, Common::ASCII_F1, 0), "AT1", _("Attack 1")}, + {Common::KeyState(Common::KEYCODE_F2, Common::ASCII_F2, 0), "AT2", _("Attack 2")}, + {Common::KeyState(Common::KEYCODE_F3, Common::ASCII_F2, 0), "AT3", _("Attack 3")}, {Common::KeyState(Common::KEYCODE_UP), "MVF", _("Move Forward")}, {Common::KeyState(Common::KEYCODE_DOWN), "MVB", _("Move Back")}, {Common::KeyState(Common::KEYCODE_LEFT), "SLL", _("Slide Left")}, -- cgit v1.2.3 From 25e42e1baa04013755593db4b46e368e7ff051eb Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 13 Dec 2011 10:21:19 +0200 Subject: DREAMWEB: 'removefreeobject' is unused. Port 'updatesymboltop', 'updatesymbolbot' to C++ --- engines/dreamweb/dreamgen.cpp | 98 ------------------------------------------- engines/dreamweb/dreamgen.h | 3 -- engines/dreamweb/stubs.cpp | 74 ++++++++++++++++++++++++++++++++ engines/dreamweb/stubs.h | 2 + 4 files changed, 76 insertions(+), 101 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 681bb79085..63942575bf 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -4060,16 +4060,6 @@ void DreamGenContext::findPuzText() { si = ax; } -void DreamGenContext::removeFreeObject() { - STACK_CHECK; - push(es); - push(bx); - getFreeAd(); - es.byte(bx+2) = 255; - bx = pop(); - es = pop(); -} - void DreamGenContext::useGun() { STACK_CHECK; _cmp(data.byte(kObjecttype), 4); @@ -4247,94 +4237,6 @@ nottvsoldier: putBackObStuff(); } -void DreamGenContext::updateSymbolTop() { - STACK_CHECK; - _cmp(data.byte(kSymboltopdir), 0); - if (flags.z()) - return /* (topfinished) */; - _cmp(data.byte(kSymboltopdir), -1); - if (flags.z()) - goto backwards; - _inc(data.byte(kSymboltopx)); - _cmp(data.byte(kSymboltopx), 49); - if (!flags.z()) - goto notwrapfor; - data.byte(kSymboltopx) = 0; - _dec(data.byte(kSymboltopnum)); - _cmp(data.byte(kSymboltopnum), -1); - if (!flags.z()) - return /* (topfinished) */; - data.byte(kSymboltopnum) = 5; - return; -notwrapfor: - _cmp(data.byte(kSymboltopx), 24); - if (!flags.z()) - return /* (topfinished) */; - data.byte(kSymboltopdir) = 0; - return; -backwards: - _dec(data.byte(kSymboltopx)); - _cmp(data.byte(kSymboltopx), -1); - if (!flags.z()) - goto notwrapback; - data.byte(kSymboltopx) = 48; - _inc(data.byte(kSymboltopnum)); - _cmp(data.byte(kSymboltopnum), 6); - if (!flags.z()) - return /* (topfinished) */; - data.byte(kSymboltopnum) = 0; - return; -notwrapback: - _cmp(data.byte(kSymboltopx), 24); - if (!flags.z()) - return /* (topfinished) */; - data.byte(kSymboltopdir) = 0; -} - -void DreamGenContext::updateSymbolBot() { - STACK_CHECK; - _cmp(data.byte(kSymbolbotdir), 0); - if (flags.z()) - return /* (botfinished) */; - _cmp(data.byte(kSymbolbotdir), -1); - if (flags.z()) - goto backwardsbot; - _inc(data.byte(kSymbolbotx)); - _cmp(data.byte(kSymbolbotx), 49); - if (!flags.z()) - goto notwrapforb; - data.byte(kSymbolbotx) = 0; - _dec(data.byte(kSymbolbotnum)); - _cmp(data.byte(kSymbolbotnum), -1); - if (!flags.z()) - return /* (botfinished) */; - data.byte(kSymbolbotnum) = 5; - return; -notwrapforb: - _cmp(data.byte(kSymbolbotx), 24); - if (!flags.z()) - return /* (botfinished) */; - data.byte(kSymbolbotdir) = 0; - return; -backwardsbot: - _dec(data.byte(kSymbolbotx)); - _cmp(data.byte(kSymbolbotx), -1); - if (!flags.z()) - goto notwrapbackb; - data.byte(kSymbolbotx) = 48; - _inc(data.byte(kSymbolbotnum)); - _cmp(data.byte(kSymbolbotnum), 6); - if (!flags.z()) - return /* (botfinished) */; - data.byte(kSymbolbotnum) = 0; - return; -notwrapbackb: - _cmp(data.byte(kSymbolbotx), 24); - if (!flags.z()) - return /* (botfinished) */; - data.byte(kSymbolbotdir) = 0; -} - void DreamGenContext::showDiaryKeys() { STACK_CHECK; _cmp(data.byte(kPresscount), 0); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 3b9c2cf034..b7fb2495c5 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -547,7 +547,6 @@ public: void fillOpen(); void findSetObject(); void deleteExObject(); - void removeFreeObject(); void lookAtCard(); void helicopter(); void getEitherAd(); @@ -580,12 +579,10 @@ public: void getExAd(); void initialMonCols(); void execCommand(); - void updateSymbolBot(); void findPuzText(); void swapWithInv(); void adjustRight(); void transferToEx(); - void updateSymbolTop(); void getPersonText(); void parser(); void emergencyPurge(); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 97dad08298..6dc74b7309 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -4511,4 +4511,78 @@ void DreamGenContext::selectSlot() { delPointer(); } +void DreamGenContext::updateSymbolTop() { + if (!data.byte(kSymboltopdir)) + return; // topfinished + + if (data.byte(kSymboltopdir) == (byte)-1) { + // Backward + data.byte(kSymboltopx)--; + if (data.byte(kSymboltopx) != (byte)-1) { + // Not wrapping + if (data.byte(kSymboltopx) != 24) + return; // topfinished + data.byte(kSymboltopdir) = 0; + } else { + data.byte(kSymboltopx) = 48; + data.byte(kSymboltopnum)++; + if (data.byte(kSymboltopnum) != 6) + return; // topfinished + data.byte(kSymboltopnum) = 0; + } + } else { + // Forward + data.byte(kSymboltopx)++; + if (data.byte(kSymboltopx) != 49) { + // Not wrapping + if (data.byte(kSymboltopx) != 24) + return; // topfinished + data.byte(kSymboltopdir) = 0; + } else { + data.byte(kSymboltopx) = 0; + data.byte(kSymboltopnum)--; + if (data.byte(kSymboltopnum) != (byte)-1) + return; // topfinished + data.byte(kSymboltopnum) = 5; + } + } +} + +void DreamGenContext::updateSymbolBot() { + if (!data.byte(kSymbolbotdir)) + return; // botfinished + + if (data.byte(kSymbolbotdir) == (byte)-1) { + // Backward + data.byte(kSymbolbotx)--; + if (data.byte(kSymbolbotx) != (byte)-1) { + // Not wrapping + if (data.byte(kSymbolbotx) != 24) + return; // botfinished + data.byte(kSymbolbotdir) = 0; + } else { + data.byte(kSymbolbotx) = 48; + data.byte(kSymbolbotnum)++; + if (data.byte(kSymbolbotnum) != 6) + return; // botfinished + data.byte(kSymbolbotnum) = 0; + } + } else { + // Forward + data.byte(kSymbolbotx)++; + if (data.byte(kSymbolbotx) != 49) { + // Not wrapping + if (data.byte(kSymbolbotx) != 24) + return; // botfinished + data.byte(kSymbolbotdir) = 0; + } else { + data.byte(kSymbolbotx) = 0; + data.byte(kSymbolbotnum)--; + if (data.byte(kSymbolbotnum) != (byte)-1) + return; // botfinished + data.byte(kSymbolbotnum) = 5; + } + } +} + } // End of namespace DreamGen diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index ed45e40b8d..6a8445b991 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -577,5 +577,7 @@ void entryAnims(); void triggerMessage(uint16 index); void processTrigger(); + void updateSymbolTop(); + void updateSymbolBot(); #endif -- cgit v1.2.3 From d124e25cfe6b022c7030842493065fa91c616bd5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 13 Dec 2011 20:33:45 +1100 Subject: TSAGE: Bugfix to show R2R conversations in front of other on-screen objects --- engines/tsage/ringworld2/ringworld2_speakers.cpp | 9 +++++++-- engines/tsage/ringworld2/ringworld2_speakers.h | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'engines') diff --git a/engines/tsage/ringworld2/ringworld2_speakers.cpp b/engines/tsage/ringworld2/ringworld2_speakers.cpp index 8c8bd7171a..cff7334090 100644 --- a/engines/tsage/ringworld2/ringworld2_speakers.cpp +++ b/engines/tsage/ringworld2/ringworld2_speakers.cpp @@ -128,7 +128,7 @@ void VisualSpeaker::setText(const Common::String &msg) { //_sceneText.clone(); _sceneText.setPosition(_textPos); - _sceneText.setPriority(0x100); + _sceneText.fixPriority(256); // If subtitles are turned off, don't show the text if (!(R2_GLOBALS._speechSubtitles & SPEECH_TEXT)) { @@ -148,7 +148,7 @@ void VisualSpeaker::setText(const Common::String &msg) { ++numWords; _numFrames = numWords * 30 + 120; - setFrame(_numFrames); + setDelay(_numFrames); } else { _numFrames = 1; } @@ -185,6 +185,11 @@ void VisualSpeaker::setFrame(int numFrames) { _frameNumber = R2_GLOBALS._events.getFrameNumber(); } +void VisualSpeaker::setDelay(int delay) { + _delayAmount = delay; + _frameNumber = R2_GLOBALS._events.getFrameNumber(); +} + /*--------------------------------------------------------------------------*/ SpeakerMiranda300::SpeakerMiranda300(): VisualSpeaker() { diff --git a/engines/tsage/ringworld2/ringworld2_speakers.h b/engines/tsage/ringworld2/ringworld2_speakers.h index e6a805f31b..b8ad17886a 100644 --- a/engines/tsage/ringworld2/ringworld2_speakers.h +++ b/engines/tsage/ringworld2/ringworld2_speakers.h @@ -59,6 +59,8 @@ public: virtual void setText(const Common::String &msg); virtual void proc15() {} virtual void proc16(); + + void setDelay(int delay); }; class SpeakerMiranda300 : public VisualSpeaker { -- cgit v1.2.3 From fb66ae3698f75ccfd7ac541b85e1646596fca968 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Tue, 13 Dec 2011 10:36:50 +0100 Subject: DREAMWEB: Fix regression in selecSlot --- engines/dreamweb/stubs.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 6dc74b7309..a7d65845e1 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -4488,15 +4488,12 @@ void DreamGenContext::selectSlot() { data.byte(kLoadingorsave)--; oldToNames(); - uint16 y = data.word(kMousey) - (kOpsy + 4); - byte currentSlot = (byte)-1; - - do { - currentSlot++; - y -= 11; - } while (y >= 11); + int y = data.word(kMousey) - (kOpsy + 4); + if (y < 11) + data.byte(kCurrentslot) = 0; + else + data.byte(kCurrentslot) = y / 11; - data.byte(kCurrentslot) = currentSlot; delPointer(); showOpBox(); showSlots(); -- cgit v1.2.3 From a1dfacb4c9df35928372db4472dba117e72e2590 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 13 Dec 2011 20:49:42 +1100 Subject: TSAGE: Implement missing doorway code in R2R scene 300 --- engines/tsage/ringworld2/ringworld2_scenes0.cpp | 20 +++++++++++++++++++- engines/tsage/ringworld2/ringworld2_scenes0.h | 7 ++++++- 2 files changed, 25 insertions(+), 2 deletions(-) (limited to 'engines') diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index 214853ce86..4a0443e798 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -1707,6 +1707,25 @@ bool Scene300::Quinn::startAction(CursorType action, Event &event) { } } +bool Scene300::Doorway::startAction(CursorType action, Event &event) { + Scene300 *scene = (Scene300 *)R2_GLOBALS._sceneManager._scene; + + if (action == CURSOR_USE) { + if ((R2_GLOBALS._player._characterIndex == R2_QUINN) && + (!R2_GLOBALS.getFlag(44) || R2_GLOBALS._player._characterScene[R2_MIRANDA] == 500)) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 301; + scene->setAction(&scene->_sequenceManager1, scene, 301, &R2_GLOBALS._player, this, NULL); + } else { + SceneItem::display2(300, 45); + } + + return true; + } else { + return SceneActor::startAction(action, event); + } +} + /*--------------------------------------------------------------------------*/ Scene300::Scene300(): SceneExt() { @@ -1769,7 +1788,6 @@ void Scene300::postInit(SceneObjectList *OwnerList) { _object4.postInit(); _object4.setup(300, 5, 1); _object4.setPosition(Common::Point(236, 48)); - _object4.animate(ANIM_MODE_2, NULL); _protocolDisplay.postInit(); diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.h b/engines/tsage/ringworld2/ringworld2_scenes0.h index 834b91c01c..be07a4064b 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.h +++ b/engines/tsage/ringworld2/ringworld2_scenes0.h @@ -240,6 +240,10 @@ class Scene300: public SceneExt { public: virtual bool startAction(CursorType action, Event &event); }; + class Doorway: public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; public: SequenceManager _sequenceManager1, _sequenceManager2, _sequenceManager3, _sequenceManager4; ASoundExt _sound1; @@ -258,7 +262,8 @@ public: MirandaWorkstation _mirandaWorkstation1, _mirandaWorkstation2; SceneActor _object1, _object2, _object3, _object4, _protocolDisplay; SceneActor _object6, _object7, _object8, _object9; - SceneActor _teal, _soldier, _object12, _doorway; + SceneActor _teal, _soldier, _object12; + Doorway _doorway; Miranda _miranda; Seeker _seeker; Quinn _quinn; -- cgit v1.2.3 From a4f74ddf8a98a1a6c37ea415ab7d19f12cd8d3d5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 13 Dec 2011 21:46:24 +1100 Subject: TSAGE: Clarified some hotspot names in R2R Scene 100, and created derived Scene 150 --- engines/tsage/ringworld2/ringworld2_logic.cpp | 4 +- engines/tsage/ringworld2/ringworld2_scenes0.cpp | 149 +++++++++++++++++++----- engines/tsage/ringworld2/ringworld2_scenes0.h | 17 ++- 3 files changed, 136 insertions(+), 34 deletions(-) (limited to 'engines') diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index 296da52da5..f86bab3a87 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -42,8 +42,8 @@ Scene *Ringworld2Game::createScene(int sceneNumber) { case 100: return new Scene100(); // Computer console case 125: return new Scene125(); - // - case 150: + // Empty Bedroom + case 150: return new Scene150(); case 160: case 175: case 180: diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index 4a0443e798..661a52d601 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -94,11 +94,11 @@ bool Scene100::Door::startAction(CursorType action, Event &event) { if (_state) { SceneItem::display2(100, 26); _state = 0; - scene->_object10.setFrame(1); + scene->_doorDisplay.setFrame(1); } else { SceneItem::display2(100, 27); _state = 1; - scene->_object10.setFrame(2); + scene->_doorDisplay.setFrame(2); } return true; default: @@ -176,7 +176,7 @@ bool Scene100::StasisNegator::startAction(CursorType action, Event &event) { } } -bool Scene100::Object10::startAction(CursorType action, Event &event) { +bool Scene100::DoorDisplay::startAction(CursorType action, Event &event) { Scene100 *scene = (Scene100 *)R2_GLOBALS._sceneManager._scene; switch (action) { @@ -242,34 +242,35 @@ void Scene100::postInit(SceneObjectList *OwnerList) { _door.setPosition(Common::Point(160, 84)); _door.setDetails(100, 3, 4, 5, 1, NULL); - _object10.postInit(); - _object10.setup(100, 2, 1); - _object10.setDetails(100, -1, -1, -1, 1, NULL); + _doorDisplay.postInit(); + _doorDisplay.setup(100, 2, 1); + _doorDisplay.setPosition(Common::Point(202, 53)); + _doorDisplay.setDetails(100, -1, -1, -1, 1, NULL); _table.postInit(); _table.setup(100, 2, 3); _table.setPosition(Common::Point(175, 157)); _table.setDetails(100, 17, 18, 20, 1, NULL); - _object1.postInit(); - _object1.setup(100, 3, 1); - _object1.setPosition(Common::Point(89, 79)); - _object1.fixPriority(250); - _object1.animate(ANIM_MODE_2, NULL); - _object1._numFrames = 3; - - _object2.postInit(); - _object2.setup(100, 3, 1); - _object2.setPosition(Common::Point(89, 147)); - _object2.fixPriority(250); - _object2.animate(ANIM_MODE_7, 0, NULL); - _object2._numFrames = 3; - - _object6.postInit(); - _object6.setVisage(101); - _object6.setPosition(Common::Point(231, 126)); - _object6.fixPriority(10); - _object6.setDetails(100, 37, -1, 39, 1, NULL); + _bedLights1.postInit(); + _bedLights1.setup(100, 3, 1); + _bedLights1.setPosition(Common::Point(89, 79)); + _bedLights1.fixPriority(250); + _bedLights1.animate(ANIM_MODE_2, NULL); + _bedLights1._numFrames = 3; + + _bedLights2.postInit(); + _bedLights2.setup(100, 3, 1); + _bedLights2.setPosition(Common::Point(89, 147)); + _bedLights2.fixPriority(250); + _bedLights2.animate(ANIM_MODE_7, 0, NULL); + _bedLights2._numFrames = 3; + + _wardrobe.postInit(); + _wardrobe.setVisage(101); + _wardrobe.setPosition(Common::Point(231, 126)); + _wardrobe.fixPriority(10); + _wardrobe.setDetails(100, 37, -1, 39, 1, NULL); if (R2_INVENTORY.getObjectScene(R2_STEPPING_DISKS) == 100) { _steppingDisks.postInit(); @@ -296,7 +297,7 @@ void Scene100::postInit(SceneObjectList *OwnerList) { _object5.postInit(); _object4.postInit(); _sceneMode = 104; - setAction(&_sequenceManager1, this, 104, &R2_GLOBALS._player, &_object6, &_object4, &_object5, NULL); + setAction(&_sequenceManager1, this, 104, &R2_GLOBALS._player, &_wardrobe, &_object4, &_object5, NULL); break; case 125: _sceneMode = 100; @@ -356,10 +357,10 @@ void Scene100::signal() { case 110: if (_door._state) { _door._state = 0; - _object10.setFrame(1); + _doorDisplay.setFrame(1); } else { _door._state = 1; - _object10.setFrame(2); + _doorDisplay.setFrame(2); } R2_GLOBALS._player.enableControl(); break; @@ -1198,6 +1199,98 @@ Common::String Scene125::parseMessage(const Common::String &msg) { return Common::String(msgP); } +/*-------------------------------------------------------------------------- + * Scene 150 - Empty Bedroom + * + *--------------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------------*/ + +void Scene150::postInit(SceneObjectList *OwnerList) { + SceneExt::postInit(); + loadScene(100); + + _door.postInit(); + _door._state = 0; + _door.setVisage(100); + _door.setPosition(Common::Point(160, 84)); + _door.setDetails(100, 3, -1, -1, 1, NULL); + + _doorDisplay.postInit(); + _doorDisplay.setup(100, 2, 1); + _doorDisplay.setPosition(Common::Point(202, 53)); + _doorDisplay.setDetails(100, -1, -1, -1, 1, NULL); + + _emptyRoomTable.postInit(); + _emptyRoomTable.setVisage(100); + _emptyRoomTable.setStrip(4); + _emptyRoomTable.setFrame(1); + _emptyRoomTable.setPosition(Common::Point(175, 157)); + _emptyRoomTable.setDetails(150, 3, 4, 5, 1, NULL); + + _wardrobe.postInit(); + _wardrobe.setVisage(101); + _wardrobe.setPosition(Common::Point(231, 126)); + _wardrobe.fixPriority(10); + _wardrobe.setDetails(100, 37, -1, 39, 1, NULL); + + _terminal.setDetails(11, 100, 14, 15, 16); + _desk.setDetails(12, 100, 11, -1, 13); + _bed.setDetails(13, 100, 8, 9, 10); + _duct.setDetails(14, 100, 34, -1, 36); + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.setVisage(10); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player.disableControl(); + + _background.setDetails(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 150, 0, 1, -1, 1, NULL); + _sceneMode = 100; + + switch (R2_GLOBALS._sceneManager._previousScene) { + case 100: + setAction(&_sequenceManager1, this, 106, &R2_GLOBALS._player, NULL); + break; + case 200: + setAction(&_sequenceManager1, this, 100, &R2_GLOBALS._player, &_door, NULL); + break; + default: + R2_GLOBALS._player.setStrip(3); + R2_GLOBALS._player.setPosition(Common::Point(180, 100)); + R2_GLOBALS._player.enableControl(); + break; + } +} + +void Scene150::remove() { + R2_GLOBALS._sound1.fadeOut2(NULL); + SceneExt::remove(); +} + +void Scene150::signal() { + switch (_sceneMode) { + case 101: + R2_GLOBALS._sceneManager.changeScene(200); + break; + case 105: + R2_GLOBALS._sceneManager.changeScene(125); + break; + case 110: + if (_door._state) { + _door._state = 0; + _doorDisplay.setFrame(1); + } else { + _door._state = 1; + _doorDisplay.setFrame(2); + } + R2_GLOBALS._player.enableControl(); + break; + default: + R2_GLOBALS._player.enableControl(); + break; + } +} + /*-------------------------------------------------------------------------- * Scene 200 - Ship Corridor * diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.h b/engines/tsage/ringworld2/ringworld2_scenes0.h index be07a4064b..5b3123b37f 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.h +++ b/engines/tsage/ringworld2/ringworld2_scenes0.h @@ -67,7 +67,7 @@ class Scene100: public SceneExt { public: bool startAction(CursorType action, Event &event); }; - class Object10: public SceneActorExt { + class DoorDisplay: public SceneActorExt { public: bool startAction(CursorType action, Event &event); }; @@ -85,12 +85,12 @@ class Scene100: public SceneExt { public: NamedHotspot _background, _duct, _bed, _desk; Terminal _terminal; - SceneActor _object1, _object2, _object3, _object4, _object5; - SceneActor _object6; + SceneActor _bedLights1, _bedLights2, _object3, _object4, _object5; + SceneActor _wardrobe; Door _door; Table _table; StasisNegator _stasisNegator; - Object10 _object10; + DoorDisplay _doorDisplay; SteppingDisks _steppingDisks; SequenceManager _sequenceManager1, _sequenceManager2; @@ -157,6 +157,15 @@ public: Common::String parseMessage(const Common::String &msg); }; +class Scene150: public Scene100 { +public: + SceneActor _emptyRoomTable; +public: + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void remove(); + virtual void signal(); +}; + class Scene200: public SceneExt { /* Objects */ class NorthDoor: public SceneActor { -- cgit v1.2.3 From efa52cb79c35a78e624f42e4ab919c6016bdadcf Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 13 Dec 2011 16:15:04 +0100 Subject: KYRA: Fix for bug #3459000 "KYRA1CD: Accented characters overdrawn in introduction". --- engines/kyra/seqplayer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/kyra/seqplayer.cpp b/engines/kyra/seqplayer.cpp index 531d864293..1bdcde5177 100644 --- a/engines/kyra/seqplayer.cpp +++ b/engines/kyra/seqplayer.cpp @@ -624,7 +624,7 @@ bool SeqPlayer::playSequence(const uint8 *seqData, bool skipSeq) { if (_vm->gameFlags().lang == Common::JA_JPN) charStr[1] = _vm->seqTextsTable()[_seqDisplayedText][++_seqDisplayedChar]; _screen->printText(charStr, _seqDisplayedTextX, 180, 0xF, 0xC); - _seqDisplayedTextX += _screen->getCharWidth(charStr[0]); + _seqDisplayedTextX += _screen->getCharWidth((uint8)charStr[0]); ++_seqDisplayedChar; if (_vm->seqTextsTable()[_seqDisplayedText][_seqDisplayedChar] == '\0') -- cgit v1.2.3 From 77959acd51982d9fedec94ac07241b1702681c6a Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 13 Dec 2011 16:17:06 +0100 Subject: KYRA: Cast char to uint8 before passing it to getCharWidth. This assures getCharWidth really gets the character number and now sign extended version of it in case char is signed. --- engines/kyra/sequences_hof.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines') diff --git a/engines/kyra/sequences_hof.cpp b/engines/kyra/sequences_hof.cpp index 50b5db78fc..b27f0df137 100644 --- a/engines/kyra/sequences_hof.cpp +++ b/engines/kyra/sequences_hof.cpp @@ -2622,7 +2622,7 @@ void KyraEngine_HoF::seq_displayScrollText(uint8 *data, const ScreenDim *d, int while (*str2) { cChar[0] = *str2; _screen->printText(cChar, x, y, col1++, 0); - x += _screen->getCharWidth(*str2++); + x += _screen->getCharWidth((uint8)*str2++); } palCycle = true; } else if (!strcmp(str, specialData[1])) { @@ -2631,7 +2631,7 @@ void KyraEngine_HoF::seq_displayScrollText(uint8 *data, const ScreenDim *d, int while (*str2) { cChar[0] = *str2; _screen->printText(cChar, x, y, col1--, 0); - x += _screen->getCharWidth(*str2++); + x += _screen->getCharWidth((uint8)*str2++); } palCycle = true; } else { -- cgit v1.2.3 From a6ec4f70da120a1ce406ed4dd9e149e081542f59 Mon Sep 17 00:00:00 2001 From: Andrea Corna Date: Tue, 13 Dec 2011 17:20:25 +0100 Subject: COMMON: Make more members of Archive constant. --- engines/agos/installshield_cab.cpp | 12 ++++++------ engines/kyra/resource_intern.cpp | 18 +++++++++--------- engines/kyra/resource_intern.h | 18 +++++++++--------- engines/lastexpress/data/archive.cpp | 6 +++--- engines/lastexpress/data/archive.h | 6 +++--- engines/lastexpress/resource.cpp | 10 +++++----- engines/lastexpress/resource.h | 6 +++--- engines/mohawk/installer_archive.cpp | 6 +++--- engines/mohawk/installer_archive.h | 6 +++--- engines/parallaction/disk_ns.cpp | 14 +++++++------- 10 files changed, 51 insertions(+), 51 deletions(-) (limited to 'engines') diff --git a/engines/agos/installshield_cab.cpp b/engines/agos/installshield_cab.cpp index ac4e40d1d1..d4e636f7b3 100644 --- a/engines/agos/installshield_cab.cpp +++ b/engines/agos/installshield_cab.cpp @@ -60,9 +60,9 @@ public: ~InstallShieldCabinet(); // Common::Archive API implementation - bool hasFile(const Common::String &name); - int listMembers(Common::ArchiveMemberList &list); - Common::ArchiveMemberPtr getMember(const Common::String &name); + bool hasFile(const Common::String &name) const; + int listMembers(Common::ArchiveMemberList &list) const; + const Common::ArchiveMemberPtr getMember(const Common::String &name) const; Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const; private: @@ -161,18 +161,18 @@ InstallShieldCabinet::InstallShieldCabinet(const Common::String &filename) : _in delete[] fileTableOffsets; } -bool InstallShieldCabinet::hasFile(const Common::String &name) { +bool InstallShieldCabinet::hasFile(const Common::String &name) const { return _map.contains(name); } -int InstallShieldCabinet::listMembers(Common::ArchiveMemberList &list) { +int InstallShieldCabinet::listMembers(Common::ArchiveMemberList &list) const { for (FileMap::const_iterator it = _map.begin(); it != _map.end(); it++) list.push_back(getMember(it->_key)); return _map.size(); } -Common::ArchiveMemberPtr InstallShieldCabinet::getMember(const Common::String &name) { +const Common::ArchiveMemberPtr InstallShieldCabinet::getMember(const Common::String &name) const { return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(name, this)); } diff --git a/engines/kyra/resource_intern.cpp b/engines/kyra/resource_intern.cpp index 482bd1a5d6..f9aae2c550 100644 --- a/engines/kyra/resource_intern.cpp +++ b/engines/kyra/resource_intern.cpp @@ -37,11 +37,11 @@ PlainArchive::PlainArchive(Common::ArchiveMemberPtr file) : _file(file), _files() { } -bool PlainArchive::hasFile(const Common::String &name) { +bool PlainArchive::hasFile(const Common::String &name) const { return (_files.find(name) != _files.end()); } -int PlainArchive::listMembers(Common::ArchiveMemberList &list) { +int PlainArchive::listMembers(Common::ArchiveMemberList &list) const { int count = 0; for (FileMap::const_iterator i = _files.begin(); i != _files.end(); ++i) { @@ -52,7 +52,7 @@ int PlainArchive::listMembers(Common::ArchiveMemberList &list) { return count; } -Common::ArchiveMemberPtr PlainArchive::getMember(const Common::String &name) { +const Common::ArchiveMemberPtr PlainArchive::getMember(const Common::String &name) const { if (!hasFile(name)) return Common::ArchiveMemberPtr(); @@ -92,11 +92,11 @@ TlkArchive::~TlkArchive() { delete[] _fileEntries; } -bool TlkArchive::hasFile(const Common::String &name) { +bool TlkArchive::hasFile(const Common::String &name) const { return (findFile(name) != 0); } -int TlkArchive::listMembers(Common::ArchiveMemberList &list) { +int TlkArchive::listMembers(Common::ArchiveMemberList &list) const { uint count = 0; for (; count < _entryCount; ++count) { @@ -107,7 +107,7 @@ int TlkArchive::listMembers(Common::ArchiveMemberList &list) { return count; } -Common::ArchiveMemberPtr TlkArchive::getMember(const Common::String &name) { +const Common::ArchiveMemberPtr TlkArchive::getMember(const Common::String &name) const { if (!hasFile(name)) return Common::ArchiveMemberPtr(); @@ -186,11 +186,11 @@ CachedArchive::~CachedArchive() { _files.clear(); } -bool CachedArchive::hasFile(const Common::String &name) { +bool CachedArchive::hasFile(const Common::String &name) const { return (_files.find(name) != _files.end()); } -int CachedArchive::listMembers(Common::ArchiveMemberList &list) { +int CachedArchive::listMembers(Common::ArchiveMemberList &list) const { int count = 0; for (FileMap::const_iterator i = _files.begin(); i != _files.end(); ++i) { @@ -201,7 +201,7 @@ int CachedArchive::listMembers(Common::ArchiveMemberList &list) { return count; } -Common::ArchiveMemberPtr CachedArchive::getMember(const Common::String &name) { +const Common::ArchiveMemberPtr CachedArchive::getMember(const Common::String &name) const { if (!hasFile(name)) return Common::ArchiveMemberPtr(); diff --git a/engines/kyra/resource_intern.h b/engines/kyra/resource_intern.h index 03c9d871e8..9d9574d823 100644 --- a/engines/kyra/resource_intern.h +++ b/engines/kyra/resource_intern.h @@ -49,9 +49,9 @@ public: Entry getFileEntry(const Common::String &name) const; // Common::Archive API implementation - bool hasFile(const Common::String &name); - int listMembers(Common::ArchiveMemberList &list); - Common::ArchiveMemberPtr getMember(const Common::String &name); + bool hasFile(const Common::String &name) const; + int listMembers(Common::ArchiveMemberList &list) const; + const Common::ArchiveMemberPtr getMember(const Common::String &name) const; Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const; private: typedef Common::HashMap FileMap; @@ -65,9 +65,9 @@ public: TlkArchive(Common::ArchiveMemberPtr file, uint16 entryCount, const uint32 *fileEntries); ~TlkArchive(); - bool hasFile(const Common::String &name); - int listMembers(Common::ArchiveMemberList &list); - Common::ArchiveMemberPtr getMember(const Common::String &name); + bool hasFile(const Common::String &name) const; + int listMembers(Common::ArchiveMemberList &list) const; + const Common::ArchiveMemberPtr getMember(const Common::String &name) const; Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const; private: Common::ArchiveMemberPtr _file; @@ -92,9 +92,9 @@ public: CachedArchive(const FileInputList &files); ~CachedArchive(); - bool hasFile(const Common::String &name); - int listMembers(Common::ArchiveMemberList &list); - Common::ArchiveMemberPtr getMember(const Common::String &name); + bool hasFile(const Common::String &name) const; + int listMembers(Common::ArchiveMemberList &list) const; + const Common::ArchiveMemberPtr getMember(const Common::String &name) const; Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const; private: struct Entry { diff --git a/engines/lastexpress/data/archive.cpp b/engines/lastexpress/data/archive.cpp index 3aa5584ca4..908d58254a 100644 --- a/engines/lastexpress/data/archive.cpp +++ b/engines/lastexpress/data/archive.cpp @@ -74,11 +74,11 @@ HPFArchive::HPFArchive(const Common::String &path) { delete archive; } -bool HPFArchive::hasFile(const Common::String &name) { +bool HPFArchive::hasFile(const Common::String &name) const { return (_files.find(name) != _files.end()); } -int HPFArchive::listMembers(Common::ArchiveMemberList &list) { +int HPFArchive::listMembers(Common::ArchiveMemberList &list) const { int numMembers = 0; for (FileMap::const_iterator i = _files.begin(); i != _files.end(); ++i) { @@ -89,7 +89,7 @@ int HPFArchive::listMembers(Common::ArchiveMemberList &list) { return numMembers; } -Common::ArchiveMemberPtr HPFArchive::getMember(const Common::String &name) { +const Common::ArchiveMemberPtr HPFArchive::getMember(const Common::String &name) const { if (!hasFile(name)) return Common::ArchiveMemberPtr(); diff --git a/engines/lastexpress/data/archive.h b/engines/lastexpress/data/archive.h index 8e0c46f183..011c830668 100644 --- a/engines/lastexpress/data/archive.h +++ b/engines/lastexpress/data/archive.h @@ -46,9 +46,9 @@ class HPFArchive : public Common::Archive { public: HPFArchive(const Common::String &path); - bool hasFile(const Common::String &name); - int listMembers(Common::ArchiveMemberList &list); - Common::ArchiveMemberPtr getMember(const Common::String &name); + bool hasFile(const Common::String &name) const; + int listMembers(Common::ArchiveMemberList &list) const; + const Common::ArchiveMemberPtr getMember(const Common::String &name) const; Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const; int count() { return _files.size(); } diff --git a/engines/lastexpress/resource.cpp b/engines/lastexpress/resource.cpp index 3910aaa010..ee4885e34e 100644 --- a/engines/lastexpress/resource.cpp +++ b/engines/lastexpress/resource.cpp @@ -148,8 +148,8 @@ Common::SeekableReadStream *ResourceManager::getFileStream(const Common::String ////////////////////////////////////////////////////////////////////////// // Archive functions ////////////////////////////////////////////////////////////////////////// -bool ResourceManager::hasFile(const Common::String &name) { - for (Common::Array::iterator it = _archives.begin(); it != _archives.end(); ++it) { +bool ResourceManager::hasFile(const Common::String &name) const { + for (Common::Array::const_iterator it = _archives.begin(); it != _archives.end(); ++it) { if ((*it)->hasFile(name)) return true; } @@ -157,10 +157,10 @@ bool ResourceManager::hasFile(const Common::String &name) { return false; } -int ResourceManager::listMembers(Common::ArchiveMemberList &list) { +int ResourceManager::listMembers(Common::ArchiveMemberList &list) const { int count = 0; - for (Common::Array::iterator it = _archives.begin(); it != _archives.end(); ++it) { + for (Common::Array::const_iterator it = _archives.begin(); it != _archives.end(); ++it) { Common::ArchiveMemberList members; count += (*it)->listMembers(members); @@ -171,7 +171,7 @@ int ResourceManager::listMembers(Common::ArchiveMemberList &list) { return count; } -Common::ArchiveMemberPtr ResourceManager::getMember(const Common::String &name) { +const Common::ArchiveMemberPtr ResourceManager::getMember(const Common::String &name) const { if (!hasFile(name)) return Common::ArchiveMemberPtr(); diff --git a/engines/lastexpress/resource.h b/engines/lastexpress/resource.h index 9e05a90399..f2f5d63bce 100644 --- a/engines/lastexpress/resource.h +++ b/engines/lastexpress/resource.h @@ -45,9 +45,9 @@ public: Common::SeekableReadStream *getFileStream(const Common::String &name); // Archive functions - bool hasFile(const Common::String &name); - int listMembers(Common::ArchiveMemberList &list); - Common::ArchiveMemberPtr getMember(const Common::String &name); + bool hasFile(const Common::String &name) const; + int listMembers(Common::ArchiveMemberList &list) const; + const Common::ArchiveMemberPtr getMember(const Common::String &name) const; Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const; // Resource loading diff --git a/engines/mohawk/installer_archive.cpp b/engines/mohawk/installer_archive.cpp index 83796158a6..636b7ae476 100644 --- a/engines/mohawk/installer_archive.cpp +++ b/engines/mohawk/installer_archive.cpp @@ -107,18 +107,18 @@ void InstallerArchive::close() { _map.clear(); } -bool InstallerArchive::hasFile(const Common::String &name) { +bool InstallerArchive::hasFile(const Common::String &name) const { return _map.contains(name); } -int InstallerArchive::listMembers(Common::ArchiveMemberList &list) { +int InstallerArchive::listMembers(Common::ArchiveMemberList &list) const { for (FileMap::const_iterator it = _map.begin(); it != _map.end(); it++) list.push_back(getMember(it->_key)); return _map.size(); } -Common::ArchiveMemberPtr InstallerArchive::getMember(const Common::String &name) { +const Common::ArchiveMemberPtr InstallerArchive::getMember(const Common::String &name) const { return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(name, this)); } diff --git a/engines/mohawk/installer_archive.h b/engines/mohawk/installer_archive.h index 27877d69f9..89d2d85f8d 100644 --- a/engines/mohawk/installer_archive.h +++ b/engines/mohawk/installer_archive.h @@ -43,9 +43,9 @@ public: bool isOpen() const { return _stream != 0; } // Common::Archive API implementation - bool hasFile(const Common::String &name); - int listMembers(Common::ArchiveMemberList &list); - Common::ArchiveMemberPtr getMember(const Common::String &name); + bool hasFile(const Common::String &name) const; + int listMembers(Common::ArchiveMemberList &list) const; + const Common::ArchiveMemberPtr getMember(const Common::String &name) const; Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const; private: diff --git a/engines/parallaction/disk_ns.cpp b/engines/parallaction/disk_ns.cpp index 05ea60f510..e145743f09 100644 --- a/engines/parallaction/disk_ns.cpp +++ b/engines/parallaction/disk_ns.cpp @@ -73,9 +73,9 @@ public: ~NSArchive(); Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const; - bool hasFile(const Common::String &name); - int listMembers(Common::ArchiveMemberList &list); - Common::ArchiveMemberPtr getMember(const Common::String &name); + bool hasFile(const Common::String &name) const; + int listMembers(Common::ArchiveMemberList &list) const; + const Common::ArchiveMemberPtr getMember(const Common::String &name) const; }; @@ -137,23 +137,23 @@ Common::SeekableReadStream *NSArchive::createReadStreamForMember(const Common::S return new Common::SeekableSubReadStream(_stream, offset, endOffset, DisposeAfterUse::NO); } -bool NSArchive::hasFile(const Common::String &name) { +bool NSArchive::hasFile(const Common::String &name) const { if (name.empty()) return false; return lookup(name.c_str()) != _numFiles; } -int NSArchive::listMembers(Common::ArchiveMemberList &list) { +int NSArchive::listMembers(Common::ArchiveMemberList &list) const { for (uint32 i = 0; i < _numFiles; i++) { list.push_back(Common::SharedPtr(new Common::GenericArchiveMember(_archiveDir[i], this))); } return _numFiles; } -Common::ArchiveMemberPtr NSArchive::getMember(const Common::String &name) { +const Common::ArchiveMemberPtr NSArchive::getMember(const Common::String &name) const { uint32 index = lookup(name.c_str()); - char *item = 0; + const char *item = 0; if (index < _numFiles) { item = _archiveDir[index]; } -- cgit v1.2.3 From f9419db947a8d1cb42ee389b377c7ec6030ad9dd Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 13 Dec 2011 22:39:34 +0200 Subject: DREAMWEB: Port 'bartender' and 'receptionist' to C++ --- engines/dreamweb/dreamgen.cpp | 81 ------------------------------------------- engines/dreamweb/dreamgen.h | 2 -- engines/dreamweb/people.cpp | 66 ++++++++++++++++++++++++++++++++--- engines/dreamweb/stubs.h | 2 ++ 4 files changed, 64 insertions(+), 87 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 63942575bf..83b86f9d51 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -26,87 +26,6 @@ namespace DreamGen { -void DreamGenContext::receptionist() { - STACK_CHECK; - checkSpeed(); - if (!flags.z()) - goto gotrecep; - _cmp(data.byte(kCardpassflag), 1); - if (!flags.z()) - goto notsetcard; - _inc(data.byte(kCardpassflag)); - es.byte(bx+7) = 1; - es.word(bx+3) = 64; -notsetcard: - _cmp(es.word(bx+3), 58); - if (!flags.z()) - goto notdes1; - randomNumber(); - _cmp(al, 30); - if (flags.c()) - goto notdes2; - es.word(bx+3) = 55; - goto gotrecep; -notdes1: - _cmp(es.word(bx+3), 60); - if (!flags.z()) - goto notdes2; - randomNumber(); - _cmp(al, 240); - if (flags.c()) - goto gotrecep; - es.word(bx+3) = 53; - goto gotrecep; -notdes2: - _cmp(es.word(bx+3), 88); - if (!flags.z()) - goto notendcard; - es.word(bx+3) = 53; - goto gotrecep; -notendcard: - _inc(es.word(bx+3)); -gotrecep: - showGameReel(); - addToPeopleList(); - al = es.byte(bx+7); - _and(al, 128); - if (flags.z()) - return /* (nottalkedrecep) */; - data.byte(kTalkedtorecep) = 1; -} - -void DreamGenContext::bartender() { - STACK_CHECK; - checkSpeed(); - if (!flags.z()) - goto gotsmoket; - _cmp(es.word(bx+3), 86); - if (!flags.z()) - goto notsmoket1; - randomNumber(); - _cmp(al, 18); - if (flags.c()) - goto notsmoket2; - es.word(bx+3) = 81; - goto gotsmoket; -notsmoket1: - _cmp(es.word(bx+3), 103); - if (!flags.z()) - goto notsmoket2; - es.word(bx+3) = 81; - goto gotsmoket; -notsmoket2: - _inc(es.word(bx+3)); -gotsmoket: - showGameReel(); - _cmp(data.byte(kGunpassflag), 1); - if (!flags.z()) - goto notgotgun; - es.byte(bx+7) = 9; -notgotgun: - addToPeopleList(); -} - void DreamGenContext::helicopter() { STACK_CHECK; ax = es.word(bx+3); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index b7fb2495c5..a8e8a610fd 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -499,7 +499,6 @@ public: void adjustUp(); void fadeScreenDownHalf(); void fadeDownMon(); - void bartender(); void outOfOpen(); void dirCom(); void endGameSeq(); @@ -523,7 +522,6 @@ public: void findInvPos(); void getKeyAndLogo(); void selectOb(); - void receptionist(); void fadeUpMon(); void showDiaryPage(); void reExFromInv(); diff --git a/engines/dreamweb/people.cpp b/engines/dreamweb/people.cpp index 84f6543a19..caaea26d0d 100644 --- a/engines/dreamweb/people.cpp +++ b/engines/dreamweb/people.cpp @@ -29,13 +29,13 @@ static void (DreamGenContext::*reelCallbacks[57])() = { NULL, NULL, NULL, NULL, NULL, NULL, - &DreamGenContext::receptionist, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &DreamGenContext::heavy, NULL, NULL, NULL, - &DreamGenContext::bartender, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, @@ -61,13 +61,13 @@ static void (DreamGenContext::*reelCallbacksCPP[57])(ReelRoutine &) = { &DreamGenContext::eden, &DreamGenContext::edenInBath, &DreamGenContext::sparky, &DreamGenContext::smokeBloke, &DreamGenContext::manAsleep, &DreamGenContext::drunk, - /*&DreamGenContext::receptionist*/NULL, &DreamGenContext::genericPerson /*maleFan*/, + &DreamGenContext::receptionist, &DreamGenContext::genericPerson /*maleFan*/, &DreamGenContext::genericPerson /*femaleFan*/, &DreamGenContext::louis, &DreamGenContext::louisChair, &DreamGenContext::soldier1, &DreamGenContext::bossMan, &DreamGenContext::interviewer, /*&DreamGenContext::heavy*/NULL, &DreamGenContext::manAsleep /*manAsleep2*/, &DreamGenContext::genericPerson /*manSatStill*/, &DreamGenContext::drinker, - /*&DreamGenContext::bartender*/NULL, &DreamGenContext::genericPerson /*otherSmoker*/, + &DreamGenContext::bartender, &DreamGenContext::genericPerson /*otherSmoker*/, &DreamGenContext::genericPerson /*tattooMan*/, &DreamGenContext::attendant, &DreamGenContext::keeper, &DreamGenContext::candles1, &DreamGenContext::smallCandle, &DreamGenContext::security, @@ -777,4 +777,62 @@ void DreamGenContext::soldier1(ReelRoutine &routine) { addToPeopleList(&routine); } +void DreamGenContext::receptionist(ReelRoutine &routine) { + if (checkSpeed(routine)) { + if (data.byte(kCardpassflag) == 1) { + // Set card + data.byte(kCardpassflag)++; + routine.b7 = 1; + routine.b3 = 64; + } + + if (routine.b3 != 58) { + // notdes1 + if (routine.b3 != 60) { + // notdes2 + if (routine.b3 != 88) + routine.b3++; // not end card + else + routine.b3 = 53; + } else if (engine->randomNumber() >= 240) { + routine.b3 = 53; + } + } else if (engine->randomNumber() >= 30) { + routine.b3 = 55; + } else { + // notdes2 + if (routine.b3 != 88) + routine.b3++; // not end card + else + routine.b3 = 53; + } + } + + showGameReel(&routine); + addToPeopleList(&routine); + if (routine.b7 & 128) + data.byte(kTalkedtorecep) = 1; +} + +void DreamGenContext::bartender(ReelRoutine &routine) { + if (checkSpeed(routine)) { + if (routine.b3 == 86) { + if (engine->randomNumber() >= 18) + routine.b3 = 81; + else + routine.b3++; // notsmoket2 + } else if (routine.b3 == 103) { + routine.b3 = 81; // notsmoket1 + } else { + routine.b3++; // notsmoket2 + } + } + + showGameReel(&routine); + if (data.byte(kGunpassflag) == 1) + routine.b7 = 9; // got gun + + addToPeopleList(&routine); +} + } // End of namespace DreamGen diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 6a8445b991..5256111cc1 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -417,6 +417,8 @@ void introMonks1(ReelRoutine &routine); void introMonks2(ReelRoutine &routine); void soldier1(ReelRoutine &routine); + void receptionist(ReelRoutine &routine); + void bartender(ReelRoutine &routine); void singleKey(uint8 key, uint16 x, uint16 y); void loadSaveBox(); void loadKeypad(); -- cgit v1.2.3 From 9042f85ef3da49893f0c595476abf4602c794fdf Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 13 Dec 2011 23:04:26 +0200 Subject: DREAMWEB: Fix regression in bartender() and receptionist() --- engines/dreamweb/people.cpp | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/people.cpp b/engines/dreamweb/people.cpp index caaea26d0d..99e382f325 100644 --- a/engines/dreamweb/people.cpp +++ b/engines/dreamweb/people.cpp @@ -783,28 +783,28 @@ void DreamGenContext::receptionist(ReelRoutine &routine) { // Set card data.byte(kCardpassflag)++; routine.b7 = 1; - routine.b3 = 64; + routine.setReelPointer(64); } - if (routine.b3 != 58) { + if (routine.reelPointer() != 58) { // notdes1 - if (routine.b3 != 60) { + if (routine.reelPointer() != 60) { // notdes2 - if (routine.b3 != 88) - routine.b3++; // not end card + if (routine.reelPointer() != 88) + routine.incReelPointer(); // not end card else - routine.b3 = 53; + routine.setReelPointer(53); } else if (engine->randomNumber() >= 240) { - routine.b3 = 53; + routine.setReelPointer(53); } } else if (engine->randomNumber() >= 30) { - routine.b3 = 55; + routine.setReelPointer(55); } else { // notdes2 - if (routine.b3 != 88) - routine.b3++; // not end card + if (routine.reelPointer() != 88) + routine.incReelPointer(); // not end card else - routine.b3 = 53; + routine.setReelPointer(53); } } @@ -816,15 +816,15 @@ void DreamGenContext::receptionist(ReelRoutine &routine) { void DreamGenContext::bartender(ReelRoutine &routine) { if (checkSpeed(routine)) { - if (routine.b3 == 86) { + if (routine.reelPointer() == 86) { if (engine->randomNumber() >= 18) - routine.b3 = 81; + routine.setReelPointer(81); else - routine.b3++; // notsmoket2 - } else if (routine.b3 == 103) { - routine.b3 = 81; // notsmoket1 + routine.incReelPointer(); // notsmoket2 + } else if (routine.reelPointer() == 103) { + routine.setReelPointer(81); // notsmoket1 } else { - routine.b3++; // notsmoket2 + routine.incReelPointer(); // notsmoket2 } } -- cgit v1.2.3 From c98803817418c39ca94994e7946419645ab729dd Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 14 Dec 2011 00:47:29 +0200 Subject: DREAMWEB: Port 'showdiarypage' to C++ --- engines/dreamweb/dreamgen.cpp | 33 --------------------------------- engines/dreamweb/dreamgen.h | 1 - engines/dreamweb/stubs.cpp | 17 +++++++++++++++++ engines/dreamweb/stubs.h | 1 + 4 files changed, 18 insertions(+), 34 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 83b86f9d51..725e682a14 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -4260,39 +4260,6 @@ notdumpdiary: multiDump(); } -void DreamGenContext::showDiaryPage() { - STACK_CHECK; - al = 0; - ah = 0; - di = (68+24); - bx = (48+12); - ds = data.word(kTempgraphics); - showFrame(); - al = data.byte(kDiarypage); - findText1(); - data.byte(kKerning) = 1; - useTempCharset(); - di = (68+24)+48; - bx = (48+12)+16; - dl = 240; - ah = 16; - data.word(kCharshift) = 91+91; - printDirect(); - di = (68+24)+129; - bx = (48+12)+16; - dl = 240; - ah = 16; - printDirect(); - di = (68+24)+48; - bx = (48+12)+23; - dl = 240; - ah = 16; - printDirect(); - data.byte(kKerning) = 0; - data.word(kCharshift) = 0; - useCharset1(); -} - void DreamGenContext::findText1() { STACK_CHECK; ah = 0; diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index a8e8a610fd..f5c333be36 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -523,7 +523,6 @@ public: void getKeyAndLogo(); void selectOb(); void fadeUpMon(); - void showDiaryPage(); void reExFromInv(); void businessMan(); void outOfInv(); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index a7d65845e1..4fc46ad3aa 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -4582,4 +4582,21 @@ void DreamGenContext::updateSymbolBot() { } } +void DreamGenContext::showDiaryPage() { + showFrame(tempGraphics(), kDiaryx, kDiaryy, 0, 0); + data.byte(kKerning) = 1; + useTempCharset(); + data.word(kCharshift) = 91+91; + uint16 offset = kTextstart + getSegment(data.word(kTextfile1)).word(data.byte(kDiarypage) * 2); + const uint8 *string = getSegment(data.word(kTextfile1)).ptr(offset, 0); + uint16 y = kDiaryy + 16; + printDirect(&string, kDiaryx + 48, &y, 240, 240 & 1); + printDirect(&string, kDiaryx + 129, &y, 240, 240 & 1); + y = kDiaryy + 23; + printDirect(&string, kDiaryx + 48, &y, 240, 240 & 1); + data.byte(kKerning) = 0; + data.word(kCharshift) = 0; + useCharset1(); +} + } // End of namespace DreamGen diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 5256111cc1..da01c9b26c 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -581,5 +581,6 @@ void processTrigger(); void updateSymbolTop(); void updateSymbolBot(); + void showDiaryPage(); #endif -- cgit v1.2.3 From c95bdeb20ca16927fbac990c9633cb0db9e1fc3e Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 14 Dec 2011 01:03:57 +0200 Subject: DREAMWEB: Port 'dumpdiarykeys' to C++ and remove the now unused 'findtext1' --- engines/dreamweb/dreamgen.cpp | 69 ------------------------------------------- engines/dreamweb/dreamgen.h | 2 -- engines/dreamweb/stubs.cpp | 28 ++++++++++++++++++ engines/dreamweb/stubs.h | 1 + 4 files changed, 29 insertions(+), 71 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 725e682a14..e2b5530b2e 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -4202,75 +4202,6 @@ gotkeyp: showDiaryPage(); } -void DreamGenContext::dumpDiaryKeys() { - STACK_CHECK; - _cmp(data.byte(kPresscount), 1); - if (!flags.z()) - goto notdumpdiary; - _cmp(data.byte(kSartaindead), 1); - if (flags.z()) - goto notsartadd; - _cmp(data.byte(kDiarypage), 5); - if (!flags.z()) - goto notsartadd; - _cmp(data.byte(kDiarypage), 5); - if (!flags.z()) - goto notsartadd; - al = 6; - getLocation(); - _cmp(al, 1); - if (flags.z()) - goto notsartadd; - al = 6; - setLocation(); - delPointer(); - al = 12; - findText1(); - di = 70; - bx = 106; - dl = 241; - ah = 16; - printDirect(); - workToScreenM(); - cx = 200; - hangOnP(); - createPanel(); - showIcon(); - showDiary(); - showDiaryPage(); - workToScreenM(); - showPointer(); - return; -notsartadd: - di = (68+24)+48; - bx = (48+12)+15; - cl = 200; - ch = 16; - multiDump(); -notdumpdiary: - di = (68+24)+94; - bx = (48+12)+97; - cl = 16; - ch = 16; - multiDump(); - di = (68+24)+151; - bx = (48+12)+71; - cl = 16; - ch = 16; - multiDump(); -} - -void DreamGenContext::findText1() { - STACK_CHECK; - ah = 0; - si = ax; - _add(si, si); - es = data.word(kTextfile1); - ax = es.word(si); - _add(ax, (66*2)); - si = ax; -} - void DreamGenContext::showSlots() { STACK_CHECK; di = (60)+7; diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index f5c333be36..48b40feb37 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -488,7 +488,6 @@ public: void clearBuffers(); void getObTextStart(); void checkObjectSize(); - void findText1(); void isRyanHolding(); void showSlots(); void useCashCard(); @@ -507,7 +506,6 @@ public: void startTalk(); void getAnyAd(); void reminders(); - void dumpDiaryKeys(); void checkForExit(); void lookInInterface(); void inToInv(); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 4fc46ad3aa..e753efd72a 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -4599,4 +4599,32 @@ void DreamGenContext::showDiaryPage() { useCharset1(); } +void DreamGenContext::dumpDiaryKeys() { + if (data.byte(kPresscount) == 1) { + if (data.byte(kSartaindead) != 1 && data.byte(kDiarypage) == 5 && DreamBase::getLocation(6) != 1) { + // Add Sartain Industries note + DreamBase::setLocation(6); + delPointer(); + uint16 offset = kTextstart + getSegment(data.word(kTextfile1)).word(12 * 2); + const uint8 *string = getSegment(data.word(kTextfile1)).ptr(offset, 0); + uint16 y = 106; + printDirect(&string, 70, &y, 241, 241 & 1); + workToScreenM(); + hangOnP(200); + createPanel(); + showIcon(); + showDiary(); + showDiaryPage(); + workToScreenM(); + showPointer(); + return; + } else { + multiDump(kDiaryx + 48, kDiaryy + 15, 200, 16); + } + } + + multiDump(kDiaryx + 94, kDiaryy + 97, 16, 16); + multiDump(kDiaryx + 151, kDiaryy + 71, 16, 16); +} + } // End of namespace DreamGen diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index da01c9b26c..50a8faaf34 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -582,5 +582,6 @@ void updateSymbolTop(); void updateSymbolBot(); void showDiaryPage(); + void dumpDiaryKeys(); #endif -- cgit v1.2.3 From d4124e116ac8a9aaf52dcfe727cd600e27555154 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 14 Dec 2011 01:52:13 +0200 Subject: DREAMWEB: Port 'heavy' to C++ --- engines/dreamweb/dreamgen.cpp | 42 ------------------------------------------ engines/dreamweb/dreamgen.h | 1 - engines/dreamweb/people.cpp | 28 ++++++++++++++++++++++++++-- engines/dreamweb/stubs.h | 1 + 4 files changed, 27 insertions(+), 45 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index e2b5530b2e..1593ae78d3 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -360,48 +360,6 @@ combatover2: data.byte(kMandead) = 2; } -void DreamGenContext::heavy() { - STACK_CHECK; - al = es.byte(bx+7); - _and(al, 127); - es.byte(bx+7) = al; - _cmp(es.word(bx+3), 43); - if (flags.z()) - goto heavywait; - data.word(kWatchingtime) = 10; - _cmp(es.word(bx+3), 70); - if (!flags.z()) - goto notafterhshot; - _inc(data.byte(kCombatcount)); - _cmp(data.byte(kCombatcount), 80); - if (!flags.z()) - goto gotheavyframe; - data.byte(kMandead) = 2; - goto gotheavyframe; -notafterhshot: - checkSpeed(); - if (!flags.z()) - goto gotheavyframe; - _inc(es.word(bx+3)); - goto gotheavyframe; -heavywait: - _cmp(data.byte(kLastweapon), 1); - if (!flags.z()) - goto gotheavyframe; - _cmp(data.byte(kManspath), 5); - if (!flags.z()) - goto gotheavyframe; - _cmp(data.byte(kFacing), 4); - if (!flags.z()) - goto gotheavyframe; - data.byte(kLastweapon) = -1; - _inc(es.word(bx+3)); - data.byte(kCombatcount) = 0; -gotheavyframe: - showGameReel(); - addToPeopleList(); -} - void DreamGenContext::endGameSeq() { STACK_CHECK; checkSpeed(); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 48b40feb37..bde91490af 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -513,7 +513,6 @@ public: void deleteExText(); void getFreeAd(); void removeObFromInv(); - void heavy(); void dirFile(); void pickupConts(); void nextColon(); diff --git a/engines/dreamweb/people.cpp b/engines/dreamweb/people.cpp index 99e382f325..99a83f44d3 100644 --- a/engines/dreamweb/people.cpp +++ b/engines/dreamweb/people.cpp @@ -33,7 +33,7 @@ static void (DreamGenContext::*reelCallbacks[57])() = { NULL, NULL, NULL, NULL, NULL, NULL, - &DreamGenContext::heavy, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, @@ -65,7 +65,7 @@ static void (DreamGenContext::*reelCallbacksCPP[57])(ReelRoutine &) = { &DreamGenContext::genericPerson /*femaleFan*/, &DreamGenContext::louis, &DreamGenContext::louisChair, &DreamGenContext::soldier1, &DreamGenContext::bossMan, &DreamGenContext::interviewer, - /*&DreamGenContext::heavy*/NULL, &DreamGenContext::manAsleep /*manAsleep2*/, + &DreamGenContext::heavy, &DreamGenContext::manAsleep /*manAsleep2*/, &DreamGenContext::genericPerson /*manSatStill*/, &DreamGenContext::drinker, &DreamGenContext::bartender, &DreamGenContext::genericPerson /*otherSmoker*/, &DreamGenContext::genericPerson /*tattooMan*/, &DreamGenContext::attendant, @@ -835,4 +835,28 @@ void DreamGenContext::bartender(ReelRoutine &routine) { addToPeopleList(&routine); } +void DreamGenContext::heavy(ReelRoutine &routine) { + routine.b7 &= 127; + if (routine.reelPointer() != 43) { + data.word(kWatchingtime) = 10; + if (routine.reelPointer() == 70) { + // After shot + data.byte(kCombatcount)++; + if (data.byte(kCombatcount) == 80) + data.byte(kMandead) = 2; + } else { + if (checkSpeed(routine)) + routine.incReelPointer(); + } + } else if (data.byte(kLastweapon) == 1 && data.byte(kManspath) == 5 && data.byte(kFacing) == 4) { + // Heavy wait + data.byte(kLastweapon) = (byte)-1; + routine.incReelPointer(); + data.byte(kCombatcount) = 0; + } + + showGameReel(&routine); + addToPeopleList(&routine); +} + } // End of namespace DreamGen diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 50a8faaf34..f7d8086a64 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -419,6 +419,7 @@ void soldier1(ReelRoutine &routine); void receptionist(ReelRoutine &routine); void bartender(ReelRoutine &routine); + void heavy(ReelRoutine &routine); void singleKey(uint8 key, uint16 x, uint16 y); void loadSaveBox(); void loadKeypad(); -- cgit v1.2.3 From a97a359ea3825f6fdef40a57e3c3b6e96b4afda3 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 14 Dec 2011 00:58:10 +0100 Subject: TSAGE: R2R - Implement scene 2535 --- engines/tsage/ringworld2/ringworld2_logic.cpp | 2 + engines/tsage/ringworld2/ringworld2_scenes2.cpp | 183 ++++++++++++++++++++++++ engines/tsage/ringworld2/ringworld2_scenes2.h | 34 +++++ 3 files changed, 219 insertions(+) (limited to 'engines') diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index f86bab3a87..e2e0c71a03 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -134,6 +134,8 @@ Scene *Ringworld2Game::createScene(int sceneNumber) { // Maze: Well return new Scene2530(); case 2535: + // Maze: Tannery + return new Scene2535(); case 2600: case 2700: case 2750: diff --git a/engines/tsage/ringworld2/ringworld2_scenes2.cpp b/engines/tsage/ringworld2/ringworld2_scenes2.cpp index cbb6dbc42e..4b4f9b8375 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes2.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes2.cpp @@ -2800,5 +2800,188 @@ void Scene2530::signal() { } } +/*-------------------------------------------------------------------------- + * Scene 2535 - Maze: Tannery + * + *--------------------------------------------------------------------------*/ + +bool Scene2535::Actor3::startAction(CursorType action, Event &event) { + Scene2535 *scene = (Scene2535 *)R2_GLOBALS._sceneManager._scene; + + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + + if (R2_GLOBALS._player._characterIndex == 1) { + R2_GLOBALS._player.disableControl(); + if (R2_INVENTORY.getObjectScene(20) == 2535) { + scene->_sceneMode = 2536; + scene->setAction(&scene->_sequenceManager, scene, 2536, &R2_GLOBALS._player, &scene->_actor3, NULL); + } else { + scene->_sceneMode = 2537; + scene->setAction(&scene->_sequenceManager, scene, 2537, &R2_GLOBALS._player, &scene->_actor3, NULL); + } + } else { + SceneItem::display(2530, 33, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + } + + return true; +} + +bool Scene2535::Actor4::startAction(CursorType action, Event &event) { + Scene2535 *scene = (Scene2535 *)R2_GLOBALS._sceneManager._scene; + + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + + if (R2_GLOBALS._player._characterIndex == 2) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 2535; + scene->setAction(&scene->_sequenceManager, scene, 2535, &R2_GLOBALS._player, &scene->_actor4, NULL); + } else { + SceneItem::display(2530, 33, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + } + + return true; +} + +void Scene2535::Exit1::changeScene() { + Scene2535 *scene = (Scene2535 *)R2_GLOBALS._sceneManager._scene; + _enabled = false; + R2_GLOBALS._events.setCursor(CURSOR_ARROW); + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 11; + Common::Point pt(210, 200); + PlayerMover *mover = new PlayerMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); +} + +void Scene2535::postInit(SceneObjectList *OwnerList) { + loadScene(2535); + SceneExt::postInit(); + if (R2_GLOBALS._sceneManager._previousScene == -1) { + R2_GLOBALS.setFlag(73); + R2_INVENTORY.setObjectScene(20, 2535); + } + _exit1.setDetails(Rect(172, 155, 250, 167), EXITCURSOR_S, 2000); + _exit1.setDest(Common::Point(210, 160)); + + if (R2_INVENTORY.getObjectScene(32) == 2535) { + _actor4.postInit(); + _actor4.setup(2435, 1, 4); + _actor4.setPosition(Common::Point(47, 74)); + _actor4.fixPriority(74); + _actor4.setDetails(2535, 21, -1, -1, 1, NULL); + } + + if (R2_INVENTORY.getObjectScene(20) == 2535) { + _actor3.postInit(); + _actor3.setup(2535, 3, 1); + _actor3.setPosition(Common::Point(203, 131)); + _actor3.setDetails(3, 20, -1, -1, 1, NULL); + R2_GLOBALS._walkRegions.enableRegion(6); + } + + if ((R2_INVENTORY.getObjectScene(20) == 0) && (R2_GLOBALS.getFlag(73))) { + _actor3.postInit(); + _actor3.setup(2536, 1, 2); + _actor3.setPosition(Common::Point(164, 133)); + _actor3.setDetails(3, 20, -1, -1, 1, NULL); + } + + if (R2_GLOBALS.getFlag(73)) { + _actor2.postInit(); + _actor2.setup(2536, 1, 1); + _actor2.setPosition(Common::Point(160, 130)); + _actor2.fixPriority(122); + _actor2.setDetails(2535, 37, -1, -1, 1, NULL); + } + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + if (R2_GLOBALS._player._characterIndex == 1) { + R2_GLOBALS._player.setVisage(2008); + R2_GLOBALS._player._moveDiff = Common::Point(3, 2); + } else { + R2_GLOBALS._player.setVisage(20); + R2_GLOBALS._player._moveDiff = Common::Point(5, 3); + } + R2_GLOBALS._player.setPosition(Common::Point(210, 200)); + + if (R2_GLOBALS._player._characterScene[1] == R2_GLOBALS._player._characterScene[2]) { + _actor1.postInit(); + if (R2_GLOBALS._player._characterIndex == 1) { + _actor1.setup(20, 5, 1); + _actor1.setDetails(9002, 0, 4, 3, 1, NULL); + } else { + _actor1.setup(2008, 5, 1); + _actor1.setDetails(9001, 0, 5, 3, 1, NULL); + } + _actor1.setPosition(Common::Point(245, 115)); + R2_GLOBALS._walkRegions.enableRegion(2); + } + + _item2.setDetails(Rect(96, 3, 215, 33), 2535, 3, 6, 5, 1, NULL); + _item3.setDetails(Rect(4, 43, 40, 101), 2535, 6, 7, 8, 1, NULL); + _item4.setDetails(Rect(55, 13, 140, 89), 2535, 6, 7, 8, 1, NULL); + _item5.setDetails(Rect(144, 23, 216, 76), 2535, 6, 7, 8, 1, NULL); + _item6.setDetails(Rect(227, 8, 307, 99), 2535, 6, 7, 8, 1, NULL); + _item7.setDetails(Rect(116, 111, 201, 132), 2535, 18, 19, 20, 1, NULL); + _item1.setDetails(Rect(0, 0, 320, 200), 2535, 0, 1, -1, 1, NULL); + R2_GLOBALS._player.disableControl(); + + if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 2000) { + R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] = 2535; + Common::Point pt(210, 150); + PlayerMover *mover = new PlayerMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } else { + R2_GLOBALS._player.setPosition(Common::Point(210, 150)); + R2_GLOBALS._player.setStrip(3); + R2_GLOBALS._player.enableControl(); + } +} + +void Scene2535::signal() { + switch (_sceneMode) { + case 11: + g_globals->_sceneManager.changeScene(2000); + break; + case 2535: + R2_INVENTORY.setObjectScene(32, 2); + _actor4.remove(); + R2_GLOBALS._player.enableControl(); + break; + case 2536: + R2_INVENTORY.setObjectScene(20, 0); + R2_GLOBALS._walkRegions.disableRegion(6); + if (!R2_GLOBALS.getFlag(73)) { + _actor3.remove(); + R2_GLOBALS._player.enableControl(); + } else { + _sceneMode = 20; + _actor3.show(); + _actor3.setup(2536, 1, 2); + _actor3.setDetails(3, 20, -1, -1, 3, NULL); + _actor3.setPosition(Common::Point(164, 150)); + _actor3.fixPriority(130); + _actor3._moveDiff.y = 1; + Common::Point pt(164, 133); + PlayerMover *mover = new PlayerMover(); + _actor3.addMover(mover, &pt, this); + } + break; + case 2537: + _actor3.remove(); + R2_INVENTORY.setObjectScene(20, 1); + R2_GLOBALS._player.enableControl(); + break; + case 20: + // No break on purpose + default: + R2_GLOBALS._player.enableControl(); + break; + } +} + } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_scenes2.h b/engines/tsage/ringworld2/ringworld2_scenes2.h index bef1fc9ea8..e655d1e8a8 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes2.h +++ b/engines/tsage/ringworld2/ringworld2_scenes2.h @@ -444,6 +444,40 @@ public: virtual void postInit(SceneObjectList *OwnerList = NULL); virtual void signal(); }; + +class Scene2535 : public SceneExt { + class Actor3 : public SceneActor { + public: + bool startAction(CursorType action, Event &event); + }; + class Actor4 : public SceneActor { + public: + bool startAction(CursorType action, Event &event); + }; + + class Exit1 : public SceneExit { + public: + virtual void changeScene(); + }; +public: + NamedHotspot _item1; + NamedHotspot _item2; + NamedHotspot _item3; + NamedHotspot _item4; + NamedHotspot _item5; + NamedHotspot _item6; + NamedHotspot _item7; + SceneActor _actor1; + SceneActor _actor2; + Actor3 _actor3; + Actor4 _actor4; + Exit1 _exit1; + SequenceManager _sequenceManager; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); +}; + } // End of namespace Ringworld2 } // End of namespace TsAGE -- cgit v1.2.3 From a22266d8713eaa2400c99bc8e751e9babcf468ab Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 14 Dec 2011 02:03:57 +0200 Subject: DREAMWEB: Port 'runendseq' to C++ and remove the unused 'drawitall' function --- engines/dreamweb/dreamgen.cpp | 30 ------------------------------ engines/dreamweb/dreamgen.h | 4 +--- engines/dreamweb/stubs.cpp | 20 ++++++++++++++++++++ engines/dreamweb/stubs.h | 1 + 4 files changed, 22 insertions(+), 33 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 1593ae78d3..d3e3ace249 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -864,28 +864,6 @@ void DreamGenContext::initialMonCols() { showGroup(); } -void DreamGenContext::runEndSeq() { - STACK_CHECK; - atmospheres(); - data.byte(kGetback) = 0; -moreendseq: - vSync(); - spriteUpdate(); - vSync(); - delEverything(); - printSprites(); - reelsOnScreen(); - afterIntroRoom(); - useTimedText(); - vSync(); - dumpMap(); - dumpTimedText(); - vSync(); - _cmp(data.byte(kGetback), 1); - if (!flags.z()) - goto moreendseq; -} - void DreamGenContext::fillOpen() { STACK_CHECK; delTextLine(); @@ -3475,14 +3453,6 @@ lookcolon: goto lookcolon; } -void DreamGenContext::drawItAll() { - STACK_CHECK; - createPanel(); - drawFloor(); - printSprites(); - showIcon(); -} - void DreamGenContext::useCashCard() { STACK_CHECK; getRidOfReels(); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index bde91490af..ddddf7955a 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -483,8 +483,8 @@ public: void __start(); #include "stubs.h" // Allow hand-reversed functions to have a signature different than void f() + void fadeDownMon(); void identifyOb(); - void runEndSeq(); void clearBuffers(); void getObTextStart(); void checkObjectSize(); @@ -497,7 +497,6 @@ public: void getOpenedSize(); void adjustUp(); void fadeScreenDownHalf(); - void fadeDownMon(); void outOfOpen(); void dirCom(); void endGameSeq(); @@ -547,7 +546,6 @@ public: void setPickup(); void dropObject(); void openOb(); - void drawItAll(); void useStereo(); void showDiaryKeys(); void useOpened(); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index e753efd72a..51884ace1f 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -4627,4 +4627,24 @@ void DreamGenContext::dumpDiaryKeys() { multiDump(kDiaryx + 151, kDiaryy + 71, 16, 16); } +void DreamGenContext::runEndSeq() { + atmospheres(); + data.byte(kGetback) = 0; + + do { + vSync(); + spriteUpdate(); + vSync(); + delEverything(); + printSprites(); + reelsOnScreen(); + afterIntroRoom(); + useTimedText(); + vSync(); + dumpMap(); + dumpTimedText(); + vSync(); + } while (data.byte(kGetback) != 1); +} + } // End of namespace DreamGen diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index f7d8086a64..24f92a947b 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -584,5 +584,6 @@ void updateSymbolBot(); void showDiaryPage(); void dumpDiaryKeys(); + void runEndSeq(); #endif -- cgit v1.2.3 From f1a099d4f8ba4cd2efc58c24f7075f77c7459016 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 14 Dec 2011 02:17:53 +0200 Subject: DREAMWEB: Port 'lookatcard' to C++ --- engines/dreamweb/dreamgen.cpp | 51 ------------------------------------------- engines/dreamweb/dreamgen.h | 5 ++--- engines/dreamweb/stubs.cpp | 30 +++++++++++++++++++++++++ engines/dreamweb/stubs.h | 1 + 4 files changed, 33 insertions(+), 54 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index d3e3ace249..e8e577e51b 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -3510,57 +3510,6 @@ _tmp1: putBackObStuff(); } -void DreamGenContext::lookAtCard() { - STACK_CHECK; - data.byte(kManisoffscreen) = 1; - getRidOfReels(); - loadKeypad(); - createPanel2(); - di = 160; - bx = 80; - ds = data.word(kTempgraphics); - al = 42; - ah = 128; - showFrame(); - getObTextStart(); - findNextColon(); - findNextColon(); - findNextColon(); - di = 36; - bx = 124; - dl = 241; - al = 0; - ah = 0; - printDirect(); - push(es); - push(si); - workToScreenM(); - cx = 280; - hangOnW(); - createPanel2(); - di = 160; - bx = 80; - ds = data.word(kTempgraphics); - al = 42; - ah = 128; - showFrame(); - si = pop(); - es = pop(); - di = 36; - bx = 130; - dl = 241; - al = 0; - ah = 0; - printDirect(); - workToScreenM(); - cx = 200; - hangOnW(); - data.byte(kManisoffscreen) = 0; - getRidOfTemp(); - restoreReels(); - putBackObStuff(); -} - void DreamGenContext::moneyPoke() { STACK_CHECK; bx = offset_money1poke; diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index ddddf7955a..43f93ee238 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -489,7 +489,7 @@ public: void getObTextStart(); void checkObjectSize(); void isRyanHolding(); - void showSlots(); + void fillOpen(); void useCashCard(); void moneyPoke(); void doSomeTalk(); @@ -537,10 +537,9 @@ public: void poolGuard(); void lookAtPlace(); void findAllOpen(); - void fillOpen(); + void showSlots(); void findSetObject(); void deleteExObject(); - void lookAtCard(); void helicopter(); void getEitherAd(); void setPickup(); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 51884ace1f..127724f7db 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -4647,4 +4647,34 @@ void DreamGenContext::runEndSeq() { } while (data.byte(kGetback) != 1); } +void DreamGenContext::lookAtCard() { + //showFrame((Frame *)ds.ptr(0, 0), di, bx, ax & 0x1ff, ah & 0xfe, &width, &height); + //al = DreamBase::printDirect(&string, di, &y, dl, (bool)(dl & 1)); + data.byte(kManisoffscreen) = 1; + getRidOfReels(); + loadKeypad(); + createPanel2(); + showFrame(tempGraphics(), 160, 80, 42, 128); + uint8 *obText = getObTextStartCPP(); + findNextColon(&obText); + findNextColon(&obText); + findNextColon(&obText); + printDirect(obText, 36, 124, 241, 241 & 1); + push(es); + push(si); + workToScreenM(); + hangOnW(280); + createPanel2(); + showFrame(tempGraphics(), 160, 80, 42, 128); + si = pop(); + es = pop(); + printDirect(obText, 36, 130, 241, 241 & 1); + workToScreenM(); + hangOnW(200); + data.byte(kManisoffscreen) = 0; + getRidOfTemp(); + restoreReels(); + putBackObStuff(); +} + } // End of namespace DreamGen diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 24f92a947b..e60a5698eb 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -585,5 +585,6 @@ void showDiaryPage(); void dumpDiaryKeys(); void runEndSeq(); + void lookAtCard(); #endif -- cgit v1.2.3 From 907e9bc0cc4d1601c34d57edb3c4ce7233cb786e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 14 Dec 2011 21:36:37 +1100 Subject: TSAGE: Implemented R2R Scene 400 - Science Lab --- engines/tsage/events.h | 3 +- engines/tsage/ringworld2/ringworld2_logic.cpp | 9 +- engines/tsage/ringworld2/ringworld2_scenes0.cpp | 242 +++++++++++++++++++++++- engines/tsage/ringworld2/ringworld2_scenes0.h | 46 +++++ engines/tsage/ringworld2/ringworld2_scenes2.cpp | 12 +- 5 files changed, 296 insertions(+), 16 deletions(-) (limited to 'engines') diff --git a/engines/tsage/events.h b/engines/tsage/events.h index 1942c98901..ecc710ed99 100644 --- a/engines/tsage/events.h +++ b/engines/tsage/events.h @@ -83,7 +83,8 @@ enum CursorType { INV_CARAVAN_KEY = 67, BF_LAST_INVENT = 68, // Ringworld 2 objects - R2_OPTO_DISK = 1, R2_2 = 2, R2_NEGATOR_GUN = 3, R2_STEPPING_DISKS = 4, R2_5 = 5, R2_6 = 6, + R2_OPTO_DISK = 1, R2_READER = 2, R2_NEGATOR_GUN = 3, R2_STEPPING_DISKS = 4, + R2_ATTRACTOR_UNIT = 5, R2_SENSOR_PROBE = 6, R2_7 = 7, R2_8 = 8, R2_9 = 9, R2_10 = 10, R2_11 = 11, R2_12 = 12, R2_13 = 13, R2_14 = 14, R2_15 = 15, R2_16 = 16, R2_17 = 17, R2_18 = 18, R2_19 = 19, R2_20 = 20, R2_21 = 21, R2_22 = 22, R2_23 = 23, R2_24 = 24, R2_25 = 25, R2_26 = 26, R2_27 = 27, R2_28 = 28, diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index e2e0c71a03..c6ad92bd91 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -57,7 +57,10 @@ Scene *Ringworld2Game::createScene(int sceneNumber) { case 300: return new Scene300(); case 325: + error("Missing scene %d from group 0", sceneNumber); case 400: + // Science Lab + return new Scene400(); case 500: case 525: case 600: @@ -576,11 +579,11 @@ void Ringworld2InvObjectList::reset() { // Set up default inventory setObjectScene(R2_OPTO_DISK, 800); - setObjectScene(R2_2, 400); + setObjectScene(R2_READER, 400); setObjectScene(R2_NEGATOR_GUN, 100); setObjectScene(R2_STEPPING_DISKS, 100); - setObjectScene(R2_5, 400); - setObjectScene(R2_6, 400); + setObjectScene(R2_ATTRACTOR_UNIT, 400); + setObjectScene(R2_SENSOR_PROBE, 400); setObjectScene(R2_7, 500); setObjectScene(R2_8, 700); setObjectScene(R2_9, 800); diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index 661a52d601..c3f97f1eef 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -64,7 +64,7 @@ void Scene50::process(Event &event) { event.handled = true; warning("TODO: incomplete Scene50::process()"); // CursorType _oldCursorId = _cursorId; - g_globals->_events.setCursor(R2_2); + g_globals->_events.setCursor(CURSOR_ARROW); // _cursorManager.sub_1D474(2, 0); // sub_5566A(1); // _cursorManager._fieldE = _oldCursorId; @@ -1204,8 +1204,6 @@ Common::String Scene125::parseMessage(const Common::String &msg) { * *--------------------------------------------------------------------------*/ -/*--------------------------------------------------------------------------*/ - void Scene150::postInit(SceneObjectList *OwnerList) { SceneExt::postInit(); loadScene(100); @@ -1675,7 +1673,7 @@ bool Scene300::Miranda::startAction(CursorType action, Event &event) { SceneItem::display2(300, 54); return true; - case R2_2: + case R2_READER: if (!R2_GLOBALS.getFlag(2) || !R2_GLOBALS.getFlag(3) || (R2_INVENTORY.getObjectScene(R2_OPTO_DISK) == 1)) SceneItem::display2(300, 55); else { @@ -1749,7 +1747,7 @@ bool Scene300::Seeker::startAction(CursorType action, Event &event) { scene->setAction(&scene->_sequenceManager1, scene, 310, &R2_GLOBALS._player, NULL); return true; - case R2_2: + case R2_READER: if (!R2_GLOBALS.getFlag(2) || !R2_GLOBALS.getFlag(3) || (R2_INVENTORY.getObjectScene(R2_OPTO_DISK) == 1)) break; @@ -2325,7 +2323,7 @@ void Scene300::signal() { void Scene300::signal309() { if (R2_GLOBALS.getFlag(2)) - R2_GLOBALS._stripManager_lookupList[0] = (R2_INVENTORY.getObjectScene(R2_2) == 1) ? 3 : 2; + R2_GLOBALS._stripManager_lookupList[0] = (R2_INVENTORY.getObjectScene(R2_READER) == 1) ? 3 : 2; if (R2_GLOBALS.getFlag(4)) R2_GLOBALS._stripManager_lookupList[0] = 4; @@ -2362,6 +2360,238 @@ void Scene300::signal309() { R2_GLOBALS._stripManager_lookupList[4] = 3; } +/*-------------------------------------------------------------------------- + * Scene 400 - Science Lab + * + *--------------------------------------------------------------------------*/ + +bool Scene400::Terminal::startAction(CursorType action, Event &event) { + Scene400 *scene = (Scene400 *)R2_GLOBALS._sceneManager._scene; + + if (action == CURSOR_USE) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 402; + scene->setAction(&scene->_sequenceManager1, scene, 402, &R2_GLOBALS._player, this, NULL); + + return true; + } else { + return NamedHotspot::startAction(action, event); + } +} + +/*--------------------------------------------------------------------------*/ + +bool Scene400::Door::startAction(CursorType action, Event &event) { + Scene400 *scene = (Scene400 *)R2_GLOBALS._sceneManager._scene; + + if (action == CURSOR_USE) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 401; + scene->setAction(&scene->_sequenceManager1, scene, 401, &R2_GLOBALS._player, this, NULL); + + return true; + } else { + return SceneActor::startAction(action, event); + } +} + +bool Scene400::Reader::startAction(CursorType action, Event &event) { + Scene400 *scene = (Scene400 *)R2_GLOBALS._sceneManager._scene; + + if (action == CURSOR_USE) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 405; + scene->setAction(&scene->_sequenceManager1, scene, 405, &R2_GLOBALS._player, this, NULL); + + return true; + } else { + return SceneActor::startAction(action, event); + } +} + +bool Scene400::SensorProbe::startAction(CursorType action, Event &event) { + Scene400 *scene = (Scene400 *)R2_GLOBALS._sceneManager._scene; + + if (action == CURSOR_USE) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 404; + scene->setAction(&scene->_sequenceManager1, scene, 404, &R2_GLOBALS._player, this, NULL); + + return true; + } else { + return SceneActor::startAction(action, event); + } +} + +bool Scene400::AttractorUnit::startAction(CursorType action, Event &event) { + Scene400 *scene = (Scene400 *)R2_GLOBALS._sceneManager._scene; + + if (action == CURSOR_USE) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 406; + scene->setAction(&scene->_sequenceManager1, scene, 406, &R2_GLOBALS._player, this, NULL); + + return true; + } else { + return SceneActor::startAction(action, event); + } +} + +/*--------------------------------------------------------------------------*/ + +void Scene400::postInit(SceneObjectList *OwnerList) { + SceneExt::postInit(); + loadScene(400); + _sound1.play(20); + + _door.postInit(); + _door.setVisage(100); + _door.setPosition(Common::Point(123, 84)); + _door.setDetails(400, 24, -1, 26, 1, NULL); + + _consoleDisplay.postInit(); + _consoleDisplay.setup(400, 4, 1); + _consoleDisplay.setPosition(Common::Point(236, 92)); + _consoleDisplay.fixPriority(120); + _consoleDisplay.animate(ANIM_MODE_2, NULL); + _consoleDisplay._numFrames = 5; + + _testerDisplay.postInit(); + _testerDisplay.setup(400, 2, 1); + _testerDisplay.setPosition(Common::Point(198, 83)); + _testerDisplay.animate(ANIM_MODE_2, NULL); + _testerDisplay._numFrames = 20; + + if (R2_INVENTORY.getObjectScene(R2_READER) == 400) { + _reader.postInit(); + _reader.setup(400, 5, 2); + _reader.setPosition(Common::Point(301, 95)); + _reader.setDetails(400, 54, -1, 56, 1, NULL); + } + + if (R2_INVENTORY.getObjectScene(R2_SENSOR_PROBE) == 400) { + _sensorProbe.postInit(); + _sensorProbe.setup(400, 5, 1); + _sensorProbe.setPosition(Common::Point(251, 104)); + _sensorProbe.fixPriority(121); + _sensorProbe.setDetails(400, 57, -1, 59, 1, NULL); + } + + if (R2_INVENTORY.getObjectScene(R2_ATTRACTOR_UNIT) == 400) { + _attractorUnit.postInit(); + _attractorUnit.setup(400, 5, 3); + _attractorUnit.setPosition(Common::Point(265, 129)); + _attractorUnit.setDetails(400, 60, -1, 62, 1, NULL); + } + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.setVisage(10); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player.disableControl(); + + _equipment1.setDetails(11, 400, 3, -1, -1); + _equipment2.setDetails(24, 400, 3, -1, -1); + _equipment3.setDetails(25, 400, 3, -1, -1); + _equipment4.setDetails(26, 400, 3, -1, -1); + _equipment5.setDetails(28, 400, 3, -1, -1); + _equipment6.setDetails(29, 400, 3, -1, -1); + _desk.setDetails(12, 400, 6, -1, -1); + _desk2.setDetails(27, 400, 6, -1, -1); + _terminal.setDetails(13, 400, 6, -1, 11); + _duct.setDetails(14, 400, 12, -1, -1); + _console.setDetails(15, 400, 15, -1, 17); + _equalizer.setDetails(Rect(284, 99, 308, 108), 400, 36, -1, 38, 1, NULL); + _transducer.setDetails(Rect(295, 67, 314, 79), 400, 39, -1, 41, 1, NULL); + _optimizer.setDetails(Rect(308, 106, 315, 113), 400, 42, -1, 44, 1, NULL); + _soundModule.setDetails(Rect(291, 118, 315, 131), 400, 45, -1, 47, 1, NULL); + _tester.setDetails(Rect(179, 62, 217, 92), 400, 30, -1, 32, 1, NULL); + _helmet.setDetails(Rect(181, 53, 197, 65), 400, 48, -1, 50, 1, NULL); + _nullifier.setDetails(Rect(201, 56, 212, 65), 400, 51, -1, 50, 1, NULL); + _shelves.setDetails(16, 400, 18, -1, 20); + _cabinet.setDetails(17, 400, 21, -1, -1); + _doorDisplay.setDetails(Rect(161, 43, 166, 52), 400, 27, -1, -1, 1, NULL); + _lights.setDetails(Rect(113, 3, 168, 14), 400, 33, -1, -1, 1, NULL); + _background.setDetails(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 400, 0, 1, -1, 1, NULL); + + _sceneMode = 400; + switch (R2_GLOBALS._sceneManager._previousScene) { + case 125: + setAction(&_sequenceManager1, this, 403, &R2_GLOBALS._player, NULL); + break; + case 200: + setAction(&_sequenceManager1, this, 400, &R2_GLOBALS._player, &_door, NULL); + break; + default: + R2_GLOBALS._player.setStrip(3); + R2_GLOBALS._player.setPosition(Common::Point(180, 100)); + R2_GLOBALS._player.enableControl(); + break; + } +} + +void Scene400::remove() { + R2_GLOBALS._sound1.fadeOut2(NULL); + SceneExt::remove(); +} + +void Scene400::signal() { + switch (_sceneMode) { + case 400: + case 403: + R2_GLOBALS._player.enableControl(); + break; + case 401: + R2_GLOBALS._sceneManager.changeScene(200); + break; + case 402: + R2_GLOBALS._sceneManager.changeScene(125); + break; + case 404: + // Getting the sensor probe + R2_INVENTORY.setObjectScene(R2_SENSOR_PROBE, 1); + _sensorProbe.remove(); + R2_GLOBALS._player.enableControl(); + break; + case 405: + // Getting the reader + R2_INVENTORY.setObjectScene(R2_READER, 1); + _reader.remove(); + R2_GLOBALS._player.enableControl(); + break; + case 406: + R2_INVENTORY.setObjectScene(R2_ATTRACTOR_UNIT, 1); + _attractorUnit.remove(); + R2_GLOBALS._player.enableControl(); + break; + default: + break; + } +} + +void Scene400::dispatch() { + switch (R2_GLOBALS._player.getRegionIndex() - 15) { + case 0: + case 11: + case 12: + R2_GLOBALS._player._shade = 2; + break; + case 9: + R2_GLOBALS._player._shade = 0; + break; + case 10: + R2_GLOBALS._player._shade = 1; + break; + case 13: + R2_GLOBALS._player._shade = 3; + break; + case 14: + R2_GLOBALS._player._shade = 4; + break; + default: + break; + } +} + } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.h b/engines/tsage/ringworld2/ringworld2_scenes0.h index 5b3123b37f..646d23286a 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.h +++ b/engines/tsage/ringworld2/ringworld2_scenes0.h @@ -292,6 +292,52 @@ public: virtual void signal(); }; +class Scene400: public SceneExt { + /* Items */ + class Terminal: public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + /* Objects */ + class Door: public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Reader: public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class SensorProbe: public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class AttractorUnit: public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; +public: + NamedHotspot _background, _equipment1, _equipment2, _equipment3; + NamedHotspot _equipment4, _equipment5, _equipment6; + NamedHotspot _desk, _desk2, _console; + NamedHotspot _duct, _shelves, _cabinet, _doorDisplay, _lights; + NamedHotspot _equalizer, _transducer, _optimizer, _soundModule, _tester; + NamedHotspot _helmet, _nullifier; + Terminal _terminal; + SceneActor _consoleDisplay, _testerDisplay; + Door _door; + Reader _reader; + SensorProbe _sensorProbe; + AttractorUnit _attractorUnit; + SequenceManager _sequenceManager1; + ASoundExt _sound1; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void remove(); + virtual void signal(); + virtual void dispatch(); +}; + } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_scenes2.cpp b/engines/tsage/ringworld2/ringworld2_scenes2.cpp index 4b4f9b8375..d820784c45 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes2.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes2.cpp @@ -1047,7 +1047,7 @@ void Scene2000::synchronize(Serializer &s) { * *--------------------------------------------------------------------------*/ bool Scene2350::Actor2::startAction(CursorType action, Event &event) { - if (action != R2_6) + if (action != R2_SENSOR_PROBE) return(SceneActor::startAction(action, event)); return true; } @@ -1651,13 +1651,13 @@ bool Scene2435::Actor2::startAction(CursorType action, Event &event) { switch (action) { case R2_34: R2_GLOBALS._player.disableControl(); - R2_GLOBALS._events.setCursor(R2_2); + R2_GLOBALS._events.setCursor(CURSOR_ARROW); R2_GLOBALS.setFlag(82); scene->_stripManager.start(603, scene); return true; case R2_35: R2_GLOBALS._player.disableControl(); - R2_GLOBALS._events.setCursor(R2_2); + R2_GLOBALS._events.setCursor(CURSOR_ARROW); R2_GLOBALS.setFlag(82); scene->_stripManager.start(602, scene); R2_INVENTORY.setObjectScene(R2_35, 2000); @@ -1665,7 +1665,7 @@ bool Scene2435::Actor2::startAction(CursorType action, Event &event) { case CURSOR_TALK: R2_GLOBALS._player.disableControl(); scene->_sceneMode = 20; - R2_GLOBALS._events.setCursor(R2_2); + R2_GLOBALS._events.setCursor(CURSOR_ARROW); if ((R2_GLOBALS._player._characterIndex == 1) || (R2_GLOBALS.getFlag(82))) { scene->_stripManager.start(605, scene); return true; @@ -1765,7 +1765,7 @@ void Scene2435::signal() { g_globals->_sceneManager.changeScene(2000); break; case 20: - R2_GLOBALS._player.enableControl(R2_6); + R2_GLOBALS._player.enableControl(CURSOR_TALK); break; case 30: R2_GLOBALS._player._characterScene[1] = 2435; @@ -1787,7 +1787,7 @@ void Scene2435::signal() { case 2436: R2_GLOBALS._walkRegions.enableRegion(2); _sceneMode = 20; - R2_GLOBALS._events.setCursor(R2_2); + R2_GLOBALS._events.setCursor(CURSOR_ARROW); _stripManager.start(709, this); default: R2_GLOBALS._player.enableControl(); -- cgit v1.2.3 From 991bcb680607853e79dcf2d5caa9cfe225d300a3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 14 Dec 2011 21:44:45 +1100 Subject: TSAGE: Return to R2R scene 175 - Empty Bedroom #2 --- engines/tsage/ringworld2/ringworld2_logic.cpp | 8 ++++++-- engines/tsage/ringworld2/ringworld2_scenes0.h | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'engines') diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index c6ad92bd91..8abe44a766 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -42,10 +42,14 @@ Scene *Ringworld2Game::createScene(int sceneNumber) { case 100: return new Scene100(); // Computer console case 125: return new Scene125(); - // Empty Bedroom - case 150: return new Scene150(); + case 150: + // Empty Bedroom #1 + return new Scene150(); case 160: + error("Missing scene %d from group 0", sceneNumber); case 175: + // Empty Bedroom #2 + return new Scene175(); case 180: error("Missing scene %d from group 0", sceneNumber); case 200: diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.h b/engines/tsage/ringworld2/ringworld2_scenes0.h index 646d23286a..16133e81a0 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.h +++ b/engines/tsage/ringworld2/ringworld2_scenes0.h @@ -166,6 +166,9 @@ public: virtual void signal(); }; +class Scene175: public Scene150 { +}; + class Scene200: public SceneExt { /* Objects */ class NorthDoor: public SceneActor { -- cgit v1.2.3 From bd45f291d5f11ba4884b22d22341baf9e43e2b2b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 14 Dec 2011 21:48:38 +1100 Subject: TSAGE: Bugfix for using terminal in R2R scene 400 --- engines/tsage/ringworld2/ringworld2_scenes0.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'engines') diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index c3f97f1eef..61e3f8e00b 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -2569,6 +2569,8 @@ void Scene400::signal() { } void Scene400::dispatch() { + SceneExt::dispatch(); + switch (R2_GLOBALS._player.getRegionIndex() - 15) { case 0: case 11: -- cgit v1.2.3 From 8d804a855307ba8d16854ab12a1d5a1a576a6475 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 14 Dec 2011 21:50:46 +1100 Subject: TSAGE: Clean up comments in R2R scene factory method --- engines/tsage/ringworld2/ringworld2_logic.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'engines') diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index 8abe44a766..ef1cb76c91 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -36,12 +36,15 @@ namespace Ringworld2 { Scene *Ringworld2Game::createScene(int sceneNumber) { switch (sceneNumber) { /* Scene group #0 */ - // - case 50: return new Scene50(); - // Quinn's room - case 100: return new Scene100(); - // Computer console - case 125: return new Scene125(); + case 50: + // Waking up cutscene + return new Scene50(); + case 100: + // Quinn's room + return new Scene100(); + case 125: + // Computer console + return new Scene125(); case 150: // Empty Bedroom #1 return new Scene150(); -- cgit v1.2.3 From 5af0deba87afaac279db04da52241b6ad1c6d723 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Wed, 14 Dec 2011 12:17:32 +0100 Subject: DREAMWEB: Cleanup --- engines/dreamweb/dreambase.h | 1 + engines/dreamweb/stubs.cpp | 14 +++++++------- engines/dreamweb/stubs.h | 6 ++++-- engines/dreamweb/use.cpp | 6 +++--- 4 files changed, 15 insertions(+), 12 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index c7e9546069..2048f39e3b 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -151,6 +151,7 @@ public: SetObject *getSetAd(uint8 index); void *getAnyAd(uint8 *value1, uint8 *value2); const uint8 *getTextInFile1(uint16 index); + uint8 findNextColon(const uint8 **string); // from use.cpp void placeFreeObject(uint8 index); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 127724f7db..d931789746 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -1917,13 +1917,13 @@ void DreamGenContext::hangOnP(uint16 count) { } void DreamGenContext::findNextColon() { - uint8 *initialString = es.ptr(si, 0); - uint8 *string = initialString; + const uint8 *initialString = es.ptr(si, 0); + const uint8 *string = initialString; al = findNextColon(&string); si += (string - initialString); } -uint8 DreamGenContext::findNextColon(uint8 **string) { +uint8 DreamBase::findNextColon(const uint8 **string) { uint8 c; do { c = **string; @@ -1932,11 +1932,11 @@ uint8 DreamGenContext::findNextColon(uint8 **string) { return c; } -uint8 *DreamGenContext::getObTextStartCPP() { +const uint8 *DreamGenContext::getObTextStartCPP() { push(es); push(si); getObTextStart(); - uint8 *result = es.ptr(si, 0); + const uint8 *result = es.ptr(si, 0); si = pop(); es = pop(); return result; @@ -2246,7 +2246,7 @@ void DreamGenContext::doLook() { dumpTextLine(); uint8 index = data.byte(kRoomnum) & 31; uint16 offset = getSegment(data.word(kRoomdesc)).word(kIntextdat + index * 2); - uint8 *string = getSegment(data.word(kRoomdesc)).ptr(kIntext, 0) + offset; + const uint8 *string = getSegment(data.word(kRoomdesc)).ptr(kIntext, 0) + offset; findNextColon(&string); uint16 x; if (data.byte(kReallocation) < 50) @@ -4655,7 +4655,7 @@ void DreamGenContext::lookAtCard() { loadKeypad(); createPanel2(); showFrame(tempGraphics(), 160, 80, 42, 128); - uint8 *obText = getObTextStartCPP(); + const uint8 *obText = getObTextStartCPP(); findNextColon(&obText); findNextColon(&obText); findNextColon(&obText); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index e60a5698eb..06033b50d0 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -227,9 +227,11 @@ void hangOnP(); void hangOnP(uint16 count); void showIcon(); - uint8 findNextColon(uint8 **string); + uint8 findNextColon(const uint8 **string) { + return DreamBase::findNextColon(string); + } void findNextColon(); - uint8 *getObTextStartCPP(); + const uint8 *getObTextStartCPP(); void useText(const uint8 *string); void useText(); void getBlockOfPixel(); diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp index c591eca826..a144f850b6 100644 --- a/engines/dreamweb/use.cpp +++ b/engines/dreamweb/use.cpp @@ -139,7 +139,7 @@ void DreamGenContext::useRoutine() { } delPointer(); - uint8 *obText = getObTextStartCPP(); + const uint8 *obText = getObTextStartCPP(); if (findNextColon(&obText) != 0) { if (findNextColon(&obText) != 0) { if (*obText != 0) { @@ -178,7 +178,7 @@ void DreamGenContext::useText(const uint8 *string) { } void DreamGenContext::showFirstUse() { - uint8 *obText = getObTextStartCPP(); + const uint8 *obText = getObTextStartCPP(); findNextColon(&obText); findNextColon(&obText); useText(obText); @@ -186,7 +186,7 @@ void DreamGenContext::showFirstUse() { } void DreamGenContext::showSecondUse() { - uint8 *obText = getObTextStartCPP(); + const uint8 *obText = getObTextStartCPP(); findNextColon(&obText); findNextColon(&obText); findNextColon(&obText); -- cgit v1.2.3 From a489430bc33268d1120442bfd2e4c455cd358ec0 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Wed, 14 Dec 2011 12:02:59 +0100 Subject: DREAMWEB: Fix regression in showDiaryPage and lookAtCard --- engines/dreamweb/stubs.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index d931789746..0c22ffc2f5 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -4591,6 +4591,7 @@ void DreamGenContext::showDiaryPage() { const uint8 *string = getSegment(data.word(kTextfile1)).ptr(offset, 0); uint16 y = kDiaryy + 16; printDirect(&string, kDiaryx + 48, &y, 240, 240 & 1); + y = kDiaryy + 16; printDirect(&string, kDiaryx + 129, &y, 240, 240 & 1); y = kDiaryy + 23; printDirect(&string, kDiaryx + 48, &y, 240, 240 & 1); @@ -4659,7 +4660,8 @@ void DreamGenContext::lookAtCard() { findNextColon(&obText); findNextColon(&obText); findNextColon(&obText); - printDirect(obText, 36, 124, 241, 241 & 1); + uint16 y = 124; + printDirect(&obText, 36, &y, 241, 241 & 1); push(es); push(si); workToScreenM(); -- cgit v1.2.3 From ee5c9678c318ae844a1642445f1aefc3eaeaa320 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Wed, 14 Dec 2011 12:08:20 +0100 Subject: DREAMWEB: Cleanup --- engines/dreamweb/stubs.cpp | 19 +++++-------------- engines/dreamweb/stubs.h | 6 ++++++ 2 files changed, 11 insertions(+), 14 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 0c22ffc2f5..c365ee48d3 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -4587,8 +4587,7 @@ void DreamGenContext::showDiaryPage() { data.byte(kKerning) = 1; useTempCharset(); data.word(kCharshift) = 91+91; - uint16 offset = kTextstart + getSegment(data.word(kTextfile1)).word(data.byte(kDiarypage) * 2); - const uint8 *string = getSegment(data.word(kTextfile1)).ptr(offset, 0); + const uint8 *string = getTextInFile1(data.byte(kDiarypage)); uint16 y = kDiaryy + 16; printDirect(&string, kDiaryx + 48, &y, 240, 240 & 1); y = kDiaryy + 16; @@ -4602,14 +4601,12 @@ void DreamGenContext::showDiaryPage() { void DreamGenContext::dumpDiaryKeys() { if (data.byte(kPresscount) == 1) { - if (data.byte(kSartaindead) != 1 && data.byte(kDiarypage) == 5 && DreamBase::getLocation(6) != 1) { + if (data.byte(kSartaindead) != 1 && data.byte(kDiarypage) == 5 && getLocation(6) != 1) { // Add Sartain Industries note - DreamBase::setLocation(6); + setLocation(6); delPointer(); - uint16 offset = kTextstart + getSegment(data.word(kTextfile1)).word(12 * 2); - const uint8 *string = getSegment(data.word(kTextfile1)).ptr(offset, 0); - uint16 y = 106; - printDirect(&string, 70, &y, 241, 241 & 1); + const uint8 *string = getTextInFile1(12); + printDirect(string, 70, 106, 241, 241 & 1); workToScreenM(); hangOnP(200); createPanel(); @@ -4649,8 +4646,6 @@ void DreamGenContext::runEndSeq() { } void DreamGenContext::lookAtCard() { - //showFrame((Frame *)ds.ptr(0, 0), di, bx, ax & 0x1ff, ah & 0xfe, &width, &height); - //al = DreamBase::printDirect(&string, di, &y, dl, (bool)(dl & 1)); data.byte(kManisoffscreen) = 1; getRidOfReels(); loadKeypad(); @@ -4662,14 +4657,10 @@ void DreamGenContext::lookAtCard() { findNextColon(&obText); uint16 y = 124; printDirect(&obText, 36, &y, 241, 241 & 1); - push(es); - push(si); workToScreenM(); hangOnW(280); createPanel2(); showFrame(tempGraphics(), 160, 80, 42, 128); - si = pop(); - es = pop(); printDirect(obText, 36, 130, 241, 241 & 1); workToScreenM(); hangOnW(200); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 06033b50d0..a287d57bad 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -371,7 +371,13 @@ void folderHints(); void folderExit(); void getLocation(); + uint8 getLocation(uint8 index) { + return DreamBase::getLocation(index); + } void setLocation(); + void setLocation(uint8 index) { + DreamBase::setLocation(index); + } void loadTempText(); void loadTempText(const char *fileName); void loadTravelText(); -- cgit v1.2.3 From 5948b5a9e3b587fa257d7dea0ec32633060bbc38 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Wed, 14 Dec 2011 12:32:18 +0100 Subject: DREAMWEB: Allow quit from diary --- engines/dreamweb/use.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp index a144f850b6..599cdf7334 100644 --- a/engines/dreamweb/use.cpp +++ b/engines/dreamweb/use.cpp @@ -1213,7 +1213,8 @@ void DreamGenContext::useDiary() { dumpDiaryKeys(); dumpTextLine(); checkCoords(diaryList); - } while (!data.byte(kGetback)); + } while (!data.byte(kGetback) && !quitRequested()); + getRidOfTemp(); getRidOfTempText(); -- cgit v1.2.3 From a87a63c1bd45c925cc4d85458ccd78c82557cd18 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 13 Dec 2011 13:45:47 +0100 Subject: DREAMWEB: Convert execCommand to C++, remove comlist from data blob --- engines/dreamweb/dreamgen.cpp | 190 +++++++++++------------------------------- engines/dreamweb/dreamgen.h | 32 ++++--- engines/dreamweb/monitor.cpp | 72 +++++++++++++++- engines/dreamweb/stubs.h | 1 + 4 files changed, 136 insertions(+), 159 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index e8e577e51b..ef96461d17 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -2731,14 +2731,14 @@ void DreamGenContext::getDestInfo() { push(ax); dx = data; es = dx; - si = 1244; + si = 1184; _add(si, ax); cl = es.byte(si); ax = pop(); push(cx); dx = data; es = dx; - si = 1260; + si = 1200; _add(si, ax); ax = pop(); } @@ -2790,7 +2790,7 @@ clearedlocations: bx = ax; dx = data; es = dx; - _add(bx, 1244); + _add(bx, 1184); es.byte(bx) = 0; } @@ -2821,88 +2821,6 @@ void DreamGenContext::makeCaps() { _sub(al, 32); } -void DreamGenContext::execCommand() { - STACK_CHECK; - es = cs; - bx = offset_comlist; - ds = cs; - si = 1278; - al = ds.byte(si); - _cmp(al, 0); - if (!flags.z()) - goto notblankinp; - scrollMonitor(); - return; -notblankinp: - cl = 0; -comloop: - push(bx); - push(si); -comloop2: - al = ds.byte(si); - _add(si, 2); - ah = es.byte(bx); - _inc(bx); - _cmp(ah, 32); - if (flags.z()) - goto foundcom; - _cmp(al, ah); - if (flags.z()) - goto comloop2; - si = pop(); - bx = pop(); - _add(bx, 10); - _inc(cl); - _cmp(cl, 6); - if (!flags.z()) - goto comloop; - netError(); - al = 0; - return; -foundcom: - si = pop(); - bx = pop(); - _cmp(cl, 1); - if (flags.z()) - goto testcom; - _cmp(cl, 2); - if (flags.z()) - goto directory; - _cmp(cl, 3); - if (flags.z()) - goto accesscom; - _cmp(cl, 4); - if (flags.z()) - goto signoncom; - _cmp(cl, 5); - if (flags.z()) - goto keyscom; - goto quitcom; -directory: - dirCom(); - al = 0; - return; -signoncom: - signOn(); - al = 0; - return; -accesscom: - read(); - al = 0; - return; -keyscom: - showKeys(); - al = 0; - return; -testcom: - al = 6; - monMessage(); - al = 0; - return; -quitcom: - al = 1; -} - void DreamGenContext::dirCom() { STACK_CHECK; cx = 30; @@ -2919,7 +2837,7 @@ dirroot: si = offset_rootdir; _inc(si); es = cs; - di = 1120; + di = 1060; _inc(di); cx = 12; _movsb(cx, true); @@ -3021,7 +2939,7 @@ notyetassigned: push(bx); _add(bx, 2); ds = cs; - si = 1278; + si = 1218; checkpass: _lodsw(); ah = es.byte(bx); @@ -3092,7 +3010,7 @@ void DreamGenContext::read() { return; okcom: es = cs; - di = 1120; + di = 1060; ax = data.word(kTextfile1); data.word(kMonsource) = ax; ds = ax; @@ -3222,7 +3140,7 @@ keyok2: ds = cs; si = offset_operand1+1; es = cs; - di = 1120+1; + di = 1060+1; cx = 12; _movsb(cx, true); monitorLogo(); @@ -3349,7 +3267,7 @@ void DreamGenContext::parser() { al = '='; _stosb(); ds = cs; - si = 1278; + si = 1218; notspace1: _lodsw(); _cmp(al, 32); @@ -4167,7 +4085,7 @@ void DreamGenContext::clearChanges() { di = 0; _stosw(cx, true); es = cs; - di = 1244; + di = 1184; al = 1; _stosb(2); al = 0; @@ -4474,51 +4392,51 @@ void DreamGenContext::__start() { //0x0370: ...2 .... ...2 .... 0x14, 0x00, 0x00, 0x32, 0x14, 0x00, 0x0e, 0x21, 0x28, 0x00, 0x00, 0x32, 0x14, 0x00, 0xff, 0x44, //0x0380: ...2 ...! (..2 ...D - 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x56, 0x39, 0x39, 0x00, 0x00, 0x01, 0x45, 0x58, - //0x0390: REAM WEB. V99. ..EX - 0x49, 0x54, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x48, 0x45, 0x4c, 0x50, 0x20, 0x20, 0x20, 0x20, - //0x03a0: IT HELP - 0x20, 0x20, 0x4c, 0x49, 0x53, 0x54, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x52, 0x45, 0x41, 0x44, - //0x03b0: LI ST READ - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x4c, 0x4f, 0x47, 0x4f, 0x4e, 0x20, 0x20, 0x20, 0x20, 0x20, - //0x03c0: LO GON - 0x4b, 0x45, 0x59, 0x53, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x01, 0x00, 0x50, 0x55, 0x42, 0x4c, - //0x03d0: KEYS .. PUBL - 0x49, 0x43, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x20, 0x20, - //0x03e0: IC PUBL IC - 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x42, 0x4c, 0x41, 0x43, 0x4b, 0x44, 0x52, 0x41, 0x47, 0x4f, - //0x03f0: . ..BL ACKD RAGO - 0x4e, 0x20, 0x52, 0x59, 0x41, 0x4e, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, - //0x0400: N RY AN ... - 0x48, 0x45, 0x4e, 0x44, 0x52, 0x49, 0x58, 0x20, 0x20, 0x20, 0x20, 0x20, 0x4c, 0x4f, 0x55, 0x49, - //0x0410: HEND RIX LOUI - 0x53, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x53, 0x45, 0x50, 0x54, 0x49, 0x4d, - //0x0420: S . ..SE PTIM - 0x55, 0x53, 0x20, 0x20, 0x20, 0x20, 0x42, 0x45, 0x43, 0x4b, 0x45, 0x54, 0x54, 0x20, 0x20, 0x20, - //0x0430: US BE CKET T - 0x20, 0x00, 0xff, 0xff, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - //0x0440: ... - 0x20, 0x00, 0x22, 0x52, 0x4f, 0x4f, 0x54, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, - //0x0450: ."R OOT . - 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x30, 0x30, - //0x0460: " .00 - 0x30, 0x30, 0x00, 0x30, 0x30, 0x00, 0x0d, 0x0a, 0x0d, 0x0a, 0x24, 0x4f, 0x42, 0x4a, 0x45, 0x43, - //0x0470: 00.0 0... ..$O BJEC - 0x54, 0x20, 0x4e, 0x41, 0x4d, 0x45, 0x20, 0x4f, 0x4e, 0x45, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - //0x0480: T NA ME O NE + 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x56, 0x39, 0x39, 0x00, 0x00, 0x01, 0x01, 0x00, + //0x0390: REAM WEB. V99. .... + 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x50, 0x55, 0x42, 0x4c, + //0x03a0: PUBL IC PUBL + 0x49, 0x43, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x42, 0x4c, 0x41, 0x43, 0x4b, 0x44, + //0x03b0: IC . ..BL ACKD + 0x52, 0x41, 0x47, 0x4f, 0x4e, 0x20, 0x52, 0x59, 0x41, 0x4e, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + //0x03c0: RAGO N RY AN + 0x20, 0x00, 0x00, 0x00, 0x48, 0x45, 0x4e, 0x44, 0x52, 0x49, 0x58, 0x20, 0x20, 0x20, 0x20, 0x20, + //0x03d0: ... HEND RIX + 0x4c, 0x4f, 0x55, 0x49, 0x53, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x53, 0x45, + //0x03e0: LOUI S . ..SE + 0x50, 0x54, 0x49, 0x4d, 0x55, 0x53, 0x20, 0x20, 0x20, 0x20, 0x42, 0x45, 0x43, 0x4b, 0x45, 0x54, + //0x03f0: PTIM US BE CKET + 0x54, 0x20, 0x20, 0x20, 0x20, 0x00, 0xff, 0xff, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + //0x0400: T ... + 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x22, 0x52, 0x4f, 0x4f, 0x54, 0x20, 0x20, 0x20, 0x20, 0x20, + //0x0410: ."R OOT + 0x20, 0x20, 0x20, 0x00, 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + //0x0420: . " + 0x20, 0x00, 0x30, 0x30, 0x30, 0x30, 0x00, 0x30, 0x30, 0x00, 0x0d, 0x0a, 0x0d, 0x0a, 0x24, 0x4f, + //0x0430: .00 00.0 0... ..$O + 0x42, 0x4a, 0x45, 0x43, 0x54, 0x20, 0x4e, 0x41, 0x4d, 0x45, 0x20, 0x4f, 0x4e, 0x45, 0x20, 0x20, + //0x0440: BJEC T NA ME O NE 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - //0x0490: - 0x20, 0x20, 0x20, 0x00, 0x10, 0x12, 0x12, 0x11, 0x10, 0x10, 0x10, 0x01, 0x01, 0x01, 0x01, 0x01, - //0x04a0: . .... .... .... - 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x44, 0x3a, 0x00, 0x00, - //0x04b0: .... .... .... D:.. + //0x0450: + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x10, 0x12, 0x12, 0x11, 0x10, 0x10, 0x10, 0x01, + //0x0460: . .... .... + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, + //0x0470: .... .... .... .... + 0x44, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + //0x0480: D:.. .... .... .... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + //0x0490: .... .... .... .... + 0x01, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + //0x04a0: .... .... .... .... + 0x05, 0x00, 0x03, 0x02, 0x04, 0x01, 0x0a, 0x09, 0x08, 0x06, 0x0b, 0x04, 0x07, 0x07, 0x00, 0x00, + //0x04b0: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x04c0: .... .... .... .... - 0x00, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x04d0: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x02, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x04e0: .... .... .... .... - 0x04, 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, //0x04f0: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0500: .... .... .... .... @@ -4528,15 +4446,7 @@ void DreamGenContext::__start() { //0x0520: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0530: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x0540: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x0550: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x0560: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, - //0x0570: .... .... .... .... - 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, }; + 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, }; ds.assign(src, src + sizeof(src)); dreamweb(); } diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 43f93ee238..dc06f1f9e5 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -32,14 +32,13 @@ namespace DreamGen { -static const uint16 offset_money1poke = 0x046e; -static const uint16 offset_operand1 = 0x0444; -static const uint16 offset_comlist = 0x039e; -static const uint16 offset_commandline = 0x047b; -static const uint16 offset_rootdir = 0x0452; -static const uint16 offset_money2poke = 0x0473; +static const uint16 offset_commandline = 0x043f; +static const uint16 offset_rootdir = 0x0416; +static const uint16 offset_money2poke = 0x0437; +static const uint16 offset_operand1 = 0x0408; +static const uint16 offset_keys = 0x039e; +static const uint16 offset_money1poke = 0x0432; static const uint16 offset_openchangesize = 0x039c; -static const uint16 offset_keys = 0x03da; static const uint16 kStartvars = 0; static const uint16 kProgresspoints = 1; static const uint16 kWatchon = 2; @@ -373,15 +372,15 @@ static const uint16 kCurrentsample = 452; static const uint16 kRoomssample = 453; static const uint16 kReelroutines = 454; static const uint16 kBasicsample = 911; -static const uint16 kCurrentfile = 1120; -static const uint16 kRoomscango = 1244; -static const uint16 kRoompics = 1260; -static const uint16 kOplist = 1275; -static const uint16 kInputline = 1278; -static const uint16 kPresslist = 1406; -static const uint16 kQuitrequested = 1412; -static const uint16 kSubtitles = 1413; -static const uint16 kForeignrelease = 1414; +static const uint16 kCurrentfile = 1060; +static const uint16 kRoomscango = 1184; +static const uint16 kRoompics = 1200; +static const uint16 kOplist = 1215; +static const uint16 kInputline = 1218; +static const uint16 kPresslist = 1346; +static const uint16 kQuitrequested = 1352; +static const uint16 kSubtitles = 1353; +static const uint16 kForeignrelease = 1354; static const uint16 kBlocktextdat = (0); static const uint16 kPersonframes = (0); static const uint16 kDebuglevel1 = (0); @@ -569,7 +568,6 @@ public: void searchForFiles(); void getExAd(); void initialMonCols(); - void execCommand(); void findPuzText(); void swapWithInv(); void adjustRight(); diff --git a/engines/dreamweb/monitor.cpp b/engines/dreamweb/monitor.cpp index f01664632a..dba0d56c31 100644 --- a/engines/dreamweb/monitor.cpp +++ b/engines/dreamweb/monitor.cpp @@ -70,6 +70,7 @@ void DreamGenContext::useMon() { scrollMonitor(); data.word(kBufferin) = 0; data.word(kBufferout) = 0; + bool stop = false; do { di = data.word(kMonadx); bx = data.word(kMonady); @@ -80,10 +81,10 @@ void DreamGenContext::useMon() { di = pop(); data.word(kMonadx) = di; data.word(kMonady) = bx; - execCommand(); + stop = execCommand(); if (quitRequested()) //TODO : Check why it crashes when put before the execcommand break; - } while (al == 0); + } while (!stop); getRidOfTemp(); getRidOfTempCharset(); deallocateMem(data.word(kTextfile1)); @@ -97,6 +98,73 @@ void DreamGenContext::useMon() { workToScreenM(); } +bool DreamGenContext::execCommand() { + static const char *comlist[] = { + "EXIT", + "HELP", + "LIST", + "READ", + "LOGON", + "KEYS" + }; + + const char *inputLine = (const char *)data.ptr(kInputline, 64); + if (*inputLine == 0) { + // No input + scrollMonitor(); + return false; + } + + int cmd; + bool done = false; + // Loop over all commands in the list and see if we get a match + for (cmd = 0; cmd < ARRAYSIZE(comlist); ++cmd) { + const char *cmdStr = comlist[cmd]; + const char *inputStr = inputLine; + // Compare the command, char by char, to see if we get a match. + // We only care about the prefix matching, though. + char inputChar, cmdChar; + do { + inputChar = *inputStr; inputStr += 2; + cmdChar = *cmdStr++; + if (cmdChar == 0) { + done = true; + break; + } + } while (inputChar == cmdChar); + + if (done) + break; + } + + // Execute the selected command + switch (cmd) { + case 0: + return true; + case 1: + monMessage(6); + break; + case 2: + dirCom(); + break; + case 3: + read(); + break; + case 4: + signOn(); + break; + case 5: + showKeys(); + break; + default: + netError(); + break; + } + return false; +} + + + void DreamGenContext::monitorLogo() { if (data.byte(kLogonum) != data.byte(kOldlogonum)) { data.byte(kOldlogonum) = data.byte(kLogonum); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index a287d57bad..b3b974a43d 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -594,5 +594,6 @@ void dumpDiaryKeys(); void runEndSeq(); void lookAtCard(); + bool execCommand(); #endif -- cgit v1.2.3 From e44a79fdd49e746947cbb88e3982dc8c89e2ae44 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 13 Dec 2011 14:04:10 +0100 Subject: DREAMWEB: Convert makeCaps to C++, fix bug in delChar --- engines/dreamweb/dreambase.h | 3 +++ engines/dreamweb/dreamgen.cpp | 8 -------- engines/dreamweb/dreamgen.h | 1 - engines/dreamweb/monitor.cpp | 21 +++++++++++++++------ engines/dreamweb/stubs.h | 6 ++++-- 5 files changed, 22 insertions(+), 17 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 2048f39e3b..a451704c6a 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -52,6 +52,9 @@ public: public: // from monitor.cpp + void input(); + byte makeCaps(byte c); + void delChar(); void printOuterMon(); void showCurrentFile(); void accessLightOn(); diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index ef96461d17..3831f386db 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -2813,14 +2813,6 @@ emptyinterface: al = 0; } -void DreamGenContext::makeCaps() { - STACK_CHECK; - _cmp(al, 'a'); - if (flags.c()) - return /* (notupperc) */; - _sub(al, 32); -} - void DreamGenContext::dirCom() { STACK_CHECK; cx = 30; diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index dc06f1f9e5..8d23f9768e 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -554,7 +554,6 @@ public: void checkInside(); void findPathOfPoint(); void getDestInfo(); - void makeCaps(); void read(); void additionalText(); void mugger(); diff --git a/engines/dreamweb/monitor.cpp b/engines/dreamweb/monitor.cpp index dba0d56c31..5d0987b29e 100644 --- a/engines/dreamweb/monitor.cpp +++ b/engines/dreamweb/monitor.cpp @@ -185,7 +185,7 @@ void DreamBase::printLogo() { showCurrentFile(); } -void DreamGenContext::input() { +void DreamBase::input() { char *inputLine = (char *)data.ptr(kInputline, 64); memset(inputLine, 0, 64); data.word(kCurpos) = 0; @@ -215,9 +215,7 @@ void DreamGenContext::input() { continue; if ((currentKey == 32) && (data.word(kCurpos) == 0)) continue; - al = currentKey; - makeCaps(); - currentKey = al; + currentKey = makeCaps(currentKey); inputLine[data.word(kCurpos) * 2 + 0] = currentKey; if (currentKey > 'Z') continue; @@ -231,7 +229,18 @@ void DreamGenContext::input() { } } -void DreamGenContext::delChar() { +void DreamGenContext::makeCaps() { + al = makeCaps(al); +} + +byte DreamBase::makeCaps(byte c) { + // TODO: Replace calls to this by toupper() ? + if (c >= 'a') + c -= 'a' - 'A'; // = 32 + return c; +} + +void DreamBase::delChar() { char *inputLine = (char *)data.ptr(kInputline, 0); --data.word(kCurpos); inputLine[data.word(kCurpos) * 2] = 0; @@ -241,7 +250,7 @@ void DreamGenContext::delChar() { uint16 offset = data.word(kCurpos); offset = ((offset & 0x00ff) << 8) | ((offset & 0xff00) >> 8); multiPut(mapStore() + offset, data.word(kMonadx), data.word(kMonady), 8, 8); - multiDump(data.word(kMonadx), data.word(kMonady), al, 8); + multiDump(data.word(kMonadx), data.word(kMonady), 8, 8); } void DreamBase::printCurs() { diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index b3b974a43d..481e784e4a 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -38,7 +38,6 @@ void loadTempCharset(); void loadTempCharset(const char *fileName); void saveLoad(); - void delChar(); void hangOnCurs(uint16 frameCount); void hangOnCurs(); void workToScreen(); @@ -267,7 +266,10 @@ void dumpMenu(); void useMenu(); void useMon(); - void input(); + void makeCaps(); + byte makeCaps(byte c) { + return DreamBase::makeCaps(c); + } void monPrint(); const char *monPrint(const char *string) { return DreamBase::monPrint(string); -- cgit v1.2.3 From b466575d9e36d1c36e64e2d3cccadfd44e2e6940 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 13 Dec 2011 14:21:21 +0100 Subject: DREAMWEB: Move more stuff to DreamBase --- engines/dreamweb/dreambase.h | 19 +++++++++++++++++ engines/dreamweb/monitor.cpp | 12 ++++------- engines/dreamweb/stubs.cpp | 49 ++++++++++++++++++++++---------------------- engines/dreamweb/stubs.h | 27 ++++++------------------ 4 files changed, 53 insertions(+), 54 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index a451704c6a..1a730ac541 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -55,6 +55,10 @@ public: void input(); byte makeCaps(byte c); void delChar(); + void monMessage(uint8 index); + void netError(); + void monitorLogo(); + void randomAccess(uint16 count); void printOuterMon(); void showCurrentFile(); void accessLightOn(); @@ -155,6 +159,21 @@ public: void *getAnyAd(uint8 *value1, uint8 *value2); const uint8 *getTextInFile1(uint16 index); uint8 findNextColon(const uint8 **string); + uint16 allocateMem(uint16 paragraphs); + void deallocateMem(uint16 segment); + uint16 allocateAndLoad(unsigned int size); + uint16 standardLoad(const char *fileName, uint16 *outSizeInBytes = NULL); // Returns a segment handle which needs to be freed with deallocatemem for symmetry + void *standardLoadCPP(const char *fileName, uint16 *outSizeInBytes = NULL); // And this one should be 'free'd + void loadIntoTemp(const char *fileName); + void loadIntoTemp2(const char *fileName); + void loadIntoTemp3(const char *fileName); + void loadTempCharset(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(); + void useCharset1(); // from use.cpp void placeFreeObject(uint8 index); diff --git a/engines/dreamweb/monitor.cpp b/engines/dreamweb/monitor.cpp index 5d0987b29e..30ba9b88e0 100644 --- a/engines/dreamweb/monitor.cpp +++ b/engines/dreamweb/monitor.cpp @@ -165,7 +165,7 @@ bool DreamGenContext::execCommand() { -void DreamGenContext::monitorLogo() { +void DreamBase::monitorLogo() { if (data.byte(kLogonum) != data.byte(kOldlogonum)) { data.byte(kOldlogonum) = data.byte(kLogonum); printLogo(); @@ -283,10 +283,6 @@ void DreamBase::delCurs() { multiDump(x, y, width, height); } -void DreamGenContext::hangOnCurs() { - hangOnCurs(cx); -} - void DreamBase::scrollMonitor() { printLogo(); printUnderMon(); @@ -318,7 +314,7 @@ void DreamGenContext::randomAccess() { randomAccess(cx); } -void DreamGenContext::randomAccess(uint16 count) { +void DreamBase::randomAccess(uint16 count) { for (uint16 i = 0; i < count; ++i) { vSync(); vSync(); @@ -335,7 +331,7 @@ void DreamGenContext::monMessage() { monMessage(al); } -void DreamGenContext::monMessage(uint8 index) { +void DreamBase::monMessage(uint8 index) { assert(index > 0); const char *string = (const char *)getSegment(data.word(kTextfile1)).ptr(kTextstart, 0); for (uint8 i = 0; i < index; ++i) { @@ -345,7 +341,7 @@ void DreamGenContext::monMessage(uint8 index) { monPrint(string); } -void DreamGenContext::netError() { +void DreamBase::netError() { monMessage(5); scrollMonitor(); } diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index c365ee48d3..55e7916fc0 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -744,7 +744,7 @@ uint8 *DreamBase::textUnder() { return getSegment(data.word(kBuffers)).ptr(kTextunder, 0); } -uint16 DreamGenContext::standardLoad(const char *fileName, uint16 *outSizeInBytes) { +uint16 DreamBase::standardLoad(const char *fileName, uint16 *outSizeInBytes) { FileHeader header; Common::File file; @@ -758,7 +758,7 @@ uint16 DreamGenContext::standardLoad(const char *fileName, uint16 *outSizeInByte return result; } -void *DreamGenContext::standardLoadCPP(const char *fileName, uint16 *outSizeInBytes) { +void *DreamBase::standardLoadCPP(const char *fileName, uint16 *outSizeInBytes) { uint16 sizeInBytes; uint16 seg = standardLoad(fileName, &sizeInBytes); void *buffer = malloc(sizeInBytes); @@ -769,28 +769,24 @@ void *DreamGenContext::standardLoadCPP(const char *fileName, uint16 *outSizeInBy return buffer; } -void DreamGenContext::loadIntoTemp() { - loadIntoTemp((const char *)data.ptr(dx, 0)); -} - -void DreamGenContext::loadIntoTemp(const char *fileName) { +void DreamBase::loadIntoTemp(const char *fileName) { data.word(kTempgraphics) = standardLoad(fileName); } -void DreamGenContext::loadIntoTemp2(const char *fileName) { +void DreamBase::loadIntoTemp2(const char *fileName) { data.word(kTempgraphics2) = standardLoad(fileName); } -void DreamGenContext::loadIntoTemp3(const char *fileName) { +void DreamBase::loadIntoTemp3(const char *fileName) { data.word(kTempgraphics3) = standardLoad(fileName); } -void DreamGenContext::loadTempCharset() { - loadTempCharset((const char *)data.ptr(dx, 0)); +void DreamBase::loadTempCharset(const char *fileName) { + engine->setTempCharset(standardLoadCPP(fileName)); } -void DreamGenContext::loadTempCharset(const char *fileName) { - engine->setTempCharset(standardLoadCPP(fileName)); +void DreamGenContext::hangOnCurs() { + hangOnCurs(cx); } void DreamGenContext::hangOnCurs(uint16 frameCount) { @@ -970,22 +966,25 @@ void DreamGenContext::getTime() { data.byte(kHourcount) = ch; } -uint16 DreamGenContext::allocateMem(uint16 paragraphs) { +uint16 DreamBase::allocateMem(uint16 paragraphs) { uint size = (paragraphs + 2) * 16; debug(1, "allocate mem, %u bytes", size); - flags._c = false; SegmentRef seg = allocateSegment(size); uint16 result = (uint16)seg; debug(1, "\tsegment address -> %04x", result); return result; } -void DreamGenContext::deallocateMem(uint16 segment) { +void DreamBase::deallocateMem(uint16 segment) { debug(1, "deallocating segment %04x", segment); deallocateSegment(segment); - //fixing invalid entries in the sprite table - es = data; + + // FIXME: The following line used to be enabled with the comment: "fixing + // invalid entries in the sprite table" + // So if there are regressions with sprites, we may want to investigate this + // closer. +// es = data; uint tsize = 16 * 32; uint16 bseg = data.word(kBuffers); if (!bseg) @@ -1075,21 +1074,21 @@ void DreamGenContext::makeBackOb(SetObject *objData) { sprite->animFrame = 0; } -uint16 DreamGenContext::allocateAndLoad(unsigned int size) { +uint16 DreamBase::allocateAndLoad(unsigned int size) { // allocatemem adds 32 bytes, so it doesn't matter that size/16 rounds down uint16 result = allocateMem(size / 16); engine->readFromFile(getSegment(result).ptr(0, size), size); return result; } -void DreamGenContext::clearAndLoad(uint8 *buf, uint8 c, +void DreamBase::clearAndLoad(uint8 *buf, uint8 c, unsigned int size, unsigned int maxSize) { assert(size <= maxSize); memset(buf, c, maxSize); engine->readFromFile(buf, size); } -void DreamGenContext::clearAndLoad(uint16 seg, uint8 c, +void DreamBase::clearAndLoad(uint16 seg, uint8 c, unsigned int size, unsigned int maxSize) { assert(size <= maxSize); uint8 *buf = getSegment(seg).ptr(0, maxSize); @@ -2027,7 +2026,7 @@ void DreamGenContext::zoomOnOff() { workToScreenM(); } -void DreamGenContext::sortOutMap() { +void DreamBase::sortOutMap() { const uint8 *src = workspace(); uint8 *dst = (uint8 *)getSegment(data.word(kMapdata)).ptr(0, 0); for (uint16 y = 0; y < kMaplength; ++y) { @@ -2262,11 +2261,11 @@ void DreamGenContext::doLook() { workToScreenM(); } -void DreamGenContext::useCharset1() { +void DreamBase::useCharset1() { engine->setCurrentCharset((Frame *)getSegment(data.word(kCharset1)).ptr(0, 0)); } -void DreamGenContext::useTempCharset() { +void DreamBase::useTempCharset() { engine->setCurrentCharset(engine->tempCharset()); } @@ -2310,7 +2309,7 @@ void DreamGenContext::getRidOfAll() { } // if skipDat, skip clearing and loading Setdat and Freedat -void DreamGenContext::loadRoomData(const Room &room, bool skipDat) { +void DreamBase::loadRoomData(const Room &room, bool skipDat) { engine->openFile(room.name); FileHeader header; diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 481e784e4a..089272bb0b 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -27,16 +27,6 @@ void startup1(); void switchRyanOn(); void switchRyanOff(); - uint16 allocateMem(uint16 paragraphs); - void deallocateMem(uint16 segment); - uint16 standardLoad(const char *fileName, uint16 *outSizeInBytes = NULL); // Returns a segment handle which needs to be freed with deallocatemem for symmetry - void *standardLoadCPP(const char *fileName, uint16 *outSizeInBytes = NULL); // And this one should be 'free'd - void loadIntoTemp(); - void loadIntoTemp(const char *fileName); - void loadIntoTemp2(const char *fileName); - void loadIntoTemp3(const char *fileName); - void loadTempCharset(); - void loadTempCharset(const char *fileName); void saveLoad(); void hangOnCurs(uint16 frameCount); void hangOnCurs(); @@ -236,7 +226,6 @@ void getBlockOfPixel(); uint8 getBlockOfPixel(uint8 x, uint8 y); void examineObText(); - void sortOutMap(); void showCity(); uint16 getPersFrame(uint8 index); void convIcons(); @@ -274,11 +263,14 @@ const char *monPrint(const char *string) { return DreamBase::monPrint(string); } - void randomAccess(uint16 count); void randomAccess(); - void monMessage(uint8 index); + void randomAccess(uint16 count) { + DreamBase::randomAccess(count); + } void monMessage(); - void netError(); + void monMessage(uint8 index) { + DreamBase::monMessage(index); + } void playChannel1(); void playChannel1(uint8 index) { DreamBase::playChannel1(index); @@ -291,8 +283,6 @@ void look(); void autoLook(); void doLook(); - void useTempCharset(); - void useCharset1(); void getBackFromOb(); void getRidOfAll(); void getRidOfTemp(); @@ -307,10 +297,6 @@ void actualLoad(); void loadPosition(unsigned int slot); void savePosition(unsigned int slot, const char *descbuf); - uint16 allocateAndLoad(unsigned int size); - void clearAndLoad(uint8 *buf, uint8 c, unsigned int size, unsigned int maxSize); - void clearAndLoad(uint16 seg, uint8 c, unsigned int size, unsigned int maxSize); - void loadRoomData(const Room &room, bool skipDat); void restoreAll(); void restoreReels(); void enterSymbol(); @@ -570,7 +556,6 @@ void hangOnPQ(); void showGun(); void endGame(); - void monitorLogo(); void quitSymbol(); void diaryKeyP(); void diaryKeyN(); -- cgit v1.2.3 From cf77cc922d8efdb95c9f0f8e20bc3773d0788206 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 14 Dec 2011 18:08:46 +0100 Subject: TSAGE: R2R - Implement scene 2600 --- engines/tsage/ringworld2/ringworld2_logic.cpp | 2 ++ engines/tsage/ringworld2/ringworld2_scenes2.cpp | 41 +++++++++++++++++++++++++ engines/tsage/ringworld2/ringworld2_scenes2.h | 12 ++++++++ 3 files changed, 55 insertions(+) (limited to 'engines') diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index ef1cb76c91..b93e9c202a 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -147,6 +147,8 @@ Scene *Ringworld2Game::createScene(int sceneNumber) { // Maze: Tannery return new Scene2535(); case 2600: + // Maze: Exit + return new Scene2600(); case 2700: case 2750: case 2800: diff --git a/engines/tsage/ringworld2/ringworld2_scenes2.cpp b/engines/tsage/ringworld2/ringworld2_scenes2.cpp index d820784c45..b2e7b46420 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes2.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes2.cpp @@ -2983,5 +2983,46 @@ void Scene2535::signal() { } } +/*-------------------------------------------------------------------------- + * Scene 2600 - Maze: Exit + * + *--------------------------------------------------------------------------*/ +Scene2600::Scene2600(): SceneExt() { + _rotation = NULL; +} + +void Scene2600::synchronize(Serializer &s) { + SceneExt::synchronize(s); + + SYNC_POINTER(_rotation); +} + +void Scene2600::postInit(SceneObjectList *OwnerList) { + loadScene(2600); + R2_GLOBALS._v58CE2 = 0; + SceneExt::postInit(); + R2_GLOBALS._sound1.fadeSound(214); + R2_GLOBALS._sound2.play(215); + _rotation = R2_GLOBALS._scenePalette.addRotation(176, 191, 1); + _rotation->setDelay(3); + _rotation->_countdown = 1; + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.disableControl(); + _sceneMode = 2600; + R2_GLOBALS._player.setAction(&_sequenceManager, this, 2600, &R2_GLOBALS._player, NULL); +} + +void Scene2600::remove() { + R2_GLOBALS._sound1.fadeOut2(NULL); + R2_GLOBALS._sound2.fadeOut2(NULL); +// _rotation->remove(); + SceneExt::remove(); +} + +void Scene2600::signal() { + if (_sceneMode == 2600) + g_globals->_sceneManager.changeScene(3800); +} + } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_scenes2.h b/engines/tsage/ringworld2/ringworld2_scenes2.h index e655d1e8a8..8684078860 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes2.h +++ b/engines/tsage/ringworld2/ringworld2_scenes2.h @@ -478,6 +478,18 @@ public: virtual void signal(); }; +class Scene2600 : public SceneExt { +public: + SequenceManager _sequenceManager; + PaletteRotation *_rotation; + + Scene2600(); + virtual void synchronize(Serializer &s); + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void remove(); + virtual void signal(); +}; + } // End of namespace Ringworld2 } // End of namespace TsAGE -- cgit v1.2.3 From ea8b6c8c6dd43ed0c645927966e4150cc987b5c6 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 15 Dec 2011 00:11:12 +0200 Subject: DREAMWEB: Port 'findsetobject' and 'findexobject' to C++ and simplify compare() --- engines/dreamweb/dreamgen.cpp | 66 ------------------------------ engines/dreamweb/dreamgen.h | 2 - engines/dreamweb/stubs.cpp | 62 +++++++++++++++++++++++----- engines/dreamweb/stubs.h | 4 ++ engines/dreamweb/use.cpp | 94 ++++++++++++++----------------------------- 5 files changed, 87 insertions(+), 141 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 3831f386db..fb232ceabc 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -3630,72 +3630,6 @@ doselob: useRoutine(); } -void DreamGenContext::findSetObject() { - STACK_CHECK; - _sub(al, 'A'); - _sub(ah, 'A'); - _sub(cl, 'A'); - _sub(ch, 'A'); - es = data.word(kSetdat); - bx = 0; - dl = 0; -findsetloop: - _cmp(al, es.byte(bx+12)); - if (!flags.z()) - goto nofind; - _cmp(ah, es.byte(bx+13)); - if (!flags.z()) - goto nofind; - _cmp(cl, es.byte(bx+14)); - if (!flags.z()) - goto nofind; - _cmp(ch, es.byte(bx+15)); - if (!flags.z()) - goto nofind; - al = dl; - return; -nofind: - _add(bx, 64); - _inc(dl); - _cmp(dl, 128); - if (!flags.z()) - goto findsetloop; - al = dl; -} - -void DreamGenContext::findExObject() { - STACK_CHECK; - _sub(al, 'A'); - _sub(ah, 'A'); - _sub(cl, 'A'); - _sub(ch, 'A'); - es = data.word(kExtras); - bx = (0+2080+30000); - dl = 0; -findexloop: - _cmp(al, es.byte(bx+12)); - if (!flags.z()) - goto nofindex; - _cmp(ah, es.byte(bx+13)); - if (!flags.z()) - goto nofindex; - _cmp(cl, es.byte(bx+14)); - if (!flags.z()) - goto nofindex; - _cmp(ch, es.byte(bx+15)); - if (!flags.z()) - goto nofindex; - al = dl; - return; -nofindex: - _add(bx, 16); - _inc(dl); - _cmp(dl, (114)); - if (!flags.z()) - goto findexloop; - al = dl; -} - void DreamGenContext::isRyanHolding() { STACK_CHECK; _sub(al, 'A'); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 8d23f9768e..2a8a6c613e 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -537,7 +537,6 @@ public: void lookAtPlace(); void findAllOpen(); void showSlots(); - void findSetObject(); void deleteExObject(); void helicopter(); void getEitherAd(); @@ -562,7 +561,6 @@ public: void useGun(); void useHandle(); void incRyanPage(); - void findExObject(); void clearChanges(); void searchForFiles(); void getExAd(); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 55e7916fc0..21173f8e3b 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -1755,19 +1755,64 @@ void DreamGenContext::printMessage(uint16 x, uint16 y, uint8 index, uint8 maxWid printDirect(&string, x, &y, maxWidth, centered); } +bool objectMatches(void *object, const char *id) { + const char *objId = (const char *)(((const uint8 *)object) + 12); // whether it is a DynObject or a SetObject + for (size_t i = 0; i < 4; ++i) { + if (id[i] != objId[i] + 'A') + return false; + } + return true; +} + void DreamGenContext::compare() { char id[4] = { cl, ch, dl, dh }; flags._z = compare(al, ah, id); } bool DreamGenContext::compare(uint8 index, uint8 flag, const char id[4]) { - void *ptr = getAnyAdDir(index, flag); - const char *objId = (const char *)(((const uint8 *)ptr) + 12); // whether it is a DynObject or a SetObject - for (size_t i = 0; i < 4; ++i) { - if (id[i] != objId[i] + 'A') - return false; - } - return true; + return objectMatches(getAnyAdDir(index, flag), id); +} + +void DreamGenContext::findSetObject() { + char id[5]; + id[0] = al; + id[1] = ah; + id[2] = cl; + id[3] = ch; + id[4] = '\0'; + al = findSetObject(id); +} + +uint16 DreamGenContext::findSetObject(const char *id) { + uint16 index = 0; + + do { + if (objectMatches(getSetAd(index), id)) + return index; + } while (index++ < 128); + + return index; // 128, not found +} + +void DreamGenContext::findExObject() { + char id[5]; + id[0] = al; + id[1] = ah; + id[2] = cl; + id[3] = ch; + id[4] = '\0'; + al = findExObject(id); +} + +uint16 DreamGenContext::findExObject(const char *id) { + uint16 index = 0; + + do { + if (objectMatches(getExAd(index), id)) + return index; + } while (index++ < 114); + + return index; // 114, not found } bool DreamGenContext::isItDescribed(const ObjPos *pos) { @@ -3344,8 +3389,7 @@ void DreamGenContext::openInv() { } void DreamGenContext::obsThatDoThings() { - char id[4] = { 'M', 'E', 'M', 'B' }; // TODO: convert to string with trailing zero - if (!compare(data.byte(kCommand), data.byte(kObjecttype), id)) + if (!compare(data.byte(kCommand), data.byte(kObjecttype), "MEMB")) return; // notlouiscard if (DreamBase::getLocation(4) != 1) { diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 089272bb0b..6764c18beb 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -582,5 +582,9 @@ void runEndSeq(); void lookAtCard(); bool execCommand(); + void findSetObject(); + uint16 findSetObject(const char *id); + void findExObject(); + uint16 findExObject(const char *id); #endif diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp index 599cdf7334..f5d631aed5 100644 --- a/engines/dreamweb/use.cpp +++ b/engines/dreamweb/use.cpp @@ -747,8 +747,7 @@ bool DreamGenContext::defaultUseHandler(const char *id) { } void DreamGenContext::useChurchGate() { - char id[4] = { 'C', 'U', 'T', 'T' }; // TODO: convert to string with trailing zero - if (defaultUseHandler(id)) + if (defaultUseHandler("CUTT")) return; // Cut gate @@ -784,8 +783,7 @@ void DreamGenContext::useFullCart() { } void DreamGenContext::useClearBox() { - char id[4] = { 'R', 'A', 'I', 'L' }; // TODO: convert to string with trailing zero - if (defaultUseHandler(id)) + if (defaultUseHandler("RAIL")) return; // Open box @@ -800,8 +798,7 @@ void DreamGenContext::useClearBox() { } void DreamGenContext::openTVDoor() { - char id[4] = { 'U', 'L', 'O', 'K' }; // TODO: convert to string with trailing zero - if (defaultUseHandler(id)) + if (defaultUseHandler("ULOK")) return; // Key on TV @@ -816,9 +813,7 @@ void DreamGenContext::usePlate() { return; } - char screw[4] = { 'S', 'C', 'R', 'W' }; // TODO: convert to string with trailing zero - char knife[4] = { 'K', 'N', 'F', 'E' }; // TODO: convert to string with trailing zero - if (compare(data.byte(kWithobject), data.byte(kWithtype), screw)) { + if (compare(data.byte(kWithobject), data.byte(kWithtype), "SCRW")) { // Unscrew plate playChannel1(20); showFirstUse(); @@ -828,7 +823,7 @@ void DreamGenContext::usePlate() { placeFreeObject(0); data.byte(kProgresspoints)++; data.byte(kGetback) = 1; - } else if (compare(data.byte(kWithobject), data.byte(kWithtype), knife)) { + } else if (compare(data.byte(kWithobject), data.byte(kWithtype), "KNFE")) { // Tried knife showPuzText(54, 300); putBackObStuff(); @@ -845,8 +840,7 @@ void DreamGenContext::usePlinth() { return; } - char id[4] = { 'D', 'K', 'E', 'Y' }; // TODO: convert to string with trailing zero - if (!compare(data.byte(kWithobject), data.byte(kWithtype), id)) { + if (!compare(data.byte(kWithobject), data.byte(kWithtype), "DKEY")) { // Wrong key showFirstUse(); putBackObStuff(); @@ -864,8 +858,7 @@ void DreamGenContext::usePlinth() { } void DreamGenContext::useElvDoor() { - char id[4] = { 'A', 'X', 'E', 'D' }; // TODO: convert to string with trailing zero - if (defaultUseHandler(id)) + if (defaultUseHandler("AXED")) return; // Axe on door @@ -899,8 +892,7 @@ void DreamGenContext::useWinch() { ah = 1; checkInside(); - char id[4] = { 'F', 'U', 'S', 'E' }; // TODO: convert to string with trailing zero - if (cl == kNumexobjects || !compare(cl, 4, id)) { + if (cl == kNumexobjects || !compare(cl, 4, "FUSE")) { // No winch showFirstUse(); putBackObStuff(); @@ -923,8 +915,7 @@ void DreamGenContext::useWinch() { } void DreamGenContext::useCart() { - char id[4] = { 'R', 'O', 'C', 'K' }; // TODO: convert to string with trailing zero - if (defaultUseHandler(id)) + if (defaultUseHandler("ROCK")) return; DynObject *exObject = getExAd(data.byte(kWithobject)); @@ -959,8 +950,7 @@ void DreamGenContext::chewy() { } void DreamGenContext::useHole() { - char id[4] = { 'H', 'N', 'D', 'A' }; // TODO: convert to string with trailing zero - if (defaultUseHandler(id)) + if (defaultUseHandler("HNDA")) return; showFirstUse(); @@ -972,8 +962,7 @@ void DreamGenContext::useHole() { } void DreamGenContext::openHotelDoor() { - char id[4] = { 'K', 'E', 'Y', 'A' }; // TODO: convert to string with trailing zero - if (defaultUseHandler(id)) + if (defaultUseHandler("KEYA")) return; playChannel1(16); @@ -983,8 +972,7 @@ void DreamGenContext::openHotelDoor() { } void DreamGenContext::openHotelDoor2() { - char id[4] = { 'K', 'E', 'Y', 'A' }; // TODO: convert to string with trailing zero - if (defaultUseHandler(id)) + if (defaultUseHandler("KEYA")) return; playChannel1(16); @@ -993,8 +981,7 @@ void DreamGenContext::openHotelDoor2() { } void DreamGenContext::grafittiDoor() { - char id[4] = { 'A', 'P', 'E', 'N' }; // TODO: convert to string with trailing zero - if (defaultUseHandler(id)) + if (defaultUseHandler("APEN")) return; showFirstUse(); @@ -1002,8 +989,7 @@ void DreamGenContext::grafittiDoor() { } void DreamGenContext::usePoolReader() { - char id[4] = { 'M', 'E', 'M', 'B' }; // TODO: convert to string with trailing zero - if (defaultUseHandler(id)) + if (defaultUseHandler("MEMB")) return; if (data.byte(kTalkedtoattendant) != 1) { @@ -1019,8 +1005,7 @@ void DreamGenContext::usePoolReader() { } void DreamGenContext::useCardReader1() { - char id[4] = { 'C', 'S', 'H', 'R' }; // TODO: convert to string with trailing zero - if (defaultUseHandler(id)) + if (defaultUseHandler("CSHR")) return; if (data.byte(kTalkedtosparky) == 0) { @@ -1042,8 +1027,7 @@ void DreamGenContext::useCardReader1() { } void DreamGenContext::useCardReader2() { - char id[4] = { 'C', 'S', 'H', 'R' }; // TODO: convert to string with trailing zero - if (defaultUseHandler(id)) + if (defaultUseHandler("CSHR")) return; if (data.byte(kTalkedtoboss) == 0) { @@ -1070,8 +1054,7 @@ void DreamGenContext::useCardReader2() { } void DreamGenContext::useCardReader3() { - char id[4] = { 'C', 'S', 'H', 'R' }; // TODO: convert to string with trailing zero - if (defaultUseHandler(id)) + if (defaultUseHandler("CSHR")) return; if (data.byte(kTalkedtorecep) == 0) { @@ -1098,8 +1081,7 @@ void DreamGenContext::useLighter() { return; } - char id[4] = { 'S', 'M', 'K', 'E' }; // TODO: convert to string with trailing zero - if (!compare(data.byte(kWithobject), data.byte(kWithtype), id)) { + if (!compare(data.byte(kWithobject), data.byte(kWithtype), "SMKE")) { showFirstUse(); putBackObStuff(); } else { @@ -1116,8 +1098,7 @@ void DreamGenContext::useWire() { return; } - char knife[4] = { 'K', 'N', 'F', 'E' }; // TODO: convert to string with trailing zero - if (compare(data.byte(kWithobject), data.byte(kWithtype), knife)) { + if (compare(data.byte(kWithobject), data.byte(kWithtype), "KNFE")) { removeSetObject(51); placeSetObject(52); showPuzText(11, 300); @@ -1126,8 +1107,7 @@ void DreamGenContext::useWire() { return; } - char axe[4] = { 'A', 'X', 'E', 'D' }; // TODO: convert to string with trailing zero - if (compare(data.byte(kWithobject), data.byte(kWithtype), axe)) { + if (compare(data.byte(kWithobject), data.byte(kWithtype), "AXED")) { showPuzText(16, 300); putBackObStuff(); return; @@ -1231,8 +1211,7 @@ void DreamGenContext::useControl() { return; } - char key[4] = { 'K', 'E', 'Y', 'A' }; // TODO: convert to string with trailing zero - if (compare(data.byte(kWithobject), data.byte(kWithtype), key)) { // Right key + if (compare(data.byte(kWithobject), data.byte(kWithtype), "KEYA")) { // Right key playChannel1(16); if (data.byte(kLocation) == 21) { // Going down showPuzText(3, 300); @@ -1250,10 +1229,7 @@ void DreamGenContext::useControl() { } if (data.byte(kReallocation) == 21) { - char knife[4] = { 'K', 'N', 'F', 'E' }; // TODO: convert to string with trailing zero - char axe[4] = { 'A', 'X', 'E', 'D' }; // TODO: convert to string with trailing zero - - if (compare(data.byte(kWithobject), data.byte(kWithtype), knife)) { + if (compare(data.byte(kWithobject), data.byte(kWithtype), "KNFE")) { // Jimmy controls placeSetObject(50); placeSetObject(51); @@ -1265,7 +1241,7 @@ void DreamGenContext::useControl() { showPuzText(10, 300); data.byte(kProgresspoints)++; data.byte(kGetback) = 1; - } else if (compare(data.byte(kWithobject), data.byte(kWithtype), axe)) { + } else if (compare(data.byte(kWithobject), data.byte(kWithtype), "AXED")) { // Axe on controls showPuzText(16, 300); data.byte(kProgresspoints)++; @@ -1288,8 +1264,7 @@ void DreamGenContext::useSLab() { return; } - char id[4] = { 'J', 'E', 'W', 'L' }; // TODO: convert to string with trailing zero - if (!compare(data.byte(kWithobject), data.byte(kWithtype), id)) { + if (!compare(data.byte(kWithobject), data.byte(kWithtype), "JEWL")) { showPuzText(14, 300); putBackObStuff(); return; @@ -1321,17 +1296,14 @@ void DreamGenContext::usePipe() { return; } - char cupEmpty[4] = { 'C', 'U', 'P', 'E' }; // TODO: convert to string with trailing zero - char cupFull[4] = { 'C', 'U', 'P', 'F' }; // TODO: convert to string with trailing zero - - if (compare(data.byte(kWithobject), data.byte(kWithtype), cupEmpty)) { + if (compare(data.byte(kWithobject), data.byte(kWithtype), "CUPE")) { // Fill cup showPuzText(36, 300); putBackObStuff(); DynObject *exObject = getExAd(data.byte(kWithobject)); exObject->id[3] = 'F'-'A'; // CUPE (empty cup) -> CUPF (full cup) return; - } else if (compare(data.byte(kWithobject), data.byte(kWithtype), cupFull)) { + } else if (compare(data.byte(kWithobject), data.byte(kWithtype), "CUPF")) { // Already full showPuzText(35, 300); putBackObStuff(); @@ -1348,10 +1320,7 @@ void DreamGenContext::useOpenBox() { return; } - char cupEmpty[4] = { 'C', 'U', 'P', 'E' }; // TODO: convert to string with trailing zero - char cupFull[4] = { 'C', 'U', 'P', 'F' }; // TODO: convert to string with trailing zero - - if (compare(data.byte(kWithobject), data.byte(kWithtype), cupFull)) { + if (compare(data.byte(kWithobject), data.byte(kWithtype), "CUPF")) { // Destroy open box data.byte(kProgresspoints)++; showPuzText(37, 300); @@ -1367,7 +1336,7 @@ void DreamGenContext::useOpenBox() { return; } - if (compare(data.byte(kWithobject), data.byte(kWithtype), cupEmpty)) { + if (compare(data.byte(kWithobject), data.byte(kWithtype), "CUPE")) { // Open box wrong showPuzText(38, 300); putBackObStuff(); @@ -1383,10 +1352,7 @@ void DreamGenContext::runTap() { return; } - char cupEmpty[4] = { 'C', 'U', 'P', 'E' }; // TODO: convert to string with trailing zero - char cupFull[4] = { 'C', 'U', 'P', 'F' }; // TODO: convert to string with trailing zero - - if (compare(data.byte(kWithobject), data.byte(kWithtype), cupEmpty)) { + if (compare(data.byte(kWithobject), data.byte(kWithtype), "CUPE")) { // Fill cup from tap DynObject *exObject = getExAd(data.byte(kWithobject)); exObject->id[3] = 'F'-'A'; // CUPE (empty cup) -> CUPF (full cup) @@ -1396,7 +1362,7 @@ void DreamGenContext::runTap() { return; } - if (compare(data.byte(kWithobject), data.byte(kWithtype), cupFull)) { + if (compare(data.byte(kWithobject), data.byte(kWithtype), "CUPF")) { // Cup from tap full showPuzText(58, 300); putBackObStuff(); -- cgit v1.2.3 From f0b0f25bd6165becd995aedd09cf46de6db3bbba Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 15 Dec 2011 00:18:27 +0200 Subject: DREAMWEB: Properly set bx in findSetObject() and findExObject() --- engines/dreamweb/stubs.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'engines') diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 21173f8e3b..a3acfe8e37 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -1781,6 +1781,7 @@ void DreamGenContext::findSetObject() { id[3] = ch; id[4] = '\0'; al = findSetObject(id); + bx = al * 64; } uint16 DreamGenContext::findSetObject(const char *id) { @@ -1802,6 +1803,7 @@ void DreamGenContext::findExObject() { id[3] = ch; id[4] = '\0'; al = findExObject(id); + bx = al * 16; } uint16 DreamGenContext::findExObject(const char *id) { -- cgit v1.2.3 From 509755a010967cc685001762b11996cc73891015 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 15 Dec 2011 00:30:31 +0200 Subject: DREAMWEB: Further simplification of findSetObject() and findExObject() (thanks wjp) --- engines/dreamweb/stubs.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index a3acfe8e37..01169a81df 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -1785,14 +1785,12 @@ void DreamGenContext::findSetObject() { } uint16 DreamGenContext::findSetObject(const char *id) { - uint16 index = 0; - - do { + for (uint16 index = 0; index < 128; index++) { if (objectMatches(getSetAd(index), id)) return index; - } while (index++ < 128); + } - return index; // 128, not found + return 128; } void DreamGenContext::findExObject() { @@ -1807,14 +1805,12 @@ void DreamGenContext::findExObject() { } uint16 DreamGenContext::findExObject(const char *id) { - uint16 index = 0; - - do { + for (uint16 index = 0; index < kNumexobjects; index++) { if (objectMatches(getExAd(index), id)) return index; - } while (index++ < 114); + } - return index; // 114, not found + return kNumexobjects; } bool DreamGenContext::isItDescribed(const ObjPos *pos) { -- cgit v1.2.3 From dd8304dd75e051460b96414ab3abac865a5af6e2 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 15 Dec 2011 00:43:08 +0200 Subject: DREAMWEB: Port 'usehandle', 'usealtar' to C++ --- engines/dreamweb/dreamgen.cpp | 71 ------------------------------------------- engines/dreamweb/dreamgen.h | 2 -- engines/dreamweb/stubs.h | 2 ++ engines/dreamweb/use.cpp | 39 ++++++++++++++++++++++++ 4 files changed, 41 insertions(+), 73 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index fb232ceabc..a33f5a27fc 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -3306,53 +3306,6 @@ void DreamGenContext::notHeldError() { putBackObStuff(); } -void DreamGenContext::useAltar() { - STACK_CHECK; - al = 'C'; - ah = 'N'; - cl = 'D'; - ch = 'A'; - findExObject(); - _cmp(al, (114)); - if (flags.z()) - goto thingsonaltar; - al = 'C'; - ah = 'N'; - cl = 'D'; - ch = 'B'; - findExObject(); - _cmp(al, (114)); - if (flags.z()) - goto thingsonaltar; - _cmp(data.byte(kCanmovealtar), 1); - if (flags.z()) - goto movealtar; - cx = 300; - al = 23; - showPuzText(); - data.byte(kGetback) = 1; - return; -movealtar: - _inc(data.byte(kProgresspoints)); - showSecondUse(); - data.word(kWatchingtime) = 160; - data.word(kReeltowatch) = 81; - data.word(kEndwatchreel) = 174; - data.byte(kWatchspeed) = 1; - data.byte(kSpeedcount) = 1; - al = 47; - bl = 52; - bh = 76; - cx = 32; - dx = 98; - setupTimedUse(); - data.byte(kGetback) = 1; - return; -thingsonaltar: - showFirstUse(); - data.byte(kGetback) = 1; -} - void DreamGenContext::nextColon() { STACK_CHECK; lookcolon: @@ -3463,30 +3416,6 @@ numberpoke3: cs.byte(bx) = al; } -void DreamGenContext::useHandle() { - STACK_CHECK; - al = 'C'; - ah = 'U'; - cl = 'T'; - ch = 'W'; - findSetObject(); - al = es.byte(bx+58); - _cmp(al, 255); - if (!flags.z()) - goto havecutwire; - cx = 300; - al = 12; - showPuzText(); - data.byte(kGetback) = 1; - return; -havecutwire: - cx = 300; - al = 13; - showPuzText(); - data.byte(kNewlocation) = 22; - data.byte(kGetback) = 1; -} - void DreamGenContext::useStereo() { STACK_CHECK; _cmp(data.byte(kLocation), 0); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 2a8a6c613e..c1829ec4c2 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -500,7 +500,6 @@ public: void dirCom(); void endGameSeq(); void findFirstPath(); - void useAltar(); void startTalk(); void getAnyAd(); void reminders(); @@ -559,7 +558,6 @@ public: void searchForString(); void selectOpenOb(); void useGun(); - void useHandle(); void incRyanPage(); void clearChanges(); void searchForFiles(); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 6764c18beb..16d7e67d5c 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -345,6 +345,8 @@ void useCooker(); void useWire(); void useControl(); + void useHandle(); + void useAltar(); bool defaultUseHandler(const char *id); void openTVDoor(); void wearWatch(); diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp index f5d631aed5..5306522c13 100644 --- a/engines/dreamweb/use.cpp +++ b/engines/dreamweb/use.cpp @@ -1434,4 +1434,43 @@ void DreamGenContext::useKey() { } } +void DreamGenContext::useHandle() { + SetObject *object = getSetAd(findSetObject("CUTW")); + if (object->mapad[0] == 255) { + // Wire not cut + showPuzText(12, 300); + } else { + // Wire has been cut + showPuzText(13, 300); + data.byte(kNewlocation) = 22; + } + + data.byte(kGetback) = 1; +} + +void DreamGenContext::useAltar() { + if (findExObject("CNDA") == 114 || findExObject("CNDB") == 114) { + // Things on altar + showFirstUse(); + data.byte(kGetback) = 1; + return; + } + + if (data.byte(kCanmovealtar) == 1) { + // Move altar + data.byte(kProgresspoints)++; + showSecondUse(); + data.word(kWatchingtime) = 160; + data.word(kReeltowatch) = 81; + data.word(kEndwatchreel) = 174; + data.byte(kWatchspeed) = 1; + data.byte(kSpeedcount) = 1; + DreamBase::setupTimedUse(47, 32, 98, 52, 76); + data.byte(kGetback) = 1; + } else { + showPuzText(23, 300); + data.byte(kGetback) = 1; + } +} + } // End of namespace DreamGen -- cgit v1.2.3 From 45794d1b829c1015f1d79205f2a4b28a811a036a Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 15 Dec 2011 02:09:17 +0200 Subject: DREAMWEB: Port 'describeob', 'additionaltext' to C++ --- engines/dreamweb/dreamgen.cpp | 80 ------------------------------------------- engines/dreamweb/dreamgen.h | 2 -- engines/dreamweb/stubs.cpp | 28 ++++++++++++++- engines/dreamweb/stubs.h | 1 + 4 files changed, 28 insertions(+), 83 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index a33f5a27fc..b882f9f1ea 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -1046,86 +1046,6 @@ void DreamGenContext::openOb() { cs.word(bx) = ax; } -void DreamGenContext::describeOb() { - STACK_CHECK; - getObTextStart(); - di = 33; - bx = 92; - _cmp(data.byte(kForeignrelease), 0); - if (flags.z()) - goto notsetd; - _cmp(data.byte(kObjecttype), 1); - if (!flags.z()) - goto notsetd; - bx = 82; -notsetd: - dl = 241; - ah = 16; - data.word(kCharshift) = 91+91; - printDirect(); - data.word(kCharshift) = 0; - di = 36; - bx = 104; - _cmp(data.byte(kForeignrelease), 0); - if (flags.z()) - goto notsetd2; - _cmp(data.byte(kObjecttype), 1); - if (!flags.z()) - goto notsetd2; - bx = 94; -notsetd2: - dl = 241; - ah = 0; - printDirect(); - push(bx); - obsThatDoThings(); - bx = pop(); - additionalText(); -} - -void DreamGenContext::additionalText() { - STACK_CHECK; - _add(bx, 10); - push(bx); - al = data.byte(kCommand); - ah = data.byte(kObjecttype); - cl = 'C'; - ch = 'U'; - dl = 'P'; - dh = 'E'; - compare(); - if (flags.z()) - goto emptycup; - al = data.byte(kCommand); - ah = data.byte(kObjecttype); - cl = 'C'; - ch = 'U'; - dl = 'P'; - dh = 'F'; - compare(); - if (flags.z()) - goto fullcup; - bx = pop(); - return; -emptycup: - al = 40; - findPuzText(); - bx = pop(); - di = 36; - dl = 241; - ah = 0; - printDirect(); - return; -fullcup: - al = 39; - findPuzText(); - bx = pop(); - di = 36; - dl = 241; - ah = 0; - printDirect(); -} - void DreamGenContext::getObTextStart() { STACK_CHECK; es = data.word(kFreedesc); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index c1829ec4c2..d1a9471f4f 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -528,7 +528,6 @@ public: void showKeys(); void printmessage2(); void findOpenPos(); - void describeOb(); void deleteExFrame(); void searchForSame(); void rollEm(); @@ -553,7 +552,6 @@ public: void findPathOfPoint(); void getDestInfo(); void read(); - void additionalText(); void mugger(); void searchForString(); void selectOpenOb(); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 01169a81df..e721d482db 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -3396,6 +3396,33 @@ void DreamGenContext::obsThatDoThings() { } } +void DreamGenContext::describeOb() { + const uint8 *obText = getObTextStartCPP(); + uint16 y = 92; + if (data.byte(kForeignrelease) && data.byte(kObjecttype) == 1) + y = 82; + data.word(kCharshift) = 91 + 91; + printDirect(obText, 33, y, 241, 241 & 1); + data.word(kCharshift) = 0; + if (data.byte(kForeignrelease) && data.byte(kObjecttype) == 1) + y = 94; + printDirect(obText, 36, y, 241, 241 & 1); + obsThatDoThings(); + + // Additional text + if (compare(data.byte(kCommand), data.byte(kObjecttype), "CUPE")) { + // Empty cup + uint16 offset = kTextstart + getSegment(data.word(kPuzzletext)).word(40 * 2); + const uint8 *string = getSegment(data.word(kPuzzletext)).ptr(offset, 0); + printDirect(string, 36, y + 10, 241, 241 & 1); + } else if (compare(data.byte(kCommand), data.byte(kObjecttype), "CUPF")) { + // Full cup + uint16 offset = kTextstart + getSegment(data.word(kPuzzletext)).word(39 * 2); + const uint8 *string = getSegment(data.word(kPuzzletext)).ptr(offset, 0); + printDirect(string, 36, y + 10, 241, 241 & 1); + } +} + void DreamGenContext::delEverything() { if (data.byte(kMapysize) + data.word(kMapoffsety) < 182) { mapToPanel(); @@ -4272,7 +4299,6 @@ void DreamGenContext::showPuzText() { } void DreamGenContext::showPuzText(uint16 command, uint16 count) { - findPuzText(); // FIXME: Unnecessary? (Input: al, Output: es:si) createPanel(); showPanel(); showMan(); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 16d7e67d5c..3413c5eef0 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -588,5 +588,6 @@ uint16 findSetObject(const char *id); void findExObject(); uint16 findExObject(const char *id); + void describeOb(); #endif -- cgit v1.2.3 From f87227dcd329baade142c89df859d434b174655f Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 15 Dec 2011 02:14:21 +0200 Subject: DREAMWEB: 'keypadax', 'keypadcx' are no longer needed --- engines/dreamweb/dreamgen.cpp | 218 ++++++++++++++++----------------- engines/dreamweb/dreamgen.h | 276 +++++++++++++++++++++--------------------- 2 files changed, 246 insertions(+), 248 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index b882f9f1ea..6f8cff0ff1 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -2651,14 +2651,14 @@ void DreamGenContext::getDestInfo() { push(ax); dx = data; es = dx; - si = 1184; + si = 1180; _add(si, ax); cl = es.byte(si); ax = pop(); push(cx); dx = data; es = dx; - si = 1200; + si = 1196; _add(si, ax); ax = pop(); } @@ -2710,7 +2710,7 @@ clearedlocations: bx = ax; dx = data; es = dx; - _add(bx, 1184); + _add(bx, 1180); es.byte(bx) = 0; } @@ -2749,7 +2749,7 @@ dirroot: si = offset_rootdir; _inc(si); es = cs; - di = 1060; + di = 1056; _inc(di); cx = 12; _movsb(cx, true); @@ -2851,7 +2851,7 @@ notyetassigned: push(bx); _add(bx, 2); ds = cs; - si = 1218; + si = 1214; checkpass: _lodsw(); ah = es.byte(bx); @@ -2922,7 +2922,7 @@ void DreamGenContext::read() { return; okcom: es = cs; - di = 1060; + di = 1056; ax = data.word(kTextfile1); data.word(kMonsource) = ax; ds = ax; @@ -3052,7 +3052,7 @@ keyok2: ds = cs; si = offset_operand1+1; es = cs; - di = 1060+1; + di = 1056+1; cx = 12; _movsb(cx, true); monitorLogo(); @@ -3179,7 +3179,7 @@ void DreamGenContext::parser() { al = '='; _stosb(); ds = cs; - si = 1218; + si = 1214; notspace1: _lodsw(); _cmp(al, 32); @@ -3808,7 +3808,7 @@ nomatchslot: void DreamGenContext::clearBuffers() { STACK_CHECK; es = data.word(kBuffers); - cx = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+911-454+68-0)/2; + cx = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+907-450+68-0)/2; ax = 0; di = 0; _stosw(cx, true); @@ -3820,11 +3820,11 @@ void DreamGenContext::clearBuffers() { es = data.word(kBuffers); di = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)); ds = cs; - si = 454; - cx = (911-454); + si = 450; + cx = (907-450); _movsb(cx, true); es = data.word(kBuffers); - di = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+911-454); + di = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+907-450); ds = cs; si = 0; cx = (68-0); @@ -3842,11 +3842,11 @@ void DreamGenContext::clearChanges() { ds = data.word(kBuffers); si = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)); es = cs; - di = 454; - cx = (911-454); + di = 450; + cx = (907-450); _movsb(cx, true); ds = data.word(kBuffers); - si = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+911-454); + si = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+907-450); es = cs; di = 0; cx = (68-0); @@ -3860,7 +3860,7 @@ void DreamGenContext::clearChanges() { di = 0; _stosw(cx, true); es = cs; - di = 1184; + di = 1180; al = 1; _stosb(2); al = 0; @@ -4099,111 +4099,111 @@ void DreamGenContext::__start() { //0x0150: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0160: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //0x0170: .... .... .... .... 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //0x0180: .... .... .... .... 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //0x0190: .... .... .... .... - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xff, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x01a0: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, //0x01b0: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x01, 0x2c, 0x00, 0x14, 0x00, 0x02, 0x00, 0x01, 0x01, 0x37, - //0x01c0: .... ..., .... ...7 - 0x00, 0x00, 0x00, 0x32, 0x14, 0x00, 0x18, 0x16, 0x00, 0x4a, 0x00, 0x01, 0x00, 0x00, 0x18, 0x21, - //0x01d0: ...2 .... .J.. ...! - 0x0a, 0x4b, 0x00, 0x01, 0x00, 0x01, 0x01, 0x2c, 0x00, 0x1b, 0x00, 0x02, 0x00, 0x02, 0x01, 0x2c, - //0x01e0: .K.. ..., .... ..., - 0x00, 0x60, 0x00, 0x03, 0x00, 0x04, 0x01, 0x2c, 0x00, 0x76, 0x00, 0x02, 0x00, 0x05, 0x01, 0x2c, - //0x01f0: .`.. ..., .v.. ..., - 0x0a, 0x00, 0x00, 0x02, 0x00, 0x00, 0x05, 0x16, 0x14, 0x35, 0x00, 0x03, 0x00, 0x00, 0x05, 0x16, - //0x0200: .... .... .5.. .... - 0x14, 0x28, 0x00, 0x01, 0x00, 0x02, 0x05, 0x16, 0x14, 0x32, 0x00, 0x01, 0x00, 0x03, 0x02, 0x0b, - //0x0210: .(.. .... .2.. .... - 0x0a, 0xc0, 0x00, 0x01, 0x00, 0x00, 0x02, 0x0b, 0x0a, 0xb6, 0x00, 0x02, 0x00, 0x01, 0x08, 0x0b, + 0xff, 0x00, 0x01, 0x2c, 0x00, 0x14, 0x00, 0x02, 0x00, 0x01, 0x01, 0x37, 0x00, 0x00, 0x00, 0x32, + //0x01c0: ..., .... ...7 ...2 + 0x14, 0x00, 0x18, 0x16, 0x00, 0x4a, 0x00, 0x01, 0x00, 0x00, 0x18, 0x21, 0x0a, 0x4b, 0x00, 0x01, + //0x01d0: .... .J.. ...! .K.. + 0x00, 0x01, 0x01, 0x2c, 0x00, 0x1b, 0x00, 0x02, 0x00, 0x02, 0x01, 0x2c, 0x00, 0x60, 0x00, 0x03, + //0x01e0: ..., .... ..., .`.. + 0x00, 0x04, 0x01, 0x2c, 0x00, 0x76, 0x00, 0x02, 0x00, 0x05, 0x01, 0x2c, 0x0a, 0x00, 0x00, 0x02, + //0x01f0: ..., .v.. ..., .... + 0x00, 0x00, 0x05, 0x16, 0x14, 0x35, 0x00, 0x03, 0x00, 0x00, 0x05, 0x16, 0x14, 0x28, 0x00, 0x01, + //0x0200: .... .5.. .... .(.. + 0x00, 0x02, 0x05, 0x16, 0x14, 0x32, 0x00, 0x01, 0x00, 0x03, 0x02, 0x0b, 0x0a, 0xc0, 0x00, 0x01, + //0x0210: .... .2.. .... .... + 0x00, 0x00, 0x02, 0x0b, 0x0a, 0xb6, 0x00, 0x02, 0x00, 0x01, 0x08, 0x0b, 0x0a, 0x00, 0x00, 0x02, //0x0220: .... .... .... .... - 0x0a, 0x00, 0x00, 0x02, 0x00, 0x01, 0x17, 0x00, 0x32, 0x00, 0x00, 0x03, 0x00, 0x00, 0x1c, 0x0b, - //0x0230: .... .... 2... .... - 0x14, 0xfa, 0x00, 0x04, 0x00, 0x00, 0x17, 0x00, 0x32, 0x2b, 0x00, 0x02, 0x00, 0x08, 0x17, 0x0b, - //0x0240: .... .... 2+.. .... - 0x28, 0x82, 0x00, 0x02, 0x00, 0x01, 0x17, 0x16, 0x28, 0x7a, 0x00, 0x02, 0x00, 0x02, 0x17, 0x16, - //0x0250: (... .... (z.. .... - 0x28, 0x69, 0x00, 0x02, 0x00, 0x03, 0x17, 0x16, 0x28, 0x51, 0x00, 0x02, 0x00, 0x04, 0x17, 0x0b, - //0x0260: (i.. .... (Q.. .... - 0x28, 0x87, 0x00, 0x02, 0x00, 0x05, 0x17, 0x16, 0x28, 0x91, 0x00, 0x02, 0x00, 0x06, 0x04, 0x16, - //0x0270: (... .... (... .... - 0x1e, 0x00, 0x00, 0x02, 0x00, 0x00, 0x2d, 0x16, 0x1e, 0xc8, 0x00, 0x00, 0x00, 0x14, 0x2d, 0x16, - //0x0280: .... ..-. .... ..-. - 0x1e, 0x27, 0x00, 0x02, 0x00, 0x00, 0x2d, 0x16, 0x1e, 0x19, 0x00, 0x02, 0x00, 0x00, 0x08, 0x16, - //0x0290: .'.. ..-. .... .... - 0x28, 0x20, 0x00, 0x02, 0x00, 0x00, 0x07, 0x0b, 0x14, 0x40, 0x00, 0x02, 0x00, 0x00, 0x16, 0x16, - //0x02a0: ( .. .... .@.. .... - 0x14, 0x52, 0x00, 0x02, 0x00, 0x00, 0x1b, 0x0b, 0x1e, 0x00, 0x00, 0x02, 0x00, 0x00, 0x14, 0x00, - //0x02b0: .R.. .... .... .... - 0x1e, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0e, 0x21, 0x28, 0x15, 0x00, 0x01, 0x00, 0x00, 0x1d, 0x0b, - //0x02c0: .... ...! (... .... - 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0x16, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x19, 0x00, - //0x02d0: .... .... .... .... - 0x32, 0x04, 0x00, 0x02, 0x00, 0x00, 0x32, 0x16, 0x1e, 0x79, 0x00, 0x02, 0x00, 0x00, 0x32, 0x16, - //0x02e0: 2... ..2. .y.. ..2. - 0x1e, 0x00, 0x00, 0x14, 0x00, 0x00, 0x34, 0x16, 0x1e, 0xc0, 0x00, 0x02, 0x00, 0x00, 0x34, 0x16, - //0x02f0: .... ..4. .... ..4. - 0x1e, 0xe9, 0x00, 0x02, 0x00, 0x00, 0x32, 0x16, 0x28, 0x68, 0x00, 0x37, 0x00, 0x00, 0x35, 0x21, - //0x0300: .... ..2. (h.7 ..5! - 0x00, 0x63, 0x00, 0x02, 0x00, 0x00, 0x32, 0x16, 0x28, 0x00, 0x00, 0x03, 0x00, 0x00, 0x32, 0x16, - //0x0310: .c.. ..2. (... ..2. - 0x1e, 0xa2, 0x00, 0x02, 0x00, 0x00, 0x34, 0x16, 0x1e, 0x39, 0x00, 0x02, 0x00, 0x00, 0x34, 0x16, - //0x0320: .... ..4. .9.. ..4. - 0x1e, 0x00, 0x00, 0x02, 0x00, 0x00, 0x36, 0x00, 0x00, 0x48, 0x00, 0x03, 0x00, 0x00, 0x37, 0x2c, - //0x0330: .... ..6. .H.. ..7, - 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x0e, 0x16, + 0x00, 0x01, 0x17, 0x00, 0x32, 0x00, 0x00, 0x03, 0x00, 0x00, 0x1c, 0x0b, 0x14, 0xfa, 0x00, 0x04, + //0x0230: .... 2... .... .... + 0x00, 0x00, 0x17, 0x00, 0x32, 0x2b, 0x00, 0x02, 0x00, 0x08, 0x17, 0x0b, 0x28, 0x82, 0x00, 0x02, + //0x0240: .... 2+.. .... (... + 0x00, 0x01, 0x17, 0x16, 0x28, 0x7a, 0x00, 0x02, 0x00, 0x02, 0x17, 0x16, 0x28, 0x69, 0x00, 0x02, + //0x0250: .... (z.. .... (i.. + 0x00, 0x03, 0x17, 0x16, 0x28, 0x51, 0x00, 0x02, 0x00, 0x04, 0x17, 0x0b, 0x28, 0x87, 0x00, 0x02, + //0x0260: .... (Q.. .... (... + 0x00, 0x05, 0x17, 0x16, 0x28, 0x91, 0x00, 0x02, 0x00, 0x06, 0x04, 0x16, 0x1e, 0x00, 0x00, 0x02, + //0x0270: .... (... .... .... + 0x00, 0x00, 0x2d, 0x16, 0x1e, 0xc8, 0x00, 0x00, 0x00, 0x14, 0x2d, 0x16, 0x1e, 0x27, 0x00, 0x02, + //0x0280: ..-. .... ..-. .'.. + 0x00, 0x00, 0x2d, 0x16, 0x1e, 0x19, 0x00, 0x02, 0x00, 0x00, 0x08, 0x16, 0x28, 0x20, 0x00, 0x02, + //0x0290: ..-. .... .... ( .. + 0x00, 0x00, 0x07, 0x0b, 0x14, 0x40, 0x00, 0x02, 0x00, 0x00, 0x16, 0x16, 0x14, 0x52, 0x00, 0x02, + //0x02a0: .... .@.. .... .R.. + 0x00, 0x00, 0x1b, 0x0b, 0x1e, 0x00, 0x00, 0x02, 0x00, 0x00, 0x14, 0x00, 0x1e, 0x00, 0x00, 0x02, + //0x02b0: .... .... .... .... + 0x00, 0x00, 0x0e, 0x21, 0x28, 0x15, 0x00, 0x01, 0x00, 0x00, 0x1d, 0x0b, 0x0a, 0x00, 0x00, 0x01, + //0x02c0: ...! (... .... .... + 0x00, 0x00, 0x02, 0x16, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x19, 0x00, 0x32, 0x04, 0x00, 0x02, + //0x02d0: .... .... .... 2... + 0x00, 0x00, 0x32, 0x16, 0x1e, 0x79, 0x00, 0x02, 0x00, 0x00, 0x32, 0x16, 0x1e, 0x00, 0x00, 0x14, + //0x02e0: ..2. .y.. ..2. .... + 0x00, 0x00, 0x34, 0x16, 0x1e, 0xc0, 0x00, 0x02, 0x00, 0x00, 0x34, 0x16, 0x1e, 0xe9, 0x00, 0x02, + //0x02f0: ..4. .... ..4. .... + 0x00, 0x00, 0x32, 0x16, 0x28, 0x68, 0x00, 0x37, 0x00, 0x00, 0x35, 0x21, 0x00, 0x63, 0x00, 0x02, + //0x0300: ..2. (h.7 ..5! .c.. + 0x00, 0x00, 0x32, 0x16, 0x28, 0x00, 0x00, 0x03, 0x00, 0x00, 0x32, 0x16, 0x1e, 0xa2, 0x00, 0x02, + //0x0310: ..2. (... ..2. .... + 0x00, 0x00, 0x34, 0x16, 0x1e, 0x39, 0x00, 0x02, 0x00, 0x00, 0x34, 0x16, 0x1e, 0x00, 0x00, 0x02, + //0x0320: ..4. .9.. ..4. .... + 0x00, 0x00, 0x36, 0x00, 0x00, 0x48, 0x00, 0x03, 0x00, 0x00, 0x37, 0x2c, 0x00, 0x00, 0x00, 0x02, + //0x0330: ..6. .H.. ..7, .... + 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x0e, 0x16, 0x00, 0x02, 0x00, 0x02, //0x0340: .... .... .... .... - 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x0e, 0x16, 0x00, 0x2c, 0x01, 0x01, 0x00, 0x00, 0x0a, 0x16, - //0x0350: .... .... .,.. .... - 0x1e, 0xae, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x16, 0x14, 0x00, 0x00, 0x01, 0x00, 0x00, 0x0b, 0x0b, - //0x0360: .... .... .... .... - 0x14, 0x00, 0x00, 0x32, 0x14, 0x00, 0x0b, 0x0b, 0x1e, 0x00, 0x00, 0x32, 0x14, 0x00, 0x0b, 0x16, - //0x0370: ...2 .... ...2 .... - 0x14, 0x00, 0x00, 0x32, 0x14, 0x00, 0x0e, 0x21, 0x28, 0x00, 0x00, 0x32, 0x14, 0x00, 0xff, 0x44, - //0x0380: ...2 ...! (..2 ...D - 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x56, 0x39, 0x39, 0x00, 0x00, 0x01, 0x01, 0x00, - //0x0390: REAM WEB. V99. .... - 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x50, 0x55, 0x42, 0x4c, - //0x03a0: PUBL IC PUBL - 0x49, 0x43, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x42, 0x4c, 0x41, 0x43, 0x4b, 0x44, - //0x03b0: IC . ..BL ACKD - 0x52, 0x41, 0x47, 0x4f, 0x4e, 0x20, 0x52, 0x59, 0x41, 0x4e, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - //0x03c0: RAGO N RY AN - 0x20, 0x00, 0x00, 0x00, 0x48, 0x45, 0x4e, 0x44, 0x52, 0x49, 0x58, 0x20, 0x20, 0x20, 0x20, 0x20, - //0x03d0: ... HEND RIX - 0x4c, 0x4f, 0x55, 0x49, 0x53, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x53, 0x45, - //0x03e0: LOUI S . ..SE - 0x50, 0x54, 0x49, 0x4d, 0x55, 0x53, 0x20, 0x20, 0x20, 0x20, 0x42, 0x45, 0x43, 0x4b, 0x45, 0x54, - //0x03f0: PTIM US BE CKET - 0x54, 0x20, 0x20, 0x20, 0x20, 0x00, 0xff, 0xff, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - //0x0400: T ... - 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x22, 0x52, 0x4f, 0x4f, 0x54, 0x20, 0x20, 0x20, 0x20, 0x20, - //0x0410: ."R OOT - 0x20, 0x20, 0x20, 0x00, 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - //0x0420: . " - 0x20, 0x00, 0x30, 0x30, 0x30, 0x30, 0x00, 0x30, 0x30, 0x00, 0x0d, 0x0a, 0x0d, 0x0a, 0x24, 0x4f, - //0x0430: .00 00.0 0... ..$O - 0x42, 0x4a, 0x45, 0x43, 0x54, 0x20, 0x4e, 0x41, 0x4d, 0x45, 0x20, 0x4f, 0x4e, 0x45, 0x20, 0x20, - //0x0440: BJEC T NA ME O NE + 0x00, 0x00, 0x0e, 0x16, 0x00, 0x2c, 0x01, 0x01, 0x00, 0x00, 0x0a, 0x16, 0x1e, 0xae, 0x00, 0x00, + //0x0350: .... .,.. .... .... + 0x00, 0x00, 0x0c, 0x16, 0x14, 0x00, 0x00, 0x01, 0x00, 0x00, 0x0b, 0x0b, 0x14, 0x00, 0x00, 0x32, + //0x0360: .... .... .... ...2 + 0x14, 0x00, 0x0b, 0x0b, 0x1e, 0x00, 0x00, 0x32, 0x14, 0x00, 0x0b, 0x16, 0x14, 0x00, 0x00, 0x32, + //0x0370: .... ...2 .... ...2 + 0x14, 0x00, 0x0e, 0x21, 0x28, 0x00, 0x00, 0x32, 0x14, 0x00, 0xff, 0x44, 0x52, 0x45, 0x41, 0x4d, + //0x0380: ...! (..2 ...D REAM + 0x57, 0x45, 0x42, 0x2e, 0x56, 0x39, 0x39, 0x00, 0x00, 0x01, 0x01, 0x00, 0x50, 0x55, 0x42, 0x4c, + //0x0390: WEB. V99. .... PUBL + 0x49, 0x43, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x20, 0x20, + //0x03a0: IC PUBL IC + 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x42, 0x4c, 0x41, 0x43, 0x4b, 0x44, 0x52, 0x41, 0x47, 0x4f, + //0x03b0: . ..BL ACKD RAGO + 0x4e, 0x20, 0x52, 0x59, 0x41, 0x4e, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, + //0x03c0: N RY AN ... + 0x48, 0x45, 0x4e, 0x44, 0x52, 0x49, 0x58, 0x20, 0x20, 0x20, 0x20, 0x20, 0x4c, 0x4f, 0x55, 0x49, + //0x03d0: HEND RIX LOUI + 0x53, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x53, 0x45, 0x50, 0x54, 0x49, 0x4d, + //0x03e0: S . ..SE PTIM + 0x55, 0x53, 0x20, 0x20, 0x20, 0x20, 0x42, 0x45, 0x43, 0x4b, 0x45, 0x54, 0x54, 0x20, 0x20, 0x20, + //0x03f0: US BE CKET T + 0x20, 0x00, 0xff, 0xff, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + //0x0400: ... + 0x20, 0x00, 0x22, 0x52, 0x4f, 0x4f, 0x54, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, + //0x0410: ."R OOT . + 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x30, 0x30, + //0x0420: " .00 + 0x30, 0x30, 0x00, 0x30, 0x30, 0x00, 0x0d, 0x0a, 0x0d, 0x0a, 0x24, 0x4f, 0x42, 0x4a, 0x45, 0x43, + //0x0430: 00.0 0... ..$O BJEC + 0x54, 0x20, 0x4e, 0x41, 0x4d, 0x45, 0x20, 0x4f, 0x4e, 0x45, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + //0x0440: T NA ME O NE 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, //0x0450: - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x10, 0x12, 0x12, 0x11, 0x10, 0x10, 0x10, 0x01, - //0x0460: . .... .... - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, - //0x0470: .... .... .... .... - 0x44, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x0480: D:.. .... .... .... + 0x20, 0x20, 0x20, 0x00, 0x10, 0x12, 0x12, 0x11, 0x10, 0x10, 0x10, 0x01, 0x01, 0x01, 0x01, 0x01, + //0x0460: . .... .... .... + 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x44, 0x3a, 0x00, 0x00, + //0x0470: .... .... .... D:.. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + //0x0480: .... .... .... .... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, //0x0490: .... .... .... .... - 0x01, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x02, //0x04a0: .... .... .... .... - 0x05, 0x00, 0x03, 0x02, 0x04, 0x01, 0x0a, 0x09, 0x08, 0x06, 0x0b, 0x04, 0x07, 0x07, 0x00, 0x00, + 0x04, 0x01, 0x0a, 0x09, 0x08, 0x06, 0x0b, 0x04, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x04b0: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x04c0: .... .... .... .... @@ -4219,9 +4219,9 @@ void DreamGenContext::__start() { //0x0510: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0520: .... .... .... .... - 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, 0xff, //0x0530: .... .... .... .... - 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, }; + 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, }; ds.assign(src, src + sizeof(src)); dreamweb(); } diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index d1a9471f4f..b565b4e13a 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -32,13 +32,13 @@ namespace DreamGen { -static const uint16 offset_commandline = 0x043f; -static const uint16 offset_rootdir = 0x0416; -static const uint16 offset_money2poke = 0x0437; -static const uint16 offset_operand1 = 0x0408; -static const uint16 offset_keys = 0x039e; -static const uint16 offset_money1poke = 0x0432; -static const uint16 offset_openchangesize = 0x039c; +static const uint16 offset_money1poke = 0x042e; +static const uint16 offset_operand1 = 0x0404; +static const uint16 offset_openchangesize = 0x0398; +static const uint16 offset_commandline = 0x043b; +static const uint16 offset_rootdir = 0x0412; +static const uint16 offset_money2poke = 0x0433; +static const uint16 offset_keys = 0x039a; static const uint16 kStartvars = 0; static const uint16 kProgresspoints = 1; static const uint16 kWatchon = 2; @@ -252,135 +252,133 @@ static const uint16 kPressed = 269; static const uint16 kPresspointer = 270; static const uint16 kGraphicpress = 272; static const uint16 kPresscount = 273; -static const uint16 kKeypadax = 274; -static const uint16 kKeypadcx = 276; -static const uint16 kLightcount = 278; -static const uint16 kFolderpage = 279; -static const uint16 kDiarypage = 280; -static const uint16 kMenucount = 281; -static const uint16 kSymboltopx = 282; -static const uint16 kSymboltopnum = 283; -static const uint16 kSymboltopdir = 284; -static const uint16 kSymbolbotx = 285; -static const uint16 kSymbolbotnum = 286; -static const uint16 kSymbolbotdir = 287; -static const uint16 kSymboltolight = 288; -static const uint16 kSymbol1 = 289; -static const uint16 kSymbol2 = 290; -static const uint16 kSymbol3 = 291; -static const uint16 kSymbolnum = 292; -static const uint16 kDumpx = 293; -static const uint16 kDumpy = 295; -static const uint16 kWalkandexam = 297; -static const uint16 kWalkexamtype = 298; -static const uint16 kWalkexamnum = 299; -static const uint16 kCursloc = 300; -static const uint16 kCurslocx = 302; -static const uint16 kCurslocy = 304; -static const uint16 kCurpos = 306; -static const uint16 kMonadx = 308; -static const uint16 kMonady = 310; -static const uint16 kGotfrom = 312; -static const uint16 kMonsource = 314; -static const uint16 kNumtodo = 316; -static const uint16 kTimecount = 318; -static const uint16 kCounttotimed = 320; -static const uint16 kTimedseg = 322; -static const uint16 kTimedoffset = 324; -static const uint16 kTimedy = 326; -static const uint16 kTimedx = 327; -static const uint16 kNeedtodumptimed = 328; -static const uint16 kLoadingorsave = 329; -static const uint16 kCurrentslot = 330; -static const uint16 kCursorpos = 331; -static const uint16 kColourpos = 332; -static const uint16 kFadedirection = 333; -static const uint16 kNumtofade = 334; -static const uint16 kFadecount = 335; -static const uint16 kAddtogreen = 336; -static const uint16 kAddtored = 337; -static const uint16 kAddtoblue = 338; -static const uint16 kLastsoundreel = 339; -static const uint16 kSpeechloaded = 341; -static const uint16 kSpeechlength = 342; -static const uint16 kVolume = 344; -static const uint16 kVolumeto = 345; -static const uint16 kVolumedirection = 346; -static const uint16 kVolumecount = 347; -static const uint16 kPlayblock = 348; -static const uint16 kWongame = 349; -static const uint16 kLasthardkey = 350; -static const uint16 kBufferin = 351; -static const uint16 kBufferout = 353; -static const uint16 kExtras = 355; -static const uint16 kWorkspace = 357; -static const uint16 kMapstore = 359; -static const uint16 kCharset1 = 361; -static const uint16 kBuffers = 363; -static const uint16 kMainsprites = 365; -static const uint16 kBackdrop = 367; -static const uint16 kMapdata = 369; -static const uint16 kSounddata = 371; -static const uint16 kSounddata2 = 373; -static const uint16 kRecordspace = 375; -static const uint16 kFreedat = 377; -static const uint16 kSetdat = 379; -static const uint16 kReel1 = 381; -static const uint16 kReel2 = 383; -static const uint16 kReel3 = 385; -static const uint16 kRoomdesc = 387; -static const uint16 kFreedesc = 389; -static const uint16 kSetdesc = 391; -static const uint16 kBlockdesc = 393; -static const uint16 kSetframes = 395; -static const uint16 kFreeframes = 397; -static const uint16 kPeople = 399; -static const uint16 kReels = 401; -static const uint16 kCommandtext = 403; -static const uint16 kPuzzletext = 405; -static const uint16 kTraveltext = 407; -static const uint16 kTempgraphics = 409; -static const uint16 kTempgraphics2 = 411; -static const uint16 kTempgraphics3 = 413; -static const uint16 kTempsprites = 415; -static const uint16 kTextfile1 = 417; -static const uint16 kTextfile2 = 419; -static const uint16 kTextfile3 = 421; -static const uint16 kBlinkframe = 423; -static const uint16 kBlinkcount = 424; -static const uint16 kReasseschanges = 425; -static const uint16 kPointerspath = 426; -static const uint16 kManspath = 427; -static const uint16 kPointerfirstpath = 428; -static const uint16 kFinaldest = 429; -static const uint16 kDestination = 430; -static const uint16 kLinestartx = 431; -static const uint16 kLinestarty = 433; -static const uint16 kLineendx = 435; -static const uint16 kLineendy = 437; -static const uint16 kLinepointer = 439; -static const uint16 kLinedirection = 440; -static const uint16 kLinelength = 441; -static const uint16 kLiftsoundcount = 442; -static const uint16 kCh0blockstocopy = 443; -static const uint16 kCh0playing = 445; -static const uint16 kCh0repeat = 446; -static const uint16 kCh1playing = 447; -static const uint16 kCh1blockstocopy = 448; -static const uint16 kSoundbufferwrite = 450; -static const uint16 kCurrentsample = 452; -static const uint16 kRoomssample = 453; -static const uint16 kReelroutines = 454; -static const uint16 kBasicsample = 911; -static const uint16 kCurrentfile = 1060; -static const uint16 kRoomscango = 1184; -static const uint16 kRoompics = 1200; -static const uint16 kOplist = 1215; -static const uint16 kInputline = 1218; -static const uint16 kPresslist = 1346; -static const uint16 kQuitrequested = 1352; -static const uint16 kSubtitles = 1353; -static const uint16 kForeignrelease = 1354; +static const uint16 kLightcount = 274; +static const uint16 kFolderpage = 275; +static const uint16 kDiarypage = 276; +static const uint16 kMenucount = 277; +static const uint16 kSymboltopx = 278; +static const uint16 kSymboltopnum = 279; +static const uint16 kSymboltopdir = 280; +static const uint16 kSymbolbotx = 281; +static const uint16 kSymbolbotnum = 282; +static const uint16 kSymbolbotdir = 283; +static const uint16 kSymboltolight = 284; +static const uint16 kSymbol1 = 285; +static const uint16 kSymbol2 = 286; +static const uint16 kSymbol3 = 287; +static const uint16 kSymbolnum = 288; +static const uint16 kDumpx = 289; +static const uint16 kDumpy = 291; +static const uint16 kWalkandexam = 293; +static const uint16 kWalkexamtype = 294; +static const uint16 kWalkexamnum = 295; +static const uint16 kCursloc = 296; +static const uint16 kCurslocx = 298; +static const uint16 kCurslocy = 300; +static const uint16 kCurpos = 302; +static const uint16 kMonadx = 304; +static const uint16 kMonady = 306; +static const uint16 kGotfrom = 308; +static const uint16 kMonsource = 310; +static const uint16 kNumtodo = 312; +static const uint16 kTimecount = 314; +static const uint16 kCounttotimed = 316; +static const uint16 kTimedseg = 318; +static const uint16 kTimedoffset = 320; +static const uint16 kTimedy = 322; +static const uint16 kTimedx = 323; +static const uint16 kNeedtodumptimed = 324; +static const uint16 kLoadingorsave = 325; +static const uint16 kCurrentslot = 326; +static const uint16 kCursorpos = 327; +static const uint16 kColourpos = 328; +static const uint16 kFadedirection = 329; +static const uint16 kNumtofade = 330; +static const uint16 kFadecount = 331; +static const uint16 kAddtogreen = 332; +static const uint16 kAddtored = 333; +static const uint16 kAddtoblue = 334; +static const uint16 kLastsoundreel = 335; +static const uint16 kSpeechloaded = 337; +static const uint16 kSpeechlength = 338; +static const uint16 kVolume = 340; +static const uint16 kVolumeto = 341; +static const uint16 kVolumedirection = 342; +static const uint16 kVolumecount = 343; +static const uint16 kPlayblock = 344; +static const uint16 kWongame = 345; +static const uint16 kLasthardkey = 346; +static const uint16 kBufferin = 347; +static const uint16 kBufferout = 349; +static const uint16 kExtras = 351; +static const uint16 kWorkspace = 353; +static const uint16 kMapstore = 355; +static const uint16 kCharset1 = 357; +static const uint16 kBuffers = 359; +static const uint16 kMainsprites = 361; +static const uint16 kBackdrop = 363; +static const uint16 kMapdata = 365; +static const uint16 kSounddata = 367; +static const uint16 kSounddata2 = 369; +static const uint16 kRecordspace = 371; +static const uint16 kFreedat = 373; +static const uint16 kSetdat = 375; +static const uint16 kReel1 = 377; +static const uint16 kReel2 = 379; +static const uint16 kReel3 = 381; +static const uint16 kRoomdesc = 383; +static const uint16 kFreedesc = 385; +static const uint16 kSetdesc = 387; +static const uint16 kBlockdesc = 389; +static const uint16 kSetframes = 391; +static const uint16 kFreeframes = 393; +static const uint16 kPeople = 395; +static const uint16 kReels = 397; +static const uint16 kCommandtext = 399; +static const uint16 kPuzzletext = 401; +static const uint16 kTraveltext = 403; +static const uint16 kTempgraphics = 405; +static const uint16 kTempgraphics2 = 407; +static const uint16 kTempgraphics3 = 409; +static const uint16 kTempsprites = 411; +static const uint16 kTextfile1 = 413; +static const uint16 kTextfile2 = 415; +static const uint16 kTextfile3 = 417; +static const uint16 kBlinkframe = 419; +static const uint16 kBlinkcount = 420; +static const uint16 kReasseschanges = 421; +static const uint16 kPointerspath = 422; +static const uint16 kManspath = 423; +static const uint16 kPointerfirstpath = 424; +static const uint16 kFinaldest = 425; +static const uint16 kDestination = 426; +static const uint16 kLinestartx = 427; +static const uint16 kLinestarty = 429; +static const uint16 kLineendx = 431; +static const uint16 kLineendy = 433; +static const uint16 kLinepointer = 435; +static const uint16 kLinedirection = 436; +static const uint16 kLinelength = 437; +static const uint16 kLiftsoundcount = 438; +static const uint16 kCh0blockstocopy = 439; +static const uint16 kCh0playing = 441; +static const uint16 kCh0repeat = 442; +static const uint16 kCh1playing = 443; +static const uint16 kCh1blockstocopy = 444; +static const uint16 kSoundbufferwrite = 446; +static const uint16 kCurrentsample = 448; +static const uint16 kRoomssample = 449; +static const uint16 kReelroutines = 450; +static const uint16 kBasicsample = 907; +static const uint16 kCurrentfile = 1056; +static const uint16 kRoomscango = 1180; +static const uint16 kRoompics = 1196; +static const uint16 kOplist = 1211; +static const uint16 kInputline = 1214; +static const uint16 kPresslist = 1342; +static const uint16 kQuitrequested = 1348; +static const uint16 kSubtitles = 1349; +static const uint16 kForeignrelease = 1350; static const uint16 kBlocktextdat = (0); static const uint16 kPersonframes = (0); static const uint16 kDebuglevel1 = (0); @@ -419,8 +417,8 @@ static const uint16 kListofchanges = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768 static const uint16 kUndertimedtext = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)); static const uint16 kRainlist = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)); static const uint16 kInitialreelrouts = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)); -static const uint16 kInitialvars = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+911-454); -static const uint16 kLengthofbuffer = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+911-454+68-0); +static const uint16 kInitialvars = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+907-450); +static const uint16 kLengthofbuffer = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+907-450+68-0); static const uint16 kReellist = (0+(36*144)); static const uint16 kIntext = (0+(38*2)); static const uint16 kLengthofmap = (0+(66*60)); @@ -471,7 +469,7 @@ static const uint16 kKeypady = (72); static const uint16 kZoomx = (8); static const uint16 kInventx = (80); static const uint16 kMenux = (80+40); -static const uint16 kLenofreelrouts = (911-454); +static const uint16 kLenofreelrouts = (907-450); static const uint16 kHeaderlen = (96); -- cgit v1.2.3 From faab2d761d103de3c019dc1c979d3940191abc96 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 15 Dec 2011 11:30:47 +0200 Subject: DREAMWEB: Remove some unused global variables from the data blob --- engines/dreamweb/dreamgen.cpp | 228 ++++++++++++++++++++--------------------- engines/dreamweb/dreamgen.h | 230 +++++++++++++++++++++--------------------- 2 files changed, 227 insertions(+), 231 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 6f8cff0ff1..dfeda18d6c 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -2651,14 +2651,14 @@ void DreamGenContext::getDestInfo() { push(ax); dx = data; es = dx; - si = 1180; + si = 1174; _add(si, ax); cl = es.byte(si); ax = pop(); push(cx); dx = data; es = dx; - si = 1196; + si = 1190; _add(si, ax); ax = pop(); } @@ -2710,7 +2710,7 @@ clearedlocations: bx = ax; dx = data; es = dx; - _add(bx, 1180); + _add(bx, 1174); es.byte(bx) = 0; } @@ -2749,7 +2749,7 @@ dirroot: si = offset_rootdir; _inc(si); es = cs; - di = 1056; + di = 1050; _inc(di); cx = 12; _movsb(cx, true); @@ -2851,7 +2851,7 @@ notyetassigned: push(bx); _add(bx, 2); ds = cs; - si = 1214; + si = 1208; checkpass: _lodsw(); ah = es.byte(bx); @@ -2922,7 +2922,7 @@ void DreamGenContext::read() { return; okcom: es = cs; - di = 1056; + di = 1050; ax = data.word(kTextfile1); data.word(kMonsource) = ax; ds = ax; @@ -3052,7 +3052,7 @@ keyok2: ds = cs; si = offset_operand1+1; es = cs; - di = 1056+1; + di = 1050+1; cx = 12; _movsb(cx, true); monitorLogo(); @@ -3179,7 +3179,7 @@ void DreamGenContext::parser() { al = '='; _stosb(); ds = cs; - si = 1214; + si = 1208; notspace1: _lodsw(); _cmp(al, 32); @@ -3808,7 +3808,7 @@ nomatchslot: void DreamGenContext::clearBuffers() { STACK_CHECK; es = data.word(kBuffers); - cx = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+907-450+68-0)/2; + cx = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+901-444+68-0)/2; ax = 0; di = 0; _stosw(cx, true); @@ -3820,11 +3820,11 @@ void DreamGenContext::clearBuffers() { es = data.word(kBuffers); di = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)); ds = cs; - si = 450; - cx = (907-450); + si = 444; + cx = (901-444); _movsb(cx, true); es = data.word(kBuffers); - di = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+907-450); + di = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+901-444); ds = cs; si = 0; cx = (68-0); @@ -3842,11 +3842,11 @@ void DreamGenContext::clearChanges() { ds = data.word(kBuffers); si = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)); es = cs; - di = 450; - cx = (907-450); + di = 444; + cx = (901-444); _movsb(cx, true); ds = data.word(kBuffers); - si = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+907-450); + si = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+901-444); es = cs; di = 0; cx = (68-0); @@ -3860,7 +3860,7 @@ void DreamGenContext::clearChanges() { di = 0; _stosw(cx, true); es = cs; - di = 1180; + di = 1174; al = 1; _stosb(2); al = 0; @@ -4099,111 +4099,111 @@ void DreamGenContext::__start() { //0x0150: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0160: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x00, 0x00, 0x00, 0x00, 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, //0x0180: .... .... .... .... - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 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, //0x0190: .... .... .... .... - 0xff, 0xff, 0xff, 0x17, 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, //0x01a0: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, - //0x01b0: .... .... .... .... - 0xff, 0x00, 0x01, 0x2c, 0x00, 0x14, 0x00, 0x02, 0x00, 0x01, 0x01, 0x37, 0x00, 0x00, 0x00, 0x32, - //0x01c0: ..., .... ...7 ...2 - 0x14, 0x00, 0x18, 0x16, 0x00, 0x4a, 0x00, 0x01, 0x00, 0x00, 0x18, 0x21, 0x0a, 0x4b, 0x00, 0x01, - //0x01d0: .... .J.. ...! .K.. - 0x00, 0x01, 0x01, 0x2c, 0x00, 0x1b, 0x00, 0x02, 0x00, 0x02, 0x01, 0x2c, 0x00, 0x60, 0x00, 0x03, - //0x01e0: ..., .... ..., .`.. - 0x00, 0x04, 0x01, 0x2c, 0x00, 0x76, 0x00, 0x02, 0x00, 0x05, 0x01, 0x2c, 0x0a, 0x00, 0x00, 0x02, - //0x01f0: ..., .v.. ..., .... - 0x00, 0x00, 0x05, 0x16, 0x14, 0x35, 0x00, 0x03, 0x00, 0x00, 0x05, 0x16, 0x14, 0x28, 0x00, 0x01, - //0x0200: .... .5.. .... .(.. - 0x00, 0x02, 0x05, 0x16, 0x14, 0x32, 0x00, 0x01, 0x00, 0x03, 0x02, 0x0b, 0x0a, 0xc0, 0x00, 0x01, - //0x0210: .... .2.. .... .... - 0x00, 0x00, 0x02, 0x0b, 0x0a, 0xb6, 0x00, 0x02, 0x00, 0x01, 0x08, 0x0b, 0x0a, 0x00, 0x00, 0x02, - //0x0220: .... .... .... .... - 0x00, 0x01, 0x17, 0x00, 0x32, 0x00, 0x00, 0x03, 0x00, 0x00, 0x1c, 0x0b, 0x14, 0xfa, 0x00, 0x04, - //0x0230: .... 2... .... .... - 0x00, 0x00, 0x17, 0x00, 0x32, 0x2b, 0x00, 0x02, 0x00, 0x08, 0x17, 0x0b, 0x28, 0x82, 0x00, 0x02, - //0x0240: .... 2+.. .... (... - 0x00, 0x01, 0x17, 0x16, 0x28, 0x7a, 0x00, 0x02, 0x00, 0x02, 0x17, 0x16, 0x28, 0x69, 0x00, 0x02, - //0x0250: .... (z.. .... (i.. - 0x00, 0x03, 0x17, 0x16, 0x28, 0x51, 0x00, 0x02, 0x00, 0x04, 0x17, 0x0b, 0x28, 0x87, 0x00, 0x02, - //0x0260: .... (Q.. .... (... - 0x00, 0x05, 0x17, 0x16, 0x28, 0x91, 0x00, 0x02, 0x00, 0x06, 0x04, 0x16, 0x1e, 0x00, 0x00, 0x02, - //0x0270: .... (... .... .... - 0x00, 0x00, 0x2d, 0x16, 0x1e, 0xc8, 0x00, 0x00, 0x00, 0x14, 0x2d, 0x16, 0x1e, 0x27, 0x00, 0x02, - //0x0280: ..-. .... ..-. .'.. - 0x00, 0x00, 0x2d, 0x16, 0x1e, 0x19, 0x00, 0x02, 0x00, 0x00, 0x08, 0x16, 0x28, 0x20, 0x00, 0x02, - //0x0290: ..-. .... .... ( .. - 0x00, 0x00, 0x07, 0x0b, 0x14, 0x40, 0x00, 0x02, 0x00, 0x00, 0x16, 0x16, 0x14, 0x52, 0x00, 0x02, - //0x02a0: .... .@.. .... .R.. - 0x00, 0x00, 0x1b, 0x0b, 0x1e, 0x00, 0x00, 0x02, 0x00, 0x00, 0x14, 0x00, 0x1e, 0x00, 0x00, 0x02, - //0x02b0: .... .... .... .... - 0x00, 0x00, 0x0e, 0x21, 0x28, 0x15, 0x00, 0x01, 0x00, 0x00, 0x1d, 0x0b, 0x0a, 0x00, 0x00, 0x01, - //0x02c0: ...! (... .... .... - 0x00, 0x00, 0x02, 0x16, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x19, 0x00, 0x32, 0x04, 0x00, 0x02, - //0x02d0: .... .... .... 2... - 0x00, 0x00, 0x32, 0x16, 0x1e, 0x79, 0x00, 0x02, 0x00, 0x00, 0x32, 0x16, 0x1e, 0x00, 0x00, 0x14, - //0x02e0: ..2. .y.. ..2. .... - 0x00, 0x00, 0x34, 0x16, 0x1e, 0xc0, 0x00, 0x02, 0x00, 0x00, 0x34, 0x16, 0x1e, 0xe9, 0x00, 0x02, - //0x02f0: ..4. .... ..4. .... - 0x00, 0x00, 0x32, 0x16, 0x28, 0x68, 0x00, 0x37, 0x00, 0x00, 0x35, 0x21, 0x00, 0x63, 0x00, 0x02, - //0x0300: ..2. (h.7 ..5! .c.. - 0x00, 0x00, 0x32, 0x16, 0x28, 0x00, 0x00, 0x03, 0x00, 0x00, 0x32, 0x16, 0x1e, 0xa2, 0x00, 0x02, - //0x0310: ..2. (... ..2. .... - 0x00, 0x00, 0x34, 0x16, 0x1e, 0x39, 0x00, 0x02, 0x00, 0x00, 0x34, 0x16, 0x1e, 0x00, 0x00, 0x02, - //0x0320: ..4. .9.. ..4. .... - 0x00, 0x00, 0x36, 0x00, 0x00, 0x48, 0x00, 0x03, 0x00, 0x00, 0x37, 0x2c, 0x00, 0x00, 0x00, 0x02, - //0x0330: ..6. .H.. ..7, .... - 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x0e, 0x16, 0x00, 0x02, 0x00, 0x02, - //0x0340: .... .... .... .... - 0x00, 0x00, 0x0e, 0x16, 0x00, 0x2c, 0x01, 0x01, 0x00, 0x00, 0x0a, 0x16, 0x1e, 0xae, 0x00, 0x00, - //0x0350: .... .,.. .... .... - 0x00, 0x00, 0x0c, 0x16, 0x14, 0x00, 0x00, 0x01, 0x00, 0x00, 0x0b, 0x0b, 0x14, 0x00, 0x00, 0x32, - //0x0360: .... .... .... ...2 - 0x14, 0x00, 0x0b, 0x0b, 0x1e, 0x00, 0x00, 0x32, 0x14, 0x00, 0x0b, 0x16, 0x14, 0x00, 0x00, 0x32, - //0x0370: .... ...2 .... ...2 - 0x14, 0x00, 0x0e, 0x21, 0x28, 0x00, 0x00, 0x32, 0x14, 0x00, 0xff, 0x44, 0x52, 0x45, 0x41, 0x4d, - //0x0380: ...! (..2 ...D REAM - 0x57, 0x45, 0x42, 0x2e, 0x56, 0x39, 0x39, 0x00, 0x00, 0x01, 0x01, 0x00, 0x50, 0x55, 0x42, 0x4c, - //0x0390: WEB. V99. .... PUBL - 0x49, 0x43, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x20, 0x20, - //0x03a0: IC PUBL IC - 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x42, 0x4c, 0x41, 0x43, 0x4b, 0x44, 0x52, 0x41, 0x47, 0x4f, - //0x03b0: . ..BL ACKD RAGO - 0x4e, 0x20, 0x52, 0x59, 0x41, 0x4e, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, - //0x03c0: N RY AN ... - 0x48, 0x45, 0x4e, 0x44, 0x52, 0x49, 0x58, 0x20, 0x20, 0x20, 0x20, 0x20, 0x4c, 0x4f, 0x55, 0x49, - //0x03d0: HEND RIX LOUI - 0x53, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x53, 0x45, 0x50, 0x54, 0x49, 0x4d, - //0x03e0: S . ..SE PTIM - 0x55, 0x53, 0x20, 0x20, 0x20, 0x20, 0x42, 0x45, 0x43, 0x4b, 0x45, 0x54, 0x54, 0x20, 0x20, 0x20, - //0x03f0: US BE CKET T - 0x20, 0x00, 0xff, 0xff, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - //0x0400: ... - 0x20, 0x00, 0x22, 0x52, 0x4f, 0x4f, 0x54, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, - //0x0410: ."R OOT . - 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x30, 0x30, - //0x0420: " .00 - 0x30, 0x30, 0x00, 0x30, 0x30, 0x00, 0x0d, 0x0a, 0x0d, 0x0a, 0x24, 0x4f, 0x42, 0x4a, 0x45, 0x43, - //0x0430: 00.0 0... ..$O BJEC - 0x54, 0x20, 0x4e, 0x41, 0x4d, 0x45, 0x20, 0x4f, 0x4e, 0x45, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - //0x0440: T NA ME O NE - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - //0x0450: - 0x20, 0x20, 0x20, 0x00, 0x10, 0x12, 0x12, 0x11, 0x10, 0x10, 0x10, 0x01, 0x01, 0x01, 0x01, 0x01, - //0x0460: . .... .... .... - 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x44, 0x3a, 0x00, 0x00, - //0x0470: .... .... .... D:.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x01, 0x2c, 0x00, 0x14, + //0x01b0: .... .... .... .,.. + 0x00, 0x02, 0x00, 0x01, 0x01, 0x37, 0x00, 0x00, 0x00, 0x32, 0x14, 0x00, 0x18, 0x16, 0x00, 0x4a, + //0x01c0: .... .7.. .2.. ...J + 0x00, 0x01, 0x00, 0x00, 0x18, 0x21, 0x0a, 0x4b, 0x00, 0x01, 0x00, 0x01, 0x01, 0x2c, 0x00, 0x1b, + //0x01d0: .... .!.K .... .,.. + 0x00, 0x02, 0x00, 0x02, 0x01, 0x2c, 0x00, 0x60, 0x00, 0x03, 0x00, 0x04, 0x01, 0x2c, 0x00, 0x76, + //0x01e0: .... .,.` .... .,.v + 0x00, 0x02, 0x00, 0x05, 0x01, 0x2c, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x00, 0x05, 0x16, 0x14, 0x35, + //0x01f0: .... .,.. .... ...5 + 0x00, 0x03, 0x00, 0x00, 0x05, 0x16, 0x14, 0x28, 0x00, 0x01, 0x00, 0x02, 0x05, 0x16, 0x14, 0x32, + //0x0200: .... ...( .... ...2 + 0x00, 0x01, 0x00, 0x03, 0x02, 0x0b, 0x0a, 0xc0, 0x00, 0x01, 0x00, 0x00, 0x02, 0x0b, 0x0a, 0xb6, + //0x0210: .... .... .... .... + 0x00, 0x02, 0x00, 0x01, 0x08, 0x0b, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x01, 0x17, 0x00, 0x32, 0x00, + //0x0220: .... .... .... ..2. + 0x00, 0x03, 0x00, 0x00, 0x1c, 0x0b, 0x14, 0xfa, 0x00, 0x04, 0x00, 0x00, 0x17, 0x00, 0x32, 0x2b, + //0x0230: .... .... .... ..2+ + 0x00, 0x02, 0x00, 0x08, 0x17, 0x0b, 0x28, 0x82, 0x00, 0x02, 0x00, 0x01, 0x17, 0x16, 0x28, 0x7a, + //0x0240: .... ..(. .... ..(z + 0x00, 0x02, 0x00, 0x02, 0x17, 0x16, 0x28, 0x69, 0x00, 0x02, 0x00, 0x03, 0x17, 0x16, 0x28, 0x51, + //0x0250: .... ..(i .... ..(Q + 0x00, 0x02, 0x00, 0x04, 0x17, 0x0b, 0x28, 0x87, 0x00, 0x02, 0x00, 0x05, 0x17, 0x16, 0x28, 0x91, + //0x0260: .... ..(. .... ..(. + 0x00, 0x02, 0x00, 0x06, 0x04, 0x16, 0x1e, 0x00, 0x00, 0x02, 0x00, 0x00, 0x2d, 0x16, 0x1e, 0xc8, + //0x0270: .... .... .... -... + 0x00, 0x00, 0x00, 0x14, 0x2d, 0x16, 0x1e, 0x27, 0x00, 0x02, 0x00, 0x00, 0x2d, 0x16, 0x1e, 0x19, + //0x0280: .... -..' .... -... + 0x00, 0x02, 0x00, 0x00, 0x08, 0x16, 0x28, 0x20, 0x00, 0x02, 0x00, 0x00, 0x07, 0x0b, 0x14, 0x40, + //0x0290: .... ..( .... ...@ + 0x00, 0x02, 0x00, 0x00, 0x16, 0x16, 0x14, 0x52, 0x00, 0x02, 0x00, 0x00, 0x1b, 0x0b, 0x1e, 0x00, + //0x02a0: .... ...R .... .... + 0x00, 0x02, 0x00, 0x00, 0x14, 0x00, 0x1e, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0e, 0x21, 0x28, 0x15, + //0x02b0: .... .... .... .!(. + 0x00, 0x01, 0x00, 0x00, 0x1d, 0x0b, 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0x16, 0x00, 0x02, + //0x02c0: .... .... .... .... + 0x00, 0x02, 0x00, 0x00, 0x19, 0x00, 0x32, 0x04, 0x00, 0x02, 0x00, 0x00, 0x32, 0x16, 0x1e, 0x79, + //0x02d0: .... ..2. .... 2..y + 0x00, 0x02, 0x00, 0x00, 0x32, 0x16, 0x1e, 0x00, 0x00, 0x14, 0x00, 0x00, 0x34, 0x16, 0x1e, 0xc0, + //0x02e0: .... 2... .... 4... + 0x00, 0x02, 0x00, 0x00, 0x34, 0x16, 0x1e, 0xe9, 0x00, 0x02, 0x00, 0x00, 0x32, 0x16, 0x28, 0x68, + //0x02f0: .... 4... .... 2.(h + 0x00, 0x37, 0x00, 0x00, 0x35, 0x21, 0x00, 0x63, 0x00, 0x02, 0x00, 0x00, 0x32, 0x16, 0x28, 0x00, + //0x0300: .7.. 5!.c .... 2.(. + 0x00, 0x03, 0x00, 0x00, 0x32, 0x16, 0x1e, 0xa2, 0x00, 0x02, 0x00, 0x00, 0x34, 0x16, 0x1e, 0x39, + //0x0310: .... 2... .... 4..9 + 0x00, 0x02, 0x00, 0x00, 0x34, 0x16, 0x1e, 0x00, 0x00, 0x02, 0x00, 0x00, 0x36, 0x00, 0x00, 0x48, + //0x0320: .... 4... .... 6..H + 0x00, 0x03, 0x00, 0x00, 0x37, 0x2c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, + //0x0330: .... 7,.. .... .... + 0x00, 0x1c, 0x00, 0x00, 0x0e, 0x16, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x0e, 0x16, 0x00, 0x2c, + //0x0340: .... .... .... ..., + 0x01, 0x01, 0x00, 0x00, 0x0a, 0x16, 0x1e, 0xae, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x16, 0x14, 0x00, + //0x0350: .... .... .... .... + 0x00, 0x01, 0x00, 0x00, 0x0b, 0x0b, 0x14, 0x00, 0x00, 0x32, 0x14, 0x00, 0x0b, 0x0b, 0x1e, 0x00, + //0x0360: .... .... .2.. .... + 0x00, 0x32, 0x14, 0x00, 0x0b, 0x16, 0x14, 0x00, 0x00, 0x32, 0x14, 0x00, 0x0e, 0x21, 0x28, 0x00, + //0x0370: .2.. .... .2.. .!(. + 0x00, 0x32, 0x14, 0x00, 0xff, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x56, 0x39, + //0x0380: .2.. .DRE AMWE B.V9 + 0x39, 0x00, 0x00, 0x01, 0x01, 0x00, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x20, 0x20, 0x20, 0x20, + //0x0390: 9... ..PU BLIC + 0x20, 0x20, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, + //0x03a0: PU BLIC ... + 0x42, 0x4c, 0x41, 0x43, 0x4b, 0x44, 0x52, 0x41, 0x47, 0x4f, 0x4e, 0x20, 0x52, 0x59, 0x41, 0x4e, + //0x03b0: BLAC KDRA GON RYAN + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x48, 0x45, 0x4e, 0x44, 0x52, 0x49, + //0x03c0: . ..HE NDRI + 0x58, 0x20, 0x20, 0x20, 0x20, 0x20, 0x4c, 0x4f, 0x55, 0x49, 0x53, 0x20, 0x20, 0x20, 0x20, 0x20, + //0x03d0: X LO UIS + 0x20, 0x00, 0x00, 0x00, 0x53, 0x45, 0x50, 0x54, 0x49, 0x4d, 0x55, 0x53, 0x20, 0x20, 0x20, 0x20, + //0x03e0: ... SEPT IMUS + 0x42, 0x45, 0x43, 0x4b, 0x45, 0x54, 0x54, 0x20, 0x20, 0x20, 0x20, 0x00, 0xff, 0xff, 0x20, 0x20, + //0x03f0: BECK ETT . .. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x22, 0x52, 0x4f, 0x4f, + //0x0400: . "ROO + 0x54, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, + //0x0410: T ." + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x30, 0x30, 0x30, 0x30, 0x00, 0x30, 0x30, 0x00, + //0x0420: . 0000 .00. + 0x0d, 0x0a, 0x0d, 0x0a, 0x24, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x20, 0x4e, 0x41, 0x4d, 0x45, + //0x0430: .... $OBJ ECT NAME + 0x20, 0x4f, 0x4e, 0x45, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + //0x0440: ONE + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x10, 0x12, + //0x0450: ... + 0x12, 0x11, 0x10, 0x10, 0x10, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, + //0x0460: .... .... .... .... + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x44, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + //0x0470: .... ..D: .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0480: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0490: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x02, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x02, 0x04, 0x01, 0x0a, 0x09, 0x08, 0x06, //0x04a0: .... .... .... .... - 0x04, 0x01, 0x0a, 0x09, 0x08, 0x06, 0x0b, 0x04, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0b, 0x04, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x04b0: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x04c0: .... .... .... .... @@ -4219,9 +4219,9 @@ void DreamGenContext::__start() { //0x0510: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0520: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, //0x0530: .... .... .... .... - 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, }; + 0x00, }; ds.assign(src, src + sizeof(src)); dreamweb(); } diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index b565b4e13a..e530a3b968 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -32,13 +32,13 @@ namespace DreamGen { -static const uint16 offset_money1poke = 0x042e; -static const uint16 offset_operand1 = 0x0404; -static const uint16 offset_openchangesize = 0x0398; -static const uint16 offset_commandline = 0x043b; -static const uint16 offset_rootdir = 0x0412; -static const uint16 offset_money2poke = 0x0433; -static const uint16 offset_keys = 0x039a; +static const uint16 offset_money2poke = 0x042d; +static const uint16 offset_rootdir = 0x040c; +static const uint16 offset_openchangesize = 0x0392; +static const uint16 offset_keys = 0x0394; +static const uint16 offset_commandline = 0x0435; +static const uint16 offset_money1poke = 0x0428; +static const uint16 offset_operand1 = 0x03fe; static const uint16 kStartvars = 0; static const uint16 kProgresspoints = 1; static const uint16 kWatchon = 2; @@ -272,113 +272,109 @@ static const uint16 kDumpy = 291; static const uint16 kWalkandexam = 293; static const uint16 kWalkexamtype = 294; static const uint16 kWalkexamnum = 295; -static const uint16 kCursloc = 296; -static const uint16 kCurslocx = 298; -static const uint16 kCurslocy = 300; -static const uint16 kCurpos = 302; -static const uint16 kMonadx = 304; -static const uint16 kMonady = 306; -static const uint16 kGotfrom = 308; -static const uint16 kMonsource = 310; -static const uint16 kNumtodo = 312; -static const uint16 kTimecount = 314; -static const uint16 kCounttotimed = 316; -static const uint16 kTimedseg = 318; -static const uint16 kTimedoffset = 320; -static const uint16 kTimedy = 322; -static const uint16 kTimedx = 323; -static const uint16 kNeedtodumptimed = 324; -static const uint16 kLoadingorsave = 325; -static const uint16 kCurrentslot = 326; -static const uint16 kCursorpos = 327; -static const uint16 kColourpos = 328; -static const uint16 kFadedirection = 329; -static const uint16 kNumtofade = 330; -static const uint16 kFadecount = 331; -static const uint16 kAddtogreen = 332; -static const uint16 kAddtored = 333; -static const uint16 kAddtoblue = 334; -static const uint16 kLastsoundreel = 335; -static const uint16 kSpeechloaded = 337; -static const uint16 kSpeechlength = 338; -static const uint16 kVolume = 340; -static const uint16 kVolumeto = 341; -static const uint16 kVolumedirection = 342; -static const uint16 kVolumecount = 343; -static const uint16 kPlayblock = 344; -static const uint16 kWongame = 345; -static const uint16 kLasthardkey = 346; -static const uint16 kBufferin = 347; -static const uint16 kBufferout = 349; -static const uint16 kExtras = 351; -static const uint16 kWorkspace = 353; -static const uint16 kMapstore = 355; -static const uint16 kCharset1 = 357; -static const uint16 kBuffers = 359; -static const uint16 kMainsprites = 361; -static const uint16 kBackdrop = 363; -static const uint16 kMapdata = 365; -static const uint16 kSounddata = 367; -static const uint16 kSounddata2 = 369; -static const uint16 kRecordspace = 371; -static const uint16 kFreedat = 373; -static const uint16 kSetdat = 375; -static const uint16 kReel1 = 377; -static const uint16 kReel2 = 379; -static const uint16 kReel3 = 381; -static const uint16 kRoomdesc = 383; -static const uint16 kFreedesc = 385; -static const uint16 kSetdesc = 387; -static const uint16 kBlockdesc = 389; -static const uint16 kSetframes = 391; -static const uint16 kFreeframes = 393; -static const uint16 kPeople = 395; -static const uint16 kReels = 397; -static const uint16 kCommandtext = 399; -static const uint16 kPuzzletext = 401; -static const uint16 kTraveltext = 403; -static const uint16 kTempgraphics = 405; -static const uint16 kTempgraphics2 = 407; -static const uint16 kTempgraphics3 = 409; -static const uint16 kTempsprites = 411; -static const uint16 kTextfile1 = 413; -static const uint16 kTextfile2 = 415; -static const uint16 kTextfile3 = 417; -static const uint16 kBlinkframe = 419; -static const uint16 kBlinkcount = 420; -static const uint16 kReasseschanges = 421; -static const uint16 kPointerspath = 422; -static const uint16 kManspath = 423; -static const uint16 kPointerfirstpath = 424; -static const uint16 kFinaldest = 425; -static const uint16 kDestination = 426; -static const uint16 kLinestartx = 427; -static const uint16 kLinestarty = 429; -static const uint16 kLineendx = 431; -static const uint16 kLineendy = 433; -static const uint16 kLinepointer = 435; -static const uint16 kLinedirection = 436; -static const uint16 kLinelength = 437; -static const uint16 kLiftsoundcount = 438; -static const uint16 kCh0blockstocopy = 439; -static const uint16 kCh0playing = 441; -static const uint16 kCh0repeat = 442; -static const uint16 kCh1playing = 443; -static const uint16 kCh1blockstocopy = 444; -static const uint16 kSoundbufferwrite = 446; -static const uint16 kCurrentsample = 448; -static const uint16 kRoomssample = 449; -static const uint16 kReelroutines = 450; -static const uint16 kBasicsample = 907; -static const uint16 kCurrentfile = 1056; -static const uint16 kRoomscango = 1180; -static const uint16 kRoompics = 1196; -static const uint16 kOplist = 1211; -static const uint16 kInputline = 1214; -static const uint16 kPresslist = 1342; -static const uint16 kQuitrequested = 1348; -static const uint16 kSubtitles = 1349; -static const uint16 kForeignrelease = 1350; +static const uint16 kCurslocx = 296; +static const uint16 kCurslocy = 298; +static const uint16 kCurpos = 300; +static const uint16 kMonadx = 302; +static const uint16 kMonady = 304; +static const uint16 kMonsource = 306; +static const uint16 kNumtodo = 308; +static const uint16 kTimecount = 310; +static const uint16 kCounttotimed = 312; +static const uint16 kTimedseg = 314; +static const uint16 kTimedoffset = 316; +static const uint16 kTimedy = 318; +static const uint16 kTimedx = 319; +static const uint16 kNeedtodumptimed = 320; +static const uint16 kLoadingorsave = 321; +static const uint16 kCurrentslot = 322; +static const uint16 kCursorpos = 323; +static const uint16 kColourpos = 324; +static const uint16 kFadedirection = 325; +static const uint16 kNumtofade = 326; +static const uint16 kFadecount = 327; +static const uint16 kAddtogreen = 328; +static const uint16 kAddtored = 329; +static const uint16 kAddtoblue = 330; +static const uint16 kLastsoundreel = 331; +static const uint16 kSpeechloaded = 333; +static const uint16 kSpeechlength = 334; +static const uint16 kVolume = 336; +static const uint16 kVolumeto = 337; +static const uint16 kVolumedirection = 338; +static const uint16 kVolumecount = 339; +static const uint16 kWongame = 340; +static const uint16 kLasthardkey = 341; +static const uint16 kBufferin = 342; +static const uint16 kBufferout = 344; +static const uint16 kExtras = 346; +static const uint16 kWorkspace = 348; +static const uint16 kMapstore = 350; +static const uint16 kCharset1 = 352; +static const uint16 kBuffers = 354; +static const uint16 kMainsprites = 356; +static const uint16 kBackdrop = 358; +static const uint16 kMapdata = 360; +static const uint16 kSounddata = 362; +static const uint16 kSounddata2 = 364; +static const uint16 kRecordspace = 366; +static const uint16 kFreedat = 368; +static const uint16 kSetdat = 370; +static const uint16 kReel1 = 372; +static const uint16 kReel2 = 374; +static const uint16 kReel3 = 376; +static const uint16 kRoomdesc = 378; +static const uint16 kFreedesc = 380; +static const uint16 kSetdesc = 382; +static const uint16 kBlockdesc = 384; +static const uint16 kSetframes = 386; +static const uint16 kFreeframes = 388; +static const uint16 kPeople = 390; +static const uint16 kReels = 392; +static const uint16 kCommandtext = 394; +static const uint16 kPuzzletext = 396; +static const uint16 kTraveltext = 398; +static const uint16 kTempgraphics = 400; +static const uint16 kTempgraphics2 = 402; +static const uint16 kTempgraphics3 = 404; +static const uint16 kTempsprites = 406; +static const uint16 kTextfile1 = 408; +static const uint16 kTextfile2 = 410; +static const uint16 kTextfile3 = 412; +static const uint16 kBlinkframe = 414; +static const uint16 kBlinkcount = 415; +static const uint16 kReasseschanges = 416; +static const uint16 kPointerspath = 417; +static const uint16 kManspath = 418; +static const uint16 kPointerfirstpath = 419; +static const uint16 kFinaldest = 420; +static const uint16 kDestination = 421; +static const uint16 kLinestartx = 422; +static const uint16 kLinestarty = 424; +static const uint16 kLineendx = 426; +static const uint16 kLineendy = 428; +static const uint16 kLinepointer = 430; +static const uint16 kLinedirection = 431; +static const uint16 kLinelength = 432; +static const uint16 kCh0blockstocopy = 433; +static const uint16 kCh0playing = 435; +static const uint16 kCh0repeat = 436; +static const uint16 kCh1playing = 437; +static const uint16 kCh1blockstocopy = 438; +static const uint16 kSoundbufferwrite = 440; +static const uint16 kCurrentsample = 442; +static const uint16 kRoomssample = 443; +static const uint16 kReelroutines = 444; +static const uint16 kBasicsample = 901; +static const uint16 kCurrentfile = 1050; +static const uint16 kRoomscango = 1174; +static const uint16 kRoompics = 1190; +static const uint16 kOplist = 1205; +static const uint16 kInputline = 1208; +static const uint16 kPresslist = 1336; +static const uint16 kQuitrequested = 1342; +static const uint16 kSubtitles = 1343; +static const uint16 kForeignrelease = 1344; static const uint16 kBlocktextdat = (0); static const uint16 kPersonframes = (0); static const uint16 kDebuglevel1 = (0); @@ -417,8 +413,8 @@ static const uint16 kListofchanges = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768 static const uint16 kUndertimedtext = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)); static const uint16 kRainlist = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)); static const uint16 kInitialreelrouts = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)); -static const uint16 kInitialvars = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+907-450); -static const uint16 kLengthofbuffer = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+907-450+68-0); +static const uint16 kInitialvars = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+901-444); +static const uint16 kLengthofbuffer = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+901-444+68-0); static const uint16 kReellist = (0+(36*144)); static const uint16 kIntext = (0+(38*2)); static const uint16 kLengthofmap = (0+(66*60)); @@ -469,7 +465,7 @@ static const uint16 kKeypady = (72); static const uint16 kZoomx = (8); static const uint16 kInventx = (80); static const uint16 kMenux = (80+40); -static const uint16 kLenofreelrouts = (907-450); +static const uint16 kLenofreelrouts = (901-444); static const uint16 kHeaderlen = (96); -- cgit v1.2.3 From 93bf275f4c9ef168ceab23a07a1219d2c78b65ec Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 15 Dec 2011 12:15:22 +0200 Subject: DREAMWEB: Port 'helicopter' to C++ --- engines/dreamweb/dreamgen.cpp | 65 ------------------------------------------- engines/dreamweb/dreamgen.h | 1 - engines/dreamweb/people.cpp | 52 ++++++++++++++++++++++++++++++++-- engines/dreamweb/stubs.h | 1 + 4 files changed, 51 insertions(+), 68 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index dfeda18d6c..2ee3d512cd 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -26,71 +26,6 @@ namespace DreamGen { -void DreamGenContext::helicopter() { - STACK_CHECK; - ax = es.word(bx+3); - _cmp(ax, 203); - if (flags.z()) - goto heliwon; - checkSpeed(); - if (!flags.z()) - goto helispeed; - ax = es.word(bx+3); - _inc(ax); - _cmp(ax, 53); - if (!flags.z()) - goto notbeforehdead; - _inc(data.byte(kCombatcount)); - _cmp(data.byte(kCombatcount), 8); - if (flags.c()) - goto waitabit; - data.byte(kMandead) = 2; -waitabit: - ax = 49; - goto gotheliframe; -notbeforehdead: - _cmp(ax, 9); - if (!flags.z()) - goto gotheliframe; - _dec(ax); - _cmp(data.byte(kLastweapon), 1); - if (!flags.z()) - goto notgunonheli; - data.byte(kLastweapon) = -1; - ax = 55; - goto gotheliframe; -notgunonheli: - ax = 5; - _inc(data.byte(kCombatcount)); - _cmp(data.byte(kCombatcount), 20); - if (!flags.z()) - goto gotheliframe; - data.byte(kCombatcount) = 0; - ax = 9; -gotheliframe: - es.word(bx+3) = ax; -helispeed: - showGameReel(); - al = data.byte(kMapx); - es.byte(bx+1) = al; - ax = es.word(bx+3); - _cmp(ax, 9); - if (!flags.c()) - goto notwaitingheli; - _cmp(data.byte(kCombatcount), 7); - if (flags.c()) - goto notwaitingheli; - data.byte(kPointermode) = 2; - data.word(kWatchingtime) = 0; - return; -notwaitingheli: - data.byte(kPointermode) = 0; - data.word(kWatchingtime) = 2; - return; -heliwon: - data.byte(kPointermode) = 0; -} - void DreamGenContext::mugger() { STACK_CHECK; ax = es.word(bx+3); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index e530a3b968..582caa712f 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -530,7 +530,6 @@ public: void findAllOpen(); void showSlots(); void deleteExObject(); - void helicopter(); void getEitherAd(); void setPickup(); void dropObject(); diff --git a/engines/dreamweb/people.cpp b/engines/dreamweb/people.cpp index 99a83f44d3..e060df9fcc 100644 --- a/engines/dreamweb/people.cpp +++ b/engines/dreamweb/people.cpp @@ -42,7 +42,7 @@ static void (DreamGenContext::*reelCallbacks[57])() = { NULL, &DreamGenContext::poolGuard, NULL, &DreamGenContext::businessMan, NULL, NULL, - &DreamGenContext::mugger, &DreamGenContext::helicopter, + &DreamGenContext::mugger, NULL, NULL, NULL, NULL, NULL, NULL, NULL, @@ -74,7 +74,7 @@ static void (DreamGenContext::*reelCallbacksCPP[57])(ReelRoutine &) = { &DreamGenContext::copper, /*&DreamGenContext::poolGuard*/NULL, &DreamGenContext::rockstar, /*&DreamGenContext::businessMan*/NULL, &DreamGenContext::train, &DreamGenContext::genericPerson /*aide*/, - /*&DreamGenContext::mugger*/NULL, /*&DreamGenContext::helicopter*/NULL, + /*&DreamGenContext::mugger*/NULL, &DreamGenContext::helicopter, &DreamGenContext::introMagic1, &DreamGenContext::introMusic, &DreamGenContext::introMagic2, &DreamGenContext::candles2, &DreamGenContext::gates, &DreamGenContext::introMagic3, @@ -859,4 +859,52 @@ void DreamGenContext::heavy(ReelRoutine &routine) { addToPeopleList(&routine); } +void DreamGenContext::helicopter(ReelRoutine &routine) { + if (routine.reelPointer() == 203) { + // Won helicopter + data.byte(kPointermode) = 0; + return; + } + + if (checkSpeed(routine)) { + uint16 nextReelPointer = routine.reelPointer() + 1; + if (nextReelPointer == 53) { + // Before killing helicopter + data.byte(kCombatcount)++; + if (data.byte(kCombatcount) != 8) + data.byte(kMandead) = 2; + nextReelPointer = 49; + } else if (nextReelPointer == 9) { + nextReelPointer--; + if (data.byte(kLastweapon) == 1) { + data.byte(kLastweapon) = (byte)-1; + nextReelPointer = 55; + } else { + nextReelPointer = 5; + data.byte(kCombatcount)++; + if (data.byte(kCombatcount) == 20) { + data.byte(kCombatcount) = 0; + nextReelPointer = 9; + } + } + } else { + // Not waiting helicopter + data.byte(kPointermode) = 0; + data.word(kWatchingtime) = 2; + } + + routine.setReelPointer(nextReelPointer); + } + + showGameReel(&routine); + routine.mapX = data.byte(kMapx); + if (routine.reelPointer() == 9 && data.byte(kCombatcount) != 7) { + data.byte(kPointermode) = 2; + data.word(kWatchingtime) = 0; + } else { + data.byte(kPointermode) = 0; + data.word(kWatchingtime) = 2; + } +} + } // End of namespace DreamGen diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 3413c5eef0..8218a1ac0f 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -418,6 +418,7 @@ void receptionist(ReelRoutine &routine); void bartender(ReelRoutine &routine); void heavy(ReelRoutine &routine); + void helicopter(ReelRoutine &routine); void singleKey(uint8 key, uint16 x, uint16 y); void loadSaveBox(); void loadKeypad(); -- cgit v1.2.3 From 1f348745b00bb2f3fc3bc37d30221ab2f229b28d Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 15 Dec 2011 12:24:48 +0200 Subject: DREAMWEB: Fix regression in describeOb() --- engines/dreamweb/stubs.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index e721d482db..0c57d0d767 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -3402,11 +3402,12 @@ void DreamGenContext::describeOb() { if (data.byte(kForeignrelease) && data.byte(kObjecttype) == 1) y = 82; data.word(kCharshift) = 91 + 91; - printDirect(obText, 33, y, 241, 241 & 1); + printDirect(&obText, 33, &y, 241, 241 & 1); data.word(kCharshift) = 0; + y = 104; if (data.byte(kForeignrelease) && data.byte(kObjecttype) == 1) y = 94; - printDirect(obText, 36, y, 241, 241 & 1); + printDirect(&obText, 36, &y, 241, 241 & 1); obsThatDoThings(); // Additional text -- cgit v1.2.3 From d97d8b1d06e4ca0d6fdc5ff7a2c8f6f44d361585 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 15 Dec 2011 21:28:01 +1100 Subject: TSAGE: Implemented R2R Scene 250 - Lift --- engines/tsage/ringworld2/ringworld2_logic.cpp | 7 +- engines/tsage/ringworld2/ringworld2_scenes0.cpp | 306 ++++++++++++++++++++++++ engines/tsage/ringworld2/ringworld2_scenes0.h | 29 +++ 3 files changed, 340 insertions(+), 2 deletions(-) (limited to 'engines') diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index b93e9c202a..b3cbd86412 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -56,12 +56,15 @@ Scene *Ringworld2Game::createScene(int sceneNumber) { case 180: error("Missing scene %d from group 0", sceneNumber); case 200: - // Ship Corridor + // Deck #2 - By Lift return new Scene200(); case 205: - case 250: error("Missing scene %d from group 0", sceneNumber); + case 250: + // Lift + return new Scene250(); case 300: + // Bridge return new Scene300(); case 325: error("Missing scene %d from group 0", sceneNumber); diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index 61e3f8e00b..1c25c896a6 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -1443,6 +1443,312 @@ void Scene200::signal() { } } +/*-------------------------------------------------------------------------- + * Scene 250 - Lift + * + *--------------------------------------------------------------------------*/ + +Scene250::Button::Button(): SceneActor() { + _floorNumber = _v2 = 0; +} + +void Scene250::Button::synchronize(Serializer &s) { + SceneActor::synchronize(s); + + s.syncAsSint16LE(_floorNumber); + s.syncAsSint16LE(_v2); +} + +bool Scene250::Button::startAction(CursorType action, Event &event) { + Scene250 *scene = (Scene250 *)R2_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + if (scene->_field414) { + SceneItem::display2(250, 15); + } else { + switch (_floorNumber) { + case 1: + case 2: + case 5: + case 9: + scene->_sound1.play(14); + scene->changeFloor(_floorNumber); + break; + case 10: + // Current Floor + scene->_sound1.play(14); + R2_GLOBALS._sceneManager.changeScene(R2_GLOBALS._sceneManager._previousScene); + break; + default: + SceneItem::display2(250, 16); + break; + } + } + return true; + + case CURSOR_LOOK: + switch (_floorNumber) { + case 1: + case 2: + case 5: + case 9: + SceneItem::display2(250, 12); + break; + case 10: + SceneItem::display2(250, 13); + break; + case 11: + SceneItem::display2(250, 14); + break; + default: + SceneItem::display2(250, 16); + break; + } + return true; + + default: + return SceneActor::startAction(action, event); + } +} + +void Scene250::Button::setFloor(int floorNumber) { + SceneActor::postInit(); + _floorNumber = floorNumber; + _v2 = 0; + + if (_floorNumber <= 9) { + SceneObject::setup(250, 1, 4); + + switch (_floorNumber) { + case 1: + case 2: + case 5: + case 9: + setFrame(6); + break; + default: + break; + } + + setPosition(Common::Point(111, (_floorNumber - 1) * 12 + 43)); + fixPriority(10); + setDetails(250, -1, -1, -1, 1, NULL); + } +} + +/*--------------------------------------------------------------------------*/ + +Scene250::Scene250(): SceneExt() { + _field412 = _field414 = _field416 = _field418 = _field41A = 0; +} + +void Scene250::synchronize(Serializer &s) { + SceneExt::synchronize(s); + + s.syncAsSint16LE(_field412); + s.syncAsSint16LE(_field414); + s.syncAsSint16LE(_field416); + s.syncAsSint16LE(_field418); + s.syncAsSint16LE(_field41A); +} + +void Scene250::postInit(SceneObjectList *OwnerList) { + SceneExt::postInit(); + loadScene(250); + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.setVisage(10); + R2_GLOBALS._player.hide(); + R2_GLOBALS._player.enableControl(); + R2_GLOBALS._player._canWalk = false; + + _currentFloor.setFloor(10); + _currentFloor.setup(250, 1, 5); + _currentFloor.setDetails(250, 13, -1, -1, 1, NULL); + + _button1.setFloor(11); + _button1.setup(250, 1, 3); + _button1.setPosition(Common::Point(400, 100)); + _button1.setDetails(250, 14, -1, -1, 1, NULL); + _button1.fixPriority(190); + _button1.hide(); + + _floor1.setFloor(1); + _floor2.setFloor(2); + _floor3.setFloor(3); + _floor4.setFloor(4); + _floor5.setFloor(5); + _floor6.setFloor(6); + _floor7.setFloor(7); + _floor8.setFloor(8); + _floor9.setFloor(9); + + _item2.setDetails(Rect(0, 0, 73, SCREEN_HEIGHT), 250, 9, -1, 9, 1, NULL); + _item4.setDetails(Rect(239, 16, 283, 164), 250, 6, -1, -1, 1, NULL); + _background.setDetails(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 250, 0, 1, -1, 1, NULL); + + R2_GLOBALS._events.setCursor(CURSOR_USE); + + switch (R2_GLOBALS._sceneManager._previousScene) { + case 200: + _field412 = 55; + break; + case 300: + _field412 = 43; + break; + case 700: + _field412 = 139; + break; + case 850: + _field412 = 91; + break; + default: + R2_GLOBALS._sceneManager._previousScene = 200; + _field412 = 55; + break; + } + + _currentFloor.setPosition(Common::Point(111, _field412)); +} + +void Scene250::signal() { + if (_field41A) + _sceneMode = 20; + + switch (_sceneMode) { + case 1: + _sound1.play(22); + R2_GLOBALS._player.show(); + R2_GLOBALS._player.setup(250, 1, 2); + R2_GLOBALS._player.setPosition(Common::Point(261, 185)); + ADD_MOVER(R2_GLOBALS._player, 261, 15); + + _field416 = 0; + _sceneMode = 2; + break; + case 2: + _sceneMode = ((_field414 - 12) == _field412) ? 4 : 3; + signal(); + break; + case 3: + _currentFloor.setPosition(Common::Point(111, _currentFloor._position.y + 12)); + _field412 += 12; + R2_GLOBALS._player.setPosition(Common::Point(261, 185)); + ADD_MOVER(R2_GLOBALS._player, 261, 15); + + if ((_field414 - 12) == _field412) + _sceneMode = 4; + break; + case 4: + _sound1.play(21); + + _currentFloor.setPosition(Common::Point(111, _currentFloor._position.y + 12)); + R2_GLOBALS._player.setPosition(Common::Point(261, 185)); + ADD_MOVER(R2_GLOBALS._player, 261, 15); + _sceneMode = 5; + break; + case 5: + R2_GLOBALS._player.disableControl(); + _sceneMode = 20; + signal(); + break; + case 6: + _sound1.play(22); + R2_GLOBALS._player.show(); + R2_GLOBALS._player.setup(250, 1, 2); + R2_GLOBALS._player.setPosition(Common::Point(261, 15)); + ADD_MOVER(R2_GLOBALS._player, 261, 185); + _field416 = 0; + _sceneMode = 7; + break; + case 7: + _field418 = 1; + if ((_field414 + 12) == _field412) + _sceneMode = 8; + signal(); + break; + case 8: + _currentFloor.setPosition(Common::Point(111, _currentFloor._position.y - 12)); + _field412 -= 12; + R2_GLOBALS._player.setPosition(Common::Point(261, 15)); + ADD_MOVER(R2_GLOBALS._player, 261, 185); + + if ((_field414 + 12) == _field412) + _sceneMode = 9; + break; + case 9: + _sound1.play(21); + _currentFloor.setPosition(Common::Point(111, _currentFloor._position.y - 12)); + R2_GLOBALS._player.setPosition(Common::Point(261, 15)); + ADD_MOVER(R2_GLOBALS._player, 261, 185); + _sceneMode = 10; + break; + case 10: + _sceneMode = 20; + signal(); + break; + case 20: + // Handle changing scene + switch (_field414) { + case 55: + R2_GLOBALS._sceneManager.changeScene(200); + break; + case 43: + R2_GLOBALS._sceneManager.changeScene(300); + break; + case 139: + R2_GLOBALS._sceneManager.changeScene(139); + break; + case 91: + R2_GLOBALS._sceneManager.changeScene(91); + break; + default: + break; + } + break; + default: + break; + } +} + +void Scene250::changeFloor(int floorNumber) { + _field414 = (floorNumber - 1) * 12 + 43; + _button1.setPosition(Common::Point(111, _field414)); + _button1.show(); + + _sceneMode = (_field412 >= _field414) ? 6 : 1; + if (_field414 == _field412) + _sceneMode = 20; + + signal(); +} + +void Scene250::process(Event &event) { + if (!event.handled) { + if (((event.eventType == EVENT_KEYPRESS) || (event.btnState != 0)) && _field418) { + _field41A = 1; + event.handled = true; + } + + SceneExt::process(event); + } +} + +void Scene250::dispatch() { + SceneExt::dispatch(); + + if (((_sceneMode == 2) || (_sceneMode == 7)) && (_field416 < 100)) { + ++_field416; + R2_GLOBALS._player._moveDiff.y = _field416 / 5; + } + + if (((_sceneMode == 5) || (_sceneMode == 10)) && (R2_GLOBALS._player._moveDiff.y > 4)) { + --_field416; + R2_GLOBALS._player._moveDiff.y = _field416 / 7 + 3; + } +} + /*-------------------------------------------------------------------------- * Scene 300 - Bridge * diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.h b/engines/tsage/ringworld2/ringworld2_scenes0.h index 16133e81a0..a0c3f92668 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.h +++ b/engines/tsage/ringworld2/ringworld2_scenes0.h @@ -206,6 +206,35 @@ public: virtual void signal(); }; +class Scene250: public SceneExt { + class Button: public SceneActor { + public: + int _floorNumber, _v2; + Button(); + void setFloor(int floorNumber); + + virtual void synchronize(Serializer &s); + virtual bool startAction(CursorType action, Event &event); + }; +public: + int _field412, _field414, _field416, _field418, _field41A; + NamedHotspot _background, _item2, _item3, _item4; + Button _button1, _currentFloor; + Button _floor1, _floor2, _floor3, _floor4, _floor5; + Button _floor6, _floor7, _floor8, _floor9; + ASoundExt _sound1; + SequenceManager _sequenceManager1; +public: + Scene250(); + void changeFloor(int floorNumber); + + virtual void synchronize(Serializer &s); + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); + virtual void process(Event &event); + virtual void dispatch(); +}; + class Scene300: public SceneExt { /* Actions */ class Action1: public Action { -- cgit v1.2.3 From ee43bfed74f313115fc9cb537f614f26fa3d6fa2 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 15 Dec 2011 13:09:43 +0100 Subject: TSAGE: R2R - Implement Scene 2700 --- engines/tsage/ringworld2/ringworld2_logic.cpp | 32 +- engines/tsage/ringworld2/ringworld2_scenes2.cpp | 708 ++++++++++++++++++++++- engines/tsage/ringworld2/ringworld2_scenes2.h | 57 ++ engines/tsage/ringworld2/ringworld2_speakers.cpp | 90 +++ engines/tsage/ringworld2/ringworld2_speakers.h | 16 + 5 files changed, 875 insertions(+), 28 deletions(-) (limited to 'engines') diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index b3cbd86412..3e0d36be8d 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -108,51 +108,53 @@ Scene *Ringworld2Game::createScene(int sceneNumber) { /* Scene group #2 */ // case 2000: - // Maze + // Ice Maze return new Scene2000(); case 2350: - // Maze: Balloon Launch Platform + // Ice Maze: Balloon Launch Platform return new Scene2350(); case 2400: - // Maze: Large empty room + // Ice Maze: Large empty room return new Scene2400(); case 2425: - // Maze: + // Ice Maze: return new Scene2425(); case 2430: - // Maze: Bedroom + // Ice Maze: Bedroom return new Scene2430(); case 2435: - // Maze: Throne room + // Ice Maze: Throne room return new Scene2435(); case 2440: - // Maze: Another bedroom + // Ice Maze: Another bedroom return new Scene2440(); case 2445: - // Maze: + // Ice Maze: return new Scene2445(); case 2450: - // Maze: Another bedroom + // Ice Maze: Another bedroom return new Scene2450(); case 2455: - // Maze: Inside crevasse + // Ice Maze: Inside crevasse return new Scene2455(); case 2500: - // Maze: Large Cave + // Ice Maze: Large Cave return new Scene2500(); case 2525: - // Maze: Furnace room + // Ice Maze: Furnace room return new Scene2525(); case 2530: - // Maze: Well + // Ice Maze: Well return new Scene2530(); case 2535: - // Maze: Tannery + // Ice Maze: Tannery return new Scene2535(); case 2600: - // Maze: Exit + // Ice Maze: Exit return new Scene2600(); case 2700: + // Forest Maze + return new Scene2700(); case 2750: case 2800: case 2900: diff --git a/engines/tsage/ringworld2/ringworld2_scenes2.cpp b/engines/tsage/ringworld2/ringworld2_scenes2.cpp index b2e7b46420..a81aee41de 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes2.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes2.cpp @@ -30,7 +30,7 @@ namespace TsAGE { namespace Ringworld2 { /*-------------------------------------------------------------------------- - * Scene 2000 - Maze + * Scene 2000 - Ice Maze * *--------------------------------------------------------------------------*/ void Scene2000::initPlayer() { @@ -1222,7 +1222,7 @@ void Scene2350::process(Event &event) { } /*-------------------------------------------------------------------------- - * Scene 2400 - Maze: Large empty room + * Scene 2400 - Ice Maze: Large empty room * *--------------------------------------------------------------------------*/ void Scene2400::Exit1::changeScene() { @@ -1284,7 +1284,7 @@ void Scene2400::signal() { } /*-------------------------------------------------------------------------- - * Scene 2425 - Maze: + * Scene 2425 - Ice Maze: * *--------------------------------------------------------------------------*/ @@ -1499,7 +1499,7 @@ void Scene2425::signal() { } /*-------------------------------------------------------------------------- - * Scene 2430 - Maze: Bedroom + * Scene 2430 - Ice Maze: Bedroom * *--------------------------------------------------------------------------*/ @@ -1638,7 +1638,7 @@ void Scene2430::signal() { } /*-------------------------------------------------------------------------- - * Scene 2435 - Maze: Throne room + * Scene 2435 - Ice Maze: Throne room * *--------------------------------------------------------------------------*/ bool Scene2435::Actor1::startAction(CursorType action, Event &event) { @@ -1796,7 +1796,7 @@ void Scene2435::signal() { } /*-------------------------------------------------------------------------- - * Scene 2440 - Maze: Another bedroom + * Scene 2440 - Ice Maze: Another bedroom * *--------------------------------------------------------------------------*/ @@ -1909,7 +1909,7 @@ void Scene2440::signal() { } /*-------------------------------------------------------------------------- - * Scene 2445 - Maze: + * Scene 2445 - Ice Maze: * *--------------------------------------------------------------------------*/ void Scene2445::postInit(SceneObjectList *OwnerList) { @@ -1927,7 +1927,7 @@ void Scene2445::signal() { } /*-------------------------------------------------------------------------- - * Scene 2450 - Maze: Another bedroom + * Scene 2450 - Ice Maze: Another bedroom * *--------------------------------------------------------------------------*/ @@ -2219,7 +2219,7 @@ void Scene2450::signal() { } /*-------------------------------------------------------------------------- - * Scene 2455 - Maze: Inside crevasse + * Scene 2455 - Ice Maze: Inside crevasse * *--------------------------------------------------------------------------*/ @@ -2399,7 +2399,7 @@ void Scene2455::signal() { } /*-------------------------------------------------------------------------- - * Scene 2500 - Maze: Large Cave + * Scene 2500 - Ice Maze: Large Cave * *--------------------------------------------------------------------------*/ @@ -2644,7 +2644,7 @@ void Scene2525::signal() { } /*-------------------------------------------------------------------------- - * Scene 2530 - Maze: Well + * Scene 2530 - Ice Maze: Well * *--------------------------------------------------------------------------*/ bool Scene2530::Actor2::startAction(CursorType action, Event &event) { @@ -2801,7 +2801,7 @@ void Scene2530::signal() { } /*-------------------------------------------------------------------------- - * Scene 2535 - Maze: Tannery + * Scene 2535 - Ice Maze: Tannery * *--------------------------------------------------------------------------*/ @@ -2846,6 +2846,7 @@ bool Scene2535::Actor4::startAction(CursorType action, Event &event) { void Scene2535::Exit1::changeScene() { Scene2535 *scene = (Scene2535 *)R2_GLOBALS._sceneManager._scene; + _enabled = false; R2_GLOBALS._events.setCursor(CURSOR_ARROW); R2_GLOBALS._player.disableControl(); @@ -2984,7 +2985,7 @@ void Scene2535::signal() { } /*-------------------------------------------------------------------------- - * Scene 2600 - Maze: Exit + * Scene 2600 - Ice Maze: Exit * *--------------------------------------------------------------------------*/ Scene2600::Scene2600(): SceneExt() { @@ -3024,5 +3025,686 @@ void Scene2600::signal() { g_globals->_sceneManager.changeScene(3800); } +/*-------------------------------------------------------------------------- + * Scene 2700 - Forest Maze + * + *--------------------------------------------------------------------------*/ +Scene2700::Scene2700(): SceneExt() { + _field412 = _field414 = _field416 = 0; +} + +void Scene2700::synchronize(Serializer &s) { + SceneExt::synchronize(s); + + s.syncAsSint16LE(_field412); + s.syncAsSint16LE(_field414); + s.syncAsSint16LE(_field416); +} + +void Scene2700::Action1::signal() { + Scene2700 *scene = (Scene2700 *)R2_GLOBALS._sceneManager._scene; + + setDelay(600 + R2_GLOBALS._randomSource.getRandomNumber(300)); + scene->_actor2.animate(ANIM_MODE_5, NULL); +} + +void Scene2700::Action2::signal() { + Scene2700 *scene = (Scene2700 *)R2_GLOBALS._sceneManager._scene; + + setDelay(300 + R2_GLOBALS._randomSource.getRandomNumber(300)); + scene->_actor3.animate(ANIM_MODE_5, NULL); +} + +void Scene2700::Action3::signal() { + Scene2700 *scene = (Scene2700 *)R2_GLOBALS._sceneManager._scene; + + setDelay(450 + R2_GLOBALS._randomSource.getRandomNumber(450)); + scene->_actor4.animate(ANIM_MODE_8, 1, NULL); +} + +void Scene2700::Action4::signal() { + Scene2700 *scene = (Scene2700 *)R2_GLOBALS._sceneManager._scene; + + setDelay(300 + R2_GLOBALS._randomSource.getRandomNumber(300)); + scene->_actor5.animate(ANIM_MODE_8, 1, NULL); +} + +void Scene2700::Area1::process(Event &event) { + SceneArea::process(event); + if ((event.eventType == 1) && (R2_GLOBALS._player._canWalk) && (_bounds.contains(event.mousePos.x, event.mousePos.y))) { + Scene2700 *scene = (Scene2700 *)R2_GLOBALS._sceneManager._scene; + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 10; + scene->_field414 = 2703; + switch (scene->_field412) { + case 0: + // No break on purpose + case 6: + scene->_sceneMode = 2703; + scene->setAction(&scene->_sequenceManager, scene, 2703, &R2_GLOBALS._player, NULL); + break; + case 1: { + Common::Point pt(80, 137); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); + break; + } + case 2: { + Common::Point pt(155, 137); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); + break; + } + case 3: { + Common::Point pt(140, 162); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); + break; + } + case 4: { + Common::Point pt(155, 137); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); + break; + } + case 5: { + Common::Point pt(235, 132); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); + break; + } + default: + break; + } + } +} + +void Scene2700::Area2::process(Event &event) { + SceneArea::process(event); + if ((event.eventType == 1) && (R2_GLOBALS._player._canWalk) && (_bounds.contains(event.mousePos.x, event.mousePos.y))) { + Scene2700 *scene = (Scene2700 *)R2_GLOBALS._sceneManager._scene; + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 10; + scene->_field414 = 2704; + switch (scene->_field412) { + case 0: { + Common::Point pt(140, 162); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); + break; + } + case 1: { + Common::Point pt(80, 137); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); + break; + } + case 2: { + Common::Point pt(155, 137); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); + break; + } + case 3: { + Common::Point pt(155, 137); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); + break; + } + case 4: { + Common::Point pt(235, 132); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); + break; + } + case 5: + scene->_sceneMode = 2704; + scene->setAction(&scene->_sequenceManager, scene, 2704, &R2_GLOBALS._player, NULL); + break; + case 6: { + Common::Point pt(140, 162); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); + break; + } + default: + break; + } + } +} + +void Scene2700::postInit(SceneObjectList *OwnerList) { + loadScene(2700); + SceneExt::postInit(); + R2_GLOBALS._sound1.stop(); + R2_GLOBALS._sound2.stop(); + + _area1.setDetails(Rect(135, 160, 185, 168), SHADECURSOR_DOWN); + _area2.setDetails(Rect(300, 90, 320, 135), EXITCURSOR_E); + _rect1.set(70, 122, 90, 132); + _rect2.set(150, 122, 160, 132); + _rect3.set(90, 142, 130, 157); + _rect4.set(175, 137, 200, 147); + _rect5.set(280, 127, 300, 137); + _rect6.set(240, 157, 265, 167); + + _actor2.postInit(); + _actor2.setup(2700, 1, 1); + _actor2.setPosition(Common::Point(140, 29)); + _actor2.setAction(&_action1); + + _actor3.postInit(); + _actor3.setup(2700, 2, 1); + _actor3.setPosition(Common::Point(213, 32)); + _actor3.setAction(&_action2); + + _actor4.postInit(); + _actor4.setup(2700, 3, 1); + _actor4.setPosition(Common::Point(17, 39)); + _actor4.setAction(&_action3); + + _actor5.postInit(); + _actor5.setup(2700, 5, 1); + _actor5.setPosition(Common::Point(17, 71)); + _actor5.setAction(&_action4); + + _item2.setDetails(Rect(52, 38, 68, 60), 2700, 4, -1, 6, 1, NULL); + _item3.setDetails(Rect(113, 22, 127, 33), 2700, 4, -1, 6, 1, NULL); + _item4.setDetails(Rect(161, 44, 170, 52), 2700, 4, -1, 6, 1, NULL); + _item5.setDetails(Rect(221, 19, 233, 31), 2700, 4, -1, 6, 1, NULL); + _item6.setDetails(Rect(235, 59, 250, 75), 2700, 4, -1, 6, 1, NULL); + _item1.setDetails(Rect(0, 0, 320, 200), 2700, 4, -1, 6, 1, NULL); + + _stripManager.setColors(60, 255); + _stripManager.setFontNumber(3); + _stripManager.addSpeaker(&_quinnSpeaker); + _stripManager.addSpeaker(&_nejSpeaker); + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.setVisage(19); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player._moveDiff = Common::Point(2, 2); + R2_GLOBALS._player.disableControl(); + + if (R2_INVENTORY.getObjectScene(36) == 0) + R2_GLOBALS._sound1.changeSound(234); + + if (R2_GLOBALS._sceneManager._previousScene == 2750) { + _sceneMode = 2702; + _field412 = 5; + setAction(&_sequenceManager, this, 2702, &R2_GLOBALS._player, NULL); + } else { + _field412 = 0; + if (R2_GLOBALS._sceneManager._previousScene == 3900) { + _sceneMode = 2701; + setAction(&_sequenceManager, this, 2701, &R2_GLOBALS._player, NULL); + } else { + R2_GLOBALS._player.setStrip(3); + R2_GLOBALS._player.setPosition(Common::Point(164, 160)); + R2_GLOBALS._player.enableControl(); + } + } +} + +void Scene2700::signal() { + switch (_sceneMode) { + case 10: + switch (_field414) { + case 1: + switch (_field412) { + case 0: + case 2: + case 4: + case 6: + _field412 = 3; + R2_GLOBALS._player.setAction(&_sequenceManager, this, 2705, &R2_GLOBALS._player, NULL); + break; + case 3: { + _sceneMode = _field414; + _field412 = 1; + Common::Point pt(80, 127); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + break; + } + case 5: + _field412 = 4; + R2_GLOBALS._player.setAction(&_sequenceManager, this, 2708, &R2_GLOBALS._player, NULL); + break; + default: // includes case 1 + break; + } + break; + case 2: + switch (_field412) { + case 0: + case 1: + case 6: + _field412 = 3; + R2_GLOBALS._player.setAction(&_sequenceManager, this, 2706, &R2_GLOBALS._player, NULL); + break; + case 3: + case 4: { + _sceneMode = _field414; + _field412 = 2; + Common::Point pt(155, 127); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + break; + } + case 5: + _field412 = 4; + R2_GLOBALS._player.setAction(&_sequenceManager, this, 2708, &R2_GLOBALS._player, NULL); + break; + default: // includes case 2 + break; + } + break; + case 3: + switch (_field412) { + case 0: + case 1: + case 2: + case 4: + case 6: { + _sceneMode = _field414; + _field412 = 3; + Common::Point pt(115, 152); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + break; + } + case 5: + _field412 = 4; + R2_GLOBALS._player.setAction(&_sequenceManager, this, 2708, &R2_GLOBALS._player, NULL); + break; + default: // includes case 3 + break; + } + break; + case 4: + switch (_field412) { + case 0: + case 1: + case 6: + _field412 = 3; + R2_GLOBALS._player.setAction(&_sequenceManager, this, 2706, &R2_GLOBALS._player, NULL); + break; + case 2: + case 3: + _field412 = 4; + R2_GLOBALS._player.setAction(&_sequenceManager, this, 2709, &R2_GLOBALS._player, NULL); + break; + case 4: + case 5: + _sceneMode = _field414; + R2_GLOBALS._player.setAction(&_sequenceManager, this, 2704, &R2_GLOBALS._player, NULL); + break; + default: + break; + } + break; + case 5: + switch (_field412) { + case 0: + case 1: + case 6: + _field412 = 3; + R2_GLOBALS._player.setAction(&_sequenceManager, this, 2706, &R2_GLOBALS._player, NULL); + break; + case 2: + case 3: + _field412 = 4; + R2_GLOBALS._player.setAction(&_sequenceManager, this, 2709, &R2_GLOBALS._player, NULL); + break; + case 4: { + _sceneMode = _field414; + _field412 = 5; + Common::Point pt(285, 132); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + break; + } + default: // includes case 5 + break; + } + break; + case 6: + switch (_field412) { + case 0: + case 3: { + _sceneMode = _field414; + _field412 = 6; + Common::Point pt(250, 162); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + break; + } + case 1: + case 2: + case 4: + _field412 = 3; + R2_GLOBALS._player.setAction(&_sequenceManager, this, 2707, &R2_GLOBALS._player, NULL); + break; + case 5: + _field412 = 4; + R2_GLOBALS._player.setAction(&_sequenceManager, this, 2708, &R2_GLOBALS._player, NULL); + break; + default: + break; + } + break; + case 2703: + switch (_field412) { + case 0: + case 3: + case 6: + _sceneMode = _field414; + setAction(&_sequenceManager, this, 2703, &R2_GLOBALS._player, NULL); + break; + case 1: + case 2: + case 4: + _field412 = 3; + R2_GLOBALS._player.setAction(&_sequenceManager, this, 2707, &R2_GLOBALS._player, NULL); + break; + case 5: + _field412 = 4; + R2_GLOBALS._player.setAction(&_sequenceManager, this, 2708, &R2_GLOBALS._player, NULL); + break; + default: + break; + } + break; + case 2704: + switch (_field412) { + case 0: + case 1: + case 6: + _field412 = 3; + R2_GLOBALS._player.setAction(&_sequenceManager, this, 2706, &R2_GLOBALS._player, NULL); + break; + case 2: + case 3: + _field412 = 4; + R2_GLOBALS._player.setAction(&_sequenceManager, this, 2709, &R2_GLOBALS._player, NULL); + break; + case 4: + case 5: + _sceneMode = _field414; + R2_GLOBALS._player.setAction(&_sequenceManager, this, 2704, &R2_GLOBALS._player, NULL); + break; + default: + break; + } + break; + case 2710: + switch (_field412) { + case 0: + case 1: + case 3: + _field412 = 3; + R2_GLOBALS._player.setAction(&_sequenceManager, this, 2707, &R2_GLOBALS._player, NULL); + break; + case 2: + case 5: { + _sceneMode = _field414; + Common::Point pt(164, 160); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + break; + } + case 4: + _field412 = 4; + R2_GLOBALS._player.setAction(&_sequenceManager, this, 2708, &R2_GLOBALS._player, NULL); + break; + default: + break; + } + break; + default: + break; + } + break; + case 11: + R2_INVENTORY.setObjectScene(36, 0); + R2_GLOBALS._player.disableControl(); + _field412 = 0; + _sceneMode = 2700; + setAction(&_sequenceManager, this, 2700, &_actor1, NULL); + break; + case 12: + R2_GLOBALS._sound1.play(234); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + _sceneMode = 2711; + _stripManager.start(_field416, this); + break; + case 13: + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + _sceneMode = 2712; + _stripManager.start(_field416, this); + break; + case 14: + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + _sceneMode = 2713; + _stripManager.start(_field416, this); + break; + case 15: + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + _sceneMode = 11; + _stripManager.start(_field416, this); + break; + case 2700: + _actor1.remove(); + R2_GLOBALS._player.enableControl(CURSOR_ARROW); + break; + case 2703: + g_globals->_sceneManager.changeScene(3900); + break; + case 2704: + g_globals->_sceneManager.changeScene(2750); + break; + case 2710: + _field416 = 1200; + _sceneMode = 12; + _actor1.postInit(); + setAction(&_sequenceManager, this, 2710, &R2_GLOBALS._player, &_actor1, NULL); + break; + case 2711: + R2_GLOBALS._player.disableControl(); + _field416 = 1201; + _sceneMode = 13; + setAction(&_sequenceManager, this, 2711, &R2_GLOBALS._player, &_actor1, NULL); + break; + case 2712: + R2_GLOBALS._player.disableControl(); + _field416 = 1202; + _sceneMode = 14; + setAction(&_sequenceManager, this, 2712, &R2_GLOBALS._player, &_actor1, NULL); + break; + case 2713: + R2_GLOBALS._player.disableControl(); + _field416 = 1203; + _sceneMode = 14; + setAction(&_sequenceManager, this, 2713, &R2_GLOBALS._player, &_actor1, NULL); + break; + default: + R2_GLOBALS._player.enableControl(CURSOR_ARROW); + break; + } +} +void Scene2700::process(Event &event) { + if ((R2_GLOBALS._player._canWalk) && (event.eventType == EVENT_BUTTON_DOWN)) { + if (R2_GLOBALS._events.getCursor() == R2_36) { + if (R2_GLOBALS._player._bounds.contains(event.mousePos.x, event.mousePos.y)) { + _sceneMode = 10; + _field414 = 2710; + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + switch (_field412) { + case 0: { + _sceneMode = 2710; + Common::Point pt(164, 160); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + break; + } + case 1: { + Common::Point pt(80, 137); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + break; + } + case 2: { + Common::Point pt(155, 137); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + break; + } + case 3: { + Common::Point pt(140, 162); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + break; + } + case 4: { + Common::Point pt(155, 137); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + break; + } + case 5: { + Common::Point pt(235, 132); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + break; + } + case 6: { + Common::Point pt(205, 162); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + break; + } + default: + break; + } + event.handled = true; + } else { + SceneItem::display(2700, 3, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + } + } else if (R2_GLOBALS._events.getCursor() == R2_NEGATOR_GUN) { + if (_rect1.contains(event.mousePos.x, event.mousePos.y)) { + if (!_rect1.contains(R2_GLOBALS._player._position.x, R2_GLOBALS._player._position.y)) { + event.handled = true; + _sceneMode = 10; + _field414 = 1; + } + } else if (_rect2.contains(event.mousePos.x, event.mousePos.y)) { + if (!_rect2.contains(R2_GLOBALS._player._position.x, R2_GLOBALS._player._position.y)) { + event.handled = true; + _sceneMode = 10; + _field414 = 2; + } + } else if (_rect3.contains(event.mousePos.x, event.mousePos.y)) { + if (!_rect3.contains(R2_GLOBALS._player._position.x, R2_GLOBALS._player._position.y)) { + event.handled = true; + _sceneMode = 10; + _field414 = 3; + } + } else if (_rect4.contains(event.mousePos.x, event.mousePos.y)) { + if (!_rect4.contains(R2_GLOBALS._player._position.x, R2_GLOBALS._player._position.y)) { + event.handled = true; + _sceneMode = 10; + _field414 = 4; + } + } else if (_rect5.contains(event.mousePos.x, event.mousePos.y)) { + if (!_rect5.contains(R2_GLOBALS._player._position.x, R2_GLOBALS._player._position.y)) { + event.handled = true; + _sceneMode = 10; + _field414 = 5; + } + } else if (_rect6.contains(event.mousePos.x, event.mousePos.y)) { + if (!_rect6.contains(R2_GLOBALS._player._position.x, R2_GLOBALS._player._position.y)) { + event.handled = true; + _sceneMode = 10; + _field414 = 6; + } + } else { + event.handled = true; + R2_GLOBALS._player.updateAngle(Common::Point(event.mousePos.x, event.mousePos.y)); + } + if (_sceneMode = 10) { + R2_GLOBALS._player.disableControl(); + switch (_field412) { + case 0: + if (_field414 >= 6) { + Common::Point pt(205, 162); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } else { + Common::Point pt(140, 162); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 1: { + Common::Point pt(80, 137); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + break; + } + case 2: { + Common::Point pt(155, 137); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + break; + } + case 3: + if (_field414 == 1) { + Common::Point pt(80, 137); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } else if (_field414 == 6) { + Common::Point pt(140, 162); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } else { + Common::Point pt(155, 137); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 4: + if (_field414 == 5) { + Common::Point pt(235, 132); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } else { + Common::Point pt(155, 137); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 5: { + Common::Point pt(235, 132); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + break; + } + case 6: { + Common::Point pt(140, 162); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + break; + } + default: + break; + } + } + } + } + Scene::process(event); +} + } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_scenes2.h b/engines/tsage/ringworld2/ringworld2_scenes2.h index 8684078860..83fb7b3cfb 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes2.h +++ b/engines/tsage/ringworld2/ringworld2_scenes2.h @@ -490,6 +490,63 @@ public: virtual void signal(); }; +class Scene2700 : public SceneExt { + class Action1: public Action { + public: + void signal(); + }; + class Action2: public Action { + public: + void signal(); + }; + class Action3: public Action { + public: + void signal(); + }; + class Action4: public Action { + public: + void signal(); + }; + + class Area1: public SceneArea { + public: + void process(Event &event); + }; + class Area2: public SceneArea { + public: + void process(Event &event); + }; +public: + VisualSpeaker _quinnSpeaker; + VisualSpeaker _nejSpeaker; + NamedHotspot _item1; + NamedHotspot _item2; + NamedHotspot _item3; + NamedHotspot _item4; + NamedHotspot _item5; + NamedHotspot _item6; + SceneActor _actor1; + SceneActor _actor2; + SceneActor _actor3; + SceneActor _actor4; + SceneActor _actor5; + Action1 _action1; + Action2 _action2; + Action3 _action3; + Action4 _action4; + Area1 _area1; + Area2 _area2; + Rect _rect1, _rect2, _rect3, _rect4, _rect5, _rect6; + SequenceManager _sequenceManager; + int _field412, _field414, _field416; + + Scene2700(); + virtual void synchronize(Serializer &s); + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); + virtual void process(Event &event); +}; + } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_speakers.cpp b/engines/tsage/ringworld2/ringworld2_speakers.cpp index cff7334090..b3120f8af6 100644 --- a/engines/tsage/ringworld2/ringworld2_speakers.cpp +++ b/engines/tsage/ringworld2/ringworld2_speakers.cpp @@ -739,5 +739,95 @@ SpeakerWebbster2500::SpeakerWebbster2500() { _numFrames = 0; } +SpeakerQuinn2700::SpeakerQuinn2700() { + _speakerName = "QUINN"; + _color1 = 60; + _color2 = 0; + _fieldF6 = 0; + _textWidth = 300; + _hideObjects = false; + _object2 = NULL; + _displayMode = 1; + _numFrames = 0; +} + +void SpeakerQuinn2700::proc15() { + int v = _fieldF6; + + if (!_object2) { + _object2 = &R2_GLOBALS._player; + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + if (v == 0) { + _object1.animate(ANIM_MODE_2, NULL); + } else { + ((SceneItem *)_action)->_sceneRegionId = 0; + switch (_object2->_visage) { + case 19: + _object1.setup(4022, 5, 1); + break; + case 2701: + _object1.setup(4022, 1, 1); + break; + default: + break; + } + _object1.animate(ANIM_MODE_5, this); + } +} + +SpeakerNej2700::SpeakerNej2700() { + _speakerName = "NEJ"; + _color1 = 171; + _color2 = 0; + _fieldF6 = 0; + _textWidth = 300; + _hideObjects = false; + _object2 = NULL; + _displayMode = 1; + _numFrames = 0; +} + +void SpeakerNej2700::proc15() { + int v = _fieldF6; + Scene2700 *scene = (Scene2700 *)R2_GLOBALS._sceneManager._scene; + + if (!_object2) { + _object2 = &scene->_actor1; + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + if (v == 0) { + _object1.animate(ANIM_MODE_2, NULL); + } else { + ((SceneItem *)_action)->_sceneRegionId = 0; + switch (_object2->_visage) { + case 2701: + _object1.setup(4022, 3, 1); + _object1.setPosition(Common::Point(164, 163)); + _object2->setPosition(Common::Point(-10, -10)); + break; + case 2705: + _object1.setup(4022, 7, 1); + _object1.fixPriority(162); + break; + default: + break; + } + _object1.animate(ANIM_MODE_5, this); + } +} + } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_speakers.h b/engines/tsage/ringworld2/ringworld2_speakers.h index b8ad17886a..7ffd24e6e7 100644 --- a/engines/tsage/ringworld2/ringworld2_speakers.h +++ b/engines/tsage/ringworld2/ringworld2_speakers.h @@ -205,6 +205,22 @@ public: virtual Common::String getClassName() { return "SpeakerWebbster2500"; } }; + +class SpeakerQuinn2700 : public VisualSpeaker { +public: + SpeakerQuinn2700(); + + virtual Common::String getClassName() { return "SpeakerQuinn2700"; } + virtual void proc15(); +}; + +class SpeakerNej2700 : public VisualSpeaker { +public: + SpeakerNej2700(); + + virtual Common::String getClassName() { return "SpeakerNej2700"; } + virtual void proc15(); +}; } // End of namespace Ringworld2 } // End of namespace TsAGE -- cgit v1.2.3 From 719f3ec1789005186c4cb86b10effa9ceee93866 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 15 Dec 2011 10:54:28 +0100 Subject: DREAMWEB: Convert a bunch of stuff to C++ Specifically, I started with openOb() and withWhat() which allowed to remove offset_commandline and offset_openchangesize. A clean conversion of these required a conversion of printMessage2 and getOpenedSize. --- engines/dreamweb/dreambase.h | 10 +- engines/dreamweb/dreamgen.cpp | 221 +++++++++--------------------------------- engines/dreamweb/dreamgen.h | 38 +++----- engines/dreamweb/dreamweb.cpp | 10 ++ engines/dreamweb/object.cpp | 35 ++++++- engines/dreamweb/stubs.cpp | 17 +++- engines/dreamweb/stubs.h | 9 +- engines/dreamweb/use.cpp | 23 +++++ 8 files changed, 156 insertions(+), 207 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 1a730ac541..5f2d3d5e70 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -47,8 +47,14 @@ class DreamBase : public SegmentManager { protected: DreamWeb::DreamWebEngine *engine; + // from object.cpp + uint16 _openChangeSize; + + // from pathfind.cpp + Common::Point _lineData[200]; // Output of Bresenham + public: - DreamBase(DreamWeb::DreamWebEngine *en) : engine(en) { } + DreamBase(DreamWeb::DreamWebEngine *en); public: // from monitor.cpp @@ -76,7 +82,6 @@ public: void obIcons(); // from pathfind.cpp - Common::Point _lineData[200]; // Output of Bresenham void checkDest(const RoomPaths *roomsPaths); RoomPaths *getRoomsPaths(); void faceRightWay(); @@ -126,6 +131,7 @@ public: // from stubs.cpp void crosshair(); + void delTextLine(); void showBlink(); void dumpBlink(); void dumpPointer(); diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 2ee3d512cd..afb537f387 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -950,37 +950,6 @@ findnewpage: delPointer(); } -void DreamGenContext::openOb() { - STACK_CHECK; - al = data.byte(kOpenedob); - ah = data.byte(kOpenedtype); - di = offset_commandline; - copyName(); - di = (80); - bx = (58)+86; - al = 62; - dl = 240; - printMessage(); - di = data.word(kLastxpos); - _add(di, 5); - bx = (58)+86; - es = cs; - si = offset_commandline; - dl = 220; - al = 0; - ah = 0; - printDirect(); - fillOpen(); - getOpenedSize(); - al = ah; - ah = 0; - cx = (44); - _mul(cx); - _add(ax, (80)); - bx = offset_openchangesize; - cs.word(bx) = ax; -} - void DreamGenContext::getObTextStart() { STACK_CHECK; es = data.word(kFreedesc); @@ -1475,29 +1444,6 @@ isex: ax = es.word(bx+7); } -void DreamGenContext::getOpenedSize() { - STACK_CHECK; - _cmp(data.byte(kOpenedtype), 4); - if (flags.z()) - goto isex2; - _cmp(data.byte(kOpenedtype), 2); - if (flags.z()) - goto isfree2; - al = data.byte(kOpenedob); - getSetAd(); - ax = es.word(bx+3); - return; -isfree2: - al = data.byte(kOpenedob); - getFreeAd(); - ax = es.word(bx+7); - return; -isex2: - al = data.byte(kOpenedob); - getExAd(); - ax = es.word(bx+7); -} - void DreamGenContext::getSetAd() { STACK_CHECK; ah = 0; @@ -2586,14 +2532,14 @@ void DreamGenContext::getDestInfo() { push(ax); dx = data; es = dx; - si = 1174; + si = 1131; _add(si, ax); cl = es.byte(si); ax = pop(); push(cx); dx = data; es = dx; - si = 1190; + si = 1147; _add(si, ax); ax = pop(); } @@ -2645,7 +2591,7 @@ clearedlocations: bx = ax; dx = data; es = dx; - _add(bx, 1174); + _add(bx, 1131); es.byte(bx) = 0; } @@ -2684,7 +2630,7 @@ dirroot: si = offset_rootdir; _inc(si); es = cs; - di = 1050; + di = 1048; _inc(di); cx = 12; _movsb(cx, true); @@ -2786,7 +2732,7 @@ notyetassigned: push(bx); _add(bx, 2); ds = cs; - si = 1208; + si = 1165; checkpass: _lodsw(); ah = es.byte(bx); @@ -2857,7 +2803,7 @@ void DreamGenContext::read() { return; okcom: es = cs; - di = 1050; + di = 1048; ax = data.word(kTextfile1); data.word(kMonsource) = ax; ds = ax; @@ -2987,7 +2933,7 @@ keyok2: ds = cs; si = offset_operand1+1; es = cs; - di = 1050+1; + di = 1048+1; cx = 12; _movsb(cx, true); monitorLogo(); @@ -3114,7 +3060,7 @@ void DreamGenContext::parser() { al = '='; _stosb(); ds = cs; - si = 1208; + si = 1165; notspace1: _lodsw(); _cmp(al, 32); @@ -3154,7 +3100,7 @@ void DreamGenContext::notHeldError() { al = 63; ah = 1; dl = 201; - printmessage2(); + printMessage2(); workToScreenM(); cx = 50; hangOnP(); @@ -3333,48 +3279,6 @@ stereoon: putBackObStuff(); } -void DreamGenContext::withWhat() { - STACK_CHECK; - createPanel(); - showPanel(); - showMan(); - showExit(); - al = data.byte(kCommand); - ah = data.byte(kObjecttype); - es = cs; - di = offset_commandline; - copyName(); - di = 100; - bx = 21; - dl = 200; - al = 63; - ah = 2; - printmessage2(); - di = data.word(kLastxpos); - _add(di, 5); - bx = 21; - es = cs; - si = offset_commandline; - dl = 220; - al = 0; - ah = 0; - printDirect(); - di = data.word(kLastxpos); - _add(di, 5); - bx = 21; - dl = 200; - al = 63; - ah = 3; - printmessage2(); - fillRyan(); - data.byte(kCommandtype) = 255; - readMouse(); - showPointer(); - workToScreen(); - delPointer(); - data.byte(kInvopen) = 2; -} - void DreamGenContext::selectOb() { STACK_CHECK; findInvPos(); @@ -3795,7 +3699,7 @@ void DreamGenContext::clearChanges() { di = 0; _stosw(cx, true); es = cs; - di = 1174; + di = 1131; al = 1; _stosb(2); al = 0; @@ -3957,35 +3861,6 @@ gotfirst: al = es.byte(bx+6); } -void DreamGenContext::printmessage2() { - STACK_CHECK; - push(dx); - push(bx); - push(di); - push(ax); - ah = 0; - _add(ax, ax); - bx = ax; - es = data.word(kCommandtext); - ax = es.word(bx); - _add(ax, (66*2)); - si = ax; - ax = pop(); -searchmess: - push(ax); - findNextColon(); - ax = pop(); - _dec(ah); - if (!flags.z()) - goto searchmess; - di = pop(); - bx = pop(); - dx = pop(); - al = 0; - ah = 0; - printDirect(); -} - void DreamGenContext::__start() { static const uint8 src[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x13, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -4102,43 +3977,43 @@ void DreamGenContext::__start() { //0x0370: .2.. .... .2.. .!(. 0x00, 0x32, 0x14, 0x00, 0xff, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x56, 0x39, //0x0380: .2.. .DRE AMWE B.V9 - 0x39, 0x00, 0x00, 0x01, 0x01, 0x00, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x20, 0x20, 0x20, 0x20, - //0x0390: 9... ..PU BLIC - 0x20, 0x20, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, - //0x03a0: PU BLIC ... - 0x42, 0x4c, 0x41, 0x43, 0x4b, 0x44, 0x52, 0x41, 0x47, 0x4f, 0x4e, 0x20, 0x52, 0x59, 0x41, 0x4e, - //0x03b0: BLAC KDRA GON RYAN - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x48, 0x45, 0x4e, 0x44, 0x52, 0x49, - //0x03c0: . ..HE NDRI - 0x58, 0x20, 0x20, 0x20, 0x20, 0x20, 0x4c, 0x4f, 0x55, 0x49, 0x53, 0x20, 0x20, 0x20, 0x20, 0x20, - //0x03d0: X LO UIS - 0x20, 0x00, 0x00, 0x00, 0x53, 0x45, 0x50, 0x54, 0x49, 0x4d, 0x55, 0x53, 0x20, 0x20, 0x20, 0x20, - //0x03e0: ... SEPT IMUS - 0x42, 0x45, 0x43, 0x4b, 0x45, 0x54, 0x54, 0x20, 0x20, 0x20, 0x20, 0x00, 0xff, 0xff, 0x20, 0x20, - //0x03f0: BECK ETT . .. - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x22, 0x52, 0x4f, 0x4f, - //0x0400: . "ROO - 0x54, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, - //0x0410: T ." - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x30, 0x30, 0x30, 0x30, 0x00, 0x30, 0x30, 0x00, - //0x0420: . 0000 .00. - 0x0d, 0x0a, 0x0d, 0x0a, 0x24, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x20, 0x4e, 0x41, 0x4d, 0x45, - //0x0430: .... $OBJ ECT NAME - 0x20, 0x4f, 0x4e, 0x45, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - //0x0440: ONE - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x10, 0x12, - //0x0450: ... - 0x12, 0x11, 0x10, 0x10, 0x10, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, - //0x0460: .... .... .... .... - 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x44, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x0470: .... ..D: .... .... + 0x39, 0x00, 0x01, 0x00, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + //0x0390: 9... PUBL IC + 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x42, 0x4c, + //0x03a0: PUBL IC . ..BL + 0x41, 0x43, 0x4b, 0x44, 0x52, 0x41, 0x47, 0x4f, 0x4e, 0x20, 0x52, 0x59, 0x41, 0x4e, 0x20, 0x20, + //0x03b0: ACKD RAGO N RY AN + 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x48, 0x45, 0x4e, 0x44, 0x52, 0x49, 0x58, 0x20, + //0x03c0: ... HEND RIX + 0x20, 0x20, 0x20, 0x20, 0x4c, 0x4f, 0x55, 0x49, 0x53, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, + //0x03d0: LOUI S . + 0x00, 0x00, 0x53, 0x45, 0x50, 0x54, 0x49, 0x4d, 0x55, 0x53, 0x20, 0x20, 0x20, 0x20, 0x42, 0x45, + //0x03e0: ..SE PTIM US BE + 0x43, 0x4b, 0x45, 0x54, 0x54, 0x20, 0x20, 0x20, 0x20, 0x00, 0xff, 0xff, 0x20, 0x20, 0x20, 0x20, + //0x03f0: CKET T ... + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x22, 0x52, 0x4f, 0x4f, 0x54, 0x20, + //0x0400: ."R OOT + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + //0x0410: . " + 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x30, 0x30, 0x30, 0x30, 0x00, 0x30, 0x30, 0x00, 0x0d, 0x0a, + //0x0420: .00 00.0 0... + 0x0d, 0x0a, 0x24, 0x10, 0x12, 0x12, 0x11, 0x10, 0x10, 0x10, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + //0x0430: ..$. .... .... .... + 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x44, 0x3a, 0x00, 0x00, 0x00, + //0x0440: .... .... ...D :... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + //0x0450: .... .... .... .... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, 0x00, + //0x0460: .... .... .... .... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x02, 0x04, + //0x0470: .... .... .... .... + 0x01, 0x0a, 0x09, 0x08, 0x06, 0x0b, 0x04, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0480: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0490: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x02, 0x04, 0x01, 0x0a, 0x09, 0x08, 0x06, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x04a0: .... .... .... .... - 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, 0x00, 0x00, 0x00, 0x00, 0x00, //0x04b0: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x04c0: .... .... .... .... @@ -4148,15 +4023,9 @@ void DreamGenContext::__start() { //0x04e0: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x04f0: .... .... .... .... - 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, //0x0500: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x0510: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x0520: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, - //0x0530: .... .... .... .... - 0x00, }; + 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, }; ds.assign(src, src + sizeof(src)); dreamweb(); } diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 582caa712f..16a42d2e25 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -32,13 +32,11 @@ namespace DreamGen { -static const uint16 offset_money2poke = 0x042d; -static const uint16 offset_rootdir = 0x040c; -static const uint16 offset_openchangesize = 0x0392; -static const uint16 offset_keys = 0x0394; -static const uint16 offset_commandline = 0x0435; -static const uint16 offset_money1poke = 0x0428; -static const uint16 offset_operand1 = 0x03fe; +static const uint16 offset_money1poke = 0x0426; +static const uint16 offset_operand1 = 0x03fc; +static const uint16 offset_rootdir = 0x040a; +static const uint16 offset_keys = 0x0392; +static const uint16 offset_money2poke = 0x042b; static const uint16 kStartvars = 0; static const uint16 kProgresspoints = 1; static const uint16 kWatchon = 2; @@ -366,15 +364,15 @@ static const uint16 kCurrentsample = 442; static const uint16 kRoomssample = 443; static const uint16 kReelroutines = 444; static const uint16 kBasicsample = 901; -static const uint16 kCurrentfile = 1050; -static const uint16 kRoomscango = 1174; -static const uint16 kRoompics = 1190; -static const uint16 kOplist = 1205; -static const uint16 kInputline = 1208; -static const uint16 kPresslist = 1336; -static const uint16 kQuitrequested = 1342; -static const uint16 kSubtitles = 1343; -static const uint16 kForeignrelease = 1344; +static const uint16 kCurrentfile = 1048; +static const uint16 kRoomscango = 1131; +static const uint16 kRoompics = 1147; +static const uint16 kOplist = 1162; +static const uint16 kInputline = 1165; +static const uint16 kPresslist = 1293; +static const uint16 kQuitrequested = 1299; +static const uint16 kSubtitles = 1300; +static const uint16 kForeignrelease = 1301; static const uint16 kBlocktextdat = (0); static const uint16 kPersonframes = (0); static const uint16 kDebuglevel1 = (0); @@ -478,6 +476,7 @@ public: void fadeDownMon(); void identifyOb(); + void getPersonText(); void clearBuffers(); void getObTextStart(); void checkObjectSize(); @@ -487,7 +486,6 @@ public: void moneyPoke(); void doSomeTalk(); void resetLocation(); - void getOpenedSize(); void adjustUp(); void fadeScreenDownHalf(); void outOfOpen(); @@ -506,7 +504,6 @@ public: void removeObFromInv(); void dirFile(); void pickupConts(); - void nextColon(); void findInvPos(); void getKeyAndLogo(); void selectOb(); @@ -520,7 +517,7 @@ public: void notHeldError(); void getSetAd(); void showKeys(); - void printmessage2(); + void nextColon(); void findOpenPos(); void deleteExFrame(); void searchForSame(); @@ -533,7 +530,6 @@ public: void getEitherAd(); void setPickup(); void dropObject(); - void openOb(); void useStereo(); void showDiaryKeys(); void useOpened(); @@ -558,12 +554,10 @@ public: void swapWithInv(); void adjustRight(); void transferToEx(); - void getPersonText(); void parser(); void emergencyPurge(); void transferConToEx(); void adjustDown(); - void withWhat(); }; } // End of namespace DreamGen diff --git a/engines/dreamweb/dreamweb.cpp b/engines/dreamweb/dreamweb.cpp index b4fc1b7b77..082b7d8ce7 100644 --- a/engines/dreamweb/dreamweb.cpp +++ b/engines/dreamweb/dreamweb.cpp @@ -410,3 +410,13 @@ uint8 DreamWebEngine::modifyChar(uint8 c) const { } } // End of namespace DreamWeb + + +namespace DreamGen { + +// FIXME/TODO: Move this to a better place. +DreamBase::DreamBase(DreamWeb::DreamWebEngine *en) : engine(en) { + _openChangeSize = kInventx+(4*kItempicsize); +} + +} // End of namespace DreamGen diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index 53d834e74c..8e5da2c90e 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -162,13 +162,13 @@ void DreamGenContext::examineOb(bool examineAgain) { break; } case 1: { - // NB: This table contains the non-constant openChangeSize! + // Note: This table contains the non-constant _openChangeSize! RectWithCallback invList1[] = { { 273,320,157,198,&DreamGenContext::getBackFromOb }, { 255,294,0,24,&DreamGenContext::dropObject }, { kInventx+167,kInventx+167+(18*3),kInventy-18,kInventy-2,&DreamGenContext::incRyanPage }, - { kInventx, data.word(offset_openchangesize),kInventy+100,kInventy+100+kItempicsize,&DreamGenContext::useOpened }, - { kInventx,kInventx+(5*kItempicsize), kInventy,kInventy+(2*kItempicsize),&DreamGenContext::inToInv }, + { kInventx,_openChangeSize,kInventy+100,kInventy+100+kItempicsize,&DreamGenContext::useOpened }, + { kInventx,kInventx+(5*kItempicsize),kInventy,kInventy+(2*kItempicsize),&DreamGenContext::inToInv }, { 0,320,0,200,&DreamGenContext::blank }, { 0xFFFF,0,0,0,0 } }; @@ -263,4 +263,33 @@ void DreamGenContext::getBackFromOb() { blank(); } +void DreamGenContext::getOpenedSize() { + ax = getOpenedSizeCPP(); +} + +byte DreamGenContext::getOpenedSizeCPP() { + byte obj = data.byte(kOpenedob); + switch (data.byte(kOpenedtype)) { + case 4: + return getExAd(obj)->b7; + case 2: + return getFreeAd(obj)->b7; + default: + return getSetAd(obj)->b3; + } +} + +void DreamGenContext::openOb() { + uint8 commandLine[64] = "OBJECT NAME ONE "; + + copyName(data.byte(kOpenedtype), data.byte(kOpenedob), commandLine); + + printMessage(kInventx, kInventy+86, 62, 240, false); + + al = printDirect(commandLine, data.word(kLastxpos) + 5, kInventy+86, 220, false); + + fillOpen(); + _openChangeSize = getOpenedSizeCPP() * kItempicsize + kInventx; +} + } // End of namespace DreamGen diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 0c57d0d767..1c66ac7681 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -1191,7 +1191,7 @@ void DreamBase::crosshair() { showFrame(engine->icons1(), kZoomx + 24, kZoomy + 19, frame, 0); } -void DreamGenContext::delTextLine() { +void DreamBase::delTextLine() { uint16 x = data.word(kTextaddressx); uint16 y = data.word(kTextaddressy); if (data.byte(kForeignrelease) != 0) @@ -1752,7 +1752,20 @@ void DreamGenContext::printMessage() { void DreamGenContext::printMessage(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered) { uint16 offset = kTextstart + getSegment(data.word(kCommandtext)).word(index * 2); const uint8 *string = getSegment(data.word(kCommandtext)).ptr(offset, 0); - printDirect(&string, x, &y, maxWidth, centered); + printDirect(string, x, y, maxWidth, centered); +} + +void DreamGenContext::printMessage2() { + printMessage2(di, bx, al, dl, (bool)(dl & 1), ah); +} + +void DreamGenContext::printMessage2(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered, uint8 count) { + uint16 offset = kTextstart + getSegment(data.word(kCommandtext)).word(index * 2); + const uint8 *string = getSegment(data.word(kCommandtext)).ptr(offset, 0); + while (count--) { + findNextColon(&string); + } + printDirect(string, x, y, maxWidth, centered); } bool objectMatches(void *object, const char *id) { diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 8218a1ac0f..b7e477804c 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -58,8 +58,10 @@ uint8 printDirect(const uint8* string, uint16 x, uint16 y, uint8 maxWidth, bool centered) { return DreamBase::printDirect(string, x, y, maxWidth, centered); } - void printMessage(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered); void printMessage(); + void printMessage(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered); + void printMessage2(); + void printMessage2(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered, uint8 count); void useTimedText(); void dumpTimedText(); void setupTimedTemp(uint8 textIndex, uint8 voiceIndex, uint8 x, uint8 y, uint16 countToTimed, uint16 timeCount); @@ -111,7 +113,6 @@ void dealWithSpecial(uint8 firstParam, uint8 secondParam); void zoom(); void showRain(); - void delTextLine(); void commandOnly(); void commandOnly(uint8 command); void doBlocks(); @@ -590,5 +591,9 @@ void findExObject(); uint16 findExObject(const char *id); void describeOb(); + void getOpenedSize(); + byte getOpenedSizeCPP(); + void openOb(); + void withWhat(); #endif diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp index 5306522c13..87b3640e03 100644 --- a/engines/dreamweb/use.cpp +++ b/engines/dreamweb/use.cpp @@ -1473,4 +1473,27 @@ void DreamGenContext::useAltar() { } } +void DreamGenContext::withWhat() { + uint8 commandLine[64] = "OBJECT NAME ONE "; + + createPanel(); + showPanel(); + showMan(); + showExit(); + + copyName(data.byte(kObjecttype), data.byte(kCommand), commandLine); + printMessage2(100, 21, 63, 200, false, 2); + printDirect(commandLine, data.word(kLastxpos) + 5, 21, 220, false); + printMessage2(data.word(kLastxpos) + 5, 21, 63, 200, false, 3); + + fillRyan(); + data.byte(kCommandtype) = 255; + readMouse(); + showPointer(); + workToScreen(); + delPointer(); + data.byte(kInvopen) = 2; +} + + } // End of namespace DreamGen -- cgit v1.2.3 From 9972fc613adf7a9f751163724a08ac9bcd5ef7b0 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 15 Dec 2011 12:23:00 +0100 Subject: DREAMWEB: Move more methods to DreamBase --- engines/dreamweb/backdrop.cpp | 2 +- engines/dreamweb/dreambase.h | 38 ++++++++++++++++++++++++++++++++++ engines/dreamweb/keypad.cpp | 48 +++++++++++++++++++++---------------------- engines/dreamweb/stubs.cpp | 22 ++++++++++---------- engines/dreamweb/stubs.h | 42 ++++++++----------------------------- 5 files changed, 83 insertions(+), 69 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/backdrop.cpp b/engines/dreamweb/backdrop.cpp index 3e005fdec9..15a226a5ac 100644 --- a/engines/dreamweb/backdrop.cpp +++ b/engines/dreamweb/backdrop.cpp @@ -274,7 +274,7 @@ void DreamGenContext::showAllFree() { } } -void DreamGenContext::drawFlags() { +void DreamBase::drawFlags() { uint8 *mapFlags = getSegment(data.word(kBuffers)).ptr(kMapflags, 0); const uint8 *mapData = getSegment(data.word(kMapdata)).ptr(kMap + data.byte(kMapy) * kMapwidth + data.byte(kMapx), 0); const uint8 *backdropFlags = getSegment(data.word(kBackdrop)).ptr(kFlags, 0); diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 5f2d3d5e70..2e3c530853 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -57,6 +57,35 @@ public: DreamBase(DreamWeb::DreamWebEngine *en); public: + // from backdrop.cpp + void drawFlags(); + + // from keypad.cpp + void getUnderMenu(); + void putUnderMenu(); + void singleKey(uint8 key, uint16 x, uint16 y); + void loadKeypad(); + void showKeypad(); + bool isItRight(uint8 digit0, uint8 digit1, uint8 digit2, uint8 digit3); + void addToPressList(); + void buttonOne(); + void buttonTwo(); + void buttonThree(); + void buttonFour(); + void buttonFive(); + void buttonSix(); + void buttonSeven(); + void buttonEight(); + void buttonNine(); + void buttonNought(); + void buttonEnter(); + void buttonPress(uint8 buttonId); + void showOuterPad(); + void dumpKeypad(); + void dumpSymbol(); + void dumpSymBox(); + void quitSymbol(); + // from monitor.cpp void input(); byte makeCaps(byte c); @@ -180,6 +209,15 @@ public: void loadRoomData(const Room &room, bool skipDat); void useTempCharset(); void useCharset1(); + void printMessage(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered); + void printMessage2(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered, uint8 count); + bool isItDescribed(const ObjPos *objPos); + void zoomIcon(); + void roomName(); + void showIcon(); + void eraseOldObs(); + void commandOnly(uint8 command); + void blank(); // from use.cpp void placeFreeObject(uint8 index); diff --git a/engines/dreamweb/keypad.cpp b/engines/dreamweb/keypad.cpp index 09bdcb837b..795f5b053e 100644 --- a/engines/dreamweb/keypad.cpp +++ b/engines/dreamweb/keypad.cpp @@ -24,15 +24,15 @@ namespace DreamGen { -void DreamGenContext::getUnderMenu() { +void DreamBase::getUnderMenu() { multiGet(getSegment(data.word(kBuffers)).ptr(kUndertimedtext, 0), kMenux, kMenuy, 48, 48); } -void DreamGenContext::putUnderMenu() { +void DreamBase::putUnderMenu() { multiPut(getSegment(data.word(kBuffers)).ptr(kUndertimedtext, 0), kMenux, kMenuy, 48, 48); } -void DreamGenContext::singleKey(uint8 key, uint16 x, uint16 y) { +void DreamBase::singleKey(uint8 key, uint16 x, uint16 y) { if (key == data.byte(kGraphicpress)) { key += 11; if (data.byte(kPresscount) < 8) @@ -42,11 +42,11 @@ void DreamGenContext::singleKey(uint8 key, uint16 x, uint16 y) { showFrame(tempGraphics(), x, y, key, 0); } -void DreamGenContext::loadKeypad() { +void DreamBase::loadKeypad() { loadIntoTemp("DREAMWEB.G02"); } -void DreamGenContext::showKeypad() { +void DreamBase::showKeypad() { singleKey(22, kKeypadx+9, kKeypady+5); singleKey(23, kKeypadx+31, kKeypady+5); singleKey(24, kKeypadx+53, kKeypady+5); @@ -75,13 +75,13 @@ void DreamGenContext::showKeypad() { } } -bool DreamGenContext::isItRight(uint8 digit0, uint8 digit1, uint8 digit2, uint8 digit3) { +bool DreamBase::isItRight(uint8 digit0, uint8 digit1, uint8 digit2, uint8 digit3) { return digit0 == data.byte(kPresslist+0) && digit1 == data.byte(kPresslist+1) && digit2 == data.byte(kPresslist+2) && digit3 == data.byte(kPresslist+3); } -void DreamGenContext::addToPressList() { +void DreamBase::addToPressList() { if (data.word(kPresspointer) == 5) return; uint8 pressed = data.byte(kPressed); @@ -164,51 +164,51 @@ void DreamGenContext::enterCode(uint8 digit0, uint8 digit1, uint8 digit2, uint8 workToScreenM(); } -void DreamGenContext::buttonOne() { +void DreamBase::buttonOne() { buttonPress(1); } -void DreamGenContext::buttonTwo() { +void DreamBase::buttonTwo() { buttonPress(2); } -void DreamGenContext::buttonThree() { +void DreamBase::buttonThree() { buttonPress(3); } -void DreamGenContext::buttonFour() { +void DreamBase::buttonFour() { buttonPress(4); } -void DreamGenContext::buttonFive() { +void DreamBase::buttonFive() { buttonPress(5); } -void DreamGenContext::buttonSix() { +void DreamBase::buttonSix() { buttonPress(6); } -void DreamGenContext::buttonSeven() { +void DreamBase::buttonSeven() { buttonPress(7); } -void DreamGenContext::buttonEight() { +void DreamBase::buttonEight() { buttonPress(8); } -void DreamGenContext::buttonNine() { +void DreamBase::buttonNine() { buttonPress(9); } -void DreamGenContext::buttonNought() { +void DreamBase::buttonNought() { buttonPress(10); } -void DreamGenContext::buttonEnter() { +void DreamBase::buttonEnter() { buttonPress(11); } -void DreamGenContext::buttonPress(uint8 buttonId) { +void DreamBase::buttonPress(uint8 buttonId) { uint8 commandType = 100 + buttonId; if (data.byte(kCommandtype) != commandType) { data.byte(kCommandtype) = commandType; @@ -223,28 +223,28 @@ void DreamGenContext::buttonPress(uint8 buttonId) { } } -void DreamGenContext::showOuterPad() { +void DreamBase::showOuterPad() { showFrame(tempGraphics(), kKeypadx-3, kKeypady-4, 1, 0); showFrame(tempGraphics(), kKeypadx+74, kKeypady+76, 37, 0); } -void DreamGenContext::dumpKeypad() { +void DreamBase::dumpKeypad() { multiDump(kKeypadx - 3, kKeypady - 4, 120, 90); } -void DreamGenContext::dumpSymbol() { +void DreamBase::dumpSymbol() { data.byte(kNewtextline) = 0; multiDump(kSymbolx, kSymboly + 20, 104, 60); } -void DreamGenContext::dumpSymBox() { +void DreamBase::dumpSymBox() { if (data.word(kDumpx) != 0xFFFF) { multiDump(data.word(kDumpx), data.word(kDumpy), 30, 77); data.word(kDumpx) = 0xFFFF; } } -void DreamGenContext::quitSymbol() { +void DreamBase::quitSymbol() { if (data.byte(kSymboltopx) != 24 || data.byte(kSymbolbotx) != 24) { blank(); return; diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 1c66ac7681..014e3143d9 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -1015,7 +1015,7 @@ void DreamGenContext::DOSReturn() { void DreamGenContext::set16ColPalette() { } -void DreamGenContext::eraseOldObs() { +void DreamBase::eraseOldObs() { if (data.byte(kNewobs) == 0) return; @@ -1200,10 +1200,10 @@ void DreamBase::delTextLine() { } void DreamGenContext::commandOnly() { - commandOnly(al); + commandOnly(al); } -void DreamGenContext::commandOnly(uint8 command) { +void DreamBase::commandOnly(uint8 command) { delTextLine(); uint16 index = command * 2; uint16 offset = kTextstart + getSegment(data.word(kCommandtext)).word(index); @@ -1749,7 +1749,7 @@ void DreamGenContext::printMessage() { printMessage(di, bx, al, dl, (bool)(dl & 1)); } -void DreamGenContext::printMessage(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered) { +void DreamBase::printMessage(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered) { uint16 offset = kTextstart + getSegment(data.word(kCommandtext)).word(index * 2); const uint8 *string = getSegment(data.word(kCommandtext)).ptr(offset, 0); printDirect(string, x, y, maxWidth, centered); @@ -1759,7 +1759,7 @@ void DreamGenContext::printMessage2() { printMessage2(di, bx, al, dl, (bool)(dl & 1), ah); } -void DreamGenContext::printMessage2(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered, uint8 count) { +void DreamBase::printMessage2(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered, uint8 count) { uint16 offset = kTextstart + getSegment(data.word(kCommandtext)).word(index * 2); const uint8 *string = getSegment(data.word(kCommandtext)).ptr(offset, 0); while (count--) { @@ -1768,7 +1768,7 @@ void DreamGenContext::printMessage2(uint16 x, uint16 y, uint8 index, uint8 maxWi printDirect(string, x, y, maxWidth, centered); } -bool objectMatches(void *object, const char *id) { +static bool objectMatches(void *object, const char *id) { const char *objId = (const char *)(((const uint8 *)object) + 12); // whether it is a DynObject or a SetObject for (size_t i = 0; i < 4; ++i) { if (id[i] != objId[i] + 'A') @@ -1826,7 +1826,7 @@ uint16 DreamGenContext::findExObject(const char *id) { return kNumexobjects; } -bool DreamGenContext::isItDescribed(const ObjPos *pos) { +bool DreamBase::isItDescribed(const ObjPos *pos) { uint16 offset = getSegment(data.word(kSetdesc)).word(kSettextdat + pos->index * 2); uint8 result = getSegment(data.word(kSetdesc)).byte(kSettext + offset); return result != 0; @@ -1840,7 +1840,7 @@ bool DreamGenContext::isCD() { return (data.byte(kSpeechloaded) == 1); } -void DreamGenContext::showIcon() { +void DreamBase::showIcon() { if (data.byte(kReallocation) < 50) { showPanel(); showMan(); @@ -2188,7 +2188,7 @@ void DreamGenContext::watchCount() { } } -void DreamGenContext::roomName() { +void DreamBase::roomName() { printMessage(88, 18, 53, 240, false); uint16 textIndex = data.byte(kRoomnum); if (textIndex >= 32) @@ -2202,7 +2202,7 @@ void DreamGenContext::roomName() { useCharset1(); } -void DreamGenContext::zoomIcon() { +void DreamBase::zoomIcon() { if (data.byte(kZoomon) == 0) return; showFrame(engine->icons1(), kZoomx, kZoomy-1, 8, 0); @@ -3362,7 +3362,7 @@ void DreamGenContext::selectSlot2() { selectSlot(); } -void DreamGenContext::blank() { +void DreamBase::blank() { if (data.byte(kCommandtype) != 199) { data.byte(kCommandtype) = 199; commandOnly(0); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index b7e477804c..c028c6851b 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -59,9 +59,13 @@ return DreamBase::printDirect(string, x, y, maxWidth, centered); } void printMessage(); - void printMessage(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered); + void printMessage(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered) { + DreamBase::printMessage(x, y, index, maxWidth, centered); + } void printMessage2(); - void printMessage2(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered, uint8 count); + void printMessage2(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered, uint8 count) { + DreamBase::printMessage2(x, y, index, maxWidth, centered, count); + } void useTimedText(); void dumpTimedText(); void setupTimedTemp(uint8 textIndex, uint8 voiceIndex, uint8 x, uint8 y, uint16 countToTimed, uint16 timeCount); @@ -80,7 +84,6 @@ } void printASprite(const Sprite *sprite); void width160(); - void eraseOldObs(); void clearSprites(); Sprite *makeSprite(uint8 x, uint8 y, uint16 updateCallback, uint16 frameData, uint16 somethingInDi); void spriteUpdate(); @@ -114,7 +117,9 @@ void zoom(); void showRain(); void commandOnly(); - void commandOnly(uint8 command); + void commandOnly(uint8 command) { + DreamBase::commandOnly(command); + } void doBlocks(); void checkIfPerson(); bool checkIfPerson(uint8 x, uint8 y); @@ -184,7 +189,6 @@ void obName(uint8 command, uint8 commandType); void animPointer(); void checkCoords(const RectWithCallback *rectWithCallbacks); - void drawFlags(); void addToPeopleList(); void addToPeopleList(ReelRoutine *routine); void getExPos(); @@ -192,7 +196,6 @@ void compare(); bool compare(uint8 index, uint8 flag, const char id[4]); bool pixelCheckSet(const ObjPos *pos, uint8 x, uint8 y); - bool isItDescribed(const ObjPos *objPos); void checkIfSet(); bool checkIfSet(uint8 x, uint8 y); void checkIfPathIsOn(); @@ -216,7 +219,6 @@ void hangOnW(uint16 frameCount); void hangOnP(); void hangOnP(uint16 count); - void showIcon(); uint8 findNextColon(const uint8 **string) { return DreamBase::findNextColon(string); } @@ -232,15 +234,11 @@ void convIcons(); void examineOb(bool examineAgain = true); void dumpWatch(); - void roomName(); void transferText(); void initRain(); Rain *splitIntoLines(uint8 x, uint8 y, Rain *rain); void watchCount(); - void zoomIcon(); void loadRoom(); - void getUnderMenu(); - void putUnderMenu(); void textForMonk(); void textForMonkHelper(uint8 textIndex, uint8 voiceIndex, uint8 x, uint8 y, uint16 countToTimed, uint16 timeCount); void textForEnd(); @@ -422,26 +420,9 @@ void helicopter(ReelRoutine &routine); void singleKey(uint8 key, uint16 x, uint16 y); void loadSaveBox(); - void loadKeypad(); - void showKeypad(); - void showOuterPad(); uint8 nextSymbol(uint8 symbol); void showSymbol(); void examIcon(); - void buttonOne(); - void buttonTwo(); - void buttonThree(); - void buttonFour(); - void buttonFive(); - void buttonSix(); - void buttonSeven(); - void buttonEight(); - void buttonNine(); - void buttonNought(); - void buttonEnter(); - void buttonPress(uint8 buttonId); - void addToPressList(); - bool isItRight(uint8 digit0, uint8 digit1, uint8 digit2, uint8 digit3); void enterCode(uint8 digit0, uint8 digit1, uint8 digit2, uint8 digit3); unsigned int scanForNames(); void doLoad(int slot); @@ -481,7 +462,6 @@ void redrawMainScrn(); void selectSlot(); void selectSlot2(); - void blank(); void allPointer(); void openYourNeighbour(); void openRyan(); @@ -525,9 +505,6 @@ void redes(); void isSetObOnMap(); bool isSetObOnMap(uint8 index); - void dumpKeypad(); - void dumpSymbol(); - void dumpSymBox(); void dumpZoom(); void selectLocation(); void showGroup(); @@ -560,7 +537,6 @@ void hangOnPQ(); void showGun(); void endGame(); - void quitSymbol(); void diaryKeyP(); void diaryKeyN(); void checkInput(); -- cgit v1.2.3 From 9ebcaa33e7080098e686c02ec03dff65a0a55174 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 15 Dec 2011 13:41:30 +0100 Subject: DREAMWEB: Move even more stuff to DreamBase --- engines/dreamweb/dreambase.h | 44 ++++++- engines/dreamweb/keypad.cpp | 24 ++-- engines/dreamweb/object.cpp | 36 ++++-- engines/dreamweb/saveload.cpp | 113 +++++++++++++++++- engines/dreamweb/sprite.cpp | 2 +- engines/dreamweb/stubs.cpp | 270 ++++++++++-------------------------------- engines/dreamweb/stubs.h | 58 ++------- 7 files changed, 264 insertions(+), 283 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 2e3c530853..de7bada943 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -53,6 +53,10 @@ protected: // from pathfind.cpp Common::Point _lineData[200]; // Output of Bresenham + // from saveload.cpp + char _saveNames[17*7]; + char _saveNamesOld[17*7]; + public: DreamBase(DreamWeb::DreamWebEngine *en); @@ -109,6 +113,9 @@ public: // from object.cpp void obIcons(); + void fillRyan(); + void findAllRyan(uint8 *inv); + void obToInv(uint8 index, uint8 flag, uint16 x, uint16 y); // from pathfind.cpp void checkDest(const RoomPaths *roomsPaths); @@ -135,8 +142,10 @@ public: void delCurs(); // from saveload.cpp - char _saveNames[17*7]; - char _saveNamesOld[17*7]; + void oldToNames(); + void namesToOld(); + void showMainOps(); + void showDiscOps(); void showNames(); // from sound.cpp @@ -157,6 +166,7 @@ public: void soundOnReels(uint16 reelPointer); void rollEndCredits(); void priestText(ReelRoutine &routine); + void checkOne(uint8 x, uint8 y, uint8 *flag, uint8 *flagEx, uint8 *type, uint8 *flagX, uint8 *flagY); // from stubs.cpp void crosshair(); @@ -185,6 +195,7 @@ public: DynObject *getFreeAd(uint8 index); DynObject *getExAd(uint8 index); DynObject *getEitherAdCPP(); + void *getAnyAdDir(uint8 index, uint8 flag); void showWatch(); void showTime(); void showExit(); @@ -203,6 +214,8 @@ public: void loadIntoTemp2(const char *fileName); void loadIntoTemp3(const char *fileName); void loadTempCharset(const char *fileName); + 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(); @@ -218,6 +231,33 @@ public: void eraseOldObs(); void commandOnly(uint8 command); void blank(); + void setTopLeft(); + void setTopRight(); + void setBotLeft(); + void setBotRight(); + void examIcon(); + void animPointer(); + void getFlagUnderP(uint8 *flag, uint8 *flagEx); + void workToScreenM(); + void quitKey(); + void loadFolder(); + void folderHints(); + void folderExit(); + void showFolder(); + void showLeftPage(); + void showRightPage(); + void underTextLine(); + void hangOnP(uint16 count); + void getUnderZoom(); + void putUnderZoom(); + void examineInventory(); + void openInv(); + void getBack1(); + void getBackFromOb(); + void getBackFromOps(); + void getBackToOps(); + void DOSReturn(); + bool isItWorn(const DynObject *object); // from use.cpp void placeFreeObject(uint8 index); diff --git a/engines/dreamweb/keypad.cpp b/engines/dreamweb/keypad.cpp index 795f5b053e..032f01873e 100644 --- a/engines/dreamweb/keypad.cpp +++ b/engines/dreamweb/keypad.cpp @@ -94,18 +94,18 @@ void DreamBase::addToPressList() { void DreamGenContext::enterCode(uint8 digit0, uint8 digit1, uint8 digit2, uint8 digit3) { RectWithCallback keypadList[] = { - { kKeypadx+9,kKeypadx+30,kKeypady+9,kKeypady+22,&DreamGenContext::buttonOne }, - { kKeypadx+31,kKeypadx+52,kKeypady+9,kKeypady+22,&DreamGenContext::buttonTwo }, - { kKeypadx+53,kKeypadx+74,kKeypady+9,kKeypady+22,&DreamGenContext::buttonThree }, - { kKeypadx+9,kKeypadx+30,kKeypady+23,kKeypady+40,&DreamGenContext::buttonFour }, - { kKeypadx+31,kKeypadx+52,kKeypady+23,kKeypady+40,&DreamGenContext::buttonFive }, - { kKeypadx+53,kKeypadx+74,kKeypady+23,kKeypady+40,&DreamGenContext::buttonSix }, - { kKeypadx+9,kKeypadx+30,kKeypady+41,kKeypady+58,&DreamGenContext::buttonSeven }, - { kKeypadx+31,kKeypadx+52,kKeypady+41,kKeypady+58,&DreamGenContext::buttonEight }, - { kKeypadx+53,kKeypadx+74,kKeypady+41,kKeypady+58,&DreamGenContext::buttonNine }, - { kKeypadx+9,kKeypadx+30,kKeypady+59,kKeypady+73,&DreamGenContext::buttonNought }, - { kKeypadx+31,kKeypadx+74,kKeypady+59,kKeypady+73,&DreamGenContext::buttonEnter }, - { kKeypadx+72,kKeypadx+86,kKeypady+80,kKeypady+94,&DreamGenContext::quitKey }, + { kKeypadx+9,kKeypadx+30,kKeypady+9,kKeypady+22,&DreamBase::buttonOne }, + { kKeypadx+31,kKeypadx+52,kKeypady+9,kKeypady+22,&DreamBase::buttonTwo }, + { kKeypadx+53,kKeypadx+74,kKeypady+9,kKeypady+22,&DreamBase::buttonThree }, + { kKeypadx+9,kKeypadx+30,kKeypady+23,kKeypady+40,&DreamBase::buttonFour }, + { kKeypadx+31,kKeypadx+52,kKeypady+23,kKeypady+40,&DreamBase::buttonFive }, + { kKeypadx+53,kKeypadx+74,kKeypady+23,kKeypady+40,&DreamBase::buttonSix }, + { kKeypadx+9,kKeypadx+30,kKeypady+41,kKeypady+58,&DreamBase::buttonSeven }, + { kKeypadx+31,kKeypadx+52,kKeypady+41,kKeypady+58,&DreamBase::buttonEight }, + { kKeypadx+53,kKeypadx+74,kKeypady+41,kKeypady+58,&DreamBase::buttonNine }, + { kKeypadx+9,kKeypadx+30,kKeypady+59,kKeypady+73,&DreamBase::buttonNought }, + { kKeypadx+31,kKeypadx+74,kKeypady+59,kKeypady+73,&DreamBase::buttonEnter }, + { kKeypadx+72,kKeypadx+86,kKeypady+80,kKeypady+94,&DreamBase::quitKey }, { 0,320,0,200,&DreamGenContext::blank }, { 0xFFFF,0,0,0,0 } }; diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index 8e5da2c90e..b430183cee 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -24,7 +24,27 @@ namespace DreamGen { -void DreamGenContext::fillRyan() { +void DreamBase::showRyanPage() { + showFrame(engine->icons1(), kInventx + 167, kInventy - 12, 12, 0); + showFrame(engine->icons1(), kInventx + 167 + 18 * data.byte(kRyanpage), kInventy - 12, 13 + data.byte(kRyanpage), 0); +} + +void DreamBase::findAllRyan(uint8 *inv) { + memset(inv, 0xff, 60); + for (size_t i = 0; i < kNumexobjects; ++i) { + DynObject *extra = getExAd(i); + if (extra->mapad[0] != 4) + continue; + if (extra->mapad[1] != 0xff) + continue; + uint8 slot = extra->mapad[2]; + assert(slot < 30); + inv[2 * slot + 0] = i; + inv[2 * slot + 1] = 4; + } +} + +void DreamBase::fillRyan() { uint8 *inv = getSegment(data.word(kBuffers)).ptr(kRyaninvlist, 60); findAllRyan(inv); inv += data.byte(kRyanpage) * 2 * 10; @@ -42,7 +62,7 @@ void DreamGenContext::isItWorn() { flags._z = isItWorn((const DynObject *)es.ptr(bx, sizeof(DynObject))); } -bool DreamGenContext::isItWorn(const DynObject *object) { +bool DreamBase::isItWorn(const DynObject *object) { return (object->id[0] == 'W'-'A') && (object->id[1] == 'E'-'A'); } @@ -72,7 +92,7 @@ void DreamGenContext::obToInv() { obToInv(al, ah, di, bx); } -void DreamGenContext::obToInv(uint8 index, uint8 flag, uint16 x, uint16 y) { +void DreamBase::obToInv(uint8 index, uint8 flag, uint16 x, uint16 y) { showFrame(engine->icons1(), x - 2, y - 1, 10, 0); if (index == 0xff) return; @@ -154,8 +174,8 @@ void DreamGenContext::examineOb(bool examineAgain) { { 260,300,0,44,&DreamGenContext::useObject }, { 210,254,0,44,&DreamGenContext::selectOpenOb }, { 144,176,64,96,&DreamGenContext::setPickup }, - { 0,50,50,200,&DreamGenContext::examineInventory }, - { 0,320,0,200,&DreamGenContext::blank }, + { 0,50,50,200,&DreamBase::examineInventory }, + { 0,320,0,200,&DreamBase::blank }, { 0xFFFF,0,0,0,0 } }; checkCoords(examList); @@ -169,7 +189,7 @@ void DreamGenContext::examineOb(bool examineAgain) { { kInventx+167,kInventx+167+(18*3),kInventy-18,kInventy-2,&DreamGenContext::incRyanPage }, { kInventx,_openChangeSize,kInventy+100,kInventy+100+kItempicsize,&DreamGenContext::useOpened }, { kInventx,kInventx+(5*kItempicsize),kInventy,kInventy+(2*kItempicsize),&DreamGenContext::inToInv }, - { 0,320,0,200,&DreamGenContext::blank }, + { 0,320,0,200,&DreamBase::blank }, { 0xFFFF,0,0,0,0 } }; checkCoords(invList1); @@ -180,7 +200,7 @@ void DreamGenContext::examineOb(bool examineAgain) { { 273,320,157,198,&DreamGenContext::getBackFromOb }, { kInventx+167,kInventx+167+(18*3),kInventy-18,kInventy-2,&DreamGenContext::incRyanPage }, { kInventx,kInventx+(5*kItempicsize), kInventy,kInventy+(2*kItempicsize),&DreamGenContext::selectOb }, - { 0,320,0,200,&DreamGenContext::blank }, + { 0,320,0,200,&DreamBase::blank }, { 0xFFFF,0,0,0,0 } }; checkCoords(withList1); @@ -256,7 +276,7 @@ void DreamGenContext::transferText() { data.word(kExtextpos) += len + 1; } -void DreamGenContext::getBackFromOb() { +void DreamBase::getBackFromOb() { if (data.byte(kPickup) != 1) getBack1(); else diff --git a/engines/dreamweb/saveload.cpp b/engines/dreamweb/saveload.cpp index f0fd477ec1..2945874e1a 100644 --- a/engines/dreamweb/saveload.cpp +++ b/engines/dreamweb/saveload.cpp @@ -71,7 +71,7 @@ void DreamGenContext::doLoad(int savegameId) { { kOpsx+176,kOpsx+192,kOpsy+60,kOpsy+76,&DreamGenContext::getBackToOps }, { kOpsx+128,kOpsx+190,kOpsy+12,kOpsy+100,&DreamGenContext::actualLoad }, { kOpsx+2,kOpsx+92,kOpsy+4,kOpsy+81,&DreamGenContext::selectSlot }, - { 0,320,0,200,&DreamGenContext::blank }, + { 0,320,0,200,&DreamBase::blank }, { 0xFFFF,0,0,0,0 } }; checkCoords(loadlist); @@ -167,7 +167,7 @@ void DreamGenContext::saveGame() { { kOpsx+176,kOpsx+192,kOpsy+60,kOpsy+76,&DreamGenContext::getBackToOps }, { kOpsx+128,kOpsx+190,kOpsy+12,kOpsy+100,&DreamGenContext::actualSave }, { kOpsx+2,kOpsx+92,kOpsy+4,kOpsy+81,&DreamGenContext::selectSlot }, - { 0,320,0,200,&DreamGenContext::blank }, + { 0,320,0,200,&DreamBase::blank }, { 0xFFFF,0,0,0,0 } }; checkCoords(savelist); @@ -216,11 +216,11 @@ void DreamGenContext::saveGame() { } } -void DreamGenContext::namesToOld() { +void DreamBase::namesToOld() { memcpy(_saveNamesOld, _saveNames, 17*7); } -void DreamGenContext::oldToNames() { +void DreamBase::oldToNames() { memcpy(_saveNames, _saveNamesOld, 17*7); } @@ -237,13 +237,77 @@ void DreamGenContext::saveLoad() { doSaveLoad(); } -void DreamGenContext::showMainOps() { +void DreamGenContext::doSaveLoad() { + data.byte(kPointerframe) = 0; + data.word(kTextaddressx) = 70; + data.word(kTextaddressy) = 182-8; + data.byte(kTextlen) = 181; + data.byte(kManisoffscreen) = 1; + clearWork(); + createPanel2(); + underTextLine(); + getRidOfAll(); + loadSaveBox(); + showOpBox(); + showMainOps(); + workToScreenCPP(); + + RectWithCallback opsList[] = { + { kOpsx+59,kOpsx+114,kOpsy+30,kOpsy+76,&DreamGenContext::getBackFromOps }, + { kOpsx+10,kOpsx+77,kOpsy+10,kOpsy+59,&DreamBase::DOSReturn }, + { kOpsx+128,kOpsx+190,kOpsy+16,kOpsy+100,&DreamGenContext::discOps }, + { 0,320,0,200,&DreamBase::blank }, + { 0xFFFF,0,0,0,0 } + }; + + bool firstOps = true; + + do { // restart ops + if (firstOps) { + firstOps = false; + } else { + showOpBox(); + showMainOps(); + workToScreenM(); + } + data.byte(kGetback) = 0; + + do { // wait ops + if (data.byte(kQuitrequested)) { + data.byte(kManisoffscreen) = 0; + return; + } + + readMouse(); + showPointer(); + vSync(); + dumpPointer(); + dumpTextLine(); + delPointer(); + checkCoords(opsList); + } while (!data.byte(kGetback)); + } while (data.byte(kGetback) == 2); + + data.word(kTextaddressx) = 13; + data.word(kTextaddressy) = 182; + data.byte(kTextlen) = 240; + if (data.byte(kGetback) != 4) { + getRidOfTemp(); + restoreAll(); + redrawMainScrn(); + workToScreenM(); + data.byte(kCommandtype) = 200; + } + data.byte(kManisoffscreen) = 0; +} + +void DreamBase::showMainOps() { showFrame(tempGraphics(), kOpsx+10, kOpsy+10, 8, 0); showFrame(tempGraphics(), kOpsx+59, kOpsy+30, 7, 0); showFrame(tempGraphics(), kOpsx+128+4, kOpsy+12, 1, 0); } -void DreamGenContext::showDiscOps() { +void DreamBase::showDiscOps() { showFrame(tempGraphics(), kOpsx+128+4, kOpsy+12, 1, 0); showFrame(tempGraphics(), kOpsx+10, kOpsy+10, 9, 0); showFrame(tempGraphics(), kOpsx+59, kOpsy+30, 10, 0); @@ -522,5 +586,42 @@ void DreamGenContext::checkInput() { workToScreenM(); } +void DreamGenContext::selectSlot() { + if (data.byte(kCommandtype) != 244) { + data.byte(kCommandtype) = 244; + commandOnly(45); + } + + if (data.word(kMousebutton) != 1 || data.word(kMousebutton) == data.word(kOldbutton)) + return; // noselslot + if (data.byte(kLoadingorsave) == 3) + data.byte(kLoadingorsave)--; + + oldToNames(); + int y = data.word(kMousey) - (kOpsy + 4); + if (y < 11) + data.byte(kCurrentslot) = 0; + else + data.byte(kCurrentslot) = y / 11; + + delPointer(); + showOpBox(); + showSlots(); + showNames(); + if (data.byte(kLoadingorsave) == 1) + showLoadOps(); + else + showSaveOps(); + readMouse(); + showPointer(); + workToScreen(); + delPointer(); +} + +void DreamGenContext::selectSlot2() { + if (data.word(kMousebutton)) + data.byte(kLoadingorsave) = 2; + selectSlot(); +} } // End of namespace DreamGen diff --git a/engines/dreamweb/sprite.cpp b/engines/dreamweb/sprite.cpp index aca935cde9..1a341ce8d3 100644 --- a/engines/dreamweb/sprite.cpp +++ b/engines/dreamweb/sprite.cpp @@ -581,7 +581,7 @@ void DreamGenContext::checkOne() { al = type; } -void DreamGenContext::checkOne(uint8 x, uint8 y, uint8 *flag, uint8 *flagEx, uint8 *type, uint8 *flagX, uint8 *flagY) { +void DreamBase::checkOne(uint8 x, uint8 y, uint8 *flag, uint8 *flagEx, uint8 *type, uint8 *flagX, uint8 *flagY) { *flagX = x / 16; *flagY = y / 16; const uint8 *tileData = getSegment(data.word(kBuffers)).ptr(kMapflags + (*flagY * 11 + *flagX) * 3, 3); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 014e3143d9..d53c1a1346 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -882,13 +882,13 @@ void DreamGenContext::triggerMessage(uint16 index) { void DreamGenContext::processTrigger() { if (data.byte(kLasttrigger) == '1') { - DreamBase::setLocation(8); + setLocation(8); triggerMessage(45); } else if (data.byte(kLasttrigger) == '2') { - DreamBase::setLocation(9); + setLocation(9); triggerMessage(55); } else if (data.byte(kLasttrigger) == '3') { - DreamBase::setLocation(2); + setLocation(2); triggerMessage(59); } } @@ -1000,7 +1000,7 @@ void DreamBase::deallocateMem(uint16 segment) { } } -void DreamGenContext::DOSReturn() { +void DreamBase::DOSReturn() { if (data.byte(kCommandtype) != 250) { data.byte(kCommandtype) = 250; commandOnly(46); @@ -1409,7 +1409,7 @@ void *DreamBase::getAnyAd(uint8 *value1, uint8 *value2) { } } -void *DreamGenContext::getAnyAdDir(uint8 index, uint8 flag) { +void *DreamBase::getAnyAdDir(uint8 index, uint8 flag) { if (flag == 4) return getExAd(index); else if (flag == 2) @@ -1488,18 +1488,11 @@ bool DreamGenContext::finishedWalkingCPP() { return (data.byte(kLinepointer) == 254) && (data.byte(kFacing) == data.byte(kTurntoface)); } -void DreamGenContext::getFlagUnderP() { - uint8 flag, flagEx; - getFlagUnderP(&flag, &flagEx); - cl = flag; - ch = flagEx; -} - -void DreamGenContext::getFlagUnderP(uint8 *flag, uint8 *flagEx) { +void DreamBase::getFlagUnderP(uint8 *flag, uint8 *flagEx) { uint8 type, flagX, flagY; checkOne(data.word(kMousex) - data.word(kMapadx), data.word(kMousey) - data.word(kMapady), flag, flagEx, &type, &flagX, &flagY); - cl = data.byte(kLastflag) = *flag; - ch = data.byte(kLastflagex) = *flagEx; + data.byte(kLastflag) = *flag; + data.byte(kLastflagex) = *flagEx; } void DreamGenContext::walkAndExamine() { @@ -1574,7 +1567,8 @@ void DreamGenContext::obName(uint8 command, uint8 commandType) { } } - getFlagUnderP(); + uint8 flag, flagEx; + getFlagUnderP(&flag, &flagEx); if (data.byte(kLastflag) < 2) { blockNameText(); return; @@ -1691,7 +1685,7 @@ void DreamBase::showPointer() { } } -void DreamGenContext::animPointer() { +void DreamBase::animPointer() { if (data.byte(kPointermode) == 2) { data.byte(kPointerframe) = 0; @@ -1879,30 +1873,6 @@ bool DreamGenContext::checkIfSet(uint8 x, uint8 y) { return false; } -void DreamBase::showRyanPage() { - showFrame(engine->icons1(), kInventx + 167, kInventy - 12, 12, 0); - showFrame(engine->icons1(), kInventx + 167 + 18 * data.byte(kRyanpage), kInventy - 12, 13 + data.byte(kRyanpage), 0); -} - -void DreamGenContext::findAllRyan() { - findAllRyan(es.ptr(di, 60)); -} - -void DreamGenContext::findAllRyan(uint8 *inv) { - memset(inv, 0xff, 60); - for (size_t i = 0; i < kNumexobjects; ++i) { - DynObject *extra = getExAd(i); - if (extra->mapad[0] != 4) - continue; - if (extra->mapad[1] != 0xff) - continue; - uint8 slot = extra->mapad[2]; - assert(slot < 30); - inv[2 * slot + 0] = i; - inv[2 * slot + 1] = 4; - } -} - void DreamGenContext::hangOn() { hangOn(cx); } @@ -1938,7 +1908,7 @@ void DreamGenContext::hangOnP() { hangOnP(cx); } -void DreamGenContext::hangOnP(uint16 count) { +void DreamBase::hangOnP(uint16 count) { data.word(kMaintimer) = 0; uint8 pointerFrame = data.byte(kPointerframe); uint8 pickup = data.byte(kPickup); @@ -2022,12 +1992,12 @@ void DreamGenContext::enterSymbol() { dumpTextLine(); dumpSymbol(); RectWithCallback symbolList[] = { - { kSymbolx+40,kSymbolx+64,kSymboly+2,kSymboly+16,&DreamGenContext::quitSymbol }, - { kSymbolx,kSymbolx+52,kSymboly+20,kSymboly+50,&DreamGenContext::setTopLeft }, - { kSymbolx+52,kSymbolx+104,kSymboly+20,kSymboly+50,&DreamGenContext::setTopRight }, - { kSymbolx,kSymbolx+52,kSymboly+50,kSymboly+80,&DreamGenContext::setBotLeft }, - { kSymbolx+52,kSymbolx+104,kSymboly+50,kSymboly+80,&DreamGenContext::setBotRight }, - { 0,320,0,200,&DreamGenContext::blank }, + { kSymbolx+40,kSymbolx+64,kSymboly+2,kSymboly+16,&DreamBase::quitSymbol }, + { kSymbolx,kSymbolx+52,kSymboly+20,kSymboly+50,&DreamBase::setTopLeft }, + { kSymbolx+52,kSymbolx+104,kSymboly+20,kSymboly+50,&DreamBase::setTopRight }, + { kSymbolx,kSymbolx+52,kSymboly+50,kSymboly+80,&DreamBase::setBotLeft }, + { kSymbolx+52,kSymbolx+104,kSymboly+50,kSymboly+80,&DreamBase::setBotRight }, + { 0,320,0,200,&DreamBase::blank }, { 0xFFFF,0,0,0,0 } }; checkCoords(symbolList); @@ -2438,7 +2408,7 @@ void DreamGenContext::restoreReels() { engine->closeFile(); } -void DreamGenContext::loadFolder() { +void DreamBase::loadFolder() { loadIntoTemp("DREAMWEB.G09"); // folder graphics 1 loadIntoTemp2("DREAMWEB.G10"); // folder graphics 2 loadIntoTemp3("DREAMWEB.G11"); // folder graphics 3 @@ -2446,7 +2416,7 @@ void DreamGenContext::loadFolder() { loadTempText("DREAMWEB.T50"); // folder text } -void DreamGenContext::showFolder() { +void DreamBase::showFolder() { data.byte(kCommandtype) = 255; if (data.byte(kFolderpage)) { useTempCharset(); @@ -2471,7 +2441,7 @@ void DreamGenContext::showFolder() { } } -void DreamGenContext::showLeftPage() { +void DreamBase::showLeftPage() { showFrame(tempGraphics2(), 0, 12, 3, 0); uint16 y = 12+5; for (size_t i = 0; i < 9; ++i) { @@ -2504,7 +2474,7 @@ void DreamGenContext::showLeftPage() { } } -void DreamGenContext::showRightPage() { +void DreamBase::showRightPage() { showFrame(tempGraphics2(), 143, 12, 0, 0); uint16 y = 12+37; for (size_t i = 0; i < 7; ++i) { @@ -2552,7 +2522,7 @@ void DreamBase::panelIcons1() { showWatch(); } -void DreamGenContext::examIcon() { +void DreamBase::examIcon() { showFrame(engine->icons2(), 254, 5, 3, 0); } @@ -2560,10 +2530,6 @@ uint8 DreamBase::getLocation(uint8 index) { return data.byte(kRoomscango + index); } -void DreamGenContext::getLocation() { - al = DreamBase::getLocation(al); -} - void DreamBase::setLocation(uint8 index) { data.byte(kRoomscango + index) = 1; } @@ -2581,10 +2547,10 @@ const uint8 *DreamBase::getTextInFile1(uint16 index) { void DreamGenContext::checkFolderCoords() { RectWithCallback folderList[] = { - { 280,320,160,200, &DreamGenContext::quitKey }, + { 280,320,160,200, &DreamBase::quitKey }, { 143,300,6,194, &DreamGenContext::nextFolder }, { 0,143,6,194, &DreamGenContext::lastFolder }, - { 0,320,0,200, &DreamGenContext::blank }, + { 0,320,0,200, &DreamBase::blank }, { 0xFFFF,0,0,0, 0 } }; checkCoords(folderList); @@ -2630,10 +2596,10 @@ void DreamGenContext::lastFolder() { } } -void DreamGenContext::folderHints() { +void DreamBase::folderHints() { if (data.byte(kFolderpage) == 5) { - if ((data.byte(kAidedead) != 1) && (DreamBase::getLocation(13) != 1)) { - DreamBase::setLocation(13); + if ((data.byte(kAidedead) != 1) && (getLocation(13) != 1)) { + setLocation(13); showFolder(); const uint8 *string = getTextInFile1(30); printDirect(string, 0, 86, 141, true); @@ -2641,8 +2607,8 @@ void DreamGenContext::folderHints() { hangOnP(200); } } else if (data.byte(kFolderpage) == 9) { - if (DreamBase::getLocation(7) != 1) { - DreamBase::setLocation(7); + if (getLocation(7) != 1) { + setLocation(7); showFolder(); const uint8 *string = getTextInFile1(31); printDirect(string, 0, 86, 141, true); @@ -2652,19 +2618,15 @@ void DreamGenContext::folderHints() { } } -void DreamGenContext::folderExit() { +void DreamBase::folderExit() { showFrame(tempGraphics2(), 296, 178, 6, 0); } -void DreamGenContext::loadTravelText() { +void DreamBase::loadTravelText() { data.word(kTraveltext) = standardLoad("DREAMWEB.T81"); // location descs } -void DreamGenContext::loadTempText() { - loadTempText((const char *)data.ptr(dx, 0)); -} - -void DreamGenContext::loadTempText(const char *fileName) { +void DreamBase::loadTempText(const char *fileName) { data.word(kTextfile1) = standardLoad(fileName); } @@ -2692,7 +2654,7 @@ void DreamGenContext::allocateBuffers() { data.word(kSounddata2) = allocateMem(2048/16); } -void DreamGenContext::workToScreenM() { +void DreamBase::workToScreenM() { animPointer(); readMouse(); showPointer(); @@ -2742,8 +2704,8 @@ void DreamGenContext::useMenu() { dumpMenu(); dumpTextLine(); RectWithCallback menuList[] = { - { kMenux+54,kMenux+68,kMenuy+72,kMenuy+88,&DreamGenContext::quitKey }, - { 0,320,0,200,&DreamGenContext::blank }, + { kMenux+54,kMenux+68,kMenuy+72,kMenuy+88,&DreamBase::quitKey }, + { 0,320,0,200,&DreamBase::blank }, { 0xFFFF,0,0,0,0 } }; checkCoords(menuList); @@ -3169,7 +3131,7 @@ void DreamGenContext::intro() { data.byte(kLasthardkey) = 0; } -void DreamGenContext::setTopLeft() { +void DreamBase::setTopLeft() { if (data.byte(kSymboltopdir) != 0) { blank(); return; @@ -3184,7 +3146,7 @@ void DreamGenContext::setTopLeft() { data.byte(kSymboltopdir) = 0xFF; } -void DreamGenContext::setTopRight() { +void DreamBase::setTopRight() { if (data.byte(kSymboltopdir) != 0) { blank(); return; @@ -3199,7 +3161,7 @@ void DreamGenContext::setTopRight() { data.byte(kSymboltopdir) = 1; } -void DreamGenContext::setBotLeft() { +void DreamBase::setBotLeft() { if (data.byte(kSymbolbotdir) != 0) { blank(); return; @@ -3214,7 +3176,7 @@ void DreamGenContext::setBotLeft() { data.byte(kSymbolbotdir) = 0xFF; } -void DreamGenContext::setBotRight() { +void DreamBase::setBotRight() { if (data.byte(kSymbolbotdir) != 0) { blank(); return; @@ -3239,14 +3201,14 @@ void DreamGenContext::newGame() { data.byte(kGetback) = 3; } -void DreamGenContext::getBackFromOps() { +void DreamBase::getBackFromOps() { if (data.byte(kMandead) == 2) blank(); else getBack1(); } -void DreamGenContext::getBackToOps() { +void DreamBase::getBackToOps() { if (data.byte(kCommandtype) != 201) { data.byte(kCommandtype) = 201; commandOnly(42); @@ -3356,12 +3318,6 @@ void DreamGenContext::redrawMainScrn() { data.byte(kCommandtype) = 255; } -void DreamGenContext::selectSlot2() { - if (data.word(kMousebutton)) - data.byte(kLoadingorsave) = 2; - selectSlot(); -} - void DreamBase::blank() { if (data.byte(kCommandtype) != 199) { data.byte(kCommandtype) = 199; @@ -3392,7 +3348,7 @@ void DreamGenContext::makeMainScreen() { data.byte(kManisoffscreen) = 0; } -void DreamGenContext::openInv() { +void DreamBase::openInv() { data.byte(kInvopen) = 1; printMessage(80, 58 - 10, 61, 240, (240 & 1)); fillRyan(); @@ -3403,8 +3359,8 @@ void DreamGenContext::obsThatDoThings() { if (!compare(data.byte(kCommand), data.byte(kObjecttype), "MEMB")) return; // notlouiscard - if (DreamBase::getLocation(4) != 1) { - DreamBase::setLocation(4); + if (getLocation(4) != 1) { + setLocation(4); lookAtCard(); } } @@ -3704,7 +3660,7 @@ void DreamGenContext::selectLocation() { { 280,308,4,44,&DreamGenContext::lookAtPlace }, { 104,216,138,192,&DreamGenContext::destSelect }, { 273,320,157,198,&DreamGenContext::getBack1 }, - { 0,320,0,200,&DreamGenContext::blank }, + { 0,320,0,200,&DreamBase::blank }, { 0xFFFF,0,0,0,0 } }; checkCoords(destList); @@ -3722,7 +3678,7 @@ void DreamGenContext::selectLocation() { } -void DreamGenContext::examineInventory() { +void DreamBase::examineInventory() { if (data.byte(kCommandtype) != 249) { data.byte(kCommandtype) = 249; commandOnly(32); @@ -3781,13 +3737,11 @@ void DreamBase::showDiary() { showFrame(tempGraphics(), kDiaryx + 176, kDiaryy + 108, 2, 0); } -void DreamGenContext::underTextLine() { +void DreamBase::underTextLine() { uint16 y = data.word(kTextaddressy); if (data.byte(kForeignrelease)) y -= 3; - ds = data.word(kBuffers); - si = kTextunder; - multiGet(ds.ptr(si, 0), data.byte(kTextaddressx), y, kUndertextsizex, kUndertextsizey); + multiGet(textUnder(), data.byte(kTextaddressx), y, kUndertextsizex, kUndertextsizey); } void DreamGenContext::showDecisions() { @@ -3797,16 +3751,12 @@ void DreamGenContext::showDecisions() { underTextLine(); } -void DreamGenContext::getUnderZoom() { - ds = data.word(kBuffers); - si = kZoomspace; - multiGet(ds.ptr(si, 0), kZoomx + 5, kZoomy + 4, 46, 40); +void DreamBase::getUnderZoom() { + multiGet(getSegment(data.word(kBuffers)).ptr(kZoomspace, 0), kZoomx + 5, kZoomy + 4, 46, 40); } -void DreamGenContext::putUnderZoom() { - ds = data.word(kBuffers); - si = kZoomspace; - multiPut(ds.ptr(si, 0), kZoomx + 5, kZoomy + 4, 46, 40); +void DreamBase::putUnderZoom() { + multiPut(getSegment(data.word(kBuffers)).ptr(kZoomspace, 0), kZoomx + 5, kZoomy + 4, 46, 40); } void DreamGenContext::showWatchReel() { @@ -3939,9 +3889,9 @@ void DreamGenContext::decide() { RectWithCallback decideList[] = { { kOpsx+69,kOpsx+124,kOpsy+30,kOpsy+76,&DreamGenContext::newGame }, - { kOpsx+20,kOpsx+87,kOpsy+10,kOpsy+59,&DreamGenContext::DOSReturn }, + { kOpsx+20,kOpsx+87,kOpsy+10,kOpsy+59,&DreamBase::DOSReturn }, { kOpsx+123,kOpsx+190,kOpsy+10,kOpsy+59,&DreamGenContext::loadOld }, - { 0,320,0,200,&DreamGenContext::blank }, + { 0,320,0,200,&DreamBase::blank }, { 0xFFFF,0,0,0,0 } }; @@ -3985,7 +3935,7 @@ void DreamGenContext::talk() { RectWithCallback talkList[] = { { 273,320,157,198,&DreamGenContext::getBack1 }, { 240,290,2,44,&DreamGenContext::moreTalk }, - { 0,320,0,200,&DreamGenContext::blank }, + { 0,320,0,200,&DreamBase::blank }, { 0xFFFF,0,0,0,0 } }; @@ -4040,7 +3990,7 @@ void DreamGenContext::discOps() { { kOpsx+59,kOpsx+114,kOpsy+30,kOpsy+76,&DreamGenContext::loadGame }, { kOpsx+10,kOpsx+79,kOpsy+10,kOpsy+59,&DreamGenContext::saveGame }, { kOpsx+176,kOpsx+192,kOpsy+60,kOpsy+76,&DreamGenContext::getBackToOps }, - { 0,320,0,200,&DreamGenContext::blank }, + { 0,320,0,200,&DreamBase::blank }, { 0xFFFF,0,0,0,0 } }; @@ -4058,76 +4008,12 @@ void DreamGenContext::discOps() { } while (!data.byte(kGetback)); } -void DreamGenContext::doSaveLoad() { - data.byte(kPointerframe) = 0; - data.word(kTextaddressx) = 70; - data.word(kTextaddressy) = 182-8; - data.byte(kTextlen) = 181; - data.byte(kManisoffscreen) = 1; - clearWork(); - createPanel2(); - underTextLine(); - getRidOfAll(); - loadSaveBox(); - showOpBox(); - showMainOps(); - workToScreenCPP(); - - RectWithCallback opsList[] = { - { kOpsx+59,kOpsx+114,kOpsy+30,kOpsy+76,&DreamGenContext::getBackFromOps }, - { kOpsx+10,kOpsx+77,kOpsy+10,kOpsy+59,&DreamGenContext::DOSReturn }, - { kOpsx+128,kOpsx+190,kOpsy+16,kOpsy+100,&DreamGenContext::discOps }, - { 0,320,0,200,&DreamGenContext::blank }, - { 0xFFFF,0,0,0,0 } - }; - - bool firstOps = true; - - do { // restart ops - if (firstOps) { - firstOps = false; - } else { - showOpBox(); - showMainOps(); - workToScreenM(); - } - data.byte(kGetback) = 0; - - do { // wait ops - if (data.byte(kQuitrequested)) { - data.byte(kManisoffscreen) = 0; - return; - } - - readMouse(); - showPointer(); - vSync(); - dumpPointer(); - dumpTextLine(); - delPointer(); - checkCoords(opsList); - } while (!data.byte(kGetback)); - } while (data.byte(kGetback) == 2); - - data.word(kTextaddressx) = 13; - data.word(kTextaddressy) = 182; - data.byte(kTextlen) = 240; - if (data.byte(kGetback) != 4) { - getRidOfTemp(); - restoreAll(); - redrawMainScrn(); - workToScreenM(); - data.byte(kCommandtype) = 200; - } - data.byte(kManisoffscreen) = 0; -} - void DreamGenContext::hangOnPQ() { data.byte(kGetback) = 0; RectWithCallback quitList[] = { { 273,320,157,198,&DreamGenContext::getBack1 }, - { 0,320,0,200,&DreamGenContext::blank }, + { 0,320,0,200,&DreamBase::blank }, { 0xFFFF,0,0,0,0 } }; @@ -4276,7 +4162,7 @@ void DreamGenContext::cantDrop() { workToScreenM(); } -void DreamGenContext::getBack1() { +void DreamBase::getBack1() { if (data.byte(kPickup) != 0) { blank(); return; @@ -4383,7 +4269,7 @@ void DreamGenContext::autoAppear() { // In alley al = 5; resetLocation(); - DreamBase::setLocation(10); + setLocation(10); data.byte(kDestpos) = 10; return; } @@ -4414,7 +4300,7 @@ void DreamGenContext::autoAppear() { data.byte(kNewsitem) = 3; al = 6; resetLocation(); - DreamBase::setLocation(11); + setLocation(11); data.byte(kDestpos) = 11; } else { if (data.byte(kReallocation) == 2 && data.byte(kRockstardead) != 0) @@ -4423,7 +4309,7 @@ void DreamGenContext::autoAppear() { } } -void DreamGenContext::quitKey() { +void DreamBase::quitKey() { if (data.byte(kCommandtype) != 222) { data.byte(kCommandtype) = 222; commandOnly(4); @@ -4557,38 +4443,6 @@ void DreamGenContext::entryAnims() { } } -void DreamGenContext::selectSlot() { - if (data.byte(kCommandtype) != 244) { - data.byte(kCommandtype) = 244; - commandOnly(45); - } - - if (data.word(kMousebutton) != 1 || data.word(kMousebutton) == data.word(kOldbutton)) - return; // noselslot - if (data.byte(kLoadingorsave) == 3) - data.byte(kLoadingorsave)--; - - oldToNames(); - int y = data.word(kMousey) - (kOpsy + 4); - if (y < 11) - data.byte(kCurrentslot) = 0; - else - data.byte(kCurrentslot) = y / 11; - - delPointer(); - showOpBox(); - showSlots(); - showNames(); - if (data.byte(kLoadingorsave) == 1) - showLoadOps(); - else - showSaveOps(); - readMouse(); - showPointer(); - workToScreen(); - delPointer(); -} - void DreamGenContext::updateSymbolTop() { if (!data.byte(kSymboltopdir)) return; // topfinished diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index c028c6851b..0e407415e8 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -72,8 +72,6 @@ void getUnderTimed(); void putUnderTimed(); void dumpTextLine(); - void oldToNames(); - void namesToOld(); void startLoading(const Room &room); void showFrame(); void showFrame(const Frame *frameData, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag, uint8 *width, uint8 *height) { @@ -160,14 +158,12 @@ DynObject *getExAd(uint8 index) { return DreamBase::getExAd(index); } - DynObject *getEitherAdCPP(); void *getAnyAd(uint8 *value1, uint8 *value2) { return DreamBase::getAnyAd(value1, value2); } SetObject *getSetAd(uint8 index) { return DreamBase::getSetAd(index); } - void *getAnyAdDir(uint8 index, uint8 flag); void setAllChanges(); void doChange(uint8 index, uint8 value, uint8 type); void deleteTaken(); @@ -181,13 +177,12 @@ bool finishedWalkingCPP(); void finishedWalking(); void checkOne(); - void checkOne(uint8 x, uint8 y, uint8 *flag, uint8 *flagEx, uint8 *type, uint8 *flagX, uint8 *flagY); - void getFlagUnderP(); - void getFlagUnderP(uint8 *flag, uint8 *flagEx); + void checkOne(uint8 x, uint8 y, uint8 *flag, uint8 *flagEx, uint8 *type, uint8 *flagX, uint8 *flagY) { + DreamBase::checkOne(x, y, flag, flagEx, type, flagX, flagY); + } void walkAndExamine(); void obName(); void obName(uint8 command, uint8 commandType); - void animPointer(); void checkCoords(const RectWithCallback *rectWithCallbacks); void addToPeopleList(); void addToPeopleList(ReelRoutine *routine); @@ -201,15 +196,16 @@ void checkIfPathIsOn(); bool checkIfPathIsOn(uint8 index); void isItWorn(); - bool isItWorn(const DynObject *object); + bool isItWorn(const DynObject *object) { + return DreamBase::isItWorn(object); + } void wornError(); void makeWorn(); void makeWorn(DynObject *object); void obToInv(); - void obToInv(uint8 index, uint8 flag, uint16 x, uint16 y); - void findAllRyan(); - void findAllRyan(uint8 *inv); - void fillRyan(); + void obToInv(uint8 index, uint8 flag, uint16 x, uint16 y) { + DreamBase::obToInv(index, flag, x, y); + } void useRoutine(); void hangOn(); void hangOn(uint16 frameCount) { @@ -218,7 +214,9 @@ void hangOnW(); void hangOnW(uint16 frameCount); void hangOnP(); - void hangOnP(uint16 count); + void hangOnP(uint16 count) { + DreamBase::hangOnP(count); + } uint8 findNextColon(const uint8 **string) { return DreamBase::findNextColon(string); } @@ -274,15 +272,12 @@ void playChannel1(uint8 index) { DreamBase::playChannel1(index); } - void showMainOps(); - void showDiscOps(); void findRoomInLoc(); void reelsOnScreen(); void reconstruct(); void look(); void autoLook(); void doLook(); - void getBackFromOb(); void getRidOfAll(); void getRidOfTemp(); void getRidOfTempText(); @@ -351,28 +346,14 @@ void wearWatch(); void wearShades(); void checkFolderCoords(); - void loadFolder(); - void showFolder(); - void showLeftPage(); - void showRightPage(); void nextFolder(); void lastFolder(); - void folderHints(); - void folderExit(); - void getLocation(); - uint8 getLocation(uint8 index) { - return DreamBase::getLocation(index); - } void setLocation(); void setLocation(uint8 index) { DreamBase::setLocation(index); } - void loadTempText(); - void loadTempText(const char *fileName); - void loadTravelText(); void drawFloor(); void allocateBuffers(); - void workToScreenM(); bool checkSpeed(ReelRoutine &routine); void checkSpeed(); void sparkyDrip(ReelRoutine &routine); @@ -422,7 +403,6 @@ void loadSaveBox(); uint8 nextSymbol(uint8 symbol); void showSymbol(); - void examIcon(); void enterCode(uint8 digit0, uint8 digit1, uint8 digit2, uint8 digit3); unsigned int scanForNames(); void doLoad(int slot); @@ -446,13 +426,7 @@ void clearReels(); void getRidOfReels(); void liftNoise(uint8 index); - void setTopLeft(); - void setTopRight(); - void setBotLeft(); - void setBotRight(); void newGame(); - void getBackFromOps(); - void getBackToOps(); void pickupOb(uint8 command, uint8 pos); void initialInv(); void walkIntoRoom(); @@ -469,7 +443,6 @@ void openEden(); void openSarters(); void openLouis(); - void DOSReturn(); void useLadder(); void useLadderB(); void useCart(); @@ -490,7 +463,6 @@ void hotelControl(); void obsThatDoThings(); void makeMainScreen(); - void openInv(); void delEverything(); void clearPalette(); void errorMessage1(); @@ -514,7 +486,6 @@ } void getTime(); void set16ColPalette(); - void examineInventory(); void showSaveOps(); void showLoadOps(); void watchReel(); @@ -526,9 +497,6 @@ void afterNewRoom(); void madmanRun(); void showDecisions(); - void underTextLine(); - void getUnderZoom(); - void putUnderZoom(); void decide(); void talk(); void discOps(); @@ -542,7 +510,6 @@ void checkInput(); void dropError(); void cantDrop(); - void getBack1(); void newPlace(); void showPuzText(uint16 command, uint16 count); void showPuzText(); @@ -550,7 +517,6 @@ void rollEndCredits2(); void useButtonA(); void autoAppear(); - void quitKey(); void setupTimedUse(); void entryAnims(); void triggerMessage(uint16 index); -- cgit v1.2.3 From e7a436545d24298d5da82a011eac1fdcdb35be25 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 15 Dec 2011 13:52:20 +0100 Subject: TSAGE: R2R - Fix bug in scene 2700, thanks to fingolfin --- engines/tsage/ringworld2/ringworld2_scenes2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/tsage/ringworld2/ringworld2_scenes2.cpp b/engines/tsage/ringworld2/ringworld2_scenes2.cpp index a81aee41de..9c6b65658c 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes2.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes2.cpp @@ -3633,7 +3633,7 @@ void Scene2700::process(Event &event) { event.handled = true; R2_GLOBALS._player.updateAngle(Common::Point(event.mousePos.x, event.mousePos.y)); } - if (_sceneMode = 10) { + if (_sceneMode == 10) { R2_GLOBALS._player.disableControl(); switch (_field412) { case 0: -- cgit v1.2.3 From d1ed87beceb68a2b33db9989e6a480bbda6a73d1 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 15 Dec 2011 14:09:53 +0100 Subject: DREAMWEB: Convert notHeldError to C++, move stuff to DreamBase --- engines/dreamweb/dreambase.h | 17 ++++++++++++++++- engines/dreamweb/dreamgen.cpp | 19 ------------------- engines/dreamweb/dreamgen.h | 1 - engines/dreamweb/object.cpp | 2 +- engines/dreamweb/sprite.cpp | 8 ++++---- engines/dreamweb/stubs.cpp | 32 ++++++++++---------------------- engines/dreamweb/stubs.h | 28 ++++------------------------ engines/dreamweb/use.cpp | 11 +++++++++++ 8 files changed, 46 insertions(+), 72 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index de7bada943..727a81ce8b 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -116,6 +116,7 @@ public: void fillRyan(); void findAllRyan(uint8 *inv); void obToInv(uint8 index, uint8 flag, uint16 x, uint16 y); + void obPicture(); // from pathfind.cpp void checkDest(const RoomPaths *roomsPaths); @@ -163,10 +164,14 @@ public: const Frame *findSource(uint16 &frame); void showReelFrame(Reel *reel); const Frame *getReelFrameAX(uint16 frame); - void soundOnReels(uint16 reelPointer); void rollEndCredits(); void priestText(ReelRoutine &routine); void checkOne(uint8 x, uint8 y, uint8 *flag, uint8 *flagEx, uint8 *type, uint8 *flagX, uint8 *flagY); + void soundOnReels(uint16 reelPointer); + void clearBeforeLoad(); + void clearReels(); + void getRidOfReels(); + void liftNoise(uint8 index); // from stubs.cpp void crosshair(); @@ -240,6 +245,7 @@ public: void getFlagUnderP(uint8 *flag, uint8 *flagEx); void workToScreenM(); void quitKey(); + void restoreReels(); void loadFolder(); void folderHints(); void folderExit(); @@ -258,6 +264,15 @@ public: void getBackToOps(); void DOSReturn(); bool isItWorn(const DynObject *object); + bool compare(uint8 index, uint8 flag, const char id[4]); + void hangOnW(uint16 frameCount); + void getRidOfTemp(); + void getRidOfTempText(); + void getRidOfTemp2(); + void getRidOfTemp3(); + void getRidOfTempCharset(); + void getRidOfTempsP(); + void getRidOfAll(); // from use.cpp void placeFreeObject(uint8 index); diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index afb537f387..92bb062aab 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -3088,25 +3088,6 @@ finishpars: di = offset_operand1; } -void DreamGenContext::notHeldError() { - STACK_CHECK; - createPanel(); - showPanel(); - showMan(); - showExit(); - obIcons(); - di = 64; - bx = 100; - al = 63; - ah = 1; - dl = 201; - printMessage2(); - workToScreenM(); - cx = 50; - hangOnP(); - putBackObStuff(); -} - void DreamGenContext::nextColon() { STACK_CHECK; lookcolon: diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 16a42d2e25..fbefd91099 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -514,7 +514,6 @@ public: void transferMap(); void purgeAnItem(); void purgeALocation(); - void notHeldError(); void getSetAd(); void showKeys(); void nextColon(); diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index b430183cee..5f326a5a03 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -107,7 +107,7 @@ void DreamBase::obToInv(uint8 index, uint8 flag, uint16 x, uint16 y) { showFrame(engine->icons1(), x - 3, y - 2, 7, 0); } -void DreamGenContext::obPicture() { +void DreamBase::obPicture() { if (data.byte(kObjecttype) == 1) return; Frame *frames; diff --git a/engines/dreamweb/sprite.cpp b/engines/dreamweb/sprite.cpp index 1a341ce8d3..c69ac2a3f5 100644 --- a/engines/dreamweb/sprite.cpp +++ b/engines/dreamweb/sprite.cpp @@ -1191,7 +1191,7 @@ void DreamBase::soundOnReels(uint16 reelPointer) { data.word(kLastsoundreel) = (uint16)-1; } -void DreamGenContext::clearBeforeLoad() { +void DreamBase::clearBeforeLoad() { if (data.byte(kRoomloaded) != 1) return /* (noclear) */; @@ -1213,13 +1213,13 @@ void DreamGenContext::clearBeforeLoad() { data.byte(kRoomloaded) = 0; } -void DreamGenContext::clearReels() { +void DreamBase::clearReels() { deallocateMem(data.word(kReel1)); deallocateMem(data.word(kReel2)); deallocateMem(data.word(kReel3)); } -void DreamGenContext::getRidOfReels() { +void DreamBase::getRidOfReels() { if (data.byte(kRoomloaded) == 0) return /* (dontgetrid) */; @@ -1228,7 +1228,7 @@ void DreamGenContext::getRidOfReels() { deallocateMem(data.word(kReel3)); } -void DreamGenContext::liftNoise(uint8 index) { +void DreamBase::liftNoise(uint8 index) { if (data.byte(kReallocation) == 5 || data.byte(kReallocation) == 21) playChannel1(13); // hiss noise else diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index d53c1a1346..c353948abb 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -1739,20 +1739,12 @@ void DreamBase::animPointer() { data.byte(kPointerframe) = 8; } -void DreamGenContext::printMessage() { - printMessage(di, bx, al, dl, (bool)(dl & 1)); -} - void DreamBase::printMessage(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered) { uint16 offset = kTextstart + getSegment(data.word(kCommandtext)).word(index * 2); const uint8 *string = getSegment(data.word(kCommandtext)).ptr(offset, 0); printDirect(string, x, y, maxWidth, centered); } -void DreamGenContext::printMessage2() { - printMessage2(di, bx, al, dl, (bool)(dl & 1), ah); -} - void DreamBase::printMessage2(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered, uint8 count) { uint16 offset = kTextstart + getSegment(data.word(kCommandtext)).word(index * 2); const uint8 *string = getSegment(data.word(kCommandtext)).ptr(offset, 0); @@ -1776,7 +1768,7 @@ void DreamGenContext::compare() { flags._z = compare(al, ah, id); } -bool DreamGenContext::compare(uint8 index, uint8 flag, const char id[4]) { +bool DreamBase::compare(uint8 index, uint8 flag, const char id[4]) { return objectMatches(getAnyAdDir(index, flag), id); } @@ -1886,11 +1878,7 @@ void DreamBase::hangOn(uint16 frameCount) { } } -void DreamGenContext::hangOnW() { - hangOnW(cx); -} - -void DreamGenContext::hangOnW(uint16 frameCount) { +void DreamBase::hangOnW(uint16 frameCount) { while (frameCount) { delPointer(); readMouse(); @@ -2295,31 +2283,31 @@ void DreamBase::useTempCharset() { engine->setCurrentCharset(engine->tempCharset()); } -void DreamGenContext::getRidOfTemp() { +void DreamBase::getRidOfTemp() { deallocateMem(data.word(kTempgraphics)); } -void DreamGenContext::getRidOfTempText() { +void DreamBase::getRidOfTempText() { deallocateMem(data.word(kTextfile1)); } -void DreamGenContext::getRidOfTemp2() { +void DreamBase::getRidOfTemp2() { deallocateMem(data.word(kTempgraphics2)); } -void DreamGenContext::getRidOfTemp3() { +void DreamBase::getRidOfTemp3() { deallocateMem(data.word(kTempgraphics3)); } -void DreamGenContext::getRidOfTempCharset() { +void DreamBase::getRidOfTempCharset() { engine->freeTempCharset(); } -void DreamGenContext::getRidOfTempsP() { +void DreamBase::getRidOfTempsP() { deallocateMem(data.word(kTempsprites)); } -void DreamGenContext::getRidOfAll() { +void DreamBase::getRidOfAll() { deallocateMem(data.word(kBackdrop)); deallocateMem(data.word(kSetframes)); deallocateMem(data.word(kReel1)); @@ -2381,7 +2369,7 @@ void DreamGenContext::restoreAll() { setAllChanges(); } -void DreamGenContext::restoreReels() { +void DreamBase::restoreReels() { if (data.byte(kRoomloaded) == 0) return; diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 0e407415e8..0f5a5ca115 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -58,14 +58,6 @@ uint8 printDirect(const uint8* string, uint16 x, uint16 y, uint8 maxWidth, bool centered) { return DreamBase::printDirect(string, x, y, maxWidth, centered); } - void printMessage(); - void printMessage(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered) { - DreamBase::printMessage(x, y, index, maxWidth, centered); - } - void printMessage2(); - void printMessage2(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered, uint8 count) { - DreamBase::printMessage2(x, y, index, maxWidth, centered, count); - } void useTimedText(); void dumpTimedText(); void setupTimedTemp(uint8 textIndex, uint8 voiceIndex, uint8 x, uint8 y, uint16 countToTimed, uint16 timeCount); @@ -187,9 +179,10 @@ void addToPeopleList(); void addToPeopleList(ReelRoutine *routine); void getExPos(); - void obPicture(); void compare(); - bool compare(uint8 index, uint8 flag, const char id[4]); + bool compare(uint8 index, uint8 flag, const char id[4]) { + return DreamBase::compare(index, flag, id); + } bool pixelCheckSet(const ObjPos *pos, uint8 x, uint8 y); void checkIfSet(); bool checkIfSet(uint8 x, uint8 y); @@ -211,8 +204,6 @@ void hangOn(uint16 frameCount) { DreamBase::hangOn(frameCount); } - void hangOnW(); - void hangOnW(uint16 frameCount); void hangOnP(); void hangOnP(uint16 count) { DreamBase::hangOnP(count); @@ -278,13 +269,6 @@ void look(); void autoLook(); void doLook(); - void getRidOfAll(); - void getRidOfTemp(); - void getRidOfTempText(); - void getRidOfTemp2(); - void getRidOfTemp3(); - void getRidOfTempCharset(); - void getRidOfTempsP(); void showFirstUse(); void showSecondUse(); void actualSave(); @@ -292,7 +276,6 @@ void loadPosition(unsigned int slot); void savePosition(unsigned int slot, const char *descbuf); void restoreAll(); - void restoreReels(); void enterSymbol(); void viewFolder(); void edensCDPlayer(); @@ -422,10 +405,6 @@ void realCredits(); void runIntroSeq(); void intro(); - void clearBeforeLoad(); - void clearReels(); - void getRidOfReels(); - void liftNoise(uint8 index); void newGame(); void pickupOb(uint8 command, uint8 pos); void initialInv(); @@ -537,5 +516,6 @@ byte getOpenedSizeCPP(); void openOb(); void withWhat(); + void notHeldError(); #endif diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp index 87b3640e03..08b96cf33a 100644 --- a/engines/dreamweb/use.cpp +++ b/engines/dreamweb/use.cpp @@ -1495,5 +1495,16 @@ void DreamGenContext::withWhat() { data.byte(kInvopen) = 2; } +void DreamGenContext::notHeldError() { + createPanel(); + showPanel(); + showMan(); + showExit(); + obIcons(); + printMessage2(64, 100, 63, 200 + 1, true, 1); + workToScreenM(); + hangOnP(50); + putBackObStuff(); +} } // End of namespace DreamGen -- cgit v1.2.3 From f0d47faaba13b13de95e8a3d70607d8bbefc022d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 15 Dec 2011 16:59:45 +0100 Subject: TSAGE: R2R - Implement scene 2750, fix bug in scene 2700 --- engines/tsage/ringworld2/ringworld2_logic.cpp | 2 + engines/tsage/ringworld2/ringworld2_scenes2.cpp | 456 +++++++++++++++++++++++ engines/tsage/ringworld2/ringworld2_scenes2.h | 81 +++- engines/tsage/ringworld2/ringworld2_speakers.cpp | 86 +++++ engines/tsage/ringworld2/ringworld2_speakers.h | 16 + 5 files changed, 639 insertions(+), 2 deletions(-) (limited to 'engines') diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index 3e0d36be8d..a33a9a5e9e 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -156,6 +156,8 @@ Scene *Ringworld2Game::createScene(int sceneNumber) { // Forest Maze return new Scene2700(); case 2750: + // Forest Maze + return new Scene2750(); case 2800: case 2900: error("Missing scene %d from group 2", sceneNumber); diff --git a/engines/tsage/ringworld2/ringworld2_scenes2.cpp b/engines/tsage/ringworld2/ringworld2_scenes2.cpp index 9c6b65658c..abcf16405b 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes2.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes2.cpp @@ -3706,5 +3706,461 @@ void Scene2700::process(Event &event) { Scene::process(event); } +/*-------------------------------------------------------------------------- + * Scene 2750 - Forest Maze + * + *--------------------------------------------------------------------------*/ +Scene2750::Scene2750(): SceneExt() { + _field412 = _field414 = _field416 = 0; +} + +void Scene2750::synchronize(Serializer &s) { + SceneExt::synchronize(s); + + s.syncAsSint16LE(_field412); + s.syncAsSint16LE(_field414); + s.syncAsSint16LE(_field416); +} + +void Scene2750::Action1::signal() { + Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene; + + switch (_actionIndex) { + case 1: + setDelay(60 + R2_GLOBALS._randomSource.getRandomNumber(240)); + _actionIndex = 2; + scene->_actor5.show(); + scene->_actor5.animate(ANIM_MODE_8, 1, NULL); + break; + case 2: + setDelay(600 + R2_GLOBALS._randomSource.getRandomNumber(600)); + _actionIndex = 0; + scene->_actor5.show(); + scene->_actor3.animate(ANIM_MODE_2, NULL); + break; + default: + setDelay(30); + _actionIndex = 1; + scene->_actor3.animate(ANIM_MODE_6, NULL); + scene->_actor4.animate(ANIM_MODE_8, 1, NULL); + break; + } +} + +void Scene2750::Action2::signal() { + Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene; + + setDelay(600 + R2_GLOBALS._randomSource.getRandomNumber(300)); + scene->_actor6.animate(ANIM_MODE_8, 1, NULL); +} + +void Scene2750::Action3::signal() { + Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene; + + if (scene->_actor7._position.x <= 320) { + setDelay(1800 + R2_GLOBALS._randomSource.getRandomNumber(600)); + } else { + setDelay(60); + scene->_actor7.setPosition(Common::Point(-10, 25)); + Common::Point pt(330, 45); + NpcMover *mover = new NpcMover(); + scene->_actor7.addMover(mover, &pt, NULL); + } +} + +void Scene2750::Action4::signal() { + Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene; + + setDelay(600 + R2_GLOBALS._randomSource.getRandomNumber(300)); + scene->_actor8.animate(ANIM_MODE_8, 1, NULL); +} + +void Scene2750::Action5::signal() { + Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene; + + setDelay(600 + R2_GLOBALS._randomSource.getRandomNumber(300)); + scene->_actor9.animate(ANIM_MODE_8, 1, NULL); +} + +void Scene2750::Action6::signal() { + Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene; + + setDelay(600 + R2_GLOBALS._randomSource.getRandomNumber(300)); + scene->_actor10.animate(ANIM_MODE_8, 1, NULL); +} + +void Scene2750::Action7::signal() { + Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene; + + setDelay(600 + R2_GLOBALS._randomSource.getRandomNumber(300)); + scene->_actor11.animate(ANIM_MODE_8, 1, NULL); +} + +void Scene2750::Area1::process(Event &event) { + SceneArea::process(event); + if ((event.eventType == EVENT_BUTTON_DOWN) && (R2_GLOBALS._player._canWalk) && (_bounds.contains(event.mousePos.x, event.mousePos.y))) { + Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene; + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 10; + scene->_field414 = 2752; + switch (scene->_field412) { + case 1: { + scene->_sceneMode = 2752; + scene->setAction(&scene->_sequenceManager, scene, 2752, &R2_GLOBALS._player, NULL); + break; + } + case 2: { + Common::Point pt(140, 142); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); + break; + } + case 3: { + Common::Point pt(210, 142); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); + break; + } + default: + break; + } + } +} + +void Scene2750::Area2::process(Event &event) { + SceneArea::process(event); + if ((event.eventType == EVENT_BUTTON_DOWN) && (R2_GLOBALS._player._canWalk) && (_bounds.contains(event.mousePos.x, event.mousePos.y))) { + Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene; + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 10; + scene->_field414 = 2753; + switch (scene->_field412) { + case 1: { + Common::Point pt(140, 142); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); + break; + } + case 2: { + Common::Point pt(210, 142); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); + break; + } + case 3: { + scene->_sceneMode = 2753; + scene->setAction(&scene->_sequenceManager, scene, 2753, &R2_GLOBALS._player, NULL); + break; + } + default: + break; + } + } +} + +void Scene2750::postInit(SceneObjectList *OwnerList) { + loadScene(2750); + R2_GLOBALS._sound2.stop(); + SceneExt::postInit(); + _area1.setDetails(Rect(0, 90, 20, 135), EXITCURSOR_W); + _area2.setDetails(Rect(300, 90, 320, 135), EXITCURSOR_E); + + _rect1.set(30, 127, 155, 147); + _rect2.set(130, 142, 210, 167); + _rect3.set(-1, 137, 290, 147); + + if (R2_INVENTORY.getObjectScene(36) == 0) { + R2_GLOBALS._sound1.changeSound(235); + _actor2.postInit(); + _actor2.setup(2751, 1, 1); + _actor2.setPosition(Common::Point(104, 158)); + _actor2.animate(ANIM_MODE_2, NULL); + } + + _actor3.postInit(); + _actor3.setup(2750, 1, 1); + _actor3.setPosition(Common::Point(188, 34)); + _actor3.animate(ANIM_MODE_2, NULL); + _actor3._numFrames = 16; + + _actor4.postInit(); + _actor4.setup(2700, 4, 1); + _actor4.setPosition(Common::Point(188, 37)); + _actor4.fixPriority(26); + + _actor5.postInit(); + _actor5.setup(2750, 2, 1); + _actor5.setPosition(Common::Point(188, 34)); + _actor5.hide(); + + _actor3.setAction(&_action1); + + _actor6.postInit(); + _actor6.setup(2750, 3, 1); + _actor6.setPosition(Common::Point(9, 167)); + _actor6.fixPriority(252); + _actor6.setAction(&_action2); + + _actor7.postInit(); + _actor7.setup(2750, 4, 1); + _actor7.setPosition(Common::Point(-10, 25)); + _actor7.animate(ANIM_MODE_1, NULL); + _actor7.setStrip2(4); + _actor7._moveRate = 20; + _actor7.setAction(&_action3); + + _actor8.postInit(); + _actor8.fixPriority(26); + _actor8.setup(2750, 5, 1); + _actor8.setPosition(Common::Point(258, 33)); + _actor8.setAction(&_action4); + + _actor9.postInit(); + _actor9.fixPriority(26); + _actor9.setup(2750, 6, 1); + _actor9.setPosition(Common::Point(61, 38)); + _actor9.setAction(&_action5); + + _actor10.postInit(); + _actor10.fixPriority(26); + _actor10.setup(2750, 7, 1); + _actor10.setPosition(Common::Point(69, 37)); + _actor10.setAction(&_action6); + + _actor11.postInit(); + _actor11.fixPriority(26); + _actor11.setup(2750, 8, 1); + _actor11.setPosition(Common::Point(80, 35)); + _actor11.setAction(&_action7); + + _item2.setDetails(Rect(29, 50, 35, 56), 2750, 3, -1, 5, 1, NULL); + _item3.setDetails(Rect(47, 36, 54, 42), 2750, 3, -1, 5, 1, NULL); + _item4.setDetails(Rect(193, 21, 206, 34), 2750, 3, -1, 5, 1, NULL); + _item5.setDetails(Rect(301, 18, 315, 32), 2750, 3, -1, 5, 1, NULL); + _item1.setDetails(Rect(0, 0, 320, 200), 2700, 0, -1, 2, 1, NULL); + + _stripManager.setColors(60, 255); + _stripManager.setFontNumber(3); + _stripManager.addSpeaker(&_quinnSpeaker); + _stripManager.addSpeaker(&_nejSpeaker); + + if (R2_INVENTORY.getObjectScene(36) == 0) { + _actor1.postInit(); + _actor1.setup(2752, 5, 1); + _actor1.animate(ANIM_MODE_NONE, NULL); + _actor1.setPosition(Common::Point(101, 148)); + } + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.setVisage(19); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player._moveDiff = Common::Point(2, 2); + R2_GLOBALS._player.disableControl(); + + if (R2_GLOBALS._sceneManager._previousScene == 2700) { + if (R2_INVENTORY.getObjectScene(36) == 0) { + R2_GLOBALS._player.setVisage(2752); + R2_GLOBALS._player.setStrip(6); + R2_GLOBALS._player.animate(ANIM_MODE_NONE, NULL); + R2_GLOBALS._player.setPosition(Common::Point(81, 165)); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + _field416 = 1204; + _sceneMode = 11; + _stripManager.start(_field416, this); + } else { + _sceneMode = 2750; + _field412 = 1; + R2_GLOBALS._player.setAction(&_sequenceManager, this, 2750, &R2_GLOBALS._player, NULL); + } + } else if (R2_GLOBALS._sceneManager._previousScene == 2800) { + _sceneMode = 2751; + _field412 = 3; + R2_GLOBALS._player.setAction(&_sequenceManager, this, 2751, &R2_GLOBALS._player, NULL); + } else { + _field412 = 1; + R2_GLOBALS._player.setPosition(Common::Point(90, 137)); + R2_GLOBALS._player.setStrip(3); + R2_GLOBALS._player.enableControl(); + } +} +void Scene2750::signal() { + switch (_sceneMode) { + case 10: + switch (_field414) { + case 1: + switch (_field412) { + case 2: { + _sceneMode = _field414; + _field412 = 1; + Common::Point pt(90, 137); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 3: { + _field412 = 2; + Common::Point pt(140, 142); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + default: + break; + } + break; + case 2: { + _sceneMode = _field414; + _field412 = 2; + Common::Point pt(170, 162); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 3: + switch (_field412) { + case 1: { + _field412 = 2; + Common::Point pt(210, 142); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 2: { + _sceneMode = _field414; + _field412 = 3; + Common::Point pt(270, 142); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + default: + break; + } + break; + case 2752: + switch (_field412) { + case 1: + _sceneMode = _field414; + setAction(&_sequenceManager, this, 2752, &R2_GLOBALS._player, NULL); + break; + case 2: { + _field412 = 1; + Common::Point pt(20, 132); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 3: { + _field412 = 2; + Common::Point pt(140, 142); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + default: + break; + } + break; + case 2753: + switch (_field412) { + case 1: { + _field412 = 2; + Common::Point pt(210, 142); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 2: { + _field412 = 3; + Common::Point pt(300, 132); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 3: + _sceneMode = _field414; + setAction(&_sequenceManager, this, 2753, &R2_GLOBALS._player, NULL); + break; + default: + break; + } + break; + default: + break; + } + break; + case 11: + // No break on purpose + case 2753: + g_globals->_sceneManager.changeScene(2800); + break; + case 2752: + g_globals->_sceneManager.changeScene(2700); + break; + default: + R2_GLOBALS._player.enableControl(R2_NEGATOR_GUN); + break; + } +} + +void Scene2750::process(Event &event) { + if ((R2_GLOBALS._player._canWalk) && (event.eventType == EVENT_BUTTON_DOWN) && (R2_GLOBALS._events.getCursor() == R2_NEGATOR_GUN)) { + if (_rect1.contains(event.mousePos.x, event.mousePos.y)) { + if (!_rect1.contains(R2_GLOBALS._player._position.x, R2_GLOBALS._player._position.y)) { + event.handled = true; + _sceneMode = 10; + _field414 = 1; + } + } else if (_rect2.contains(event.mousePos.x, event.mousePos.y)) { + if (!_rect2.contains(R2_GLOBALS._player._position.x, R2_GLOBALS._player._position.y)) { + event.handled = true; + _sceneMode = 10; + _field414 = 2; + } + } else if (_rect3.contains(event.mousePos.x, event.mousePos.y)) { + if (!_rect3.contains(R2_GLOBALS._player._position.x, R2_GLOBALS._player._position.y)) { + event.handled = true; + _sceneMode = 10; + _field414 = 3; + } + } else { + event.handled = true; + R2_GLOBALS._player.updateAngle(Common::Point(event.mousePos.x, event.mousePos.y)); + } + + if (_sceneMode == 10) { + R2_GLOBALS._player.disableControl(); + switch (_field412) { + case 1: { + Common::Point pt(140, 142); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 2: + if (_field414 == 1) { + Common::Point pt(140, 142); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } else { + Common::Point pt(210, 142); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 3: { + Common::Point pt(210, 142); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + default: + break; + } + } + } + Scene::process(event); +} + } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_scenes2.h b/engines/tsage/ringworld2/ringworld2_scenes2.h index 83fb7b3cfb..9b2a8685fc 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes2.h +++ b/engines/tsage/ringworld2/ringworld2_scenes2.h @@ -517,8 +517,8 @@ class Scene2700 : public SceneExt { void process(Event &event); }; public: - VisualSpeaker _quinnSpeaker; - VisualSpeaker _nejSpeaker; + SpeakerQuinn2700 _quinnSpeaker; + SpeakerNej2700 _nejSpeaker; NamedHotspot _item1; NamedHotspot _item2; NamedHotspot _item3; @@ -547,6 +547,83 @@ public: virtual void process(Event &event); }; +class Scene2750 : public SceneExt { + class Action1: public Action { + public: + void signal(); + }; + class Action2: public Action { + public: + void signal(); + }; + class Action3: public Action { + public: + void signal(); + }; + class Action4: public Action { + public: + void signal(); + }; + class Action5: public Action { + public: + void signal(); + }; + class Action6: public Action { + public: + void signal(); + }; + class Action7: public Action { + public: + void signal(); + }; + + class Area1: public SceneArea { + public: + void process(Event &event); + }; + class Area2: public SceneArea { + public: + void process(Event &event); + }; +public: + SpeakerQuinn2750 _quinnSpeaker; + SpeakerNej2750 _nejSpeaker; + NamedHotspot _item1; + NamedHotspot _item2; + NamedHotspot _item3; + NamedHotspot _item4; + NamedHotspot _item5; + SceneActor _actor1; + SceneActor _actor2; + SceneActor _actor3; + SceneActor _actor4; + SceneActor _actor5; + SceneActor _actor6; + SceneActor _actor7; + SceneActor _actor8; + SceneActor _actor9; + SceneActor _actor10; + SceneActor _actor11; + Action1 _action1; + Action2 _action2; + Action3 _action3; + Action4 _action4; + Action5 _action5; + Action6 _action6; + Action7 _action7; + Area1 _area1; + Area2 _area2; + Rect _rect1, _rect2, _rect3; + SequenceManager _sequenceManager; + int _field412, _field414, _field416; + + Scene2750(); + virtual void synchronize(Serializer &s); + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); + virtual void process(Event &event); +}; + } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_speakers.cpp b/engines/tsage/ringworld2/ringworld2_speakers.cpp index b3120f8af6..7a3871f9ac 100644 --- a/engines/tsage/ringworld2/ringworld2_speakers.cpp +++ b/engines/tsage/ringworld2/ringworld2_speakers.cpp @@ -829,5 +829,91 @@ void SpeakerNej2700::proc15() { } } +SpeakerQuinn2750::SpeakerQuinn2750() { + _speakerName = "QUINN"; + _color1 = 60; + _color2 = 0; + _fieldF6 = 0; + _textWidth = 300; + _hideObjects = false; + _object2 = NULL; + _displayMode = 1; + _numFrames = 0; +} + +void SpeakerQuinn2750::proc15() { + int v = _fieldF6; + + if (!_object2) { + _object2 = &R2_GLOBALS._player; + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + if (v == 0) { + _object1.animate(ANIM_MODE_2, NULL); + } else { + ((SceneItem *)_action)->_sceneRegionId = 0; + switch (_object2->_visage) { + case 19: + _object1.setup(4022, 5, 1); + break; + case 2752: + _object1.setup(2752, 1, 1); + break; + default: + break; + } + _object1.animate(ANIM_MODE_5, this); + } +} + +SpeakerNej2750::SpeakerNej2750() { + _speakerName = "NEJ"; + _color1 = 171; + _color2 = 0; + _fieldF6 = 0; + _textWidth = 300; + _hideObjects = false; + _object2 = NULL; + _displayMode = 1; + _numFrames = 0; +} + +void SpeakerNej2750::proc15() { + int v = _fieldF6; + Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene; + + if (!_object2) { + _object2 = &scene->_actor1; + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + if (v == 0) { + _object1.animate(ANIM_MODE_2, NULL); + } else { + ((SceneItem *)_action)->_sceneRegionId = 0; + switch (_object2->_visage) { + case 2705: + _object1.setup(4022, 7, 1); + break; + case 2752: + _object1.setup(2752, 1, 1); + break; + default: + break; + } + _object1.animate(ANIM_MODE_5, this); + } +} } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_speakers.h b/engines/tsage/ringworld2/ringworld2_speakers.h index 7ffd24e6e7..115ad580ce 100644 --- a/engines/tsage/ringworld2/ringworld2_speakers.h +++ b/engines/tsage/ringworld2/ringworld2_speakers.h @@ -221,6 +221,22 @@ public: virtual Common::String getClassName() { return "SpeakerNej2700"; } virtual void proc15(); }; + +class SpeakerQuinn2750 : public VisualSpeaker { +public: + SpeakerQuinn2750(); + + virtual Common::String getClassName() { return "SpeakerQuinn2750"; } + virtual void proc15(); +}; + +class SpeakerNej2750 : public VisualSpeaker { +public: + SpeakerNej2750(); + + virtual Common::String getClassName() { return "SpeakerNej2750"; } + virtual void proc15(); +}; } // End of namespace Ringworld2 } // End of namespace TsAGE -- cgit v1.2.3 From 2ce198575fbf2d06140c5ff3d610b782220f5e28 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 15 Dec 2011 17:09:45 +0100 Subject: TSAGE: R2R - Cleanup --- engines/tsage/ringworld2/ringworld2_scenes2.cpp | 46 ++++++++++++------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'engines') diff --git a/engines/tsage/ringworld2/ringworld2_scenes2.cpp b/engines/tsage/ringworld2/ringworld2_scenes2.cpp index abcf16405b..107d7bad04 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes2.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes2.cpp @@ -3071,7 +3071,7 @@ void Scene2700::Action4::signal() { void Scene2700::Area1::process(Event &event) { SceneArea::process(event); - if ((event.eventType == 1) && (R2_GLOBALS._player._canWalk) && (_bounds.contains(event.mousePos.x, event.mousePos.y))) { + if ((event.eventType == 1) && (R2_GLOBALS._player._canWalk) && (_bounds.contains(event.mousePos))) { Scene2700 *scene = (Scene2700 *)R2_GLOBALS._sceneManager._scene; R2_GLOBALS._player.disableControl(); scene->_sceneMode = 10; @@ -3121,7 +3121,7 @@ void Scene2700::Area1::process(Event &event) { void Scene2700::Area2::process(Event &event) { SceneArea::process(event); - if ((event.eventType == 1) && (R2_GLOBALS._player._canWalk) && (_bounds.contains(event.mousePos.x, event.mousePos.y))) { + if ((event.eventType == 1) && (R2_GLOBALS._player._canWalk) && (_bounds.contains(event.mousePos))) { Scene2700 *scene = (Scene2700 *)R2_GLOBALS._sceneManager._scene; R2_GLOBALS._player.disableControl(); scene->_sceneMode = 10; @@ -3536,7 +3536,7 @@ void Scene2700::signal() { void Scene2700::process(Event &event) { if ((R2_GLOBALS._player._canWalk) && (event.eventType == EVENT_BUTTON_DOWN)) { if (R2_GLOBALS._events.getCursor() == R2_36) { - if (R2_GLOBALS._player._bounds.contains(event.mousePos.x, event.mousePos.y)) { + if (R2_GLOBALS._player._bounds.contains(event.mousePos)) { _sceneMode = 10; _field414 = 2710; R2_GLOBALS._player.disableControl(); @@ -3593,38 +3593,38 @@ void Scene2700::process(Event &event) { SceneItem::display(2700, 3, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); } } else if (R2_GLOBALS._events.getCursor() == R2_NEGATOR_GUN) { - if (_rect1.contains(event.mousePos.x, event.mousePos.y)) { - if (!_rect1.contains(R2_GLOBALS._player._position.x, R2_GLOBALS._player._position.y)) { + if (_rect1.contains(event.mousePos)) { + if (!_rect1.contains(R2_GLOBALS._player._position)) { event.handled = true; _sceneMode = 10; _field414 = 1; } - } else if (_rect2.contains(event.mousePos.x, event.mousePos.y)) { - if (!_rect2.contains(R2_GLOBALS._player._position.x, R2_GLOBALS._player._position.y)) { + } else if (_rect2.contains(event.mousePos)) { + if (!_rect2.contains(R2_GLOBALS._player._position)) { event.handled = true; _sceneMode = 10; _field414 = 2; } - } else if (_rect3.contains(event.mousePos.x, event.mousePos.y)) { - if (!_rect3.contains(R2_GLOBALS._player._position.x, R2_GLOBALS._player._position.y)) { + } else if (_rect3.contains(event.mousePos)) { + if (!_rect3.contains(R2_GLOBALS._player._position)) { event.handled = true; _sceneMode = 10; _field414 = 3; } - } else if (_rect4.contains(event.mousePos.x, event.mousePos.y)) { - if (!_rect4.contains(R2_GLOBALS._player._position.x, R2_GLOBALS._player._position.y)) { + } else if (_rect4.contains(event.mousePos)) { + if (!_rect4.contains(R2_GLOBALS._player._position)) { event.handled = true; _sceneMode = 10; _field414 = 4; } - } else if (_rect5.contains(event.mousePos.x, event.mousePos.y)) { - if (!_rect5.contains(R2_GLOBALS._player._position.x, R2_GLOBALS._player._position.y)) { + } else if (_rect5.contains(event.mousePos)) { + if (!_rect5.contains(R2_GLOBALS._player._position)) { event.handled = true; _sceneMode = 10; _field414 = 5; } - } else if (_rect6.contains(event.mousePos.x, event.mousePos.y)) { - if (!_rect6.contains(R2_GLOBALS._player._position.x, R2_GLOBALS._player._position.y)) { + } else if (_rect6.contains(event.mousePos)) { + if (!_rect6.contains(R2_GLOBALS._player._position)) { event.handled = true; _sceneMode = 10; _field414 = 6; @@ -3798,7 +3798,7 @@ void Scene2750::Action7::signal() { void Scene2750::Area1::process(Event &event) { SceneArea::process(event); - if ((event.eventType == EVENT_BUTTON_DOWN) && (R2_GLOBALS._player._canWalk) && (_bounds.contains(event.mousePos.x, event.mousePos.y))) { + if ((event.eventType == EVENT_BUTTON_DOWN) && (R2_GLOBALS._player._canWalk) && (_bounds.contains(event.mousePos))) { Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene; R2_GLOBALS._player.disableControl(); scene->_sceneMode = 10; @@ -3829,7 +3829,7 @@ void Scene2750::Area1::process(Event &event) { void Scene2750::Area2::process(Event &event) { SceneArea::process(event); - if ((event.eventType == EVENT_BUTTON_DOWN) && (R2_GLOBALS._player._canWalk) && (_bounds.contains(event.mousePos.x, event.mousePos.y))) { + if ((event.eventType == EVENT_BUTTON_DOWN) && (R2_GLOBALS._player._canWalk) && (_bounds.contains(event.mousePos))) { Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene; R2_GLOBALS._player.disableControl(); scene->_sceneMode = 10; @@ -4105,20 +4105,20 @@ void Scene2750::signal() { void Scene2750::process(Event &event) { if ((R2_GLOBALS._player._canWalk) && (event.eventType == EVENT_BUTTON_DOWN) && (R2_GLOBALS._events.getCursor() == R2_NEGATOR_GUN)) { - if (_rect1.contains(event.mousePos.x, event.mousePos.y)) { - if (!_rect1.contains(R2_GLOBALS._player._position.x, R2_GLOBALS._player._position.y)) { + if (_rect1.contains(event.mousePos)) { + if (!_rect1.contains(R2_GLOBALS._player._position)) { event.handled = true; _sceneMode = 10; _field414 = 1; } - } else if (_rect2.contains(event.mousePos.x, event.mousePos.y)) { - if (!_rect2.contains(R2_GLOBALS._player._position.x, R2_GLOBALS._player._position.y)) { + } else if (_rect2.contains(event.mousePos)) { + if (!_rect2.contains(R2_GLOBALS._player._position)) { event.handled = true; _sceneMode = 10; _field414 = 2; } - } else if (_rect3.contains(event.mousePos.x, event.mousePos.y)) { - if (!_rect3.contains(R2_GLOBALS._player._position.x, R2_GLOBALS._player._position.y)) { + } else if (_rect3.contains(event.mousePos)) { + if (!_rect3.contains(R2_GLOBALS._player._position)) { event.handled = true; _sceneMode = 10; _field414 = 3; -- cgit v1.2.3 From 2a96ee48d466e4404ebd8feb8a3bf608a19121ce Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 15 Dec 2011 23:21:22 +0200 Subject: DREAMWEB: Fix regression in helicopter() --- engines/dreamweb/people.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/people.cpp b/engines/dreamweb/people.cpp index e060df9fcc..8b68c52d3e 100644 --- a/engines/dreamweb/people.cpp +++ b/engines/dreamweb/people.cpp @@ -871,7 +871,7 @@ void DreamGenContext::helicopter(ReelRoutine &routine) { if (nextReelPointer == 53) { // Before killing helicopter data.byte(kCombatcount)++; - if (data.byte(kCombatcount) != 8) + if (data.byte(kCombatcount) >= 8) data.byte(kMandead) = 2; nextReelPointer = 49; } else if (nextReelPointer == 9) { @@ -898,10 +898,11 @@ void DreamGenContext::helicopter(ReelRoutine &routine) { showGameReel(&routine); routine.mapX = data.byte(kMapx); - if (routine.reelPointer() == 9 && data.byte(kCombatcount) != 7) { + if (routine.reelPointer() < 9 && data.byte(kCombatcount) >= 7) { data.byte(kPointermode) = 2; data.word(kWatchingtime) = 0; } else { + // Not waiting helicopter data.byte(kPointermode) = 0; data.word(kWatchingtime) = 2; } -- cgit v1.2.3 From 60f9b91ced244fd7bdb822cc4471a937d38d6179 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 15 Dec 2011 23:45:09 +0200 Subject: DREAMWEB: Port 'mugger' to C++, remove the unused 'findpuztext' function and fix tasm-recover --- engines/dreamweb/dreamgen.cpp | 86 ------------------------------------------- engines/dreamweb/dreamgen.h | 2 - engines/dreamweb/people.cpp | 44 +++++++++++++++++++++- engines/dreamweb/stubs.h | 1 + 4 files changed, 43 insertions(+), 90 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 92bb062aab..8892c84b2d 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -26,81 +26,6 @@ namespace DreamGen { -void DreamGenContext::mugger() { - STACK_CHECK; - ax = es.word(bx+3); - _cmp(ax, 138); - if (flags.z()) - goto endmugger1; - _cmp(ax, 176); - if (flags.z()) - return /* (endmugger2) */; - _cmp(ax, 2); - if (!flags.z()) - goto havesetwatch; - data.word(kWatchingtime) = 175*2; -havesetwatch: - checkSpeed(); - if (!flags.z()) - goto notmugger; - _inc(es.word(bx+3)); -notmugger: - showGameReel(); - al = data.byte(kMapx); - es.byte(bx+1) = al; - return; -endmugger1: - push(es); - push(bx); - createPanel2(); - showIcon(); - al = 41; - findPuzText(); - di = 33+20; - bx = 104; - dl = 241; - ah = 0; - printDirect(); - workToScreen(); - cx = 300; - hangOn(); - bx = pop(); - es = pop(); - push(es); - push(bx); - es.word(bx+3) = 140; - data.byte(kManspath) = 2; - data.byte(kFinaldest) = 2; - findXYFromPath(); - data.byte(kResetmanxy) = 1; - al = 'W'; - ah = 'E'; - cl = 'T'; - ch = 'A'; - findExObject(); - data.byte(kCommand) = al; - data.byte(kObjecttype) = 4; - removeObFromInv(); - al = 'W'; - ah = 'E'; - cl = 'T'; - ch = 'B'; - findExObject(); - data.byte(kCommand) = al; - data.byte(kObjecttype) = 4; - removeObFromInv(); - makeMainScreen(); - al = 48; - bl = 68-32; - bh = 54+64; - cx = 70; - dx = 10; - setupTimedUse(); - data.byte(kBeenmugged) = 1; - bx = pop(); - es = pop(); -} - void DreamGenContext::businessMan() { STACK_CHECK; data.byte(kPointermode) = 0; @@ -3358,17 +3283,6 @@ notfoundinside: goto insideloop; } -void DreamGenContext::findPuzText() { - STACK_CHECK; - ah = 0; - si = ax; - _add(si, si); - es = data.word(kPuzzletext); - ax = es.word(si); - _add(ax, (66*2)); - si = ax; -} - void DreamGenContext::useGun() { STACK_CHECK; _cmp(data.byte(kObjecttype), 4); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index fbefd91099..5a61fcb33e 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -540,7 +540,6 @@ public: void findPathOfPoint(); void getDestInfo(); void read(); - void mugger(); void searchForString(); void selectOpenOb(); void useGun(); @@ -549,7 +548,6 @@ public: void searchForFiles(); void getExAd(); void initialMonCols(); - void findPuzText(); void swapWithInv(); void adjustRight(); void transferToEx(); diff --git a/engines/dreamweb/people.cpp b/engines/dreamweb/people.cpp index 8b68c52d3e..e4e368211e 100644 --- a/engines/dreamweb/people.cpp +++ b/engines/dreamweb/people.cpp @@ -42,7 +42,7 @@ static void (DreamGenContext::*reelCallbacks[57])() = { NULL, &DreamGenContext::poolGuard, NULL, &DreamGenContext::businessMan, NULL, NULL, - &DreamGenContext::mugger, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, @@ -74,7 +74,7 @@ static void (DreamGenContext::*reelCallbacksCPP[57])(ReelRoutine &) = { &DreamGenContext::copper, /*&DreamGenContext::poolGuard*/NULL, &DreamGenContext::rockstar, /*&DreamGenContext::businessMan*/NULL, &DreamGenContext::train, &DreamGenContext::genericPerson /*aide*/, - /*&DreamGenContext::mugger*/NULL, &DreamGenContext::helicopter, + &DreamGenContext::mugger, &DreamGenContext::helicopter, &DreamGenContext::introMagic1, &DreamGenContext::introMusic, &DreamGenContext::introMagic2, &DreamGenContext::candles2, &DreamGenContext::gates, &DreamGenContext::introMagic3, @@ -908,4 +908,44 @@ void DreamGenContext::helicopter(ReelRoutine &routine) { } } +void DreamGenContext::mugger(ReelRoutine &routine) { + if (routine.reelPointer() != 138) { + if (routine.reelPointer() == 176) + return; // endmugger2 + + if (routine.reelPointer() == 2) + data.word(kWatchingtime) = 175 * 2; // set watch + + if (checkSpeed(routine)) + routine.incReelPointer(); + + showGameReel(&routine); + routine.mapX = data.byte(kMapx); + } else { + createPanel2(); + showIcon(); + + uint16 offset = kTextstart + getSegment(data.word(kPuzzletext)).word(41 * 2); + const uint8 *string = getSegment(data.word(kPuzzletext)).ptr(offset, 0); + uint16 y = 104; + printDirect(&string, 33 + 20, &y, 241, 241 & 1); + workToScreenCPP(); + hangOn(300); + routine.setReelPointer(140); + data.byte(kManspath) = 2; + data.byte(kFinaldest) = 2; + findXYFromPath(); + data.byte(kResetmanxy) = 1; + data.byte(kCommand) = findExObject("WETA"); + data.byte(kObjecttype) = 4; + removeObFromInv(); + data.byte(kCommand) = findExObject("WETB"); + data.byte(kObjecttype) = 4; + removeObFromInv(); + makeMainScreen(); + DreamBase::setupTimedUse(48, 70, 10, 68 - 32, 54 + 64); + data.byte(kBeenmugged) = 1; + } +} + } // End of namespace DreamGen diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 0f5a5ca115..33e43eba32 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -382,6 +382,7 @@ void bartender(ReelRoutine &routine); void heavy(ReelRoutine &routine); void helicopter(ReelRoutine &routine); + void mugger(ReelRoutine &routine); void singleKey(uint8 key, uint16 x, uint16 y); void loadSaveBox(); uint8 nextSymbol(uint8 symbol); -- cgit v1.2.3 From 6792fa2fb650d4ac225b4b4352b41fd17323c4c4 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 16 Dec 2011 00:02:57 +0200 Subject: DREAMWEB: Port 'businessman' to C++ --- engines/dreamweb/dreamgen.cpp | 97 ------------------------------------------- engines/dreamweb/dreamgen.h | 1 - engines/dreamweb/people.cpp | 68 +++++++++++++++++++++++++++++- engines/dreamweb/stubs.h | 1 + 4 files changed, 67 insertions(+), 100 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 8892c84b2d..e4a5411ed7 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -26,103 +26,6 @@ namespace DreamGen { -void DreamGenContext::businessMan() { - STACK_CHECK; - data.byte(kPointermode) = 0; - data.word(kWatchingtime) = 2; - ax = es.word(bx+3); - _cmp(ax, 2); - if (!flags.z()) - goto notfirstbiz; - push(ax); - push(bx); - push(es); - al = 49; - cx = 30; - dx = 1; - bl = 68; - bh = 174; - setupTimedUse(); - es = pop(); - bx = pop(); - ax = pop(); -notfirstbiz: - _cmp(ax, 95); - if (flags.z()) - goto buscombatwonend; - _cmp(ax, 49); - if (flags.z()) - return /* (buscombatend) */; - checkSpeed(); - if (!flags.z()) - goto busspeed; - ax = es.word(bx+3); - _inc(ax); - _cmp(ax, 48); - if (!flags.z()) - goto notbeforedeadb; - data.byte(kMandead) = 2; - goto gotbusframe; -notbeforedeadb: - _cmp(ax, 15); - if (!flags.z()) - goto buscombatwon; - _dec(ax); - _cmp(data.byte(kLastweapon), 3); - if (!flags.z()) - goto notshieldonbus; - data.byte(kLastweapon) = -1; - data.byte(kCombatcount) = 0; - ax = 51; - goto gotbusframe; -notshieldonbus: - _inc(data.byte(kCombatcount)); - _cmp(data.byte(kCombatcount), 20); - if (!flags.z()) - goto gotbusframe; - data.byte(kCombatcount) = 0; - ax = 15; - goto gotbusframe; -buscombatwon: - _cmp(ax, 91); - if (!flags.z()) - goto gotbusframe; - push(bx); - push(es); - al = 0; - turnPathOn(); - al = 1; - turnPathOn(); - al = 2; - turnPathOn(); - al = 3; - turnPathOff(); - data.byte(kManspath) = 5; - data.byte(kFinaldest) = 5; - findXYFromPath(); - data.byte(kResetmanxy) = 1; - es = pop(); - bx = pop(); - ax = 92; - goto gotbusframe; -gotbusframe: - es.word(bx+3) = ax; -busspeed: - showGameReel(); - al = data.byte(kMapy); - es.byte(bx+2) = al; - ax = es.word(bx+3); - _cmp(ax, 14); - if (!flags.z()) - return /* (buscombatend) */; - data.word(kWatchingtime) = 0; - data.byte(kPointermode) = 2; - return; -buscombatwonend: - data.byte(kPointermode) = 0; - data.word(kWatchingtime) = 0; -} - void DreamGenContext::poolGuard() { STACK_CHECK; ax = es.word(bx+3); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 5a61fcb33e..87b769f79e 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -509,7 +509,6 @@ public: void selectOb(); void fadeUpMon(); void reExFromInv(); - void businessMan(); void outOfInv(); void transferMap(); void purgeAnItem(); diff --git a/engines/dreamweb/people.cpp b/engines/dreamweb/people.cpp index e4e368211e..003921b163 100644 --- a/engines/dreamweb/people.cpp +++ b/engines/dreamweb/people.cpp @@ -40,7 +40,7 @@ static void (DreamGenContext::*reelCallbacks[57])() = { NULL, NULL, NULL, NULL, NULL, &DreamGenContext::poolGuard, - NULL, &DreamGenContext::businessMan, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, @@ -72,7 +72,7 @@ static void (DreamGenContext::*reelCallbacksCPP[57])(ReelRoutine &) = { &DreamGenContext::keeper, &DreamGenContext::candles1, &DreamGenContext::smallCandle, &DreamGenContext::security, &DreamGenContext::copper, /*&DreamGenContext::poolGuard*/NULL, - &DreamGenContext::rockstar, /*&DreamGenContext::businessMan*/NULL, + &DreamGenContext::rockstar, &DreamGenContext::businessMan, &DreamGenContext::train, &DreamGenContext::genericPerson /*aide*/, &DreamGenContext::mugger, &DreamGenContext::helicopter, &DreamGenContext::introMagic1, &DreamGenContext::introMusic, @@ -948,4 +948,68 @@ void DreamGenContext::mugger(ReelRoutine &routine) { } } +void DreamGenContext::businessMan(ReelRoutine &routine) { + data.byte(kPointermode) = 0; + data.word(kWatchingtime) = 2; + if (routine.reelPointer() == 2) { + // First + DreamBase::setupTimedUse(49, 30, 1, 68, 174); + return; + } + + if (routine.reelPointer() == 95) { + // Bus combat won - end + data.byte(kPointermode) = 0; + data.word(kWatchingtime) = 0; + return; + } + + if (routine.reelPointer() == 49) + return; // buscombatend + + if (checkSpeed(routine)) { + uint16 nextReelPointer = routine.reelPointer() + 1; + if (nextReelPointer == 48) { + data.byte(kMandead) = 2; // before dead body + } else if (nextReelPointer == 15) { + nextReelPointer--; + if (data.byte(kLastweapon) == 3) { + // Shield bonus + data.byte(kLastweapon) = (byte)-1; + data.byte(kCombatcount) = 0; + nextReelPointer = 51; + } else { + // No shield bonus + data.byte(kCombatcount)++; + if (data.byte(kCombatcount) == 20) { + data.byte(kCombatcount) = 0; + nextReelPointer = 15; + } + } + } else { + // Bus combat won + if (nextReelPointer == 91) { + turnPathOn(0); + turnPathOn(1); + turnPathOn(2); + turnPathOff(3); + data.byte(kManspath) = 5; + data.byte(kFinaldest) = 5; + findXYFromPath(); + data.byte(kResetmanxy) = 1; + nextReelPointer = 92; + } + } + + routine.setReelPointer(nextReelPointer); + } + + showGameReel(&routine); + routine.mapY = data.byte(kMapy); + if (routine.reelPointer() == 14) { + data.word(kWatchingtime) = 0; + data.byte(kPointermode) = 2; + } +} + } // End of namespace DreamGen diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 33e43eba32..5b012d580e 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -383,6 +383,7 @@ void heavy(ReelRoutine &routine); void helicopter(ReelRoutine &routine); void mugger(ReelRoutine &routine); + void businessMan(ReelRoutine &routine); void singleKey(uint8 key, uint16 x, uint16 y); void loadSaveBox(); uint8 nextSymbol(uint8 symbol); -- cgit v1.2.3 From 66618f4e0245bb1f90cd08a1261d57483e73aaae Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 16 Dec 2011 00:15:04 +0200 Subject: DREAMWEB: Port 'endgameseq' to C++ --- engines/dreamweb/dreamgen.cpp | 63 ------------------------------------------- engines/dreamweb/dreamgen.h | 1 - engines/dreamweb/people.cpp | 41 ++++++++++++++++++++++++++-- engines/dreamweb/stubs.h | 1 + 4 files changed, 40 insertions(+), 66 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index e4a5411ed7..804896de5f 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -123,69 +123,6 @@ combatover2: data.byte(kMandead) = 2; } -void DreamGenContext::endGameSeq() { - STACK_CHECK; - checkSpeed(); - if (!flags.z()) - goto notendseq; - ax = es.word(bx+3); - _inc(ax); - _cmp(ax, 51); - if (!flags.z()) - goto gotendseq; - _cmp(data.byte(kIntrocount), 140); - if (flags.z()) - goto gotendseq; - _inc(data.byte(kIntrocount)); - push(es); - push(bx); - textForEnd(); - bx = pop(); - es = pop(); - ax = 50; -gotendseq: - es.word(bx+3) = ax; - _cmp(ax, 134); - if (!flags.z()) - goto notfadedown; - push(es); - push(bx); - push(ax); - fadeScreenDownHalf(); - ax = pop(); - bx = pop(); - es = pop(); - goto notendseq; -notfadedown: - _cmp(ax, 324); - if (!flags.z()) - goto notfadeend; - push(es); - push(bx); - push(ax); - fadeScreenDowns(); - data.byte(kVolumeto) = 7; - data.byte(kVolumedirection) = 1; - ax = pop(); - bx = pop(); - es = pop(); -notfadeend: - _cmp(ax, 340); - if (!flags.z()) - goto notendseq; - data.byte(kGetback) = 1; -notendseq: - showGameReel(); - al = data.byte(kMapy); - es.byte(bx+2) = al; - ax = es.word(bx+3); - _cmp(ax, 145); - if (!flags.z()) - return /* (notendcreds) */; - es.word(bx+3) = 146; - rollEndCredits(); -} - void DreamGenContext::checkForExit() { STACK_CHECK; cl = data.byte(kRyanx); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 87b769f79e..c47be2f748 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -490,7 +490,6 @@ public: void fadeScreenDownHalf(); void outOfOpen(); void dirCom(); - void endGameSeq(); void findFirstPath(); void startTalk(); void getAnyAd(); diff --git a/engines/dreamweb/people.cpp b/engines/dreamweb/people.cpp index 003921b163..96c9ae89c9 100644 --- a/engines/dreamweb/people.cpp +++ b/engines/dreamweb/people.cpp @@ -48,7 +48,7 @@ static void (DreamGenContext::*reelCallbacks[57])() = { NULL, NULL, NULL, NULL, NULL, NULL, - NULL, &DreamGenContext::endGameSeq, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, @@ -80,7 +80,7 @@ static void (DreamGenContext::*reelCallbacksCPP[57])(ReelRoutine &) = { &DreamGenContext::gates, &DreamGenContext::introMagic3, &DreamGenContext::introMonks1, &DreamGenContext::candles, &DreamGenContext::introMonks2, &DreamGenContext::handClap, - &DreamGenContext::monkAndRyan, /*&DreamGenContext::endGameSeq*/NULL, + &DreamGenContext::monkAndRyan, &DreamGenContext::endGameSeq, &DreamGenContext::priest, &DreamGenContext::madman, &DreamGenContext::madmansTelly, &DreamGenContext::alleyBarkSound, &DreamGenContext::foghornSound, &DreamGenContext::carParkDrip, @@ -1012,4 +1012,41 @@ void DreamGenContext::businessMan(ReelRoutine &routine) { } } +void DreamGenContext::endGameSeq(ReelRoutine &routine) { + if (checkSpeed(routine)) { + uint16 nextReelPointer = routine.reelPointer() + 1; + if (nextReelPointer == 51 && data.byte(kIntrocount) != 140) { + data.byte(kIntrocount)++; + textForEnd(); + nextReelPointer = 50; + } + + routine.setReelPointer(nextReelPointer); + if (nextReelPointer == 134) { + push(es); + push(bx); + push(ax); + fadeScreenDownHalf(); + ax = pop(); + bx = pop(); + es = pop(); + } else if (nextReelPointer == 324) { + fadeScreenDowns(); + data.byte(kVolumeto) = 7; + data.byte(kVolumedirection) = 1; + } + + if (nextReelPointer == 340) + data.byte(kGetback) = 1; + } + + showGameReel(&routine); + routine.mapY = data.byte(kMapy); + + if (routine.reelPointer() == 145) { + routine.setReelPointer(146); + rollEndCredits(); + } +} + } // End of namespace DreamGen diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 5b012d580e..0ee4171470 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -384,6 +384,7 @@ void helicopter(ReelRoutine &routine); void mugger(ReelRoutine &routine); void businessMan(ReelRoutine &routine); + void endGameSeq(ReelRoutine &routine); void singleKey(uint8 key, uint16 x, uint16 y); void loadSaveBox(); uint8 nextSymbol(uint8 symbol); -- cgit v1.2.3 From 30b4037ffbc0dc5faa2ccb0e4d069a33b0dcd1fd Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 16 Dec 2011 00:41:27 +0200 Subject: DREAMWEB: Port 'poolguard' to C++ This is the last of the people-related functions, so the assembly-like wrappers of addToPeopleList() and showGameReel() have been removed. Also, madManText() has been simplified --- engines/dreamweb/dreamgen.cpp | 97 ------------------------------ engines/dreamweb/dreamgen.h | 1 - engines/dreamweb/people.cpp | 135 +++++++++++++++++++++++++----------------- engines/dreamweb/sprite.cpp | 4 -- engines/dreamweb/stubs.h | 3 +- 5 files changed, 83 insertions(+), 157 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 804896de5f..9106dc0425 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -26,103 +26,6 @@ namespace DreamGen { -void DreamGenContext::poolGuard() { - STACK_CHECK; - ax = es.word(bx+3); - _cmp(ax, 214); - if (flags.z()) - goto combatover2; - _cmp(ax, 258); - if (flags.z()) - goto combatover2; - _cmp(ax, 185); - if (flags.z()) - goto combatover1; - _cmp(ax, 0); - if (!flags.z()) - goto notfirstpool; - al = 0; - turnPathOn(); -notfirstpool: - checkSpeed(); - if (!flags.z()) - goto guardspeed; - ax = es.word(bx+3); - _inc(ax); - _cmp(ax, 122); - if (!flags.z()) - goto notendguard1; - _dec(ax); - _cmp(data.byte(kLastweapon), 2); - if (!flags.z()) - goto notaxeonpool; - data.byte(kLastweapon) = -1; - ax = 122; - goto gotguardframe; -notaxeonpool: - _inc(data.byte(kCombatcount)); - _cmp(data.byte(kCombatcount), 40); - if (!flags.z()) - goto gotguardframe; - data.byte(kCombatcount) = 0; - ax = 195; - goto gotguardframe; -notendguard1: - _cmp(ax, 147); - if (!flags.z()) - goto gotguardframe; - _dec(ax); - _cmp(data.byte(kLastweapon), 1); - if (!flags.z()) - goto notgunonpool; - data.byte(kLastweapon) = -1; - ax = 147; - goto gotguardframe; -notgunonpool: - _inc(data.byte(kCombatcount)); - _cmp(data.byte(kCombatcount), 40); - if (!flags.z()) - goto gotguardframe; - data.byte(kCombatcount) = 0; - ax = 220; -gotguardframe: - es.word(bx+3) = ax; -guardspeed: - showGameReel(); - ax = es.word(bx+3); - _cmp(ax, 121); - if (flags.z()) - goto iswaitingpool; - _cmp(ax, 146); - if (flags.z()) - goto iswaitingpool; - data.byte(kPointermode) = 0; - data.word(kWatchingtime) = 2; - return; -iswaitingpool: - data.byte(kPointermode) = 2; - data.word(kWatchingtime) = 0; - return; -combatover1: - data.word(kWatchingtime) = 0; - data.byte(kPointermode) = 0; - al = 0; - turnPathOn(); - al = 1; - turnPathOff(); - return; -combatover2: - showGameReel(); - data.word(kWatchingtime) = 2; - data.byte(kPointermode) = 0; - _inc(data.byte(kCombatcount)); - _cmp(data.byte(kCombatcount), 100); - if (flags.c()) - return /* (doneover2) */; - data.word(kWatchingtime) = 0; - data.byte(kMandead) = 2; -} - void DreamGenContext::checkForExit() { STACK_CHECK; cl = data.byte(kRyanx); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index c47be2f748..945e8ad10f 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -519,7 +519,6 @@ public: void deleteExFrame(); void searchForSame(); void rollEm(); - void poolGuard(); void lookAtPlace(); void findAllOpen(); void showSlots(); diff --git a/engines/dreamweb/people.cpp b/engines/dreamweb/people.cpp index 96c9ae89c9..d8ebca648d 100644 --- a/engines/dreamweb/people.cpp +++ b/engines/dreamweb/people.cpp @@ -24,38 +24,6 @@ namespace DreamGen { -static void (DreamGenContext::*reelCallbacks[57])() = { - NULL, NULL, - NULL, NULL, - NULL, NULL, - NULL, NULL, - NULL, NULL, - NULL, NULL, - NULL, NULL, - NULL, NULL, - NULL, NULL, - NULL, NULL, - NULL, NULL, - NULL, NULL, - NULL, NULL, - NULL, NULL, - NULL, &DreamGenContext::poolGuard, - NULL, NULL, - NULL, NULL, - NULL, NULL, - NULL, NULL, - NULL, NULL, - NULL, NULL, - NULL, NULL, - NULL, NULL, - NULL, NULL, - NULL, NULL, - NULL, NULL, - NULL, NULL, - NULL, NULL, - NULL -}; - static void (DreamGenContext::*reelCallbacksCPP[57])(ReelRoutine &) = { &DreamGenContext::gamer, &DreamGenContext::sparkyDrip, &DreamGenContext::eden, &DreamGenContext::edenInBath, @@ -93,10 +61,6 @@ void DreamGenContext::updatePeople() { memset(getSegment(data.word(kBuffers)).ptr(kPeoplelist, 12 * sizeof(People)), 0xff, 12 * sizeof(People)); ++data.word(kMaintimer); - // The original callbacks are called with es:bx pointing to their reelRoutine entry. - // The new callbacks take a mutable ReelRoutine parameter. - - es = data; ReelRoutine *r = (ReelRoutine *)data.ptr(kReelroutines, 0); for (int i = 0; r[i].reallocation != 255; ++i) { @@ -104,35 +68,30 @@ void DreamGenContext::updatePeople() { if (r[i].reallocation == data.byte(kReallocation) && r[i].mapX == data.byte(kMapx) && r[i].mapY == data.byte(kMapy)) { - if (reelCallbacks[i]) { - assert(!reelCallbacksCPP[i]); - (this->*(reelCallbacks[i]))(); - } else { - assert(reelCallbacksCPP[i]); - (this->*(reelCallbacksCPP[i]))(r[i]); - } + assert(reelCallbacksCPP[i]); + (this->*(reelCallbacksCPP[i]))(r[i]); } } } void DreamGenContext::madmanText() { + byte origCount; + if (isCD()) { if (data.byte(kSpeechcount) >= 63) return; if (data.byte(kCh1playing) != 255) return; - al = data.byte(kSpeechcount); + origCount = data.byte(kSpeechcount); ++data.byte(kSpeechcount); } else { if (data.byte(kCombatcount) >= 61) return; - al = data.byte(kCombatcount); - _and(al, 3); - if (!flags.z()) + if (data.byte(kCombatcount) & 3) return; - al = data.byte(kCombatcount) / 4; + origCount = data.byte(kCombatcount) / 4; } - setupTimedTemp(47 + al, 82, 72, 80, 90, 1); + setupTimedTemp(47 + origCount, 82, 72, 80, 90, 1); } void DreamGenContext::madman(ReelRoutine &routine) { @@ -191,10 +150,6 @@ void DreamGenContext::madMode() { data.byte(kPointermode) = 2; } -void DreamGenContext::addToPeopleList() { - addToPeopleList((ReelRoutine *)es.ptr(bx, sizeof(ReelRoutine))); -} - void DreamGenContext::addToPeopleList(ReelRoutine *routine) { uint16 routinePointer = (const uint8 *)routine - data.ptr(0, 0); @@ -1049,4 +1004,78 @@ void DreamGenContext::endGameSeq(ReelRoutine &routine) { } } +void DreamGenContext::poolGuard(ReelRoutine &routine) { + if (routine.reelPointer() == 214 || routine.reelPointer() == 258) { + // Combat over 2 + showGameReel(&routine); + data.word(kWatchingtime) = 2; + data.byte(kPointermode) = 0; + data.byte(kCombatcount)++; + if (data.byte(kCombatcount) < 100) + return; // doneover2 + data.word(kWatchingtime) = 0; + data.byte(kMandead) = 2; + return; + } else if (routine.reelPointer() == 185) { + // Combat over 1 + data.word(kWatchingtime) = 0; + data.byte(kPointermode) = 0; + turnPathOn(0); + turnPathOff(1); + return; + } + + if (routine.reelPointer() == 0) + turnPathOn(0); // first pool + + if (checkSpeed(routine)) { + uint16 nextReelPointer = routine.reelPointer() + 1; + + if (nextReelPointer != 122) { + // Not end guard 1 + if (nextReelPointer == 147) { + nextReelPointer--; + if (data.byte(kLastweapon) == 1) { + // Gun on pool + data.byte(kLastweapon) = (byte)-1; + nextReelPointer = 147; + } else { + // Gun not on pool + data.byte(kCombatcount)++; + if (data.byte(kCombatcount) == 40) { + data.byte(kCombatcount) = 0; + nextReelPointer = 220; + } + } + } + } + + nextReelPointer--; + + if (data.byte(kLastweapon) == 2) { + // Axe on pool + data.byte(kLastweapon) = (byte)-1; + nextReelPointer = 122; + } else { + data.byte(kCombatcount)++; + if (data.byte(kCombatcount) == 40) { + data.byte(kCombatcount) = 0; + nextReelPointer = 195; + } + } + + routine.setReelPointer(nextReelPointer); + } + + showGameReel(&routine); + + if (routine.reelPointer() != 121 && routine.reelPointer() != 146) { + data.byte(kPointermode) = 0; + data.word(kWatchingtime) = 2; + } else { + data.byte(kPointermode) = 2; + data.word(kWatchingtime) = 0; + } +} + } // End of namespace DreamGen diff --git a/engines/dreamweb/sprite.cpp b/engines/dreamweb/sprite.cpp index c69ac2a3f5..d82d0f19fc 100644 --- a/engines/dreamweb/sprite.cpp +++ b/engines/dreamweb/sprite.cpp @@ -486,10 +486,6 @@ void DreamBase::showReelFrame(Reel *reel) { showFrame(base, x, y, frame, 8); } -void DreamGenContext::showGameReel() { - showGameReel((ReelRoutine *)es.ptr(bx, sizeof(ReelRoutine))); -} - void DreamGenContext::showGameReel(ReelRoutine *routine) { uint16 reelPointer = routine->reelPointer(); if (reelPointer >= 512) diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 0ee4171470..b50b1bccd7 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -92,7 +92,6 @@ void wideDoor(Sprite *sprite, SetObject *objData); void lockedDoorway(Sprite *sprite, SetObject *objData); void liftSprite(Sprite *sprite, SetObject *objData); - void showGameReel(); void showGameReel(ReelRoutine *routine); void turnPathOn(uint8 param); void turnPathOff(uint8 param); @@ -176,7 +175,6 @@ void obName(); void obName(uint8 command, uint8 commandType); void checkCoords(const RectWithCallback *rectWithCallbacks); - void addToPeopleList(); void addToPeopleList(ReelRoutine *routine); void getExPos(); void compare(); @@ -385,6 +383,7 @@ void mugger(ReelRoutine &routine); void businessMan(ReelRoutine &routine); void endGameSeq(ReelRoutine &routine); + void poolGuard(ReelRoutine &routine); void singleKey(uint8 key, uint16 x, uint16 y); void loadSaveBox(); uint8 nextSymbol(uint8 symbol); -- cgit v1.2.3 From a6b2b9c7ff19075a159fd53f966d2c66e8ea33cd Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 16 Dec 2011 00:42:25 +0200 Subject: DREAMWEB: Enable the C++ callback of poolGuard() --- engines/dreamweb/people.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/dreamweb/people.cpp b/engines/dreamweb/people.cpp index d8ebca648d..a96af8babd 100644 --- a/engines/dreamweb/people.cpp +++ b/engines/dreamweb/people.cpp @@ -39,7 +39,7 @@ static void (DreamGenContext::*reelCallbacksCPP[57])(ReelRoutine &) = { &DreamGenContext::genericPerson /*tattooMan*/, &DreamGenContext::attendant, &DreamGenContext::keeper, &DreamGenContext::candles1, &DreamGenContext::smallCandle, &DreamGenContext::security, - &DreamGenContext::copper, /*&DreamGenContext::poolGuard*/NULL, + &DreamGenContext::copper, &DreamGenContext::poolGuard, &DreamGenContext::rockstar, &DreamGenContext::businessMan, &DreamGenContext::train, &DreamGenContext::genericPerson /*aide*/, &DreamGenContext::mugger, &DreamGenContext::helicopter, -- cgit v1.2.3 From 84be5b04465fa241b1982f943df3d17a1a1ced1a Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 16 Dec 2011 00:46:05 +0200 Subject: DREAMWEB: Rename 'reelCallbacksCPP' to reelCallbacks' --- engines/dreamweb/people.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/people.cpp b/engines/dreamweb/people.cpp index a96af8babd..fd408b772c 100644 --- a/engines/dreamweb/people.cpp +++ b/engines/dreamweb/people.cpp @@ -24,7 +24,7 @@ namespace DreamGen { -static void (DreamGenContext::*reelCallbacksCPP[57])(ReelRoutine &) = { +static void (DreamGenContext::*reelCallbacks[57])(ReelRoutine &) = { &DreamGenContext::gamer, &DreamGenContext::sparkyDrip, &DreamGenContext::eden, &DreamGenContext::edenInBath, &DreamGenContext::sparky, &DreamGenContext::smokeBloke, @@ -68,8 +68,8 @@ void DreamGenContext::updatePeople() { if (r[i].reallocation == data.byte(kReallocation) && r[i].mapX == data.byte(kMapx) && r[i].mapY == data.byte(kMapy)) { - assert(reelCallbacksCPP[i]); - (this->*(reelCallbacksCPP[i]))(r[i]); + assert(reelCallbacks[i]); + (this->*(reelCallbacks[i]))(r[i]); } } } -- cgit v1.2.3 From 86c3c8b4620f3841ba587790bdad9f262d1ed339 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Fri, 16 Dec 2011 10:36:07 +0100 Subject: DREAMWEB: Fix regressions in helicopter and poolGuard --- engines/dreamweb/people.cpp | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/people.cpp b/engines/dreamweb/people.cpp index fd408b772c..aeb0b5db22 100644 --- a/engines/dreamweb/people.cpp +++ b/engines/dreamweb/people.cpp @@ -842,11 +842,7 @@ void DreamGenContext::helicopter(ReelRoutine &routine) { nextReelPointer = 9; } } - } else { - // Not waiting helicopter - data.byte(kPointermode) = 0; - data.word(kWatchingtime) = 2; - } + } routine.setReelPointer(nextReelPointer); } @@ -929,12 +925,12 @@ void DreamGenContext::businessMan(ReelRoutine &routine) { } else if (nextReelPointer == 15) { nextReelPointer--; if (data.byte(kLastweapon) == 3) { - // Shield bonus + // Shield on bus data.byte(kLastweapon) = (byte)-1; data.byte(kCombatcount) = 0; nextReelPointer = 51; } else { - // No shield bonus + // No shield on bus data.byte(kCombatcount)++; if (data.byte(kCombatcount) == 20) { data.byte(kCombatcount) = 0; @@ -1048,19 +1044,19 @@ void DreamGenContext::poolGuard(ReelRoutine &routine) { } } } - } - - nextReelPointer--; - - if (data.byte(kLastweapon) == 2) { - // Axe on pool - data.byte(kLastweapon) = (byte)-1; - nextReelPointer = 122; } else { - data.byte(kCombatcount)++; - if (data.byte(kCombatcount) == 40) { - data.byte(kCombatcount) = 0; - nextReelPointer = 195; + nextReelPointer--; + + if (data.byte(kLastweapon) == 2) { + // Axe on pool + data.byte(kLastweapon) = (byte)-1; + nextReelPointer = 122; + } else { + data.byte(kCombatcount)++; + if (data.byte(kCombatcount) == 40) { + data.byte(kCombatcount) = 0; + nextReelPointer = 195; + } } } -- cgit v1.2.3 From f878f0453a88ee5b11cfc0c755c2bfcd2a9ad6f9 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 16 Dec 2011 16:24:41 +0100 Subject: DREAMWEB: Convert useGun to C++ --- engines/dreamweb/dreamgen.cpp | 177 ------------------------------------------ engines/dreamweb/dreamgen.h | 1 - engines/dreamweb/stubs.h | 1 + engines/dreamweb/use.cpp | 112 ++++++++++++++++++++++++++ 4 files changed, 113 insertions(+), 178 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 9106dc0425..906ce3adc3 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -3026,183 +3026,6 @@ notfoundinside: goto insideloop; } -void DreamGenContext::useGun() { - STACK_CHECK; - _cmp(data.byte(kObjecttype), 4); - if (flags.z()) - goto istakengun; - showSecondUse(); - putBackObStuff(); - return; -istakengun: - _cmp(data.byte(kReallocation), 22); - if (!flags.z()) - goto notinpoolroom; - cx = 300; - al = 34; - showPuzText(); - data.byte(kLastweapon) = 1; - data.byte(kCombatcount) = 39; - data.byte(kGetback) = 1; - _inc(data.byte(kProgresspoints)); - return; -notinpoolroom: - _cmp(data.byte(kReallocation), 25); - if (!flags.z()) - goto nothelicopter; - cx = 300; - al = 34; - showPuzText(); - data.byte(kLastweapon) = 1; - data.byte(kCombatcount) = 19; - data.byte(kGetback) = 1; - data.byte(kDreamnumber) = 2; - data.byte(kRoomafterdream) = 38; - data.byte(kSartaindead) = 1; - _inc(data.byte(kProgresspoints)); - return; -nothelicopter: - _cmp(data.byte(kReallocation), 27); - if (!flags.z()) - goto notinrockroom; - cx = 300; - al = 46; - showPuzText(); - data.byte(kPointermode) = 2; - data.byte(kRockstardead) = 1; - data.byte(kLastweapon) = 1; - data.byte(kNewsitem) = 1; - data.byte(kGetback) = 1; - data.byte(kRoomafterdream) = 32; - data.byte(kDreamnumber) = 0; - _inc(data.byte(kProgresspoints)); - return; -notinrockroom: - _cmp(data.byte(kReallocation), 8); - if (!flags.z()) - goto notbystudio; - _cmp(data.byte(kMapx), 22); - if (!flags.z()) - goto notbystudio; - _cmp(data.byte(kMapy), 40); - if (!flags.z()) - goto notbystudio; - al = 92; - isSetObOnMap(); - if (flags.z()) - goto notbystudio; - _cmp(data.byte(kManspath), 9); - if (flags.z()) - goto notbystudio; - data.byte(kDestination) = 9; - data.byte(kFinaldest) = 9; - autoSetWalk(); - data.byte(kLastweapon) = 1; - data.byte(kGetback) = 1; - _inc(data.byte(kProgresspoints)); - return; -notbystudio: - _cmp(data.byte(kReallocation), 6); - if (!flags.z()) - goto notsarters; - _cmp(data.byte(kMapx), 11); - if (!flags.z()) - goto notsarters; - _cmp(data.byte(kMapy), 20); - if (!flags.z()) - goto notsarters; - al = 5; - isSetObOnMap(); - if (!flags.z()) - goto notsarters; - data.byte(kDestination) = 1; - data.byte(kFinaldest) = 1; - autoSetWalk(); - al = 5; - removeSetObject(); - al = 6; - placeSetObject(); - al = 1; - ah = data.byte(kRoomnum); - _dec(ah); - turnAnyPathOn(); - data.byte(kLiftflag) = 1; - data.word(kWatchingtime) = 40*2; - data.word(kReeltowatch) = 4; - data.word(kEndwatchreel) = 43; - data.byte(kWatchspeed) = 1; - data.byte(kSpeedcount) = 1; - data.byte(kGetback) = 1; - _inc(data.byte(kProgresspoints)); - return; -notsarters: - _cmp(data.byte(kReallocation), 29); - if (!flags.z()) - goto notaide; - data.byte(kGetback) = 1; - al = 13; - resetLocation(); - al = 12; - setLocation(); - data.byte(kDestpos) = 12; - data.byte(kDestination) = 2; - data.byte(kFinaldest) = 2; - autoSetWalk(); - data.word(kWatchingtime) = 164*2; - data.word(kReeltowatch) = 3; - data.word(kEndwatchreel) = 164; - data.byte(kWatchspeed) = 1; - data.byte(kSpeedcount) = 1; - data.byte(kAidedead) = 1; - data.byte(kDreamnumber) = 3; - data.byte(kRoomafterdream) = 33; - _inc(data.byte(kProgresspoints)); - return; -notaide: - _cmp(data.byte(kReallocation), 23); - if (!flags.z()) - goto notwithboss; - _cmp(data.byte(kMapx), 0); - if (!flags.z()) - goto notwithboss; - _cmp(data.byte(kMapy), 50); - if (!flags.z()) - goto notwithboss; - _cmp(data.byte(kManspath), 5); - if (flags.z()) - goto pathokboss; - data.byte(kDestination) = 5; - data.byte(kFinaldest) = 5; - autoSetWalk(); -pathokboss: - data.byte(kLastweapon) = 1; - data.byte(kGetback) = 1; - return; -notwithboss: - _cmp(data.byte(kReallocation), 8); - if (!flags.z()) - goto nottvsoldier; - _cmp(data.byte(kMapx), 11); - if (!flags.z()) - goto nottvsoldier; - _cmp(data.byte(kMapy), 10); - if (!flags.z()) - goto nottvsoldier; - _cmp(data.byte(kManspath), 2); - if (flags.z()) - goto pathoktv; - data.byte(kDestination) = 2; - data.byte(kFinaldest) = 2; - autoSetWalk(); -pathoktv: - data.byte(kLastweapon) = 1; - data.byte(kGetback) = 1; - return; -nottvsoldier: - showFirstUse(); - putBackObStuff(); -} - void DreamGenContext::showDiaryKeys() { STACK_CHECK; _cmp(data.byte(kPresscount), 0); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 945e8ad10f..ddccd5eaad 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -539,7 +539,6 @@ public: void read(); void searchForString(); void selectOpenOb(); - void useGun(); void incRyanPage(); void clearChanges(); void searchForFiles(); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index b50b1bccd7..3330f6f019 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -519,5 +519,6 @@ void openOb(); void withWhat(); void notHeldError(); + void useGun(); #endif diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp index 08b96cf33a..b0666bab33 100644 --- a/engines/dreamweb/use.cpp +++ b/engines/dreamweb/use.cpp @@ -764,6 +764,118 @@ void DreamGenContext::useChurchGate() { turnPathOn(2); // Open church } +void DreamGenContext::useGun() { + + if (data.byte(kObjecttype) != 4) { + // gun is not taken + showSecondUse(); + putBackObStuff(); + + } else if (data.byte(kReallocation) == 22) { + // in pool room + showPuzText(34, 300); + data.byte(kLastweapon) = 1; + data.byte(kCombatcount) = 39; + data.byte(kGetback) = 1; + data.byte(kProgresspoints)++; + + } else if (data.byte(kReallocation) == 25) { + // helicopter + showPuzText(34, 300); + data.byte(kLastweapon) = 1; + data.byte(kCombatcount) = 19; + data.byte(kGetback) = 1; + data.byte(kDreamnumber) = 2; + data.byte(kRoomafterdream) = 38; + data.byte(kSartaindead) = 1; + data.byte(kProgresspoints)++; + + } else if (data.byte(kReallocation) == 27) { + // in rock room + showPuzText(46, 300); + data.byte(kPointermode) = 2; + data.byte(kRockstardead) = 1; + data.byte(kLastweapon) = 1; + data.byte(kNewsitem) = 1; + data.byte(kGetback) = 1; + data.byte(kRoomafterdream) = 32; + data.byte(kDreamnumber) = 0; + data.byte(kProgresspoints)++; + + } else if (data.byte(kReallocation) == 8 && data.byte(kMapx) == 22 && data.byte(kMapy) == 40 + && !isSetObOnMap(92) && data.byte(kManspath) != 9) { + // by studio + data.byte(kDestination) = 9; + data.byte(kFinaldest) = 9; + autoSetWalk(); + data.byte(kLastweapon) = 1; + data.byte(kGetback) = 1; + data.byte(kProgresspoints)++; + + } else if (data.byte(kReallocation) == 6 && data.byte(kMapx) == 11 && data.byte(kMapy) == 20 + && isSetObOnMap(5)) { + // sarters + data.byte(kDestination) = 1; + data.byte(kFinaldest) = 1; + autoSetWalk(); + removeSetObject(5); + placeSetObject(6); + turnAnyPathOn(1, data.byte(kRoomnum) - 1); + data.byte(kLiftflag) = 1; + data.word(kWatchingtime) = 40*2; + data.word(kReeltowatch) = 4; + data.word(kEndwatchreel) = 43; + data.byte(kWatchspeed) = 1; + data.byte(kSpeedcount) = 1; + data.byte(kGetback) = 1; + data.byte(kProgresspoints)++; + + } else if (data.byte(kReallocation) == 29) { + // aide + data.byte(kGetback) = 1; + al = 13; + resetLocation(); + setLocation(12); + data.byte(kDestpos) = 12; + data.byte(kDestination) = 2; + data.byte(kFinaldest) = 2; + autoSetWalk(); + data.word(kWatchingtime) = 164*2; + data.word(kReeltowatch) = 3; + data.word(kEndwatchreel) = 164; + data.byte(kWatchspeed) = 1; + data.byte(kSpeedcount) = 1; + data.byte(kAidedead) = 1; + data.byte(kDreamnumber) = 3; + data.byte(kRoomafterdream) = 33; + data.byte(kProgresspoints)++; + + } else if (data.byte(kReallocation) == 23 && data.byte(kMapx) == 0 && data.byte(kMapy) == 50) { + // with boss + if (data.byte(kManspath) != 5) { + data.byte(kDestination) = 5; + data.byte(kFinaldest) = 5; + autoSetWalk(); + } + data.byte(kLastweapon) = 1; + data.byte(kGetback) = 1; + + } else if (data.byte(kReallocation) == 8 && data.byte(kMapx) == 11 && data.byte(kMapy) == 10) { + // tv soldier + if (data.byte(kManspath) != 2) { + data.byte(kDestination) = 2; + data.byte(kFinaldest) = 2; + autoSetWalk(); + } + data.byte(kLastweapon) = 1; + data.byte(kGetback) = 1; + + } else { + showFirstUse(); + putBackObStuff(); + } +} + void DreamGenContext::useFullCart() { data.byte(kProgresspoints)++; turnAnyPathOn(2, data.byte(kRoomnum) + 6); -- cgit v1.2.3 From 027249ec30bafcf7229a25d1dbd565f0b18cbe54 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 16 Dec 2011 16:37:06 +0100 Subject: DREAMWEB: Remove some dead code --- engines/dreamweb/dreambase.h | 11 ++++++++++- engines/dreamweb/pathfind.cpp | 30 +++++------------------------- engines/dreamweb/stubs.cpp | 24 ++++-------------------- engines/dreamweb/stubs.h | 21 --------------------- 4 files changed, 19 insertions(+), 67 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 727a81ce8b..6ecf94d513 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -119,12 +119,17 @@ public: void obPicture(); // from pathfind.cpp - void checkDest(const RoomPaths *roomsPaths); + void turnPathOn(uint8 param); + void turnPathOff(uint8 param); + void turnAnyPathOn(uint8 param, uint8 room); + void turnAnyPathOff(uint8 param, uint8 room); RoomPaths *getRoomsPaths(); void faceRightWay(); void setWalk(); void autoSetWalk(); + void checkDest(const RoomPaths *roomsPaths); void findXYFromPath(); + bool checkIfPathIsOn(uint8 index); void bresenhams(); void workoutFrames(); @@ -273,6 +278,10 @@ public: void getRidOfTempCharset(); void getRidOfTempsP(); void getRidOfAll(); + void placeSetObject(uint8 index); + void removeSetObject(uint8 index); + bool isSetObOnMap(uint8 index); + void dumpZoom(); // from use.cpp void placeFreeObject(uint8 index); diff --git a/engines/dreamweb/pathfind.cpp b/engines/dreamweb/pathfind.cpp index 212d61e6e2..8d9d9a95bb 100644 --- a/engines/dreamweb/pathfind.cpp +++ b/engines/dreamweb/pathfind.cpp @@ -24,11 +24,7 @@ namespace DreamGen { -void DreamGenContext::turnPathOn() { - turnPathOn(al); -} - -void DreamGenContext::turnPathOn(uint8 param) { +void DreamBase::turnPathOn(uint8 param) { findOrMake(param, 0xff, data.byte(kRoomnum) + 100); PathNode *roomsPaths = getRoomsPaths()->nodes; if (param == 0xff) @@ -36,11 +32,7 @@ void DreamGenContext::turnPathOn(uint8 param) { roomsPaths[param].on = 0xff; } -void DreamGenContext::turnPathOff() { - turnPathOff(al); -} - -void DreamGenContext::turnPathOff(uint8 param) { +void DreamBase::turnPathOff(uint8 param) { findOrMake(param, 0x00, data.byte(kRoomnum) + 100); PathNode *roomsPaths = getRoomsPaths()->nodes; if (param == 0xff) @@ -48,26 +40,18 @@ void DreamGenContext::turnPathOff(uint8 param) { roomsPaths[param].on = 0x00; } -void DreamGenContext::turnAnyPathOn(uint8 param, uint8 room) { +void DreamBase::turnAnyPathOn(uint8 param, uint8 room) { findOrMake(param, 0xff, room + 100); PathNode *paths = (PathNode *)getSegment(data.word(kReels)).ptr(kPathdata + 144 * room, 0); paths[param].on = 0xff; } -void DreamGenContext::turnAnyPathOn() { - turnAnyPathOn(al, ah); -} - -void DreamGenContext::turnAnyPathOff(uint8 param, uint8 room) { +void DreamBase::turnAnyPathOff(uint8 param, uint8 room) { findOrMake(param, 0x00, room + 100); PathNode *paths = (PathNode *)getSegment(data.word(kReels)).ptr(kPathdata + 144 * room, 0); paths[param].on = 0x00; } -void DreamGenContext::turnAnyPathOff() { - turnAnyPathOff(al, ah); -} - RoomPaths *DreamBase::getRoomsPaths() { void *result = getSegment(data.word(kReels)).ptr(data.byte(kRoomnum) * 144, 144); return (RoomPaths *)result; @@ -150,11 +134,7 @@ void DreamBase::findXYFromPath() { data.byte(kRyany) = roomsPaths[data.byte(kManspath)].y - 12; } -void DreamGenContext::checkIfPathIsOn() { - flags._z = checkIfPathIsOn(al); -} - -bool DreamGenContext::checkIfPathIsOn(uint8 index) { +bool DreamBase::checkIfPathIsOn(uint8 index) { RoomPaths *roomsPaths = getRoomsPaths(); uint8 pathOn = roomsPaths->nodes[index].on; return pathOn == 0xff; diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index c353948abb..1c2b70c882 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -1462,20 +1462,12 @@ void DreamGenContext::getExPos() { di = kExdata + kNumexobjects * sizeof(DynObject); } -void DreamGenContext::placeSetObject() { - placeSetObject(al); -} - -void DreamGenContext::placeSetObject(uint8 index) { +void DreamBase::placeSetObject(uint8 index) { findOrMake(index, 0, 0); getSetAd(index)->mapad[0] = 0; } -void DreamGenContext::removeSetObject() { - removeSetObject(al); -} - -void DreamGenContext::removeSetObject(uint8 index) { +void DreamBase::removeSetObject(uint8 index) { findOrMake(index, 0xff, 0); getSetAd(index)->mapad[0] = 0xff; } @@ -2522,10 +2514,6 @@ void DreamBase::setLocation(uint8 index) { data.byte(kRoomscango + index) = 1; } -void DreamGenContext::setLocation() { - DreamBase::setLocation(al); -} - const uint8 *DreamBase::getTextInFile1(uint16 index) { SegmentRef text = getSegment(data.word(kTextfile1)); uint16 offset = text.word(index * 2) + kTextstart; @@ -3591,15 +3579,11 @@ void DreamGenContext::moreTalk() { doSomeTalk(); } -bool DreamGenContext::isSetObOnMap(uint8 index) { +bool DreamBase::isSetObOnMap(uint8 index) { return (getSetAd(index)->mapad[0] == 0); } -void DreamGenContext::isSetObOnMap() { - flags._z = isSetObOnMap(al); -} - -void DreamGenContext::dumpZoom() { +void DreamBase::dumpZoom() { if (data.byte(kZoomon) == 1) multiDump(kZoomx + 5, kZoomy + 4, 46, 40); } diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 3330f6f019..bed8cec87d 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -93,14 +93,6 @@ void lockedDoorway(Sprite *sprite, SetObject *objData); void liftSprite(Sprite *sprite, SetObject *objData); void showGameReel(ReelRoutine *routine); - void turnPathOn(uint8 param); - void turnPathOff(uint8 param); - void turnPathOn(); - void turnPathOff(); - void turnAnyPathOn(uint8 param, uint8 room); - void turnAnyPathOff(uint8 param, uint8 room); - void turnAnyPathOn(); - void turnAnyPathOff(); void makeBackOb(SetObject *objData); void dealWithSpecial(uint8 firstParam, uint8 secondParam); void zoom(); @@ -159,10 +151,6 @@ void doChange(uint8 index, uint8 value, uint8 type); void deleteTaken(); bool isCD(); - void placeSetObject(); - void placeSetObject(uint8 index); - void removeSetObject(); - void removeSetObject(uint8 index); void showAllFree(); void showAllEx(); bool finishedWalkingCPP(); @@ -184,8 +172,6 @@ bool pixelCheckSet(const ObjPos *pos, uint8 x, uint8 y); void checkIfSet(); bool checkIfSet(uint8 x, uint8 y); - void checkIfPathIsOn(); - bool checkIfPathIsOn(uint8 index); void isItWorn(); bool isItWorn(const DynObject *object) { return DreamBase::isItWorn(object); @@ -329,10 +315,6 @@ void checkFolderCoords(); void nextFolder(); void lastFolder(); - void setLocation(); - void setLocation(uint8 index) { - DreamBase::setLocation(index); - } void drawFloor(); void allocateBuffers(); bool checkSpeed(ReelRoutine &routine); @@ -456,9 +438,6 @@ void putBackObStuff(); void moreTalk(); void redes(); - void isSetObOnMap(); - bool isSetObOnMap(uint8 index); - void dumpZoom(); void selectLocation(); void showGroup(); void loadSpeech(); -- cgit v1.2.3 From 202f9d18f142544339ecd70c13e30243b5325682 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 16 Dec 2011 16:38:21 +0100 Subject: DREAMWEB: Move more things to DreamBase; cleanup some code --- engines/dreamweb/dreambase.h | 43 ++++++++++++++++++++++++++- engines/dreamweb/keypad.cpp | 2 +- engines/dreamweb/sprite.cpp | 70 +++++++++++++++++--------------------------- engines/dreamweb/stubs.cpp | 35 ++++++++++------------ engines/dreamweb/stubs.h | 44 ---------------------------- engines/dreamweb/use.cpp | 10 +++---- 6 files changed, 91 insertions(+), 113 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 6ecf94d513..4856ae0487 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -165,13 +165,41 @@ public: // from sprite.cpp Sprite *spriteTable(); + void printSprites(); + void printASprite(const Sprite *sprite); + void clearSprites(); + Sprite *makeSprite(uint8 x, uint8 y, uint16 updateCallback, uint16 frameData, uint16 somethingInDi); + void initMan(); + void walking(Sprite *sprite); + void aboutTurn(Sprite *sprite); + void backObject(Sprite *sprite); + void constant(Sprite *sprite, SetObject *objData); + void randomSprite(Sprite *sprite, SetObject *objData); + void doorway(Sprite *sprite, SetObject *objData); + void wideDoor(Sprite *sprite, SetObject *objData); + void doDoor(Sprite *sprite, SetObject *objData, Common::Rect check); + void steady(Sprite *sprite, SetObject *objData); + void lockedDoorway(Sprite *sprite, SetObject *objData); + void liftSprite(Sprite *sprite, SetObject *objData); + Reel *getReelStart(uint16 reelPointer); const Frame *findSource(uint16 &frame); void showReelFrame(Reel *reel); + void showGameReel(ReelRoutine *routine); const Frame *getReelFrameAX(uint16 frame); + void moveMap(uint8 param); + void checkOne(uint8 x, uint8 y, uint8 *flag, uint8 *flagEx, uint8 *type, uint8 *flagX, uint8 *flagY); + + uint8 getBlockOfPixel(uint8 x, uint8 y); + Rain *splitIntoLines(uint8 x, uint8 y, Rain *rain); + void initRain(); + void rollEndCredits(); + void monks2text(); + void textForEnd(); + void textForMonkHelper(uint8 textIndex, uint8 voiceIndex, uint8 x, uint8 y, uint16 countToTimed, uint16 timeCount); + void textForMonk(); void priestText(ReelRoutine &routine); - void checkOne(uint8 x, uint8 y, uint8 *flag, uint8 *flagEx, uint8 *type, uint8 *flagX, uint8 *flagY); void soundOnReels(uint16 reelPointer); void clearBeforeLoad(); void clearReels(); @@ -179,6 +207,7 @@ public: void liftNoise(uint8 index); // from stubs.cpp + bool isCD(); void crosshair(); void delTextLine(); void showBlink(); @@ -187,6 +216,8 @@ public: void showPointer(); void delPointer(); void showRyanPage(); + void switchRyanOn(); + void switchRyanOff(); Frame *tempGraphics(); Frame *tempGraphics2(); Frame *tempGraphics3(); @@ -215,6 +246,7 @@ public: void *getAnyAd(uint8 *value1, uint8 *value2); const uint8 *getTextInFile1(uint16 index); uint8 findNextColon(const uint8 **string); + void allocateBuffers(); uint16 allocateMem(uint16 paragraphs); void deallocateMem(uint16 segment); uint16 allocateAndLoad(unsigned int size); @@ -282,6 +314,15 @@ public: void removeSetObject(uint8 index); bool isSetObOnMap(uint8 index); void dumpZoom(); + void diaryKeyP(); + void diaryKeyN(); + void findRoomInLoc(); + void loadMenu(); + void showMenu(); + void dumpMenu(); + void dealWithSpecial(uint8 firstParam, uint8 secondParam); + void plotReel(uint16 &reelPointer); + void setupTimedTemp(uint8 textIndex, uint8 voiceIndex, uint8 x, uint8 y, uint16 countToTimed, uint16 timeCount); // from use.cpp void placeFreeObject(uint8 index); diff --git a/engines/dreamweb/keypad.cpp b/engines/dreamweb/keypad.cpp index 032f01873e..43f6749cad 100644 --- a/engines/dreamweb/keypad.cpp +++ b/engines/dreamweb/keypad.cpp @@ -106,7 +106,7 @@ void DreamGenContext::enterCode(uint8 digit0, uint8 digit1, uint8 digit2, uint8 { kKeypadx+9,kKeypadx+30,kKeypady+59,kKeypady+73,&DreamBase::buttonNought }, { kKeypadx+31,kKeypadx+74,kKeypady+59,kKeypady+73,&DreamBase::buttonEnter }, { kKeypadx+72,kKeypadx+86,kKeypady+80,kKeypady+94,&DreamBase::quitKey }, - { 0,320,0,200,&DreamGenContext::blank }, + { 0,320,0,200,&DreamBase::blank }, { 0xFFFF,0,0,0,0 } }; diff --git a/engines/dreamweb/sprite.cpp b/engines/dreamweb/sprite.cpp index d82d0f19fc..99b12d1bc8 100644 --- a/engines/dreamweb/sprite.cpp +++ b/engines/dreamweb/sprite.cpp @@ -29,7 +29,7 @@ Sprite *DreamBase::spriteTable() { return sprite; } -void DreamGenContext::printSprites() { +void DreamBase::printSprites() { for (size_t priority = 0; priority < 7; ++priority) { Sprite *sprites = spriteTable(); for (size_t j = 0; j < 16; ++j) { @@ -45,7 +45,7 @@ void DreamGenContext::printSprites() { } } -void DreamGenContext::printASprite(const Sprite *sprite) { +void DreamBase::printASprite(const Sprite *sprite) { uint16 x, y; if (sprite->y >= 220) { y = data.word(kMapady) - (256 - sprite->y); @@ -67,11 +67,11 @@ void DreamGenContext::printASprite(const Sprite *sprite) { showFrame((const Frame *)getSegment(sprite->frameData()).ptr(0, 0), x, y, sprite->frameNumber, c); } -void DreamGenContext::clearSprites() { +void DreamBase::clearSprites() { memset(spriteTable(), 0xff, sizeof(Sprite) * 16); } -Sprite *DreamGenContext::makeSprite(uint8 x, uint8 y, uint16 updateCallback, uint16 frameData, uint16 somethingInDi) { +Sprite *DreamBase::makeSprite(uint8 x, uint8 y, uint16 updateCallback, uint16 frameData, uint16 somethingInDi) { Sprite *sprite = spriteTable(); while (sprite->frameNumber != 0xff) { // NB: No boundchecking in the original code either ++sprite; @@ -111,17 +111,13 @@ void DreamGenContext::spriteUpdate() { } } -void DreamGenContext::initMan() { +void DreamBase::initMan() { Sprite *sprite = makeSprite(data.byte(kRyanx), data.byte(kRyany), addr_mainman, data.word(kMainsprites), 0); sprite->priority = 4; sprite->speed = 0; sprite->walkFrame = 0; } -void DreamGenContext::mainMan() { - assert(false); -} - void DreamGenContext::mainMan(Sprite *sprite) { push(es); push(ds); @@ -186,7 +182,7 @@ void DreamGenContext::mainMan(Sprite *sprite) { es = pop(); } -void DreamGenContext::walking(Sprite *sprite) { +void DreamBase::walking(Sprite *sprite) { uint8 comp; if (data.byte(kLinedirection) != 0) { --data.byte(kLinepointer); @@ -208,14 +204,10 @@ void DreamGenContext::walking(Sprite *sprite) { return; } data.byte(kDestination) = data.byte(kFinaldest); - push(es); - push(bx); autoSetWalk(); - bx = pop(); - es = pop(); } -void DreamGenContext::aboutTurn(Sprite *sprite) { +void DreamBase::aboutTurn(Sprite *sprite) { bool incdir = true; if (data.byte(kTurndirection) == 1) @@ -249,11 +241,7 @@ void DreamGenContext::aboutTurn(Sprite *sprite) { } } -void DreamGenContext::backObject() { - assert(false); -} - -void DreamGenContext::backObject(Sprite *sprite) { +void DreamBase::backObject(Sprite *sprite) { SetObject *objData = (SetObject *)getSegment(data.word(kSetdat)).ptr(sprite->objData(), 0); if (sprite->delay != 0) { @@ -278,7 +266,7 @@ void DreamGenContext::backObject(Sprite *sprite) { steady(sprite, objData); } -void DreamGenContext::constant(Sprite *sprite, SetObject *objData) { +void DreamBase::constant(Sprite *sprite, SetObject *objData) { ++sprite->animFrame; if (objData->frames[sprite->animFrame] == 255) { sprite->animFrame = 0; @@ -288,22 +276,22 @@ void DreamGenContext::constant(Sprite *sprite, SetObject *objData) { sprite->frameNumber = frame; } -void DreamGenContext::randomSprite(Sprite *sprite, SetObject *objData) { +void DreamBase::randomSprite(Sprite *sprite, SetObject *objData) { uint8 r = engine->randomNumber(); sprite->frameNumber = objData->frames[r&7]; } -void DreamGenContext::doorway(Sprite *sprite, SetObject *objData) { +void DreamBase::doorway(Sprite *sprite, SetObject *objData) { Common::Rect check(-24, -30, 10, 10); doDoor(sprite, objData, check); } -void DreamGenContext::wideDoor(Sprite *sprite, SetObject *objData) { +void DreamBase::wideDoor(Sprite *sprite, SetObject *objData) { Common::Rect check(-24, -30, 24, 24); doDoor(sprite, objData, check); } -void DreamGenContext::doDoor(Sprite *sprite, SetObject *objData, Common::Rect check) { +void DreamBase::doDoor(Sprite *sprite, SetObject *objData, Common::Rect check) { int ryanx = data.byte(kRyanx); int ryany = data.byte(kRyany); @@ -352,13 +340,13 @@ void DreamGenContext::doDoor(Sprite *sprite, SetObject *objData, Common::Rect ch } } -void DreamGenContext::steady(Sprite *sprite, SetObject *objData) { +void DreamBase::steady(Sprite *sprite, SetObject *objData) { uint8 frame = objData->frames[0]; objData->index = frame; sprite->frameNumber = frame; } -void DreamGenContext::lockedDoorway(Sprite *sprite, SetObject *objData) { +void DreamBase::lockedDoorway(Sprite *sprite, SetObject *objData) { int ryanx = data.byte(kRyanx); int ryany = data.byte(kRyany); @@ -409,13 +397,13 @@ void DreamGenContext::lockedDoorway(Sprite *sprite, SetObject *objData) { } } -void DreamGenContext::liftSprite(Sprite *sprite, SetObject *objData) { +void DreamBase::liftSprite(Sprite *sprite, SetObject *objData) { uint8 liftFlag = data.byte(kLiftflag); if (liftFlag == 0) { //liftclosed turnPathOff(data.byte(kLiftpath)); if (data.byte(kCounttoopen) != 0) { - _dec(data.byte(kCounttoopen)); + data.byte(kCounttoopen)--; if (data.byte(kCounttoopen) == 0) data.byte(kLiftflag) = 3; } @@ -426,7 +414,7 @@ void DreamGenContext::liftSprite(Sprite *sprite, SetObject *objData) { turnPathOn(data.byte(kLiftpath)); if (data.byte(kCounttoclose) != 0) { - _dec(data.byte(kCounttoclose)); + data.byte(kCounttoclose)--; if (data.byte(kCounttoclose) == 0) data.byte(kLiftflag) = 2; } @@ -486,7 +474,7 @@ void DreamBase::showReelFrame(Reel *reel) { showFrame(base, x, y, frame, 8); } -void DreamGenContext::showGameReel(ReelRoutine *routine) { +void DreamBase::showGameReel(ReelRoutine *routine) { uint16 reelPointer = routine->reelPointer(); if (reelPointer >= 512) return; @@ -545,7 +533,7 @@ void DreamGenContext::showRain() { playChannel1(soundIndex); } -void DreamGenContext::moveMap(uint8 param) { +void DreamBase::moveMap(uint8 param) { switch (param) { case 32: data.byte(kMapy) -= 20; @@ -586,11 +574,7 @@ void DreamBase::checkOne(uint8 x, uint8 y, uint8 *flag, uint8 *flagEx, uint8 *ty *type = tileData[2]; } -void DreamGenContext::getBlockOfPixel() { - al = getBlockOfPixel(cl, ch); -} - -uint8 DreamGenContext::getBlockOfPixel(uint8 x, uint8 y) { +uint8 DreamBase::getBlockOfPixel(uint8 x, uint8 y) { uint8 flag, flagEx, type, flagX, flagY; checkOne(x + data.word(kMapxstart), y + data.word(kMapystart), &flag, &flagEx, &type, &flagX, &flagY); if (flag & 1) @@ -599,7 +583,7 @@ uint8 DreamGenContext::getBlockOfPixel(uint8 x, uint8 y) { return type; } -Rain *DreamGenContext::splitIntoLines(uint8 x, uint8 y, Rain *rain) { +Rain *DreamBase::splitIntoLines(uint8 x, uint8 y, Rain *rain) { do { // Look for line start while (!getBlockOfPixel(x, y)) { @@ -670,7 +654,7 @@ static const RainLocation rainLocationList[] = { { 255,0,0,0 } }; -void DreamGenContext::initRain() { +void DreamBase::initRain() { const RainLocation *r = rainLocationList; Rain *rainList = (Rain *)getSegment(data.word(kBuffers)).ptr(kRainlist, 0); Rain *rain = rainList; @@ -799,7 +783,7 @@ void DreamBase::rollEndCredits() { } -void DreamGenContext::monks2text() { +void DreamBase::monks2text() { bool isGermanCD = isCD() && engine->getLanguage() == Common::DE_DEU; if (data.byte(kIntrocount) == 1) @@ -836,7 +820,7 @@ void DreamGenContext::monks2text() { setupTimedTemp(18, 82, 36, 160, 120, 1); } -void DreamGenContext::textForEnd() { +void DreamBase::textForEnd() { if (data.byte(kIntrocount) == 20) setupTimedTemp(0, 83, 34, 20, 60, 1); else if (data.byte(kIntrocount) == (isCD() ? 50 : 65)) @@ -845,14 +829,14 @@ void DreamGenContext::textForEnd() { setupTimedTemp(2, 83, 34, 20, 60, 1); } -void DreamGenContext::textForMonkHelper(uint8 textIndex, uint8 voiceIndex, uint8 x, uint8 y, uint16 countToTimed, uint16 timeCount) { +void DreamBase::textForMonkHelper(uint8 textIndex, uint8 voiceIndex, uint8 x, uint8 y, uint16 countToTimed, uint16 timeCount) { if (isCD() && data.byte(kCh1playing) != 255) data.byte(kIntrocount)--; else setupTimedTemp(textIndex, voiceIndex, x, y, countToTimed, timeCount); } -void DreamGenContext::textForMonk() { +void DreamBase::textForMonk() { if (data.byte(kIntrocount) == 1) textForMonkHelper(19, 82, 68, 154, 120, 1); else if (data.byte(kIntrocount) == 5) diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 1c2b70c882..352dec334d 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -732,11 +732,11 @@ void DreamGenContext::startup1() { fadeScreenUp(); } -void DreamGenContext::switchRyanOn() { +void DreamBase::switchRyanOn() { data.byte(kRyanon) = 255; } -void DreamGenContext::switchRyanOff() { +void DreamBase::switchRyanOff() { data.byte(kRyanon) = 1; } @@ -916,7 +916,7 @@ void DreamGenContext::useTimedText() { data.byte(kNeedtodumptimed) = 1; } -void DreamGenContext::setupTimedTemp(uint8 textIndex, uint8 voiceIndex, uint8 x, uint8 y, uint16 countToTimed, uint16 timeCount) { +void DreamBase::setupTimedTemp(uint8 textIndex, uint8 voiceIndex, uint8 x, uint8 y, uint16 countToTimed, uint16 timeCount) { #if 1 // if cd if (voiceIndex != 0) { if (loadSpeech('T', voiceIndex, 'T', textIndex)) { @@ -1110,7 +1110,6 @@ void DreamGenContext::startLoading(const Room &room) { data.byte(kLiftpath) = room.liftPath; data.byte(kDoorpath) = room.doorPath; data.byte(kLastweapon) = (uint8)-1; - ah = data.byte(kReallocation); data.byte(kReallocation) = room.realLocation; loadRoomData(room, false); @@ -1131,14 +1130,12 @@ void DreamGenContext::startLoading(const Room &room) { data.byte(kLinepointer) = 254; if (room.b27 != 255) { data.byte(kManspath) = room.b27; - push(bx); autoSetWalk(); - bx = pop(); } findXYFromPath(); } -void DreamGenContext::dealWithSpecial(uint8 firstParam, uint8 secondParam) { +void DreamBase::dealWithSpecial(uint8 firstParam, uint8 secondParam) { uint8 type = firstParam - 220; if (type == 0) { placeSetObject(secondParam); @@ -1165,7 +1162,7 @@ void DreamGenContext::dealWithSpecial(uint8 firstParam, uint8 secondParam) { } } -void DreamGenContext::plotReel(uint16 &reelPointer) { +void DreamBase::plotReel(uint16 &reelPointer) { Reel *reel = getReelStart(reelPointer); while (reel->x >= 220 && reel->x != 255) { dealWithSpecial(reel->x, reel->y); @@ -1810,7 +1807,7 @@ bool DreamBase::isItDescribed(const ObjPos *pos) { return result != 0; } -bool DreamGenContext::isCD() { +bool DreamBase::isCD() { // The original sources has two codepaths depending if the game is 'if cd' or not // This is a hack to guess which version to use with the assumption that if we have a cd version // we managed to load the speech. At least it is isolated in this function and can be changed. @@ -2208,7 +2205,7 @@ Frame * DreamBase::tempGraphics3() { return (Frame *)getSegment(data.word(kTempgraphics3)).ptr(0, 0); } -void DreamGenContext::findRoomInLoc() { +void DreamBase::findRoomInLoc() { uint8 x = data.byte(kMapx) / 11; uint8 y = data.byte(kMapy) / 10; uint8 roomNum = y * 6 + x; @@ -2619,7 +2616,7 @@ void DreamGenContext::drawFloor() { data.byte(kNewobs) = 0; } -void DreamGenContext::allocateBuffers() { +void DreamBase::allocateBuffers() { data.word(kExtras) = allocateMem(kLengthofextra/16); data.word(kMapdata) = allocateMem(kLengthofmap/16); data.word(kBuffers) = allocateMem(kLengthofbuffer/16); @@ -2639,19 +2636,19 @@ void DreamBase::workToScreenM() { delPointer(); } -void DreamGenContext::loadMenu() { +void DreamBase::loadMenu() { loadIntoTemp("DREAMWEB.S02"); // sprite name 3 loadIntoTemp2("DREAMWEB.G07"); // mon. graphics 2 } -void DreamGenContext::showMenu() { +void DreamBase::showMenu() { ++data.byte(kMenucount); if (data.byte(kMenucount) == 37*2) data.byte(kMenucount) = 0; showFrame(tempGraphics(), kMenux, kMenuy, data.byte(kMenucount) / 2, 0); } -void DreamGenContext::dumpMenu() { +void DreamBase::dumpMenu() { multiDump(kMenux, kMenuy, 48, 48); } @@ -3631,7 +3628,7 @@ void DreamGenContext::selectLocation() { { 104,124,4,44,&DreamGenContext::lastDest }, { 280,308,4,44,&DreamGenContext::lookAtPlace }, { 104,216,138,192,&DreamGenContext::destSelect }, - { 273,320,157,198,&DreamGenContext::getBack1 }, + { 273,320,157,198,&DreamBase::getBack1 }, { 0,320,0,200,&DreamBase::blank }, { 0xFFFF,0,0,0,0 } }; @@ -3905,7 +3902,7 @@ void DreamGenContext::talk() { workToScreenCPP(); RectWithCallback talkList[] = { - { 273,320,157,198,&DreamGenContext::getBack1 }, + { 273,320,157,198,&DreamBase::getBack1 }, { 240,290,2,44,&DreamGenContext::moreTalk }, { 0,320,0,200,&DreamBase::blank }, { 0xFFFF,0,0,0,0 } @@ -3984,7 +3981,7 @@ void DreamGenContext::hangOnPQ() { data.byte(kGetback) = 0; RectWithCallback quitList[] = { - { 273,320,157,198,&DreamGenContext::getBack1 }, + { 273,320,157,198,&DreamBase::getBack1 }, { 0,320,0,200,&DreamBase::blank }, { 0xFFFF,0,0,0,0 } }; @@ -4068,7 +4065,7 @@ void DreamGenContext::showGun() { getRidOfTempText(); } -void DreamGenContext::diaryKeyP() { +void DreamBase::diaryKeyP() { if (data.byte(kCommandtype) != 214) { data.byte(kCommandtype) = 214; commandOnly(23); @@ -4088,7 +4085,7 @@ void DreamGenContext::diaryKeyP() { data.byte(kDiarypage) = 11; } -void DreamGenContext::diaryKeyN() { +void DreamBase::diaryKeyN() { if (data.byte(kCommandtype) != 213) { data.byte(kCommandtype) = 213; commandOnly(23); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index bed8cec87d..765b689251 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -25,8 +25,6 @@ void screenUpdate(); void startup(); void startup1(); - void switchRyanOn(); - void switchRyanOff(); void saveLoad(); void hangOnCurs(uint16 frameCount); void hangOnCurs(); @@ -43,7 +41,6 @@ void multiDump(uint16 x, uint16 y, uint8 width, uint8 height) { DreamBase::multiDump(x, y, width, height); } - void printSprites(); void quickQuit(); void readOneBlock(); void readCityPic(); @@ -60,7 +57,6 @@ } void useTimedText(); void dumpTimedText(); - void setupTimedTemp(uint8 textIndex, uint8 voiceIndex, uint8 x, uint8 y, uint16 countToTimed, uint16 timeCount); void getUnderTimed(); void putUnderTimed(); void dumpTextLine(); @@ -72,29 +68,10 @@ void showFrame(const Frame *frameData, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag) { DreamBase::showFrame(frameData, x, y, frameNumber, effectsFlag); } - void printASprite(const Sprite *sprite); void width160(); - void clearSprites(); - Sprite *makeSprite(uint8 x, uint8 y, uint16 updateCallback, uint16 frameData, uint16 somethingInDi); void spriteUpdate(); - void initMan(); void mainMan(Sprite *sprite); - void mainMan(); - void walking(Sprite *sprite); - void aboutTurn(Sprite *sprite); - void backObject(Sprite *sprite); - void backObject(); - void constant(Sprite *sprite, SetObject *objData); - void steady(Sprite *sprite, SetObject *objData); - void randomSprite(Sprite *sprite, SetObject *objData); - void doDoor(Sprite *sprite, SetObject *objData, Common::Rect check); - void doorway(Sprite *sprite, SetObject *objData); - void wideDoor(Sprite *sprite, SetObject *objData); - void lockedDoorway(Sprite *sprite, SetObject *objData); - void liftSprite(Sprite *sprite, SetObject *objData); - void showGameReel(ReelRoutine *routine); void makeBackOb(SetObject *objData); - void dealWithSpecial(uint8 firstParam, uint8 secondParam); void zoom(); void showRain(); void commandOnly(); @@ -117,7 +94,6 @@ void madman(ReelRoutine &routine); void madmanText(); void madMode(); - void moveMap(uint8 param); bool addAlong(const uint8 *mapFlags); bool addLength(const uint8 *mapFlags); void getDimension(); @@ -150,7 +126,6 @@ void setAllChanges(); void doChange(uint8 index, uint8 value, uint8 type); void deleteTaken(); - bool isCD(); void showAllFree(); void showAllEx(); bool finishedWalkingCPP(); @@ -199,8 +174,6 @@ const uint8 *getObTextStartCPP(); void useText(const uint8 *string); void useText(); - void getBlockOfPixel(); - uint8 getBlockOfPixel(uint8 x, uint8 y); void examineObText(); void showCity(); uint16 getPersFrame(uint8 index); @@ -208,23 +181,14 @@ void examineOb(bool examineAgain = true); void dumpWatch(); void transferText(); - void initRain(); - Rain *splitIntoLines(uint8 x, uint8 y, Rain *rain); void watchCount(); void loadRoom(); - void textForMonk(); - void textForMonkHelper(uint8 textIndex, uint8 voiceIndex, uint8 x, uint8 y, uint16 countToTimed, uint16 timeCount); - void textForEnd(); - void monks2text(); void intro1Text(); void intro2Text(); void intro3Text(); void readSetData(); void fadeupYellows(); void fadeupMonFirst(); - void loadMenu(); - void showMenu(); - void dumpMenu(); void useMenu(); void useMon(); void makeCaps(); @@ -247,7 +211,6 @@ void playChannel1(uint8 index) { DreamBase::playChannel1(index); } - void findRoomInLoc(); void reelsOnScreen(); void reconstruct(); void look(); @@ -316,7 +279,6 @@ void nextFolder(); void lastFolder(); void drawFloor(); - void allocateBuffers(); bool checkSpeed(ReelRoutine &routine); void checkSpeed(); void sparkyDrip(ReelRoutine &routine); @@ -450,10 +412,6 @@ void showLoadOps(); void watchReel(); void showWatchReel(); - void plotReel(uint16 &reelPointer); - void removeFreeObject(uint8 index) { - DreamBase::removeFreeObject(index); - } void afterNewRoom(); void madmanRun(); void showDecisions(); @@ -465,8 +423,6 @@ void hangOnPQ(); void showGun(); void endGame(); - void diaryKeyP(); - void diaryKeyN(); void checkInput(); void dropError(); void cantDrop(); diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp index b0666bab33..4e956cd016 100644 --- a/engines/dreamweb/use.cpp +++ b/engines/dreamweb/use.cpp @@ -975,7 +975,7 @@ void DreamGenContext::useElvDoor() { // Axe on door showPuzText(15, 300); - _inc(data.byte(kProgresspoints)); + data.byte(kProgresspoints)++; data.word(kWatchingtime) = 46 * 2; data.word(kReeltowatch) = 31; data.word(kEndwatchreel) = 77; @@ -1288,10 +1288,10 @@ void DreamGenContext::useDiary() { data.byte(kGetback) = 0; RectWithCallback diaryList[] = { - { kDiaryx+94,kDiaryx+110,kDiaryy+97,kDiaryy+113,&DreamGenContext::diaryKeyN }, - { kDiaryx+151,kDiaryx+167,kDiaryy+71,kDiaryy+87,&DreamGenContext::diaryKeyP }, - { kDiaryx+176,kDiaryx+192,kDiaryy+108,kDiaryy+124,&DreamGenContext::quitKey }, - { 0,320,0,200,&DreamGenContext::blank }, + { kDiaryx+94,kDiaryx+110,kDiaryy+97,kDiaryy+113,&DreamBase::diaryKeyN }, + { kDiaryx+151,kDiaryx+167,kDiaryy+71,kDiaryy+87,&DreamBase::diaryKeyP }, + { kDiaryx+176,kDiaryx+192,kDiaryy+108,kDiaryy+124,&DreamBase::quitKey }, + { 0,320,0,200,&DreamBase::blank }, { 0xFFFF,0,0,0,0 } }; -- cgit v1.2.3 From 010714ce5bf401f3d91e8d410c447b866646c85f Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 16 Dec 2011 17:05:15 +0100 Subject: DREAMWEB: Move more to DreamBase; fix regression in introMonks1() --- engines/dreamweb/dreambase.h | 9 +++++++++ engines/dreamweb/people.cpp | 28 +++++----------------------- engines/dreamweb/sprite.cpp | 14 +++++++------- engines/dreamweb/stubs.h | 7 ------- 4 files changed, 21 insertions(+), 37 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 4856ae0487..d6b94e013b 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -133,6 +133,11 @@ public: void bresenhams(); void workoutFrames(); + // from people.cpp + void madMode(); + void addToPeopleList(ReelRoutine *routine); + bool checkSpeed(ReelRoutine &routine); + // from print.cpp uint8 getNextWord(const Frame *charSet, const uint8 *string, uint8 *totalWidth, uint8 *charCount); void printChar(const Frame* charSet, uint16 *x, uint16 y, uint8 c, uint8 nextChar, uint8 *width, uint8 *height); @@ -194,6 +199,10 @@ public: Rain *splitIntoLines(uint8 x, uint8 y, Rain *rain); void initRain(); + void intro1Text(); + void intro2Text(uint16 nextReelPointer); + void intro3Text(uint16 nextReelPointer); + void rollEndCredits(); void monks2text(); void textForEnd(); diff --git a/engines/dreamweb/people.cpp b/engines/dreamweb/people.cpp index aeb0b5db22..c4f950cbab 100644 --- a/engines/dreamweb/people.cpp +++ b/engines/dreamweb/people.cpp @@ -140,7 +140,7 @@ void DreamGenContext::madman(ReelRoutine &routine) { madMode(); } -void DreamGenContext::madMode() { +void DreamBase::madMode() { data.word(kWatchingtime) = 2; data.byte(kPointermode) = 0; if (data.byte(kCombatcount) < (isCD() ? 65 : 63)) @@ -150,7 +150,7 @@ void DreamGenContext::madMode() { data.byte(kPointermode) = 2; } -void DreamGenContext::addToPeopleList(ReelRoutine *routine) { +void DreamBase::addToPeopleList(ReelRoutine *routine) { uint16 routinePointer = (const uint8 *)routine - data.ptr(0, 0); People *people = (People *)getSegment(data.word(kBuffers)).ptr(data.word(kListpos), sizeof(People)); @@ -160,12 +160,7 @@ void DreamGenContext::addToPeopleList(ReelRoutine *routine) { data.word(kListpos) += sizeof(People); } -void DreamGenContext::checkSpeed() { - ReelRoutine *routine = (ReelRoutine *)es.ptr(bx, sizeof(ReelRoutine)); - flags._z = checkSpeed(*routine); -} - -bool DreamGenContext::checkSpeed(ReelRoutine &routine) { +bool DreamBase::checkSpeed(ReelRoutine &routine) { if (data.byte(kLastweapon) != (uint8)-1) return true; ++routine.counter; @@ -372,11 +367,7 @@ void DreamGenContext::introMagic1(ReelRoutine &routine) { routine.setReelPointer(nextReelPointer); if (nextReelPointer == 121) { ++data.byte(kIntrocount); - push(es); - push(bx); intro1Text(); - bx = pop(); - es = pop(); if (data.byte(kIntrocount) == 8) { data.byte(kMapy) += 10; data.byte(kNowinnewroom) = 1; @@ -462,12 +453,7 @@ void DreamGenContext::gates(ReelRoutine &routine) { nextReelPointer = 119; } routine.setReelPointer(nextReelPointer); - push(es); - push(bx); - ax = nextReelPointer; - intro3Text(); - bx = pop(); - es = pop(); + intro3Text(nextReelPointer); } showGameReel(&routine); } @@ -655,11 +641,7 @@ void DreamGenContext::introMonks1(ReelRoutine &routine) { nextReelPointer == 25 || nextReelPointer == 61 || nextReelPointer == 71) { // Wait step - push(es); - push(bx); - intro2Text(); - bx = pop(); - es = pop(); + intro2Text(nextReelPointer); routine.counter = (uint8)-20; } } diff --git a/engines/dreamweb/sprite.cpp b/engines/dreamweb/sprite.cpp index 99b12d1bc8..cfa204ec23 100644 --- a/engines/dreamweb/sprite.cpp +++ b/engines/dreamweb/sprite.cpp @@ -709,7 +709,7 @@ void DreamBase::initRain() { rain->x = 0xff; } -void DreamGenContext::intro1Text() { +void DreamBase::intro1Text() { if (data.byte(kIntrocount) != 2 && data.byte(kIntrocount) != 4 && data.byte(kIntrocount) != 6) return; @@ -725,17 +725,17 @@ void DreamGenContext::intro1Text() { } } -void DreamGenContext::intro2Text() { - if (ax == 5) +void DreamBase::intro2Text(uint16 nextReelPointer) { + if (nextReelPointer == 5) setupTimedTemp(43, 82, 34, 40, 90, 1); - else if (ax == 15) + else if (nextReelPointer == 15) setupTimedTemp(44, 82, 34, 40, 90, 1); } -void DreamGenContext::intro3Text() { - if (ax == 107) +void DreamBase::intro3Text(uint16 nextReelPointer) { + if (nextReelPointer == 107) setupTimedTemp(45, 82, 36, 56, 100, 1); - else if (ax == (isCD() ? 108 : 109)) + else if (nextReelPointer == (isCD() ? 108 : 109)) setupTimedTemp(46, 82, 36, 56, 100, 1); } diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 765b689251..df55f0579c 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -93,7 +93,6 @@ void updatePeople(); void madman(ReelRoutine &routine); void madmanText(); - void madMode(); bool addAlong(const uint8 *mapFlags); bool addLength(const uint8 *mapFlags); void getDimension(); @@ -138,7 +137,6 @@ void obName(); void obName(uint8 command, uint8 commandType); void checkCoords(const RectWithCallback *rectWithCallbacks); - void addToPeopleList(ReelRoutine *routine); void getExPos(); void compare(); bool compare(uint8 index, uint8 flag, const char id[4]) { @@ -183,9 +181,6 @@ void transferText(); void watchCount(); void loadRoom(); - void intro1Text(); - void intro2Text(); - void intro3Text(); void readSetData(); void fadeupYellows(); void fadeupMonFirst(); @@ -279,8 +274,6 @@ void nextFolder(); void lastFolder(); void drawFloor(); - bool checkSpeed(ReelRoutine &routine); - void checkSpeed(); void sparkyDrip(ReelRoutine &routine); void genericPerson(ReelRoutine &routine); void gamer(ReelRoutine &routine); -- cgit v1.2.3 From 8cb92c2367da5a16f4d7ffb68adea9f1bdfd13e8 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 16 Dec 2011 17:20:53 +0100 Subject: DREAMWEB: Convert fadeScreenDownHalf to C++ --- engines/dreamweb/dreambase.h | 2 ++ engines/dreamweb/dreamgen.cpp | 30 ------------------------------ engines/dreamweb/dreamgen.h | 1 - engines/dreamweb/stubs.h | 1 - engines/dreamweb/vgafades.cpp | 23 ++++++++++++++++++++++- 5 files changed, 24 insertions(+), 33 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index d6b94e013b..a6c1abc9cd 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -356,6 +356,8 @@ public: void fadeScreenUpHalf(); void fadeScreenDown(); void fadeScreenDowns(); + void fadeScreenDownHalf(); + void clearPalette(); void greyscaleSum(); void allPalette(); void dumpCurrent(); diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 906ce3adc3..ea731fcb21 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -285,36 +285,6 @@ void DreamGenContext::transferMap() { _add(data.word(kExframepos), cx); } -void DreamGenContext::fadeScreenDownHalf() { - STACK_CHECK; - palToStartPal(); - palToEndPal(); - cx = 768; - es = data.word(kBuffers); - bx = (0+(228*13)+32+60+(32*32)+(11*10*3)+768); -halfend: - al = es.byte(bx); - _shr(al, 1); - es.byte(bx) = al; - _inc(bx); - if (--cx) - goto halfend; - ds = data.word(kBuffers); - es = data.word(kBuffers); - si = (0+(228*13)+32+60+(32*32)+(11*10*3))+(56*3); - di = (0+(228*13)+32+60+(32*32)+(11*10*3)+768)+(56*3); - cx = 3*5; - _movsb(cx, true); - si = (0+(228*13)+32+60+(32*32)+(11*10*3))+(77*3); - di = (0+(228*13)+32+60+(32*32)+(11*10*3)+768)+(77*3); - cx = 3*2; - _movsb(cx, true); - data.byte(kFadedirection) = 1; - data.byte(kFadecount) = 31; - data.byte(kColourpos) = 0; - data.byte(kNumtofade) = 32; -} - void DreamGenContext::rollEm() { STACK_CHECK; cl = 160; diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index ddccd5eaad..f22461ef0f 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -487,7 +487,6 @@ public: void doSomeTalk(); void resetLocation(); void adjustUp(); - void fadeScreenDownHalf(); void outOfOpen(); void dirCom(); void findFirstPath(); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index df55f0579c..79b2244e9c 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -382,7 +382,6 @@ void obsThatDoThings(); void makeMainScreen(); void delEverything(); - void clearPalette(); void errorMessage1(); void errorMessage2(); void errorMessage3(); diff --git a/engines/dreamweb/vgafades.cpp b/engines/dreamweb/vgafades.cpp index ca63b7308c..6766d56424 100644 --- a/engines/dreamweb/vgafades.cpp +++ b/engines/dreamweb/vgafades.cpp @@ -184,7 +184,28 @@ void DreamBase::fadeScreenDowns() { data.byte(kNumtofade) = 64; } -void DreamGenContext::clearPalette() { +void DreamBase::fadeScreenDownHalf() { + palToStartPal(); + palToEndPal(); + + const uint8 *startPal = startPalette(); + uint8 *endPal = endPalette(); + for (int i = 0; i < 256 * 3; ++i) { + *endPal >>= 1; + endPal++; + } + + memcpy(endPal + (56*3), startPal + (56*3), 3*5); + memcpy(endPal + (77*3), startPal + (77*3), 3*2); + + data.byte(kFadedirection) = 1; + data.byte(kFadecount) = 31; + data.byte(kColourpos) = 0; + data.byte(kNumtofade) = 32; +} + + +void DreamBase::clearPalette() { data.byte(kFadedirection) = 0; clearStartPal(); dumpCurrent(); -- cgit v1.2.3 From 2f0c6712566b757b6527a37bdaf35519a7d42c3e Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 16 Dec 2011 17:11:46 +0100 Subject: DREAMWEB: Move most of people.cpp to DreamBase --- engines/dreamweb/dreambase.h | 49 +++++++++++++ engines/dreamweb/people.cpp | 168 ++++++++++++++++++++----------------------- engines/dreamweb/stubs.h | 48 ------------- 3 files changed, 126 insertions(+), 139 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index a6c1abc9cd..e64a41d75e 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -134,9 +134,58 @@ public: void workoutFrames(); // from people.cpp + void madmanText(); + void madman(ReelRoutine &routine); void madMode(); void addToPeopleList(ReelRoutine *routine); bool checkSpeed(ReelRoutine &routine); + void sparkyDrip(ReelRoutine &routine); + void genericPerson(ReelRoutine &routine); + void gamer(ReelRoutine &routine); + void eden(ReelRoutine &routine); + void sparky(ReelRoutine &routine); + void rockstar(ReelRoutine &routine); + void madmansTelly(ReelRoutine &routine); + void smokeBloke(ReelRoutine &routine); + void manAsleep(ReelRoutine &routine); + void drunk(ReelRoutine &routine); + void introMagic1(ReelRoutine &routine); + void introMagic2(ReelRoutine &routine); + void introMagic3(ReelRoutine &routine); + void introMusic(ReelRoutine &routine); + void candles(ReelRoutine &routine); + void candles1(ReelRoutine &routine); + void candles2(ReelRoutine &routine); + void smallCandle(ReelRoutine &routine); + void gates(ReelRoutine &routine); + void security(ReelRoutine &routine); + void edenInBath(ReelRoutine &routine); + void louis(ReelRoutine &routine); + void handClap(ReelRoutine &routine); + void carParkDrip(ReelRoutine &routine); + void foghornSound(ReelRoutine &routine); + void train(ReelRoutine &routine); + void attendant(ReelRoutine &routine); + void keeper(ReelRoutine &routine); + void interviewer(ReelRoutine &routine); + void drinker(ReelRoutine &routine); + void alleyBarkSound(ReelRoutine &routine); + void louisChair(ReelRoutine &routine); + void bossMan(ReelRoutine &routine); + void priest(ReelRoutine &routine); + void monkAndRyan(ReelRoutine &routine); + void copper(ReelRoutine &routine); + void introMonks1(ReelRoutine &routine); + void introMonks2(ReelRoutine &routine); + void soldier1(ReelRoutine &routine); + void receptionist(ReelRoutine &routine); + void bartender(ReelRoutine &routine); + void heavy(ReelRoutine &routine); + void helicopter(ReelRoutine &routine); + //void mugger(ReelRoutine &routine); + void businessMan(ReelRoutine &routine); + void endGameSeq(ReelRoutine &routine); + void poolGuard(ReelRoutine &routine); // from print.cpp uint8 getNextWord(const Frame *charSet, const uint8 *string, uint8 *totalWidth, uint8 *charCount); diff --git a/engines/dreamweb/people.cpp b/engines/dreamweb/people.cpp index c4f950cbab..887a4452ad 100644 --- a/engines/dreamweb/people.cpp +++ b/engines/dreamweb/people.cpp @@ -25,35 +25,35 @@ namespace DreamGen { static void (DreamGenContext::*reelCallbacks[57])(ReelRoutine &) = { - &DreamGenContext::gamer, &DreamGenContext::sparkyDrip, - &DreamGenContext::eden, &DreamGenContext::edenInBath, - &DreamGenContext::sparky, &DreamGenContext::smokeBloke, - &DreamGenContext::manAsleep, &DreamGenContext::drunk, - &DreamGenContext::receptionist, &DreamGenContext::genericPerson /*maleFan*/, - &DreamGenContext::genericPerson /*femaleFan*/, &DreamGenContext::louis, - &DreamGenContext::louisChair, &DreamGenContext::soldier1, - &DreamGenContext::bossMan, &DreamGenContext::interviewer, - &DreamGenContext::heavy, &DreamGenContext::manAsleep /*manAsleep2*/, - &DreamGenContext::genericPerson /*manSatStill*/, &DreamGenContext::drinker, - &DreamGenContext::bartender, &DreamGenContext::genericPerson /*otherSmoker*/, - &DreamGenContext::genericPerson /*tattooMan*/, &DreamGenContext::attendant, - &DreamGenContext::keeper, &DreamGenContext::candles1, - &DreamGenContext::smallCandle, &DreamGenContext::security, - &DreamGenContext::copper, &DreamGenContext::poolGuard, - &DreamGenContext::rockstar, &DreamGenContext::businessMan, - &DreamGenContext::train, &DreamGenContext::genericPerson /*aide*/, - &DreamGenContext::mugger, &DreamGenContext::helicopter, - &DreamGenContext::introMagic1, &DreamGenContext::introMusic, - &DreamGenContext::introMagic2, &DreamGenContext::candles2, - &DreamGenContext::gates, &DreamGenContext::introMagic3, - &DreamGenContext::introMonks1, &DreamGenContext::candles, - &DreamGenContext::introMonks2, &DreamGenContext::handClap, - &DreamGenContext::monkAndRyan, &DreamGenContext::endGameSeq, - &DreamGenContext::priest, &DreamGenContext::madman, - &DreamGenContext::madmansTelly, &DreamGenContext::alleyBarkSound, - &DreamGenContext::foghornSound, &DreamGenContext::carParkDrip, - &DreamGenContext::carParkDrip, &DreamGenContext::carParkDrip, - &DreamGenContext::carParkDrip + &DreamBase::gamer, &DreamBase::sparkyDrip, + &DreamBase::eden, &DreamBase::edenInBath, + &DreamBase::sparky, &DreamBase::smokeBloke, + &DreamBase::manAsleep, &DreamBase::drunk, + &DreamBase::receptionist, &DreamBase::genericPerson /*maleFan*/, + &DreamBase::genericPerson /*femaleFan*/, &DreamBase::louis, + &DreamBase::louisChair, &DreamBase::soldier1, + &DreamBase::bossMan, &DreamBase::interviewer, + &DreamBase::heavy, &DreamBase::manAsleep /*manAsleep2*/, + &DreamBase::genericPerson /*manSatStill*/, &DreamBase::drinker, + &DreamBase::bartender, &DreamBase::genericPerson /*otherSmoker*/, + &DreamBase::genericPerson /*tattooMan*/, &DreamBase::attendant, + &DreamBase::keeper, &DreamBase::candles1, + &DreamBase::smallCandle, &DreamBase::security, + &DreamBase::copper, &DreamBase::poolGuard, + &DreamBase::rockstar, &DreamBase::businessMan, + &DreamBase::train, &DreamBase::genericPerson /*aide*/, + &DreamGenContext::mugger, &DreamBase::helicopter, + &DreamBase::introMagic1, &DreamBase::introMusic, + &DreamBase::introMagic2, &DreamBase::candles2, + &DreamBase::gates, &DreamBase::introMagic3, + &DreamBase::introMonks1, &DreamBase::candles, + &DreamBase::introMonks2, &DreamBase::handClap, + &DreamBase::monkAndRyan, &DreamGenContext::endGameSeq, + &DreamBase::priest, &DreamBase::madman, + &DreamBase::madmansTelly, &DreamBase::alleyBarkSound, + &DreamBase::foghornSound, &DreamBase::carParkDrip, + &DreamBase::carParkDrip, &DreamBase::carParkDrip, + &DreamBase::carParkDrip }; void DreamGenContext::updatePeople() { @@ -74,7 +74,7 @@ void DreamGenContext::updatePeople() { } } -void DreamGenContext::madmanText() { +void DreamBase::madmanText() { byte origCount; if (isCD()) { @@ -94,7 +94,7 @@ void DreamGenContext::madmanText() { setupTimedTemp(47 + origCount, 82, 72, 80, 90, 1); } -void DreamGenContext::madman(ReelRoutine &routine) { +void DreamBase::madman(ReelRoutine &routine) { data.word(kWatchingtime) = 2; if (checkSpeed(routine)) { uint16 newReelPointer = routine.reelPointer(); @@ -170,17 +170,17 @@ bool DreamBase::checkSpeed(ReelRoutine &routine) { return true; } -void DreamGenContext::sparkyDrip(ReelRoutine &routine) { +void DreamBase::sparkyDrip(ReelRoutine &routine) { if (checkSpeed(routine)) playChannel0(14, 0); } -void DreamGenContext::genericPerson(ReelRoutine &routine) { +void DreamBase::genericPerson(ReelRoutine &routine) { showGameReel(&routine); addToPeopleList(&routine); } -void DreamGenContext::gamer(ReelRoutine &routine) { +void DreamBase::gamer(ReelRoutine &routine) { if (checkSpeed(routine)) { uint8 v; do { @@ -193,14 +193,14 @@ void DreamGenContext::gamer(ReelRoutine &routine) { addToPeopleList(&routine); } -void DreamGenContext::eden(ReelRoutine &routine) { +void DreamBase::eden(ReelRoutine &routine) { if (data.byte(kGeneraldead)) return; showGameReel(&routine); addToPeopleList(&routine); } -void DreamGenContext::sparky(ReelRoutine &routine) { +void DreamBase::sparky(ReelRoutine &routine) { if (data.word(kCard1money)) routine.b7 = 3; if (checkSpeed(routine)) { @@ -222,7 +222,7 @@ void DreamGenContext::sparky(ReelRoutine &routine) { data.byte(kTalkedtosparky) = 1; } -void DreamGenContext::rockstar(ReelRoutine &routine) { +void DreamBase::rockstar(ReelRoutine &routine) { if ((routine.reelPointer() == 303) || (routine.reelPointer() == 118)) { data.byte(kNewlocation) = 45; showGameReel(&routine); @@ -259,7 +259,7 @@ void DreamGenContext::rockstar(ReelRoutine &routine) { } } -void DreamGenContext::madmansTelly(ReelRoutine &routine) { +void DreamBase::madmansTelly(ReelRoutine &routine) { uint16 nextReelPointer = routine.reelPointer() + 1; if (nextReelPointer == 307) nextReelPointer = 300; @@ -268,7 +268,7 @@ void DreamGenContext::madmansTelly(ReelRoutine &routine) { } -void DreamGenContext::smokeBloke(ReelRoutine &routine) { +void DreamBase::smokeBloke(ReelRoutine &routine) { if (data.byte(kRockstardead) == 0) { if (routine.b7 & 128) DreamBase::setLocation(5); @@ -288,20 +288,20 @@ void DreamGenContext::smokeBloke(ReelRoutine &routine) { addToPeopleList(&routine); } -void DreamGenContext::manAsleep(ReelRoutine &routine) { +void DreamBase::manAsleep(ReelRoutine &routine) { routine.b7 &= 127; showGameReel(&routine); addToPeopleList(&routine); } -void DreamGenContext::attendant(ReelRoutine &routine) { +void DreamBase::attendant(ReelRoutine &routine) { showGameReel(&routine); addToPeopleList(&routine); if (routine.b7 & 128) data.byte(kTalkedtoattendant) = 1; } -void DreamGenContext::keeper(ReelRoutine &routine) { +void DreamBase::keeper(ReelRoutine &routine) { if (data.byte(kKeeperflag) != 0) { // Not waiting addToPeopleList(&routine); @@ -318,7 +318,7 @@ void DreamGenContext::keeper(ReelRoutine &routine) { routine.b7 = data.byte(kDreamnumber); } -void DreamGenContext::drunk(ReelRoutine &routine) { +void DreamBase::drunk(ReelRoutine &routine) { if (data.byte(kGeneraldead)) return; routine.b7 &= 127; @@ -326,7 +326,7 @@ void DreamGenContext::drunk(ReelRoutine &routine) { addToPeopleList(&routine); } -void DreamGenContext::interviewer(ReelRoutine &routine) { +void DreamBase::interviewer(ReelRoutine &routine) { if (data.word(kReeltowatch) == 68) routine.incReelPointer(); @@ -336,7 +336,7 @@ void DreamGenContext::interviewer(ReelRoutine &routine) { showGameReel(&routine); } -void DreamGenContext::drinker(ReelRoutine &routine) { +void DreamBase::drinker(ReelRoutine &routine) { if (checkSpeed(routine)) { routine.incReelPointer(); @@ -349,7 +349,7 @@ void DreamGenContext::drinker(ReelRoutine &routine) { addToPeopleList(&routine); } -void DreamGenContext::alleyBarkSound(ReelRoutine &routine) { +void DreamBase::alleyBarkSound(ReelRoutine &routine) { uint16 prevReelPointer = routine.reelPointer() - 1; if (prevReelPointer == 0) { playChannel1(14); @@ -359,7 +359,7 @@ void DreamGenContext::alleyBarkSound(ReelRoutine &routine) { } } -void DreamGenContext::introMagic1(ReelRoutine &routine) { +void DreamBase::introMagic1(ReelRoutine &routine) { if (checkSpeed(routine)) { uint16 nextReelPointer = routine.reelPointer() + 1; if (nextReelPointer == 145) @@ -377,7 +377,7 @@ void DreamGenContext::introMagic1(ReelRoutine &routine) { showGameReel(&routine); } -void DreamGenContext::introMagic2(ReelRoutine &routine) { +void DreamBase::introMagic2(ReelRoutine &routine) { if (checkSpeed(routine)) { uint16 nextReelPointer = routine.reelPointer() + 1; if (nextReelPointer == 216) @@ -387,7 +387,7 @@ void DreamGenContext::introMagic2(ReelRoutine &routine) { showGameReel(&routine); } -void DreamGenContext::introMagic3(ReelRoutine &routine) { +void DreamBase::introMagic3(ReelRoutine &routine) { if (checkSpeed(routine)) { uint16 nextReelPointer = routine.reelPointer() + 1; if (nextReelPointer == 218) @@ -398,7 +398,7 @@ void DreamGenContext::introMagic3(ReelRoutine &routine) { routine.mapX = data.byte(kMapx); } -void DreamGenContext::candles1(ReelRoutine &routine) { +void DreamBase::candles1(ReelRoutine &routine) { if (checkSpeed(routine)) { uint16 nextReelPointer = routine.reelPointer() + 1; if (nextReelPointer == 44) @@ -408,7 +408,7 @@ void DreamGenContext::candles1(ReelRoutine &routine) { showGameReel(&routine); } -void DreamGenContext::candles2(ReelRoutine &routine) { +void DreamBase::candles2(ReelRoutine &routine) { if (checkSpeed(routine)) { uint16 nextReelPointer = routine.reelPointer() + 1; if (nextReelPointer == 238) @@ -418,7 +418,7 @@ void DreamGenContext::candles2(ReelRoutine &routine) { showGameReel(&routine); } -void DreamGenContext::smallCandle(ReelRoutine &routine) { +void DreamBase::smallCandle(ReelRoutine &routine) { if (checkSpeed(routine)) { uint16 nextReelPointer = routine.reelPointer() + 1; if (nextReelPointer == 37) @@ -428,10 +428,10 @@ void DreamGenContext::smallCandle(ReelRoutine &routine) { showGameReel(&routine); } -void DreamGenContext::introMusic(ReelRoutine &routine) { +void DreamBase::introMusic(ReelRoutine &routine) { } -void DreamGenContext::candles(ReelRoutine &routine) { +void DreamBase::candles(ReelRoutine &routine) { if (checkSpeed(routine)) { uint16 nextReelPointer = routine.reelPointer() + 1; if (nextReelPointer == 167) @@ -441,7 +441,7 @@ void DreamGenContext::candles(ReelRoutine &routine) { showGameReel(&routine); } -void DreamGenContext::gates(ReelRoutine &routine) { +void DreamBase::gates(ReelRoutine &routine) { if (checkSpeed(routine)) { uint16 nextReelPointer = routine.reelPointer() + 1; if (nextReelPointer == 116) @@ -458,7 +458,7 @@ void DreamGenContext::gates(ReelRoutine &routine) { showGameReel(&routine); } -void DreamGenContext::security(ReelRoutine &routine) { +void DreamBase::security(ReelRoutine &routine) { if (routine.reelPointer() == 32) { if (data.byte(kLastweapon) == 1) { data.word(kWatchingtime) = 10; @@ -478,7 +478,7 @@ void DreamGenContext::security(ReelRoutine &routine) { addToPeopleList(&routine); } -void DreamGenContext::edenInBath(ReelRoutine &routine) { +void DreamBase::edenInBath(ReelRoutine &routine) { if (data.byte(kGeneraldead) == 0 || data.byte(kSartaindead) != 0) return; @@ -486,7 +486,7 @@ void DreamGenContext::edenInBath(ReelRoutine &routine) { addToPeopleList(&routine); } -void DreamGenContext::louis(ReelRoutine &routine) { +void DreamBase::louis(ReelRoutine &routine) { if (data.byte(kRockstardead) != 0) return; @@ -494,26 +494,26 @@ void DreamGenContext::louis(ReelRoutine &routine) { addToPeopleList(&routine); } -void DreamGenContext::handClap(ReelRoutine &routine) { +void DreamBase::handClap(ReelRoutine &routine) { } -void DreamGenContext::carParkDrip(ReelRoutine &routine) { +void DreamBase::carParkDrip(ReelRoutine &routine) { if (!checkSpeed(routine)) return; // cantdrip2 playChannel1(14); } -void DreamGenContext::foghornSound(ReelRoutine &routine) { +void DreamBase::foghornSound(ReelRoutine &routine) { if (engine->randomNumber() == 198) playChannel1(13); } -void DreamGenContext::train(ReelRoutine &routine) { +void DreamBase::train(ReelRoutine &routine) { // The original code has logic for this, but it is disabled } -void DreamGenContext::louisChair(ReelRoutine &routine) { +void DreamBase::louisChair(ReelRoutine &routine) { if (data.byte(kRockstardead) == 0) return; // notlouis2 @@ -535,7 +535,7 @@ void DreamGenContext::louisChair(ReelRoutine &routine) { addToPeopleList(&routine); } -void DreamGenContext::bossMan(ReelRoutine &routine) { +void DreamBase::bossMan(ReelRoutine &routine) { if (checkSpeed(routine)) { uint16 nextReelPointer = routine.reelPointer() + 1; @@ -561,7 +561,7 @@ void DreamGenContext::bossMan(ReelRoutine &routine) { data.byte(kTalkedtoboss) = 1; } -void DreamGenContext::priest(ReelRoutine &routine) { +void DreamBase::priest(ReelRoutine &routine) { if (routine.reelPointer() == 8) return; // priestspoken @@ -582,7 +582,7 @@ void DreamBase::priestText(ReelRoutine &routine) { setupTimedUse((reel >> 1) + 50, 54, 1, 72, 80); } -void DreamGenContext::monkAndRyan(ReelRoutine &routine) { +void DreamBase::monkAndRyan(ReelRoutine &routine) { if (checkSpeed(routine)) { uint16 nextReelPointer = routine.reelPointer() + 1; if (nextReelPointer == 83) { @@ -602,7 +602,7 @@ void DreamGenContext::monkAndRyan(ReelRoutine &routine) { showGameReel(&routine); } -void DreamGenContext::copper(ReelRoutine &routine) { +void DreamBase::copper(ReelRoutine &routine) { if (checkSpeed(routine)) { uint16 nextReelPointer = routine.reelPointer() + 1; if (nextReelPointer == 94) { @@ -620,7 +620,7 @@ void DreamGenContext::copper(ReelRoutine &routine) { addToPeopleList(&routine); } -void DreamGenContext::introMonks1(ReelRoutine &routine) { +void DreamBase::introMonks1(ReelRoutine &routine) { if (checkSpeed(routine)) { uint16 nextReelPointer = routine.reelPointer() + 1; @@ -650,16 +650,12 @@ void DreamGenContext::introMonks1(ReelRoutine &routine) { routine.mapY = data.byte(kMapy); } -void DreamGenContext::introMonks2(ReelRoutine &routine) { +void DreamBase::introMonks2(ReelRoutine &routine) { if (checkSpeed(routine)) { uint16 nextReelPointer = routine.reelPointer() + 1; if (nextReelPointer == 87) { data.byte(kIntrocount)++; - push(es); - push(bx); monks2text(); - bx = pop(); - es = pop(); if (data.byte(kIntrocount), 19) nextReelPointer = 87; @@ -669,11 +665,7 @@ void DreamGenContext::introMonks2(ReelRoutine &routine) { if (nextReelPointer == 110) { data.byte(kIntrocount)++; - push(es); - push(bx); monks2text(); - bx = pop(); - es = pop(); if (data.byte(kIntrocount) == 35) nextReelPointer = 111; @@ -691,7 +683,7 @@ void DreamGenContext::introMonks2(ReelRoutine &routine) { showGameReel(&routine); } -void DreamGenContext::soldier1(ReelRoutine &routine) { +void DreamBase::soldier1(ReelRoutine &routine) { if (routine.reelPointer() != 0) { data.word(kWatchingtime) = 10; if (routine.reelPointer() == 30) { @@ -714,7 +706,7 @@ void DreamGenContext::soldier1(ReelRoutine &routine) { addToPeopleList(&routine); } -void DreamGenContext::receptionist(ReelRoutine &routine) { +void DreamBase::receptionist(ReelRoutine &routine) { if (checkSpeed(routine)) { if (data.byte(kCardpassflag) == 1) { // Set card @@ -751,7 +743,7 @@ void DreamGenContext::receptionist(ReelRoutine &routine) { data.byte(kTalkedtorecep) = 1; } -void DreamGenContext::bartender(ReelRoutine &routine) { +void DreamBase::bartender(ReelRoutine &routine) { if (checkSpeed(routine)) { if (routine.reelPointer() == 86) { if (engine->randomNumber() >= 18) @@ -772,7 +764,7 @@ void DreamGenContext::bartender(ReelRoutine &routine) { addToPeopleList(&routine); } -void DreamGenContext::heavy(ReelRoutine &routine) { +void DreamBase::heavy(ReelRoutine &routine) { routine.b7 &= 127; if (routine.reelPointer() != 43) { data.word(kWatchingtime) = 10; @@ -796,7 +788,7 @@ void DreamGenContext::heavy(ReelRoutine &routine) { addToPeopleList(&routine); } -void DreamGenContext::helicopter(ReelRoutine &routine) { +void DreamBase::helicopter(ReelRoutine &routine) { if (routine.reelPointer() == 203) { // Won helicopter data.byte(kPointermode) = 0; @@ -881,7 +873,7 @@ void DreamGenContext::mugger(ReelRoutine &routine) { } } -void DreamGenContext::businessMan(ReelRoutine &routine) { +void DreamBase::businessMan(ReelRoutine &routine) { data.byte(kPointermode) = 0; data.word(kWatchingtime) = 2; if (routine.reelPointer() == 2) { @@ -945,7 +937,7 @@ void DreamGenContext::businessMan(ReelRoutine &routine) { } } -void DreamGenContext::endGameSeq(ReelRoutine &routine) { +void DreamBase::endGameSeq(ReelRoutine &routine) { if (checkSpeed(routine)) { uint16 nextReelPointer = routine.reelPointer() + 1; if (nextReelPointer == 51 && data.byte(kIntrocount) != 140) { @@ -956,13 +948,7 @@ void DreamGenContext::endGameSeq(ReelRoutine &routine) { routine.setReelPointer(nextReelPointer); if (nextReelPointer == 134) { - push(es); - push(bx); - push(ax); fadeScreenDownHalf(); - ax = pop(); - bx = pop(); - es = pop(); } else if (nextReelPointer == 324) { fadeScreenDowns(); data.byte(kVolumeto) = 7; @@ -982,7 +968,7 @@ void DreamGenContext::endGameSeq(ReelRoutine &routine) { } } -void DreamGenContext::poolGuard(ReelRoutine &routine) { +void DreamBase::poolGuard(ReelRoutine &routine) { if (routine.reelPointer() == 214 || routine.reelPointer() == 258) { // Combat over 2 showGameReel(&routine); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 79b2244e9c..c3d72a6d02 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -91,8 +91,6 @@ void commandWithOb(); void commandWithOb(uint8 command, uint8 type, uint8 index); void updatePeople(); - void madman(ReelRoutine &routine); - void madmanText(); bool addAlong(const uint8 *mapFlags); bool addLength(const uint8 *mapFlags); void getDimension(); @@ -274,53 +272,7 @@ void nextFolder(); void lastFolder(); void drawFloor(); - void sparkyDrip(ReelRoutine &routine); - void genericPerson(ReelRoutine &routine); - void gamer(ReelRoutine &routine); - void eden(ReelRoutine &routine); - void sparky(ReelRoutine &routine); - void rockstar(ReelRoutine &routine); - void madmansTelly(ReelRoutine &routine); - void smokeBloke(ReelRoutine &routine); - void manAsleep(ReelRoutine &routine); - void drunk(ReelRoutine &routine); - void introMagic1(ReelRoutine &routine); - void introMagic2(ReelRoutine &routine); - void introMagic3(ReelRoutine &routine); - void introMusic(ReelRoutine &routine); - void candles(ReelRoutine &routine); - void candles1(ReelRoutine &routine); - void candles2(ReelRoutine &routine); - void smallCandle(ReelRoutine &routine); - void gates(ReelRoutine &routine); - void security(ReelRoutine &routine); - void edenInBath(ReelRoutine &routine); - void louis(ReelRoutine &routine); - void handClap(ReelRoutine &routine); - void carParkDrip(ReelRoutine &routine); - void foghornSound(ReelRoutine &routine); - void train(ReelRoutine &routine); - void attendant(ReelRoutine &routine); - void keeper(ReelRoutine &routine); - void interviewer(ReelRoutine &routine); - void drinker(ReelRoutine &routine); - void alleyBarkSound(ReelRoutine &routine); - void louisChair(ReelRoutine &routine); - void bossMan(ReelRoutine &routine); - void priest(ReelRoutine &routine); - void monkAndRyan(ReelRoutine &routine); - void copper(ReelRoutine &routine); - void introMonks1(ReelRoutine &routine); - void introMonks2(ReelRoutine &routine); - void soldier1(ReelRoutine &routine); - void receptionist(ReelRoutine &routine); - void bartender(ReelRoutine &routine); - void heavy(ReelRoutine &routine); - void helicopter(ReelRoutine &routine); void mugger(ReelRoutine &routine); - void businessMan(ReelRoutine &routine); - void endGameSeq(ReelRoutine &routine); - void poolGuard(ReelRoutine &routine); void singleKey(uint8 key, uint16 x, uint16 y); void loadSaveBox(); uint8 nextSymbol(uint8 symbol); -- cgit v1.2.3 From 1d09f7c12a79416349cb33a7de88792c85ada5c1 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 16 Dec 2011 18:10:27 +0100 Subject: DREAMWEB: Some more cleanup --- engines/dreamweb/dreambase.h | 7 +++++ engines/dreamweb/stubs.cpp | 64 ++++++++++++-------------------------------- engines/dreamweb/stubs.h | 9 ------- 3 files changed, 24 insertions(+), 56 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index e64a41d75e..20cafcb203 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -381,6 +381,13 @@ public: void dealWithSpecial(uint8 firstParam, uint8 secondParam); void plotReel(uint16 &reelPointer); void setupTimedTemp(uint8 textIndex, uint8 voiceIndex, uint8 x, uint8 y, uint16 countToTimed, uint16 timeCount); + void getUnderTimed(); + void putUnderTimed(); + void dumpTextLine(); + void useTimedText(); + void dumpTimedText(); + void getTime(); + void doChange(uint8 index, uint8 value, uint8 type); // from use.cpp void placeFreeObject(uint8 index); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 352dec334d..3a9785e586 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -801,10 +801,6 @@ void DreamGenContext::seeCommandTail() { data.byte(kBrightness) = 1; } -void DreamGenContext::randomNumber() { - al = engine->randomNumber(); -} - void DreamGenContext::quickQuit() { engine->quit(); } @@ -829,7 +825,7 @@ uint16 DreamBase::readMouseState() { return state; } -void DreamGenContext::dumpTextLine() { +void DreamBase::dumpTextLine() { if (data.byte(kNewtextline) != 1) return; data.byte(kNewtextline) = 0; @@ -840,22 +836,18 @@ void DreamGenContext::dumpTextLine() { multiDump(x, y, 228, 13); } -void DreamGenContext::getUnderTimed() { +void DreamBase::getUnderTimed() { uint16 y = data.byte(kTimedy); if (data.byte(kForeignrelease)) y -= 3; - ds = data.word(kBuffers); - si = kUndertimedtext; - multiGet(ds.ptr(si, 0), data.byte(kTimedx), y, 240, kUndertimedysize); + multiGet(getSegment(data.word(kBuffers)).ptr(kUndertimedtext, 0), data.byte(kTimedx), y, 240, kUndertimedysize); } -void DreamGenContext::putUnderTimed() { +void DreamBase::putUnderTimed() { uint16 y = data.byte(kTimedy); if (data.byte(kForeignrelease)) y -= 3; - ds = data.word(kBuffers); - si = kUndertimedtext; - multiPut(ds.ptr(si, 0), data.byte(kTimedx), y, 240, kUndertimedysize); + multiPut(getSegment(data.word(kBuffers)).ptr(kUndertimedtext, 0), data.byte(kTimedx), y, 240, kUndertimedysize); } void DreamBase::getUnderCentre() { @@ -893,7 +885,7 @@ void DreamGenContext::processTrigger() { } } -void DreamGenContext::useTimedText() { +void DreamBase::useTimedText() { if (data.word(kTimecount) == 0) return; --data.word(kTimecount); @@ -908,9 +900,7 @@ void DreamGenContext::useTimedText() { else if (data.word(kTimecount) > data.word(kCounttotimed)) return; - es = data.word(kTimedseg); - si = data.word(kTimedoffset); - const uint8 *string = es.ptr(si, 0); + const uint8 *string = getSegment(data.word(kTimedseg)).ptr(data.word(kTimedoffset), 0); uint16 y = data.byte(kTimedy); printDirect(&string, data.byte(kTimedx), &y, 237, true); data.byte(kNeedtodumptimed) = 1; @@ -943,7 +933,7 @@ void DreamBase::setupTimedTemp(uint8 textIndex, uint8 voiceIndex, uint8 x, uint8 debug(1, "setupTimedTemp: (%d, %d) => '%s'", textIndex, voiceIndex, string); } -void DreamGenContext::dumpTimedText() { +void DreamBase::dumpTimedText() { if (data.byte(kNeedtodumptimed) != 1) return; uint8 y = data.byte(kTimedy); @@ -954,16 +944,13 @@ void DreamGenContext::dumpTimedText() { data.byte(kNeedtodumptimed) = 0; } -void DreamGenContext::getTime() { +void DreamBase::getTime() { TimeDate t; g_system->getTimeAndDate(t); debug(1, "\tgettime: %02d:%02d:%02d", t.tm_hour, t.tm_min, t.tm_sec); - ch = t.tm_hour; - cl = t.tm_min; - dh = t.tm_sec; - data.byte(kSecondcount) = dh; - data.byte(kMinutecount) = cl; - data.byte(kHourcount) = ch; + data.byte(kSecondcount) = t.tm_sec; + data.byte(kMinutecount) = t.tm_min; + data.byte(kHourcount) = t.tm_hour; } uint16 DreamBase::allocateMem(uint16 paragraphs) { @@ -979,12 +966,6 @@ void DreamBase::deallocateMem(uint16 segment) { debug(1, "deallocating segment %04x", segment); deallocateSegment(segment); - - // FIXME: The following line used to be enabled with the comment: "fixing - // invalid entries in the sprite table" - // So if there are regressions with sprites, we may want to investigate this - // closer. -// es = data; uint tsize = 16 * 32; uint16 bseg = data.word(kBuffers); if (!bseg) @@ -1119,10 +1100,6 @@ void DreamGenContext::startLoading(const Room &room) { setAllChanges(); autoAppear(); // 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; @@ -1295,10 +1272,6 @@ const uint8 *DreamGenContext::findObName(uint8 type, uint8 index) { } } -void DreamGenContext::copyName() { - copyName(ah, al, data.ptr(di, 0)); -} - void DreamGenContext::copyName(uint8 type, uint8 index, uint8 *dst) { const uint8 *src = findObName(type, index); size_t i; @@ -1419,7 +1392,7 @@ SetObject *DreamBase::getSetAd(uint8 index) { return (SetObject *)getSegment(data.word(kSetdat)).ptr(0, 0) + index; } -void DreamGenContext::doChange(uint8 index, uint8 value, uint8 type) { +void DreamBase::doChange(uint8 index, uint8 value, uint8 type) { if (type == 0) { //object getSetAd(index)->mapad[0] = value; } else if (type == 1) { //freeObject @@ -1427,9 +1400,9 @@ void DreamGenContext::doChange(uint8 index, uint8 value, uint8 type) { if (freeObject->mapad[0] == 0xff) freeObject->mapad[0] = value; } else { //path - bx = kPathdata + (type - 100) * 144 + index * 8; - es = data.word(kReels); - es.byte(bx+6) = value; +// getSegment(data.word(kReels)).byte(kPathdata + (type - 100) * 144 + index * 8 + 6) = value; + PathNode *paths = (PathNode *)getSegment(data.word(kReels)).ptr(kPathdata + 144 * (type - 100), 0); + paths[index].on = value; } } @@ -3922,11 +3895,8 @@ void DreamGenContext::talk() { break; } while (!data.byte(kGetback)); - bx = data.word(kPersondata); - es = cs; - if (data.byte(kTalkpos) >= 4) - es.byte(bx+7) |= 128; + data.byte(data.word(kPersondata)+7) |= 128; redrawMainScrn(); workToScreenM(); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index c3d72a6d02..ddaa66fa47 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -46,7 +46,6 @@ void readCityPic(); void readDestIcon(); void seeCommandTail(); - void randomNumber(); void quickQuit2(); void printDirect(); uint8 printDirect(const uint8** string, uint16 x, uint16 *y, uint8 maxWidth, bool centered) { @@ -55,11 +54,6 @@ uint8 printDirect(const uint8* string, uint16 x, uint16 y, uint8 maxWidth, bool centered) { return DreamBase::printDirect(string, x, y, maxWidth, centered); } - void useTimedText(); - void dumpTimedText(); - void getUnderTimed(); - void putUnderTimed(); - void dumpTextLine(); void startLoading(const Room &room); void showFrame(); void showFrame(const Frame *frameData, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag, uint8 *width, uint8 *height) { @@ -86,7 +80,6 @@ void checkIfEx(); bool checkIfEx(uint8 x, uint8 y); const uint8 *findObName(uint8 type, uint8 index); - void copyName(); void copyName(uint8 type, uint8 index, uint8 *dst); void commandWithOb(); void commandWithOb(uint8 command, uint8 type, uint8 index); @@ -121,7 +114,6 @@ return DreamBase::getSetAd(index); } void setAllChanges(); - void doChange(uint8 index, uint8 value, uint8 type); void deleteTaken(); void showAllFree(); void showAllEx(); @@ -350,7 +342,6 @@ bool loadSpeech(byte type1, int idx1, byte type2, int idx2) { return DreamBase::loadSpeech(type1, idx1, type2, idx2); } - void getTime(); void set16ColPalette(); void showSaveOps(); void showLoadOps(); -- cgit v1.2.3 From 12cac260c9acb16180ab4414fecd5748d77886f3 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 16 Dec 2011 22:04:47 +0200 Subject: DREAMWEB: Port 'isryanholding' to C++ --- engines/dreamweb/dreamgen.cpp | 38 -------------------------------------- engines/dreamweb/dreamgen.h | 1 - engines/dreamweb/stubs.cpp | 20 ++++++++++++++++++++ engines/dreamweb/stubs.h | 2 ++ engines/dreamweb/use.cpp | 8 +------- 5 files changed, 23 insertions(+), 46 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index ea731fcb21..0938efca37 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -2937,44 +2937,6 @@ doselob: useRoutine(); } -void DreamGenContext::isRyanHolding() { - STACK_CHECK; - _sub(al, 'A'); - _sub(ah, 'A'); - _sub(cl, 'A'); - _sub(ch, 'A'); - es = data.word(kExtras); - bx = (0+2080+30000); - dl = 0; -searchinv: - _cmp(es.byte(bx+2), 4); - if (!flags.z()) - goto nofindininv; - _cmp(al, es.byte(bx+12)); - if (!flags.z()) - goto nofindininv; - _cmp(ah, es.byte(bx+13)); - if (!flags.z()) - goto nofindininv; - _cmp(cl, es.byte(bx+14)); - if (!flags.z()) - goto nofindininv; - _cmp(ch, es.byte(bx+15)); - if (!flags.z()) - goto nofindininv; - al = dl; - _cmp(al, (114)); - return; -nofindininv: - _add(bx, 16); - _inc(dl); - _cmp(dl, (114)); - if (!flags.z()) - goto searchinv; - al = dl; - _cmp(al, (114)); -} - void DreamGenContext::checkInside() { STACK_CHECK; es = data.word(kExtras); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index f22461ef0f..f3cedd890d 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -480,7 +480,6 @@ public: void clearBuffers(); void getObTextStart(); void checkObjectSize(); - void isRyanHolding(); void fillOpen(); void useCashCard(); void moneyPoke(); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 3a9785e586..2279d9ffbe 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -1774,6 +1774,26 @@ uint16 DreamGenContext::findExObject(const char *id) { return kNumexobjects; } +void DreamGenContext::isRyanHolding() { + char id[5]; + id[0] = al; + id[1] = ah; + id[2] = cl; + id[3] = ch; + id[4] = '\0'; + flags._z = isRyanHolding(id); +} + +bool DreamGenContext::isRyanHolding(const char *id) { + for (uint16 index = 0; index < kNumexobjects; index++) { + DynObject *object = getExAd(index); + if (object->mapad[0] == 4 && objectMatches(object, id)) + return (index == kNumexobjects); + } + + return false; +} + bool DreamBase::isItDescribed(const ObjPos *pos) { uint16 offset = getSegment(data.word(kSetdesc)).word(kSettextdat + pos->index * 2); uint8 result = getSegment(data.word(kSetdesc)).byte(kSettext + offset); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index ddaa66fa47..d3f656db45 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -383,6 +383,8 @@ uint16 findSetObject(const char *id); void findExObject(); uint16 findExObject(const char *id); + void isRyanHolding(); + bool isRyanHolding(const char *id); void describeOb(); void getOpenedSize(); byte getOpenedSizeCPP(); diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp index 4e956cd016..385bfbb101 100644 --- a/engines/dreamweb/use.cpp +++ b/engines/dreamweb/use.cpp @@ -625,13 +625,7 @@ void DreamGenContext::sLabDoorB() { data.byte(kWatchspeed) = 1; data.byte(kSpeedcount) = 1; } else { - al = 'S'; - ah = 'H'; - cl = 'L'; - ch = 'D'; - isRyanHolding(); - - if (flags.z()) { + if (isRyanHolding("SHLD")) { // No crystal showPuzText(44, 200); putBackObStuff(); -- cgit v1.2.3 From 984010faae5d7cac0cef8f74229f9761cf7dd934 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 16 Dec 2011 22:29:41 +0200 Subject: DREAMWEB: Port 'identifyob' to C++ --- engines/dreamweb/dreamgen.cpp | 63 ------------------------------------------- engines/dreamweb/dreamgen.h | 5 ++-- engines/dreamweb/object.cpp | 38 ++++++++++++++++++++++++++ engines/dreamweb/stubs.h | 1 + 4 files changed, 41 insertions(+), 66 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 0938efca37..ddc599f7e8 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -3104,69 +3104,6 @@ void DreamGenContext::clearChanges() { _stosw(cx, true); } -void DreamGenContext::identifyOb() { - STACK_CHECK; - _cmp(data.word(kWatchingtime), 0); - if (!flags.z()) - { blank(); return; }; - ax = data.word(kMousex); - _sub(ax, data.word(kMapadx)); - _cmp(ax, 22*8); - if (flags.c()) - goto notover1; - blank(); - return; -notover1: - bx = data.word(kMousey); - _sub(bx, data.word(kMapady)); - _cmp(bx, 20*8); - if (flags.c()) - goto notover2; - blank(); - return; -notover2: - data.byte(kInmaparea) = 1; - ah = bl; - push(ax); - findPathOfPoint(); - data.byte(kPointerspath) = dl; - ax = pop(); - push(ax); - findFirstPath(); - data.byte(kPointerfirstpath) = al; - ax = pop(); - checkIfEx(); - if (!flags.z()) - return /* (finishidentify) */; - checkIfFree(); - if (!flags.z()) - return /* (finishidentify) */; - checkIfPerson(); - if (!flags.z()) - return /* (finishidentify) */; - checkIfSet(); - if (!flags.z()) - return /* (finishidentify) */; - ax = data.word(kMousex); - _sub(ax, data.word(kMapadx)); - cl = al; - ax = data.word(kMousey); - _sub(ax, data.word(kMapady)); - ch = al; - checkOne(); - _cmp(al, 0); - if (flags.z()) - goto nothingund; - _cmp(data.byte(kMandead), 1); - if (flags.z()) - goto nothingund; - ah = 3; - obName(); - return; -nothingund: - blank(); -} - void DreamGenContext::findPathOfPoint() { STACK_CHECK; push(ax); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index f3cedd890d..5273270ce5 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -475,12 +475,11 @@ public: #include "stubs.h" // Allow hand-reversed functions to have a signature different than void f() void fadeDownMon(); - void identifyOb(); void getPersonText(); void clearBuffers(); void getObTextStart(); void checkObjectSize(); - void fillOpen(); + void showSlots(); void useCashCard(); void moneyPoke(); void doSomeTalk(); @@ -519,7 +518,7 @@ public: void rollEm(); void lookAtPlace(); void findAllOpen(); - void showSlots(); + void fillOpen(); void deleteExObject(); void getEitherAd(); void setPickup(); diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index 5f326a5a03..64f70ada98 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -312,4 +312,42 @@ void DreamGenContext::openOb() { _openChangeSize = getOpenedSizeCPP() * kItempicsize + kInventx; } +void DreamGenContext::identifyOb() { + if (data.word(kWatchingtime) != 0 || + data.word(kMousex) - data.word(kMapadx) >= 22 * 8 || + data.word(kMousey) - data.word(kMapady) >= 20 * 8) { + blank(); + return; + } + + data.byte(kInmaparea) = 1; + ah = bl; + push(ax); + findPathOfPoint(); + data.byte(kPointerspath) = dl; + ax = pop(); + push(ax); + findFirstPath(); + data.byte(kPointerfirstpath) = al; + ax = pop(); + + byte x = al; + byte y = ah; + + if (checkIfEx(x, y) || checkIfFree(x, y) || + checkIfPerson(x, y) || checkIfSet(x, y)) + return; // finishidentify + + x = (data.word(kMousex) - data.word(kMapadx)) & 0xFF; + y = (data.word(kMousey) - data.word(kMapady)) & 0xFF; + byte flag, flagEx, type, flagX, flagY; + + checkOne(x, y, &flag, &flagEx, &type, &flagX, &flagY); + + if (type != 0 && data.byte(kMandead) != 1) + obName(type, 3); + else + blank(); +} + } // End of namespace DreamGen diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index d3f656db45..6140f3d0d4 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -392,5 +392,6 @@ void withWhat(); void notHeldError(); void useGun(); + void identifyOb(); #endif -- cgit v1.2.3 From 2887686d56544e6edfaf401c0aab5203be3c1ccc Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 16 Dec 2011 22:47:33 +0200 Subject: DREAMWEB: Port 'showslots' to C++ --- engines/dreamweb/dreamgen.cpp | 33 --------------------------------- engines/dreamweb/dreamgen.h | 3 +-- engines/dreamweb/stubs.cpp | 14 +++++++++++++- engines/dreamweb/stubs.h | 1 + 4 files changed, 15 insertions(+), 36 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index ddc599f7e8..b756c39bbf 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -3004,39 +3004,6 @@ gotkeyp: showDiaryPage(); } -void DreamGenContext::showSlots() { - STACK_CHECK; - di = (60)+7; - bx = (52)+8; - al = 2; - ds = data.word(kTempgraphics); - ah = 0; - showFrame(); - di = (60)+10; - bx = (52)+11; - cl = 0; -slotloop: - push(cx); - push(di); - push(bx); - _cmp(cl, data.byte(kCurrentslot)); - if (!flags.z()) - goto nomatchslot; - al = 3; - ds = data.word(kTempgraphics); - ah = 0; - showFrame(); -nomatchslot: - bx = pop(); - di = pop(); - cx = pop(); - _add(bx, 10); - _inc(cl); - _cmp(cl, 7); - if (!flags.z()) - goto slotloop; -} - void DreamGenContext::clearBuffers() { STACK_CHECK; es = data.word(kBuffers); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 5273270ce5..05e7c856df 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -479,7 +479,7 @@ public: void clearBuffers(); void getObTextStart(); void checkObjectSize(); - void showSlots(); + void fillOpen(); void useCashCard(); void moneyPoke(); void doSomeTalk(); @@ -518,7 +518,6 @@ public: void rollEm(); void lookAtPlace(); void findAllOpen(); - void fillOpen(); void deleteExObject(); void getEitherAd(); void setPickup(); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 2279d9ffbe..fb5fba8d9c 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -3927,7 +3927,6 @@ void DreamGenContext::talk() { } } - void DreamGenContext::discOps() { if (data.byte(kCommandtype) != 249) { data.byte(kCommandtype) = 249; @@ -4564,4 +4563,17 @@ void DreamGenContext::lookAtCard() { putBackObStuff(); } +void DreamGenContext::showSlots() { + showFrame(tempGraphics(), kOpsx + 7, kOpsy + 8, 2, 0); + + uint16 y = kOpsy + 11; + + for (int slot = 0; slot < 7; slot++) { + if (slot == data.byte(kCurrentslot)) + showFrame(tempGraphics(), kOpsx + 10, y, 3, 0); + + y += 10; + } +} + } // End of namespace DreamGen diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 6140f3d0d4..741abd807f 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -393,5 +393,6 @@ void notHeldError(); void useGun(); void identifyOb(); + void showSlots(); #endif -- cgit v1.2.3 From 654a60a90cfec631893598325dbfc5ab8adbfa35 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 17 Dec 2011 00:01:45 +0200 Subject: DREAMWEB: Rewrote useCashCard() in C++ and got rid of moneyPoke() and its associated offsets in the data blob --- engines/dreamweb/dreamgen.cpp | 134 +++++------------------------------------- engines/dreamweb/dreamgen.h | 22 +++---- engines/dreamweb/stubs.h | 1 + engines/dreamweb/use.cpp | 29 +++++++++ 4 files changed, 55 insertions(+), 131 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index b756c39bbf..47b01d3785 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -2170,14 +2170,14 @@ void DreamGenContext::getDestInfo() { push(ax); dx = data; es = dx; - si = 1131; + si = 1123; _add(si, ax); cl = es.byte(si); ax = pop(); push(cx); dx = data; es = dx; - si = 1147; + si = 1139; _add(si, ax); ax = pop(); } @@ -2229,7 +2229,7 @@ clearedlocations: bx = ax; dx = data; es = dx; - _add(bx, 1131); + _add(bx, 1123); es.byte(bx) = 0; } @@ -2370,7 +2370,7 @@ notyetassigned: push(bx); _add(bx, 2); ds = cs; - si = 1165; + si = 1157; checkpass: _lodsw(); ah = es.byte(bx); @@ -2698,7 +2698,7 @@ void DreamGenContext::parser() { al = '='; _stosb(); ds = cs; - si = 1165; + si = 1157; notspace1: _lodsw(); _cmp(al, 32); @@ -2736,106 +2736,6 @@ lookcolon: goto lookcolon; } -void DreamGenContext::useCashCard() { - STACK_CHECK; - getRidOfReels(); - loadKeypad(); - createPanel(); - showPanel(); - showExit(); - showMan(); - di = 114; - bx = 120; - _cmp(data.byte(kForeignrelease), 0); - if (flags.z()) - goto _tmp1; - bx = 120-3; -_tmp1: - ds = data.word(kTempgraphics); - al = 39; - ah = 0; - showFrame(); - ax = data.word(kCard1money); - moneyPoke(); - getObTextStart(); - nextColon(); - nextColon(); - di = 36; - bx = 98; - dl = 241; - al = 0; - ah = 0; - printDirect(); - di = 160; - bx = 155; - es = cs; - si = offset_money1poke; - data.word(kCharshift) = 91*2+75; - al = 0; - ah = 0; - dl = 240; - printDirect(); - di = 187; - bx = 155; - es = cs; - si = offset_money2poke; - data.word(kCharshift) = 91*2+85; - al = 0; - ah = 0; - dl = 240; - printDirect(); - data.word(kCharshift) = 0; - workToScreenM(); - cx = 400; - hangOnP(); - getRidOfTemp(); - restoreReels(); - putBackObStuff(); -} - -void DreamGenContext::moneyPoke() { - STACK_CHECK; - bx = offset_money1poke; - cl = 48-1; -numberpoke0: - _inc(cl); - _sub(ax, 10000); - if (!flags.c()) - goto numberpoke0; - _add(ax, 10000); - cs.byte(bx) = cl; - _inc(bx); - cl = 48-1; -numberpoke1: - _inc(cl); - _sub(ax, 1000); - if (!flags.c()) - goto numberpoke1; - _add(ax, 1000); - cs.byte(bx) = cl; - _inc(bx); - cl = 48-1; -numberpoke2: - _inc(cl); - _sub(ax, 100); - if (!flags.c()) - goto numberpoke2; - _add(ax, 100); - cs.byte(bx) = cl; - _inc(bx); - cl = 48-1; -numberpoke3: - _inc(cl); - _sub(ax, 10); - if (!flags.c()) - goto numberpoke3; - _add(ax, 10); - cs.byte(bx) = cl; - bx = offset_money2poke; - _add(al, 48); - cs.byte(bx) = al; -} - void DreamGenContext::useStereo() { STACK_CHECK; _cmp(data.byte(kLocation), 0); @@ -3059,7 +2959,7 @@ void DreamGenContext::clearChanges() { di = 0; _stosw(cx, true); es = cs; - di = 1131; + di = 1123; al = 1; _stosb(2); al = 0; @@ -3292,19 +3192,19 @@ void DreamGenContext::__start() { //0x0400: ."R OOT 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, //0x0410: . " - 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x30, 0x30, 0x30, 0x30, 0x00, 0x30, 0x30, 0x00, 0x0d, 0x0a, - //0x0420: .00 00.0 0... - 0x0d, 0x0a, 0x24, 0x10, 0x12, 0x12, 0x11, 0x10, 0x10, 0x10, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - //0x0430: ..$. .... .... .... - 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x44, 0x3a, 0x00, 0x00, 0x00, - //0x0440: .... .... ...D :... + 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x0d, 0x0a, 0x0d, 0x0a, 0x24, 0x10, 0x12, 0x12, 0x11, 0x10, + //0x0420: ... ..$. .... + 0x10, 0x10, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, + //0x0430: .... .... .... .... + 0x02, 0x02, 0x02, 0x44, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + //0x0440: ...D :... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0450: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0460: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x02, 0x04, + 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x02, 0x04, 0x01, 0x0a, 0x09, 0x08, 0x06, 0x0b, 0x04, 0x07, //0x0470: .... .... .... .... - 0x01, 0x0a, 0x09, 0x08, 0x06, 0x0b, 0x04, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0480: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0490: .... .... .... .... @@ -3320,9 +3220,7 @@ void DreamGenContext::__start() { //0x04e0: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x04f0: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, - //0x0500: .... .... .... .... - 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, }; + 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, }; ds.assign(src, src + sizeof(src)); dreamweb(); } diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 05e7c856df..94826e8433 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -32,11 +32,9 @@ namespace DreamGen { -static const uint16 offset_money1poke = 0x0426; static const uint16 offset_operand1 = 0x03fc; -static const uint16 offset_rootdir = 0x040a; static const uint16 offset_keys = 0x0392; -static const uint16 offset_money2poke = 0x042b; +static const uint16 offset_rootdir = 0x040a; static const uint16 kStartvars = 0; static const uint16 kProgresspoints = 1; static const uint16 kWatchon = 2; @@ -365,14 +363,14 @@ static const uint16 kRoomssample = 443; static const uint16 kReelroutines = 444; static const uint16 kBasicsample = 901; static const uint16 kCurrentfile = 1048; -static const uint16 kRoomscango = 1131; -static const uint16 kRoompics = 1147; -static const uint16 kOplist = 1162; -static const uint16 kInputline = 1165; -static const uint16 kPresslist = 1293; -static const uint16 kQuitrequested = 1299; -static const uint16 kSubtitles = 1300; -static const uint16 kForeignrelease = 1301; +static const uint16 kRoomscango = 1123; +static const uint16 kRoompics = 1139; +static const uint16 kOplist = 1154; +static const uint16 kInputline = 1157; +static const uint16 kPresslist = 1285; +static const uint16 kQuitrequested = 1291; +static const uint16 kSubtitles = 1292; +static const uint16 kForeignrelease = 1293; static const uint16 kBlocktextdat = (0); static const uint16 kPersonframes = (0); static const uint16 kDebuglevel1 = (0); @@ -480,8 +478,6 @@ public: void getObTextStart(); void checkObjectSize(); void fillOpen(); - void useCashCard(); - void moneyPoke(); void doSomeTalk(); void resetLocation(); void adjustUp(); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 741abd807f..ab09fd3ace 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -394,5 +394,6 @@ void useGun(); void identifyOb(); void showSlots(); + void useCashCard(); #endif diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp index 385bfbb101..6b59faf401 100644 --- a/engines/dreamweb/use.cpp +++ b/engines/dreamweb/use.cpp @@ -1613,4 +1613,33 @@ void DreamGenContext::notHeldError() { putBackObStuff(); } +void DreamGenContext::useCashCard() { + getRidOfReels(); + loadKeypad(); + createPanel(); + showPanel(); + showExit(); + showMan(); + uint16 y = (!data.byte(kForeignrelease)) ? 120 : 120 - 3; + showFrame(tempGraphics(), 114, y, 39, 0); + const uint8 *obText = getObTextStartCPP(); + findNextColon(&obText); + findNextColon(&obText); + y = 98; + printDirect(&obText, 36, &y, 36, 36 & 1); + char amountStr[10]; + sprintf(amountStr, "%04d", data.word(kCard1money) / 10); + data.word(kCharshift) = 91 * 2 + 75; + printDirect((const uint8 *)amountStr, 160, 155, 240, 240 & 1); + sprintf(amountStr, "%02d", (data.word(kCard1money) % 10) * 10); + data.word(kCharshift) = 91 * 2 + 85; + printDirect((const uint8 *)amountStr, 187, 155, 240, 240 & 1); + data.word(kCharshift) = 0; + workToScreenM(); + hangOnP(400); + getRidOfTemp(); + restoreReels(); + putBackObStuff(); +} + } // End of namespace DreamGen -- cgit v1.2.3 From 29a20ed7dddb178eecfbcc4b7db11364c2c30606 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 17 Dec 2011 09:05:09 +1100 Subject: TSAGE: Implemented R2R Scene 850 - Deck #5 By Lift --- engines/tsage/events.h | 4 +- engines/tsage/ringworld2/ringworld2_logic.cpp | 7 +- engines/tsage/ringworld2/ringworld2_scenes0.cpp | 176 +++++++++++++++++++++++- engines/tsage/ringworld2/ringworld2_scenes0.h | 39 ++++++ 4 files changed, 221 insertions(+), 5 deletions(-) (limited to 'engines') diff --git a/engines/tsage/events.h b/engines/tsage/events.h index ecc710ed99..303c2201ea 100644 --- a/engines/tsage/events.h +++ b/engines/tsage/events.h @@ -85,8 +85,8 @@ enum CursorType { // Ringworld 2 objects R2_OPTO_DISK = 1, R2_READER = 2, R2_NEGATOR_GUN = 3, R2_STEPPING_DISKS = 4, R2_ATTRACTOR_UNIT = 5, R2_SENSOR_PROBE = 6, - R2_7 = 7, R2_8 = 8, R2_9 = 9, R2_10 = 10, R2_11 = 11, R2_12 = 12, R2_13 = 13, R2_14 = 14, - R2_15 = 15, R2_16 = 16, R2_17 = 17, R2_18 = 18, R2_19 = 19, R2_20 = 20, R2_21 = 21, + R2_7 = 7, R2_8 = 8, R2_9 = 9, R2_10 = 10, R2_11 = 11, R2_12 = 12, R2_13 = 13, R2_OPTICAL_FIBRE = 14, + R2_CLAMP = 15, R2_16 = 16, R2_17 = 17, R2_18 = 18, R2_19 = 19, R2_20 = 20, R2_21 = 21, R2_22 = 22, R2_23 = 23, R2_24 = 24, R2_25 = 25, R2_26 = 26, R2_27 = 27, R2_28 = 28, R2_29 = 29, R2_30 = 30, R2_31 = 31, R2_32 = 32, R2_33 = 33, R2_34 = 34, R2_35 = 35, R2_36 = 36, R2_37 = 37, R2_38 = 38, R2_39 = 39, R2_40 = 40, R2_41 = 41, R2_42 = 42, diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index a33a9a5e9e..201b44eeef 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -77,7 +77,10 @@ Scene *Ringworld2Game::createScene(int sceneNumber) { case 700: case 800: case 825: + error("Missing scene %d from group 0", sceneNumber); case 850: + // Deck #5 - By Lift + return new Scene850(); case 900: error("Missing scene %d from group 0", sceneNumber); /* Scene group #1 */ @@ -607,8 +610,8 @@ void Ringworld2InvObjectList::reset() { setObjectScene(R2_11, 400); setObjectScene(R2_12, 500); setObjectScene(R2_13, 1550); - setObjectScene(R2_14, 850); - setObjectScene(R2_15, 850); + setObjectScene(R2_OPTICAL_FIBRE, 850); + setObjectScene(R2_CLAMP, 850); setObjectScene(R2_16, 0); setObjectScene(R2_17, 1550); setObjectScene(R2_18, 1550); diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index 1c25c896a6..7a3b0cdd78 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -1701,7 +1701,7 @@ void Scene250::signal() { R2_GLOBALS._sceneManager.changeScene(139); break; case 91: - R2_GLOBALS._sceneManager.changeScene(91); + R2_GLOBALS._sceneManager.changeScene(850); break; default: break; @@ -2900,6 +2900,180 @@ void Scene400::dispatch() { } } +/*-------------------------------------------------------------------------- + * Scene 850 - Deck #5 - By Lift + * + *--------------------------------------------------------------------------*/ + +bool Scene850::Indicator::startAction(CursorType action, Event &event) { + Scene850 *scene = (Scene850 *)R2_GLOBALS._sceneManager._scene; + + if ((action != CURSOR_USE) || (R2_INVENTORY.getObjectScene(R2_OPTICAL_FIBRE) != 850)) + return NamedHotspot::startAction(action, event); + else { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 851; + scene->setAction(&scene->_sequenceManager1, scene, 851, &R2_GLOBALS._player, &scene->_fibre, NULL); + return true; + } +} + +/*--------------------------------------------------------------------------*/ + +bool Scene850::LiftDoor::startAction(CursorType action, Event &event) { + Scene850 *scene = (Scene850 *)R2_GLOBALS._sceneManager._scene; + + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + else { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 202; + scene->setAction(&scene->_sequenceManager1, scene, 202, &R2_GLOBALS._player, this, NULL); + return true; + } +} + +bool Scene850::SickBayDoor::startAction(CursorType action, Event &event) { + Scene850 *scene = (Scene850 *)R2_GLOBALS._sceneManager._scene; + + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + else { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 204; + scene->setAction(&scene->_sequenceManager1, scene, 204, &R2_GLOBALS._player, this, NULL); + return true; + } +} + +bool Scene850::Clamp::startAction(CursorType action, Event &event) { + Scene850 *scene = (Scene850 *)R2_GLOBALS._sceneManager._scene; + + if (!R2_GLOBALS.getFlag(7)) + return false; + else if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + else { + R2_GLOBALS._player.disableControl(); + scene->_object1.postInit(); + scene->_sceneMode = 850; + scene->setAction(&scene->_sequenceManager1, scene, 850, &R2_GLOBALS._player, this, &scene->_object1, NULL); + return true; + } +} + +bool Scene850::Panel::startAction(CursorType action, Event &event) { + Scene850 *scene = (Scene850 *)R2_GLOBALS._sceneManager._scene; + + if ((action != CURSOR_USE) || R2_GLOBALS.getFlag(7)) + return SceneActor::startAction(action, event); + else { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 852; + scene->setAction(&scene->_sequenceManager1, scene, 852, &R2_GLOBALS._player, this, &scene->_object1, NULL); + return true; + } +} + +/*--------------------------------------------------------------------------*/ + +void Scene850::postInit(SceneObjectList *OwnerList) { + SceneExt::postInit(); + loadScene(850); + + _liftDoor.postInit(); + _liftDoor.setup(850, 2, 1); + _liftDoor.setPosition(Common::Point(188, 79)); + _liftDoor.setDetails(850, 3, -1, -1, 1, NULL); + + _sickBayDoor.postInit(); + _sickBayDoor.setup(850, 3, 1); + _sickBayDoor.setPosition(Common::Point(62, 84)); + _sickBayDoor.setDetails(850, 9, -1, -1, 1, NULL); + + if (R2_INVENTORY.getObjectScene(R2_CLAMP) == 850) { + _clamp.postInit(); + _clamp.setup(850, 5, 1); + _clamp.setPosition(Common::Point(242, 93)); + _clamp.fixPriority(81); + _clamp.animate(ANIM_MODE_2, NULL); + _clamp.setDetails(850, 27, -1, -1, 1, NULL); + } + + _panel.postInit(); + _panel.setVisage(850); + + if (R2_GLOBALS.getFlag(7)) + _panel.setFrame(7); + + _panel.setPosition(Common::Point(232, 119)); + _panel.fixPriority(82); + _panel.setDetails(850, 24, -1, -1, 1, NULL); + + if (R2_INVENTORY.getObjectScene(R2_OPTICAL_FIBRE) == 850) { + _fibre.postInit(); + _fibre.setup(850, 6, 1); + _fibre.setPosition(Common::Point(280, 87)); + } + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.setVisage(10); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player.disableControl(); + + _eastDoor.setDetails(Rect(289, 53, 315, 125), 850, 6, -1, 8, 1, NULL); + _indicator.setDetails(Rect(275, 67, 286, 79), 850, 18, -1, 20, 1, NULL); + _sickBayIndicator.setDetails(Rect(41, 51, 48, 61), 850, 15, -1, -1, 1, NULL); + _liftControls.setDetails(Rect(156, 32, 166, 44), 850, 21, -1, -1, 1, NULL); + _compartment.setDetails(Rect(4, 88, 153, 167), 850, 12, -1, -1, 1, NULL); + _background.setDetails(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 850, 0, -1, -1, 1, NULL); + + switch (R2_GLOBALS._sceneManager._previousScene) { + case 250: + _sceneMode = 203; + setAction(&_sequenceManager1, this, 203, &R2_GLOBALS._player, &_liftDoor, NULL); + break; + case 800: + _sceneMode = 205; + setAction(&_sequenceManager1, this, 205, &R2_GLOBALS._player, &_sickBayDoor, NULL); + break; + default: + R2_GLOBALS._player.setStrip(3); + R2_GLOBALS._player.setPosition(Common::Point(215, 115)); + R2_GLOBALS._player.enableControl(); + break; + } +} + +void Scene850::signal() { + switch (_sceneMode) { + case 202: + R2_GLOBALS._sceneManager.changeScene(250); + break; + case 204: + R2_GLOBALS._sceneManager.changeScene(800); + break; + case 850: + R2_INVENTORY.setObjectScene(R2_CLAMP, 1); + _clamp.remove(); + _object1.remove(); + R2_GLOBALS._player.enableControl(); + break; + case 851: + R2_INVENTORY.setObjectScene(R2_OPTICAL_FIBRE, 1); + _fibre.remove(); + R2_GLOBALS._player.enableControl(); + break; + case 852: + R2_GLOBALS.setFlag(7); + R2_GLOBALS._player.enableControl(); + break; + default: + R2_GLOBALS._player.enableControl(); + break; + } +} + } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.h b/engines/tsage/ringworld2/ringworld2_scenes0.h index a0c3f92668..5f2d768f90 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.h +++ b/engines/tsage/ringworld2/ringworld2_scenes0.h @@ -370,6 +370,45 @@ public: virtual void dispatch(); }; +class Scene850: public SceneExt { + /* Items */ + class Indicator: public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + /* Objects */ + class LiftDoor: public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class SickBayDoor: public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Clamp: public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Panel: public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; +public: + NamedHotspot _background, _eastDoor, _compartment, _sickBayIndicator; + NamedHotspot _liftControls; + Indicator _indicator; + SceneActor _object1, _fibre; + LiftDoor _liftDoor; + SickBayDoor _sickBayDoor; + Clamp _clamp; + Panel _panel; + SequenceManager _sequenceManager1; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); +}; + } // End of namespace Ringworld2 } // End of namespace TsAGE -- cgit v1.2.3 From b371c46af9d5dd7e1282a9e227a853e0d2054fb2 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 17 Dec 2011 00:41:30 +0200 Subject: DREAMWEB: Port 'checkinside' to C++ --- engines/dreamweb/dreamgen.cpp | 21 --------------------- engines/dreamweb/dreamgen.h | 1 - engines/dreamweb/stubs.cpp | 14 ++++++++++++++ engines/dreamweb/stubs.h | 2 ++ engines/dreamweb/use.cpp | 12 ++---------- 5 files changed, 18 insertions(+), 32 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 47b01d3785..0a891cb1cf 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -2837,27 +2837,6 @@ doselob: useRoutine(); } -void DreamGenContext::checkInside() { - STACK_CHECK; - es = data.word(kExtras); - bx = (0+2080+30000); - cl = 0; -insideloop: - _cmp(al, es.byte(bx+3)); - if (!flags.z()) - goto notfoundinside; - _cmp(ah, es.byte(bx+2)); - if (!flags.z()) - goto notfoundinside; - return; -notfoundinside: - _add(bx, 16); - _inc(cl); - _cmp(cl, (114)); - if (!flags.z()) - goto insideloop; -} - void DreamGenContext::showDiaryKeys() { STACK_CHECK; _cmp(data.byte(kPresscount), 0); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 94826e8433..86768e6cca 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -525,7 +525,6 @@ public: void locationPic(); void swapWithOpen(); void dreamweb(); - void checkInside(); void findPathOfPoint(); void getDestInfo(); void read(); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index fb5fba8d9c..376a681604 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -1794,6 +1794,20 @@ bool DreamGenContext::isRyanHolding(const char *id) { return false; } +void DreamGenContext::checkInside() { + cl = checkInside(al, ah); +} + +uint16 DreamGenContext::checkInside(uint16 command, uint16 type) { + for (uint16 index = 0; index < kNumexobjects; index++) { + DynObject *object = getExAd(index); + if (object->mapad[1] == command && object->mapad[0] == type) + return index; + } + + return kNumexobjects; +} + bool DreamBase::isItDescribed(const ObjPos *pos) { uint16 offset = getSegment(data.word(kSetdesc)).word(kSettextdat + pos->index * 2); uint8 result = getSegment(data.word(kSetdesc)).byte(kSettext + offset); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index ab09fd3ace..27a5cee9c5 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -395,5 +395,7 @@ void identifyOb(); void showSlots(); void useCashCard(); + void checkInside(); + uint16 checkInside(uint16 command, uint16 type); #endif diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp index 6b59faf401..b4e7efdb4f 100644 --- a/engines/dreamweb/use.cpp +++ b/engines/dreamweb/use.cpp @@ -994,11 +994,7 @@ void DreamGenContext::useObject() { } void DreamGenContext::useWinch() { - al = 40; - ah = 1; - checkInside(); - - if (cl == kNumexobjects || !compare(cl, 4, "FUSE")) { + if (checkInside(40, 1) == kNumexobjects || !compare(cl, 4, "FUSE")) { // No winch showFirstUse(); putBackObStuff(); @@ -1244,11 +1240,7 @@ void DreamGenContext::hotelControl() { } void DreamGenContext::useCooker() { - al = data.byte(kCommand); - ah = data.byte(kObjecttype); - checkInside(); - - if (cl == 114) + if (checkInside(data.byte(kCommand), data.byte(kObjecttype)) == kNumexobjects) showFirstUse(); else showSecondUse(); // Food inside -- cgit v1.2.3 From b289533e4d972c68391bd3d84c3b87ad20f08c52 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 17 Dec 2011 01:39:29 +0200 Subject: DREAMWEB: Fix regression in identifyOb --- engines/dreamweb/object.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index 64f70ada98..747b7934b4 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -313,9 +313,15 @@ void DreamGenContext::openOb() { } void DreamGenContext::identifyOb() { - if (data.word(kWatchingtime) != 0 || - data.word(kMousex) - data.word(kMapadx) >= 22 * 8 || - data.word(kMousey) - data.word(kMapady) >= 20 * 8) { + if (data.word(kWatchingtime) != 0) { + blank(); + return; + } + + ax = data.word(kMousex) - data.word(kMapadx); + bx = data.word(kMousey) - data.word(kMapady); + + if (ax >= 22 * 8 || bx >= 20 * 8) { blank(); return; } @@ -325,8 +331,6 @@ void DreamGenContext::identifyOb() { push(ax); findPathOfPoint(); data.byte(kPointerspath) = dl; - ax = pop(); - push(ax); findFirstPath(); data.byte(kPointerfirstpath) = al; ax = pop(); -- cgit v1.2.3 From f9d4886e50dc87535c34ec7c12c1e53fed3a3910 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 17 Dec 2011 02:04:31 +0200 Subject: DREAMWEB: Port 'usestereo' to C++ --- engines/dreamweb/dreamgen.cpp | 62 ------------------------------------------- engines/dreamweb/dreamgen.h | 1 - engines/dreamweb/stubs.h | 1 + engines/dreamweb/use.cpp | 30 +++++++++++++++++++++ 4 files changed, 31 insertions(+), 63 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 0a891cb1cf..939e8c0127 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -2736,68 +2736,6 @@ lookcolon: goto lookcolon; } -void DreamGenContext::useStereo() { - STACK_CHECK; - _cmp(data.byte(kLocation), 0); - if (flags.z()) - goto stereook; - cx = 400; - al = 4; - showPuzText(); - putBackObStuff(); - return; -stereook: - _cmp(data.byte(kMapx), 11); - if (!flags.z()) - goto stereonotok; - _cmp(data.byte(kMapy), 0); - if (flags.z()) - goto stereook2; -stereonotok: - cx = 400; - al = 5; - showPuzText(); - putBackObStuff(); - return; -stereook2: - al = 'C'; - ah = 'D'; - cl = 'P'; - ch = 'L'; - findSetObject(); - ah = 1; - checkInside(); - _cmp(cl, (114)); - if (!flags.z()) - goto cdinside; - al = 6; - cx = 400; - showPuzText(); - putBackObStuff(); - getAnyAd(); - al = 255; - es.byte(bx+10) = al; - return; -cdinside: - getAnyAd(); - al = es.byte(bx+10); - _xor(al, 1); - es.byte(bx+10) = al; - _cmp(al, 255); - if (flags.z()) - goto stereoon; - al = 7; - cx = 400; - showPuzText(); - putBackObStuff(); - return; -stereoon: - al = 8; - cx = 400; - showPuzText(); - putBackObStuff(); -} - void DreamGenContext::selectOb() { STACK_CHECK; findInvPos(); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 86768e6cca..28711bb1ba 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -518,7 +518,6 @@ public: void getEitherAd(); void setPickup(); void dropObject(); - void useStereo(); void showDiaryKeys(); void useOpened(); void signOn(); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 27a5cee9c5..b2417e767b 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -395,6 +395,7 @@ void identifyOb(); void showSlots(); void useCashCard(); + void useStereo(); void checkInside(); uint16 checkInside(uint16 command, uint16 type); diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp index b4e7efdb4f..4be3c7a6b3 100644 --- a/engines/dreamweb/use.cpp +++ b/engines/dreamweb/use.cpp @@ -1634,4 +1634,34 @@ void DreamGenContext::useCashCard() { putBackObStuff(); } +void DreamGenContext::useStereo() { + if (data.byte(kLocation) != 0) { + showPuzText(4, 400); + putBackObStuff(); + } else if (data.byte(kMapx) != 11) { + showPuzText(5, 400); + putBackObStuff(); + } else if (checkInside(findSetObject("CDPL"), 1) == kNumexobjects) { + // No CD inside + showPuzText(6, 400); + putBackObStuff(); + // TODO: Use the C++ version of getAnyAd() + getAnyAd(); + es.byte(bx + 10) = 255; + } else { + // CD inside + getAnyAd(); + es.byte(bx + 10) ^= 1; + if (es.byte(bx + 10) != 255) { + // Stereo off + showPuzText(7, 400); + } else { + // Stereo on + showPuzText(8, 400); + } + + putBackObStuff(); + } +} + } // End of namespace DreamGen -- cgit v1.2.3 From 114e857d78536d5a19d2b37855d67522d5b00e6e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 17 Dec 2011 02:03:36 +0100 Subject: TSAGE: R2R - Implement scene 2800 --- engines/tsage/ringworld2/ringworld2_logic.cpp | 2 + engines/tsage/ringworld2/ringworld2_scenes2.cpp | 383 +++++++++++++++++++++++ engines/tsage/ringworld2/ringworld2_scenes2.h | 41 +++ engines/tsage/ringworld2/ringworld2_speakers.cpp | 124 ++++++++ engines/tsage/ringworld2/ringworld2_speakers.h | 24 ++ 5 files changed, 574 insertions(+) (limited to 'engines') diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index 201b44eeef..3854a37384 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -162,6 +162,8 @@ Scene *Ringworld2Game::createScene(int sceneNumber) { // Forest Maze return new Scene2750(); case 2800: + // Exiting Forest + return new Scene2800(); case 2900: error("Missing scene %d from group 2", sceneNumber); /* Scene group #3 */ diff --git a/engines/tsage/ringworld2/ringworld2_scenes2.cpp b/engines/tsage/ringworld2/ringworld2_scenes2.cpp index 107d7bad04..a61ff6ac9a 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes2.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes2.cpp @@ -4162,5 +4162,388 @@ void Scene2750::process(Event &event) { Scene::process(event); } +/*-------------------------------------------------------------------------- + * Scene 2800 - Exiting forest + * + *--------------------------------------------------------------------------*/ +Scene2800::Scene2800(): SceneExt() { + _field412 = 0; +} + +void Scene2800::synchronize(Serializer &s) { + SceneExt::synchronize(s); + + s.syncAsSint16LE(_field412); +} + +bool Scene2800::Item2::startAction(CursorType action, Event &event) { + Scene2800 *scene = (Scene2800 *)R2_GLOBALS._sceneManager._scene; + + if ((action == CURSOR_USE) && (R2_GLOBALS.getFlag(47))) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 2805; + scene->setAction(&scene->_sequenceManager, scene, 2805, &R2_GLOBALS._player, NULL); + return true; + } else + return SceneHotspot::startAction(action, event); +} + +bool Scene2800::Actor1::startAction(CursorType action, Event &event) { + Scene2800 *scene = (Scene2800 *)R2_GLOBALS._sceneManager._scene; + + if (action == CURSOR_TALK) { + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + R2_GLOBALS.setFlag(47); + scene->_field412 = 1205; + scene->_sceneMode = 2803; + scene->_stripManager.start(scene->_field412, scene); + return true; + } else if (action == R2_7) { + R2_GLOBALS._events.setCursor(CURSOR_ARROW); + R2_GLOBALS._player.disableControl(); + R2_GLOBALS.setFlag(47); + scene->_sceneMode = 10; + scene->setAction(&scene->_sequenceManager, scene, 2802, &R2_GLOBALS._player, &scene->_actor2, &scene->_actor1, NULL); + return true; + } else + return SceneActor::startAction(action, event); +} + +void Scene2800::Action1::signal() { + Scene2800 *scene = (Scene2800 *)R2_GLOBALS._sceneManager._scene; + + if (R2_GLOBALS._player._position.x <= 320) { + setDelay(120); + Common::Point pt(330, 25); + NpcMover *mover = new NpcMover(); + scene->_object1.addMover(mover, &pt, NULL); + } else { + setDelay(1800 + R2_GLOBALS._randomSource.getRandomNumber(600)); + scene->_object1.setPosition(Common::Point(-10, 45)); + } +} + +void Scene2800::Action2::signal() { + Scene2800 *scene = (Scene2800 *)R2_GLOBALS._sceneManager._scene; + + switch (_actionIndex++) { + case 0: + setDelay(240); + R2_GLOBALS._sound1.changeSound(240); + R2_GLOBALS._sound2.stop(); + break; + case 1: + scene->_object2.postInit(); + scene->_object2.setVisage(2800); + scene->_object2.setStrip(1); + scene->_object2._numFrames = 8; + scene->_object2._moveRate = 8; + scene->_object2.changeZoom(100); + scene->_object2.setPosition(Common::Point(1, 1)); + scene->_object2.show(); + scene->_object2.animate(ANIM_MODE_5, this); + break; + case 2: + R2_GLOBALS._sound2.play(130); + scene->_object2.setVisage(2800); + scene->_object2.setStrip(7); + + scene->_object3.postInit(); + scene->_object3.setVisage(2800); + scene->_object3.setStrip(3); + scene->_object3._numFrames = 8; + scene->_object3._moveRate = 8; + scene->_object3.changeZoom(100); + scene->_object3.setPosition(Common::Point(300, 104)); + scene->_object3.show(); + scene->_object3.animate(ANIM_MODE_5, this); + break; + case 3: + R2_GLOBALS._sound1.play(241); + scene->_object4.postInit(); + scene->_object4.setVisage(2800); + scene->_object4.setStrip(2); + scene->_object4._numFrames = 4; + scene->_object4._moveRate = 4; + scene->_object4.changeZoom(100); + scene->_object4.setPosition(Common::Point(300, 104)); + scene->_object4.fixPriority(105); + scene->_object4.show(); + scene->_object4.animate(ANIM_MODE_5, this); + break; + case 4: + setDelay(18); + scene->_object4.setStrip(4); + scene->_actor1.setVisage(2800); + scene->_actor1.setStrip(5); + scene->_actor1.setFrame(1); + scene->_actor1._numFrames = 5; + scene->_actor1._moveRate = 5; + scene->_actor1.setPosition(Common::Point(300, 104)); + scene->_actor1.fixPriority(110); + scene->_actor1.changeZoom(100); + scene->_actor1.show(); + break; + case 5: + scene->_actor1.animate(ANIM_MODE_5, this); + break; + case 6: { + scene->_actor1.changeZoom(-1); + scene->_actor1.setVisage(3107); + scene->_actor1.animate(ANIM_MODE_1, NULL); + scene->_actor1.setStrip(3); + scene->_actor1.setPosition(Common::Point(297, 140)); + scene->_actor1._numFrames = 10; + scene->_actor1._moveRate = 10; + scene->_actor1._moveDiff = Common::Point(3, 2); + + Common::Point pt(297, 160); + NpcMover *mover = new NpcMover(); + scene->_actor1.addMover(mover, &pt, this); + break; + } + case 7: { + scene->_actor1.changeZoom(75); + scene->_actor1.updateAngle(R2_GLOBALS._player._position); + + Common::Point pt(105, 82); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + break; + } + case 8: { + R2_GLOBALS._player._numFrames = 8; + R2_GLOBALS._player._moveRate = 8; + R2_GLOBALS._player.animate(ANIM_MODE_2, NULL); + R2_GLOBALS._player.setObjectWrapper(NULL); + R2_GLOBALS._player.setStrip(2); + R2_GLOBALS._player.changeZoom(-1); + + Common::Point pt(79, 100); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + break; + } + case 9: { + R2_GLOBALS._player._numFrames = 10; + R2_GLOBALS._player._moveRate = 10; + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper()); + + Common::Point pt(100, 64); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + break; + } + case 10: { + R2_GLOBALS._player.fixPriority(124); + R2_GLOBALS._player._moveDiff = Common::Point(3, 2); + + Common::Point pt(160, 124); + PlayerMover *mover = new PlayerMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + break; + } + case 11: { + R2_GLOBALS._player.fixPriority(-1); + + Common::Point pt(160, 160); + PlayerMover *mover = new PlayerMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + break; + } + case 12: { + Common::Point pt(270, 160); + PlayerMover *mover = new PlayerMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + break; + } + case 13: + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + scene->_field412 = 1207; + scene->_stripManager.start(scene->_field412, this); + break; + case 14: { + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._player.fixPriority(110); + + Common::Point pt(288, 140); + PlayerMover *mover = new PlayerMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + break; + } + case 15: + setDelay(18); + scene->_actor1.updateAngle(R2_GLOBALS._player._position); + R2_GLOBALS._player.setVisage(2800); + R2_GLOBALS._player.setStrip(6); + R2_GLOBALS._player.setFrame(1); + R2_GLOBALS._player.changeZoom(100); + R2_GLOBALS._player.setPosition(Common::Point(300, 104)); + R2_GLOBALS._player._numFrames = 5; + R2_GLOBALS._player._moveRate = 5; + break; + case 16: + R2_GLOBALS._player.animate(ANIM_MODE_5, this); + break; + case 17: + setDelay(6); + scene->_object4.setStrip(2); + scene->_object4.setFrame(11); + R2_GLOBALS._player.hide(); + // No break on purpose + case 18: + R2_GLOBALS._sound1.play(241); + scene->_object4.animate(ANIM_MODE_6, this); + break; + case 19: + scene->_object4.remove(); + scene->_object3.animate(ANIM_MODE_6, this); + break; + case 20: + setDelay(6); + scene->_object3.remove(); + scene->_object2.setStrip(1); + scene->_object2.setFrame(19); + break; + case 21: + setDelay(150); + R2_GLOBALS._sound1.play(269); + R2_GLOBALS._sound2.stop(); + break; + case 22: + scene->_sceneMode = 12; + scene->_object2.animate(ANIM_MODE_6, scene); + break; + default: + break; + } +} + +void Scene2800::postInit(SceneObjectList *OwnerList) { + loadScene(2800); + setZoomPercents(100, 50, 124, 75); + R2_GLOBALS._sound1.stop(); + R2_GLOBALS._sound2.stop(); + SceneExt::postInit(); + + _object1.postInit(); + _object1.setup(2750, 4, 1); + _object1.setPosition(Common::Point(-10, 25)); + _object1.animate(ANIM_MODE_1, NULL); + _object1.setStrip2(4); + _object1._moveRate = 20; + _object1.setAction(&_action1); + + _actor3.postInit(); + _actor3.setup(2802, 1, 1); + _actor3.setPosition(Common::Point(116, 80)); + _actor3.fixPriority(111); + _actor3.animate(ANIM_MODE_2, NULL); + _actor3._numFrames = 6; + + if (!R2_GLOBALS.getFlag(47)) { + _actor1.postInit(); + _actor1.setVisage(3105); + _actor1.setStrip(3); + _actor1.setFrame(1); + _actor1.setZoom(50); + _actor1._moveDiff = Common::Point(2, 1); + _actor1.setPosition(Common::Point(122, 82)); + _actor1.animate(ANIM_MODE_NONE, NULL); + _actor1.setDetails(2800, -1, -1, -1, 1, NULL); + } + + _item1.setDetails(Rect(0, 0, 320, 200), 2800, -1, -1, -1, 1, NULL); + + _stripManager.setColors(60, 255); + _stripManager.setFontNumber(3); + _stripManager.addSpeaker(&_quinnSpeaker); + _stripManager.addSpeaker(&_nejSpeaker); + _stripManager.addSpeaker(&_guardSpeaker); + + if (R2_INVENTORY.getObjectScene(36) == 0) { + R2_GLOBALS._sound1.fadeSound(237); + if (R2_GLOBALS.getFlag(47)) { + _item2.setDetails(Rect(76, 45, 155, 90), 2800, 3, -1, -1, 2, NULL); + } else { + _actor2.postInit(); + _actor2.setup(2752, 5, 1); + _actor2.animate(ANIM_MODE_NONE, NULL); + _actor2.changeZoom(100); + _actor2._moveDiff = Common::Point(2, 1); + _actor2.setPosition(Common::Point(101, 148)); + } + } + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.setVisage(19); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player.changeZoom(100); + R2_GLOBALS._player._moveDiff = Common::Point(2, 2); + R2_GLOBALS._player.disableControl(); + + if (R2_INVENTORY.getObjectScene(36) == 0) { + R2_GLOBALS._player.setAction(&_sequenceManager, this, 2800, &R2_GLOBALS._player, NULL); + } else if (R2_GLOBALS.getFlag(47)) { + R2_GLOBALS._player.setVisage(3110); + R2_GLOBALS._player.changeZoom(-1); + R2_GLOBALS._player._moveDiff = Common::Point(3, 2); + R2_GLOBALS._player.setPosition(Common::Point(160, 124)); + R2_GLOBALS._player.enableControl(); + } else { + _sceneMode = 2801; + R2_GLOBALS._player.setAction(&_sequenceManager, this, 2801, &R2_GLOBALS._player, &_actor2, &_actor1, NULL); + } +} + +void Scene2800::signal() { + switch (_sceneMode) { + case 10: + R2_GLOBALS._sound1.play(238); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + _field412 = 1206; + _sceneMode = 2804; + _stripManager.start(_field412, this); + break; + case 11: + _actor2.remove(); + _object1.setAction(NULL); + R2_GLOBALS._player.enableControl(CURSOR_ARROW); + R2_GLOBALS._player._moveDiff = Common::Point(3, 2); + _item2.setDetails(Rect(76, 45, 155, 90), 2800, 3, -1, -1, 2, NULL); + break; + case 12: + R2_GLOBALS._sound1.fadeOut2(NULL); + R2_GLOBALS._sound2.fadeOut2(NULL); + g_globals->_sceneManager.changeScene(1000); + break; + case 2800: + g_globals->_sceneManager.changeScene(2750); + break; + case 2801: + R2_GLOBALS._player.enableControl(CURSOR_ARROW); + R2_GLOBALS._player._canWalk = false; + break; + case 2803: + R2_GLOBALS._player.disableControl(); + _sceneMode = 10; + setAction(&_sequenceManager, this, 2803, &R2_GLOBALS._player, &_actor2, &_actor1, NULL); + break; + case 2804: + R2_GLOBALS._player.disableControl(); + _sceneMode = 11; + setAction(&_sequenceManager, this, 2804, &R2_GLOBALS._player, &_actor2, NULL); + break; + case 2805: + _object1.remove(); + setAction(&_action2); + break; + default: + break; + } +} + } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_scenes2.h b/engines/tsage/ringworld2/ringworld2_scenes2.h index 9b2a8685fc..2097465a48 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes2.h +++ b/engines/tsage/ringworld2/ringworld2_scenes2.h @@ -624,6 +624,47 @@ public: virtual void process(Event &event); }; +class Scene2800 : public SceneExt { + class Item2 : public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + class Actor1 : public SceneActor { + virtual bool startAction(CursorType action, Event &event); + }; + + class Action1: public Action { + public: + void signal(); + }; + class Action2: public Action { + public: + void signal(); + }; +public: + SpeakerQuinn2800 _quinnSpeaker; + SpeakerNej2800 _nejSpeaker; + SpeakerGuard2800 _guardSpeaker; + NamedHotspot _item1; + Item2 _item2; + Actor1 _actor1; + SceneActor _actor2; + SceneActor _actor3; + SceneObject _object1; + Action1 _action1; + Action2 _action2; + SceneObject _object2; + SceneObject _object3; + SceneObject _object4; + SequenceManager _sequenceManager; + int _field412; + + Scene2800(); + virtual void synchronize(Serializer &s); + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); +}; } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_speakers.cpp b/engines/tsage/ringworld2/ringworld2_speakers.cpp index 7a3871f9ac..35de45d8e6 100644 --- a/engines/tsage/ringworld2/ringworld2_speakers.cpp +++ b/engines/tsage/ringworld2/ringworld2_speakers.cpp @@ -915,5 +915,129 @@ void SpeakerNej2750::proc15() { _object1.animate(ANIM_MODE_5, this); } } + +SpeakerQuinn2800::SpeakerQuinn2800() { + _speakerName = "QUINN"; + _color1 = 60; + _color2 = 0; + _fieldF6 = 0; + _textWidth = 300; + _hideObjects = false; + _object2 = NULL; + _displayMode = 1; + _numFrames = 0; +} + +void SpeakerQuinn2800::proc15() { + int v = _fieldF6; + + if (!_object2) { + _object2 = &R2_GLOBALS._player; + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + if (v == 0) { + _object1.animate(ANIM_MODE_2, NULL); + } else { + ((SceneItem *)_action)->_sceneRegionId = 0; + switch (_object2->_visage) { + case 16: + _object1.setZoom(75); + _object1.setup(4023, 5, 1); + break; + case 19: + _object1.setup(4023, 1, 1); + break; + case 3110: + _object1.setZoom(75); + if (_object2->_strip == 1) + _object1.setup(4061 , 1, 1); + else + _object1.setup(4061 , 3, 1); + break; + default: + break; + } + _object1.animate(ANIM_MODE_5, this); + } +} + +SpeakerNej2800::SpeakerNej2800() { + _speakerName = "NEJ"; + _color1 = 171; + _color2 = 0; + _fieldF6 = 0; + _textWidth = 300; + _hideObjects = false; + _object2 = NULL; + _displayMode = 1; + _numFrames = 0; +} + +void SpeakerNej2800::proc15() { + int v = _fieldF6; + Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene; + + if (!_object2) { + _object2 = &scene->_actor2; + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + if (v == 0) { + _object1.animate(ANIM_MODE_2, NULL); + } else { + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4023, 3, 1); + if (_object2->_visage == 2801) + _object1.setPosition(Common::Point(R2_GLOBALS._player._position.x - 12, R2_GLOBALS._player._position.y)); + _object1.animate(ANIM_MODE_5, this); + } +} + +SpeakerGuard2800::SpeakerGuard2800() { + _speakerName = "GUARD"; + _color1 = 5; + _color2 = 0; + _fieldF6 = 0; + _textWidth = 300; + _hideObjects = false; + _object2 = NULL; + _displayMode = 1; + _numFrames = 0; +} + +void SpeakerGuard2800::proc15() { + int v = _fieldF6; + Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene; + + if (!_object2) { + _object2 = &scene->_actor1; + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + if (v == 0) { + _object1.animate(ANIM_MODE_2, NULL); + } else { + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setZoom(75); + _object1.setup(4060, 3, 1); + _object1.animate(ANIM_MODE_5, this); + } +} } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_speakers.h b/engines/tsage/ringworld2/ringworld2_speakers.h index 115ad580ce..31eda2431c 100644 --- a/engines/tsage/ringworld2/ringworld2_speakers.h +++ b/engines/tsage/ringworld2/ringworld2_speakers.h @@ -237,6 +237,30 @@ public: virtual Common::String getClassName() { return "SpeakerNej2750"; } virtual void proc15(); }; + +class SpeakerQuinn2800 : public VisualSpeaker { +public: + SpeakerQuinn2800(); + + virtual Common::String getClassName() { return "SpeakerQuinn2800"; } + virtual void proc15(); +}; + +class SpeakerNej2800 : public VisualSpeaker { +public: + SpeakerNej2800(); + + virtual Common::String getClassName() { return "SpeakerNej2800"; } + virtual void proc15(); +}; + +class SpeakerGuard2800 : public VisualSpeaker { +public: + SpeakerGuard2800(); + + virtual Common::String getClassName() { return "SpeakerGuard2800"; } + virtual void proc15(); +}; } // End of namespace Ringworld2 } // End of namespace TsAGE -- cgit v1.2.3 From 24740b30bd9d6cfd5ce420951a53b87a156ffbbf Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 17 Dec 2011 13:13:44 +1100 Subject: TSAGE: Disallow saving and loading via the GMM when a dialog is active --- engines/tsage/blue_force/blueforce_logic.cpp | 6 ++++-- engines/tsage/ringworld/ringworld_logic.cpp | 7 +++++-- engines/tsage/ringworld2/ringworld2_logic.cpp | 6 ++++-- 3 files changed, 13 insertions(+), 6 deletions(-) (limited to 'engines') diff --git a/engines/tsage/blue_force/blueforce_logic.cpp b/engines/tsage/blue_force/blueforce_logic.cpp index 22299c1bf1..9888f4dd91 100644 --- a/engines/tsage/blue_force/blueforce_logic.cpp +++ b/engines/tsage/blue_force/blueforce_logic.cpp @@ -255,14 +255,16 @@ Scene *BlueForceGame::createScene(int sceneNumber) { * Returns true if it is currently okay to restore a game */ bool BlueForceGame::canLoadGameStateCurrently() { - return true; + // Don't allow a game to be loaded if a dialog is active + return g_globals->_gfxManagers.size() == 1; } /** * Returns true if it is currently okay to save the game */ bool BlueForceGame::canSaveGameStateCurrently() { - return true; + // Don't allow a game to be saved if a dialog is active + return g_globals->_gfxManagers.size() == 1; } void BlueForceGame::rightClick() { diff --git a/engines/tsage/ringworld/ringworld_logic.cpp b/engines/tsage/ringworld/ringworld_logic.cpp index ad67b66f69..c87b95e0b8 100644 --- a/engines/tsage/ringworld/ringworld_logic.cpp +++ b/engines/tsage/ringworld/ringworld_logic.cpp @@ -196,14 +196,17 @@ Scene *RingworldGame::createScene(int sceneNumber) { * Returns true if it is currently okay to restore a game */ bool RingworldGame::canLoadGameStateCurrently() { - return !g_globals->getFlag(50); + // Don't allow a game to be loaded if a dialog is active + return !g_globals->getFlag(50) && (g_globals->_gfxManagers.size() == 1); + } /** * Returns true if it is currently okay to save the game */ bool RingworldGame::canSaveGameStateCurrently() { - return !g_globals->getFlag(50); + // Don't allow a game to be saved if a dialog is active + return !g_globals->getFlag(50) && (g_globals->_gfxManagers.size() == 1); } /*--------------------------------------------------------------------------*/ diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index 3854a37384..ccedb3a18a 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -203,14 +203,16 @@ Scene *Ringworld2Game::createScene(int sceneNumber) { * Returns true if it is currently okay to restore a game */ bool Ringworld2Game::canLoadGameStateCurrently() { - return true; + // Don't allow a game to be loaded if a dialog is active + return g_globals->_gfxManagers.size() == 1; } /** * Returns true if it is currently okay to save the game */ bool Ringworld2Game::canSaveGameStateCurrently() { - return true; + // Don't allow a game to be saved if a dialog is active + return g_globals->_gfxManagers.size() == 1; } /*--------------------------------------------------------------------------*/ -- cgit v1.2.3 From 3e6e5bc0ce1d384d96b464377319ecae0a36222e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 17 Dec 2011 13:28:12 +1100 Subject: TSAGE: Bugfix to allow loading savegames in Blue Force directly from the launcher --- engines/tsage/blue_force/blueforce_logic.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'engines') diff --git a/engines/tsage/blue_force/blueforce_logic.cpp b/engines/tsage/blue_force/blueforce_logic.cpp index 9888f4dd91..91cba43e1d 100644 --- a/engines/tsage/blue_force/blueforce_logic.cpp +++ b/engines/tsage/blue_force/blueforce_logic.cpp @@ -20,6 +20,7 @@ * */ +#include "common/config-manager.h" #include "tsage/blue_force/blueforce_logic.h" #include "tsage/blue_force/blueforce_dialogs.h" #include "tsage/blue_force/blueforce_scenes0.h" @@ -42,8 +43,25 @@ namespace TsAGE { namespace BlueForce { void BlueForceGame::start() { - // Start the game - g_globals->_sceneManager.changeScene(20); + int slot = -1; + + // Check for a savegame to load straight from the launcher + if (ConfMan.hasKey("save_slot")) { + slot = ConfMan.getInt("save_slot"); + Common::String file = g_vm->generateSaveName(slot); + Common::InSaveFile *in = g_vm->_system->getSavefileManager()->openForLoading(file); + if (in) + delete in; + else + slot = -1; + } + + if (slot >= 0) + // Set the savegame slot to load in the main loop + g_globals->_sceneHandler->_loadGameSlot = slot; + else + // Switch to the title screen + g_globals->_sceneManager.setNewScene(20); } Scene *BlueForceGame::createScene(int sceneNumber) { -- cgit v1.2.3 From 8dec805d852cff58d3ff52c4d8051ac0a33f93be Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 17 Dec 2011 15:38:29 +1100 Subject: TSAGE: Bugfix for #3460485 - Animation running too slowly --- engines/tsage/events.cpp | 2 +- engines/tsage/events.h | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'engines') diff --git a/engines/tsage/events.cpp b/engines/tsage/events.cpp index ac08997563..152570b187 100644 --- a/engines/tsage/events.cpp +++ b/engines/tsage/events.cpp @@ -386,7 +386,7 @@ bool EventsClass::isCursorVisible() const { */ void EventsClass::delay(int numFrames) { while (_frameNumber < (_prevDelayFrame + numFrames)) { - uint32 delayAmount = CLIP(_priorFrameTime + GAME_FRAME_TIME - g_system->getMillis(), + uint32 delayAmount = CLIP(_priorFrameTime + GAME_SCRIPT_TIME - g_system->getMillis(), (uint32)0, (uint32)GAME_FRAME_TIME); if (delayAmount > 0) g_system->delayMillis(delayAmount); diff --git a/engines/tsage/events.h b/engines/tsage/events.h index 303c2201ea..fe4d3ecde6 100644 --- a/engines/tsage/events.h +++ b/engines/tsage/events.h @@ -36,9 +36,12 @@ enum EventType {EVENT_NONE = 0, EVENT_BUTTON_DOWN = 1, EVENT_BUTTON_UP = 2, EVEN enum ButtonShiftFlags {BTNSHIFT_LEFT = 0, BTNSHIFT_RIGHT = 3, BTNSHIFT_MIDDLE = 4}; -// Intrinisc game delay between execution frames. This runs at 60Hz -#define GAME_FRAME_RATE 60 -#define GAME_FRAME_TIME (1000 / 60) +// Intrinisc game delay between execution frames +#define GAME_FRAME_RATE 50 +#define GAME_FRAME_TIME (1000 / GAME_FRAME_RATE) + +#define GAME_SCRIPT_RATE 80 +#define GAME_SCRIPT_TIME (1000 / GAME_SCRIPT_RATE) class GfxManager; -- cgit v1.2.3 From 05c5e224b45f910d9db50e6c9ce451ede31452f2 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 17 Dec 2011 13:47:42 +0200 Subject: DREAMWEB: Port 'findinvpos', 'selectob' to C++ and fix a regression in identifyOb() --- engines/dreamweb/dreamgen.cpp | 69 ------------------------------------------- engines/dreamweb/dreamgen.h | 2 -- engines/dreamweb/object.cpp | 41 +++++++++++++++++++++++++ engines/dreamweb/stubs.h | 3 ++ 4 files changed, 44 insertions(+), 71 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 939e8c0127..ff91eb678f 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -1091,36 +1091,6 @@ void DreamGenContext::getSetAd() { es = data.word(kSetdat); } -void DreamGenContext::findInvPos() { - STACK_CHECK; - cx = data.word(kMousex); - _sub(cx, (80)); - bx = -1; -findinv1: - _inc(bx); - _sub(cx, (44)); - if (!flags.c()) - goto findinv1; - cx = data.word(kMousey); - _sub(cx, (58)); - _sub(bx, 5); -findinv2: - _add(bx, 5); - _sub(cx, (44)); - if (!flags.c()) - goto findinv2; - al = data.byte(kRyanpage); - ah = 0; - cx = 10; - _mul(cx); - _add(bx, ax); - al = bl; - data.byte(kLastinvpos) = al; - _add(bx, bx); - es = data.word(kBuffers); - _add(bx, (0+(228*13)+32)); -} - void DreamGenContext::findOpenPos() { STACK_CHECK; cx = data.word(kMousex); @@ -2736,45 +2706,6 @@ lookcolon: goto lookcolon; } -void DreamGenContext::selectOb() { - STACK_CHECK; - findInvPos(); - ax = es.word(bx); - _cmp(al, 255); - if (!flags.z()) - goto canselectob; - blank(); - return; -canselectob: - data.byte(kWithobject) = al; - data.byte(kWithtype) = ah; - _cmp(ax, data.word(kOldsubject)); - if (!flags.z()) - goto diffsub3; - _cmp(data.byte(kCommandtype), 221); - if (flags.z()) - goto alreadyselob; - data.byte(kCommandtype) = 221; -diffsub3: - data.word(kOldsubject) = ax; - bx = ax; - al = 0; - commandWithOb(); -alreadyselob: - ax = data.word(kMousebutton); - _cmp(ax, data.word(kOldbutton)); - if (flags.z()) - return /* (notselob) */; - _and(ax, 1); - if (!flags.z()) - goto doselob; - return; -doselob: - delPointer(); - data.byte(kInvopen) = 0; - useRoutine(); -} - void DreamGenContext::showDiaryKeys() { STACK_CHECK; _cmp(data.byte(kPresscount), 0); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 28711bb1ba..139253cdb8 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -496,9 +496,7 @@ public: void removeObFromInv(); void dirFile(); void pickupConts(); - void findInvPos(); void getKeyAndLogo(); - void selectOb(); void fadeUpMon(); void reExFromInv(); void outOfInv(); diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index 747b7934b4..283e44b583 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -331,6 +331,8 @@ void DreamGenContext::identifyOb() { push(ax); findPathOfPoint(); data.byte(kPointerspath) = dl; + ax = pop(); + push(ax); findFirstPath(); data.byte(kPointerfirstpath) = al; ax = pop(); @@ -354,4 +356,43 @@ void DreamGenContext::identifyOb() { blank(); } +uint16 DreamGenContext::findInvPosCPP() { + uint16 x = data.word(kMousex) - kInventx; + uint16 y = data.word(kMousey) - kInventy; + uint16 pos = (x / kItempicsize) + (y / kItempicsize) * 5; + uint16 invPos = data.byte(kRyanpage) * 10 + pos; + data.byte(kLastinvpos) = invPos & 0xFF; + return invPos * 2 + kRyaninvlist; +} + +void DreamGenContext::findInvPos() { + bx = findInvPosCPP(); + es = data.word(kBuffers); +} + +void DreamGenContext::selectOb() { + es = data.word(kBuffers); + + uint16 objectId = es.word(findInvPosCPP()); + if ((objectId & 0xFF) == 255) { + blank(); + return; + } + + data.byte(kWithobject) = objectId & 0x00FF; + data.byte(kWithtype) = objectId & 0xFF00; + + if (objectId == data.word(kOldsubject) && data.byte(kCommandtype) != 221) + data.byte(kCommandtype) = 221; + + data.word(kOldsubject) = objectId; + commandWithOb(0, data.byte(kWithtype), data.byte(kWithobject)); + + if (data.word(kMousebutton) != data.word(kOldbutton) && (data.word(kMousebutton) & 1)) { + delPointer(); + data.byte(kInvopen) = 0; + useRoutine(); + } +} + } // End of namespace DreamGen diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index b2417e767b..d9823fb2c0 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -398,5 +398,8 @@ void useStereo(); void checkInside(); uint16 checkInside(uint16 command, uint16 type); + void selectOb(); + void findInvPos(); + uint16 findInvPosCPP(); #endif -- cgit v1.2.3 From 710072c55bcdac525bea401a4c9fa260a95d79c5 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 17 Dec 2011 14:33:17 +0200 Subject: DREAMWEB: Fix regression in getOpenedSize() --- engines/dreamweb/object.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index 283e44b583..d376f915e5 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -284,7 +284,26 @@ void DreamBase::getBackFromOb() { } void DreamGenContext::getOpenedSize() { - ax = getOpenedSizeCPP(); + //ax = getOpenedSizeCPP(); + + // We need to call the ASM-style versions of get*Ad, as these also set + // bx and es + + al = data.byte(kOpenedob); + + switch (data.byte(kOpenedtype)) { + case 4: + getExAd(); + break; + case 2: + getFreeAd(); + break; + default: + getSetAd(); + break; + } + + ax = es.word(bx+7); } byte DreamGenContext::getOpenedSizeCPP() { -- cgit v1.2.3 From 127795805358493d92f82fae2768c1559a8bcaf0 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 17 Dec 2011 15:23:06 +0200 Subject: DREAMWEB: Fix regression in isRyanHolding() --- engines/dreamweb/stubs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 376a681604..8ee5158773 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -1781,7 +1781,7 @@ void DreamGenContext::isRyanHolding() { id[2] = cl; id[3] = ch; id[4] = '\0'; - flags._z = isRyanHolding(id); + flags._z = !isRyanHolding(id); } bool DreamGenContext::isRyanHolding(const char *id) { -- cgit v1.2.3 From 7d38ba5619fbca6850c0d67eb9a2b43938654cf1 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 17 Dec 2011 15:25:56 +0200 Subject: DREAMWEB: Fix another regression in isRyanHolding() (thanks wjp) --- engines/dreamweb/stubs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 8ee5158773..a1d08b35d1 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -1788,7 +1788,7 @@ bool DreamGenContext::isRyanHolding(const char *id) { for (uint16 index = 0; index < kNumexobjects; index++) { DynObject *object = getExAd(index); if (object->mapad[0] == 4 && objectMatches(object, id)) - return (index == kNumexobjects); + return true; } return false; -- cgit v1.2.3 From b1edf2446251a0141fae38ad0bff42d2a639a1bf Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 17 Dec 2011 15:43:10 +0200 Subject: DREAMWEB: Fix a regression in businessMan(), and updated its comments --- engines/dreamweb/people.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/people.cpp b/engines/dreamweb/people.cpp index 887a4452ad..e8446f0445 100644 --- a/engines/dreamweb/people.cpp +++ b/engines/dreamweb/people.cpp @@ -873,24 +873,23 @@ void DreamGenContext::mugger(ReelRoutine &routine) { } } +// Exiting the elevator of Sartain's industries, Sartain (the businessman) and +// two bodyguards are expecting Ryan. void DreamBase::businessMan(ReelRoutine &routine) { data.byte(kPointermode) = 0; data.word(kWatchingtime) = 2; - if (routine.reelPointer() == 2) { - // First - DreamBase::setupTimedUse(49, 30, 1, 68, 174); - return; - } + if (routine.reelPointer() == 2) + DreamBase::setupTimedUse(49, 30, 1, 68, 174); // First if (routine.reelPointer() == 95) { - // Bus combat won - end + // Businessman combat won - end data.byte(kPointermode) = 0; data.word(kWatchingtime) = 0; return; } if (routine.reelPointer() == 49) - return; // buscombatend + return; // Businessman combat end if (checkSpeed(routine)) { uint16 nextReelPointer = routine.reelPointer() + 1; @@ -904,7 +903,7 @@ void DreamBase::businessMan(ReelRoutine &routine) { data.byte(kCombatcount) = 0; nextReelPointer = 51; } else { - // No shield on bus + // No shield on businessman data.byte(kCombatcount)++; if (data.byte(kCombatcount) == 20) { data.byte(kCombatcount) = 0; @@ -912,7 +911,7 @@ void DreamBase::businessMan(ReelRoutine &routine) { } } } else { - // Bus combat won + // Businessman combat won if (nextReelPointer == 91) { turnPathOn(0); turnPathOn(1); -- cgit v1.2.3 From 956abddc5ce30bf29bb7df84f3eb3f74076d57e0 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 17 Dec 2011 15:50:48 +0200 Subject: DREAMWEB: Fix regression in selectOb() (thanks wjp) --- engines/dreamweb/object.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index d376f915e5..3cea2a5c2f 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -399,7 +399,7 @@ void DreamGenContext::selectOb() { } data.byte(kWithobject) = objectId & 0x00FF; - data.byte(kWithtype) = objectId & 0xFF00; + data.byte(kWithtype) = objectId >> 8; if (objectId == data.word(kOldsubject) && data.byte(kCommandtype) != 221) data.byte(kCommandtype) = 221; -- cgit v1.2.3 From 400bda78d2ad98c7671c384e58cb6d74ba7579fd Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 17 Dec 2011 16:21:32 +0200 Subject: DREAMWEB: Fix another regression in selectOb() (thanks wjp) --- engines/dreamweb/object.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index 3cea2a5c2f..dbae7e2ba5 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -401,8 +401,19 @@ void DreamGenContext::selectOb() { data.byte(kWithobject) = objectId & 0x00FF; data.byte(kWithtype) = objectId >> 8; - if (objectId == data.word(kOldsubject) && data.byte(kCommandtype) != 221) - data.byte(kCommandtype) = 221; + if (objectId == data.word(kOldsubject)) { + if (data.byte(kCommandtype) == 221) { + // Object already selected + if (data.word(kMousebutton) != data.word(kOldbutton) && (data.word(kMousebutton) & 1)) { + delPointer(); + data.byte(kInvopen) = 0; + useRoutine(); + } + return; + } else { + data.byte(kCommandtype) = 221; + } + } data.word(kOldsubject) = objectId; commandWithOb(0, data.byte(kWithtype), data.byte(kWithobject)); -- cgit v1.2.3 From 9fdb38d39510d81de43c887e95bae5b6e6a91156 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 17 Dec 2011 16:32:12 +0200 Subject: DREAMWEB: Fix another regression in the ASM-style version of getOpenedSize() --- engines/dreamweb/object.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index dbae7e2ba5..29e6d52ba7 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -294,16 +294,17 @@ void DreamGenContext::getOpenedSize() { switch (data.byte(kOpenedtype)) { case 4: getExAd(); + ax = es.word(bx+7); break; case 2: getFreeAd(); + ax = es.word(bx+7); break; default: getSetAd(); + ax = es.word(bx+3); break; } - - ax = es.word(bx+7); } byte DreamGenContext::getOpenedSizeCPP() { -- cgit v1.2.3 From 3185dac25e2f1984ccf92e7c33eee12caa6cd676 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sat, 17 Dec 2011 16:39:01 +0100 Subject: DREAMWEB: Work around runtime limitation The WordRef accessor writes back its value too late. Example: in the call printDirect(data.word(kLastxpos), .....) the destructor isn't called until after printDirect returns. This destroys the modifications to lastXPos that printDirect makes. --- engines/dreamweb/segment.h | 5 +++++ engines/dreamweb/use.cpp | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/dreamweb/segment.h b/engines/dreamweb/segment.h index 9464015478..65bc2335ea 100644 --- a/engines/dreamweb/segment.h +++ b/engines/dreamweb/segment.h @@ -56,6 +56,11 @@ public: } inline ~WordRef() { + // FIXME: This is _too late_ to write back the + // value. Example: in the call + // printDirect(data.word(kLastxpos), .....) + // the destructor isn't called until after printDirect returns. This + // destroys the modifications to lastXPos that printDirect makes. _data[0] = _value & 0xff; _data[1] = _value >> 8; _value = _data[0] | (_data[1] << 8); diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp index 4be3c7a6b3..ba1e8e4952 100644 --- a/engines/dreamweb/use.cpp +++ b/engines/dreamweb/use.cpp @@ -1581,7 +1581,8 @@ void DreamGenContext::withWhat() { copyName(data.byte(kObjecttype), data.byte(kCommand), commandLine); printMessage2(100, 21, 63, 200, false, 2); - printDirect(commandLine, data.word(kLastxpos) + 5, 21, 220, false); + uint16 x = data.word(kLastxpos) + 5; + printDirect(commandLine, x, 21, 220, false); printMessage2(data.word(kLastxpos) + 5, 21, 63, 200, false, 3); fillRyan(); -- cgit v1.2.3 From 0731bcb5acb9a591eac843904e725de98b19fa73 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 17 Dec 2011 19:28:04 +0200 Subject: DREAMWEB: Implement removeSaveState() --- engines/dreamweb/detection.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'engines') diff --git a/engines/dreamweb/detection.cpp b/engines/dreamweb/detection.cpp index ba7152beb5..db2155fc4c 100644 --- a/engines/dreamweb/detection.cpp +++ b/engines/dreamweb/detection.cpp @@ -116,6 +116,8 @@ SaveStateList DreamWebMetaEngine::listSaves(const char *target) const { int DreamWebMetaEngine::getMaximumSaveSlot() const { return 99; } void DreamWebMetaEngine::removeSaveState(const char *target, int slot) const { + Common::String fileName = Common::String::format("DREAMWEB.D%02d", slot); + g_system->getSavefileManager()->removeSavefile(fileName); } #if PLUGIN_ENABLED_DYNAMIC(DREAMWEB) -- cgit v1.2.3 From af1c8d774d4d15b848876c915165cf4b2632ebae Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 17 Dec 2011 19:30:06 +0200 Subject: DREAMWEB: Fix two off-by-one errors in saveGame(), rewrite scanForNames() to use listSavefiles() and use Common::strlcopy instead of strncpy --- engines/dreamweb/saveload.cpp | 63 +++++++++++++++++++++---------------------- 1 file changed, 30 insertions(+), 33 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/saveload.cpp b/engines/dreamweb/saveload.cpp index 2945874e1a..574036c045 100644 --- a/engines/dreamweb/saveload.cpp +++ b/engines/dreamweb/saveload.cpp @@ -191,16 +191,16 @@ void DreamGenContext::saveGame() { } char descbuf[17] = { 2, 0 }; - strncpy((char*)descbuf+1, game_description.c_str(), 16); + Common::strlcpy((char*)descbuf+1, game_description.c_str(), 16); unsigned int desclen = game_description.size(); if (desclen > 15) desclen = 15; // zero terminate, and pad with ones descbuf[++desclen] = 0; - while (desclen < 17) + while (desclen < 16) descbuf[++desclen] = 1; if (savegameId < 7) - memcpy(&_saveNames[17*savegameId], descbuf, 17); + Common::strlcpy(&_saveNames[17 * savegameId + 1], descbuf, 16); // the first character is unused savePosition(savegameId, descbuf); @@ -464,42 +464,39 @@ void DreamGenContext::loadPosition(unsigned int slot) { // Count number of save files, and load their descriptions into _saveNames unsigned int DreamGenContext::scanForNames() { - unsigned int count = 0; - - FileHeader header; - - // TODO: Change this to use SaveFileManager::listSavefiles() + // Initialize the first 7 slots (like the original code expects) for (unsigned int slot = 0; slot < 7; ++slot) { - _saveNames[17*slot+0] = 2; - _saveNames[17*slot+1] = 0; + _saveNames[17 * slot + 0] = 2; + _saveNames[17 * slot + 1] = 0; for (int i = 2; i < 17; ++i) - _saveNames[17*slot+i] = 1; - - // Try opening savegame with the given slot id - Common::String filename = engine->getSavegameFilename(slot); - Common::InSaveFile *inSaveFile = engine->getSaveFileManager()->openForLoading(filename); - if (!inSaveFile) - continue; - - ++count; - - inSaveFile->read((uint8 *)&header, sizeof(FileHeader)); - - if (header.len(0) != 17) { - ::warning("Error loading save: description buffer isn't 17 bytes"); - delete inSaveFile; - continue; - } - - // NB: Only possible if slot < 7 - inSaveFile->read(&_saveNames[17*slot], 17); + _saveNames[17 * slot + i] = 1; // initialize with 1's + } - delete inSaveFile; + Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); + Common::StringArray files = saveFileMan->listSavefiles("DREAMWEB.D??"); + Common::sort(files.begin(), files.end()); + + SaveStateList saveList; + for (uint i = 0; i < files.size(); ++i) { + const Common::String &file = files[i]; + Common::InSaveFile *stream = saveFileMan->openForLoading(file); + if (!stream) + error("cannot open save file %s", file.c_str()); + char name[17] = {}; + stream->seek(0x61); + stream->read(name, sizeof(name) - 1); + delete stream; + + int slotNum = atoi(file.c_str() + file.size() - 2); + SaveStateDescriptor sd(slotNum, name); + saveList.push_back(sd); + if (slotNum < 7) + Common::strlcpy(&_saveNames[17 * slotNum + 1], name, 16); // the first character is unused } - al = (uint8)count; + al = saveList.size() <= 7 ? (uint8)saveList.size() : 7; - return count; + return saveList.size(); } void DreamGenContext::loadOld() { -- cgit v1.2.3 From 855b5320b3249e138eeb07a2414ce2ecb862387a Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 17 Dec 2011 19:30:48 +0200 Subject: DREAMWEB: Use ScummVM's save/load dialogs by default --- engines/dreamweb/dreamweb.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamweb.cpp b/engines/dreamweb/dreamweb.cpp index 082b7d8ce7..0af3f00d5c 100644 --- a/engines/dreamweb/dreamweb.cpp +++ b/engines/dreamweb/dreamweb.cpp @@ -209,7 +209,7 @@ Common::Error DreamWebEngine::run() { syncSoundSettings(); _console = new DreamWebConsole(this); - ConfMan.registerDefault("dreamweb_originalsaveload", "true"); + ConfMan.registerDefault("dreamweb_originalsaveload", "false"); _timer->installTimerProc(vSyncInterrupt, 1000000 / 70, this, "dreamwebVSync"); _context.__start(); -- cgit v1.2.3 From f8bfe84c44edd9969cad6c9e011c43f92127a23d Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 17 Dec 2011 20:06:55 +0200 Subject: DREAMWEB: Remove dead code --- engines/dreamweb/saveload.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/saveload.cpp b/engines/dreamweb/saveload.cpp index 574036c045..c77c419148 100644 --- a/engines/dreamweb/saveload.cpp +++ b/engines/dreamweb/saveload.cpp @@ -191,7 +191,7 @@ void DreamGenContext::saveGame() { } char descbuf[17] = { 2, 0 }; - Common::strlcpy((char*)descbuf+1, game_description.c_str(), 16); + Common::strlcpy((char*)descbuf + 1, game_description.c_str(), 16); unsigned int desclen = game_description.size(); if (desclen > 15) desclen = 15; @@ -199,9 +199,6 @@ void DreamGenContext::saveGame() { descbuf[++desclen] = 0; while (desclen < 16) descbuf[++desclen] = 1; - if (savegameId < 7) - Common::strlcpy(&_saveNames[17 * savegameId + 1], descbuf, 16); // the first character is unused - savePosition(savegameId, descbuf); // TODO: The below is copied from actualsave -- cgit v1.2.3 From 6dd09b8935495d211c51a45652fc59b4da1b0442 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Wed, 14 Dec 2011 17:19:14 +0100 Subject: DREAMWEB: Convert checkForExit --- engines/dreamweb/dreambase.h | 2 + engines/dreamweb/dreamgen.cpp | 371 ++++++++++------------------------- engines/dreamweb/dreamgen.h | 442 +++++++++++++++++++++--------------------- engines/dreamweb/sprite.cpp | 61 +++++- engines/dreamweb/stubs.cpp | 3 +- engines/dreamweb/stubs.h | 4 +- 6 files changed, 388 insertions(+), 495 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 20cafcb203..7c86696568 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -263,6 +263,7 @@ public: void clearReels(); void getRidOfReels(); void liftNoise(uint8 index); + void checkForExit(Sprite *sprite); // from stubs.cpp bool isCD(); @@ -388,6 +389,7 @@ public: void dumpTimedText(); void getTime(); void doChange(uint8 index, uint8 value, uint8 type); + bool isRyanHolding(const char *id); // from use.cpp void placeFreeObject(uint8 index); diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index ff91eb678f..ea4d8e5b05 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -26,165 +26,6 @@ namespace DreamGen { -void DreamGenContext::checkForExit() { - STACK_CHECK; - cl = data.byte(kRyanx); - _add(cl, 12); - ch = data.byte(kRyany); - _add(ch, 12); - checkOne(); - data.byte(kLastflag) = cl; - data.byte(kLastflagex) = ch; - data.byte(kFlagx) = dl; - data.byte(kFlagy) = dh; - al = data.byte(kLastflag); - _test(al, 64); - if (flags.z()) - goto notnewdirect; - al = data.byte(kLastflagex); - data.byte(kAutolocation) = al; - return; -notnewdirect: - _test(al, 32); - if (flags.z()) - goto notleave; - push(es); - push(bx); - _cmp(data.byte(kReallocation), 2); - if (!flags.z()) - goto notlouis; - bl = 0; - push(bx); - al = 'W'; - ah = 'E'; - cl = 'T'; - ch = 'A'; - isRyanHolding(); - bx = pop(); - if (flags.z()) - goto noshoe1; - _inc(bl); -noshoe1: - push(bx); - al = 'W'; - ah = 'E'; - cl = 'T'; - ch = 'B'; - isRyanHolding(); - bx = pop(); - if (flags.z()) - goto noshoe2; - _inc(bl); -noshoe2: - _cmp(bl, 2); - if (flags.z()) - goto notlouis; - al = 42; - _cmp(bl, 0); - if (flags.z()) - goto notravmessage; - _inc(al); -notravmessage: - cx = 80; - dx = 10; - bl = 68; - bh = 64; - setupTimedUse(); - al = data.byte(kFacing); - _add(al, 4); - _and(al, 7); - data.byte(kTurntoface) = al; - bx = pop(); - es = pop(); - return; -notlouis: - bx = pop(); - es = pop(); - data.byte(kNeedtotravel) = 1; - return; -notleave: - _test(al, 4); - if (flags.z()) - goto notaleft; - adjustLeft(); - return; -notaleft: - _test(al, 2); - if (flags.z()) - goto notaright; - adjustRight(); - return; -notaright: - _test(al, 8); - if (flags.z()) - goto notadown; - adjustDown(); - return; -notadown: - _test(al, 16); - if (flags.z()) - return /* (notanup) */; - adjustUp(); -} - -void DreamGenContext::adjustDown() { - STACK_CHECK; - push(es); - push(bx); - _add(data.byte(kMapy), 10); - al = data.byte(kLastflagex); - cl = 16; - _mul(cl); - es.byte(bx+11) = al; - data.byte(kNowinnewroom) = 1; - bx = pop(); - es = pop(); -} - -void DreamGenContext::adjustUp() { - STACK_CHECK; - push(es); - push(bx); - _sub(data.byte(kMapy), 10); - al = data.byte(kLastflagex); - cl = 16; - _mul(cl); - es.byte(bx+11) = al; - data.byte(kNowinnewroom) = 1; - bx = pop(); - es = pop(); -} - -void DreamGenContext::adjustLeft() { - STACK_CHECK; - push(es); - push(bx); - data.byte(kLastflag) = 0; - _sub(data.byte(kMapx), 11); - al = data.byte(kLastflagex); - cl = 16; - _mul(cl); - es.byte(bx+10) = al; - data.byte(kNowinnewroom) = 1; - bx = pop(); - es = pop(); -} - -void DreamGenContext::adjustRight() { - STACK_CHECK; - push(es); - push(bx); - _add(data.byte(kMapx), 11); - al = data.byte(kLastflagex); - cl = 16; - _mul(cl); - _sub(al, 2); - es.byte(bx+10) = al; - data.byte(kNowinnewroom) = 1; - bx = pop(); - es = pop(); -} - void DreamGenContext::reminders() { STACK_CHECK; _cmp(data.byte(kReallocation), 24); @@ -2140,14 +1981,14 @@ void DreamGenContext::getDestInfo() { push(ax); dx = data; es = dx; - si = 1123; + si = 1120; _add(si, ax); cl = es.byte(si); ax = pop(); push(cx); dx = data; es = dx; - si = 1139; + si = 1136; _add(si, ax); ax = pop(); } @@ -2199,7 +2040,7 @@ clearedlocations: bx = ax; dx = data; es = dx; - _add(bx, 1123); + _add(bx, 1120); es.byte(bx) = 0; } @@ -2238,7 +2079,7 @@ dirroot: si = offset_rootdir; _inc(si); es = cs; - di = 1048; + di = 1045; _inc(di); cx = 12; _movsb(cx, true); @@ -2340,7 +2181,7 @@ notyetassigned: push(bx); _add(bx, 2); ds = cs; - si = 1157; + si = 1154; checkpass: _lodsw(); ah = es.byte(bx); @@ -2411,7 +2252,7 @@ void DreamGenContext::read() { return; okcom: es = cs; - di = 1048; + di = 1045; ax = data.word(kTextfile1); data.word(kMonsource) = ax; ds = ax; @@ -2541,7 +2382,7 @@ keyok2: ds = cs; si = offset_operand1+1; es = cs; - di = 1048+1; + di = 1045+1; cx = 12; _movsb(cx, true); monitorLogo(); @@ -2668,7 +2509,7 @@ void DreamGenContext::parser() { al = '='; _stosb(); ds = cs; - si = 1157; + si = 1154; notspace1: _lodsw(); _cmp(al, 32); @@ -2755,7 +2596,7 @@ gotkeyp: void DreamGenContext::clearBuffers() { STACK_CHECK; es = data.word(kBuffers); - cx = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+901-444+68-0)/2; + cx = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+898-441+68-0)/2; ax = 0; di = 0; _stosw(cx, true); @@ -2767,11 +2608,11 @@ void DreamGenContext::clearBuffers() { es = data.word(kBuffers); di = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)); ds = cs; - si = 444; - cx = (901-444); + si = 441; + cx = (898-441); _movsb(cx, true); es = data.word(kBuffers); - di = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+901-444); + di = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+898-441); ds = cs; si = 0; cx = (68-0); @@ -2789,11 +2630,11 @@ void DreamGenContext::clearChanges() { ds = data.word(kBuffers); si = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)); es = cs; - di = 444; - cx = (901-444); + di = 441; + cx = (898-441); _movsb(cx, true); ds = data.word(kBuffers); - si = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+901-444); + si = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+898-441); es = cs; di = 0; cx = (68-0); @@ -2807,7 +2648,7 @@ void DreamGenContext::clearChanges() { di = 0; _stosw(cx, true); es = cs; - di = 1123; + di = 1120; al = 1; _stosb(2); al = 0; @@ -2930,14 +2771,14 @@ void DreamGenContext::__start() { //0x0090: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00a0: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00b0: .... .... .... .... 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: .... .... .... . . 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x00d0: .... .... .... .... - 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x00e0: .. .... .... .... + //0x00e0: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00f0: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -2954,105 +2795,105 @@ void DreamGenContext::__start() { //0x0150: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0160: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x00, 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, //0x0180: .... .... .... .... - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x17, 0x00, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x17, 0x00, 0x00, 0x00, 0x00, //0x0190: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x01a0: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x01, 0x2c, 0x00, 0x14, - //0x01b0: .... .... .... .,.. - 0x00, 0x02, 0x00, 0x01, 0x01, 0x37, 0x00, 0x00, 0x00, 0x32, 0x14, 0x00, 0x18, 0x16, 0x00, 0x4a, - //0x01c0: .... .7.. .2.. ...J - 0x00, 0x01, 0x00, 0x00, 0x18, 0x21, 0x0a, 0x4b, 0x00, 0x01, 0x00, 0x01, 0x01, 0x2c, 0x00, 0x1b, - //0x01d0: .... .!.K .... .,.. - 0x00, 0x02, 0x00, 0x02, 0x01, 0x2c, 0x00, 0x60, 0x00, 0x03, 0x00, 0x04, 0x01, 0x2c, 0x00, 0x76, - //0x01e0: .... .,.` .... .,.v - 0x00, 0x02, 0x00, 0x05, 0x01, 0x2c, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x00, 0x05, 0x16, 0x14, 0x35, - //0x01f0: .... .,.. .... ...5 - 0x00, 0x03, 0x00, 0x00, 0x05, 0x16, 0x14, 0x28, 0x00, 0x01, 0x00, 0x02, 0x05, 0x16, 0x14, 0x32, - //0x0200: .... ...( .... ...2 - 0x00, 0x01, 0x00, 0x03, 0x02, 0x0b, 0x0a, 0xc0, 0x00, 0x01, 0x00, 0x00, 0x02, 0x0b, 0x0a, 0xb6, + 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x01, 0x2c, 0x00, 0x14, 0x00, 0x02, 0x00, + //0x01b0: .... .... ..,. .... + 0x01, 0x01, 0x37, 0x00, 0x00, 0x00, 0x32, 0x14, 0x00, 0x18, 0x16, 0x00, 0x4a, 0x00, 0x01, 0x00, + //0x01c0: ..7. ..2. .... J... + 0x00, 0x18, 0x21, 0x0a, 0x4b, 0x00, 0x01, 0x00, 0x01, 0x01, 0x2c, 0x00, 0x1b, 0x00, 0x02, 0x00, + //0x01d0: ..!. K... ..,. .... + 0x02, 0x01, 0x2c, 0x00, 0x60, 0x00, 0x03, 0x00, 0x04, 0x01, 0x2c, 0x00, 0x76, 0x00, 0x02, 0x00, + //0x01e0: ..,. `... ..,. v... + 0x05, 0x01, 0x2c, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x00, 0x05, 0x16, 0x14, 0x35, 0x00, 0x03, 0x00, + //0x01f0: ..,. .... .... 5... + 0x00, 0x05, 0x16, 0x14, 0x28, 0x00, 0x01, 0x00, 0x02, 0x05, 0x16, 0x14, 0x32, 0x00, 0x01, 0x00, + //0x0200: .... (... .... 2... + 0x03, 0x02, 0x0b, 0x0a, 0xc0, 0x00, 0x01, 0x00, 0x00, 0x02, 0x0b, 0x0a, 0xb6, 0x00, 0x02, 0x00, //0x0210: .... .... .... .... - 0x00, 0x02, 0x00, 0x01, 0x08, 0x0b, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x01, 0x17, 0x00, 0x32, 0x00, - //0x0220: .... .... .... ..2. - 0x00, 0x03, 0x00, 0x00, 0x1c, 0x0b, 0x14, 0xfa, 0x00, 0x04, 0x00, 0x00, 0x17, 0x00, 0x32, 0x2b, - //0x0230: .... .... .... ..2+ - 0x00, 0x02, 0x00, 0x08, 0x17, 0x0b, 0x28, 0x82, 0x00, 0x02, 0x00, 0x01, 0x17, 0x16, 0x28, 0x7a, - //0x0240: .... ..(. .... ..(z - 0x00, 0x02, 0x00, 0x02, 0x17, 0x16, 0x28, 0x69, 0x00, 0x02, 0x00, 0x03, 0x17, 0x16, 0x28, 0x51, - //0x0250: .... ..(i .... ..(Q - 0x00, 0x02, 0x00, 0x04, 0x17, 0x0b, 0x28, 0x87, 0x00, 0x02, 0x00, 0x05, 0x17, 0x16, 0x28, 0x91, - //0x0260: .... ..(. .... ..(. - 0x00, 0x02, 0x00, 0x06, 0x04, 0x16, 0x1e, 0x00, 0x00, 0x02, 0x00, 0x00, 0x2d, 0x16, 0x1e, 0xc8, - //0x0270: .... .... .... -... - 0x00, 0x00, 0x00, 0x14, 0x2d, 0x16, 0x1e, 0x27, 0x00, 0x02, 0x00, 0x00, 0x2d, 0x16, 0x1e, 0x19, - //0x0280: .... -..' .... -... - 0x00, 0x02, 0x00, 0x00, 0x08, 0x16, 0x28, 0x20, 0x00, 0x02, 0x00, 0x00, 0x07, 0x0b, 0x14, 0x40, - //0x0290: .... ..( .... ...@ - 0x00, 0x02, 0x00, 0x00, 0x16, 0x16, 0x14, 0x52, 0x00, 0x02, 0x00, 0x00, 0x1b, 0x0b, 0x1e, 0x00, - //0x02a0: .... ...R .... .... - 0x00, 0x02, 0x00, 0x00, 0x14, 0x00, 0x1e, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0e, 0x21, 0x28, 0x15, - //0x02b0: .... .... .... .!(. - 0x00, 0x01, 0x00, 0x00, 0x1d, 0x0b, 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0x16, 0x00, 0x02, + 0x01, 0x08, 0x0b, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x01, 0x17, 0x00, 0x32, 0x00, 0x00, 0x03, 0x00, + //0x0220: .... .... ...2 .... + 0x00, 0x1c, 0x0b, 0x14, 0xfa, 0x00, 0x04, 0x00, 0x00, 0x17, 0x00, 0x32, 0x2b, 0x00, 0x02, 0x00, + //0x0230: .... .... ...2 +... + 0x08, 0x17, 0x0b, 0x28, 0x82, 0x00, 0x02, 0x00, 0x01, 0x17, 0x16, 0x28, 0x7a, 0x00, 0x02, 0x00, + //0x0240: ...( .... ...( z... + 0x02, 0x17, 0x16, 0x28, 0x69, 0x00, 0x02, 0x00, 0x03, 0x17, 0x16, 0x28, 0x51, 0x00, 0x02, 0x00, + //0x0250: ...( i... ...( Q... + 0x04, 0x17, 0x0b, 0x28, 0x87, 0x00, 0x02, 0x00, 0x05, 0x17, 0x16, 0x28, 0x91, 0x00, 0x02, 0x00, + //0x0260: ...( .... ...( .... + 0x06, 0x04, 0x16, 0x1e, 0x00, 0x00, 0x02, 0x00, 0x00, 0x2d, 0x16, 0x1e, 0xc8, 0x00, 0x00, 0x00, + //0x0270: .... .... .-.. .... + 0x14, 0x2d, 0x16, 0x1e, 0x27, 0x00, 0x02, 0x00, 0x00, 0x2d, 0x16, 0x1e, 0x19, 0x00, 0x02, 0x00, + //0x0280: .-.. '... .-.. .... + 0x00, 0x08, 0x16, 0x28, 0x20, 0x00, 0x02, 0x00, 0x00, 0x07, 0x0b, 0x14, 0x40, 0x00, 0x02, 0x00, + //0x0290: ...( ... .... @... + 0x00, 0x16, 0x16, 0x14, 0x52, 0x00, 0x02, 0x00, 0x00, 0x1b, 0x0b, 0x1e, 0x00, 0x00, 0x02, 0x00, + //0x02a0: .... R... .... .... + 0x00, 0x14, 0x00, 0x1e, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0e, 0x21, 0x28, 0x15, 0x00, 0x01, 0x00, + //0x02b0: .... .... ..!( .... + 0x00, 0x1d, 0x0b, 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0x16, 0x00, 0x02, 0x00, 0x02, 0x00, //0x02c0: .... .... .... .... - 0x00, 0x02, 0x00, 0x00, 0x19, 0x00, 0x32, 0x04, 0x00, 0x02, 0x00, 0x00, 0x32, 0x16, 0x1e, 0x79, - //0x02d0: .... ..2. .... 2..y - 0x00, 0x02, 0x00, 0x00, 0x32, 0x16, 0x1e, 0x00, 0x00, 0x14, 0x00, 0x00, 0x34, 0x16, 0x1e, 0xc0, - //0x02e0: .... 2... .... 4... - 0x00, 0x02, 0x00, 0x00, 0x34, 0x16, 0x1e, 0xe9, 0x00, 0x02, 0x00, 0x00, 0x32, 0x16, 0x28, 0x68, - //0x02f0: .... 4... .... 2.(h - 0x00, 0x37, 0x00, 0x00, 0x35, 0x21, 0x00, 0x63, 0x00, 0x02, 0x00, 0x00, 0x32, 0x16, 0x28, 0x00, - //0x0300: .7.. 5!.c .... 2.(. - 0x00, 0x03, 0x00, 0x00, 0x32, 0x16, 0x1e, 0xa2, 0x00, 0x02, 0x00, 0x00, 0x34, 0x16, 0x1e, 0x39, - //0x0310: .... 2... .... 4..9 - 0x00, 0x02, 0x00, 0x00, 0x34, 0x16, 0x1e, 0x00, 0x00, 0x02, 0x00, 0x00, 0x36, 0x00, 0x00, 0x48, - //0x0320: .... 4... .... 6..H - 0x00, 0x03, 0x00, 0x00, 0x37, 0x2c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, - //0x0330: .... 7,.. .... .... - 0x00, 0x1c, 0x00, 0x00, 0x0e, 0x16, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x0e, 0x16, 0x00, 0x2c, - //0x0340: .... .... .... ..., - 0x01, 0x01, 0x00, 0x00, 0x0a, 0x16, 0x1e, 0xae, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x16, 0x14, 0x00, + 0x00, 0x19, 0x00, 0x32, 0x04, 0x00, 0x02, 0x00, 0x00, 0x32, 0x16, 0x1e, 0x79, 0x00, 0x02, 0x00, + //0x02d0: ...2 .... .2.. y... + 0x00, 0x32, 0x16, 0x1e, 0x00, 0x00, 0x14, 0x00, 0x00, 0x34, 0x16, 0x1e, 0xc0, 0x00, 0x02, 0x00, + //0x02e0: .2.. .... .4.. .... + 0x00, 0x34, 0x16, 0x1e, 0xe9, 0x00, 0x02, 0x00, 0x00, 0x32, 0x16, 0x28, 0x68, 0x00, 0x37, 0x00, + //0x02f0: .4.. .... .2.( h.7. + 0x00, 0x35, 0x21, 0x00, 0x63, 0x00, 0x02, 0x00, 0x00, 0x32, 0x16, 0x28, 0x00, 0x00, 0x03, 0x00, + //0x0300: .5!. c... .2.( .... + 0x00, 0x32, 0x16, 0x1e, 0xa2, 0x00, 0x02, 0x00, 0x00, 0x34, 0x16, 0x1e, 0x39, 0x00, 0x02, 0x00, + //0x0310: .2.. .... .4.. 9... + 0x00, 0x34, 0x16, 0x1e, 0x00, 0x00, 0x02, 0x00, 0x00, 0x36, 0x00, 0x00, 0x48, 0x00, 0x03, 0x00, + //0x0320: .4.. .... .6.. H... + 0x00, 0x37, 0x2c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, + //0x0330: .7,. .... .... .... + 0x00, 0x0e, 0x16, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x0e, 0x16, 0x00, 0x2c, 0x01, 0x01, 0x00, + //0x0340: .... .... .... ,... + 0x00, 0x0a, 0x16, 0x1e, 0xae, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x16, 0x14, 0x00, 0x00, 0x01, 0x00, //0x0350: .... .... .... .... - 0x00, 0x01, 0x00, 0x00, 0x0b, 0x0b, 0x14, 0x00, 0x00, 0x32, 0x14, 0x00, 0x0b, 0x0b, 0x1e, 0x00, - //0x0360: .... .... .2.. .... - 0x00, 0x32, 0x14, 0x00, 0x0b, 0x16, 0x14, 0x00, 0x00, 0x32, 0x14, 0x00, 0x0e, 0x21, 0x28, 0x00, - //0x0370: .2.. .... .2.. .!(. - 0x00, 0x32, 0x14, 0x00, 0xff, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x56, 0x39, - //0x0380: .2.. .DRE AMWE B.V9 - 0x39, 0x00, 0x01, 0x00, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - //0x0390: 9... PUBL IC - 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x42, 0x4c, - //0x03a0: PUBL IC . ..BL - 0x41, 0x43, 0x4b, 0x44, 0x52, 0x41, 0x47, 0x4f, 0x4e, 0x20, 0x52, 0x59, 0x41, 0x4e, 0x20, 0x20, - //0x03b0: ACKD RAGO N RY AN - 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x48, 0x45, 0x4e, 0x44, 0x52, 0x49, 0x58, 0x20, - //0x03c0: ... HEND RIX - 0x20, 0x20, 0x20, 0x20, 0x4c, 0x4f, 0x55, 0x49, 0x53, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, - //0x03d0: LOUI S . - 0x00, 0x00, 0x53, 0x45, 0x50, 0x54, 0x49, 0x4d, 0x55, 0x53, 0x20, 0x20, 0x20, 0x20, 0x42, 0x45, - //0x03e0: ..SE PTIM US BE - 0x43, 0x4b, 0x45, 0x54, 0x54, 0x20, 0x20, 0x20, 0x20, 0x00, 0xff, 0xff, 0x20, 0x20, 0x20, 0x20, - //0x03f0: CKET T ... - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x22, 0x52, 0x4f, 0x4f, 0x54, 0x20, - //0x0400: ."R OOT - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - //0x0410: . " - 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x0d, 0x0a, 0x0d, 0x0a, 0x24, 0x10, 0x12, 0x12, 0x11, 0x10, - //0x0420: ... ..$. .... - 0x10, 0x10, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, + 0x00, 0x0b, 0x0b, 0x14, 0x00, 0x00, 0x32, 0x14, 0x00, 0x0b, 0x0b, 0x1e, 0x00, 0x00, 0x32, 0x14, + //0x0360: .... ..2. .... ..2. + 0x00, 0x0b, 0x16, 0x14, 0x00, 0x00, 0x32, 0x14, 0x00, 0x0e, 0x21, 0x28, 0x00, 0x00, 0x32, 0x14, + //0x0370: .... ..2. ..!( ..2. + 0x00, 0xff, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x56, 0x39, 0x39, 0x00, 0x01, + //0x0380: ..DR EAMW EB.V 99.. + 0x00, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x50, 0x55, 0x42, + //0x0390: .PUB LIC PUB + 0x4c, 0x49, 0x43, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x42, 0x4c, 0x41, 0x43, 0x4b, + //0x03a0: LIC ...B LACK + 0x44, 0x52, 0x41, 0x47, 0x4f, 0x4e, 0x20, 0x52, 0x59, 0x41, 0x4e, 0x20, 0x20, 0x20, 0x20, 0x20, + //0x03b0: DRAG ON R YAN + 0x20, 0x20, 0x00, 0x00, 0x00, 0x48, 0x45, 0x4e, 0x44, 0x52, 0x49, 0x58, 0x20, 0x20, 0x20, 0x20, + //0x03c0: .. .HEN DRIX + 0x20, 0x4c, 0x4f, 0x55, 0x49, 0x53, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x53, + //0x03d0: LOU IS ...S + 0x45, 0x50, 0x54, 0x49, 0x4d, 0x55, 0x53, 0x20, 0x20, 0x20, 0x20, 0x42, 0x45, 0x43, 0x4b, 0x45, + //0x03e0: EPTI MUS B ECKE + 0x54, 0x54, 0x20, 0x20, 0x20, 0x20, 0x00, 0xff, 0xff, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + //0x03f0: TT .. . + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x22, 0x52, 0x4f, 0x4f, 0x54, 0x20, 0x20, 0x20, 0x20, + //0x0400: ." ROOT + 0x20, 0x20, 0x20, 0x20, 0x00, 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + //0x0410: ." + 0x20, 0x20, 0x00, 0x0d, 0x0a, 0x0d, 0x0a, 0x24, 0x10, 0x12, 0x12, 0x11, 0x10, 0x10, 0x10, 0x01, + //0x0420: .. ...$ .... .... + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, //0x0430: .... .... .... .... - 0x02, 0x02, 0x02, 0x44, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x0440: ...D :... .... .... + 0x44, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + //0x0440: D:.. .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0450: .... .... .... .... - 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0460: .... .... .... .... - 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x02, 0x04, 0x01, 0x0a, 0x09, 0x08, 0x06, 0x0b, 0x04, 0x07, + 0x05, 0x00, 0x03, 0x02, 0x04, 0x01, 0x0a, 0x09, 0x08, 0x06, 0x0b, 0x04, 0x07, 0x07, 0x00, 0x00, //0x0470: .... .... .... .... - 0x07, 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, //0x0480: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0490: .... .... .... .... @@ -3068,7 +2909,7 @@ void DreamGenContext::__start() { //0x04e0: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x04f0: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, }; + 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, }; ds.assign(src, src + sizeof(src)); dreamweb(); } diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 139253cdb8..f6100557c1 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -32,9 +32,9 @@ namespace DreamGen { -static const uint16 offset_operand1 = 0x03fc; -static const uint16 offset_keys = 0x0392; -static const uint16 offset_rootdir = 0x040a; +static const uint16 offset_rootdir = 0x0407; +static const uint16 offset_operand1 = 0x03f9; +static const uint16 offset_keys = 0x038f; static const uint16 kStartvars = 0; static const uint16 kProgresspoints = 1; static const uint16 kWatchon = 2; @@ -157,220 +157,217 @@ static const uint16 kNewscreen = 149; static const uint16 kRyanx = 150; static const uint16 kRyany = 151; static const uint16 kLastflag = 152; -static const uint16 kLastflagex = 153; -static const uint16 kFlagx = 154; -static const uint16 kFlagy = 155; -static const uint16 kCurrentex = 156; -static const uint16 kCurrentfree = 157; -static const uint16 kFramesad = 158; -static const uint16 kDataad = 160; -static const uint16 kFrsegment = 162; -static const uint16 kObjectx = 164; -static const uint16 kObjecty = 166; -static const uint16 kOffsetx = 168; -static const uint16 kOffsety = 170; -static const uint16 kSavesize = 172; -static const uint16 kSavesource = 174; -static const uint16 kSavex = 176; -static const uint16 kSavey = 177; -static const uint16 kCurrentob = 178; -static const uint16 kPrioritydep = 179; -static const uint16 kDestpos = 180; -static const uint16 kReallocation = 181; -static const uint16 kRoomnum = 182; -static const uint16 kNowinnewroom = 183; -static const uint16 kResetmanxy = 184; -static const uint16 kNewlocation = 185; -static const uint16 kAutolocation = 186; -static const uint16 kMustload = 187; -static const uint16 kAnswered = 188; -static const uint16 kSaidno = 189; -static const uint16 kDoorcheck1 = 190; -static const uint16 kDoorcheck2 = 191; -static const uint16 kDoorcheck3 = 192; -static const uint16 kDoorcheck4 = 193; -static const uint16 kMousex = 194; -static const uint16 kMousey = 196; -static const uint16 kMousebutton = 198; -static const uint16 kMousebutton1 = 200; -static const uint16 kMousebutton2 = 202; -static const uint16 kMousebutton3 = 204; -static const uint16 kMousebutton4 = 206; -static const uint16 kOldbutton = 208; -static const uint16 kOldx = 210; -static const uint16 kOldy = 212; -static const uint16 kLastbutton = 214; -static const uint16 kOldpointerx = 216; -static const uint16 kOldpointery = 218; -static const uint16 kDelherex = 220; -static const uint16 kDelherey = 222; -static const uint16 kPointerxs = 224; -static const uint16 kPointerys = 225; -static const uint16 kDelxs = 226; -static const uint16 kDelys = 227; -static const uint16 kPointerframe = 228; -static const uint16 kPointerpower = 229; -static const uint16 kAuxpointerframe = 230; -static const uint16 kPointermode = 231; -static const uint16 kPointerspeed = 232; -static const uint16 kPointercount = 233; -static const uint16 kInmaparea = 234; -static const uint16 kSlotdata = 235; -static const uint16 kThisslot = 236; -static const uint16 kSlotflags = 237; -static const uint16 kTalkmode = 238; -static const uint16 kTalkpos = 239; -static const uint16 kCharacter = 240; -static const uint16 kPersondata = 241; -static const uint16 kTalknum = 243; -static const uint16 kNumberinroom = 244; -static const uint16 kCurrentcel = 245; -static const uint16 kOldselection = 246; -static const uint16 kStopwalking = 247; -static const uint16 kMouseon = 248; -static const uint16 kPlayed = 249; -static const uint16 kTimer1 = 251; -static const uint16 kTimer2 = 252; -static const uint16 kTimer3 = 253; -static const uint16 kWholetimer = 254; -static const uint16 kTimer1to = 256; -static const uint16 kTimer2to = 257; -static const uint16 kTimer3to = 258; -static const uint16 kWatchdump = 259; -static const uint16 kLogonum = 260; -static const uint16 kOldlogonum = 261; -static const uint16 kNewlogonum = 262; -static const uint16 kNetseg = 263; -static const uint16 kNetpoint = 265; -static const uint16 kKeynum = 267; -static const uint16 kCursorstate = 268; -static const uint16 kPressed = 269; -static const uint16 kPresspointer = 270; -static const uint16 kGraphicpress = 272; -static const uint16 kPresscount = 273; -static const uint16 kLightcount = 274; -static const uint16 kFolderpage = 275; -static const uint16 kDiarypage = 276; -static const uint16 kMenucount = 277; -static const uint16 kSymboltopx = 278; -static const uint16 kSymboltopnum = 279; -static const uint16 kSymboltopdir = 280; -static const uint16 kSymbolbotx = 281; -static const uint16 kSymbolbotnum = 282; -static const uint16 kSymbolbotdir = 283; -static const uint16 kSymboltolight = 284; -static const uint16 kSymbol1 = 285; -static const uint16 kSymbol2 = 286; -static const uint16 kSymbol3 = 287; -static const uint16 kSymbolnum = 288; -static const uint16 kDumpx = 289; -static const uint16 kDumpy = 291; -static const uint16 kWalkandexam = 293; -static const uint16 kWalkexamtype = 294; -static const uint16 kWalkexamnum = 295; -static const uint16 kCurslocx = 296; -static const uint16 kCurslocy = 298; -static const uint16 kCurpos = 300; -static const uint16 kMonadx = 302; -static const uint16 kMonady = 304; -static const uint16 kMonsource = 306; -static const uint16 kNumtodo = 308; -static const uint16 kTimecount = 310; -static const uint16 kCounttotimed = 312; -static const uint16 kTimedseg = 314; -static const uint16 kTimedoffset = 316; -static const uint16 kTimedy = 318; -static const uint16 kTimedx = 319; -static const uint16 kNeedtodumptimed = 320; -static const uint16 kLoadingorsave = 321; -static const uint16 kCurrentslot = 322; -static const uint16 kCursorpos = 323; -static const uint16 kColourpos = 324; -static const uint16 kFadedirection = 325; -static const uint16 kNumtofade = 326; -static const uint16 kFadecount = 327; -static const uint16 kAddtogreen = 328; -static const uint16 kAddtored = 329; -static const uint16 kAddtoblue = 330; -static const uint16 kLastsoundreel = 331; -static const uint16 kSpeechloaded = 333; -static const uint16 kSpeechlength = 334; -static const uint16 kVolume = 336; -static const uint16 kVolumeto = 337; -static const uint16 kVolumedirection = 338; -static const uint16 kVolumecount = 339; -static const uint16 kWongame = 340; -static const uint16 kLasthardkey = 341; -static const uint16 kBufferin = 342; -static const uint16 kBufferout = 344; -static const uint16 kExtras = 346; -static const uint16 kWorkspace = 348; -static const uint16 kMapstore = 350; -static const uint16 kCharset1 = 352; -static const uint16 kBuffers = 354; -static const uint16 kMainsprites = 356; -static const uint16 kBackdrop = 358; -static const uint16 kMapdata = 360; -static const uint16 kSounddata = 362; -static const uint16 kSounddata2 = 364; -static const uint16 kRecordspace = 366; -static const uint16 kFreedat = 368; -static const uint16 kSetdat = 370; -static const uint16 kReel1 = 372; -static const uint16 kReel2 = 374; -static const uint16 kReel3 = 376; -static const uint16 kRoomdesc = 378; -static const uint16 kFreedesc = 380; -static const uint16 kSetdesc = 382; -static const uint16 kBlockdesc = 384; -static const uint16 kSetframes = 386; -static const uint16 kFreeframes = 388; -static const uint16 kPeople = 390; -static const uint16 kReels = 392; -static const uint16 kCommandtext = 394; -static const uint16 kPuzzletext = 396; -static const uint16 kTraveltext = 398; -static const uint16 kTempgraphics = 400; -static const uint16 kTempgraphics2 = 402; -static const uint16 kTempgraphics3 = 404; -static const uint16 kTempsprites = 406; -static const uint16 kTextfile1 = 408; -static const uint16 kTextfile2 = 410; -static const uint16 kTextfile3 = 412; -static const uint16 kBlinkframe = 414; -static const uint16 kBlinkcount = 415; -static const uint16 kReasseschanges = 416; -static const uint16 kPointerspath = 417; -static const uint16 kManspath = 418; -static const uint16 kPointerfirstpath = 419; -static const uint16 kFinaldest = 420; -static const uint16 kDestination = 421; -static const uint16 kLinestartx = 422; -static const uint16 kLinestarty = 424; -static const uint16 kLineendx = 426; -static const uint16 kLineendy = 428; -static const uint16 kLinepointer = 430; -static const uint16 kLinedirection = 431; -static const uint16 kLinelength = 432; -static const uint16 kCh0blockstocopy = 433; -static const uint16 kCh0playing = 435; -static const uint16 kCh0repeat = 436; -static const uint16 kCh1playing = 437; -static const uint16 kCh1blockstocopy = 438; -static const uint16 kSoundbufferwrite = 440; -static const uint16 kCurrentsample = 442; -static const uint16 kRoomssample = 443; -static const uint16 kReelroutines = 444; -static const uint16 kBasicsample = 901; -static const uint16 kCurrentfile = 1048; -static const uint16 kRoomscango = 1123; -static const uint16 kRoompics = 1139; -static const uint16 kOplist = 1154; -static const uint16 kInputline = 1157; -static const uint16 kPresslist = 1285; -static const uint16 kQuitrequested = 1291; -static const uint16 kSubtitles = 1292; -static const uint16 kForeignrelease = 1293; +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 kNewlogonum = 259; +static const uint16 kNetseg = 260; +static const uint16 kNetpoint = 262; +static const uint16 kKeynum = 264; +static const uint16 kCursorstate = 265; +static const uint16 kPressed = 266; +static const uint16 kPresspointer = 267; +static const uint16 kGraphicpress = 269; +static const uint16 kPresscount = 270; +static const uint16 kLightcount = 271; +static const uint16 kFolderpage = 272; +static const uint16 kDiarypage = 273; +static const uint16 kMenucount = 274; +static const uint16 kSymboltopx = 275; +static const uint16 kSymboltopnum = 276; +static const uint16 kSymboltopdir = 277; +static const uint16 kSymbolbotx = 278; +static const uint16 kSymbolbotnum = 279; +static const uint16 kSymbolbotdir = 280; +static const uint16 kSymboltolight = 281; +static const uint16 kSymbol1 = 282; +static const uint16 kSymbol2 = 283; +static const uint16 kSymbol3 = 284; +static const uint16 kSymbolnum = 285; +static const uint16 kDumpx = 286; +static const uint16 kDumpy = 288; +static const uint16 kWalkandexam = 290; +static const uint16 kWalkexamtype = 291; +static const uint16 kWalkexamnum = 292; +static const uint16 kCurslocx = 293; +static const uint16 kCurslocy = 295; +static const uint16 kCurpos = 297; +static const uint16 kMonadx = 299; +static const uint16 kMonady = 301; +static const uint16 kMonsource = 303; +static const uint16 kNumtodo = 305; +static const uint16 kTimecount = 307; +static const uint16 kCounttotimed = 309; +static const uint16 kTimedseg = 311; +static const uint16 kTimedoffset = 313; +static const uint16 kTimedy = 315; +static const uint16 kTimedx = 316; +static const uint16 kNeedtodumptimed = 317; +static const uint16 kLoadingorsave = 318; +static const uint16 kCurrentslot = 319; +static const uint16 kCursorpos = 320; +static const uint16 kColourpos = 321; +static const uint16 kFadedirection = 322; +static const uint16 kNumtofade = 323; +static const uint16 kFadecount = 324; +static const uint16 kAddtogreen = 325; +static const uint16 kAddtored = 326; +static const uint16 kAddtoblue = 327; +static const uint16 kLastsoundreel = 328; +static const uint16 kSpeechloaded = 330; +static const uint16 kSpeechlength = 331; +static const uint16 kVolume = 333; +static const uint16 kVolumeto = 334; +static const uint16 kVolumedirection = 335; +static const uint16 kVolumecount = 336; +static const uint16 kWongame = 337; +static const uint16 kLasthardkey = 338; +static const uint16 kBufferin = 339; +static const uint16 kBufferout = 341; +static const uint16 kExtras = 343; +static const uint16 kWorkspace = 345; +static const uint16 kMapstore = 347; +static const uint16 kCharset1 = 349; +static const uint16 kBuffers = 351; +static const uint16 kMainsprites = 353; +static const uint16 kBackdrop = 355; +static const uint16 kMapdata = 357; +static const uint16 kSounddata = 359; +static const uint16 kSounddata2 = 361; +static const uint16 kRecordspace = 363; +static const uint16 kFreedat = 365; +static const uint16 kSetdat = 367; +static const uint16 kReel1 = 369; +static const uint16 kReel2 = 371; +static const uint16 kReel3 = 373; +static const uint16 kRoomdesc = 375; +static const uint16 kFreedesc = 377; +static const uint16 kSetdesc = 379; +static const uint16 kBlockdesc = 381; +static const uint16 kSetframes = 383; +static const uint16 kFreeframes = 385; +static const uint16 kPeople = 387; +static const uint16 kReels = 389; +static const uint16 kCommandtext = 391; +static const uint16 kPuzzletext = 393; +static const uint16 kTraveltext = 395; +static const uint16 kTempgraphics = 397; +static const uint16 kTempgraphics2 = 399; +static const uint16 kTempgraphics3 = 401; +static const uint16 kTempsprites = 403; +static const uint16 kTextfile1 = 405; +static const uint16 kTextfile2 = 407; +static const uint16 kTextfile3 = 409; +static const uint16 kBlinkframe = 411; +static const uint16 kBlinkcount = 412; +static const uint16 kReasseschanges = 413; +static const uint16 kPointerspath = 414; +static const uint16 kManspath = 415; +static const uint16 kPointerfirstpath = 416; +static const uint16 kFinaldest = 417; +static const uint16 kDestination = 418; +static const uint16 kLinestartx = 419; +static const uint16 kLinestarty = 421; +static const uint16 kLineendx = 423; +static const uint16 kLineendy = 425; +static const uint16 kLinepointer = 427; +static const uint16 kLinedirection = 428; +static const uint16 kLinelength = 429; +static const uint16 kCh0blockstocopy = 430; +static const uint16 kCh0playing = 432; +static const uint16 kCh0repeat = 433; +static const uint16 kCh1playing = 434; +static const uint16 kCh1blockstocopy = 435; +static const uint16 kSoundbufferwrite = 437; +static const uint16 kCurrentsample = 439; +static const uint16 kRoomssample = 440; +static const uint16 kReelroutines = 441; +static const uint16 kBasicsample = 898; +static const uint16 kCurrentfile = 1045; +static const uint16 kRoomscango = 1120; +static const uint16 kRoompics = 1136; +static const uint16 kOplist = 1151; +static const uint16 kInputline = 1154; +static const uint16 kPresslist = 1282; +static const uint16 kQuitrequested = 1288; +static const uint16 kSubtitles = 1289; +static const uint16 kForeignrelease = 1290; static const uint16 kBlocktextdat = (0); static const uint16 kPersonframes = (0); static const uint16 kDebuglevel1 = (0); @@ -409,8 +406,8 @@ static const uint16 kListofchanges = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768 static const uint16 kUndertimedtext = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)); static const uint16 kRainlist = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)); static const uint16 kInitialreelrouts = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)); -static const uint16 kInitialvars = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+901-444); -static const uint16 kLengthofbuffer = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+901-444+68-0); +static const uint16 kInitialvars = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+898-441); +static const uint16 kLengthofbuffer = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+898-441+68-0); static const uint16 kReellist = (0+(36*144)); static const uint16 kIntext = (0+(38*2)); static const uint16 kLengthofmap = (0+(66*60)); @@ -461,7 +458,7 @@ static const uint16 kKeypady = (72); static const uint16 kZoomx = (8); static const uint16 kInventx = (80); static const uint16 kMenux = (80+40); -static const uint16 kLenofreelrouts = (901-444); +static const uint16 kLenofreelrouts = (898-441); static const uint16 kHeaderlen = (96); @@ -480,17 +477,14 @@ public: void fillOpen(); void doSomeTalk(); void resetLocation(); - void adjustUp(); void outOfOpen(); void dirCom(); void findFirstPath(); void startTalk(); void getAnyAd(); void reminders(); - void checkForExit(); void lookInInterface(); void inToInv(); - void adjustLeft(); void deleteExText(); void getFreeAd(); void removeObFromInv(); @@ -533,12 +527,10 @@ public: void getExAd(); void initialMonCols(); void swapWithInv(); - void adjustRight(); void transferToEx(); void parser(); void emergencyPurge(); void transferConToEx(); - void adjustDown(); }; } // End of namespace DreamGen diff --git a/engines/dreamweb/sprite.cpp b/engines/dreamweb/sprite.cpp index cfa204ec23..1e980de015 100644 --- a/engines/dreamweb/sprite.cpp +++ b/engines/dreamweb/sprite.cpp @@ -148,7 +148,7 @@ void DreamGenContext::mainMan(Sprite *sprite) { if ((data.byte(kTurndirection) != 0) && (data.byte(kLinepointer) == 254)) { data.byte(kReasseschanges) = 1; if (data.byte(kFacing) == data.byte(kLeavedirection)) - checkForExit(); + checkForExit(sprite); } data.byte(kTurndirection) = 0; if (data.byte(kLinepointer) == 254) { @@ -168,7 +168,7 @@ void DreamGenContext::mainMan(Sprite *sprite) { if (data.byte(kTurntoface) == data.byte(kFacing)) { data.byte(kReasseschanges) = 1; if (data.byte(kFacing) == data.byte(kLeavedirection)) - checkForExit(); + checkForExit(sprite); } } } @@ -1215,4 +1215,61 @@ void DreamBase::liftNoise(uint8 index) { playChannel1(index); } +void DreamBase::checkForExit(Sprite *sprite) { + uint8 flag, flagEx, type, flagX, flagY; + checkOne(data.byte(kRyanx) + 12, data.byte(kRyany) + 12, &flag, &flagEx, &type, &flagX, &flagY); + data.byte(kLastflag) = flag; + + if (flag & 64) { + data.byte(kAutolocation) = flagEx; + return; + } + + if (!(flag & 32)) { + if (flag & 4) { + // adjust left + data.byte(kLastflag) = 0; + data.byte(kMapx) -= 11; + sprite->x = 16 * flagEx; + data.byte(kNowinnewroom) = 1; + } else if (flag & 2) { + // adjust right + data.byte(kMapx) += 11; + sprite->x = 16 * flagEx - 2; + data.byte(kNowinnewroom) = 1; + } else if (flag & 8) { + // adjust down + data.byte(kMapy) += 10; + sprite->y = 16 * flagEx; + data.byte(kNowinnewroom) = 1; + } else if (flag & 16) { + // adjust up + data.byte(kMapy) -= 10; + sprite->y = 16 * flagEx; + data.byte(kNowinnewroom) = 1; + } + + return; + } + + if (data.byte(kReallocation) == 2) { + // Can't leave Louis' until you found shoes + + int shoeCount = 0; + if (isRyanHolding("WETA")) shoeCount++; + if (isRyanHolding("WETB")) shoeCount++; + + if (shoeCount < 2) { + uint8 text = shoeCount ? 43 : 42; + setupTimedUse(text, 80, 10, 68, 64); + + data.byte(kTurntoface) = (data.byte(kFacing) + 4) & 7; + return; + } + + } + + data.byte(kNeedtotravel) = 1; +} + } // End of namespace DreamGen diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index a1d08b35d1..21d1038f3c 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -1454,7 +1454,6 @@ void DreamBase::getFlagUnderP(uint8 *flag, uint8 *flagEx) { uint8 type, flagX, flagY; checkOne(data.word(kMousex) - data.word(kMapadx), data.word(kMousey) - data.word(kMapady), flag, flagEx, &type, &flagX, &flagY); data.byte(kLastflag) = *flag; - data.byte(kLastflagex) = *flagEx; } void DreamGenContext::walkAndExamine() { @@ -1784,7 +1783,7 @@ void DreamGenContext::isRyanHolding() { flags._z = !isRyanHolding(id); } -bool DreamGenContext::isRyanHolding(const char *id) { +bool DreamBase::isRyanHolding(const char *id) { for (uint16 index = 0; index < kNumexobjects; index++) { DynObject *object = getExAd(index); if (object->mapad[0] == 4 && objectMatches(object, id)) diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index d9823fb2c0..2305b93d53 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -384,7 +384,9 @@ void findExObject(); uint16 findExObject(const char *id); void isRyanHolding(); - bool isRyanHolding(const char *id); + bool isRyanHolding(const char *id) { + return DreamBase::isRyanHolding(id); + } void describeOb(); void getOpenedSize(); byte getOpenedSizeCPP(); -- cgit v1.2.3 From b8ab0e62177916f82131b884d118a23e1afb3407 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sat, 17 Dec 2011 19:18:57 +0100 Subject: DREAMWEB: Fix regression in getOpenedSize --- engines/dreamweb/object.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index 29e6d52ba7..5bdfc07496 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -311,11 +311,11 @@ byte DreamGenContext::getOpenedSizeCPP() { byte obj = data.byte(kOpenedob); switch (data.byte(kOpenedtype)) { case 4: - return getExAd(obj)->b7; + return getExAd(obj)->b8; case 2: - return getFreeAd(obj)->b7; + return getFreeAd(obj)->b8; default: - return getSetAd(obj)->b3; + return getSetAd(obj)->b4; } } -- cgit v1.2.3 From 5958d2d29af136a7adcbc4dc2abbb8ee5e0fcbba Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sat, 17 Dec 2011 21:02:31 +0100 Subject: DREAMWEB: Name some DynObject/SetObject fields Also change getAnyAd() behaviour to be consistent between Free/Ex and Set objects, diverging from the original. --- engines/dreamweb/object.cpp | 6 +++--- engines/dreamweb/structs.h | 8 ++++---- engines/dreamweb/stubs.cpp | 16 ++++++++++------ 3 files changed, 17 insertions(+), 13 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index 5bdfc07496..e4abac14f2 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -311,11 +311,11 @@ byte DreamGenContext::getOpenedSizeCPP() { byte obj = data.byte(kOpenedob); switch (data.byte(kOpenedtype)) { case 4: - return getExAd(obj)->b8; + return getExAd(obj)->slotCount; case 2: - return getFreeAd(obj)->b8; + return getFreeAd(obj)->slotCount; default: - return getSetAd(obj)->b4; + return getSetAd(obj)->slotCount; } } diff --git a/engines/dreamweb/structs.h b/engines/dreamweb/structs.h index 30962a272c..28c462ef7d 100644 --- a/engines/dreamweb/structs.h +++ b/engines/dreamweb/structs.h @@ -76,8 +76,8 @@ struct SetObject { uint8 b0; uint8 b1; uint8 b2; - uint8 b3; - uint8 b4; + uint8 slotSize; + uint8 slotCount; uint8 priority; uint8 b6; uint8 delay; @@ -125,8 +125,8 @@ struct DynObject { uint8 currentLocation; uint8 index; uint8 mapad[5]; - uint8 b7; - uint8 b8; + uint8 slotSize; + uint8 slotCount; uint8 b9; uint8 b10; uint8 initialLocation; diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 21d1038f3c..1ba88405bc 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -1363,18 +1363,22 @@ DynObject *DreamBase::getEitherAdCPP() { void *DreamBase::getAnyAd(uint8 *value1, uint8 *value2) { if (data.byte(kObjecttype) == 4) { DynObject *exObject = getExAd(data.byte(kCommand)); - *value1 = exObject->b7; - *value2 = exObject->b8; + *value1 = exObject->slotSize; + *value2 = exObject->slotCount; return exObject; } else if (data.byte(kObjecttype) == 2) { DynObject *freeObject = getFreeAd(data.byte(kCommand)); - *value1 = freeObject->b7; - *value2 = freeObject->b8; + *value1 = freeObject->slotSize; + *value2 = freeObject->slotCount; return freeObject; } else { SetObject *setObject = getSetAd(data.byte(kCommand)); - *value1 = setObject->b4; - *value2 = setObject->priority; + // Note: the original returned slotCount/priority (bytes 4 and 5) + // instead of slotSize/slotCount (bytes 3 and 4). + // Changed this for consistency with the Ex/Free cases, and also + // with getOpenedSize() + *value1 = setObject->slotSize; + *value2 = setObject->slotCount; return setObject; } } -- cgit v1.2.3 From b0a42f115eb8333cb6f25eb713324ef778822bce Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sat, 17 Dec 2011 21:30:54 +0100 Subject: DREAMWEB: Use serializer for ReelRoutines --- engines/dreamweb/saveload.cpp | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/dreamweb/saveload.cpp b/engines/dreamweb/saveload.cpp index c77c419148..a47afdea63 100644 --- a/engines/dreamweb/saveload.cpp +++ b/engines/dreamweb/saveload.cpp @@ -25,12 +25,25 @@ #include "gui/saveload.h" #include "common/config-manager.h" #include "common/translation.h" +#include "common/serializer.h" namespace DreamGen { // Temporary storage for loading the room from a savegame Room g_madeUpRoomDat; + +void syncReelRoutine(Common::Serializer &s, ReelRoutine *reel) { + s.syncAsByte(reel->reallocation); + s.syncAsByte(reel->mapX); + s.syncAsByte(reel->mapY); + s.syncAsByte(reel->b3); + s.syncAsByte(reel->b4); + s.syncAsByte(reel->period); + s.syncAsByte(reel->counter); + s.syncAsByte(reel->b7); +} + void DreamGenContext::loadGame() { if (data.byte(kCommandtype) != 246) { data.byte(kCommandtype) = 246; @@ -405,6 +418,11 @@ void DreamGenContext::savePosition(unsigned int slot, const char *descbuf) { outSaveFile->write((const uint8 *)&madeUpRoom, sizeof(Room)); outSaveFile->write(data.ptr(kRoomscango, 16), 16); + // TODO: Convert more to serializer? + Common::Serializer s(0, outSaveFile); + for (unsigned int i = 0; 8*i < kLenofreelrouts; ++i) { + syncReelRoutine(s, (ReelRoutine*)data.ptr(kReelroutines + 8*i, 8)); + } outSaveFile->write(data.ptr(kReelroutines, len[5]), len[5]); outSaveFile->finalize(); @@ -454,7 +472,11 @@ void DreamGenContext::loadPosition(unsigned int slot) { inSaveFile->read((uint8 *)&g_madeUpRoomDat, sizeof(Room)); inSaveFile->read(data.ptr(kRoomscango, 16), 16); - inSaveFile->read(data.ptr(kReelroutines, len[5]), len[5]); + // TODO: Use serializer for more + Common::Serializer s(inSaveFile, 0); + for (unsigned int i = 0; 8*i < kLenofreelrouts; ++i) { + syncReelRoutine(s, (ReelRoutine*)data.ptr(kReelroutines + 8*i, 8)); + } delete inSaveFile; } -- cgit v1.2.3 From 46caa771640a37339a0b2e1ed7774d9f894fdc68 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sat, 17 Dec 2011 22:26:17 +0100 Subject: DREAMWEB: Add disabled reelRoutine conversion work --- engines/dreamweb/people.cpp | 79 +++++++++++++++++++++++++++++++++++++++++++ engines/dreamweb/saveload.cpp | 4 +++ engines/dreamweb/structs.h | 7 ++++ 3 files changed, 90 insertions(+) (limited to 'engines') diff --git a/engines/dreamweb/people.cpp b/engines/dreamweb/people.cpp index e8446f0445..af92d07439 100644 --- a/engines/dreamweb/people.cpp +++ b/engines/dreamweb/people.cpp @@ -56,6 +56,85 @@ static void (DreamGenContext::*reelCallbacks[57])(ReelRoutine &) = { &DreamBase::carParkDrip }; +#if 0 +// TODO: Enable this when the ReelRoutine list has been moved out of the +// data segment, all ReelCallbacks are in DreamBase, and the +// ReelRoutine::reelPointer field is a real member. +// See also struct ReelRoutine, clearBuffers, clearChanges, syncReelRoutine + +static const ReelRoutine g_initialReelRoutines[] = { +// Room number and x,y +// reel pointer +// speed,speed count,convers. no. + { 1,44,0, 20, 2,0,1 }, + { 1,55,0, 0, 50,20,0 }, + { 24,22,0, 74, 1,0,0 }, + { 24,33,10, 75, 1,0,1 }, + { 1,44,0, 27, 2,0,2 }, + { 1,44,0, 96, 3,0,4 }, + { 1,44,0, 118, 2,0,5 }, + { 1,44,10, 0, 2,0,0 }, + { 5,22,20, 53, 3,0,0 }, + { 5,22,20, 40, 1,0,2 }, + { 5,22,20, 50, 1,0,3 }, + { 2,11,10, 192, 1,0,0 }, + { 2,11,10, 182, 2,0,1 }, + { 8,11,10, 0, 2,0,1 }, + { 23,0,50, 0, 3,0,0 }, + { 28,11,20, 250, 4,0,0 }, + { 23,0,50, 43, 2,0,8 }, + { 23,11,40, 130, 2,0,1 }, + { 23,22,40, 122, 2,0,2 }, + { 23,22,40, 105, 2,0,3 }, + { 23,22,40, 81, 2,0,4 }, + { 23,11,40, 135, 2,0,5 }, + { 23,22,40, 145, 2,0,6 }, + { 4,22,30, 0, 2,0,0 }, + { 45,22,30, 200, 0,0,20 }, + { 45,22,30, 39, 2,0,0 }, + { 45,22,30, 25, 2,0,0 }, + { 8,22,40, 32, 2,0,0 }, + { 7,11,20, 64, 2,0,0 }, + { 22,22,20, 82, 2,0,0 }, + { 27,11,30, 0, 2,0,0 }, + { 20,0,30, 0, 2,0,0 }, + { 14,33,40, 21, 1,0,0 }, + { 29,11,10, 0, 1,0,0 }, + { 2,22,0, 2, 2,0,0 }, + { 25,0,50, 4, 2,0,0 }, + { 50,22,30, 121, 2,0,0 }, + { 50,22,30, 0, 20,0,0 }, + { 52,22,30, 192, 2,0,0 }, + { 52,22,30, 233, 2,0,0 }, + { 50,22,40, 104, 55,0,0 }, // ...., 65,0,0 for German CD + { 53,33,0, 99, 2,0,0 }, + { 50,22,40, 0, 3,0,0 }, + { 50,22,30, 162, 2,0,0 }, + { 52,22,30, 57, 2,0,0 }, + { 52,22,30, 0, 2,0,0 }, + { 54,0,0, 72, 3,0,0 }, + { 55,44,0, 0, 2,0,0 }, + { 19,0,0, 0, 28,0,0 }, + { 14,22,0, 2, 2,0,0 }, + { 14,22,0, 300, 1,0,0 }, + { 10,22,30, 174, 0,0,0 }, + { 12,22,20, 0, 1,0,0 }, + { 11,11,20, 0, 50,20,0 }, + { 11,11,30, 0, 50,20,0 }, + { 11,22,20, 0, 50,20,0 }, + { 14,33,40, 0, 50,20,0 }, + { 255,0,0, 0, 0,0,0 } +}; + +void DreamBase::setupInitialReelRoutines(ReelRoutine *dest) { + for (unsigned int i = 0; i < ARRAYSIZE(g_initialReelRoutines); ++i) { + dest[i] = g_initialReelRoutines[i]; + if (dest[i].period == 55 && isCD() && engine->getLanguage() == Common::DE_DEU) + dest[i].period = 65; + } +} +#endif + void DreamGenContext::updatePeople() { data.word(kListpos) = kPeoplelist; memset(getSegment(data.word(kBuffers)).ptr(kPeoplelist, 12 * sizeof(People)), 0xff, 12 * sizeof(People)); diff --git a/engines/dreamweb/saveload.cpp b/engines/dreamweb/saveload.cpp index a47afdea63..9cf3ea2c63 100644 --- a/engines/dreamweb/saveload.cpp +++ b/engines/dreamweb/saveload.cpp @@ -37,8 +37,12 @@ void syncReelRoutine(Common::Serializer &s, ReelRoutine *reel) { s.syncAsByte(reel->reallocation); s.syncAsByte(reel->mapX); s.syncAsByte(reel->mapY); +#if 1 s.syncAsByte(reel->b3); s.syncAsByte(reel->b4); +#else + s.syncAsUint16LE(reel->_reelPointer); +#endif s.syncAsByte(reel->period); s.syncAsByte(reel->counter); s.syncAsByte(reel->b7); diff --git a/engines/dreamweb/structs.h b/engines/dreamweb/structs.h index 28c462ef7d..709a3d2a8e 100644 --- a/engines/dreamweb/structs.h +++ b/engines/dreamweb/structs.h @@ -168,11 +168,18 @@ struct ReelRoutine { uint8 reallocation; uint8 mapX; uint8 mapY; +#if 0 + uint16 _reelPointer; + uint16 reelPointer() const { return _reelPointer; } + void setReelPointer(uint16 v) { _reelPointer = v; } + void incReelPointer() { _reelPointer++; } +#else uint8 b3; uint8 b4; uint16 reelPointer() const { return READ_LE_UINT16(&b3); } void setReelPointer(uint16 v) { WRITE_LE_UINT16(&b3, v); } void incReelPointer() { setReelPointer(reelPointer() + 1); } +#endif uint8 period; uint8 counter; uint8 b7; -- cgit v1.2.3 From 30089ec31504c862d4ad4317075af600d38a79a8 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sat, 17 Dec 2011 22:20:32 +0100 Subject: DREAMWEB: Convert clearBuffers, clearChanges --- engines/dreamweb/dreambase.h | 2 ++ engines/dreamweb/dreamgen.cpp | 67 ------------------------------------------- engines/dreamweb/dreamgen.h | 2 -- engines/dreamweb/stubs.cpp | 35 ++++++++++++++++++++++ 4 files changed, 37 insertions(+), 69 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 7c86696568..06936ca72d 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -390,6 +390,8 @@ public: void getTime(); void doChange(uint8 index, uint8 value, uint8 type); bool isRyanHolding(const char *id); + void clearBuffers(); + void clearChanges(); // from use.cpp void placeFreeObject(uint8 index); diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index ea4d8e5b05..3c3abe9ca4 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -2593,73 +2593,6 @@ gotkeyp: showDiaryPage(); } -void DreamGenContext::clearBuffers() { - STACK_CHECK; - es = data.word(kBuffers); - cx = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+898-441+68-0)/2; - ax = 0; - di = 0; - _stosw(cx, true); - es = data.word(kExtras); - cx = (0+2080+30000+(16*114)+((114+2)*2)+18000)/2; - ax = 0x0ffff; - di = 0; - _stosw(cx, true); - es = data.word(kBuffers); - di = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)); - ds = cs; - si = 441; - cx = (898-441); - _movsb(cx, true); - es = data.word(kBuffers); - di = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+898-441); - ds = cs; - si = 0; - cx = (68-0); - _movsb(cx, true); - clearChanges(); -} - -void DreamGenContext::clearChanges() { - STACK_CHECK; - es = data.word(kBuffers); - cx = (250)*2; - ax = 0x0ffff; - di = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)); - _stosw(cx, true); - ds = data.word(kBuffers); - si = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)); - es = cs; - di = 441; - cx = (898-441); - _movsb(cx, true); - ds = data.word(kBuffers); - si = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+898-441); - es = cs; - di = 0; - cx = (68-0); - _movsb(cx, true); - data.byte(kExpos) = 0; - data.word(kExframepos) = 0; - data.word(kExtextpos) = 0; - es = data.word(kExtras); - cx = (0+2080+30000+(16*114)+((114+2)*2)+18000)/2; - ax = 0x0ffff; - di = 0; - _stosw(cx, true); - es = cs; - di = 1120; - al = 1; - _stosb(2); - al = 0; - _stosb(); - al = 1; - _stosb(); - ax = 0; - cx = 6; - _stosw(cx, true); -} - void DreamGenContext::findPathOfPoint() { STACK_CHECK; push(ax); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index f6100557c1..98bab1bd0e 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -471,7 +471,6 @@ public: void fadeDownMon(); void getPersonText(); - void clearBuffers(); void getObTextStart(); void checkObjectSize(); void fillOpen(); @@ -522,7 +521,6 @@ public: void searchForString(); void selectOpenOb(); void incRyanPage(); - void clearChanges(); void searchForFiles(); void getExAd(); void initialMonCols(); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 1ba88405bc..eea38eb196 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -4593,4 +4593,39 @@ void DreamGenContext::showSlots() { } } +void DreamBase::clearBuffers() { + memset(getSegment(data.word(kBuffers)).ptr(0, kLengthofbuffer), 0, kLengthofbuffer); + + memset(getSegment(data.word(kExtras)).ptr(0, kLengthofextra), 0xFF, kLengthofextra); + + // TODO: Remove this line + // (once the ReelRoutines are no longer in the data segment) + memcpy(getSegment(data.word(kBuffers)).ptr(kInitialreelrouts, kLenofreelrouts), data.ptr(kReelroutines, kLenofreelrouts), kLenofreelrouts); + + memcpy(getSegment(data.word(kBuffers)).ptr(kInitialvars, kLengthofvars), data.ptr(kStartvars, kLengthofvars), kLengthofvars); + + clearChanges(); +} + +void DreamBase::clearChanges() { + memset(getSegment(data.word(kBuffers)).ptr(kListofchanges, 4*kNumchanges), 0xFF, 4*kNumchanges); + + // TODO: Call setupInitialReelRoutines instead + // (once the ReelRoutines are no longer in the data segment) + memcpy(data.ptr(kReelroutines, kLenofreelrouts), getSegment(data.word(kBuffers)).ptr(kInitialreelrouts, kLenofreelrouts), kLenofreelrouts); + + memcpy(data.ptr(kStartvars, kLengthofvars), getSegment(data.word(kBuffers)).ptr(kInitialvars, kLengthofvars), kLengthofvars); + + data.byte(kExpos) = 0; + data.word(kExframepos) = 0; + data.word(kExtextpos) = 0; + + memset(getSegment(data.word(kExtras)).ptr(0, kLengthofextra), 0xFF, kLengthofextra); + + const uint8 initialRoomsCanGo[] = { 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + + memcpy(data.ptr(kRoomscango, 16), initialRoomsCanGo, 16); +} + + } // End of namespace DreamGen -- cgit v1.2.3 From 10e163761223b919533ad8ff71d05f90001d6fb8 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sat, 17 Dec 2011 23:16:36 +0100 Subject: DREAMWEB: Fix regressions in findExObject, findSetObject --- engines/dreamweb/stubs.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index eea38eb196..7f1824d2bb 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -1745,6 +1745,7 @@ void DreamGenContext::findSetObject() { id[3] = ch; id[4] = '\0'; al = findSetObject(id); + es = data.word(kSetdat); bx = al * 64; } @@ -1765,7 +1766,8 @@ void DreamGenContext::findExObject() { id[3] = ch; id[4] = '\0'; al = findExObject(id); - bx = al * 16; + es = data.word(kExtras); + bx = kExdata + al * 16; } uint16 DreamGenContext::findExObject(const char *id) { -- cgit v1.2.3 From 656409c72bd4142781fc369a496b026edb2cb87c Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sat, 17 Dec 2011 23:28:26 +0100 Subject: DREAMWEB: Fix regression in slabdoorb --- engines/dreamweb/use.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp index ba1e8e4952..5b6e3f8dff 100644 --- a/engines/dreamweb/use.cpp +++ b/engines/dreamweb/use.cpp @@ -625,7 +625,7 @@ void DreamGenContext::sLabDoorB() { data.byte(kWatchspeed) = 1; data.byte(kSpeedcount) = 1; } else { - if (isRyanHolding("SHLD")) { + if (!isRyanHolding("SHLD")) { // No crystal showPuzText(44, 200); putBackObStuff(); -- cgit v1.2.3 From 2e8490448e4add482d622fe2e83b5125372aa67d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 18 Dec 2011 00:37:01 +0100 Subject: TSAGE: R2R - Scene 2800: Move several objects from scene to action2 --- engines/tsage/ringworld2/ringworld2_scenes2.cpp | 82 ++++++++++++------------- engines/tsage/ringworld2/ringworld2_scenes2.h | 6 +- 2 files changed, 44 insertions(+), 44 deletions(-) (limited to 'engines') diff --git a/engines/tsage/ringworld2/ringworld2_scenes2.cpp b/engines/tsage/ringworld2/ringworld2_scenes2.cpp index a61ff6ac9a..b851ed4e22 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes2.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes2.cpp @@ -4234,47 +4234,47 @@ void Scene2800::Action2::signal() { R2_GLOBALS._sound2.stop(); break; case 1: - scene->_object2.postInit(); - scene->_object2.setVisage(2800); - scene->_object2.setStrip(1); - scene->_object2._numFrames = 8; - scene->_object2._moveRate = 8; - scene->_object2.changeZoom(100); - scene->_object2.setPosition(Common::Point(1, 1)); - scene->_object2.show(); - scene->_object2.animate(ANIM_MODE_5, this); + _object2.postInit(); + _object2.setVisage(2800); + _object2.setStrip(1); + _object2._numFrames = 8; + _object2._moveRate = 8; + _object2.changeZoom(100); + _object2.setPosition(Common::Point(1, 1)); + _object2.show(); + _object2.animate(ANIM_MODE_5, this); break; case 2: R2_GLOBALS._sound2.play(130); - scene->_object2.setVisage(2800); - scene->_object2.setStrip(7); - - scene->_object3.postInit(); - scene->_object3.setVisage(2800); - scene->_object3.setStrip(3); - scene->_object3._numFrames = 8; - scene->_object3._moveRate = 8; - scene->_object3.changeZoom(100); - scene->_object3.setPosition(Common::Point(300, 104)); - scene->_object3.show(); - scene->_object3.animate(ANIM_MODE_5, this); + _object2.setVisage(2800); + _object2.setStrip(7); + + _object3.postInit(); + _object3.setVisage(2800); + _object3.setStrip(3); + _object3._numFrames = 8; + _object3._moveRate = 8; + _object3.changeZoom(100); + _object3.setPosition(Common::Point(300, 104)); + _object3.show(); + _object3.animate(ANIM_MODE_5, this); break; case 3: R2_GLOBALS._sound1.play(241); - scene->_object4.postInit(); - scene->_object4.setVisage(2800); - scene->_object4.setStrip(2); - scene->_object4._numFrames = 4; - scene->_object4._moveRate = 4; - scene->_object4.changeZoom(100); - scene->_object4.setPosition(Common::Point(300, 104)); - scene->_object4.fixPriority(105); - scene->_object4.show(); - scene->_object4.animate(ANIM_MODE_5, this); + _object4.postInit(); + _object4.setVisage(2800); + _object4.setStrip(2); + _object4._numFrames = 4; + _object4._moveRate = 4; + _object4.changeZoom(100); + _object4.setPosition(Common::Point(300, 104)); + _object4.fixPriority(105); + _object4.show(); + _object4.animate(ANIM_MODE_5, this); break; case 4: setDelay(18); - scene->_object4.setStrip(4); + _object4.setStrip(4); scene->_actor1.setVisage(2800); scene->_actor1.setStrip(5); scene->_actor1.setFrame(1); @@ -4389,23 +4389,23 @@ void Scene2800::Action2::signal() { break; case 17: setDelay(6); - scene->_object4.setStrip(2); - scene->_object4.setFrame(11); + _object4.setStrip(2); + _object4.setFrame(11); R2_GLOBALS._player.hide(); // No break on purpose case 18: R2_GLOBALS._sound1.play(241); - scene->_object4.animate(ANIM_MODE_6, this); + _object4.animate(ANIM_MODE_6, this); break; case 19: - scene->_object4.remove(); - scene->_object3.animate(ANIM_MODE_6, this); + _object4.remove(); + _object3.animate(ANIM_MODE_6, this); break; case 20: setDelay(6); - scene->_object3.remove(); - scene->_object2.setStrip(1); - scene->_object2.setFrame(19); + _object3.remove(); + _object2.setStrip(1); + _object2.setFrame(19); break; case 21: setDelay(150); @@ -4414,7 +4414,7 @@ void Scene2800::Action2::signal() { break; case 22: scene->_sceneMode = 12; - scene->_object2.animate(ANIM_MODE_6, scene); + _object2.animate(ANIM_MODE_6, scene); break; default: break; diff --git a/engines/tsage/ringworld2/ringworld2_scenes2.h b/engines/tsage/ringworld2/ringworld2_scenes2.h index 2097465a48..d007f7e9f5 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes2.h +++ b/engines/tsage/ringworld2/ringworld2_scenes2.h @@ -639,6 +639,9 @@ class Scene2800 : public SceneExt { void signal(); }; class Action2: public Action { + SceneObject _object2; + SceneObject _object3; + SceneObject _object4; public: void signal(); }; @@ -654,9 +657,6 @@ public: SceneObject _object1; Action1 _action1; Action2 _action2; - SceneObject _object2; - SceneObject _object3; - SceneObject _object4; SequenceManager _sequenceManager; int _field412; -- cgit v1.2.3 From 08fec8fa345cc3a76928059539ecd7ab5bd8a0e2 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 18 Dec 2011 02:54:51 +0200 Subject: DREAMWEB: Add meta information to saved games This information includes savegame versioning and the saved game's date/time, played time and game thumbnail. This information is stored into an unused data block of the original save format, so the generated ScummVM saves are (hopefully) fully compatible with the original ones and can be loaded in the original interpreter --- engines/dreamweb/detection.cpp | 70 ++++++++++++++++++++++++++++++++++++++++++ engines/dreamweb/dreamweb.h | 4 +++ engines/dreamweb/saveload.cpp | 53 +++++++++++++++++++++++++++++--- 3 files changed, 123 insertions(+), 4 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/detection.cpp b/engines/dreamweb/detection.cpp index db2155fc4c..b3483f9248 100644 --- a/engines/dreamweb/detection.cpp +++ b/engines/dreamweb/detection.cpp @@ -25,7 +25,10 @@ #include "common/algorithm.h" #include "common/system.h" +#include "graphics/thumbnail.h" + #include "dreamweb/dreamweb.h" +#include "dreamweb/structs.h" static const PlainGameDescriptor dreamWebGames[] = { { "dreamweb", "DreamWeb" }, @@ -56,6 +59,7 @@ public: virtual SaveStateList listSaves(const char *target) const; virtual int getMaximumSaveSlot() const; virtual void removeSaveState(const char *target, int slot) const; + SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; }; bool DreamWebMetaEngine::hasFeature(MetaEngineFeature f) const { @@ -63,6 +67,10 @@ bool DreamWebMetaEngine::hasFeature(MetaEngineFeature f) const { case kSupportsListSaves: case kSupportsLoadingDuringStartup: case kSupportsDeleteSave: + case kSavesSupportMetaInfo: + case kSavesSupportThumbnail: + case kSavesSupportCreationDate: + case kSavesSupportPlayTime: return true; default: return false; @@ -120,6 +128,68 @@ void DreamWebMetaEngine::removeSaveState(const char *target, int slot) const { g_system->getSavefileManager()->removeSavefile(fileName); } +SaveStateDescriptor DreamWebMetaEngine::querySaveMetaInfos(const char *target, int slot) const { + Common::String filename = Common::String::format("DREAMWEB.D%02d", slot); + Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(filename.c_str()); + + if (in) { + DreamGen::FileHeader header; + in->read((uint8 *)&header, sizeof(DreamGen::FileHeader)); + + Common::String saveName; + byte descSize = header.len(0); + byte i; + + for (i = 0; i < descSize; i++) + saveName += (char)in->readByte(); + + SaveStateDescriptor desc(slot, saveName); + desc.setDeletableFlag(true); + desc.setWriteProtectedFlag(false); + + // Check if there is a ScummVM data block + if (header.len(6) == SCUMMVM_BLOCK_MAGIC_SIZE) { + // Skip the game data + for (i = 1; i <= 5; i++) + in->skip(header.len(i)); + + uint32 tag = in->readUint32BE(); + if (tag != SCUMMVM_HEADER) { + warning("ScummVM data block found, but the block header is incorrect - skipping"); + delete in; + return desc; + } + + byte version = in->readByte(); + if (version > SAVEGAME_VERSION) { + warning("ScummVM data block found, but it has been saved with a newer version of ScummVM - skipping"); + delete in; + return desc; + } + + uint32 saveDate = in->readUint32LE(); + uint32 saveTime = in->readUint32LE(); + uint32 playTime = in->readUint32LE(); + Graphics::Surface *thumbnail = Graphics::loadThumbnail(*in); + + int day = (saveDate >> 24) & 0xFF; + int month = (saveDate >> 16) & 0xFF; + int year = saveDate & 0xFFFF; + int hour = (saveTime >> 16) & 0xFF; + int minutes = (saveTime >> 8) & 0xFF; + + desc.setSaveDate(year, month, day); + desc.setSaveTime(hour, minutes); + desc.setPlayTime(playTime * 1000); + desc.setThumbnail(thumbnail); + } + + return desc; + } + + return SaveStateDescriptor(); +} // End of namespace Toltecs + #if PLUGIN_ENABLED_DYNAMIC(DREAMWEB) REGISTER_PLUGIN_DYNAMIC(DREAMWEB, PLUGIN_TYPE_ENGINE, DreamWebMetaEngine); #else diff --git a/engines/dreamweb/dreamweb.h b/engines/dreamweb/dreamweb.h index 7ff0005fa4..4d7bf5f0e4 100644 --- a/engines/dreamweb/dreamweb.h +++ b/engines/dreamweb/dreamweb.h @@ -42,6 +42,10 @@ #include "dreamweb/structs.h" +#define SCUMMVM_HEADER MKTAG('S', 'C', 'V', 'M') +#define SCUMMVM_BLOCK_MAGIC_SIZE 0x1234 +#define SAVEGAME_VERSION 1 + namespace DreamGen { // These are for ReelRoutine::reelPointer, which is a callback field. diff --git a/engines/dreamweb/saveload.cpp b/engines/dreamweb/saveload.cpp index 9cf3ea2c63..599ef45c66 100644 --- a/engines/dreamweb/saveload.cpp +++ b/engines/dreamweb/saveload.cpp @@ -22,6 +22,7 @@ #include "dreamweb/dreamweb.h" #include "engines/metaengine.h" +#include "graphics/thumbnail.h" #include "gui/saveload.h" #include "common/config-manager.h" #include "common/translation.h" @@ -216,7 +217,6 @@ void DreamGenContext::saveGame() { descbuf[++desclen] = 0; while (desclen < 16) descbuf[++desclen] = 1; - savePosition(savegameId, descbuf); // TODO: The below is copied from actualsave getRidOfTemp(); @@ -225,6 +225,12 @@ void DreamGenContext::saveGame() { data.word(kTextaddressy) = 182; data.byte(kTextlen) = 240; redrawMainScrn(); + workToScreenCPP(); // show the main screen without the mouse pointer + + // We need to save after the scene has been redrawn, to capture the + // correct screen thumbnail + savePosition(savegameId, descbuf); + workToScreenM(); data.byte(kGetback) = 4; } @@ -387,9 +393,6 @@ void DreamGenContext::savePosition(unsigned int slot, const char *descbuf) { madeUpRoom.facing = data.byte(kFacing); madeUpRoom.b27 = 255; - - engine->processEvents(); // TODO: Is this necessary? - Common::String filename = engine->getSavegameFilename(slot); debug(1, "savePosition: slot %d filename %s", slot, filename.c_str()); Common::OutSaveFile *outSaveFile = engine->getSaveFileManager()->openForSaving(filename); @@ -412,6 +415,11 @@ void DreamGenContext::savePosition(unsigned int slot, const char *descbuf) { for (int i = 0; i < 6; ++i) header.setLen(i, len[i]); + // Write a new section with data that we need for ScummVM (version, + // thumbnail, played time etc). We don't really care for its size, + // so we just set it to a magic number. + header.setLen(6, SCUMMVM_BLOCK_MAGIC_SIZE); + outSaveFile->write((const uint8 *)&header, sizeof(FileHeader)); outSaveFile->write(descbuf, len[0]); outSaveFile->write(data.ptr(kStartvars, len[1]), len[1]); @@ -429,6 +437,19 @@ void DreamGenContext::savePosition(unsigned int slot, const char *descbuf) { } outSaveFile->write(data.ptr(kReelroutines, len[5]), len[5]); + // ScummVM data block + outSaveFile->writeUint32BE(SCUMMVM_HEADER); + outSaveFile->writeByte(SAVEGAME_VERSION); + TimeDate curTime; + g_system->getTimeAndDate(curTime); + uint32 saveDate = ((curTime.tm_mday & 0xFF) << 24) | (((curTime.tm_mon + 1) & 0xFF) << 16) | ((curTime.tm_year + 1900) & 0xFFFF); + uint32 saveTime = ((curTime.tm_hour & 0xFF) << 16) | (((curTime.tm_min) & 0xFF) << 8) | ((curTime.tm_sec) & 0xFF); + uint32 playTime = g_engine->getTotalPlayTime() / 1000; + outSaveFile->writeUint32LE(saveDate); + outSaveFile->writeUint32LE(saveTime); + outSaveFile->writeUint32LE(playTime); + Graphics::saveThumbnail(*outSaveFile); + outSaveFile->finalize(); if (outSaveFile->err()) { // TODO: Do proper error handling @@ -482,6 +503,30 @@ void DreamGenContext::loadPosition(unsigned int slot) { syncReelRoutine(s, (ReelRoutine*)data.ptr(kReelroutines + 8*i, 8)); } + // Check if there's a ScummVM data block + if (header.len(6) == SCUMMVM_BLOCK_MAGIC_SIZE) { + uint32 tag = inSaveFile->readUint32BE(); + if (tag != SCUMMVM_HEADER) { + warning("ScummVM data block found, but the block header is incorrect - skipping"); + delete inSaveFile; + return; + } + + byte version = inSaveFile->readByte(); + if (version > SAVEGAME_VERSION) { + warning("ScummVM data block found, but it has been saved with a newer version of ScummVM - skipping"); + delete inSaveFile; + return; + } + + inSaveFile->skip(4); // saveDate + inSaveFile->skip(4); // saveTime + uint32 playTime = inSaveFile->readUint32LE(); + g_engine->setTotalPlayTime(playTime * 1000); + + // The thumbnail data follows, but we don't need it here + } + delete inSaveFile; } -- cgit v1.2.3 From 83b31ccb1d79276cbb04cd33c8a133bc0039003a Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 18 Dec 2011 03:07:54 +0200 Subject: DREAMWEB: Remove an erroneous comment (copy/paste error) --- engines/dreamweb/detection.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/dreamweb/detection.cpp b/engines/dreamweb/detection.cpp index b3483f9248..b5ec6e8e69 100644 --- a/engines/dreamweb/detection.cpp +++ b/engines/dreamweb/detection.cpp @@ -188,7 +188,7 @@ SaveStateDescriptor DreamWebMetaEngine::querySaveMetaInfos(const char *target, i } return SaveStateDescriptor(); -} // End of namespace Toltecs +} #if PLUGIN_ENABLED_DYNAMIC(DREAMWEB) REGISTER_PLUGIN_DYNAMIC(DREAMWEB, PLUGIN_TYPE_ENGINE, DreamWebMetaEngine); -- cgit v1.2.3 From 9818def85b7ede9635a918e3635b521de7e996b2 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 18 Dec 2011 03:28:21 +0200 Subject: DREAMWEB: Port 'lookininterface' to C++ --- engines/dreamweb/dreamgen.cpp | 19 ------------------- engines/dreamweb/dreamgen.h | 3 +-- engines/dreamweb/monitor.cpp | 13 ++++++++----- 3 files changed, 9 insertions(+), 26 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 3c3abe9ca4..72f2feca0e 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -2044,25 +2044,6 @@ clearedlocations: es.byte(bx) = 0; } -void DreamGenContext::lookInInterface() { - STACK_CHECK; - al = 'I'; - ah = 'N'; - cl = 'T'; - ch = 'F'; - findSetObject(); - ah = 1; - checkInside(); - _cmp(cl, (114)); - if (flags.z()) - goto emptyinterface; - al = es.byte(bx+15); - _inc(al); - return; -emptyinterface: - al = 0; -} - void DreamGenContext::dirCom() { STACK_CHECK; cx = 30; diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 98bab1bd0e..29cd6e39ab 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -473,7 +473,6 @@ public: void getPersonText(); void getObTextStart(); void checkObjectSize(); - void fillOpen(); void doSomeTalk(); void resetLocation(); void outOfOpen(); @@ -482,7 +481,6 @@ public: void startTalk(); void getAnyAd(); void reminders(); - void lookInInterface(); void inToInv(); void deleteExText(); void getFreeAd(); @@ -505,6 +503,7 @@ public: void rollEm(); void lookAtPlace(); void findAllOpen(); + void fillOpen(); void deleteExObject(); void getEitherAd(); void setPickup(); diff --git a/engines/dreamweb/monitor.cpp b/engines/dreamweb/monitor.cpp index 30ba9b88e0..577d5701ee 100644 --- a/engines/dreamweb/monitor.cpp +++ b/engines/dreamweb/monitor.cpp @@ -403,15 +403,18 @@ void DreamGenContext::loadNews() { } void DreamGenContext::loadCart() { - lookInInterface(); + byte cartridgeId = 0; + uint16 objectIndex = findSetObject("INTF"); + if (checkInside(objectIndex, 1) != kNumexobjects) + cartridgeId = getSetAd(objectIndex)->name[0] + 1; - if (al == 0) + if (cartridgeId == 0) data.word(kTextfile3) = standardLoad("DREAMWEB.T20"); // monitor file 20 - else if (al == 1) + else if (cartridgeId == 1) data.word(kTextfile3) = standardLoad("DREAMWEB.T21"); // monitor file 21 - else if (al == 2) + else if (cartridgeId == 2) data.word(kTextfile3) = standardLoad("DREAMWEB.T22"); // monitor file 22 - else if (al == 3) + else if (cartridgeId == 3) data.word(kTextfile3) = standardLoad("DREAMWEB.T23"); // monitor file 23 else data.word(kTextfile3) = standardLoad("DREAMWEB.T24"); // monitor file 24 -- cgit v1.2.3 From f69dfba21a5d4be8cc60a20a0dd0628717fa5373 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 18 Dec 2011 18:08:45 +1100 Subject: TSAGE: Implemented dirty rect handling in the engine This should help improve performance when scalers are being used. --- engines/tsage/blue_force/blueforce_dialogs.cpp | 4 +- engines/tsage/converse.cpp | 2 +- engines/tsage/core.cpp | 4 +- engines/tsage/events.cpp | 6 +- engines/tsage/globals.cpp | 8 +- engines/tsage/graphics.cpp | 144 ++++++++++++++++++++---- engines/tsage/graphics.h | 14 ++- engines/tsage/ringworld/ringworld_dialogs.cpp | 4 +- engines/tsage/ringworld/ringworld_logic.cpp | 2 +- engines/tsage/ringworld/ringworld_scenes3.cpp | 6 +- engines/tsage/ringworld/ringworld_scenes5.cpp | 4 +- engines/tsage/ringworld2/ringworld2_dialogs.cpp | 2 +- engines/tsage/scenes.cpp | 2 +- 13 files changed, 156 insertions(+), 46 deletions(-) (limited to 'engines') diff --git a/engines/tsage/blue_force/blueforce_dialogs.cpp b/engines/tsage/blue_force/blueforce_dialogs.cpp index b9b3ad6c22..6f294d263a 100644 --- a/engines/tsage/blue_force/blueforce_dialogs.cpp +++ b/engines/tsage/blue_force/blueforce_dialogs.cpp @@ -163,7 +163,7 @@ void RightClickDialog::execute() { } g_system->delayMillis(10); - g_system->updateScreen(); + GLOBALS._screenSurface.copyToScreen(); } // Execute the specified action @@ -243,7 +243,7 @@ void AmmoBeltDialog::execute() { } g_system->delayMillis(10); - g_system->updateScreen(); + GLOBALS._screenSurface.copyToScreen(); } _gfxManager.deactivate(); diff --git a/engines/tsage/converse.cpp b/engines/tsage/converse.cpp index b802f71ff3..00c0b3a1f1 100644 --- a/engines/tsage/converse.cpp +++ b/engines/tsage/converse.cpp @@ -451,7 +451,7 @@ int ConversationChoiceDialog::execute(const Common::StringArray &choiceList) { while (!g_globals->_events.getEvent(event, EVENT_KEYPRESS | EVENT_BUTTON_DOWN | EVENT_MOUSE_MOVE) && !g_vm->shouldQuit()) { g_system->delayMillis(10); - g_system->updateScreen(); + GLOBALS._screenSurface.copyToScreen(); } if (g_vm->shouldQuit()) break; diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp index 9d7c8abf0a..c243624608 100644 --- a/engines/tsage/core.cpp +++ b/engines/tsage/core.cpp @@ -1415,7 +1415,7 @@ void ScenePalette::fade(const byte *adjustData, bool fullAdjust, int percent) { // Set the altered pale4tte g_system->getPaletteManager()->setPalette((const byte *)&tempPalette[0], 0, 256); - g_system->updateScreen(); + GLOBALS._screenSurface.copyToScreen(); } PaletteRotation *ScenePalette::addRotation(int start, int end, int rotationMode, int duration, Action *action) { @@ -1708,7 +1708,7 @@ void SceneItem::display(int resNum, int lineNum, ...) { // Keep event on-screen until a mouse or keypress while (!g_vm->shouldQuit() && !g_globals->_events.getEvent(event, EVENT_BUTTON_DOWN | EVENT_KEYPRESS)) { - g_system->updateScreen(); + GLOBALS._screenSurface.copyToScreen(); g_system->delayMillis(10); } diff --git a/engines/tsage/events.cpp b/engines/tsage/events.cpp index 152570b187..21dc86b8ec 100644 --- a/engines/tsage/events.cpp +++ b/engines/tsage/events.cpp @@ -49,8 +49,8 @@ bool EventsClass::pollEvent() { _priorFrameTime = milli; ++_frameNumber; - // Update screen - g_system->updateScreen(); + // Update the physical screen with any updates to the screen surface + GLOBALS._screenSurface.copyToScreen(); } if (!g_system->getEventManager()->pollEvent(_event)) return false; @@ -395,7 +395,7 @@ void EventsClass::delay(int numFrames) { _priorFrameTime = g_system->getMillis(); } - g_system->updateScreen(); + GLOBALS._screenSurface.copyToScreen(); _prevDelayFrame = _frameNumber; _priorFrameTime = g_system->getMillis(); } diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp index 769ad4c054..1d0e37d071 100644 --- a/engines/tsage/globals.cpp +++ b/engines/tsage/globals.cpp @@ -108,9 +108,15 @@ Globals::Globals() : _dialogCenter(160, 140), _gfxManagerInstance(_screenSurface _color2 = _gfxColors.foreground; _color3 = _gfxColors.foreground; } - _screenSurface.setScreenSurface(); + + // Set up a buffer for the screen surface + _screenSurface.create(SCREEN_WIDTH, SCREEN_HEIGHT); + _screenSurface.trackDirtyRects(); + + // Add the global graphics manager to the graphic manager list _gfxManagers.push_back(&_gfxManagerInstance); + // Set up the global scene objects list _sceneObjects = &_sceneObjectsInstance; _sceneObjects_queue.push_front(_sceneObjects); diff --git a/engines/tsage/graphics.cpp b/engines/tsage/graphics.cpp index 171167c2ea..bc4ce75c22 100644 --- a/engines/tsage/graphics.cpp +++ b/engines/tsage/graphics.cpp @@ -220,11 +220,10 @@ void Rect::synchronize(Serializer &s) { GfxSurface::GfxSurface() : _bounds(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT) { _disableUpdates = false; - _screenSurface = false; _lockSurfaceCtr = 0; _customSurface = NULL; - _screenSurfaceP = NULL; _transColor = -1; + _trackDirtyRects = false; } GfxSurface::GfxSurface(const GfxSurface &s) { @@ -241,12 +240,41 @@ GfxSurface::~GfxSurface() { } /** - * Specifies that the surface will encapsulate the ScummVM screen surface + * Turns on dirty rectangle tracking for the surface */ -void GfxSurface::setScreenSurface() { - _screenSurface = true; - _customSurface = NULL; - _lockSurfaceCtr = 0; +void GfxSurface::trackDirtyRects() { + _trackDirtyRects = true; +} + +void GfxSurface::addDirtyRect(const Rect &r) { + if (_trackDirtyRects) + _dirtyRects.push_back(Rect(r.left, r.top, + MIN(r.right + 1, SCREEN_WIDTH), MIN(r.bottom + 1, SCREEN_HEIGHT))); +} + +/** + * Copies all areas specified by the dirty rect list to the screen + */ +void GfxSurface::copyToScreen() { + assert(_trackDirtyRects); + + // Merge any overlapping dirty rects + mergeDirtyRects(); + + // Loop through the dirty rect list to copy the affected areas to the sc + for (Common::List::iterator i = _dirtyRects.begin(); i != _dirtyRects.end(); ++i) { + Rect r = *i; + + const byte *srcP = (const byte *)_customSurface->getBasePtr(r.left, r.top); + g_system->copyRectToScreen(srcP, _customSurface->pitch, r.left, r.top, + r.width(), r.height()); + } + + // Update the physical screen + g_system->updateScreen(); + + // Now that the dirty rects have been copied, clear the dirty rect list + _dirtyRects.clear(); } /** @@ -254,11 +282,13 @@ void GfxSurface::setScreenSurface() { */ void GfxSurface::create(int width, int height) { assert((width >= 0) && (height >= 0)); - _screenSurface = false; + + // Delete any prior internal surface that may have been previously created if (_customSurface) { _customSurface->free(); delete _customSurface; } + _customSurface = new Graphics::Surface(); _customSurface->create(width, height, Graphics::PixelFormat::createFormatCLUT8()); Common::fill((byte *)_customSurface->pixels, (byte *)_customSurface->pixels + (width * height), 0); @@ -271,13 +301,7 @@ void GfxSurface::create(int width, int height) { Graphics::Surface GfxSurface::lockSurface() { ++_lockSurfaceCtr; - Graphics::Surface *src; - if (_screenSurface) { - if (_lockSurfaceCtr == 1) - _screenSurfaceP = g_system->lockScreen(); - src = _screenSurfaceP; - } else - src = _customSurface; + Graphics::Surface *src = _customSurface; assert(src); // Setup the returned surface either as one pointing to the same pixels as the source, or @@ -298,15 +322,10 @@ Graphics::Surface GfxSurface::lockSurface() { void GfxSurface::unlockSurface() { assert(_lockSurfaceCtr > 0); --_lockSurfaceCtr; - - if ((_lockSurfaceCtr == 0) && _screenSurface) { - g_system->unlockScreen(); - } } void GfxSurface::synchronize(Serializer &s) { assert(!_lockSurfaceCtr); - assert(!_screenSurface); s.syncAsByte(_disableUpdates); _bounds.synchronize(s); @@ -351,6 +370,7 @@ void GfxSurface::fillRect(const Rect &bounds, int color) { Graphics::Surface surface = lockSurface(); surface.fillRect(bounds, color); unlockSurface(); + addDirtyRect(bounds); } GfxSurface &GfxSurface::operator=(const GfxSurface &s) { @@ -363,7 +383,6 @@ GfxSurface &GfxSurface::operator=(const GfxSurface &s) { } _customSurface = s._customSurface; - _screenSurface = s._screenSurface; _disableUpdates = s._disableUpdates; _bounds = s._bounds; _centroid = s._centroid; @@ -567,10 +586,17 @@ void GfxSurface::copyFrom(GfxSurface &src, Rect srcBounds, Rect destBounds, Regi if (destBounds.bottom > destSurface.h) destBounds.bottom = destSurface.h; - if (destBounds.isValidRect()) { + if (destBounds.isValidRect() && (destBounds.left < SCREEN_WIDTH) && (destBounds.right >= 0) && + (destBounds.top < SCREEN_HEIGHT) && (destBounds.bottom >= 0)) { + // Register the affected area as dirty + addDirtyRect(Rect(destBounds.left + _bounds.left, destBounds.top + _bounds.top, + destBounds.right + _bounds.left, destBounds.bottom + _bounds.top)); + + // Get pointers to the source and destination surface areas const byte *pSrc = (const byte *)srcSurface.getBasePtr(srcX, srcY); byte *pDest = (byte *)destSurface.getBasePtr(destBounds.left, destBounds.top); + // Loop through copying each row for (int y = 0; y < destBounds.height(); ++y, pSrc += srcSurface.pitch, pDest += destSurface.pitch) { if (!priorityRegion && (src._transColor == -1)) @@ -595,6 +621,7 @@ void GfxSurface::copyFrom(GfxSurface &src, Rect srcBounds, Rect destBounds, Regi } } + // Unlock the surfaces unlockSurface(); srcImage.unlockSurface(); } @@ -613,6 +640,68 @@ void GfxSurface::draw(const Common::Point &pt, Rect *rect) { } } +/** + * Merges any clipping rectangles that overlap to try and reduce + * the total number of clip rectangles. + */ +void GfxSurface::mergeDirtyRects() { + if (_dirtyRects.size() <= 1) + return; + + Common::List::iterator rOuter, rInner; + + for (rOuter = _dirtyRects.begin(); rOuter != _dirtyRects.end(); ++rOuter) { + rInner = rOuter; + while (++rInner != _dirtyRects.end()) { + + if (looseIntersectRectangle(*rOuter, *rInner)) { + // these two rectangles overlap or + // are next to each other - merge them + + unionRectangle(*rOuter, *rOuter, *rInner); + + // remove the inner rect from the list + _dirtyRects.erase(rInner); + + // move back to beginning of list + rInner = rOuter; + } + } + } +} + +/** + * Check if the two rectangles are next to each other. + * @param pSrc1 a source rectangle + * @param pSrc2 a source rectangle + */ +bool GfxSurface::looseIntersectRectangle(const Rect &src1, const Rect &src2) { + Rect destRect; + + destRect.left = MAX(src1.left, src2.left); + destRect.top = MAX(src1.top, src2.top); + destRect.right = MIN(src1.right, src2.right); + destRect.bottom = MIN(src1.bottom, src2.bottom); + + return destRect.isValidRect(); +} + +/** + * Creates the union of two rectangles. + * Returns True if there is a union. + * @param pDest destination rectangle that is to receive the new union + * @param pSrc1 a source rectangle + * @param pSrc2 a source rectangle + */ +bool GfxSurface::unionRectangle(Common::Rect &destRect, const Rect &src1, const Rect &src2) { + destRect.left = MIN(src1.left, src2.left); + destRect.top = MIN(src1.top, src2.top); + destRect.right = MAX(src1.right, src2.right); + destRect.bottom = MAX(src1.bottom, src2.bottom); + + return !destRect.isEmpty(); +} + /*--------------------------------------------------------------------------*/ GfxElement::GfxElement() { @@ -639,6 +728,9 @@ void GfxElement::highlight() { GfxManager &gfxManager = g_globals->gfxManager(); Graphics::Surface surface = gfxManager.lockSurface(); + // Mark the area is dirty + gfxManager.addDirtyRect(_bounds); + // Scan through the contents of the element, switching any occurances of the foreground // color with the background color and vice versa Rect tempRect(_bounds); @@ -734,6 +826,7 @@ void GfxElement::drawFrame() { gfxManager.fillRect2(tempRect.right, tempRect.top + 2, 1, tempRect.height() - 3, 0); gfxManager.unlockSurface(); + gfxManager.addDirtyRect(_bounds); } /** @@ -1090,7 +1183,7 @@ GfxButton *GfxDialog::execute(GfxButton *defaultButton) { } g_system->delayMillis(10); - g_system->updateScreen(); + GLOBALS._screenSurface.copyToScreen(); } _gfxManager.deactivate(); @@ -1174,6 +1267,11 @@ void GfxManager::fillArea(int xp, int yp, int color) { _surface.fillRect(tempRect, color); } +void GfxManager::addDirtyRect(const Rect &r) { + _surface.addDirtyRect(Rect(r.left + _bounds.left, r.top + _bounds.top, + r.right + _bounds.left, r.bottom + _bounds.top)); +} + void GfxManager::fillRect(const Rect &bounds, int color) { _surface.setBounds(_bounds); _surface.fillRect(bounds, color); diff --git a/engines/tsage/graphics.h b/engines/tsage/graphics.h index dba3401700..e32994505c 100644 --- a/engines/tsage/graphics.h +++ b/engines/tsage/graphics.h @@ -74,12 +74,16 @@ public: class GfxSurface { private: Graphics::Surface *_customSurface; - Graphics::Surface *_screenSurfaceP; int _lockSurfaceCtr; - bool _screenSurface; bool _disableUpdates; Rect _bounds; + bool _trackDirtyRects; + Common::List _dirtyRects; + + void mergeDirtyRects(); + bool looseIntersectRectangle(const Rect &src1, const Rect &src2); + bool unionRectangle(Common::Rect &destRect, const Rect &src1, const Rect &src2); public: Common::Point _centroid; int _transColor; @@ -88,7 +92,9 @@ public: GfxSurface(const GfxSurface &s); ~GfxSurface(); - void setScreenSurface(); + void trackDirtyRects(); + void addDirtyRect(const Rect &r); + void copyToScreen(); Graphics::Surface lockSurface(); void unlockSurface(); void synchronize(Serializer &s); @@ -274,6 +280,7 @@ public: return _surface.lockSurface(); } void unlockSurface() { _surface.unlockSurface(); } + void addDirtyRect(const Rect &r); void fillArea(int xp, int yp, int color); void fillRect(const Rect &bounds, int color); void fillRect2(int xs, int ys, int width, int height, int color); @@ -301,7 +308,6 @@ public: void copyFrom(GfxSurface &src, int destX, int destY) { _surface.setBounds(_bounds); _surface.copyFrom(src, destX, destY); - g_system->updateScreen(); } GfxSurface &getSurface() { _surface.setBounds(_bounds); diff --git a/engines/tsage/ringworld/ringworld_dialogs.cpp b/engines/tsage/ringworld/ringworld_dialogs.cpp index 37101c9c58..d0d5ab7b4a 100644 --- a/engines/tsage/ringworld/ringworld_dialogs.cpp +++ b/engines/tsage/ringworld/ringworld_dialogs.cpp @@ -183,7 +183,7 @@ void RightClickDialog::execute() { } g_system->delayMillis(10); - g_system->updateScreen(); + GLOBALS._screenSurface.copyToScreen(); } // Execute the specified action @@ -394,7 +394,7 @@ void InventoryDialog::execute() { Event event; while (!g_globals->_events.getEvent(event) && !g_vm->shouldQuit()) { g_system->delayMillis(10); - g_system->updateScreen(); + GLOBALS._screenSurface.copyToScreen(); } if (g_vm->shouldQuit()) break; diff --git a/engines/tsage/ringworld/ringworld_logic.cpp b/engines/tsage/ringworld/ringworld_logic.cpp index c87b95e0b8..2497327a01 100644 --- a/engines/tsage/ringworld/ringworld_logic.cpp +++ b/engines/tsage/ringworld/ringworld_logic.cpp @@ -315,7 +315,7 @@ void SceneArea::wait() { // Wait until a mouse or keypress Event event; while (!g_vm->shouldQuit() && !g_globals->_events.getEvent(event)) { - g_system->updateScreen(); + GLOBALS._screenSurface.copyToScreen(); g_system->delayMillis(10); } diff --git a/engines/tsage/ringworld/ringworld_scenes3.cpp b/engines/tsage/ringworld/ringworld_scenes3.cpp index 81190aea7b..6f3d1ed93a 100644 --- a/engines/tsage/ringworld/ringworld_scenes3.cpp +++ b/engines/tsage/ringworld/ringworld_scenes3.cpp @@ -532,7 +532,7 @@ void Scene2100::Action1::signal() { // Wait for an event Event event; if (!g_globals->_events.getEvent(event)) { - g_system->updateScreen(); + GLOBALS._screenSurface.copyToScreen(); g_system->delayMillis(10); continue; } @@ -2263,7 +2263,7 @@ void Scene2150::Action1::signal() { // Wait for an event Event event; if (!g_globals->_events.getEvent(event)) { - g_system->updateScreen(); + GLOBALS._screenSurface.copyToScreen(); g_system->delayMillis(10); continue; } @@ -5118,7 +5118,7 @@ void Scene2320::Action3::signal() { // Wait for an event Event event; if (!g_globals->_events.getEvent(event)) { - g_system->updateScreen(); + GLOBALS._screenSurface.copyToScreen(); g_system->delayMillis(10); continue; } diff --git a/engines/tsage/ringworld/ringworld_scenes5.cpp b/engines/tsage/ringworld/ringworld_scenes5.cpp index 49726eba2e..7c8da54fac 100644 --- a/engines/tsage/ringworld/ringworld_scenes5.cpp +++ b/engines/tsage/ringworld/ringworld_scenes5.cpp @@ -2810,7 +2810,7 @@ void Scene4150::Action1::signal() { case 4: { for (int idx = 100; idx >= 0; idx -= 5) { g_globals->_scenePalette.fade(adjustData, false, idx); - g_system->updateScreen(); + GLOBALS._screenSurface.copyToScreen(); g_system->delayMillis(10); } @@ -2838,7 +2838,7 @@ void Scene4150::Action1::signal() { case 7: for (int idx = 100; idx >= 0; idx -= 5) { g_globals->_scenePalette.fade(adjustData, false, idx); - g_system->updateScreen(); + GLOBALS._screenSurface.copyToScreen(); g_system->delayMillis(10); } diff --git a/engines/tsage/ringworld2/ringworld2_dialogs.cpp b/engines/tsage/ringworld2/ringworld2_dialogs.cpp index ddb4eae9c4..6035b37e19 100644 --- a/engines/tsage/ringworld2/ringworld2_dialogs.cpp +++ b/engines/tsage/ringworld2/ringworld2_dialogs.cpp @@ -153,7 +153,7 @@ void RightClickDialog::execute() { } g_system->delayMillis(10); - g_system->updateScreen(); + GLOBALS._screenSurface.copyToScreen(); } // Execute the specified action diff --git a/engines/tsage/scenes.cpp b/engines/tsage/scenes.cpp index 6362c63bc3..03c7d8d0ae 100644 --- a/engines/tsage/scenes.cpp +++ b/engines/tsage/scenes.cpp @@ -133,7 +133,7 @@ void SceneManager::fadeInIfNecessary() { percent = 100; g_globals->_scenePalette.fade((const byte *)&adjustData, false, percent); - g_system->updateScreen(); + GLOBALS._screenSurface.copyToScreen(); g_system->delayMillis(10); } -- cgit v1.2.3 From 421c8cd2624a9e8ac2f0091ef1b51b42f99dae26 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 18 Dec 2011 11:25:49 +0200 Subject: DREAMWEB: Port 'setpickup' to C++ and added an enum for the object types --- engines/dreamweb/dreamgen.cpp | 65 ------------------------------------------- engines/dreamweb/dreamgen.h | 1 - engines/dreamweb/object.cpp | 59 ++++++++++++++++++++++++++++++++++++--- engines/dreamweb/people.cpp | 4 +-- engines/dreamweb/structs.h | 7 +++++ engines/dreamweb/stubs.cpp | 16 +++++------ engines/dreamweb/stubs.h | 1 + engines/dreamweb/use.cpp | 2 +- 8 files changed, 74 insertions(+), 81 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 72f2feca0e..04276c001e 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -519,71 +519,6 @@ foundmatch: bx = pop(); } -void DreamGenContext::setPickup() { - STACK_CHECK; - _cmp(data.byte(kObjecttype), 1); - if (flags.z()) - goto cantpick; - _cmp(data.byte(kObjecttype), 3); - if (flags.z()) - goto cantpick; - getAnyAd(); - al = es.byte(bx+2); - _cmp(al, 4); - if (!flags.z()) - goto canpick; -cantpick: - blank(); - return; -canpick: - _cmp(data.byte(kCommandtype), 209); - if (flags.z()) - goto alreadysp; - data.byte(kCommandtype) = 209; - bl = data.byte(kCommand); - bh = data.byte(kObjecttype); - al = 33; - commandWithOb(); -alreadysp: - ax = data.word(kMousebutton); - _cmp(ax, 1); - if (!flags.z()) - return /* (nosetpick) */; - _cmp(ax, data.word(kOldbutton)); - if (!flags.z()) - goto dosetpick; - return; -dosetpick: - createPanel(); - showPanel(); - showMan(); - showExit(); - examIcon(); - data.byte(kPickup) = 1; - data.byte(kInvopen) = 2; - _cmp(data.byte(kObjecttype), 4); - if (flags.z()) - goto pickupexob; - al = data.byte(kCommand); - data.byte(kItemframe) = al; - data.byte(kOpenedob) = 255; - transferToEx(); - data.byte(kItemframe) = al; - data.byte(kObjecttype) = 4; - getEitherAd(); - es.byte(bx+2) = 20; - es.byte(bx+3) = 255; - openInv(); - workToScreenM(); - return; -pickupexob: - al = data.byte(kCommand); - data.byte(kItemframe) = al; - data.byte(kOpenedob) = 255; - openInv(); - workToScreenM(); -} - void DreamGenContext::reExFromInv() { STACK_CHECK; findInvPos(); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 29cd6e39ab..cbf4d558c8 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -506,7 +506,6 @@ public: void fillOpen(); void deleteExObject(); void getEitherAd(); - void setPickup(); void dropObject(); void showDiaryKeys(); void useOpened(); diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index e4abac14f2..4daa5091a5 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -108,10 +108,10 @@ void DreamBase::obToInv(uint8 index, uint8 flag, uint16 x, uint16 y) { } void DreamBase::obPicture() { - if (data.byte(kObjecttype) == 1) + if (data.byte(kObjecttype) == kSetObjectType1) return; Frame *frames; - if (data.byte(kObjecttype) == 4) + if (data.byte(kObjecttype) == kExObjectType) frames = (Frame *)getSegment(data.word(kExtras)).ptr(0, 0); else frames = (Frame *)getSegment(data.word(kFreeframes)).ptr(0, 0); @@ -133,6 +133,7 @@ void DreamBase::obIcons() { void DreamGenContext::examineOb(bool examineAgain) { data.byte(kPointermode) = 0; data.word(kTimecount) = 0; + while (true) { if (examineAgain) { data.byte(kInmaparea) = 0; @@ -140,8 +141,7 @@ void DreamGenContext::examineOb(bool examineAgain) { data.byte(kOpenedob) = 255; data.byte(kOpenedtype) = 255; data.byte(kInvopen) = 0; - al = data.byte(kCommandtype); - data.byte(kObjecttype) = al; + data.byte(kObjecttype) = data.byte(kCommandtype); data.byte(kItemframe) = 0; data.byte(kPointerframe) = 0; createPanel(); @@ -167,6 +167,7 @@ void DreamGenContext::examineOb(bool examineAgain) { dumpTextLine(); delPointer(); data.byte(kGetback) = 0; + switch (data.byte(kInvopen)) { case 0: { RectWithCallback examList[] = { @@ -207,6 +208,7 @@ void DreamGenContext::examineOb(bool examineAgain) { break; } } + if (data.byte(kQuitrequested) != 0) break; if (data.byte(kExamagain) != 0) @@ -426,4 +428,53 @@ void DreamGenContext::selectOb() { } } +void DreamGenContext::setPickup() { + if (data.byte(kObjecttype) != kSetObjectType1 && data.byte(kObjecttype) != kSetObjectType3) { + // The original called getAnyAd() here. However, since object types + // 1 and 3 are excluded, the resulting object is a DynObject, so + // we can use getEitherAd() instead. + DynObject *object = getEitherAdCPP(); + if (object->mapad[0] == 4) { + blank(); + return; + } + } else { + blank(); + return; + } + + if (data.byte(kCommandtype) != 209) { + data.byte(kCommandtype) = 209; + commandWithOb(33, data.byte(kObjecttype), data.byte(kCommand)); + } + + if (data.word(kMousebutton) == 1 && data.word(kMousebutton) == data.word(kOldbutton)) + return; + + createPanel(); + showPanel(); + showMan(); + showExit(); + examIcon(); + data.byte(kPickup) = 1; + data.byte(kInvopen) = 2; + + if (data.byte(kObjecttype) != kExObjectType) { + data.byte(kItemframe) = data.byte(kCommand); + data.byte(kOpenedob) = 255; + transferToEx(); + data.byte(kItemframe) = data.byte(kCommand); + data.byte(kObjecttype) = kExObjectType; + DynObject *object = getEitherAdCPP(); + object->mapad[0] = 20; + object->mapad[1] = 255; + } else { + data.byte(kItemframe) = data.byte(kCommand); + data.byte(kOpenedob) = 255; + } + + openInv(); + workToScreenM(); +} + } // End of namespace DreamGen diff --git a/engines/dreamweb/people.cpp b/engines/dreamweb/people.cpp index af92d07439..8998e2f394 100644 --- a/engines/dreamweb/people.cpp +++ b/engines/dreamweb/people.cpp @@ -941,10 +941,10 @@ void DreamGenContext::mugger(ReelRoutine &routine) { findXYFromPath(); data.byte(kResetmanxy) = 1; data.byte(kCommand) = findExObject("WETA"); - data.byte(kObjecttype) = 4; + data.byte(kObjecttype) = kExObjectType; removeObFromInv(); data.byte(kCommand) = findExObject("WETB"); - data.byte(kObjecttype) = 4; + data.byte(kObjecttype) = kExObjectType; removeObFromInv(); makeMainScreen(); DreamBase::setupTimedUse(48, 70, 10, 68 - 32, 54 + 64); diff --git a/engines/dreamweb/structs.h b/engines/dreamweb/structs.h index 709a3d2a8e..d96469fbd5 100644 --- a/engines/dreamweb/structs.h +++ b/engines/dreamweb/structs.h @@ -296,6 +296,13 @@ struct Atmosphere { uint8 _repeat; }; +enum ObjectTypes { + kSetObjectType1 = 1, + kFreeObjectType = 2, + kSetObjectType3 = 3, + kExObjectType = 4 +}; + } // End of namespace DreamWeb #endif diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 7f1824d2bb..bf29cd05ea 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -1354,24 +1354,24 @@ DynObject *DreamBase::getExAd(uint8 index) { } DynObject *DreamBase::getEitherAdCPP() { - if (data.byte(kObjecttype) == 4) + if (data.byte(kObjecttype) == kExObjectType) return getExAd(data.byte(kItemframe)); else return getFreeAd(data.byte(kItemframe)); } void *DreamBase::getAnyAd(uint8 *value1, uint8 *value2) { - if (data.byte(kObjecttype) == 4) { + if (data.byte(kObjecttype) == kExObjectType) { DynObject *exObject = getExAd(data.byte(kCommand)); *value1 = exObject->slotSize; *value2 = exObject->slotCount; return exObject; - } else if (data.byte(kObjecttype) == 2) { + } else if (data.byte(kObjecttype) == kFreeObjectType) { DynObject *freeObject = getFreeAd(data.byte(kCommand)); *value1 = freeObject->slotSize; *value2 = freeObject->slotCount; return freeObject; - } else { + } else { // 1 or 3. 0 should never happen SetObject *setObject = getSetAd(data.byte(kCommand)); // Note: the original returned slotCount/priority (bytes 4 and 5) // instead of slotSize/slotCount (bytes 3 and 4). @@ -1615,7 +1615,7 @@ void DreamBase::showPointer() { data.word(kOldpointery) = data.word(kMousey); if (data.byte(kPickup) == 1) { const Frame *frames; - if (data.byte(kObjecttype) != 4) + if (data.byte(kObjecttype) != kExObjectType) frames = (const Frame *)getSegment(data.word(kFreeframes)).ptr(0, 0); else frames = (const Frame *)getSegment(data.word(kExtras)).ptr(0, 0); @@ -3209,7 +3209,7 @@ void DreamBase::getBackToOps() { void DreamGenContext::pickupOb(uint8 command, uint8 pos) { data.byte(kLastinvpos) = pos; - data.byte(kObjecttype) = 2; + data.byte(kObjecttype) = kFreeObjectType; data.byte(kItemframe) = command; data.byte(kCommand) = command; getAnyAd(); @@ -3353,13 +3353,13 @@ void DreamGenContext::obsThatDoThings() { void DreamGenContext::describeOb() { const uint8 *obText = getObTextStartCPP(); uint16 y = 92; - if (data.byte(kForeignrelease) && data.byte(kObjecttype) == 1) + if (data.byte(kForeignrelease) && data.byte(kObjecttype) == kSetObjectType1) y = 82; data.word(kCharshift) = 91 + 91; printDirect(&obText, 33, &y, 241, 241 & 1); data.word(kCharshift) = 0; y = 104; - if (data.byte(kForeignrelease) && data.byte(kObjecttype) == 1) + if (data.byte(kForeignrelease) && data.byte(kObjecttype) == kSetObjectType1) y = 94; printDirect(&obText, 36, &y, 241, 241 & 1); obsThatDoThings(); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 2305b93d53..e6726b664a 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -403,5 +403,6 @@ void selectOb(); void findInvPos(); uint16 findInvPosCPP(); + void setPickup(); #endif diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp index 5b6e3f8dff..06cb5a9131 100644 --- a/engines/dreamweb/use.cpp +++ b/engines/dreamweb/use.cpp @@ -760,7 +760,7 @@ void DreamGenContext::useChurchGate() { void DreamGenContext::useGun() { - if (data.byte(kObjecttype) != 4) { + if (data.byte(kObjecttype) != kExObjectType) { // gun is not taken showSecondUse(); putBackObStuff(); -- cgit v1.2.3 From 8385ee1c012af3f2d62cfa098aab7254c4e559b0 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 18 Dec 2011 21:07:31 +1100 Subject: TSAGE: Bugfix for using save/load buttons in the Blue Force options dialog --- engines/tsage/blue_force/blueforce_dialogs.cpp | 49 +++++++++++++++++--------- 1 file changed, 33 insertions(+), 16 deletions(-) (limited to 'engines') diff --git a/engines/tsage/blue_force/blueforce_dialogs.cpp b/engines/tsage/blue_force/blueforce_dialogs.cpp index 6f294d263a..11c0358aca 100644 --- a/engines/tsage/blue_force/blueforce_dialogs.cpp +++ b/engines/tsage/blue_force/blueforce_dialogs.cpp @@ -166,6 +166,9 @@ void RightClickDialog::execute() { GLOBALS._screenSurface.copyToScreen(); } + // Deactivate the graphics manager used for the dialog + _gfxManager.deactivate(); + // Execute the specified action CursorType cursorNum = CURSOR_NONE; switch (_selectedAction) { @@ -193,8 +196,6 @@ void RightClickDialog::execute() { if (cursorNum != CURSOR_NONE) BF_GLOBALS._events.setCursor(cursorNum); - - _gfxManager.deactivate(); } /*--------------------------------------------------------------------------*/ @@ -435,29 +436,45 @@ void OptionsDialog::show() { OptionsDialog *dlg = new OptionsDialog(); dlg->draw(); + // Show the dialog GfxButton *btn = dlg->execute(); - if (btn == &dlg->_btnQuit) { + // Get which button was pressed + int btnIndex = -1; + if (btn == &dlg->_btnRestore) + btnIndex = 0; + else if (btn == &dlg->_btnSave) + btnIndex = 1; + else if (btn == &dlg->_btnRestart) + btnIndex = 2; + else if (btn == &dlg->_btnQuit) + btnIndex = 3; + else if (btn == &dlg->_btnSound) + btnIndex = 4; + + // Close the dialog + dlg->remove(); + delete dlg; + + // Execute the given selection + if (btnIndex == 0) { + // Restore button + g_globals->_game->restoreGame(); + } else if (btnIndex == 1) { + // Save button + g_globals->_game->saveGame(); + } else if (btnIndex == 2) { + // Restart game + g_globals->_game->restartGame(); + } else if (btnIndex == 3) { // Quit game if (MessageDialog::show(QUIT_CONFIRM_MSG, CANCEL_BTN_STRING, QUIT_BTN_STRING) == 1) { g_vm->quitGame(); } - } else if (btn == &dlg->_btnRestart) { - // Restart game - g_globals->_game->restartGame(); - } else if (btn == &dlg->_btnSound) { + } else if (btnIndex == 4) { // Sound dialog SoundDialog::execute(); - } else if (btn == &dlg->_btnSave) { - // Save button - g_globals->_game->saveGame(); - } else if (btn == &dlg->_btnRestore) { - // Restore button - g_globals->_game->restoreGame(); } - - dlg->remove(); - delete dlg; } OptionsDialog::OptionsDialog() { -- cgit v1.2.3 From 96d15e83dbca886054550d3c1d676b955464a9fc Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 18 Dec 2011 21:18:33 +1100 Subject: TSAGE: Bugfix for Ringworld saving and restoring via options dialog --- engines/tsage/ringworld/ringworld_dialogs.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines') diff --git a/engines/tsage/ringworld/ringworld_dialogs.cpp b/engines/tsage/ringworld/ringworld_dialogs.cpp index d0d5ab7b4a..0561a27055 100644 --- a/engines/tsage/ringworld/ringworld_dialogs.cpp +++ b/engines/tsage/ringworld/ringworld_dialogs.cpp @@ -186,6 +186,8 @@ void RightClickDialog::execute() { GLOBALS._screenSurface.copyToScreen(); } + _gfxManager.deactivate(); + // Execute the specified action switch (_selectedAction) { case 1: @@ -213,8 +215,6 @@ void RightClickDialog::execute() { Ringworld::OptionsDialog::show(); break; } - - _gfxManager.deactivate(); } /*--------------------------------------------------------------------------*/ -- cgit v1.2.3 From a1799ba0912615793c41537cae38e13c5a61f5ea Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 18 Dec 2011 12:17:56 +0200 Subject: DREAMWEB: Close the file opened in querySaveMetaInfos() when returning --- engines/dreamweb/detection.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'engines') diff --git a/engines/dreamweb/detection.cpp b/engines/dreamweb/detection.cpp index b5ec6e8e69..3a5c28a104 100644 --- a/engines/dreamweb/detection.cpp +++ b/engines/dreamweb/detection.cpp @@ -184,6 +184,7 @@ SaveStateDescriptor DreamWebMetaEngine::querySaveMetaInfos(const char *target, i desc.setThumbnail(thumbnail); } + delete in; return desc; } -- cgit v1.2.3 From 09eaef6bcd65ac55a10920920a0bb1feb32cae80 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 18 Dec 2011 13:08:27 +0200 Subject: DREAMWEB: Remove regression from b0a42f1 (duplicate saved reel data) --- engines/dreamweb/saveload.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'engines') diff --git a/engines/dreamweb/saveload.cpp b/engines/dreamweb/saveload.cpp index 599ef45c66..e9a670c9d7 100644 --- a/engines/dreamweb/saveload.cpp +++ b/engines/dreamweb/saveload.cpp @@ -435,7 +435,6 @@ void DreamGenContext::savePosition(unsigned int slot, const char *descbuf) { for (unsigned int i = 0; 8*i < kLenofreelrouts; ++i) { syncReelRoutine(s, (ReelRoutine*)data.ptr(kReelroutines + 8*i, 8)); } - outSaveFile->write(data.ptr(kReelroutines, len[5]), len[5]); // ScummVM data block outSaveFile->writeUint32BE(SCUMMVM_HEADER); -- cgit v1.2.3 From 5d1e1fbbbcff5c930b1f929883e9e0cf897e585f Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 18 Dec 2011 13:16:25 +0200 Subject: DREAMWEB: Spacing --- engines/dreamweb/saveload.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/saveload.cpp b/engines/dreamweb/saveload.cpp index e9a670c9d7..52f28515f5 100644 --- a/engines/dreamweb/saveload.cpp +++ b/engines/dreamweb/saveload.cpp @@ -432,8 +432,8 @@ void DreamGenContext::savePosition(unsigned int slot, const char *descbuf) { // TODO: Convert more to serializer? Common::Serializer s(0, outSaveFile); - for (unsigned int i = 0; 8*i < kLenofreelrouts; ++i) { - syncReelRoutine(s, (ReelRoutine*)data.ptr(kReelroutines + 8*i, 8)); + for (unsigned int i = 0; 8 * i < kLenofreelrouts; ++i) { + syncReelRoutine(s, (ReelRoutine *)data.ptr(kReelroutines + 8 * i, 8)); } // ScummVM data block @@ -498,8 +498,8 @@ void DreamGenContext::loadPosition(unsigned int slot) { // TODO: Use serializer for more Common::Serializer s(inSaveFile, 0); - for (unsigned int i = 0; 8*i < kLenofreelrouts; ++i) { - syncReelRoutine(s, (ReelRoutine*)data.ptr(kReelroutines + 8*i, 8)); + for (unsigned int i = 0; 8 * i < kLenofreelrouts; ++i) { + syncReelRoutine(s, (ReelRoutine *)data.ptr(kReelroutines + 8 * i, 8)); } // Check if there's a ScummVM data block -- cgit v1.2.3 From 4178ad6b681d32de567b00833b18bf992cbffd92 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sun, 18 Dec 2011 12:38:53 +0100 Subject: DREAMWEB: Fix ReelRoutine terminator saving/loading --- engines/dreamweb/saveload.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/saveload.cpp b/engines/dreamweb/saveload.cpp index 52f28515f5..4001cb1448 100644 --- a/engines/dreamweb/saveload.cpp +++ b/engines/dreamweb/saveload.cpp @@ -432,9 +432,11 @@ void DreamGenContext::savePosition(unsigned int slot, const char *descbuf) { // TODO: Convert more to serializer? Common::Serializer s(0, outSaveFile); - for (unsigned int i = 0; 8 * i < kLenofreelrouts; ++i) { - syncReelRoutine(s, (ReelRoutine *)data.ptr(kReelroutines + 8 * i, 8)); + for (unsigned int i = 0; 8*i < kLenofreelrouts - 1; ++i) { + syncReelRoutine(s, (ReelRoutine *)data.ptr(kReelroutines + 8*i, 8)); } + // Terminator + s.syncAsByte(*data.ptr(kReelroutines + kLenofreelrouts - 1, 1)); // ScummVM data block outSaveFile->writeUint32BE(SCUMMVM_HEADER); @@ -498,9 +500,11 @@ void DreamGenContext::loadPosition(unsigned int slot) { // TODO: Use serializer for more Common::Serializer s(inSaveFile, 0); - for (unsigned int i = 0; 8 * i < kLenofreelrouts; ++i) { - syncReelRoutine(s, (ReelRoutine *)data.ptr(kReelroutines + 8 * i, 8)); + for (unsigned int i = 0; 8*i < kLenofreelrouts - 1; ++i) { + syncReelRoutine(s, (ReelRoutine *)data.ptr(kReelroutines + 8*i, 8)); } + // Terminator + s.syncAsByte(*data.ptr(kReelroutines + kLenofreelrouts - 1, 1)); // Check if there's a ScummVM data block if (header.len(6) == SCUMMVM_BLOCK_MAGIC_SIZE) { -- cgit v1.2.3 From feaf297c7500aaff8a68da0a47466e537f25db4b Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sun, 18 Dec 2011 13:06:05 +0100 Subject: DREAMWEB: Fix multiple regressions in setPickup --- engines/dreamweb/object.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index 4daa5091a5..473d876ce8 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -448,7 +448,7 @@ void DreamGenContext::setPickup() { commandWithOb(33, data.byte(kObjecttype), data.byte(kCommand)); } - if (data.word(kMousebutton) == 1 && data.word(kMousebutton) == data.word(kOldbutton)) + if (data.word(kMousebutton) != 1 || data.word(kMousebutton) == data.word(kOldbutton)) return; createPanel(); @@ -463,9 +463,9 @@ void DreamGenContext::setPickup() { data.byte(kItemframe) = data.byte(kCommand); data.byte(kOpenedob) = 255; transferToEx(); - data.byte(kItemframe) = data.byte(kCommand); + data.byte(kItemframe) = al; data.byte(kObjecttype) = kExObjectType; - DynObject *object = getEitherAdCPP(); + DynObject *object = getExAd(data.byte(kItemframe)); object->mapad[0] = 20; object->mapad[1] = 255; } else { -- cgit v1.2.3 From cf73ee9939fae986db922a2551544277d8d48449 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sun, 18 Dec 2011 13:18:24 +0100 Subject: DREAMWEB: Fix multiple regressions in checkInside and loadCart --- engines/dreamweb/monitor.cpp | 5 +++-- engines/dreamweb/stubs.cpp | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/monitor.cpp b/engines/dreamweb/monitor.cpp index 577d5701ee..0b126ee250 100644 --- a/engines/dreamweb/monitor.cpp +++ b/engines/dreamweb/monitor.cpp @@ -405,8 +405,9 @@ void DreamGenContext::loadNews() { void DreamGenContext::loadCart() { byte cartridgeId = 0; uint16 objectIndex = findSetObject("INTF"); - if (checkInside(objectIndex, 1) != kNumexobjects) - cartridgeId = getSetAd(objectIndex)->name[0] + 1; + uint16 cartridgeIndex = checkInside(objectIndex, 1); + if (cartridgeIndex != kNumexobjects) + cartridgeId = getExAd(cartridgeIndex)->id[3] + 1; if (cartridgeId == 0) data.word(kTextfile3) = standardLoad("DREAMWEB.T20"); // monitor file 20 diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index bf29cd05ea..1c87a05dea 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -1801,6 +1801,8 @@ bool DreamBase::isRyanHolding(const char *id) { void DreamGenContext::checkInside() { cl = checkInside(al, ah); + es = data.word(kExtras); + bx = kExdata + cl * sizeof(DynObject); } uint16 DreamGenContext::checkInside(uint16 command, uint16 type) { -- cgit v1.2.3 From f0508dd05a2840a98f98d3a215b5a859d757e653 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sun, 18 Dec 2011 14:08:32 +0100 Subject: DREAMWEB: Fix regression in useWinch --- engines/dreamweb/use.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp index 06cb5a9131..5a80a33bd5 100644 --- a/engines/dreamweb/use.cpp +++ b/engines/dreamweb/use.cpp @@ -994,7 +994,8 @@ void DreamGenContext::useObject() { } void DreamGenContext::useWinch() { - if (checkInside(40, 1) == kNumexobjects || !compare(cl, 4, "FUSE")) { + uint16 contentIndex = checkInside(40, 1); + if (contentIndex == kNumexobjects || !compare(contentIndex, kExObjectType, "FUSE")) { // No winch showFirstUse(); putBackObStuff(); -- cgit v1.2.3 From 8c8666e811d1b68fec400f4100a02146e0e1235b Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sun, 18 Dec 2011 13:04:45 +0100 Subject: DREAMWEB: Move backdrop.cpp and more to DreamBase; remove some dead code --- engines/dreamweb/backdrop.cpp | 78 +++++++++++++++++--------------------- engines/dreamweb/dreambase.h | 31 ++++++++++++++- engines/dreamweb/dreamweb.cpp | 2 +- engines/dreamweb/monitor.cpp | 18 ++++----- engines/dreamweb/stubs.cpp | 88 +++++++------------------------------------ engines/dreamweb/stubs.h | 36 ------------------ engines/dreamweb/use.cpp | 32 ++++++++++++---- engines/dreamweb/vgafades.cpp | 4 +- 8 files changed, 113 insertions(+), 176 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/backdrop.cpp b/engines/dreamweb/backdrop.cpp index 15a226a5ac..38ccb0296c 100644 --- a/engines/dreamweb/backdrop.cpp +++ b/engines/dreamweb/backdrop.cpp @@ -24,7 +24,7 @@ namespace DreamGen { -void DreamGenContext::doBlocks() { +void DreamBase::doBlocks() { uint16 dstOffset = data.word(kMapady) * 320 + data.word(kMapadx); uint16 mapOffset = kMap + data.byte(kMapy) * kMapwidth + data.byte(kMapx); const uint8 *mapData = getSegment(data.word(kMapdata)).ptr(mapOffset, 0); @@ -49,7 +49,6 @@ void DreamGenContext::doBlocks() { dst += 320; } dst += 4; - ax = 0x0dfdf; memset(dst, 0xdf, 16); dst += 320; memset(dst, 0xdf, 16); @@ -63,7 +62,7 @@ void DreamGenContext::doBlocks() { } } -uint8 DreamGenContext::getXAd(const uint8 *setData, uint8 *result) { +uint8 DreamBase::getXAd(const uint8 *setData, uint8 *result) { uint8 v0 = setData[0]; uint8 v1 = setData[1]; uint8 v2 = setData[2]; @@ -78,7 +77,7 @@ uint8 DreamGenContext::getXAd(const uint8 *setData, uint8 *result) { return 1; } -uint8 DreamGenContext::getYAd(const uint8 *setData, uint8 *result) { +uint8 DreamBase::getYAd(const uint8 *setData, uint8 *result) { uint8 v0 = setData[3]; uint8 v1 = setData[4]; if (v0 < data.byte(kMapy)) @@ -90,11 +89,7 @@ uint8 DreamGenContext::getYAd(const uint8 *setData, uint8 *result) { return 1; } -void DreamGenContext::getMapAd() { - ch = getMapAd((const uint8 *)es.ptr(si, 5)); -} - -uint8 DreamGenContext::getMapAd(const uint8 *setData) { +uint8 DreamBase::getMapAd(const uint8 *setData) { uint8 xad, yad; if (getXAd(setData, &xad) == 0) return 0; @@ -105,14 +100,7 @@ uint8 DreamGenContext::getMapAd(const uint8 *setData) { return 1; } -void DreamGenContext::calcFrFrame(uint16 frame) { - uint8 width, height; - calcFrFrame(frame, &width, &height); - cl = width; - ch = height; -} - -void DreamGenContext::calcFrFrame(uint16 frameNum, uint8* width, uint8* height) { +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; @@ -123,21 +111,34 @@ void DreamGenContext::calcFrFrame(uint16 frameNum, uint8* width, uint8* height) *height = frame->height; } -void DreamGenContext::finalFrame() { - uint16 x, y; - finalFrame(&x, &y); - di = x; - bx = y; -} - -void DreamGenContext::finalFrame(uint16 *x, uint16 *y) { +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); } -void DreamGenContext::showAllObs() { +void DreamBase::makeBackOb(SetObject *objData) { + 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); + + uint16 objDataOffset = (uint8 *)objData - getSegment(data.word(kSetdat)).ptr(0, 0); + assert(objDataOffset % sizeof(SetObject) == 0); + assert(objDataOffset < 128 * sizeof(SetObject)); + sprite->setObjData(objDataOffset); + if (priority == 255) + priority = 0; + sprite->priority = priority; + sprite->type = type; + sprite->b16 = 0; + sprite->delay = 0; + sprite->animFrame = 0; +} + +void DreamBase::showAllObs() { data.word(kListpos) = kSetlist; memset(getSegment(data.word(kBuffers)).ptr(kSetlist, 0), 0xff, 128 * 5); data.word(kFrsegment) = data.word(kSetframes); @@ -153,7 +154,8 @@ void DreamGenContext::showAllObs() { uint8 currentFrame = setEntry->frames[0]; if (currentFrame == 0xff) continue; - calcFrFrame(currentFrame); + uint8 width, height; + calcFrFrame(currentFrame, &width, &height); uint16 x, y; finalFrame(&x, &y); setEntry->index = setEntry->frames[0]; @@ -174,17 +176,7 @@ void DreamGenContext::showAllObs() { } } -void DreamGenContext::getDimension() { - uint8 mapXstart, mapYstart; - uint8 mapXsize, mapYsize; - getDimension(&mapXstart, &mapYstart, &mapXsize, &mapYsize); - cl = mapXstart; - ch = mapYstart; - dl = mapXsize; - dh = mapYsize; -} - -bool DreamGenContext::addAlong(const uint8 *mapFlags) { +bool DreamBase::addAlong(const uint8 *mapFlags) { for (size_t i = 0; i < 11; ++i) { if (mapFlags[3 * i] != 0) return true; @@ -192,7 +184,7 @@ bool DreamGenContext::addAlong(const uint8 *mapFlags) { return false; } -bool DreamGenContext::addLength(const uint8 *mapFlags) { +bool DreamBase::addLength(const uint8 *mapFlags) { for (size_t i = 0; i < 10; ++i) { if (mapFlags[3 * 11 * i] != 0) return true; @@ -200,7 +192,7 @@ bool DreamGenContext::addLength(const uint8 *mapFlags) { return false; } -void DreamGenContext::getDimension(uint8 *mapXstart, uint8 *mapYstart, uint8 *mapXsize, uint8 *mapYsize) { +void DreamBase::getDimension(uint8 *mapXstart, uint8 *mapYstart, uint8 *mapXsize, uint8 *mapYsize) { const uint8 *mapFlags = getSegment(data.word(kBuffers)).ptr(kMapflags, 0); uint8 yStart = 0; @@ -229,7 +221,7 @@ void DreamGenContext::getDimension(uint8 *mapXstart, uint8 *mapYstart, uint8 *ma data.byte(kMapysize) = *mapYsize << 4; } -void DreamGenContext::calcMapAd() { +void DreamBase::calcMapAd() { uint8 mapXstart, mapYstart; uint8 mapXsize, mapYsize; getDimension(&mapXstart, &mapYstart, &mapXsize, &mapYsize); @@ -237,7 +229,7 @@ void DreamGenContext::calcMapAd() { data.word(kMapady) = data.word(kMapoffsety) - 8 * (mapYsize + 2 * mapYstart - 10); } -void DreamGenContext::showAllFree() { +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)); @@ -290,7 +282,7 @@ void DreamBase::drawFlags() { } } -void DreamGenContext::showAllEx() { +void DreamBase::showAllEx() { data.word(kListpos) = kExlist; memset(getSegment(data.word(kBuffers)).ptr(kExlist, 100 * 5), 0xff, 100 * 5); diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 06936ca72d..6f78bcad07 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -57,12 +57,29 @@ protected: char _saveNames[17*7]; char _saveNamesOld[17*7]; + // from vgagrafx.cpp + uint8 _workspace[(0x1000 + 2) * 16]; + public: DreamBase(DreamWeb::DreamWebEngine *en); public: // from backdrop.cpp + 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); + void showAllObs(); + bool addAlong(const uint8 *mapFlags); + bool addLength(const uint8 *mapFlags); + void getDimension(uint8 *mapXstart, uint8 *mapYstart, uint8 *mapXsize, uint8 *mapYsize); + void calcMapAd(); + void showAllFree(); void drawFlags(); + void showAllEx(); // from keypad.cpp void getUnderMenu(); @@ -110,6 +127,9 @@ public: const char *monPrint(const char *string); void lockLightOn(); void lockLightOff(); + void loadPersonal(); + void loadNews(); + void loadCart(); // from object.cpp void obIcons(); @@ -392,11 +412,19 @@ public: bool isRyanHolding(const char *id); void clearBuffers(); void clearChanges(); + void drawFloor(); + uint16 findSetObject(const char *id); + void hangOnCurs(uint16 frameCount); + const uint8 *findObName(uint8 type, uint8 index); + void copyName(uint8 type, uint8 index, uint8 *dst); // from use.cpp void placeFreeObject(uint8 index); void removeFreeObject(uint8 index); void setupTimedUse(uint16 offset, uint16 countToTimed, uint16 timeCount, byte x, byte y); + void withWhat(); + uint16 checkInside(uint16 command, uint16 type); + void showPuzText(uint16 command, uint16 count); // from vgafades.cpp uint8 *mainPalette(); @@ -411,6 +439,8 @@ public: void fadeDOS(); void doFade(); void fadeCalculation(); + void fadeupYellows(); + void fadeupMonFirst(); void fadeScreenUp(); void fadeScreenUps(); void fadeScreenUpHalf(); @@ -423,7 +453,6 @@ public: void dumpCurrent(); // from vgagrafx.cpp - uint8 _workspace[(0x1000 + 2) * 16]; inline uint8 *workspace() { return _workspace; } void clearWork(); diff --git a/engines/dreamweb/dreamweb.cpp b/engines/dreamweb/dreamweb.cpp index 0af3f00d5c..997f36438e 100644 --- a/engines/dreamweb/dreamweb.cpp +++ b/engines/dreamweb/dreamweb.cpp @@ -330,7 +330,7 @@ void DreamWebEngine::blit(const uint8 *src, int pitch, int x, int y, int w, int } void DreamWebEngine::printUnderMonitor() { - uint8 *dst = _base._workspace + DreamGen::kScreenwidth * 43 + 76; + uint8 *dst = _base.workspace() + DreamGen::kScreenwidth * 43 + 76; Graphics::Surface *s = _system->lockScreen(); if (!s) diff --git a/engines/dreamweb/monitor.cpp b/engines/dreamweb/monitor.cpp index 0b126ee250..9bac71a8e5 100644 --- a/engines/dreamweb/monitor.cpp +++ b/engines/dreamweb/monitor.cpp @@ -72,15 +72,11 @@ void DreamGenContext::useMon() { data.word(kBufferout) = 0; bool stop = false; do { - di = data.word(kMonadx); - bx = data.word(kMonady); - push(di); - push(bx); + uint16 oldMonadx = data.word(kMonadx); + uint16 oldMonady = data.word(kMonady); input(); - bx = pop(); - di = pop(); - data.word(kMonadx) = di; - data.word(kMonady) = bx; + data.word(kMonadx) = oldMonadx; + data.word(kMonady) = oldMonady; stop = execCommand(); if (quitRequested()) //TODO : Check why it crashes when put before the execcommand break; @@ -383,14 +379,14 @@ void DreamBase::printOuterMon() { showFrame(tempGraphics(), 40, 164, 4, 0); } -void DreamGenContext::loadPersonal() { +void DreamBase::loadPersonal() { if (data.byte(kLocation) == 0 || data.byte(kLocation) == 42) data.word(kTextfile1) = standardLoad("DREAMWEB.T01"); // monitor file 1 else data.word(kTextfile1) = standardLoad("DREAMWEB.T02"); // monitor file 2 } -void DreamGenContext::loadNews() { +void DreamBase::loadNews() { // textfile2 holds information accessible by anyone if (data.byte(kNewsitem) == 0) data.word(kTextfile2) = standardLoad("DREAMWEB.T10"); // monitor file 10 @@ -402,7 +398,7 @@ void DreamGenContext::loadNews() { data.word(kTextfile2) = standardLoad("DREAMWEB.T13"); // monitor file 13 } -void DreamGenContext::loadCart() { +void DreamBase::loadCart() { byte cartridgeId = 0; uint16 objectIndex = findSetObject("INTF"); uint16 cartridgeIndex = checkInside(objectIndex, 1); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 1c87a05dea..021b2bad84 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -785,11 +785,7 @@ void DreamBase::loadTempCharset(const char *fileName) { engine->setTempCharset(standardLoadCPP(fileName)); } -void DreamGenContext::hangOnCurs() { - hangOnCurs(cx); -} - -void DreamGenContext::hangOnCurs(uint16 frameCount) { +void DreamBase::hangOnCurs(uint16 frameCount) { for (uint16 i = 0; i < frameCount; ++i) { printCurs(); vSync(); @@ -1035,26 +1031,6 @@ void DreamBase::lockMon() { } } -void DreamGenContext::makeBackOb(SetObject *objData) { - 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); - - uint16 objDataOffset = (uint8 *)objData - getSegment(data.word(kSetdat)).ptr(0, 0); - assert(objDataOffset % sizeof(SetObject) == 0); - assert(objDataOffset < 128 * sizeof(SetObject)); - sprite->setObjData(objDataOffset); - if (priority == 255) - priority = 0; - sprite->priority = priority; - sprite->type = type; - sprite->b16 = 0; - sprite->delay = 0; - sprite->animFrame = 0; -} - uint16 DreamBase::allocateAndLoad(unsigned int size) { // allocatemem adds 32 bytes, so it doesn't matter that size/16 rounds down uint16 result = allocateMem(size / 16); @@ -1252,7 +1228,7 @@ bool DreamGenContext::checkIfEx(uint8 x, uint8 y) { return false; } -const uint8 *DreamGenContext::findObName(uint8 type, uint8 index) { +const uint8 *DreamBase::findObName(uint8 type, uint8 index) { if (type == 5) { uint16 i = 64 * 2 * (index & 127); uint16 offset = getSegment(data.word(kPeople)).word(kPersontxtdat + i) + kPersontext; @@ -1272,7 +1248,7 @@ const uint8 *DreamGenContext::findObName(uint8 type, uint8 index) { } } -void DreamGenContext::copyName(uint8 type, uint8 index, uint8 *dst) { +void DreamBase::copyName(uint8 type, uint8 index, uint8 *dst) { const uint8 *src = findObName(type, index); size_t i; for (i = 0; i < 28; ++i) { @@ -1737,19 +1713,7 @@ bool DreamBase::compare(uint8 index, uint8 flag, const char id[4]) { return objectMatches(getAnyAdDir(index, flag), id); } -void DreamGenContext::findSetObject() { - char id[5]; - id[0] = al; - id[1] = ah; - id[2] = cl; - id[3] = ch; - id[4] = '\0'; - al = findSetObject(id); - es = data.word(kSetdat); - bx = al * 64; -} - -uint16 DreamGenContext::findSetObject(const char *id) { +uint16 DreamBase::findSetObject(const char *id) { for (uint16 index = 0; index < 128; index++) { if (objectMatches(getSetAd(index), id)) return index; @@ -1799,22 +1763,6 @@ bool DreamBase::isRyanHolding(const char *id) { return false; } -void DreamGenContext::checkInside() { - cl = checkInside(al, ah); - es = data.word(kExtras); - bx = kExdata + cl * sizeof(DynObject); -} - -uint16 DreamGenContext::checkInside(uint16 command, uint16 type) { - for (uint16 index = 0; index < kNumexobjects; index++) { - DynObject *object = getExAd(index); - if (object->mapad[1] == command && object->mapad[0] == type) - return index; - } - - return kNumexobjects; -} - bool DreamBase::isItDescribed(const ObjPos *pos) { uint16 offset = getSegment(data.word(kSetdesc)).word(kSettextdat + pos->index * 2); uint8 result = getSegment(data.word(kSetdesc)).byte(kSettext + offset); @@ -2184,7 +2132,14 @@ void DreamGenContext::loadRoom() { loadRoomsSample(); switchRyanOn(); drawFlags(); - getDimension(); + + uint8 mapXstart, mapYstart; + uint8 mapXsize, mapYsize; + getDimension(&mapXstart, &mapYstart, &mapXsize, &mapYsize); + cl = mapXstart; + ch = mapYstart; + dl = mapXsize; + dh = mapYsize; } void DreamGenContext::readSetData() { @@ -2617,7 +2572,7 @@ void DreamBase::loadTempText(const char *fileName) { data.word(kTextfile1) = standardLoad(fileName); } -void DreamGenContext::drawFloor() { +void DreamBase::drawFloor() { eraseOldObs(); drawFlags(); calcMapAd(); @@ -4173,23 +4128,6 @@ void DreamGenContext::newPlace() { } } -void DreamGenContext::showPuzText() { - showPuzText(al, cx); -} - -void DreamGenContext::showPuzText(uint16 command, uint16 count) { - createPanel(); - showPanel(); - showMan(); - showExit(); - obIcons(); - uint16 offset = kTextstart + getSegment(data.word(kPuzzletext)).word(command * 2); - const uint8 *string = getSegment(data.word(kPuzzletext)).ptr(offset, 0); - printDirect(string, 36, 104, 241, 241 & 1); - workToScreenM(); - hangOnP(count); -} - void DreamGenContext::monkSpeaking() { // FIXME: This is the CD version only. diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index e6726b664a..b835a26ea1 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -26,8 +26,6 @@ void startup(); void startup1(); void saveLoad(); - void hangOnCurs(uint16 frameCount); - void hangOnCurs(); void workToScreen(); void multiGet(); void multiGet(uint8 *dst, uint16 x, uint16 y, uint8 width, uint8 height) { @@ -65,39 +63,21 @@ void width160(); void spriteUpdate(); void mainMan(Sprite *sprite); - void makeBackOb(SetObject *objData); void zoom(); void showRain(); void commandOnly(); void commandOnly(uint8 command) { DreamBase::commandOnly(command); } - void doBlocks(); void checkIfPerson(); bool checkIfPerson(uint8 x, uint8 y); void checkIfFree(); bool checkIfFree(uint8 x, uint8 y); void checkIfEx(); bool checkIfEx(uint8 x, uint8 y); - const uint8 *findObName(uint8 type, uint8 index); - void copyName(uint8 type, uint8 index, uint8 *dst); void commandWithOb(); void commandWithOb(uint8 command, uint8 type, uint8 index); void updatePeople(); - bool addAlong(const uint8 *mapFlags); - bool addLength(const uint8 *mapFlags); - void getDimension(); - void getDimension(uint8 *mapXstart, uint8 *mapYstart, uint8 *mapXsize, uint8 *mapYsize); - void getMapAd(); - void calcMapAd(); - uint8 getMapAd(const uint8 *setData); - uint8 getXAd(const uint8 *setData, uint8 *result); - uint8 getYAd(const uint8 *setData, uint8 *result); - void calcFrFrame(uint16 frame); - void calcFrFrame(uint16 frame, uint8* width, uint8* height); - void finalFrame(); - void finalFrame(uint16 *x, uint16 *y); - void showAllObs(); void blockNameText(); void walkToText(); void personNameText(); @@ -115,8 +95,6 @@ } void setAllChanges(); void deleteTaken(); - void showAllFree(); - void showAllEx(); bool finishedWalkingCPP(); void finishedWalking(); void checkOne(); @@ -161,7 +139,6 @@ void findNextColon(); const uint8 *getObTextStartCPP(); void useText(const uint8 *string); - void useText(); void examineObText(); void showCity(); uint16 getPersFrame(uint8 index); @@ -172,8 +149,6 @@ void watchCount(); void loadRoom(); void readSetData(); - void fadeupYellows(); - void fadeupMonFirst(); void useMenu(); void useMon(); void makeCaps(); @@ -263,7 +238,6 @@ void checkFolderCoords(); void nextFolder(); void lastFolder(); - void drawFloor(); void mugger(ReelRoutine &routine); void singleKey(uint8 key, uint16 x, uint16 y); void loadSaveBox(); @@ -279,9 +253,6 @@ void saveGame(); void zoomOnOff(); void atmospheres(); - void loadPersonal(); - void loadNews(); - void loadCart(); void hangOne(uint16 delay); void hangOne(); void bibleQuote(); @@ -362,8 +333,6 @@ void dropError(); void cantDrop(); void newPlace(); - void showPuzText(uint16 command, uint16 count); - void showPuzText(); void monkSpeaking(); void rollEndCredits2(); void useButtonA(); @@ -379,8 +348,6 @@ void runEndSeq(); void lookAtCard(); bool execCommand(); - void findSetObject(); - uint16 findSetObject(const char *id); void findExObject(); uint16 findExObject(const char *id); void isRyanHolding(); @@ -391,15 +358,12 @@ void getOpenedSize(); byte getOpenedSizeCPP(); void openOb(); - void withWhat(); void notHeldError(); void useGun(); void identifyOb(); void showSlots(); void useCashCard(); void useStereo(); - void checkInside(); - uint16 checkInside(uint16 command, uint16 type); void selectOb(); void findInvPos(); uint16 findInvPosCPP(); diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp index 5a80a33bd5..5cb1f6b92c 100644 --- a/engines/dreamweb/use.cpp +++ b/engines/dreamweb/use.cpp @@ -163,10 +163,6 @@ void DreamGenContext::useRoutine() { data.byte(kCommandtype) = 255; } -void DreamGenContext::useText() { - useText(es.ptr(si, 0)); -} - void DreamGenContext::useText(const uint8 *string) { createPanel(); showPanel(); @@ -1408,7 +1404,6 @@ void DreamGenContext::usePipe() { putBackObStuff(); } else { showPuzText(14, 300); - showPuzText(); putBackObStuff(); } } @@ -1572,7 +1567,7 @@ void DreamGenContext::useAltar() { } } -void DreamGenContext::withWhat() { +void DreamBase::withWhat() { uint8 commandLine[64] = "OBJECT NAME ONE "; createPanel(); @@ -1590,7 +1585,7 @@ void DreamGenContext::withWhat() { data.byte(kCommandtype) = 255; readMouse(); showPointer(); - workToScreen(); + workToScreenCPP(); delPointer(); data.byte(kInvopen) = 2; } @@ -1666,4 +1661,27 @@ void DreamGenContext::useStereo() { } } +uint16 DreamBase::checkInside(uint16 command, uint16 type) { + for (uint16 index = 0; index < kNumexobjects; index++) { + DynObject *object = getExAd(index); + if (object->mapad[1] == command && object->mapad[0] == type) + return index; + } + + return kNumexobjects; +} + +void DreamBase::showPuzText(uint16 command, uint16 count) { + createPanel(); + showPanel(); + showMan(); + showExit(); + obIcons(); + uint16 offset = kTextstart + getSegment(data.word(kPuzzletext)).word(command * 2); + const uint8 *string = getSegment(data.word(kPuzzletext)).ptr(offset, 0); + printDirect(string, 36, 104, 241, 241 & 1); + workToScreenM(); + hangOnP(count); +} + } // End of namespace DreamGen diff --git a/engines/dreamweb/vgafades.cpp b/engines/dreamweb/vgafades.cpp index 6766d56424..7518c226f4 100644 --- a/engines/dreamweb/vgafades.cpp +++ b/engines/dreamweb/vgafades.cpp @@ -114,7 +114,7 @@ void DreamBase::fadeCalculation() { --data.byte(kFadecount); } -void DreamGenContext::fadeupYellows() { +void DreamBase::fadeupYellows() { palToEndPal(); memset(endPalette() + 231 * 3, 0, 8 * 3); memset(endPalette() + 246 * 3, 0, 1 * 3); @@ -125,7 +125,7 @@ void DreamGenContext::fadeupYellows() { hangOn(128); } -void DreamGenContext::fadeupMonFirst() { +void DreamBase::fadeupMonFirst() { palToStartPal(); palToEndPal(); memset(startPalette() + 231 * 3, 0, 8 * 3); -- cgit v1.2.3 From a5879196df33eb7946b2c7afa6491c9a7d5e7213 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 18 Dec 2011 14:14:25 +0200 Subject: DREAMWEB: Port 'showdiarykeys' to C++ --- engines/dreamweb/dreamgen.cpp | 46 ------------------------------------------- engines/dreamweb/dreamgen.h | 1 - engines/dreamweb/stubs.cpp | 20 +++++++++++++++++++ engines/dreamweb/stubs.h | 1 + 4 files changed, 21 insertions(+), 47 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 04276c001e..43c2e50d1e 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -2463,52 +2463,6 @@ lookcolon: goto lookcolon; } -void DreamGenContext::showDiaryKeys() { - STACK_CHECK; - _cmp(data.byte(kPresscount), 0); - if (flags.z()) - return /* (nokeyatall) */; - _dec(data.byte(kPresscount)); - _cmp(data.byte(kPresscount), 0); - if (flags.z()) - return /* (nokeyatall) */; - _cmp(data.byte(kPressed), 'N'); - if (!flags.z()) - goto nokeyn; - al = 3; - _cmp(data.byte(kPresscount), 1); - if (flags.z()) - goto gotkeyn; - al = 4; -gotkeyn: - ah = 0; - di = (68+24)+94; - bx = (48+12)+97; - ds = data.word(kTempgraphics); - showFrame(); - _cmp(data.byte(kPresscount), 1); - if (!flags.z()) - return /* (notshown) */; - showDiaryPage(); - return; -nokeyn: - al = 5; - _cmp(data.byte(kPresscount), 1); - if (flags.z()) - goto gotkeyp; - al = 6; -gotkeyp: - ah = 0; - di = (68+24)+151; - bx = (48+12)+71; - ds = data.word(kTempgraphics); - showFrame(); - _cmp(data.byte(kPresscount), 1); - if (!flags.z()) - return /* (notshowp) */; - showDiaryPage(); -} - void DreamGenContext::findPathOfPoint() { STACK_CHECK; push(ax); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index cbf4d558c8..9ecd688824 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -507,7 +507,6 @@ public: void deleteExObject(); void getEitherAd(); void dropObject(); - void showDiaryKeys(); void useOpened(); void signOn(); void locationPic(); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 021b2bad84..51587f1bde 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -4569,5 +4569,25 @@ void DreamBase::clearChanges() { memcpy(data.ptr(kRoomscango, 16), initialRoomsCanGo, 16); } +void DreamGenContext::showDiaryKeys() { + if (!data.byte(kPresscount)) + return; // nokeyatall + + data.byte(kPresscount)--; + + if (!data.byte(kPresscount)) + return; // nokeyatall + + if (data.byte(kPressed) == 'N') { + byte frame = (data.byte(kPresscount) == 1) ? 3 : 4; + showFrame(tempGraphics(), kDiaryx + 94, kDiaryy + 97, frame, 0); + } else { + byte frame = (data.byte(kPresscount) == 1) ? 5 : 6; + showFrame(tempGraphics(), kDiaryx + 151, kDiaryy + 71, frame, 0); + } + + if (data.byte(kPresscount) == 1) + showDiaryPage(); +} } // End of namespace DreamGen diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index b835a26ea1..1578aefc71 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -368,5 +368,6 @@ void findInvPos(); uint16 findInvPosCPP(); void setPickup(); + void showDiaryKeys(); #endif -- cgit v1.2.3 From 362f21d30d2b8f531c30ec19829326e369ac01cd Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 18 Dec 2011 15:43:03 +0200 Subject: DREAMWEB: Port 'showkeys' to C++ --- engines/dreamweb/dreamgen.cpp | 27 --------------------------- engines/dreamweb/dreamgen.h | 1 - engines/dreamweb/monitor.cpp | 42 +++++++++++++++++++++++++++++++++++------- engines/dreamweb/stubs.h | 1 + 4 files changed, 36 insertions(+), 35 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 43c2e50d1e..f7632514e1 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -2129,33 +2129,6 @@ passpassed: es.byte(bx) = 1; } -void DreamGenContext::showKeys() { - STACK_CHECK; - cx = 10; - randomAccess(); - scrollMonitor(); - al = 18; - monMessage(); - es = cs; - bx = offset_keys; - cx = 4; -keysloop: - push(cx); - push(bx); - _cmp(es.byte(bx), 0); - if (flags.z()) - goto notheld; - _add(bx, 14); - monPrint(); -notheld: - bx = pop(); - cx = pop(); - _add(bx, 26); - if (--cx) - goto keysloop; - scrollMonitor(); -} - void DreamGenContext::read() { STACK_CHECK; cx = 40; diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 9ecd688824..12af1ab3c7 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -495,7 +495,6 @@ public: void purgeAnItem(); void purgeALocation(); void getSetAd(); - void showKeys(); void nextColon(); void findOpenPos(); void deleteExFrame(); diff --git a/engines/dreamweb/monitor.cpp b/engines/dreamweb/monitor.cpp index 9bac71a8e5..8ff199cf49 100644 --- a/engines/dreamweb/monitor.cpp +++ b/engines/dreamweb/monitor.cpp @@ -25,21 +25,33 @@ namespace DreamGen { struct MonitorKeyEntry { - uint8 b0; - uint8 b1; - char b2[24]; + uint8 keyHeld; + uint8 b1; // unused, for alignment + char userpass[24]; + //char password[12]; // for the new monitor key list below + //char username[12]; // for the new monitor key list below }; +#if 0 +// New monitor key list +static MonitorKeyEntry monitorKeyEntries[4] = { + { 1, "PUBLIC ", "PUBLIC " }, + { 0, "BLACKDRAGON", "RYAN " }, + { 0, "HENDRIX ", "LOUIS " }, + { 0, "SEPTIMUS ", "BECKETT " } +}; +#endif + void DreamGenContext::useMon() { data.byte(kLasttrigger) = 0; memset(data.ptr(kCurrentfile+1, 0), ' ', 12); memset(data.ptr(offset_operand1+1, 0), ' ', 12); MonitorKeyEntry *monitorKeyEntries = (MonitorKeyEntry *)data.ptr(offset_keys, 0); - monitorKeyEntries[0].b0 = 1; - monitorKeyEntries[1].b0 = 0; - monitorKeyEntries[2].b0 = 0; - monitorKeyEntries[3].b0 = 0; + monitorKeyEntries[0].keyHeld = 1; + monitorKeyEntries[1].keyHeld = 0; + monitorKeyEntries[2].keyHeld = 0; + monitorKeyEntries[3].keyHeld = 0; createPanel(); showPanel(); @@ -417,4 +429,20 @@ void DreamBase::loadCart() { data.word(kTextfile3) = standardLoad("DREAMWEB.T24"); // monitor file 24 } +void DreamGenContext::showKeys() { + randomAccess(10); + scrollMonitor(); + monMessage(18); + + MonitorKeyEntry *monitorKeyEntries = (MonitorKeyEntry *)data.ptr(offset_keys, 0); + + for (int i = 0; i < 4; i++) { + if (monitorKeyEntries[i].keyHeld) + monPrint(monitorKeyEntries[i].userpass + 12); // username + //monPrint(monitorKeyEntries[i].username); + } + + scrollMonitor(); +} + } // End of namespace DreamGen diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 1578aefc71..0d2d8dfe76 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -369,5 +369,6 @@ uint16 findInvPosCPP(); void setPickup(); void showDiaryKeys(); + void showKeys(); #endif -- cgit v1.2.3 From 62dc71a73a894426cb2f5c61e26ab53b0c9f06ad Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 18 Dec 2011 16:43:05 +0200 Subject: DREAMWEB: Port 'getkeyandlogo' to C++ --- engines/dreamweb/dreamgen.cpp | 45 ------------------------------------------- engines/dreamweb/dreamgen.h | 1 - engines/dreamweb/monitor.cpp | 18 +++++++++++++++++ engines/dreamweb/stubs.h | 1 + 4 files changed, 19 insertions(+), 46 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index f7632514e1..6034e0ea69 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -2298,51 +2298,6 @@ endofdir2: scrollMonitor(); } -void DreamGenContext::getKeyAndLogo() { - STACK_CHECK; - _inc(bx); - al = es.byte(bx); - _sub(al, 48); - data.byte(kNewlogonum) = al; - _add(bx, 2); - al = es.byte(bx); - _sub(al, 48); - data.byte(kKeynum) = al; - _inc(bx); - push(es); - push(bx); - al = data.byte(kKeynum); - ah = 0; - cx = 26; - _mul(cx); - es = cs; - bx = offset_keys; - _add(bx, ax); - al = es.byte(bx); - _cmp(al, 1); - if (flags.z()) - goto keyok; - push(bx); - push(es); - al = 12; - monMessage(); - es = pop(); - bx = pop(); - _add(bx, 14); - monPrint(); - scrollMonitor(); - bx = pop(); - es = pop(); - al = 1; - return; -keyok: - bx = pop(); - es = pop(); - al = data.byte(kNewlogonum); - data.byte(kLogonum) = al; - al = 0; -} - void DreamGenContext::searchForString() { STACK_CHECK; dl = es.byte(di); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 12af1ab3c7..7f1601e5f6 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -487,7 +487,6 @@ public: void removeObFromInv(); void dirFile(); void pickupConts(); - void getKeyAndLogo(); void fadeUpMon(); void reExFromInv(); void outOfInv(); diff --git a/engines/dreamweb/monitor.cpp b/engines/dreamweb/monitor.cpp index 8ff199cf49..dd94633105 100644 --- a/engines/dreamweb/monitor.cpp +++ b/engines/dreamweb/monitor.cpp @@ -445,4 +445,22 @@ void DreamGenContext::showKeys() { scrollMonitor(); } +void DreamGenContext::getKeyAndLogo() { + byte newLogo = es.byte(bx + 1) - 48; + MonitorKeyEntry *monitorKeyEntries = (MonitorKeyEntry *)data.ptr(offset_keys, 0); + byte keyNum = es.byte(bx + 1 + 2) - 48; + bx += 1 + 2 + 1; + + if (monitorKeyEntries[keyNum].keyHeld == 1) { + // Key OK + data.byte(kLogonum) = newLogo; + al = 0; + } else { + monMessage(12); // "Access denied, key required -" + monPrint(monitorKeyEntries[keyNum].userpass + 12); // username + scrollMonitor(); + al = 1; + } +} + } // End of namespace DreamGen diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 0d2d8dfe76..3e61367e2d 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -370,5 +370,6 @@ void setPickup(); void showDiaryKeys(); void showKeys(); + void getKeyAndLogo(); #endif -- cgit v1.2.3 From 133cfc3ae9de62daa3b3aa9cd7a9d0328b4043dc Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sun, 18 Dec 2011 15:55:27 +0100 Subject: DREAMWEB: Fix yet another regression in setPickup getAnyAd and getEitherAd have different inputs, so can't be interchanged... --- engines/dreamweb/object.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index 473d876ce8..53ecc0c362 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -431,9 +431,9 @@ void DreamGenContext::selectOb() { void DreamGenContext::setPickup() { if (data.byte(kObjecttype) != kSetObjectType1 && data.byte(kObjecttype) != kSetObjectType3) { // The original called getAnyAd() here. However, since object types - // 1 and 3 are excluded, the resulting object is a DynObject, so - // we can use getEitherAd() instead. - DynObject *object = getEitherAdCPP(); + // 1 and 3 are excluded, the resulting object is a DynObject + uint8 dummy; + DynObject *object = (DynObject *)getAnyAd(&dummy, &dummy); if (object->mapad[0] == 4) { blank(); return; -- cgit v1.2.3 From ebbc8ae3d2f7b868d4392b3df82ec1f332599dd7 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sun, 18 Dec 2011 14:26:29 +0100 Subject: DREAMWEB: Set es for reel callbacks while it may be necessary --- engines/dreamweb/people.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/dreamweb/people.cpp b/engines/dreamweb/people.cpp index 8998e2f394..81de17cbac 100644 --- a/engines/dreamweb/people.cpp +++ b/engines/dreamweb/people.cpp @@ -143,11 +143,14 @@ void DreamGenContext::updatePeople() { ReelRoutine *r = (ReelRoutine *)data.ptr(kReelroutines, 0); for (int i = 0; r[i].reallocation != 255; ++i) { - bx = kReelroutines + 8*i; if (r[i].reallocation == data.byte(kReallocation) && r[i].mapX == data.byte(kMapx) && r[i].mapY == data.byte(kMapy)) { assert(reelCallbacks[i]); + // Set es:bx to the ReelRoutine, while not all ReelCallbacks are in + // DreamBase + es = data; + bx = kReelroutines + 8*i; (this->*(reelCallbacks[i]))(r[i]); } } -- cgit v1.2.3 From 8449493eff5ff26e8550dec6c50470521fc31947 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sun, 18 Dec 2011 15:32:25 +0100 Subject: DREAMWEB: Convert removeObFromInv, deleteExObject, deleteExFrame, deleteExText --- engines/dreamweb/dreambase.h | 5 ++ engines/dreamweb/dreamgen.cpp | 143 ------------------------------------------ engines/dreamweb/dreamgen.h | 4 -- engines/dreamweb/object.cpp | 86 +++++++++++++++++++++++++ engines/dreamweb/people.cpp | 2 +- engines/dreamweb/stubs.cpp | 2 +- engines/dreamweb/stubs.h | 16 ++++- 7 files changed, 108 insertions(+), 150 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 6f78bcad07..eae1d05902 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -137,6 +137,10 @@ public: void findAllRyan(uint8 *inv); void obToInv(uint8 index, uint8 flag, uint16 x, uint16 y); void obPicture(); + void removeObFromInv(); + void deleteExObject(uint8 index); + void deleteExFrame(uint8 frameNum); + void deleteExText(uint8 textNum); // from pathfind.cpp void turnPathOn(uint8 param); @@ -417,6 +421,7 @@ public: void hangOnCurs(uint16 frameCount); const uint8 *findObName(uint8 type, uint8 index); void copyName(uint8 type, uint8 index, uint8 *dst); + uint16 findExObject(const char *id); // from use.cpp void placeFreeObject(uint8 index); diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 6034e0ea69..6d303e62bf 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -985,18 +985,6 @@ notinlift: es.byte(bx) = al; } -void DreamGenContext::removeObFromInv() { - STACK_CHECK; - _cmp(data.byte(kCommand), 100); - if (flags.z()) - return /* (obnotexist) */; - getAnyAd(); - di = bx; - cl = data.byte(kCommand); - ch = 0; - deleteExObject(); -} - void DreamGenContext::selectOpenOb() { STACK_CHECK; al = data.byte(kCommand); @@ -1466,137 +1454,6 @@ cantpurge2: goto lookforpurge2; } -void DreamGenContext::deleteExObject() { - STACK_CHECK; - push(cx); - push(cx); - push(cx); - push(cx); - al = 255; - cx = 16; - _stosb(cx, true); - ax = pop(); - cl = al; - _add(al, al); - _add(al, cl); - deleteExFrame(); - ax = pop(); - cl = al; - _add(al, al); - _add(al, cl); - _inc(al); - deleteExFrame(); - ax = pop(); - deleteExText(); - bx = pop(); - bh = bl; - bl = 4; - di = (0+2080+30000); - cx = 0; -deleteconts: - _cmp(es.word(di+2), bx); - if (!flags.z()) - goto notinsideex; - push(bx); - push(cx); - push(di); - deleteExObject(); - di = pop(); - cx = pop(); - bx = pop(); -notinsideex: - _add(di, 16); - _inc(cx); - _cmp(cx, (114)); - if (!flags.z()) - goto deleteconts; -} - -void DreamGenContext::deleteExFrame() { - STACK_CHECK; - di = (0); - ah = 0; - _add(ax, ax); - _add(di, ax); - _add(ax, ax); - _add(di, ax); - al = es.byte(di); - ah = 0; - cl = es.byte(di+1); - ch = 0; - _mul(cx); - si = es.word(di+2); - push(si); - _add(si, (0+2080)); - cx = (30000); - _sub(cx, es.word(di+2)); - di = si; - _add(si, ax); - push(ax); - ds = es; - _movsb(cx, true); - bx = pop(); - _sub(data.word(kExframepos), bx); - si = pop(); - cx = (114)*3; - di = (0); -shuffleadsdown: - ax = es.word(di+2); - _cmp(ax, si); - if (flags.c()) - goto beforethisone; - _sub(ax, bx); -beforethisone: - es.word(di+2) = ax; - _add(di, 6); - if (--cx) - goto shuffleadsdown; -} - -void DreamGenContext::deleteExText() { - STACK_CHECK; - di = (0+2080+30000+(16*114)); - ah = 0; - _add(ax, ax); - _add(di, ax); - ax = es.word(di); - si = ax; - di = ax; - _add(si, (0+2080+30000+(16*114)+((114+2)*2))); - _add(di, (0+2080+30000+(16*114)+((114+2)*2))); - ax = 0; -findlenextext: - cl = es.byte(si); - _inc(ax); - _inc(si); - _cmp(cl, 0); - if (!flags.z()) - goto findlenextext; - cx = (18000); - bx = si; - _sub(bx, (0+2080+30000+(16*114)+((114+2)*2))); - push(bx); - push(ax); - _sub(cx, bx); - _movsb(cx, true); - bx = pop(); - _sub(data.word(kExtextpos), bx); - si = pop(); - cx = (114); - di = (0+2080+30000+(16*114)); -shuffletextads: - ax = es.word(di); - _cmp(ax, si); - if (flags.c()) - goto beforethistext; - _sub(ax, bx); -beforethistext: - es.word(di) = ax; - _add(di, 2); - if (--cx) - goto shuffletextads; -} - void DreamGenContext::startTalk() { STACK_CHECK; data.byte(kTalkmode) = 0; diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 7f1601e5f6..b7a644fe1f 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -482,9 +482,7 @@ public: void getAnyAd(); void reminders(); void inToInv(); - void deleteExText(); void getFreeAd(); - void removeObFromInv(); void dirFile(); void pickupConts(); void fadeUpMon(); @@ -496,13 +494,11 @@ public: void getSetAd(); void nextColon(); void findOpenPos(); - void deleteExFrame(); void searchForSame(); void rollEm(); void lookAtPlace(); void findAllOpen(); void fillOpen(); - void deleteExObject(); void getEitherAd(); void dropObject(); void useOpened(); diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index 53ecc0c362..384e001b5e 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -477,4 +477,90 @@ void DreamGenContext::setPickup() { workToScreenM(); } +void DreamGenContext::deleteExFrame() { + deleteExFrame(al); +} + +void DreamBase::deleteExFrame(uint8 frameNum) { + Frame *frame = (Frame *)getSegment(data.word(kExtras)).ptr(kExframedata + sizeof(Frame)*frameNum, sizeof(Frame)); + + 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 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); + + // 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)); + if (frame->ptr() >= startOff) + frame->setPtr(frame->ptr() - frameSize); + } +} + +void DreamGenContext::deleteExText() { + deleteExText(al); +} + +void DreamBase::deleteExText(uint8 textNum) { + uint16 offset = getSegment(data.word(kExtras)).word(kExtextdat + 2*textNum); + + uint16 startOff = kExtext + offset; + uint16 textSize = strlen((char *)getSegment(data.word(kExtras)).ptr(startOff, 0)) + 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); + + // 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); + if (t >= offset + textSize) + getSegment(data.word(kExtras)).word(kExtextdat + 2*i) = t - textSize; + } +} + +// This takes es:di and cl as input, but es:di always points to getExAd(cl) +void DreamGenContext::deleteExObject() { + deleteExObject(cl); +} + +void DreamBase::deleteExObject(uint8 index) { + DynObject *obj = getExAd(index); + + memset(obj, 0xFF, sizeof(DynObject)); + + deleteExFrame(3*index); + deleteExFrame(3*index + 1); + + deleteExText(index); + + for (uint8 i = 0; i < kNumexobjects; ++i) { + DynObject *t = getExAd(index); + // Is this object contained in the one we've just deleted? + if (t->mapad[0] == 4 && t->mapad[1] == index) + deleteExObject(i); + } +} + +void DreamBase::removeObFromInv() { + if (data.byte(kCommand) == 100) + return; // object doesn't exit + + assert(data.byte(kObjecttype) == kExObjectType); + + deleteExObject(data.byte(kCommand)); +} + + } // End of namespace DreamGen diff --git a/engines/dreamweb/people.cpp b/engines/dreamweb/people.cpp index 81de17cbac..20d67763ad 100644 --- a/engines/dreamweb/people.cpp +++ b/engines/dreamweb/people.cpp @@ -48,7 +48,7 @@ static void (DreamGenContext::*reelCallbacks[57])(ReelRoutine &) = { &DreamBase::gates, &DreamBase::introMagic3, &DreamBase::introMonks1, &DreamBase::candles, &DreamBase::introMonks2, &DreamBase::handClap, - &DreamBase::monkAndRyan, &DreamGenContext::endGameSeq, + &DreamBase::monkAndRyan, &DreamBase::endGameSeq, &DreamBase::priest, &DreamBase::madman, &DreamBase::madmansTelly, &DreamBase::alleyBarkSound, &DreamBase::foghornSound, &DreamBase::carParkDrip, diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 51587f1bde..6b7e9a7784 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -1734,7 +1734,7 @@ void DreamGenContext::findExObject() { bx = kExdata + al * 16; } -uint16 DreamGenContext::findExObject(const char *id) { +uint16 DreamBase::findExObject(const char *id) { for (uint16 index = 0; index < kNumexobjects; index++) { if (objectMatches(getExAd(index), id)) return index; diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 3e61367e2d..aeda662283 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -349,7 +349,9 @@ void lookAtCard(); bool execCommand(); void findExObject(); - uint16 findExObject(const char *id); + uint16 findExObject(const char *id) { + return DreamBase::findExObject(id); + } void isRyanHolding(); bool isRyanHolding(const char *id) { return DreamBase::isRyanHolding(id); @@ -371,5 +373,17 @@ void showDiaryKeys(); void showKeys(); void getKeyAndLogo(); + void deleteExObject(); + void deleteExObject(uint8 index) { + DreamBase::deleteExObject(index); + } + void deleteExFrame(); + void deleteExFrame(uint8 frameNum) { + DreamBase::deleteExFrame(frameNum); + } + void deleteExText(); + void deleteExText(uint8 textNum) { + DreamBase::deleteExText(textNum); + } #endif -- cgit v1.2.3 From 49877b231916a9ed75ab5b63870e89c351aafedf Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sun, 18 Dec 2011 16:20:17 +0100 Subject: DREAMWEB: Move all reel functions to DreamBase --- engines/dreamweb/dreambase.h | 11 ++++++++++- engines/dreamweb/people.cpp | 12 ++++-------- engines/dreamweb/sprite.cpp | 42 +++++++++++++----------------------------- engines/dreamweb/stubs.cpp | 6 +++--- engines/dreamweb/stubs.h | 10 ---------- 5 files changed, 30 insertions(+), 51 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index eae1d05902..9a5d68436c 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -158,6 +158,7 @@ public: void workoutFrames(); // from people.cpp + void updatePeople(); void madmanText(); void madman(ReelRoutine &routine); void madMode(); @@ -206,7 +207,7 @@ public: void bartender(ReelRoutine &routine); void heavy(ReelRoutine &routine); void helicopter(ReelRoutine &routine); - //void mugger(ReelRoutine &routine); + void mugger(ReelRoutine &routine); void businessMan(ReelRoutine &routine); void endGameSeq(ReelRoutine &routine); void poolGuard(ReelRoutine &routine); @@ -288,6 +289,11 @@ public: void getRidOfReels(); void liftNoise(uint8 index); void checkForExit(Sprite *sprite); + void mainMan(Sprite *sprite); + void spriteUpdate(); + void showRain(); + void reconstruct(); + void reelsOnScreen(); // from stubs.cpp bool isCD(); @@ -422,6 +428,9 @@ public: const uint8 *findObName(uint8 type, uint8 index); void copyName(uint8 type, uint8 index, uint8 *dst); uint16 findExObject(const char *id); + void makeMainScreen(); + void showWatchReel(); + void watchReel(); // from use.cpp void placeFreeObject(uint8 index); diff --git a/engines/dreamweb/people.cpp b/engines/dreamweb/people.cpp index 20d67763ad..801e959a13 100644 --- a/engines/dreamweb/people.cpp +++ b/engines/dreamweb/people.cpp @@ -24,7 +24,7 @@ namespace DreamGen { -static void (DreamGenContext::*reelCallbacks[57])(ReelRoutine &) = { +static void (DreamBase::*reelCallbacks[57])(ReelRoutine &) = { &DreamBase::gamer, &DreamBase::sparkyDrip, &DreamBase::eden, &DreamBase::edenInBath, &DreamBase::sparky, &DreamBase::smokeBloke, @@ -42,7 +42,7 @@ static void (DreamGenContext::*reelCallbacks[57])(ReelRoutine &) = { &DreamBase::copper, &DreamBase::poolGuard, &DreamBase::rockstar, &DreamBase::businessMan, &DreamBase::train, &DreamBase::genericPerson /*aide*/, - &DreamGenContext::mugger, &DreamBase::helicopter, + &DreamBase::mugger, &DreamBase::helicopter, &DreamBase::introMagic1, &DreamBase::introMusic, &DreamBase::introMagic2, &DreamBase::candles2, &DreamBase::gates, &DreamBase::introMagic3, @@ -135,7 +135,7 @@ void DreamBase::setupInitialReelRoutines(ReelRoutine *dest) { } #endif -void DreamGenContext::updatePeople() { +void DreamBase::updatePeople() { data.word(kListpos) = kPeoplelist; memset(getSegment(data.word(kBuffers)).ptr(kPeoplelist, 12 * sizeof(People)), 0xff, 12 * sizeof(People)); ++data.word(kMaintimer); @@ -147,10 +147,6 @@ void DreamGenContext::updatePeople() { r[i].mapX == data.byte(kMapx) && r[i].mapY == data.byte(kMapy)) { assert(reelCallbacks[i]); - // Set es:bx to the ReelRoutine, while not all ReelCallbacks are in - // DreamBase - es = data; - bx = kReelroutines + 8*i; (this->*(reelCallbacks[i]))(r[i]); } } @@ -915,7 +911,7 @@ void DreamBase::helicopter(ReelRoutine &routine) { } } -void DreamGenContext::mugger(ReelRoutine &routine) { +void DreamBase::mugger(ReelRoutine &routine) { if (routine.reelPointer() != 138) { if (routine.reelPointer() == 176) return; // endmugger2 diff --git a/engines/dreamweb/sprite.cpp b/engines/dreamweb/sprite.cpp index 1e980de015..cc6b09fd68 100644 --- a/engines/dreamweb/sprite.cpp +++ b/engines/dreamweb/sprite.cpp @@ -88,7 +88,7 @@ Sprite *DreamBase::makeSprite(uint8 x, uint8 y, uint16 updateCallback, uint16 fr return sprite; } -void DreamGenContext::spriteUpdate() { +void DreamBase::spriteUpdate() { Sprite *sprites = spriteTable(); sprites[0].hidden = data.byte(kRyanon); @@ -118,30 +118,19 @@ void DreamBase::initMan() { sprite->walkFrame = 0; } -void DreamGenContext::mainMan(Sprite *sprite) { - push(es); - push(ds); - - // Recover es:bx from sprite - es = data.word(kBuffers); - bx = kSpritetable; - Sprite *sprites = (Sprite *)es.ptr(bx, sizeof(Sprite) * 16); - bx += 32 * (sprite - sprites); - // - +void DreamBase::mainMan(Sprite *sprite) { if (data.byte(kResetmanxy) == 1) { data.byte(kResetmanxy) = 0; sprite->x = data.byte(kRyanx); sprite->y = data.byte(kRyany); sprite->walkFrame = 0; } + --sprite->speed; - if (sprite->speed != 0xff) { - ds = pop(); - es = pop(); + if (sprite->speed != 0xff) return; - } sprite->speed = 0; + if (data.byte(kTurntoface) != data.byte(kFacing)) { aboutTurn(sprite); } else { @@ -177,9 +166,6 @@ void DreamGenContext::mainMan(Sprite *sprite) { sprite->frameNumber = sprite->walkFrame + facelist[data.byte(kFacing)]; data.byte(kRyanx) = sprite->x; data.byte(kRyany) = sprite->y; - - ds = pop(); - es = pop(); } void DreamBase::walking(Sprite *sprite) { @@ -487,25 +473,23 @@ const Frame *DreamBase::getReelFrameAX(uint16 frame) { return base + frame; } -void DreamGenContext::showRain() { +void DreamBase::showRain() { Rain *rain = (Rain *)getSegment(data.word(kBuffers)).ptr(kRainlist, 0); // Do nothing if there's no rain at all if (rain->x == 255) return; - ds = data.word(kMainsprites); - si = 6*58; // Frame 58 - ax = ds.word(si+2); // Frame::ptr - si = ax + 2080; + const Frame *frame = (const Frame *)getSegment(data.word(kMainsprites)).ptr(58 * sizeof(Frame), sizeof(Frame)); + const uint8 *frameData = getSegment(data.word(kMainsprites)).ptr(kFrframes + frame->ptr(), 512); for (; rain->x != 255; ++rain) { uint16 y = rain->y + data.word(kMapady) + data.word(kMapystart); uint16 x = rain->x + data.word(kMapadx) + data.word(kMapxstart); uint16 size = rain->size; - ax = ((uint16)(rain->w3() - rain->b5)) & 511; - rain->setW3(ax); - const uint8 *src = ds.ptr(si, 0) + ax; + uint16 offset = (rain->w3() - rain->b5) & 511; + rain->setW3(offset); + const uint8 *src = frameData + offset; uint8 *dst = workspace() + y * 320 + x; for (uint16 i = 0; i < size; ++i) { uint8 v = src[i]; @@ -872,7 +856,7 @@ void DreamBase::textForMonk() { } } -void DreamGenContext::reelsOnScreen() { +void DreamBase::reelsOnScreen() { reconstruct(); updatePeople(); watchReel(); @@ -880,7 +864,7 @@ void DreamGenContext::reelsOnScreen() { useTimedText(); } -void DreamGenContext::reconstruct() { +void DreamBase::reconstruct() { if (data.byte(kHavedoneobs) == 0) return; data.byte(kNewobs) = 1; diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 6b7e9a7784..4ac13ea3fb 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -3273,7 +3273,7 @@ void DreamGenContext::allPointer() { dumpPointer(); } -void DreamGenContext::makeMainScreen() { +void DreamBase::makeMainScreen() { createPanel(); data.byte(kNewobs) = 1; drawFloor(); @@ -3697,7 +3697,7 @@ void DreamBase::putUnderZoom() { multiPut(getSegment(data.word(kBuffers)).ptr(kZoomspace, 0), kZoomx + 5, kZoomy + 4, 46, 40); } -void DreamGenContext::showWatchReel() { +void DreamBase::showWatchReel() { uint16 reelPointer = data.word(kReeltowatch); plotReel(reelPointer); data.word(kReeltowatch) = reelPointer; @@ -3707,7 +3707,7 @@ void DreamGenContext::showWatchReel() { data.byte(kShakecounter) = 0xFF; } -void DreamGenContext::watchReel() { +void DreamBase::watchReel() { if (data.word(kReeltowatch) != 0xFFFF) { if (data.byte(kManspath) != data.byte(kFinaldest)) return; // Wait until stopped walking diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index aeda662283..de03e45c62 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -61,10 +61,7 @@ DreamBase::showFrame(frameData, x, y, frameNumber, effectsFlag); } void width160(); - void spriteUpdate(); - void mainMan(Sprite *sprite); void zoom(); - void showRain(); void commandOnly(); void commandOnly(uint8 command) { DreamBase::commandOnly(command); @@ -77,7 +74,6 @@ bool checkIfEx(uint8 x, uint8 y); void commandWithOb(); void commandWithOb(uint8 command, uint8 type, uint8 index); - void updatePeople(); void blockNameText(); void walkToText(); void personNameText(); @@ -171,8 +167,6 @@ void playChannel1(uint8 index) { DreamBase::playChannel1(index); } - void reelsOnScreen(); - void reconstruct(); void look(); void autoLook(); void doLook(); @@ -238,7 +232,6 @@ void checkFolderCoords(); void nextFolder(); void lastFolder(); - void mugger(ReelRoutine &routine); void singleKey(uint8 key, uint16 x, uint16 y); void loadSaveBox(); uint8 nextSymbol(uint8 symbol); @@ -295,7 +288,6 @@ void openTomb(); void hotelControl(); void obsThatDoThings(); - void makeMainScreen(); void delEverything(); void errorMessage1(); void errorMessage2(); @@ -316,8 +308,6 @@ void set16ColPalette(); void showSaveOps(); void showLoadOps(); - void watchReel(); - void showWatchReel(); void afterNewRoom(); void madmanRun(); void showDecisions(); -- cgit v1.2.3 From 60ece632b87ab8cb797df0a245bb5f97301fe610 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sun, 18 Dec 2011 16:53:47 +0100 Subject: DREAMWEB: Remove reelRoutines from data blob --- engines/dreamweb/dreambase.h | 9 +++ engines/dreamweb/dreamgen.cpp | 158 ++++++++++++++---------------------------- engines/dreamweb/dreamgen.h | 33 +++++---- engines/dreamweb/people.cpp | 29 +++----- engines/dreamweb/saveload.cpp | 29 +++----- engines/dreamweb/structs.h | 8 --- engines/dreamweb/stubs.cpp | 8 +-- engines/dreamweb/stubs.h | 2 - 8 files changed, 96 insertions(+), 180 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 9a5d68436c..6de854f452 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -34,6 +34,9 @@ namespace DreamWeb { namespace DreamGen { + +const unsigned int kNumReelRoutines = 57; + /** * This class is one of the parent classes of DreamGenContext. Its sole purpose * is to allow us to incrementally move things out of DreamGenContext into this @@ -60,6 +63,9 @@ protected: // from vgagrafx.cpp uint8 _workspace[(0x1000 + 2) * 16]; + // from people.cpp + ReelRoutine _reelRoutines[kNumReelRoutines+1]; + public: DreamBase(DreamWeb::DreamWebEngine *en); @@ -158,6 +164,7 @@ public: void workoutFrames(); // from people.cpp + void setupInitialReelRoutines(); void updatePeople(); void madmanText(); void madman(ReelRoutine &routine); @@ -232,6 +239,8 @@ public: void showMainOps(); void showDiscOps(); void showNames(); + void loadPosition(unsigned int slot); + void savePosition(unsigned int slot, const char *descbuf); // from sound.cpp bool loadSpeech(byte type1, int idx1, byte type2, int idx2); diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 6d303e62bf..33bac8299e 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -1773,14 +1773,14 @@ void DreamGenContext::getDestInfo() { push(ax); dx = data; es = dx; - si = 1120; + si = 663; _add(si, ax); cl = es.byte(si); ax = pop(); push(cx); dx = data; es = dx; - si = 1136; + si = 679; _add(si, ax); ax = pop(); } @@ -1832,7 +1832,7 @@ clearedlocations: bx = ax; dx = data; es = dx; - _add(bx, 1120); + _add(bx, 663); es.byte(bx) = 0; } @@ -1852,7 +1852,7 @@ dirroot: si = offset_rootdir; _inc(si); es = cs; - di = 1045; + di = 588; _inc(di); cx = 12; _movsb(cx, true); @@ -1954,7 +1954,7 @@ notyetassigned: push(bx); _add(bx, 2); ds = cs; - si = 1154; + si = 697; checkpass: _lodsw(); ah = es.byte(bx); @@ -1998,7 +1998,7 @@ void DreamGenContext::read() { return; okcom: es = cs; - di = 1045; + di = 588; ax = data.word(kTextfile1); data.word(kMonsource) = ax; ds = ax; @@ -2128,7 +2128,7 @@ keyok2: ds = cs; si = offset_operand1+1; es = cs; - di = 1045+1; + di = 588+1; cx = 12; _movsb(cx, true); monitorLogo(); @@ -2210,7 +2210,7 @@ void DreamGenContext::parser() { al = '='; _stosb(); ds = cs; - si = 1154; + si = 697; notspace1: _lodsw(); _cmp(al, 32); @@ -2391,113 +2391,57 @@ void DreamGenContext::__start() { //0x0190: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x01a0: .... .... .... .... - 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x01, 0x2c, 0x00, 0x14, 0x00, 0x02, 0x00, - //0x01b0: .... .... ..,. .... - 0x01, 0x01, 0x37, 0x00, 0x00, 0x00, 0x32, 0x14, 0x00, 0x18, 0x16, 0x00, 0x4a, 0x00, 0x01, 0x00, - //0x01c0: ..7. ..2. .... J... - 0x00, 0x18, 0x21, 0x0a, 0x4b, 0x00, 0x01, 0x00, 0x01, 0x01, 0x2c, 0x00, 0x1b, 0x00, 0x02, 0x00, - //0x01d0: ..!. K... ..,. .... - 0x02, 0x01, 0x2c, 0x00, 0x60, 0x00, 0x03, 0x00, 0x04, 0x01, 0x2c, 0x00, 0x76, 0x00, 0x02, 0x00, - //0x01e0: ..,. `... ..,. v... - 0x05, 0x01, 0x2c, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x00, 0x05, 0x16, 0x14, 0x35, 0x00, 0x03, 0x00, - //0x01f0: ..,. .... .... 5... - 0x00, 0x05, 0x16, 0x14, 0x28, 0x00, 0x01, 0x00, 0x02, 0x05, 0x16, 0x14, 0x32, 0x00, 0x01, 0x00, - //0x0200: .... (... .... 2... - 0x03, 0x02, 0x0b, 0x0a, 0xc0, 0x00, 0x01, 0x00, 0x00, 0x02, 0x0b, 0x0a, 0xb6, 0x00, 0x02, 0x00, - //0x0210: .... .... .... .... - 0x01, 0x08, 0x0b, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x01, 0x17, 0x00, 0x32, 0x00, 0x00, 0x03, 0x00, - //0x0220: .... .... ...2 .... - 0x00, 0x1c, 0x0b, 0x14, 0xfa, 0x00, 0x04, 0x00, 0x00, 0x17, 0x00, 0x32, 0x2b, 0x00, 0x02, 0x00, - //0x0230: .... .... ...2 +... - 0x08, 0x17, 0x0b, 0x28, 0x82, 0x00, 0x02, 0x00, 0x01, 0x17, 0x16, 0x28, 0x7a, 0x00, 0x02, 0x00, - //0x0240: ...( .... ...( z... - 0x02, 0x17, 0x16, 0x28, 0x69, 0x00, 0x02, 0x00, 0x03, 0x17, 0x16, 0x28, 0x51, 0x00, 0x02, 0x00, - //0x0250: ...( i... ...( Q... - 0x04, 0x17, 0x0b, 0x28, 0x87, 0x00, 0x02, 0x00, 0x05, 0x17, 0x16, 0x28, 0x91, 0x00, 0x02, 0x00, - //0x0260: ...( .... ...( .... - 0x06, 0x04, 0x16, 0x1e, 0x00, 0x00, 0x02, 0x00, 0x00, 0x2d, 0x16, 0x1e, 0xc8, 0x00, 0x00, 0x00, - //0x0270: .... .... .-.. .... - 0x14, 0x2d, 0x16, 0x1e, 0x27, 0x00, 0x02, 0x00, 0x00, 0x2d, 0x16, 0x1e, 0x19, 0x00, 0x02, 0x00, - //0x0280: .-.. '... .-.. .... - 0x00, 0x08, 0x16, 0x28, 0x20, 0x00, 0x02, 0x00, 0x00, 0x07, 0x0b, 0x14, 0x40, 0x00, 0x02, 0x00, - //0x0290: ...( ... .... @... - 0x00, 0x16, 0x16, 0x14, 0x52, 0x00, 0x02, 0x00, 0x00, 0x1b, 0x0b, 0x1e, 0x00, 0x00, 0x02, 0x00, - //0x02a0: .... R... .... .... - 0x00, 0x14, 0x00, 0x1e, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0e, 0x21, 0x28, 0x15, 0x00, 0x01, 0x00, - //0x02b0: .... .... ..!( .... - 0x00, 0x1d, 0x0b, 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0x16, 0x00, 0x02, 0x00, 0x02, 0x00, - //0x02c0: .... .... .... .... - 0x00, 0x19, 0x00, 0x32, 0x04, 0x00, 0x02, 0x00, 0x00, 0x32, 0x16, 0x1e, 0x79, 0x00, 0x02, 0x00, - //0x02d0: ...2 .... .2.. y... - 0x00, 0x32, 0x16, 0x1e, 0x00, 0x00, 0x14, 0x00, 0x00, 0x34, 0x16, 0x1e, 0xc0, 0x00, 0x02, 0x00, - //0x02e0: .2.. .... .4.. .... - 0x00, 0x34, 0x16, 0x1e, 0xe9, 0x00, 0x02, 0x00, 0x00, 0x32, 0x16, 0x28, 0x68, 0x00, 0x37, 0x00, - //0x02f0: .4.. .... .2.( h.7. - 0x00, 0x35, 0x21, 0x00, 0x63, 0x00, 0x02, 0x00, 0x00, 0x32, 0x16, 0x28, 0x00, 0x00, 0x03, 0x00, - //0x0300: .5!. c... .2.( .... - 0x00, 0x32, 0x16, 0x1e, 0xa2, 0x00, 0x02, 0x00, 0x00, 0x34, 0x16, 0x1e, 0x39, 0x00, 0x02, 0x00, - //0x0310: .2.. .... .4.. 9... - 0x00, 0x34, 0x16, 0x1e, 0x00, 0x00, 0x02, 0x00, 0x00, 0x36, 0x00, 0x00, 0x48, 0x00, 0x03, 0x00, - //0x0320: .4.. .... .6.. H... - 0x00, 0x37, 0x2c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, - //0x0330: .7,. .... .... .... - 0x00, 0x0e, 0x16, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x0e, 0x16, 0x00, 0x2c, 0x01, 0x01, 0x00, - //0x0340: .... .... .... ,... - 0x00, 0x0a, 0x16, 0x1e, 0xae, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x16, 0x14, 0x00, 0x00, 0x01, 0x00, - //0x0350: .... .... .... .... - 0x00, 0x0b, 0x0b, 0x14, 0x00, 0x00, 0x32, 0x14, 0x00, 0x0b, 0x0b, 0x1e, 0x00, 0x00, 0x32, 0x14, - //0x0360: .... ..2. .... ..2. - 0x00, 0x0b, 0x16, 0x14, 0x00, 0x00, 0x32, 0x14, 0x00, 0x0e, 0x21, 0x28, 0x00, 0x00, 0x32, 0x14, - //0x0370: .... ..2. ..!( ..2. - 0x00, 0xff, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x56, 0x39, 0x39, 0x00, 0x01, - //0x0380: ..DR EAMW EB.V 99.. - 0x00, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x50, 0x55, 0x42, - //0x0390: .PUB LIC PUB - 0x4c, 0x49, 0x43, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x42, 0x4c, 0x41, 0x43, 0x4b, - //0x03a0: LIC ...B LACK - 0x44, 0x52, 0x41, 0x47, 0x4f, 0x4e, 0x20, 0x52, 0x59, 0x41, 0x4e, 0x20, 0x20, 0x20, 0x20, 0x20, - //0x03b0: DRAG ON R YAN - 0x20, 0x20, 0x00, 0x00, 0x00, 0x48, 0x45, 0x4e, 0x44, 0x52, 0x49, 0x58, 0x20, 0x20, 0x20, 0x20, - //0x03c0: .. .HEN DRIX - 0x20, 0x4c, 0x4f, 0x55, 0x49, 0x53, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x53, - //0x03d0: LOU IS ...S - 0x45, 0x50, 0x54, 0x49, 0x4d, 0x55, 0x53, 0x20, 0x20, 0x20, 0x20, 0x42, 0x45, 0x43, 0x4b, 0x45, - //0x03e0: EPTI MUS B ECKE - 0x54, 0x54, 0x20, 0x20, 0x20, 0x20, 0x00, 0xff, 0xff, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - //0x03f0: TT .. . - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x22, 0x52, 0x4f, 0x4f, 0x54, 0x20, 0x20, 0x20, 0x20, - //0x0400: ." ROOT - 0x20, 0x20, 0x20, 0x20, 0x00, 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - //0x0410: ." - 0x20, 0x20, 0x00, 0x0d, 0x0a, 0x0d, 0x0a, 0x24, 0x10, 0x12, 0x12, 0x11, 0x10, 0x10, 0x10, 0x01, - //0x0420: .. ...$ .... .... - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, - //0x0430: .... .... .... .... - 0x44, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x0440: D:.. .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x0450: .... .... .... .... - 0x01, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x0460: .... .... .... .... - 0x05, 0x00, 0x03, 0x02, 0x04, 0x01, 0x0a, 0x09, 0x08, 0x06, 0x0b, 0x04, 0x07, 0x07, 0x00, 0x00, - //0x0470: .... .... .... .... + 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, + //0x01b0: .... .... .DRE AMWE + 0x42, 0x2e, 0x56, 0x39, 0x39, 0x00, 0x01, 0x00, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x20, 0x20, + //0x01c0: B.V9 9... PUBL IC + 0x20, 0x20, 0x20, 0x20, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, + //0x01d0: PUBL IC . + 0x00, 0x00, 0x42, 0x4c, 0x41, 0x43, 0x4b, 0x44, 0x52, 0x41, 0x47, 0x4f, 0x4e, 0x20, 0x52, 0x59, + //0x01e0: ..BL ACKD RAGO N RY + 0x41, 0x4e, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x48, 0x45, 0x4e, 0x44, + //0x01f0: AN ... HEND + 0x52, 0x49, 0x58, 0x20, 0x20, 0x20, 0x20, 0x20, 0x4c, 0x4f, 0x55, 0x49, 0x53, 0x20, 0x20, 0x20, + //0x0200: RIX LOUI S + 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x53, 0x45, 0x50, 0x54, 0x49, 0x4d, 0x55, 0x53, 0x20, 0x20, + //0x0210: . ..SE PTIM US + 0x20, 0x20, 0x42, 0x45, 0x43, 0x4b, 0x45, 0x54, 0x54, 0x20, 0x20, 0x20, 0x20, 0x00, 0xff, 0xff, + //0x0220: BE CKET T ... + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x22, 0x52, + //0x0230: ."R + 0x4f, 0x4f, 0x54, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x22, 0x20, 0x20, 0x20, + //0x0240: OOT . " + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x0d, 0x0a, 0x0d, 0x0a, 0x24, 0x10, + //0x0250: ... ..$. + 0x12, 0x12, 0x11, 0x10, 0x10, 0x10, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, + //0x0260: .... .... .... .... + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x44, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + //0x0270: .... ...D :... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x0480: .... .... .... .... + //0x0280: .... .... .... .... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + //0x0290: .... .... .... .... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x02, 0x04, 0x01, 0x0a, 0x09, 0x08, + //0x02a0: .... .... .... .... + 0x06, 0x0b, 0x04, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + //0x02b0: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x0490: .... .... .... .... + //0x02c0: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x04a0: .... .... .... .... + //0x02d0: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x04b0: .... .... .... .... + //0x02e0: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x04c0: .... .... .... .... + //0x02f0: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x04d0: .... .... .... .... + //0x0300: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x04e0: .... .... .... .... + //0x0310: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x04f0: .... .... .... .... - 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, }; + //0x0320: .... .... .... .... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, + //0x0330: .... .... .... .... + 0x00, 0x00, }; ds.assign(src, src + sizeof(src)); dreamweb(); } diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index b7a644fe1f..47be37a20a 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -32,9 +32,9 @@ namespace DreamGen { -static const uint16 offset_rootdir = 0x0407; -static const uint16 offset_operand1 = 0x03f9; -static const uint16 offset_keys = 0x038f; +static const uint16 offset_keys = 0x01c6; +static const uint16 offset_rootdir = 0x023e; +static const uint16 offset_operand1 = 0x0230; static const uint16 kStartvars = 0; static const uint16 kProgresspoints = 1; static const uint16 kWatchon = 2; @@ -357,17 +357,16 @@ static const uint16 kCh1blockstocopy = 435; static const uint16 kSoundbufferwrite = 437; static const uint16 kCurrentsample = 439; static const uint16 kRoomssample = 440; -static const uint16 kReelroutines = 441; -static const uint16 kBasicsample = 898; -static const uint16 kCurrentfile = 1045; -static const uint16 kRoomscango = 1120; -static const uint16 kRoompics = 1136; -static const uint16 kOplist = 1151; -static const uint16 kInputline = 1154; -static const uint16 kPresslist = 1282; -static const uint16 kQuitrequested = 1288; -static const uint16 kSubtitles = 1289; -static const uint16 kForeignrelease = 1290; +static const uint16 kBasicsample = 441; +static const uint16 kCurrentfile = 588; +static const uint16 kRoomscango = 663; +static const uint16 kRoompics = 679; +static const uint16 kOplist = 694; +static const uint16 kInputline = 697; +static const uint16 kPresslist = 825; +static const uint16 kQuitrequested = 831; +static const uint16 kSubtitles = 832; +static const uint16 kForeignrelease = 833; static const uint16 kBlocktextdat = (0); static const uint16 kPersonframes = (0); static const uint16 kDebuglevel1 = (0); @@ -406,8 +405,8 @@ static const uint16 kListofchanges = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768 static const uint16 kUndertimedtext = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)); static const uint16 kRainlist = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)); static const uint16 kInitialreelrouts = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)); -static const uint16 kInitialvars = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+898-441); -static const uint16 kLengthofbuffer = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+898-441+68-0); +static const uint16 kInitialvars = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+457); +static const uint16 kLengthofbuffer = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+457+68-0); static const uint16 kReellist = (0+(36*144)); static const uint16 kIntext = (0+(38*2)); static const uint16 kLengthofmap = (0+(66*60)); @@ -440,6 +439,7 @@ static const uint16 kTablesize = (32); static const uint16 kScreenwidth = (320); static const uint16 kKeypadx = (36+112); static const uint16 kItempicsize = (44); +static const uint16 kLenofreelrouts = (457); static const uint16 kDiaryy = (48+12); static const uint16 kOpsy = (52); static const uint16 kSymboly = (56); @@ -458,7 +458,6 @@ static const uint16 kKeypady = (72); static const uint16 kZoomx = (8); static const uint16 kInventx = (80); static const uint16 kMenux = (80+40); -static const uint16 kLenofreelrouts = (898-441); static const uint16 kHeaderlen = (96); diff --git a/engines/dreamweb/people.cpp b/engines/dreamweb/people.cpp index 801e959a13..4d66134e96 100644 --- a/engines/dreamweb/people.cpp +++ b/engines/dreamweb/people.cpp @@ -56,12 +56,6 @@ static void (DreamBase::*reelCallbacks[57])(ReelRoutine &) = { &DreamBase::carParkDrip }; -#if 0 -// TODO: Enable this when the ReelRoutine list has been moved out of the -// data segment, all ReelCallbacks are in DreamBase, and the -// ReelRoutine::reelPointer field is a real member. -// See also struct ReelRoutine, clearBuffers, clearChanges, syncReelRoutine - static const ReelRoutine g_initialReelRoutines[] = { // Room number and x,y // reel pointer @@ -126,28 +120,25 @@ static const ReelRoutine g_initialReelRoutines[] = { { 255,0,0, 0, 0,0,0 } }; -void DreamBase::setupInitialReelRoutines(ReelRoutine *dest) { - for (unsigned int i = 0; i < ARRAYSIZE(g_initialReelRoutines); ++i) { - dest[i] = g_initialReelRoutines[i]; - if (dest[i].period == 55 && isCD() && engine->getLanguage() == Common::DE_DEU) - dest[i].period = 65; +void DreamBase::setupInitialReelRoutines() { + for (unsigned int i = 0; i < kNumReelRoutines + 1; ++i) { + _reelRoutines[i] = g_initialReelRoutines[i]; + if (_reelRoutines[i].period == 55 && isCD() && engine->getLanguage() == Common::DE_DEU) + _reelRoutines[i].period = 65; } } -#endif void DreamBase::updatePeople() { data.word(kListpos) = kPeoplelist; memset(getSegment(data.word(kBuffers)).ptr(kPeoplelist, 12 * sizeof(People)), 0xff, 12 * sizeof(People)); ++data.word(kMaintimer); - ReelRoutine *r = (ReelRoutine *)data.ptr(kReelroutines, 0); - - for (int i = 0; r[i].reallocation != 255; ++i) { - if (r[i].reallocation == data.byte(kReallocation) && - r[i].mapX == data.byte(kMapx) && - r[i].mapY == data.byte(kMapy)) { + for (int i = 0; _reelRoutines[i].reallocation != 255; ++i) { + if (_reelRoutines[i].reallocation == data.byte(kReallocation) && + _reelRoutines[i].mapX == data.byte(kMapx) && + _reelRoutines[i].mapY == data.byte(kMapy)) { assert(reelCallbacks[i]); - (this->*(reelCallbacks[i]))(r[i]); + (this->*(reelCallbacks[i]))(_reelRoutines[i]); } } } diff --git a/engines/dreamweb/saveload.cpp b/engines/dreamweb/saveload.cpp index 4001cb1448..cd32e4fa34 100644 --- a/engines/dreamweb/saveload.cpp +++ b/engines/dreamweb/saveload.cpp @@ -38,12 +38,7 @@ void syncReelRoutine(Common::Serializer &s, ReelRoutine *reel) { s.syncAsByte(reel->reallocation); s.syncAsByte(reel->mapX); s.syncAsByte(reel->mapY); -#if 1 - s.syncAsByte(reel->b3); - s.syncAsByte(reel->b4); -#else s.syncAsUint16LE(reel->_reelPointer); -#endif s.syncAsByte(reel->period); s.syncAsByte(reel->counter); s.syncAsByte(reel->b7); @@ -380,7 +375,7 @@ void DreamGenContext::actualLoad() { data.byte(kGetback) = 1; } -void DreamGenContext::savePosition(unsigned int slot, const char *descbuf) { +void DreamBase::savePosition(unsigned int slot, const char *descbuf) { const Room ¤tRoom = g_roomData[data.byte(kLocation)]; @@ -411,7 +406,7 @@ void DreamGenContext::savePosition(unsigned int slot, const char *descbuf) { // fill length fields in savegame file header uint16 len[6] = { 17, kLengthofvars, kLengthofextra, - 4*kNumchanges, 48, kLenofreelrouts }; + 4*kNumchanges, 48, kNumReelRoutines*8+1 }; for (int i = 0; i < 6; ++i) header.setLen(i, len[i]); @@ -432,11 +427,11 @@ void DreamGenContext::savePosition(unsigned int slot, const char *descbuf) { // TODO: Convert more to serializer? Common::Serializer s(0, outSaveFile); - for (unsigned int i = 0; 8*i < kLenofreelrouts - 1; ++i) { - syncReelRoutine(s, (ReelRoutine *)data.ptr(kReelroutines + 8*i, 8)); + for (unsigned int i = 0; i < kNumReelRoutines; ++i) { + syncReelRoutine(s, &_reelRoutines[i]); } // Terminator - s.syncAsByte(*data.ptr(kReelroutines + kLenofreelrouts - 1, 1)); + s.syncAsByte(_reelRoutines[kNumReelRoutines].reallocation); // ScummVM data block outSaveFile->writeUint32BE(SCUMMVM_HEADER); @@ -460,7 +455,7 @@ void DreamGenContext::savePosition(unsigned int slot, const char *descbuf) { delete outSaveFile; } -void DreamGenContext::loadPosition(unsigned int slot) { +void DreamBase::loadPosition(unsigned int slot) { data.word(kTimecount) = 0; clearChanges(); @@ -500,11 +495,11 @@ void DreamGenContext::loadPosition(unsigned int slot) { // TODO: Use serializer for more Common::Serializer s(inSaveFile, 0); - for (unsigned int i = 0; 8*i < kLenofreelrouts - 1; ++i) { - syncReelRoutine(s, (ReelRoutine *)data.ptr(kReelroutines + 8*i, 8)); + for (unsigned int i = 0; i < kNumReelRoutines; ++i) { + syncReelRoutine(s, &_reelRoutines[i]); } // Terminator - s.syncAsByte(*data.ptr(kReelroutines + kLenofreelrouts - 1, 1)); + s.syncAsByte(_reelRoutines[kNumReelRoutines].reallocation); // Check if there's a ScummVM data block if (header.len(6) == SCUMMVM_BLOCK_MAGIC_SIZE) { @@ -686,10 +681,4 @@ void DreamGenContext::selectSlot() { delPointer(); } -void DreamGenContext::selectSlot2() { - if (data.word(kMousebutton)) - data.byte(kLoadingorsave) = 2; - selectSlot(); -} - } // End of namespace DreamGen diff --git a/engines/dreamweb/structs.h b/engines/dreamweb/structs.h index d96469fbd5..313f3caf0b 100644 --- a/engines/dreamweb/structs.h +++ b/engines/dreamweb/structs.h @@ -168,18 +168,10 @@ struct ReelRoutine { uint8 reallocation; uint8 mapX; uint8 mapY; -#if 0 uint16 _reelPointer; uint16 reelPointer() const { return _reelPointer; } void setReelPointer(uint16 v) { _reelPointer = v; } void incReelPointer() { _reelPointer++; } -#else - uint8 b3; - uint8 b4; - uint16 reelPointer() const { return READ_LE_UINT16(&b3); } - void setReelPointer(uint16 v) { WRITE_LE_UINT16(&b3, v); } - void incReelPointer() { setReelPointer(reelPointer() + 1); } -#endif uint8 period; uint8 counter; uint8 b7; diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 4ac13ea3fb..98d961ef2b 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -4540,10 +4540,6 @@ void DreamBase::clearBuffers() { memset(getSegment(data.word(kExtras)).ptr(0, kLengthofextra), 0xFF, kLengthofextra); - // TODO: Remove this line - // (once the ReelRoutines are no longer in the data segment) - memcpy(getSegment(data.word(kBuffers)).ptr(kInitialreelrouts, kLenofreelrouts), data.ptr(kReelroutines, kLenofreelrouts), kLenofreelrouts); - memcpy(getSegment(data.word(kBuffers)).ptr(kInitialvars, kLengthofvars), data.ptr(kStartvars, kLengthofvars), kLengthofvars); clearChanges(); @@ -4552,9 +4548,7 @@ void DreamBase::clearBuffers() { void DreamBase::clearChanges() { memset(getSegment(data.word(kBuffers)).ptr(kListofchanges, 4*kNumchanges), 0xFF, 4*kNumchanges); - // TODO: Call setupInitialReelRoutines instead - // (once the ReelRoutines are no longer in the data segment) - memcpy(data.ptr(kReelroutines, kLenofreelrouts), getSegment(data.word(kBuffers)).ptr(kInitialreelrouts, kLenofreelrouts), kLenofreelrouts); + setupInitialReelRoutines(); memcpy(data.ptr(kStartvars, kLengthofvars), getSegment(data.word(kBuffers)).ptr(kInitialvars, kLengthofvars), kLengthofvars); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index de03e45c62..3f38ad4beb 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -174,8 +174,6 @@ void showSecondUse(); void actualSave(); void actualLoad(); - void loadPosition(unsigned int slot); - void savePosition(unsigned int slot, const char *descbuf); void restoreAll(); void enterSymbol(); void viewFolder(); -- cgit v1.2.3 From 833507695e9a096489cb6e3a7ca5ad854a769fc7 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 18 Dec 2011 17:58:43 +0200 Subject: DREAMWEB: Remove the now unused 'keynum' and 'newlogonum' variables from the data blob --- engines/dreamweb/dreamgen.cpp | 82 ++++++------- engines/dreamweb/dreamgen.h | 268 +++++++++++++++++++++--------------------- 2 files changed, 174 insertions(+), 176 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 33bac8299e..644187c558 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -1773,14 +1773,14 @@ void DreamGenContext::getDestInfo() { push(ax); dx = data; es = dx; - si = 663; + si = 661; _add(si, ax); cl = es.byte(si); ax = pop(); push(cx); dx = data; es = dx; - si = 679; + si = 677; _add(si, ax); ax = pop(); } @@ -1832,7 +1832,7 @@ clearedlocations: bx = ax; dx = data; es = dx; - _add(bx, 663); + _add(bx, 661); es.byte(bx) = 0; } @@ -1852,7 +1852,7 @@ dirroot: si = offset_rootdir; _inc(si); es = cs; - di = 588; + di = 586; _inc(di); cx = 12; _movsb(cx, true); @@ -1954,7 +1954,7 @@ notyetassigned: push(bx); _add(bx, 2); ds = cs; - si = 697; + si = 695; checkpass: _lodsw(); ah = es.byte(bx); @@ -1998,7 +1998,7 @@ void DreamGenContext::read() { return; okcom: es = cs; - di = 588; + di = 586; ax = data.word(kTextfile1); data.word(kMonsource) = ax; ds = ax; @@ -2128,7 +2128,7 @@ keyok2: ds = cs; si = offset_operand1+1; es = cs; - di = 588+1; + di = 586+1; cx = 12; _movsb(cx, true); monitorLogo(); @@ -2210,7 +2210,7 @@ void DreamGenContext::parser() { al = '='; _stosb(); ds = cs; - si = 697; + si = 695; notspace1: _lodsw(); _cmp(al, 32); @@ -2381,49 +2381,49 @@ void DreamGenContext::__start() { //0x0140: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0150: .... .... .... .... - 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, //0x0160: .... .... .... .... - 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 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, //0x0180: .... .... .... .... - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x17, 0x00, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0190: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x01a0: .... .... .... .... - 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, - //0x01b0: .... .... .DRE AMWE - 0x42, 0x2e, 0x56, 0x39, 0x39, 0x00, 0x01, 0x00, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x20, 0x20, - //0x01c0: B.V9 9... PUBL IC - 0x20, 0x20, 0x20, 0x20, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, - //0x01d0: PUBL IC . - 0x00, 0x00, 0x42, 0x4c, 0x41, 0x43, 0x4b, 0x44, 0x52, 0x41, 0x47, 0x4f, 0x4e, 0x20, 0x52, 0x59, - //0x01e0: ..BL ACKD RAGO N RY - 0x41, 0x4e, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x48, 0x45, 0x4e, 0x44, - //0x01f0: AN ... HEND - 0x52, 0x49, 0x58, 0x20, 0x20, 0x20, 0x20, 0x20, 0x4c, 0x4f, 0x55, 0x49, 0x53, 0x20, 0x20, 0x20, - //0x0200: RIX LOUI S - 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x53, 0x45, 0x50, 0x54, 0x49, 0x4d, 0x55, 0x53, 0x20, 0x20, - //0x0210: . ..SE PTIM US - 0x20, 0x20, 0x42, 0x45, 0x43, 0x4b, 0x45, 0x54, 0x54, 0x20, 0x20, 0x20, 0x20, 0x00, 0xff, 0xff, - //0x0220: BE CKET T ... - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x22, 0x52, - //0x0230: ."R - 0x4f, 0x4f, 0x54, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x22, 0x20, 0x20, 0x20, - //0x0240: OOT . " - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x0d, 0x0a, 0x0d, 0x0a, 0x24, 0x10, - //0x0250: ... ..$. - 0x12, 0x12, 0x11, 0x10, 0x10, 0x10, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, + 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, + //0x01b0: .... ...D REAM WEB. + 0x56, 0x39, 0x39, 0x00, 0x01, 0x00, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x20, 0x20, 0x20, 0x20, + //0x01c0: V99. ..PU BLIC + 0x20, 0x20, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, + //0x01d0: PU BLIC ... + 0x42, 0x4c, 0x41, 0x43, 0x4b, 0x44, 0x52, 0x41, 0x47, 0x4f, 0x4e, 0x20, 0x52, 0x59, 0x41, 0x4e, + //0x01e0: BLAC KDRA GON RYAN + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x48, 0x45, 0x4e, 0x44, 0x52, 0x49, + //0x01f0: . ..HE NDRI + 0x58, 0x20, 0x20, 0x20, 0x20, 0x20, 0x4c, 0x4f, 0x55, 0x49, 0x53, 0x20, 0x20, 0x20, 0x20, 0x20, + //0x0200: X LO UIS + 0x20, 0x00, 0x00, 0x00, 0x53, 0x45, 0x50, 0x54, 0x49, 0x4d, 0x55, 0x53, 0x20, 0x20, 0x20, 0x20, + //0x0210: ... SEPT IMUS + 0x42, 0x45, 0x43, 0x4b, 0x45, 0x54, 0x54, 0x20, 0x20, 0x20, 0x20, 0x00, 0xff, 0xff, 0x20, 0x20, + //0x0220: BECK ETT . .. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x22, 0x52, 0x4f, 0x4f, + //0x0230: . "ROO + 0x54, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, + //0x0240: T ." + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x0d, 0x0a, 0x0d, 0x0a, 0x24, 0x10, 0x12, 0x12, + //0x0250: . .... $... + 0x11, 0x10, 0x10, 0x10, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, //0x0260: .... .... .... .... - 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x44, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x0270: .... ...D :... .... + 0x02, 0x02, 0x02, 0x02, 0x02, 0x44, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + //0x0270: .... .D:. .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0280: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0290: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x02, 0x04, 0x01, 0x0a, 0x09, 0x08, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x02, 0x04, 0x01, 0x0a, 0x09, 0x08, 0x06, 0x0b, //0x02a0: .... .... .... .... - 0x06, 0x0b, 0x04, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x04, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x02b0: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x02c0: .... .... .... .... @@ -2439,9 +2439,9 @@ void DreamGenContext::__start() { //0x0310: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0320: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, //0x0330: .... .... .... .... - 0x00, 0x00, }; + }; ds.assign(src, src + sizeof(src)); dreamweb(); } diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 47be37a20a..6e06941d18 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -32,9 +32,9 @@ namespace DreamGen { -static const uint16 offset_keys = 0x01c6; -static const uint16 offset_rootdir = 0x023e; -static const uint16 offset_operand1 = 0x0230; +static const uint16 offset_rootdir = 0x023c; +static const uint16 offset_operand1 = 0x022e; +static const uint16 offset_keys = 0x01c4; static const uint16 kStartvars = 0; static const uint16 kProgresspoints = 1; static const uint16 kWatchon = 2; @@ -236,137 +236,135 @@ static const uint16 kTimer3to = 255; static const uint16 kWatchdump = 256; static const uint16 kLogonum = 257; static const uint16 kOldlogonum = 258; -static const uint16 kNewlogonum = 259; -static const uint16 kNetseg = 260; -static const uint16 kNetpoint = 262; -static const uint16 kKeynum = 264; -static const uint16 kCursorstate = 265; -static const uint16 kPressed = 266; -static const uint16 kPresspointer = 267; -static const uint16 kGraphicpress = 269; -static const uint16 kPresscount = 270; -static const uint16 kLightcount = 271; -static const uint16 kFolderpage = 272; -static const uint16 kDiarypage = 273; -static const uint16 kMenucount = 274; -static const uint16 kSymboltopx = 275; -static const uint16 kSymboltopnum = 276; -static const uint16 kSymboltopdir = 277; -static const uint16 kSymbolbotx = 278; -static const uint16 kSymbolbotnum = 279; -static const uint16 kSymbolbotdir = 280; -static const uint16 kSymboltolight = 281; -static const uint16 kSymbol1 = 282; -static const uint16 kSymbol2 = 283; -static const uint16 kSymbol3 = 284; -static const uint16 kSymbolnum = 285; -static const uint16 kDumpx = 286; -static const uint16 kDumpy = 288; -static const uint16 kWalkandexam = 290; -static const uint16 kWalkexamtype = 291; -static const uint16 kWalkexamnum = 292; -static const uint16 kCurslocx = 293; -static const uint16 kCurslocy = 295; -static const uint16 kCurpos = 297; -static const uint16 kMonadx = 299; -static const uint16 kMonady = 301; -static const uint16 kMonsource = 303; -static const uint16 kNumtodo = 305; -static const uint16 kTimecount = 307; -static const uint16 kCounttotimed = 309; -static const uint16 kTimedseg = 311; -static const uint16 kTimedoffset = 313; -static const uint16 kTimedy = 315; -static const uint16 kTimedx = 316; -static const uint16 kNeedtodumptimed = 317; -static const uint16 kLoadingorsave = 318; -static const uint16 kCurrentslot = 319; -static const uint16 kCursorpos = 320; -static const uint16 kColourpos = 321; -static const uint16 kFadedirection = 322; -static const uint16 kNumtofade = 323; -static const uint16 kFadecount = 324; -static const uint16 kAddtogreen = 325; -static const uint16 kAddtored = 326; -static const uint16 kAddtoblue = 327; -static const uint16 kLastsoundreel = 328; -static const uint16 kSpeechloaded = 330; -static const uint16 kSpeechlength = 331; -static const uint16 kVolume = 333; -static const uint16 kVolumeto = 334; -static const uint16 kVolumedirection = 335; -static const uint16 kVolumecount = 336; -static const uint16 kWongame = 337; -static const uint16 kLasthardkey = 338; -static const uint16 kBufferin = 339; -static const uint16 kBufferout = 341; -static const uint16 kExtras = 343; -static const uint16 kWorkspace = 345; -static const uint16 kMapstore = 347; -static const uint16 kCharset1 = 349; -static const uint16 kBuffers = 351; -static const uint16 kMainsprites = 353; -static const uint16 kBackdrop = 355; -static const uint16 kMapdata = 357; -static const uint16 kSounddata = 359; -static const uint16 kSounddata2 = 361; -static const uint16 kRecordspace = 363; -static const uint16 kFreedat = 365; -static const uint16 kSetdat = 367; -static const uint16 kReel1 = 369; -static const uint16 kReel2 = 371; -static const uint16 kReel3 = 373; -static const uint16 kRoomdesc = 375; -static const uint16 kFreedesc = 377; -static const uint16 kSetdesc = 379; -static const uint16 kBlockdesc = 381; -static const uint16 kSetframes = 383; -static const uint16 kFreeframes = 385; -static const uint16 kPeople = 387; -static const uint16 kReels = 389; -static const uint16 kCommandtext = 391; -static const uint16 kPuzzletext = 393; -static const uint16 kTraveltext = 395; -static const uint16 kTempgraphics = 397; -static const uint16 kTempgraphics2 = 399; -static const uint16 kTempgraphics3 = 401; -static const uint16 kTempsprites = 403; -static const uint16 kTextfile1 = 405; -static const uint16 kTextfile2 = 407; -static const uint16 kTextfile3 = 409; -static const uint16 kBlinkframe = 411; -static const uint16 kBlinkcount = 412; -static const uint16 kReasseschanges = 413; -static const uint16 kPointerspath = 414; -static const uint16 kManspath = 415; -static const uint16 kPointerfirstpath = 416; -static const uint16 kFinaldest = 417; -static const uint16 kDestination = 418; -static const uint16 kLinestartx = 419; -static const uint16 kLinestarty = 421; -static const uint16 kLineendx = 423; -static const uint16 kLineendy = 425; -static const uint16 kLinepointer = 427; -static const uint16 kLinedirection = 428; -static const uint16 kLinelength = 429; -static const uint16 kCh0blockstocopy = 430; -static const uint16 kCh0playing = 432; -static const uint16 kCh0repeat = 433; -static const uint16 kCh1playing = 434; -static const uint16 kCh1blockstocopy = 435; -static const uint16 kSoundbufferwrite = 437; -static const uint16 kCurrentsample = 439; -static const uint16 kRoomssample = 440; -static const uint16 kBasicsample = 441; -static const uint16 kCurrentfile = 588; -static const uint16 kRoomscango = 663; -static const uint16 kRoompics = 679; -static const uint16 kOplist = 694; -static const uint16 kInputline = 697; -static const uint16 kPresslist = 825; -static const uint16 kQuitrequested = 831; -static const uint16 kSubtitles = 832; -static const uint16 kForeignrelease = 833; +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 = 586; +static const uint16 kRoomscango = 661; +static const uint16 kRoompics = 677; +static const uint16 kOplist = 692; +static const uint16 kInputline = 695; +static const uint16 kPresslist = 823; +static const uint16 kQuitrequested = 829; +static const uint16 kSubtitles = 830; +static const uint16 kForeignrelease = 831; static const uint16 kBlocktextdat = (0); static const uint16 kPersonframes = (0); static const uint16 kDebuglevel1 = (0); @@ -375,13 +373,13 @@ static const uint16 kPlayback = (0); static const uint16 kMap = (0); static const uint16 kSettextdat = (0); static const uint16 kSpanish = (0); -static const uint16 kFramedata = (0); static const uint16 kRecording = (0); static const uint16 kFlags = (0); static const uint16 kGerman = (0); static const uint16 kTextunder = (0); static const uint16 kPathdata = (0); static const uint16 kDemo = (0); +static const uint16 kFramedata = (0); static const uint16 kExframedata = (0); static const uint16 kIntextdat = (0); static const uint16 kFreetextdat = (0); -- cgit v1.2.3 From 25b99c448d63da48b639834d41146d2f30a11e49 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 18 Dec 2011 20:17:55 +0200 Subject: DREAMWEB: Rewrite signOn into C++, and remove the users and passwords from the data blob Note that the string processing logic in signOn is a bit different from the original, but the end result is the same (with cleaner code) --- engines/dreamweb/dreamgen.cpp | 183 ++++++++---------------------------------- engines/dreamweb/dreamgen.h | 24 +++--- engines/dreamweb/monitor.cpp | 97 ++++++++++++++++------ engines/dreamweb/stubs.h | 1 + 4 files changed, 119 insertions(+), 186 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 644187c558..5be71266cd 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -1773,14 +1773,14 @@ void DreamGenContext::getDestInfo() { push(ax); dx = data; es = dx; - si = 661; + si = 555; _add(si, ax); cl = es.byte(si); ax = pop(); push(cx); dx = data; es = dx; - si = 677; + si = 571; _add(si, ax); ax = pop(); } @@ -1832,7 +1832,7 @@ clearedlocations: bx = ax; dx = data; es = dx; - _add(bx, 661); + _add(bx, 555); es.byte(bx) = 0; } @@ -1852,7 +1852,7 @@ dirroot: si = offset_rootdir; _inc(si); es = cs; - di = 586; + di = 480; _inc(di); cx = 12; _movsb(cx, true); @@ -1885,107 +1885,6 @@ directloop1: goto directloop1; } -void DreamGenContext::signOn() { - STACK_CHECK; - parser(); - _inc(di); - ds = cs; - si = offset_keys; - cx = 4; -signonloop: - push(cx); - push(si); - push(di); - _add(si, 14); - cx = 11; -signonloop2: - _lodsb(); - _cmp(al, 32); - if (flags.z()) - goto foundsign; - makeCaps(); - ah = es.byte(di); - _inc(di); - _cmp(al, ah); - if (!flags.z()) - goto nomatch; - if (--cx) - goto signonloop2; -nomatch: - di = pop(); - si = pop(); - cx = pop(); - _add(si, 26); - if (--cx) - goto signonloop; - al = 13; - monMessage(); - return; -foundsign: - di = pop(); - si = pop(); - cx = pop(); - bx = si; - es = ds; - _cmp(es.byte(bx), 0); - if (flags.z()) - goto notyetassigned; - al = 17; - monMessage(); - return; -notyetassigned: - push(es); - push(bx); - scrollMonitor(); - al = 15; - monMessage(); - di = data.word(kMonadx); - bx = data.word(kMonady); - push(di); - push(bx); - input(); - bx = pop(); - di = pop(); - data.word(kMonadx) = di; - data.word(kMonady) = bx; - bx = pop(); - es = pop(); - push(es); - push(bx); - _add(bx, 2); - ds = cs; - si = 695; -checkpass: - _lodsw(); - ah = es.byte(bx); - _inc(bx); - _cmp(ah, 32); - if (flags.z()) - goto passpassed; - _cmp(al, ah); - if (flags.z()) - goto checkpass; - bx = pop(); - es = pop(); - scrollMonitor(); - al = 16; - monMessage(); - return; -passpassed: - al = 14; - monMessage(); - bx = pop(); - es = pop(); - push(es); - push(bx); - _add(bx, 14); - monPrint(); - scrollMonitor(); - bx = pop(); - es = pop(); - es.byte(bx) = 1; -} - void DreamGenContext::read() { STACK_CHECK; cx = 40; @@ -1998,7 +1897,7 @@ void DreamGenContext::read() { return; okcom: es = cs; - di = 586; + di = 480; ax = data.word(kTextfile1); data.word(kMonsource) = ax; ds = ax; @@ -2128,7 +2027,7 @@ keyok2: ds = cs; si = offset_operand1+1; es = cs; - di = 586+1; + di = 480+1; cx = 12; _movsb(cx, true); monitorLogo(); @@ -2210,7 +2109,7 @@ void DreamGenContext::parser() { al = '='; _stosb(); ds = cs; - si = 695; + si = 589; notspace1: _lodsw(); _cmp(al, 32); @@ -2393,55 +2292,41 @@ void DreamGenContext::__start() { //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, 0x01, 0x00, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x20, 0x20, 0x20, 0x20, - //0x01c0: V99. ..PU BLIC - 0x20, 0x20, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, - //0x01d0: PU BLIC ... - 0x42, 0x4c, 0x41, 0x43, 0x4b, 0x44, 0x52, 0x41, 0x47, 0x4f, 0x4e, 0x20, 0x52, 0x59, 0x41, 0x4e, - //0x01e0: BLAC KDRA GON RYAN - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x48, 0x45, 0x4e, 0x44, 0x52, 0x49, - //0x01f0: . ..HE NDRI - 0x58, 0x20, 0x20, 0x20, 0x20, 0x20, 0x4c, 0x4f, 0x55, 0x49, 0x53, 0x20, 0x20, 0x20, 0x20, 0x20, - //0x0200: X LO UIS - 0x20, 0x00, 0x00, 0x00, 0x53, 0x45, 0x50, 0x54, 0x49, 0x4d, 0x55, 0x53, 0x20, 0x20, 0x20, 0x20, - //0x0210: ... SEPT IMUS - 0x42, 0x45, 0x43, 0x4b, 0x45, 0x54, 0x54, 0x20, 0x20, 0x20, 0x20, 0x00, 0xff, 0xff, 0x20, 0x20, - //0x0220: BECK ETT . .. - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x22, 0x52, 0x4f, 0x4f, - //0x0230: . "ROO - 0x54, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, - //0x0240: T ." - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x0d, 0x0a, 0x0d, 0x0a, 0x24, 0x10, 0x12, 0x12, - //0x0250: . .... $... - 0x11, 0x10, 0x10, 0x10, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, - //0x0260: .... .... .... .... - 0x02, 0x02, 0x02, 0x02, 0x02, 0x44, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x0270: .... .D:. .... .... + 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, - //0x0280: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x0290: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x02, 0x04, 0x01, 0x0a, 0x09, 0x08, 0x06, 0x0b, - //0x02a0: .... .... .... .... - 0x04, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x02b0: .... .... .... .... + //0x0210: .... .... .... .... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, 0x00, + //0x0220: .... .... .... .... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x02, 0x04, + //0x0230: .... .... .... .... + 0x01, 0x0a, 0x09, 0x08, 0x06, 0x0b, 0x04, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + //0x0240: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x02c0: .... .... .... .... + //0x0250: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x02d0: .... .... .... .... + //0x0260: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x02e0: .... .... .... .... + //0x0270: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x02f0: .... .... .... .... + //0x0280: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x0300: .... .... .... .... + //0x0290: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x0310: .... .... .... .... + //0x02a0: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x0320: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, - //0x0330: .... .... .... .... - }; + //0x02b0: .... .... .... .... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, + //0x02c0: .... .... .... .... + 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, }; ds.assign(src, src + sizeof(src)); dreamweb(); } diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 6e06941d18..9b5665c0f3 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -32,9 +32,8 @@ namespace DreamGen { -static const uint16 offset_rootdir = 0x023c; -static const uint16 offset_operand1 = 0x022e; -static const uint16 offset_keys = 0x01c4; +static const uint16 offset_operand1 = 0x01c4; +static const uint16 offset_rootdir = 0x01d2; static const uint16 kStartvars = 0; static const uint16 kProgresspoints = 1; static const uint16 kWatchon = 2; @@ -356,15 +355,15 @@ static const uint16 kSoundbufferwrite = 435; static const uint16 kCurrentsample = 437; static const uint16 kRoomssample = 438; static const uint16 kBasicsample = 439; -static const uint16 kCurrentfile = 586; -static const uint16 kRoomscango = 661; -static const uint16 kRoompics = 677; -static const uint16 kOplist = 692; -static const uint16 kInputline = 695; -static const uint16 kPresslist = 823; -static const uint16 kQuitrequested = 829; -static const uint16 kSubtitles = 830; -static const uint16 kForeignrelease = 831; +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 kBlocktextdat = (0); static const uint16 kPersonframes = (0); static const uint16 kDebuglevel1 = (0); @@ -499,7 +498,6 @@ public: void getEitherAd(); void dropObject(); void useOpened(); - void signOn(); void locationPic(); void swapWithOpen(); void dreamweb(); diff --git a/engines/dreamweb/monitor.cpp b/engines/dreamweb/monitor.cpp index dd94633105..26caeb29ec 100644 --- a/engines/dreamweb/monitor.cpp +++ b/engines/dreamweb/monitor.cpp @@ -25,33 +25,28 @@ namespace DreamGen { struct MonitorKeyEntry { - uint8 keyHeld; - uint8 b1; // unused, for alignment - char userpass[24]; - //char password[12]; // for the new monitor key list below - //char username[12]; // for the new monitor key list below + uint8 keyAssigned; + char username[12]; + char password[12]; }; -#if 0 // New monitor key list static MonitorKeyEntry monitorKeyEntries[4] = { - { 1, "PUBLIC ", "PUBLIC " }, - { 0, "BLACKDRAGON", "RYAN " }, - { 0, "HENDRIX ", "LOUIS " }, - { 0, "SEPTIMUS ", "BECKETT " } + { 1, "PUBLIC", "PUBLIC" }, + { 0, "RYAN", "BLACKDRAGON" }, + { 0, "LOUIS", "HENDRIX" }, + { 0, "BECKETT", "SEPTIMUS" } }; -#endif void DreamGenContext::useMon() { data.byte(kLasttrigger) = 0; memset(data.ptr(kCurrentfile+1, 0), ' ', 12); memset(data.ptr(offset_operand1+1, 0), ' ', 12); - MonitorKeyEntry *monitorKeyEntries = (MonitorKeyEntry *)data.ptr(offset_keys, 0); - monitorKeyEntries[0].keyHeld = 1; - monitorKeyEntries[1].keyHeld = 0; - monitorKeyEntries[2].keyHeld = 0; - monitorKeyEntries[3].keyHeld = 0; + monitorKeyEntries[0].keyAssigned = 1; + monitorKeyEntries[1].keyAssigned = 0; + monitorKeyEntries[2].keyAssigned = 0; + monitorKeyEntries[3].keyAssigned = 0; createPanel(); showPanel(); @@ -434,12 +429,9 @@ void DreamGenContext::showKeys() { scrollMonitor(); monMessage(18); - MonitorKeyEntry *monitorKeyEntries = (MonitorKeyEntry *)data.ptr(offset_keys, 0); - for (int i = 0; i < 4; i++) { - if (monitorKeyEntries[i].keyHeld) - monPrint(monitorKeyEntries[i].userpass + 12); // username - //monPrint(monitorKeyEntries[i].username); + if (monitorKeyEntries[i].keyAssigned) + monPrint(monitorKeyEntries[i].username); } scrollMonitor(); @@ -447,20 +439,77 @@ void DreamGenContext::showKeys() { void DreamGenContext::getKeyAndLogo() { byte newLogo = es.byte(bx + 1) - 48; - MonitorKeyEntry *monitorKeyEntries = (MonitorKeyEntry *)data.ptr(offset_keys, 0); byte keyNum = es.byte(bx + 1 + 2) - 48; bx += 1 + 2 + 1; - if (monitorKeyEntries[keyNum].keyHeld == 1) { + if (monitorKeyEntries[keyNum].keyAssigned == 1) { // Key OK data.byte(kLogonum) = newLogo; al = 0; } else { monMessage(12); // "Access denied, key required -" - monPrint(monitorKeyEntries[keyNum].userpass + 12); // username + monPrint(monitorKeyEntries[keyNum].username); scrollMonitor(); al = 1; } } +void DreamGenContext::signOn() { + parser(); + + int8 foundIndex = -1; + Common::String inputLine = (const char *)data.ptr(offset_operand1 + 1, 0); + inputLine.trim(); + + for (byte i = 0; i < 4; i++) { + if (inputLine.equalsIgnoreCase(monitorKeyEntries[i].username)) { + // Check if the key has already been assigned + if (monitorKeyEntries[i].keyAssigned) { + monMessage(17); + return; + } else { + foundIndex = i; + break; + } + } + } + + if (foundIndex == -1) { + monMessage(13); + return; + } + + monMessage(15); + + uint16 prevX = data.word(kMonadx); + uint16 prevY = data.word(kMonady); + input(); // password input + data.word(kMonadx) = prevX; + data.word(kMonady) = prevY; + + inputLine = (const char *)data.ptr(kInputline, 0); + inputLine.toUppercase(); + + // The entered line has zeroes in-between each character + uint32 len = strlen(monitorKeyEntries[foundIndex].password); + bool found = true; + + for (uint32 i = 0; i < len; i++) { + if (monitorKeyEntries[foundIndex].password[i] != inputLine[i * 2]) { + found = false; + break; + } + } + + if (!found) { + scrollMonitor(); + monMessage(16); + } else { + monMessage(14); + monPrint(monitorKeyEntries[foundIndex].username); + scrollMonitor(); + monitorKeyEntries[foundIndex].keyAssigned = 1; + } +} + } // End of namespace DreamGen diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 3f38ad4beb..bb86175b0d 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -373,5 +373,6 @@ void deleteExText(uint8 textNum) { DreamBase::deleteExText(textNum); } + void signOn(); #endif -- cgit v1.2.3 From 5843fc11579150313b90ead919a8805081839f06 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 18 Dec 2011 20:22:03 +0200 Subject: DREAMWEB: 'nextcolon' is unused --- engines/dreamweb/dreamgen.cpp | 10 ---------- engines/dreamweb/dreamgen.h | 1 - 2 files changed, 11 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 5be71266cd..f97eba4166 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -2137,16 +2137,6 @@ finishpars: di = offset_operand1; } -void DreamGenContext::nextColon() { - STACK_CHECK; -lookcolon: - al = es.byte(si); - _inc(si); - _cmp(al, ':'); - if (!flags.z()) - goto lookcolon; -} - void DreamGenContext::findPathOfPoint() { STACK_CHECK; push(ax); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 9b5665c0f3..fb965156f3 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -488,7 +488,6 @@ public: void purgeAnItem(); void purgeALocation(); void getSetAd(); - void nextColon(); void findOpenPos(); void searchForSame(); void rollEm(); -- cgit v1.2.3 From 0cd53d5d3e6324869adf145047c65d2ef93e8b7f Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 18 Dec 2011 21:07:27 +0200 Subject: DREAMWEB: Port 'lookatplace' to C++ --- engines/dreamweb/dreamgen.cpp | 71 ------------------------------------------- engines/dreamweb/dreamgen.h | 1 - engines/dreamweb/stubs.cpp | 32 +++++++++++++++++++ engines/dreamweb/stubs.h | 1 + 4 files changed, 33 insertions(+), 72 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index f97eba4166..be1bfa6d96 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -1647,77 +1647,6 @@ endheartalk: data.byte(kPointermode) = 0; } -void DreamGenContext::lookAtPlace() { - STACK_CHECK; - _cmp(data.byte(kCommandtype), 224); - if (flags.z()) - goto alreadyinfo; - data.byte(kCommandtype) = 224; - al = 27; - commandOnly(); -alreadyinfo: - ax = data.word(kMousebutton); - _and(ax, 1); - if (flags.z()) - return /* (noinfo) */; - _cmp(ax, data.word(kOldbutton)); - if (flags.z()) - return /* (noinfo) */; - bl = data.byte(kDestpos); - _cmp(bl, 15); - if (!flags.c()) - return /* (noinfo) */; - push(bx); - delPointer(); - delTextLine(); - getUnderCentre(); - ds = data.word(kTempgraphics3); - al = 0; - ah = 0; - di = 60; - bx = 72; - showFrame(); - al = 4; - ah = 0; - di = 60; - bx = 72+55; - showFrame(); - _cmp(data.byte(kForeignrelease), 0); - if (flags.z()) - goto _tmp1; - al = 4; - ah = 0; - di = 60; - bx = 72+55+21; - showFrame(); -_tmp1: - bx = pop(); - bh = 0; - _add(bx, bx); - es = data.word(kTraveltext); - si = es.word(bx); - _add(si, (66*2)); - findNextColon(); - di = 63; - bx = 84; - _cmp(data.byte(kForeignrelease), 0); - if (flags.z()) - goto _tmp2; - bx = 84+4; -_tmp2: - dl = 191; - al = 0; - ah = 0; - printDirect(); - workToScreenM(); - cx = 500; - hangOnP(); - data.byte(kPointermode) = 0; - data.byte(kPointerframe) = 0; - putUnderCentre(); - workToScreenM(); -} - void DreamGenContext::locationPic() { STACK_CHECK; getDestInfo(); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index fb965156f3..77e3abdcc9 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -491,7 +491,6 @@ public: void findOpenPos(); void searchForSame(); void rollEm(); - void lookAtPlace(); void findAllOpen(); void fillOpen(); void getEitherAd(); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 98d961ef2b..6989a57a93 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -4584,4 +4584,36 @@ void DreamGenContext::showDiaryKeys() { showDiaryPage(); } +void DreamGenContext::lookAtPlace() { + if (data.byte(kCommandtype) != 224) { + data.byte(kCommandtype) = 224; + commandOnly(27); + } + + if (!(data.word(kMousebutton) & 1) || + data.word(kMousebutton) == data.word(kOldbutton) || + data.byte(kDestpos) >= 15) + return; // noinfo + + delPointer(); + delTextLine(); + getUnderCentre(); + showFrame(tempGraphics3(), 60, 72, 0, 0); + showFrame(tempGraphics3(), 60, 72 + 55, 4, 0); + if (data.byte(kForeignrelease)) + showFrame(tempGraphics3(), 60, 72+55+21, 4, 0); + + uint16 offset = kTextstart + getSegment(data.word(kTraveltext)).word(data.byte(kDestpos) * 2); + const uint8 *string = getSegment(data.word(kTraveltext)).ptr(offset, 0); + findNextColon(&string); + uint16 y = (data.byte(kForeignrelease)) ? 84 + 4 : 84; + printDirect(&string, 63, &y, 191, 191 & 1); + workToScreenM(); + hangOnP(500); + data.byte(kPointermode) = 0; + data.byte(kPointerframe) = 0; + putUnderCentre(); + workToScreenM(); +} + } // End of namespace DreamGen diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index bb86175b0d..3ab7cfbb11 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -374,5 +374,6 @@ DreamBase::deleteExText(textNum); } void signOn(); + void lookAtPlace(); #endif -- cgit v1.2.3 From 14ccd4f1f089e11fa03044100b67f3a9380701fb Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 19 Dec 2011 00:09:48 +0100 Subject: TSAGE: R2R - Implement scene 3100 --- engines/tsage/module.mk | 1 + engines/tsage/ringworld2/ringworld2_logic.cpp | 2 + engines/tsage/ringworld2/ringworld2_scenes3.cpp | 206 +++++++++++++++++++++++ engines/tsage/ringworld2/ringworld2_scenes3.h | 73 ++++++++ engines/tsage/ringworld2/ringworld2_speakers.cpp | 13 ++ engines/tsage/ringworld2/ringworld2_speakers.h | 7 + 6 files changed, 302 insertions(+) create mode 100644 engines/tsage/ringworld2/ringworld2_scenes3.cpp create mode 100644 engines/tsage/ringworld2/ringworld2_scenes3.h (limited to 'engines') diff --git a/engines/tsage/module.mk b/engines/tsage/module.mk index 44f808ba8e..95a1a583dd 100644 --- a/engines/tsage/module.mk +++ b/engines/tsage/module.mk @@ -39,6 +39,7 @@ MODULE_OBJS := \ ringworld2/ringworld2_logic.o \ ringworld2/ringworld2_scenes0.o \ ringworld2/ringworld2_scenes2.o \ + ringworld2/ringworld2_scenes3.o \ ringworld2/ringworld2_speakers.o \ saveload.o \ scenes.o \ diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index ccedb3a18a..689b2b5f0f 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -28,6 +28,7 @@ #include "tsage/ringworld2/ringworld2_dialogs.h" #include "tsage/ringworld2/ringworld2_scenes0.h" #include "tsage/ringworld2/ringworld2_scenes2.h" +#include "tsage/ringworld2/ringworld2_scenes3.h" namespace TsAGE { @@ -169,6 +170,7 @@ Scene *Ringworld2Game::createScene(int sceneNumber) { /* Scene group #3 */ // case 3100: + return new Scene3100(); case 3125: case 3150: case 3175: diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp new file mode 100644 index 0000000000..22e58b6d2b --- /dev/null +++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp @@ -0,0 +1,206 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "tsage/scenes.h" +#include "tsage/tsage.h" +#include "tsage/staticres.h" +#include "tsage/ringworld2/ringworld2_scenes3.h" + +namespace TsAGE { + +namespace Ringworld2 { + +/*-------------------------------------------------------------------------- + * Scene 3100 - + * + *--------------------------------------------------------------------------*/ +Scene3100::Scene3100() { + _field412 = 0; +} + +void Scene3100::synchronize(Serializer &s) { + SceneExt::synchronize(s); + + s.syncAsSint16LE(_field412); +} + +bool Scene3100::Actor6::startAction(CursorType action, Event &event) { + if (action != CURSOR_TALK) + return SceneActor::startAction(action, event); + + Scene3100 *scene = (Scene3100 *)R2_GLOBALS._sceneManager._scene; + + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 10; + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + scene->_stripManager.start(606, scene); + return true; +} + +void Scene3100::postInit(SceneObjectList *OwnerList) { + if (R2_GLOBALS._sceneManager._previousScene == 1000) { + if (R2_GLOBALS._player._oldCharacterScene[1] == 3100) { + loadScene(3101); + R2_GLOBALS._v58CE2 = 0; + } else { + loadScene(3100); + g_globals->gfxManager()._bounds.moveTo(Common::Point(160, 0)); + } + } else { + loadScene(3100); + } + // Original was doing it twice in a row. Skipped. + + if (R2_GLOBALS._sceneManager._previousScene == 3255) + R2_GLOBALS._v58CE2 = 0; + + SceneExt::postInit(); + _stripManager.addSpeaker(&_guardSpeaker); + + if (R2_GLOBALS._sceneManager._previousScene == -1) + R2_GLOBALS._sceneManager._previousScene = 1000; + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player._characterIndex = R2_QUINN; + R2_GLOBALS._player.disableControl(); + + _actor1.postInit(); + _item2.setDetails(Rect(212, 97, 320, 114), 3100, 3, -1, -1, 1, NULL); + _item1.setDetails(Rect(0, 0, 480, 200), 3100, 0, -1, -1, 1, NULL); + _field412 = 0; + + if (R2_GLOBALS._sceneManager._previousScene == 1000) { + if (R2_GLOBALS._player._oldCharacterScene[1] == 3100) { + _sceneMode = 3102; + _actor3.postInit(); + _actor4.postInit(); + _actor5.postInit(); + R2_GLOBALS._sound1.play(274); + _sound1.fadeSound(130); + setAction(&_sequenceManager, this, 3102, &_actor1, &R2_GLOBALS._player, &_actor3, &_actor4, &_actor5, NULL); + } else { + _actor6.postInit(); + _actor6.setup(3110, 5, 1); + _actor6.changeZoom(50); + _actor6.setPosition(Common::Point(10, 149)); + _actor6.setDetails(3100, 6, -1, -1, 2, NULL); + + _actor4.postInit(); + _actor4.setup(3103, 1, 1); + _actor4.setPosition(Common::Point(278, 113)); + _actor4.setDetails(3100, 9, -1, -1, 2, NULL); + _actor4.animate(ANIM_MODE_2, NULL); + + _field412 = 1; + _actor1.setDetails(3100, 3, -1, -1, 2, NULL); + R2_GLOBALS._sound1.play(243); + R2_GLOBALS._sound2.play(130); + _sceneMode = 3100; + + setAction(&_sequenceManager, this, 3100, &R2_GLOBALS._player, &_actor1, NULL); + } + } else if (R2_GLOBALS._sceneManager._previousScene == 3255) { + _sceneMode = 3101; + _actor2.postInit(); + _actor3.postInit(); + _field412 = 1; + + setAction(&_sequenceManager, this, 3101, &R2_GLOBALS._player, &_actor1, &_actor2, &_actor3, NULL); + } else { + _actor6.postInit(); + _actor6.setup(3110, 5, 1); + _actor6.changeZoom(50); + _actor6.setPosition(Common::Point(10, 149)); + _actor6.setDetails(3100, 6, -1, -1, 2, NULL); + + _actor4.postInit(); + _actor4.setup(3103, 1, 1); + _actor4.setPosition(Common::Point(278, 113)); + _actor4.setDetails(3100, 9, -1, -1, 2, NULL); + _actor4.animate(ANIM_MODE_2, NULL); + + _actor1.postInit(); + _actor1.setup(3104, 4, 1); + _actor1.setPosition(Common::Point(143, 104)); + _actor1.setDetails(3100, 3, -1, -1, 2, NULL); + + R2_GLOBALS._player.setup(3110, 3, 1); + R2_GLOBALS._player.changeZoom(50); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player.setPosition(Common::Point(160, 150)); + R2_GLOBALS._player._moveDiff = Common::Point(3, 2); + R2_GLOBALS._player.enableControl(CURSOR_ARROW); + + R2_GLOBALS._sound1.play(243); + } + + R2_GLOBALS._player._oldCharacterScene[1] = 3100; +} + +void Scene3100::remove() { + R2_GLOBALS._scrollFollower = &R2_GLOBALS._player; + R2_GLOBALS._sound1.fadeOut2(NULL); + R2_GLOBALS._sound2.fadeOut2(NULL); + _sound1.fadeOut2(NULL); + SceneExt::remove(); +} + +void Scene3100::signal() { + switch (_sceneMode) { + case 10: + warning("TODO: Unknown cursor used (6/-6)"); + R2_GLOBALS._player.enableControl(); + break; + case 3100: + R2_GLOBALS._player._moveDiff = Common::Point(3, 2); + R2_GLOBALS._scrollFollower = &R2_GLOBALS._player; + R2_GLOBALS._player.enableControl(CURSOR_ARROW); + break; + case 3101: + R2_GLOBALS._sceneManager.changeScene(1000); + break; + case 3102: + R2_GLOBALS._player._oldCharacterScene[1] = 1000; + R2_GLOBALS._sceneManager.changeScene(1000); + break; + default: + R2_GLOBALS._player.enableControl(CURSOR_ARROW); + break; + } +} + +void Scene3100::dispatch() { + if ((_sceneMode == 3100) && (_field412 != 0) && (R2_GLOBALS._player._position.y == 104)) { + _field412 = 0; + R2_GLOBALS._sound2.fadeOut2(NULL); + } + + if ((_sceneMode == 3101) && (_field412 != 0) && (R2_GLOBALS._player._position.y < 104)) { + _field412 = 0; + _sound1.fadeSound(130); + } + + 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 new file mode 100644 index 0000000000..fe00e2cf09 --- /dev/null +++ b/engines/tsage/ringworld2/ringworld2_scenes3.h @@ -0,0 +1,73 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef TSAGE_RINGWORLD2_SCENES3_H +#define TSAGE_RINGWORLD2_SCENES3_H + +#include "common/scummsys.h" +#include "tsage/converse.h" +#include "tsage/events.h" +#include "tsage/core.h" +#include "tsage/scenes.h" +#include "tsage/globals.h" +#include "tsage/sound.h" +#include "tsage/ringworld2/ringworld2_logic.h" +#include "tsage/ringworld2/ringworld2_speakers.h" + +namespace TsAGE { + +namespace Ringworld2 { + +using namespace TsAGE; + + +class Scene3100 : public SceneExt { + class Actor6 : public SceneActor { + virtual bool startAction(CursorType action, Event &event); + }; +public: + + int _field412; + SpeakerGuard3100 _guardSpeaker; + NamedHotspot _item1; + NamedHotspot _item2; + SceneActor _actor1; + SceneActor _actor2; + SceneActor _actor3; + SceneActor _actor4; + SceneActor _actor5; + Actor6 _actor6; + ASoundExt _sound1; + SequenceManager _sequenceManager; + + Scene3100(); + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void remove(); + virtual void signal(); + virtual void dispatch(); + virtual void synchronize(Serializer &s); +}; + +} // End of namespace Ringworld2 +} // End of namespace TsAGE + +#endif diff --git a/engines/tsage/ringworld2/ringworld2_speakers.cpp b/engines/tsage/ringworld2/ringworld2_speakers.cpp index 35de45d8e6..3ec1df41d0 100644 --- a/engines/tsage/ringworld2/ringworld2_speakers.cpp +++ b/engines/tsage/ringworld2/ringworld2_speakers.cpp @@ -1039,5 +1039,18 @@ void SpeakerGuard2800::proc15() { _object1.animate(ANIM_MODE_5, this); } } + +SpeakerGuard3100::SpeakerGuard3100() { + _speakerName = "GUARD"; + _color1 = 5; + _color2 = 0; + _fieldF6 = 0; + _textWidth = 300; + _hideObjects = false; + _object2 = NULL; + _displayMode = 1; + _numFrames = 0; +} + } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_speakers.h b/engines/tsage/ringworld2/ringworld2_speakers.h index 31eda2431c..1d99a54e7c 100644 --- a/engines/tsage/ringworld2/ringworld2_speakers.h +++ b/engines/tsage/ringworld2/ringworld2_speakers.h @@ -261,6 +261,13 @@ public: virtual Common::String getClassName() { return "SpeakerGuard2800"; } virtual void proc15(); }; + +class SpeakerGuard3100 : public VisualSpeaker { +public: + SpeakerGuard3100(); + + virtual Common::String getClassName() { return "SpeakerGuard3100"; } +}; } // End of namespace Ringworld2 } // End of namespace TsAGE -- cgit v1.2.3 From 9916d2e99ced884a4f79277dc17367cb1a4b7375 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 19 Dec 2011 01:10:48 +0100 Subject: CINE: Add some comments to the MT-32 instrument code. --- engines/cine/sound.cpp | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) (limited to 'engines') diff --git a/engines/cine/sound.cpp b/engines/cine/sound.cpp index 0328466e76..b2e992e8f6 100644 --- a/engines/cine/sound.cpp +++ b/engines/cine/sound.cpp @@ -205,7 +205,7 @@ private: Common::Mutex _mutex; void writeInstrument(int offset, const byte *data, int size); - void selectInstrument(int channel, int unk, int instrument, int volume); + void selectInstrument(int channel, int timbreGroup, int timbreNumber, int volume); }; class PCSoundFxPlayer { @@ -647,8 +647,11 @@ void MidiSoundDriverH32::setupChannel(int channel, const byte *data, int instrum if (!data) selectInstrument(channel, 0, 0, volume); + // In case the instrument is a builtin instrument select it directly. else if (data[0] < 0x80) selectInstrument(channel, data[0] / 0x40, data[0] % 0x40, volume); + // In case we use a custom instrument we need to specify the timbre group + // 2, which means it's a timbre from the timbre memory area. else selectInstrument(channel, 2, instrument, volume); } @@ -690,6 +693,9 @@ void MidiSoundDriverH32::playSample(const byte *data, int size, int channel, int void MidiSoundDriverH32::notifyInstrumentLoad(const byte *data, int size, int channel) { Common::StackLock lock(_mutex); + // In case we specify a standard instrument or standard rhythm instrument + // do not do anything here. It might be noteworthy that the instrument + // selection client code does not support rhythm instruments! if (data[0] < 0x80 || data[0] > 0xC0) return; @@ -717,18 +723,29 @@ void MidiSoundDriverH32::writeInstrument(int offset, const byte *data, int size) _output->sysEx(sysEx, copySize + 8); } -void MidiSoundDriverH32::selectInstrument(int channel, int unk, int instrument, int volume) { - const int offset = channel * 16 + 0x30000; +void MidiSoundDriverH32::selectInstrument(int channel, int timbreGroup, int timbreNumber, int volume) { + const int offset = channel * 16 + 0x30000; // 0x30000 is the start of the patch temp area byte sysEx[24] = { 0x41, 0x10, 0x16, 0x12, 0x00, 0x00, 0x00, // offset - 0x00, // unk - 0x00, // instrument - 0x18, 0x32, 0x0C, 0x03, 0x01, 0x00, - 0x00, // volume - 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00 // checksum + 0x00, // Timbre group _ timbreGroup * 64 + timbreNumber should be the + 0x00, // Timbre number / MT-32 instrument in case timbreGroup is 0 or 1. + 0x18, // Key shift (= 0) + 0x32, // Fine tune (= 0) + 0x0C, // Bender Range + 0x03, // Assign Mode + 0x01, // Reverb Switch (= enabled) + 0x00, // dummy + 0x00, // Output level + 0x07, // Panpot (= balanced) + 0x00, // dummy + 0x00, // dummy + 0x00, // dummy + 0x00, // dummy + 0x00, // dummy + 0x00, // dummy + 0x00 // checksum }; @@ -736,9 +753,8 @@ void MidiSoundDriverH32::selectInstrument(int channel, int unk, int instrument, sysEx[5] = (offset >> 8) & 0xFF; sysEx[6] = (offset >> 0) & 0xFF; - sysEx[7] = unk; - - sysEx[8] = instrument; + sysEx[7] = timbreGroup; + sysEx[8] = timbreNumber; sysEx[15] = volume; -- cgit v1.2.3 From f0eee81d327957cddb85c5a1ffe7a308a377f636 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 19 Dec 2011 03:23:16 +0200 Subject: DREAMWEB: Port 'intoinv', 'outofinv' to C++ --- engines/dreamweb/dreamgen.cpp | 112 ------------------------------------------ engines/dreamweb/dreamgen.h | 2 - engines/dreamweb/object.cpp | 82 +++++++++++++++++++++++++++++++ engines/dreamweb/stubs.h | 2 + 4 files changed, 84 insertions(+), 114 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index be1bfa6d96..a0ce29d416 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -691,118 +691,6 @@ actuallyswap: delPointer(); } -void DreamGenContext::inToInv() { - STACK_CHECK; - _cmp(data.byte(kPickup), 0); - if (!flags.z()) - goto notout; - outOfInv(); - return; -notout: - findInvPos(); - ax = es.word(bx); - _cmp(al, 255); - if (flags.z()) - goto canplace1; - swapWithInv(); - return; -canplace1: - al = data.byte(kItemframe); - ah = data.byte(kObjecttype); - _cmp(ax, data.word(kOldsubject)); - if (!flags.z()) - goto difsub1; - _cmp(data.byte(kCommandtype), 220); - if (flags.z()) - goto alreadyplce; - data.byte(kCommandtype) = 220; -difsub1: - data.word(kOldsubject) = ax; - bx = ax; - al = 35; - commandWithOb(); -alreadyplce: - ax = data.word(kMousebutton); - _cmp(ax, data.word(kOldbutton)); - if (flags.z()) - return /* (notletgo2) */; - _and(ax, 1); - if (!flags.z()) - goto doplace; - return; -doplace: - delPointer(); - al = data.byte(kItemframe); - getExAd(); - es.byte(bx+2) = 4; - es.byte(bx+3) = 255; - al = data.byte(kLastinvpos); - es.byte(bx+4) = al; - data.byte(kPickup) = 0; - fillRyan(); - readMouse(); - showPointer(); - outOfInv(); - workToScreen(); - delPointer(); -} - -void DreamGenContext::outOfInv() { - STACK_CHECK; - findInvPos(); - ax = es.word(bx); - _cmp(al, 255); - if (!flags.z()) - goto canpick2; - blank(); - return; -canpick2: - bx = data.word(kMousebutton); - _cmp(bx, 2); - if (!flags.z()) - goto canpick2a; - reExFromInv(); - return; -canpick2a: - _cmp(ax, data.word(kOldsubject)); - if (!flags.z()) - goto difsub3; - _cmp(data.byte(kCommandtype), 221); - if (flags.z()) - goto alreadygrab; - data.byte(kCommandtype) = 221; -difsub3: - data.word(kOldsubject) = ax; - bx = ax; - al = 36; - commandWithOb(); -alreadygrab: - ax = data.word(kMousebutton); - _cmp(ax, data.word(kOldbutton)); - if (flags.z()) - return /* (notletgo) */; - _and(ax, 1); - if (!flags.z()) - goto dograb; - return; -dograb: - delPointer(); - data.byte(kPickup) = 1; - findInvPos(); - ax = es.word(bx); - data.byte(kItemframe) = al; - data.byte(kObjecttype) = ah; - getExAd(); - es.byte(bx+2) = 20; - es.byte(bx+3) = 255; - fillRyan(); - readMouse(); - showPointer(); - inToInv(); - workToScreen(); - delPointer(); -} - void DreamGenContext::getFreeAd() { STACK_CHECK; ah = 0; diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 77e3abdcc9..b13d150ad4 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -477,13 +477,11 @@ public: void startTalk(); void getAnyAd(); void reminders(); - void inToInv(); void getFreeAd(); void dirFile(); void pickupConts(); void fadeUpMon(); void reExFromInv(); - void outOfInv(); void transferMap(); void purgeAnItem(); void purgeALocation(); diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index 384e001b5e..9fe94c4bd4 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -562,5 +562,87 @@ void DreamBase::removeObFromInv() { deleteExObject(data.byte(kCommand)); } +void DreamGenContext::inToInv() { + if (!data.byte(kPickup)) { + outOfInv(); + return; + } + + findInvPos(); + ax = es.word(bx); + + if (al != 255) { + swapWithInv(); + return; + } + + al = data.byte(kItemframe); + ah = data.byte(kObjecttype); + + if (ax == data.word(kOldsubject) && data.byte(kCommandtype) != 220) + data.byte(kCommandtype) = 220; + + data.word(kOldsubject) = ax; + commandWithOb(35, data.byte(kObjecttype), data.byte(kItemframe)); + + if (data.word(kMousebutton) == data.word(kOldbutton) || !(data.word(kMousebutton) & 1)) + return; // notletgo2 + + delPointer(); + DynObject *object = getExAd(data.byte(kItemframe)); + object->mapad[0] = 4; + object->mapad[1] = 255; + object->mapad[2] = data.byte(kLastinvpos); + data.byte(kPickup) = 0; + fillRyan(); + readMouse(); + showPointer(); + outOfInv(); + workToScreen(); + delPointer(); +} + +void DreamGenContext::outOfInv() { + findInvPos(); + ax = es.word(bx); + + if (al == 255) { + blank(); + return; + } + + if (data.word(kMousebutton) == 2) { + reExFromInv(); + return; + } + + if (ax == data.word(kOldsubject) && data.byte(kCommandtype) != 221) + data.byte(kCommandtype) = 221; + + data.word(kOldsubject) = ax; + commandWithOb(36, ah, al); + + if (data.word(kMousebutton) == data.word(kOldbutton)) + return; // notletgo + + if (!(data.word(kMousebutton) & 1)) + return; + + delPointer(); + data.byte(kPickup) = 1; + findInvPos(); + ax = es.word(bx); + data.byte(kItemframe) = al; + data.byte(kObjecttype) = ah; + DynObject *object = getExAd(data.byte(kItemframe)); + object->mapad[0] = 20; + object->mapad[1] = 255; + fillRyan(); + readMouse(); + showPointer(); + inToInv(); + workToScreen(); + delPointer(); +} } // End of namespace DreamGen diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 3ab7cfbb11..1a76a785b8 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -375,5 +375,7 @@ } void signOn(); void lookAtPlace(); + void inToInv(); + void outOfInv(); #endif -- cgit v1.2.3 From 7d580ee37e73673e15eaf9052e8491ec721a052d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 19 Dec 2011 22:28:25 +1100 Subject: TSAGE: Implemented R2R Scene 800 - Sickbay --- engines/tsage/ringworld2/ringworld2_logic.cpp | 3 + engines/tsage/ringworld2/ringworld2_scenes0.cpp | 284 ++++++++++++++++++++++++ engines/tsage/ringworld2/ringworld2_scenes0.h | 49 ++++ 3 files changed, 336 insertions(+) (limited to 'engines') diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index 689b2b5f0f..42f3b16d7f 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -76,7 +76,10 @@ Scene *Ringworld2Game::createScene(int sceneNumber) { case 525: case 600: case 700: + error("Missing scene %d from group 0", sceneNumber); case 800: + // Sick bay + return new Scene800(); case 825: error("Missing scene %d from group 0", sceneNumber); case 850: diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index 7a3b0cdd78..ceca8915d8 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -2900,6 +2900,290 @@ void Scene400::dispatch() { } } +/*-------------------------------------------------------------------------- + * Scene 800 - Sick Bay + * + *--------------------------------------------------------------------------*/ + +bool Scene800::Button::startAction(CursorType action, Event &event) { + Scene800 *scene = (Scene800 *)R2_GLOBALS._sceneManager._scene; + + if (action != CURSOR_USE) { + return NamedHotspot::startAction(action, event); + } else { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 802; + scene->setAction(&scene->_sequenceManager1, scene, 802, &R2_GLOBALS._player, &scene->_autodocCover, NULL); + return true; + } +} + +bool Scene800::CableJunction::startAction(CursorType action, Event &event) { + Scene800 *scene = (Scene800 *)R2_GLOBALS._sceneManager._scene; + + if (action != R2_OPTICAL_FIBRE) { + return NamedHotspot::startAction(action, event); + } else { + R2_GLOBALS._player.disableControl(); + scene->_opticalFibre.postInit(); + scene->_sceneMode = 803; + + if (R2_INVENTORY.getObjectScene(R2_READER) == 800) + scene->setAction(&scene->_sequenceManager1, scene, 813, &R2_GLOBALS._player, &scene->_opticalFibre, &scene->_reader, NULL); + else + scene->setAction(&scene->_sequenceManager1, scene, 803, &R2_GLOBALS._player, &scene->_opticalFibre, NULL); + + return true; + } +} + +bool Scene800::DeviceSlot::startAction(CursorType action, Event &event) { + Scene800 *scene = (Scene800 *)R2_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + if (R2_INVENTORY.getObjectScene(R2_READER) != 800) + break; + + R2_GLOBALS._player.disableControl(); + scene->_reader.postInit(); + + if (R2_INVENTORY.getObjectScene(R2_OPTICAL_FIBRE) == 800) + scene->setAction(&scene->_sequenceManager1, scene, 814, &R2_GLOBALS._player, &scene->_reader, &scene->_opticalFibre, NULL); + else + scene->setAction(&scene->_sequenceManager1, scene, 804, &R2_GLOBALS._player, &scene->_reader, NULL); + return true; + default: + break; + } + + return NamedHotspot::startAction(action, event); +} + +/*--------------------------------------------------------------------------*/ + +bool Scene800::Door::startAction(CursorType action, Event &event) { + Scene800 *scene = (Scene800 *)R2_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 801; + scene->setAction(&scene->_sequenceManager1, scene, 801, &R2_GLOBALS._player, &scene->_door, NULL); + return true; + default: + return SceneActor::startAction(action, event); + } +} + +bool Scene800::Tray::startAction(CursorType action, Event &event) { + Scene800 *scene = (Scene800 *)R2_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + if (!R2_GLOBALS.getFlag(10)) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 806; + scene->setAction(&scene->_sequenceManager1, scene, 806, &R2_GLOBALS._player, &scene->_tray, NULL); + } else if (R2_INVENTORY.getObjectScene(R2_OPTO_DISK) == 825) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 808; + scene->setAction(&scene->_sequenceManager1, scene, 808, &R2_GLOBALS._player, &scene->_tray, NULL); + } else { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 807; + scene->setAction(&scene->_sequenceManager1, scene, 807, &R2_GLOBALS._player, &scene->_tray, NULL); + } + return true; + default: + return SceneActor::startAction(action, event); + } +} + +bool Scene800::ComScanner::startAction(CursorType action, Event &event) { + Scene800 *scene = (Scene800 *)R2_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + if (scene->_cabinet._frame == 1) + return false; + + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 811; + scene->setAction(&scene->_sequenceManager1, scene, 811, &R2_GLOBALS._player, &scene->_comScanner, NULL); + return true; + case CURSOR_TALK: + SceneItem::display2(800, 35); + return true; + default: + return SceneActor::startAction(action, event); + } +} + +bool Scene800::Cabinet::startAction(CursorType action, Event &event) { + Scene800 *scene = (Scene800 *)R2_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + R2_GLOBALS._player.disableControl(); + + if (scene->_cabinet._frame == 1) { + scene->_sceneMode = 810; + scene->setAction(&scene->_sequenceManager1, scene, 810, &R2_GLOBALS._player, &scene->_cabinet, NULL); + R2_GLOBALS.setFlag(56); + } else { + scene->_sceneMode = 812; + scene->setAction(&scene->_sequenceManager1, scene, 812, &R2_GLOBALS._player, &scene->_cabinet, NULL); + R2_GLOBALS.clearFlag(56); + } + return true; + default: + return SceneActor::startAction(action, event); + } +} + +/*--------------------------------------------------------------------------*/ + +void Scene800::postInit(SceneObjectList *OwnerList) { + SceneExt::postInit(); + loadScene(800); + + _door.postInit(); + _door.setVisage(800); + _door.setPosition(Common::Point(286, 108)); + _door.fixPriority(50); + _door.setDetails(800, 3, -1, -1, 1, NULL); + + _autodocCover.postInit(); + _autodocCover.setup(800, 2, 1); + _autodocCover.setPosition(Common::Point(119, 161)); + _autodocCover.setDetails(800, 6, 7, -1, 1, NULL); + + if (R2_INVENTORY.getObjectScene(R2_OPTICAL_FIBRE) == 800) { + _opticalFibre.postInit(); + if (R2_INVENTORY.getObjectScene(R2_READER) == 800) + _opticalFibre.setup(800, 4, 1); + else + _opticalFibre.setup(800, 7, 2); + + _opticalFibre.setPosition(Common::Point(220, 124)); + _opticalFibre.fixPriority(140); + } + + if (R2_INVENTORY.getObjectScene(R2_READER) == 800) { + _reader.postInit(); + + if (R2_INVENTORY.getObjectScene(R2_OPTICAL_FIBRE) == 800) { + _opticalFibre.setup(800, 4, 1); + _reader.hide(); + } else { + _reader.setup(800, 7, 1); + } + + _reader.setPosition(Common::Point(230, 120)); + _reader.fixPriority(140); + } + + _cabinet.postInit(); + _cabinet.setup(801, 1, R2_GLOBALS.getFlag(56) ? 6 : 1); + _cabinet.setPosition(Common::Point(169, 79)); + _cabinet.setDetails(800, 41, -1, -1, 1, NULL); + + if (R2_INVENTORY.getObjectScene(R2_9) == 800) { + _comScanner.postInit(); + _comScanner.setup(801, 2, 1); + _comScanner.setPosition(Common::Point(174, 73)); + _comScanner.setDetails(800, 34, 35, -1, 1, NULL); + } + + _tray.postInit(); + _tray.setup(800, R2_INVENTORY.getObjectScene(R2_OPTO_DISK) == 825 ? 6 : 5, 1); + if (R2_GLOBALS.getFlag(10)) + _tray.setFrame(5); + _tray.setPosition(Common::Point(203, 144)); + _tray.setDetails(800, 12, -1, 14, 1, NULL); + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.setVisage(10); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player.disableControl(); + + _dataConduits.setDetails(13, 800, 21, -1, -1); + _cableJunction.setDetails(Rect(206, 111, 223, 125), 800, 24, -1, -1, 1, NULL); + _deviceSlot.setDetails(Rect(220, 108, 239, 122), 800, 27, -1, -1, 1, NULL); + _diskSlot.setDetails(Rect(209, 124, 226, 133), 800, 9, -1, 11, 1, NULL); + + if (R2_INVENTORY.getObjectScene(R2_READER) == 800) + _deviceSlot._lookLineNum = 33; + + _button.setDetails(Rect(189, 112, 204, 124), 800, 30, -1, -1, 1, NULL); + _couch.setDetails(11, 800, 15, -1, 17); + _autoDoc.setDetails(Rect(152, 92, 247, 151), 800, 6, 7, -1, 1, NULL); + _medicalDatabase.setDetails(12, 800, 18, -1, -1); + _background.setDetails(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 800, 0, -1, -1, 1, NULL); + + switch (R2_GLOBALS._sceneManager._previousScene) { + case 825: + _sceneMode = 800; + setAction(&_sequenceManager1, this, 805, &R2_GLOBALS._player, &_autodocCover, NULL); + break; + case 850: + _sceneMode = 800; + setAction(&_sequenceManager1, this, 800, &R2_GLOBALS._player, &_door, NULL); + break; + default: + R2_GLOBALS._player.setStrip(3); + R2_GLOBALS._player.setPosition(Common::Point(277, 132)); + R2_GLOBALS._player.enableControl(); + break; + } +} + +void Scene800::signal() { + switch (_sceneMode) { + case 801: + R2_GLOBALS._sceneManager.changeScene(850); + break; + case 802: + R2_GLOBALS._sceneManager.changeScene(825); + break; + case 803: + R2_GLOBALS._player.enableControl(); + R2_INVENTORY.setObjectScene(R2_OPTICAL_FIBRE, 800); + break; + case 804: + R2_GLOBALS._player.enableControl(); + _deviceSlot._lookLineNum = 33; + R2_INVENTORY.setObjectScene(R2_READER, 800); + break; + case 806: + R2_GLOBALS._player.enableControl(); + R2_GLOBALS.setFlag(10); + break; + case 807: + R2_GLOBALS._player.enableControl(); + R2_GLOBALS.clearFlag(10); + break; + case 808: + R2_GLOBALS._player.enableControl(); + R2_INVENTORY.setObjectScene(R2_OPTO_DISK, 1); + break; + case 809: + R2_GLOBALS._player.enableControl(); + R2_INVENTORY.setObjectScene(R2_READER, 1); + break; + case 811: + R2_GLOBALS._player.enableControl(); + _comScanner.remove(); + R2_INVENTORY.setObjectScene(R2_9, 1); + break; + default: + R2_GLOBALS._player.enableControl(); + break; + } +} + + /*-------------------------------------------------------------------------- * Scene 850 - Deck #5 - By Lift * diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.h b/engines/tsage/ringworld2/ringworld2_scenes0.h index 5f2d768f90..6810b5d85a 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.h +++ b/engines/tsage/ringworld2/ringworld2_scenes0.h @@ -370,6 +370,55 @@ public: virtual void dispatch(); }; +class Scene800: public SceneExt { + /* Items */ + class Button: public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class CableJunction: public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class DeviceSlot: public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + /* Objects */ + class Door: public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Tray: public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class ComScanner: public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Cabinet: public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; +public: + NamedHotspot _background, _autoDoc, _diskSlot, _couch; + NamedHotspot _medicalDatabase, _dataConduits; + Button _button; + CableJunction _cableJunction; + DeviceSlot _deviceSlot; + SceneActor _autodocCover, _opticalFibre, _reader; + Door _door; + Tray _tray; + ComScanner _comScanner; + Cabinet _cabinet; + SequenceManager _sequenceManager1; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); +}; + class Scene850: public SceneExt { /* Items */ class Indicator: public NamedHotspot { -- cgit v1.2.3 From 96face8ba870c09b7f7ce6847165bd2aed0d3e77 Mon Sep 17 00:00:00 2001 From: Tarek Soliman Date: Mon, 19 Dec 2011 10:51:01 -0600 Subject: TSAGE: Blue Force is now ready for testing --- engines/tsage/detection_tables.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'engines') diff --git a/engines/tsage/detection_tables.h b/engines/tsage/detection_tables.h index d6b1760b80..0f6d8c9d7d 100644 --- a/engines/tsage/detection_tables.h +++ b/engines/tsage/detection_tables.h @@ -105,7 +105,7 @@ static const tSageGameDescription gameDescriptions[] = { AD_ENTRY1s("blue.rlb", "17c3993415e8a2cf93040eef7e88ec93", 1156508), Common::EN_ANY, Common::kPlatformPC, - ADGF_UNSTABLE, + ADGF_TESTING, GUIO2(GUIO_NOSPEECH, GUIO_NOSFX) }, GType_BlueForce, @@ -120,7 +120,7 @@ static const tSageGameDescription gameDescriptions[] = { AD_ENTRY1s("blue.rlb", "17eabb456cb1546c66baf1aff387ba6a", 10032614), Common::EN_ANY, Common::kPlatformPC, - ADGF_UNSTABLE, + ADGF_TESTING, GUIO2(GUIO_NOSPEECH, GUIO_NOSFX) }, GType_BlueForce, @@ -134,7 +134,7 @@ static const tSageGameDescription gameDescriptions[] = { AD_ENTRY1s("blue.rlb", "99983f48cb218f1f3760cf2f9a7ef11d", 63863322), Common::EN_ANY, Common::kPlatformPC, - ADGF_CD | ADGF_UNSTABLE, + ADGF_CD | ADGF_TESTING, GUIO2(GUIO_NOSPEECH, GUIO_NOSFX) }, GType_BlueForce, -- cgit v1.2.3 From 5a3deea58ebab2a443e48c91cfff7ca5ecab349c Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 19 Dec 2011 23:47:06 +0200 Subject: DREAMWEB: More work on inToInv and outOfInv --- engines/dreamweb/object.cpp | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index 9fe94c4bd4..1cdbca0907 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -568,21 +568,19 @@ void DreamGenContext::inToInv() { return; } - findInvPos(); - ax = es.word(bx); + uint16 subject = getSegment(data.word(kBuffers)).word(findInvPosCPP()); - if (al != 255) { + if ((subject & 0xFF) != 255) { swapWithInv(); return; } - al = data.byte(kItemframe); - ah = data.byte(kObjecttype); + subject = (data.byte(kObjecttype) << 8) | data.byte(kItemframe); - if (ax == data.word(kOldsubject) && data.byte(kCommandtype) != 220) + if (subject == data.word(kOldsubject) && data.byte(kCommandtype) != 220) data.byte(kCommandtype) = 220; - data.word(kOldsubject) = ax; + data.word(kOldsubject) = subject; commandWithOb(35, data.byte(kObjecttype), data.byte(kItemframe)); if (data.word(kMousebutton) == data.word(kOldbutton) || !(data.word(kMousebutton) & 1)) @@ -603,10 +601,9 @@ void DreamGenContext::inToInv() { } void DreamGenContext::outOfInv() { - findInvPos(); - ax = es.word(bx); + uint16 subject = getSegment(data.word(kBuffers)).word(findInvPosCPP()); - if (al == 255) { + if ((subject & 0xFF) == 255) { blank(); return; } @@ -616,11 +613,13 @@ void DreamGenContext::outOfInv() { return; } - if (ax == data.word(kOldsubject) && data.byte(kCommandtype) != 221) + if (subject == data.word(kOldsubject) && data.byte(kCommandtype) != 221) data.byte(kCommandtype) = 221; - data.word(kOldsubject) = ax; - commandWithOb(36, ah, al); + data.word(kOldsubject) = subject; + byte type = subject >> 8; + byte frame = subject & 0xFF; + commandWithOb(36, type, frame); if (data.word(kMousebutton) == data.word(kOldbutton)) return; // notletgo @@ -630,10 +629,9 @@ void DreamGenContext::outOfInv() { delPointer(); data.byte(kPickup) = 1; - findInvPos(); - ax = es.word(bx); - data.byte(kItemframe) = al; - data.byte(kObjecttype) = ah; + subject = getSegment(data.word(kBuffers)).word(findInvPosCPP()); + data.byte(kObjecttype) = subject >> 8; + data.byte(kItemframe) = subject & 0xFF; DynObject *object = getExAd(data.byte(kItemframe)); object->mapad[0] = 20; object->mapad[1] = 255; -- cgit v1.2.3 From 9a40cd8fd784bbb52186f8dc14bbea8198e1a239 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 19 Dec 2011 23:15:42 +0100 Subject: TSAGE: R2R - Implement scene 3125 --- engines/tsage/ringworld2/ringworld2_logic.cpp | 2 + engines/tsage/ringworld2/ringworld2_scenes3.cpp | 169 ++++++++++++++++++++++++ engines/tsage/ringworld2/ringworld2_scenes3.h | 38 ++++++ 3 files changed, 209 insertions(+) (limited to 'engines') diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index 42f3b16d7f..e5a3919c05 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -175,6 +175,8 @@ Scene *Ringworld2Game::createScene(int sceneNumber) { case 3100: return new Scene3100(); case 3125: + // Ghouls dormitory + return new Scene3125(); case 3150: case 3175: case 3200: diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp index 22e58b6d2b..488fda5d59 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp @@ -202,5 +202,174 @@ void Scene3100::dispatch() { Scene::dispatch(); } +/*-------------------------------------------------------------------------- + * Scene 3125 - Ghouls dormitory + * + *--------------------------------------------------------------------------*/ +Scene3125::Scene3125() { + _field412 = 0; +} + +void Scene3125::synchronize(Serializer &s) { + SceneExt::synchronize(s); + + s.syncAsSint16LE(_field412); +} + +bool Scene3125::Item1::startAction(CursorType action, Event &event) { + Scene3125 *scene = (Scene3125 *)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); + break; + case CURSOR_LOOK: + if (_lookLineNum != -1) + SceneItem::display(_resNum, _lookLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + break; + case CURSOR_TALK: + if (_talkLineNum != -1) + SceneItem::display(_resNum, _talkLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + break; + default: + warning("scene->display() called with two parameters"); + return scene->display(action); + break; + } + + return true; +} + +bool Scene3125::Item2::startAction(CursorType action, Event &event) { + Scene3125 *scene = (Scene3125 *)R2_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 3125; + scene->setAction(&scene->_sequenceManager1, scene, 3125, &R2_GLOBALS._player, NULL); + break; + case CURSOR_LOOK: + SceneItem::display(3125, 15, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + break; + case CURSOR_TALK: + SceneItem::display(3125, 13, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + break; + default: + return SceneHotspot::startAction(action, event); + break; + } + + return true; +} + +bool Scene3125::Item3::startAction(CursorType action, Event &event) { + Scene3125 *scene = (Scene3125 *)R2_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + R2_GLOBALS._player.disableControl(); + scene->_actor5.postInit(); + scene->_sceneMode = 3126; + scene->setAction(&scene->_sequenceManager1, scene, 3126, &R2_GLOBALS._player, &scene->_actor2, &scene->_actor3, &scene->_actor4, &scene->_actor1, &scene->_actor5, NULL); + break; + case CURSOR_LOOK: + SceneItem::display(3125, 9, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + break; + case CURSOR_TALK: + SceneItem::display(3125, 13, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + break; + default: + return SceneHotspot::startAction(action, event); + break; + } + + return true; +} + +bool Scene3125::Actor1::startAction(CursorType action, Event &event) { + Scene3125 *scene = (Scene3125 *)R2_GLOBALS._sceneManager._scene; + + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 3176; + scene->setAction(&scene->_sequenceManager1, scene, 3176, &R2_GLOBALS._player, &scene->_actor1, NULL); + return true; +} + +void Scene3125::postInit(SceneObjectList *OwnerList) { + loadScene(3125); + SceneExt::postInit(); + _field412 = 0; + + _actor1.postInit(); + _actor1.setup(3175, 1, 1); + _actor1.setPosition(Common::Point(35, 72)); + _actor1.setDetails(3125, 12, 13, -1, 1, NULL); + + _actor2.postInit(); + _actor2.setup(3126, 4, 1); + _actor2.setPosition(Common::Point(71, 110)); + _actor2._numFrames = 20; + + _actor3.postInit(); + _actor3.setup(3126, 1, 1); + _actor3.setPosition(Common::Point(215, 62)); + _actor3.fixPriority(71); + + _actor4.postInit(); + _actor4.setup(3126, 1, 1); + _actor4.setPosition(Common::Point(171, 160)); + _actor4.fixPriority(201); + + _item3.setDetails(12, 3125, 9, 13, -1); + _item2.setDetails(11, 3125, 15, 13, -1); + _item1.setDetails(Rect(0, 0, 320, 200), 3125, 0, 1, 2, 1, NULL); + + R2_GLOBALS._sound1.play(262); + R2_GLOBALS._player.postInit(); + + if (R2_GLOBALS._player._oldCharacterScene[3] == 3250) { + _sceneMode = 3175; + setAction(&_sequenceManager1, this, 3175, &R2_GLOBALS._player, &_actor1, NULL); + } else { + R2_GLOBALS._player.setup(30, 5, 1); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player.setPosition(Common::Point(89, 76)); + R2_GLOBALS._player.enableControl(); + } + R2_GLOBALS._player._oldCharacterScene[3] = 3125; +} + +void Scene3125::signal() { + switch (_sceneMode) { + case 3125: + SceneItem::display(3125, 3, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + _sceneMode = 3127; + setAction(&_sequenceManager1, this, 3127, &R2_GLOBALS._player, NULL); + break; + case 3126: + R2_GLOBALS.setFlag(79); + // No break on purpose + case 3176: + R2_GLOBALS._sceneManager.changeScene(3250); + break; + default: + R2_GLOBALS._player.enableControl(); + break; + } +} + +void Scene3125::dispatch() { + if ((_sceneMode == 3126) && (_actor2._frame == 2) && (_field412 == 0)) { + _field412 = 1; + R2_GLOBALS._sound1.play(265); + } + 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 fe00e2cf09..b135ddc0a3 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.h +++ b/engines/tsage/ringworld2/ringworld2_scenes3.h @@ -67,6 +67,44 @@ public: virtual void synchronize(Serializer &s); }; +class Scene3125 : public SceneExt { + class Item1 : public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Item2 : public Item1 { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Item3 : public Item1 { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + class Actor1 : public SceneActor { + virtual bool startAction(CursorType action, Event &event); + }; +public: + + int _field412; + Item1 _item1; + Actor1 _actor1; + Item2 _item2; + Item3 _item3; + SceneActor _actor2; + SceneActor _actor3; + SceneActor _actor4; + SceneActor _actor5; + SequenceManager _sequenceManager1; + // Second sequence manager... Unused? + SequenceManager _sequenceManager2; + + Scene3125(); + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); + virtual void dispatch(); + virtual void synchronize(Serializer &s); +}; } // End of namespace Ringworld2 } // End of namespace TsAGE -- cgit v1.2.3 From d2375c86eb9afbc7f14273f5c377533a1b10fce5 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Mon, 19 Dec 2011 23:58:55 +0100 Subject: SKY: Fix warning --- engines/sky/logic.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'engines') diff --git a/engines/sky/logic.cpp b/engines/sky/logic.cpp index 86c8828e5a..18fb4f7e82 100644 --- a/engines/sky/logic.cpp +++ b/engines/sky/logic.cpp @@ -1232,10 +1232,8 @@ uint16 Logic::mouseScript(uint32 scrNum, Compact *scriptComp) { * @return 0 if script finished. Else offset where to continue. */ uint16 Logic::script(uint16 scriptNo, uint16 offset) { - bool restartScript; - do { - restartScript = false; + bool restartScript = false; /// process a script /// low level interface to interpreter @@ -1422,7 +1420,7 @@ uint16 Logic::script(uint16 scriptNo, uint16 offset) { error("Unknown script command: %d", command); } } - } while (restartScript); + } while (true); } bool Logic::fnCacheChip(uint32 a, uint32 b, uint32 c) { -- cgit v1.2.3 From f5e8b3257e5c32c02561e4d26298775fa5547df2 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Tue, 20 Dec 2011 00:06:49 +0100 Subject: DREAMWEB: Fix regressions in intoInv, outOfInv; cleanup selectOb --- engines/dreamweb/object.cpp | 62 ++++++++++++++++++--------------------------- 1 file changed, 25 insertions(+), 37 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index 1cdbca0907..70481407f2 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -393,9 +393,7 @@ void DreamGenContext::findInvPos() { } void DreamGenContext::selectOb() { - es = data.word(kBuffers); - - uint16 objectId = es.word(findInvPosCPP()); + uint16 objectId = getSegment(data.word(kBuffers)).word(findInvPosCPP()); if ((objectId & 0xFF) == 255) { blank(); return; @@ -404,28 +402,19 @@ void DreamGenContext::selectOb() { data.byte(kWithobject) = objectId & 0x00FF; data.byte(kWithtype) = objectId >> 8; - if (objectId == data.word(kOldsubject)) { - if (data.byte(kCommandtype) == 221) { - // Object already selected - if (data.word(kMousebutton) != data.word(kOldbutton) && (data.word(kMousebutton) & 1)) { - delPointer(); - data.byte(kInvopen) = 0; - useRoutine(); - } - return; - } else { + if (objectId != data.word(kOldsubject) || data.byte(kCommandtype) != 221) { + if (objectId == data.word(kOldsubject)) data.byte(kCommandtype) = 221; - } + data.word(kOldsubject) = objectId; + commandWithOb(0, data.byte(kWithtype), data.byte(kWithobject)); } - data.word(kOldsubject) = objectId; - commandWithOb(0, data.byte(kWithtype), data.byte(kWithobject)); + if (data.word(kMousebutton) == data.word(kOldbutton) || !(data.word(kMousebutton) & 1)) + return; - if (data.word(kMousebutton) != data.word(kOldbutton) && (data.word(kMousebutton) & 1)) { - delPointer(); - data.byte(kInvopen) = 0; - useRoutine(); - } + delPointer(); + data.byte(kInvopen) = 0; + useRoutine(); } void DreamGenContext::setPickup() { @@ -577,11 +566,12 @@ void DreamGenContext::inToInv() { subject = (data.byte(kObjecttype) << 8) | data.byte(kItemframe); - if (subject == data.word(kOldsubject) && data.byte(kCommandtype) != 220) - data.byte(kCommandtype) = 220; - - data.word(kOldsubject) = subject; - commandWithOb(35, data.byte(kObjecttype), data.byte(kItemframe)); + if (subject != data.word(kOldsubject) || data.byte(kCommandtype) != 220) { + if (subject == data.word(kOldsubject)) + data.byte(kCommandtype) = 220; + data.word(kOldsubject) = subject; + commandWithOb(35, data.byte(kObjecttype), data.byte(kItemframe)); + } if (data.word(kMousebutton) == data.word(kOldbutton) || !(data.word(kMousebutton) & 1)) return; // notletgo2 @@ -613,18 +603,16 @@ void DreamGenContext::outOfInv() { return; } - if (subject == data.word(kOldsubject) && data.byte(kCommandtype) != 221) - data.byte(kCommandtype) = 221; - - data.word(kOldsubject) = subject; - byte type = subject >> 8; - byte frame = subject & 0xFF; - commandWithOb(36, type, frame); - - if (data.word(kMousebutton) == data.word(kOldbutton)) - return; // notletgo + if (subject != data.word(kOldsubject) || data.byte(kCommandtype) != 221) { + if (subject == data.word(kOldsubject)) + data.byte(kCommandtype) = 221; + data.word(kOldsubject) = subject; + byte type = subject >> 8; + byte frame = subject & 0xFF; + commandWithOb(36, type, frame); + } - if (!(data.word(kMousebutton) & 1)) + if (data.word(kMousebutton) == data.word(kOldbutton) || !(data.word(kMousebutton) & 1)) return; delPointer(); -- cgit v1.2.3 From 8a22c2d65e198e01b91360fe9e2d979c7d5b3c64 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Mon, 19 Dec 2011 19:06:15 -0500 Subject: MOHAWK: Add another lilmonster demo --- engines/mohawk/detection_tables.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'engines') diff --git a/engines/mohawk/detection_tables.h b/engines/mohawk/detection_tables.h index 998c2ef56d..2b1b28716e 100644 --- a/engines/mohawk/detection_tables.h +++ b/engines/mohawk/detection_tables.h @@ -1970,6 +1970,22 @@ static const MohawkGameDescription gameDescriptions[] = { "MONSTER.EXE" }, + // From GeorgeQGreg + { + { + "lilmonster", + "Demo", + AD_ENTRY1("MONSTER.512", "f603f04c1824d1034ec0366416a059c9"), + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_DEMO, + GUIO1(GUIO_NOASPECT) + }, + GType_LIVINGBOOKSV1, + GF_DEMO, + "MONSTER.EXE" + }, + { { "catinthehat", -- cgit v1.2.3 From 341a2d68742d4c7dce9229c1da4c8e6b13e2087c Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Tue, 20 Dec 2011 13:58:26 +0100 Subject: DREAMWEB: Fix regression in deleteExObject (thanks to Fingolfin) --- engines/dreamweb/object.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index 70481407f2..54979309f4 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -535,7 +535,7 @@ void DreamBase::deleteExObject(uint8 index) { deleteExText(index); for (uint8 i = 0; i < kNumexobjects; ++i) { - DynObject *t = getExAd(index); + DynObject *t = getExAd(i); // Is this object contained in the one we've just deleted? if (t->mapad[0] == 4 && t->mapad[1] == index) deleteExObject(i); @@ -544,7 +544,7 @@ void DreamBase::deleteExObject(uint8 index) { void DreamBase::removeObFromInv() { if (data.byte(kCommand) == 100) - return; // object doesn't exit + return; // object doesn't exist assert(data.byte(kObjecttype) == kExObjectType); -- cgit v1.2.3 From 62f4bb6ac1c8910381ef5579f718b692e93b9770 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 20 Dec 2011 23:56:26 +0100 Subject: TSAGE: R2R - Implement scene 3150 --- engines/tsage/globals.cpp | 3 +- engines/tsage/globals.h | 1 + engines/tsage/ringworld2/ringworld2_logic.cpp | 2 + engines/tsage/ringworld2/ringworld2_scenes3.cpp | 422 ++++++++++++++++++++++++ engines/tsage/ringworld2/ringworld2_scenes3.h | 54 +++ 5 files changed, 481 insertions(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp index 1d0e37d071..da40485617 100644 --- a/engines/tsage/globals.cpp +++ b/engines/tsage/globals.cpp @@ -386,6 +386,7 @@ void Ringworld2Globals::reset() { _v565AE = 0; for (int i = 0; i < 14; i++) _v56605[i] = 0; + _v56AA0 = 0; _v57C2C = 0; _v58CE2 = 0; Common::fill(&_v565F1[0], &_v565F1[MAX_CHARACTERS], 0); @@ -426,7 +427,7 @@ void Ringworld2Globals::synchronize(Serializer &s) { s.syncAsSint16LE(_v565F1[i]); s.syncAsByte(_v565AE); - + s.syncAsByte(_v56AA0); for (i = 0; i < 14; ++i) s.syncAsByte(_v56605[i]); diff --git a/engines/tsage/globals.h b/engines/tsage/globals.h index 9048899953..7e40276fcf 100644 --- a/engines/tsage/globals.h +++ b/engines/tsage/globals.h @@ -252,6 +252,7 @@ public: int _v5657C; byte _v565AE; byte _v56605[14]; + byte _v56AA0; int _v57C2C; int _v58CE2; int _speechSubtitles; diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index e5a3919c05..0248a3c32d 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -178,6 +178,8 @@ Scene *Ringworld2Game::createScene(int sceneNumber) { // Ghouls dormitory return new Scene3125(); case 3150: + // Jail + return new Scene3150(); case 3175: case 3200: case 3210: diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp index 488fda5d59..2c2530f833 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp @@ -371,5 +371,427 @@ void Scene3125::dispatch() { Scene::dispatch(); } +/*-------------------------------------------------------------------------- + * Scene 3150 - Jail + * + *--------------------------------------------------------------------------*/ +bool Scene3150::Item5::startAction(CursorType action, Event &event) { + Scene3150 *scene = (Scene3150 *)R2_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + if (R2_INVENTORY.getObjectScene(47) != 3150) + return SceneHotspot::startAction(action, event); + + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 3154; + scene->setAction(&scene->_sequenceManager, scene, 3154, &R2_GLOBALS._player, &scene->_actor3, NULL); + return true; + case R2_40: + if ((R2_INVENTORY.getObjectScene(47) != 3150) && (R2_GLOBALS.getFlag(75))) { + R2_GLOBALS._player.disableControl(); + scene->_actor3.postInit(); + scene->_actor3._effect = 3; + scene->_actor3._shade = 5; + scene->_sceneMode = 3155; + scene->setAction(&scene->_sequenceManager, scene, 3155, &R2_GLOBALS._player, &scene->_actor3, NULL); + } else { + SceneItem::display(3150, 42, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + } + return true; + default: + return SceneHotspot::startAction(action, event); + break; + } +} + +bool Scene3150::Item6::startAction(CursorType action, Event &event) { + Scene3150 *scene = (Scene3150 *)R2_GLOBALS._sceneManager._scene; + + switch (action) { + case R2_41: + R2_GLOBALS._player.disableControl(); + scene->_actor4.postInit(); + scene->_actor4._effect = 6; + scene->_actor4._shade = 3; + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 3158; + scene->setAction(&scene->_sequenceManager, scene, 3158, &R2_GLOBALS._player, &scene->_actor4, NULL); + return true; + case R2_42: + if ((R2_INVENTORY.getObjectScene(47) != 3150) && (R2_INVENTORY.getObjectScene(40) == 3150) && (R2_GLOBALS.getFlag(75))) { + scene->_actor5.postInit(); + scene->_actor5._effect = 6; + scene->_actor5._shade = 3; + scene->_actor5.setDetails(3150, 30, -1, -1, 2, NULL); + + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 3159; + scene->setAction(&scene->_sequenceManager, scene, 3159, &R2_GLOBALS._player, &scene->_actor5, NULL); + } else { + SceneItem::display(3150, 42, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + } + default: + return SceneHotspot::startAction(action, event); + break; + } +} + +bool Scene3150::Actor4::startAction(CursorType action, Event &event) { + Scene3150 *scene = (Scene3150 *)R2_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + if (R2_GLOBALS.getFlag(75)) + return SceneActor::startAction(action, event); + + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 3151; + scene->setAction(&scene->_sequenceManager, scene, 3151, &R2_GLOBALS._player, &scene->_actor4, NULL); + return true; + case R2_42: + return false; + default: + return SceneActor::startAction(action, event); + break; + } +} + +bool Scene3150::Actor5::startAction(CursorType action, Event &event) { + Scene3150 *scene = (Scene3150 *)R2_GLOBALS._sceneManager._scene; + + if ((action != CURSOR_USE) || (R2_GLOBALS.getFlag(77))) + return SceneActor::startAction(action ,event); + + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 3157; + scene->setAction(&scene->_sequenceManager, scene, 3157, &R2_GLOBALS._player, &scene->_actor5, NULL); + return true; +} + +bool Scene3150::Actor6::startAction(CursorType action, Event &event) { + Scene3150 *scene = (Scene3150 *)R2_GLOBALS._sceneManager._scene; + + if (action == CURSOR_USE) { + if (R2_GLOBALS.getFlag(75)) { + if (R2_GLOBALS.getFlag(77)) { + R2_GLOBALS._player.disableControl(); + if (R2_GLOBALS.getFlag(76)) { + scene->_sceneMode = 3152; + scene->setAction(&scene->_sequenceManager, scene, 3152, &R2_GLOBALS._player, NULL); + } else { + scene->_sceneMode = 3153; + scene->setAction(&scene->_sequenceManager, scene, 3152, &R2_GLOBALS._player, &scene->_actor4, NULL); + } + } else { + SceneItem::display(3150, 42, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + } + } else { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 3152; + scene->setAction(&scene->_sequenceManager, scene, 3152, &R2_GLOBALS._player, NULL); + } + return true; + } else { + return SceneActor::startAction(action, event); + } +} + +bool Scene3150::Actor7::startAction(CursorType action, Event &event) { + Scene3150 *scene = (Scene3150 *)R2_GLOBALS._sceneManager._scene; + + if ((action == R2_43) && (!R2_GLOBALS.getFlag(80))) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 3160; + scene->setAction(&scene->_sequenceManager, scene, 3160, &R2_GLOBALS._player, &scene->_actor7, NULL); + return true; + } + + return SceneActor::startAction(action, event); +} + +void Scene3150::Exit1::changeScene() { + Scene3150 *scene = (Scene3150 *)R2_GLOBALS._sceneManager._scene; + + _enabled = false; + g_globals->_events.setCursor(CURSOR_ARROW); + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 11; + + Common::Point pt(-20, 180); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); +} + +void Scene3150::Exit2::changeScene() { + Scene3150 *scene = (Scene3150 *)R2_GLOBALS._sceneManager._scene; + + _enabled = false; + g_globals->_events.setCursor(CURSOR_ARROW); + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 12; + + scene->setAction(&scene->_sequenceManager, scene, 3163, &R2_GLOBALS._player, NULL); +} + +void Scene3150::postInit(SceneObjectList *OwnerList) { + loadScene(3150); + if (R2_GLOBALS._sceneManager._previousScene == -1) { + R2_INVENTORY.setObjectScene(35, 2000); + R2_GLOBALS._player._oldCharacterScene[1] = 3100; + R2_GLOBALS._player._oldCharacterScene[3] = 0; + R2_GLOBALS._player._characterIndex = R2_MIRANDA; + } + SceneExt::postInit(); + + if (R2_GLOBALS.getFlag(78)) { + _exit1.setDetails(Rect(0, 135, 60, 168), EXITCURSOR_SW, 3275); + _exit1.setDest(Common::Point(70, 125)); + } + + if (R2_GLOBALS.getFlag(80)) { + _exit2.setDetails(Rect(249, 36, 279, 60), EXITCURSOR_NE, 3150); + _exit2.setDest(Common::Point(241, 106)); + } + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.disableControl(); + + _actor2.postInit(); + _actor2.setPosition(Common::Point(64, 139)); + if (R2_GLOBALS.getFlag(78)) { + _actor2.setup(3151, 1, 5); + _actor2.fixPriority(125); + } else { + _actor2.setup(3151, 1, 1); + _actor2.setDetails(3150, 8, -1, 9, 1, NULL); + } + + if (R2_GLOBALS.getFlag(78)) { + _actor1.postInit(); + _actor1.setup(3154, 1, 16); + _actor1.setPosition(Common::Point(104, 129)); + _actor1._effect = 6; + _actor1._shade = 3; + _actor1.setDetails(3150, 24, -1, -1, -1, NULL); + } + + _actor7.postInit(); + _actor7.setup(3154, 5, 1); + if (R2_GLOBALS.getFlag(80)) + _actor7.setPosition(Common::Point(264, 108)); + else + _actor7.setPosition(Common::Point(264, 58)); + _actor7.fixPriority(50); + _actor7.setDetails(3150, 17, -1, 19, 1, NULL); + + if (R2_INVENTORY.getObjectScene(41) == 3150) { + _actor4.postInit(); + if (R2_GLOBALS.getFlag(75)) { + if (R2_GLOBALS.getFlag(76)) { + R2_GLOBALS._walkRegions.enableRegion(1); + R2_GLOBALS._walkRegions.enableRegion(4); + R2_GLOBALS._walkRegions.enableRegion(5); + R2_GLOBALS._walkRegions.enableRegion(6); + _actor4.setup(3152, 4, 10); + _actor4.setDetails(3150, 14, -1, -1, 1, NULL); + } else { + _actor4.setup(3152, 7, 4); + _actor4.setDetails(3150, 13, -1, -1, 1, NULL); + } + _actor4.fixPriority(110); + _actor4.setPosition(Common::Point(83, 88)); + _actor4._effect = 6; + _actor4._shade = 3; + } else { + _actor4.setup(3152, 7, 3); + _actor4.setPosition(Common::Point(143, 70)); + _actor4.setDetails(3150, 15, -1, -1, 1, NULL); + } + } + + if (R2_INVENTORY.getObjectScene(47) == 3150) { + _actor3.postInit(); + _actor3.setup(3152, 7, 1); + _actor3.setPosition(Common::Point(73, 83)); + } + + if (R2_INVENTORY.getObjectScene(40) == 3150) { + _actor3.postInit(); + _actor3.setup(3152, 7, 3); + _actor3.setPosition(Common::Point(70, 55)); + _actor3.fixPriority(111); + _actor3._effect = 6; + _actor3._shade = 5; + } + + if (R2_INVENTORY.getObjectScene(42) == 3150) { + _actor5.postInit(); + if (R2_GLOBALS.getFlag(77)) { + _actor5.setup(3152, 7, 8); + _actor5.setPosition(Common::Point(82, 92)); + _actor5.fixPriority(111); + _actor5._effect = 6; + _actor5._shade = 3; + } else { + _actor5.setup(3152, 7, 7); + _actor5.setPosition(Common::Point(155, 79)); + } + _actor5.setDetails(3150, 30, -1, -1, 2, NULL); + } + + _actor6.postInit(); + _actor6.setup(3152, 7, 6); + _actor6.setPosition(Common::Point(98, 73)); + _actor6.setDetails(3150, 43, -1, -1, 1, NULL); + + _item2.setDetails(12, 3150, 10, -1, 12); + _item3.setDetails(Rect(186, 17, 210, 36), 3150, 6, -1, -1, 1, NULL); + _item4.setDetails(Rect(61, 21, 92, 41), 3150, 7, -1, -1, 1, NULL); + _item5.setDetails(Rect(63, 48, 78, 58), 3150, 6, -1, -1, 1, NULL); + _item6.setDetails(Rect(63, 81, 100, 95), 3150, 3, 4, -1, 1, NULL); + _item1.setDetails(Rect(0, 0, 200, 320), 3150, 0, 1, 2, 1, NULL); + + switch (R2_GLOBALS._player._oldCharacterScene[3]) { + case 0: + _sceneMode = 3150; + _actor1.postInit(); + _actor1._effect = 6; + _actor1._shade = 5; + setAction(&_sequenceManager, this, 3150, &R2_GLOBALS._player, &_actor1, &_actor2, NULL); + break; + case 1200: + _sceneMode = 3162; + setAction(&_sequenceManager, this, 3162, &R2_GLOBALS._player, NULL); + break; + case 3275: { + _sceneMode = 10; + R2_GLOBALS._player.setup(30, 3, 1); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player.setPosition(Common::Point(-20, 180)); + R2_GLOBALS._player._moveDiff = Common::Point(3, 2); + + Common::Point pt(80, 125); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + break; + } + default: + if ((R2_GLOBALS._v56AA0 == 1) && (R2_INVENTORY.getObjectScene(35) == 2000) && (R2_GLOBALS._player._oldCharacterScene[1] == 3100)) { + ++R2_GLOBALS._v56AA0; + _sceneMode = 3156; + _actor1.postInit(); + _actor1._effect = 6; + _actor1._shade = 3; + + _actor2.postInit(); + _actor5.postInit(); + _actor5._effect = 6; + _actor5._shade = 3; + + setAction(&_sequenceManager, this, 3156, &R2_GLOBALS._player, &_actor1, &_actor2, &_actor5, NULL); + } else { + if (R2_GLOBALS._v56AA0 != 2) + ++R2_GLOBALS._v56AA0; + + R2_GLOBALS._player.setup(30, 3, 1); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player.setPosition(Common::Point(155, 120)); + R2_GLOBALS._player._moveDiff = Common::Point(3, 2); + R2_GLOBALS._player.enableControl(); + } + } + + R2_GLOBALS._player._oldCharacterScene[3] = 3150; +} + +void Scene3150::signal() { + switch (_sceneMode) { + case 11: + R2_GLOBALS._sceneManager.changeScene(3275); + break; + case 12: + R2_GLOBALS._sceneManager.changeScene(1200); + break; + case 3151: + _actor1.remove(); + R2_INVENTORY.setObjectScene(41, 3); + R2_GLOBALS._player.enableControl(); + break; + case 3153: + R2_GLOBALS.setFlag(76); + _actor4.setDetails(3150, 14, -1, -1, 3, NULL); + _actor1.postInit(); + _actor1.setDetails(3150, 24, -1, -1, 2, NULL); + _sceneMode = 3161; + setAction(&_sequenceManager, this, 3161, &_actor1, &_actor2, NULL); + break; + case 3154: + _actor3.remove(); + R2_INVENTORY.setObjectScene(47, 3); + R2_GLOBALS._player.enableControl(); + break; + case 3155: + R2_INVENTORY.setObjectScene(40, 3150); + R2_GLOBALS._player.enableControl(); + break; + case 3156: + _actor5.setDetails(3150, 30, -1, -1, 2, NULL); + R2_INVENTORY.setObjectScene(42, 3150); + R2_GLOBALS._player.enableControl(); + break; + case 3157: + _actor5.remove(); + R2_INVENTORY.setObjectScene(42, 3); + R2_GLOBALS._player.enableControl(); + break; + case 3158: + R2_GLOBALS.setFlag(75); + R2_INVENTORY.setObjectScene(41, 3150); + _actor4.fixPriority(110); + _actor4.setDetails(3150, 13, -1, -1, 2, NULL); + R2_GLOBALS._player.enableControl(); + break; + case 3159: + R2_GLOBALS.setFlag(77); + R2_INVENTORY.setObjectScene(42, 3150); + R2_GLOBALS._player.enableControl(); + break; + case 3160: + R2_INVENTORY.setObjectScene(52, 3150); + R2_GLOBALS.setFlag(80); + R2_GLOBALS._sceneManager.changeScene(1200); + break; + case 3161: + R2_GLOBALS._sceneItems.remove(&_actor2); + _exit1.setDetails(Rect(0, 135, 60, 168), EXITCURSOR_SW, 3275); + _exit1.setDest(Common::Point(70, 125)); + R2_GLOBALS._walkRegions.enableRegion(1); + R2_GLOBALS._walkRegions.enableRegion(4); + R2_GLOBALS._walkRegions.enableRegion(5); + R2_GLOBALS._walkRegions.enableRegion(6); + R2_GLOBALS.setFlag(78); + R2_GLOBALS._player.enableControl(); + break; + default: + R2_GLOBALS._player.enableControl(); + break; + } +} + +void Scene3150::dispatch() { + if (_actor5._position.x == 155) { + _actor5._effect = 0; + _actor5._shade = 0; + } + + if (_actor1._visage == 3154) { + _actor1._effect = 0; + _actor1._shade = 0; + } + + 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 b135ddc0a3..cdbf4359b0 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.h +++ b/engines/tsage/ringworld2/ringworld2_scenes3.h @@ -105,6 +105,60 @@ public: virtual void dispatch(); virtual void synchronize(Serializer &s); }; + +class Scene3150 : public SceneExt { + class Item5 : public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Item6 : public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Actor4 : public SceneActor { + virtual bool startAction(CursorType action, Event &event); + }; + class Actor5 : public SceneActor { + virtual bool startAction(CursorType action, Event &event); + }; + class Actor6 : public SceneActor { + virtual bool startAction(CursorType action, Event &event); + }; + class Actor7 : public SceneActor { + virtual bool startAction(CursorType action, Event &event); + }; + + class Exit1 : public SceneExit { + public: + virtual void changeScene(); + }; + class Exit2 : public SceneExit { + public: + virtual void changeScene(); + }; +public: + + NamedHotspot _item1; + NamedHotspot _item2; + NamedHotspot _item3; + NamedHotspot _item4; + Item5 _item5; + Item6 _item6; + SceneActor _actor1; + SceneActor _actor2; + SceneActor _actor3; + Actor4 _actor4; + Actor5 _actor5; + Actor6 _actor6; + Actor7 _actor7; + Exit1 _exit1; + Exit2 _exit2; + SequenceManager _sequenceManager; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); + virtual void dispatch(); +}; } // End of namespace Ringworld2 } // End of namespace TsAGE -- cgit v1.2.3 From 53929044a66005031658657f5ede8931979f9104 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 21 Dec 2011 22:42:16 +0100 Subject: TSAGE: R2R - Implement scene 3175 --- engines/tsage/ringworld2/ringworld2_logic.cpp | 2 + engines/tsage/ringworld2/ringworld2_scenes3.cpp | 130 ++++++++++++++++++++++++ engines/tsage/ringworld2/ringworld2_scenes3.h | 26 +++++ 3 files changed, 158 insertions(+) (limited to 'engines') diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index 0248a3c32d..d84e4eb6e0 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -181,6 +181,8 @@ Scene *Ringworld2Game::createScene(int sceneNumber) { // Jail return new Scene3150(); case 3175: + // Autopsy room + return new Scene3175(); case 3200: case 3210: case 3220: diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp index 2c2530f833..cdb4bee493 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp @@ -793,5 +793,135 @@ void Scene3150::dispatch() { Scene::dispatch(); } +/*-------------------------------------------------------------------------- + * Scene 3175 - Autopsy room + * + *--------------------------------------------------------------------------*/ +bool Scene3175::Item1::startAction(CursorType action, Event &event) { + Scene3175 *scene = (Scene3175 *)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; + } + warning("scene->display() called with two parameters"); + return scene->display(action); +} + +bool Scene3175::Actor3::startAction(CursorType action, Event &event) { + Scene3175 *scene = (Scene3175 *)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; + } + warning("scene->display() called with two parameters"); + return scene->display(action); +} + +bool Scene3175::Actor1::startAction(CursorType action, Event &event) { + Scene3175 *scene = (Scene3175 *)R2_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 3176; + scene->setAction(&scene->_sequenceManager, scene, 3176, &R2_GLOBALS._player, &scene->_actor1, NULL); + return true; + break; + case CURSOR_LOOK: + SceneItem::display(3175, 9, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + return true; + break; + case CURSOR_TALK: + SceneItem::display(3175, 10, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + return true; + break; + default: + return SceneActor::startAction(action, event); + break; + } +} + +void Scene3175::postInit(SceneObjectList *OwnerList) { + loadScene(3175); + SceneExt::postInit(); + + _actor1.postInit(); + _actor1.setup(3175, 1, 1); + _actor1.setPosition(Common::Point(35, 72)); + _actor1.setDetails(3175, 9, 10, -1, 1, NULL); + + _actor2.postInit(); + _actor2.setup(3175, 2, 1); + _actor2.setPosition(Common::Point(87, 148)); + + _actor3.postInit(); + _actor3.setup(3175, 3, 1); + _actor3.setPosition(Common::Point(199, 117)); + _actor3.setDetails(3175, 15, 16, 17, 1, NULL); + + _item2.setDetails(12, 3175, 3, 1, 5); + _item3.setDetails(11, 3175, 6, 7, 8); + _item1.setDetails(Rect(0, 0, 320, 200), 3175, 0, 1, 2, 1, NULL); + + R2_GLOBALS._player.postInit(); + + if (R2_GLOBALS._player._oldCharacterScene[3] == 3250) { + R2_GLOBALS._player.setup(30, 5, 1); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player.setPosition(Common::Point(126, 77)); + R2_GLOBALS._player.enableControl(); + } else { + _sceneMode = 3175; + setAction(&_sequenceManager, this, 3175, &R2_GLOBALS._player, &_actor1, NULL); + } + + R2_GLOBALS._player._oldCharacterScene[3] = 3175; +} + +void Scene3175::signal() { + if (_sceneMode == 3176) + R2_GLOBALS._sceneManager.changeScene(3250); + else + R2_GLOBALS._player.enableControl(); +} + } // 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 cdbf4359b0..67c430cdfd 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.h +++ b/engines/tsage/ringworld2/ringworld2_scenes3.h @@ -159,6 +159,32 @@ public: virtual void signal(); virtual void dispatch(); }; + +class Scene3175 : public SceneExt { + class Item1 : public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + class Actor3 : public SceneActor { + virtual bool startAction(CursorType action, Event &event); + }; + class Actor1 : public Actor3 { + virtual bool startAction(CursorType action, Event &event); + }; +public: + + Item1 _item1; + Item1 _item2; + Item1 _item3; + Actor1 _actor1; + SceneActor _actor2; + Actor3 _actor3; + SequenceManager _sequenceManager; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); +}; } // End of namespace Ringworld2 } // End of namespace TsAGE -- cgit v1.2.3 From d49ffde8eae1fd311e4c0f800e9a5bad57381204 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 22 Dec 2011 00:30:49 +0100 Subject: TSAGE: R2R - Implement scene 3200 --- engines/tsage/ringworld2/ringworld2_logic.cpp | 2 + engines/tsage/ringworld2/ringworld2_scenes3.cpp | 28 ++++++ engines/tsage/ringworld2/ringworld2_scenes3.h | 14 +++ engines/tsage/ringworld2/ringworld2_speakers.cpp | 106 +++++++++++++++++++++++ engines/tsage/ringworld2/ringworld2_speakers.h | 25 ++++++ 5 files changed, 175 insertions(+) (limited to 'engines') diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index d84e4eb6e0..386d09f6db 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -184,6 +184,8 @@ Scene *Ringworld2Game::createScene(int sceneNumber) { // Autopsy room return new Scene3175(); case 3200: + // Cutscene : Guard discussion + return new Scene3200(); case 3210: case 3220: case 3230: diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp index cdb4bee493..c73cb8547e 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp @@ -923,5 +923,33 @@ void Scene3175::signal() { R2_GLOBALS._player.enableControl(); } +/*-------------------------------------------------------------------------- + * Scene 3200 - Cutscene : Guard discussion + * + *--------------------------------------------------------------------------*/ +void Scene3200::postInit(SceneObjectList *OwnerList) { + loadScene(3200); + R2_GLOBALS._v58CE2 = 0; + SceneExt::postInit(); + + _stripManager.addSpeaker(&_rockoSpeaker); + _stripManager.addSpeaker(&_jockoSpeaker); + _stripManager.addSpeaker(&_sockoSpeaker); + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.hide(); + R2_GLOBALS._player.disableControl(); + + _actor1.postInit(); + _actor3.postInit(); + _actor2.postInit(); + + setAction(&_sequenceManager, this, 3200 + R2_GLOBALS._randomSource.getRandomNumber(1), &_actor1, &_actor2, &_actor3, NULL); +} + +void Scene3200::signal() { + R2_GLOBALS._sceneManager.changeScene(1200); +} + } // 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 67c430cdfd..58ba4cc590 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.h +++ b/engines/tsage/ringworld2/ringworld2_scenes3.h @@ -185,6 +185,20 @@ public: virtual void postInit(SceneObjectList *OwnerList = NULL); virtual void signal(); }; + +class Scene3200 : public SceneExt { +public: + SpeakerRocko3200 _rockoSpeaker; + SpeakerJocko3200 _jockoSpeaker; + SpeakerSocko3200 _sockoSpeaker; + SceneActor _actor1; + SceneActor _actor2; + SceneActor _actor3; + SequenceManager _sequenceManager; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); +}; } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_speakers.cpp b/engines/tsage/ringworld2/ringworld2_speakers.cpp index 3ec1df41d0..b3a15a84d3 100644 --- a/engines/tsage/ringworld2/ringworld2_speakers.cpp +++ b/engines/tsage/ringworld2/ringworld2_speakers.cpp @@ -27,6 +27,7 @@ #include "tsage/staticres.h" #include "tsage/ringworld2/ringworld2_scenes0.h" #include "tsage/ringworld2/ringworld2_scenes2.h" +#include "tsage/ringworld2/ringworld2_scenes3.h" namespace TsAGE { @@ -1052,5 +1053,110 @@ SpeakerGuard3100::SpeakerGuard3100() { _numFrames = 0; } +SpeakerRocko3200::SpeakerRocko3200() { + _speakerName = "Rocko"; + _color1 = 5; + _color2 = 0; + _fieldF6 = 0; + _textWidth = 300; + _hideObjects = false; + _object2 = NULL; + _displayMode = 1; + _numFrames = 0; +} + +void SpeakerRocko3200::proc15() { + int v = _fieldF6; + Scene3200 *scene = (Scene3200 *)R2_GLOBALS._sceneManager._scene; + + if (!_object2) { + _object2 = &scene->_actor1; + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + if (v == 0) { + _object1.animate(ANIM_MODE_2, NULL); + } else { + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4060, (_object2->_strip * 2) - 1, 1); + _object1.animate(ANIM_MODE_5, this); + } +} + +SpeakerJocko3200::SpeakerJocko3200() { + _speakerName = "Jocko"; + _color1 = 45; + _color2 = 0; + _fieldF6 = 0; + _textWidth = 300; + _hideObjects = false; + _object2 = NULL; + _displayMode = 1; + _numFrames = 0; +} + +void SpeakerJocko3200::proc15() { + int v = _fieldF6; + Scene3200 *scene = (Scene3200 *)R2_GLOBALS._sceneManager._scene; + + if (!_object2) { + _object2 = &scene->_actor2; + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + if (v == 0) { + _object1.animate(ANIM_MODE_2, NULL); + } else { + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4060, (_object2->_strip * 2) - 1, 1); + _object1.animate(ANIM_MODE_5, this); + } +} + +SpeakerSocko3200::SpeakerSocko3200() { + _speakerName = "Socko"; + _color1 = 10; + _color2 = 0; + _fieldF6 = 0; + _textWidth = 300; + _hideObjects = false; + _object2 = NULL; + _displayMode = 1; + _numFrames = 0; +} + +void SpeakerSocko3200::proc15() { + int v = _fieldF6; + Scene3200 *scene = (Scene3200 *)R2_GLOBALS._sceneManager._scene; + + if (!_object2) { + _object2 = &scene->_actor3; + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + if (v == 0) { + _object1.animate(ANIM_MODE_2, NULL); + } else { + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4060, (_object2->_strip * 2) - 1, 1); + _object1.animate(ANIM_MODE_5, this); + } +} + } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_speakers.h b/engines/tsage/ringworld2/ringworld2_speakers.h index 1d99a54e7c..38a097bc61 100644 --- a/engines/tsage/ringworld2/ringworld2_speakers.h +++ b/engines/tsage/ringworld2/ringworld2_speakers.h @@ -268,6 +268,31 @@ public: virtual Common::String getClassName() { return "SpeakerGuard3100"; } }; + +class SpeakerRocko3200 : public VisualSpeaker { +public: + SpeakerRocko3200(); + + virtual Common::String getClassName() { return "SpeakerRocko3200"; } + virtual void proc15(); +}; + +class SpeakerJocko3200 : public VisualSpeaker { +public: + SpeakerJocko3200(); + + virtual Common::String getClassName() { return "SpeakerJocko3200"; } + virtual void proc15(); +}; + +class SpeakerSocko3200 : public VisualSpeaker { +public: + SpeakerSocko3200(); + + virtual Common::String getClassName() { return "SpeakerSocko3200"; } + virtual void proc15(); +}; + } // End of namespace Ringworld2 } // End of namespace TsAGE -- cgit v1.2.3 From c40df9a6edc320ad2f3c8187e4b0c2d1eb9c6aa8 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 22 Dec 2011 00:33:18 +0100 Subject: TSAGE: Work around a data issue in R2R. The character name doesn't seem case sensitive in R2R --- engines/tsage/converse.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'engines') diff --git a/engines/tsage/converse.cpp b/engines/tsage/converse.cpp index 00c0b3a1f1..1542b0a8e3 100644 --- a/engines/tsage/converse.cpp +++ b/engines/tsage/converse.cpp @@ -888,6 +888,17 @@ Speaker *StripManager::getSpeaker(const char *speakerName) { return _speakerList[idx]; } + // TODO: Check if it necessary to make a strcmp first. + // + // If nothing is found, recheck and ignore the case as + // in R2R, some character names aren't in uppercase. + if (g_vm->getGameID() == GType_Ringworld2) { + for (uint idx = 0; idx < _speakerList.size(); ++idx) { + if (!scumm_stricmp(_speakerList[idx]->_speakerName.c_str(), speakerName)) + return _speakerList[idx]; + } + } + return NULL; } -- cgit v1.2.3 From 877b6e9b1d5ca0cb47e1845c57cc7340b924a5eb Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 22 Dec 2011 07:44:58 +0100 Subject: TSAGE: R2R - Implement scene 3210 --- engines/tsage/ringworld2/ringworld2_logic.cpp | 4 +- engines/tsage/ringworld2/ringworld2_scenes3.cpp | 27 ++++++++- engines/tsage/ringworld2/ringworld2_scenes3.h | 12 ++++ engines/tsage/ringworld2/ringworld2_speakers.cpp | 70 ++++++++++++++++++++++++ engines/tsage/ringworld2/ringworld2_speakers.h | 16 ++++++ 5 files changed, 127 insertions(+), 2 deletions(-) (limited to 'engines') diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index 386d09f6db..0844a48ed8 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -184,9 +184,11 @@ Scene *Ringworld2Game::createScene(int sceneNumber) { // Autopsy room return new Scene3175(); case 3200: - // Cutscene : Guard discussion + // Cutscene : Cutscene : Rocko & co - Discussion return new Scene3200(); case 3210: + // Cutscene : Captain and Private - Discussion + return new Scene3210(); case 3220: case 3230: case 3240: diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp index c73cb8547e..8ea83a2527 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp @@ -924,7 +924,7 @@ void Scene3175::signal() { } /*-------------------------------------------------------------------------- - * Scene 3200 - Cutscene : Guard discussion + * Scene 3200 - Cutscene : Rocko & co - Discussion * *--------------------------------------------------------------------------*/ void Scene3200::postInit(SceneObjectList *OwnerList) { @@ -951,5 +951,30 @@ void Scene3200::signal() { R2_GLOBALS._sceneManager.changeScene(1200); } +/*-------------------------------------------------------------------------- + * Scene 3210 - Cutscene : Captain and Private - Discussion + * + *--------------------------------------------------------------------------*/ +void Scene3210::postInit(SceneObjectList *OwnerList) { + loadScene(3210); + R2_GLOBALS._v58CE2 = 0; + SceneExt::postInit(); + + _stripManager.addSpeaker(&_privateSpeaker); + _stripManager.addSpeaker(&_captainSpeaker); + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.hide(); + R2_GLOBALS._player.disableControl(); + + _actor1.postInit(); + _actor2.postInit(); + + setAction(&_sequenceManager, this, 3210 + R2_GLOBALS._randomSource.getRandomNumber(1), &_actor1, &_actor2, NULL); +} + +void Scene3210::signal() { + R2_GLOBALS._sceneManager.changeScene(1200); +} } // 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 58ba4cc590..fbb6392be4 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.h +++ b/engines/tsage/ringworld2/ringworld2_scenes3.h @@ -199,6 +199,18 @@ public: virtual void postInit(SceneObjectList *OwnerList = NULL); virtual void signal(); }; + +class Scene3210 : public SceneExt { +public: + SpeakerCaptain3210 _captainSpeaker; + SpeakerPrivate3210 _privateSpeaker; + SceneActor _actor1; + SceneActor _actor2; + SequenceManager _sequenceManager; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); +}; } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_speakers.cpp b/engines/tsage/ringworld2/ringworld2_speakers.cpp index b3a15a84d3..80ac04c403 100644 --- a/engines/tsage/ringworld2/ringworld2_speakers.cpp +++ b/engines/tsage/ringworld2/ringworld2_speakers.cpp @@ -1158,5 +1158,75 @@ void SpeakerSocko3200::proc15() { } } +SpeakerCaptain3210::SpeakerCaptain3210() { + _speakerName = "Captain"; + _color1 = 5; + _color2 = 0; + _fieldF6 = 0; + _textWidth = 300; + _hideObjects = false; + _object2 = NULL; + _displayMode = 1; + _numFrames = 0; +} + +void SpeakerCaptain3210::proc15() { + int v = _fieldF6; + Scene3210 *scene = (Scene3210 *)R2_GLOBALS._sceneManager._scene; + + if (!_object2) { + _object2 = &scene->_actor1; + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + if (v == 0) { + _object1.animate(ANIM_MODE_2, NULL); + } else { + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4060, (_object2->_strip * 2) - 1, 1); + _object1.animate(ANIM_MODE_5, this); + } +} + +SpeakerPrivate3210::SpeakerPrivate3210() { + _speakerName = "Private"; + _color1 = 45; + _color2 = 0; + _fieldF6 = 0; + _textWidth = 300; + _hideObjects = false; + _object2 = NULL; + _displayMode = 1; + _numFrames = 0; +} + +void SpeakerPrivate3210::proc15() { + int v = _fieldF6; + Scene3210 *scene = (Scene3210 *)R2_GLOBALS._sceneManager._scene; + + if (!_object2) { + _object2 = &scene->_actor2; + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + if (v == 0) { + _object1.animate(ANIM_MODE_2, NULL); + } else { + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4060, (_object2->_strip * 2) - 1, 1); + _object1.animate(ANIM_MODE_5, this); + } +} + } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_speakers.h b/engines/tsage/ringworld2/ringworld2_speakers.h index 38a097bc61..66edd67276 100644 --- a/engines/tsage/ringworld2/ringworld2_speakers.h +++ b/engines/tsage/ringworld2/ringworld2_speakers.h @@ -293,6 +293,22 @@ public: virtual void proc15(); }; +class SpeakerCaptain3210 : public VisualSpeaker { +public: + SpeakerCaptain3210(); + + virtual Common::String getClassName() { return "SpeakerCaptain3210"; } + virtual void proc15(); +}; + +class SpeakerPrivate3210 : public VisualSpeaker { +public: + SpeakerPrivate3210(); + + virtual Common::String getClassName() { return "SpeakerPrivate3210"; } + virtual void proc15(); +}; + } // End of namespace Ringworld2 } // End of namespace TsAGE -- cgit v1.2.3 From 0319cd06ef8e20486a3c7aa69a84bd39e8a71683 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 22 Dec 2011 19:30:47 +1100 Subject: CGE: Added explicit 'PACKED_STRUCT' macro to the HideDesc structure --- engines/cge/bitmap.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/cge/bitmap.h b/engines/cge/bitmap.h index e7179f3b0b..3de05ac2fd 100644 --- a/engines/cge/bitmap.h +++ b/engines/cge/bitmap.h @@ -49,7 +49,7 @@ enum { struct HideDesc { uint16 _skip; uint16 _hide; -}; +} PACKED_STRUCT; #include "common/pack-end.h" -- cgit v1.2.3 From b5e53281846e455ebd3f4a7bf40d1fffc6afeafe Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 22 Dec 2011 21:12:08 +1100 Subject: TSAGE: Implement R2R 2 parameter versions of Player disableControl and enableControl --- engines/tsage/core.cpp | 17 +++++++++++++++-- engines/tsage/core.h | 3 ++- 2 files changed, 17 insertions(+), 3 deletions(-) (limited to 'engines') diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp index c243624608..6c015ab45f 100644 --- a/engines/tsage/core.cpp +++ b/engines/tsage/core.cpp @@ -3073,9 +3073,22 @@ void Player::enableControl() { } } -void Player::enableControl(CursorType cursor) { +void Player::disableControl(CursorType cursorId, CursorType objectId) { + if (cursorId != -1) + R2_GLOBALS._events.setCursor(cursorId); + else if (objectId != CURSOR_NONE) + R2_GLOBALS._events.setCursor(objectId); + + disableControl(); +} + +void Player::enableControl(CursorType cursorId, CursorType objectId) { enableControl(); - R2_GLOBALS._events.setCursor(cursor); + + if (cursorId != -1) + R2_GLOBALS._events.setCursor(cursorId); + else if (objectId != CURSOR_NONE) + R2_GLOBALS._events.setCursor(objectId); } void Player::process(Event &event) { diff --git a/engines/tsage/core.h b/engines/tsage/core.h index 060ffee121..e887be050b 100644 --- a/engines/tsage/core.h +++ b/engines/tsage/core.h @@ -646,7 +646,8 @@ public: void disableControl(); void enableControl(); - void enableControl(CursorType cursor); + void disableControl(CursorType cursorId, CursorType objectId); + void enableControl(CursorType cursorId, CursorType objectId = CURSOR_NONE); }; /*--------------------------------------------------------------------------*/ -- cgit v1.2.3 From a4934fe05a50ccdbffd5171d08b7e600572da5a7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 22 Dec 2011 21:55:46 +1100 Subject: TSAGE: Moved look/use/talk descriptions to SceneItem class, and implemented R2R SceneExt::display --- engines/tsage/blue_force/blueforce_logic.h | 2 - engines/tsage/core.cpp | 102 +++++++++++++++++++----- engines/tsage/core.h | 6 ++ engines/tsage/events.h | 1 + engines/tsage/ringworld/ringworld_logic.h | 1 - engines/tsage/ringworld2/ringworld2_logic.cpp | 99 ++++++++--------------- engines/tsage/ringworld2/ringworld2_logic.h | 7 +- engines/tsage/ringworld2/ringworld2_scenes3.cpp | 9 +-- 8 files changed, 130 insertions(+), 97 deletions(-) (limited to 'engines') diff --git a/engines/tsage/blue_force/blueforce_logic.h b/engines/tsage/blue_force/blueforce_logic.h index f5a3938f2b..65cea8efae 100644 --- a/engines/tsage/blue_force/blueforce_logic.h +++ b/engines/tsage/blue_force/blueforce_logic.h @@ -338,10 +338,8 @@ public: class NamedHotspot : public SceneHotspot { public: - int _resNum, _lookLineNum, _useLineNum, _talkLineNum; NamedHotspot(); - virtual bool startAction(CursorType action, Event &event); virtual Common::String getClassName() { return "NamedHotspot"; } virtual void synchronize(Serializer &s); diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp index 6c015ab45f..a32f445194 100644 --- a/engines/tsage/core.cpp +++ b/engines/tsage/core.cpp @@ -34,6 +34,7 @@ #include "tsage/globals.h" #include "tsage/sound.h" #include "tsage/blue_force/blueforce_logic.h" +#include "tsage/ringworld2/ringworld2_logic.h" namespace TsAGE { @@ -1511,6 +1512,14 @@ void SceneItem::synchronize(Serializer &s) { s.syncAsSint16LE(_position.x); s.syncAsSint32LE(_position.y); s.syncAsSint16LE(_yDiff); s.syncAsSint32LE(_sceneRegionId); + + if (g_vm->getGameID() == GType_Ringworld2) { + // In R2R, the following fields were moved into the SceneItem class + s.syncAsSint16LE(_resNum); + s.syncAsSint16LE(_lookLineNum); + s.syncAsSint16LE(_useLineNum); + s.syncAsSint16LE(_talkLineNum); + } } void SceneItem::remove() { @@ -1533,25 +1542,30 @@ bool SceneItem::startAction(CursorType action, Event &event) { void SceneItem::doAction(int action) { const char *msg = NULL; - switch ((int)action) { - case CURSOR_LOOK: - msg = LOOK_SCENE_HOTSPOT; - break; - case CURSOR_USE: - msg = USE_SCENE_HOTSPOT; - break; - case CURSOR_TALK: - msg = TALK_SCENE_HOTSPOT; - break; - case 0x1000: - msg = SPECIAL_SCENE_HOTSPOT; - break; - default: - msg = DEFAULT_SCENE_HOTSPOT; - break; - } + if (g_vm->getGameID() == GType_Ringworld2) { + Event dummyEvent; + ((Ringworld2::SceneExt *)GLOBALS._sceneManager._scene)->display((CursorType)action, dummyEvent); + } else { + switch ((int)action) { + case CURSOR_LOOK: + msg = LOOK_SCENE_HOTSPOT; + break; + case CURSOR_USE: + msg = USE_SCENE_HOTSPOT; + break; + case CURSOR_TALK: + msg = TALK_SCENE_HOTSPOT; + break; + case 0x1000: + msg = SPECIAL_SCENE_HOTSPOT; + break; + default: + msg = DEFAULT_SCENE_HOTSPOT; + break; + } - GUIErrorMessage(msg); + GUIErrorMessage(msg); + } } bool SceneItem::contains(const Common::Point &pt) { @@ -1760,6 +1774,58 @@ void SceneItem::display(const Common::String &msg) { SET_EXT_FGCOLOR, 13, LIST_END); } +void SceneItem::setDetails(int ys, int xs, int ye, int xe, const int resnum, const int lookLineNum, const int useLineNum) { + setBounds(ys, xe, ye, xs); + _resNum = resnum; + _lookLineNum = lookLineNum; + _useLineNum = useLineNum; + _talkLineNum = -1; + g_globals->_sceneItems.addItems(this, NULL); +} + +void SceneItem::setDetails(const Rect &bounds, int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode, SceneItem *item) { + setBounds(bounds); + _resNum = resNum; + _lookLineNum = lookLineNum; + _talkLineNum = talkLineNum; + _useLineNum = useLineNum; + + switch (mode) { + case 2: + g_globals->_sceneItems.push_front(this); + break; + case 4: + g_globals->_sceneItems.addBefore(item, this); + break; + case 5: + g_globals->_sceneItems.addAfter(item, this); + break; + default: + g_globals->_sceneItems.push_back(this); + break; + } +} + +void SceneItem::setDetails(int sceneRegionId, int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode) { + _sceneRegionId = sceneRegionId; + _resNum = resNum; + _lookLineNum = lookLineNum; + _talkLineNum = talkLineNum; + _useLineNum = useLineNum; + + // Handle adding hotspot to scene items list as necessary + switch (mode) { + case 2: + GLOBALS._sceneItems.push_front(this); + break; + case 3: + break; + default: + GLOBALS._sceneItems.push_back(this); + break; + } +} + /*--------------------------------------------------------------------------*/ bool SceneHotspot::startAction(CursorType action, Event &event) { diff --git a/engines/tsage/core.h b/engines/tsage/core.h index e887be050b..98efaf9881 100644 --- a/engines/tsage/core.h +++ b/engines/tsage/core.h @@ -412,6 +412,8 @@ public: Common::Point _position; int _yDiff; int _sceneRegionId; + + int _resNum, _lookLineNum, _useLineNum, _talkLineNum; public: SceneItem() : EventHandler() { _msg = "Feature"; _action = NULL; _sceneRegionId = 0; } @@ -428,6 +430,10 @@ public: static void display(int resNum, int lineNum, ...); static void display2(int resNum, int lineNum); static void display(const Common::String &msg); + + virtual void setDetails(int ys, int xs, int ye, int xe, const int resnum, const int lookLineNum, const int useLineNum); + virtual void setDetails(const Rect &bounds, int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode, SceneItem *item); + virtual void setDetails(int sceneRegionId, int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode = 0); }; class SceneItemExt : public SceneItem { diff --git a/engines/tsage/events.h b/engines/tsage/events.h index fe4d3ecde6..dcff1b45b8 100644 --- a/engines/tsage/events.h +++ b/engines/tsage/events.h @@ -95,6 +95,7 @@ enum CursorType { R2_36 = 36, R2_37 = 37, R2_38 = 38, R2_39 = 39, R2_40 = 40, R2_41 = 41, R2_42 = 42, R2_43 = 43, R2_44 = 44, R2_45 = 45, R2_46 = 46, R2_47 = 47, R2_48 = 48, R2_49 = 49, R2_50 = 50, R2_51 = 51, R2_52 = 52, + R2_LAST_INVENT = 53, // Ringworld 2 cursors R2CURSORS_START = 0x8000, EXITCURSOR_N = 0x8007, EXITCURSOR_S = 0x8008, EXITCURSOR_W = 0x8009, diff --git a/engines/tsage/ringworld/ringworld_logic.h b/engines/tsage/ringworld/ringworld_logic.h index 6f6a66cc26..b3f103f293 100644 --- a/engines/tsage/ringworld/ringworld_logic.h +++ b/engines/tsage/ringworld/ringworld_logic.h @@ -161,7 +161,6 @@ public: class NamedHotspot : public SceneHotspot { public: - int _resNum, _lookLineNum, _useLineNum, _talkLineNum; NamedHotspot(); virtual void doAction(int action); diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index 0844a48ed8..470cdab10c 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -303,7 +303,7 @@ void SceneExt::loadScene(int sceneNum) { } } -bool SceneExt::display(CursorType action) { +bool SceneExt::display(CursorType action, Event &event) { switch (action) { case CURSOR_CROSSHAIRS: return false; @@ -316,10 +316,41 @@ bool SceneExt::display(CursorType action) { case CURSOR_TALK: SceneItem::display2(1, R2_GLOBALS._randomSource.getRandomNumber(4) + 10); break; + case R2_NEGATOR_GUN: + if (R2_GLOBALS.getFlag(1)) + SceneItem::display2(2, action); + else + SceneItem::display2(5, 0); + break; + case R2_7: + if ((R2_GLOBALS._v565F1[1] == 2) || ((R2_GLOBALS._v565F1[1] == 1) && + (R2_GLOBALS._v565F1[2] == 2) && (R2_GLOBALS._sceneManager._previousScene == 300))) { + R2_GLOBALS._sound4.stop(); + R2_GLOBALS._sound3.play(46); + SceneItem::display2(5, 15); + } else { + R2_GLOBALS._sound3.play(43, 0); + SceneItem::display2(2, 0); + } + + R2_GLOBALS._sound4.play(45); + break; + case R2_9: + case R2_39: + R2_GLOBALS._sound3.play(44); + SceneItem::display2(2, action); + R2_GLOBALS._sound3.stop(); + break; + case R2_44: + R2_GLOBALS._sound3.play(99); + SceneItem::display2(2, action); + break; default: - return false; + SceneItem::display2(2, action); + break; } + event.handled = true; return true; } @@ -840,68 +871,6 @@ bool NamedHotspot::startAction(CursorType action, Event &event) { } } -void NamedHotspot::setDetails(int ys, int xs, int ye, int xe, const int resnum, const int lookLineNum, const int useLineNum) { - setBounds(ys, xe, ye, xs); - _resNum = resnum; - _lookLineNum = lookLineNum; - _useLineNum = useLineNum; - _talkLineNum = -1; - g_globals->_sceneItems.addItems(this, NULL); -} - -void NamedHotspot::setDetails(const Rect &bounds, int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode, SceneItem *item) { - setBounds(bounds); - _resNum = resNum; - _lookLineNum = lookLineNum; - _talkLineNum = talkLineNum; - _useLineNum = useLineNum; - - switch (mode) { - case 2: - g_globals->_sceneItems.push_front(this); - break; - case 4: - g_globals->_sceneItems.addBefore(item, this); - break; - case 5: - g_globals->_sceneItems.addAfter(item, this); - break; - default: - g_globals->_sceneItems.push_back(this); - break; - } -} - -void NamedHotspot::setDetails(int sceneRegionId, int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode) { - _sceneRegionId = sceneRegionId; - _resNum = resNum; - _lookLineNum = lookLineNum; - _talkLineNum = talkLineNum; - _useLineNum = useLineNum; - - // Handle adding hotspot to scene items list as necessary - switch (mode) { - case 2: - GLOBALS._sceneItems.push_front(this); - break; - case 3: - break; - default: - GLOBALS._sceneItems.push_back(this); - break; - } -} - -void NamedHotspot::synchronize(Serializer &s) { - SceneHotspot::synchronize(s); - s.syncAsSint16LE(_resNum); - s.syncAsSint16LE(_lookLineNum); - s.syncAsSint16LE(_useLineNum); - - if (g_vm->getGameID() == GType_BlueForce) - s.syncAsSint16LE(_talkLineNum); -} - void SceneActor::postInit(SceneObjectList *OwnerList) { _lookLineNum = _talkLineNum = _useLineNum = -1; SceneObject::postInit(); @@ -943,7 +912,7 @@ bool SceneActor::startAction(CursorType action, Event &event) { } if (!handled) - handled = ((SceneExt *)R2_GLOBALS._sceneManager._scene)->display(action); + handled = ((SceneExt *)R2_GLOBALS._sceneManager._scene)->display(action, event); return handled; } diff --git a/engines/tsage/ringworld2/ringworld2_logic.h b/engines/tsage/ringworld2/ringworld2_logic.h index 9eaa1b0cd1..67346bcc80 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.h +++ b/engines/tsage/ringworld2/ringworld2_logic.h @@ -102,7 +102,7 @@ public: virtual void refreshBackground(int xAmount, int yAmount); virtual void saveCharacter(int characterIndex); - bool display(CursorType action); + bool display(CursorType action, Event &event); void fadeOut(); void clearScreen(); }; @@ -233,15 +233,10 @@ public: class NamedHotspot : public SceneHotspot { public: - int _resNum, _lookLineNum, _useLineNum, _talkLineNum; NamedHotspot(); virtual bool startAction(CursorType action, Event &event); virtual Common::String getClassName() { return "NamedHotspot"; } - virtual void synchronize(Serializer &s); - virtual void setDetails(int ys, int xs, int ye, int xe, const int resnum, const int lookLineNum, const int useLineNum); - virtual void setDetails(const Rect &bounds, int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode, SceneItem *item); - virtual void setDetails(int sceneRegionId, int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode = 0); }; class NamedHotspotExt : public NamedHotspot { diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp index 8ea83a2527..5b1e05ebc8 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp @@ -233,8 +233,7 @@ bool Scene3125::Item1::startAction(CursorType action, Event &event) { SceneItem::display(_resNum, _talkLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); break; default: - warning("scene->display() called with two parameters"); - return scene->display(action); + return scene->display(action, event); break; } @@ -822,8 +821,8 @@ bool Scene3175::Item1::startAction(CursorType action, Event &event) { default: break; } - warning("scene->display() called with two parameters"); - return scene->display(action); + + return scene->display(action, event); } bool Scene3175::Actor3::startAction(CursorType action, Event &event) { @@ -852,7 +851,7 @@ bool Scene3175::Actor3::startAction(CursorType action, Event &event) { break; } warning("scene->display() called with two parameters"); - return scene->display(action); + return scene->display(action, event); } bool Scene3175::Actor1::startAction(CursorType action, Event &event) { -- cgit v1.2.3 From 109ba212c6cc62ec4a2f2a664a957e66b383f44d Mon Sep 17 00:00:00 2001 From: Tobias Gunkel Date: Sun, 9 Oct 2011 12:47:47 +0200 Subject: SCUMM: Add initial support for AppleII sound player --- engines/scumm/player_appleII.cpp | 364 +++++++++++++++++++++++++++++++++++++++ engines/scumm/player_appleII.h | 167 ++++++++++++++++++ engines/scumm/scumm.cpp | 3 +- 3 files changed, 533 insertions(+), 1 deletion(-) create mode 100644 engines/scumm/player_appleII.cpp create mode 100644 engines/scumm/player_appleII.h (limited to 'engines') diff --git a/engines/scumm/player_appleII.cpp b/engines/scumm/player_appleII.cpp new file mode 100644 index 0000000000..c5f60cd700 --- /dev/null +++ b/engines/scumm/player_appleII.cpp @@ -0,0 +1,364 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include +#include "engines/engine.h" +#include "scumm/player_appleII.h" +#include "scumm/scumm.h" + +// CPU_CLOCK according to AppleWin +static const double CPU_CLOCK = 1020484.5; // ~ 1.02 MHz + +namespace Scumm { + +Player_AppleII::Player_AppleII(ScummEngine *scumm, Audio::Mixer *mixer) { + _speakerState = 0; + _soundNr = 0; + + _mixer = mixer; + _sampleRate = _mixer->getOutputRate(); + _vm = scumm; + + _mixer->playStream(Audio::Mixer::kPlainSoundType, &_soundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true); +} + +Player_AppleII::~Player_AppleII() { + _mixer->stopHandle(_soundHandle); +} + +/* +void logSounds() { + for (nr = 1; nr < 70; ++nr) { + switch (nr) { + // non-existing or invalid + case 3: case 4: case 5: case 49: case 51: case 68: + continue; + } + + byte *data = _vm->getResourceAddress(rtSound, nr); + if (data) { + size_t size = (data[1] << 8) | data[0]; + + std::stringstream s; + s << "d:/msound/sound" << nr << ".snd"; + FILE *f = fopen(s.str().c_str(), "wb"); + fwrite(data, 1, size, f); + fclose(f); + printf("sound: %d\n", nr); + } + } +} +*/ + +void Player_AppleII::startSound(int nr) { + Common::StackLock lock(_mutex); + + _soundNr = nr; + _buffer.clear(); + + byte *data = _vm->getResourceAddress(rtSound, nr); + assert(data); + + byte *ptr1 = data + 4; + + int type = ptr1[0]; + if (type == 0) + return; + int loop = ptr1[1]; + assert(loop > 0); + ptr1 += 2; + + debug(4, "startSound %d: type %d, loop %d", + nr, type, loop); + + do { + switch (type) { + case 1: // freq up/down + soundFunc1(ptr1); + break; + case 2: // symmetric wave (~) + soundFunc2(ptr1); + break; + case 3: // asymmetric wave (__-) + soundFunc3(ptr1); + break; + case 4: // polyphone (2 voices) + soundFunc4(ptr1); + break; + case 5: // periodic noise + soundFunc5(ptr1); + break; + } + --loop; + } while (loop > 0); +} + +void Player_AppleII::stopAllSounds() { + Common::StackLock lock(_mutex); + _buffer.clear(); +} + +void Player_AppleII::stopSound(int nr) { + Common::StackLock lock(_mutex); + if (_soundNr == nr) { + _buffer.clear(); + } +} + +int Player_AppleII::getSoundStatus(int nr) const { + Common::StackLock lock(_mutex); + return (_buffer.availableSize() > 0 ? 1 : 0); +} + +int Player_AppleII::getMusicTimer() { + /* Apple-II sounds are synchronous -> no music timer */ + return 0; +} + +int Player_AppleII::readBuffer(int16 *buffer, const int numSamples) { + Common::StackLock lock(_mutex); + return _buffer.read((byte*)buffer, numSamples * 2) / 2; +} + +/************************************ + * Apple-II sound-resource parser + ************************************/ + +// toggle speaker on/off +void Player_AppleII::speakerToggle() { + _speakerState ^= 0x1; +} + +void Player_AppleII::generateSamples(int cycles) { + // sampleDiff is used to compensate fractional samples + static double sampleDiff = 0; + double fSamples = (double)cycles / CPU_CLOCK * _sampleRate + sampleDiff; + int samples = (int)(fSamples + 0.5); + sampleDiff = fSamples - samples; + + float vol = (float)_maxvol / 255; + int16 value = vol * (_speakerState ? 32767 : -32767); + for (int i = 0; i < samples; ++i) + _buffer.write(&value, sizeof(value)); +} + +void Player_AppleII::wait(int interval, int count /*y*/) { + assert(count > 0); // 0 == 256? + assert(interval > 0); // 0 == 256? + generateSamples(11 + count*(8 + 5 * interval)); +} + +void Player_AppleII::_soundFunc1(int interval /*a*/, int count /*y*/) { // D076 + assert(interval > 0); // 0 == 256? + assert(count > 0); // 0 == 256? + + for (; count >= 0; --count) { + speakerToggle(); + generateSamples(17 + 5 * interval); + } +} + +void Player_AppleII::soundFunc1(const byte *params) { // D085 + int delta = params[0]; + int count = params[1]; + byte interval = params[2]; // must be byte ("interval < delta" possible) + int limit = params[3]; + bool decInterval = (params[4] >= 0x40); + + if (decInterval) { + do { + _soundFunc1(interval, count); + interval -= delta; + } while (interval >= limit); + } else { + do { + _soundFunc1(interval, count); + interval += delta; + } while (interval < limit); + } +} + +void Player_AppleII::_soundFunc2(int interval /*a*/, int count) { // D0EF + if (interval == 0xFE) { + wait(interval, 10); + } else { + assert(count > 0); // 0 == 256? + assert(interval > 0); // 0 == 256? + + int a = (interval >> 3) + count; + for (int y = a; y > 0; --y) { + generateSamples(1292 - 5*interval); + speakerToggle(); + + generateSamples(1287 - 5*interval); + speakerToggle(); + } + } +} + +void Player_AppleII::soundFunc2(const byte *params) { // D0D6 + for (int pos = 1; pos < 256; ++pos) { + byte interval = params[pos]; + if (interval == 0xFF) + return; + _soundFunc2(interval, params[0] /*, LD12F=interval*/); + } +} + +void Player_AppleII::_soundFunc3(int interval /*a*/, int count /*LD12D*/) { // D14B + if (interval == 0xFE) { + wait(interval, 70); + } else { + assert(interval > 0); // 0 == 256? + assert(count > 0); // 0 == 256? + + for (int y = count; y > 0; --y) { + generateSamples(1289 - 5*interval); + speakerToggle(); + } + } +} + +void Player_AppleII::soundFunc3(const byte *params) { // D132 + for (int pos = 1; pos < 256; ++pos) { + byte interval = params[pos]; + if (interval == 0xFF) + return; + _soundFunc3(interval, params[0]); + } +} + +void Player_AppleII::_soundFunc4(byte param0, byte param1, byte param2) { // D1A2 + uint16 count = (-param2 << 8) | 0x3; + byte bitmask1 = 0x3; + byte bitmask2 = 0x3; + + byte updateInterval2 = param0; + if (updateInterval2 == 0) + bitmask2 = 0x0; + + byte updateInterval1 = param1; + if (updateInterval1 == 0) { + bitmask1 = 0x0; + if (bitmask2 != 0) { + bitmask1 = bitmask2; + bitmask2 = 0; + updateInterval1 = updateInterval2; + } + } + + byte speakerShiftReg = 0; + static byte updateRemain1 = 80; + static byte updateRemain2 = 10; + + while (true) { + --updateRemain1; + if (updateRemain1 == 0) { + updateRemain1 = updateInterval1; + speakerShiftReg ^= bitmask1; + } + + --updateRemain2; + if (updateRemain2 == 0) { + updateRemain2 = updateInterval2; + if (updateRemain1 != 0) { + speakerShiftReg ^= bitmask2; + } + } + + if (speakerShiftReg & 0x1) + speakerToggle(); + speakerShiftReg >>= 1; + generateSamples(40); + + ++count; + if (count == 0) { + return; + } + } +} + +void Player_AppleII::soundFunc4(const byte *params) { // D170 + while (params[0] != 0x01) { + _soundFunc4(params[0], params[1], params[2]); + params += 3; + } +} + +void Player_AppleII::_soundFunc5(int interval /*a*/, int count) { // D270 + assert(count > 0); // 0 == 256? + if (interval == 0) + interval = 256; + + for (int i = count; i > 0; --i) { + generateSamples(10 + 5*interval); + speakerToggle(); + + generateSamples(5 + 5*interval); + speakerToggle(); + } +} + +// LD000[loc] ^ LD00A[loc] +static const byte noiseTable[256] = { + 0x65, 0x1b, 0xda, 0x11, 0x61, 0xe5, 0x77, 0x57, 0x92, 0xc8, 0x51, 0x1c, 0xd4, 0x91, 0x62, 0x63, + 0x00, 0x38, 0x57, 0xd5, 0x18, 0xd8, 0xdc, 0x40, 0x03, 0x86, 0xd3, 0x2f, 0x10, 0x11, 0xd8, 0x3c, + 0xbe, 0x00, 0x19, 0xc5, 0xd2, 0xc3, 0xca, 0x34, 0x00, 0x28, 0xbf, 0xb9, 0x18, 0x20, 0x01, 0xcc, + 0xda, 0x08, 0xbc, 0x75, 0x7c, 0xb0, 0x8d, 0xe0, 0x09, 0x18, 0xbf, 0x5d, 0xe9, 0x8c, 0x75, 0x64, + 0xe5, 0xb5, 0x5d, 0xe0, 0xb7, 0x7d, 0xe9, 0x8c, 0x55, 0x65, 0xc5, 0xb5, 0x5d, 0xd8, 0x09, 0x0d, + 0x64, 0xf0, 0xf0, 0x08, 0x63, 0x03, 0x00, 0x55, 0x35, 0xc0, 0x00, 0x20, 0x74, 0xa5, 0x1e, 0xe3, + 0x00, 0x06, 0x3c, 0x52, 0xd1, 0x70, 0xd0, 0x57, 0x02, 0xf0, 0x00, 0xb6, 0xfc, 0x02, 0x11, 0x9a, + 0x3b, 0xc8, 0x38, 0xdf, 0x1a, 0xb0, 0xd1, 0xb8, 0xd0, 0x18, 0x8a, 0x4a, 0xea, 0x1b, 0x12, 0x5d, + 0x29, 0x58, 0xd8, 0x43, 0xb8, 0x2d, 0xd2, 0x61, 0x10, 0x3c, 0x0c, 0x5d, 0x1b, 0x61, 0x10, 0x3c, + 0x0a, 0x5d, 0x1d, 0x61, 0x10, 0x3c, 0x0b, 0x19, 0x88, 0x21, 0xc0, 0x21, 0x07, 0x00, 0x65, 0x62, + 0x08, 0xe9, 0x36, 0x40, 0x20, 0x41, 0x06, 0x00, 0x20, 0x00, 0x00, 0xed, 0xa3, 0x00, 0x88, 0x06, + 0x98, 0x01, 0x5d, 0x7f, 0x02, 0x1d, 0x78, 0x03, 0x60, 0xcb, 0x3a, 0x01, 0xbd, 0x78, 0x02, 0x5d, + 0x7e, 0x03, 0x1d, 0xf5, 0xa6, 0x40, 0x81, 0xb4, 0xd0, 0x8d, 0xd3, 0xd0, 0x6d, 0xd5, 0x61, 0x48, + 0x61, 0x4d, 0xd1, 0xc8, 0xb1, 0xd8, 0x69, 0xff, 0x61, 0xd9, 0xed, 0xa0, 0xfe, 0x19, 0x91, 0x37, + 0x19, 0x37, 0x00, 0xf1, 0x00, 0x01, 0x1f, 0x00, 0xad, 0xc1, 0x01, 0x01, 0x2e, 0x00, 0x40, 0xc6, + 0x7a, 0x9b, 0x95, 0x43, 0xfc, 0x18, 0xd2, 0x9e, 0x2a, 0x5a, 0x4b, 0x2a, 0xb6, 0x87, 0x30, 0x6c +}; + +byte /*a*/ Player_AppleII::noise() { // D261 + static int pos = 0; // initial value? + byte result = noiseTable[pos]; + pos = (pos + 1) % 256; + return result; +} + +void Player_AppleII::soundFunc5(const byte *params) { // D222 + const byte noiseMask[] = { + 0x3F, 0x3F, 0x7F, 0x7F, 0x7F, 0x7F, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F + }; + + int param0 = params[0]; + assert(param0 > 0); + for (int i = 0; i < 10; ++i) { + int count = param0; + do { + _soundFunc5(noise() & noiseMask[i], 1); + --count; + } while (count > 0); + } +} + +} // End of namespace Scumm diff --git a/engines/scumm/player_appleII.h b/engines/scumm/player_appleII.h new file mode 100644 index 0000000000..545e590fdd --- /dev/null +++ b/engines/scumm/player_appleII.h @@ -0,0 +1,167 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef SCUMM_PLAYER_APPLEII_H +#define SCUMM_PLAYER_APPLEII_H + +#include "common/mutex.h" +#include "common/scummsys.h" +#include "common/memstream.h" +#include "scumm/music.h" +#include "audio/audiostream.h" +#include "audio/mixer.h" +#include "audio/softsynth/sid.h" + +namespace Scumm { + +class ScummEngine; + +class DynamicMemoryStream { +public: + DynamicMemoryStream() : _data(0) { + clear(); + } + + ~DynamicMemoryStream() { + free(_data); + } + + void clear() { + free(_data); + _data = 0; + _capacity = 0; + _size = 0; + _ptr = 0; + _pos = 0; + _readPos = 0; + } + + void ensureCapacity(uint32 new_len) { + if (new_len <= _capacity) + return; + + byte *old_data = _data; + + _capacity *= 2; + if (_capacity < new_len + 2048) + _capacity = new_len + 2048; + _data = (byte *)malloc(_capacity); + _ptr = _data + _pos; + + if (old_data) { + // Copy old data + memcpy(_data, old_data, _size); + free(old_data); + } + + _size = new_len; + } + + uint32 availableSize() const { + if (_readPos >= _size) + return 0; + return _size - _readPos; + } + + virtual uint32 write(const void *dataPtr, uint32 dataSize) { + ensureCapacity(_pos + dataSize); + memcpy(_ptr, dataPtr, dataSize); + _ptr += dataSize; + _pos += dataSize; + if (_pos > _size) + _size = _pos; + return dataSize; + } + + uint32 read(byte *dataPtr, uint32 dataSize) const { + uint32 avail = availableSize(); + if (avail == 0) + return 0; + if (dataSize > avail) + dataSize = avail; + memcpy(dataPtr, _data + _readPos, dataSize); + _readPos += dataSize; + return dataSize; + } + +private: + mutable uint32 _readPos; + uint32 _capacity; + uint32 _size; + byte *_ptr; + byte *_data; + uint32 _pos; +}; + +class Player_AppleII : public Audio::AudioStream, public MusicEngine { +public: + Player_AppleII(ScummEngine *scumm, Audio::Mixer *mixer); + virtual ~Player_AppleII(); + + virtual void setMusicVolume(int vol) { _maxvol = vol; } + void startMusic(int songResIndex); + virtual void startSound(int sound); + virtual void stopSound(int sound); + virtual void stopAllSounds(); + virtual int getSoundStatus(int sound) const; + virtual int getMusicTimer(); + + // AudioStream API + int readBuffer(int16 *buffer, const int numSamples); + bool isStereo() const { return false; } + bool endOfData() const { return false; } + int getRate() const { return _sampleRate; } + +private: + ScummEngine *_vm; + Audio::Mixer *_mixer; + Audio::SoundHandle _soundHandle; + int _maxvol; + int _sampleRate; + Common::Mutex _mutex; + +private: + byte _speakerState; + DynamicMemoryStream _buffer; + int _soundNr; + +private: + void speakerToggle(); + void generateSamples(int cycles); + void wait(int interval, int count); + byte noise(); + + void soundFunc1(const byte *params); + void _soundFunc1(int interval, int count); + void soundFunc2(const byte *params); + void _soundFunc2(int interval, int count); + void soundFunc3(const byte *params); + void _soundFunc3(int interval, int count); + void soundFunc4(const byte *params); + void _soundFunc4(byte param0, byte param1, byte param2); + void soundFunc5(const byte *params); + void _soundFunc5(int interval, int count); +}; + +} // End of namespace Scumm + +#endif diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index f94496b14b..3eea68fbbe 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -55,6 +55,7 @@ #include "scumm/player_nes.h" #include "scumm/player_sid.h" #include "scumm/player_pce.h" +#include "scumm/player_appleII.h" #include "scumm/player_v1.h" #include "scumm/player_v2.h" #include "scumm/player_v2cms.h" @@ -1797,7 +1798,7 @@ void ScummEngine::setupMusic(int midi) { if (_game.version >= 7) { // Setup for digital iMuse is performed in another place } else if (_game.platform == Common::kPlatformApple2GS && _game.version == 0){ - // TODO: Add support for music format + _musicEngine = new Player_AppleII(this, _mixer); } else if (_game.platform == Common::kPlatformC64 && _game.version <= 1) { #ifndef DISABLE_SID _musicEngine = new Player_SID(this, _mixer); -- cgit v1.2.3 From e56d5df295de63ed991bf9682f1c78e3ab92f351 Mon Sep 17 00:00:00 2001 From: Tobias Gunkel Date: Mon, 19 Dec 2011 17:03:10 +0100 Subject: SCUMM: Fix error in player_appleII when both voices are triggered at the same time --- engines/scumm/player_appleII.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'engines') diff --git a/engines/scumm/player_appleII.cpp b/engines/scumm/player_appleII.cpp index c5f60cd700..b83bb22871 100644 --- a/engines/scumm/player_appleII.cpp +++ b/engines/scumm/player_appleII.cpp @@ -272,19 +272,21 @@ void Player_AppleII::_soundFunc4(byte param0, byte param1, byte param2) { // D1A while (true) { --updateRemain1; - if (updateRemain1 == 0) { - updateRemain1 = updateInterval1; - speakerShiftReg ^= bitmask1; - } - --updateRemain2; + if (updateRemain2 == 0) { updateRemain2 = updateInterval2; + // use only first voice's data (bitmask1) if both voices are triggered if (updateRemain1 != 0) { speakerShiftReg ^= bitmask2; } } + if (updateRemain1 == 0) { + updateRemain1 = updateInterval1; + speakerShiftReg ^= bitmask1; + } + if (speakerShiftReg & 0x1) speakerToggle(); speakerShiftReg >>= 1; -- cgit v1.2.3 From 8b7ad559c18df51deb7682ad728244fde22dc70a Mon Sep 17 00:00:00 2001 From: Tobias Gunkel Date: Sun, 20 Nov 2011 20:52:28 +0100 Subject: SCUMM: Aggregate speaker states of CPU cycles in between samples - formerly only two sample levels were possible: 32767 or -32767. Now the speaker states (0/1) between two samples are aggregated by the new SampleConverter class to allow more accurate sample values between -32767 and 32767. - the player's state is moved into a separate state struct --- engines/scumm/player_appleII.cpp | 90 +++++++++++++++------------------ engines/scumm/player_appleII.h | 106 ++++++++++++++++++++++++++++++++++++--- 2 files changed, 139 insertions(+), 57 deletions(-) (limited to 'engines') diff --git a/engines/scumm/player_appleII.cpp b/engines/scumm/player_appleII.cpp index b83bb22871..0c34c906a6 100644 --- a/engines/scumm/player_appleII.cpp +++ b/engines/scumm/player_appleII.cpp @@ -25,9 +25,6 @@ #include "scumm/player_appleII.h" #include "scumm/scumm.h" -// CPU_CLOCK according to AppleWin -static const double CPU_CLOCK = 1020484.5; // ~ 1.02 MHz - namespace Scumm { Player_AppleII::Player_AppleII(ScummEngine *scumm, Audio::Mixer *mixer) { @@ -35,9 +32,10 @@ Player_AppleII::Player_AppleII(ScummEngine *scumm, Audio::Mixer *mixer) { _soundNr = 0; _mixer = mixer; - _sampleRate = _mixer->getOutputRate(); _vm = scumm; + setSampleRate(_mixer->getOutputRate()); + _mixer->playStream(Audio::Mixer::kPlainSoundType, &_soundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true); } @@ -73,60 +71,62 @@ void Player_AppleII::startSound(int nr) { Common::StackLock lock(_mutex); _soundNr = nr; - _buffer.clear(); + _sampleConverter.reset(); byte *data = _vm->getResourceAddress(rtSound, nr); assert(data); byte *ptr1 = data + 4; - int type = ptr1[0]; - if (type == 0) + _state.type = ptr1[0]; + if (_state.type == 0) return; - int loop = ptr1[1]; - assert(loop > 0); - ptr1 += 2; + + _state.loop = ptr1[1]; + assert(_state.loop > 0); + + _state.params = &ptr1[2]; debug(4, "startSound %d: type %d, loop %d", - nr, type, loop); + nr, _state.type, _state.loop); do { - switch (type) { + switch (_state.type) { case 1: // freq up/down - soundFunc1(ptr1); + soundFunc1(); break; case 2: // symmetric wave (~) - soundFunc2(ptr1); + soundFunc2(); break; case 3: // asymmetric wave (__-) - soundFunc3(ptr1); + soundFunc3(); break; case 4: // polyphone (2 voices) - soundFunc4(ptr1); + soundFunc4(); break; case 5: // periodic noise - soundFunc5(ptr1); + soundFunc5(); break; } - --loop; - } while (loop > 0); + --_state.loop; + } while (_state.loop > 0); } void Player_AppleII::stopAllSounds() { Common::StackLock lock(_mutex); - _buffer.clear(); + _sampleConverter.reset(); } void Player_AppleII::stopSound(int nr) { Common::StackLock lock(_mutex); if (_soundNr == nr) { - _buffer.clear(); + _sampleConverter.reset(); } } int Player_AppleII::getSoundStatus(int nr) const { Common::StackLock lock(_mutex); - return (_buffer.availableSize() > 0 ? 1 : 0); + return (_sampleConverter.availableSize() > 0 ? 1 : 0); } int Player_AppleII::getMusicTimer() { @@ -136,7 +136,7 @@ int Player_AppleII::getMusicTimer() { int Player_AppleII::readBuffer(int16 *buffer, const int numSamples) { Common::StackLock lock(_mutex); - return _buffer.read((byte*)buffer, numSamples * 2) / 2; + return _sampleConverter.readSamples(buffer, numSamples); } /************************************ @@ -149,16 +149,7 @@ void Player_AppleII::speakerToggle() { } void Player_AppleII::generateSamples(int cycles) { - // sampleDiff is used to compensate fractional samples - static double sampleDiff = 0; - double fSamples = (double)cycles / CPU_CLOCK * _sampleRate + sampleDiff; - int samples = (int)(fSamples + 0.5); - sampleDiff = fSamples - samples; - - float vol = (float)_maxvol / 255; - int16 value = vol * (_speakerState ? 32767 : -32767); - for (int i = 0; i < samples; ++i) - _buffer.write(&value, sizeof(value)); + _sampleConverter.addCycles(_speakerState, cycles); } void Player_AppleII::wait(int interval, int count /*y*/) { @@ -177,12 +168,12 @@ void Player_AppleII::_soundFunc1(int interval /*a*/, int count /*y*/) { // D076 } } -void Player_AppleII::soundFunc1(const byte *params) { // D085 - int delta = params[0]; - int count = params[1]; - byte interval = params[2]; // must be byte ("interval < delta" possible) - int limit = params[3]; - bool decInterval = (params[4] >= 0x40); +void Player_AppleII::soundFunc1() { // D085 + const int delta = _state.params[0]; + const int count = _state.params[1]; + byte interval = _state.params[2]; // must be byte ("interval < delta" possible) + const int limit = _state.params[3]; + const bool decInterval = (_state.params[4] >= 0x40); if (decInterval) { do { @@ -215,12 +206,12 @@ void Player_AppleII::_soundFunc2(int interval /*a*/, int count) { // D0EF } } -void Player_AppleII::soundFunc2(const byte *params) { // D0D6 +void Player_AppleII::soundFunc2() { // D0D6 for (int pos = 1; pos < 256; ++pos) { - byte interval = params[pos]; + byte interval = _state.params[pos]; if (interval == 0xFF) return; - _soundFunc2(interval, params[0] /*, LD12F=interval*/); + _soundFunc2(interval, _state.params[0] /*, LD12F=interval*/); } } @@ -238,12 +229,12 @@ void Player_AppleII::_soundFunc3(int interval /*a*/, int count /*LD12D*/) { // D } } -void Player_AppleII::soundFunc3(const byte *params) { // D132 +void Player_AppleII::soundFunc3() { // D132 for (int pos = 1; pos < 256; ++pos) { - byte interval = params[pos]; + byte interval = _state.params[pos]; if (interval == 0xFF) return; - _soundFunc3(interval, params[0]); + _soundFunc3(interval, _state.params[0]); } } @@ -290,7 +281,7 @@ void Player_AppleII::_soundFunc4(byte param0, byte param1, byte param2) { // D1A if (speakerShiftReg & 0x1) speakerToggle(); speakerShiftReg >>= 1; - generateSamples(40); + generateSamples(42); /* actually 42.5 */ ++count; if (count == 0) { @@ -299,7 +290,8 @@ void Player_AppleII::_soundFunc4(byte param0, byte param1, byte param2) { // D1A } } -void Player_AppleII::soundFunc4(const byte *params) { // D170 +void Player_AppleII::soundFunc4() { // D170 + const byte *params = _state.params; while (params[0] != 0x01) { _soundFunc4(params[0], params[1], params[2]); params += 3; @@ -347,12 +339,12 @@ byte /*a*/ Player_AppleII::noise() { // D261 return result; } -void Player_AppleII::soundFunc5(const byte *params) { // D222 +void Player_AppleII::soundFunc5() { // D222 const byte noiseMask[] = { 0x3F, 0x3F, 0x7F, 0x7F, 0x7F, 0x7F, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F }; - int param0 = params[0]; + int param0 = _state.params[0]; assert(param0 > 0); for (int i = 0; i < 10; ++i) { int count = param0; diff --git a/engines/scumm/player_appleII.h b/engines/scumm/player_appleII.h index 545e590fdd..18572200c2 100644 --- a/engines/scumm/player_appleII.h +++ b/engines/scumm/player_appleII.h @@ -112,12 +112,97 @@ private: uint32 _pos; }; +// CPU_CLOCK according to AppleWin +static const double CPU_CLOCK = 1020484.5; // ~ 1.02 MHz + +class SampleConverter { +private: + void newSample(int sample) { + int16 value = _volume * sample / 255; + _buffer.write(&value, sizeof(value)); + } + +public: + SampleConverter() : + _cyclesPerSample(0), + _missingCycles(0), + _sampleCyclesSum(0), + _volume(255) + {} + + void reset() { + _missingCycles = 0; + _sampleCyclesSum = 0; + _buffer.clear(); + } + + uint32 availableSize() const { + return _buffer.availableSize(); + } + + void setMusicVolume(int vol) { + assert(vol >= 0 && vol <= 255); + _volume = vol; + } + + void setSampleRate(int rate) { + _cyclesPerSample = CPU_CLOCK / (float)rate; + reset(); + } + + void addCycles(byte level, int cycles) { + // step 1: if cycles are left from the last call, process them first + if (_missingCycles > 0) { + int n = (_missingCycles < cycles) ? _missingCycles : cycles; + if (level) + _sampleCyclesSum += n; + cycles -= n; + _missingCycles -= n; + if (_missingCycles == 0) { + newSample(2*32767 * _sampleCyclesSum / _cyclesPerSample - 32767); + } else { + return; + } + } + + _sampleCyclesSum = 0; + + // step 2: process blocks of cycles fitting into a whole sample + while (cycles >= _cyclesPerSample) { + newSample(level ? 32767 : -32767); + cycles -= _cyclesPerSample; + } + + // step 3: remember cycles left for next call + if (cycles > 0) { + _missingCycles = _cyclesPerSample - cycles; + if (level) + _sampleCyclesSum = cycles; + } + } + + uint32 readSamples(void *buffer, int numSamples) { + return _buffer.read((byte*)buffer, numSamples * 2) / 2; + } + +private: + float _cyclesPerSample; + int _missingCycles; + int _sampleCyclesSum; + int _volume; /* 0 - 255 */ + DynamicMemoryStream _buffer; +}; + class Player_AppleII : public Audio::AudioStream, public MusicEngine { public: Player_AppleII(ScummEngine *scumm, Audio::Mixer *mixer); virtual ~Player_AppleII(); - virtual void setMusicVolume(int vol) { _maxvol = vol; } + virtual void setMusicVolume(int vol) { _sampleConverter.setMusicVolume(vol); } + void setSampleRate(int rate) { + _sampleRate = rate; + _sampleConverter.setSampleRate(rate); + } void startMusic(int songResIndex); virtual void startSound(int sound); virtual void stopSound(int sound); @@ -132,17 +217,22 @@ public: int getRate() const { return _sampleRate; } private: + struct state_t { + int type; + int loop; + const byte *params; + } _state; + ScummEngine *_vm; Audio::Mixer *_mixer; Audio::SoundHandle _soundHandle; - int _maxvol; int _sampleRate; Common::Mutex _mutex; private: byte _speakerState; - DynamicMemoryStream _buffer; int _soundNr; + SampleConverter _sampleConverter; private: void speakerToggle(); @@ -150,15 +240,15 @@ private: void wait(int interval, int count); byte noise(); - void soundFunc1(const byte *params); + void soundFunc1(); void _soundFunc1(int interval, int count); - void soundFunc2(const byte *params); + void soundFunc2(); void _soundFunc2(int interval, int count); - void soundFunc3(const byte *params); + void soundFunc3(); void _soundFunc3(int interval, int count); - void soundFunc4(const byte *params); + void soundFunc4(); void _soundFunc4(byte param0, byte param1, byte param2); - void soundFunc5(const byte *params); + void soundFunc5(); void _soundFunc5(int interval, int count); }; -- cgit v1.2.3 From 375047b72969fb4560cb7269134d586ff3baff31 Mon Sep 17 00:00:00 2001 From: Tobias Gunkel Date: Sun, 20 Nov 2011 21:10:59 +0100 Subject: SCUMM: Increase precision of player_appleII Use fixed precision instead of integral numbers for sample conversion --- engines/scumm/player_appleII.h | 84 +++++++++++++++++++++++++++--------------- 1 file changed, 54 insertions(+), 30 deletions(-) (limited to 'engines') diff --git a/engines/scumm/player_appleII.h b/engines/scumm/player_appleII.h index 18572200c2..7cc02b1f01 100644 --- a/engines/scumm/player_appleII.h +++ b/engines/scumm/player_appleII.h @@ -113,26 +113,28 @@ private: }; // CPU_CLOCK according to AppleWin -static const double CPU_CLOCK = 1020484.5; // ~ 1.02 MHz +static const double APPLEII_CPU_CLOCK = 1020484.5; // ~ 1.02 MHz class SampleConverter { private: - void newSample(int sample) { - int16 value = _volume * sample / 255; + void addSampleToBuffer(int sample) { + int16 value = sample * _volume / _maxVolume; _buffer.write(&value, sizeof(value)); } public: SampleConverter() : - _cyclesPerSample(0), - _missingCycles(0), - _sampleCyclesSum(0), - _volume(255) + _cyclesPerSampleFP(0), + _missingCyclesFP(0), + _sampleCyclesSumFP(0), + _volume(_maxVolume) {} + ~SampleConverter() {} + void reset() { - _missingCycles = 0; - _sampleCyclesSum = 0; + _missingCyclesFP = 0; + _sampleCyclesSumFP = 0; _buffer.clear(); } @@ -141,43 +143,47 @@ public: } void setMusicVolume(int vol) { - assert(vol >= 0 && vol <= 255); + assert(vol >= 0 && vol <= _maxVolume); _volume = vol; } void setSampleRate(int rate) { - _cyclesPerSample = CPU_CLOCK / (float)rate; + /* ~46 CPU cycles per sample @ 22.05kHz */ + _cyclesPerSampleFP = APPLEII_CPU_CLOCK * (1 << PREC_SHIFT) / rate; reset(); } - void addCycles(byte level, int cycles) { + void addCycles(byte level, const int cycles) { + /* convert to fixed precision floats */ + int cyclesFP = cycles << PREC_SHIFT; + // step 1: if cycles are left from the last call, process them first - if (_missingCycles > 0) { - int n = (_missingCycles < cycles) ? _missingCycles : cycles; + if (_missingCyclesFP > 0) { + int n = (_missingCyclesFP < cyclesFP) ? _missingCyclesFP : cyclesFP; if (level) - _sampleCyclesSum += n; - cycles -= n; - _missingCycles -= n; - if (_missingCycles == 0) { - newSample(2*32767 * _sampleCyclesSum / _cyclesPerSample - 32767); + _sampleCyclesSumFP += n; + cyclesFP -= n; + _missingCyclesFP -= n; + if (_missingCyclesFP == 0) { + addSampleToBuffer(2*32767 * _sampleCyclesSumFP / _cyclesPerSampleFP - 32767); } else { return; } } - _sampleCyclesSum = 0; + _sampleCyclesSumFP = 0; // step 2: process blocks of cycles fitting into a whole sample - while (cycles >= _cyclesPerSample) { - newSample(level ? 32767 : -32767); - cycles -= _cyclesPerSample; + while (cyclesFP >= _cyclesPerSampleFP) { + addSampleToBuffer(level ? 32767 : -32767); + cyclesFP -= _cyclesPerSampleFP; } // step 3: remember cycles left for next call - if (cycles > 0) { - _missingCycles = _cyclesPerSample - cycles; + if (cyclesFP > 0) { + _missingCyclesFP = _cyclesPerSampleFP - cyclesFP; if (level) - _sampleCyclesSum = cycles; + _sampleCyclesSumFP = cyclesFP; } } @@ -185,11 +191,29 @@ public: return _buffer.read((byte*)buffer, numSamples * 2) / 2; } +#if 0 + void logToFile(Common::String fileName) { + FILE *f; + byte buffer[512]; + int n; + + f = fopen(fileName.c_str(), "wb"); + while ((n = _buffer.read(buffer, 512)) != 0) { + fwrite(buffer, 1, n, f); + } + fclose(f); + } +#endif + +private: + static const int PREC_SHIFT = 7; + private: - float _cyclesPerSample; - int _missingCycles; - int _sampleCyclesSum; - int _volume; /* 0 - 255 */ + int _cyclesPerSampleFP; /* (fixed precision) */ + int _missingCyclesFP; /* (fixed precision) */ + int _sampleCyclesSumFP; /* (fixed precision) */ + int _volume; /* 0 - 256 */ + static const int _maxVolume = 256; DynamicMemoryStream _buffer; }; -- cgit v1.2.3 From ffc88c5ceda344d5d5166ecbd712c6714e7af738 Mon Sep 17 00:00:00 2001 From: Tobias Gunkel Date: Tue, 20 Dec 2011 08:33:11 +0100 Subject: SCUMM: Reduce sound buffer size for player_appleII Sound generation functions are now called incrementally instead of just once to generate the sound data. This reduces the max. buffer size from 1.7MB to just ~100KB (piano, sound 50). --- engines/scumm/player_appleII.cpp | 199 ++++++++++++++++++++++++++++----------- engines/scumm/player_appleII.h | 41 ++++++-- 2 files changed, 177 insertions(+), 63 deletions(-) (limited to 'engines') diff --git a/engines/scumm/player_appleII.cpp b/engines/scumm/player_appleII.cpp index 0c34c906a6..a4111c5109 100644 --- a/engines/scumm/player_appleII.cpp +++ b/engines/scumm/player_appleII.cpp @@ -28,11 +28,10 @@ namespace Scumm { Player_AppleII::Player_AppleII(ScummEngine *scumm, Audio::Mixer *mixer) { - _speakerState = 0; - _soundNr = 0; - _mixer = mixer; _vm = scumm; + + resetState(); setSampleRate(_mixer->getOutputRate()); @@ -70,18 +69,23 @@ void logSounds() { void Player_AppleII::startSound(int nr) { Common::StackLock lock(_mutex); - _soundNr = nr; - _sampleConverter.reset(); + resetState(); byte *data = _vm->getResourceAddress(rtSound, nr); assert(data); - byte *ptr1 = data + 4; _state.type = ptr1[0]; - if (_state.type == 0) + if (_state.type == 0) { + // nothing to play + resetState(); return; - + } + + _state.soundNr = nr; + _state.finished = false; + initFuncState(); + _state.loop = ptr1[1]; assert(_state.loop > 0); @@ -89,44 +93,86 @@ void Player_AppleII::startSound(int nr) { debug(4, "startSound %d: type %d, loop %d", nr, _state.type, _state.loop); - - do { - switch (_state.type) { - case 1: // freq up/down - soundFunc1(); - break; - case 2: // symmetric wave (~) - soundFunc2(); - break; - case 3: // asymmetric wave (__-) - soundFunc3(); - break; - case 4: // polyphone (2 voices) - soundFunc4(); - break; - case 5: // periodic noise - soundFunc5(); - break; - } +} + +void Player_AppleII::initFuncState() { + switch (_state.type) { + case 2: case 3: + _state.func23.pos = 1; + break; + case 4: + _state.func4.updateRemain1 = 80; + _state.func4.updateRemain2 = 10; + break; + case 5: + _state.func5.index = 0; + break; + } +} + +bool Player_AppleII::updateSound() { + if (!_state.soundNr || _state.finished) + return false; + + bool done = false; + switch (_state.type) { + case 1: // freq up/down + done = soundFunc1(); + break; + case 2: // symmetric wave (~) + done = soundFunc2(); + break; + case 3: // asymmetric wave (__-) + done = soundFunc3(); + break; + case 4: // polyphone (2 voices) + done = soundFunc4(); + break; + case 5: // periodic noise + done = soundFunc5(); + break; + } + + if (done) { --_state.loop; - } while (_state.loop > 0); + if (_state.loop <= 0) { + _state.finished = true; + } else { + // reset function state on each loop + initFuncState(); + } + } + + return true; +} + +void Player_AppleII::resetState() { + _state.soundNr = 0; + _state.type = 0; + _state.loop = 0; + _state.params = NULL; + _state.localParams = NULL; + _state.speakerState = 0; + _state.finished = true; + + _sampleConverter.reset(); } void Player_AppleII::stopAllSounds() { Common::StackLock lock(_mutex); - _sampleConverter.reset(); + resetState(); } void Player_AppleII::stopSound(int nr) { Common::StackLock lock(_mutex); - if (_soundNr == nr) { - _sampleConverter.reset(); + if (_state.soundNr == nr) { + resetState(); } } int Player_AppleII::getSoundStatus(int nr) const { Common::StackLock lock(_mutex); - return (_sampleConverter.availableSize() > 0 ? 1 : 0); + return (_state.soundNr == nr); } int Player_AppleII::getMusicTimer() { @@ -136,7 +182,22 @@ int Player_AppleII::getMusicTimer() { int Player_AppleII::readBuffer(int16 *buffer, const int numSamples) { Common::StackLock lock(_mutex); - return _sampleConverter.readSamples(buffer, numSamples); + + if (!_state.soundNr) + return 0; + + int samplesLeft = numSamples; + do { + int nSamplesRead = _sampleConverter.readSamples(buffer, samplesLeft); + samplesLeft -= nSamplesRead; + buffer += nSamplesRead; + } while ((samplesLeft > 0) && updateSound()); + + // reset state if sound is played completely + if (_state.finished && (_sampleConverter.availableSize() == 0)) + resetState(); + + return numSamples - samplesLeft; } /************************************ @@ -145,11 +206,11 @@ int Player_AppleII::readBuffer(int16 *buffer, const int numSamples) { // toggle speaker on/off void Player_AppleII::speakerToggle() { - _speakerState ^= 0x1; + _state.speakerState ^= 0x1; } void Player_AppleII::generateSamples(int cycles) { - _sampleConverter.addCycles(_speakerState, cycles); + _sampleConverter.addCycles(_state.speakerState, cycles); } void Player_AppleII::wait(int interval, int count /*y*/) { @@ -168,7 +229,7 @@ void Player_AppleII::_soundFunc1(int interval /*a*/, int count /*y*/) { // D076 } } -void Player_AppleII::soundFunc1() { // D085 +bool Player_AppleII::soundFunc1() { // D085 const int delta = _state.params[0]; const int count = _state.params[1]; byte interval = _state.params[2]; // must be byte ("interval < delta" possible) @@ -186,6 +247,8 @@ void Player_AppleII::soundFunc1() { // D085 interval += delta; } while (interval < limit); } + + return true; } void Player_AppleII::_soundFunc2(int interval /*a*/, int count) { // D0EF @@ -206,13 +269,18 @@ void Player_AppleII::_soundFunc2(int interval /*a*/, int count) { // D0EF } } -void Player_AppleII::soundFunc2() { // D0D6 - for (int pos = 1; pos < 256; ++pos) { - byte interval = _state.params[pos]; +bool Player_AppleII::soundFunc2() { // D0D6 + // while (pos = 1; pos < 256; ++pos) + if (_state.func23.pos < 256) { + byte interval = _state.params[_state.func23.pos]; if (interval == 0xFF) - return; + return true; _soundFunc2(interval, _state.params[0] /*, LD12F=interval*/); - } + + ++_state.func23.pos; + return false; + } + return true; } void Player_AppleII::_soundFunc3(int interval /*a*/, int count /*LD12D*/) { // D14B @@ -229,13 +297,18 @@ void Player_AppleII::_soundFunc3(int interval /*a*/, int count /*LD12D*/) { // D } } -void Player_AppleII::soundFunc3() { // D132 - for (int pos = 1; pos < 256; ++pos) { - byte interval = _state.params[pos]; +bool Player_AppleII::soundFunc3() { // D132 + // while (pos = 1; pos < 256; ++pos) + if (_state.func23.pos < 256) { + byte interval = _state.params[_state.func23.pos]; if (interval == 0xFF) - return; + return true; _soundFunc3(interval, _state.params[0]); + + ++_state.func23.pos; + return false; } + return true; } void Player_AppleII::_soundFunc4(byte param0, byte param1, byte param2) { // D1A2 @@ -258,8 +331,8 @@ void Player_AppleII::_soundFunc4(byte param0, byte param1, byte param2) { // D1A } byte speakerShiftReg = 0; - static byte updateRemain1 = 80; - static byte updateRemain2 = 10; + byte updateRemain1 = _state.func4.updateRemain1; + byte updateRemain2 = _state.func4.updateRemain2; while (true) { --updateRemain1; @@ -285,17 +358,26 @@ void Player_AppleII::_soundFunc4(byte param0, byte param1, byte param2) { // D1A ++count; if (count == 0) { + _state.func4.updateRemain1 = updateRemain1; + _state.func4.updateRemain2 = updateRemain2; return; } } } -void Player_AppleII::soundFunc4() { // D170 - const byte *params = _state.params; - while (params[0] != 0x01) { - _soundFunc4(params[0], params[1], params[2]); - params += 3; +bool Player_AppleII::soundFunc4() { // D170 + if (!_state.localParams) + _state.localParams = _state.params; + + // while (_state.params[0] != 0x01) + if (_state.localParams[0] != 0x01) { + _soundFunc4(_state.localParams[0], _state.localParams[1], _state.localParams[2]); + _state.localParams += 3; + return false; } + + _state.localParams = NULL; + return true; } void Player_AppleII::_soundFunc5(int interval /*a*/, int count) { // D270 @@ -339,20 +421,27 @@ byte /*a*/ Player_AppleII::noise() { // D261 return result; } -void Player_AppleII::soundFunc5() { // D222 +bool Player_AppleII::soundFunc5() { // D222 const byte noiseMask[] = { 0x3F, 0x3F, 0x7F, 0x7F, 0x7F, 0x7F, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F }; int param0 = _state.params[0]; assert(param0 > 0); - for (int i = 0; i < 10; ++i) { + + // while (i = 0; i < 10; ++i) + if (_state.func5.index < 10) { int count = param0; do { - _soundFunc5(noise() & noiseMask[i], 1); + _soundFunc5(noise() & noiseMask[_state.func5.index], 1); --count; } while (count > 0); + + ++_state.func5.index; + return false; } + + return true; } } // End of namespace Scumm diff --git a/engines/scumm/player_appleII.h b/engines/scumm/player_appleII.h index 7cc02b1f01..eb4a99c4bd 100644 --- a/engines/scumm/player_appleII.h +++ b/engines/scumm/player_appleII.h @@ -241,10 +241,34 @@ public: int getRate() const { return _sampleRate; } private: - struct state_t { + struct sound_state { + // sound number + int soundNr; + // type of sound int type; + // number of loops left int loop; + // global sound param list const byte *params; + // local sound param list + const byte *localParams; + // speaker toggle state (0 / 1) + byte speakerState; + // processing complete + bool finished; + // sound type specific data + union { + struct { + byte updateRemain1; + byte updateRemain2; + } func4; + struct { + int pos; + } func23; + struct { + int index; + } func5; + }; } _state; ScummEngine *_vm; @@ -254,25 +278,26 @@ private: Common::Mutex _mutex; private: - byte _speakerState; - int _soundNr; SampleConverter _sampleConverter; private: + void resetState(); + void initFuncState(); + bool updateSound(); void speakerToggle(); void generateSamples(int cycles); void wait(int interval, int count); byte noise(); - void soundFunc1(); + bool soundFunc1(); void _soundFunc1(int interval, int count); - void soundFunc2(); + bool soundFunc2(); void _soundFunc2(int interval, int count); - void soundFunc3(); + bool soundFunc3(); void _soundFunc3(int interval, int count); - void soundFunc4(); + bool soundFunc4(); void _soundFunc4(byte param0, byte param1, byte param2); - void soundFunc5(); + bool soundFunc5(); void _soundFunc5(int interval, int count); }; -- cgit v1.2.3 From 7d551c9e6e8c5a46086f9da5e601561c434bafe0 Mon Sep 17 00:00:00 2001 From: Tobias Gunkel Date: Tue, 20 Dec 2011 12:07:50 +0100 Subject: SCUMM: Wrap player_appleII sound generation functions in classes --- engines/scumm/player_appleII.cpp | 623 ++++++++++++++++++++++----------------- engines/scumm/player_appleII.h | 52 ++-- 2 files changed, 364 insertions(+), 311 deletions(-) (limited to 'engines') diff --git a/engines/scumm/player_appleII.cpp b/engines/scumm/player_appleII.cpp index a4111c5109..a027b522b5 100644 --- a/engines/scumm/player_appleII.cpp +++ b/engines/scumm/player_appleII.cpp @@ -27,10 +27,322 @@ namespace Scumm { +/************************************ + * Apple-II sound-resource parsers + ************************************/ + +/* + * SoundFunction1: frequency up/down + */ +class AppleII_SoundFunction1_FreqUpDown : public AppleII_SoundFunction { +public: + virtual void init(Player_AppleII *player, const byte *params) { + _player = player; + _delta = params[0]; + _count = params[1]; + _interval = params[2]; + _limit = params[3]; + _decInterval = (params[4] >= 0x40); + } + + virtual bool update() { // D085 + if (_decInterval) { + do { + _update(_interval, _count); + _interval -= _delta; + } while (_interval >= _limit); + } else { + do { + _update(_interval, _count); + _interval += _delta; + } while (_interval < _limit); + } + return true; + } + +private: + void _update(int interval /*a*/, int count /*y*/) { // D076 + assert(interval > 0); // 0 == 256? + assert(count > 0); // 0 == 256? + + for (; count >= 0; --count) { + _player->speakerToggle(); + _player->generateSamples(17 + 5 * interval); + } + } + +protected: + int _delta; + int _count; + byte _interval; // must be unsigned byte ("interval < delta" possible) + int _limit; + bool _decInterval; +}; + +/* + * SoundFunction2: symmetric wave (~) + */ +class AppleII_SoundFunction2_SymmetricWave : public AppleII_SoundFunction { +public: + virtual void init(Player_AppleII *player, const byte *params) { + _player = player; + _params = params; + _pos = 1; + } + + virtual bool update() { // D0D6 + // while (pos = 1; pos < 256; ++pos) + if (_pos < 256) { + byte interval = _params[_pos]; + if (interval == 0xFF) + return true; + _update(interval, _params[0] /*, LD12F=interval*/); + + ++_pos; + return false; + } + return true; + } + +private: + void _update(int interval /*a*/, int count) { // D0EF + if (interval == 0xFE) { + _player->wait(interval, 10); + } else { + assert(count > 0); // 0 == 256? + assert(interval > 0); // 0 == 256? + + int a = (interval >> 3) + count; + for (int y = a; y > 0; --y) { + _player->generateSamples(1292 - 5*interval); + _player->speakerToggle(); + + _player->generateSamples(1287 - 5*interval); + _player->speakerToggle(); + } + } + } + +protected: + const byte *_params; + int _pos; +}; + +/* + * SoundFunction3: asymmetric wave (__-) + */ +class AppleII_SoundFunction3_AsymmetricWave : public AppleII_SoundFunction { +public: + virtual void init(Player_AppleII *player, const byte *params) { + _player = player; + _params = params; + _pos = 1; + } + + virtual bool update() { // D132 + // while (pos = 1; pos < 256; ++pos) + if (_pos < 256) { + byte interval = _params[_pos]; + if (interval == 0xFF) + return true; + _update(interval, _params[0]); + + ++_pos; + return false; + } + return true; + } + +private: + void _update(int interval /*a*/, int count /*LD12D*/) { // D14B + if (interval == 0xFE) { + _player->wait(interval, 70); + } else { + assert(interval > 0); // 0 == 256? + assert(count > 0); // 0 == 256? + + for (int y = count; y > 0; --y) { + _player->generateSamples(1289 - 5*interval); + _player->speakerToggle(); + } + } + } + +protected: + const byte *_params; + int _pos; +}; + +/* + * SoundFunction4: polyphone (2 voices) + */ +class AppleII_SoundFunction4_Polyphone : public AppleII_SoundFunction { +public: + virtual void init(Player_AppleII *player, const byte *params) { + _player = player; + _params = params; + _updateRemain1 = 80; + _updateRemain2 = 10; + } + + virtual bool update() { // D170 + // while (_state.params[0] != 0x01) + if (_params[0] != 0x01) { + _update(_params[0], _params[1], _params[2]); + _params += 3; + return false; + } + return true; + } + +private: + void _update(byte param0, byte param1, byte param2) { // D1A2 + uint16 count = (-param2 << 8) | 0x3; + byte bitmask1 = 0x3; + byte bitmask2 = 0x3; + + byte updateInterval2 = param0; + if (updateInterval2 == 0) + bitmask2 = 0x0; + + byte updateInterval1 = param1; + if (updateInterval1 == 0) { + bitmask1 = 0x0; + if (bitmask2 != 0) { + bitmask1 = bitmask2; + bitmask2 = 0; + updateInterval1 = updateInterval2; + } + } + + byte speakerShiftReg = 0; + + while (true) { + --_updateRemain1; + --_updateRemain2; + + if (_updateRemain2 == 0) { + _updateRemain2 = updateInterval2; + // use only first voice's data (bitmask1) if both voices are triggered + if (_updateRemain1 != 0) { + speakerShiftReg ^= bitmask2; + } + } + + if (_updateRemain1 == 0) { + _updateRemain1 = updateInterval1; + speakerShiftReg ^= bitmask1; + } + + if (speakerShiftReg & 0x1) + _player->speakerToggle(); + speakerShiftReg >>= 1; + _player->generateSamples(42); /* actually 42.5 */ + + ++count; + if (count == 0) { + return; + } + } + } + +protected: + const byte *_params; + byte _updateRemain1; + byte _updateRemain2; +}; + +/* + * SoundFunction5: periodic noise + */ +class AppleII_SoundFunction5_Noise : public AppleII_SoundFunction { +public: + virtual void init(Player_AppleII *player, const byte *params) { + _player = player; + _index = 0; + _param0 = params[0]; + assert(_param0 > 0); + } + + virtual bool update() { // D222 + const byte noiseMask[] = { + 0x3F, 0x3F, 0x7F, 0x7F, 0x7F, 0x7F, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F + }; + + // while (i = 0; i < 10; ++i) + if (_index < 10) { + int count = _param0; + do { + _update(noise() & noiseMask[_index], 1); + --count; + } while (count > 0); + + ++_index; + return false; + } + + return true; + } + +private: + void _update(int interval /*a*/, int count) { // D270 + assert(count > 0); // 0 == 256? + if (interval == 0) + interval = 256; + + for (int i = count; i > 0; --i) { + _player->generateSamples(10 + 5*interval); + _player->speakerToggle(); + + _player->generateSamples(5 + 5*interval); + _player->speakerToggle(); + } + } + + byte /*a*/ noise() { // D261 + static int pos = 0; // initial value? + byte result = _noiseTable[pos]; + pos = (pos + 1) % 256; + return result; + } + +protected: + int _index; + int _param0; + +private: + static const byte _noiseTable[256]; +}; + +// LD000[loc] ^ LD00A[loc] +const byte AppleII_SoundFunction5_Noise::_noiseTable[256] = { + 0x65, 0x1b, 0xda, 0x11, 0x61, 0xe5, 0x77, 0x57, 0x92, 0xc8, 0x51, 0x1c, 0xd4, 0x91, 0x62, 0x63, + 0x00, 0x38, 0x57, 0xd5, 0x18, 0xd8, 0xdc, 0x40, 0x03, 0x86, 0xd3, 0x2f, 0x10, 0x11, 0xd8, 0x3c, + 0xbe, 0x00, 0x19, 0xc5, 0xd2, 0xc3, 0xca, 0x34, 0x00, 0x28, 0xbf, 0xb9, 0x18, 0x20, 0x01, 0xcc, + 0xda, 0x08, 0xbc, 0x75, 0x7c, 0xb0, 0x8d, 0xe0, 0x09, 0x18, 0xbf, 0x5d, 0xe9, 0x8c, 0x75, 0x64, + 0xe5, 0xb5, 0x5d, 0xe0, 0xb7, 0x7d, 0xe9, 0x8c, 0x55, 0x65, 0xc5, 0xb5, 0x5d, 0xd8, 0x09, 0x0d, + 0x64, 0xf0, 0xf0, 0x08, 0x63, 0x03, 0x00, 0x55, 0x35, 0xc0, 0x00, 0x20, 0x74, 0xa5, 0x1e, 0xe3, + 0x00, 0x06, 0x3c, 0x52, 0xd1, 0x70, 0xd0, 0x57, 0x02, 0xf0, 0x00, 0xb6, 0xfc, 0x02, 0x11, 0x9a, + 0x3b, 0xc8, 0x38, 0xdf, 0x1a, 0xb0, 0xd1, 0xb8, 0xd0, 0x18, 0x8a, 0x4a, 0xea, 0x1b, 0x12, 0x5d, + 0x29, 0x58, 0xd8, 0x43, 0xb8, 0x2d, 0xd2, 0x61, 0x10, 0x3c, 0x0c, 0x5d, 0x1b, 0x61, 0x10, 0x3c, + 0x0a, 0x5d, 0x1d, 0x61, 0x10, 0x3c, 0x0b, 0x19, 0x88, 0x21, 0xc0, 0x21, 0x07, 0x00, 0x65, 0x62, + 0x08, 0xe9, 0x36, 0x40, 0x20, 0x41, 0x06, 0x00, 0x20, 0x00, 0x00, 0xed, 0xa3, 0x00, 0x88, 0x06, + 0x98, 0x01, 0x5d, 0x7f, 0x02, 0x1d, 0x78, 0x03, 0x60, 0xcb, 0x3a, 0x01, 0xbd, 0x78, 0x02, 0x5d, + 0x7e, 0x03, 0x1d, 0xf5, 0xa6, 0x40, 0x81, 0xb4, 0xd0, 0x8d, 0xd3, 0xd0, 0x6d, 0xd5, 0x61, 0x48, + 0x61, 0x4d, 0xd1, 0xc8, 0xb1, 0xd8, 0x69, 0xff, 0x61, 0xd9, 0xed, 0xa0, 0xfe, 0x19, 0x91, 0x37, + 0x19, 0x37, 0x00, 0xf1, 0x00, 0x01, 0x1f, 0x00, 0xad, 0xc1, 0x01, 0x01, 0x2e, 0x00, 0x40, 0xc6, + 0x7a, 0x9b, 0x95, 0x43, 0xfc, 0x18, 0xd2, 0x9e, 0x2a, 0x5a, 0x4b, 0x2a, 0xb6, 0x87, 0x30, 0x6c +}; + +/************************************ + * Apple-II player + ************************************/ + Player_AppleII::Player_AppleII(ScummEngine *scumm, Audio::Mixer *mixer) { _mixer = mixer; _vm = scumm; + _state.soundFunc = 0; resetState(); setSampleRate(_mixer->getOutputRate()); @@ -40,6 +352,7 @@ Player_AppleII::Player_AppleII(ScummEngine *scumm, Audio::Mixer *mixer) { Player_AppleII::~Player_AppleII() { _mixer->stopHandle(_soundHandle); + delete _state.soundFunc; } /* @@ -69,77 +382,56 @@ void logSounds() { void Player_AppleII::startSound(int nr) { Common::StackLock lock(_mutex); - resetState(); - byte *data = _vm->getResourceAddress(rtSound, nr); assert(data); byte *ptr1 = data + 4; + resetState(); + _state.soundNr = nr; _state.type = ptr1[0]; - if (_state.type == 0) { - // nothing to play + _state.loop = ptr1[1]; + _state.params = &ptr1[2]; + + switch (_state.type) { + case 0: // empty (nothing to play) resetState(); return; + case 1: + _state.soundFunc = new AppleII_SoundFunction1_FreqUpDown(); + break; + case 2: + _state.soundFunc = new AppleII_SoundFunction2_SymmetricWave(); + break; + case 3: + _state.soundFunc = new AppleII_SoundFunction3_AsymmetricWave(); + break; + case 4: + _state.soundFunc = new AppleII_SoundFunction4_Polyphone(); + break; + case 5: + _state.soundFunc = new AppleII_SoundFunction5_Noise(); + break; } + _state.soundFunc->init(this, _state.params); - _state.soundNr = nr; - _state.finished = false; - initFuncState(); - - _state.loop = ptr1[1]; assert(_state.loop > 0); - _state.params = &ptr1[2]; - debug(4, "startSound %d: type %d, loop %d", nr, _state.type, _state.loop); } -void Player_AppleII::initFuncState() { - switch (_state.type) { - case 2: case 3: - _state.func23.pos = 1; - break; - case 4: - _state.func4.updateRemain1 = 80; - _state.func4.updateRemain2 = 10; - break; - case 5: - _state.func5.index = 0; - break; - } -} - bool Player_AppleII::updateSound() { - if (!_state.soundNr || _state.finished) + if (!_state.soundFunc) return false; - bool done = false; - switch (_state.type) { - case 1: // freq up/down - done = soundFunc1(); - break; - case 2: // symmetric wave (~) - done = soundFunc2(); - break; - case 3: // asymmetric wave (__-) - done = soundFunc3(); - break; - case 4: // polyphone (2 voices) - done = soundFunc4(); - break; - case 5: // periodic noise - done = soundFunc5(); - break; - } - - if (done) { + if (_state.soundFunc->update()) { --_state.loop; if (_state.loop <= 0) { - _state.finished = true; + delete _state.soundFunc; + _state.soundFunc = 0; } else { // reset function state on each loop - initFuncState(); + _state.soundFunc->init(this, _state.params); } } @@ -151,9 +443,9 @@ void Player_AppleII::resetState() { _state.type = 0; _state.loop = 0; _state.params = NULL; - _state.localParams = NULL; _state.speakerState = 0; - _state.finished = true; + delete _state.soundFunc; + _state.soundFunc = 0; _sampleConverter.reset(); } @@ -194,14 +486,14 @@ int Player_AppleII::readBuffer(int16 *buffer, const int numSamples) { } while ((samplesLeft > 0) && updateSound()); // reset state if sound is played completely - if (_state.finished && (_sampleConverter.availableSize() == 0)) + if (!_state.soundFunc && (_sampleConverter.availableSize() == 0)) resetState(); return numSamples - samplesLeft; } /************************************ - * Apple-II sound-resource parser + * Apple-II sound-resource helpers ************************************/ // toggle speaker on/off @@ -219,229 +511,4 @@ void Player_AppleII::wait(int interval, int count /*y*/) { generateSamples(11 + count*(8 + 5 * interval)); } -void Player_AppleII::_soundFunc1(int interval /*a*/, int count /*y*/) { // D076 - assert(interval > 0); // 0 == 256? - assert(count > 0); // 0 == 256? - - for (; count >= 0; --count) { - speakerToggle(); - generateSamples(17 + 5 * interval); - } -} - -bool Player_AppleII::soundFunc1() { // D085 - const int delta = _state.params[0]; - const int count = _state.params[1]; - byte interval = _state.params[2]; // must be byte ("interval < delta" possible) - const int limit = _state.params[3]; - const bool decInterval = (_state.params[4] >= 0x40); - - if (decInterval) { - do { - _soundFunc1(interval, count); - interval -= delta; - } while (interval >= limit); - } else { - do { - _soundFunc1(interval, count); - interval += delta; - } while (interval < limit); - } - - return true; -} - -void Player_AppleII::_soundFunc2(int interval /*a*/, int count) { // D0EF - if (interval == 0xFE) { - wait(interval, 10); - } else { - assert(count > 0); // 0 == 256? - assert(interval > 0); // 0 == 256? - - int a = (interval >> 3) + count; - for (int y = a; y > 0; --y) { - generateSamples(1292 - 5*interval); - speakerToggle(); - - generateSamples(1287 - 5*interval); - speakerToggle(); - } - } -} - -bool Player_AppleII::soundFunc2() { // D0D6 - // while (pos = 1; pos < 256; ++pos) - if (_state.func23.pos < 256) { - byte interval = _state.params[_state.func23.pos]; - if (interval == 0xFF) - return true; - _soundFunc2(interval, _state.params[0] /*, LD12F=interval*/); - - ++_state.func23.pos; - return false; - } - return true; -} - -void Player_AppleII::_soundFunc3(int interval /*a*/, int count /*LD12D*/) { // D14B - if (interval == 0xFE) { - wait(interval, 70); - } else { - assert(interval > 0); // 0 == 256? - assert(count > 0); // 0 == 256? - - for (int y = count; y > 0; --y) { - generateSamples(1289 - 5*interval); - speakerToggle(); - } - } -} - -bool Player_AppleII::soundFunc3() { // D132 - // while (pos = 1; pos < 256; ++pos) - if (_state.func23.pos < 256) { - byte interval = _state.params[_state.func23.pos]; - if (interval == 0xFF) - return true; - _soundFunc3(interval, _state.params[0]); - - ++_state.func23.pos; - return false; - } - return true; -} - -void Player_AppleII::_soundFunc4(byte param0, byte param1, byte param2) { // D1A2 - uint16 count = (-param2 << 8) | 0x3; - byte bitmask1 = 0x3; - byte bitmask2 = 0x3; - - byte updateInterval2 = param0; - if (updateInterval2 == 0) - bitmask2 = 0x0; - - byte updateInterval1 = param1; - if (updateInterval1 == 0) { - bitmask1 = 0x0; - if (bitmask2 != 0) { - bitmask1 = bitmask2; - bitmask2 = 0; - updateInterval1 = updateInterval2; - } - } - - byte speakerShiftReg = 0; - byte updateRemain1 = _state.func4.updateRemain1; - byte updateRemain2 = _state.func4.updateRemain2; - - while (true) { - --updateRemain1; - --updateRemain2; - - if (updateRemain2 == 0) { - updateRemain2 = updateInterval2; - // use only first voice's data (bitmask1) if both voices are triggered - if (updateRemain1 != 0) { - speakerShiftReg ^= bitmask2; - } - } - - if (updateRemain1 == 0) { - updateRemain1 = updateInterval1; - speakerShiftReg ^= bitmask1; - } - - if (speakerShiftReg & 0x1) - speakerToggle(); - speakerShiftReg >>= 1; - generateSamples(42); /* actually 42.5 */ - - ++count; - if (count == 0) { - _state.func4.updateRemain1 = updateRemain1; - _state.func4.updateRemain2 = updateRemain2; - return; - } - } -} - -bool Player_AppleII::soundFunc4() { // D170 - if (!_state.localParams) - _state.localParams = _state.params; - - // while (_state.params[0] != 0x01) - if (_state.localParams[0] != 0x01) { - _soundFunc4(_state.localParams[0], _state.localParams[1], _state.localParams[2]); - _state.localParams += 3; - return false; - } - - _state.localParams = NULL; - return true; -} - -void Player_AppleII::_soundFunc5(int interval /*a*/, int count) { // D270 - assert(count > 0); // 0 == 256? - if (interval == 0) - interval = 256; - - for (int i = count; i > 0; --i) { - generateSamples(10 + 5*interval); - speakerToggle(); - - generateSamples(5 + 5*interval); - speakerToggle(); - } -} - -// LD000[loc] ^ LD00A[loc] -static const byte noiseTable[256] = { - 0x65, 0x1b, 0xda, 0x11, 0x61, 0xe5, 0x77, 0x57, 0x92, 0xc8, 0x51, 0x1c, 0xd4, 0x91, 0x62, 0x63, - 0x00, 0x38, 0x57, 0xd5, 0x18, 0xd8, 0xdc, 0x40, 0x03, 0x86, 0xd3, 0x2f, 0x10, 0x11, 0xd8, 0x3c, - 0xbe, 0x00, 0x19, 0xc5, 0xd2, 0xc3, 0xca, 0x34, 0x00, 0x28, 0xbf, 0xb9, 0x18, 0x20, 0x01, 0xcc, - 0xda, 0x08, 0xbc, 0x75, 0x7c, 0xb0, 0x8d, 0xe0, 0x09, 0x18, 0xbf, 0x5d, 0xe9, 0x8c, 0x75, 0x64, - 0xe5, 0xb5, 0x5d, 0xe0, 0xb7, 0x7d, 0xe9, 0x8c, 0x55, 0x65, 0xc5, 0xb5, 0x5d, 0xd8, 0x09, 0x0d, - 0x64, 0xf0, 0xf0, 0x08, 0x63, 0x03, 0x00, 0x55, 0x35, 0xc0, 0x00, 0x20, 0x74, 0xa5, 0x1e, 0xe3, - 0x00, 0x06, 0x3c, 0x52, 0xd1, 0x70, 0xd0, 0x57, 0x02, 0xf0, 0x00, 0xb6, 0xfc, 0x02, 0x11, 0x9a, - 0x3b, 0xc8, 0x38, 0xdf, 0x1a, 0xb0, 0xd1, 0xb8, 0xd0, 0x18, 0x8a, 0x4a, 0xea, 0x1b, 0x12, 0x5d, - 0x29, 0x58, 0xd8, 0x43, 0xb8, 0x2d, 0xd2, 0x61, 0x10, 0x3c, 0x0c, 0x5d, 0x1b, 0x61, 0x10, 0x3c, - 0x0a, 0x5d, 0x1d, 0x61, 0x10, 0x3c, 0x0b, 0x19, 0x88, 0x21, 0xc0, 0x21, 0x07, 0x00, 0x65, 0x62, - 0x08, 0xe9, 0x36, 0x40, 0x20, 0x41, 0x06, 0x00, 0x20, 0x00, 0x00, 0xed, 0xa3, 0x00, 0x88, 0x06, - 0x98, 0x01, 0x5d, 0x7f, 0x02, 0x1d, 0x78, 0x03, 0x60, 0xcb, 0x3a, 0x01, 0xbd, 0x78, 0x02, 0x5d, - 0x7e, 0x03, 0x1d, 0xf5, 0xa6, 0x40, 0x81, 0xb4, 0xd0, 0x8d, 0xd3, 0xd0, 0x6d, 0xd5, 0x61, 0x48, - 0x61, 0x4d, 0xd1, 0xc8, 0xb1, 0xd8, 0x69, 0xff, 0x61, 0xd9, 0xed, 0xa0, 0xfe, 0x19, 0x91, 0x37, - 0x19, 0x37, 0x00, 0xf1, 0x00, 0x01, 0x1f, 0x00, 0xad, 0xc1, 0x01, 0x01, 0x2e, 0x00, 0x40, 0xc6, - 0x7a, 0x9b, 0x95, 0x43, 0xfc, 0x18, 0xd2, 0x9e, 0x2a, 0x5a, 0x4b, 0x2a, 0xb6, 0x87, 0x30, 0x6c -}; - -byte /*a*/ Player_AppleII::noise() { // D261 - static int pos = 0; // initial value? - byte result = noiseTable[pos]; - pos = (pos + 1) % 256; - return result; -} - -bool Player_AppleII::soundFunc5() { // D222 - const byte noiseMask[] = { - 0x3F, 0x3F, 0x7F, 0x7F, 0x7F, 0x7F, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F - }; - - int param0 = _state.params[0]; - assert(param0 > 0); - - // while (i = 0; i < 10; ++i) - if (_state.func5.index < 10) { - int count = param0; - do { - _soundFunc5(noise() & noiseMask[_state.func5.index], 1); - --count; - } while (count > 0); - - ++_state.func5.index; - return false; - } - - return true; -} - } // End of namespace Scumm diff --git a/engines/scumm/player_appleII.h b/engines/scumm/player_appleII.h index eb4a99c4bd..91c7935f76 100644 --- a/engines/scumm/player_appleII.h +++ b/engines/scumm/player_appleII.h @@ -217,6 +217,8 @@ private: DynamicMemoryStream _buffer; }; +class AppleII_SoundFunction; + class Player_AppleII : public Audio::AudioStream, public MusicEngine { public: Player_AppleII(ScummEngine *scumm, Audio::Mixer *mixer); @@ -240,6 +242,11 @@ public: bool endOfData() const { return false; } int getRate() const { return _sampleRate; } +public: + void speakerToggle(); + void generateSamples(int cycles); + void wait(int interval, int count); + private: struct sound_state { // sound number @@ -250,25 +257,10 @@ private: int loop; // global sound param list const byte *params; - // local sound param list - const byte *localParams; // speaker toggle state (0 / 1) byte speakerState; - // processing complete - bool finished; - // sound type specific data - union { - struct { - byte updateRemain1; - byte updateRemain2; - } func4; - struct { - int pos; - } func23; - struct { - int index; - } func5; - }; + // sound function + AppleII_SoundFunction *soundFunc; } _state; ScummEngine *_vm; @@ -282,23 +274,17 @@ private: private: void resetState(); - void initFuncState(); bool updateSound(); - void speakerToggle(); - void generateSamples(int cycles); - void wait(int interval, int count); - byte noise(); - - bool soundFunc1(); - void _soundFunc1(int interval, int count); - bool soundFunc2(); - void _soundFunc2(int interval, int count); - bool soundFunc3(); - void _soundFunc3(int interval, int count); - bool soundFunc4(); - void _soundFunc4(byte param0, byte param1, byte param2); - bool soundFunc5(); - void _soundFunc5(int interval, int count); +}; + +class AppleII_SoundFunction { +public: + AppleII_SoundFunction() {} + virtual ~AppleII_SoundFunction() {} + virtual void init(Player_AppleII *player, const byte *params) = 0; + virtual bool update() = 0; +protected: + Player_AppleII *_player; }; } // End of namespace Scumm -- cgit v1.2.3 From 3a9f2c5f5bb817b4acbe279aedae938679634257 Mon Sep 17 00:00:00 2001 From: Tobias Gunkel Date: Tue, 20 Dec 2011 13:18:27 +0100 Subject: SCUMM: Use finer grained sound updates for player_appleII This reduces the needed buffer size for the biggest type4 sound from 170kB to only 2 bytes --- engines/scumm/player_appleII.cpp | 99 +++++++++++++++++++++++----------------- engines/scumm/player_appleII.h | 1 + 2 files changed, 59 insertions(+), 41 deletions(-) (limited to 'engines') diff --git a/engines/scumm/player_appleII.cpp b/engines/scumm/player_appleII.cpp index a027b522b5..b566012d73 100644 --- a/engines/scumm/player_appleII.cpp +++ b/engines/scumm/player_appleII.cpp @@ -183,73 +183,90 @@ public: _params = params; _updateRemain1 = 80; _updateRemain2 = 10; + _count = 0; } virtual bool update() { // D170 // while (_state.params[0] != 0x01) if (_params[0] != 0x01) { - _update(_params[0], _params[1], _params[2]); - _params += 3; + if (_count == 0) // prepare next loop + nextLoop(_params[0], _params[1], _params[2]); + if (loopIteration()) // loop finished -> fetch next parameter set + _params += 3; return false; } return true; } private: - void _update(byte param0, byte param1, byte param2) { // D1A2 - uint16 count = (-param2 << 8) | 0x3; - byte bitmask1 = 0x3; - byte bitmask2 = 0x3; + /* + * prepare for next parameter set loop + */ + void nextLoop(byte param0, byte param1, byte param2) { // LD182 + _count = (-param2 << 8) | 0x3; + + _bitmask1 = 0x3; + _bitmask2 = 0x3; - byte updateInterval2 = param0; - if (updateInterval2 == 0) - bitmask2 = 0x0; - - byte updateInterval1 = param1; - if (updateInterval1 == 0) { - bitmask1 = 0x0; - if (bitmask2 != 0) { - bitmask1 = bitmask2; - bitmask2 = 0; - updateInterval1 = updateInterval2; + _updateInterval2 = param0; + if (_updateInterval2 == 0) + _bitmask2 = 0x0; + + _updateInterval1 = param1; + if (_updateInterval1 == 0) { + _bitmask1 = 0x0; + if (_bitmask2 != 0) { + _bitmask1 = _bitmask2; + _bitmask2 = 0; + _updateInterval1 = _updateInterval2; } } - byte speakerShiftReg = 0; - - while (true) { - --_updateRemain1; - --_updateRemain2; + _speakerShiftReg = 0; + } - if (_updateRemain2 == 0) { - _updateRemain2 = updateInterval2; - // use only first voice's data (bitmask1) if both voices are triggered - if (_updateRemain1 != 0) { - speakerShiftReg ^= bitmask2; - } + /* + * perform one loop iteration + * Returns true if loop finished + */ + bool loopIteration() { // D1A2 + --_updateRemain1; + --_updateRemain2; + + if (_updateRemain2 == 0) { + _updateRemain2 = _updateInterval2; + // use only first voice's data (bitmask1) if both voices are triggered + if (_updateRemain1 != 0) { + _speakerShiftReg ^= _bitmask2; } + } - if (_updateRemain1 == 0) { - _updateRemain1 = updateInterval1; - speakerShiftReg ^= bitmask1; - } + if (_updateRemain1 == 0) { + _updateRemain1 = _updateInterval1; + _speakerShiftReg ^= _bitmask1; + } - if (speakerShiftReg & 0x1) - _player->speakerToggle(); - speakerShiftReg >>= 1; - _player->generateSamples(42); /* actually 42.5 */ + if (_speakerShiftReg & 0x1) + _player->speakerToggle(); + _speakerShiftReg >>= 1; + _player->generateSamples(42); /* actually 42.5 */ - ++count; - if (count == 0) { - return; - } - } + ++_count; + return (_count == 0); } protected: const byte *_params; + byte _updateRemain1; byte _updateRemain2; + + uint16 _count; + byte _bitmask1; + byte _bitmask2; + byte _updateInterval1; + byte _updateInterval2; + byte _speakerShiftReg; }; /* diff --git a/engines/scumm/player_appleII.h b/engines/scumm/player_appleII.h index 91c7935f76..f0b148ef86 100644 --- a/engines/scumm/player_appleII.h +++ b/engines/scumm/player_appleII.h @@ -282,6 +282,7 @@ public: AppleII_SoundFunction() {} virtual ~AppleII_SoundFunction() {} virtual void init(Player_AppleII *player, const byte *params) = 0; + /* returns true if finished */ virtual bool update() = 0; protected: Player_AppleII *_player; -- cgit v1.2.3 From f7a869ccc5c22212768c43f258a7fbf7dddb758f Mon Sep 17 00:00:00 2001 From: Tobias Gunkel Date: Wed, 21 Dec 2011 10:10:42 +0100 Subject: SCUMM: Optimize player_appleII sample buffer The AppleII sound player works in two phases: writing samples to the sample buffer (sample generation) or reading samples from the buffer and passing it to ScummVM's output callback. The sample buffer is read completely in the reading phase so the entries of the already read samples of the buffer can be reused again during the next write phase. --- engines/scumm/player_appleII.h | 84 +++++++++++++++++++++++++----------------- 1 file changed, 50 insertions(+), 34 deletions(-) (limited to 'engines') diff --git a/engines/scumm/player_appleII.h b/engines/scumm/player_appleII.h index f0b148ef86..1f53b6a8dc 100644 --- a/engines/scumm/player_appleII.h +++ b/engines/scumm/player_appleII.h @@ -35,13 +35,20 @@ namespace Scumm { class ScummEngine; -class DynamicMemoryStream { +/* + * Optimized for use with periodical read/write phases when the buffer + * is filled in a write phase and completely read in a read phase. + * The growing strategy is optimized for repeated small (e.g. 2 bytes) + * single writes resulting in large buffers + * (avg.: 4KB, max: 18KB @ 16bit/22.050kHz (MM sound21)). + */ +class SampleBuffer { public: - DynamicMemoryStream() : _data(0) { + SampleBuffer() : _data(0) { clear(); } - ~DynamicMemoryStream() { + ~SampleBuffer() { free(_data); } @@ -49,50 +56,61 @@ public: free(_data); _data = 0; _capacity = 0; - _size = 0; - _ptr = 0; - _pos = 0; + _writePos = 0; _readPos = 0; } - void ensureCapacity(uint32 new_len) { - if (new_len <= _capacity) + void ensureFree(uint32 needed) { + // if data was read completely, reset read/write pos to front + if ((_writePos != 0) && (_writePos == _readPos)) { + _writePos = 0; + _readPos = 0; + } + + // check for enough space at end of buffer + uint32 freeEndCnt = _capacity - _writePos; + if (needed <= freeEndCnt) return; - byte *old_data = _data; + uint32 avail = availableSize(); + + // check for enough space at beginning and end of buffer + if (needed <= _readPos + freeEndCnt) { + // move unread data to front of buffer + memmove(_data, _data + _readPos, avail); + _writePos = avail; + _readPos = 0; + } else { // needs a grow + byte *old_data = _data; + uint32 new_len = avail + needed; - _capacity *= 2; - if (_capacity < new_len + 2048) _capacity = new_len + 2048; - _data = (byte *)malloc(_capacity); - _ptr = _data + _pos; - - if (old_data) { - // Copy old data - memcpy(_data, old_data, _size); - free(old_data); + _data = (byte *)malloc(_capacity); + + if (old_data) { + // copy old unread data to front of new buffer + memcpy(_data, old_data + _readPos, avail); + free(old_data); + _writePos = avail; + _readPos = 0; + } } - - _size = new_len; } uint32 availableSize() const { - if (_readPos >= _size) + if (_readPos >= _writePos) return 0; - return _size - _readPos; + return _writePos - _readPos; } virtual uint32 write(const void *dataPtr, uint32 dataSize) { - ensureCapacity(_pos + dataSize); - memcpy(_ptr, dataPtr, dataSize); - _ptr += dataSize; - _pos += dataSize; - if (_pos > _size) - _size = _pos; + ensureFree(dataSize); + memcpy(_data + _writePos, dataPtr, dataSize); + _writePos += dataSize; return dataSize; } - uint32 read(byte *dataPtr, uint32 dataSize) const { + uint32 read(byte *dataPtr, uint32 dataSize) { uint32 avail = availableSize(); if (avail == 0) return 0; @@ -104,12 +122,10 @@ public: } private: - mutable uint32 _readPos; + uint32 _writePos; + uint32 _readPos; uint32 _capacity; - uint32 _size; - byte *_ptr; byte *_data; - uint32 _pos; }; // CPU_CLOCK according to AppleWin @@ -214,7 +230,7 @@ private: int _sampleCyclesSumFP; /* (fixed precision) */ int _volume; /* 0 - 256 */ static const int _maxVolume = 256; - DynamicMemoryStream _buffer; + SampleBuffer _buffer; }; class AppleII_SoundFunction; -- cgit v1.2.3 From 12103981b786d81e96ec38cc5ff24c3ce3bd9909 Mon Sep 17 00:00:00 2001 From: Tobias Gunkel Date: Wed, 21 Dec 2011 10:12:47 +0100 Subject: SCUMM: Remove player_appleII logging --- engines/scumm/player_appleII.cpp | 24 ------------------------ engines/scumm/player_appleII.h | 14 -------------- 2 files changed, 38 deletions(-) (limited to 'engines') diff --git a/engines/scumm/player_appleII.cpp b/engines/scumm/player_appleII.cpp index b566012d73..0631bcd055 100644 --- a/engines/scumm/player_appleII.cpp +++ b/engines/scumm/player_appleII.cpp @@ -372,30 +372,6 @@ Player_AppleII::~Player_AppleII() { delete _state.soundFunc; } -/* -void logSounds() { - for (nr = 1; nr < 70; ++nr) { - switch (nr) { - // non-existing or invalid - case 3: case 4: case 5: case 49: case 51: case 68: - continue; - } - - byte *data = _vm->getResourceAddress(rtSound, nr); - if (data) { - size_t size = (data[1] << 8) | data[0]; - - std::stringstream s; - s << "d:/msound/sound" << nr << ".snd"; - FILE *f = fopen(s.str().c_str(), "wb"); - fwrite(data, 1, size, f); - fclose(f); - printf("sound: %d\n", nr); - } - } -} -*/ - void Player_AppleII::startSound(int nr) { Common::StackLock lock(_mutex); diff --git a/engines/scumm/player_appleII.h b/engines/scumm/player_appleII.h index 1f53b6a8dc..a44e7b6afe 100644 --- a/engines/scumm/player_appleII.h +++ b/engines/scumm/player_appleII.h @@ -207,20 +207,6 @@ public: return _buffer.read((byte*)buffer, numSamples * 2) / 2; } -#if 0 - void logToFile(Common::String fileName) { - FILE *f; - byte buffer[512]; - int n; - - f = fopen(fileName.c_str(), "wb"); - while ((n = _buffer.read(buffer, 512)) != 0) { - fwrite(buffer, 1, n, f); - } - fclose(f); - } -#endif - private: static const int PREC_SHIFT = 7; -- cgit v1.2.3 From 8b77f18c9e88ec2cea559578e10b33399f40a82d Mon Sep 17 00:00:00 2001 From: Tobias Gunkel Date: Thu, 22 Dec 2011 10:53:25 +0100 Subject: SCUMM: Revert now obsolete separation of state variables in player_appleII --- engines/scumm/player_appleII.cpp | 88 +++++++++++++++++++--------------------- engines/scumm/player_appleII.h | 61 +++++++++++++++------------- 2 files changed, 73 insertions(+), 76 deletions(-) (limited to 'engines') diff --git a/engines/scumm/player_appleII.cpp b/engines/scumm/player_appleII.cpp index 0631bcd055..f250f686e6 100644 --- a/engines/scumm/player_appleII.cpp +++ b/engines/scumm/player_appleII.cpp @@ -187,7 +187,7 @@ public: } virtual bool update() { // D170 - // while (_state.params[0] != 0x01) + // while (_params[0] != 0x01) if (_params[0] != 0x01) { if (_count == 0) // prepare next loop nextLoop(_params[0], _params[1], _params[2]); @@ -355,21 +355,27 @@ const byte AppleII_SoundFunction5_Noise::_noiseTable[256] = { * Apple-II player ************************************/ -Player_AppleII::Player_AppleII(ScummEngine *scumm, Audio::Mixer *mixer) { - _mixer = mixer; - _vm = scumm; - - _state.soundFunc = 0; +Player_AppleII::Player_AppleII(ScummEngine *scumm, Audio::Mixer *mixer) + : _mixer(mixer), _vm(scumm), _soundFunc(0) { resetState(); - setSampleRate(_mixer->getOutputRate()); - _mixer->playStream(Audio::Mixer::kPlainSoundType, &_soundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true); } Player_AppleII::~Player_AppleII() { _mixer->stopHandle(_soundHandle); - delete _state.soundFunc; + delete _soundFunc; +} + +void Player_AppleII::resetState() { + _soundNr = 0; + _type = 0; + _loop = 0; + _params = NULL; + _speakerState = 0; + delete _soundFunc; + _soundFunc = 0; + _sampleConverter.reset(); } void Player_AppleII::startSound(int nr) { @@ -380,69 +386,57 @@ void Player_AppleII::startSound(int nr) { byte *ptr1 = data + 4; resetState(); - _state.soundNr = nr; - _state.type = ptr1[0]; - _state.loop = ptr1[1]; - _state.params = &ptr1[2]; + _soundNr = nr; + _type = ptr1[0]; + _loop = ptr1[1]; + _params = &ptr1[2]; - switch (_state.type) { + switch (_type) { case 0: // empty (nothing to play) resetState(); return; case 1: - _state.soundFunc = new AppleII_SoundFunction1_FreqUpDown(); + _soundFunc = new AppleII_SoundFunction1_FreqUpDown(); break; case 2: - _state.soundFunc = new AppleII_SoundFunction2_SymmetricWave(); + _soundFunc = new AppleII_SoundFunction2_SymmetricWave(); break; case 3: - _state.soundFunc = new AppleII_SoundFunction3_AsymmetricWave(); + _soundFunc = new AppleII_SoundFunction3_AsymmetricWave(); break; case 4: - _state.soundFunc = new AppleII_SoundFunction4_Polyphone(); + _soundFunc = new AppleII_SoundFunction4_Polyphone(); break; case 5: - _state.soundFunc = new AppleII_SoundFunction5_Noise(); + _soundFunc = new AppleII_SoundFunction5_Noise(); break; } - _state.soundFunc->init(this, _state.params); + _soundFunc->init(this, _params); - assert(_state.loop > 0); + assert(_loop > 0); debug(4, "startSound %d: type %d, loop %d", - nr, _state.type, _state.loop); + nr, _type, _loop); } bool Player_AppleII::updateSound() { - if (!_state.soundFunc) + if (!_soundFunc) return false; - if (_state.soundFunc->update()) { - --_state.loop; - if (_state.loop <= 0) { - delete _state.soundFunc; - _state.soundFunc = 0; + if (_soundFunc->update()) { + --_loop; + if (_loop <= 0) { + delete _soundFunc; + _soundFunc = 0; } else { // reset function state on each loop - _state.soundFunc->init(this, _state.params); + _soundFunc->init(this, _params); } } return true; } -void Player_AppleII::resetState() { - _state.soundNr = 0; - _state.type = 0; - _state.loop = 0; - _state.params = NULL; - _state.speakerState = 0; - delete _state.soundFunc; - _state.soundFunc = 0; - - _sampleConverter.reset(); -} - void Player_AppleII::stopAllSounds() { Common::StackLock lock(_mutex); resetState(); @@ -450,14 +444,14 @@ void Player_AppleII::stopAllSounds() { void Player_AppleII::stopSound(int nr) { Common::StackLock lock(_mutex); - if (_state.soundNr == nr) { + if (_soundNr == nr) { resetState(); } } int Player_AppleII::getSoundStatus(int nr) const { Common::StackLock lock(_mutex); - return (_state.soundNr == nr); + return (_soundNr == nr); } int Player_AppleII::getMusicTimer() { @@ -468,7 +462,7 @@ int Player_AppleII::getMusicTimer() { int Player_AppleII::readBuffer(int16 *buffer, const int numSamples) { Common::StackLock lock(_mutex); - if (!_state.soundNr) + if (!_soundNr) return 0; int samplesLeft = numSamples; @@ -479,7 +473,7 @@ int Player_AppleII::readBuffer(int16 *buffer, const int numSamples) { } while ((samplesLeft > 0) && updateSound()); // reset state if sound is played completely - if (!_state.soundFunc && (_sampleConverter.availableSize() == 0)) + if (!_soundFunc && (_sampleConverter.availableSize() == 0)) resetState(); return numSamples - samplesLeft; @@ -491,11 +485,11 @@ int Player_AppleII::readBuffer(int16 *buffer, const int numSamples) { // toggle speaker on/off void Player_AppleII::speakerToggle() { - _state.speakerState ^= 0x1; + _speakerState ^= 0x1; } void Player_AppleII::generateSamples(int cycles) { - _sampleConverter.addCycles(_state.speakerState, cycles); + _sampleConverter.addCycles(_speakerState, cycles); } void Player_AppleII::wait(int interval, int count /*y*/) { diff --git a/engines/scumm/player_appleII.h b/engines/scumm/player_appleII.h index a44e7b6afe..9e97ab0c89 100644 --- a/engines/scumm/player_appleII.h +++ b/engines/scumm/player_appleII.h @@ -131,6 +131,11 @@ private: // CPU_CLOCK according to AppleWin static const double APPLEII_CPU_CLOCK = 1020484.5; // ~ 1.02 MHz +/* + * Converts the 1-bit speaker state values into audio samples. + * This is done by aggregation of the speaker states at each + * CPU cycle in a sampling period into an audio sample. + */ class SampleConverter { private: void addSampleToBuffer(int sample) { @@ -219,7 +224,18 @@ private: SampleBuffer _buffer; }; -class AppleII_SoundFunction; +class Player_AppleII; + +class AppleII_SoundFunction { +public: + AppleII_SoundFunction() {} + virtual ~AppleII_SoundFunction() {} + virtual void init(Player_AppleII *player, const byte *params) = 0; + /* returns true if finished */ + virtual bool update() = 0; +protected: + Player_AppleII *_player; +}; class Player_AppleII : public Audio::AudioStream, public MusicEngine { public: @@ -250,46 +266,33 @@ public: void wait(int interval, int count); private: - struct sound_state { - // sound number - int soundNr; - // type of sound - int type; - // number of loops left - int loop; - // global sound param list - const byte *params; - // speaker toggle state (0 / 1) - byte speakerState; - // sound function - AppleII_SoundFunction *soundFunc; - } _state; + // sound number + int _soundNr; + // type of sound + int _type; + // number of loops left + int _loop; + // global sound param list + const byte *_params; + // speaker toggle state (0 / 1) + byte _speakerState; + // sound function + AppleII_SoundFunction *_soundFunc; + // cycle to sample converter + SampleConverter _sampleConverter; +private: ScummEngine *_vm; Audio::Mixer *_mixer; Audio::SoundHandle _soundHandle; int _sampleRate; Common::Mutex _mutex; -private: - SampleConverter _sampleConverter; - private: void resetState(); bool updateSound(); }; -class AppleII_SoundFunction { -public: - AppleII_SoundFunction() {} - virtual ~AppleII_SoundFunction() {} - virtual void init(Player_AppleII *player, const byte *params) = 0; - /* returns true if finished */ - virtual bool update() = 0; -protected: - Player_AppleII *_player; -}; - } // End of namespace Scumm #endif -- cgit v1.2.3 From 5f89ef2094e3092d4c5ffa74a77ca8931e675578 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 22 Dec 2011 22:26:08 +1100 Subject: TSAGE: R2R look/use/talk fields are more appropriate in the SceneHotspot class --- engines/tsage/core.cpp | 144 ++++++++++++++++++++++++++++++------------------- engines/tsage/core.h | 15 +++--- 2 files changed, 97 insertions(+), 62 deletions(-) (limited to 'engines') diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp index a32f445194..f894d2d33a 100644 --- a/engines/tsage/core.cpp +++ b/engines/tsage/core.cpp @@ -1512,14 +1512,6 @@ void SceneItem::synchronize(Serializer &s) { s.syncAsSint16LE(_position.x); s.syncAsSint32LE(_position.y); s.syncAsSint16LE(_yDiff); s.syncAsSint32LE(_sceneRegionId); - - if (g_vm->getGameID() == GType_Ringworld2) { - // In R2R, the following fields were moved into the SceneItem class - s.syncAsSint16LE(_resNum); - s.syncAsSint16LE(_lookLineNum); - s.syncAsSint16LE(_useLineNum); - s.syncAsSint16LE(_talkLineNum); - } } void SceneItem::remove() { @@ -1774,60 +1766,24 @@ void SceneItem::display(const Common::String &msg) { SET_EXT_FGCOLOR, 13, LIST_END); } -void SceneItem::setDetails(int ys, int xs, int ye, int xe, const int resnum, const int lookLineNum, const int useLineNum) { - setBounds(ys, xe, ye, xs); - _resNum = resnum; - _lookLineNum = lookLineNum; - _useLineNum = useLineNum; - _talkLineNum = -1; - g_globals->_sceneItems.addItems(this, NULL); -} - -void SceneItem::setDetails(const Rect &bounds, int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode, SceneItem *item) { - setBounds(bounds); - _resNum = resNum; - _lookLineNum = lookLineNum; - _talkLineNum = talkLineNum; - _useLineNum = useLineNum; +/*--------------------------------------------------------------------------*/ - switch (mode) { - case 2: - g_globals->_sceneItems.push_front(this); - break; - case 4: - g_globals->_sceneItems.addBefore(item, this); - break; - case 5: - g_globals->_sceneItems.addAfter(item, this); - break; - default: - g_globals->_sceneItems.push_back(this); - break; - } +SceneHotspot::SceneHotspot(): SceneItem() { + _lookLineNum = _useLineNum = _talkLineNum = 0; } -void SceneItem::setDetails(int sceneRegionId, int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode) { - _sceneRegionId = sceneRegionId; - _resNum = resNum; - _lookLineNum = lookLineNum; - _talkLineNum = talkLineNum; - _useLineNum = useLineNum; +void SceneHotspot::synchronize(Serializer &s) { + SceneItem::synchronize(s); - // Handle adding hotspot to scene items list as necessary - switch (mode) { - case 2: - GLOBALS._sceneItems.push_front(this); - break; - case 3: - break; - default: - GLOBALS._sceneItems.push_back(this); - break; + if (g_vm->getGameID() == GType_Ringworld2) { + // In R2R, the following fields were moved into the SceneItem class + s.syncAsSint16LE(_resNum); + s.syncAsSint16LE(_lookLineNum); + s.syncAsSint16LE(_useLineNum); + s.syncAsSint16LE(_talkLineNum); } } -/*--------------------------------------------------------------------------*/ - bool SceneHotspot::startAction(CursorType action, Event &event) { switch (g_vm->getGameID()) { case GType_BlueForce: { @@ -1835,6 +1791,32 @@ bool SceneHotspot::startAction(CursorType action, Event &event) { assert(scene); return scene->display(action); } + case GType_Ringworld2: { + switch (action) { + case CURSOR_LOOK: + if (_lookLineNum != -1) { + SceneItem::display2(_resNum, _lookLineNum); + return true; + } + break; + case CURSOR_USE: + if (_useLineNum != -1) { + SceneItem::display2(_resNum, _useLineNum); + return true; + } + break; + case CURSOR_TALK: + if (_talkLineNum != -1) { + SceneItem::display2(_resNum, _talkLineNum); + return true; + } + break; + default: + break; + } + + return ((Ringworld2::SceneExt *)GLOBALS._sceneManager._scene)->display(action, event); + } default: return SceneItem::startAction(action, event); } @@ -1871,6 +1853,58 @@ void SceneHotspot::doAction(int action) { } } +void SceneHotspot::setDetails(int ys, int xs, int ye, int xe, const int resnum, const int lookLineNum, const int useLineNum) { + setBounds(ys, xe, ye, xs); + _resNum = resnum; + _lookLineNum = lookLineNum; + _useLineNum = useLineNum; + _talkLineNum = -1; + g_globals->_sceneItems.addItems(this, NULL); +} + +void SceneHotspot::setDetails(const Rect &bounds, int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode, SceneItem *item) { + setBounds(bounds); + _resNum = resNum; + _lookLineNum = lookLineNum; + _talkLineNum = talkLineNum; + _useLineNum = useLineNum; + + switch (mode) { + case 2: + g_globals->_sceneItems.push_front(this); + break; + case 4: + g_globals->_sceneItems.addBefore(item, this); + break; + case 5: + g_globals->_sceneItems.addAfter(item, this); + break; + default: + g_globals->_sceneItems.push_back(this); + break; + } +} + +void SceneHotspot::setDetails(int sceneRegionId, int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode) { + _sceneRegionId = sceneRegionId; + _resNum = resNum; + _lookLineNum = lookLineNum; + _talkLineNum = talkLineNum; + _useLineNum = useLineNum; + + // Handle adding hotspot to scene items list as necessary + switch (mode) { + case 2: + GLOBALS._sceneItems.push_front(this); + break; + case 3: + break; + default: + GLOBALS._sceneItems.push_back(this); + break; + } +} + /*--------------------------------------------------------------------------*/ void SceneObjectWrapper::setSceneObject(SceneObject *so) { diff --git a/engines/tsage/core.h b/engines/tsage/core.h index 98efaf9881..ca691ec618 100644 --- a/engines/tsage/core.h +++ b/engines/tsage/core.h @@ -412,8 +412,6 @@ public: Common::Point _position; int _yDiff; int _sceneRegionId; - - int _resNum, _lookLineNum, _useLineNum, _talkLineNum; public: SceneItem() : EventHandler() { _msg = "Feature"; _action = NULL; _sceneRegionId = 0; } @@ -430,10 +428,6 @@ public: static void display(int resNum, int lineNum, ...); static void display2(int resNum, int lineNum); static void display(const Common::String &msg); - - virtual void setDetails(int ys, int xs, int ye, int xe, const int resnum, const int lookLineNum, const int useLineNum); - virtual void setDetails(const Rect &bounds, int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode, SceneItem *item); - virtual void setDetails(int sceneRegionId, int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode = 0); }; class SceneItemExt : public SceneItem { @@ -449,10 +443,17 @@ public: class SceneHotspot : public SceneItem { public: - SceneHotspot() : SceneItem() {} + int _resNum, _lookLineNum, _useLineNum, _talkLineNum; +public: + SceneHotspot(); + virtual void synchronize(Serializer &s); virtual bool startAction(CursorType action, Event &event); virtual Common::String getClassName() { return "SceneHotspot"; } virtual void doAction(int action); + + virtual void setDetails(int ys, int xs, int ye, int xe, const int resnum, const int lookLineNum, const int useLineNum); + virtual void setDetails(const Rect &bounds, int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode, SceneItem *item); + virtual void setDetails(int sceneRegionId, int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode = 0); }; enum AnimateMode {ANIM_MODE_NONE = 0, ANIM_MODE_1 = 1, ANIM_MODE_2 = 2, ANIM_MODE_3 = 3, -- cgit v1.2.3 From e10060f26207dc37ba38790db9fc793f1bcfb892 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 22 Dec 2011 14:31:04 +0100 Subject: TSAGE: R2R - Implement scene 3220 --- engines/tsage/ringworld2/ringworld2_logic.cpp | 4 +- engines/tsage/ringworld2/ringworld2_scenes3.cpp | 29 +++++++++- engines/tsage/ringworld2/ringworld2_scenes3.h | 12 ++++ engines/tsage/ringworld2/ringworld2_speakers.cpp | 70 ++++++++++++++++++++++++ engines/tsage/ringworld2/ringworld2_speakers.h | 16 ++++++ 5 files changed, 129 insertions(+), 2 deletions(-) (limited to 'engines') diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index 470cdab10c..cf294fa962 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -184,12 +184,14 @@ Scene *Ringworld2Game::createScene(int sceneNumber) { // Autopsy room return new Scene3175(); case 3200: - // Cutscene : Cutscene : Rocko & co - Discussion + // Cutscene : Guards - Discussion return new Scene3200(); case 3210: // Cutscene : Captain and Private - Discussion return new Scene3210(); case 3220: + // Cutscene : Guards in cargo zone + return new Scene3220(); case 3230: case 3240: case 3245: diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp index 5b1e05ebc8..097097308a 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp @@ -923,7 +923,7 @@ void Scene3175::signal() { } /*-------------------------------------------------------------------------- - * Scene 3200 - Cutscene : Rocko & co - Discussion + * Scene 3200 - Cutscene : Guards - Discussion * *--------------------------------------------------------------------------*/ void Scene3200::postInit(SceneObjectList *OwnerList) { @@ -975,5 +975,32 @@ void Scene3210::postInit(SceneObjectList *OwnerList) { void Scene3210::signal() { R2_GLOBALS._sceneManager.changeScene(1200); } + +/*-------------------------------------------------------------------------- + * Scene 3220 - Cutscene : Guards in cargo zone + * + *--------------------------------------------------------------------------*/ +void Scene3220::postInit(SceneObjectList *OwnerList) { + loadScene(3220); + R2_GLOBALS._v58CE2 = 0; + SceneExt::postInit(); + + _stripManager.addSpeaker(&_rockoSpeaker); + _stripManager.addSpeaker(&_jockoSpeaker); + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.hide(); + R2_GLOBALS._player.disableControl(); + + _actor1.postInit(); + _actor2.postInit(); + + setAction(&_sequenceManager, this, 3220 + R2_GLOBALS._randomSource.getRandomNumber(1), &_actor1, &_actor2, NULL); +} + +void Scene3220::signal() { + R2_GLOBALS._sceneManager.changeScene(1200); +} + } // 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 fbb6392be4..afd39769f0 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.h +++ b/engines/tsage/ringworld2/ringworld2_scenes3.h @@ -211,6 +211,18 @@ public: virtual void postInit(SceneObjectList *OwnerList = NULL); virtual void signal(); }; + +class Scene3220 : public SceneExt { +public: + SpeakerRocko3220 _rockoSpeaker; + SpeakerJocko3220 _jockoSpeaker; + SceneActor _actor1; + SceneActor _actor2; + SequenceManager _sequenceManager; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); +}; } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_speakers.cpp b/engines/tsage/ringworld2/ringworld2_speakers.cpp index 80ac04c403..c216486d7f 100644 --- a/engines/tsage/ringworld2/ringworld2_speakers.cpp +++ b/engines/tsage/ringworld2/ringworld2_speakers.cpp @@ -1228,5 +1228,75 @@ void SpeakerPrivate3210::proc15() { } } +SpeakerRocko3220::SpeakerRocko3220() { + _speakerName = "Rocko"; + _color1 = 5; + _color2 = 0; + _fieldF6 = 0; + _textWidth = 300; + _hideObjects = false; + _object2 = NULL; + _displayMode = 1; + _numFrames = 0; +} + +void SpeakerRocko3220::proc15() { + int v = _fieldF6; + Scene3220 *scene = (Scene3220 *)R2_GLOBALS._sceneManager._scene; + + if (!_object2) { + _object2 = &scene->_actor1; + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + if (v == 0) { + _object1.animate(ANIM_MODE_2, NULL); + } else { + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4060, (_object2->_strip * 2) - 1, 1); + _object1.animate(ANIM_MODE_5, this); + } +} + +SpeakerJocko3220::SpeakerJocko3220() { + _speakerName = "Jocko"; + _color1 = 45; + _color2 = 0; + _fieldF6 = 0; + _textWidth = 300; + _hideObjects = false; + _object2 = NULL; + _displayMode = 1; + _numFrames = 0; +} + +void SpeakerJocko3220::proc15() { + int v = _fieldF6; + Scene3220 *scene = (Scene3220 *)R2_GLOBALS._sceneManager._scene; + + if (!_object2) { + _object2 = &scene->_actor2; + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + if (v == 0) { + _object1.animate(ANIM_MODE_2, NULL); + } else { + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4060, (_object2->_strip * 2) - 1, 1); + _object1.animate(ANIM_MODE_5, this); + } +} + } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_speakers.h b/engines/tsage/ringworld2/ringworld2_speakers.h index 66edd67276..fef700387e 100644 --- a/engines/tsage/ringworld2/ringworld2_speakers.h +++ b/engines/tsage/ringworld2/ringworld2_speakers.h @@ -309,6 +309,22 @@ public: virtual void proc15(); }; +class SpeakerRocko3220 : public VisualSpeaker { +public: + SpeakerRocko3220(); + + virtual Common::String getClassName() { return "SpeakerRocko3220"; } + virtual void proc15(); +}; + +class SpeakerJocko3220 : public VisualSpeaker { +public: + SpeakerJocko3220(); + + virtual Common::String getClassName() { return "SpeakerJocko3220"; } + virtual void proc15(); +}; + } // End of namespace Ringworld2 } // End of namespace TsAGE -- cgit v1.2.3 From fc671351cf47c50f7cfc21b1f0ea38b81b105f38 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 22 Dec 2011 15:01:50 +0100 Subject: TSAGE: R2R - Implement scene 3230 --- engines/tsage/ringworld2/ringworld2_logic.cpp | 2 + engines/tsage/ringworld2/ringworld2_scenes3.cpp | 26 +++++++++ engines/tsage/ringworld2/ringworld2_scenes3.h | 13 +++++ engines/tsage/ringworld2/ringworld2_speakers.cpp | 70 ++++++++++++++++++++++++ engines/tsage/ringworld2/ringworld2_speakers.h | 15 +++++ 5 files changed, 126 insertions(+) (limited to 'engines') diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index cf294fa962..3503765ef5 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -193,6 +193,8 @@ Scene *Ringworld2Game::createScene(int sceneNumber) { // Cutscene : Guards in cargo zone return new Scene3220(); case 3230: + // Cutscene : Guards on duty + return new Scene3230(); case 3240: case 3245: case 3250: diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp index 097097308a..a07076bcba 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp @@ -1002,5 +1002,31 @@ void Scene3220::signal() { R2_GLOBALS._sceneManager.changeScene(1200); } +/*-------------------------------------------------------------------------- + * Scene 3230 - Cutscene : Guards on duty + * + *--------------------------------------------------------------------------*/ +void Scene3230::postInit(SceneObjectList *OwnerList) { + loadScene(3230); + R2_GLOBALS._v58CE2 = 0; + SceneExt::postInit(); + + _stripManager.addSpeaker(&_rockoSpeaker); + _stripManager.addSpeaker(&_jockoSpeaker); + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.hide(); + R2_GLOBALS._player.disableControl(); + + _actor1.postInit(); + _actor2.postInit(); + _actor3.postInit(); + + setAction(&_sequenceManager, this, 3230 + R2_GLOBALS._randomSource.getRandomNumber(1), &_actor1, &_actor2, &_actor3, NULL); +} + +void Scene3230::signal() { + R2_GLOBALS._sceneManager.changeScene(1200); +} } // 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 afd39769f0..6bff8bc6d8 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.h +++ b/engines/tsage/ringworld2/ringworld2_scenes3.h @@ -223,6 +223,19 @@ public: virtual void postInit(SceneObjectList *OwnerList = NULL); virtual void signal(); }; + +class Scene3230 : public SceneExt { +public: + SpeakerRocko3230 _rockoSpeaker; + SpeakerJocko3230 _jockoSpeaker; + SceneActor _actor1; + SceneActor _actor2; + SceneActor _actor3; + SequenceManager _sequenceManager; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); +}; } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_speakers.cpp b/engines/tsage/ringworld2/ringworld2_speakers.cpp index c216486d7f..4c0494c214 100644 --- a/engines/tsage/ringworld2/ringworld2_speakers.cpp +++ b/engines/tsage/ringworld2/ringworld2_speakers.cpp @@ -1298,5 +1298,75 @@ void SpeakerJocko3220::proc15() { } } +SpeakerRocko3230::SpeakerRocko3230() { + _speakerName = "Rocko"; + _color1 = 5; + _color2 = 0; + _fieldF6 = 0; + _textWidth = 300; + _hideObjects = false; + _object2 = NULL; + _displayMode = 1; + _numFrames = 0; +} + +void SpeakerRocko3230::proc15() { + int v = _fieldF6; + Scene3230 *scene = (Scene3230 *)R2_GLOBALS._sceneManager._scene; + + if (!_object2) { + _object2 = &scene->_actor1; + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + if (v == 0) { + _object1.animate(ANIM_MODE_2, NULL); + } else { + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4111, (_object2->_strip * 2) - 1, 1); + _object1.animate(ANIM_MODE_5, this); + } +} + +SpeakerJocko3230::SpeakerJocko3230() { + _speakerName = "Jocko"; + _color1 = 45; + _color2 = 0; + _fieldF6 = 0; + _textWidth = 300; + _hideObjects = false; + _object2 = NULL; + _displayMode = 1; + _numFrames = 0; +} + +void SpeakerJocko3230::proc15() { + int v = _fieldF6; + Scene3230 *scene = (Scene3230 *)R2_GLOBALS._sceneManager._scene; + + if (!_object2) { + _object2 = &scene->_actor2; + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + if (v == 0) { + _object1.animate(ANIM_MODE_2, NULL); + } else { + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4060, (_object2->_strip * 2) - 1, 1); + _object1.animate(ANIM_MODE_5, this); + } +} + } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_speakers.h b/engines/tsage/ringworld2/ringworld2_speakers.h index fef700387e..71933f3ec9 100644 --- a/engines/tsage/ringworld2/ringworld2_speakers.h +++ b/engines/tsage/ringworld2/ringworld2_speakers.h @@ -325,6 +325,21 @@ public: virtual void proc15(); }; +class SpeakerRocko3230 : public VisualSpeaker { +public: + SpeakerRocko3230(); + + virtual Common::String getClassName() { return "SpeakerRocko3230"; } + virtual void proc15(); +}; + +class SpeakerJocko3230 : public VisualSpeaker { +public: + SpeakerJocko3230(); + + virtual Common::String getClassName() { return "SpeakerJocko3230"; } + virtual void proc15(); +}; } // End of namespace Ringworld2 } // End of namespace TsAGE -- cgit v1.2.3 From e6a671b555500de4f870d73cbd785e40f76d0d33 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 22 Dec 2011 16:20:21 +0100 Subject: TSAGE: R2R - Implement scene 3240 --- engines/tsage/ringworld2/ringworld2_logic.cpp | 2 + engines/tsage/ringworld2/ringworld2_scenes3.cpp | 28 ++++++++++ engines/tsage/ringworld2/ringworld2_scenes3.h | 13 +++++ engines/tsage/ringworld2/ringworld2_speakers.cpp | 70 ++++++++++++++++++++++++ engines/tsage/ringworld2/ringworld2_speakers.h | 16 ++++++ 5 files changed, 129 insertions(+) (limited to 'engines') diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index 3503765ef5..0f43704fa8 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -196,6 +196,8 @@ Scene *Ringworld2Game::createScene(int sceneNumber) { // Cutscene : Guards on duty return new Scene3230(); case 3240: + // Cutscene : Teal monolog + return new Scene3240(); case 3245: case 3250: case 3255: diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp index a07076bcba..326591178d 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp @@ -1028,5 +1028,33 @@ void Scene3230::postInit(SceneObjectList *OwnerList) { void Scene3230::signal() { R2_GLOBALS._sceneManager.changeScene(1200); } + +/*-------------------------------------------------------------------------- + * Scene 3240 - Cutscene : Teal monolog + * + *--------------------------------------------------------------------------*/ +void Scene3240::postInit(SceneObjectList *OwnerList) { + loadScene(3240); + R2_GLOBALS._v58CE2 = 0; + SceneExt::postInit(); + + _stripManager.addSpeaker(&_tealSpeaker); + _stripManager.addSpeaker(&_webbsterSpeaker); + _stripManager.addSpeaker(&_mirandaSpeaker); + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.hide(); + R2_GLOBALS._player.disableControl(); + + _actor1.postInit(); + _actor2.postInit(); + + setAction(&_sequenceManager, this, 3240 + R2_GLOBALS._randomSource.getRandomNumber(1), &_actor1, &_actor2, NULL); +} + +void Scene3240::signal() { + R2_GLOBALS._sceneManager.changeScene(1200); +} + } // 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 6bff8bc6d8..d652788e14 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.h +++ b/engines/tsage/ringworld2/ringworld2_scenes3.h @@ -236,6 +236,19 @@ public: virtual void postInit(SceneObjectList *OwnerList = NULL); virtual void signal(); }; + +class Scene3240 : public SceneExt { +public: + SpeakerTeal3240 _tealSpeaker; + SpeakerWebbster3240 _webbsterSpeaker; + SpeakerMiranda2500 _mirandaSpeaker; + SceneActor _actor1; + SceneActor _actor2; + SequenceManager _sequenceManager; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); +}; } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_speakers.cpp b/engines/tsage/ringworld2/ringworld2_speakers.cpp index 4c0494c214..a14d3ea8ae 100644 --- a/engines/tsage/ringworld2/ringworld2_speakers.cpp +++ b/engines/tsage/ringworld2/ringworld2_speakers.cpp @@ -1368,5 +1368,75 @@ void SpeakerJocko3230::proc15() { } } +SpeakerTeal3240::SpeakerTeal3240() { + _speakerName = "Teal"; + _color1 = 22; + _color2 = 0; + _fieldF6 = 0; + _textWidth = 300; + _hideObjects = false; + _object2 = NULL; + _displayMode = 1; + _numFrames = 0; +} + +void SpeakerTeal3240::proc15() { + int v = _fieldF6; + Scene3240 *scene = (Scene3240 *)R2_GLOBALS._sceneManager._scene; + + if (!_object2) { + _object2 = &scene->_actor1; + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + if (v == 0) { + _object1.animate(ANIM_MODE_2, NULL); + } else { + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4070, (_object2->_strip * 2) - 1, 1); + _object1.animate(ANIM_MODE_5, this); + } +} + +SpeakerWebbster3240::SpeakerWebbster3240() { + _speakerName = "Webbster"; + _color1 = 10; + _color2 = 0; + _fieldF6 = 0; + _textWidth = 300; + _hideObjects = false; + _object2 = NULL; + _displayMode = 1; + _numFrames = 0; +} + +void SpeakerWebbster3240::proc15() { + int v = _fieldF6; + Scene3240 *scene = (Scene3240 *)R2_GLOBALS._sceneManager._scene; + + if (!_object2) { + _object2 = &scene->_actor2; + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + if (v == 0) { + _object1.animate(ANIM_MODE_2, NULL); + } else { + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4110, 5, 1); + _object1.animate(ANIM_MODE_5, this); + } +} + } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_speakers.h b/engines/tsage/ringworld2/ringworld2_speakers.h index 71933f3ec9..bb49b985dc 100644 --- a/engines/tsage/ringworld2/ringworld2_speakers.h +++ b/engines/tsage/ringworld2/ringworld2_speakers.h @@ -340,6 +340,22 @@ public: virtual Common::String getClassName() { return "SpeakerJocko3230"; } virtual void proc15(); }; + +class SpeakerTeal3240 : public VisualSpeaker { +public: + SpeakerTeal3240(); + + virtual Common::String getClassName() { return "SpeakerTeal3240"; } + virtual void proc15(); +}; + +class SpeakerWebbster3240 : public VisualSpeaker { +public: + SpeakerWebbster3240(); + + virtual Common::String getClassName() { return "SpeakerWebbster3240"; } + virtual void proc15(); +}; } // End of namespace Ringworld2 } // End of namespace TsAGE -- cgit v1.2.3 From cdd9ab3b70da5abe287cc5ef4baa0c5b40e3bfd4 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 22 Dec 2011 17:12:08 +0100 Subject: TSAGE: R2R - Implement scene 3245 --- engines/tsage/globals.cpp | 2 + engines/tsage/globals.h | 1 + engines/tsage/ringworld2/ringworld2_logic.cpp | 2 + engines/tsage/ringworld2/ringworld2_scenes3.cpp | 34 +++++++++ engines/tsage/ringworld2/ringworld2_scenes3.h | 12 +++ engines/tsage/ringworld2/ringworld2_speakers.cpp | 96 ++++++++++++++++++++++++ engines/tsage/ringworld2/ringworld2_speakers.h | 16 ++++ 7 files changed, 163 insertions(+) (limited to 'engines') diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp index da40485617..c9518fa688 100644 --- a/engines/tsage/globals.cpp +++ b/engines/tsage/globals.cpp @@ -387,6 +387,7 @@ void Ringworld2Globals::reset() { for (int i = 0; i < 14; i++) _v56605[i] = 0; _v56AA0 = 0; + _v56AA1 = 0; _v57C2C = 0; _v58CE2 = 0; Common::fill(&_v565F1[0], &_v565F1[MAX_CHARACTERS], 0); @@ -428,6 +429,7 @@ void Ringworld2Globals::synchronize(Serializer &s) { s.syncAsByte(_v565AE); s.syncAsByte(_v56AA0); + s.syncAsByte(_v56AA1); for (i = 0; i < 14; ++i) s.syncAsByte(_v56605[i]); diff --git a/engines/tsage/globals.h b/engines/tsage/globals.h index 7e40276fcf..89ad418baa 100644 --- a/engines/tsage/globals.h +++ b/engines/tsage/globals.h @@ -253,6 +253,7 @@ public: byte _v565AE; byte _v56605[14]; byte _v56AA0; + byte _v56AA1; int _v57C2C; int _v58CE2; int _speechSubtitles; diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index 0f43704fa8..f7dcc56d42 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -199,6 +199,8 @@ Scene *Ringworld2Game::createScene(int sceneNumber) { // Cutscene : Teal monolog return new Scene3240(); case 3245: + // Cutscene : Discussions with Dr. Tomko + return new Scene3245(); case 3250: case 3255: case 3260: diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp index 326591178d..aa7361b77b 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp @@ -1056,5 +1056,39 @@ void Scene3240::signal() { R2_GLOBALS._sceneManager.changeScene(1200); } +/*-------------------------------------------------------------------------- + * Scene 3245 - Cutscene : Discussions with Dr. Tomko + * + *--------------------------------------------------------------------------*/ +void Scene3245::postInit(SceneObjectList *OwnerList) { + loadScene(3245); + R2_GLOBALS._v58CE2 = 0; + SceneExt::postInit(); + + _stripManager.addSpeaker(&_ralfSpeaker); + _stripManager.addSpeaker(&_tomkoSpeaker); + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.hide(); + R2_GLOBALS._player.disableControl(); + + _actor1.postInit(); + _actor2.postInit(); + + if (R2_GLOBALS._v56AA1 < 4) + ++R2_GLOBALS._v56AA1; + + if (R2_GLOBALS._v56AA1 >= 4) { + SceneItem::display(1200, 7, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + signal(); + } else { + setAction(&_sequenceManager, this, 3244 + R2_GLOBALS._v56AA1, &_actor1, &_actor2, NULL); + } +} + +void Scene3245::signal() { + R2_GLOBALS._sceneManager.changeScene(1200); +} + } // 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 d652788e14..96fa65e70f 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.h +++ b/engines/tsage/ringworld2/ringworld2_scenes3.h @@ -249,6 +249,18 @@ public: virtual void postInit(SceneObjectList *OwnerList = NULL); virtual void signal(); }; + +class Scene3245 : public SceneExt { +public: + SpeakerRalf3245 _ralfSpeaker; + SpeakerTomko3245 _tomkoSpeaker; + SceneActor _actor1; + SceneActor _actor2; + SequenceManager _sequenceManager; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); +}; } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_speakers.cpp b/engines/tsage/ringworld2/ringworld2_speakers.cpp index a14d3ea8ae..619b1c291f 100644 --- a/engines/tsage/ringworld2/ringworld2_speakers.cpp +++ b/engines/tsage/ringworld2/ringworld2_speakers.cpp @@ -1438,5 +1438,101 @@ void SpeakerWebbster3240::proc15() { } } +SpeakerRalf3245::SpeakerRalf3245() { + _speakerName = "Ralf"; + _color1 = 5; + _color2 = 0; + _fieldF6 = 0; + _textWidth = 300; + _hideObjects = false; + _object2 = NULL; + _displayMode = 1; + _numFrames = 0; +} + +void SpeakerRalf3245::proc15() { + int v = _fieldF6; + Scene3245 *scene = (Scene3245 *)R2_GLOBALS._sceneManager._scene; + + if (!_object2) { + _object2 = &scene->_actor1; + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + if (v == 0) { + _object1.animate(ANIM_MODE_2, NULL); + } else { + ((SceneItem *)_action)->_sceneRegionId = 0; + switch (_object2->_visage) { + case 3100: + _object1.setup(4105, (_object2->_strip * 2) - 1, 1); + break; + case 3101: + _object1.setup(4108, (_object2->_strip * 2) - 1, 1); + break; + case 3102: + _object1.setup(4109, (_object2->_strip * 2) - 1, 1); + break; + default: + break; + } + + _object1.animate(ANIM_MODE_5, this); + } +} + +SpeakerTomko3245::SpeakerTomko3245() { + _speakerName = "Tomko"; + _color1 = 10; + _color2 = 0; + _fieldF6 = 0; + _textWidth = 300; + _hideObjects = false; + _object2 = NULL; + _displayMode = 1; + _numFrames = 0; +} + +void SpeakerTomko3245::proc15() { + int v = _fieldF6; + Scene3245 *scene = (Scene3245 *)R2_GLOBALS._sceneManager._scene; + + if (!_object2) { + _object2 = &scene->_actor2; + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + if (v == 0) { + _object1.animate(ANIM_MODE_2, NULL); + } else { + ((SceneItem *)_action)->_sceneRegionId = 0; + switch (_object2->_visage) { + case 3100: + _object1.setup(4105, (_object2->_strip * 2) - 1, 1); + break; + case 3101: + _object1.setup(4108, (_object2->_strip * 2) - 1, 1); + break; + case 3102: + _object1.setup(4109, (_object2->_strip * 2) - 1, 1); + break; + default: + break; + } + + _object1.animate(ANIM_MODE_5, this); + } +} + } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_speakers.h b/engines/tsage/ringworld2/ringworld2_speakers.h index bb49b985dc..e6a1819eb3 100644 --- a/engines/tsage/ringworld2/ringworld2_speakers.h +++ b/engines/tsage/ringworld2/ringworld2_speakers.h @@ -356,6 +356,22 @@ public: virtual Common::String getClassName() { return "SpeakerWebbster3240"; } virtual void proc15(); }; + +class SpeakerRalf3245 : public VisualSpeaker { +public: + SpeakerRalf3245(); + + virtual Common::String getClassName() { return "SpeakerRalf3245"; } + virtual void proc15(); +}; + +class SpeakerTomko3245 : public VisualSpeaker { +public: + SpeakerTomko3245(); + + virtual Common::String getClassName() { return "SpeakerTomko3245"; } + virtual void proc15(); +}; } // End of namespace Ringworld2 } // End of namespace TsAGE -- cgit v1.2.3 From 086b0e505730a5168dc85371214d9904fbb16284 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 22 Dec 2011 19:42:13 +0100 Subject: TSAGE: R2R - Scene 3100 (space port): Fix cursor used in signal(), rename an object --- engines/tsage/ringworld2/ringworld2_scenes3.cpp | 25 ++++++++++++------------- engines/tsage/ringworld2/ringworld2_scenes3.h | 4 ++-- 2 files changed, 14 insertions(+), 15 deletions(-) (limited to 'engines') diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp index aa7361b77b..a46c3f7b9f 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp @@ -43,7 +43,7 @@ void Scene3100::synchronize(Serializer &s) { s.syncAsSint16LE(_field412); } -bool Scene3100::Actor6::startAction(CursorType action, Event &event) { +bool Scene3100::Guard::startAction(CursorType action, Event &event) { if (action != CURSOR_TALK) return SceneActor::startAction(action, event); @@ -98,11 +98,11 @@ void Scene3100::postInit(SceneObjectList *OwnerList) { _sound1.fadeSound(130); setAction(&_sequenceManager, this, 3102, &_actor1, &R2_GLOBALS._player, &_actor3, &_actor4, &_actor5, NULL); } else { - _actor6.postInit(); - _actor6.setup(3110, 5, 1); - _actor6.changeZoom(50); - _actor6.setPosition(Common::Point(10, 149)); - _actor6.setDetails(3100, 6, -1, -1, 2, NULL); + _guard.postInit(); + _guard.setup(3110, 5, 1); + _guard.changeZoom(50); + _guard.setPosition(Common::Point(10, 149)); + _guard.setDetails(3100, 6, -1, -1, 2, NULL); _actor4.postInit(); _actor4.setup(3103, 1, 1); @@ -126,11 +126,11 @@ void Scene3100::postInit(SceneObjectList *OwnerList) { setAction(&_sequenceManager, this, 3101, &R2_GLOBALS._player, &_actor1, &_actor2, &_actor3, NULL); } else { - _actor6.postInit(); - _actor6.setup(3110, 5, 1); - _actor6.changeZoom(50); - _actor6.setPosition(Common::Point(10, 149)); - _actor6.setDetails(3100, 6, -1, -1, 2, NULL); + _guard.postInit(); + _guard.setup(3110, 5, 1); + _guard.changeZoom(50); + _guard.setPosition(Common::Point(10, 149)); + _guard.setDetails(3100, 6, -1, -1, 2, NULL); _actor4.postInit(); _actor4.setup(3103, 1, 1); @@ -167,8 +167,7 @@ void Scene3100::remove() { void Scene3100::signal() { switch (_sceneMode) { case 10: - warning("TODO: Unknown cursor used (6/-6)"); - R2_GLOBALS._player.enableControl(); + R2_GLOBALS._player.enableControl(CURSOR_TALK); break; case 3100: R2_GLOBALS._player._moveDiff = Common::Point(3, 2); diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.h b/engines/tsage/ringworld2/ringworld2_scenes3.h index 96fa65e70f..ab98a8d66e 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.h +++ b/engines/tsage/ringworld2/ringworld2_scenes3.h @@ -41,7 +41,7 @@ using namespace TsAGE; class Scene3100 : public SceneExt { - class Actor6 : public SceneActor { + class Guard : public SceneActor { virtual bool startAction(CursorType action, Event &event); }; public: @@ -55,7 +55,7 @@ public: SceneActor _actor3; SceneActor _actor4; SceneActor _actor5; - Actor6 _actor6; + Guard _guard; ASoundExt _sound1; SequenceManager _sequenceManager; -- cgit v1.2.3 From 0234bb5be26319a3cd634cbdcf73ad7beb31b16f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 22 Dec 2011 19:45:44 +0100 Subject: TSAGE: R2R - Remove obsolete warning --- engines/tsage/ringworld2/ringworld2_scenes3.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp index a46c3f7b9f..65b1622883 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp @@ -849,7 +849,7 @@ bool Scene3175::Actor3::startAction(CursorType action, Event &event) { default: break; } - warning("scene->display() called with two parameters"); + return scene->display(action, event); } -- cgit v1.2.3 From 2811d83670f63cbda6ff058d343be692f9c3ddbe Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 22 Dec 2011 20:21:23 +0100 Subject: TSAGE: Give a default value to the second parameter of disableControl(), as for enableControl() --- engines/tsage/core.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/tsage/core.h b/engines/tsage/core.h index ca691ec618..bd27a942a4 100644 --- a/engines/tsage/core.h +++ b/engines/tsage/core.h @@ -653,7 +653,7 @@ public: void disableControl(); void enableControl(); - void disableControl(CursorType cursorId, CursorType objectId); + void disableControl(CursorType cursorId, CursorType objectId = CURSOR_NONE); void enableControl(CursorType cursorId, CursorType objectId = CURSOR_NONE); }; -- cgit v1.2.3 From 014536cf3f8d619c257698ebd50b94c950cfca13 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 22 Dec 2011 20:23:48 +0100 Subject: TSAGE: R2R - Fix a couple of bugs in scene 2000, Fix calls to disableControl() with parameters Also remove several obsolete warnings --- engines/tsage/globals.cpp | 3 ++ engines/tsage/globals.h | 1 + engines/tsage/ringworld2/ringworld2_scenes2.cpp | 42 ++++++------------------- 3 files changed, 14 insertions(+), 32 deletions(-) (limited to 'engines') diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp index c9518fa688..740d9b91fd 100644 --- a/engines/tsage/globals.cpp +++ b/engines/tsage/globals.cpp @@ -388,6 +388,7 @@ void Ringworld2Globals::reset() { _v56605[i] = 0; _v56AA0 = 0; _v56AA1 = 0; + _v56AAB = 0; _v57C2C = 0; _v58CE2 = 0; Common::fill(&_v565F1[0], &_v565F1[MAX_CHARACTERS], 0); @@ -420,6 +421,7 @@ void Ringworld2Globals::synchronize(Serializer &s) { s.syncAsSint16LE(_v5657C); s.syncAsSint16LE(_v565F5); + s.syncAsSint16LE(_v56AAB); s.syncAsSint16LE(_v57C2C); s.syncAsSint16LE(_v58CE2); s.syncAsSint16LE(_speechSubtitles); @@ -430,6 +432,7 @@ void Ringworld2Globals::synchronize(Serializer &s) { s.syncAsByte(_v565AE); s.syncAsByte(_v56AA0); s.syncAsByte(_v56AA1); + for (i = 0; i < 14; ++i) s.syncAsByte(_v56605[i]); diff --git a/engines/tsage/globals.h b/engines/tsage/globals.h index 89ad418baa..fb892c6cf7 100644 --- a/engines/tsage/globals.h +++ b/engines/tsage/globals.h @@ -254,6 +254,7 @@ public: byte _v56605[14]; byte _v56AA0; byte _v56AA1; + int _v56AAB; int _v57C2C; int _v58CE2; int _speechSubtitles; diff --git a/engines/tsage/ringworld2/ringworld2_scenes2.cpp b/engines/tsage/ringworld2/ringworld2_scenes2.cpp index b851ed4e22..1fe920e65c 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes2.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes2.cpp @@ -35,9 +35,7 @@ namespace Ringworld2 { *--------------------------------------------------------------------------*/ void Scene2000::initPlayer() { R2_GLOBALS._player.disableControl(); - warning("DisableControl, with arguments?"); - warning("initPlayer: %d", _mazePlayerMode); switch (_mazePlayerMode) { case 0: R2_GLOBALS._player.setStrip(5); @@ -49,7 +47,6 @@ void Scene2000::initPlayer() { } else R2_GLOBALS._player.setPosition(Common::Point(245, 129)); R2_GLOBALS._player.enableControl(); - warning("EnableControl, with 2 arguments?"); break; case 1: if (R2_GLOBALS._player._characterIndex == 1) @@ -179,8 +176,6 @@ void Scene2000::initExits() { _object1.remove(); - warning("initExits: %d", R2_GLOBALS._v56605[R2_GLOBALS._player._characterIndex]); - switch (R2_GLOBALS._v56605[R2_GLOBALS._player._characterIndex]) { case 3: case 10: @@ -395,7 +390,6 @@ void Scene2000::Action1::signal() { case 0: { _actionIndex = 1; Common::Point pt(-20, 127); - warning("TODO: Check sub_22D26"); NpcMover *mover = new NpcMover(); scene->_objList1[_state].addMover(mover, &pt, scene); break; @@ -439,7 +433,6 @@ void Scene2000::Action1::signal() { case 5: { _actionIndex = 6; Common::Point pt(340, 127); - warning("TODO: Check sub_22D26"); NpcMover *mover = new NpcMover(); scene->_objList1[_state].addMover(mover, &pt, this); break; @@ -482,7 +475,6 @@ void Scene2000::Action1::signal() { break; case 10: { Common::Point pt(290, 127); - warning("TODO: Check sub_22D26"); NpcMover *mover = new NpcMover(); scene->_objList1[_state].addMover(mover, &pt, this); _actionIndex = 11; @@ -508,13 +500,11 @@ void Scene2000::Action1::signal() { case 15: if ((R2_GLOBALS._v56605[3 + _state] == 13) || (R2_GLOBALS._v56605[3 + _state] == 22) || (R2_GLOBALS._v56605[3 + _state] == 27)) { Common::Point pt(30, 127); - warning("TODO: Check sub_22D26"); NpcMover *mover = new NpcMover(); scene->_objList1[_state].addMover(mover, &pt, this); _actionIndex = 16; } else { Common::Point pt(120, 127); - warning("TODO: Check sub_22D26"); NpcMover *mover = new NpcMover(); scene->_objList1[_state].addMover(mover, &pt, this); _actionIndex = 16; @@ -546,15 +536,12 @@ void Scene2000::Action1::signal() { void Scene2000::Exit1::changeScene() { Scene2000 *scene = (Scene2000 *)R2_GLOBALS._sceneManager._scene; - warning("exit1"); scene->_exitingFlag = true; scene->_sceneMode = 0; - R2_GLOBALS._player.disableControl(); - warning("DisableControl, with arguments?"); + R2_GLOBALS._player.disableControl(CURSOR_ARROW); scene->_sceneMode = 10; - warning("TODO: Check sub_22D26"); Common::Point pt(-10, 129); NpcMover *mover = new NpcMover(); R2_GLOBALS._player.addMover(mover, &pt, scene); @@ -564,15 +551,12 @@ void Scene2000::Exit1::changeScene() { void Scene2000::Exit2::changeScene() { Scene2000 *scene = (Scene2000 *)R2_GLOBALS._sceneManager._scene; - warning("exit2"); scene->_exitingFlag = true; scene->_sceneMode = 0; - R2_GLOBALS._player.disableControl(); - warning("DisableControl, with arguments?"); + R2_GLOBALS._player.disableControl(CURSOR_ARROW); scene->_sceneMode = 11; - warning("TODO: Check sub_22D26"); Common::Point pt(330, 129); NpcMover *mover = new NpcMover(); R2_GLOBALS._player.addMover(mover, &pt, scene); @@ -580,12 +564,10 @@ void Scene2000::Exit2::changeScene() { void Scene2000::Exit3::changeScene() { Scene2000 *scene = (Scene2000 *)R2_GLOBALS._sceneManager._scene; - warning("exit13"); scene->_exitingFlag = true; scene->_sceneMode = 0; - R2_GLOBALS._player.disableControl(); - warning("DisableControl, with arguments?"); + R2_GLOBALS._player.disableControl(CURSOR_ARROW); scene->_sceneMode = 12; switch (R2_GLOBALS._v56605[R2_GLOBALS._player._characterIndex]) { @@ -650,12 +632,10 @@ void Scene2000::Exit3::changeScene() { } void Scene2000::Exit4::changeScene() { Scene2000 *scene = (Scene2000 *)R2_GLOBALS._sceneManager._scene; - warning("exit4"); scene->_exitingFlag = true; scene->_sceneMode = 0; - R2_GLOBALS._player.disableControl(); - warning("DisableControl, with arguments?"); + R2_GLOBALS._player.disableControl(CURSOR_ARROW); scene->_sceneMode = 13; switch (R2_GLOBALS._v56605[R2_GLOBALS._player._characterIndex]) { @@ -709,11 +689,9 @@ void Scene2000::Exit4::changeScene() { void Scene2000::Exit5::changeScene() { Scene2000 *scene = (Scene2000 *)R2_GLOBALS._sceneManager._scene; - warning("exit5"); scene->_sceneMode = 0; - R2_GLOBALS._player.disableControl(); - warning("DisableControl, with arguments?"); + R2_GLOBALS._player.disableControl(CURSOR_ARROW); scene->_sceneMode = 14; switch (R2_GLOBALS._v56605[R2_GLOBALS._player._characterIndex]) { @@ -1009,6 +987,9 @@ void Scene2000::signal() { g_globals->_sceneManager.changeScene(2535); break; default: + if (R2_GLOBALS._v56AAB != 0) + R2_GLOBALS._v56AAB = 0; + R2_GLOBALS._player.enableControl(CURSOR_ARROW); break; } break; @@ -1024,7 +1005,6 @@ void Scene2000::signal() { void Scene2000::process(Event &event) { if ((R2_GLOBALS._player._canWalk) && (event.eventType == EVENT_BUTTON_DOWN) && (R2_GLOBALS._events.getCursor() == CURSOR_CROSSHAIRS)) { - warning("TODO: Check sub_22D26"); Common::Point pt(event.mousePos.x, 129); PlayerMover *mover = new PlayerMover(); @@ -1069,7 +1049,7 @@ bool Scene2350::Actor3::startAction(CursorType action, Event &event) { void Scene2350::ExitUp::changeScene() { Scene2350 *scene = (Scene2350 *)R2_GLOBALS._sceneManager._scene; - R2_GLOBALS._player.disableControl(); + R2_GLOBALS._player.disableControl(CURSOR_CROSSHAIRS); scene->_sceneMode = 12; if (R2_GLOBALS._player._characterIndex == 1) scene->setAction(&scene->_sequenceManager, scene, 2350, &R2_GLOBALS._player, NULL); @@ -1080,11 +1060,10 @@ void Scene2350::ExitUp::changeScene() { void Scene2350::ExitWest::changeScene() { Scene2350 *scene = (Scene2350 *)R2_GLOBALS._sceneManager._scene; - R2_GLOBALS._player.disableControl(); + R2_GLOBALS._player.disableControl(CURSOR_CROSSHAIRS); scene->_sceneMode = 11; Common::Point pt(-10, 129); - warning("TODO: Check sub_22D26"); NpcMover *mover = new NpcMover(); R2_GLOBALS._player.addMover(mover, &pt, scene); @@ -1157,7 +1136,6 @@ void Scene2350::postInit(SceneObjectList *OwnerList) { _sceneMode = 10; R2_GLOBALS._player.setPosition(Common::Point(-20, 129)); Common::Point pt(20, 129); - warning("TODO: Check sub_22D26"); NpcMover *mover = new NpcMover(); R2_GLOBALS._player.addMover(mover, &pt, this); -- cgit v1.2.3 From 3241d34a32fcd718e37a9b95841503675aa62a02 Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Fri, 23 Dec 2011 10:39:42 +1100 Subject: Add patch #3463338 - Detect Macintosh demo of Pajama Sam 1. --- engines/scumm/detection_tables.h | 1 + engines/scumm/scumm-md5.h | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'engines') diff --git a/engines/scumm/detection_tables.h b/engines/scumm/detection_tables.h index cd055a5b78..c75089f8ca 100644 --- a/engines/scumm/detection_tables.h +++ b/engines/scumm/detection_tables.h @@ -717,6 +717,7 @@ static const GameFilenamePattern gameFilenamesTable[] = { { "pajama", "Pajama Sam", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 }, { "pajama", "PajamaNHD", kGenHEPC, UNK_LANG, UNK, 0 }, { "pajama", "PJS-DEMO", kGenHEPC, UNK_LANG, UNK, 0 }, + { "pajama", "PJS-DEMO", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 }, { "pajama", "pjsam", kGenHEPC, UNK_LANG, UNK, 0 }, { "pajama", "PjSamDemo", kGenHEPC, UNK_LANG, UNK, 0 }, { "pajama", "PYJAMA", kGenHEPC, Common::DE_DEU, UNK, 0 }, diff --git a/engines/scumm/scumm-md5.h b/engines/scumm/scumm-md5.h index 42ce74ec29..cb36743ee2 100644 --- a/engines/scumm/scumm-md5.h +++ b/engines/scumm/scumm-md5.h @@ -1,5 +1,5 @@ /* - This file was generated by the md5table tool on Mon Nov 28 01:09:07 2011 + This file was generated by the md5table tool on Thu Dec 22 23:21:30 2011 DO NOT EDIT MANUALLY! */ @@ -16,7 +16,7 @@ struct MD5Table { static const MD5Table md5table[] = { { "008e76ec3ae58d0add637ea7aa299a2c", "freddi3", "", "", -1, Common::FR_FRA, Common::kPlatformMacintosh }, { "02cae0e7ff8504f73618391873d5781a", "freddi3", "HE 98.5", "", -1, Common::DE_DEU, Common::kPlatformWindows }, - { "0305e850382b812fec6e5998ef88a966", "pajama", "", "Demo", -1, Common::NL_NLD, Common::kPlatformWindows }, + { "0305e850382b812fec6e5998ef88a966", "pajama", "", "Demo", -1, Common::NL_NLD, Common::kPlatformUnknown }, { "035deab53b47bc43abc763560d0f8d4b", "atlantis", "Floppy", "Demo", -1, Common::EN_ANY, Common::kPlatformPC }, { "037385a953789190298494d92b89b3d0", "catalog", "HE 72", "Demo", -1, Common::EN_ANY, Common::kPlatformWindows }, { "03d3b18ee3fd68114e2a687c871e38d5", "freddi4", "HE 99", "Mini Game", -1, Common::EN_USA, Common::kPlatformWindows }, -- cgit v1.2.3 From c7dbbc860677efd01bd2aaaa5944b21c0849dda4 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 23 Dec 2011 03:27:27 +0200 Subject: DREAMWEB: Ported 'reminders' to C++ and renamed it to edensFlatReminders() --- engines/dreamweb/dreamgen.cpp | 53 ------------------------------------------- engines/dreamweb/dreamgen.h | 1 - engines/dreamweb/stubs.cpp | 30 +++++++++++++++++++++++- engines/dreamweb/stubs.h | 1 + 4 files changed, 30 insertions(+), 55 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index a0ce29d416..dff190a6bf 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -26,59 +26,6 @@ namespace DreamGen { -void DreamGenContext::reminders() { - STACK_CHECK; - _cmp(data.byte(kReallocation), 24); - if (!flags.z()) - return /* (notinedenslift) */; - _cmp(data.byte(kMapx), 44); - if (!flags.z()) - return /* (notinedenslift) */; - _cmp(data.byte(kProgresspoints), 0); - if (!flags.z()) - return /* (notfirst) */; - al = 'D'; - ah = 'K'; - cl = 'E'; - ch = 'Y'; - isRyanHolding(); - if (flags.z()) - goto forgotone; - al = 'C'; - ah = 'S'; - cl = 'H'; - ch = 'R'; - findExObject(); - _cmp(al, (114)); - if (flags.z()) - goto forgotone; - ax = es.word(bx+2); - _cmp(al, 4); - if (!flags.z()) - goto forgotone; - _cmp(ah, 255); - if (flags.z()) - goto havegotcard; - cl = 'P'; - ch = 'U'; - dl = 'R'; - dh = 'S'; - _xchg(al, ah); - compare(); - if (!flags.z()) - goto forgotone; -havegotcard: - _inc(data.byte(kProgresspoints)); - return; -forgotone: - al = 50; - bl = 54; - bh = 70; - cx = 48; - dx = 8; - setupTimedUse(); -} - void DreamGenContext::transferMap() { STACK_CHECK; di = data.word(kExframepos); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index b13d150ad4..76fa167389 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -476,7 +476,6 @@ public: void findFirstPath(); void startTalk(); void getAnyAd(); - void reminders(); void getFreeAd(); void dirFile(); void pickupConts(); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 6989a57a93..c755b93dec 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -3784,7 +3784,7 @@ void DreamGenContext::afterNewRoom() { zoom(); workToScreenM(); walkIntoRoom(); - reminders(); + edensFlatReminders(); atmospheres(); } @@ -4616,4 +4616,32 @@ void DreamGenContext::lookAtPlace() { workToScreenM(); } +void DreamGenContext::edensFlatReminders() { + if (data.byte(kReallocation) != 24 || data.byte(kMapx) != 44) + return; // not in Eden's lift + + if (data.byte(kProgresspoints)) + return; // not the first time in Eden's apartment + + uint16 exObjextIndex = findExObject("CSHR"); + if (!isRyanHolding("DKEY") || exObjextIndex == kNumexobjects) { + DreamBase::setupTimedUse(50, 48, 8, 54, 70); // forgot something + return; + } + + DynObject *object = getExAd(exObjextIndex); + + if (object->mapad[0] != 4) { + DreamBase::setupTimedUse(50, 48, 8, 54, 70); // forgot something + return; + } else if (object->mapad[1] != 255) { + if (!compare(object->mapad[1], object->mapad[0], "PURS")) { + DreamBase::setupTimedUse(50, 48, 8, 54, 70); // forgot something + return; + } + } + + data.byte(kProgresspoints)++; // got card +} + } // End of namespace DreamGen diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 1a76a785b8..f50f4d883d 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -377,5 +377,6 @@ void lookAtPlace(); void inToInv(); void outOfInv(); + void edensFlatReminders(); #endif -- cgit v1.2.3 From 2bdcbadbfe6badc8ab7c75bd27b988be7916828d Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sun, 18 Dec 2011 23:35:03 +0100 Subject: DREAMWEB: Yet more things to DreamBase --- engines/dreamweb/dreambase.h | 11 ++++++++--- engines/dreamweb/stubs.cpp | 26 +++++++------------------- engines/dreamweb/stubs.h | 16 +++------------- engines/dreamweb/vgagrafx.cpp | 4 ++-- 4 files changed, 20 insertions(+), 37 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 6de854f452..0cdcefe233 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -440,6 +440,12 @@ public: void makeMainScreen(); void showWatchReel(); void watchReel(); + void commandWithOb(uint8 command, uint8 type, uint8 index); + void examineObText(); + void blockNameText(); + void personNameText(); + void walkToText(); + void entryTexts(); // from use.cpp void placeFreeObject(uint8 index); @@ -487,9 +493,8 @@ public: void panelToMap(); void mapToPanel(); void dumpMap(); - void transferInv(); - + void zoom(); void multiGet(uint8 *dst, uint16 x, uint16 y, uint8 width, uint8 height); void multiPut(const uint8 *src, uint16 x, uint16 y, uint8 width, uint8 height); void multiDump(uint16 x, uint16 y, uint8 width, uint8 height); @@ -506,11 +511,11 @@ public: void showPCX(const Common::String &name); 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); + bool pixelCheckSet(const ObjPos *pos, uint8 x, uint8 y); void loadPalFromIFF(); void createPanel(); void createPanel2(); void showPanel(); - void entryTexts(); }; diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index c755b93dec..1a0c07cea5 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -1266,7 +1266,7 @@ void DreamGenContext::commandWithOb() { commandWithOb(al, bh, bl); } -void DreamGenContext::commandWithOb(uint8 command, uint8 type, uint8 index) { +void DreamBase::commandWithOb(uint8 command, uint8 type, uint8 index) { uint8 commandLine[64] = "OBJECT NAME ONE "; delTextLine(); uint16 commandText = kTextstart + getSegment(data.word(kCommandtext)).word(command * 2); @@ -1283,19 +1283,19 @@ void DreamGenContext::commandWithOb(uint8 command, uint8 type, uint8 index) { data.byte(kNewtextline) = 1; } -void DreamGenContext::examineObText() { +void DreamBase::examineObText() { commandWithOb(1, data.byte(kCommandtype), data.byte(kCommand)); } -void DreamGenContext::blockNameText() { +void DreamBase::blockNameText() { commandWithOb(0, data.byte(kCommandtype), data.byte(kCommand)); } -void DreamGenContext::personNameText() { +void DreamBase::personNameText() { commandWithOb(2, data.byte(kCommandtype), data.byte(kCommand) & 127); } -void DreamGenContext::walkToText() { +void DreamBase::walkToText() { commandWithOb(3, data.byte(kCommandtype), data.byte(kCommand)); } @@ -1446,10 +1446,6 @@ void DreamGenContext::walkAndExamine() { examineOb(); } -void DreamGenContext::obName() { - obName(al, ah); -} - void DreamGenContext::obName(uint8 command, uint8 commandType) { if (data.byte(kReasseschanges) == 0) { if ((commandType == data.byte(kCommandtype)) && (command == data.byte(kCommand))) { @@ -1796,19 +1792,15 @@ void DreamBase::showIcon() { } } -void DreamGenContext::checkIfSet() { - flags._z = !checkIfSet(al, ah); -} - bool DreamGenContext::checkIfSet(uint8 x, uint8 y) { const ObjPos *setList = (const ObjPos *)getSegment(data.word(kBuffers)).ptr(kSetlist, sizeof(ObjPos) * 128); for (size_t i = 0; i < 128; ++i) { const ObjPos *pos = setList + 127 - i; if (pos->index == 0xff || !pos->contains(x,y)) continue; - if (! pixelCheckSet(pos, x, y)) + if (!pixelCheckSet(pos, x, y)) continue; - if (! isItDescribed(pos)) + if (!isItDescribed(pos)) continue; obName(pos->index, 1); return true; @@ -1843,10 +1835,6 @@ void DreamBase::hangOnW(uint16 frameCount) { } } -void DreamGenContext::hangOnP() { - hangOnP(cx); -} - void DreamBase::hangOnP(uint16 count) { data.word(kMaintimer) = 0; uint8 pointerFrame = data.byte(kPointerframe); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index f50f4d883d..987f04f65a 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -61,7 +61,6 @@ DreamBase::showFrame(frameData, x, y, frameNumber, effectsFlag); } void width160(); - void zoom(); void commandOnly(); void commandOnly(uint8 command) { DreamBase::commandOnly(command); @@ -73,10 +72,9 @@ void checkIfEx(); bool checkIfEx(uint8 x, uint8 y); void commandWithOb(); - void commandWithOb(uint8 command, uint8 type, uint8 index); - void blockNameText(); - void walkToText(); - void personNameText(); + void commandWithOb(uint8 command, uint8 type, uint8 index) { + DreamBase::commandWithOb(command, type, index); + } DynObject *getFreeAd(uint8 index) { return DreamBase::getFreeAd(index); } @@ -98,7 +96,6 @@ DreamBase::checkOne(x, y, flag, flagEx, type, flagX, flagY); } void walkAndExamine(); - void obName(); void obName(uint8 command, uint8 commandType); void checkCoords(const RectWithCallback *rectWithCallbacks); void getExPos(); @@ -106,8 +103,6 @@ bool compare(uint8 index, uint8 flag, const char id[4]) { return DreamBase::compare(index, flag, id); } - bool pixelCheckSet(const ObjPos *pos, uint8 x, uint8 y); - void checkIfSet(); bool checkIfSet(uint8 x, uint8 y); void isItWorn(); bool isItWorn(const DynObject *object) { @@ -125,17 +120,12 @@ void hangOn(uint16 frameCount) { DreamBase::hangOn(frameCount); } - void hangOnP(); - void hangOnP(uint16 count) { - DreamBase::hangOnP(count); - } uint8 findNextColon(const uint8 **string) { return DreamBase::findNextColon(string); } void findNextColon(); const uint8 *getObTextStartCPP(); void useText(const uint8 *string); - void examineObText(); void showCity(); uint16 getPersFrame(uint8 index); void convIcons(); diff --git a/engines/dreamweb/vgagrafx.cpp b/engines/dreamweb/vgagrafx.cpp index cea9dbef8c..b1a23a6c96 100644 --- a/engines/dreamweb/vgagrafx.cpp +++ b/engines/dreamweb/vgagrafx.cpp @@ -371,7 +371,7 @@ void DreamBase::clearWork() { memset(workspace(), 0, 320*200); } -void DreamGenContext::zoom() { +void DreamBase::zoom() { if (data.word(kWatchingtime) != 0) return; if (data.byte(kZoomon) != 1) @@ -432,7 +432,7 @@ void DreamBase::transferInv() { data.word(kExframepos) += byteCount; } -bool DreamGenContext::pixelCheckSet(const ObjPos *pos, uint8 x, uint8 y) { +bool DreamBase::pixelCheckSet(const ObjPos *pos, uint8 x, uint8 y) { x -= pos->xMin; y -= pos->yMin; SetObject *setObject = getSetAd(pos->index); -- cgit v1.2.3 From d033566f6dea0330d17f54d2f1539c4587f231d0 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 20 Dec 2011 09:39:33 +0100 Subject: DREAMWEB: Move most of saveload.cpp to DreamBase --- engines/dreamweb/dreambase.h | 15 +++++- engines/dreamweb/saveload.cpp | 119 +++++++++++++++++++++++++++++++++++++----- engines/dreamweb/stubs.cpp | 99 ++--------------------------------- engines/dreamweb/stubs.h | 12 ----- 4 files changed, 122 insertions(+), 123 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 0cdcefe233..ba0499f95e 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -238,9 +238,18 @@ public: void namesToOld(); void showMainOps(); void showDiscOps(); - void showNames(); + void actualSave(); + void actualLoad(); void loadPosition(unsigned int slot); void savePosition(unsigned int slot, const char *descbuf); + void loadSaveBox(); + void showNames(); + void checkInput(); + void selectSlot(); + void showSlots(); + void showOpBox(); + void showSaveOps(); + void showLoadOps(); // from sound.cpp bool loadSpeech(byte type1, int idx1, byte type2, int idx2); @@ -320,7 +329,6 @@ public: Frame *tempGraphics2(); Frame *tempGraphics3(); void showArrows(); - void showOpBox(); void middlePanel(); void showDiary(); void readMouse(); @@ -446,6 +454,9 @@ public: void personNameText(); void walkToText(); void entryTexts(); + void setAllChanges(); + void restoreAll(); + void redrawMainScrn(); // from use.cpp void placeFreeObject(uint8 index); diff --git a/engines/dreamweb/saveload.cpp b/engines/dreamweb/saveload.cpp index cd32e4fa34..5ca8ce88ec 100644 --- a/engines/dreamweb/saveload.cpp +++ b/engines/dreamweb/saveload.cpp @@ -81,9 +81,9 @@ void DreamGenContext::doLoad(int savegameId) { dumpPointer(); dumpTextLine(); RectWithCallback loadlist[] = { - { kOpsx+176,kOpsx+192,kOpsy+60,kOpsy+76,&DreamGenContext::getBackToOps }, - { kOpsx+128,kOpsx+190,kOpsy+12,kOpsy+100,&DreamGenContext::actualLoad }, - { kOpsx+2,kOpsx+92,kOpsy+4,kOpsy+81,&DreamGenContext::selectSlot }, + { kOpsx+176,kOpsx+192,kOpsy+60,kOpsy+76,&DreamBase::getBackToOps }, + { kOpsx+128,kOpsx+190,kOpsy+12,kOpsy+100,&DreamBase::actualLoad }, + { kOpsx+2,kOpsx+92,kOpsy+4,kOpsy+81,&DreamBase::selectSlot }, { 0,320,0,200,&DreamBase::blank }, { 0xFFFF,0,0,0,0 } }; @@ -177,9 +177,9 @@ void DreamGenContext::saveGame() { dumpTextLine(); RectWithCallback savelist[] = { - { kOpsx+176,kOpsx+192,kOpsy+60,kOpsy+76,&DreamGenContext::getBackToOps }, - { kOpsx+128,kOpsx+190,kOpsy+12,kOpsy+100,&DreamGenContext::actualSave }, - { kOpsx+2,kOpsx+92,kOpsy+4,kOpsy+81,&DreamGenContext::selectSlot }, + { kOpsx+176,kOpsx+192,kOpsy+60,kOpsy+76,&DreamBase::getBackToOps }, + { kOpsx+128,kOpsx+190,kOpsy+12,kOpsy+100,&DreamBase::actualSave }, + { kOpsx+2,kOpsx+92,kOpsy+4,kOpsy+81,&DreamBase::selectSlot }, { 0,320,0,200,&DreamBase::blank }, { 0xFFFF,0,0,0,0 } }; @@ -268,7 +268,7 @@ void DreamGenContext::doSaveLoad() { workToScreenCPP(); RectWithCallback opsList[] = { - { kOpsx+59,kOpsx+114,kOpsy+30,kOpsy+76,&DreamGenContext::getBackFromOps }, + { kOpsx+59,kOpsx+114,kOpsy+30,kOpsy+76,&DreamBase::getBackFromOps }, { kOpsx+10,kOpsx+77,kOpsy+10,kOpsy+59,&DreamBase::DOSReturn }, { kOpsx+128,kOpsx+190,kOpsy+16,kOpsy+100,&DreamGenContext::discOps }, { 0,320,0,200,&DreamBase::blank }, @@ -316,6 +316,27 @@ void DreamGenContext::doSaveLoad() { data.byte(kManisoffscreen) = 0; } +void DreamBase::getBackFromOps() { + if (data.byte(kMandead) == 2) + blank(); + else + getBack1(); +} + +void DreamBase::getBackToOps() { + if (data.byte(kCommandtype) != 201) { + data.byte(kCommandtype) = 201; + commandOnly(42); + } + + if (data.word(kMousebutton) != data.word(kOldbutton)) { + if (data.word(kMousebutton) & 1) { + oldToNames(); + data.byte(kGetback) = 2; + } + } +} + void DreamBase::showMainOps() { showFrame(tempGraphics(), kOpsx+10, kOpsy+10, 8, 0); showFrame(tempGraphics(), kOpsx+59, kOpsy+30, 7, 0); @@ -329,7 +350,46 @@ void DreamBase::showDiscOps() { showFrame(tempGraphics(), kOpsx+176+2, kOpsy+60-4, 5, 0); } -void DreamGenContext::actualSave() { +void DreamGenContext::discOps() { + if (data.byte(kCommandtype) != 249) { + data.byte(kCommandtype) = 249; + commandOnly(43); + } + + if (data.word(kMousebutton) == data.word(kOldbutton) || !(data.word(kMousebutton) & 1)) + return; + + scanForNames(); + data.byte(kLoadingorsave) = 2; + showOpBox(); + showDiscOps(); + data.byte(kCurrentslot) = 0; + workToScreenM(); + data.byte(kGetback) = 0; + + RectWithCallback discOpsList[] = { + { kOpsx+59,kOpsx+114,kOpsy+30,kOpsy+76,&DreamGenContext::loadGame }, + { kOpsx+10,kOpsx+79,kOpsy+10,kOpsy+59,&DreamGenContext::saveGame }, + { kOpsx+176,kOpsx+192,kOpsy+60,kOpsy+76,&DreamBase::getBackToOps }, + { 0,320,0,200,&DreamBase::blank }, + { 0xFFFF,0,0,0,0 } + }; + + do { + if (data.byte(kQuitrequested) != 0) + return; // quitdiscops + + delPointer(); + readMouse(); + showPointer(); + vSync(); + dumpPointer(); + dumpTextLine(); + checkCoords(discOpsList); + } while (!data.byte(kGetback)); +} + +void DreamBase::actualSave() { if (data.byte(kCommandtype) != 222) { data.byte(kCommandtype) = 222; commandOnly(44); @@ -356,7 +416,7 @@ void DreamGenContext::actualSave() { data.byte(kGetback) = 4; } -void DreamGenContext::actualLoad() { +void DreamBase::actualLoad() { if (data.byte(kCommandtype) != 221) { data.byte(kCommandtype) = 221; commandOnly(41); @@ -584,7 +644,7 @@ void DreamGenContext::loadOld() { data.byte(kGetback) = 0; } -void DreamGenContext::loadSaveBox() { +void DreamBase::loadSaveBox() { loadIntoTemp("DREAMWEB.G08"); } @@ -612,7 +672,7 @@ void DreamBase::showNames() { } } -void DreamGenContext::checkInput() { +void DreamBase::checkInput() { if (data.byte(kLoadingorsave) == 3) return; @@ -649,7 +709,7 @@ void DreamGenContext::checkInput() { workToScreenM(); } -void DreamGenContext::selectSlot() { +void DreamBase::selectSlot() { if (data.byte(kCommandtype) != 244) { data.byte(kCommandtype) = 244; commandOnly(45); @@ -677,8 +737,41 @@ void DreamGenContext::selectSlot() { showSaveOps(); readMouse(); showPointer(); - workToScreen(); + workToScreenCPP(); delPointer(); } +void DreamBase::showSlots() { + showFrame(tempGraphics(), kOpsx + 7, kOpsy + 8, 2, 0); + + uint16 y = kOpsy + 11; + + for (int slot = 0; slot < 7; slot++) { + if (slot == data.byte(kCurrentslot)) + showFrame(tempGraphics(), kOpsx + 10, y, 3, 0); + + y += 10; + } +} + +void DreamBase::showOpBox() { + showFrame(tempGraphics(), kOpsx, kOpsy, 0, 0); + + // CHECKME: There seem to be versions of dreamweb in which this call + // should be removed. It displays a red dot on the ops dialogs if left in. + showFrame(tempGraphics(), kOpsx, kOpsy + 55, 4, 0); +} + +void DreamBase::showLoadOps() { + showFrame(tempGraphics(), kOpsx + 128 + 4, kOpsy + 12, 1, 0); + showFrame(tempGraphics(), kOpsx + 176 + 2, kOpsy + 60 - 4, 5, 0); + printMessage(kOpsx + 104, kOpsy + 14, 55, 101, (101 & 1)); +} + +void DreamBase::showSaveOps() { + showFrame(tempGraphics(), kOpsx + 128 + 4, kOpsy + 12, 1, 0); + showFrame(tempGraphics(), kOpsx + 176 + 2, kOpsy + 60 - 4, 5, 0); + printMessage(kOpsx + 104, kOpsy + 14, 54, 101, (101 & 1)); +} + } // End of namespace DreamGen diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 1a0c07cea5..c31edc2c65 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -1314,7 +1314,7 @@ void DreamBase::findOrMake(uint8 index, uint8 value, uint8 type) { change->type = type; } -void DreamGenContext::setAllChanges() { +void DreamBase::setAllChanges() { Change *change = (Change *)getSegment(data.word(kBuffers)).ptr(kListofchanges, sizeof(Change)); for (; change->index != 0xff; ++change) if (change->location == data.byte(kReallocation)) @@ -2309,7 +2309,7 @@ void DreamBase::loadRoomData(const Room &room, bool skipDat) { engine->closeFile(); } -void DreamGenContext::restoreAll() { +void DreamBase::restoreAll() { const Room &room = g_roomData[data.byte(kLocation)]; loadRoomData(room, true); setAllChanges(); @@ -3131,27 +3131,6 @@ void DreamGenContext::newGame() { data.byte(kGetback) = 3; } -void DreamBase::getBackFromOps() { - if (data.byte(kMandead) == 2) - blank(); - else - getBack1(); -} - -void DreamBase::getBackToOps() { - if (data.byte(kCommandtype) != 201) { - data.byte(kCommandtype) = 201; - commandOnly(42); - } - - if (data.word(kMousebutton) != data.word(kOldbutton)) { - if (data.word(kMousebutton) & 1) { - oldToNames(); - data.byte(kGetback) = 2; - } - } -} - void DreamGenContext::pickupOb(uint8 command, uint8 pos) { data.byte(kLastinvpos) = pos; data.byte(kObjecttype) = kFreeObjectType; @@ -3234,7 +3213,7 @@ void DreamGenContext::gettingShot() { clearBeforeLoad(); } -void DreamGenContext::redrawMainScrn() { +void DreamBase::redrawMainScrn() { data.word(kTimecount) = 0; createPanel(); data.byte(kNewobs) = 0; @@ -3630,26 +3609,6 @@ void DreamBase::showArrows() { showFrame(tempGraphics(), 280, 14, 2, 0); } -void DreamBase::showOpBox() { - showFrame(tempGraphics(), kOpsx, kOpsy, 0, 0); - - // CHECKME: There seem to be versions of dreamweb in which this call - // should be removed. It displays a red dot on the ops dialogs if left in. - showFrame(tempGraphics(), kOpsx, kOpsy + 55, 4, 0); -} - -void DreamGenContext::showLoadOps() { - showFrame(tempGraphics(), kOpsx + 128 + 4, kOpsy + 12, 1, 0); - showFrame(tempGraphics(), kOpsx + 176 + 2, kOpsy + 60 - 4, 5, 0); - printMessage(kOpsx + 104, kOpsy + 14, 55, 101, (101 & 1)); -} - -void DreamGenContext::showSaveOps() { - showFrame(tempGraphics(), kOpsx + 128 + 4, kOpsy + 12, 1, 0); - showFrame(tempGraphics(), kOpsx + 176 + 2, kOpsy + 60 - 4, 5, 0); - printMessage(kOpsx + 104, kOpsy + 14, 54, 101, (101 & 1)); -} - void DreamBase::middlePanel() { Frame *tempSprites = (Frame *)getSegment(data.word(kTempsprites)).ptr(0, 0); showFrame(tempSprites, 72 + 47 + 20, 0, 48, 0); @@ -3891,45 +3850,6 @@ void DreamGenContext::talk() { } } -void DreamGenContext::discOps() { - if (data.byte(kCommandtype) != 249) { - data.byte(kCommandtype) = 249; - commandOnly(43); - } - - if (data.word(kMousebutton) == data.word(kOldbutton) || !(data.word(kMousebutton) & 1)) - return; - - scanForNames(); - data.byte(kLoadingorsave) = 2; - showOpBox(); - showDiscOps(); - data.byte(kCurrentslot) = 0; - workToScreenM(); - data.byte(kGetback) = 0; - - RectWithCallback discOpsList[] = { - { kOpsx+59,kOpsx+114,kOpsy+30,kOpsy+76,&DreamGenContext::loadGame }, - { kOpsx+10,kOpsx+79,kOpsy+10,kOpsy+59,&DreamGenContext::saveGame }, - { kOpsx+176,kOpsx+192,kOpsy+60,kOpsy+76,&DreamGenContext::getBackToOps }, - { 0,320,0,200,&DreamBase::blank }, - { 0xFFFF,0,0,0,0 } - }; - - do { - if (data.byte(kQuitrequested) != 0) - return; // quitdiscops - - delPointer(); - readMouse(); - showPointer(); - vSync(); - dumpPointer(); - dumpTextLine(); - checkCoords(discOpsList); - } while (!data.byte(kGetback)); -} - void DreamGenContext::hangOnPQ() { data.byte(kGetback) = 0; @@ -4510,19 +4430,6 @@ void DreamGenContext::lookAtCard() { putBackObStuff(); } -void DreamGenContext::showSlots() { - showFrame(tempGraphics(), kOpsx + 7, kOpsy + 8, 2, 0); - - uint16 y = kOpsy + 11; - - for (int slot = 0; slot < 7; slot++) { - if (slot == data.byte(kCurrentslot)) - showFrame(tempGraphics(), kOpsx + 10, y, 3, 0); - - y += 10; - } -} - void DreamBase::clearBuffers() { memset(getSegment(data.word(kBuffers)).ptr(0, kLengthofbuffer), 0, kLengthofbuffer); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 987f04f65a..8a9a41489a 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -87,7 +87,6 @@ SetObject *getSetAd(uint8 index) { return DreamBase::getSetAd(index); } - void setAllChanges(); void deleteTaken(); bool finishedWalkingCPP(); void finishedWalking(); @@ -162,9 +161,6 @@ void doLook(); void showFirstUse(); void showSecondUse(); - void actualSave(); - void actualLoad(); - void restoreAll(); void enterSymbol(); void viewFolder(); void edensCDPlayer(); @@ -221,7 +217,6 @@ void nextFolder(); void lastFolder(); void singleKey(uint8 key, uint16 x, uint16 y); - void loadSaveBox(); uint8 nextSymbol(uint8 symbol); void showSymbol(); void enterCode(uint8 digit0, uint8 digit1, uint8 digit2, uint8 digit3); @@ -247,9 +242,6 @@ void loadIntroRoom(); void afterIntroRoom(); void gettingShot(); - void redrawMainScrn(); - void selectSlot(); - void selectSlot2(); void allPointer(); void openYourNeighbour(); void openRyan(); @@ -294,8 +286,6 @@ return DreamBase::loadSpeech(type1, idx1, type2, idx2); } void set16ColPalette(); - void showSaveOps(); - void showLoadOps(); void afterNewRoom(); void madmanRun(); void showDecisions(); @@ -307,7 +297,6 @@ void hangOnPQ(); void showGun(); void endGame(); - void checkInput(); void dropError(); void cantDrop(); void newPlace(); @@ -341,7 +330,6 @@ void notHeldError(); void useGun(); void identifyOb(); - void showSlots(); void useCashCard(); void useStereo(); void selectOb(); -- cgit v1.2.3 From a4ffb8fe54c41c957f506c127c6aa30586769c52 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 19 Dec 2011 21:41:51 +0100 Subject: DREAMWEB: Convert fadeDownMon, fadeUpMon, initialMonCols to C++ Note that the two fade methods are currently unused; the only calls to them are commented out in the asm version of the code. This change also removes showGroup() --- engines/dreamweb/dreambase.h | 7 ++++-- engines/dreamweb/dreamgen.cpp | 58 ------------------------------------------- engines/dreamweb/dreamgen.h | 3 --- engines/dreamweb/monitor.cpp | 6 +++-- engines/dreamweb/stubs.h | 1 - engines/dreamweb/vgafades.cpp | 46 ++++++++++++++++++++++++++-------- 6 files changed, 44 insertions(+), 77 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index ba0499f95e..45560dbc35 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -479,8 +479,11 @@ public: void fadeDOS(); void doFade(); void fadeCalculation(); - void fadeupYellows(); - void fadeupMonFirst(); + void fadeUpYellows(); + void fadeUpMonFirst(); + void fadeUpMon(); + void fadeDownMon(); + void initialMonCols(); void fadeScreenUp(); void fadeScreenUps(); void fadeScreenUpHalf(); diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index dff190a6bf..c2d8530b25 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -167,64 +167,6 @@ endearly2: cx = pop(); } -void DreamGenContext::fadeDownMon() { - STACK_CHECK; - palToStartPal(); - palToEndPal(); - es = data.word(kBuffers); - di = (0+(228*13)+32+60+(32*32)+(11*10*3)+768)+(231*3); - cx = 3*8; - ax = 0; - _stosb(cx, true); - di = (0+(228*13)+32+60+(32*32)+(11*10*3)+768)+(246*3); - _stosb(); - _stosw(); - data.byte(kFadedirection) = 1; - data.byte(kFadecount) = 63; - data.byte(kColourpos) = 0; - data.byte(kNumtofade) = 128; - cx = 64; - hangOn(); -} - -void DreamGenContext::fadeUpMon() { - STACK_CHECK; - palToStartPal(); - palToEndPal(); - es = data.word(kBuffers); - di = (0+(228*13)+32+60+(32*32)+(11*10*3))+(231*3); - cx = 3*8; - ax = 0; - _stosb(cx, true); - di = (0+(228*13)+32+60+(32*32)+(11*10*3))+(246*3); - _stosb(); - _stosw(); - data.byte(kFadedirection) = 1; - data.byte(kFadecount) = 63; - data.byte(kColourpos) = 0; - data.byte(kNumtofade) = 128; - cx = 128; - hangOn(); -} - -void DreamGenContext::initialMonCols() { - STACK_CHECK; - palToStartPal(); - es = data.word(kBuffers); - di = (0+(228*13)+32+60+(32*32)+(11*10*3))+(230*3); - cx = 3*9; - ax = 0; - _stosb(cx, true); - di = (0+(228*13)+32+60+(32*32)+(11*10*3))+(246*3); - _stosb(); - _stosw(); - ds = data.word(kBuffers); - si = (0+(228*13)+32+60+(32*32)+(11*10*3))+(230*3); - al = 230; - cx = 18; - showGroup(); -} - void DreamGenContext::fillOpen() { STACK_CHECK; delTextLine(); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 76fa167389..92b75a287a 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -465,7 +465,6 @@ public: void __start(); #include "stubs.h" // Allow hand-reversed functions to have a signature different than void f() - void fadeDownMon(); void getPersonText(); void getObTextStart(); void checkObjectSize(); @@ -479,7 +478,6 @@ public: void getFreeAd(); void dirFile(); void pickupConts(); - void fadeUpMon(); void reExFromInv(); void transferMap(); void purgeAnItem(); @@ -504,7 +502,6 @@ public: void incRyanPage(); void searchForFiles(); void getExAd(); - void initialMonCols(); void swapWithInv(); void transferToEx(); void parser(); diff --git a/engines/dreamweb/monitor.cpp b/engines/dreamweb/monitor.cpp index 26caeb29ec..665265052a 100644 --- a/engines/dreamweb/monitor.cpp +++ b/engines/dreamweb/monitor.cpp @@ -63,8 +63,8 @@ void DreamGenContext::useMon() { printLogo(); workToScreenCPP(); turnOnPower(); - fadeupYellows(); - fadeupMonFirst(); + fadeUpYellows(); + fadeUpMonFirst(); data.word(kMonadx) = 76; data.word(kMonady) = 141; monMessage(1); @@ -171,10 +171,12 @@ bool DreamGenContext::execCommand() { void DreamBase::monitorLogo() { if (data.byte(kLogonum) != data.byte(kOldlogonum)) { data.byte(kOldlogonum) = data.byte(kLogonum); + //fadeDownMon(); // FIXME: Commented out in ASM printLogo(); printUnderMon(); workToScreenCPP(); printLogo(); + //fadeUpMon(); // FIXME: Commented out in ASM printLogo(); playChannel1(26); randomAccess(20); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 8a9a41489a..81949801b1 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -280,7 +280,6 @@ void moreTalk(); void redes(); void selectLocation(); - void showGroup(); void loadSpeech(); bool loadSpeech(byte type1, int idx1, byte type2, int idx2) { return DreamBase::loadSpeech(type1, idx1, type2, idx2); diff --git a/engines/dreamweb/vgafades.cpp b/engines/dreamweb/vgafades.cpp index 7518c226f4..d975d303c9 100644 --- a/engines/dreamweb/vgafades.cpp +++ b/engines/dreamweb/vgafades.cpp @@ -114,7 +114,7 @@ void DreamBase::fadeCalculation() { --data.byte(kFadecount); } -void DreamBase::fadeupYellows() { +void DreamBase::fadeUpYellows() { palToEndPal(); memset(endPalette() + 231 * 3, 0, 8 * 3); memset(endPalette() + 246 * 3, 0, 1 * 3); @@ -125,7 +125,7 @@ void DreamBase::fadeupYellows() { hangOn(128); } -void DreamBase::fadeupMonFirst() { +void DreamBase::fadeUpMonFirst() { palToStartPal(); palToEndPal(); memset(startPalette() + 231 * 3, 0, 8 * 3); @@ -139,6 +139,39 @@ void DreamBase::fadeupMonFirst() { hangOn(64); } + +void DreamBase::fadeDownMon() { + palToStartPal(); + palToEndPal(); + memset(endPalette() + 231 * 3, 0, 8 * 3); + memset(endPalette() + 246 * 3, 0, 1 * 3); + data.byte(kFadedirection) = 1; + data.byte(kFadecount) = 63; + data.byte(kColourpos) = 0; + data.byte(kNumtofade) = 128; + hangOn(64); +} + +void DreamBase::fadeUpMon() { + palToStartPal(); + palToEndPal(); + memset(startPalette() + 231 * 3, 0, 8 * 3); + memset(startPalette() + 246 * 3, 0, 1 * 3); + data.byte(kFadedirection) = 1; + data.byte(kFadecount) = 63; + data.byte(kColourpos) = 0; + data.byte(kNumtofade) = 128; + hangOn(128); +} + +void DreamBase::initialMonCols() { + palToStartPal(); + memset(startPalette() + 230 * 3, 0, 9 * 3); + memset(startPalette() + 246 * 3, 0, 1 * 3); + engine->processEvents(); + engine->setPalette(startPalette() + 230 * 3, 230, 18); +} + void DreamBase::fadeScreenUp() { clearStartPal(); palToEndPal(); @@ -260,15 +293,6 @@ void DreamBase::dumpCurrent() { engine->setPalette(pal, 128, 128); } -void DreamGenContext::showGroup() { - engine->processEvents(); - unsigned n = (uint16)cx; - uint8 *src = ds.ptr(si, n * 3); - engine->setPalette(src, al, n); - si += n * 3; - cx = 0; -} - void DreamGenContext::rollEndCredits2() { rollEm(); } -- cgit v1.2.3 From cdc6bc421bef6ed0119819a92fba1b2b9283ce17 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 20 Dec 2011 09:44:00 +0100 Subject: DREAMWEB: Turn RectWithCallback into template Also moves checkCoords to DreamBase, adding a nasty cast to it. This is a temporary HACK, which allows moving functions that use checkCoords to DreamBase one at a time, instead of all at once (and at the same time as checkCoords). This can be undone once everything using checkCoords has been moved to DreamBase. --- engines/dreamweb/dreambase.h | 1 + engines/dreamweb/keypad.cpp | 2 +- engines/dreamweb/object.cpp | 6 +++--- engines/dreamweb/saveload.cpp | 8 ++++---- engines/dreamweb/structs.h | 3 ++- engines/dreamweb/stubs.cpp | 25 +++++++++++++------------ engines/dreamweb/stubs.h | 2 +- engines/dreamweb/use.cpp | 2 +- 8 files changed, 26 insertions(+), 23 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 45560dbc35..f2a4b70209 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -457,6 +457,7 @@ public: void setAllChanges(); void restoreAll(); void redrawMainScrn(); + template void checkCoords(const RectWithCallback *rectWithCallbacks); // from use.cpp void placeFreeObject(uint8 index); diff --git a/engines/dreamweb/keypad.cpp b/engines/dreamweb/keypad.cpp index 43f6749cad..b3ed844079 100644 --- a/engines/dreamweb/keypad.cpp +++ b/engines/dreamweb/keypad.cpp @@ -93,7 +93,7 @@ void DreamBase::addToPressList() { } void DreamGenContext::enterCode(uint8 digit0, uint8 digit1, uint8 digit2, uint8 digit3) { - RectWithCallback keypadList[] = { + RectWithCallback keypadList[] = { { kKeypadx+9,kKeypadx+30,kKeypady+9,kKeypady+22,&DreamBase::buttonOne }, { kKeypadx+31,kKeypadx+52,kKeypady+9,kKeypady+22,&DreamBase::buttonTwo }, { kKeypadx+53,kKeypadx+74,kKeypady+9,kKeypady+22,&DreamBase::buttonThree }, diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index 54979309f4..1c1ae5b4a0 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -170,7 +170,7 @@ void DreamGenContext::examineOb(bool examineAgain) { switch (data.byte(kInvopen)) { case 0: { - RectWithCallback examList[] = { + RectWithCallback examList[] = { { 273,320,157,198,&DreamGenContext::getBackFromOb }, { 260,300,0,44,&DreamGenContext::useObject }, { 210,254,0,44,&DreamGenContext::selectOpenOb }, @@ -184,7 +184,7 @@ void DreamGenContext::examineOb(bool examineAgain) { } case 1: { // Note: This table contains the non-constant _openChangeSize! - RectWithCallback invList1[] = { + RectWithCallback invList1[] = { { 273,320,157,198,&DreamGenContext::getBackFromOb }, { 255,294,0,24,&DreamGenContext::dropObject }, { kInventx+167,kInventx+167+(18*3),kInventy-18,kInventy-2,&DreamGenContext::incRyanPage }, @@ -197,7 +197,7 @@ void DreamGenContext::examineOb(bool examineAgain) { break; } default: { - RectWithCallback withList1[] = { + RectWithCallback withList1[] = { { 273,320,157,198,&DreamGenContext::getBackFromOb }, { kInventx+167,kInventx+167+(18*3),kInventy-18,kInventy-2,&DreamGenContext::incRyanPage }, { kInventx,kInventx+(5*kItempicsize), kInventy,kInventy+(2*kItempicsize),&DreamGenContext::selectOb }, diff --git a/engines/dreamweb/saveload.cpp b/engines/dreamweb/saveload.cpp index 5ca8ce88ec..ceaac99ae1 100644 --- a/engines/dreamweb/saveload.cpp +++ b/engines/dreamweb/saveload.cpp @@ -80,7 +80,7 @@ void DreamGenContext::doLoad(int savegameId) { vSync(); dumpPointer(); dumpTextLine(); - RectWithCallback loadlist[] = { + RectWithCallback loadlist[] = { { kOpsx+176,kOpsx+192,kOpsy+60,kOpsy+76,&DreamBase::getBackToOps }, { kOpsx+128,kOpsx+190,kOpsy+12,kOpsy+100,&DreamBase::actualLoad }, { kOpsx+2,kOpsx+92,kOpsy+4,kOpsy+81,&DreamBase::selectSlot }, @@ -176,7 +176,7 @@ void DreamGenContext::saveGame() { dumpPointer(); dumpTextLine(); - RectWithCallback savelist[] = { + RectWithCallback savelist[] = { { kOpsx+176,kOpsx+192,kOpsy+60,kOpsy+76,&DreamBase::getBackToOps }, { kOpsx+128,kOpsx+190,kOpsy+12,kOpsy+100,&DreamBase::actualSave }, { kOpsx+2,kOpsx+92,kOpsy+4,kOpsy+81,&DreamBase::selectSlot }, @@ -267,7 +267,7 @@ void DreamGenContext::doSaveLoad() { showMainOps(); workToScreenCPP(); - RectWithCallback opsList[] = { + RectWithCallback opsList[] = { { kOpsx+59,kOpsx+114,kOpsy+30,kOpsy+76,&DreamBase::getBackFromOps }, { kOpsx+10,kOpsx+77,kOpsy+10,kOpsy+59,&DreamBase::DOSReturn }, { kOpsx+128,kOpsx+190,kOpsy+16,kOpsy+100,&DreamGenContext::discOps }, @@ -367,7 +367,7 @@ void DreamGenContext::discOps() { workToScreenM(); data.byte(kGetback) = 0; - RectWithCallback discOpsList[] = { + RectWithCallback discOpsList[] = { { kOpsx+59,kOpsx+114,kOpsy+30,kOpsy+76,&DreamGenContext::loadGame }, { kOpsx+10,kOpsx+79,kOpsy+10,kOpsy+59,&DreamGenContext::saveGame }, { kOpsx+176,kOpsx+192,kOpsy+60,kOpsy+76,&DreamBase::getBackToOps }, diff --git a/engines/dreamweb/structs.h b/engines/dreamweb/structs.h index 313f3caf0b..320ed7e1a8 100644 --- a/engines/dreamweb/structs.h +++ b/engines/dreamweb/structs.h @@ -62,10 +62,11 @@ struct Sprite { class DreamGenContext; +template struct RectWithCallback { uint16 _xMin, _xMax; uint16 _yMin, _yMax; - void (DreamGenContext::*_callback)(); + void (T::*_callback)(); bool contains(uint16 x, uint16 y) const { return (x >= _xMin) && (x < _xMax) && (y >= _yMin) && (y < _yMax); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index c31edc2c65..eed12ceb95 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -1566,14 +1566,15 @@ void DreamBase::dumpPointer() { multiDump(data.word(kOldpointerx), data.word(kOldpointery), data.byte(kPointerxs), data.byte(kPointerys)); } -void DreamGenContext::checkCoords(const RectWithCallback *rectWithCallbacks) { +template +void DreamBase::checkCoords(const RectWithCallback *rectWithCallbacks) { if (data.byte(kNewlocation) != 0xff) return; - const RectWithCallback *r; + const RectWithCallback *r; for (r = rectWithCallbacks; r->_xMin != 0xffff; ++r) { if (r->contains(data.word(kMousex), data.word(kMousey))) { - (this->*(r->_callback))(); + (((T *)this)->*(r->_callback))(); return; } } @@ -1918,7 +1919,7 @@ void DreamGenContext::enterSymbol() { dumpPointer(); dumpTextLine(); dumpSymbol(); - RectWithCallback symbolList[] = { + RectWithCallback symbolList[] = { { kSymbolx+40,kSymbolx+64,kSymboly+2,kSymboly+16,&DreamBase::quitSymbol }, { kSymbolx,kSymbolx+52,kSymboly+20,kSymboly+50,&DreamBase::setTopLeft }, { kSymbolx+52,kSymbolx+104,kSymboly+20,kSymboly+50,&DreamBase::setTopRight }, @@ -1998,7 +1999,7 @@ void DreamGenContext::showCity() { void DreamGenContext::mainScreen() { data.byte(kInmaparea) = 0; if (data.byte(kWatchon) == 1) { - RectWithCallback mainList[] = { + RectWithCallback mainList[] = { { 44,70,32,46,&DreamGenContext::look }, { 0,50,0,180,&DreamGenContext::inventory }, { 226,244,10,26,&DreamGenContext::zoomOnOff }, @@ -2009,7 +2010,7 @@ void DreamGenContext::mainScreen() { }; checkCoords(mainList); } else { - RectWithCallback mainList2[] = { + RectWithCallback mainList2[] = { { 44,70,32,46,&DreamGenContext::look }, { 0,50,0,180,&DreamGenContext::inventory }, { 226+48,244+48,10,26,&DreamGenContext::zoomOnOff }, @@ -2476,7 +2477,7 @@ const uint8 *DreamBase::getTextInFile1(uint16 index) { } void DreamGenContext::checkFolderCoords() { - RectWithCallback folderList[] = { + RectWithCallback folderList[] = { { 280,320,160,200, &DreamBase::quitKey }, { 143,300,6,194, &DreamGenContext::nextFolder }, { 0,143,6,194, &DreamGenContext::lastFolder }, @@ -2633,7 +2634,7 @@ void DreamGenContext::useMenu() { dumpPointer(); dumpMenu(); dumpTextLine(); - RectWithCallback menuList[] = { + RectWithCallback menuList[] = { { kMenux+54,kMenux+68,kMenuy+72,kMenuy+88,&DreamBase::quitKey }, { 0,320,0,200,&DreamBase::blank }, { 0xFFFF,0,0,0,0 } @@ -3559,7 +3560,7 @@ void DreamGenContext::selectLocation() { if (data.byte(kGetback) == 1) break; - RectWithCallback destList[] = { + RectWithCallback destList[] = { { 238,258,4,44,&DreamGenContext::nextDest }, { 104,124,4,44,&DreamGenContext::lastDest }, { 280,308,4,44,&DreamGenContext::lookAtPlace }, @@ -3772,7 +3773,7 @@ void DreamGenContext::decide() { fadeScreenUp(); data.byte(kGetback) = 0; - RectWithCallback decideList[] = { + RectWithCallback decideList[] = { { kOpsx+69,kOpsx+124,kOpsy+30,kOpsy+76,&DreamGenContext::newGame }, { kOpsx+20,kOpsx+87,kOpsy+10,kOpsy+59,&DreamBase::DOSReturn }, { kOpsx+123,kOpsx+190,kOpsy+10,kOpsy+59,&DreamGenContext::loadOld }, @@ -3817,7 +3818,7 @@ void DreamGenContext::talk() { showPointer(); workToScreenCPP(); - RectWithCallback talkList[] = { + RectWithCallback talkList[] = { { 273,320,157,198,&DreamBase::getBack1 }, { 240,290,2,44,&DreamGenContext::moreTalk }, { 0,320,0,200,&DreamBase::blank }, @@ -3853,7 +3854,7 @@ void DreamGenContext::talk() { void DreamGenContext::hangOnPQ() { data.byte(kGetback) = 0; - RectWithCallback quitList[] = { + RectWithCallback quitList[] = { { 273,320,157,198,&DreamBase::getBack1 }, { 0,320,0,200,&DreamBase::blank }, { 0xFFFF,0,0,0,0 } diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 81949801b1..a3efebd2fe 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -96,7 +96,7 @@ } void walkAndExamine(); void obName(uint8 command, uint8 commandType); - void checkCoords(const RectWithCallback *rectWithCallbacks); + void getExPos(); void compare(); bool compare(uint8 index, uint8 flag, const char id[4]) { diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp index 5cb1f6b92c..7765215827 100644 --- a/engines/dreamweb/use.cpp +++ b/engines/dreamweb/use.cpp @@ -1270,7 +1270,7 @@ void DreamGenContext::useDiary() { delPointer(); data.byte(kGetback) = 0; - RectWithCallback diaryList[] = { + RectWithCallback diaryList[] = { { kDiaryx+94,kDiaryx+110,kDiaryy+97,kDiaryy+113,&DreamBase::diaryKeyN }, { kDiaryx+151,kDiaryx+167,kDiaryy+71,kDiaryy+87,&DreamBase::diaryKeyP }, { kDiaryx+176,kDiaryx+192,kDiaryy+108,kDiaryy+124,&DreamBase::quitKey }, -- cgit v1.2.3 From ef98df589563d77625928b69be79f7227e97d4a7 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 20 Dec 2011 10:27:02 +0100 Subject: DREAMWEB: cleanup --- engines/dreamweb/dreambase.h | 3 +++ engines/dreamweb/keypad.cpp | 2 +- engines/dreamweb/object.cpp | 6 +++--- engines/dreamweb/saveload.cpp | 11 +++++++++-- engines/dreamweb/stubs.cpp | 19 ++++++------------- engines/dreamweb/stubs.h | 3 --- engines/dreamweb/use.cpp | 2 +- 7 files changed, 23 insertions(+), 23 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index f2a4b70209..18eff56a77 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -242,6 +242,7 @@ public: void actualLoad(); void loadPosition(unsigned int slot); void savePosition(unsigned int slot, const char *descbuf); + void showDecisions(); void loadSaveBox(); void showNames(); void checkInput(); @@ -458,6 +459,8 @@ public: void restoreAll(); void redrawMainScrn(); template void checkCoords(const RectWithCallback *rectWithCallbacks); + void newGame(); + void deleteTaken(); // from use.cpp void placeFreeObject(uint8 index); diff --git a/engines/dreamweb/keypad.cpp b/engines/dreamweb/keypad.cpp index b3ed844079..6e6941918f 100644 --- a/engines/dreamweb/keypad.cpp +++ b/engines/dreamweb/keypad.cpp @@ -93,7 +93,7 @@ void DreamBase::addToPressList() { } void DreamGenContext::enterCode(uint8 digit0, uint8 digit1, uint8 digit2, uint8 digit3) { - RectWithCallback keypadList[] = { + RectWithCallback keypadList[] = { { kKeypadx+9,kKeypadx+30,kKeypady+9,kKeypady+22,&DreamBase::buttonOne }, { kKeypadx+31,kKeypadx+52,kKeypady+9,kKeypady+22,&DreamBase::buttonTwo }, { kKeypadx+53,kKeypadx+74,kKeypady+9,kKeypady+22,&DreamBase::buttonThree }, diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index 1c1ae5b4a0..8553f41ee8 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -171,7 +171,7 @@ void DreamGenContext::examineOb(bool examineAgain) { switch (data.byte(kInvopen)) { case 0: { RectWithCallback examList[] = { - { 273,320,157,198,&DreamGenContext::getBackFromOb }, + { 273,320,157,198,&DreamBase::getBackFromOb }, { 260,300,0,44,&DreamGenContext::useObject }, { 210,254,0,44,&DreamGenContext::selectOpenOb }, { 144,176,64,96,&DreamGenContext::setPickup }, @@ -185,7 +185,7 @@ void DreamGenContext::examineOb(bool examineAgain) { case 1: { // Note: This table contains the non-constant _openChangeSize! RectWithCallback invList1[] = { - { 273,320,157,198,&DreamGenContext::getBackFromOb }, + { 273,320,157,198,&DreamBase::getBackFromOb }, { 255,294,0,24,&DreamGenContext::dropObject }, { kInventx+167,kInventx+167+(18*3),kInventy-18,kInventy-2,&DreamGenContext::incRyanPage }, { kInventx,_openChangeSize,kInventy+100,kInventy+100+kItempicsize,&DreamGenContext::useOpened }, @@ -198,7 +198,7 @@ void DreamGenContext::examineOb(bool examineAgain) { } default: { RectWithCallback withList1[] = { - { 273,320,157,198,&DreamGenContext::getBackFromOb }, + { 273,320,157,198,&DreamBase::getBackFromOb }, { kInventx+167,kInventx+167+(18*3),kInventy-18,kInventy-2,&DreamGenContext::incRyanPage }, { kInventx,kInventx+(5*kItempicsize), kInventy,kInventy+(2*kItempicsize),&DreamGenContext::selectOb }, { 0,320,0,200,&DreamBase::blank }, diff --git a/engines/dreamweb/saveload.cpp b/engines/dreamweb/saveload.cpp index ceaac99ae1..a0309e1ee0 100644 --- a/engines/dreamweb/saveload.cpp +++ b/engines/dreamweb/saveload.cpp @@ -80,7 +80,7 @@ void DreamGenContext::doLoad(int savegameId) { vSync(); dumpPointer(); dumpTextLine(); - RectWithCallback loadlist[] = { + RectWithCallback loadlist[] = { { kOpsx+176,kOpsx+192,kOpsy+60,kOpsy+76,&DreamBase::getBackToOps }, { kOpsx+128,kOpsx+190,kOpsy+12,kOpsy+100,&DreamBase::actualLoad }, { kOpsx+2,kOpsx+92,kOpsy+4,kOpsy+81,&DreamBase::selectSlot }, @@ -176,7 +176,7 @@ void DreamGenContext::saveGame() { dumpPointer(); dumpTextLine(); - RectWithCallback savelist[] = { + RectWithCallback savelist[] = { { kOpsx+176,kOpsx+192,kOpsy+60,kOpsy+76,&DreamBase::getBackToOps }, { kOpsx+128,kOpsx+190,kOpsy+12,kOpsy+100,&DreamBase::actualSave }, { kOpsx+2,kOpsx+92,kOpsy+4,kOpsy+81,&DreamBase::selectSlot }, @@ -644,6 +644,13 @@ void DreamGenContext::loadOld() { data.byte(kGetback) = 0; } +void DreamBase::showDecisions() { + createPanel2(); + showOpBox(); + showFrame(tempGraphics(), kOpsx + 17, kOpsy + 13, 6, 0); + underTextLine(); +} + void DreamBase::loadSaveBox() { loadIntoTemp("DREAMWEB.G08"); } diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index eed12ceb95..dde9613f52 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -1386,7 +1386,7 @@ void DreamBase::doChange(uint8 index, uint8 value, uint8 type) { } } -void DreamGenContext::deleteTaken() { +void DreamBase::deleteTaken() { const DynObject *extraObjects = (const DynObject *)getSegment(data.word(kExtras)).ptr(kExdata, 0); DynObject *freeObjects = (DynObject *)getSegment(data.word(kFreedat)).ptr(0, 0); for (size_t i = 0; i < kNumexobjects; ++i) { @@ -1919,7 +1919,7 @@ void DreamGenContext::enterSymbol() { dumpPointer(); dumpTextLine(); dumpSymbol(); - RectWithCallback symbolList[] = { + RectWithCallback symbolList[] = { { kSymbolx+40,kSymbolx+64,kSymboly+2,kSymboly+16,&DreamBase::quitSymbol }, { kSymbolx,kSymbolx+52,kSymboly+20,kSymboly+50,&DreamBase::setTopLeft }, { kSymbolx+52,kSymbolx+104,kSymboly+20,kSymboly+50,&DreamBase::setTopRight }, @@ -2634,7 +2634,7 @@ void DreamGenContext::useMenu() { dumpPointer(); dumpMenu(); dumpTextLine(); - RectWithCallback menuList[] = { + RectWithCallback menuList[] = { { kMenux+54,kMenux+68,kMenuy+72,kMenuy+88,&DreamBase::quitKey }, { 0,320,0,200,&DreamBase::blank }, { 0xFFFF,0,0,0,0 } @@ -3122,7 +3122,7 @@ void DreamBase::setBotRight() { data.byte(kSymbolbotdir) = 1; } -void DreamGenContext::newGame() { +void DreamBase::newGame() { if (data.byte(kCommandtype) != 251) { data.byte(kCommandtype) = 251; commandOnly(47); @@ -3630,13 +3630,6 @@ void DreamBase::underTextLine() { multiGet(textUnder(), data.byte(kTextaddressx), y, kUndertextsizex, kUndertextsizey); } -void DreamGenContext::showDecisions() { - createPanel2(); - showOpBox(); - showFrame(tempGraphics(), kOpsx + 17, kOpsy + 13, 6, 0); - underTextLine(); -} - void DreamBase::getUnderZoom() { multiGet(getSegment(data.word(kBuffers)).ptr(kZoomspace, 0), kZoomx + 5, kZoomy + 4, 46, 40); } @@ -3774,7 +3767,7 @@ void DreamGenContext::decide() { data.byte(kGetback) = 0; RectWithCallback decideList[] = { - { kOpsx+69,kOpsx+124,kOpsy+30,kOpsy+76,&DreamGenContext::newGame }, + { kOpsx+69,kOpsx+124,kOpsy+30,kOpsy+76,&DreamBase::newGame }, { kOpsx+20,kOpsx+87,kOpsy+10,kOpsy+59,&DreamBase::DOSReturn }, { kOpsx+123,kOpsx+190,kOpsy+10,kOpsy+59,&DreamGenContext::loadOld }, { 0,320,0,200,&DreamBase::blank }, @@ -3854,7 +3847,7 @@ void DreamGenContext::talk() { void DreamGenContext::hangOnPQ() { data.byte(kGetback) = 0; - RectWithCallback quitList[] = { + RectWithCallback quitList[] = { { 273,320,157,198,&DreamBase::getBack1 }, { 0,320,0,200,&DreamBase::blank }, { 0xFFFF,0,0,0,0 } diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index a3efebd2fe..61697e828e 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -87,7 +87,6 @@ SetObject *getSetAd(uint8 index) { return DreamBase::getSetAd(index); } - void deleteTaken(); bool finishedWalkingCPP(); void finishedWalking(); void checkOne(); @@ -235,7 +234,6 @@ void realCredits(); void runIntroSeq(); void intro(); - void newGame(); void pickupOb(uint8 command, uint8 pos); void initialInv(); void walkIntoRoom(); @@ -287,7 +285,6 @@ void set16ColPalette(); void afterNewRoom(); void madmanRun(); - void showDecisions(); void decide(); void talk(); void discOps(); diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp index 7765215827..f6406dc773 100644 --- a/engines/dreamweb/use.cpp +++ b/engines/dreamweb/use.cpp @@ -1270,7 +1270,7 @@ void DreamGenContext::useDiary() { delPointer(); data.byte(kGetback) = 0; - RectWithCallback diaryList[] = { + RectWithCallback diaryList[] = { { kDiaryx+94,kDiaryx+110,kDiaryy+97,kDiaryy+113,&DreamBase::diaryKeyN }, { kDiaryx+151,kDiaryx+167,kDiaryy+71,kDiaryy+87,&DreamBase::diaryKeyP }, { kDiaryx+176,kDiaryx+192,kDiaryy+108,kDiaryy+124,&DreamBase::quitKey }, -- cgit v1.2.3 From f41412186ba7bf3748428b572a3e5147d4313064 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 20 Dec 2011 11:05:24 +0100 Subject: DREAMWEB: Add newplace.cpp --- engines/dreamweb/dreambase.h | 12 +- engines/dreamweb/module.mk | 1 + engines/dreamweb/newplace.cpp | 251 ++++++++++++++++++++++++++++++++++++++++++ engines/dreamweb/stubs.cpp | 217 ------------------------------------ 4 files changed, 259 insertions(+), 222 deletions(-) create mode 100644 engines/dreamweb/newplace.cpp (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 18eff56a77..01772bb2ff 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -137,6 +137,13 @@ public: void loadNews(); void loadCart(); + // from newplace.cpp + void getUnderCentre(); + void putUnderCentre(); + void showArrows(); + uint8 getLocation(uint8 index); + void setLocation(uint8 index); + // from object.cpp void obIcons(); void fillRyan(); @@ -329,7 +336,6 @@ public: Frame *tempGraphics(); Frame *tempGraphics2(); Frame *tempGraphics3(); - void showArrows(); void middlePanel(); void showDiary(); void readMouse(); @@ -503,10 +509,6 @@ public: inline uint8 *workspace() { return _workspace; } void clearWork(); - uint8 getLocation(uint8 index); - void setLocation(uint8 index); - void getUnderCentre(); - void putUnderCentre(); uint8 *mapStore(); void panelToMap(); void mapToPanel(); diff --git a/engines/dreamweb/module.mk b/engines/dreamweb/module.mk index 398f0b8db0..9b6d9f30df 100644 --- a/engines/dreamweb/module.mk +++ b/engines/dreamweb/module.mk @@ -8,6 +8,7 @@ MODULE_OBJS := \ dreamgen.o \ keypad.o \ monitor.o \ + newplace.o \ object.o \ pathfind.o \ people.o \ diff --git a/engines/dreamweb/newplace.cpp b/engines/dreamweb/newplace.cpp new file mode 100644 index 0000000000..ba1276b9c6 --- /dev/null +++ b/engines/dreamweb/newplace.cpp @@ -0,0 +1,251 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "dreamweb/dreamweb.h" + +namespace DreamGen { + +void DreamGenContext::newPlace() { + if (data.byte(kNeedtotravel) == 1) { + data.byte(kNeedtotravel) = 0; + selectLocation(); + } else if (data.byte(kAutolocation) != 0xFF) { + data.byte(kNewlocation) = data.byte(kAutolocation); + data.byte(kAutolocation) = 0xFF; + } +} + +void DreamGenContext::selectLocation() { + data.byte(kInmaparea) = 0; + clearBeforeLoad(); + data.byte(kGetback) = 0; + data.byte(kPointerframe) = 22; + readCityPic(); + showCity(); + getRidOfTemp(); + readDestIcon(); + loadTravelText(); + showPanel(); + showMan(); + showArrows(); + showExit(); + locationPic(); + underTextLine(); + data.byte(kCommandtype) = 255; + readMouse(); + data.byte(kPointerframe) = 0; + showPointer(); + workToScreenCPP(); + playChannel0(9, 255); + data.byte(kNewlocation) = 255; + + while (data.byte(kNewlocation) == 255) { + if (quitRequested()) + break; + + delPointer(); + readMouse(); + showPointer(); + vSync(); + dumpPointer(); + dumpTextLine(); + + if (data.byte(kGetback) == 1) + break; + + RectWithCallback destList[] = { + { 238,258,4,44,&DreamGenContext::nextDest }, + { 104,124,4,44,&DreamGenContext::lastDest }, + { 280,308,4,44,&DreamGenContext::lookAtPlace }, + { 104,216,138,192,&DreamGenContext::destSelect }, + { 273,320,157,198,&DreamBase::getBack1 }, + { 0,320,0,200,&DreamBase::blank }, + { 0xFFFF,0,0,0,0 } + }; + checkCoords(destList); + } + + if (quitRequested() || data.byte(kGetback) == 1 || data.byte(kNewlocation) == data.byte(kLocation)) { + data.byte(kNewlocation) = data.byte(kReallocation); + data.byte(kGetback) = 0; + } + + getRidOfTemp(); + getRidOfTemp2(); + getRidOfTemp3(); + deallocateMem(data.word(kTraveltext)); +} + +void DreamGenContext::showCity() { + clearWork(); + showFrame(tempGraphics(), 57, 32, 0, 0); + showFrame(tempGraphics(), 120+57, 32, 1, 0); +} + +void DreamGenContext::lookAtPlace() { + if (data.byte(kCommandtype) != 224) { + data.byte(kCommandtype) = 224; + commandOnly(27); + } + + if (!(data.word(kMousebutton) & 1) || + data.word(kMousebutton) == data.word(kOldbutton) || + data.byte(kDestpos) >= 15) + return; // noinfo + + delPointer(); + delTextLine(); + getUnderCentre(); + showFrame(tempGraphics3(), 60, 72, 0, 0); + showFrame(tempGraphics3(), 60, 72 + 55, 4, 0); + if (data.byte(kForeignrelease)) + showFrame(tempGraphics3(), 60, 72+55+21, 4, 0); + + uint16 offset = kTextstart + getSegment(data.word(kTraveltext)).word(data.byte(kDestpos) * 2); + const uint8 *string = getSegment(data.word(kTraveltext)).ptr(offset, 0); + findNextColon(&string); + uint16 y = (data.byte(kForeignrelease)) ? 84 + 4 : 84; + printDirect(&string, 63, &y, 191, 191 & 1); + workToScreenM(); + hangOnP(500); + data.byte(kPointermode) = 0; + data.byte(kPointerframe) = 0; + putUnderCentre(); + workToScreenM(); +} + +void DreamBase::getUnderCentre() { + multiGet(mapStore(), 58, 72, 254, 110); +} + +void DreamBase::putUnderCentre() { + multiPut(mapStore(), 58, 72, 254, 110); +} + +// TODO: put Locationpic here + +// TODO: put Getdestinfo here + +void DreamBase::showArrows() { + showFrame(tempGraphics(), 116 - 12, 16, 0, 0); + showFrame(tempGraphics(), 226 + 12, 16, 1, 0); + showFrame(tempGraphics(), 280, 14, 2, 0); +} + +void DreamGenContext::nextDest() { + if (data.byte(kCommandtype) != 218) { + data.byte(kCommandtype) = 218; + commandOnly(28); + } + + if (!(data.word(kMousebutton) & 1) || data.word(kOldbutton) == 1) + return; // nodu + + do { + data.byte(kDestpos)++; + if (data.byte(kDestpos) == 15) + data.byte(kDestpos) = 0; // last destination + + getDestInfo(); + } while (al == 0); + + data.byte(kNewtextline) = 1; + delTextLine(); + delPointer(); + showPanel(); + showMan(); + showArrows(); + locationPic(); + underTextLine(); + readMouse(); + showPointer(); + workToScreenCPP(); + delPointer(); +} + +void DreamGenContext::lastDest() { + if (data.byte(kCommandtype) != 219) { + data.byte(kCommandtype) = 219; + commandOnly(29); + } + + if (!(data.word(kMousebutton) & 1) || data.word(kOldbutton) == 1) + return; // nodd + + do { + data.byte(kDestpos)--; + if (data.byte(kDestpos) == 0xFF) + data.byte(kDestpos) = 15; // first destination + + getDestInfo(); + } while (al == 0); + + data.byte(kNewtextline) = 1; + delTextLine(); + delPointer(); + showPanel(); + showMan(); + showArrows(); + locationPic(); + underTextLine(); + readMouse(); + showPointer(); + workToScreenCPP(); + delPointer(); +} + +void DreamGenContext::destSelect() { + if (data.byte(kCommandtype) != 222) { + data.byte(kCommandtype) = 222; + commandOnly(30); + } + + if (!(data.word(kMousebutton) & 1) || data.word(kOldbutton) == 1) + return; // notrav + + getDestInfo(); + data.byte(kNewlocation) = data.byte(kDestpos); +} + +uint8 DreamBase::getLocation(uint8 index) { + return data.byte(kRoomscango + index); +} + +void DreamBase::setLocation(uint8 index) { + data.byte(kRoomscango + index) = 1; +} + +// TODO: Place resetLocation here + +void DreamGenContext::readDestIcon() { + loadIntoTemp("DREAMWEB.G05"); + loadIntoTemp2("DREAMWEB.G06"); + loadIntoTemp3("DREAMWEB.G08"); +} + +void DreamGenContext::readCityPic() { + loadIntoTemp("DREAMWEB.G04"); +} + + + +} // End of namespace DreamGen diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index dde9613f52..137fad4526 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -846,14 +846,6 @@ void DreamBase::putUnderTimed() { multiPut(getSegment(data.word(kBuffers)).ptr(kUndertimedtext, 0), data.byte(kTimedx), y, 240, kUndertimedysize); } -void DreamBase::getUnderCentre() { - multiGet(mapStore(), 58, 72, 254, 110); -} - -void DreamBase::putUnderCentre() { - multiPut(mapStore(), 58, 72, 254, 110); -} - void DreamGenContext::triggerMessage(uint16 index) { multiGet(mapStore(), 174, 153, 200, 63); uint16 offset = kTextstart + getSegment(data.word(kPuzzletext)).word(index * 2); @@ -1990,12 +1982,6 @@ void DreamBase::sortOutMap() { } } -void DreamGenContext::showCity() { - clearWork(); - showFrame(tempGraphics(), 57, 32, 0, 0); - showFrame(tempGraphics(), 120+57, 32, 1, 0); -} - void DreamGenContext::mainScreen() { data.byte(kInmaparea) = 0; if (data.byte(kWatchon) == 1) { @@ -2461,14 +2447,6 @@ void DreamBase::examIcon() { showFrame(engine->icons2(), 254, 5, 3, 0); } -uint8 DreamBase::getLocation(uint8 index) { - return data.byte(kRoomscango + index); -} - -void DreamBase::setLocation(uint8 index) { - data.byte(kRoomscango + index) = 1; -} - const uint8 *DreamBase::getTextInFile1(uint16 index) { SegmentRef text = getSegment(data.word(kTextfile1)); uint16 offset = text.word(index * 2) + kTextstart; @@ -2711,16 +2689,6 @@ void DreamGenContext::atmospheres() { cancelCh0(); } -void DreamGenContext::readCityPic() { - loadIntoTemp("DREAMWEB.G04"); -} - -void DreamGenContext::readDestIcon() { - loadIntoTemp("DREAMWEB.G05"); - loadIntoTemp2("DREAMWEB.G06"); - loadIntoTemp3("DREAMWEB.G08"); -} - uint8 DreamGenContext::nextSymbol(uint8 symbol) { uint8 result = symbol + 1; if (result == 6) @@ -3370,81 +3338,6 @@ void DreamGenContext::reExFromOpen() { } -void DreamGenContext::nextDest() { - if (data.byte(kCommandtype) != 218) { - data.byte(kCommandtype) = 218; - commandOnly(28); - } - - if (!(data.word(kMousebutton) & 1) || data.word(kOldbutton) == 1) - return; // nodu - - do { - data.byte(kDestpos)++; - if (data.byte(kDestpos) == 15) - data.byte(kDestpos) = 0; // last destination - - getDestInfo(); - } while (al == 0); - - data.byte(kNewtextline) = 1; - delTextLine(); - delPointer(); - showPanel(); - showMan(); - showArrows(); - locationPic(); - underTextLine(); - readMouse(); - showPointer(); - workToScreenCPP(); - delPointer(); -} - -void DreamGenContext::lastDest() { - if (data.byte(kCommandtype) != 219) { - data.byte(kCommandtype) = 219; - commandOnly(29); - } - - if (!(data.word(kMousebutton) & 1) || data.word(kOldbutton) == 1) - return; // nodd - - do { - data.byte(kDestpos)--; - if (data.byte(kDestpos) == 0xFF) - data.byte(kDestpos) = 15; // first destination - - getDestInfo(); - } while (al == 0); - - data.byte(kNewtextline) = 1; - delTextLine(); - delPointer(); - showPanel(); - showMan(); - showArrows(); - locationPic(); - underTextLine(); - readMouse(); - showPointer(); - workToScreenCPP(); - delPointer(); -} - -void DreamGenContext::destSelect() { - if (data.byte(kCommandtype) != 222) { - data.byte(kCommandtype) = 222; - commandOnly(30); - } - - if (!(data.word(kMousebutton) & 1) || data.word(kOldbutton) == 1) - return; // notrav - - getDestInfo(); - data.byte(kNewlocation) = data.byte(kDestpos); -} - void DreamGenContext::putBackObStuff() { createPanel(); showPanel(); @@ -3522,68 +3415,6 @@ void DreamBase::dumpZoom() { multiDump(kZoomx + 5, kZoomy + 4, 46, 40); } -void DreamGenContext::selectLocation() { - data.byte(kInmaparea) = 0; - clearBeforeLoad(); - data.byte(kGetback) = 0; - data.byte(kPointerframe) = 22; - readCityPic(); - showCity(); - getRidOfTemp(); - readDestIcon(); - loadTravelText(); - showPanel(); - showMan(); - showArrows(); - showExit(); - locationPic(); - underTextLine(); - data.byte(kCommandtype) = 255; - readMouse(); - data.byte(kPointerframe) = 0; - showPointer(); - workToScreenCPP(); - playChannel0(9, 255); - data.byte(kNewlocation) = 255; - - while (data.byte(kNewlocation) == 255) { - if (quitRequested()) - break; - - delPointer(); - readMouse(); - showPointer(); - vSync(); - dumpPointer(); - dumpTextLine(); - - if (data.byte(kGetback) == 1) - break; - - RectWithCallback destList[] = { - { 238,258,4,44,&DreamGenContext::nextDest }, - { 104,124,4,44,&DreamGenContext::lastDest }, - { 280,308,4,44,&DreamGenContext::lookAtPlace }, - { 104,216,138,192,&DreamGenContext::destSelect }, - { 273,320,157,198,&DreamBase::getBack1 }, - { 0,320,0,200,&DreamBase::blank }, - { 0xFFFF,0,0,0,0 } - }; - checkCoords(destList); - } - - if (quitRequested() || data.byte(kGetback) == 1 || data.byte(kNewlocation) == data.byte(kLocation)) { - data.byte(kNewlocation) = data.byte(kReallocation); - data.byte(kGetback) = 0; - } - - getRidOfTemp(); - getRidOfTemp2(); - getRidOfTemp3(); - deallocateMem(data.word(kTraveltext)); -} - - void DreamBase::examineInventory() { if (data.byte(kCommandtype) != 249) { data.byte(kCommandtype) = 249; @@ -3604,12 +3435,6 @@ void DreamBase::examineInventory() { workToScreenM(); } -void DreamBase::showArrows() { - showFrame(tempGraphics(), 116 - 12, 16, 0, 0); - showFrame(tempGraphics(), 226 + 12, 16, 1, 0); - showFrame(tempGraphics(), 280, 14, 2, 0); -} - void DreamBase::middlePanel() { Frame *tempSprites = (Frame *)getSegment(data.word(kTempsprites)).ptr(0, 0); showFrame(tempSprites, 72 + 47 + 20, 0, 48, 0); @@ -4020,16 +3845,6 @@ void DreamBase::getBack1() { } } -void DreamGenContext::newPlace() { - if (data.byte(kNeedtotravel) == 1) { - data.byte(kNeedtotravel) = 0; - selectLocation(); - } else if (data.byte(kAutolocation) != 0xFF) { - data.byte(kNewlocation) = data.byte(kAutolocation); - data.byte(kAutolocation) = 0xFF; - } -} - void DreamGenContext::monkSpeaking() { // FIXME: This is the CD version only. @@ -4473,38 +4288,6 @@ void DreamGenContext::showDiaryKeys() { showDiaryPage(); } -void DreamGenContext::lookAtPlace() { - if (data.byte(kCommandtype) != 224) { - data.byte(kCommandtype) = 224; - commandOnly(27); - } - - if (!(data.word(kMousebutton) & 1) || - data.word(kMousebutton) == data.word(kOldbutton) || - data.byte(kDestpos) >= 15) - return; // noinfo - - delPointer(); - delTextLine(); - getUnderCentre(); - showFrame(tempGraphics3(), 60, 72, 0, 0); - showFrame(tempGraphics3(), 60, 72 + 55, 4, 0); - if (data.byte(kForeignrelease)) - showFrame(tempGraphics3(), 60, 72+55+21, 4, 0); - - uint16 offset = kTextstart + getSegment(data.word(kTraveltext)).word(data.byte(kDestpos) * 2); - const uint8 *string = getSegment(data.word(kTraveltext)).ptr(offset, 0); - findNextColon(&string); - uint16 y = (data.byte(kForeignrelease)) ? 84 + 4 : 84; - printDirect(&string, 63, &y, 191, 191 & 1); - workToScreenM(); - hangOnP(500); - data.byte(kPointermode) = 0; - data.byte(kPointerframe) = 0; - putUnderCentre(); - workToScreenM(); -} - void DreamGenContext::edensFlatReminders() { if (data.byte(kReallocation) != 24 || data.byte(kMapx) != 44) return; // not in Eden's lift -- cgit v1.2.3 From b6e139d112b08d9280c145ae40f6324be6707efe Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 20 Dec 2011 11:23:51 +0100 Subject: DREAMWEB: Convert resetLocation and purgeALocation to C++ --- engines/dreamweb/dreambase.h | 2 ++ engines/dreamweb/dreamgen.cpp | 82 ------------------------------------------- engines/dreamweb/dreamgen.h | 2 -- engines/dreamweb/object.cpp | 35 ++++++++++++++++++ engines/dreamweb/stubs.cpp | 9 ++--- engines/dreamweb/use.cpp | 3 +- 6 files changed, 41 insertions(+), 92 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 01772bb2ff..5acdca0ac9 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -143,6 +143,7 @@ public: void showArrows(); uint8 getLocation(uint8 index); void setLocation(uint8 index); + void resetLocation(uint8 index); // from object.cpp void obIcons(); @@ -154,6 +155,7 @@ public: void deleteExObject(uint8 index); void deleteExFrame(uint8 frameNum); void deleteExText(uint8 textNum); + void purgeALocation(uint8 index); // from pathfind.cpp void turnPathOn(uint8 param); diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index c2d8530b25..e23a0a7983 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -1130,37 +1130,6 @@ void DreamGenContext::transferConToEx() { ds.byte(si+2) = 255; } -void DreamGenContext::purgeALocation() { - STACK_CHECK; - push(ax); - es = data.word(kExtras); - di = (0+2080+30000); - bx = pop(); - cx = 0; -purgeloc: - _cmp(bl, es.byte(di+0)); - if (!flags.z()) - goto dontpurge; - _cmp(es.byte(di+2), 0); - if (!flags.z()) - goto dontpurge; - push(di); - push(es); - push(bx); - push(cx); - deleteExObject(); - cx = pop(); - bx = pop(); - es = pop(); - di = pop(); -dontpurge: - _add(di, 16); - _inc(cx); - _cmp(cx, (114)); - if (!flags.z()) - goto purgeloc; -} - void DreamGenContext::emergencyPurge() { STACK_CHECK; checkpurgeagain: @@ -1491,57 +1460,6 @@ void DreamGenContext::getDestInfo() { ax = pop(); } -void DreamGenContext::resetLocation() { - STACK_CHECK; - push(ax); - _cmp(al, 5); - if (!flags.z()) - goto notdelhotel; - purgeALocation(); - al = 21; - purgeALocation(); - al = 22; - purgeALocation(); - al = 27; - purgeALocation(); - goto clearedlocations; -notdelhotel: - _cmp(al, 8); - if (!flags.z()) - goto notdeltvstud; - purgeALocation(); - al = 28; - purgeALocation(); - goto clearedlocations; -notdeltvstud: - _cmp(al, 6); - if (!flags.z()) - goto notdelsarters; - purgeALocation(); - al = 20; - purgeALocation(); - al = 25; - purgeALocation(); - goto clearedlocations; -notdelsarters: - _cmp(al, 13); - if (!flags.z()) - goto notdelboathouse; - purgeALocation(); - al = 29; - purgeALocation(); - goto clearedlocations; -notdelboathouse: -clearedlocations: - ax = pop(); - ah = 0; - bx = ax; - dx = data; - es = dx; - _add(bx, 555); - es.byte(bx) = 0; -} - void DreamGenContext::dirCom() { STACK_CHECK; cx = 30; diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 92b75a287a..de710a20d1 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -469,7 +469,6 @@ public: void getObTextStart(); void checkObjectSize(); void doSomeTalk(); - void resetLocation(); void outOfOpen(); void dirCom(); void findFirstPath(); @@ -481,7 +480,6 @@ public: void reExFromInv(); void transferMap(); void purgeAnItem(); - void purgeALocation(); void getSetAd(); void findOpenPos(); void searchForSame(); diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index 8553f41ee8..6aa1364002 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -631,4 +631,39 @@ void DreamGenContext::outOfInv() { delPointer(); } +void DreamBase::resetLocation(uint8 index) { + if (index == 5) { + // delete hotel + purgeALocation(5); + purgeALocation(21); + purgeALocation(22); + purgeALocation(27); + } else if (index == 8) { + // delete TV studio + purgeALocation(8); + purgeALocation(28); + } else if (index == 6) { + // delete sarters + purgeALocation(6); + purgeALocation(20); + purgeALocation(25); + } else if (index == 13) { + // delete boathouse + purgeALocation(13); + purgeALocation(29); + } + + data.byte(kRoomscango + index) = 0; +} + +void DreamBase::purgeALocation(uint8 index) { + // index == al + for (uint8 i = 0; i < kNumexobjects; ++i) { + DynObject *t = getExAd(i); + if (t->currentLocation == index && t->mapad[0] == 0) { + deleteExObject(i); + } + } +} + } // End of namespace DreamGen diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 137fad4526..894c247e5b 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -3901,8 +3901,7 @@ void DreamGenContext::useButtonA() { void DreamGenContext::autoAppear() { if (data.byte(kLocation) == 32) { // In alley - al = 5; - resetLocation(); + resetLocation(5); setLocation(10); data.byte(kDestpos) = 10; return; @@ -3932,8 +3931,7 @@ void DreamGenContext::autoAppear() { if (data.byte(kReallocation) == 25) { // Sart roof data.byte(kNewsitem) = 3; - al = 6; - resetLocation(); + resetLocation(6); setLocation(11); data.byte(kDestpos) = 11; } else { @@ -4013,8 +4011,7 @@ void DreamGenContext::entryAnims() { data.byte(kSpeedcount) = 1; break; case 44: // Sparky's - al = 8; - resetLocation(); + resetLocation(8); data.word(kWatchingtime) = 50*2; data.word(kReeltowatch) = 247; data.word(kEndwatchreel) = 297; diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp index f6406dc773..d3dda0e0a0 100644 --- a/engines/dreamweb/use.cpp +++ b/engines/dreamweb/use.cpp @@ -823,8 +823,7 @@ void DreamGenContext::useGun() { } else if (data.byte(kReallocation) == 29) { // aide data.byte(kGetback) = 1; - al = 13; - resetLocation(); + resetLocation(13); setLocation(12); data.byte(kDestpos) = 12; data.byte(kDestination) = 2; -- cgit v1.2.3 From b2fcdd6c86fb341695d32afded114fecbe5d7590 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 20 Dec 2011 11:33:09 +0100 Subject: DREAMWEB: Move rest of saveload.cpp to DreamBase --- engines/dreamweb/dreambase.h | 15 ++++++++++++++- engines/dreamweb/newplace.cpp | 25 ++++++++++++++++++++++++- engines/dreamweb/object.cpp | 25 ------------------------- engines/dreamweb/saveload.cpp | 23 ++++++++++++----------- engines/dreamweb/stubs.cpp | 20 ++++++++------------ engines/dreamweb/stubs.h | 13 ------------- 6 files changed, 58 insertions(+), 63 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 5acdca0ac9..561237ac6e 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -243,14 +243,22 @@ public: void delCurs(); // from saveload.cpp - void oldToNames(); + void loadGame(); + void doLoad(int slot); + void saveGame(); void namesToOld(); + void oldToNames(); + void saveLoad(); + void doSaveLoad(); void showMainOps(); void showDiscOps(); + void discOps(); void actualSave(); void actualLoad(); void loadPosition(unsigned int slot); void savePosition(unsigned int slot, const char *descbuf); + uint scanForNames(); + void loadOld(); void showDecisions(); void loadSaveBox(); void showNames(); @@ -469,6 +477,11 @@ public: template void checkCoords(const RectWithCallback *rectWithCallbacks); void newGame(); void deleteTaken(); + void autoAppear(); + void loadRoom(); + void startLoading(const Room &room); + void startup(); + void atmospheres(); // from use.cpp void placeFreeObject(uint8 index); diff --git a/engines/dreamweb/newplace.cpp b/engines/dreamweb/newplace.cpp index ba1276b9c6..f1743f0e6d 100644 --- a/engines/dreamweb/newplace.cpp +++ b/engines/dreamweb/newplace.cpp @@ -234,7 +234,30 @@ void DreamBase::setLocation(uint8 index) { data.byte(kRoomscango + index) = 1; } -// TODO: Place resetLocation here +void DreamBase::resetLocation(uint8 index) { + if (index == 5) { + // delete hotel + purgeALocation(5); + purgeALocation(21); + purgeALocation(22); + purgeALocation(27); + } else if (index == 8) { + // delete TV studio + purgeALocation(8); + purgeALocation(28); + } else if (index == 6) { + // delete sarters + purgeALocation(6); + purgeALocation(20); + purgeALocation(25); + } else if (index == 13) { + // delete boathouse + purgeALocation(13); + purgeALocation(29); + } + + data.byte(kRoomscango + index) = 0; +} void DreamGenContext::readDestIcon() { loadIntoTemp("DREAMWEB.G05"); diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index 6aa1364002..207f4889db 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -631,31 +631,6 @@ void DreamGenContext::outOfInv() { delPointer(); } -void DreamBase::resetLocation(uint8 index) { - if (index == 5) { - // delete hotel - purgeALocation(5); - purgeALocation(21); - purgeALocation(22); - purgeALocation(27); - } else if (index == 8) { - // delete TV studio - purgeALocation(8); - purgeALocation(28); - } else if (index == 6) { - // delete sarters - purgeALocation(6); - purgeALocation(20); - purgeALocation(25); - } else if (index == 13) { - // delete boathouse - purgeALocation(13); - purgeALocation(29); - } - - data.byte(kRoomscango + index) = 0; -} - void DreamBase::purgeALocation(uint8 index) { // index == al for (uint8 i = 0; i < kNumexobjects; ++i) { diff --git a/engines/dreamweb/saveload.cpp b/engines/dreamweb/saveload.cpp index a0309e1ee0..b12c668d82 100644 --- a/engines/dreamweb/saveload.cpp +++ b/engines/dreamweb/saveload.cpp @@ -44,7 +44,7 @@ void syncReelRoutine(Common::Serializer &s, ReelRoutine *reel) { s.syncAsByte(reel->b7); } -void DreamGenContext::loadGame() { +void DreamBase::loadGame() { if (data.byte(kCommandtype) != 246) { data.byte(kCommandtype) = 246; commandOnly(41); @@ -57,7 +57,7 @@ void DreamGenContext::loadGame() { // if -1, open menu to ask for slot to load // if >= 0, directly load from that slot -void DreamGenContext::doLoad(int savegameId) { +void DreamBase::doLoad(int savegameId) { data.byte(kLoadingorsave) = 1; if (ConfMan.getBool("dreamweb_originalsaveload") && savegameId == -1) { @@ -138,7 +138,7 @@ void DreamGenContext::doLoad(int savegameId) { } -void DreamGenContext::saveGame() { +void DreamBase::saveGame() { if (data.byte(kMandead) == 2) { blank(); return; @@ -239,7 +239,7 @@ void DreamBase::oldToNames() { memcpy(_saveNames, _saveNamesOld, 17*7); } -void DreamGenContext::saveLoad() { +void DreamBase::saveLoad() { if (data.word(kWatchingtime) || (data.byte(kPointermode) == 2)) { blank(); return; @@ -252,7 +252,7 @@ void DreamGenContext::saveLoad() { doSaveLoad(); } -void DreamGenContext::doSaveLoad() { +void DreamBase::doSaveLoad() { data.byte(kPointerframe) = 0; data.word(kTextaddressx) = 70; data.word(kTextaddressy) = 182-8; @@ -350,7 +350,7 @@ void DreamBase::showDiscOps() { showFrame(tempGraphics(), kOpsx+176+2, kOpsy+60-4, 5, 0); } -void DreamGenContext::discOps() { +void DreamBase::discOps() { if (data.byte(kCommandtype) != 249) { data.byte(kCommandtype) = 249; commandOnly(43); @@ -368,8 +368,8 @@ void DreamGenContext::discOps() { data.byte(kGetback) = 0; RectWithCallback discOpsList[] = { - { kOpsx+59,kOpsx+114,kOpsy+30,kOpsy+76,&DreamGenContext::loadGame }, - { kOpsx+10,kOpsx+79,kOpsy+10,kOpsy+59,&DreamGenContext::saveGame }, + { kOpsx+59,kOpsx+114,kOpsy+30,kOpsy+76,&DreamBase::loadGame }, + { kOpsx+10,kOpsx+79,kOpsy+10,kOpsy+59,&DreamBase::saveGame }, { kOpsx+176,kOpsx+192,kOpsy+60,kOpsy+76,&DreamBase::getBackToOps }, { 0,320,0,200,&DreamBase::blank }, { 0xFFFF,0,0,0,0 } @@ -589,7 +589,7 @@ void DreamBase::loadPosition(unsigned int slot) { } // Count number of save files, and load their descriptions into _saveNames -unsigned int DreamGenContext::scanForNames() { +uint DreamBase::scanForNames() { // Initialize the first 7 slots (like the original code expects) for (unsigned int slot = 0; slot < 7; ++slot) { _saveNames[17 * slot + 0] = 2; @@ -620,12 +620,13 @@ unsigned int DreamGenContext::scanForNames() { Common::strlcpy(&_saveNames[17 * slotNum + 1], name, 16); // the first character is unused } - al = saveList.size() <= 7 ? (uint8)saveList.size() : 7; + // FIXME: Can the following be safely removed? +// al = saveList.size() <= 7 ? (uint8)saveList.size() : 7; return saveList.size(); } -void DreamGenContext::loadOld() { +void DreamBase::loadOld() { if (data.byte(kCommandtype) != 252) { data.byte(kCommandtype) = 252; commandOnly(48); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 894c247e5b..6d8519b577 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -495,7 +495,7 @@ void DreamGenContext::dreamweb() { while (true) { - unsigned int count = scanForNames(); + uint count = scanForNames(); bool startNewGame = true; @@ -707,7 +707,7 @@ void DreamGenContext::screenUpdate() { delPointer(); } -void DreamGenContext::startup() { +void DreamBase::startup() { data.byte(kCurrentkey) = 0; data.byte(kMainmode) = 0; createPanel(); @@ -1044,7 +1044,7 @@ void DreamBase::clearAndLoad(uint16 seg, uint8 c, clearAndLoad(buf, c, size, maxSize); } -void DreamGenContext::startLoading(const Room &room) { +void DreamBase::startLoading(const Room &room) { data.byte(kCombatcount) = 0; data.byte(kRoomssample) = room.roomsSample; data.byte(kMapx) = room.mapX; @@ -2092,7 +2092,7 @@ void DreamBase::zoomIcon() { showFrame(engine->icons1(), kZoomx, kZoomy-1, 8, 0); } -void DreamGenContext::loadRoom() { +void DreamBase::loadRoom() { data.byte(kRoomloaded) = 1; data.word(kTimecount) = 0; data.word(kMaintimer) = 0; @@ -2111,10 +2111,6 @@ void DreamGenContext::loadRoom() { uint8 mapXstart, mapYstart; uint8 mapXsize, mapYsize; getDimension(&mapXstart, &mapYstart, &mapXsize, &mapYsize); - cl = mapXstart; - ch = mapYstart; - dl = mapXsize; - dh = mapYsize; } void DreamGenContext::readSetData() { @@ -2627,7 +2623,7 @@ void DreamGenContext::useMenu() { workToScreenM(); } -void DreamGenContext::atmospheres() { +void DreamBase::atmospheres() { const Atmosphere *a = &g_atmosphereList[0]; @@ -2651,8 +2647,8 @@ void DreamGenContext::atmospheres() { // I'm interpreting this as if the cmp reallocation is below the jz if (data.byte(kMapy) == 0) { - data.byte(kVolume) = 0; // "fullvol" - return; + data.byte(kVolume) = 0; // "fullvol" + return; } if (data.byte(kReallocation) == 2 && data.byte(kMapx) == 22 && data.byte(kMapy) == 10) @@ -3898,7 +3894,7 @@ void DreamGenContext::useButtonA() { } } -void DreamGenContext::autoAppear() { +void DreamBase::autoAppear() { if (data.byte(kLocation) == 32) { // In alley resetLocation(5); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 61697e828e..c94cb02a3c 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -23,9 +23,7 @@ #define DREAMWEB_STUBS_H void screenUpdate(); - void startup(); void startup1(); - void saveLoad(); void workToScreen(); void multiGet(); void multiGet(uint8 *dst, uint16 x, uint16 y, uint8 width, uint8 height) { @@ -52,7 +50,6 @@ uint8 printDirect(const uint8* string, uint16 x, uint16 y, uint8 maxWidth, bool centered) { return DreamBase::printDirect(string, x, y, maxWidth, centered); } - void startLoading(const Room &room); void showFrame(); void showFrame(const Frame *frameData, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag, uint8 *width, uint8 *height) { DreamBase::showFrame(frameData, x, y, frameNumber, effectsFlag, width, height); @@ -131,7 +128,6 @@ void dumpWatch(); void transferText(); void watchCount(); - void loadRoom(); void readSetData(); void useMenu(); void useMon(); @@ -219,15 +215,9 @@ uint8 nextSymbol(uint8 symbol); void showSymbol(); void enterCode(uint8 digit0, uint8 digit1, uint8 digit2, uint8 digit3); - unsigned int scanForNames(); - void doLoad(int slot); - void loadOld(); void inventory(); void mainScreen(); - void loadGame(); - void saveGame(); void zoomOnOff(); - void atmospheres(); void hangOne(uint16 delay); void hangOne(); void bibleQuote(); @@ -287,8 +277,6 @@ void madmanRun(); void decide(); void talk(); - void discOps(); - void doSaveLoad(); void useDiary(); void hangOnPQ(); void showGun(); @@ -299,7 +287,6 @@ void monkSpeaking(); void rollEndCredits2(); void useButtonA(); - void autoAppear(); void setupTimedUse(); void entryAnims(); void triggerMessage(uint16 index); -- cgit v1.2.3 From c9e9e5d6d8da4bdd180b4934b1dd5c3ef7d77dbe Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 21 Dec 2011 17:46:11 +0100 Subject: DREAMWEB: Add titles.cpp, move some methods to titles.cpp and talk.cpp --- engines/dreamweb/module.mk | 1 + engines/dreamweb/stubs.cpp | 561 +----------------------------------------- engines/dreamweb/talk.cpp | 153 +++++++++++- engines/dreamweb/titles.cpp | 426 ++++++++++++++++++++++++++++++++ engines/dreamweb/vgafades.cpp | 1 + 5 files changed, 589 insertions(+), 553 deletions(-) create mode 100644 engines/dreamweb/titles.cpp (limited to 'engines') diff --git a/engines/dreamweb/module.mk b/engines/dreamweb/module.mk index 9b6d9f30df..88dfdeea53 100644 --- a/engines/dreamweb/module.mk +++ b/engines/dreamweb/module.mk @@ -18,6 +18,7 @@ MODULE_OBJS := \ sprite.o \ stubs.o \ talk.o \ + titles.o \ use.o \ vgafades.o \ vgagrafx.o diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 6d8519b577..4ee19fde4d 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -21,7 +21,6 @@ */ #include "dreamweb/dreamweb.h" -#include "engines/util.h" #include "common/config-manager.h" namespace DreamGen { @@ -329,23 +328,23 @@ static const Atmosphere g_atmosphereList[] = { { 10,33,30,6,255 }, { 10,22,30,6,255 }, - + { 9,22,10,6,255 }, { 9,22,20,16,255 }, { 9,22,30,16,255 }, { 9,22,40,16,255 }, { 9,22,50,16,255 }, - + { 6,11,30,6,255 }, { 6,0,10,15,255 }, { 6,0,20,15,255 }, { 6,11,20,15,255 }, { 6,22,20,15,255 }, - + { 7,11,20,6,255 }, { 7,0,20,6,255 }, { 7,0,30,6,255 }, - + { 55,44,0,5,255 }, { 55,44,10,5,255 }, @@ -367,12 +366,12 @@ static const Atmosphere g_atmosphereList[] = { { 8,33,40,6,255 }, { 8,22,40,6,255 }, { 8,11,40,6,255 }, - + { 11,11,20,12,255 }, { 11,11,30,12,255 }, { 11,22,20,12,255 }, { 11,22,30,12,255 }, - + { 12,22,20,12,255 }, { 13,22,20,12,255 }, { 13,33,20,12,255 }, @@ -384,7 +383,7 @@ static const Atmosphere g_atmosphereList[] = { { 14,33,30,12,255 }, { 14,33,40,12,255 }, { 14,22,0,16,255 }, - + { 19,0,0,12,255 }, { 20,0,20,16,255 }, @@ -544,6 +543,7 @@ void DreamGenContext::dreamweb() { // "playGame" // "titles" + // TODO: In the demo version, titles() did nothing clearPalette(); bibleQuote(); if (!quitRequested()) // "titlesearly" @@ -981,9 +981,6 @@ void DreamBase::DOSReturn() { } } -void DreamGenContext::set16ColPalette() { -} - void DreamBase::eraseOldObs() { if (data.byte(kNewobs) == 0) return; @@ -1243,7 +1240,7 @@ const uint8 *DreamBase::findObName(uint8 type, uint8 index) { void DreamBase::copyName(uint8 type, uint8 index, uint8 *dst) { const uint8 *src = findObName(type, index); size_t i; - for (i = 0; i < 28; ++i) { + for (i = 0; i < 28; ++i) { char c = src[i]; if (c == ':') break; @@ -1255,7 +1252,7 @@ void DreamBase::copyName(uint8 type, uint8 index, uint8 *dst) { } void DreamGenContext::commandWithOb() { - commandWithOb(al, bh, bl); + commandWithOb(al, bh, bl); } void DreamBase::commandWithOb(uint8 command, uint8 type, uint8 index) { @@ -2724,308 +2721,6 @@ void DreamBase::readKey() { data.word(kBufferout) = bufOut; } -void DreamGenContext::hangOne(uint16 delay) { - do { - vSync(); - if (data.byte(kLasthardkey) == 1) - return; // "hangonearly" - } while (--delay); -} - -void DreamGenContext::hangOne() { - hangOne(cx); -} - -void DreamGenContext::bibleQuote() { - initGraphics(640, 480, true); - - showPCX("DREAMWEB.I00"); - fadeScreenUps(); - - hangOne(80); - if (data.byte(kLasthardkey) == 1) { - data.byte(kLasthardkey) = 0; - return; // "biblequotearly" - } - - hangOne(560); - if (data.byte(kLasthardkey) == 1) { - data.byte(kLasthardkey) = 0; - return; // "biblequotearly" - } - - fadeScreenDowns(); - - hangOne(200); - if (data.byte(kLasthardkey) == 1) { - data.byte(kLasthardkey) = 0; - return; // "biblequotearly" - } - - cancelCh0(); - - data.byte(kLasthardkey) = 0; -} - -void DreamGenContext::realCredits() { - data.byte(kRoomssample) = 33; - loadRoomsSample(); - data.byte(kVolume) = 0; - - initGraphics(640, 480, true); - hangOn(35); - - showPCX("DREAMWEB.I01"); - playChannel0(12, 0); - - hangOne(2); - - if (data.byte(kLasthardkey) == 1) { - data.byte(kLasthardkey) = 0; - return; // "realcreditsearly" - } - - allPalette(); - hangOne(80); - - if (data.byte(kLasthardkey) == 1) { - data.byte(kLasthardkey) = 0; - return; // "realcreditsearly" - } - - fadeScreenDowns(); - hangOne(256); - - if (data.byte(kLasthardkey) == 1) { - data.byte(kLasthardkey) = 0; - return; // "realcreditsearly" - } - - showPCX("DREAMWEB.I02"); - playChannel0(12, 0); - hangOne(2); - - if (data.byte(kLasthardkey) == 1) { - data.byte(kLasthardkey) = 0; - return; // "realcreditsearly" - } - - allPalette(); - hangOne(80); - - if (data.byte(kLasthardkey) == 1) { - data.byte(kLasthardkey) = 0; - return; // "realcreditsearly" - } - - fadeScreenDowns(); - hangOne(256); - - if (data.byte(kLasthardkey) == 1) { - data.byte(kLasthardkey) = 0; - return; // "realcreditsearly" - } - - showPCX("DREAMWEB.I03"); - playChannel0(12, 0); - hangOne(2); - - if (data.byte(kLasthardkey) == 1) { - data.byte(kLasthardkey) = 0; - return; // "realcreditsearly" - } - - allPalette(); - hangOne(80); - - if (data.byte(kLasthardkey) == 1) { - data.byte(kLasthardkey) = 0; - return; // "realcreditsearly" - } - - fadeScreenDowns(); - hangOne(256); - - if (data.byte(kLasthardkey) == 1) { - data.byte(kLasthardkey) = 0; - return; // "realcreditsearly" - } - - showPCX("DREAMWEB.I04"); - playChannel0(12, 0); - hangOne(2); - - if (data.byte(kLasthardkey) == 1) { - data.byte(kLasthardkey) = 0; - return; // "realcreditsearly" - } - - allPalette(); - hangOne(80); - - if (data.byte(kLasthardkey) == 1) { - data.byte(kLasthardkey) = 0; - return; // "realcreditsearly" - } - - fadeScreenDowns(); - hangOne(256); - - if (data.byte(kLasthardkey) == 1) { - data.byte(kLasthardkey) = 0; - return; // "realcreditsearly" - } - - showPCX("DREAMWEB.I05"); - playChannel0(12, 0); - hangOne(2); - - if (data.byte(kLasthardkey) == 1) { - data.byte(kLasthardkey) = 0; - return; // "realcreditsearly" - } - - allPalette(); - hangOne(80); - - if (data.byte(kLasthardkey) == 1) { - data.byte(kLasthardkey) = 0; - return; // "realcreditsearly" - } - - fadeScreenDowns(); - hangOne(256); - - if (data.byte(kLasthardkey) == 1) { - data.byte(kLasthardkey) = 0; - return; // "realcreditsearly" - } - - showPCX("DREAMWEB.I06"); - fadeScreenUps(); - hangOne(60); - - if (data.byte(kLasthardkey) == 1) { - data.byte(kLasthardkey) = 0; - return; // "realcreditsearly" - } - - playChannel0(13, 0); - hangOne(350); - - if (data.byte(kLasthardkey) == 1) { - data.byte(kLasthardkey) = 0; - return; // "realcreditsearly" - } - - fadeScreenDowns(); - hangOne(256); - - data.byte(kLasthardkey) = 0; -} - -void DreamGenContext::runIntroSeq() { - data.byte(kGetback) = 0; - - do { - vSync(); - - if (data.byte(kLasthardkey) == 1) - break; - - spriteUpdate(); - vSync(); - - if (data.byte(kLasthardkey) == 1) - break; - - delEverything(); - printSprites(); - reelsOnScreen(); - afterIntroRoom(); - useTimedText(); - vSync(); - - if (data.byte(kLasthardkey) == 1) - break; - - dumpMap(); - dumpTimedText(); - vSync(); - - if (data.byte(kLasthardkey) == 1) - break; - - } while (data.byte(kGetback) != 1); - - - if (data.byte(kLasthardkey) == 1) { - getRidOfTempText(); - clearBeforeLoad(); - } - - // These were not called in this program arc - // in the original code.. Bug? - //getRidOfTempText(); - //clearBeforeLoad(); -} - -void DreamGenContext::intro() { - loadTempText("DREAMWEB.T82"); - loadPalFromIFF(); - setMode(); - data.byte(kNewlocation) = 50; - clearPalette(); - loadIntroRoom(); - data.byte(kVolume) = 7; - data.byte(kVolumedirection) = (byte)-1; - data.byte(kVolumeto) = 4; - playChannel0(12, 255); - fadeScreenUps(); - runIntroSeq(); - - if (data.byte(kLasthardkey) == 1) { - data.byte(kLasthardkey) = 0; - return; // "introearly" - } - - clearBeforeLoad(); - data.byte(kNewlocation) = 52; - loadIntroRoom(); - runIntroSeq(); - - if (data.byte(kLasthardkey) == 1) { - data.byte(kLasthardkey) = 0; - return; // "introearly" - } - - clearBeforeLoad(); - data.byte(kNewlocation) = 53; - loadIntroRoom(); - runIntroSeq(); - - if (data.byte(kLasthardkey) == 1) { - data.byte(kLasthardkey) = 0; - return; // "introearly" - } - - clearBeforeLoad(); - allPalette(); - data.byte(kNewlocation) = 54; - loadIntroRoom(); - runIntroSeq(); - - if (data.byte(kLasthardkey) == 1) { - data.byte(kLasthardkey) = 0; - return; // "introearly" - } - - getRidOfTempText(); - clearBeforeLoad(); - - data.byte(kLasthardkey) = 0; -} - void DreamBase::setTopLeft() { if (data.byte(kSymboltopdir) != 0) { blank(); @@ -3133,25 +2828,6 @@ void DreamGenContext::walkIntoRoom() { } } -void DreamGenContext::loadIntroRoom() { - data.byte(kIntrocount) = 0; - data.byte(kLocation) = 255; - loadRoom(); - data.word(kMapoffsetx) = 72; - data.word(kMapoffsety) = 16; - clearSprites(); - data.byte(kThroughdoor) = 0; - data.byte(kCurrentkey) = '0'; - data.byte(kMainmode) = 0; - clearWork(); - data.byte(kNewobs) = 1; - drawFloor(); - reelsOnScreen(); - spriteUpdate(); - printSprites(); - workToScreenCPP(); -} - void DreamGenContext::afterIntroRoom() { if (data.byte(kNowinnewroom) == 0) return; // notnewintro @@ -3167,17 +2843,6 @@ void DreamGenContext::afterIntroRoom() { data.byte(kNowinnewroom) = 0; } -void DreamGenContext::gettingShot() { - data.byte(kNewlocation) = 55; - clearPalette(); - loadIntroRoom(); - fadeScreenUps(); - data.byte(kVolumeto) = 0; - data.byte(kVolumedirection) = (byte)-1; - runEndSeq(); - clearBeforeLoad(); -} - void DreamBase::redrawMainScrn() { data.word(kTimecount) = 0; createPanel(); @@ -3350,58 +3015,6 @@ void DreamGenContext::putBackObStuff() { delPointer(); } -void DreamGenContext::redes() { - if (data.byte(kCh1playing) != 255 || data.byte(kTalkmode) != 2) { - blank(); - return; - } - - if (data.byte(kCommandtype) != 217) { - data.byte(kCommandtype) = 217; - commandOnly(50); - } - - if (!(data.word(kMousebutton) & 1)) - return; - - delPointer(); - createPanel(); - showPanel(); - showMan(); - showExit(); - convIcons(); - startTalk(); - readMouse(); - showPointer(); - workToScreenCPP(); - delPointer(); -} - -void DreamGenContext::moreTalk() { - if (data.byte(kTalkmode) != 0) { - redes(); - return; - } - - if (data.byte(kCommandtype) != 215) { - data.byte(kCommandtype) = 215; - commandOnly(49); - } - - if (data.word(kMousebutton) == data.word(kOldbutton)) - return; // nomore - - if (!(data.word(kMousebutton) & 1)) - return; - - data.byte(kTalkmode) = 2; - data.byte(kTalkpos) = 4; - - if (data.byte(kCharacter) >= 100) - data.byte(kTalkpos) = 48; // second part - doSomeTalk(); -} - bool DreamBase::isSetObOnMap(uint8 index) { return (getSetAd(index)->mapad[0] == 0); } @@ -3616,107 +3229,6 @@ void DreamGenContext::decide() { data.byte(kTextlen) = 240; } -void DreamGenContext::talk() { - data.byte(kTalkpos) = 0; - data.byte(kInmaparea) = 0; - data.byte(kCharacter) = data.byte(kCommand); - createPanel(); - showPanel(); - showMan(); - showExit(); - underTextLine(); - convIcons(); - startTalk(); - data.byte(kCommandtype) = 255; - readMouse(); - showPointer(); - workToScreenCPP(); - - RectWithCallback talkList[] = { - { 273,320,157,198,&DreamBase::getBack1 }, - { 240,290,2,44,&DreamGenContext::moreTalk }, - { 0,320,0,200,&DreamBase::blank }, - { 0xFFFF,0,0,0,0 } - }; - - do { - delPointer(); - readMouse(); - animPointer(); - showPointer(); - vSync(); - dumpPointer(); - dumpTextLine(); - data.byte(kGetback) = 0; - checkCoords(talkList); - if (data.byte(kQuitrequested)) - break; - } while (!data.byte(kGetback)); - - if (data.byte(kTalkpos) >= 4) - data.byte(data.word(kPersondata)+7) |= 128; - - redrawMainScrn(); - workToScreenM(); - if (data.byte(kSpeechloaded) == 1) { - cancelCh1(); - data.byte(kVolumedirection) = (byte)-1; - data.byte(kVolumeto) = 0; - } -} - -void DreamGenContext::hangOnPQ() { - data.byte(kGetback) = 0; - - RectWithCallback quitList[] = { - { 273,320,157,198,&DreamBase::getBack1 }, - { 0,320,0,200,&DreamBase::blank }, - { 0xFFFF,0,0,0,0 } - }; - - uint16 speechFlag = 0; - - do { - delPointer(); - readMouse(); - animPointer(); - showPointer(); - vSync(); - dumpPointer(); - dumpTextLine(); - checkCoords(quitList); - - if (data.byte(kGetback) == 1 || data.byte(kQuitrequested)) { - // Quit conversation - delPointer(); - data.byte(kPointermode) = 0; - cancelCh1(); - flags._c = true; - return; - } - - if (data.byte(kSpeechloaded) == 1 && data.byte(kCh1playing) == 255) { - speechFlag++; - if (speechFlag == 40) - break; - } - } while (!data.word(kMousebutton) || data.word(kOldbutton)); - - delPointer(); - data.byte(kPointermode) = 0; - flags._c = false; - } - -void DreamGenContext::endGame() { - loadTempText("DREAMWEB.T83"); - monkSpeaking(); - gettingShot(); - getRidOfTempText(); - data.byte(kVolumeto) = 7; - data.byte(kVolumedirection) = 1; - hangOn(200); -} - void DreamGenContext::showGun() { data.byte(kAddtored) = 0; data.byte(kAddtogreen) = 0; @@ -3841,39 +3353,6 @@ void DreamBase::getBack1() { } } -void DreamGenContext::monkSpeaking() { - // FIXME: This is the CD version only. - - data.byte(kRoomssample) = 35; - loadRoomsSample(); - loadIntoTemp("DREAMWEB.G15"); - clearWork(); - showFrame(tempGraphics(), 160, 72, 0, 128); // show monk - workToScreen(); - data.byte(kVolume) = 7; - data.byte(kVolumedirection) = (byte)-1; - data.byte(kVolumeto) = 5; - playChannel0(12, 255); - fadeScreenUps(); - hangOn(300); - - for (int i = 40; i <= 48; i++) { - loadSpeech('T', 83, 'T', i); - - playChannel1(50 + 12); - - do { - engine->waitForVSync(); - } while (data.byte(kCh1playing) != 255); - } - - data.byte(kVolumedirection) = 1; - data.byte(kVolumeto) = 7; - fadeScreenDowns(); - hangOn(300); - getRidOfTemp(); -} - void DreamGenContext::useButtonA() { if (!isSetObOnMap(95)) { showFirstUse(); @@ -4187,26 +3666,6 @@ void DreamGenContext::dumpDiaryKeys() { multiDump(kDiaryx + 151, kDiaryy + 71, 16, 16); } -void DreamGenContext::runEndSeq() { - atmospheres(); - data.byte(kGetback) = 0; - - do { - vSync(); - spriteUpdate(); - vSync(); - delEverything(); - printSprites(); - reelsOnScreen(); - afterIntroRoom(); - useTimedText(); - vSync(); - dumpMap(); - dumpTimedText(); - vSync(); - } while (data.byte(kGetback) != 1); -} - void DreamGenContext::lookAtCard() { data.byte(kManisoffscreen) = 1; getRidOfReels(); diff --git a/engines/dreamweb/talk.cpp b/engines/dreamweb/talk.cpp index 86d1b886ef..fac75be6cf 100644 --- a/engines/dreamweb/talk.cpp +++ b/engines/dreamweb/talk.cpp @@ -24,8 +24,53 @@ namespace DreamGen { -uint16 DreamGenContext::getPersFrame(uint8 index) { - return getSegment(data.word(kPeople)).word(kPersonframes + index * 2); +void DreamGenContext::talk() { + data.byte(kTalkpos) = 0; + data.byte(kInmaparea) = 0; + data.byte(kCharacter) = data.byte(kCommand); + createPanel(); + showPanel(); + showMan(); + showExit(); + underTextLine(); + convIcons(); + startTalk(); + data.byte(kCommandtype) = 255; + readMouse(); + showPointer(); + workToScreenCPP(); + + RectWithCallback talkList[] = { + { 273,320,157,198,&DreamBase::getBack1 }, + { 240,290,2,44,&DreamGenContext::moreTalk }, + { 0,320,0,200,&DreamBase::blank }, + { 0xFFFF,0,0,0,0 } + }; + + do { + delPointer(); + readMouse(); + animPointer(); + showPointer(); + vSync(); + dumpPointer(); + dumpTextLine(); + data.byte(kGetback) = 0; + checkCoords(talkList); + if (data.byte(kQuitrequested)) + break; + } while (!data.byte(kGetback)); + + if (data.byte(kTalkpos) >= 4) + data.byte(data.word(kPersondata)+7) |= 128; + + redrawMainScrn(); + workToScreenM(); + if (data.byte(kSpeechloaded) == 1) { + cancelCh1(); + data.byte(kVolumedirection) = (byte)-1; + data.byte(kVolumeto) = 0; + } } void DreamGenContext::convIcons() { @@ -35,4 +80,108 @@ void DreamGenContext::convIcons() { showFrame(base, 234, 2, frame, 0); } +uint16 DreamGenContext::getPersFrame(uint8 index) { + return getSegment(data.word(kPeople)).word(kPersonframes + index * 2); +} + +// TODO: put Starttalk here + +// TODO: put Getpersontext here + +void DreamGenContext::moreTalk() { + if (data.byte(kTalkmode) != 0) { + redes(); + return; + } + + if (data.byte(kCommandtype) != 215) { + data.byte(kCommandtype) = 215; + commandOnly(49); + } + + if (data.word(kMousebutton) == data.word(kOldbutton)) + return; // nomore + + if (!(data.word(kMousebutton) & 1)) + return; + + data.byte(kTalkmode) = 2; + data.byte(kTalkpos) = 4; + + if (data.byte(kCharacter) >= 100) + data.byte(kTalkpos) = 48; // second part + doSomeTalk(); +} + +// TODO: put Dosometalk here + +void DreamGenContext::hangOnPQ() { + data.byte(kGetback) = 0; + + RectWithCallback quitList[] = { + { 273,320,157,198,&DreamBase::getBack1 }, + { 0,320,0,200,&DreamBase::blank }, + { 0xFFFF,0,0,0,0 } + }; + + uint16 speechFlag = 0; + + do { + delPointer(); + readMouse(); + animPointer(); + showPointer(); + vSync(); + dumpPointer(); + dumpTextLine(); + checkCoords(quitList); + + if (data.byte(kGetback) == 1 || data.byte(kQuitrequested)) { + // Quit conversation + delPointer(); + data.byte(kPointermode) = 0; + cancelCh1(); + flags._c = true; + return; + } + + if (data.byte(kSpeechloaded) == 1 && data.byte(kCh1playing) == 255) { + speechFlag++; + if (speechFlag == 40) + break; + } + } while (!data.word(kMousebutton) || data.word(kOldbutton)); + + delPointer(); + data.byte(kPointermode) = 0; + flags._c = false; +} + +void DreamGenContext::redes() { + if (data.byte(kCh1playing) != 255 || data.byte(kTalkmode) != 2) { + blank(); + return; + } + + if (data.byte(kCommandtype) != 217) { + data.byte(kCommandtype) = 217; + commandOnly(50); + } + + if (!(data.word(kMousebutton) & 1)) + return; + + delPointer(); + createPanel(); + showPanel(); + showMan(); + showExit(); + convIcons(); + startTalk(); + readMouse(); + showPointer(); + workToScreenCPP(); + delPointer(); +} + } // End of namespace DreamGen diff --git a/engines/dreamweb/titles.cpp b/engines/dreamweb/titles.cpp new file mode 100644 index 0000000000..b653c2cf27 --- /dev/null +++ b/engines/dreamweb/titles.cpp @@ -0,0 +1,426 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "dreamweb/dreamweb.h" +#include "engines/util.h" + +namespace DreamGen { + +void DreamGenContext::endGame() { + loadTempText("DREAMWEB.T83"); + monkSpeaking(); + gettingShot(); + getRidOfTempText(); + data.byte(kVolumeto) = 7; + data.byte(kVolumedirection) = 1; + hangOn(200); +} + +void DreamGenContext::monkSpeaking() { + // FIXME: This is the CD version only. + + data.byte(kRoomssample) = 35; + loadRoomsSample(); + loadIntoTemp("DREAMWEB.G15"); + clearWork(); + showFrame(tempGraphics(), 160, 72, 0, 128); // show monk + workToScreen(); + data.byte(kVolume) = 7; + data.byte(kVolumedirection) = (byte)-1; + data.byte(kVolumeto) = 5; + playChannel0(12, 255); + fadeScreenUps(); + hangOn(300); + + for (int i = 40; i <= 48; i++) { + loadSpeech('T', 83, 'T', i); + + playChannel1(50 + 12); + + do { + engine->waitForVSync(); + } while (data.byte(kCh1playing) != 255); + } + + data.byte(kVolumedirection) = 1; + data.byte(kVolumeto) = 7; + fadeScreenDowns(); + hangOn(300); + getRidOfTemp(); +} + +void DreamGenContext::gettingShot() { + data.byte(kNewlocation) = 55; + clearPalette(); + loadIntroRoom(); + fadeScreenUps(); + data.byte(kVolumeto) = 0; + data.byte(kVolumedirection) = (byte)-1; + runEndSeq(); + clearBeforeLoad(); +} + +void DreamGenContext::bibleQuote() { + initGraphics(640, 480, true); + + showPCX("DREAMWEB.I00"); + fadeScreenUps(); + + hangOne(80); + if (data.byte(kLasthardkey) == 1) { + data.byte(kLasthardkey) = 0; + return; // "biblequotearly" + } + + hangOne(560); + if (data.byte(kLasthardkey) == 1) { + data.byte(kLasthardkey) = 0; + return; // "biblequotearly" + } + + fadeScreenDowns(); + + hangOne(200); + if (data.byte(kLasthardkey) == 1) { + data.byte(kLasthardkey) = 0; + return; // "biblequotearly" + } + + cancelCh0(); + + data.byte(kLasthardkey) = 0; +} + +void DreamGenContext::hangOne(uint16 delay) { + do { + vSync(); + if (data.byte(kLasthardkey) == 1) + return; // "hangonearly" + } while (--delay); +} + +void DreamGenContext::hangOne() { + hangOne(cx); +} + +void DreamGenContext::intro() { + loadTempText("DREAMWEB.T82"); + loadPalFromIFF(); + setMode(); + data.byte(kNewlocation) = 50; + clearPalette(); + loadIntroRoom(); + data.byte(kVolume) = 7; + data.byte(kVolumedirection) = (byte)-1; + data.byte(kVolumeto) = 4; + playChannel0(12, 255); + fadeScreenUps(); + runIntroSeq(); + + if (data.byte(kLasthardkey) == 1) { + data.byte(kLasthardkey) = 0; + return; // "introearly" + } + + clearBeforeLoad(); + data.byte(kNewlocation) = 52; + loadIntroRoom(); + runIntroSeq(); + + if (data.byte(kLasthardkey) == 1) { + data.byte(kLasthardkey) = 0; + return; // "introearly" + } + + clearBeforeLoad(); + data.byte(kNewlocation) = 53; + loadIntroRoom(); + runIntroSeq(); + + if (data.byte(kLasthardkey) == 1) { + data.byte(kLasthardkey) = 0; + return; // "introearly" + } + + clearBeforeLoad(); + allPalette(); + data.byte(kNewlocation) = 54; + loadIntroRoom(); + runIntroSeq(); + + if (data.byte(kLasthardkey) == 1) { + data.byte(kLasthardkey) = 0; + return; // "introearly" + } + + getRidOfTempText(); + clearBeforeLoad(); + + data.byte(kLasthardkey) = 0; +} + +void DreamGenContext::runIntroSeq() { + data.byte(kGetback) = 0; + + do { + vSync(); + + if (data.byte(kLasthardkey) == 1) + break; + + spriteUpdate(); + vSync(); + + if (data.byte(kLasthardkey) == 1) + break; + + delEverything(); + printSprites(); + reelsOnScreen(); + afterIntroRoom(); + useTimedText(); + vSync(); + + if (data.byte(kLasthardkey) == 1) + break; + + dumpMap(); + dumpTimedText(); + vSync(); + + if (data.byte(kLasthardkey) == 1) + break; + + } while (data.byte(kGetback) != 1); + + + if (data.byte(kLasthardkey) == 1) { + getRidOfTempText(); + clearBeforeLoad(); + } + + // These were not called in this program arc + // in the original code.. Bug? + //getRidOfTempText(); + //clearBeforeLoad(); +} + +void DreamGenContext::runEndSeq() { + atmospheres(); + data.byte(kGetback) = 0; + + do { + vSync(); + spriteUpdate(); + vSync(); + delEverything(); + printSprites(); + reelsOnScreen(); + afterIntroRoom(); + useTimedText(); + vSync(); + dumpMap(); + dumpTimedText(); + vSync(); + } while (data.byte(kGetback) != 1); +} + +void DreamGenContext::loadIntroRoom() { + data.byte(kIntrocount) = 0; + data.byte(kLocation) = 255; + loadRoom(); + data.word(kMapoffsetx) = 72; + data.word(kMapoffsety) = 16; + clearSprites(); + data.byte(kThroughdoor) = 0; + data.byte(kCurrentkey) = '0'; + data.byte(kMainmode) = 0; + clearWork(); + data.byte(kNewobs) = 1; + drawFloor(); + reelsOnScreen(); + spriteUpdate(); + printSprites(); + workToScreenCPP(); +} + +void DreamGenContext::set16ColPalette() { +} + +void DreamGenContext::realCredits() { + data.byte(kRoomssample) = 33; + loadRoomsSample(); + data.byte(kVolume) = 0; + + initGraphics(640, 480, true); + hangOn(35); + + showPCX("DREAMWEB.I01"); + playChannel0(12, 0); + + hangOne(2); + + if (data.byte(kLasthardkey) == 1) { + data.byte(kLasthardkey) = 0; + return; // "realcreditsearly" + } + + allPalette(); + hangOne(80); + + if (data.byte(kLasthardkey) == 1) { + data.byte(kLasthardkey) = 0; + return; // "realcreditsearly" + } + + fadeScreenDowns(); + hangOne(256); + + if (data.byte(kLasthardkey) == 1) { + data.byte(kLasthardkey) = 0; + return; // "realcreditsearly" + } + + showPCX("DREAMWEB.I02"); + playChannel0(12, 0); + hangOne(2); + + if (data.byte(kLasthardkey) == 1) { + data.byte(kLasthardkey) = 0; + return; // "realcreditsearly" + } + + allPalette(); + hangOne(80); + + if (data.byte(kLasthardkey) == 1) { + data.byte(kLasthardkey) = 0; + return; // "realcreditsearly" + } + + fadeScreenDowns(); + hangOne(256); + + if (data.byte(kLasthardkey) == 1) { + data.byte(kLasthardkey) = 0; + return; // "realcreditsearly" + } + + showPCX("DREAMWEB.I03"); + playChannel0(12, 0); + hangOne(2); + + if (data.byte(kLasthardkey) == 1) { + data.byte(kLasthardkey) = 0; + return; // "realcreditsearly" + } + + allPalette(); + hangOne(80); + + if (data.byte(kLasthardkey) == 1) { + data.byte(kLasthardkey) = 0; + return; // "realcreditsearly" + } + + fadeScreenDowns(); + hangOne(256); + + if (data.byte(kLasthardkey) == 1) { + data.byte(kLasthardkey) = 0; + return; // "realcreditsearly" + } + + showPCX("DREAMWEB.I04"); + playChannel0(12, 0); + hangOne(2); + + if (data.byte(kLasthardkey) == 1) { + data.byte(kLasthardkey) = 0; + return; // "realcreditsearly" + } + + allPalette(); + hangOne(80); + + if (data.byte(kLasthardkey) == 1) { + data.byte(kLasthardkey) = 0; + return; // "realcreditsearly" + } + + fadeScreenDowns(); + hangOne(256); + + if (data.byte(kLasthardkey) == 1) { + data.byte(kLasthardkey) = 0; + return; // "realcreditsearly" + } + + showPCX("DREAMWEB.I05"); + playChannel0(12, 0); + hangOne(2); + + if (data.byte(kLasthardkey) == 1) { + data.byte(kLasthardkey) = 0; + return; // "realcreditsearly" + } + + allPalette(); + hangOne(80); + + if (data.byte(kLasthardkey) == 1) { + data.byte(kLasthardkey) = 0; + return; // "realcreditsearly" + } + + fadeScreenDowns(); + hangOne(256); + + if (data.byte(kLasthardkey) == 1) { + data.byte(kLasthardkey) = 0; + return; // "realcreditsearly" + } + + showPCX("DREAMWEB.I06"); + fadeScreenUps(); + hangOne(60); + + if (data.byte(kLasthardkey) == 1) { + data.byte(kLasthardkey) = 0; + return; // "realcreditsearly" + } + + playChannel0(13, 0); + hangOne(350); + + if (data.byte(kLasthardkey) == 1) { + data.byte(kLasthardkey) = 0; + return; // "realcreditsearly" + } + + fadeScreenDowns(); + hangOne(256); + + data.byte(kLasthardkey) = 0; +} + +} // End of namespace DreamGen diff --git a/engines/dreamweb/vgafades.cpp b/engines/dreamweb/vgafades.cpp index d975d303c9..adbc158c84 100644 --- a/engines/dreamweb/vgafades.cpp +++ b/engines/dreamweb/vgafades.cpp @@ -25,6 +25,7 @@ namespace DreamGen { uint8 *DreamBase::mainPalette() { +// TODO: Turn these into plain C arrays return getSegment(data.word(kBuffers)).ptr(kMaingamepal, 256 * 3); } -- cgit v1.2.3 From 1b98cd5686409645bb99473954dd73bfdb9c5182 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 23 Dec 2011 20:52:27 +1100 Subject: TSAGE: Implemented R2R Scene 825 - Autodoc --- engines/tsage/ringworld2/ringworld2_logic.cpp | 3 +- engines/tsage/ringworld2/ringworld2_scenes0.cpp | 358 ++++++++++++++++++++++++ engines/tsage/ringworld2/ringworld2_scenes0.h | 36 +++ engines/tsage/staticres.cpp | 20 ++ engines/tsage/staticres.h | 14 + 5 files changed, 430 insertions(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index f7dcc56d42..f48864f87d 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(); 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/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; -- cgit v1.2.3 From 99b7fce6113943263bdf9140fab345d0353cf5bd Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Fri, 23 Dec 2011 17:09:46 +0100 Subject: DREAMWEB: Fix regression in sparky --- engines/dreamweb/people.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/dreamweb/people.cpp b/engines/dreamweb/people.cpp index 4d66134e96..1e79471a65 100644 --- a/engines/dreamweb/people.cpp +++ b/engines/dreamweb/people.cpp @@ -273,7 +273,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 -- cgit v1.2.3 From c4af50ae63fc93e221306440fee0337a77059295 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 23 Dec 2011 18:17:33 +0100 Subject: TSAGE: R2R - Implement scene 3250 --- engines/tsage/ringworld2/ringworld2_logic.cpp | 2 + engines/tsage/ringworld2/ringworld2_scenes3.cpp | 167 ++++++++++++++++++++++++ engines/tsage/ringworld2/ringworld2_scenes3.h | 30 +++++ 3 files changed, 199 insertions(+) (limited to 'engines') diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index f48864f87d..6f26054423 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -203,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_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 -- cgit v1.2.3 From 0f36350e03c69ce605fde1277118c43487f724af Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Fri, 23 Dec 2011 19:13:42 +0100 Subject: DREAMWEB: Fix regression from moving ReelRoutines out of data The struct People still had an old-style pointer to a ReelRoutine. Fix this by converting People to use a real ReelRoutine * and moving the PeopleList from the buffers segment to a Common::List. Thanks to digitall for the assistance with tracking this down. --- engines/dreamweb/dreambase.h | 3 +++ engines/dreamweb/people.cpp | 14 ++++++-------- engines/dreamweb/structs.h | 10 ++-------- engines/dreamweb/stubs.cpp | 16 +++++++--------- 4 files changed, 18 insertions(+), 25 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 18eff56a77..d624f8285c 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 _peopleList; + ReelRoutine *_personData; public: DreamBase(DreamWeb::DreamWebEngine *en); diff --git a/engines/dreamweb/people.cpp b/engines/dreamweb/people.cpp index 1e79471a65..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) { 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 dde9613f52..f3c908aad2 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -1168,12 +1168,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::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()); @@ -1189,8 +1187,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; @@ -3833,7 +3831,7 @@ void DreamGenContext::talk() { } while (!data.byte(kGetback)); if (data.byte(kTalkpos) >= 4) - data.byte(data.word(kPersondata)+7) |= 128; + _personData->b7 |= 128; redrawMainScrn(); workToScreenM(); -- cgit v1.2.3 From 6653c977ef30ec9910f64c9231205f42ed58722b Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Fri, 23 Dec 2011 19:55:39 +0100 Subject: DREAMWEB: Remove a few unnecessary globals --- engines/dreamweb/backdrop.cpp | 79 +++++++++++++++++++------------------------ engines/dreamweb/dreambase.h | 2 +- 2 files changed, 36 insertions(+), 45 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/backdrop.cpp b/engines/dreamweb/backdrop.cpp index 38ccb0296c..c4c30548d0 100644 --- a/engines/dreamweb/backdrop.cpp +++ b/engines/dreamweb/backdrop.cpp @@ -100,9 +100,9 @@ uint8 DreamBase::getMapAd(const uint8 *setData) { 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(); +void DreamBase::calcFrFrame(uint16 frameSeg, uint16 frameNum, uint16 framesAd, uint8* width, uint8* height) { + const Frame *frame = (const Frame *)getSegment(frameSeg).ptr(frameNum * sizeof(Frame), sizeof(Frame)); + data.word(kSavesource) = framesAd + frame->ptr(); data.byte(kSavesize+0) = frame->width; data.byte(kSavesize+1) = frame->height; data.word(kOffsetx) = frame->x; @@ -139,15 +139,14 @@ 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) continue; @@ -155,24 +154,23 @@ void DreamBase::showAllObs() { if (currentFrame == 0xff) continue; uint8 width, height; - calcFrFrame(currentFrame, &width, &height); + calcFrFrame(data.word(kSetframes), currentFrame, kFrames, &width, &height); uint16 x, y; finalFrame(&x, &y); 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); - 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 +228,34 @@ 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) { + const Frame *frameBase = (const Frame *)getSegment(data.word(kFreeframes)).ptr(0, 0); + for (size_t i = 0; i < count; ++i) { uint8 mapAd = getMapAd(freeObjects[i].mapad); if (mapAd != 0) { uint8 width, height; - uint16 currentFrame = 3 * data.byte(kCurrentfree); - calcFrFrame(currentFrame, &width, &height); + uint16 currentFrame = 3 * i; + calcFrFrame(data.word(kFreeframes), currentFrame, kFrframes, &width, &height); uint16 x, y; finalFrame(&x, &y); 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)); + showFrame(frameBase, x, y, currentFrame, 0); 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; } } - - ++data.byte(kCurrentfree); } } @@ -283,15 +276,14 @@ 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; @@ -300,20 +292,19 @@ void DreamBase::showAllEx() { if (getMapAd(object->mapad) == 0) continue; uint8 width, height; - uint16 currentFrame = 3 * data.byte(kCurrentex); - calcFrFrame(currentFrame, &width, &height); + uint16 currentFrame = 3 * i; + calcFrFrame(data.word(kExtras), currentFrame, kExframes, &width, &height); uint16 x, y; finalFrame(&x, &y); 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)); + showFrame(frameBase, x + data.word(kMapadx), y + data.word(kMapady), currentFrame, 0); 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); objPos->index = i; - data.word(kListpos) += sizeof(ObjPos); + ++objPos; } } } diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index d624f8285c..37c3be17d0 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -78,7 +78,7 @@ public: 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 calcFrFrame(uint16 frameSeg, uint16 frameNum, uint16 framesAd, uint8* width, uint8* height); void finalFrame(uint16 *x, uint16 *y); void makeBackOb(SetObject *objData); void showAllObs(); -- cgit v1.2.3 From b6a6778843051d9150ac64c640ba19f3df08fce0 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Fri, 23 Dec 2011 20:32:52 +0100 Subject: DREAMWEB: Remove more unnecessary globals --- engines/dreamweb/backdrop.cpp | 62 +++---- engines/dreamweb/dreambase.h | 7 +- engines/dreamweb/dreamgen.cpp | 72 ++++---- engines/dreamweb/dreamgen.h | 409 ++++++++++++++++++++---------------------- 4 files changed, 257 insertions(+), 293 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/backdrop.cpp b/engines/dreamweb/backdrop.cpp index c4c30548d0..9d13eef210 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 frameSeg, uint16 frameNum, uint16 framesAd, uint8* width, uint8* height) { +void DreamBase::calcFrFrame(uint16 frameSeg, uint16 frameNum, uint8 *width, uint8 *height, uint16 x, uint16 y, ObjPos *objPos) { const Frame *frame = (const Frame *)getSegment(frameSeg).ptr(frameNum * sizeof(Frame), sizeof(Frame)); - data.word(kSavesource) = framesAd + frame->ptr(); - data.byte(kSavesize+0) = frame->width; - data.byte(kSavesize+1) = frame->height; - data.word(kOffsetx) = frame->x; - data.word(kOffsety) = frame->y; *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); @@ -148,27 +141,22 @@ void DreamBase::showAllObs() { 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(data.word(kSetframes), currentFrame, kFrames, &width, &height); - uint16 x, y; - finalFrame(&x, &y); + calcFrFrame(data.word(kSetframes), 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(frameBase, x, y, currentFrame, 0); } else - makeBackOb(setEntry); + makeBackOb(setEntry, x, y); - 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; ++objPos; } @@ -236,22 +224,17 @@ void DreamBase::showAllFree() { const DynObject *freeObjects = (const DynObject *)getSegment(data.word(kFreedat)).ptr(0, 0); const Frame *frameBase = (const Frame *)getSegment(data.word(kFreeframes)).ptr(0, 0); for (size_t i = 0; i < count; ++i) { - uint8 mapAd = getMapAd(freeObjects[i].mapad); + uint16 x, y; + uint8 mapAd = getMapAd(freeObjects[i].mapad, &x, &y); if (mapAd != 0) { uint8 width, height; uint16 currentFrame = 3 * i; - calcFrFrame(data.word(kFreeframes), currentFrame, kFrframes, &width, &height); - uint16 x, y; - finalFrame(&x, &y); + calcFrFrame(data.word(kFreeframes), currentFrame, &width, &height, x, y, objPos); if ((width != 0) || (height != 0)) { x += data.word(kMapadx); y += data.word(kMapady); assert(currentFrame < 256); showFrame(frameBase, x, y, currentFrame, 0); - 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; ++objPos; } @@ -289,20 +272,15 @@ void DreamBase::showAllEx() { 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 * i; - calcFrFrame(data.word(kExtras), currentFrame, kExframes, &width, &height); - uint16 x, y; - finalFrame(&x, &y); + calcFrFrame(data.word(kExtras), 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); - 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); objPos->index = i; ++objPos; } diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 37c3be17d0..b49787e3b2 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -77,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 frameSeg, uint16 frameNum, uint16 framesAd, 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(uint16 frameSeg, 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 c2d8530b25..6a68e7c2b9 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -1479,14 +1479,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(); } @@ -1538,7 +1538,7 @@ clearedlocations: bx = ax; dx = data; es = dx; - _add(bx, 555); + _add(bx, 537); es.byte(bx) = 0; } @@ -1558,7 +1558,7 @@ dirroot: si = offset_rootdir; _inc(si); es = cs; - di = 480; + di = 462; _inc(di); cx = 12; _movsb(cx, true); @@ -1603,7 +1603,7 @@ void DreamGenContext::read() { return; okcom: es = cs; - di = 480; + di = 462; ax = data.word(kTextfile1); data.word(kMonsource) = ax; ds = ax; @@ -1733,7 +1733,7 @@ keyok2: ds = cs; si = offset_operand1+1; es = cs; - di = 480+1; + di = 462+1; cx = 12; _movsb(cx, true); monitorLogo(); @@ -1815,7 +1815,7 @@ void DreamGenContext::parser() { al = '='; _stosb(); ds = cs; - si = 589; + si = 571; notspace1: _lodsw(); _cmp(al, 32); @@ -1952,14 +1952,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, @@ -1974,37 +1974,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: .... .... .... .... @@ -2018,11 +2018,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 92b75a287a..d7f754afe9 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); -- cgit v1.2.3 From 625a5ef2ed8f947e43e8e8d12bd72ffe9d1776c6 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Fri, 23 Dec 2011 20:45:51 +0100 Subject: DREAMWEB: Minor cleanup --- engines/dreamweb/backdrop.cpp | 10 +++++----- engines/dreamweb/dreambase.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/backdrop.cpp b/engines/dreamweb/backdrop.cpp index 9d13eef210..cb72454a41 100644 --- a/engines/dreamweb/backdrop.cpp +++ b/engines/dreamweb/backdrop.cpp @@ -100,8 +100,8 @@ uint8 DreamBase::getMapAd(const uint8 *setData, uint16 *x, uint16 *y) { return 1; } -void DreamBase::calcFrFrame(uint16 frameSeg, uint16 frameNum, uint8 *width, uint8 *height, uint16 x, uint16 y, ObjPos *objPos) { - const Frame *frame = (const Frame *)getSegment(frameSeg).ptr(frameNum * sizeof(Frame), sizeof(Frame)); +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; @@ -148,7 +148,7 @@ void DreamBase::showAllObs() { if (currentFrame == 0xff) continue; uint8 width, height; - calcFrFrame(data.word(kSetframes), currentFrame, &width, &height, x, y, objPos); + 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); @@ -229,7 +229,7 @@ void DreamBase::showAllFree() { if (mapAd != 0) { uint8 width, height; uint16 currentFrame = 3 * i; - calcFrFrame(data.word(kFreeframes), currentFrame, &width, &height, x, y, objPos); + calcFrFrame(frameBase, currentFrame, &width, &height, x, y, objPos); if ((width != 0) || (height != 0)) { x += data.word(kMapadx); y += data.word(kMapady); @@ -277,7 +277,7 @@ void DreamBase::showAllEx() { continue; uint8 width, height; uint16 currentFrame = 3 * i; - calcFrFrame(data.word(kExtras), currentFrame, &width, &height, x, y, objPos); + calcFrFrame(frameBase, 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 b49787e3b2..3c2283636e 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -78,7 +78,7 @@ public: uint8 getXAd(const uint8 *setData, uint8 *result); uint8 getYAd(const uint8 *setData, uint8 *result); uint8 getMapAd(const uint8 *setData, uint16 *x, uint16 *y); - void calcFrFrame(uint16 frameSeg, uint16 frameNum, uint8* width, uint8* height, uint16 x, uint16 y, ObjPos *objPos); + 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); -- cgit v1.2.3 From f6d63ae6a8adeb182d404274b856c03bb40bae4a Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 24 Dec 2011 00:34:56 +0200 Subject: DREAMWEB: Use the C++ versions of getAnyAd and makeWorn in some places This allows us to remove the ASM style version of makeWorn() --- engines/dreamweb/object.cpp | 7 +------ engines/dreamweb/stubs.h | 1 - engines/dreamweb/use.cpp | 16 ++++++++-------- 3 files changed, 9 insertions(+), 15 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index 207f4889db..cdd612001f 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -79,10 +79,6 @@ void DreamGenContext::wornError() { workToScreenM(); } -void DreamGenContext::makeWorn() { - makeWorn((DynObject *)es.ptr(bx, sizeof(DynObject))); -} - void DreamGenContext::makeWorn(DynObject *object) { object->id[0] = 'W'-'A'; object->id[1] = 'E'-'A'; @@ -419,8 +415,7 @@ void DreamGenContext::selectOb() { void DreamGenContext::setPickup() { if (data.byte(kObjecttype) != kSetObjectType1 && data.byte(kObjecttype) != kSetObjectType3) { - // The original called getAnyAd() here. However, since object types - // 1 and 3 are excluded, the resulting object is a DynObject + // Object types 1 and 3 are excluded, so the resulting object is a DynObject uint8 dummy; DynObject *object = (DynObject *)getAnyAd(&dummy, &dummy); if (object->mapad[0] == 4) { diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index c94cb02a3c..a58bb259be 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -104,7 +104,6 @@ return DreamBase::isItWorn(object); } void wornError(); - void makeWorn(); void makeWorn(DynObject *object); void obToInv(); void obToInv(uint8 index, uint8 flag, uint16 x, uint16 y) { diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp index d3dda0e0a0..b642598589 100644 --- a/engines/dreamweb/use.cpp +++ b/engines/dreamweb/use.cpp @@ -363,8 +363,8 @@ void DreamGenContext::wearWatch() { showFirstUse(); data.byte(kWatchon) = 1; data.byte(kGetback) = 1; - getAnyAd(); - makeWorn(); + uint8 dummy; + makeWorn((DynObject *)getAnyAd(&dummy, &dummy)); } } @@ -377,8 +377,8 @@ void DreamGenContext::wearShades() { data.byte(kShadeson) = 1; showFirstUse(); data.byte(kGetback) = 1; - getAnyAd(); - makeWorn(); + uint8 dummy; + makeWorn((DynObject *)getAnyAd(&dummy, &dummy)); } } @@ -1027,13 +1027,13 @@ void DreamGenContext::useCart() { } void DreamGenContext::useTrainer() { - // TODO: Use the C++ version of getAnyAd() - getAnyAd(); - if (es.byte(bx + 2) != 4) { + uint8 dummy; + DynObject *object = (DynObject *)getAnyAd(&dummy, &dummy); + if (object->mapad[0] != 4) { notHeldError(); } else { data.byte(kProgresspoints)++; - makeWorn(); + makeWorn(object); showSecondUse(); putBackObStuff(); } -- cgit v1.2.3 From 00b0aafd4ca9fa79686340a66f9dba9b383993e2 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Fri, 23 Dec 2011 23:45:44 +0100 Subject: DREAMWEB: Fix broken merge for pull request #151 --- engines/dreamweb/talk.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/dreamweb/talk.cpp b/engines/dreamweb/talk.cpp index fac75be6cf..40c514b34a 100644 --- a/engines/dreamweb/talk.cpp +++ b/engines/dreamweb/talk.cpp @@ -62,7 +62,7 @@ void DreamGenContext::talk() { } while (!data.byte(kGetback)); if (data.byte(kTalkpos) >= 4) - data.byte(data.word(kPersondata)+7) |= 128; + _personData->b7 |= 128; redrawMainScrn(); workToScreenM(); -- cgit v1.2.3 From 061d24bb829a9b4ee08016fb25781802799fae14 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Fri, 23 Dec 2011 22:47:20 +0100 Subject: DREAMWEB: Move palettes out of buffers --- engines/dreamweb/dreambase.h | 10 ++++--- engines/dreamweb/vgafades.cpp | 67 +++++++++++++++++-------------------------- engines/dreamweb/vgagrafx.cpp | 4 +-- 3 files changed, 35 insertions(+), 46 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index e20ee83bac..b4265e904a 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -66,9 +66,14 @@ protected: // from people.cpp ReelRoutine _reelRoutines[kNumReelRoutines+1]; - Common::List _peopleList; ReelRoutine *_personData; + // from Buffers + uint8 _startPal[3*256]; + uint8 _endPal[3*256]; + uint8 _mainPal[3*256]; + Common::List _peopleList; + public: DreamBase(DreamWeb::DreamWebEngine *en); @@ -494,9 +499,6 @@ public: void showPuzText(uint16 command, uint16 count); // from vgafades.cpp - uint8 *mainPalette(); - uint8 *startPalette(); - uint8 *endPalette(); void clearStartPal(); void clearEndPal(); void palToStartPal(); diff --git a/engines/dreamweb/vgafades.cpp b/engines/dreamweb/vgafades.cpp index adbc158c84..80f5ce608a 100644 --- a/engines/dreamweb/vgafades.cpp +++ b/engines/dreamweb/vgafades.cpp @@ -24,41 +24,28 @@ namespace DreamGen { -uint8 *DreamBase::mainPalette() { -// TODO: Turn these into plain C arrays - return getSegment(data.word(kBuffers)).ptr(kMaingamepal, 256 * 3); -} - -uint8 *DreamBase::startPalette() { - return getSegment(data.word(kBuffers)).ptr(kStartpal, 256 * 3); -} - -uint8 *DreamBase::endPalette() { - return getSegment(data.word(kBuffers)).ptr(kEndpal, 256 * 3); -} - void DreamBase::clearStartPal() { - memset(startPalette(), 0, 256 * 3); + memset(_startPal, 0, 256 * 3); } void DreamBase::clearEndPal() { - memset(endPalette(), 0, 256 * 3); + memset(_endPal, 0, 256 * 3); } void DreamBase::palToStartPal() { - memcpy(startPalette(), mainPalette(), 256 * 3); + memcpy(_startPal, _mainPal, 256 * 3); } void DreamBase::endPalToStart() { - memcpy(startPalette(), endPalette(), 256 * 3); + memcpy(_startPal, _endPal, 256 * 3); } void DreamBase::startPalToEnd() { - memcpy(endPalette(), startPalette(), 256 * 3); + memcpy(_endPal, _startPal, 256 * 3); } void DreamBase::palToEndPal() { - memcpy(endPalette(), mainPalette(), 256 * 3); + memcpy(_endPal, _mainPal, 256 * 3); } void DreamBase::fadeDOS() { @@ -66,7 +53,7 @@ void DreamBase::fadeDOS() { engine->waitForVSync(); //processEvents will be called from vsync - uint8 *dst = startPalette(); + uint8 *dst = _startPal; engine->getPalette(dst, 0, 64); for (int fade = 0; fade < 64; ++fade) { for (int c = 0; c < 768; ++c) { //original sources decrement 768 values -> 256 colors @@ -84,7 +71,7 @@ void DreamBase::doFade() { return; engine->processEvents(); - uint8 *src = startPalette() + 3 * data.byte(kColourpos); + uint8 *src = _startPal + 3 * data.byte(kColourpos); engine->setPalette(src, data.byte(kColourpos), data.byte(kNumtofade)); data.byte(kColourpos) += data.byte(kNumtofade); @@ -98,8 +85,8 @@ void DreamBase::fadeCalculation() { return; } - uint8 *startPal = startPalette(); - const uint8 *endPal = endPalette(); + uint8 *startPal = _startPal; + const uint8 *endPal = _endPal; for (size_t i = 0; i < 256 * 3; ++i) { uint8 s = startPal[i]; uint8 e = endPal[i]; @@ -117,8 +104,8 @@ void DreamBase::fadeCalculation() { void DreamBase::fadeUpYellows() { palToEndPal(); - memset(endPalette() + 231 * 3, 0, 8 * 3); - memset(endPalette() + 246 * 3, 0, 1 * 3); + memset(_endPal + 231 * 3, 0, 8 * 3); + memset(_endPal + 246 * 3, 0, 1 * 3); data.byte(kFadedirection) = 1; data.byte(kFadecount) = 63; data.byte(kColourpos) = 0; @@ -129,8 +116,8 @@ void DreamBase::fadeUpYellows() { void DreamBase::fadeUpMonFirst() { palToStartPal(); palToEndPal(); - memset(startPalette() + 231 * 3, 0, 8 * 3); - memset(startPalette() + 246 * 3, 0, 1 * 3); + memset(_startPal + 231 * 3, 0, 8 * 3); + memset(_startPal + 246 * 3, 0, 1 * 3); data.byte(kFadedirection) = 1; data.byte(kFadecount) = 63; data.byte(kColourpos) = 0; @@ -144,8 +131,8 @@ void DreamBase::fadeUpMonFirst() { void DreamBase::fadeDownMon() { palToStartPal(); palToEndPal(); - memset(endPalette() + 231 * 3, 0, 8 * 3); - memset(endPalette() + 246 * 3, 0, 1 * 3); + memset(_endPal + 231 * 3, 0, 8 * 3); + memset(_endPal + 246 * 3, 0, 1 * 3); data.byte(kFadedirection) = 1; data.byte(kFadecount) = 63; data.byte(kColourpos) = 0; @@ -156,8 +143,8 @@ void DreamBase::fadeDownMon() { void DreamBase::fadeUpMon() { palToStartPal(); palToEndPal(); - memset(startPalette() + 231 * 3, 0, 8 * 3); - memset(startPalette() + 246 * 3, 0, 1 * 3); + memset(_startPal + 231 * 3, 0, 8 * 3); + memset(_startPal + 246 * 3, 0, 1 * 3); data.byte(kFadedirection) = 1; data.byte(kFadecount) = 63; data.byte(kColourpos) = 0; @@ -167,10 +154,10 @@ void DreamBase::fadeUpMon() { void DreamBase::initialMonCols() { palToStartPal(); - memset(startPalette() + 230 * 3, 0, 9 * 3); - memset(startPalette() + 246 * 3, 0, 1 * 3); + memset(_startPal + 230 * 3, 0, 9 * 3); + memset(_startPal + 246 * 3, 0, 1 * 3); engine->processEvents(); - engine->setPalette(startPalette() + 230 * 3, 230, 18); + engine->setPalette(_startPal + 230 * 3, 230, 18); } void DreamBase::fadeScreenUp() { @@ -222,8 +209,8 @@ void DreamBase::fadeScreenDownHalf() { palToStartPal(); palToEndPal(); - const uint8 *startPal = startPalette(); - uint8 *endPal = endPalette(); + const uint8 *startPal = _startPal; + uint8 *endPal = _endPal; for (int i = 0; i < 256 * 3; ++i) { *endPal >>= 1; endPal++; @@ -248,8 +235,8 @@ void DreamBase::clearPalette() { // Converts palette to grey scale, summed using formula // .20xred + .59xGreen + .11xBlue void DreamBase::greyscaleSum() { - byte *src = mainPalette(); - byte *dst = endPalette(); + byte *src = _mainPal; + byte *dst = _endPal; for (int i = 0; i < 256; ++i) { const unsigned int r = 20 * *src++; @@ -276,12 +263,12 @@ void DreamBase::greyscaleSum() { } void DreamBase::allPalette() { - memcpy(startPalette(), mainPalette(), 3 * 256); + memcpy(_startPal, _mainPal, 3 * 256); dumpCurrent(); } void DreamBase::dumpCurrent() { - uint8 *pal = startPalette(); + uint8 *pal = _startPal; engine->waitForVSync(); engine->processEvents(); diff --git a/engines/dreamweb/vgagrafx.cpp b/engines/dreamweb/vgagrafx.cpp index b1a23a6c96..87ab998553 100644 --- a/engines/dreamweb/vgagrafx.cpp +++ b/engines/dreamweb/vgagrafx.cpp @@ -202,7 +202,7 @@ void DreamBase::showPCX(const Common::String &name) { // the color components have to be adjusted from 8 to 6 bits. pcxFile.seek(16, SEEK_SET); - mainGamePal = mainPalette(); + mainGamePal = _mainPal; pcxFile.read(mainGamePal, 48); memset(mainGamePal + 48, 0xff, 720); @@ -448,7 +448,7 @@ void DreamBase::loadPalFromIFF() { palFile.close(); const uint8 *src = mapStore() + 0x30; - uint8 *dst = mainPalette(); + uint8 *dst = _mainPal; for (size_t i = 0; i < 256*3; ++i) { uint8 c = src[i] / 4; if (data.byte(kBrightness) == 1) { -- cgit v1.2.3 From 1749182e98ed410cd62e22185943696b7e30432a Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Fri, 23 Dec 2011 22:49:40 +0100 Subject: DREAMWEB: Move ObjPos lists out of buffers --- engines/dreamweb/backdrop.cpp | 30 +++++++++++++++--------------- engines/dreamweb/dreambase.h | 3 +++ engines/dreamweb/stubs.cpp | 37 ++++++++++++++++++++----------------- 3 files changed, 38 insertions(+), 32 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/backdrop.cpp b/engines/dreamweb/backdrop.cpp index cb72454a41..9fe3c74150 100644 --- a/engines/dreamweb/backdrop.cpp +++ b/engines/dreamweb/backdrop.cpp @@ -134,8 +134,7 @@ void DreamBase::makeBackOb(SetObject *objData, uint16 x, uint16 y) { void DreamBase::showAllObs() { const unsigned int count = 128; - ObjPos *objPos = (ObjPos *)getSegment(data.word(kBuffers)).ptr(kSetlist, count * sizeof(ObjPos)); - memset(objPos, 0xff, count * sizeof(ObjPos)); + _setList.clear(); const Frame *frameBase = (const Frame *)getSegment(data.word(kSetframes)).ptr(0, 0); SetObject *setEntries = (SetObject *)getSegment(data.word(kSetdat)).ptr(0, count * sizeof(SetObject)); @@ -148,7 +147,8 @@ void DreamBase::showAllObs() { if (currentFrame == 0xff) continue; uint8 width, height; - calcFrFrame(frameBase, currentFrame, &width, &height, x, y, objPos); + ObjPos objPos; + 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); @@ -157,8 +157,8 @@ void DreamBase::showAllObs() { } else makeBackOb(setEntry, x, y); - objPos->index = i; - ++objPos; + objPos.index = i; + _setList.push_back(objPos); } } @@ -218,8 +218,7 @@ void DreamBase::calcMapAd() { void DreamBase::showAllFree() { const unsigned int count = 80; - ObjPos *objPos = (ObjPos *)getSegment(data.word(kBuffers)).ptr(kFreelist, count * sizeof(ObjPos)); - memset(objPos, 0xff, count * sizeof(ObjPos)); + _freeList.clear(); const DynObject *freeObjects = (const DynObject *)getSegment(data.word(kFreedat)).ptr(0, 0); const Frame *frameBase = (const Frame *)getSegment(data.word(kFreeframes)).ptr(0, 0); @@ -228,15 +227,16 @@ void DreamBase::showAllFree() { uint8 mapAd = getMapAd(freeObjects[i].mapad, &x, &y); if (mapAd != 0) { uint8 width, height; + ObjPos objPos; uint16 currentFrame = 3 * i; - calcFrFrame(frameBase, currentFrame, &width, &height, x, y, objPos); + 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(frameBase, x, y, currentFrame, 0); - objPos->index = i; - ++objPos; + objPos.index = i; + _freeList.push_back(objPos); } } } @@ -261,8 +261,7 @@ void DreamBase::drawFlags() { void DreamBase::showAllEx() { const unsigned int count = 100; - ObjPos *objPos = (ObjPos *)getSegment(data.word(kBuffers)).ptr(kExlist, count * sizeof(ObjPos)); - memset(objPos, 0xff, count * sizeof(ObjPos)); + _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); @@ -276,13 +275,14 @@ void DreamBase::showAllEx() { if (getMapAd(object->mapad, &x, &y) == 0) continue; uint8 width, height; + ObjPos objPos; uint16 currentFrame = 3 * i; - calcFrFrame(frameBase, currentFrame, &width, &height, x, y, objPos); + calcFrFrame(frameBase, 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); - objPos->index = i; - ++objPos; + objPos.index = i; + _exList.push_back(objPos); } } } diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index b4265e904a..b739c9cbbe 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -72,6 +72,9 @@ protected: uint8 _startPal[3*256]; uint8 _endPal[3*256]; uint8 _mainPal[3*256]; + Common::List _setList; + Common::List _freeList; + Common::List _exList; Common::List _peopleList; public: diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 9969ac775a..3e7a694c91 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -1188,12 +1188,13 @@ void DreamGenContext::checkIfFree() { } bool DreamGenContext::checkIfFree(uint8 x, uint8 y) { - const ObjPos *freeList = (const ObjPos *)getSegment(data.word(kBuffers)).ptr(kFreelist, 80 * sizeof(ObjPos)); - for (size_t i = 0; i < 80; ++i) { - const ObjPos *objPos = freeList + 79 - i; - if (objPos->index == 0xff || !objPos->contains(x,y)) + Common::List::const_iterator i; + for (i = _freeList.reverse_begin(); i != _freeList.end(); --i) { + const ObjPos &pos = *i; + assert(pos.index != 0xff); + if (!pos.contains(x,y)) continue; - obName(objPos->index, 2); + obName(pos.index, 2); return true; } return false; @@ -1204,12 +1205,13 @@ void DreamGenContext::checkIfEx() { } bool DreamGenContext::checkIfEx(uint8 x, uint8 y) { - const ObjPos *exList = (const ObjPos *)getSegment(data.word(kBuffers)).ptr(kExlist, 100 * sizeof(ObjPos)); - for (size_t i = 0; i < 100; ++i) { - const ObjPos *objPos = exList + 99 - i; - if (objPos->index == 0xff || !objPos->contains(x,y)) + Common::List::const_iterator i; + for (i = _exList.reverse_begin(); i != _exList.end(); --i) { + const ObjPos &pos = *i; + assert(pos.index != 0xff); + if (!pos.contains(x,y)) continue; - obName(objPos->index, 4); + obName(pos.index, 4); return true; } return false; @@ -1781,16 +1783,17 @@ void DreamBase::showIcon() { } bool DreamGenContext::checkIfSet(uint8 x, uint8 y) { - const ObjPos *setList = (const ObjPos *)getSegment(data.word(kBuffers)).ptr(kSetlist, sizeof(ObjPos) * 128); - for (size_t i = 0; i < 128; ++i) { - const ObjPos *pos = setList + 127 - i; - if (pos->index == 0xff || !pos->contains(x,y)) + Common::List::const_iterator i; + for (i = _setList.reverse_begin(); i != _setList.end(); --i) { + const ObjPos &pos = *i; + assert(pos.index != 0xff); + if (!pos.contains(x,y)) continue; - if (!pixelCheckSet(pos, x, y)) + if (!pixelCheckSet(&pos, x, y)) continue; - if (!isItDescribed(pos)) + if (!isItDescribed(&pos)) continue; - obName(pos->index, 1); + obName(pos.index, 1); return true; } return false; -- cgit v1.2.3 From 109acaab3cb9b75937e9521b582476f544ebfe71 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Fri, 23 Dec 2011 22:51:32 +0100 Subject: DREAMWEB: Move mapflags out of buffers --- engines/dreamweb/backdrop.cpp | 12 +++++------- engines/dreamweb/dreambase.h | 1 + engines/dreamweb/sprite.cpp | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/backdrop.cpp b/engines/dreamweb/backdrop.cpp index 9fe3c74150..b806ba43a0 100644 --- a/engines/dreamweb/backdrop.cpp +++ b/engines/dreamweb/backdrop.cpp @@ -179,22 +179,20 @@ bool DreamBase::addLength(const uint8 *mapFlags) { } void DreamBase::getDimension(uint8 *mapXstart, uint8 *mapYstart, uint8 *mapXsize, uint8 *mapYsize) { - const uint8 *mapFlags = getSegment(data.word(kBuffers)).ptr(kMapflags, 0); - uint8 yStart = 0; - while (! addAlong(mapFlags + 3 * 11 * yStart)) + while (! addAlong(_mapFlags + 3 * 11 * yStart)) ++yStart; uint8 xStart = 0; - while (! addLength(mapFlags + 3 * xStart)) + while (! addLength(_mapFlags + 3 * xStart)) ++xStart; uint8 yEnd = 10; - while (! addAlong(mapFlags + 3 * 11 * (yEnd - 1))) + while (! addAlong(_mapFlags + 3 * 11 * (yEnd - 1))) --yEnd; uint8 xEnd = 11; - while (! addLength(mapFlags + 3 * (xEnd - 1))) + while (! addLength(_mapFlags + 3 * (xEnd - 1))) --xEnd; *mapXstart = xStart; @@ -243,7 +241,7 @@ void DreamBase::showAllFree() { } void DreamBase::drawFlags() { - uint8 *mapFlags = getSegment(data.word(kBuffers)).ptr(kMapflags, 0); + uint8 *mapFlags = _mapFlags; const uint8 *mapData = getSegment(data.word(kMapdata)).ptr(kMap + data.byte(kMapy) * kMapwidth + data.byte(kMapx), 0); const uint8 *backdropFlags = getSegment(data.word(kBackdrop)).ptr(kFlags, 0); diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index b739c9cbbe..7816308e03 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -69,6 +69,7 @@ protected: ReelRoutine *_personData; // from Buffers + uint8 _mapFlags[11*10*3]; uint8 _startPal[3*256]; uint8 _endPal[3*256]; uint8 _mainPal[3*256]; diff --git a/engines/dreamweb/sprite.cpp b/engines/dreamweb/sprite.cpp index cc6b09fd68..17d3ccd765 100644 --- a/engines/dreamweb/sprite.cpp +++ b/engines/dreamweb/sprite.cpp @@ -552,7 +552,7 @@ void DreamGenContext::checkOne() { void DreamBase::checkOne(uint8 x, uint8 y, uint8 *flag, uint8 *flagEx, uint8 *type, uint8 *flagX, uint8 *flagY) { *flagX = x / 16; *flagY = y / 16; - const uint8 *tileData = getSegment(data.word(kBuffers)).ptr(kMapflags + (*flagY * 11 + *flagX) * 3, 3); + const uint8 *tileData = &_mapFlags[(*flagY * 11 + *flagX) * 3]; *flag = tileData[0]; *flagEx = tileData[1]; *type = tileData[2]; -- cgit v1.2.3 From 814793de49f8002fbac17fdd604399a4f694ddf8 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Fri, 23 Dec 2011 22:53:29 +0100 Subject: DREAMWEB: Move rainlist out of buffers --- engines/dreamweb/dreambase.h | 3 ++- engines/dreamweb/sprite.cpp | 52 ++++++++++++++++++++------------------------ engines/dreamweb/structs.h | 5 +---- 3 files changed, 27 insertions(+), 33 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 7816308e03..3428a8cef8 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -77,6 +77,7 @@ protected: Common::List _freeList; Common::List _exList; Common::List _peopleList; + Common::List _rainList; public: DreamBase(DreamWeb::DreamWebEngine *en); @@ -317,7 +318,7 @@ public: void checkOne(uint8 x, uint8 y, uint8 *flag, uint8 *flagEx, uint8 *type, uint8 *flagX, uint8 *flagY); uint8 getBlockOfPixel(uint8 x, uint8 y); - Rain *splitIntoLines(uint8 x, uint8 y, Rain *rain); + void splitIntoLines(uint8 x, uint8 y); void initRain(); void intro1Text(); diff --git a/engines/dreamweb/sprite.cpp b/engines/dreamweb/sprite.cpp index 17d3ccd765..754f91401b 100644 --- a/engines/dreamweb/sprite.cpp +++ b/engines/dreamweb/sprite.cpp @@ -474,25 +474,26 @@ const Frame *DreamBase::getReelFrameAX(uint16 frame) { } void DreamBase::showRain() { - Rain *rain = (Rain *)getSegment(data.word(kBuffers)).ptr(kRainlist, 0); + Common::List::iterator i; // Do nothing if there's no rain at all - if (rain->x == 255) + if (_rainList.empty()) return; const Frame *frame = (const Frame *)getSegment(data.word(kMainsprites)).ptr(58 * sizeof(Frame), sizeof(Frame)); const uint8 *frameData = getSegment(data.word(kMainsprites)).ptr(kFrframes + frame->ptr(), 512); - for (; rain->x != 255; ++rain) { - uint16 y = rain->y + data.word(kMapady) + data.word(kMapystart); - uint16 x = rain->x + data.word(kMapadx) + data.word(kMapxstart); - uint16 size = rain->size; - uint16 offset = (rain->w3() - rain->b5) & 511; - rain->setW3(offset); + for (i = _rainList.begin(); i != _rainList.end(); ++i) { + Rain &rain = *i; + uint16 y = rain.y + data.word(kMapady) + data.word(kMapystart); + uint16 x = rain.x + data.word(kMapadx) + data.word(kMapxstart); + uint16 size = rain.size; + uint16 offset = (rain.w3 - rain.b5) & 511; + rain.w3 = offset; const uint8 *src = frameData + offset; uint8 *dst = workspace() + y * 320 + x; - for (uint16 i = 0; i < size; ++i) { - uint8 v = src[i]; + for (uint16 j = 0; j < size; ++j) { + uint8 v = src[j]; if (v != 0) *dst = v; dst += 320-1; // advance diagonally @@ -567,18 +568,20 @@ uint8 DreamBase::getBlockOfPixel(uint8 x, uint8 y) { return type; } -Rain *DreamBase::splitIntoLines(uint8 x, uint8 y, Rain *rain) { +void DreamBase::splitIntoLines(uint8 x, uint8 y) { do { + Rain rain; + // Look for line start while (!getBlockOfPixel(x, y)) { --x; ++y; if (x == 0 || y >= data.byte(kMapysize)) - return rain; + return; } - rain->x = x; - rain->y = y; + rain.x = x; + rain.y = y; uint8 length = 1; @@ -591,14 +594,11 @@ Rain *DreamBase::splitIntoLines(uint8 x, uint8 y, Rain *rain) { ++length; } - rain->size = length; - rain->w3_lo = engine->randomNumber(); - rain->w3_hi = engine->randomNumber(); - rain->b5 = (engine->randomNumber() & 3) + 4; - ++rain; + rain.size = length; + rain.w3 = (engine->randomNumber() << 8) | engine->randomNumber(); + rain.b5 = (engine->randomNumber() & 3) + 4; + _rainList.push_back(rain); } while (x > 0 && y < data.byte(kMapysize)); - - return rain; } struct RainLocation { @@ -640,8 +640,7 @@ static const RainLocation rainLocationList[] = { void DreamBase::initRain() { const RainLocation *r = rainLocationList; - Rain *rainList = (Rain *)getSegment(data.word(kBuffers)).ptr(kRainlist, 0); - Rain *rain = rainList; + _rainList.clear(); uint8 rainSpacing = 0; @@ -656,7 +655,6 @@ void DreamBase::initRain() { if (rainSpacing == 0) { // location not found in rainLocationList: no rain - rain->x = 0xff; return; } @@ -672,7 +670,7 @@ void DreamBase::initRain() { if (x >= data.byte(kMapxsize)) break; - rain = splitIntoLines(x, 0, rain); + splitIntoLines(x, 0); } while (true); // start lines of rain from side of screen @@ -687,10 +685,8 @@ void DreamBase::initRain() { if (y >= data.byte(kMapysize)) break; - rain = splitIntoLines(data.byte(kMapxsize) - 1, y, rain); + splitIntoLines(data.byte(kMapxsize) - 1, y); } while (true); - - rain->x = 0xff; } void DreamBase::intro1Text() { diff --git a/engines/dreamweb/structs.h b/engines/dreamweb/structs.h index 61400455d1..558b000f19 100644 --- a/engines/dreamweb/structs.h +++ b/engines/dreamweb/structs.h @@ -213,10 +213,7 @@ struct Rain { uint8 x; uint8 y; uint8 size; - uint8 w3_lo; - uint8 w3_hi; - uint16 w3() const { return READ_LE_UINT16(&w3_lo); } - void setW3(uint16 v) { WRITE_LE_UINT16(&w3_lo, v); } + uint16 w3; uint8 b5; }; -- cgit v1.2.3 From 10774daa586008af8e327a58a3ee910482a7cbfb Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Fri, 23 Dec 2011 22:56:39 +0100 Subject: DREAMWEB: Move backgrounds, zoom space, initial vars out of buffers --- engines/dreamweb/dreambase.h | 16 +++++++++++++++- engines/dreamweb/keypad.cpp | 4 ++-- engines/dreamweb/monitor.cpp | 4 ++-- engines/dreamweb/stubs.cpp | 45 ++++++++++++++++++++------------------------ 4 files changed, 39 insertions(+), 30 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 3428a8cef8..26f0395732 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -35,8 +35,17 @@ namespace DreamWeb { namespace DreamGen { - + // Note: duplication from dreamgen.h const unsigned int kNumReelRoutines = 57; +const unsigned int kUnderTextSizeX = 180; +const unsigned int kUnderTextSizeY = 10; +const unsigned int kUnderTimedTextSizeY = 24; +const unsigned int kUnderTextSizeX_f = 228; // foreign version +const unsigned int kUnderTextSizeY_f = 13; // foreign version +const unsigned int kUnderTimedTextSizeY_f = 30; +const unsigned int kUnderTextBufSize = kUnderTextSizeX_f * kUnderTextSizeY_f; +const unsigned int kUnderTimedTextBufSize = 256 * kUnderTextSizeY_f; +const unsigned int kLengthOfVars = 68; /** * This class is one of the parent classes of DreamGenContext. Its sole purpose @@ -69,6 +78,8 @@ protected: ReelRoutine *_personData; // from Buffers + uint8 _textUnder[kUnderTextBufSize]; + uint8 _pointerBack[32*32]; uint8 _mapFlags[11*10*3]; uint8 _startPal[3*256]; uint8 _endPal[3*256]; @@ -77,7 +88,10 @@ protected: Common::List _freeList; Common::List _exList; Common::List _peopleList; + uint8 _zoomSpace[46*40]; + uint8 _underTimedText[kUnderTimedTextBufSize]; Common::List _rainList; + uint8 _initialVars[kLengthOfVars]; // TODO: This shouldn't be necessary public: DreamBase(DreamWeb::DreamWebEngine *en); diff --git a/engines/dreamweb/keypad.cpp b/engines/dreamweb/keypad.cpp index 6e6941918f..d0ef260e90 100644 --- a/engines/dreamweb/keypad.cpp +++ b/engines/dreamweb/keypad.cpp @@ -25,11 +25,11 @@ namespace DreamGen { void DreamBase::getUnderMenu() { - multiGet(getSegment(data.word(kBuffers)).ptr(kUndertimedtext, 0), kMenux, kMenuy, 48, 48); + multiGet(_underTimedText, kMenux, kMenuy, 48, 48); } void DreamBase::putUnderMenu() { - multiPut(getSegment(data.word(kBuffers)).ptr(kUndertimedtext, 0), kMenux, kMenuy, 48, 48); + multiPut(_underTimedText, kMenux, kMenuy, 48, 48); } void DreamBase::singleKey(uint8 key, uint16 x, uint16 y) { diff --git a/engines/dreamweb/monitor.cpp b/engines/dreamweb/monitor.cpp index 665265052a..9a1076a92f 100644 --- a/engines/dreamweb/monitor.cpp +++ b/engines/dreamweb/monitor.cpp @@ -267,7 +267,7 @@ void DreamBase::printCurs() { height = 11; } else height = 8; - multiGet(textUnder(), x, y, 6, height); + multiGet(_textUnder, x, y, 6, height); ++data.word(kMaintimer); if ((data.word(kMaintimer) & 16) == 0) showFrame(engine->tempCharset(), x, y, '/' - 32, 0); @@ -284,7 +284,7 @@ void DreamBase::delCurs() { height = 11; } else height = 8; - multiPut(textUnder(), x, y, width, height); + multiPut(_textUnder, x, y, width, height); multiDump(x, y, width, height); } diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 3e7a694c91..388244676d 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -740,10 +740,6 @@ void DreamBase::switchRyanOff() { data.byte(kRyanon) = 1; } -uint8 *DreamBase::textUnder() { - return getSegment(data.word(kBuffers)).ptr(kTextunder, 0); -} - uint16 DreamBase::standardLoad(const char *fileName, uint16 *outSizeInBytes) { FileHeader header; @@ -833,17 +829,17 @@ void DreamBase::dumpTextLine() { } void DreamBase::getUnderTimed() { - uint16 y = data.byte(kTimedy); if (data.byte(kForeignrelease)) - y -= 3; - multiGet(getSegment(data.word(kBuffers)).ptr(kUndertimedtext, 0), data.byte(kTimedx), y, 240, kUndertimedysize); + multiGet(_underTimedText, data.byte(kTimedx), data.byte(kTimedy) - 3, 240, kUnderTimedTextSizeY_f); + else + multiGet(_underTimedText, data.byte(kTimedx), data.byte(kTimedy), 240, kUnderTimedTextSizeY); } void DreamBase::putUnderTimed() { - uint16 y = data.byte(kTimedy); if (data.byte(kForeignrelease)) - y -= 3; - multiPut(getSegment(data.word(kBuffers)).ptr(kUndertimedtext, 0), data.byte(kTimedx), y, 240, kUndertimedysize); + multiPut(_underTimedText, data.byte(kTimedx), data.byte(kTimedy) - 3, 240, kUnderTimedTextSizeY_f); + else + multiPut(_underTimedText, data.byte(kTimedx), data.byte(kTimedy), 240, kUnderTimedTextSizeY); } void DreamGenContext::triggerMessage(uint16 index) { @@ -1131,11 +1127,10 @@ void DreamBase::crosshair() { } void DreamBase::delTextLine() { - uint16 x = data.word(kTextaddressx); - uint16 y = data.word(kTextaddressy); - if (data.byte(kForeignrelease) != 0) - y -= 3; - multiPut(textUnder(), x, y, kUndertextsizex, kUndertextsizey); + if (data.byte(kForeignrelease)) + multiPut(_textUnder, data.byte(kTextaddressx), data.word(kTextaddressy) - 3, kUnderTextSizeX_f, kUnderTextSizeY_f); + else + multiPut(_textUnder, data.byte(kTextaddressx), data.word(kTextaddressy), kUnderTextSizeX, kUnderTextSizeY); } void DreamGenContext::commandOnly() { @@ -1514,7 +1509,7 @@ void DreamBase::delPointer() { data.word(kDelherey) = data.word(kOldpointery); data.byte(kDelxs) = data.byte(kPointerxs); data.byte(kDelys) = data.byte(kPointerys); - multiPut(getSegment(data.word(kBuffers)).ptr(kPointerback, 0), data.word(kDelherex), data.word(kDelherey), data.byte(kPointerxs), data.byte(kPointerys)); + multiPut(_pointerBack, data.word(kDelherex), data.word(kDelherey), data.byte(kPointerxs), data.byte(kPointerys)); } void DreamBase::showBlink() { @@ -1594,7 +1589,7 @@ void DreamBase::showPointer() { uint16 yMin = (y >= height / 2) ? y - height / 2 : 0; data.word(kOldpointerx) = xMin; data.word(kOldpointery) = yMin; - multiGet(getSegment(data.word(kBuffers)).ptr(kPointerback, 0), xMin, yMin, width, height); + multiGet(_pointerBack, xMin, yMin, width, height); showFrame(frames, x, y, 3 * data.byte(kItemframe) + 1, 128); showFrame(engine->icons1(), x, y, 3, 128); } else { @@ -1607,7 +1602,7 @@ void DreamBase::showPointer() { height = 12; data.byte(kPointerxs) = width; data.byte(kPointerys) = height; - multiGet(getSegment(data.word(kBuffers)).ptr(kPointerback, 0), x, y, width, height); + multiGet(_pointerBack, x, y, width, height); showFrame(engine->icons1(), x, y, data.byte(kPointerframe) + 20, 0); } } @@ -3059,18 +3054,18 @@ void DreamBase::showDiary() { } void DreamBase::underTextLine() { - uint16 y = data.word(kTextaddressy); if (data.byte(kForeignrelease)) - y -= 3; - multiGet(textUnder(), data.byte(kTextaddressx), y, kUndertextsizex, kUndertextsizey); + multiGet(_textUnder, data.byte(kTextaddressx), data.word(kTextaddressy) - 3, kUnderTextSizeX_f, kUnderTextSizeY_f); + else + multiGet(_textUnder, data.byte(kTextaddressx), data.word(kTextaddressy), kUnderTextSizeX, kUnderTextSizeY); } void DreamBase::getUnderZoom() { - multiGet(getSegment(data.word(kBuffers)).ptr(kZoomspace, 0), kZoomx + 5, kZoomy + 4, 46, 40); + multiGet(_zoomSpace, kZoomx + 5, kZoomy + 4, 46, 40); } void DreamBase::putUnderZoom() { - multiPut(getSegment(data.word(kBuffers)).ptr(kZoomspace, 0), kZoomx + 5, kZoomy + 4, 46, 40); + multiPut(_zoomSpace, kZoomx + 5, kZoomy + 4, 46, 40); } void DreamBase::showWatchReel() { @@ -3697,7 +3692,7 @@ void DreamBase::clearBuffers() { memset(getSegment(data.word(kExtras)).ptr(0, kLengthofextra), 0xFF, kLengthofextra); - memcpy(getSegment(data.word(kBuffers)).ptr(kInitialvars, kLengthofvars), data.ptr(kStartvars, kLengthofvars), kLengthofvars); + memcpy(_initialVars, data.ptr(kStartvars, kLengthofvars), kLengthofvars); clearChanges(); } @@ -3707,7 +3702,7 @@ void DreamBase::clearChanges() { setupInitialReelRoutines(); - memcpy(data.ptr(kStartvars, kLengthofvars), getSegment(data.word(kBuffers)).ptr(kInitialvars, kLengthofvars), kLengthofvars); + memcpy(data.ptr(kStartvars, kLengthofvars), _initialVars, kLengthofvars); data.byte(kExpos) = 0; data.word(kExframepos) = 0; -- cgit v1.2.3 From bbdbffc10744e4d9e789150ba151c1884c740ae0 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Fri, 23 Dec 2011 22:58:31 +0100 Subject: DREAMWEB: Move changes out of buffers --- engines/dreamweb/dreambase.h | 6 ++++++ engines/dreamweb/saveload.cpp | 4 ++-- engines/dreamweb/stubs.cpp | 6 +++--- 3 files changed, 11 insertions(+), 5 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 26f0395732..1601cb44b5 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -46,6 +46,7 @@ const unsigned int kUnderTimedTextSizeY_f = 30; const unsigned int kUnderTextBufSize = kUnderTextSizeX_f * kUnderTextSizeY_f; const unsigned int kUnderTimedTextBufSize = 256 * kUnderTextSizeY_f; const unsigned int kLengthOfVars = 68; +const unsigned int kNumChanges = 250; /** * This class is one of the parent classes of DreamGenContext. Its sole purpose @@ -79,16 +80,21 @@ protected: // from Buffers uint8 _textUnder[kUnderTextBufSize]; + // _openInvList (see fillOpen/findOpenPos) + // _ryanInvList (see findInvPos/findInvPosCPP) uint8 _pointerBack[32*32]; uint8 _mapFlags[11*10*3]; uint8 _startPal[3*256]; uint8 _endPal[3*256]; uint8 _mainPal[3*256]; + // _spriteTable Common::List _setList; Common::List _freeList; Common::List _exList; Common::List _peopleList; uint8 _zoomSpace[46*40]; + // _printedList (unused?) + Change _listOfChanges[kNumChanges]; // Note: this array is saved uint8 _underTimedText[kUnderTimedTextBufSize]; Common::List _rainList; uint8 _initialVars[kLengthOfVars]; // TODO: This shouldn't be necessary diff --git a/engines/dreamweb/saveload.cpp b/engines/dreamweb/saveload.cpp index b12c668d82..53c2f55d38 100644 --- a/engines/dreamweb/saveload.cpp +++ b/engines/dreamweb/saveload.cpp @@ -479,7 +479,7 @@ void DreamBase::savePosition(unsigned int slot, const char *descbuf) { 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]); - outSaveFile->write(getSegment(data.word(kBuffers)).ptr(kListofchanges, len[3]), len[3]); + outSaveFile->write(_listOfChanges, len[3]); // len[4] == 48, which is sizeof(Room) plus 16 for 'Roomscango' outSaveFile->write((const uint8 *)&madeUpRoom, sizeof(Room)); @@ -545,7 +545,7 @@ void DreamBase::loadPosition(unsigned int slot) { } inSaveFile->read(data.ptr(kStartvars, len[1]), len[1]); inSaveFile->read(getSegment(data.word(kExtras)).ptr(kExframedata, len[2]), len[2]); - inSaveFile->read(getSegment(data.word(kBuffers)).ptr(kListofchanges, len[3]), len[3]); + inSaveFile->read(_listOfChanges, len[3]); // len[4] == 48, which is sizeof(Room) plus 16 for 'Roomscango' // Note: the values read into g_madeUpRoomDat are only used in actualLoad, diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 388244676d..dd1a03411f 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -1284,7 +1284,7 @@ void DreamBase::walkToText() { } void DreamBase::findOrMake(uint8 index, uint8 value, uint8 type) { - Change *change = (Change *)getSegment(data.word(kBuffers)).ptr(kListofchanges, sizeof(Change)); + Change *change = _listOfChanges; for (; change->index != 0xff; ++change) { if (index == change->index && data.byte(kReallocation) == change->location && type == change->type) { change->value = value; @@ -1299,7 +1299,7 @@ void DreamBase::findOrMake(uint8 index, uint8 value, uint8 type) { } void DreamBase::setAllChanges() { - Change *change = (Change *)getSegment(data.word(kBuffers)).ptr(kListofchanges, sizeof(Change)); + Change *change = _listOfChanges; for (; change->index != 0xff; ++change) if (change->location == data.byte(kReallocation)) doChange(change->index, change->value, change->type); @@ -3698,7 +3698,7 @@ void DreamBase::clearBuffers() { } void DreamBase::clearChanges() { - memset(getSegment(data.word(kBuffers)).ptr(kListofchanges, 4*kNumchanges), 0xFF, 4*kNumchanges); + memset(_listOfChanges, 0xFF, 4*kNumchanges); setupInitialReelRoutines(); -- cgit v1.2.3 From 8e79608a1de77c54cc6bf0eb23b32b1cc3175677 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Fri, 23 Dec 2011 22:58:54 +0100 Subject: DREAMWEB: Move sprite table out of buffers --- engines/dreamweb/backdrop.cpp | 2 +- engines/dreamweb/dreambase.h | 3 +- engines/dreamweb/sprite.cpp | 67 +++++++++++++++++++++---------------------- engines/dreamweb/structs.h | 6 ---- engines/dreamweb/stubs.cpp | 17 +++++++---- 5 files changed, 45 insertions(+), 50 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/backdrop.cpp b/engines/dreamweb/backdrop.cpp index b806ba43a0..875e16805e 100644 --- a/engines/dreamweb/backdrop.cpp +++ b/engines/dreamweb/backdrop.cpp @@ -121,7 +121,7 @@ void DreamBase::makeBackOb(SetObject *objData, uint16 x, uint16 y) { uint16 objDataOffset = (uint8 *)objData - getSegment(data.word(kSetdat)).ptr(0, 0); assert(objDataOffset % sizeof(SetObject) == 0); assert(objDataOffset < 128 * sizeof(SetObject)); - sprite->setObjData(objDataOffset); + sprite->_objData = objDataOffset; if (priority == 255) priority = 0; sprite->priority = priority; diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 1601cb44b5..32b36a56da 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -87,7 +87,7 @@ protected: uint8 _startPal[3*256]; uint8 _endPal[3*256]; uint8 _mainPal[3*256]; - // _spriteTable + Common::List _spriteTable; Common::List _setList; Common::List _freeList; Common::List _exList; @@ -311,7 +311,6 @@ public: void playChannel1(uint8 index); // from sprite.cpp - Sprite *spriteTable(); void printSprites(); void printASprite(const Sprite *sprite); void clearSprites(); diff --git a/engines/dreamweb/sprite.cpp b/engines/dreamweb/sprite.cpp index 754f91401b..e2e27bc417 100644 --- a/engines/dreamweb/sprite.cpp +++ b/engines/dreamweb/sprite.cpp @@ -24,18 +24,12 @@ namespace DreamGen { -Sprite *DreamBase::spriteTable() { - Sprite *sprite = (Sprite *)getSegment(data.word(kBuffers)).ptr(kSpritetable, 16 * sizeof(Sprite)); - return sprite; -} - void DreamBase::printSprites() { for (size_t priority = 0; priority < 7; ++priority) { - Sprite *sprites = spriteTable(); - for (size_t j = 0; j < 16; ++j) { - const Sprite &sprite = sprites[j]; - if (sprite.updateCallback() == 0x0ffff) - continue; + Common::List::const_iterator i; + for (i = _spriteTable.begin(); i != _spriteTable.end(); ++i) { + const Sprite &sprite = *i; + assert(sprite._updateCallback != 0x0ffff); if (priority != sprite.priority) continue; if (sprite.hidden == 1) @@ -64,24 +58,27 @@ void DreamBase::printASprite(const Sprite *sprite) { c = 8; else c = 0; - showFrame((const Frame *)getSegment(sprite->frameData()).ptr(0, 0), x, y, sprite->frameNumber, c); + showFrame((const Frame *)getSegment(sprite->_frameData).ptr(0, 0), x, y, sprite->frameNumber, c); } void DreamBase::clearSprites() { - memset(spriteTable(), 0xff, sizeof(Sprite) * 16); + _spriteTable.clear(); } Sprite *DreamBase::makeSprite(uint8 x, uint8 y, uint16 updateCallback, uint16 frameData, uint16 somethingInDi) { - Sprite *sprite = spriteTable(); - while (sprite->frameNumber != 0xff) { // NB: No boundchecking in the original code either - ++sprite; - } + // Note: the original didn't append sprites here, but filled up the + // first unused entry. This can change the order of entries, but since they + // are drawn based on the priority field, this shouldn't matter. + _spriteTable.push_back(Sprite()); + Sprite *sprite = &_spriteTable.back(); + + memset(sprite, 0xff, sizeof(Sprite)); - sprite->setUpdateCallback(updateCallback); + sprite->_updateCallback = updateCallback; sprite->x = x; sprite->y = y; - sprite->setFrameData(frameData); - WRITE_LE_UINT16(&sprite->w8, somethingInDi); + sprite->_frameData = frameData; + sprite->w8 = somethingInDi; sprite->w2 = 0xffff; sprite->frameNumber = 0; sprite->delay = 0; @@ -89,25 +86,25 @@ Sprite *DreamBase::makeSprite(uint8 x, uint8 y, uint16 updateCallback, uint16 fr } void DreamBase::spriteUpdate() { - Sprite *sprites = spriteTable(); - sprites[0].hidden = data.byte(kRyanon); - - Sprite *sprite = sprites; - for (size_t i=0; i < 16; ++i) { - uint16 updateCallback = sprite->updateCallback(); - if (updateCallback != 0xffff) { - sprite->w24 = sprite->w2; - if (updateCallback == addr_mainman) // NB : Let's consider the callback as an enum while more code is not ported to C++ - mainMan(sprite); - else { - assert(updateCallback == addr_backobject); - backObject(sprite); - } + // During the intro the sprite table can be empty + if (!_spriteTable.empty()) + _spriteTable.front().hidden = data.byte(kRyanon); + + Common::List::iterator i; + for (i = _spriteTable.begin(); i != _spriteTable.end(); ++i) { + Sprite &sprite = *i; + assert(sprite._updateCallback != 0xffff); + + sprite.w24 = sprite.w2; + if (sprite._updateCallback == addr_mainman) // NB : Let's consider the callback as an enum while more code is not ported to C++ + mainMan(&sprite); + else { + assert(sprite._updateCallback == addr_backobject); + backObject(&sprite); } if (data.byte(kNowinnewroom) == 1) break; - ++sprite; } } @@ -228,7 +225,7 @@ void DreamBase::aboutTurn(Sprite *sprite) { } void DreamBase::backObject(Sprite *sprite) { - SetObject *objData = (SetObject *)getSegment(data.word(kSetdat)).ptr(sprite->objData(), 0); + SetObject *objData = (SetObject *)getSegment(data.word(kSetdat)).ptr(sprite->_objData, 0); if (sprite->delay != 0) { --sprite->delay; diff --git a/engines/dreamweb/structs.h b/engines/dreamweb/structs.h index 558b000f19..4d1b1420f9 100644 --- a/engines/dreamweb/structs.h +++ b/engines/dreamweb/structs.h @@ -30,13 +30,9 @@ namespace DreamGen { struct Sprite { uint16 _updateCallback; - uint16 updateCallback() const { return READ_LE_UINT16(&_updateCallback); } - void setUpdateCallback(uint16 v) { WRITE_LE_UINT16(&_updateCallback, v); } uint16 w2; uint16 w4; uint16 _frameData; - uint16 frameData() const { return READ_LE_UINT16(&_frameData); } - void setFrameData(uint16 v) { WRITE_LE_UINT16(&_frameData, v); } uint16 w8; uint8 x; uint8 y; @@ -48,8 +44,6 @@ struct Sprite { uint8 delay; uint8 animFrame; // index into SetObject::frames uint16 _objData; - uint16 objData() const { return READ_LE_UINT16(&_objData); } - void setObjData(uint16 v) { WRITE_LE_UINT16(&_objData, v); } uint8 speed; uint8 priority; uint16 w24; diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index dd1a03411f..b302bce18b 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -981,12 +981,17 @@ void DreamBase::eraseOldObs() { if (data.byte(kNewobs) == 0) return; - Sprite *sprites = spriteTable(); - for (size_t i = 0; i < 16; ++i) { - Sprite &sprite = sprites[i]; - if (sprite.objData() != 0xffff) { - memset(&sprite, 0xff, sizeof(Sprite)); - } + // Note: the original didn't delete sprites here, but marked the + // entries as unused, to be filled again by makeSprite. This can + // change the order of entries, but since they are drawn based on the + // priority field, this shouldn't matter. + Common::List::iterator i; + for (i = _spriteTable.begin(); i != _spriteTable.end(); ) { + Sprite &sprite = *i; + if (sprite._objData != 0xffff) + i = _spriteTable.erase(i); + else + ++i; } } -- cgit v1.2.3 From c3fad04dea55afe9412c7518c71fea22a0b9819b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 23 Dec 2011 23:58:06 +0100 Subject: TSAGE: R2R - Implement scene 3260 --- engines/tsage/ringworld2/ringworld2_logic.cpp | 2 + engines/tsage/ringworld2/ringworld2_scenes3.cpp | 177 ++++++++++++++++++++++++ engines/tsage/ringworld2/ringworld2_scenes3.h | 48 +++++++ 3 files changed, 227 insertions(+) (limited to 'engines') diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index 6f26054423..dbde0ee27a 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -207,6 +207,8 @@ Scene *Ringworld2Game::createScene(int sceneNumber) { return new Scene3250(); case 3255: case 3260: + // Computer room + return new Scene3260(); case 3275: case 3350: case 3375: diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp index 298093be3a..8b8d8c479c 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp @@ -1256,5 +1256,182 @@ void Scene3250::dispatch() { Scene::dispatch(); } +/*-------------------------------------------------------------------------- + * Scene 3260 - Computer room + * + *--------------------------------------------------------------------------*/ +bool Scene3260::Actor13::startAction(CursorType action, Event &event) { + Scene3260 *scene = (Scene3260 *)R2_GLOBALS._sceneManager._scene; + + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 3271; + scene->setAction(&scene->_sequenceManager, scene, 3271, &R2_GLOBALS._player, &scene->_actor13, NULL); + return true; +} + +bool Scene3260::Actor14::startAction(CursorType action, Event &event) { + Scene3260 *scene = (Scene3260 *)R2_GLOBALS._sceneManager._scene; + + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 3272; + scene->setAction(&scene->_sequenceManager, scene, 3272, &R2_GLOBALS._player, &scene->_actor14, NULL); + return true; +} + +void Scene3260::Action1::signal() { + SceneObjectExt *fmtObj = (SceneObjectExt *) _endHandler; + + fmtObj->setFrame(R2_GLOBALS._randomSource.getRandomNumber(6)); + setDelay(120 + R2_GLOBALS._randomSource.getRandomNumber(179)); +} + +void Scene3260::postInit(SceneObjectList *OwnerList) { + loadScene(3260); + R2_GLOBALS._player._characterIndex = R2_MIRANDA; + SceneExt::postInit(); + R2_GLOBALS._sound1.play(285); + + _actor13.postInit(); + _actor13.setup(3260, 6, 1); + _actor13.setPosition(Common::Point(40, 106)); + _actor13.setDetails(3260, 18, 1, -1, 1, NULL); + + if (R2_INVENTORY.getObjectScene(52) == 3260) { + _actor14.postInit(); + _actor14.setup(3260, 7, 1); + _actor14.setPosition(Common::Point(202, 66)); + _actor14.setDetails(3260, 12, 1, -1, 1, NULL); + } + + _actor1.postInit(); + _actor1.setup(3260, 1, 1); + _actor1.setPosition(Common::Point(93, 73)); + _actor1.setDetails(3260, 3, 1, 5, 1, NULL); + _actor1.setAction(&_action1, &_actor1); + + _actor2.postInit(); + _actor2.setup(3260, 2, 1); + _actor2.setPosition(Common::Point(142, 63)); + _actor2.setDetails(3260, 3, 1, 5, 1, NULL); + _actor2.setAction(&_action2, &_actor2); + + _actor3.postInit(); + _actor3.setup(3260, 2, 1); + _actor3.setPosition(Common::Point(166, 54)); + _actor3.setDetails(3260, 3, 1, 5, 1, NULL); + _actor3.setAction(&_action3, &_actor3); + + _actor4.postInit(); + _actor4.setup(3260, 2, 1); + _actor4.setPosition(Common::Point(190, 46)); + _actor4.setDetails(3260, 3, 1, 5, 1, NULL); + _actor4.setAction(&_action4, &_actor4); + + _actor5.postInit(); + _actor5.setup(3260, 2, 1); + _actor5.setPosition(Common::Point(142, 39)); + _actor5.setDetails(3260, 3, 1, 5, 1, NULL); + _actor5.setAction(&_action5, &_actor5); + + _actor6.postInit(); + _actor6.setup(3260, 2, 1); + _actor6.setPosition(Common::Point(166, 30)); + _actor6.setDetails(3260, 3, 1, 5, 1, NULL); + _actor6.setAction(&_action6, &_actor6); + + _actor7.postInit(); + _actor7.setup(3260, 2, 1); + _actor7.setPosition(Common::Point(190, 22)); + _actor7.setDetails(3260, 3, 1, 5, 1, NULL); + _actor7.setAction(&_action7, &_actor7); + + _actor8.postInit(); + _actor8.setup(3260, 2, 1); + _actor8.setPosition(Common::Point(142, 14)); + _actor8.setDetails(3260, 3, 1, 5, 1, NULL); + _actor8.setAction(&_action8, &_actor8); + + _actor9.postInit(); + _actor9.setup(3260, 2, 1); + _actor9.setPosition(Common::Point(166, 6)); + _actor9.setDetails(3260, 3, 1, 5, 1, NULL); + _actor9.setAction(&_action9, &_actor9); + + _actor10.postInit(); + _actor10.setup(3260, 3, 1); + _actor10.setPosition(Common::Point(265, 163)); + _actor10.fixPriority(180); + _actor10._numFrames = 10; + _actor10.setDetails(3260, 6, 1, 8, 1, NULL); + _actor10.animate(ANIM_MODE_2, NULL); + + _actor11.postInit(); + _actor11.setup(3260, 4, 1); + _actor11.setPosition(Common::Point(127, 108)); + _actor11.fixPriority(120); + _actor11.setAction(&_action11, &_actor11); + _actor11._numFrames = 15; + _actor11.setDetails(3260, 6, 1, 8, 1, NULL); + _actor11.animate(ANIM_MODE_2, NULL); + + _actor12.postInit(); + _actor12.setup(3260, 5, 1); + _actor12.setPosition(Common::Point(274, 65)); + _actor12.setAction(&_action12, &_actor12); + _actor12._numFrames = 5; + _actor12.setDetails(3260, 9, 1, 11, 1, NULL); + _actor12.animate(ANIM_MODE_2, NULL); + + _item1.setDetails(Rect(0, 0, 320, 200), 3260, 0, 1, 2, 1, NULL); + R2_GLOBALS._player.postInit(); + + if (R2_GLOBALS._player._oldCharacterScene[3] == 3275) { + _sceneMode = 3270; + setAction(&_sequenceManager, this, 3270, &R2_GLOBALS._player, &_actor13, NULL); + } else { + R2_GLOBALS._player.setup(30, 5, 1); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player.setPosition(Common::Point(53, 113)); + R2_GLOBALS._player._moveDiff = Common::Point(3, 2); + R2_GLOBALS._player.enableControl(); + } + R2_GLOBALS._player._oldCharacterScene[3] = 3260; +} + +void Scene3260::remove() { + R2_GLOBALS._sound1.fadeOut2(NULL); + SceneExt::remove(); +} + +void Scene3260::signal() { + switch (_sceneMode) { + case 3271: + R2_GLOBALS._sceneManager.changeScene(3275); + break; + case 3272: + _sceneMode = 3273; + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + SceneItem::display(3260, 15, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999); + R2_GLOBALS._player.disableControl(); + R2_INVENTORY.setObjectScene(52, 3); + R2_INVENTORY.setObjectScene(43, 3); + setAction(&_sequenceManager, this, 3273, &R2_GLOBALS._player, &_actor14, NULL); + break; + case 3273: + _actor4.remove(); + R2_GLOBALS._player.enableControl(); + break; + default: + R2_GLOBALS._player.enableControl(); + break; + } +} + } // 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 b83f83b1c2..2a4899c205 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.h +++ b/engines/tsage/ringworld2/ringworld2_scenes3.h @@ -291,6 +291,54 @@ public: virtual void dispatch(); }; +class Scene3260 : public SceneExt { + class Actor13 : public SceneActor { + virtual bool startAction(CursorType action, Event &event); + }; + class Actor14 : public SceneActor { + virtual bool startAction(CursorType action, Event &event); + }; + + class Action1: public Action { + public: + void signal(); + }; +public: + + NamedHotspot _item1; + SceneActor _actor1; + SceneActor _actor2; + SceneActor _actor3; + SceneActor _actor4; + SceneActor _actor5; + SceneActor _actor6; + SceneActor _actor7; + SceneActor _actor8; + SceneActor _actor9; + SceneActor _actor10; + SceneActor _actor11; + SceneActor _actor12; + Actor13 _actor13; + Actor14 _actor14; + Action1 _action1; + Action1 _action2; + Action1 _action3; + Action1 _action4; + Action1 _action5; + Action1 _action6; + Action1 _action7; + Action1 _action8; + Action1 _action9; + Action1 _action10; + Action1 _action11; + Action1 _action12; + SequenceManager _sequenceManager; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void remove(); + virtual void signal(); +}; + } // End of namespace Ringworld2 } // End of namespace TsAGE -- cgit v1.2.3 From 1cb1df369953b6bc9cfac555cc165cb972c96f8f Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 24 Dec 2011 01:00:57 +0200 Subject: DREAMWEB: Port 'incryanpage' to C++ --- engines/dreamweb/dreamgen.cpp | 34 ---------------------------------- engines/dreamweb/dreamgen.h | 1 - engines/dreamweb/stubs.cpp | 19 +++++++++++++++++++ engines/dreamweb/stubs.h | 1 + 4 files changed, 20 insertions(+), 35 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 265b215af6..17f862c411 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -284,40 +284,6 @@ findopen2a: goto findopen1a; } -void DreamGenContext::incRyanPage() { - STACK_CHECK; - _cmp(data.byte(kCommandtype), 222); - if (flags.z()) - goto alreadyincryan; - data.byte(kCommandtype) = 222; - al = 31; - commandOnly(); -alreadyincryan: - ax = data.word(kMousebutton); - _cmp(ax, data.word(kOldbutton)); - if (flags.z()) - return /* (noincryan) */; - _and(ax, 1); - if (!flags.z()) - goto doincryan; - return; -doincryan: - ax = data.word(kMousex); - _sub(ax, (80)+167); - data.byte(kRyanpage) = -1; -findnewpage: - _inc(data.byte(kRyanpage)); - _sub(ax, 18); - if (!flags.c()) - goto findnewpage; - delPointer(); - fillRyan(); - readMouse(); - showPointer(); - workToScreen(); - delPointer(); -} - void DreamGenContext::getObTextStart() { STACK_CHECK; es = data.word(kFreedesc); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index f836b58577..b620b2179d 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -486,7 +486,6 @@ public: void read(); void searchForString(); void selectOpenOb(); - void incRyanPage(); void searchForFiles(); void getExAd(); void swapWithInv(); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index b302bce18b..9efb49b873 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -3769,4 +3769,23 @@ void DreamGenContext::edensFlatReminders() { data.byte(kProgresspoints)++; // got card } +void DreamGenContext::incRyanPage() { + if (data.byte(kCommandtype) != 222) { + data.byte(kCommandtype) = 222; + commandOnly(31); + } + + if (data.word(kMousebutton) == data.word(kOldbutton) || (data.word(kMousebutton) & 1)) + return; + + data.byte(kRyanpage) = (data.word(kMousex) - (kInventx + 167)) / 18; + + delPointer(); + fillRyan(); + readMouse(); + showPointer(); + workToScreenCPP(); + delPointer(); + +} } // End of namespace DreamGen diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index a58bb259be..83b4ebfcae 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -338,5 +338,6 @@ void inToInv(); void outOfInv(); void edensFlatReminders(); + void incRyanPage(); #endif -- cgit v1.2.3 From 99a5db20494eff00d6d149c08b75ba83d9a7af20 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 24 Dec 2011 01:09:17 +0200 Subject: DREAMWEB: Fix typo in incRyanPage() --- engines/dreamweb/stubs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 9efb49b873..0b2ed7a7c5 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -3775,7 +3775,7 @@ void DreamGenContext::incRyanPage() { commandOnly(31); } - if (data.word(kMousebutton) == data.word(kOldbutton) || (data.word(kMousebutton) & 1)) + if (data.word(kMousebutton) == data.word(kOldbutton) || !(data.word(kMousebutton) & 1)) return; data.byte(kRyanpage) = (data.word(kMousex) - (kInventx + 167)) / 18; -- cgit v1.2.3 From 544e241d221a5d503e2acf574fbde66c8a4fa527 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 24 Dec 2011 01:15:28 +0100 Subject: TSAGE: R2R - Implement scene 3255 --- engines/tsage/ringworld2/ringworld2_logic.cpp | 1 + engines/tsage/ringworld2/ringworld2_scenes3.cpp | 105 +++++++++++++++++++++++ engines/tsage/ringworld2/ringworld2_scenes3.h | 18 ++++ engines/tsage/ringworld2/ringworld2_speakers.cpp | 68 +++++++++++++++ engines/tsage/ringworld2/ringworld2_speakers.h | 16 ++++ 5 files changed, 208 insertions(+) (limited to 'engines') diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index dbde0ee27a..5cb66a50f7 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -206,6 +206,7 @@ Scene *Ringworld2Game::createScene(int sceneNumber) { // Room with large stasis field negator return new Scene3250(); case 3255: + return new Scene3255(); case 3260: // Computer room return new Scene3260(); diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp index 8b8d8c479c..f7e7be02f2 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp @@ -1256,6 +1256,111 @@ void Scene3250::dispatch() { Scene::dispatch(); } +/*-------------------------------------------------------------------------- + * Scene 3255 - + * + *--------------------------------------------------------------------------*/ +void Scene3255::postInit(SceneObjectList *OwnerList) { + loadScene(3255); + SceneExt::postInit(); + + _stripManager.addSpeaker(&_quinnSpeaker); + _stripManager.addSpeaker(&_mirandaSpeaker); + + if (R2_GLOBALS._sceneManager._previousScene == -1) + R2_GLOBALS.setFlag(79); + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.disableControl(); + + if (R2_GLOBALS.getFlag(79)) { + R2_GLOBALS._sound1.play(267); + R2_GLOBALS._sound2.play(268); + _sceneMode = 3257; + _actor3.postInit(); + _actor4.postInit(); + _actor4._effect = 1; + setAction(&_sequenceManager, this, 3257, &R2_GLOBALS._player, &_actor4, &_actor3, NULL); + } else { + _actor1.postInit(); + _actor1.setup(303, 1, 1); + _actor1.setPosition(Common::Point(208, 128)); + _actor2.postInit(); + _actor2.setup(3107, 3, 1); + _actor2.setPosition(Common::Point(230, 127)); + _sceneMode = 3255; + setAction(&_sequenceManager, this, 3255, &R2_GLOBALS._player, NULL); + } + R2_GLOBALS._player._oldCharacterScene[3] = 3255; +} + +void Scene3255::signal() { + switch (_sceneMode) { + case 10: + _sceneMode = 3258; + _actor5.postInit(); + _actor6.postInit(); + _actor7.postInit(); + setAction(&_sequenceManager, this, 3258, &R2_GLOBALS._player, &_actor4, &_actor3, &_actor5, &_actor6, &_actor7, NULL); + break; + case 3256: + R2_GLOBALS._sceneManager.changeScene(3250); + break; + case 3257: + _sceneMode = 10; + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + _stripManager.start(607, this); + break; + case 3258: + R2_GLOBALS._sceneManager.changeScene(3100); + break; + default: + SceneItem::display(3255, 0, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + _sceneMode = 3256; + setAction(&_sequenceManager, this, 3256, &R2_GLOBALS._player, NULL); + } +} + +void Scene3255::dispatch() { + if (R2_GLOBALS.getFlag(79)) { + if (_actor5._position.y >= 95) { + if (_actor5._position.y <= 110) + _actor5._shade = 6 - (_actor5._position.y - 95) / 3; + else + _actor5._effect = 1; + } else { + _actor5._effect = 6; + _actor5._shade = 6; + } + + if (_actor6._position.y >= 95) { + if (_actor6._position.y <= 110) + _actor6._shade = 6 - (_actor6._position.y - 95) / 3; + else + _actor6._effect = 1; + } else { + _actor6._effect = 6; + _actor6._shade = 6; + } + + if (_actor7._position.y >= 95) { + if (_actor7._position.y <= 110) + _actor7._shade = 6 - (_actor7._position.y - 95) / 3; + else + _actor7._effect = 1; + } else { + _actor7._effect = 6; + _actor7._shade = 6; + } + } + + if ((R2_GLOBALS._player._position.x > 250) && (R2_GLOBALS._player._shade == 1)) { + R2_GLOBALS._player._effect = 6; + _actor4._effect = 6; + } + Scene::dispatch(); +} + /*-------------------------------------------------------------------------- * Scene 3260 - Computer room * diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.h b/engines/tsage/ringworld2/ringworld2_scenes3.h index 2a4899c205..22e5fea477 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.h +++ b/engines/tsage/ringworld2/ringworld2_scenes3.h @@ -291,6 +291,24 @@ public: virtual void dispatch(); }; +class Scene3255 : public SceneExt { +public: + SceneActor _actor1; + SceneActor _actor2; + SceneActor _actor3; + SceneActor _actor4; + SceneActor _actor5; + SceneActor _actor6; + SceneActor _actor7; + SpeakerQuinn3255 _quinnSpeaker; + SpeakerMiranda3255 _mirandaSpeaker; + SequenceManager _sequenceManager; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); + virtual void dispatch(); +}; + class Scene3260 : public SceneExt { class Actor13 : public SceneActor { virtual bool startAction(CursorType action, Event &event); diff --git a/engines/tsage/ringworld2/ringworld2_speakers.cpp b/engines/tsage/ringworld2/ringworld2_speakers.cpp index 619b1c291f..b63409e387 100644 --- a/engines/tsage/ringworld2/ringworld2_speakers.cpp +++ b/engines/tsage/ringworld2/ringworld2_speakers.cpp @@ -1534,5 +1534,73 @@ void SpeakerTomko3245::proc15() { } } +SpeakerQuinn3255::SpeakerQuinn3255() { + _speakerName = "QUINN"; + _color1 = 60; + _color2 = 0; + _fieldF6 = 0; + _textWidth = 300; + _hideObjects = false; + _object2 = NULL; + _displayMode = 1; + _numFrames = 0; +} + +void SpeakerQuinn3255::proc15() { + Scene3255 *scene = (Scene3255 *)R2_GLOBALS._sceneManager._scene; + + int v = _fieldF6; + + if (!_object2) { + _object2 = &scene->_actor4; + _object2->hide(); + _object1.postInit(); + _object1._effect = _object2->_effect; + _object1._shade = _object2->_shade; + _object1.setPosition(_object2->_position); + } + + if (v == 0) { + _object1.animate(ANIM_MODE_2, NULL); + } else { + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(3257, 3, 1); + _object1.animate(ANIM_MODE_5, this); + } +} + +SpeakerMiranda3255::SpeakerMiranda3255() { + _speakerName = "MIRANDA"; + _color1 = 154; + _color2 = 0; + _fieldF6 = 0; + _textWidth = 300; + _hideObjects = false; + _object2 = NULL; + _displayMode = 1; + _numFrames = 0; +} + +void SpeakerMiranda3255::proc15() { + int v = _fieldF6; + + if (!_object2) { + _object2 = &R2_GLOBALS._player; + _object2->hide(); + _object1.postInit(); + _object1._effect = _object2->_effect; + _object1._shade = _object2->_shade; + _object1.setPosition(_object2->_position); + } + + if (v == 0) { + _object1.animate(ANIM_MODE_2, NULL); + } else { + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(3257, 5, 1); + _object1.animate(ANIM_MODE_5, this); + } +} + } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_speakers.h b/engines/tsage/ringworld2/ringworld2_speakers.h index e6a1819eb3..dba402b64a 100644 --- a/engines/tsage/ringworld2/ringworld2_speakers.h +++ b/engines/tsage/ringworld2/ringworld2_speakers.h @@ -372,6 +372,22 @@ public: virtual Common::String getClassName() { return "SpeakerTomko3245"; } virtual void proc15(); }; + +class SpeakerQuinn3255 : public VisualSpeaker { +public: + SpeakerQuinn3255(); + + virtual Common::String getClassName() { return "SpeakerQuinn3255"; } + virtual void proc15(); +}; + +class SpeakerMiranda3255 : public VisualSpeaker { +public: + SpeakerMiranda3255(); + + virtual Common::String getClassName() { return "SpeakerMiranda3255"; } + virtual void proc15(); +}; } // End of namespace Ringworld2 } // End of namespace TsAGE -- cgit v1.2.3 From c91d67a6639b032398baa865c8403be9c5b590c7 Mon Sep 17 00:00:00 2001 From: Tobias Gunkel Date: Sat, 24 Dec 2011 01:27:10 +0100 Subject: SCUMM: Remove assert.h include from player_appleII --- engines/scumm/player_appleII.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'engines') diff --git a/engines/scumm/player_appleII.cpp b/engines/scumm/player_appleII.cpp index f250f686e6..f310e3e546 100644 --- a/engines/scumm/player_appleII.cpp +++ b/engines/scumm/player_appleII.cpp @@ -20,7 +20,6 @@ * */ -#include #include "engines/engine.h" #include "scumm/player_appleII.h" #include "scumm/scumm.h" -- cgit v1.2.3 From f07531bed36d22354a3724d53067ee22533cf049 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 24 Dec 2011 10:18:58 +0100 Subject: TSAGE: R2R - Implement scene 3275 --- engines/tsage/ringworld2/ringworld2_logic.cpp | 2 + engines/tsage/ringworld2/ringworld2_scenes3.cpp | 97 +++++++++++++++++++++++++ engines/tsage/ringworld2/ringworld2_scenes3.h | 24 ++++++ 3 files changed, 123 insertions(+) (limited to 'engines') diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index 5cb66a50f7..e591436fd8 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -211,6 +211,8 @@ Scene *Ringworld2Game::createScene(int sceneNumber) { // Computer room return new Scene3260(); case 3275: + // Hall + return new Scene3275(); case 3350: case 3375: case 3385: diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp index f7e7be02f2..1a219e773a 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp @@ -1538,5 +1538,102 @@ void Scene3260::signal() { } } +/*-------------------------------------------------------------------------- + * Scene 3275 - Hall + * + *--------------------------------------------------------------------------*/ +bool Scene3275::Actor2::startAction(CursorType action, Event &event) { + Scene3275 *scene = (Scene3275 *)R2_GLOBALS._sceneManager._scene; + + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 3275; + scene->setAction(&scene->_sequenceManager, scene, 3275, &R2_GLOBALS._player, &scene->_actor2, NULL); + return true; +} + +void Scene3275::Exit1::changeScene() { + Scene3275 *scene = (Scene3275 *)R2_GLOBALS._sceneManager._scene; + + scene->_sceneMode = 0; + g_globals->_events.setCursor(CURSOR_ARROW); + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 10; + Common::Point pt(418, 118); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); +} + +void Scene3275::postInit(SceneObjectList *OwnerList) { + loadScene(3275); + + if (R2_GLOBALS._sceneManager._previousScene == -1) + R2_GLOBALS._sceneManager._previousScene = 3260; + + if (R2_GLOBALS._sceneManager._previousScene == 3150) + g_globals->gfxManager()._bounds.moveTo(Common::Point(160, 0)); + else + g_globals->gfxManager()._bounds.moveTo(Common::Point(0, 0)); + + SceneExt::postInit(); + _exit1.setDetails(Rect(398, 60, 439, 118), SHADECURSOR_UP, 3150); + _exit1.setDest(Common::Point(418, 128)); + + _actor1.postInit(); + _actor1.setup(3275, 1, 7); + _actor1.setPosition(Common::Point(419, 119)); + + _actor2.postInit(); + _actor2.setup(3275, 2, 1); + _actor2.setPosition(Common::Point(56, 118)); + _actor2.setDetails(3275, 3, 4, -1, 1, NULL); + + _item2.setDetails(Rect(153, 58, 200, 120), 3275, 6, 7, 8, 1, NULL); + _item3.setDetails(Rect(275, 58, 331, 120), 3275, 6, 7, 8, 1, NULL); + _item4.setDetails(Rect(0, 66, 22, 127), 3275, 9, 10, 11, 1, NULL); + _item5.setDetails(Rect(457, 66, 480, 127), 3275, 9, 10, 11, 1, NULL); + _item1.setDetails(Rect(0, 0, 480, 200), 3275, 0, 1, 2, 1, NULL); + + R2_GLOBALS._scrollFollower = &R2_GLOBALS._player; + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.disableControl(); + if (R2_GLOBALS._player._oldCharacterScene[3] == 3150) { + _sceneMode = 11; + R2_GLOBALS._player.setup(30, 3, 1); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player.setPosition(Common::Point(418, 118)); + R2_GLOBALS._player._moveDiff = Common::Point(3, 2); + Common::Point pt(418, 128); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } else if (R2_GLOBALS._player._oldCharacterScene[3] == 3260) { + _sceneMode = 3276; + setAction(&_sequenceManager, this, 3276, &R2_GLOBALS._player, &_actor2, NULL); + } else { + R2_GLOBALS._player.setup(30, 3, 1); + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player.setPosition(Common::Point(245, 135)); + R2_GLOBALS._player._moveDiff = Common::Point(3, 2); + R2_GLOBALS._player.enableControl(); + } + R2_GLOBALS._player._oldCharacterScene[3] = 3275; +} + +void Scene3275::signal() { + switch (_sceneMode) { + case 10: + R2_GLOBALS._sceneManager.changeScene(3150); + break; + case 3275: + R2_GLOBALS._sceneManager.changeScene(3260); + break; + default: + R2_GLOBALS._player.enableControl(); + break; + } +} + } // 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 22e5fea477..c82515c8c0 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.h +++ b/engines/tsage/ringworld2/ringworld2_scenes3.h @@ -357,6 +357,30 @@ public: virtual void signal(); }; +class Scene3275 : public SceneExt { + class Actor2 : public SceneActor { + virtual bool startAction(CursorType action, Event &event); + }; + + class Exit1 : public SceneExit { + public: + virtual void changeScene(); + }; +public: + NamedHotspot _item1; + NamedHotspot _item2; + NamedHotspot _item3; + NamedHotspot _item4; + NamedHotspot _item5; + SceneActor _actor1; + Actor2 _actor2; + Exit1 _exit1; + SequenceManager _sequenceManager; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); +}; + } // End of namespace Ringworld2 } // End of namespace TsAGE -- cgit v1.2.3 From 64b7aee081af753366bdd2000e73f24b28b226e8 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sat, 24 Dec 2011 00:28:45 +0100 Subject: DREAMWEB: Minor cleanup --- engines/dreamweb/dreambase.h | 1 + engines/dreamweb/stubs.cpp | 4 ++-- engines/dreamweb/use.cpp | 5 +++-- 3 files changed, 6 insertions(+), 4 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 32b36a56da..e573443674 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -513,6 +513,7 @@ public: void startLoading(const Room &room); void startup(); void atmospheres(); + bool objectMatches(void *object, const char *id); // from use.cpp void placeFreeObject(uint8 index); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 0b2ed7a7c5..09c8b36e81 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -1681,8 +1681,8 @@ void DreamBase::printMessage2(uint16 x, uint16 y, uint8 index, uint8 maxWidth, b printDirect(string, x, y, maxWidth, centered); } -static bool objectMatches(void *object, const char *id) { - const char *objId = (const char *)(((const uint8 *)object) + 12); // whether it is a DynObject or a SetObject +bool DreamBase::objectMatches(void *object, const char *id) { + const char *objId = (const char *)object + 12; // whether it is a DynObject or a SetObject for (size_t i = 0; i < 4; ++i) { if (id[i] != objId[i] + 'A') return false; diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp index b642598589..aa7c2bddea 100644 --- a/engines/dreamweb/use.cpp +++ b/engines/dreamweb/use.cpp @@ -128,11 +128,12 @@ void DreamGenContext::useRoutine() { } getAnyAd(); - const uint8 *id = es.ptr(bx + 12, 4); + // CHECKME: Do the callbacks use es:bx ? + void *obj = es.ptr(bx, 15); for (size_t i = 0; i < sizeof(kUseList)/sizeof(UseListEntry); ++i) { const UseListEntry &entry = kUseList[i]; - if (('A' + id[0] == entry.id[0]) && ('A' + id[1] == entry.id[1]) && ('A' + id[2] == entry.id[2]) && ('A' + id[3] == entry.id[3])) { + if (objectMatches(obj, entry.id)) { (this->*entry.callback)(); return; } -- cgit v1.2.3 From 0133ca823e5948e7a144ae32d2bbcceda3fdc564 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sat, 24 Dec 2011 12:10:13 +0100 Subject: DREAMWEB: Fix wrong buffer size --- engines/dreamweb/dreambase.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index e573443674..7ba8a93c7c 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -44,7 +44,7 @@ const unsigned int kUnderTextSizeX_f = 228; // foreign version const unsigned int kUnderTextSizeY_f = 13; // foreign version const unsigned int kUnderTimedTextSizeY_f = 30; const unsigned int kUnderTextBufSize = kUnderTextSizeX_f * kUnderTextSizeY_f; -const unsigned int kUnderTimedTextBufSize = 256 * kUnderTextSizeY_f; +const unsigned int kUnderTimedTextBufSize = 256 * kUnderTimedTextSizeY_f; const unsigned int kLengthOfVars = 68; const unsigned int kNumChanges = 250; -- cgit v1.2.3 From b9839635eab502b640c29e23bdbb20240b2bf440 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sat, 24 Dec 2011 12:23:24 +0100 Subject: DREAMWEB: Convert getObTextStart --- engines/dreamweb/dreambase.h | 1 + engines/dreamweb/dreamgen.cpp | 47 ----------------------------- engines/dreamweb/dreamgen.h | 1 - engines/dreamweb/object.cpp | 69 +++++++++++++++++++++++++++++++++++++++++++ engines/dreamweb/stubs.cpp | 14 ++------- engines/dreamweb/use.cpp | 8 ++--- 6 files changed, 76 insertions(+), 64 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 7ba8a93c7c..4dc537c4e3 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -188,6 +188,7 @@ public: void deleteExFrame(uint8 frameNum); void deleteExText(uint8 textNum); void purgeALocation(uint8 index); + const uint8 *getObTextStart(); // from pathfind.cpp void turnPathOn(uint8 param); diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 17f862c411..bcb45f529f 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -284,53 +284,6 @@ findopen2a: goto findopen1a; } -void DreamGenContext::getObTextStart() { - STACK_CHECK; - es = data.word(kFreedesc); - si = (0); - cx = (0+(82*2)); - _cmp(data.byte(kObjecttype), 2); - if (flags.z()) - goto describe; - es = data.word(kSetdesc); - si = (0); - cx = (0+(130*2)); - _cmp(data.byte(kObjecttype), 1); - if (flags.z()) - goto describe; - es = data.word(kExtras); - si = (0+2080+30000+(16*114)); - cx = (0+2080+30000+(16*114)+((114+2)*2)); -describe: - al = data.byte(kCommand); - ah = 0; - _add(ax, ax); - _add(si, ax); - ax = es.word(si); - _add(ax, cx); - si = ax; - bx = ax; -tryagain: - push(si); - findNextColon(); - al = es.byte(si); - cx = si; - si = pop(); - _cmp(data.byte(kObjecttype), 1); - if (!flags.z()) - return /* (cantmakeoneup) */; - _cmp(al, 0); - if (flags.z()) - goto findsometext; - _cmp(al, ':'); - if (flags.z()) - goto findsometext; - return; -findsometext: - searchForSame(); - goto tryagain; -} - void DreamGenContext::searchForSame() { STACK_CHECK; si = cx; diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index b620b2179d..2df23e4e08 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -455,7 +455,6 @@ public: #include "stubs.h" // Allow hand-reversed functions to have a signature different than void f() void getPersonText(); - void getObTextStart(); void checkObjectSize(); void doSomeTalk(); void outOfOpen(); diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index cdd612001f..8e7ade4ffd 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -636,4 +636,73 @@ void DreamBase::purgeALocation(uint8 index) { } } +const uint8 *DreamBase::getObTextStart() { + uint16 textSeg, textDatOff, textOff; + if (data.byte(kObjecttype) == kFreeObjectType) { + textSeg = data.word(kFreedesc); + textDatOff = kFreetextdat; + textOff = kFreetext; + } else if (data.byte(kObjecttype) == kSetObjectType1) { + textSeg = data.word(kSetdesc); + textDatOff = kSettextdat; + textOff = kSettext; + } else { + textSeg = data.word(kExtras); + textDatOff = kExtextdat; + textOff = kExtext; + } + 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; + + const uint8 *obname = text; + while (true) { + const uint8 *start = text; + findNextColon(&text); + + // Not an empty description string? + if (*text != 0 && *text != ':') + return start; + + // If the description string (of a SetObjectType1 object) is empty, + // look for an object with the same name. + // Example: Eden's garage door outside has two parts. The right part + // has no description of its own but uses that of the left part. + + bool found = false; + do { + text++; + uint8 c = *obname; + + // scan for matching first character + while (*text != c) { + text++; + + // arbitrary give-up counter + if (text - (textBase - textOff) >= 8000) { + warning("Object description for %d/%d not found", data.byte(kObjecttype), data.byte(kCommand)); + return obname; + } + } + + // found matching first character, so match the rest + const uint8 *s1 = obname; + const uint8 *s2 = text; + do { + s1++; + s2++; + } while (*s1 != ':' && *s1 != 0 && *s1 == *s2); + + if (*s1 == ':' || *s1 == 0) + found = true; // (prefix) matched the entire object name + } while (!found); + + // We found an object with the same name. The next loop iteration + // will check if this one again has an empty description. + } +} + + } // End of namespace DreamGen diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 09c8b36e81..f15325eaa9 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -1875,16 +1875,6 @@ uint8 DreamBase::findNextColon(const uint8 **string) { return c; } -const uint8 *DreamGenContext::getObTextStartCPP() { - push(es); - push(si); - getObTextStart(); - const uint8 *result = es.ptr(si, 0); - si = pop(); - es = pop(); - return result; -} - void DreamGenContext::enterSymbol() { data.byte(kManisoffscreen) = 1; getRidOfReels(); @@ -2906,7 +2896,7 @@ void DreamGenContext::obsThatDoThings() { } void DreamGenContext::describeOb() { - const uint8 *obText = getObTextStartCPP(); + const uint8 *obText = getObTextStart(); uint16 y = 92; if (data.byte(kForeignrelease) && data.byte(kObjecttype) == kSetObjectType1) y = 82; @@ -3673,7 +3663,7 @@ void DreamGenContext::lookAtCard() { loadKeypad(); createPanel2(); showFrame(tempGraphics(), 160, 80, 42, 128); - const uint8 *obText = getObTextStartCPP(); + const uint8 *obText = getObTextStart(); findNextColon(&obText); findNextColon(&obText); findNextColon(&obText); diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp index aa7c2bddea..e891298f2b 100644 --- a/engines/dreamweb/use.cpp +++ b/engines/dreamweb/use.cpp @@ -140,7 +140,7 @@ void DreamGenContext::useRoutine() { } delPointer(); - const uint8 *obText = getObTextStartCPP(); + const uint8 *obText = getObTextStart(); if (findNextColon(&obText) != 0) { if (findNextColon(&obText) != 0) { if (*obText != 0) { @@ -175,7 +175,7 @@ void DreamGenContext::useText(const uint8 *string) { } void DreamGenContext::showFirstUse() { - const uint8 *obText = getObTextStartCPP(); + const uint8 *obText = getObTextStart(); findNextColon(&obText); findNextColon(&obText); useText(obText); @@ -183,7 +183,7 @@ void DreamGenContext::showFirstUse() { } void DreamGenContext::showSecondUse() { - const uint8 *obText = getObTextStartCPP(); + const uint8 *obText = getObTextStart(); findNextColon(&obText); findNextColon(&obText); findNextColon(&obText); @@ -1611,7 +1611,7 @@ void DreamGenContext::useCashCard() { showMan(); uint16 y = (!data.byte(kForeignrelease)) ? 120 : 120 - 3; showFrame(tempGraphics(), 114, y, 39, 0); - const uint8 *obText = getObTextStartCPP(); + const uint8 *obText = getObTextStart(); findNextColon(&obText); findNextColon(&obText); y = 98; -- cgit v1.2.3 From be1a4de2919e7a5fa26ee05d23792aacd0e33a7a Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 24 Dec 2011 13:27:09 +0200 Subject: DREAMWEB: Port 'dropobject' to C++ --- engines/dreamweb/dreamgen.cpp | 101 ------------------------------------------ engines/dreamweb/dreamgen.h | 1 - engines/dreamweb/object.cpp | 52 ++++++++++++++++++++++ engines/dreamweb/stubs.h | 1 + 4 files changed, 53 insertions(+), 102 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index bcb45f529f..d1abe79a48 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -580,107 +580,6 @@ findopenp1: _add(bx, (0+(228*13))); } -void DreamGenContext::dropObject() { - STACK_CHECK; - _cmp(data.byte(kCommandtype), 223); - if (flags.z()) - goto alreadydrop; - data.byte(kCommandtype) = 223; - _cmp(data.byte(kPickup), 0); - if (flags.z()) - { blank(); return; }; - bl = data.byte(kItemframe); - bh = data.byte(kObjecttype); - al = 37; - commandWithOb(); -alreadydrop: - ax = data.word(kMousebutton); - _cmp(ax, data.word(kOldbutton)); - if (flags.z()) - return /* (nodrop) */; - _and(ax, 1); - if (!flags.z()) - goto dodrop; - return; -dodrop: - getEitherAd(); - isItWorn(); - if (!flags.z()) - goto nowornerror; - wornError(); - return; -nowornerror: - _cmp(data.byte(kReallocation), 47); - if (flags.z()) - goto nodrop2; - cl = data.byte(kRyanx); - _add(cl, 12); - ch = data.byte(kRyany); - _add(ch, 12); - checkOne(); - _cmp(cl, 2); - if (flags.c()) - goto nodroperror; -nodrop2: - dropError(); - return; -nodroperror: - _cmp(data.byte(kMapxsize), 64); - if (!flags.z()) - goto notinlift; - _cmp(data.byte(kMapysize), 64); - if (!flags.z()) - goto notinlift; - dropError(); - return; -notinlift: - al = data.byte(kItemframe); - ah = 4; - cl = 'G'; - ch = 'U'; - dl = 'N'; - dh = 'A'; - compare(); - if (flags.z()) - { cantDrop(); return; }; - al = data.byte(kItemframe); - ah = 4; - cl = 'S'; - ch = 'H'; - dl = 'L'; - dh = 'D'; - compare(); - if (flags.z()) - { cantDrop(); return; }; - data.byte(kObjecttype) = 4; - al = data.byte(kItemframe); - getExAd(); - es.byte(bx+2) = 0; - al = data.byte(kRyanx); - _add(al, 4); - cl = 4; - _shr(al, cl); - _add(al, data.byte(kMapx)); - ah = data.byte(kRyany); - _add(ah, 8); - cl = 4; - _shr(ah, cl); - _add(ah, data.byte(kMapy)); - es.byte(bx+3) = al; - es.byte(bx+5) = ah; - al = data.byte(kRyanx); - _add(al, 4); - _and(al, 15); - ah = data.byte(kRyany); - _add(ah, 8); - _and(ah, 15); - es.byte(bx+4) = al; - es.byte(bx+6) = ah; - data.byte(kPickup) = 0; - al = data.byte(kReallocation); - es.byte(bx) = al; -} - void DreamGenContext::selectOpenOb() { STACK_CHECK; al = data.byte(kCommand); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 2df23e4e08..2041ab186b 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -475,7 +475,6 @@ public: void findAllOpen(); void fillOpen(); void getEitherAd(); - void dropObject(); void useOpened(); void locationPic(); void swapWithOpen(); diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index 8e7ade4ffd..04081e2f0e 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -704,5 +704,57 @@ const uint8 *DreamBase::getObTextStart() { } } +void DreamGenContext::dropObject() { + if (data.byte(kCommandtype) != 223) { + data.byte(kCommandtype) = 223; + if (!data.byte(kPickup)) { + blank(); + return; + } + commandWithOb(37, data.byte(kObjecttype), data.byte(kItemframe)); + } + + if (data.word(kMousebutton) == data.word(kOldbutton) || !(data.word(kMousebutton) & 1)) + return; + + if (isItWorn(getEitherAdCPP())) { + wornError(); + return; + } + + if (data.byte(kReallocation) != 47) { + byte flag, flagEx, type, flagX, flagY; + checkOne(data.byte(kRyanx) + 12, data.byte(kRyany) + 12, &flag, &flagEx, &type, &flagX, &flagY); + + if (flag >= 2) { + dropError(); + return; + } + } else { + dropError(); + return; + } + + if (data.byte(kMapxsize) == 64 && data.byte(kMapysize) == 64) { + // Inside lift + dropError(); + return; + } + + if (compare(data.byte(kItemframe), 4, "GUNA") || compare(data.byte(kItemframe), 4, "SHLD")) { + cantDrop(); + return; + } + + data.byte(kObjecttype) = 4; + DynObject *object = getExAd(data.byte(kItemframe)); + object->mapad[0] = 0; + object->mapad[1] = ((data.byte(kRyanx) + 4) >> 4) + data.byte(kMapx); + object->mapad[2] = (data.byte(kRyanx) + 4) & 0xF; + object->mapad[3] = ((data.byte(kRyany) + 8) >> 4) + data.byte(kMapy); + object->mapad[4] = (data.byte(kRyany) + 8) & 0xF; + data.byte(kPickup) = 0; + object->currentLocation = data.byte(kReallocation); +} } // End of namespace DreamGen diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 83b4ebfcae..5f4ad566c1 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -339,5 +339,6 @@ void outOfInv(); void edensFlatReminders(); void incRyanPage(); + void dropObject(); #endif -- cgit v1.2.3 From efb9057dda86fb8899cfbe18e3857b88f5597b22 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sat, 24 Dec 2011 13:12:00 +0100 Subject: DREAMWEB: Remove unused function --- engines/dreamweb/dreamgen.cpp | 43 ------------------------------------------- engines/dreamweb/dreamgen.h | 1 - 2 files changed, 44 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index d1abe79a48..b9816c28b2 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -284,49 +284,6 @@ findopen2a: goto findopen1a; } -void DreamGenContext::searchForSame() { - STACK_CHECK; - si = cx; -searchagain: - _inc(si); - al = es.byte(bx); -search: - _cmp(es.byte(si), al); - if (flags.z()) - goto gotstartletter; - _inc(cx); - _inc(si); - _cmp(si, 8000); - if (flags.c()) - goto search; - si = bx; - ax = pop(); - return; -gotstartletter: - push(bx); - push(si); -keepchecking: - _inc(si); - _inc(bx); - al = es.byte(bx); - ah = es.byte(si); - _cmp(al, ':'); - if (flags.z()) - goto foundmatch; - _cmp(al, 0); - if (flags.z()) - goto foundmatch; - _cmp(al, ah); - if (flags.z()) - goto keepchecking; - si = pop(); - bx = pop(); - goto searchagain; -foundmatch: - si = pop(); - bx = pop(); -} - void DreamGenContext::reExFromInv() { STACK_CHECK; findInvPos(); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 2041ab186b..10abde7fff 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -470,7 +470,6 @@ public: void purgeAnItem(); void getSetAd(); void findOpenPos(); - void searchForSame(); void rollEm(); void findAllOpen(); void fillOpen(); -- cgit v1.2.3 From bcf789274f605a0f4901399f767a1da40444fa79 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sat, 24 Dec 2011 13:39:27 +0100 Subject: DREAMWEB: Move many use-related functions to DreamBase --- engines/dreamweb/dreambase.h | 87 +++++++++++++ engines/dreamweb/keypad.cpp | 2 +- engines/dreamweb/stubs.cpp | 28 ++--- engines/dreamweb/stubs.h | 87 ------------- engines/dreamweb/use.cpp | 290 +++++++++++++++++++++---------------------- 5 files changed, 247 insertions(+), 247 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 4dc537c4e3..720fcb3116 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -144,6 +144,7 @@ public: void dumpSymbol(); void dumpSymBox(); void quitSymbol(); + void enterCode(uint8 digit0, uint8 digit1, uint8 digit2, uint8 digit3); // from monitor.cpp void input(); @@ -515,6 +516,17 @@ public: void startup(); void atmospheres(); bool objectMatches(void *object, const char *id); + void checkFolderCoords(); + void nextFolder(); + void lastFolder(); + void lookAtCard(); + void obsThatDoThings(); + void describeOb(); + void putBackObStuff(); + void reExFromOpen(); + void showDiaryPage(); + void showDiaryKeys(); + void dumpDiaryKeys(); // from use.cpp void placeFreeObject(uint8 index); @@ -523,6 +535,81 @@ public: void withWhat(); uint16 checkInside(uint16 command, uint16 type); void showPuzText(uint16 command, uint16 count); + void useText(const uint8 *string); + void showFirstUse(); + void showSecondUse(); + void viewFolder(); + void edensCDPlayer(); + void hotelBell(); + void playGuitar(); + void useElevator2(); + void useElevator3(); + void useElevator4(); + void useElevator5(); + void useHatch(); + void wheelSound(); + void callHotelLift(); + void useShield(); + void useCoveredBox(); + void useRailing(); + void useChurchHole(); + void sitDownInBar(); + void useBalcony(); + void useWindow(); + void trapDoor(); + void useDryer(); + void callEdensDLift(); + void callEdensLift(); + void openYourNeighbour(); + void openRyan(); + void openPoolBoss(); + void openEden(); + void openSarters(); + void openLouis(); + void useWall(); + void useChurchGate(); + void useLadder(); + void useLadderB(); + bool defaultUseHandler(const char *id); + void slabDoorA(); + void slabDoorB(); + void slabDoorC(); + void slabDoorE(); + void slabDoorD(); + void slabDoorF(); + void useGun(); + void useFullCart(); + void useClearBox(); + void openTVDoor(); + void usePlate(); + void usePlinth(); + void useElvDoor(); + void useWinch(); + void useCart(); + void useHole(); + void openHotelDoor(); + void openHotelDoor2(); + void grafittiDoor(); + void useCardReader1(); + void useCardReader2(); + void useCardReader3(); + void usePoolReader(); + void useLighter(); + void useWire(); + void openTomb(); + void hotelControl(); + void useCooker(); + void useDiary(); + void useControl(); + void useSlab(); + void usePipe(); + void useOpenBox(); + void runTap(); + void useAxe(); + void useHandle(); + void useAltar(); + void notHeldError(); + void useCashCard(); // from vgafades.cpp void clearStartPal(); diff --git a/engines/dreamweb/keypad.cpp b/engines/dreamweb/keypad.cpp index d0ef260e90..29f31f1bd0 100644 --- a/engines/dreamweb/keypad.cpp +++ b/engines/dreamweb/keypad.cpp @@ -92,7 +92,7 @@ void DreamBase::addToPressList() { ++data.word(kPresspointer); } -void DreamGenContext::enterCode(uint8 digit0, uint8 digit1, uint8 digit2, uint8 digit3) { +void DreamBase::enterCode(uint8 digit0, uint8 digit1, uint8 digit2, uint8 digit3) { RectWithCallback keypadList[] = { { kKeypadx+9,kKeypadx+30,kKeypady+9,kKeypady+22,&DreamBase::buttonOne }, { kKeypadx+31,kKeypadx+52,kKeypady+9,kKeypady+22,&DreamBase::buttonTwo }, diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index f15325eaa9..9a7b66ac72 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -2438,18 +2438,18 @@ const uint8 *DreamBase::getTextInFile1(uint16 index) { return string; } -void DreamGenContext::checkFolderCoords() { - RectWithCallback folderList[] = { +void DreamBase::checkFolderCoords() { + RectWithCallback folderList[] = { { 280,320,160,200, &DreamBase::quitKey }, - { 143,300,6,194, &DreamGenContext::nextFolder }, - { 0,143,6,194, &DreamGenContext::lastFolder }, + { 143,300,6,194, &DreamBase::nextFolder }, + { 0,143,6,194, &DreamBase::lastFolder }, { 0,320,0,200, &DreamBase::blank }, { 0xFFFF,0,0,0, 0 } }; checkCoords(folderList); } -void DreamGenContext::nextFolder() { +void DreamBase::nextFolder() { if (data.byte(kFolderpage) == 12) { blank(); return; @@ -2469,7 +2469,7 @@ void DreamGenContext::nextFolder() { } } -void DreamGenContext::lastFolder() { +void DreamBase::lastFolder() { if (data.byte(kFolderpage) == 0) { blank(); return; @@ -2885,7 +2885,7 @@ void DreamBase::openInv() { data.byte(kCommandtype) = 255; } -void DreamGenContext::obsThatDoThings() { +void DreamBase::obsThatDoThings() { if (!compare(data.byte(kCommand), data.byte(kObjecttype), "MEMB")) return; // notlouiscard @@ -2895,7 +2895,7 @@ void DreamGenContext::obsThatDoThings() { } } -void DreamGenContext::describeOb() { +void DreamBase::describeOb() { const uint8 *obText = getObTextStart(); uint16 y = 92; if (data.byte(kForeignrelease) && data.byte(kObjecttype) == kSetObjectType1) @@ -2986,11 +2986,11 @@ void DreamGenContext::errorMessage3() { delPointer(); } -void DreamGenContext::reExFromOpen() { +void DreamBase::reExFromOpen() { } -void DreamGenContext::putBackObStuff() { +void DreamBase::putBackObStuff() { createPanel(); showPanel(); showMan(); @@ -3614,7 +3614,7 @@ void DreamGenContext::updateSymbolBot() { } } -void DreamGenContext::showDiaryPage() { +void DreamBase::showDiaryPage() { showFrame(tempGraphics(), kDiaryx, kDiaryy, 0, 0); data.byte(kKerning) = 1; useTempCharset(); @@ -3631,7 +3631,7 @@ void DreamGenContext::showDiaryPage() { useCharset1(); } -void DreamGenContext::dumpDiaryKeys() { +void DreamBase::dumpDiaryKeys() { if (data.byte(kPresscount) == 1) { if (data.byte(kSartaindead) != 1 && data.byte(kDiarypage) == 5 && getLocation(6) != 1) { // Add Sartain Industries note @@ -3657,7 +3657,7 @@ void DreamGenContext::dumpDiaryKeys() { multiDump(kDiaryx + 151, kDiaryy + 71, 16, 16); } -void DreamGenContext::lookAtCard() { +void DreamBase::lookAtCard() { data.byte(kManisoffscreen) = 1; getRidOfReels(); loadKeypad(); @@ -3710,7 +3710,7 @@ void DreamBase::clearChanges() { memcpy(data.ptr(kRoomscango, 16), initialRoomsCanGo, 16); } -void DreamGenContext::showDiaryKeys() { +void DreamBase::showDiaryKeys() { if (!data.byte(kPresscount)) return; // nokeyatall diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 5f4ad566c1..da14962a27 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -119,7 +119,6 @@ } void findNextColon(); const uint8 *getObTextStartCPP(); - void useText(const uint8 *string); void showCity(); uint16 getPersFrame(uint8 index); void convIcons(); @@ -153,67 +152,15 @@ void look(); void autoLook(); void doLook(); - void showFirstUse(); - void showSecondUse(); void enterSymbol(); - void viewFolder(); - void edensCDPlayer(); - void hotelBell(); - void playGuitar(); - void callEdensDLift(); - void callEdensLift(); - void sitDownInBar(); - void trapDoor(); - void useBalcony(); - void useChurchHole(); - void useCoveredBox(); void useElevator1(); - void useElevator2(); - void useElevator3(); - void useElevator4(); - void useElevator5(); - void useDryer(); - void useRailing(); - void useWindow(); - void useHatch(); - void useLighter(); - void useSLab(); - void usePipe(); - void useOpenBox(); - void useAxe(); void useKey(); - void wheelSound(); - void callHotelLift(); - void useShield(); - void useWall(); - void useChurchGate(); - void useFullCart(); - void useClearBox(); - void usePlate(); - void usePlinth(); - void useElvDoor(); void useObject(); - void useWinch(); - void useCardReader1(); - void useCardReader2(); - void useCardReader3(); - void usePoolReader(); - void useCooker(); - void useWire(); - void useControl(); - void useHandle(); - void useAltar(); - bool defaultUseHandler(const char *id); - void openTVDoor(); void wearWatch(); void wearShades(); - void checkFolderCoords(); - void nextFolder(); - void lastFolder(); void singleKey(uint8 key, uint16 x, uint16 y); uint8 nextSymbol(uint8 symbol); void showSymbol(); - void enterCode(uint8 digit0, uint8 digit1, uint8 digit2, uint8 digit3); void inventory(); void mainScreen(); void zoomOnOff(); @@ -230,40 +177,15 @@ void afterIntroRoom(); void gettingShot(); void allPointer(); - void openYourNeighbour(); - void openRyan(); - void openPoolBoss(); - void openEden(); - void openSarters(); - void openLouis(); - void useLadder(); - void useLadderB(); - void useCart(); void useTrainer(); - void useHole(); - void runTap(); void chewy(); - void sLabDoorA(); - void sLabDoorB(); - void sLabDoorC(); - void sLabDoorE(); - void sLabDoorD(); - void sLabDoorF(); - void openHotelDoor(); - void openHotelDoor2(); - void grafittiDoor(); - void openTomb(); - void hotelControl(); - void obsThatDoThings(); void delEverything(); void errorMessage1(); void errorMessage2(); void errorMessage3(); - void reExFromOpen(); void nextDest(); void lastDest(); void destSelect(); - void putBackObStuff(); void moreTalk(); void redes(); void selectLocation(); @@ -276,7 +198,6 @@ void madmanRun(); void decide(); void talk(); - void useDiary(); void hangOnPQ(); void showGun(); void endGame(); @@ -292,10 +213,7 @@ void processTrigger(); void updateSymbolTop(); void updateSymbolBot(); - void showDiaryPage(); - void dumpDiaryKeys(); void runEndSeq(); - void lookAtCard(); bool execCommand(); void findExObject(); uint16 findExObject(const char *id) { @@ -305,20 +223,15 @@ bool isRyanHolding(const char *id) { return DreamBase::isRyanHolding(id); } - void describeOb(); void getOpenedSize(); byte getOpenedSizeCPP(); void openOb(); - void notHeldError(); - void useGun(); void identifyOb(); - void useCashCard(); void useStereo(); void selectOb(); void findInvPos(); uint16 findInvPosCPP(); void setPickup(); - void showDiaryKeys(); void showKeys(); void getKeyAndLogo(); void deleteExObject(); diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp index e891298f2b..bbcf028b78 100644 --- a/engines/dreamweb/use.cpp +++ b/engines/dreamweb/use.cpp @@ -40,85 +40,85 @@ void DreamGenContext::useRoutine() { static const UseListEntry kUseList[] = { { &DreamGenContext::useMon, "NETW" }, { &DreamGenContext::useElevator1, "ELVA" }, - { &DreamGenContext::useElevator2, "ELVB" }, - { &DreamGenContext::useElevator3, "ELVC" }, - { &DreamGenContext::useElevator4, "ELVE" }, - { &DreamGenContext::useElevator5, "ELVF" }, - { &DreamGenContext::useChurchGate, "CGAT" }, + { &DreamBase::useElevator2, "ELVB" }, + { &DreamBase::useElevator3, "ELVC" }, + { &DreamBase::useElevator4, "ELVE" }, + { &DreamBase::useElevator5, "ELVF" }, + { &DreamBase::useChurchGate, "CGAT" }, { &DreamGenContext::useStereo, "REMO" }, { &DreamGenContext::useButtonA, "BUTA" }, - { &DreamGenContext::useWinch, "CBOX" }, - { &DreamGenContext::useLighter, "LITE" }, - { &DreamGenContext::usePlate, "PLAT" }, - { &DreamGenContext::useControl, "LIFT" }, - { &DreamGenContext::useWire, "WIRE" }, - { &DreamGenContext::useHandle, "HNDL" }, - { &DreamGenContext::useHatch, "HACH" }, - { &DreamGenContext::useElvDoor, "DOOR" }, - { &DreamGenContext::useCashCard, "CSHR" }, - { &DreamGenContext::useGun, "GUNA" }, - { &DreamGenContext::useCardReader1, "CRAA" }, - { &DreamGenContext::useCardReader2, "CRBB" }, - { &DreamGenContext::useCardReader3, "CRCC" }, - { &DreamGenContext::sitDownInBar, "SEAT" }, + { &DreamBase::useWinch, "CBOX" }, + { &DreamBase::useLighter, "LITE" }, + { &DreamBase::usePlate, "PLAT" }, + { &DreamBase::useControl, "LIFT" }, + { &DreamBase::useWire, "WIRE" }, + { &DreamBase::useHandle, "HNDL" }, + { &DreamBase::useHatch, "HACH" }, + { &DreamBase::useElvDoor, "DOOR" }, + { &DreamBase::useCashCard, "CSHR" }, + { &DreamBase::useGun, "GUNA" }, + { &DreamBase::useCardReader1, "CRAA" }, + { &DreamBase::useCardReader2, "CRBB" }, + { &DreamBase::useCardReader3, "CRCC" }, + { &DreamBase::sitDownInBar, "SEAT" }, { &DreamGenContext::useMenu, "MENU" }, - { &DreamGenContext::useCooker, "COOK" }, - { &DreamGenContext::callHotelLift, "ELCA" }, - { &DreamGenContext::callEdensLift, "EDCA" }, - { &DreamGenContext::callEdensDLift, "DDCA" }, - { &DreamGenContext::useAltar, "ALTR" }, - { &DreamGenContext::openHotelDoor, "LOKA" }, - { &DreamGenContext::openHotelDoor2, "LOKB" }, - { &DreamGenContext::openLouis, "ENTA" }, - { &DreamGenContext::openRyan, "ENTB" }, - { &DreamGenContext::openPoolBoss, "ENTE" }, - { &DreamGenContext::openYourNeighbour, "ENTC" }, - { &DreamGenContext::openEden, "ENTD" }, - { &DreamGenContext::openSarters, "ENTH" }, + { &DreamBase::useCooker, "COOK" }, + { &DreamBase::callHotelLift, "ELCA" }, + { &DreamBase::callEdensLift, "EDCA" }, + { &DreamBase::callEdensDLift, "DDCA" }, + { &DreamBase::useAltar, "ALTR" }, + { &DreamBase::openHotelDoor, "LOKA" }, + { &DreamBase::openHotelDoor2, "LOKB" }, + { &DreamBase::openLouis, "ENTA" }, + { &DreamBase::openRyan, "ENTB" }, + { &DreamBase::openPoolBoss, "ENTE" }, + { &DreamBase::openYourNeighbour, "ENTC" }, + { &DreamBase::openEden, "ENTD" }, + { &DreamBase::openSarters, "ENTH" }, { &DreamGenContext::wearWatch, "WWAT" }, - { &DreamGenContext::usePoolReader, "POOL" }, + { &DreamBase::usePoolReader, "POOL" }, { &DreamGenContext::wearShades, "WSHD" }, - { &DreamGenContext::grafittiDoor, "GRAF" }, - { &DreamGenContext::trapDoor, "TRAP" }, - { &DreamGenContext::edensCDPlayer, "CDPE" }, - { &DreamGenContext::openTVDoor, "DLOK" }, - { &DreamGenContext::useHole, "HOLE" }, - { &DreamGenContext::useDryer, "DRYR" }, - { &DreamGenContext::useChurchHole, "HOLY" }, - { &DreamGenContext::useWall, "WALL" }, - { &DreamGenContext::useDiary, "BOOK" }, - { &DreamGenContext::useAxe, "AXED" }, - { &DreamGenContext::useShield, "SHLD" }, - { &DreamGenContext::useRailing, "BCNY" }, - { &DreamGenContext::useCoveredBox, "LIDC" }, - { &DreamGenContext::useClearBox, "LIDU" }, - { &DreamGenContext::useOpenBox, "LIDO" }, - { &DreamGenContext::usePipe, "PIPE" }, - { &DreamGenContext::useBalcony, "BALC" }, - { &DreamGenContext::useWindow, "WIND" }, - { &DreamGenContext::viewFolder, "PAPR" }, + { &DreamBase::grafittiDoor, "GRAF" }, + { &DreamBase::trapDoor, "TRAP" }, + { &DreamBase::edensCDPlayer, "CDPE" }, + { &DreamBase::openTVDoor, "DLOK" }, + { &DreamBase::useHole, "HOLE" }, + { &DreamBase::useDryer, "DRYR" }, + { &DreamBase::useChurchHole, "HOLY" }, + { &DreamBase::useWall, "WALL" }, + { &DreamBase::useDiary, "BOOK" }, + { &DreamBase::useAxe, "AXED" }, + { &DreamBase::useShield, "SHLD" }, + { &DreamBase::useRailing, "BCNY" }, + { &DreamBase::useCoveredBox, "LIDC" }, + { &DreamBase::useClearBox, "LIDU" }, + { &DreamBase::useOpenBox, "LIDO" }, + { &DreamBase::usePipe, "PIPE" }, + { &DreamBase::useBalcony, "BALC" }, + { &DreamBase::useWindow, "WIND" }, + { &DreamBase::viewFolder, "PAPR" }, { &DreamGenContext::useTrainer, "UWTA" }, { &DreamGenContext::useTrainer, "UWTB" }, { &DreamGenContext::enterSymbol, "STAT" }, - { &DreamGenContext::openTomb, "TLID" }, - { &DreamGenContext::useSLab, "SLAB" }, - { &DreamGenContext::useCart, "CART" }, - { &DreamGenContext::useFullCart, "FCAR" }, - { &DreamGenContext::sLabDoorA, "SLBA" }, - { &DreamGenContext::sLabDoorB, "SLBB" }, - { &DreamGenContext::sLabDoorC, "SLBC" }, - { &DreamGenContext::sLabDoorD, "SLBD" }, - { &DreamGenContext::sLabDoorE, "SLBE" }, - { &DreamGenContext::sLabDoorF, "SLBF" }, - { &DreamGenContext::usePlinth, "PLIN" }, - { &DreamGenContext::useLadder, "LADD" }, - { &DreamGenContext::useLadderB, "LADB" }, + { &DreamBase::openTomb, "TLID" }, + { &DreamBase::useSlab, "SLAB" }, + { &DreamBase::useCart, "CART" }, + { &DreamBase::useFullCart, "FCAR" }, + { &DreamBase::slabDoorA, "SLBA" }, + { &DreamBase::slabDoorB, "SLBB" }, + { &DreamBase::slabDoorC, "SLBC" }, + { &DreamBase::slabDoorD, "SLBD" }, + { &DreamBase::slabDoorE, "SLBE" }, + { &DreamBase::slabDoorF, "SLBF" }, + { &DreamBase::usePlinth, "PLIN" }, + { &DreamBase::useLadder, "LADD" }, + { &DreamBase::useLadderB, "LADB" }, { &DreamGenContext::chewy, "GUMA" }, - { &DreamGenContext::wheelSound, "SQEE" }, - { &DreamGenContext::runTap, "TAPP" }, - { &DreamGenContext::playGuitar, "GUIT" }, - { &DreamGenContext::hotelControl, "CONT" }, - { &DreamGenContext::hotelBell, "BELL" }, + { &DreamBase::wheelSound, "SQEE" }, + { &DreamBase::runTap, "TAPP" }, + { &DreamBase::playGuitar, "GUIT" }, + { &DreamBase::hotelControl, "CONT" }, + { &DreamBase::hotelBell, "BELL" }, }; if (data.byte(kReallocation) >= 50) { @@ -164,7 +164,7 @@ void DreamGenContext::useRoutine() { data.byte(kCommandtype) = 255; } -void DreamGenContext::useText(const uint8 *string) { +void DreamBase::useText(const uint8 *string) { createPanel(); showPanel(); showMan(); @@ -174,7 +174,7 @@ void DreamGenContext::useText(const uint8 *string) { workToScreenM(); } -void DreamGenContext::showFirstUse() { +void DreamBase::showFirstUse() { const uint8 *obText = getObTextStart(); findNextColon(&obText); findNextColon(&obText); @@ -182,7 +182,7 @@ void DreamGenContext::showFirstUse() { hangOnP(400); } -void DreamGenContext::showSecondUse() { +void DreamBase::showSecondUse() { const uint8 *obText = getObTextStart(); findNextColon(&obText); findNextColon(&obText); @@ -191,7 +191,7 @@ void DreamGenContext::showSecondUse() { hangOnP(400); } -void DreamGenContext::viewFolder() { +void DreamBase::viewFolder() { data.byte(kManisoffscreen) = 1; getRidOfAll(); loadFolder(); @@ -220,7 +220,7 @@ void DreamGenContext::viewFolder() { workToScreenM(); } -void DreamGenContext::edensCDPlayer() { +void DreamBase::edensCDPlayer() { showFirstUse(); data.word(kWatchingtime) = 18 * 2; data.word(kReeltowatch) = 25; @@ -230,13 +230,13 @@ void DreamGenContext::edensCDPlayer() { data.byte(kGetback) = 1; } -void DreamGenContext::hotelBell() { +void DreamBase::hotelBell() { playChannel1(12); showFirstUse(); putBackObStuff(); } -void DreamGenContext::playGuitar() { +void DreamBase::playGuitar() { playChannel1(14); showFirstUse(); putBackObStuff(); @@ -248,7 +248,7 @@ void DreamGenContext::useElevator1() { data.byte(kGetback) = 1; } -void DreamGenContext::useElevator2() { +void DreamBase::useElevator2() { showFirstUse(); if (data.byte(kLocation) == 23) // In pool hall @@ -262,7 +262,7 @@ void DreamGenContext::useElevator2() { data.byte(kGetback) = 1; } -void DreamGenContext::useElevator3() { +void DreamBase::useElevator3() { showFirstUse(); data.byte(kCounttoclose) = 20; data.byte(kNewlocation) = 34; @@ -274,7 +274,7 @@ void DreamGenContext::useElevator3() { data.byte(kGetback) = 1; } -void DreamGenContext::useElevator4() { +void DreamBase::useElevator4() { showFirstUse(); data.word(kReeltowatch) = 0; data.word(kEndwatchreel) = 11; @@ -286,7 +286,7 @@ void DreamGenContext::useElevator4() { data.byte(kNewlocation) = 24; } -void DreamGenContext::useElevator5() { +void DreamBase::useElevator5() { placeSetObject(4); removeSetObject(0); data.byte(kNewlocation) = 20; @@ -296,19 +296,19 @@ void DreamGenContext::useElevator5() { data.byte(kGetback) = 1; } -void DreamGenContext::useHatch() { +void DreamBase::useHatch() { showFirstUse(); data.byte(kNewlocation) = 40; data.byte(kGetback) = 1; } -void DreamGenContext::wheelSound() { +void DreamBase::wheelSound() { playChannel1(17); showFirstUse(); putBackObStuff(); } -void DreamGenContext::callHotelLift() { +void DreamBase::callHotelLift() { playChannel1(12); showFirstUse(); data.byte(kCounttoopen) = 8; @@ -319,7 +319,7 @@ void DreamGenContext::callHotelLift() { turnPathOn(4); } -void DreamGenContext::useShield() { +void DreamBase::useShield() { if (data.byte(kReallocation) != 20 || data.byte(kCombatcount) == 0) { // Not in Sart room showFirstUse(); @@ -333,7 +333,7 @@ void DreamGenContext::useShield() { } } -void DreamGenContext::useCoveredBox() { +void DreamBase::useCoveredBox() { data.byte(kProgresspoints)++; showFirstUse(); data.word(kWatchingtime) = 50; @@ -344,7 +344,7 @@ void DreamGenContext::useCoveredBox() { data.byte(kGetback) = 1; } -void DreamGenContext::useRailing() { +void DreamBase::useRailing() { showFirstUse(); data.word(kWatchingtime) = 80; data.word(kReeltowatch) = 0; @@ -383,7 +383,7 @@ void DreamGenContext::wearShades() { } } -void DreamGenContext::useChurchHole() { +void DreamBase::useChurchHole() { showFirstUse(); data.byte(kGetback) = 1; data.word(kWatchingtime) = 28; @@ -393,7 +393,7 @@ void DreamGenContext::useChurchHole() { data.byte(kSpeedcount) = 1; } -void DreamGenContext::sitDownInBar() { +void DreamBase::sitDownInBar() { if (data.byte(kWatchmode) != 0xFF) { // Sat down showSecondUse(); @@ -411,13 +411,13 @@ void DreamGenContext::sitDownInBar() { } } -void DreamGenContext::useDryer() { +void DreamBase::useDryer() { playChannel1(12); showFirstUse(); data.byte(kGetback) = 1; } -void DreamGenContext::useBalcony() { +void DreamBase::useBalcony() { showFirstUse(); turnPathOn(6); turnPathOff(0); @@ -441,7 +441,7 @@ void DreamGenContext::useBalcony() { data.byte(kGetback) = 1; } -void DreamGenContext::useWindow() { +void DreamBase::useWindow() { if (data.byte(kManspath) != 6) { // Not on balcony showSecondUse(); @@ -454,7 +454,7 @@ void DreamGenContext::useWindow() { } } -void DreamGenContext::trapDoor() { +void DreamBase::trapDoor() { data.byte(kProgresspoints)++; showFirstUse(); switchRyanOff(); @@ -467,14 +467,14 @@ void DreamGenContext::trapDoor() { data.byte(kGetback) = 1; } -void DreamGenContext::callEdensLift() { +void DreamBase::callEdensLift() { showFirstUse(); data.byte(kCounttoopen) = 8; data.byte(kGetback) = 1; turnPathOn(2); } -void DreamGenContext::callEdensDLift() { +void DreamBase::callEdensDLift() { if (data.byte(kLiftflag) == 1) { // Eden's D here showSecondUse(); @@ -487,38 +487,38 @@ void DreamGenContext::callEdensDLift() { } } -void DreamGenContext::openYourNeighbour() { +void DreamBase::openYourNeighbour() { enterCode(255, 255, 255, 255); data.byte(kGetback) = 1; } -void DreamGenContext::openRyan() { +void DreamBase::openRyan() { enterCode(5, 1, 0, 6); data.byte(kGetback) = 1; } -void DreamGenContext::openPoolBoss() { +void DreamBase::openPoolBoss() { enterCode(5, 2, 2, 2); data.byte(kGetback) = 1; } -void DreamGenContext::openEden() { +void DreamBase::openEden() { enterCode(2, 8, 6, 5); data.byte(kGetback) = 1; } -void DreamGenContext::openSarters() { +void DreamBase::openSarters() { enterCode(7, 8, 3, 3); data.byte(kGetback) = 1; } -void DreamGenContext::openLouis() { +void DreamBase::openLouis() { enterCode(5, 2, 3, 8); data.byte(kGetback) = 1; } -void DreamGenContext::useWall() { +void DreamBase::useWall() { showFirstUse(); if (data.byte(kManspath) != 3) { @@ -561,7 +561,7 @@ void DreamGenContext::useWall() { } } -void DreamGenContext::useLadder() { +void DreamBase::useLadder() { showFirstUse(); data.byte(kMapx) = data.byte(kMapx) - 11; findRoomInLoc(); @@ -575,7 +575,7 @@ void DreamGenContext::useLadder() { data.byte(kGetback) = 1; } -void DreamGenContext::useLadderB() { +void DreamBase::useLadderB() { showFirstUse(); data.byte(kMapx) = data.byte(kMapx) + 11; findRoomInLoc(); @@ -589,7 +589,7 @@ void DreamGenContext::useLadderB() { data.byte(kGetback) = 1; } -void DreamGenContext::sLabDoorA() { +void DreamBase::slabDoorA() { showFirstUse(); data.byte(kGetback) = 1; data.byte(kWatchspeed) = 1; @@ -609,7 +609,7 @@ void DreamGenContext::sLabDoorA() { } } -void DreamGenContext::sLabDoorB() { +void DreamBase::slabDoorB() { if (data.byte(kDreamnumber) != 1) { // Wrong showFirstUse(); @@ -641,7 +641,7 @@ void DreamGenContext::sLabDoorB() { } } -void DreamGenContext::sLabDoorC() { +void DreamBase::slabDoorC() { showFirstUse(); data.byte(kGetback) = 1; data.byte(kWatchspeed) = 1; @@ -661,7 +661,7 @@ void DreamGenContext::sLabDoorC() { } } -void DreamGenContext::sLabDoorD() { +void DreamBase::slabDoorD() { showFirstUse(); data.byte(kGetback) = 1; data.byte(kWatchspeed) = 1; @@ -681,7 +681,7 @@ void DreamGenContext::sLabDoorD() { } } -void DreamGenContext::sLabDoorE() { +void DreamBase::slabDoorE() { showFirstUse(); data.byte(kGetback) = 1; data.byte(kWatchspeed) = 1; @@ -701,7 +701,7 @@ void DreamGenContext::sLabDoorE() { } } -void DreamGenContext::sLabDoorF() { +void DreamBase::slabDoorF() { showFirstUse(); data.byte(kGetback) = 1; data.byte(kWatchspeed) = 1; @@ -721,7 +721,7 @@ void DreamGenContext::sLabDoorF() { } } -bool DreamGenContext::defaultUseHandler(const char *id) { +bool DreamBase::defaultUseHandler(const char *id) { if (data.byte(kWithobject) == 255) { withWhat(); return true; // event handled @@ -737,7 +737,7 @@ bool DreamGenContext::defaultUseHandler(const char *id) { return false; // continue with the original event } -void DreamGenContext::useChurchGate() { +void DreamBase::useChurchGate() { if (defaultUseHandler("CUTT")) return; @@ -755,7 +755,7 @@ void DreamGenContext::useChurchGate() { turnPathOn(2); // Open church } -void DreamGenContext::useGun() { +void DreamBase::useGun() { if (data.byte(kObjecttype) != kExObjectType) { // gun is not taken @@ -866,7 +866,7 @@ void DreamGenContext::useGun() { } } -void DreamGenContext::useFullCart() { +void DreamBase::useFullCart() { data.byte(kProgresspoints)++; turnAnyPathOn(2, data.byte(kRoomnum) + 6); data.byte(kManspath) = 4; @@ -884,7 +884,7 @@ void DreamGenContext::useFullCart() { data.byte(kGetback) = 1; } -void DreamGenContext::useClearBox() { +void DreamBase::useClearBox() { if (defaultUseHandler("RAIL")) return; @@ -899,7 +899,7 @@ void DreamGenContext::useClearBox() { data.byte(kGetback) = 1; } -void DreamGenContext::openTVDoor() { +void DreamBase::openTVDoor() { if (defaultUseHandler("ULOK")) return; @@ -909,7 +909,7 @@ void DreamGenContext::openTVDoor() { data.byte(kGetback) = 1; } -void DreamGenContext::usePlate() { +void DreamBase::usePlate() { if (data.byte(kWithobject) == 255) { withWhat(); return; @@ -936,7 +936,7 @@ void DreamGenContext::usePlate() { } } -void DreamGenContext::usePlinth() { +void DreamBase::usePlinth() { if (data.byte(kWithobject) == 255) { withWhat(); return; @@ -959,7 +959,7 @@ void DreamGenContext::usePlinth() { } } -void DreamGenContext::useElvDoor() { +void DreamBase::useElvDoor() { if (defaultUseHandler("AXED")) return; @@ -989,7 +989,7 @@ void DreamGenContext::useObject() { useRoutine(); } -void DreamGenContext::useWinch() { +void DreamBase::useWinch() { uint16 contentIndex = checkInside(40, 1); if (contentIndex == kNumexobjects || !compare(contentIndex, kExObjectType, "FUSE")) { // No winch @@ -1013,7 +1013,7 @@ void DreamGenContext::useWinch() { data.byte(kProgresspoints)++; } -void DreamGenContext::useCart() { +void DreamBase::useCart() { if (defaultUseHandler("ROCK")) return; @@ -1048,7 +1048,7 @@ void DreamGenContext::chewy() { data.byte(kGetback) = 1; } -void DreamGenContext::useHole() { +void DreamBase::useHole() { if (defaultUseHandler("HNDA")) return; @@ -1060,7 +1060,7 @@ void DreamGenContext::useHole() { data.byte(kGetback) = 1; } -void DreamGenContext::openHotelDoor() { +void DreamBase::openHotelDoor() { if (defaultUseHandler("KEYA")) return; @@ -1070,7 +1070,7 @@ void DreamGenContext::openHotelDoor() { data.byte(kGetback) = 1; } -void DreamGenContext::openHotelDoor2() { +void DreamBase::openHotelDoor2() { if (defaultUseHandler("KEYA")) return; @@ -1079,7 +1079,7 @@ void DreamGenContext::openHotelDoor2() { putBackObStuff(); } -void DreamGenContext::grafittiDoor() { +void DreamBase::grafittiDoor() { if (defaultUseHandler("APEN")) return; @@ -1087,7 +1087,7 @@ void DreamGenContext::grafittiDoor() { putBackObStuff(); } -void DreamGenContext::usePoolReader() { +void DreamBase::usePoolReader() { if (defaultUseHandler("MEMB")) return; @@ -1103,7 +1103,7 @@ void DreamGenContext::usePoolReader() { } } -void DreamGenContext::useCardReader1() { +void DreamBase::useCardReader1() { if (defaultUseHandler("CSHR")) return; @@ -1125,7 +1125,7 @@ void DreamGenContext::useCardReader1() { } } -void DreamGenContext::useCardReader2() { +void DreamBase::useCardReader2() { if (defaultUseHandler("CSHR")) return; @@ -1152,7 +1152,7 @@ void DreamGenContext::useCardReader2() { } } -void DreamGenContext::useCardReader3() { +void DreamBase::useCardReader3() { if (defaultUseHandler("CSHR")) return; @@ -1174,7 +1174,7 @@ void DreamGenContext::useCardReader3() { } } -void DreamGenContext::useLighter() { +void DreamBase::useLighter() { if (data.byte(kWithobject) == 255) { withWhat(); return; @@ -1191,7 +1191,7 @@ void DreamGenContext::useLighter() { } } -void DreamGenContext::useWire() { +void DreamBase::useWire() { if (data.byte(kWithobject) == 255) { withWhat(); return; @@ -1216,7 +1216,7 @@ void DreamGenContext::useWire() { putBackObStuff(); } -void DreamGenContext::openTomb() { +void DreamBase::openTomb() { data.byte(kProgresspoints)++; showFirstUse(); data.word(kWatchingtime) = 35 * 2; @@ -1227,7 +1227,7 @@ void DreamGenContext::openTomb() { data.byte(kGetback) = 1; } -void DreamGenContext::hotelControl() { +void DreamBase::hotelControl() { if (data.byte(kReallocation) != 21 || data.byte(kMapx) != 33) showSecondUse(); // Not right control else @@ -1236,7 +1236,7 @@ void DreamGenContext::hotelControl() { putBackObStuff(); } -void DreamGenContext::useCooker() { +void DreamBase::useCooker() { if (checkInside(data.byte(kCommand), data.byte(kObjecttype)) == kNumexobjects) showFirstUse(); else @@ -1254,7 +1254,7 @@ void DreamBase::removeFreeObject(uint8 index) { getFreeAd(index)->mapad[0] = 0xFF; } -void DreamGenContext::useDiary() { +void DreamBase::useDiary() { getRidOfReels(); loadIntoTemp("DREAMWEB.G14"); loadTempText("DREAMWEB.T51"); @@ -1300,7 +1300,7 @@ void DreamGenContext::useDiary() { workToScreenM(); } -void DreamGenContext::useControl() { +void DreamBase::useControl() { if (data.byte(kWithobject) == 255) { withWhat(); return; @@ -1353,7 +1353,7 @@ void DreamGenContext::useControl() { } } -void DreamGenContext::useSLab() { +void DreamBase::useSlab() { if (data.byte(kWithobject) == 255) { withWhat(); return; @@ -1385,7 +1385,7 @@ void DreamGenContext::useSLab() { data.byte(kGetback) = 1; } -void DreamGenContext::usePipe() { +void DreamBase::usePipe() { if (data.byte(kWithobject) == 255) { withWhat(); return; @@ -1408,7 +1408,7 @@ void DreamGenContext::usePipe() { } } -void DreamGenContext::useOpenBox() { +void DreamBase::useOpenBox() { if (data.byte(kWithobject) == 255) { withWhat(); return; @@ -1440,7 +1440,7 @@ void DreamGenContext::useOpenBox() { showFirstUse(); } -void DreamGenContext::runTap() { +void DreamBase::runTap() { if (data.byte(kWithobject) == 255) { withWhat(); return; @@ -1467,7 +1467,7 @@ void DreamGenContext::runTap() { putBackObStuff(); } -void DreamGenContext::useAxe() { +void DreamBase::useAxe() { if (data.byte(kReallocation) != 22) { // Not in pool showFirstUse(); @@ -1528,7 +1528,7 @@ void DreamGenContext::useKey() { } } -void DreamGenContext::useHandle() { +void DreamBase::useHandle() { SetObject *object = getSetAd(findSetObject("CUTW")); if (object->mapad[0] == 255) { // Wire not cut @@ -1542,7 +1542,7 @@ void DreamGenContext::useHandle() { data.byte(kGetback) = 1; } -void DreamGenContext::useAltar() { +void DreamBase::useAltar() { if (findExObject("CNDA") == 114 || findExObject("CNDB") == 114) { // Things on altar showFirstUse(); @@ -1590,7 +1590,7 @@ void DreamBase::withWhat() { data.byte(kInvopen) = 2; } -void DreamGenContext::notHeldError() { +void DreamBase::notHeldError() { createPanel(); showPanel(); showMan(); @@ -1602,7 +1602,7 @@ void DreamGenContext::notHeldError() { putBackObStuff(); } -void DreamGenContext::useCashCard() { +void DreamBase::useCashCard() { getRidOfReels(); loadKeypad(); createPanel(); -- cgit v1.2.3 From 42068065b57993c865823ff56e81bd7a87aa0278 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sat, 24 Dec 2011 13:55:56 +0100 Subject: DREAMWEB: Move more functions to DreamBase --- engines/dreamweb/dreambase.h | 14 +++++++++ engines/dreamweb/monitor.cpp | 2 +- engines/dreamweb/object.cpp | 14 ++------- engines/dreamweb/stubs.cpp | 71 ++++++-------------------------------------- engines/dreamweb/stubs.h | 36 ---------------------- engines/dreamweb/use.cpp | 39 ++++++++++++++++++------ 6 files changed, 57 insertions(+), 119 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 720fcb3116..750cffdeac 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -169,6 +169,7 @@ public: void loadPersonal(); void loadNews(); void loadCart(); + void showKeys(); // from newplace.cpp void getUnderCentre(); @@ -190,6 +191,9 @@ public: void deleteExText(uint8 textNum); void purgeALocation(uint8 index); const uint8 *getObTextStart(); + void wornError(); + void makeWorn(DynObject *object); + void dropObject(); // from pathfind.cpp void turnPathOn(uint8 param); @@ -527,6 +531,12 @@ public: void showDiaryPage(); void showDiaryKeys(); void dumpDiaryKeys(); + void useMenu(); + void incRyanPage(); + void edensFlatReminders(); + void dropError(); + void cantDrop(); + void entryAnims(); // from use.cpp void placeFreeObject(uint8 index); @@ -610,6 +620,10 @@ public: void useAltar(); void notHeldError(); void useCashCard(); + void useButtonA(); + void wearWatch(); + void wearShades(); + void useTrainer(); // from vgafades.cpp void clearStartPal(); diff --git a/engines/dreamweb/monitor.cpp b/engines/dreamweb/monitor.cpp index 9a1076a92f..3ee68e897c 100644 --- a/engines/dreamweb/monitor.cpp +++ b/engines/dreamweb/monitor.cpp @@ -426,7 +426,7 @@ void DreamBase::loadCart() { data.word(kTextfile3) = standardLoad("DREAMWEB.T24"); // monitor file 24 } -void DreamGenContext::showKeys() { +void DreamBase::showKeys() { randomAccess(10); scrollMonitor(); monMessage(18); diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index 04081e2f0e..1245187a92 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -66,7 +66,7 @@ bool DreamBase::isItWorn(const DynObject *object) { return (object->id[0] == 'W'-'A') && (object->id[1] == 'E'-'A'); } -void DreamGenContext::wornError() { +void DreamBase::wornError() { data.byte(kCommandtype) = 255; delPointer(); printMessage(76, 21, 57, 240, false); @@ -79,7 +79,7 @@ void DreamGenContext::wornError() { workToScreenM(); } -void DreamGenContext::makeWorn(DynObject *object) { +void DreamBase::makeWorn(DynObject *object) { object->id[0] = 'W'-'A'; object->id[1] = 'E'-'A'; } @@ -461,10 +461,6 @@ void DreamGenContext::setPickup() { workToScreenM(); } -void DreamGenContext::deleteExFrame() { - deleteExFrame(al); -} - void DreamBase::deleteExFrame(uint8 frameNum) { Frame *frame = (Frame *)getSegment(data.word(kExtras)).ptr(kExframedata + sizeof(Frame)*frameNum, sizeof(Frame)); @@ -488,10 +484,6 @@ void DreamBase::deleteExFrame(uint8 frameNum) { } } -void DreamGenContext::deleteExText() { - deleteExText(al); -} - void DreamBase::deleteExText(uint8 textNum) { uint16 offset = getSegment(data.word(kExtras)).word(kExtextdat + 2*textNum); @@ -704,7 +696,7 @@ const uint8 *DreamBase::getObTextStart() { } } -void DreamGenContext::dropObject() { +void DreamBase::dropObject() { if (data.byte(kCommandtype) != 223) { data.byte(kCommandtype) = 223; if (!data.byte(kPickup)) { diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 9a7b66ac72..0f5b6541d7 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -1708,18 +1708,6 @@ uint16 DreamBase::findSetObject(const char *id) { return 128; } -void DreamGenContext::findExObject() { - char id[5]; - id[0] = al; - id[1] = ah; - id[2] = cl; - id[3] = ch; - id[4] = '\0'; - al = findExObject(id); - es = data.word(kExtras); - bx = kExdata + al * 16; -} - uint16 DreamBase::findExObject(const char *id) { for (uint16 index = 0; index < kNumexobjects; index++) { if (objectMatches(getExAd(index), id)) @@ -1729,16 +1717,6 @@ uint16 DreamBase::findExObject(const char *id) { return kNumexobjects; } -void DreamGenContext::isRyanHolding() { - char id[5]; - id[0] = al; - id[1] = ah; - id[2] = cl; - id[3] = ch; - id[4] = '\0'; - flags._z = !isRyanHolding(id); -} - bool DreamBase::isRyanHolding(const char *id) { for (uint16 index = 0; index < kNumexobjects; index++) { DynObject *object = getExAd(index); @@ -1859,13 +1837,6 @@ void DreamBase::hangOnP(uint16 count) { data.byte(kPointermode) = 0; } -void DreamGenContext::findNextColon() { - const uint8 *initialString = es.ptr(si, 0); - const uint8 *string = initialString; - al = findNextColon(&string); - si += (string - initialString); -} - uint8 DreamBase::findNextColon(const uint8 **string) { uint8 c; do { @@ -2572,7 +2543,7 @@ void DreamBase::dumpMenu() { multiDump(kMenux, kMenuy, 48, 48); } -void DreamGenContext::useMenu() { +void DreamBase::useMenu() { getRidOfReels(); loadMenu(); createPanel(); @@ -3296,7 +3267,7 @@ void DreamBase::diaryKeyN() { data.byte(kDiarypage) = 0; } -void DreamGenContext::dropError() { +void DreamBase::dropError() { data.byte(kCommandtype) = 255; delPointer(); printMessage(76, 21, 56, 240, 240 & 1); @@ -3309,7 +3280,7 @@ void DreamGenContext::dropError() { workToScreenM(); } -void DreamGenContext::cantDrop() { +void DreamBase::cantDrop() { data.byte(kCommandtype) = 255; delPointer(); printMessage(76, 21, 24, 240, 240 & 1); @@ -3344,26 +3315,6 @@ void DreamBase::getBack1() { } } -void DreamGenContext::useButtonA() { - if (!isSetObOnMap(95)) { - showFirstUse(); - turnAnyPathOn(0, data.byte(kRoomnum) - 1); - removeSetObject(9); - placeSetObject(95); - data.word(kWatchingtime) = 15 * 2; - data.word(kReeltowatch) = 71; - data.word(kEndwatchreel) = 85; - data.byte(kWatchspeed) = 1; - data.byte(kSpeedcount) = 1; - data.byte(kGetback) = 1; - data.byte(kProgresspoints)++; - } else { - // Done this bit - showSecondUse(); - putBackObStuff(); - } -} - void DreamBase::autoAppear() { if (data.byte(kLocation) == 32) { // In alley @@ -3417,10 +3368,6 @@ void DreamBase::quitKey() { data.byte(kGetback) = 1; } -void DreamGenContext::setupTimedUse() { - DreamBase::setupTimedUse(al, cx, dx, bl, bh); -} - void DreamBase::setupTimedUse(uint16 textIndex, uint16 countToTimed, uint16 timeCount, byte x, byte y) { if (data.word(kTimecount) != 0) return; // can't setup @@ -3463,7 +3410,7 @@ void DreamBase::entryTexts() { } } -void DreamGenContext::entryAnims() { +void DreamBase::entryAnims() { data.word(kReeltowatch) = 0xFFFF; data.byte(kWatchmode) = (byte)-1; @@ -3731,7 +3678,7 @@ void DreamBase::showDiaryKeys() { showDiaryPage(); } -void DreamGenContext::edensFlatReminders() { +void DreamBase::edensFlatReminders() { if (data.byte(kReallocation) != 24 || data.byte(kMapx) != 44) return; // not in Eden's lift @@ -3740,18 +3687,18 @@ void DreamGenContext::edensFlatReminders() { uint16 exObjextIndex = findExObject("CSHR"); if (!isRyanHolding("DKEY") || exObjextIndex == kNumexobjects) { - DreamBase::setupTimedUse(50, 48, 8, 54, 70); // forgot something + setupTimedUse(50, 48, 8, 54, 70); // forgot something return; } DynObject *object = getExAd(exObjextIndex); if (object->mapad[0] != 4) { - DreamBase::setupTimedUse(50, 48, 8, 54, 70); // forgot something + setupTimedUse(50, 48, 8, 54, 70); // forgot something return; } else if (object->mapad[1] != 255) { if (!compare(object->mapad[1], object->mapad[0], "PURS")) { - DreamBase::setupTimedUse(50, 48, 8, 54, 70); // forgot something + setupTimedUse(50, 48, 8, 54, 70); // forgot something return; } } @@ -3759,7 +3706,7 @@ void DreamGenContext::edensFlatReminders() { data.byte(kProgresspoints)++; // got card } -void DreamGenContext::incRyanPage() { +void DreamBase::incRyanPage() { if (data.byte(kCommandtype) != 222) { data.byte(kCommandtype) = 222; commandOnly(31); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index da14962a27..b24185b82d 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -103,8 +103,6 @@ bool isItWorn(const DynObject *object) { return DreamBase::isItWorn(object); } - void wornError(); - void makeWorn(DynObject *object); void obToInv(); void obToInv(uint8 index, uint8 flag, uint16 x, uint16 y) { DreamBase::obToInv(index, flag, x, y); @@ -114,11 +112,6 @@ void hangOn(uint16 frameCount) { DreamBase::hangOn(frameCount); } - uint8 findNextColon(const uint8 **string) { - return DreamBase::findNextColon(string); - } - void findNextColon(); - const uint8 *getObTextStartCPP(); void showCity(); uint16 getPersFrame(uint8 index); void convIcons(); @@ -127,7 +120,6 @@ void transferText(); void watchCount(); void readSetData(); - void useMenu(); void useMon(); void makeCaps(); byte makeCaps(byte c) { @@ -156,8 +148,6 @@ void useElevator1(); void useKey(); void useObject(); - void wearWatch(); - void wearShades(); void singleKey(uint8 key, uint16 x, uint16 y); uint8 nextSymbol(uint8 symbol); void showSymbol(); @@ -177,7 +167,6 @@ void afterIntroRoom(); void gettingShot(); void allPointer(); - void useTrainer(); void chewy(); void delEverything(); void errorMessage1(); @@ -201,28 +190,15 @@ void hangOnPQ(); void showGun(); void endGame(); - void dropError(); - void cantDrop(); void newPlace(); void monkSpeaking(); void rollEndCredits2(); - void useButtonA(); - void setupTimedUse(); - void entryAnims(); void triggerMessage(uint16 index); void processTrigger(); void updateSymbolTop(); void updateSymbolBot(); void runEndSeq(); bool execCommand(); - void findExObject(); - uint16 findExObject(const char *id) { - return DreamBase::findExObject(id); - } - void isRyanHolding(); - bool isRyanHolding(const char *id) { - return DreamBase::isRyanHolding(id); - } void getOpenedSize(); byte getOpenedSizeCPP(); void openOb(); @@ -232,26 +208,14 @@ void findInvPos(); uint16 findInvPosCPP(); void setPickup(); - void showKeys(); void getKeyAndLogo(); void deleteExObject(); void deleteExObject(uint8 index) { DreamBase::deleteExObject(index); } - void deleteExFrame(); - void deleteExFrame(uint8 frameNum) { - DreamBase::deleteExFrame(frameNum); - } - void deleteExText(); - void deleteExText(uint8 textNum) { - DreamBase::deleteExText(textNum); - } void signOn(); void lookAtPlace(); void inToInv(); void outOfInv(); - void edensFlatReminders(); - void incRyanPage(); - void dropObject(); #endif diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp index bbcf028b78..47c9ae62b8 100644 --- a/engines/dreamweb/use.cpp +++ b/engines/dreamweb/use.cpp @@ -46,7 +46,7 @@ void DreamGenContext::useRoutine() { { &DreamBase::useElevator5, "ELVF" }, { &DreamBase::useChurchGate, "CGAT" }, { &DreamGenContext::useStereo, "REMO" }, - { &DreamGenContext::useButtonA, "BUTA" }, + { &DreamBase::useButtonA, "BUTA" }, { &DreamBase::useWinch, "CBOX" }, { &DreamBase::useLighter, "LITE" }, { &DreamBase::usePlate, "PLAT" }, @@ -61,7 +61,7 @@ void DreamGenContext::useRoutine() { { &DreamBase::useCardReader2, "CRBB" }, { &DreamBase::useCardReader3, "CRCC" }, { &DreamBase::sitDownInBar, "SEAT" }, - { &DreamGenContext::useMenu, "MENU" }, + { &DreamBase::useMenu, "MENU" }, { &DreamBase::useCooker, "COOK" }, { &DreamBase::callHotelLift, "ELCA" }, { &DreamBase::callEdensLift, "EDCA" }, @@ -75,9 +75,9 @@ void DreamGenContext::useRoutine() { { &DreamBase::openYourNeighbour, "ENTC" }, { &DreamBase::openEden, "ENTD" }, { &DreamBase::openSarters, "ENTH" }, - { &DreamGenContext::wearWatch, "WWAT" }, + { &DreamBase::wearWatch, "WWAT" }, { &DreamBase::usePoolReader, "POOL" }, - { &DreamGenContext::wearShades, "WSHD" }, + { &DreamBase::wearShades, "WSHD" }, { &DreamBase::grafittiDoor, "GRAF" }, { &DreamBase::trapDoor, "TRAP" }, { &DreamBase::edensCDPlayer, "CDPE" }, @@ -97,8 +97,8 @@ void DreamGenContext::useRoutine() { { &DreamBase::useBalcony, "BALC" }, { &DreamBase::useWindow, "WIND" }, { &DreamBase::viewFolder, "PAPR" }, - { &DreamGenContext::useTrainer, "UWTA" }, - { &DreamGenContext::useTrainer, "UWTB" }, + { &DreamBase::useTrainer, "UWTA" }, + { &DreamBase::useTrainer, "UWTB" }, { &DreamGenContext::enterSymbol, "STAT" }, { &DreamBase::openTomb, "TLID" }, { &DreamBase::useSlab, "SLAB" }, @@ -355,7 +355,7 @@ void DreamBase::useRailing() { data.byte(kMandead) = 4; } -void DreamGenContext::wearWatch() { +void DreamBase::wearWatch() { if (data.byte(kWatchon) == 1) { // Already wearing watch showSecondUse(); @@ -369,7 +369,7 @@ void DreamGenContext::wearWatch() { } } -void DreamGenContext::wearShades() { +void DreamBase::wearShades() { if (data.byte(kShadeson) == 1) { // Already wearing shades showSecondUse(); @@ -1027,7 +1027,7 @@ void DreamBase::useCart() { data.byte(kGetback) = 1; } -void DreamGenContext::useTrainer() { +void DreamBase::useTrainer() { uint8 dummy; DynObject *object = (DynObject *)getAnyAd(&dummy, &dummy); if (object->mapad[0] != 4) { @@ -1684,4 +1684,25 @@ void DreamBase::showPuzText(uint16 command, uint16 count) { hangOnP(count); } +void DreamBase::useButtonA() { + if (!isSetObOnMap(95)) { + showFirstUse(); + turnAnyPathOn(0, data.byte(kRoomnum) - 1); + removeSetObject(9); + placeSetObject(95); + data.word(kWatchingtime) = 15 * 2; + data.word(kReeltowatch) = 71; + data.word(kEndwatchreel) = 85; + data.byte(kWatchspeed) = 1; + data.byte(kSpeedcount) = 1; + data.byte(kGetback) = 1; + data.byte(kProgresspoints)++; + } else { + // Done this bit + showSecondUse(); + putBackObStuff(); + } +} + + } // End of namespace DreamGen -- cgit v1.2.3 From 854928f09a2d839c667848c2b18eb7e6b3dd6c22 Mon Sep 17 00:00:00 2001 From: Tobias Gunkel Date: Sat, 24 Dec 2011 14:29:06 +0100 Subject: SCUMM: Rename player_appleII.* -> player_apple2.* to have the filenames lower case --- engines/scumm/player_apple2.cpp | 500 +++++++++++++++++++++++++++++++++++++++ engines/scumm/player_apple2.h | 298 +++++++++++++++++++++++ engines/scumm/player_appleII.cpp | 500 --------------------------------------- engines/scumm/player_appleII.h | 298 ----------------------- engines/scumm/scumm.cpp | 2 +- 5 files changed, 799 insertions(+), 799 deletions(-) create mode 100644 engines/scumm/player_apple2.cpp create mode 100644 engines/scumm/player_apple2.h delete mode 100644 engines/scumm/player_appleII.cpp delete mode 100644 engines/scumm/player_appleII.h (limited to 'engines') diff --git a/engines/scumm/player_apple2.cpp b/engines/scumm/player_apple2.cpp new file mode 100644 index 0000000000..a8e150caa9 --- /dev/null +++ b/engines/scumm/player_apple2.cpp @@ -0,0 +1,500 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "engines/engine.h" +#include "scumm/player_apple2.h" +#include "scumm/scumm.h" + +namespace Scumm { + +/************************************ + * Apple-II sound-resource parsers + ************************************/ + +/* + * SoundFunction1: frequency up/down + */ +class AppleII_SoundFunction1_FreqUpDown : public AppleII_SoundFunction { +public: + virtual void init(Player_AppleII *player, const byte *params) { + _player = player; + _delta = params[0]; + _count = params[1]; + _interval = params[2]; + _limit = params[3]; + _decInterval = (params[4] >= 0x40); + } + + virtual bool update() { // D085 + if (_decInterval) { + do { + _update(_interval, _count); + _interval -= _delta; + } while (_interval >= _limit); + } else { + do { + _update(_interval, _count); + _interval += _delta; + } while (_interval < _limit); + } + return true; + } + +private: + void _update(int interval /*a*/, int count /*y*/) { // D076 + assert(interval > 0); // 0 == 256? + assert(count > 0); // 0 == 256? + + for (; count >= 0; --count) { + _player->speakerToggle(); + _player->generateSamples(17 + 5 * interval); + } + } + +protected: + int _delta; + int _count; + byte _interval; // must be unsigned byte ("interval < delta" possible) + int _limit; + bool _decInterval; +}; + +/* + * SoundFunction2: symmetric wave (~) + */ +class AppleII_SoundFunction2_SymmetricWave : public AppleII_SoundFunction { +public: + virtual void init(Player_AppleII *player, const byte *params) { + _player = player; + _params = params; + _pos = 1; + } + + virtual bool update() { // D0D6 + // while (pos = 1; pos < 256; ++pos) + if (_pos < 256) { + byte interval = _params[_pos]; + if (interval == 0xFF) + return true; + _update(interval, _params[0] /*, LD12F=interval*/); + + ++_pos; + return false; + } + return true; + } + +private: + void _update(int interval /*a*/, int count) { // D0EF + if (interval == 0xFE) { + _player->wait(interval, 10); + } else { + assert(count > 0); // 0 == 256? + assert(interval > 0); // 0 == 256? + + int a = (interval >> 3) + count; + for (int y = a; y > 0; --y) { + _player->generateSamples(1292 - 5*interval); + _player->speakerToggle(); + + _player->generateSamples(1287 - 5*interval); + _player->speakerToggle(); + } + } + } + +protected: + const byte *_params; + int _pos; +}; + +/* + * SoundFunction3: asymmetric wave (__-) + */ +class AppleII_SoundFunction3_AsymmetricWave : public AppleII_SoundFunction { +public: + virtual void init(Player_AppleII *player, const byte *params) { + _player = player; + _params = params; + _pos = 1; + } + + virtual bool update() { // D132 + // while (pos = 1; pos < 256; ++pos) + if (_pos < 256) { + byte interval = _params[_pos]; + if (interval == 0xFF) + return true; + _update(interval, _params[0]); + + ++_pos; + return false; + } + return true; + } + +private: + void _update(int interval /*a*/, int count /*LD12D*/) { // D14B + if (interval == 0xFE) { + _player->wait(interval, 70); + } else { + assert(interval > 0); // 0 == 256? + assert(count > 0); // 0 == 256? + + for (int y = count; y > 0; --y) { + _player->generateSamples(1289 - 5*interval); + _player->speakerToggle(); + } + } + } + +protected: + const byte *_params; + int _pos; +}; + +/* + * SoundFunction4: polyphone (2 voices) + */ +class AppleII_SoundFunction4_Polyphone : public AppleII_SoundFunction { +public: + virtual void init(Player_AppleII *player, const byte *params) { + _player = player; + _params = params; + _updateRemain1 = 80; + _updateRemain2 = 10; + _count = 0; + } + + virtual bool update() { // D170 + // while (_params[0] != 0x01) + if (_params[0] != 0x01) { + if (_count == 0) // prepare next loop + nextLoop(_params[0], _params[1], _params[2]); + if (loopIteration()) // loop finished -> fetch next parameter set + _params += 3; + return false; + } + return true; + } + +private: + /* + * prepare for next parameter set loop + */ + void nextLoop(byte param0, byte param1, byte param2) { // LD182 + _count = (-param2 << 8) | 0x3; + + _bitmask1 = 0x3; + _bitmask2 = 0x3; + + _updateInterval2 = param0; + if (_updateInterval2 == 0) + _bitmask2 = 0x0; + + _updateInterval1 = param1; + if (_updateInterval1 == 0) { + _bitmask1 = 0x0; + if (_bitmask2 != 0) { + _bitmask1 = _bitmask2; + _bitmask2 = 0; + _updateInterval1 = _updateInterval2; + } + } + + _speakerShiftReg = 0; + } + + /* + * perform one loop iteration + * Returns true if loop finished + */ + bool loopIteration() { // D1A2 + --_updateRemain1; + --_updateRemain2; + + if (_updateRemain2 == 0) { + _updateRemain2 = _updateInterval2; + // use only first voice's data (bitmask1) if both voices are triggered + if (_updateRemain1 != 0) { + _speakerShiftReg ^= _bitmask2; + } + } + + if (_updateRemain1 == 0) { + _updateRemain1 = _updateInterval1; + _speakerShiftReg ^= _bitmask1; + } + + if (_speakerShiftReg & 0x1) + _player->speakerToggle(); + _speakerShiftReg >>= 1; + _player->generateSamples(42); /* actually 42.5 */ + + ++_count; + return (_count == 0); + } + +protected: + const byte *_params; + + byte _updateRemain1; + byte _updateRemain2; + + uint16 _count; + byte _bitmask1; + byte _bitmask2; + byte _updateInterval1; + byte _updateInterval2; + byte _speakerShiftReg; +}; + +/* + * SoundFunction5: periodic noise + */ +class AppleII_SoundFunction5_Noise : public AppleII_SoundFunction { +public: + virtual void init(Player_AppleII *player, const byte *params) { + _player = player; + _index = 0; + _param0 = params[0]; + assert(_param0 > 0); + } + + virtual bool update() { // D222 + const byte noiseMask[] = { + 0x3F, 0x3F, 0x7F, 0x7F, 0x7F, 0x7F, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F + }; + + // while (i = 0; i < 10; ++i) + if (_index < 10) { + int count = _param0; + do { + _update(noise() & noiseMask[_index], 1); + --count; + } while (count > 0); + + ++_index; + return false; + } + + return true; + } + +private: + void _update(int interval /*a*/, int count) { // D270 + assert(count > 0); // 0 == 256? + if (interval == 0) + interval = 256; + + for (int i = count; i > 0; --i) { + _player->generateSamples(10 + 5*interval); + _player->speakerToggle(); + + _player->generateSamples(5 + 5*interval); + _player->speakerToggle(); + } + } + + byte /*a*/ noise() { // D261 + static int pos = 0; // initial value? + byte result = _noiseTable[pos]; + pos = (pos + 1) % 256; + return result; + } + +protected: + int _index; + int _param0; + +private: + static const byte _noiseTable[256]; +}; + +// LD000[loc] ^ LD00A[loc] +const byte AppleII_SoundFunction5_Noise::_noiseTable[256] = { + 0x65, 0x1b, 0xda, 0x11, 0x61, 0xe5, 0x77, 0x57, 0x92, 0xc8, 0x51, 0x1c, 0xd4, 0x91, 0x62, 0x63, + 0x00, 0x38, 0x57, 0xd5, 0x18, 0xd8, 0xdc, 0x40, 0x03, 0x86, 0xd3, 0x2f, 0x10, 0x11, 0xd8, 0x3c, + 0xbe, 0x00, 0x19, 0xc5, 0xd2, 0xc3, 0xca, 0x34, 0x00, 0x28, 0xbf, 0xb9, 0x18, 0x20, 0x01, 0xcc, + 0xda, 0x08, 0xbc, 0x75, 0x7c, 0xb0, 0x8d, 0xe0, 0x09, 0x18, 0xbf, 0x5d, 0xe9, 0x8c, 0x75, 0x64, + 0xe5, 0xb5, 0x5d, 0xe0, 0xb7, 0x7d, 0xe9, 0x8c, 0x55, 0x65, 0xc5, 0xb5, 0x5d, 0xd8, 0x09, 0x0d, + 0x64, 0xf0, 0xf0, 0x08, 0x63, 0x03, 0x00, 0x55, 0x35, 0xc0, 0x00, 0x20, 0x74, 0xa5, 0x1e, 0xe3, + 0x00, 0x06, 0x3c, 0x52, 0xd1, 0x70, 0xd0, 0x57, 0x02, 0xf0, 0x00, 0xb6, 0xfc, 0x02, 0x11, 0x9a, + 0x3b, 0xc8, 0x38, 0xdf, 0x1a, 0xb0, 0xd1, 0xb8, 0xd0, 0x18, 0x8a, 0x4a, 0xea, 0x1b, 0x12, 0x5d, + 0x29, 0x58, 0xd8, 0x43, 0xb8, 0x2d, 0xd2, 0x61, 0x10, 0x3c, 0x0c, 0x5d, 0x1b, 0x61, 0x10, 0x3c, + 0x0a, 0x5d, 0x1d, 0x61, 0x10, 0x3c, 0x0b, 0x19, 0x88, 0x21, 0xc0, 0x21, 0x07, 0x00, 0x65, 0x62, + 0x08, 0xe9, 0x36, 0x40, 0x20, 0x41, 0x06, 0x00, 0x20, 0x00, 0x00, 0xed, 0xa3, 0x00, 0x88, 0x06, + 0x98, 0x01, 0x5d, 0x7f, 0x02, 0x1d, 0x78, 0x03, 0x60, 0xcb, 0x3a, 0x01, 0xbd, 0x78, 0x02, 0x5d, + 0x7e, 0x03, 0x1d, 0xf5, 0xa6, 0x40, 0x81, 0xb4, 0xd0, 0x8d, 0xd3, 0xd0, 0x6d, 0xd5, 0x61, 0x48, + 0x61, 0x4d, 0xd1, 0xc8, 0xb1, 0xd8, 0x69, 0xff, 0x61, 0xd9, 0xed, 0xa0, 0xfe, 0x19, 0x91, 0x37, + 0x19, 0x37, 0x00, 0xf1, 0x00, 0x01, 0x1f, 0x00, 0xad, 0xc1, 0x01, 0x01, 0x2e, 0x00, 0x40, 0xc6, + 0x7a, 0x9b, 0x95, 0x43, 0xfc, 0x18, 0xd2, 0x9e, 0x2a, 0x5a, 0x4b, 0x2a, 0xb6, 0x87, 0x30, 0x6c +}; + +/************************************ + * Apple-II player + ************************************/ + +Player_AppleII::Player_AppleII(ScummEngine *scumm, Audio::Mixer *mixer) + : _mixer(mixer), _vm(scumm), _soundFunc(0) { + resetState(); + setSampleRate(_mixer->getOutputRate()); + _mixer->playStream(Audio::Mixer::kPlainSoundType, &_soundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true); +} + +Player_AppleII::~Player_AppleII() { + _mixer->stopHandle(_soundHandle); + delete _soundFunc; +} + +void Player_AppleII::resetState() { + _soundNr = 0; + _type = 0; + _loop = 0; + _params = NULL; + _speakerState = 0; + delete _soundFunc; + _soundFunc = 0; + _sampleConverter.reset(); +} + +void Player_AppleII::startSound(int nr) { + Common::StackLock lock(_mutex); + + byte *data = _vm->getResourceAddress(rtSound, nr); + assert(data); + byte *ptr1 = data + 4; + + resetState(); + _soundNr = nr; + _type = ptr1[0]; + _loop = ptr1[1]; + _params = &ptr1[2]; + + switch (_type) { + case 0: // empty (nothing to play) + resetState(); + return; + case 1: + _soundFunc = new AppleII_SoundFunction1_FreqUpDown(); + break; + case 2: + _soundFunc = new AppleII_SoundFunction2_SymmetricWave(); + break; + case 3: + _soundFunc = new AppleII_SoundFunction3_AsymmetricWave(); + break; + case 4: + _soundFunc = new AppleII_SoundFunction4_Polyphone(); + break; + case 5: + _soundFunc = new AppleII_SoundFunction5_Noise(); + break; + } + _soundFunc->init(this, _params); + + assert(_loop > 0); + + debug(4, "startSound %d: type %d, loop %d", + nr, _type, _loop); +} + +bool Player_AppleII::updateSound() { + if (!_soundFunc) + return false; + + if (_soundFunc->update()) { + --_loop; + if (_loop <= 0) { + delete _soundFunc; + _soundFunc = 0; + } else { + // reset function state on each loop + _soundFunc->init(this, _params); + } + } + + return true; +} + +void Player_AppleII::stopAllSounds() { + Common::StackLock lock(_mutex); + resetState(); +} + +void Player_AppleII::stopSound(int nr) { + Common::StackLock lock(_mutex); + if (_soundNr == nr) { + resetState(); + } +} + +int Player_AppleII::getSoundStatus(int nr) const { + Common::StackLock lock(_mutex); + return (_soundNr == nr); +} + +int Player_AppleII::getMusicTimer() { + /* Apple-II sounds are synchronous -> no music timer */ + return 0; +} + +int Player_AppleII::readBuffer(int16 *buffer, const int numSamples) { + Common::StackLock lock(_mutex); + + if (!_soundNr) + return 0; + + int samplesLeft = numSamples; + do { + int nSamplesRead = _sampleConverter.readSamples(buffer, samplesLeft); + samplesLeft -= nSamplesRead; + buffer += nSamplesRead; + } while ((samplesLeft > 0) && updateSound()); + + // reset state if sound is played completely + if (!_soundFunc && (_sampleConverter.availableSize() == 0)) + resetState(); + + return numSamples - samplesLeft; +} + +/************************************ + * Apple-II sound-resource helpers + ************************************/ + +// toggle speaker on/off +void Player_AppleII::speakerToggle() { + _speakerState ^= 0x1; +} + +void Player_AppleII::generateSamples(int cycles) { + _sampleConverter.addCycles(_speakerState, cycles); +} + +void Player_AppleII::wait(int interval, int count /*y*/) { + assert(count > 0); // 0 == 256? + assert(interval > 0); // 0 == 256? + generateSamples(11 + count*(8 + 5 * interval)); +} + +} // End of namespace Scumm diff --git a/engines/scumm/player_apple2.h b/engines/scumm/player_apple2.h new file mode 100644 index 0000000000..9e97ab0c89 --- /dev/null +++ b/engines/scumm/player_apple2.h @@ -0,0 +1,298 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef SCUMM_PLAYER_APPLEII_H +#define SCUMM_PLAYER_APPLEII_H + +#include "common/mutex.h" +#include "common/scummsys.h" +#include "common/memstream.h" +#include "scumm/music.h" +#include "audio/audiostream.h" +#include "audio/mixer.h" +#include "audio/softsynth/sid.h" + +namespace Scumm { + +class ScummEngine; + +/* + * Optimized for use with periodical read/write phases when the buffer + * is filled in a write phase and completely read in a read phase. + * The growing strategy is optimized for repeated small (e.g. 2 bytes) + * single writes resulting in large buffers + * (avg.: 4KB, max: 18KB @ 16bit/22.050kHz (MM sound21)). + */ +class SampleBuffer { +public: + SampleBuffer() : _data(0) { + clear(); + } + + ~SampleBuffer() { + free(_data); + } + + void clear() { + free(_data); + _data = 0; + _capacity = 0; + _writePos = 0; + _readPos = 0; + } + + void ensureFree(uint32 needed) { + // if data was read completely, reset read/write pos to front + if ((_writePos != 0) && (_writePos == _readPos)) { + _writePos = 0; + _readPos = 0; + } + + // check for enough space at end of buffer + uint32 freeEndCnt = _capacity - _writePos; + if (needed <= freeEndCnt) + return; + + uint32 avail = availableSize(); + + // check for enough space at beginning and end of buffer + if (needed <= _readPos + freeEndCnt) { + // move unread data to front of buffer + memmove(_data, _data + _readPos, avail); + _writePos = avail; + _readPos = 0; + } else { // needs a grow + byte *old_data = _data; + uint32 new_len = avail + needed; + + _capacity = new_len + 2048; + _data = (byte *)malloc(_capacity); + + if (old_data) { + // copy old unread data to front of new buffer + memcpy(_data, old_data + _readPos, avail); + free(old_data); + _writePos = avail; + _readPos = 0; + } + } + } + + uint32 availableSize() const { + if (_readPos >= _writePos) + return 0; + return _writePos - _readPos; + } + + virtual uint32 write(const void *dataPtr, uint32 dataSize) { + ensureFree(dataSize); + memcpy(_data + _writePos, dataPtr, dataSize); + _writePos += dataSize; + return dataSize; + } + + uint32 read(byte *dataPtr, uint32 dataSize) { + uint32 avail = availableSize(); + if (avail == 0) + return 0; + if (dataSize > avail) + dataSize = avail; + memcpy(dataPtr, _data + _readPos, dataSize); + _readPos += dataSize; + return dataSize; + } + +private: + uint32 _writePos; + uint32 _readPos; + uint32 _capacity; + byte *_data; +}; + +// CPU_CLOCK according to AppleWin +static const double APPLEII_CPU_CLOCK = 1020484.5; // ~ 1.02 MHz + +/* + * Converts the 1-bit speaker state values into audio samples. + * This is done by aggregation of the speaker states at each + * CPU cycle in a sampling period into an audio sample. + */ +class SampleConverter { +private: + void addSampleToBuffer(int sample) { + int16 value = sample * _volume / _maxVolume; + _buffer.write(&value, sizeof(value)); + } + +public: + SampleConverter() : + _cyclesPerSampleFP(0), + _missingCyclesFP(0), + _sampleCyclesSumFP(0), + _volume(_maxVolume) + {} + + ~SampleConverter() {} + + void reset() { + _missingCyclesFP = 0; + _sampleCyclesSumFP = 0; + _buffer.clear(); + } + + uint32 availableSize() const { + return _buffer.availableSize(); + } + + void setMusicVolume(int vol) { + assert(vol >= 0 && vol <= _maxVolume); + _volume = vol; + } + + void setSampleRate(int rate) { + /* ~46 CPU cycles per sample @ 22.05kHz */ + _cyclesPerSampleFP = APPLEII_CPU_CLOCK * (1 << PREC_SHIFT) / rate; + reset(); + } + + void addCycles(byte level, const int cycles) { + /* convert to fixed precision floats */ + int cyclesFP = cycles << PREC_SHIFT; + + // step 1: if cycles are left from the last call, process them first + if (_missingCyclesFP > 0) { + int n = (_missingCyclesFP < cyclesFP) ? _missingCyclesFP : cyclesFP; + if (level) + _sampleCyclesSumFP += n; + cyclesFP -= n; + _missingCyclesFP -= n; + if (_missingCyclesFP == 0) { + addSampleToBuffer(2*32767 * _sampleCyclesSumFP / _cyclesPerSampleFP - 32767); + } else { + return; + } + } + + _sampleCyclesSumFP = 0; + + // step 2: process blocks of cycles fitting into a whole sample + while (cyclesFP >= _cyclesPerSampleFP) { + addSampleToBuffer(level ? 32767 : -32767); + cyclesFP -= _cyclesPerSampleFP; + } + + // step 3: remember cycles left for next call + if (cyclesFP > 0) { + _missingCyclesFP = _cyclesPerSampleFP - cyclesFP; + if (level) + _sampleCyclesSumFP = cyclesFP; + } + } + + uint32 readSamples(void *buffer, int numSamples) { + return _buffer.read((byte*)buffer, numSamples * 2) / 2; + } + +private: + static const int PREC_SHIFT = 7; + +private: + int _cyclesPerSampleFP; /* (fixed precision) */ + int _missingCyclesFP; /* (fixed precision) */ + int _sampleCyclesSumFP; /* (fixed precision) */ + int _volume; /* 0 - 256 */ + static const int _maxVolume = 256; + SampleBuffer _buffer; +}; + +class Player_AppleII; + +class AppleII_SoundFunction { +public: + AppleII_SoundFunction() {} + virtual ~AppleII_SoundFunction() {} + virtual void init(Player_AppleII *player, const byte *params) = 0; + /* returns true if finished */ + virtual bool update() = 0; +protected: + Player_AppleII *_player; +}; + +class Player_AppleII : public Audio::AudioStream, public MusicEngine { +public: + Player_AppleII(ScummEngine *scumm, Audio::Mixer *mixer); + virtual ~Player_AppleII(); + + virtual void setMusicVolume(int vol) { _sampleConverter.setMusicVolume(vol); } + void setSampleRate(int rate) { + _sampleRate = rate; + _sampleConverter.setSampleRate(rate); + } + void startMusic(int songResIndex); + virtual void startSound(int sound); + virtual void stopSound(int sound); + virtual void stopAllSounds(); + virtual int getSoundStatus(int sound) const; + virtual int getMusicTimer(); + + // AudioStream API + int readBuffer(int16 *buffer, const int numSamples); + bool isStereo() const { return false; } + bool endOfData() const { return false; } + int getRate() const { return _sampleRate; } + +public: + void speakerToggle(); + void generateSamples(int cycles); + void wait(int interval, int count); + +private: + // sound number + int _soundNr; + // type of sound + int _type; + // number of loops left + int _loop; + // global sound param list + const byte *_params; + // speaker toggle state (0 / 1) + byte _speakerState; + // sound function + AppleII_SoundFunction *_soundFunc; + // cycle to sample converter + SampleConverter _sampleConverter; + +private: + ScummEngine *_vm; + Audio::Mixer *_mixer; + Audio::SoundHandle _soundHandle; + int _sampleRate; + Common::Mutex _mutex; + +private: + void resetState(); + bool updateSound(); +}; + +} // End of namespace Scumm + +#endif diff --git a/engines/scumm/player_appleII.cpp b/engines/scumm/player_appleII.cpp deleted file mode 100644 index f310e3e546..0000000000 --- a/engines/scumm/player_appleII.cpp +++ /dev/null @@ -1,500 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "engines/engine.h" -#include "scumm/player_appleII.h" -#include "scumm/scumm.h" - -namespace Scumm { - -/************************************ - * Apple-II sound-resource parsers - ************************************/ - -/* - * SoundFunction1: frequency up/down - */ -class AppleII_SoundFunction1_FreqUpDown : public AppleII_SoundFunction { -public: - virtual void init(Player_AppleII *player, const byte *params) { - _player = player; - _delta = params[0]; - _count = params[1]; - _interval = params[2]; - _limit = params[3]; - _decInterval = (params[4] >= 0x40); - } - - virtual bool update() { // D085 - if (_decInterval) { - do { - _update(_interval, _count); - _interval -= _delta; - } while (_interval >= _limit); - } else { - do { - _update(_interval, _count); - _interval += _delta; - } while (_interval < _limit); - } - return true; - } - -private: - void _update(int interval /*a*/, int count /*y*/) { // D076 - assert(interval > 0); // 0 == 256? - assert(count > 0); // 0 == 256? - - for (; count >= 0; --count) { - _player->speakerToggle(); - _player->generateSamples(17 + 5 * interval); - } - } - -protected: - int _delta; - int _count; - byte _interval; // must be unsigned byte ("interval < delta" possible) - int _limit; - bool _decInterval; -}; - -/* - * SoundFunction2: symmetric wave (~) - */ -class AppleII_SoundFunction2_SymmetricWave : public AppleII_SoundFunction { -public: - virtual void init(Player_AppleII *player, const byte *params) { - _player = player; - _params = params; - _pos = 1; - } - - virtual bool update() { // D0D6 - // while (pos = 1; pos < 256; ++pos) - if (_pos < 256) { - byte interval = _params[_pos]; - if (interval == 0xFF) - return true; - _update(interval, _params[0] /*, LD12F=interval*/); - - ++_pos; - return false; - } - return true; - } - -private: - void _update(int interval /*a*/, int count) { // D0EF - if (interval == 0xFE) { - _player->wait(interval, 10); - } else { - assert(count > 0); // 0 == 256? - assert(interval > 0); // 0 == 256? - - int a = (interval >> 3) + count; - for (int y = a; y > 0; --y) { - _player->generateSamples(1292 - 5*interval); - _player->speakerToggle(); - - _player->generateSamples(1287 - 5*interval); - _player->speakerToggle(); - } - } - } - -protected: - const byte *_params; - int _pos; -}; - -/* - * SoundFunction3: asymmetric wave (__-) - */ -class AppleII_SoundFunction3_AsymmetricWave : public AppleII_SoundFunction { -public: - virtual void init(Player_AppleII *player, const byte *params) { - _player = player; - _params = params; - _pos = 1; - } - - virtual bool update() { // D132 - // while (pos = 1; pos < 256; ++pos) - if (_pos < 256) { - byte interval = _params[_pos]; - if (interval == 0xFF) - return true; - _update(interval, _params[0]); - - ++_pos; - return false; - } - return true; - } - -private: - void _update(int interval /*a*/, int count /*LD12D*/) { // D14B - if (interval == 0xFE) { - _player->wait(interval, 70); - } else { - assert(interval > 0); // 0 == 256? - assert(count > 0); // 0 == 256? - - for (int y = count; y > 0; --y) { - _player->generateSamples(1289 - 5*interval); - _player->speakerToggle(); - } - } - } - -protected: - const byte *_params; - int _pos; -}; - -/* - * SoundFunction4: polyphone (2 voices) - */ -class AppleII_SoundFunction4_Polyphone : public AppleII_SoundFunction { -public: - virtual void init(Player_AppleII *player, const byte *params) { - _player = player; - _params = params; - _updateRemain1 = 80; - _updateRemain2 = 10; - _count = 0; - } - - virtual bool update() { // D170 - // while (_params[0] != 0x01) - if (_params[0] != 0x01) { - if (_count == 0) // prepare next loop - nextLoop(_params[0], _params[1], _params[2]); - if (loopIteration()) // loop finished -> fetch next parameter set - _params += 3; - return false; - } - return true; - } - -private: - /* - * prepare for next parameter set loop - */ - void nextLoop(byte param0, byte param1, byte param2) { // LD182 - _count = (-param2 << 8) | 0x3; - - _bitmask1 = 0x3; - _bitmask2 = 0x3; - - _updateInterval2 = param0; - if (_updateInterval2 == 0) - _bitmask2 = 0x0; - - _updateInterval1 = param1; - if (_updateInterval1 == 0) { - _bitmask1 = 0x0; - if (_bitmask2 != 0) { - _bitmask1 = _bitmask2; - _bitmask2 = 0; - _updateInterval1 = _updateInterval2; - } - } - - _speakerShiftReg = 0; - } - - /* - * perform one loop iteration - * Returns true if loop finished - */ - bool loopIteration() { // D1A2 - --_updateRemain1; - --_updateRemain2; - - if (_updateRemain2 == 0) { - _updateRemain2 = _updateInterval2; - // use only first voice's data (bitmask1) if both voices are triggered - if (_updateRemain1 != 0) { - _speakerShiftReg ^= _bitmask2; - } - } - - if (_updateRemain1 == 0) { - _updateRemain1 = _updateInterval1; - _speakerShiftReg ^= _bitmask1; - } - - if (_speakerShiftReg & 0x1) - _player->speakerToggle(); - _speakerShiftReg >>= 1; - _player->generateSamples(42); /* actually 42.5 */ - - ++_count; - return (_count == 0); - } - -protected: - const byte *_params; - - byte _updateRemain1; - byte _updateRemain2; - - uint16 _count; - byte _bitmask1; - byte _bitmask2; - byte _updateInterval1; - byte _updateInterval2; - byte _speakerShiftReg; -}; - -/* - * SoundFunction5: periodic noise - */ -class AppleII_SoundFunction5_Noise : public AppleII_SoundFunction { -public: - virtual void init(Player_AppleII *player, const byte *params) { - _player = player; - _index = 0; - _param0 = params[0]; - assert(_param0 > 0); - } - - virtual bool update() { // D222 - const byte noiseMask[] = { - 0x3F, 0x3F, 0x7F, 0x7F, 0x7F, 0x7F, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F - }; - - // while (i = 0; i < 10; ++i) - if (_index < 10) { - int count = _param0; - do { - _update(noise() & noiseMask[_index], 1); - --count; - } while (count > 0); - - ++_index; - return false; - } - - return true; - } - -private: - void _update(int interval /*a*/, int count) { // D270 - assert(count > 0); // 0 == 256? - if (interval == 0) - interval = 256; - - for (int i = count; i > 0; --i) { - _player->generateSamples(10 + 5*interval); - _player->speakerToggle(); - - _player->generateSamples(5 + 5*interval); - _player->speakerToggle(); - } - } - - byte /*a*/ noise() { // D261 - static int pos = 0; // initial value? - byte result = _noiseTable[pos]; - pos = (pos + 1) % 256; - return result; - } - -protected: - int _index; - int _param0; - -private: - static const byte _noiseTable[256]; -}; - -// LD000[loc] ^ LD00A[loc] -const byte AppleII_SoundFunction5_Noise::_noiseTable[256] = { - 0x65, 0x1b, 0xda, 0x11, 0x61, 0xe5, 0x77, 0x57, 0x92, 0xc8, 0x51, 0x1c, 0xd4, 0x91, 0x62, 0x63, - 0x00, 0x38, 0x57, 0xd5, 0x18, 0xd8, 0xdc, 0x40, 0x03, 0x86, 0xd3, 0x2f, 0x10, 0x11, 0xd8, 0x3c, - 0xbe, 0x00, 0x19, 0xc5, 0xd2, 0xc3, 0xca, 0x34, 0x00, 0x28, 0xbf, 0xb9, 0x18, 0x20, 0x01, 0xcc, - 0xda, 0x08, 0xbc, 0x75, 0x7c, 0xb0, 0x8d, 0xe0, 0x09, 0x18, 0xbf, 0x5d, 0xe9, 0x8c, 0x75, 0x64, - 0xe5, 0xb5, 0x5d, 0xe0, 0xb7, 0x7d, 0xe9, 0x8c, 0x55, 0x65, 0xc5, 0xb5, 0x5d, 0xd8, 0x09, 0x0d, - 0x64, 0xf0, 0xf0, 0x08, 0x63, 0x03, 0x00, 0x55, 0x35, 0xc0, 0x00, 0x20, 0x74, 0xa5, 0x1e, 0xe3, - 0x00, 0x06, 0x3c, 0x52, 0xd1, 0x70, 0xd0, 0x57, 0x02, 0xf0, 0x00, 0xb6, 0xfc, 0x02, 0x11, 0x9a, - 0x3b, 0xc8, 0x38, 0xdf, 0x1a, 0xb0, 0xd1, 0xb8, 0xd0, 0x18, 0x8a, 0x4a, 0xea, 0x1b, 0x12, 0x5d, - 0x29, 0x58, 0xd8, 0x43, 0xb8, 0x2d, 0xd2, 0x61, 0x10, 0x3c, 0x0c, 0x5d, 0x1b, 0x61, 0x10, 0x3c, - 0x0a, 0x5d, 0x1d, 0x61, 0x10, 0x3c, 0x0b, 0x19, 0x88, 0x21, 0xc0, 0x21, 0x07, 0x00, 0x65, 0x62, - 0x08, 0xe9, 0x36, 0x40, 0x20, 0x41, 0x06, 0x00, 0x20, 0x00, 0x00, 0xed, 0xa3, 0x00, 0x88, 0x06, - 0x98, 0x01, 0x5d, 0x7f, 0x02, 0x1d, 0x78, 0x03, 0x60, 0xcb, 0x3a, 0x01, 0xbd, 0x78, 0x02, 0x5d, - 0x7e, 0x03, 0x1d, 0xf5, 0xa6, 0x40, 0x81, 0xb4, 0xd0, 0x8d, 0xd3, 0xd0, 0x6d, 0xd5, 0x61, 0x48, - 0x61, 0x4d, 0xd1, 0xc8, 0xb1, 0xd8, 0x69, 0xff, 0x61, 0xd9, 0xed, 0xa0, 0xfe, 0x19, 0x91, 0x37, - 0x19, 0x37, 0x00, 0xf1, 0x00, 0x01, 0x1f, 0x00, 0xad, 0xc1, 0x01, 0x01, 0x2e, 0x00, 0x40, 0xc6, - 0x7a, 0x9b, 0x95, 0x43, 0xfc, 0x18, 0xd2, 0x9e, 0x2a, 0x5a, 0x4b, 0x2a, 0xb6, 0x87, 0x30, 0x6c -}; - -/************************************ - * Apple-II player - ************************************/ - -Player_AppleII::Player_AppleII(ScummEngine *scumm, Audio::Mixer *mixer) - : _mixer(mixer), _vm(scumm), _soundFunc(0) { - resetState(); - setSampleRate(_mixer->getOutputRate()); - _mixer->playStream(Audio::Mixer::kPlainSoundType, &_soundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true); -} - -Player_AppleII::~Player_AppleII() { - _mixer->stopHandle(_soundHandle); - delete _soundFunc; -} - -void Player_AppleII::resetState() { - _soundNr = 0; - _type = 0; - _loop = 0; - _params = NULL; - _speakerState = 0; - delete _soundFunc; - _soundFunc = 0; - _sampleConverter.reset(); -} - -void Player_AppleII::startSound(int nr) { - Common::StackLock lock(_mutex); - - byte *data = _vm->getResourceAddress(rtSound, nr); - assert(data); - byte *ptr1 = data + 4; - - resetState(); - _soundNr = nr; - _type = ptr1[0]; - _loop = ptr1[1]; - _params = &ptr1[2]; - - switch (_type) { - case 0: // empty (nothing to play) - resetState(); - return; - case 1: - _soundFunc = new AppleII_SoundFunction1_FreqUpDown(); - break; - case 2: - _soundFunc = new AppleII_SoundFunction2_SymmetricWave(); - break; - case 3: - _soundFunc = new AppleII_SoundFunction3_AsymmetricWave(); - break; - case 4: - _soundFunc = new AppleII_SoundFunction4_Polyphone(); - break; - case 5: - _soundFunc = new AppleII_SoundFunction5_Noise(); - break; - } - _soundFunc->init(this, _params); - - assert(_loop > 0); - - debug(4, "startSound %d: type %d, loop %d", - nr, _type, _loop); -} - -bool Player_AppleII::updateSound() { - if (!_soundFunc) - return false; - - if (_soundFunc->update()) { - --_loop; - if (_loop <= 0) { - delete _soundFunc; - _soundFunc = 0; - } else { - // reset function state on each loop - _soundFunc->init(this, _params); - } - } - - return true; -} - -void Player_AppleII::stopAllSounds() { - Common::StackLock lock(_mutex); - resetState(); -} - -void Player_AppleII::stopSound(int nr) { - Common::StackLock lock(_mutex); - if (_soundNr == nr) { - resetState(); - } -} - -int Player_AppleII::getSoundStatus(int nr) const { - Common::StackLock lock(_mutex); - return (_soundNr == nr); -} - -int Player_AppleII::getMusicTimer() { - /* Apple-II sounds are synchronous -> no music timer */ - return 0; -} - -int Player_AppleII::readBuffer(int16 *buffer, const int numSamples) { - Common::StackLock lock(_mutex); - - if (!_soundNr) - return 0; - - int samplesLeft = numSamples; - do { - int nSamplesRead = _sampleConverter.readSamples(buffer, samplesLeft); - samplesLeft -= nSamplesRead; - buffer += nSamplesRead; - } while ((samplesLeft > 0) && updateSound()); - - // reset state if sound is played completely - if (!_soundFunc && (_sampleConverter.availableSize() == 0)) - resetState(); - - return numSamples - samplesLeft; -} - -/************************************ - * Apple-II sound-resource helpers - ************************************/ - -// toggle speaker on/off -void Player_AppleII::speakerToggle() { - _speakerState ^= 0x1; -} - -void Player_AppleII::generateSamples(int cycles) { - _sampleConverter.addCycles(_speakerState, cycles); -} - -void Player_AppleII::wait(int interval, int count /*y*/) { - assert(count > 0); // 0 == 256? - assert(interval > 0); // 0 == 256? - generateSamples(11 + count*(8 + 5 * interval)); -} - -} // End of namespace Scumm diff --git a/engines/scumm/player_appleII.h b/engines/scumm/player_appleII.h deleted file mode 100644 index 9e97ab0c89..0000000000 --- a/engines/scumm/player_appleII.h +++ /dev/null @@ -1,298 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef SCUMM_PLAYER_APPLEII_H -#define SCUMM_PLAYER_APPLEII_H - -#include "common/mutex.h" -#include "common/scummsys.h" -#include "common/memstream.h" -#include "scumm/music.h" -#include "audio/audiostream.h" -#include "audio/mixer.h" -#include "audio/softsynth/sid.h" - -namespace Scumm { - -class ScummEngine; - -/* - * Optimized for use with periodical read/write phases when the buffer - * is filled in a write phase and completely read in a read phase. - * The growing strategy is optimized for repeated small (e.g. 2 bytes) - * single writes resulting in large buffers - * (avg.: 4KB, max: 18KB @ 16bit/22.050kHz (MM sound21)). - */ -class SampleBuffer { -public: - SampleBuffer() : _data(0) { - clear(); - } - - ~SampleBuffer() { - free(_data); - } - - void clear() { - free(_data); - _data = 0; - _capacity = 0; - _writePos = 0; - _readPos = 0; - } - - void ensureFree(uint32 needed) { - // if data was read completely, reset read/write pos to front - if ((_writePos != 0) && (_writePos == _readPos)) { - _writePos = 0; - _readPos = 0; - } - - // check for enough space at end of buffer - uint32 freeEndCnt = _capacity - _writePos; - if (needed <= freeEndCnt) - return; - - uint32 avail = availableSize(); - - // check for enough space at beginning and end of buffer - if (needed <= _readPos + freeEndCnt) { - // move unread data to front of buffer - memmove(_data, _data + _readPos, avail); - _writePos = avail; - _readPos = 0; - } else { // needs a grow - byte *old_data = _data; - uint32 new_len = avail + needed; - - _capacity = new_len + 2048; - _data = (byte *)malloc(_capacity); - - if (old_data) { - // copy old unread data to front of new buffer - memcpy(_data, old_data + _readPos, avail); - free(old_data); - _writePos = avail; - _readPos = 0; - } - } - } - - uint32 availableSize() const { - if (_readPos >= _writePos) - return 0; - return _writePos - _readPos; - } - - virtual uint32 write(const void *dataPtr, uint32 dataSize) { - ensureFree(dataSize); - memcpy(_data + _writePos, dataPtr, dataSize); - _writePos += dataSize; - return dataSize; - } - - uint32 read(byte *dataPtr, uint32 dataSize) { - uint32 avail = availableSize(); - if (avail == 0) - return 0; - if (dataSize > avail) - dataSize = avail; - memcpy(dataPtr, _data + _readPos, dataSize); - _readPos += dataSize; - return dataSize; - } - -private: - uint32 _writePos; - uint32 _readPos; - uint32 _capacity; - byte *_data; -}; - -// CPU_CLOCK according to AppleWin -static const double APPLEII_CPU_CLOCK = 1020484.5; // ~ 1.02 MHz - -/* - * Converts the 1-bit speaker state values into audio samples. - * This is done by aggregation of the speaker states at each - * CPU cycle in a sampling period into an audio sample. - */ -class SampleConverter { -private: - void addSampleToBuffer(int sample) { - int16 value = sample * _volume / _maxVolume; - _buffer.write(&value, sizeof(value)); - } - -public: - SampleConverter() : - _cyclesPerSampleFP(0), - _missingCyclesFP(0), - _sampleCyclesSumFP(0), - _volume(_maxVolume) - {} - - ~SampleConverter() {} - - void reset() { - _missingCyclesFP = 0; - _sampleCyclesSumFP = 0; - _buffer.clear(); - } - - uint32 availableSize() const { - return _buffer.availableSize(); - } - - void setMusicVolume(int vol) { - assert(vol >= 0 && vol <= _maxVolume); - _volume = vol; - } - - void setSampleRate(int rate) { - /* ~46 CPU cycles per sample @ 22.05kHz */ - _cyclesPerSampleFP = APPLEII_CPU_CLOCK * (1 << PREC_SHIFT) / rate; - reset(); - } - - void addCycles(byte level, const int cycles) { - /* convert to fixed precision floats */ - int cyclesFP = cycles << PREC_SHIFT; - - // step 1: if cycles are left from the last call, process them first - if (_missingCyclesFP > 0) { - int n = (_missingCyclesFP < cyclesFP) ? _missingCyclesFP : cyclesFP; - if (level) - _sampleCyclesSumFP += n; - cyclesFP -= n; - _missingCyclesFP -= n; - if (_missingCyclesFP == 0) { - addSampleToBuffer(2*32767 * _sampleCyclesSumFP / _cyclesPerSampleFP - 32767); - } else { - return; - } - } - - _sampleCyclesSumFP = 0; - - // step 2: process blocks of cycles fitting into a whole sample - while (cyclesFP >= _cyclesPerSampleFP) { - addSampleToBuffer(level ? 32767 : -32767); - cyclesFP -= _cyclesPerSampleFP; - } - - // step 3: remember cycles left for next call - if (cyclesFP > 0) { - _missingCyclesFP = _cyclesPerSampleFP - cyclesFP; - if (level) - _sampleCyclesSumFP = cyclesFP; - } - } - - uint32 readSamples(void *buffer, int numSamples) { - return _buffer.read((byte*)buffer, numSamples * 2) / 2; - } - -private: - static const int PREC_SHIFT = 7; - -private: - int _cyclesPerSampleFP; /* (fixed precision) */ - int _missingCyclesFP; /* (fixed precision) */ - int _sampleCyclesSumFP; /* (fixed precision) */ - int _volume; /* 0 - 256 */ - static const int _maxVolume = 256; - SampleBuffer _buffer; -}; - -class Player_AppleII; - -class AppleII_SoundFunction { -public: - AppleII_SoundFunction() {} - virtual ~AppleII_SoundFunction() {} - virtual void init(Player_AppleII *player, const byte *params) = 0; - /* returns true if finished */ - virtual bool update() = 0; -protected: - Player_AppleII *_player; -}; - -class Player_AppleII : public Audio::AudioStream, public MusicEngine { -public: - Player_AppleII(ScummEngine *scumm, Audio::Mixer *mixer); - virtual ~Player_AppleII(); - - virtual void setMusicVolume(int vol) { _sampleConverter.setMusicVolume(vol); } - void setSampleRate(int rate) { - _sampleRate = rate; - _sampleConverter.setSampleRate(rate); - } - void startMusic(int songResIndex); - virtual void startSound(int sound); - virtual void stopSound(int sound); - virtual void stopAllSounds(); - virtual int getSoundStatus(int sound) const; - virtual int getMusicTimer(); - - // AudioStream API - int readBuffer(int16 *buffer, const int numSamples); - bool isStereo() const { return false; } - bool endOfData() const { return false; } - int getRate() const { return _sampleRate; } - -public: - void speakerToggle(); - void generateSamples(int cycles); - void wait(int interval, int count); - -private: - // sound number - int _soundNr; - // type of sound - int _type; - // number of loops left - int _loop; - // global sound param list - const byte *_params; - // speaker toggle state (0 / 1) - byte _speakerState; - // sound function - AppleII_SoundFunction *_soundFunc; - // cycle to sample converter - SampleConverter _sampleConverter; - -private: - ScummEngine *_vm; - Audio::Mixer *_mixer; - Audio::SoundHandle _soundHandle; - int _sampleRate; - Common::Mutex _mutex; - -private: - void resetState(); - bool updateSound(); -}; - -} // End of namespace Scumm - -#endif diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 3eea68fbbe..9a093891d2 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -55,7 +55,7 @@ #include "scumm/player_nes.h" #include "scumm/player_sid.h" #include "scumm/player_pce.h" -#include "scumm/player_appleII.h" +#include "scumm/player_apple2.h" #include "scumm/player_v1.h" #include "scumm/player_v2.h" #include "scumm/player_v2cms.h" -- cgit v1.2.3 From 5d6710ebfd7b5bac79120492bbb3ff937f99efdb Mon Sep 17 00:00:00 2001 From: Tobias Gunkel Date: Sat, 24 Dec 2011 14:30:57 +0100 Subject: SCUMM: add player_apple2.cpp to project files Seems as if the iphone project files have to be updated separately. --- engines/scumm/module.mk | 1 + 1 file changed, 1 insertion(+) (limited to 'engines') diff --git a/engines/scumm/module.mk b/engines/scumm/module.mk index 781ca30459..1f219f5187 100644 --- a/engines/scumm/module.mk +++ b/engines/scumm/module.mk @@ -34,6 +34,7 @@ MODULE_OBJS := \ midiparser_ro.o \ object.o \ palette.o \ + player_apple2.o \ player_mod.o \ player_nes.o \ player_pce.o \ -- cgit v1.2.3 From ef35f1f69d3c75c2ed6dbb0bb4fe6a5551750ec1 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 24 Dec 2011 14:39:22 +0100 Subject: TSAGE: R2R - Implement scene 3350 --- engines/tsage/ringworld2/ringworld2_logic.cpp | 2 + engines/tsage/ringworld2/ringworld2_scenes3.cpp | 63 +++++++++++++++++++++++++ engines/tsage/ringworld2/ringworld2_scenes3.h | 19 ++++++++ 3 files changed, 84 insertions(+) (limited to 'engines') diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index e591436fd8..30e794627f 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -214,6 +214,8 @@ Scene *Ringworld2Game::createScene(int sceneNumber) { // Hall return new Scene3275(); case 3350: + // Cutscene - Ship landing + return new Scene3350(); case 3375: case 3385: case 3395: diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp index 1a219e773a..ce08e9647e 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp @@ -1635,5 +1635,68 @@ void Scene3275::signal() { } } +/*-------------------------------------------------------------------------- + * Scene 3350 - Cutscene - Ship landing + * + *--------------------------------------------------------------------------*/ +void Scene3350::postInit(SceneObjectList *OwnerList) { + loadScene(3350); + R2_GLOBALS._v58CE2 = 0; + SceneExt::postInit(); + R2_GLOBALS._sound2.play(310); + + _rotation = R2_GLOBALS._scenePalette.addRotation(176, 203, 1); + _rotation->setDelay(3); + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.hide(); + R2_GLOBALS._player.disableControl(); + + _actor1.postInit(); + _actor1.hide(); + _actor2.postInit(); + _actor2.hide(); + _actor3.postInit(); + _actor3.hide(); + _actor4.postInit(); + _actor4.hide(); + _actor9.postInit(); + _actor9.hide(); + _actor8.postInit(); + _actor8.hide(); + _actor5.postInit(); + _actor5.hide(); + _actor6.postInit(); + _actor6.hide(); + _actor7.postInit(); + _actor7.hide(); + + _sceneMode = 3350; + setAction(&_sequenceManager, this, _sceneMode, &_actor5, &_actor6, &_actor7, NULL); +} + +void Scene3350::remove() { + R2_GLOBALS._sound2.fadeOut2(NULL); + SceneExt::remove(); +} + +void Scene3350::signal() { + switch (_sceneMode) { + case 3350: + _sceneMode = 3351; + setAction(&_sequenceManager, this, 3351, &_actor4, &_actor9, &_actor8, NULL); + break; + case 3351: + _sceneMode = 3352; + setAction(&_sequenceManager, this, 3352, &_actor4, &R2_GLOBALS._player, &_actor1, &_actor2, &_actor3, NULL); + case 3352: + R2_GLOBALS._sceneManager.changeScene(3395); + break; + default: + R2_GLOBALS._player.enableControl(); + break; + } +} + } // 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 c82515c8c0..ac1436637c 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.h +++ b/engines/tsage/ringworld2/ringworld2_scenes3.h @@ -381,6 +381,25 @@ public: virtual void signal(); }; +class Scene3350 : public SceneExt { +public: + SceneActor _actor1; + SceneActor _actor2; + SceneActor _actor3; + SceneActor _actor4; + SceneActor _actor5; + SceneActor _actor6; + SceneActor _actor7; + SceneActor _actor8; + SceneActor _actor9; + SequenceManager _sequenceManager; + PaletteRotation *_rotation; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void remove(); + virtual void signal(); +}; + } // End of namespace Ringworld2 } // End of namespace TsAGE -- cgit v1.2.3 From 8e36de736e88f1b7a70ad04fc3d09b7807ff94f9 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sat, 24 Dec 2011 14:27:24 +0100 Subject: DREAMWEB: Minor cleanup --- engines/dreamweb/dreambase.h | 1 + engines/dreamweb/object.cpp | 3 +-- engines/dreamweb/sprite.cpp | 11 ----------- engines/dreamweb/stubs.cpp | 31 +++---------------------------- engines/dreamweb/stubs.h | 17 ----------------- 5 files changed, 5 insertions(+), 58 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 750cffdeac..0123943c35 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -537,6 +537,7 @@ public: void dropError(); void cantDrop(); void entryAnims(); + bool finishedWalking(); // from use.cpp void placeFreeObject(uint8 index); diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index 1245187a92..ac5f3132b6 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -231,8 +231,7 @@ void DreamGenContext::inventory() { if (data.byte(kCommandtype) != 239) { data.byte(kCommandtype) = 239; - al = 32; - commandOnly(); + commandOnly(32); } if (data.word(kMousebutton) == data.word(kOldbutton)) diff --git a/engines/dreamweb/sprite.cpp b/engines/dreamweb/sprite.cpp index e2e27bc417..c9ea699988 100644 --- a/engines/dreamweb/sprite.cpp +++ b/engines/dreamweb/sprite.cpp @@ -536,17 +536,6 @@ void DreamBase::moveMap(uint8 param) { data.byte(kNowinnewroom) = 1; } -void DreamGenContext::checkOne() { - uint8 flag, flagEx, type, flagX, flagY; - checkOne(cl, ch, &flag, &flagEx, &type, &flagX, &flagY); - - cl = flag; - ch = flagEx; - dl = flagX; - dh = flagY; - al = type; -} - void DreamBase::checkOne(uint8 x, uint8 y, uint8 *flag, uint8 *flagEx, uint8 *type, uint8 *flagX, uint8 *flagY) { *flagX = x / 16; *flagY = y / 16; diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 0f5b6541d7..2120668ef6 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -1138,10 +1138,6 @@ void DreamBase::delTextLine() { multiPut(_textUnder, data.byte(kTextaddressx), data.word(kTextaddressy), kUnderTextSizeX, kUnderTextSizeY); } -void DreamGenContext::commandOnly() { - commandOnly(al); -} - void DreamBase::commandOnly(uint8 command) { delTextLine(); uint16 index = command * 2; @@ -1152,10 +1148,6 @@ void DreamBase::commandOnly(uint8 command) { data.byte(kNewtextline) = 1; } -void DreamGenContext::checkIfPerson() { - flags._z = !checkIfPerson(al, ah); -} - bool DreamGenContext::checkIfPerson(uint8 x, uint8 y) { Common::List::iterator i; for (i = _peopleList.begin(); i != _peopleList.end(); ++i) { @@ -1183,10 +1175,6 @@ bool DreamGenContext::checkIfPerson(uint8 x, uint8 y) { return false; } -void DreamGenContext::checkIfFree() { - flags._z = !checkIfFree(al, ah); -} - bool DreamGenContext::checkIfFree(uint8 x, uint8 y) { Common::List::const_iterator i; for (i = _freeList.reverse_begin(); i != _freeList.end(); --i) { @@ -1200,10 +1188,6 @@ bool DreamGenContext::checkIfFree(uint8 x, uint8 y) { return false; } -void DreamGenContext::checkIfEx() { - flags._z = !checkIfEx(al, ah); -} - bool DreamGenContext::checkIfEx(uint8 x, uint8 y) { Common::List::const_iterator i; for (i = _exList.reverse_begin(); i != _exList.end(); --i) { @@ -1411,11 +1395,7 @@ void DreamBase::removeSetObject(uint8 index) { getSetAd(index)->mapad[0] = 0xff; } -void DreamGenContext::finishedWalking() { - flags._z = finishedWalkingCPP(); -} - -bool DreamGenContext::finishedWalkingCPP() { +bool DreamBase::finishedWalking() { return (data.byte(kLinepointer) == 254) && (data.byte(kFacing) == data.byte(kTurntoface)); } @@ -1426,7 +1406,7 @@ void DreamBase::getFlagUnderP(uint8 *flag, uint8 *flagEx) { } void DreamGenContext::walkAndExamine() { - if (!finishedWalkingCPP()) + if (!finishedWalking()) return; data.byte(kCommandtype) = data.byte(kWalkexamtype); data.byte(kCommand) = data.byte(kWalkexamnum); @@ -1449,7 +1429,7 @@ void DreamGenContext::obName(uint8 command, uint8 commandType) { setWalk(); data.byte(kReasseschanges) = 1; return; - } else if (! finishedWalkingCPP()) + } else if (!finishedWalking()) return; else if (data.byte(kCommandtype) == 5) { if (data.word(kWatchingtime) == 0) @@ -1690,11 +1670,6 @@ bool DreamBase::objectMatches(void *object, const char *id) { return true; } -void DreamGenContext::compare() { - char id[4] = { cl, ch, dl, dh }; - flags._z = compare(al, ah, id); -} - bool DreamBase::compare(uint8 index, uint8 flag, const char id[4]) { return objectMatches(getAnyAdDir(index, flag), id); } diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index b24185b82d..c0c8aede5b 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -58,15 +58,8 @@ DreamBase::showFrame(frameData, x, y, frameNumber, effectsFlag); } void width160(); - void commandOnly(); - void commandOnly(uint8 command) { - DreamBase::commandOnly(command); - } - void checkIfPerson(); bool checkIfPerson(uint8 x, uint8 y); - void checkIfFree(); bool checkIfFree(uint8 x, uint8 y); - void checkIfEx(); bool checkIfEx(uint8 x, uint8 y); void commandWithOb(); void commandWithOb(uint8 command, uint8 type, uint8 index) { @@ -84,20 +77,10 @@ SetObject *getSetAd(uint8 index) { return DreamBase::getSetAd(index); } - bool finishedWalkingCPP(); - void finishedWalking(); - void checkOne(); - void checkOne(uint8 x, uint8 y, uint8 *flag, uint8 *flagEx, uint8 *type, uint8 *flagX, uint8 *flagY) { - DreamBase::checkOne(x, y, flag, flagEx, type, flagX, flagY); - } void walkAndExamine(); void obName(uint8 command, uint8 commandType); void getExPos(); - void compare(); - bool compare(uint8 index, uint8 flag, const char id[4]) { - return DreamBase::compare(index, flag, id); - } bool checkIfSet(uint8 x, uint8 y); void isItWorn(); bool isItWorn(const DynObject *object) { -- cgit v1.2.3 From 4164b31e4a33b3c856acf2b58d0c05b4d96eb91d Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Thu, 22 Dec 2011 23:48:18 -0500 Subject: SAGA: Properly handle ITE Mac sound resources --- engines/saga/saga.h | 3 ++- engines/saga/sndres.cpp | 41 +++++++++++++++++++++++++++++++++-------- 2 files changed, 35 insertions(+), 9 deletions(-) (limited to 'engines') diff --git a/engines/saga/saga.h b/engines/saga/saga.h index fb01b1ac5d..a9bd1335e6 100644 --- a/engines/saga/saga.h +++ b/engines/saga/saga.h @@ -217,7 +217,8 @@ enum GameSoundTypes { kSoundOGG = 5, kSoundFLAC = 6, kSoundAIFF = 7, - kSoundShorten = 8 + kSoundShorten = 8, + kSoundMacSND = 9 }; enum TextStringIds { diff --git a/engines/saga/sndres.cpp b/engines/saga/sndres.cpp index add34e22a2..dc527d8200 100644 --- a/engines/saga/sndres.cpp +++ b/engines/saga/sndres.cpp @@ -30,10 +30,12 @@ #include "saga/sound.h" #include "common/file.h" +#include "common/substream.h" #include "audio/audiostream.h" #include "audio/decoders/adpcm.h" #include "audio/decoders/aiff.h" +#include "audio/decoders/mac_snd.h" #include "audio/decoders/raw.h" #include "audio/decoders/voc.h" #include "audio/decoders/wave.h" @@ -174,7 +176,7 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff GameSoundTypes resourceType = kSoundPCM; byte *data = 0; int rate = 0, size = 0; - Common::File* file; + Common::File *file; if (resourceId == (uint32)-1) { return false; @@ -258,7 +260,10 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff buffer.flags = Audio::FLAG_16BITS; buffer.frequency = 22050; if (_vm->getGameId() == GID_ITE) { - if (_vm->getFeatures() & GF_8BIT_UNSIGNED_PCM) { // older ITE demos + if (context->fileType() & GAME_MACBINARY) { + // ITE Mac has sound in the Mac snd format + resourceType = kSoundMacSND; + } else if (_vm->getFeatures() & GF_8BIT_UNSIGNED_PCM) { // older ITE demos buffer.flags |= Audio::FLAG_UNSIGNED; buffer.flags &= ~Audio::FLAG_16BITS; } else { @@ -276,16 +281,11 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff if (!context->isBigEndian()) buffer.flags |= Audio::FLAG_LITTLE_ENDIAN; - // Older Mac versions of ITE were Macbinary packed - int soundOffset = (context->fileType() & GAME_MACBINARY) ? 36 : 0; - switch (resourceType) { case kSoundPCM: - buffer.size = soundResourceLength - soundOffset; + buffer.size = soundResourceLength; if (!onlyHeader) { buffer.buffer = (byte *) malloc(buffer.size); - if (soundOffset > 0) - readS.skip(soundOffset); readS.read(buffer.buffer, buffer.size); } result = true; @@ -300,6 +300,31 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff } result = true; break; + case kSoundMacSND: { + Audio::SeekableAudioStream *audStream = Audio::makeMacSndStream(new Common::SeekableSubReadStream(&readS, readS.pos(), readS.pos() + soundResourceLength), DisposeAfterUse::YES); + Audio::Timestamp length = audStream->getLength(); + buffer.size = length.totalNumberOfFrames() * 2; + buffer.frequency = audStream->getRate(); + + if (audStream->isStereo()) { + buffer.size *= 2; + buffer.flags |= Audio::FLAG_STEREO; + } + + buffer.buffer = (byte *)malloc(buffer.size); + audStream->readBuffer((int16 *)buffer.buffer, buffer.size / 2); + + // The sound data is in native endian format now that we read it + // from the stream. +#ifdef SCUMM_LITTLE_ENDIAN + buffer.flags |= Audio::FLAG_LITTLE_ENDIAN; +#else + buffer.flags &= ~Audio::FLAG_LITTLE_ENDIAN; +#endif + + delete audStream; + result = true; + } break; case kSoundWAV: case kSoundAIFF: case kSoundShorten: -- cgit v1.2.3 From d876dddd45d4d8fa5d93396d3d922b720e273c99 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Fri, 23 Dec 2011 19:26:25 -0500 Subject: SAGA: Rework the way audio is buffered The streams that are created are now used directly instead of SAGA creating its own RawStream after decoding it. In addition, this should fix ADPCM-compressed sounds on big endian systems (as the code was treating the result of readBuffer() to always be LE, whereas it's actual native endian). I've also clarified the bugfix to bug #1256701. It only applies to 16-bit PCM data and the size for other data is no longer truncated too ;) --- engines/saga/saga.h | 13 --- engines/saga/sndres.cpp | 230 ++++++++++++++++++++++-------------------------- engines/saga/sndres.h | 2 - engines/saga/sound.cpp | 35 +------- engines/saga/sound.h | 19 ++-- 5 files changed, 113 insertions(+), 186 deletions(-) (limited to 'engines') diff --git a/engines/saga/saga.h b/engines/saga/saga.h index a9bd1335e6..829425aeaf 100644 --- a/engines/saga/saga.h +++ b/engines/saga/saga.h @@ -208,19 +208,6 @@ enum PanelButtonType { kPanelAllButtons = 0xFFFFF }; -enum GameSoundTypes { - kSoundPCM = 0, - kSoundVOX = 1, - kSoundVOC = 2, - kSoundWAV = 3, - kSoundMP3 = 4, - kSoundOGG = 5, - kSoundFLAC = 6, - kSoundAIFF = 7, - kSoundShorten = 8, - kSoundMacSND = 9 -}; - enum TextStringIds { kTextPickUp, kTextLookAt, diff --git a/engines/saga/sndres.cpp b/engines/saga/sndres.cpp index dc527d8200..5a97eb6019 100644 --- a/engines/saga/sndres.cpp +++ b/engines/saga/sndres.cpp @@ -35,9 +35,12 @@ #include "audio/audiostream.h" #include "audio/decoders/adpcm.h" #include "audio/decoders/aiff.h" +#include "audio/decoders/flac.h" #include "audio/decoders/mac_snd.h" +#include "audio/decoders/mp3.h" #include "audio/decoders/raw.h" #include "audio/decoders/voc.h" +#include "audio/decoders/vorbis.h" #include "audio/decoders/wave.h" #ifdef ENABLE_SAGA2 #include "saga/shorten.h" @@ -169,12 +172,29 @@ void SndRes::playVoice(uint32 resourceId) { _vm->_sound->playVoice(buffer); } +enum GameSoundType { + kSoundPCM = 0, + kSoundVOX = 1, + kSoundVOC = 2, + kSoundWAV = 3, + kSoundMP3 = 4, + kSoundOGG = 5, + kSoundFLAC = 6, + kSoundAIFF = 7, + kSoundShorten = 8, + kSoundMacSND = 9 +}; + +// Use a macro to read in the sound data based on if we actually want to buffer it or not +#define READ_STREAM(streamSize) \ + (onlyHeader \ + ? new Common::SeekableSubReadStream(&readS, readS.pos(), readS.pos() + (streamSize)) \ + : readS.readStream(streamSize)) + bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buffer, bool onlyHeader) { - Audio::AudioStream *voxStream; size_t soundResourceLength; bool result = false; - GameSoundTypes resourceType = kSoundPCM; - byte *data = 0; + GameSoundType resourceType = kSoundPCM; int rate = 0, size = 0; Common::File *file; @@ -212,7 +232,7 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff soundResourceLength = resourceData->size; } - Common::SeekableReadStream& readS = *file; + Common::SeekableReadStream &readS = *file; bool uncompressedSound = false; if (soundResourceLength >= 8) { @@ -252,183 +272,141 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff } - // Default sound type is 16-bit signed PCM, used in ITE by PCM and VOX files - buffer.isCompressed = context->isCompressed(); - buffer.soundType = resourceType; - buffer.originalSize = 0; - // Set default flags and frequency for PCM, VOC and VOX files, which got no header - buffer.flags = Audio::FLAG_16BITS; - buffer.frequency = 22050; + // Default sound type is 16-bit signed PCM, used in ITE + byte rawFlags = Audio::FLAG_16BITS; + if (_vm->getGameId() == GID_ITE) { if (context->fileType() & GAME_MACBINARY) { // ITE Mac has sound in the Mac snd format resourceType = kSoundMacSND; } else if (_vm->getFeatures() & GF_8BIT_UNSIGNED_PCM) { // older ITE demos - buffer.flags |= Audio::FLAG_UNSIGNED; - buffer.flags &= ~Audio::FLAG_16BITS; - } else { + rawFlags |= Audio::FLAG_UNSIGNED; + rawFlags &= ~Audio::FLAG_16BITS; + } else if (!uncompressedSound && !scumm_stricmp(context->fileName(), "voicesd.rsc")) { // Voice files in newer ITE demo versions are OKI ADPCM (VOX) encoded. - // These are LE in all the Windows and Mac demos - if (!uncompressedSound && !scumm_stricmp(context->fileName(), "voicesd.rsc")) { - resourceType = kSoundVOX; - buffer.flags |= Audio::FLAG_LITTLE_ENDIAN; - } + resourceType = kSoundVOX; } } - buffer.buffer = NULL; + + buffer.stream = 0; // Check for LE sounds if (!context->isBigEndian()) - buffer.flags |= Audio::FLAG_LITTLE_ENDIAN; + rawFlags |= Audio::FLAG_LITTLE_ENDIAN; switch (resourceType) { - case kSoundPCM: - buffer.size = soundResourceLength; - if (!onlyHeader) { - buffer.buffer = (byte *) malloc(buffer.size); - readS.read(buffer.buffer, buffer.size); - } + case kSoundPCM: { + // In ITE CD German, some voices are absent and contain just 5 zero bytes. + // Round down to an even number when the audio is 16-bit so makeRawStream + // will accept the data (needs to be an even size for 16-bit data). + // See bug #1256701 + + if ((soundResourceLength & 1) && (rawFlags & Audio::FLAG_16BITS)) + soundResourceLength &= ~1; + + Audio::SeekableAudioStream *audStream = Audio::makeRawStream(READ_STREAM(soundResourceLength), 22050, rawFlags); + buffer.stream = audStream; + buffer.streamLength = audStream->getLength(); result = true; - break; + } break; case kSoundVOX: - buffer.size = soundResourceLength * 4; - if (!onlyHeader) { - voxStream = Audio::makeADPCMStream(&readS, DisposeAfterUse::NO, soundResourceLength, Audio::kADPCMOki); - buffer.buffer = (byte *)malloc(buffer.size); - voxStream->readBuffer((int16*)buffer.buffer, soundResourceLength * 2); - delete voxStream; - } + buffer.stream = Audio::makeADPCMStream(READ_STREAM(soundResourceLength), DisposeAfterUse::YES, soundResourceLength, Audio::kADPCMOki, 22050, 1); + buffer.streamLength = Audio::Timestamp(0, soundResourceLength * 2, buffer.stream->getRate()); result = true; break; case kSoundMacSND: { - Audio::SeekableAudioStream *audStream = Audio::makeMacSndStream(new Common::SeekableSubReadStream(&readS, readS.pos(), readS.pos() + soundResourceLength), DisposeAfterUse::YES); - Audio::Timestamp length = audStream->getLength(); - buffer.size = length.totalNumberOfFrames() * 2; - buffer.frequency = audStream->getRate(); - - if (audStream->isStereo()) { - buffer.size *= 2; - buffer.flags |= Audio::FLAG_STEREO; - } - - buffer.buffer = (byte *)malloc(buffer.size); - audStream->readBuffer((int16 *)buffer.buffer, buffer.size / 2); - - // The sound data is in native endian format now that we read it - // from the stream. -#ifdef SCUMM_LITTLE_ENDIAN - buffer.flags |= Audio::FLAG_LITTLE_ENDIAN; -#else - buffer.flags &= ~Audio::FLAG_LITTLE_ENDIAN; -#endif - - delete audStream; + Audio::SeekableAudioStream *audStream = Audio::makeMacSndStream(READ_STREAM(soundResourceLength), DisposeAfterUse::YES); + buffer.stream = audStream; + buffer.streamLength = audStream->getLength(); + result = true; + } break; + case kSoundAIFF: { + Audio::SeekableAudioStream *audStream = Audio::makeAIFFStream(READ_STREAM(soundResourceLength), DisposeAfterUse::YES); + buffer.stream = audStream; + buffer.streamLength = audStream->getLength(); + result = true; + } break; + case kSoundVOC: { + Audio::SeekableAudioStream *audStream = Audio::makeVOCStream(READ_STREAM(soundResourceLength), Audio::FLAG_UNSIGNED, DisposeAfterUse::YES); + buffer.stream = audStream; + buffer.streamLength = audStream->getLength(); result = true; } break; case kSoundWAV: - case kSoundAIFF: case kSoundShorten: - case kSoundVOC: if (resourceType == kSoundWAV) { - result = Audio::loadWAVFromStream(readS, size, rate, buffer.flags); - } else if (resourceType == kSoundAIFF) { - result = Audio::loadAIFFFromStream(readS, size, rate, buffer.flags); + result = Audio::loadWAVFromStream(readS, size, rate, rawFlags); #ifdef ENABLE_SAGA2 } else if (resourceType == kSoundShorten) { - result = loadShortenFromStream(readS, size, rate, buffer.flags); + result = loadShortenFromStream(readS, size, rate, rawFlags); #endif - } else if (resourceType == kSoundVOC) { - data = Audio::loadVOCFromStream(readS, size, rate); - result = (data != NULL); - if (onlyHeader) - free(data); - buffer.flags |= Audio::FLAG_UNSIGNED; - buffer.flags &= ~Audio::FLAG_16BITS; - buffer.flags &= ~Audio::FLAG_STEREO; } if (result) { - buffer.frequency = rate; - buffer.size = size; - - if (!onlyHeader) { - if (resourceType == kSoundVOC) { - buffer.buffer = data; - } else { - buffer.buffer = (byte *)malloc(size); - readS.read(buffer.buffer, size); - } - } + Audio::SeekableAudioStream *audStream = Audio::makeRawStream(READ_STREAM(size), rate, rawFlags); + buffer.stream = audStream; + buffer.streamLength = audStream->getLength(); } break; case kSoundMP3: case kSoundOGG: - case kSoundFLAC: - ResourceData *resourceData; - resourceData = context->getResourceData(resourceId); - - // Read compressed sfx header - readS.readByte(); // Skip compression identifier byte - buffer.frequency = readS.readUint16LE(); - buffer.originalSize = readS.readUint32LE(); - if (readS.readByte() == 8) // read sample bits - buffer.flags &= ~Audio::FLAG_16BITS; - if (readS.readByte() != 0) // read stereo flag - buffer.flags |= Audio::FLAG_STEREO; - - buffer.size = soundResourceLength; - buffer.soundType = resourceType; - buffer.fileOffset = resourceData->offset + 9; // skip compressed sfx header: byte + uint16 + uint32 + byte + byte - - if (!onlyHeader) { - buffer.buffer = (byte *)malloc(buffer.size); - readS.read(buffer.buffer, buffer.size); + case kSoundFLAC: { + readS.skip(9); // skip sfx header + + Audio::SeekableAudioStream *audStream = 0; + Common::SeekableReadStream *memStream = READ_STREAM(soundResourceLength - 9); + + if (resourceType == kSoundMP3) { +#ifdef USE_MAD + audStream = Audio::makeMP3Stream(memStream, DisposeAfterUse::YES); +#endif + } else if (resourceType == kSoundOGG) { +#ifdef USE_VORBIS + audStream = Audio::makeVorbisStream(memStream, DisposeAfterUse::YES); +#endif + } else /* if (resourceType == kSoundFLAC) */ { +#ifdef USE_FLAC + audStream = Audio::makeFLACStream(memStream, DisposeAfterUse::YES); +#endif } - result = true; - break; + if (audStream) { + buffer.stream = audStream; + buffer.streamLength = audStream->getLength(); + result = true; + } else { + delete memStream; + } + + } break; default: error("SndRes::load Unknown sound type"); } - if (_vm->getGameId() == GID_IHNM && _vm->isMacResources()) { delete file; } - - // In ITE CD De some voices are absent and contain just 5 bytes header - // Round it to even number so soundmanager will not crash. - // See bug #1256701 - buffer.size &= ~(0x1); + if (onlyHeader) { + delete buffer.stream; + buffer.stream = 0; + } return result; } +#undef READ_STREAM + int SndRes::getVoiceLength(uint32 resourceId) { - double msDouble; SoundBuffer buffer; if (!(_vm->_voiceFilesExist)) return -1; - if (!load(_voiceContext, resourceId, buffer, true)) { + if (!load(_voiceContext, resourceId, buffer, true)) return -1; - } - - if (!_voiceContext->isCompressed() || buffer.originalSize == 0) - msDouble = (double)buffer.size; - else - msDouble = (double)buffer.originalSize; - - if (buffer.flags & Audio::FLAG_16BITS) - msDouble /= 2.0; - - if (buffer.flags & Audio::FLAG_STEREO) - msDouble /= 2.0; - msDouble = msDouble / buffer.frequency * 1000.0; - return (int)msDouble; + return buffer.streamLength.msecs(); } } // End of namespace Saga diff --git a/engines/saga/sndres.h b/engines/saga/sndres.h index 9b0eebc834..979c0288f6 100644 --- a/engines/saga/sndres.h +++ b/engines/saga/sndres.h @@ -52,8 +52,6 @@ public: private: bool load(ResourceContext *context, uint32 resourceId, SoundBuffer &buffer, bool onlyHeader); - bool loadVocSound(byte *soundResource, size_t soundResourceLength, SoundBuffer &buffer); - bool loadWavSound(byte *soundResource, size_t soundResourceLength, SoundBuffer &buffer); ResourceContext *_sfxContext; ResourceContext *_voiceContext; diff --git a/engines/saga/sound.cpp b/engines/saga/sound.cpp index 3408125f73..67be499bc7 100644 --- a/engines/saga/sound.cpp +++ b/engines/saga/sound.cpp @@ -63,42 +63,11 @@ SndHandle *Sound::getHandle() { void Sound::playSoundBuffer(Audio::SoundHandle *handle, const SoundBuffer &buffer, int volume, sndHandleType handleType, bool loop) { - Audio::RewindableAudioStream *stream = 0; - Audio::Mixer::SoundType soundType = (handleType == kVoiceHandle) ? Audio::Mixer::kSpeechSoundType : Audio::Mixer::kSFXSoundType; - if (!buffer.isCompressed) { - stream = Audio::makeRawStream(buffer.buffer, buffer.size, buffer.frequency, buffer.flags); - } else { - Common::SeekableReadStream *memStream = new Common::MemoryReadStream(buffer.buffer, buffer.size, DisposeAfterUse::YES); - - switch (buffer.soundType) { -#ifdef USE_MAD - case kSoundMP3: - stream = Audio::makeMP3Stream(memStream, DisposeAfterUse::YES); - break; -#endif -#ifdef USE_VORBIS - case kSoundOGG: - stream = Audio::makeVorbisStream(memStream, DisposeAfterUse::YES); - break; -#endif -#ifdef USE_FLAC - case kSoundFLAC: - stream = Audio::makeFLACStream(memStream, DisposeAfterUse::YES); - break; -#endif - default: - // Unknown compression, ignore sample - delete memStream; - warning("Unknown compression, ignoring sound"); - break; - } - } - - if (stream != NULL) - _mixer->playStream(soundType, handle, Audio::makeLoopingAudioStream(stream, loop ? 0 : 1), -1, volume); + if (buffer.stream) + _mixer->playStream(soundType, handle, Audio::makeLoopingAudioStream(buffer.stream, loop ? 0 : 1), -1, volume); } void Sound::playSound(SoundBuffer &buffer, int volume, bool loop, int resId) { diff --git a/engines/saga/sound.h b/engines/saga/sound.h index 15624a9da5..e2163dfb0e 100644 --- a/engines/saga/sound.h +++ b/engines/saga/sound.h @@ -27,9 +27,11 @@ #include "common/file.h" #include "audio/mixer.h" -#include "audio/decoders/mp3.h" -#include "audio/decoders/vorbis.h" -#include "audio/decoders/flac.h" +#include "audio/timestamp.h" + +namespace Audio { +class RewindableAudioStream; +} namespace Saga { @@ -40,15 +42,8 @@ enum SOUND_FLAGS { }; struct SoundBuffer { - uint16 frequency; - bool isCompressed; - byte flags; - - byte *buffer; - size_t size; - size_t originalSize; - GameSoundTypes soundType; - size_t fileOffset; + Audio::RewindableAudioStream *stream; + Audio::Timestamp streamLength; }; enum sndHandleType { -- cgit v1.2.3 From df269f839d7e0fb1e2ba029e1fadba078d125030 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Sat, 24 Dec 2011 22:24:05 +0000 Subject: DREAMWEB: Ported 'starttalk' to C++ --- engines/dreamweb/dreamgen.cpp | 39 --------------------------------------- engines/dreamweb/dreamgen.h | 1 - engines/dreamweb/stubs.h | 1 + engines/dreamweb/talk.cpp | 25 ++++++++++++++++++++++++- 4 files changed, 25 insertions(+), 41 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index b9816c28b2..487839c03b 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -975,45 +975,6 @@ cantpurge2: goto lookforpurge2; } -void DreamGenContext::startTalk() { - STACK_CHECK; - data.byte(kTalkmode) = 0; - al = data.byte(kCharacter); - _and(al, 127); - getPersonText(); - data.word(kCharshift) = 91+91; - di = 66; - bx = 64; - dl = 241; - al = 0; - ah = 79; - printDirect(); - data.word(kCharshift) = 0; - di = 66; - bx = 80; - dl = 241; - al = 0; - ah = 0; - printDirect(); - data.byte(kSpeechloaded) = 0; - al = data.byte(kCharacter); - _and(al, 127); - ah = 0; - cx = 64; - _mul(cx); - cl = 'C'; - dl = 'R'; - dh = data.byte(kReallocation); - loadSpeech(); - _cmp(data.byte(kSpeechloaded), 1); - if (!flags.z()) - return /* (nospeech1) */; - data.byte(kVolumedirection) = 1; - data.byte(kVolumeto) = 6; - al = 50+12; - playChannel1(); -} - void DreamGenContext::getPersonText() { STACK_CHECK; ah = 0; diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 10abde7fff..f6399b4e7d 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -460,7 +460,6 @@ public: void outOfOpen(); void dirCom(); void findFirstPath(); - void startTalk(); void getAnyAd(); void getFreeAd(); void dirFile(); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index c0c8aede5b..5f777e4e9a 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -98,6 +98,7 @@ void showCity(); uint16 getPersFrame(uint8 index); void convIcons(); + void startTalk(); void examineOb(bool examineAgain = true); void dumpWatch(); void transferText(); diff --git a/engines/dreamweb/talk.cpp b/engines/dreamweb/talk.cpp index 40c514b34a..20ac58dd7a 100644 --- a/engines/dreamweb/talk.cpp +++ b/engines/dreamweb/talk.cpp @@ -84,7 +84,30 @@ uint16 DreamGenContext::getPersFrame(uint8 index) { return getSegment(data.word(kPeople)).word(kPersonframes + index * 2); } -// TODO: put Starttalk here +void DreamGenContext::startTalk() { + data.byte(kTalkmode) = 0; + + al = (data.byte(kCharacter) & 0x7F); + getPersonText(); + const uint8 *str = es.ptr(si, 0); + uint16 y; + + data.word(kCharshift) = 91+91; + y = 64; + printDirect(&str, 66, &y, 241, true); + + data.word(kCharshift) = 0; + y = 80; + printDirect(&str, 66, &y, 241, true); + + data.byte(kSpeechloaded) = 0; + loadSpeech('R', data.byte(kReallocation), 'C', 64*(data.byte(kCharacter) & 0x7F)); + if (data.byte(kSpeechloaded) == 1) { + data.byte(kVolumedirection) = 1; + data.byte(kVolumeto) = 6; + playChannel1(50 + 12); + } +} // TODO: put Getpersontext here -- cgit v1.2.3 From a1ffa11620fcd0ba48b5cc2c1ca505ca4baab436 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Sat, 24 Dec 2011 23:00:11 +0000 Subject: DREAMWEB: Port 'getpersontext' to C++ --- engines/dreamweb/dreamgen.cpp | 14 -------------- engines/dreamweb/dreamgen.h | 1 - engines/dreamweb/stubs.h | 1 + engines/dreamweb/talk.cpp | 8 +++++--- 4 files changed, 6 insertions(+), 18 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 487839c03b..e321c50993 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -975,20 +975,6 @@ cantpurge2: goto lookforpurge2; } -void DreamGenContext::getPersonText() { - STACK_CHECK; - ah = 0; - cx = 64*2; - _mul(cx); - si = ax; - es = data.word(kPeople); - _add(si, (0+24)); - cx = (0+24+(1026*2)); - ax = es.word(si); - _add(ax, cx); - si = ax; -} - void DreamGenContext::doSomeTalk() { STACK_CHECK; dospeech: diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index f6399b4e7d..7717c7fb1c 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -454,7 +454,6 @@ public: void __start(); #include "stubs.h" // Allow hand-reversed functions to have a signature different than void f() - void getPersonText(); void checkObjectSize(); void doSomeTalk(); void outOfOpen(); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 5f777e4e9a..921b8ed2eb 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -99,6 +99,7 @@ uint16 getPersFrame(uint8 index); void convIcons(); void startTalk(); + void getPersonText(uint8 index); void examineOb(bool examineAgain = true); void dumpWatch(); void transferText(); diff --git a/engines/dreamweb/talk.cpp b/engines/dreamweb/talk.cpp index 20ac58dd7a..c0622f7d53 100644 --- a/engines/dreamweb/talk.cpp +++ b/engines/dreamweb/talk.cpp @@ -87,8 +87,7 @@ uint16 DreamGenContext::getPersFrame(uint8 index) { void DreamGenContext::startTalk() { data.byte(kTalkmode) = 0; - al = (data.byte(kCharacter) & 0x7F); - getPersonText(); + getPersonText(data.byte(kCharacter) & 0x7F); const uint8 *str = es.ptr(si, 0); uint16 y; @@ -109,7 +108,10 @@ void DreamGenContext::startTalk() { } } -// TODO: put Getpersontext here +void DreamGenContext::getPersonText(uint8 index) { + es = data.word(kPeople); + si = es.word((index * 64 * 2) + 24) + (1026 * 2) + 24; +} void DreamGenContext::moreTalk() { if (data.byte(kTalkmode) != 0) { -- cgit v1.2.3 From 652403021d7dbcceb672dd21b468d1667479fc8b Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 25 Dec 2011 04:51:18 +0200 Subject: DREAMWEB: Convert 'checkobjectsize' to C++ Also, renamed getOpenedSizeCPP() to getSlotCount(). Special thanks to wjp for his help and for examining the behavior of a fallback case. --- engines/dreamweb/dreamgen.cpp | 48 -------------------------------- engines/dreamweb/dreamgen.h | 1 - engines/dreamweb/object.cpp | 64 +++++++++++++++++++++++++++++++++++++++++-- engines/dreamweb/structs.h | 6 ++-- engines/dreamweb/stubs.h | 5 +++- 5 files changed, 68 insertions(+), 56 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index e321c50993..7416e1bafb 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -677,54 +677,6 @@ sizeok1: delPointer(); } -void DreamGenContext::checkObjectSize() { - STACK_CHECK; - getOpenedSize(); - push(ax); - al = data.byte(kItemframe); - getEitherAd(); - al = es.byte(bx+9); - cx = pop(); - _cmp(al, 255); - if (!flags.z()) - goto notunsized; - al = 6; -notunsized: - _cmp(al, 100); - if (!flags.c()) - goto specialcase; - _cmp(cl, 100); - if (flags.c()) - goto isntspecial; - errorMessage3(); - goto sizewrong; -isntspecial: - _cmp(cl, al); - if (!flags.c()) - goto sizeok; -specialcase: - _sub(al, 100); - _cmp(cl, 100); - if (!flags.c()) - goto bothspecial; - _cmp(cl, al); - if (!flags.c()) - goto sizeok; - errorMessage2(); - goto sizewrong; -bothspecial: - _sub(cl, 100); - _cmp(al, cl); - if (flags.z()) - goto sizeok; - errorMessage3(); -sizewrong: - al = 1; - return; -sizeok: - al = 0; -} - void DreamGenContext::outOfOpen() { STACK_CHECK; _cmp(data.byte(kOpenedob), 255); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 7717c7fb1c..d8270efdc3 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -454,7 +454,6 @@ public: void __start(); #include "stubs.h" // Allow hand-reversed functions to have a signature different than void f() - void checkObjectSize(); void doSomeTalk(); void outOfOpen(); void dirCom(); diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index ac5f3132b6..7e1ba1c2a3 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -281,7 +281,7 @@ void DreamBase::getBackFromOb() { } void DreamGenContext::getOpenedSize() { - //ax = getOpenedSizeCPP(); + //ax = getOpenedSlotCount(); // We need to call the ASM-style versions of get*Ad, as these also set // bx and es @@ -304,7 +304,7 @@ void DreamGenContext::getOpenedSize() { } } -byte DreamGenContext::getOpenedSizeCPP() { +byte DreamGenContext::getOpenedSlotCount() { byte obj = data.byte(kOpenedob); switch (data.byte(kOpenedtype)) { case 4: @@ -316,6 +316,18 @@ byte DreamGenContext::getOpenedSizeCPP() { } } +byte DreamGenContext::getOpenedSlotSize() { + byte obj = data.byte(kOpenedob); + switch (data.byte(kOpenedtype)) { + case 4: + return getExAd(obj)->slotSize; + case 2: + return getFreeAd(obj)->slotSize; + default: + return getSetAd(obj)->slotSize; + } +} + void DreamGenContext::openOb() { uint8 commandLine[64] = "OBJECT NAME ONE "; @@ -326,7 +338,7 @@ void DreamGenContext::openOb() { al = printDirect(commandLine, data.word(kLastxpos) + 5, kInventy+86, 220, false); fillOpen(); - _openChangeSize = getOpenedSizeCPP() * kItempicsize + kInventx; + _openChangeSize = getOpenedSlotCount() * kItempicsize + kInventx; } void DreamGenContext::identifyOb() { @@ -748,4 +760,50 @@ void DreamBase::dropObject() { object->currentLocation = data.byte(kReallocation); } +void DreamGenContext::checkObjectSize() { + al = checkObjectSizeCPP() ? 0 : 1; +} + +bool DreamGenContext::checkObjectSizeCPP() { + byte containerSize = getOpenedSlotSize(); + DynObject *object = getEitherAdCPP(); + // If there is no size defined for the object in the editor, set its size + // to 6. This could be a bad idea, according to the original source. + byte objectSize = (object->objectSize != 255) ? object->objectSize : 6; + + if (objectSize >= 100) { + // Special case + if (containerSize >= 100) { + // Both objects are special + if (containerSize == objectSize) { + return true; + } else { + errorMessage3(); + return false; + } + } else { + if (containerSize >= (byte)(objectSize - 100)) { + return true; + } else { + errorMessage2(); + return false; + } + } + } else if (containerSize >= 100) { // The current object isn't special, but the container object is + errorMessage3(); + return false; + } else if (containerSize >= objectSize) { + return true; + } else { + // The original continues here to the special case above. It checks if + // cl (containerSize) < al (objectSize) and continues if this is so. + // However, in this case, the code subtracts 100 from objectSize, which + // was between 0 - 99, so it now is between 156 and 255. containerSize is + // smaller than 100, so comparing it with objectSize will always be true, + // thus this bit of code always falls through to the errorMessage2() case. + errorMessage2(); + return false; + } +} + } // End of namespace DreamGen diff --git a/engines/dreamweb/structs.h b/engines/dreamweb/structs.h index 4d1b1420f9..5d93d1d99f 100644 --- a/engines/dreamweb/structs.h +++ b/engines/dreamweb/structs.h @@ -120,9 +120,9 @@ struct DynObject { uint8 currentLocation; uint8 index; uint8 mapad[5]; - uint8 slotSize; - uint8 slotCount; - uint8 b9; + uint8 slotSize; // the size of an object's slots + uint8 slotCount; // the number of slots of an object + uint8 objectSize; // the size of an object uint8 b10; uint8 initialLocation; uint8 id[4]; diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 921b8ed2eb..09a68682a7 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -185,7 +185,10 @@ void runEndSeq(); bool execCommand(); void getOpenedSize(); - byte getOpenedSizeCPP(); + byte getOpenedSlotSize(); + byte getOpenedSlotCount(); + void checkObjectSize(); + bool checkObjectSizeCPP(); void openOb(); void identifyOb(); void useStereo(); -- cgit v1.2.3 From 088c145f8f551a7faaf50e317529549503b1b7e8 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Sun, 25 Dec 2011 07:28:29 +0000 Subject: DREAMWEB: Port 'dosometalk' to C++ --- engines/dreamweb/dreamgen.cpp | 140 ------------------------------------------ engines/dreamweb/dreamgen.h | 1 - engines/dreamweb/stubs.h | 1 + engines/dreamweb/talk.cpp | 86 +++++++++++++++++++++++++- 4 files changed, 85 insertions(+), 143 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 7416e1bafb..8cd5dd43df 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -927,146 +927,6 @@ cantpurge2: goto lookforpurge2; } -void DreamGenContext::doSomeTalk() { - STACK_CHECK; -dospeech: - al = data.byte(kTalkpos); - al = data.byte(kCharacter); - _and(al, 127); - ah = 0; - cx = 64; - _mul(cx); - cx = ax; - al = data.byte(kTalkpos); - ah = 0; - _add(ax, cx); - _add(ax, ax); - si = ax; - es = data.word(kPeople); - _add(si, (0+24)); - cx = (0+24+(1026*2)); - ax = es.word(si); - _add(ax, cx); - si = ax; - _cmp(es.byte(si), 0); - if (flags.z()) - goto endheartalk; - push(es); - push(si); - createPanel(); - showPanel(); - showMan(); - showExit(); - convIcons(); - si = pop(); - es = pop(); - di = 164; - bx = 64; - dl = 144; - al = 0; - ah = 0; - printDirect(); - al = data.byte(kCharacter); - _and(al, 127); - ah = 0; - cx = 64; - _mul(cx); - cl = data.byte(kTalkpos); - ch = 0; - _add(ax, cx); - cl = 'C'; - dl = 'R'; - dh = data.byte(kReallocation); - loadSpeech(); - _cmp(data.byte(kSpeechloaded), 0); - if (flags.z()) - goto noplay1; - al = 62; - playChannel1(); -noplay1: - data.byte(kPointermode) = 3; - workToScreenM(); - cx = 180; - hangOnPQ(); - if (!flags.c()) - goto _tmp1; - return; -_tmp1: - _inc(data.byte(kTalkpos)); - al = data.byte(kTalkpos); - al = data.byte(kCharacter); - _and(al, 127); - ah = 0; - cx = 64; - _mul(cx); - cx = ax; - al = data.byte(kTalkpos); - ah = 0; - _add(ax, cx); - _add(ax, ax); - si = ax; - es = data.word(kPeople); - _add(si, (0+24)); - cx = (0+24+(1026*2)); - ax = es.word(si); - _add(ax, cx); - si = ax; - _cmp(es.byte(si), 0); - if (flags.z()) - goto endheartalk; - _cmp(es.byte(si), ':'); - if (flags.z()) - goto skiptalk2; - _cmp(es.byte(si), 32); - if (flags.z()) - goto skiptalk2; - push(es); - push(si); - createPanel(); - showPanel(); - showMan(); - showExit(); - convIcons(); - si = pop(); - es = pop(); - di = 48; - bx = 128; - dl = 144; - al = 0; - ah = 0; - printDirect(); - al = data.byte(kCharacter); - _and(al, 127); - ah = 0; - cx = 64; - _mul(cx); - cl = data.byte(kTalkpos); - ch = 0; - _add(ax, cx); - cl = 'C'; - dl = 'R'; - dh = data.byte(kReallocation); - loadSpeech(); - _cmp(data.byte(kSpeechloaded), 0); - if (flags.z()) - goto noplay2; - al = 62; - playChannel1(); -noplay2: - data.byte(kPointermode) = 3; - workToScreenM(); - cx = 180; - hangOnPQ(); - if (!flags.c()) - goto skiptalk2; - return; -skiptalk2: - _inc(data.byte(kTalkpos)); - goto dospeech; -endheartalk: - data.byte(kPointermode) = 0; -} - void DreamGenContext::locationPic() { STACK_CHECK; getDestInfo(); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index d8270efdc3..52009dc5ed 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -454,7 +454,6 @@ public: void __start(); #include "stubs.h" // Allow hand-reversed functions to have a signature different than void f() - void doSomeTalk(); void outOfOpen(); void dirCom(); void findFirstPath(); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 09a68682a7..b1406182f0 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -100,6 +100,7 @@ void convIcons(); void startTalk(); void getPersonText(uint8 index); + void doSomeTalk(); void examineOb(bool examineAgain = true); void dumpWatch(); void transferText(); diff --git a/engines/dreamweb/talk.cpp b/engines/dreamweb/talk.cpp index c0622f7d53..834109b1dc 100644 --- a/engines/dreamweb/talk.cpp +++ b/engines/dreamweb/talk.cpp @@ -110,7 +110,7 @@ void DreamGenContext::startTalk() { void DreamGenContext::getPersonText(uint8 index) { es = data.word(kPeople); - si = es.word((index * 64 * 2) + 24) + (1026 * 2) + 24; + si = es.word((index * 64 * 2) + kPersontxtdat) + kPersontext; } void DreamGenContext::moreTalk() { @@ -138,7 +138,89 @@ void DreamGenContext::moreTalk() { doSomeTalk(); } -// TODO: put Dosometalk here +void DreamGenContext::doSomeTalk() { + while (true) { + es = data.word(kPeople); + si = ((data.byte(kTalkpos) + (64 * (data.byte(kCharacter) & 0x7F))) * 2) + kPersontxtdat; + si = es.word(si) + kPersontext; + + if (es.byte(si) == 0) { + // endheartalk + data.byte(kPointermode) = 0; + return; + } + + push(es); + push(si); + + createPanel(); + showPanel(); + showMan(); + showExit(); + convIcons(); + + si = pop(); + es = pop(); + + const uint8 *str = es.ptr(si, 0); + uint16 y = 64; + printDirect(&str, 164, &y, 144, false); + + loadSpeech('R', data.byte(kReallocation), 'C', (64 * (data.byte(kCharacter) & 0x7F)) + data.byte(kTalkpos)); + if (data.byte(kSpeechloaded) != 0) + playChannel1(62); + + data.byte(kPointermode) = 3; + workToScreenM(); + cx = 180; + hangOnPQ(); + if (flags.c()) + return; + + data.byte(kTalkpos)++; + + es = data.word(kPeople); + si = kPersontxtdat + (((64 * (data.byte(kCharacter) & 0x7F)) + data.byte(kTalkpos)) * 2); + si = es.word(si) + kPersontext; + + if (es.byte(si) == 0) { + // endheartalk + data.byte(kPointermode) = 0; + return; + } + + if (es.byte(si) != ':' && es.byte(si) != 32) { + push(es); + push(si); + + createPanel(); + showPanel(); + showMan(); + showExit(); + convIcons(); + + si = pop(); + es = pop(); + + str = es.ptr(si, 0); + y = 128; + printDirect(&str, 48, &y, 144, false); + + loadSpeech('R', data.byte(kReallocation), 'C', (64 * (data.byte(kCharacter) & 0x7F)) + data.byte(kTalkpos)); + if (data.byte(kSpeechloaded) != 0) + playChannel1(62); + + data.byte(kPointermode) = 3; + workToScreenM(); + cx = 180; + hangOnPQ(); + if (flags.c()) + return; + } + + data.byte(kTalkpos)++; + } +} void DreamGenContext::hangOnPQ() { data.byte(kGetback) = 0; -- cgit v1.2.3 From 4bb6305e59a1b3aa6ff1135ba8660fede22ff0e8 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Sun, 25 Dec 2011 07:42:04 +0000 Subject: DREAMWEB: Change hangOnPQ function signature to avoid carry flag usage. --- engines/dreamweb/stubs.h | 2 +- engines/dreamweb/talk.cpp | 13 +++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index b1406182f0..bf5f5c54df 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -173,7 +173,7 @@ void madmanRun(); void decide(); void talk(); - void hangOnPQ(); + bool hangOnPQ(); void showGun(); void endGame(); void newPlace(); diff --git a/engines/dreamweb/talk.cpp b/engines/dreamweb/talk.cpp index 834109b1dc..f13f40e229 100644 --- a/engines/dreamweb/talk.cpp +++ b/engines/dreamweb/talk.cpp @@ -173,8 +173,7 @@ void DreamGenContext::doSomeTalk() { data.byte(kPointermode) = 3; workToScreenM(); cx = 180; - hangOnPQ(); - if (flags.c()) + if (hangOnPQ()) return; data.byte(kTalkpos)++; @@ -213,8 +212,7 @@ void DreamGenContext::doSomeTalk() { data.byte(kPointermode) = 3; workToScreenM(); cx = 180; - hangOnPQ(); - if (flags.c()) + if (hangOnPQ()) return; } @@ -222,7 +220,7 @@ void DreamGenContext::doSomeTalk() { } } -void DreamGenContext::hangOnPQ() { +bool DreamGenContext::hangOnPQ() { data.byte(kGetback) = 0; RectWithCallback quitList[] = { @@ -248,8 +246,7 @@ void DreamGenContext::hangOnPQ() { delPointer(); data.byte(kPointermode) = 0; cancelCh1(); - flags._c = true; - return; + return true; } if (data.byte(kSpeechloaded) == 1 && data.byte(kCh1playing) == 255) { @@ -261,7 +258,7 @@ void DreamGenContext::hangOnPQ() { delPointer(); data.byte(kPointermode) = 0; - flags._c = false; + return false; } void DreamGenContext::redes() { -- cgit v1.2.3 From fb068a1dbc4471b22ccc088816343e92bd1a94b4 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sun, 25 Dec 2011 12:41:37 +0100 Subject: DREAMWEB: Simplify order of checkObjectSize checks --- engines/dreamweb/object.cpp | 47 ++++++++++++++++----------------------------- 1 file changed, 17 insertions(+), 30 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index 7e1ba1c2a3..4addfc404e 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -771,39 +771,26 @@ bool DreamGenContext::checkObjectSizeCPP() { // to 6. This could be a bad idea, according to the original source. byte objectSize = (object->objectSize != 255) ? object->objectSize : 6; - if (objectSize >= 100) { - // Special case - if (containerSize >= 100) { - // Both objects are special - if (containerSize == objectSize) { - return true; - } else { - errorMessage3(); - return false; - } - } else { - if (containerSize >= (byte)(objectSize - 100)) { - return true; - } else { - errorMessage2(); - return false; - } - } - } else if (containerSize >= 100) { // The current object isn't special, but the container object is + if (containerSize >= 100) { + // Special type of container: only objects of the same special type fit. + if (containerSize == objectSize) + return true; + errorMessage3(); return false; - } else if (containerSize >= objectSize) { - return true; - } else { - // The original continues here to the special case above. It checks if - // cl (containerSize) < al (objectSize) and continues if this is so. - // However, in this case, the code subtracts 100 from objectSize, which - // was between 0 - 99, so it now is between 156 and 255. containerSize is - // smaller than 100, so comparing it with objectSize will always be true, - // thus this bit of code always falls through to the errorMessage2() case. - errorMessage2(); - return false; } + + if (objectSize >= 100) { + // Special type of object, but a regular container. + // Subtract 100 from the size to get its regular size. + objectSize -= 100; + } + + if (containerSize >= objectSize) + return true; + + errorMessage2(); + return false; } } // End of namespace DreamGen -- cgit v1.2.3 From 85e54574023fde58933da06a5192793597de1ec0 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sun, 25 Dec 2011 12:54:12 +0100 Subject: DREAMWEB: Move talk functions to DreamBase --- engines/dreamweb/dreambase.h | 6 ++++++ engines/dreamweb/stubs.h | 4 ---- engines/dreamweb/talk.cpp | 15 +++++++-------- 3 files changed, 13 insertions(+), 12 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 0123943c35..be88295631 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -539,6 +539,12 @@ public: void entryAnims(); bool finishedWalking(); + // from talk.cpp + void convIcons(); + uint16 getPersFrame(uint8 index); + const uint8 *getPersonText(uint8 index); + void startTalk(); + // from use.cpp void placeFreeObject(uint8 index); void removeFreeObject(uint8 index); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index bf5f5c54df..52798f556f 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -96,10 +96,6 @@ DreamBase::hangOn(frameCount); } void showCity(); - uint16 getPersFrame(uint8 index); - void convIcons(); - void startTalk(); - void getPersonText(uint8 index); void doSomeTalk(); void examineOb(bool examineAgain = true); void dumpWatch(); diff --git a/engines/dreamweb/talk.cpp b/engines/dreamweb/talk.cpp index f13f40e229..e364d63e36 100644 --- a/engines/dreamweb/talk.cpp +++ b/engines/dreamweb/talk.cpp @@ -73,22 +73,21 @@ void DreamGenContext::talk() { } } -void DreamGenContext::convIcons() { +void DreamBase::convIcons() { uint8 index = data.byte(kCharacter) & 127; uint16 frame = getPersFrame(index); const Frame *base = findSource(frame); showFrame(base, 234, 2, frame, 0); } -uint16 DreamGenContext::getPersFrame(uint8 index) { +uint16 DreamBase::getPersFrame(uint8 index) { return getSegment(data.word(kPeople)).word(kPersonframes + index * 2); } -void DreamGenContext::startTalk() { +void DreamBase::startTalk() { data.byte(kTalkmode) = 0; - getPersonText(data.byte(kCharacter) & 0x7F); - const uint8 *str = es.ptr(si, 0); + const uint8 *str = getPersonText(data.byte(kCharacter) & 0x7F); uint16 y; data.word(kCharshift) = 91+91; @@ -108,9 +107,9 @@ void DreamGenContext::startTalk() { } } -void DreamGenContext::getPersonText(uint8 index) { - es = data.word(kPeople); - si = es.word((index * 64 * 2) + kPersontxtdat) + kPersontext; +const uint8 *DreamBase::getPersonText(uint8 index) { + uint16 offset = kPersontext + getSegment(data.word(kPeople)).word((index * 64 * 2) + kPersontxtdat); + return getSegment(data.word(kPeople)).ptr(offset, 0); } void DreamGenContext::moreTalk() { -- cgit v1.2.3 From 5e976490c75ad9fdf11bff8f07dc1985eb56b15e Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sun, 25 Dec 2011 13:02:56 +0100 Subject: DREAMWEB: Move remaining talk functions to DreamBase --- engines/dreamweb/dreambase.h | 7 +++++- engines/dreamweb/stubs.h | 5 ---- engines/dreamweb/talk.cpp | 56 +++++++++++++------------------------------- 3 files changed, 22 insertions(+), 46 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index be88295631..3b53353915 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -540,10 +540,15 @@ public: bool finishedWalking(); // from talk.cpp + void talk(); void convIcons(); uint16 getPersFrame(uint8 index); - const uint8 *getPersonText(uint8 index); + const uint8 *getPersonText(uint8 index, uint8 talkPos); void startTalk(); + void moreTalk(); + void doSomeTalk(); + bool hangOnPQ(); + void redes(); // from use.cpp void placeFreeObject(uint8 index); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 52798f556f..0f473c8751 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -96,7 +96,6 @@ DreamBase::hangOn(frameCount); } void showCity(); - void doSomeTalk(); void examineOb(bool examineAgain = true); void dumpWatch(); void transferText(); @@ -157,8 +156,6 @@ void nextDest(); void lastDest(); void destSelect(); - void moreTalk(); - void redes(); void selectLocation(); void loadSpeech(); bool loadSpeech(byte type1, int idx1, byte type2, int idx2) { @@ -168,8 +165,6 @@ void afterNewRoom(); void madmanRun(); void decide(); - void talk(); - bool hangOnPQ(); void showGun(); void endGame(); void newPlace(); diff --git a/engines/dreamweb/talk.cpp b/engines/dreamweb/talk.cpp index e364d63e36..131e164cf6 100644 --- a/engines/dreamweb/talk.cpp +++ b/engines/dreamweb/talk.cpp @@ -24,7 +24,7 @@ namespace DreamGen { -void DreamGenContext::talk() { +void DreamBase::talk() { data.byte(kTalkpos) = 0; data.byte(kInmaparea) = 0; data.byte(kCharacter) = data.byte(kCommand); @@ -42,7 +42,7 @@ void DreamGenContext::talk() { RectWithCallback talkList[] = { { 273,320,157,198,&DreamBase::getBack1 }, - { 240,290,2,44,&DreamGenContext::moreTalk }, + { 240,290,2,44,&DreamBase::moreTalk }, { 0,320,0,200,&DreamBase::blank }, { 0xFFFF,0,0,0,0 } }; @@ -87,7 +87,7 @@ uint16 DreamBase::getPersFrame(uint8 index) { void DreamBase::startTalk() { data.byte(kTalkmode) = 0; - const uint8 *str = getPersonText(data.byte(kCharacter) & 0x7F); + const uint8 *str = getPersonText(data.byte(kCharacter) & 0x7F, 0); uint16 y; data.word(kCharshift) = 91+91; @@ -107,12 +107,12 @@ void DreamBase::startTalk() { } } -const uint8 *DreamBase::getPersonText(uint8 index) { - uint16 offset = kPersontext + getSegment(data.word(kPeople)).word((index * 64 * 2) + kPersontxtdat); +const uint8 *DreamBase::getPersonText(uint8 index, uint8 talkPos) { + uint16 offset = kPersontext + getSegment(data.word(kPeople)).word(((index * 64 + talkPos) * 2) + kPersontxtdat); return getSegment(data.word(kPeople)).ptr(offset, 0); } -void DreamGenContext::moreTalk() { +void DreamBase::moreTalk() { if (data.byte(kTalkmode) != 0) { redes(); return; @@ -137,33 +137,23 @@ void DreamGenContext::moreTalk() { doSomeTalk(); } -void DreamGenContext::doSomeTalk() { +void DreamBase::doSomeTalk() { while (true) { - es = data.word(kPeople); - si = ((data.byte(kTalkpos) + (64 * (data.byte(kCharacter) & 0x7F))) * 2) + kPersontxtdat; - si = es.word(si) + kPersontext; + const uint8 *str = getPersonText(data.byte(kCharacter) & 0x7F, data.byte(kTalkpos)); - if (es.byte(si) == 0) { + if (*str == 0) { // endheartalk data.byte(kPointermode) = 0; return; } - push(es); - push(si); - createPanel(); showPanel(); showMan(); showExit(); convIcons(); - si = pop(); - es = pop(); - - const uint8 *str = es.ptr(si, 0); - uint16 y = 64; - printDirect(&str, 164, &y, 144, false); + printDirect(str, 164, 64, 144, false); loadSpeech('R', data.byte(kReallocation), 'C', (64 * (data.byte(kCharacter) & 0x7F)) + data.byte(kTalkpos)); if (data.byte(kSpeechloaded) != 0) @@ -171,38 +161,25 @@ void DreamGenContext::doSomeTalk() { data.byte(kPointermode) = 3; workToScreenM(); - cx = 180; if (hangOnPQ()) return; data.byte(kTalkpos)++; - es = data.word(kPeople); - si = kPersontxtdat + (((64 * (data.byte(kCharacter) & 0x7F)) + data.byte(kTalkpos)) * 2); - si = es.word(si) + kPersontext; - - if (es.byte(si) == 0) { + str = getPersonText(data.byte(kCharacter) & 0x7F, data.byte(kTalkpos)); + if (*str == 0) { // endheartalk data.byte(kPointermode) = 0; return; } - if (es.byte(si) != ':' && es.byte(si) != 32) { - push(es); - push(si); - + if (*str != ':' && *str != 32) { createPanel(); showPanel(); showMan(); showExit(); convIcons(); - - si = pop(); - es = pop(); - - str = es.ptr(si, 0); - y = 128; - printDirect(&str, 48, &y, 144, false); + printDirect(str, 48, 128, 144, false); loadSpeech('R', data.byte(kReallocation), 'C', (64 * (data.byte(kCharacter) & 0x7F)) + data.byte(kTalkpos)); if (data.byte(kSpeechloaded) != 0) @@ -210,7 +187,6 @@ void DreamGenContext::doSomeTalk() { data.byte(kPointermode) = 3; workToScreenM(); - cx = 180; if (hangOnPQ()) return; } @@ -219,7 +195,7 @@ void DreamGenContext::doSomeTalk() { } } -bool DreamGenContext::hangOnPQ() { +bool DreamBase::hangOnPQ() { data.byte(kGetback) = 0; RectWithCallback quitList[] = { @@ -260,7 +236,7 @@ bool DreamGenContext::hangOnPQ() { return false; } -void DreamGenContext::redes() { +void DreamBase::redes() { if (data.byte(kCh1playing) != 255 || data.byte(kTalkmode) != 2) { blank(); return; -- cgit v1.2.3 From e412078319c11206617c8d86d9b6f166b4526287 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 25 Dec 2011 14:13:48 +0200 Subject: DREAMWEB: Name the return values of getAnyAd --- engines/dreamweb/dreambase.h | 2 +- engines/dreamweb/stubs.cpp | 14 +++++++------- engines/dreamweb/stubs.h | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 3b53353915..2a61331290 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -403,7 +403,7 @@ public: void showMan(); void panelIcons1(); SetObject *getSetAd(uint8 index); - void *getAnyAd(uint8 *value1, uint8 *value2); + void *getAnyAd(uint8 *slotSize, uint8 *slotCount); const uint8 *getTextInFile1(uint16 index); uint8 findNextColon(const uint8 **string); void allocateBuffers(); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 2120668ef6..2ad4af89b9 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -1309,16 +1309,16 @@ DynObject *DreamBase::getEitherAdCPP() { return getFreeAd(data.byte(kItemframe)); } -void *DreamBase::getAnyAd(uint8 *value1, uint8 *value2) { +void *DreamBase::getAnyAd(uint8 *slotSize, uint8 *slotCount) { if (data.byte(kObjecttype) == kExObjectType) { DynObject *exObject = getExAd(data.byte(kCommand)); - *value1 = exObject->slotSize; - *value2 = exObject->slotCount; + *slotSize = exObject->slotSize; + *slotCount = exObject->slotCount; return exObject; } else if (data.byte(kObjecttype) == kFreeObjectType) { DynObject *freeObject = getFreeAd(data.byte(kCommand)); - *value1 = freeObject->slotSize; - *value2 = freeObject->slotCount; + *slotSize = freeObject->slotSize; + *slotCount = freeObject->slotCount; return freeObject; } else { // 1 or 3. 0 should never happen SetObject *setObject = getSetAd(data.byte(kCommand)); @@ -1326,8 +1326,8 @@ void *DreamBase::getAnyAd(uint8 *value1, uint8 *value2) { // instead of slotSize/slotCount (bytes 3 and 4). // Changed this for consistency with the Ex/Free cases, and also // with getOpenedSize() - *value1 = setObject->slotSize; - *value2 = setObject->slotCount; + *slotSize = setObject->slotSize; + *slotCount = setObject->slotCount; return setObject; } } diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 0f473c8751..ed0afa4ea9 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -71,8 +71,8 @@ DynObject *getExAd(uint8 index) { return DreamBase::getExAd(index); } - void *getAnyAd(uint8 *value1, uint8 *value2) { - return DreamBase::getAnyAd(value1, value2); + void *getAnyAd(uint8 *slotSize, uint8 *slotCount) { + return DreamBase::getAnyAd(slotSize, slotCount); } SetObject *getSetAd(uint8 index) { return DreamBase::getSetAd(index); -- cgit v1.2.3 From 3ac88c16ea63243a46444e5754a94e41302f2d64 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 25 Dec 2011 14:30:00 +0200 Subject: DREAMWEB: Port 'selectopenob' to C++ --- engines/dreamweb/dreamgen.cpp | 46 ------------------------------------------- engines/dreamweb/dreamgen.h | 1 - engines/dreamweb/object.cpp | 33 +++++++++++++++++++++++++++++++ engines/dreamweb/stubs.h | 1 + 4 files changed, 34 insertions(+), 47 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 8cd5dd43df..bca2232267 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -537,52 +537,6 @@ findopenp1: _add(bx, (0+(228*13))); } -void DreamGenContext::selectOpenOb() { - STACK_CHECK; - al = data.byte(kCommand); - getAnyAd(); - _cmp(al, 255); - if (!flags.z()) - goto canopenit1; - blank(); - return; -canopenit1: - _cmp(data.byte(kCommandtype), 224); - if (flags.z()) - goto alreadyopob; - data.byte(kCommandtype) = 224; - bl = data.byte(kCommand); - bh = data.byte(kObjecttype); - al = 38; - commandWithOb(); -alreadyopob: - ax = data.word(kMousebutton); - _cmp(ax, data.word(kOldbutton)); - if (flags.z()) - return /* (noopenob) */; - _and(ax, 1); - if (!flags.z()) - goto doopenob; - return; -doopenob: - al = data.byte(kCommand); - data.byte(kOpenedob) = al; - al = data.byte(kObjecttype); - data.byte(kOpenedtype) = al; - createPanel(); - showPanel(); - showMan(); - examIcon(); - showExit(); - openInv(); - openOb(); - underTextLine(); - readMouse(); - showPointer(); - workToScreen(); - delPointer(); -} - void DreamGenContext::useOpened() { STACK_CHECK; _cmp(data.byte(kOpenedob), 255); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 52009dc5ed..db9a8c2eeb 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -478,7 +478,6 @@ public: void getDestInfo(); void read(); void searchForString(); - void selectOpenOb(); void searchForFiles(); void getExAd(); void swapWithInv(); diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index 4addfc404e..dff58050a5 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -793,4 +793,37 @@ bool DreamGenContext::checkObjectSizeCPP() { return false; } +void DreamGenContext::selectOpenOb() { + uint8 slotSize, slotCount; + getAnyAd(&slotSize, &slotCount); + if (slotCount == 255) { + // Can't open the object + blank(); + return; + } + + if (data.byte(kCommandtype) != 224) { + data.byte(kCommandtype) = 224; + commandWithOb(38, data.byte(kObjecttype), data.byte(kCommand)); + } + + if (data.word(kMousebutton) == data.word(kOldbutton) || !(data.word(kMousebutton) & 1)) + return; + + data.byte(kOpenedob) = data.byte(kCommand); + data.byte(kOpenedtype) = data.byte(kObjecttype); + createPanel(); + showPanel(); + showMan(); + examIcon(); + showExit(); + openInv(); + openOb(); + underTextLine(); + readMouse(); + showPointer(); + workToScreenCPP(); + delPointer(); +} + } // End of namespace DreamGen diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index ed0afa4ea9..547714e006 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -197,5 +197,6 @@ void lookAtPlace(); void inToInv(); void outOfInv(); + void selectOpenOb(); #endif -- cgit v1.2.3 From 3802b21183b148f1c8d43cc8d2e550afed6e9e6a Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 25 Dec 2011 15:07:56 +0200 Subject: DREAMWEB: Move some functions to DreamBase --- engines/dreamweb/dreambase.h | 5 +++++ engines/dreamweb/newplace.cpp | 7 ++++--- engines/dreamweb/structs.h | 2 +- engines/dreamweb/stubs.h | 7 +------ engines/dreamweb/use.cpp | 41 ++++++++++++++++++++++------------------- 5 files changed, 33 insertions(+), 29 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 2a61331290..9e45e046f4 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -178,6 +178,9 @@ public: uint8 getLocation(uint8 index); void setLocation(uint8 index); void resetLocation(uint8 index); + void readCityPic(); + void readDestIcon(); + void showCity(); // from object.cpp void obIcons(); @@ -636,6 +639,8 @@ public: void wearWatch(); void wearShades(); void useTrainer(); + void useStereo(); + void chewy(); // from vgafades.cpp void clearStartPal(); diff --git a/engines/dreamweb/newplace.cpp b/engines/dreamweb/newplace.cpp index f1743f0e6d..69e452865e 100644 --- a/engines/dreamweb/newplace.cpp +++ b/engines/dreamweb/newplace.cpp @@ -34,6 +34,7 @@ void DreamGenContext::newPlace() { } } +// TODO: Move to DreamBase once locationPic is moved void DreamGenContext::selectLocation() { data.byte(kInmaparea) = 0; clearBeforeLoad(); @@ -95,7 +96,7 @@ void DreamGenContext::selectLocation() { deallocateMem(data.word(kTraveltext)); } -void DreamGenContext::showCity() { +void DreamBase::showCity() { clearWork(); showFrame(tempGraphics(), 57, 32, 0, 0); showFrame(tempGraphics(), 120+57, 32, 1, 0); @@ -259,13 +260,13 @@ void DreamBase::resetLocation(uint8 index) { data.byte(kRoomscango + index) = 0; } -void DreamGenContext::readDestIcon() { +void DreamBase::readDestIcon() { loadIntoTemp("DREAMWEB.G05"); loadIntoTemp2("DREAMWEB.G06"); loadIntoTemp3("DREAMWEB.G08"); } -void DreamGenContext::readCityPic() { +void DreamBase::readCityPic() { loadIntoTemp("DREAMWEB.G04"); } diff --git a/engines/dreamweb/structs.h b/engines/dreamweb/structs.h index 5d93d1d99f..d64bcab5d0 100644 --- a/engines/dreamweb/structs.h +++ b/engines/dreamweb/structs.h @@ -123,7 +123,7 @@ struct DynObject { uint8 slotSize; // the size of an object's slots uint8 slotCount; // the number of slots of an object uint8 objectSize; // the size of an object - uint8 b10; + uint8 turnedOn; uint8 initialLocation; uint8 id[4]; }; diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 547714e006..0c764a4495 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -39,8 +39,6 @@ } void quickQuit(); void readOneBlock(); - void readCityPic(); - void readDestIcon(); void seeCommandTail(); void quickQuit2(); void printDirect(); @@ -95,7 +93,6 @@ void hangOn(uint16 frameCount) { DreamBase::hangOn(frameCount); } - void showCity(); void examineOb(bool examineAgain = true); void dumpWatch(); void transferText(); @@ -148,7 +145,6 @@ void afterIntroRoom(); void gettingShot(); void allPointer(); - void chewy(); void delEverything(); void errorMessage1(); void errorMessage2(); @@ -156,7 +152,6 @@ void nextDest(); void lastDest(); void destSelect(); - void selectLocation(); void loadSpeech(); bool loadSpeech(byte type1, int idx1, byte type2, int idx2) { return DreamBase::loadSpeech(type1, idx1, type2, idx2); @@ -183,7 +178,6 @@ bool checkObjectSizeCPP(); void openOb(); void identifyOb(); - void useStereo(); void selectOb(); void findInvPos(); uint16 findInvPosCPP(); @@ -198,5 +192,6 @@ void inToInv(); void outOfInv(); void selectOpenOb(); + void selectLocation(); #endif diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp index 47c9ae62b8..eeda27780c 100644 --- a/engines/dreamweb/use.cpp +++ b/engines/dreamweb/use.cpp @@ -45,7 +45,7 @@ void DreamGenContext::useRoutine() { { &DreamBase::useElevator4, "ELVE" }, { &DreamBase::useElevator5, "ELVF" }, { &DreamBase::useChurchGate, "CGAT" }, - { &DreamGenContext::useStereo, "REMO" }, + { &DreamBase::useStereo, "REMO" }, { &DreamBase::useButtonA, "BUTA" }, { &DreamBase::useWinch, "CBOX" }, { &DreamBase::useLighter, "LITE" }, @@ -113,7 +113,7 @@ void DreamGenContext::useRoutine() { { &DreamBase::usePlinth, "PLIN" }, { &DreamBase::useLadder, "LADD" }, { &DreamBase::useLadderB, "LADB" }, - { &DreamGenContext::chewy, "GUMA" }, + { &DreamBase::chewy, "GUMA" }, { &DreamBase::wheelSound, "SQEE" }, { &DreamBase::runTap, "TAPP" }, { &DreamBase::playGuitar, "GUIT" }, @@ -242,6 +242,7 @@ void DreamBase::playGuitar() { putBackObStuff(); } +// TODO: Move to DreamBase once selectLocation (in reality, locationPic) is moved void DreamGenContext::useElevator1() { showFirstUse(); selectLocation(); @@ -1040,11 +1041,12 @@ void DreamBase::useTrainer() { } } -void DreamGenContext::chewy() { +void DreamBase::chewy() { + // Chewing a gum showFirstUse(); - // TODO: Use the C++ version of getAnyAd() - getAnyAd(); - es.byte(bx + 2) = 255; + uint8 dummy; + DynObject *object = (DynObject *)getAnyAd(&dummy, &dummy); + object->mapad[0] = 255; data.byte(kGetback) = 1; } @@ -1631,7 +1633,10 @@ void DreamBase::useCashCard() { putBackObStuff(); } -void DreamGenContext::useStereo() { +void DreamBase::useStereo() { + // Handles the stereo in Ryan's apartment (accessible from the remote on + // the couch) + if (data.byte(kLocation) != 0) { showPuzText(4, 400); putBackObStuff(); @@ -1642,20 +1647,18 @@ void DreamGenContext::useStereo() { // No CD inside showPuzText(6, 400); putBackObStuff(); - // TODO: Use the C++ version of getAnyAd() - getAnyAd(); - es.byte(bx + 10) = 255; + uint8 dummy; + DynObject *object = (DynObject *)getAnyAd(&dummy, &dummy); + object->turnedOn = 255; } else { // CD inside - getAnyAd(); - es.byte(bx + 10) ^= 1; - if (es.byte(bx + 10) != 255) { - // Stereo off - showPuzText(7, 400); - } else { - // Stereo on - showPuzText(8, 400); - } + uint8 dummy; + DynObject *object = (DynObject *)getAnyAd(&dummy, &dummy); + object->turnedOn ^= 1; + if (object->turnedOn != 255) + showPuzText(7, 400); // Stereo off + else + showPuzText(8, 400); // Stereo on putBackObStuff(); } -- cgit v1.2.3 From e322d6257dae83761c86c9d5bfbc7d02c0a9988d Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 25 Dec 2011 16:33:30 +0200 Subject: DREAMWEB: Port 'locationpic', 'reexfrominv' to C++ --- engines/dreamweb/dreamgen.cpp | 58 ------------------------------------------- engines/dreamweb/dreamgen.h | 2 -- engines/dreamweb/newplace.cpp | 16 +++++++++++- engines/dreamweb/object.cpp | 8 ++++++ engines/dreamweb/stubs.cpp | 1 + engines/dreamweb/stubs.h | 2 ++ engines/dreamweb/use.cpp | 2 +- 7 files changed, 27 insertions(+), 62 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index bca2232267..55ab3755af 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -284,16 +284,6 @@ findopen2a: goto findopen1a; } -void DreamGenContext::reExFromInv() { - STACK_CHECK; - findInvPos(); - ax = es.word(bx); - data.byte(kCommandtype) = ah; - data.byte(kCommand) = al; - data.byte(kExamagain) = 1; - data.byte(kPointermode) = 0; -} - void DreamGenContext::swapWithInv() { STACK_CHECK; al = data.byte(kItemframe); @@ -881,54 +871,6 @@ cantpurge2: goto lookforpurge2; } -void DreamGenContext::locationPic() { - STACK_CHECK; - getDestInfo(); - al = es.byte(si); - push(es); - push(si); - di = 0; - _cmp(al, 6); - if (!flags.c()) - goto secondlot; - ds = data.word(kTempgraphics); - _add(al, 4); - goto gotgraphic; -secondlot: - _sub(al, 6); - ds = data.word(kTempgraphics2); -gotgraphic: - _add(di, 104); - bx = 138+14; - ah = 0; - showFrame(); - si = pop(); - es = pop(); - al = data.byte(kDestpos); - _cmp(al, data.byte(kReallocation)); - if (!flags.z()) - goto notinthisone; - al = 3; - di = 104; - bx = 140+14; - ds = data.word(kTempgraphics); - ah = 0; - showFrame(); -notinthisone: - bl = data.byte(kDestpos); - bh = 0; - _add(bx, bx); - es = data.word(kTraveltext); - si = es.word(bx); - _add(si, (66*2)); - di = 50; - bx = 20; - dl = 241; - al = 0; - ah = 0; - printDirect(); -} - void DreamGenContext::getDestInfo() { STACK_CHECK; al = data.byte(kDestpos); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index db9a8c2eeb..ffefa0dd3e 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -461,7 +461,6 @@ public: void getFreeAd(); void dirFile(); void pickupConts(); - void reExFromInv(); void transferMap(); void purgeAnItem(); void getSetAd(); @@ -471,7 +470,6 @@ public: void fillOpen(); void getEitherAd(); void useOpened(); - void locationPic(); void swapWithOpen(); void dreamweb(); void findPathOfPoint(); diff --git a/engines/dreamweb/newplace.cpp b/engines/dreamweb/newplace.cpp index 69e452865e..027d7c1937 100644 --- a/engines/dreamweb/newplace.cpp +++ b/engines/dreamweb/newplace.cpp @@ -34,7 +34,7 @@ void DreamGenContext::newPlace() { } } -// TODO: Move to DreamBase once locationPic is moved +// TODO: Move to DreamBase once getDestInfo is moved void DreamGenContext::selectLocation() { data.byte(kInmaparea) = 0; clearBeforeLoad(); @@ -270,6 +270,20 @@ void DreamBase::readCityPic() { loadIntoTemp("DREAMWEB.G04"); } +void DreamGenContext::locationPic() { + getDestInfo(); + byte destFlag = es.byte(si); + if (destFlag >= 6) + showFrame(tempGraphics2(), 104, 138 + 14, destFlag - 6, 0); // Second slot + else + showFrame(tempGraphics(), 104, 138 + 14, destFlag + 4, 0); + + if (data.byte(kDestpos) == data.byte(kReallocation)) + showFrame(tempGraphics(), 104, 140 + 14, 3, 0); // Currently in this location + uint16 offset = kTextstart + getSegment(data.word(kTraveltext)).word(data.byte(kDestpos) * 2); + const uint8 *string = getSegment(data.word(kTraveltext)).ptr(offset, 0); + DreamBase::printDirect(string, 50, 20, 241, 241 & 1); +} } // End of namespace DreamGen diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index dff58050a5..9d81825964 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -826,4 +826,12 @@ void DreamGenContext::selectOpenOb() { delPointer(); } +void DreamGenContext::reExFromInv() { + uint16 objectId = getSegment(data.word(kBuffers)).word(findInvPosCPP()); + data.byte(kCommandtype) = objectId >> 8; + data.byte(kCommand) = objectId & 0x00FF; + data.byte(kExamagain) = 1; + data.byte(kPointermode) = 0; +} + } // End of namespace DreamGen diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 2ad4af89b9..3a0ca79a1d 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -3700,4 +3700,5 @@ void DreamBase::incRyanPage() { delPointer(); } + } // End of namespace DreamGen diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 0c764a4495..a4fcbf761d 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -193,5 +193,7 @@ void outOfInv(); void selectOpenOb(); void selectLocation(); + void reExFromInv(); + void locationPic(); #endif diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp index eeda27780c..41b338e885 100644 --- a/engines/dreamweb/use.cpp +++ b/engines/dreamweb/use.cpp @@ -242,7 +242,7 @@ void DreamBase::playGuitar() { putBackObStuff(); } -// TODO: Move to DreamBase once selectLocation (in reality, locationPic) is moved +// TODO: Move to DreamBase once selectLocation (in reality, getDestInfo) is moved void DreamGenContext::useElevator1() { showFirstUse(); selectLocation(); -- cgit v1.2.3 From 0fff97b4b023895256cb8cce9b30684d433bfae4 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 25 Dec 2011 17:10:49 +0200 Subject: DREAMWEB: Port 'useopened' to C++ --- engines/dreamweb/dreamgen.cpp | 94 ------------------------------------------- engines/dreamweb/dreamgen.h | 1 - engines/dreamweb/object.cpp | 68 +++++++++++++++++++++++++++++++ engines/dreamweb/stubs.h | 1 + 4 files changed, 69 insertions(+), 95 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 55ab3755af..4d89322a77 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -527,100 +527,6 @@ findopenp1: _add(bx, (0+(228*13))); } -void DreamGenContext::useOpened() { - STACK_CHECK; - _cmp(data.byte(kOpenedob), 255); - if (flags.z()) - return /* (cannotuseopen) */; - _cmp(data.byte(kPickup), 0); - if (!flags.z()) - goto notout2; - outOfOpen(); - return; -notout2: - findOpenPos(); - ax = es.word(bx); - _cmp(al, 255); - if (flags.z()) - goto canplace3; - swapWithOpen(); - return; -canplace3: - _cmp(data.byte(kPickup), 1); - if (flags.z()) - goto intoopen; - blank(); - return; -intoopen: - al = data.byte(kItemframe); - ah = data.byte(kObjecttype); - _cmp(ax, data.word(kOldsubject)); - if (!flags.z()) - goto difsub2; - _cmp(data.byte(kCommandtype), 227); - if (flags.z()) - goto alreadyplc2; - data.byte(kCommandtype) = 227; -difsub2: - data.word(kOldsubject) = ax; - bx = ax; - al = 35; - commandWithOb(); -alreadyplc2: - ax = data.word(kMousebutton); - _cmp(ax, data.word(kOldbutton)); - if (flags.z()) - return /* (notletgo3) */; - _cmp(ax, 1); - if (flags.z()) - goto doplace2; - return; -doplace2: - getEitherAd(); - isItWorn(); - if (!flags.z()) - goto notworntoopen; - wornError(); - return; -notworntoopen: - delPointer(); - al = data.byte(kItemframe); - _cmp(al, data.byte(kOpenedob)); - if (!flags.z()) - goto isntsame; - al = data.byte(kObjecttype); - _cmp(al, data.byte(kOpenedtype)); - if (!flags.z()) - goto isntsame; - errorMessage1(); - return; -isntsame: - checkObjectSize(); - _cmp(al, 0); - if (flags.z()) - goto sizeok1; - return; -sizeok1: - data.byte(kPickup) = 0; - al = data.byte(kItemframe); - getEitherAd(); - al = data.byte(kOpenedtype); - es.byte(bx+2) = al; - al = data.byte(kOpenedob); - es.byte(bx+3) = al; - al = data.byte(kLastinvpos); - es.byte(bx+4) = al; - al = data.byte(kReallocation); - es.byte(bx+5) = al; - fillOpen(); - underTextLine(); - readMouse(); - useOpened(); - showPointer(); - workToScreen(); - delPointer(); -} - void DreamGenContext::outOfOpen() { STACK_CHECK; _cmp(data.byte(kOpenedob), 255); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index ffefa0dd3e..3ddf858053 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -469,7 +469,6 @@ public: void findAllOpen(); void fillOpen(); void getEitherAd(); - void useOpened(); void swapWithOpen(); void dreamweb(); void findPathOfPoint(); diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index 9d81825964..8399c6f26a 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -834,4 +834,72 @@ void DreamGenContext::reExFromInv() { data.byte(kPointermode) = 0; } +void DreamGenContext::useOpened() { + if (data.byte(kOpenedob) == 255) + return; // cannot use opened object + + if (!data.byte(kPickup)) { + outOfOpen(); + return; + } + + findOpenPos(); + ax = es.word(bx); + + if (al != 255) { + swapWithOpen(); + return; + } + + if (data.byte(kPickup) != 1) { + blank(); + return; + } + + uint16 subject = (data.byte(kObjecttype) << 8) | data.byte(kItemframe); + if (subject == data.word(kOldsubject)) { + if (data.byte(kCommandtype) != 227) { + data.byte(kCommandtype) = 227; + data.word(kOldsubject) = subject; + commandWithOb(35, data.byte(kObjecttype), data.byte(kItemframe)); + } + } else { + data.word(kOldsubject) = subject; + commandWithOb(35, data.byte(kObjecttype), data.byte(kItemframe)); + } + + if (data.word(kMousebutton) == data.word(kOldbutton) || !(data.word(kMousebutton) & 1)) + return; + + if (isItWorn(getEitherAdCPP())) { + wornError(); + return; + } + + delPointer(); + + if (data.byte(kItemframe) == data.byte(kOpenedob) && + data.byte(kObjecttype) == data.byte(kOpenedtype)) { + errorMessage1(); + return; + } + + if (!checkObjectSizeCPP()) + return; + + data.byte(kPickup) = 0; + DynObject *object = getEitherAdCPP(); + object->mapad[0] = data.byte(kOpenedtype); + object->mapad[1] = data.byte(kOpenedob); + object->mapad[2] = data.byte(kLastinvpos); + object->mapad[3] = data.byte(kReallocation); + fillOpen(); + underTextLine(); + readMouse(); + useOpened(); + showPointer(); + workToScreenCPP(); + delPointer(); +} + } // End of namespace DreamGen diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index a4fcbf761d..4ba8cd6dd9 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -195,5 +195,6 @@ void selectLocation(); void reExFromInv(); void locationPic(); + void useOpened(); #endif -- cgit v1.2.3 From c531c4c1eafbf66a3724df0f3cb7b9ad8da97a8d Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 25 Dec 2011 17:32:56 +0200 Subject: DREAMWEB: Port 'swapwithinv' to C++ --- engines/dreamweb/dreamgen.cpp | 60 ------------------------------------------- engines/dreamweb/dreamgen.h | 1 - engines/dreamweb/object.cpp | 43 +++++++++++++++++++++++++++++++ engines/dreamweb/stubs.h | 1 + 4 files changed, 44 insertions(+), 61 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 4d89322a77..1afca17560 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -284,66 +284,6 @@ findopen2a: goto findopen1a; } -void DreamGenContext::swapWithInv() { - STACK_CHECK; - al = data.byte(kItemframe); - ah = data.byte(kObjecttype); - _cmp(ax, data.word(kOldsubject)); - if (!flags.z()) - goto difsub7; - _cmp(data.byte(kCommandtype), 243); - if (flags.z()) - goto alreadyswap1; - data.byte(kCommandtype) = 243; -difsub7: - data.word(kOldsubject) = ax; - bx = ax; - al = 34; - commandWithOb(); -alreadyswap1: - ax = data.word(kMousebutton); - _cmp(ax, data.word(kOldbutton)); - if (flags.z()) - return /* (cantswap1) */; - _and(ax, 1); - if (!flags.z()) - goto doswap1; - return; -doswap1: - ah = data.byte(kObjecttype); - al = data.byte(kItemframe); - push(ax); - findInvPos(); - ax = es.word(bx); - data.byte(kItemframe) = al; - data.byte(kObjecttype) = ah; - getEitherAd(); - es.byte(bx+2) = 20; - es.byte(bx+3) = 255; - bl = data.byte(kItemframe); - bh = data.byte(kObjecttype); - ax = pop(); - data.byte(kObjecttype) = ah; - data.byte(kItemframe) = al; - push(bx); - findInvPos(); - delPointer(); - al = data.byte(kItemframe); - getEitherAd(); - es.byte(bx+2) = 4; - es.byte(bx+3) = 255; - al = data.byte(kLastinvpos); - es.byte(bx+4) = al; - ax = pop(); - data.byte(kObjecttype) = ah; - data.byte(kItemframe) = al; - fillRyan(); - readMouse(); - showPointer(); - workToScreen(); - delPointer(); -} - void DreamGenContext::swapWithOpen() { STACK_CHECK; al = data.byte(kItemframe); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 3ddf858053..25901250b6 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -477,7 +477,6 @@ public: void searchForString(); void searchForFiles(); void getExAd(); - void swapWithInv(); void transferToEx(); void parser(); void emergencyPurge(); diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index 8399c6f26a..9eb31f438f 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -902,4 +902,47 @@ void DreamGenContext::useOpened() { delPointer(); } +void DreamGenContext::swapWithInv() { + uint16 subject = (data.byte(kObjecttype) << 8) | data.byte(kItemframe); + if (subject == data.word(kOldsubject)) { + if (data.byte(kCommandtype) != 243) { + data.byte(kCommandtype) = 243; + data.word(kOldsubject) = subject; + commandWithOb(34, data.byte(kObjecttype), data.byte(kItemframe)); + } + } else { + data.word(kOldsubject) = subject; + commandWithOb(34, data.byte(kObjecttype), data.byte(kItemframe)); + } + + if (data.word(kMousebutton) == data.word(kOldbutton) || !(data.word(kMousebutton) & 1)) + return; + + byte prevType = data.byte(kObjecttype); + byte prevFrame = data.byte(kItemframe); + uint16 objectId = getSegment(data.word(kBuffers)).word(findInvPosCPP()); + data.byte(kItemframe) = objectId & 0x00FF; + data.byte(kObjecttype) = objectId >> 8; + DynObject *object = getEitherAdCPP(); + object->mapad[0] = 20; + object->mapad[1] = 255; + byte prevType2 = data.byte(kObjecttype); + byte prevFrame2 = data.byte(kItemframe); + data.byte(kObjecttype) = prevType; + data.byte(kItemframe) = prevFrame; + //findInvPosCPP(); // found in the original source, but it seems to be useless + delPointer(); + object = getEitherAdCPP(); + object->mapad[0] = 4; + object->mapad[1] = 255; + object->mapad[2] = data.byte(kLastinvpos); + data.byte(kObjecttype) = prevType2; + data.byte(kItemframe) = prevFrame2; + fillRyan(); + readMouse(); + showPointer(); + workToScreenCPP(); + delPointer(); +} + } // End of namespace DreamGen diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 4ba8cd6dd9..2ac944b06a 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -196,5 +196,6 @@ void reExFromInv(); void locationPic(); void useOpened(); + void swapWithInv(); #endif -- cgit v1.2.3 From bf4271dfc116fa6f4b4245051e2d6a391f1d850c Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 25 Dec 2011 17:54:22 +0200 Subject: DREAMWEB: Port 'swapwithopen' to C++ --- engines/dreamweb/dreamgen.cpp | 102 ------------------------------------------ engines/dreamweb/dreamgen.h | 1 - engines/dreamweb/object.cpp | 91 ++++++++++++++++++++++++++++++++----- engines/dreamweb/stubs.h | 1 + 4 files changed, 82 insertions(+), 113 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 1afca17560..d68bd3b88f 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -284,108 +284,6 @@ findopen2a: goto findopen1a; } -void DreamGenContext::swapWithOpen() { - STACK_CHECK; - al = data.byte(kItemframe); - ah = data.byte(kObjecttype); - _cmp(ax, data.word(kOldsubject)); - if (!flags.z()) - goto difsub8; - _cmp(data.byte(kCommandtype), 242); - if (flags.z()) - goto alreadyswap2; - data.byte(kCommandtype) = 242; -difsub8: - data.word(kOldsubject) = ax; - bx = ax; - al = 34; - commandWithOb(); -alreadyswap2: - ax = data.word(kMousebutton); - _cmp(ax, data.word(kOldbutton)); - if (flags.z()) - return /* (cantswap2) */; - _and(ax, 1); - if (!flags.z()) - goto doswap2; - return; -doswap2: - getEitherAd(); - isItWorn(); - if (!flags.z()) - goto notwornswap; - wornError(); - return; -notwornswap: - delPointer(); - al = data.byte(kItemframe); - _cmp(al, data.byte(kOpenedob)); - if (!flags.z()) - goto isntsame2; - al = data.byte(kObjecttype); - _cmp(al, data.byte(kOpenedtype)); - if (!flags.z()) - goto isntsame2; - errorMessage1(); - return; -isntsame2: - checkObjectSize(); - _cmp(al, 0); - if (flags.z()) - goto sizeok2; - return; -sizeok2: - ah = data.byte(kObjecttype); - al = data.byte(kItemframe); - push(ax); - findOpenPos(); - ax = es.word(bx); - data.byte(kItemframe) = al; - data.byte(kObjecttype) = ah; - _cmp(ah, 4); - if (!flags.z()) - goto makeswapex; - getEitherAd(); - es.byte(bx+2) = 20; - es.byte(bx+3) = 255; - goto actuallyswap; -makeswapex: - transferToEx(); - data.byte(kItemframe) = al; - data.byte(kObjecttype) = 4; - getEitherAd(); - es.byte(bx+2) = 20; - es.byte(bx+3) = 255; -actuallyswap: - bl = data.byte(kItemframe); - bh = data.byte(kObjecttype); - ax = pop(); - data.byte(kObjecttype) = ah; - data.byte(kItemframe) = al; - push(bx); - findOpenPos(); - getEitherAd(); - al = data.byte(kOpenedtype); - es.byte(bx+2) = al; - al = data.byte(kOpenedob); - es.byte(bx+3) = al; - al = data.byte(kLastinvpos); - es.byte(bx+4) = al; - al = data.byte(kReallocation); - es.byte(bx+5) = al; - ax = pop(); - data.byte(kObjecttype) = ah; - data.byte(kItemframe) = al; - fillOpen(); - fillRyan(); - underTextLine(); - readMouse(); - useOpened(); - showPointer(); - workToScreen(); - delPointer(); -} - void DreamGenContext::getFreeAd() { STACK_CHECK; ah = 0; diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 25901250b6..f585c6a7b4 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -469,7 +469,6 @@ public: void findAllOpen(); void fillOpen(); void getEitherAd(); - void swapWithOpen(); void dreamweb(); void findPathOfPoint(); void getDestInfo(); diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index 9eb31f438f..6546f19da4 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -834,6 +834,49 @@ void DreamGenContext::reExFromInv() { data.byte(kPointermode) = 0; } +void DreamGenContext::swapWithInv() { + uint16 subject = (data.byte(kObjecttype) << 8) | data.byte(kItemframe); + if (subject == data.word(kOldsubject)) { + if (data.byte(kCommandtype) != 243) { + data.byte(kCommandtype) = 243; + data.word(kOldsubject) = subject; + commandWithOb(34, data.byte(kObjecttype), data.byte(kItemframe)); + } + } else { + data.word(kOldsubject) = subject; + commandWithOb(34, data.byte(kObjecttype), data.byte(kItemframe)); + } + + if (data.word(kMousebutton) == data.word(kOldbutton) || !(data.word(kMousebutton) & 1)) + return; + + byte prevType = data.byte(kObjecttype); + byte prevFrame = data.byte(kItemframe); + uint16 objectId = getSegment(data.word(kBuffers)).word(findInvPosCPP()); + data.byte(kItemframe) = objectId & 0x00FF; + data.byte(kObjecttype) = objectId >> 8; + DynObject *object = getEitherAdCPP(); + object->mapad[0] = 20; + object->mapad[1] = 255; + byte prevType2 = data.byte(kObjecttype); + byte prevFrame2 = data.byte(kItemframe); + data.byte(kObjecttype) = prevType; + data.byte(kItemframe) = prevFrame; + //findInvPosCPP(); // found in the original source, but it seems to be useless + delPointer(); + object = getEitherAdCPP(); + object->mapad[0] = 4; + object->mapad[1] = 255; + object->mapad[2] = data.byte(kLastinvpos); + data.byte(kObjecttype) = prevType2; + data.byte(kItemframe) = prevFrame2; + fillRyan(); + readMouse(); + showPointer(); + workToScreenCPP(); + delPointer(); +} + void DreamGenContext::useOpened() { if (data.byte(kOpenedob) == 255) return; // cannot use opened object @@ -902,11 +945,11 @@ void DreamGenContext::useOpened() { delPointer(); } -void DreamGenContext::swapWithInv() { +void DreamGenContext::swapWithOpen() { uint16 subject = (data.byte(kObjecttype) << 8) | data.byte(kItemframe); if (subject == data.word(kOldsubject)) { - if (data.byte(kCommandtype) != 243) { - data.byte(kCommandtype) = 243; + if (data.byte(kCommandtype) != 242) { + data.byte(kCommandtype) = 242; data.word(kOldsubject) = subject; commandWithOb(34, data.byte(kObjecttype), data.byte(kItemframe)); } @@ -918,28 +961,56 @@ void DreamGenContext::swapWithInv() { if (data.word(kMousebutton) == data.word(kOldbutton) || !(data.word(kMousebutton) & 1)) return; + if (isItWorn(getEitherAdCPP())) { + wornError(); + return; + } + + delPointer(); + + if (data.byte(kItemframe) == data.byte(kOpenedob) && + data.byte(kObjecttype) == data.byte(kOpenedtype)) { + errorMessage1(); + return; + } + + if (!checkObjectSizeCPP()) + return; + byte prevType = data.byte(kObjecttype); byte prevFrame = data.byte(kItemframe); - uint16 objectId = getSegment(data.word(kBuffers)).word(findInvPosCPP()); - data.byte(kItemframe) = objectId & 0x00FF; - data.byte(kObjecttype) = objectId >> 8; + findOpenPos(); + ax = es.word(bx); + data.byte(kItemframe) = al; + data.byte(kObjecttype) = ah; + + if (data.byte(kObjecttype) != 4) { + transferToEx(); + data.byte(kItemframe) = al; + data.byte(kObjecttype) = 4; + } + DynObject *object = getEitherAdCPP(); object->mapad[0] = 20; object->mapad[1] = 255; + byte prevType2 = data.byte(kObjecttype); byte prevFrame2 = data.byte(kItemframe); data.byte(kObjecttype) = prevType; data.byte(kItemframe) = prevFrame; - //findInvPosCPP(); // found in the original source, but it seems to be useless - delPointer(); + findOpenPos(); object = getEitherAdCPP(); - object->mapad[0] = 4; - object->mapad[1] = 255; + object->mapad[0] = data.byte(kOpenedtype); + object->mapad[1] = data.byte(kOpenedob); object->mapad[2] = data.byte(kLastinvpos); + object->mapad[3] = data.byte(kReallocation); data.byte(kObjecttype) = prevType2; data.byte(kItemframe) = prevFrame2; + fillOpen(); fillRyan(); + underTextLine(); readMouse(); + useOpened(); showPointer(); workToScreenCPP(); delPointer(); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 2ac944b06a..0cdd68fa18 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -196,6 +196,7 @@ void reExFromInv(); void locationPic(); void useOpened(); + void swapWithOpen(); void swapWithInv(); #endif -- cgit v1.2.3 From 21a278bb630fc7bae6f152861900101a58836344 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 25 Dec 2011 18:26:13 +0200 Subject: DREAMWEB: Port 'outofopen' to C++ --- engines/dreamweb/dreamgen.cpp | 70 ----------------------------------------- engines/dreamweb/dreamgen.h | 1 - engines/dreamweb/object.cpp | 72 +++++++++++++++++++++++++++++++++++++++---- engines/dreamweb/stubs.h | 1 + 4 files changed, 67 insertions(+), 77 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index d68bd3b88f..6ecbba7995 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -365,76 +365,6 @@ findopenp1: _add(bx, (0+(228*13))); } -void DreamGenContext::outOfOpen() { - STACK_CHECK; - _cmp(data.byte(kOpenedob), 255); - if (flags.z()) - goto cantuseopen; - findOpenPos(); - ax = es.word(bx); - _cmp(al, 255); - if (!flags.z()) - goto canpick4; -cantuseopen: - blank(); - return; -canpick4: - _cmp(ax, data.word(kOldsubject)); - if (!flags.z()) - goto difsub4; - _cmp(data.byte(kCommandtype), 228); - if (flags.z()) - goto alreadygrb; - data.byte(kCommandtype) = 228; -difsub4: - data.word(kOldsubject) = ax; - bx = ax; - al = 36; - commandWithOb(); -alreadygrb: - ax = data.word(kMousebutton); - _cmp(ax, data.word(kOldbutton)); - if (flags.z()) - return /* (notletgo4) */; - _cmp(ax, 1); - if (flags.z()) - goto dogrb; - _cmp(ax, 2); - if (!flags.z()) - return /* (notletgo4) */; - reExFromOpen(); - return; -dogrb: - delPointer(); - data.byte(kPickup) = 1; - findOpenPos(); - ax = es.word(bx); - data.byte(kItemframe) = al; - data.byte(kObjecttype) = ah; - _cmp(ah, 4); - if (!flags.z()) - goto makeintoex; - getEitherAd(); - es.byte(bx+2) = 20; - es.byte(bx+3) = 255; - goto actuallyout; -makeintoex: - transferToEx(); - data.byte(kItemframe) = al; - data.byte(kObjecttype) = 4; - getEitherAd(); - es.byte(bx+2) = 20; - es.byte(bx+3) = 255; -actuallyout: - fillOpen(); - underTextLine(); - readMouse(); - useOpened(); - showPointer(); - workToScreen(); - delPointer(); -} - void DreamGenContext::transferToEx() { STACK_CHECK; emergencyPurge(); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index f585c6a7b4..7bb4793d05 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -454,7 +454,6 @@ public: void __start(); #include "stubs.h" // Allow hand-reversed functions to have a signature different than void f() - void outOfOpen(); void dirCom(); void findFirstPath(); void getAnyAd(); diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index 6546f19da4..64b3d276bb 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -887,9 +887,9 @@ void DreamGenContext::useOpened() { } findOpenPos(); - ax = es.word(bx); + uint16 subject = es.word(bx); - if (al != 255) { + if ((subject & 0x00FF) != 255) { swapWithOpen(); return; } @@ -899,7 +899,7 @@ void DreamGenContext::useOpened() { return; } - uint16 subject = (data.byte(kObjecttype) << 8) | data.byte(kItemframe); + subject = (data.byte(kObjecttype) << 8) | data.byte(kItemframe); if (subject == data.word(kOldsubject)) { if (data.byte(kCommandtype) != 227) { data.byte(kCommandtype) = 227; @@ -945,6 +945,66 @@ void DreamGenContext::useOpened() { delPointer(); } +void DreamGenContext::outOfOpen() { + if (data.byte(kOpenedob) == 255) + return; // cannot use opened object + + findOpenPos(); + uint16 subject = es.word(bx); + + if ((subject & 0x00FF) == 255) { + blank(); + return; + } + + if (subject == data.word(kOldsubject)) { + if (data.byte(kCommandtype) != 228) { + data.byte(kCommandtype) = 228; + data.word(kOldsubject) = subject; + commandWithOb(36, subject >> 8, subject & 0x00FF); + } + } else { + data.word(kOldsubject) = subject; + commandWithOb(36, subject >> 8, subject & 0x00FF); + } + + if (data.word(kMousebutton) == data.word(kOldbutton)) + return; // notletgo4 + + if (data.word(kMousebutton) != 1) { + if (data.word(kMousebutton) != 2) + return; // notletgo4 + + reExFromOpen(); + return; + } + + delPointer(); + data.byte(kPickup) = 1; + findOpenPos(); + subject = es.word(bx); + data.byte(kObjecttype) = subject >> 8; + data.byte(kItemframe) = subject & 0xFF; + + if (data.byte(kObjecttype) != 4) { + transferToEx(); + data.byte(kItemframe) = al; + data.byte(kObjecttype) = 4; + } + + DynObject *object = getEitherAdCPP(); + object->mapad[0] = 20; + object->mapad[1] = 255; + + fillOpen(); + underTextLine(); + readMouse(); + useOpened(); + showPointer(); + workToScreenCPP(); + delPointer(); +} + void DreamGenContext::swapWithOpen() { uint16 subject = (data.byte(kObjecttype) << 8) | data.byte(kItemframe); if (subject == data.word(kOldsubject)) { @@ -980,9 +1040,9 @@ void DreamGenContext::swapWithOpen() { byte prevType = data.byte(kObjecttype); byte prevFrame = data.byte(kItemframe); findOpenPos(); - ax = es.word(bx); - data.byte(kItemframe) = al; - data.byte(kObjecttype) = ah; + subject = es.word(bx); + data.byte(kObjecttype) = subject >> 8; + data.byte(kItemframe) = subject & 0xFF; if (data.byte(kObjecttype) != 4) { transferToEx(); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 0cdd68fa18..4cc0ee0027 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -196,6 +196,7 @@ void reExFromInv(); void locationPic(); void useOpened(); + void outOfOpen(); void swapWithOpen(); void swapWithInv(); -- cgit v1.2.3 From eaf87bdfa7ac279f736c03b25af94ac1df3b31ce Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 25 Dec 2011 18:42:13 +0200 Subject: DREAMWEB: Port 'emergencypurge' to C++ --- engines/dreamweb/dreamgen.cpp | 20 -------------------- engines/dreamweb/dreamgen.h | 1 - engines/dreamweb/stubs.cpp | 12 ++++++++++++ engines/dreamweb/stubs.h | 1 + 4 files changed, 13 insertions(+), 21 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 6ecbba7995..42c0f71d2e 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -475,26 +475,6 @@ void DreamGenContext::transferConToEx() { ds.byte(si+2) = 255; } -void DreamGenContext::emergencyPurge() { - STACK_CHECK; -checkpurgeagain: - ax = data.word(kExframepos); - _add(ax, 4000); - _cmp(ax, (30000)); - if (flags.c()) - goto notnearframeend; - purgeAnItem(); - goto checkpurgeagain; -notnearframeend: - ax = data.word(kExtextpos); - _add(ax, 400); - _cmp(ax, (18000)); - if (flags.c()) - return /* (notneartextend) */; - purgeAnItem(); - goto checkpurgeagain; -} - void DreamGenContext::purgeAnItem() { STACK_CHECK; es = data.word(kExtras); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 7bb4793d05..d86e0072ef 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -477,7 +477,6 @@ public: void getExAd(); void transferToEx(); void parser(); - void emergencyPurge(); void transferConToEx(); }; diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 3a0ca79a1d..4eea0b72b9 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -3701,4 +3701,16 @@ void DreamBase::incRyanPage() { } +void DreamGenContext::emergencyPurge() { + while (true) { + if (data.word(kExframepos) + 4000 < kExframeslen) { + // Not near frame end + if (data.word(kExtextpos) + 400 < kExtextlen) + return; // notneartextend + } + + purgeAnItem(); + } +} + } // End of namespace DreamGen diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 4cc0ee0027..5bb07adbfa 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -199,5 +199,6 @@ void outOfOpen(); void swapWithOpen(); void swapWithInv(); + void emergencyPurge(); #endif -- cgit v1.2.3 From 95ffd7f4ce2e0274b8adf87f03bc705b1d3a1ebd Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 25 Dec 2011 19:25:00 +0200 Subject: DREAMWEB: Port 'purgeanitem' to C++, some cleanup --- engines/dreamweb/dreambase.h | 2 ++ engines/dreamweb/dreamgen.cpp | 50 ------------------------------------------- engines/dreamweb/dreamgen.h | 1 - engines/dreamweb/object.cpp | 5 ----- engines/dreamweb/stubs.cpp | 21 +++++++++++++++++- engines/dreamweb/stubs.h | 5 ----- 6 files changed, 22 insertions(+), 62 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 9e45e046f4..c14bfda7a1 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -541,6 +541,8 @@ public: void cantDrop(); void entryAnims(); bool finishedWalking(); + void emergencyPurge(); + void purgeAnItem(); // from talk.cpp void talk(); diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 42c0f71d2e..3ab3a66f55 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -475,56 +475,6 @@ void DreamGenContext::transferConToEx() { ds.byte(si+2) = 255; } -void DreamGenContext::purgeAnItem() { - STACK_CHECK; - es = data.word(kExtras); - di = (0+2080+30000); - bl = data.byte(kReallocation); - cx = 0; -lookforpurge: - al = es.byte(di+2); - _cmp(al, 0); - if (!flags.z()) - goto cantpurge; - _cmp(es.byte(di+12), 2); - if (flags.z()) - goto iscup; - _cmp(es.byte(di+12), 255); - if (!flags.z()) - goto cantpurge; -iscup: - _cmp(es.byte(di+11), bl); - if (flags.z()) - goto cantpurge; - deleteExObject(); - return; -cantpurge: - _add(di, 16); - _inc(cx); - _cmp(cx, (114)); - if (!flags.z()) - goto lookforpurge; - di = (0+2080+30000); - bl = data.byte(kReallocation); - cx = 0; -lookforpurge2: - al = es.byte(di+2); - _cmp(al, 0); - if (!flags.z()) - goto cantpurge2; - _cmp(es.byte(di+12), 255); - if (!flags.z()) - goto cantpurge2; - deleteExObject(); - return; -cantpurge2: - _add(di, 16); - _inc(cx); - _cmp(cx, (114)); - if (!flags.z()) - goto lookforpurge2; -} - void DreamGenContext::getDestInfo() { STACK_CHECK; al = data.byte(kDestpos); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index d86e0072ef..cd65c723a7 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -461,7 +461,6 @@ public: void dirFile(); void pickupConts(); void transferMap(); - void purgeAnItem(); void getSetAd(); void findOpenPos(); void rollEm(); diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index 64b3d276bb..f3e27d9a5b 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -517,11 +517,6 @@ void DreamBase::deleteExText(uint8 textNum) { } } -// This takes es:di and cl as input, but es:di always points to getExAd(cl) -void DreamGenContext::deleteExObject() { - deleteExObject(cl); -} - void DreamBase::deleteExObject(uint8 index) { DynObject *obj = getExAd(index); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 4eea0b72b9..3425ad400f 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -3701,7 +3701,7 @@ void DreamBase::incRyanPage() { } -void DreamGenContext::emergencyPurge() { +void DreamBase::emergencyPurge() { while (true) { if (data.word(kExframepos) + 4000 < kExframeslen) { // Not near frame end @@ -3713,4 +3713,23 @@ void DreamGenContext::emergencyPurge() { } } +void DreamBase::purgeAnItem() { + const DynObject *extraObjects = (const DynObject *)getSegment(data.word(kExtras)).ptr(kExdata, 0); + + for (size_t i = 0; i < kNumexobjects; ++i) { + if (extraObjects[i].mapad[0] && extraObjects[i].id[0] == 255 && + extraObjects[i].initialLocation != data.byte(kReallocation)) { + deleteExObject(i); + return; + } + } + + for (size_t i = 0; i < kNumexobjects; ++i) { + if (extraObjects[i].mapad[0] && extraObjects[i].id[0] == 255) { + deleteExObject(i); + return; + } + } +} + } // End of namespace DreamGen diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 5bb07adbfa..98149f2b70 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -183,10 +183,6 @@ uint16 findInvPosCPP(); void setPickup(); void getKeyAndLogo(); - void deleteExObject(); - void deleteExObject(uint8 index) { - DreamBase::deleteExObject(index); - } void signOn(); void lookAtPlace(); void inToInv(); @@ -199,6 +195,5 @@ void outOfOpen(); void swapWithOpen(); void swapWithInv(); - void emergencyPurge(); #endif -- cgit v1.2.3 From 6dbc930b18c43c12138d68c34a12bc015e28354d Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 25 Dec 2011 19:48:49 +0200 Subject: DREAMWEB: Remove getDestInfo() from locationPic This allows to move some more functions into DreamBase --- engines/dreamweb/dreambase.h | 4 ++++ engines/dreamweb/newplace.cpp | 36 ++++++++++++++++-------------------- engines/dreamweb/stubs.h | 4 ---- engines/dreamweb/use.cpp | 5 ++--- 4 files changed, 22 insertions(+), 27 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index c14bfda7a1..e023d975a4 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -181,6 +181,9 @@ public: void readCityPic(); void readDestIcon(); void showCity(); + void locationPic(); + void selectLocation(); + void newPlace(); // from object.cpp void obIcons(); @@ -569,6 +572,7 @@ public: void edensCDPlayer(); void hotelBell(); void playGuitar(); + void useElevator1(); void useElevator2(); void useElevator3(); void useElevator4(); diff --git a/engines/dreamweb/newplace.cpp b/engines/dreamweb/newplace.cpp index 027d7c1937..b2456ad2e1 100644 --- a/engines/dreamweb/newplace.cpp +++ b/engines/dreamweb/newplace.cpp @@ -24,7 +24,7 @@ namespace DreamGen { -void DreamGenContext::newPlace() { +void DreamBase::newPlace() { if (data.byte(kNeedtotravel) == 1) { data.byte(kNeedtotravel) = 0; selectLocation(); @@ -34,8 +34,7 @@ void DreamGenContext::newPlace() { } } -// TODO: Move to DreamBase once getDestInfo is moved -void DreamGenContext::selectLocation() { +void DreamBase::selectLocation() { data.byte(kInmaparea) = 0; clearBeforeLoad(); data.byte(kGetback) = 0; @@ -142,7 +141,20 @@ void DreamBase::putUnderCentre() { multiPut(mapStore(), 58, 72, 254, 110); } -// TODO: put Locationpic here +void DreamBase::locationPic() { + byte destFlag = data.byte(553 + data.byte(kDestpos)); + if (destFlag >= 6) + showFrame(tempGraphics2(), 104, 138 + 14, destFlag - 6, 0); // Second slot + else + showFrame(tempGraphics(), 104, 138 + 14, destFlag + 4, 0); + + if (data.byte(kDestpos) == data.byte(kReallocation)) + showFrame(tempGraphics(), 104, 140 + 14, 3, 0); // Currently in this location + + uint16 offset = kTextstart + getSegment(data.word(kTraveltext)).word(data.byte(kDestpos) * 2); + const uint8 *string = getSegment(data.word(kTraveltext)).ptr(offset, 0); + DreamBase::printDirect(string, 50, 20, 241, 241 & 1); +} // TODO: put Getdestinfo here @@ -270,20 +282,4 @@ void DreamBase::readCityPic() { loadIntoTemp("DREAMWEB.G04"); } -void DreamGenContext::locationPic() { - getDestInfo(); - byte destFlag = es.byte(si); - if (destFlag >= 6) - showFrame(tempGraphics2(), 104, 138 + 14, destFlag - 6, 0); // Second slot - else - showFrame(tempGraphics(), 104, 138 + 14, destFlag + 4, 0); - - if (data.byte(kDestpos) == data.byte(kReallocation)) - showFrame(tempGraphics(), 104, 140 + 14, 3, 0); // Currently in this location - - uint16 offset = kTextstart + getSegment(data.word(kTraveltext)).word(data.byte(kDestpos) * 2); - const uint8 *string = getSegment(data.word(kTraveltext)).ptr(offset, 0); - DreamBase::printDirect(string, 50, 20, 241, 241 & 1); -} - } // End of namespace DreamGen diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 98149f2b70..e447b705fb 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -123,7 +123,6 @@ void autoLook(); void doLook(); void enterSymbol(); - void useElevator1(); void useKey(); void useObject(); void singleKey(uint8 key, uint16 x, uint16 y); @@ -162,7 +161,6 @@ void decide(); void showGun(); void endGame(); - void newPlace(); void monkSpeaking(); void rollEndCredits2(); void triggerMessage(uint16 index); @@ -188,9 +186,7 @@ void inToInv(); void outOfInv(); void selectOpenOb(); - void selectLocation(); void reExFromInv(); - void locationPic(); void useOpened(); void outOfOpen(); void swapWithOpen(); diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp index 41b338e885..78dffc99ad 100644 --- a/engines/dreamweb/use.cpp +++ b/engines/dreamweb/use.cpp @@ -39,7 +39,7 @@ void DreamGenContext::useRoutine() { static const UseListEntry kUseList[] = { { &DreamGenContext::useMon, "NETW" }, - { &DreamGenContext::useElevator1, "ELVA" }, + { &DreamBase::useElevator1, "ELVA" }, { &DreamBase::useElevator2, "ELVB" }, { &DreamBase::useElevator3, "ELVC" }, { &DreamBase::useElevator4, "ELVE" }, @@ -242,8 +242,7 @@ void DreamBase::playGuitar() { putBackObStuff(); } -// TODO: Move to DreamBase once selectLocation (in reality, getDestInfo) is moved -void DreamGenContext::useElevator1() { +void DreamBase::useElevator1() { showFirstUse(); selectLocation(); data.byte(kGetback) = 1; -- cgit v1.2.3 From e27a5931c811681590ced5df290e0c16f52aecc4 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 25 Dec 2011 21:00:30 +0200 Subject: DREAMWEB: Remove getdestinfo() and access the roomPics array directly in locationPic() --- engines/dreamweb/dreamgen.cpp | 31 +++++-------------------------- engines/dreamweb/dreamgen.h | 14 ++++++-------- engines/dreamweb/newplace.cpp | 21 ++++++++------------- 3 files changed, 19 insertions(+), 47 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 3ab3a66f55..f71ced9057 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -475,25 +475,6 @@ void DreamGenContext::transferConToEx() { ds.byte(si+2) = 255; } -void DreamGenContext::getDestInfo() { - STACK_CHECK; - al = data.byte(kDestpos); - ah = 0; - push(ax); - dx = data; - es = dx; - si = 537; - _add(si, ax); - cl = es.byte(si); - ax = pop(); - push(cx); - dx = data; - es = dx; - si = 553; - _add(si, ax); - ax = pop(); -} - void DreamGenContext::dirCom() { STACK_CHECK; cx = 30; @@ -767,7 +748,7 @@ void DreamGenContext::parser() { al = '='; _stosb(); ds = cs; - si = 571; + si = 556; notspace1: _lodsw(); _cmp(al, 32); @@ -952,9 +933,9 @@ void DreamGenContext::__start() { //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, 0x05, 0x00, 0x03, 0x02, 0x04, 0x01, 0x0a, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0220: .... .... .... .... - 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, 0x00, 0x00, //0x0230: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0240: .... .... .... .... @@ -968,11 +949,9 @@ void DreamGenContext::__start() { //0x0280: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0290: .... .... .... .... - 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, 0xff, //0x02a0: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, - //0x02b0: .... .... .... .... - 0xff, 0x00, 0x00, 0x00, }; + 0xff, 0xff, 0x00, 0x00, 0x00, }; ds.assign(src, src + sizeof(src)); dreamweb(); } diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index cd65c723a7..7247bedf74 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -346,13 +346,12 @@ 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 kOplist = 553; +static const uint16 kInputline = 556; +static const uint16 kPresslist = 684; +static const uint16 kQuitrequested = 690; +static const uint16 kSubtitles = 691; +static const uint16 kForeignrelease = 692; static const uint16 kBlocktextdat = (0); static const uint16 kPersonframes = (0); static const uint16 kDebuglevel1 = (0); @@ -469,7 +468,6 @@ public: void getEitherAd(); void dreamweb(); void findPathOfPoint(); - void getDestInfo(); void read(); void searchForString(); void searchForFiles(); diff --git a/engines/dreamweb/newplace.cpp b/engines/dreamweb/newplace.cpp index b2456ad2e1..e311f44ccc 100644 --- a/engines/dreamweb/newplace.cpp +++ b/engines/dreamweb/newplace.cpp @@ -142,11 +142,13 @@ void DreamBase::putUnderCentre() { } void DreamBase::locationPic() { - byte destFlag = data.byte(553 + data.byte(kDestpos)); - if (destFlag >= 6) - showFrame(tempGraphics2(), 104, 138 + 14, destFlag - 6, 0); // Second slot + const int roomPics[] = { 5, 0, 3, 2, 4, 1, 10, 9, 8, 6, 11, 4, 7, 7, 0 }; + byte picture = roomPics[data.byte(kDestpos)]; + + if (picture >= 6) + showFrame(tempGraphics2(), 104, 138 + 14, picture - 6, 0); // Second slot else - showFrame(tempGraphics(), 104, 138 + 14, destFlag + 4, 0); + showFrame(tempGraphics(), 104, 138 + 14, picture + 4, 0); if (data.byte(kDestpos) == data.byte(kReallocation)) showFrame(tempGraphics(), 104, 140 + 14, 3, 0); // Currently in this location @@ -156,8 +158,6 @@ void DreamBase::locationPic() { DreamBase::printDirect(string, 50, 20, 241, 241 & 1); } -// TODO: put Getdestinfo here - void DreamBase::showArrows() { showFrame(tempGraphics(), 116 - 12, 16, 0, 0); showFrame(tempGraphics(), 226 + 12, 16, 1, 0); @@ -177,9 +177,7 @@ void DreamGenContext::nextDest() { data.byte(kDestpos)++; if (data.byte(kDestpos) == 15) data.byte(kDestpos) = 0; // last destination - - getDestInfo(); - } while (al == 0); + } while (!data.byte(kRoomscango + data.byte(kDestpos))); data.byte(kNewtextline) = 1; delTextLine(); @@ -208,9 +206,7 @@ void DreamGenContext::lastDest() { data.byte(kDestpos)--; if (data.byte(kDestpos) == 0xFF) data.byte(kDestpos) = 15; // first destination - - getDestInfo(); - } while (al == 0); + } while (!data.byte(kRoomscango + data.byte(kDestpos))); data.byte(kNewtextline) = 1; delTextLine(); @@ -235,7 +231,6 @@ void DreamGenContext::destSelect() { if (!(data.word(kMousebutton) & 1) || data.word(kOldbutton) == 1) return; // notrav - getDestInfo(); data.byte(kNewlocation) = data.byte(kDestpos); } -- cgit v1.2.3 From 95c9a6d8cd93b7cbe921e391f207450f6082d99a Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 25 Dec 2011 21:10:20 +0200 Subject: DREAMWEB: Move all of the functions in newplace.cpp into DreamBase --- engines/dreamweb/dreambase.h | 4 ++++ engines/dreamweb/newplace.cpp | 18 +++++++++--------- engines/dreamweb/stubs.h | 4 ---- 3 files changed, 13 insertions(+), 13 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index e023d975a4..41409bc323 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -184,6 +184,10 @@ public: void locationPic(); void selectLocation(); void newPlace(); + void nextDest(); + void lastDest(); + void destSelect(); + void lookAtPlace(); // from object.cpp void obIcons(); diff --git a/engines/dreamweb/newplace.cpp b/engines/dreamweb/newplace.cpp index e311f44ccc..4942804369 100644 --- a/engines/dreamweb/newplace.cpp +++ b/engines/dreamweb/newplace.cpp @@ -72,11 +72,11 @@ void DreamBase::selectLocation() { if (data.byte(kGetback) == 1) break; - RectWithCallback destList[] = { - { 238,258,4,44,&DreamGenContext::nextDest }, - { 104,124,4,44,&DreamGenContext::lastDest }, - { 280,308,4,44,&DreamGenContext::lookAtPlace }, - { 104,216,138,192,&DreamGenContext::destSelect }, + RectWithCallback destList[] = { + { 238,258,4,44,&DreamBase::nextDest }, + { 104,124,4,44,&DreamBase::lastDest }, + { 280,308,4,44,&DreamBase::lookAtPlace }, + { 104,216,138,192,&DreamBase::destSelect }, { 273,320,157,198,&DreamBase::getBack1 }, { 0,320,0,200,&DreamBase::blank }, { 0xFFFF,0,0,0,0 } @@ -101,7 +101,7 @@ void DreamBase::showCity() { showFrame(tempGraphics(), 120+57, 32, 1, 0); } -void DreamGenContext::lookAtPlace() { +void DreamBase::lookAtPlace() { if (data.byte(kCommandtype) != 224) { data.byte(kCommandtype) = 224; commandOnly(27); @@ -164,7 +164,7 @@ void DreamBase::showArrows() { showFrame(tempGraphics(), 280, 14, 2, 0); } -void DreamGenContext::nextDest() { +void DreamBase::nextDest() { if (data.byte(kCommandtype) != 218) { data.byte(kCommandtype) = 218; commandOnly(28); @@ -193,7 +193,7 @@ void DreamGenContext::nextDest() { delPointer(); } -void DreamGenContext::lastDest() { +void DreamBase::lastDest() { if (data.byte(kCommandtype) != 219) { data.byte(kCommandtype) = 219; commandOnly(29); @@ -222,7 +222,7 @@ void DreamGenContext::lastDest() { delPointer(); } -void DreamGenContext::destSelect() { +void DreamBase::destSelect() { if (data.byte(kCommandtype) != 222) { data.byte(kCommandtype) = 222; commandOnly(30); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index e447b705fb..148436e8a8 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -148,9 +148,6 @@ void errorMessage1(); void errorMessage2(); void errorMessage3(); - void nextDest(); - void lastDest(); - void destSelect(); void loadSpeech(); bool loadSpeech(byte type1, int idx1, byte type2, int idx2) { return DreamBase::loadSpeech(type1, idx1, type2, idx2); @@ -182,7 +179,6 @@ void setPickup(); void getKeyAndLogo(); void signOn(); - void lookAtPlace(); void inToInv(); void outOfInv(); void selectOpenOb(); -- cgit v1.2.3 From bdded1ce12212e092452a7b4943e99cad4c16a14 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 25 Dec 2011 22:11:27 +0200 Subject: DREAMWEB: The ASM-style version of getEitherAd() is no longer needed --- engines/dreamweb/dreamgen.cpp | 13 ------------- engines/dreamweb/dreamgen.h | 1 - 2 files changed, 14 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index f71ced9057..0dffe56c2a 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -303,19 +303,6 @@ void DreamGenContext::getExAd() { _add(bx, (0+2080+30000)); } -void DreamGenContext::getEitherAd() { - STACK_CHECK; - _cmp(data.byte(kObjecttype), 4); - if (flags.z()) - goto isinexlist; - al = data.byte(kItemframe); - getFreeAd(); - return; -isinexlist: - al = data.byte(kItemframe); - getExAd(); -} - void DreamGenContext::getAnyAd() { STACK_CHECK; _cmp(data.byte(kObjecttype), 4); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 7247bedf74..0f6bfc0a48 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -465,7 +465,6 @@ public: void rollEm(); void findAllOpen(); void fillOpen(); - void getEitherAd(); void dreamweb(); void findPathOfPoint(); void read(); -- cgit v1.2.3 From 1f346baa92064388de2958110d93006ac96a5479 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 25 Dec 2011 22:31:07 +0200 Subject: DREAMWEB: Port 'findopenpos' to C++ --- engines/dreamweb/dreambase.h | 1 + engines/dreamweb/dreamgen.cpp | 17 --------------- engines/dreamweb/dreamgen.h | 1 - engines/dreamweb/object.cpp | 51 +++++++++++++++++++++++-------------------- 4 files changed, 28 insertions(+), 42 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 41409bc323..0dc4e52d86 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -204,6 +204,7 @@ public: void wornError(); void makeWorn(DynObject *object); void dropObject(); + uint16 findOpenPos(); // from pathfind.cpp void turnPathOn(uint8 param); diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 0dffe56c2a..32bb520b18 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -335,23 +335,6 @@ void DreamGenContext::getSetAd() { es = data.word(kSetdat); } -void DreamGenContext::findOpenPos() { - STACK_CHECK; - cx = data.word(kMousex); - _sub(cx, (80)); - bx = -1; -findopenp1: - _inc(bx); - _sub(cx, (44)); - if (!flags.c()) - goto findopenp1; - al = bl; - data.byte(kLastinvpos) = al; - _add(bx, bx); - es = data.word(kBuffers); - _add(bx, (0+(228*13))); -} - void DreamGenContext::transferToEx() { STACK_CHECK; emergencyPurge(); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 0f6bfc0a48..45589cab07 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -461,7 +461,6 @@ public: void pickupConts(); void transferMap(); void getSetAd(); - void findOpenPos(); void rollEm(); void findAllOpen(); void fillOpen(); diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index f3e27d9a5b..c202ac765c 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -881,10 +881,9 @@ void DreamGenContext::useOpened() { return; } - findOpenPos(); - uint16 subject = es.word(bx); + uint16 objectId = getSegment(data.word(kBuffers)).word(findOpenPos()); - if ((subject & 0x00FF) != 255) { + if ((objectId & 0x00FF) != 255) { swapWithOpen(); return; } @@ -894,15 +893,15 @@ void DreamGenContext::useOpened() { return; } - subject = (data.byte(kObjecttype) << 8) | data.byte(kItemframe); - if (subject == data.word(kOldsubject)) { + objectId = (data.byte(kObjecttype) << 8) | data.byte(kItemframe); + if (objectId == data.word(kOldsubject)) { if (data.byte(kCommandtype) != 227) { data.byte(kCommandtype) = 227; - data.word(kOldsubject) = subject; + data.word(kOldsubject) = objectId; commandWithOb(35, data.byte(kObjecttype), data.byte(kItemframe)); } } else { - data.word(kOldsubject) = subject; + data.word(kOldsubject) = objectId; commandWithOb(35, data.byte(kObjecttype), data.byte(kItemframe)); } @@ -944,23 +943,22 @@ void DreamGenContext::outOfOpen() { if (data.byte(kOpenedob) == 255) return; // cannot use opened object - findOpenPos(); - uint16 subject = es.word(bx); + uint16 objectId = getSegment(data.word(kBuffers)).word(findOpenPos()); - if ((subject & 0x00FF) == 255) { + if ((objectId & 0x00FF) == 255) { blank(); return; } - if (subject == data.word(kOldsubject)) { + if (objectId == data.word(kOldsubject)) { if (data.byte(kCommandtype) != 228) { data.byte(kCommandtype) = 228; - data.word(kOldsubject) = subject; - commandWithOb(36, subject >> 8, subject & 0x00FF); + data.word(kOldsubject) = objectId; + commandWithOb(36, objectId >> 8, objectId & 0x00FF); } } else { - data.word(kOldsubject) = subject; - commandWithOb(36, subject >> 8, subject & 0x00FF); + data.word(kOldsubject) = objectId; + commandWithOb(36, objectId >> 8, objectId & 0x00FF); } if (data.word(kMousebutton) == data.word(kOldbutton)) @@ -976,10 +974,9 @@ void DreamGenContext::outOfOpen() { delPointer(); data.byte(kPickup) = 1; - findOpenPos(); - subject = es.word(bx); - data.byte(kObjecttype) = subject >> 8; - data.byte(kItemframe) = subject & 0xFF; + objectId = getSegment(data.word(kBuffers)).word(findOpenPos()); + data.byte(kObjecttype) = objectId >> 8; + data.byte(kItemframe) = objectId & 0xFF; if (data.byte(kObjecttype) != 4) { transferToEx(); @@ -1034,10 +1031,9 @@ void DreamGenContext::swapWithOpen() { byte prevType = data.byte(kObjecttype); byte prevFrame = data.byte(kItemframe); - findOpenPos(); - subject = es.word(bx); - data.byte(kObjecttype) = subject >> 8; - data.byte(kItemframe) = subject & 0xFF; + uint16 objectId = getSegment(data.word(kBuffers)).word(findOpenPos()); + data.byte(kObjecttype) = objectId >> 8; + data.byte(kItemframe) = objectId & 0xFF; if (data.byte(kObjecttype) != 4) { transferToEx(); @@ -1053,7 +1049,7 @@ void DreamGenContext::swapWithOpen() { byte prevFrame2 = data.byte(kItemframe); data.byte(kObjecttype) = prevType; data.byte(kItemframe) = prevFrame; - findOpenPos(); + //findOpenPos(); // was in the original source, looks to be unused object = getEitherAdCPP(); object->mapad[0] = data.byte(kOpenedtype); object->mapad[1] = data.byte(kOpenedob); @@ -1071,4 +1067,11 @@ void DreamGenContext::swapWithOpen() { delPointer(); } +uint16 DreamBase::findOpenPos() { + uint16 pos = (data.word(kMousex) - kInventx) / kItempicsize; + data.byte(kLastinvpos) = pos & 0xFF; + + return pos * 2 + kOpeninvlist; // return the object position in the inventory data +} + } // End of namespace DreamGen -- cgit v1.2.3 From c7b1ec21980d622c138fa2dcac5a03f80aa415e1 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Sun, 25 Dec 2011 23:33:11 +0000 Subject: DREAMWEB: Ported 'findfirstpath' to C++. This conversion could do with a bit more work to remove the es/ax/cx temp usage and clean up the code. --- engines/dreamweb/dreamgen.cpp | 43 ------------------------------------------- engines/dreamweb/dreamgen.h | 1 - engines/dreamweb/object.cpp | 29 +++++++++++++++++++++++++++-- engines/dreamweb/stubs.h | 1 + 4 files changed, 28 insertions(+), 46 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 32bb520b18..e92291178c 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -790,49 +790,6 @@ flunkedit: dl = 255; } -void DreamGenContext::findFirstPath() { - STACK_CHECK; - push(ax); - bx = (0); - es = data.word(kReels); - al = data.byte(kRoomnum); - ah = 0; - cx = 144; - _mul(cx); - _add(bx, ax); - cx = pop(); - dl = 0; -fpathloop: - ax = es.word(bx+2); - _cmp(ax, 0x0ffff); - if (flags.z()) - goto nofirst; - _cmp(cl, al); - if (flags.c()) - goto nofirst; - _cmp(ch, ah); - if (flags.c()) - goto nofirst; - ax = es.word(bx+4); - _cmp(cl, al); - if (!flags.c()) - goto nofirst; - _cmp(ch, ah); - if (!flags.c()) - goto nofirst; - goto gotfirst; -nofirst: - _add(bx, 8); - _inc(dl); - _cmp(dl, 12); - if (!flags.z()) - goto fpathloop; - al = 0; - return; -gotfirst: - al = es.byte(bx+6); -} - void DreamGenContext::__start() { static const uint8 src[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x13, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 45589cab07..4d6946e8ab 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -454,7 +454,6 @@ public: #include "stubs.h" // Allow hand-reversed functions to have a signature different than void f() void dirCom(); - void findFirstPath(); void getAnyAd(); void getFreeAd(); void dirFile(); diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index c202ac765c..84829bf440 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -341,6 +341,32 @@ void DreamGenContext::openOb() { _openChangeSize = getOpenedSlotCount() * kItempicsize + kInventx; } +uint8 DreamGenContext::findFirstPath(uint16 param) { + es = data.word(kReels); + uint16 ptr = 144 * data.byte(kRoomnum); + // TODO: Replace ax, cx usage with temporary uint8/16 variables... + cx = param; + + for (uint8 pathLoop = 0; pathLoop < 12; pathLoop++, ptr += 8) { + ax = es.word(ptr+2); + + if (ax == 0x0ffff) + continue; // "nofirst" + + if (cl < al || ch < ah) + continue; // "nofirst" + + ax = es.word(ptr+4); + + if (cl > al || ch > ah) + continue; // "nofirst" + + return es.byte(ptr+6); // "gotfirst" + } + + return 0; +} + void DreamGenContext::identifyOb() { if (data.word(kWatchingtime) != 0) { blank(); @@ -362,8 +388,7 @@ void DreamGenContext::identifyOb() { data.byte(kPointerspath) = dl; ax = pop(); push(ax); - findFirstPath(); - data.byte(kPointerfirstpath) = al; + data.byte(kPointerfirstpath) = findFirstPath(ax); ax = pop(); byte x = al; diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 148436e8a8..62259a16a5 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -172,6 +172,7 @@ void checkObjectSize(); bool checkObjectSizeCPP(); void openOb(); + uint8 findFirstPath(uint16 param); void identifyOb(); void selectOb(); void findInvPos(); -- cgit v1.2.3 From 9ba55105fccf0489659d91cee38a899f13628168 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 25 Dec 2011 23:41:03 +0100 Subject: TSAGE: R2R - Implement scene 3400 --- engines/tsage/globals.cpp | 3 + engines/tsage/globals.h | 1 + engines/tsage/ringworld2/ringworld2_logic.cpp | 2 + engines/tsage/ringworld2/ringworld2_scenes3.cpp | 247 ++++++++++++++++++ engines/tsage/ringworld2/ringworld2_scenes3.h | 24 ++ engines/tsage/ringworld2/ringworld2_speakers.cpp | 313 +++++++++++++++++++++++ engines/tsage/ringworld2/ringworld2_speakers.h | 40 +++ 7 files changed, 630 insertions(+) (limited to 'engines') diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp index 740d9b91fd..d30d585c09 100644 --- a/engines/tsage/globals.cpp +++ b/engines/tsage/globals.cpp @@ -381,6 +381,7 @@ void Ringworld2Globals::reset() { T2_GLOBALS._uiElements._active = false; // Reset fields + _v558B6.set(0, 0, 0, 0); _v5657C = 0; _v565F5 = 0; _v565AE = 0; @@ -419,6 +420,8 @@ void Ringworld2Globals::synchronize(Serializer &s) { TsAGE2Globals::synchronize(s); int i; + _v558B6.synchronize(s); + s.syncAsSint16LE(_v5657C); s.syncAsSint16LE(_v565F5); s.syncAsSint16LE(_v56AAB); diff --git a/engines/tsage/globals.h b/engines/tsage/globals.h index fb892c6cf7..498659d3ae 100644 --- a/engines/tsage/globals.h +++ b/engines/tsage/globals.h @@ -248,6 +248,7 @@ public: PlayStream _playStream; StripProxy _stripProxy; int _insetUp; + Rect _v558B6; int _v565F5; int _v5657C; byte _v565AE; diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index 30e794627f..4462122a4d 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -219,7 +219,9 @@ Scene *Ringworld2Game::createScene(int sceneNumber) { case 3375: case 3385: case 3395: + error("Missing scene %d from group 3", sceneNumber); case 3400: + return new Scene3400(); case 3500: case 3600: case 3700: diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp index ce08e9647e..e3d2869634 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp @@ -1698,5 +1698,252 @@ void Scene3350::signal() { } } +/*-------------------------------------------------------------------------- + * Scene 3400 - + * + *--------------------------------------------------------------------------*/ +Scene3400::Scene3400() { + _field157C = 0; +} + +void Scene3400::synchronize(Serializer &s) { + SceneExt::synchronize(s); + + s.syncAsSint16LE(_field157C); +} + +void Scene3400::postInit(SceneObjectList *OwnerList) { + R2_GLOBALS._scrollFollower = &R2_GLOBALS._player; + g_globals->gfxManager()._bounds.moveTo(Common::Point(160, 0)); + loadScene(3400); + _field157C = 0; + R2_GLOBALS._v558B6.set(60, 0, 260, 200); + SceneExt::postInit(); + R2_GLOBALS._sound1.play(317); + + _stripManager.setColors(60, 255); + _stripManager.setFontNumber(3); + _stripManager.addSpeaker(&_quinnSpeaker); + _stripManager.addSpeaker(&_seekerSpeaker); + _stripManager.addSpeaker(&_mirandaSpeaker); + _stripManager.addSpeaker(&_webbsterSpeaker); + _stripManager.addSpeaker(&_tealSpeaker); + + setZoomPercents(51, 46, 180, 200); + R2_GLOBALS._player._characterScene[1] = 3400; + R2_GLOBALS._player._characterScene[2] = 3400; + R2_GLOBALS._player._characterScene[3] = 3400; + + _actor7.postInit(); + _actor7.setup(3403, 1, 1); + _actor7.setPosition(Common::Point(190, 103)); + _actor7.fixPriority(89); + + R2_GLOBALS._player.postInit(); + if (R2_GLOBALS._player._characterIndex == 2) + R2_GLOBALS._player._moveDiff = Common::Point(5, 3); + else + R2_GLOBALS._player._moveDiff = Common::Point(3, 2); + R2_GLOBALS._player.changeZoom(-1); + R2_GLOBALS._player.setPosition(Common::Point(239, 64)); + + if (R2_GLOBALS._player._characterIndex == 2) + R2_GLOBALS._player.setup(20, 5, 1); + else if (R2_GLOBALS._player._characterIndex == 3) + R2_GLOBALS._player.setup(30, 5, 1); + else + R2_GLOBALS._player.setup(10, 5, 1); + + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player.disableControl(); + + _actor1.postInit(); + if (R2_GLOBALS._player._characterIndex == 2) { + _actor1._numFrames = 10; + _actor1._moveDiff = Common::Point(3, 2); + } else { + _actor1._numFrames = 7; + _actor1._moveDiff = Common::Point(5, 3); + } + _actor1.changeZoom(-1); + _actor1._effect = 1; + _actor1.setPosition(Common::Point(247, 63)); + if (R2_GLOBALS._player._characterIndex == 2) + _actor1.setup(10, 5, 1); + else + _actor1.setup(20, 5, 1); + _actor1.animate(ANIM_MODE_1, NULL); + + _actor2.postInit(); + _actor2._moveDiff = Common::Point(3, 2); + _actor2.changeZoom(-1); + _actor2._effect = 1; + _actor2.setPosition(Common::Point(225, 63)); + if (R2_GLOBALS._player._characterIndex == 3) + _actor2.setup(10, 5, 1); + else + _actor2.setup(30, 5, 1); + _actor2.animate(ANIM_MODE_1, NULL); + + _actor3.postInit(); + _actor3._numFrames = 7; + _actor3._moveDiff = Common::Point(5, 3); + _actor3.changeZoom(-1); + _actor3._effect = 1; + _actor3.setPosition(Common::Point(235, 61)); + _actor3.setup(40, 3, 1); + _actor3.animate(ANIM_MODE_1, NULL); + + _actor6.postInit(); + _actor6.setup(3400, 1, 6); + _actor6.setPosition(Common::Point(236, 51)); + _actor6.fixPriority(51); + _actor6.animate(ANIM_MODE_6, NULL); + + R2_GLOBALS.clearFlag(71); + _sceneMode = 3400; + setAction(&_sequenceManager, this, 3400, &R2_GLOBALS._player, &_actor1, &_actor2, &_actor3, NULL); +} + +void Scene3400::remove() { + R2_GLOBALS._sound2.fadeOut2(NULL); + R2_GLOBALS._sound1.fadeOut2(NULL); + SceneExt::remove(); +} + +void Scene3400::signal() { + switch (_sceneMode) { + case 3305: { + warning("STUB: sub_1D227()"); + _tealSpeaker._object1.hide(); + _actor4.show(); + _actor4.setStrip(1); + Common::Point pt(158, 190); + NpcMover *mover = new NpcMover(); + _actor4.addMover(mover, &pt, this); + _sceneMode = 3402; + setAction(&_sequenceManager, this, 3402, &R2_GLOBALS._player, &_actor1, &_actor2, &_actor3, NULL); + } + break; + case 3306: + R2_GLOBALS._sound2.play(318); + _actor1.setStrip(2); + R2_GLOBALS._player.setStrip(6); + _actor2.setStrip(6); + _actor3.setStrip(3); + _actor4.setStrip(1); + R2_INVENTORY.setObjectScene(34, 0); + _stripManager.start(3307, this); + if (R2_GLOBALS._player._characterIndex == 2) { + _sceneMode = 3400; + R2_GLOBALS._player.setAction(&_sequenceManager, this, 3400, &R2_GLOBALS._player, &_actor4, &_actor8, NULL); + } else { + _sceneMode = 3408; + _actor1.setAction(&_sequenceManager, this, 3408, &_actor1, &_actor4, &_actor8, NULL); + } + break; + case 3307: + case 3404: + case 3408: + if (_field157C == 0) { + R2_GLOBALS._sound2.fadeOut2(NULL); + _field157C = 1; + } else { + _sceneMode = 3308; + _stripManager.start(3308, this); + } + break; + case 3308: + warning("STUB: sub_1D227()"); + _actor1.setStrip(2); + R2_GLOBALS._player.setStrip(6); + _actor2.setStrip(6); + _actor3.setStrip(3); + _actor4.setStrip(1); + _sceneMode = 3403; + if (R2_GLOBALS._player._characterIndex == 2) + setAction(&_sequenceManager, this, 3403, R2_GLOBALS._player, &_actor3, &_actor7, NULL); + else + setAction(&_sequenceManager, this, 3403, &_actor1, &_actor3, &_actor7, NULL); + break; + case 3309: + warning("STUB: sub_1D227()"); + _actor4.setStrip(1); + _sceneMode = 3405; + if (R2_GLOBALS._player._characterIndex == 3) + setAction(&_sequenceManager, this, 3405, R2_GLOBALS._player, &_actor7, NULL); + else + setAction(&_sequenceManager, this, 3405, &_actor2, &_actor7, NULL); + break; + case 3310: + warning("STUB: sub_1D227()"); + _actor4.setStrip(1); + _sceneMode = 3406; + if (R2_GLOBALS._player._characterIndex == 1) + setAction(&_sequenceManager, this, 3406, &R2_GLOBALS._player, &_actor7, NULL); + else if (R2_GLOBALS._player._characterIndex == 2) + setAction(&_sequenceManager, this, 3406, &_actor1, &_actor7, NULL); + else if (R2_GLOBALS._player._characterIndex == 3) + setAction(&_sequenceManager, this, 3406, &_actor2, &_actor7, NULL); + break; + case 3311: + warning("STUB: sub_1D227()"); + _tealSpeaker._object1.hide(); + _actor4.show(); + _actor4.setStrip(1); + _sceneMode = 3407; + setAction(&_sequenceManager, this, 3407, &_actor4, &_actor7, NULL); + break; + case 3400: { + _actor8.postInit(); + _actor8.hide(); + _actor4.postInit(); + _actor4._numFrames = 7; + _actor4._moveDiff = Common::Point(3, 2); + _actor4.changeZoom(-1); + _actor4._effect = 1; + _actor4.setPosition(Common::Point(-15, 90)); + _actor4.setup(3402, 1, 1); + _actor4.animate(ANIM_MODE_1, NULL); + Common::Point pt1(115, 90); + NpcMover *mover1 = new NpcMover(); + _actor4.addMover(mover1, &pt1, this); + R2_GLOBALS._scrollFollower = &_actor4; + Common::Point pt2(203, 76); + NpcMover *mover2 = new NpcMover(); + _actor3.addMover(mover2, &pt2, NULL); + _sceneMode = 3401; + } + break; + case 3401: + _sceneMode = 3305; + _stripManager.start(3305, this); + break; + case 3402: + _sceneMode = 3306; + _stripManager.start(3306, this); + break; + case 3403: + R2_GLOBALS._scrollFollower = &R2_GLOBALS._player; + _sceneMode = 3309; + _stripManager.start(3309, this); + break; + case 3405: + _sceneMode = 3310; + _stripManager.start(3310, this); + break; + case 3406: + _sceneMode = 3311; + _stripManager.start(3311, this); + break; + case 3407: + R2_GLOBALS._sceneManager.changeScene(3600); + break; + default: + R2_GLOBALS._player.enableControl(); + break; + } +} + } // 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 ac1436637c..8968bddf1a 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.h +++ b/engines/tsage/ringworld2/ringworld2_scenes3.h @@ -400,6 +400,30 @@ public: virtual void signal(); }; +class Scene3400 : public SceneExt { +public: + SpeakerQuinn3400 _quinnSpeaker; + SpeakerSeeker3400 _seekerSpeaker; + SpeakerMiranda3400 _mirandaSpeaker; + SpeakerWebbster3400 _webbsterSpeaker; + SpeakerTeal3400 _tealSpeaker; + SceneActor _actor1; + SceneActor _actor2; + SceneActor _actor3; + SceneActor _actor4; + SceneActor _actor5; + SceneActor _actor6; + SceneActor _actor7; + SceneActor _actor8; + SequenceManager _sequenceManager; + int16 _field157C; + + Scene3400(); + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void remove(); + virtual void signal(); + virtual void synchronize(Serializer &s); +}; } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_speakers.cpp b/engines/tsage/ringworld2/ringworld2_speakers.cpp index b63409e387..edcf340e04 100644 --- a/engines/tsage/ringworld2/ringworld2_speakers.cpp +++ b/engines/tsage/ringworld2/ringworld2_speakers.cpp @@ -1602,5 +1602,318 @@ void SpeakerMiranda3255::proc15() { } } +SpeakerQuinn3400::SpeakerQuinn3400() { + _speakerName = "QUINN"; + _color1 = 60; + _color2 = 0; + _fieldF6 = 0; + _textWidth = 300; + _hideObjects = false; + _object2 = NULL; + _displayMode = 1; + _numFrames = 0; +} +void SpeakerQuinn3400::proc15() { + Scene3400 *scene = (Scene3400 *)R2_GLOBALS._sceneManager._scene; + + int v = _fieldF6; + + if (!_object2) { + if (R2_GLOBALS._player._characterIndex == 1) + _object2 = &R2_GLOBALS._player; + else if (R2_GLOBALS._player._characterIndex == 2) + _object2 = &scene->_actor1; + else + _object2 = &scene->_actor2; + + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + _object1._numFrames = 7; + _object1._effect = 1; + _object1.changeZoom(-1); + R2_GLOBALS._player.disableControl(); + if (_object2->_mover) + _object2->addMover(NULL); + } + + switch (v) { + case 0: + _object1.animate(ANIM_MODE_2, NULL); + break; + case 1: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4010, 5, 1); + _object1.animate(ANIM_MODE_5, NULL); + break; + case 2: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4010, 3, 1); + _object1.animate(ANIM_MODE_5, NULL); + break; + case 3: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4012, 3, 1); + _object1.animate(ANIM_MODE_5, NULL); + break; + default: + signal(); + break; + } +} + +SpeakerSeeker3400::SpeakerSeeker3400() { + _speakerName = "SEEKER"; + _color1 = 35; + _color2 = 0; + _fieldF6 = 0; + _textWidth = 300; + _hideObjects = false; + _object2 = NULL; + _displayMode = 1; + _numFrames = 0; +} + +void SpeakerSeeker3400::proc15() { + Scene3400 *scene = (Scene3400 *)R2_GLOBALS._sceneManager._scene; + + int v = _fieldF6; + + if (!_object2) { + if (R2_GLOBALS._player._characterIndex == 2) + _object2 = &R2_GLOBALS._player; + else + _object2 = &scene->_actor1; + + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + _object1._numFrames = 7; + _object1._effect = 1; + _object1.changeZoom(-1); + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + switch (v) { + case 0: + _object1.animate(ANIM_MODE_2, NULL); + break; + case 1: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4031, 1, 1); + _object1.animate(ANIM_MODE_5, NULL); + break; + case 2: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4031, 3, 1); + _object1.animate(ANIM_MODE_5, NULL); + break; + case 3: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4030, 3, 1); + _object1.animate(ANIM_MODE_5, NULL); + break; + case 4: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4031, 7, 1); + _object1.animate(ANIM_MODE_5, NULL); + break; + case 5: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4033, 1, 1); + _object1.animate(ANIM_MODE_5, NULL); + break; + default: + signal(); + break; + } +} + +SpeakerMiranda3400::SpeakerMiranda3400() { + _speakerName = "MIRANDA"; + _color1 = 154; + _color2 = 0; + _fieldF6 = 0; + _textWidth = 300; + _hideObjects = false; + _object2 = NULL; + _displayMode = 1; + _numFrames = 0; +} + +void SpeakerMiranda3400::proc15() { + Scene3400 *scene = (Scene3400 *)R2_GLOBALS._sceneManager._scene; + + int v = _fieldF6; + + if (!_object2) { + if (R2_GLOBALS._player._characterIndex == 3) + _object2 = &R2_GLOBALS._player; + else + _object2 = &scene->_actor2; + + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + _object1._numFrames = 7; + _object1._effect = 1; + _object1.changeZoom(-1); + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + switch (v) { + case 0: + _object1.animate(ANIM_MODE_2, NULL); + break; + case 1: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4051, 5, 1); + _object1.animate(ANIM_MODE_5, NULL); + break; + case 2: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4050, 3, 1); + _object1.animate(ANIM_MODE_5, NULL); + break; + default: + signal(); + break; + } +} + +SpeakerWebbster3400::SpeakerWebbster3400() { + _speakerName = "WEBBSTER"; + _color1 = 27; + _color2 = 0; + _fieldF6 = 0; + _textWidth = 300; + _hideObjects = false; + _object2 = NULL; + _displayMode = 1; + _numFrames = 0; +} + +void SpeakerWebbster3400::proc15() { + Scene3400 *scene = (Scene3400 *)R2_GLOBALS._sceneManager._scene; + + int v = _fieldF6; + + if (!_object2) { + _object2 = &scene->_actor3; + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + _object1._numFrames = 7; + _object1._effect = 1; + _object1.changeZoom(-1); + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + switch (v) { + case 0: + _object1.animate(ANIM_MODE_2, NULL); + break; + case 1: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4110, 5, 1); + _object1.animate(ANIM_MODE_5, NULL); + break; + case 2: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4110, 7, 1); + _object1.animate(ANIM_MODE_5, NULL); + break; + case 3: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4110, 3, 1); + _object1.animate(ANIM_MODE_5, NULL); + break; + default: + signal(); + break; + } +} + +SpeakerTeal3400::SpeakerTeal3400() { + _speakerName = "TEAL"; + _color1 = 22; + _color2 = 0; + _fieldF6 = 0; + _textWidth = 300; + _hideObjects = false; + _object2 = NULL; + _displayMode = 1; + _numFrames = 0; +} + +void SpeakerTeal3400::proc15() { + Scene3400 *scene = (Scene3400 *)R2_GLOBALS._sceneManager._scene; + + int v = _fieldF6; + + if (!_object2) { + _object2 = &scene->_actor4; + _object2->hide(); + _object1.postInit(); + _object1._numFrames = 7; + _object1._effect = 1; + _object1.changeZoom(-1); + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + + if (_object2->_mover) + _object2->addMover(NULL); + } + _object1.setPosition(_object2->_position); + _object1.show(); + + if (scene ->_sceneMode == 3305) { + R2_GLOBALS._player.setStrip(6); + scene->_actor1.setStrip(6); + scene->_actor2.setStrip(6); + } + + switch (v) { + case 0: + _object1.animate(ANIM_MODE_2, NULL); + break; + case 1: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4107, 5, 1); + _object1.animate(ANIM_MODE_5, NULL); + break; + case 2: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4107, 1, 1); + _object1.animate(ANIM_MODE_5, NULL); + break; + case 3: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4107, 7, 1); + _object1.animate(ANIM_MODE_5, NULL); + break; + case 4: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(4107, 3, 1); + _object1.animate(ANIM_MODE_5, NULL); + break; + default: + signal(); + break; + } +} + } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_speakers.h b/engines/tsage/ringworld2/ringworld2_speakers.h index dba402b64a..f85b412f9c 100644 --- a/engines/tsage/ringworld2/ringworld2_speakers.h +++ b/engines/tsage/ringworld2/ringworld2_speakers.h @@ -388,6 +388,46 @@ public: virtual Common::String getClassName() { return "SpeakerMiranda3255"; } virtual void proc15(); }; + +class SpeakerQuinn3400 : public VisualSpeaker { +public: + SpeakerQuinn3400(); + + virtual Common::String getClassName() { return "SpeakerQuinn3400"; } + virtual void proc15(); +}; + +class SpeakerSeeker3400 : public VisualSpeaker { +public: + SpeakerSeeker3400(); + + virtual Common::String getClassName() { return "SpeakerSeeker3400"; } + virtual void proc15(); +}; + +class SpeakerMiranda3400 : public VisualSpeaker { +public: + SpeakerMiranda3400(); + + virtual Common::String getClassName() { return "SpeakerMiranda3400"; } + virtual void proc15(); +}; + +class SpeakerWebbster3400 : public VisualSpeaker { +public: + SpeakerWebbster3400(); + + virtual Common::String getClassName() { return "SpeakerWebbster3400"; } + virtual void proc15(); +}; + +class SpeakerTeal3400 : public VisualSpeaker { +public: + SpeakerTeal3400(); + + virtual Common::String getClassName() { return "SpeakerTeal3400"; } + virtual void proc15(); +}; } // End of namespace Ringworld2 } // End of namespace TsAGE -- cgit v1.2.3 From d015f5d4465b971a2dc99d51a7e4c11cb23103a7 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 26 Dec 2011 00:58:37 +0100 Subject: DREAMWEB: Remove some dead code --- engines/dreamweb/object.cpp | 12 ++---------- engines/dreamweb/sound.cpp | 8 -------- engines/dreamweb/stubs.cpp | 8 -------- engines/dreamweb/stubs.h | 29 ----------------------------- engines/dreamweb/titles.cpp | 2 +- engines/dreamweb/vgagrafx.cpp | 14 -------------- 6 files changed, 3 insertions(+), 70 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index 84829bf440..0a278d11ee 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -58,10 +58,6 @@ void DreamBase::fillRyan() { showRyanPage(); } -void DreamGenContext::isItWorn() { - flags._z = isItWorn((const DynObject *)es.ptr(bx, sizeof(DynObject))); -} - bool DreamBase::isItWorn(const DynObject *object) { return (object->id[0] == 'W'-'A') && (object->id[1] == 'E'-'A'); } @@ -604,7 +600,7 @@ void DreamGenContext::inToInv() { readMouse(); showPointer(); outOfInv(); - workToScreen(); + workToScreenCPP(); delPointer(); } @@ -645,7 +641,7 @@ void DreamGenContext::outOfInv() { readMouse(); showPointer(); inToInv(); - workToScreen(); + workToScreenCPP(); delPointer(); } @@ -780,10 +776,6 @@ void DreamBase::dropObject() { object->currentLocation = data.byte(kReallocation); } -void DreamGenContext::checkObjectSize() { - al = checkObjectSizeCPP() ? 0 : 1; -} - bool DreamGenContext::checkObjectSizeCPP() { byte containerSize = getOpenedSlotSize(); DynObject *object = getEitherAdCPP(); diff --git a/engines/dreamweb/sound.cpp b/engines/dreamweb/sound.cpp index 784a6d0d11..4683f333c9 100644 --- a/engines/dreamweb/sound.cpp +++ b/engines/dreamweb/sound.cpp @@ -30,10 +30,6 @@ namespace DreamGen { -void DreamGenContext::loadSpeech() { - loadSpeech((uint8)dl, (uint8)dh, (uint8)cl, (uint16)ax); -} - bool DreamBase::loadSpeech(byte type1, int idx1, byte type2, int idx2) { cancelCh1(); @@ -87,10 +83,6 @@ void DreamBase::playChannel1(uint8 index) { data.word(kCh1blockstocopy) = soundBank[index].blockCount(); } -void DreamGenContext::playChannel1() { - playChannel1(al); -} - void DreamBase::cancelCh0() { data.byte(kCh0repeat) = 0; data.word(kCh0blockstocopy) = 0; diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 3425ad400f..b2490c0364 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -1235,10 +1235,6 @@ void DreamBase::copyName(uint8 type, uint8 index, uint8 *dst) { dst[i] = 0; } -void DreamGenContext::commandWithOb() { - commandWithOb(al, bh, bl); -} - void DreamBase::commandWithOb(uint8 command, uint8 type, uint8 index) { uint8 commandLine[64] = "OBJECT NAME ONE "; delTextLine(); @@ -1752,10 +1748,6 @@ bool DreamGenContext::checkIfSet(uint8 x, uint8 y) { return false; } -void DreamGenContext::hangOn() { - hangOn(cx); -} - void DreamBase::hangOn(uint16 frameCount) { while (frameCount) { vSync(); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 62259a16a5..9e547837c7 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -24,7 +24,6 @@ void screenUpdate(); void startup1(); - void workToScreen(); void multiGet(); void multiGet(uint8 *dst, uint16 x, uint16 y, uint8 width, uint8 height) { DreamBase::multiGet(dst, x, y, width, height); @@ -48,21 +47,10 @@ uint8 printDirect(const uint8* string, uint16 x, uint16 y, uint8 maxWidth, bool centered) { return DreamBase::printDirect(string, x, y, maxWidth, centered); } - void showFrame(); - void showFrame(const Frame *frameData, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag, uint8 *width, uint8 *height) { - DreamBase::showFrame(frameData, x, y, frameNumber, effectsFlag, width, height); - } - void showFrame(const Frame *frameData, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag) { - DreamBase::showFrame(frameData, x, y, frameNumber, effectsFlag); - } void width160(); bool checkIfPerson(uint8 x, uint8 y); bool checkIfFree(uint8 x, uint8 y); bool checkIfEx(uint8 x, uint8 y); - void commandWithOb(); - void commandWithOb(uint8 command, uint8 type, uint8 index) { - DreamBase::commandWithOb(command, type, index); - } DynObject *getFreeAd(uint8 index) { return DreamBase::getFreeAd(index); } @@ -80,19 +68,11 @@ void getExPos(); bool checkIfSet(uint8 x, uint8 y); - void isItWorn(); - bool isItWorn(const DynObject *object) { - return DreamBase::isItWorn(object); - } void obToInv(); void obToInv(uint8 index, uint8 flag, uint16 x, uint16 y) { DreamBase::obToInv(index, flag, x, y); } void useRoutine(); - void hangOn(); - void hangOn(uint16 frameCount) { - DreamBase::hangOn(frameCount); - } void examineOb(bool examineAgain = true); void dumpWatch(); void transferText(); @@ -115,10 +95,6 @@ void monMessage(uint8 index) { DreamBase::monMessage(index); } - void playChannel1(); - void playChannel1(uint8 index) { - DreamBase::playChannel1(index); - } void look(); void autoLook(); void doLook(); @@ -148,10 +124,6 @@ void errorMessage1(); void errorMessage2(); void errorMessage3(); - void loadSpeech(); - bool loadSpeech(byte type1, int idx1, byte type2, int idx2) { - return DreamBase::loadSpeech(type1, idx1, type2, idx2); - } void set16ColPalette(); void afterNewRoom(); void madmanRun(); @@ -169,7 +141,6 @@ void getOpenedSize(); byte getOpenedSlotSize(); byte getOpenedSlotCount(); - void checkObjectSize(); bool checkObjectSizeCPP(); void openOb(); uint8 findFirstPath(uint16 param); diff --git a/engines/dreamweb/titles.cpp b/engines/dreamweb/titles.cpp index b653c2cf27..f116a90b6a 100644 --- a/engines/dreamweb/titles.cpp +++ b/engines/dreamweb/titles.cpp @@ -43,7 +43,7 @@ void DreamGenContext::monkSpeaking() { loadIntoTemp("DREAMWEB.G15"); clearWork(); showFrame(tempGraphics(), 160, 72, 0, 128); // show monk - workToScreen(); + workToScreenCPP(); data.byte(kVolume) = 7; data.byte(kVolumedirection) = (byte)-1; data.byte(kVolumeto) = 5; diff --git a/engines/dreamweb/vgagrafx.cpp b/engines/dreamweb/vgagrafx.cpp index 87ab998553..1c39021420 100644 --- a/engines/dreamweb/vgagrafx.cpp +++ b/engines/dreamweb/vgagrafx.cpp @@ -90,13 +90,6 @@ void DreamBase::workToScreenCPP() { engine->blit(workspace(), 320, 0, 0, 320, 200); } -void DreamGenContext::workToScreen() { - workToScreenCPP(); - uint size = 320 * 200; - di = si = size; - cx = 0; -} - void DreamBase::printUnderMon() { engine->printUnderMonitor(); } @@ -360,13 +353,6 @@ void DreamBase::showFrame(const Frame *frameData, uint16 x, uint16 y, uint16 fra return; } -void DreamGenContext::showFrame() { - uint8 width, height; - showFrame((Frame *)ds.ptr(0, 0), di, bx, ax & 0x1ff, ah & 0xfe, &width, &height); - cl = width; - ch = height; -} - void DreamBase::clearWork() { memset(workspace(), 0, 320*200); } -- cgit v1.2.3 From 04a147921f1259e8874c7f9b723e8b3a8158f8c8 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 26 Dec 2011 00:59:04 +0100 Subject: DREAMWEB: Rename workToScreenCPP to workToScreen --- engines/dreamweb/dreambase.h | 2 +- engines/dreamweb/keypad.cpp | 2 +- engines/dreamweb/monitor.cpp | 6 +++--- engines/dreamweb/newplace.cpp | 6 +++--- engines/dreamweb/object.cpp | 18 +++++++++--------- engines/dreamweb/people.cpp | 2 +- engines/dreamweb/saveload.cpp | 8 ++++---- engines/dreamweb/stubs.cpp | 30 +++++++++++++++--------------- engines/dreamweb/talk.cpp | 4 ++-- engines/dreamweb/titles.cpp | 4 ++-- engines/dreamweb/use.cpp | 4 ++-- engines/dreamweb/vgagrafx.cpp | 2 +- 12 files changed, 44 insertions(+), 44 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 0dc4e52d86..0438defc05 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -692,7 +692,7 @@ public: void multiGet(uint8 *dst, uint16 x, uint16 y, uint8 width, uint8 height); void multiPut(const uint8 *src, uint16 x, uint16 y, uint8 width, uint8 height); void multiDump(uint16 x, uint16 y, uint8 width, uint8 height); - void workToScreenCPP(); + void workToScreen(); void printUnderMon(); void cls(); void frameOutV(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, int16 x, int16 y); diff --git a/engines/dreamweb/keypad.cpp b/engines/dreamweb/keypad.cpp index 29f31f1bd0..878fbda5bf 100644 --- a/engines/dreamweb/keypad.cpp +++ b/engines/dreamweb/keypad.cpp @@ -118,7 +118,7 @@ void DreamBase::enterCode(uint8 digit0, uint8 digit1, uint8 digit2, uint8 digit3 showKeypad(); readMouse(); showPointer(); - workToScreenCPP(); + workToScreen(); delPointer(); data.word(kPresspointer) = 0; data.byte(kGetback) = 0; diff --git a/engines/dreamweb/monitor.cpp b/engines/dreamweb/monitor.cpp index 3ee68e897c..4627597ab0 100644 --- a/engines/dreamweb/monitor.cpp +++ b/engines/dreamweb/monitor.cpp @@ -61,7 +61,7 @@ void DreamGenContext::useMon() { printOuterMon(); initialMonCols(); printLogo(); - workToScreenCPP(); + workToScreen(); turnOnPower(); fadeUpYellows(); fadeUpMonFirst(); @@ -174,7 +174,7 @@ void DreamBase::monitorLogo() { //fadeDownMon(); // FIXME: Commented out in ASM printLogo(); printUnderMon(); - workToScreenCPP(); + workToScreen(); printLogo(); //fadeUpMon(); // FIXME: Commented out in ASM printLogo(); @@ -291,7 +291,7 @@ void DreamBase::delCurs() { void DreamBase::scrollMonitor() { printLogo(); printUnderMon(); - workToScreenCPP(); + workToScreen(); playChannel1(25); } diff --git a/engines/dreamweb/newplace.cpp b/engines/dreamweb/newplace.cpp index 4942804369..03824aa706 100644 --- a/engines/dreamweb/newplace.cpp +++ b/engines/dreamweb/newplace.cpp @@ -54,7 +54,7 @@ void DreamBase::selectLocation() { readMouse(); data.byte(kPointerframe) = 0; showPointer(); - workToScreenCPP(); + workToScreen(); playChannel0(9, 255); data.byte(kNewlocation) = 255; @@ -189,7 +189,7 @@ void DreamBase::nextDest() { underTextLine(); readMouse(); showPointer(); - workToScreenCPP(); + workToScreen(); delPointer(); } @@ -218,7 +218,7 @@ void DreamBase::lastDest() { underTextLine(); readMouse(); showPointer(); - workToScreenCPP(); + workToScreen(); delPointer(); } diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index 0a278d11ee..8c26956681 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -147,7 +147,7 @@ void DreamGenContext::examineOb(bool examineAgain) { data.byte(kCommandtype) = 255; readMouse(); showPointer(); - workToScreenCPP(); + workToScreen(); delPointer(); examineAgain = false; } @@ -251,7 +251,7 @@ void DreamGenContext::inventory() { openInv(); readMouse(); showPointer(); - workToScreenCPP(); + workToScreen(); delPointer(); data.byte(kOpenedob) = 255; examineOb(false); @@ -600,7 +600,7 @@ void DreamGenContext::inToInv() { readMouse(); showPointer(); outOfInv(); - workToScreenCPP(); + workToScreen(); delPointer(); } @@ -641,7 +641,7 @@ void DreamGenContext::outOfInv() { readMouse(); showPointer(); inToInv(); - workToScreenCPP(); + workToScreen(); delPointer(); } @@ -834,7 +834,7 @@ void DreamGenContext::selectOpenOb() { underTextLine(); readMouse(); showPointer(); - workToScreenCPP(); + workToScreen(); delPointer(); } @@ -885,7 +885,7 @@ void DreamGenContext::swapWithInv() { fillRyan(); readMouse(); showPointer(); - workToScreenCPP(); + workToScreen(); delPointer(); } @@ -952,7 +952,7 @@ void DreamGenContext::useOpened() { readMouse(); useOpened(); showPointer(); - workToScreenCPP(); + workToScreen(); delPointer(); } @@ -1010,7 +1010,7 @@ void DreamGenContext::outOfOpen() { readMouse(); useOpened(); showPointer(); - workToScreenCPP(); + workToScreen(); delPointer(); } @@ -1080,7 +1080,7 @@ void DreamGenContext::swapWithOpen() { readMouse(); useOpened(); showPointer(); - workToScreenCPP(); + workToScreen(); delPointer(); } diff --git a/engines/dreamweb/people.cpp b/engines/dreamweb/people.cpp index 32fbbc04e5..83eb10765b 100644 --- a/engines/dreamweb/people.cpp +++ b/engines/dreamweb/people.cpp @@ -921,7 +921,7 @@ void DreamBase::mugger(ReelRoutine &routine) { const uint8 *string = getSegment(data.word(kPuzzletext)).ptr(offset, 0); uint16 y = 104; printDirect(&string, 33 + 20, &y, 241, 241 & 1); - workToScreenCPP(); + workToScreen(); hangOn(300); routine.setReelPointer(140); data.byte(kManspath) = 2; diff --git a/engines/dreamweb/saveload.cpp b/engines/dreamweb/saveload.cpp index 53c2f55d38..2076a349b5 100644 --- a/engines/dreamweb/saveload.cpp +++ b/engines/dreamweb/saveload.cpp @@ -133,7 +133,7 @@ void DreamBase::doLoad(int savegameId) { data.word(kTextaddressy) = 182; data.byte(kTextlen) = 240; startup(); - workToScreenCPP(); + workToScreen(); data.byte(kGetback) = 4; } @@ -220,7 +220,7 @@ void DreamBase::saveGame() { data.word(kTextaddressy) = 182; data.byte(kTextlen) = 240; redrawMainScrn(); - workToScreenCPP(); // show the main screen without the mouse pointer + workToScreen(); // show the main screen without the mouse pointer // We need to save after the scene has been redrawn, to capture the // correct screen thumbnail @@ -265,7 +265,7 @@ void DreamBase::doSaveLoad() { loadSaveBox(); showOpBox(); showMainOps(); - workToScreenCPP(); + workToScreen(); RectWithCallback opsList[] = { { kOpsx+59,kOpsx+114,kOpsy+30,kOpsy+76,&DreamBase::getBackFromOps }, @@ -745,7 +745,7 @@ void DreamBase::selectSlot() { showSaveOps(); readMouse(); showPointer(); - workToScreenCPP(); + workToScreen(); delPointer(); } diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index b2490c0364..0026d63204 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -508,7 +508,7 @@ void DreamGenContext::dreamweb() { clearPalette(); doLoad(savegameId); - workToScreenCPP(); + workToScreen(); fadeScreenUp(); startNewGame = false; @@ -728,7 +728,7 @@ void DreamGenContext::startup1() { startup(); - workToScreenCPP(); + workToScreen(); fadeScreenUp(); } @@ -849,10 +849,10 @@ void DreamGenContext::triggerMessage(uint16 index) { uint16 y = 156; printDirect(&string, 174, &y, 141, true); hangOn(140); - workToScreenCPP(); + workToScreen(); hangOn(340); multiPut(mapStore(), 174, 153, 200, 63); - workToScreenCPP(); + workToScreen(); data.byte(kLasttrigger) = 0; } @@ -2490,7 +2490,7 @@ void DreamBase::workToScreenM() { readMouse(); showPointer(); vSync(); - workToScreenCPP(); + workToScreen(); delPointer(); } @@ -2768,7 +2768,7 @@ void DreamGenContext::afterIntroRoom() { reelsOnScreen(); spriteUpdate(); printSprites(); - workToScreenCPP(); + workToScreen(); data.byte(kNowinnewroom) = 0; } @@ -2877,7 +2877,7 @@ void DreamGenContext::errorMessage1() { printMessage(76, 21, 58, 240, (240 & 1)); readMouse(); showPointer(); - workToScreenCPP(); + workToScreen(); delPointer(); hangOnP(50); showPanel(); @@ -2886,7 +2886,7 @@ void DreamGenContext::errorMessage1() { readMouse(); useOpened(); showPointer(); - workToScreenCPP(); + workToScreen(); delPointer(); } @@ -2896,7 +2896,7 @@ void DreamGenContext::errorMessage2() { printMessage(76, 21, 59, 240, (240 & 1)); readMouse(); showPointer(); - workToScreenCPP(); + workToScreen(); delPointer(); hangOnP(50); showPanel(); @@ -2905,7 +2905,7 @@ void DreamGenContext::errorMessage2() { readMouse(); useOpened(); showPointer(); - workToScreenCPP(); + workToScreen(); delPointer(); } @@ -2920,7 +2920,7 @@ void DreamGenContext::errorMessage3() { readMouse(); useOpened(); showPointer(); - workToScreenCPP(); + workToScreen(); delPointer(); } @@ -2940,7 +2940,7 @@ void DreamBase::putBackObStuff() { data.byte(kCommandtype) = 255; readMouse(); showPointer(); - workToScreenCPP(); + workToScreen(); delPointer(); } @@ -3125,7 +3125,7 @@ void DreamGenContext::decide() { data.byte(kManisoffscreen) = 1; loadSaveBox(); showDecisions(); - workToScreenCPP(); + workToScreen(); fadeScreenUp(); data.byte(kGetback) = 0; @@ -3184,7 +3184,7 @@ void DreamGenContext::showGun() { createPanel2(); showFrame(tempGraphics(), 100, 4, 0, 0); showFrame(tempGraphics(), 158, 106, 1, 0); - workToScreenCPP(); + workToScreen(); getRidOfTemp(); fadeScreenUp(); hangOn(160); @@ -3688,7 +3688,7 @@ void DreamBase::incRyanPage() { fillRyan(); readMouse(); showPointer(); - workToScreenCPP(); + workToScreen(); delPointer(); } diff --git a/engines/dreamweb/talk.cpp b/engines/dreamweb/talk.cpp index 131e164cf6..a73a5091c0 100644 --- a/engines/dreamweb/talk.cpp +++ b/engines/dreamweb/talk.cpp @@ -38,7 +38,7 @@ void DreamBase::talk() { data.byte(kCommandtype) = 255; readMouse(); showPointer(); - workToScreenCPP(); + workToScreen(); RectWithCallback talkList[] = { { 273,320,157,198,&DreamBase::getBack1 }, @@ -259,7 +259,7 @@ void DreamBase::redes() { startTalk(); readMouse(); showPointer(); - workToScreenCPP(); + workToScreen(); delPointer(); } diff --git a/engines/dreamweb/titles.cpp b/engines/dreamweb/titles.cpp index f116a90b6a..dd8b3550cf 100644 --- a/engines/dreamweb/titles.cpp +++ b/engines/dreamweb/titles.cpp @@ -43,7 +43,7 @@ void DreamGenContext::monkSpeaking() { loadIntoTemp("DREAMWEB.G15"); clearWork(); showFrame(tempGraphics(), 160, 72, 0, 128); // show monk - workToScreenCPP(); + workToScreen(); data.byte(kVolume) = 7; data.byte(kVolumedirection) = (byte)-1; data.byte(kVolumeto) = 5; @@ -260,7 +260,7 @@ void DreamGenContext::loadIntroRoom() { reelsOnScreen(); spriteUpdate(); printSprites(); - workToScreenCPP(); + workToScreen(); } void DreamGenContext::set16ColPalette() { diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp index 78dffc99ad..8aa735d84f 100644 --- a/engines/dreamweb/use.cpp +++ b/engines/dreamweb/use.cpp @@ -1267,7 +1267,7 @@ void DreamBase::useDiary() { showDiaryPage(); readMouse(); showPointer(); - workToScreenCPP(); + workToScreen(); delPointer(); data.byte(kGetback) = 0; @@ -1586,7 +1586,7 @@ void DreamBase::withWhat() { data.byte(kCommandtype) = 255; readMouse(); showPointer(); - workToScreenCPP(); + workToScreen(); delPointer(); data.byte(kInvopen) = 2; } diff --git a/engines/dreamweb/vgagrafx.cpp b/engines/dreamweb/vgagrafx.cpp index 1c39021420..ce89711f87 100644 --- a/engines/dreamweb/vgagrafx.cpp +++ b/engines/dreamweb/vgagrafx.cpp @@ -86,7 +86,7 @@ void DreamBase::multiDump(uint16 x, uint16 y, uint8 width, uint8 height) { engine->blit(workspace() + offset, kScreenwidth, x, y, width, height); } -void DreamBase::workToScreenCPP() { +void DreamBase::workToScreen() { engine->blit(workspace(), 320, 0, 0, 320, 200); } -- cgit v1.2.3 From dbe5b50cd34362bc3a6743be6eac0e4840353a47 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 26 Dec 2011 01:36:29 +0100 Subject: DREAMWEB: Port rollEm() to C++ --- engines/dreamweb/dreambase.h | 5 +++ engines/dreamweb/dreamgen.cpp | 94 ------------------------------------------- engines/dreamweb/dreamgen.h | 1 - engines/dreamweb/sprite.cpp | 2 + engines/dreamweb/stubs.h | 3 -- engines/dreamweb/titles.cpp | 6 +-- engines/dreamweb/vgafades.cpp | 47 +++++++++++++++++++++- 7 files changed, 54 insertions(+), 104 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 0438defc05..3bc2757ac8 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -563,6 +563,9 @@ public: bool hangOnPQ(); void redes(); + // from titles.cpp + void hangOne(uint16 delay); + // from use.cpp void placeFreeObject(uint8 index); void removeFreeObject(uint8 index); @@ -710,6 +713,8 @@ public: void createPanel(); void createPanel2(); void showPanel(); + void rollEndCredits2(); + void rollEm(); }; diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index e92291178c..fcf8dc6727 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -73,100 +73,6 @@ void DreamGenContext::transferMap() { _add(data.word(kExframepos), cx); } -void DreamGenContext::rollEm() { - STACK_CHECK; - cl = 160; - ch = 160; - di = 25; - bx = 20; - ds = data.word(kMapstore); - si = 0; - multiGet(); - es = data.word(kTextfile1); - si = 49*2; - ax = es.word(si); - si = ax; - _add(si, (66*2)); - cx = 80; -endcredits21: - push(cx); - bx = 10; - cx = data.word(kLinespacing); -endcredits22: - push(cx); - push(si); - push(di); - push(es); - push(bx); - vSync(); - cl = 160; - ch = 160; - di = 25; - bx = 20; - ds = data.word(kMapstore); - si = 0; - multiPut(); - vSync(); - bx = pop(); - es = pop(); - di = pop(); - si = pop(); - push(si); - push(di); - push(es); - push(bx); - cx = 18; -onelot2: - push(cx); - di = 25; - dx = 161; - ax = 0; - printDirect(); - _add(bx, data.word(kLinespacing)); - cx = pop(); - if (--cx) - goto onelot2; - vSync(); - cl = 160; - ch = 160; - di = 25; - bx = 20; - multiDump(); - bx = pop(); - es = pop(); - di = pop(); - si = pop(); - cx = pop(); - _cmp(data.byte(kLasthardkey), 1); - if (flags.z()) - goto endearly2; - _dec(bx); - if (--cx) - goto endcredits22; - cx = pop(); -looknext2: - al = es.byte(si); - _inc(si); - _cmp(al, ':'); - if (flags.z()) - goto gotnext2; - _cmp(al, 0); - if (flags.z()) - goto gotnext2; - goto looknext2; -gotnext2: - _cmp(data.byte(kLasthardkey), 1); - if (flags.z()) - return /* (endearly) */; - if (--cx) - goto endcredits21; - cx = 120; - hangOne(); - return; -endearly2: - cx = pop(); -} - void DreamGenContext::fillOpen() { STACK_CHECK; delTextLine(); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 4d6946e8ab..40046c4379 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -460,7 +460,6 @@ public: void pickupConts(); void transferMap(); void getSetAd(); - void rollEm(); void findAllOpen(); void fillOpen(); void dreamweb(); diff --git a/engines/dreamweb/sprite.cpp b/engines/dreamweb/sprite.cpp index c9ea699988..72be878e14 100644 --- a/engines/dreamweb/sprite.cpp +++ b/engines/dreamweb/sprite.cpp @@ -706,6 +706,8 @@ void DreamBase::intro3Text(uint16 nextReelPointer) { } void DreamBase::rollEndCredits() { + // Note: This function is very similar to rollEm() in vgafades.cpp + playChannel0(16, 255); data.byte(kVolume) = 7; data.byte(kVolumeto) = 0; diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 9e547837c7..9e1649dcaa 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -107,8 +107,6 @@ void inventory(); void mainScreen(); void zoomOnOff(); - void hangOne(uint16 delay); - void hangOne(); void bibleQuote(); void realCredits(); void runIntroSeq(); @@ -131,7 +129,6 @@ void showGun(); void endGame(); void monkSpeaking(); - void rollEndCredits2(); void triggerMessage(uint16 index); void processTrigger(); void updateSymbolTop(); diff --git a/engines/dreamweb/titles.cpp b/engines/dreamweb/titles.cpp index dd8b3550cf..f3dafa38d9 100644 --- a/engines/dreamweb/titles.cpp +++ b/engines/dreamweb/titles.cpp @@ -110,7 +110,7 @@ void DreamGenContext::bibleQuote() { data.byte(kLasthardkey) = 0; } -void DreamGenContext::hangOne(uint16 delay) { +void DreamBase::hangOne(uint16 delay) { do { vSync(); if (data.byte(kLasthardkey) == 1) @@ -118,10 +118,6 @@ void DreamGenContext::hangOne(uint16 delay) { } while (--delay); } -void DreamGenContext::hangOne() { - hangOne(cx); -} - void DreamGenContext::intro() { loadTempText("DREAMWEB.T82"); loadPalFromIFF(); diff --git a/engines/dreamweb/vgafades.cpp b/engines/dreamweb/vgafades.cpp index 80f5ce608a..23a8655fa1 100644 --- a/engines/dreamweb/vgafades.cpp +++ b/engines/dreamweb/vgafades.cpp @@ -281,8 +281,53 @@ void DreamBase::dumpCurrent() { engine->setPalette(pal, 128, 128); } -void DreamGenContext::rollEndCredits2() { +void DreamBase::rollEndCredits2() { rollEm(); } +void DreamBase::rollEm() { + // Note: This function is very similar to rollEndCredits() in sprite.cpp + + multiGet(mapStore(), 25, 20, 160, 160); + + const uint8 *string = getTextInFile1(49); + const int linespacing = data.word(kLinespacing); + + for (int i = 0; i < 80; ++i) { + // Output the text, initially with an offset of 10 pixels, + // then move it up one pixel until we shifted it by a complete + // line of text. + for (int j = 0; j < linespacing; ++j) { + vSync(); + multiPut(mapStore(), 25, 20, 160, 160); + vSync(); + + // Output up to 18 lines of text + uint16 y = 10 - j; + const uint8 *tmp_str = string; + for (int k = 0; k < 18; ++k) { + DreamBase::printDirect(&tmp_str, 25, &y, 160 + 1, true); + y += linespacing; + } + + vSync(); + multiDump(25, 20, 160, 160); + + if (data.byte(kLasthardkey) == 1) + return; + } + + // Skip to the next text line + byte c; + do { + c = *string++; + } while (c != ':' && c != 0); + + if (data.byte(kLasthardkey) == 1) + return; + } + + hangOne(120); +} + } // End of namespace DreamGen -- cgit v1.2.3 From a4643a0484fe1f54a2cc60ad146cf459012bd0f1 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 26 Dec 2011 01:41:15 +0100 Subject: DREAMWEB: Move titles.cpp to DreamBase --- engines/dreamweb/dreambase.h | 12 ++++++++++++ engines/dreamweb/stubs.cpp | 4 ++-- engines/dreamweb/stubs.h | 12 ------------ engines/dreamweb/titles.cpp | 20 ++++++++++---------- 4 files changed, 24 insertions(+), 24 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 3bc2757ac8..2f9a9e82c4 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -564,7 +564,17 @@ public: void redes(); // from titles.cpp + void endGame(); + void monkSpeaking(); + void gettingShot(); + void bibleQuote(); void hangOne(uint16 delay); + void intro(); + void runIntroSeq(); + void runEndSeq(); + void loadIntroRoom(); + void set16ColPalette(); + void realCredits(); // from use.cpp void placeFreeObject(uint8 index); @@ -655,6 +665,8 @@ public: void useTrainer(); void useStereo(); void chewy(); + void delEverything(); + void afterIntroRoom(); // from vgafades.cpp void clearStartPal(); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 0026d63204..f21927c57d 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -2757,7 +2757,7 @@ void DreamGenContext::walkIntoRoom() { } } -void DreamGenContext::afterIntroRoom() { +void DreamBase::afterIntroRoom() { if (data.byte(kNowinnewroom) == 0) return; // notnewintro @@ -2861,7 +2861,7 @@ void DreamBase::describeOb() { } } -void DreamGenContext::delEverything() { +void DreamBase::delEverything() { if (data.byte(kMapysize) + data.word(kMapoffsety) < 182) { mapToPanel(); } else { diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 9e1649dcaa..dd6cd37f8c 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -107,33 +107,21 @@ void inventory(); void mainScreen(); void zoomOnOff(); - void bibleQuote(); - void realCredits(); - void runIntroSeq(); - void intro(); void pickupOb(uint8 command, uint8 pos); void initialInv(); void walkIntoRoom(); - void loadIntroRoom(); - void afterIntroRoom(); - void gettingShot(); void allPointer(); - void delEverything(); void errorMessage1(); void errorMessage2(); void errorMessage3(); - void set16ColPalette(); void afterNewRoom(); void madmanRun(); void decide(); void showGun(); - void endGame(); - void monkSpeaking(); void triggerMessage(uint16 index); void processTrigger(); void updateSymbolTop(); void updateSymbolBot(); - void runEndSeq(); bool execCommand(); void getOpenedSize(); byte getOpenedSlotSize(); diff --git a/engines/dreamweb/titles.cpp b/engines/dreamweb/titles.cpp index f3dafa38d9..a521036202 100644 --- a/engines/dreamweb/titles.cpp +++ b/engines/dreamweb/titles.cpp @@ -25,7 +25,7 @@ namespace DreamGen { -void DreamGenContext::endGame() { +void DreamBase::endGame() { loadTempText("DREAMWEB.T83"); monkSpeaking(); gettingShot(); @@ -35,7 +35,7 @@ void DreamGenContext::endGame() { hangOn(200); } -void DreamGenContext::monkSpeaking() { +void DreamBase::monkSpeaking() { // FIXME: This is the CD version only. data.byte(kRoomssample) = 35; @@ -68,7 +68,7 @@ void DreamGenContext::monkSpeaking() { getRidOfTemp(); } -void DreamGenContext::gettingShot() { +void DreamBase::gettingShot() { data.byte(kNewlocation) = 55; clearPalette(); loadIntroRoom(); @@ -79,7 +79,7 @@ void DreamGenContext::gettingShot() { clearBeforeLoad(); } -void DreamGenContext::bibleQuote() { +void DreamBase::bibleQuote() { initGraphics(640, 480, true); showPCX("DREAMWEB.I00"); @@ -118,7 +118,7 @@ void DreamBase::hangOne(uint16 delay) { } while (--delay); } -void DreamGenContext::intro() { +void DreamBase::intro() { loadTempText("DREAMWEB.T82"); loadPalFromIFF(); setMode(); @@ -174,7 +174,7 @@ void DreamGenContext::intro() { data.byte(kLasthardkey) = 0; } -void DreamGenContext::runIntroSeq() { +void DreamBase::runIntroSeq() { data.byte(kGetback) = 0; do { @@ -220,7 +220,7 @@ void DreamGenContext::runIntroSeq() { //clearBeforeLoad(); } -void DreamGenContext::runEndSeq() { +void DreamBase::runEndSeq() { atmospheres(); data.byte(kGetback) = 0; @@ -240,7 +240,7 @@ void DreamGenContext::runEndSeq() { } while (data.byte(kGetback) != 1); } -void DreamGenContext::loadIntroRoom() { +void DreamBase::loadIntroRoom() { data.byte(kIntrocount) = 0; data.byte(kLocation) = 255; loadRoom(); @@ -259,10 +259,10 @@ void DreamGenContext::loadIntroRoom() { workToScreen(); } -void DreamGenContext::set16ColPalette() { +void DreamBase::set16ColPalette() { } -void DreamGenContext::realCredits() { +void DreamBase::realCredits() { data.byte(kRoomssample) = 33; loadRoomsSample(); data.byte(kVolume) = 0; -- cgit v1.2.3 From 7945a0fbb0ee3ec89d2b4e51d130f47b9717bfd3 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 26 Dec 2011 02:50:02 +0200 Subject: DREAMWEB: Cleaned up findFirstPath(), fixed a regression and moved it to DreamBase --- engines/dreamweb/dreambase.h | 1 + engines/dreamweb/object.cpp | 28 +--------------------------- engines/dreamweb/pathfind.cpp | 20 ++++++++++++++++++++ engines/dreamweb/structs.h | 8 ++++---- engines/dreamweb/stubs.h | 1 - 5 files changed, 26 insertions(+), 32 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 0dc4e52d86..a7b3316dfc 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -220,6 +220,7 @@ public: bool checkIfPathIsOn(uint8 index); void bresenhams(); void workoutFrames(); + byte findFirstPath(byte x, byte y); // from people.cpp void setupInitialReelRoutines(); diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index 84829bf440..8e202a0ed0 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -341,32 +341,6 @@ void DreamGenContext::openOb() { _openChangeSize = getOpenedSlotCount() * kItempicsize + kInventx; } -uint8 DreamGenContext::findFirstPath(uint16 param) { - es = data.word(kReels); - uint16 ptr = 144 * data.byte(kRoomnum); - // TODO: Replace ax, cx usage with temporary uint8/16 variables... - cx = param; - - for (uint8 pathLoop = 0; pathLoop < 12; pathLoop++, ptr += 8) { - ax = es.word(ptr+2); - - if (ax == 0x0ffff) - continue; // "nofirst" - - if (cl < al || ch < ah) - continue; // "nofirst" - - ax = es.word(ptr+4); - - if (cl > al || ch > ah) - continue; // "nofirst" - - return es.byte(ptr+6); // "gotfirst" - } - - return 0; -} - void DreamGenContext::identifyOb() { if (data.word(kWatchingtime) != 0) { blank(); @@ -388,7 +362,7 @@ void DreamGenContext::identifyOb() { data.byte(kPointerspath) = dl; ax = pop(); push(ax); - data.byte(kPointerfirstpath) = findFirstPath(ax); + data.byte(kPointerfirstpath) = findFirstPath(al, ah); ax = pop(); byte x = al; diff --git a/engines/dreamweb/pathfind.cpp b/engines/dreamweb/pathfind.cpp index 8d9d9a95bb..20bbf7d67e 100644 --- a/engines/dreamweb/pathfind.cpp +++ b/engines/dreamweb/pathfind.cpp @@ -309,4 +309,24 @@ void DreamBase::workoutFrames() { data.byte(kTurndirection) = 0; } +byte DreamBase::findFirstPath(byte x, byte y) { + PathNode *paths = (PathNode *)getSegment(data.word(kReels)).ptr(kPathdata + 144 * data.byte(kRoomnum), 0); + + for (uint8 index = 0; index < 12; index++) { + if (paths[index].x1 == 0xff && paths[index].y1 == 0xff) + continue; // "nofirst" + + if (x < paths[index].x1 || y < paths[index].y1) + continue; // "nofirst" + + if (x >= paths[index].x2 || y >= paths[index].y2) + continue; // "nofirst" + + return paths[index].on; // "gotfirst" + } + + return 0; +} + + } // End of namespace DreamGen diff --git a/engines/dreamweb/structs.h b/engines/dreamweb/structs.h index d64bcab5d0..b0a168930b 100644 --- a/engines/dreamweb/structs.h +++ b/engines/dreamweb/structs.h @@ -221,10 +221,10 @@ struct Change { struct PathNode { uint8 x; uint8 y; - uint8 b2; - uint8 b3; - uint8 b4; - uint8 b5; + uint8 x1; + uint8 y1; + uint8 x2; + uint8 y2; uint8 on; uint8 dir; }; diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 62259a16a5..148436e8a8 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -172,7 +172,6 @@ void checkObjectSize(); bool checkObjectSizeCPP(); void openOb(); - uint8 findFirstPath(uint16 param); void identifyOb(); void selectOb(); void findInvPos(); -- cgit v1.2.3 From d503838fd65db483a764d550cc6cce32984f6381 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 26 Dec 2011 03:15:47 +0200 Subject: DREAMWEB: Moved the two rollEndCredits functions together in print.cpp and renamed them to rollEndCreditsGameWon and rollEndCreditsGameLost --- engines/dreamweb/dreambase.h | 5 +-- engines/dreamweb/people.cpp | 2 +- engines/dreamweb/print.cpp | 87 +++++++++++++++++++++++++++++++++++++++++++ engines/dreamweb/sprite.cpp | 46 ----------------------- engines/dreamweb/stubs.cpp | 2 +- engines/dreamweb/vgafades.cpp | 49 ------------------------ 6 files changed, 91 insertions(+), 100 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 3b4ef7e131..a669e6bc20 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -291,6 +291,8 @@ public: uint16 waitFrames(); void printCurs(); void delCurs(); + void rollEndCreditsGameWon(); + void rollEndCreditsGameLost(); // from saveload.cpp void loadGame(); @@ -362,7 +364,6 @@ public: void intro2Text(uint16 nextReelPointer); void intro3Text(uint16 nextReelPointer); - void rollEndCredits(); void monks2text(); void textForEnd(); void textForMonkHelper(uint8 textIndex, uint8 voiceIndex, uint8 x, uint8 y, uint16 countToTimed, uint16 timeCount); @@ -726,8 +727,6 @@ public: void createPanel(); void createPanel2(); void showPanel(); - void rollEndCredits2(); - void rollEm(); }; diff --git a/engines/dreamweb/people.cpp b/engines/dreamweb/people.cpp index 83eb10765b..a6ebbcc1ec 100644 --- a/engines/dreamweb/people.cpp +++ b/engines/dreamweb/people.cpp @@ -1030,7 +1030,7 @@ void DreamBase::endGameSeq(ReelRoutine &routine) { if (routine.reelPointer() == 145) { routine.setReelPointer(146); - rollEndCredits(); + rollEndCreditsGameWon(); } } diff --git a/engines/dreamweb/print.cpp b/engines/dreamweb/print.cpp index 0fd596ceac..0191aa8860 100644 --- a/engines/dreamweb/print.cpp +++ b/engines/dreamweb/print.cpp @@ -263,4 +263,91 @@ const char *DreamBase::monPrint(const char *string) { return iterator; } +void DreamBase::rollEndCreditsGameWon() { + playChannel0(16, 255); + data.byte(kVolume) = 7; + data.byte(kVolumeto) = 0; + data.byte(kVolumedirection) = (byte)-1; + + multiGet(mapStore(), 75, 20, 160, 160); + + const uint8 *string = getTextInFile1(3); + const int linespacing = data.word(kLinespacing); + + for (int i = 0; i < 254; ++i) { + // Output the text, initially with an offset of 10 pixels, + // then move it up one pixel until we shifted it by a complete + // line of text. + for (int j = 0; j < linespacing; ++j) { + vSync(); + multiPut(mapStore(), 75, 20, 160, 160); + vSync(); + + // Output up to 18 lines of text + uint16 y = 10 - j; + const uint8 *tmp_str = string; + for (int k = 0; k < 18; ++k) { + DreamBase::printDirect(&tmp_str, 75, &y, 160 + 1, true); + y += linespacing; + } + + vSync(); + multiDump(75, 20, 160, 160); + } + + // Skip to the next text line + byte c; + do { + c = *string++; + } while (c != ':' && c != 0); + } + + hangOn(100); + panelToMap(); + fadeScreenUpHalf(); +} + +void DreamBase::rollEndCreditsGameLost() { + multiGet(mapStore(), 25, 20, 160, 160); + + const uint8 *string = getTextInFile1(49); + const int linespacing = data.word(kLinespacing); + + for (int i = 0; i < 80; ++i) { + // Output the text, initially with an offset of 10 pixels, + // then move it up one pixel until we shifted it by a complete + // line of text. + for (int j = 0; j < linespacing; ++j) { + vSync(); + multiPut(mapStore(), 25, 20, 160, 160); + vSync(); + + // Output up to 18 lines of text + uint16 y = 10 - j; + const uint8 *tmp_str = string; + for (int k = 0; k < 18; ++k) { + DreamBase::printDirect(&tmp_str, 25, &y, 160 + 1, true); + y += linespacing; + } + + vSync(); + multiDump(25, 20, 160, 160); + + if (data.byte(kLasthardkey) == 1) + return; + } + + // Skip to the next text line + byte c; + do { + c = *string++; + } while (c != ':' && c != 0); + + if (data.byte(kLasthardkey) == 1) + return; + } + + hangOne(120); +} + } // End of namespace DreamGen diff --git a/engines/dreamweb/sprite.cpp b/engines/dreamweb/sprite.cpp index 72be878e14..f23804b395 100644 --- a/engines/dreamweb/sprite.cpp +++ b/engines/dreamweb/sprite.cpp @@ -705,52 +705,6 @@ void DreamBase::intro3Text(uint16 nextReelPointer) { setupTimedTemp(46, 82, 36, 56, 100, 1); } -void DreamBase::rollEndCredits() { - // Note: This function is very similar to rollEm() in vgafades.cpp - - playChannel0(16, 255); - data.byte(kVolume) = 7; - data.byte(kVolumeto) = 0; - data.byte(kVolumedirection) = (byte)-1; - - multiGet(mapStore(), 75, 20, 160, 160); - - const uint8 *string = getTextInFile1(3); - const int linespacing = data.word(kLinespacing); - - for (int i = 0; i < 254; ++i) { - // Output the text, initially with an offset of 10 pixels, - // then move it up one pixel until we shifted it by a complete - // line of text. - for (int j = 0; j < linespacing; ++j) { - vSync(); - multiPut(mapStore(), 75, 20, 160, 160); - vSync(); - - // Output up to 18 lines of text - uint16 y = 10 - j; - const uint8 *tmp_str = string; - for (int k = 0; k < 18; ++k) { - DreamBase::printDirect(&tmp_str, 75, &y, 160 + 1, true); - y += linespacing; - } - - vSync(); - multiDump(75, 20, 160, 160); - } - - // Skip to the next text line - byte c; - do { - c = *string++; - } while (c != ':' && c != 0); - } - hangOn(100); - panelToMap(); - fadeScreenUpHalf(); -} - - void DreamBase::monks2text() { bool isGermanCD = isCD() && engine->getLanguage() == Common::DE_DEU; diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index f21927c57d..e8fa1767b8 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -3190,7 +3190,7 @@ void DreamGenContext::showGun() { hangOn(160); playChannel0(12, 0); loadTempText("DREAMWEB.T83"); - rollEndCredits2(); + rollEndCreditsGameLost(); getRidOfTempText(); } diff --git a/engines/dreamweb/vgafades.cpp b/engines/dreamweb/vgafades.cpp index 23a8655fa1..3833050003 100644 --- a/engines/dreamweb/vgafades.cpp +++ b/engines/dreamweb/vgafades.cpp @@ -281,53 +281,4 @@ void DreamBase::dumpCurrent() { engine->setPalette(pal, 128, 128); } -void DreamBase::rollEndCredits2() { - rollEm(); -} - -void DreamBase::rollEm() { - // Note: This function is very similar to rollEndCredits() in sprite.cpp - - multiGet(mapStore(), 25, 20, 160, 160); - - const uint8 *string = getTextInFile1(49); - const int linespacing = data.word(kLinespacing); - - for (int i = 0; i < 80; ++i) { - // Output the text, initially with an offset of 10 pixels, - // then move it up one pixel until we shifted it by a complete - // line of text. - for (int j = 0; j < linespacing; ++j) { - vSync(); - multiPut(mapStore(), 25, 20, 160, 160); - vSync(); - - // Output up to 18 lines of text - uint16 y = 10 - j; - const uint8 *tmp_str = string; - for (int k = 0; k < 18; ++k) { - DreamBase::printDirect(&tmp_str, 25, &y, 160 + 1, true); - y += linespacing; - } - - vSync(); - multiDump(25, 20, 160, 160); - - if (data.byte(kLasthardkey) == 1) - return; - } - - // Skip to the next text line - byte c; - do { - c = *string++; - } while (c != ':' && c != 0); - - if (data.byte(kLasthardkey) == 1) - return; - } - - hangOne(120); -} - } // End of namespace DreamGen -- cgit v1.2.3 From 389afc46660918409d69458bfbb096a6ba128f63 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Mon, 26 Dec 2011 05:02:51 +0000 Subject: DREAMWEB: Port 'findpathofpoint' to C++ --- engines/dreamweb/dreambase.h | 1 + engines/dreamweb/dreamgen.cpp | 44 ------------------------------------------- engines/dreamweb/dreamgen.h | 1 - engines/dreamweb/object.cpp | 3 +-- engines/dreamweb/pathfind.cpp | 21 +++++++++++++++++++++ engines/dreamweb/stubs.cpp | 5 +---- 6 files changed, 24 insertions(+), 51 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index a669e6bc20..cbcfa1e46f 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -221,6 +221,7 @@ public: void bresenhams(); void workoutFrames(); byte findFirstPath(byte x, byte y); + byte findPathOfPoint(byte x, byte y); // from people.cpp void setupInitialReelRoutines(); diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index fcf8dc6727..6c16274e32 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -652,50 +652,6 @@ finishpars: di = offset_operand1; } -void DreamGenContext::findPathOfPoint() { - STACK_CHECK; - push(ax); - bx = (0); - es = data.word(kReels); - al = data.byte(kRoomnum); - ah = 0; - cx = 144; - _mul(cx); - _add(bx, ax); - cx = pop(); - dl = 0; -pathloop: - al = es.byte(bx+6); - _cmp(al, 255); - if (!flags.z()) - goto flunkedit; - ax = es.word(bx+2); - _cmp(ax, 0x0ffff); - if (flags.z()) - goto flunkedit; - _cmp(cl, al); - if (flags.c()) - goto flunkedit; - _cmp(ch, ah); - if (flags.c()) - goto flunkedit; - ax = es.word(bx+4); - _cmp(cl, al); - if (!flags.c()) - goto flunkedit; - _cmp(ch, ah); - if (!flags.c()) - goto flunkedit; - return /* (gotvalidpath) */; -flunkedit: - _add(bx, 8); - _inc(dl); - _cmp(dl, 12); - if (!flags.z()) - goto pathloop; - dl = 255; -} - void DreamGenContext::__start() { static const uint8 src[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x13, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 40046c4379..6c5bf1918b 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -463,7 +463,6 @@ public: void findAllOpen(); void fillOpen(); void dreamweb(); - void findPathOfPoint(); void read(); void searchForString(); void searchForFiles(); diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index 7864b2aa25..9d5ea15fa3 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -354,8 +354,7 @@ void DreamGenContext::identifyOb() { data.byte(kInmaparea) = 1; ah = bl; push(ax); - findPathOfPoint(); - data.byte(kPointerspath) = dl; + data.byte(kPointerspath) = findPathOfPoint(al, ah); ax = pop(); push(ax); data.byte(kPointerfirstpath) = findFirstPath(al, ah); diff --git a/engines/dreamweb/pathfind.cpp b/engines/dreamweb/pathfind.cpp index 20bbf7d67e..4f887db251 100644 --- a/engines/dreamweb/pathfind.cpp +++ b/engines/dreamweb/pathfind.cpp @@ -328,5 +328,26 @@ byte DreamBase::findFirstPath(byte x, byte y) { return 0; } +byte DreamBase::findPathOfPoint(byte x, byte y) { + PathNode *paths = (PathNode *)getSegment(data.word(kReels)).ptr(kPathdata + 144 * data.byte(kRoomnum), 0); + + for (uint8 index = 0; index < 12; index++) { + if (paths[index].on != 0xff) + continue; // "flunkedit" + + if (paths[index].x1 == 0xff && paths[index].y1 == 0xff) + continue; // "flunkedit" + + if (x < paths[index].x1 || y < paths[index].y1) + continue; // "flunkedit" + + if (x >= paths[index].x2 || y >= paths[index].y2) + continue; // "flunkedit" + + return index; // "gotvalidpath" + } + + return 0xff; +} } // End of namespace DreamGen diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index e8fa1767b8..413bd27c85 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -3067,10 +3067,7 @@ void DreamGenContext::afterNewRoom() { data.byte(kCommandtype) = 0; findRoomInLoc(); if (data.byte(kRyanon) != 1) { - al = data.byte(kRyanx) + 12; - ah = data.byte(kRyany) + 12; - findPathOfPoint(); - data.byte(kManspath) = dl; + data.byte(kManspath) = findPathOfPoint(data.byte(kRyanx) + 12, data.byte(kRyany) + 12); findXYFromPath(); data.byte(kResetmanxy) = 1; } -- cgit v1.2.3 From 6f8a4bb336e3a881fabe7eb857a227a6dcd3d026 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Mon, 26 Dec 2011 05:46:01 +0000 Subject: DREAMWEB: Ported 'searchforfiles' to C++ --- engines/dreamweb/dreamgen.cpp | 16 ---------------- engines/dreamweb/dreamgen.h | 1 - engines/dreamweb/monitor.cpp | 13 +++++++++++++ engines/dreamweb/stubs.h | 1 + 4 files changed, 14 insertions(+), 17 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 6c16274e32..66885d7623 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -384,22 +384,6 @@ dirroot: scrollMonitor(); } -void DreamGenContext::searchForFiles() { - STACK_CHECK; - bx = (66*2); -directloop1: - al = es.byte(bx); - _inc(bx); - _cmp(al, '*'); - if (flags.z()) - return /* (endofdir) */; - _cmp(al, 34); - if (!flags.z()) - goto directloop1; - monPrint(); - goto directloop1; -} - void DreamGenContext::read() { STACK_CHECK; cx = 40; diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 6c5bf1918b..3d98f294ce 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -465,7 +465,6 @@ public: void dreamweb(); void read(); void searchForString(); - void searchForFiles(); void getExAd(); void transferToEx(); void parser(); diff --git a/engines/dreamweb/monitor.cpp b/engines/dreamweb/monitor.cpp index 4627597ab0..f3aad7a496 100644 --- a/engines/dreamweb/monitor.cpp +++ b/engines/dreamweb/monitor.cpp @@ -514,4 +514,17 @@ void DreamGenContext::signOn() { } } +void DreamGenContext::searchForFiles() { + bx = kTextstart; + + while (true) { + al = es.byte(bx); + bx++; + if (al == '*') + return; // "endofdir" + if (al == 34) + monPrint(); + } +} + } // End of namespace DreamGen diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 2ed08f92c9..7301ba9158 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -143,5 +143,6 @@ void outOfOpen(); void swapWithOpen(); void swapWithInv(); + void searchForFiles(); #endif -- cgit v1.2.3 From 9751d6ded4067f6de5b70aa61d4391b64be9e04c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 26 Dec 2011 07:21:48 +0100 Subject: TSAGE: R2R - Scene 3700: Fix a couple of bugs Thanks to Fingolfin for pointing those out --- engines/tsage/ringworld2/ringworld2_scenes3.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines') diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp index e3d2869634..adcd86e391 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp @@ -1862,7 +1862,7 @@ void Scene3400::signal() { _actor4.setStrip(1); _sceneMode = 3403; if (R2_GLOBALS._player._characterIndex == 2) - setAction(&_sequenceManager, this, 3403, R2_GLOBALS._player, &_actor3, &_actor7, NULL); + setAction(&_sequenceManager, this, 3403, &R2_GLOBALS._player, &_actor3, &_actor7, NULL); else setAction(&_sequenceManager, this, 3403, &_actor1, &_actor3, &_actor7, NULL); break; @@ -1871,7 +1871,7 @@ void Scene3400::signal() { _actor4.setStrip(1); _sceneMode = 3405; if (R2_GLOBALS._player._characterIndex == 3) - setAction(&_sequenceManager, this, 3405, R2_GLOBALS._player, &_actor7, NULL); + setAction(&_sequenceManager, this, 3405, &R2_GLOBALS._player, &_actor7, NULL); else setAction(&_sequenceManager, this, 3405, &_actor2, &_actor7, NULL); break; -- cgit v1.2.3 From 1b11f48a35b299633ad336fa6d9dcb723d16a92f Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 26 Dec 2011 13:18:09 +0200 Subject: DREAMWEB: Cleanup identifyOb() --- engines/dreamweb/object.cpp | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index 9d5ea15fa3..10138acb78 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -343,25 +343,20 @@ void DreamGenContext::identifyOb() { return; } - ax = data.word(kMousex) - data.word(kMapadx); - bx = data.word(kMousey) - data.word(kMapady); + uint16 initialX = data.word(kMousex) - data.word(kMapadx); + uint16 initialY = data.word(kMousey) - data.word(kMapady); - if (ax >= 22 * 8 || bx >= 20 * 8) { + if (initialX >= 22 * 8 || initialY >= 20 * 8) { blank(); return; } + byte x = initialX & 0xFF; + byte y = initialY & 0xFF; + data.byte(kInmaparea) = 1; - ah = bl; - push(ax); - data.byte(kPointerspath) = findPathOfPoint(al, ah); - ax = pop(); - push(ax); - data.byte(kPointerfirstpath) = findFirstPath(al, ah); - ax = pop(); - - byte x = al; - byte y = ah; + data.byte(kPointerspath) = findPathOfPoint(x, y); + data.byte(kPointerfirstpath) = findFirstPath(x, y); if (checkIfEx(x, y) || checkIfFree(x, y) || checkIfPerson(x, y) || checkIfSet(x, y)) -- cgit v1.2.3 From 2ca00bc3c6c2817090372450dbdd835677d3c20e Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 26 Dec 2011 13:33:37 +0200 Subject: DREAMWEB: Cleanup searchForFiles() --- engines/dreamweb/monitor.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/monitor.cpp b/engines/dreamweb/monitor.cpp index f3aad7a496..81c0f7e168 100644 --- a/engines/dreamweb/monitor.cpp +++ b/engines/dreamweb/monitor.cpp @@ -515,14 +515,15 @@ void DreamGenContext::signOn() { } void DreamGenContext::searchForFiles() { - bx = kTextstart; + uint16 offset = kTextstart; + byte curChar; while (true) { - al = es.byte(bx); - bx++; - if (al == '*') + curChar = es.byte(offset); + offset++; + if (curChar == '*') return; // "endofdir" - if (al == 34) + if (curChar == 34) monPrint(); } } -- cgit v1.2.3 From d7335d69e351e910f33dbcc3b80a9a5d52bfd4e1 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 26 Dec 2011 13:59:20 +0200 Subject: DREAMWEB: Move the roomsCanGo array out of the data blob --- engines/dreamweb/dreambase.h | 2 ++ engines/dreamweb/dreamgen.cpp | 8 +++----- engines/dreamweb/dreamgen.h | 13 ++++++------- engines/dreamweb/newplace.cpp | 14 +++++++++----- engines/dreamweb/saveload.cpp | 4 ++-- engines/dreamweb/stubs.cpp | 2 +- 6 files changed, 23 insertions(+), 20 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index cbcfa1e46f..5ac720be89 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -98,6 +98,7 @@ protected: uint8 _underTimedText[kUnderTimedTextBufSize]; Common::List _rainList; uint8 _initialVars[kLengthOfVars]; // TODO: This shouldn't be necessary + uint8 _roomsCanGo[16]; public: DreamBase(DreamWeb::DreamWebEngine *en); @@ -177,6 +178,7 @@ public: void showArrows(); uint8 getLocation(uint8 index); void setLocation(uint8 index); + void clearLocation(uint8 index); void resetLocation(uint8 index); void readCityPic(); void readDestIcon(); diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 66885d7623..2d58aea6c5 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -608,7 +608,7 @@ void DreamGenContext::parser() { al = '='; _stosb(); ds = cs; - si = 556; + si = 540; notspace1: _lodsw(); _cmp(al, 32); @@ -704,7 +704,7 @@ void DreamGenContext::__start() { //0x01f0: .... .... .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, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0210: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0220: .... .... .... .... @@ -720,10 +720,8 @@ void DreamGenContext::__start() { //0x0270: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0280: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x0290: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, - //0x02a0: .... .... .... .... + //0x0290: .... .... .... .... 0xff, 0xff, 0x00, 0x00, 0x00, }; ds.assign(src, src + sizeof(src)); dreamweb(); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 3d98f294ce..3da65cf189 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -345,13 +345,12 @@ 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 kOplist = 553; -static const uint16 kInputline = 556; -static const uint16 kPresslist = 684; -static const uint16 kQuitrequested = 690; -static const uint16 kSubtitles = 691; -static const uint16 kForeignrelease = 692; +static const uint16 kOplist = 537; +static const uint16 kInputline = 540; +static const uint16 kPresslist = 668; +static const uint16 kQuitrequested = 674; +static const uint16 kSubtitles = 675; +static const uint16 kForeignrelease = 676; static const uint16 kBlocktextdat = (0); static const uint16 kPersonframes = (0); static const uint16 kDebuglevel1 = (0); diff --git a/engines/dreamweb/newplace.cpp b/engines/dreamweb/newplace.cpp index 03824aa706..efcffef82a 100644 --- a/engines/dreamweb/newplace.cpp +++ b/engines/dreamweb/newplace.cpp @@ -177,7 +177,7 @@ void DreamBase::nextDest() { data.byte(kDestpos)++; if (data.byte(kDestpos) == 15) data.byte(kDestpos) = 0; // last destination - } while (!data.byte(kRoomscango + data.byte(kDestpos))); + } while (!getLocation(data.byte(kDestpos))); data.byte(kNewtextline) = 1; delTextLine(); @@ -206,7 +206,7 @@ void DreamBase::lastDest() { data.byte(kDestpos)--; if (data.byte(kDestpos) == 0xFF) data.byte(kDestpos) = 15; // first destination - } while (!data.byte(kRoomscango + data.byte(kDestpos))); + } while (!getLocation(data.byte(kDestpos))); data.byte(kNewtextline) = 1; delTextLine(); @@ -235,11 +235,15 @@ void DreamBase::destSelect() { } uint8 DreamBase::getLocation(uint8 index) { - return data.byte(kRoomscango + index); + return _roomsCanGo[index]; } void DreamBase::setLocation(uint8 index) { - data.byte(kRoomscango + index) = 1; + _roomsCanGo[index] = 1; +} + +void DreamBase::clearLocation(uint8 index) { + _roomsCanGo[index] = 0; } void DreamBase::resetLocation(uint8 index) { @@ -264,7 +268,7 @@ void DreamBase::resetLocation(uint8 index) { purgeALocation(29); } - data.byte(kRoomscango + index) = 0; + clearLocation(index); } void DreamBase::readDestIcon() { diff --git a/engines/dreamweb/saveload.cpp b/engines/dreamweb/saveload.cpp index 2076a349b5..4fa8cf33fe 100644 --- a/engines/dreamweb/saveload.cpp +++ b/engines/dreamweb/saveload.cpp @@ -483,7 +483,7 @@ void DreamBase::savePosition(unsigned int slot, const char *descbuf) { // len[4] == 48, which is sizeof(Room) plus 16 for 'Roomscango' outSaveFile->write((const uint8 *)&madeUpRoom, sizeof(Room)); - outSaveFile->write(data.ptr(kRoomscango, 16), 16); + outSaveFile->write(_roomsCanGo, 16); // TODO: Convert more to serializer? Common::Serializer s(0, outSaveFile); @@ -551,7 +551,7 @@ void DreamBase::loadPosition(unsigned int slot) { // Note: the values read into g_madeUpRoomDat are only used in actualLoad, // which is (almost) immediately called after this function inSaveFile->read((uint8 *)&g_madeUpRoomDat, sizeof(Room)); - inSaveFile->read(data.ptr(kRoomscango, 16), 16); + inSaveFile->read(_roomsCanGo, 16); // TODO: Use serializer for more Common::Serializer s(inSaveFile, 0); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 413bd27c85..827fb2ee22 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -3618,7 +3618,7 @@ void DreamBase::clearChanges() { const uint8 initialRoomsCanGo[] = { 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - memcpy(data.ptr(kRoomscango, 16), initialRoomsCanGo, 16); + memcpy(_roomsCanGo, initialRoomsCanGo, 16); } void DreamBase::showDiaryKeys() { -- cgit v1.2.3 From 2db59ab3111746df973641bf960b68765671ff22 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Mon, 26 Dec 2011 12:58:19 +0100 Subject: DREAMWEB: Move even more use-related functions to DreamBase --- engines/dreamweb/dreambase.h | 9 ++++++++- engines/dreamweb/stubs.cpp | 10 +++++----- engines/dreamweb/stubs.h | 5 ----- engines/dreamweb/use.cpp | 2 +- 4 files changed, 14 insertions(+), 12 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 5ac720be89..c96604a263 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -61,6 +61,9 @@ class DreamBase : public SegmentManager { protected: DreamWeb::DreamWebEngine *engine; + // from newplace.cpp + uint8 _roomsCanGo[16]; + // from object.cpp uint16 _openChangeSize; @@ -98,7 +101,6 @@ protected: uint8 _underTimedText[kUnderTimedTextBufSize]; Common::List _rainList; uint8 _initialVars[kLengthOfVars]; // TODO: This shouldn't be necessary - uint8 _roomsCanGo[16]; public: DreamBase(DreamWeb::DreamWebEngine *en); @@ -556,6 +558,11 @@ public: bool finishedWalking(); void emergencyPurge(); void purgeAnItem(); + uint8 nextSymbol(uint8 symbol); + void enterSymbol(); + void showSymbol(); + void updateSymbolTop(); + void updateSymbolBot(); // from talk.cpp void talk(); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 827fb2ee22..8535b17e2f 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -1813,7 +1813,7 @@ uint8 DreamBase::findNextColon(const uint8 **string) { return c; } -void DreamGenContext::enterSymbol() { +void DreamBase::enterSymbol() { data.byte(kManisoffscreen) = 1; getRidOfReels(); loadIntoTemp("DREAMWEB.G12"); // symbol graphics @@ -2611,7 +2611,7 @@ void DreamBase::atmospheres() { cancelCh0(); } -uint8 DreamGenContext::nextSymbol(uint8 symbol) { +uint8 DreamBase::nextSymbol(uint8 symbol) { uint8 result = symbol + 1; if (result == 6) return 0; @@ -2620,7 +2620,7 @@ uint8 DreamGenContext::nextSymbol(uint8 symbol) { return result; } -void DreamGenContext::showSymbol() { +void DreamBase::showSymbol() { showFrame(tempGraphics(), kSymbolx, kSymboly, 12, 0); showFrame(tempGraphics(), data.byte(kSymboltopx) + kSymbolx-44, kSymboly+20, data.byte(kSymboltopnum), 32); @@ -3451,7 +3451,7 @@ void DreamBase::entryAnims() { } } -void DreamGenContext::updateSymbolTop() { +void DreamBase::updateSymbolTop() { if (!data.byte(kSymboltopdir)) return; // topfinished @@ -3488,7 +3488,7 @@ void DreamGenContext::updateSymbolTop() { } } -void DreamGenContext::updateSymbolBot() { +void DreamBase::updateSymbolBot() { if (!data.byte(kSymbolbotdir)) return; // botfinished diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 7301ba9158..a03dbc2fb6 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -98,12 +98,9 @@ void look(); void autoLook(); void doLook(); - void enterSymbol(); void useKey(); void useObject(); void singleKey(uint8 key, uint16 x, uint16 y); - uint8 nextSymbol(uint8 symbol); - void showSymbol(); void inventory(); void mainScreen(); void zoomOnOff(); @@ -120,8 +117,6 @@ void showGun(); void triggerMessage(uint16 index); void processTrigger(); - void updateSymbolTop(); - void updateSymbolBot(); bool execCommand(); void getOpenedSize(); byte getOpenedSlotSize(); diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp index 8aa735d84f..24ea58e252 100644 --- a/engines/dreamweb/use.cpp +++ b/engines/dreamweb/use.cpp @@ -99,7 +99,7 @@ void DreamGenContext::useRoutine() { { &DreamBase::viewFolder, "PAPR" }, { &DreamBase::useTrainer, "UWTA" }, { &DreamBase::useTrainer, "UWTB" }, - { &DreamGenContext::enterSymbol, "STAT" }, + { &DreamBase::enterSymbol, "STAT" }, { &DreamBase::openTomb, "TLID" }, { &DreamBase::useSlab, "SLAB" }, { &DreamBase::useCart, "CART" }, -- cgit v1.2.3 From 047a9dc19daa27b88aa105bd9d30e5cd1cd161c1 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 26 Dec 2011 14:34:36 +0200 Subject: DREAMWEB: Fix regression in loadRoomsSample() --- engines/dreamweb/sound.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'engines') diff --git a/engines/dreamweb/sound.cpp b/engines/dreamweb/sound.cpp index 4683f333c9..247935b8f8 100644 --- a/engines/dreamweb/sound.cpp +++ b/engines/dreamweb/sound.cpp @@ -104,6 +104,7 @@ void DreamBase::loadRoomsSample() { assert(sample < 100); Common::String sampleName = Common::String::format("DREAMWEB.V%02d", sample); + data.byte(kCurrentsample) = sample; uint8 ch0 = data.byte(kCh0playing); if (ch0 >= 12 && ch0 != 255) -- cgit v1.2.3 From e311f678b989c2cf3eee03bb98c7c8deed46bddc Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 26 Dec 2011 15:03:36 +0200 Subject: DREAMWEB: Move pressList out of the data blob, and remove loads of unused global variables from the data blob --- engines/dreamweb/dreambase.h | 3 + engines/dreamweb/dreamgen.cpp | 60 +++---- engines/dreamweb/dreamgen.h | 387 ++++++++++++++++++++---------------------- engines/dreamweb/keypad.cpp | 6 +- 4 files changed, 215 insertions(+), 241 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index c96604a263..ab0843663a 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -61,6 +61,9 @@ class DreamBase : public SegmentManager { protected: DreamWeb::DreamWebEngine *engine; + // from keypad.cpp + uint8 _pressList[6]; + // from newplace.cpp uint8 _roomsCanGo[16]; diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 2d58aea6c5..66438cfd04 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -367,7 +367,7 @@ dirroot: si = offset_rootdir; _inc(si); es = cs; - di = 462; + di = 436; _inc(di); cx = 12; _movsb(cx, true); @@ -396,7 +396,7 @@ void DreamGenContext::read() { return; okcom: es = cs; - di = 462; + di = 436; ax = data.word(kTextfile1); data.word(kMonsource) = ax; ds = ax; @@ -526,7 +526,7 @@ keyok2: ds = cs; si = offset_operand1+1; es = cs; - di = 462+1; + di = 436+1; cx = 12; _movsb(cx, true); monitorLogo(); @@ -608,7 +608,7 @@ void DreamGenContext::parser() { al = '='; _stosb(); ds = cs; - si = 540; + si = 511; notspace1: _lodsw(); _cmp(al, 32); @@ -658,12 +658,12 @@ 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, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00a0: .... .... .... .... 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, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + //0x00c0: .... .. .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00d0: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -678,30 +678,30 @@ void DreamGenContext::__start() { //0x0120: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //0x0140: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, - //0x0150: .... .... .... .... 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + //0x0150: .... .... .... .... + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x17, 0x00, 0x00, //0x0160: .... .... .... .... - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0170: .... .... .... .... - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x0180: .... .... .... .... - 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, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, + //0x0180: .... .... ...D REAM + 0x57, 0x45, 0x42, 0x2e, 0x56, 0x39, 0x39, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + //0x0190: WEB. V99. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x22, 0x52, 0x4f, 0x4f, 0x54, 0x20, 0x20, 0x20, 0x20, 0x20, + //0x01a0: ."R OOT + 0x20, 0x20, 0x20, 0x00, 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + //0x01b0: . " + 0x20, 0x00, 0x0d, 0x0a, 0x0d, 0x0a, 0x24, 0x10, 0x12, 0x12, 0x11, 0x10, 0x10, 0x10, 0x01, 0x01, + //0x01c0: ... ..$. .... .... + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x44, + //0x01d0: .... .... .... ...D + 0x3a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + //0x01e0: :... .... .... .... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + //0x01f0: .... .... .... .... 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -718,11 +718,7 @@ void DreamGenContext::__start() { //0x0260: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0270: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x0280: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, - //0x0290: .... .... .... .... - 0xff, 0xff, 0x00, 0x00, 0x00, }; + 0x00, 0x00, }; ds.assign(src, src + sizeof(src)); dreamweb(); } diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 3da65cf189..a292384826 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -32,8 +32,8 @@ namespace DreamGen { -static const uint16 offset_operand1 = 0x01b2; -static const uint16 offset_rootdir = 0x01c0; +static const uint16 offset_rootdir = 0x01a6; +static const uint16 offset_operand1 = 0x0198; static const uint16 kStartvars = 0; static const uint16 kProgresspoints = 1; static const uint16 kWatchon = 2; @@ -147,210 +147,185 @@ static const uint16 kArrowad = 139; static const uint16 kCurrentkey = 141; static const uint16 kOldkey = 142; static const uint16 kUseddirection = 143; -static const uint16 kCurrentkey2 = 144; -static const uint16 kTimercount = 145; -static const uint16 kOldtimercount = 146; -static const uint16 kMapx = 147; -static const uint16 kMapy = 148; -static const uint16 kNewscreen = 149; -static const uint16 kRyanx = 150; -static const uint16 kRyany = 151; -static const uint16 kLastflag = 152; -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 kOplist = 537; -static const uint16 kInputline = 540; -static const uint16 kPresslist = 668; -static const uint16 kQuitrequested = 674; -static const uint16 kSubtitles = 675; -static const uint16 kForeignrelease = 676; +static const uint16 kTimercount = 144; +static const uint16 kOldtimercount = 145; +static const uint16 kMapx = 146; +static const uint16 kMapy = 147; +static const uint16 kNewscreen = 148; +static const uint16 kRyanx = 149; +static const uint16 kRyany = 150; +static const uint16 kLastflag = 151; +static const uint16 kOffsetx = 152; +static const uint16 kOffsety = 154; +static const uint16 kCurrentob = 156; +static const uint16 kDestpos = 157; +static const uint16 kReallocation = 158; +static const uint16 kRoomnum = 159; +static const uint16 kNowinnewroom = 160; +static const uint16 kResetmanxy = 161; +static const uint16 kNewlocation = 162; +static const uint16 kAutolocation = 163; +static const uint16 kDoorcheck1 = 164; +static const uint16 kDoorcheck2 = 165; +static const uint16 kDoorcheck3 = 166; +static const uint16 kDoorcheck4 = 167; +static const uint16 kMousex = 168; +static const uint16 kMousey = 170; +static const uint16 kMousebutton = 172; +static const uint16 kMousebutton1 = 174; +static const uint16 kMousebutton2 = 176; +static const uint16 kMousebutton3 = 178; +static const uint16 kMousebutton4 = 180; +static const uint16 kOldbutton = 182; +static const uint16 kOldx = 184; +static const uint16 kOldy = 186; +static const uint16 kLastbutton = 188; +static const uint16 kOldpointerx = 190; +static const uint16 kOldpointery = 192; +static const uint16 kDelherex = 194; +static const uint16 kDelherey = 196; +static const uint16 kPointerxs = 198; +static const uint16 kPointerys = 199; +static const uint16 kDelxs = 200; +static const uint16 kDelys = 201; +static const uint16 kPointerframe = 202; +static const uint16 kPointerpower = 203; +static const uint16 kAuxpointerframe = 204; +static const uint16 kPointermode = 205; +static const uint16 kPointerspeed = 206; +static const uint16 kPointercount = 207; +static const uint16 kInmaparea = 208; +static const uint16 kTalkmode = 209; +static const uint16 kTalkpos = 210; +static const uint16 kCharacter = 211; +static const uint16 kWatchdump = 212; +static const uint16 kLogonum = 213; +static const uint16 kOldlogonum = 214; +static const uint16 kNetseg = 215; +static const uint16 kNetpoint = 217; +static const uint16 kCursorstate = 219; +static const uint16 kPressed = 220; +static const uint16 kPresspointer = 221; +static const uint16 kGraphicpress = 223; +static const uint16 kPresscount = 224; +static const uint16 kLightcount = 225; +static const uint16 kFolderpage = 226; +static const uint16 kDiarypage = 227; +static const uint16 kMenucount = 228; +static const uint16 kSymboltopx = 229; +static const uint16 kSymboltopnum = 230; +static const uint16 kSymboltopdir = 231; +static const uint16 kSymbolbotx = 232; +static const uint16 kSymbolbotnum = 233; +static const uint16 kSymbolbotdir = 234; +static const uint16 kSymboltolight = 235; +static const uint16 kSymbol1 = 236; +static const uint16 kSymbol2 = 237; +static const uint16 kSymbol3 = 238; +static const uint16 kSymbolnum = 239; +static const uint16 kDumpx = 240; +static const uint16 kDumpy = 242; +static const uint16 kWalkandexam = 244; +static const uint16 kWalkexamtype = 245; +static const uint16 kWalkexamnum = 246; +static const uint16 kCurslocx = 247; +static const uint16 kCurslocy = 249; +static const uint16 kCurpos = 251; +static const uint16 kMonadx = 253; +static const uint16 kMonady = 255; +static const uint16 kMonsource = 257; +static const uint16 kNumtodo = 259; +static const uint16 kTimecount = 261; +static const uint16 kCounttotimed = 263; +static const uint16 kTimedseg = 265; +static const uint16 kTimedoffset = 267; +static const uint16 kTimedy = 269; +static const uint16 kTimedx = 270; +static const uint16 kNeedtodumptimed = 271; +static const uint16 kLoadingorsave = 272; +static const uint16 kCurrentslot = 273; +static const uint16 kCursorpos = 274; +static const uint16 kColourpos = 275; +static const uint16 kFadedirection = 276; +static const uint16 kNumtofade = 277; +static const uint16 kFadecount = 278; +static const uint16 kAddtogreen = 279; +static const uint16 kAddtored = 280; +static const uint16 kAddtoblue = 281; +static const uint16 kLastsoundreel = 282; +static const uint16 kSpeechloaded = 284; +static const uint16 kSpeechlength = 285; +static const uint16 kVolume = 287; +static const uint16 kVolumeto = 288; +static const uint16 kVolumedirection = 289; +static const uint16 kVolumecount = 290; +static const uint16 kWongame = 291; +static const uint16 kLasthardkey = 292; +static const uint16 kBufferin = 293; +static const uint16 kBufferout = 295; +static const uint16 kExtras = 297; +static const uint16 kWorkspace = 299; +static const uint16 kMapstore = 301; +static const uint16 kCharset1 = 303; +static const uint16 kBuffers = 305; +static const uint16 kMainsprites = 307; +static const uint16 kBackdrop = 309; +static const uint16 kMapdata = 311; +static const uint16 kSounddata = 313; +static const uint16 kSounddata2 = 315; +static const uint16 kRecordspace = 317; +static const uint16 kFreedat = 319; +static const uint16 kSetdat = 321; +static const uint16 kReel1 = 323; +static const uint16 kReel2 = 325; +static const uint16 kReel3 = 327; +static const uint16 kRoomdesc = 329; +static const uint16 kFreedesc = 331; +static const uint16 kSetdesc = 333; +static const uint16 kBlockdesc = 335; +static const uint16 kSetframes = 337; +static const uint16 kFreeframes = 339; +static const uint16 kPeople = 341; +static const uint16 kReels = 343; +static const uint16 kCommandtext = 345; +static const uint16 kPuzzletext = 347; +static const uint16 kTraveltext = 349; +static const uint16 kTempgraphics = 351; +static const uint16 kTempgraphics2 = 353; +static const uint16 kTempgraphics3 = 355; +static const uint16 kTempsprites = 357; +static const uint16 kTextfile1 = 359; +static const uint16 kTextfile2 = 361; +static const uint16 kTextfile3 = 363; +static const uint16 kBlinkframe = 365; +static const uint16 kBlinkcount = 366; +static const uint16 kReasseschanges = 367; +static const uint16 kPointerspath = 368; +static const uint16 kManspath = 369; +static const uint16 kPointerfirstpath = 370; +static const uint16 kFinaldest = 371; +static const uint16 kDestination = 372; +static const uint16 kLinestartx = 373; +static const uint16 kLinestarty = 375; +static const uint16 kLineendx = 377; +static const uint16 kLineendy = 379; +static const uint16 kLinepointer = 381; +static const uint16 kLinedirection = 382; +static const uint16 kLinelength = 383; +static const uint16 kCh0blockstocopy = 384; +static const uint16 kCh0playing = 386; +static const uint16 kCh0repeat = 387; +static const uint16 kCh1playing = 388; +static const uint16 kCh1blockstocopy = 389; +static const uint16 kSoundbufferwrite = 391; +static const uint16 kCurrentsample = 393; +static const uint16 kRoomssample = 394; +static const uint16 kBasicsample = 395; +static const uint16 kCurrentfile = 436; +static const uint16 kInputline = 511; +static const uint16 kQuitrequested = 639; +static const uint16 kSubtitles = 640; +static const uint16 kForeignrelease = 641; static const uint16 kBlocktextdat = (0); static const uint16 kPersonframes = (0); static const uint16 kDebuglevel1 = (0); diff --git a/engines/dreamweb/keypad.cpp b/engines/dreamweb/keypad.cpp index 878fbda5bf..b165c00394 100644 --- a/engines/dreamweb/keypad.cpp +++ b/engines/dreamweb/keypad.cpp @@ -77,8 +77,8 @@ void DreamBase::showKeypad() { bool DreamBase::isItRight(uint8 digit0, uint8 digit1, uint8 digit2, uint8 digit3) { - return digit0 == data.byte(kPresslist+0) && digit1 == data.byte(kPresslist+1) - && digit2 == data.byte(kPresslist+2) && digit3 == data.byte(kPresslist+3); + return digit0 == _pressList[0] && digit1 == _pressList[1] + && digit2 == _pressList[2] && digit3 == _pressList[3]; } void DreamBase::addToPressList() { @@ -88,7 +88,7 @@ void DreamBase::addToPressList() { if (pressed == 10) pressed = 0; - data.byte(kPresslist + data.word(kPresspointer)) = pressed; + _pressList[data.word(kPresspointer)] = pressed; ++data.word(kPresspointer); } -- cgit v1.2.3 From 63ba3988fff08911d2fecbf4808f5514e2fd420f Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 26 Dec 2011 16:10:28 +0200 Subject: DREAMWEB: Port 'transfertoex' to C++ --- engines/dreamweb/dreamgen.cpp | 41 ----------------------------------------- engines/dreamweb/dreamgen.h | 1 - engines/dreamweb/object.cpp | 34 ++++++++++++++++++++++++++++------ engines/dreamweb/stubs.h | 1 + 4 files changed, 29 insertions(+), 48 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 66438cfd04..9582ebe5a5 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -241,47 +241,6 @@ void DreamGenContext::getSetAd() { es = data.word(kSetdat); } -void DreamGenContext::transferToEx() { - STACK_CHECK; - emergencyPurge(); - getExPos(); - al = data.byte(kExpos); - push(ax); - push(di); - al = data.byte(kItemframe); - ah = 0; - bx = 16; - _mul(bx); - ds = data.word(kFreedat); - si = ax; - cx = 8; - _movsw(cx, true); - di = pop(); - al = data.byte(kReallocation); - es.byte(di) = al; - es.byte(di+11) = al; - al = data.byte(kItemframe); - es.byte(di+1) = al; - es.byte(di+2) = 4; - es.byte(di+3) = 255; - al = data.byte(kLastinvpos); - es.byte(di+4) = al; - al = data.byte(kItemframe); - data.byte(kItemtotran) = al; - transferMap(); - transferInv(); - transferText(); - al = data.byte(kItemframe); - ah = 0; - bx = 16; - _mul(bx); - ds = data.word(kFreedat); - si = ax; - ds.byte(si+2) = 254; - pickupConts(); - ax = pop(); -} - void DreamGenContext::pickupConts() { STACK_CHECK; al = ds.byte(si+7); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index a292384826..0ecdf7210b 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -440,7 +440,6 @@ public: void read(); void searchForString(); void getExAd(); - void transferToEx(); void parser(); void transferConToEx(); }; diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index 10138acb78..daa45e67eb 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -446,8 +446,7 @@ void DreamGenContext::setPickup() { if (data.byte(kObjecttype) != kExObjectType) { data.byte(kItemframe) = data.byte(kCommand); data.byte(kOpenedob) = 255; - transferToEx(); - data.byte(kItemframe) = al; + data.byte(kItemframe) = transferToEx(); data.byte(kObjecttype) = kExObjectType; DynObject *object = getExAd(data.byte(kItemframe)); object->mapad[0] = 20; @@ -964,8 +963,7 @@ void DreamGenContext::outOfOpen() { data.byte(kItemframe) = objectId & 0xFF; if (data.byte(kObjecttype) != 4) { - transferToEx(); - data.byte(kItemframe) = al; + data.byte(kItemframe) = transferToEx(); data.byte(kObjecttype) = 4; } @@ -1021,8 +1019,7 @@ void DreamGenContext::swapWithOpen() { data.byte(kItemframe) = objectId & 0xFF; if (data.byte(kObjecttype) != 4) { - transferToEx(); - data.byte(kItemframe) = al; + data.byte(kItemframe) = transferToEx(); data.byte(kObjecttype) = 4; } @@ -1059,4 +1056,29 @@ uint16 DreamBase::findOpenPos() { return pos * 2 + kOpeninvlist; // return the object position in the inventory data } +byte DreamGenContext::transferToEx() { + emergencyPurge(); + getExPos(); + byte pos = data.byte(kExpos); + DynObject *exObject = getExAd(pos); + DynObject *freeObject = getFreeAd(data.byte(kItemframe)); + memcpy(exObject, freeObject, sizeof(DynObject)); + exObject->currentLocation = data.byte(kReallocation); + exObject->initialLocation = data.byte(kReallocation); + exObject->index = data.byte(kItemframe); + exObject->mapad[0] = 4; + exObject->mapad[1] = 255; + exObject->mapad[2] = data.byte(kLastinvpos); + data.byte(kItemtotran) = data.byte(kItemframe); + transferMap(); + transferInv(); + transferText(); + freeObject = getFreeAd(data.byte(kItemframe)); + freeObject->mapad[0] = 254; + ds = data.word(kFreedat); + si = data.byte(kItemframe); + pickupConts(); + return pos; +} + } // End of namespace DreamGen diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index a03dbc2fb6..9bbf3b3c40 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -139,5 +139,6 @@ void swapWithOpen(); void swapWithInv(); void searchForFiles(); + byte transferToEx(); #endif -- cgit v1.2.3 From 95cabb0ffd43e6bdd2c600c5baa459cab89f068d Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 24 Dec 2011 21:09:46 +0100 Subject: SCUMM: Add a difficulty selection dialog for Loom FM-Towns. It is in spirit of the DOS version's selection dialog, but it has the description above the buttons instead of below it. --- engines/scumm/dialogs.cpp | 34 ++++++++++++++++++++++++++++++++++ engines/scumm/dialogs.h | 21 +++++++++++++++++++++ engines/scumm/scumm.cpp | 10 ++++++++++ 3 files changed, 65 insertions(+) (limited to 'engines') diff --git a/engines/scumm/dialogs.cpp b/engines/scumm/dialogs.cpp index 20aedae089..0e531daf73 100644 --- a/engines/scumm/dialogs.cpp +++ b/engines/scumm/dialogs.cpp @@ -648,4 +648,38 @@ void DebugInputDialog::handleKeyDown(Common::KeyState state) { } } +LoomTownsDifficultyDialog::LoomTownsDifficultyDialog() + : Dialog("LoomTownsDifficultyDialog"), _difficulty(-1) { + GUI::StaticTextWidget *text1 = new GUI::StaticTextWidget(this, "LoomTownsDifficultyDialog.Description1", _("Select a Proficiency Level.")); + text1->setAlign(Graphics::kTextAlignCenter); + GUI::StaticTextWidget *text2 = new GUI::StaticTextWidget(this, "LoomTownsDifficultyDialog.Description2", _("Refer to your Loom(TM) manual for help.")); + text2->setAlign(Graphics::kTextAlignCenter); + + new GUI::ButtonWidget(this, "LoomTownsDifficultyDialog.Standard", _("Standard"), 0, kStandardCmd); + new GUI::ButtonWidget(this, "LoomTownsDifficultyDialog.Practice", _("Practice"), 0, kPracticeCmd); + new GUI::ButtonWidget(this, "LoomTownsDifficultyDialog.Expert", _("Expert"), 0, kExpertCmd); +} + +void LoomTownsDifficultyDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) { + switch (cmd) { + case kStandardCmd: + _difficulty = 1; + close(); + break; + + case kPracticeCmd: + _difficulty = 0; + close(); + break; + + case kExpertCmd: + _difficulty = 2; + close(); + break; + + default: + GUI::Dialog::handleCommand(sender, cmd, data); + } +} + } // End of namespace Scumm diff --git a/engines/scumm/dialogs.h b/engines/scumm/dialogs.h index c26aa9f414..7977f123ed 100644 --- a/engines/scumm/dialogs.h +++ b/engines/scumm/dialogs.h @@ -187,6 +187,27 @@ public: Common::String mainText; }; +/** + * Difficulty selection dialog for Loom FM-Towns. + */ +class LoomTownsDifficultyDialog : public GUI::Dialog { +public: + LoomTownsDifficultyDialog(); + + int getSelectedDifficulty() const { return _difficulty; } +protected: + virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data); + +private: + enum { + kStandardCmd = 'STDD', + kPracticeCmd = 'PRAD', + kExpertCmd = 'EXPD' + }; + + int _difficulty; +}; + } // End of namespace Scumm #endif diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 9a093891d2..d3cc218cd3 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -1256,6 +1256,16 @@ void ScummEngine::setupScumm() { // Load game from specified slot, if any if (ConfMan.hasKey("save_slot")) { requestLoad(ConfMan.getInt("save_slot")); + } else if (!ConfMan.hasKey("boot_param") && _game.id == GID_LOOM && _game.platform == Common::kPlatformFMTowns) { + // In case we run the Loom FM-Towns version and have no boot parameter + // nor start save game supplied we will show our own custom difficulty + // selection dialog, since the original does not have any. + LoomTownsDifficultyDialog difficultyDialog; + runDialog(difficultyDialog); + + int difficulty = difficultyDialog.getSelectedDifficulty(); + if (difficulty != -1) + _bootParam = difficulty; } _res->allocResTypeData(rtBuffer, 0, 10, kDynamicResTypeMode); -- cgit v1.2.3 From 1fef9d1f75948b3d6f10c221ce8289b44b288a7d Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Mon, 26 Dec 2011 15:23:15 +0100 Subject: DREAMWEB: Convert findAllOpen, fillOpen --- engines/dreamweb/dreambase.h | 5 ++ engines/dreamweb/dreamgen.cpp | 117 ------------------------------------------ engines/dreamweb/dreamgen.h | 2 - engines/dreamweb/object.cpp | 59 +++++++++++++++++++-- engines/dreamweb/stubs.h | 3 -- 5 files changed, 59 insertions(+), 127 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index ab0843663a..3f667e8757 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -212,6 +212,11 @@ public: void makeWorn(DynObject *object); void dropObject(); uint16 findOpenPos(); + byte getOpenedSlotSize(); + byte getOpenedSlotCount(); + void openOb(); + void findAllOpen(); + void fillOpen(); // from pathfind.cpp void turnPathOn(uint8 param); diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 9582ebe5a5..282fab2db2 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -73,123 +73,6 @@ void DreamGenContext::transferMap() { _add(data.word(kExframepos), cx); } -void DreamGenContext::fillOpen() { - STACK_CHECK; - delTextLine(); - getOpenedSize(); - _cmp(ah, 4); - if (flags.c()) - goto lessthanapage; - ah = 4; -lessthanapage: - al = 1; - push(ax); - es = data.word(kBuffers); - di = (0+(228*13)); - findAllOpen(); - si = (0+(228*13)); - di = (80); - bx = (58)+96; - cx = pop(); -openloop1: - push(cx); - push(di); - push(bx); - ax = es.word(si); - _add(si, 2); - push(si); - push(es); - _cmp(ch, cl); - if (flags.c()) - goto nextopenslot; - obToInv(); -nextopenslot: - es = pop(); - si = pop(); - bx = pop(); - di = pop(); - cx = pop(); - _add(di, (44)); - _inc(cl); - _cmp(cl, 5); - if (!flags.z()) - goto openloop1; - underTextLine(); -} - -void DreamGenContext::findAllOpen() { - STACK_CHECK; - push(di); - cx = 16; - ax = 0x0ffff; - _stosw(cx, true); - di = pop(); - cl = data.byte(kOpenedob); - dl = data.byte(kOpenedtype); - ds = data.word(kExtras); - bx = (0+2080+30000); - ch = 0; -findopen1: - _cmp(ds.byte(bx+3), cl); - if (!flags.z()) - goto findopen2; - _cmp(ds.byte(bx+2), dl); - if (!flags.z()) - goto findopen2; - _cmp(data.byte(kOpenedtype), 4); - if (flags.z()) - goto noloccheck; - al = ds.byte(bx+5); - _cmp(al, data.byte(kReallocation)); - if (!flags.z()) - goto findopen2; -noloccheck: - al = ds.byte(bx+4); - ah = 0; - push(di); - _add(di, ax); - _add(di, ax); - al = ch; - ah = 4; - _stosw(); - di = pop(); -findopen2: - _add(bx, 16); - _inc(ch); - _cmp(ch, (114)); - if (!flags.z()) - goto findopen1; - cl = data.byte(kOpenedob); - dl = data.byte(kOpenedtype); - push(dx); - ds = data.word(kFreedat); - dx = pop(); - bx = 0; - ch = 0; -findopen1a: - _cmp(ds.byte(bx+3), cl); - if (!flags.z()) - goto findopen2a; - _cmp(ds.byte(bx+2), dl); - if (!flags.z()) - goto findopen2a; - al = ds.byte(bx+4); - ah = 0; - push(di); - _add(di, ax); - _add(di, ax); - al = ch; - ah = 2; - _stosw(); - di = pop(); -findopen2a: - _add(bx, 16); - _inc(ch); - _cmp(ch, 80); - if (!flags.z()) - goto findopen1a; -} - void DreamGenContext::getFreeAd() { STACK_CHECK; ah = 0; diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 0ecdf7210b..d377489da4 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -434,8 +434,6 @@ public: void pickupConts(); void transferMap(); void getSetAd(); - void findAllOpen(); - void fillOpen(); void dreamweb(); void read(); void searchForString(); diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index daa45e67eb..c8127c345e 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -277,7 +277,8 @@ void DreamBase::getBackFromOb() { } void DreamGenContext::getOpenedSize() { - //ax = getOpenedSlotCount(); + //ah = getOpenedSlotSize(); + //ah = getOpenedSlotCount(); // We need to call the ASM-style versions of get*Ad, as these also set // bx and es @@ -300,7 +301,7 @@ void DreamGenContext::getOpenedSize() { } } -byte DreamGenContext::getOpenedSlotCount() { +byte DreamBase::getOpenedSlotCount() { byte obj = data.byte(kOpenedob); switch (data.byte(kOpenedtype)) { case 4: @@ -312,7 +313,7 @@ byte DreamGenContext::getOpenedSlotCount() { } } -byte DreamGenContext::getOpenedSlotSize() { +byte DreamBase::getOpenedSlotSize() { byte obj = data.byte(kOpenedob); switch (data.byte(kOpenedtype)) { case 4: @@ -324,14 +325,14 @@ byte DreamGenContext::getOpenedSlotSize() { } } -void DreamGenContext::openOb() { +void DreamBase::openOb() { uint8 commandLine[64] = "OBJECT NAME ONE "; copyName(data.byte(kOpenedtype), data.byte(kOpenedob), commandLine); printMessage(kInventx, kInventy+86, 62, 240, false); - al = printDirect(commandLine, data.word(kLastxpos) + 5, kInventy+86, 220, false); + printDirect(commandLine, data.word(kLastxpos) + 5, kInventy+86, 220, false); fillOpen(); _openChangeSize = getOpenedSlotCount() * kItempicsize + kInventx; @@ -1081,4 +1082,52 @@ byte DreamGenContext::transferToEx() { return pos; } +void DreamBase::fillOpen() { + delTextLine(); + uint8 size = getOpenedSlotCount(); + if (size > 4) + size = 4; + findAllOpen(); + uint8 *openInvList = getSegment(data.word(kBuffers)).ptr(kOpeninvlist, 32); + for (uint8 i = 0; i < size; ++i) { + uint8 index = openInvList[2*i]; + uint8 type = openInvList[2*i + 1]; + obToInv(index, type, kInventx + (i-1)*kItempicsize, kInventy + 96); + } + underTextLine(); +} + +void DreamBase::findAllOpen() { + uint8 *openInvList = getSegment(data.word(kBuffers)).ptr(kOpeninvlist, 32); + + memset(openInvList, 0xFF, 32); + + const DynObject *obj; + + obj = (const DynObject *)getSegment(data.word(kExtras)).ptr(kExdata, 0); + for (uint8 i = 0; i < kNumexobjects; ++i, ++obj) { + if (obj->mapad[1] != data.byte(kOpenedob)) + continue; + if (obj->mapad[0] != data.byte(kOpenedtype)) + continue; + if (data.byte(kOpenedtype) != kExObjectType && obj->mapad[3] != data.byte(kReallocation)) + continue; + uint8 slot = obj->mapad[2]; + assert(slot < 16); + openInvList[2*slot] = i; + openInvList[2*slot + 1] = kExObjectType; + } + + obj = (const DynObject *)getSegment(data.word(kFreedat)).ptr(0, 0); + for (uint8 i = 0; i < 80; ++i, ++obj) { + if (obj->mapad[1] != data.byte(kOpenedob)) + continue; + if (obj->mapad[0] != data.byte(kOpenedtype)) + continue; + uint8 index = obj->mapad[2]; + openInvList[2*index] = i; + openInvList[2*index + 1] = kFreeObjectType; + } +} + } // End of namespace DreamGen diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 9bbf3b3c40..bd5cd9d1e5 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -119,10 +119,7 @@ void processTrigger(); bool execCommand(); void getOpenedSize(); - byte getOpenedSlotSize(); - byte getOpenedSlotCount(); bool checkObjectSizeCPP(); - void openOb(); void identifyOb(); void selectOb(); void findInvPos(); -- cgit v1.2.3 From 3b9b4cb6ba72a93359523a9b7c3c115db3d0aed2 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 26 Dec 2011 16:52:31 +0200 Subject: DREAMWEB: Fix a regression in fillOpen() and remove the now unused getOpenedSize() --- engines/dreamweb/object.cpp | 27 +-------------------------- engines/dreamweb/stubs.h | 1 - 2 files changed, 1 insertion(+), 27 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index c8127c345e..a7a7814db3 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -276,31 +276,6 @@ void DreamBase::getBackFromOb() { blank(); } -void DreamGenContext::getOpenedSize() { - //ah = getOpenedSlotSize(); - //ah = getOpenedSlotCount(); - - // We need to call the ASM-style versions of get*Ad, as these also set - // bx and es - - al = data.byte(kOpenedob); - - switch (data.byte(kOpenedtype)) { - case 4: - getExAd(); - ax = es.word(bx+7); - break; - case 2: - getFreeAd(); - ax = es.word(bx+7); - break; - default: - getSetAd(); - ax = es.word(bx+3); - break; - } -} - byte DreamBase::getOpenedSlotCount() { byte obj = data.byte(kOpenedob); switch (data.byte(kOpenedtype)) { @@ -1092,7 +1067,7 @@ void DreamBase::fillOpen() { for (uint8 i = 0; i < size; ++i) { uint8 index = openInvList[2*i]; uint8 type = openInvList[2*i + 1]; - obToInv(index, type, kInventx + (i-1)*kItempicsize, kInventy + 96); + obToInv(index, type, kInventx + i * kItempicsize, kInventy + 96); } underTextLine(); } diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index bd5cd9d1e5..9ab025fb3e 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -118,7 +118,6 @@ void triggerMessage(uint16 index); void processTrigger(); bool execCommand(); - void getOpenedSize(); bool checkObjectSizeCPP(); void identifyOb(); void selectOb(); -- cgit v1.2.3 From 8c3488a973fb93895d542c0b55548bb96101b187 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 26 Dec 2011 16:53:28 +0200 Subject: DREAMWEB: Remove the now unused ASM style versions of getanyad, getexad, getfreead and getsetad --- engines/dreamweb/dreamgen.cpp | 51 ------------------------------------------- engines/dreamweb/dreamgen.h | 4 ---- engines/dreamweb/stubs.cpp | 3 ++- engines/dreamweb/use.cpp | 5 ++--- 4 files changed, 4 insertions(+), 59 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 282fab2db2..77af051122 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -73,57 +73,6 @@ void DreamGenContext::transferMap() { _add(data.word(kExframepos), cx); } -void DreamGenContext::getFreeAd() { - STACK_CHECK; - ah = 0; - cl = 4; - _shl(ax, cl); - bx = ax; - es = data.word(kFreedat); -} - -void DreamGenContext::getExAd() { - STACK_CHECK; - ah = 0; - bx = 16; - _mul(bx); - bx = ax; - es = data.word(kExtras); - _add(bx, (0+2080+30000)); -} - -void DreamGenContext::getAnyAd() { - STACK_CHECK; - _cmp(data.byte(kObjecttype), 4); - if (flags.z()) - goto isex; - _cmp(data.byte(kObjecttype), 2); - if (flags.z()) - goto isfree; - al = data.byte(kCommand); - getSetAd(); - ax = es.word(bx+4); - return; -isfree: - al = data.byte(kCommand); - getFreeAd(); - ax = es.word(bx+7); - return; -isex: - al = data.byte(kCommand); - getExAd(); - ax = es.word(bx+7); -} - -void DreamGenContext::getSetAd() { - STACK_CHECK; - ah = 0; - bx = 64; - _mul(bx); - bx = ax; - es = data.word(kSetdat); -} - void DreamGenContext::pickupConts() { STACK_CHECK; al = ds.byte(si+7); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index d377489da4..d3bb80da1a 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -428,16 +428,12 @@ public: #include "stubs.h" // Allow hand-reversed functions to have a signature different than void f() void dirCom(); - void getAnyAd(); - void getFreeAd(); void dirFile(); void pickupConts(); void transferMap(); - void getSetAd(); void dreamweb(); void read(); void searchForString(); - void getExAd(); void parser(); void transferConToEx(); }; diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 8535b17e2f..7c4bfe8a92 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -2725,7 +2725,8 @@ void DreamGenContext::pickupOb(uint8 command, uint8 pos) { data.byte(kObjecttype) = kFreeObjectType; data.byte(kItemframe) = command; data.byte(kCommand) = command; - getAnyAd(); + //uint8 dummy; + //getAnyAd(&dummy, &dummy); // was in the original source, seems useless here transferToEx(); } diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp index 24ea58e252..25ed8d50e5 100644 --- a/engines/dreamweb/use.cpp +++ b/engines/dreamweb/use.cpp @@ -127,9 +127,8 @@ void DreamGenContext::useRoutine() { data.byte(kPointerpower) = 0; } - getAnyAd(); - // CHECKME: Do the callbacks use es:bx ? - void *obj = es.ptr(bx, 15); + uint8 dummy; + void *obj = getAnyAd(&dummy, &dummy); for (size_t i = 0; i < sizeof(kUseList)/sizeof(UseListEntry); ++i) { const UseListEntry &entry = kUseList[i]; -- cgit v1.2.3 From 77a81a80b4157acd7e8e580c2648ec3b3ef6bc64 Mon Sep 17 00:00:00 2001 From: athrxx Date: Sun, 6 Nov 2011 00:46:58 +0100 Subject: KYRA: (AdLib Driver) - implement sound effects volume (also make internal driver version more flexible) --- engines/kyra/sound.cpp | 4 +- engines/kyra/sound.h | 4 +- engines/kyra/sound_adlib.cpp | 101 ++++++++++++++++++++++--------------------- engines/kyra/sound_adlib.h | 6 +-- engines/kyra/sound_amiga.cpp | 2 +- engines/kyra/sound_intern.h | 10 ++--- engines/kyra/sound_midi.cpp | 2 +- engines/kyra/sound_towns.cpp | 6 +-- 8 files changed, 68 insertions(+), 67 deletions(-) (limited to 'engines') diff --git a/engines/kyra/sound.cpp b/engines/kyra/sound.cpp index a1af1ad6f8..9325513066 100644 --- a/engines/kyra/sound.cpp +++ b/engines/kyra/sound.cpp @@ -229,8 +229,8 @@ bool MixedSoundDriver::isPlaying() const { return _music->isPlaying() | _sfx->isPlaying(); } -void MixedSoundDriver::playSoundEffect(uint8 track) { - _sfx->playSoundEffect(track); +void MixedSoundDriver::playSoundEffect(uint8 track, uint8 volume) { + _sfx->playSoundEffect(track, volume); } void MixedSoundDriver::stopAllSoundEffects() { diff --git a/engines/kyra/sound.h b/engines/kyra/sound.h index f3de56520e..88454e4878 100644 --- a/engines/kyra/sound.h +++ b/engines/kyra/sound.h @@ -128,7 +128,7 @@ public: * * @param track sound effect id */ - virtual void playSoundEffect(uint8 track) = 0; + virtual void playSoundEffect(uint8 track, uint8 volume = 0xff) = 0; /** * Stop playback of all sfx tracks. @@ -273,7 +273,7 @@ public: virtual void haltTrack(); virtual bool isPlaying() const; - virtual void playSoundEffect(uint8 track); + virtual void playSoundEffect(uint8 track, uint8 volume = 0xff); virtual void stopAllSoundEffects(); diff --git a/engines/kyra/sound_adlib.cpp b/engines/kyra/sound_adlib.cpp index b04abea080..c31cf809ee 100644 --- a/engines/kyra/sound_adlib.cpp +++ b/engines/kyra/sound_adlib.cpp @@ -57,12 +57,12 @@ namespace Kyra { class AdLibDriver : public Audio::AudioStream { public: - AdLibDriver(Audio::Mixer *mixer, bool v2); + AdLibDriver(Audio::Mixer *mixer, int version); ~AdLibDriver(); void initDriver(); void setSoundData(uint8 *data); - void queueTrack(int track); + void queueTrack(int track, int volume); bool isChannelPlaying(int channel) const; void stopAllChannels(); int getSoundTrigger() const { return _soundTrigger; } @@ -223,7 +223,7 @@ private: } uint8 *getInstrument(int instrumentId) { - return _soundData + READ_LE_UINT16(_soundData + (_v2 ? 1000 : 500) + 2 * instrumentId); + return _soundData + READ_LE_UINT16(_soundData + ((_version == 2) ? 1000 : 500) + 2 * instrumentId); } void setupPrograms(); @@ -358,11 +358,16 @@ private: uint8 *_soundData; + struct QueueEntry { + uint8 *data; + uint8 volume; + }; + + QueueEntry _programQueue[16]; int _programStartTimeout; - uint8 *_programQueue[16]; int _programQueueStart, _programQueueEnd; - void adjustSfxData(uint8 *data); + void adjustSfxData(uint8 *data, int volume); uint8 *_sfxPointer; int _sfxPriority; int _sfxVelocity; @@ -394,13 +399,13 @@ private: uint8 _musicVolume, _sfxVolume; - bool _v2; + int _version; }; -AdLibDriver::AdLibDriver(Audio::Mixer *mixer, bool v2) { +AdLibDriver::AdLibDriver(Audio::Mixer *mixer, int version) { setupParserOpcodeTable(); - _v2 = v2; + _version = version; _mixer = mixer; @@ -467,7 +472,7 @@ void AdLibDriver::setMusicVolume(uint8 volume) { } // For now we use the music volume for both sfx and music in Kyra1. - if (!_v2) { + if (_version < 2) { _sfxVolume = volume; for (uint i = 6; i < 9; ++i) { @@ -484,8 +489,8 @@ void AdLibDriver::setMusicVolume(uint8 volume) { } void AdLibDriver::setSfxVolume(uint8 volume) { - // We only support sfx volume in v2 games. - if (!_v2) + // We only support sfx volume in version 2 games. + if (_version < 2) return; Common::StackLock lock(_mutex); @@ -525,20 +530,21 @@ void AdLibDriver::setSoundData(uint8 *data) { _soundData = data; } -void AdLibDriver::queueTrack(int track) { +void AdLibDriver::queueTrack(int track, int volume) { Common::StackLock lock(_mutex); uint8 *trackData = getProgram(track); if (!trackData) return; - if (_programQueueEnd == _programQueueStart && _programQueue[_programQueueEnd] != 0) { + if (_programQueueEnd == _programQueueStart && _programQueue[_programQueueEnd].data != 0) { warning("AdLibDriver: Program queue full, dropping track %d", track); return; } - _programQueue[_programQueueEnd++] = trackData; - _programQueueEnd &= 15; + _programQueue[_programQueueEnd].data = trackData; + _programQueue[_programQueueEnd].volume = volume; + _programQueueEnd = (_programQueueEnd + 1) & 15; } bool AdLibDriver::isChannelPlaying(int channel) const { @@ -588,13 +594,13 @@ void AdLibDriver::setupPrograms() { if (_programQueueStart == _programQueueEnd) return; - uint8 *ptr = _programQueue[_programQueueStart]; + uint8 *ptr = _programQueue[_programQueueStart].data; // Clear the queue entry - _programQueue[_programQueueStart] = 0; + _programQueue[_programQueueStart].data = 0; _programQueueStart = (_programQueueStart + 1) & 15; // Adjust data in case we hit a sound effect. - adjustSfxData(ptr); + adjustSfxData(ptr, _programQueue[_programQueueStart].volume); const int chan = *ptr++; const int priority = *ptr++; @@ -626,7 +632,7 @@ void AdLibDriver::setupPrograms() { } } -void AdLibDriver::adjustSfxData(uint8 *ptr) { +void AdLibDriver::adjustSfxData(uint8 *ptr, int volume) { // Check whether we need to reset the data of an old sfx which has been // started. if (_sfxPointer) { @@ -647,21 +653,16 @@ void AdLibDriver::adjustSfxData(uint8 *ptr) { _sfxPriority = ptr[1]; _sfxVelocity = ptr[3]; - // In the cases I've seen, the mysterious fourth byte has been - // the parameter for the update_setExtraLevel3() callback. - // - // The extra level is part of the channels "total level", which - // is a six-bit value where larger values means softer volume. - // - // So what seems to be happening here is that sounds which are - // started by this function are given a slightly lower priority - // and a slightly higher (i.e. softer) extra level 3 than they - // would have if they were started from anywhere else. Strange. - // Adjust the values. - int newVal = ((((ptr[3]) + 63) * 0xFF) >> 8) & 0xFF; - ptr[3] = -newVal + 63; - ptr[1] = ((ptr[1] * 0xFF) >> 8) & 0xFF; + if (_version >= 1) { + int newVal = ((((ptr[3]) + 63) * volume) >> 8) & 0xFF; + ptr[3] = -newVal + 63; + ptr[1] = ((ptr[1] * volume) >> 8) & 0xFF; + } else { + int newVal = ((_sfxVelocity << 2) ^ 0xff) * volume; + ptr[3] = (newVal >> 10) ^ 0x3f; + ptr[1] = newVal >> 11; + } } // A few words on opcode parsing and timing: @@ -2238,20 +2239,20 @@ const int SoundAdLibPC::_kyra1NumSoundTriggers = ARRAYSIZE(SoundAdLibPC::_kyra1S SoundAdLibPC::SoundAdLibPC(KyraEngine_v1 *vm, Audio::Mixer *mixer) : Sound(vm, mixer), _driver(0), _trackEntries(), _soundDataPtr(0) { memset(_trackEntries, 0, sizeof(_trackEntries)); - _v2 = (_vm->game() == GI_KYRA2) || (_vm->game() == GI_LOL && !_vm->gameFlags().isDemo); - _driver = new AdLibDriver(mixer, _v2); + _version = ((_vm->game() == GI_KYRA2) || (_vm->game() == GI_LOL && !_vm->gameFlags().isDemo)) ? 2 : 1; + _driver = new AdLibDriver(mixer, _version); assert(_driver); _sfxPlayingSound = -1; _soundFileLoaded.clear(); - if (_v2) { + if (_version == 1) { + _soundTriggers = _kyra1SoundTriggers; + _numSoundTriggers = _kyra1NumSoundTriggers; + } else { // TODO: Figure out if Kyra 2 uses sound triggers at all. _soundTriggers = 0; _numSoundTriggers = 0; - } else { - _soundTriggers = _kyra1SoundTriggers; - _numSoundTriggers = _kyra1NumSoundTriggers; } } @@ -2307,13 +2308,13 @@ void SoundAdLibPC::playTrack(uint8 track) { _driver->setSyncJumpMask(0x000F); else _driver->setSyncJumpMask(0); - play(track); + play(track, 0xff); } } void SoundAdLibPC::haltTrack() { - play(0); - play(0); + play(0, 0); + play(0, 0); //_vm->_system->delayMillis(3 * 60); } @@ -2321,27 +2322,27 @@ bool SoundAdLibPC::isPlaying() const { return _driver->isChannelPlaying(0); } -void SoundAdLibPC::playSoundEffect(uint8 track) { +void SoundAdLibPC::playSoundEffect(uint8 track, uint8 volume) { if (_sfxEnabled) - play(track); + play(track, volume); } -void SoundAdLibPC::play(uint8 track) { +void SoundAdLibPC::play(uint8 track, uint8 volume) { uint16 soundId = 0; - if (_v2) + if (_version == 2) soundId = READ_LE_UINT16(&_trackEntries[track<<1]); else soundId = _trackEntries[track]; - if ((soundId == 0xFFFF && _v2) || (soundId == 0xFF && !_v2) || !_soundDataPtr) + if ((soundId == 0xFFFF && _version == 2) || (soundId == 0xFF && _version < 2) || !_soundDataPtr) return; - _driver->queueTrack(soundId); + _driver->queueTrack(soundId, volume); } void SoundAdLibPC::beginFadeOut() { - play(1); + play(1, 0xff); } void SoundAdLibPC::loadSoundFile(uint file) { @@ -2377,7 +2378,7 @@ void SoundAdLibPC::internalLoadFile(Common::String file) { int soundDataSize = fileSize; uint8 *p = fileData; - if (_v2) { + if (_version == 2) { memcpy(_trackEntries, p, 500); p += 500; soundDataSize -= 500; diff --git a/engines/kyra/sound_adlib.h b/engines/kyra/sound_adlib.h index 923a4cb75f..06ec9515ff 100644 --- a/engines/kyra/sound_adlib.h +++ b/engines/kyra/sound_adlib.h @@ -76,17 +76,17 @@ public: virtual void haltTrack(); virtual bool isPlaying() const; - virtual void playSoundEffect(uint8 track); + virtual void playSoundEffect(uint8 track, uint8 volume = 0xff); virtual void beginFadeOut(); private: void internalLoadFile(Common::String file); - void play(uint8 track); + void play(uint8 track, uint8 volume); AdLibDriver *_driver; - bool _v2; + int _version; uint8 _trackEntries[500]; uint8 *_soundDataPtr; int _sfxPlayingSound; diff --git a/engines/kyra/sound_amiga.cpp b/engines/kyra/sound_amiga.cpp index dfb0aa8bf3..ec2748dd38 100644 --- a/engines/kyra/sound_amiga.cpp +++ b/engines/kyra/sound_amiga.cpp @@ -173,7 +173,7 @@ void SoundAmiga::beginFadeOut() { _driver->setVolume(0x40); } -void SoundAmiga::playSoundEffect(uint8 track) { +void SoundAmiga::playSoundEffect(uint8 track, uint8) { debugC(5, kDebugLevelSound, "SoundAmiga::playSoundEffect(%d)", track); const AmigaSfxTable *sfx = 0; bool pan = false; diff --git a/engines/kyra/sound_intern.h b/engines/kyra/sound_intern.h index be3c09de96..427bef66e2 100644 --- a/engines/kyra/sound_intern.h +++ b/engines/kyra/sound_intern.h @@ -67,7 +67,7 @@ public: void haltTrack(); bool isPlaying() const; - void playSoundEffect(uint8 track); + void playSoundEffect(uint8 track, uint8 volume = 0xff); void stopAllSoundEffects(); void beginFadeOut(); @@ -116,7 +116,7 @@ public: void playTrack(uint8 track); void haltTrack(); - void playSoundEffect(uint8); + void playSoundEffect(uint8 track, uint8 volume = 0xff); void stopAllSoundEffects(); void beginFadeOut(); @@ -166,7 +166,7 @@ public: void beginFadeOut(); int32 voicePlay(const char *file, Audio::SoundHandle *handle, uint8 volume, bool isSfx) { return -1; } - void playSoundEffect(uint8); + void playSoundEffect(uint8 track, uint8 volume = 0xff); void updateVolumeSettings(); @@ -195,7 +195,7 @@ public: void beginFadeOut(); int32 voicePlay(const char *file, Audio::SoundHandle *handle, uint8 volume, bool isSfx); - void playSoundEffect(uint8 track); + void playSoundEffect(uint8 track, uint8 volume = 0xff); void updateVolumeSettings(); @@ -304,7 +304,7 @@ public: void beginFadeOut(); int32 voicePlay(const char *file, Audio::SoundHandle *handle, uint8 volume, bool isSfx) { return -1; } - void playSoundEffect(uint8); + void playSoundEffect(uint8 track, uint8 volume = 0xff); protected: Audio::MaxTrax *_driver; diff --git a/engines/kyra/sound_midi.cpp b/engines/kyra/sound_midi.cpp index 1a5c2f94ac..0004395f6f 100644 --- a/engines/kyra/sound_midi.cpp +++ b/engines/kyra/sound_midi.cpp @@ -684,7 +684,7 @@ bool SoundMidiPC::isPlaying() const { return _music->isPlaying(); } -void SoundMidiPC::playSoundEffect(uint8 track) { +void SoundMidiPC::playSoundEffect(uint8 track, uint8) { if (!_sfxEnabled) return; diff --git a/engines/kyra/sound_towns.cpp b/engines/kyra/sound_towns.cpp index c851842f22..b77c307872 100644 --- a/engines/kyra/sound_towns.cpp +++ b/engines/kyra/sound_towns.cpp @@ -125,7 +125,7 @@ void SoundTowns::loadSoundFile(uint file) { _sfxFileData = _vm->resource()->fileData(fileListEntry(file), 0); } -void SoundTowns::playSoundEffect(uint8 track) { +void SoundTowns::playSoundEffect(uint8 track, uint8) { if (!_sfxEnabled || !_sfxFileData) return; @@ -446,7 +446,7 @@ void SoundPC98::beginFadeOut() { haltTrack(); } -void SoundPC98::playSoundEffect(uint8 track) { +void SoundPC98::playSoundEffect(uint8 track, uint8) { if (!_sfxTrackData) return; @@ -650,7 +650,7 @@ int32 SoundTownsPC98_v2::voicePlay(const char *file, Audio::SoundHandle *handle, return 1; } -void SoundTownsPC98_v2::playSoundEffect(uint8 track) { +void SoundTownsPC98_v2::playSoundEffect(uint8 track, uint8) { if (!_useFmSfx || !_sfxTrackData) return; -- cgit v1.2.3 From f2a1ff3f7842757d369db23652b39ed3f2a22144 Mon Sep 17 00:00:00 2001 From: athrxx Date: Tue, 8 Nov 2011 20:30:26 +0100 Subject: KYRA: (AdLib Driver) - fix invalid memory write issue --- engines/kyra/sound_adlib.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/kyra/sound_adlib.cpp b/engines/kyra/sound_adlib.cpp index c31cf809ee..9e47367138 100644 --- a/engines/kyra/sound_adlib.cpp +++ b/engines/kyra/sound_adlib.cpp @@ -524,7 +524,7 @@ void AdLibDriver::setSoundData(uint8 *data) { if (_soundData) { delete[] _soundData; - _soundData = 0; + _soundData = _sfxPointer = 0; } _soundData = data; -- cgit v1.2.3 From 4098feff57239102a7519e5b7bc1ef8f41465dc2 Mon Sep 17 00:00:00 2001 From: athrxx Date: Sun, 6 Nov 2011 00:55:37 +0100 Subject: KYRA: (AdLib Driver) - allow sound trigger query --- engines/kyra/sound.h | 10 ++++++++++ engines/kyra/sound_adlib.cpp | 9 +++++++++ engines/kyra/sound_adlib.h | 3 +++ 3 files changed, 22 insertions(+) (limited to 'engines') diff --git a/engines/kyra/sound.h b/engines/kyra/sound.h index 88454e4878..63cec48d00 100644 --- a/engines/kyra/sound.h +++ b/engines/kyra/sound.h @@ -217,6 +217,16 @@ public: * Stops playback of the current voice. */ void voiceStop(const Audio::SoundHandle *handle = 0); + + /** + * Receive notifications from a song at certain points. + */ + virtual int checkTrigger() { return 0; } + + /** + * Reset sound trigger. + */ + virtual void resetTrigger() {} protected: const char *fileListEntry(int file) const { return (_soundDataList != 0 && file >= 0 && file < _soundDataList->fileListLen) ? _soundDataList->fileList[file] : ""; } int fileListLen() const { return _soundDataList->fileListLen; } diff --git a/engines/kyra/sound_adlib.cpp b/engines/kyra/sound_adlib.cpp index 9e47367138..d3b72cb833 100644 --- a/engines/kyra/sound_adlib.cpp +++ b/engines/kyra/sound_adlib.cpp @@ -66,6 +66,7 @@ public: bool isChannelPlaying(int channel) const; void stopAllChannels(); int getSoundTrigger() const { return _soundTrigger; } + void resetSoundTrigger() { _soundTrigger = 0; } void callback(); @@ -2345,6 +2346,14 @@ void SoundAdLibPC::beginFadeOut() { play(1, 0xff); } +int SoundAdLibPC::checkTrigger() { + return _driver->getSoundTrigger(); +} + +void SoundAdLibPC::resetTrigger() { + _driver->resetSoundTrigger(); +} + void SoundAdLibPC::loadSoundFile(uint file) { internalLoadFile(fileListEntry(file)); } diff --git a/engines/kyra/sound_adlib.h b/engines/kyra/sound_adlib.h index 06ec9515ff..8492f3b99a 100644 --- a/engines/kyra/sound_adlib.h +++ b/engines/kyra/sound_adlib.h @@ -79,6 +79,9 @@ public: virtual void playSoundEffect(uint8 track, uint8 volume = 0xff); virtual void beginFadeOut(); + + virtual int checkTrigger(); + virtual void resetTrigger(); private: void internalLoadFile(Common::String file); -- cgit v1.2.3 From 86a8f694c0c09ccb5825fc7591a1303e638b2451 Mon Sep 17 00:00:00 2001 From: athrxx Date: Sun, 6 Nov 2011 14:12:13 +0100 Subject: KYRA: (AdLib Driver) - rename some variables to make more sense --- engines/kyra/sound_adlib.cpp | 49 +++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 26 deletions(-) (limited to 'engines') diff --git a/engines/kyra/sound_adlib.cpp b/engines/kyra/sound_adlib.cpp index d3b72cb833..0bc682df0d 100644 --- a/engines/kyra/sound_adlib.cpp +++ b/engines/kyra/sound_adlib.cpp @@ -107,7 +107,7 @@ private: // These variables have not yet been named, but some of them are partly // known nevertheless: // - // unk16 - Sound-related. Possibly some sort of pitch bend. + // pitchBend - Sound-related. Possibly some sort of pitch bend. // unk18 - Sound-effect. Used for secondaryEffect1() // unk19 - Sound-effect. Used for secondaryEffect1() // unk20 - Sound-effect. Used for secondaryEffect1() @@ -176,7 +176,7 @@ private: uint16 offset; uint8 tempoReset; uint8 rawNote; - int8 unk16; + int8 pitchBend; uint8 volumeModifier; }; @@ -280,7 +280,7 @@ private: int updateCallback38(uint8 *&dataptr, Channel &channel, uint8 value); int updateCallback39(uint8 *&dataptr, Channel &channel, uint8 value); int update_removePrimaryEffect2(uint8 *&dataptr, Channel &channel, uint8 value); - int updateCallback41(uint8 *&dataptr, Channel &channel, uint8 value); + int update_pitchBend(uint8 *&dataptr, Channel &channel, uint8 value); int update_resetToGlobalTempo(uint8 *&dataptr, Channel &channel, uint8 value); int update_nop(uint8 *&dataptr, Channel &channel, uint8 value); int update_setDurationRandomness(uint8 *&dataptr, Channel &channel, uint8 value); @@ -318,7 +318,7 @@ private: // _unkValue18 - Unknown. Rhythm section volume? // _unkValue19 - Unknown. Rhythm section volume? // _unkValue20 - Unknown. Rhythm section volume? - // _unkTable[] - Probably frequences for the 12-tone scale. + // _freqTable[] - Probably frequences for the 12-tone scale. // _unkTable2[] - Unknown. Currently only used by updateCallback46() // _unkTable2_1[] - One of the tables in _unkTable2[] // _unkTable2_2[] - One of the tables in _unkTable2[] @@ -385,12 +385,12 @@ private: const uint8 *_tablePtr2; static const uint8 _regOffset[]; - static const uint16 _unkTable[]; + static const uint16 _freqTable[]; static const uint8 *const _unkTable2[]; static const uint8 _unkTable2_1[]; static const uint8 _unkTable2_2[]; static const uint8 _unkTable2_3[]; - static const uint8 _unkTables[][32]; + static const uint8 _pitchBendTables[][32]; uint16 _syncJumpMask; @@ -975,20 +975,20 @@ void AdLibDriver::setupNote(uint8 rawNote, Channel &channel, bool flag) { // octave bits, and that could possibly have been used in some sound. // But as it is now, I can't see any way it would happen. - uint16 freq = _unkTable[note] + channel.baseFreq; + uint16 freq = _freqTable[note] + channel.baseFreq; // When called from callback 41, the behavior is slightly different: - // We adjust the frequency, even when channel.unk16 is 0. + // We adjust the frequency, even when channel.pitchBend is 0. - if (channel.unk16 || flag) { + if (channel.pitchBend || flag) { const uint8 *table; - if (channel.unk16 >= 0) { - table = _unkTables[(channel.rawNote & 0x0F) + 2]; - freq += table[channel.unk16]; + if (channel.pitchBend >= 0) { + table = _pitchBendTables[(channel.rawNote & 0x0F) + 2]; + freq += table[channel.pitchBend]; } else { - table = _unkTables[channel.rawNote & 0x0F]; - freq -= table[-channel.unk16]; + table = _pitchBendTables[channel.rawNote & 0x0F]; + freq -= table[-channel.pitchBend]; } } @@ -1670,8 +1670,8 @@ int AdLibDriver::update_removePrimaryEffect2(uint8 *&dataptr, Channel &channel, return 0; } -int AdLibDriver::updateCallback41(uint8 *&dataptr, Channel &channel, uint8 value) { - channel.unk16 = value; +int AdLibDriver::update_pitchBend(uint8 *&dataptr, Channel &channel, uint8 value) { + channel.pitchBend = value; setupNote(channel.rawNote, channel, true); return 0; } @@ -2022,7 +2022,7 @@ void AdLibDriver::setupParserOpcodeTable() { // 56 COMMAND(update_stopChannel), - COMMAND(updateCallback41), + COMMAND(update_pitchBend), COMMAND(update_resetToGlobalTempo), COMMAND(update_nop), @@ -2063,11 +2063,10 @@ const uint8 AdLibDriver::_regOffset[] = { 0x12 }; -// Given the size of this table, and the range of its values, it's probably the -// F-Numbers (10 bits) for the notes of the 12-tone scale. However, it does not -// match the table in the AdLib documentation I've seen. +//These are the F-Numbers (10 bits) for the notes of the 12-tone scale. +// However, it does not match the table in the AdLib documentation I've seen. -const uint16 AdLibDriver::_unkTable[] = { +const uint16 AdLibDriver::_freqTable[] = { 0x0134, 0x0147, 0x015A, 0x016F, 0x0184, 0x019C, 0x01B4, 0x01CE, 0x01E9, 0x0207, 0x0225, 0x0246 }; @@ -2145,13 +2144,11 @@ const uint8 AdLibDriver::_unkTable2_3[] = { }; // This table is used to modify the frequency of the notes, depending on the -// note value and unk16. In theory, we could very well try to access memory -// outside this table, but in reality that probably won't happen. +// note value and the pitch bend value. In theory, we could very well try to +// access memory outside this table, but in reality that probably won't happen. // -// This could be some sort of pitch bend, but I have yet to see it used for -// anything so it's hard to say. -const uint8 AdLibDriver::_unkTables[][32] = { +const uint8 AdLibDriver::_pitchBendTables[][32] = { // 0 { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, -- cgit v1.2.3 From 93321ca4850c4859c71ec02420874101529bddce Mon Sep 17 00:00:00 2001 From: athrxx Date: Sun, 6 Nov 2011 14:22:47 +0100 Subject: KYRA: (AdLib Driver) - fix secondary effect --- engines/kyra/sound_adlib.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/kyra/sound_adlib.cpp b/engines/kyra/sound_adlib.cpp index 0bc682df0d..2bce5a2c59 100644 --- a/engines/kyra/sound_adlib.cpp +++ b/engines/kyra/sound_adlib.cpp @@ -1428,7 +1428,21 @@ int AdLibDriver::update_setupSecondaryEffect1(uint8 *&dataptr, Channel &channel, channel.unk19 = value; channel.unk20 = channel.unk21 = *dataptr++; channel.unk22 = *dataptr++; - channel.offset = READ_LE_UINT16(dataptr); dataptr += 2; + // WORKAROUND: The original code reads a true offset which later gets translated via xlat (in + // the current segment). This means that the outcome depends on the sound data offset. + // Unfortunately this offset is different in most implementations of the audio driver and + // probably also different from the offset assumed by the sequencer. + // It seems that the driver assumes an offset of 191 which is wrong for all the game driver + // implementations. + // This bug has probably not been noticed, since the effect is hardly used and the sounds are + // not necessarily worse. I noticed the difference between ScummVM and DOSBox for the EOB II + // teleporter sound. I also found the location of the table which is supposed to be used here + // (simple enough: it is located at the end of the track after the 0x88 ending opcode). + // Teleporters in EOB I and II now sound exactly the same which I am sure was the intended way, + // since the sound data is exactly the same. + // In DOSBox the teleporters will sound different in EOB I and II, due to different sound + // data offsets. + channel.offset = READ_LE_UINT16(dataptr) - 191; dataptr += 2; channel.secondaryEffect = &AdLibDriver::secondaryEffect1; return 0; } -- cgit v1.2.3 From 2da431aa65da25388963687d398f4a40f2aeee73 Mon Sep 17 00:00:00 2001 From: athrxx Date: Sun, 6 Nov 2011 14:57:01 +0100 Subject: KYRA: (AdLib Driver) - increase versions and add necessary EOB modifications --- engines/kyra/kyra_v1.h | 4 ++- engines/kyra/sound_adlib.cpp | 81 +++++++++++++++++++++++++++++--------------- 2 files changed, 56 insertions(+), 29 deletions(-) (limited to 'engines') diff --git a/engines/kyra/kyra_v1.h b/engines/kyra/kyra_v1.h index 5a9feb0054..24a3b35418 100644 --- a/engines/kyra/kyra_v1.h +++ b/engines/kyra/kyra_v1.h @@ -134,7 +134,9 @@ enum { GI_KYRA1 = 0, GI_KYRA2 = 1, GI_KYRA3 = 2, - GI_LOL = 4 + GI_LOL = 4, + GI_EOB1 = 5, + GI_EOB2 = 6 }; struct AudioDataStruct { diff --git a/engines/kyra/sound_adlib.cpp b/engines/kyra/sound_adlib.cpp index 2bce5a2c59..983d3b6031 100644 --- a/engines/kyra/sound_adlib.cpp +++ b/engines/kyra/sound_adlib.cpp @@ -224,7 +224,7 @@ private: } uint8 *getInstrument(int instrumentId) { - return _soundData + READ_LE_UINT16(_soundData + ((_version == 2) ? 1000 : 500) + 2 * instrumentId); + return getProgram(_numPrograms + instrumentId); } void setupPrograms(); @@ -400,6 +400,7 @@ private: uint8 _musicVolume, _sfxVolume; + int _numPrograms; int _version; }; @@ -407,6 +408,7 @@ AdLibDriver::AdLibDriver(Audio::Mixer *mixer, int version) { setupParserOpcodeTable(); _version = version; + _numPrograms = (_version == 1) ? 150 : ((_version == 4) ? 500 : 250); _mixer = mixer; @@ -472,8 +474,8 @@ void AdLibDriver::setMusicVolume(uint8 volume) { writeOPL(0x43 + regOffset, calculateOpLevel2(chan)); } - // For now we use the music volume for both sfx and music in Kyra1. - if (_version < 2) { + // For now we use the music volume for both sfx and music in Kyra1 and Eob + if (_version < 4) { _sfxVolume = volume; for (uint i = 6; i < 9; ++i) { @@ -490,8 +492,8 @@ void AdLibDriver::setMusicVolume(uint8 volume) { } void AdLibDriver::setSfxVolume(uint8 volume) { - // We only support sfx volume in version 2 games. - if (_version < 2) + // We only support sfx volume in version 4 games. + if (_version < 4) return; Common::StackLock lock(_mutex); @@ -655,15 +657,17 @@ void AdLibDriver::adjustSfxData(uint8 *ptr, int volume) { _sfxVelocity = ptr[3]; // Adjust the values. - if (_version >= 1) { - int newVal = ((((ptr[3]) + 63) * volume) >> 8) & 0xFF; - ptr[3] = -newVal + 63; - ptr[1] = ((ptr[1] * volume) >> 8) & 0xFF; - } else { - int newVal = ((_sfxVelocity << 2) ^ 0xff) * volume; - ptr[3] = (newVal >> 10) ^ 0x3f; - ptr[1] = newVal >> 11; - } + if (volume != 0xff) { + if (_version >= 3) { + int newVal = ((((ptr[3]) + 63) * volume) >> 8) & 0xFF; + ptr[3] = -newVal + 63; + ptr[1] = ((ptr[1] * volume) >> 8) & 0xFF; + } else { + int newVal = ((_sfxVelocity << 2) ^ 0xff) * volume; + ptr[3] = (newVal >> 10) ^ 0x3f; + ptr[1] = newVal >> 11; + } + } } // A few words on opcode parsing and timing: @@ -1368,7 +1372,10 @@ int AdLibDriver::update_setNoteSpacing(uint8 *&dataptr, Channel &channel, uint8 int AdLibDriver::update_jump(uint8 *&dataptr, Channel &channel, uint8 value) { --dataptr; int16 add = READ_LE_UINT16(dataptr); dataptr += 2; - dataptr += add; + if (_version == 1) + dataptr = _soundData + add - 191; + else + dataptr += add; if (_syncJumpMask & (1 << (&channel - _channels))) channel.lock = true; return 0; @@ -1378,7 +1385,10 @@ int AdLibDriver::update_jumpToSubroutine(uint8 *&dataptr, Channel &channel, uint --dataptr; int16 add = READ_LE_UINT16(dataptr); dataptr += 2; channel.dataptrStack[channel.dataptrStackPos++] = dataptr; - dataptr += add; + if (_version < 3) + dataptr = _soundData + add - 191; + else + dataptr += add; return 0; } @@ -2251,21 +2261,36 @@ const int SoundAdLibPC::_kyra1NumSoundTriggers = ARRAYSIZE(SoundAdLibPC::_kyra1S SoundAdLibPC::SoundAdLibPC(KyraEngine_v1 *vm, Audio::Mixer *mixer) : Sound(vm, mixer), _driver(0), _trackEntries(), _soundDataPtr(0) { memset(_trackEntries, 0, sizeof(_trackEntries)); - _version = ((_vm->game() == GI_KYRA2) || (_vm->game() == GI_LOL && !_vm->gameFlags().isDemo)) ? 2 : 1; - _driver = new AdLibDriver(mixer, _version); - assert(_driver); + _soundTriggers = 0; + _numSoundTriggers = 0; _sfxPlayingSound = -1; _soundFileLoaded.clear(); - if (_version == 1) { + switch (vm->game()) { + case GI_LOL: + _version = _vm->gameFlags().isDemo ? 3 : 4; + break; + case GI_KYRA2: + _version = 4; + break; + case GI_KYRA1: + _version = 3; _soundTriggers = _kyra1SoundTriggers; _numSoundTriggers = _kyra1NumSoundTriggers; - } else { - // TODO: Figure out if Kyra 2 uses sound triggers at all. - _soundTriggers = 0; - _numSoundTriggers = 0; + break; + case GI_EOB2: + _version = 2; + break; + case GI_EOB1: + _version = 1; + break; + default: + break; } + + _driver = new AdLibDriver(mixer, _version); + assert(_driver); } SoundAdLibPC::~SoundAdLibPC() { @@ -2342,12 +2367,12 @@ void SoundAdLibPC::playSoundEffect(uint8 track, uint8 volume) { void SoundAdLibPC::play(uint8 track, uint8 volume) { uint16 soundId = 0; - if (_version == 2) + if (_version == 4) soundId = READ_LE_UINT16(&_trackEntries[track<<1]); else soundId = _trackEntries[track]; - if ((soundId == 0xFFFF && _version == 2) || (soundId == 0xFF && _version < 2) || !_soundDataPtr) + if ((soundId == 0xFFFF && _version == 4) || (soundId == 0xFF && _version < 4) || !_soundDataPtr) return; _driver->queueTrack(soundId, volume); @@ -2374,7 +2399,7 @@ void SoundAdLibPC::loadSoundFile(Common::String file) { } void SoundAdLibPC::internalLoadFile(Common::String file) { - file += ".ADL"; + file += ((_version == 1) ? ".DAT" : ".ADL"); if (_soundFileLoaded == file) return; @@ -2398,7 +2423,7 @@ void SoundAdLibPC::internalLoadFile(Common::String file) { int soundDataSize = fileSize; uint8 *p = fileData; - if (_version == 2) { + if (_version == 4) { memcpy(_trackEntries, p, 500); p += 500; soundDataSize -= 500; -- cgit v1.2.3 From 2bcae2451a9e5e59c2ad30e5c8560d9b8e117501 Mon Sep 17 00:00:00 2001 From: athrxx Date: Sun, 6 Nov 2011 21:31:18 +0100 Subject: KYRA: (AdLib Driver) - prevent squashing of sounds during halt track execution This patch makes sure that the stopping track (track 0) does not squash sounds which get queued during the execution of the stopping track. This seems to be a hardware problem (original driver implementation not suitable for modern machines). --- engines/kyra/sound_adlib.cpp | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) (limited to 'engines') diff --git a/engines/kyra/sound_adlib.cpp b/engines/kyra/sound_adlib.cpp index 983d3b6031..94a285d729 100644 --- a/engines/kyra/sound_adlib.cpp +++ b/engines/kyra/sound_adlib.cpp @@ -360,13 +360,17 @@ private: uint8 *_soundData; struct QueueEntry { + QueueEntry() : data(0), id(0), volume(0) {} + QueueEntry(uint8 *ptr, uint8 track, uint8 vol) : data(ptr), id(track), volume(vol) {} uint8 *data; + uint8 id; uint8 volume; }; QueueEntry _programQueue[16]; int _programStartTimeout; int _programQueueStart, _programQueueEnd; + bool _retrySounds; void adjustSfxData(uint8 *data, int volume); uint8 *_sfxPointer; @@ -450,6 +454,7 @@ AdLibDriver::AdLibDriver(Audio::Mixer *mixer, int version) { _sfxPointer = 0; _programQueueStart = _programQueueEnd = 0; + _retrySounds = false; } AdLibDriver::~AdLibDriver() { @@ -545,8 +550,7 @@ void AdLibDriver::queueTrack(int track, int volume) { return; } - _programQueue[_programQueueEnd].data = trackData; - _programQueue[_programQueueEnd].volume = volume; + _programQueue[_programQueueEnd] = QueueEntry(trackData, track, volume); _programQueueEnd = (_programQueueEnd + 1) & 15; } @@ -570,6 +574,7 @@ void AdLibDriver::stopAllChannels() { if (channel != 9) noteOff(chan); } + _retrySounds = false; } // timer callback @@ -598,13 +603,25 @@ void AdLibDriver::setupPrograms() { return; uint8 *ptr = _programQueue[_programQueueStart].data; - // Clear the queue entry - _programQueue[_programQueueStart].data = 0; - _programQueueStart = (_programQueueStart + 1) & 15; + + // The AdLib driver (in its old versions used for EOB) is not suitable for modern (fast) CPUs. + // The stop sound track (track 0 which has a priority of 50) will often still be busy when the + // next sound (with a lower priority) starts which will cause that sound to be skipped. We simply + // restart incoming sounds during stop sound execution. + // UPDATE: This stilly applies after introduction of the _programQueue. + QueueEntry retrySound; + if (_version < 3 && _programQueue[_programQueueStart].id == 0) + _retrySounds = true; + else if (_retrySounds) + retrySound = _programQueue[_programQueueStart]; // Adjust data in case we hit a sound effect. adjustSfxData(ptr, _programQueue[_programQueueStart].volume); + // Clear the queue entry + _programQueue[_programQueueStart].data = 0; + _programQueueStart = (_programQueueStart + 1) & 15; + const int chan = *ptr++; const int priority = *ptr++; @@ -632,6 +649,13 @@ void AdLibDriver::setupPrograms() { // This is (probably) required to assure that the sfx are started with // the correct priority and velocity. _programStartTimeout = 2; + + retrySound = QueueEntry(); + } + + if (retrySound.data) { + debugC(9, kDebugLevelSound, "AdLibDriver::setupPrograms(): WORKAROUND - Restarting skipped sound %d)", retrySound.id); + queueTrack(retrySound.id, retrySound.volume); } } -- cgit v1.2.3 From 814c78e84ea4d75b2ac3442227120d4d14e7b18b Mon Sep 17 00:00:00 2001 From: athrxx Date: Sun, 6 Nov 2011 22:19:26 +0100 Subject: KYRA: (AdLib Driver) - fix queue handling for Eob Huge numbers of sound effects get started as soon as a couple of monsters are around. If we start dropping sound when the queue is full, we won't have any sounds in these situations, but we'll get tons of useless warnings instead. --- engines/kyra/sound_adlib.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/kyra/sound_adlib.cpp b/engines/kyra/sound_adlib.cpp index 94a285d729..e99990e1e0 100644 --- a/engines/kyra/sound_adlib.cpp +++ b/engines/kyra/sound_adlib.cpp @@ -545,7 +545,9 @@ void AdLibDriver::queueTrack(int track, int volume) { if (!trackData) return; - if (_programQueueEnd == _programQueueStart && _programQueue[_programQueueEnd].data != 0) { + // Don't drop tracks in Eob. The queue is always full there if a couple of monsters are around. + // If we drop the incoming tracks we get no sound effects, but tons of warnings instead. + if (_version >= 3 && _programQueueEnd == _programQueueStart && _programQueue[_programQueueEnd].data != 0) { warning("AdLibDriver: Program queue full, dropping track %d", track); return; } -- cgit v1.2.3 From 540d081a6fd4daa31f746ddf30ccc91fb88ea04b Mon Sep 17 00:00:00 2001 From: athrxx Date: Sun, 11 Dec 2011 01:57:03 +0100 Subject: KYRA: (EOB) - initial code base commit --- engines/engines.mk | 4 + engines/kyra/chargen.cpp | 1495 ++++++++++++++++++++++++++ engines/kyra/detection.cpp | 11 + engines/kyra/detection_tables.h | 74 ++ engines/kyra/eob1.cpp | 242 +++++ engines/kyra/eob1.h | 96 ++ engines/kyra/eob2.cpp | 437 ++++++++ engines/kyra/eob2.h | 119 +++ engines/kyra/eobcommon.cpp | 1845 ++++++++++++++++++++++++++++++++ engines/kyra/eobcommon.h | 977 +++++++++++++++++ engines/kyra/gui.h | 8 +- engines/kyra/gui_eob.cpp | 2165 ++++++++++++++++++++++++++++++++++++++ engines/kyra/gui_eob.h | 130 +++ engines/kyra/gui_lol.cpp | 90 +- engines/kyra/gui_lol.h | 2 - engines/kyra/items_eob.cpp | 614 +++++++++++ engines/kyra/kyra_hof.cpp | 2 +- engines/kyra/kyra_hof.h | 2 +- engines/kyra/kyra_mr.cpp | 2 +- engines/kyra/kyra_mr.h | 2 +- engines/kyra/kyra_v1.cpp | 41 +- engines/kyra/kyra_v1.h | 2 +- engines/kyra/kyra_v2.h | 2 +- engines/kyra/lol.cpp | 410 +++----- engines/kyra/lol.h | 328 ++---- engines/kyra/loleobbase.cpp | 354 +++++++ engines/kyra/loleobbase.h | 324 ++++++ engines/kyra/magic_eob.cpp | 780 ++++++++++++++ engines/kyra/module.mk | 29 + engines/kyra/resource.cpp | 4 +- engines/kyra/resource.h | 319 +++++- engines/kyra/resource_intern.cpp | 11 +- engines/kyra/saveload_eob.cpp | 549 ++++++++++ engines/kyra/saveload_lol.cpp | 96 +- engines/kyra/scene_eob.cpp | 1350 ++++++++++++++++++++++++ engines/kyra/scene_lol.cpp | 733 +------------ engines/kyra/screen.cpp | 58 +- engines/kyra/screen.h | 45 +- engines/kyra/screen_eob.cpp | 965 +++++++++++++++++ engines/kyra/screen_eob.h | 105 ++ engines/kyra/script.cpp | 2 +- engines/kyra/script.h | 4 +- engines/kyra/script_eob.cpp | 1528 +++++++++++++++++++++++++++ engines/kyra/script_eob.h | 121 +++ engines/kyra/script_hof.cpp | 2 +- engines/kyra/script_lok.cpp | 2 +- engines/kyra/script_lol.cpp | 80 +- engines/kyra/script_mr.cpp | 2 +- engines/kyra/script_tim.cpp | 180 +--- engines/kyra/script_tim.h | 19 +- engines/kyra/sequences_eob1.cpp | 140 +++ engines/kyra/sequences_eob2.cpp | 1277 ++++++++++++++++++++++ engines/kyra/sound.cpp | 2 +- engines/kyra/sound_lol.cpp | 25 +- engines/kyra/sprites_eob.cpp | 1249 ++++++++++++++++++++++ engines/kyra/sprites_lol.cpp | 77 +- engines/kyra/staticres.cpp | 16 +- engines/kyra/staticres_eob.cpp | 1062 +++++++++++++++++++ engines/kyra/staticres_lol.cpp | 190 ++-- engines/kyra/text_eob.cpp | 649 ++++++++++++ engines/kyra/text_eob.h | 112 ++ engines/kyra/text_lol.cpp | 501 +-------- engines/kyra/text_lol.h | 52 +- engines/kyra/timer.cpp | 2 +- engines/kyra/timer_eob.cpp | 378 +++++++ engines/kyra/timer_lol.cpp | 52 - 66 files changed, 20176 insertions(+), 2370 deletions(-) create mode 100644 engines/kyra/chargen.cpp create mode 100644 engines/kyra/eob1.cpp create mode 100644 engines/kyra/eob1.h create mode 100644 engines/kyra/eob2.cpp create mode 100644 engines/kyra/eob2.h create mode 100644 engines/kyra/eobcommon.cpp create mode 100644 engines/kyra/eobcommon.h create mode 100644 engines/kyra/gui_eob.cpp create mode 100644 engines/kyra/gui_eob.h create mode 100644 engines/kyra/items_eob.cpp create mode 100644 engines/kyra/loleobbase.cpp create mode 100644 engines/kyra/loleobbase.h create mode 100644 engines/kyra/magic_eob.cpp create mode 100644 engines/kyra/saveload_eob.cpp create mode 100644 engines/kyra/scene_eob.cpp create mode 100644 engines/kyra/screen_eob.cpp create mode 100644 engines/kyra/screen_eob.h create mode 100644 engines/kyra/script_eob.cpp create mode 100644 engines/kyra/script_eob.h create mode 100644 engines/kyra/sequences_eob1.cpp create mode 100644 engines/kyra/sequences_eob2.cpp create mode 100644 engines/kyra/sprites_eob.cpp create mode 100644 engines/kyra/staticres_eob.cpp create mode 100644 engines/kyra/text_eob.cpp create mode 100644 engines/kyra/text_eob.h create mode 100644 engines/kyra/timer_eob.cpp (limited to 'engines') diff --git a/engines/engines.mk b/engines/engines.mk index 5280bf92d7..9939506b86 100644 --- a/engines/engines.mk +++ b/engines/engines.mk @@ -87,6 +87,10 @@ MODULES += engines/kyra ifdef ENABLE_LOL DEFINES += -DENABLE_LOL endif + +ifdef ENABLE_EOB +DEFINES += -DENABLE_EOB +endif endif ifdef ENABLE_LASTEXPRESS diff --git a/engines/kyra/chargen.cpp b/engines/kyra/chargen.cpp new file mode 100644 index 0000000000..4a0e035483 --- /dev/null +++ b/engines/kyra/chargen.cpp @@ -0,0 +1,1495 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifdef ENABLE_EOB + +#include "kyra/eobcommon.h" +#include "kyra/resource.h" +#include "kyra/sound_intern.h" + +namespace Kyra { + +class CharacterGenerator { +public: + CharacterGenerator(EobCoreEngine *vm, Screen_Eob *screen); + ~CharacterGenerator(); + + void start(EobCharacter *characters, uint8 ***faceShapes); + +private: + void init(); + void initButtonsFromList(int first, int numButtons); + void initButton(int index, int x, int y, int w, int h, int keyCode); + void checkForCompleteParty(); + void toggleSpecialButton(int index, int bodyCustom, int pageNum); + void processSpecialButton(int index); + void highlightBoxFrame(int index); + int viewDeleteCharacter(); + void createPartyMember(); + int raceSexMenu(); + int classMenu(int raceSex); + int alignmentMenu(int cClass); + void updateMagicShapes(); + void generateStats(int index); + void modifyMenu(); + void statsAndFacesMenu(); + void faceSelectMenu(); + int getNextFreeFaceShape(int shpIndex, int charSex, int step, int8 *selectedPortraits); + void processFaceMenuSelection(int index); + void printStats(int index, int mode); + void processNameInput(int index, int len, int textColor); + int rollDice(); + int modifyStat(int index, int8 *stat1, int8 *stat2); + int getMaxHp(int cclass, int constitution, int level1, int level2, int level3); + int getMinHp(int cclass, int constitution, int level1, int level2, int level3); + void finish(); + + uint8 **_chargenMagicShapes; + uint8 **_chargenButtonLabels; + int _activeBox; + int _magicShapesBox; + int _updateBoxIndex; + int _updateBoxColorIndex; + int _updateBoxShapesIndex; + int _lastUpdateBoxShapesIndex; + uint32 _chargenBoxTimer; + uint32 _chargenMagicShapeTimer; + int8 _chargenSelectedPortraits[4]; + int8 _chargenSelectedPortraits2[4]; + + uint16 _chargenMinStats[7]; + uint16 _chargenMaxStats[7]; + + const char *const *_chargenStrings1; + const char *const *_chargenStrings2; + const char *const *_chargenStatStrings; + const char *const *_chargenRaceSexStrings; + const char *const *_chargenClassStrings; + const char *const *_chargenAlignmentStrings; + const char *const *_chargenEnterGameStrings; + + const uint8 *_chargenStartLevels; + const uint8 *_chargenClassMinStats; + const uint8 *_chargenRaceMinStats; + const uint16 *_chargenRaceMaxStats; + + static const EobChargenButtonDef _chargenButtonDefs[]; + static const CreatePartyModButton _chargenModButtons[]; + static const EobRect8 _chargenButtonBodyCoords[]; + static const EobRect16 _chargenPortraitBoxFrames[]; + static const int16 _chargenBoxX[]; + static const int16 _chargenBoxY[]; + static const int16 _chargenNameFieldX[]; + static const int16 _chargenNameFieldY[]; + + static const int32 _classMenuMasks[]; + static const int32 _alignmentMenuMasks[]; + + static const int16 _raceModifiers[]; + + EobCharacter *_characters; + uint8 **_faceShapes; + + EobCoreEngine *_vm; + Screen_Eob *_screen; +}; + +void EobCoreEngine::startCharacterGeneration() { + CharacterGenerator(this, _screen).start(_characters, &_faceShapes); +} + +CharacterGenerator::CharacterGenerator(EobCoreEngine *vm, Screen_Eob *screen) : _vm(vm), _screen(screen), + _characters(0), _faceShapes(0), _chargenMagicShapes(0), _chargenButtonLabels(0), _updateBoxIndex(-1), + _chargenBoxTimer(0), _chargenMagicShapeTimer(0), _updateBoxColorIndex(0), _updateBoxShapesIndex(0), + _lastUpdateBoxShapesIndex(0), _magicShapesBox(6), _activeBox(0) { + + _chargenStatStrings = _vm->_chargenStatStrings; + _chargenRaceSexStrings = _vm->_chargenRaceSexStrings; + _chargenClassStrings = _vm->_chargenClassStrings; + _chargenAlignmentStrings = _vm->_chargenAlignmentStrings; + + memset(_chargenSelectedPortraits, -1, sizeof(_chargenSelectedPortraits)); + memset(_chargenSelectedPortraits2, 0, sizeof(_chargenSelectedPortraits2)); + memset(_chargenMinStats, 0, sizeof(_chargenMinStats)); + memset(_chargenMaxStats, 0, sizeof(_chargenMaxStats)); + + int temp; + _chargenStrings1 = _vm->staticres()->loadStrings(kEobBaseChargenStrings1, temp); + _chargenStrings2 = _vm->staticres()->loadStrings(kEobBaseChargenStrings2, temp); + _chargenStartLevels = _vm->staticres()->loadRawData(kEobBaseChargenStartLevels, temp); + _chargenEnterGameStrings = _vm->staticres()->loadStrings(kEobBaseChargenEnterGameStrings, temp); + _chargenClassMinStats = _vm->staticres()->loadRawData(kEobBaseChargenClassMinStats, temp); + _chargenRaceMinStats = _vm->staticres()->loadRawData(kEobBaseChargenRaceMinStats, temp); + _chargenRaceMaxStats = _vm->staticres()->loadRawDataBe16(kEobBaseChargenRaceMaxStats, temp); +} + +CharacterGenerator::~CharacterGenerator() { + if (_chargenMagicShapes) { + for (int i = 0; i < 10; i++) + delete[] _chargenMagicShapes[i]; + delete[] _chargenMagicShapes; + } + + if (_chargenButtonLabels) { + for (int i = 0; i < 10; i++) + delete[] _chargenButtonLabels[i]; + delete[] _chargenButtonLabels; + } +} + +void CharacterGenerator::start(EobCharacter *characters, uint8 ***faceShapes) { + if (!characters && !faceShapes) + return; + + _characters = characters; + _faceShapes = *faceShapes; + + _vm->sound()->playTrack(0); + + _vm->delay(_vm->_tickLength); + + init(); + + _screen->setScreenDim(2); + + checkForCompleteParty(); + initButtonsFromList(0, 5); + + _vm->sound()->playTrack(_vm->game() == GI_EOB1 ? 20 : 13); + _activeBox = 0; + + for (bool loop = true; loop && (!_vm->shouldQuit()); ) { + highlightBoxFrame(_activeBox + 6); + _vm->sound()->process(); + int inputFlag = _vm->checkInput(_vm->_activeButtons, false, 0); + _vm->removeInputTop(); + + if (inputFlag) { + if (inputFlag == _vm->_keyMap[Common::KEYCODE_LEFT] || inputFlag == _vm->_keyMap[Common::KEYCODE_RIGHT]) + _activeBox ^= 1; + else if (inputFlag == _vm->_keyMap[Common::KEYCODE_UP] || inputFlag == _vm->_keyMap[Common::KEYCODE_DOWN]) + _activeBox ^= 2; + highlightBoxFrame(-1); + } + + if (inputFlag & 0x8000) { + inputFlag = (inputFlag & 0x0f) - 1; + if (inputFlag == 4) { + loop = false; + } else { + _activeBox = inputFlag; + inputFlag = 43; + } + } + + if (inputFlag == _vm->_keyMap[Common::KEYCODE_RETURN] || inputFlag == _vm->_keyMap[Common::KEYCODE_SPACE] || inputFlag == _vm->_keyMap[Common::KEYCODE_KP5]) { + highlightBoxFrame(-1); + if (_characters[_activeBox].name[0]) { + int b = _activeBox; + if (viewDeleteCharacter()) + loop = false; + if (b != _activeBox && !_characters[_activeBox].name[0]) + createPartyMember(); + } else { + createPartyMember(); + } + + initButtonsFromList(0, 5); + checkForCompleteParty(); + } + + if (loop == false) { + for (int i = 0; i < 4; i++) { + if (!_characters[i].name[0]) + loop = true; + } + } + } + + if (!_vm->shouldQuit()) { + processSpecialButton(15); + finish(); + } + + _vm->sound()->playTrack(15); + + *faceShapes = _faceShapes; +} + +void CharacterGenerator::init() { + _screen->loadEobBitmap("CHARGENA", 3, 3); + if (_faceShapes) { + for (int i = 0; i < 44; i++) + delete[] _faceShapes[i]; + delete[] _faceShapes; + } + + _faceShapes = new uint8*[44]; + for (int i = 0; i < 44; i++) + _faceShapes[i] = _screen->encodeShape((i % 10) << 2, (i / 10) << 5, 4, 32, true); + _screen->_curPage = 0; + + _screen->loadEobCpsFileToPage("CHARGEN", 0, 3, 3, 0); + _screen->loadEobBitmap("CHARGENB", 3, 3); + if (_chargenMagicShapes) { + for (int i = 0; i < 10; i++) + delete[] _chargenMagicShapes[i]; + delete[] _chargenMagicShapes; + } + + _chargenMagicShapes = new uint8*[10]; + for (int i = 0; i < 10; i++) + _chargenMagicShapes[i] = _screen->encodeShape(i << 2, 0, 4, 32, true); + + _chargenButtonLabels = new uint8*[17]; + for (int i = 0; i < 17; i++) { + const CreatePartyModButton *c = &_chargenModButtons[i]; + _chargenButtonLabels[i] = c->labelW? _screen->encodeShape(c->encodeLabelX, c->encodeLabelY, c->labelW, c->labelH, true) : 0; + } + + _screen->copyPage(3, 2); + _screen->_curPage = 0; + _screen->copyRegion(144, 64, 0, 0, 180, 128, 0, 2, Screen::CR_NO_P_CHECK); + _screen->updateScreen(); +} + +void CharacterGenerator::initButtonsFromList(int first, int numButtons) { + _vm->gui_resetButtonList(); + + for (int i = 0; i < numButtons; i++) { + const EobChargenButtonDef *e = &_chargenButtonDefs[first + i]; + initButton(i, e->x, e->y, e->w, e->h, e->keyCode); + } + + _vm->gui_notifyButtonListChanged(); +} + +void CharacterGenerator::initButton(int index, int x, int y, int w, int h, int keyCode) { + Button *b = 0; + int cnt = 1; + + if (_vm->_activeButtons) { + Button *n = _vm->_activeButtons; + while (n->nextButton) { + ++cnt; + n = n->nextButton; + } + + ++cnt; + b = n->nextButton = &_vm->_activeButtonData[cnt]; + } else { + b = &_vm->_activeButtonData[0]; + _vm->_activeButtons = b; + } + + *b = Button(); + b->flags = 0x1100; + b->data0Val2 = 12; + b->data1Val2 = b->data2Val2 = 15; + b->data3Val2 = 8; + + b->index = index + 1; + b->x = x << 3; + b->y = y; + b->width = w; + b->height = h; + b->keyCode = keyCode; + b->keyCode2 = keyCode + 0x100; +} + +void CharacterGenerator::checkForCompleteParty() { + _screen->copyRegion(0, 0, 160, 0, 160, 128, 2, 2, Screen::CR_NO_P_CHECK); + int cp = _screen->setCurPage(2); + _screen->printShadedText(_chargenStrings1[8], 168, 16, 15, 0); + _screen->setCurPage(cp); + _screen->copyRegion(160, 0, 144, 64, 160, 128, 2, 0, Screen::CR_NO_P_CHECK); + + int numChars = 0; + for (int i = 0; i < 4; i++) { + if (_characters[i].name[0]) + numChars++; + } + + if (numChars == 4) { + _screen->setCurPage(2); + _screen->printShadedText(_chargenStrings1[0], 168, 61, 15, 0); + _screen->setCurPage(0); + _screen->copyRegion(168, 61, 152, 125, 136, 40, 2, 0, Screen::CR_NO_P_CHECK); + toggleSpecialButton(15, 0, 0); + } else { + toggleSpecialButton(14, 0, 0); + } + + _screen->updateScreen(); +} + +void CharacterGenerator::toggleSpecialButton(int index, int bodyCustom, int pageNum) { + if (index >= 17) + return; + + const CreatePartyModButton *c = &_chargenModButtons[index]; + const EobRect8 *p = &_chargenButtonBodyCoords[c->bodyIndex + bodyCustom]; + + int x2 = 20; + int y2 = 0; + + if (pageNum) { + x2 = c->destX + 2; + y2 = c->destY - 64; + } + + _screen->copyRegion(p->x << 3, p->y, x2 << 3, y2, p->w << 3, p->h, 2, 2, Screen::CR_NO_P_CHECK); + if (c->labelW) + _screen->drawShape(2, _chargenButtonLabels[index], (x2 << 3) + c->labelX, y2 + c->labelY, 0); + + if (pageNum == 2) + return; + + _screen->copyRegion(160, 0, c->destX << 3, c->destY, p->w << 3, p->h, 2, 0, Screen::CR_NO_P_CHECK); + _screen->updateScreen(); +} + +void CharacterGenerator::processSpecialButton(int index) { + toggleSpecialButton(index, 1, 0); + _vm->sound()->playSoundEffect(76); + _vm->_system->delayMillis(80); + toggleSpecialButton(index, 0, 0); +} + +void CharacterGenerator::highlightBoxFrame(int index) { + static const uint8 colorTable[] = { 0x0F, 0xB0, 0xB2, 0xB4, 0xB6, + 0xB8, 0xBA, 0xBC, 0x0C, 0xBC, 0xBA, 0xB8, 0xB6, 0xB4, 0xB2, 0xB0, 0x00 + }; + + if (_updateBoxIndex == index) { + if (_updateBoxIndex == -1) + return; + + if (_vm->_system->getMillis() <= _chargenBoxTimer) + return; + + if (!colorTable[_updateBoxColorIndex]) + _updateBoxColorIndex = 0; + + const EobRect16 *r = &_chargenPortraitBoxFrames[_updateBoxIndex]; + _screen->drawBox(r->x1, r->y1, r->x2, r->y2, colorTable[_updateBoxColorIndex++]); + _screen->updateScreen(); + + _chargenBoxTimer = _vm->_system->getMillis() + _vm->_tickLength; + + } else { + if (_updateBoxIndex != -1) { + const EobRect16 *r = &_chargenPortraitBoxFrames[_updateBoxIndex]; + _screen->drawBox(r->x1, r->y1, r->x2, r->y2, 12); + _screen->updateScreen(); + } + + _updateBoxColorIndex = 0; + _updateBoxIndex = index; + _chargenBoxTimer = _vm->_system->getMillis(); + } +} + +int CharacterGenerator::viewDeleteCharacter() { + initButtonsFromList(0, 7); + _vm->removeInputTop(); + + highlightBoxFrame(-1); + printStats(_activeBox, 2); + + int res = 0; + for (bool loop = true; loop && _characters[_activeBox].name[0] && !_vm->shouldQuit(); ) { + highlightBoxFrame(_activeBox + 6); + _vm->sound()->process(); + + int inputFlag = _vm->checkInput(_vm->_activeButtons, false, 0); + int cbx = _activeBox; + _vm->removeInputTop(); + + if (inputFlag == _vm->_keyMap[Common::KEYCODE_RETURN] || inputFlag == _vm->_keyMap[Common::KEYCODE_SPACE] || inputFlag == _vm->_keyMap[Common::KEYCODE_KP5] || inputFlag == _vm->_keyMap[Common::KEYCODE_ESCAPE]) { + processSpecialButton(9); + res = 0; + loop = false; + } else if (inputFlag == _vm->_keyMap[Common::KEYCODE_LEFT] || inputFlag == _vm->_keyMap[Common::KEYCODE_RIGHT]) { + cbx ^= 1; + } else if (inputFlag == _vm->_keyMap[Common::KEYCODE_UP] || inputFlag == _vm->_keyMap[Common::KEYCODE_DOWN]) { + cbx ^= 2; + } + + if (inputFlag & 0x8000) { + inputFlag = (inputFlag & 0x0f) - 1; + if (inputFlag == 4) { + res = 1; + loop = false; + } else if (inputFlag == 5) { + processSpecialButton(9); + res = 0; + loop = false; + } else if (inputFlag == 6) { + if (_characters[_activeBox].name[0]) { + processSpecialButton(16); + _characters[_activeBox].name[0] = 0; + processNameInput(_activeBox, 1, 12); + processFaceMenuSelection(_activeBox + 50); + } + } else { + cbx = inputFlag; + } + } + + if (loop == false) + highlightBoxFrame(-1); + + if (!_characters[cbx].name[0]) + loop = false; + + if (cbx != _activeBox) { + _activeBox = cbx; + highlightBoxFrame(-1); + if (loop) + printStats(_activeBox, 2); + } + } + + return res; +} + +void CharacterGenerator::createPartyMember() { + _screen->setScreenDim(2); + _chargenBoxTimer = 0; + + for (int i = 0; i != 3 && !_vm->shouldQuit(); i++) { + bool bck = false; + + switch (i) { + case 0: + _characters[_activeBox].raceSex = raceSexMenu(); + break; + case 1: + _characters[_activeBox].cClass = classMenu(_characters[_activeBox].raceSex); + if (_characters[_activeBox].cClass == _vm->_keyMap[Common::KEYCODE_ESCAPE]) + bck = true; + break; + case 2: + _characters[_activeBox].alignment = alignmentMenu(_characters[_activeBox].cClass); + if (_characters[_activeBox].alignment == _vm->_keyMap[Common::KEYCODE_ESCAPE]) + bck = true; + break; + default: + break; + } + + if (bck) + i -= 2; + }; + + if (!_vm->shouldQuit()) { + generateStats(_activeBox); + statsAndFacesMenu(); + + for (_characters[_activeBox].name[0] = 0; _characters[_activeBox].name[0] == 0 && !_vm->shouldQuit(); ) { + processFaceMenuSelection(_chargenMinStats[6]); + printStats(_activeBox, 0); + _screen->printShadedText(_chargenStrings2[11], 149, 100, 9, 0); + if (!_vm->shouldQuit()) + processNameInput(_activeBox, _vm->_gui->getTextInput(_characters[_activeBox].name, 24, 100, 10, 15, 0, 8), 2); + } + } +} + +int CharacterGenerator::raceSexMenu() { + _screen->drawBox(_chargenBoxX[_activeBox], _chargenBoxY[_activeBox], _chargenBoxX[_activeBox] + 32, _chargenBoxY[_activeBox] + 33, 12); + _screen->copyRegion(0, 0, 144, 64, 160, 128, 2, 0, Screen::CR_NO_P_CHECK); + _screen->printShadedText(_chargenStrings2[8], 147, 67, 9, 0); + _vm->removeInputTop(); + + _vm->_gui->setupMenu(1, 0, _chargenRaceSexStrings, -1, 0, 0); + int16 res = -1; + + while (res == -1 && !_vm->shouldQuit()) { + res = _vm->_gui->handleMenu(1, _chargenRaceSexStrings, 0, -1, 0); + updateMagicShapes(); + } + + return res; +} + +int CharacterGenerator::classMenu(int raceSex) { + int32 itemsMask = -1; + + for (int i = 0; i < 4; i++) { + // check for evil characters + if (_characters[i].name[0] && _characters[i].alignment > 5) + itemsMask = 0xFFFB; + } + + _vm->removeInputTop(); + updateMagicShapes(); + + _screen->copyRegion(0, 0, 144, 64, 160, 128, 2, 0, Screen::CR_NO_P_CHECK); + _screen->printShadedText(_chargenStrings2[9], 147, 67, 9, 0); + + toggleSpecialButton(5, 0, 0); + + itemsMask &=_classMenuMasks[raceSex / 2]; + _vm->_gui->setupMenu(2, 15, _chargenClassStrings, itemsMask, 0, 0); + + _vm->_mouseX = _vm->_mouseY = 0; + int16 res = -1; + + while (res == -1 && !_vm->shouldQuit()) { + updateMagicShapes(); + + int in = _vm->checkInput(0, false, 0) & 0xff; + Common::Point mp = _vm->getMousePos(); + + if (in == _vm->_keyMap[Common::KEYCODE_ESCAPE] || _vm->_gui->_menuLastInFlags == _vm->_keyMap[Common::KEYCODE_ESCAPE] || _vm->_gui->_menuLastInFlags == _vm->_keyMap[Common::KEYCODE_b]) { + res = _vm->_keyMap[Common::KEYCODE_ESCAPE]; + } else if (_vm->posWithinRect(mp.x, mp.y, 264, 171, 303, 187)) { + if (in == 199 || in == 201) + res = _vm->_keyMap[Common::KEYCODE_ESCAPE]; + else + _vm->removeInputTop(); + } else { + res = _vm->_gui->handleMenu(2, _chargenClassStrings, 0, itemsMask, 0); + } + } + + _vm->removeInputTop(); + + if (res == _vm->_keyMap[Common::KEYCODE_ESCAPE]) + processSpecialButton(5); + + return res; +} + +int CharacterGenerator::alignmentMenu(int cClass) { + int32 itemsMask = -1; + + for (int i = 0; i < 4; i++) { + // check for paladins + if (_characters[i].name[0] && _characters[i].cClass == 2) + itemsMask = 0xFE3F; + } + + _vm->removeInputTop(); + updateMagicShapes(); + + _screen->copyRegion(0, 0, 144, 64, 160, 128, 2, 0, Screen::CR_NO_P_CHECK); + _screen->printShadedText(_chargenStrings2[10], 147, 67, 9, 0); + + toggleSpecialButton(5, 0, 0); + + itemsMask &=_alignmentMenuMasks[cClass]; + _vm->_gui->setupMenu(3, 9, _chargenAlignmentStrings, itemsMask, 0, 0); + + _vm->_mouseX = _vm->_mouseY = 0; + int16 res = -1; + + while (res == -1 && !_vm->shouldQuit()) { + updateMagicShapes(); + + int in = _vm->checkInput(0, false, 0) & 0xff; + Common::Point mp = _vm->getMousePos(); + + if (in == _vm->_keyMap[Common::KEYCODE_ESCAPE] || _vm->_gui->_menuLastInFlags == _vm->_keyMap[Common::KEYCODE_ESCAPE] || _vm->_gui->_menuLastInFlags == _vm->_keyMap[Common::KEYCODE_b]) { + res = _vm->_keyMap[Common::KEYCODE_ESCAPE]; + } else if (_vm->posWithinRect(mp.x, mp.y, 264, 171, 303, 187)) { + if (in == 199 || in == 201) + res = _vm->_keyMap[Common::KEYCODE_ESCAPE]; + else + _vm->removeInputTop(); + } else { + res = _vm->_gui->handleMenu(3, _chargenAlignmentStrings, 0, itemsMask, 0); + } + } + + _vm->removeInputTop(); + + if (res == _vm->_keyMap[Common::KEYCODE_ESCAPE]) + processSpecialButton(5); + + return res; +} + +void CharacterGenerator::updateMagicShapes() { + _vm->sound()->process(); + + if (_magicShapesBox != _activeBox) { + _chargenMagicShapeTimer = 0; + _magicShapesBox = _activeBox; + } + + if (_chargenMagicShapeTimer < _vm->_system->getMillis()) { + if (++_updateBoxShapesIndex > 9) + _updateBoxShapesIndex = 0; + _chargenMagicShapeTimer = _vm->_system->getMillis() + 2 * _vm->_tickLength; + } + + if (_updateBoxShapesIndex == _lastUpdateBoxShapesIndex) + return; + + _screen->copyRegion(_activeBox << 5, 128, 288, 128, 32, 32, 2, 2, Screen::CR_NO_P_CHECK); + _screen->drawShape(2, _chargenMagicShapes[_updateBoxShapesIndex], 288, 128, 0); + _screen->copyRegion(288, 128, _chargenBoxX[_activeBox], _chargenBoxY[_activeBox] + 1, 32, 32, 2, 0, Screen::CR_NO_P_CHECK); + _screen->updateScreen(); + + _lastUpdateBoxShapesIndex = _updateBoxShapesIndex; +} + +void CharacterGenerator::generateStats(int index) { + EobCharacter *c = &_characters[index]; + + for (int i = 0; i < 3; i++) { + c->level[i] = _chargenStartLevels[(c->cClass << 2) + i]; + c->experience[i] = (_vm->game() == GI_EOB2 ? 69000 : 5000) / _chargenStartLevels[(c->cClass << 2) + 3]; + } + + int rc = c->raceSex >> 1; + for (int i = 0; i < 6; i++) { + _chargenMinStats[i] = MAX(_chargenClassMinStats[c->cClass * 6 + i], _chargenRaceMinStats[rc * 6 + i]); + _chargenMaxStats[i] = _chargenRaceMaxStats[rc * 6 + i]; + } + + if (_vm->_charClassModUnk[c->cClass]) + _chargenMaxStats[0] = 18; + + uint16 sv[6]; + for (int i = 0; i < 6; i++) { + sv[i] = MAX(rollDice() + _raceModifiers[rc * 6 + i], _chargenMinStats[i]); + if (!i && sv[i] == 18) + sv[i] |= (uint16)(_vm->rollDice(1, 100) << 8); + if (sv[i] > _chargenMaxStats[i]) + sv[i] = _chargenMaxStats[i]; + } + + c->strengthCur = c->strengthMax = sv[0] & 0xff; + c->strengthExtCur = c->strengthExtMax = sv[0] >> 8; + c->intelligenceCur = c->intelligenceMax = sv[1] & 0xff; + c->wisdomCur = c->wisdomMax = sv[2] & 0xff; + c->dexterityCur = c->dexterityMax = sv[3] & 0xff; + c->constitutionCur = c->constitutionMax = sv[4] & 0xff; + c->charismaCur = c->charismaMax = sv[5] & 0xff; + c->armorClass = 10 + _vm->getDexterityArmorClassModifier(sv[3] & 0xff); + c->hitPointsCur = 0; + + for (int l = 0; l < 3; l++) { + for (int i = 0; i < c->level[l]; i++) + c->hitPointsCur += _vm->generateCharacterHitpointsByLevel(index, 1 << l); + } + + c->hitPointsMax = c->hitPointsCur; +} + +void CharacterGenerator::modifyMenu() { + _vm->removeInputTop(); + printStats(_activeBox, 3); + + EobCharacter *c = &_characters[_activeBox]; + int8 hpLO = c->hitPointsCur; + + for (int i = 0; i >= 0 && i < 7; ) { + switch (i) { + case 0: + i = modifyStat(i, &c->strengthCur, &c->strengthExtCur); + break; + case 1: + i = modifyStat(i, &c->intelligenceCur, 0); + break; + case 2: + i = modifyStat(i, &c->wisdomCur, 0); + break; + case 3: + i = modifyStat(i, &c->dexterityCur, 0); + break; + case 4: + i = modifyStat(i, &c->constitutionCur, 0); + break; + case 5: + i = modifyStat(i, &c->charismaCur, 0); + break; + case 6: + hpLO = c->hitPointsCur; + i = modifyStat(i, &hpLO, 0); + c->hitPointsCur = hpLO; + break; + default: + break; + } + + if (i == -2 || _vm->shouldQuit()) + break; + else if (i < 0) + i = 6; + i %= 7; + + printStats(_activeBox, 3); + } + + printStats(_activeBox, 1); +} + +void CharacterGenerator::statsAndFacesMenu() { + faceSelectMenu(); + printStats(_activeBox, 1); + initButtonsFromList(27, 4); + _vm->removeInputTop(); + int in = 0; + + while (!in && !_vm->shouldQuit()) { + updateMagicShapes(); + in = _vm->checkInput(_vm->_activeButtons, false, 0); + _vm->removeInputTop(); + + if (in == 0x8001) { + processSpecialButton(4); + updateMagicShapes(); + generateStats(_activeBox); + in = -1; + } else if (in == 0x8002) { + processSpecialButton(7); + modifyMenu(); + in = -1; + } else if (in == 0x8003) { + processSpecialButton(8); + faceSelectMenu(); + in = -1; + } else if (in == 0x8004 || in == _vm->_keyMap[Common::KEYCODE_KP5]) { + processSpecialButton(6); + in = 1; + } else { + in = 0; + } + + if (in & 0x8000) { + printStats(_activeBox, 1); + initButtonsFromList(27, 4); + in = 0; + } + } + + highlightBoxFrame(6 + _activeBox); + highlightBoxFrame(-1); +} + +void CharacterGenerator::faceSelectMenu() { + int8 sp[4]; + memcpy(sp, _chargenSelectedPortraits2, sizeof(sp)); + _vm->removeInputTop(); + initButtonsFromList(21, 6); + + int charSex = _characters[_activeBox].raceSex % 2; + int8 shp = charSex ? 26 : 0; + + printStats(_activeBox, 4); + toggleSpecialButton(12, 0, 0); + toggleSpecialButton(13, 0, 0); + highlightBoxFrame(-1); + + shp = getNextFreeFaceShape(shp, charSex, 1, _chargenSelectedPortraits); + + int res = -1; + int box = 1; + + while (res == -1 && !_vm->shouldQuit()) { + int8 shpOld = shp; + + for (int i = 0; i < 4; i++) { + sp[i] = shp; + _screen->drawShape(0, _faceShapes[sp[i]], 176 + (i << 5), 66, 0); + shp = getNextFreeFaceShape(shp + 1, charSex, 1, _chargenSelectedPortraits); + } + + shp = shpOld; + int in = 0; + + while (!in && !_vm->shouldQuit()) { + updateMagicShapes(); + in = _vm->checkInput(_vm->_activeButtons, false, 0); + _vm->removeInputTop(); + + highlightBoxFrame(box + 10); + + if (in == 0x8002 || in == _vm->_keyMap[Common::KEYCODE_RIGHT]) { + processSpecialButton(13); + in = 2; + } else if (in > 0x8002 && in < 0x8007) { + box = (in & 7) - 3; + in = 3; + } else if (in == 0x8001 || in == _vm->_keyMap[Common::KEYCODE_LEFT]) { + processSpecialButton(12); + in = 1; + } else if (in == _vm->_keyMap[Common::KEYCODE_RETURN] || in == _vm->_keyMap[Common::KEYCODE_KP5]) { + in = 3; + } else if (in & 0x8000) { + in &= 0xff; + } else { + in = 0; + } + } + + highlightBoxFrame(-1); + + if (in == 1) + shp = getNextFreeFaceShape(shp - 1, charSex, -1, _chargenSelectedPortraits); + else if (in == 2) + shp = getNextFreeFaceShape(shp + 1, charSex, 1, _chargenSelectedPortraits); + else if (in == 3) + res = box; + } + + if (!_vm->shouldQuit()) { + highlightBoxFrame(-1); + updateMagicShapes(); + + _chargenSelectedPortraits[_activeBox] = sp[res]; + _characters[_activeBox].portrait = sp[res]; + _characters[_activeBox].faceShape = _faceShapes[sp[res]]; + + printStats(_activeBox, 1); + } +} + +int CharacterGenerator::getNextFreeFaceShape(int shpIndex, int charSex, int step, int8 *selectedPortraits) { + int shpCur = ((shpIndex < 0) ? 43 : shpIndex) % 44; + bool notUsable = false; + + do { + notUsable = false; + for (int i = 0; i < 4; i++) { + if (_characters[i].name[0] && selectedPortraits[i] == shpCur) + notUsable = true; + } + + if ((charSex && (shpCur < 26)) || (!charSex && (shpCur > 28))) + notUsable = true; + + if (notUsable) { + shpCur += step; + shpCur = ((shpCur < 0) ? 43 : shpCur) % 44; + } + } while (notUsable); + + return shpCur; +} + +void CharacterGenerator::processFaceMenuSelection(int index) { + highlightBoxFrame(-1); + if (index <= 48) + _screen->drawShape(0, _characters[_activeBox].faceShape, _chargenBoxX[_activeBox], _chargenBoxY[_activeBox] + 1, 0); + else + toggleSpecialButton(index - 50, 0, 0); +} + +void CharacterGenerator::printStats(int index, int mode) { + _screen->copyRegion(0, 0, 160, 0, 160, 128, 2, 2, Screen::CR_NO_P_CHECK); + _screen->_curPage = 2; + + EobCharacter *c = &_characters[index]; + + if (mode != 4) + _screen->drawShape(2, c->faceShape, 224, 2, 0); + + _screen->printShadedText(c->name, 160 + ((20 - strlen(c->name)) << 2), 35, 15, 0); + _screen->printShadedText(_chargenRaceSexStrings[c->raceSex], 160 + ((20 - strlen(_chargenRaceSexStrings[c->raceSex])) << 2), 45, 15, 0); + _screen->printShadedText(_chargenClassStrings[c->cClass], 160 + ((20 - strlen(_chargenClassStrings[c->cClass])) << 2), 54, 15, 0); + + for (int i = 0; i < 6; i++) + _screen->printShadedText(_chargenStatStrings[i], 163, (i + 8) << 3, 15, 0); + + _screen->printShadedText(_chargenStrings1[2], 248, 64, 15, 0); + + char str[22]; + snprintf(str, 22, _chargenStrings1[3], _vm->getCharStrength(c->strengthCur, c->strengthExtCur), c->intelligenceCur, c->wisdomCur, c->dexterityCur, c->constitutionCur, c->charismaCur); + _screen->printShadedText(str, 192, 64, 15, 0); + + snprintf(str, 22, _chargenStrings1[4], c->armorClass, c->hitPointsMax); + _screen->printShadedText(str, 280, 64, 15, 0); + + const char *lvlStr = c->level[2] ? _chargenStrings1[7] : (c->level[1] ? _chargenStrings1[6] : _chargenStrings1[5]); + snprintf(str, 22, lvlStr, c->level[0], c->level[1], c->level[2]); + _screen->printShadedText(str, 280, 80, 15, 0); + + switch (mode) { + case 1: + toggleSpecialButton(4, 0, 2); + toggleSpecialButton(7, 0, 2); + toggleSpecialButton(8, 0, 2); + toggleSpecialButton(6, 0, 2); + break; + + case 2: + toggleSpecialButton(16, 0, 2); + toggleSpecialButton(9, 0, 2); + break; + + case 3: + toggleSpecialButton(10, 0, 2); + toggleSpecialButton(11, 0, 2); + toggleSpecialButton(9, 0, 2); + break; + + default: + break; + } + + _screen->copyRegion(160, 0, 144, 64, 160, 128, 2, 0, Screen::CR_NO_P_CHECK); + + if (mode != 3) + _screen->updateScreen(); + + _screen->_curPage = 0; +} + +void CharacterGenerator::processNameInput(int index, int len, int textColor) { + Screen::FontId of = _screen->setFont(Screen::FID_6_FNT); + + // WORKAROUND for bug in original code: + len = strlen(_characters[index].name); + + int xOffs = (60 - _screen->getFontWidth() * len) >> 1; + _screen->printText(_chargenStrings1[1], _chargenNameFieldX[index], _chargenNameFieldY[index], 12, 12); + _screen->printText(_characters[index].name, _chargenNameFieldX[index] + xOffs, _chargenNameFieldY[index], textColor, 0); + _screen->updateScreen(); + _screen->setFont(of); +} + +int CharacterGenerator::rollDice() { + int res = 0; + int min = 10; + + for (int i = 0; i < 4; i++) { + int d = _vm->rollDice(1, 6, 0); + res += d; + if (d < min) + min = d; + } + + res -= min; + return res; +} + +int CharacterGenerator::modifyStat(int index, int8 *stat1, int8 *stat2) { + uint8 *s1 = (uint8*) stat1; + uint8 *s2 = (uint8*) stat2; + + initButtonsFromList(31, 10); + Button *b = _vm->gui_getButton(_vm->_activeButtons, index + 1); + + printStats(_activeBox, 3); + _vm->removeInputTop(); + + char statStr[6]; + if (index) + snprintf(statStr, 6, "%d", *s1); + else + snprintf(statStr, 6, "%s", _vm->getCharStrength(*s1, *s2)); + + _screen->copyRegion(b->x - 112, b->y - 64, b->x + 32, b->y, 40, b->height, 2, 0, Screen::CR_NO_P_CHECK); + _screen->printShadedText(statStr, b->x + 32, b->y, 6, 0); + _screen->updateScreen(); + + EobCharacter *c = &_characters[_activeBox]; + + int ci = index; + uint8 v2 = s2 ? *s2 : 0; + + if (index == 6) { + _chargenMaxStats[6] = getMaxHp(c->cClass, c->constitutionCur, c->level[0], c->level[1], c->level[2]); + _chargenMinStats[6] = getMinHp(c->cClass, c->constitutionCur, c->level[0], c->level[1], c->level[2]); + } + + for (bool loop = true; loop && !_vm->shouldQuit(); ) { + uint8 v1 = *s1; + updateMagicShapes(); + int inputFlag = _vm->checkInput(_vm->_activeButtons, false, 0); + _vm->removeInputTop(); + + if (inputFlag == _vm->_keyMap[Common::KEYCODE_LEFT] || inputFlag == _vm->_keyMap[Common::KEYCODE_KP4] || inputFlag == _vm->_keyMap[Common::KEYCODE_MINUS] || inputFlag == _vm->_keyMap[Common::KEYCODE_KP_MINUS] || inputFlag == 0x8009) { + processSpecialButton(11); + v1--; + + } else if (inputFlag == _vm->_keyMap[Common::KEYCODE_RIGHT] || inputFlag == _vm->_keyMap[Common::KEYCODE_KP6] || inputFlag == _vm->_keyMap[Common::KEYCODE_PLUS] || inputFlag == _vm->_keyMap[Common::KEYCODE_KP_PLUS] || inputFlag == 0x8008) { + processSpecialButton(10); + v1++; + + } else if (inputFlag == _vm->_keyMap[Common::KEYCODE_UP] || inputFlag == _vm->_keyMap[Common::KEYCODE_KP8]) { + ci = --ci % 7; + loop = false; + + } else if (inputFlag == _vm->_keyMap[Common::KEYCODE_DOWN] || inputFlag == _vm->_keyMap[Common::KEYCODE_KP2]) { + ci = ++ci % 7; + loop = false; + + } else if (inputFlag == _vm->_keyMap[Common::KEYCODE_o] || inputFlag == _vm->_keyMap[Common::KEYCODE_KP5] || inputFlag == _vm->_keyMap[Common::KEYCODE_ESCAPE] || inputFlag == 0x800A) { + processSpecialButton(9); + loop = false; + ci = -2; + + } else if (inputFlag & 0x8000) { + inputFlag = (inputFlag & 0x0f) - 1; + if (index != inputFlag) { + ci = inputFlag; + loop = false; + } + } + + if (v1 == *s1) + continue; + + if (!index) { + while (v1 > 18) { + v1--; + v2++; + } + while (v2 > 0 && v1 < 18) { + v1++; + v2--; + } + + v1 = CLIP(v1, _chargenMinStats[index], _chargenMaxStats[index] & 0xff); + v2 = (v1 == 18 && _chargenMaxStats[index] >= 19) ? CLIP(v2, 0, 100) : 0; + if (s2) + *s2 = v2; + else + error("CharacterGenerator::modifyStat:..."); + } else { + v1 = CLIP(v1, _chargenMinStats[index], _chargenMaxStats[index]); + } + + *s1 = v1; + + if (index == 6) + _characters[_activeBox].hitPointsMax = v1; + + if (index) + snprintf(statStr, 6, "%d", *s1); + else + snprintf(statStr, 6, "%s", _vm->getCharStrength(*s1, *s2)); + + _screen->copyRegion(b->x - 112, b->y - 64, b->x + 32, b->y, 40, b->height, 2, 0, Screen::CR_NO_P_CHECK); + _screen->printShadedText(statStr, b->x + 32, b->y, 6, 0); + _screen->updateScreen(); + + if (index == 4) { + int oldVal = c->hitPointsCur; + _chargenMaxStats[6] = getMaxHp(c->cClass, c->constitutionCur, c->level[0], c->level[1], c->level[2]); + _chargenMinStats[6] = getMinHp(c->cClass, c->constitutionCur, c->level[0], c->level[1], c->level[2]); + c->hitPointsMax = c->hitPointsCur = CLIP(c->hitPointsCur, _chargenMinStats[6], _chargenMaxStats[6]); + + if (c->hitPointsCur != oldVal) { + snprintf(statStr, 6, "%d", c->hitPointsCur); + _screen->copyRegion(120, 72, 264, 136, 40, 8, 2, 0, Screen::CR_NO_P_CHECK); + _screen->printShadedText(statStr, 264, 136, 15, 0); + _screen->updateScreen(); + } + + } else if (index == 3) { + int oldVal = c->armorClass; + c->armorClass = _vm->getDexterityArmorClassModifier(v1) + 10; + + if (c->armorClass != oldVal) { + snprintf(statStr, 6, "%d", c->armorClass); + _screen->copyRegion(120, 64, 264, 128, 40, 8, 2, 0, Screen::CR_NO_P_CHECK); + _screen->printShadedText(statStr, 264, 128, 15, 0); + _screen->updateScreen(); + } + } + + if (loop = false) { + if (index) + snprintf(statStr, 6, "%d", *s1); + else + snprintf(statStr, 6, "%s", _vm->getCharStrength(*s1, *s2)); + _screen->printText(statStr, b->x + 32, b->y, 15, 0); + _screen->updateScreen(); + } + } + + return ci; +} + +int CharacterGenerator::getMaxHp(int cclass, int constitution, int level1, int level2, int level3) { + int res = 0; + constitution = _vm->getClassAndConstHitpointsModifier(cclass, constitution); + + int m = _vm->getClassHpIncreaseType(cclass, 0); + if (m != -1) + res = _vm->getModifiedHpLimits(m, constitution, level1, false); + + m = _vm->getClassHpIncreaseType(cclass, 1); + if (m != -1) + res += _vm->getModifiedHpLimits(m, constitution, level2, false); + + m = _vm->getClassHpIncreaseType(cclass, 2); + if (m != -1) + res += _vm->getModifiedHpLimits(m, constitution, level3, false); + + res /= _vm->_numLevelsPerClass[cclass]; + + return res; +} + +int CharacterGenerator::getMinHp(int cclass, int constitution, int level1, int level2, int level3) { + int res = 0; + constitution = _vm->getClassAndConstHitpointsModifier(cclass, constitution); + + int m = _vm->getClassHpIncreaseType(cclass, 0); + if (m != -1) + res = _vm->getModifiedHpLimits(m, constitution, level1, true); + + m = _vm->getClassHpIncreaseType(cclass, 1); + if (m != -1) + res += _vm->getModifiedHpLimits(m, constitution, level2, true); + + m = _vm->getClassHpIncreaseType(cclass, 2); + if (m != -1) + res += _vm->getModifiedHpLimits(m, constitution, level3, true); + + res /= _vm->_numLevelsPerClass[cclass]; + + return res; +} + +void CharacterGenerator::finish() { + _screen->copyRegion(0, 0, 160, 0, 160, 128, 2, 2, Screen::CR_NO_P_CHECK); + int cp = _screen->setCurPage(2); + _screen->printShadedText(_chargenEnterGameStrings[0], 168, 32, 15, 0); + _screen->setCurPage(cp); + _screen->copyRegion(160, 0, 144, 64, 160, 128, 2, 0, Screen::CR_NO_P_CHECK); + _screen->updateScreen(); + + if (_vm->game() == GI_EOB1) { + static const int8 classDefaultItemsList[] = { 1, 17, 2, 17, 46, -1, 4, -1, 5, -1, 6, 2, 7, -1, 8, -1, 9, 21, 10, 2, 31, 2 }; + static const int8 classDefaultItemsListIndex[] = { 4, 8, 0, -1, 4, 3, 0, -1, 4, 10, 0, 8, 3, 6, 1, -1, 2, 7, 0, -1, + 4, 5, 0, -1, 4, 7, 0, 8, 4, 5, 0, 8, 4, 6, 8, 8, 4, 6, 5, 8, 3, 6, 5, -1, 2, 7, 5, 0, 4, 6, 7, 0, 4, 3, 7, 0, 2, 6, 7, 1 }; + + _characters[0].inventory[2] = _vm->duplicateItem(35); + + for (int i = 0; i < 4; i++) { + EobCharacter *c = &_characters[i]; + c->flags = 1; + c->food = 100; + c->id = i; + c->inventory[3] = _vm->duplicateItem(10); + + for (int ii = 0; ii < 4; ii++) { + int l = classDefaultItemsListIndex[(c->cClass << 2) + ii] << 1; + if (classDefaultItemsList[l] == -1) + continue; + + int d = classDefaultItemsList[l]; + int slot = classDefaultItemsList[l + 1]; + + if (slot < 0) { + slot = 0; + if (c->inventory[slot]) + slot++; + if (c->inventory[slot]) + slot++; + } + + if (slot != 2 && c->inventory[slot]) + continue; + + if (d == 5 && (c->raceSex >> 1) == 3) + d = 36; + + if (slot == 2) { + while (c->inventory[slot]) + slot++; + } + + c->inventory[slot] = _vm->duplicateItem(d); + } + + _vm->recalcArmorClass(i); + } + + } else { + static const uint8 classDefaultItemsListIndex[] = { 0, 0, 0, 1, 2, 3, 0, 0, 0, 0, 3, 2, 0, 0, 2 }; + static const int8 itemList0[] = { 3, 36, 0, 17, -1, 0, 0, 56, 1, 17, 31, 0, 1, 23, 1, 17, 31, 1, 1 }; + static const int8 itemList1[] = { 1, 2, 0, 17, -1, 0, 0 }; + static const int8 itemList2[] = { 2, 56, 1, 17, 31, 0, 1, 23, 1, 17, 31, 0, 1 }; + static const int8 itemList3[] = { 2, 1, 1, 17, 31, 1, 1, 1, 0, 17, 31, 2, 1 }; + static const int8 *itemList[] = { itemList0, itemList1, itemList2, itemList3 }; + + for (int i = 0; i < 4; i++) { + EobCharacter *c = &_characters[i]; + c->flags = 1; + c->food = 100; + c->id = i; + const int8 *df = itemList[classDefaultItemsListIndex[c->cClass]]; + int v1 = _vm->rollDice(1, *df++, -1); + + df = &df[v1 * 6]; + for (int ii = 0; ii < 2; ii++) { + if (df[0] == -1) + break; + _vm->createInventoryItem(c, df[0], df[1], df[2]); + df = &df[3]; + } + + uint16 m = _vm->_classModifierFlags[c->cClass]; + v1 = _vm->rollDice(1, 2, -1); + + int ival = 0; + int itype = 0; + + if (m & 0x31) { + if ((c->raceSex >> 1) == 3) { + itype = 22; + ival = 1; + } else { + if (v1 == 0) { + itype = 5; + ival = 1; + } else { + itype = 34; + } + } + } else if (m & 0x04) { + itype = 26; + if (v1 != 0) + ival = 1; + } else if (m & 0x08) { + ival = 1; + itype = ((c->raceSex >> 1) == 3) ? 22 : 5; + } else { + if (v1 == 0) { + itype = 3; + } else { + itype = 4; + ival = 1; + } + } + + _vm->createInventoryItem(c, itype, ival, 0); + _vm->createInventoryItem(c, 10, -1, 2); + _vm->createInventoryItem(c, 10, -1, 2); + _vm->createInventoryItem(c, 24, 2, 2); + + if (_vm->_classModifierFlags[c->cClass] & 2) { + _vm->createInventoryItem(c, 7, -1, 1); + _vm->createInventoryItem(c, 21, 4, 2); + _vm->createInventoryItem(c, 21, 13, 2); + } + + if (_vm->_classModifierFlags[c->cClass] & 0x14) { + if (c->cClass == 2) + _vm->createInventoryItem(c, 27, -1, 1); + else + _vm->createInventoryItem(c, 8, -1, 1); + + _vm->createInventoryItem(c, 20, 49, 1); + } + + if (_vm->_classModifierFlags[c->cClass] & 8) + _vm->createInventoryItem(c, 6, -1, 1); + + if (i == 0) + _vm->createInventoryItem(c, 93, -1, 2); + + _vm->recalcArmorClass(i); + } + } + + for (int i = 0; i < 4; i++) { + if (_vm->_classModifierFlags[_characters[i].cClass] & 2) + _characters[i].mageSpellsAvailabilityFlags = (_vm->game() == GI_EOB2) ? 0x81CB6 : 0x26C; + + if (_vm->_classModifierFlags[_characters[i].cClass] & 0x14 && _vm->game() == GI_EOB2) { + // Cleric: Turn Undead + _characters[i].clericSpells[0] = 29; + } + } + + for (int i = 0; i < 4; i++) { + EobCharacter *c = &_characters[i]; + c->strengthMax = c->strengthCur; + c->strengthExtMax = c->strengthExtCur; + c->intelligenceMax = c->intelligenceCur; + c->wisdomMax = c->wisdomCur; + c->dexterityMax = c->dexterityCur; + c->constitutionMax = c->constitutionCur; + c->charismaMax = c->charismaCur; + c->hitPointsMax = c->hitPointsCur; + } + + _vm->gui_resetButtonList(); + + if (_faceShapes) { + for (int i = 0; i < 44; i++) { + bool del = true; + for (int ii = 0; ii < 4; ii++) { + if (_characters[ii].faceShape == _faceShapes[i]) + del = false; + } + if (del) + delete[] _faceShapes[i]; + } + delete[] _faceShapes; + _faceShapes = 0; + } + + if (_chargenMagicShapes) { + for (int i = 0; i < 10; i++) + delete[] _chargenMagicShapes[i]; + delete[] _chargenMagicShapes; + _chargenMagicShapes = 0; + } + + if (_chargenButtonLabels) { + for (int i = 0; i < 10; i++) + delete[] _chargenButtonLabels[i]; + delete[] _chargenButtonLabels; + _chargenButtonLabels = 0; + } +} + +const EobChargenButtonDef CharacterGenerator::_chargenButtonDefs[] = { + { 0x01, 0x37, 0x31, 0x32, 0x70 }, + { 0x09, 0x37, 0x31, 0x32, 0x71 }, + { 0x01, 0x77, 0x31, 0x32, 0x72 }, + { 0x09, 0x77, 0x31, 0x32, 0x73 }, + { 0x03, 0xB5, 0x53, 0x10, 0x1A }, + { 0x21, 0xAC, 0x26, 0x10, 0x19 }, + { 0x1C, 0xAC, 0x26, 0x10, 0x21 }, + { 0x21, 0xAC, 0x26, 0x10, 0x32 }, + { 0x13, 0x50, 0x9A, 0x08, 0x00 }, + { 0x13, 0x58, 0x9A, 0x08, 0x00 }, + { 0x13, 0x60, 0x9A, 0x08, 0x00 }, + { 0x13, 0x68, 0x9A, 0x08, 0x00 }, + { 0x13, 0x70, 0x9A, 0x08, 0x00 }, + { 0x13, 0x78, 0x9A, 0x08, 0x00 }, + { 0x13, 0x80, 0x9A, 0x08, 0x00 }, + { 0x13, 0x88, 0x9A, 0x08, 0x00 }, + { 0x13, 0x90, 0x9A, 0x08, 0x00 }, + { 0x13, 0x98, 0x9A, 0x08, 0x00 }, + { 0x13, 0xA0, 0x9A, 0x08, 0x00 }, + { 0x13, 0xA8, 0x9A, 0x08, 0x00 }, + { 0x13, 0xB0, 0x9A, 0x08, 0x00 }, + { 0x12, 0x42, 0x20, 0x10, 0x00 }, + { 0x12, 0x52, 0x20, 0x10, 0x00 }, + { 0x16, 0x42, 0x20, 0x20, 0x00 }, + { 0x1A, 0x42, 0x20, 0x20, 0x00 }, + { 0x1E, 0x42, 0x20, 0x20, 0x00 }, + { 0x22, 0x42, 0x20, 0x20, 0x00 }, + { 0x1C, 0x9C, 0x26, 0x10, 0x14 }, + { 0x21, 0x9C, 0x26, 0x10, 0x34 }, + { 0x1C, 0xAC, 0x26, 0x10, 0x22 }, + { 0x21, 0xAC, 0x26, 0x10, 0x26 }, + { 0x12, 0x80, 0x35, 0x08, 0x00 }, + { 0x12, 0x88, 0x35, 0x08, 0x00 }, + { 0x12, 0x90, 0x35, 0x08, 0x00 }, + { 0x12, 0x98, 0x35, 0x08, 0x00 }, + { 0x12, 0xA0, 0x35, 0x08, 0x00 }, + { 0x12, 0xA8, 0x35, 0x08, 0x00 }, + { 0x1D, 0x88, 0x35, 0x08, 0x00 }, + { 0x1B, 0xAC, 0x15, 0x10, 0x0D }, + { 0x1E, 0xAC, 0x15, 0x10, 0x0C }, + { 0x21, 0xAC, 0x25, 0x10, 0x19 } +}; + +const CreatePartyModButton CharacterGenerator::_chargenModButtons[] = { + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0A, 0x40 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x80 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x0A, 0x80 }, + { 0x00, 0xC0, 0x04, 0x05, 0x07, 0x05, 0x08, 0x1C, 0x9C }, + { 0x04, 0xC0, 0x03, 0x05, 0x0A, 0x05, 0x08, 0x21, 0xAC }, + { 0x07, 0xC0, 0x03, 0x05, 0x0B, 0x05, 0x08, 0x21, 0xAC }, + { 0x0A, 0xC0, 0x04, 0x05, 0x06, 0x05, 0x08, 0x21, 0x9C }, + { 0x18, 0xC0, 0x03, 0x05, 0x09, 0x05, 0x08, 0x1C, 0xAC }, + { 0x0E, 0xC0, 0x02, 0x05, 0x0F, 0x05, 0x08, 0x21, 0xAC }, + { 0x10, 0xC0, 0x01, 0x05, 0x09, 0x05, 0x04, 0x1B, 0xAC }, + { 0x11, 0xC0, 0x01, 0x01, 0x09, 0x07, 0x04, 0x1E, 0xAC }, + { 0x12, 0xC0, 0x03, 0x07, 0x07, 0x04, 0x06, 0x12, 0x42 }, + { 0x15, 0xC0, 0x03, 0x07, 0x07, 0x04, 0x06, 0x12, 0x52 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x03, 0xB5 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x03, 0xB5 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x1C, 0xAC } +}; + +const EobRect8 CharacterGenerator::_chargenButtonBodyCoords[] = { + { 0x00, 0x80, 0x04, 0x20 }, + { 0x04, 0x80, 0x04, 0x20 }, + { 0x08, 0x80, 0x04, 0x20 }, + { 0x0C, 0x80, 0x04, 0x20 }, + { 0x0E, 0xA0, 0x03, 0x10 }, + { 0x0B, 0xA0, 0x03, 0x10 }, + { 0x10, 0x80, 0x04, 0x10 }, + { 0x10, 0x90, 0x04, 0x10 }, + { 0x11, 0xA0, 0x05, 0x10 }, + { 0x11, 0xB0, 0x05, 0x10 }, + { 0x16, 0xA0, 0x05, 0x10 }, + { 0x16, 0xB0, 0x05, 0x10 }, + { 0x00, 0xA0, 0x0B, 0x10 }, + { 0x14, 0x80, 0x0B, 0x10 }, + { 0x14, 0x90, 0x0B, 0x10 } +}; + +const EobRect16 CharacterGenerator::_chargenPortraitBoxFrames[] = { + { 0x00B7, 0x0001, 0x00F7, 0x0034 }, + { 0x00FF, 0x0001, 0x013F, 0x0034 }, + { 0x00B7, 0x0035, 0x00F7, 0x0068 }, + { 0x00FF, 0x0035, 0x013F, 0x0068 }, + { 0x00B7, 0x0069, 0x00F7, 0x009C }, + { 0x00FF, 0x0069, 0x013F, 0x009C }, + { 0x0010, 0x003F, 0x0030, 0x0060 }, + { 0x0050, 0x003F, 0x0070, 0x0060 }, + { 0x0010, 0x007F, 0x0030, 0x00A0 }, + { 0x0050, 0x007F, 0x0070, 0x00A0 }, + { 0x00B0, 0x0042, 0x00D0, 0x0061 }, + { 0x00D0, 0x0042, 0x00F0, 0x0061 }, + { 0x00F0, 0x0042, 0x0110, 0x0061 }, + { 0x0110, 0x0042, 0x0130, 0x0061 }, + { 0x0004, 0x0018, 0x0024, 0x0039 }, + { 0x00A3, 0x0018, 0x00C3, 0x0039 }, + { 0x0004, 0x0040, 0x0024, 0x0061 }, + { 0x00A3, 0x0040, 0x00C3, 0x0061 }, + { 0x0004, 0x0068, 0x0024, 0x0089 }, + { 0x00A3, 0x0068, 0x00C3, 0x0089 } +}; + +const int16 CharacterGenerator::_chargenBoxX[] = { 0x10, 0x50, 0x10, 0x50 }; +const int16 CharacterGenerator::_chargenBoxY[] = { 0x3F, 0x3F, 0x7F, 0x7F }; +const int16 CharacterGenerator::_chargenNameFieldX[] = { 0x02, 0x42, 0x02, 0x42 }; +const int16 CharacterGenerator::_chargenNameFieldY[] = { 0x6B, 0x6B, 0xAB, 0xAB }; + +const int32 CharacterGenerator::_classMenuMasks[] = { + 0x003F, 0x07BB, 0x77FB, 0x00F1, 0x08F1, 0x00B1 +}; + +const int32 CharacterGenerator::_alignmentMenuMasks[] = { + 0x01FF, 0x0007, 0x0001, 0x01FF, 0x01FF, 0x01FE, 0x01FF, 0x01FE, + 0x01FF, 0x01FE, 0x01FE, 0x01FE, 0x01FF, 0x0007, 0x01FF +}; + +const int16 CharacterGenerator::_raceModifiers[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, -1, 0, 1, -1, 0, 0, 0, -1, 0, 0, 1, 0, 0 +}; + +} // End of namespace Kyra + +#endif // ENABLE_EOB diff --git a/engines/kyra/detection.cpp b/engines/kyra/detection.cpp index 68eb08210e..44fbc0fe68 100644 --- a/engines/kyra/detection.cpp +++ b/engines/kyra/detection.cpp @@ -17,12 +17,15 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * */ #include "kyra/kyra_lok.h" #include "kyra/lol.h" #include "kyra/kyra_hof.h" #include "kyra/kyra_mr.h" +#include "kyra/eob1.h" +#include "kyra/eob2.h" #include "common/config-manager.h" #include "common/system.h" @@ -129,6 +132,14 @@ bool KyraMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGame *engine = new Kyra::LoLEngine(syst, flags); break; #endif // ENABLE_LOL +#ifdef ENABLE_EOB + case Kyra::GI_EOB1: + *engine = new Kyra::EobEngine(syst, flags); + break; + case Kyra::GI_EOB2: + *engine = new Kyra::DarkMoonEngine(syst, flags); + break; +#endif // ENABLE_EOB default: res = false; warning("Kyra engine: unknown gameID"); diff --git a/engines/kyra/detection_tables.h b/engines/kyra/detection_tables.h index ebf7c8eee7..50a154dcf3 100644 --- a/engines/kyra/detection_tables.h +++ b/engines/kyra/detection_tables.h @@ -57,6 +57,9 @@ namespace { #define LOL_DEMO_FLAGS FLAGS(true, true, false, false, false, false, false, false, Kyra::GI_LOL) #define LOL_KYRA2_DEMO_FLAGS FLAGS(true, false, false, false, false, false, false, false, Kyra::GI_KYRA2) +#define EOB_FLAGS FLAGS(false, false, false, false, false, false, false, false, Kyra::GI_EOB1) +#define EOB2_FLAGS FLAGS(false, false, false, false, false, false, false, false, Kyra::GI_EOB2) + const KYRAGameDescription adGameDescs[] = { /* disable these targets until they get supported { @@ -1439,6 +1442,73 @@ const KYRAGameDescription adGameDescs[] = { LOL_KYRA2_DEMO_FLAGS }, #endif // ENABLE_LOL +#ifdef ENABLE_EOB + + { + { + "eob", + 0, + { + { "EOBDATA2.PAK", 0, "feaf0345086b3a1d931352f4b0ad8feb", -1 }, + { 0, 0, 0, 0 } + }, + Common::EN_ANY, + Common::kPlatformPC, + ADGF_NO_FLAGS, + GUIO3(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIPCSPK) + }, + EOB_FLAGS + }, + + { + { + "eob", + 0, + { + { "SHINDIA.CPS", 0, "383b0c7ba0903eae5d04cad28ce90aaf", -1 }, + { 0, 0, 0, 0 } + }, + Common::DE_DEU, + Common::kPlatformPC, + ADGF_NO_FLAGS, + GUIO3(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIPCSPK) + }, + EOB_FLAGS + }, + + { + { + "eob2", + 0, + { + { "LEVEL15.INF", 0, "10f19eab75c73d0476dc58bcf70fff7a", -1 }, + { 0, 0, 0, 0 } + }, + Common::EN_ANY, + Common::kPlatformPC, + ADGF_NO_FLAGS, + GUIO3(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIPCSPK) + }, + EOB2_FLAGS + }, + + { + { + "eob2", + 0, + { + { "LEVEL15.INF", 0, "ce54243ad1ca4447f521340428da2c91", -1 }, + { 0, 0, 0, 0 } + }, + Common::DE_DEU, + Common::kPlatformPC, + ADGF_NO_FLAGS, + GUIO3(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIPCSPK) + }, + EOB2_FLAGS + }, +#endif // ENABLE_EOB + { AD_TABLE_END_MARKER, FLAGS(0, 0, 0, 0, 0, 0, 0, 0, 0) } }; @@ -1449,6 +1519,10 @@ const PlainGameDescriptor gameList[] = { #ifdef ENABLE_LOL { "lol", "Lands of Lore: The Throne of Chaos" }, #endif // ENABLE_LOL +#ifdef ENABLE_EOB + { "eob", "Eye of the Beholder" }, + { "eob2", "Eye of the Beholder II: The Legend of Darkmoon" }, +#endif // ENABLE_EOB { 0, 0 } }; diff --git a/engines/kyra/eob1.cpp b/engines/kyra/eob1.cpp new file mode 100644 index 0000000000..993d06a56b --- /dev/null +++ b/engines/kyra/eob1.cpp @@ -0,0 +1,242 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifdef ENABLE_EOB + +#include "kyra/eob1.h" +#include "kyra/resource.h" + +namespace Kyra { + +EobEngine::EobEngine(OSystem *system, const GameFlags &flags) : EobCoreEngine(system, flags) { + _numSpells = 53; +} + +EobEngine::~EobEngine() { + delete[] _itemsOverlay; +} + +Common::Error EobEngine::init() { + Common::Error err = EobCoreEngine::init(); + if (err.getCode() != Common::kNoError) + return err; + + initStaticResource(); + + _itemsOverlay = _res->fileData("ITEMRMP.VGA", 0); + + _bkgColor_1 = 132; + _color1_1 = 135; + _color2_1 = 130; + _color4 = 133; + _color5 = 133; + _color6 = 180; + _color7 = 177; + _color8 = 184; + + _color14 = _color8; + _color13 = _color7; + _color12 = _color6; + + _screen->modifyScreenDim(7, 0x01, 0xB3, 0x22, 0x12); + _screen->modifyScreenDim(9, 0x01, 0x7D, 0x26, 0x3F); + _screen->modifyScreenDim(12, 0x01, 0x04, 0x14, 0xA0); + + _scriptTimersCount = 1; + + return Common::kNoError; +} + +void EobEngine::startupNew() { + _currentLevel = 1; + _currentSub = 0; + loadLevel(1, 0); + _currentBlock = 490; + _currentDirection = 0; + setHandItem(0); +} + +void EobEngine::startupLoad() { + updateHandItemCursor(); + loadLevel(_currentLevel, _currentSub); + _saveLoadMode = 0; +} + +void EobEngine::npcSequence(int npcIndex) { + + +} + +void EobEngine::updateUsedCharacterHandItem(int charIndex, int slot) { + EobItem *itm = &_items[_characters[charIndex].inventory[slot]]; + if (itm->type == 48) { + int charges = itm->flags & 0x3f; + if (--charges) + --itm->flags; + else + deleteInventoryItem(charIndex, slot); + } else if (itm->type == 34 || itm->type == 35) { + deleteInventoryItem(charIndex, slot); + } +} + +void EobEngine::replaceMonster(int unit, uint16 block, int pos, int dir, int type, int shpIndex, int mode, int h2, int randItem, int fixedItem) { + if (_levelBlockProperties[block].flags & 7) + return; + + for (int i = 0; i < 30; i++) { + if (_monsters[i].hitPointsCur <= 0) { + initMonster(i, unit, block, pos, dir, type, shpIndex, mode, h2, randItem, fixedItem);; + break; + } + } +} + +void EobEngine::loadDoorShapes(int doorType1, int shapeId1, int doorType2, int shapeId2) { + _screen->loadEobBitmap("DOOR", 5, 3); + _screen->_curPage = 2; + + if (doorType1 != 0xff) { + for (int i = 0; i < 3; i++) { + const uint8 *enc = &_doorShapeEncodeDefs[(doorType1 * 3 + i) << 2]; + _doorShapes[shapeId1 + i] = _screen->encodeShape(enc[0], enc[1], enc[2], enc[3]); + enc = &_doorSwitchShapeEncodeDefs[(doorType1 * 3 + i) << 2]; + _doorSwitches[shapeId1 + i].shp = _screen->encodeShape(enc[0], enc[1], enc[2], enc[3]); + _doorSwitches[shapeId1 + i].x = _doorSwitchCoords[doorType1 << 1]; + _doorSwitches[shapeId1 + i].y = _doorSwitchCoords[(doorType1 << 1) + 1]; + } + } + + if (doorType2 != 0xff) { + for (int i = 0; i < 3; i++) { + const uint8 *enc = &_doorShapeEncodeDefs[(doorType2 * 3 + i) << 2]; + _doorShapes[shapeId2 + i] = _screen->encodeShape(enc[0], enc[1], enc[2], enc[3]); + enc = &_doorSwitchShapeEncodeDefs[(doorType2 * 3 + i) << 2]; + _doorSwitches[shapeId2 + i].shp = _screen->encodeShape(enc[0], enc[1], enc[2], enc[3]); + _doorSwitches[shapeId2 + i].x = _doorSwitchCoords[doorType2 << 1]; + _doorSwitches[shapeId2 + i].y = _doorSwitchCoords[(doorType2 << 1) + 1]; + } + } + + _screen->_curPage = 0; +} + +void EobEngine::drawDoorIntern(int type, int index, int x, int y, int w, int wall, int mDim, int16 y1, int16 y2) { + int shapeIndex = type + 2 - mDim; + uint8 *shp = _doorShapes[shapeIndex]; + + int d1 = 0; + int d2 = 0; + int v = 0; + const ScreenDim *td = _screen->getScreenDim(5); + + switch (_currentLevel) { + case 4: + case 5: + case 6: + y = _dscDoorY2[mDim] - shp[1]; + d1 = _dscDoorCoordsExt[index << 1] >> 3; + d2 = _dscDoorCoordsExt[(index << 1) + 1] >> 3; + if (_shpDmX1 > d1) + d1 = _shpDmX1; + if (_shpDmX2 < d2) + d2 = _shpDmX2; + _screen->modifyScreenDim(5, d1, td->sy, d2 - d1, td->h); + v = ((wall < 30) ? (wall - _dscDoorScaleOffs[wall]) * _dscDoorScaleMult3[mDim] : _dscDoorScaleMult4[mDim]) * -1; + v -= (shp[2] << 3); + drawBlockObject(0, 2, shp, x + v, y, 5); + v += (shp[2] << 3); + drawBlockObject(1, 2, shp, x - v, y, 5); + if (_wllShapeMap[wall] == -1) + drawBlockObject(0, 2, _doorSwitches[shapeIndex].shp, _doorSwitches[shapeIndex].x + w - v, _doorSwitches[shapeIndex].y, 5); + break; + + case 7: + case 8: + case 9: + y = _dscDoorY3[mDim] - _doorShapes[shapeIndex + 3][1]; + d1 = x - (_doorShapes[shapeIndex + 3][2] << 2); + x -= (shp[2] << 2); + drawBlockObject(0, 2, _doorShapes[shapeIndex + 3], d1, y, 5); + scaleLevelShapesDim(index, y1, y2, 5); + y = _dscDoorY3[mDim] - ((wall < 30) ? (wall - _dscDoorScaleOffs[wall]) * _dscDoorScaleMult1[mDim] : _dscDoorScaleMult2[mDim]); + drawBlockObject(0, 2, shp, x, y, 5); + if (_wllShapeMap[wall] == -1) + drawBlockObject(0, 2, _doorSwitches[shapeIndex].shp, _doorSwitches[shapeIndex].x + w, _doorSwitches[shapeIndex].y, 5); + break; + + case 10: + case 11: + v = ((wall < 30) ? (wall - _dscDoorScaleOffs[wall]) * _dscDoorScaleMult5[mDim] : _dscDoorScaleMult6[mDim]) * -1; + x -= (shp[2] << 2); + y = _dscDoorY3[mDim] + v; + drawBlockObject(0, 2, shp, x, y + v, 5); + v >>= 4; + y = _dscDoorY5[mDim]; + drawBlockObject(0, 2, _doorShapes[shapeIndex + 3], x, y - v, 5); + if (_wllShapeMap[wall] == -1) + drawBlockObject(0, 2, _doorSwitches[shapeIndex].shp, _doorSwitches[shapeIndex].x + w, _doorSwitches[shapeIndex].y, 5); + break; + + default: + y = (_currentLevel == 12 ? _dscDoorY6[mDim] : _dscDoorY1[mDim]) - shp[1]; + x -= (shp[2] << 2); + y -= (wall >= 30 ? _dscDoorScaleMult2[mDim] : (wall - _dscDoorScaleOffs[wall]) * _dscDoorScaleMult1[mDim]); + drawBlockObject(0, 2, shp, x, y, 5); + + if (_wllShapeMap[wall] == -1) + drawBlockObject(0, 2, _doorSwitches[shapeIndex].shp, _doorSwitches[shapeIndex].x + w, _doorSwitches[shapeIndex].y, 5); + break; + } +} + +uint32 EobEngine::convertSpellFlagToEob2Format(uint32 flag, int ignoreInvisibility) { + uint32 res = 0; + if (flag & 0x01) + res |= 0x20; + if (flag & 0x02) + res |= 0x400; + if (flag & 0x04) + res |= 0x80; + if (flag & 0x08) + res |= 0x40; + if (ignoreInvisibility) + res |= 0x100; + return res; +} + +uint32 EobEngine::convertCharacterEffectFlagToEob2Format(uint32 flag) { + uint32 res = 0; + if (flag & 0x02) + res |= 0x08; + if (flag & 0x04) + res |= 0x40; + if (flag & 0x80) + res |= 0x2000; + if (flag & 0x100) + res |= 0x4000; + return res; +} + +} // End of namespace Kyra + +#endif // ENABLE_EOB diff --git a/engines/kyra/eob1.h b/engines/kyra/eob1.h new file mode 100644 index 0000000000..27a060f65c --- /dev/null +++ b/engines/kyra/eob1.h @@ -0,0 +1,96 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifdef ENABLE_EOB + +#ifndef KYRA_EOB1_H +#define KYRA_EOB1_H + +#include "kyra/eobcommon.h" + +namespace Kyra { + +class EobEngine : public EobCoreEngine { +friend class GUI_Eob; +public: + EobEngine(OSystem *system, const GameFlags &flags); + ~EobEngine(); + +private: + // Init / Release + Common::Error init(); + void initStaticResource(); + void initSpells(); + + // Main Menu + int mainMenu(); + int mainMenuLoop(); + + // Main loop + void startupNew(); + void startupLoad(); + + // Intro/Outro + void seq_playOpeningCredits(); + void seq_playIntro(); + void seq_playFinale(); + + // characters + void npcSequence(int npcIndex); + + //const char *const *_npc1Strings; + //const char *const *_npc2Strings; + + // items + void updateUsedCharacterHandItem(int charIndex, int slot); + + // Monsters + void replaceMonster(int unit, uint16 block, int d, int dir, int type, int shpIndex, int mode, int h2, int randItem, int fixedItem); + + // Level + void loadDoorShapes(int doorType1, int shapeId1, int doorType2, int shapeId2); + void drawDoorIntern(int type, int index, int x, int y, int w, int wall, int mDim, int16 y1, int16 y2); + + const int16 *_dscDoorCoordsExt; + const uint8 *_dscDoorScaleMult4; + const uint8 *_dscDoorScaleMult5; + const uint8 *_dscDoorScaleMult6; + const uint8 *_dscDoorY3; + const uint8 *_dscDoorY4; + const uint8 *_dscDoorY5; + const uint8 *_dscDoorY6; + + const uint8 *_doorShapeEncodeDefs; + const uint8 *_doorSwitchShapeEncodeDefs; + const uint8 *_doorSwitchCoords; + + // Misc + uint32 convertSpellFlagToEob2Format(uint32 flag, int ignoreInvisibility); + uint32 convertCharacterEffectFlagToEob2Format(uint32 flag); +}; + + +} // End of namespace Kyra + +#endif + +#endif // ENABLE_EOB diff --git a/engines/kyra/eob2.cpp b/engines/kyra/eob2.cpp new file mode 100644 index 0000000000..120ad157d0 --- /dev/null +++ b/engines/kyra/eob2.cpp @@ -0,0 +1,437 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifdef ENABLE_EOB + +#include "kyra/eob2.h" +#include "kyra/resource.h" +#include "kyra/sound.h" + +namespace Kyra { + +DarkMoonEngine::DarkMoonEngine(OSystem *system, const GameFlags &flags) : EobCoreEngine(system, flags) { + _seqIntro = _seqFinale = 0; + _shapesIntro = _shapesFinale = 0; + _dscDoorType5Offs = 0; + _numSpells = 70; +} + +DarkMoonEngine::~DarkMoonEngine() { + delete[] _seqIntro; + delete[] _seqFinale; + delete[] _shapesIntro; + delete[] _shapesFinale; +} + +Common::Error DarkMoonEngine::init() { + Common::Error err = EobCoreEngine::init(); + if (err.getCode() != Common::kNoError) + return err; + + initStaticResource(); + + _monsterProps = new EobMonsterProperty[10]; + + _bkgColor_1 = 183; + _color1_1 = 186; + _color2_1 = 181; + _color4 = 133; + _color5 = 184; + _color6 = 183; + _color7 = 181; + _color8 = 186; + _color12 = 180; + _color13 = 177; + _color14 = 182; + + return Common::kNoError; +} + +void DarkMoonEngine::startupNew() { + _currentLevel = 4; + _currentSub = 0; + loadLevel(4, 0); + _currentBlock = 171; + _currentDirection = 2; + setHandItem(0); +} + +void DarkMoonEngine::startupLoad() { + updateHandItemCursor(); + loadLevel(_currentLevel, _currentSub); + _saveLoadMode = 0; +} + +void DarkMoonEngine::npcSequence(int npcIndex) { + _screen->loadEobBitmap("OUTTAKE", 5, 3); + _screen->copyRegion(0, 0, 0, 0, 176, 120, 0, 6, Screen::CR_NO_P_CHECK); + const uint8 *shpDef = &_npcShpData[npcIndex << 3]; + + for (int i = npcIndex; i != 255; i = shpDef[7]) { + shpDef = &_npcShpData[i << 3]; + _screen->_curPage = 2; + const uint8 *shp = _screen->encodeShape(READ_LE_UINT16(shpDef), shpDef[2], shpDef[3], shpDef[4]); + _screen->_curPage = 0; + _screen->drawShape(0, shp, 88 + shpDef[5] - (shp[2] << 2), 104 + shpDef[6] - shp[1], 5); + delete[] shp; + } + + Common::SeekableReadStream *s = _res->createReadStream("TEXT.DAT"); + _screen->loadFileDataToPage(s, 5, 32000); + delete s; + + gui_drawBox(0, 121, 320, 79, _color1_1, _color2_1, _bkgColor_1); + _txt->setupField(9, true); + _txt->resetPageBreakString(); + + if (npcIndex == 0) { + snd_playSoundEffect(57); + if (npcJoinDialogue(0, 1, 3, 2)) + setScriptFlag(0x40); + } else if (npcIndex == 1) { + snd_playSoundEffect(53); + gui_drawDialogueBox(); + + _txt->printDialogueText(4, 0); + int r = runDialogue(-1, 0, _npc1Strings[0], _npc1Strings[1]) - 1; + + if (r == 0) { + _sound->playTrack(0); + delay(3 * _tickLength); + snd_playSoundEffect(91); + npcJoinDialogue(1, 5, 6, 7); + } else if (r == 1) { + setScriptFlag(0x20); + } + + } else if (npcIndex == 2) { + snd_playSoundEffect(55); + gui_drawDialogueBox(); + + _txt->printDialogueText(8, 0); + int r = runDialogue(-1, 0, _npc2Strings[0], _npc2Strings[1]) - 1; + + if (r == 0) { + if (rollDice(1, 2, -1)) + _txt->printDialogueText(9, _okStrings[0]); + else + npcJoinDialogue(2, 102, 103, 104); + setScriptFlag(8); + } else if (r == 1) { + _currentDirection = 0; + } + } + + _txt->removePageBreakFlag(); + gui_restorePlayField(); +} + +void DarkMoonEngine::updateUsedCharacterHandItem(int charIndex, int slot) { + EobItem *itm = &_items[_characters[charIndex].inventory[slot]]; + if (itm->type == 48 || itm->type == 62) { + if (itm->value == 5) + return; + int charges = itm->flags & 0x3f; + if (--charges) + --itm->flags; + else + deleteInventoryItem(charIndex, slot); + } else if (itm->type == 26 || itm->type == 34 || itm->type == 35) { + deleteInventoryItem(charIndex, slot); + } +} + +void DarkMoonEngine::generateMonsterPalettes(const char *file, int16 monsterIndex) { + int cp = _screen->setCurPage(2); + _screen->loadEobBitmap(file, 3, 3); + uint8 tmpPal[16]; + uint8 newPal[16]; + + for (int i = 0; i < 6; i++) { + int dci = monsterIndex + i; + memcpy(tmpPal, _monsterShapes[dci] + 4, 16); + int colx = 302 + 3 * i; + + for (int ii = 0; ii < 16; ii++) { + uint8 col = _screen->getPagePixel(_screen->_curPage, colx, 184 + ii); + + int iii = 0; + for (; iii < 16; iii++) { + if (tmpPal[iii] == col) { + newPal[ii] = iii; + break; + } + } + + if (iii == 16) + newPal[ii] = 0; + } + + for (int ii = 1; ii < 3; ii++) { + memcpy(tmpPal, _monsterShapes[dci] + 4, 16); + + for (int iii = 0; iii < 16; iii++) { + uint8 col = _screen->getPagePixel(_screen->_curPage, colx + ii, 184 + iii); + if (newPal[iii]) + tmpPal[newPal[iii]] = col; + } + + int c = i; + if (monsterIndex >= 18) + c += 6; + + c = (c << 1) + (ii - 1); + memcpy(_monsterPalettes[c], tmpPal, 16); + } + } + + _screen->setCurPage(cp); +} + +void DarkMoonEngine::loadMonsterDecoration(const char *file, int16 monsterIndex) { + char filename[13]; + snprintf(filename, 13, "%s.dcr", file); + + Common::SeekableReadStream *s = _res->createReadStream(filename); + if (!s) + return; + + int len = s->readUint16LE(); + + for (int i = 0; i < len; i++) { + for (int ii = 0; ii < 6; ii++) { + uint8 dc[6]; + s->read(dc, 6); + if (!dc[2] || !dc[3]) + continue; + + SpriteDecoration *m = &_monsterDecorations[i * 6 + ii + monsterIndex]; + + m->shp = _screen->encodeShape(dc[0], dc[1], dc[2], dc[3]); + m->x = dc[4]; + m->y = dc[5]; + } + } + + delete s; +} + +void DarkMoonEngine::replaceMonster(int unit, uint16 block, int pos, int dir, int type, int shpIndex, int mode, int h2, int randItem, int fixedItem) { + uint8 flg = _levelBlockProperties[block].flags & 7; + + if (flg == 7 || _currentBlock == block || (flg && (_monsterProps[type].u30 || pos == 4))) + return; + + for (int i = 0; i < 30; i++) { + if (_monsters[i].block != block) + continue; + if (_monsters[i].pos == 4 || _monsterProps[_monsters[i].type].u30) + return; + } + + int index = -1; + int maxDist = 0; + + for (int i = 0; i < 30; i++) { + if (_monsters[i].hitPointsCur <= 0) { + index = i; + break; + } + + if (_monsters[i].flags & 0x40) + continue; + + int dist = getBlockDistance(_monsters[i].block, _currentBlock); + + if (dist > maxDist) { + maxDist = dist; + index = i; + } + } + + if (index == -1) + return; + + if (_monsters[index].hitPointsCur > 0) + killMonster(&_monsters[index], false); + + initMonster(index, unit, block, pos, dir, type, shpIndex, mode, h2, randItem, fixedItem); +} + +const uint8 *DarkMoonEngine::loadDoorShapes(const char *filename, int doorIndex, const uint8 *shapeDefs) { + _screen->loadEobBitmap(filename, 3, 3); + for (int i = 0; i < 3; i++) { + _doorShapes[doorIndex * 3 + i] = _screen->encodeShape(READ_LE_UINT16(shapeDefs), READ_LE_UINT16(shapeDefs + 2), READ_LE_UINT16(shapeDefs + 4), READ_LE_UINT16(shapeDefs + 6)); + shapeDefs += 8; + } + + for (int i = 0; i < 2; i++) { + _doorSwitches[doorIndex * 3 + i].shp = _screen->encodeShape(READ_LE_UINT16(shapeDefs), READ_LE_UINT16(shapeDefs + 2), READ_LE_UINT16(shapeDefs + 4), READ_LE_UINT16(shapeDefs + 6)); + shapeDefs += 8; + _doorSwitches[doorIndex * 3 + i].x = *shapeDefs; + shapeDefs += 2; + _doorSwitches[doorIndex * 3 + i]. y= *shapeDefs; + shapeDefs += 2; + } + _screen->_curPage = 0; + return shapeDefs; +} + +void DarkMoonEngine::drawDoorIntern(int type, int, int x, int y, int w, int wall, int mDim, int16, int16) { + int shapeIndex = type * 3 + 2 - mDim; + uint8 *shp = _doorShapes[shapeIndex]; + + if ((_doorType[type] == 0) || (_doorType[type] == 1)) { + y = _dscDoorY1[mDim] - shp[1]; + x -= (shp[2] << 2); + + if (_doorType[type] == 1) { + drawBlockObject(0, 2, shp, x, y, 5); + shp = _doorShapes[3 + shapeIndex]; + } + + y -= ((wall - _dscDoorScaleOffs[wall]) * _dscDoorScaleMult1[mDim]); + + if (_specialWallTypes[wall] == 5) + y -= _dscDoorType5Offs[shapeIndex]; + + } else if (_doorType[type] == 2) { + x -= (shp[2] << 2); + y = _dscDoorY2[mDim] - ((wall - _dscDoorScaleOffs[wall]) * _dscDoorScaleMult3[mDim]); + } + + drawBlockObject(0, 2, shp, x, y, 5); + + if (_wllShapeMap[wall] == -1 && !_noDoorSwitch[type]) + drawBlockObject(0, 2, _doorSwitches[shapeIndex].shp, _doorSwitches[shapeIndex].x + w, _doorSwitches[shapeIndex].y, 5); +} + +void DarkMoonEngine::drawLightningColumn() { + int f = rollDice(1, 2, -1); + int y = 0; + + for (int i = 0; i < 6; i++) { + f ^= 1; + drawBlockObject(f, 2, _lightningColumnShape, 72, y, 5); + y += 64; + } +} + +int DarkMoonEngine::resurrectionSelectDialogue() { + int cnt = 0; + const char *namesList[10]; + memset(namesList, 0, 10 * sizeof(const char*)); + int8 indexList[10]; + + for (int i = 0; i < 6; i++) { + if (!testCharacter(i, 1)) + continue; + if (_characters[i].hitPointsCur != -10) + continue; + + namesList[cnt] = _characters[i].name; + indexList[cnt++] = i; + } + + for (int i = 0; i < 6; i++) { + if (!testCharacter(i, 1)) + continue; + + for (int ii = 0; ii < 27; ii++) { + uint16 inv = _characters[i].inventory[ii]; + if (!inv) + continue; + + if (_items[inv].type != 33) + continue; + + namesList[cnt] = _npcPreset[_items[inv].value - 1].name; + indexList[cnt++] = -_items[inv].value; + } + } + + if (_itemInHand) { + if (_items[_itemInHand].type == 33) { + namesList[cnt] = _npcPreset[_items[_itemInHand].value - 1].name; + indexList[cnt++] = -_items[_itemInHand].value; + } + } + + namesList[cnt] = _abortStrings[0]; + indexList[cnt++] = 99; + + int r = indexList[runDialogue(-1, 1, namesList[0], namesList[1], namesList[2], namesList[3], namesList[4], namesList[5], namesList[6], namesList[7], namesList[8]) - 1]; + if (r == 99) + return 0; + + if (r < 0) { + r = -r; + if (prepareForNewPartyMember(33, r)) + initNpc(r - 1); + } else { + _characters[r].hitPointsCur = 1; + } + + return 1; +} + +int DarkMoonEngine::charSelectDialogue() { + int cnt = 0; + const char *namesList[7]; + memset(namesList, 0, 7 * sizeof(const char*)); + + for (int i = 0; i < 6; i++) { + if (!testCharacter(i, 3)) + continue; + namesList[cnt++] = _characters[i].name; + } + + namesList[cnt++] = _abortStrings[0]; + + int r = runDialogue(-1, 1, namesList[0], namesList[1], namesList[2], namesList[3], namesList[4], namesList[5], namesList[6], 0) - 1; + if (r == cnt - 1) + return 99; + + for (cnt = 0; cnt < 6; cnt++) { + if (!testCharacter(cnt, 3)) + continue; + if (--r < 0) + break; + } + return cnt; +} + +void DarkMoonEngine::characterLevelGain(int charIndex) { + EobCharacter *c = &_characters[charIndex]; + int s = _numLevelsPerClass[c->cClass]; + for (int i = 0; i < s; i++) { + uint32 er = getRequiredExperience(c->cClass, i, c->level[i] + 1); + if (er == 0xffffffff) + continue; + + increaseCharacterExperience(charIndex, er - c->experience[i]); + } +} + +} // End of namespace Kyra + +#endif // ENABLE_EOB diff --git a/engines/kyra/eob2.h b/engines/kyra/eob2.h new file mode 100644 index 0000000000..a36ec0e466 --- /dev/null +++ b/engines/kyra/eob2.h @@ -0,0 +1,119 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifdef ENABLE_EOB + +#ifndef KYRA_EOB2_H +#define KYRA_EOB2_H + +#include "kyra/eobcommon.h" + +namespace Kyra { + +class DarkmoonSequenceHelper; + +struct EobSequenceStep { + uint8 command; + uint8 obj; + int16 x1; + uint8 y1; + uint8 delay; + uint8 pal; + uint8 x2; + uint8 y2; + uint8 w; + uint8 h; +}; + +class DarkMoonEngine : public EobCoreEngine { +friend class GUI_Eob; +friend class DarkmoonSequenceHelper; +public: + DarkMoonEngine(OSystem *system, const GameFlags &flags); + ~DarkMoonEngine(); + +private: + // Init / Release + Common::Error init(); + void initStaticResource(); + void initSpells(); + + // Main Menu + int mainMenu(); + int mainMenuLoop(); + + // Main loop + void startupNew(); + void startupLoad(); + + // Intro/Outro + void seq_playIntro(); + void seq_playFinale(); + void seq_playCredits(DarkmoonSequenceHelper *sq, const uint8 *data, int sd, int backupPage, int tempPage, int speed); + + const char * const*_introStrings; + const char * const *_cpsFilesIntro; + const EobSequenceStep **_seqIntro; + const EobShapeDef **_shapesIntro; + + const char * const*_finaleStrings; + const uint8 *_creditsData; + const char * const *_cpsFilesFinale; + const EobSequenceStep **_seqFinale; + const EobShapeDef **_shapesFinale; + + static const char *_palFilesIntro[]; + static const char *_palFilesFinale[]; + + // characters + void npcSequence(int npcIndex); + + const uint8 *_npcShpData; + const char *const *_npc1Strings; + const char *const *_npc2Strings; + + // items + void updateUsedCharacterHandItem(int charIndex, int slot); + + // Monsters + void generateMonsterPalettes(const char *file, int16 monsterIndex); + void loadMonsterDecoration(const char *file, int16 monsterIndex); + void replaceMonster(int unit, uint16 block, int d, int dir, int type, int shpIndex, int mode, int h2, int randItem, int fixedItem); + + // Level + const uint8 *loadDoorShapes(const char *filename, int doorIndex, const uint8 *shapeDefs); + void drawDoorIntern(int type, int, int x, int y, int w, int wall, int mDim, int16, int16); + + const uint8 *_dscDoorType5Offs; + + // misc + void drawLightningColumn(); + int resurrectionSelectDialogue(); + int charSelectDialogue(); + void characterLevelGain(int charIndex); +}; + +} // End of namespace Kyra + +#endif + +#endif // ENABLE_EOB diff --git a/engines/kyra/eobcommon.cpp b/engines/kyra/eobcommon.cpp new file mode 100644 index 0000000000..d82a3dd012 --- /dev/null +++ b/engines/kyra/eobcommon.cpp @@ -0,0 +1,1845 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifdef ENABLE_EOB + +#include "common/config-manager.h" + +#include "audio/mididrv.h" +#include "audio/mixer.h" + +#include "kyra/loleobbase.h" +#include "kyra/resource.h" +#include "kyra/sound_intern.h" +#include "kyra/script_eob.h" +#include "kyra/timer.h" + +namespace Kyra { + +EobCoreEngine::EobCoreEngine(OSystem *system, const GameFlags &flags) : LolEobBaseEngine(system, flags), _numLargeItemShapes(flags.gameID == GI_EOB1 ? 14 : 11), + _numSmallItemShapes(flags.gameID == GI_EOB1 ? 23 : 26), _numThrownItemShapes(flags.gameID == GI_EOB1 ? 12 : 9), _numItemIconShapes(flags.gameID == GI_EOB1 ? 89 : 112), + _teleporterWallId(flags.gameID == GI_EOB1 ? 52 : 44) { + _screen = 0; + _gui = 0; + + //_runLoopUnk2 = 0; + //_runLoopTimerUnk = 0; + _playFinale = false; + _runFlag = true; + _saveLoadMode = 0; + _updateHandItemCursor = false; + + _largeItemShapes = _smallItemShapes = _thrownItemShapes = _spellShapes = _firebeamShapes = _itemIconShapes = + _wallOfForceShapes = _teleporterShapes = _sparkShapes = _compassShapes = 0; + _redSplatShape = _greenSplatShape = _deadCharShape = _disabledCharGrid = _blackBoxSmallGrid = + _weaponSlotGrid = _blackBoxWideGrid = _lightningColumnShape = 0; + _tempIconShape = 0; + + _monsterDustStrings = 0; + _monsterDistAttType10 = 0; + _monsterDistAttSfx10 = 0; + _monsterDistAttType17 = 0; + _monsterDistAttSfx17 = 0; + + _faceShapes = 0; + _characters = 0; + _items = 0; + _itemTypes = 0; + _itemNames = 0; + _itemInHand = -1; + _numItems = _numItemNames = 0; + + _castScrollSlot = 0; + _currentSub = 0; + + _itemsOverlay = 0; + + _partyEffectFlags = 0; + _lastUsedItem = 0; + + _levelDecorationRects = 0; + _doorSwitches = 0; + _monsterProps = 0; + _monsterDecorations = 0; + _monsterOvl1 = _monsterOvl2 = 0; + _monsters = 0; + _dstMonsterIndex = 0; + _inflictMonsterDamageUnk = 0; + + _teleporterPulse = 0; + + _dscShapeCoords = 0; + _dscItemPosIndex = 0; + _dscItemShpX = 0; + _dscItemScaleIndex = 0; + _dscItemTileIndex = 0; + _dscItemShapeMap = 0; + _dscDoorScaleOffs = 0; + _dscDoorScaleMult1 = 0; + _dscDoorScaleMult2 = 0; + _dscDoorScaleMult3 = 0; + _dscDoorY1 = 0; + + _color9 = 17; + _color10 = 23; + _color11 = 20; + + _exchangeCharacterId = -1; + _charExchangeSwap = 0; + _hpBarGraphs = true; + + memset(_dialogueLastBitmap, 0, 13); + _dlgUnk1 = 0; + _moveCounter = 0; + _partyResting = false; + + _flyingObjects = 0; + + _inf = 0; + _stepCounter = 0; + _stepsUntilScriptCall = 0; + _scriptTimersMode = 3; + _currentDirection = 0; + + _openBookSpellLevel = 0; + _openBookSpellSelectedItem = 0; + _openBookSpellListOffset = 0; + _openBookChar = _openBookCharBackup = 0; + _openBookType = _openBookTypeBackup = 0; + _openBookSpellList = 0; + _openBookAvailableSpells = 0; + _activeSpellCaster = 0; + _activeSpellCasterPos = 0; + _activeSpell = 0; + _returnAfterSpellCallback = false; + _spells = 0; + _spellAnimBuffer = 0; + _clericSpellOffset = 0; +} + +EobCoreEngine::~EobCoreEngine() { + releaseItemsAndDecorationsShapes(); + releaseTempData(); + + if (_faceShapes) { + for (int i = 0; i < 44; i++) { + if (_characters) { + for (int ii = 0; ii < 6; ii++) { + if (_characters[ii].faceShape == _faceShapes[i]) + _characters[ii].faceShape = 0; + } + } + delete[] _faceShapes[i]; + _faceShapes[i] = 0; + } + delete[] _faceShapes; + } + + if (_characters) { + for (int i = 0; i < 6; i++) + delete[] _characters[i].faceShape; + } + + delete[] _characters; + delete[] _items; + delete[] _itemTypes; + if (_itemNames) { + for (int i = 0; i < 130; i++) + delete _itemNames[i]; + } + delete[] _itemNames; + delete[] _flyingObjects; + + delete[] _monsterOvl1; + delete[] _monsterOvl2; + delete[] _monsters; + + if (_monsterDecorations) { + releaseMonsterShapes(0, 36); + delete[] _monsterShapes; + delete[] _monsterDecorations; + + for (int i = 0; i < 24; i++) + delete[] _monsterPalettes[i]; + delete[] _monsterPalettes; + } + + delete[] _monsterProps; + + if (_doorSwitches) { + releaseDoorShapes(); + delete[] _doorSwitches; + } + + releaseDecorations(); + delete[] _levelDecorationRects; + + delete[] _spells; + delete[] _spellAnimBuffer; + + delete _gui; + _gui = 0; + delete _inf; + delete _timer; + _timer = 0; +} + +Common::Error EobCoreEngine::init() { + // In EOB the timer proc is directly invoked via interrupt 0x1c, 18.2 times per second. + // This makes a tick length of 54.94. + _tickLength = 55; + + _screen = new Screen_Eob(this, _system); + + assert(_screen); + _screen->setResolution(); + + // Setup mixer + _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume")); + _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume")); + _mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, ConfMan.getInt("speech_volume")); + + //MidiDriverType midiDriver = MidiDriver::detectDevice(MDT_PCSPK | MDT_ADLIB); + _sound = new SoundAdLibPC(this, _mixer); + assert(_sound); + + if (_sound) + _sound->updateVolumeSettings(); + + _res = new Resource(this); + assert(_res); + _res->reset(); + + if (!screen()->init()) + error("screen()->init() failed"); + + if (ConfMan.hasKey("save_slot")) { + _gameToLoad = ConfMan.getInt("save_slot"); + if (!saveFileLoadable(_gameToLoad)) + _gameToLoad = -1; + } + + setupKeyMap(); + _gui = new GUI_Eob(this); + _txt = new TextDisplayer_Eob(this, _screen); + _inf = new EobInfProcessor(this, _screen); + + _screen->loadFont(Screen::FID_6_FNT, "FONT6.FNT"); + _screen->loadFont(Screen::FID_8_FNT, "FONT8.FNT"); + + _activeButtons = 0; + + _staticres = new StaticResource(this); + assert(_staticres); + if (!_staticres->init()) + error("_staticres->init() failed"); + + Common::Error err = LolEobBaseEngine::init(); + if (err.getCode() != Common::kNoError) + return err; + + initButtonData(); + initStaticResource(); + initSpells(); + + _timer = new TimerManager(this, _system); + assert(_timer); + setupTimers(); + + _wllVmpMap[1] = 1; + _wllVmpMap[2] = 2; + memset(&_wllVmpMap[3], 3, 20); + _wllVmpMap[23] = 4; + _wllVmpMap[24] = 5; + + memcpy(_wllWallFlags, _wllFlagPreset, _wllFlagPresetSize); + + memset(&_specialWallTypes[3], 1, 5); + memset(&_specialWallTypes[13], 1, 5); + _specialWallTypes[8] = _specialWallTypes[18] = 6; + + memset(&_wllShapeMap[3], -1, 5); + memset(&_wllShapeMap[13], -1, 5); + + _wllVcnOffset = 16; + + _monsters = new EobMonsterInPlay[30]; + memset(_monsters, 0, 30 * sizeof(EobMonsterInPlay)); + + _characters = new EobCharacter[6]; + memset(_characters, 0, sizeof(EobCharacter) * 6); + + _items = new EobItem[600]; + memset(_items, 0, sizeof(EobItem) * 600); + + _itemNames = new char*[130]; + for (int i = 0; i < 130; i++) { + _itemNames[i] = new char[35]; + memset(_itemNames[i], 0, 35); + } + + _flyingObjects = new EobFlyingObject[10]; + memset(_flyingObjects, 0, 10 * sizeof(EobFlyingObject)); + + _spellAnimBuffer = new uint8[4096]; + memset(_spellAnimBuffer, 0, 4096); + + memset(_doorType, 0, sizeof(_doorType)); + memset(_noDoorSwitch, 0, sizeof(_noDoorSwitch)); + + _monsterShapes = new uint8*[36]; + memset(_monsterShapes, 0, 36 * sizeof(uint8*)); + _monsterDecorations = new SpriteDecoration[36]; + memset(_monsterDecorations, 0, 36 * sizeof(SpriteDecoration)); + _monsterPalettes = new uint8*[24]; + for (int i = 0; i < 24; i++) + _monsterPalettes[i] = new uint8[16]; + + _doorSwitches = new SpriteDecoration[6]; + memset(_doorSwitches, 0, 6 * sizeof(SpriteDecoration)); + + _monsterOvl1 = new uint8[16]; + _monsterOvl2 = new uint8[16]; + memset(_monsterOvl1, 15, 16 * sizeof(uint8)); + memset(_monsterOvl2, 13, 16 * sizeof(uint8)); + _monsterOvl1[0] = _monsterOvl2[0] = 0; + + return Common::kNoError; +} + +Common::Error EobCoreEngine::go() { + _txt->removePageBreakFlag(); + _screen->loadPalette("palette.col", _screen->getPalette(0)); + _screen->setScreenPalette(_screen->getPalette(0)); + _screen->setFont(Screen::FID_8_FNT); + + loadItemsAndDecorationsShapes(); + _screen->setMouseCursor(0, 0, _itemIconShapes[0]); + _screen->showMouse(); + + //initPlayBuffers + + loadItemDefs(); + + int action = 0; + + if (_gameToLoad != -1) { + if (loadGameState(_gameToLoad).getCode() != Common::kNoError) + error("Couldn't load game slot %d on startup", _gameToLoad); + _gameToLoad = -1; + } else { + action = mainMenu(); + } + + if (action == -1) { + // load game + _saveLoadMode = -1; + startupLoad(); + } else if (action == -2) { + // new game + startCharacterGeneration(); + startupNew(); + } else if (action == -3) { + // transfer party + } + + if (!shouldQuit() && action > -3) { + runLoop(); + + if (_playFinale) + seq_playFinale(); + } + + return Common::kNoError; +} + +void EobCoreEngine::runLoop() { + _envAudioTimer = _system->getMillis() + (rollDice(1, 10, 3) * 18 * _tickLength); + /// + // startupSub1 + // + // + _updateFlags = 0; + //_unkCharacterId = 0; + _flashShapeTimer = 0; + _drawSceneTimer = _system->getMillis(); + //_unkBBBBBBBBBBBBBBBB = 1; + gui_setPlayFieldButtons(); + // + + _screen->_curPage = 0; + gui_drawPlayField(0); + + _screen->setFont(Screen::FID_6_FNT); + + _screen->_curPage = 0; + gui_drawAllCharPortraitsWithStats(); + + drawScene(1); + + _screen->setScreenDim(7); + + //_runLoopUnk2 = _currentBlock; + _runFlag = true; + + while (!shouldQuit() && _runFlag) { + //_runLoopUnk2 = _currentBlock; + updateCharacterEvents(true); + checkInput(_activeButtons, true); + removeInputTop(); + + if (_updateHandItemCursor) { + _updateHandItemCursor = false; + setHandItem(_itemInHand); + } + + _timer->update(); + updateScriptTimers(); + + if (_sceneUpdateRequired) + drawScene(1); + + if (_envAudioTimer >= _system->getMillis()) + continue; + + _envAudioTimer = _system->getMillis() + (rollDice(1, 10, 3) * 18 * _tickLength); + snd_processEnvironmentalSoundEffect(rollDice(1, 2, -1) ? 27 : 28, _currentBlock + rollDice(1, 12, -1)); + updateEnvironmentalSfx(0); + } +} + +bool EobCoreEngine::updateCharacterEvents(bool a) { + int numChars = 0; + for (int i = 0; i < 6; i++) + numChars += testCharacter(i, 13); + + if (numChars) + return false; + + if (!a) + return true; + + + gui_drawAllCharPortraitsWithStats(); + + /// TODO + /// if (checkScriptFlag(0x10)) + /// j_dranThoseFools() + + /// TODO + + /// TODO + + + return false; +} + +void EobCoreEngine::loadItemsAndDecorationsShapes() { + releaseItemsAndDecorationsShapes(); + _screen->setCurPage(2); + + _screen->loadBitmap("ITEML1.CPS", 5, 3, 0); + _largeItemShapes = new const uint8*[_numLargeItemShapes]; + int div = (_flags.gameID == GI_EOB1) ? 3 : 8; + int mul = (_flags.gameID == GI_EOB1) ? 64 : 24; + + for (int i = 0; i < _numLargeItemShapes; i++) + _largeItemShapes[i] = _screen->encodeShape((i / div) << 3, (i % div) * mul, 8, 24); + + _screen->loadBitmap("ITEMS1.CPS", 5, 3, 0); + _smallItemShapes = new const uint8*[_numSmallItemShapes]; + for (int i = 0; i < _numSmallItemShapes; i++) + _smallItemShapes[i] = _screen->encodeShape((i / div) << 2, (i % div) * mul, 4, 24); + + _screen->loadBitmap("THROWN.CPS", 5, 3, 0); + _thrownItemShapes = new const uint8*[_numThrownItemShapes]; + for (int i = 0; i < _numThrownItemShapes; i++) + _thrownItemShapes[i] = _screen->encodeShape((i / div) << 2, (i % div) * mul, 4, 24); + + _spellShapes = new const uint8*[4]; + for (int i = 0; i < 4; i++) + _spellShapes[i] = _screen->encodeShape(8, i << 5, 6, 32); + + _firebeamShapes = new const uint8*[3]; + _firebeamShapes[0] = _screen->encodeShape(16, 0, 4, 24); + _firebeamShapes[1] = _screen->encodeShape(16, 24, 4, 24); + _firebeamShapes[2] = _screen->encodeShape(16, 48, 3, 24); + _redSplatShape = _screen->encodeShape(16, _flags.gameID == GI_EOB1 ? 144 : 72, 5, 24); + _greenSplatShape = _screen->encodeShape(16, _flags.gameID == GI_EOB1 ? 168 : 96, 5, 16); + + _screen->loadBitmap("ITEMICN.CPS", 5, 3, 0); + _itemIconShapes = new const uint8*[_numItemIconShapes]; + for (int i = 0; i < _numItemIconShapes; i++) + _itemIconShapes[i] = _screen->encodeShape((i % 0x14) << 1, (i / 0x14) << 4, 2, 0x10); + _tempIconShape = new uint8[300]; + + _screen->loadBitmap("DECORATE.CPS", 5, 3, 0); + + if (_flags.gameID == GI_EOB2) { + _lightningColumnShape = _screen->encodeShape(18, 88, 4, 64); + _wallOfForceShapes = new const uint8*[6]; + for (int i = 0; i < 6; i++) + _wallOfForceShapes[i] = _screen->encodeShape(_wallOfForceShapeDefs[(i << 2)], _wallOfForceShapeDefs[(i << 2) + 1], _wallOfForceShapeDefs[(i << 2) + 2], _wallOfForceShapeDefs[(i << 2) + 3]); + } + + _teleporterShapes = new const uint8*[6]; + for (int i = 0; i < 6; i++) + _teleporterShapes[i] = _screen->encodeShape(_teleporterShapeDefs[(i << 2)], _teleporterShapeDefs[(i << 2) + 1], _teleporterShapeDefs[(i << 2) + 2], _teleporterShapeDefs[(i << 2) + 3]); + _sparkShapes = new const uint8*[3]; + _sparkShapes[0] = _screen->encodeShape(29, 0, 2, 16); + _sparkShapes[1] = _screen->encodeShape(31, 0, 2, 16); + _sparkShapes[2] = _screen->encodeShape(33, 0, 2, 16); + _deadCharShape = _screen->encodeShape(0, 88, 4, 32); + _disabledCharGrid = _screen->encodeShape(4, 88, 4, 32); + _blackBoxSmallGrid = _screen->encodeShape(9, 88, 2, 8); + _weaponSlotGrid = _screen->encodeShape(8, 88, 4, 16); + _blackBoxWideGrid = _screen->encodeShape(8, 104, 4, 8); + + static const uint8 dHeight[] = { 17, 10, 10 }; + static const uint8 dY[] = { 120, 137, 147 }; + + _compassShapes = new const uint8*[12]; + for (int y = 0; y < 3; y++) { + for (int x = 0; x < 4; x++) + _compassShapes[(y << 2) + x] = _screen->encodeShape(x * 3, dY[y], 3, dHeight[y]); + } +} + +void EobCoreEngine::releaseItemsAndDecorationsShapes() { + if (_largeItemShapes) { + for (int i = 0; i < _numLargeItemShapes; i++) { + if (_largeItemShapes[i]) + delete[] _largeItemShapes[i]; + } + delete[] _largeItemShapes; + } + + if (_smallItemShapes) { + for (int i = 0; i < _numSmallItemShapes; i++) { + if (_smallItemShapes[i]) + delete[] _smallItemShapes[i]; + } + delete[] _smallItemShapes; + } + + if (_thrownItemShapes) { + for (int i = 0; i < _numThrownItemShapes; i++) { + if (_thrownItemShapes[i]) + delete[] _thrownItemShapes[i]; + } + delete[] _thrownItemShapes; + } + + if (_spellShapes) { + for (int i = 0; i < 4; i++) { + if (_spellShapes[i]) + delete [] _spellShapes[i]; + } + delete[] _spellShapes; + } + + if (_itemIconShapes) { + for (int i = 0; i < _numItemIconShapes; i++) { + if (_itemIconShapes[i]) + delete[] _itemIconShapes[i]; + } + delete[] _itemIconShapes; + } + delete[] _tempIconShape; + + if (_sparkShapes) { + for (int i = 0; i < 3; i++) { + if (_sparkShapes[i]) + delete[] _sparkShapes[i]; + } + delete[] _sparkShapes; + } + + if (_wallOfForceShapes) { + for (int i = 0; i < 6; i++) { + if (_wallOfForceShapes[i]) + delete[] _wallOfForceShapes[i]; + } + delete[] _wallOfForceShapes; + } + + if (_teleporterShapes) { + for (int i = 0; i < 6; i++) { + if (_teleporterShapes[i]) + delete[] _teleporterShapes[i]; + } + delete[] _teleporterShapes; + } + + if (_compassShapes) { + for (int i = 0; i < 12; i++) { + if (_compassShapes[i]) + delete[] _compassShapes[i]; + } + delete[] _compassShapes; + } + + if (_firebeamShapes) { + for (int i = 0; i < 3; i++) { + if (_firebeamShapes[i]) + delete[] _firebeamShapes[i]; + } + delete []_firebeamShapes; + } + + delete[] _deadCharShape; + delete[] _disabledCharGrid; + delete[] _blackBoxSmallGrid; + delete[] _weaponSlotGrid; + delete[] _blackBoxWideGrid; + delete[] _lightningColumnShape; +} + +void EobCoreEngine::setHandItem(Item itemIndex) { + if (itemIndex == -1) + return; + + if (_screen->curDimIndex() == 7 && itemIndex) { + printFullItemName(itemIndex); + _txt->printMessage(_takenStrings[0]); + } + + _itemInHand = itemIndex; + int icon = _items[_itemInHand].icon; + const uint8 *shp = _itemIconShapes[icon]; + + if (icon && (_items[_itemInHand].flags & 0x80) && ((_flags.gameID == GI_EOB2 && (_partyEffectFlags & 2)) || (_flags.gameID == GI_EOB1 && (_partyEffectFlags & 0x10000)))) { + memcpy(_tempIconShape, shp, 300); + if (_flags.gameID == GI_EOB1) + _screen->replaceShapePalette(_tempIconShape, &_itemsOverlay[icon << 4]); + else + _screen->applyShapeOverlay(_tempIconShape, 3); + shp = _tempIconShape; + } + + int mouseOffs = itemIndex ? 8 : 0; + _screen->setMouseCursor(mouseOffs, mouseOffs, shp); +} + +int EobCoreEngine::getDexterityArmorClassModifier(int dexterity) { + static const int mod[] = { 5, 5, 5, 4, 3, 2, 1, 0, 0, + 0, 0, 0, 0, 0, 0, -1, -2, -3, -4, -4, -5, -5, -5, -6, -6 }; + return mod[dexterity]; +} + +int EobCoreEngine::generateCharacterHitpointsByLevel(int charIndex, int levelIndex) { + EobCharacter *c = &_characters[charIndex]; + int m = getClassAndConstHitpointsModifier(c->cClass, c->constitutionCur); + + int h = 0; + + for (int i = 0; i < 3; i++) { + if (!(levelIndex & (1 << i))) + continue; + + int d = getClassHpIncreaseType(c->cClass, i); + + if (c->level[i] <= _hpIncrPerLevel[6 + i]) + h += rollDice(1, (d >= 0) ? _hpIncrPerLevel[d] : 0); + else + h += _hpIncrPerLevel[12 + i]; + + h += m; + } + + h /= _numLevelsPerClass[c->cClass]; + + if (h < 1) + h = 1; + + return h; +} + +int EobCoreEngine::getClassAndConstHitpointsModifier(int cclass, int constitution) { + int res = _hpConstModifiers[constitution]; + + if (res <= 2 || (_classModifierFlags[cclass] & 0x31)) + return res; + + return 2; +} + +int EobCoreEngine::getClassHpIncreaseType(int cclass, int levelIndex) { + return _classHpIncreaseType[cclass * 3 + levelIndex]; +} + +int EobCoreEngine::getModifiedHpLimits(int hpModifier, int constModifier, int level, bool mode) { + int s = _hpIncrPerLevel[6 + hpModifier] > level ? level : _hpIncrPerLevel[6 + hpModifier]; + int res = s; + + if (!mode) + res *= (hpModifier >= 0 ? _hpIncrPerLevel[hpModifier] : 0); + + if (level > s) { + s = level - s; + res += (s * _hpIncrPerLevel[12 + hpModifier]); + } + + if (!mode || (constModifier > 0)) + res += (level * constModifier); + + return res; +} + +const char *EobCoreEngine::getCharStrength(int str, int strExt) { + if (strExt) { + if (strExt == 100) + strExt = 0; + snprintf(_strenghtStr, 6, "%d/%02d", str, strExt); + } else { + snprintf(_strenghtStr, 6, "%d", str); + } + + return _strenghtStr; +} + +int EobCoreEngine::testCharacter(int index, int flags) { + if (index == -1) + return 0; + + EobCharacter *c = &_characters[index]; + int res = 1; + + if (flags & 1) + res &= (c->flags & 1); + + if (flags & 2) + res &= ((c->hitPointsCur <= -10) || (c->flags & 8)) ? 0 : 1; + + if (flags & 4) + res &= ((c->hitPointsCur <= 0) || (c->flags & 8)) ? 0 : 1; + + if (flags & 8) + res &= (c->flags & 12) ? 0 : 1; + + if (flags & 0x20) + res &= (c->flags & 4) ? 0 : 1; + + if (flags & 0x10) + res &= (c->flags & 2) ? 0 : 1; + + if (flags & 0x40) + res &= (c->food <= 0) ? 0 : 1; + + return res; +} + +int EobCoreEngine::getNextValidCharIndex(int curCharIndex, int searchStep) { + do { + curCharIndex += searchStep; + if (curCharIndex < 0) + curCharIndex = 5; + if (curCharIndex > 5) + curCharIndex = 0; + } while (!testCharacter(curCharIndex, 1)); + + return curCharIndex; +} + +void EobCoreEngine::recalcArmorClass(int index) { + EobCharacter *c = &_characters[index]; + int acm = getDexterityArmorClassModifier(c->dexterityCur); + c->armorClass = 10 + acm; + + static uint8 slot[] = { 17, 0, 1, 18 }; + for (int i = 0; i < 4; i++) { + int itm = c->inventory[slot[i]]; + if (!itm) + continue; + + if (i == 2) { + if (!validateWeaponSlotItem(index, 1)) + continue; + } + + int tp = _items[itm].type; + + if (!(_itemTypes[tp].allowedClasses & _classModifierFlags[c->cClass]) || (_itemTypes[tp].extraProperties & 0x7f) || (i >= 1 && i <= 2 && tp != 27 && !(_flags.gameID == GI_EOB2 && tp == 57))) + continue; + + c->armorClass += _itemTypes[tp].armorClass; + c->armorClass -= _items[itm].value; + } + + if (!_items[c->inventory[17]].value) { + int8 m1 = 0; + int8 m2 = 0; + + if (c->inventory[25]) { + if (!(_itemTypes[_items[c->inventory[25]].type].extraProperties & 0x7f)) + m1 = _items[c->inventory[25]].value; + } + + if (c->inventory[26]) { + if (!(_itemTypes[_items[c->inventory[26]].type].extraProperties & 0x7f)) + m2 = _items[c->inventory[26]].value; + } + + c->armorClass -= MAX(m1, m2); + } + + if (c->effectsRemainder[0] > 0) { + if (c->armorClass <= (acm + 6)) + c->effectsRemainder[0] = 0; + else + c->armorClass = (acm + 6); + } + + // shield + if ((c->effectFlags & 8) && (c->armorClass > 4)) + c->armorClass = 4; + + // magical vestment + if (c->effectFlags & 0x4000) { + int8 m1 = 5; + + if (getCharacterClericPaladinLevel(index) > 5) + m1 += ((getCharacterClericPaladinLevel(index) - 5) / 3); + + if (c->armorClass > m1) + c->armorClass = m1; + } + + if (c->armorClass < -10) + c->armorClass = -10; +} + +int EobCoreEngine::validateWeaponSlotItem(int index, int slot) { + EobCharacter *c = &_characters[index]; + int itm1 = c->inventory[0]; + int r = itemUsableByCharacter(index, itm1); + int tp1 = _items[itm1].type; + + if (!slot) + return (!itm1 || r) ? 1 : 0; + + int itm2 = c->inventory[1]; + r = itemUsableByCharacter(index, itm2); + int tp2 = _items[itm2].type; + + if (itm1 && _itemTypes[tp1].requiredHands == 2) + return 0; + + if (!itm2) + return 1; + + int f = (_itemTypes[tp2].extraProperties & 0x7f); + if (f <= 0 || f > 3) + return r; + + if (_itemTypes[tp2].requiredHands) + return 0; + + return r; +} + +int EobCoreEngine::getCharacterClericPaladinLevel(int index) { + if (_castScrollSlot) + return 9; + + if (index == -1) + return (_currentLevel < 7) ? 5 : 9; + + int l = getLevelIndexForHpIncType(2, _characters[index].cClass); + if (l > -1) + return _characters[index].level[l]; + + l = getLevelIndexForHpIncType(4, _characters[index].cClass); + if (l > -1) { + if (_characters[index].level[l] > 8) + return _characters[index].level[l] - 8; + } + + return 1; +} + +int EobCoreEngine::getCharacterMageLevel(int index) { + if (_castScrollSlot) + return 9; + + if (index == -1) + return (_currentLevel < 7) ? 5 : 9; + + int l = getLevelIndexForHpIncType(1, _characters[index].cClass); + return (l > -1) ? _characters[index].level[l] : 1; +} + +int EobCoreEngine::getLevelIndexForHpIncType(int hpIncType, int cClass) { + if (getClassHpIncreaseType(cClass, 0) == hpIncType) + return 0; + + if (getClassHpIncreaseType(cClass, 1) == hpIncType) + return 1; + + if (getClassHpIncreaseType(cClass, 2) == hpIncType) + return 2; + + return -1; +} + +int EobCoreEngine::countCharactersWithSpecificItems(int16 itemType, int16 itemValue) { + int res = 0; + for (int i = 0; i < 6; i++) { + if (!testCharacter(i, 1)) + continue; + if (checkCharacterInventoryForItem(i, itemType, itemValue) != -1) + res++; + } + return res; +} + +int EobCoreEngine::checkCharacterInventoryForItem(int character, int16 itemType, int16 itemValue) { + for (int i = 0; i < 27; i++) { + uint16 inv = _characters[character].inventory[i]; + if (!inv) + continue; + if (_items[inv].type != itemType && itemType != -1) + continue; + if (_items[inv].value == itemValue || itemValue == -1) + return i; + } + return -1; +} + +void EobCoreEngine::modifyCharacterHitpoints(int character, int16 points) { + if (!testCharacter(character, 3)) + return; + + EobCharacter *c = &_characters[character]; + c->hitPointsCur += points; + if (c->hitPointsCur > c->hitPointsMax) + c->hitPointsCur = c->hitPointsMax; + + gui_drawHitpoints(character); + gui_drawCharPortraitWithStats(character); +} + +void EobCoreEngine::neutralizePoison(int character) { + _characters[character].flags &= ~2; + _characters[character].effectFlags &= ~0x2000; + deleteCharEventTimer(character, -34); + gui_drawCharPortraitWithStats(character); +} + +void EobCoreEngine::initNpc(int npcIndex) { + EobCharacter *c = _characters; + int i = 0; + for (; i < 6; i++) { + if (!(_characters[i].flags & 1)) { + c = &_characters[i]; + break; + } + } + + delete[] c->faceShape; + memcpy(c, &_npcPreset[npcIndex], sizeof(EobCharacter)); + recalcArmorClass(i); + + for (i = 0; i < 25; i++) { + if (!c->inventory[i]) + continue; + c->inventory[i] = duplicateItem(c->inventory[i]); + } + + _screen->loadEobBitmap(_flags.gameID == GI_EOB2 ? "OUTPORTS" : "OUTTAKE", 3, 3); + _screen->_curPage = 2; + c->faceShape = _screen->encodeShape(npcIndex << 2, _flags.gameID == GI_EOB2 ? 0 : 160, 4, 32, true); + _screen->_curPage = 0; +} + +int EobCoreEngine::npcJoinDialogue(int npcIndex, int queryJoinTextId, int confirmJoinTextId, int noJoinTextId) { + gui_drawDialogueBox(); + _txt->printDialogueText(queryJoinTextId, 0); + + int r = runDialogue(-1, 0, _yesNoStrings[0], _yesNoStrings[1]) - 1; + if (r == 0) { + if (confirmJoinTextId == -1) { + char tmp[35]; + snprintf(tmp, 35, _npcJoinStrings[0], _npcPreset[npcIndex].name); + _txt->printDialogueText(tmp, true); + } else { + _txt->printDialogueText(confirmJoinTextId, _okStrings[0]); + } + + if (prepareForNewPartyMember(33, npcIndex + 1)) + initNpc(npcIndex); + + } else if (r == 1) { + _txt->printDialogueText(noJoinTextId, _okStrings[0]); + } + + return r ^ 1; +} + +int EobCoreEngine::prepareForNewPartyMember(int16 itemType, int16 itemValue) { + int numChars = 0; + for (int i = 0; i < 6; i++) + numChars += (_characters[i].flags & 1); + + if (numChars < 6) { + deletePartyItem(itemType, itemValue); + } else { + gui_drawDialogueBox(); + _txt->printDialogueText(_npcMaxStrings[0]); + int r = runDialogue(-1, 1, _characters[0].name, _characters[1].name, _characters[2].name, _characters[3].name, + _characters[4].name, _characters[5].name, _abortStrings[0], 0, 0) - 1; + + if (r == 6) + return 0; + + deletePartyItem(itemType, itemValue); + removeCharacterFromParty(r); + } + + return 1; +} + +void EobCoreEngine::removeCharacterFromParty(int charIndex) { + EobCharacter *c = &_characters[charIndex]; + c->flags = 0; + + for (int i = 0; i < 27; i++) { + if (i == 16 || !c->inventory[i]) + continue; + + setItemPosition((Item*)&_levelBlockProperties[_currentBlock & 0x3ff].drawObjects, _currentBlock, c->inventory[i], _dropItemDirIndex[(_currentDirection << 2) + rollDice(1, 2, -1)]); + c->inventory[i] = 0; + } + + while (c->inventory[16]) + setItemPosition((Item*)&_levelBlockProperties[_currentBlock & 0x3ff].drawObjects, _currentBlock, getQueuedItem(&c->inventory[16], 0, -1), _dropItemDirIndex[(_currentDirection << 2) + rollDice(1, 2, -1)]); + + c->inventory[16] = 0; + + if (_updateCharNum == charIndex) + _updateCharNum = 0; + + setupCharacterTimers(); +} + +void EobCoreEngine::increasePartyExperience(int16 points) { + int cnt = 0; + for (int i = 0; i < 6; i++) { + if (testCharacter(i, 3)) + cnt++; + } + + if (cnt <= 0) + return; + + points /= cnt; + + for (int i = 0; i < 6; i++) { + if (!testCharacter(i, 3)) + continue; + increaseCharacterExperience(i, points); + } +} + +void EobCoreEngine::increaseCharacterExperience(int charIndex, int32 points) { + int cl = _characters[charIndex].cClass; + points /= _numLevelsPerClass[cl]; + + for (int i = 0; i < 3; i++) { + if (getClassHpIncreaseType(cl, i) == -1) + continue; + _characters[charIndex].experience[i] += points; + + uint32 er = getRequiredExperience(cl, i, _characters[charIndex].level[i] + 1); + if (er == 0xffffffff) + continue; + + if (_characters[charIndex].experience[i] >= er) + increaseCharacterLevel(charIndex, i); + } +} + +uint32 EobCoreEngine::getRequiredExperience(int cClass, int levelIndex, int level) { + cClass = getClassHpIncreaseType(cClass, levelIndex); + if (cClass == -1) + return 0xffffffff; + + const uint32 *tbl = _expRequirementTables[cClass]; + return tbl[level - 1]; +} + +void EobCoreEngine::increaseCharacterLevel(int charIndex, int levelIndex) { + _characters[charIndex].level[levelIndex]++; + int hpInc = generateCharacterHitpointsByLevel(charIndex, levelIndex); + _characters[charIndex].hitPointsCur += hpInc; + _characters[charIndex].hitPointsMax += hpInc; + + gui_drawCharPortraitWithStats(charIndex); + _txt->printMessage(_levelGainStrings[0], -1, _characters[charIndex].name); + snd_playSoundEffect(23); +} + +void EobCoreEngine::setWeaponSlotStatus(int charIndex, int mode, int slot) { + if (mode == 0 || mode == 2) + _characters[charIndex].disabledSlots ^= (1 << slot); + else if (mode != 1) + return; + + _characters[charIndex].slotStatus[slot] = 0; + gui_drawCharPortraitWithStats(charIndex); +} + +void EobCoreEngine::setupDialogueButtons(int presetfirst, int numStr, const char *str1, ...) { + _dialogueNumButtons = numStr; + _dialogueButtonString[0] = str1; + _dialogueHighlightedButton = 0; + + va_list args; + va_start(args, str1); + const char **s5p = va_arg(args, const char**); + va_end(args); + for (int i = 1; i < numStr; i++) { + if (s5p[i - 1]) + _dialogueButtonString[i] = s5p[i - 1]; + else + _dialogueNumButtons = numStr = i; + } + + static const uint16 prsX[] = { 59, 166, 4, 112, 220, 4, 112, 220, 4, 112, 220, 4, 112, 220 }; + static const uint8 prsY[] = { 0, 0, 0, 0, 0, 12, 12, 12, 24, 24, 24, 36, 36, 36 }; + + const ScreenDim *dm = screen()->_curDim; + int yOffs = (_txt->lineCount() + 1) * _screen->getFontHeight() + dm->sy + 4; + + _dialogueButtonPosX = &prsX[presetfirst]; + _dialogueButtonPosY = &prsY[presetfirst]; + _dialogueButtonYoffs = yOffs; + + drawDialogueButtons(); + + if (!shouldQuit()) + removeInputTop(); +} + +void EobCoreEngine::initDialogueSequence() { + _dlgUnk1 = -1; + _txt->setWaitButtonMode(0); + _dialogueField = true; + + _dialogueLastBitmap[0] = 0; + + _txt->resetPageBreakString(); + gui_updateControls(); + + _sound->playTrack(0); + Common::SeekableReadStream *s = _res->createReadStream("TEXT.DAT"); + _screen->loadFileDataToPage(s, 5, 32000); + _txt->setupField(9, 0); + delete s; +} + +void EobCoreEngine::restoreAfterDialogueSequence() { + _txt->allowPageBreak(false); + _dialogueField = false; + + _dialogueLastBitmap[0] = 0; + + gui_restorePlayField(); + _screen->setScreenDim(7); + + if (_flags.gameID == GI_EOB2) + _sound->playTrack(2); + + _sceneUpdateRequired = true; +} + +void EobCoreEngine::drawSequenceBitmap(const char *file, int destRect, int x1, int y1, int flags) { + static const uint8 frameX[] = { 1, 0 }; + static const uint8 frameY[] = { 8, 0 }; + static const uint8 frameW[] = { 20, 40 }; + static const uint8 frameH[] = { 96, 121 }; + + int page = ((flags & 2) || destRect) ? 0 : 6; + + if (scumm_stricmp(_dialogueLastBitmap, file)) { + if (!destRect) { + if (!(flags & 1)) { + _screen->loadEobCpsFileToPage("BORDER", 0, 3, 3, 2); + _screen->copyRegion(0, 0, 0, 0, 184, 121, 2, page, Screen::CR_NO_P_CHECK); + } else { + _screen->copyRegion(0, 0, 0, 0, 184, 121, 0, page, Screen::CR_NO_P_CHECK); + } + + if (!page) + _screen->copyRegion(0, 0, 0, 0, 184, 121, 2, 6, Screen::CR_NO_P_CHECK); + } + + _screen->loadEobCpsFileToPage(file, 0, 3, 3, 2); + strcpy(_dialogueLastBitmap, file); + } + + if (flags & 2) + _screen->crossFadeRegion(x1 << 3, y1, frameX[destRect] << 3, frameY[destRect], frameW[destRect] << 3, frameH[destRect], 2, page); + else + _screen->copyRegion(x1 << 3, y1, frameX[destRect] << 3, frameY[destRect], frameW[destRect] << 3, frameH[destRect], 2, page, Screen::CR_NO_P_CHECK); + + if (page == 6) + _screen->copyRegion(0, 0, 0, 0, 184, 121, 6, 0, Screen::CR_NO_P_CHECK); + + _screen->updateScreen(); +} + +int EobCoreEngine::runDialogue(int dialogueTextId, int style, const char *button1, ...) { + if (dialogueTextId != -1) + txt()->printDialogueText(dialogueTextId, 0); + + va_list args; + va_start(args, button1); + if (style) + setupDialogueButtons(2, 9, button1, args); + else + setupDialogueButtons(0, 2, button1, args); + va_end(args); + + int res = 0; + while (res == 0 && !shouldQuit()) + res = processDialogue(); + + gui_drawDialogueBox(); + + return res; +} + +void EobCoreEngine::delay(uint32 millis, bool, bool) { + while (millis && !shouldQuit() && !skipFlag()) { + updateInput(); + uint32 step = MIN(millis, (_tickLength / 5)); + _system->delayMillis(step); + millis -= step; + } +} + +void EobCoreEngine::displayParchment(int id) { + _txt->setWaitButtonMode(1); + _txt->resetPageBreakString(); + gui_updateControls(); + + if (id >= 0) { + // display text + Common::SeekableReadStream *s = _res->createReadStream("TEXT.DAT"); + _screen->loadFileDataToPage(s, 5, 32000); + gui_drawBox(0, 0, 176, 175, _color1_1, _color2_1, _bkgColor_1); + _txt->setupField(12, 1); + if (_flags.gameID == GI_EOB2) + id++; + _txt->printDialogueText(id, _okStrings[0]); + + } else { + // display bitmap + id = -id - 1; + static const uint8 x[] = { 0, 20, 0 }; + static const uint8 y[] = { 0, 0, 96 }; + drawSequenceBitmap("MAP", 0, x[id], y[id], 0); + + removeInputTop(); + while (!shouldQuit()) { + delay(_tickLength); + if (checkInput(0) & 0xff) + break; + removeInputTop(); + } + removeInputTop(); + } + + restoreAfterDialogueSequence(); +} + +void EobCoreEngine::useSlotWeapon(int charIndex, int slotIndex, int item) { + EobCharacter *c = &_characters[charIndex]; + int tp = item ? _items[item].type : 0; + + if (c->effectFlags & 0x40) + removeCharacterEffect(10, charIndex, 1); // remove invisibility effect + + int ep = _itemTypes[tp].extraProperties & 0x7f; + int8 inflict = 0; + + if (ep == 1) { + inflict = closeDistanceAttack(charIndex, item); + if (!inflict) + inflict = -1; + snd_playSoundEffect(32); + } else if (ep == 2) { + inflict = thrownAttack(charIndex, slotIndex, item); + } else if (ep == 3) { + inflict = bowAttack(charIndex, item); + gui_drawCharPortraitWithStats(charIndex); + } + + if (inflict > 0) { + if (_items[item].flags & 8) { + c->hitPointsCur += inflict; + gui_drawCharPortraitWithStats(charIndex); + } + + if (_items[item].flags & 0x10) + c->inventory[slotIndex] = 0; + + inflictMonsterDamage(&_monsters[_dstMonsterIndex], inflict, true); + } + + c->disabledSlots ^= (1 << slotIndex); + c->slotStatus[slotIndex] = inflict; + + gui_drawCharPortraitWithStats(charIndex); + setCharEventTimer(charIndex, 18, inflict >= -2 ? slotIndex + 2 : slotIndex, 1); +} + +int EobCoreEngine::closeDistanceAttack(int charIndex, int item) { + if (charIndex > 1) + return -3; + + uint16 d = calcNewBlockPosition(_currentBlock, _currentDirection); + int r = getClosestMonsterPos(charIndex, d); + + if (r == -1) { + uint8 w = _specialWallTypes[_levelBlockProperties[d].walls[_sceneDrawVarDown]]; + if (w == 0xff) { + if (_flags.gameID == GI_EOB1) { + _levelBlockProperties[d].walls[_sceneDrawVarDown]++; + _levelBlockProperties[d].walls[_sceneDrawVarDown ^ 2]++; + + } else { + for (int i = 0; i < 4; i++) { + if (_specialWallTypes[_levelBlockProperties[d].walls[i]] == 0xff) + _levelBlockProperties[d].walls[i]++; + } + } + _sceneUpdateRequired = true; + + } else if ((_flags.gameID == GI_EOB1) || (_flags.gameID == GI_EOB2 && w != 8 && w != 9)) { + return -1; + } + + return (_flags.gameID == GI_EOB2 && ((_itemTypes[_items[item].type].allowedClasses & 4) || !item)) ? -5 : -2; + + } else { + if (_monsters[r].flags & 0x20) { + killMonster(&_monsters[r], 1); + _txt->printMessage(_monsterDustStrings[0]); + return -2; + } + + if (!characterAttackHitTest(charIndex, r, item, 1)) + return -1; + + uint16 flg = 0x100; + + if ((_flags.gameID == GI_EOB1 && _items[item].type > 51 && _items[item].type < 57) || (_flags.gameID == GI_EOB2 && isMagicWeapon(item))) + flg |= 1; + + _dstMonsterIndex = r; + return calcCloseDistanceMonsterDamage(&_monsters[r], charIndex, item, 1, flg, 5, 3); + } + + return 0; +} + +int EobCoreEngine::thrownAttack(int charIndex, int slotIndex, int item) { + int d = charIndex > 3 ? charIndex - 2 : charIndex; + if (!launchObject(charIndex, item, _currentBlock, _dropItemDirIndex[(_currentDirection << 2) + d], _currentDirection, _items[item].type)) + return 0; + + snd_playSoundEffect(11); + _characters[charIndex].inventory[slotIndex] = 0; + reloadWeaponSlot(charIndex, slotIndex, -1, 0); + _sceneUpdateRequired = true; + return 0; +} + +int EobCoreEngine::bowAttack(int charIndex, int item) { + return 0; +} + +void EobCoreEngine::inflictMonsterDamage(EobMonsterInPlay *m, int damage, bool giveExperience) { + m->hitPointsCur -= damage; + m->flags = (m->flags & 0xf7) | 1; + + if (_monsterProps[m->type].flags & 0x2000) { + inflictMonsterDamage_s1(m); + checkSceneUpdateNeed(m->block); + m->hitPointsCur = 0; + } else { + if (checkSceneUpdateNeed(m->block)) { + m->flags |= 2; + if (_inflictMonsterDamageUnk) + return; + flashMonsterShape(m); + } + } + + if (m->hitPointsCur <= 0) + killMonster(m, giveExperience); + else if (getBlockDistance(m->block, _currentBlock) < 4) + m->dest = _currentBlock; +} + +void EobCoreEngine::calcAndInflictMonsterDamage(EobMonsterInPlay *m, int times, int pips, int offs, int flags, int b, int damageType) { + int dmg = calcCloseDistanceMonsterDamage(m, times, pips, offs, flags, b, damageType); + if (dmg > 0) + inflictMonsterDamage(m, dmg, flags & 0x800 ? true : false); +} + +void EobCoreEngine::calcAndInflictCharacterDamage(int charIndex, int times, int itemOrPips, int useStrModifierOrBase, int flg, int a, int damageType) { + int dmg = calcCharacterDamage(charIndex, times, itemOrPips, useStrModifierOrBase, flg, a, damageType); + if (dmg) + inflictCharacterDamage(charIndex, dmg); +} + +int EobCoreEngine::calcCharacterDamage(int charIndex, int times, int itemOrPips, int useStrModifierOrBase, int flg, int a, int damageType) { + int s = (flg & 0x100) ? calcDamageModifers(times, 0, itemOrPips, _items[itemOrPips].type, useStrModifierOrBase) : rollDice(times, itemOrPips, useStrModifierOrBase); + EobCharacter *c = &_characters[charIndex]; + + if (a != 5) { + if (checkUnkConstModifiers(c, _charClassModUnk[c->cClass], c->level[0], a, c->raceSex)) + s = recalcDamageModifier(damageType, s); + } + + if ((flg & 0x110) == 0x110) { + if (!calcDamageCheckItemType(_items[itemOrPips].type)) + s = 1; + } + + if (flg & 4) { + if (checkInventoryForRings(charIndex, 3)) + s = 0; + } + + if (flg & 0x400) { + if (c->effectFlags & 0x2000) + s = 0; + else + _txt->printMessage(_characterStatusStrings8[0], -1, c->name); + } + + return s; +} + +void EobCoreEngine::inflictCharacterDamage(int charIndex, int damage) { + EobCharacter *c = &_characters[charIndex]; + if (!testCharacter(charIndex, 3)) + return; + + if (c->effectsRemainder[3]) + c->effectsRemainder[3] = (damage < c->effectsRemainder[3]) ? (c->effectsRemainder[3] - damage) : 0; + + c->hitPointsCur -= damage; + c->damageTaken = damage; + + if (c->hitPointsCur > -10) { + snd_playSoundEffect(21); + } else { + c->hitPointsCur = -10; + c->flags &= 1; + c->food = 0; + removeAllCharacterEffects(charIndex); + snd_playSoundEffect(22); + } + + if (c->effectsRemainder[0]) { + c->effectsRemainder[0] = (damage < c->effectsRemainder[0]) ? (c->effectsRemainder[0] - damage) : 0; + if (!c->effectsRemainder[0]) + removeCharacterEffect(1, charIndex, 1); + } + + if (_currentControlMode) + gui_drawFaceShape(charIndex); + else + gui_drawCharPortraitWithStats(charIndex); + + if (c->hitPointsCur <= 0 && _updateFlags == 1 && charIndex == _openBookChar) { + Button b; + clickedSpellbookAbort(&b); + } + + setCharEventTimer(charIndex, 18, 6, 1); +} + +bool EobCoreEngine::characterAttackHitTest(int charIndex, int monsterIndex, int item, int attackType) { + if (charIndex < 0) + return true; + + int p = item ? (_flags.gameID == GI_EOB1 ? _items[item].type : (_itemTypes[_items[item].type].extraProperties & 0x7f)) : 0; + + if (_monsters[monsterIndex].flags & 0x20) + return true;// EOB 2 only ? + + int t = _monsters[monsterIndex].type; + int d = (p < 1 || p > 3) ? 0 : _items[item].value; + + if (_flags.gameID == GI_EOB2) { + if ((p > 0 && p < 4) || !item ){ + if (((_monsterProps[t].statusFlags & 0x200) && (d <= 0)) || ((_monsterProps[t].statusFlags & 0x1000) && (d <= 1))) + return false; + } + } + + d += (attackType ? getStrHitChanceModifier(charIndex) : getDexHitChanceModifier(charIndex)); + + int m = getMonsterAcHitChanceModifier(charIndex, _monsterProps[t].armorClass) - d; + int s = rollDice(1, 20); + + _monsters[monsterIndex].flags |= 1; + + if (_flags.gameID == GI_EOB1) { + if (_partyEffectFlags & 0x30) + s++; + if (_characters[charIndex].effectFlags & 0x40) + s++; + } else if ((_partyEffectFlags & 0x8400) || (_characters[charIndex].effectFlags & 0x1000)) { + s++; + } + + s = CLIP(s, 1, 20); + + return s < m ? false : true; +} + +bool EobCoreEngine::monsterAttackHitTest(EobMonsterInPlay *m, int charIndex) { + int tp = m->type; + EobMonsterProperty *p = &_monsterProps[tp]; + + int r = rollDice(1, 20); + if (r != 20) { + if (_characters[charIndex].effectFlags & 0x800) + r -= 2; + if (_characters[charIndex].effectFlags & 0x10) + r -= 2; + if (_partyEffectFlags & 0x8000) + r--; + } + + return ((r == 20) || (r >= (p->hitChance - _characters[charIndex].armorClass))); +} + +bool EobCoreEngine::flyingObjectMonsterHit(EobFlyingObject *fo, int monsterIndex) { + if (fo->attackerId != -1) { + if (!characterAttackHitTest(fo->attackerId, monsterIndex, fo->item, 0)) + return false; + } + calcAndInflictMonsterDamage(&_monsters[monsterIndex], fo->attackerId, fo->item, 0, (fo->attackerId == -1) ? 0x110: 0x910, 5, 3); + return true; +} + +bool EobCoreEngine::flyingObjectPartyHit(EobFlyingObject *fo) { + int ps = _dscItemPosIndex[(_currentDirection << 2) + (_items[fo->item].pos & 3)]; + bool res = false; + + bool b = ((_currentDirection == fo->direction || _currentDirection == (fo->direction ^ 2)) && ps > 2); + int s = ps << 1; + if (ps > 2) + s += rollDice(1, 2, -1); + + static const int8 charId[] = { 0, -1, 1, -1, 2, 4, 3, 5 }; + + for (int i = 0; i < 2; i++) { + int c = charId[s]; + s ^= 1; + if (!testCharacter(c, 3)) + continue; + calcAndInflictCharacterDamage(c, -1, fo->item, 0, 0x110, 5, 3); + res = true; + if (ps < 2 || b == 0) + break; + } + + return res; +} + +void EobCoreEngine::monsterCloseAttack(EobMonsterInPlay *m) { + int first = _monsterCloseAttDstTable1[(_currentDirection << 2) + m->dir] * 12; + int v = (m->pos == 4) ? rollDice(1, 2, -1) : _monsterCloseAttChkTable2[(m->dir << 2) + m->pos]; + if (!v) + first += 6; + + int last = first + 6; + for (int i = first; i < last; i++) { + int c = _monsterCloseAttDstTable2[i]; + if (!testCharacter(c, 3)) + continue; + + // Character Invisibility + if ((_characters[c].effectFlags & 0x140) && (rollDice(1, 20) >= 5)) + continue; + + int dmg = 0; + for (int ii = 0; ii < _monsterProps[m->type].attacksPerRound; ii++) { + if (!monsterAttackHitTest(m, c)) + continue; + dmg += rollDice(_monsterProps[m->type].dmgDc[ii].times, _monsterProps[m->type].dmgDc[ii].pips, _monsterProps[m->type].dmgDc[ii].base); + } + + if (dmg > 0) { + if ((_monsterProps[m->type].flags & 0x80) && rollDice(1, 4, -1) != 3) { + int slot = rollDice(1, 27, -1); + for (int iii = 0; iii < 27; iii++) { + Item itm = _characters[c].inventory[slot]; + if (!itm || !(_itemTypes[_items[itm].type].extraProperties & 0x80)) { + if (++slot == 27) + slot = 0; + continue; + } + + _characters[c].inventory[slot] = 0; + _txt->printMessage(_itemExtraStrings[(_characters[c].raceSex & 1) ^ 1], -1, _characters[c].name); + printFullItemName(itm); + _txt->printMessage(_itemExtraStrings[2]); + } + gui_drawCharPortraitWithStats(c); + } + + inflictCharacterDamage(c, dmg); + + if (_monsterProps[m->type].flags & 0x10) { + statusAttack(c, 2, _monsterSpecAttStrings[_flags.gameID == GI_EOB1 ? 3 : 2], 0, 1, 8, 1); + _characters[c].effectFlags &= ~0x2000; + } + + if (_monsterProps[m->type].flags & 0x20) + statusAttack(c, 4, _monsterSpecAttStrings[_flags.gameID == GI_EOB1 ? 4 : 3], 2, 5, 9, 1); + + if (_monsterProps[m->type].flags & 0x8000) + statusAttack(c, 8, _monsterSpecAttStrings[4], 2, 0, 0, 1); + + } + + if (!(_monsterProps[m->type].flags & 0x4000)) + return; + } +} + +void EobCoreEngine::monsterSpellCast(EobMonsterInPlay *m, int type) { + launchMagicObject(-1, type, m->block, m->pos, m->dir); + snd_processEnvironmentalSoundEffect(_spells[_magicFlightObjectProperties[type << 2]].sound, m->block); +} + +void EobCoreEngine::statusAttack(int charIndex, int attackStatusFlags, const char *attackStatusString, int a, uint32 effectDuration, int restoreEvent, int noRefresh) { + EobCharacter *c = &_characters[charIndex]; + if ((c->flags & attackStatusFlags) && noRefresh) + return; + if (!testCharacter(charIndex, 3)) + return; + + if (a != 5 && specialAttackConstTest(charIndex, a)) + return; + + if (attackStatusFlags & 8) { + removeAllCharacterEffects(charIndex); + c->flags = (c->flags & 1) | 8; + } else { + c->flags |= attackStatusFlags; + } + + if ((attackStatusFlags & 0x0c) && (_openBookChar == charIndex) && _updateFlags) { + Button b; + clickedSpellbookAbort(&b); + } + + if (effectDuration) + setCharEventTimer(charIndex, effectDuration * 546, restoreEvent, 1); + + gui_drawCharPortraitWithStats(charIndex); + _txt->printMessage(_characterStatusStrings13[0], -1, c->name, attackStatusString); +} + +int EobCoreEngine::calcCloseDistanceMonsterDamage(EobMonsterInPlay *m, int times, int pips, int offs, int flags, int b, int damageType) { + int s = flags & 0x100 ? calcDamageModifers(times, m, pips, _items[pips].type, offs) : rollDice(times, pips, offs); + EobMonsterProperty *p = &_monsterProps[m->type]; + + if (b == 5) { + if (checkUnkConstModifiers(m, 0, p->level, b, 6)) + s = recalcDamageModifier(damageType, s); + } + + if ((flags & 0x110) == 0x110) { + if (!calcDamageCheckItemType(_items[pips].type)) + s = 1; + } + + if ((flags & 0x100) && ((_flags.gameID == GI_EOB2 && (p->statusFlags & 0x100)) || (_flags.gameID == GI_EOB1 && (p->flags & 4))) && (!(_itemTypes[_items[pips].type].allowedClasses & 4 /* bug in original code ??*/))) + s >>= 1; + + if (p->statusFlags & 0x2000) { + if (flags & 0x100) { + if (_items[pips].value < 3) + s >>= 2; + if (_items[pips].value == 3) + s >>= 1; + if (s == 0) + s = _items[pips].value; + + } else { + s >>= 1; + } + } + + if (flags & 1) { + if (checkMonsterDamageEvasion(m)) + s = 0; + } + + if (_flags.gameID == GI_EOB1) + return s; + + static const uint16 damageImmunityFlags[] = { 0x01, 0x10, 0x02, 0x20, 0x80, 0x400, 0x20, 0x800, 0x40, 0x80, 0x400, 0x40 }; + for (int i = 0; i < 12; i += 2) { + if ((flags & damageImmunityFlags[i]) && (p->statusFlags & damageImmunityFlags[i + 1])) + s = 0; + } + + return s; +} + +int EobCoreEngine::calcDamageModifers(int charIndex, EobMonsterInPlay *m, int item, int itemType, int useStrModifier) { + int s = (useStrModifier && (charIndex != -1)) ? getStrDamageModifier(charIndex) : 0; + if (item) { + EobItemType *p = &_itemTypes[itemType]; + int t = m ? m->type : 0; + s += ((m && (_monsterProps[t].flags & 1)) ? rollDice(p->dmgNumDiceL, p->dmgNumPipsL, p->dmgIncS /* bug in original code ? */) : + rollDice(p->dmgNumDiceS, p->dmgNumPipsS, p->dmgIncS)); + s += _items[item].value; + } else { + s += rollDice(1, 2); + } + + return (s < 0) ? 0 : s; +} + +bool EobCoreEngine::checkUnkConstModifiers(void *target, int hpModifier, int level, int b, int race) { + static const int8 constMod[] = { 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5 }; + + if (b == 5) + return false; + + int s = getConstModifierTableValue(hpModifier, level, b); + if (((race == 3 || race == 5) && (b == 4 || b == 1 || b == 0)) || (race == 4 && (b == 4 || b == 1))) { + EobCharacter *c = (EobCharacter*)target; + s -= constMod[c->constitutionCur]; + } + + return rollDice(1, 20) < s ? false : true; +} + +bool EobCoreEngine::specialAttackConstTest(int charIndex, int b) { + return checkUnkConstModifiers(&_characters[charIndex], _charClassModUnk[_characters[charIndex].cClass], _characters[charIndex].level[0], b, _characters[charIndex].raceSex >> 1); +} + +int EobCoreEngine::getConstModifierTableValue(int hpModifier, int level, int b) { + const uint8 *tbl = _constModTables[hpModifier]; + if (_constModLevelIndex[hpModifier] < level) + level = _constModLevelIndex[hpModifier]; + level /= _constModDiv[hpModifier]; + level += (_constModExt[hpModifier] * b); + + return tbl[level]; +} + +bool EobCoreEngine::calcDamageCheckItemType(int itemType) { + itemType = _itemTypes[itemType].extraProperties & 0x7f; + return (itemType == 2 || itemType == 3) ? true : false; +} + +int EobCoreEngine::recalcDamageModifier(int damageType, int dmgModifier) { + if (damageType == 3) + return 0; + + if (damageType == 0 || damageType == 1) + return dmgModifier >> 1; + + return dmgModifier; +} + +bool EobCoreEngine::checkMonsterDamageEvasion(EobMonsterInPlay *m) { + return rollDice(1, 100) < _monsterProps[m->type].dmgModifierEvade ? true : false; +} + +int EobCoreEngine::getStrHitChanceModifier(int charIndex) { + static const int8 strExtLimit[] = { 1, 51, 76, 91, 100 }; + static const int8 strExtMod[] = { 1, 2, 2, 2, 3 }; + static const int8 strMod[] = { -4, -3, -3, -2, -2, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 3, 3, 4, 4, 5, 6, 7 }; + + int r = strMod[_characters[charIndex].strengthCur - 1]; + if (_characters[charIndex].strengthExtCur) { + for (int i = 0; i < 5; i++) { + if (_characters[charIndex].strengthExtCur >= strExtLimit[i]) + r = strExtMod[i]; + } + } + + return r; +} + +int EobCoreEngine::getStrDamageModifier(int charIndex) { + static const int8 strExtLimit[] = { 1, 51, 76, 91, 100 }; + static const int8 strExtMod[] = { 3, 3, 4, 5, 6 }; + static const int8 strMod[] = { -3, -2, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 7, 8, 9, 10, 11, 12, 14 }; + + int r = strMod[_characters[charIndex].strengthCur - 1]; + if (_characters[charIndex].strengthExtCur) { + for (int i = 0; i < 5; i++) { + if (_characters[charIndex].strengthExtCur >= strExtLimit[i]) + r = strExtMod[i]; + } + } + + return r; +} + +int EobCoreEngine::getDexHitChanceModifier(int charIndex) { + static const int8 dexMod[] = { -5, -4, -3, -2, -1, 0, 0, 0, 0, 0, 0, 1, 2, 2, 3, 3, 4, 4, 4 }; + return dexMod[_characters[charIndex].dexterityCur - 1]; +} + +int EobCoreEngine::getMonsterAcHitChanceModifier(int charIndex, int monsterAc) { + static const uint8 mod1[] = { 1, 3, 3, 2 }; + static const uint8 mod2[] = { 1, 1, 2, 1 }; + + int l = _characters[charIndex].level[0] - 1; + int cm = _charClassModUnk[_characters[charIndex].cClass]; + + return (20 - ((l / mod1[cm]) * mod2[cm])) - monsterAc; +} + +void EobCoreEngine::inflictMonsterDamage_s1(EobMonsterInPlay *m) { + +} + +void EobCoreEngine::snd_playSoundEffect(int id, int volume) { + if (id < 1 || id > 119 || shouldQuit()) + return; + + _sound->playSoundEffect(id, volume); +} + +} // End of namespace Kyra + +#endif // ENABLE_EOB diff --git a/engines/kyra/eobcommon.h b/engines/kyra/eobcommon.h new file mode 100644 index 0000000000..201c1dfa11 --- /dev/null +++ b/engines/kyra/eobcommon.h @@ -0,0 +1,977 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef KYRA_EOBCOMMON_H +#define KYRA_EOBCOMMON_H + +#if defined(ENABLE_EOB) || defined(ENABLE_LOL) +#include "kyra/loleobbase.h" +#endif // (ENABLE_EOB || ENABLE_LOL) + +#ifdef ENABLE_EOB + +namespace Kyra { + +struct EobShapeDef { + int16 index; + uint8 x, y, w, h; +}; + +struct CreatePartyModButton { + uint8 encodeLabelX; + uint8 encodeLabelY; + uint8 labelW; + uint8 labelH; + uint8 labelX; + uint8 labelY; + uint8 bodyIndex; + uint8 destX; + uint8 destY; +}; + +struct EobRect8 { + uint8 x; + uint8 y; + uint8 w; + uint8 h; +}; + +struct EobRect16 { + int16 x1; + int16 y1; + uint16 x2; + uint16 y2; +}; + +struct EobChargenButtonDef { + uint8 x; + uint8 y; + uint8 w; + uint8 h; + uint8 keyCode; +}; + +struct EobGuiButtonDef { + uint8 keyCode; + uint8 keyCode2; + uint16 flags; + uint16 x; + uint8 y; + uint16 w; + uint8 h; + Button::Callback buttonCallback; + uint16 arg; +}; + +struct EobCharacter { + uint8 id; + uint8 flags; + char name[11]; + int8 strengthCur; + int8 strengthMax; + int8 strengthExtCur; + int8 strengthExtMax; + int8 intelligenceCur; + int8 intelligenceMax; + int8 wisdomCur; + int8 wisdomMax; + int8 dexterityCur; + int8 dexterityMax; + int8 constitutionCur; + int8 constitutionMax; + int8 charismaCur; + int8 charismaMax; + int16 hitPointsCur; + int16 hitPointsMax; + int8 armorClass; + uint8 disabledSlots; + uint8 raceSex; + uint8 cClass; + uint8 alignment; + int8 portrait; + uint8 food; + uint8 level[3]; + uint32 experience[3]; + uint8 *faceShape; + + int8 mageSpells[80]; + int8 clericSpells[80]; + uint32 mageSpellsAvailabilityFlags; + + Item inventory[27]; + uint32 timers[10]; + int8 events[10]; + uint8 effectsRemainder[4]; + uint32 effectFlags; + uint8 damageTaken; + int8 slotStatus[5]; +}; + +struct EobItem { + uint8 nameUnid; + uint8 nameId; + uint8 flags; + int8 icon; + int8 type; + int8 pos; + int16 block; + Item next; + Item prev; + uint8 level; + int8 value; +}; + +struct EobItemType { + uint16 invFlags; + uint16 handFlags; + int8 armorClass; + int8 allowedClasses; + int8 requiredHands; + int8 dmgNumDiceS; + int8 dmgNumPipsS; + int8 dmgIncS; + int8 dmgNumDiceL; + int8 dmgNumPipsL; + int8 dmgIncL; + uint8 unk1; + uint16 extraProperties; +}; + +struct SpriteDecoration { + uint8 *shp; + uint8 x; + uint8 y; +}; + +struct EobMonsterProperty { + int8 armorClass; + int8 hitChance; + uint8 level; + uint8 hpDcTimes; + uint8 hpDcPips; + uint8 hpDcBase; + uint8 attacksPerRound; + struct DmgDc { + uint8 times; + uint8 pips; + int8 base; + } dmgDc[3]; + uint16 statusFlags; + uint16 flags; + int32 u22; + int32 experience; + + uint8 u30; + uint8 sound1; + uint8 sound2; + uint8 numRemoteAttacks; + uint8 remoteWeaponChangeMode; + uint8 numRemoteWeapons; + + int8 remoteWeapons[5]; + + uint8 u41; + uint8 dmgModifierEvade; + + uint8 decorations[3]; +}; + +struct EobMonsterInPlay { + uint8 type; + uint8 unit; + uint16 block; + uint8 pos; + int8 dir; + uint8 animStep; + uint8 shpIndex; + int8 mode; + int8 f_9; + int8 curAttackFrame; + uint8 f_b; + int16 hitPointsMax; + int16 hitPointsCur; + uint16 dest; + uint16 randItem; + uint16 fixedItem; + uint8 flags; + uint8 idleAnimState; + uint8 curRemoteWeapon; + uint8 numRemoteAttacks; + int8 palette; + uint8 directionChanged; + uint8 stepsTillRemoteAttack; + uint8 sub; +}; + +struct ScriptTimer { + uint16 func; + uint16 ticks; + uint32 next; +}; + +struct EobFlyingObject { + uint8 enable; + uint8 objectType; + int16 attackerId; + Item item; + uint16 curBlock; + uint16 u2; + uint8 u1; + uint8 direction; + uint8 distance; + int8 callBackIndex; + uint8 curPos; + uint8 flags; + uint8 unused; +}; + +class EobInfProcessor; + +class EobCoreEngine : public LolEobBaseEngine { +friend class TextDisplayer_Eob; +friend class GUI_Eob; +friend class EobInfProcessor; +friend class DarkmoonSequenceHelper; +friend class CharacterGenerator; +public: + EobCoreEngine(OSystem *system, const GameFlags &flags); + virtual ~EobCoreEngine(); + + Screen *screen() { return _screen; } + GUI *gui() const { return _gui; } + +protected: + // Startup + virtual Common::Error init(); + Common::Error go(); + + // Main Menu, Intro, Finale + virtual int mainMenu() = 0; + virtual void seq_playFinale() = 0; + bool _playFinale; + + //Init + void loadItemsAndDecorationsShapes(); + void releaseItemsAndDecorationsShapes(); + + void initButtonData(); + void initStaticResource(); + virtual void initSpells(); + + const uint8 **_largeItemShapes; + const uint8 **_smallItemShapes; + const uint8 **_thrownItemShapes; + const int _numLargeItemShapes; + const int _numSmallItemShapes; + const int _numThrownItemShapes; + const int _numItemIconShapes; + + const uint8 **_spellShapes; + const uint8 **_firebeamShapes; + const uint8 *_redSplatShape; + const uint8 *_greenSplatShape; + const uint8 **_wallOfForceShapes; + const uint8 **_teleporterShapes; + const uint8 **_sparkShapes; + const uint8 *_deadCharShape; + const uint8 *_disabledCharGrid; + const uint8 *_blackBoxSmallGrid; + const uint8 *_weaponSlotGrid; + const uint8 *_blackBoxWideGrid; + const uint8 *_lightningColumnShape; + + uint8 *_tempIconShape; + uint8 *_itemsOverlay; + + static const uint8 _teleporterShapeDefs[]; + static const uint8 _wallOfForceShapeDefs[]; + + const char *const *_mainMenuStrings; + + // Main loop + virtual void startupNew() = 0; + virtual void startupLoad() = 0; + void runLoop(); + void update() { screen()->updateScreen(); } + bool updateCharacterEvents(bool a); + + bool _runFlag; + //int _runLoopUnk2; + + // Create Party + void startCharacterGeneration(); + + uint8 **_faceShapes; + + static const int8 _classHpIncreaseType[]; + static const uint8 _hpIncrPerLevel[]; + static const uint8 _numLevelsPerClass[]; + static const int16 _hpConstModifiers[]; + static const uint8 _charClassModUnk[]; + + const uint8 *_classModifierFlags; + + // timers + void setupTimers(); + void setCharEventTimer(int charIndex, uint32 countdown, int evnt, int updateExistingTimer); + void deleteCharEventTimer(int charIndex, int evnt); + void setupCharacterTimers(); + + void timerProcessMonsters(int timerNum); + void timerSpecialCharacterUpdate(int timerNum); + void timerProcessFlyingObjects(int timerNum); + void timerProcessCharacterExchange(int timerNum); + void timerUpdateTeleporters(int timerNum); + void timerUpdateFoodStatus(int timerNum); + void timerUpdateMonsterIdleAnim(int timerNum); + + uint8 getClock2Timer(int index) { return index < _numClock2Timers ? _clock2Timers[index] : 0; } + uint8 getNumClock2Timers() { return _numClock2Timers; } + + static const uint8 _clock2Timers[]; + static const uint8 _numClock2Timers; + + // Mouse + void setHandItem(Item itemIndex); + void updateHandItemCursor() { _updateHandItemCursor = true; } + bool _updateHandItemCursor; + + // Characters + int getDexterityArmorClassModifier(int dexterity); + int generateCharacterHitpointsByLevel(int charIndex, int levelIndex); + int getClassAndConstHitpointsModifier(int cclass, int constitution); + int getClassHpIncreaseType(int cclass, int levelIndex); + int getModifiedHpLimits(int hpModifier, int constModifier, int level, bool mode); + const char *getCharStrength(int str, int strExt); + int testCharacter(int index, int flags); + int getNextValidCharIndex(int curCharIndex, int searchStep); + + void recalcArmorClass(int index); + int validateWeaponSlotItem(int index, int slot); + int getCharacterClericPaladinLevel(int index); + int getCharacterMageLevel(int index); + int getLevelIndexForHpIncType(int unk, int cClass); + + int countCharactersWithSpecificItems(int16 itemType, int16 itemValue); + int checkCharacterInventoryForItem(int character, int16 itemType, int16 itemValue); + void modifyCharacterHitpoints(int character, int16 points); + void neutralizePoison(int character); + + virtual void npcSequence(int npcIndex) = 0; + void initNpc(int npcIndex); + int npcJoinDialogue(int npcIndex, int queryJoinTextId, int confirmJoinTextId, int noJoinTextId); + int prepareForNewPartyMember(int16 itemType, int16 itemValue); + void removeCharacterFromParty(int charIndex); + + void increasePartyExperience(int16 points); + void increaseCharacterExperience(int charIndex, int32 points); + uint32 getRequiredExperience(int cClass, int levelIndex, int level); + void increaseCharacterLevel(int charIndex, int levelIndex); + + void setWeaponSlotStatus(int charIndex, int mode, int slot); + + EobCharacter *_characters; + char _strenghtStr[6]; + int _castScrollSlot; + int _exchangeCharacterId; + + const char *const *_levelGainStrings; + const uint32 *_expRequirementTables[6]; + + const uint8 *_constModTables[6]; + const uint8 *_constModLevelIndex; + const uint8 *_constModDiv; + const uint8 *_constModExt; + + const EobCharacter *_npcPreset; + bool _partyResting; + + // Items + void loadItemDefs(); + Item duplicateItem(Item itemIndex); + void setItemPosition(Item *itemQueue, int block, Item item, int pos); + void createInventoryItem(EobCharacter *c, Item itemIndex, int itemValue, int preferedInventorySlot); + int deleteInventoryItem(int charIndex, int slot); + void deleteBlockItem(uint16 block, int type); + int validateInventorySlotForItem(Item item, int charIndex, int slot); + void deletePartyItem(Item itemType, int16 itemValue); + virtual void updateUsedCharacterHandItem(int charIndex, int slot) = 0; + int itemUsableByCharacter(int charIndex, Item item); + int countQueuedItems(Item itemQueue, int16 id, int16 type, int count, int includeFlyingItems); + int getQueuedItem(Item *items, int pos, int id); + void printFullItemName(Item item); + void identifyQueuedItems(Item itemQueue); + void drawItemIconShape(int pageNum, Item itemId, int x, int y); + bool isMagicWeapon(Item itemIndex); + bool checkInventoryForRings(int charIndex, int itemValue); + void eatItemInHand(int charIndex); + + bool launchObject(int charIndex, Item item, uint16 startBlock, int startPos, int dir, int type); + void launchMagicObject(int charIndex, int type, uint16 startBlock, int startPos, int dir); + bool updateObjectFlight(EobFlyingObject *fo, int block, int pos); + bool updateFlyingObjectHitTest(EobFlyingObject *fo, int block, int pos); + void updateFlyingObject_s3(EobFlyingObject *fo); + void endObjectFlight(EobFlyingObject *fo); + void checkFlyingObjects(); + + void reloadWeaponSlot(int charIndex, int slotIndex, int itemType, int arrowOrDagger); + + EobItem *_items; + uint16 _numItems; + EobItemType *_itemTypes; + char **_itemNames; + uint16 _numItemNames; + uint32 _partyEffectFlags; + Item _lastUsedItem; + + const uint16 *_slotValidationFlags; + + EobFlyingObject *_flyingObjects; + const uint8 *_drawObjPosIndex; + const uint8 *_flightObjFlipIndex; + const int8 *_flightObjShpMap; + const int8 *_flightObjSclIndex; + + // Monsters + void loadMonsterShapes(const char *filename, int monsterIndex, bool hasDecorations, int encodeTableIndex); + void releaseMonsterShapes(int first, int num); + virtual void generateMonsterPalettes(const char *file, int16 monsterIndex) {} + virtual void loadMonsterDecoration(const char *file, int16 monsterIndex) {} + const uint8 *loadMonsterProperties(const uint8 *data); + const uint8 *loadActiveMonsterData(const uint8 *data, int level); + void initMonster(int index, int unit, uint16 block, int pos, int dir, int type, int shpIndex, int mode, int i, int randItem, int fixedItem); + void placeMonster(EobMonsterInPlay *m, uint16 block, int dir); + virtual void replaceMonster(int b, uint16 block, int pos, int dir, int type, int shpIndex, int mode, int h2, int randItem, int fixedItem) = 0; + void killMonster(EobMonsterInPlay *m, bool giveExperience); + int countSpecificMonsters(int type); + void updateAttackingMonsterFlags(); + + const int8 *getMonsterBlockPositions(uint16 block); + int getClosestMonsterPos(int charIndex, int block); + + bool blockHasMonsters(uint16 block); + bool isMonsterOnPos(EobMonsterInPlay *m, uint16 block, int pos, int checkPos4); + const int16 *findBlockMonsters(uint16 block, int pos, int dir, int blockDamage, int singleTargetCheckAdjacent); + + void drawBlockObject(int flipped, int page, const uint8 *shape, int x, int y, int sd, uint8 *ovl = 0); + void drawMonsterShape(const uint8 *shape, int x, int y, int flipped, int flags, int palIndex); + void flashMonsterShape(EobMonsterInPlay *m); + void updateAllMonsterShapes(); + void drawBlockItems(int index); + void drawDoor(int index); + virtual void drawDoorIntern(int type, int index, int x, int y, int w, int wall, int mDim, int16 y1, int16 y2) = 0; + void drawMonsters(int index); + void drawWallOfForce(int index); + void drawFlyingObjects(int index); + void drawTeleporter(int index); + + void updateMonsters(int unit); + void updateMonsterDest(EobMonsterInPlay *m); + void updateMonsterDest2(EobMonsterInPlay *m); + void turnFriendlyMonstersHostile(); + int getNextMonsterDirection(int curBlock, int destBlock); + int getNextMonsterPos(EobMonsterInPlay *m, int block); + int findFreeMonsterPos(int block, int size); + void updateMoveMonster(EobMonsterInPlay *m); + bool updateMonsterTryDistanceAttack(EobMonsterInPlay *m); + bool updateMonsterTryCloseAttack(EobMonsterInPlay *m, int block); + void walkMonster(EobMonsterInPlay *m, int destBlock); + bool walkMonsterNextStep(EobMonsterInPlay *m, int destBlock, int direction); + void updateMonsterFollowPath(EobMonsterInPlay *m, int turnSteps); + void updateMonstersStraying(EobMonsterInPlay *m, int a); + void updateMonsters_mode710(EobMonsterInPlay *m); + void setBlockMonsterDirection(int block, int dir); + + uint8 *_monsterOvl1; + uint8 *_monsterOvl2; + + SpriteDecoration *_monsterDecorations; + EobMonsterProperty *_monsterProps; + + EobMonsterInPlay *_monsters; + + const int8 *_monsterStepTable0; + const int8 *_monsterStepTable1; + const int8 *_monsterStepTable2; + const int8 *_monsterStepTable3; + const uint8 *_monsterCloseAttPosTable1; + const uint8 *_monsterCloseAttPosTable2; + const int8 *_monsterCloseAttUnkTable; + const uint8 *_monsterCloseAttChkTable1; + const uint8 *_monsterCloseAttChkTable2; + const uint8 *_monsterCloseAttDstTable1; + const uint8 *_monsterCloseAttDstTable2; + + const uint8 *_monsterProximityTable; + const uint8 *_findBlockMonstersTable; + const char *const *_monsterDustStrings; + + const uint8 *_monsterDistAttType10; + const uint8 *_monsterDistAttSfx10; + const uint8 *_monsterDistAttType17; + const uint8 *_monsterDistAttSfx17; + const char *const *_monsterSpecAttStrings; + + const int8 *_monsterFrmOffsTable1; + const int8 *_monsterFrmOffsTable2; + + const uint16 *_encodeMonsterShpTable; + const uint8 _teleporterWallId; + + const int8 *_monsterDirChangeTable; + + // Level + void loadLevel(int level, int func); + const char *initLevelData(int func); + void addLevelItems(); + void loadVcnData(const char *file, const char */*nextFile*/); + void loadBlockProperties(const char *mazFile); + void loadDecorations(const char *cpsFile, const char *decFile); + void assignWallsAndDecorations(int wallIndex, int vmpIndex, int decDataIndex, int specialType, int flags); + void releaseDecorations(); + void releaseDoorShapes(); + void toggleWallState(int wall, int flags); + virtual void loadDoorShapes(int doorType1, int shapeId1, int doorType2, int shapeId2) {} + virtual const uint8 *loadDoorShapes(const char *filename, int doorIndex, const uint8*shapeDefs) { return (const uint8*)filename; } + + void drawScene(int update); + void drawSceneShapes(); + void drawDecorations(int index); + + int calcNewBlockPositionAndTestPassability(uint16 curBlock, uint16 direction); + void notifyBlockNotPassable(); + void moveParty(uint16 block); + + int clickedDoorSwitch(uint16 block, uint16 direction); + int clickedDoorPry(uint16 block, uint16 direction); + int clickedDoorNoPry(uint16 block, uint16 direction); + int clickedNiche(uint16 block, uint16 direction); + + int specialWallAction(int block, int direction); + + void openDoor(int block); + void closeDoor(int block); + + int16 _doorType[2]; + int16 _noDoorSwitch[2]; + + EobRect8 *_levelDecorationRects; + SpriteDecoration *_doorSwitches; + + int8 _currentSub; + char _curGfxFile[13]; + + uint32 _drawSceneTimer; + uint32 _flashShapeTimer; + uint32 _envAudioTimer; + uint16 _teleporterPulse; + + const int16 *_dscShapeCoords; + + const uint8 *_dscItemPosIndex; + const int16 *_dscItemShpX; + const uint8 *_dscItemScaleIndex; + const uint8 *_dscItemTileIndex; + const uint8 *_dscItemShapeMap; + + const uint8 *_dscDoorScaleOffs; + const uint8 *_dscDoorScaleMult1; + const uint8 *_dscDoorScaleMult2; + const uint8 *_dscDoorScaleMult3; + const uint8 *_dscDoorY1; + + const uint8 *_wllFlagPreset; + int _wllFlagPresetSize; + const uint8 *_teleporterShapeCoords; + + // Script + void runLevelScript(int block, int flags); + void setScriptFlag(int flag); + bool checkScriptFlag(int flag); + + const uint8 *initScriptTimers(const uint8 *pos); + void updateScriptTimers(); + + EobInfProcessor *_inf; + int _stepCounter; + int _stepsUntilScriptCall; + ScriptTimer _scriptTimers[5]; + int _scriptTimersCount; + uint8 _scriptTimersMode; + + // Gui + void gui_drawPlayField(int pageNum); + void gui_restorePlayField(); + void gui_drawAllCharPortraitsWithStats(); + void gui_drawCharPortraitWithStats(int index); + void gui_drawFaceShape(int index); + void gui_drawWeaponSlot(int charIndex, int slot); + void gui_drawWeaponSlotStatus(int x, int y, int status); + void gui_drawHitpoints(int index); + void gui_drawFoodStatusGraph(int index); + void gui_drawHorizontalBarGraph(int x, int y, int w, int h, int32 curVal, int32 maxVal, int col1, int col2); + void gui_drawCharPortraitStatusFrame(int index); + void gui_drawInventoryItem(int slot, int special, int pageNum); + void gui_drawCompass(bool force); + void gui_drawDialogueBox(); + void gui_drawSpellbook(); + void gui_drawSpellbookScrollArrow(int x, int y, int direction); + void gui_updateSlotAfterScrollUse(); + void gui_updateControls(); + void gui_toggleButtons(); + void gui_setPlayFieldButtons(); + void gui_setInventoryButtons(); + void gui_setStatsListButtons(); + void gui_setSwapCharacterButtons(); + void gui_setCastOnWhomButtons(); + void gui_initButton(int index, int x = -1, int y = -1, int val = -1); + Button *gui_getButton(Button *buttonList, int index); + + int clickedInventoryNextPage(Button *button); + int clickedPortraitRestore(Button *button); + int clickedCharPortraitDefault(Button *button); + int clickedCamp(Button *button); + int clickedSceneDropPickupItem(Button *button); + int clickedCharPortrait2(Button *button); + int clickedWeaponSlot(Button *button); + int clickedCharNameLabelRight(Button *button); + int clickedInventorySlot(Button *button); + int clickedEatItem(Button *button); + int clickedInventoryPrevChar(Button *button); + int clickedInventoryNextChar(Button *button); + int clickedSpellbookTab(Button *button); + int clickedSpellbookList(Button *button); + int clickedCastSpellOnCharacter(Button *button); + int clickedUpArrow(Button *button); + int clickedDownArrow(Button *button); + int clickedLeftArrow(Button *button); + int clickedRightArrow(Button *button); + int clickedTurnLeftArrow(Button *button); + int clickedTurnRightArrow(Button *button); + int clickedAbortCharSwitch(Button *button); + int clickedSceneThrowItem(Button *button); + int clickedSceneSpecial(Button *button); + int clickedSpellbookAbort(Button *button); + int clickedSpellbookScroll(Button *button); + int clickedUnk(Button *button); + + void gui_processCharPortraitClick(int index); + void gui_processWeaponSlotClickLeft(int charIndex, int slotIndex); + void gui_processWeaponSlotClickRight(int charIndex, int slotIndex); + void gui_processInventorySlotClick(int slot); + + static const int16 _buttonList1[]; + int _buttonList1Size; + static const int16 _buttonList2[]; + int _buttonList2Size; + static const int16 _buttonList3[]; + int _buttonList3Size; + static const int16 _buttonList4[]; + int _buttonList4Size; + static const int16 _buttonList5[]; + int _buttonList5Size; + static const int16 _buttonList6[]; + int _buttonList6Size; + static const int16 _buttonList7[]; + int _buttonList7Size; + static const int16 _buttonList8[]; + int _buttonList8Size; + + const EobGuiButtonDef *_buttonDefs; + const char *const *_characterGuiStringsHp; + const char *const *_characterGuiStringsWp; + const char *const *_characterGuiStringsWr; + const char *const *_characterGuiStringsSt; + const char *const *_characterGuiStringsIn; + + const char *const *_characterStatusStrings7; + const char *const *_characterStatusStrings8; + const char *const *_characterStatusStrings9; + const char *const *_characterStatusStrings12; + const char *const *_characterStatusStrings13; + + const uint16 *_inventorySlotsX; + const uint8 *_inventorySlotsY; + const uint8 **_compassShapes; + uint8 _charExchangeSwap; + bool _hpBarGraphs; + + // text + void setupDialogueButtons(int presetfirst, int numStr, const char *str1, ...); + void initDialogueSequence(); + void restoreAfterDialogueSequence(); + void drawSequenceBitmap(const char *file, int destRect, int x1, int y1, int flags); + int runDialogue(int dialogueTextId, int style, const char *button1, ...); + + char _dialogueLastBitmap[13]; + int _dlgUnk1; + int _moveCounter; + + uint8 _color4; + uint8 _color5; + uint8 _color6; + uint8 _color7; + uint8 _color8; + uint8 _color9; + uint8 _color10; + uint8 _color11; + uint8 _color12; + uint8 _color13; + uint8 _color14; + + const char *const *_chargenStatStrings; + const char *const *_chargenRaceSexStrings; + const char *const *_chargenClassStrings; + const char *const *_chargenAlignmentStrings; + + const char *const *_pryDoorStrings; + const char *const *_warningStrings; + const char *const *_itemExtraStrings; + const char *const *_itemSuffixStrings; + const char *const *_takenStrings; + const char *const *_potionEffectStrings; + + const char *const *_yesNoStrings; + const char *const *_npcMaxStrings; + const char *const *_okStrings; + const char *const *_npcJoinStrings; + const char *const *_cancelStrings; + const char *const *_abortStrings; + + // misc + void delay(uint32 millis, bool doUpdate = false, bool isMainLoop = false); + void displayParchment(int id); + + virtual void drawLightningColumn() {} + virtual int resurrectionSelectDialogue() { return -1; } + virtual int charSelectDialogue() { return -1; } + virtual void characterLevelGain(int charIndex) {} + + Common::Error loadGameState(int slot); + Common::Error saveGameStateIntern(int slot, const char *saveName, const Graphics::Surface *thumbnail); + + void *generateMonsterTempData(LevelTempData *tmp); + void *generateFlyingObjectTempData(LevelTempData *tmp); + void restoreMonsterTempData(LevelTempData *tmp); + void restoreFlyingObjectTempData(LevelTempData *tmp); + void releaseMonsterTempData(LevelTempData *tmp); + void releaseFlyingObjectTempData(LevelTempData *tmp); + + int _saveLoadMode; + + Screen_Eob *_screen; + GUI_Eob *_gui; + + // fight + void useSlotWeapon(int charIndex, int slotIndex, int item); + int closeDistanceAttack(int charIndex, int item); + int thrownAttack(int charIndex, int slotIndex, int item); + int bowAttack(int charIndex, int item); + + void inflictMonsterDamage(EobMonsterInPlay *m, int damage, bool giveExperience); + void calcAndInflictMonsterDamage(EobMonsterInPlay *m, int times, int pips, int offs, int flags, int b, int damageType); + void calcAndInflictCharacterDamage(int charIndex, int times, int itemOrPips, int useStrModifierOrBase, int flg, int a, int damageType); + int calcCharacterDamage(int charIndex, int times, int itemOrPips, int useStrModifierOrBase, int flg, int a, int damageType) ; + void inflictCharacterDamage(int charIndex, int damage); + + bool characterAttackHitTest(int charIndex, int monsterIndex, int item, int attackType); + bool monsterAttackHitTest(EobMonsterInPlay *m, int charIndex); + bool flyingObjectMonsterHit(EobFlyingObject *fo, int monsterIndex); + bool flyingObjectPartyHit(EobFlyingObject *fo); + + void monsterCloseAttack(EobMonsterInPlay *m); + void monsterSpellCast(EobMonsterInPlay *m, int type); + void statusAttack(int charIndex, int attackStatusFlags, const char *attackStatusString, int a, uint32 effectDuration, int restoreEvent, int noRefresh); + + int calcCloseDistanceMonsterDamage(EobMonsterInPlay *m, int times, int pips, int offs, int flags, int b, int damageType); + int calcDamageModifers(int charIndex, EobMonsterInPlay *m, int item, int itemType, int useStrModifier); + bool checkUnkConstModifiers(void *target, int hpModifier, int level, int b, int race); + bool specialAttackConstTest(int charIndex, int b); + int getConstModifierTableValue(int hpModifier, int level, int b); + bool calcDamageCheckItemType(int itemType); + int recalcDamageModifier(int damageType, int dmgModifier); + bool checkMonsterDamageEvasion(EobMonsterInPlay *m); + int getStrHitChanceModifier(int charIndex); + int getStrDamageModifier(int charIndex); + int getDexHitChanceModifier(int charIndex); + int getMonsterAcHitChanceModifier(int charIndex, int monsterAc); + void inflictMonsterDamage_s1(EobMonsterInPlay *m); + + int _dstMonsterIndex; + int _inflictMonsterDamageUnk; + int16 _foundMonstersArray[5]; + + // magic + void useMagicBookOrSymbol(int charIndex, int type); + void useMagicScroll(int charIndex, int type, int weaponSlot); + void usePotion(int charIndex, int weaponSlot); + + void castSpell(int spell, int weaponSlot); + void removeCharacterEffect(int spell, int charIndex, int showWarning); + void removeAllCharacterEffects(int charIndex); + void castOnWhomDialogue(); + void startSpell(int spell); + + void sparkEffectDefensive(int charIndex); + void sparkEffectOffensive(); + void setSpellEventTimer(int spell, int timerBaseFactor, int timerLength, int timerLevelFactor, int updateExistingTimer); + + bool magicObjectHit(EobFlyingObject *fo, int dcTimes, int dcPips, int dcOffs, int level); + + void spellCallback_start_empty() {} + bool spellCallback_end_empty(EobFlyingObject *fo) { return true; } + void spellCallback_start_armor(); + void spellCallback_start_burningHands(); + void spellCallback_start_detectMagic(); + bool spellCallback_end_detectMagic(EobFlyingObject *fo); + void spellCallback_start_magicMissile(); + bool spellCallback_end_magicMissile(EobFlyingObject *fo); + void spellCallback_start_shockingGrasp(); + bool spellCallback_end_shockingGraspFlameBlade(EobFlyingObject *fo); + void spellCallback_start_improvedIdentify(); + void spellCallback_start_melfsAcidArrow(); + bool spellCallback_end_melfsAcidArrow(EobFlyingObject *fo); + void spellCallback_start_dispelMagic(); + void spellCallback_start_fireball(); + bool spellCallback_end_fireball(EobFlyingObject *fo); + void spellCallback_start_flameArrow(); + bool spellCallback_end_flameArrow(EobFlyingObject *fo); + void spellCallback_start_holdPerson(); + bool spellCallback_end_holdPerson(EobFlyingObject *fo); + void spellCallback_start_lightningBolt(); + bool spellCallback_end_lightningBolt(EobFlyingObject *fo); + void spellCallback_start_vampiricTouch(); + bool spellCallback_end_vampiricTouch(EobFlyingObject *fo); + void spellCallback_start_fear(); + void spellCallback_start_iceStorm(); + bool spellCallback_end_iceStorm(EobFlyingObject *fo); + void spellCallback_start_removeCurse(); + void spellCallback_start_coneOfCold(); + void spellCallback_start_holdMonster(); + bool spellCallback_end_holdMonster(EobFlyingObject *fo); + void spellCallback_start_wallOfForce(); + void spellCallback_start_disintegrate(); + void spellCallback_start_fleshToStone(); + void spellCallback_start_stoneToFlesh(); + void spellCallback_start_trueSeeing(); + bool spellCallback_end_trueSeeing(EobFlyingObject *fo); + void spellCallback_start_slayLiving(); + void spellCallback_start_powerWordStun(); + void spellCallback_start_causeLightWounds(); + void spellCallback_start_cureLightWounds(); + void spellCallback_start_aid(); + bool spellCallback_end_aid(EobFlyingObject *fo); + void spellCallback_start_flameBlade(); + void spellCallback_start_slowPoison(); + bool spellCallback_end_slowPoison(EobFlyingObject *fo); + void spellCallback_start_createFood(); + void spellCallback_start_removeParalysis(); + void spellCallback_start_causeSeriousWounds(); + void spellCallback_start_cureSeriousWounds(); + void spellCallback_start_neutralizePoison(); + void spellCallback_start_causeCriticalWounds(); + void spellCallback_start_cureCriticalWounds(); + void spellCallback_start_flameStrike(); + bool spellCallback_end_flameStrike(EobFlyingObject *fo); + void spellCallback_start_raiseDead(); + void spellCallback_start_harm(); + void spellCallback_start_heal(); + void spellCallback_start_layOnHands(); + void spellCallback_start_turnUndead(); + bool spellCallback_end_unk1Passive(EobFlyingObject *fo); + bool spellCallback_end_unk2Passive(EobFlyingObject *fo); + bool spellCallback_end_deathSpellPassive(EobFlyingObject *fo); + bool spellCallback_end_disintegratePassive(EobFlyingObject *fo); + bool spellCallback_end_causeCriticalWoundsPassive(EobFlyingObject *fo); + bool spellCallback_end_fleshToStonePassive(EobFlyingObject *fo); + + int8 _openBookSpellLevel; + int8 _openBookSpellSelectedItem; + int8 _openBookSpellListOffset; + uint8 _openBookChar; + uint8 _openBookType; + uint8 _openBookCharBackup; + uint8 _openBookTypeBackup; + const char *const *_openBookSpellList; + int8 *_openBookAvailableSpells; + uint8 _activeSpellCaster; + uint8 _activeSpellCasterPos; + uint8 _activeSpell; + bool _returnAfterSpellCallback; + + typedef void (EobCoreEngine::*SpellStartCallback)(); + typedef bool (EobCoreEngine::*SpellEndCallback)(EobFlyingObject *fo); + + struct EobSpell { + const char *name; + SpellStartCallback startCallback; + uint16 flags; + const uint16 *timingPara; + SpellEndCallback endCallback; + uint8 sound; + uint32 effectFlags; + uint16 damageFlags; + }; + + EobSpell *_spells; + int _numSpells; + + const char *const *_bookNumbers; + const char *const *_mageSpellList; + int _mageSpellListSize; + int _clericSpellOffset; + const char *const *_clericSpellList; + const char *const *_spellNames; + const char *const *_magicStrings1; + const char *const *_magicStrings2; + const char *const *_magicStrings3; + const char *const *_magicStrings4; + const char *const *_magicStrings5; + const char *const *_magicStrings6; + const char *const *_magicStrings7; + const char *const *_magicStrings8; + + uint8 *_spellAnimBuffer; + + const uint8 *_sparkEffectDefSteps; + const uint8 *_sparkEffectDefSubSteps; + const uint8 *_sparkEffectDefShift; + const uint8 *_sparkEffectDefAdd; + const uint8 *_sparkEffectDefX; + const uint8 *_sparkEffectDefY; + const uint32 *_sparkEffectOfFlags1; + const uint32 *_sparkEffectOfFlags2; + const uint8 *_sparkEffectOfShift; + const uint8 *_sparkEffectOfX; + const uint8 *_sparkEffectOfY; + + const uint8 *_magicFlightObjectProperties; + + // sound + void snd_playSoundEffect(int id, int volume=0xFF); +}; + +} // End of namespace Kyra + +#endif // ENABLE_EOB + +#endif \ No newline at end of file diff --git a/engines/kyra/gui.h b/engines/kyra/gui.h index 6e9606f1de..04fc9b5523 100644 --- a/engines/kyra/gui.h +++ b/engines/kyra/gui.h @@ -40,10 +40,10 @@ struct Button { typedef Common::Functor1