summaryrefslogtreecommitdiffstats
path: root/src/menu.cpp
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-11-04 18:08:07 +0100
committersalmonik <salmonik@tuta.io>2026-11-04 18:08:07 +0100
commitb3003583a1a66f5ae2eae63763f285635b43d58f (patch)
treed4d2e778a2265652befcc86fbaa8bf1f4fcb30c3 /src/menu.cpp
parentChams: quiet material lookup, accept any fallback by name (diff)
downloadhl2h-b3003583a1a66f5ae2eae63763f285635b43d58f.tar.gz
hl2h-b3003583a1a66f5ae2eae63763f285635b43d58f.zip
Chams: material styles and viewmodel support
- Material selector 0..4: debugwhite, debug wireframe (ignorez), vgui white_additive, debugtranslucentsinglecolor, vgui/white; cached per index with a debugwhite fallback. - Add "Viewmodel (hands/weapon)" toggle; viewmodel entities (class contains viewmodel or model path /v_...) get a normal-depth chams pass. - [chams] gains viewmodel= and material=.
Diffstat (limited to 'src/menu.cpp')
-rw-r--r--src/menu.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/menu.cpp b/src/menu.cpp
index 77eb35f..4f22d39 100644
--- a/src/menu.cpp
+++ b/src/menu.cpp
@@ -65,6 +65,8 @@ bool g_proj_fuse = true;
65bool g_proj_radius = true; 65bool g_proj_radius = true;
66FeatureState g_chams{false, 0}; // flat model material, optional through walls 66FeatureState g_chams{false, 0}; // flat model material, optional through walls
67bool g_chams_walls = true; 67bool g_chams_walls = true;
68bool g_chams_viewmodel = false;
69int g_chams_mat_index = 0;
68int g_chams_rgb[3] = {255, 60, 60}; 70int g_chams_rgb[3] = {255, 60, 60};
69bool g_item_health = true; 71bool g_item_health = true;
70bool g_item_ammo = true; 72bool g_item_ammo = true;
@@ -237,8 +239,10 @@ void config_save() {
237 fprintf(f, "[projectiles]\nactive=%d\nbind=%d\nfuse=%d\nradius=%d\n", 239 fprintf(f, "[projectiles]\nactive=%d\nbind=%d\nfuse=%d\nradius=%d\n",
238 g_projectiles.active, g_projectiles.bind, (int)g_proj_fuse, 240 g_projectiles.active, g_projectiles.bind, (int)g_proj_fuse,
239 (int)g_proj_radius); 241 (int)g_proj_radius);
240 fprintf(f, "[chams]\nactive=%d\nbind=%d\nwalls=%d\nr=%d\ng=%d\nb=%d\n", 242 fprintf(f, "[chams]\nactive=%d\nbind=%d\nwalls=%d\nviewmodel=%d\n"
241 g_chams.active, g_chams.bind, (int)g_chams_walls, g_chams_rgb[0], 243 "material=%d\nr=%d\ng=%d\nb=%d\n",
244 g_chams.active, g_chams.bind, (int)g_chams_walls,
245 (int)g_chams_viewmodel, g_chams_mat_index, g_chams_rgb[0],
242 g_chams_rgb[1], g_chams_rgb[2]); 246 g_chams_rgb[1], g_chams_rgb[2]);
243 fprintf(f, "[items]\nactive=%d\nbind=%d\nhealth=%d\nammo=%d\n" 247 fprintf(f, "[items]\nactive=%d\nbind=%d\nhealth=%d\nammo=%d\n"
244 "armor=%d\nweapons=%d\ncrates=%d\ndistance=%d\nmax_dist=%d\n" 248 "armor=%d\nweapons=%d\ncrates=%d\ndistance=%d\nmax_dist=%d\n"
@@ -393,8 +397,15 @@ static bool config_load() {
393 if (in_chams) { 397 if (in_chams) {
394 if (strcmp(key, "walls") == 0) 398 if (strcmp(key, "walls") == 0)
395 g_chams_walls = atoi(val) != 0; 399 g_chams_walls = atoi(val) != 0;
396 else if (strcmp(key, "r") == 0 || strcmp(key, "g") == 0 || 400 else if (strcmp(key, "viewmodel") == 0)
397 strcmp(key, "b") == 0) { 401 g_chams_viewmodel = atoi(val) != 0;
402 else if (strcmp(key, "material") == 0) {
403 int v = atoi(val);
404 if (v < 0) v = 0;
405 if (v > 4) v = 4;
406 g_chams_mat_index = v;
407 } else if (strcmp(key, "r") == 0 || strcmp(key, "g") == 0 ||
408 strcmp(key, "b") == 0) {
398 int v = atoi(val); 409 int v = atoi(val);
399 if (v < 0) v = 0; 410 if (v < 0) v = 0;
400 if (v > 255) v = 255; 411 if (v > 255) v = 255;
@@ -627,6 +638,8 @@ void config_reset_defaults() {
627 g_proj_radius = true; 638 g_proj_radius = true;
628 g_chams = {false, 0}; 639 g_chams = {false, 0};
629 g_chams_walls = true; 640 g_chams_walls = true;
641 g_chams_viewmodel = false;
642 g_chams_mat_index = 0;
630 g_chams_rgb[0] = 255; 643 g_chams_rgb[0] = 255;
631 g_chams_rgb[1] = 60; 644 g_chams_rgb[1] = 60;
632 g_chams_rgb[2] = 60; 645 g_chams_rgb[2] = 60;