mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-02-21 19:10:50 +00:00
- made the vertical scroller widescreen aware as well.
# Conflicts: # src/intermission/intermission.cpp
This commit is contained in:
parent
fbd2b05d36
commit
51f9e158f2
1 changed files with 86 additions and 82 deletions
|
@ -730,101 +730,105 @@ void DIntermissionScreenScroller::Drawer ()
|
|||
{
|
||||
FTexture *tex = TexMan[mFirstPic];
|
||||
FTexture *tex2 = TexMan[mSecondPic];
|
||||
//if (mTicker >= mScrollDelay && mTicker < mScrollDelay + mScrollTime && tex != nullptr && tex2 != nullptr)
|
||||
|
||||
// These must round down to the nearest full pixel to cover seams between the two textures.
|
||||
int fwidth = (int)tex->GetScaledWidth();
|
||||
int fheight = (int)tex->GetScaledHeight();
|
||||
int fwidth2 = (int)tex2->GetScaledWidth();
|
||||
int fheight2 = (int)tex2->GetScaledHeight();
|
||||
|
||||
double xpos1 = 0, ypos1 = 0, xpos2 = 0, ypos2 = 0;
|
||||
|
||||
int aheight = fheight == 200 ? 240 : fheight == 400 ? 480 : fheight;
|
||||
DoubleRect drect;
|
||||
|
||||
if (mScrollDir == SCROLL_Left || mScrollDir == SCROLL_Right)
|
||||
{
|
||||
int fwidth2 = (int)tex2->GetScaledWidth();
|
||||
int fheight2 = (int)tex2->GetScaledHeight();
|
||||
// guesstimate the intended aspect ratio.
|
||||
int awidth = aheight * 4 / 3;
|
||||
int atotalwidth = fwidth + fwidth2;
|
||||
int sidespace = (atotalwidth - 2*awidth);
|
||||
// Now set a clipping rectangle for the intended viewport
|
||||
double displayratio = atotalwidth / double(aheight) - 4./3.;
|
||||
double displaywidth = aheight * displayratio;
|
||||
screen->CalcFullscreenScale(displaywidth, aheight, gameinfo.fullscreenautoaspect, drect);
|
||||
screen->SetClipRect(int(drect.left), int(drect.top), int(drect.width), int(drect.height));
|
||||
|
||||
int fwidth = tex->GetScaledWidth();
|
||||
int fheight = tex->GetScaledHeight();
|
||||
int ticker = clamp(mTicker - mScrollDelay, 0, mScrollTime);
|
||||
|
||||
double xpos1 = 0, ypos1 = 0, xpos2 = 0, ypos2 = 0;
|
||||
|
||||
if (mScrollDir == SCROLL_Left || mScrollDir == SCROLL_Right)
|
||||
switch (mScrollDir)
|
||||
{
|
||||
// guesstimate the intended aspect ratio.
|
||||
int aheight = fheight == 200 ? 240 : fheight == 400 ? 480 : fheight;
|
||||
int awidth = aheight * 4 / 3;
|
||||
int atotalwidth = fwidth + fwidth2;
|
||||
int sidespace = (atotalwidth - 2*awidth);
|
||||
// Now set a clipping rectangle for the intended viewport
|
||||
double displayratio = atotalwidth / double(aheight) - 4./3.;
|
||||
double displaywidth = aheight * displayratio;
|
||||
DoubleRect drect;
|
||||
screen->CalcFullscreenScale(displaywidth, aheight, gameinfo.fullscreenautoaspect, drect);
|
||||
screen->SetClipRect(int(drect.left), int(drect.top), int(drect.width), int(drect.height));
|
||||
case SCROLL_Left:
|
||||
default:
|
||||
xpos2 = -awidth + double(ticker) * awidth / mScrollTime;
|
||||
xpos1 = xpos2 + fwidth2;
|
||||
break;
|
||||
|
||||
int ticker = clamp(mTicker - mScrollDelay, 0, mScrollTime);
|
||||
|
||||
switch (mScrollDir)
|
||||
{
|
||||
case SCROLL_Left:
|
||||
default:
|
||||
xpos2 = -awidth + double(ticker) * awidth / mScrollTime;
|
||||
xpos1 = xpos2 + fwidth2;
|
||||
break;
|
||||
|
||||
case SCROLL_Right:
|
||||
xpos1 = -double(ticker) * awidth / mScrollTime;
|
||||
xpos2 = xpos1 + fwidth;
|
||||
break;
|
||||
}
|
||||
double scale = drect.height / aheight;
|
||||
xpos1 *= scale;
|
||||
xpos2 *= scale;
|
||||
|
||||
screen->DrawTexture(tex, xpos1 + drect.left, drect.top,
|
||||
DTA_DestWidthF, fwidth * scale,
|
||||
DTA_DestHeightF, aheight * scale,
|
||||
DTA_Masked, false,
|
||||
TAG_DONE);
|
||||
screen->DrawTexture(tex2, xpos2 + drect.left, drect.top,
|
||||
DTA_DestWidthF, fwidth2 * scale,
|
||||
DTA_DestHeightF, aheight * scale,
|
||||
DTA_Masked, false,
|
||||
TAG_DONE);
|
||||
|
||||
|
||||
screen->ClearClipRect();
|
||||
case SCROLL_Right:
|
||||
xpos1 = -double(ticker) * awidth / mScrollTime;
|
||||
xpos2 = xpos1 + fwidth;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (mScrollDir)
|
||||
{
|
||||
case SCROLL_Up:
|
||||
default:
|
||||
ypos1 = double(mTicker - mScrollDelay) * fheight / mScrollTime;
|
||||
ypos2 = ypos1 - fheight;
|
||||
break;
|
||||
double scale = drect.height / aheight;
|
||||
xpos1 *= scale;
|
||||
xpos2 *= scale;
|
||||
|
||||
case SCROLL_Down:
|
||||
ypos1 = -double(mTicker - mScrollDelay) * fheight / mScrollTime;
|
||||
ypos2 = ypos1 + fheight;
|
||||
break;
|
||||
}
|
||||
screen->DrawTexture(tex, xpos1 + drect.left, drect.top,
|
||||
DTA_DestWidthF, fwidth * scale,
|
||||
DTA_DestHeightF, aheight * scale,
|
||||
DTA_Masked, false,
|
||||
TAG_DONE);
|
||||
screen->DrawTexture(tex2, xpos2 + drect.left, drect.top,
|
||||
DTA_DestWidthF, fwidth2 * scale,
|
||||
DTA_DestHeightF, aheight * scale,
|
||||
DTA_Masked, false,
|
||||
TAG_DONE);
|
||||
|
||||
screen->DrawTexture(tex, xpos1, ypos1,
|
||||
DTA_VirtualWidth, fwidth,
|
||||
DTA_VirtualHeight, fheight,
|
||||
DTA_Masked, false,
|
||||
TAG_DONE);
|
||||
screen->DrawTexture(tex2, xpos2, ypos2,
|
||||
DTA_VirtualWidth, fwidth,
|
||||
DTA_VirtualHeight, fheight,
|
||||
DTA_Masked, false,
|
||||
TAG_DONE);
|
||||
}
|
||||
mBackground = mSecondPic;
|
||||
|
||||
screen->ClearClipRect();
|
||||
}
|
||||
/*
|
||||
else
|
||||
else
|
||||
{
|
||||
Super::Drawer();
|
||||
// guesstimate the intended aspect ratio.
|
||||
screen->CalcFullscreenScale(fwidth, aheight, gameinfo.fullscreenautoaspect, drect);
|
||||
screen->SetClipRect(int(drect.left), int(drect.top), int(drect.width), int(drect.height));
|
||||
|
||||
int ticker = clamp(mTicker - mScrollDelay, 0, mScrollTime);
|
||||
|
||||
switch (mScrollDir)
|
||||
{
|
||||
case SCROLL_Up:
|
||||
default:
|
||||
ypos1 = double(ticker) * aheight / mScrollTime;
|
||||
ypos2 = ypos1 - aheight;
|
||||
break;
|
||||
|
||||
case SCROLL_Down:
|
||||
ypos1 = -double(ticker) * aheight / mScrollTime;
|
||||
ypos2 = ypos1 + aheight;
|
||||
break;
|
||||
}
|
||||
double scale = drect.height / aheight;
|
||||
ypos1 *= scale;
|
||||
ypos2 *= scale;
|
||||
|
||||
screen->DrawTexture(tex, drect.left, drect.top + ypos1,
|
||||
DTA_DestWidthF, fwidth * scale,
|
||||
DTA_DestHeightF, aheight * scale,
|
||||
DTA_Masked, false,
|
||||
TAG_DONE);
|
||||
screen->DrawTexture(tex2, drect.left, drect.top + ypos2,
|
||||
DTA_DestWidthF, fwidth2 * scale,
|
||||
DTA_DestHeightF, aheight * scale,
|
||||
DTA_Masked, false,
|
||||
TAG_DONE);
|
||||
|
||||
|
||||
screen->ClearClipRect();
|
||||
}
|
||||
*/
|
||||
mBackground = mSecondPic;
|
||||
}
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue