[Scummvm-git-logs] scummvm master -> 44e56aad77348d32d9f4e996386118f8eee37dde
sev-
noreply at scummvm.org
Sat Aug 31 17:24:17 UTC 2024
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
44e56aad77 QDENGINE: Got rid of the global variables in QDEngineEngine
Commit: 44e56aad77348d32d9f4e996386118f8eee37dde
https://github.com/scummvm/scummvm/commit/44e56aad77348d32d9f4e996386118f8eee37dde
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-08-31T19:23:53+02:00
Commit Message:
QDENGINE: Got rid of the global variables in QDEngineEngine
Changed paths:
engines/qdengine/qdengine.cpp
engines/qdengine/qdengine.h
diff --git a/engines/qdengine/qdengine.cpp b/engines/qdengine/qdengine.cpp
index 6499a01799b..ef5b369fa98 100644
--- a/engines/qdengine/qdengine.cpp
+++ b/engines/qdengine/qdengine.cpp
@@ -54,15 +54,11 @@
namespace QDEngine {
QDEngineEngine *g_engine;
-grDispatcher *grD = NULL;
-qdGameDispatcher *qd_gameD = NULL;
static void generateTagMap(int date, bool verbose = true);
void searchTagMap(int id, int targetVal);
static int detectVersion(Common::String gameID);
-static void init_graphics();
-static bool init_graphics_dispatcher();
static void restore_graphics();
static void qd_show_load_progress(int percents_loaded, void *p);
@@ -140,11 +136,7 @@ Common::Error QDEngineEngine::run() {
return Common::kNoGameDataFoundError;
}
- grD = new grDispatcher();
-
- grD->hideMouse();
-
- grD->showMouse(); // FIXME HACK
+ _grD = new grDispatcher();
SplashScreen sp;
if (ConfMan.getBool("splash_enabled")) {
@@ -161,15 +153,15 @@ Common::Error QDEngineEngine::run() {
grDispatcher::set_default_font(qdGameDispatcher::create_font(0));
- qd_gameD = new qdGameDispatcher;
- qd_gameD->load_script(script_name.c_str());
+ _gameD = new qdGameDispatcher;
+ _gameD->load_script(script_name.c_str());
if (ConfMan.getBool("dump_scripts")) {
- qd_gameD->save_script("qd_game.xml");
+ _gameD->save_script("qd_game.xml");
debug("Dumped qd_game.xml%s", debugChannelSet(-1, kDebugLog) ? " in human-readable form" : "");
}
- qd_gameD->set_scene_loading_progress_callback(qd_show_load_progress);
+ _gameD->set_scene_loading_progress_callback(qd_show_load_progress);
if (ConfMan.getBool("splash_enabled")) {
sp.wait(ConfMan.getInt("splash_time"));
@@ -184,18 +176,18 @@ Common::Error QDEngineEngine::run() {
winVideo::init();
- qd_gameD->load_resources();
+ _gameD->load_resources();
if (ConfMan.hasKey("boot_param")) {
const char *scene_name = ""; // FIXME. Implement actual scene selection
- if (!qd_gameD->select_scene(scene_name))
+ if (!_gameD->select_scene(scene_name))
error("Cannot find the startup scene");
} else {
bool music_enabled = mpegPlayer::instance().is_enabled();
mpegPlayer::instance().disable();
- qd_gameD->toggle_main_menu(true);
- if (!qd_gameD->start_intro_videos()) {
+ _gameD->toggle_main_menu(true);
+ if (!_gameD->start_intro_videos()) {
if (music_enabled)
mpegPlayer::instance().enable(true);
} else {
@@ -204,12 +196,12 @@ Common::Error QDEngineEngine::run() {
}
}
- qd_gameD->update_time();
- qd_gameD->quant();
+ _gameD->update_time();
+ _gameD->quant();
ResourceDispatcher resD;
resD.setTimer(ConfMan.getBool("logic_synchro_by_clock"), ConfMan.getInt("logic_period"), 300);
- resD.attach(new MemberFunctionCallResourceUser<qdGameDispatcher>(*qd_gameD, &qdGameDispatcher::quant, ConfMan.getInt("logic_period")));
+ resD.attach(new MemberFunctionCallResourceUser<qdGameDispatcher>(*_gameD, &qdGameDispatcher::quant, ConfMan.getInt("logic_period")));
sndD->set_frequency_coeff(ConfMan.getFloat("game_speed"));
resD.set_speed(ConfMan.getFloat("game_speed"));
resD.start();
@@ -222,7 +214,7 @@ Common::Error QDEngineEngine::run() {
Common::Event event;
- while (!exit_flag && !qd_gameD->need_exit()) {
+ while (!exit_flag && !_gameD->need_exit()) {
while (g_system->getEventManager()->pollEvent(event)) {
switch (event.type) {
case Common::EVENT_QUIT:
@@ -277,7 +269,7 @@ Common::Error QDEngineEngine::run() {
g_system->delayMillis(500);
}
resD.quant();
- qd_gameD->redraw();
+ _gameD->redraw();
} else {
was_inactive = true;
@@ -288,14 +280,14 @@ Common::Error QDEngineEngine::run() {
g_system->updateScreen();
}
- delete qd_gameD;
+ delete _gameD;
grDispatcher::instance()->finit();
qdFileManager::instance().Finit();
delete sndD;
- delete grD;
+ delete _grD;
winVideo::done();
@@ -417,14 +409,13 @@ static int detectVersion(Common::String gameID) {
}
}
-void init_graphics() {
+void QDEngineEngine::init_graphics() {
grDispatcher::set_restore_handler(restore_graphics);
grDispatcher::instance()->finit();
- grDispatcher::set_instance(grD);
+ grDispatcher::set_instance(_grD);
- if (!init_graphics_dispatcher())
- return;
+ grDispatcher::instance()->init(g_engine->_screenW, g_engine->_screenH, GR_RGB565);
grDispatcher::instance()->setClip();
grDispatcher::instance()->setClipMode(1);
@@ -436,11 +427,6 @@ void init_graphics() {
grDispatcher::instance()->flush();
}
-bool init_graphics_dispatcher() {
- grDispatcher::instance()->init(g_engine->_screenW, g_engine->_screenH, GR_RGB565);
- return true;
-}
-
void qd_show_load_progress(int percents_loaded, void *p) {
const int rect_sx = 200;
const int rect_sy = 10;
diff --git a/engines/qdengine/qdengine.h b/engines/qdengine/qdengine.h
index a97c70d8c1b..e4639777b2e 100644
--- a/engines/qdengine/qdengine.h
+++ b/engines/qdengine/qdengine.h
@@ -41,6 +41,8 @@ class Screen;
namespace QDEngine {
struct QDEngineGameDescription;
+class grDispatcher;
+class qdGameDispatcher;
enum QDEngineDebugChannels {
kDebugGraphics = 1,
@@ -59,9 +61,14 @@ class QDEngineEngine : public Engine {
private:
const ADGameDescription *_gameDescription;
Common::RandomSource _randomSource;
+
+ grDispatcher *_grD = nullptr;
+ qdGameDispatcher *_gameD = nullptr;
+
protected:
// Engine APIs
Common::Error run() override;
+
public:
Graphics::Screen *_screen = nullptr;
Graphics::PixelFormat _pixelformat;
@@ -71,6 +78,7 @@ public:
int _screenH;
bool _forceFullRedraw = false;
+
public:
QDEngineEngine(OSystem *syst, const ADGameDescription *gameDesc);
~QDEngineEngine() override;
@@ -128,6 +136,9 @@ public:
qdScreenTextFormat _global_text_format;
// Global format for dialog topics
qdScreenTextFormat _global_topic_format;
+
+private:
+ void init_graphics();
};
extern QDEngineEngine *g_engine;
More information about the Scummvm-git-logs
mailing list