From 867b616aed21af7b48a379af57959c7b28c5134b Mon Sep 17 00:00:00 2001 From: BlueNightHawk <46296596+BlueNightHawk@users.noreply.github.com> Date: Sun, 25 Dec 2022 22:25:27 +0530 Subject: [PATCH] Fix caching --- cl_dll/StudioModelRenderer.cpp | 8 ++++++-- filecopy.bat | 2 +- projects/vs2022/hl_cdll.vcxproj | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/cl_dll/StudioModelRenderer.cpp b/cl_dll/StudioModelRenderer.cpp index aae0cb1..191ab86 100644 --- a/cl_dll/StudioModelRenderer.cpp +++ b/cl_dll/StudioModelRenderer.cpp @@ -2002,6 +2002,9 @@ void CStudioModelRenderer::SetupModelExtraData(void) { m_pCurretExtraData = &m_ExtraData[m_pRenderModel->name]; + if (StudioReadData()) + return; + if (m_pCurretExtraData->submodels.size() > 0) return; @@ -2049,6 +2052,8 @@ void CStudioModelRenderer::SetupModelExtraData(void) } gEngfuncs.Con_Printf("Done (%d polys, %d edges)\n", facecounter, edgecounter); + + StudioWriteData(); } /* @@ -2322,8 +2327,7 @@ void CStudioModelRenderer::StudioWriteData(void) size_t i; char szFile[256]; - if (!std::filesystem::exists((std::string) "./" + gEngfuncs.pfnGetGameDirectory() + "/models/shadowcache")) - std::filesystem::create_directory((std::string) "./" + gEngfuncs.pfnGetGameDirectory() + "/models/shadowcache"); +// std::filesystem::create_directory((std::string) "./" + gEngfuncs.pfnGetGameDirectory() + "/models/shadowcache"); std::string filename(m_pRenderModel->name); sprintf(szFile, "%s/%s/%s.dat", gEngfuncs.pfnGetGameDirectory(), "models/shadowcache", filename.substr(0, filename.rfind('.')).c_str() + 7); diff --git a/filecopy.bat b/filecopy.bat index 1a5fefa..d36fdea 100755 --- a/filecopy.bat +++ b/filecopy.bat @@ -1,7 +1,7 @@ @echo off rem Set this path to your mod directory. You can use environment variables to avoid hardcoding the path if your team members have different install locations. -set mod_directory=E:\SteamLibrary\steamapps\common\Half-Life/hlu_sdl3 +set mod_directory=E:\SteamLibrary\steamapps\common\Half-Life\hlu_stencilhack rem Input paths may end with a backslash which will be interpreted as an escape character when passed into robocopy, so this needs to be escaped. set source=%~1 diff --git a/projects/vs2022/hl_cdll.vcxproj b/projects/vs2022/hl_cdll.vcxproj index a8ce540..26dd431 100644 --- a/projects/vs2022/hl_cdll.vcxproj +++ b/projects/vs2022/hl_cdll.vcxproj @@ -105,7 +105,7 @@ cmd /c ""$(ProjectDir)..\..\filecopy.bat" "$(OutDir)" "cl_dlls" "$(TargetName).p true true true - ..\..\utils\vgui\lib\win32_vc6\vgui.lib;wsock32.lib;..\..lib\public\SDL2.lib;%(AdditionalDependencies) + ..\..\utils\vgui\lib\win32_vc6\vgui.lib;wsock32.lib;..\..\lib\public\SDL2.lib;opengl32.lib;%(AdditionalDependencies)