aboutsummaryrefslogtreecommitdiff
path: root/sky
diff options
context:
space:
mode:
authorRobert Göffringmann2003-06-02 03:30:41 +0000
committerRobert Göffringmann2003-06-02 03:30:41 +0000
commitee886a6be29f1f9a6fca13c11b8b53b92b69c882 (patch)
tree86c080d45a5857477949cdc0cf2ce6519d6f0d5f /sky
parentd811359226c5e8b9d4815d47ee0ef22f54909f8d (diff)
downloadscummvm-rg350-ee886a6be29f1f9a6fca13c11b8b53b92b69c882.tar.gz
scummvm-rg350-ee886a6be29f1f9a6fca13c11b8b53b92b69c882.tar.bz2
scummvm-rg350-ee886a6be29f1f9a6fca13c11b8b53b92b69c882.zip
fixed sprite animation bug in stdSpeak, cleaned fnTalk and made text timing in cd version depending on the end of the voc files being reached.
svn-id: r8262
Diffstat (limited to 'sky')
-rw-r--r--sky/logic.cpp78
-rw-r--r--sky/screen.cpp3
-rw-r--r--sky/sky.cpp2
-rw-r--r--sky/sound.cpp13
-rw-r--r--sky/sound.h1
5 files changed, 45 insertions, 52 deletions
diff --git a/sky/logic.cpp b/sky/logic.cpp
index 6bdbd83f14..d9724cceec 100644
--- a/sky/logic.cpp
+++ b/sky/logic.cpp
@@ -496,9 +496,8 @@ void SkyLogic::talk() {
// If speech is allowed then check for it to finish before finishing animations
- if ((SkyState::_systemVars.systemFlags & SF_PLAY_VOCS) && // sblaster?
- (_compact->extCompact->spTextId == 0xFFFF) && // is this a voc file?
- (!(SkyState::_systemVars.systemFlags & SF_VOC_PLAYING))) { // finished?
+ if ((_compact->extCompact->spTextId == 0xFFFF) && // is this a voc file?
+ (_skySound->speechFinished())) { // finished?
_compact->logic = L_SCRIPT; // restart character control
@@ -517,41 +516,33 @@ void SkyLogic::talk() {
// we will force the animation to finish 3 game cycles
// before the speech actually finishes - because it looks good.
- if (_compact->extCompact->spTime != 3) {
+ if ((_compact->extCompact->spTime != 3) || (!_skySound->speechFinished())) {
_compact->frame = *(graphixProg + 2) + _compact->offset;
graphixProg += 3;
_compact->grafixProg = graphixProg;
- goto past_speech_anim;
- }
-
- if (SkyState::_systemVars.systemFlags & SF_VOC_PLAYING) {
- _compact->extCompact->spTime++;
- return;
}
+ } else {
+ // we ran out of frames, let actor stand still.
+ // TODO: we should improve this and simply restart animation.
+ _compact->frame = _compact->getToFlag;
+ _compact->grafixProg = 0;
}
-
- _compact->frame = _compact->getToFlag;
- _compact->grafixProg = 0;
}
-past_speech_anim:
- if (--(_compact->extCompact->spTime))
- return;
+ if (_skySound->speechFinished()) _compact->extCompact->spTime--;
- // ok, speech has finished
+ if (_compact->extCompact->spTime == 0) {
- if (SkyState::_systemVars.systemFlags & SF_VOC_PLAYING) {
- _compact->extCompact->spTime++;
- return;
- }
+ // ok, speech has finished
- if (_compact->extCompact->spTextId) {
- Compact *cpt = SkyState::fetchCompact(_compact->extCompact->spTextId); // get text id to kill
- cpt->status = 0; // kill the text
- }
+ if (_compact->extCompact->spTextId) {
+ Compact *cpt = SkyState::fetchCompact(_compact->extCompact->spTextId); // get text id to kill
+ cpt->status = 0; // kill the text
+ }
- _compact->logic = L_SCRIPT;
- logicScript();
+ _compact->logic = L_SCRIPT;
+ logicScript();
+ }
}
void SkyLogic::listen() {
@@ -2198,24 +2189,16 @@ bool SkyLogic::fnPrintf(uint32 a, uint32 b, uint32 c) {
}
void SkyLogic::stdSpeak(Compact *target, uint32 textNum, uint32 animNum, uint32 base) {
- //animNum == -1 (0x??FF) means directional
-
- uint8 offset = (uint8)(target->extCompact->megaSet / NEXT_MEGA_SET);
- uint16 *animPtr = 0;
-
- if (animNum > 0xFF)
- warning("animNum > 255! - tell joostp when/where this happens");
-
- //FIXME: Is this correct?
- if (animNum >= 0xFF)
- offset += -1;
- else
- offset += (uint8)(animNum & 0xFF); //get correct anim no
- if (SkyTalkAnims::animTalkTableIsPointer[offset]) //is it a pointer?
- animPtr = (uint16 *)SkyTalkAnims::animTalkTablePtr[offset];
- else //then it must be a value
- animPtr = (uint16 *)SkyState::fetchCompact(SkyTalkAnims::animTalkTableVal[offset]);
+ uint16 *animPtr;
+
+ animNum += target->extCompact->megaSet / NEXT_MEGA_SET;
+ animNum &= 0xFF;
+
+ if (SkyTalkAnims::animTalkTableIsPointer[animNum]) //is it a pointer?
+ animPtr = (uint16 *)SkyTalkAnims::animTalkTablePtr[animNum];
+ else //then it must be a value
+ animPtr = (uint16 *)SkyState::fetchCompact(SkyTalkAnims::animTalkTableVal[animNum]);
target->offset = *animPtr++;
target->getToFlag = *animPtr++;
@@ -2268,8 +2251,11 @@ void SkyLogic::stdSpeak(Compact *target, uint32 textNum, uint32 animNum, uint32
_compact->status = 0; //don't display text
//_logicTalkButtonRelease = 1;
}
-
- target->extCompact->spTime = (uint16)_skyText->_dtLetters + 5;
+ // In CD version, we're doing the timing by checking when the VOC has stopped playing.
+ // Setting spTime to 10 thus means that we're doing a pause of 10 gamecycles between
+ // each sentence.
+ if (SkyState::isCDVersion()) target->extCompact->spTime = 10;
+ else target->extCompact->spTime = (uint16)_skyText->_dtLetters + 5;
target->logic = L_TALK;
}
diff --git a/sky/screen.cpp b/sky/screen.cpp
index c8050eefa1..56f8aec409 100644
--- a/sky/screen.cpp
+++ b/sky/screen.cpp
@@ -180,8 +180,8 @@ void SkyScreen::flip(void) {
uint8 *screenPos = _currentScreen;
uint8 *backPos = _backScreen;
uint32 copyX, copyWidth;
+ copyWidth = 0;
for (uint8 cnty = 0; cnty < GRID_Y; cnty++) {
- copyWidth = 0;
for (uint8 cntx = 0; cntx < GRID_X; cntx++) {
if (_gameGrid[cnty * GRID_X + cntx] & 1) {
_gameGrid[cnty * GRID_X + cntx] &= ~1;
@@ -220,7 +220,6 @@ void SkyScreen::fnDrawScreen(uint32 palette, uint32 scroll) {
recreate();
spriteEngine();
flip();
- _system->update_screen();
fnFadeUp(palette, scroll);
}
diff --git a/sky/sky.cpp b/sky/sky.cpp
index 4c5f5bf17e..f20f2ed2bf 100644
--- a/sky/sky.cpp
+++ b/sky/sky.cpp
@@ -153,6 +153,7 @@ void SkyState::go() {
_skyScreen->spriteEngine();
_skyScreen->flip();
_system->update_screen();
+ //if (_skySound->speechFinished()) printf("finsihed\n"); else printf("running\n");
}
}
@@ -172,6 +173,7 @@ void SkyState::initialise(void) {
_systemVars.systemFlags |= SF_ROLAND;
_skyMusic = new SkyGmMusic(_detector->createMidi(), _skyDisk);
}
+ _systemVars.systemFlags |= SF_PLAY_VOCS;
_skyText = new SkyText(_skyDisk);
_skyMouse = new SkyMouse(_system, _skyDisk);
diff --git a/sky/sound.cpp b/sky/sound.cpp
index 99a697c672..314a328377 100644
--- a/sky/sound.cpp
+++ b/sky/sound.cpp
@@ -1013,6 +1013,7 @@ SkySound::SkySound(SoundMixer *mixer, SkyDisk *pDisk) {
_effectHandle = 0;
_bgSoundHandle = 0;
_ingameSound = 0;
+ _ingameSpeech = 0;
}
SkySound::~SkySound(void) {
@@ -1117,10 +1118,14 @@ bool SkySound::fnStartFx(uint32 sound) {
uint8 volume = 0x7f; // start with max vol
- if (SkyState::_systemVars.systemFlags & SF_SBLASTER)
- volume = roomList[i].adlibVolume;
- if (SkyState::_systemVars.systemFlags & SF_ROLAND)
- volume = roomList[i].rolandVolume;
+ if (!SkyState::isCDVersion()) {
+ // as long as we can't set the volume for sfx without changing the speech volume,
+ // we're better off not setting it at all.
+ if (SkyState::_systemVars.systemFlags & SF_SBLASTER)
+ volume = roomList[i].adlibVolume;
+ if (SkyState::_systemVars.systemFlags & SF_ROLAND)
+ volume = roomList[i].rolandVolume;
+ }
// Check the flags, the sound may come on after a delay.
if (sfx->flags & SFXF_START_DELAY) {
diff --git a/sky/sound.h b/sky/sound.h
index 348cfc4c99..bcdb56f88f 100644
--- a/sky/sound.h
+++ b/sky/sound.h
@@ -51,6 +51,7 @@ public:
void playSound(uint16 sound, uint16 volume);
bool fnStartFx(uint32 sound);
void fnStartSpeech(uint16 textNum);
+ bool speechFinished(void) { return _ingameSpeech == 0; };
private:
SkyDisk *_skyDisk;