- fixed layout for classic Duke fullscreen HUD.

This commit is contained in:
Christoph Oelckers 2020-07-25 15:41:11 +02:00
parent f9d48e1f68
commit 654391a278
6 changed files with 25 additions and 19 deletions

View file

@ -124,7 +124,6 @@ public:
if (totalclock < ototalclock - 1) if (totalclock < ototalclock - 1)
{ {
Printf("\n");
twod->ClearScreen(); twod->ClearScreen();
DrawTexture(twod, animtex.GetFrame(), 0, 0, DTA_FullscreenEx, 3, DTA_Masked, false, TAG_DONE); DrawTexture(twod, animtex.GetFrame(), 0, 0, DTA_FullscreenEx, 3, DTA_Masked, false, TAG_DONE);
return skiprequest? -1 : 1; return skiprequest? -1 : 1;

View file

@ -627,6 +627,7 @@ void DBaseStatusBar::DrawString(FFont *font, const FString &cstring, double x, d
{ {
continue; continue;
} }
width += font->GetDefaultKerning();
if (!monospaced) //If we are monospaced lets use the offset if (!monospaced) //If we are monospaced lets use the offset
x += (c->GetDisplayLeftOffset() + 1); //ignore x offsets since we adapt to character size x += (c->GetDisplayLeftOffset() + 1); //ignore x offsets since we adapt to character size

View file

@ -111,6 +111,8 @@ void InitFonts_d()
fontdata.Insert('/', tileGetTexture(THREEBYFIVE + 11)); fontdata.Insert('/', tileGetTexture(THREEBYFIVE + 11));
fontdata.Insert('%', tileGetTexture(MINIFONT + '%' - '!')); fontdata.Insert('%', tileGetTexture(MINIFONT + '%' - '!'));
fontdata.Insert(1, TexMan.FindGameTexture("TINYBLAK")); // this is only here to widen the color range of the font to produce a better translation. fontdata.Insert(1, TexMan.FindGameTexture("TINYBLAK")); // this is only here to widen the color range of the font to produce a better translation.
GlyphSet::Iterator iti(fontdata);
while (iti.NextPair(pair)) pair->Value->SetOffsetsNotForFont();
IndexFont = new ::FFont("IndexFont", nullptr, nullptr, 0, 0, 0, -1, -1, false, false, false, &fontdata); IndexFont = new ::FFont("IndexFont", nullptr, nullptr, 0, 0, 0, -1, -1, false, false, false, &fontdata);
fontdata.Clear(); fontdata.Clear();
@ -118,6 +120,8 @@ void InitFonts_d()
// digital font // digital font
for (int i = 0; i < 10; i++) fontdata.Insert('0' + i, tileGetTexture(DIGITALNUM + i)); for (int i = 0; i < 10; i++) fontdata.Insert('0' + i, tileGetTexture(DIGITALNUM + i));
fontdata.Insert(1, TexMan.FindGameTexture("TINYBLAK")); // this is only here to widen the color range of the font to produce a better translation. fontdata.Insert(1, TexMan.FindGameTexture("TINYBLAK")); // this is only here to widen the color range of the font to produce a better translation.
GlyphSet::Iterator itd(fontdata);
while (itd.NextPair(pair)) pair->Value->SetOffsetsNotForFont();
DigiFont = new ::FFont("DigiFont", nullptr, nullptr, 0, 0, 0, -1, -1, false, false, false, &fontdata); DigiFont = new ::FFont("DigiFont", nullptr, nullptr, 0, 0, 0, -1, -1, false, false, false, &fontdata);
} }

View file

@ -1297,19 +1297,19 @@ void registerinputcommands()
C_RegisterFunction("slot", "slot <weaponslot>: select a weapon from the given slot (1-10)", ccmd_slot); C_RegisterFunction("slot", "slot <weaponslot>: select a weapon from the given slot (1-10)", ccmd_slot);
C_RegisterFunction("weapprev", nullptr, [](CCmdFuncPtr)->int { WeaponToSend = 11; return CCMD_OK; }); C_RegisterFunction("weapprev", nullptr, [](CCmdFuncPtr)->int { WeaponToSend = 11; return CCMD_OK; });
C_RegisterFunction("weapnext", nullptr, [](CCmdFuncPtr)->int { WeaponToSend = 12; return CCMD_OK; }); C_RegisterFunction("weapnext", nullptr, [](CCmdFuncPtr)->int { WeaponToSend = 12; return CCMD_OK; });
C_RegisterFunction("pause", nullptr, [](CCmdFuncPtr)->int { BitsToSend = SKB_PAUSE; return CCMD_OK; }); C_RegisterFunction("pause", nullptr, [](CCmdFuncPtr)->int { BitsToSend |= SKB_PAUSE; return CCMD_OK; });
C_RegisterFunction("steroids", nullptr, [](CCmdFuncPtr)->int { BitsToSend = SKB_STEROIDS; return CCMD_OK; }); C_RegisterFunction("steroids", nullptr, [](CCmdFuncPtr)->int { BitsToSend |= SKB_STEROIDS; return CCMD_OK; });
C_RegisterFunction("nightvision", nullptr, [](CCmdFuncPtr)->int { BitsToSend = SKB_NIGHTVISION; return CCMD_OK; }); C_RegisterFunction("nightvision", nullptr, [](CCmdFuncPtr)->int { BitsToSend |= SKB_NIGHTVISION; return CCMD_OK; });
C_RegisterFunction("medkit", nullptr, [](CCmdFuncPtr)->int { BitsToSend = SKB_MEDKIT; return CCMD_OK; }); C_RegisterFunction("medkit", nullptr, [](CCmdFuncPtr)->int { BitsToSend |= SKB_MEDKIT; return CCMD_OK; });
C_RegisterFunction("centerview", nullptr, [](CCmdFuncPtr)->int { BitsToSend = SKB_CENTER_VIEW; return CCMD_OK; }); C_RegisterFunction("centerview", nullptr, [](CCmdFuncPtr)->int { BitsToSend |= SKB_CENTER_VIEW; return CCMD_OK; });
C_RegisterFunction("holsterweapon", nullptr, [](CCmdFuncPtr)->int { BitsToSend = SKB_HOLSTER; return CCMD_OK; }); C_RegisterFunction("holsterweapon", nullptr, [](CCmdFuncPtr)->int { BitsToSend |= SKB_HOLSTER; return CCMD_OK; });
C_RegisterFunction("invprev", nullptr, [](CCmdFuncPtr)->int { BitsToSend = SKB_INV_LEFT; return CCMD_OK; }); C_RegisterFunction("invprev", nullptr, [](CCmdFuncPtr)->int { BitsToSend |= SKB_INV_LEFT; return CCMD_OK; });
C_RegisterFunction("invnext", nullptr, [](CCmdFuncPtr)->int { BitsToSend = SKB_INV_RIGHT; return CCMD_OK; }); C_RegisterFunction("invnext", nullptr, [](CCmdFuncPtr)->int { BitsToSend |= SKB_INV_RIGHT; return CCMD_OK; });
C_RegisterFunction("holoduke", nullptr, [](CCmdFuncPtr)->int { BitsToSend = SKB_HOLODUKE; return CCMD_OK; }); C_RegisterFunction("holoduke", nullptr, [](CCmdFuncPtr)->int { BitsToSend |= SKB_HOLODUKE; return CCMD_OK; });
C_RegisterFunction("jetpack", nullptr, [](CCmdFuncPtr)->int { BitsToSend = SKB_JETPACK; return CCMD_OK; }); C_RegisterFunction("jetpack", nullptr, [](CCmdFuncPtr)->int { BitsToSend |= SKB_JETPACK; return CCMD_OK; });
C_RegisterFunction("turnaround", nullptr, [](CCmdFuncPtr)->int { BitsToSend = SKB_TURNAROUND; return CCMD_OK; }); C_RegisterFunction("turnaround", nullptr, [](CCmdFuncPtr)->int { BitsToSend |= SKB_TURNAROUND; return CCMD_OK; });
C_RegisterFunction("invuse", nullptr, [](CCmdFuncPtr)->int { BitsToSend = SKB_INVENTORY; return CCMD_OK; }); C_RegisterFunction("invuse", nullptr, [](CCmdFuncPtr)->int { BitsToSend |= SKB_INVENTORY; return CCMD_OK; });
C_RegisterFunction("backoff", nullptr, [](CCmdFuncPtr)->int { BitsToSend = SKB_ESCAPE; return CCMD_OK; }); C_RegisterFunction("backoff", nullptr, [](CCmdFuncPtr)->int { BitsToSend |= SKB_ESCAPE; return CCMD_OK; });
} }
// This is called from ImputState::ClearAllInput and resets all static state being used here. // This is called from ImputState::ClearAllInput and resets all static state being used here.

View file

@ -49,9 +49,9 @@ BEGIN_DUKE_NS
//========================================================================== //==========================================================================
DDukeCommonStatusBar::DDukeCommonStatusBar() DDukeCommonStatusBar::DDukeCommonStatusBar()
: numberFont(BigFont, 1, Off, 1, 1), : numberFont(BigFont, 0, Off, 1, 1),
indexFont(IndexFont, 4, CellRight, 1, 1), indexFont(IndexFont, 4, CellRight, 1, 1),
miniFont(SmallFont2, 1, Off, 1, 1), miniFont(SmallFont2, 0, Off, 1, 1),
digiFont(DigiFont, 1 , Off, 1, 1) digiFont(DigiFont, 1 , Off, 1, 1)
{ {
drawOffset.Y = 0; drawOffset.Y = 0;
@ -100,10 +100,13 @@ std::pair<const char*, EColorRange> DDukeCommonStatusBar::ontext(struct player_s
{ {
case ICON_HOLODUKE: case ICON_HOLODUKE:
onstate = p->holoduke_on; onstate = p->holoduke_on;
break;
case ICON_JETPACK: case ICON_JETPACK:
onstate = p->jetpack_on; onstate = p->jetpack_on;
break;
case ICON_HEATS: case ICON_HEATS:
onstate = p->heat_on; onstate = p->heat_on;
break;
} }
// Texts are intentionally not translated because the font is too small for making localization work and the translated words are too long. // Texts are intentionally not translated because the font is too small for making localization work and the translated words are too long.

View file

@ -201,7 +201,7 @@ public:
DrawGraphic(tileGetTexture(HEALTHBOX), 5, -2, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, scale, scale); DrawGraphic(tileGetTexture(HEALTHBOX), 5, -2, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, scale, scale);
int health = (sprite[p->i].pal == 1 && p->last_extra < 2) ? 1 : p->last_extra; int health = (sprite[p->i].pal == 1 && p->last_extra < 2) ? 1 : p->last_extra;
FStringf format("%d", health); FStringf format("%d", health);
SBar_DrawString(this, &digiFont, format, 19, -digiFont.mFont->GetHeight() * scale - 7, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale); SBar_DrawString(this, &digiFont, format, 19, -digiFont.mFont->GetHeight() * scale - 3, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale);
// //
// ammo // ammo
@ -209,7 +209,7 @@ public:
DrawGraphic(tileGetTexture(AMMOBOX), 37, -2, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, scale, scale); DrawGraphic(tileGetTexture(AMMOBOX), 37, -2, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, scale, scale);
int wp = (p->curr_weapon == HANDREMOTE_WEAPON) ? HANDBOMB_WEAPON : p->curr_weapon; int wp = (p->curr_weapon == HANDREMOTE_WEAPON) ? HANDBOMB_WEAPON : p->curr_weapon;
format.Format("%d", p->ammo_amount[wp]); format.Format("%d", p->ammo_amount[wp]);
SBar_DrawString(this, &digiFont, format, 53, -digiFont.mFont->GetHeight() * scale - 7, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale); SBar_DrawString(this, &digiFont, format, 53, -digiFont.mFont->GetHeight() * scale - 3, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale);
// //
// inventory // inventory
@ -229,7 +229,6 @@ public:
auto text = ontext(p); auto text = ontext(p);
if (text.first) SBar_DrawString(this, &miniFont, text.first, x + 34, -miniFont.mFont->GetHeight() - 14.5, DI_TEXT_ALIGN_RIGHT, text.second, 1, 0, 0, 1, 1); if (text.first) SBar_DrawString(this, &miniFont, text.first, x + 34, -miniFont.mFont->GetHeight() - 14.5, DI_TEXT_ALIGN_RIGHT, text.second, 1, 0, 0, 1, 1);
} }
} }