SCUMM: COMI: Fix some more text/GUI rendering glitches

This commit is contained in:
AndywinXp 2022-07-16 13:39:03 +02:00 committed by Lothar Serra Mari
parent e1f0b5a25d
commit ced78b19d5
4 changed files with 42 additions and 6 deletions

View file

@ -1825,12 +1825,12 @@ void ScummEngine_v6::drawBlastObject(BlastObject *eo) {
void ScummEngine_v6::removeBlastObjects() {
BlastObject *eo;
int i;
eo = _blastObjectQueue;
for (i = 0; i < _blastObjectQueuePos; i++, eo++) {
for (int i = 0; i < _blastObjectQueuePos; i++, eo++) {
removeBlastObject(eo);
}
_blastObjectQueuePos = 0;
}

View file

@ -2384,7 +2384,15 @@ void ScummEngine::scummLoop(int delta) {
scummLoop_handleSaveLoad();
}
// BlastObjects/Texts are removed in this moment of the codepath, in v7-8...
// BlastObjects/Texts are removed in this moment of the codepath, in v7-8.
// V8 should just reset the queue and the rects should be restored somewhere else.
//
// We do that for the texts just after calling runAllScripts(), but this method
// doesn't quite work as well for the blastObjects as it does for the texts, so
// for now we'll have to live with one known glitch: if a system dialog is shown
// on the main menu (i.e. "Do you want to replace this saved game? (Y/N)"), it
// will wipe out all the blastObjects (the empty thumbnail rectangles) for the duration
// of said dialog.
if (_game.version >= 7) {
((ScummEngine_v6 *)this)->removeBlastObjects();
#ifdef ENABLE_SCUMM_7_8
@ -2410,6 +2418,17 @@ void ScummEngine::scummLoop(int delta) {
}
}
// Another v8 quirk: runAllScripts() is called here, after that we can
// finally restore the blastTexts' rects, otherwise if a system dialog
// is shown we will lose all currently displayed blastTexts (see the
// comment above on the removal of blastTexts and blastObjects)
if (_game.version == 8) {
runAllScripts();
#ifdef ENABLE_SCUMM_7_8
((ScummEngine_v7 *)this)->restoreBlastTextsRects();
#endif
}
if (_game.version < 8)
load_game:
scummLoop_handleSaveLoad();
@ -2439,7 +2458,9 @@ load_game:
((SoundHE *)_sound)->processSoundCode();
}
if (_game.version < 8) {
runAllScripts();
}
// SCUMM v7-8 executes checkExecVerbs inside the function
// which processes keyboard inputs, so we handle it above

View file

@ -87,6 +87,7 @@ protected:
Common::Rect _defaultTextClipRect;
Common::Rect _wrappedTextClipRect;
bool _newTextRenderStyle;
int _blastTextRectsQueue = 0;
int _verbLineSpacing;
bool _existLanguageFile;
@ -123,6 +124,7 @@ public:
void CHARSET_1() override;
bool isSmushActive() { return _smushActive; }
void removeBlastTexts() override;
void restoreBlastTextsRects();
protected:

View file

@ -497,14 +497,27 @@ void ScummEngine_v7::drawBlastTexts() {
}
void ScummEngine_v7::removeBlastTexts() {
int i;
if (_game.version == 8) {
if (_blastTextQueuePos != 0)
_blastTextRectsQueue = _blastTextQueuePos;
_blastTextQueuePos = 0;
return;
}
for (i = 0; i < _blastTextQueuePos; i++) {
for (int i = 0; i < _blastTextQueuePos; i++) {
restoreBackground(_blastTextQueue[i].rect);
}
_blastTextQueuePos = 0;
}
void ScummEngine_v7::restoreBlastTextsRects() {
for (int i = 0; i < _blastTextRectsQueue; i++) {
restoreBackground(_blastTextQueue[i].rect);
}
_blastTextRectsQueue = 0;
}
void ScummEngine_v8::printString(int m, const byte *msg) {
if (m == 4) {
const StringTab &st = _string[m];