aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorathrxx2019-11-16 22:00:30 +0100
committerathrxx2019-12-18 20:50:41 +0100
commit7cae73aae3775e82ca8e78abe7809d125b67ccc3 (patch)
tree0581903d17feab307e052af6e264e449ce9e45cf
parentf74f4929a043e278ea5bd989eeac17c18c756e22 (diff)
downloadscummvm-rg350-7cae73aae3775e82ca8e78abe7809d125b67ccc3.tar.gz
scummvm-rg350-7cae73aae3775e82ca8e78abe7809d125b67ccc3.tar.bz2
scummvm-rg350-7cae73aae3775e82ca8e78abe7809d125b67ccc3.zip
KYRA: (EOB/PC98) - initial startup fix
- hook up static resources, sound code, etc - nothing really working yet, though (except the music)
-rw-r--r--engines/kyra/engine/chargen.cpp1
-rw-r--r--engines/kyra/engine/eob.h8
-rw-r--r--engines/kyra/engine/eobcommon.cpp12
-rw-r--r--engines/kyra/engine/scene_eob.cpp2
-rw-r--r--engines/kyra/graphics/screen_eob.cpp59
-rw-r--r--engines/kyra/graphics/screen_eob.h9
-rw-r--r--engines/kyra/module.mk1
-rw-r--r--engines/kyra/resource/staticres_eob.cpp38
-rw-r--r--engines/kyra/sequence/sequences_eob.cpp72
-rw-r--r--engines/kyra/sound/sound_intern.h31
-rw-r--r--engines/kyra/sound/sound_pc98_eob.cpp126
11 files changed, 310 insertions, 49 deletions
diff --git a/engines/kyra/engine/chargen.cpp b/engines/kyra/engine/chargen.cpp
index 7a4c9672c6..ef61bb987c 100644
--- a/engines/kyra/engine/chargen.cpp
+++ b/engines/kyra/engine/chargen.cpp
@@ -212,6 +212,7 @@ bool CharacterGenerator::start(EoBCharacter *characters, uint8 ***faceShapes) {
// Unlike the original we allow returning to the main menu if no character has been created yet or all characters have been deleted
if (!_characters[0].name[0] && !_characters[1].name[0] && !_characters[2].name[0] && !_characters[3].name[0]) {
_vm->snd_stopSound();
+ *faceShapes = _faceShapes;
return false;
}
}
diff --git a/engines/kyra/engine/eob.h b/engines/kyra/engine/eob.h
index efb6c47b30..09e769bb72 100644
--- a/engines/kyra/engine/eob.h
+++ b/engines/kyra/engine/eob.h
@@ -53,7 +53,13 @@ private:
void startupLoad();
// Intro/Outro
- void seq_playIntro();
+ enum IntroPart {
+ kOnlyCredits = 0,
+ kOnlyIntro,
+ kCreditsAndIntro,
+ };
+
+ void seq_playIntro(int part);
void seq_playFinale();
void seq_xdeath();
diff --git a/engines/kyra/engine/eobcommon.cpp b/engines/kyra/engine/eobcommon.cpp
index 3389d4fed0..826502d405 100644
--- a/engines/kyra/engine/eobcommon.cpp
+++ b/engines/kyra/engine/eobcommon.cpp
@@ -413,7 +413,8 @@ Common::Error EoBCoreEngine::init() {
} else if (_flags.platform == Common::kPlatformFMTowns) {
_sound = new SoundTowns_Darkmoon(this, _mixer);
} else if (_flags.platform == Common::kPlatformPC98) {
-
+ if (_flags.gameID == GI_EOB1)
+ _sound = new SoundPC98_EoB(this, _mixer);
} else if (_flags.platform == Common::kPlatformAmiga) {
_sound = new SoundAmiga_EoB(this, _mixer);
}
@@ -421,6 +422,9 @@ Common::Error EoBCoreEngine::init() {
assert(_sound);
_sound->init();
+ // This if for EOB1 / PC98 only
+ _sound->loadSfxFile("EFECT.OBJ");
+
// Setup volume settings (and read in all ConfigManager settings)
syncSoundSettings();
@@ -566,9 +570,9 @@ Common::Error EoBCoreEngine::go() {
// Import original save game files (especially the "Quick Start Party")
if (ConfMan.getBool("importOrigSaves")) {
- importOriginalSaveFile(-1);
- ConfMan.setBool("importOrigSaves", false);
- ConfMan.flushToDisk();
+ //importOriginalSaveFile(-1);
+ //ConfMan.setBool("importOrigSaves", false);
+ //ConfMan.flushToDisk();
}
loadItemDefs();
diff --git a/engines/kyra/engine/scene_eob.cpp b/engines/kyra/engine/scene_eob.cpp
index 110bf0d12c..6d51c0c725 100644
--- a/engines/kyra/engine/scene_eob.cpp
+++ b/engines/kyra/engine/scene_eob.cpp
@@ -706,7 +706,7 @@ int EoBCoreEngine::calcNewBlockPositionAndTestPassability(uint16 curBlock, uint1
void EoBCoreEngine::notifyBlockNotPassable() {
_txt->printMessage(_warningStrings[0]);
- snd_playSoundEffect(29);
+ snd_playSoundEffect(29); //PC98 : 45
removeInputTop();
}
diff --git a/engines/kyra/graphics/screen_eob.cpp b/engines/kyra/graphics/screen_eob.cpp
index f1efbd0943..785317ba23 100644
--- a/engines/kyra/graphics/screen_eob.cpp
+++ b/engines/kyra/graphics/screen_eob.cpp
@@ -63,6 +63,18 @@ Screen_EoB::Screen_EoB(EoBCoreEngine *vm, OSystem *system) : Screen(vm, system,
_cgaMappingDefault = 0;
_cgaDitheringTables[0] = _cgaDitheringTables[1] = 0;
_useHiResEGADithering = _dualPaletteMode = false;
+ for (int i = 0; i < 10; ++i)
+ _palette16c[i] = 0;
+
+ _cpsFilePattern = "%s.CPS";
+ if (_vm->gameFlags().platform == Common::kPlatformFMTowns) {
+ _cpsFilePattern = "%s.SHP";
+ } else if (_vm->game() == GI_EOB1) {
+ if (_vm->gameFlags().platform == Common::kPlatformPC98)
+ _cpsFilePattern = "%s.BIN";
+ else if (_renderMode == Common::kRenderEGA || _renderMode == Common::kRenderCGA)
+ _cpsFilePattern = "%s.EGA";
+ }
}
Screen_EoB::~Screen_EoB() {
@@ -114,6 +126,12 @@ bool Screen_EoB::init() {
_cgaScaleTable[i] = ((i & 0xF0) >> 2) | (i & 0x03);
}
+ const uint8 *pal16c = _vm->staticres()->loadRawData(kEoB1Palettes16c, temp);
+ if (pal16c) {
+ for (int i = 0; i < 10; i++)
+ _palette16c[i] = pal16c + i * 48;
+ }
+
return true;
}
return false;
@@ -235,11 +253,11 @@ void Screen_EoB::loadShapeSetBitmap(const char *file, int tempPage, int destPage
void Screen_EoB::loadBitmap(const char *filename, int tempPage, int dstPage, Palette *pal, bool skip) {
Screen::loadBitmap(filename, tempPage, dstPage, pal);
- Common::SeekableReadStream *str = _vm->resource()->createReadStream(filename);
- str->skip(4);
- uint32 imgSize = str->readUint32LE();
-
if (_isAmiga && !skip) {
+ Common::SeekableReadStream *str = _vm->resource()->createReadStream(filename);
+ str->skip(4);
+ uint32 imgSize = str->readUint32LE();
+
if (_vm->game() == GI_EOB1 && (dstPage == 3 || dstPage == 4) && imgSize == 40064) {
// Yay, this is where EOB1 Amiga hides the palette data
loadPalette(_pagePtrs[dstPage] + 40000, *_palettes[0], 64);
@@ -253,15 +271,14 @@ void Screen_EoB::loadBitmap(const char *filename, int tempPage, int dstPage, Pal
_palettes[i]->loadAmigaPalette(*str, 0, 32);
}
}
- Screen::convertAmigaGfx(getPagePtr(dstPage), 320, 200);
- }
- delete str;
+ Screen::convertAmigaGfx(getPagePtr(dstPage), 320, 200);
+ delete str;
+ }
}
void Screen_EoB::loadEoBBitmap(const char *file, const uint8 *cgaMapping, int tempPage, int destPage, int convertToPage) {
- const char *filePattern = _vm->gameFlags().platform == Common::kPlatformFMTowns ? "%s.SHP" : ((_vm->game() == GI_EOB1 && (_renderMode == Common::kRenderEGA || _renderMode == Common::kRenderCGA)) ? "%s.EGA" : "%s.CPS");
- Common::String tmp = Common::String::format(filePattern, file);
+ Common::String tmp = Common::String::format(_cpsFilePattern, file);
Common::SeekableReadStream *s = _vm->resource()->createReadStream(tmp);
bool loadAlternative = false;
@@ -271,6 +288,14 @@ void Screen_EoB::loadEoBBitmap(const char *file, const uint8 *cgaMapping, int te
s->read(_shpBuffer, s->size());
decodeSHP(_shpBuffer, destPage);
+ } if (_vm->gameFlags().platform == Common::kPlatformPC98) {
+ if (!s)
+ error("Screen_EoB::loadEoBBitmap(): Failed to load file '%s'", file);
+ s->skip(2);
+ uint16 imgSize = s->readUint16LE();
+ loadFileDataToPage(s, tempPage, s->size() - 4);
+ decodeBIN(_pagePtrs[tempPage], _pagePtrs[destPage], imgSize);
+
} else if (s) {
// This additional check is necessary since some localized versions of EOB II seem to contain invalid (size zero) cps files
if (s->size() == 0) {
@@ -368,9 +393,9 @@ void Screen_EoB::setScreenPalette(const Palette &pal) {
if (_bytesPerPixel == 2) {
for (int i = 0; i < 4; i++)
createFadeTable16bit((const uint16*)(pal.getData()), &_16bitPalette[i * 256], 0, i * 85);
- }else if (_useHiResEGADithering && pal.getNumColors() != 16) {
+ } else if (_useHiResEGADithering && pal.getNumColors() != 16) {
generateEGADitheringTable(pal);
- } else if (_renderMode == Common::kRenderEGA && pal.getNumColors() == 16) {
+ } else if ((_renderMode == Common::kRenderEGA) && pal.getNumColors() == 16) {
_screenPalette->copy(pal);
_system->getPaletteManager()->setPalette(_screenPalette->getData(), 0, _screenPalette->getNumColors());
} else if (_renderMode != Common::kRenderCGA && _renderMode != Common::kRenderEGA) {
@@ -400,7 +425,7 @@ uint8 *Screen_EoB::encodeShape(uint16 x, uint16 y, uint16 w, uint16 h, bool enco
uint8 *srcLineStart = getPagePtr(_curPage | 1) + y * 320 + (x << 3);
uint8 *src = srcLineStart;
- if (_renderMode == Common::kRenderEGA && !_useHiResEGADithering)
+ if (_use16ColorMode || (_renderMode == Common::kRenderEGA && !_useHiResEGADithering))
encode8bit = false;
if (_bytesPerPixel == 2 && encode8bit) {
@@ -1650,6 +1675,16 @@ void Screen_EoB::loadSpecialAmigaCPS(const char *fileName, int destPage, bool is
convertAmigaGfx(_pagePtrs[destPage], 320, 200);
}
+void Screen_EoB::load16ColPalette(int palID, Palette &dest) {
+ if (!_palette16c[palID])
+ return;
+ loadPalette(_palette16c[palID], dest, 48);
+}
+
+void Screen_EoB::decodeBIN(const uint8 *src, uint8 *dst, uint32 dstSize) {
+
+}
+
void Screen_EoB::setupDualPalettesSplitScreen(Palette &top, Palette &bottom) {
// The original supports simultaneous fading of both palettes, but doesn't make any use of that
// feature. The fade rate is always set to 0. So I see no need to implement that.
diff --git a/engines/kyra/graphics/screen_eob.h b/engines/kyra/graphics/screen_eob.h
index 5df67df506..edc49e144a 100644
--- a/engines/kyra/graphics/screen_eob.h
+++ b/engines/kyra/graphics/screen_eob.h
@@ -93,6 +93,10 @@ public:
// Amiga specific
void loadSpecialAmigaCPS(const char *fileName, int destPage, bool isGraphics);
+ // PC-98 specific
+ void load16ColPalette(int palID, Palette &dest);
+ void decodeBIN(const uint8 *src, uint8 *dst, uint32 dstSize);
+
// This is a simple way of emulating the Amiga copper list palette magic for more than 32 colors.
// I use colors 32 to 63 for these extra colors (which the Amiga copper sends to the color
// registers on the fly at vertical beam position 120).
@@ -136,6 +140,11 @@ private:
uint8 *_egaDitheringTable;
uint8 *_egaDitheringTempPage;
+ // hard coded 16 color palettes for PC98 version of EOB1
+ const uint8 *_palette16c[10];
+
+ const char *_cpsFilePattern;
+
const uint16 _cursorColorKey16Bit;
static const uint8 _egaMatchTable[];
diff --git a/engines/kyra/module.mk b/engines/kyra/module.mk
index 6a288c5446..3f4bab622d 100644
--- a/engines/kyra/module.mk
+++ b/engines/kyra/module.mk
@@ -129,6 +129,7 @@ MODULE_OBJS += \
sequence/sequences_eob.o \
sequence/sequences_darkmoon.o \
sound/sound_amiga_eob.o \
+ sound/sound_pc98_eob.o \
sound/sound_towns_darkmoon.o \
sound/drivers/audiomaster2.o \
sound/drivers/mlalf98.o
diff --git a/engines/kyra/resource/staticres_eob.cpp b/engines/kyra/resource/staticres_eob.cpp
index 2e299670e1..a1585c1e91 100644
--- a/engines/kyra/resource/staticres_eob.cpp
+++ b/engines/kyra/resource/staticres_eob.cpp
@@ -500,9 +500,7 @@ void EoBCoreEngine::initStaticResource() {
data = _staticres->loadRawData(kEoB2PcmSoundEffectsFinale, temp2);
SoundResourceInfo_TownsEoB finale(files, temp, data, temp2, 40);
sndInfo_finale = &finale;
- } else if (_flags.platform == Common::kPlatformPC98) {
-
- } else {
+ } else if (_flags.platform != Common::kPlatformPC98) {
const char *const *files = _staticres->loadStrings(kEoBBaseSoundFilesIngame, temp);
SoundResourceInfo_PC ingame(files, temp);
sndInfo_ingame = &ingame;
@@ -1162,11 +1160,6 @@ void EoBEngine::initStaticResource() {
_cgaLevelMappingIndex = _staticres->loadRawData(kEoB1CgaLevelMappingIndex, temp);
for (int i = 0; i < 5; i++)
_cgaMappingLevel[i] = _staticres->loadRawData(kEoB1CgaMappingLevel0 + i, temp);
- const uint8 *pal16c = _staticres->loadRawData(kEoB1Palettes16c, temp);
- if (pal16c) {
- for (int i = 0; i < 10; i++)
- _palette16c[i] = pal16c + i * 48;
- }
_itemNamesPC98 = _staticres->loadStrings(kEoB1ItemNames, _numItemNamesPC98);
@@ -1213,16 +1206,41 @@ void EoBEngine::initStaticResource() {
p->dmgModifierEvade = *ps++;
}
+ if (_flags.platform == Common::kPlatformPC98) {
+ const char *const *files = _staticres->loadStrings(kEoBBaseSoundFilesIngame, temp);
+ SoundResourceInfo_PC ingame(files, temp);
+ _sound->initAudioResourceInfo(kMusicIngame, &ingame);
+ files = _staticres->loadStrings(kEoBBaseSoundFilesIntro, temp);
+ SoundResourceInfo_PC intro(files, temp);
+ _sound->initAudioResourceInfo(kMusicIntro, &intro);
+ files = _staticres->loadStrings(kEoBBaseSoundFilesFinale, temp);
+ SoundResourceInfo_PC finale(files, temp);
+ _sound->initAudioResourceInfo(kMusicFinale, &finale);
+ }
+
_monsterAcHitChanceTable1 = _monsterAcHitChanceTbl1;
_monsterAcHitChanceTable2 = _monsterAcHitChanceTbl2;
- static const char *const errorSlotNoNameString[3] = {
+ static const char *const errorSlotNoNameString[4] = {
" You must specify\r a name for your\r save game!",
" Spielstaende mues-\r sen einen Namen\r haben!",
+ "",
0
};
- _errorSlotNoNameString = errorSlotNoNameString[(_flags.lang == Common::EN_ANY) ? 0 : ((_flags.lang == Common::DE_DEU) ? 1 : 2)];
+ switch (_flags.lang) {
+ case Common::EN_ANY:
+ _errorSlotNoNameString = errorSlotNoNameString[0];
+ break;
+ case Common::DE_DEU:
+ _errorSlotNoNameString = errorSlotNoNameString[1];
+ break;
+ case Common::JA_JPN:
+ _errorSlotNoNameString = errorSlotNoNameString[2];
+ break;
+ default:
+ _errorSlotNoNameString = errorSlotNoNameString[ARRAYSIZE(errorSlotNoNameString) - 1];
+ }
}
void EoBEngine::initSpells() {
diff --git a/engines/kyra/sequence/sequences_eob.cpp b/engines/kyra/sequence/sequences_eob.cpp
index 200a5da925..e091530807 100644
--- a/engines/kyra/sequence/sequences_eob.cpp
+++ b/engines/kyra/sequence/sequences_eob.cpp
@@ -38,7 +38,13 @@ public:
EoBIntroPlayer(EoBEngine *vm, Screen_EoB *screen);
~EoBIntroPlayer() {}
- void start();
+ enum IntroPart {
+ kOnlyCredits = 0,
+ kOnlyIntro,
+ kCreditsAndIntro,
+ };
+
+ void start(int part);
private:
void openingCredits();
@@ -50,7 +56,7 @@ private:
void waterdeepExit();
void tunnel();
- void loadAndSetPalette(const char *filename);
+ void loadAndSetPalette(const char *dosPaletteFile, int pc98PaletteID = 0);
void copyBlurRegion(int x1, int y1, int x2, int y2, int w, int h, int step);
void whirlTransition();
@@ -143,17 +149,23 @@ EoBIntroPlayer::EoBIntroPlayer(EoBEngine *vm, Screen_EoB *screen) : _vm(vm), _sc
_screen->loadPalette(orbFadePal, _screen->getPalette(2), temp);
}
-void EoBIntroPlayer::start() {
+void EoBIntroPlayer::start(int part) {
_vm->_allowSkip = true;
- openingCredits();
-
- if (!_vm->shouldQuit() && !_vm->skipFlag()) {
- _vm->snd_playSong(2);
- _screen->loadBitmap(_vm->gameFlags().platform == Common::kPlatformAmiga ? "TITLE.CPS" : (_vm->_configRenderMode == Common::kRenderCGA || _vm->_configRenderMode == Common::kRenderEGA) ? "TITLE-E.CMP" : "TITLE-V.CMP", 3, 5, 0);
- _screen->convertPage(5, 2, _vm->_cgaMappingDefault);
- uint32 del = 120 * _vm->_tickLength;
- _screen->crossFadeRegion(0, 0, 0, 0, 320, 200, 2, 0);
- _vm->delay(del);
+
+ if (part != kOnlyIntro) {
+ openingCredits();
+
+ if (part == kOnlyCredits)
+ return;
+
+ if (!_vm->shouldQuit() && !_vm->skipFlag()) {
+ _vm->snd_playSong(2);
+ _screen->loadBitmap(_vm->gameFlags().platform == Common::kPlatformAmiga ? "TITLE.CPS" : (_vm->_configRenderMode == Common::kRenderCGA || _vm->_configRenderMode == Common::kRenderEGA) ? "TITLE-E.CMP" : "TITLE-V.CMP", 3, 5, 0);
+ _screen->convertPage(5, 2, _vm->_cgaMappingDefault);
+ uint32 del = 120 * _vm->_tickLength;
+ _screen->crossFadeRegion(0, 0, 0, 0, 320, 200, 2, 0);
+ _vm->delay(del);
+ }
}
Common::SeekableReadStream *s = _vm->resource()->createReadStream("TEXT.RAW");
@@ -162,10 +174,13 @@ void EoBIntroPlayer::start() {
_screen->loadFileDataToPage(s, 5, s->size() - 768);
delete s;
} else {
- _screen->loadBitmap(_vm->gameFlags().platform == Common::kPlatformAmiga ? "TEXT.CPS" : "TEXT.CMP", 3, 5, 0);
+ _screen->loadBitmap(_vm->gameFlags().platform == Common::kPlatformAmiga ? "TEXT.CPS" : (_vm->gameFlags().platform == Common::kPlatformPC98 ? "TEXT.BIN" : "TEXT.CMP"), 3, 5, 0);
}
_screen->convertPage(5, 6, _vm->_cgaMappingAlt);
+ if (part == kOnlyIntro)
+ _vm->snd_playSong(1);
+
tower();
orb();
waterdeepEntry();
@@ -180,7 +195,8 @@ void EoBIntroPlayer::start() {
}
void EoBIntroPlayer::openingCredits() {
- _vm->snd_playSong(1);
+ if (_vm->gameFlags().platform != Common::kPlatformPC98)
+ _vm->snd_playSong(1);
_screen->loadBitmap(_filesOpening[4], 5, 3, 0);
_screen->convertPage(3, 0, _vm->_cgaMappingAlt);
@@ -188,7 +204,7 @@ void EoBIntroPlayer::openingCredits() {
if (_vm->gameFlags().platform == Common::kPlatformAmiga) {
_screen->fadeFromBlack(64);
} else {
- loadAndSetPalette(_filesOpening[5]);
+ loadAndSetPalette(_filesOpening[5], 1);
_screen->updateScreen();
}
@@ -912,12 +928,14 @@ void EoBIntroPlayer::tunnel() {
_vm->delay(50 * _vm->_tickLength);
}
-void EoBIntroPlayer::loadAndSetPalette(const char *filename) {
+void EoBIntroPlayer::loadAndSetPalette(const char *dosPaletteFile, int pc98PaletteID) {
if (_vm->_configRenderMode == Common::kRenderCGA || _vm->_configRenderMode == Common::kRenderEGA)
return;
- if (_vm->gameFlags().platform != Common::kPlatformAmiga)
- _screen->loadPalette(filename, _screen->getPalette(0));
+ if (_vm->gameFlags().platform == Common::kPlatformDOS)
+ _screen->loadPalette(dosPaletteFile, _screen->getPalette(0));
+ else if (_vm->gameFlags().platform == Common::kPlatformPC98)
+ _screen->load16ColPalette(pc98PaletteID, _screen->getPalette(0));
_screen->getPalette(0).fill(0, 1, 0);
_screen->setScreenPalette(_screen->getPalette(0));
@@ -1462,6 +1480,18 @@ int EoBEngine::mainMenu() {
case 2:
// create new party
+ if (_flags.platform == Common::kPlatformPC98) {
+ _sound->selectAudioResourceSet(kMusicIntro);
+ _sound->loadSoundFile(0);
+ _screen->hideMouse();
+
+ seq_playIntro(kOnlyIntro);
+
+ _screen->showMouse();
+ _sound->selectAudioResourceSet(kMusicIngame);
+ _sound->loadSoundFile(0);
+ }
+
menuChoice = -2;
break;
@@ -1476,7 +1506,7 @@ int EoBEngine::mainMenu() {
_sound->loadSoundFile(0);
_screen->hideMouse();
- seq_playIntro();
+ seq_playIntro(_flags.platform == Common::kPlatformPC98 ? kOnlyCredits : kCreditsAndIntro);
_screen->showMouse();
_sound->selectAudioResourceSet(kMusicIngame);
@@ -1506,8 +1536,8 @@ int EoBEngine::mainMenuLoop() {
return sel + 1;
}
-void EoBEngine::seq_playIntro() {
- EoBIntroPlayer(this, _screen).start();
+void EoBEngine::seq_playIntro(int part) {
+ EoBIntroPlayer(this, _screen).start((EoBIntroPlayer::IntroPart)part);
}
void EoBEngine::seq_playFinale() {
diff --git a/engines/kyra/sound/sound_intern.h b/engines/kyra/sound/sound_intern.h
index 29572f6fe2..44f7adbfe2 100644
--- a/engines/kyra/sound/sound_intern.h
+++ b/engines/kyra/sound/sound_intern.h
@@ -443,6 +443,37 @@ private:
bool _ready;
};
+class MLALF98;
+class SoundPC98_EoB : public Sound {
+public:
+ SoundPC98_EoB(KyraEngine_v1 *vm, Audio::Mixer *mixer);
+ virtual ~SoundPC98_EoB();
+
+ kType getMusicType() const;
+
+ bool init();
+ void initAudioResourceInfo(int set, void *info);
+ void selectAudioResourceSet(int set);
+ bool hasSoundFile(uint file) const { return false; }
+ void loadSoundFile(uint file);
+ void loadSoundFile(Common::String file) {}
+ void loadSfxFile(Common::String file);
+ void playTrack(uint8 track);
+ void haltTrack();
+ void playSoundEffect(uint8 track, uint8);
+ void beginFadeOut() {}
+ void updateVolumeSettings();
+
+private:
+ KyraEngine_v1 *_vm;
+ MLALF98 *_driver;
+
+ SoundResourceInfo_PC *_resInfo[3];
+ int _currentResourceSet;
+
+ bool _ready;
+};
+
#endif
} // End of namespace Kyra
diff --git a/engines/kyra/sound/sound_pc98_eob.cpp b/engines/kyra/sound/sound_pc98_eob.cpp
new file mode 100644
index 0000000000..13b7214d74
--- /dev/null
+++ b/engines/kyra/sound/sound_pc98_eob.cpp
@@ -0,0 +1,126 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifdef ENABLE_EOB
+
+#include "kyra/sound/sound_intern.h"
+#include "kyra/resource/resource.h"
+#include "kyra/sound/drivers/mlalf98.h"
+
+#include "common/config-manager.h"
+
+namespace Kyra {
+
+SoundPC98_EoB::SoundPC98_EoB(KyraEngine_v1 *vm, Audio::Mixer *mixer) : Sound(vm, mixer),
+ _vm(vm), _driver(0), _currentResourceSet(-1), _ready(false) {
+ memset(_resInfo, 0, sizeof(_resInfo));
+}
+
+SoundPC98_EoB::~SoundPC98_EoB() {
+ delete _driver;
+
+ for (int i = 0; i < 3; i++)
+ initAudioResourceInfo(i, 0);
+}
+
+Sound::kType SoundPC98_EoB::getMusicType() const {
+ return kPC98;
+}
+
+bool SoundPC98_EoB::init() {
+ _driver = new MLALF98(_mixer, MLALF98::kType9801_86);
+ _ready = true;
+ return true;
+}
+
+void SoundPC98_EoB::initAudioResourceInfo(int set, void *info) {
+ delete _resInfo[set];
+ _resInfo[set] = info ? new SoundResourceInfo_PC(*(SoundResourceInfo_PC*)info) : 0;
+}
+
+void SoundPC98_EoB::selectAudioResourceSet(int set) {
+ if (set == _currentResourceSet || !_ready)
+ return;
+
+ if (!_resInfo[set])
+ return;
+
+ _currentResourceSet = set;
+}
+
+void SoundPC98_EoB::loadSoundFile(uint file) {
+ if (!_ready)
+ return;
+
+ if (file >= _resInfo[_currentResourceSet]->fileListSize)
+ return;
+
+ Common::SeekableReadStream *s = _vm->resource()->createReadStream(_resInfo[_currentResourceSet]->fileList[file]);
+ _driver->loadMusicData(s);
+ delete s;
+}
+
+void SoundPC98_EoB::loadSfxFile(Common::String file) {
+ if (!_ready)
+ return;
+
+ Common::SeekableReadStream *s = _vm->resource()->createReadStream(file);
+ _driver->loadSoundEffectData(s);
+ delete s;
+}
+
+void SoundPC98_EoB::playTrack(uint8 track) {
+ if (!_musicEnabled || !_ready)
+ return;
+
+ _driver->allChannelsOff();
+ loadSoundFile(track);
+ _driver->startMusic(0);
+}
+
+void SoundPC98_EoB::haltTrack() {
+ if (!_musicEnabled || !_ready)
+ return;
+ playTrack(0);
+}
+
+void SoundPC98_EoB::playSoundEffect(uint8 track, uint8) {
+ if (_currentResourceSet != kMusicIngame || !_sfxEnabled || !_ready || track >= 120)
+ return;
+ _driver->startSoundEffect(track);
+}
+
+void SoundPC98_EoB::updateVolumeSettings() {
+ if (!_driver || !_ready)
+ return;
+
+ bool mute = false;
+ if (ConfMan.hasKey("mute"))
+ mute = ConfMan.getBool("mute");
+
+ _driver->setMusicVolume((mute ? 0 : ConfMan.getInt("music_volume")));
+ _driver->setSoundEffectVolume((mute ? 0 : ConfMan.getInt("sfx_volume")));
+}
+
+} // End of namespace Kyra
+
+#endif