void AGOSEngine::restartAnimation() { if (!(_videoLockOut & 0x10)) return; if (getGameType() != GType_PN) { _window4Flag = 2; setMoveRect(0, 0, 224, 127); displayScreen(); } _videoLockOut &= ~0x10; }
void AGOSEngine_Simon2::clearVideoWindow(uint16 num, uint16 color) { const uint16 *vlut = &_videoWindows[num * 4]; uint16 xoffs = vlut[0] * 16; uint16 yoffs = vlut[1]; uint16 dstWidth = _videoWindows[18] * 16; byte *dst = (byte *)_window4BackScn->pixels + xoffs + yoffs * dstWidth; setMoveRect(0, 0, vlut[2] * 16, vlut[3]); for (uint h = 0; h < vlut[3]; h++) { memset(dst, color, vlut[2] * 16); dst += dstWidth; } _window4Flag = 1; }
void AGOSEngine_Simon2::clearVideoWindow(uint16 num, uint16 color) { const uint16 *vlut = &_videoWindows[num * 4]; uint16 xoffs = vlut[0] * 16; uint16 yoffs = vlut[1]; uint16 dstWidth = _videoWindows[18] * 16; // TODO: Is there any known connection between dstWidth and the pitch // of the _window4BackScn Surface? If so, we might be able to pass // yoffs as proper y parameter to getBasePtr. byte *dst = (byte *)_window4BackScn->getBasePtr(xoffs, 0) + yoffs * dstWidth; setMoveRect(0, 0, vlut[2] * 16, vlut[3]); for (uint h = 0; h < vlut[3]; h++) { memset(dst, color, vlut[2] * 16); dst += dstWidth; } _window4Flag = 1; }
void AGOSEngine::scrollScreen() { byte *dst; const byte *src; uint x, y; dst = getBackGround(); if (_scrollXMax == 0) { uint screenSize = 8 * _screenWidth; if (_scrollFlag < 0) { memmove(dst + screenSize, dst, _scrollWidth * _screenHeight - screenSize); } else { memmove(dst, dst + screenSize, _scrollWidth * _screenHeight - screenSize); } y = _scrollY - 8; if (_scrollFlag > 0) { dst += _screenHeight * _screenWidth - screenSize; y += 488; } src = _scrollImage + y / 2; decodeRow(dst, src + readUint32Wrapper(src), _scrollWidth, _backGroundBuf->pitch); _scrollY += _scrollFlag; vcWriteVar(250, _scrollY); fillBackFromBackGround(_screenHeight, _scrollWidth); } else { if (_scrollFlag < 0) { memmove(dst + 8, dst, _screenWidth * _scrollHeight - 8); } else { memmove(dst, dst + 8, _screenWidth * _scrollHeight - 8); } x = _scrollX; x -= (getGameType() == GType_FF) ? 8 : 1; if (_scrollFlag > 0) { dst += _screenWidth - 8; x += (getGameType() == GType_FF) ? 648 : 41; } if (getGameType() == GType_FF) src = _scrollImage + x / 2; else src = _scrollImage + x * 4; decodeColumn(dst, src + readUint32Wrapper(src), _scrollHeight, _backGroundBuf->pitch); _scrollX += _scrollFlag; vcWriteVar(251, _scrollX); if (getGameType() == GType_SIMON2) { src = getBackGround(); dst = (byte *)_window4BackScn->pixels; for (int i = 0; i < _scrollHeight; i++) { memcpy(dst, src, _screenWidth); src += _backGroundBuf->pitch; dst += _window4BackScn->pitch; } } else { fillBackFromBackGround(_scrollHeight, _screenWidth); } setMoveRect(0, 0, 320, _scrollHeight); _window4Flag = 1; } _scrollFlag = 0; if (getGameType() == GType_SIMON2) { AnimTable *animTable = _screenAnim1; while (animTable->srcPtr) { animTable->srcPtr = 0; animTable++; } VgaSprite *vsp = _vgaSprites; while (vsp->id) { vsp->windowNum |= 0x8000; vsp++; } } }
void AGOSEngine::displayBoxStars() { HitArea *ha, *dha; uint count; uint y_, x_; byte *dst; uint color; o_haltAnimation(); if (getGameType() == GType_SIMON2) color = 236; else color = 225; uint curHeight = (getGameType() == GType_SIMON2) ? _boxStarHeight : 134; for (int i = 0; i < 5; i++) { ha = _hitAreas; count = ARRAYSIZE(_hitAreas); Graphics::Surface *screen = _system->lockScreen(); do { if (ha->id != 0 && ha->flags & kBFBoxInUse && !(ha->flags & kBFBoxDead)) { dha = _hitAreas; if (ha->flags & kBFTextBox) { while (dha != ha && dha->flags != ha->flags) ++dha; if (dha != ha && dha->flags == ha->flags) continue; } else { dha = _hitAreas; while (dha != ha && dha->itemPtr != ha->itemPtr) ++dha; if (dha != ha && dha->itemPtr == ha->itemPtr) continue; } if (ha->y >= curHeight) continue; y_ = (ha->height / 2) - 4 + ha->y; x_ = (ha->width / 2) - 4 + ha->x - (_scrollX * 8); if (x_ >= 311) continue; dst = (byte *)screen->pixels; dst += (((screen->pitch / 4) * y_) * 4) + x_; dst[4] = color; dst += screen->pitch; dst[1] = color; dst[4] = color; dst[7] = color; dst += screen->pitch; dst[2] = color; dst[4] = color; dst[6] = color; dst += screen->pitch; dst[3] = color; dst[5] = color; dst += screen->pitch; dst[0] = color; dst[1] = color; dst[2] = color; dst[6] = color; dst[7] = color; dst[8] = color; dst += screen->pitch; dst[3] = color; dst[5] = color; dst += screen->pitch; dst[2] = color; dst[4] = color; dst[6] = color; dst += screen->pitch; dst[1] = color; dst[4] = color; dst[7] = color; dst += screen->pitch; dst[4] = color; } } while (ha++, --count); _system->unlockScreen(); delay(100); setMoveRect(0, 0, 320, curHeight); _window4Flag = 2; displayScreen(); delay(100); } o_restartAnimation(); }
void AGOSEngine::animateSprites() { VgaSprite *vsp; VgaPointersEntry *vpe; if (_copyScnFlag) { _copyScnFlag--; _vgaSpriteChanged++; } if (getGameType() == GType_ELVIRA1 || getGameType() == GType_ELVIRA2) { const uint8 var = (getGameType() == GType_ELVIRA1) ? 293 : 71; if (_wallOn && !_variableArray[var]) { _wallOn--; VC10_state state; state.srcPtr = getBackGround() + 3 * _backGroundBuf->pitch + 3 * 16; state.height = state.draw_height = 127; state.width = state.draw_width = 14; state.y = 0; state.x = 0; state.palette = 0; state.paletteMod = 0; state.flags = kDFNonTrans; _windowNum = 4; _backFlag = true; drawImage(&state); _backFlag = false; _vgaSpriteChanged++; } } if (!_scrollFlag && !_vgaSpriteChanged) { return; } _vgaSpriteChanged = 0; if (_paletteFlag == 2) _paletteFlag = 1; if (getGameType() == GType_SIMON2 && _scrollFlag) { scrollScreen(); } if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) { dirtyClips(); } restoreBackGround(); vsp = _vgaSprites; for (; vsp->id !=0; vsp++) { if ((getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) && !(vsp->windowNum & 0x8000)) { continue; } vsp->windowNum &= ~0x8000; vpe = &_vgaBufferPointers[vsp->zoneNum]; _curVgaFile1 = vpe->vgaFile1; _curVgaFile2 = vpe->vgaFile2; _curSfxFile = vpe->sfxFile; _windowNum = vsp->windowNum; _vgaCurSpriteId = vsp->id; saveBackGround(vsp); drawImage_init(vsp->image, vsp->palette, vsp->x, vsp->y, vsp->flags); } if (getGameType() == GType_ELVIRA1 && _variableArray[293]) { // Used by the Fire Wall and Ice Wall spells debug(0, "Using special wall"); uint8 color, h, len; byte *dst = (byte *)_window4BackScn->pixels; color = (_variableArray[293] & 1) ? 13 : 15; _wallOn = 2; h = 127; while (h) { len = 112; while (len--) { *dst++ = color; dst++; } h--; if (h == 0) break; len = 112; while (len--) { dst++; *dst++ = color; } h--; } _window4Flag = 1; setMoveRect(0, 0, 224, 127); } else if (getGameType() == GType_ELVIRA2 && _variableArray[71] & 2) { // Used by the Unholy Barrier spell uint8 color, h, len; byte *dst = (byte *)_window4BackScn->pixels; color = 1; _wallOn = 2; h = 43; while (h) { len = 56; while (len--) { *dst++ = color; dst += 3; } h--; if (h == 0) break; dst += 448; len = 56; while (len--) { dst += 2; *dst++ = color; dst += 1; } dst += 448; h--; } _window4Flag = 1; setMoveRect(0, 0, 224, 127); } if (_window6Flag == 1) _window6Flag++; if (_window4Flag == 1) _window4Flag++; _displayFlag++; }