[Scummvm-cvs-logs] SF.net SVN: scummvm: [29790] scummvm/trunk/engines/cine
cyx at users.sourceforge.net
cyx at users.sourceforge.net
Sun Dec 9 14:42:00 CET 2007
Revision: 29790
http://scummvm.svn.sourceforge.net/scummvm/?rev=29790&view=rev
Author: cyx
Date: 2007-12-09 05:41:59 -0800 (Sun, 09 Dec 2007)
Log Message:
-----------
- minor screen fix for OS
- added new debug channel for sound
- updated 2 opcodes comments
Modified Paths:
--------------
scummvm/trunk/engines/cine/bg.cpp
scummvm/trunk/engines/cine/cine.cpp
scummvm/trunk/engines/cine/cine.h
scummvm/trunk/engines/cine/gfx.cpp
scummvm/trunk/engines/cine/main_loop.cpp
scummvm/trunk/engines/cine/script.cpp
scummvm/trunk/engines/cine/sound.cpp
scummvm/trunk/engines/cine/sound.h
scummvm/trunk/engines/cine/various.cpp
scummvm/trunk/engines/cine/various.h
Modified: scummvm/trunk/engines/cine/bg.cpp
===================================================================
--- scummvm/trunk/engines/cine/bg.cpp 2007-12-09 11:32:05 UTC (rev 29789)
+++ scummvm/trunk/engines/cine/bg.cpp 2007-12-09 13:41:59 UTC (rev 29790)
@@ -104,7 +104,9 @@
ptr += 2;
}
- loadRelatedPalette(bgName);
+ if (g_cine->getGameType() == Cine::GType_FW) {
+ loadRelatedPalette(bgName);
+ }
gfxResetRawPage(page2Raw);
gfxConvertSpriteToRaw(page2Raw, ptr, 160, 200);
Modified: scummvm/trunk/engines/cine/cine.cpp
===================================================================
--- scummvm/trunk/engines/cine/cine.cpp 2007-12-09 11:32:05 UTC (rev 29789)
+++ scummvm/trunk/engines/cine/cine.cpp 2007-12-09 13:41:59 UTC (rev 29790)
@@ -53,6 +53,7 @@
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 @@
freePoldatDat();
freeErrmessDat();
}
+ Common::clearAllSpecialDebugLevels();
}
int CineEngine::init() {
Modified: scummvm/trunk/engines/cine/cine.h
===================================================================
--- scummvm/trunk/engines/cine/cine.h 2007-12-09 11:32:05 UTC (rev 29789)
+++ scummvm/trunk/engines/cine/cine.h 2007-12-09 13:41:59 UTC (rev 29790)
@@ -126,7 +126,8 @@
enum {
kCineDebugScript = 1 << 0,
- kCineDebugPart = 1 << 1
+ kCineDebugPart = 1 << 1,
+ kCineDebugSound = 1 << 2
};
enum {
Modified: scummvm/trunk/engines/cine/gfx.cpp
===================================================================
--- scummvm/trunk/engines/cine/gfx.cpp 2007-12-09 11:32:05 UTC (rev 29789)
+++ scummvm/trunk/engines/cine/gfx.cpp 2007-12-09 13:41:59 UTC (rev 29790)
@@ -474,6 +474,10 @@
void flip(void) {
blitRawScreen(page1Raw);
+ if (fadeRequired) {
+ memcpy(c_palette, tempPalette, sizeof(uint16) * 16);
+ fadeRequired = false;
+ }
}
} // End of namespace Cine
Modified: scummvm/trunk/engines/cine/main_loop.cpp
===================================================================
--- scummvm/trunk/engines/cine/main_loop.cpp 2007-12-09 11:32:05 UTC (rev 29789)
+++ scummvm/trunk/engines/cine/main_loop.cpp 2007-12-09 13:41:59 UTC (rev 29790)
@@ -214,7 +214,7 @@
allowPlayerInput = 0;
checkForPendingDataLoadSwitch = 0;
- fadeRequired = 0;
+ fadeRequired = false;
isDrawCommandEnabled = 0;
waitForPlayerClick = 0;
menuCommandLen = 0;
Modified: scummvm/trunk/engines/cine/script.cpp
===================================================================
--- scummvm/trunk/engines/cine/script.cpp 2007-12-09 11:32:05 UTC (rev 29789)
+++ scummvm/trunk/engines/cine/script.cpp 2007-12-09 13:41:59 UTC (rev 29790)
@@ -292,7 +292,7 @@
{ 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 @@
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 @@
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 @@
}
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 @@
if (additionalBgTable[param]) {
currentAdditionalBgIdx = param;
- //if (adBgVar0 == 0) {
+ //if (_screenNeedFadeOut == 0) {
// adBgVar1 = 1;
//}
+ fadeRequired = true;
}
}
Modified: scummvm/trunk/engines/cine/sound.cpp
===================================================================
--- scummvm/trunk/engines/cine/sound.cpp 2007-12-09 11:32:05 UTC (rev 29789)
+++ scummvm/trunk/engines/cine/sound.cpp 2007-12-09 13:41:59 UTC (rev 29790)
@@ -744,32 +744,37 @@
}
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 @@
}
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::playMusic() {
+ debugC(5, kCineDebugSound, "PaulaSound::playMusic()");
_mixer->stopHandle(_moduleHandle);
if (_moduleStream) {
_mixer->playInputStream(Audio::Mixer::kMusicSoundType, &_moduleHandle, _moduleStream);
@@ -807,60 +814,45 @@
}
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);
}
Modified: scummvm/trunk/engines/cine/sound.h
===================================================================
--- scummvm/trunk/engines/cine/sound.h 2007-12-09 11:32:05 UTC (rev 29789)
+++ scummvm/trunk/engines/cine/sound.h 2007-12-09 13:41:59 UTC (rev 29790)
@@ -102,23 +102,11 @@
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;
};
Modified: scummvm/trunk/engines/cine/various.cpp
===================================================================
--- scummvm/trunk/engines/cine/various.cpp 2007-12-09 11:32:05 UTC (rev 29789)
+++ scummvm/trunk/engines/cine/various.cpp 2007-12-09 13:41:59 UTC (rev 29790)
@@ -71,7 +71,7 @@
uint16 checkForPendingDataLoadSwitch;
-uint16 fadeRequired;
+bool fadeRequired;
uint16 isDrawCommandEnabled;
uint16 waitForPlayerClick;
uint16 menuCommandLen;
@@ -513,7 +513,7 @@
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;
Modified: scummvm/trunk/engines/cine/various.h
===================================================================
--- scummvm/trunk/engines/cine/various.h 2007-12-09 11:32:05 UTC (rev 29789)
+++ scummvm/trunk/engines/cine/various.h 2007-12-09 13:41:59 UTC (rev 29790)
@@ -90,7 +90,7 @@
extern uint16 checkForPendingDataLoadSwitch;
-extern uint16 fadeRequired;
+extern bool fadeRequired;
extern uint16 isDrawCommandEnabled;
extern uint16 waitForPlayerClick;
extern uint16 menuCommandLen;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list