diff options
Diffstat (limited to 'src/studio.cpp')
| -rw-r--r-- | src/studio.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/studio.cpp b/src/studio.cpp index e667c4b..f67936c 100644 --- a/src/studio.cpp +++ b/src/studio.cpp | |||
| @@ -201,10 +201,11 @@ int g_chams_mat_idx = -1; | |||
| 201 | 201 | ||
| 202 | const char *chams_material_name(int idx) { | 202 | const char *chams_material_name(int idx) { |
| 203 | switch (idx) { | 203 | switch (idx) { |
| 204 | case 1: return "debug/debugwireframevertexcolorignorez"; | 204 | case 1: return "debug/debugwireframe"; |
| 205 | case 2: return "vgui/white_additive"; | 205 | case 2: return "debug/additivevertexcolorvertexalpha"; |
| 206 | case 3: return "debug/debugtranslucentsinglecolor"; | 206 | case 3: return "debug/debugtranslucentsinglecolor"; |
| 207 | case 4: return "vgui/white"; | 207 | case 4: return "debug/debugtranslucentvertexcolor"; |
| 208 | case 5: return "debug/debugmrmfullbright2"; | ||
| 208 | default: return "models/debug/debugwhite"; | 209 | default: return "models/debug/debugwhite"; |
| 209 | } | 210 | } |
| 210 | } | 211 | } |
| @@ -212,17 +213,26 @@ const char *chams_material_name(int idx) { | |||
| 212 | void *chams_material() { | 213 | void *chams_material() { |
| 213 | int idx = g_chams_mat_index; | 214 | int idx = g_chams_mat_index; |
| 214 | if (idx < 0) idx = 0; | 215 | if (idx < 0) idx = 0; |
| 215 | if (idx > 4) idx = 4; | 216 | if (idx > 5) idx = 5; |
| 216 | if (g_chams_mat && g_chams_mat_idx == idx) | 217 | if (g_chams_mat && g_chams_mat_idx == idx) |
| 217 | return g_chams_mat; | 218 | return g_chams_mat; |
| 218 | g_chams_mat = world_find_material(chams_material_name(idx)); | 219 | g_chams_mat = world_find_material(chams_material_name(idx)); |
| 219 | if (!g_chams_mat) | 220 | if (!g_chams_mat) |
| 220 | g_chams_mat = world_find_material("models/debug/debugwhite"); | 221 | g_chams_mat = world_find_material("debug/debugtranslucentsinglecolor"); |
| 221 | g_chams_mat_idx = idx; | 222 | g_chams_mat_idx = idx; |
| 222 | logf("chams: style %d -> %p", idx, g_chams_mat); | 223 | logf("chams: style %d -> %p", idx, g_chams_mat); |
| 223 | return g_chams_mat; | 224 | return g_chams_mat; |
| 224 | } | 225 | } |
| 225 | 226 | ||
| 227 | // Viewmodels need a model shader; the VGUI white materials used by some | ||
| 228 | // styles do not draw skinned models and make the hands/weapon disappear. | ||
| 229 | void *viewmodel_material() { | ||
| 230 | static void *mat = nullptr; | ||
| 231 | if (!mat) | ||
| 232 | mat = world_find_material("debug/debugtranslucentsinglecolor"); | ||
| 233 | return mat; | ||
| 234 | } | ||
| 235 | |||
| 226 | void chams_color(void *mat, float r, float g, float b) { | 236 | void chams_color(void *mat, float r, float g, float b) { |
| 227 | using ColorFn = void (*)(void *, float, float, float); | 237 | using ColorFn = void (*)(void *, float, float, float); |
| 228 | using FindVarFn = void *(*)(void *, const char *, bool *, bool); | 238 | using FindVarFn = void *(*)(void *, const char *, bool *, bool); |
| @@ -257,7 +267,7 @@ void hkdModelExecute(void *self, const void *state, const void *info, | |||
| 257 | bool is_npc = esp_is_npc_index(idx); | 267 | bool is_npc = esp_is_npc_index(idx); |
| 258 | bool is_vm = g_chams_viewmodel && esp_is_viewmodel_index(idx); | 268 | bool is_vm = g_chams_viewmodel && esp_is_viewmodel_index(idx); |
| 259 | if (is_npc || is_vm) { | 269 | if (is_npc || is_vm) { |
| 260 | void *mat = chams_material(); | 270 | void *mat = is_vm ? viewmodel_material() : chams_material(); |
| 261 | if (mat) { | 271 | if (mat) { |
| 262 | if (g_chams_walls && !is_vm) { | 272 | if (g_chams_walls && !is_vm) { |
| 263 | chams_apply(mat, true); | 273 | chams_apply(mat, true); |
