[Scummvm-git-logs] scummvm master -> 488b34643f8e139127682dae0179c3723201d469
athrxx
athrxx at scummvm.org
Thu Aug 19 18:00:11 UTC 2021
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
cc46e61603 KYRA: (HOF) - slightly improve intro/outro timing accuracy
488b34643f KYRA: (HOF) - fix some intro glitches (ticket no. 6285)
Commit: cc46e616030284a2ebd65524b79282ada0e6c19d
https://github.com/scummvm/scummvm/commit/cc46e616030284a2ebd65524b79282ada0e6c19d
Author: athrxx (athrxx at scummvm.org)
Date: 2021-08-19T19:55:57+02:00
Commit Message:
KYRA: (HOF) - slightly improve intro/outro timing accuracy
(due to ticket no. 6285)
Changed paths:
engines/kyra/sequence/sequences_hof.cpp
diff --git a/engines/kyra/sequence/sequences_hof.cpp b/engines/kyra/sequence/sequences_hof.cpp
index c58aedee65..2600259989 100644
--- a/engines/kyra/sequence/sequences_hof.cpp
+++ b/engines/kyra/sequence/sequences_hof.cpp
@@ -249,6 +249,8 @@ private:
uint32 _countDownRemainder;
uint32 _countDownLastUpdate;
+ const int _tickLength;
+
enum SeqPlayerTargetInfo {
kHoF = 0,
kHoFDemo,
@@ -336,7 +338,7 @@ private:
SeqPlayer_HOF *SeqPlayer_HOF::_instance = 0;
-SeqPlayer_HOF::SeqPlayer_HOF(KyraEngine_v1 *vm, Screen_v2 *screen, OSystem *system, bool startupSaveLoadable) : _vm(vm), _screen(screen), _system(system), _startupSaveLoadable(startupSaveLoadable) {
+SeqPlayer_HOF::SeqPlayer_HOF(KyraEngine_v1 *vm, Screen_v2 *screen, OSystem *system, bool startupSaveLoadable) : _vm(vm), _screen(screen), _system(system), _startupSaveLoadable(startupSaveLoadable), _tickLength(1000000/60) {
// We use a static pointer for pauseEngine functionality. Since we don't
// ever need more than one SeqPlayer_HOF object at the same time we keep
// this simple and just add an assert to detect typos, regressions, etc.
@@ -874,7 +876,7 @@ void SeqPlayer_HOF::doTransition(int type) {
void SeqPlayer_HOF::nestedFrameAnimTransition(int srcPage, int dstPage, int delaytime, int steps, int x, int y, int w, int h, int openClose, int directionFlags) {
if (openClose) {
for (int i = 1; i < steps; i++) {
- uint32 endtime = _system->getMillis() + delaytime * _vm->tickLength();
+ uint32 endtime = _system->getMillis() + delaytime * _tickLength / 1000;
int w2 = (((w * 256) / steps) * i) / 256;
int h2 = (((h * 256) / steps) * i) / 256;
@@ -899,7 +901,7 @@ void SeqPlayer_HOF::nestedFrameAnimTransition(int srcPage, int dstPage, int dela
} else {
_screen->copyPage(12, dstPage);
for (int i = steps; i; i--) {
- uint32 endtime = _system->getMillis() + delaytime * _vm->tickLength();
+ uint32 endtime = _system->getMillis() + delaytime * _tickLength / 1000;
int w2 = (((w * 256) / steps) * i) / 256;
int h2 = (((h * 256) / steps) * i) / 256;
@@ -927,7 +929,7 @@ void SeqPlayer_HOF::nestedFrameFadeTransition(const char *cmpFile) {
_screen->copyPage(12, 4);
for (int i = 0; i < 3; i++) {
- uint32 endtime = _system->getMillis() + 4 * _vm->tickLength();
+ uint32 endtime = _system->getMillis() + 4 * _tickLength / 1000;
assert(_screenHoF);
_screenHoF->cmpFadeFrameStep(4, 320, 200, 0, 0, 2, 320, 200, 0, 0, 320, 200, 6);
_screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0);
@@ -1008,7 +1010,7 @@ void SeqPlayer_HOF::playAnimation(WSAMovie_v2 *wsaObj, int startFrame, int lastF
break;
if (fadePal1 && fadePal2) {
- if (!_screen->timedPaletteFadeStep(fadePal1->getData(), fadePal2->getData(), _system->getMillis() - startTime, fadeRate * _vm->tickLength()) && !wsaObj)
+ if (!_screen->timedPaletteFadeStep(fadePal1->getData(), fadePal2->getData(), _system->getMillis() - startTime, fadeRate * _tickLength / 1000) && !wsaObj)
break;
}
@@ -1044,7 +1046,7 @@ void SeqPlayer_HOF::playDialogueAnimation(uint16 strID, uint16 soundID, int text
if (slot >= 0)
_textSlots[slot].textcolor = textColor;
}
- _specialAnimTimeOutTotal = _system->getMillis() + dur * _vm->tickLength();
+ _specialAnimTimeOutTotal = _system->getMillis() + dur * _tickLength / 1000;
int curframe = animStartFrame;
if (soundID && _vm->speechEnabled()) {
@@ -1063,7 +1065,7 @@ void SeqPlayer_HOF::playDialogueAnimation(uint16 strID, uint16 soundID, int text
if (ABS(animLastFrame) < curframe)
curframe = animStartFrame;
- _specialAnimFrameTimeOut = _system->getMillis() + _animDuration * _vm->tickLength();
+ _specialAnimFrameTimeOut = _system->getMillis() + _animDuration * _tickLength / 1000;
setCountDown(_animDuration);
if (wsaObj)
@@ -1242,9 +1244,9 @@ bool SeqPlayer_HOF::updateNestedAnimation(int animSlot) {
}
if (_animSlots[animSlot].flags & 0x10) {
- currentFrame = (curTick - _animSlots[animSlot].nextFrame) / (_animSlots[animSlot].frameDelay * _vm->tickLength());
+ currentFrame = (curTick - _animSlots[animSlot].nextFrame) / (_animSlots[animSlot].frameDelay * _tickLength / 1000);
} else {
- int diff = (curTick - _animSlots[animSlot].nextFrame) / (_animSlots[animSlot].frameDelay * _vm->tickLength());
+ int diff = (curTick - _animSlots[animSlot].nextFrame) / (_animSlots[animSlot].frameDelay * _tickLength / 1000);
if (diff > 0) {
currentFrame++;
if (_vm->gameFlags().platform == Common::kPlatformFMTowns || _vm->gameFlags().platform == Common::kPlatformPC98)
@@ -1356,7 +1358,7 @@ int SeqPlayer_HOF::displaySubTitle(uint16 strIndex, uint16 posX, uint16 posY, in
_textSlots[i].strIndex = strIndex;
_textSlots[i].x = posX;
_textSlots[i].y = posY;
- _textSlots[i].duration = duration * _vm->tickLength();
+ _textSlots[i].duration = duration * _tickLength / 1000;
_textSlots[i].width = width;
_textSlots[i].startTime = _system->getMillis();
_textSlots[i].textcolor = -1;
@@ -1437,7 +1439,7 @@ char *SeqPlayer_HOF::preprocessString(const char *srcStr, int width) {
}
void SeqPlayer_HOF::waitForSubTitlesTimeout() {
- uint32 timeOut = _system->getMillis() + ticksTillSubTitlesTimeout() * _vm->tickLength();
+ uint32 timeOut = _system->getMillis() + ticksTillSubTitlesTimeout() * _tickLength / 1000;
if (_vm->textEnabled()) {
delayUntil(timeOut);
@@ -1546,7 +1548,7 @@ void SeqPlayer_HOF::displayHoFTalkieScrollText(uint8 *data, const ScreenDim *d,
int cnt = 0;
while (loop) {
- uint32 loopEnd = _system->getMillis() + speed * _vm->tickLength();
+ uint32 loopEnd = _system->getMillis() + speed * _tickLength / 1000;
while (cnt < 35 && *ptr) {
uint16 cH;
@@ -1726,7 +1728,7 @@ void SeqPlayer_HOF::updateDemoAdText(int bottom, int top) {
}
void SeqPlayer_HOF::delayTicks(uint32 ticks) {
- uint32 len = ticks * _vm->tickLength();
+ uint32 len = ticks * _tickLength / 1000;
while (len && !_vm->shouldQuit() && !checkAbortPlayback()) {
uint32 step = (len >= 10) ? 10 : len;
_system->delayMillis(step);
@@ -1743,7 +1745,7 @@ void SeqPlayer_HOF::delayUntil(uint32 dest) {
}
void SeqPlayer_HOF::setCountDown(uint32 ticks) {
- _countDownRemainder = ticks * _vm->tickLength();
+ _countDownRemainder = ticks * _tickLength / 1000;
if (_vm->gameFlags().platform == Common::kPlatformFMTowns || _vm->gameFlags().platform == Common::kPlatformPC98)
_countDownRemainder = _countDownRemainder * 2 / 3;
_countDownLastUpdate = _system->getMillis() & ~(_vm->tickLength() - 1);
@@ -1815,7 +1817,7 @@ int SeqPlayer_HOF::cbHOF_overview(WSAMovie_v2 *wsaObj, int x, int y, int frm) {
_updateAnimations = true;
fadeOutMusic();
_vm->sound()->playTrack(4);
- frameEnd = _system->getMillis() + 60 * _vm->tickLength();
+ frameEnd = _system->getMillis() + 60 * _tickLength / 1000;
_textColor[1] = _screen->findLeastDifferentColor(_textColorPresets, _screen->getPalette(0), 1, 255) & 0xFF;
memset(_textColorMap, _textColor[1], 16);
@@ -2250,7 +2252,7 @@ int SeqPlayer_HOF::cbHOF_funters(WSAMovie_v2 *wsaObj, int x, int y, int frm) {
_textColor[0] = _textColorMap[1] = 0xFF;
_screen->setTextColorMap(_textColorMap);
- frameEnd = _system->getMillis() + 480 * _vm->tickLength();
+ frameEnd = _system->getMillis() + 480 * _tickLength / 1000;
printFadingText(81, 240, 70, _textColorMap, 252);
printFadingText(82, 240, 90, _textColorMap, _textColor[0]);
_screen->copyPage(2, 12);
@@ -2324,7 +2326,7 @@ int SeqPlayer_HOF::cbHOF_ferb(WSAMovie_v2 *wsaObj, int x, int y, int frm) {
switch (frm) {
case -2:
doTransition(9);
- frameEnd = _system->getMillis() + 480 * _vm->tickLength();
+ frameEnd = _system->getMillis() + 480 * _tickLength / 1000;
printFadingText(34, 240, _vm->gameFlags().isTalkie ? 60 : 40, _textColorMap, 252);
printFadingText(35, 240, _vm->gameFlags().isTalkie ? 70 : 50, _textColorMap, _textColor[0]);
printFadingText(36, 240, _vm->gameFlags().isTalkie ? 90 : 70, _textColorMap, 252);
@@ -2406,7 +2408,7 @@ int SeqPlayer_HOF::cbHOF_fish(WSAMovie_v2 *wsaObj, int x, int y, int frm) {
switch (frm) {
case -2:
doTransition(9);
- frameEnd = _system->getMillis() + 480 * _vm->tickLength();
+ frameEnd = _system->getMillis() + 480 * _tickLength / 1000;
printFadingText(40, 240, _vm->gameFlags().isTalkie ? 55 : 40, _textColorMap, 252);
printFadingText(41, 240, _vm->gameFlags().isTalkie ? 65 : 50, _textColorMap, _textColor[0]);
@@ -2488,7 +2490,7 @@ int SeqPlayer_HOF::cbHOF_fheep(WSAMovie_v2 *wsaObj, int x, int y, int frm) {
_screen->copyPage(2, 0);
_screen->updateScreen();
doTransition(9);
- frameEnd = _system->getMillis() + 480 * _vm->tickLength();
+ frameEnd = _system->getMillis() + 480 * _tickLength / 1000;
printFadingText(49, 240, 20, _textColorMap, 252);
printFadingText(50, 240, 30, _textColorMap, _textColor[0]);
printFadingText(51, 240, 40, _textColorMap, _textColor[0]);
@@ -2568,7 +2570,7 @@ int SeqPlayer_HOF::cbHOF_farmer(WSAMovie_v2 *wsaObj, int x, int y, int frm) {
_screen->copyPage(2, 0);
_screen->updateScreen();
doTransition(9);
- frameEnd = _system->getMillis() + 480 * _vm->tickLength();
+ frameEnd = _system->getMillis() + 480 * _tickLength / 1000;
printFadingText(45, 240, 40, _textColorMap, 252);
printFadingText(46, 240, 50, _textColorMap, _textColor[0]);
printFadingText(47, 240, 60, _textColorMap, _textColor[0]);
@@ -2638,7 +2640,7 @@ int SeqPlayer_HOF::cbHOF_fuards(WSAMovie_v2 *wsaObj, int x, int y, int frm) {
switch (frm) {
case -2:
doTransition(9);
- frameEnd = _system->getMillis() + 480 * _vm->tickLength();
+ frameEnd = _system->getMillis() + 480 * _tickLength / 1000;
printFadingText(70, 240, 20, _textColorMap, 252);
printFadingText(71, 240, 30, _textColorMap, _textColor[0]);
printFadingText(72, 240, 40, _textColorMap, _textColor[0]);
@@ -2733,7 +2735,7 @@ int SeqPlayer_HOF::cbHOF_firates(WSAMovie_v2 *wsaObj, int x, int y, int frm) {
_screen->copyPage(2, 0);
_screen->updateScreen();
doTransition(9);
- frameEnd = _system->getMillis() + 480 * _vm->tickLength();
+ frameEnd = _system->getMillis() + 480 * _tickLength / 1000;
printFadingText(76, 240, 40, _textColorMap, 252);
printFadingText(77, 240, 50, _textColorMap, 252);
printFadingText(78, 240, 60, _textColorMap, _textColor[0]);
@@ -3066,7 +3068,7 @@ int SeqPlayer_HOF::cbHOFDEMO_dinob(WSAMovie_v2 *wsaObj, int x, int y, int frm) {
}
int SeqPlayer_HOF::cbHOFDEMO_fisher(WSAMovie_v2 *wsaObj, int x, int y, int frm) {
- if (((_system->getMillis() - _fisherAnimCurTime) / (5 * _vm->tickLength())) > 0) {
+ if (((_system->getMillis() - _fisherAnimCurTime) / (5 * _tickLength / 1000)) > 0) {
_fisherAnimCurTime = _system->getMillis();
if (!_callbackCurrentFrame) {
startNestedAnimation(0, kNestedSequenceHoFDemoBail);
Commit: 488b34643f8e139127682dae0179c3723201d469
https://github.com/scummvm/scummvm/commit/488b34643f8e139127682dae0179c3723201d469
Author: athrxx (athrxx at scummvm.org)
Date: 2021-08-19T19:58:05+02:00
Commit Message:
KYRA: (HOF) - fix some intro glitches (ticket no. 6285)
- fix delays when speech is enabled and subtitles are disabled
- fix palette fade transition
- remove obsolete special cases for FM-Towns/PC-98
Changed paths:
engines/kyra/sequence/sequences_hof.cpp
diff --git a/engines/kyra/sequence/sequences_hof.cpp b/engines/kyra/sequence/sequences_hof.cpp
index 2600259989..fd0662a25e 100644
--- a/engines/kyra/sequence/sequences_hof.cpp
+++ b/engines/kyra/sequence/sequences_hof.cpp
@@ -389,7 +389,7 @@ SeqPlayer_HOF::SeqPlayer_HOF(KyraEngine_v1 *vm, Screen_v2 *screen, OSystem *syst
_vm->resource()->loadFileList(files, tempSize);
_sequenceStrings = _vm->staticres()->loadStrings(k2SeqplayStrings, tempSize);
- uint8 multiplier = (_vm->gameFlags().platform == Common::kPlatformFMTowns || _vm->gameFlags().platform == Common::kPlatformPC98) ? 12 : 8;
+ uint8 multiplier = /*(_vm->gameFlags().platform == Common::kPlatformFMTowns || _vm->gameFlags().platform == Common::kPlatformPC98) ? 12 :*/ 8;
for (int i = 0; i < MIN(33, tempSize); i++)
_textDuration[i] = (int)strlen(_sequenceStrings[i]) * multiplier;
@@ -656,7 +656,7 @@ void SeqPlayer_HOF::playScenes() {
if (sq.flags & 2) {
_screen->loadBitmap(sq.cpsFile, 2, 2, &_screen->getPalette(0));
- _screen->setScreenPalette(_screen->getPalette(0));
+ //_screen->setScreenPalette(_screen->getPalette(0));
} else {
_screen->setCurPage(2);
_screen->clearPage(2);
@@ -706,7 +706,7 @@ void SeqPlayer_HOF::playScenes() {
setCountDown(_animDuration);
while (!checkAbortPlayback() && !_vm->shouldQuit() && (countDownRunning() || _updateAnimations)) {
- uint32 endFrame = (_system->getMillis() + _vm->tickLength()) & ~(_vm->tickLength() - 1);
+ uint32 endFrame = _system->getMillis() + _vm->tickLength();
updateAllNestedAnimations();
if (_config->seqProc[_curScene])
@@ -730,7 +730,7 @@ void SeqPlayer_HOF::playScenes() {
(this->*_config->seqProc[_curScene])(0, 0, 0, -2);
uint32 textTimeOut = ticksTillSubTitlesTimeout();
- setCountDown(sq.timeout < textTimeOut ? textTimeOut : sq.timeout);
+ setCountDown(MAX<uint32>(textTimeOut, sq.timeout));
while (!checkAbortPlayback() && !_vm->shouldQuit() && (countDownRunning() || _updateAnimations)) {
updateAllNestedAnimations();
@@ -808,6 +808,8 @@ void SeqPlayer_HOF::doTransition(int type) {
for (int i = 0; i < 8; i++)
closeNestedAnimation(i);
+
+
switch (type) {
case 0:
_screen->fadeToBlack(36);
@@ -1075,7 +1077,7 @@ void SeqPlayer_HOF::playDialogueAnimation(uint16 strID, uint16 soundID, int text
updateSubTitles();
delayUntil(MIN(_specialAnimFrameTimeOut, _specialAnimTimeOutTotal));
- if (_vm->speechEnabled() && !_vm->textEnabled() && !_vm->snd_voiceIsPlaying())
+ if (_vm->speechEnabled() && !_vm->textEnabled() && !_vm->sound()->voiceIsPlaying())
break;
if (checkAbortPlayback())
@@ -1249,9 +1251,9 @@ bool SeqPlayer_HOF::updateNestedAnimation(int animSlot) {
int diff = (curTick - _animSlots[animSlot].nextFrame) / (_animSlots[animSlot].frameDelay * _tickLength / 1000);
if (diff > 0) {
currentFrame++;
- if (_vm->gameFlags().platform == Common::kPlatformFMTowns || _vm->gameFlags().platform == Common::kPlatformPC98)
+ /*if (_vm->gameFlags().platform == Common::kPlatformFMTowns || _vm->gameFlags().platform == Common::kPlatformPC98)
_animSlots[animSlot].nextFrame += ((curTick - _animSlots[animSlot].nextFrame) * 2 / 3);
- else
+ else*/
_animSlots[animSlot].nextFrame = curTick;
}
}
@@ -1444,7 +1446,7 @@ void SeqPlayer_HOF::waitForSubTitlesTimeout() {
if (_vm->textEnabled()) {
delayUntil(timeOut);
} else if (_vm->speechEnabled()) {
- while (_vm->snd_voiceIsPlaying())
+ while (!(_vm->shouldQuit() || _vm->skipFlag()) && _vm->sound()->voiceIsPlaying())
delayTicks(1);
}
@@ -1746,8 +1748,8 @@ void SeqPlayer_HOF::delayUntil(uint32 dest) {
void SeqPlayer_HOF::setCountDown(uint32 ticks) {
_countDownRemainder = ticks * _tickLength / 1000;
- if (_vm->gameFlags().platform == Common::kPlatformFMTowns || _vm->gameFlags().platform == Common::kPlatformPC98)
- _countDownRemainder = _countDownRemainder * 2 / 3;
+ //if (_vm->gameFlags().platform == Common::kPlatformFMTowns || _vm->gameFlags().platform == Common::kPlatformPC98)
+ // _countDownRemainder = _countDownRemainder * 2 / 3;
_countDownLastUpdate = _system->getMillis() & ~(_vm->tickLength() - 1);
}
@@ -1755,7 +1757,7 @@ bool SeqPlayer_HOF::countDownRunning() {
uint32 cur = _system->getMillis();
uint32 step = cur - _countDownLastUpdate;
_countDownLastUpdate = cur;
- _countDownRemainder = (step <= _countDownRemainder) ? _countDownRemainder - step : 0;
+ _countDownRemainder = (uint32)MAX<int32>(_countDownRemainder - step, 0);
return _countDownRemainder;
}
@@ -1767,8 +1769,8 @@ bool SeqPlayer_HOF::countDownRunning() {
int SeqPlayer_HOF::cbHOF_westwood(WSAMovie_v2 *wsaObj, int x, int y, int frm) {
if (frm == -2) {
- if (_vm->gameFlags().platform == Common::kPlatformFMTowns || _vm->gameFlags().platform == Common::kPlatformPC98)
- delayTicks(300);
+ //if (_vm->gameFlags().platform == Common::kPlatformFMTowns || _vm->gameFlags().platform == Common::kPlatformPC98)
+ // delayTicks(300);
} else if (!frm) {
_vm->sound()->playTrack(2);
}
@@ -1903,7 +1905,7 @@ int SeqPlayer_HOF::cbHOF_library(WSAMovie_v2 *wsaObj, int x, int y, int frm) {
case 0:
_updateAnimations = true;
_vm->sound()->playTrack(5);
-
+ playSoundAndDisplaySubTitle(4);
assert(_screenHoF);
_screenHoF->generateGrayOverlay(_screen->getPalette(0), _screen->getPalette(3).getData(), 0x24, 0, 0, 0, 0x100, false);
_textColor[1] = _screen->findLeastDifferentColor(_textColorPresets, _screen->getPalette(0), 1, 255) & 0xFF;
@@ -1915,7 +1917,6 @@ int SeqPlayer_HOF::cbHOF_library(WSAMovie_v2 *wsaObj, int x, int y, int frm) {
case 1:
startNestedAnimation(0, kNestedSequenceLibrary3);
- playSoundAndDisplaySubTitle(4);
break;
case 100:
@@ -2137,7 +2138,12 @@ int SeqPlayer_HOF::cbHOF_zanfaun(WSAMovie_v2 *wsaObj, int x, int y, int frm) {
break;
case 26:
- waitForSubTitlesTimeout();
+ if (_vm->gameFlags().isTalkie && !_vm->textEnabled()) {
+ while (!(_vm->shouldQuit() || _vm->skipFlag()) && _vm->sound()->voiceIsPlaying());
+ delayTicks(1);
+ } else {
+ waitForSubTitlesTimeout();
+ }
break;
case 46:
@@ -2176,9 +2182,14 @@ int SeqPlayer_HOF::cbHOF_over2(WSAMovie_v2 *wsaObj, int x, int y, int frm) {
int SeqPlayer_HOF::cbHOF_forest(WSAMovie_v2 *wsaObj, int x, int y, int frm) {
if (frm == 11)
waitForSubTitlesTimeout();
- else if (frm == 12)
+ else if (frm == 12) {
+ if (_vm->gameFlags().isTalkie && _vm->gameFlags().lang == Common::DE_DEU) {
+ while (!(_vm->shouldQuit() || _vm->skipFlag()) && _vm->sound()->voiceIsPlaying())
+ delayTicks(1);
+ }
+ delayTicks(25);
playSoundAndDisplaySubTitle(2);
-
+ }
return frm;
}
More information about the Scummvm-git-logs
mailing list