diff options
79 files changed, 164 insertions, 53 deletions
diff --git a/base/gameDetector.cpp b/base/gameDetector.cpp index 8a17faa684..44e823ef65 100644 --- a/base/gameDetector.cpp +++ b/base/gameDetector.cpp @@ -28,6 +28,7 @@ #include "base/version.h" #include "common/config-manager.h" +#include "common/system.h" #include "sound/mididrv.h" #include "sound/mixer.h" diff --git a/base/main.cpp b/base/main.cpp index 1cfd92a35b..51ca83fe0f 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -35,6 +35,7 @@ #include "base/version.h" #include "common/config-manager.h" #include "common/file.h" +#include "common/system.h" #include "common/timer.h" #include "gui/newgui.h" #include "gui/launcher.h" diff --git a/common/debugger.cpp b/common/debugger.cpp index d8090d0955..8d967a1792 100644 --- a/common/debugger.cpp +++ b/common/debugger.cpp @@ -21,6 +21,7 @@ #include "stdafx.h" #include "common/debugger.h" +#include "common/system.h" #if USE_CONSOLE #include "gui/console.h" diff --git a/common/timer.cpp b/common/timer.cpp index b5725f6cea..230366ad0d 100644 --- a/common/timer.cpp +++ b/common/timer.cpp @@ -24,6 +24,7 @@ #include "common/scummsys.h" #include "common/timer.h" #include "common/util.h" +#include "common/system.h" Timer *g_timer = NULL; diff --git a/common/timer.h b/common/timer.h index abd828cd3e..6b3509f41c 100644 --- a/common/timer.h +++ b/common/timer.h @@ -22,7 +22,7 @@ #define COMMON_TIMER_H #include "common/scummsys.h" -#include "common/system.h" +#include "common/mutex.h" #define MAX_TIMERS 2 @@ -31,13 +31,15 @@ #include "morphos_timer.h" #else +class OSystem; + class Timer { public: typedef void (*TimerProc)(void *refCon); private: OSystem *_system; - OSystem::MutexRef _mutex; + Common::MutexRef _mutex; void *_timerHandler; int32 _thisTime; int32 _lastTime; diff --git a/graphics/animation.cpp b/graphics/animation.cpp index 48a85fa03c..f54779ea2d 100644 --- a/graphics/animation.cpp +++ b/graphics/animation.cpp @@ -21,9 +21,10 @@ #include "common/stdafx.h" #include "graphics/animation.h" -#include "common/file.h" #include "sound/audiostream.h" #include "common/config-manager.h" +#include "common/file.h" +#include "common/system.h" namespace Graphics { diff --git a/gui/EditTextWidget.cpp b/gui/EditTextWidget.cpp index 5ad3b23286..1e788aef91 100644 --- a/gui/EditTextWidget.cpp +++ b/gui/EditTextWidget.cpp @@ -42,7 +42,7 @@ EditTextWidget::EditTextWidget(GuiObject *boss, int x, int y, int w, int h, cons } void EditTextWidget::handleTickle() { - uint32 time = g_system->getMillis(); + uint32 time = getMillis(); if (_caretTime < time) { _caretTime = time + kCaretBlinkTime; drawCaret(_caretVisible); diff --git a/gui/ListWidget.cpp b/gui/ListWidget.cpp index 0496c0c16c..5bd59827cb 100644 --- a/gui/ListWidget.cpp +++ b/gui/ListWidget.cpp @@ -110,7 +110,7 @@ void ListWidget::scrollBarRecalc() { } void ListWidget::handleTickle() { - uint32 time = g_system->getMillis(); + uint32 time = getMillis(); if (_editMode && _caretTime < time) { _caretTime = time + kCaretBlinkTime; drawCaret(_caretVisible); @@ -172,7 +172,7 @@ bool ListWidget::handleKeyDown(uint16 ascii, int keycode, int modifiers) { // Only works in a useful fashion if the list entries are sorted. // TODO: Maybe this should be off by default, and instead we add a // method "enableQuickSelect()" or so ? - uint32 time = g_system->getMillis(); + uint32 time = getMillis(); if (_quickSelectTime < time) { _quickSelectStr = (char)ascii; } else { diff --git a/gui/PopUpWidget.cpp b/gui/PopUpWidget.cpp index aa7f4cbab2..ac72892a7d 100644 --- a/gui/PopUpWidget.cpp +++ b/gui/PopUpWidget.cpp @@ -19,9 +19,9 @@ */ #include "stdafx.h" -#include "gui/PopUpWidget.h" #include "gui/dialog.h" #include "gui/newgui.h" +#include "gui/PopUpWidget.h" #include "base/engine.h" namespace GUI { @@ -102,7 +102,7 @@ PopUpDialog::PopUpDialog(PopUpWidget *boss, int clickX, int clickY) _clickY = clickY - _y; // Time the popup was opened - _openTime = g_system->getMillis(); + _openTime = getMillis(); } void PopUpDialog::drawDialog() { @@ -125,7 +125,7 @@ void PopUpDialog::handleMouseUp(int x, int y, int button, int clickCount) { // Mouse was released. If it wasn't moved much since the original mouse down, // let the popup stay open. If it did move, assume the user made his selection. int dist = (_clickX - x) * (_clickX - x) + (_clickY - y) * (_clickY - y); - if (dist > 3 * 3 || g_system->getMillis() - _openTime > 300) { + if (dist > 3 * 3 || getMillis() - _openTime > 300) { setResult(_selection); close(); } diff --git a/gui/about.cpp b/gui/about.cpp index e2bb3ac3fd..96a6fc50a9 100644 --- a/gui/about.cpp +++ b/gui/about.cpp @@ -21,6 +21,7 @@ #include "stdafx.h" #include "base/engine.h" #include "base/version.h" +#include "common/system.h" #include "gui/about.h" #include "gui/newgui.h" #include "gui/widget.h" @@ -114,7 +115,7 @@ AboutDialog::AboutDialog() } void AboutDialog::open() { - _scrollTime = g_system->getMillis() + kScrollStartDelay; + _scrollTime = getMillis() + kScrollStartDelay; _scrollPos = 0; _modifiers = 0; _willClose = false; @@ -193,7 +194,7 @@ void AboutDialog::drawDialog() { void AboutDialog::handleTickle() { - const uint32 t = g_system->getMillis(); + const uint32 t = getMillis(); int scrollOffset = ((int)t - (int)_scrollTime) / kScrollMillisPerPixel; if (scrollOffset > 0) { // Scroll faster when shift is pressed diff --git a/gui/browser.cpp b/gui/browser.cpp index 5b86a662cb..9e42f6900e 100644 --- a/gui/browser.cpp +++ b/gui/browser.cpp @@ -25,6 +25,8 @@ #include "backends/fs/fs.h" +#include "common/system.h" + namespace GUI { #ifdef MACOSX diff --git a/gui/console.cpp b/gui/console.cpp index 48387e7e9d..b9d2374c92 100644 --- a/gui/console.cpp +++ b/gui/console.cpp @@ -25,6 +25,8 @@ #include "base/engine.h" #include "base/version.h" +#include "common/system.h" + #include "graphics/font.h" namespace GUI { diff --git a/gui/dialog.cpp b/gui/dialog.cpp index f2ee027f56..dde31feeb2 100644 --- a/gui/dialog.cpp +++ b/gui/dialog.cpp @@ -21,9 +21,11 @@ #include <ctype.h> #include "stdafx.h" -#include "newgui.h" -#include "dialog.h" -#include "widget.h" +#include "gui/newgui.h" +#include "gui/dialog.h" +#include "gui/widget.h" + +#include "common/system.h" namespace GUI { @@ -294,4 +296,9 @@ ButtonWidget *Dialog::addButton(int x, int y, const Common::String &label, uint3 return new ButtonWidget(this, x, y, kButtonWidth, 16, label, cmd, hotkey); } + +uint32 GuiObject::getMillis() { + return g_system->getMillis(); +} + } // End of namespace GUI diff --git a/gui/message.cpp b/gui/message.cpp index 5ee78027e5..d5d44238df 100644 --- a/gui/message.cpp +++ b/gui/message.cpp @@ -156,12 +156,12 @@ void MessageDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data TimedMessageDialog::TimedMessageDialog(const Common::String &message, uint32 duration) : MessageDialog(message, 0, 0) { - _timer = g_system->getMillis() + duration; + _timer = getMillis() + duration; } void TimedMessageDialog::handleTickle() { MessageDialog::handleTickle(); - if (g_system->getMillis() > _timer) + if (getMillis() > _timer) close(); } diff --git a/gui/newgui.cpp b/gui/newgui.cpp index 206cec532b..c6fb6b8683 100644 --- a/gui/newgui.cpp +++ b/gui/newgui.cpp @@ -19,6 +19,7 @@ */ #include "stdafx.h" +#include "common/system.h" #include "common/util.h" #include "gui/newgui.h" #include "gui/dialog.h" diff --git a/gui/newgui.h b/gui/newgui.h index ed4f69dd96..4acce206f7 100644 --- a/gui/newgui.h +++ b/gui/newgui.h @@ -25,9 +25,10 @@ #include "common/singleton.h" #include "common/stack.h" #include "common/str.h" -#include "common/system.h" // For events #include "graphics/fontman.h" +class OSystem; + namespace GUI { class Dialog; diff --git a/gui/object.h b/gui/object.h index f581940444..3ca5248228 100644 --- a/gui/object.h +++ b/gui/object.h @@ -75,6 +75,10 @@ public: protected: virtual void releaseFocus() = 0; + + // Convenience alias for OSystem::getMillis(). + // This is a bit hackish, of course :-). + uint32 getMillis(); }; } // End of namespace GUI diff --git a/gui/options.cpp b/gui/options.cpp index 58afa3e37b..1a6cd0f2f6 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -30,6 +30,7 @@ #include "backends/fs/fs.h" #include "common/config-manager.h" #include "common/scaler.h" +#include "common/system.h" #include "sound/mididrv.h" #include "sound/mixer.h" diff --git a/queen/queen.cpp b/queen/queen.cpp index 7211b4d249..450d762a10 100644 --- a/queen/queen.cpp +++ b/queen/queen.cpp @@ -29,6 +29,8 @@ #include "common/config-manager.h" #include "common/file.h" #include "common/timer.h" +#include "common/savefile.h" +#include "common/system.h" #include "queen/queen.h" #include "queen/bankman.h" diff --git a/saga/render.cpp b/saga/render.cpp index 69f21a943e..c3a72e779e 100644 --- a/saga/render.cpp +++ b/saga/render.cpp @@ -35,7 +35,9 @@ #include "saga/objectmap.h" #include "saga/render.h" -#include <common/timer.h> + +#include "common/timer.h" +#include "common/system.h" namespace Saga { diff --git a/saga/saga.cpp b/saga/saga.cpp index e864414e69..89340353fc 100644 --- a/saga/saga.cpp +++ b/saga/saga.cpp @@ -26,9 +26,11 @@ #include "base/plugins.h" #include "backends/fs/fs.h" -#include "sound/mixer.h" #include "common/file.h" #include "common/config-manager.h" +#include "common/system.h" + +#include "sound/mixer.h" #include "saga/saga.h" diff --git a/scumm/debugger.cpp b/scumm/debugger.cpp index 042a8651a2..8d5b0710dd 100644 --- a/scumm/debugger.cpp +++ b/scumm/debugger.cpp @@ -23,6 +23,7 @@ #include "common/config-manager.h" #include "common/file.h" #include "common/str.h" +#include "common/system.h" #include "common/util.h" #include "scumm/actor.h" diff --git a/scumm/dialogs.cpp b/scumm/dialogs.cpp index 873ad56e60..e53e6429d5 100644 --- a/scumm/dialogs.cpp +++ b/scumm/dialogs.cpp @@ -21,6 +21,7 @@ #include "stdafx.h" #include "common/config-manager.h" +#include "common/system.h" #include "gui/chooser.h" #include "gui/newgui.h" diff --git a/scumm/imuse.cpp b/scumm/imuse.cpp index 3a3dc8bae5..568314b020 100644 --- a/scumm/imuse.cpp +++ b/scumm/imuse.cpp @@ -25,6 +25,7 @@ #include "base/version.h" #include "common/util.h" +#include "common/system.h" #include "scumm/imuse.h" #include "scumm/imuse_internal.h" diff --git a/scumm/imuse.h b/scumm/imuse.h index c02cc33344..a9da34247b 100644 --- a/scumm/imuse.h +++ b/scumm/imuse.h @@ -24,7 +24,7 @@ #define IMUSE_H #include "common/scummsys.h" -#include "common/system.h" +#include "common/mutex.h" #include "scumm/music.h" class MidiDriver; @@ -40,7 +40,7 @@ class IMuse : public MusicEngine { private: OSystem *_system; IMuseInternal *_target; - mutable OSystem::MutexRef _mutex; + mutable Common::MutexRef _mutex; IMuse(OSystem *system, IMuseInternal *target); void in() const; diff --git a/scumm/imuse_digi/dimuse.cpp b/scumm/imuse_digi/dimuse.cpp index 036be47137..1f9b702282 100644 --- a/scumm/imuse_digi/dimuse.cpp +++ b/scumm/imuse_digi/dimuse.cpp @@ -19,6 +19,7 @@ */ #include "stdafx.h" +#include "common/system.h" #include "common/timer.h" #include "scumm/actor.h" diff --git a/scumm/imuse_digi/dimuse.h b/scumm/imuse_digi/dimuse.h index eb1e0df68f..dce27f3816 100644 --- a/scumm/imuse_digi/dimuse.h +++ b/scumm/imuse_digi/dimuse.h @@ -84,7 +84,7 @@ private: Track *_track[MAX_DIGITAL_TRACKS + MAX_DIGITAL_FADETRACKS]; - OSystem::MutexRef _mutex; + Common::MutexRef _mutex; ScummEngine *_vm; ImuseDigiSndMgr *_sound; diff --git a/scumm/imuse_digi/dimuse_script.cpp b/scumm/imuse_digi/dimuse_script.cpp index edef204032..356e004bdb 100644 --- a/scumm/imuse_digi/dimuse_script.cpp +++ b/scumm/imuse_digi/dimuse_script.cpp @@ -19,6 +19,7 @@ */ #include "stdafx.h" +#include "common/system.h" #include "common/timer.h" #include "scumm/actor.h" diff --git a/scumm/imuse_digi/dimuse_sndmgr.h b/scumm/imuse_digi/dimuse_sndmgr.h index 421bcab9eb..3435e256b2 100644 --- a/scumm/imuse_digi/dimuse_sndmgr.h +++ b/scumm/imuse_digi/dimuse_sndmgr.h @@ -23,7 +23,6 @@ #include "stdafx.h" #include "common/scummsys.h" -#include "common/system.h" #include "scumm/imuse_digi/dimuse_bndmgr.h" namespace Scumm { diff --git a/scumm/input.cpp b/scumm/input.cpp index 376196122f..912574ca76 100644 --- a/scumm/input.cpp +++ b/scumm/input.cpp @@ -23,6 +23,7 @@ #include "stdafx.h" #include "common/config-manager.h" +#include "common/system.h" #include "scumm/debugger.h" #include "scumm/imuse.h" diff --git a/scumm/insane/insane.cpp b/scumm/insane/insane.cpp index 84acd3f790..5f23226a78 100644 --- a/scumm/insane/insane.cpp +++ b/scumm/insane/insane.cpp @@ -24,6 +24,8 @@ #include "base/engine.h" +#include "common/system.h" + #include "scumm/scumm.h" #include "scumm/actor.h" #include "scumm/sound.h" diff --git a/scumm/player_v2.cpp b/scumm/player_v2.cpp index 452bd3b913..7a9db4fb0e 100644 --- a/scumm/player_v2.cpp +++ b/scumm/player_v2.cpp @@ -22,6 +22,7 @@ #include "stdafx.h" #include "base/engine.h" +#include "common/system.h" #include "scumm/player_v2.h" #include "scumm/scumm.h" #include "sound/mididrv.h" @@ -963,6 +964,14 @@ void Player_V2::generatePCjrSamples(int16 *data, uint len) { lowPassFilter(data, len); } +void Player_V2::mutex_up() { + _system->lockMutex (_mutex); +} + +void Player_V2::mutex_down() { + _system->unlockMutex (_mutex); +} + } // End of namespace Scumm #ifdef __PALM_OS__ diff --git a/scumm/player_v2.h b/scumm/player_v2.h index 3ba3f99a0c..7cc4c3e28a 100644 --- a/scumm/player_v2.h +++ b/scumm/player_v2.h @@ -24,7 +24,7 @@ #define PLAYER_V2_H #include "common/scummsys.h" -#include "common/system.h" +#include "common/mutex.h" #include "scumm/music.h" #include "sound/audiostream.h" @@ -133,12 +133,12 @@ private: const uint16 *_freqs_table; - OSystem::MutexRef _mutex; + Common::MutexRef _mutex; ChannelInfo _channels[5]; protected: - void mutex_up() { _system->lockMutex (_mutex); } - void mutex_down() { _system->unlockMutex (_mutex); } + void mutex_up(); + void mutex_down(); virtual void nextTick(); virtual void clear_channel(int i); diff --git a/scumm/saveload.cpp b/scumm/saveload.cpp index ca88038c01..73293371a2 100644 --- a/scumm/saveload.cpp +++ b/scumm/saveload.cpp @@ -23,6 +23,8 @@ #include "stdafx.h" #include "common/config-manager.h" +#include "common/savefile.h" +#include "common/system.h" #include "scumm/actor.h" #include "scumm/charset.h" diff --git a/scumm/script_v5.cpp b/scumm/script_v5.cpp index 28f3fdd1cc..e4eed6b1a3 100644 --- a/scumm/script_v5.cpp +++ b/scumm/script_v5.cpp @@ -28,6 +28,7 @@ #include "scumm/scumm.h" #include "scumm/sound.h" #include "scumm/verbs.h" +#include "common/savefile.h" namespace Scumm { diff --git a/scumm/script_v72he.cpp b/scumm/script_v72he.cpp index 3322edc469..dc9abc00d6 100644 --- a/scumm/script_v72he.cpp +++ b/scumm/script_v72he.cpp @@ -24,6 +24,7 @@ #include "stdafx.h" #include "common/config-manager.h" +#include "common/system.h" #include "scumm/actor.h" #include "scumm/charset.h" diff --git a/scumm/script_v8.cpp b/scumm/script_v8.cpp index b6d9d765bc..7b026d49b0 100644 --- a/scumm/script_v8.cpp +++ b/scumm/script_v8.cpp @@ -21,6 +21,7 @@ #include "stdafx.h" #include "common/config-manager.h" +#include "common/system.h" #include "scumm/actor.h" #include "scumm/akos.h" #include "scumm/charset.h" diff --git a/scumm/scumm.cpp b/scumm/scumm.cpp index 399f084b6f..094f8caafc 100644 --- a/scumm/scumm.cpp +++ b/scumm/scumm.cpp @@ -29,6 +29,7 @@ #include "common/config-manager.h" #include "common/md5.h" +#include "common/system.h" #include "gui/message.h" #include "gui/newgui.h" diff --git a/scumm/smush/smush_player.cpp b/scumm/smush/smush_player.cpp index 794221ac6e..d5eaac4511 100644 --- a/scumm/smush/smush_player.cpp +++ b/scumm/smush/smush_player.cpp @@ -25,8 +25,9 @@ #include "common/config-manager.h" #include "common/file.h" -#include "common/util.h" +#include "common/system.h" #include "common/timer.h" +#include "common/util.h" #include "scumm/bomp.h" #include "scumm/imuse_digi/dimuse.h" diff --git a/scumm/sound.cpp b/scumm/sound.cpp index 6892579cf4..d9bd683011 100644 --- a/scumm/sound.cpp +++ b/scumm/sound.cpp @@ -29,6 +29,7 @@ #include "scumm/sound.h" #include "common/config-manager.h" +#include "common/system.h" #include "common/timer.h" #include "common/util.h" diff --git a/simon/cursor.cpp b/simon/cursor.cpp index 51178288fc..a8fe272e75 100644 --- a/simon/cursor.cpp +++ b/simon/cursor.cpp @@ -23,6 +23,7 @@ #include "simon/simon.h" #include "simon/intern.h" +#include "common/system.h" namespace Simon { diff --git a/simon/items.cpp b/simon/items.cpp index e1a3d4e31b..f4698f53de 100644 --- a/simon/items.cpp +++ b/simon/items.cpp @@ -26,6 +26,8 @@ #include "simon/simon.h" #include "simon/intern.h" +#include "common/system.h" + namespace Simon { int SimonEngine::runScript() { diff --git a/simon/midi.h b/simon/midi.h index d7075bc58d..ac53cbc021 100644 --- a/simon/midi.h +++ b/simon/midi.h @@ -24,6 +24,7 @@ #include "sound/mididrv.h" #include "sound/midiparser.h" +#include "common/mutex.h" class File; class OSystem; @@ -52,7 +53,7 @@ struct MusicInfo { class MidiPlayer : public MidiDriver { protected: OSystem *_system; - OSystem::MutexRef _mutex; + Common::MutexRef _mutex; MidiDriver *_driver; bool _map_mt32_to_gm; bool _passThrough; diff --git a/simon/saveload.cpp b/simon/saveload.cpp index 7e95694822..4e68368a10 100644 --- a/simon/saveload.cpp +++ b/simon/saveload.cpp @@ -34,6 +34,9 @@ #include "simon/simon.h" #include "simon/intern.h" +#include "common/savefile.h" +#include "common/system.h" + namespace Simon { void SimonEngine::o_save_game() { diff --git a/simon/simon.cpp b/simon/simon.cpp index 962617f6ad..e54ad83e19 100644 --- a/simon/simon.cpp +++ b/simon/simon.cpp @@ -29,6 +29,7 @@ #include "common/config-manager.h" #include "common/file.h" #include "common/md5.h" +#include "common/system.h" #include "gui/about.h" #include "gui/message.h" diff --git a/simon/vga.cpp b/simon/vga.cpp index 550548476b..5ff57296a4 100644 --- a/simon/vga.cpp +++ b/simon/vga.cpp @@ -25,6 +25,8 @@ #include "simon/intern.h" #include "simon/vga.h" +#include "common/system.h" + namespace Simon { typedef void (SimonEngine::*VgaOpcodeProc) (); diff --git a/sky/intro.cpp b/sky/intro.cpp index b51582425e..39f06688dc 100644 --- a/sky/intro.cpp +++ b/sky/intro.cpp @@ -21,6 +21,7 @@ #include "stdafx.h" #include "common/util.h" +#include "common/system.h" #include "sky/disk.h" #include "sky/intro.h" #include "sky/music/musicbase.h" diff --git a/sky/music/mt32music.cpp b/sky/music/mt32music.cpp index 9b384bcca8..6f941499d1 100644 --- a/sky/music/mt32music.cpp +++ b/sky/music/mt32music.cpp @@ -22,6 +22,7 @@ #include "sky/music/mt32music.h" #include "sky/music/gmchannel.h" #include "common/util.h" +#include "common/system.h" #include "sound/mididrv.h" namespace Sky { @@ -96,7 +97,8 @@ bool MT32Music::processPatchSysEx(uint8 *sysExData) { uint8 sysExBuf[15]; uint8 crc = 0; - if (sysExData[0] & 0x80) return false; + if (sysExData[0] & 0x80) + return false; // decompress data from stream sysExBuf[0] = 0x41; sysExBuf[1] = 0x10; sysExBuf[2] = 0x16; sysExBuf[3] = 0x12; sysExBuf[4] = 0x5; @@ -113,7 +115,7 @@ bool MT32Music::processPatchSysEx(uint8 *sysExData) { crc -= sysExBuf[cnt]; sysExBuf[14] = crc & 0x7F; // crc _midiDrv->sysEx(sysExBuf, 15); - g_system->delayMillis (5); + g_system->delayMillis(5); return true; } diff --git a/sky/music/musicbase.cpp b/sky/music/musicbase.cpp index 8138ccd0bb..104b132103 100644 --- a/sky/music/musicbase.cpp +++ b/sky/music/musicbase.cpp @@ -22,6 +22,7 @@ #include "sky/music/musicbase.h" #include "sky/disk.h" #include "common/util.h" +#include "common/system.h" namespace Sky { diff --git a/sky/music/musicbase.h b/sky/music/musicbase.h index f33f3ec9bb..f3e88dc1f2 100644 --- a/sky/music/musicbase.h +++ b/sky/music/musicbase.h @@ -24,7 +24,7 @@ #include "stdafx.h" #include "common/scummsys.h" -#include "common/system.h" +#include "common/mutex.h" class OSystem; @@ -77,7 +77,7 @@ protected: uint32 _aktTime; Actions _onNextPoll; ChannelBase *_channels[10]; - OSystem::MutexRef _mutex; + Common::MutexRef _mutex; virtual void setupPointers(void) = 0; virtual void setupChannels(uint8 *channelData) = 0; diff --git a/sky/sky.cpp b/sky/sky.cpp index cf9d2e46e7..5e398dd812 100644 --- a/sky/sky.cpp +++ b/sky/sky.cpp @@ -28,6 +28,7 @@ #include "common/config-manager.h" #include "common/file.h" +#include "common/system.h" #include "common/timer.h" #include "sky/control.h" diff --git a/sound/audiocd.cpp b/sound/audiocd.cpp index aafa279ed8..e8a74d062c 100644 --- a/sound/audiocd.cpp +++ b/sound/audiocd.cpp @@ -28,6 +28,7 @@ #include "base/engine.h" #include "common/file.h" #include "common/util.h" +#include "common/system.h" struct TrackFormat { /** Decodername */ diff --git a/sound/mixer.cpp b/sound/mixer.cpp index a981e32cda..050f37f8ec 100644 --- a/sound/mixer.cpp +++ b/sound/mixer.cpp @@ -21,8 +21,10 @@ */ #include "stdafx.h" + #include "common/file.h" #include "common/util.h" +#include "common/system.h" #include "sound/mixer.h" #include "sound/rate.h" diff --git a/sound/mixer.h b/sound/mixer.h index ecfbc19b12..44f552fd9c 100644 --- a/sound/mixer.h +++ b/sound/mixer.h @@ -25,12 +25,13 @@ #include "stdafx.h" #include "common/scummsys.h" -#include "common/system.h" +#include "common/mutex.h" class AudioStream; class Channel; class File; +class OSystem; class PlayingSoundHandle { friend class Channel; @@ -88,7 +89,7 @@ private: }; OSystem *_syst; - OSystem::MutexRef _mutex; + Common::MutexRef _mutex; Channel *_premixChannel; diff --git a/sound/mpu401.h b/sound/mpu401.h index 9c5529934f..7b722df7c9 100644 --- a/sound/mpu401.h +++ b/sound/mpu401.h @@ -23,7 +23,6 @@ #define SOUND_MPU401_H #include "stdafx.h" -#include "common/system.h" #include "mididrv.h" //////////////////////////////////////// diff --git a/sound/softsynth/mt32.cpp b/sound/softsynth/mt32.cpp index 358cfacc84..44221b91b1 100644 --- a/sound/softsynth/mt32.cpp +++ b/sound/softsynth/mt32.cpp @@ -31,6 +31,7 @@ #include "common/util.h" #include "common/file.h" #include "common/config-manager.h" +#include "common/system.h" #include "graphics/fontman.h" #include "graphics/surface.h" diff --git a/sword1/animation.cpp b/sword1/animation.cpp index f142cb9a15..1f9ed0a46a 100644 --- a/sword1/animation.cpp +++ b/sword1/animation.cpp @@ -28,6 +28,7 @@ #include "common/config-manager.h" #include "common/str.h" +#include "common/system.h" namespace Sword1 { diff --git a/sword1/control.cpp b/sword1/control.cpp index 2c466ec2da..0258e35b34 100644 --- a/sword1/control.cpp +++ b/sword1/control.cpp @@ -22,7 +22,7 @@ #include "common/file.h" #include "common/stdafx.h" #include "common/util.h" -#include "common/util.h" +#include "common/system.h" #include "gui/message.h" diff --git a/sword1/credits.cpp b/sword1/credits.cpp index e9c426abec..527bf74a0f 100644 --- a/sword1/credits.cpp +++ b/sword1/credits.cpp @@ -20,14 +20,18 @@ */ #include "stdafx.h" + #include "sword1/credits.h" #include "sword1/screen.h" -#include "common/file.h" +#include "sword1/sword1.h" + +#include "sound/audiostream.h" #include "sound/mixer.h" + +#include "common/file.h" #include "common/util.h" -#include "sound/audiostream.h" +#include "common/system.h" -#include "sword1.h" #define CREDITS_X 480 #define CREDITS_Y 300 diff --git a/sword1/music.cpp b/sword1/music.cpp index c2b21409a3..ac2a3345b7 100644 --- a/sword1/music.cpp +++ b/sword1/music.cpp @@ -20,10 +20,14 @@ */ #include "stdafx.h" + #include "sword1/music.h" -#include "sound/mixer.h" + #include "common/util.h" #include "common/file.h" +#include "common/system.h" + +#include "sound/mixer.h" #include "sound/mp3.h" #include "sound/vorbis.h" #include "sound/wave.h" diff --git a/sword1/music.h b/sword1/music.h index 3cbc13584a..1820a8704c 100644 --- a/sword1/music.h +++ b/sword1/music.h @@ -23,7 +23,7 @@ #define BSMUSIC_H #include "scummsys.h" -#include "common/system.h" +#include "common/mutex.h" #include "common/file.h" #include "sound/audiostream.h" #include "sound/rate.h" @@ -109,7 +109,7 @@ private: OSystem *_system; SoundMixer *_mixer; uint32 _sampleRate; - OSystem::MutexRef _mutex; + Common::MutexRef _mutex; static void passMixerFunc(void *param, int16 *buf, uint len); void mixer(int16 *buf, uint32 len); diff --git a/sword1/sword1.cpp b/sword1/sword1.cpp index 2c8709435a..4e4eca1d37 100644 --- a/sword1/sword1.cpp +++ b/sword1/sword1.cpp @@ -28,6 +28,7 @@ #include "common/config-manager.h" #include "common/file.h" #include "common/timer.h" +#include "common/system.h" #include "sword1/resman.h" #include "sword1/objectman.h" diff --git a/sword2/build_display.cpp b/sword2/build_display.cpp index eb6b8737e8..b0a6468bb0 100644 --- a/sword2/build_display.cpp +++ b/sword2/build_display.cpp @@ -22,6 +22,7 @@ // --------------------------------------------------------------------------- #include "common/stdafx.h" +#include "common/system.h" #include "sword2/sword2.h" #include "sword2/console.h" #include "sword2/defs.h" @@ -103,10 +104,10 @@ void Sword2Engine::buildDisplay(void) { _graphics->updateDisplay(); _frameCount++; - if (_system->getMillis() > _cycleTime) { + if (getMillis() > _cycleTime) { _fps = _frameCount; _frameCount = 0; - _cycleTime = _system->getMillis() + 1000; + _cycleTime = getMillis() + 1000; } } while (!_graphics->endRenderCycle()); @@ -174,7 +175,7 @@ void Sword2Engine::displayMsg(byte *text, int time) { _graphics->waitForFade(); if (time > 0) { - uint32 targetTime = _system->getMillis() + (time * 1000); + uint32 targetTime = getMillis() + (time * 1000); sleepUntil(targetTime); } else { while (!_quit) { diff --git a/sword2/controls.cpp b/sword2/controls.cpp index b3d3af4a8e..459f413846 100644 --- a/sword2/controls.cpp +++ b/sword2/controls.cpp @@ -20,6 +20,7 @@ #include "common/stdafx.h" #include "common/rect.h" #include "common/config-manager.h" +#include "common/system.h" #include "sword2/sword2.h" #include "sword2/controls.h" #include "sword2/defs.h" diff --git a/sword2/debug.cpp b/sword2/debug.cpp index cf28e26f3a..b62eeee0d8 100644 --- a/sword2/debug.cpp +++ b/sword2/debug.cpp @@ -116,7 +116,7 @@ void Debugger::buildDebugText(void) { // debug info at top of screen - enabled/disabled as one complete unit if (_displayTime) { - int32 time = _vm->_system->getMillis(); + int32 time = _vm->getMillis(); if ((time - _startTime) / 1000 >= 10000) _startTime = time; diff --git a/sword2/driver/_mouse.cpp b/sword2/driver/_mouse.cpp index bde0896df2..dd9c42c88f 100644 --- a/sword2/driver/_mouse.cpp +++ b/sword2/driver/_mouse.cpp @@ -18,6 +18,7 @@ */ #include "common/stdafx.h" +#include "common/system.h" #include "sword2/sword2.h" #include "sword2/driver/d_draw.h" diff --git a/sword2/driver/animation.cpp b/sword2/driver/animation.cpp index ff5dac2375..3a1a30f630 100644 --- a/sword2/driver/animation.cpp +++ b/sword2/driver/animation.cpp @@ -22,6 +22,7 @@ #include "common/stdafx.h" #include "common/file.h" #include "common/config-manager.h" +#include "common/system.h" #include "sound/vorbis.h" #include "sound/mp3.h" diff --git a/sword2/driver/d_draw.cpp b/sword2/driver/d_draw.cpp index 293a2da838..822d858e35 100644 --- a/sword2/driver/d_draw.cpp +++ b/sword2/driver/d_draw.cpp @@ -18,6 +18,7 @@ */ #include "common/stdafx.h" +#include "common/system.h" #include "sword2/sword2.h" #include "sword2/driver/d_draw.h" #include "sword2/driver/menu.h" diff --git a/sword2/driver/d_sound.cpp b/sword2/driver/d_sound.cpp index 495fcf24b0..c61a349d28 100644 --- a/sword2/driver/d_sound.cpp +++ b/sword2/driver/d_sound.cpp @@ -25,6 +25,7 @@ #include "common/stdafx.h" #include "common/file.h" +#include "common/system.h" #include "sound/mp3.h" #include "sound/vorbis.h" #include "sound/flac.h" diff --git a/sword2/driver/d_sound.h b/sword2/driver/d_sound.h index 96a6689ff6..77d8f753d0 100644 --- a/sword2/driver/d_sound.h +++ b/sword2/driver/d_sound.h @@ -59,7 +59,7 @@ class Sound : public AudioStream { private: Sword2Engine *_vm; - OSystem::MutexRef _mutex; + Common::MutexRef _mutex; int32 _panTable[33]; bool _soundOn; diff --git a/sword2/driver/menu.cpp b/sword2/driver/menu.cpp index e8b39d0d37..98a430e11c 100644 --- a/sword2/driver/menu.cpp +++ b/sword2/driver/menu.cpp @@ -55,10 +55,10 @@ void Graphics::processMenu(void) { static int32 lastTime = 0; if (lastTime == 0) { - lastTime = _vm->_system->getMillis(); + lastTime = _vm->getMillis(); frameCount = 1; } else { - int32 delta = _vm->_system->getMillis() - lastTime; + int32 delta = _vm->getMillis() - lastTime; if (delta > 250) { lastTime += delta; diff --git a/sword2/driver/palette.cpp b/sword2/driver/palette.cpp index 285c463e14..2423d38ae3 100644 --- a/sword2/driver/palette.cpp +++ b/sword2/driver/palette.cpp @@ -18,6 +18,7 @@ */ #include "common/stdafx.h" +#include "common/system.h" #include "sword2/sword2.h" #include "sword2/driver/d_draw.h" diff --git a/sword2/driver/rdwin.cpp b/sword2/driver/rdwin.cpp index 45405b47d0..51ae28569b 100644 --- a/sword2/driver/rdwin.cpp +++ b/sword2/driver/rdwin.cpp @@ -18,6 +18,7 @@ */ #include "common/stdafx.h" +#include "common/system.h" #include "sword2/sword2.h" #include "sword2/driver/d_draw.h" #include "sword2/driver/menu.h" diff --git a/sword2/driver/render.cpp b/sword2/driver/render.cpp index 4f7f8947cf..9a07cb0431 100644 --- a/sword2/driver/render.cpp +++ b/sword2/driver/render.cpp @@ -18,6 +18,7 @@ */ #include "common/stdafx.h" +#include "common/system.h" #include "sword2/sword2.h" #include "sword2/driver/animation.h" #include "sword2/driver/d_draw.h" diff --git a/sword2/function.cpp b/sword2/function.cpp index 102f328281..99f52a8b5e 100644 --- a/sword2/function.cpp +++ b/sword2/function.cpp @@ -19,6 +19,7 @@ #include "common/stdafx.h" #include "common/file.h" +#include "common/system.h" #include "sword2/sword2.h" #include "sword2/defs.h" #include "sword2/interpreter.h" @@ -588,7 +589,7 @@ int32 Logic::fnPlayCredits(int32 *params) { bool abortCredits = false; int scrollSteps = lineTop + CREDITS_FONT_HEIGHT; - uint32 musicStart = _vm->_system->getMillis(); + uint32 musicStart = _vm->getMillis(); // Ideally the music should last just a tiny bit longer than the // credits. Note that musicTimeRemaining() will return 0 if the music diff --git a/sword2/maketext.cpp b/sword2/maketext.cpp index 8bad8e6ce7..b8ab6a6ca9 100644 --- a/sword2/maketext.cpp +++ b/sword2/maketext.cpp @@ -36,6 +36,7 @@ // as a resource) on 5dec96. #include "common/stdafx.h" +#include "common/system.h" #include "sword2/sword2.h" #include "sword2/defs.h" #include "sword2/logic.h" diff --git a/sword2/save_rest.cpp b/sword2/save_rest.cpp index 365c2baadc..680ce944ce 100644 --- a/sword2/save_rest.cpp +++ b/sword2/save_rest.cpp @@ -27,6 +27,7 @@ // --------------------------------------------------------------------------- #include "common/stdafx.h" +#include "common/savefile.h" #include "sword2/sword2.h" #include "sword2/defs.h" #include "sword2/interpreter.h" diff --git a/sword2/sword2.cpp b/sword2/sword2.cpp index 8894c289ec..dc3c96ad26 100644 --- a/sword2/sword2.cpp +++ b/sword2/sword2.cpp @@ -18,11 +18,15 @@ */ #include "common/stdafx.h" + #include "backends/fs/fs.h" + #include "base/gameDetector.h" #include "base/plugins.h" + #include "common/config-manager.h" #include "common/file.h" +#include "common/system.h" #include "sword2/sword2.h" #include "sword2/console.h" @@ -545,7 +549,7 @@ void Sword2Engine::startGame() { // FIXME: Move this to some better place? void Sword2Engine::sleepUntil(uint32 time) { - while (_system->getMillis() < time) { + while (getMillis() < time) { // Make sure menu animations and fades don't suffer, but don't // redraw the entire scene. _graphics->processMenu(); @@ -612,4 +616,8 @@ void Sword2Engine::unpauseGame() { setMouse(NORMAL_MOUSE_ID); } +uint32 Sword2Engine::getMillis() { + return _system->getMillis(); +} + } // End of namespace Sword2 diff --git a/sword2/sword2.h b/sword2/sword2.h index e230995d3b..0d0a832800 100644 --- a/sword2/sword2.h +++ b/sword2/sword2.h @@ -29,7 +29,7 @@ #include "base/engine.h" -#include "common/system.h" +#include "common/util.h" #include "sword2/driver/driver96.h" #include "sword2/build_display.h" @@ -41,6 +41,7 @@ #include "sword2/save_rest.h" class GameDetector; +class OSystem; namespace Sword2 { @@ -407,6 +408,11 @@ public: void errorString(const char *buf_input, char *buf_output); void initialiseFontResourceFlags(); void initialiseFontResourceFlags(uint8 language); + + + // Convenience alias for OSystem::getMillis(). + // This is a bit hackish, of course :-). + uint32 getMillis(); }; } // End of namespace Sword2 |