[Scummvm-git-logs] scummvm master -> 8f4fde27e80725e1c816a5e12501e68828ee0665
athrxx
noreply at scummvm.org
Tue Mar 29 12:17:55 UTC 2022
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:
c1a01e9708 KYRA: (LOK) - slow down intro to make it closer to the original
8f4fde27e8 KYRA: (EOB) - improve intro (tower scene scrolling)
Commit: c1a01e97087de8810736f4821074b3cc1b6151d8
https://github.com/scummvm/scummvm/commit/c1a01e97087de8810736f4821074b3cc1b6151d8
Author: athrxx (athrxx at scummvm.org)
Date: 2022-03-29T14:17:10+02:00
Commit Message:
KYRA: (LOK) - slow down intro to make it closer to the original
Animations often run at full speed without any delays. Apparently the target hardware of that time (286/386, Amiga, Mac) would ensure sufficient slowdown. Unfortunately, comparing with DOSBox, ScummVM runs somewhat faster. I have tried to add extra delays depending on the amount of onscreen activity. I have finally gotten a result which is very similiar to DOSBox execution.
Basing this on the screen activity is not optimal. Ideally, it would be based on the orignal cpu activity. But we can hardly do that...
Changed paths:
engines/kyra/graphics/screen.cpp
engines/kyra/graphics/screen.h
engines/kyra/sequence/seqplayer_lok.cpp
engines/kyra/sequence/sequences_lok.cpp
diff --git a/engines/kyra/graphics/screen.cpp b/engines/kyra/graphics/screen.cpp
index edb6b3aa612..9ea45098e0e 100644
--- a/engines/kyra/graphics/screen.cpp
+++ b/engines/kyra/graphics/screen.cpp
@@ -346,7 +346,17 @@ void Screen::enableHiColorMode(bool enabled) {
resetPagePtrsAndBuffers(_isSegaCD ? SCREEN_W * _screenHeight : SCREEN_PAGE_SIZE * _bytesPerPixel);
}
-void Screen::updateScreen() {
+int Screen::updateScreen() {
+ int res = 0;
+ if (_forceFullUpdate) {
+ res = SCREEN_W * SCREEN_H;
+ } else if (!_dirtyRects.empty()) {
+ for (Common::List<Common::Rect>::const_iterator i = _dirtyRects.begin(); i != _dirtyRects.end(); ++i)
+ res += (i->width() * i->height());
+ // Due to overlapping the value might be larger than the actual vga video memory size.
+ res = MIN<int>(res, SCREEN_W * SCREEN_H);
+ }
+
bool needRealUpdate = _forceFullUpdate || !_dirtyRects.empty() || _paletteChanged;
_paletteChanged = false;
@@ -368,6 +378,10 @@ void Screen::updateScreen() {
if (needRealUpdate)
updateBackendScreen(true);
+
+ // I've determined this value for the estimated screen update time on legacy hardware experimentally
+ // with a side-by-side comparison with DOSBox. This was as close as I got...
+ return res / 4000;
}
#ifdef KYRA_SCREEN_IDLE_REFRESH
diff --git a/engines/kyra/graphics/screen.h b/engines/kyra/graphics/screen.h
index 2d64c0af31b..b1ab0d0149c 100644
--- a/engines/kyra/graphics/screen.h
+++ b/engines/kyra/graphics/screen.h
@@ -556,7 +556,7 @@ public:
virtual void enableHiColorMode(bool enabled);
// refresh
- void updateScreen();
+ int updateScreen();
void updateBackendScreen(bool force);
uint32 _idleUpdateTimer;
diff --git a/engines/kyra/sequence/seqplayer_lok.cpp b/engines/kyra/sequence/seqplayer_lok.cpp
index 87fe7e82d09..62baca11579 100644
--- a/engines/kyra/sequence/seqplayer_lok.cpp
+++ b/engines/kyra/sequence/seqplayer_lok.cpp
@@ -25,8 +25,6 @@
#include "common/system.h"
-#define SEQOP(n, x) { n, &SeqPlayer::x, #x }
-
namespace Kyra {
SeqPlayer::SeqPlayer(KyraEngine_LoK *vm, OSystem *system) {
@@ -417,16 +415,22 @@ void SeqPlayer::s1_playEffect() {
void SeqPlayer::s1_playTrack() {
uint8 msg = *_seqData++;
- if (msg == 0 && (_vm->gameFlags().platform == Common::kPlatformPC98 || _vm->gameFlags().platform == Common::kPlatformMacintosh)) {
+ if (_vm->gameFlags().platform != Common::kPlatformMacintosh && _vm->gameFlags().platform != Common::kPlatformAmiga)
+ _vm->delay(3 * _vm->tickLength());
+
+ if (msg == 0 && (_vm->gameFlags().platform != Common::kPlatformDOS && _vm->gameFlags().platform != Common::kPlatformAmiga)) {
_sound->haltTrack();
} else if (msg == 1) {
_sound->beginFadeOut();
} else {
_sound->haltTrack();
- if (_vm->gameFlags().platform == Common::kPlatformFMTowns)
- msg += 2;
- _sound->playTrack(msg);
+ if (_vm->gameFlags().platform != Common::kPlatformMacintosh && _vm->gameFlags().platform != Common::kPlatformAmiga)
+ _vm->delay(3 * _vm->tickLength());
+ _sound->playTrack(_vm->gameFlags().platform == Common::kPlatformFMTowns ? msg + 2 : msg);
}
+
+ if (msg < 2 && (_vm->gameFlags().platform != Common::kPlatformMacintosh && _vm->gameFlags().platform != Common::kPlatformAmiga))
+ _vm->delay(3 * _vm->tickLength());
}
void SeqPlayer::s1_allocTempBuffer() {
@@ -473,6 +477,8 @@ void SeqPlayer::s1_prefetchVocFile() {
// we do not have to prefetch the vocfiles on modern systems
}
+#define SEQOP(n, x) { n, &SeqPlayer::x, #x }
+
bool SeqPlayer::playSequence(const uint8 *seqData, bool skipSeq) {
assert(seqData);
@@ -607,6 +613,7 @@ bool SeqPlayer::playSequence(const uint8 *seqData, bool skipSeq) {
memset(revBuffer, 0, sizeof(revBuffer));
int charIdx = 0;
while (!_seqQuitFlag && !_vm->shouldQuit()) {
+ uint32 startFrameCt = _vm->_system->getMillis();
if (skipSeq && _vm->seq_skipSequence()) {
while (1) {
uint8 code = *_seqData;
@@ -667,7 +674,9 @@ bool SeqPlayer::playSequence(const uint8 *seqData, bool skipSeq) {
error("Invalid sequence opcode %d called from 0x%.04X", seqCode, (uint16)(_seqData - 1 - seqData));
}
- _screen->updateScreen();
+ int extraDelay = _screen->updateScreen();
+ uint32 ct = _system->getMillis();
+ _vm->delayUntil(startFrameCt + extraDelay > ct ? startFrameCt + extraDelay : ct + 8);
}
delete[] _specialBuffer;
_specialBuffer = nullptr;
@@ -679,5 +688,7 @@ bool SeqPlayer::playSequence(const uint8 *seqData, bool skipSeq) {
return seqSkippedFlag;
}
+#undef SEQOP
+#undef KYRA_SEQ_SCREENFRAMEDELAY_MIN
} // End of namespace Kyra
diff --git a/engines/kyra/sequence/sequences_lok.cpp b/engines/kyra/sequence/sequences_lok.cpp
index 3d3aa4e96a9..c0994dae157 100644
--- a/engines/kyra/sequence/sequences_lok.cpp
+++ b/engines/kyra/sequence/sequences_lok.cpp
@@ -213,7 +213,7 @@ bool KyraEngine_LoK::seq_introLogos() {
uint32 now = _system->getMillis();
// The smallest y2 we ever draw the screen for is 65.
- int distance = (now - start) / _tickLength;
+ int distance = (now - start) / (_tickLength << 1);
if (distance > 112) {
distance = 112;
doneFlag = true;
@@ -232,7 +232,7 @@ bool KyraEngine_LoK::seq_introLogos() {
}
oldDistance = distance;
- delay(10);
+ delay(8);
} while (!doneFlag && !shouldQuit() && !_abortIntroFlag);
}
@@ -298,6 +298,8 @@ bool KyraEngine_LoK::seq_introStory() {
_screen->updateScreen();
delay(360 * _tickLength);
+ _sound->beginFadeOut();
+
return _abortIntroFlag;
}
Commit: 8f4fde27e80725e1c816a5e12501e68828ee0665
https://github.com/scummvm/scummvm/commit/8f4fde27e80725e1c816a5e12501e68828ee0665
Author: athrxx (athrxx at scummvm.org)
Date: 2022-03-29T14:17:21+02:00
Commit Message:
KYRA: (EOB) - improve intro (tower scene scrolling)
The original scrolling was rather sloppy, maybe for better performance. I have made it a bit more smooth.
Changed paths:
engines/kyra/sequence/sequences_eob.cpp
diff --git a/engines/kyra/sequence/sequences_eob.cpp b/engines/kyra/sequence/sequences_eob.cpp
index 19787312c3d..eab972ed298 100644
--- a/engines/kyra/sequence/sequences_eob.cpp
+++ b/engines/kyra/sequence/sequences_eob.cpp
@@ -521,8 +521,8 @@ void EoBIntroPlayer::tower() {
displaySubtitle(0, 168, 32, _stringsTower, 0, 17, 22, 0xE1, 0x0F, 2);
printSub(_stringsTower, 1, 13, 24, 0xE1, 0x0F, 2);
- for (int i = 0; i < 64 && !_vm->shouldQuit() && !_vm->skipFlag(); i += 2) {
- uint32 end = _vm->_system->getMillis() + 2 * _vm->_tickLength;
+ for (int i = 0; i < 64 && !_vm->shouldQuit() && !_vm->skipFlag(); ++i) {
+ uint32 end = _vm->_system->getMillis() + _vm->_tickLength;
_screen->copyRegion(0, 142 - i, 96, 0, 128, i + 1, 4, 0, Screen::CR_NO_P_CHECK);
_screen->copyRegion(0, 0, 96, i + 1, 128, 167 - i, 2, 0, Screen::CR_NO_P_CHECK);
_screen->selectPC98Palette(0, _screen->getPalette(0), MIN(i / 4 - 14, 0), true);
@@ -532,22 +532,22 @@ void EoBIntroPlayer::tower() {
_screen->selectPC98Palette(0, _screen->getPalette(0), 0, true);
- for (int i = 0; i < 24 && !_vm->shouldQuit() && !_vm->skipFlag(); i += 2) {
- uint32 end = _vm->_system->getMillis() + 2 * _vm->_tickLength;
- _screen->copyRegion(0, 79 - i, 96, 0, 24, 65 + i, 4, 0, Screen::CR_NO_P_CHECK);
- _screen->copyRegion(104, 79 - i, 200, 0, 24, 65 + i, 4, 0, Screen::CR_NO_P_CHECK);
- _screen->copyRegion(24, 110, 120, i + 31, 80, 34, 4, 0, Screen::CR_NO_P_CHECK);
+ for (int i = 0; i < 23 && !_vm->shouldQuit() && !_vm->skipFlag(); ++i) {
+ uint32 end = _vm->_system->getMillis() + _vm->_tickLength;
+ _screen->copyRegion(0, 78 - i, 96, 0, 24, 65 + i, 4, 0, Screen::CR_NO_P_CHECK);
+ _screen->copyRegion(104, 78 - i, 200, 0, 24, 65 + i, 4, 0, Screen::CR_NO_P_CHECK);
+ _screen->copyRegion(24, 109, 120, i + 31, 80, 34, 4, 0, Screen::CR_NO_P_CHECK);
_screen->copyRegion(152, 0, 120, 32, 80, i + 1, 4, 0, Screen::CR_NO_P_CHECK);
_screen->copyRegion(0, 0, 96, 65 + i, 128, 103 - i, 2, 0, Screen::CR_NO_P_CHECK);
_screen->updateScreen();
_vm->delayUntil(end);
}
- for (int i = 0; i < 56 && !_vm->shouldQuit() && !_vm->skipFlag(); i += 2) {
- uint32 end = _vm->_system->getMillis() + 2 * _vm->_tickLength;
- _screen->copyRegion(0, 56, 96, i, 24, 54, 4, 0, Screen::CR_NO_P_CHECK);
- _screen->copyRegion(104, 56, 200, i, 24, 54, 4, 0, Screen::CR_NO_P_CHECK);
- _screen->copyRegion(0, 110, 96, 54 + i, 128, 34, 4, 0, Screen::CR_NO_P_CHECK);
+ for (int i = 0; i < 56 && !_vm->shouldQuit() && !_vm->skipFlag(); ++i) {
+ uint32 end = _vm->_system->getMillis() + _vm->_tickLength;
+ _screen->copyRegion(0, 55, 96, i, 24, 54, 4, 0, Screen::CR_NO_P_CHECK);
+ _screen->copyRegion(104, 55, 200, i, 24, 54, 4, 0, Screen::CR_NO_P_CHECK);
+ _screen->copyRegion(0, 109, 96, 54 + i, 128, 34, 4, 0, Screen::CR_NO_P_CHECK);
if (i < 32) {
_screen->fillRect(128, 0, 255, i + 1, _fillColor1, 2);
@@ -560,7 +560,7 @@ void EoBIntroPlayer::tower() {
_screen->drawShape(2, _shapes[10], 128, i - 55, 0);
_screen->copyRegion(128, 0, 96, 0, 128, i + 1, 2, 0, Screen::CR_NO_P_CHECK);
- _screen->copyRegion(0, 0, 96, i + 89, 128, 79 - i, 2, 0, Screen::CR_NO_P_CHECK);
+ _screen->copyRegion(0, 0, 96, i + 88, 128, 80 - i, 2, 0, Screen::CR_NO_P_CHECK);
_screen->updateScreen();
_vm->delayUntil(end);
}
More information about the Scummvm-git-logs
mailing list