mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-27 20:20:40 +00:00
- fixed all issues with Duke's/RR's status bar.
This commit is contained in:
parent
f84f58e714
commit
781cb32dcf
9 changed files with 46 additions and 18 deletions
|
@ -136,7 +136,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(DStatusBarCore, DrawImage, SBar_DrawImage)
|
||||||
void SBar_DrawImageRotated(DStatusBarCore* self, const FString& texid, double x, double y, int flags, double angle, double alpha, double scaleX, double scaleY, int style, int color, int translation)
|
void SBar_DrawImageRotated(DStatusBarCore* self, const FString& texid, double x, double y, int flags, double angle, double alpha, double scaleX, double scaleY, int style, int color, int translation)
|
||||||
{
|
{
|
||||||
if (!twod->HasBegun2D()) ThrowAbortException(X_OTHER, "Attempt to draw to screen outside a draw function");
|
if (!twod->HasBegun2D()) ThrowAbortException(X_OTHER, "Attempt to draw to screen outside a draw function");
|
||||||
self->DrawRotated(TexMan.CheckForTexture(texid, ETextureType::Any), x, y, flags, alpha, scaleX, scaleY, color, translation, style);
|
self->DrawRotated(TexMan.CheckForTexture(texid, ETextureType::Any), x, y, flags, angle, alpha, scaleX, scaleY, color, translation, (ERenderStyle)style);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION_NATIVE(DStatusBarCore, DrawImageRotated, SBar_DrawImageRotated)
|
DEFINE_ACTION_FUNCTION_NATIVE(DStatusBarCore, DrawImageRotated, SBar_DrawImageRotated)
|
||||||
|
|
|
@ -816,10 +816,13 @@ void CreateStatusBar()
|
||||||
{
|
{
|
||||||
stbarclass = PClass::FindClass("ExhumedStatusBar");
|
stbarclass = PClass::FindClass("ExhumedStatusBar");
|
||||||
}
|
}
|
||||||
|
else if (flags & GAMEFLAG_RRALL)
|
||||||
|
{
|
||||||
|
stbarclass = PClass::FindClass("RedneckStatusBar");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
StatusBar = isRR() ? Duke3d::CreateRedneckStatusBar() : Duke3d::CreateDukeStatusBar();
|
stbarclass = PClass::FindClass("DukeStatusBar");
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
if (!stbarclass)
|
if (!stbarclass)
|
||||||
{
|
{
|
||||||
|
@ -829,12 +832,12 @@ void CreateStatusBar()
|
||||||
StatusBar->SetSize(0, 320, 200);
|
StatusBar->SetSize(0, 320, 200);
|
||||||
InitStatusBar();
|
InitStatusBar();
|
||||||
// this is for comparing the scriptification with the C++ versions
|
// this is for comparing the scriptification with the C++ versions
|
||||||
/*
|
StatusBar2 = isRR() ? Duke3d::CreateRedneckStatusBar() : Duke3d::CreateDukeStatusBar();
|
||||||
stbarclass = PClass::FindClass("NativeExhumedStatusBar");
|
|
||||||
StatusBar2 = static_cast<DBaseStatusBar*>(stbarclass->CreateNew());
|
//stbarclass = PClass::FindClass("NativeExhumedStatusBar");
|
||||||
|
//StatusBar2 = static_cast<DBaseStatusBar*>(stbarclass->CreateNew());
|
||||||
StatusBar2->SetSize(0, 320, 200);
|
StatusBar2->SetSize(0, 320, 200);
|
||||||
StatusBar2->Release();
|
StatusBar2->Release();
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -291,9 +291,7 @@ void drawoverlays(double smoothratio)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawBorder();
|
DrawStatusBar();
|
||||||
|
|
||||||
StatusBar->UpdateStatusBar();
|
|
||||||
|
|
||||||
if (ps[myconnectindex].newOwner == nullptr && ud.cameraactor == nullptr)
|
if (ps[myconnectindex].newOwner == nullptr && ud.cameraactor == nullptr)
|
||||||
{
|
{
|
||||||
|
|
|
@ -298,6 +298,27 @@ void DrawBorder()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CVAR(Bool, old_sb, false, 0)
|
||||||
|
void DrawStatusBar()
|
||||||
|
{
|
||||||
|
DrawBorder();
|
||||||
|
|
||||||
|
if (old_sb)
|
||||||
|
{
|
||||||
|
StatusBar2->UpdateStatusBar();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SummaryInfo info{};
|
||||||
|
|
||||||
|
info.kills = ps[0].actors_killed;
|
||||||
|
info.maxkills = ps[0].max_actors_killed;
|
||||||
|
info.secrets = ps[0].secret_rooms;
|
||||||
|
info.maxsecrets = ps[0].max_secret_rooms;
|
||||||
|
info.time = Scale(PlayClock, 1000, 120);
|
||||||
|
UpdateStatusBar(&info);
|
||||||
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// view sizing game interface
|
// view sizing game interface
|
||||||
|
|
|
@ -31,5 +31,6 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
void DrawBorder();
|
void DrawBorder();
|
||||||
|
void DrawStatusBar();
|
||||||
|
|
||||||
END_DUKE_NS
|
END_DUKE_NS
|
||||||
|
|
|
@ -57,6 +57,9 @@ public:
|
||||||
numberFont = Create<DHUDFont>(BigFont, 0, Off, 1, 1 );
|
numberFont = Create<DHUDFont>(BigFont, 0, Off, 1, 1 );
|
||||||
miniFont = Create<DHUDFont>(SmallFont2, 0, Off, 1, 1 );
|
miniFont = Create<DHUDFont>(SmallFont2, 0, Off, 1, 1 );
|
||||||
digiFont = Create<DHUDFont>(DigiFont, 2, Off, 1, 1 );
|
digiFont = Create<DHUDFont>(DigiFont, 2, Off, 1, 1 );
|
||||||
|
numberFont->Release();
|
||||||
|
miniFont->Release();
|
||||||
|
digiFont->Release();
|
||||||
|
|
||||||
// optionally draw at the top of the screen.
|
// optionally draw at the top of the screen.
|
||||||
SetSize(tileHeight(BOTTOMSTATUSBAR));
|
SetSize(tileHeight(BOTTOMSTATUSBAR));
|
||||||
|
|
|
@ -194,20 +194,22 @@ class DukeCommonStatusBar : RazeStatusBar
|
||||||
}
|
}
|
||||||
else if (hud_stats)
|
else if (hud_stats)
|
||||||
{
|
{
|
||||||
stats.spacing = Raze.isRR() ? 10 : 7;
|
|
||||||
stats.letterColor = Font.TEXTCOLOR_ORANGE;
|
stats.letterColor = Font.TEXTCOLOR_ORANGE;
|
||||||
if (Raze.isNamWW2GI())
|
if (Raze.isNamWW2GI())
|
||||||
{
|
{
|
||||||
|
stats.spacing = 8;
|
||||||
stats.standardColor = Font.TEXTCOLOR_YELLOW;
|
stats.standardColor = Font.TEXTCOLOR_YELLOW;
|
||||||
stats.completeColor = Font.TEXTCOLOR_FIRE;
|
stats.completeColor = Font.TEXTCOLOR_FIRE;
|
||||||
}
|
}
|
||||||
else if (!Raze.isRR())
|
else if (!Raze.isRR())
|
||||||
{
|
{
|
||||||
|
stats.spacing = 7;
|
||||||
stats.standardColor = Font.TEXTCOLOR_CREAM;
|
stats.standardColor = Font.TEXTCOLOR_CREAM;
|
||||||
stats.completeColor = Font.TEXTCOLOR_FIRE;
|
stats.completeColor = Font.TEXTCOLOR_FIRE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
stats.spacing = 10;
|
||||||
stats.standardColor =
|
stats.standardColor =
|
||||||
stats.completeColor = Font.TEXTCOLOR_UNTRANSLATED;
|
stats.completeColor = Font.TEXTCOLOR_UNTRANSLATED;
|
||||||
}
|
}
|
||||||
|
|
|
@ -221,7 +221,7 @@ class RedneckStatusBar : DukeCommonStatusBar
|
||||||
//
|
//
|
||||||
// ammo
|
// ammo
|
||||||
//
|
//
|
||||||
DrawImage("AMMOBOX", (37, -2), DI_ITEM_LEFT_BOTTOM, scale:(scale, scale));
|
DrawImage("AMMOBOX", (41, -2), DI_ITEM_LEFT_BOTTOM, scale:(scale, scale));
|
||||||
int wp = p.curr_weapon == RRWpn.THROWINGDYNAMITE_WEAPON? RRWpn.DYNAMITE_WEAPON : p.curr_weapon;
|
int wp = p.curr_weapon == RRWpn.THROWINGDYNAMITE_WEAPON? RRWpn.DYNAMITE_WEAPON : p.curr_weapon;
|
||||||
format = String.Format("%d", p.ammo_amount[wp]);
|
format = String.Format("%d", p.ammo_amount[wp]);
|
||||||
DrawString(digiFont, format, (60.25, -digiFont.mFont.GetHeight() * scale - 5.5), DI_TEXT_ALIGN_CENTER, scale:(scale, scale));
|
DrawString(digiFont, format, (60.25, -digiFont.mFont.GetHeight() * scale - 5.5), DI_TEXT_ALIGN_CENTER, scale:(scale, scale));
|
||||||
|
@ -233,7 +233,7 @@ class RedneckStatusBar : DukeCommonStatusBar
|
||||||
if (icon > 0)
|
if (icon > 0)
|
||||||
{
|
{
|
||||||
int x = 84;
|
int x = 84;
|
||||||
DrawImage("INVENTORYBOX", (69, -2), DI_ITEM_LEFT_BOTTOM, scale:(scale, scale));
|
DrawImage("INVENTORYBOX", (77, -2), DI_ITEM_LEFT_BOTTOM, scale:(scale, scale));
|
||||||
if (icon < Duke.ICON_MAX)
|
if (icon < Duke.ICON_MAX)
|
||||||
DrawImage(item_icons[icon], (x, -15.375), DI_ITEM_LEFT|DI_ITEM_VCENTER, scale:(scale, scale));
|
DrawImage(item_icons[icon], (x, -15.375), DI_ITEM_LEFT|DI_ITEM_VCENTER, scale:(scale, scale));
|
||||||
|
|
||||||
|
@ -252,7 +252,7 @@ class RedneckStatusBar : DukeCommonStatusBar
|
||||||
|
|
||||||
void DrawHud(DukePlayer p, int style, SummaryInfo info)
|
void DrawHud(DukePlayer p, int style, SummaryInfo info)
|
||||||
{
|
{
|
||||||
BeginHUD(320, 200, 1.f);
|
BeginHUD(1, false, 320, 200);
|
||||||
if (style == 1)
|
if (style == 1)
|
||||||
{
|
{
|
||||||
double y = -40;
|
double y = -40;
|
||||||
|
@ -324,7 +324,7 @@ class RedneckStatusBar : DukeCommonStatusBar
|
||||||
void Statusbar(DukePlayer p)
|
void Statusbar(DukePlayer p)
|
||||||
{
|
{
|
||||||
let bsb = TexMan.CheckForTexture("BOTTOMSTATUSBAR", Texman.Type_Any);
|
let bsb = TexMan.CheckForTexture("BOTTOMSTATUSBAR", Texman.Type_Any);
|
||||||
let siz = TexMan.GetScaledSize(bsb);
|
let siz = TexMan.GetScaledSize(bsb) * scale;
|
||||||
|
|
||||||
double wh = 0;
|
double wh = 0;
|
||||||
if (hud_size < Hud_Stbar) wh = tileHeight("WEAPONBAR") * scale;
|
if (hud_size < Hud_Stbar) wh = tileHeight("WEAPONBAR") * scale;
|
||||||
|
@ -393,8 +393,8 @@ class RedneckStatusBar : DukeCommonStatusBar
|
||||||
p.drunkang = 400;
|
p.drunkang = 400;
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawImageRotated("GUTMETER", (256, top + 15), DI_ITEM_RELCENTER, p.drunkang * -Raze.BAngToDegree, 1, (scale, scale), 0xffffffff, 0);
|
DrawImageRotated("GUTMETER", (256, top + 15), DI_ITEM_RELCENTER, p.drunkang * -Raze.BAngToDegree, 1, (scale, scale));
|
||||||
DrawImageRotated("GUTMETER", (292, top + 15), DI_ITEM_RELCENTER, p.eatang * -Raze.BAngToDegree, 1, (scale, scale), 0xffffffff, 0);
|
DrawImageRotated("GUTMETER", (292, top + 15), DI_ITEM_RELCENTER, p.eatang * -Raze.BAngToDegree, 1, (scale, scale));
|
||||||
|
|
||||||
if (p.drink_amt >= 0 && p.drink_amt <= 30)
|
if (p.drink_amt >= 0 && p.drink_amt <= 30)
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,7 +26,7 @@ class RazeStatusBar : StatusBarCore
|
||||||
virtual void Reset() {}
|
virtual void Reset() {}
|
||||||
virtual void UpdateStatusBar(SummaryInfo info) {}
|
virtual void UpdateStatusBar(SummaryInfo info) {}
|
||||||
|
|
||||||
void drawStatText(Font statFont, int x, int y, String text, double scale)
|
void drawStatText(Font statFont, double x, double y, String text, double scale)
|
||||||
{
|
{
|
||||||
Screen.DrawText(statfont, Font.CR_UNTRANSLATED, x + scale, y + scale, text, DTA_FullscreenScale, FSMode_ScaleToHeight, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200,
|
Screen.DrawText(statfont, Font.CR_UNTRANSLATED, x + scale, y + scale, text, DTA_FullscreenScale, FSMode_ScaleToHeight, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200,
|
||||||
DTA_KeepRatio, true, DTA_ScaleX, scale, DTA_ScaleY, scale, DTA_LegacyRenderStyle, STYLE_TranslucentStencil, DTA_Color, 0);
|
DTA_KeepRatio, true, DTA_ScaleX, scale, DTA_ScaleY, scale, DTA_LegacyRenderStyle, STYLE_TranslucentStencil, DTA_Color, 0);
|
||||||
|
|
Loading…
Reference in a new issue