diff options
Diffstat (limited to 'engines/tinsel')
-rw-r--r-- | engines/tinsel/config.cpp | 93 | ||||
-rw-r--r-- | engines/tinsel/config.h | 22 | ||||
-rw-r--r-- | engines/tinsel/cursor.cpp | 7 | ||||
-rw-r--r-- | engines/tinsel/detection.cpp | 126 | ||||
-rw-r--r-- | engines/tinsel/dw.h | 7 | ||||
-rw-r--r-- | engines/tinsel/inventory.cpp | 265 | ||||
-rw-r--r-- | engines/tinsel/music.cpp | 4 | ||||
-rw-r--r-- | engines/tinsel/tinlib.cpp | 10 | ||||
-rw-r--r-- | engines/tinsel/tinsel.cpp | 28 | ||||
-rw-r--r-- | engines/tinsel/tinsel.h | 15 |
10 files changed, 324 insertions, 253 deletions
diff --git a/engines/tinsel/config.cpp b/engines/tinsel/config.cpp index 4c143f1b8d..cb2099c130 100644 --- a/engines/tinsel/config.cpp +++ b/engines/tinsel/config.cpp @@ -24,8 +24,6 @@ * This file contains configuration functionality */ -//#define USE_3FLAGS 1 - #include "tinsel/config.h" #include "tinsel/dw.h" #include "tinsel/sound.h" @@ -47,7 +45,7 @@ int volVoice = MAXSAMPVOL; int speedText = DEFTEXTSPEED; int bSubtitles = false; int bSwapButtons = 0; -LANGUAGE language = TXT_ENGLISH; +LANGUAGE g_language = TXT_ENGLISH; int bAmerica = 0; @@ -55,9 +53,8 @@ int bAmerica = 0; bool bNoBlocking; /** - * WriteConfig() + * Write settings to config manager and flush the config file to disk. */ - void WriteConfig(void) { ConfMan.setInt("dclick_speed", dclickSpeed); ConfMan.setInt("music_volume", (volMidi * Audio::Mixer::kMaxChannelVolume) / MAXMIDIVOL); @@ -66,8 +63,33 @@ void WriteConfig(void) { ConfMan.setInt("talkspeed", (speedText * 255) / 100); ConfMan.setBool("subtitles", bSubtitles); //ConfMan.setBool("swap_buttons", bSwapButtons ? 1 : 0); - //ConfigData.language = language; // not necessary, as language has been set in the launcher //ConfigData.bAmerica = bAmerica; // EN_USA / EN_GRB + + // Store language for multilingual versions + if ((_vm->getFeatures() & GF_USE_3FLAGS) || (_vm->getFeatures() & GF_USE_4FLAGS) || (_vm->getFeatures() & GF_USE_5FLAGS)) { + Common::Language lang; + switch (g_language) { + case TXT_FRENCH: + lang = Common::FR_FRA; + break; + case TXT_GERMAN: + lang = Common::DE_DEU; + break; + case TXT_SPANISH: + lang = Common::ES_ESP; + break; + case TXT_ITALIAN: + lang = Common::IT_ITA; + break; + default: + lang = Common::EN_ANY; + } + + ConfMan.set("language", Common::getLanguageCode(lang)); + } + + // Write to disk + ConfMan.flushToDisk(); } /*---------------------------------------------------------------------*\ @@ -94,24 +116,53 @@ void ReadConfig(void) { //ConfigData.language = language; // not necessary, as language has been set in the launcher //ConfigData.bAmerica = bAmerica; // EN_USA / EN_GRB -// The flags here control how many country flags are displayed in one of the option dialogs. -#if defined(USE_3FLAGS) || defined(USE_4FLAGS) || defined(USE_5FLAGS) - language = ConfigData.language; - #ifdef USE_3FLAGS - if (language == TXT_ENGLISH || language == TXT_ITALIAN) { - language = TXT_GERMAN; - bSubtitles = true; + // Set language - we'll be clever here and use the ScummVM language setting + g_language = TXT_ENGLISH; + Common::Language lang = _vm->getLanguage(); + if (lang == Common::UNK_LANG && ConfMan.hasKey("language")) + lang = Common::parseLanguage(ConfMan.get("language")); // For multi-lingual versions, fall back to user settings + switch (lang) { + case Common::FR_FRA: + g_language = TXT_FRENCH; + break; + case Common::DE_DEU: + g_language = TXT_GERMAN; + break; + case Common::ES_ESP: + g_language = TXT_SPANISH; + break; + case Common::IT_ITA: + g_language = TXT_ITALIAN; + break; + default: + g_language = TXT_ENGLISH; } - #endif - #ifdef USE_4FLAGS - if (language == TXT_ENGLISH) { - language = TXT_GERMAN; + + if (lang == Common::JA_JPN) { + // TODO: Add support for JAPAN version + } else if (lang == Common::HB_ISR) { + // TODO: Add support for HEBREW version + + // The Hebrew version appears to the software as being English + // but it needs to have subtitles on... + g_language = TXT_ENGLISH; bSubtitles = true; + } else if (_vm->getFeatures() & GF_USE_3FLAGS) { + // 3 FLAGS version supports French, German, Spanish + // Fall back to German if necessary + if (g_language != TXT_FRENCH && g_language != TXT_GERMAN && g_language != TXT_SPANISH) { + g_language = TXT_GERMAN; + bSubtitles = true; + } + } else if (_vm->getFeatures() & GF_USE_4FLAGS) { + // 4 FLAGS version supports French, German, Spanish, Italian + // Fall back to German if necessary + if (g_language != TXT_FRENCH && g_language != TXT_GERMAN && + g_language != TXT_SPANISH && g_language != TXT_ITALIAN) { + g_language = TXT_GERMAN; + bSubtitles = true; + } } - #endif -#else - language = TXT_ENGLISH; -#endif } bool isJapanMode() { diff --git a/engines/tinsel/config.h b/engines/tinsel/config.h index 73cc411cb6..fc85f0abe0 100644 --- a/engines/tinsel/config.h +++ b/engines/tinsel/config.h @@ -30,23 +30,11 @@ namespace Tinsel { -// None of these defined -> 1 language, in ENGLISH.TXT -//#define USE_5FLAGS 1 // All 5 flags -//#define USE_4FLAGS 1 // French, German, Italian, Spanish -//#define USE_3FLAGS 1 // French, German, Spanish - -// The Hebrew version appears to the software as being English -// but it needs to have subtitles on... -//#define HEBREW 1 - -//#define JAPAN 1 - - // double click timer initial value -#define DOUBLE_CLICK_TIME 6 // 6 @ 18Hz = .33 sec - -#define DEFTEXTSPEED 0 - +enum { + DOUBLE_CLICK_TIME = 6, // 6 @ 18Hz = .33 sec + DEFTEXTSPEED = 0 +}; extern int dclickSpeed; extern int volMidi; @@ -55,7 +43,7 @@ extern int volVoice; extern int speedText; extern int bSubtitles; extern int bSwapButtons; -extern LANGUAGE language; +extern LANGUAGE g_language; extern int bAmerica; void WriteConfig(void); diff --git a/engines/tinsel/cursor.cpp b/engines/tinsel/cursor.cpp index b95662cbfe..f933b2dd79 100644 --- a/engines/tinsel/cursor.cpp +++ b/engines/tinsel/cursor.cpp @@ -49,7 +49,7 @@ namespace Tinsel { //----------------- LOCAL DEFINES -------------------- #define ITERATION_BASE FRAC_ONE -#define ITER_ACCELLERATION (10L << (FRAC_BITS - 4)) +#define ITER_ACCELERATION (10L << (FRAC_BITS - 4)) //----------------- LOCAL GLOBAL DATA -------------------- @@ -404,7 +404,8 @@ static void MoveCursor(void) { newY = intToFrac(ptMouse.y); // modify mouse driver position depending on cursor keys - if ((dir = _vm->getKeyDirection()) != 0) { + dir = _vm->getKeyDirection(); + if (dir != 0) { if (dir & MSK_LEFT) newX -= IterationSize; @@ -417,7 +418,7 @@ static void MoveCursor(void) { if (dir & MSK_DOWN) newY += IterationSize; - IterationSize += ITER_ACCELLERATION; + IterationSize += ITER_ACCELERATION; // set new mouse driver position _vm->setMousePosition(Common::Point(fracToInt(newX), fracToInt(newY))); diff --git a/engines/tinsel/detection.cpp b/engines/tinsel/detection.cpp index 7da4192456..f4fe876290 100644 --- a/engines/tinsel/detection.cpp +++ b/engines/tinsel/detection.cpp @@ -130,6 +130,96 @@ static const TinselGameDescription gameDescriptions[] = { TINSEL_V1, }, + { // Multilingual CD with english speech and *.gra files. + // Note: It contains no english subtitles. + { + "dw", + "CD", + { + {"dw.gra", 0, "c8808ccd988d603dd35dff42013ae7fd", 781656}, + {"english.smp", 0, NULL, -1}, + {"french.txt", 0, NULL, -1}, + {"german.txt", 0, NULL, -1}, + {"italian.txt", 0, NULL, -1}, + {"spanish.txt", 0, NULL, -1}, + {NULL, 0, NULL, 0} + }, + Common::FR_FRA, + Common::kPlatformPC, + Common::ADGF_DROPLANGUAGE + }, + GID_DW1, + 0, + GF_CD | GF_USE_4FLAGS, + TINSEL_V1, + }, + { + { + "dw", + "CD", + { + {"dw.gra", 0, "c8808ccd988d603dd35dff42013ae7fd", 781656}, + {"english.smp", 0, NULL, -1}, + {"french.txt", 0, NULL, -1}, + {"german.txt", 0, NULL, -1}, + {"italian.txt", 0, NULL, -1}, + {"spanish.txt", 0, NULL, -1}, + {NULL, 0, NULL, 0} + }, + Common::DE_DEU, + Common::kPlatformPC, + Common::ADGF_DROPLANGUAGE + }, + GID_DW1, + 0, + GF_CD | GF_USE_4FLAGS, + TINSEL_V1, + }, + { + { + "dw", + "CD", + { + {"dw.gra", 0, "c8808ccd988d603dd35dff42013ae7fd", 781656}, + {"english.smp", 0, NULL, -1}, + {"french.txt", 0, NULL, -1}, + {"german.txt", 0, NULL, -1}, + {"italian.txt", 0, NULL, -1}, + {"spanish.txt", 0, NULL, -1}, + {NULL, 0, NULL, 0} + }, + Common::IT_ITA, + Common::kPlatformPC, + Common::ADGF_DROPLANGUAGE + }, + GID_DW1, + 0, + GF_CD | GF_USE_4FLAGS, + TINSEL_V1, + }, + { + { + "dw", + "CD", + { + {"dw.gra", 0, "c8808ccd988d603dd35dff42013ae7fd", 781656}, + {"english.smp", 0, NULL, -1}, + {"french.txt", 0, NULL, -1}, + {"german.txt", 0, NULL, -1}, + {"italian.txt", 0, NULL, -1}, + {"spanish.txt", 0, NULL, -1}, + {NULL, 0, NULL, 0} + }, + Common::ES_ESP, + Common::kPlatformPC, + Common::ADGF_DROPLANGUAGE + }, + GID_DW1, + 0, + GF_CD | GF_USE_4FLAGS, + TINSEL_V1, + }, + { // English CD with SCN files { "dw", @@ -189,25 +279,6 @@ static const TinselGameDescription gameDescriptions[] = { { AD_TABLE_END_MARKER, 0, 0, 0, 0 } }; -/** - * The fallback game descriptor used by the Tinsel engine's fallbackDetector. - * Contents of this struct are to be overwritten by the fallbackDetector. - */ -static TinselGameDescription g_fallbackDesc = { - { - "", - "", - AD_ENTRY1(0, 0), // This should always be AD_ENTRY1(0, 0) in the fallback descriptor - Common::UNK_LANG, - Common::kPlatformPC, - Common::ADGF_NO_FLAGS - }, - 0, - 0, - 0, - 0, -}; - } // End of namespace Tinsel static const Common::ADParams detectionParams = { @@ -243,8 +314,6 @@ public: virtual bool createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const; - const Common::ADGameDescription *fallbackDetect(const FSList *fslist) const; - }; bool TinselMetaEngine::createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const { @@ -255,21 +324,6 @@ bool TinselMetaEngine::createInstance(OSystem *syst, Engine **engine, const Comm return gd != 0; } -const Common::ADGameDescription *TinselMetaEngine::fallbackDetect(const FSList *fslist) const { - // Set the default values for the fallback descriptor's ADGameDescription part. - Tinsel::g_fallbackDesc.desc.language = Common::UNK_LANG; - Tinsel::g_fallbackDesc.desc.platform = Common::kPlatformPC; - Tinsel::g_fallbackDesc.desc.flags = Common::ADGF_NO_FLAGS; - - // Set default values for the fallback descriptor's TinselGameDescription part. - Tinsel::g_fallbackDesc.gameID = 0; - Tinsel::g_fallbackDesc.features = 0; - Tinsel::g_fallbackDesc.version = 0; - - //return (const Common::ADGameDescription *)&Tinsel::g_fallbackDesc; - return NULL; -} - #if PLUGIN_ENABLED_DYNAMIC(TINSEL) REGISTER_PLUGIN_DYNAMIC(TINSEL, PLUGIN_TYPE_ENGINE, TinselMetaEngine); #else diff --git a/engines/tinsel/dw.h b/engines/tinsel/dw.h index d14dd43fa2..9ceef37858 100644 --- a/engines/tinsel/dw.h +++ b/engines/tinsel/dw.h @@ -110,8 +110,11 @@ typedef int HPOLYGON; // Language for the resource strings enum LANGUAGE { - TXT_ENGLISH, TXT_FRENCH, TXT_GERMAN, - TXT_ITALIAN, TXT_SPANISH + TXT_ENGLISH, + TXT_FRENCH, + TXT_GERMAN, + TXT_ITALIAN, + TXT_SPANISH }; } // end of namespace Tinsel diff --git a/engines/tinsel/inventory.cpp b/engines/tinsel/inventory.cpp index e3333bae90..ffecacd1be 100644 --- a/engines/tinsel/inventory.cpp +++ b/engines/tinsel/inventory.cpp @@ -29,8 +29,6 @@ * And there's still a bit of tidying and commenting to do yet. */ -//#define USE_3FLAGS 1 - #include "tinsel/actors.h" #include "tinsel/anim.h" #include "tinsel/background.h" @@ -370,9 +368,7 @@ enum BFUNC { NOFUNC, SAVEGAME, LOADGAME, IQUITGAME, CLOSEWIN, OPENLOAD, OPENSAVE, OPENREST, OPENSOUND, OPENCONT, -#ifndef JAPAN OPENSUBT, -#endif OPENQUIT, INITGAME, MIDIVOL, CLANG, RLANG @@ -402,9 +398,7 @@ struct CONFBOX { #define SIX_RESTART_OPTION 2 #define SIX_SOUND_OPTION 3 #define SIX_CONTROL_OPTION 4 -#ifndef JAPAN #define SIX_SUBTITLES_OPTION 5 -#endif #define SIX_QUIT_OPTION 6 #define SIX_RESUME_OPTION 7 #define SIX_LOAD_HEADING 8 @@ -568,41 +562,60 @@ CONFBOX controlBox[] = { /*-------------------------------------------------------------*\ -| This is the subtitles 'menu'. | +| This is the subtitles 'menu'. | \*-------------------------------------------------------------*/ -#ifndef JAPAN CONFBOX subtitlesBox[] = { -#ifdef USE_5FLAGS + { SLIDER, NOFUNC, NULL, SIX_TSPEED_SLIDER, 142, 20, 100, 2, &speedText, 0 }, + { TOGGLE, NOFUNC, NULL, SIX_STITLE_TOGGLE, 142, 20+40, 23, 19, &bSubtitles, 0 }, + +}; + +CONFBOX subtitlesBox3Flags[] = { + + { FRGROUP, NOFUNC, NULL, USE_POINTER, 15, 118, 56, 32, NULL, FIX_FR }, + { FRGROUP, NOFUNC, NULL, USE_POINTER, 85, 118, 56, 32, NULL, FIX_GR }, + { FRGROUP, NOFUNC, NULL, USE_POINTER, 155, 118, 56, 32, NULL, FIX_SP }, + + { SLIDER, NOFUNC, NULL, SIX_TSPEED_SLIDER, 142, 20, 100, 2, &speedText, 0 }, + { TOGGLE, NOFUNC, NULL, SIX_STITLE_TOGGLE, 142, 20+40, 23, 19, &bSubtitles, 0 }, + + { ARSGBUT, CLANG, NULL, USE_POINTER, 230, 110, 23, 19, NULL, IX_TICK1 }, + { AAGBUT, RLANG, NULL, USE_POINTER, 230, 140, 23, 19, NULL, IX_CROSS1 } + +}; + +CONFBOX subtitlesBox4Flags[] = { + + { FRGROUP, NOFUNC, NULL, USE_POINTER, 20, 100, 56, 32, NULL, FIX_FR }, + { FRGROUP, NOFUNC, NULL, USE_POINTER, 108, 100, 56, 32, NULL, FIX_GR }, + { FRGROUP, NOFUNC, NULL, USE_POINTER, 64, 137, 56, 32, NULL, FIX_IT }, + { FRGROUP, NOFUNC, NULL, USE_POINTER, 152, 137, 56, 32, NULL, FIX_SP }, + + { SLIDER, NOFUNC, NULL, SIX_TSPEED_SLIDER, 142, 20, 100, 2, &speedText, 0 }, + { TOGGLE, NOFUNC, NULL, SIX_STITLE_TOGGLE, 142, 20+40, 23, 19, &bSubtitles, 0 }, + + { ARSGBUT, CLANG, NULL, USE_POINTER, 230, 110, 23, 19, NULL, IX_TICK1 }, + { AAGBUT, RLANG, NULL, USE_POINTER, 230, 140, 23, 19, NULL, IX_CROSS1 } + +}; + +CONFBOX subtitlesBox5Flags[] = { + { FRGROUP, NOFUNC, NULL, USE_POINTER, 15, 100, 56, 32, NULL, FIX_UK }, { FRGROUP, NOFUNC, NULL, USE_POINTER, 85, 100, 56, 32, NULL, FIX_FR }, { FRGROUP, NOFUNC, NULL, USE_POINTER, 155, 100, 56, 32, NULL, FIX_GR }, { FRGROUP, NOFUNC, NULL, USE_POINTER, 50, 137, 56, 32, NULL, FIX_IT }, { FRGROUP, NOFUNC, NULL, USE_POINTER, 120, 137, 56, 32, NULL, FIX_SP }, -#endif -#ifdef USE_4FLAGS - { FRGROUP, NOFUNC, NULL, USE_POINTER, 20, 100, 56, 32, NULL, FIX_FR }, - { FRGROUP, NOFUNC, NULL, USE_POINTER, 108, 100, 56, 32, NULL, FIX_GR }, - { FRGROUP, NOFUNC, NULL, USE_POINTER, 64, 137, 56, 32, NULL, FIX_IT }, - { FRGROUP, NOFUNC, NULL, USE_POINTER, 152, 137, 56, 32, NULL, FIX_SP }, -#endif -#ifdef USE_3FLAGS - { FRGROUP, NOFUNC, NULL, USE_POINTER, 15, 118, 56, 32, NULL, FIX_FR }, - { FRGROUP, NOFUNC, NULL, USE_POINTER, 85, 118, 56, 32, NULL, FIX_GR }, - { FRGROUP, NOFUNC, NULL, USE_POINTER, 155, 118, 56, 32, NULL, FIX_SP }, -#endif { SLIDER, NOFUNC, NULL, SIX_TSPEED_SLIDER, 142, 20, 100, 2, &speedText, 0 }, { TOGGLE, NOFUNC, NULL, SIX_STITLE_TOGGLE, 142, 20+40, 23, 19, &bSubtitles, 0 }, -#if defined(USE_3FLAGS) || defined(USE_4FLAGS) || defined(USE_5FLAGS) { ARSGBUT, CLANG, NULL, USE_POINTER, 230, 110, 23, 19, NULL, IX_TICK1 }, { AAGBUT, RLANG, NULL, USE_POINTER, 230, 140, 23, 19, NULL, IX_CROSS1 } -#endif }; -#endif /*-------------------------------------------------------------*\ @@ -610,7 +623,7 @@ CONFBOX subtitlesBox[] = { \*-------------------------------------------------------------*/ CONFBOX quitBox[] = { -#ifdef JAPAN +#ifdef g { AAGBUT, IQUITGAME, NULL, USE_POINTER,70, 44, 23, 19, NULL, IX_TICK1 }, { AAGBUT, CLOSEWIN, NULL, USE_POINTER, 30, 44, 23, 19, NULL, IX_CROSS1 } #else @@ -652,13 +665,9 @@ CONFINIT ciSound = { 10, 5, 20, 16, false, soundBox, ARRAYSIZE(soundBox), NO_HEA #else CONFINIT ciControl = { 10, 5, 20, 16, false, controlBox, ARRAYSIZE(controlBox), NO_HEADING }; #endif -#ifndef JAPAN -#if defined(USE_3FLAGS) || defined(USE_4FLAGS) || defined(USE_5FLAGS) -CONFINIT ciSubtitles = { 10, 6, 20, 16, false, subtitlesBox, ARRAYSIZE(subtitlesBox), NO_HEADING }; -#else + CONFINIT ciSubtitles = { 10, 3, 20, 16, false, subtitlesBox, ARRAYSIZE(subtitlesBox), NO_HEADING }; -#endif -#endif + CONFINIT ciQuit = { 4, 2, 98, 53, false, quitBox, ARRAYSIZE(quitBox), SIX_QUIT_HEADING }; CONFINIT ciTopWin = { 6, 5, 72, 23, false, topwinBox, 0, NO_HEADING }; @@ -762,45 +771,39 @@ static void ConfActionSpecial(int i); -#ifndef JAPAN bool LanguageChange(void) { - LANGUAGE nLang; - -#ifdef USE_3FLAGS - // VERY quick dodgy bodge - if (cd.selBox == 0) - nLang = TXT_FRENCH; - else if (cd.selBox == 1) - nLang = TXT_GERMAN; - else - nLang = TXT_SPANISH; - if (nLang != language) { -#elif defined(USE_4FLAGS) - nLang = (LANGUAGE)(cd.selBox + 1); - if (nLang != language) { -#else - if (cd.selBox != language) { + LANGUAGE nLang = TXT_ENGLISH; + + if (_vm->getFeatures() & GF_USE_3FLAGS) { + // VERY quick dodgy bodge + if (cd.selBox == 0) + nLang = TXT_FRENCH; // = 1 + else if (cd.selBox == 1) + nLang = TXT_GERMAN; // = 2 + else + nLang = TXT_SPANISH; // = 4 + } else if (_vm->getFeatures() & GF_USE_4FLAGS) { + nLang = (LANGUAGE)(cd.selBox + 1); + } else if (_vm->getFeatures() & GF_USE_5FLAGS) { nLang = (LANGUAGE)cd.selBox; -#endif + } + + if (nLang != g_language) { KillInventory(); ChangeLanguage(nLang); - language = nLang; + g_language = nLang; return true; - } - else + } else return false; } -#endif /**************************************************************************/ /******************** Some miscellaneous functions ************************/ /**************************************************************************/ -/*---------------------------------------------------------------------*\ -| DumpIconArray()/DumpDobjArray()/DumpObjArray() | -|-----------------------------------------------------------------------| -| Delete all the objects in iconArray[]/DobjArray[]/objArray[] | -\*---------------------------------------------------------------------*/ +/** + * Delete all the objects in iconArray[] + */ static void DumpIconArray(void){ for (int i = 0; i < MAX_ICONS; i++) { if (iconArray[i] != NULL) { @@ -813,7 +816,6 @@ static void DumpIconArray(void){ /** * Delete all the objects in DobjArray[] */ - static void DumpDobjArray(void) { for (int i = 0; i < MAX_WCOMP; i++) { if (DobjArray[i] != NULL) { @@ -826,7 +828,6 @@ static void DumpDobjArray(void) { /** * Delete all the objects in objArray[] */ - static void DumpObjArray(void) { for (int i = 0; i < MAX_WCOMP; i++) { if (objArray[i] != NULL) { @@ -886,7 +887,6 @@ bool IsInInventory(int object, int invnum) { /** * Returns which item is held (INV_NOICON (-1) if none) */ - int WhichItemHeld(void) { return HeldItem; } @@ -895,7 +895,6 @@ int WhichItemHeld(void) { * Called from the cursor module when it re-initialises (at the start of * a new scene). For if we are holding something at scene-change time. */ - void InventoryIconCursor(void) { INV_OBJECT *invObj; @@ -908,7 +907,6 @@ void InventoryIconCursor(void) { /** * Returns TRUE if the inventory is active. */ - bool InventoryActive(void) { return (InventoryState == ACTIVE_INV); } @@ -1214,8 +1212,8 @@ void Select(int i, bool force) { break; -#if defined(USE_3FLAGS) || defined(USE_4FLAGS) || defined(USE_5FLAGS) case FRGROUP: + assert((_vm->getFeatures() & GF_USE_3FLAGS) || (_vm->getFeatures() & GF_USE_4FLAGS) || (_vm->getFeatures() & GF_USE_5FLAGS)); iconArray[HL2] = RectangleObject(BackPal(), COL_HILIGHT, cd.Box[i].w+6, cd.Box[i].h+6); MultiInsertObject(GetPlayfieldList(FIELD_STATUS), iconArray[HL2]); MultiSetAniXY(iconArray[HL2], @@ -1224,7 +1222,7 @@ void Select(int i, bool force) { MultiSetZPosition(iconArray[HL2], Z_INV_BRECT+1); break; -#endif + default: break; } @@ -1276,7 +1274,6 @@ void DropItem(int item) { * Stick the item into an inventory list (ItemOrder[]), and hold the * item if requested. */ - void AddToInventory(int invno, int icon, bool hold) { int i; bool bOpen; @@ -1407,12 +1404,12 @@ int InvArea(int x, int y) { int RightX = MultiRightmost(RectObject) + 1; int BottomY = MultiLowest(RectObject) + 1; -// Outside the whole rectangle? + // Outside the whole rectangle? if (x <= LeftX - EXTRA || x > RightX + EXTRA || y <= TopY - EXTRA || y > BottomY + EXTRA) return I_NOTIN; -// The bottom line + // The bottom line if (y > BottomY - 2 - EXTRA) { // Below top of bottom line? if (x <= LeftX + 2 + EXTRA) return I_BLEFT; // Bottom left corner @@ -1422,7 +1419,7 @@ int InvArea(int x, int y) { return I_BOTTOM; // Just plain bottom } -// The top line + // The top line if (y <= TopY + 2 + EXTRA) { // Above bottom of top line? if (x <= LeftX + 2 + EXTRA) return I_TLEFT; // Top left corner @@ -1432,24 +1429,24 @@ int InvArea(int x, int y) { return I_TOP; // Just plain top } -// Sides + // Sides if (x <= LeftX + 2 + EXTRA) // Left of right of left side? return I_LEFT; else if (x > RightX - 2 - EXTRA) // Right of left of right side? return I_RIGHT; -// From here down still needs fixing up properly -/* -* In the move area? -*/ + // From here down still needs fixing up properly + /* + * In the move area? + */ if (ino != INV_CONF && x >= LeftX + M_SW - 2 && x <= RightX - M_SW + 3 && y >= TopY + M_TH - 2 && y < TopY + M_TBB + 2) return I_MOVE; -/* -* Scroll bits -*/ + /* + * Scroll bits + */ if (ino == INV_CONF && cd.bExtraWin) { } else { if (x > RightX - M_IAL + 3 && x <= RightX - M_IAR + 1) { @@ -1476,7 +1473,6 @@ int InvArea(int x, int y) { * Returns the id of the icon displayed under the given position. * Also return co-ordinates of items tag display position, if requested. */ - int InvItem(int *x, int *y, bool update) { int itop, ileft; int row, col; @@ -1510,7 +1506,6 @@ int InvItem(int *x, int *y, bool update) { /** * Returns the id of the icon displayed under the given position. */ - int InvItemId(int x, int y) { int itop, ileft; int row, col; @@ -1539,21 +1534,21 @@ int InvItemId(int x, int y) { return INV_NOICON; } -/*---------------------------------------------------------------------*\ -| WhichInvBox() | -|-----------------------------------------------------------------------| -| Finds which box the cursor is in. | -\*---------------------------------------------------------------------*/ -#define MD_YSLIDTOP 7 -#define MD_YSLIDBOT 18 -#define MD_YBUTTOP 9 -#define MD_YBUTBOT 16 -#define MD_XLBUTL 1 -#define MD_XLBUTR 10 -#define MD_XRBUTL 105 -#define MD_XRBUTR 114 - +/** + * Finds which box the cursor is in. + */ static int WhichInvBox(int curX, int curY, bool bSlides) { + enum { + MD_YSLIDTOP = 7, + MD_YSLIDBOT = 18, + MD_YBUTTOP = 9, + MD_YBUTBOT = 16, + MD_XLBUTL = 1, + MD_XLBUTR = 10, + MD_XRBUTL = 105, + MD_XRBUTR = 114 + }; + if (bSlides) { for (int i = 0; i < numMdSlides; i++) { if (curY > MultiHighest(mdSlides[i].obj) && curY < MultiLowest(mdSlides[i].obj) @@ -1841,7 +1836,6 @@ void InvLabels(bool InBody, int aniX, int aniY) { * It seems to set up slideStuff[], an array of possible first-displayed * icons set against the matching y-positions of the slider. */ - void AdjustTop(void) { int tMissing, bMissing, nMissing; int nslideY; @@ -1904,7 +1898,6 @@ void AdjustTop(void) { /** * Insert an inventory icon object onto the display list. */ - OBJECT *AddInvObject(int num, const FREEL **pfreel, const FILM **pfilm) { INV_OBJECT *invObj; // Icon data const MULTI_INIT *pmi; // Its INIT structure - from the reel @@ -1929,7 +1922,6 @@ OBJECT *AddInvObject(int num, const FREEL **pfreel, const FILM **pfilm) { /** * Create display objects for the displayed icons in an inventory window. */ - void FillInInventory(void) { int Index; // Index into ItemOrder[] int n = 0; // index into iconArray[] @@ -2010,7 +2002,6 @@ void AddBackground(OBJECT **rect, OBJECT **title, int extraH, int extraV, int te /** * Insert a part of the inventory window frame onto the display list. */ - static OBJECT *AddObject(const FREEL *pfreel, int num) { const MULTI_INIT *pmi; // Get the MULTI_INIT structure IMAGE *pim; @@ -2043,7 +2034,6 @@ static OBJECT *AddObject(const FREEL *pfreel, int num) { /** * Display the scroll bar slider. */ - void AddSlider(OBJECT **slide, const FILM *pfilm) { SlideObject = *slide = AddObject(&pfilm->reels[IX_SLIDE], -1); MultiSetAniXY(*slide, MultiRightmost(RectObject)-M_SXOFF+2, InvD[ino].inventoryY + slideY); @@ -2062,7 +2052,6 @@ enum { /** * Display a box with some text in it. */ - void AddBox(int *pi, int i) { int x = InvD[ino].inventoryX + cd.Box[i].xpos; int y = InvD[ino].inventoryY + cd.Box[i].ypos; @@ -2126,8 +2115,8 @@ void AddBox(int *pi, int i) { break; -#if defined(USE_3FLAGS) || defined(USE_4FLAGS) || defined(USE_5FLAGS) case FRGROUP: + assert((_vm->getFeatures() & GF_USE_3FLAGS) || (_vm->getFeatures() & GF_USE_4FLAGS) || (_vm->getFeatures() & GF_USE_5FLAGS)); assert(flagFilm != 0); // Language flags not declared! pfilm = (const FILM *)LockMem(flagFilm); @@ -2141,7 +2130,7 @@ void AddBox(int *pi, int i) { *pi += 1; break; -#endif + case FLIP: pfilm = (const FILM *)LockMem(winPartsf); @@ -2234,7 +2223,6 @@ static void AddBoxes(bool posnSlide) { /** * Display the scroll bar slider. */ - void AddEWSlider(OBJECT **slide, const FILM *pfilm) { SlideObject = *slide = AddObject(&pfilm->reels[IX_SLIDE], -1); MultiSetAniXY(*slide, InvD[ino].inventoryX + 24 + 127, slideY); @@ -2244,7 +2232,6 @@ void AddEWSlider(OBJECT **slide, const FILM *pfilm) { /** * AddExtraWindow */ - int AddExtraWindow(int x, int y, OBJECT **retObj) { int n = 0; const FILM *pfilm; @@ -2479,7 +2466,7 @@ void ConstructInventory(InventoryType filling) { OBJECT **rect, **title; -// Draw background, slider and icons + // Draw background, slider and icons if (filling == FULL) { rect = &retObj[n++]; title = &retObj[n++]; @@ -2495,8 +2482,7 @@ void ConstructInventory(InventoryType filling) { } FillInInventory(); - } - else if (filling == CONF) { + } else if (filling == CONF) { rect = &retObj[n++]; title = &retObj[n++]; @@ -2800,7 +2786,6 @@ bool convHid(void) { /** * Start up an inventory window. */ - void PopUpInventory(int invno) { assert((invno == INV_1 || invno == INV_2 || invno == INV_CONV || invno == INV_CONF)); // Trying to open illegal inventory @@ -2849,7 +2834,6 @@ void SetConfGlobals(CONFINIT *ci) { /** * PopupConf */ - void PopUpConf(CONFTYPE type) { int curX, curY; @@ -2903,11 +2887,27 @@ void PopUpConf(CONFTYPE type) { SetConfGlobals(&ciSound); break; -#ifndef JAPAN case SUBT: + if (_vm->getFeatures() & GF_USE_3FLAGS) { + ciSubtitles.v = 6; + ciSubtitles.Box = subtitlesBox3Flags; + ciSubtitles.NumBoxes = ARRAYSIZE(subtitlesBox3Flags); + } else if (_vm->getFeatures() & GF_USE_4FLAGS) { + ciSubtitles.v = 6; + ciSubtitles.Box = subtitlesBox4Flags; + ciSubtitles.NumBoxes = ARRAYSIZE(subtitlesBox4Flags); + } else if (_vm->getFeatures() & GF_USE_5FLAGS) { + ciSubtitles.v = 6; + ciSubtitles.Box = subtitlesBox4Flags; + ciSubtitles.NumBoxes = ARRAYSIZE(subtitlesBox4Flags); + } else { + ciSubtitles.v = 3; + ciSubtitles.Box = subtitlesBox; + ciSubtitles.NumBoxes = ARRAYSIZE(subtitlesBox); + } + SetConfGlobals(&ciSubtitles); break; -#endif case TOPWIN: SetConfGlobals(&ciTopWin); @@ -2927,25 +2927,21 @@ void PopUpConf(CONFTYPE type) { if (type == SAVE || type == LOAD) Select(0, false); -#ifndef JAPAN -#if !defined(USE_3FLAGS) || !defined(USE_4FLAGS) || !defined(USE_5FLAGS) else if (type == SUBT) { -#ifdef USE_3FLAGS - // VERY quick dirty bodges - if (language == TXT_FRENCH) - Select(0, false); - else if (language == TXT_GERMAN) - Select(1, false); - else - Select(2, false); -#elif defined(USE_4FLAGS) - Select(language-1, false); -#else - Select(language, false); -#endif + if (_vm->getFeatures() & GF_USE_3FLAGS) { + // VERY quick dirty bodges + if (g_language == TXT_FRENCH) + Select(0, false); + else if (g_language == TXT_GERMAN) + Select(1, false); + else + Select(2, false); + } else if (_vm->getFeatures() & GF_USE_4FLAGS) { + Select(g_language-1, false); + } else if (_vm->getFeatures() & GF_USE_5FLAGS) { + Select(g_language, false); + } } -#endif -#endif // JAPAN GetCursorXY(&curX, &curY, false); InvCursor(IC_AREA, curX, curY); @@ -2954,7 +2950,6 @@ void PopUpConf(CONFTYPE type) { /** * Close down an inventory window. */ - void KillInventory(void) { if (objArray[0] != NULL) { DumpObjArray(); @@ -2976,6 +2971,9 @@ void KillInventory(void) { if (bOpenConf) { bOpenConf = false; PopUpConf(OPTION); + + // Write config changes + WriteConfig(); } else if (ino == INV_CONF) InventoryIconCursor(); } @@ -3098,12 +3096,10 @@ void InventoryProcess(CORO_PARAM, const void *) { KillInventory(); PopUpConf(CONTROLS); break; - #ifndef JAPAN case OPENSUBT: KillInventory(); PopUpConf(SUBT); break; - #endif case OPENQUIT: KillInventory(); PopUpConf(QUIT); @@ -3112,7 +3108,6 @@ void InventoryProcess(CORO_PARAM, const void *) { KillInventory(); bRestart = true; break; - #if defined(USE_3FLAGS) || defined(USE_4FLAGS) || defined(USE_5FLAGS) case CLANG: if (!LanguageChange()) KillInventory(); @@ -3120,7 +3115,6 @@ void InventoryProcess(CORO_PARAM, const void *) { case RLANG: KillInventory(); break; - #endif default: break; } @@ -3344,10 +3338,8 @@ static void SlideMSlider(int x, SSFN fn) { case S_END: // End of a drag on the slider AddBoxes(false); // Might change position slightly -#ifndef JAPAN if (ino == INV_CONF && cd.Box == subtitlesBox) - Select(language, false); -#endif + Select(g_language, false); break; } } @@ -3780,8 +3772,8 @@ void ConfAction(int i, bool dbl) { } break; -#if defined(USE_3FLAGS) || defined(USE_4FLAGS) || defined(USE_5FLAGS) case FRGROUP: + assert((_vm->getFeatures() & GF_USE_3FLAGS) || (_vm->getFeatures() & GF_USE_4FLAGS) || (_vm->getFeatures() & GF_USE_5FLAGS)); if (dbl) { Select(i, false); LanguageChange(); @@ -3789,7 +3781,6 @@ void ConfAction(int i, bool dbl) { Select(i, false); } break; -#endif case AAGBUT: case ARSGBUT: diff --git a/engines/tinsel/music.cpp b/engines/tinsel/music.cpp index 7d4efd8079..4d77ee4ace 100644 --- a/engines/tinsel/music.cpp +++ b/engines/tinsel/music.cpp @@ -343,8 +343,6 @@ MusicPlayer::~MusicPlayer() { } void MusicPlayer::setVolume(int volume) { - Common::StackLock lock(_mutex); - // FIXME: Could we simply change MAXMIDIVOL to match ScummVM's range? volume = CLIP((255 * volume) / MAXMIDIVOL, 0, 255); _vm->_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, volume); @@ -354,6 +352,8 @@ void MusicPlayer::setVolume(int volume) { _masterVolume = volume; + Common::StackLock lock(_mutex); + for (int i = 0; i < 16; ++i) { if (_channel[i]) { _channel[i]->volume(_channelVolume[i] * _masterVolume / 255); diff --git a/engines/tinsel/tinlib.cpp b/engines/tinsel/tinlib.cpp index bf980f0983..07c1b22b2a 100644 --- a/engines/tinsel/tinlib.cpp +++ b/engines/tinsel/tinlib.cpp @@ -1991,7 +1991,6 @@ void topplay(CORO_PARAM, SCNHANDLE film, int x, int y, int complete, int actorid /** * Open or close the 'top window' */ - void topwindow(int bpos) { assert(bpos == TW_START || bpos == TW_END); @@ -2010,7 +2009,6 @@ void topwindow(int bpos) { /** * unhookscene */ - void unhookscene(void) { UnHookScene(); } @@ -2018,7 +2016,6 @@ void unhookscene(void) { /** * Un-define an actor as tagged. */ - void untagactor(int actor) { UnTagActor(actor); } @@ -2026,14 +2023,12 @@ void untagactor(int actor) { /** * vibrate */ - void vibrate(void) { } /** * waitframe(int actor, int frameNumber) */ - void waitframe(CORO_PARAM, int actor, int frameNumber, bool escOn, int myescEvent) { CORO_BEGIN_CONTEXT; CORO_END_CONTEXT(_ctx); @@ -2056,7 +2051,6 @@ void waitframe(CORO_PARAM, int actor, int frameNumber, bool escOn, int myescEven /** * Return when a key pressed or button pushed. */ - void waitkey(CORO_PARAM, bool escOn, int myescEvent) { CORO_BEGIN_CONTEXT; int startEvent; @@ -2104,7 +2098,6 @@ void waitkey(CORO_PARAM, bool escOn, int myescEvent) { /** * Pause for requested time. */ - void waittime(CORO_PARAM, int time, bool frame, bool escOn, int myescEvent) { CORO_BEGIN_CONTEXT; int time; @@ -2261,7 +2254,6 @@ void walkingactor(uint32 id, SCNHANDLE *rp) { * Walk a moving actor towards the polygon's tag, but return when the * actor enters the polygon. */ - void walkpoly(CORO_PARAM, int actor, SCNHANDLE film, HPOLYGON hp, bool escOn, int myescEvent) { // COROUTINE CORO_BEGIN_CONTEXT; @@ -2309,7 +2301,6 @@ void walkpoly(CORO_PARAM, int actor, SCNHANDLE film, HPOLYGON hp, bool escOn, in /** * walktag(actor, reel, hold) */ - void walktag(CORO_PARAM, int actor, SCNHANDLE film, HPOLYGON hp, bool escOn, int myescEvent) { // COROUTINE CORO_BEGIN_CONTEXT; @@ -2385,7 +2376,6 @@ void walktag(CORO_PARAM, int actor, SCNHANDLE film, HPOLYGON hp, bool escOn, int /** * whichinventory */ - int whichinventory(void) { return WhichInventoryOpen(); } diff --git a/engines/tinsel/tinsel.cpp b/engines/tinsel/tinsel.cpp index c91fecf84e..70dd0170b4 100644 --- a/engines/tinsel/tinsel.cpp +++ b/engines/tinsel/tinsel.cpp @@ -206,13 +206,16 @@ void KeyboardProcess(CORO_PARAM, const void *) { { int sceneOffset = (_vm->getFeatures() & GF_SCNFILES) ? 1 : 0; int sceneNumber = (GetSceneHandle() >> SCNHANDLE_SHIFT) - sceneOffset; - if ((language == TXT_GERMAN) && +#if 0 // FIXME: Disabled this code for now, as it doesn't work as it should (see bug #2078922). + if ((g_language == TXT_GERMAN) && ((sceneNumber >= 25 && sceneNumber <= 27) || (sceneNumber == 17))) { // Skip to title screen // It seems the German CD version uses scenes 25,26,27,17 for the intro, // instead of 13,14,15,11; also, the title screen is 11 instead of 10 SetNewScene((11 + sceneOffset) << SCNHANDLE_SHIFT, 1, TRANS_CUT); - } else if ((sceneNumber >= 13) && (sceneNumber <= 15) || (sceneNumber == 11)) { + } else +#endif + if ((sceneNumber >= 13) && (sceneNumber <= 15) || (sceneNumber == 11)) { // Skip to title screen SetNewScene((10 + sceneOffset) << SCNHANDLE_SHIFT, 1, TRANS_CUT); } else { @@ -695,25 +698,8 @@ int TinselEngine::init() { // TODO: More stuff from dos_main.c may have to be added here - // Set language - we'll be clever here and use the ScummVM language setting - language = TXT_ENGLISH; - switch (getLanguage()) { - case Common::FR_FRA: - language = TXT_FRENCH; - break; - case Common::DE_DEU: - language = TXT_GERMAN; - break; - case Common::IT_ITA: - language = TXT_ITALIAN; - break; - case Common::ES_ESP: - language = TXT_SPANISH; - break; - default: - language = TXT_ENGLISH; - } - ChangeLanguage(language); + // load in text strings + ChangeLanguage(g_language); // load in graphics info SetupHandleTable(); diff --git a/engines/tinsel/tinsel.h b/engines/tinsel/tinsel.h index 347a344519..369fd64a9b 100644 --- a/engines/tinsel/tinsel.h +++ b/engines/tinsel/tinsel.h @@ -55,12 +55,19 @@ enum TinselGameFeatures { GF_DEMO = 1 << 0, GF_CD = 1 << 1, GF_FLOPPY = 1 << 2, - GF_SCNFILES = 1 << 3 + GF_SCNFILES = 1 << 3, + + // The GF_USE_?FLAGS values specify how many country flags are displayed + // in the subtitles options dialog. + // None of these defined -> 1 language, in ENGLISH.TXT + GF_USE_3FLAGS = 1 << 4, // French, German, Spanish + GF_USE_4FLAGS = 1 << 5, // French, German, Spanish, Italian + GF_USE_5FLAGS = 1 << 6 // All 5 flags }; enum TinselEngineVersion { - TINSEL_V0 = 1 << 0, // Used in the DW1 demo only - TINSEL_V1 = 1 << 1 + TINSEL_V0 = 0, // Used in the DW1 demo only + TINSEL_V1 = 1 }; struct TinselGameDescription; @@ -72,7 +79,7 @@ enum TinselKeyDirection { typedef bool (*KEYFPTR)(const Common::KeyState &); -class TinselEngine : public ::Engine { +class TinselEngine : public Engine { int _gameId; Common::KeyState _keyPressed; Common::RandomSource _random; |