CINE: Add support for CD music in the CD version of Future Wars.
This commit is contained in:
parent
703d1d7142
commit
8c5e6d2be4
7 changed files with 116 additions and 2 deletions
3
NEWS
3
NEWS
|
@ -35,6 +35,9 @@ For a more comprehensive changelog of the latest experimental code, see:
|
||||||
head scene (bug #6728). It may have been happening in other scenes as
|
head scene (bug #6728). It may have been happening in other scenes as
|
||||||
well.
|
well.
|
||||||
|
|
||||||
|
CinE:
|
||||||
|
- Added support for music in CD version of Future Wars.
|
||||||
|
|
||||||
MADE:
|
MADE:
|
||||||
- Improved AdLib music support in Return to Zork.
|
- Improved AdLib music support in Return to Zork.
|
||||||
|
|
||||||
|
|
|
@ -92,6 +92,9 @@ Common::Error CineEngine::run() {
|
||||||
// Initialize backend
|
// Initialize backend
|
||||||
initGraphics(320, 200, false);
|
initGraphics(320, 200, false);
|
||||||
|
|
||||||
|
if (g_cine->getGameType() == GType_FW && (g_cine->getFeatures() & GF_CD))
|
||||||
|
checkCD();
|
||||||
|
|
||||||
if (getPlatform() == Common::kPlatformDOS) {
|
if (getPlatform() == Common::kPlatformDOS) {
|
||||||
g_sound = new PCSound(_mixer, this);
|
g_sound = new PCSound(_mixer, this);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -31,6 +31,8 @@
|
||||||
#include "cine/bg_list.h"
|
#include "cine/bg_list.h"
|
||||||
#include "cine/sound.h"
|
#include "cine/sound.h"
|
||||||
|
|
||||||
|
#include "backends/audiocd/audiocd.h"
|
||||||
|
|
||||||
namespace Cine {
|
namespace Cine {
|
||||||
|
|
||||||
struct MouseStatusStruct {
|
struct MouseStatusStruct {
|
||||||
|
@ -219,6 +221,8 @@ void manageEvents() {
|
||||||
|
|
||||||
mouseData.left = mouseLeft;
|
mouseData.left = mouseLeft;
|
||||||
mouseData.right = mouseRight;
|
mouseData.right = mouseRight;
|
||||||
|
|
||||||
|
g_system->getAudioCDManager()->updateCD();
|
||||||
}
|
}
|
||||||
|
|
||||||
void getMouseData(uint16 param, uint16 *pButton, uint16 *pX, uint16 *pY) {
|
void getMouseData(uint16 param, uint16 *pButton, uint16 *pX, uint16 *pY) {
|
||||||
|
|
|
@ -543,6 +543,15 @@ bool CineEngine::loadTempSaveOS(Common::SeekableReadStream &in) {
|
||||||
loadRel(currentRelName);
|
loadRel(currentRelName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reset background music in CD version of Future Wars
|
||||||
|
if (getGameType() == GType_FW && (getFeatures() & GF_CD)) {
|
||||||
|
if (strlen(bgNames[0])) {
|
||||||
|
char buffer[20];
|
||||||
|
removeExtention(buffer, bgNames[0]);
|
||||||
|
g_sound->setBgMusic(atoi(buffer + 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Load first background (Uses loadBg)
|
// Load first background (Uses loadBg)
|
||||||
if (strlen(bgNames[0])) {
|
if (strlen(bgNames[0])) {
|
||||||
loadBg(bgNames[0]);
|
loadBg(bgNames[0]);
|
||||||
|
|
|
@ -1380,6 +1380,12 @@ int FWScript::o1_loadBg() {
|
||||||
|
|
||||||
debugC(5, kCineDebugScript, "Line: %d: loadBg(\"%s\")", _line, param);
|
debugC(5, kCineDebugScript, "Line: %d: loadBg(\"%s\")", _line, param);
|
||||||
|
|
||||||
|
if (g_cine->getGameType() == GType_FW && (g_cine->getFeatures() & GF_CD)) {
|
||||||
|
char buffer[20];
|
||||||
|
removeExtention(buffer, param);
|
||||||
|
g_sound->setBgMusic(atoi(buffer + 1));
|
||||||
|
}
|
||||||
|
|
||||||
loadBg(param);
|
loadBg(param);
|
||||||
g_cine->_bgIncrustList.clear();
|
g_cine->_bgIncrustList.clear();
|
||||||
bgVar0 = 0;
|
bgVar0 = 0;
|
||||||
|
|
|
@ -32,6 +32,8 @@
|
||||||
#include "cine/cine.h"
|
#include "cine/cine.h"
|
||||||
#include "cine/sound.h"
|
#include "cine/sound.h"
|
||||||
|
|
||||||
|
#include "backends/audiocd/audiocd.h"
|
||||||
|
|
||||||
#include "audio/audiostream.h"
|
#include "audio/audiostream.h"
|
||||||
#include "audio/fmopl.h"
|
#include "audio/fmopl.h"
|
||||||
#include "audio/mididrv.h"
|
#include "audio/mididrv.h"
|
||||||
|
@ -907,6 +909,10 @@ void PCSoundFxPlayer::unload() {
|
||||||
PCSound::PCSound(Audio::Mixer *mixer, CineEngine *vm)
|
PCSound::PCSound(Audio::Mixer *mixer, CineEngine *vm)
|
||||||
: Sound(mixer, vm), _soundDriver(0) {
|
: Sound(mixer, vm), _soundDriver(0) {
|
||||||
|
|
||||||
|
_currentMusic = 0;
|
||||||
|
_currentMusicStatus = 0;
|
||||||
|
_currentBgSlot = 0;
|
||||||
|
|
||||||
const MidiDriver::DeviceHandle dev = MidiDriver::detectDevice(MDT_MIDI | MDT_ADLIB);
|
const MidiDriver::DeviceHandle dev = MidiDriver::detectDevice(MDT_MIDI | MDT_ADLIB);
|
||||||
const MusicType musicType = MidiDriver::getMusicType(dev);
|
const MusicType musicType = MidiDriver::getMusicType(dev);
|
||||||
if (musicType == MT_MT32 || musicType == MT_GM) {
|
if (musicType == MT_MT32 || musicType == MT_GM) {
|
||||||
|
@ -940,23 +946,98 @@ PCSound::~PCSound() {
|
||||||
delete _soundDriver;
|
delete _soundDriver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *const musicFileNames[12] = {
|
||||||
|
"DUGGER.DAT",
|
||||||
|
"SUITE21.DAT",
|
||||||
|
"FWARS.DAT",
|
||||||
|
"SUITE23.DAT",
|
||||||
|
"SUITE22.DAT",
|
||||||
|
"ESCAL",
|
||||||
|
"MOINES.DAT",
|
||||||
|
"MEDIAVAL.DAT",
|
||||||
|
"SFUTUR",
|
||||||
|
"ALIENS",
|
||||||
|
"TELESONG.DAT",
|
||||||
|
};
|
||||||
|
|
||||||
|
static uint8 musicCDTracks[12] = {
|
||||||
|
20, 21, 22, 23, 24, 25, 26, 27, 28, 30, 22,
|
||||||
|
};
|
||||||
|
|
||||||
void PCSound::loadMusic(const char *name) {
|
void PCSound::loadMusic(const char *name) {
|
||||||
debugC(5, kCineDebugSound, "PCSound::loadMusic('%s')", name);
|
debugC(5, kCineDebugSound, "PCSound::loadMusic('%s')", name);
|
||||||
_player->load(name);
|
if (_vm->getGameType() == GType_FW && (_vm->getFeatures() & GF_CD)) {
|
||||||
|
_currentMusic = 0;
|
||||||
|
_currentMusicStatus = 0;
|
||||||
|
for (int i = 0; i < 11; i++) {
|
||||||
|
if (!strcmp((const char *)name, musicFileNames[i])) {
|
||||||
|
_currentMusic = musicCDTracks[i];
|
||||||
|
_currentMusicStatus = musicCDTracks[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
_player->load(name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PCSound::playMusic() {
|
void PCSound::playMusic() {
|
||||||
debugC(5, kCineDebugSound, "PCSound::playMusic()");
|
debugC(5, kCineDebugSound, "PCSound::playMusic()");
|
||||||
_player->play();
|
if (_vm->getGameType() == GType_FW && (_vm->getFeatures() & GF_CD)) {
|
||||||
|
g_system->getAudioCDManager()->stop();
|
||||||
|
g_system->getAudioCDManager()->play(_currentMusic - 1, -1, 0, 0);
|
||||||
|
} else {
|
||||||
|
_player->play();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint8 bgCDTracks[49] = {
|
||||||
|
0, 21, 21, 23, 0, 29, 0, 0, 0, 0,
|
||||||
|
0, 27, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 22, 22, 23, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||||
|
};
|
||||||
|
|
||||||
|
void PCSound::setBgMusic(int num) {
|
||||||
|
debugC(5, kCineDebugSound, "PCSound::setBgMusic(%d)", num);
|
||||||
|
_currentBgSlot = num;
|
||||||
|
if (!bgCDTracks[_currentBgSlot])
|
||||||
|
return;
|
||||||
|
|
||||||
|
if ((_currentBgSlot == 1) || (_currentMusicStatus == 0 && _currentMusic != bgCDTracks[_currentBgSlot])) {
|
||||||
|
_currentMusic = bgCDTracks[_currentBgSlot];
|
||||||
|
g_system->getAudioCDManager()->stop();
|
||||||
|
g_system->getAudioCDManager()->play(bgCDTracks[_currentBgSlot] - 1, -1, 0, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PCSound::stopMusic() {
|
void PCSound::stopMusic() {
|
||||||
debugC(5, kCineDebugSound, "PCSound::stopMusic()");
|
debugC(5, kCineDebugSound, "PCSound::stopMusic()");
|
||||||
|
|
||||||
|
if (_vm->getGameType() == GType_FW && (_vm->getFeatures() & GF_CD)) {
|
||||||
|
if (_currentBgSlot != 1)
|
||||||
|
g_system->getAudioCDManager()->stop();
|
||||||
|
}
|
||||||
_player->stop();
|
_player->stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PCSound::fadeOutMusic() {
|
void PCSound::fadeOutMusic() {
|
||||||
debugC(5, kCineDebugSound, "PCSound::fadeOutMusic()");
|
debugC(5, kCineDebugSound, "PCSound::fadeOutMusic()");
|
||||||
|
|
||||||
|
if (_vm->getGameType() == GType_FW && (_vm->getFeatures() & GF_CD)) {
|
||||||
|
if (_currentMusicStatus) {
|
||||||
|
if (_currentBgSlot == 1) {
|
||||||
|
_currentMusicStatus = 0;
|
||||||
|
} else {
|
||||||
|
_currentMusic = 0;
|
||||||
|
_currentMusicStatus = 0;
|
||||||
|
g_system->getAudioCDManager()->stop();
|
||||||
|
if (bgCDTracks[_currentBgSlot]) {
|
||||||
|
g_system->getAudioCDManager()->play(_currentBgSlot - 1, -1, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
_player->fadeOut();
|
_player->fadeOut();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1056,6 +1137,9 @@ void PaulaSound::stopMusic() {
|
||||||
_mixer->stopHandle(_moduleHandle);
|
_mixer->stopHandle(_moduleHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PaulaSound::setBgMusic(int num) {
|
||||||
|
}
|
||||||
|
|
||||||
void PaulaSound::fadeOutMusic() {
|
void PaulaSound::fadeOutMusic() {
|
||||||
debugC(5, kCineDebugSound, "PaulaSound::fadeOutMusic()");
|
debugC(5, kCineDebugSound, "PaulaSound::fadeOutMusic()");
|
||||||
Common::StackLock lock(_musicMutex);
|
Common::StackLock lock(_musicMutex);
|
||||||
|
|
|
@ -48,6 +48,7 @@ public:
|
||||||
|
|
||||||
virtual void playSound(int channel, int frequency, const uint8 *data, int size, int volumeStep, int stepCount, int volume, int repeat) = 0;
|
virtual void playSound(int channel, int frequency, const uint8 *data, int size, int volumeStep, int stepCount, int volume, int repeat) = 0;
|
||||||
virtual void stopSound(int channel) = 0;
|
virtual void stopSound(int channel) = 0;
|
||||||
|
virtual void setBgMusic(int num) = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
@ -71,11 +72,14 @@ public:
|
||||||
|
|
||||||
virtual void playSound(int channel, int frequency, const uint8 *data, int size, int volumeStep, int stepCount, int volume, int repeat);
|
virtual void playSound(int channel, int frequency, const uint8 *data, int size, int volumeStep, int stepCount, int volume, int repeat);
|
||||||
virtual void stopSound(int channel);
|
virtual void stopSound(int channel);
|
||||||
|
virtual void setBgMusic(int num);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
PCSoundDriver *_soundDriver;
|
PCSoundDriver *_soundDriver;
|
||||||
PCSoundFxPlayer *_player;
|
PCSoundFxPlayer *_player;
|
||||||
|
|
||||||
|
uint8 _currentMusic, _currentMusicStatus, _currentBgSlot;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PaulaSound : public Sound {
|
class PaulaSound : public Sound {
|
||||||
|
@ -91,6 +95,7 @@ public:
|
||||||
|
|
||||||
virtual void playSound(int channel, int frequency, const uint8 *data, int size, int volumeStep, int stepCount, int volume, int repeat);
|
virtual void playSound(int channel, int frequency, const uint8 *data, int size, int volumeStep, int stepCount, int volume, int repeat);
|
||||||
virtual void stopSound(int channel);
|
virtual void stopSound(int channel);
|
||||||
|
virtual void setBgMusic(int num);
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
PAULA_FREQ = 3579545,
|
PAULA_FREQ = 3579545,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue