void AGOSEngine::clearSurfaces() { _system->fillScreen(0); if (_backBuf) { memset(getBackBuf(), 0, _backBuf->h * _backBuf->pitch); } }
void AGOSEngine_Feeble::oracleLogo() { Common::Rect srcRect, dstRect; byte *src, *dst; uint16 w, h; dstRect.left = 16; dstRect.top = 16; dstRect.right = 58; dstRect.bottom = 59; srcRect.left = 0; srcRect.top = 0; srcRect.right = 42; srcRect.bottom = 43; src = _iconFilePtr; dst = getBackBuf() + _backBuf->pitch * dstRect.top + dstRect.left; for (h = 0; h < dstRect.height(); h++) { for (w = 0; w < dstRect.width(); w++) { if (src[w]) dst[w] = src[w]; } src += 336; dst += _backBuf->pitch; } }
void AGOSEngine::clearSurfaces() { _system->fillScreen(0); if (_backBuf) { memset(getBackBuf(), 0, _backBuf->getHeight() * _backBuf->getPitch()); } }
void AGOSEngine::fillBackGroundFromBack() { byte *src = getBackBuf(); byte *dst = getBackGround(); for (int i = 0; i < _screenHeight; i++) { memcpy(dst, src, _screenWidth); src += _backBuf->pitch; dst += _backGroundBuf->pitch; } }
void AGOSEngine::fillBackFromBackGround(uint16 height, uint16 width) { byte *src = getBackGround(); byte *dst = getBackBuf(); for (int i = 0; i < height; i++) { memcpy(dst, src, width); src += _backGroundBuf->pitch; dst += _backBuf->pitch; } }
void AGOSEngine::fillBackFromFront() { Graphics::Surface *screen = _system->lockScreen(); byte *src = (byte *)screen->pixels; byte *dst = getBackBuf(); for (int i = 0; i < _screenHeight; i++) { memcpy(dst, src, _screenWidth); src += screen->pitch; dst += _backBuf->pitch; } _system->unlockScreen(); }
void AGOSEngine_Feeble::swapCharacterLogo() { Common::Rect srcRect, dstRect; byte *src, *dst; uint16 w, h; int x; dstRect.left = 64; dstRect.top = 16; dstRect.right = 106; dstRect.bottom = 59; srcRect.top = 0; srcRect.bottom = 43; x = _variableArray[91]; if (x > _variableArray[90]) x--; if (x < _variableArray[90]) x++; _variableArray[91] = x; x++; x *= 42; srcRect.left = x; srcRect.right = srcRect.left + 42; src = _iconFilePtr + srcRect.top * 336 + srcRect.left; dst = getBackBuf() + _backBuf->pitch * dstRect.top + dstRect.left; for (h = 0; h < dstRect.height(); h++) { for (w = 0; w < dstRect.width(); w++) { if (src[w]) dst[w] = src[w]; } src += 336; dst += _backBuf->pitch; } }
void AGOSEngine::displayScreen() { if (_fastFadeInFlag == 0 && _paletteFlag == 1) { _paletteFlag = 0; if (memcmp(_displayPalette, _currentPalette, sizeof(_currentPalette))) { memcpy(_currentPalette, _displayPalette, sizeof(_displayPalette)); _system->getPaletteManager()->setPalette(_displayPalette, 0, 256); } } Graphics::Surface *screen = _system->lockScreen(); if (getGameType() == GType_PP || getGameType() == GType_FF) { byte *src = getBackBuf(); byte *dst = (byte *)screen->pixels; for (int i = 0; i < _screenHeight; i++) { memcpy(dst, src, _screenWidth); src += _backBuf->pitch; dst += screen->pitch; } if (getGameId() != GID_DIMP) fillBackFromBackGround(_screenHeight, _screenWidth); } else { if (_window4Flag == 2) { _window4Flag = 0; uint16 srcWidth, width, height; byte *dst = (byte *)screen->pixels; const byte *src = (const byte *)_window4BackScn->pixels; if (_window3Flag == 1) { src = getBackGround(); } dst += (_moveYMin + _videoWindows[17]) * screen->pitch; dst += (_videoWindows[16] * 16) + _moveXMin; src += (_videoWindows[18] * 16 * _moveYMin); src += _moveXMin; srcWidth = _videoWindows[18] * 16; width = _moveXMax - _moveXMin; height = _moveYMax - _moveYMin; for (; height > 0; height--) { memcpy(dst, src, width); dst += screen->pitch; src += srcWidth; } _moveXMin = 0xFFFF; _moveYMin = 0xFFFF; _moveXMax = 0; _moveYMax = 0; } if (_window6Flag == 2) { _window6Flag = 0; byte *src = (byte *)_window6BackScn->pixels; byte *dst = (byte *)screen->pixels + 51 * screen->pitch; for (int i = 0; i < 80; i++) { memcpy(dst, src, _window6BackScn->w); dst += screen->pitch; src += _window6BackScn->pitch; } } } _system->unlockScreen(); if (getGameType() == GType_FF && _scrollFlag) { scrollScreen(); } if (_fastFadeInFlag) { fastFadeIn(); } }
void AGOSEngine_Feeble::drawImage(VC10_state *state) { state->surf_addr = getBackBuf(); state->surf_pitch = _backBuf->pitch; if (state->flags & kDFCompressed) { if (state->flags & kDFScaled) { state->surf_addr = getScaleBuf(); state->surf_pitch = _scaleBuf->pitch; uint w, h; byte *src, *dst, *dstPtr; state->dl = state->width; state->dh = state->height; dstPtr = state->surf_addr; w = 0; do { src = vc10_depackColumn(state); dst = dstPtr; h = 0; do { *dst = *src; dst += state->surf_pitch; src++; } while (++h != state->draw_height); dstPtr++; } while (++w != state->draw_width); if (_vgaCurSpritePriority % 10 != 9) { _scaleX = state->x; _scaleY = state->y; _scaleWidth = state->width; _scaleHeight = state->height; } else { scaleClip(state->height, state->width, state->y, state->x, state->y + _scrollY); } } else if (state->flags & kDFOverlayed) { state->surf_addr = getScaleBuf(); state->surf_pitch = _scaleBuf->pitch; state->surf_addr += (state->x + _scrollX) + (state->y + _scrollY) * state->surf_pitch; uint w, h; byte *src, *dst, *dstPtr; state->dl = state->width; state->dh = state->height; dstPtr = state->surf_addr; w = 0; do { byte color; src = vc10_depackColumn(state); dst = dstPtr; h = 0; do { color = *src; if (color != 0) *dst = color; dst += state->surf_pitch; src++; } while (++h != state->draw_height); dstPtr++; } while (++w != state->draw_width); if (_vgaCurSpritePriority % 10 == 9) { scaleClip(_scaleHeight, _scaleWidth, _scaleY, _scaleX, _scaleY + _scrollY); } } else { if (!drawImage_clip(state)) { return; } state->surf_addr += state->x + state->y * state->surf_pitch; uint w, h; byte *src, *dst, *dstPtr; state->dl = state->width; state->dh = state->height; vc10_skip_cols(state); if (state->flags & kDFMasked) { if (getGameType() == GType_FF && !getBitFlag(81)) { if (state->x > _feebleRect.right) { return; } if (state->y > _feebleRect.bottom) { return; } if (state->x + state->width < _feebleRect.left) { return; } if (state->y + state->height < _feebleRect.top) { return; } } dstPtr = state->surf_addr; w = 0; do { byte color; src = vc10_depackColumn(state); dst = dstPtr; h = 0; do { color = *src; if (color) *dst = color; dst += state->surf_pitch; src++; } while (++h != state->draw_height); dstPtr++; } while (++w != state->draw_width); } else { dstPtr = state->surf_addr; w = 0; do { byte color; src = vc10_depackColumn(state); dst = dstPtr; h = 0; do { color = *src; if ((state->flags & kDFNonTrans) || color != 0) *dst = color; dst += state->surf_pitch; src++; } while (++h != state->draw_height); dstPtr++; } while (++w != state->draw_width); } } } else { if (!drawImage_clip(state)) { return; } state->surf_addr += state->x + state->y * state->surf_pitch; const byte *src; byte *dst; uint count; src = state->srcPtr + state->width * state->y_skip; dst = state->surf_addr; do { for (count = 0; count != state->draw_width; count++) { byte color; color = src[count + state->x_skip]; if (color) { if ((state->flags & kDFShaded) && color == 220) color = 244; dst[count] = color; } } dst += state->surf_pitch; src += state->width; } while (--state->draw_height); } }
void AGOSEngine_Feeble::scaleClip(int16 h, int16 w, int16 y, int16 x, int16 scrollY) { Common::Rect srcRect, dstRect; float factor, xscale; srcRect.left = 0; srcRect.top = 0; srcRect.right = w; srcRect.bottom = h; if (scrollY > _baseY) factor = 1 + ((scrollY - _baseY) * _scale); else factor = 1 - ((_baseY - scrollY) * _scale); xscale = ((w * factor) / 2); dstRect.left = (int16)(x - xscale); if (dstRect.left > _screenWidth - 1) return; dstRect.top = (int16)(y - (h * factor)); if (dstRect.top > _screenHeight - 1) return; dstRect.right = (int16)(x + xscale); dstRect.bottom = y; _feebleRect = dstRect; _variableArray[20] = _feebleRect.top; _variableArray[21] = _feebleRect.left; _variableArray[22] = _feebleRect.bottom; _variableArray[23] = _feebleRect.right; debug(5, "Left %d Right %d Top %d Bottom %d", dstRect.left, dstRect.right, dstRect.top, dstRect.bottom); // Unlike normal rectangles in ScummVM, it seems that in the case of // the destination rectangle the bottom and right coordinates are // considered to be inside the rectangle. For the source rectangle, // I believe that they are not. int scaledW = dstRect.width() + 1; int scaledH = dstRect.height() + 1; byte *src = getScaleBuf(); byte *dst = getBackBuf(); dst += dstRect.top * _backBuf->pitch + dstRect.left; for (int dstY = 0; dstY < scaledH; dstY++) { if (dstRect.top + dstY >= 0 && dstRect.top + dstY < _screenHeight) { int srcY = (dstY * h) / scaledH; byte *srcPtr = src + _scaleBuf->pitch * srcY; byte *dstPtr = dst + _backBuf->pitch * dstY; for (int dstX = 0; dstX < scaledW; dstX++) { if (dstRect.left + dstX >= 0 && dstRect.left + dstX < _screenWidth) { int srcX = (dstX * w) / scaledW; if (srcPtr[srcX]) dstPtr[dstX] = srcPtr[srcX]; } } } } }