diff --git a/PackageScript b/PackageScript
index 86e3fabf..565cca31 100644
--- a/PackageScript
+++ b/PackageScript
@@ -136,6 +136,15 @@ for task in MMSPlugin.tasks:
materials_cs2f_folder = builder.AddFolder(os.path.join(packages[sdk_name].sdk_name, 'materials', MMSPlugin.metadata['name']))
builder.AddCopy(os.path.join('assets', 'materials', MMSPlugin.metadata['name'], 'leader_defend_mark.vtex_c'), materials_cs2f_folder)
+ panorama_layout_cs2f_folder = builder.AddFolder(os.path.join(packages[sdk_name].sdk_name, 'panorama', 'layout', 'custom_game', MMSPlugin.metadata['name']))
+ builder.AddCopy(os.path.join('assets', 'panorama', 'layout', 'custom_game', MMSPlugin.metadata['name'], 'entwatch_hud.vxml_c'), panorama_layout_cs2f_folder)
+ builder.AddCopy(os.path.join('assets', 'panorama', 'layout', 'custom_game', MMSPlugin.metadata['name'], 'entwatch_settings.vxml_c'), panorama_layout_cs2f_folder)
+
+ panorama_styles_cs2f_folder = builder.AddFolder(os.path.join(packages[sdk_name].sdk_name, 'panorama', 'styles', 'custom_game', MMSPlugin.metadata['name']))
+ builder.AddCopy(os.path.join('assets', 'panorama', 'styles', 'custom_game', MMSPlugin.metadata['name'], 'entwatch_common.vcss_c'), panorama_styles_cs2f_folder)
+ builder.AddCopy(os.path.join('assets', 'panorama', 'styles', 'custom_game', MMSPlugin.metadata['name'], 'entwatch_hud.vcss_c'), panorama_styles_cs2f_folder)
+ builder.AddCopy(os.path.join('assets', 'panorama', 'styles', 'custom_game', MMSPlugin.metadata['name'], 'entwatch_settings.vcss_c'), panorama_styles_cs2f_folder)
+
soundevents_folder = builder.AddFolder(os.path.join(packages[sdk_name].sdk_name, 'soundevents'))
builder.AddCopy(os.path.join('assets', 'soundevents', 'soundevents_zr.vsndevts_c'), soundevents_folder)
diff --git a/assets/panorama/layout/custom_game/cs2fixes/entwatch_hud.vxml_c b/assets/panorama/layout/custom_game/cs2fixes/entwatch_hud.vxml_c
new file mode 100644
index 00000000..a3e7d4cd
Binary files /dev/null and b/assets/panorama/layout/custom_game/cs2fixes/entwatch_hud.vxml_c differ
diff --git a/assets/panorama/layout/custom_game/cs2fixes/entwatch_settings.vxml_c b/assets/panorama/layout/custom_game/cs2fixes/entwatch_settings.vxml_c
new file mode 100644
index 00000000..99c44e3b
Binary files /dev/null and b/assets/panorama/layout/custom_game/cs2fixes/entwatch_settings.vxml_c differ
diff --git a/assets/panorama/styles/custom_game/cs2fixes/entwatch_common.vcss_c b/assets/panorama/styles/custom_game/cs2fixes/entwatch_common.vcss_c
new file mode 100644
index 00000000..260c3799
Binary files /dev/null and b/assets/panorama/styles/custom_game/cs2fixes/entwatch_common.vcss_c differ
diff --git a/assets/panorama/styles/custom_game/cs2fixes/entwatch_hud.vcss_c b/assets/panorama/styles/custom_game/cs2fixes/entwatch_hud.vcss_c
new file mode 100644
index 00000000..1a1ee481
Binary files /dev/null and b/assets/panorama/styles/custom_game/cs2fixes/entwatch_hud.vcss_c differ
diff --git a/assets/panorama/styles/custom_game/cs2fixes/entwatch_settings.vcss_c b/assets/panorama/styles/custom_game/cs2fixes/entwatch_settings.vcss_c
new file mode 100644
index 00000000..902978ea
Binary files /dev/null and b/assets/panorama/styles/custom_game/cs2fixes/entwatch_settings.vcss_c differ
diff --git a/assets_source/panorama/layout/custom_game/cs2fixes/entwatch_hud.xml b/assets_source/panorama/layout/custom_game/cs2fixes/entwatch_hud.xml
new file mode 100644
index 00000000..b048112d
--- /dev/null
+++ b/assets_source/panorama/layout/custom_game/cs2fixes/entwatch_hud.xml
@@ -0,0 +1,333 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/assets_source/panorama/layout/custom_game/cs2fixes/entwatch_settings.xml b/assets_source/panorama/layout/custom_game/cs2fixes/entwatch_settings.xml
new file mode 100644
index 00000000..eae8ae8c
--- /dev/null
+++ b/assets_source/panorama/layout/custom_game/cs2fixes/entwatch_settings.xml
@@ -0,0 +1,191 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/assets_source/panorama/styles/custom_game/cs2fixes/entwatch_common.css b/assets_source/panorama/styles/custom_game/cs2fixes/entwatch_common.css
new file mode 100644
index 00000000..b77c1731
--- /dev/null
+++ b/assets_source/panorama/styles/custom_game/cs2fixes/entwatch_common.css
@@ -0,0 +1,64 @@
+@define hud-color-0: #ffffffff; /* White */
+@define hud-color-1: #808080ff; /* Gray */
+@define hud-color-2: #ff0000ff; /* Red */
+@define hud-color-3: #ff8060ff; /* Coral */
+@define hud-color-4: #ff8000ff; /* Orange */
+@define hud-color-5: #ffff00ff; /* Yellow */
+@define hud-color-6: #80D000ff; /* Olive */
+@define hud-color-7: #00ff00ff; /* Lime */
+@define hud-color-8: #00ff80ff; /* Emerald */
+@define hud-color-9: #80ffc0ff; /* Mint */
+@define hud-color-10: #00ffffff; /* Cyan */
+@define hud-color-11: #80c0ffff; /* Sky */
+@define hud-color-12: #0080ffff; /* Blue */
+@define hud-color-13: #0000ffff; /* Navy */
+@define hud-color-14: #8000ffff; /* Purple */
+@define hud-color-15: #c080ffff; /* Lavender */
+@define hud-color-16: #ff00ffff; /* Magenta */
+@define hud-color-17: #ff0080ff; /* Rose */
+@define hud-color-18: #ff80c0ff; /* Pink */
+@define hud-color-19: #804000ff; /* Brown */
+
+
+.HudColour-0 { wash-color: hud-color-0; }
+.HudColour-1 { wash-color: hud-color-1; }
+.HudColour-2 { wash-color: hud-color-2; }
+.HudColour-3 { wash-color: hud-color-3; }
+.HudColour-4 { wash-color: hud-color-4; }
+.HudColour-5 { wash-color: hud-color-5; }
+.HudColour-6 { wash-color: hud-color-6; }
+.HudColour-7 { wash-color: hud-color-7; }
+.HudColour-8 { wash-color: hud-color-8; }
+.HudColour-9 { wash-color: hud-color-9; }
+.HudColour-10 { wash-color: hud-color-10; }
+.HudColour-11 { wash-color: hud-color-11; }
+.HudColour-12 { wash-color: hud-color-12; }
+.HudColour-13 { wash-color: hud-color-13; }
+.HudColour-14 { wash-color: hud-color-14; }
+.HudColour-15 { wash-color: hud-color-15; }
+.HudColour-16 { wash-color: hud-color-16; }
+.HudColour-17 { wash-color: hud-color-17; }
+.HudColour-18 { wash-color: hud-color-18; }
+.HudColour-19 { wash-color: hud-color-19; }
+
+.Scale-50 {ui-scale:50%;}
+.Scale-55 {ui-scale:55%;}
+.Scale-60 {ui-scale:60%;}
+.Scale-65 {ui-scale:65%;}
+.Scale-70 {ui-scale:70%;}
+.Scale-75 {ui-scale:75%;}
+.Scale-80 {ui-scale:80%;}
+.Scale-85 {ui-scale:85%;}
+.Scale-90 {ui-scale:90%;}
+.Scale-95 {ui-scale:95%;}
+.Scale-100 {ui-scale:100%;}
+.Scale-105 {ui-scale:105%;}
+.Scale-110 {ui-scale:110%;}
+.Scale-115 {ui-scale:115%;}
+.Scale-120 {ui-scale:120%;}
+.Scale-125 {ui-scale:125%;}
+.Scale-130 {ui-scale:130%;}
+.Scale-135 {ui-scale:135%;}
+.Scale-140 {ui-scale:140%;}
+.Scale-145 {ui-scale:145%;}
+.Scale-150 {ui-scale:150%;}
diff --git a/assets_source/panorama/styles/custom_game/cs2fixes/entwatch_hud.css b/assets_source/panorama/styles/custom_game/cs2fixes/entwatch_hud.css
new file mode 100644
index 00000000..5e6a719c
--- /dev/null
+++ b/assets_source/panorama/styles/custom_game/cs2fixes/entwatch_hud.css
@@ -0,0 +1,291 @@
+@import url("file://{resources}/styles/custom_game/cs2fixes/entwatch_common.css");
+@define row-height: 30px;
+
+.Root {
+ width: 100%;
+ height: 100%;
+}
+.HudTextPanel {
+ opacity: 1;
+ flow-children: right;
+ width:fit-children;
+ overflow: noclip noclip;
+}
+.HudTextPanel.Hidden {
+ opacity: 0;
+}
+.ItemStateColumn {
+ font-size: 32px;
+ width: 20px;
+ margin-right: 10px;
+ flow-children:down;
+ overflow: noclip noclip;
+}
+.ItemNamesColumn {
+ width:fit-children;
+ flow-children:down;
+}
+.Item {
+ flow-children:right;
+ visibility: visible;
+}
+.Item.Hidden {
+ visibility: collapse;
+}
+Label {
+ color: #ffffff;
+ font-size: 28px;
+}
+.ItemState {
+ font-family: 'Stratum2 bold monodigit', 'Arial Unicode MS';
+ horizontal-align:right;
+ text-align: right;
+ height:row-height;
+ color: #000;
+ visibility: visible;
+ overflow: noclip noclip;
+ text-overflow: noclip;
+}
+.ItemState.Hidden {
+ visibility: collapse;
+}
+.ItemName {
+ font-family: 'Stratum2 bold monodigit', 'Arial Unicode MS';
+ height:row-height;
+ margin-right: 11px;
+ text-shadow: 0px 0px 3px 2.0 #000000ff;
+ overflow: noclip noclip;
+ text-overflow: noclip;
+}
+.ItemPlayer {
+ font-family: 'Stratum2', 'Arial Unicode MS';
+ height:row-height;
+ text-shadow: 0px 0px 3px 2.0 #000000ff;
+ visibility: visible;
+ overflow: noclip noclip;
+ text-overflow: noclip;
+}
+.ItemPlayer.Hidden {
+ visibility: collapse;
+}
+
+/* Item State Text Shadow Colours */
+.HudColourShadow-1 { text-shadow: 0px 0px 3px 2.0 #ffffff; }
+.HudColourShadow-2 { text-shadow: 0px 0px 3px 2.0 #e60000; }
+.HudColourShadow-3 { text-shadow: 0px 0px 3px 2.0 #b882f2; }
+.HudColourShadow-4 { text-shadow: 0px 0px 3px 2.0 #1eff1e; }
+.HudColourShadow-5 { text-shadow: 0px 0px 3px 2.0 #b2ff91; }
+.HudColourShadow-6 { text-shadow: 0px 0px 3px 2.0 #b8dc3f; }
+.HudColourShadow-7 { text-shadow: 0px 0px 3px 2.0 #ff4141; }
+.HudColourShadow-8 { text-shadow: 0px 0px 3px 2.0 #afb4b4; }
+.HudColourShadow-9 { text-shadow: 0px 0px 3px 2.0 #fafa19; }
+.HudColourShadow-10 { text-shadow: 0px 0px 3px 2.0 #a5b4d2; }
+.HudColourShadow-11 { text-shadow: 0px 0px 3px 2.0 #72bcff; }
+.HudColourShadow-12 { text-shadow: 0px 0px 3px 2.0 #3755ff; }
+/* 13 is a duplicate of 10 */
+.HudColourShadow-14 { text-shadow: 0px 0px 3px 2.0 #d22be5; }
+.HudColourShadow-15 { text-shadow: 0px 0px 3px 2.0 #e67878; }
+.HudColourShadow-16 { text-shadow: 0px 0px 3px 2.0 #eb912e; }
+
+/* Hud Position */
+.HudPosX0 { x: 0%;}
+.HudPosX1 { x: 1%;}
+.HudPosX2 { x: 2%;}
+.HudPosX3 { x: 3%;}
+.HudPosX4 { x: 4%;}
+.HudPosX5 { x: 5%;}
+.HudPosX6 { x: 6%;}
+.HudPosX7 { x: 7%;}
+.HudPosX8 { x: 8%;}
+.HudPosX9 { x: 9%;}
+.HudPosX10 { x: 10%;}
+.HudPosX11 { x: 11%;}
+.HudPosX12 { x: 12%;}
+.HudPosX13 { x: 13%;}
+.HudPosX14 { x: 14%;}
+.HudPosX15 { x: 15%;}
+.HudPosX16 { x: 16%;}
+.HudPosX17 { x: 17%;}
+.HudPosX18 { x: 18%;}
+.HudPosX19 { x: 19%;}
+.HudPosX20 { x: 20%;}
+.HudPosX21 { x: 21%;}
+.HudPosX22 { x: 22%;}
+.HudPosX23 { x: 23%;}
+.HudPosX24 { x: 24%;}
+.HudPosX25 { x: 25%;}
+.HudPosX26 { x: 26%;}
+.HudPosX27 { x: 27%;}
+.HudPosX28 { x: 28%;}
+.HudPosX29 { x: 29%;}
+.HudPosX30 { x: 30%;}
+.HudPosX31 { x: 31%;}
+.HudPosX32 { x: 32%;}
+.HudPosX33 { x: 33%;}
+.HudPosX34 { x: 34%;}
+.HudPosX35 { x: 35%;}
+.HudPosX36 { x: 36%;}
+.HudPosX37 { x: 37%;}
+.HudPosX38 { x: 38%;}
+.HudPosX39 { x: 39%;}
+.HudPosX40 { x: 40%;}
+.HudPosX41 { x: 41%;}
+.HudPosX42 { x: 42%;}
+.HudPosX43 { x: 43%;}
+.HudPosX44 { x: 44%;}
+.HudPosX45 { x: 45%;}
+.HudPosX46 { x: 46%;}
+.HudPosX47 { x: 47%;}
+.HudPosX48 { x: 48%;}
+.HudPosX49 { x: 49%;}
+.HudPosX50 { x: 50%;}
+.HudPosX51 { x: 51%;}
+.HudPosX52 { x: 52%;}
+.HudPosX53 { x: 53%;}
+.HudPosX54 { x: 54%;}
+.HudPosX55 { x: 55%;}
+.HudPosX56 { x: 56%;}
+.HudPosX57 { x: 57%;}
+.HudPosX58 { x: 58%;}
+.HudPosX59 { x: 59%;}
+.HudPosX60 { x: 60%;}
+.HudPosX61 { x: 61%;}
+.HudPosX62 { x: 62%;}
+.HudPosX63 { x: 63%;}
+.HudPosX64 { x: 64%;}
+.HudPosX65 { x: 65%;}
+.HudPosX66 { x: 66%;}
+.HudPosX67 { x: 67%;}
+.HudPosX68 { x: 68%;}
+.HudPosX69 { x: 69%;}
+.HudPosX70 { x: 70%;}
+.HudPosX71 { x: 71%;}
+.HudPosX72 { x: 72%;}
+.HudPosX73 { x: 73%;}
+.HudPosX74 { x: 74%;}
+.HudPosX75 { x: 75%;}
+.HudPosX76 { x: 76%;}
+.HudPosX77 { x: 77%;}
+.HudPosX78 { x: 78%;}
+.HudPosX79 { x: 79%;}
+.HudPosX80 { x: 80%;}
+.HudPosX81 { x: 81%;}
+.HudPosX82 { x: 82%;}
+.HudPosX83 { x: 83%;}
+.HudPosX84 { x: 84%;}
+.HudPosX85 { x: 85%;}
+.HudPosX86 { x: 86%;}
+.HudPosX87 { x: 87%;}
+.HudPosX88 { x: 88%;}
+.HudPosX89 { x: 89%;}
+.HudPosX90 { x: 90%;}
+.HudPosX91 { x: 91%;}
+.HudPosX92 { x: 92%;}
+.HudPosX93 { x: 93%;}
+.HudPosX94 { x: 94%;}
+.HudPosX95 { x: 95%;}
+.HudPosX96 { x: 96%;}
+.HudPosX97 { x: 97%;}
+.HudPosX98 { x: 98%;}
+.HudPosX99 { x: 99%;}
+
+.HudPosY0 { y: 0%;}
+.HudPosY1 { y: 1%;}
+.HudPosY2 { y: 2%;}
+.HudPosY3 { y: 3%;}
+.HudPosY4 { y: 4%;}
+.HudPosY5 { y: 5%;}
+.HudPosY6 { y: 6%;}
+.HudPosY7 { y: 7%;}
+.HudPosY8 { y: 8%;}
+.HudPosY9 { y: 9%;}
+.HudPosY10 { y: 10%;}
+.HudPosY11 { y: 11%;}
+.HudPosY12 { y: 12%;}
+.HudPosY13 { y: 13%;}
+.HudPosY14 { y: 14%;}
+.HudPosY15 { y: 15%;}
+.HudPosY16 { y: 16%;}
+.HudPosY17 { y: 17%;}
+.HudPosY18 { y: 18%;}
+.HudPosY19 { y: 19%;}
+.HudPosY20 { y: 20%;}
+.HudPosY21 { y: 21%;}
+.HudPosY22 { y: 22%;}
+.HudPosY23 { y: 23%;}
+.HudPosY24 { y: 24%;}
+.HudPosY25 { y: 25%;}
+.HudPosY26 { y: 26%;}
+.HudPosY27 { y: 27%;}
+.HudPosY28 { y: 28%;}
+.HudPosY29 { y: 29%;}
+.HudPosY30 { y: 30%;}
+.HudPosY31 { y: 31%;}
+.HudPosY32 { y: 32%;}
+.HudPosY33 { y: 33%;}
+.HudPosY34 { y: 34%;}
+.HudPosY35 { y: 35%;}
+.HudPosY36 { y: 36%;}
+.HudPosY37 { y: 37%;}
+.HudPosY38 { y: 38%;}
+.HudPosY39 { y: 39%;}
+.HudPosY40 { y: 40%;}
+.HudPosY41 { y: 41%;}
+.HudPosY42 { y: 42%;}
+.HudPosY43 { y: 43%;}
+.HudPosY44 { y: 44%;}
+.HudPosY45 { y: 45%;}
+.HudPosY46 { y: 46%;}
+.HudPosY47 { y: 47%;}
+.HudPosY48 { y: 48%;}
+.HudPosY49 { y: 49%;}
+.HudPosY50 { y: 50%;}
+.HudPosY51 { y: 51%;}
+.HudPosY52 { y: 52%;}
+.HudPosY53 { y: 53%;}
+.HudPosY54 { y: 54%;}
+.HudPosY55 { y: 55%;}
+.HudPosY56 { y: 56%;}
+.HudPosY57 { y: 57%;}
+.HudPosY58 { y: 58%;}
+.HudPosY59 { y: 59%;}
+.HudPosY60 { y: 60%;}
+.HudPosY61 { y: 61%;}
+.HudPosY62 { y: 62%;}
+.HudPosY63 { y: 63%;}
+.HudPosY64 { y: 64%;}
+.HudPosY65 { y: 65%;}
+.HudPosY66 { y: 66%;}
+.HudPosY67 { y: 67%;}
+.HudPosY68 { y: 68%;}
+.HudPosY69 { y: 69%;}
+.HudPosY70 { y: 70%;}
+.HudPosY71 { y: 71%;}
+.HudPosY72 { y: 72%;}
+.HudPosY73 { y: 73%;}
+.HudPosY74 { y: 74%;}
+.HudPosY75 { y: 75%;}
+.HudPosY76 { y: 76%;}
+.HudPosY77 { y: 77%;}
+.HudPosY78 { y: 78%;}
+.HudPosY79 { y: 79%;}
+.HudPosY80 { y: 80%;}
+.HudPosY81 { y: 81%;}
+.HudPosY82 { y: 82%;}
+.HudPosY83 { y: 83%;}
+.HudPosY84 { y: 84%;}
+.HudPosY85 { y: 85%;}
+.HudPosY86 { y: 86%;}
+.HudPosY87 { y: 87%;}
+.HudPosY88 { y: 88%;}
+.HudPosY89 { y: 89%;}
+.HudPosY90 { y: 90%;}
+.HudPosY91 { y: 91%;}
+.HudPosY92 { y: 92%;}
+.HudPosY93 { y: 93%;}
+.HudPosY94 { y: 94%;}
+.HudPosY95 { y: 95%;}
+.HudPosY96 { y: 96%;}
+.HudPosY97 { y: 97%;}
+.HudPosY98 { y: 98%;}
+.HudPosY99 { y: 99%;}
diff --git a/assets_source/panorama/styles/custom_game/cs2fixes/entwatch_settings.css b/assets_source/panorama/styles/custom_game/cs2fixes/entwatch_settings.css
new file mode 100644
index 00000000..972eec0b
--- /dev/null
+++ b/assets_source/panorama/styles/custom_game/cs2fixes/entwatch_settings.css
@@ -0,0 +1,310 @@
+@import url("file://{resources}/styles/custom_game/cs2fixes/entwatch_common.css");
+
+.Root {
+ width: 100%;
+ height: 100%;
+}
+
+.SettingsPanel {
+ min-width: 720px;
+ width:38%;
+ min-height: 440px;
+ height: width-percentage(62%);
+ horizontal-align: center;
+ vertical-align: center;
+ flow-children: right;
+ padding: 24px;
+ background-color: #000000F0;
+ background-img-opacity: 0.015;
+ background-size: 360px 360px;
+ background-image: url("s2r://panorama/images/backgrounds/bluedots_large_png.vtex");
+ background-blur: gaussian(3);
+ border: 2px solid rgb(206, 206, 206);
+ border-radius: 4px;
+ font-family: Stratum2;
+ color: #f2f2f2;
+ opacity: 1;
+}
+.SettingsPanel.Hidden {
+ visibility: collapse;
+}
+
+.SettingsColumn {
+ width: 330px;
+ height: 100%;
+ flow-children: down;
+ margin-right: 28px;
+}
+
+.ColorColumn {
+ width: fill-parent-flow(1.0);
+ height: 100%;
+ flow-children: down;
+}
+
+.TogglePanel {
+ width:349px;
+ flow-children: down;
+ margin-right: 16px;
+}
+.SettingRow {
+ width: fit-children;
+ height: 48px;
+ flow-children: right;
+ margin-bottom: 8px;
+ horizontal-align: right;
+}
+
+.SettingName {
+ width: fit-children;
+ vertical-align: center;
+ text-align: right;
+ font-size: 22px;
+ margin-right: 18px;
+}
+
+.ToggleButton {
+ width: 94px;
+ height: 42px;
+ vertical-align: center;
+ padding: 5px;
+ border: 3px solid #d5d9dd;
+ border-radius: 11px;
+ background-color: #080c10;
+ transition-property: background-color, border-color;
+ transition-duration: 0.22s, 0.12s;
+}
+
+.ToggleButton:hover {
+ border-color: white;
+ sound: "UIPanorama.mainmenu_rollover";
+}
+
+.ToggleKnob {
+ width: 26px;
+ height: 26px;
+ vertical-align: center;
+ border-radius: 50%;
+ background-color: #858b91;
+ horizontal-align: left;
+ transition-property: position, background-color;
+ transition-duration: 0.22s;
+}
+
+.ToggleButton.Selected,
+.ToggleButton.On {
+ background-color: #3076a8;
+}
+
+.ToggleButton.Selected .ToggleKnob,
+.ToggleButton.On .ToggleKnob {
+ horizontal-align: right;
+ background-color: white;
+}
+
+.PositionControls {
+ width: 100%;
+ flow-children: down;
+ margin-top: 6px;
+ horizontal-align: right;
+}
+
+.SectionTitle {
+ width: 100%;
+ text-align: center;
+ font-size: 21px;
+ color: #f2f2f2;
+ margin-bottom: 7px;
+}
+
+.AdjustmentRow {
+ width: fit-children;
+ height: 58px;
+ horizontal-align:center;
+ flow-children: right;
+ margin-bottom: 8px;
+}
+.AdjustmentRow:last-child {
+ margin-right: 0px;
+}
+
+.AdjustmentButton {
+ width: 55px;
+ height: 55px;
+ margin-right: 8px;
+ border: 3px solid #d5d9dd;
+ background-color: #080c10;
+ transition-property: background-color, border-color;
+ transition-duration: 0.1s;
+}
+#PositionXPlus10 {
+ margin-right: 0px;
+}
+#PositionYPlus10 {
+ margin-right: 0px;
+}
+
+.AdjustmentButton:hover {
+ background-color: #29343e;
+ border-color: white;
+ sound: "UIPanorama.mainmenu_rollover";
+}
+
+.AdjustmentButton:active {
+ background-color: #3a4b59;
+}
+
+.AdjustmentButton Label {
+ horizontal-align: center;
+ vertical-align: center;
+ text-align: center;
+ font-size: 20px;
+ color: #f2f2f2;
+}
+
+.HudPosLabel {
+ height:55px;
+ width: 42px;
+ margin-right: 8px;
+ flow-children: down;
+}
+.AxisLabelText {
+ vertical-align: center;
+ horizontal-align:center;
+ text-align: center;
+ font-size: 20px;
+ color:white;
+}
+.AxisLabel {
+ vertical-align: top;
+ horizontal-align:center;
+ margin-top: -8px;
+ text-align: center;
+ font-size: 30px;
+ color: white;
+}
+
+.HudSizeControls {
+ width: 100%;
+ flow-children: down;
+ margin-top: 1px;
+}
+
+.SizeRow {
+ horizontal-align: center;
+ height: 58px;
+ flow-children: right;
+}
+
+.SizeButton {
+ margin-right: 0px;
+}
+
+.SizeValue {
+ width: 70px;
+ vertical-align: center;
+ text-align: center;
+ font-size: 20px;
+ color: #f2f2f2;
+}
+
+.ColorHeader {
+ width: 100%;
+ height: 31px;
+}
+
+.ColorTitle {
+ horizontal-align: center;
+ vertical-align: center;
+ margin-bottom: 0px;
+}
+
+.CloseButton {
+ ignore-parent-flow: true;
+ width: 29px;
+ height: 29px;
+ horizontal-align: right;
+ vertical-align: top;
+ margin-top: -16px;
+ margin-right: -16px;
+ border: 1px solid #9099a1;
+ border-radius: 4px;
+ background-color: transparent;
+ transition-property: background-color, border-color;
+ transition-duration: 0.1s;
+}
+
+.CloseButton:hover {
+ border-color: white;
+ background-color: #888888;
+ sound: "UIPanorama.mainmenu_rollover";
+}
+
+.CloseButton Label {
+ horizontal-align: center;
+ vertical-align: center;
+ text-align: center;
+ font-size: 19px;
+ color: #f2f2f2;
+}
+
+.ColorList {
+ width: 100%;
+ height: 100%;
+ flow-children:down;
+ overflow: squish scroll;
+ horizontal-align: center;
+ border: 3px solid #d5d9dd;
+}
+
+.ColorPanel {
+ border-width: 2px;
+ border-style: solid;
+ border-color: #00000000;
+ border-radius: 3px;
+ flow-children: right;
+ height: 30px;
+ width:90%;
+ font-size: 24px;
+ background-color: transparent;
+ margin-top: 8px;
+ horizontal-align: center;
+ transition-property: border-color;
+ transition-duration: 0.2s;
+}
+.ColorPanel:hover {
+ border-color: #a2a2a2;
+ sound: "UIPanorama.mainmenu_rollover";
+}
+.ColorPanel.Selected {
+ border-color: #fff;
+ border-width: 3px;
+}
+.ColorPanel .ColorSquare {
+ margin-right: 8px;
+}
+.ColorPanel .ColorLabel {
+ margin-right: 8px;
+}
+.ColorPanel .ColorSquareEnd {
+ margin-right: 0px;
+}
+
+.ColorSquare {
+ height: 100%;
+ width: height-percentage( 100% );
+ background-color: #ffffff;
+}
+.ColorSquareEnd {
+ height: 100%;
+ width: fill-parent-flow(1.0);
+ background-color: #ffffff;
+}
+
+.ColorLabel {
+ text-align: center;
+ vertical-align: center;
+ width: fill-parent-flow(0.6);
+ text-shadow: 2px 2px 8px 3.0 #333333b0;
+ color:#ffffff;
+}
diff --git a/src/entwatch.cpp b/src/entwatch.cpp
index 916b3710..9beac6d1 100644
--- a/src/entwatch.cpp
+++ b/src/entwatch.cpp
@@ -26,7 +26,7 @@
#include "entity/ccsplayercontroller.h"
#include "entity/ccsplayerpawn.h"
#include "entity/cmathcounter.h"
-#include "entity/cpointworldtext.h"
+#include "entity/customhudlayout.h"
#include "entity/services.h"
#include "eventlistener.h"
#include "leader.h"
@@ -57,6 +57,29 @@ CConVar g_cvarUseEntwatchClantag("entwatch_clantag", FCVAR_NONE, "Whether
CConVar g_cvarItemHolderScore("entwatch_score", FCVAR_NONE, "Score to give item holders (0 = dont change score at all) Requires entwatch_clantag 1", 9999, true, 0, false, 0);
CConVar g_cvarEnableEntwatchHud("entwatch_hud", FCVAR_NONE, "Whether to enable the EntWatch hud and related commands", true);
+// Colour names to show on the !hud menu, change the hex in entwatch_common.css
+std::string g_HudColors[EW_MAX_HUDCOLORS] = {
+ "white",
+ "gray",
+ "red",
+ "coral",
+ "orange",
+ "yellow",
+ "olive",
+ "lime",
+ "emerald",
+ "mint",
+ "cyan",
+ "sky",
+ "blue",
+ "navy",
+ "purple",
+ "lavender",
+ "magenta",
+ "rose",
+ "pink",
+ "brown"};
+
void ItemGlowDistanceChanged(CConVar* ref, CSplitScreenSlot nSlot, const int* pNewValue, const int* pOldValue)
{
if (!g_pEWHandler || !g_pEWHandler->IsConfigLoaded() || g_pEWHandler->vecItems.size() < 1)
@@ -467,6 +490,7 @@ void EWItem::SetDefaultValues()
/* no default hammerid */
V_strcpy(sChatColor, "\x01");
colorGlow = Color(255, 255, 255, 255);
+ iHudColor = 0;
bShowPickup = true;
bShowHud = true;
transfer = EWCfg_Auto;
@@ -481,77 +505,92 @@ void EWItem::ParseColor(std::string value)
{
V_strcpy(sChatColor, "\x01");
colorGlow = Color(255, 255, 255, 255);
+ iHudColor = 1;
}
else if (value == "darkred")
{
V_strcpy(sChatColor, "\x02");
colorGlow = Color(220, 0, 0, 255);
+ iHudColor = 2;
}
else if (value == "team")
{
V_strcpy(sChatColor, "\x03");
colorGlow = Color(184, 130, 242, 255);
+ iHudColor = 3;
}
else if (value == "green")
{
V_strcpy(sChatColor, "\x04");
colorGlow = Color(30, 255, 30, 255);
+ iHudColor = 4;
}
else if (value == "lightgreen")
{
V_strcpy(sChatColor, "\x05");
colorGlow = Color(178, 255, 145, 255);
+ iHudColor = 5;
}
else if (value == "olive")
{
V_strcpy(sChatColor, "\x06");
colorGlow = Color(184, 220, 63, 255);
+ iHudColor = 6;
}
else if (value == "red")
{
V_strcpy(sChatColor, "\x07");
colorGlow = Color(255, 65, 65, 255);
+ iHudColor = 7;
}
else if (value == "gray" || value == "grey")
{
V_strcpy(sChatColor, "\x08");
colorGlow = Color(175, 180, 180, 255);
+ iHudColor = 8;
}
else if (value == "yellow")
{
V_strcpy(sChatColor, "\x09");
colorGlow = Color(250, 250, 25, 255);
+ iHudColor = 9;
}
else if (value == "silver")
{
V_strcpy(sChatColor, "\x0A");
colorGlow = Color(165, 180, 210, 255);
+ iHudColor = 10;
}
else if (value == "blue")
{
V_strcpy(sChatColor, "\x0B");
colorGlow = Color(114, 188, 255, 255);
+ iHudColor = 11;
}
else if (value == "darkblue")
{
V_strcpy(sChatColor, "\x0C");
colorGlow = Color(45, 75, 255, 255);
+ iHudColor = 12;
}
// \x0D is the same as \x0A
else if (value == "purple" || value == "pink")
{
V_strcpy(sChatColor, "\x0E");
colorGlow = Color(210, 43, 229, 255);
+ iHudColor = 14;
}
else if (value == "red2")
{
V_strcpy(sChatColor, "\x0F");
colorGlow = Color(230, 120, 120, 255);
+ iHudColor = 15;
}
else if (value == "orange" || value == "gold")
{
V_strcpy(sChatColor, "\x10");
colorGlow = Color(235, 145, 46, 255);
+ iHudColor = 16;
}
}
@@ -563,6 +602,7 @@ EWItem::EWItem(std::shared_ptr pItem)
szHammerid = pItem->szHammerid;
V_strcpy(sChatColor, pItem->sChatColor);
colorGlow = pItem->colorGlow;
+ iHudColor = pItem->iHudColor;
bShowPickup = pItem->bShowPickup;
bShowHud = pItem->bShowHud;
transfer = pItem->transfer;
@@ -1181,6 +1221,33 @@ void CEWHandler::ClearItems()
vecItems.clear();
}
+void CEWHandler::ClearHud()
+{
+ if (!hHud.Get())
+ return;
+
+ std::string stateId;
+ std::string itemId;
+ std::string nameId;
+ std::string playerId;
+
+ for (int i = 0; i < EW_HUD_MAXITEMS; i++)
+ {
+ const std::string index = std::to_string(i);
+
+ stateId = EW_HUD_STATE_ID + index;
+ itemId = "Item-" + index;
+ nameId = EW_HUD_NAME_ID + index;
+ playerId = EW_HUD_PLAYER_ID + index;
+
+ hHud->SetDialogVariableString(stateId, "State", "");
+ hHud->SetHasClass(stateId, "Hidden", true);
+ hHud->SetHasClass(itemId, "Hidden", true);
+ hHud->SetDialogVariableString(nameId, "Name", "");
+ hHud->SetDialogVariableString(playerId, "Player", "");
+ }
+}
+
/*
* Finds the index of an item instance with a given entity index
* Returns index into vecItems or -1 if not found
@@ -1598,7 +1665,7 @@ void CEWHandler::PlayerPickup(CCSPlayerPawn* pPawn, int iItemInstance)
if (m_pHudTimer.expired())
m_pHudTimer = CTimer::Create(EW_HUD_TICKRATE, TIMERFLAG_MAP | TIMERFLAG_ROUND, [] {
- return EW_UpdateHud();
+ return g_pEWHandler->UpdateHud();
});
}
@@ -1861,20 +1928,163 @@ KHook::Return CEWHandler::Hook_Use(CBaseEntity* pThis, InputData_t* pInput
return {KHook::Action::Ignore};
}
+void CEWHandler::ShowHudMenu(CCSPlayerController* pController, ZEPlayer* zpPlayer)
+{
+ if (!hHudSettings.Get())
+ {
+ hHudSettings = CCSCustomHudLayout::Create("cs2fixes/entwatch_settings");
+ for (int i = 0; i < EW_MAX_HUDCOLORS; i++)
+ {
+ std::string labelId = "ColorLabel-" + std::to_string(i);
+ std::string strPrettyName = g_HudColors[i];
+ strPrettyName[0] = toupper(strPrettyName[0]);
+ hHudSettings->SetDialogVariableString(labelId, "ColorName", strPrettyName);
+ }
+
+ hHudSettings->SetClickCallback([](CCSPlayerController* pController, CCSCustomHudLayout* pHud, std::string sButtonId) {
+ if (sButtonId == "CloseButton")
+ {
+ pHud->SetHasClass("SettingsPanel", "Hidden", true, pController);
+ pHud->SetInputCaptureEnabled(false, pController);
+ }
+ else if (sButtonId == "ToggleEntWatchHud")
+ {
+ ZEPlayer* zpPlayer = g_playerManager->GetPlayer(pController->GetPlayerSlot());
+ if (zpPlayer)
+ zpPlayer->SetEntwatchHudEnabled(!zpPlayer->GetEntwatchHudEnabled());
+ }
+ else if (sButtonId == "TogglePlayerNames")
+ {
+ ZEPlayer* zpPlayer = g_playerManager->GetPlayer(pController->GetPlayerSlot());
+ if (zpPlayer)
+ zpPlayer->SetEntwatchPlayerNames(!zpPlayer->GetEntwatchPlayerNames());
+ }
+ else if (sButtonId == "HudSizeMinus")
+ {
+ ZEPlayer* zpPlayer = g_playerManager->GetPlayer(pController->GetPlayerSlot());
+ if (zpPlayer)
+ {
+ int size = zpPlayer->GetEntwatchHudSize();
+ size -= 5;
+ if (size < EW_HUDSIZE_MIN)
+ size = EW_HUDSIZE_MIN;
+ if (size != zpPlayer->GetEntwatchHudSize())
+ zpPlayer->SetEntwatchHudSize(size);
+ }
+ }
+ else if (sButtonId == "HudSizePlus")
+ {
+ ZEPlayer* zpPlayer = g_playerManager->GetPlayer(pController->GetPlayerSlot());
+ if (zpPlayer)
+ {
+ int size = zpPlayer->GetEntwatchHudSize();
+ size += 5;
+ if (size > EW_HUDSIZE_MAX)
+ size = EW_HUDSIZE_MAX;
+ if (size != zpPlayer->GetEntwatchHudSize())
+ zpPlayer->SetEntwatchHudSize(size);
+ }
+ }
+ else if (sButtonId.starts_with("PositionX"))
+ {
+ ZEPlayer* zpPlayer = g_playerManager->GetPlayer(pController->GetPlayerSlot());
+ if (zpPlayer)
+ {
+ int x = zpPlayer->GetEntwatchHudX();
+ if (sButtonId == "PositionXMinus10")
+ x -= 10;
+ else if (sButtonId == "PositionXMinus1")
+ x -= 1;
+ else if (sButtonId == "PositionXPlus1")
+ x += 1;
+ else if (sButtonId == "PositionXPlus10")
+ x += 10;
+
+ if (x < EW_HUDPOS_MIN)
+ x = EW_HUDPOS_MIN;
+ else if (x > EW_HUDPOS_MAX)
+ x = EW_HUDPOS_MAX;
+
+ if (x != zpPlayer->GetEntwatchHudX())
+ zpPlayer->SetEntwatchHudPos(x, zpPlayer->GetEntwatchHudY());
+ }
+ }
+ else if (sButtonId.starts_with("PositionY"))
+ {
+ ZEPlayer* zpPlayer = g_playerManager->GetPlayer(pController->GetPlayerSlot());
+ if (zpPlayer)
+ {
+ int y = zpPlayer->GetEntwatchHudY();
+ if (sButtonId == "PositionYMinus10")
+ y -= 10;
+ else if (sButtonId == "PositionYMinus1")
+ y -= 1;
+ else if (sButtonId == "PositionYPlus1")
+ y += 1;
+ else if (sButtonId == "PositionYPlus10")
+ y += 10;
+
+ if (y < EW_HUDPOS_MIN)
+ y = EW_HUDPOS_MIN;
+ else if (y > EW_HUDPOS_MAX)
+ y = EW_HUDPOS_MAX;
+
+ if (y != zpPlayer->GetEntwatchHudY())
+ zpPlayer->SetEntwatchHudPos(zpPlayer->GetEntwatchHudX(), y);
+ }
+ }
+ else if (sButtonId.starts_with("ColorPanel-"))
+ {
+ std::string strColorIndex = sButtonId.substr(11);
+ int i = V_StringToInt32(strColorIndex.c_str(), -1);
+ if (i >= 0 && i < EW_MAX_HUDCOLORS)
+ {
+ ZEPlayer* zpPlayer = g_playerManager->GetPlayer(pController->GetPlayerSlot());
+ if (zpPlayer)
+ zpPlayer->SetEntwatchHudColor(i);
+ }
+ }
+ });
+ }
+
+ hHudSettings->SetHasClass("ToggleEntWatchHud", "Selected", zpPlayer->GetEntwatchHudEnabled(), pController);
+ hHudSettings->SetHasClass("TogglePlayerNames", "Selected", zpPlayer->GetEntwatchPlayerNames(), pController);
+
+ std::string text = std::to_string(zpPlayer->GetEntwatchHudSize());
+ hHudSettings->SetDialogVariableString("HudSizeValue", "Scale", text, pController);
+
+ text = std::to_string(zpPlayer->GetEntwatchHudX());
+ hHudSettings->SetDialogVariableString("HudPosXValue", "HudPosX", text, pController);
+
+ text = std::to_string(zpPlayer->GetEntwatchHudY());
+ hHudSettings->SetDialogVariableString("HudPosYValue", "HudPosY", text, pController);
+
+ text = "ColorPanel-" + std::to_string(zpPlayer->GetEntwatchHudColor());
+ hHudSettings->SetHasClass(text, "Selected", true, pController);
+
+ hHudSettings->SetHasClass("SettingsPanel", "Hidden", false, pController);
+ hHudSettings->SetInputCaptureEnabled(true, pController);
+}
+
// Update cd and uses of all held items
-float EW_UpdateHud()
+float CEWHandler::UpdateHud()
{
if (!GetGlobals())
return EW_HUD_TICKRATE;
- std::string sHudText = "";
- std::string sHudTextNoPlayerNames = "";
- static bool bWasEmptyPreviously = false;
+ if (g_cvarEnableEntwatchHud.Get() && !hHud.Get())
+ {
+ hHud = CCSCustomHudLayout::Create("cs2fixes/entwatch_hud");
+ for (int i = 0; i < MAX_PLAYERS; i++)
+ bClientHudInitialized[i] = false;
+ }
+
+ int iItemsOnHud = 0;
bool bFirst = true;
- for (int i = 0; i < (g_pEWHandler->vecItems).size(); i++)
+ for (int i = 0; i < (vecItems).size(); i++)
{
- std::shared_ptr pItem = g_pEWHandler->vecItems[i];
+ std::shared_ptr pItem = vecItems[i];
if (!pItem)
continue;
@@ -1897,41 +2107,60 @@ float EW_UpdateHud()
pOwner->SetClanTag(pItem->sClantag);
}
- if (!g_cvarEnableEntwatchHud.Get())
+ if (!g_cvarEnableEntwatchHud.Get() || iItemsOnHud >= EW_HUD_MAXITEMS)
continue;
- // std::format not supported in clang16 by default (steamrt3)
- if (!bFirst)
+ const std::string sIndex = std::to_string(iItemsOnHud);
+ std::string panelid = EW_HUD_STATE_ID + sIndex;
+ hHud->SetDialogVariableString(panelid, "State", sItemText);
+ hHud->SetHasClass(panelid, "Hidden", false);
+
+ if (pItem->iHudColor != iItemColors[iItemsOnHud])
{
- sHudText.append("\n");
- sHudTextNoPlayerNames.append("\n");
+ std::string colorclass = EW_HUDCOLOR_SHADOW + std::to_string(iItemColors[iItemsOnHud]);
+ hHud->SetHasClass(panelid, colorclass, false);
+
+ colorclass = EW_HUDCOLOR_SHADOW + std::to_string(pItem->iHudColor);
+ hHud->SetHasClass(panelid, colorclass, true);
+
+ iItemColors[iItemsOnHud] = pItem->iHudColor;
}
- else
- bFirst = false;
- sHudText.append("[");
- sHudText.append(sItemText);
- sHudText.append("]");
- sHudText.append(pItem->szShortName);
- sHudText.append(": ");
- sHudText.append(pOwner->GetPlayerName());
+ panelid = "Item-" + sIndex;
+ hHud->SetHasClass(panelid, "Hidden", false);
- // sHudTextNoPlayerNames.append(std::format("\n[{}]{}", sItemText, pItem->szShortName));
- sHudTextNoPlayerNames.append("[");
- sHudTextNoPlayerNames.append(sItemText);
- sHudTextNoPlayerNames.append("]");
- sHudTextNoPlayerNames.append(pItem->szShortName);
- }
+ panelid = EW_HUD_NAME_ID + sIndex;
+ hHud->SetDialogVariableString(panelid, "Name", pItem->szShortName);
- if (sHudText != "")
- {
- bWasEmptyPreviously = false;
+ panelid = EW_HUD_PLAYER_ID + sIndex;
+ hHud->SetDialogVariableString(panelid, "Player", pOwner->GetPlayerName());
+
+ iItemsOnHud++;
}
- else
+
+ if (iItemsOnHud == 0 && iItemsOnHudLastTick == 0)
+ return EW_HUD_TICKRATE;
+
+ // Clear any that weren't overridden
+ if (iItemsOnHudLastTick > iItemsOnHud)
{
- if (bWasEmptyPreviously)
- return EW_HUD_TICKRATE;
- bWasEmptyPreviously = true;
+ for (int i = iItemsOnHud; i < iItemsOnHudLastTick; i++)
+ {
+ const std::string sIndex = std::to_string(i);
+
+ std::string panelid = "ItemState-" + sIndex;
+ hHud->SetDialogVariableString(panelid, "State", "");
+ hHud->SetHasClass(panelid, "Hidden", true);
+
+ panelid = "Item-" + sIndex;
+ hHud->SetHasClass(panelid, "Hidden", true);
+
+ panelid = EW_HUD_NAME_ID + sIndex;
+ hHud->SetDialogVariableString(panelid, "Name", "");
+
+ panelid = EW_HUD_PLAYER_ID + sIndex;
+ hHud->SetDialogVariableString(panelid, "Player", "");
+ }
}
for (int i = 0; i < GetGlobals()->maxClients; i++)
@@ -1943,23 +2172,44 @@ float EW_UpdateHud()
if (!pPawn)
continue;
ZEPlayer* zpPlayer = g_playerManager->GetPlayer(CPlayerSlot(i));
- if (!zpPlayer)
+ if (!zpPlayer || zpPlayer->IsFakeClient())
continue;
- EWHudMode mode = (EWHudMode)(zpPlayer->GetEntwatchHudMode());
+ // Clients joining an existing HUD still need their saved preferences applied.
+ if (!bClientHudInitialized[i])
+ {
+ // Initialising classes so don't need to remove any
+ // Default is HUD disabled, player names enabled
+ hHud->SetHasClass("HudTextPanel", "Hidden", !zpPlayer->GetEntwatchHudEnabled(), pController);
- CPointWorldText* pText = zpPlayer->GetEntwatchHud();
- if (!pText)
- continue;
+ std::string text = EW_HUDPOS_X_CLASS + std::to_string(zpPlayer->GetEntwatchHudX());
+ hHud->SetHasClass("HudTextPanel", text, true, pController);
- if (mode == EWHudMode::Hud_On)
- pText->AcceptInput("SetMessage", sHudText.c_str());
- else if (mode == EWHudMode::Hud_ItemOnly)
- pText->AcceptInput("SetMessage", sHudTextNoPlayerNames.c_str());
- else
- pText->AcceptInput("SetMessage", "");
+ text = EW_HUDPOS_Y_CLASS + std::to_string(zpPlayer->GetEntwatchHudY());
+ hHud->SetHasClass("HudTextPanel", text, true, pController);
+
+ text = EW_HUDSIZE_CLASS + std::to_string(zpPlayer->GetEntwatchHudSize());
+ hHud->SetHasClass("HudTextPanel", text, true, pController);
+
+ text = EW_HUDCOLOR_CLASS + std::to_string(zpPlayer->GetEntwatchHudColor());
+ hHud->SetHasClass("ItemNamesColumn", text, true, pController);
+ }
+
+ // Initialise player names too, then update changes while the HUD is enabled.
+ if (!bClientHudInitialized[i] || (zpPlayer->GetEntwatchHudEnabled() && bPlayerNames[i] != zpPlayer->GetEntwatchPlayerNames()))
+ {
+ for (int j = 0; j < EW_HUD_MAXITEMS; j++)
+ {
+ const std::string sIndex = std::to_string(j);
+ const std::string sPanelId = "ItemPlayer-" + sIndex;
+ hHud->SetHasClass(sPanelId, "Hidden", !zpPlayer->GetEntwatchPlayerNames(), pController);
+ }
+ bPlayerNames[i] = zpPlayer->GetEntwatchPlayerNames();
+ }
+ bClientHudInitialized[i] = true;
}
+ iItemsOnHudLastTick = iItemsOnHud;
return EW_HUD_TICKRATE;
}
@@ -1967,6 +2217,13 @@ void EW_OnLevelInit(const char* sMapName)
{
g_pEWHandler->UnLoadConfig();
g_pEWHandler->LoadMapConfig(sMapName);
+ g_pEWHandler->iItemsOnHudLastTick = 0;
+
+ for (int i = 0; i < EW_HUD_MAXITEMS; i++)
+ g_pEWHandler->iItemColors[i] = 0;
+
+ for (int i = 0; i < MAX_PLAYERS; i++)
+ g_pEWHandler->bPlayerNames[i] = true;
}
void EW_RoundPreStart()
@@ -1976,6 +2233,7 @@ void EW_RoundPreStart()
g_pEWHandler->ResetAllClantags();
g_pEWHandler->ClearItems();
+ g_pEWHandler->ClearHud();
}
void EW_OnEntitySpawned(CEntityInstance* pEntity)
@@ -2192,18 +2450,13 @@ void EW_PlayerDeathPre(CCSPlayerController* pController)
void EW_PlayerDisconnect(int slot)
{
- ZEPlayer* pPlayer = g_playerManager->GetPlayer(CPlayerSlot(slot));
- if (pPlayer)
- {
- CPointWorldText* pText = pPlayer->GetEntwatchHud();
- if (pText)
- pText->Remove();
- }
-
auto i = g_pEWHandler->mapTransfers.find(slot);
if (i != g_pEWHandler->mapTransfers.end())
g_pEWHandler->mapTransfers.erase(slot);
+ g_pEWHandler->bPlayerNames[slot] = true;
+ g_pEWHandler->bClientHudInitialized[slot] = false;
+
CCSPlayerController* pController = CCSPlayerController::FromSlot(slot);
if (!pController)
return;
@@ -2555,7 +2808,7 @@ CON_COMMAND_CHAT(ew_dump, "- Prints the currently loaded config to console")
g_pEWHandler->PrintLoadedConfig(player);
}
-CON_COMMAND_CHAT(hud, "- Toggle EntWatch HUD")
+CON_COMMAND_CHAT(hud, "- Open EntWatch HUD Settings Menu")
{
if (!g_cvarEnableEntWatch.Get())
return;
@@ -2579,22 +2832,7 @@ CON_COMMAND_CHAT(hud, "- Toggle EntWatch HUD")
return;
}
- EWHudMode mode = (EWHudMode)(zpPlayer->GetEntwatchHudMode());
- if (mode == EWHudMode::Hud_None)
- mode = EWHudMode::Hud_On;
- else if (mode == EWHudMode::Hud_On)
- mode = EWHudMode::Hud_ItemOnly;
- else
- mode = EWHudMode::Hud_None;
-
- zpPlayer->SetEntwatchHudMode((int)mode);
-
- if (mode == EWHudMode::Hud_None)
- ClientPrint(player, HUD_PRINTTALK, EW_PREFIX "EntWatch HUD\x07 disabled.");
- else if (mode == EWHudMode::Hud_On)
- ClientPrint(player, HUD_PRINTTALK, EW_PREFIX "EntWatch HUD\x04 enabled.");
- else
- ClientPrint(player, HUD_PRINTTALK, EW_PREFIX "EntWatch HUD\x04 enabled\x10 (Item names only).");
+ g_pEWHandler->ShowHudMenu(player, zpPlayer);
}
CON_COMMAND_CHAT(hudpos, " - Sets the position of the EntWatch hud.")
@@ -2624,18 +2862,23 @@ CON_COMMAND_CHAT(hudpos, " - Sets the position of the EntWatch hud.")
if (args.ArgC() < 3)
{
ClientPrint(player, HUD_PRINTTALK, EW_PREFIX "Usage: !hudpos ");
- ClientPrint(player, HUD_PRINTTALK, EW_PREFIX "Current hudpos: %.1fx %.1fy", zpPlayer->GetEntwatchHudX(), zpPlayer->GetEntwatchHudY());
+ ClientPrint(player, HUD_PRINTTALK, EW_PREFIX "Current hudpos: %dx %dy", zpPlayer->GetEntwatchHudX(), zpPlayer->GetEntwatchHudY());
return;
}
- float x = std::atof(args[1]);
- float y = std::atof(args[2]);
+ int x = std::atoi(args[1]);
+ int y = std::atoi(args[2]);
+ if (x < 0 || x > 99 || y < 0 || y > 99)
+ {
+ ClientPrint(player, HUD_PRINTTALK, EW_PREFIX "X and Y values must be between 0 and 99!");
+ return;
+ }
zpPlayer->SetEntwatchHudPos(x, y);
- ClientPrint(player, HUD_PRINTTALK, EW_PREFIX "Set hudpos to: %.1fx %.1fy", x, y);
+ ClientPrint(player, HUD_PRINTTALK, EW_PREFIX "Set hudpos to: %dx %dy", x, y);
}
-CON_COMMAND_CHAT(hudcolor, " [a] - Set color (and transparency) of the Entwatch hud")
+CON_COMMAND_CHAT(hudcolor, "[color] - Set color of the Entwatch hud")
{
if (!g_cvarEnableEntWatch.Get())
return;
@@ -2659,35 +2902,30 @@ CON_COMMAND_CHAT(hudcolor, " [a] - Set color (and transparency) of th
return;
}
- Color clrCur = zpPlayer->GetEntwatchHudColor();
- if (args.ArgC() < 4)
+ if (args.ArgC() < 2)
{
- ClientPrint(player, HUD_PRINTTALK, EW_PREFIX "Usage: !hudcolor [Optional: alpha]");
- ClientPrint(player, HUD_PRINTTALK, EW_PREFIX "Current hudcolor:\x07 %d\x04 %d\x0C %d\x01 %d", clrCur.r(), clrCur.g(), clrCur.b(), clrCur.a());
+ ClientPrint(player, HUD_PRINTTALK, EW_PREFIX "Usage: !hudcolor [color]");
+ ClientPrint(player, HUD_PRINTTALK, EW_PREFIX "Current hudcolor:\x04 %s", g_HudColors[zpPlayer->GetEntwatchHudColor()].c_str());
return;
}
- int r = std::atoi(args[1]);
- int g = std::atoi(args[2]);
- int b = std::atoi(args[3]);
- int a = clrCur.a();
- Color newColor;
- if (args.ArgC() > 4)
+ std::string colour = args[1];
+ colour = StringToLower(colour);
+ for (int i = 0; i < EW_MAX_HUDCOLORS; i++)
{
- a = std::atoi(args[4]);
- newColor.SetColor(r, g, b, a);
- ClientPrint(player, HUD_PRINTTALK, EW_PREFIX "Set hudcolor to:\x07 %d\x04 %d\x0C %d\x01 %d", newColor.r(), newColor.g(), newColor.b(), newColor.a());
- }
- else
- {
- newColor.SetColor(r, g, b, a);
- ClientPrint(player, HUD_PRINTTALK, EW_PREFIX "Set hudcolor to:\x07 %d\x04 %d\x0C %d", newColor.r(), newColor.g(), newColor.b());
+ if (colour == g_HudColors[i])
+ {
+ zpPlayer->SetEntwatchHudColor(i);
+ ClientPrint(player, HUD_PRINTTALK, EW_PREFIX "Hud color set to:\x04 %s", g_HudColors[i].c_str());
+ return;
+ }
}
- zpPlayer->SetEntwatchHudColor(newColor);
+ ClientPrint(player, HUD_PRINTTALK, EW_PREFIX "Invalid hud color entered! Color names are on the \x04!hud \x01menu.");
+ ClientPrint(player, HUD_PRINTTALK, EW_PREFIX "Usage: !hudcolor ");
}
-CON_COMMAND_CHAT(hudsize, " - Set font size of the EntWatch hud")
+CON_COMMAND_CHAT(hudsize, " - Set size of the EntWatch hud")
{
if (!g_cvarEnableEntWatch.Get())
return;
@@ -2714,17 +2952,18 @@ CON_COMMAND_CHAT(hudsize, " - Set font size of the EntWatch hud")
if (args.ArgC() < 2)
{
ClientPrint(player, HUD_PRINTTALK, EW_PREFIX "Usage: !hudsize ");
- float flSize = zpPlayer->GetEntwatchHudSize();
- ClientPrint(player, HUD_PRINTTALK, EW_PREFIX "Current hud size:\x04 %.2f", flSize);
+ ClientPrint(player, HUD_PRINTTALK, EW_PREFIX "Current hud size:\x04 %d%%", zpPlayer->GetEntwatchHudSize());
return;
}
- float size = std::atof(args[1]);
- if (size < 20.0f) // size 20 with 0.005 units per pixel is small
- size = 20.0f;
- else if (size > 255.0f) // game has a max of 255
- size = 255.0f;
+ int size = std::atoi(args[1]);
+ if (size < EW_HUDSIZE_MIN || size > EW_HUDSIZE_MAX || size % 5 != 0)
+ {
+ ClientPrint(player, HUD_PRINTTALK, EW_PREFIX "Hud size must be a multiple of 5 between \x04%d - %d", EW_HUDSIZE_MIN, EW_HUDSIZE_MAX);
+ ClientPrint(player, HUD_PRINTTALK, EW_PREFIX "Usage: !hudsize ");
+ return;
+ }
- ClientPrint(player, HUD_PRINTTALK, EW_PREFIX "Hud font size set to:\x04 %.2f", size);
+ ClientPrint(player, HUD_PRINTTALK, EW_PREFIX "Hud size set to:\x04 %d%%", size);
zpPlayer->SetEntwatchHudSize(size);
}
diff --git a/src/entwatch.h b/src/entwatch.h
index 1526bb2f..b84c0fb7 100644
--- a/src/entwatch.h
+++ b/src/entwatch.h
@@ -30,25 +30,45 @@ using ordered_json = nlohmann::ordered_json;
class CCSPlayerController;
class CCSPlayerPawn;
+class CCSCustomHudLayout;
+class ZEPlayer;
extern CConVar g_cvarEnableEntWatch;
extern CConVar g_cvarEnableEntwatchHud;
#define EW_PREFIX " \4[EntWatch]\1 "
-#define EW_PREF_HUD_MODE "entwatch_hud"
-#define EW_PREF_HUDPOS_X "entwatch_hudpos_x"
-#define EW_PREF_HUDPOS_Y "entwatch_hudpos_y"
-#define EW_PREF_HUDCOLOR "entwatch_hudcolor"
-#define EW_PREF_HUDSIZE "entwatch_hudfontsize"
-
-#define EW_HUDPOS_X_DEFAULT -7.5f
-#define EW_HUDPOS_Y_DEFAULT -2.0f
-
-#define EW_HUDSIZE_DEFAULT 60.0f
+#define EW_PREF_HUD_MODE "entwatch_pano_hud"
+#define EW_PREF_HUD_PLAYERNAMES "entwatch_pano_hud_playernames"
+#define EW_PREF_HUDPOS_X "entwatch_pano_hudpos_x"
+#define EW_PREF_HUDPOS_Y "entwatch_pano_hudpos_y"
+#define EW_PREF_HUDCOLOR "entwatch_pano_hudcolor"
+#define EW_PREF_HUDSIZE "entwatch_pano_hudsize"
+
+#define EW_HUDPOS_X_CLASS "HudPosX"
+#define EW_HUDPOS_Y_CLASS "HudPosY"
+#define EW_HUDPOS_X_DEFAULT 6
+#define EW_HUDPOS_Y_DEFAULT 35
+#define EW_HUDPOS_MIN 0
+#define EW_HUDPOS_MAX 99
+
+#define EW_HUDSIZE_CLASS "Scale-"
+#define EW_HUDSIZE_DEFAULT 100
+#define EW_HUDSIZE_MIN 50
+#define EW_HUDSIZE_MAX 150
+
+#define EW_MAX_HUDCOLORS 20
+#define EW_HUDCOLOR_CLASS "HudColour-"
+#define EW_HUDCOLOR_DEFAULT 0
#define EW_HUD_TICKRATE 0.5f
+#define EW_HUD_MAXITEMS 64 // Number of items defined in entwatch_hud.xml
+#define EW_HUD_STATE_ID "ItemState-"
+#define EW_HUD_NAME_ID "ItemName-"
+#define EW_HUD_PLAYER_ID "ItemPlayer-"
+#define EW_HUDCOLOR_SHADOW "HudColourShadow-"
+
enum EWHandlerType
{
Type_None,
@@ -78,13 +98,6 @@ enum EWDropReason
Deleted
};
-enum EWHudMode
-{
- Hud_None,
- Hud_On,
- Hud_ItemOnly,
-};
-
enum EWAutoConfigOption
{
EWCfg_Auto = -1,
@@ -142,6 +155,7 @@ struct EWItem
std::string szHammerid; /* Hammerid of the weapon */
char sChatColor[2];
Color colorGlow;
+ int iHudColor; /* Color for hud css class */
bool bShowPickup; /* Whether to show pickup/drop messages in chat */
bool bShowHud; /* Whether to show this item on hud/scoreboard */
EWAutoConfigOption transfer; /* Can this item be transferred */
@@ -253,6 +267,7 @@ class CEWHandler
void PrintLoadedConfig(CCSPlayerController* pController);
void ClearItems();
+ void ClearHud();
int FindItemInstanceByWeapon(int iWeaponEnt);
int FindItemInstanceByOwner(int iOwnerSlot, bool bOnlyTransferrable, int iStartItem);
@@ -274,6 +289,9 @@ class CEWHandler
void RemoveUseEntity(CBaseEntity* pEnt);
KHook::Return Hook_Use(CBaseEntity* pThis, InputData_t* pInput);
+ void ShowHudMenu(CCSPlayerController* pController, ZEPlayer* zpPlayer);
+ float UpdateHud();
+
std::map> mapItemConfig; /* items defined in the config */
std::vector> vecItems; /* all items found spawned */
@@ -286,6 +304,13 @@ class CEWHandler
std::map> mapTransfers; // Any etransfers that target multiple items
std::vector> vecActiveTransfers; // Active transfers where only the receiver can pickup the weapon
+ CHandle hHud;
+ CHandle hHudSettings;
+ int iItemsOnHudLastTick = 0;
+ int iItemColors[EW_HUD_MAXITEMS] = {};
+ bool bPlayerNames[MAX_PLAYERS] = {true};
+ bool bClientHudInitialized[MAX_PLAYERS] = {};
+
KHook::Virtual m_hBaseButtonUse;
KHook::Virtual m_hPhysBoxUse;
KHook::Virtual m_hRotButtonUse;
@@ -317,4 +342,3 @@ void EW_PlayerDeathPre(CCSPlayerController* pController);
void EW_PlayerDisconnect(int slot);
void EW_FireOutput(const CEntityIOOutput* pThis, CEntityInstance* pActivator, CEntityInstance* pCaller, float flDelay);
int GetTemplateSuffixNumber(const char* szName);
-float EW_UpdateHud();
\ No newline at end of file
diff --git a/src/events.cpp b/src/events.cpp
index e64cec2c..1828be37 100644
--- a/src/events.cpp
+++ b/src/events.cpp
@@ -93,6 +93,27 @@ GAME_EVENT_F(player_team)
pEvent->SetBool("silent", true);
}
+GAME_EVENT_F(player_connect_full)
+{
+ CCSPlayerController* pController = (CCSPlayerController*)pEvent->GetPlayerController("userid");
+ if (!pController)
+ return;
+
+ CHandle hController = pController->GetHandle();
+
+ // custom_hud_layout entities clear the new controller's slot during this event.
+ CTimer::Create(0.0f, TIMERFLAG_MAP, [hController]() {
+ CCSPlayerController* pController = hController.Get();
+ if (!pController)
+ return -1.0f;
+
+ if (g_pEWHandler)
+ g_pEWHandler->bClientHudInitialized[pController->GetPlayerSlot()] = false;
+
+ return -1.0f;
+ });
+}
+
CConVar g_cvarNoblock("cs2f_noblock_enable", FCVAR_NONE, "Whether to use player noblock, which sets debris collision on every player", false);
CConVar g_cvarFreeArmor("cs2f_free_armor", FCVAR_NONE, "Whether kevlar (1+) and/or helmet (2) are given automatically", 0, true, 0, true, 2);
diff --git a/src/playermanager.cpp b/src/playermanager.cpp
index 0b4dfb63..04d8f53b 100644
--- a/src/playermanager.cpp
+++ b/src/playermanager.cpp
@@ -26,6 +26,7 @@
#include "engine2/ivengineserver2.h"
#include "engine2/serversideclient.h"
#include "entity/ccsplayercontroller.h"
+#include "entity/customhudlayout.h"
#include "entwatch.h"
#include "leader.h"
#include "map_votes.h"
@@ -100,16 +101,6 @@ ZEPlayer* ZEPlayerHandle::Get() const
void ZEPlayer::OnSpawn()
{
SetSpeedMod(1.f);
-
- ZEPlayerHandle handle = GetHandle();
- CTimer::Create(0.0f, TIMERFLAG_MAP | TIMERFLAG_ROUND, [handle] {
- if (handle.Get())
- {
- handle.Get()->CreatePointOrient();
- handle.Get()->CreateEntwatchHud();
- }
- return -1.0f;
- });
}
void ZEPlayer::OnAuthenticated()
@@ -623,39 +614,6 @@ void ZEPlayer::ReplicateConVar(const char* pszName, const char* pszValue)
delete data;
}
-void ZEPlayer::CreatePointOrient()
-{
- CPointOrient* pOrient = GetPointOrient();
- if (pOrient)
- {
- pOrient->Remove();
- pOrient = nullptr;
- }
-
- CCSPlayerController* pController = CCSPlayerController::FromSlot(GetPlayerSlot());
- if (!pController)
- return;
-
- CCSPlayerPawn* pPawn = pController->GetPlayerPawn();
- if (!pPawn)
- return;
-
- Vector origin = pPawn->GetEyePosition();
- CEntityKeyValues* pKeyValues = g_pEntitySystem->CreateEntityKeyValues(nullptr, &origin);
-
- pKeyValues->SetInt("start_active", 1);
- pKeyValues->SetString("goal_direction_type", "eEyesForward");
-
- pOrient = g_pEntitySystem->SpawnEntityByClassname("point_orient", pKeyValues);
-
- if (!pOrient)
- return;
-
- SetPointOrient(pOrient);
- pOrient->AcceptInput("SetParent", "!activator", pPawn);
- pOrient->AcceptInput("SetTarget", "!activator", pPawn);
-}
-
void ZEPlayer::ToggleThirdPerson(float flDistance, bool bForce)
{
CCSPlayerController* pController = CCSPlayerController::FromSlot(GetPlayerSlot());
@@ -741,126 +699,124 @@ void ZEPlayer::ToggleThirdPerson(float flDistance, bool bForce)
ClientPrint(pController, HUD_PRINTTALK, CHAT_PREFIX "You have enabled thirdperson.");
}
-void ZEPlayer::CreateEntwatchHud()
+void ZEPlayer::SetEntwatchHudEnabled(bool bEnabled)
{
+ m_bEntwatchHud = bEnabled;
+ g_pUserPreferencesSystem->SetPreferenceInt(m_slot.Get(), EW_PREF_HUD_MODE, m_bEntwatchHud ? 1 : 0);
+
CCSPlayerController* pController = CCSPlayerController::FromSlot(GetPlayerSlot());
- if (!pController)
- return;
+ if (pController)
+ {
+ if (g_pEWHandler->hHud.Get())
+ g_pEWHandler->hHud->SetHasClass("HudTextPanel", "Hidden", !m_bEntwatchHud, pController);
- CCSPlayerPawn* pPawn = pController->GetPlayerPawn();
- if (!pPawn)
- return;
+ if (g_pEWHandler->hHudSettings.Get())
+ g_pEWHandler->hHudSettings->SetHasClass("ToggleEntWatchHud", "Selected", m_bEntwatchHud, pController);
+ }
+}
- CPointOrient* pOrient = GetPointOrient();
- if (!pOrient)
- return;
+void ZEPlayer::SetEntwatchPlayerNames(bool bEnabled)
+{
+ m_bEntwatchPlayerNames = bEnabled;
+ g_pUserPreferencesSystem->SetPreferenceInt(m_slot.Get(), EW_PREF_HUD_PLAYERNAMES, m_bEntwatchPlayerNames ? 1 : 0);
- CPointWorldText* pText = GetEntwatchHud();
- if (pText)
+ CCSPlayerController* pController = CCSPlayerController::FromSlot(GetPlayerSlot());
+ if (pController)
{
- pText->Remove();
- pText = nullptr;
+ if (g_pEWHandler->hHudSettings.Get())
+ g_pEWHandler->hHudSettings->SetHasClass("TogglePlayerNames", "Selected", m_bEntwatchPlayerNames, pController);
}
+}
- Color col;
- CEntityKeyValues* pKeyValues = g_pEntitySystem->CreateEntityKeyValues();
-
- int a = m_colorEntwatchHud.a();
- if (a == 255) // 254 allows it to be visible through some items
- col.SetColor(m_colorEntwatchHud.r(), m_colorEntwatchHud.g(), m_colorEntwatchHud.b(), 254);
- else
- col.SetColor(m_colorEntwatchHud.r(), m_colorEntwatchHud.g(), m_colorEntwatchHud.b(), a);
-
- pKeyValues->SetBool("enabled", true);
- pKeyValues->SetBool("fullbright", true);
- pKeyValues->SetFloat("font_size", GetEntwatchHudSize());
- pKeyValues->SetColor("color", col);
- pKeyValues->SetFloat("world_units_per_pixel", 0.005f);
- pKeyValues->SetString("font_name", "Verdana Bold");
- pKeyValues->SetInt("justify_vertical", (int)PointWorldTextJustifyVertical_t::POINT_WORLD_TEXT_JUSTIFY_VERTICAL_TOP);
- pKeyValues->SetString("message", "");
-
- pText = g_pEntitySystem->SpawnEntityByClassname("point_worldtext", pKeyValues);
-
- if (!pText)
- return;
-
- SetEntwatchHud(pText);
- pText->SetParent(pOrient);
-
- Vector origin = pOrient->GetAbsOrigin();
- QAngle vmangles = pOrient->GetAbsRotation();
-
- Vector forward;
- Vector right;
- Vector up;
- AngleVectors(vmangles, &forward, &right, &up);
-
- origin += (forward * 7.0f);
-
- // -x = move left, +x = move right
- origin += (right * GetEntwatchHudX());
+void ZEPlayer::SetEntwatchHudColor(int iColorIndex)
+{
+ const std::string sOldColor = std::to_string(m_iEntwatchColor);
+ const std::string sNewColor = std::to_string(iColorIndex);
- // -y = move up, +y = move down
- origin -= (up * GetEntwatchHudY());
+ // Remove old
+ CCSPlayerController* pController = CCSPlayerController::FromSlot(GetPlayerSlot());
+ if (pController)
+ {
+ std::string sOldText = "ColorPanel-" + sOldColor;
+ std::string sNewText = "ColorPanel-" + sNewColor;
+ if (g_pEWHandler->hHudSettings.Get())
+ {
+ g_pEWHandler->hHudSettings->SetHasClass(sOldText, "Selected", false, pController);
+ g_pEWHandler->hHudSettings->SetHasClass(sNewText, "Selected", true, pController);
+ }
- QAngle angles;
- angles.x = 0.0f;
- angles.y = AngleNormalize(vmangles.y - 90.0f);
- angles.z = AngleNormalize(-vmangles.x + 90.0f);
+ if (g_pEWHandler->hHud.Get())
+ {
+ sOldText = EW_HUDCOLOR_CLASS + sOldColor;
+ sNewText = EW_HUDCOLOR_CLASS + sNewColor;
- pText->Teleport(&origin, &angles, nullptr);
-}
+ g_pEWHandler->hHud->SetHasClass("ItemNamesColumn", sOldText, false, pController);
+ g_pEWHandler->hHud->SetHasClass("ItemNamesColumn", sNewText, true, pController);
+ }
+ }
-int ZEPlayer::GetEntwatchHudMode()
-{
- if (IsFakeClient())
- return 0;
- return m_iEntwatchHudMode;
+ m_iEntwatchColor = iColorIndex;
+ g_pUserPreferencesSystem->SetPreferenceInt(m_slot.Get(), EW_PREF_HUDCOLOR, m_iEntwatchColor);
}
-void ZEPlayer::SetEntwatchHudMode(int iMode)
+void ZEPlayer::SetEntwatchHudPos(int x, int y)
{
- m_iEntwatchHudMode = iMode;
- g_pUserPreferencesSystem->SetPreferenceInt(m_slot.Get(), EW_PREF_HUD_MODE, m_iEntwatchHudMode);
-}
+ const std::string sNewX = std::to_string(x);
+ const std::string sNewY = std::to_string(y);
+ std::string oldx = EW_HUDPOS_X_CLASS + std::to_string(m_iEntwatchHudX);
+ std::string oldy = EW_HUDPOS_Y_CLASS + std::to_string(m_iEntwatchHudY);
+ std::string newx = EW_HUDPOS_X_CLASS + sNewX;
+ std::string newy = EW_HUDPOS_Y_CLASS + sNewY;
+ // Remove old
+ CCSPlayerController* pController = CCSPlayerController::FromSlot(GetPlayerSlot());
+ if (pController)
+ {
+ if (g_pEWHandler->hHud.Get())
+ {
+ g_pEWHandler->hHud->SetHasClass("HudTextPanel", oldx, false, pController);
+ g_pEWHandler->hHud->SetHasClass("HudTextPanel", oldy, false, pController);
-void ZEPlayer::SetEntwatchHudColor(Color colorHud)
-{
- m_colorEntwatchHud = colorHud;
- std::string strColor = std::to_string(colorHud.r()) + " " + std::to_string(colorHud.g()) + " " + std::to_string(colorHud.b()) + " " + std::to_string(colorHud.a());
- g_pUserPreferencesSystem->SetPreference(m_slot.Get(), EW_PREF_HUDCOLOR, strColor.c_str());
+ g_pEWHandler->hHud->SetHasClass("HudTextPanel", newx, true, pController);
+ g_pEWHandler->hHud->SetHasClass("HudTextPanel", newy, true, pController);
+ }
- CPointWorldText* pText = GetEntwatchHud();
- if (pText)
- {
- Color c;
- if (colorHud.a() == 255)
- c.SetColor(colorHud.r(), colorHud.g(), colorHud.b(), 254);
- else
- c = colorHud;
- pText->m_Color = c;
+ if (g_pEWHandler->hHudSettings.Get())
+ {
+ g_pEWHandler->hHudSettings->SetDialogVariableString("HudPosXValue", "HudPosX", sNewX, pController);
+ g_pEWHandler->hHudSettings->SetDialogVariableString("HudPosYValue", "HudPosY", sNewY, pController);
+ }
}
+
+ m_iEntwatchHudX = x;
+ m_iEntwatchHudY = y;
+ g_pUserPreferencesSystem->SetPreferenceInt(m_slot.Get(), EW_PREF_HUDPOS_X, m_iEntwatchHudX);
+ g_pUserPreferencesSystem->SetPreferenceInt(m_slot.Get(), EW_PREF_HUDPOS_Y, m_iEntwatchHudY);
}
-void ZEPlayer::SetEntwatchHudPos(float x, float y)
+void ZEPlayer::SetEntwatchHudSize(int iSize)
{
- m_flEntwatchHudX = x;
- m_flEntwatchHudY = y;
- g_pUserPreferencesSystem->SetPreferenceFloat(m_slot.Get(), EW_PREF_HUDPOS_X, m_flEntwatchHudX);
- g_pUserPreferencesSystem->SetPreferenceFloat(m_slot.Get(), EW_PREF_HUDPOS_Y, m_flEntwatchHudY);
+ const std::string sOldSize = std::to_string(m_iEntwatchHudSize);
+ const std::string sNewSize = std::to_string(iSize);
- CreateEntwatchHud();
-}
+ CCSPlayerController* pController = CCSPlayerController::FromSlot(GetPlayerSlot());
+ if (pController)
+ {
+ std::string oldText = EW_HUDSIZE_CLASS + sOldSize;
+ std::string newText = EW_HUDSIZE_CLASS + sNewSize;
+ // Remove old
+ if (g_pEWHandler->hHud.Get())
+ {
+ g_pEWHandler->hHud->SetHasClass("HudTextPanel", oldText, false, pController);
+ g_pEWHandler->hHud->SetHasClass("HudTextPanel", newText, true, pController);
+ }
-void ZEPlayer::SetEntwatchHudSize(float flSize)
-{
- m_flEntwatchHudSize = flSize;
- g_pUserPreferencesSystem->SetPreferenceFloat(m_slot.Get(), EW_PREF_HUDSIZE, m_flEntwatchHudSize);
+ // Set settings menu text
+ if (g_pEWHandler->hHudSettings.Get())
+ g_pEWHandler->hHudSettings->SetDialogVariableString("HudSizeValue", "Scale", sNewSize, pController);
+ }
- CPointWorldText* pText = GetEntwatchHud();
- if (pText)
- pText->m_flFontSize = m_flEntwatchHudSize;
+ m_iEntwatchHudSize = iSize;
+ g_pUserPreferencesSystem->SetPreferenceInt(m_slot.Get(), EW_PREF_HUDSIZE, m_iEntwatchHudSize);
}
void CPlayerManager::OnBotConnected(CPlayerSlot slot)
@@ -1184,21 +1140,6 @@ void CPlayerManager::UpdatePlayerStates()
pPlayer->SetPlayerState(iCurrentPlayerState);
}
-
- // Update entwatch hud position
- if (g_cvarEnableEntWatch.Get() && g_cvarEnableEntwatchHud.Get())
- {
- CCSPlayerPawn* pPawn = pController->GetPlayerPawn();
- if (!pPawn)
- continue;
-
- CPointOrient* pOrient = pPlayer->GetPointOrient();
- if (pOrient)
- {
- Vector origin = pPawn->GetEyePosition();
- pOrient->Teleport(&origin, nullptr, nullptr);
- }
- }
}
}
diff --git a/src/playermanager.h b/src/playermanager.h
index 9753fec7..8f490709 100644
--- a/src/playermanager.h
+++ b/src/playermanager.h
@@ -20,8 +20,6 @@
#pragma once
#include "common.h"
#include "entity/cparticlesystem.h"
-#include "entity/cpointorient.h"
-#include "entity/cpointworldtext.h"
#include "entity/customplayercamera.h"
#include "entity/lights.h"
#include "gamesystem.h"
@@ -197,11 +195,12 @@ class ZEPlayer
m_pActiveZRClass = nullptr;
m_pActiveZRModel = nullptr;
m_iButtonWatchMode = 0;
- m_iEntwatchHudMode = 0;
- m_colorEntwatchHud = Color(255, 255, 255, 255);
- m_flEntwatchHudX = -7.5f;
- m_flEntwatchHudY = -2.0f;
- m_flEntwatchHudSize = 60.0f;
+ m_bEntwatchHud = false;
+ m_bEntwatchPlayerNames = true;
+ m_iEntwatchColor = 0;
+ m_iEntwatchHudX = 6;
+ m_iEntwatchHudY = 35;
+ m_iEntwatchHudSize = 100;
m_bTopDefender = false;
m_flLastVoiceTime = -15.0f;
m_flBeaconEnabledTime = -2.0f;
@@ -270,12 +269,11 @@ class ZEPlayer
void ReplicateConVar(const char* pszName, const char* pszValue);
void SetActiveZRClass(std::shared_ptr pZRModel) { m_pActiveZRClass = pZRModel; }
void SetActiveZRModel(std::shared_ptr pZRClass) { m_pActiveZRModel = pZRClass; }
- void SetEntwatchHudMode(int iMode);
- void SetPointOrient(CPointOrient* pOrient) { m_hPointOrient.Set(pOrient); }
- void SetEntwatchHud(CPointWorldText* pWorldText) { m_hEntwatchHud.Set(pWorldText); }
- void SetEntwatchHudColor(Color colorHud);
- void SetEntwatchHudPos(float x, float y);
- void SetEntwatchHudSize(float flSize);
+ void SetEntwatchHudEnabled(bool bEnabled);
+ void SetEntwatchPlayerNames(bool bEnabled);
+ void SetEntwatchHudColor(int iColorIndex);
+ void SetEntwatchHudPos(int x, int y);
+ void SetEntwatchHudSize(int iSize);
void SetTopDefenderStatus(bool bStatus) { m_bTopDefender = bStatus; }
void SetLastVoiceTime(float flTime) { m_flLastVoiceTime = flTime; }
void SetBeaconEnabledTime(float flTime) { m_flBeaconEnabledTime = flTime; }
@@ -326,13 +324,12 @@ class ZEPlayer
std::shared_ptr GetActiveZRClass() { return m_pActiveZRClass; }
std::shared_ptr GetActiveZRModel() { return m_pActiveZRModel; }
int GetButtonWatchMode();
- int GetEntwatchHudMode();
- CPointOrient* GetPointOrient() { return m_hPointOrient.Get(); }
- CPointWorldText* GetEntwatchHud() { return m_hEntwatchHud.Get(); }
- Color GetEntwatchHudColor() { return m_colorEntwatchHud; }
- float GetEntwatchHudX() { return m_flEntwatchHudX; }
- float GetEntwatchHudY() { return m_flEntwatchHudY; }
- float GetEntwatchHudSize() { return m_flEntwatchHudSize; }
+ bool GetEntwatchHudEnabled() { return m_bEntwatchHud; }
+ bool GetEntwatchPlayerNames() { return m_bEntwatchPlayerNames; }
+ int GetEntwatchHudColor() { return m_iEntwatchColor; }
+ int GetEntwatchHudX() { return m_iEntwatchHudX; }
+ int GetEntwatchHudY() { return m_iEntwatchHudY; }
+ int GetEntwatchHudSize() { return m_iEntwatchHudSize; }
bool GetTopDefenderStatus() { return m_bTopDefender; }
float GetLastVoiceTime() { return m_flLastVoiceTime; }
float GetBeaconEnabledTime() { return m_flBeaconEnabledTime; }
@@ -352,8 +349,6 @@ class ZEPlayer
void StartGlow(Color color, int duration);
void EndGlow();
void SetSteamIdAttribute();
- void CreateEntwatchHud();
- void CreatePointOrient();
void ToggleThirdPerson(float flDistance = -65.f, bool bForce = false);
private:
@@ -405,14 +400,13 @@ class ZEPlayer
std::shared_ptr m_pActiveZRClass;
std::shared_ptr m_pActiveZRModel;
int m_iButtonWatchMode;
- CHandle m_hPointOrient;
- CHandle m_hEntwatchHud;
CHandle m_hCustomCamera;
- int m_iEntwatchHudMode;
- Color m_colorEntwatchHud;
- float m_flEntwatchHudX;
- float m_flEntwatchHudY;
- float m_flEntwatchHudSize;
+ bool m_bEntwatchHud;
+ bool m_bEntwatchPlayerNames;
+ int m_iEntwatchColor;
+ int m_iEntwatchHudX;
+ int m_iEntwatchHudY;
+ int m_iEntwatchHudSize;
bool m_bTopDefender;
float m_flLastVoiceTime;
float m_flBeaconEnabledTime;
diff --git a/src/user_preferences.cpp b/src/user_preferences.cpp
index bb694e16..36c4ffee 100644
--- a/src/user_preferences.cpp
+++ b/src/user_preferences.cpp
@@ -116,12 +116,12 @@ void CUserPreferencesSystem::OnPutPreferences(int iSlot)
int iZSounds = GetPreferenceInt(iSlot, ZSOUNDS_PREF_KEY_NAME, (int)EZSoundsType::ON);
// EntWatch
- int iEntwatchMode = GetPreferenceInt(iSlot, EW_PREF_HUD_MODE, 0);
- float flEntwatchHudposX = GetPreferenceFloat(iSlot, EW_PREF_HUDPOS_X, EW_HUDPOS_X_DEFAULT);
- float flEntwatchHudposY = GetPreferenceFloat(iSlot, EW_PREF_HUDPOS_Y, EW_HUDPOS_Y_DEFAULT);
- Color ewHudColor;
- V_StringToColor(g_pUserPreferencesSystem->GetPreference(iSlot, EW_PREF_HUDCOLOR, "255 255 255 255"), ewHudColor);
- float flEntwatchHudSize = GetPreferenceFloat(iSlot, EW_PREF_HUDSIZE, EW_HUDSIZE_DEFAULT);
+ bool bEntwatchEnabled = (bool)GetPreferenceInt(iSlot, EW_PREF_HUD_MODE, 0);
+ bool bEntwatchPlayerNames = (bool)GetPreferenceInt(iSlot, EW_PREF_HUD_PLAYERNAMES, 1);
+ int iEntwatchHudposX = GetPreferenceInt(iSlot, EW_PREF_HUDPOS_X, EW_HUDPOS_X_DEFAULT);
+ int iEntwatchHudposY = GetPreferenceInt(iSlot, EW_PREF_HUDPOS_Y, EW_HUDPOS_Y_DEFAULT);
+ int iEntwatchColor = GetPreferenceInt(iSlot, EW_PREF_HUDCOLOR, EW_HUDCOLOR_DEFAULT);
+ int iEntwatchSize = GetPreferenceInt(iSlot, EW_PREF_HUDSIZE, EW_HUDSIZE_DEFAULT);
// Set the values that we just loaded --- the player is guaranteed available
g_playerManager->SetPlayerStopSound(iSlot, bStopSound);
@@ -136,10 +136,11 @@ void CUserPreferencesSystem::OnPutPreferences(int iSlot)
player->CycleButtonWatch();
// Set EntWatch
- player->SetEntwatchHudMode(iEntwatchMode);
- player->SetEntwatchHudPos(flEntwatchHudposX, flEntwatchHudposY);
- player->SetEntwatchHudColor(ewHudColor);
- player->SetEntwatchHudSize(flEntwatchHudSize);
+ player->SetEntwatchHudEnabled(bEntwatchEnabled);
+ player->SetEntwatchPlayerNames(bEntwatchPlayerNames);
+ player->SetEntwatchHudPos(iEntwatchHudposX, iEntwatchHudposY);
+ player->SetEntwatchHudColor(iEntwatchColor);
+ player->SetEntwatchHudSize(iEntwatchSize);
}
void CUserPreferencesSystem::PullPreferences(int iSlot)
diff --git a/src/virtual_hooks.cpp b/src/virtual_hooks.cpp
index 9a31db85..8035ce4f 100644
--- a/src/virtual_hooks.cpp
+++ b/src/virtual_hooks.cpp
@@ -708,14 +708,6 @@ KHook::Return Hook_CheckTransmit_Post(ISource2GameEntities* pThis, CCheckT
if (!g_cvarFlashLightTransmitOthers.Get() && pFlashLight)
pInfo->m_pTransmitEntity->Clear(pFlashLight->entindex());
- if (g_cvarEnableEntWatch.Get() && g_pEWHandler->IsConfigLoaded())
- {
- // Don't transmit other players' entwatch hud
- CPointWorldText* pHud = pController->IsConnected() ? g_playerManager->GetPlayer(j)->GetEntwatchHud() : nullptr;
- if (pHud)
- pInfo->m_pTransmitEntity->Clear(pHud->entindex());
- }
-
// Always transmit other players if spectating
if (!g_cvarEnableHide.Get() || pSelfController->GetPawnState() == STATE_OBSERVER_MODE)
continue;