void GfxFrameout::deletePlanePictures(reg_t object) { for (PlanePictureList::iterator it = _planePictures.begin(); it != _planePictures.end(); it++) { if (it->object == object) { delete it->picture; _planePictures.erase(it); deletePlanePictures(object); return; } } }
void GfxFrameout::kernelDeletePlane(reg_t object) { deletePlaneItems(object); deletePlanePictures(object); for (PlaneList::iterator it = _planes.begin(); it != _planes.end(); ++it) { if (it->object == object) { _planes.erase(it); Common::Rect planeRect; planeRect.top = readSelectorValue(_segMan, object, SELECTOR(top)); planeRect.left = readSelectorValue(_segMan, object, SELECTOR(left)); planeRect.bottom = readSelectorValue(_segMan, object, SELECTOR(bottom)); planeRect.right = readSelectorValue(_segMan, object, SELECTOR(right)); _coordAdjuster->fromScriptToDisplay(planeRect.top, planeRect.left); _coordAdjuster->fromScriptToDisplay(planeRect.bottom, planeRect.right); // Blackout removed plane rect _paint32->fillRect(planeRect, 0); return; } } }
void GfxFrameout::kernelDeletePlane(reg_t object) { deletePlanePictures(object); for (PlaneList::iterator it = _planes.begin(); it != _planes.end(); it++) { if (it->object == object) { _planes.erase(it); Common::Rect planeRect; planeRect.top = readSelectorValue(_segMan, object, SELECTOR(top)); planeRect.left = readSelectorValue(_segMan, object, SELECTOR(left)); planeRect.bottom = readSelectorValue(_segMan, object, SELECTOR(bottom)) + 1; planeRect.right = readSelectorValue(_segMan, object, SELECTOR(right)) + 1; Common::Rect screenRect(_screen->getWidth(), _screen->getHeight()); planeRect.top = (planeRect.top * screenRect.height()) / scriptsRunningHeight; planeRect.left = (planeRect.left * screenRect.width()) / scriptsRunningWidth; planeRect.bottom = (planeRect.bottom * screenRect.height()) / scriptsRunningHeight; planeRect.right = (planeRect.right * screenRect.width()) / scriptsRunningWidth; planeRect.clip(screenRect); // we need to do this, at least in gk1 on cemetary we get bottom right -> 201, 321 // Blackout removed plane rect _paint32->fillRect(planeRect, 0); return; } } }
void GfxFrameout::kernelUpdatePlane(reg_t object) { for (PlaneList::iterator it = _planes.begin(); it != _planes.end(); ++it) { if (it->object == object) { // Read some information it->priority = readSelectorValue(_segMan, object, SELECTOR(priority)); GuiResourceId lastPictureId = it->pictureId; it->pictureId = readSelectorValue(_segMan, object, SELECTOR(picture)); if (lastPictureId != it->pictureId) { // picture got changed, load new picture deletePlanePictures(object); // Draw the plane's picture if it's not a translucent/plane colored frame if ((it->pictureId != kPlanePlainColored) && (it->pictureId != kPlaneTranslucent)) { // SQ6 gives us a bad picture number for the control menu if (_resMan->testResource(ResourceId(kResourceTypePic, it->pictureId))) addPlanePicture(object, it->pictureId, 0); } } it->planeRect.top = readSelectorValue(_segMan, object, SELECTOR(top)); it->planeRect.left = readSelectorValue(_segMan, object, SELECTOR(left)); it->planeRect.bottom = readSelectorValue(_segMan, object, SELECTOR(bottom)); it->planeRect.right = readSelectorValue(_segMan, object, SELECTOR(right)); _coordAdjuster->fromScriptToDisplay(it->planeRect.top, it->planeRect.left); _coordAdjuster->fromScriptToDisplay(it->planeRect.bottom, it->planeRect.right); // We get negative left in kq7 in scrolling rooms if (it->planeRect.left < 0) { it->planeOffsetX = -it->planeRect.left; it->planeRect.left = 0; } else { it->planeOffsetX = 0; } if (it->planeRect.top < 0) { it->planeOffsetY = -it->planeRect.top; it->planeRect.top = 0; } else { it->planeOffsetY = 0; } // We get bad plane-bottom in sq6 if (it->planeRect.right > _screen->getWidth()) it->planeRect.right = _screen->getWidth(); if (it->planeRect.bottom > _screen->getHeight()) it->planeRect.bottom = _screen->getHeight(); it->planeClipRect = Common::Rect(it->planeRect.width(), it->planeRect.height()); it->upscaledPlaneRect = it->planeRect; it->upscaledPlaneClipRect = it->planeClipRect; if (_screen->getUpscaledHires()) { _screen->adjustToUpscaledCoordinates(it->upscaledPlaneRect.top, it->upscaledPlaneRect.left); _screen->adjustToUpscaledCoordinates(it->upscaledPlaneRect.bottom, it->upscaledPlaneRect.right); _screen->adjustToUpscaledCoordinates(it->upscaledPlaneClipRect.top, it->upscaledPlaneClipRect.left); _screen->adjustToUpscaledCoordinates(it->upscaledPlaneClipRect.bottom, it->upscaledPlaneClipRect.right); } it->planePictureMirrored = readSelectorValue(_segMan, object, SELECTOR(mirrored)); it->planeBack = readSelectorValue(_segMan, object, SELECTOR(back)); sortPlanes(); // Update the items in the plane for (FrameoutList::iterator listIterator = _screenItems.begin(); listIterator != _screenItems.end(); listIterator++) { reg_t itemPlane = readSelector(_segMan, (*listIterator)->object, SELECTOR(plane)); if (object == itemPlane) { kernelUpdateScreenItem((*listIterator)->object); } } return; } } error("kUpdatePlane called on plane that wasn't added before"); }