Skip to content

Commit

Permalink
Add Weapon Help Text & Object Description HUD Elements
Browse files Browse the repository at this point in the history
Closes #10
  • Loading branch information
UndeadZeratul committed Oct 7, 2023
1 parent ade89ef commit 63d9647
Show file tree
Hide file tree
Showing 7 changed files with 410 additions and 77 deletions.
46 changes: 46 additions & 0 deletions CVARINFO
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,29 @@ user int uz_hhx_mugshot_bg_hlm_posX = 0;
user int uz_hhx_mugshot_bg_hlm_posY = 0;
user float uz_hhx_mugshot_bg_hlm_scale = 1.;

// OBJECT DESCRIPTION CONFIGS
user bool uz_hhx_objectDescription_enabled = true;

user int uz_hhx_objectDescription_nhm_hudLevel = 1;
user int uz_hhx_objectDescription_nhm_posX = 0;
user int uz_hhx_objectDescription_nhm_posY = 20;
user float uz_hhx_objectDescription_nhm_scale = 1.;

user bool uz_hhx_objectDescription_hlm_required = false;
user int uz_hhx_objectDescription_hlm_hudLevel = 1;
user int uz_hhx_objectDescription_hlm_posX = 0;
user int uz_hhx_objectDescription_hlm_posY = 20;
user float uz_hhx_objectDescription_hlm_scale = 1.;

user string uz_hhx_objectDescription_bg_nhm_ref = "";
user int uz_hhx_objectDescription_bg_nhm_posX = 0;
user int uz_hhx_objectDescription_bg_nhm_posY = 0;
user float uz_hhx_objectDescription_bg_nhm_scale = 1.;
user string uz_hhx_objectDescription_bg_hlm_ref = "";
user int uz_hhx_objectDescription_bg_hlm_posX = 0;
user int uz_hhx_objectDescription_bg_hlm_posY = 0;
user float uz_hhx_objectDescription_bg_hlm_scale = 1.;

// RADSUIT OVERRIDE CONFIGS
user bool uz_hhx_radsuit_enabled = true;
user string uz_hhx_radsuit_ref = "RADMSK";
Expand Down Expand Up @@ -876,6 +899,29 @@ user int uz_hhx_stunnedCounter_bg_hlm_posX = 0;
user int uz_hhx_stunnedCounter_bg_hlm_posY = 0;
user float uz_hhx_stunnedCounter_bg_hlm_scale = 1.;

// WEAPON HELP TEXT CONFIGS
user bool uz_hhx_weaponHelp_enabled = true;

user int uz_hhx_weaponHelp_nhm_hudLevel = 2;
user int uz_hhx_weaponHelp_nhm_posX = 8;
user int uz_hhx_weaponHelp_nhm_posY = 100;
user float uz_hhx_weaponHelp_nhm_scale = 1.;

user bool uz_hhx_weaponHelp_hlm_required = false;
user int uz_hhx_weaponHelp_hlm_hudLevel = 2;
user int uz_hhx_weaponHelp_hlm_posX = 8;
user int uz_hhx_weaponHelp_hlm_posY = 100;
user float uz_hhx_weaponHelp_hlm_scale = 1.;

user string uz_hhx_weaponHelp_bg_nhm_ref = "";
user int uz_hhx_weaponHelp_bg_nhm_posX = 0;
user int uz_hhx_weaponHelp_bg_nhm_posY = 0;
user float uz_hhx_weaponHelp_bg_nhm_scale = 1.;
user string uz_hhx_weaponHelp_bg_hlm_ref = "";
user int uz_hhx_weaponHelp_bg_hlm_posX = 0;
user int uz_hhx_weaponHelp_bg_hlm_posY = 0;
user float uz_hhx_weaponHelp_bg_hlm_scale = 1.;

// WEAPON SPRITE CONFIGS
user bool uz_hhx_weaponSprite_enabled = true;

Expand Down
128 changes: 67 additions & 61 deletions KEYCONF

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions LANGUAGE.en
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ HHXHeartbeat = "Heartbeat Options";
HHXInventory = "Inventory Options";
HHXKeys = "Keys Options";
HHXMugshot = "Mugshot Options";
HHXObjectDescription = "Object Description Options";
HHXRadsuitOverride = "Radsuit Overlay Options";
HHXRespiratorOverlay = "Respirator Overlay Options";
HHXWeaponHelp = "Weapon Help Text Options";
HHXWeaponSprite = "Weapon Sprite Options";
HHXWeaponStash = "Weapon Stash Options";
HHXWeaponStatus = "Weapon Status Options";
Expand Down Expand Up @@ -110,8 +112,10 @@ HHXResetHeartbeat = "Reset Heartbeat Options";
HHXResetInventory = "Reset Inventory Options";
HHXResetKeys = "Reset Keys Options";
HHXResetMugshot = "Reset Mugshot Options";
HHXResetObjectDescription = "Reset Object Description Options";
HHXResetRadsuitOverride = "Reset Radsuit Overlay Options";
HHXResetRespiratorOverlay = "Reset Respirator Overlay Options";
HHXResetWeaponHelp = "Reset Weapon Help Text Options";
HHXResetWeaponSprite = "Reset Weapon Sprite Options";
HHXResetWeaponStash = "Reset Weapon Stash Options";
HHXResetWeaponStatus = "Reset Weapon Status Options";
Expand Down Expand Up @@ -154,7 +158,9 @@ HHXHHResetHeartbeat = "Reset Heartbeat HHelmet Options";
HHXHHResetInventory = "Reset Inventory HHelmet Options";
HHXHHResetKeys = "Reset Keys HHelmet Options";
HHXHHResetMugshot = "Reset Mugshot HHelmet Options";
HHXHHResetObjectDescription = "Reset Object Description HHelmet Options";
HHXHHResetBackground = "Reset Helmet Background HHelmet Options";
HHXHHResetWeaponHelp = "Reset Weapon Help Text HHelmet Options";
HHXHHResetWeaponSprite = "Reset Weapon Sprite HHelmet Options";
HHXHHResetweaponStash = "Reset Weapon Stash HHelmet Options";
HHXHHResetWeaponStatus = "Reset Weapon Status HHelmet Options";
Expand Down
120 changes: 104 additions & 16 deletions MENUDEF
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,24 @@ OptionMenu "HHXAdvanced" {
Title "$HHXAdvanced"

StaticText ""
SubMenu "$HHXAmmoCounters", "HHXAmmoCounters"
SubMenu "$HHXArmour", "HHXArmour"
SubMenu "$HHXCompass", "HHXCompass"
SubMenu "$HHXEKG", "HHXEKG"
SubMenu "$HHXEncumbrance", "HHXEncumbrance"
SubMenu "$HHXFullInventory", "HHXFullInventory"
SubMenu "$HHXHeartbeat", "HHXHeartbeat"
SubMenu "$HHXInventory", "HHXInventory"
// SubMenu "$HHXItemAdditions", "HHXItemAdditions"
SubMenu "$HHXKeys", "HHXKeys"
SubMenu "$HHXMugshot", "HHXMugshot"
SubMenu "$HHXBackground", "HHXBackground"
SubMenu "$HHXWeaponSprite", "HHXWeaponSprite"
SubMenu "$HHXWeaponStash", "HHXWeaponStash"
// SubMenu "$HHXWeaponStatus", "HHXWeaponStatus"
SubMenu "$HHXWoundCounter", "HHXWoundCounter"
SubMenu "$HHXAmmoCounters", "HHXAmmoCounters"
SubMenu "$HHXArmour", "HHXArmour"
SubMenu "$HHXCompass", "HHXCompass"
SubMenu "$HHXEKG", "HHXEKG"
SubMenu "$HHXEncumbrance", "HHXEncumbrance"
SubMenu "$HHXFullInventory", "HHXFullInventory"
SubMenu "$HHXHeartbeat", "HHXHeartbeat"
SubMenu "$HHXInventory", "HHXInventory"
// SubMenu "$HHXItemAdditions", "HHXItemAdditions"
SubMenu "$HHXKeys", "HHXKeys"
SubMenu "$HHXMugshot", "HHXMugshot"
SubMenu "$HHXObjectDescription", "HHXObjectDescription"
SubMenu "$HHXBackground", "HHXBackground"
SubMenu "$HHXWeaponHelp", "HHXWeaponHelp"
SubMenu "$HHXWeaponSprite", "HHXWeaponSprite"
SubMenu "$HHXWeaponStash", "HHXWeaponStash"
// SubMenu "$HHXWeaponStatus", "HHXWeaponStatus"
SubMenu "$HHXWoundCounter", "HHXWoundCounter"

StaticText ""
SubMenu "$HHXCounters", "HHXCounters"
Expand Down Expand Up @@ -1572,6 +1574,49 @@ OptionMenu "HHXMugshot" {
SafeCommand "$HHXHHResetMugshot", "uz_hhx_options_reset_hlm_mugshot"
}

OptionMenu "HHXObjectDescription" {
Title "$HHXObjectDescription"

Option "$HHXEnabled", "uz_hhx_objectDescription_enabled", "OnOff"

StaticText ""
StaticText ""
StaticText "$HHXNHM", 1
StaticText ""
Slider "$HHXHUDLevel", "uz_hhx_objectDescription_nhm_hudLevel", 0, 2, 1, 0, "uz_hhx_objectDescription_enabled"
Slider "$HHXPosX", "uz_hhx_objectDescription_nhm_posX", -400, 400, 1, 0, "uz_hhx_objectDescription_enabled"
Slider "$HHXPosY", "uz_hhx_objectDescription_nhm_posY", -400, 400, 1, 0, "uz_hhx_objectDescription_enabled"
Slider "$HHXScale", "uz_hhx_objectDescription_nhm_scale", .01, 4., .05, 2, "uz_hhx_objectDescription_enabled"
StaticText ""
TextField "$HHXBgRef", "uz_hhx_objectDescription_bg_nhm_ref", "uz_hhx_objectDescription_enabled"
Slider "$HHXPosX", "uz_hhx_objectDescription_bg_nhm_posX", -400, 400, 1, 0, "uz_hhx_objectDescription_enabled"
Slider "$HHXPosY", "uz_hhx_objectDescription_bg_nhm_posY", -400, 400, 1, 0, "uz_hhx_objectDescription_enabled"
Slider "$HHXScale", "uz_hhx_objectDescription_bg_nhm_scale", .01, 4., .05, 2, "uz_hhx_objectDescription_enabled"

StaticText ""
StaticText ""
StaticText "$HHXHLM", 1
StaticText "$HHXHHelmetRequired"
StaticText ""
Option "$HHXHelmetRequired", "uz_hhx_objectDescription_hlm_required", "OnOff", "uz_hhx_objectDescription_enabled"
StaticText ""
Slider "$HHXHUDLevel", "uz_hhx_objectDescription_hlm_hudLevel", 0, 2, 1, 0, "uz_hhx_objectDescription_enabled"
Slider "$HHXPosX", "uz_hhx_objectDescription_hlm_posX", -400, 400, 1, 0, "uz_hhx_objectDescription_enabled"
Slider "$HHXPosY", "uz_hhx_objectDescription_hlm_posY", -400, 400, 1, 0, "uz_hhx_objectDescription_enabled"
Slider "$HHXScale", "uz_hhx_objectDescription_hlm_scale", .01, 4., .05, 2, "uz_hhx_objectDescription_enabled"
StaticText ""
TextField "$HHXBgRef", "uz_hhx_objectDescription_bg_hlm_ref", "uz_hhx_objectDescription_enabled"
Slider "$HHXPosX", "uz_hhx_objectDescription_bg_hlm_posX", -400, 400, 1, 0, "uz_hhx_objectDescription_enabled"
Slider "$HHXPosY", "uz_hhx_objectDescription_bg_hlm_posY", -400, 400, 1, 0, "uz_hhx_objectDescription_enabled"
Slider "$HHXScale", "uz_hhx_objectDescription_bg_hlm_scale", .01, 4., .05, 2, "uz_hhx_objectDescription_enabled"

StaticText ""
StaticText ""
StaticText "$HHXDangerZone", "Red"
SafeCommand "$HHXResetMugshot", "uz_hhx_options_reset_nhm_objectDescription"
SafeCommand "$HHXHHResetMugshot", "uz_hhx_options_reset_hlm_objectDescription"
}

OptionMenu "HHXBackground" {
Title "$HHXBackground"

Expand Down Expand Up @@ -1761,6 +1806,49 @@ OptionMenu "HHXStunnedCounter" {
SafeCommand "$HHXHHResetStunnedCounter", "uz_hhx_options_reset_hlm_stunnedCounter"
}

OptionMenu "HHXWeaponHelp" {
Title "$HHXWeaponHelp"

Option "$HHXEnabled", "uz_hhx_weaponHelp_enabled", "OnOff"

StaticText ""
StaticText ""
StaticText "$HHXNHM", 1
StaticText ""
Slider "$HHXHUDLevel", "uz_hhx_weaponHelp_nhm_hudLevel", 0, 2, 1, 0, "uz_hhx_weaponHelp_enabled"
Slider "$HHXPosX", "uz_hhx_weaponHelp_nhm_posX", -400, 400, 1, 0, "uz_hhx_weaponHelp_enabled"
Slider "$HHXPosY", "uz_hhx_weaponHelp_nhm_posY", -400, 400, 1, 0, "uz_hhx_weaponHelp_enabled"
Slider "$HHXScale", "uz_hhx_weaponHelp_nhm_scale", .01, 4., .05, 2, "uz_hhx_weaponHelp_enabled"
StaticText ""
TextField "$HHXBgRef", "uz_hhx_weaponHelp_bg_nhm_ref", "uz_hhx_weaponHelp_enabled"
Slider "$HHXPosX", "uz_hhx_weaponHelp_bg_nhm_posX", -400, 400, 1, 0, "uz_hhx_weaponHelp_enabled"
Slider "$HHXPosY", "uz_hhx_weaponHelp_bg_nhm_posY", -400, 400, 1, 0, "uz_hhx_weaponHelp_enabled"
Slider "$HHXScale", "uz_hhx_weaponHelp_bg_nhm_scale", .01, 4., .05, 2, "uz_hhx_weaponHelp_enabled"

StaticText ""
StaticText ""
StaticText "$HHXHLM", 1
StaticText "$HHXHHelmetRequired"
StaticText ""
Option "$HHXHelmetRequired", "uz_hhx_weaponHelp_hlm_required", "OnOff", "uz_hhx_weaponHelp_enabled"
StaticText ""
Slider "$HHXHUDLevel", "uz_hhx_weaponHelp_hlm_hudLevel", 0, 2, 1, 0, "uz_hhx_weaponHelp_enabled"
Slider "$HHXPosX", "uz_hhx_weaponHelp_hlm_posX", -400, 400, 1, 0, "uz_hhx_weaponHelp_enabled"
Slider "$HHXPosY", "uz_hhx_weaponHelp_hlm_posY", -400, 400, 1, 0, "uz_hhx_weaponHelp_enabled"
Slider "$HHXScale", "uz_hhx_weaponHelp_hlm_scale", .01, 4., .05, 2, "uz_hhx_weaponHelp_enabled"
StaticText ""
TextField "$HHXBgRef", "uz_hhx_weaponHelp_bg_hlm_ref", "uz_hhx_weaponHelp_enabled"
Slider "$HHXPosX", "uz_hhx_weaponHelp_bg_hlm_posX", -400, 400, 1, 0, "uz_hhx_weaponHelp_enabled"
Slider "$HHXPosY", "uz_hhx_weaponHelp_bg_hlm_posY", -400, 400, 1, 0, "uz_hhx_weaponHelp_enabled"
Slider "$HHXScale", "uz_hhx_weaponHelp_bg_hlm_scale", .01, 4., .05, 2, "uz_hhx_weaponHelp_enabled"

StaticText ""
StaticText ""
StaticText "$HHXDangerZone", "Red"
SafeCommand "$HHXResetWeaponHelp", "uz_hhx_options_reset_nhm_weaponHelp"
SafeCommand "$HHXHHResetWeaponHelp", "uz_hhx_options_reset_hlm_weaponHelp"
}

OptionMenu "HHXWeaponSprite" {
Title "$HHXWeaponSprite"

Expand Down
2 changes: 2 additions & 0 deletions zscript.zs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ version "4.10"
#include "zscript/undeadzeratul/elements/UZItemAdditions.zs"
#include "zscript/undeadzeratul/elements/UZKeys.zs"
#include "zscript/undeadzeratul/elements/UZMugshot.zs"
#include "zscript/undeadzeratul/elements/UZObjectDescription.zs"
#include "zscript/undeadzeratul/elements/UZPosition.zs"
#include "zscript/undeadzeratul/elements/UZRadsuit.zs"
#include "zscript/undeadzeratul/elements/UZRespirator.zs"
#include "zscript/undeadzeratul/elements/UZWeaponHelp.zs"
#include "zscript/undeadzeratul/elements/UZWeaponSprite.zs"
#include "zscript/undeadzeratul/elements/UZWeaponStash.zs"
// #include "zscript/undeadzeratul/elements/UZWeaponStatus.zs"
Expand Down
91 changes: 91 additions & 0 deletions zscript/undeadzeratul/elements/UZObjectDescription.zs
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
class UZObjectDescription : HUDElement {

private Service _HHFunc;

private transient CVar _enabled;
private transient CVar _hlm_required;

private transient CVar _hlm_hudLevel;
private transient CVar _hlm_posX;
private transient CVar _hlm_posY;
private transient CVar _hlm_scale;
private transient CVar _nhm_hudLevel;
private transient CVar _nhm_posX;
private transient CVar _nhm_posY;
private transient CVar _nhm_scale;

private transient CVar _nhm_bgRef;
private transient CVar _nhm_bgPosX;
private transient CVar _nhm_bgPosY;
private transient CVar _nhm_bgScale;
private transient CVar _hlm_bgRef;
private transient CVar _hlm_bgPosX;
private transient CVar _hlm_bgPosY;
private transient CVar _hlm_bgScale;

override void Init(HCStatusbar sb) {
ZLayer = 0;
Namespace = "objectdescription";
}

override void Tick(HCStatusbar sb) {
if (!_HHFunc) _HHFunc = ServiceIterator.Find("HHFunc").Next();

if (!_enabled) _enabled = CVar.GetCVar("uz_hhx_objectDescription_enabled", sb.CPlayer);
if (!_hlm_required) _hlm_required = CVar.GetCVar("uz_hhx_objectDescription_hlm_required", sb.CPlayer);
if (!_hlm_hudLevel) _hlm_hudLevel = CVar.GetCVar("uz_hhx_objectDescription_hlm_hudLevel", sb.CPlayer);
if (!_hlm_posX) _hlm_posX = CVar.GetCVar("uz_hhx_objectDescription_hlm_posX", sb.CPlayer);
if (!_hlm_posY) _hlm_posY = CVar.GetCVar("uz_hhx_objectDescription_hlm_posY", sb.CPlayer);
if (!_hlm_scale) _hlm_scale = CVar.GetCVar("uz_hhx_objectDescription_hlm_scale", sb.CPlayer);
if (!_nhm_hudLevel) _nhm_hudLevel = CVar.GetCVar("uz_hhx_objectDescription_nhm_hudLevel", sb.CPlayer);
if (!_nhm_posX) _nhm_posX = CVar.GetCVar("uz_hhx_objectDescription_nhm_posX", sb.CPlayer);
if (!_nhm_posY) _nhm_posY = CVar.GetCVar("uz_hhx_objectDescription_nhm_posY", sb.CPlayer);
if (!_nhm_scale) _nhm_scale = CVar.GetCVar("uz_hhx_objectDescription_nhm_scale", sb.CPlayer);

if (!_nhm_bgRef) _nhm_bgRef = CVar.GetCVar("uz_hhx_objectDescription_bg_nhm_ref", sb.CPlayer);
if (!_nhm_bgPosX) _nhm_bgPosX = CVar.GetCVar("uz_hhx_objectDescription_bg_nhm_posX", sb.CPlayer);
if (!_nhm_bgPosY) _nhm_bgPosY = CVar.GetCVar("uz_hhx_objectDescription_bg_nhm_posY", sb.CPlayer);
if (!_nhm_bgScale) _nhm_bgScale = CVar.GetCVar("uz_hhx_objectDescription_bg_nhm_scale", sb.CPlayer);
if (!_hlm_bgRef) _hlm_bgRef = CVar.GetCVar("uz_hhx_objectDescription_bg_hlm_ref", sb.CPlayer);
if (!_hlm_bgPosX) _hlm_bgPosX = CVar.GetCVar("uz_hhx_objectDescription_bg_hlm_posX", sb.CPlayer);
if (!_hlm_bgPosY) _hlm_bgPosY = CVar.GetCVar("uz_hhx_objectDescription_bg_hlm_posY", sb.CPlayer);
if (!_hlm_bgScale) _hlm_bgScale = CVar.GetCVar("uz_hhx_objectDescription_bg_hlm_scale", sb.CPlayer);
}

override void DrawHUDStuff(HCStatusbar sb, int state, double ticFrac) {
bool hasHelmet = _HHFunc && _HHFunc.GetIntUI("GetShowHUD", objectArg: sb.hpl);
int hudLevel = hasHelmet ? _hlm_hudLevel.GetInt() : _nhm_hudLevel.GetInt();

if (
!_enabled.GetBool()
|| (!hasHelmet && _hlm_required.GetBool())
|| HDSpectator(sb.hpl)
|| !(sb.HUDLevel >= hudLevel)
) return;

if (CheckCommonStuff(sb, state, ticFrac)) {

int posX = hasHelmet ? _hlm_posX.GetInt() : _nhm_posX.GetInt();
int posY = hasHelmet ? _hlm_posY.GetInt() : _nhm_posY.GetInt();
float scale = hasHelmet ? _hlm_scale.GetFloat() : _nhm_scale.GetFloat();

string bgRef = hasHelmet ? _hlm_bgRef.GetString() : _nhm_bgRef.GetString();
int bgPosX = hasHelmet ? _hlm_bgPosX.GetInt() : _nhm_bgPosX.GetInt();
int bgPosY = hasHelmet ? _hlm_bgPosY.GetInt() : _nhm_bgPosY.GetInt();
float bgScale = hasHelmet ? _hlm_bgScale.GetFloat() : _nhm_bgScale.GetFloat();

string s = sb.hpl.viewstring;
if (s != "") {
sb.drawstring(
sb.pnewsmallfont,
s,
(posX,posY),
sb.DI_SCREEN_CENTER|sb.DI_TEXT_ALIGN_CENTER,
Font.CR_GREY,
0.4,
scale:(scale, scale)
);
}
}
}
}
Loading

0 comments on commit 63d9647

Please sign in to comment.