WINTERMUTE: WME3D: Added game option to allow force 2d renderer for 2d games

This commit is contained in:
Paweł Kołodziejski 2022-07-16 12:53:25 +02:00
parent 79118af9a9
commit 6688e22195
No known key found for this signature in database
GPG Key ID: 0BDADC9E74440FF7
5 changed files with 39 additions and 6 deletions

View File

@ -417,6 +417,14 @@ bool BaseGame::initConfManSettings() {
_smartCache = true;
}
#ifdef ENABLE_WME3D
if (ConfMan.hasKey("force_2d_renderer")) {
_force2dRenderer = ConfMan.getBool("force_2d_renderer");
} else {
_force2dRenderer = false;
}
#endif
if (!_smartCache) {
LOG(0, "Smart cache is DISABLED");
}
@ -540,19 +548,20 @@ bool BaseGame::initialize2() { // we know whether we are going to be accelerated
Graphics::RendererType matchingRendererType = Graphics::Renderer::getBestMatchingType(desiredRendererType, availableRendererTypes);
bool force2dRenderer = _force2dRenderer && !_playing3DGame;
#if defined(USE_OPENGL_SHADERS)
if (matchingRendererType == Graphics::kRendererTypeOpenGLShaders) {
if (!force2dRenderer && matchingRendererType == Graphics::kRendererTypeOpenGLShaders) {
initGraphics3d(_settings->getResWidth(), _settings->getResHeight());
_renderer3D = makeOpenGL3DShaderRenderer(this);
}
#endif // defined(USE_OPENGL_SHADERS)
#if defined(USE_OPENGL_GAME)
if (matchingRendererType == Graphics::kRendererTypeOpenGL) {
if (!force2dRenderer && matchingRendererType == Graphics::kRendererTypeOpenGL) {
initGraphics3d(_settings->getResWidth(), _settings->getResHeight());
_renderer3D = makeOpenGL3DRenderer(this);
}
#endif // defined(USE_OPENGL)
if (matchingRendererType == Graphics::kRendererTypeTinyGL) {
if (!force2dRenderer && matchingRendererType == Graphics::kRendererTypeTinyGL) {
if (_playing3DGame) {
_renderer3D = nullptr;// TODO: makeTinyGL3DRenderer(this);
warning("3D software renderer is not supported yet");

View File

@ -315,6 +315,9 @@ protected:
private:
bool _debugShowFPS;
bool _bilinearFiltering;
#ifdef ENABLE_WME3D
bool _force2dRenderer;
#endif
void *_debugLogFile;
void DEBUG_DebugDisable();
void DEBUG_DebugEnable(const char *filename = nullptr);

View File

@ -70,6 +70,20 @@ static const ADExtraGuiOptionsMap gameGuiOptions[] = {
}
},
#ifdef ENABLE_WME3D
{
GAMEOPTION_FORCE_2D_RENDERER,
{
_s("Force to use 2D renderer (2D games only)"),
_s("This setting forces ScummVM to use 2D renderer while running 2D games"),
"force_2d_renderer",
false,
0,
0
}
},
#endif
AD_EXTRA_GUI_OPTIONS_TERMINATOR
};
@ -86,7 +100,11 @@ public:
// Use kADFlagUseExtraAsHint to distinguish between SD and HD versions
// of J.U.L.I.A. when their datafiles sit in the same directory (e.g. in Steam distribution).
_flags = kADFlagUseExtraAsHint;
#ifdef ENABLE_WME3D
_guiOptions = GUIO4(GUIO_NOMIDI, GAMEOPTION_SHOW_FPS, GAMEOPTION_BILINEAR, GAMEOPTION_FORCE_2D_RENDERER);
#else
_guiOptions = GUIO3(GUIO_NOMIDI, GAMEOPTION_SHOW_FPS, GAMEOPTION_BILINEAR);
#endif
_maxScanDepth = 2;
_directoryGlobs = directoryGlobs;
}

View File

@ -21,8 +21,11 @@
namespace Wintermute {
#define GAMEOPTION_SHOW_FPS GUIO_GAMEOPTIONS1
#define GAMEOPTION_BILINEAR GUIO_GAMEOPTIONS2
#define GAMEOPTION_SHOW_FPS GUIO_GAMEOPTIONS1
#define GAMEOPTION_BILINEAR GUIO_GAMEOPTIONS2
#ifdef ENABLE_WME3D
#define GAMEOPTION_FORCE_2D_RENDERER GUIO_GAMEOPTIONS3
#endif
static const PlainGameDescriptor wintermuteGames[] = {
{"5ld", "Five Lethal Demons"},

View File

@ -61,7 +61,7 @@ WintermuteEngine::WintermuteEngine(OSystem *syst, const WMEGameDescription *desc
// Put your engine in a sane state, but do nothing big yet;
// in particular, do not load data from files; rather, if you
// need to do such things, do them from init().
ConfMan.registerDefault("show_fps","false");
ConfMan.registerDefault("show_fps", "false");
// Do not initialize graphics here