diff options
26 files changed, 1586 insertions, 69 deletions
@@ -34,6 +34,8 @@ For a more comprehensive changelog of the latest experimental code, see: - The option to toggle sound effect types between digitized and synthesized has been disabled until a more user-friendly GUI option is possible. Digital sound effects are always preferred for now. + - Fixed a case where starting a new song didn't fully reset its channels, + thus some notes sounded wrong. 1.4.0 (2011-11-11) New Games: diff --git a/backends/platform/sdl/macosx/appmenu_osx.mm b/backends/platform/sdl/macosx/appmenu_osx.mm index bb089a6b61..97c7edba3e 100755 --- a/backends/platform/sdl/macosx/appmenu_osx.mm +++ b/backends/platform/sdl/macosx/appmenu_osx.mm @@ -35,6 +35,11 @@ - (void)setAppleMenu:(NSMenu *)menu; @end +NSString *constructNSStringFromCString(const char* rawCString, NSStringEncoding stringEncoding) { + NSData *nsData = [NSData dataWithBytes:rawCString length:strlen(rawCString)]; + return [[NSString alloc] initWithData:nsData encoding:stringEncoding]; +} + void replaceApplicationMenuItems() { // Code mainly copied and adapted from SDLmain.m @@ -50,34 +55,47 @@ void replaceApplicationMenuItems() { // Create new application menu appleMenu = [[NSMenu alloc] initWithTitle:@""]; + NSString *nsString = NULL; + // Get current encoding #ifdef USE_TRANSLATION - NSStringEncoding stringEncoding = CFStringConvertEncodingToNSStringEncoding(CFStringConvertIANACharSetNameToEncoding((CFStringRef)[NSString stringWithCString:(TransMan.getCurrentCharset()).c_str() encoding:NSASCIIStringEncoding])); + nsString = constructNSStringFromCString((TransMan.getCurrentCharset()).c_str(), NSASCIIStringEncoding); + NSStringEncoding stringEncoding = CFStringConvertEncodingToNSStringEncoding(CFStringConvertIANACharSetNameToEncoding((CFStringRef)nsString)); + [nsString release]; #else NSStringEncoding stringEncoding = NSASCIIStringEncoding; #endif - + // Add "About ScummVM" menu item - [appleMenu addItemWithTitle:[NSString stringWithCString:_("About ScummVM") encoding:stringEncoding] action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""]; + nsString = constructNSStringFromCString(_("About ScummVM"), stringEncoding); + [appleMenu addItemWithTitle:nsString action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""]; + [nsString release]; // Add separator [appleMenu addItem:[NSMenuItem separatorItem]]; // Add "Hide ScummVM" menu item - [appleMenu addItemWithTitle:[NSString stringWithCString:_("Hide ScummVM") encoding:stringEncoding] action:@selector(hide:) keyEquivalent:@"h"]; + nsString = constructNSStringFromCString(_("Hide ScummVM"), stringEncoding); + [appleMenu addItemWithTitle:nsString action:@selector(hide:) keyEquivalent:@"h"]; + [nsString release]; // Add "Hide Others" menu item - menuItem = (NSMenuItem *)[appleMenu addItemWithTitle:[NSString stringWithCString:_("Hide Others") encoding:stringEncoding] action:@selector(hideOtherApplications:) keyEquivalent:@"h"]; + nsString = constructNSStringFromCString(_("Hide Others"), stringEncoding); + menuItem = (NSMenuItem *)[appleMenu addItemWithTitle:nsString action:@selector(hideOtherApplications:) keyEquivalent:@"h"]; [menuItem setKeyEquivalentModifierMask:(NSAlternateKeyMask|NSCommandKeyMask)]; // Add "Show All" menu item - [appleMenu addItemWithTitle:[NSString stringWithCString:_("Show All") encoding:stringEncoding] action:@selector(unhideAllApplications:) keyEquivalent:@""]; + nsString = constructNSStringFromCString(_("Show All"), stringEncoding); + [appleMenu addItemWithTitle:nsString action:@selector(unhideAllApplications:) keyEquivalent:@""]; + [nsString release]; // Add separator [appleMenu addItem:[NSMenuItem separatorItem]]; // Add "Quit ScummVM" menu item - [appleMenu addItemWithTitle:[NSString stringWithCString:_("Quit ScummVM") encoding:stringEncoding] action:@selector(terminate:) keyEquivalent:@"q"]; + nsString = constructNSStringFromCString(_("Quit ScummVM"), stringEncoding); + [appleMenu addItemWithTitle:nsString action:@selector(terminate:) keyEquivalent:@"q"]; + [nsString release]; // Put application menu into the menubar menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""]; @@ -89,16 +107,22 @@ void replaceApplicationMenuItems() { // Create new "Window" menu - windowMenu = [[NSMenu alloc] initWithTitle:[NSString stringWithCString:_("Window") encoding:stringEncoding]]; + nsString = constructNSStringFromCString(_("Window"), stringEncoding); + windowMenu = [[NSMenu alloc] initWithTitle:nsString]; + [nsString release]; // Add "Minimize" menu item - menuItem = [[NSMenuItem alloc] initWithTitle:[NSString stringWithCString:_("Minimize") encoding:stringEncoding] action:@selector(performMiniaturize:) keyEquivalent:@"m"]; + nsString = constructNSStringFromCString(_("Minimize"), stringEncoding); + menuItem = [[NSMenuItem alloc] initWithTitle:nsString action:@selector(performMiniaturize:) keyEquivalent:@"m"]; [windowMenu addItem:menuItem]; + [nsString release]; // Put menu into the menubar - menuItem = [[NSMenuItem alloc] initWithTitle:[NSString stringWithCString:_("Window") encoding:stringEncoding] action:nil keyEquivalent:@""]; + nsString = constructNSStringFromCString(_("Window"), stringEncoding); + menuItem = [[NSMenuItem alloc] initWithTitle:nsString action:nil keyEquivalent:@""]; [menuItem setSubmenu:windowMenu]; [[NSApp mainMenu] addItem:menuItem]; + [nsString release]; // Tell the application object that this is now the window menu. [NSApp setWindowsMenu:windowMenu]; diff --git a/common/zlib.cpp b/common/zlib.cpp index 70133fea30..7d765fc539 100644 --- a/common/zlib.cpp +++ b/common/zlib.cpp @@ -49,7 +49,7 @@ bool uncompress(byte *dst, unsigned long *dstLen, const byte *src, unsigned long return Z_OK == ::uncompress(dst, dstLen, src, srcLen); } -bool inflateZlibHeaderless(byte *dst, uint dstLen, const byte *src, uint srcLen) { +bool inflateZlibHeaderless(byte *dst, uint dstLen, const byte *src, uint srcLen, const byte *dict, uint dictLen) { if (!dst || !dstLen || !src || !srcLen) return false; @@ -68,6 +68,13 @@ bool inflateZlibHeaderless(byte *dst, uint dstLen, const byte *src, uint srcLen) if (err != Z_OK) return false; + // Set the dictionary, if provided + if (dict != 0) { + err = inflateSetDictionary(&stream, const_cast<byte *>(dict), dictLen); + if (err != Z_OK) + return false; + } + err = inflate(&stream, Z_SYNC_FLUSH); if (err != Z_OK && err != Z_STREAM_END) { inflateEnd(&stream); diff --git a/common/zlib.h b/common/zlib.h index 7af7df0da8..61322c286a 100644 --- a/common/zlib.h +++ b/common/zlib.h @@ -37,7 +37,19 @@ class WriteStream; * it possible to uncompress data in engines without being forced to link * them against zlib, thus simplifying the build system. * - * @return true on success (i.e. Z_OK), false otherwise + * Taken from the zlib manual: + * Decompresses the src buffer into the dst buffer. + * srcLen is the byte length of the source buffer. Upon entry, dstLen is the + * total size of the destination buffer, which must be large enough to hold + * the entire uncompressed data. Upon exit, dstLen is the actual size of the + * compressed buffer. + * + * @param dst the buffer to store into. + * @param dstLen a pointer to the size of the destination buffer. + * @param src the data to be decompressed. + * @param srcLen the size of the compressed data. + * + * @return true on success (i.e. Z_OK), false otherwise. */ bool uncompress(byte *dst, unsigned long *dstLen, const byte *src, unsigned long srcLen); @@ -46,9 +58,24 @@ bool uncompress(byte *dst, unsigned long *dstLen, const byte *src, unsigned long * necessary inflate functions to uncompress data compressed with deflate * but *not* with the standard zlib header. * - * @return true on success (Z_OK or Z_STREAM_END), false otherwise + * Decompresses the src buffer into the dst buffer. + * srcLen is the byte length of the source buffer, dstLen is the byte + * length of the output buffer. + * It decompress as much data as possible, up to dstLen bytes. + * If a dictionary is provided through the dict buffer, uses it to initializes + * the internal decompression dictionary, before the decompression takes place. + * + * @param dst the buffer to store into. + * @param dstLen the size of the destination buffer. + * @param src the data to be decompressed. + * @param dstLen the size of the compressed data. + * @param dict (optional) a decompress dictionary. + * @param dictLen (optional) the size of the dictionary. + * Mandatory if dict is not 0. + * + * @return true on success (Z_OK or Z_STREAM_END), false otherwise. */ -bool inflateZlibHeaderless(byte *dst, uint dstLen, const byte *src, uint srcLen); +bool inflateZlibHeaderless(byte *dst, uint dstLen, const byte *src, uint srcLen, const byte *dict = 0, uint dictLen = 0); #endif diff --git a/dists/debian/copyright b/dists/debian/copyright index e0885ae9e6..318c06f62b 100644 --- a/dists/debian/copyright +++ b/dists/debian/copyright @@ -7,7 +7,7 @@ It was downloaded from <http://www.scummvm.org/>. Upstream Authors: see `/usr/share/doc/scummvm/AUTHORS'. -Scummvm is Copyright © 2002-2010 The ScummVM Project +Scummvm is Copyright © 2002-2012 The ScummVM Project 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 diff --git a/dists/macosx/DS_Store b/dists/macosx/DS_Store Binary files differindex 2d4193a6af..7ad5a19d61 100644 --- a/dists/macosx/DS_Store +++ b/dists/macosx/DS_Store diff --git a/dists/win32/ScummVM.iss b/dists/win32/ScummVM.iss index 7f3359f530..14536d0cbf 100644 --- a/dists/win32/ScummVM.iss +++ b/dists/win32/ScummVM.iss @@ -1,5 +1,5 @@ [Setup] -AppCopyright=2011 +AppCopyright=2012 AppName=ScummVM AppVerName=ScummVM Git AppPublisher=The ScummVM Team diff --git a/engines/kyra/debugger.cpp b/engines/kyra/debugger.cpp index 95c6162c36..6514984b93 100644 --- a/engines/kyra/debugger.cpp +++ b/engines/kyra/debugger.cpp @@ -205,6 +205,7 @@ void Debugger_LoK::initialize() { DCmd_Register("scenes", WRAP_METHOD(Debugger_LoK, cmd_listScenes)); DCmd_Register("give", WRAP_METHOD(Debugger_LoK, cmd_giveItem)); DCmd_Register("birthstones", WRAP_METHOD(Debugger_LoK, cmd_listBirthstones)); + Debugger::initialize(); } bool Debugger_LoK::cmd_enterRoom(int argc, const char **argv) { @@ -295,6 +296,7 @@ void Debugger_v2::initialize() { DCmd_Register("scene_info", WRAP_METHOD(Debugger_v2, cmd_sceneInfo)); DCmd_Register("scene_to_facing", WRAP_METHOD(Debugger_v2, cmd_sceneToFacing)); DCmd_Register("give", WRAP_METHOD(Debugger_v2, cmd_giveItem)); + Debugger::initialize(); } bool Debugger_v2::cmd_enterScene(int argc, const char **argv) { @@ -445,6 +447,7 @@ Debugger_HoF::Debugger_HoF(KyraEngine_HoF *vm) : Debugger_v2(vm), _vm(vm) { void Debugger_HoF::initialize() { DCmd_Register("pass_codes", WRAP_METHOD(Debugger_HoF, cmd_passcodes)); + Debugger_v2::initialize(); } bool Debugger_HoF::cmd_passcodes(int argc, const char **argv) { diff --git a/engines/kyra/kyra_lok.cpp b/engines/kyra/kyra_lok.cpp index c195f0275a..74db67d22b 100644 --- a/engines/kyra/kyra_lok.cpp +++ b/engines/kyra/kyra_lok.cpp @@ -510,7 +510,14 @@ void KyraEngine_LoK::delay(uint32 amount, bool update, bool isMainLoop) { updateTextFade(); updateMousePointer(); } else { - _screen->updateScreen(); + // We call OSystem::updateScreen here and not Screen::updateScreen + // to avoid new graphics changes to be copied to the screen. + // This assures the workaround of bug #1498221 + // "KYRA1: Glitches when meeting Zanthia" is working correctly. + // Since we only call updateScreen here to let systems with frame + // update count limitations not miss any graphics updates it + // should not cause any problems. + _system->updateScreen(); } _isSaveAllowed = isMainLoop; diff --git a/engines/sci/engine/kernel_tables.h b/engines/sci/engine/kernel_tables.h index fe0c9fc2ef..622511c906 100644 --- a/engines/sci/engine/kernel_tables.h +++ b/engines/sci/engine/kernel_tables.h @@ -610,6 +610,12 @@ static SciKernelMapEntry s_kernelMap[] = { { MAP_DUMMY(DeletePic), SIG_EVERYWHERE, "(.*)", NULL, NULL }, { MAP_DUMMY(GetSierraProfileString), SIG_EVERYWHERE, "(.*)", NULL, NULL }, + // Unused / debug functions in the in-between SCI2.1 interpreters + { MAP_DUMMY(PreloadResource), SIG_EVERYWHERE, "(.*)", NULL, NULL }, + { MAP_DUMMY(CheckCDisc), SIG_EVERYWHERE, "(.*)", NULL, NULL }, + { MAP_DUMMY(GetSaveCDisc), SIG_EVERYWHERE, "(.*)", NULL, NULL }, + { MAP_DUMMY(TestPoly), SIG_EVERYWHERE, "(.*)", NULL, NULL }, + // SCI2.1 unmapped functions - TODO! // MovePlaneItems - used by SQ6 to scroll through the inventory via the up/down buttons diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index 76c6778f0a..cfeaaaa803 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -25,6 +25,7 @@ #include "engines/util.h" #include "graphics/cursorman.h" #include "graphics/surface.h" +#include "graphics/palette.h" // temporary, for the fadeIn()/fadeOut() functions below #include "gui/message.h" @@ -1212,7 +1213,8 @@ reg_t kRemapColors(EngineState *s, int argc, reg_t *argv) { switch (operation) { case 0: { // Set remapping to base. 0 turns remapping off. int16 base = (argc >= 2) ? argv[1].toSint16() : 0; - warning("kRemapColors: Set remapping to base %d", base); + if (base != 0) // 0 is the default behavior when changing rooms in GK1, thus silencing the warning + warning("kRemapColors: Set remapping to base %d", base); } break; case 1: { // unknown @@ -1440,6 +1442,46 @@ reg_t kWinHelp(EngineState *s, int argc, reg_t *argv) { return s->r_acc; } +// Taken from the SCI16 GfxTransitions class +static void fadeOut() { + byte oldPalette[3 * 256], workPalette[3 * 256]; + int16 stepNr, colorNr; + // Sierra did not fade in/out color 255 for sci1.1, but they used it in + // several pictures (e.g. qfg3 demo/intro), so the fading looked weird + int16 tillColorNr = getSciVersion() >= SCI_VERSION_1_1 ? 255 : 254; + + g_system->getPaletteManager()->grabPalette(oldPalette, 0, 256); + + for (stepNr = 100; stepNr >= 0; stepNr -= 10) { + for (colorNr = 1; colorNr <= tillColorNr; colorNr++) { + if (g_sci->_gfxPalette->colorIsFromMacClut(colorNr)) { + workPalette[colorNr * 3 + 0] = oldPalette[colorNr * 3]; + workPalette[colorNr * 3 + 1] = oldPalette[colorNr * 3 + 1]; + workPalette[colorNr * 3 + 2] = oldPalette[colorNr * 3 + 2]; + } else { + workPalette[colorNr * 3 + 0] = oldPalette[colorNr * 3] * stepNr / 100; + workPalette[colorNr * 3 + 1] = oldPalette[colorNr * 3 + 1] * stepNr / 100; + workPalette[colorNr * 3 + 2] = oldPalette[colorNr * 3 + 2] * stepNr / 100; + } + } + g_system->getPaletteManager()->setPalette(workPalette + 3, 1, tillColorNr); + g_sci->getEngineState()->wait(2); + } +} + +// Taken from the SCI16 GfxTransitions class +static void fadeIn() { + int16 stepNr; + // Sierra did not fade in/out color 255 for sci1.1, but they used it in + // several pictures (e.g. qfg3 demo/intro), so the fading looked weird + int16 tillColorNr = getSciVersion() >= SCI_VERSION_1_1 ? 255 : 254; + + for (stepNr = 0; stepNr <= 100; stepNr += 10) { + g_sci->_gfxPalette->kernelSetIntensity(1, tillColorNr + 1, stepNr, true); + g_sci->getEngineState()->wait(2); + } +} + /** * Used for scene transitions, replacing (but reusing parts of) the old * transition code. @@ -1450,31 +1492,65 @@ reg_t kSetShowStyle(EngineState *s, int argc, reg_t *argv) { // tables inside graphics/transitions.cpp uint16 showStyle = argv[0].toUint16(); // 0 - 15 reg_t planeObj = argv[1]; // the affected plane - //argv[2] // seconds that the transition lasts - //argv[3] // back color to be used(?) - //int16 priority = argv[4].toSint16(); - //argv[5] // boolean, animate or not while the transition lasts - //argv[6] // refFrame + uint16 seconds = argv[2].toUint16(); // seconds that the transition lasts + uint16 backColor = argv[3].toUint16(); // target back color(?). When fading out, it's 0x0000. When fading in, it's 0xffff + int16 priority = argv[4].toSint16(); // always 0xc8 (200) when fading in/out + uint16 animate = argv[5].toUint16(); // boolean, animate or not while the transition lasts + uint16 refFrame = argv[6].toUint16(); // refFrame, always 0 when fading in/out + int16 divisions; // If the game has the pFadeArray selector, another parameter is used here, // before the optional last parameter - /*bool hasFadeArray = g_sci->getKernel()->findSelector("pFadeArray") > 0; + bool hasFadeArray = g_sci->getKernel()->findSelector("pFadeArray") > 0; if (hasFadeArray) { // argv[7] - //int16 unk7 = (argc >= 9) ? argv[8].toSint16() : 0; // divisions (transition steps?) + divisions = (argc >= 9) ? argv[8].toSint16() : -1; // divisions (transition steps?) } else { - //int16 unk7 = (argc >= 8) ? argv[7].toSint16() : 0; // divisions (transition steps?) - }*/ + divisions = (argc >= 8) ? argv[7].toSint16() : -1; // divisions (transition steps?) + } if (showStyle > 15) { warning("kSetShowStyle: Illegal style %d for plane %04x:%04x", showStyle, PRINT_REG(planeObj)); return s->r_acc; } + // TODO: Proper implementation. This is a very basic version. I'm not even + // sure if the rest of the styles will work with this mechanism. + + // Check if the passed parameters are the ones we expect + if (showStyle == 13 || showStyle == 14) { // fade out / fade in + if (seconds != 1) + warning("kSetShowStyle(fade): seconds isn't 1, it's %d", seconds); + if (backColor != 0 && backColor != 0xFFFF) + warning("kSetShowStyle(fade): backColor isn't 0 or 0xFFFF, it's %d", backColor); + if (priority != 200) + warning("kSetShowStyle(fade): priority isn't 200, it's %d", priority); + if (animate != 0) + warning("kSetShowStyle(fade): animate isn't 0, it's %d", animate); + if (refFrame != 0) + warning("kSetShowStyle(fade): refFrame isn't 0, it's %d", refFrame); + if (divisions >= 0 && divisions != 20) + warning("kSetShowStyle(fade): divisions isn't 20, it's %d", divisions); + } + // TODO: Check if the plane is in the list of planes to draw - // TODO: This is all a stub/skeleton, thus we're invoking kStub() for now - kStub(s, argc, argv); + switch (showStyle) { + //case 0: // no transition, perhaps? (like in the previous SCI versions) + case 13: // fade out + // TODO: Temporary implementation, which ignores all additional parameters + fadeOut(); + break; + case 14: // fade in + // TODO: Temporary implementation, which ignores all additional parameters + g_sci->_gfxFrameout->kernelFrameout(); // draw new scene before fading in + fadeIn(); + break; + default: + // TODO: This is all a stub/skeleton, thus we're invoking kStub() for now + kStub(s, argc, argv); + break; + } return s->r_acc; } diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp index 7efcb42f4b..187f1ce021 100644 --- a/engines/sci/engine/script_patches.cpp +++ b/engines/sci/engine/script_patches.cpp @@ -366,7 +366,7 @@ const uint16 freddypharkasPatchLadderEvent[] = { // script, description, magic DWORD, adjust const SciScriptSignature freddypharkasSignatures[] = { { 0, "CD: score early disposal", 1, PATCH_MAGICDWORD(0x39, 0x0d, 0x43, 0x75), -3, freddypharkasSignatureScoreDisposal, freddypharkasPatchScoreDisposal }, - { 235, "CD: canister pickup hang", 3, PATCH_MAGICDWORD(0x39, 0x07, 0x39, 0x08), -4, freddypharkasSignatureCanisterHang, freddypharkasPatchCanisterHang }, + { 235, "CD: canister pickup hang", 3, PATCH_MAGICDWORD(0x39, 0x07, 0x39, 0x08), -4, freddypharkasSignatureCanisterHang, freddypharkasPatchCanisterHang }, { 320, "ladder event issue", 2, PATCH_MAGICDWORD(0x6d, 0x76, 0x38, 0xf5), -1, freddypharkasSignatureLadderEvent, freddypharkasPatchLadderEvent }, SCI_SIGNATUREENTRY_TERMINATOR }; @@ -437,8 +437,68 @@ const uint16 gk1PatchDay5PhoneFreeze[] = { PATCH_END }; +// Floppy version: Interrogation::dispose() compares an object reference +// (stored in the view selector) with a number, leading to a crash (this kind +// of comparison was not used in SCI32). The view selector is used to store +// both a view number (in some cases), and a view reference (in other cases). +// In the floppy version, the checks are in the wrong order, so there is a +// comparison between a number an an object. In the CD version, the checks are +// in the correct order, thus the comparison is correct, thus we use the code +// from the CD version in the floppy one. +const byte gk1SignatureInterrogationBug[] = { + 43, + 0x65, 0x4c, // aTop 4c + 0x67, 0x50, // pTos 50 + 0x34, 0x10, 0x27, // ldi 2710 + 0x1e, // gt? + 0x31, 0x08, // bnt 08 [05a0] + 0x67, 0x50, // pTos 50 + 0x34, 0x10, 0x27, // ldi 2710 + 0x04, // sub + 0x65, 0x50, // aTop 50 + 0x63, 0x50, // pToa 50 + 0x31, 0x15, // bnt 15 [05b9] + 0x39, 0x0e, // pushi 0e + 0x76, // push0 + 0x4a, 0x04, 0x00, // send 0004 + 0xa5, 0x00, // sat 00 + 0x38, 0x93, 0x00, // pushi 0093 + 0x76, // push0 + 0x63, 0x50, // pToa 50 + 0x4a, 0x04, 0x00, // send 0004 + 0x85, 0x00, // lat 00 + 0x65, 0x50, // aTop 50 + 0 +}; + +const uint16 gk1PatchInterrogationBug[] = { + 0x65, 0x4c, // aTop 4c + 0x63, 0x50, // pToa 50 + 0x31, 0x15, // bnt 15 [05b9] + 0x39, 0x0e, // pushi 0e + 0x76, // push0 + 0x4a, 0x04, 0x00, // send 0004 + 0xa5, 0x00, // sat 00 + 0x38, 0x93, 0x00, // pushi 0093 + 0x76, // push0 + 0x63, 0x50, // pToa 50 + 0x4a, 0x04, 0x00, // send 0004 + 0x85, 0x00, // lat 00 + 0x65, 0x50, // aTop 50 + 0x67, 0x50, // pTos 50 + 0x34, 0x10, 0x27, // ldi 2710 + 0x1e, // gt? + 0x31, 0x08, // bnt 08 [05b9] + 0x67, 0x50, // pTos 50 + 0x34, 0x10, 0x27, // ldi 2710 + 0x04, // sub + 0x65, 0x50, // aTop 50 + PATCH_END +}; + // script, description, magic DWORD, adjust const SciScriptSignature gk1Signatures[] = { + { 51, "interrogation bug", 1, PATCH_MAGICDWORD(0x65, 0x4c, 0x67, 0x50), 0, gk1SignatureInterrogationBug, gk1PatchInterrogationBug }, { 212, "day 5 phone freeze", 1, PATCH_MAGICDWORD(0x35, 0x03, 0x65, 0x1a), 0, gk1SignatureDay5PhoneFreeze, gk1PatchDay5PhoneFreeze }, { 230, "day 6 police beignet timer issue", 1, PATCH_MAGICDWORD(0x34, 0xdc, 0x00, 0x65), -16, gk1SignatureDay6PoliceBeignet, gk1PatchDay6PoliceBeignet }, { 230, "day 6 police sleep timer issue", 1, PATCH_MAGICDWORD(0x34, 0xdc, 0x00, 0x65), -5, gk1SignatureDay6PoliceSleep, gk1PatchDay6PoliceSleep }, diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp index 9f150ae507..e3fac80f7c 100644 --- a/engines/sci/graphics/frameout.cpp +++ b/engines/sci/graphics/frameout.cpp @@ -101,7 +101,7 @@ void GfxFrameout::kernelAddPlane(reg_t object) { } void GfxFrameout::kernelUpdatePlane(reg_t object) { - for (PlaneList::iterator it = _planes.begin(); it != _planes.end(); it++) { + for (PlaneList::iterator it = _planes.begin(); it != _planes.end(); ++it) { if (it->object == object) { // Read some information it->priority = readSelectorValue(_segMan, object, SELECTOR(priority)); @@ -178,8 +178,10 @@ void GfxFrameout::kernelUpdatePlane(reg_t object) { } void GfxFrameout::kernelDeletePlane(reg_t object) { + deletePlaneItems(object); deletePlanePictures(object); - for (PlaneList::iterator it = _planes.begin(); it != _planes.end(); it++) { + + for (PlaneList::iterator it = _planes.begin(); it != _planes.end(); ++it) { if (it->object == object) { _planes.erase(it); Common::Rect planeRect; @@ -193,10 +195,6 @@ void GfxFrameout::kernelDeletePlane(reg_t object) { planeRect.left = (planeRect.left * screenRect.width()) / _scriptsRunningWidth; planeRect.bottom = (planeRect.bottom * screenRect.height()) / _scriptsRunningHeight; planeRect.right = (planeRect.right * screenRect.width()) / _scriptsRunningWidth; - planeRect.clip(screenRect); // we need to do this, at least in gk1 on cemetary we get bottom right -> 201, 321 - // FIXME: The code above incorrectly added 1 pixel to the plane's - // bottom and right, so probably the plane clipping code is no - // longer necessary // Blackout removed plane rect _paint32->fillRect(planeRect, 0); return; @@ -276,6 +274,18 @@ void GfxFrameout::kernelDeleteScreenItem(reg_t object) { _screenItems.remove(itemEntry); } +void GfxFrameout::deletePlaneItems(reg_t planeObject) { + FrameoutList::iterator listIterator = _screenItems.begin(); + + while (listIterator != _screenItems.end()) { + reg_t itemPlane = readSelector(_segMan, (*listIterator)->object, SELECTOR(plane)); + if (planeObject == itemPlane) + listIterator = _screenItems.erase(listIterator); + else + ++listIterator; + } +} + FrameoutEntry *GfxFrameout::findScreenItem(reg_t object) { for (FrameoutList::iterator listIterator = _screenItems.begin(); listIterator != _screenItems.end(); listIterator++) { FrameoutEntry *itemEntry = *listIterator; diff --git a/engines/sci/graphics/frameout.h b/engines/sci/graphics/frameout.h index a4a0a853e4..8c3cc261d5 100644 --- a/engines/sci/graphics/frameout.h +++ b/engines/sci/graphics/frameout.h @@ -94,6 +94,7 @@ public: void kernelAddScreenItem(reg_t object); void kernelUpdateScreenItem(reg_t object); void kernelDeleteScreenItem(reg_t object); + void deletePlaneItems(reg_t planeObject); FrameoutEntry *findScreenItem(reg_t object); int16 kernelGetHighPlanePri(); void kernelAddPicAt(reg_t planeObj, GuiResourceId pictureId, int16 pictureX, int16 pictureY); diff --git a/engines/sci/graphics/transitions.cpp b/engines/sci/graphics/transitions.cpp index d047eb10a1..438cf376a5 100644 --- a/engines/sci/graphics/transitions.cpp +++ b/engines/sci/graphics/transitions.cpp @@ -295,12 +295,12 @@ void GfxTransitions::fadeOut() { int16 stepNr, colorNr; // Sierra did not fade in/out color 255 for sci1.1, but they used it in // several pictures (e.g. qfg3 demo/intro), so the fading looked weird - int16 tillColorNr = getSciVersion() >= SCI_VERSION_1_1 ? 256 : 255; + int16 tillColorNr = getSciVersion() >= SCI_VERSION_1_1 ? 255 : 254; g_system->getPaletteManager()->grabPalette(oldPalette, 0, 256); for (stepNr = 100; stepNr >= 0; stepNr -= 10) { - for (colorNr = 1; colorNr < tillColorNr; colorNr++) { + for (colorNr = 1; colorNr <= tillColorNr; colorNr++) { if (_palette->colorIsFromMacClut(colorNr)) { workPalette[colorNr * 3 + 0] = oldPalette[colorNr * 3]; workPalette[colorNr * 3 + 1] = oldPalette[colorNr * 3 + 1]; @@ -311,7 +311,7 @@ void GfxTransitions::fadeOut() { workPalette[colorNr * 3 + 2] = oldPalette[colorNr * 3 + 2] * stepNr / 100; } } - g_system->getPaletteManager()->setPalette(workPalette + 3, 1, 254); + g_system->getPaletteManager()->setPalette(workPalette + 3, 1, tillColorNr); g_sci->getEngineState()->wait(2); } } @@ -322,10 +322,10 @@ void GfxTransitions::fadeIn() { int16 stepNr; // Sierra did not fade in/out color 255 for sci1.1, but they used it in // several pictures (e.g. qfg3 demo/intro), so the fading looked weird - int16 tillColorNr = getSciVersion() >= SCI_VERSION_1_1 ? 256 : 255; + int16 tillColorNr = getSciVersion() >= SCI_VERSION_1_1 ? 255 : 254; for (stepNr = 0; stepNr <= 100; stepNr += 10) { - _palette->kernelSetIntensity(1, tillColorNr, stepNr, true); + _palette->kernelSetIntensity(1, tillColorNr + 1, stepNr, true); g_sci->getEngineState()->wait(2); } } diff --git a/engines/scumm/script.cpp b/engines/scumm/script.cpp index cfc4b3c419..37ea3a9a9f 100644 --- a/engines/scumm/script.cpp +++ b/engines/scumm/script.cpp @@ -29,6 +29,7 @@ #include "scumm/resource.h" #include "scumm/util.h" #include "scumm/scumm_v2.h" +#include "scumm/sound.h" #include "scumm/verbs.h" namespace Scumm { @@ -935,6 +936,17 @@ void ScummEngine::runExitScript() { } if (VAR_EXIT_SCRIPT2 != 0xFF && VAR(VAR_EXIT_SCRIPT2)) runScript(VAR(VAR_EXIT_SCRIPT2), 0, 0, 0); + +#ifdef ENABLE_SCUMM_7_8 + // WORKAROUND: The spider lair (room 44) will optionally play the sound + // of trickling water (sound 215), but it never stops it. The same sound + // effect is also used in room 33, so let's do the same fade out that it + // does in that room's exit script. + if (_game.id == GID_DIG && _currentRoom == 44) { + int scriptCmds[] = { 14, 215, 0x600, 0, 30, 0, 0, 0 }; + _sound->soundKludge(scriptCmds, ARRAYSIZE(scriptCmds)); + } +#endif } void ScummEngine::runEntryScript() { diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp index 4c9c6de956..1ac426518d 100644 --- a/engines/tsage/globals.cpp +++ b/engines/tsage/globals.cpp @@ -416,11 +416,14 @@ void Ringworld2Globals::reset() { _v56AAB = 0; _v57C2C = 0; _v58CE2 = 0; + _v565EC[0] = 0; + _v565EC[1] = 27; + _v565EC[2] = 27; + _v565EC[3] = 4; + _v565EC[4] = 4; Common::fill(&_v565F1[0], &_v565F1[MAX_CHARACTERS], 1); _speechSubtitles = SPEECH_VOICE | SPEECH_TEXT; _insetUp = 0; - - Common::fill(&_v565F1[0], &_v565F1[MAX_CHARACTERS], 0); Common::fill(&_stripManager_lookupList[0], &_stripManager_lookupList[12], 0); _stripManager_lookupList[0] = 1; _stripManager_lookupList[1] = 1; @@ -460,8 +463,11 @@ void Ringworld2Globals::synchronize(Serializer &s) { s.syncAsSint16LE(_v58CE2); s.syncAsSint16LE(_speechSubtitles); + for (i = 0; i < 5; i++) + s.syncAsByte(_v565EC[i]); + for (i = 0; i < MAX_CHARACTERS; ++i) - s.syncAsSint16LE(_v565F1[i]); + s.syncAsByte(_v565F1[i]); s.syncAsByte(_v565AE); s.syncAsByte(_v566A8); diff --git a/engines/tsage/globals.h b/engines/tsage/globals.h index 07f5b85e9b..9d00e618a4 100644 --- a/engines/tsage/globals.h +++ b/engines/tsage/globals.h @@ -274,7 +274,8 @@ public: int _v57C2C; int _v58CE2; int _speechSubtitles; - int _v565F1[4]; + byte _v565EC[5]; + byte _v565F1[4]; byte _stripManager_lookupList[12]; virtual void reset(); diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index d7d21154f3..2f537c4ebe 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -117,6 +117,7 @@ Scene *Ringworld2Game::createScene(int sceneNumber) { // Cutscene - Elevator return new Scene1530(); case 1550: + return new Scene1550(); case 1575: case 1580: case 1625: diff --git a/engines/tsage/ringworld2/ringworld2_logic.h b/engines/tsage/ringworld2/ringworld2_logic.h index bb6aa25f85..9b64063803 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.h +++ b/engines/tsage/ringworld2/ringworld2_logic.h @@ -265,6 +265,7 @@ public: int _state; SceneActorExt() { _state = 0; } + virtual Common::String getClassName() { return "SceneActorExt"; } virtual void synchronize(Serializer &s) { SceneActor::synchronize(s); diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp index 84da3f23f8..45aec17fbf 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp @@ -1126,6 +1126,40 @@ int Scene1200::Object1::sub51AF8(Common::Point pt) { return -1; } +bool Scene1200::Object1::sub51AFD(Common::Point pt) { + int retval = false; + + _field2E = pt.x; + _field30 = pt.y; + + if (_field2E < _rect2.top) { + _field2E = _rect2.top; + retval = true; + } + + if (_field30 < _rect2.left) { + _field30 = _rect2.left; + retval = true; + } + + if (_field2E + _rect1.width() > _rect2.right) { + _field2E = _rect2.right - _rect1.width(); + retval = true; + } + + if (_field30 + _rect1.height() > _rect2.bottom) { + _field30 = _rect2.bottom - _rect1.height(); + retval = true; + } + + return retval; +} + +void Scene1200::Object1::sub9EDE8(Rect rect) { + _rect1 = rect; + warning("FIXME: Scene1200::Object1::sub9EDE8()"); +// _rect1.clip(g_globals->gfxManager()._bounds); +} void Scene1200::postInit(SceneObjectList *OwnerList) { Rect tmpRect; @@ -1163,9 +1197,10 @@ void Scene1200::postInit(SceneObjectList *OwnerList) { _actor1.hide(); tmpRect.set(110, 20, 210, 120); - warning("_object1.sub9EDE8(tmpRect);"); + _object1.sub9EDE8(tmpRect); + warning("_object1.sub51AE9(1);"); - warning("_object1.sub51AFD(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4);"); + _object1.sub51AFD(Common::Point(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4)); warning("int unk = set_pane_p(_paneNumber);"); warning("_object1.sub51B02();"); warning("set_pane_p(unk);"); @@ -1572,7 +1607,7 @@ void Scene1200::dispatch() { Rect tmpRect; Scene::dispatch(); if (_field41C != 0) { - warning("_object1.sub51AFD(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4);"); + _object1.sub51AFD(Common::Point(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4)); warning("int unk = set_pane_p(_paneNumber);"); warning("_object1.sub51B02();"); warning("_gfxManager.sub294AC(unk);"); @@ -1599,7 +1634,7 @@ void Scene1200::dispatch() { default: break; } - warning("_object1.sub51AFD(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4);"); + _object1.sub51AFD(Common::Point(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4)); warning("int unk = set_pane_p(_paneNumber);"); warning("_object1.sub51B02();"); warning("_gfxManager.sub294AC(unk);"); @@ -1937,6 +1972,1081 @@ void Scene1530::dispatch() { Scene::dispatch(); } +/*-------------------------------------------------------------------------- + * Scene 1550 - + * + *--------------------------------------------------------------------------*/ +Scene1550::UnkObj15501::UnkObj15501() { + _fieldA4 = _fieldA6 = 0; +} + +void Scene1550::UnkObj15501::synchronize(Serializer &s) { + SceneActor::synchronize(s); + + s.syncAsSint16LE(_fieldA4); + s.syncAsSint16LE(_fieldA6); +} + +bool Scene1550::UnkObj15501::startAction(CursorType action, Event &event) { + Scene1550 *scene = (Scene1550 *)R2_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + if (_visage == 1561) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 40; + Common::Point pt(_position.x + 5, _position.y + 20); + PlayerMover *mover = new PlayerMover(); + R2_GLOBALS._player.addMover(mover, &pt, scene); + return true; + } + return SceneActor::startAction(action, event); + break; + case CURSOR_LOOK: + if (_visage == 1561) { + switch (_frame) { + case 2: + SceneItem::display(1550, 23, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + break; + case 3: + SceneItem::display(1550, 26, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + break; + case 4: + SceneItem::display(1550, 35, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + break; + default: + break; + } + } else { + switch ((((_strip - 1) * 5) + _frame) % 3) { + case 0: + SceneItem::display(1550, 62, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + break; + case 1: + SceneItem::display(1550, 53, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + break; + case 2: + SceneItem::display(1550, 76, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + break; + default: + break; + } + } + return true; + break; + default: + return SceneActor::startAction(action, event); + break; + } +} + +Scene1550::UnkObj15502::UnkObj15502() { + _fieldA4 = 0; +} + +void Scene1550::UnkObj15502::synchronize(Serializer &s) { + SceneActor::synchronize(s); + + s.syncAsSint16LE(_fieldA4); +} + +bool Scene1550::UnkObj15502::startAction(CursorType action, Event &event) { + Scene1550 *scene = (Scene1550 *)R2_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + if (_fieldA4 == 8) { + scene->_field412 = 1; + R2_GLOBALS._player.disableControl(); + if (R2_GLOBALS._player._characterIndex == 1) + scene->_sceneMode = 1576; + else + scene->_sceneMode = 1584; + // strcpy(scene->_arrUnkObj15502[7]._actorName, 'hatch'); + scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_arrUnkObj15502[7], NULL); + return true; + } + return SceneActor::startAction(action, event); + break; + case CURSOR_LOOK: + if (_fieldA4 == 8) + SceneItem::display(1550, 75, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + else if (_frame == 1) + SceneItem::display(1550, 70, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + else + SceneItem::display(1550, 71, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + return true; + break; + case R2_17: + scene->_field412 = 1; + if (_fieldA4 == 6) { + R2_GLOBALS._player.disableControl(); + scene->_actor1.postInit(); + if (R2_GLOBALS._player._characterIndex == 1) + scene->_sceneMode = 1574; + else + scene->_sceneMode = 1582; + scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_arrUnkObj15502[5], &scene->_actor1, NULL); + return true; + } + return SceneActor::startAction(action, event); + break; + case R2_18: + scene->_field412 = 1; + if (_fieldA4 == 3) { + R2_GLOBALS._player.disableControl(); + scene->_actor1.postInit(); + if (R2_GLOBALS._player._characterIndex == 1) + scene->_sceneMode = 1571; + else + scene->_sceneMode = 1581; + scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_arrUnkObj15502[2], &scene->_actor1, NULL); + return true; + } + return SceneActor::startAction(action, event); + break; + case R2_22: + scene->_field412 = 1; + if (_fieldA4 == 1) { + R2_GLOBALS._player.disableControl(); + scene->_actor1.postInit(); + if (R2_GLOBALS._player._characterIndex == 1) + scene->_sceneMode = 1569; + else + scene->_sceneMode = 1579; + scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_arrUnkObj15502[0], &scene->_actor1, NULL); + return true; + } + return SceneActor::startAction(action, event); + break; + case R2_23: + scene->_field412 = 1; + if (_fieldA4 == 4) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 1572; + scene->_actor1.postInit(); + scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_arrUnkObj15502[3], &scene->_actor1, NULL); + return true; + } + return SceneActor::startAction(action, event); + break; + case R2_25: + scene->_field412 = 1; + if (_fieldA4 == 2) { + R2_GLOBALS._player.disableControl(); + scene->_actor1.postInit(); + if (R2_GLOBALS._player._characterIndex == 1) + scene->_sceneMode = 1570; + else + scene->_sceneMode = 1580; + scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_arrUnkObj15502[1], &scene->_actor1, NULL); + return true; + } + return SceneActor::startAction(action, event); + break; + case R2_27: + scene->_field412 = 1; + if (_fieldA4 == 5) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 1573; + scene->_actor1.postInit(); + scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_arrUnkObj15502[4], &scene->_actor1, NULL); + return true; + } + return SceneActor::startAction(action, event); + break; + case R2_45: + scene->_field412 = 1; + if (_fieldA4 == 7) { + R2_GLOBALS._player.disableControl(); + scene->_actor1.postInit(); + if (R2_GLOBALS._player._characterIndex == 1) + scene->_sceneMode = 1575; + else + scene->_sceneMode = 1583; + scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_arrUnkObj15502[6], &scene->_actor1, NULL); + return true; + } + return SceneActor::startAction(action, event); + break; + default: + return SceneActor::startAction(action, event); + break; + } +} + +Scene1550::UnkObj15503::UnkObj15503() { + _fieldA4 = 0; +} + +void Scene1550::UnkObj15503::synchronize(Serializer &s) { + SceneActor::synchronize(s); + + s.syncAsSint16LE(_fieldA4); +} + +bool Scene1550::UnkObj15503::startAction(CursorType action, Event &event) { + Scene1550 *scene = (Scene1550 *)R2_GLOBALS._sceneManager._scene; + + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + switch (_fieldA4) { + case 1: + if (scene->_actor13._frame == 5) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 25; + if (scene->_actor4._frame == 1) { + scene->setAction(&scene->_sequenceManager1, scene, 1560, &scene->_actor4, NULL); + R2_GLOBALS.setFlag(20); + setFrame(2); + } else { + scene->setAction(&scene->_sequenceManager1, scene, 1561, &scene->_actor4, NULL); + R2_GLOBALS.clearFlag(20); + setFrame(1); + } + scene->_unkArea1.remove(); + } + break; + case 2: + R2_GLOBALS._player.disableControl(); + if (scene->_actor13._frame == 1) { + scene->_sceneMode = 23; + scene->setAction(&scene->_sequenceManager1, scene, 1560, this, NULL); + } else { + if (scene->_actor4._frame == 1) + scene->_sceneMode = 24; + else + scene->_sceneMode = 22; + scene->setAction(&scene->_sequenceManager1, scene, 1561, this, NULL); + } + break; + default: + break; + } + return true; +} + +void Scene1550::UnkArea1550::remove() { + Scene1550 *scene = (Scene1550 *)R2_GLOBALS._sceneManager._scene; + + _unkObj155031.remove(); + _unkObj155032.remove(); + // sub201EA is a common part with UnkArea1200 + R2_GLOBALS._sceneItems.remove((SceneItem *)this); + _areaActor.remove(); + SceneArea::remove(); + R2_GLOBALS._insetUp--; + // + if ((scene->_sceneMode >= 20) and (scene->_sceneMode <= 29)) + return; + + R2_GLOBALS._player.disableControl(); + if (scene->_actor4._frame == 1) { + scene->_sceneMode = 1559; + scene->setAction(&scene->_sequenceManager1, scene, 1559, &R2_GLOBALS._player, NULL); + } else { + scene->_sceneMode = 1562; + scene->setAction(&scene->_sequenceManager1, scene, 1562, &R2_GLOBALS._player, NULL); + } +} +void Scene1550::UnkArea1550::proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY) { + warning("Scene1550::UnkArea1550::proc12() should be based on Scene1550::UnkArea1200::proc12()"); +} + +bool Scene1550::Hotspot1::startAction(CursorType action, Event &event) { + return SceneHotspot::startAction(action, event); +} + +bool Scene1550::Hotspot3::startAction(CursorType action, Event &event) { + // Arrays related to this scene are all hacky in the origina: they are based on the impossibility to use Miranda + assert ((R2_GLOBALS._player._characterIndex == 1) || (R2_GLOBALS._player._characterIndex == 2)); + // The original contains a debug message when CURSOR_TALK is used. + if (action == CURSOR_TALK) + warning("Location: %d/%d - %d", R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex], R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex + 2], _v5A4D6[(R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex + 2] * 30)] + R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex]); + + return SceneHotspot::startAction(action, event); +} + +bool Scene1550::Actor6::startAction(CursorType action, Event &event) { + return SceneActor::startAction(action, event); +} + +bool Scene1550::Actor7::startAction(CursorType action, Event &event) { + if (action != CURSOR_TALK) + return SceneActor::startAction(action, event); + + Scene1550 *scene = (Scene1550 *)R2_GLOBALS._sceneManager._scene; + scene->_sceneMode = 80; + scene->signal(); + + return true; +} + +bool Scene1550::Actor8::startAction(CursorType action, Event &event) { + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + + R2_GLOBALS._player.disableControl(); + Scene1550 *scene = (Scene1550 *)R2_GLOBALS._sceneManager._scene; + scene->_field412 = 1; + if (R2_GLOBALS._player._characterIndex == 1) + scene->_sceneMode = 1552; + else + scene->_sceneMode = 1588; + + scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_actor8, NULL); + return true; +} + +bool Scene1550::Actor9::startAction(CursorType action, Event &event) { + Scene1550 *scene = (Scene1550 *)R2_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + scene->_sceneMode = 50; + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + if (R2_GLOBALS._player._characterIndex == 1) + scene->_stripManager.start(518, scene); + else + scene->_stripManager.start(520, scene); + return true; + break; + case CURSOR_LOOK: + SceneItem::display(1550, 41, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + return true; + break; + default: + return SceneActor::startAction(action, event); + } +} + +bool Scene1550::Actor10::startAction(CursorType action, Event &event) { + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + + Scene1550 *scene = (Scene1550 *)R2_GLOBALS._sceneManager._scene; + R2_GLOBALS._player.disableControl(); + if (R2_GLOBALS._player._characterIndex == 1) + scene->_sceneMode = 1555; + else + scene->_sceneMode = 1589; + + scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_actor10, NULL); + return true; +} + +bool Scene1550::Actor11::startAction(CursorType action, Event &event) { + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + + Scene1550 *scene = (Scene1550 *)R2_GLOBALS._sceneManager._scene; + R2_GLOBALS._player.disableControl(); + scene->_field412 = 1; + if (R2_GLOBALS._player._characterIndex == 1) + scene->_sceneMode = 1586; + else + scene->_sceneMode = 1587; + + scene->setAction(&scene->_sequenceManager1, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_actor11, NULL); + return true; +} + +bool Scene1550::Actor12::startAction(CursorType action, Event &event) { + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + + Scene1550 *scene = (Scene1550 *)R2_GLOBALS._sceneManager._scene; + + if (R2_GLOBALS._player._characterIndex == 2) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 1585; + scene->setAction(&scene->_sequenceManager1, scene, 1585, &R2_GLOBALS._player, NULL); + } else { + R2_GLOBALS._player.disableControl(); + switch(scene->_field415) { + case 0: + scene->_actor13.fixPriority(168); + scene->_actor4.fixPriority(125); + scene->_sceneMode = 1558; + scene->setAction(&scene->_sequenceManager1, scene, 1558, &R2_GLOBALS._player, NULL); + break; + case 1: + return SceneActor::startAction(action, event); + break; + case 2: + scene->_field415 = 1; + scene->_sceneMode = 1563; + scene->setAction(&scene->_sequenceManager1, scene, 1563, &R2_GLOBALS._player, &scene->_actor4, NULL); + break; + default: + break; + } + } + return true; + +} + +bool Scene1550::Actor13::startAction(CursorType action, Event &event) { + Scene1550 *scene = (Scene1550 *)R2_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + if (scene->_field415 != 2) + return SceneActor::startAction(action, event); + + if (R2_INVENTORY.getObjectScene(R2_45) == 1550) { + R2_GLOBALS._player.disableControl(); + scene->_sceneMode = 1564; + scene->setAction(&scene->_sequenceManager1, scene, 1564, &R2_GLOBALS._player, NULL); + } else + SceneItem::display(1550, 64, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + return true; + break; + case CURSOR_LOOK: + if (scene->_field415 != 2) + return SceneActor::startAction(action, event); + + if (R2_INVENTORY.getObjectScene(R2_45) == 1550) { + SceneItem::display(1550, 74, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + } else + SceneItem::display(1550, 64, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + return true; + break; + default: + return SceneActor::startAction(action, event); + break; + } +} + +Scene1550::Scene1550() { + _field412 = 0; + _field414 = 0; + _field415 = 0; + _field417 = 0; + _field419 = 0; +} + +void Scene1550::synchronize(Serializer &s) { + SceneExt::synchronize(s); + + s.syncAsSint16LE(_field412); + s.syncAsByte(_field414); + s.syncAsSint16LE(_field415); + s.syncAsSint16LE(_field417); + s.syncAsSint16LE(_field419); +} + +void Scene1550::postInit(SceneObjectList *OwnerList) { + if ((R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex] == 9) && (R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex + 2] == 11)) + loadScene(1234); + else + loadScene(1550); + + scalePalette(65, 65, 65); + setZoomPercents(30, 75, 170, 100); + _field417 = 1550; + _field419 = 0; + SceneExt::postInit(); + + if (R2_GLOBALS._sceneManager._previousScene == -1) + R2_GLOBALS.setFlag(R2_16); + + if ((R2_GLOBALS._player._characterScene[1] != 1550) && (R2_GLOBALS._player._characterScene[1] != 1580)) { + R2_GLOBALS._player._characterScene[1] = 1550; + R2_GLOBALS._player._characterScene[2] = 1550; + } + + _stripManager.setColors(60, 255); + _stripManager.setFontNumber(3); + _stripManager.addSpeaker(&_quinnSpeaker); + _stripManager.addSpeaker(&_seekerSpeaker); + + R2_GLOBALS._player.postInit(); + R2_GLOBALS._player._effect = 6; + + if (R2_GLOBALS._player._characterIndex == 1) + R2_GLOBALS._player.setup(1500, 3, 1); + else + R2_GLOBALS._player.setup(1505, 3, 1); + + R2_GLOBALS._player._moveDiff = Common::Point(5, 3); + + if ((R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex] == 9) && (R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex + 2] == 11)) + R2_GLOBALS._player.setPosition(Common::Point(157, 135)); + else + R2_GLOBALS._player.setPosition(Common::Point(160, 100)); + + R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); + R2_GLOBALS._player.disableControl(); + + _field414 = 0; + _actor7.changeZoom(-1); + R2_GLOBALS._player.changeZoom(-1); + + switch (R2_GLOBALS._sceneManager._previousScene) { + case 1530: + R2_GLOBALS._v565AE = 0; + // No break on purpose + case 300: + // No break on purpose + case 1500: + // No break on purpose + case 3150: + R2_GLOBALS._sound1.play(105); + break; + case 1580: + if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 1580) { + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._player.animate(ANIM_MODE_NONE, NULL); + + _field412 = 1; + + _actor1.postInit(); + warning("_arrUnkObj15502[7].subA5CDF()"); + _arrUnkObj15502[7].hide(); + if (R2_GLOBALS._player._characterIndex == 1) + _sceneMode = 1577; + else + _sceneMode = 1578; + + setAction(&_sequenceManager1, this, _sceneMode, &R2_GLOBALS._player, &_actor1, &_arrUnkObj15502[7], NULL); + R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] = 1550; + } else { + R2_GLOBALS._player.enableControl(); + } + break; + default: + break; + } + warning("subA2B2F();"); + _item1.setDetails(16, 1550, 10, -1, -1); + _item2.setDetails(24, 1550, 10, -1, -1); + _item3.setDetails(Rect(0, 0, 320, 200), 1550, 0, 1, -1, 1, NULL); + + if ((R2_GLOBALS._sceneManager._previousScene == 1500) && (R2_GLOBALS.getFlag(16))) { + _sceneMode = 70; + if (!R2_GLOBALS._sceneObjects->contains(&_actor7)) + _actor7.postInit(); + + if (R2_GLOBALS._player._characterIndex == 1) + _actor7.setVisage(1505); + else + _actor7.setVisage(1500); + + _actor7.changeZoom(77); + _actor7.setDetails(1550, -1, -1, -1, 2, (SceneItem *) NULL); + + warning("R2_GLOBALS._walkRegions.enableRegion(R2_GLOBALS._v14A72[_field419]);"); + setAction(&_sequenceManager1, this, 1590, &_actor7, NULL); + } else if ((_sceneMode != 1577) && (_sceneMode != 1578)) + R2_GLOBALS._player.enableControl(); +} + +void Scene1550::signal() { + switch (_sceneMode) { + case 1: + // No break on purpose + case 3: + // No break on purpose + case 5: + // No break on purpose + case 7: + _field412 = 0; + R2_GLOBALS._v56AAB = 0; + R2_GLOBALS._player.enableControl(CURSOR_ARROW); + break; + case 20: + // No break on purpose + case 21: + // No break on purpose + case 25: + // No break on purpose + case 1563: + R2_GLOBALS.clearFlag(20); + _unkArea1.proc12(1559, 1, 1, 160, 125); + R2_GLOBALS._player.enableControl(); + _sceneMode = 0; + break; + case 22: + _unkArea1.remove(); + _sceneMode = 24; + setAction(&_sequenceManager1, this, 1561, &_actor4, NULL); + R2_GLOBALS.clearFlag(20); + break; + case 23: + _unkArea1.remove(); + _sceneMode = 20; + setAction(&_sequenceManager1, this, 1566, &_actor13, &_actor5, NULL); + R2_GLOBALS.setFlag(21); + break; + case 24: + _unkArea1.remove(); + _sceneMode = 21; + setAction(&_sequenceManager1, this, 1567, &_actor13, &_actor5, NULL); + R2_GLOBALS.clearFlag(19); + break; + case 30: + // No break on purpose + case 1556: + // No break on purpose + case 1557: + // Nothing on purpose + break; + case 40: { + _sceneMode = 41; + Common::Point pt(_arrUnkObj15501[0]._position.x, _arrUnkObj15501[0]._position.y + 20); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 41: + _sceneMode = 42; + if (R2_GLOBALS._player._characterIndex == 1) { + R2_GLOBALS._player.setup(1502, 8, 1); + } else { + R2_GLOBALS._player.changeZoom(R2_GLOBALS._player._percent + 14); + R2_GLOBALS._player.setup(1516, 4, 1); + } + R2_GLOBALS._player.animate(ANIM_MODE_5, this); + break; + case 42: + _sceneMode = 43; + warning("TODO: unknown use of arrUnkObj15501[0]._fieldA6"); + switch (_arrUnkObj15501[0]._frame - 1) { + case 0: + R2_INVENTORY.setObjectScene(26, R2_GLOBALS._player._characterIndex); + break; + case 1: + R2_INVENTORY.setObjectScene(17, R2_GLOBALS._player._characterIndex); + break; + case 2: + R2_INVENTORY.setObjectScene(22, R2_GLOBALS._player._characterIndex); + break; + case 3: + R2_INVENTORY.setObjectScene(25, R2_GLOBALS._player._characterIndex); + break; + case 4: + R2_INVENTORY.setObjectScene(45, R2_GLOBALS._player._characterIndex); + break; + case 5: + R2_INVENTORY.setObjectScene(28, R2_GLOBALS._player._characterIndex); + break; + default: + break; + } + _arrUnkObj15501[0].remove(); + R2_GLOBALS._player.animate(ANIM_MODE_6, this); + break; + case 43: + warning("TODO: unknown use of arrUnkObj15501[0]._fieldA6"); + if (R2_GLOBALS._player._characterIndex == 1) + R2_GLOBALS._player.setVisage(1500); + else { + R2_GLOBALS._player.changeZoom(-1); + R2_GLOBALS._player.setVisage(1505); + } + R2_GLOBALS._player.animate(ANIM_MODE_1, this); + R2_GLOBALS._player.setStrip(8); + R2_GLOBALS._player.enableControl(); + break; + case 50: + warning("STUB: sub_1D227()"); + ++_sceneMode; + setAction(&_sequenceManager1, this, 1591, &R2_GLOBALS._player, NULL); + if (g_globals->_sceneObjects->contains(&_actor7)) + signal(); + else { + _actor7.postInit(); + if (R2_GLOBALS._player._characterIndex == 1) + _actor7.setVisage(1505); + else + _actor7.setVisage(1500); + _actor7.changeZoom(77); + _actor7.setAction(&_sequenceManager2, this, 1590, &_actor7, NULL); + _actor7.setDetails(1550, -1, -1, -1, 2, (SceneItem *) NULL); + } + break; + case 51: + ++_sceneMode; + break; + case 52: + _actor7.changeZoom(-1); + _sceneMode = 1592; + if (R2_GLOBALS._player._characterIndex == 1) + setAction(&_sequenceManager1, this, 1592, &R2_GLOBALS._player, &_actor7, &_arrUnkObj15501[0], &_actor9, NULL); + else + setAction(&_sequenceManager1, this, 1593, &R2_GLOBALS._player, &_actor7, &_arrUnkObj15501[0], &_actor9, NULL); + break; + case 61: + R2_GLOBALS._player.enableControl(CURSOR_USE); + R2_GLOBALS._player._canWalk = false; + _field415 = 2; + break; + case 62: + R2_GLOBALS._player.enableControl(CURSOR_TALK); + if (_field415 == 2) { + R2_GLOBALS._player.enableControl(CURSOR_USE); + R2_GLOBALS._player._canWalk = false; + } + break; + case 70: + R2_GLOBALS._v565EC[2] = R2_GLOBALS._v565EC[1]; + R2_GLOBALS._v565EC[4] = R2_GLOBALS._v565EC[3]; + R2_GLOBALS._v565EC[0] = 1; + _sceneMode = 60; + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + _stripManager.start(500, this); + break; + case 80: + if (R2_GLOBALS.getFlag(16)) { + _sceneMode = 60; + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + if (R2_GLOBALS._v565AE >= 3) { + if (R2_GLOBALS._player._characterIndex == 1) + _stripManager.start(572, this); + else + _stripManager.start(573, this); + } else { + ++R2_GLOBALS._v565AE; + if (R2_GLOBALS._player._characterIndex == 1) + _stripManager.start(499 + R2_GLOBALS._v565AE, this); + else + _stripManager.start(502 + R2_GLOBALS._v565AE, this); + } + } else { + _sceneMode = 60; + R2_GLOBALS._player.disableControl(); + R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + if (R2_GLOBALS._v565AE >= 4) { + if (R2_GLOBALS._player._characterIndex == 1) + _stripManager.start(572, this); + else + _stripManager.start(573, this); + } else { + ++R2_GLOBALS._v565AE; + if (R2_GLOBALS._player._characterIndex == 1) + _stripManager.start(563 + R2_GLOBALS._v565AE, this); + else + _stripManager.start(567 + R2_GLOBALS._v565AE, this); + } + } + break; + case 1550: + R2_GLOBALS._sceneManager.changeScene(1525); + break; + case 1552: + // No break on purpose + case 1588: + R2_INVENTORY.setObjectScene(R2_19, R2_GLOBALS._player._characterIndex); + _actor8.remove(); + _field412 = 0; + R2_GLOBALS._player.enableControl(); + break; + case 1553: + R2_GLOBALS._sceneManager.changeScene(1575); + break; + case 1554: + R2_GLOBALS._player.enableControl(); + _field412 = 0; + break; + case 1555: + // No break on purpose + case 1589: + R2_INVENTORY.setObjectScene(R2_18, R2_GLOBALS._player._characterIndex); + _actor10.remove(); + R2_GLOBALS._player.enableControl(); + break; + case 1558: + _actor13.fixPriority(124); + _field415 = 1; + _unkArea1.proc12(1559, 1, 1, 160, 125); + R2_GLOBALS._player.enableControl(); + break; + case 1559: + _actor13.fixPriority(168); + _actor4.fixPriority(169); + R2_GLOBALS._player.fixPriority(-1); + R2_GLOBALS._player.changeZoom(-1); + _field415 = 0; + R2_GLOBALS._player.enableControl(); + break; + case 1562: + R2_GLOBALS._player.enableControl(); + R2_GLOBALS._player._canWalk = false; + _field415 = 2; + break; + case 1564: + R2_INVENTORY.setObjectScene(R2_45, 1); + _sceneMode = 1565; + setAction(&_sequenceManager1, this, 1565, &R2_GLOBALS._player, NULL); + break; + case 1565: + R2_GLOBALS._player.enableControl(CURSOR_USE); + R2_GLOBALS._player._canWalk = false; + break; + case 1569: + // No break on purpose + case 1579: + _field412 = 0; + _actor1.remove(); + R2_INVENTORY.setObjectScene(R2_22, 0); + R2_GLOBALS._player.enableControl(); + break; + case 1570: + // No break on purpose + case 1580: + _field412 = 0; + _actor1.remove(); + R2_INVENTORY.setObjectScene(R2_25, 0); + R2_GLOBALS._player.enableControl(); + break; + case 1571: + // No break on purpose + case 1581: + _field412 = 0; + _actor1.remove(); + R2_INVENTORY.setObjectScene(R2_18, 0); + R2_GLOBALS._player.enableControl(); + break; + case 1572: + _field412 = 0; + _actor1.remove(); + R2_INVENTORY.setObjectScene(R2_23, 0); + R2_GLOBALS._player.enableControl(); + break; + case 1573: + _field412 = 0; + _actor1.remove(); + R2_INVENTORY.setObjectScene(R2_27, 0); + R2_GLOBALS._player.enableControl(); + break; + case 1574: + // No break on purpose + case 1582: + _field412 = 0; + _actor1.remove(); + R2_INVENTORY.setObjectScene(R2_17, 0); + R2_GLOBALS._player.enableControl(); + break; + case 1575: + // No break on purpose + case 1583: + _field412 = 0; + _actor1.remove(); + R2_INVENTORY.setObjectScene(R2_45, 0); + R2_GLOBALS._player.enableControl(); + break; + case 1576: + // No break on purpose + case 1584: + R2_GLOBALS._sceneManager.changeScene(1580); + R2_GLOBALS._player.enableControl(); + break; + case 1577: + // No break on purpose + case 1578: + _sceneMode = 0; + _actor1.remove(); + _field412 = 0; + R2_GLOBALS._player.fixPriority(-1); + R2_GLOBALS._player.enableControl(); + break; + case 1585: + SceneItem::display(1550, 66, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999); + R2_GLOBALS._player.enableControl(); + break; + case 1586: + // No break on purpose + case 1587: + R2_INVENTORY.setObjectScene(R2_28, R2_GLOBALS._player._characterIndex); + _actor1.remove(); + _field412 = 0; + R2_GLOBALS._player.enableControl(); + break; + case 1592: + _actor9.remove(); + R2_INVENTORY.setObjectScene(R2_26, 1); + if (R2_GLOBALS._player._characterIndex == 1) { + R2_GLOBALS._v565EC[2] = R2_GLOBALS._v565EC[1]; + R2_GLOBALS._v565EC[4] = R2_GLOBALS._v565EC[3]; + } else { + R2_GLOBALS._v565EC[1] = R2_GLOBALS._v565EC[2]; + R2_GLOBALS._v565EC[3] = R2_GLOBALS._v565EC[4]; + } + R2_GLOBALS._player.enableControl(); + break; + default: + _sceneMode = 62; + setAction(&_sequenceManager1, this, 1, &R2_GLOBALS._player, NULL); + break; + } +} + +void Scene1550::process(Event &event) { + if ((!R2_GLOBALS._player._canWalk) && (R2_GLOBALS._events.getCursor() == R2_NEGATOR_GUN) && (event.eventType == EVENT_BUTTON_DOWN) && (this->_screenNumber == 1234)) { + int curReg = R2_GLOBALS._sceneRegions.indexOf(event.mousePos); + if (curReg == 0) + _field412 = 1; + else if (((R2_GLOBALS._player._position.y < 90) && (event.mousePos.y > 90)) || ((R2_GLOBALS._player._position.y > 90) && (event.mousePos.y < 90))) + _field412 = 1; + else + _field412 = 0; + + if ((curReg == 13) || (curReg == 14)) + _field412 = 0; + } + + Scene::process(event); +} + +void Scene1550::dispatch() { + Scene::dispatch(); + + // Arrays related to this scene are all hacky in the origina: they are based on the impossibility to use Miranda + assert ((R2_GLOBALS._player._characterIndex == 1) || (R2_GLOBALS._player._characterIndex == 2)); + + if ((R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex] == 15) && (R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex + 2] == 16)) { + R2_GLOBALS._player._shade = 0; + // Original game contains a switch based on an uninitialised variable. + // Until we understand what should really happen there, this code is unused on purpose + int missingVariable = 0; + switch (missingVariable) { + case 144: + // No break on purpose + case 146: + _actor13._frame = 5; + R2_GLOBALS._player._shade = 3; + break; + case 148: + // No break on purpose + case 149: + _actor13._frame = 1; + // No break on purpose + case 147: + // No break on purpose + case 150: + R2_GLOBALS._player._shade = 3; + break; + default: + break; + } + } + + if (_field412 != 0) + return; + + switch (R2_GLOBALS._player.getRegionIndex() - 11) { + case 0: + // No break on purpose + case 5: + R2_GLOBALS._player.disableControl(); + _sceneMode = 1; + _field412 = 1; + --R2_GLOBALS._v565EC[2 + R2_GLOBALS._player._characterIndex]; + warning("subA2B2F();"); + R2_GLOBALS._player.setPosition(Common::Point( 160 - (((((160 - R2_GLOBALS._player._position.x) * 100) / 108) * 172) / 100), 145)); + if (R2_GLOBALS._player._position.x < 160) { + Common::Point pt(R2_GLOBALS._player._position.x + 5, 135); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } else if (R2_GLOBALS._player._position.x <= 160) { // the check is really in the original... + Common::Point pt(R2_GLOBALS._player._position.x, 135); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } else { + Common::Point pt(R2_GLOBALS._player._position.x - 5, 135); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 1: + R2_GLOBALS._player.disableControl(); + _sceneMode = 3; + _field412 = 1; + ++R2_GLOBALS._v565EC[2 + R2_GLOBALS._player._characterIndex]; + warning("subA2B2F();"); + R2_GLOBALS._player.setPosition(Common::Point( 160 - (((((160 - R2_GLOBALS._player._position.x) * 100) / 172) * 108) / 100), 19)); + if (R2_GLOBALS._player._position.x < 160) { + Common::Point pt(R2_GLOBALS._player._position.x + 5, 29); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } else if (R2_GLOBALS._player._position.x <= 160) { // the check is really in the original... + Common::Point pt(R2_GLOBALS._player._position.x, 29); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } else { + Common::Point pt(R2_GLOBALS._player._position.x - 5, 29); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 2: + R2_GLOBALS._player.disableControl(); + _sceneMode = 5; + _field412 = 1; + ++R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex]; + warning("subA2B2F();"); + if ((R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex] == 9) && (R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex + 2] == 11) && (R2_GLOBALS._player._position.y > 50) && (R2_GLOBALS._player._position.y < 135)) { + if (R2_GLOBALS._player._position.y >= 85) { + R2_GLOBALS._player.setPosition(Common::Point(320 - R2_GLOBALS._player._position.x, R2_GLOBALS._player._position.y + 10)); + Common::Point pt(R2_GLOBALS._player._position.x + 30, R2_GLOBALS._player._position.y + 20); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } else { + R2_GLOBALS._player.setPosition(Common::Point(320 - R2_GLOBALS._player._position.x, R2_GLOBALS._player._position.y - 10)); + Common::Point pt(R2_GLOBALS._player._position.x + 30, R2_GLOBALS._player._position.y - 20); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + } else { + R2_GLOBALS._player.setPosition(Common::Point(320 - R2_GLOBALS._player._position.x, R2_GLOBALS._player._position.y)); + Common::Point pt(R2_GLOBALS._player._position.x + 10, R2_GLOBALS._player._position.y); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + case 3: + R2_GLOBALS._player.disableControl(); + _sceneMode = 7; + _field412 = 1; + --R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex]; + if ((R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex] == 24) && (R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex + 2] == 11)) { + R2_GLOBALS._player.setPosition(Common::Point(320 - R2_GLOBALS._player._position.x, R2_GLOBALS._player._position.y / 2)); + Common::Point pt(265, 29); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } else if ((R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex] == 9) && (R2_GLOBALS._v565EC[R2_GLOBALS._player._characterIndex + 2] == 11) && (R2_GLOBALS._player._position.y > 50) && (R2_GLOBALS._player._position.y < 135)) { + if (R2_GLOBALS._player._position.y >= 85) { + R2_GLOBALS._player.setPosition(Common::Point(320 - R2_GLOBALS._player._position.x, R2_GLOBALS._player._position.y + 10)); + Common::Point pt(R2_GLOBALS._player._position.x - 30, R2_GLOBALS._player._position.y + 20); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } else { + R2_GLOBALS._player.setPosition(Common::Point(320 - R2_GLOBALS._player._position.x, R2_GLOBALS._player._position.y - 10)); + Common::Point pt(R2_GLOBALS._player._position.x - 30, R2_GLOBALS._player._position.y - 20); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + } else { + R2_GLOBALS._player.setPosition(Common::Point(320 - R2_GLOBALS._player._position.x, R2_GLOBALS._player._position.y)); + Common::Point pt(R2_GLOBALS._player._position.x - 10, R2_GLOBALS._player._position.y); + NpcMover *mover = new NpcMover(); + R2_GLOBALS._player.addMover(mover, &pt, this); + } + break; + default: + break; + } +} + +void Scene1550::saveCharacter(int characterIndex) { + if (R2_GLOBALS._player._characterIndex == 3) + R2_GLOBALS._sound1.fadeOut2(NULL); + + SceneExt::saveCharacter(characterIndex); +} } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.h b/engines/tsage/ringworld2/ringworld2_scenes1.h index ec05a83fff..6d2bd3b084 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.h +++ b/engines/tsage/ringworld2/ringworld2_scenes1.h @@ -59,15 +59,15 @@ public: class Scene1100 : public SceneExt { class Actor16 : public SceneActor { public: - bool startAction(CursorType action, Event &event); + virtual bool startAction(CursorType action, Event &event); }; class Actor17 : public SceneActor { public: - bool startAction(CursorType action, Event &event); + virtual bool startAction(CursorType action, Event &event); }; class Actor18 : public SceneActor { public: - bool startAction(CursorType action, Event &event); + virtual bool startAction(CursorType action, Event &event); }; public: @@ -123,7 +123,7 @@ class Scene1200 : public SceneExt { class Actor3 : public SceneActorExt { public: void init(int state); - bool startAction(CursorType action, Event &event); + virtual bool startAction(CursorType action, Event &event); }; SceneActor _actor2; @@ -160,6 +160,8 @@ class Scene1200 : public SceneExt { void synchronize(Serializer &s); int sub51AF8(Common::Point pt); + bool sub51AFD(Common::Point pt); + void sub9EDE8(Rect rect); virtual Common::String getClassName() { return "UnkObject1200"; } }; @@ -211,8 +213,8 @@ public: class Scene1530 : public SceneExt { public: - SpeakerQuinn1530 _quinnSpeaker; - SpeakerSeeker1530 _seekerSpeaker; + SpeakerQuinn _quinnSpeaker; + SpeakerSeeker _seekerSpeaker; SceneActor _actor1; SceneActor _actor2; SceneActor _actor3; @@ -223,6 +225,151 @@ public: virtual void signal(); virtual void dispatch(); }; + +class Scene1550 : public SceneExt { + class UnkObj15501 : public SceneActor { + public: + int _fieldA4; + int _fieldA6; + + UnkObj15501(); + void synchronize(Serializer &s); + + virtual bool startAction(CursorType action, Event &event); + }; + + class UnkObj15502 : public SceneActor { + public: + int _fieldA4; + + UnkObj15502(); + void synchronize(Serializer &s); + + virtual bool startAction(CursorType action, Event &event); + }; + + class UnkObj15503 : public SceneActor { + public: + int _fieldA4; + + UnkObj15503(); + void synchronize(Serializer &s); + + virtual bool startAction(CursorType action, Event &event); + }; + + class UnkArea1550 : public SceneArea { + public: + byte _field20; + SceneActor _areaActor; + UnkObj15503 _unkObj155031; + UnkObj15503 _unkObj155032; + + virtual void remove(); + virtual void proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY); + }; + + class Hotspot1 : public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + class Hotspot3 : public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + class Actor6 : public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + class Actor7 : public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + class Actor8 : public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + class Actor9 : public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + class Actor10 : public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + class Actor11 : public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + class Actor12 : public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + class Actor13 : public SceneActor { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + class Actor14 : public SceneActor { + // Nothing specific found in the original + // TODO: check if it's an useless class + }; + +public: + SpeakerQuinn _quinnSpeaker; + SpeakerSeeker _seekerSpeaker; + Hotspot1 _item1; + Hotspot1 _item2; + Hotspot3 _item3; + SceneActor _actor1; + SceneActor _actor2; + SceneActor _actor3; + SceneActor _actor4; + SceneActor _actor5; + Actor6 _actor6; + Actor7 _actor7; + Actor8 _actor8; + Actor9 _actor9; + Actor10 _actor10; + Actor11 _actor11; + Actor12 _actor12; + Actor13 _actor13; + UnkObj15501 _arrUnkObj15501[8]; + Actor14 _actor14; + Actor14 _actor15; + Actor14 _actor16; + Actor14 _actor17; + Actor14 _actor18; + Actor14 _actor19; + UnkObj15502 _arrUnkObj15502[8]; + UnkArea1550 _unkArea1; + SequenceManager _sequenceManager1; + SequenceManager _sequenceManager2; + + int _field412; + byte _field414; + int _field415; + int _field417; + int _field419; + + Scene1550(); + void synchronize(Serializer &s); + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); + virtual void process(Event &event); + virtual void dispatch(); + virtual void saveCharacter(int characterIndex); +}; } // 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 49ac9f555f..13c770a4a3 100644 --- a/engines/tsage/ringworld2/ringworld2_speakers.h +++ b/engines/tsage/ringworld2/ringworld2_speakers.h @@ -269,11 +269,6 @@ public: virtual void proc15(); }; -class SpeakerQuinn1530 : public SpeakerQuinn { -public: - virtual Common::String getClassName() { return "SpeakerQuinn1530"; } -}; - class SpeakerQuinn2435 : public SpeakerQuinn { public: virtual Common::String getClassName() { return "SpeakerQuinn2435"; } @@ -412,11 +407,6 @@ public: virtual void proc15(); }; -class SpeakerSeeker1530 : public SpeakerSeeker { -public: - virtual Common::String getClassName() { return "SpeakerSeeker1530"; } -}; - class SpeakerSeeker2435 : public SpeakerSeeker { public: virtual Common::String getClassName() { return "SpeakerSeeker2435"; } diff --git a/engines/tsage/staticres.cpp b/engines/tsage/staticres.cpp index cc93c4f35f..1251b6d262 100644 --- a/engines/tsage/staticres.cpp +++ b/engines/tsage/staticres.cpp @@ -237,6 +237,29 @@ char const *const F7 = "F7"; char const *const F8 = "F8"; char const *const F10 = "F10"; +const byte _v5A4D6[] = { + 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, + 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, + 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, + 7, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, + 6, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, + 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, + 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, + 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, + 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, + 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, + 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, + 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, + 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, + 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, + 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, + 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, + 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, + 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, + 13, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 14 +}; + } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/staticres.h b/engines/tsage/staticres.h index 5b6f4393c4..ae2aa28aeb 100644 --- a/engines/tsage/staticres.h +++ b/engines/tsage/staticres.h @@ -190,6 +190,9 @@ extern char const *const F7; extern char const *const F8; extern char const *const F10; +// Scene 1550 map +extern const byte _v5A4D6[]; + } // End of namespace Ringworld2 } // End of namespace TsAGE @@ -110,7 +110,7 @@ OSX_STATIC_LIBS += $(STATICLIBPATH)/lib/libfaad.a endif ifdef USE_ZLIB -OSX_ZLIB ?= -lz +OSX_ZLIB ?= $(STATICLIBPATH)/lib/libz.a endif ifdef USE_SPARKLE @@ -165,10 +165,10 @@ osxsnap: bundle mkdir ScummVM-snapshot/doc/it cp $(srcdir)/doc/it/GuidaRapida ./ScummVM-snapshot/doc/it/GuidaRapida mkdir ScummVM-snapshot/doc/no-nb - cp $(srcdir)doc/no-nb/HurtigStart ./ScummVM-snapshot/doc/no-nb/HurtigStart + cp $(srcdir)/doc/no-nb/HurtigStart ./ScummVM-snapshot/doc/no-nb/HurtigStart mkdir ScummVM-snapshot/doc/se - cp $(srcdir)doc/se/LasMig ./ScummVM-snapshot/doc/se/LasMig - cp $(srcdir)doc/se/Snabbstart ./ScummVM-snapshot/doc/se/Snabbstart + cp $(srcdir)/doc/se/LasMig ./ScummVM-snapshot/doc/se/LasMig + cp $(srcdir)/doc/se/Snabbstart ./ScummVM-snapshot/doc/se/Snabbstart /Developer/Tools/SetFile -t ttro -c ttxt ./ScummVM-snapshot/* xattr -w "com.apple.TextEncoding" "utf-8;134217984" ./ScummVM-snapshot/doc/cz/* xattr -w "com.apple.TextEncoding" "utf-8;134217984" ./ScummVM-snapshot/doc/de/* |