diff options
28 files changed, 420 insertions, 62 deletions
diff --git a/audio/mixer.cpp b/audio/mixer.cpp index 0620d07a29..16cf5640eb 100644 --- a/audio/mixer.cpp +++ b/audio/mixer.cpp @@ -333,7 +333,7 @@ void MixerImpl::stopHandle(SoundHandle handle) { } void MixerImpl::muteSoundType(SoundType type, bool mute) { - assert(0 <= type && type < ARRAYSIZE(_soundTypeSettings)); + assert(0 <= (int)type && (int)type < ARRAYSIZE(_soundTypeSettings)); _soundTypeSettings[type].mute = mute; for (int i = 0; i != NUM_CHANNELS; ++i) { @@ -343,7 +343,7 @@ void MixerImpl::muteSoundType(SoundType type, bool mute) { } bool MixerImpl::isSoundTypeMuted(SoundType type) const { - assert(0 <= type && type < ARRAYSIZE(_soundTypeSettings)); + assert(0 <= (int)type && (int)type < ARRAYSIZE(_soundTypeSettings)); return _soundTypeSettings[type].mute; } @@ -468,7 +468,7 @@ bool MixerImpl::hasActiveChannelOfType(SoundType type) { } void MixerImpl::setVolumeForSoundType(SoundType type, int volume) { - assert(0 <= type && type < ARRAYSIZE(_soundTypeSettings)); + assert(0 <= (int)type && (int)type < ARRAYSIZE(_soundTypeSettings)); // Check range if (volume > kMaxMixerVolume) @@ -489,7 +489,7 @@ void MixerImpl::setVolumeForSoundType(SoundType type, int volume) { } int MixerImpl::getVolumeForSoundType(SoundType type) const { - assert(0 <= type && type < ARRAYSIZE(_soundTypeSettings)); + assert(0 <= (int)type && (int)type < ARRAYSIZE(_soundTypeSettings)); return _soundTypeSettings[type].volume; } diff --git a/backends/platform/wii/osystem_gfx.cpp b/backends/platform/wii/osystem_gfx.cpp index 001cfea31e..bb91242f98 100644 --- a/backends/platform/wii/osystem_gfx.cpp +++ b/backends/platform/wii/osystem_gfx.cpp @@ -717,8 +717,8 @@ void OSystem_Wii::setMouseCursor(const void *buf, uint w, uint h, int hotspotX, u16 *d = (u16 *) tmp; for (u16 y = 0; y < h; ++y) { for (u16 x = 0; x < w; ++x) { - if (*s++ != _mouseKeyColor) - *d++ |= 7 << 12; + if (*s++ == _mouseKeyColor) + *d++ &= ~(7 << 12); else d++; } diff --git a/common/zlib.cpp b/common/zlib.cpp index 448e1eadd5..c22ea1e660 100644 --- a/common/zlib.cpp +++ b/common/zlib.cpp @@ -27,6 +27,7 @@ #include "common/ptr.h" #include "common/util.h" #include "common/stream.h" +#include "common/debug.h" #include "common/textconsole.h" #if defined(USE_ZLIB) @@ -140,6 +141,10 @@ bool inflateZlibInstallShield(byte *dst, uint dstLen, const byte *src, uint srcL return true; } +#ifndef RELEASE_BUILD +static bool _shownBackwardSeekingWarning = false; +#endif + /** * A simple wrapper class which can be used to wrap around an arbitrary * other SeekableReadStream and will then provide on-the-fly decompression support. @@ -159,11 +164,10 @@ protected: uint32 _pos; uint32 _origSize; bool _eos; - bool _shownBackwardSeekingWarning; public: - GZipReadStream(SeekableReadStream *w, uint32 knownSize = 0) : _wrapped(w), _stream(), _shownBackwardSeekingWarning(false) { + GZipReadStream(SeekableReadStream *w, uint32 knownSize = 0) : _wrapped(w), _stream() { assert(w != 0); // Verify file header is correct @@ -263,13 +267,15 @@ public: // from the start of the file. A rather wasteful operation, best // to avoid it. :/ +#ifndef RELEASE_BUILD if (!_shownBackwardSeekingWarning) { // We only throw this warning once per stream, to avoid // getting the console swarmed with warnings when consecutive // seeks are made. - warning("Backward seeking in GZipReadStream detected"); + debug(1, "Backward seeking in GZipReadStream detected"); _shownBackwardSeekingWarning = true; } +#endif _pos = 0; _wrapped->seek(0, SEEK_SET); diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp index dc1c277877..b7b03e86dc 100644 --- a/engines/avalanche/dialogs.cpp +++ b/engines/avalanche/dialogs.cpp @@ -363,6 +363,7 @@ void Dialogs::scrollModeMusic() { value = 11; break; default: + error("cannot happen"); break; } diff --git a/engines/cruise/font.cpp b/engines/cruise/font.cpp index c63be30f77..80fb0e8a02 100644 --- a/engines/cruise/font.cpp +++ b/engines/cruise/font.cpp @@ -148,8 +148,6 @@ void initSystem() { preloadData[i].nofree = 0; } - lowMemory = 0; - doFade = 0; fadeFlag = 0; scroll = 0; diff --git a/engines/cruise/function.cpp b/engines/cruise/function.cpp index e727ac73cb..7af6b73238 100644 --- a/engines/cruise/function.cpp +++ b/engines/cruise/function.cpp @@ -606,7 +606,7 @@ int16 Op_InitializeState() { } int16 Op_GetlowMemory() { - return lowMemory; + return 0; } int16 Op_AniDir() { diff --git a/engines/cruise/saveload.cpp b/engines/cruise/saveload.cpp index a991c29583..a734db4b3b 100644 --- a/engines/cruise/saveload.cpp +++ b/engines/cruise/saveload.cpp @@ -182,11 +182,13 @@ static void syncFilesDatabase(Common::Serializer &s) { s.syncAsUint16LE(fe.resType); s.syncAsUint16LE(fe.height); - // TODO: Have a look at the saving/loading of this pointer + // Remember whether this file database was open or not. + // Upon loading, loadSavegameData uses this information + // in order to re-open the file databases accordingly. tmp = (fe.subData.ptr) ? 1 : 0; s.syncAsUint32LE(tmp); if (s.isLoading()) { - fe.subData.ptr = (uint8 *)tmp; + fe.subData.ptr = tmp ? (uint8 *)1 : 0; } s.syncAsSint16LE(fe.subData.index); @@ -195,11 +197,11 @@ static void syncFilesDatabase(Common::Serializer &s) { s.syncAsSint16LE(fe.subData.transparency); - // TODO: Have a look at the saving/loading of this pointer + // Treat fe.subData.ptrMask the same as fe.subData.ptr. tmp = (fe.subData.ptrMask) ? 1 : 0; s.syncAsUint32LE(tmp); if (s.isLoading()) { - fe.subData.ptrMask = (uint8 *)tmp; + fe.subData.ptrMask = tmp ? (uint8 *)1 : 0; } s.syncAsUint16LE(fe.subData.resourceType); @@ -806,7 +808,6 @@ Common::Error saveSavegameData(int saveGameIdx, const Common::String &saveName) } Common::Error loadSavegameData(int saveGameIdx) { - int lowMemorySave; Common::String saveName; cellStruct *currentcellHead; @@ -878,20 +879,19 @@ Common::Error loadSavegameData(int saveGameIdx) { lastAni[0] = 0; - lowMemorySave = lowMemory; - for (int i = 0; i < NUM_FILE_ENTRIES; i++) { if (filesDatabase[i].subData.ptr) { int j; int k; - for (j = i + 1; j < NUM_FILE_ENTRIES && filesDatabase[j].subData.ptr && !strcmp(filesDatabase[i].subData.name, filesDatabase[j].subData.name) && (filesDatabase[j].subData.index == (j - i)); j++) + for (j = i + 1; j < NUM_FILE_ENTRIES && + filesDatabase[j].subData.ptr && + !strcmp(filesDatabase[i].subData.name, filesDatabase[j].subData.name) && + (filesDatabase[j].subData.index == (j - i)); + j++) ; for (k = i; k < j; k++) { - if (filesDatabase[k].subData.ptrMask) - lowMemory = 0; - filesDatabase[k].subData.ptr = NULL; filesDatabase[k].subData.ptrMask = NULL; } @@ -908,7 +908,6 @@ Common::Error loadSavegameData(int saveGameIdx) { } i = j - 1; - lowMemory = lowMemorySave; } } diff --git a/engines/cruise/vars.cpp b/engines/cruise/vars.cpp index f7c74c8e6d..9a59c8a714 100644 --- a/engines/cruise/vars.cpp +++ b/engines/cruise/vars.cpp @@ -31,7 +31,6 @@ uint8 selectColor = 3; uint8 titleColor = 2; uint8 subColor = 5; -int16 lowMemory; int16 scroll; int16 switchPal; char cmdLine[90]; diff --git a/engines/cruise/vars.h b/engines/cruise/vars.h index 8bfcdc57d4..fe3f7d6303 100644 --- a/engines/cruise/vars.h +++ b/engines/cruise/vars.h @@ -59,7 +59,6 @@ extern uint8 selectColor; extern uint8 titleColor; extern uint8 subColor; -extern int16 lowMemory; extern int16 scroll; extern int16 switchPal; extern char cmdLine[90]; diff --git a/engines/fullpipe/constants.h b/engines/fullpipe/constants.h index 6dc368599b..59c4ded125 100644 --- a/engines/fullpipe/constants.h +++ b/engines/fullpipe/constants.h @@ -1295,14 +1295,24 @@ namespace Fullpipe { #define MSG_SC29_STOPRIDE 2107 #define MV_ASS_HITGREEN 2138 #define MV_ASS_HITRED 2139 +#define MV_BRDCMN_GOR 4735 #define MV_MAN29_BEND 2091 +#define MV_MAN29_HIT 2088 #define MV_MAN29_JUMP 2090 #define MV_MAN29_RUN 2095 #define MV_MAN29_STANDUP 2092 +#define MV_MAN29_STANDUP_NORM 2093 #define MV_PTR_MOVEFAST 2102 #define MV_SHG_HITASS 2151 #define MV_SHR_HITASS 2152 +#define MV_STR1_SHOOT 2109 +#define MV_STR2_SHOOT 2112 #define PIC_SC29_LTRUBA 2081 +#define QU_SC29_BRD1 4741 +#define QU_SC29_BRD2 4742 +#define QU_SC29_BRDOUT1 4743 +#define QU_SC29_BRDOUT2 4744 +#define QU_SC29_ESCAPE 2129 #define QU_SC29_MANFROM_L 2101 #define QU_SC29_MANFROM_R 2104 #define QU_SC29_MANTO_L 2103 @@ -1310,7 +1320,14 @@ namespace Fullpipe { #define SND_29_028 4758 #define SND_29_029 4759 #define ST_ASS_NORM 2122 +#define ST_BRDCMN_GOR 4734 +#define ST_BRDCMN_RIGHT 4732 #define ST_MAN29_RUNR 2140 +#define ST_MAN29_SITR 2141 +#define ST_STR1_RIGHT 2143 +#define ST_STR2_RIGHT 2144 +#define ST_STR1_STAND 2110 +#define ST_STR2_STAND 2113 // Scene 30 #define ANI_LEG 2322 diff --git a/engines/fullpipe/scenes/scene29.cpp b/engines/fullpipe/scenes/scene29.cpp index 5d885a5af1..3fe1cac4e7 100644 --- a/engines/fullpipe/scenes/scene29.cpp +++ b/engines/fullpipe/scenes/scene29.cpp @@ -183,10 +183,6 @@ void sceneHandler29_shootRed() { warning("STUB: sceneHandler29_shootRed()"); } -void sceneHandler29_clickPorter(ExCommand *cmd) { - warning("STUB: sceneHandler29_clickPorter()"); -} - void sceneHandler29_manJump() { if (!g_fp->_aniMan->_movement || g_fp->_aniMan->_movement->_id == MV_MAN29_RUN || g_fp->_aniMan->_movement->_id == MV_MAN29_STANDUP) { g_vars->scene29_var12 = 0; @@ -215,6 +211,109 @@ void sceneHandler29_manBend() { g_vars->scene29_var21 = g_fp->_aniMan->_oy; } +bool sceneHandler29_sub15(StaticANIObject *ani, int maxx) { + if (!g_vars->scene29_var10 || g_vars->scene29_var15) + return false; + + if ((ani->_ox >= g_vars->scene29_var20 + 42 || ani->_ox <= g_vars->scene29_var20 + 8) + && (ani->_ox < g_vars->scene29_var20 + 8 || maxx > g_vars->scene29_var20 + 27)) + return false; + + if (!g_fp->_aniMan->_movement) + return true; + + int phase = g_fp->_aniMan->_movement->_currDynamicPhaseIndex; + + if (g_fp->_aniMan->_movement->_id != MV_MAN29_BEND && g_fp->_aniMan->_movement->_id != MV_MAN29_RUN + && (g_fp->_aniMan->_movement->_id != MV_MAN29_JUMP || (phase >= 3 && phase <= 6))) + return false; + else + return true; +} + +bool sceneHandler29_sub16(StaticANIObject *ani, int maxx) { + if (!g_vars->scene29_var10 || g_vars->scene29_var15) + return false; + + if (ani->_ox >= g_vars->scene29_var20 + 40) { + if (maxx > g_vars->scene29_var20 + 27) + return false; + } else { + if (ani->_ox <= g_vars->scene29_var20 + 10) { + if (ani->_ox < g_vars->scene29_var20 + 40) + return false; + + if (maxx > g_vars->scene29_var20 + 27) + return false; + } + } + + if (!g_fp->_aniMan->_movement) + return true; + + if (g_fp->_aniMan->_movement->_id == MV_MAN29_JUMP) + return true; + + if (g_fp->_aniMan->_movement->_id == MV_MAN29_RUN) + return true; + + if (g_fp->_aniMan->_movement->_id == MV_MAN29_BEND) { + if (g_fp->_aniMan->_movement->_currDynamicPhaseIndex < 1 || g_fp->_aniMan->_movement->_currDynamicPhaseIndex > 5) + return true; + } + + return false; +} + +void sceneHandler29_manHit() { + MGMInfo mgminfo; + + g_vars->scene29_var15 = 1; + + g_fp->_aniMan->changeStatics2(ST_MAN29_RUNR); + g_fp->_aniMan->setOXY(g_vars->scene29_var20, g_vars->scene29_var21); + + mgminfo.ani = g_fp->_aniMan; + mgminfo.staticsId2 = ST_MAN29_SITR; + mgminfo.y1 = 463; + mgminfo.x1 = g_vars->scene29_var20 <= 638 ? 351 : 0; + mgminfo.field_1C = 10; + mgminfo.field_10 = 1; + mgminfo.flags = (g_vars->scene29_var20 <= 638 ? 2 : 0) | 0x44; + mgminfo.movementId = MV_MAN29_HIT; + + MessageQueue *mq = g_vars->scene29_mgm.genMovement(&mgminfo); + ExCommand *ex; + + if (mq) { + if (g_vars->scene29_var20 <= 638) { + ex = new ExCommand(ANI_MAN, 1, MV_MAN29_STANDUP_NORM, 0, 0, 0, 1, 0, 0, 0); + ex->_excFlags = 2; + ex->_keyCode = g_fp->_aniMan->_okeyCode; + mq->addExCommandToEnd(ex); + + ex = new ExCommand(0, 17, MSG_SC29_STOPRIDE, 0, 0, 0, 1, 0, 0, 0); + ex->_excFlags = 2; + mq->addExCommandToEnd(ex); + + g_vars->scene29_var09 = 0; + g_vars->scene29_var10 = 0; + g_vars->scene29_var11 = 0; + g_vars->scene29_var12 = 0; + } else { + ex = new ExCommand(ANI_MAN, 1, MV_MAN29_STANDUP, 0, 0, 0, 1, 0, 0, 0); + ex->_excFlags = 2; + ex->_keyCode = g_fp->_aniMan->_okeyCode; + mq->addExCommandToEnd(ex); + } + + mq->setFlags(mq->getFlags() | 1); + + if (!mq->chain(g_fp->_aniMan)) + delete mq; + } +} + void sceneHandler29_sub03() { warning("STUB: sceneHandler29_sub03()"); } @@ -286,16 +385,84 @@ void sceneHandler29_manToR() { g_fp->_scrollSpeed = 4; } +void sceneHandler29_clickPorter(ExCommand *cmd) { + if (!g_fp->_aniMan->isIdle() || g_fp->_aniMan->_flags & 0x100) { + cmd->_messageKind = 0; + + return; + } + + if (g_vars->scene29_var20 <= g_vars->scene29_porter->_ox) { + if (ABS(351 - g_vars->scene29_var20) > 1 || ABS(443 - g_vars->scene29_var21) > 1 + || g_fp->_aniMan->_movement || g_fp->_aniMan->_statics->_staticsId != ST_MAN_RIGHT) { + if (g_fp->_msgX != 351 || g_fp->_msgY != 443) { + MessageQueue *mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, 351, 443, 1, ST_MAN_RIGHT); + + if (mq) { + mq->addExCommandToEnd(cmd->createClone()); + + postExCommand(g_fp->_aniMan->_id, 2, 351, 443, 0, -1); + } + } + } else { + sceneHandler29_manToL(); + } + } else { + g_vars->scene29_var20 = g_fp->_aniMan->_ox; + g_vars->scene29_var21 = g_fp->_aniMan->_oy; + + if (ABS(1582 - g_vars->scene29_var20) > 1 || ABS(445 - g_fp->_aniMan->_oy) > 1 + || g_fp->_aniMan->_movement || g_fp->_aniMan->_statics->_staticsId != (0x4000 | ST_MAN_RIGHT)) { + if (g_fp->_msgX != 1582 || g_fp->_msgY != 445) { + MessageQueue *mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, 1582, 445, 1, (0x4000 | ST_MAN_RIGHT)); + + if (mq) { + mq->addExCommandToEnd(cmd->createClone()); + + postExCommand(g_fp->_aniMan->_id, 2, 1582, 445, 0, -1); + } + } + } else { + sceneHandler29_manToR(); + } + } +} + void sceneHandler29_sub05() { warning("STUB: sceneHandler29_sub05()"); } void sceneHandler29_shootersEscape() { - warning("STUB: sceneHandler29_shootersEscape()"); + if (g_vars->scene29_var10) { + g_vars->scene29_var20 += 2; + + g_fp->_aniMan->setOXY(g_vars->scene29_var20, g_vars->scene29_var21); + + if (g_vars->scene29_var20 > 1310 && !g_vars->scene29_shooter1->_movement && !g_vars->scene29_shooter2->_movement + && g_vars->scene29_shooter1->_statics->_staticsId == ST_STR1_RIGHT) { + g_vars->scene29_var13 = 0; + + g_vars->scene29_shooter1->changeStatics2(ST_STR1_STAND); + g_vars->scene29_shooter2->changeStatics2(ST_STR2_STAND); + + chainQueue(QU_SC29_ESCAPE, 1); + + g_vars->scene29_ass->queueMessageQueue(0); + g_vars->scene29_ass->hide(); + + g_fp->setObjectState(sO_LeftPipe_29, g_fp->getObjectEnumState(sO_LeftPipe_29, sO_IsOpened)); + } + } else if (g_vars->scene29_var09) { + g_vars->scene29_var20 -= 4; + + g_fp->_aniMan->setOXY(g_vars->scene29_var20, g_vars->scene29_var21); + } } void sceneHandler29_sub07() { - warning("STUB: sceneHandler29_sub07()"); + g_vars->scene29_var20 -= 2; + + g_fp->_aniMan->setOXY(g_vars->scene29_var20, g_vars->scene29_var21); } void sceneHandler29_assHitGreen() { @@ -313,11 +480,109 @@ void sceneHandler29_assHitRed() { } void sceneHandler29_shoot() { - warning("STUB: sceneHandler29_shoot()"); + if (g_vars->scene29_var10 && g_vars->scene29_var20 < 1310) { + if (g_fp->_rnd->getRandomNumber(1) || g_vars->scene29_shooter1->_movement || g_vars->scene29_shooter1->_statics->_staticsId != ST_STR1_RIGHT) { + if (!g_vars->scene29_shooter2->_movement && g_vars->scene29_shooter2->_statics->_staticsId == ST_STR2_RIGHT) { + if (g_vars->scene29_shooter2->_flags & 4) { + g_vars->scene29_shooter2->startAnim(MV_STR2_SHOOT, 0, -1); + + g_vars->scene29_var13 = 0; + } + } + } else { + g_vars->scene29_shooter1->startAnim(MV_STR1_SHOOT, 0, -1); + + g_vars->scene29_var13 = 0; + } + } } void sceneHandler29_animBearded() { - warning("STUB: sceneHandler29_animBearded()"); + MessageQueue *mq; + + for (uint i = 0; i < g_vars->scene29_var19.size(); i++) { + StaticANIObject *ani = g_vars->scene29_var19[i]->ani; + + if (g_vars->scene29_var19[i]->wbflag) { + int x = ani->_ox; + int y = ani->_oy; + + if (!ani->_movement && ani->_statics->_staticsId == (ST_BRDCMN_RIGHT | 0x4000)) { + x -= 4; + + if (x - g_vars->scene29_var20 < 100 || !g_vars->scene29_var10) { + mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC29_BRDOUT1), 0, 1); + + mq->replaceKeyCode(-1, ani->_okeyCode); + mq->chain(0); + + g_vars->scene29_var19[i]->wbflag = 0; + g_vars->scene29_var19[i]->wbcounter = 0; + } + } + + if (!ani->_movement && ani->_statics->_staticsId == ST_BRDCMN_GOR) + ani->startAnim(MV_BRDCMN_GOR, 0, -1); + + if (ani->_movement) { + if (ani->_movement->_id == MV_BRDCMN_GOR) { + x -= 4; + + if (g_vars->scene29_var20 - x < 60 || x - g_vars->scene29_var20 < -260 || !g_vars->scene29_var10) { + ani->changeStatics2(ST_BRDCMN_RIGHT); + + mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC29_BRDOUT2), 0, 1); + + mq->replaceKeyCode(-1, ani->_okeyCode); + mq->chain(0); + + g_vars->scene29_var19[i]->wbflag = 0; + g_vars->scene29_var19[i]->wbcounter = 0; + } + } + } + + ani->setOXY(x, y); + continue; + } + + if (g_vars->scene29_var10 && g_vars->scene29_var19[i]->wbcounter > 30) { + int newx; + + if (g_fp->_rnd->getRandomNumber(1)) + goto dostuff; + + if (g_vars->scene29_var20 <= 700) { + g_vars->scene29_var19[i]->wbcounter++; + continue; + } + + if (g_vars->scene29_var20 >= 1100) { + dostuff: + if (g_vars->scene29_var20 <= 700 || g_vars->scene29_var20 >= 1350) { + g_vars->scene29_var19[i]->wbcounter++; + continue; + } + + mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC29_BRD2), 0, 1); + + newx = g_vars->scene29_var20 - 200; + } else { + mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC29_BRD1), 0, 1); + + newx = g_vars->scene29_var20 + 350; + } + + mq->getExCommandByIndex(0)->_x = newx; + mq->replaceKeyCode(-1, ani->_okeyCode); + mq->chain(0); + + g_vars->scene29_var19[i]->wbflag = 1; + g_vars->scene29_var19[i]->wbcounter = 0; + } + + g_vars->scene29_var19[i]->wbcounter++; + } } diff --git a/engines/groovie/roq.cpp b/engines/groovie/roq.cpp index cbaa992596..2776a0455d 100644 --- a/engines/groovie/roq.cpp +++ b/engines/groovie/roq.cpp @@ -43,8 +43,9 @@ namespace Groovie { -ROQPlayer::ROQPlayer(GroovieEngine *vm) : VideoPlayer(vm), _codingTypeCount(0), _bg(&_vm->_graphicsMan->_background) { - // _fg = &_vm->_graphicsMan->_foreground; +ROQPlayer::ROQPlayer(GroovieEngine *vm) : + VideoPlayer(vm), _codingTypeCount(0), + _bg(&_vm->_graphicsMan->_background) { // Create the work surfaces _currBuf = new Graphics::Surface(); diff --git a/engines/groovie/roq.h b/engines/groovie/roq.h index b5e63c2b4a..cd5e91c82b 100644 --- a/engines/groovie/roq.h +++ b/engines/groovie/roq.h @@ -75,7 +75,6 @@ private: byte _codebook4[256 * 4]; // Buffers - // Graphics::Surface *_fg, *_thirdBuf; Graphics::Surface *_bg; Graphics::Surface *_currBuf, *_prevBuf; void buildShowBuf(); diff --git a/engines/lastexpress/data/animation.cpp b/engines/lastexpress/data/animation.cpp index 9c8cc202aa..148854e04d 100644 --- a/engines/lastexpress/data/animation.cpp +++ b/engines/lastexpress/data/animation.cpp @@ -39,7 +39,7 @@ namespace LastExpress { -Animation::Animation() : _stream(NULL), _currentChunk(NULL), _overlay(NULL), _background1(NULL), _background2(NULL), _backgroundCurrent(0), _audio(NULL), _startTime(0), _changed(false), _flag(0) { +Animation::Animation() : _stream(NULL), _currentChunk(NULL), _overlay(NULL), _background1(NULL), _background2(NULL), _backgroundCurrent(0), _audio(NULL), _startTime(0), _changed(false) { } Animation::~Animation() { diff --git a/engines/lastexpress/data/animation.h b/engines/lastexpress/data/animation.h index 7f6922866a..9523cddb78 100644 --- a/engines/lastexpress/data/animation.h +++ b/engines/lastexpress/data/animation.h @@ -113,7 +113,6 @@ private: uint32 _startTime; bool _changed; - int _flag; }; } // End of namespace LastExpress diff --git a/engines/lastexpress/data/sequence.cpp b/engines/lastexpress/data/sequence.cpp index c7073b560c..f43e2afdef 100644 --- a/engines/lastexpress/data/sequence.cpp +++ b/engines/lastexpress/data/sequence.cpp @@ -76,7 +76,7 @@ void FrameInfo::read(Common::SeekableReadStream *in, bool isSequence) { // AnimFrame -AnimFrame::AnimFrame(Common::SeekableReadStream *in, const FrameInfo &f, bool ignoreSubtype) : _palette(NULL), _ignoreSubtype(ignoreSubtype) { +AnimFrame::AnimFrame(Common::SeekableReadStream *in, const FrameInfo &f, bool /* ignoreSubtype */) : _palette(NULL) { _palSize = 1; // TODO: use just the needed rectangle _image.create(640, 480, Graphics::PixelFormat::createFormatCLUT8()); diff --git a/engines/lastexpress/data/sequence.h b/engines/lastexpress/data/sequence.h index dbb08a0c07..fd8b3cd27b 100644 --- a/engines/lastexpress/data/sequence.h +++ b/engines/lastexpress/data/sequence.h @@ -147,7 +147,6 @@ private: uint16 _palSize; uint16 *_palette; Common::Rect _rect; - bool _ignoreSubtype; }; class Sequence { diff --git a/engines/parallaction/saveload.h b/engines/parallaction/saveload.h index dbbbb42066..c9b724e69d 100644 --- a/engines/parallaction/saveload.h +++ b/engines/parallaction/saveload.h @@ -71,12 +71,12 @@ public: }; class SaveLoad_br : public SaveLoad { - Parallaction_br *_vm; +// Parallaction_br *_vm; virtual void doLoadGame(uint16 slot); virtual void doSaveGame(uint16 slot, const char* name); public: - SaveLoad_br(Parallaction_br *vm, Common::SaveFileManager *saveFileMan) : SaveLoad(saveFileMan, "bra"), _vm(vm) { } + SaveLoad_br(Parallaction_br *vm, Common::SaveFileManager *saveFileMan) : SaveLoad(saveFileMan, "bra") { } virtual void getGamePartProgress(bool *complete, int size); virtual void setPartComplete(const char *part); diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp index 29e29722d2..65acdbcdf5 100644 --- a/engines/sci/engine/kfile.cpp +++ b/engines/sci/engine/kfile.cpp @@ -37,6 +37,7 @@ #include "sci/engine/state.h" #include "sci/engine/kernel.h" #include "sci/engine/savegame.h" +#include "sci/sound/audio.h" #include "sci/console.h" namespace Sci { @@ -494,6 +495,21 @@ reg_t kFileIOWriteString(EngineState *s, int argc, reg_t *argv) { Common::String str = s->_segMan->getString(argv[1]); debugC(kDebugLevelFile, "kFileIO(writeString): %d", handle); + // Handle sciAudio calls in fanmade games here. sciAudio is an + // external .NET library for playing MP3 files in fanmade games. + // It runs in the background, and obtains sound commands from the + // currently running game via text files (called "conductor files"). + // We skip creating these files, and instead handle the calls + // directly. Since the sciAudio calls are only creating text files, + // this is probably the most straightforward place to handle them. + if (handle == 0xFFFF && str.hasPrefix("(sciAudio")) { + Common::List<ExecStack>::const_iterator iter = s->_executionStack.reverse_begin(); + iter--; // sciAudio + iter--; // sciAudio child + g_sci->_audio->handleFanmadeSciAudio(iter->sendp, s->_segMan); + return NULL_REG; + } + #ifdef ENABLE_SCI32 if (handle == VIRTUALFILE_HANDLE) { s->_virtualIndexFile->write(str.c_str(), str.size()); diff --git a/engines/sci/sound/audio.cpp b/engines/sci/sound/audio.cpp index 3147fbda09..8e35d6b055 100644 --- a/engines/sci/sound/audio.cpp +++ b/engines/sci/sound/audio.cpp @@ -61,6 +61,62 @@ void AudioPlayer::stopAllAudio() { audioCdStop(); } +/** + * Handles the sciAudio calls in fanmade games. + * sciAudio is an external .NET library for playing MP3 files in fanmade games. + * It runs in the background, and obtains sound commands from the + * currently running game via text files (called "conductor files"). + * For further info, check: http://sciprogramming.com/community/index.php?topic=634.0 + */ +void AudioPlayer::handleFanmadeSciAudio(reg_t sciAudioObject, SegManager *segMan) { + // TODO: This is a bare bones implementation. Only the play/playx and stop commands + // are handled for now - the other commands haven't been observed in any fanmade game + // yet. All the volume related and fading functionality is currently missing. + + Kernel *kernel = g_sci->getKernel(); + + reg_t commandReg = readSelector(segMan, sciAudioObject, kernel->findSelector("command")); + Common::String command = segMan->getString(commandReg); + + if (command == "play" || command == "playx") { +#ifdef USE_MAD + reg_t fileNameReg = readSelector(segMan, sciAudioObject, kernel->findSelector("fileName")); + Common::String fileName = segMan->getString(fileNameReg); + + int16 loopCount = (int16)readSelectorValue(segMan, sciAudioObject, kernel->findSelector("loopCount")); + // When loopCount is -1, we treat it as infinite looping, else no looping is done. + // This is observed by game scripts, which can set loopCount to all sorts of random values. + // Adjust loopCount for ScummVM's LoopingAudioStream semantics + loopCount = (loopCount == -1) ? 0 : 1; + + // Determine sound type + Audio::Mixer::SoundType soundType = Audio::Mixer::kSFXSoundType; + if (fileName.hasPrefix("music")) + soundType = Audio::Mixer::kMusicSoundType; + else if (fileName.hasPrefix("speech")) + soundType = Audio::Mixer::kSpeechSoundType; + + Common::File *sciAudio = new Common::File(); + // Replace backwards slashes + for (uint i = 0; i < fileName.size(); i++) { + if (fileName[i] == '\\') + fileName.setChar('/', i); + } + sciAudio->open("sciAudio/" + fileName); + + Audio::SeekableAudioStream *audioStream = Audio::makeMP3Stream(sciAudio, DisposeAfterUse::YES); + + // We only support one audio handle + _mixer->playStream(soundType, &_audioHandle, + Audio::makeLoopingAudioStream((Audio::RewindableAudioStream *)audioStream, loopCount)); +#endif + } else if (command == "stop") { + _mixer->stopHandle(_audioHandle); + } else { + warning("Unhandled sciAudio command: %s", command.c_str()); + } +} + int AudioPlayer::startAudio(uint16 module, uint32 number) { int sampleLen; Audio::AudioStream *audioStream = getAudioStream(number, module, &sampleLen); diff --git a/engines/sci/sound/audio.h b/engines/sci/sound/audio.h index 545d35b2ee..9e65d6e0c8 100644 --- a/engines/sci/sound/audio.h +++ b/engines/sci/sound/audio.h @@ -75,6 +75,8 @@ public: void pauseAudio(); void resumeAudio(); + void handleFanmadeSciAudio(reg_t sciAudioObject, SegManager *segMan); + void setSoundSync(ResourceId id, reg_t syncObjAddr, SegManager *segMan); void doSoundSync(reg_t syncObjAddr, SegManager *segMan); void stopSoundSync(); diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp index bb1a7ffaf1..1d1b6b4f13 100644 --- a/engines/scumm/gfx.cpp +++ b/engines/scumm/gfx.cpp @@ -380,7 +380,7 @@ void ScummEngine::initVirtScreen(VirtScreenNumber slot, int top, int width, int int size; assert(height >= 0); - assert(slot >= 0 && slot < 4); + assert((int)slot >= 0 && (int)slot < 4); if (_game.version >= 7) { if (slot == kMainVirtScreen && (_roomHeight != 0)) diff --git a/engines/scumm/saveload.cpp b/engines/scumm/saveload.cpp index 8d278f6ddf..0aaff4c094 100644 --- a/engines/scumm/saveload.cpp +++ b/engines/scumm/saveload.cpp @@ -1242,7 +1242,9 @@ void ScummEngine::saveOrLoad(Serializer *s) { } s->saveUint16(0xFFFF); // End marker } else { - while ((type = (ResType)s->loadUint16()) != 0xFFFF) { + uint16 tmp; + while ((tmp = s->loadUint16()) != 0xFFFF) { + type = (ResType)tmp; while ((idx = s->loadUint16()) != 0xFFFF) { assert(idx < _res->_types[type].size()); loadResource(s, type, idx); @@ -1430,7 +1432,9 @@ void ScummEngine::saveOrLoad(Serializer *s) { } s->saveByte(0xFF); } else { - while ((type = (ResType)s->loadByte()) != 0xFF) { + uint8 tmp; + while ((tmp = s->loadByte()) != 0xFF) { + type = (ResType)tmp; idx = s->loadUint16(); _res->lock(type, idx); } diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp index 95f8c85efe..3f32503fdf 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp @@ -5048,6 +5048,7 @@ void Scene3700::signal() { Scene3800::Scene3800() { _desertDirection = 0; + _skylineRect.set(0, 0, 320, 87); } void Scene3800::synchronize(Serializer &s) { @@ -5220,7 +5221,8 @@ void Scene3800::initExits() { } void Scene3800::enterArea() { - R2_GLOBALS._player.disableControl(); + R2_GLOBALS._player.disableControl(CURSOR_WALK); + switch (_desertDirection) { case 0: R2_GLOBALS._player.postInit(); @@ -5346,7 +5348,6 @@ void Scene3800::postInit(SceneObjectList *OwnerList) { _westExit.setDetails(Rect(0, 87, 14, 168), EXITCURSOR_W, 3800); _westExit.setDest(Common::Point(7, 145)); - _skylineRect.set(0, 0, 320, 87); _background.setDetails(Rect(0, 0, 320, 200), 3800, 0, 1, 2, 1, (SceneItem *) NULL); enterArea(); diff --git a/engines/zvision/fonts/truetype_font.cpp b/engines/zvision/fonts/truetype_font.cpp index 03520f18b6..ba4d72bde8 100644 --- a/engines/zvision/fonts/truetype_font.cpp +++ b/engines/zvision/fonts/truetype_font.cpp @@ -39,12 +39,9 @@ namespace ZVision { TruetypeFont::TruetypeFont(ZVision *engine, int32 fontHeight) - : _engine(engine), - _fontHeight(fontHeight), + : _fontHeight(fontHeight), _font(0), - _lineHeight(0), - _maxCharWidth(0), - _maxCharHeight(0) { + _lineHeight(0) { } TruetypeFont::~TruetypeFont(void) { diff --git a/engines/zvision/fonts/truetype_font.h b/engines/zvision/fonts/truetype_font.h index 3b5805db14..64f53a2c3b 100644 --- a/engines/zvision/fonts/truetype_font.h +++ b/engines/zvision/fonts/truetype_font.h @@ -43,12 +43,12 @@ public: ~TruetypeFont(); private: - ZVision *_engine; +// ZVision *_engine; Graphics::Font *_font; int _lineHeight; - size_t _maxCharWidth; - size_t _maxCharHeight; +// size_t _maxCharWidth; +// size_t _maxCharHeight; public: int32 _fontHeight; diff --git a/test/common/util.h b/test/common/util.h index cd65307612..e195f13a84 100644 --- a/test/common/util.h +++ b/test/common/util.h @@ -115,7 +115,7 @@ class UtilTestSuite : public CxxTest::TestSuite { TS_ASSERT_EQUALS(Common::isAlnum('Z'), 1); TS_ASSERT_EQUALS(Common::isAlnum('1'), 1); TS_ASSERT_EQUALS(Common::isAlnum('0'), 1); - TS_ASSERT_EQUALS(Common::isAlnum('§'), 0); + TS_ASSERT_EQUALS(Common::isAlnum('\xA7'), 0); TS_ASSERT_EQUALS(Common::isAlnum('$'), 0); TS_ASSERT_EQUALS(Common::isAlnum(' '), 0); TS_ASSERT_EQUALS(Common::isAlnum('\n'), 0); @@ -136,7 +136,7 @@ class UtilTestSuite : public CxxTest::TestSuite { TS_ASSERT_EQUALS(Common::isAlpha('Z'), 1); TS_ASSERT_EQUALS(Common::isAlpha('1'), 0); TS_ASSERT_EQUALS(Common::isAlpha('0'), 0); - TS_ASSERT_EQUALS(Common::isAlpha('§'), 0); + TS_ASSERT_EQUALS(Common::isAlpha('\xA7'), 0); TS_ASSERT_EQUALS(Common::isAlpha('$'), 0); TS_ASSERT_EQUALS(Common::isAlpha(' '), 0); TS_ASSERT_EQUALS(Common::isAlpha('\n'), 0); @@ -157,7 +157,7 @@ class UtilTestSuite : public CxxTest::TestSuite { TS_ASSERT_EQUALS(Common::isDigit('Z'), 0); TS_ASSERT_EQUALS(Common::isDigit('1'), 1); TS_ASSERT_EQUALS(Common::isDigit('0'), 1); - TS_ASSERT_EQUALS(Common::isDigit('§'), 0); + TS_ASSERT_EQUALS(Common::isDigit('\xA7'), 0); TS_ASSERT_EQUALS(Common::isDigit('$'), 0); TS_ASSERT_EQUALS(Common::isDigit(' '), 0); TS_ASSERT_EQUALS(Common::isDigit('\n'), 0); @@ -178,7 +178,7 @@ class UtilTestSuite : public CxxTest::TestSuite { TS_ASSERT_EQUALS(Common::isLower('Z'), 0); TS_ASSERT_EQUALS(Common::isLower('1'), 0); TS_ASSERT_EQUALS(Common::isLower('0'), 0); - TS_ASSERT_EQUALS(Common::isLower('§'), 0); + TS_ASSERT_EQUALS(Common::isLower('\xA7'), 0); TS_ASSERT_EQUALS(Common::isLower('$'), 0); TS_ASSERT_EQUALS(Common::isLower(' '), 0); TS_ASSERT_EQUALS(Common::isLower('\n'), 0); @@ -200,7 +200,7 @@ class UtilTestSuite : public CxxTest::TestSuite { TS_ASSERT_EQUALS(Common::isUpper('Z'), 1); TS_ASSERT_EQUALS(Common::isUpper('1'), 0); TS_ASSERT_EQUALS(Common::isUpper('0'), 0); - TS_ASSERT_EQUALS(Common::isUpper('§'), 0); + TS_ASSERT_EQUALS(Common::isUpper('\xA7'), 0); TS_ASSERT_EQUALS(Common::isUpper('$'), 0); TS_ASSERT_EQUALS(Common::isUpper(' '), 0); TS_ASSERT_EQUALS(Common::isUpper('\n'), 0); diff --git a/test/cxxtest_mingw.h b/test/cxxtest_mingw.h index f407105bfe..380f638640 100644 --- a/test/cxxtest_mingw.h +++ b/test/cxxtest_mingw.h @@ -8,4 +8,4 @@ #undef main #endif // main -#endif // CXXTEST_MINGW
\ No newline at end of file +#endif // CXXTEST_MINGW |