aboutsummaryrefslogtreecommitdiff
path: root/queen
diff options
context:
space:
mode:
authorJoost Peters2003-11-15 21:33:04 +0000
committerJoost Peters2003-11-15 21:33:04 +0000
commitf979f185af997c5f11ca57854a1874088477a898 (patch)
treef9dba888ba28273eb77bdda8cf32bba673fe90ef /queen
parentb938b63ddf4bd09db1bd1d36408a217d6d13b3f8 (diff)
downloadscummvm-rg350-f979f185af997c5f11ca57854a1874088477a898.tar.gz
scummvm-rg350-f979f185af997c5f11ca57854a1874088477a898.tar.bz2
scummvm-rg350-f979f185af997c5f11ca57854a1874088477a898.zip
- Enabled missing calls to _sound->playSong, now it should *really* play all SFX
- Moved sound/music related toggle variables to Sound class - Changed "Couldn't find file.." warning() to debug(7, ..) svn-id: r11303
Diffstat (limited to 'queen')
-rw-r--r--queen/command.cpp13
-rw-r--r--queen/command.h3
-rw-r--r--queen/cutaway.cpp6
-rw-r--r--queen/logic.cpp19
-rw-r--r--queen/logic.h3
-rw-r--r--queen/resource.cpp2
-rw-r--r--queen/sound.cpp4
-rw-r--r--queen/sound.h16
8 files changed, 41 insertions, 25 deletions
diff --git a/queen/command.cpp b/queen/command.cpp
index ce169bd505..8ad1135208 100644
--- a/queen/command.cpp
+++ b/queen/command.cpp
@@ -25,6 +25,7 @@
#include "queen/input.h"
#include "queen/graphics.h"
#include "queen/logic.h"
+#include "queen/sound.h"
#include "queen/talk.h"
#include "queen/walk.h"
@@ -125,8 +126,8 @@ void SelectedCmdState::init() {
}
-Command::Command(Logic *l, Graphics *g, Input *i, Walk *w)
- : _logic(l), _graphics(g), _input(i), _walk(w) {
+Command::Command(Logic *l, Graphics *g, Input *i, Walk *w, Sound *s)
+ : _logic(l), _graphics(g), _input(i), _walk(w), _sound(s) {
_cmdText._graphics = _graphics;
_cmdText._logic = _logic;
}
@@ -365,7 +366,7 @@ void Command::executeCurrentAction(bool walk) {
if (_selCmd.action.value() != VERB_OPEN && _selCmd.action.value() != VERB_CLOSE) {
// only play song if it's a PLAY BEFORE type
if (com->song > 0) {
- // XXX playsong(com->song);
+ _sound->playSong(com->song);
}
}
@@ -423,7 +424,7 @@ void Command::executeCurrentAction(bool walk) {
// only play song if it's a PLAY AFTER type
if (com->song > 0) {
- // XXX playsong(com->song);
+ _sound->playSong(com->song);
}
clear(true);
@@ -1045,7 +1046,7 @@ void Command::changeObjectState(const Verb& action, int16 obj, int16 song, bool
// play music if it exists... (or SFX for open/close door)
if (song != 0) {
- // XXX playsong(abs(song));
+ _sound->playSong(abs(song));
}
if (objData->entryObj != 0) {
@@ -1067,7 +1068,7 @@ void Command::changeObjectState(const Verb& action, int16 obj, int16 song, bool
// play music if it exists... (or SFX for open/close door)
if (song != 0) {
- // XXX playsong(abs(song));
+ _sound->playSong(abs(song));
}
if (objData->entryObj != 0) {
diff --git a/queen/command.h b/queen/command.h
index fd11cb63a1..504fef771b 100644
--- a/queen/command.h
+++ b/queen/command.h
@@ -87,7 +87,7 @@ struct SelectedCmdState {
class Command {
public:
- Command(Logic*, Graphics*, Input*, Walk*);
+ Command(Logic*, Graphics*, Input*, Walk*, Sound*);
//! initialise command construction
void clear(bool clearTexts);
@@ -188,6 +188,7 @@ private:
Logic *_logic;
Graphics *_graphics;
Input *_input;
+ Sound *_sound;
Walk *_walk;
};
diff --git a/queen/cutaway.cpp b/queen/cutaway.cpp
index c19d8b72ce..3f1123ad19 100644
--- a/queen/cutaway.cpp
+++ b/queen/cutaway.cpp
@@ -1072,7 +1072,7 @@ byte *Cutaway::handleAnimation(byte *ptr, CutawayObject &object) {
return NULL;
if (objAnim[i].song > 0)
- /* XXX playsong(objAnim[i].song) */ ;
+ _sound->playSong(objAnim[i].song);
// Load but don't play
if(objAnim[i].song < 0) {
@@ -1396,9 +1396,9 @@ void Cutaway::run(char *nextFilename) {
_input->cutawayQuitReset();
if (_songBeforeComic > 0)
- /* XXX playsong(_songBeforeComic) */ ;
+ _sound->playSong(_songBeforeComic);
else if (_lastSong > 0)
- /* XXX playsong(_lastSong) */ ;
+ _sound->playSong(_lastSong);
}
void Cutaway::stop() {
diff --git a/queen/logic.cpp b/queen/logic.cpp
index a64a2db2da..a5929cc8df 100644
--- a/queen/logic.cpp
+++ b/queen/logic.cpp
@@ -28,6 +28,7 @@
#include "queen/display.h"
#include "queen/graphics.h"
#include "queen/input.h"
+#include "queen/sound.h"
#include "queen/talk.h"
#include "queen/walk.h"
@@ -183,7 +184,7 @@ Logic::Logic(Resource *theResource, Graphics *graphics, Display *theDisplay, Inp
_joe.x = _joe.y = 0;
_joe.scale = 100;
_walk = new Walk(this, _graphics);
- _cmd = new Command(this, _graphics, _input, _walk);
+ _cmd = new Command(this, _graphics, _input, _walk, _sound);
_dbg = new Debug(_input, this, _graphics);
memset(_gameState, 0, sizeof(_gameState));
memset(_talkSelected, 0, sizeof(_talkSelected));
@@ -380,9 +381,9 @@ void Logic::initialise() {
_settings.textToggle = true;
if (_resource->isFloppy())
- _settings.speechToggle = false;
+ _sound->speechToggle(false);
else
- _settings.speechToggle = true;
+ _sound->speechToggle(true);
_cmd->clear(false);
_scene = 0;
@@ -2376,9 +2377,9 @@ bool Logic::gameSave(uint16 slot, const char *desc) {
WRITE_BE_UINT16(ptr, _settings.talkSpeed); ptr += 2;
WRITE_BE_UINT16(ptr, _settings.musicVolume); ptr += 2;
- WRITE_BE_UINT16(ptr, _settings.sfxToggle ? 1 : 0); ptr += 2;
- WRITE_BE_UINT16(ptr, _settings.speechToggle ? 1 : 0); ptr += 2;
- WRITE_BE_UINT16(ptr, _settings.musicToggle ? 1 : 0); ptr += 2;
+ WRITE_BE_UINT16(ptr, _sound->sfxOn() ? 1 : 0); ptr += 2;
+ WRITE_BE_UINT16(ptr, _sound->speechOn() ? 1 : 0); ptr += 2;
+ WRITE_BE_UINT16(ptr, _sound->musicOn() ? 1 : 0); ptr += 2;
WRITE_BE_UINT16(ptr, _settings.textToggle ? 1 : 0); ptr += 2;
for (i = 0; i < 4; i++) {
@@ -2443,9 +2444,9 @@ bool Logic::gameLoad(uint16 slot) {
ptr += 32; //skip description
_settings.talkSpeed = (int16)READ_BE_UINT16(ptr); ptr += 2;
_settings.musicVolume = (int16)READ_BE_UINT16(ptr); ptr += 2;
- _settings.sfxToggle = READ_BE_UINT16(ptr) != 0; ptr += 2;
- _settings.speechToggle = READ_BE_UINT16(ptr) != 0; ptr += 2;
- _settings.musicToggle = READ_BE_UINT16(ptr) != 0; ptr += 2;
+ _sound->sfxToggle(READ_BE_UINT16(ptr) != 0); ptr += 2;
+ _sound->speechToggle(READ_BE_UINT16(ptr) != 0); ptr += 2;
+ _sound->musicToggle(READ_BE_UINT16(ptr) != 0); ptr += 2;
_settings.textToggle = READ_BE_UINT16(ptr) != 0; ptr += 2;
for (i = 0; i < 4; i++) {
diff --git a/queen/logic.h b/queen/logic.h
index e183efabbe..e944102fa7 100644
--- a/queen/logic.h
+++ b/queen/logic.h
@@ -43,10 +43,7 @@ struct ZoneSlot {
struct GameConfig {
int musicVolume;
- bool musicToggle;
- bool sfxToggle;
bool textToggle;
- bool speechToggle;
int talkSpeed;
};
diff --git a/queen/resource.cpp b/queen/resource.cpp
index f2a00d6bce..36066ddfd2 100644
--- a/queen/resource.cpp
+++ b/queen/resource.cpp
@@ -124,7 +124,7 @@ int32 Resource::resourceIndex(const char *filename) {
high = cur;
}
- warning("Couldn't find file '%s'", entryName);
+ debug(7, "Couldn't find file '%s'", entryName);
return -1;
}
diff --git a/queen/sound.cpp b/queen/sound.cpp
index 04a6cae124..b8c878c415 100644
--- a/queen/sound.cpp
+++ b/queen/sound.cpp
@@ -95,7 +95,7 @@ static ov_callbacks g_File_wrap = {
#endif
Sound::Sound(SoundMixer *mixer, Input *input, Resource *resource) :
- _mixer(mixer), _input(input), _resource(resource), _lastOverride(0), _currentSong(0), _sfxHandle(0) {
+ _mixer(mixer), _input(input), _resource(resource), _lastOverride(0), _currentSong(0), _sfxHandle(0), _sfxToggle(true), _speechToggle(true), _musicToggle(true) {
}
Sound::~Sound() {
@@ -137,7 +137,7 @@ void Sound::waitSfxFinished() {
void Sound::playSong(int16 songNum) {
int16 newTune = _song[songNum - 1].tuneList[0];
- if (_tune[newTune - 1].sfx[0] /* && _sfxToggle */ )
+ if (_tune[newTune - 1].sfx[0] && sfxOn())
sfxPlay(_sfxName[_tune[newTune - 1].sfx[0] - 1]);
}
diff --git a/queen/sound.h b/queen/sound.h
index a717f4e07c..5af30e8396 100644
--- a/queen/sound.h
+++ b/queen/sound.h
@@ -56,6 +56,18 @@ public:
void waitSfxFinished();
void playSong(int16 songNum);
+ bool sfxOn() { return _sfxToggle; }
+ void sfxToggle(bool val) { _sfxToggle = val; }
+ void toggleSfx() { _sfxToggle ^= true; }
+
+ bool speechOn() { return _speechToggle; }
+ void speechToggle(bool val) { _speechToggle = val; }
+ void toggleSpeech() { _speechToggle ^= true; }
+
+ bool musicOn() { return _musicToggle; }
+ void musicToggle(bool val) { _musicToggle = val; }
+ void toggleMusic() { _musicToggle ^= true; }
+
protected:
SoundMixer *_mixer;
Input *_input;
@@ -64,6 +76,10 @@ protected:
static const songData _song[];
static const tuneData _tune[];
static const char *_sfxName[];
+
+ bool _sfxToggle;
+ bool _speechToggle;
+ bool _musicToggle;
int16 _lastOverride;
int16 _lastMerge;