ENGINES: Remove default1x scaler flag

This flag is removed for a few reasons:

* Engines universally set this flag to true for widths > 320,
  which made it redundant everywhere;
* This flag functioned primarily as a "force 1x scaler" flag,
  since its behaviour was almost completely undocumented and users
  would need to figure out that they'd need an explicit non-default
  scaler set to get a scaler to operate at widths > 320;
* (Most importantly) engines should not be in the business of
  deciding how the backend may choose to render its virtual screen.
  The choice of rendering behaviour belongs to the user, and the
  backend, in that order.

A nearby future commit restores the default1x scaler behaviour in
the SDL backend code for the moment, but in the future it is my
hope that there will be a better configuration UI to allow users
to specify how they want scaling to work for high resolutions.
This commit is contained in:
Colin Snover 2017-10-01 00:56:01 -05:00
parent ebe6c40a6a
commit 432fd522d2
86 changed files with 132 additions and 159 deletions

View file

@ -332,7 +332,6 @@ void SurfaceSdlGraphicsManager::beginGFXTransaction() {
_transactionDetails.needHotswap = false; _transactionDetails.needHotswap = false;
_transactionDetails.needUpdatescreen = false; _transactionDetails.needUpdatescreen = false;
_transactionDetails.normal1xScaler = false;
#if SDL_VERSION_ATLEAST(2, 0, 0) #if SDL_VERSION_ATLEAST(2, 0, 0)
_transactionDetails.needTextureUpdate = false; _transactionDetails.needTextureUpdate = false;
#endif #endif
@ -657,7 +656,6 @@ bool SurfaceSdlGraphicsManager::setGraphicsMode(int mode) {
return false; return false;
} }
_transactionDetails.normal1xScaler = (mode == GFX_NORMAL);
if (_oldVideoMode.setup && _oldVideoMode.scaleFactor != newScaleFactor) if (_oldVideoMode.setup && _oldVideoMode.scaleFactor != newScaleFactor)
_transactionDetails.needHotswap = true; _transactionDetails.needHotswap = true;

View file

@ -238,7 +238,6 @@ protected:
bool sizeChanged; bool sizeChanged;
bool needHotswap; bool needHotswap;
bool needUpdatescreen; bool needUpdatescreen;
bool normal1xScaler;
#if SDL_VERSION_ATLEAST(2, 0, 0) #if SDL_VERSION_ATLEAST(2, 0, 0)
bool needTextureUpdate; bool needTextureUpdate;
#endif #endif

View file

@ -153,7 +153,7 @@ AccessEngine::~AccessEngine() {
} }
void AccessEngine::setVGA() { void AccessEngine::setVGA() {
initGraphics(320, 200, false); initGraphics(320, 200);
} }
void AccessEngine::initialize() { void AccessEngine::initialize() {

View file

@ -681,7 +681,7 @@ void AdlEngine::gameLoop() {
} }
Common::Error AdlEngine::run() { Common::Error AdlEngine::run() {
initGraphics(DISPLAY_WIDTH * 2, DISPLAY_HEIGHT * 2, true); initGraphics(DISPLAY_WIDTH * 2, DISPLAY_HEIGHT * 2);
_console = new Console(this); _console = new Console(this);
_display = new Display(); _display = new Display();

View file

@ -210,7 +210,7 @@ int GfxMgr::initVideo() {
_displayPixels = _displayScreenWidth * _displayScreenHeight; _displayPixels = _displayScreenWidth * _displayScreenHeight;
_displayScreen = (byte *)calloc(_displayPixels, 1); _displayScreen = (byte *)calloc(_displayPixels, 1);
initGraphics(_displayScreenWidth, _displayScreenHeight, _displayScreenWidth > 320); initGraphics(_displayScreenWidth, _displayScreenHeight);
setPalette(true); // set gfx-mode palette setPalette(true); // set gfx-mode palette

View file

@ -577,7 +577,7 @@ Common::Error AGOSEngine::init() {
_screenHeight = 200; _screenHeight = 200;
} }
initGraphics(_screenWidth, _screenHeight, getGameType() == GType_FF || getGameType() == GType_PP); initGraphics(_screenWidth, _screenHeight);
_midi = new MidiPlayer(); _midi = new MidiPlayer();

View file

@ -68,7 +68,7 @@ GraphicManager::~GraphicManager() {
} }
void GraphicManager::init() { void GraphicManager::init() {
initGraphics(kScreenWidth, kScreenHeight * 2, true); // Doubling the height. initGraphics(kScreenWidth, kScreenHeight * 2); // Doubling the height.
for (int i = 0; i < 64; ++i) { for (int i = 0; i < 64; ++i) {
_egaPalette[i][0] = (i >> 2 & 1) * 0xaa + (i >> 5 & 1) * 0x55; _egaPalette[i][0] = (i >> 2 & 1) * 0xaa + (i >> 5 & 1) * 0x55;
@ -799,7 +799,7 @@ void GraphicManager::menuRefreshScreen() {
} }
void GraphicManager::menuInitialize() { void GraphicManager::menuInitialize() {
initGraphics(kScreenWidth, kMenuScreenHeight, true); initGraphics(kScreenWidth, kMenuScreenHeight);
_menu.create(kScreenWidth, kMenuScreenHeight, Graphics::PixelFormat::createFormatCLUT8()); _menu.create(kScreenWidth, kMenuScreenHeight, Graphics::PixelFormat::createFormatCLUT8());
} }
@ -808,7 +808,7 @@ void GraphicManager::menuFree() {
} }
void GraphicManager::menuRestoreScreen() { void GraphicManager::menuRestoreScreen() {
initGraphics(kScreenWidth, 2 * kScreenHeight, true); initGraphics(kScreenWidth, 2 * kScreenHeight);
} }
void GraphicManager::menuLoadPictures() { void GraphicManager::menuLoadPictures() {

View file

@ -170,7 +170,7 @@ Common::Error BbvsEngine::run() {
_isSaveAllowed = false; _isSaveAllowed = false;
_hasSnapshot = false; _hasSnapshot = false;
initGraphics(320, 240, false); initGraphics(320, 240);
_screen = new Screen(_system); _screen = new Screen(_system);
_gameModule = new GameModule(); _gameModule = new GameModule();

View file

@ -37,7 +37,7 @@ void BbvsEngine::playVideo(int videoNum) {
videoFilename = Common::String::format("vid/video%03d.avi", videoNum - 1); videoFilename = Common::String::format("vid/video%03d.avi", videoNum - 1);
// Set the correct video mode // Set the correct video mode
initGraphics(320, 240, false, 0); initGraphics(320, 240, nullptr);
if (_system->getScreenFormat().bytesPerPixel == 1) { if (_system->getScreenFormat().bytesPerPixel == 1) {
warning("Couldn't switch to a RGB color video mode to play a video."); warning("Couldn't switch to a RGB color video mode to play a video.");
return; return;
@ -84,7 +84,7 @@ void BbvsEngine::playVideo(int videoNum) {
delete videoDecoder; delete videoDecoder;
initGraphics(320, 240, false); initGraphics(320, 240);
} }

View file

@ -139,7 +139,7 @@ bool BladeRunnerEngine::hasFeature(EngineFeature f) const {
Common::Error BladeRunnerEngine::run() { Common::Error BladeRunnerEngine::run() {
Graphics::PixelFormat format = createRGB555(); Graphics::PixelFormat format = createRGB555();
initGraphics(640, 480, true, &format); initGraphics(640, 480, &format);
_system->showMouse(true); _system->showMouse(true);

View file

@ -219,7 +219,7 @@ Common::Error CGEEngine::run() {
} }
// Initialize graphics using following: // Initialize graphics using following:
initGraphics(kScrWidth, kScrHeight, false); initGraphics(kScrWidth, kScrHeight);
// Setup necessary game objects // Setup necessary game objects
init(); init();

View file

@ -191,7 +191,7 @@ bool CGE2Engine::hasFeature(EngineFeature f) const {
Common::Error CGE2Engine::run() { Common::Error CGE2Engine::run() {
syncSoundSettings(); syncSoundSettings();
initGraphics(kScrWidth, kScrHeight, false); initGraphics(kScrWidth, kScrHeight);
init(); init();
cge2_main(); cge2_main();

View file

@ -83,8 +83,8 @@ void ChewyEngine::initialize() {
Common::Error ChewyEngine::run() { Common::Error ChewyEngine::run() {
// Initialize backend // Initialize backend
//initGraphics(640, 480, true); //initGraphics(640, 480);
initGraphics(320, 200, false); initGraphics(320, 200);
initialize(); initialize();

View file

@ -99,7 +99,7 @@ Common::Error CineEngine::run() {
} }
// Initialize backend // Initialize backend
initGraphics(320, 200, false); initGraphics(320, 200);
if (g_cine->getGameType() == GType_FW && (g_cine->getFeatures() & GF_CD)) if (g_cine->getGameType() == GType_FW && (g_cine->getFeatures() & GF_CD))
checkCD(); checkCD();
@ -259,7 +259,7 @@ void CineEngine::showSplashScreen() {
const Graphics::Surface *surface = decoder.getSurface(); const Graphics::Surface *surface = decoder.getSurface();
if (surface->w == 640 && surface->h == 480) { if (surface->w == 640 && surface->h == 480) {
initGraphics(640, 480, true); initGraphics(640, 480);
const byte *palette = decoder.getPalette(); const byte *palette = decoder.getPalette();
int paletteColorCount = decoder.getPaletteColorCount(); int paletteColorCount = decoder.getPaletteColorCount();

View file

@ -101,7 +101,7 @@ Common::Error ComposerEngine::run() {
uint height = 480; uint height = 480;
if (_bookIni.hasKey("Height", "Common")) if (_bookIni.hasKey("Height", "Common"))
height = atoi(getStringFromConfig("Common", "Height").c_str()); height = atoi(getStringFromConfig("Common", "Height").c_str());
initGraphics(width, height, true); initGraphics(width, height);
_screen.create(width, height, Graphics::PixelFormat::createFormatCLUT8()); _screen.create(width, height, Graphics::PixelFormat::createFormatCLUT8());
Graphics::Cursor *cursor = Graphics::makeDefaultWinCursor(); Graphics::Cursor *cursor = Graphics::makeDefaultWinCursor();

View file

@ -84,7 +84,7 @@ bool CruiseEngine::hasFeature(EngineFeature f) const {
Common::Error CruiseEngine::run() { Common::Error CruiseEngine::run() {
// Initialize backend // Initialize backend
initGraphics(320, 200, false); initGraphics(320, 200);
if (!loadLanguageStrings()) { if (!loadLanguageStrings()) {
error("Could not setup language data for your version"); error("Could not setup language data for your version");

View file

@ -74,7 +74,7 @@ Common::Error CryoEngine::run() {
_timerTicks = 0; // incremented in realtime _timerTicks = 0; // incremented in realtime
// Initialize graphics using following: // Initialize graphics using following:
initGraphics(320, 200, false); initGraphics(320, 200);
_screen.create(320, 200, Graphics::PixelFormat::createFormatCLUT8()); _screen.create(320, 200, Graphics::PixelFormat::createFormatCLUT8());
_game->run(); _game->run();

View file

@ -228,7 +228,7 @@ void DirectorEngine::testFontScaling() {
int w = 640; int w = 640;
int h = 480; int h = 480;
initGraphics(w, h, true); initGraphics(w, h);
_system->getPaletteManager()->setPalette(defaultPalette, 0, 256); _system->getPaletteManager()->setPalette(defaultPalette, 0, 256);
Graphics::ManagedSurface surface; Graphics::ManagedSurface surface;

View file

@ -1170,7 +1170,7 @@ Common::Rect Score::readRect(Common::ReadStreamEndian &stream) {
} }
void Score::startLoop() { void Score::startLoop() {
initGraphics(_movieRect.width(), _movieRect.height(), true); initGraphics(_movieRect.width(), _movieRect.height());
_surface->create(_movieRect.width(), _movieRect.height()); _surface->create(_movieRect.width(), _movieRect.height());
_trailSurface->create(_movieRect.width(), _movieRect.height()); _trailSurface->create(_movieRect.width(), _movieRect.height());

View file

@ -357,7 +357,7 @@ Common::Error DMEngine::run() {
initConstants(); initConstants();
// scummvm/engine specific // scummvm/engine specific
initGraphics(320, 200, false); initGraphics(320, 200);
_console = new Console(this); _console = new Console(this);
_displayMan = new DisplayMan(this); _displayMan = new DisplayMan(this);
_dungeonMan = new DungeonMan(this); _dungeonMan = new DungeonMan(this);

View file

@ -150,7 +150,7 @@ static SoundArchive* openAnyPossibleDubbing() {
int DraciEngine::init() { int DraciEngine::init() {
// Initialize graphics using following: // Initialize graphics using following:
initGraphics(kScreenWidth, kScreenHeight, false); initGraphics(kScreenWidth, kScreenHeight);
// Open game's archives // Open game's archives
_initArchive = new BArchive(initPath); _initArchive = new BArchive(initPath);

View file

@ -236,7 +236,7 @@ bool DrasculaEngine::hasFeature(EngineFeature f) const {
Common::Error DrasculaEngine::run() { Common::Error DrasculaEngine::run() {
// Initialize backend // Initialize backend
initGraphics(320, 200, false); initGraphics(320, 200);
switch (getLanguage()) { switch (getLanguage()) {
case Common::EN_ANY: case Common::EN_ANY:

View file

@ -99,7 +99,7 @@ void DreamWebEngine::gettingShot() {
} }
void DreamWebEngine::bibleQuote() { void DreamWebEngine::bibleQuote() {
initGraphics(640, 480, true); initGraphics(640, 480);
showPCX("I00"); showPCX("I00");
fadeScreenUps(); fadeScreenUps();
@ -285,7 +285,7 @@ void DreamWebEngine::realCredits() {
_sound->loadRoomsSample(_roomsSample); _sound->loadRoomsSample(_roomsSample);
_sound->volumeSet(0); _sound->volumeSet(0);
initGraphics(640, 480, true); initGraphics(640, 480);
hangOn(35); hangOn(35);
showPCX("I01"); showPCX("I01");

View file

@ -151,7 +151,7 @@ void DreamWebEngine::doShake() {
void DreamWebEngine::setMode() { void DreamWebEngine::setMode() {
waitForVSync(); waitForVSync();
initGraphics(kScreenwidth, kScreenheight, false); initGraphics(kScreenwidth, kScreenheight);
} }
void DreamWebEngine::showPCX(const Common::String &suffix) { void DreamWebEngine::showPCX(const Common::String &suffix) {

View file

@ -194,38 +194,16 @@ void Engine::initializePath(const Common::FSNode &gamePath) {
SearchMan.addDirectory(gamePath.getPath(), gamePath, 0, 4); SearchMan.addDirectory(gamePath.getPath(), gamePath, 0, 4);
} }
void initCommonGFX(bool defaultTo1XScaler) { void initCommonGFX() {
const Common::ConfigManager::Domain *transientDomain = ConfMan.getDomain(Common::ConfigManager::kTransientDomain); const Common::ConfigManager::Domain *transientDomain = ConfMan.getDomain(Common::ConfigManager::kTransientDomain);
const Common::ConfigManager::Domain *gameDomain = ConfMan.getActiveDomain(); const Common::ConfigManager::Domain *gameDomain = ConfMan.getActiveDomain();
assert(transientDomain); assert(transientDomain);
const bool useDefaultGraphicsMode = // Override global scaler with any game-specific define
(!transientDomain->contains("gfx_mode") || if (ConfMan.hasKey("gfx_mode")) {
!scumm_stricmp(transientDomain->getVal("gfx_mode").c_str(), "normal") || Common::String gfxMode = ConfMan.get("gfx_mode");
!scumm_stricmp(transientDomain->getVal("gfx_mode").c_str(), "default") g_system->setGraphicsMode(gfxMode.c_str());
)
&&
(
!gameDomain ||
!gameDomain->contains("gfx_mode") ||
!scumm_stricmp(gameDomain->getVal("gfx_mode").c_str(), "normal") ||
!scumm_stricmp(gameDomain->getVal("gfx_mode").c_str(), "default")
);
// See if the game should default to 1x scaler
if (useDefaultGraphicsMode && defaultTo1XScaler) {
g_system->resetGraphicsScale();
} else {
// Override global scaler with any game-specific define
if (ConfMan.hasKey("gfx_mode")) {
Common::String gfxMode = ConfMan.get("gfx_mode");
g_system->setGraphicsMode(gfxMode.c_str());
// HACK: For OpenGL modes, we will still honor the graphics scale override
if (defaultTo1XScaler && gfxMode.equalsIgnoreCase("opengl"))
g_system->resetGraphicsScale();
}
} }
// Note: The following code deals with the fullscreen / ASR settings. This // Note: The following code deals with the fullscreen / ASR settings. This
@ -307,11 +285,11 @@ void splashScreen() {
splash = true; splash = true;
} }
void initGraphics(int width, int height, bool defaultTo1xScaler, const Graphics::PixelFormat *format) { void initGraphics(int width, int height, const Graphics::PixelFormat *format) {
g_system->beginGFXTransaction(); g_system->beginGFXTransaction();
initCommonGFX(defaultTo1xScaler); initCommonGFX();
#ifdef USE_RGB_COLOR #ifdef USE_RGB_COLOR
if (format) if (format)
g_system->initSize(width, height, format); g_system->initSize(width, height, format);
@ -399,20 +377,20 @@ inline PixelFormat findCompatibleFormat(Common::List<PixelFormat> backend, Commo
} }
void initGraphics(int width, int height, bool defaultTo1xScaler, const Common::List<Graphics::PixelFormat> &formatList) { void initGraphics(int width, int height, const Common::List<Graphics::PixelFormat> &formatList) {
Graphics::PixelFormat format = findCompatibleFormat(g_system->getSupportedFormats(), formatList); Graphics::PixelFormat format = findCompatibleFormat(g_system->getSupportedFormats(), formatList);
initGraphics(width, height, defaultTo1xScaler, &format); initGraphics(width, height, &format);
} }
void initGraphics(int width, int height, bool defaultTo1xScaler) { void initGraphics(int width, int height) {
Graphics::PixelFormat format = Graphics::PixelFormat::createFormatCLUT8(); Graphics::PixelFormat format = Graphics::PixelFormat::createFormatCLUT8();
initGraphics(width, height, defaultTo1xScaler, &format); initGraphics(width, height, &format);
} }
void GUIErrorMessage(const Common::String &msg) { void GUIErrorMessage(const Common::String &msg) {
g_system->setWindowCaption("Error"); g_system->setWindowCaption("Error");
g_system->beginGFXTransaction(); g_system->beginGFXTransaction();
initCommonGFX(false); initCommonGFX();
g_system->initSize(320, 200); g_system->initSize(320, 200);
if (g_system->endGFXTransaction() == OSystem::kTransactionSuccess) { if (g_system->endGFXTransaction() == OSystem::kTransactionSuccess) {
GUI::MessageDialog dialog(msg); GUI::MessageDialog dialog(msg);

View file

@ -280,7 +280,7 @@ Common::Error FullpipeEngine::saveGameState(int slot, const Common::String &desc
Common::Error FullpipeEngine::run() { Common::Error FullpipeEngine::run() {
const Graphics::PixelFormat format(4, 8, 8, 8, 8, 24, 16, 8, 0); const Graphics::PixelFormat format(4, 8, 8, 8, 8, 24, 16, 8, 0);
// Initialize backend // Initialize backend
initGraphics(800, 600, true, &format); initGraphics(800, 600, &format);
_backgroundSurface = new Graphics::Surface; _backgroundSurface = new Graphics::Surface;
_backgroundSurface->create(800, 600, format); _backgroundSurface->create(800, 600, format);

View file

@ -200,7 +200,7 @@ Common::Error GnapEngine::run() {
#else #else
Graphics::PixelFormat format = Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0); Graphics::PixelFormat format = Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0);
#endif #endif
initGraphics(800, 600, true, &format); initGraphics(800, 600, &format);
// We do not support color conversion yet // We do not support color conversion yet
if (_system->getScreenFormat() != format) if (_system->getScreenFormat() != format)

View file

@ -260,7 +260,7 @@ void GobEngine::setTrueColor(bool trueColor) {
_features = (_features & ~kFeaturesTrueColor) | (trueColor ? kFeaturesTrueColor : 0); _features = (_features & ~kFeaturesTrueColor) | (trueColor ? kFeaturesTrueColor : 0);
_video->setSize(is640x480()); _video->setSize();
_pixelFormat = g_system->getScreenFormat(); _pixelFormat = g_system->getScreenFormat();
@ -708,7 +708,7 @@ Common::Error GobEngine::initGraphics() {
_mode = 0x14; _mode = 0x14;
} }
_video->setSize(is640x480()); _video->setSize();
_pixelFormat = g_system->getScreenFormat(); _pixelFormat = g_system->getScreenFormat();

View file

@ -797,7 +797,7 @@ void Inter_v2::o2_initScreen() {
height = _vm->_height = 400; height = _vm->_height = 400;
_vm->_global->_colorCount = 16; _vm->_global->_colorCount = 16;
_vm->_video->setSize(true); _vm->_video->setSize();
} else if (_vm->_global->_videoMode == 0x10) { } else if (_vm->_global->_videoMode == 0x10) {
@ -810,7 +810,7 @@ void Inter_v2::o2_initScreen() {
_vm->_height = 200; _vm->_height = 200;
_vm->_global->_colorCount = 256; _vm->_global->_colorCount = 256;
_vm->_video->setSize(false); _vm->_video->setSize();
} }
} }

View file

@ -140,13 +140,13 @@ void Inter_v5::o5_initScreen() {
_vm->_width = 320; _vm->_width = 320;
_vm->_height = 200; _vm->_height = 200;
_vm->_video->setSize(false); _vm->_video->setSize();
} else if (_vm->_global->_videoMode == 0x13) { } else if (_vm->_global->_videoMode == 0x13) {
width = _vm->_width = 640; width = _vm->_width = 640;
height = _vm->_height = 480; height = _vm->_height = 480;
_vm->_video->setSize(true); _vm->_video->setSize();
} }
_vm->_global->_fakeVideoMode = videoMode; _vm->_global->_fakeVideoMode = videoMode;

View file

@ -237,11 +237,11 @@ void Video::clearScreen() {
g_system->fillScreen(0); g_system->fillScreen(0);
} }
void Video::setSize(bool defaultTo1XScaler) { void Video::setSize() {
if (_vm->isTrueColor()) if (_vm->isTrueColor())
initGraphics(_vm->_width, _vm->_height, defaultTo1XScaler, 0); initGraphics(_vm->_width, _vm->_height, nullptr);
else else
initGraphics(_vm->_width, _vm->_height, defaultTo1XScaler); initGraphics(_vm->_width, _vm->_height);
} }
void Video::retrace(bool mouse) { void Video::retrace(bool mouse) {

View file

@ -112,7 +112,7 @@ public:
void initPrimary(int16 mode); void initPrimary(int16 mode);
SurfacePtr initSurfDesc(int16 width, int16 height, int16 flags = 0); SurfacePtr initSurfDesc(int16 width, int16 height, int16 flags = 0);
void setSize(bool defaultTo1XScaler); void setSize();
void clearScreen(); void clearScreen();
void retrace(bool mouse = true); void retrace(bool mouse = true);

View file

@ -106,7 +106,7 @@ Common::Error GroovieEngine::run() {
case kGroovieV2: { case kGroovieV2: {
// Request the mode with the highest precision available // Request the mode with the highest precision available
Graphics::PixelFormat format(4, 8, 8, 8, 8, 24, 16, 8, 0); Graphics::PixelFormat format(4, 8, 8, 8, 8, 24, 16, 8, 0);
initGraphics(640, 480, true, &format); initGraphics(640, 480, &format);
if (_system->getScreenFormat() != format) if (_system->getScreenFormat() != format)
return Common::kUnsupportedColorMode; return Common::kUnsupportedColorMode;
@ -116,7 +116,7 @@ Common::Error GroovieEngine::run() {
break; break;
} }
case kGroovieT7G: case kGroovieT7G:
initGraphics(640, 480, true); initGraphics(640, 480);
_pixelFormat = Graphics::PixelFormat::createFormatCLUT8(); _pixelFormat = Graphics::PixelFormat::createFormatCLUT8();
break; break;
} }

View file

@ -106,7 +106,7 @@ GraphicsManager::~GraphicsManager() {
void GraphicsManager::setGraphicalMode(int width, int height) { void GraphicsManager::setGraphicalMode(int width, int height) {
if (!_initGraphicsFl) { if (!_initGraphicsFl) {
Graphics::PixelFormat pixelFormat16(2, 5, 6, 5, 0, 11, 5, 0, 0); Graphics::PixelFormat pixelFormat16(2, 5, 6, 5, 0, 11, 5, 0, 0);
initGraphics(width, height, true, &pixelFormat16); initGraphics(width, height, &pixelFormat16);
// Init surfaces // Init surfaces
_backBuffer = _vm->_globals->allocMemory(SCREEN_WIDTH * 2 * SCREEN_HEIGHT); _backBuffer = _vm->_globals->allocMemory(SCREEN_WIDTH * 2 * SCREEN_HEIGHT);

View file

@ -218,7 +218,7 @@ void HugoEngine::gameOverMsg() {
Common::Error HugoEngine::run() { Common::Error HugoEngine::run() {
s_Engine = this; s_Engine = this;
initGraphics(320, 200, false); initGraphics(320, 200);
_mouse = new MouseHandler(this); _mouse = new MouseHandler(this);
_inventory = new InventoryHandler(this); _inventory = new InventoryHandler(this);

View file

@ -253,10 +253,8 @@ void Screen::setResolution() {
_system->getPaletteManager()->grabPalette(palette, 0, 256); _system->getPaletteManager()->grabPalette(palette, 0, 256);
int width = 320, height = 200; int width = 320, height = 200;
bool defaultTo1xScaler = false;
if (_vm->gameFlags().useHiRes) { if (_vm->gameFlags().useHiRes) {
defaultTo1xScaler = true;
height = 400; height = 400;
if (_debugEnabled) if (_debugEnabled)
@ -270,7 +268,7 @@ void Screen::setResolution() {
width = 320; width = 320;
} }
initGraphics(width, height, defaultTo1xScaler); initGraphics(width, height);
_system->getPaletteManager()->setPalette(palette, 0, 256); _system->getPaletteManager()->setPalette(palette, 0, 256);
} }

View file

@ -160,9 +160,9 @@ LabEngine::~LabEngine() {
Common::Error LabEngine::run() { Common::Error LabEngine::run() {
if (getFeatures() & GF_LOWRES) if (getFeatures() & GF_LOWRES)
initGraphics(320, 200, false); initGraphics(320, 200);
else else
initGraphics(640, 480, true); initGraphics(640, 480);
_interface = new Interface(this); _interface = new Interface(this);
_event = new EventManager(this); _event = new EventManager(this);

View file

@ -111,7 +111,7 @@ LastExpressEngine::~LastExpressEngine() {
Common::Error LastExpressEngine::run() { Common::Error LastExpressEngine::run() {
// Initialize the graphics // Initialize the graphics
const Graphics::PixelFormat dataPixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0); const Graphics::PixelFormat dataPixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0);
initGraphics(640, 480, true, &dataPixelFormat); initGraphics(640, 480, &dataPixelFormat);
// We do not support color conversion // We do not support color conversion
if (_system->getScreenFormat() != dataPixelFormat) if (_system->getScreenFormat() != dataPixelFormat)

View file

@ -55,7 +55,7 @@ Common::Error LureEngine::init() {
_initialized = false; _initialized = false;
_saveLoadAllowed = false; _saveLoadAllowed = false;
initGraphics(FULL_SCREEN_WIDTH, FULL_SCREEN_HEIGHT, false); initGraphics(FULL_SCREEN_WIDTH, FULL_SCREEN_HEIGHT);
// Check the version of the lure.dat file // Check the version of the lure.dat file
Common::File f; Common::File f;

View file

@ -146,7 +146,7 @@ void MacVentureEngine::initDebugChannels() {
Common::Error MacVentureEngine::run() { Common::Error MacVentureEngine::run() {
debug("MacVenture::MacVentureEngine::init()"); debug("MacVenture::MacVentureEngine::init()");
initGraphics(kScreenWidth, kScreenHeight, true); initGraphics(kScreenWidth, kScreenHeight);
_debugger = new Console(this); _debugger = new Console(this);

View file

@ -292,7 +292,7 @@ Common::Error MadeEngine::run() {
syncSoundSettings(); syncSoundSettings();
// Initialize backend // Initialize backend
initGraphics(320, 200, false); initGraphics(320, 200);
resetAllTimers(); resetAllTimers();

View file

@ -159,7 +159,7 @@ void MADSEngine::saveOptions() {
} }
Common::Error MADSEngine::run() { Common::Error MADSEngine::run() {
initGraphics(MADS_SCREEN_WIDTH, MADS_SCREEN_HEIGHT, false); initGraphics(MADS_SCREEN_WIDTH, MADS_SCREEN_HEIGHT);
initialize(); initialize();
// Run the game // Run the game

View file

@ -32,7 +32,7 @@ namespace Mohawk {
CSTimeGraphics::CSTimeGraphics(MohawkEngine_CSTime *vm) : GraphicsManager(), _vm(vm) { CSTimeGraphics::CSTimeGraphics(MohawkEngine_CSTime *vm) : GraphicsManager(), _vm(vm) {
_bmpDecoder = new MohawkBitmap(); _bmpDecoder = new MohawkBitmap();
initGraphics(640, 480, true); initGraphics(640, 480);
} }
CSTimeGraphics::~CSTimeGraphics() { CSTimeGraphics::~CSTimeGraphics() {

View file

@ -34,7 +34,7 @@ namespace Mohawk {
LBGraphics::LBGraphics(MohawkEngine_LivingBooks *vm, uint16 width, uint16 height) : GraphicsManager(), _vm(vm) { LBGraphics::LBGraphics(MohawkEngine_LivingBooks *vm, uint16 width, uint16 height) : GraphicsManager(), _vm(vm) {
_bmpDecoder = _vm->isPreMohawk() ? new LivingBooksBitmap_v1() : new MohawkBitmap(); _bmpDecoder = _vm->isPreMohawk() ? new LivingBooksBitmap_v1() : new MohawkBitmap();
initGraphics(width, height, true); initGraphics(width, height);
} }
LBGraphics::~LBGraphics() { LBGraphics::~LBGraphics() {

View file

@ -40,13 +40,13 @@ MystGraphics::MystGraphics(MohawkEngine_Myst* vm) : GraphicsManager(), _vm(vm) {
if (_vm->getFeatures() & GF_ME) { if (_vm->getFeatures() & GF_ME) {
// High color // High color
initGraphics(_viewport.width(), _viewport.height(), true, nullptr); initGraphics(_viewport.width(), _viewport.height(), nullptr);
if (_vm->_system->getScreenFormat().bytesPerPixel == 1) if (_vm->_system->getScreenFormat().bytesPerPixel == 1)
error("Myst ME requires greater than 256 colors to run"); error("Myst ME requires greater than 256 colors to run");
} else { } else {
// Paletted // Paletted
initGraphics(_viewport.width(), _viewport.height(), true); initGraphics(_viewport.width(), _viewport.height());
clearScreenPalette(); clearScreenPalette();
} }

View file

@ -308,7 +308,7 @@ RivenGraphics::RivenGraphics(MohawkEngine_Riven* vm) : GraphicsManager(), _vm(vm
// Restrict ourselves to a single pixel format to simplify the effects implementation // Restrict ourselves to a single pixel format to simplify the effects implementation
_pixelFormat = Graphics::createPixelFormat<565>(); _pixelFormat = Graphics::createPixelFormat<565>();
initGraphics(608, 436, true, &_pixelFormat); initGraphics(608, 436, &_pixelFormat);
// The actual game graphics only take up the first 392 rows. The inventory // The actual game graphics only take up the first 392 rows. The inventory
// occupies the rest of the screen and we don't use the buffer to hold that. // occupies the rest of the screen and we don't use the buffer to hold that.

View file

@ -247,7 +247,7 @@ void MortevielleEngine::pauseEngineIntern(bool pause) {
*/ */
Common::ErrorCode MortevielleEngine::initialize() { Common::ErrorCode MortevielleEngine::initialize() {
// Initialize graphics mode // Initialize graphics mode
initGraphics(SCREEN_WIDTH, SCREEN_HEIGHT, true); initGraphics(SCREEN_WIDTH, SCREEN_HEIGHT);
// Set up an intermediate screen surface // Set up an intermediate screen surface
_screenSurface->create(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()); _screenSurface->create(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());

View file

@ -65,7 +65,7 @@ NeverhoodEngine::~NeverhoodEngine() {
} }
Common::Error NeverhoodEngine::run() { Common::Error NeverhoodEngine::run() {
initGraphics(640, 480, true); initGraphics(640, 480);
const Common::FSNode gameDataDir(ConfMan.get("path")); const Common::FSNode gameDataDir(ConfMan.get("path"));

View file

@ -731,7 +731,7 @@ Gfx::Gfx(Parallaction* vm) :
_gameType = _vm->getGameType(); _gameType = _vm->getGameType();
_doubleBuffering = _gameType != GType_Nippon; _doubleBuffering = _gameType != GType_Nippon;
initGraphics(_vm->_screenWidth, _vm->_screenHeight, _gameType == GType_BRA); initGraphics(_vm->_screenWidth, _vm->_screenHeight);
setPalette(_palette); setPalette(_palette);

View file

@ -35,7 +35,7 @@
namespace Pegasus { namespace Pegasus {
GraphicsManager::GraphicsManager(PegasusEngine *vm) : _vm(vm) { GraphicsManager::GraphicsManager(PegasusEngine *vm) : _vm(vm) {
initGraphics(640, 480, true, NULL); initGraphics(640, 480, nullptr);
if (_vm->_system->getScreenFormat().bytesPerPixel == 1) if (_vm->_system->getScreenFormat().bytesPerPixel == 1)
error("No true color mode available"); error("No true color mode available");

View file

@ -88,7 +88,7 @@ static const byte cursorPalette[] = {
}; };
Common::Error PlumbersGame::run() { Common::Error PlumbersGame::run() {
initGraphics(640, 480, true); initGraphics(640, 480);
_console = new Console(this); _console = new Console(this);
CursorMan.replaceCursor(MOUSECURSOR_SCI, 11, 16, 0, 0, 0); CursorMan.replaceCursor(MOUSECURSOR_SCI, 11, 16, 0, 0, 0);

View file

@ -31,7 +31,7 @@
namespace Prince { namespace Prince {
GraphicsMan::GraphicsMan(PrinceEngine *vm) : _vm(vm), _changed(false) { GraphicsMan::GraphicsMan(PrinceEngine *vm) : _vm(vm), _changed(false) {
initGraphics(640, 480, true); initGraphics(640, 480);
_frontScreen = new Graphics::Surface(); _frontScreen = new Graphics::Surface();
_frontScreen->create(640, 480, Graphics::PixelFormat::createFormatCLUT8()); _frontScreen->create(640, 480, Graphics::PixelFormat::createFormatCLUT8());

View file

@ -30,7 +30,7 @@ namespace Prince {
void PrinceEngine::playVideo(Common::String videoFilename) { void PrinceEngine::playVideo(Common::String videoFilename) {
// Set the correct video mode // Set the correct video mode
initGraphics(640, 480, true, 0); initGraphics(640, 480, nullptr);
if (_system->getScreenFormat().bytesPerPixel == 1) { if (_system->getScreenFormat().bytesPerPixel == 1) {
warning("Couldn't switch to a RGB color video mode to play a video."); warning("Couldn't switch to a RGB color video mode to play a video.");
return; return;
@ -42,7 +42,7 @@ void PrinceEngine::playVideo(Common::String videoFilename) {
if (!videoDecoder->loadFile(videoFilename)) { if (!videoDecoder->loadFile(videoFilename)) {
delete videoDecoder; delete videoDecoder;
warning("Unable to open video %s", videoFilename.c_str()); warning("Unable to open video %s", videoFilename.c_str());
initGraphics(640, 480, true); initGraphics(640, 480);
return; return;
} }
@ -78,7 +78,7 @@ void PrinceEngine::playVideo(Common::String videoFilename) {
delete videoDecoder; delete videoDecoder;
initGraphics(640, 480, true); initGraphics(640, 480);
} }
} // End of namespace Prince } // End of namespace Prince

View file

@ -324,7 +324,7 @@ bool Queen::QueenEngine::hasFeature(EngineFeature f) const {
} }
Common::Error QueenEngine::run() { Common::Error QueenEngine::run() {
initGraphics(GAME_SCREEN_WIDTH, GAME_SCREEN_HEIGHT, false); initGraphics(GAME_SCREEN_WIDTH, GAME_SCREEN_HEIGHT);
_resource = new Resource(); _resource = new Resource();

View file

@ -40,7 +40,7 @@ namespace Saga {
#define RID_IHNM_HOURGLASS_CURSOR 11 // not in demo #define RID_IHNM_HOURGLASS_CURSOR 11 // not in demo
Gfx::Gfx(SagaEngine *vm, OSystem *system, int width, int height) : _vm(vm), _system(system) { Gfx::Gfx(SagaEngine *vm, OSystem *system, int width, int height) : _vm(vm), _system(system) {
initGraphics(width, height, width > 320); initGraphics(width, height);
debug(5, "Init screen %dx%d", width, height); debug(5, "Init screen %dx%d", width, height);
// Convert surface data to R surface data // Convert surface data to R surface data

View file

@ -300,7 +300,7 @@ void Console::postEnter() {
if (duckMode) { if (duckMode) {
Common::List<Graphics::PixelFormat> formats; Common::List<Graphics::PixelFormat> formats;
formats.push_back(videoDecoder->getPixelFormat()); formats.push_back(videoDecoder->getPixelFormat());
initGraphics(640, 480, true, formats); initGraphics(640, 480, formats);
if (g_system->getScreenFormat().bytesPerPixel != videoDecoder->getPixelFormat().bytesPerPixel) if (g_system->getScreenFormat().bytesPerPixel != videoDecoder->getPixelFormat().bytesPerPixel)
error("Could not switch screen format for the duck video"); error("Could not switch screen format for the duck video");
@ -316,7 +316,7 @@ void Console::postEnter() {
#ifdef ENABLE_SCI32 #ifdef ENABLE_SCI32
// Switch back to 8bpp if we played a duck video // Switch back to 8bpp if we played a duck video
if (duckMode) if (duckMode)
initGraphics(oldWidth, oldHeight, oldWidth > 320); initGraphics(oldWidth, oldHeight);
#endif #endif
_engine->_gfxCursor->kernelShow(); _engine->_gfxCursor->kernelShow();

View file

@ -140,7 +140,7 @@ reg_t kShowMovie(EngineState *s, int argc, reg_t *argv) {
// The only argument is the string for the video // The only argument is the string for the video
// HACK: Switch to 16bpp graphics for Cinepak. // HACK: Switch to 16bpp graphics for Cinepak.
initGraphics(screenWidth, screenHeight, screenWidth > 320, NULL); initGraphics(screenWidth, screenHeight, nullptr);
if (g_system->getScreenFormat().bytesPerPixel == 1) { if (g_system->getScreenFormat().bytesPerPixel == 1) {
warning("This video requires >8bpp color to be displayed, but could not switch to RGB color mode"); warning("This video requires >8bpp color to be displayed, but could not switch to RGB color mode");
@ -176,7 +176,7 @@ reg_t kShowMovie(EngineState *s, int argc, reg_t *argv) {
// The only known movie to do use this codec is the GK2 demo trailer // The only known movie to do use this codec is the GK2 demo trailer
// If another video turns up that uses Indeo, we may have to add a better // If another video turns up that uses Indeo, we may have to add a better
// check. // check.
initGraphics(screenWidth, screenHeight, screenWidth > 320, NULL); initGraphics(screenWidth, screenHeight, nullptr);
if (g_system->getScreenFormat().bytesPerPixel == 1) { if (g_system->getScreenFormat().bytesPerPixel == 1) {
warning("This video requires >8bpp color to be displayed, but could not switch to RGB color mode"); warning("This video requires >8bpp color to be displayed, but could not switch to RGB color mode");
@ -206,7 +206,7 @@ reg_t kShowMovie(EngineState *s, int argc, reg_t *argv) {
// HACK: Switch back to 8bpp if we played a true color video. // HACK: Switch back to 8bpp if we played a true color video.
// We also won't be copying the screen to the SCI screen... // We also won't be copying the screen to the SCI screen...
if (g_system->getScreenFormat().bytesPerPixel != 1) if (g_system->getScreenFormat().bytesPerPixel != 1)
initGraphics(screenWidth, screenHeight, screenWidth > 320); initGraphics(screenWidth, screenHeight);
else if (getSciVersion() < SCI_VERSION_2) { else if (getSciVersion() < SCI_VERSION_2) {
g_sci->_gfxScreen->kernelSyncWithFramebuffer(); g_sci->_gfxScreen->kernelSyncWithFramebuffer();
g_sci->_gfxPalette16->kernelSyncScreenPalette(); g_sci->_gfxPalette16->kernelSyncScreenPalette();

View file

@ -80,7 +80,7 @@ GfxFrameout::GfxFrameout(SegManager *segMan, GfxPalette32 *palette, GfxTransitio
} else { } else {
_currentBuffer.create(320, 200, Graphics::PixelFormat::createFormatCLUT8()); _currentBuffer.create(320, 200, Graphics::PixelFormat::createFormatCLUT8());
} }
initGraphics(_currentBuffer.w, _currentBuffer.h, _isHiRes); initGraphics(_currentBuffer.w, _currentBuffer.h);
switch (g_sci->getGameId()) { switch (g_sci->getGameId()) {
case GID_HOYLE5: case GID_HOYLE5:

View file

@ -207,7 +207,7 @@ public:
* Resets the pixel format of the hardware surface to the given format. * Resets the pixel format of the hardware surface to the given format.
*/ */
void setPixelFormat(const Graphics::PixelFormat &format) const { void setPixelFormat(const Graphics::PixelFormat &format) const {
initGraphics(_currentBuffer.w, _currentBuffer.h, _isHiRes, &format); initGraphics(_currentBuffer.w, _currentBuffer.h, &format);
} }
/** /**

View file

@ -179,13 +179,13 @@ GfxScreen::GfxScreen(ResourceManager *resMan) : _resMan(resMan) {
// We add 2 to the height of the icon bar to add a buffer between the screen and the // We add 2 to the height of the icon bar to add a buffer between the screen and the
// icon bar (as did the original interpreter). // icon bar (as did the original interpreter).
if (g_sci->getGameId() == GID_KQ6) if (g_sci->getGameId() == GID_KQ6)
initGraphics(_displayWidth, _displayHeight + 26 + 2, _displayWidth > 320); initGraphics(_displayWidth, _displayHeight + 26 + 2);
else if (g_sci->getGameId() == GID_FREDDYPHARKAS) else if (g_sci->getGameId() == GID_FREDDYPHARKAS)
initGraphics(_displayWidth, _displayHeight + 28 + 2, _displayWidth > 320); initGraphics(_displayWidth, _displayHeight + 28 + 2);
else else
error("Unknown SCI1.1 Mac game"); error("Unknown SCI1.1 Mac game");
} else } else
initGraphics(_displayWidth, _displayHeight, _displayWidth > 320); initGraphics(_displayWidth, _displayHeight);
} }
GfxScreen::~GfxScreen() { GfxScreen::~GfxScreen() {

View file

@ -962,7 +962,7 @@ ScummEngine_vCUPhe::~ScummEngine_vCUPhe() {
} }
Common::Error ScummEngine_vCUPhe::run() { Common::Error ScummEngine_vCUPhe::run() {
initGraphics(CUP_Player::kDefaultVideoWidth, CUP_Player::kDefaultVideoHeight, true); initGraphics(CUP_Player::kDefaultVideoWidth, CUP_Player::kDefaultVideoHeight);
if (_cupPlayer->open(_filenamePattern.pattern)) { if (_cupPlayer->open(_filenamePattern.pattern)) {
_cupPlayer->play(); _cupPlayer->play();
@ -1247,7 +1247,7 @@ Common::Error ScummEngine::init() {
// Initialize backend // Initialize backend
if (_renderMode == Common::kRenderHercA || _renderMode == Common::kRenderHercG) { if (_renderMode == Common::kRenderHercA || _renderMode == Common::kRenderHercG) {
initGraphics(kHercWidth, kHercHeight, true); initGraphics(kHercWidth, kHercHeight);
} else { } else {
int screenWidth = _screenWidth; int screenWidth = _screenWidth;
int screenHeight = _screenHeight; int screenHeight = _screenHeight;
@ -1266,7 +1266,7 @@ Common::Error ScummEngine::init() {
_outputPixelFormat = Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0); _outputPixelFormat = Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0);
if (_game.platform != Common::kPlatformFMTowns && _game.platform != Common::kPlatformPCEngine) { if (_game.platform != Common::kPlatformFMTowns && _game.platform != Common::kPlatformPCEngine) {
initGraphics(screenWidth, screenHeight, screenWidth > 320, &_outputPixelFormat); initGraphics(screenWidth, screenHeight, &_outputPixelFormat);
if (_outputPixelFormat != _system->getScreenFormat()) if (_outputPixelFormat != _system->getScreenFormat())
return Common::kUnsupportedColorMode; return Common::kUnsupportedColorMode;
} else { } else {
@ -1281,7 +1281,7 @@ Common::Error ScummEngine::init() {
} }
} }
initGraphics(screenWidth, screenHeight, screenWidth > 320, tryModes); initGraphics(screenWidth, screenHeight, tryModes);
if (_system->getScreenFormat().bytesPerPixel != 2) if (_system->getScreenFormat().bytesPerPixel != 2)
return Common::kUnsupportedColorMode; return Common::kUnsupportedColorMode;
} }
@ -1298,7 +1298,7 @@ Common::Error ScummEngine::init() {
if (_game.platform == Common::kPlatformFMTowns && _game.version == 5) if (_game.platform == Common::kPlatformFMTowns && _game.version == 5)
return Common::Error(Common::kUnsupportedColorMode, "This game requires dual graphics layer support which is disabled in this build"); return Common::Error(Common::kUnsupportedColorMode, "This game requires dual graphics layer support which is disabled in this build");
#endif #endif
initGraphics(screenWidth, screenHeight, (screenWidth > 320)); initGraphics(screenWidth, screenHeight);
} }
} }

View file

@ -251,14 +251,14 @@ ScalpelEngine::~ScalpelEngine() {
void ScalpelEngine::setupGraphics() { void ScalpelEngine::setupGraphics() {
if (getPlatform() != Common::kPlatform3DO) { if (getPlatform() != Common::kPlatform3DO) {
// 320x200 palettized // 320x200 palettized
initGraphics(320, 200, false); initGraphics(320, 200);
} else { } else {
// 3DO actually uses RGB555, but some platforms of ours only support RGB565, so we use that // 3DO actually uses RGB555, but some platforms of ours only support RGB565, so we use that
const Graphics::PixelFormat pixelFormatRGB565 = Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0); const Graphics::PixelFormat pixelFormatRGB565 = Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0);
// First try for a 640x400 mode // First try for a 640x400 mode
g_system->beginGFXTransaction(); g_system->beginGFXTransaction();
initCommonGFX(true); initCommonGFX();
g_system->initSize(640, 400, &pixelFormatRGB565); g_system->initSize(640, 400, &pixelFormatRGB565);
OSystem::TransactionError gfxError = g_system->endGFXTransaction(); OSystem::TransactionError gfxError = g_system->endGFXTransaction();
@ -266,7 +266,7 @@ void ScalpelEngine::setupGraphics() {
_isScreenDoubled = true; _isScreenDoubled = true;
} else { } else {
// System doesn't support it, so fall back on 320x200 mode // System doesn't support it, so fall back on 320x200 mode
initGraphics(320, 200, false, &pixelFormatRGB565); initGraphics(320, 200, &pixelFormatRGB565);
} }
} }
} }

View file

@ -51,7 +51,7 @@ void TattooEngine::showOpening() {
} }
void TattooEngine::initialize() { void TattooEngine::initialize() {
initGraphics(640, 480, true); initGraphics(640, 480);
// Initialize the base engine // Initialize the base engine
SherlockEngine::initialize(); SherlockEngine::initialize();

View file

@ -259,7 +259,7 @@ Common::Error SkyEngine::go() {
} }
Common::Error SkyEngine::init() { Common::Error SkyEngine::init() {
initGraphics(320, 200, false); initGraphics(320, 200);
_skyDisk = new Disk(); _skyDisk = new Disk();
_skySound = new Sound(_mixer, _skyDisk, Audio::Mixer::kMaxChannelVolume); _skySound = new Sound(_mixer, _skyDisk, Audio::Mixer::kMaxChannelVolume);

View file

@ -143,7 +143,7 @@ void GraphicsManager::kill() {
} }
bool GraphicsManager::initGfx() { bool GraphicsManager::initGfx() {
initGraphics(_winWidth, _winHeight, true, _vm->getScreenPixelFormat()); initGraphics(_winWidth, _winHeight, _vm->getScreenPixelFormat());
_renderSurface.create(_winWidth, _winHeight, *_vm->getScreenPixelFormat()); _renderSurface.create(_winWidth, _winHeight, *_vm->getScreenPixelFormat());
if (!killResizeBackdrop(_winWidth, _winHeight)) if (!killResizeBackdrop(_winWidth, _winHeight))

View file

@ -191,12 +191,12 @@ bool MoviePlayer::load(uint32 id) {
// Need to switch to true color for PSX/MP2 videos // Need to switch to true color for PSX/MP2 videos
if (_decoderType == kVideoDecoderPSX || _decoderType == kVideoDecoderMP2) if (_decoderType == kVideoDecoderPSX || _decoderType == kVideoDecoderMP2)
initGraphics(g_system->getWidth(), g_system->getHeight(), true, 0); initGraphics(g_system->getWidth(), g_system->getHeight(), nullptr);
if (!_decoder->loadFile(filename)) { if (!_decoder->loadFile(filename)) {
// Go back to 8bpp color // Go back to 8bpp color
if (_decoderType == kVideoDecoderPSX || _decoderType == kVideoDecoderMP2) if (_decoderType == kVideoDecoderPSX || _decoderType == kVideoDecoderMP2)
initGraphics(g_system->getWidth(), g_system->getHeight(), true); initGraphics(g_system->getWidth(), g_system->getHeight());
return false; return false;
} }
@ -422,7 +422,7 @@ bool MoviePlayer::playVideo() {
// Need to jump back to paletted color // Need to jump back to paletted color
if (_decoderType == kVideoDecoderPSX || _decoderType == kVideoDecoderMP2) if (_decoderType == kVideoDecoderPSX || _decoderType == kVideoDecoderMP2)
initGraphics(g_system->getWidth(), g_system->getHeight(), true); initGraphics(g_system->getWidth(), g_system->getHeight());
return !_vm->shouldQuit() && !skipped; return !_vm->shouldQuit() && !skipped;
} }

View file

@ -94,7 +94,7 @@ SwordEngine::~SwordEngine() {
Common::Error SwordEngine::init() { Common::Error SwordEngine::init() {
initGraphics(640, 480, true); initGraphics(640, 480);
if (0 == scumm_stricmp(ConfMan.get("gameid").c_str(), "sword1mac") || if (0 == scumm_stricmp(ConfMan.get("gameid").c_str(), "sword1mac") ||
0 == scumm_stricmp(ConfMan.get("gameid").c_str(), "sword1macdemo")) 0 == scumm_stricmp(ConfMan.get("gameid").c_str(), "sword1macdemo"))

View file

@ -103,12 +103,12 @@ bool MoviePlayer::load(const char *name) {
// Need to switch to true color for PSX/MP2 videos // Need to switch to true color for PSX/MP2 videos
if (_decoderType == kVideoDecoderPSX || _decoderType == kVideoDecoderMP2) if (_decoderType == kVideoDecoderPSX || _decoderType == kVideoDecoderMP2)
initGraphics(g_system->getWidth(), g_system->getHeight(), true, 0); initGraphics(g_system->getWidth(), g_system->getHeight(), nullptr);
if (!_decoder->loadFile(filename)) { if (!_decoder->loadFile(filename)) {
// Go back to 8bpp color // Go back to 8bpp color
if (_decoderType == kVideoDecoderPSX || _decoderType == kVideoDecoderMP2) if (_decoderType == kVideoDecoderPSX || _decoderType == kVideoDecoderMP2)
initGraphics(g_system->getWidth(), g_system->getHeight(), true); initGraphics(g_system->getWidth(), g_system->getHeight());
return false; return false;
} }
@ -145,7 +145,7 @@ void MoviePlayer::play(MovieText *movieTexts, uint32 numMovieTexts, uint32 leadI
// Need to jump back to paletted color // Need to jump back to paletted color
if (_decoderType == kVideoDecoderPSX || _decoderType == kVideoDecoderMP2) if (_decoderType == kVideoDecoderPSX || _decoderType == kVideoDecoderMP2)
initGraphics(640, 480, true); initGraphics(640, 480);
} }
void MoviePlayer::openTextObject(uint32 index) { void MoviePlayer::openTextObject(uint32 index) {

View file

@ -442,7 +442,7 @@ Common::Error Sword2Engine::run() {
_resman = NULL; _resman = NULL;
_memory = NULL; _memory = NULL;
initGraphics(640, 480, true); initGraphics(640, 480);
_screen = new Screen(this, 640, 480); _screen = new Screen(this, 640, 480);
// Create the debugger as early as possible (but not before the // Create the debugger as early as possible (but not before the

View file

@ -97,7 +97,7 @@ Common::Error Sword25Engine::run() {
Common::Error Sword25Engine::appStart() { Common::Error Sword25Engine::appStart() {
// Initialize the graphics mode to RGBA8888 // Initialize the graphics mode to RGBA8888
Graphics::PixelFormat format = Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0); Graphics::PixelFormat format = Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0);
initGraphics(800, 600, true, &format); initGraphics(800, 600, &format);
if (format != g_system->getScreenFormat()) if (format != g_system->getScreenFormat())
return Common::kUnsupportedColorMode; return Common::kUnsupportedColorMode;

View file

@ -540,7 +540,7 @@ Common::Error TeenAgentEngine::run() {
Common::EventManager *_event = _system->getEventManager(); Common::EventManager *_event = _system->getEventManager();
initGraphics(kScreenWidth, kScreenHeight, false); initGraphics(kScreenWidth, kScreenHeight);
console = new Console(this); console = new Console(this);
scene = new Scene(this); scene = new Scene(this);

View file

@ -185,7 +185,7 @@ void TestbedEngine::invokeTestsuites(TestbedConfigManager &cfMan) {
Common::Error TestbedEngine::run() { Common::Error TestbedEngine::run() {
// Initialize graphics using following: // Initialize graphics using following:
initGraphics(320, 200, false); initGraphics(320, 200);
// As of now we are using GUI::MessageDialog for interaction, Test if it works. // As of now we are using GUI::MessageDialog for interaction, Test if it works.
// interactive mode could also be modified by a config parameter "non-interactive=1" // interactive mode could also be modified by a config parameter "non-interactive=1"

View file

@ -900,13 +900,13 @@ Common::Error TinselEngine::run() {
// Initialize backend // Initialize backend
if (getGameID() == GID_DW2) { if (getGameID() == GID_DW2) {
#ifndef DW2_EXACT_SIZE #ifndef DW2_EXACT_SIZE
initGraphics(640, 480, true); initGraphics(640, 480);
#else #else
initGraphics(640, 432, true); initGraphics(640, 432);
#endif #endif
_screenSurface.create(640, 432, Graphics::PixelFormat::createFormatCLUT8()); _screenSurface.create(640, 432, Graphics::PixelFormat::createFormatCLUT8());
} else { } else {
initGraphics(320, 200, false); initGraphics(320, 200);
_screenSurface.create(320, 200, Graphics::PixelFormat::createFormatCLUT8()); _screenSurface.create(320, 200, Graphics::PixelFormat::createFormatCLUT8());
} }

View file

@ -40,7 +40,7 @@ void DirectDraw::setDisplayMode(int width, int height, int bpp, int refreshRate)
assert(bpp == 16); assert(bpp == 16);
Graphics::PixelFormat pixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0); Graphics::PixelFormat pixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0);
initGraphics(width, height, true, &pixelFormat); initGraphics(width, height, &pixelFormat);
} }
void DirectDraw::diagnostics() { void DirectDraw::diagnostics() {

View file

@ -70,7 +70,7 @@ ToltecsEngine::~ToltecsEngine() {
} }
Common::Error ToltecsEngine::run() { Common::Error ToltecsEngine::run() {
initGraphics(640, 400, true); initGraphics(640, 400);
_isSaveAllowed = true; _isSaveAllowed = true;

View file

@ -54,7 +54,7 @@ RMWindow::~RMWindow() {
*/ */
void RMWindow::init() { void RMWindow::init() {
Graphics::PixelFormat pixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0); Graphics::PixelFormat pixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0);
initGraphics(RM_SX, RM_SY, true, &pixelFormat); initGraphics(RM_SX, RM_SY, &pixelFormat);
reset(); reset();
} }

View file

@ -1116,7 +1116,7 @@ Common::Error ToonEngine::run() {
if (!loadToonDat()) if (!loadToonDat())
return Common::kUnknownError; return Common::kUnknownError;
initGraphics(TOON_SCREEN_WIDTH, TOON_SCREEN_HEIGHT, true); initGraphics(TOON_SCREEN_WIDTH, TOON_SCREEN_HEIGHT);
init(); init();
// do we need to load directly a game? // do we need to load directly a game?

View file

@ -199,7 +199,7 @@ ToucheEngine::~ToucheEngine() {
} }
Common::Error ToucheEngine::run() { Common::Error ToucheEngine::run() {
initGraphics(kScreenWidth, kScreenHeight, true); initGraphics(kScreenWidth, kScreenHeight);
Graphics::setupFont(_language); Graphics::setupFont(_language);

View file

@ -53,7 +53,7 @@ TSageEngine::TSageEngine(OSystem *system, const tSageGameDescription *gameDesc)
} }
Common::Error TSageEngine::init() { Common::Error TSageEngine::init() {
initGraphics(SCREEN_WIDTH, SCREEN_HEIGHT, false); initGraphics(SCREEN_WIDTH, SCREEN_HEIGHT);
return Common::kNoError; return Common::kNoError;
} }

View file

@ -89,7 +89,7 @@ bool TuckerEngine::hasFeature(EngineFeature f) const {
} }
Common::Error TuckerEngine::run() { Common::Error TuckerEngine::run() {
initGraphics(kScreenWidth, kScreenHeight, false); initGraphics(kScreenWidth, kScreenHeight);
syncSoundSettings(); syncSoundSettings();
_compressedSound.openFile(); _compressedSound.openFile();
if (_startSlot == -1) if (_startSlot == -1)

View file

@ -30,7 +30,7 @@
/** /**
* Setup the backend's graphics mode. * Setup the backend's graphics mode.
*/ */
void initCommonGFX(bool defaultTo1XScaler); void initCommonGFX();
/** /**
* Setup the backend's screen size and graphics mode. * Setup the backend's screen size and graphics mode.
@ -45,8 +45,8 @@ void initCommonGFX(bool defaultTo1XScaler);
* Uses the backend's preferred format if graphics format pointer is NULL. * Uses the backend's preferred format if graphics format pointer is NULL.
* Finds the best compatible format if a list of graphics formats is provided. * Finds the best compatible format if a list of graphics formats is provided.
*/ */
void initGraphics(int width, int height, bool defaultTo1xScaler); void initGraphics(int width, int height);
void initGraphics(int width, int height, bool defaultTo1xScaler, const Graphics::PixelFormat *format); void initGraphics(int width, int height, const Graphics::PixelFormat *format);
void initGraphics(int width, int height, bool defaultTo1xScaler, const Common::List<Graphics::PixelFormat> &formatList); void initGraphics(int width, int height, const Common::List<Graphics::PixelFormat> &formatList);
#endif #endif

View file

@ -54,7 +54,7 @@ Screen::Screen(VoyeurEngine *vm) : Graphics::Screen(), _vm(vm), _drawPtr(&_defau
} }
void Screen::sInitGraphics() { void Screen::sInitGraphics() {
initGraphics(SCREEN_WIDTH, SCREEN_HEIGHT, false); initGraphics(SCREEN_WIDTH, SCREEN_HEIGHT);
create(SCREEN_WIDTH, SCREEN_HEIGHT); create(SCREEN_WIDTH, SCREEN_HEIGHT);
clearPalette(); clearPalette();
} }

View file

@ -106,7 +106,7 @@ WageEngine::~WageEngine() {
Common::Error WageEngine::run() { Common::Error WageEngine::run() {
debug("WageEngine::init"); debug("WageEngine::init");
initGraphics(512, 342, true); initGraphics(512, 342);
// Create debugger console. It requires GFX to be initialized // Create debugger console. It requires GFX to be initialized
_console = new Console(this); _console = new Console(this);

View file

@ -109,7 +109,7 @@ bool WintermuteEngine::hasFeature(EngineFeature f) const {
Common::Error WintermuteEngine::run() { Common::Error WintermuteEngine::run() {
// Initialize graphics using following: // Initialize graphics using following:
Graphics::PixelFormat format(4, 8, 8, 8, 8, 24, 16, 8, 0); Graphics::PixelFormat format(4, 8, 8, 8, 8, 24, 16, 8, 0);
initGraphics(800, 600, true, &format); initGraphics(800, 600, &format);
if (g_system->getScreenFormat() != format) { if (g_system->getScreenFormat() != format) {
error("Wintermute currently REQUIRES 32bpp"); error("Wintermute currently REQUIRES 32bpp");
} }

View file

@ -107,7 +107,7 @@ void XeenEngine::initialize() {
_eventData = f.readStream(f.size()); _eventData = f.readStream(f.size());
// Set graphics mode // Set graphics mode
initGraphics(320, 200, false); initGraphics(320, 200);
// If requested, load a savegame instead of showing the intro // If requested, load a savegame instead of showing the intro
if (ConfMan.hasKey("save_slot")) { if (ConfMan.hasKey("save_slot")) {

View file

@ -401,13 +401,13 @@ void ZVision::initScreen() {
((WINDOW_HEIGHT - workingWindowHeight) / 2) + workingWindowHeight ((WINDOW_HEIGHT - workingWindowHeight) / 2) + workingWindowHeight
); );
initGraphics(WINDOW_WIDTH, WINDOW_HEIGHT, true, &_screenPixelFormat); initGraphics(WINDOW_WIDTH, WINDOW_HEIGHT, &_screenPixelFormat);
} }
void ZVision::initHiresScreen() { void ZVision::initHiresScreen() {
_renderManager->upscaleRect(_workingWindow); _renderManager->upscaleRect(_workingWindow);
initGraphics(HIRES_WINDOW_WIDTH, HIRES_WINDOW_HEIGHT, true, &_screenPixelFormat); initGraphics(HIRES_WINDOW_WIDTH, HIRES_WINDOW_HEIGHT, &_screenPixelFormat);
} }
} // End of namespace ZVision } // End of namespace ZVision