[Maps] Add r_disableModelWorkaround
This commit is contained in:
parent
deaf269808
commit
0a8f0e5f70
@ -535,22 +535,13 @@ namespace Components
|
|||||||
|
|
||||||
Maps::Maps()
|
Maps::Maps()
|
||||||
{
|
{
|
||||||
// Set AABBTree
|
|
||||||
//Utils::Hook::Nop(0x54A575, 2);
|
|
||||||
//Utils::Hook::Nop(0x54A589, 2);
|
|
||||||
//Utils::Hook::Set<WORD>(0x54A506, 0xE990);
|
|
||||||
|
|
||||||
// Reset while drawing
|
|
||||||
//Utils::Hook::Nop(0x542073, 4);
|
|
||||||
//Utils::Hook::Nop(0x54209B, 4);
|
|
||||||
//Utils::Hook::Nop(0x541FAB, 4);
|
|
||||||
|
|
||||||
// Reset dpvs
|
|
||||||
//Utils::Hook::Nop(0x5185A3, 5);
|
|
||||||
|
|
||||||
Dvar::OnInit([]()
|
Dvar::OnInit([]()
|
||||||
{
|
{
|
||||||
Dvar::Register<bool>("r_forceForwardModels", false, 0, "Force drawing all static models in front of the player");
|
bool value = false;
|
||||||
|
#ifdef DEBUG
|
||||||
|
value = true;
|
||||||
|
#endif
|
||||||
|
Dvar::Register<bool>("r_disableModelWorkaround", value, 0, "Disable static model drawing workaround for custom maps");
|
||||||
});
|
});
|
||||||
|
|
||||||
// Hook R_ClearDpvsSceneView to force drawing all models in front of us
|
// Hook R_ClearDpvsSceneView to force drawing all models in front of us
|
||||||
@ -559,7 +550,7 @@ namespace Components
|
|||||||
Utils::Hook::Call<void()>(0x518530)(); // R_ClearDpvsSceneView
|
Utils::Hook::Call<void()>(0x518530)(); // R_ClearDpvsSceneView
|
||||||
|
|
||||||
Game::GfxWorld*& gameWorld = *reinterpret_cast<Game::GfxWorld**>(0x66DEE94);
|
Game::GfxWorld*& gameWorld = *reinterpret_cast<Game::GfxWorld**>(0x66DEE94);
|
||||||
if (!Game::CL_IsCgameInitialized() || !gameWorld || !Dvar::Var("r_forceForwardModels").get<bool>()) return;
|
if (!Game::CL_IsCgameInitialized() || !gameWorld || Dvar::Var("r_disableModelWorkaround").get<bool>() || gameWorld->mapVtxChecksum != 0xDEADBEEF) return;
|
||||||
|
|
||||||
Game::vec3_t _forward, _right;
|
Game::vec3_t _forward, _right;
|
||||||
Game::AngleVectors(reinterpret_cast<float*>(0x85F650), _forward, _right, nullptr);
|
Game::AngleVectors(reinterpret_cast<float*>(0x85F650), _forward, _right, nullptr);
|
||||||
@ -575,9 +566,11 @@ namespace Components
|
|||||||
{
|
{
|
||||||
float* _origin = gameWorld->dpvs.smodelDrawInsts[i].placement.origin;
|
float* _origin = gameWorld->dpvs.smodelDrawInsts[i].placement.origin;
|
||||||
glm::vec2 modelOrigin(_origin[0], _origin[1]);
|
glm::vec2 modelOrigin(_origin[0], _origin[1]);
|
||||||
glm::mat2x2 matrix(right[0], -(forward[0]), right[1], -(forward[1]));
|
|
||||||
|
|
||||||
|
if ((selfOrigin - modelOrigin).length() <= gameWorld->dpvs.smodelDrawInsts[i].cullDist * 1.0f)
|
||||||
|
{
|
||||||
// If matrix is singular just draw the models
|
// If matrix is singular just draw the models
|
||||||
|
glm::mat2x2 matrix(right[0], -(forward[0]), right[1], -(forward[1]));
|
||||||
if (glm::determinant(matrix) != 0)
|
if (glm::determinant(matrix) != 0)
|
||||||
{
|
{
|
||||||
glm::mat2x2 invMatrix = glm::inverse(matrix);
|
glm::mat2x2 invMatrix = glm::inverse(matrix);
|
||||||
@ -593,13 +586,9 @@ namespace Components
|
|||||||
gameWorld->dpvs.smodelVisData[1][i] = 1;
|
gameWorld->dpvs.smodelVisData[1][i] = 1;
|
||||||
gameWorld->dpvs.smodelVisData[2][i] = 1;
|
gameWorld->dpvs.smodelVisData[2][i] = 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}, HOOK_CALL).install()->quick();
|
}, HOOK_CALL).install()->quick();
|
||||||
|
|
||||||
Command::Add("skipModel", [](Command::Params*)
|
|
||||||
{
|
|
||||||
Utils::Hook::Nop(0x541F02, 6);
|
|
||||||
});
|
|
||||||
|
|
||||||
Dvar::OnInit([] ()
|
Dvar::OnInit([] ()
|
||||||
{
|
{
|
||||||
Dvar::Register<bool>("isDlcInstalled_All", false, Game::DVAR_FLAG_USERCREATED | Game::DVAR_FLAG_WRITEPROTECTED, "");
|
Dvar::Register<bool>("isDlcInstalled_All", false, Game::DVAR_FLAG_USERCREATED | Game::DVAR_FLAG_WRITEPROTECTED, "");
|
||||||
|
@ -85,7 +85,7 @@ namespace Utils
|
|||||||
{
|
{
|
||||||
for (auto i = this->entities.begin(); i != this->entities.end();)
|
for (auto i = this->entities.begin(); i != this->entities.end();)
|
||||||
{
|
{
|
||||||
if (i->find("weaponinfo") != i->end())
|
if (i->find("weaponinfo") != i->end() || (i->find("targetname") != i->end() && (*i)["targetname"] == "oldschool_pickup"s))
|
||||||
{
|
{
|
||||||
if (!keepTurrets || i->find("classname") == i->end() || (*i)["classname"] != "misc_turret"s)
|
if (!keepTurrets || i->find("classname") == i->end() || (*i)["classname"] != "misc_turret"s)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user