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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -37,7 +37,7 @@ void BbvsEngine::playVideo(int videoNum) {
videoFilename = Common::String::format("vid/video%03d.avi", videoNum - 1);
// Set the correct video mode
initGraphics(320, 240, false, 0);
initGraphics(320, 240, nullptr);
if (_system->getScreenFormat().bytesPerPixel == 1) {
warning("Couldn't switch to a RGB color video mode to play a video.");
return;
@ -84,7 +84,7 @@ void BbvsEngine::playVideo(int videoNum) {
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() {
Graphics::PixelFormat format = createRGB555();
initGraphics(640, 480, true, &format);
initGraphics(640, 480, &format);
_system->showMouse(true);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -151,7 +151,7 @@ void DreamWebEngine::doShake() {
void DreamWebEngine::setMode() {
waitForVSync();
initGraphics(kScreenwidth, kScreenheight, false);
initGraphics(kScreenwidth, kScreenheight);
}
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);
}
void initCommonGFX(bool defaultTo1XScaler) {
void initCommonGFX() {
const Common::ConfigManager::Domain *transientDomain = ConfMan.getDomain(Common::ConfigManager::kTransientDomain);
const Common::ConfigManager::Domain *gameDomain = ConfMan.getActiveDomain();
assert(transientDomain);
const bool useDefaultGraphicsMode =
(!transientDomain->contains("gfx_mode") ||
!scumm_stricmp(transientDomain->getVal("gfx_mode").c_str(), "normal") ||
!scumm_stricmp(transientDomain->getVal("gfx_mode").c_str(), "default")
)
&&
(
!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();
}
// 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());
}
// Note: The following code deals with the fullscreen / ASR settings. This
@ -307,11 +285,11 @@ void splashScreen() {
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();
initCommonGFX(defaultTo1xScaler);
initCommonGFX();
#ifdef USE_RGB_COLOR
if (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);
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();
initGraphics(width, height, defaultTo1xScaler, &format);
initGraphics(width, height, &format);
}
void GUIErrorMessage(const Common::String &msg) {
g_system->setWindowCaption("Error");
g_system->beginGFXTransaction();
initCommonGFX(false);
initCommonGFX();
g_system->initSize(320, 200);
if (g_system->endGFXTransaction() == OSystem::kTransactionSuccess) {
GUI::MessageDialog dialog(msg);

View File

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

View File

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

View File

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

View File

@ -797,7 +797,7 @@ void Inter_v2::o2_initScreen() {
height = _vm->_height = 400;
_vm->_global->_colorCount = 16;
_vm->_video->setSize(true);
_vm->_video->setSize();
} else if (_vm->_global->_videoMode == 0x10) {
@ -810,7 +810,7 @@ void Inter_v2::o2_initScreen() {
_vm->_height = 200;
_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->_height = 200;
_vm->_video->setSize(false);
_vm->_video->setSize();
} else if (_vm->_global->_videoMode == 0x13) {
width = _vm->_width = 640;
height = _vm->_height = 480;
_vm->_video->setSize(true);
_vm->_video->setSize();
}
_vm->_global->_fakeVideoMode = videoMode;

View File

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

View File

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

View File

@ -106,7 +106,7 @@ Common::Error GroovieEngine::run() {
case kGroovieV2: {
// Request the mode with the highest precision available
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)
return Common::kUnsupportedColorMode;
@ -116,7 +116,7 @@ Common::Error GroovieEngine::run() {
break;
}
case kGroovieT7G:
initGraphics(640, 480, true);
initGraphics(640, 480);
_pixelFormat = Graphics::PixelFormat::createFormatCLUT8();
break;
}

View File

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

View File

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

View File

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

View File

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

View File

@ -111,7 +111,7 @@ LastExpressEngine::~LastExpressEngine() {
Common::Error LastExpressEngine::run() {
// Initialize the graphics
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
if (_system->getScreenFormat() != dataPixelFormat)

View File

@ -55,7 +55,7 @@ Common::Error LureEngine::init() {
_initialized = 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
Common::File f;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -40,13 +40,13 @@ MystGraphics::MystGraphics(MohawkEngine_Myst* vm) : GraphicsManager(), _vm(vm) {
if (_vm->getFeatures() & GF_ME) {
// High color
initGraphics(_viewport.width(), _viewport.height(), true, nullptr);
initGraphics(_viewport.width(), _viewport.height(), nullptr);
if (_vm->_system->getScreenFormat().bytesPerPixel == 1)
error("Myst ME requires greater than 256 colors to run");
} else {
// Paletted
initGraphics(_viewport.width(), _viewport.height(), true);
initGraphics(_viewport.width(), _viewport.height());
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
_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
// 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() {
// Initialize graphics mode
initGraphics(SCREEN_WIDTH, SCREEN_HEIGHT, true);
initGraphics(SCREEN_WIDTH, SCREEN_HEIGHT);
// Set up an intermediate screen surface
_screenSurface->create(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -40,7 +40,7 @@ namespace Saga {
#define RID_IHNM_HOURGLASS_CURSOR 11 // not in demo
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);
// Convert surface data to R surface data

View File

@ -300,7 +300,7 @@ void Console::postEnter() {
if (duckMode) {
Common::List<Graphics::PixelFormat> formats;
formats.push_back(videoDecoder->getPixelFormat());
initGraphics(640, 480, true, formats);
initGraphics(640, 480, formats);
if (g_system->getScreenFormat().bytesPerPixel != videoDecoder->getPixelFormat().bytesPerPixel)
error("Could not switch screen format for the duck video");
@ -316,7 +316,7 @@ void Console::postEnter() {
#ifdef ENABLE_SCI32
// Switch back to 8bpp if we played a duck video
if (duckMode)
initGraphics(oldWidth, oldHeight, oldWidth > 320);
initGraphics(oldWidth, oldHeight);
#endif
_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
// HACK: Switch to 16bpp graphics for Cinepak.
initGraphics(screenWidth, screenHeight, screenWidth > 320, NULL);
initGraphics(screenWidth, screenHeight, nullptr);
if (g_system->getScreenFormat().bytesPerPixel == 1) {
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
// If another video turns up that uses Indeo, we may have to add a better
// check.
initGraphics(screenWidth, screenHeight, screenWidth > 320, NULL);
initGraphics(screenWidth, screenHeight, nullptr);
if (g_system->getScreenFormat().bytesPerPixel == 1) {
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.
// We also won't be copying the screen to the SCI screen...
if (g_system->getScreenFormat().bytesPerPixel != 1)
initGraphics(screenWidth, screenHeight, screenWidth > 320);
initGraphics(screenWidth, screenHeight);
else if (getSciVersion() < SCI_VERSION_2) {
g_sci->_gfxScreen->kernelSyncWithFramebuffer();
g_sci->_gfxPalette16->kernelSyncScreenPalette();

View File

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

View File

@ -207,7 +207,7 @@ public:
* Resets the pixel format of the hardware surface to the given format.
*/
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
// icon bar (as did the original interpreter).
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)
initGraphics(_displayWidth, _displayHeight + 28 + 2, _displayWidth > 320);
initGraphics(_displayWidth, _displayHeight + 28 + 2);
else
error("Unknown SCI1.1 Mac game");
} else
initGraphics(_displayWidth, _displayHeight, _displayWidth > 320);
initGraphics(_displayWidth, _displayHeight);
}
GfxScreen::~GfxScreen() {

View File

@ -962,7 +962,7 @@ ScummEngine_vCUPhe::~ScummEngine_vCUPhe() {
}
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)) {
_cupPlayer->play();
@ -1247,7 +1247,7 @@ Common::Error ScummEngine::init() {
// Initialize backend
if (_renderMode == Common::kRenderHercA || _renderMode == Common::kRenderHercG) {
initGraphics(kHercWidth, kHercHeight, true);
initGraphics(kHercWidth, kHercHeight);
} else {
int screenWidth = _screenWidth;
int screenHeight = _screenHeight;
@ -1266,7 +1266,7 @@ Common::Error ScummEngine::init() {
_outputPixelFormat = Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0);
if (_game.platform != Common::kPlatformFMTowns && _game.platform != Common::kPlatformPCEngine) {
initGraphics(screenWidth, screenHeight, screenWidth > 320, &_outputPixelFormat);
initGraphics(screenWidth, screenHeight, &_outputPixelFormat);
if (_outputPixelFormat != _system->getScreenFormat())
return Common::kUnsupportedColorMode;
} else {
@ -1281,7 +1281,7 @@ Common::Error ScummEngine::init() {
}
}
initGraphics(screenWidth, screenHeight, screenWidth > 320, tryModes);
initGraphics(screenWidth, screenHeight, tryModes);
if (_system->getScreenFormat().bytesPerPixel != 2)
return Common::kUnsupportedColorMode;
}
@ -1298,7 +1298,7 @@ Common::Error ScummEngine::init() {
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");
#endif
initGraphics(screenWidth, screenHeight, (screenWidth > 320));
initGraphics(screenWidth, screenHeight);
}
}

View File

@ -251,14 +251,14 @@ ScalpelEngine::~ScalpelEngine() {
void ScalpelEngine::setupGraphics() {
if (getPlatform() != Common::kPlatform3DO) {
// 320x200 palettized
initGraphics(320, 200, false);
initGraphics(320, 200);
} else {
// 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);
// First try for a 640x400 mode
g_system->beginGFXTransaction();
initCommonGFX(true);
initCommonGFX();
g_system->initSize(640, 400, &pixelFormatRGB565);
OSystem::TransactionError gfxError = g_system->endGFXTransaction();
@ -266,7 +266,7 @@ void ScalpelEngine::setupGraphics() {
_isScreenDoubled = true;
} else {
// 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() {
initGraphics(640, 480, true);
initGraphics(640, 480);
// Initialize the base engine
SherlockEngine::initialize();

View File

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

View File

@ -143,7 +143,7 @@ void GraphicsManager::kill() {
}
bool GraphicsManager::initGfx() {
initGraphics(_winWidth, _winHeight, true, _vm->getScreenPixelFormat());
initGraphics(_winWidth, _winHeight, _vm->getScreenPixelFormat());
_renderSurface.create(_winWidth, _winHeight, *_vm->getScreenPixelFormat());
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
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)) {
// Go back to 8bpp color
if (_decoderType == kVideoDecoderPSX || _decoderType == kVideoDecoderMP2)
initGraphics(g_system->getWidth(), g_system->getHeight(), true);
initGraphics(g_system->getWidth(), g_system->getHeight());
return false;
}
@ -422,7 +422,7 @@ bool MoviePlayer::playVideo() {
// Need to jump back to paletted color
if (_decoderType == kVideoDecoderPSX || _decoderType == kVideoDecoderMP2)
initGraphics(g_system->getWidth(), g_system->getHeight(), true);
initGraphics(g_system->getWidth(), g_system->getHeight());
return !_vm->shouldQuit() && !skipped;
}

View File

@ -94,7 +94,7 @@ SwordEngine::~SwordEngine() {
Common::Error SwordEngine::init() {
initGraphics(640, 480, true);
initGraphics(640, 480);
if (0 == scumm_stricmp(ConfMan.get("gameid").c_str(), "sword1mac") ||
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
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)) {
// Go back to 8bpp color
if (_decoderType == kVideoDecoderPSX || _decoderType == kVideoDecoderMP2)
initGraphics(g_system->getWidth(), g_system->getHeight(), true);
initGraphics(g_system->getWidth(), g_system->getHeight());
return false;
}
@ -145,7 +145,7 @@ void MoviePlayer::play(MovieText *movieTexts, uint32 numMovieTexts, uint32 leadI
// Need to jump back to paletted color
if (_decoderType == kVideoDecoderPSX || _decoderType == kVideoDecoderMP2)
initGraphics(640, 480, true);
initGraphics(640, 480);
}
void MoviePlayer::openTextObject(uint32 index) {

View File

@ -442,7 +442,7 @@ Common::Error Sword2Engine::run() {
_resman = NULL;
_memory = NULL;
initGraphics(640, 480, true);
initGraphics(640, 480);
_screen = new Screen(this, 640, 480);
// 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() {
// Initialize the graphics mode to RGBA8888
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())
return Common::kUnsupportedColorMode;

View File

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

View File

@ -185,7 +185,7 @@ void TestbedEngine::invokeTestsuites(TestbedConfigManager &cfMan) {
Common::Error TestbedEngine::run() {
// 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.
// 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
if (getGameID() == GID_DW2) {
#ifndef DW2_EXACT_SIZE
initGraphics(640, 480, true);
initGraphics(640, 480);
#else
initGraphics(640, 432, true);
initGraphics(640, 432);
#endif
_screenSurface.create(640, 432, Graphics::PixelFormat::createFormatCLUT8());
} else {
initGraphics(320, 200, false);
initGraphics(320, 200);
_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);
Graphics::PixelFormat pixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0);
initGraphics(width, height, true, &pixelFormat);
initGraphics(width, height, &pixelFormat);
}
void DirectDraw::diagnostics() {

View File

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

View File

@ -54,7 +54,7 @@ RMWindow::~RMWindow() {
*/
void RMWindow::init() {
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();
}

View File

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

View File

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

View File

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

View File

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

View File

@ -30,7 +30,7 @@
/**
* Setup the backend's graphics mode.
*/
void initCommonGFX(bool defaultTo1XScaler);
void initCommonGFX();
/**
* 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.
* 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, bool defaultTo1xScaler, const Graphics::PixelFormat *format);
void initGraphics(int width, int height, bool defaultTo1xScaler, const Common::List<Graphics::PixelFormat> &formatList);
void initGraphics(int width, int height);
void initGraphics(int width, int height, const Graphics::PixelFormat *format);
void initGraphics(int width, int height, const Common::List<Graphics::PixelFormat> &formatList);
#endif

View File

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

View File

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

View File

@ -109,7 +109,7 @@ bool WintermuteEngine::hasFeature(EngineFeature f) const {
Common::Error WintermuteEngine::run() {
// Initialize graphics using following:
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) {
error("Wintermute currently REQUIRES 32bpp");
}

View File

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

View File

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