mirror of
https://github.com/libretro/scummvm.git
synced 2024-11-30 21:00:39 +00:00
SCI: implemented additional drawCel for hires views, fixes menu bar of kq6 - still need to fix coordinates and implement save/restoreBits for hires
svn-id: r47116
This commit is contained in:
parent
5b063e2d93
commit
519e80ca8b
@ -368,7 +368,7 @@ void SciGuiAnimate::drawCels() {
|
||||
}
|
||||
|
||||
// draw corresponding cel
|
||||
_gfx->drawCel(listEntry->viewId, listEntry->loopNo, listEntry->celNo, listEntry->celRect, listEntry->priority, listEntry->paletteNo, -1, scaleX, scaleY);
|
||||
_gfx->drawCel(listEntry->viewId, listEntry->loopNo, listEntry->celNo, listEntry->celRect, listEntry->priority, listEntry->paletteNo, scaleX, scaleY);
|
||||
listEntry->showBitsFlag = true;
|
||||
|
||||
if (signal & kSignalRemoveView) {
|
||||
|
@ -329,35 +329,36 @@ void Gfx::drawPicture(GuiResourceId pictureId, int16 animationNr, bool mirroredF
|
||||
}
|
||||
|
||||
// This one is the only one that updates screen!
|
||||
void Gfx::drawCelAndShow(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, int16 origHeight, uint16 scaleX, uint16 scaleY) {
|
||||
void Gfx::drawCelAndShow(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, uint16 scaleX, uint16 scaleY) {
|
||||
View *view = getView(viewId);
|
||||
Common::Rect rect;
|
||||
Common::Rect celRect;
|
||||
|
||||
if (view) {
|
||||
rect.left = leftPos;
|
||||
rect.top = topPos;
|
||||
rect.right = rect.left + view->getWidth(loopNo, celNo);
|
||||
rect.bottom = rect.top + view->getHeight(loopNo, celNo);
|
||||
celRect.left = leftPos;
|
||||
celRect.top = topPos;
|
||||
celRect.right = celRect.left + view->getWidth(loopNo, celNo);
|
||||
celRect.bottom = celRect.top + view->getHeight(loopNo, celNo);
|
||||
|
||||
drawCel(view, loopNo, celNo, rect, priority, paletteNo, origHeight, scaleX, scaleY);
|
||||
drawCel(view, loopNo, celNo, celRect, priority, paletteNo, scaleX, scaleY);
|
||||
|
||||
if (getSciVersion() >= SCI_VERSION_1_1) {
|
||||
if (!_screen->_picNotValidSci11)
|
||||
BitsShow(rect);
|
||||
if (!_screen->_picNotValidSci11) {
|
||||
BitsShow(celRect);
|
||||
}
|
||||
} else {
|
||||
if (!_screen->_picNotValid)
|
||||
BitsShow(rect);
|
||||
BitsShow(celRect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This version of drawCel is not supposed to call BitsShow()!
|
||||
void Gfx::drawCel(GuiResourceId viewId, int16 loopNo, int16 celNo, Common::Rect celRect, byte priority, uint16 paletteNo, int16 origHeight, uint16 scaleX, uint16 scaleY) {
|
||||
drawCel(getView(viewId), loopNo, celNo, celRect, priority, paletteNo, origHeight, scaleX, scaleY);
|
||||
void Gfx::drawCel(GuiResourceId viewId, int16 loopNo, int16 celNo, Common::Rect celRect, byte priority, uint16 paletteNo, uint16 scaleX, uint16 scaleY) {
|
||||
drawCel(getView(viewId), loopNo, celNo, celRect, priority, paletteNo, scaleX, scaleY);
|
||||
}
|
||||
|
||||
// This version of drawCel is not supposed to call BitsShow()!
|
||||
void Gfx::drawCel(View *view, int16 loopNo, int16 celNo, Common::Rect celRect, byte priority, uint16 paletteNo, int16 origHeight, uint16 scaleX, uint16 scaleY) {
|
||||
void Gfx::drawCel(View *view, int16 loopNo, int16 celNo, Common::Rect celRect, byte priority, uint16 paletteNo, uint16 scaleX, uint16 scaleY) {
|
||||
Common::Rect clipRect = celRect;
|
||||
clipRect.clip(_curPort->rect);
|
||||
if (clipRect.isEmpty()) // nothing to draw
|
||||
@ -365,7 +366,38 @@ void Gfx::drawCel(View *view, int16 loopNo, int16 celNo, Common::Rect celRect, b
|
||||
|
||||
Common::Rect clipRectTranslated = clipRect;
|
||||
OffsetRect(clipRectTranslated);
|
||||
view->draw(celRect, clipRect, clipRectTranslated, loopNo, celNo, priority, paletteNo, origHeight, scaleX, scaleY);
|
||||
view->draw(celRect, clipRect, clipRectTranslated, loopNo, celNo, priority, paletteNo, false, scaleX, scaleY);
|
||||
}
|
||||
|
||||
// This is used as replacement for drawCelAndShow() when hires-cels are drawn to screen
|
||||
// Hires-cels are available only SCI 1.1+
|
||||
void Gfx::drawHiresCelAndShow(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, uint16 scaleX, uint16 scaleY) {
|
||||
View *view = getView(viewId);
|
||||
Common::Rect celRect, curPortRect, clipRect, clipRectTranslated;
|
||||
|
||||
if (view) {
|
||||
celRect.left = leftPos;
|
||||
celRect.top = topPos;
|
||||
celRect.right = celRect.left + view->getWidth(loopNo, celNo);
|
||||
celRect.bottom = celRect.top + view->getHeight(loopNo, celNo);
|
||||
// adjust curPort to upscaled hires
|
||||
clipRect = celRect;
|
||||
curPortRect = _curPort->rect;
|
||||
curPortRect.top *= 2; curPortRect.bottom *= 2;
|
||||
curPortRect.left *= 2; curPortRect.right *= 2;
|
||||
clipRect.clip(curPortRect);
|
||||
if (clipRect.isEmpty()) // nothing to draw
|
||||
return;
|
||||
|
||||
clipRectTranslated = clipRect;
|
||||
clipRectTranslated.top += curPortRect.top; clipRectTranslated.bottom += curPortRect.top;
|
||||
clipRectTranslated.left += curPortRect.left; clipRectTranslated.right += curPortRect.left;
|
||||
|
||||
view->draw(celRect, clipRect, clipRectTranslated, loopNo, celNo, priority, paletteNo, true, scaleX, scaleY);
|
||||
if (!_screen->_picNotValidSci11) {
|
||||
_screen->copyDisplayRectToScreen(clipRectTranslated);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint16 Gfx::onControl(uint16 screenMask, Common::Rect rect) {
|
||||
|
@ -84,9 +84,10 @@ public:
|
||||
void BitsFree(reg_t memoryHandle);
|
||||
|
||||
void drawPicture(GuiResourceId pictureId, int16 animationNr, bool mirroredFlag, bool addToFlag, GuiResourceId paletteId);
|
||||
void drawCelAndShow(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, int16 origHeight = -1, uint16 scaleX = 128, uint16 scaleY = 128);
|
||||
void drawCel(GuiResourceId viewId, int16 loopNo, int16 celNo, Common::Rect celRect, byte priority, uint16 paletteNo, int16 origHeight = -1, uint16 scaleX = 128, uint16 scaleY = 128);
|
||||
void drawCel(View *view, int16 loopNo, int16 celNo, Common::Rect celRect, byte priority, uint16 paletteNo, int16 origHeight = -1, uint16 scaleX = 128, uint16 scaleY = 128);
|
||||
void drawCelAndShow(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, uint16 scaleX = 128, uint16 scaleY = 128);
|
||||
void drawCel(GuiResourceId viewId, int16 loopNo, int16 celNo, Common::Rect celRect, byte priority, uint16 paletteNo, uint16 scaleX = 128, uint16 scaleY = 128);
|
||||
void drawCel(View *view, int16 loopNo, int16 celNo, Common::Rect celRect, byte priority, uint16 paletteNo, uint16 scaleX = 128, uint16 scaleY = 128);
|
||||
void drawHiresCelAndShow(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, uint16 scaleX = 128, uint16 scaleY = 128);
|
||||
|
||||
uint16 onControl(uint16 screenMask, Common::Rect rect);
|
||||
|
||||
|
@ -368,7 +368,10 @@ void SciGui::drawPicture(GuiResourceId pictureId, int16 animationNr, bool animat
|
||||
}
|
||||
|
||||
void SciGui::drawCel(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, int16 priority, uint16 paletteNo, int16 origHeight) {
|
||||
_gfx->drawCelAndShow(viewId, loopNo, celNo, leftPos, topPos, priority, paletteNo, origHeight);
|
||||
if (origHeight == -1)
|
||||
_gfx->drawCelAndShow(viewId, loopNo, celNo, leftPos, topPos, priority, paletteNo);
|
||||
else
|
||||
_gfx->drawHiresCelAndShow(viewId, loopNo, celNo, leftPos, topPos, priority, paletteNo);
|
||||
_palette->setOnScreen();
|
||||
}
|
||||
|
||||
|
@ -460,7 +460,7 @@ void View::unditherBitmap(byte *bitmapPtr, int16 width, int16 height, byte clear
|
||||
}
|
||||
}
|
||||
|
||||
void View::draw(Common::Rect rect, Common::Rect clipRect, Common::Rect clipRectTranslated, int16 loopNo, int16 celNo, byte priority, uint16 EGAmappingNr, int16 origHeight, uint16 scaleX, uint16 scaleY) {
|
||||
void View::draw(Common::Rect rect, Common::Rect clipRect, Common::Rect clipRectTranslated, int16 loopNo, int16 celNo, byte priority, uint16 EGAmappingNr, bool upscaledHires, uint16 scaleX, uint16 scaleY) {
|
||||
Palette *palette = _embeddedPal ? &_viewPalette : &_palette->_sysPalette;
|
||||
CelInfo *celInfo = getCelInfo(loopNo, celNo);
|
||||
byte *bitmap = getBitmap(loopNo, celNo);
|
||||
@ -487,7 +487,8 @@ void View::draw(Common::Rect rect, Common::Rect clipRect, Common::Rect clipRectT
|
||||
for (x = 0; x < width; x++) {
|
||||
color = bitmap[x];
|
||||
if (color != clearKey && priority >= _screen->getPriority(clipRectTranslated.left + x, clipRectTranslated.top + y)) {
|
||||
if (origHeight == -1) // HACK: this parameter is passed for already scaled views, but we're not actually using it
|
||||
// UpscaledHires means view is hires and is supposed to get drawn onto lowres screen
|
||||
if (!upscaledHires)
|
||||
_screen->putPixel(clipRectTranslated.left + x, clipRectTranslated.top + y, drawMask, palette->mapping[color], priority, 0);
|
||||
else
|
||||
_screen->putPixelOnDisplay(clipRectTranslated.left + x, clipRectTranslated.top + y, palette->mapping[color]);
|
||||
|
@ -60,7 +60,7 @@ public:
|
||||
LoopInfo *getLoopInfo(int16 loopNo);
|
||||
void getCelRect(int16 loopNo, int16 celNo, int16 x, int16 y, int16 z, Common::Rect *outRect);
|
||||
byte *getBitmap(int16 loopNo, int16 celNo);
|
||||
void draw(Common::Rect rect, Common::Rect clipRect, Common::Rect clipRectTranslated, int16 loopNo, int16 celNo, byte priority, uint16 EGAmappingNr, int16 origHeight = -1, uint16 scaleX = 128, uint16 scaleY = 128);
|
||||
void draw(Common::Rect rect, Common::Rect clipRect, Common::Rect clipRectTranslated, int16 loopNo, int16 celNo, byte priority, uint16 EGAmappingNr, bool upscaledHires, uint16 scaleX = 128, uint16 scaleY = 128);
|
||||
uint16 getLoopCount() const { return _loopCount; }
|
||||
uint16 getCelCount(int16 loopNo) { return _loop[loopNo].celCount; }
|
||||
Palette *getPalette();
|
||||
|
Loading…
Reference in New Issue
Block a user