- removed the native versions of Duke's and RR's status bar.

This commit is contained in:
Christoph Oelckers 2021-05-15 17:15:29 +02:00
parent 781cb32dcf
commit f136330628
14 changed files with 3 additions and 1248 deletions

View File

@ -477,9 +477,6 @@ void CheckUserMap()
namespace Duke3d
{
::GameInterface* CreateInterface();
DBaseStatusBar* CreateDukeStatusBar();
DBaseStatusBar* CreateRedneckStatusBar();
}
namespace Blood
{
@ -832,12 +829,10 @@ void CreateStatusBar()
StatusBar->SetSize(0, 320, 200);
InitStatusBar();
// 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());
StatusBar2->SetSize(0, 320, 200);
StatusBar2->Release();
//StatusBar2->SetSize(0, 320, 200);
//StatusBar2->Release();
}

View File

@ -6,7 +6,6 @@
#include "src/player_d.cpp"
#include "src/player_w.cpp"
#include "src/premap_d.cpp"
#include "src/sbar_d.cpp"
#include "src/sectors_d.cpp"
#include "src/spawn_d.cpp"

View File

@ -7,6 +7,5 @@
#include "src/hudweapon_r.cpp"
#include "src/player_r.cpp"
#include "src/premap_r.cpp"
#include "src/sbar_r.cpp"
#include "src/sectors_r.cpp"
#include "src/spawn_r.cpp"

View File

@ -29,7 +29,6 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au)
#include "ns.h"
#include "duke3d.h"
#include "sbar.h"
#include "mapinfo.h"
#include "cheathandler.h"
#include "c_dispatch.h"

View File

@ -227,6 +227,7 @@ void PlayerColorChanged(void);
bool movementBlocked(player_struct *p);
void loadcons();
void recordoldspritepos();
void DrawStatusBar();
int* animateptr(int i);

View File

@ -40,7 +40,6 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au)
#include "st_start.h"
#include "i_interface.h"
#include "prediction.h"
#include "sbar.h"
#include "gamestate.h"
#include "dukeactor.h"
#include "interpolate.h"

View File

@ -30,7 +30,6 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au)
#include "gamestate.h"
#include "duke3d.h"
#include "sbar.h"
#include "m_argv.h"
#include "mapinfo.h"
#include "texturemanager.h"

View File

@ -29,7 +29,6 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au)
#include "ns.h" // Must come before everything else!
#include "duke3d.h"
#include "sbar.h"
#include "m_argv.h"
#include "mapinfo.h"
#include "texturemanager.h"

View File

@ -32,7 +32,6 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
#include "secrets.h"
#include "statistics.h"
#include "gamestate.h"
#include "sbar.h"
#include "automap.h"
#include "dukeactor.h"
#include "interpolate.h"

View File

@ -36,7 +36,6 @@ source as it is released.
#include "v_font.h"
#include "duke3d.h"
#include "compat.h"
#include "sbar.h"
#include "v_draw.h"
#include "texturemanager.h"
#include "mapinfo.h"
@ -44,216 +43,6 @@ source as it is released.
BEGIN_DUKE_NS
IMPLEMENT_CLASS(DNativeDukeCommonStatusBar, true, true)
IMPLEMENT_POINTERS_START(DNativeDukeCommonStatusBar)
IMPLEMENT_POINTER(miniFont)
IMPLEMENT_POINTER(numberFont)
IMPLEMENT_POINTER(digiFont)
IMPLEMENT_POINTER(indexFont)
IMPLEMENT_POINTERS_END
//==========================================================================
//
// very much a dummy to access the methods.
// The goal is to export this to a script.
//
//==========================================================================
DNativeDukeCommonStatusBar::DNativeDukeCommonStatusBar()
{
drawOffset.Y = 0;
}
//==========================================================================
//
// Frag bar - todo
//
//==========================================================================
#if 0
void DNativeDukeCommonStatusBar::displayfragbar(void)
{
short i, j;
j = 0;
for (i = connecthead; i >= 0; i = connectpoint2[i])
if (i > j) j = i;
auto tex = tileGetTexture(TILE_FRAGBAR);
for (int y = 0; y < 32; y += 8)
DrawTexture(twod, tex, 0, 0, DTA_FullscreenScale, FSMode_Fit320x200, DTA_ScaleX, 1.001, DTA_ScaleY, 1.001, TAG_Done);
for (i = connecthead; i >= 0; i = connectpoint2[i])
{
m initext(21 + (73 * (i & 3)), 2 + ((i & 28) << 1), &ud.user_name[i][0], ps[i].GetActor()->s.pal, 2 + 8 + 16 + 128);
sprintf(tempbuf, "%d", ps[i].frag - ps[i].fraggedself);
m initext(17 + 50 + (73 * (i & 3)), 2 + ((i & 28) << 1), tempbuf, ps[i].GetActor()->s.pal, 2 + 8 + 16 + 128);
}
}
#endif
//==========================================================================
//
// Common inventory icon code for all styles
//
//==========================================================================
std::pair<const char*, int> DNativeDukeCommonStatusBar::ontext(struct player_struct *p)
{
std::pair<const char*, int> retval(nullptr, CR_RED);
int onstate = 0x80000000;
switch (p->inven_icon)
{
case ICON_HOLODUKE:
onstate = p->holoduke_on != nullptr;
break;
case ICON_JETPACK:
onstate = p->jetpack_on;
break;
case ICON_HEATS:
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.
if ((unsigned)onstate != 0x80000000 && !(g_gameType & (GAMEFLAG_WW2GI|GAMEFLAG_RRALL)))
{
retval.second = onstate > 0 ? 0 : 2;
retval.first = onstate > 0 ? "ON" : "OFF";
}
if (p->inven_icon >= ICON_SCUBA)
{
retval.second = 2;
retval.first = "AUTO";
}
return retval;
}
//==========================================================================
//
// draws the inventory selector
//
//==========================================================================
void DNativeDukeCommonStatusBar::DrawInventory(const struct player_struct* p, double x, double y, int align)
{
if (p->invdisptime <= 0)return;
int n = 0, j = 0;
if (p->firstaid_amount > 0) n |= 1, j++;
if (p->steroids_amount > 0) n |= 2, j++;
if (p->holoduke_amount > 0) n |= 4, j++;
if (p->jetpack_amount > 0) n |= 8, j++;
if (p->heat_amount > 0) n |= 16, j++;
if (p->scuba_amount > 0) n |= 32, j++;
if (p->boot_amount > 0) n |= 64, j++;
x -= (j * 11);
y -= 6;
; align |= DI_ITEM_CENTER;
for(int bit = 0; bit < 7; bit++)
{
int i = 1 << bit;
if (n & i)
{
int select = 1 << (p->inven_icon - 1);
double alpha = select == i ? 1.0 : 0.7;
DrawGraphic(tileGetTexture(item_icons[bit+1]), x, y, align, alpha, 0, 0, scale, scale);
if (select == i) DrawGraphic(tileGetTexture(TILE_ARROW), isWW2GI()? x + 7.5 : x, isWW2GI()? y + 0.5 : y, align, alpha, 0, 0, scale, scale);
x += 22;
}
}
}
//==========================================================================
//
// Helper
//
//==========================================================================
PalEntry DNativeDukeCommonStatusBar::LightForShade(int shade)
{
int ll = clamp((numshades - shade) * 255 / numshades, 0, 255);
return PalEntry(255, ll, ll, ll);
}
//==========================================================================
//
// Statistics output
//
//==========================================================================
void DNativeDukeCommonStatusBar::PrintLevelStats(int bottomy)
{
FLevelStats stats{};
auto pp = &ps[myconnectindex];
stats.fontscale = isRR() ? 0.5 : 1.;
stats.screenbottomspace = bottomy;
stats.time = Scale(pp->player_par, 1000, REALGAMETICSPERSEC);
stats.font = SmallFont;
if (isNamWW2GI())
{
// The stock font of these games is totally unusable for this.
stats.font = ConFont;
stats.spacing = ConFont->GetHeight() + 1;
}
if (automapMode == am_full)
{
bool textfont = am_textfont;
if (!am_textfont)
{
// For non-English languages force use of the text font. The tiny one is simply too small to ever add localized characters to it.
auto p = GStrings["REQUIRED_CHARACTERS"];
if (p && *p) textfont = true;
}
if (!textfont)
{
stats.font = SmallFont2;
stats.spacing = 6;
}
else stats.spacing = stats.font->GetHeight() + 1;
stats.standardColor = (isNamWW2GI() && am_textfont)? CR_ORANGE : CR_UNTRANSLATED;
stats.letterColor = CR_GOLD;
DBaseStatusBar::PrintAutomapInfo(stats, textfont);
}
else if (hud_stats)
{
// JBF 20040124: display level stats in screen corner
stats.spacing = isRR() ? 10 : 7;
stats.kills = pp->actors_killed;
stats.maxkills = !isRR() && ud.player_skill > 3 ? -2 : pp->max_actors_killed;
stats.frags = ud.multimode > 1 && !ud.coop ? pp->frag - pp->fraggedself : -1;
stats.secrets = pp->secret_rooms;
stats.maxsecrets = pp->max_secret_rooms;
if (isNamWW2GI())
{
// The stock font of these games is totally unusable for this.
stats.letterColor = CR_ORANGE;
stats.standardColor = CR_YELLOW;
stats.completeColor = CR_FIRE;
}
else if (!isRR())
{
stats.letterColor = CR_ORANGE;
stats.standardColor = CR_CREAM;
stats.completeColor = CR_FIRE;
}
else
{
stats.letterColor = CR_ORANGE;
stats.standardColor =
stats.completeColor = CR_UNTRANSLATED;
}
DBaseStatusBar::PrintLevelStats(stats);
}
}
//==========================================================================
//
// 3D viewport size management
@ -298,17 +87,10 @@ 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;

View File

@ -1,36 +0,0 @@
#pragma once
#include <array>
#include "statusbar.h"
#include "duke3d.h"
BEGIN_DUKE_NS
class DNativeDukeCommonStatusBar : public DBaseStatusBar
{
DECLARE_ABSTRACT_CLASS(DNativeDukeCommonStatusBar, DBaseStatusBar)
HAS_OBJECT_POINTERS
protected:
TObjPtr<DHUDFont*> numberFont;
TObjPtr<DHUDFont*> indexFont;
TObjPtr<DHUDFont*> miniFont;
TObjPtr<DHUDFont*> digiFont;
double scale = 1;
std::array<int, MAX_WEAPONS> ammo_sprites;
std::array<int, 8> item_icons;
DNativeDukeCommonStatusBar();
std::pair<const char*, int> ontext(struct player_struct *p);
void DrawInventory(const struct player_struct* p, double x, double y, int align);
PalEntry LightForShade(int shade);
public:
void PrintLevelStats(int bottomy);
};
void DrawBorder();
void DrawStatusBar();
END_DUKE_NS

View File

@ -1,491 +0,0 @@
//-------------------------------------------------------------------------
/*
Copyright (C) 1996, 2003 - 3D Realms Entertainment
Copyright (C) 2000, 2003 - Matt Saettler (EDuke Enhancements)
Copyright (C) 2020 - Christoph Oelckers
This file is part of Enhanced Duke Nukem 3D version 1.5 - Atomic Edition
Duke Nukem 3D is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Original Source: 1996 - Todd Replogle
Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
EDuke enhancements integrated: 04/13/2003 - Matt Saettler
Note: EDuke source was in transition. Changes are in-progress in the
source as it is released.
*/
//-------------------------------------------------------------------------
#include "ns.h" // Must come before everything else!
#include <array>
#include "v_font.h"
#include "duke3d.h"
#include "compat.h"
#include "sbar.h"
#include "statusbar.h"
#include "v_draw.h"
#include "names_d.h"
#include "texturemanager.h"
#include "dukeactor.h"
bool PickTexture(FRenderState* state, FGameTexture* tex, int paletteid, TexturePick& pick);
BEGIN_DUKE_NS
//==========================================================================
//
// very much a dummy to access the methods.
// The goal is to export this to a script.
//
//==========================================================================
class DNativeDukeStatusBar : public DNativeDukeCommonStatusBar
{
DECLARE_CLASS(DNativeDukeStatusBar, DNativeDukeCommonStatusBar)
int fontheight[2];
public:
DNativeDukeStatusBar()
{
numberFont = Create<DHUDFont>( BigFont, 0, Off, 1, 1 );
indexFont = Create<DHUDFont>(IndexFont, 4, CellRight, 1, 1 );
miniFont = Create<DHUDFont>(SmallFont2, 0, Off, 1, 1 );
digiFont = Create<DHUDFont>(DigiFont, 1, Off, 1, 1 );
// optionally draw at the top of the screen.
SetSize(tileHeight(TILE_BOTTOMSTATUSBAR));
scale = 1;
ammo_sprites = { -1, AMMO, SHOTGUNAMMO, BATTERYAMMO, RPGAMMO, HBOMBAMMO, CRYSTALAMMO, DEVISTATORAMMO, TRIPBOMBSPRITE, FREEZEAMMO + 1, HBOMBAMMO, GROWAMMO, FLAMETHROWERAMMO + 1 };
item_icons = { 0, FIRSTAID_ICON, STEROIDS_ICON, HOLODUKE_ICON, JETPACK_ICON, HEAT_ICON, AIRTANK_ICON, BOOT_ICON };
fontheight[1] = fontheight[0] = 0;
for (int i = 0; i < 9; i++)
{
auto zerotex = tileGetTexture(BIGALPHANUM - 10 + i);
if (zerotex)
{
int fh0 = zerotex->GetTexture()->CheckRealHeight();
int fh1 = fh0;
TexturePick pick;
if (PickTexture(nullptr, zerotex, TRANSLATION(Translation_Remap, 0), pick))
{
int oheight = zerotex->GetTexelHeight();
int dheight = pick.texture->GetTexelHeight();
int dReal = pick.texture->CheckRealHeight();
fh1 = Scale(dReal, oheight, dheight);
}
if (fh0 > fontheight[0]) fontheight[0] = fh0;
if (fh1 > fontheight[1]) fontheight[1] = fh1;
}
}
}
//==========================================================================
//
// Helpers
//
//==========================================================================
int getinvamount(const struct player_struct* p)
{
switch (p->inven_icon)
{
case ICON_FIRSTAID:
return p->firstaid_amount;
case ICON_STEROIDS:
return (p->steroids_amount + 3) >> 2;
case ICON_HOLODUKE:
return (p->holoduke_amount + 15) / 24;
case ICON_JETPACK:
return (p->jetpack_amount + 15) >> 4;
case ICON_HEATS:
return p->heat_amount / 12;
case ICON_SCUBA:
return (p->scuba_amount + 63) >> 6;
case ICON_BOOTS:
return p->boot_amount >> 1;
}
return -1;
}
int GetMoraleOrShield(struct player_struct *p, int snum)
{
// special handling for WW2GI
int lAmount = GetGameVar("PLR_MORALE", -1, p->GetActor(), snum);
if (lAmount == -1) lAmount = p->shield_amount;
return lAmount;
}
//==========================================================================
//
// Fullscreen HUD variant #1
//
//==========================================================================
void FullscreenHUD1(struct player_struct* p, int snum)
{
int fh = fontheight[hw_hightile ? 1 : 0];
FString format;
FGameTexture* img;
double imgScale;
double baseScale = (scale * (fh+1));
double texty = -fh - 2.5;
//
// Health
//
img = tileGetTexture(isNamWW2GI()? FIRSTAID_ICON : COLA);
imgScale = baseScale / img->GetDisplayHeight();
DrawGraphic(img, 2, -1.5, DI_ITEM_LEFT_BOTTOM, 1., -1, -1, imgScale, imgScale);
if (!althud_flashing || p->last_extra > (gs.max_player_health >> 2) || (PlayClock & 32) || (p->GetActor()->s->pal == 1 && p->last_extra < 2))
{
int s = -8;
if (althud_flashing && p->last_extra > gs.max_player_health)
s += bsin(I_GetBuildTime() << 5) / 768;
int intens = clamp(255 - 6 * s, 0, 255);
format.Format("%d", p->last_extra);
SBar_DrawString(this, numberFont, format, 25, texty, DI_TEXT_ALIGN_LEFT, CR_UNTRANSLATED, intens / 255., 0, 0, 1, 1);
}
//
// Armor
//
img = tileGetTexture(SHIELD);
imgScale = baseScale / img->GetDisplayHeight();
DrawGraphic(img, 67.375, -1.5, DI_ITEM_LEFT_BOTTOM, 1., -1, -1, imgScale, imgScale);
format.Format("%d", GetMoraleOrShield(p, snum));
SBar_DrawString(this, numberFont, format, 85, texty, DI_TEXT_ALIGN_LEFT, CR_UNTRANSLATED, 1, 0, 0, 1, 1);
//
// Weapon
//
int weapon = p->curr_weapon;
if (weapon == HANDREMOTE_WEAPON) weapon = HANDBOMB_WEAPON;
int wicon = ammo_sprites[weapon];
if (wicon > 0)
{
int ammo = p->ammo_amount[weapon];
if (weapon != PISTOL_WEAPON || (weapon == PISTOL_WEAPON && !cl_showmagamt))
{
format.Format("%d", ammo);
}
else
{
short clip = CalcMagazineAmount(ammo, isNam() ? 20 : 12, p->kickback_pic >= 1);
format.Format("%d/%d", clip, ammo - clip);
}
img = tileGetTexture(wicon);
imgScale = baseScale / img->GetDisplayHeight();
auto imgX = 20.;
auto strlen = format.Len();
if (strlen > 1)
{
imgX += (imgX * 0.6) * (strlen - 1);
}
if (weapon != KNEE_WEAPON && (!althud_flashing || PlayClock & 32 || ammo > (gs.max_ammo_amount[weapon] / 10)))
{
SBar_DrawString(this, numberFont, format, -3, texty, DI_TEXT_ALIGN_RIGHT, CR_UNTRANSLATED, 1, 0, 0, 1, 1);
}
DrawGraphic(img, -imgX, -1.5, DI_ITEM_RIGHT_BOTTOM, 1, -1, -1, imgScale, imgScale);
}
//
// Selected inventory item
//
unsigned icon = p->inven_icon;
if (icon > 0)
{
int x = 128;
if (icon < ICON_MAX)
{
img = tileGetTexture(item_icons[icon]);
imgScale = baseScale / img->GetDisplayHeight();
DrawGraphic(img, x, -1.5, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, imgScale, imgScale);
}
int percentv = getinvamount(p);
format.Format("%3d%%", percentv);
int color = percentv > 50 ? 11 : percentv > 25 ? 23 : 2;
SBar_DrawString(this, miniFont, format, x + 36.5, -indexFont->mFont->GetHeight() + 0.5, DI_TEXT_ALIGN_RIGHT, color, 1, 0, 0, 1, 1, TRANSLATION(Translation_Remap, color));
auto text = ontext(p);
if (text.first) SBar_DrawString(this, miniFont, text.first, x + 36.5, -miniFont->mFont->GetHeight() - 9.5, DI_TEXT_ALIGN_RIGHT,
CR_UNDEFINED, 1, 0, 0, 1, 1, TRANSLATION(Translation_Remap, text.second));
}
//
// keys
//
if (p->got_access & 1) DrawGraphic(tileGetTexture(ACCESSCARD), -12, -23.5, DI_ITEM_RIGHT, 1, -1, -1, 0.5, 0.5, STYLE_Translucent, 0xffffffff, TRANSLATION(Translation_Remap, 0));
if (p->got_access & 4) DrawGraphic(tileGetTexture(ACCESSCARD), -7 , -21.5, DI_ITEM_RIGHT, 1, -1, -1, 0.5, 0.5, STYLE_Translucent, 0xffffffff, TRANSLATION(Translation_Remap, 23));
if (p->got_access & 2) DrawGraphic(tileGetTexture(ACCESSCARD), -2 , -19.5, DI_ITEM_RIGHT, 1, -1, -1, 0.5, 0.5, STYLE_Translucent, 0xffffffff, TRANSLATION(Translation_Remap, 21));
}
//==========================================================================
//
// Fullscreen HUD variant #2
//
//==========================================================================
void FullscreenHUD2(struct player_struct *p)
{
//
// health
//
DrawGraphic(tileGetTexture(HEALTHBOX), 5, -2, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, scale, scale);
int health = (p->GetActor()->s->pal == 1 && p->last_extra < 2) ? 1 : p->last_extra;
FStringf format("%d", health);
SBar_DrawString(this, digiFont, format, 20, -digiFont->mFont->GetHeight() * scale - 3, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale);
//
// ammo
//
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;
format.Format("%d", p->ammo_amount[wp]);
SBar_DrawString(this, digiFont, format, 52, -digiFont->mFont->GetHeight() * scale - 3, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale);
//
// inventory
//
unsigned icon = p->inven_icon;
if (icon > 0)
{
int x = 73;
DrawGraphic(tileGetTexture(INVENTORYBOX), 69, -2, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, scale, scale);
if (icon < ICON_MAX)
DrawGraphic(tileGetTexture(item_icons[icon]), x, -13.5, DI_ITEM_LEFT|DI_ITEM_VCENTER, 1, -1, -1, scale, scale);
int percentv = getinvamount(p);
format.Format("%3d%%", percentv);
int color = percentv > 50 ? 11 : percentv > 25 ? 23 : 2;
SBar_DrawString(this, miniFont, format, x + 34, -indexFont->mFont->GetHeight() - 3, DI_TEXT_ALIGN_RIGHT, color, 1, 0, 0, 1, 1, TRANSLATION(Translation_Remap, color));
auto text = ontext(p);
if (text.first) SBar_DrawString(this, miniFont, text.first, x + 34, -miniFont->mFont->GetHeight() - 14, DI_TEXT_ALIGN_RIGHT, CR_UNDEFINED, 1, 0, 0, 1, 1, TRANSLATION(Translation_Remap, text.second));
}
}
//==========================================================================
//
// Fullscreen HUD drawer
//
//==========================================================================
void DrawHud(int snum, int style)
{
auto p = &ps[snum];
BeginHUD(320, 200, 1.f);
if (style == 1)
{
DrawInventory(p, 0, -46, DI_SCREEN_CENTER_BOTTOM);
FullscreenHUD1(p, snum);
PrintLevelStats(tileHeight(BIGALPHANUM) +10);
}
else if (style == 2)
{
DrawInventory(p, (ud.multimode > 1) ? 56 : 65, -28, DI_SCREEN_CENTER_BOTTOM);
FullscreenHUD2(p);
PrintLevelStats(tileHeight(HEALTHBOX) + 4);
}
else
{
DrawInventory(p, 0, -28, DI_SCREEN_CENTER_BOTTOM);
PrintLevelStats(2);
}
}
//==========================================================================
//
// Helper for weapon display
//
//==========================================================================
void DrawWeaponNum(int index, double x, double y, int num1, int num2, int shade, int numdigits)
{
/*
if (isShareware() && (ind > HANDBOMB_WEAPON || ind < 0))
{
minitextshade(x + 1, y - 4, "ORDER", 20, 11, 2 + 8 + 16 + ROTATESPRITE_MAX);
return;
}
*/
FString format;
bool parsedDivisor = false;
if (numdigits == 2)
{
if (num1 > 99) num1 = 99;
if (num2 > 99) num2 = 99;
format.Format("%2d/%d", num1, num2);
}
else
{
if (num1 > 999) num1 = 999;
if (num2 > 999) num2 = 999;
format.Format("%3d/%d", num1, num2);
}
y--;
DrawGraphic(tileGetTexture(THREEBYFIVE0 + index), x - 7, y, DI_ITEM_LEFT|DI_ITEM_VCENTER, 1, 0, 0, 1, 1, STYLE_Translucent, LightForShade(shade - 10), TRANSLATION(Translation_Remap, 7));
auto pe = LightForShade(shade);
DrawGraphic(tileGetTexture(THREEBYFIVE10), x - 3, y, DI_ITEM_LEFT | DI_ITEM_VCENTER, 1, 0, 0, 1, 1, STYLE_Translucent, pe);
for (size_t i = 0; i < format.Len(); i++)
{
if (format[i] != ' ')
{
char c = format[i] == '/' ? 11 : format[i] - '0';
DrawGraphic(tileGetTexture(THREEBYFIVE0 + c), x + 4 * i + (parsedDivisor ? 1 : 0), y, DI_ITEM_LEFT | DI_ITEM_VCENTER, 1, 0, 0, 1, 1, STYLE_Translucent, pe);
}
if (format[i] == '/')
{
parsedDivisor = true;
}
}
}
//==========================================================================
//
// Weapon display (Duke only)
//
//==========================================================================
void DrawWeaponAmounts(const struct player_struct* p, double x, double y)
{
int cw = p->curr_weapon;
auto ShadeForWeapon = [=](int weapon, int optweapon = -1)
{
// Headache-inducing math at play here.
return (((!p->ammo_amount[weapon]) | (!p->gotweapon[weapon])) * 9) + 12 - 18 * ((cw == weapon) || (optweapon != -1 && cw == optweapon));
};
DrawWeaponNum(2, x, y, p->ammo_amount[PISTOL_WEAPON], gs.max_ammo_amount[PISTOL_WEAPON], 12 - 20 * (cw == PISTOL_WEAPON), 3);
DrawWeaponNum(3, x, y + 6, p->ammo_amount[SHOTGUN_WEAPON], gs.max_ammo_amount[SHOTGUN_WEAPON], ShadeForWeapon(SHOTGUN_WEAPON), 3);
DrawWeaponNum(4, x, y + 12, p->ammo_amount[CHAINGUN_WEAPON], gs.max_ammo_amount[CHAINGUN_WEAPON], ShadeForWeapon(CHAINGUN_WEAPON), 3);
DrawWeaponNum(5, x + 39, y, p->ammo_amount[RPG_WEAPON], gs.max_ammo_amount[RPG_WEAPON], ShadeForWeapon(RPG_WEAPON), 2);
DrawWeaponNum(6, x + 39, y + 6, p->ammo_amount[HANDBOMB_WEAPON], gs.max_ammo_amount[HANDBOMB_WEAPON], ShadeForWeapon(HANDBOMB_WEAPON, HANDREMOTE_WEAPON), 2);
if (p->subweapon & (1 << GROW_WEAPON)) // original code says: if(!p->ammo_amount[SHRINKER_WEAPON] || cw == GROW_WEAPON)
DrawWeaponNum(7, x + 39, y + 12, p->ammo_amount[GROW_WEAPON], gs.max_ammo_amount[GROW_WEAPON], ShadeForWeapon(GROW_WEAPON), 2);
else
DrawWeaponNum(7, x + 39, y + 12, p->ammo_amount[SHRINKER_WEAPON], gs.max_ammo_amount[SHRINKER_WEAPON], ShadeForWeapon(SHRINKER_WEAPON), 2);
DrawWeaponNum(8, x + 70, y, p->ammo_amount[DEVISTATOR_WEAPON], gs.max_ammo_amount[DEVISTATOR_WEAPON], ShadeForWeapon(DEVISTATOR_WEAPON), 2);
DrawWeaponNum(9, x + 70, y + 6, p->ammo_amount[TRIPBOMB_WEAPON], gs.max_ammo_amount[TRIPBOMB_WEAPON], ShadeForWeapon(TRIPBOMB_WEAPON), 2);
DrawWeaponNum(0, x + 70, y + 12, p->ammo_amount[FREEZE_WEAPON], gs.max_ammo_amount[FREEZE_WEAPON], ShadeForWeapon(FREEZE_WEAPON), 2);
}
//==========================================================================
//
// Status bar drawer
//
//==========================================================================
void Statusbar(int snum)
{
auto p = &ps[snum];
int h = tileHeight(BOTTOMSTATUSBAR);
int top = 200 - h;
int left = (320 - tileWidth(BOTTOMSTATUSBAR)) / 2;
BeginStatusBar(320, 200, h);
DrawInventory(p, 160, 154, 0);
if (hud_size == Hud_StbarOverlay) Set43ClipRect();
DrawGraphic(tileGetTexture(BOTTOMSTATUSBAR), left, top, DI_ITEM_LEFT_TOP, 1, -1, -1, 1, 1);
twod->ClearClipRect();
FString format;
if (ud.multimode > 1 && !ud.coop)
{
DrawGraphic(tileGetTexture(KILLSICON), 228, top + 8, DI_ITEM_OFFSETS, 1, 0, 0, 1, 1);
format.Format("%d", max(p->frag - p->fraggedself, 0));
SBar_DrawString(this, digiFont, format, 287, top + 17, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, 1, 1);
}
else
{
auto key = tileGetTexture(ACCESS_ICON);
if (p->got_access & 4) DrawGraphic(key, 275.5, top + 16, DI_ITEM_OFFSETS, 1, -1, -1, 1, 1, STYLE_Translucent, 0xffffffff, TRANSLATION(Translation_Remap, 23));
if (p->got_access & 2) DrawGraphic(key, 288.5, top + 16, DI_ITEM_OFFSETS, 1, -1, -1, 1, 1, STYLE_Translucent, 0xffffffff, TRANSLATION(Translation_Remap, 21));
if (p->got_access & 1) DrawGraphic(key, 282, top + 23, DI_ITEM_OFFSETS, 1, -1, -1, 1, 1, STYLE_Translucent, 0xffffffff, TRANSLATION(Translation_Remap, 0));
}
DrawWeaponAmounts(p, 96, top + 15.5);
int num = (p->GetActor()->s->pal == 1 && p->last_extra < 2) ? 1 : p->last_extra;
format.Format("%d", num);
SBar_DrawString(this, digiFont, format, 31, top + 17, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, 1, 1);
format.Format("%d", GetMoraleOrShield(p, snum));
SBar_DrawString(this, digiFont, format, 63, top + 17, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, 1, 1);
if (p->curr_weapon != KNEE_WEAPON)
{
int wep = (p->curr_weapon == HANDREMOTE_WEAPON)? HANDBOMB_WEAPON : p->curr_weapon;
format.Format("%d", p->ammo_amount[wep]);
SBar_DrawString(this, digiFont, format, 207, top + 17, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, 1, 1);
}
int icon = p->inven_icon;
if (icon)
{
int x = 232;
if (icon < ICON_MAX)
DrawGraphic(tileGetTexture(item_icons[icon]), x, top + 20.5, DI_ITEM_LEFT | DI_ITEM_VCENTER, 1, -1, -1, 1, 1);
int percentv = getinvamount(p);
format.Format("%3d%%", percentv);
int color = percentv > 50 ? 11 : percentv > 25 ? 23 : 2;
SBar_DrawString(this, miniFont, format, x + 34, top + 24, DI_TEXT_ALIGN_RIGHT, CR_UNDEFINED, 1, 0, 0, 1, 1, TRANSLATION(Translation_Remap, color));
auto text = ontext(p);
if (text.first) SBar_DrawString(this, miniFont, text.first, x + 34, top + 14, DI_TEXT_ALIGN_RIGHT, CR_UNDEFINED, 1, 0, 0, 1, 1, TRANSLATION(Translation_Remap, text.second));
}
PrintLevelStats(-1);
}
void UpdateStatusBar()
{
if (hud_size >= Hud_Mini)
{
DrawHud(screenpeek, hud_size == Hud_Nothing ? 0 : hud_size == Hud_full ? 1 : 2);
}
else
{
Statusbar(screenpeek);
}
}
};
IMPLEMENT_CLASS(DNativeDukeStatusBar, false, false)
DBaseStatusBar* CreateDukeStatusBar()
{
return Create<DNativeDukeStatusBar>();
}
END_DUKE_NS

View File

@ -1,480 +0,0 @@
//-------------------------------------------------------------------------
/*
Copyright (C) 1996, 2003 - 3D Realms Entertainment
Copyright (C) 2020 - Christoph Oelckers
This file is part of Enhanced Duke Nukem 3D version 1.5 - Atomic Edition
Duke Nukem 3D is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Original Source: 1996 - Todd Replogle
Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
*/
//-------------------------------------------------------------------------
#include "ns.h" // Must come before everything else!
#include "v_font.h"
#include "duke3d.h"
#include "compat.h"
#include "sbar.h"
#include "v_draw.h"
#include "names_r.h"
#include "texturemanager.h"
#include "dukeactor.h"
#include "v_video.h"
#include "v_draw.h"
BEGIN_DUKE_NS
//==========================================================================
//
// very much a dummy just to access the methods.
// The goal is to export this to a script.
//
//==========================================================================
class DNativeRedneckStatusBar : public DNativeDukeCommonStatusBar
{
DECLARE_CLASS(DNativeRedneckStatusBar, DNativeDukeCommonStatusBar)
public:
DNativeRedneckStatusBar()
{
numberFont = Create<DHUDFont>(BigFont, 0, Off, 1, 1 );
miniFont = Create<DHUDFont>(SmallFont2, 0, 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.
SetSize(tileHeight(BOTTOMSTATUSBAR));
scale = 0.5;
ammo_sprites = { -1, AMMO, SHOTGUNAMMO, BATTERYAMMO, HBOMBAMMO, HBOMBAMMO, SAWAMMO, DEVISTATORAMMO, TRIPBOMBSPRITE, GROWSPRITEICON, HBOMBAMMO, -1, BOWLINGBALLSPRITE, MOTOAMMO, BOATAMMO, -1, RPG2SPRITE };
item_icons = { 0, FIRSTAID_ICON, STEROIDS_ICON, HOLODUKE_ICON, JETPACK_ICON, HEAT_ICON, AIRTANK_ICON, BOOT_ICON };
}
int getinvamount(const struct player_struct* p)
{
switch (p->inven_icon)
{
case ICON_FIRSTAID:
return p->firstaid_amount;
case ICON_STEROIDS:
return (p->steroids_amount + 3) >> 2;
case ICON_HOLODUKE:
return (p->holoduke_amount) / 400;
case ICON_JETPACK:
return (p->jetpack_amount) / 100;
case ICON_HEATS:
return p->heat_amount / 12;
case ICON_SCUBA:
return (p->scuba_amount + 63) >> 6;
case ICON_BOOTS:
return (p->boot_amount / 10) >> 1;
}
return -1;
}
//==========================================================================
//
// Fullscreen HUD variant #1 for RR
//
//==========================================================================
void FullscreenHUD1(struct player_struct* p, int snum)
{
FString format;
FGameTexture* img;
double imgScale;
double baseScale = (scale * numberFont->mFont->GetHeight()) * 0.76;
//
// Health
//
img = tileGetTexture(SPINNINGNUKEICON1);
imgScale = baseScale / img->GetDisplayHeight();
DrawGraphic(img, 2, -2, DI_ITEM_LEFT_BOTTOM, 1, 0, 0, imgScale, imgScale);
if (!althud_flashing || p->last_extra > (gs.max_player_health >> 2) || (PlayClock & 32) || (p->GetActor()->s->pal == 1 && p->last_extra < 2))
{
int s = -8;
if (althud_flashing && p->last_extra > gs.max_player_health)
s += bsin(I_GetBuildTime() << 5) / 768;
int intens = clamp(255 - 6 * s, 0, 255);
format.Format("%d", p->last_extra);
SBar_DrawString(this, numberFont, format, 26.5, -numberFont->mFont->GetHeight() * scale + 4, DI_TEXT_ALIGN_LEFT, CR_UNTRANSLATED, intens / 255., 0, 0, scale, scale);
}
//
// drink
//
img = tileGetTexture(BEER);
imgScale = baseScale / img->GetDisplayHeight();
DrawGraphic(img, 74, -2, DI_ITEM_LEFT_BOTTOM, 1, 0, 0, imgScale, imgScale);
format.Format("%d", p->drink_amt);
SBar_DrawString(this, numberFont, format, 86, -numberFont->mFont->GetHeight() * scale + 4, DI_TEXT_ALIGN_LEFT, CR_UNTRANSLATED, 1, 0, 0, scale, scale);
//
// eat
//
img = tileGetTexture(COWPIE);
imgScale = baseScale / img->GetDisplayHeight();
DrawGraphic(img, 133.5, -2, DI_ITEM_LEFT_BOTTOM, 1, 0, 0, imgScale, imgScale);
format.Format("%d", p->eat);
SBar_DrawString(this, numberFont, format, 173, -numberFont->mFont->GetHeight() * scale + 4, DI_TEXT_ALIGN_LEFT, CR_UNTRANSLATED, 1, 0, 0, scale, scale);
//
// selected weapon
//
int weapon = p->curr_weapon;
if (weapon == HANDREMOTE_WEAPON) weapon = DYNAMITE_WEAPON;
int wicon = ammo_sprites[weapon];
if (wicon > 0)
{
int ammo = p->ammo_amount[weapon];
bool reloadableWeapon = weapon == PISTOL_WEAPON || weapon == SHOTGUN_WEAPON;
if (!reloadableWeapon || (reloadableWeapon && !cl_showmagamt))
{
format.Format("%d", ammo);
}
else
{
short clip;
switch (weapon)
{
case PISTOL_WEAPON:
clip = CalcMagazineAmount(ammo, 6, p->kickback_pic >= 1);
break;
case SHOTGUN_WEAPON:
clip = CalcMagazineAmount(ammo, 2, p->kickback_pic >= 4);
break;
}
format.Format("%d/%d", clip, ammo - clip);
}
img = tileGetTexture(wicon);
imgScale = baseScale / img->GetDisplayHeight();
auto imgX = 22.5;
auto strlen = format.Len();
if (strlen > 1)
{
imgX += (imgX * 0.755) * (strlen - 1);
}
if (weapon != KNEE_WEAPON && weapon != SLINGBLADE_WEAPON && (!althud_flashing || PlayClock & 32 || ammo > (gs.max_ammo_amount[weapon] / 10)))
{
SBar_DrawString(this, numberFont, format, -1, -numberFont->mFont->GetHeight() * scale + 4, DI_TEXT_ALIGN_RIGHT, CR_UNTRANSLATED, 1, 0, 0, scale, scale);
}
DrawGraphic(img, -imgX, -2, DI_ITEM_RIGHT_BOTTOM, 1, -1, -1, imgScale, imgScale);
}
//
// Selected inventory item
//
unsigned icon = p->inven_icon;
if (icon > 0)
{
int x = -130;
if (icon < ICON_MAX)
{
img = tileGetTexture(item_icons[icon]);
imgScale = baseScale / img->GetDisplayHeight();
DrawGraphic(img, x, -2, DI_ITEM_RIGHT_BOTTOM, 1, -1, -1, imgScale, imgScale);
}
int percentv = getinvamount(p);
if (icon <= 2) format.Format("%d%%", percentv);
else format.Format("%d", percentv);
SBar_DrawString(this, miniFont, format, x + 19, -miniFont->mFont->GetHeight() * scale - 1, DI_TEXT_ALIGN_RIGHT, CR_UNTRANSLATED, 1, 0, 0, scale, scale);
auto text = ontext(p);
if (text.first) SBar_DrawString(this, miniFont, text.first, x + 20, -miniFont->mFont->GetHeight() * scale - 15, DI_TEXT_ALIGN_RIGHT, CR_UNTRANSLATED, 1, 0, 0, scale, scale);
}
//
// keys
//
if (p->keys[1]) DrawGraphic(tileGetTexture(ACCESSCARD), -28.5, -32 , DI_ITEM_BOTTOM, 1, -1, -1, scale, scale, STYLE_Translucent, 0xffffffff, TRANSLATION(Translation_Remap, 0));
if (p->keys[3]) DrawGraphic(tileGetTexture(ACCESSCARD), -21.25, -28.375, DI_ITEM_BOTTOM, 1, -1, -1, scale, scale, STYLE_Translucent, 0xffffffff, TRANSLATION(Translation_Remap, 23));
if (p->keys[2]) DrawGraphic(tileGetTexture(ACCESSCARD), -14, -24.75 , DI_ITEM_BOTTOM, 1, -1, -1, scale, scale, STYLE_Translucent, 0xffffffff, TRANSLATION(Translation_Remap, 21));
}
//==========================================================================
//
// Fullscreen HUD variant #2 for RR
//
//==========================================================================
void FullscreenHUD2(struct player_struct* p)
{
//
// health
//
DrawGraphic(tileGetTexture(HEALTHBOX), 2, -2, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, scale, scale);
int health = (p->GetActor()->s->pal == 1 && p->last_extra < 2) ? 1 : p->last_extra;
FStringf format("%d", health);
SBar_DrawString(this, digiFont, format, 21.5, -digiFont->mFont->GetHeight() * scale - 5.5, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale);
//
// ammo
//
DrawGraphic(tileGetTexture(AMMOBOX), 41, -2, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, scale, scale);
int wp = p->curr_weapon == THROWINGDYNAMITE_WEAPON? DYNAMITE_WEAPON : p->curr_weapon;
format.Format("%d", p->ammo_amount[wp]);
SBar_DrawString(this, digiFont, format, 60.25, -digiFont->mFont->GetHeight() * scale - 5.5, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale);
//
// inventory
//
unsigned icon = p->inven_icon;
if (icon > 0)
{
int x = 84;
DrawGraphic(tileGetTexture(INVENTORYBOX), 77, -2, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, scale, scale);
if (icon < ICON_MAX)
DrawGraphic(tileGetTexture(item_icons[icon]), x, -15.375, DI_ITEM_LEFT | DI_ITEM_VCENTER, 1, -1, -1, scale, scale);
int percentv = getinvamount(p);
if (icon <= 2) format.Format("%d%%", percentv);
else format.Format("%d", percentv);
SBar_DrawString(this, miniFont, format, x + 31.5, -miniFont->mFont->GetHeight() * scale - 6.5, DI_TEXT_ALIGN_RIGHT, CR_UNTRANSLATED, 1, 0, 0, scale, scale);
}
}
//==========================================================================
//
// Fullscreen HUD drawer
//
//==========================================================================
void DrawHud(int snum, int style)
{
auto p = &ps[snum];
BeginHUD(320, 200, 1.f);
if (style == 1)
{
double y = -40;
if (ud.multimode > 1)
y -= 4;
if (ud.multimode > 4)
y -= 4;
DrawInventory(p, 0, y, DI_SCREEN_CENTER_BOTTOM);
FullscreenHUD1(p, snum);
PrintLevelStats(int(scale * tileHeight(BIGALPHANUM) + 10));
}
else if (style == 2)
{
DrawInventory(p, 56, -20, DI_SCREEN_CENTER_BOTTOM);
FullscreenHUD2(p);
PrintLevelStats(int(scale * tileHeight(HEALTHBOX) + 4));
}
else
{
DrawInventory(p, 0, -20, DI_SCREEN_CENTER_BOTTOM);
PrintLevelStats(2);
}
}
//==========================================================================
//
// Status bar drawer (RR)
//
//==========================================================================
void DrawWeaponBar(const struct player_struct* p, int top)
{
double sbscale = 32800. / 65536.;
DrawGraphic(tileGetTexture(WEAPONBAR), 0, 158, DI_ITEM_OFFSETS, 1, 0, 0, sbscale, sbscale);
for (int i = 0; i < 9; i++)
{
FGameTexture* img = nullptr;
FString format;
if ((g_gameType & GAMEFLAG_RRRA) && i == 4 && p->curr_weapon == CHICKEN_WEAPON)
{
img = tileGetTexture(AMMO_ICON10);
format.Format("%d", p->ammo_amount[CHICKEN_WEAPON]);
}
else
{
if (p->gotweapon[i+1])
{
img = tileGetTexture(AMMO_ICON0 + i);
format.Format("%d", p->ammo_amount[i+1]);
}
}
if (img)
{
DrawGraphic(img, 18 + i * 32, top - 6.5, DI_ITEM_OFFSETS, 1, 0, 0, sbscale, sbscale);
}
if (format.Len())
{
SBar_DrawString(this, miniFont, format, 38 + i * 32, 162.75 - miniFont->mFont->GetHeight() * scale * 0.5, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale * .875, scale * .875);
}
}
}
//==========================================================================
//
// Status bar drawer (RR)
//
//==========================================================================
void Statusbar(int snum)
{
auto p = &ps[snum];
double h = tileHeight(BOTTOMSTATUSBAR) * scale;
double wh = 0;
if (hud_size < Hud_Stbar) wh = tileHeight(WEAPONBAR) * scale;
double left = (320 - tileWidth(BOTTOMSTATUSBAR) * scale) / 2;
double top = 200 - h;
BeginStatusBar(320, 200, int(wh + h));
DrawInventory(p, 160, hud_size <= Hud_Stbar? 148 : 154, 0);
if (hud_size <= Hud_Stbar)
DrawWeaponBar(p, (int)top);
if (hud_size == Hud_StbarOverlay) Set43ClipRect();
DrawGraphic(tileGetTexture(BOTTOMSTATUSBAR), left, top, DI_ITEM_LEFT_TOP, 1, -1, -1, scale, scale);
twod->ClearClipRect();
FString format;
if (ud.multimode > 1 && !ud.coop)
{
DrawGraphic(tileGetTexture(KILLSICON), 228, top + 8, DI_ITEM_OFFSETS, 1, 0, 0, 1, 1);
format.Format("%d", max(p->frag - p->fraggedself, 0));
SBar_DrawString(this, digiFont, format, 287, top + 17, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale);
}
else
{
auto key = tileGetTexture(ACCESS_ICON);
if (p->keys[3]) DrawGraphic(key, 138, top + 13, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale, STYLE_Translucent, 0xffffffff, TRANSLATION(Translation_Remap, 23));
if (p->keys[2]) DrawGraphic(key, 152, top + 13, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale, STYLE_Translucent, 0xffffffff, TRANSLATION(Translation_Remap, 21));
if (p->keys[1]) DrawGraphic(key, 145, top + 21, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale, STYLE_Translucent, 0xffffffff, TRANSLATION(Translation_Remap, 0));
}
int num = (p->GetActor()->s->pal == 1 && p->last_extra < 2) ? 1 : p->last_extra;
format.Format("%d", num);
SBar_DrawString(this, digiFont, format, 66.5, top + 16, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale);
if (p->curr_weapon != KNEE_WEAPON)
{
int wep = (p->curr_weapon == HANDREMOTE_WEAPON) ? DYNAMITE_WEAPON : p->curr_weapon;
format.Format("%d", p->ammo_amount[wep]);
SBar_DrawString(this, digiFont, format, 110, top + 16, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale);
}
int icon = p->inven_icon;
if (icon)
{
int x = 182;
if (icon < ICON_MAX)
DrawGraphic(tileGetTexture(item_icons[icon]), x, top + 20.125, DI_ITEM_LEFT | DI_ITEM_VCENTER, 1, -1, -1, scale, scale);
int percentv = getinvamount(p);
if (icon <= 2) format.Format("%d%%", percentv);
else format.Format("%d", percentv);
SBar_DrawString(this, miniFont, format, x + 38, top + 23.5, DI_TEXT_ALIGN_RIGHT, CR_UNTRANSLATED, 1, 0, 0, scale, scale);
if (p->inven_icon == ICON_SCUBA || p->inven_icon == ICON_BOOTS)
SBar_DrawString(this, miniFont, "AUTO", x + 39, top + 13, DI_TEXT_ALIGN_RIGHT, CR_UNTRANSLATED, 1, 0, 0, scale, scale);
}
p->drunkang = ((p->drink_amt * 8) + 1647) & 2047;
if (p->drink_amt >= 100)
{
p->drink_amt = 100;
p->drunkang = 400;
}
DrawRotated(tileGetTexture(GUTMETER), 256, top + 15, DI_ITEM_RELCENTER, p->drunkang * -BAngToDegree, 1, scale, scale, 0xffffffff, 0);
DrawRotated(tileGetTexture(GUTMETER), 292, top + 15, DI_ITEM_RELCENTER, p->eatang * -BAngToDegree, 1, scale, scale, 0xffffffff, 0);
if (p->drink_amt >= 0 && p->drink_amt <= 30)
{
DrawGraphic(tileGetTexture(GUTMETER_LIGHT1), 239, top + 24, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale);
}
else if (p->drink_amt >= 31 && p->drink_amt <= 65)
{
DrawGraphic(tileGetTexture(GUTMETER_LIGHT2), 248, top + 24, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale);
}
else if (p->drink_amt >= 66 && p->drink_amt <= 87)
{
DrawGraphic(tileGetTexture(GUTMETER_LIGHT3), 256, top + 24, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale);
}
else
{
DrawGraphic(tileGetTexture(GUTMETER_LIGHT4), 265, top + 24, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale);
}
if (p->eat >= 0 && p->eat <= 30)
{
DrawGraphic(tileGetTexture(GUTMETER_LIGHT1), 276, top + 24, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale);
}
else if (p->eat >= 31 && p->eat <= 65)
{
DrawGraphic(tileGetTexture(GUTMETER_LIGHT2), 285, top + 24, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale);
}
else if (p->eat >= 66 && p->eat <= 87)
{
DrawGraphic(tileGetTexture(GUTMETER_LIGHT3), 294, top + 24, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale);
}
else
{
DrawGraphic(tileGetTexture(GUTMETER_LIGHT4), 302, top + 24, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale);
}
PrintLevelStats(-1);
}
void UpdateStatusBar()
{
if (hud_size >= Hud_Mini)
{
DrawHud(screenpeek, hud_size == Hud_Nothing ? 0 : hud_size == Hud_full ? 1 : 2);
}
else
{
Statusbar(screenpeek);
}
}
};
IMPLEMENT_CLASS(DNativeRedneckStatusBar, false, false)
DBaseStatusBar* CreateRedneckStatusBar()
{
return Create<DNativeRedneckStatusBar>();
}
END_DUKE_NS

View File

@ -250,14 +250,5 @@ class BaseStatusBar : StatusBarCore native
{}
class NativeDukeCommonStatusBar : BaseStatusBar native
{}
class NativeDukeStatusBar : NativeDukeCommonStatusBar native
{}
class NativeRedneckStatusBar : NativeDukeCommonStatusBar native
{}
class SWStatusBar : BaseStatusBar native
{}