change map experiments

This commit is contained in:
m 2023-02-04 16:37:50 -06:00
parent 5c5c12d189
commit 2177d899d3

View File

@ -11,50 +11,16 @@
namespace experimental namespace experimental
{ {
namespace
{
const game::dvar_t* map_experiments = nullptr;
utils::hook::detour load_gfx_world_asset_hook;
void load_gfx_world_asset_stub(game::GfxWorld** gfx_world_ptr)
{
load_gfx_world_asset_hook.invoke<void>(gfx_world_ptr);
if (!map_experiments || !map_experiments->current.enabled)
{
return;
}
auto gfx_world = *gfx_world_ptr;
for (unsigned int i = 0; i < gfx_world->dpvs.smodelCount; ++i)
{
if ((gfx_world->dpvs.smodelDrawInsts[i].flags & 64) != 0) // STATIC_MODEL_FLAG_LIGHTGRID_LIGHTING
{
gfx_world->dpvs.smodelLighting[i].modelLightGridLightingInfo.colorFloat16[0] = 14340; // r: 0.4
gfx_world->dpvs.smodelLighting[i].modelLightGridLightingInfo.colorFloat16[1] = 14340; // g: 0.4
gfx_world->dpvs.smodelLighting[i].modelLightGridLightingInfo.colorFloat16[2] = 14340; // b: 0.4
gfx_world->dpvs.smodelLighting[i].modelLightGridLightingInfo.colorFloat16[3] = 14340; // a: 0.4
gfx_world->dpvs.smodelLighting[i].modelLightGridLightingInfo.a = 47280;
gfx_world->dpvs.smodelLighting[i].modelLightGridLightingInfo.b = 1.0f;
}
}
}
}
class component final : public component_interface class component final : public component_interface
{ {
public: public:
void post_unpack() override void post_unpack() override
{ {
// modify GfxWorld to use static model lighting // fix static model's lighting going black sometimes
load_gfx_world_asset_hook.create(0x39C460_b, load_gfx_world_asset_stub); dvars::override::register_int("r_smodelInstancedThreshold", 0, 0, 128, 0x0);
scheduler::once([] // change minimum cap to -2000 instead of -1000 (culling issue)
{ dvars::override::register_int("r_lodBiasRigid", 0, -2000, 0, 0x0);
map_experiments = dvars::register_bool("map_experiments", 0, 0x0, "Toggle experimental map settings");
}, scheduler::main);
} }
}; };
} }