[Scummvm-cvs-logs] SF.net SVN: scummvm: [29873] scummvm/trunk/engines/lure
dreammaster at users.sourceforge.net
dreammaster at users.sourceforge.net
Sun Dec 16 09:19:56 CET 2007
Revision: 29873
http://scummvm.svn.sourceforge.net/scummvm/?rev=29873&view=rev
Author: dreammaster
Date: 2007-12-16 00:19:56 -0800 (Sun, 16 Dec 2007)
Log Message:
-----------
Hooked up the sound code to use the configuration for sfx and music, and added code from the original game that used the high bit of sounds to distinguish between the two
Modified Paths:
--------------
scummvm/trunk/engines/lure/animseq.h
scummvm/trunk/engines/lure/game.cpp
scummvm/trunk/engines/lure/game.h
scummvm/trunk/engines/lure/lure.cpp
scummvm/trunk/engines/lure/luredefs.h
scummvm/trunk/engines/lure/scripts.cpp
scummvm/trunk/engines/lure/sound.cpp
scummvm/trunk/engines/lure/sound.h
Modified: scummvm/trunk/engines/lure/animseq.h
===================================================================
--- scummvm/trunk/engines/lure/animseq.h 2007-12-16 08:14:14 UTC (rev 29872)
+++ scummvm/trunk/engines/lure/animseq.h 2007-12-16 08:19:56 UTC (rev 29873)
@@ -34,7 +34,8 @@
struct AnimSoundSequence {
uint16 numFrames;
- uint8 soundId;
+ uint8 adlibSoundId;
+ uint8 rolandSoundId;
uint8 channelNum;
};
Modified: scummvm/trunk/engines/lure/game.cpp
===================================================================
--- scummvm/trunk/engines/lure/game.cpp 2007-12-16 08:14:14 UTC (rev 29872)
+++ scummvm/trunk/engines/lure/game.cpp 2007-12-16 08:19:56 UTC (rev 29873)
@@ -49,7 +49,10 @@
_debugger = new Debugger();
_fastTextFlag = false;
_preloadFlag = false;
+
_soundFlag = true;
+ _musicVolume = ConfMan.getBool("music_mute") ? 0 : MIN(255, ConfMan.getInt("music_volume"));
+ _sfxVolume = ConfMan.getBool("sfx_mute") ? 0 : MIN(255, ConfMan.getInt("sfx_volume"));
}
Game::~Game() {
Modified: scummvm/trunk/engines/lure/game.h
===================================================================
--- scummvm/trunk/engines/lure/game.h 2007-12-16 08:14:14 UTC (rev 29872)
+++ scummvm/trunk/engines/lure/game.h 2007-12-16 08:19:56 UTC (rev 29873)
@@ -47,6 +47,8 @@
private:
Debugger *_debugger;
bool _fastTextFlag, _soundFlag;
+ uint8 _sfxVolume;
+ uint8 _musicVolume;
uint8 _state;
uint16 _tellCommands[MAX_TELL_COMMANDS * 3 + 1];
int _numTellCommands;
@@ -80,6 +82,8 @@
bool &preloadFlag() { return _preloadFlag; }
bool fastTextFlag() { return _fastTextFlag; }
bool soundFlag() { return _soundFlag; }
+ uint8 sfxVolume() { return _sfxVolume; }
+ uint8 musicVolume() { return _musicVolume; }
Debugger &debugger() { return *_debugger; }
// Menu item support methods
Modified: scummvm/trunk/engines/lure/lure.cpp
===================================================================
--- scummvm/trunk/engines/lure/lure.cpp 2007-12-16 08:14:14 UTC (rev 29872)
+++ scummvm/trunk/engines/lure/lure.cpp 2007-12-16 08:19:56 UTC (rev 29873)
@@ -54,9 +54,6 @@
if (!_mixer->isReady()) {
warning("Sound initialization failed.");
}
-
- _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume"));
- _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume"));
}
int LureEngine::init() {
@@ -135,7 +132,7 @@
if (ConfMan.getInt("boot_param") == 0) {
// Show the introduction
- Sound.loadSection(INTRO_SOUND_RESOURCE_ID);
+ Sound.loadSection(Sound.isRoland() ? ROLAND_INTRO_SOUND_RESOURCE_ID : ADLIB_INTRO_SOUND_RESOURCE_ID);
Introduction *intro = new Introduction(*_screen, *_system);
intro->show();
@@ -145,7 +142,7 @@
// Play the game
if (!_events->quitFlag) {
// Play the game
- Sound.loadSection(MAIN_SOUND_RESOURCE_ID);
+ Sound.loadSection(Sound.isRoland() ? ROLAND_MAIN_SOUND_RESOURCE_ID : ADLIB_MAIN_SOUND_RESOURCE_ID);
gameInstance->execute();
}
Modified: scummvm/trunk/engines/lure/luredefs.h
===================================================================
--- scummvm/trunk/engines/lure/luredefs.h 2007-12-16 08:14:14 UTC (rev 29872)
+++ scummvm/trunk/engines/lure/luredefs.h 2007-12-16 08:19:56 UTC (rev 29873)
@@ -236,8 +236,12 @@
// Miscellaneous resources
#define NAMES_RESOURCE_ID 9
-#define MAIN_SOUND_RESOURCE_ID 0xC
-#define INTRO_SOUND_RESOURCE_ID 0x31
+#define ROLAND_MAIN_SOUND_RESOURCE_ID 0xC
+#define ADLIB_MAIN_SOUND_RESOURCE_ID 0xD
+#define ROLAND_INTRO_SOUND_RESOURCE_ID 0x30
+#define ADLIB_INTRO_SOUND_RESOURCE_ID 0x31
+#define ROLAND_ENDGAME_SOUND_RESOURCE_ID 0xff10
+
#define NOONE_ID 0x3E7
#define PLAYER_ID 0x3E8
#define RATPOUCH_ID 0x3E9
Modified: scummvm/trunk/engines/lure/scripts.cpp
===================================================================
--- scummvm/trunk/engines/lure/scripts.cpp 2007-12-16 08:14:14 UTC (rev 29872)
+++ scummvm/trunk/engines/lure/scripts.cpp 2007-12-16 08:19:56 UTC (rev 29873)
@@ -48,9 +48,9 @@
// Details used for co-ordination of sounds during the endgame sequence
static const AnimSoundSequence soundList[] = {
- {9, 2, 0}, {27, 5, 0}, {24, 3, 0}, {24, 1, 0}, {3, 1, 1}, {3, 1, 2}, {3, 1, 3},
- {3, 1, 4}, {4, 1, 5}, {7, 4, 6}, {31, 6, 0},
- {0, 0, 0}
+ {9, 0x45, 2, 0}, {27, 0x48, 5, 0}, {24, 0x46, 3, 0}, {24, 0x37, 1, 0}, {3, 0x37, 1, 1},
+ {3, 0x37, 1, 2}, {3, 0x37, 1, 3}, {3, 0x37, 1, 4}, {4, 0x37, 1, 5}, {7, 0x47, 4, 6},
+ {31, 6, 0}, {0, 0, 0, 0}
};
/*------------------------------------------------------------------------*/
@@ -196,10 +196,12 @@
AnimationSequence *anim;
screen.paletteFadeOut();
- Sound.killSounds();
- Sound.loadSection(0xFF10);
mouse.cursorOff();
+ Sound.killSounds();
+ if (Sound.isRoland())
+ Sound.loadSection(ROLAND_ENDGAME_SOUND_RESOURCE_ID);
+
Palette p(ENDGAME_PALETTE_ID);
anim = new AnimationSequence(ENDGAME_ANIM_ID, p, true, 9, soundList);
anim->show();
Modified: scummvm/trunk/engines/lure/sound.cpp
===================================================================
--- scummvm/trunk/engines/lure/sound.cpp 2007-12-16 08:14:14 UTC (rev 29872)
+++ scummvm/trunk/engines/lure/sound.cpp 2007-12-16 08:19:56 UTC (rev 29873)
@@ -38,15 +38,18 @@
//#define SOUND_CROP_CHANNELS
SoundManager::SoundManager() {
+ Disk &disk = Disk::getReference();
+ Game &game = Game::getReference();
_soundMutex = g_system->createMutex();
int index;
- _descs = Disk::getReference().getEntry(SOUND_DESC_RESOURCE_ID);
+ _descs = disk.getEntry(SOUND_DESC_RESOURCE_ID);
_numDescs = _descs->size() / sizeof(SoundDescResource);
_soundData = NULL;
_paused = false;
int midiDriver = MidiDriver::detectMusicDriver(MDT_MIDI | MDT_ADLIB | MDT_PREFER_MIDI);
+ _isRoland = midiDriver != MD_ADLIB;
_nativeMT32 = ((midiDriver == MD_MT32) || ConfMan.getBool("native_mt32"));
Common::set_to(_channelsInUse, _channelsInUse+NUM_CHANNELS_OUTER, false);
@@ -63,7 +66,8 @@
for (index = 0; index < NUM_CHANNELS_INNER; ++index) {
_channelsInner[index].midiChannel = _driver->allocateChannel();
- _channelsInner[index].volume = DEFAULT_VOLUME;
+ _channelsInner[index].isMusic = false;
+ _channelsInner[index].volume = game.sfxVolume();
}
}
}
@@ -249,12 +253,12 @@
void SoundManager::stopSound(uint8 soundIndex) {
debugC(ERROR_BASIC, kLureDebugSounds, "SoundManager::stopSound index=%d", soundIndex);
SoundDescResource &rec = soundDescs()[soundIndex];
- musicInterface_Stop(rec.soundNumber & 0x7f);
+ musicInterface_Stop(rec.soundNumber);
}
void SoundManager::killSound(uint8 soundNumber) {
debugC(ERROR_BASIC, kLureDebugSounds, "SoundManager::stopSound soundNumber=%d", soundNumber);
- musicInterface_Stop(soundNumber & 0x7f);
+ musicInterface_Stop(soundNumber);
}
void SoundManager::setVolume(uint8 soundNumber, uint8 volume) {
@@ -395,6 +399,7 @@
void SoundManager::musicInterface_Play(uint8 soundNumber, uint8 channelNumber) {
debugC(ERROR_INTERMEDIATE, kLureDebugSounds, "musicInterface_Play soundNumber=%d, channel=%d",
soundNumber, channelNumber);
+ Game &game = Game::getReference();
if (!_soundData)
error("Sound section has not been specified");
@@ -407,7 +412,10 @@
// Only play sounds if a sound driver is active
return;
- if (!Game::getReference().soundFlag())
+ bool isMusic = (soundNumber & 0x80) != 0;
+ uint8 volume = isMusic ? game.musicVolume() : game.sfxVolume();
+
+ if (!game.soundFlag() || (volume == 0))
// Don't play sounds if sound is turned off
return;
@@ -424,8 +432,8 @@
g_system->lockMutex(_soundMutex);
MidiMusic *sound = new MidiMusic(_driver, _channelsInner, channelNumber, soundNumber,
- soundStart, dataSize);
- sound->setVolume(DEFAULT_VOLUME);
+ isMusic, soundStart, dataSize);
+ sound->setVolume(volume);
_playingSounds.push_back(sound);
g_system->unlockMutex(_soundMutex);
}
@@ -567,16 +575,20 @@
/*------------------------------------------------------------------------*/
MidiMusic::MidiMusic(MidiDriver *driver, ChannelEntry channels[NUM_CHANNELS_INNER],
- uint8 channelNum, uint8 soundNum, void *soundData, uint32 size) {
-
+ uint8 channelNum, uint8 soundNum, bool isMusic, void *soundData, uint32 size) {
+ Game &game = Game::getReference();
_driver = driver;
_channels = channels;
_soundNumber = soundNum;
_channelNumber = channelNum;
_numChannels = 4;
- _volume = 0xff;
- setVolume(DEFAULT_VOLUME);
+ _volume = 0;
+ for (int i = 0; i < _numChannels; ++i) {
+ _channels[_channelNumber + i].isMusic = isMusic;
+ _channels[_channelNumber + i].volume = isMusic ? game.musicVolume() : game.sfxVolume();
+ }
+ setVolume(0xff);
_passThrough = false;
Modified: scummvm/trunk/engines/lure/sound.h
===================================================================
--- scummvm/trunk/engines/lure/sound.h 2007-12-16 08:14:14 UTC (rev 29872)
+++ scummvm/trunk/engines/lure/sound.h 2007-12-16 08:19:56 UTC (rev 29873)
@@ -40,7 +40,8 @@
struct ChannelEntry {
MidiChannel *midiChannel;
- byte volume;
+ bool isMusic;
+ uint8 volume;
};
class MidiMusic: public MidiDriver {
@@ -67,7 +68,7 @@
public:
MidiMusic(MidiDriver *driver, ChannelEntry channels[NUM_CHANNELS_INNER],
- uint8 channelNum, uint8 soundNum, void *soundData, uint32 size);
+ uint8 channelNum, uint8 soundNum, bool isMusic, void *soundData, uint32 size);
~MidiMusic();
void setVolume(int volume);
int getVolume() { return _volume; }
@@ -117,6 +118,7 @@
bool _channelsInUse[NUM_CHANNELS_OUTER];
bool _isPlaying;
bool _nativeMT32;
+ bool _isRoland;
Common::MutexRef _soundMutex;
bool _paused;
@@ -149,6 +151,7 @@
void pause() { _paused = true; }
void resume() { _paused = false; }
bool getPaused() { return _paused; }
+ bool isRoland() { return _isRoland; }
// The following methods implement the external sound player module
void musicInterface_Initialise();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list