From 6b2d8436806a2e017ac3b4b99e954f434248121f Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Mon, 12 Feb 2007 12:53:28 +0000 Subject: - Some fixes for demos and Amiga versions - Improved language finding a bit svn-id: r25520 --- engines/gob/detection.cpp | 28 +++++++++++++++++++--- engines/gob/game.cpp | 7 ++++-- engines/gob/game_v1.cpp | 2 +- engines/gob/game_v2.cpp | 4 ++-- engines/gob/global.cpp | 3 +-- engines/gob/global.h | 1 + engines/gob/gob.cpp | 4 ++++ engines/gob/init.cpp | 4 ++-- engines/gob/inter.h | 1 + engines/gob/inter_v2.cpp | 61 +++++++++++++++++++++++++++++++++++++++-------- engines/gob/video_v2.cpp | 3 +++ 11 files changed, 96 insertions(+), 22 deletions(-) (limited to 'engines') diff --git a/engines/gob/detection.cpp b/engines/gob/detection.cpp index 3abeb09e5f..da8a6e03d5 100644 --- a/engines/gob/detection.cpp +++ b/engines/gob/detection.cpp @@ -54,8 +54,8 @@ static const PlainGameDescriptor gobGames[] = { {"gob3cd", "Goblins Quest 3 CD"}, {"gob3-demo", "Goblins Quest 3 Demo"}, {"bargon", "Bargon Attack"}, - {"ween", "Ween: The Prohpecy"}, - {"ween-demo", "Ween: The Prohpecy Demo"}, + {"ween", "Ween: The Prophecy"}, + {"ween-demo", "Ween: The Prophecy Demo"}, {"woodruff", "The Bizarre Adventures of Woodruff and the Schnibble"}, {0, 0} }; @@ -529,7 +529,7 @@ static const GOBGameDescription gameDescriptions[] = { "ween", "", AD_ENTRY1("intro.stk", "2bb8878a8042244dd2b96ff682381baa"), - UNK_LANG, + EN_GRB, kPlatformPC, }, GF_GOB2, @@ -546,6 +546,17 @@ static const GOBGameDescription gameDescriptions[] = { GF_GOB2, "intro" }, + { + { + "ween", + "", + AD_ENTRY1("intro.stk", "257fe669705ac4971efdfd5656eef16a"), + FR_FRA, + kPlatformAmiga, + }, + GF_GOB2, + "intro" + }, { { "ween", @@ -579,6 +590,17 @@ static const GOBGameDescription gameDescriptions[] = { GF_GOB2, "intro" }, + { + { + "ween-demo", + "", + AD_ENTRY1("intro.stk", "15fb91a1b9b09684b28ac75edf66e504"), + EN_USA, + kPlatformPC, + }, + GF_GOB2, + "show" + }, { { "bargon", diff --git a/engines/gob/game.cpp b/engines/gob/game.cpp index f28f91e36f..1e9354f2fd 100644 --- a/engines/gob/game.cpp +++ b/engines/gob/game.cpp @@ -690,6 +690,7 @@ int16 Game::openLocTextFile(char *locTextFile, int language) { } char *Game::loadLocTexts(void) { + static bool found = false; char locTextFile[20]; int16 handle; int i; @@ -697,18 +698,20 @@ char *Game::loadLocTexts(void) { strcpy(locTextFile, _curTotFile); handle = openLocTextFile(locTextFile, _vm->_global->_language); - if ((handle < 0) && !scumm_stricmp(_vm->_game->_curTotFile, _vm->_startTot0)) { - warning("Your game version doesn't support the requested language, using the first one available"); + if ((handle < 0) && !found) { for (i = 0; i < 10; i++) { handle = openLocTextFile(locTextFile, i); if (handle >= 0) { + warning("Your game version doesn't support the requested language, using the first one available (%d)", i); _vm->_global->_language = i; + found = true; break; } } } if (handle >= 0) { + found = true; _vm->_dataio->closeData(handle); return _vm->_dataio->getData(locTextFile); } diff --git a/engines/gob/game_v1.cpp b/engines/gob/game_v1.cpp index 83b74a898c..0bda55b12d 100644 --- a/engines/gob/game_v1.cpp +++ b/engines/gob/game_v1.cpp @@ -171,7 +171,7 @@ void Game_v1::playTot(int16 skipPlay) { _vm->_global->_inter_animDataSize = READ_LE_UINT16((char *)_totFileData + 0x38); if (_vm->_global->_inter_variables == 0) { - variablesCount = READ_LE_UINT32((char *)_totFileData + 0x2c); + variablesCount = READ_LE_UINT16((char *)_totFileData + 0x2c); _vm->_global->_inter_variables = new char[variablesCount * 4]; _vm->_global->_inter_variablesSizes = new byte[variablesCount * 4]; _vm->_global->clearVars(variablesCount); diff --git a/engines/gob/game_v2.cpp b/engines/gob/game_v2.cpp index e8b5b67ebc..41cf82fae7 100644 --- a/engines/gob/game_v2.cpp +++ b/engines/gob/game_v2.cpp @@ -196,7 +196,7 @@ void Game_v2::playTot(int16 skipPlay) { _vm->_global->_inter_animDataSize = READ_LE_UINT16((char *)_totFileData + 0x38); if (_vm->_global->_inter_variables == 0) { - variablesCount = READ_LE_UINT32((char *)_totFileData + 0x2c); + variablesCount = READ_LE_UINT16((char *)_totFileData + 0x2c); _vm->_global->_inter_variables = new char[variablesCount * 4]; _vm->_global->_inter_variablesSizes = new byte[variablesCount * 4]; _vm->_global->clearVars(variablesCount); @@ -209,7 +209,7 @@ void Game_v2::playTot(int16 skipPlay) { WRITE_VAR(13, _vm->_global->_useMouse); WRITE_VAR(14, _vm->_global->_soundFlags); - WRITE_VAR(15, _vm->_global->_videoMode); + WRITE_VAR(15, _vm->_global->_fakeVideoMode); WRITE_VAR(16, _vm->_global->_language); _vm->_inter->callSub(2); diff --git a/engines/gob/global.cpp b/engines/gob/global.cpp index 90606fbb23..9fe972b811 100644 --- a/engines/gob/global.cpp +++ b/engines/gob/global.cpp @@ -35,14 +35,13 @@ Global::Global(GobEngine *vm) : _vm(vm) { _presentHER = UNDEF; _videoMode = 0; + _fakeVideoMode = 0; /* Sound */ _soundFlags = 0; _blasterPort = 0; _disableSoundCfg = 0; - //char _playingSound = 0; - /* Mouse */ _disableMouseCfg = 0; diff --git a/engines/gob/global.h b/engines/gob/global.h index a2ffe651ef..1d567ce48f 100644 --- a/engines/gob/global.h +++ b/engines/gob/global.h @@ -77,6 +77,7 @@ public: int16 _presentHER; int16 _videoMode; + int16 _fakeVideoMode; int16 _disableVideoCfg; diff --git a/engines/gob/gob.cpp b/engines/gob/gob.cpp index 961c4a4f86..59666dc146 100644 --- a/engines/gob/gob.cpp +++ b/engines/gob/gob.cpp @@ -648,6 +648,10 @@ int GobEngine::init() { _global->_debugFlag = 1; _global->_doRangeClamp = 1; + // WORKAROUND: Some Amiga versions only play music when the video mode is + // Amiga-ish + _global->_fakeVideoMode = (_platform == Common::kPlatformAmiga) ? 0x11 : 0x13; + _global->_videoMode = 0x13; _global->_useMouse = 1; _global->_soundFlags = MIDI_FLAG | SPEAKER_FLAG | BLASTER_FLAG | ADLIB_FLAG; diff --git a/engines/gob/init.cpp b/engines/gob/init.cpp index c093f80851..82cca27545 100644 --- a/engines/gob/init.cpp +++ b/engines/gob/init.cpp @@ -189,8 +189,8 @@ memBlocks = word ptr -2*/ if (handle >= 0) { // Get variables count _vm->_dataio->seekData(handle, 0x2c, SEEK_SET); - _vm->_dataio->readData(handle, (char *)&varsCount, 4); - varsCount = FROM_LE_32(varsCount); + _vm->_dataio->readData(handle, (char *)&varsCount, 2); + varsCount = FROM_LE_16(varsCount); _vm->_dataio->closeData(handle); _vm->_global->_inter_variables = new char[varsCount * 4]; diff --git a/engines/gob/inter.h b/engines/gob/inter.h index a6d25f53ad..e051f03c12 100644 --- a/engines/gob/inter.h +++ b/engines/gob/inter.h @@ -372,6 +372,7 @@ protected: void o2_initScreen(void); void o2_setScrollOffset(void); void o2_handleGoblins(int16 &extraData, int32 *retVarPtr, Goblin::Gob_Object *objDesc); + void o2_loadInfogramesIns(int16 &extraData, int32 *retVarPtr, Goblin::Gob_Object *objDesc); void o2_playInfogrames(int16 &extraData, int32 *retVarPtr, Goblin::Gob_Object *objDesc); }; diff --git a/engines/gob/inter_v2.cpp b/engines/gob/inter_v2.cpp index 7df944c76c..05aef9e10b 100644 --- a/engines/gob/inter_v2.cpp +++ b/engines/gob/inter_v2.cpp @@ -45,7 +45,7 @@ namespace Gob { #define OPCODE(x) _OPCODE(Inter_v2, x) const int Inter_v2::_goblinFuncLookUp[][2] = { - {1, 0}, + {0, 0}, {2, 1}, {3, 2}, {4, 3}, @@ -551,7 +551,7 @@ void Inter_v2::setupOpcodes(void) { static const OpcodeGoblinEntryV2 opcodesGoblin[71] = { /* 00 */ - {NULL, ""}, + OPCODE(o2_loadInfogramesIns), {NULL, ""}, {NULL, ""}, {NULL, ""}, @@ -1403,6 +1403,10 @@ bool Inter_v2::o2_readData(char &cmdCount, int16 &counter, int16 &retFlag) { if (((dataVar >> 2) == 59) && (size == 4)) { retSize = _vm->_dataio->readData(handle, tmp, 4); WRITE_VAR(59, READ_LE_UINT32(tmp)); + // The scripts in some Amiga versions divide through 256^3 then, + // effectively doing a LE->BE conversion + if ((_vm->_platform == Common::kPlatformAmiga) && (VAR(59) < 256)) + WRITE_VAR(59, SWAP_BYTES_32(VAR(59))); } else retSize = _vm->_dataio->readData(handle, buf, size); @@ -1737,7 +1741,8 @@ bool Inter_v2::o2_palLoad(char &cmdCount, int16 &counter, int16 &retFlag) { break; case 52: - if ((_vm->_global->_videoMode != 0x0D) || (_vm->_global->_colorCount == 256)) { + if ((_vm->_platform != Common::kPlatformAmiga) && + ((_vm->_global->_videoMode != 0x0D) || (_vm->_global->_colorCount == 256))) { _vm->_global->_inter_execPtr += 48; return false; } @@ -1821,12 +1826,11 @@ bool Inter_v2::o2_palLoad(char &cmdCount, int16 &counter, int16 &retFlag) { case 52: for (i = 0; i < 16; i++, _vm->_global->_inter_execPtr += 3) { - _vm->_draw->_vgaSmallPalette[i].red = _vm->_global->_inter_execPtr[0]; - _vm->_draw->_vgaSmallPalette[i].green = _vm->_global->_inter_execPtr[1]; - _vm->_draw->_vgaSmallPalette[i].blue = _vm->_global->_inter_execPtr[2]; + _vm->_draw->_vgaPalette[i].red = _vm->_global->_inter_execPtr[0]; + _vm->_draw->_vgaPalette[i].green = _vm->_global->_inter_execPtr[1]; + _vm->_draw->_vgaPalette[i].blue = _vm->_global->_inter_execPtr[2]; } - _vm->_global->_inter_execPtr += 48; - if (_vm->_global->_videoMode >= 0x13) + if ((_vm->_platform != Common::kPlatformAmiga) && _vm->_global->_videoMode >= 0x13) return false; break; @@ -2218,6 +2222,12 @@ void Inter_v2::o2_initScreen(void) { width = _vm->_parse->parseValExpr(); height = _vm->_parse->parseValExpr(); + _vm->_global->_fakeVideoMode = videoMode; + + // Some Amiga versions require this + if (videoMode == 0xD) + videoMode = 0x14; + if ((videoMode == _vm->_global->_videoMode) && (width == -1)) return; @@ -2242,7 +2252,7 @@ void Inter_v2::o2_initScreen(void) { _vm->_global->_videoMode = videoMode; _vm->_video->initPrimary(videoMode); } - WRITE_VAR(15, _vm->_global->_videoMode); + WRITE_VAR(15, _vm->_global->_fakeVideoMode); _vm->_global->_setAllPalette = 1; @@ -2372,7 +2382,38 @@ void Inter_v2::o2_handleGoblins(int16 &extraData, int32 *retVarPtr, Goblin::Gob_ _vm->_goblin->handleGoblins(); } -void Inter_v2::o2_playInfogrames(int16 &extraData, int32 *retVarPtr, Goblin::Gob_Object *objDesc) { +void Inter_v2::o2_loadInfogramesIns(int16 &extraData, int32 *retVarPtr, + Goblin::Gob_Object *objDesc) { + int16 varName; + char fileName[20]; + + varName = load16(); + + if (_vm->_noMusic) + return; + + strcpy(fileName, GET_VAR_STR(varName)); + strcat(fileName, ".INS"); + debugC(1, kDebugMusic, "Loading Infogrames instrument file \"%s\"", fileName); + + if (_vm->_game->_infogrames) { + _vm->_mixer->stopHandle(_vm->_game->_infHandle); + _vm->_game->_infogrames = 0; + } + + if (_vm->_game->_infIns) + delete _vm->_game->_infIns; + + _vm->_game->_infIns = new Audio::Infogrames::Instruments; + if (!_vm->_game->_infIns->load(fileName)) { + warning("Couldn't load instruments file"); + delete _vm->_game->_infIns; + _vm->_game->_infIns = 0; + } +} + +void Inter_v2::o2_playInfogrames(int16 &extraData, int32 *retVarPtr, + Goblin::Gob_Object *objDesc) { int16 varName; char fileName[20]; diff --git a/engines/gob/video_v2.cpp b/engines/gob/video_v2.cpp index d4bbd7ada8..7118f7d80a 100644 --- a/engines/gob/video_v2.cpp +++ b/engines/gob/video_v2.cpp @@ -99,6 +99,9 @@ Video::SurfaceDesc *Video_v2::initSurfDesc(int16 vidMode, int16 width, int16 hei int16 someFlags = 1; SurfaceDesc *descPtr; + if (_vm->_platform == Common::kPlatformAmiga) + flags &= ~RETURN_PRIMARY; + if (flags != PRIMARY_SURFACE) _vm->_global->_sprAllocated++; -- cgit v1.2.3