From b3e404109c31160c978a17ebe497b9bdef9ff51a Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 4 May 2010 11:58:12 +0000 Subject: [PATCH] Move initGraphics and initCommonGFX from to new header. These functions are only used internally be Engine subclasses, and by moving them to a separate header we can reduce indirect header dependencies. svn-id: r48934 --- engines/agi/agi.cpp | 2 ++ engines/agos/agos.cpp | 2 ++ engines/cine/cine.cpp | 2 ++ engines/cruise/cruise.cpp | 2 ++ engines/draci/draci.cpp | 2 ++ engines/drascula/drascula.cpp | 2 ++ engines/engine.cpp | 1 + engines/engine.h | 24 -------------- engines/gob/video.cpp | 3 ++ engines/groovie/groovie.cpp | 3 ++ engines/kyra/screen.cpp | 2 ++ engines/lure/lure.cpp | 2 ++ engines/m4/m4.cpp | 2 +- engines/made/made.cpp | 2 ++ engines/mohawk/graphics.cpp | 2 ++ engines/mohawk/livingbooks.cpp | 2 ++ engines/parallaction/graphics.cpp | 1 + engines/queen/queen.cpp | 2 ++ engines/saga/gfx.cpp | 1 + engines/sci/graphics/screen.cpp | 1 + engines/sci/sci.cpp | 2 ++ engines/scumm/scumm.cpp | 2 ++ engines/sky/sky.cpp | 3 ++ engines/sword1/sword1.cpp | 2 ++ engines/sword2/sword2.cpp | 3 +- engines/teenagent/teenagent.cpp | 5 +++ engines/tinsel/tinsel.cpp | 2 ++ engines/touche/touche.cpp | 1 + engines/tucker/tucker.cpp | 2 ++ engines/util.h | 54 +++++++++++++++++++++++++++++++ 30 files changed, 109 insertions(+), 27 deletions(-) create mode 100644 engines/util.h diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp index 2a67b5a16f3..561989ee663 100644 --- a/engines/agi/agi.cpp +++ b/engines/agi/agi.cpp @@ -31,6 +31,8 @@ #include "common/config-manager.h" #include "common/random.h" +#include "engines/util.h" + #include "base/plugins.h" #include "base/version.h" diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp index 61e4351967d..926b3a89721 100644 --- a/engines/agos/agos.cpp +++ b/engines/agos/agos.cpp @@ -30,6 +30,8 @@ #include "common/fs.h" #include "common/system.h" +#include "engines/util.h" + #include "agos/debugger.h" #include "agos/intern.h" #include "agos/agos.h" diff --git a/engines/cine/cine.cpp b/engines/cine/cine.cpp index ee4bccf3fb6..b91efb58dba 100644 --- a/engines/cine/cine.cpp +++ b/engines/cine/cine.cpp @@ -30,6 +30,8 @@ #include "common/config-manager.h" #include "common/system.h" +#include "engines/util.h" + #include "graphics/cursorman.h" #include "sound/mididrv.h" diff --git a/engines/cruise/cruise.cpp b/engines/cruise/cruise.cpp index 0f6421ff3ca..c91dfdd5401 100644 --- a/engines/cruise/cruise.cpp +++ b/engines/cruise/cruise.cpp @@ -30,6 +30,8 @@ #include "common/config-manager.h" #include "common/system.h" +#include "engines/util.h" + #include "graphics/cursorman.h" #include "sound/mididrv.h" diff --git a/engines/draci/draci.cpp b/engines/draci/draci.cpp index ba9e30ba1d1..5fbad40a4fd 100644 --- a/engines/draci/draci.cpp +++ b/engines/draci/draci.cpp @@ -31,6 +31,8 @@ #include "common/keyboard.h" #include "common/EventRecorder.h" +#include "engines/util.h" + #include "graphics/cursorman.h" #include "graphics/font.h" diff --git a/engines/drascula/drascula.cpp b/engines/drascula/drascula.cpp index 1fb3a53429b..276554a24c2 100644 --- a/engines/drascula/drascula.cpp +++ b/engines/drascula/drascula.cpp @@ -33,6 +33,8 @@ #include "base/plugins.h" #include "base/version.h" +#include "engines/util.h" + #include "sound/mixer.h" #include "drascula/drascula.h" diff --git a/engines/engine.cpp b/engines/engine.cpp index a1bf09eed30..4cf797758f4 100644 --- a/engines/engine.cpp +++ b/engines/engine.cpp @@ -32,6 +32,7 @@ #include "engines/engine.h" #include "engines/dialogs.h" #include "engines/metaengine.h" +#include "engines/util.h" #include "common/config-manager.h" #include "common/debug.h" diff --git a/engines/engine.h b/engines/engine.h index fc05a0bed49..ead1526d721 100644 --- a/engines/engine.h +++ b/engines/engine.h @@ -28,8 +28,6 @@ #include "common/scummsys.h" #include "common/error.h" #include "common/str.h" -#include "common/list.h" -#include "graphics/pixelformat.h" class OSystem; @@ -46,28 +44,6 @@ namespace GUI { class Dialog; } -/** - * Setup the backend's graphics mode. - */ -void initCommonGFX(bool defaultTo1XScaler); - -/** - * Setup the backend's screen size and graphics mode. - * - * Shows an various warnings on certain backend graphics - * transaction failures (aspect switch, fullscreen switch, etc.). - * - * Errors out when backend is not able to switch to the specified - * mode. - * - * Defaults to 256 color paletted mode if no graphics format is provided. - * 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 &formatList); - /** * Initializes graphics and shows error message. */ diff --git a/engines/gob/video.cpp b/engines/gob/video.cpp index 9e1039f6599..e2c25c3a220 100644 --- a/engines/gob/video.cpp +++ b/engines/gob/video.cpp @@ -24,6 +24,9 @@ */ #include "common/endian.h" + +#include "engines/util.h" + #include "graphics/cursorman.h" #include "graphics/fontman.h" #include "graphics/surface.h" diff --git a/engines/groovie/groovie.cpp b/engines/groovie/groovie.cpp index 0beccbd6c19..0e460a90493 100644 --- a/engines/groovie/groovie.cpp +++ b/engines/groovie/groovie.cpp @@ -25,6 +25,9 @@ #include "common/config-manager.h" #include "common/events.h" + +#include "engines/util.h" + #include "sound/mixer.h" #include "groovie/groovie.h" diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp index 14463568ac6..d088aeb66db 100644 --- a/engines/kyra/screen.cpp +++ b/engines/kyra/screen.cpp @@ -27,6 +27,8 @@ #include "common/endian.h" #include "common/system.h" +#include "engines/util.h" + #include "graphics/cursorman.h" #include "graphics/sjis.h" diff --git a/engines/lure/lure.cpp b/engines/lure/lure.cpp index f74f5f818ab..45e207f0da6 100644 --- a/engines/lure/lure.cpp +++ b/engines/lure/lure.cpp @@ -28,6 +28,8 @@ #include "common/savefile.h" #include "common/EventRecorder.h" +#include "engines/util.h" + #include "lure/luredefs.h" #include "lure/surface.h" #include "lure/lure.h" diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp index 97b03c85828..37666f68801 100644 --- a/engines/m4/m4.cpp +++ b/engines/m4/m4.cpp @@ -58,7 +58,7 @@ #include "common/endian.h" #include "common/system.h" #include "common/config-manager.h" -#include "engines/engine.h" +#include "engines/util.h" #include "graphics/surface.h" #include "sound/mididrv.h" diff --git a/engines/made/made.cpp b/engines/made/made.cpp index 1e173c06290..54e21894714 100644 --- a/engines/made/made.cpp +++ b/engines/made/made.cpp @@ -33,6 +33,8 @@ #include "graphics/cursorman.h" +#include "engines/util.h" + #include "base/plugins.h" #include "base/version.h" diff --git a/engines/mohawk/graphics.cpp b/engines/mohawk/graphics.cpp index 6c41f67d85d..35691c36aa5 100644 --- a/engines/mohawk/graphics.cpp +++ b/engines/mohawk/graphics.cpp @@ -29,6 +29,8 @@ #include "mohawk/riven.h" #include "mohawk/riven_cursors.h" +#include "engines/util.h" + #include "graphics/cursorman.h" #include "graphics/primitives.h" #include "gui/message.h" diff --git a/engines/mohawk/livingbooks.cpp b/engines/mohawk/livingbooks.cpp index f0648fa1146..515ee7c8bac 100644 --- a/engines/mohawk/livingbooks.cpp +++ b/engines/mohawk/livingbooks.cpp @@ -28,6 +28,8 @@ #include "common/events.h" +#include "engines/util.h" + namespace Mohawk { MohawkEngine_LivingBooks::MohawkEngine_LivingBooks(OSystem *syst, const MohawkGameDescription *gamedesc) : MohawkEngine(syst, gamedesc) { diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp index d92fc00c1e9..a7b1f6fe32d 100644 --- a/engines/parallaction/graphics.cpp +++ b/engines/parallaction/graphics.cpp @@ -27,6 +27,7 @@ #include "common/system.h" #include "common/file.h" #include "graphics/primitives.h" +#include "engines/util.h" #include "parallaction/input.h" #include "parallaction/parallaction.h" diff --git a/engines/queen/queen.cpp b/engines/queen/queen.cpp index 29d9452f4cf..08b8ded3bb3 100644 --- a/engines/queen/queen.cpp +++ b/engines/queen/queen.cpp @@ -33,6 +33,8 @@ #include "common/events.h" #include "common/EventRecorder.h" +#include "engines/util.h" + #include "queen/queen.h" #include "queen/bankman.h" #include "queen/command.h" diff --git a/engines/saga/gfx.cpp b/engines/saga/gfx.cpp index a1c76caac79..bb0a1677b17 100644 --- a/engines/saga/gfx.cpp +++ b/engines/saga/gfx.cpp @@ -34,6 +34,7 @@ #include "common/system.h" #include "graphics/cursorman.h" +#include "engines/util.h" namespace Saga { diff --git a/engines/sci/graphics/screen.cpp b/engines/sci/graphics/screen.cpp index 21f9b0afdde..e6c710b252d 100644 --- a/engines/sci/graphics/screen.cpp +++ b/engines/sci/graphics/screen.cpp @@ -27,6 +27,7 @@ #include "common/util.h" #include "common/system.h" #include "graphics/surface.h" +#include "engines/util.h" #include "sci/sci.h" #include "sci/engine/state.h" diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index a730688c3ce..e96bfbad03d 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -28,6 +28,8 @@ #include "common/config-manager.h" #include "engines/advancedDetector.h" +#include "engines/util.h" + #include "sci/sci.h" #include "sci/debug.h" #include "sci/console.h" diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 29154b87384..93d4de6e974 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -29,6 +29,8 @@ #include "common/EventRecorder.h" #include "common/system.h" +#include "engines/util.h" + #include "gui/message.h" #include "gui/GuiManager.h" diff --git a/engines/sky/sky.cpp b/engines/sky/sky.cpp index c099dbc8b14..9ea20aafc6d 100644 --- a/engines/sky/sky.cpp +++ b/engines/sky/sky.cpp @@ -47,6 +47,9 @@ #include "sound/mididrv.h" #include "sound/mixer.h" +#include "engines/util.h" + + #ifdef _WIN32_WCE extern bool toolbar_drawn; diff --git a/engines/sword1/sword1.cpp b/engines/sword1/sword1.cpp index 2b3a4042fc9..26bb1d959b5 100644 --- a/engines/sword1/sword1.cpp +++ b/engines/sword1/sword1.cpp @@ -38,6 +38,8 @@ #include "common/config-manager.h" +#include "engines/util.h" + #include "gui/message.h" #include "gui/GuiManager.h" diff --git a/engines/sword2/sword2.cpp b/engines/sword2/sword2.cpp index 7d3a345d3c1..29f567d7ef9 100644 --- a/engines/sword2/sword2.cpp +++ b/engines/sword2/sword2.cpp @@ -25,8 +25,6 @@ * $Id$ */ - - #include "base/plugins.h" #include "common/config-manager.h" @@ -38,6 +36,7 @@ #include "common/system.h" #include "engines/metaengine.h" +#include "engines/util.h" #include "sword2/sword2.h" #include "sword2/defs.h" diff --git a/engines/teenagent/teenagent.cpp b/engines/teenagent/teenagent.cpp index eb38e4820c8..686ea8bb74b 100644 --- a/engines/teenagent/teenagent.cpp +++ b/engines/teenagent/teenagent.cpp @@ -27,11 +27,16 @@ #include "common/events.h" #include "common/savefile.h" #include "common/system.h" + #include "engines/advancedDetector.h" +#include "engines/util.h" + #include "sound/mixer.h" #include "sound/decoders/raw.h" + #include "graphics/cursorman.h" #include "graphics/thumbnail.h" + #include "teenagent/console.h" #include "teenagent/music.h" #include "teenagent/objects.h" diff --git a/engines/tinsel/tinsel.cpp b/engines/tinsel/tinsel.cpp index aed6aae0974..5f012ddff3b 100644 --- a/engines/tinsel/tinsel.cpp +++ b/engines/tinsel/tinsel.cpp @@ -35,6 +35,8 @@ #include "common/serializer.h" #include "common/stream.h" +#include "engines/util.h" + #include "graphics/cursorman.h" #include "base/plugins.h" diff --git a/engines/touche/touche.cpp b/engines/touche/touche.cpp index 185ad347530..9c54f18a797 100644 --- a/engines/touche/touche.cpp +++ b/engines/touche/touche.cpp @@ -29,6 +29,7 @@ #include "common/EventRecorder.h" #include "common/system.h" +#include "engines/util.h" #include "graphics/cursorman.h" #include "sound/mididrv.h" diff --git a/engines/tucker/tucker.cpp b/engines/tucker/tucker.cpp index f704dcb1955..c86991ab1bd 100644 --- a/engines/tucker/tucker.cpp +++ b/engines/tucker/tucker.cpp @@ -27,6 +27,8 @@ #include "common/events.h" #include "common/system.h" +#include "engines/util.h" + #include "graphics/cursorman.h" #include "tucker/tucker.h" diff --git a/engines/util.h b/engines/util.h new file mode 100644 index 00000000000..5bfc4f8ad96 --- /dev/null +++ b/engines/util.h @@ -0,0 +1,54 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + */ + +#ifndef ENGINES_UTIL_H +#define ENGINES_UTIL_H + +#include "common/scummsys.h" +#include "common/list.h" +#include "graphics/pixelformat.h" + +/** + * Setup the backend's graphics mode. + */ +void initCommonGFX(bool defaultTo1XScaler); + +/** + * Setup the backend's screen size and graphics mode. + * + * Shows an various warnings on certain backend graphics + * transaction failures (aspect switch, fullscreen switch, etc.). + * + * Errors out when backend is not able to switch to the specified + * mode. + * + * Defaults to 256 color paletted mode if no graphics format is provided. + * 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 &formatList); + +#endif