void Screen::slamRect(const Common::Rect &r) { if (r.width() && r.height() > 0) { Common::Rect srcRect = r, destRect = r; destRect.translate(-_currentScroll.x, -_currentScroll.y); if (destRect.left < 0) { srcRect.left += -destRect.left; destRect.left = 0; } if (destRect.top < 0) { srcRect.top += -destRect.top; destRect.top = 0; } if (destRect.right > SHERLOCK_SCREEN_WIDTH) { srcRect.right -= (destRect.left - SHERLOCK_SCREEN_WIDTH); destRect.right = SHERLOCK_SCREEN_WIDTH; } if (destRect.bottom > SHERLOCK_SCREEN_HEIGHT) { srcRect.bottom -= (destRect.bottom - SHERLOCK_SCREEN_HEIGHT); destRect.bottom = SHERLOCK_SCREEN_HEIGHT; } if (srcRect.isValidRect()) blitFrom(*_backBuffer, Common::Point(destRect.left, destRect.top), srcRect); } }
void Screen::randomTransition() { Events &events = *_vm->_events; const int TRANSITION_MULTIPLIER = 0x15a4e35; _dirtyRects.clear(); assert(IS_SERRATED_SCALPEL); for (int idx = 0; idx <= 65535 && !_vm->shouldQuit(); ++idx) { _transitionSeed = _transitionSeed * TRANSITION_MULTIPLIER + 1; int offset = _transitionSeed & 0xFFFF; if (offset < (this->w() * this->h())) *((byte *)getPixels() + offset) = *((const byte *)_backBuffer->getPixels() + offset); if (idx != 0 && (idx % 300) == 0) { // Ensure there's a full screen dirty rect for the next frame update if (_dirtyRects.empty()) addDirtyRect(Common::Rect(0, 0, _surface.w, _surface.h)); events.pollEvents(); events.delay(1); } } // Make sure everything has been transferred blitFrom(*_backBuffer); }
//create this image from another image (tile) void Image::createThisFromImage(Image &image, int tileNum /*=-1*/, int iAlpha /*=-1*/) { cleanUp(); _init = Surface::create(image.tileW(), image.tileH(), iAlpha); //prefill with alpha colour so the final surface contains it where curr see through drawSolidRect(0,0,image.tileW(),image.tileH(), ALPHA_COLOUR); if (-1 == tileNum) setTileSize(); else setTileSize(image.tileW(), image.tileH()); blitFrom(&image, tileNum); //into this newly created 'copy' }
void Screen::verticalTransition() { Events &events = *_vm->_events; byte table[640]; Common::fill(&table[0], &table[640], 0); for (int yp = 0; yp < this->h(); ++yp) { for (int xp = 0; xp < this->w(); ++xp) { int temp = (table[xp] >= (this->h() - 3)) ? this->h() - table[xp] : _vm->getRandomNumber(3) + 1; if (temp) { blitFrom(_backBuffer1, Common::Point(xp, table[xp]), Common::Rect(xp, table[xp], xp + 1, table[xp] + temp)); table[xp] += temp; } } events.delay(10); } }
void UserInterface::setup(InputMode inputMode) { Scene &scene = _vm->_game->_scene; if (_vm->_game->_screenObjects._inputMode != inputMode) { Common::String resName = _vm->_game->_aaName; // Strip off any extension const char *p = strchr(resName.c_str(), '.'); if (p) { resName = Common::String(resName.c_str(), p); } // Add on suffix if necessary if (inputMode != kInputBuildingSentences) resName += "A"; resName += ".INT"; load(resName); blitFrom(_surface); } _vm->_game->_screenObjects._inputMode = inputMode; scene._userInterface._uiSlots.clear(); scene._userInterface._uiSlots.fullRefresh(); _vm->_game->_screenObjects._baseTime = _vm->_events->getFrameCounter(); _highlightedCommandIndex = -1; _highlightedItemVocabIndex = -1; _highlightedInvIndex = -1; if (_vm->_game->_kernelMode == KERNEL_ACTIVE_CODE) scene._userInterface._uiSlots.draw(false, false); scene._action.clear(); drawTextElements(); loadElements(); scene._dynamicHotspots.refresh(); }
void Surface::blitFrom(const Surface &src, const Common::Point &pt, const Common::Rect &srcBounds) { blitFrom(src._surface, pt, srcBounds); }
void Surface::blitFrom(const ImageFrame &src, const Common::Point &pt, const Common::Rect &srcBounds) { blitFrom(src._frame, pt, srcBounds); }
void Surface::blitFrom(const Graphics::Surface &src, const Common::Point &pt) { blitFrom(src, pt, Common::Rect(0, 0, src.w, src.h)); }
void Surface::blitFrom(const ImageFrame &src, const Common::Point &pt) { blitFrom(src._frame, pt, Common::Rect(0, 0, src._frame.w, src._frame.h)); }
void Surface::blitFrom(const Surface &src, const Common::Point &pt) { blitFrom(src, pt, Common::Rect(0, 0, src._surface.w, src._surface.h)); }
void Surface::blitFrom(const Graphics::Surface &src) { blitFrom(src, Common::Point(0, 0)); }
void Surface::blitFrom(const ImageFrame &src) { blitFrom(src._frame, Common::Point(0, 0)); }
void ASurface::copyBuffer(Graphics::Surface *src) { blitFrom(*src); }
void ASurface::transBlitFrom(ASurface &src) { blitFrom(src); }
void BaseSurface::copyBuffer(Graphics::ManagedSurface *src) { blitFrom(*src); }