diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/studio.cpp | 14 | ||||
| -rw-r--r-- | src/world.cpp | 6 |
2 files changed, 18 insertions, 2 deletions
diff --git a/src/studio.cpp b/src/studio.cpp index dd6f109..0c988dc 100644 --- a/src/studio.cpp +++ b/src/studio.cpp | |||
| @@ -33,6 +33,8 @@ DrawStaticFn g_orig_draw_static = nullptr; | |||
| 33 | bool g_install_tried = false; | 33 | bool g_install_tried = false; |
| 34 | bool g_installed = false; | 34 | bool g_installed = false; |
| 35 | int g_prop_depth = 0; | 35 | int g_prop_depth = 0; |
| 36 | int g_static_calls = 0; | ||
| 37 | int g_static_props = 0; | ||
| 36 | 38 | ||
| 37 | bool prop_tint_on() { | 39 | bool prop_tint_on() { |
| 38 | return feature_active(FEAT_WORLD_TINT) && g_tint_prop_on; | 40 | return feature_active(FEAT_WORLD_TINT) && g_tint_prop_on; |
| @@ -89,7 +91,17 @@ void hook_set_alpha(void *self, float alpha) { | |||
| 89 | 91 | ||
| 90 | void hook_draw_static_prop(void *self, void *info, void *model_to_world, | 92 | void hook_draw_static_prop(void *self, void *info, void *model_to_world, |
| 91 | int flags) { | 93 | int flags) { |
| 92 | bool prop = prop_tint_on() && is_prop_model(info_model_name(info)); | 94 | const char *model = info_model_name(info); |
| 95 | bool prop = prop_tint_on() && is_prop_model(model); | ||
| 96 | g_static_calls++; | ||
| 97 | if (prop) | ||
| 98 | g_static_props++; | ||
| 99 | if (g_static_calls <= 3) | ||
| 100 | logf("studio: static draw model=\"%s\" prop=%d", model ? model : "?", | ||
| 101 | (int)prop); | ||
| 102 | if (g_static_calls == 500) | ||
| 103 | logf("studio: static draws=%d prop_draws=%d", g_static_calls, | ||
| 104 | g_static_props); | ||
| 93 | if (prop) { | 105 | if (prop) { |
| 94 | // The engine may have set the modulation just before this call; override | 106 | // The engine may have set the modulation just before this call; override |
| 95 | // it here as well as from the SetColorModulation hook (the static-prop | 107 | // it here as well as from the SetColorModulation hook (the static-prop |
diff --git a/src/world.cpp b/src/world.cpp index 38d302f..0de86c6 100644 --- a/src/world.cpp +++ b/src/world.cpp | |||
| @@ -58,7 +58,11 @@ Tint g_applied{false, 255, 255, 255, 255, 255, 255, 255, 255, 255}; | |||
| 58 | // map prop lives under models/props*, which keeps NPC/player/weapon materials | 58 | // map prop lives under models/props*, which keeps NPC/player/weapon materials |
| 59 | // out of the prop pass. | 59 | // out of the prop pass. |
| 60 | bool is_prop_material(const char *name) { | 60 | bool is_prop_material(const char *name) { |
| 61 | return name && strncmp(name, "models/props", 12) == 0; | 61 | // Static props often use the brush-style "props/..." materials (e.g. |
| 62 | // props/woodcrate001a, LightmappedGeneric), while dynamic props use | ||
| 63 | // models/props_junk/... . | ||
| 64 | return name && (strncmp(name, "models/props", 12) == 0 || | ||
| 65 | strncmp(name, "props/", 6) == 0); | ||
| 62 | } | 66 | } |
| 63 | 67 | ||
| 64 | struct MatCalls { | 68 | struct MatCalls { |
