diff options
author | Paul Gilbert | 2016-07-26 19:48:14 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-07-26 19:48:14 -0400 |
commit | 504cf6ecb688a3f1c65a857bffd527d8b0e6ba63 (patch) | |
tree | 0c0d96d4061c11850c851f0fc981c75a58c20515 /engines/tinsel | |
parent | d8c28d15ae553d047b7e571f98727fa79ee143f3 (diff) | |
parent | e19922d181e775791f9105b8be7ff410770ede51 (diff) | |
download | scummvm-rg350-504cf6ecb688a3f1c65a857bffd527d8b0e6ba63.tar.gz scummvm-rg350-504cf6ecb688a3f1c65a857bffd527d8b0e6ba63.tar.bz2 scummvm-rg350-504cf6ecb688a3f1c65a857bffd527d8b0e6ba63.zip |
Merge branch 'master' into xeen
Diffstat (limited to 'engines/tinsel')
-rw-r--r-- | engines/tinsel/anim.cpp | 4 | ||||
-rw-r--r-- | engines/tinsel/bmv.cpp | 5 | ||||
-rw-r--r-- | engines/tinsel/bmv.h | 5 | ||||
-rw-r--r-- | engines/tinsel/detection.cpp | 19 | ||||
-rw-r--r-- | engines/tinsel/detection_tables.h | 21 | ||||
-rw-r--r-- | engines/tinsel/dialogs.cpp | 30 | ||||
-rw-r--r-- | engines/tinsel/graphics.cpp | 2 | ||||
-rw-r--r-- | engines/tinsel/handle.cpp | 2 | ||||
-rw-r--r-- | engines/tinsel/music.cpp | 36 | ||||
-rw-r--r-- | engines/tinsel/palette.cpp | 2 | ||||
-rw-r--r-- | engines/tinsel/play.cpp | 3 | ||||
-rw-r--r-- | engines/tinsel/saveload.cpp | 6 | ||||
-rw-r--r-- | engines/tinsel/sound.cpp | 2 | ||||
-rw-r--r-- | engines/tinsel/tinsel.cpp | 13 | ||||
-rw-r--r-- | engines/tinsel/tinsel.h | 6 |
15 files changed, 102 insertions, 54 deletions
diff --git a/engines/tinsel/anim.cpp b/engines/tinsel/anim.cpp index 19e180b57e..e241c7cba0 100644 --- a/engines/tinsel/anim.cpp +++ b/engines/tinsel/anim.cpp @@ -43,7 +43,7 @@ SCRIPTSTATE DoNextFrame(ANIM *pAnim) { while (1) { // repeat until a real image debugC(DEBUG_DETAILED, kTinselDebugAnimations, - "DoNextFrame %ph index=%d, op=%xh", (byte *)pAnim, pAnim->scriptIndex, + "DoNextFrame %ph index=%d, op=%xh", (const void *)pAnim, pAnim->scriptIndex, FROM_32(pAni[pAnim->scriptIndex].op)); switch ((int32)FROM_32(pAni[pAnim->scriptIndex].op)) { @@ -217,7 +217,7 @@ void InitStepAnimScript(ANIM *pAnim, OBJECT *pAniObj, SCNHANDLE hNewScript, int "InitStepAnimScript Object=(%d,%d,%xh) script=%xh aniSpeed=%d rec=%ph", !pAniObj ? 0 : fracToInt(pAniObj->xPos), !pAniObj ? 0 : fracToInt(pAniObj->yPos), - !pAniObj ? 0 : pAniObj->hImg, hNewScript, aniSpeed, (byte *)pAnim); + !pAniObj ? 0 : pAniObj->hImg, hNewScript, aniSpeed, (void *)pAnim); pAnim->aniDelta = 1; // will animate on next call to NextAnimRate pAnim->pObject = pAniObj; // set object to animate diff --git a/engines/tinsel/bmv.cpp b/engines/tinsel/bmv.cpp index f28cd684f9..cfe97e6ec1 100644 --- a/engines/tinsel/bmv.cpp +++ b/engines/tinsel/bmv.cpp @@ -39,6 +39,7 @@ #include "tinsel/tinlib.h" #include "tinsel/tinsel.h" +#include "audio/audiostream.h" #include "audio/decoders/raw.h" #include "common/textconsole.h" @@ -566,8 +567,8 @@ void BMVPlayer::PlayBMV(CORO_PARAM, SCNHANDLE hFileStem, int myEscape) { assert(!bMovieOn); - strcpy(szMovieFile, (char *)LockMem(hFileStem)); - strcat(szMovieFile, BMOVIE_EXTENSION); + Common::strlcpy(szMovieFile, (char *)LockMem(hFileStem), 14); + Common::strlcat(szMovieFile, BMOVIE_EXTENSION, 14); assert(strlen(szMovieFile) <= 12); diff --git a/engines/tinsel/bmv.h b/engines/tinsel/bmv.h index e52297f9de..888f910627 100644 --- a/engines/tinsel/bmv.h +++ b/engines/tinsel/bmv.h @@ -27,12 +27,15 @@ #include "common/coroutines.h" #include "common/file.h" -#include "audio/audiostream.h" #include "audio/mixer.h" #include "tinsel/object.h" #include "tinsel/palette.h" +namespace Audio { +class QueuingAudioStream; +} + namespace Tinsel { diff --git a/engines/tinsel/detection.cpp b/engines/tinsel/detection.cpp index c7a62dacad..c44f1f4ef3 100644 --- a/engines/tinsel/detection.cpp +++ b/engines/tinsel/detection.cpp @@ -85,7 +85,7 @@ static const PlainGameDescriptor tinselGames[] = { class TinselMetaEngine : public AdvancedMetaEngine { public: TinselMetaEngine() : AdvancedMetaEngine(Tinsel::gameDescriptions, sizeof(Tinsel::TinselGameDescription), tinselGames) { - _singleid = "tinsel"; + _singleId = "tinsel"; } virtual const char *getName() const { @@ -134,9 +134,8 @@ extern int getList(Common::SaveFileManager *saveFileMan, const Common::String &t SaveStateList TinselMetaEngine::listSaves(const char *target) const { Common::String pattern = target; - pattern = pattern + ".???"; + pattern = pattern + ".###"; Common::StringArray files = g_system->getSavefileManager()->listSavefiles(pattern); - sort(files.begin(), files.end()); // Sort (hopefully ensuring we are sorted numerically..) SaveStateList saveList; int slotNum = 0; @@ -160,6 +159,8 @@ SaveStateList TinselMetaEngine::listSaves(const char *target) const { } } + // Sort saves based on slot number. + Common::sort(saveList.begin(), saveList.end(), SaveStateDescriptorSlotComparator()); return saveList; } @@ -227,14 +228,14 @@ const ADGameDescription *TinselMetaEngine::fallbackDetect(const FileMap &allFile // Check which files are included in some dw2 ADGameDescription *and* present // in fslist without a '1' suffix character. Compute MD5s and file sizes for these files. - for (g = &Tinsel::gameDescriptions[0]; g->desc.gameid != 0; ++g) { - if (strcmp(g->desc.gameid, "dw2") != 0) + for (g = &Tinsel::gameDescriptions[0]; g->desc.gameId != 0; ++g) { + if (strcmp(g->desc.gameId, "dw2") != 0) continue; for (fileDesc = g->desc.filesDescriptions; fileDesc->fileName; fileDesc++) { // Get the next filename, stripping off any '1' suffix character char tempFilename[50]; - strcpy(tempFilename, fileDesc->fileName); + Common::strlcpy(tempFilename, fileDesc->fileName, 50); char *pOne = strchr(tempFilename, '1'); if (pOne) { do { @@ -264,8 +265,8 @@ const ADGameDescription *TinselMetaEngine::fallbackDetect(const FileMap &allFile int maxFilesMatched = 0; // MD5 based matching - for (g = &Tinsel::gameDescriptions[0]; g->desc.gameid != 0; ++g) { - if (strcmp(g->desc.gameid, "dw2") != 0) + for (g = &Tinsel::gameDescriptions[0]; g->desc.gameId != 0; ++g) { + if (strcmp(g->desc.gameId, "dw2") != 0) continue; bool fileMissing = false; @@ -274,7 +275,7 @@ const ADGameDescription *TinselMetaEngine::fallbackDetect(const FileMap &allFile for (fileDesc = g->desc.filesDescriptions; fileDesc->fileName; fileDesc++) { // Get the next filename, stripping off any '1' suffix character char tempFilename[50]; - strcpy(tempFilename, fileDesc->fileName); + Common::strlcpy(tempFilename, fileDesc->fileName, 50); char *pOne = strchr(tempFilename, '1'); if (pOne) { do { diff --git a/engines/tinsel/detection_tables.h b/engines/tinsel/detection_tables.h index a2ea67b3e6..6c1a3a39f4 100644 --- a/engines/tinsel/detection_tables.h +++ b/engines/tinsel/detection_tables.h @@ -556,6 +556,27 @@ static const TinselGameDescription gameDescriptions[] = { TINSEL_V1, }, + { // Russian Discworld 1. Fan translation v1.1 + { + "dw", + "CD v1.1", + { + {"dw.scn", 0, "133041bde59d05c1bf084fd6f1bdce4b", 776524}, + {"english.txt", 0, "317542cf2e50106d9c9421ddcf821e22", 221656}, + {"english.smp", 0, NULL, -1}, + {NULL, 0, NULL, 0} + }, + Common::RU_RUS, + Common::kPlatformDOS, + ADGF_CD, + GUIO1(GUIO_NOASPECT) + }, + GID_DW1, + 0, + GF_SCNFILES | GF_ENHANCED_AUDIO_SUPPORT, + TINSEL_V1, + }, + { // Polish fan translaction Discworld 1 { "dw", diff --git a/engines/tinsel/dialogs.cpp b/engines/tinsel/dialogs.cpp index a84dad942c..b5d090ec15 100644 --- a/engines/tinsel/dialogs.cpp +++ b/engines/tinsel/dialogs.cpp @@ -1671,10 +1671,10 @@ static void Select(int i, bool force) { #else // Current description with cursor appended if (cd.box[i].boxText != NULL) { - strcpy(g_sedit, cd.box[i].boxText); - strcat(g_sedit, sCursor); + Common::strlcpy(g_sedit, cd.box[i].boxText, SG_DESC_LEN+2); + Common::strlcat(g_sedit, sCursor, SG_DESC_LEN+2); } else { - strcpy(g_sedit, sCursor); + Common::strlcpy(g_sedit, sCursor, SG_DESC_LEN+2); } #endif @@ -3676,13 +3676,13 @@ extern void HideConversation(bool bHide) { ConstructInventory(FULL); else { // Move it all back on-screen - for (i = 0; g_objArray[i] && i < MAX_WCOMP; i++) { + for (i = 0; i < MAX_WCOMP && g_objArray[i]; i++) { MultiAdjustXY(g_objArray[i], -2 * SCREEN_WIDTH, 0); } // Don't flash if items changed. If they have, will be redrawn anyway. if (TinselV2 || !g_ItemsChanged) { - for (i = 0; g_iconArray[i] && i < MAX_ICONS; i++) { + for (i = 0; i < MAX_ICONS && g_iconArray[i]; i++) { MultiAdjustXY(g_iconArray[i], -2*SCREEN_WIDTH, 0); } } @@ -3739,10 +3739,10 @@ extern void HideConversation(bool bHide) { deltay = g_InvD[INV_CONV].inventoryY - deltay; // Move it all - for (i = 0; g_objArray[i] && i < MAX_WCOMP; i++) { + for (i = 0; i < MAX_WCOMP && g_objArray[i]; i++) { MultiMoveRelXY(g_objArray[i], x - center, deltay); } - for (i = 0; g_iconArray[i] && i < MAX_ICONS; i++) { + for (i = 0; i < MAX_ICONS && g_iconArray[i]; i++) { MultiMoveRelXY(g_iconArray[i], x - center, deltay); } g_InvD[INV_CONV].inventoryX += x - center; @@ -3771,10 +3771,10 @@ extern void HideConversation(bool bHide) { y = 0; if (x || y) { - for (i = 0; g_objArray[i] && i < MAX_WCOMP; i++) { + for (i = 0; i < MAX_WCOMP && g_objArray[i]; i++) { MultiMoveRelXY(g_objArray[i], x, y); } - for (i = 0; g_iconArray[i] && i < MAX_ICONS; i++) { + for (i = 0; i < MAX_ICONS && g_iconArray[i]; i++) { MultiMoveRelXY(g_iconArray[i], x, y); } g_InvD[INV_CONV].inventoryX += x; @@ -3786,10 +3786,10 @@ extern void HideConversation(bool bHide) { */ if (MultiLowest(g_RectObject) > SCREEN_BOX_HEIGHT2 - SysVar(SV_CONV_MINY)) { y = (SCREEN_BOX_HEIGHT2 - SysVar(SV_CONV_MINY)) - MultiLowest(g_RectObject); - for (i = 0; g_objArray[i] && i < MAX_WCOMP; i++) { + for (i = 0; i < MAX_WCOMP && g_objArray[i]; i++) { MultiMoveRelXY(g_objArray[i], 0, y); } - for (i = 0; g_iconArray[i] && i < MAX_ICONS; i++) { + for (i = 0; i < MAX_ICONS && g_iconArray[i]; i++) { MultiMoveRelXY(g_iconArray[i], 0, y); } g_InvD[INV_CONV].inventoryY += y; @@ -4617,9 +4617,9 @@ extern void Xmovement(int x) { GetAniPosition(g_objArray[0], &g_InvD[g_ino].inventoryX, &aniY); g_InvD[g_ino].inventoryX +=x; MultiSetAniX(g_objArray[0], g_InvD[g_ino].inventoryX); - for (i = 1; g_objArray[i] && i < MAX_WCOMP; i++) + for (i = 1; i < MAX_WCOMP && g_objArray[i]; i++) MultiMoveRelXY(g_objArray[i], x, 0); - for (i = 0; g_iconArray[i] && i < MAX_ICONS; i++) + for (i = 0; i < MAX_ICONS && g_iconArray[i]; i++) MultiMoveRelXY(g_iconArray[i], x, 0); break; @@ -4665,9 +4665,9 @@ extern void Ymovement(int y) { GetAniPosition(g_objArray[0], &aniX, &g_InvD[g_ino].inventoryY); g_InvD[g_ino].inventoryY +=y; MultiSetAniY(g_objArray[0], g_InvD[g_ino].inventoryY); - for (i = 1; g_objArray[i] && i < MAX_WCOMP; i++) + for (i = 1; i < MAX_WCOMP && g_objArray[i]; i++) MultiMoveRelXY(g_objArray[i], 0, y); - for (i = 0; g_iconArray[i] && i < MAX_ICONS; i++) + for (i = 0; i < MAX_ICONS && g_iconArray[i]; i++) MultiMoveRelXY(g_iconArray[i], 0, y); break; diff --git a/engines/tinsel/graphics.cpp b/engines/tinsel/graphics.cpp index 0282aff3cb..2ff96a9b64 100644 --- a/engines/tinsel/graphics.cpp +++ b/engines/tinsel/graphics.cpp @@ -164,7 +164,7 @@ static void t0WrtNonZero(DRAWOBJECT *pObj, uint8 *srcP, uint8 *destP, bool apply // Horizontal loop for (int x = 0; x < pObj->width; ) { - uint32 numBytes = READ_UINT32(srcP); + uint32 numBytes = READ_LE_UINT32(srcP); srcP += sizeof(uint32); bool repeatFlag = (numBytes & 0x80000000L) != 0; numBytes &= 0x7fffffff; diff --git a/engines/tinsel/handle.cpp b/engines/tinsel/handle.cpp index 62d244e449..9ffd477c4a 100644 --- a/engines/tinsel/handle.cpp +++ b/engines/tinsel/handle.cpp @@ -258,7 +258,7 @@ void LoadExtraGraphData(SCNHANDLE start, SCNHANDLE next) { } void SetCdPlaySceneDetails(int fileNum, const char *fileName) { - strcpy(g_szCdPlayFile, fileName); + Common::strlcpy(g_szCdPlayFile, fileName, 100); } void SetCdPlayHandle(int fileNum) { diff --git a/engines/tinsel/music.cpp b/engines/tinsel/music.cpp index 9b4e2494e0..dc7ca67cfe 100644 --- a/engines/tinsel/music.cpp +++ b/engines/tinsel/music.cpp @@ -29,7 +29,6 @@ #include "audio/midiparser.h" // Miles Audio for Discworld 1 #include "audio/miles.h" -#include "audio/decoders/adpcm.h" #include "backends/audiocd/audiocd.h" @@ -381,14 +380,28 @@ MidiMusicPlayer::MidiMusicPlayer(TinselEngine *vm) { bool milesAudioEnabled = false; if (vm->getPlatform() == Common::kPlatformDOS) { - // Enable Miles Audio for DOS only - milesAudioEnabled = true; + // Enable Miles Audio for DOS platform only... + switch (vm->getGameID()) { + case GID_DW1: + if (!vm->getIsADGFDemo()) { + // ...for Discworld 1 + milesAudioEnabled = true; + } else { + if (vm->isV1CD()) { + // ...and for Discworld 1 CD Demo + milesAudioEnabled = true; + } + } + break; + default: + break; + } } - if ((vm->getGameId() == GID_DW1) && (milesAudioEnabled)) { + if (milesAudioEnabled) { // Discworld 1 (DOS) uses Miles Audio 3 // use our own Miles Audio drivers - // + // // It seems that there are multiple versions of Discworld 1 // // Version 1: @@ -418,9 +431,12 @@ MidiMusicPlayer::MidiMusicPlayer(TinselEngine *vm) { // Version 2: drivers got installed and fat.opl got copied over by the user _driver = Audio::MidiDriver_Miles_AdLib_create("MIDPAK.AD", ""); } else { - // Version 1: sample.ad / sample.opl, have to be copied over by the user for this version - // That's why we check those last, because then the user gets a proper error message for them - _driver = Audio::MidiDriver_Miles_AdLib_create("SAMPLE.AD", "SAMPLE.OPL"); + if ((fileClass.exists("SAMPLE.AD")) || (fileClass.exists("SAMPLE.OPL"))) { + // Version 1: sample.ad / sample.opl, have to be copied over by the user for this version + _driver = Audio::MidiDriver_Miles_AdLib_create("SAMPLE.AD", "SAMPLE.OPL"); + } else { + error("MILES-ADLIB: timbre file not found (may be called FAT.OPL, MIDPAK.AD, SAMPLE.AD or SAMPLE.OPL, may be in a subdirectory)"); + } } } break; @@ -623,10 +639,14 @@ PCMMusicPlayer::PCMMusicPlayer() { _dimmed = false; _dimmedTinsel = false; _dimIteration = 0; + _dimmedVolume = 0; + _dimPosition = 0; _fadeOutVolume = 0; _fadeOutIteration = 0; + _hScript = _hSegment = 0; + _end = true; _vm->_mixer->playStream(Audio::Mixer::kMusicSoundType, diff --git a/engines/tinsel/palette.cpp b/engines/tinsel/palette.cpp index 918894cf6f..495049d1a2 100644 --- a/engines/tinsel/palette.cpp +++ b/engines/tinsel/palette.cpp @@ -132,6 +132,8 @@ void PalettesToVideoDAC() { VIDEO_DAC_Q *pDACtail = g_vidDACdata; // set tail pointer byte pal[768]; + memset(pal, 0, sizeof(pal)); + // while Q is not empty while (g_pDAChead != pDACtail) { const PALETTE *pPalette; // pointer to hardware palette diff --git a/engines/tinsel/play.cpp b/engines/tinsel/play.cpp index ef3127233d..a4f5bc8261 100644 --- a/engines/tinsel/play.cpp +++ b/engines/tinsel/play.cpp @@ -159,6 +159,9 @@ static int RegisterSoundReel(SCNHANDLE hFilm, int column, int actorCol) { } } + if (i == MAX_SOUNDREELS) + error("Out of sound reels in RegisterSoundReel()"); + g_soundReelNumbers[i]++; return i; } diff --git a/engines/tinsel/saveload.cpp b/engines/tinsel/saveload.cpp index 88cd80b78a..c8fe5f898c 100644 --- a/engines/tinsel/saveload.cpp +++ b/engines/tinsel/saveload.cpp @@ -563,7 +563,7 @@ static void DoSave() { while (1) { Common::String fname = _vm->getSavegameFilename(ano); - strcpy(tmpName, fname.c_str()); + Common::strlcpy(tmpName, fname.c_str(), FNAMELEN); for (i = 0; i < g_numSfiles; i++) if (!strcmp(g_savedFiles[i].name, tmpName)) @@ -594,8 +594,8 @@ static void DoSave() { hdr.id = SAVEGAME_ID; hdr.size = SAVEGAME_HEADER_SIZE; hdr.ver = CURRENT_VER; - memcpy(hdr.desc, g_SaveSceneDesc, SG_DESC_LEN); - hdr.desc[SG_DESC_LEN - 1] = 0; + memset(hdr.desc, 0, SG_DESC_LEN); + Common::strlcpy(hdr.desc, g_SaveSceneDesc, SG_DESC_LEN); g_system->getTimeAndDate(hdr.dateTime); hdr.scnFlag = _vm->getFeatures() & GF_SCNFILES; hdr.language = _vm->_config->_language; diff --git a/engines/tinsel/sound.cpp b/engines/tinsel/sound.cpp index 3d87a17331..a13e91fb3c 100644 --- a/engines/tinsel/sound.cpp +++ b/engines/tinsel/sound.cpp @@ -27,7 +27,6 @@ #include "tinsel/dw.h" #include "tinsel/config.h" #include "tinsel/music.h" -#include "tinsel/strres.h" #include "tinsel/tinsel.h" #include "tinsel/sysvar.h" #include "tinsel/background.h" @@ -37,7 +36,6 @@ #include "common/system.h" #include "audio/mixer.h" -#include "audio/decoders/adpcm.h" #include "audio/decoders/flac.h" #include "audio/decoders/mp3.h" #include "audio/decoders/raw.h" diff --git a/engines/tinsel/tinsel.cpp b/engines/tinsel/tinsel.cpp index 6dc8e3bb35..44e81494f7 100644 --- a/engines/tinsel/tinsel.cpp +++ b/engines/tinsel/tinsel.cpp @@ -528,8 +528,6 @@ void SetNewScene(SCNHANDLE scene, int entrance, int transition) { * Store a scene as hooked */ void SetHookScene(SCNHANDLE scene, int entrance, int transition) { - assert(g_HookScene.scene == 0); // scene already hooked - g_HookScene.scene = scene; g_HookScene.entry = entrance; g_HookScene.trans = transition; @@ -822,9 +820,12 @@ const char *const TinselEngine::_textFiles[][3] = { TinselEngine::TinselEngine(OSystem *syst, const TinselGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc), _random("tinsel"), - _sound(0), _midiMusic(0), _pcmMusic(0), _bmv(0) { + _console(0), _sound(0), _midiMusic(0), _pcmMusic(0), _bmv(0) { _vm = this; + _gameId = 0; + _driver = NULL; + _config = new Config(this); // Register debug flags @@ -843,9 +844,7 @@ TinselEngine::TinselEngine(OSystem *syst, const TinselGameDescription *gameDesc) if (!scumm_stricmp(g->gameid, gameid)) _gameId = g->id; - int cd_num = ConfMan.getInt("cdrom"); - if (cd_num >= 0) - _system->getAudioCDManager()->openCD(cd_num); + _system->getAudioCDManager()->open(); _mousePos.x = 0; _mousePos.y = 0; @@ -977,7 +976,7 @@ Common::Error TinselEngine::run() { // Check for time to do next game cycle if ((g_system->getMillis() > timerVal + GAME_FRAME_DELAY)) { timerVal = g_system->getMillis(); - _system->getAudioCDManager()->updateCD(); + _system->getAudioCDManager()->update(); NextGameCycle(); } diff --git a/engines/tinsel/tinsel.h b/engines/tinsel/tinsel.h index c83bc80ead..9e4ce61b04 100644 --- a/engines/tinsel/tinsel.h +++ b/engines/tinsel/tinsel.h @@ -20,8 +20,8 @@ * */ -#ifndef TINSEL_H -#define TINSEL_H +#ifndef TINSEL_TINSEL_H +#define TINSEL_TINSEL_H #include "common/scummsys.h" #include "common/system.h" @@ -251,4 +251,4 @@ void CdHasChanged(); } // End of namespace Tinsel -#endif /* TINSEL_H */ +#endif /* TINSEL_TINSEL_H */ |