SCI: Use initializer list for all SciEngine members

Cleans up inconsistencies and excludes more SCI32 members
from SCI16-only builds
This commit is contained in:
sluicebox 2021-05-23 11:26:30 -06:00
parent 90a98160a9
commit a8dacadf40
2 changed files with 58 additions and 64 deletions

View file

@ -81,35 +81,60 @@
namespace Sci { namespace Sci {
SciEngine *g_sci = 0; SciEngine *g_sci = nullptr;
SciEngine::SciEngine(OSystem *syst, const ADGameDescription *desc, SciGameId gameId) SciEngine::SciEngine(OSystem *syst, const ADGameDescription *desc, SciGameId gameId) :
: Engine(syst), _gameDescription(desc), _gameId(gameId), _rng("sci") { Engine(syst),
_gfxAnimate(nullptr),
assert(g_sci == 0); _gfxCache(nullptr),
g_sci = this; _gfxCompare(nullptr),
_gfxControls16(nullptr),
_gfxMacIconBar = 0; _gfxCoordAdjuster(nullptr),
_gfxCursor(nullptr),
_audio = 0; _gfxMenu(nullptr),
_sync = nullptr; _gfxPalette16(nullptr),
_gfxRemap16(nullptr),
_gfxPaint16(nullptr),
_gfxPorts(nullptr),
_gfxScreen(nullptr),
_gfxText16(nullptr),
_gfxTransitions(nullptr),
_gfxMacIconBar(nullptr),
#ifdef ENABLE_SCI32 #ifdef ENABLE_SCI32
_audio32 = nullptr; _gfxControls32(nullptr),
_video32 = nullptr; _gfxPalette32(nullptr),
_gfxCursor32 = nullptr; _gfxRemap32(nullptr),
_gfxPaint32(nullptr),
_gfxText32(nullptr),
_audio32(nullptr),
_video32(nullptr),
_gfxFrameout(nullptr),
_gfxTransitions32(nullptr),
_gfxCursor32(nullptr),
#endif #endif
_guestAdditions = nullptr; _audio(nullptr),
_features = 0; _sync(nullptr),
_resMan = 0; _soundCmd(nullptr),
_gamestate = 0; _features(nullptr),
_kernel = 0; _guestAdditions(nullptr),
_vocabulary = 0; _opcode_formats(nullptr),
_vocabularyLanguage = 1; // we load english vocabulary on startup _debugState(),
_eventMan = 0; _gameDescription(desc),
_console = 0; _gameId(gameId),
_opcode_formats = 0; _resMan(nullptr),
_scriptPatcher(nullptr),
_gamestate(nullptr),
_kernel(nullptr),
_vocabulary(nullptr),
_vocabularyLanguage(1), // we load english vocabulary on startup
_eventMan(nullptr),
_gameObjectAddress(),
_console(nullptr),
_rng("sci"),
_forceHiresGraphics(false) {
_forceHiresGraphics = false; assert(g_sci == nullptr);
g_sci = this;
const Common::FSNode gameDataDir(ConfMan.get("path")); const Common::FSNode gameDataDir(ConfMan.get("path"));
@ -226,7 +251,7 @@ SciEngine::~SciEngine() {
delete _scriptPatcher; delete _scriptPatcher;
delete _resMan; // should be deleted last delete _resMan; // should be deleted last
g_sci = 0; g_sci = nullptr;
} }
extern int showScummVMDialog(const Common::U32String &message, const Common::U32String &altButton = Common::U32String(), bool alignCenter = true); extern int showScummVMDialog(const Common::U32String &message, const Common::U32String &altButton = Common::U32String(), bool alignCenter = true);
@ -246,9 +271,6 @@ Common::Error SciEngine::run() {
} }
*/ */
// Reset, so that error()s before SoundCommandParser is initialized wont cause a crash
_soundCmd = NULL;
// Add the after market patches for the specified game, if they exist // Add the after market patches for the specified game, if they exist
_resMan->addNewGMPatch(_gameId); _resMan->addNewGMPatch(_gameId);
_resMan->addNewD110Patch(_gameId); _resMan->addNewD110Patch(_gameId);
@ -278,8 +300,6 @@ Common::Error SciEngine::run() {
// Initialize the game screen // Initialize the game screen
_gfxScreen = new GfxScreen(_resMan); _gfxScreen = new GfxScreen(_resMan);
_gfxScreen->enableUndithering(ConfMan.getBool("disable_dithering")); _gfxScreen->enableUndithering(ConfMan.getBool("disable_dithering"));
} else {
_gfxScreen = nullptr;
} }
_kernel = new Kernel(_resMan, segMan); _kernel = new Kernel(_resMan, segMan);
@ -565,33 +585,6 @@ bool SciEngine::initGame() {
} }
void SciEngine::initGraphics() { void SciEngine::initGraphics() {
// Reset all graphics objects
_gfxAnimate = 0;
_gfxCache = 0;
_gfxCompare = 0;
_gfxControls16 = 0;
_gfxCoordAdjuster = 0;
_gfxCursor = 0;
_gfxMacIconBar = 0;
_gfxMenu = 0;
_gfxPaint16 = 0;
_gfxPalette16 = 0;
_gfxRemap16 = 0;
_gfxPorts = 0;
_gfxText16 = 0;
_gfxTransitions = 0;
#ifdef ENABLE_SCI32
_gfxControls32 = 0;
_gfxText32 = 0;
_gfxFrameout = 0;
_gfxPaint32 = 0;
_gfxPalette32 = 0;
_gfxRemap32 = 0;
_gfxTransitions32 = 0;
_gfxCursor32 = 0;
#endif
if (hasMacIconBar()) if (hasMacIconBar())
_gfxMacIconBar = new GfxMacIconBar(); _gfxMacIconBar = new GfxMacIconBar();

View file

@ -245,24 +245,25 @@ public:
GfxCache *_gfxCache; GfxCache *_gfxCache;
GfxCompare *_gfxCompare; GfxCompare *_gfxCompare;
GfxControls16 *_gfxControls16; // Controls for 16-bit gfx GfxControls16 *_gfxControls16; // Controls for 16-bit gfx
GfxControls32 *_gfxControls32; // Controls for 32-bit gfx
GfxCoordAdjuster16 *_gfxCoordAdjuster; GfxCoordAdjuster16 *_gfxCoordAdjuster;
GfxCursor *_gfxCursor; GfxCursor *_gfxCursor;
GfxMenu *_gfxMenu; // Menu for 16-bit gfx GfxMenu *_gfxMenu; // Menu for 16-bit gfx
GfxPalette *_gfxPalette16; GfxPalette *_gfxPalette16;
GfxPalette32 *_gfxPalette32; // Palette for 32-bit gfx
GfxRemap *_gfxRemap16; // Remapping for the QFG4 demo GfxRemap *_gfxRemap16; // Remapping for the QFG4 demo
GfxRemap32 *_gfxRemap32; // Remapping for 32-bit gfx
GfxPaint16 *_gfxPaint16; // Painting in 16-bit gfx GfxPaint16 *_gfxPaint16; // Painting in 16-bit gfx
GfxPaint32 *_gfxPaint32; // Painting in 32-bit gfx GfxPorts *_gfxPorts; // Port management for 16-bit gfx
GfxPorts *_gfxPorts; // Port managment for 16-bit gfx
GfxScreen *_gfxScreen; GfxScreen *_gfxScreen;
GfxText16 *_gfxText16; GfxText16 *_gfxText16;
GfxText32 *_gfxText32;
GfxTransitions *_gfxTransitions; // transitions between screens for 16-bit gfx GfxTransitions *_gfxTransitions; // transitions between screens for 16-bit gfx
GfxMacIconBar *_gfxMacIconBar; // Mac Icon Bar manager GfxMacIconBar *_gfxMacIconBar; // Mac Icon Bar manager
#ifdef ENABLE_SCI32 #ifdef ENABLE_SCI32
GfxControls32 *_gfxControls32; // Controls for 32-bit gfx
GfxPalette32 *_gfxPalette32; // Palette for 32-bit gfx
GfxRemap32 *_gfxRemap32; // Remapping for 32-bit gfx
GfxPaint32 *_gfxPaint32; // Painting in 32-bit gfx
GfxText32 *_gfxText32;
Audio32 *_audio32; Audio32 *_audio32;
Video32 *_video32; Video32 *_video32;
GfxFrameout *_gfxFrameout; // kFrameout and the like for 32-bit gfx GfxFrameout *_gfxFrameout; // kFrameout and the like for 32-bit gfx