GOB: fix a black screen after the paint game in some Adibou2 versions

Related to a weird video mode ("0x18"), in which some surfaces must not be reset when re-calling the initScreen() opcode.
This commit is contained in:
Simon Delamarre 2022-12-16 22:16:49 +01:00
parent e79da632b6
commit 0ad57d3c09
3 changed files with 46 additions and 12 deletions

View File

@ -312,6 +312,8 @@ class Draw_v7 : public Draw_Playtoons {
public:
Draw_v7(GobEngine *vm);
~Draw_v7() override;
void initScreen() override;
void animateCursor(int16 cursor) override;

View File

@ -106,6 +106,32 @@ bool Draw_v7::loadCursorFromFile(int cursorIndex) {
return true;
}
void Draw_v7::initScreen()
{
_vm->_game->_preventScroll = false;
_scrollOffsetX = 0;
_scrollOffsetY = 0;
if (!_spritesArray[kBackSurface] || _vm->_global->_videoMode != 0x18) {
initSpriteSurf(kBackSurface, _vm->_video->_surfWidth, _vm->_video->_surfHeight, 0);
_backSurface = _spritesArray[kBackSurface];
_backSurface->clear();
}
if (!_spritesArray[kCursorSurface]) {
initSpriteSurf(kCursorSurface, 32, 16, 2);
_cursorSpritesBack = _spritesArray[kCursorSurface];
_cursorSprites = _cursorSpritesBack;
_scummvmCursor = _vm->_video->initSurfDesc(16, 16, SCUMMVM_CURSOR);
}
_spritesArray[kFrontSurface] = _frontSurface;
_spritesArray[kBackSurface ] = _backSurface;
_vm->_video->dirtyRectsAll();
}
void Draw_v7::animateCursor(int16 cursor) {
if (!_cursorSprites)
return;

View File

@ -485,7 +485,8 @@ void Inter_v7::o7_initScreen() {
if (videoMode == 0)
videoMode = 0x14;
_vm->_video->clearScreen();
if (videoMode != 0x18)
_vm->_video->clearScreen();
if (videoMode == 0x13) {
@ -540,25 +541,30 @@ void Inter_v7::o7_initScreen() {
_vm->_global->_mouseMaxY = (_vm->_video->_surfHeight + _vm->_video->_screenDeltaY) - offY - 1;
_vm->_global->_mouseMinY = _vm->_video->_screenDeltaY;
_vm->_draw->closeScreen();
_vm->_util->clearPalette();
memset(_vm->_global->_redPalette, 0, 256);
memset(_vm->_global->_greenPalette, 0, 256);
memset(_vm->_global->_bluePalette, 0, 256);
_vm->_video->_splitSurf.reset();
_vm->_draw->_spritesArray[24].reset();
_vm->_draw->_spritesArray[25].reset();
if (videoMode != 0x18)
{
_vm->_draw->closeScreen();
_vm->_util->clearPalette();
memset(_vm->_global->_redPalette, 0, 256);
memset(_vm->_global->_greenPalette, 0, 256);
memset(_vm->_global->_bluePalette, 0, 256);
_vm->_video->_splitSurf.reset();
_vm->_draw->_spritesArray[24].reset();
_vm->_draw->_spritesArray[25].reset();
}
_vm->_global->_videoMode = videoMode;
_vm->_video->initPrimary(videoMode);
if (videoMode != 0x18)
_vm->_video->initPrimary(videoMode);
WRITE_VAR(15, _vm->_global->_fakeVideoMode);
_vm->_global->_setAllPalette = true;
_vm->_util->setMousePos(_vm->_global->_inter_mouseX,
_vm->_global->_inter_mouseY);
_vm->_util->clearPalette();
if (videoMode != 0x18)
_vm->_util->clearPalette();
_vm->_draw->initScreen();