mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-14 08:31:23 +00:00
- SBARINFO patch: "Apparently my attempts to reduce copy and paste failed." -- Blzut3
SVN r1160 (trunk)
This commit is contained in:
parent
c9187a0e09
commit
942c8f5e87
1 changed files with 147 additions and 78 deletions
|
@ -900,6 +900,9 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int a
|
||||||
int x, y, w, h;
|
int x, y, w, h;
|
||||||
int cx, cy, cw, ch, cr, cb;
|
int cx, cy, cw, ch, cr, cb;
|
||||||
|
|
||||||
|
// These still need to be caclulated for the clear call.
|
||||||
|
if(bg == NULL)
|
||||||
|
{
|
||||||
if(!block.fullScreenOffsets)
|
if(!block.fullScreenOffsets)
|
||||||
{
|
{
|
||||||
// Calc real screen coordinates for bar
|
// Calc real screen coordinates for bar
|
||||||
|
@ -921,28 +924,19 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int a
|
||||||
if(vid_fps && x < 0 && y >= 0)
|
if(vid_fps && x < 0 && y >= 0)
|
||||||
y += 10;
|
y += 10;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(cmd.special3 != 0)
|
if(cmd.special3 != 0)
|
||||||
{
|
{
|
||||||
//Draw the whole foreground
|
//Draw the whole foreground
|
||||||
screen->DrawTexture(fg, x, y,
|
DrawGraphic(fg, cmd.x, cmd.y, xOffset, yOffset, alpha, block.fullScreenOffsets);
|
||||||
DTA_DestWidth, w,
|
|
||||||
DTA_DestHeight, h,
|
|
||||||
DTA_Alpha, alpha,
|
|
||||||
DTA_HUDRules, HUD_Normal,
|
|
||||||
TAG_DONE);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Draw background
|
// Draw background
|
||||||
if (bg != NULL && bg->GetScaledWidth() == fg->GetScaledWidth() && bg->GetScaledHeight() == fg->GetScaledHeight())
|
if (bg != NULL && bg->GetScaledWidth() == fg->GetScaledWidth() && bg->GetScaledHeight() == fg->GetScaledHeight())
|
||||||
{
|
{
|
||||||
screen->DrawTexture(bg, x, y,
|
DrawGraphic(bg, cmd.x, cmd.y, xOffset, yOffset, alpha, block.fullScreenOffsets);
|
||||||
DTA_DestWidth, w,
|
|
||||||
DTA_DestHeight, h,
|
|
||||||
DTA_Alpha, alpha,
|
|
||||||
DTA_HUDRules, HUD_Normal,
|
|
||||||
TAG_DONE);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1003,6 +997,20 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int a
|
||||||
if(cmd.special3 != 0)
|
if(cmd.special3 != 0)
|
||||||
{
|
{
|
||||||
if (bg != NULL && bg->GetScaledWidth() == fg->GetScaledWidth() && bg->GetScaledHeight() == fg->GetScaledHeight())
|
if (bg != NULL && bg->GetScaledWidth() == fg->GetScaledWidth() && bg->GetScaledHeight() == fg->GetScaledHeight())
|
||||||
|
{
|
||||||
|
if(!block.fullScreenOffsets)
|
||||||
|
{
|
||||||
|
screen->DrawTexture(bg, x, y,
|
||||||
|
DTA_DestWidth, w,
|
||||||
|
DTA_DestHeight, h,
|
||||||
|
DTA_ClipLeft, cx,
|
||||||
|
DTA_ClipTop, cy,
|
||||||
|
DTA_ClipRight, cr,
|
||||||
|
DTA_ClipBottom, cb,
|
||||||
|
DTA_Alpha, alpha,
|
||||||
|
TAG_DONE);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
screen->DrawTexture(bg, x, y,
|
screen->DrawTexture(bg, x, y,
|
||||||
DTA_DestWidth, w,
|
DTA_DestWidth, w,
|
||||||
|
@ -1015,12 +1023,27 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int a
|
||||||
DTA_HUDRules, HUD_Normal,
|
DTA_HUDRules, HUD_Normal,
|
||||||
TAG_DONE);
|
TAG_DONE);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
screen->Clear(cx, cy, cr, cb, GPalette.BlackIndex, 0);
|
screen->Clear(cx, cy, cr, cb, GPalette.BlackIndex, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if(!block.fullScreenOffsets)
|
||||||
|
{
|
||||||
|
screen->DrawTexture(fg, x, y,
|
||||||
|
DTA_DestWidth, w,
|
||||||
|
DTA_DestHeight, h,
|
||||||
|
DTA_ClipLeft, cx,
|
||||||
|
DTA_ClipTop, cy,
|
||||||
|
DTA_ClipRight, cr,
|
||||||
|
DTA_ClipBottom, cb,
|
||||||
|
DTA_Alpha, alpha,
|
||||||
|
TAG_DONE);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
screen->DrawTexture(fg, x, y,
|
screen->DrawTexture(fg, x, y,
|
||||||
DTA_DestWidth, w,
|
DTA_DestWidth, w,
|
||||||
|
@ -1033,6 +1056,7 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int a
|
||||||
DTA_HUDRules, HUD_Normal,
|
DTA_HUDRules, HUD_Normal,
|
||||||
TAG_DONE);
|
TAG_DONE);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SBARINFO_DRAWGEM:
|
case SBARINFO_DRAWGEM:
|
||||||
|
@ -1084,6 +1108,18 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int a
|
||||||
if(vid_fps && x < 0 && y >= 0)
|
if(vid_fps && x < 0 && y >= 0)
|
||||||
y += 10;
|
y += 10;
|
||||||
}
|
}
|
||||||
|
if(!block.fullScreenOffsets)
|
||||||
|
{
|
||||||
|
screen->DrawTexture (shaders[(vertical << 1) + reverse], x, y,
|
||||||
|
DTA_DestWidth, w,
|
||||||
|
DTA_DestHeight, h,
|
||||||
|
DTA_Alpha, alpha,
|
||||||
|
DTA_AlphaChannel, true,
|
||||||
|
DTA_FillColor, 0,
|
||||||
|
TAG_DONE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
screen->DrawTexture (shaders[(vertical << 1) + reverse], x, y,
|
screen->DrawTexture (shaders[(vertical << 1) + reverse], x, y,
|
||||||
DTA_DestWidth, w,
|
DTA_DestWidth, w,
|
||||||
DTA_DestHeight, h,
|
DTA_DestHeight, h,
|
||||||
|
@ -1092,6 +1128,7 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int a
|
||||||
DTA_FillColor, 0,
|
DTA_FillColor, 0,
|
||||||
DTA_HUDRules, HUD_Normal,
|
DTA_HUDRules, HUD_Normal,
|
||||||
TAG_DONE);
|
TAG_DONE);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SBARINFO_DRAWSTRING:
|
case SBARINFO_DRAWSTRING:
|
||||||
|
@ -1335,6 +1372,14 @@ void DSBarInfo::DrawGraphic(FTexture* texture, int x, int y, int xOffset, int yO
|
||||||
// Round to nearest
|
// Round to nearest
|
||||||
w = (fw + (FRACUNIT>>1)) >> FRACBITS;
|
w = (fw + (FRACUNIT>>1)) >> FRACBITS;
|
||||||
h = (fh + (FRACUNIT>>1)) >> FRACBITS;
|
h = (fh + (FRACUNIT>>1)) >> FRACBITS;
|
||||||
|
screen->DrawTexture(texture, x, y,
|
||||||
|
DTA_DestWidth, w,
|
||||||
|
DTA_DestHeight, h,
|
||||||
|
DTA_Translation, translate ? getTranslation() : 0,
|
||||||
|
DTA_ColorOverlay, dim ? DIM_OVERLAY : 0,
|
||||||
|
DTA_CenterBottomOffset, (offsetflags & DRAWIMAGE_OFFSET_CENTERBOTTOM),
|
||||||
|
DTA_Alpha, alpha,
|
||||||
|
TAG_DONE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1342,7 +1387,6 @@ void DSBarInfo::DrawGraphic(FTexture* texture, int x, int y, int xOffset, int yO
|
||||||
h = texture->GetScaledHeight();
|
h = texture->GetScaledHeight();
|
||||||
if(vid_fps && x < 0 && y >= 0)
|
if(vid_fps && x < 0 && y >= 0)
|
||||||
y += 10;
|
y += 10;
|
||||||
}
|
|
||||||
screen->DrawTexture(texture, x, y,
|
screen->DrawTexture(texture, x, y,
|
||||||
DTA_DestWidth, w,
|
DTA_DestWidth, w,
|
||||||
DTA_DestHeight, h,
|
DTA_DestHeight, h,
|
||||||
|
@ -1352,6 +1396,7 @@ void DSBarInfo::DrawGraphic(FTexture* texture, int x, int y, int xOffset, int yO
|
||||||
DTA_HUDRules, HUD_Normal,
|
DTA_HUDRules, HUD_Normal,
|
||||||
DTA_Alpha, alpha,
|
DTA_Alpha, alpha,
|
||||||
TAG_DONE);
|
TAG_DONE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DSBarInfo::DrawString(const char* str, int x, int y, int xOffset, int yOffset, int alpha, bool fullScreenOffsets, EColorRange translation, int spacing, bool drawshadow)
|
void DSBarInfo::DrawString(const char* str, int x, int y, int xOffset, int yOffset, int alpha, bool fullScreenOffsets, EColorRange translation, int spacing, bool drawshadow)
|
||||||
|
@ -1399,6 +1444,17 @@ void DSBarInfo::DrawString(const char* str, int x, int y, int xOffset, int yOffs
|
||||||
if(drawshadow)
|
if(drawshadow)
|
||||||
{
|
{
|
||||||
int salpha = fixed_t(((double) alpha / (double) FRACUNIT) * ((double) HR_SHADOW / (double) FRACUNIT) * FRACUNIT);
|
int salpha = fixed_t(((double) alpha / (double) FRACUNIT) * ((double) HR_SHADOW / (double) FRACUNIT) * FRACUNIT);
|
||||||
|
if(!fullScreenOffsets)
|
||||||
|
{
|
||||||
|
screen->DrawTexture(character, rx+2, ry+2,
|
||||||
|
DTA_DestWidth, rw,
|
||||||
|
DTA_DestHeight, rh,
|
||||||
|
DTA_Alpha, salpha,
|
||||||
|
DTA_FillColor, 0,
|
||||||
|
TAG_DONE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
screen->DrawTexture(character, rx+2, ry+2,
|
screen->DrawTexture(character, rx+2, ry+2,
|
||||||
DTA_DestWidth, rw,
|
DTA_DestWidth, rw,
|
||||||
DTA_DestHeight, rh,
|
DTA_DestHeight, rh,
|
||||||
|
@ -1407,6 +1463,18 @@ void DSBarInfo::DrawString(const char* str, int x, int y, int xOffset, int yOffs
|
||||||
DTA_FillColor, 0,
|
DTA_FillColor, 0,
|
||||||
TAG_DONE);
|
TAG_DONE);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if(!fullScreenOffsets)
|
||||||
|
{
|
||||||
|
screen->DrawTexture(character, rx, ry,
|
||||||
|
DTA_DestWidth, rw,
|
||||||
|
DTA_DestHeight, rh,
|
||||||
|
DTA_Translation, drawingFont->GetColorTranslation(translation),
|
||||||
|
DTA_Alpha, alpha,
|
||||||
|
TAG_DONE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
screen->DrawTexture(character, rx, ry,
|
screen->DrawTexture(character, rx, ry,
|
||||||
DTA_DestWidth, rw,
|
DTA_DestWidth, rw,
|
||||||
DTA_DestHeight, rh,
|
DTA_DestHeight, rh,
|
||||||
|
@ -1414,6 +1482,7 @@ void DSBarInfo::DrawString(const char* str, int x, int y, int xOffset, int yOffs
|
||||||
DTA_Alpha, alpha,
|
DTA_Alpha, alpha,
|
||||||
DTA_HUDRules, HUD_Normal,
|
DTA_HUDRules, HUD_Normal,
|
||||||
TAG_DONE);
|
TAG_DONE);
|
||||||
|
}
|
||||||
if(SBarInfoScript->spacingCharacter == '\0')
|
if(SBarInfoScript->spacingCharacter == '\0')
|
||||||
x += width + spacing - (character->LeftOffset+1);
|
x += width + spacing - (character->LeftOffset+1);
|
||||||
else //width gets changed at the call to GetChar()
|
else //width gets changed at the call to GetChar()
|
||||||
|
|
Loading…
Reference in a new issue