mirror of
https://github.com/rei-2/Amalgam
synced 2026-10-10 12:53:10 +08:00
visual fixes
potentially fix crash while loading materials
This commit is contained in:
@@ -23,24 +23,15 @@ void CCore::Load()
|
||||
if (bUnload)
|
||||
return;
|
||||
|
||||
SDK::Output("Core", "SDK::GetTeamFortressWindow();", {}, false, false, false, true);
|
||||
SDK::GetTeamFortressWindow();
|
||||
SDK::Output("Core", "U::Signatures.Initialize();", {}, false, false, false, true);
|
||||
U::Signatures.Initialize();
|
||||
SDK::Output("Core", "U::Interfaces.Initialize();", {}, false, false, false, true);
|
||||
U::Interfaces.Initialize();
|
||||
SDK::Output("Core", "U::ConVars.Initialize();", {}, false, false, false, true);
|
||||
U::ConVars.Initialize();
|
||||
SDK::Output("Core", "F::Materials.LoadMaterials();", {}, false, false, false, true);
|
||||
F::Materials.LoadMaterials();
|
||||
SDK::Output("Core", "F::Commands.Initialize();", {}, false, false, false, true);
|
||||
F::Commands.Initialize();
|
||||
SDK::Output("Core", "U::Hooks.Initialize();", {}, false, false, false, true);
|
||||
U::Hooks.Initialize();
|
||||
SDK::Output("Core", "U::BytePatches.Initialize();", {}, false, false, false, true);
|
||||
U::BytePatches.Initialize();
|
||||
SDK::Output("Core", "H::Events.Initialize();", {}, false, false, false, true);
|
||||
H::Events.Initialize();
|
||||
F::Materials.LoadMaterials();
|
||||
F::Commands.Initialize();
|
||||
|
||||
F::Configs.LoadConfig(F::Configs.sCurrentConfig, false);
|
||||
F::Menu.ConfigLoaded = true;
|
||||
@@ -69,11 +60,8 @@ void CCore::Unload()
|
||||
}
|
||||
|
||||
G::Unload = true;
|
||||
SDK::Output("Core", "U::Hooks.Unload();", {}, false, false, false, true);
|
||||
U::Hooks.Unload();
|
||||
SDK::Output("Core", "U::BytePatches.Unload();", {}, false, false, false, true);
|
||||
U::BytePatches.Unload();
|
||||
SDK::Output("Core", "H::Events.Unload();", {}, false, false, false, true);
|
||||
H::Events.Unload();
|
||||
|
||||
if (F::Menu.IsOpen)
|
||||
@@ -93,9 +81,7 @@ void CCore::Unload()
|
||||
cl_wpn_sway_scale->SetValue(0.f);
|
||||
|
||||
Sleep(250);
|
||||
SDK::Output("Core", "U::ConVars.Unload();", {}, false, false, false, true);
|
||||
U::ConVars.Unload();
|
||||
SDK::Output("Core", "F::Materials.UnloadMaterials();", {}, false, false, false, true);
|
||||
F::Materials.UnloadMaterials();
|
||||
|
||||
SDK::Output("Amalgam", "Unloaded", { 175, 150, 255, 255 }, true, false, false, true);
|
||||
|
||||
@@ -139,7 +139,8 @@ void CESP::StorePlayers(CTFPlayer* pLocal)
|
||||
|
||||
if (iClassNum == TF_CLASS_MEDIC)
|
||||
{
|
||||
if (auto pMediGun = pPlayer->GetWeaponFromSlot(SLOT_SECONDARY))
|
||||
auto pMediGun = pPlayer->GetWeaponFromSlot(SLOT_SECONDARY);
|
||||
if (pMediGun && pMediGun->GetClassID() == ETFClassID::CWeaponMedigun)
|
||||
{
|
||||
tCache.m_flUber = std::clamp(pMediGun->As<CWeaponMedigun>()->m_flChargeLevel(), 0.f, 1.f);
|
||||
tCache.m_bUberBar = Vars::ESP::Player.Value & Vars::ESP::PlayerEnum::UberBar;
|
||||
|
||||
@@ -557,7 +557,6 @@ void CGlow::RenderViewmodel(const DrawModelState_t& pState, const ModelRenderInf
|
||||
|
||||
void CGlow::Initialize()
|
||||
{
|
||||
SDK::Output("Glow::Initialize", "m_pMatGlowColor", {}, false, false, false, true);
|
||||
if (!m_pMatGlowColor)
|
||||
{
|
||||
m_pMatGlowColor = I::MaterialSystem->FindMaterial("dev/glow_color", TEXTURE_GROUP_OTHER);
|
||||
@@ -565,7 +564,6 @@ void CGlow::Initialize()
|
||||
F::Materials.m_mMatList[m_pMatGlowColor] = true;
|
||||
}
|
||||
|
||||
SDK::Output("Glow::Initialize", "m_pMatBlurX", {}, false, false, false, true);
|
||||
if (!m_pMatBlurX)
|
||||
{
|
||||
KeyValues* kv = new KeyValues("BlurFilterX");
|
||||
@@ -573,7 +571,6 @@ void CGlow::Initialize()
|
||||
m_pMatBlurX = F::Materials.Create("MatBlurX", kv);
|
||||
}
|
||||
|
||||
SDK::Output("Glow::Initialize", "m_pMatBlurY", {}, false, false, false, true);
|
||||
if (!m_pMatBlurY)
|
||||
{
|
||||
KeyValues* kv = new KeyValues("BlurFilterY");
|
||||
@@ -581,7 +578,6 @@ void CGlow::Initialize()
|
||||
m_pMatBlurY = F::Materials.Create("MatBlurY", kv);
|
||||
}
|
||||
|
||||
SDK::Output("Glow::Initialize", "m_pMatHaloAddToScreen", {}, false, false, false, true);
|
||||
if (!m_pMatHaloAddToScreen)
|
||||
{
|
||||
KeyValues* kv = new KeyValues("UnlitGeneric");
|
||||
@@ -590,14 +586,12 @@ void CGlow::Initialize()
|
||||
m_pMatHaloAddToScreen = F::Materials.Create("MatHaloAddToScreen", kv);
|
||||
}
|
||||
|
||||
SDK::Output("Glow::Initialize", "m_pRtFullFrame", {}, false, false, false, true);
|
||||
if (!m_pRtFullFrame)
|
||||
{
|
||||
m_pRtFullFrame = I::MaterialSystem->FindTexture("_rt_FullFrameFB", TEXTURE_GROUP_RENDER_TARGET);
|
||||
m_pRtFullFrame->IncrementReferenceCount();
|
||||
}
|
||||
|
||||
SDK::Output("Glow::Initialize", "m_pRenderBuffer1", {}, false, false, false, true);
|
||||
if (!m_pRenderBuffer1)
|
||||
{
|
||||
m_pRenderBuffer1 = I::MaterialSystem->CreateNamedRenderTargetTextureEx(
|
||||
@@ -613,7 +607,6 @@ void CGlow::Initialize()
|
||||
m_pRenderBuffer1->IncrementReferenceCount();
|
||||
}
|
||||
|
||||
SDK::Output("Glow::Initialize", "m_pRenderBuffer2", {}, false, false, false, true);
|
||||
if (!m_pRenderBuffer2)
|
||||
{
|
||||
m_pRenderBuffer2 = I::MaterialSystem->CreateNamedRenderTargetTextureEx(
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
IMaterial* CMaterials::Create(char const* szName, KeyValues* pKV)
|
||||
{
|
||||
SDK::Output("LoadMaterials", "CreateMaterial", {}, false, false, false, true);
|
||||
IMaterial* pMaterial = I::MaterialSystem->CreateMaterial(szName, pKV);
|
||||
m_mMatList[pMaterial] = true;
|
||||
return pMaterial;
|
||||
@@ -32,7 +31,6 @@ void CMaterials::Remove(IMaterial* pMaterial)
|
||||
|
||||
void CMaterials::StoreStruct(std::string sName, std::string sVMT, bool bLocked)
|
||||
{
|
||||
SDK::Output("LoadMaterials", "StoreStruct", {}, false, false, false, true);
|
||||
Material_t tMaterial = {};
|
||||
tMaterial.m_sName = sName;
|
||||
tMaterial.m_sVMT = sVMT;
|
||||
@@ -43,7 +41,6 @@ void CMaterials::StoreStruct(std::string sName, std::string sVMT, bool bLocked)
|
||||
|
||||
void CMaterials::StoreVars(Material_t& tMaterial)
|
||||
{
|
||||
SDK::Output("LoadMaterials", "StoreVars", {}, false, false, false, true);
|
||||
if (!tMaterial.m_pMaterial)
|
||||
return;
|
||||
|
||||
@@ -58,8 +55,6 @@ void CMaterials::StoreVars(Material_t& tMaterial)
|
||||
auto $invertcull = tMaterial.m_pMaterial->FindVar("$invertcull", &bFound, false);
|
||||
if (bFound && $invertcull && $invertcull->GetIntValueInternal())
|
||||
tMaterial.m_bInvertCull = true;
|
||||
|
||||
SDK::Output("LoadMaterials", "StoreVars 2", {}, false, false, false, true);
|
||||
}
|
||||
|
||||
static inline void ModifyKeyValues(KeyValues* pKV)
|
||||
@@ -174,19 +169,15 @@ void CMaterials::LoadMaterials()
|
||||
// create materials
|
||||
for (auto& [_, tMaterial] : m_mMaterials)
|
||||
{
|
||||
SDK::Output("LoadMaterials", tMaterial.m_sName.c_str(), {}, false, false, false, true);
|
||||
KeyValues* kv = new KeyValues(tMaterial.m_sName.c_str());
|
||||
kv->LoadFromBuffer(tMaterial.m_sName.c_str(), tMaterial.m_sVMT.c_str());
|
||||
ModifyKeyValues(kv);
|
||||
|
||||
tMaterial.m_pMaterial = Create(tMaterial.m_sName.c_str(), kv);
|
||||
}
|
||||
for (auto& [_, tMaterial] : m_mMaterials)
|
||||
StoreVars(tMaterial);
|
||||
}
|
||||
|
||||
SDK::Output("LoadMaterials", "Glow.Initialize();", {}, false, false, false, true);
|
||||
F::Glow.Initialize();
|
||||
SDK::Output("LoadMaterials", "CameraWindow.Initialize();", {}, false, false, false, true);
|
||||
F::CameraWindow.Initialize();
|
||||
|
||||
m_bLoaded = true;
|
||||
@@ -214,20 +205,20 @@ void CMaterials::ReloadMaterials()
|
||||
|
||||
void CMaterials::SetColor(Material_t* pMaterial, Color_t tColor)
|
||||
{
|
||||
if (!pMaterial)
|
||||
return;
|
||||
|
||||
float r = float(tColor.r) / 255.f;
|
||||
float g = float(tColor.g) / 255.f;
|
||||
float b = float(tColor.b) / 255.f;
|
||||
float a = float(tColor.a) / 255.f;
|
||||
|
||||
I::RenderView->SetColorModulation(r, g, b);
|
||||
I::RenderView->SetBlend(a);
|
||||
|
||||
if (!pMaterial)
|
||||
return;
|
||||
if (pMaterial->m_phongtint)
|
||||
pMaterial->m_phongtint->SetVecValue(r, g, b);
|
||||
if (pMaterial->m_envmaptint)
|
||||
pMaterial->m_envmaptint->SetVecValue(r, g, b);
|
||||
I::RenderView->SetColorModulation(r, g, b);
|
||||
I::RenderView->SetBlend(a);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user