aboutsummaryrefslogtreecommitdiff
path: root/sword1
diff options
context:
space:
mode:
authorRobert Göffringmann2003-12-22 23:21:28 +0000
committerRobert Göffringmann2003-12-22 23:21:28 +0000
commit2df01e0abbbf9612a9ded5ac41cd3536ae4d7ff6 (patch)
tree3ebb4aa23d9330c0209eaf14782e2b5adcb3e171 /sword1
parent5b38b9ccbe7ec5c622af89ad64165949c2755572 (diff)
downloadscummvm-rg350-2df01e0abbbf9612a9ded5ac41cd3536ae4d7ff6.tar.gz
scummvm-rg350-2df01e0abbbf9612a9ded5ac41cd3536ae4d7ff6.tar.bz2
scummvm-rg350-2df01e0abbbf9612a9ded5ac41cd3536ae4d7ff6.zip
fixed screen and music fading
svn-id: r11861
Diffstat (limited to 'sword1')
-rw-r--r--sword1/logic.cpp6
-rw-r--r--sword1/music.cpp4
-rw-r--r--sword1/screen.cpp2
-rw-r--r--sword1/sword1.cpp4
4 files changed, 8 insertions, 8 deletions
diff --git a/sword1/logic.cpp b/sword1/logic.cpp
index 7a20c1d5b1..f1b20454d7 100644
--- a/sword1/logic.cpp
+++ b/sword1/logic.cpp
@@ -348,7 +348,7 @@ int SwordLogic::fullAnimDriver(BsObject *compact) {
return 1;
}
uint8 *data = ((uint8*)_resMan->openFetchRes(compact->o_anim_resource)) + sizeof(Header);
- uint16 numFrames = READ_LE_UINT32(data);
+ uint32 numFrames = READ_LE_UINT32(data);
data += 4;
AnimUnit *animPtr = (AnimUnit*)(data + compact->o_anim_pc * sizeof(AnimUnit));
@@ -370,7 +370,7 @@ int SwordLogic::animDriver(BsObject *compact) {
return 1;
}
uint8 *data = ((uint8*)_resMan->openFetchRes(compact->o_anim_resource)) + sizeof(Header);
- uint16 numFrames = READ_LE_UINT32(data);
+ uint32 numFrames = READ_LE_UINT32(data);
AnimUnit *animPtr = (AnimUnit*)(data + 4 + compact->o_anim_pc * sizeof(AnimUnit));
if (!(compact->o_status & STAT_SHRINK)) {
@@ -869,7 +869,7 @@ int SwordLogic::fnFadeUp(BsObject *cpt, int32 id, int32 speed, int32 d, int32 e,
int SwordLogic::fnCheckFade(BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
- _scriptVars[RETURN_VALUE] = (uint8)(!_screen->stillFading());
+ _scriptVars[RETURN_VALUE] = (uint8)_screen->stillFading();
return SCRIPT_CONT;
}
diff --git a/sword1/music.cpp b/sword1/music.cpp
index 9ec8358ecc..9fe8347376 100644
--- a/sword1/music.cpp
+++ b/sword1/music.cpp
@@ -82,7 +82,7 @@ void SwordMusic::mixTo(int16 *src, int16 *dst, uint32 len) {
((int16)READ_LE_UINT16(src + cnt) * _fadeVal) >> 15;
_fadeVal--;
}
- if (!_fadeVal) {
+ if ((!_fadeVal) || (!_smpInBuf)) {
_fading = _playing = false;
free(_musicBuf);
_musicBuf = NULL;
@@ -108,7 +108,7 @@ void SwordMusic::mixer(int16 *buf, uint32 len) {
while (len) {
uint32 length = len;
length = MIN(length, BUFSIZE - _bufPos);
- if (_fading) {
+ if (_fading && _fadeBuf) {
length = MIN(length, (uint32)_fadeVal);
length = MIN(length, _fadeSmpInBuf);
length = MIN(length, BUFSIZE - _fadeBufPos);
diff --git a/sword1/screen.cpp b/sword1/screen.cpp
index 77be61d510..b331a9a22e 100644
--- a/sword1/screen.cpp
+++ b/sword1/screen.cpp
@@ -115,7 +115,7 @@ void SwordScreen::refreshPalette(void) {
}
bool SwordScreen::stillFading(void) {
- return !_isBlack;
+ return _fadingStep;
}
void SwordScreen::updateScreen(void) {
diff --git a/sword1/sword1.cpp b/sword1/sword1.cpp
index a41f5dd6db..783ecf7558 100644
--- a/sword1/sword1.cpp
+++ b/sword1/sword1.cpp
@@ -1090,14 +1090,14 @@ uint8 SwordEngine::mainLoop(void) {
_screen->draw();
_mouse->animate();
- uint32 newTime = _system->get_msecs();
-
_sound->engine();
_screen->updateScreen();
_menu->refresh(MENU_TOP);
_menu->refresh(MENU_BOT);
+ uint32 newTime = _system->get_msecs();
+
if (newTime - frameTime < 80)
delay(80 - (newTime - frameTime));
else