aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorVladimir Menshakov2010-05-07 07:56:57 +0000
committerVladimir Menshakov2010-05-07 07:56:57 +0000
commit2dd34a2123c053ec2c61c6885ca2f54a84fb15f3 (patch)
tree39903eafc1ea1db1e3217d3bfcfb07b773fbc964 /engines
parente4a4df960afef56313b66a7e68c9342ec979d171 (diff)
downloadscummvm-rg350-2dd34a2123c053ec2c61c6885ca2f54a84fb15f3.tar.gz
scummvm-rg350-2dd34a2123c053ec2c61c6885ca2f54a84fb15f3.tar.bz2
scummvm-rg350-2dd34a2123c053ec2c61c6885ca2f54a84fb15f3.zip
added voices pack/cd music support
svn-id: r48962
Diffstat (limited to 'engines')
-rw-r--r--engines/teenagent/console.cpp16
-rw-r--r--engines/teenagent/console.h1
-rw-r--r--engines/teenagent/resources.cpp3
-rw-r--r--engines/teenagent/resources.h4
-rw-r--r--engines/teenagent/teenagent.cpp23
5 files changed, 38 insertions, 9 deletions
diff --git a/engines/teenagent/console.cpp b/engines/teenagent/console.cpp
index b4b8770d44..60f7854f09 100644
--- a/engines/teenagent/console.cpp
+++ b/engines/teenagent/console.cpp
@@ -30,7 +30,8 @@ namespace TeenAgent {
Console::Console(TeenAgentEngine *engine) : _engine(engine) {
DCmd_Register("enable_object", WRAP_METHOD(Console, enableObject));
DCmd_Register("disable_object", WRAP_METHOD(Console, enableObject));
- DCmd_Register("set_ons", WRAP_METHOD(Console, setOns));
+ DCmd_Register("set_ons", WRAP_METHOD(Console, setOns));
+ DCmd_Register("set_music", WRAP_METHOD(Console, setMusic));
}
bool Console::enableObject(int argc, const char **argv) {
@@ -91,7 +92,20 @@ bool Console::setOns(int argc, const char **argv) {
}
_engine->setOns(index, value, scene_id);
+ return true;
+}
+bool Console::setMusic(int argc, const char **argv) {
+ if (argc < 2) {
+ DebugPrintf("usage: %s index(1-11)\n", argv[0]);
+ return true;
+ }
+ int index = atoi(argv[1]);
+ if (index <= 0 || index > 11) {
+ DebugPrintf("invalid value\n");
+ return true;
+ }
+ _engine->setMusic(index);
return true;
}
diff --git a/engines/teenagent/console.h b/engines/teenagent/console.h
index c0cc75da97..2aba99428b 100644
--- a/engines/teenagent/console.h
+++ b/engines/teenagent/console.h
@@ -38,6 +38,7 @@ public:
private:
bool enableObject(int argc, const char **argv);
bool setOns(int argc, const char **argv);
+ bool setMusic(int argc, const char **argv);
TeenAgentEngine *_engine;
};
diff --git a/engines/teenagent/resources.cpp b/engines/teenagent/resources.cpp
index 6fc1f4b5dc..0a59c0b368 100644
--- a/engines/teenagent/resources.cpp
+++ b/engines/teenagent/resources.cpp
@@ -44,6 +44,7 @@ void Resources::deinit() {
mmm.close();
sam_mmm.close();
sam_sam.close();
+ voices.close();
}
/*
@@ -95,7 +96,7 @@ bool Resources::loadArchives(const ADGameDescription *gd) {
mmm.open("mmm.res");
sam_mmm.open("sam_mmm.res");
sam_sam.open("sam_sam.res");
-
+ voices.open("voices.res");
return true;
}
diff --git a/engines/teenagent/resources.h b/engines/teenagent/resources.h
index 95f0c1c2e4..d49602c3c5 100644
--- a/engines/teenagent/resources.h
+++ b/engines/teenagent/resources.h
@@ -54,9 +54,9 @@ public:
* TransientFilePack does not keep opened file descriptors and reopens it on each request.
*/
#ifdef __PSP__
- TransientFilePack off, on, ons, lan000, lan500, sam_mmm, sam_sam, mmm;
+ TransientFilePack off, on, ons, lan000, lan500, sam_mmm, sam_sam, mmm, voices;
#else
- FilePack off, on, ons, lan000, lan500, sam_mmm, sam_sam, mmm;
+ FilePack off, on, ons, lan000, lan500, sam_mmm, sam_sam, mmm, voices;
#endif
Segment cseg, dseg, eseg;
diff --git a/engines/teenagent/teenagent.cpp b/engines/teenagent/teenagent.cpp
index 686ea8bb74..bb0e9773a2 100644
--- a/engines/teenagent/teenagent.cpp
+++ b/engines/teenagent/teenagent.cpp
@@ -31,6 +31,7 @@
#include "engines/advancedDetector.h"
#include "engines/util.h"
+#include "sound/audiocd.h"
#include "sound/mixer.h"
#include "sound/decoders/raw.h"
@@ -470,8 +471,8 @@ Common::Error TeenAgentEngine::run() {
syncSoundSettings();
- music->load(1);
_mixer->playStream(Audio::Mixer::kMusicSoundType, &_musicHandle, music, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, false);
+ setMusic(1);
music->start();
int load_slot = Common::ConfigManager::instance().getInt("save_slot");
@@ -971,10 +972,22 @@ void TeenAgentEngine::playSoundNow(byte id) {
void TeenAgentEngine::setMusic(byte id) {
debug(0, "starting music %u", id);
- if (!music->load(id))
- return;
- *Resources::instance()->dseg.ptr(0xDB90) = id;
- music->start();
+ Resources *res = Resources::instance();
+
+ if (id != 1) //intro music
+ *res->dseg.ptr(0xDB90) = id;
+
+ if (_gameDescription->flags & ADGF_CD) {
+ byte track2cd[] = {7, 2, 0, 9, 3, 6, 8, 10, 4, 5, 11};
+ if (id == 0 || id > 11 || track2cd[id - 1] == 0) {
+ debug(0, "no cd music for id %u", id);
+ return;
+ }
+ byte track = track2cd[id - 1];
+ debug(0, "playing cd track %u", track);
+ Audio::AudioCDManager::instance().play(track, -1, 0, 0);
+ } else if (music->load(id))
+ music->start();
}
bool TeenAgentEngine::hasFeature(EngineFeature f) const {