aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2014-08-31 19:21:02 -0400
committerPaul Gilbert2014-08-31 19:21:02 -0400
commit8990a3164351d7b494acc011221ce92a4974def3 (patch)
treea84de58a27d10c75ec32ef3b4dfbf3f61bed0cdb
parent218fb94abfb941d4d8b5b63e559623e87eb52382 (diff)
downloadscummvm-rg350-8990a3164351d7b494acc011221ce92a4974def3.tar.gz
scummvm-rg350-8990a3164351d7b494acc011221ce92a4974def3.tar.bz2
scummvm-rg350-8990a3164351d7b494acc011221ce92a4974def3.zip
MADS: Implement sound player group #9
-rw-r--r--engines/mads/nebular/sound_nebular.cpp307
-rw-r--r--engines/mads/nebular/sound_nebular.h59
2 files changed, 366 insertions, 0 deletions
diff --git a/engines/mads/nebular/sound_nebular.cpp b/engines/mads/nebular/sound_nebular.cpp
index fc2755db2f..4c6070b528 100644
--- a/engines/mads/nebular/sound_nebular.cpp
+++ b/engines/mads/nebular/sound_nebular.cpp
@@ -3114,6 +3114,313 @@ int ASound8::command37() {
return 0;
}
+/*-----------------------------------------------------------------------*/
+
+const ASound9::CommandPtr ASound9::_commandList[52] = {
+ &ASound9::command0, &ASound9::command1, &ASound9::command2, &ASound9::command3,
+ &ASound9::command4, &ASound9::command5, &ASound9::command6, &ASound9::command7,
+ &ASound9::command8, &ASound9::command9, &ASound9::command10, &ASound9::command11,
+ &ASound9::command12, &ASound9::command13, &ASound9::command14, &ASound9::command15,
+ &ASound9::command16, &ASound9::command17, &ASound9::command18, &ASound9::command19,
+ &ASound9::command20, &ASound9::command21, &ASound9::command22, &ASound9::command23,
+ &ASound9::command24, &ASound9::command25, &ASound9::command26, &ASound9::command27,
+ &ASound9::command28, &ASound9::command29, &ASound9::command30, &ASound9::command31,
+ &ASound9::command32, &ASound9::command33, &ASound9::command34, &ASound9::command35,
+ &ASound9::command36, &ASound9::command37, &ASound9::command38, &ASound9::command39,
+ &ASound9::command40, &ASound9::command41, &ASound9::command42, &ASound9::command43,
+ &ASound9::command44_46, &ASound9::command45, &ASound9::command44_46, &ASound9::command47,
+ &ASound9::command48, &ASound9::command49, &ASound9::command50, &ASound9::command51
+};
+
+ASound9::ASound9(Audio::Mixer *mixer) : ASound(mixer, "asound.009", 0x16F0) {
+ _v1 = _v2 = 0;
+ _soundPtr = nullptr;
+
+ // Load sound samples
+ _soundFile.seek(_dataOffset + 0x50);
+ for (int i = 0; i < 94; ++i)
+ _samples.push_back(AdlibSample(_soundFile));
+}
+
+int ASound9::command(int commandId, int param) {
+ if (commandId > 60)
+ return 0;
+
+ _commandParam = param;
+ _frameCounter = 0;
+ return (this->*_commandList[commandId])();
+}
+
+int ASound9::command9() {
+ _v1 = 1848;
+ _v2 = 84;
+ _channels[0].load(loadData(0xAA4, 470));
+ _channels[1].load(loadData(0xE4C, 450));
+ _channels[2].load(loadData(0x1466, 702));
+ _channels[3].load(loadData(0x137E, 232));
+ _channels[4].load(loadData(0x1014, 65));
+ _channels[5].load(loadData(0x11C4, 44));
+ _channels[6].load(loadData(0XC7A, 466));
+ return 0;
+}
+
+int ASound9::command10() {
+ _channels[0].load(loadData(0x1724, 24));
+ _channels[1].load(loadData(0x173C, 24));
+ _channels[2].load(loadData(0x1754, 20));
+ _channels[3].load(loadData(0x1768, 20));
+ _channels[4].load(loadData(0x177C, 20));
+ _channels[5].load(loadData(0x1790, 20));
+ return 0;
+}
+
+int ASound9::command11() {
+ playSound(0x8232, 168);
+ playSound(0x82DA, 170);
+ return 0;
+}
+
+int ASound9::command12() {
+ playSound(0x80DA, 12);
+ playSound(0x80E6, 12);
+ return 0;
+}
+
+int ASound9::command13() {
+ playSound(0x80F2, 38);
+ playSound(0x8118, 42);
+ return 0;
+}
+
+int ASound9::command14() {
+ playSound(0x81F6, 22);
+ return 0;
+}
+
+int ASound9::command15() {
+ playSound(0x818A, 32);
+ playSound(0x81AA, 32);
+ return 0;
+}
+
+int ASound9::command16() {
+ playSound(0x8022, 36);
+ playSound(0x8046, 42);
+ return 0;
+}
+
+int ASound9::command17() {
+ command29();
+ playSound(0x858C, 11);
+ return 0;
+}
+
+int ASound9::command18() {
+ playSound(0x80C2, 24);
+ return 0;
+}
+
+int ASound9::command19() {
+ playSound(0x80A0, 34);
+ return 0;
+}
+
+int ASound9::command20() {
+ int v = (getRandomNumber() & 0x10) | 0x4D;
+ byte *pData = loadData(0x8142, 8);
+ pData[4] = v & 0x7F;
+ playSoundData(pData);
+ return 0;
+}
+
+int ASound9::command21() {
+ playSound(0x815A, 16);
+ return 0;
+}
+
+int ASound9::command22() {
+ playSound(0x816A, 16);
+ return 0;
+}
+
+int ASound9::command23() {
+ playSound(0x814A, 16);
+ return 0;
+}
+
+int ASound9::command24() {
+ playSound(0x7FE2, 34);
+ return 0;
+}
+
+int ASound9::command25() {
+ playSound(0x8004, 30);
+ return 0;
+}
+
+int ASound9::command26() {
+ _channels[6].load(loadData(0x8384, 156));
+ _channels[7].load(loadData(0x8420, 160));
+ return 0;
+}
+
+int ASound9::command27() {
+ playSound(0x84C0, 140);
+ return 0;
+}
+
+int ASound9::command28() {
+ playSound(0x81CA, 10);
+ return 0;
+}
+
+int ASound9::command29() {
+ playSound(0x81D4, 10);
+ return 0;
+}
+
+int ASound9::command30() {
+ playSound(0x817A, 16);
+ return 0;
+}
+
+int ASound9::command31() {
+ playSound(0x820C, 14);
+ playSound(0x821A, 24);
+ return 0;
+}
+
+int ASound9::command32() {
+ playSound(0x8070, 8);
+ return 0;
+}
+
+int ASound9::command33() {
+ playSound(0x8078, 16);
+ playSound(0x8088, 16);
+ return 0;
+}
+
+int ASound9::command34() {
+ // Skipped stuff in original
+ _channels[0].load(loadData(0x17A4, 24));
+ _channels[1].load(loadData(0x1CDE, 62));
+ _channels[2].load(loadData(0x2672, 980));
+ _channels[3].load(loadData(0x3336, 1000));
+ _channels[4].load(loadData(0x469E, 176));
+ _channels[5].load(loadData(0x57F2, 138));
+
+ return 0;
+}
+
+int ASound9::command35() {
+ playSound(0x854C, 64);
+ return 0;
+}
+
+int ASound9::command36() {
+ playSound(0x81DE, 10);
+ playSound(0x81E8, 14);
+ return 0;
+}
+
+int ASound9::command37() {
+ byte *pData = loadData(0x8098, 8);
+ int v = getRandomNumber();
+ if ((v &= 0x40) != 0)
+ v |= 8;
+ else
+ v += 0x4A;
+
+ pData[6] = v;
+ playSoundData(pData);
+ return 0;
+}
+
+int ASound9::command38() {
+ playSound(0x100E, 6);
+ return 0;
+}
+
+int ASound9::command39() {
+ _soundPtr = loadData(0x1055, 128);
+ return 0;
+}
+
+int ASound9::command40() {
+ _soundPtr = loadData(0x118C, 50);
+ return 0;
+}
+
+int ASound9::command41() {
+ _soundPtr = loadData(0x11BE, 6);
+ return 0;
+}
+
+int ASound9::command42() {
+ _soundPtr = loadData(0x11F0, 50);
+ return 0;
+}
+
+int ASound9::command43() {
+ _v1 = _v2 = 80;
+ _channels[0].load(loadData(0x626A, 90));
+ _channels[1].load(loadData(0x67F2, 92));
+ _channels[2].load(loadData(0x6CFE, 232));
+ _channels[3].load(loadData(0x7146, 236));
+
+ return 0;
+}
+
+int ASound9::command44_46() {
+ _soundPtr = loadData(0x10D5, 38);
+ return 0;
+}
+
+int ASound9::command45() {
+ _soundPtr = loadData(0x10FB, 38);
+ return 0;
+}
+
+int ASound9::command47() {
+ _soundPtr = loadData(0x1121, 107);
+ return 0;
+}
+
+int ASound9::command48() {
+ playSound(0x7FD0, 8);
+ playSound(0x7FD8, 10);
+ return 0;
+}
+
+int ASound9::command49() {
+ _channels[0].load(loadData(0x7AD6, 92));
+ _channels[1].load(loadData(0x7B32, 90));
+ _channels[2].load(loadData(0x7B8C, 738));
+ _channels[3].load(loadData(0x7E6E, 28));
+ _channels[4].load(loadData(0x7E8A, 30));
+ _channels[5].load(loadData(0x7EA8, 30));
+ _channels[6].load(loadData(0x7EC6, 195));
+ return 0;
+}
+
+int ASound9::command50() {
+ _soundPtr = loadData(0x1222, 348);
+ return 0;
+}
+
+int ASound9::command51() {
+ // Skipped stuff in original
+ _channels[0].load(loadData(0x17BC, 1282));
+ _channels[1].load(loadData(0x1CFC, 2422));
+ _channels[2].load(loadData(0x2A46, 2288));
+ _channels[3].load(loadData(0x371E, 3964));
+ _channels[4].load(loadData(0x474E, 1863));
+ _channels[5].load(loadData(0x587C, 2538));
+ return 0;
+}
+
+
} // End of namespace Nebular
} // End of namespace MADS
diff --git a/engines/mads/nebular/sound_nebular.h b/engines/mads/nebular/sound_nebular.h
index c485bd7955..744467b45e 100644
--- a/engines/mads/nebular/sound_nebular.h
+++ b/engines/mads/nebular/sound_nebular.h
@@ -713,6 +713,65 @@ public:
virtual int command(int commandId, int param);
};
+class ASound9 : public ASound {
+private:
+ int _v1, _v2;
+ byte *_soundPtr;
+
+ typedef int (ASound9::*CommandPtr)();
+ static const CommandPtr _commandList[52];
+
+ int command9();
+ int command10();
+ int command11();
+ int command12();
+ int command13();
+ int command14();
+ int command15();
+ int command16();
+ int command17();
+ int command18();
+ int command19();
+ int command20();
+ int command21();
+ int command22();
+ int command23();
+ int command24();
+ int command25();
+ int command26();
+ int command27();
+ int command28();
+ int command29();
+ int command30();
+ int command31();
+ int command32();
+ int command33();
+ int command34();
+ int command35();
+ int command36();
+ int command37();
+ int command38();
+ int command39();
+ int command40();
+ int command41();
+ int command42();
+ int command43();
+ int command44_46();
+ int command45();
+ int command47();
+ int command48();
+ int command49();
+ int command50();
+ int command51();
+ int command57();
+ int command59();
+ int command60();
+public:
+ ASound9(Audio::Mixer *mixer);
+
+ virtual int command(int commandId, int param);
+};
+
} // End of namespace Nebular
} // End of namespace MADS