aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra
diff options
context:
space:
mode:
authorFlorian Kagerer2009-09-13 21:41:29 +0000
committerFlorian Kagerer2009-09-13 21:41:29 +0000
commitb73f9ab41ecada2a9971834e1ef1bb4c106cbec3 (patch)
treec138df774a5e83ed8a539161da5eccbc18cde8ad /engines/kyra
parent9cc0dc3d9126245afda5e3e3605ecdae18c84767 (diff)
downloadscummvm-rg350-b73f9ab41ecada2a9971834e1ef1bb4c106cbec3.tar.gz
scummvm-rg350-b73f9ab41ecada2a9971834e1ef1bb4c106cbec3.tar.bz2
scummvm-rg350-b73f9ab41ecada2a9971834e1ef1bb4c106cbec3.zip
KYRA: - add sfx support for PC98-Version
svn-id: r44074
Diffstat (limited to 'engines/kyra')
-rw-r--r--engines/kyra/kyra_lok.cpp12
-rw-r--r--engines/kyra/kyra_lok.h3
-rw-r--r--engines/kyra/seqplayer.cpp8
-rw-r--r--engines/kyra/sound.h9
-rw-r--r--engines/kyra/sound_adlib.h1
-rw-r--r--engines/kyra/sound_intern.h3
-rw-r--r--engines/kyra/sound_lok.cpp7
-rw-r--r--engines/kyra/sound_towns.cpp22
-rw-r--r--engines/kyra/staticres.cpp53
9 files changed, 108 insertions, 10 deletions
diff --git a/engines/kyra/kyra_lok.cpp b/engines/kyra/kyra_lok.cpp
index cb0499c38b..e68a73bb29 100644
--- a/engines/kyra/kyra_lok.cpp
+++ b/engines/kyra/kyra_lok.cpp
@@ -195,7 +195,10 @@ Common::Error KyraEngine_LoK::init() {
if (!_sound->init())
error("Couldn't init sound");
- _sound->loadSoundFile(0);
+ if (_flags.platform == Common::kPlatformPC98)
+ _sound->loadSoundFile(_introSfxDataPC98, _introSfxDataPC98Size);
+ else
+ _sound->loadSoundFile(0);
setupButtonData();
@@ -334,8 +337,13 @@ Common::Error KyraEngine_LoK::go() {
void KyraEngine_LoK::startup() {
static const uint8 colorMap[] = { 0, 0, 0, 0, 12, 12, 12, 0, 0, 0, 0, 0 };
_screen->setTextColorMap(colorMap);
+
_sound->setSoundList(&_soundData[kMusicIngame]);
- _sound->loadSoundFile(0);
+ if (_flags.platform == Common::kPlatformPC98)
+ _sound->loadSoundFile("se.dat");
+ else
+ _sound->loadSoundFile(0);
+
// _screen->setFont(Screen::FID_6_FNT);
_screen->setAnimBlockPtr(3750);
memset(_sceneAnimTable, 0, sizeof(_sceneAnimTable));
diff --git a/engines/kyra/kyra_lok.h b/engines/kyra/kyra_lok.h
index 5d20cb0652..f89caef142 100644
--- a/engines/kyra/kyra_lok.h
+++ b/engines/kyra/kyra_lok.h
@@ -510,6 +510,9 @@ protected:
static const int8 _amigaTrackMap[];
static const int _amigaTrackMapSize;
+ static const uint8 _introSfxDataPC98[];
+ static const int _introSfxDataPC98Size;
+
// TODO: get rid of all variables having pointers to the static resources if possible
// i.e. let them directly use the _staticres functions
void initStaticResource();
diff --git a/engines/kyra/seqplayer.cpp b/engines/kyra/seqplayer.cpp
index 3536d2db06..4837fb03dd 100644
--- a/engines/kyra/seqplayer.cpp
+++ b/engines/kyra/seqplayer.cpp
@@ -415,6 +415,14 @@ void SeqPlayer::s1_fillRect() {
void SeqPlayer::s1_playEffect() {
uint8 track = *_seqData++;
_vm->delay(3 * _vm->tickLength());
+
+ if (_vm->gameFlags().platform == Common::kPlatformPC98) {
+ if (track > 21 && track < 38)
+ track -= 22;
+ else
+ return;
+ }
+
_sound->playSoundEffect(track);
}
diff --git a/engines/kyra/sound.h b/engines/kyra/sound.h
index 2f24a264f1..e81b18d8a4 100644
--- a/engines/kyra/sound.h
+++ b/engines/kyra/sound.h
@@ -108,6 +108,12 @@ public:
virtual void loadSoundFile(Common::String file) = 0;
/**
+ * Load hard coded data for playing music
+ * (and somtimes sound effects) from.
+ */
+ virtual void loadSoundFile(const uint8 *data, int len) { }
+
+ /**
* Load a sound file for playing sound
* effects from.
*/
@@ -268,7 +274,8 @@ public:
bool hasSoundFile(uint file) const { return _music->hasSoundFile(file) && _sfx->hasSoundFile(file); }
void loadSoundFile(uint file) { _music->loadSoundFile(file); _sfx->loadSoundFile(file); }
void loadSoundFile(Common::String file) { _music->loadSoundFile(file); _sfx->loadSoundFile(file); }
-
+
+ void loadSoundFile(const uint8 *data, int len) { _sfx->loadSoundFile(data, len); }
void loadSfxFile(Common::String file) { _sfx->loadSoundFile(file); }
void playTrack(uint8 track) { _music->playTrack(track); }
diff --git a/engines/kyra/sound_adlib.h b/engines/kyra/sound_adlib.h
index f384113af7..e85beff813 100644
--- a/engines/kyra/sound_adlib.h
+++ b/engines/kyra/sound_adlib.h
@@ -72,6 +72,7 @@ public:
void loadSoundFile(uint file);
void loadSoundFile(Common::String file);
+ void loadSoundFile(const uint8 *data, int len) {}
void playTrack(uint8 track);
void haltTrack();
diff --git a/engines/kyra/sound_intern.h b/engines/kyra/sound_intern.h
index 3ee468b87b..b84b1c4bf5 100644
--- a/engines/kyra/sound_intern.h
+++ b/engines/kyra/sound_intern.h
@@ -171,7 +171,8 @@ public:
void process() {}
void loadSoundFile(uint file) {}
- void loadSoundFile(Common::String) {}
+ void loadSoundFile(Common::String file);
+ void loadSoundFile(const uint8 *data, int len);
void playTrack(uint8 track);
void haltTrack();
diff --git a/engines/kyra/sound_lok.cpp b/engines/kyra/sound_lok.cpp
index 8aab4f6ce7..f14e4eae84 100644
--- a/engines/kyra/sound_lok.cpp
+++ b/engines/kyra/sound_lok.cpp
@@ -29,6 +29,13 @@
namespace Kyra {
void KyraEngine_LoK::snd_playSoundEffect(int track, int volume) {
+ if (_flags.platform == Common::kPlatformPC98) {
+ if (track < 16 || track > 119)
+ track = 58;
+ else
+ track -= 16;
+ }
+
if ((_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98) && track == 49) {
snd_playWanderScoreViaMap(56, 1);
return;
diff --git a/engines/kyra/sound_towns.cpp b/engines/kyra/sound_towns.cpp
index fe0a44c052..0c67b1e83a 100644
--- a/engines/kyra/sound_towns.cpp
+++ b/engines/kyra/sound_towns.cpp
@@ -4069,12 +4069,25 @@ SoundPC98::~SoundPC98() {
bool SoundPC98::init() {
_driver = new TownsPC98_OpnDriver(_mixer, TownsPC98_OpnDriver::OD_TYPE26);
- _sfxTrackData = _vm->resource()->fileData("se.dat", 0);
- if (!_sfxTrackData)
- return false;
+
return _driver->init();
}
+void SoundPC98::loadSoundFile(Common::String file) {
+ if (_sfxTrackData)
+ delete _sfxTrackData;
+
+ _sfxTrackData = _vm->resource()->fileData(file.c_str(), 0);
+}
+
+void SoundPC98::loadSoundFile(const uint8 *data, int len) {
+ if (_sfxTrackData)
+ delete _sfxTrackData;
+
+ _sfxTrackData = new uint8[len];
+ memcpy(_sfxTrackData, data, len);
+}
+
void SoundPC98::playTrack(uint8 track) {
track += extraOffset();
@@ -4119,9 +4132,6 @@ void SoundPC98::playSoundEffect(uint8 track) {
if (!_sfxTrackData)
return;
- // This has been disabled for now since I don't know
- // how to make up the correct track number. It probably
- // needs a map.
_driver->loadSoundEffectData(_sfxTrackData, track);
}
diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp
index d8928b5dba..5c3f57085e 100644
--- a/engines/kyra/staticres.cpp
+++ b/engines/kyra/staticres.cpp
@@ -2441,6 +2441,59 @@ const int8 KyraEngine_LoK::_amigaTrackMap[] = {
const int KyraEngine_LoK::_amigaTrackMapSize = ARRAYSIZE(KyraEngine_LoK::_amigaTrackMap);
+const uint8 KyraEngine_LoK::_introSfxDataPC98[] = {
+ 0x56, 0x00, 0x43, 0x00, 0x7C, 0x00, 0x69, 0x00, 0xA2, 0x00, 0x8F, 0x00, 0x00, 0x00, 0xB5, 0x00,
+ 0x00, 0x00, 0xE5, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x2C, 0x01, 0x00, 0x00, 0x45, 0x01,
+ 0x00, 0x00, 0x54, 0x01, 0x00, 0x00, 0x68, 0x01, 0x8D, 0x01, 0x7C, 0x01, 0xBD, 0x01, 0x9E, 0x01,
+ 0xF0, 0x01, 0xDC, 0x01, 0x00, 0x00, 0x04, 0x02, 0x00, 0x00, 0x2B, 0x02, 0x59, 0x02, 0x40, 0x02,
+ 0xF1, 0x00, 0xFF, 0xF1, 0x09, 0x32, 0x81, 0x49, 0x81, 0x52, 0x81, 0x59, 0x81, 0xF7, 0x01, 0x03,
+ 0xC7, 0x00, 0xFF, 0x42, 0x32, 0xFF, 0xF1, 0x05, 0x30, 0x81, 0x47, 0x81, 0x50, 0x81, 0x57, 0x81,
+ 0xF7, 0x01, 0x03, 0xC7, 0x00, 0xFF, 0x41, 0x32, 0xFF, 0xF1, 0x0C, 0x32, 0x81, 0x49, 0x81, 0x52,
+ 0x81, 0x59, 0x81, 0xF7, 0x01, 0x03, 0xC7, 0x00, 0xFF, 0x42, 0x32, 0xFF, 0xF1, 0x08, 0x30, 0x81,
+ 0x47, 0x81, 0x50, 0x81, 0x57, 0x81, 0xF7, 0x01, 0x03, 0xC7, 0x00, 0xFF, 0x41, 0x32, 0xFF, 0xF1,
+ 0x0F, 0x32, 0x81, 0x49, 0x81, 0x52, 0x81, 0x59, 0x81, 0xF7, 0x01, 0x03, 0xC7, 0x00, 0xFF, 0x42,
+ 0x32, 0xFF, 0xF1, 0x0C, 0x30, 0x81, 0x47, 0x81, 0x50, 0x81, 0x57, 0x81, 0xF7, 0x01, 0x03, 0xC7,
+ 0x00, 0xFF, 0x41, 0x32, 0xFF, 0xF1, 0x0A, 0x39, 0x01, 0x44, 0x01, 0x49, 0x01, 0xFC, 0xF6, 0x05,
+ 0x05, 0xB7, 0x00, 0x39, 0x01, 0x44, 0x01, 0x49, 0x01, 0xF6, 0x02, 0x02, 0xC3, 0x00, 0xFB, 0xFB,
+ 0xFB, 0xFB, 0x39, 0x01, 0x44, 0x01, 0x49, 0x01, 0xF6, 0x02, 0x02, 0xD2, 0x00, 0xFC, 0xFC, 0xF6,
+ 0x05, 0x05, 0xC3, 0x00, 0xFF, 0xF1, 0x0F, 0x69, 0x81, 0x59, 0x81, 0x49, 0x01, 0x39, 0x81, 0x54,
+ 0x01, 0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