diff options
author | Gregory Montoir | 2007-12-09 13:41:59 +0000 |
---|---|---|
committer | Gregory Montoir | 2007-12-09 13:41:59 +0000 |
commit | a94fada0ae13b04d54684d470d5b86ab68a2df55 (patch) | |
tree | 01104370b7ad09b69bf2adaf281b25433ab60444 /engines/cine | |
parent | 65b11e7a34e1fbdd15e4cd69b13616517aefa20a (diff) | |
download | scummvm-rg350-a94fada0ae13b04d54684d470d5b86ab68a2df55.tar.gz scummvm-rg350-a94fada0ae13b04d54684d470d5b86ab68a2df55.tar.bz2 scummvm-rg350-a94fada0ae13b04d54684d470d5b86ab68a2df55.zip |
- minor screen fix for OS
- added new debug channel for sound
- updated 2 opcodes comments
svn-id: r29790
Diffstat (limited to 'engines/cine')
-rw-r--r-- | engines/cine/bg.cpp | 4 | ||||
-rw-r--r-- | engines/cine/cine.cpp | 2 | ||||
-rw-r--r-- | engines/cine/cine.h | 3 | ||||
-rw-r--r-- | engines/cine/gfx.cpp | 4 | ||||
-rw-r--r-- | engines/cine/main_loop.cpp | 2 | ||||
-rw-r--r-- | engines/cine/script.cpp | 16 | ||||
-rw-r--r-- | engines/cine/sound.cpp | 48 | ||||
-rw-r--r-- | engines/cine/sound.h | 12 | ||||
-rw-r--r-- | engines/cine/various.cpp | 4 | ||||
-rw-r--r-- | engines/cine/various.h | 2 |
10 files changed, 45 insertions, 52 deletions
diff --git a/engines/cine/bg.cpp b/engines/cine/bg.cpp index 4f7267eb51..c2ccf4c687 100644 --- a/engines/cine/bg.cpp +++ b/engines/cine/bg.cpp @@ -104,7 +104,9 @@ byte loadBg(const char *bgName) { ptr += 2; } - loadRelatedPalette(bgName); + if (g_cine->getGameType() == Cine::GType_FW) { + loadRelatedPalette(bgName); + } gfxResetRawPage(page2Raw); gfxConvertSpriteToRaw(page2Raw, ptr, 160, 200); diff --git a/engines/cine/cine.cpp b/engines/cine/cine.cpp index 35022ec378..a10c0328ef 100644 --- a/engines/cine/cine.cpp +++ b/engines/cine/cine.cpp @@ -53,6 +53,7 @@ CineEngine *g_cine; CineEngine::CineEngine(OSystem *syst, const CINEGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) { Common::addSpecialDebugLevel(kCineDebugScript, "Script", "Script debug level"); Common::addSpecialDebugLevel(kCineDebugPart, "Part", "Part debug level"); + Common::addSpecialDebugLevel(kCineDebugSound, "Sound", "Sound debug level"); // Setup mixer if (!_mixer->isReady()) { @@ -72,6 +73,7 @@ CineEngine::~CineEngine() { freePoldatDat(); freeErrmessDat(); } + Common::clearAllSpecialDebugLevels(); } int CineEngine::init() { diff --git a/engines/cine/cine.h b/engines/cine/cine.h index 8d9fdb6f8e..7ce5231446 100644 --- a/engines/cine/cine.h +++ b/engines/cine/cine.h @@ -126,7 +126,8 @@ enum { enum { kCineDebugScript = 1 << 0, - kCineDebugPart = 1 << 1 + kCineDebugPart = 1 << 1, + kCineDebugSound = 1 << 2 }; enum { diff --git a/engines/cine/gfx.cpp b/engines/cine/gfx.cpp index a7281e8591..a225436fb8 100644 --- a/engines/cine/gfx.cpp +++ b/engines/cine/gfx.cpp @@ -474,6 +474,10 @@ void blitRawScreen(byte *frontBuffer) { void flip(void) { blitRawScreen(page1Raw); + if (fadeRequired) { + memcpy(c_palette, tempPalette, sizeof(uint16) * 16); + fadeRequired = false; + } } } // End of namespace Cine diff --git a/engines/cine/main_loop.cpp b/engines/cine/main_loop.cpp index 8f322c00c2..ad65cb4072 100644 --- a/engines/cine/main_loop.cpp +++ b/engines/cine/main_loop.cpp @@ -214,7 +214,7 @@ void CineEngine::mainLoop(int bootScriptIdx) { allowPlayerInput = 0; checkForPendingDataLoadSwitch = 0; - fadeRequired = 0; + fadeRequired = false; isDrawCommandEnabled = 0; waitForPlayerClick = 0; menuCommandLen = 0; diff --git a/engines/cine/script.cpp b/engines/cine/script.cpp index 813eb0c376..3b9437bd78 100644 --- a/engines/cine/script.cpp +++ b/engines/cine/script.cpp @@ -292,7 +292,7 @@ void setupOpcodes() { { 0, 0 }, { o2_loadPart, "s" }, /* 40 */ - { 0, 0 }, + { 0, 0 }, /* o1_closePart, triggered by some scripts (STARTA.PRC 4 for ex.) */ { o1_loadNewPrcName, "bs" }, { o1_requestCheckPendingDataLoad, "" }, { 0, 0 }, @@ -1306,11 +1306,9 @@ void o1_blitAndFade() { debugC(5, kCineDebugScript, "Line: %d: request fadein", _currentLine); // TODO: use real code - memcpy(c_palette, tempPalette, sizeof(uint16) * 16); drawOverlays(); + fadeRequired = true; flip(); - - fadeRequired = 1; } void o1_fadeToBlack() { @@ -1595,6 +1593,9 @@ void o1_playSample() { if (volume < 50) { volume = 50; } + if (g_cine->getGameType() == Cine::GType_OS && size == 0) { + return; + } g_sound->stopMusic(); if (size == 0xFFFF) { g_sound->playSound(channel, 0, animDataTable[anim].ptr1, 0, 0, 0, volume, 0); @@ -1662,8 +1663,10 @@ void o2_playSampleAlt() { } if (animDataTable[num].ptr1) { if (g_cine->getPlatform() == Common::kPlatformPC) { - // if speaker output is enabled, play sound on it + // if speaker output is available, play sound on it // if it's another device, don't play anything + // TODO: implement this, it's used in the introduction for example + // on each letter displayed } else { g_sound->playSound(channel, frequency, animDataTable[num].ptr1, size, 0, 0, 63, 0); } @@ -1869,9 +1872,10 @@ void o2_loadBg() { if (additionalBgTable[param]) { currentAdditionalBgIdx = param; - //if (adBgVar0 == 0) { + //if (_screenNeedFadeOut == 0) { // adBgVar1 = 1; //} + fadeRequired = true; } } diff --git a/engines/cine/sound.cpp b/engines/cine/sound.cpp index 1c7c6ff4f1..e94e9cb1e1 100644 --- a/engines/cine/sound.cpp +++ b/engines/cine/sound.cpp @@ -744,32 +744,37 @@ PCSound::~PCSound() { } void PCSound::loadMusic(const char *name) { + debugC(5, kCineDebugSound, "PCSound::loadMusic('%s')", name); _player->load(name); } void PCSound::playMusic() { + debugC(5, kCineDebugSound, "PCSound::playMusic()"); _player->play(); } void PCSound::stopMusic() { + debugC(5, kCineDebugSound, "PCSound::stopMusic()"); _player->stop(); } void PCSound::fadeOutMusic() { + debugC(5, kCineDebugSound, "PCSound::fadeOutMusic()"); _player->fadeOut(); } void PCSound::playSound(int channel, int frequency, const uint8 *data, int size, int volumeStep, int stepCount, int volume, int repeat) { + debugC(5, kCineDebugSound, "PCSound::playSound() channel %d size %d", channel, size); _soundDriver->playSample(data, size, channel, volume); } void PCSound::stopSound(int channel) { + debugC(5, kCineDebugSound, "PCSound::stopSound() channel %d", channel); _soundDriver->resetChannel(channel); } PaulaSound::PaulaSound(Audio::Mixer *mixer, CineEngine *vm) : Sound(mixer, vm) { - memset(_soundChannelsTable, 0, sizeof(_soundChannelsTable)); _moduleStream = 0; } @@ -781,6 +786,7 @@ PaulaSound::~PaulaSound() { } void PaulaSound::loadMusic(const char *name) { + debugC(5, kCineDebugSound, "PaulaSound::loadMusic('%s')", name); if (_vm->getGameType() == GType_FW) { // look for separate files Common::File f; @@ -800,6 +806,7 @@ void PaulaSound::loadMusic(const char *name) { } void PaulaSound::playMusic() { + debugC(5, kCineDebugSound, "PaulaSound::playMusic()"); _mixer->stopHandle(_moduleHandle); if (_moduleStream) { _mixer->playInputStream(Audio::Mixer::kMusicSoundType, &_moduleHandle, _moduleStream); @@ -807,60 +814,45 @@ void PaulaSound::playMusic() { } void PaulaSound::stopMusic() { + debugC(5, kCineDebugSound, "PaulaSound::stopMusic()"); _mixer->stopHandle(_moduleHandle); } void PaulaSound::fadeOutMusic() { + debugC(5, kCineDebugSound, "PaulaSound::fadeOutMusic()"); // TODO stopMusic(); } void PaulaSound::playSound(int channel, int frequency, const uint8 *data, int size, int volumeStep, int stepCount, int volume, int repeat) { + // TODO: handle volume slides and repeat + debugC(5, kCineDebugSound, "PaulaSound::playSound() channel %d size %d", channel, size); stopSound(channel); - SoundChannel *ch = &_soundChannelsTable[channel]; size = MIN<int>(size - SPL_HDR_SIZE, READ_BE_UINT16(data + 4)); + // TODO: consider skipping the header in loadSpl directly if (size > 0) { - ch->data = (byte *)malloc(size); - if (ch->data) { - memcpy(ch->data, data + SPL_HDR_SIZE, size); - ch->frequency = frequency; - ch->size = size; - ch->volumeStep = volumeStep; - ch->stepCount = stepCount; - ch->step = stepCount; - ch->repeat = repeat != 0; - ch->volume = volume; + byte *sound = (byte *)malloc(size); + if (sound) { + memcpy(sound, data + SPL_HDR_SIZE, size); + playSoundChannel(channel, frequency, sound, size, volume); } } } void PaulaSound::stopSound(int channel) { + debugC(5, kCineDebugSound, "PaulaSound::stopSound() channel %d", channel); _mixer->stopHandle(_channelsTable[channel]); - free(_soundChannelsTable[channel].data); - _soundChannelsTable[channel].data = 0; } void PaulaSound::update() { // process volume slides and start sound playback - for (int i = 0; i < NUM_CHANNELS; ++i) { - SoundChannel *ch = &_soundChannelsTable[i]; - if (ch->data) { - if (ch->step) { - --ch->step; - continue; - } - ch->step = ch->stepCount; - ch->volume = CLIP(ch->volume + ch->volumeStep, 0, 63); - playSoundChannel(i, ch->frequency, ch->data, ch->size, ch->volume); - ch->data = 0; - } - } + // TODO } void PaulaSound::playSoundChannel(int channel, int frequency, uint8 *data, int size, int volume) { assert(frequency > 0); frequency = PAULA_FREQ / frequency; - _mixer->playRaw(Audio::Mixer::kSFXSoundType, &_channelsTable[channel], data, size, frequency, 0); + _mixer->playRaw(Audio::Mixer::kSFXSoundType, &_channelsTable[channel], data, size, frequency, Audio::Mixer::FLAG_AUTOFREE); _mixer->setChannelVolume(_channelsTable[channel], volume * Audio::Mixer::kMaxChannelVolume / 63); } diff --git a/engines/cine/sound.h b/engines/cine/sound.h index 81fe13112d..6982468035 100644 --- a/engines/cine/sound.h +++ b/engines/cine/sound.h @@ -102,23 +102,11 @@ public: SPL_HDR_SIZE = 22 }; - struct SoundChannel { - int frequency; - uint8 *data; - int size; - int volumeStep; - int stepCount; - int step; - bool repeat; - int volume; - }; - protected: void playSoundChannel(int channel, int frequency, uint8 *data, int size, int volume); Audio::SoundHandle _channelsTable[NUM_CHANNELS]; - SoundChannel _soundChannelsTable[NUM_CHANNELS]; Audio::SoundHandle _moduleHandle; Audio::AudioStream *_moduleStream; }; diff --git a/engines/cine/various.cpp b/engines/cine/various.cpp index c6508cc211..74f8fe845a 100644 --- a/engines/cine/various.cpp +++ b/engines/cine/various.cpp @@ -71,7 +71,7 @@ uint16 allowPlayerInput; uint16 checkForPendingDataLoadSwitch; -uint16 fadeRequired; +bool fadeRequired; uint16 isDrawCommandEnabled; uint16 waitForPlayerClick; uint16 menuCommandLen; @@ -513,7 +513,7 @@ bool CineEngine::makeLoad(char *saveName) { globalVars[VAR_MOUSE_X_POS] = 0; globalVars[VAR_MOUSE_Y_POS] = 0; - fadeRequired = 0; + fadeRequired = false; for (i = 0; i < 16; i++) { c_palette[i] = 0; diff --git a/engines/cine/various.h b/engines/cine/various.h index 654ba68042..96aa27b5a0 100644 --- a/engines/cine/various.h +++ b/engines/cine/various.h @@ -90,7 +90,7 @@ extern uint16 allowPlayerInput; extern uint16 checkForPendingDataLoadSwitch; -extern uint16 fadeRequired; +extern bool fadeRequired; extern uint16 isDrawCommandEnabled; extern uint16 waitForPlayerClick; extern uint16 menuCommandLen; |