From 86b53e55d888c99a5fb7b07ad010456054af1575 Mon Sep 17 00:00:00 2001 From: lolbot-iichan Date: Mon, 27 Aug 2018 01:05:55 +0300 Subject: WINTERMUTE: Add FoxTail screen methods FoxTail use 2x, 3x, 4x, etc so-called "screen modes", that are switched between in Options menu. Current implementation makes FoxTail no choice but to think that 640x360 is the only option avaliable, since we don't want game engine to mess with ScummVM's render filter settings. --- engines/wintermute/base/base_game.cpp | 90 +++++++++++++++++++++++++++++++++++ engines/wintermute/wintermute.cpp | 4 ++ 2 files changed, 94 insertions(+) diff --git a/engines/wintermute/base/base_game.cpp b/engines/wintermute/base/base_game.cpp index 58195e6faa..81a34bd5bc 100644 --- a/engines/wintermute/base/base_game.cpp +++ b/engines/wintermute/base/base_game.cpp @@ -1983,6 +1983,96 @@ bool BaseGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack return STATUS_OK; } +#ifdef ENABLE_FOXTAIL + ////////////////////////////////////////////////////////////////////////// + // [FoxTail] GetScreenType + // Returns 0 on fullscreen and 1 on window + // Used to init and update controls at options.script and methods.script + ////////////////////////////////////////////////////////////////////////// + else if (strcmp(name, "GetScreenType") == 0) { + stack->correctParams(0); + int type = !g_system->getFeatureState(OSystem::kFeatureFullscreenMode); + stack->pushInt(type); + + return STATUS_OK; + } + + ////////////////////////////////////////////////////////////////////////// + // [FoxTail] GetScreenMode + // Returns integer to be used as a pixelization mode multiplier + // (e.g. it returns 2 for 640x360, 3 for 960x540, etc...) + // Used to init and update controls at options.script and methods.script + // This implementation always return 2 to fake window size of 2*320 x 2*180 + ////////////////////////////////////////////////////////////////////////// + else if (strcmp(name, "GetScreenMode") == 0) { + stack->correctParams(0); + stack->pushInt(2); + + return STATUS_OK; + } + + ////////////////////////////////////////////////////////////////////////// + // [FoxTail] GetDesktopDisplayMode + // Return struct with "w" and "h" fields in 1.2.362- + // Return array with "w" and "h" items in 1.2.527+ + // Used to init and update controls at options.script and methods.script + // w,h of actual desktop size expected to calcucate maximum available size + // Available screen modes are calcucated as 2...N, N*320correctParams(0); + stack->pushInt(2 * 180 + 1); + stack->pushInt(2 * 320 + 1); + + BaseScriptable *obj; + if (BaseEngine::instance().isFoxTail(FOXTAIL_1_2_527, FOXTAIL_LATEST_VERSION)) { + stack->pushInt(2); + obj = makeSXArray(_gameRef, stack); + } else { + stack->pushInt(0); + obj = makeSXObject(_gameRef, stack); + obj->scSetProperty("w", stack->pop()); + obj->scSetProperty("h", stack->pop()); + } + stack->pushNative(obj, false); + + return STATUS_OK; + } + + ////////////////////////////////////////////////////////////////////////// + // [FoxTail] SetScreenTypeMode + // This implementation ignores mode, toggles screen type only + // Used to change screen type&mode at options.script and methods.script + // Return value is never used + ////////////////////////////////////////////////////////////////////////// + else if (strcmp(name, "SetScreenTypeMode") == 0) { + stack->correctParams(2); + int type = stack->pop()->getInt(); + stack->pop()->getInt(); //mode is unused + g_system->beginGFXTransaction(); + g_system->setFeatureState(OSystem::kFeatureFullscreenMode, !type); + g_system->endGFXTransaction(); + stack->pushNULL(); + + return STATUS_OK; + } + + ////////////////////////////////////////////////////////////////////////// + // [FoxTail] ChangeWindowGrab + // Used at game.script on "Keypress" event on F11 + // Readme of FoxTail says: "F11 - free the mouse pointer from the window" + // This implementation does nothing + // Return value is never used + ////////////////////////////////////////////////////////////////////////// + else if (strcmp(name, "ChangeWindowGrab") == 0) { + stack->correctParams(0); + stack->pushNULL(); + + return STATUS_OK; + } +#endif + ////////////////////////////////////////////////////////////////////////// // ShowStatusLine ////////////////////////////////////////////////////////////////////////// diff --git a/engines/wintermute/wintermute.cpp b/engines/wintermute/wintermute.cpp index 0c8c8a9d1a..dec2025346 100644 --- a/engines/wintermute/wintermute.cpp +++ b/engines/wintermute/wintermute.cpp @@ -115,6 +115,10 @@ Common::Error WintermuteEngine::run() { Graphics::PixelFormat format(4, 8, 8, 8, 8, 24, 16, 8, 0); if (_gameDescription->adDesc.flags & GF_LOWSPEC_ASSETS) { initGraphics(320, 240, &format); +#ifdef ENABLE_FOXTAIL + } else if (BaseEngine::isFoxTailCheck(_gameDescription->targetExecutable)) { + initGraphics(640, 360, &format); +#endif } else { initGraphics(800, 600, &format); } -- cgit v1.2.3