STARK: Remove the StarkGameDescription service

It's not really needed anymore now there is a settings service
This commit is contained in:
Bastien Bouclet 2018-06-02 08:11:57 +02:00
parent 388eafac80
commit a27834fa76
6 changed files with 28 additions and 21 deletions

View File

@ -26,8 +26,6 @@
#include "common/singleton.h"
#include "common/scummsys.h"
struct ADGameDescription;
namespace Common {
class RandomSource;
}
@ -68,7 +66,6 @@ public:
gameInterface = nullptr;
userInterface = nullptr;
fontProvider = nullptr;
gameDescription = nullptr;
settings = nullptr;
}
@ -84,7 +81,6 @@ public:
GameInterface *gameInterface;
UserInterface *userInterface;
FontProvider *fontProvider;
const ADGameDescription *gameDescription;
Settings *settings;
};
@ -101,7 +97,6 @@ public:
#define StarkGameInterface StarkServices::instance().gameInterface
#define StarkUserInterface StarkServices::instance().userInterface
#define StarkFontProvider StarkServices::instance().fontProvider
#define StarkGameDescription StarkServices::instance().gameDescription
#define StarkSettings StarkServices::instance().settings
} // End of namespace Stark

View File

@ -29,10 +29,13 @@
#include "audio/mixer.h"
#include "engines/advancedDetector.h"
namespace Stark {
Settings::Settings(Audio::Mixer *mixer) :
_mixer(mixer) {
Settings::Settings(Audio::Mixer *mixer, const ADGameDescription *gd) :
_mixer(mixer),
_isDemo(gd->flags & ADGF_DEMO) {
// Initialize keys
_boolKey[kHighModel] = "enable_high_resolution_models";
_boolKey[kSubtitle] = "subtitles";

View File

@ -26,7 +26,8 @@
#include "common/config-manager.h"
#include "engines/stark/services/services.h"
#include "engines/advancedDetector.h"
struct ADGameDescription;
namespace Audio {
class Mixer;
@ -56,13 +57,18 @@ public:
kSfx
};
static bool isDemo() {
return StarkGameDescription->flags & ADGF_DEMO;
}
explicit Settings(Audio::Mixer *mixer);
Settings(Audio::Mixer *mixer, const ADGameDescription *gd);
~Settings() {}
/**
* Is this a demo version of the game?
*
* This is true either for 4-CD or 2-CD style demos
*/
bool isDemo() const {
return _isDemo;
}
/** Get the settings value */
bool getBoolSetting(BoolSettingIndex index) { return ConfMan.getBool(_boolKey[index]); }
int getIntSetting(IntSettingIndex index) { return ConfMan.getInt(_intKey[index]); }
@ -81,6 +87,7 @@ public:
private:
Audio::Mixer *_mixer;
bool _hasLowRes;
const bool _isDemo;
const char *_boolKey[6];
const char *_intKey[3];

View File

@ -121,7 +121,7 @@ Common::Error StarkEngine::run() {
_diary = new Diary();
_gameInterface = new GameInterface();
_userInterface = new UserInterface(_gfx);
_settings = new Settings(_mixer);
_settings = new Settings(_mixer, _gameDescription);
// Setup the public services
StarkServices &services = StarkServices::instance();
@ -137,7 +137,6 @@ Common::Error StarkEngine::run() {
services.gameInterface = _gameInterface;
services.userInterface = _userInterface;
services.fontProvider = _fontProvider;
services.gameDescription = _gameDescription;
services.settings = _settings;
// Load global resources

View File

@ -23,9 +23,10 @@
#ifndef STARK_H
#define STARK_H
#include "engines/advancedDetector.h"
#include "engines/engine.h"
struct ADGameDescription;
namespace Common {
class RandomSource;
}
@ -54,21 +55,21 @@ class Settings;
class StarkEngine : public Engine {
public:
StarkEngine(OSystem *syst, const ADGameDescription *gameDesc);
virtual ~StarkEngine();
~StarkEngine() override;
/** Build a save file name for the specified target and slot */
static Common::String formatSaveName(const char *target, int slot);
protected:
// Engine APIs
virtual Common::Error run() override;
virtual GUI::Debugger *getDebugger() override { return (GUI::Debugger *)_console; }
Common::Error run() override;
GUI::Debugger *getDebugger() override { return (GUI::Debugger *)_console; }
bool hasFeature(EngineFeature f) const override;
bool canLoadGameStateCurrently() override;
bool canSaveGameStateCurrently() override;
Common::Error loadGameState(int slot) override;
Common::Error saveGameState(int slot, const Common::String &desc) override;
virtual void pauseEngineIntern(bool pause) override;
void pauseEngineIntern(bool pause) override;
private:
void mainLoop();

View File

@ -27,11 +27,13 @@
#include "engines/stark/services/settings.h"
#include "common/config-manager.h"
#include "common/translation.h"
#include "gui/saveload.h"
#include "gui/message.h"
#include "engines/engine.h"
namespace Stark {
MainMenuScreen::MainMenuScreen(Gfx::Driver *gfx, Cursor *cursor) :