mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-01-31 13:50:48 +00:00
- added option to show hub and episode names on the alt HUD.
Still very much work in progress because few mods have set this up. CVARs default to off and are not exposed to the menu.
This commit is contained in:
parent
7cd7630dbd
commit
6eab875ec2
6 changed files with 66 additions and 7 deletions
|
@ -31,10 +31,6 @@
|
|||
#include <direct.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FPU_CONTROL
|
||||
#include <fpu_control.h>
|
||||
#endif
|
||||
|
||||
#if defined(__unix__) || defined(__APPLE__)
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
|
|
@ -85,6 +85,7 @@
|
|||
#include "c_buttons.h"
|
||||
#include "screenjob.h"
|
||||
#include "types.h"
|
||||
#include "gstrings.h"
|
||||
|
||||
#include "gi.h"
|
||||
|
||||
|
@ -101,6 +102,7 @@
|
|||
|
||||
void STAT_StartNewGame(const char *lev);
|
||||
void STAT_ChangeLevel(const char *newl, FLevelLocals *Level);
|
||||
FString STAT_EpisodeName();
|
||||
|
||||
EXTERN_CVAR(Bool, save_formatted)
|
||||
EXTERN_CVAR (Float, sv_gravity)
|
||||
|
@ -2430,3 +2432,31 @@ void FLevelLocals::SetMusic()
|
|||
{
|
||||
S_ChangeMusic(Music, musicorder);
|
||||
}
|
||||
|
||||
|
||||
DEFINE_ACTION_FUNCTION(FLevelLocals, GetClusterName)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(FLevelLocals)
|
||||
cluster_info_t* cluster = FindClusterInfo(self->cluster);
|
||||
FString retval;
|
||||
|
||||
if (cluster)
|
||||
{
|
||||
if (cluster->flags & CLUSTER_LOOKUPNAME)
|
||||
retval = GStrings(cluster->ClusterName);
|
||||
else
|
||||
retval = cluster->ClusterName;
|
||||
}
|
||||
ACTION_RETURN_STRING(retval);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(FLevelLocals, GetEpisodeName)
|
||||
{
|
||||
// this is a bit of a crapshoot because ZDoom never assigned a level to an episode
|
||||
// and retroactively fixing this is not possible.
|
||||
// This will need some heuristics to assign a proper episode to each existing level.
|
||||
// Stuff for later. for now this just checks the STAT module for the currently running episode,
|
||||
// which should be fine unless cheating.
|
||||
ACTION_RETURN_STRING(GStrings.localize(STAT_EpisodeName()));
|
||||
}
|
||||
|
||||
|
|
|
@ -63,6 +63,8 @@ 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 (Bool, am_showepisode, false, CVAR_ARCHIVE); // Show current episode name
|
||||
CVAR (Bool, am_showcluster, false, CVAR_ARCHIVE); // Show current cluster name
|
||||
CVAR (Int , hud_showammo, 2, CVAR_ARCHIVE); // Show ammo collected
|
||||
CVAR (Int , hud_showtime, 0, CVAR_ARCHIVE); // Show time on HUD
|
||||
CVAR (Int , hud_showtimestat, 0, CVAR_ARCHIVE); // Show time on HUD as statistics widget
|
||||
|
|
|
@ -561,6 +561,12 @@ void STAT_Serialize(FSerializer &arc)
|
|||
}
|
||||
|
||||
|
||||
FString STAT_EpisodeName()
|
||||
{
|
||||
if (StartEpisode == nullptr) return "";
|
||||
return StartEpisode->mEpisodeName;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// show statistics
|
||||
|
|
|
@ -511,6 +511,9 @@ struct LevelLocals native
|
|||
native void ExitLevel(int position, bool keepFacing);
|
||||
native void SecretExitLevel(int position);
|
||||
native void ChangeLevel(string levelname, int position = 0, int flags = 0, int skill = -1);
|
||||
|
||||
native String GetClusterName();
|
||||
native String GetEpisodeName();
|
||||
}
|
||||
|
||||
// a few values of this need to be readable by the play code.
|
||||
|
|
|
@ -973,9 +973,31 @@ class AltHud ui
|
|||
let amstr = Level.FormatMapName(hudcolor_titl);
|
||||
font = generic_ui? NewSmallFont : SmallFont.CanPrint(amstr)? SmallFont : OriginalSmallFont;
|
||||
|
||||
screen.DrawText(font, Font.CR_BRICK, 2, hudheight - fonth - 1, amstr,
|
||||
DTA_KeepRatio, true,
|
||||
DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight);
|
||||
bottom = hudheight - fonth - 1;
|
||||
|
||||
screen.DrawText(font, Font.CR_BRICK, 2, bottom, amstr,
|
||||
DTA_KeepRatio, true, DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight);
|
||||
|
||||
if (am_showcluster && (Level.clusterflags & Level.CLUSTER_HUB))
|
||||
{
|
||||
let text = Level.GetClusterName();
|
||||
if (text != "")
|
||||
{
|
||||
bottom -= fonth;
|
||||
screen.DrawText(font, Font.CR_ORANGE, 2, bottom, text,
|
||||
DTA_KeepRatio, true, DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight);
|
||||
}
|
||||
}
|
||||
if (am_showepisode)
|
||||
{
|
||||
let text = Level.GetEpisodeName();
|
||||
if (text != "")
|
||||
{
|
||||
bottom -= fonth;
|
||||
screen.DrawText(font, Font.CR_RED, 2, bottom, text,
|
||||
DTA_KeepRatio, true, DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight);
|
||||
}
|
||||
}
|
||||
|
||||
DrawCoordinates(CPlayer, false);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue