From 66f5d26a2eba82fe154cd322ca092afdea625b08 Mon Sep 17 00:00:00 2001 From: "DEMONIZED-PC\\demonized" Date: Wed, 11 Dec 2024 18:42:24 +1000 Subject: [PATCH] * Fix of "Fail to detach scope from some weapons" (https://github.com/themrdemonized/xray-monolith/issues/114) --- README.md | 3 +++ src/xrGame/Weapon.cpp | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/README.md b/README.md index 50e99cc4..95961b85 100644 --- a/README.md +++ b/README.md @@ -184,6 +184,9 @@ How to compile exes: 6. For successful compilation, **the latest build tools with MFC and ATL libraries is required** ## Changelog +**2024.12.11** +* Fix of "Fail to detach scope from some weapons" (https://github.com/themrdemonized/xray-monolith/issues/114) + **2024.12.10** * momopate (https://github.com/themrdemonized/xray-monolith/pull/112): * Added console commands: diff --git a/src/xrGame/Weapon.cpp b/src/xrGame/Weapon.cpp index 6cdc4ba0..d1dd3bf8 100644 --- a/src/xrGame/Weapon.cpp +++ b/src/xrGame/Weapon.cpp @@ -68,6 +68,11 @@ float CWeapon::SDS_Radius(bool alt) { else { scope_tex_name = alt ? m_secondary_scope_tex_name : m_primary_scope_tex_name; + + // demonized: ugly hack to fix stuck scope texture on old scopes system + if (!READ_IF_EXISTS(pSettings, r_string, cNameSect(), "scope_texture", NULL)) { + scope_tex_name = NULL; + } } if (scope_tex_name != 0) { @@ -369,6 +374,11 @@ void CWeapon::UpdateUIScope() m_primary_scope_tex_name = READ_IF_EXISTS(pSettings, r_string, cNameSect(), "scope_texture", NULL); } scope_tex_name = m_primary_scope_tex_name; + + // demonized: ugly hack to fix stuck scope texture on old scopes system + if (!READ_IF_EXISTS(pSettings, r_string, cNameSect(), "scope_texture", NULL)) { + scope_tex_name = NULL; + } } } else if (m_zoomtype == 1)