aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backends/midi/adlib.cpp1
-rw-r--r--backends/midi/morphos.cpp1
-rw-r--r--backends/midi/ypa1.cpp1
-rw-r--r--base/engine.cpp4
-rw-r--r--base/engine.h5
-rw-r--r--base/main.cpp9
-rw-r--r--common/system.h3
-rw-r--r--common/timer.cpp2
-rw-r--r--common/timer.h2
-rw-r--r--sound/mpu401.cpp16
10 files changed, 17 insertions, 27 deletions
diff --git a/backends/midi/adlib.cpp b/backends/midi/adlib.cpp
index efd412235e..8cde3a0b6e 100644
--- a/backends/midi/adlib.cpp
+++ b/backends/midi/adlib.cpp
@@ -22,7 +22,6 @@
#include "sound/mididrv.h"
#include "sound/fmopl.h"
#include "sound/mixer.h"
-#include "base/engine.h" // for g_system
#include "common/util.h"
#define BASE_FREQ 250
diff --git a/backends/midi/morphos.cpp b/backends/midi/morphos.cpp
index ab941ca6bf..abfef2e0b0 100644
--- a/backends/midi/morphos.cpp
+++ b/backends/midi/morphos.cpp
@@ -31,7 +31,6 @@
#include "stdafx.h"
#include "sound/mpu401.h"
-#include "base/engine.h" // for g_system
#include "common/util.h"
#include "morphos.h"
#include "morphos_sound.h"
diff --git a/backends/midi/ypa1.cpp b/backends/midi/ypa1.cpp
index 3bcb06eb3a..19671d5610 100644
--- a/backends/midi/ypa1.cpp
+++ b/backends/midi/ypa1.cpp
@@ -20,7 +20,6 @@
#include "stdafx.h"
#include "sound/mpu401.h"
-#include "base/engine.h" // for g_system
#include "common/util.h"
#include "Pa1Lib.h"
diff --git a/base/engine.cpp b/base/engine.cpp
index 8335b28e94..9eb5ab8e42 100644
--- a/base/engine.cpp
+++ b/base/engine.cpp
@@ -29,7 +29,6 @@
#include "sound/mixer.h"
/* FIXME - BIG HACK for MidiEmu */
-OSystem *g_system = 0;
Engine *g_engine = 0;
Engine::Engine(GameDetector *detector, OSystem *syst)
@@ -39,9 +38,6 @@ Engine::Engine(GameDetector *detector, OSystem *syst)
_gameDataPath = detector->_gameDataPath;
- g_system = _system; // FIXME - BIG HACK for MidiEmu
-
- extern Timer *g_timer;
_timer = g_timer;
}
diff --git a/base/engine.h b/base/engine.h
index 8e9db2751b..049b0b9bdc 100644
--- a/base/engine.h
+++ b/base/engine.h
@@ -49,7 +49,7 @@ enum GameId {
GID_SWORD2_FIRST,
GID_SWORD2_LAST = GID_SWORD2_FIRST + 9,
- //Flight of the Amazon Queen
+ // Flight of the Amazon Queen
GID_QUEEN_FIRST,
GID_QUEEN_LAST = GID_QUEEN_FIRST + 9
};
@@ -60,9 +60,6 @@ class GameDetector;
class Timer;
struct TargetSettings;
-/* FIXME - BIG HACK for MidiEmu */
-extern OSystem *g_system;
-
class Engine {
public:
OSystem *_system;
diff --git a/base/main.cpp b/base/main.cpp
index 643e47dcdb..b47b9e4b17 100644
--- a/base/main.cpp
+++ b/base/main.cpp
@@ -85,7 +85,7 @@ const char *gScummVMFullVersion = "ScummVM 0.5.3cvs (" __DATE__ " " __TIME__ ")"
Config *g_config = 0;
NewGui *g_gui = 0;
-Timer *g_timer = 0;
+OSystem *g_system = 0;
#if defined(WIN32) && defined(NO_CONSOLE)
#include <cstdio>
@@ -197,10 +197,6 @@ static void launcherDialog(GameDetector &detector, OSystem *system) {
system->set_palette(dummy_palette, 0, 16);
- // FIXME - hack we use because LauncherDialog accesses g_system
- extern OSystem *g_system;
- g_system = system;
-
LauncherDialog dlg(g_gui, detector);
dlg.runModal();
}
@@ -281,6 +277,7 @@ int main(int argc, char *argv[]) {
// Create the system object
OSystem *system = detector.createSystem();
+ g_system = system;
// Set initial window caption
prop.caption = "ScummVM";
@@ -309,7 +306,7 @@ int main(int argc, char *argv[]) {
}
// Create the timer services
- g_timer = new Timer (system);
+ g_timer = new Timer(system);
// Create the game engine
Engine *engine = detector.createEngine(system);
diff --git a/common/system.h b/common/system.h
index 4da287e980..164316f71d 100644
--- a/common/system.h
+++ b/common/system.h
@@ -349,4 +349,7 @@ public:
//@}
};
+/** The global OSystem instance. Inited in main(). */
+extern OSystem *g_system;
+
#endif
diff --git a/common/timer.cpp b/common/timer.cpp
index 511d4f03e3..cc8bf00efc 100644
--- a/common/timer.cpp
+++ b/common/timer.cpp
@@ -25,7 +25,7 @@
#include "common/timer.h"
#include "common/util.h"
-static Timer *g_timer = NULL;
+Timer *g_timer = NULL;
Timer::Timer(OSystem *system) :
_system(system),
diff --git a/common/timer.h b/common/timer.h
index 8299b193f7..5aaa7ccf96 100644
--- a/common/timer.h
+++ b/common/timer.h
@@ -60,6 +60,8 @@ protected:
int handler(int t);
};
+extern Timer *g_timer;
+
#endif
#endif
diff --git a/sound/mpu401.cpp b/sound/mpu401.cpp
index e11963048d..aa798005ad 100644
--- a/sound/mpu401.cpp
+++ b/sound/mpu401.cpp
@@ -24,8 +24,6 @@
#include "common/timer.h"
#include "common/util.h" // for ARRAYSIZE
-extern Timer *g_timer;
-
void MidiChannel_MPU401::init(MidiDriver_MPU401 *owner, byte channel) {
_owner = owner;
_channel = channel;
@@ -45,7 +43,7 @@ void MidiChannel_MPU401::noteOff (byte note) {
}
void MidiChannel_MPU401::noteOn(byte note, byte velocity) {
- _owner->send (velocity << 16 | note << 8 | 0x90 | _channel);
+ _owner->send(velocity << 16 | note << 8 | 0x90 | _channel);
}
void MidiChannel_MPU401::programChange(byte program) {
@@ -61,11 +59,11 @@ void MidiChannel_MPU401::controlChange(byte control, byte value) {
}
void MidiChannel_MPU401::pitchBendFactor(byte value) {
- _owner->setPitchBendRange (_channel, value);
+ _owner->setPitchBendRange(_channel, value);
}
void MidiChannel_MPU401::sysEx_customInstrument(uint32 type, byte *instr) {
- _owner->sysEx_customInstrument (_channel, type, instr);
+ _owner->sysEx_customInstrument(_channel, type, instr);
}
const char *MidiDriver::getErrorName(int error_code) {
@@ -96,7 +94,7 @@ MidiDriver_MPU401::MidiDriver_MPU401() :
void MidiDriver_MPU401::close() {
if (_timer_proc)
- g_timer->releaseProcedure (_timer_proc);
+ g_timer->releaseProcedure(_timer_proc);
_timer_proc = 0;
for (int i = 0; i < 16; ++i)
send (0x7B << 8 | 0xB0 | i);
@@ -122,7 +120,7 @@ MidiChannel *MidiDriver_MPU401::allocateChannel() {
chan = &_midi_channels[i];
if (!chan->_allocated) {
chan->allocate();
- return (chan);
+ return chan;
}
}
return NULL;
@@ -131,9 +129,9 @@ MidiChannel *MidiDriver_MPU401::allocateChannel() {
void MidiDriver_MPU401::setTimerCallback (void *timer_param, TimerProc timer_proc) {
if (!_timer_proc || !timer_proc) {
if (_timer_proc)
- g_timer->releaseProcedure (_timer_proc);
+ g_timer->releaseProcedure(_timer_proc);
_timer_proc = timer_proc;
if (timer_proc)
- g_timer->installProcedure (timer_proc, 10000, timer_param);
+ g_timer->installProcedure(timer_proc, 10000, timer_param);
}
}