aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2002-09-24 23:45:25 +0000
committerMax Horn2002-09-24 23:45:25 +0000
commit1bfaa3c02f0a3fb56c581fc204b644d457d45ae0 (patch)
tree609f369bda19b6c5a6753dade1e87baf34854327
parent77d62a61d7d9a4256a24cc37057f515d123ecfeb (diff)
downloadscummvm-rg350-1bfaa3c02f0a3fb56c581fc204b644d457d45ae0.tar.gz
scummvm-rg350-1bfaa3c02f0a3fb56c581fc204b644d457d45ae0.tar.bz2
scummvm-rg350-1bfaa3c02f0a3fb56c581fc204b644d457d45ae0.zip
removed even the last traces of Scumm dependencies from NewGUI. Yes, you heard right NewGUI is now 100% Scumm free and we can go for the launcher/message dialogs!
svn-id: r5016
-rw-r--r--gui/newgui.cpp26
-rw-r--r--gui/newgui.h7
-rw-r--r--scumm/imuse.cpp11
-rw-r--r--scumm/scumm.h1
-rw-r--r--scumm/scummvm.cpp28
-rw-r--r--sound/mididrv.cpp17
6 files changed, 54 insertions, 36 deletions
diff --git a/gui/newgui.cpp b/gui/newgui.cpp
index 1867ddd6bd..7adfa1aaea 100644
--- a/gui/newgui.cpp
+++ b/gui/newgui.cpp
@@ -20,11 +20,8 @@
#include "stdafx.h"
#include "util.h"
-#include "scumm/scumm.h"
-#include "scumm/sound.h"
#include "newgui.h"
#include "dialog.h"
-#include "scumm/dialogs.h"
#ifdef _MSC_VER
@@ -78,7 +75,7 @@ static byte guifont[] = {
};
// Constructor
-NewGui::NewGui(Scumm *s) : _s(s), _system(s->_system), _screen(0),
+NewGui::NewGui(OSystem *system) : _system(system), _screen(0),
_use_alpha_blending(true), _need_redraw(false),
_currentKeyDown(0), _cursorAnimateCounter(0), _cursorAnimateTimer(0)
{
@@ -200,29 +197,26 @@ void NewGui::runLoop()
void NewGui::saveState()
{
- // Pause sound put
- _old_soundsPaused = _s->_sound->_soundsPaused;
- _s->_sound->pauseSounds(true);
-
// Backup old cursor
_oldCursorMode = _system->show_mouse(true);
- // TODO - add getHeight & getWidth methods to OSystem
_system->show_overlay();
- _screen = new int16[_s->_realWidth * _s->_realHeight];
- _screen_pitch = _s->_realWidth;
+ // TODO - add getHeight & getWidth methods to OSystem.
+ // Note that this alone is not a sufficient solution, as in the future the screen size
+ // might change. E.g. we start up in 320x200 mode but then go on playing Zak256
+ // which makes us switch to 320x240, or even CMI which uses 640x480...
+ // FIXME - for now just use a dirty HACK
+ _screen = new int16[320 * 240];
+ _screen_pitch = 320;
+// _screen = new int16[_s->_realWidth * _s->_realHeight];
+// _screen_pitch = _s->_realWidth;
_system->grab_overlay(_screen, _screen_pitch);
}
void NewGui::restoreState()
{
- // Restore old cursor
- _s->updateCursor();
_system->show_mouse(_oldCursorMode);
- // Resume sound output
- _s->_sound->pauseSounds(_old_soundsPaused);
-
_system->hide_overlay();
if (_screen) {
delete _screen;
diff --git a/gui/newgui.h b/gui/newgui.h
index ba96a8590b..b1ce4daeea 100644
--- a/gui/newgui.h
+++ b/gui/newgui.h
@@ -25,7 +25,6 @@
#include "system.h" // For events
class Dialog;
-class Scumm;
#define hline(x, y, x2, color) line(x, y, x2, y, color);
#define vline(x, y, y2, color) line(x, y, x, y2, color);
@@ -68,10 +67,9 @@ public:
bool isActive() { return ! _dialogStack.empty(); }
- NewGui(Scumm *s);
+ NewGui(OSystem *system);
protected:
- Scumm *_s;
OSystem *_system;
int16 *_screen;
int _screen_pitch;
@@ -84,9 +82,6 @@ protected:
int _currentKeyDown, _currentKeyDownFlags;
int _keyRepeatLoopCount;
int _keyRepeatEvenCount;
-
- // sound state
- bool _old_soundsPaused;
// position and time of last mouse click (used to detect double clicks)
struct {
diff --git a/scumm/imuse.cpp b/scumm/imuse.cpp
index 0085e4ce61..15934101d1 100644
--- a/scumm/imuse.cpp
+++ b/scumm/imuse.cpp
@@ -3110,7 +3110,7 @@ void Part::set_detune(int8 detune)
void Part::set_pitchbend(int value)
{
- _pitchbend = value * _pitchbend_factor >> 6;
+ _pitchbend = value;
changed(IMuseDriver::pcMod);
}
@@ -3993,7 +3993,7 @@ void IMuseAdlib::part_changed(Part *part, byte what)
if (what & pcMod) {
for (mc = part->_mc->adl(); mc; mc = mc->_next) {
adlib_note_on(mc->_channel, mc->_note + part->_transpose_eff,
- part->_pitchbend + part->_detune_eff);
+ (part->_pitchbend * part->_pitchbend_factor >> 6) + part->_detune_eff);
}
}
@@ -4278,7 +4278,7 @@ void IMuseGM::midiPitchBend(byte chan, int16 pitchbend)
if (_midi_pitchbend_last[chan] != pitchbend) {
_midi_pitchbend_last[chan] = pitchbend;
- tmp = (pitchbend << 2) + 0x2000;
+ tmp = pitchbend + 0x2000;
_md->send(((tmp >> 7) & 0x7F) << 16 | (tmp & 0x7F) << 8 | 0xE0 | chan);
}
}
@@ -4570,8 +4570,9 @@ void IMuseGM::part_changed(Part *part, byte what)
if (what & pcMod)
midiPitchBend(mc->_chan,
- clamp(part->_pitchbend + part->_detune_eff +
- (part->_transpose_eff << 7), -2048, 2047));
+ clamp(part->_pitchbend +
+ (part->_detune_eff * 64 / 12) +
+ (part->_transpose_eff * 8192 / 12), -8192, 8191));
if (what & pcVolume)
midiVolume(mc->_chan, part->_vol_eff);
diff --git a/scumm/scumm.h b/scumm/scumm.h
index d14d822453..fee7eb45b3 100644
--- a/scumm/scumm.h
+++ b/scumm/scumm.h
@@ -401,6 +401,7 @@ public:
Dialog *_optionsDialog;
Dialog *_saveLoadDialog;
+ void runDialog(Dialog *dialog);
void pauseDialog();
void saveloadDialog();
void optionsDialog();
diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp
index 2d0bdfdb23..7a6d3e9c10 100644
--- a/scumm/scummvm.cpp
+++ b/scumm/scummvm.cpp
@@ -103,7 +103,7 @@ Scumm::Scumm (GameDetector *detector, OSystem *syst)
_gui = new Gui();
_gui->init(this);
- _newgui = new NewGui(this);
+ _newgui = new NewGui(_system);
_bundle = new Bundle();
_sound = new Sound(this);
_timer = Engine::_timer;
@@ -917,28 +917,42 @@ void Scumm::setOptions()
//_newgui->optionsDialog();
}
+void Scumm::runDialog(Dialog *dialog)
+{
+ // Pause sound put
+ bool old_soundsPaused = _sound->_soundsPaused;
+ _sound->pauseSounds(true);
+
+ // Open & run the dialog
+ dialog->open();
+ _newgui->runLoop();
+
+ // Restore old cursor
+ updateCursor();
+
+ // Resume sound output
+ _sound->pauseSounds(old_soundsPaused);
+}
+
void Scumm::pauseDialog()
{
if (!_pauseDialog)
_pauseDialog = new PauseDialog(_newgui, this);
- _pauseDialog->open();
- _newgui->runLoop();
+ runDialog(_pauseDialog);
}
void Scumm::saveloadDialog()
{
if (!_saveLoadDialog)
_saveLoadDialog = new SaveLoadDialog(_newgui, this);
- _saveLoadDialog->open();
- _newgui->runLoop();
+ runDialog(_saveLoadDialog);
}
void Scumm::optionsDialog()
{
if (!_optionsDialog)
_optionsDialog = new OptionsDialog(_newgui, this);
- _optionsDialog->open();
- _newgui->runLoop();
+ runDialog(_optionsDialog);
}
void Scumm::shutDown(int i)
diff --git a/sound/mididrv.cpp b/sound/mididrv.cpp
index 0738436470..a0190488d8 100644
--- a/sound/mididrv.cpp
+++ b/sound/mididrv.cpp
@@ -87,7 +87,7 @@ void MidiDriver_WIN::set_stream_callback(void *param, StreamCallback *sc)
}
void CALLBACK MidiDriver_WIN::midi_callback(HMIDIOUT hmo, UINT wMsg,
- DWORD dwInstance, DWORD dwParam1, DWORD dwParam2)
+ DWORD dwInstance, DWORD dwParam1, DWORD dwParam2)
{
switch (wMsg) {
@@ -111,13 +111,26 @@ int MidiDriver_WIN::open(int mode)
MMRESULT res = midiOutOpen((HMIDIOUT *) & _mo, MIDI_MAPPER, NULL, NULL, 0);
if (res != MMSYSERR_NOERROR)
check_error(res);
+
+ // Send initial pitch bend sensitivity values for +/- 12 semitones.
+ // For information on control change registered parameters,
+ // which includes the Pitch Bend sensitivity settings,
+ // visit http://www.midi.org/about-midi/table3.htm,
+ // Table 3a.
+ int chan;
+ for (chan = 0; chan < 16; ++chan) {
+ send(( 0 << 16) | (101 << 8) | (0xB0 | chan));
+ send(( 0 << 16) | (100 << 8) | (0xB0 | chan));
+ send((12 << 16) | ( 6 << 8) | (0xB0 | chan));
+ send(( 0 << 16) | ( 38 << 8) | (0xB0 | chan));
+ } // next for
} else {
/* streaming mode */
MIDIPROPTIMEDIV mptd;
UINT _midi_device_id = 0;
check_error(midiStreamOpen(&_ms, &_midi_device_id, 1,
- (uint32)midi_callback, (uint32)this, CALLBACK_FUNCTION));
+ (uint32)midi_callback, (uint32)this, CALLBACK_FUNCTION));
prepare();