2016-03-01 15:47:10 +00:00
|
|
|
/*
|
|
|
|
** Enhanced heads up 'overlay' for fullscreen
|
|
|
|
**
|
|
|
|
**---------------------------------------------------------------------------
|
|
|
|
** Copyright 2003-2008 Christoph Oelckers
|
|
|
|
** All rights reserved.
|
|
|
|
**
|
|
|
|
** Redistribution and use in source and binary forms, with or without
|
|
|
|
** modification, are permitted provided that the following conditions
|
|
|
|
** are met:
|
|
|
|
**
|
|
|
|
** 1. Redistributions of source code must retain the above copyright
|
|
|
|
** notice, this list of conditions and the following disclaimer.
|
|
|
|
** 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
** notice, this list of conditions and the following disclaimer in the
|
|
|
|
** documentation and/or other materials provided with the distribution.
|
|
|
|
** 3. The name of the author may not be used to endorse or promote products
|
|
|
|
** derived from this software without specific prior written permission.
|
|
|
|
**
|
|
|
|
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
**---------------------------------------------------------------------------
|
|
|
|
**
|
|
|
|
*/
|
|
|
|
|
|
|
|
// NOTE: Some stuff in here might seem a little redundant but I wanted this
|
|
|
|
// to be as true as possible to my original intent which means that it
|
|
|
|
// only uses that code from ZDoom's status bar that is the same as any
|
|
|
|
// copy would be.
|
|
|
|
|
|
|
|
#include "doomtype.h"
|
|
|
|
#include "doomdef.h"
|
|
|
|
#include "v_video.h"
|
|
|
|
#include "gi.h"
|
|
|
|
#include "w_wad.h"
|
|
|
|
#include "a_keys.h"
|
|
|
|
#include "sbar.h"
|
|
|
|
#include "sc_man.h"
|
|
|
|
#include "p_local.h"
|
|
|
|
#include "doomstat.h"
|
|
|
|
#include "g_level.h"
|
|
|
|
#include "d_net.h"
|
|
|
|
#include "d_player.h"
|
|
|
|
#include "r_utility.h"
|
2016-10-12 17:22:33 +00:00
|
|
|
#include "cmdlib.h"
|
2017-01-08 17:45:30 +00:00
|
|
|
#include "g_levellocals.h"
|
2017-04-12 23:12:04 +00:00
|
|
|
#include "vm.h"
|
2016-03-01 15:47:10 +00:00
|
|
|
|
|
|
|
#include <time.h>
|
|
|
|
|
|
|
|
|
|
|
|
#define HUMETA_AltIcon 0x10f000
|
|
|
|
|
|
|
|
EXTERN_CVAR(Bool,am_follow)
|
|
|
|
EXTERN_CVAR (Int, con_scaletext)
|
|
|
|
EXTERN_CVAR (Bool, idmypos)
|
|
|
|
EXTERN_CVAR (Int, screenblocks)
|
2017-03-30 00:16:23 +00:00
|
|
|
EXTERN_CVAR(Bool, hud_aspectscale)
|
2016-03-01 15:47:10 +00:00
|
|
|
|
|
|
|
EXTERN_CVAR (Bool, am_showtime)
|
|
|
|
EXTERN_CVAR (Bool, am_showtotaltime)
|
|
|
|
|
2017-03-30 00:16:23 +00:00
|
|
|
CVAR(Int,hud_althudscale, 0, CVAR_ARCHIVE) // Scale the hud to 640x400?
|
2016-03-01 15:47:10 +00:00
|
|
|
CVAR(Bool,hud_althud, false, CVAR_ARCHIVE) // Enable/Disable the alternate HUD
|
|
|
|
|
|
|
|
// These are intentionally not the same as in the automap!
|
|
|
|
CVAR (Bool, hud_showsecrets, true,CVAR_ARCHIVE); // Show secrets on HUD
|
|
|
|
CVAR (Bool, hud_showmonsters, true,CVAR_ARCHIVE); // Show monster stats on HUD
|
|
|
|
CVAR (Bool, hud_showitems, false,CVAR_ARCHIVE); // Show item stats on HUD
|
|
|
|
CVAR (Bool, hud_showstats, false, CVAR_ARCHIVE); // for stamina and accuracy.
|
|
|
|
CVAR (Bool, hud_showscore, false, CVAR_ARCHIVE); // for user maintained score
|
|
|
|
CVAR (Bool, hud_showweapons, true, CVAR_ARCHIVE); // Show weapons collected
|
|
|
|
CVAR (Int , hud_showammo, 2, CVAR_ARCHIVE); // Show ammo collected
|
|
|
|
CVAR (Int , hud_showtime, 0, CVAR_ARCHIVE); // Show time on HUD
|
|
|
|
CVAR (Int , hud_timecolor, CR_GOLD,CVAR_ARCHIVE); // Color of in-game time on HUD
|
|
|
|
CVAR (Int , hud_showlag, 0, CVAR_ARCHIVE); // Show input latency (maketic - gametic difference)
|
|
|
|
|
2016-07-16 13:48:36 +00:00
|
|
|
CVAR (Int, hud_ammo_order, 0, CVAR_ARCHIVE); // ammo image and text order
|
2016-03-01 15:47:10 +00:00
|
|
|
CVAR (Int, hud_ammo_red, 25, CVAR_ARCHIVE) // ammo percent less than which status is red
|
|
|
|
CVAR (Int, hud_ammo_yellow, 50, CVAR_ARCHIVE) // ammo percent less is yellow more green
|
|
|
|
CVAR (Int, hud_health_red, 25, CVAR_ARCHIVE) // health amount less than which status is red
|
|
|
|
CVAR (Int, hud_health_yellow, 50, CVAR_ARCHIVE) // health amount less than which status is yellow
|
|
|
|
CVAR (Int, hud_health_green, 100, CVAR_ARCHIVE) // health amount above is blue, below is green
|
|
|
|
CVAR (Int, hud_armor_red, 25, CVAR_ARCHIVE) // armor amount less than which status is red
|
|
|
|
CVAR (Int, hud_armor_yellow, 50, CVAR_ARCHIVE) // armor amount less than which status is yellow
|
|
|
|
CVAR (Int, hud_armor_green, 100, CVAR_ARCHIVE) // armor amount above is blue, below is green
|
|
|
|
|
|
|
|
CVAR (Bool, hud_berserk_health, true, CVAR_ARCHIVE); // when found berserk pack instead of health box
|
2017-12-30 10:10:39 +00:00
|
|
|
CVAR (Bool, hud_showangles, false, CVAR_ARCHIVE) // show player's pitch, yaw, roll
|
2016-03-01 15:47:10 +00:00
|
|
|
|
|
|
|
CVAR (Int, hudcolor_titl, CR_YELLOW, CVAR_ARCHIVE) // color of automap title
|
|
|
|
CVAR (Int, hudcolor_time, CR_RED, CVAR_ARCHIVE) // color of level/hub time
|
|
|
|
CVAR (Int, hudcolor_ltim, CR_ORANGE, CVAR_ARCHIVE) // color of single level time
|
|
|
|
CVAR (Int, hudcolor_ttim, CR_GOLD, CVAR_ARCHIVE) // color of total time
|
|
|
|
CVAR (Int, hudcolor_xyco, CR_GREEN, CVAR_ARCHIVE) // color of coordinates
|
|
|
|
|
|
|
|
CVAR (Int, hudcolor_statnames, CR_RED, CVAR_ARCHIVE) // For the letters before the stats
|
|
|
|
CVAR (Int, hudcolor_stats, CR_GREEN, CVAR_ARCHIVE) // For the stats values themselves
|
|
|
|
|
|
|
|
|
|
|
|
CVAR(Bool, map_point_coordinates, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) // show player or map coordinates?
|
|
|
|
|
|
|
|
static FFont * HudFont; // The font for the health and armor display
|
|
|
|
static FFont * IndexFont; // The font for the inventory indices
|
|
|
|
|
|
|
|
// Icons
|
|
|
|
static FTexture * healthpic; // Health icon
|
|
|
|
static FTexture * berserkpic; // Berserk icon (Doom only)
|
|
|
|
static FTexture * fragpic; // Frags icon
|
2017-03-26 23:02:10 +00:00
|
|
|
static FTexture * invgems[2]; // Inventory arrows
|
2018-12-01 13:01:03 +00:00
|
|
|
static FTextureID tnt1a0; // We need this to check for empty sprites.
|
2016-03-01 15:47:10 +00:00
|
|
|
|
|
|
|
static int hudwidth, hudheight; // current width/height for HUD display
|
|
|
|
static int statspace;
|
|
|
|
|
2018-12-01 23:34:28 +00:00
|
|
|
DObject *althud; // scripted parts. This is here to make a gradual transition
|
|
|
|
|
2016-03-24 00:46:11 +00:00
|
|
|
DVector2 AM_GetPosition();
|
2016-03-01 15:47:10 +00:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// Draws an image into a box with its bottom center at the bottom
|
|
|
|
// center of the box. The image is scaled down if it doesn't fit
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
2017-02-04 12:11:12 +00:00
|
|
|
static void DrawImageToBox(FTexture * tex, int x, int y, int w, int h, double trans = 0.75)
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
2018-12-01 23:34:28 +00:00
|
|
|
IFVM(AltHud, DrawImageToBox)
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
2018-12-01 23:34:28 +00:00
|
|
|
VMValue params[] = { althud, tex->id.GetIndex(), x, y, w, h, trans };
|
|
|
|
VMCall(func, params, countof(params), nullptr, 0);
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// Draws a text but uses a fixed width for all characters
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2017-02-04 12:11:12 +00:00
|
|
|
static void DrawHudText(FFont *font, int color, char * text, int x, int y, double trans = 0.75)
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
2018-12-01 23:34:28 +00:00
|
|
|
IFVM(AltHud, DrawHudText)
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
2018-12-01 23:34:28 +00:00
|
|
|
FString string = text;
|
|
|
|
VMValue params[] = { althud, font, color, &string, x, y, trans };
|
|
|
|
VMCall(func, params, countof(params), nullptr, 0);
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// Draws a number with a fixed width for all digits
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2017-02-04 12:11:12 +00:00
|
|
|
static void DrawHudNumber(FFont *font, int color, int num, int x, int y, double trans = 0.75)
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
2018-12-01 23:34:28 +00:00
|
|
|
IFVM(AltHud, DrawHudNumber)
|
|
|
|
{
|
|
|
|
VMValue params[] = { althud, font, color, num, x, y, trans };
|
|
|
|
VMCall(func, params, countof(params), nullptr, 0);
|
|
|
|
}
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// draw the status (number of kills etc)
|
|
|
|
//
|
|
|
|
//===========================================================================
|
|
|
|
|
|
|
|
static void DrawStatus(player_t * CPlayer, int x, int y)
|
|
|
|
{
|
2018-12-01 23:34:28 +00:00
|
|
|
IFVM(AltHud, DrawStatus)
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
2018-12-01 23:34:28 +00:00
|
|
|
VMValue params[] = { althud, CPlayer, x, y };
|
|
|
|
VMCall(func, params, countof(params), nullptr, 0);
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// draw health
|
|
|
|
//
|
|
|
|
//===========================================================================
|
|
|
|
|
|
|
|
static void DrawHealth(player_t *CPlayer, int x, int y)
|
|
|
|
{
|
2018-12-01 23:34:28 +00:00
|
|
|
IFVM(AltHud, DrawHealth)
|
|
|
|
{
|
|
|
|
VMValue params[] = { althud, CPlayer, x, y };
|
|
|
|
VMCall(func, params, countof(params), nullptr, 0);
|
|
|
|
}
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// Draw Armor.
|
|
|
|
// very similar to drawhealth, but adapted to handle Hexen armor too
|
|
|
|
//
|
|
|
|
//===========================================================================
|
|
|
|
|
2017-01-18 22:42:08 +00:00
|
|
|
static void DrawArmor(AInventory * barmor, AInventory * harmor, int x, int y)
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
2018-12-01 23:34:28 +00:00
|
|
|
IFVM(AltHud, DrawArmor)
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
2018-12-01 23:34:28 +00:00
|
|
|
VMValue params[] = { althud, barmor, harmor, x, y };
|
|
|
|
VMCall(func, params, countof(params), nullptr, 0);
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// KEYS
|
|
|
|
//
|
|
|
|
//===========================================================================
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// Draw all keys
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
static int DrawKeys(player_t * CPlayer, int x, int y)
|
|
|
|
{
|
2018-12-01 23:34:28 +00:00
|
|
|
IFVM(AltHud, DrawKeys)
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
2018-12-01 23:34:28 +00:00
|
|
|
VMValue params[] = { althud, CPlayer, x, y };
|
|
|
|
int retv;
|
|
|
|
VMReturn ret(&retv);
|
|
|
|
VMCall(func, params, countof(params), &ret, 1);
|
|
|
|
return retv;
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
2018-12-01 23:34:28 +00:00
|
|
|
return 0;
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// Drawing Ammo
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
2016-07-17 09:11:43 +00:00
|
|
|
|
2016-03-01 15:47:10 +00:00
|
|
|
static int DrawAmmo(player_t *CPlayer, int x, int y)
|
|
|
|
{
|
2018-12-02 08:33:59 +00:00
|
|
|
IFVM(AltHud, DrawAmmo)
|
2016-07-16 13:48:36 +00:00
|
|
|
{
|
2018-12-02 08:33:59 +00:00
|
|
|
VMValue params[] = { althud, CPlayer, x, y };
|
|
|
|
int retv;
|
|
|
|
VMReturn ret(&retv);
|
|
|
|
VMCall(func, params, countof(params), &ret, 1);
|
|
|
|
return retv;
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
2018-12-02 08:33:59 +00:00
|
|
|
return 0;
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-11-25 09:00:55 +00:00
|
|
|
static void DrawOneWeapon(player_t * CPlayer, int x, int & y, AInventory * weapon)
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
2017-02-04 12:11:12 +00:00
|
|
|
double trans;
|
2016-03-01 15:47:10 +00:00
|
|
|
|
|
|
|
// Powered up weapons and inherited sister weapons are not displayed.
|
2018-11-25 07:17:37 +00:00
|
|
|
if (weapon->IntVar(NAME_WeaponFlags) & WIF_POWERED_UP) return;
|
|
|
|
auto SisterWeapon = weapon->PointerVar<AInventory>(NAME_SisterWeapon);
|
|
|
|
if (SisterWeapon && weapon->IsKindOf(SisterWeapon->GetClass())) return;
|
2016-03-01 15:47:10 +00:00
|
|
|
|
2017-02-04 12:11:12 +00:00
|
|
|
trans=0.4;
|
2016-03-01 15:47:10 +00:00
|
|
|
if (CPlayer->ReadyWeapon)
|
|
|
|
{
|
2018-11-25 07:17:37 +00:00
|
|
|
if (weapon==CPlayer->ReadyWeapon || SisterWeapon == CPlayer->ReadyWeapon) trans = 0.85;
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
FTextureID picnum = GetInventoryIcon(weapon, DI_ALTICONFIRST);
|
|
|
|
|
|
|
|
if (picnum.isValid())
|
|
|
|
{
|
|
|
|
FTexture * tex = TexMan[picnum];
|
|
|
|
int w = tex->GetWidth();
|
|
|
|
int h = tex->GetHeight();
|
|
|
|
int rh;
|
|
|
|
if (w>h) rh=8;
|
|
|
|
else rh=16,y-=8; // don't draw tall sprites too small!
|
|
|
|
DrawImageToBox(tex, x-24, y, 20, rh, trans);
|
|
|
|
y-=10;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void DrawWeapons(player_t *CPlayer, int x, int y)
|
|
|
|
{
|
|
|
|
int k,j;
|
|
|
|
AInventory *inv;
|
|
|
|
|
|
|
|
// First draw all weapons in the inventory that are not assigned to a weapon slot
|
|
|
|
for(inv = CPlayer->mo->Inventory; inv; inv = inv->Inventory)
|
|
|
|
{
|
2017-02-08 14:47:22 +00:00
|
|
|
if (inv->IsKindOf(NAME_Weapon) &&
|
2018-11-25 09:00:55 +00:00
|
|
|
!CPlayer->weapons.LocateWeapon(inv->GetClass(), NULL, NULL))
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
2018-11-25 09:00:55 +00:00
|
|
|
DrawOneWeapon(CPlayer, x, y, inv);
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// And now everything in the weapon slots back to front
|
2018-11-24 21:03:56 +00:00
|
|
|
for (k = NUM_WEAPON_SLOTS - 1; k >= 0; k--) for(j = CPlayer->weapons.SlotSize(k) - 1; j >= 0; j--)
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
2018-11-24 21:03:56 +00:00
|
|
|
PClassActor *weap = CPlayer->weapons.GetWeapon(k, j);
|
2016-03-01 15:47:10 +00:00
|
|
|
if (weap)
|
|
|
|
{
|
|
|
|
inv=CPlayer->mo->FindInventory(weap);
|
|
|
|
if (inv)
|
|
|
|
{
|
2018-11-25 09:00:55 +00:00
|
|
|
DrawOneWeapon(CPlayer, x, y, inv);
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// Draw the Inventory
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
static void DrawInventory(player_t * CPlayer, int x,int y)
|
|
|
|
{
|
|
|
|
AInventory * rover;
|
|
|
|
int numitems = (hudwidth - 2*x) / 32;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
CPlayer->mo->InvFirst = rover = StatusBar->ValidateInvFirst(numitems);
|
|
|
|
if (rover!=NULL)
|
|
|
|
{
|
|
|
|
if(rover->PrevInv())
|
|
|
|
{
|
2017-03-26 23:02:10 +00:00
|
|
|
screen->DrawTexture(invgems[0], x-10, y,
|
2016-03-01 15:47:10 +00:00
|
|
|
DTA_KeepRatio, true,
|
2017-02-04 12:11:12 +00:00
|
|
|
DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0.4, TAG_DONE);
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for(i=0;i<numitems && rover;rover=rover->NextInv())
|
|
|
|
{
|
|
|
|
if (rover->Amount>0)
|
|
|
|
{
|
2017-02-08 15:57:48 +00:00
|
|
|
FTextureID AltIcon = rover->AltHUDIcon;
|
2016-03-01 15:47:10 +00:00
|
|
|
|
|
|
|
if (AltIcon.Exists() && (rover->Icon.isValid() || AltIcon.isValid()) )
|
|
|
|
{
|
2017-02-04 12:11:12 +00:00
|
|
|
double trans = rover==CPlayer->mo->InvSel ? 1.0 : 0.4;
|
2016-03-01 15:47:10 +00:00
|
|
|
|
|
|
|
DrawImageToBox(TexMan[AltIcon.isValid()? AltIcon : rover->Icon], x, y, 19, 25, trans);
|
|
|
|
if (rover->Amount>1)
|
|
|
|
{
|
|
|
|
char buffer[10];
|
|
|
|
int xx;
|
|
|
|
mysnprintf(buffer, countof(buffer), "%d", rover->Amount);
|
|
|
|
if (rover->Amount>=1000) xx = 32 - IndexFont->StringWidth(buffer);
|
|
|
|
else xx = 22;
|
|
|
|
|
|
|
|
screen->DrawText(IndexFont, CR_GOLD, x+xx, y+20, buffer,
|
|
|
|
DTA_KeepRatio, true,
|
|
|
|
DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, trans, TAG_DONE);
|
|
|
|
}
|
|
|
|
|
|
|
|
x+=32;
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(rover)
|
|
|
|
{
|
2017-03-26 23:02:10 +00:00
|
|
|
screen->DrawTexture(invgems[1], x-10, y,
|
2016-03-01 15:47:10 +00:00
|
|
|
DTA_KeepRatio, true,
|
2017-02-04 12:11:12 +00:00
|
|
|
DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0.4, TAG_DONE);
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// Draw the Frags
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
static void DrawFrags(player_t * CPlayer, int x, int y)
|
|
|
|
{
|
|
|
|
DrawImageToBox(fragpic, x, y, 31, 17);
|
|
|
|
DrawHudNumber(HudFont, CR_GRAY, CPlayer->fragcount, x + 33, y + 17);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC DrawCoordinates
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
static void DrawCoordinates(player_t * CPlayer)
|
|
|
|
{
|
2016-03-24 00:46:11 +00:00
|
|
|
DVector3 pos;
|
2016-03-01 15:47:10 +00:00
|
|
|
char coordstr[18];
|
|
|
|
int h = SmallFont->GetHeight()+1;
|
|
|
|
|
|
|
|
|
|
|
|
if (!map_point_coordinates || !automapactive)
|
|
|
|
{
|
2016-03-24 00:46:11 +00:00
|
|
|
pos = CPlayer->mo->Pos();
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-03-24 00:46:11 +00:00
|
|
|
DVector2 apos = AM_GetPosition();
|
|
|
|
double z = P_PointInSector(apos)->floorplane.ZatPoint(apos);
|
|
|
|
pos = DVector3(apos, z);
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
|
2017-03-30 00:16:23 +00:00
|
|
|
int xpos = hudwidth - SmallFont->StringWidth("X: -00000")-6;
|
2016-03-01 15:47:10 +00:00
|
|
|
int ypos = 18;
|
|
|
|
|
2017-03-30 00:16:23 +00:00
|
|
|
screen->DrawText(SmallFont, hudcolor_titl, hudwidth - 6 - SmallFont->StringWidth(level.MapName), ypos, level.MapName,
|
2016-04-30 11:03:08 +00:00
|
|
|
DTA_KeepRatio, true,
|
2017-03-30 00:16:23 +00:00
|
|
|
DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, TAG_DONE);
|
2016-04-30 11:03:08 +00:00
|
|
|
|
2017-03-30 00:16:23 +00:00
|
|
|
screen->DrawText(SmallFont, hudcolor_titl, hudwidth - 6 - SmallFont->StringWidth(level.LevelName), ypos + h, level.LevelName,
|
2016-04-30 11:03:08 +00:00
|
|
|
DTA_KeepRatio, true,
|
2017-03-30 00:16:23 +00:00
|
|
|
DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, TAG_DONE);
|
2016-04-30 11:03:08 +00:00
|
|
|
|
2017-12-30 10:10:39 +00:00
|
|
|
int linenum = 3;
|
2016-03-01 15:47:10 +00:00
|
|
|
|
2017-12-30 10:10:39 +00:00
|
|
|
typedef struct CoordEntry
|
|
|
|
{
|
|
|
|
const char* const format;
|
|
|
|
double value;
|
|
|
|
}
|
|
|
|
CoordEntryList[3];
|
2016-03-01 15:47:10 +00:00
|
|
|
|
2017-12-30 10:10:39 +00:00
|
|
|
const auto drawentries = [&](CoordEntryList&& entries)
|
|
|
|
{
|
|
|
|
for (const auto& entry : entries)
|
|
|
|
{
|
|
|
|
mysnprintf(coordstr, countof(coordstr), entry.format, entry.value);
|
|
|
|
screen->DrawText(SmallFont, hudcolor_xyco, xpos, ypos + linenum * h, coordstr,
|
|
|
|
DTA_KeepRatio, true,
|
|
|
|
DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, TAG_DONE);
|
|
|
|
++linenum;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
drawentries({
|
|
|
|
{ "X: %.0f", pos.X },
|
|
|
|
{ "Y: %.0f", pos.Y },
|
|
|
|
{ "Z: %.0f", pos.Z }
|
|
|
|
});
|
|
|
|
|
|
|
|
if (hud_showangles)
|
|
|
|
{
|
|
|
|
const DRotator& angles = CPlayer->mo->Angles;
|
|
|
|
++linenum;
|
|
|
|
|
|
|
|
drawentries({
|
|
|
|
{ "P: %.1f", angles.Pitch.Degrees },
|
|
|
|
{ "Y: %.1f", (90.0 - angles.Yaw).Normalized360().Degrees },
|
|
|
|
{ "R: %.1f", angles.Roll.Degrees },
|
|
|
|
});
|
|
|
|
}
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// Draw in-game time
|
|
|
|
//
|
|
|
|
// Check AltHUDTime option value in wadsrc/static/menudef.txt
|
|
|
|
// for meaning of all display modes
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
static void DrawTime()
|
|
|
|
{
|
|
|
|
if (!ST_IsTimeVisible())
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
int hours = 0;
|
|
|
|
int minutes = 0;
|
|
|
|
int seconds = 0;
|
|
|
|
|
|
|
|
if (hud_showtime < 8)
|
|
|
|
{
|
|
|
|
const int timeTicks =
|
|
|
|
hud_showtime < 4
|
|
|
|
? level.maptime
|
|
|
|
: (hud_showtime < 6
|
|
|
|
? level.time
|
|
|
|
: level.totaltime);
|
|
|
|
const int timeSeconds = Tics2Seconds(timeTicks);
|
|
|
|
|
|
|
|
hours = timeSeconds / 3600;
|
|
|
|
minutes = (timeSeconds % 3600) / 60;
|
|
|
|
seconds = timeSeconds % 60;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
time_t now;
|
|
|
|
time(&now);
|
|
|
|
|
|
|
|
struct tm* timeinfo = localtime(&now);
|
|
|
|
|
|
|
|
if (NULL != timeinfo)
|
|
|
|
{
|
|
|
|
hours = timeinfo->tm_hour;
|
|
|
|
minutes = timeinfo->tm_min;
|
|
|
|
seconds = timeinfo->tm_sec;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const bool showMillis = 1 == hud_showtime;
|
|
|
|
const bool showSeconds = showMillis || (0 == hud_showtime % 2);
|
|
|
|
|
|
|
|
char timeString[sizeof "HH:MM:SS.MMM"];
|
|
|
|
|
|
|
|
if (showMillis)
|
|
|
|
{
|
|
|
|
const int millis = (level.time % TICRATE) * (1000 / TICRATE);
|
|
|
|
|
|
|
|
mysnprintf(timeString, sizeof(timeString), "%02i:%02i:%02i.%03i", hours, minutes, seconds, millis);
|
|
|
|
}
|
|
|
|
else if (showSeconds)
|
|
|
|
{
|
|
|
|
mysnprintf(timeString, sizeof(timeString), "%02i:%02i:%02i", hours, minutes, seconds);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
mysnprintf(timeString, sizeof(timeString), "%02i:%02i", hours, minutes);
|
|
|
|
}
|
|
|
|
|
|
|
|
const int characterCount = static_cast<int>( sizeof "HH:MM" - 1
|
|
|
|
+ (showSeconds ? sizeof ":SS" - 1 : 0)
|
|
|
|
+ (showMillis ? sizeof ".MMM" - 1 : 0) );
|
|
|
|
const int width = SmallFont->GetCharWidth('0') * characterCount + 2; // small offset from screen's border
|
|
|
|
const int height = SmallFont->GetHeight();
|
|
|
|
|
2016-03-24 00:46:11 +00:00
|
|
|
DrawHudText(SmallFont, hud_timecolor, timeString, hudwidth - width, height, 0x10000);
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static bool IsAltHUDTextVisible()
|
|
|
|
{
|
|
|
|
return hud_althud
|
|
|
|
&& !automapactive
|
|
|
|
&& (SCREENHEIGHT == viewheight)
|
|
|
|
&& (11 == screenblocks);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ST_IsTimeVisible()
|
|
|
|
{
|
|
|
|
return IsAltHUDTextVisible()
|
|
|
|
&& (hud_showtime > 0)
|
|
|
|
&& (hud_showtime <= 9);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// Draw in-game latency
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
static void DrawLatency()
|
|
|
|
{
|
|
|
|
if (!ST_IsLatencyVisible())
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
int i, localdelay = 0, arbitratordelay = 0;
|
|
|
|
for (i = 0; i < BACKUPTICS; i++) localdelay += netdelay[0][i];
|
|
|
|
for (i = 0; i < BACKUPTICS; i++) arbitratordelay += netdelay[nodeforplayer[Net_Arbitrator]][i];
|
|
|
|
localdelay = ((localdelay / BACKUPTICS) * ticdup) * (1000 / TICRATE);
|
|
|
|
arbitratordelay = ((arbitratordelay / BACKUPTICS) * ticdup) * (1000 / TICRATE);
|
|
|
|
int color = CR_GREEN;
|
|
|
|
if (MAX(localdelay, arbitratordelay) > 200)
|
|
|
|
{
|
|
|
|
color = CR_YELLOW;
|
|
|
|
}
|
|
|
|
if (MAX(localdelay, arbitratordelay) > 400)
|
|
|
|
{
|
|
|
|
color = CR_ORANGE;
|
|
|
|
}
|
|
|
|
if (MAX(localdelay, arbitratordelay) >= ((BACKUPTICS / 2 - 1) * ticdup) * (1000 / TICRATE))
|
|
|
|
{
|
|
|
|
color = CR_RED;
|
|
|
|
}
|
|
|
|
|
|
|
|
char tempstr[32];
|
|
|
|
|
|
|
|
const int millis = (level.time % TICRATE) * (1000 / TICRATE);
|
|
|
|
mysnprintf(tempstr, sizeof(tempstr), "a:%dms - l:%dms", arbitratordelay, localdelay);
|
|
|
|
|
|
|
|
const int characterCount = (int)strlen(tempstr);
|
|
|
|
const int width = SmallFont->GetCharWidth('0') * characterCount + 2; // small offset from screen's border
|
|
|
|
const int height = SmallFont->GetHeight() * (ST_IsTimeVisible() ? 2 : 1);
|
|
|
|
|
2016-03-24 00:46:11 +00:00
|
|
|
DrawHudText(SmallFont, color, tempstr, hudwidth - width, height, 0x10000);
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool ST_IsLatencyVisible()
|
|
|
|
{
|
|
|
|
return IsAltHUDTextVisible()
|
|
|
|
&& (hud_showlag > 0)
|
|
|
|
&& (hud_showlag != 1 || netgame)
|
|
|
|
&& (hud_showlag <= 2);
|
|
|
|
}
|
|
|
|
|
2017-03-24 21:57:44 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// draw the overlay
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
static void DrawPowerups(player_t *CPlayer)
|
|
|
|
{
|
|
|
|
// Each icon gets a 32x32 block to draw itself in.
|
|
|
|
int x, y;
|
|
|
|
AInventory *item;
|
|
|
|
const int yshift = SmallFont->GetHeight();
|
|
|
|
const int POWERUPICONSIZE = 32;
|
|
|
|
|
|
|
|
x = hudwidth -20;
|
|
|
|
y = POWERUPICONSIZE * 5/4
|
|
|
|
+ (ST_IsTimeVisible() ? yshift : 0)
|
|
|
|
+ (ST_IsLatencyVisible() ? yshift : 0);
|
|
|
|
|
|
|
|
for (item = CPlayer->mo->Inventory; item != NULL; item = item->Inventory)
|
|
|
|
{
|
2017-04-21 16:08:30 +00:00
|
|
|
if (item->IsKindOf(NAME_Powerup))
|
2017-03-24 21:57:44 +00:00
|
|
|
{
|
2017-04-21 16:08:30 +00:00
|
|
|
IFVIRTUALPTRNAME(item, NAME_Powerup, GetPowerupIcon)
|
2017-03-24 21:57:44 +00:00
|
|
|
{
|
2017-04-21 16:08:30 +00:00
|
|
|
VMValue param[] = { item };
|
|
|
|
int rv;
|
|
|
|
VMReturn ret(&rv);
|
|
|
|
VMCall(func, param, 1, &ret, 1);
|
|
|
|
auto tex = FSetTextureID(rv);
|
|
|
|
if (!tex.isValid()) continue;
|
|
|
|
auto texture = TexMan(tex);
|
|
|
|
|
|
|
|
IFVIRTUALPTRNAME(item, NAME_Powerup, IsBlinking)
|
|
|
|
{
|
|
|
|
// Reuse the parameters from GetPowerupIcon
|
|
|
|
VMCall(func, param, 1, &ret, 1);
|
|
|
|
if (!rv)
|
|
|
|
{
|
|
|
|
|
|
|
|
screen->DrawTexture(texture, x, y, DTA_KeepRatio, true, DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_CenterBottomOffset, true, TAG_DONE);
|
|
|
|
|
|
|
|
x -= POWERUPICONSIZE;
|
|
|
|
if (x < -hudwidth / 2)
|
|
|
|
{
|
|
|
|
x = -20;
|
|
|
|
y += POWERUPICONSIZE * 3 / 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-03-24 21:57:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-03-01 15:47:10 +00:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// draw the overlay
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void DrawHUD()
|
|
|
|
{
|
|
|
|
player_t * CPlayer = StatusBar->CPlayer;
|
|
|
|
|
|
|
|
players[consoleplayer].inventorytics = 0;
|
2017-03-30 00:16:23 +00:00
|
|
|
int scale = GetUIScale(hud_althudscale);
|
|
|
|
hudwidth = SCREENWIDTH / scale;
|
|
|
|
hudheight = hud_aspectscale ? int(SCREENHEIGHT / (scale*1.2)) : SCREENHEIGHT / scale;
|
2016-03-01 15:47:10 +00:00
|
|
|
|
2018-12-01 23:34:28 +00:00
|
|
|
// Until the script export is complete we need to do some manual setup here
|
|
|
|
auto cls = PClass::FindClass("AltHud");
|
|
|
|
if (!cls) return;
|
|
|
|
|
|
|
|
althud = cls->CreateNew();
|
|
|
|
althud->IntVar("hudwidth") = hudwidth;
|
|
|
|
althud->IntVar("hudheight") = hudheight;
|
|
|
|
althud->IntVar("statspace") = statspace;
|
|
|
|
althud->IntVar("healthpic") = healthpic? healthpic->id.GetIndex() : -1;
|
|
|
|
althud->IntVar("berserkpic") = berserkpic? berserkpic->id.GetIndex() : -1;
|
2018-12-02 08:42:45 +00:00
|
|
|
althud->IntVar("tnt1a0") = tnt1a0.GetIndex();
|
2018-12-01 23:34:28 +00:00
|
|
|
althud->PointerVar<FFont>("HUDFont") = HudFont;
|
|
|
|
|
2016-03-01 15:47:10 +00:00
|
|
|
if (!automapactive)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
// No HUD in the title level!
|
|
|
|
if (gamestate == GS_TITLELEVEL || !CPlayer) return;
|
|
|
|
|
|
|
|
if (!deathmatch) DrawStatus(CPlayer, 5, hudheight-50);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
DrawStatus(CPlayer, 5, hudheight-75);
|
|
|
|
DrawFrags(CPlayer, 5, hudheight-70);
|
|
|
|
}
|
|
|
|
DrawHealth(CPlayer, 5, hudheight-45);
|
2017-01-18 22:42:08 +00:00
|
|
|
DrawArmor(CPlayer->mo->FindInventory(NAME_BasicArmor), CPlayer->mo->FindInventory(NAME_HexenArmor), 5, hudheight-20);
|
2016-03-01 15:47:10 +00:00
|
|
|
i=DrawKeys(CPlayer, hudwidth-4, hudheight-10);
|
|
|
|
i=DrawAmmo(CPlayer, hudwidth-5, i);
|
|
|
|
if (hud_showweapons) DrawWeapons(CPlayer, hudwidth - 5, i);
|
|
|
|
DrawInventory(CPlayer, 144, hudheight-28);
|
|
|
|
if (idmypos) DrawCoordinates(CPlayer);
|
|
|
|
|
|
|
|
DrawTime();
|
|
|
|
DrawLatency();
|
2017-03-24 21:57:44 +00:00
|
|
|
DrawPowerups(CPlayer);
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
FString mapname;
|
|
|
|
char printstr[256];
|
|
|
|
int seconds;
|
|
|
|
int length=8*SmallFont->GetCharWidth('0');
|
|
|
|
int fonth=SmallFont->GetHeight()+1;
|
|
|
|
int bottom=hudheight-1;
|
|
|
|
|
|
|
|
if (am_showtotaltime)
|
|
|
|
{
|
|
|
|
seconds = Tics2Seconds(level.totaltime);
|
|
|
|
mysnprintf(printstr, countof(printstr), "%02i:%02i:%02i", seconds/3600, (seconds%3600)/60, seconds%60);
|
2016-03-24 00:46:11 +00:00
|
|
|
DrawHudText(SmallFont, hudcolor_ttim, printstr, hudwidth-length, bottom, 0x10000);
|
2016-03-01 15:47:10 +00:00
|
|
|
bottom -= fonth;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (am_showtime)
|
|
|
|
{
|
|
|
|
if (level.clusterflags&CLUSTER_HUB)
|
|
|
|
{
|
|
|
|
seconds = Tics2Seconds(level.time);
|
|
|
|
mysnprintf(printstr, countof(printstr), "%02i:%02i:%02i", seconds/3600, (seconds%3600)/60, seconds%60);
|
2016-03-24 00:46:11 +00:00
|
|
|
DrawHudText(SmallFont, hudcolor_time, printstr, hudwidth-length, bottom, 0x10000);
|
2016-03-01 15:47:10 +00:00
|
|
|
bottom -= fonth;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Single level time for hubs
|
|
|
|
seconds= Tics2Seconds(level.maptime);
|
|
|
|
mysnprintf(printstr, countof(printstr), "%02i:%02i:%02i", seconds/3600, (seconds%3600)/60, seconds%60);
|
2016-03-24 00:46:11 +00:00
|
|
|
DrawHudText(SmallFont, hudcolor_ltim, printstr, hudwidth-length, bottom, 0x10000);
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ST_FormatMapName(mapname);
|
|
|
|
screen->DrawText(SmallFont, hudcolor_titl, 1, hudheight-fonth-1, mapname,
|
|
|
|
DTA_KeepRatio, true,
|
|
|
|
DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, TAG_DONE);
|
|
|
|
|
|
|
|
DrawCoordinates(CPlayer);
|
|
|
|
}
|
2018-12-01 23:34:28 +00:00
|
|
|
|
|
|
|
if (althud) althud->Destroy();
|
|
|
|
althud = nullptr;
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Initialize the fonts and other data
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
void HUD_InitHud()
|
|
|
|
{
|
|
|
|
switch (gameinfo.gametype)
|
|
|
|
{
|
|
|
|
case GAME_Heretic:
|
|
|
|
case GAME_Hexen:
|
|
|
|
healthpic = TexMan.FindTexture("ARTIPTN2");
|
|
|
|
HudFont=FFont::FindFont("HUDFONT_RAVEN");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GAME_Strife:
|
|
|
|
healthpic = TexMan.FindTexture("I_MDKT");
|
|
|
|
HudFont=BigFont; // Strife doesn't have anything nice so use the standard font
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
healthpic = TexMan.FindTexture("MEDIA0");
|
|
|
|
berserkpic = TexMan.FindTexture("PSTRA0");
|
|
|
|
HudFont=FFont::FindFont("HUDFONT_DOOM");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
IndexFont = V_GetFont("INDEXFONT");
|
|
|
|
|
|
|
|
if (HudFont == NULL) HudFont = BigFont;
|
|
|
|
if (IndexFont == NULL) IndexFont = ConFont; // Emergency fallback
|
|
|
|
|
|
|
|
invgems[0] = TexMan.FindTexture("INVGEML1");
|
2017-03-26 23:02:10 +00:00
|
|
|
invgems[1] = TexMan.FindTexture("INVGEMR1");
|
2018-12-01 13:01:03 +00:00
|
|
|
tnt1a0 = TexMan.CheckForTexture("TNT1A0", ETextureType::Sprite);
|
2016-03-01 15:47:10 +00:00
|
|
|
|
|
|
|
fragpic = TexMan.FindTexture("HU_FRAGS"); // Sadly, I don't have anything usable for this. :(
|
|
|
|
|
|
|
|
statspace = SmallFont->StringWidth("Ac:");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Now read custom icon overrides
|
|
|
|
int lump, lastlump = 0;
|
|
|
|
|
|
|
|
while ((lump = Wads.FindLump ("ALTHUDCF", &lastlump)) != -1)
|
|
|
|
{
|
|
|
|
FScanner sc(lump);
|
|
|
|
while (sc.GetString())
|
|
|
|
{
|
|
|
|
if (sc.Compare("Health"))
|
|
|
|
{
|
|
|
|
sc.MustGetString();
|
2018-03-25 18:26:16 +00:00
|
|
|
FTextureID tex = TexMan.CheckForTexture(sc.String, ETextureType::MiscPatch);
|
2016-03-01 15:47:10 +00:00
|
|
|
if (tex.isValid()) healthpic = TexMan[tex];
|
|
|
|
}
|
|
|
|
else if (sc.Compare("Berserk"))
|
|
|
|
{
|
|
|
|
sc.MustGetString();
|
2018-03-25 18:26:16 +00:00
|
|
|
FTextureID tex = TexMan.CheckForTexture(sc.String, ETextureType::MiscPatch);
|
2016-03-01 15:47:10 +00:00
|
|
|
if (tex.isValid()) berserkpic = TexMan[tex];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
PClass *ti = PClass::FindClass(sc.String);
|
|
|
|
if (!ti)
|
|
|
|
{
|
|
|
|
Printf("Unknown item class '%s' in ALTHUDCF\n", sc.String);
|
|
|
|
}
|
|
|
|
else if (!ti->IsDescendantOf(RUNTIME_CLASS(AInventory)))
|
|
|
|
{
|
|
|
|
Printf("Invalid item class '%s' in ALTHUDCF\n", sc.String);
|
|
|
|
ti=NULL;
|
|
|
|
}
|
|
|
|
sc.MustGetString();
|
|
|
|
FTextureID tex;
|
|
|
|
|
|
|
|
if (!sc.Compare("0") && !sc.Compare("NULL") && !sc.Compare(""))
|
|
|
|
{
|
2018-03-25 18:26:16 +00:00
|
|
|
tex = TexMan.CheckForTexture(sc.String, ETextureType::MiscPatch);
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
else tex.SetInvalid();
|
|
|
|
|
2017-02-08 15:57:48 +00:00
|
|
|
if (ti) ((AInventory*)GetDefaultByType(ti))->AltHUDIcon = tex;
|
2016-03-01 15:47:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|