AGOS: (ELVIRA/PC98/Jp) - more dirty rect handling

Make more use of dirty rect handling (applies to the PC-98 version only, the other versions don't need that).
This commit is contained in:
athrxx 2021-01-14 00:33:21 +01:00
parent 574133086d
commit 8d17584247
7 changed files with 49 additions and 21 deletions

View File

@ -3020,7 +3020,8 @@ void AGOSEngine::windowDrawChar(WindowBlock *window, uint x, uint y, byte chr) {
dst += dstPitch;
} while (--h);
updateBackendSurface();
Common::Rect dirtyRect(x, y, x + 6, y + 8);
updateBackendSurface(&dirtyRect);
_videoLockOut &= ~0x8000;
}

View File

@ -374,7 +374,8 @@ void AGOSEngine::drawStuff(const byte *src, uint xoffs) {
dst += screen->pitch;
}
updateBackendSurface();
Common::Rect dirtyRect(xoffs, y, xoffs + 4, y + 6);
updateBackendSurface(&dirtyRect);
}
void AGOSEngine::playerDamageEvent(VgaTimerEntry * vte, uint dx) {

View File

@ -738,7 +738,7 @@ void AGOSEngine_Simon1::drawImage(VC10_state *state) {
drawVertImage(state);
}
updateBackendSurface();
updateBackendSurface();
}
void AGOSEngine::drawBackGroundImage(VC10_state *state) {
@ -859,7 +859,7 @@ void AGOSEngine::drawImage(VC10_state *state) {
Graphics::Surface *screen = getBackendSurface();
uint16 xoffs = 0, yoffs = 0;
uint16 xoffs = 0, yoffs = 0, xmax = 0, ymax = 0;
if (getGameType() == GType_WW) {
if (_windowNum == 4 || (_windowNum >= 10 && _windowNum <= 27)) {
state->surf_addr = (byte *)_window4BackScn->getPixels();
@ -868,8 +868,8 @@ void AGOSEngine::drawImage(VC10_state *state) {
xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8;
yoffs = (vlut[1] - _videoWindows[17] + state->y);
uint xmax = (xoffs + state->draw_width * 2);
uint ymax = (yoffs + state->draw_height);
xmax = (xoffs + state->draw_width * 2);
ymax = (yoffs + state->draw_height);
setMoveRect(xoffs, yoffs, xmax, ymax);
_window4Flag = 1;
@ -879,6 +879,8 @@ void AGOSEngine::drawImage(VC10_state *state) {
xoffs = (vlut[0] * 2 + state->x) * 8;
yoffs = vlut[1] + state->y;
xmax = (xoffs + state->draw_width * 2);
ymax = (yoffs + state->draw_height);
}
} else if (getGameType() == GType_ELVIRA2) {
if (_windowNum == 4 || _windowNum >= 10) {
@ -888,8 +890,8 @@ void AGOSEngine::drawImage(VC10_state *state) {
xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8;
yoffs = (vlut[1] - _videoWindows[17] + state->y);
uint xmax = (xoffs + state->draw_width * 2);
uint ymax = (yoffs + state->draw_height);
xmax = (xoffs + state->draw_width * 2);
ymax = (yoffs + state->draw_height);
setMoveRect(xoffs, yoffs, xmax, ymax);
_window4Flag = 1;
@ -899,6 +901,8 @@ void AGOSEngine::drawImage(VC10_state *state) {
xoffs = (vlut[0] * 2 + state->x) * 8;
yoffs = vlut[1] + state->y;
xmax = (xoffs + state->draw_width * 2);
ymax = (yoffs + state->draw_height);
}
} else if (getGameType() == GType_ELVIRA1) {
if (_windowNum == 6) {
@ -907,12 +911,16 @@ void AGOSEngine::drawImage(VC10_state *state) {
xoffs = state->x * 8;
yoffs = state->y;
xmax = xoffs + vlut[2] * 16;
ymax = yoffs + vlut[3];
} else if (_windowNum == 2 || _windowNum == 3) {
state->surf_addr = (byte *)screen->getPixels();
state->surf_pitch = screen->pitch;
xoffs = (vlut[0] * 2 + state->x) * 8;
yoffs = vlut[1] + state->y;
xmax = xoffs + state->draw_width * 2;
ymax = yoffs + state->draw_height;
} else {
state->surf_addr = (byte *)_window4BackScn->getPixels();
state->surf_pitch = _videoWindows[18] * 16;
@ -920,8 +928,8 @@ void AGOSEngine::drawImage(VC10_state *state) {
xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8;
yoffs = (vlut[1] - _videoWindows[17] + state->y);
uint xmax = (xoffs + state->draw_width * 2);
uint ymax = (yoffs + state->draw_height);
xmax = (xoffs + state->draw_width * 2);
ymax = (yoffs + state->draw_height);
setMoveRect(xoffs, yoffs, xmax, ymax);
_window4Flag = 1;
@ -951,7 +959,9 @@ void AGOSEngine::drawImage(VC10_state *state) {
drawVertImage(state);
}
updateBackendSurface();
Common::Rect dirtyRect(xoffs, yoffs, xmax, ymax);
updateBackendSurface(&dirtyRect);
}
void AGOSEngine::horizontalScroll(VC10_state *state) {
@ -1527,9 +1537,15 @@ void AGOSEngine::setWindowImage(uint16 mode, uint16 vgaSpriteId, bool specialCas
dst[w] += 0x10;
dst += screen->pitch;
}
if (getPlatform() == Common::kPlatformPC98) {
Common::Rect dirtyRect(0, 133, _screenWidth, _screenHeight);
updateBackendSurface(&dirtyRect);
}
}
updateBackendSurface();
Common::Rect dirtyRect(xoffs, yoffs, xoffs + width, yoffs + _boxStarHeight);
updateBackendSurface(&dirtyRect);
}
_videoLockOut &= ~0x20;

View File

@ -315,8 +315,9 @@ void AGOSEngine_Elvira1::drawIcon(WindowBlock *window, uint icon, uint x, uint y
Graphics::Surface *screen = getBackendSurface();
dst = (byte *)screen->getPixels();
dst += (x + window->x) * 8;
dst += (y * 8 + window->y) * screen->pitch;
x = (x + window->x) * 8;
y = (y * 8 + window->y);
dst += y * screen->pitch + x;
if (getFeatures() & GF_PLANAR) {
src = _iconFilePtr;
@ -328,7 +329,8 @@ void AGOSEngine_Elvira1::drawIcon(WindowBlock *window, uint icon, uint x, uint y
decompressIconPlanar(dst, src, 24, 12, 16, screen->pitch, false);
}
updateBackendSurface();
Common::Rect dirtyRect(x, y, x + 24, y + 12);
updateBackendSurface(&dirtyRect);
_videoLockOut &= ~0x8000;
}
@ -964,7 +966,8 @@ void AGOSEngine::drawArrow(uint16 x, uint16 y, int8 dir) {
dst+= screen->pitch;
}
updateBackendSurface();
Common::Rect dirtyRect(x * 8, y, x * 8 + 16, y + 19);
updateBackendSurface(&dirtyRect);
}
void AGOSEngine_Simon1::removeArrows(WindowBlock *window, uint num) {

View File

@ -179,7 +179,8 @@ void AGOSEngine::unlightMenuStrip() {
for (i = 120; i != 130; i++)
disableBox(i);
updateBackendSurface();
Common::Rect dirtyRect(272, 8, 320, 90);
updateBackendSurface(&dirtyRect);
mouseOn();
}
@ -204,7 +205,8 @@ void AGOSEngine::lightMenuBox(uint hitarea) {
src += screen->pitch;
} while (--h);
updateBackendSurface();
Common::Rect dirtyRect(ha->x, ha->y, ha->x + w, ha->y + ha->height);
updateBackendSurface(&dirtyRect);
mouseOn();
}

View File

@ -1041,7 +1041,8 @@ void AGOSEngine::invertBox(HitArea *ha, byte a, byte b, byte c, byte d) {
src += screen->pitch;
} while (--h);
updateBackendSurface();
Common::Rect dirtyRect(ha->x, ha->y, ha->x + w, ha->y + ha->height);
updateBackendSurface(&dirtyRect);
_videoLockOut &= ~0x8000;
}

View File

@ -178,13 +178,15 @@ void AGOSEngine::colorBlock(WindowBlock *window, uint16 x, uint16 y, uint16 w, u
uint8 color = window->fillColor;
if (getGameType() == GType_ELVIRA2 || getGameType() == GType_WW)
color += dst[0] & 0xF0;
uint16 h2 = h;
do {
memset(dst, color, w);
dst += screen->pitch;
} while (--h);
updateBackendSurface();
Common::Rect dirtyRect(x, y, x + w, y + h2);
updateBackendSurface(&dirtyRect);
_videoLockOut &= ~0x8000;
}
@ -242,6 +244,7 @@ void AGOSEngine::restoreBlock(uint16 x, uint16 y, uint16 w, uint16 h) {
src += y * _backGroundBuf->pitch;
uint8 paletteMod = 0;
uint16 h2 = 2;
if (getGameType() == GType_ELVIRA1 && !(getFeatures() & GF_DEMO) && y >= 133)
paletteMod = 16;
@ -253,7 +256,8 @@ void AGOSEngine::restoreBlock(uint16 x, uint16 y, uint16 w, uint16 h) {
src += _backGroundBuf->pitch;
}
updateBackendSurface();
Common::Rect dirtyRect(x, y, x + w, y + h2);
updateBackendSurface(&dirtyRect);
}
void AGOSEngine::setTextColor(uint color) {