From 134592edffeaf1b5413803261041a811ff9947d5 Mon Sep 17 00:00:00 2001 From: LAGonauta Date: Mon, 11 Dec 2023 22:05:11 -0500 Subject: [PATCH 1/2] Any generic tell to FileBuf --- src/Loaders/GoldSrcFileBuf.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Loaders/GoldSrcFileBuf.cpp b/src/Loaders/GoldSrcFileBuf.cpp index 805ce40..b3ccfb7 100644 --- a/src/Loaders/GoldSrcFileBuf.cpp +++ b/src/Loaders/GoldSrcFileBuf.cpp @@ -67,7 +67,7 @@ namespace MetaAudio } FILESYSTEM_ANY_SEEK(mFile, static_cast(offset), seekType); - auto curPosition = g_pFileSystem->Tell(mFile); + auto curPosition = FILESYSTEM_ANY_TELL(mFile); setg(nullptr, nullptr, nullptr); return curPosition; From 68a6103f305b9c2bd4f84185126cd556caba7e78 Mon Sep 17 00:00:00 2001 From: LAGonauta Date: Mon, 11 Dec 2023 22:06:16 -0500 Subject: [PATCH 2/2] Fix SteamAudio mesh loader on HL25 --- src/Loaders/SteamAudioMapMeshLoader.cpp | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/Loaders/SteamAudioMapMeshLoader.cpp b/src/Loaders/SteamAudioMapMeshLoader.cpp index 3523abd..f6b97e8 100644 --- a/src/Loaders/SteamAudioMapMeshLoader.cpp +++ b/src/Loaders/SteamAudioMapMeshLoader.cpp @@ -4,6 +4,8 @@ #include "Utilities/VectorUtils.hpp" #include "Loaders/SteamAudioMapMeshLoader.hpp" +extern int g_iEngineType; + namespace MetaAudio { constexpr const float EPSILON = 0.000001f; @@ -67,13 +69,26 @@ namespace MetaAudio for (int i = 0; i < mapModel->nummodelsurfaces; ++i) { - auto surface = mapModel->surfaces[mapModel->firstmodelsurface + i]; - glpoly_t* poly = surface.polys; + glpoly_t* firstPoly = nullptr; + if (g_iEngineType == ENGINE_GOLDSRC_HL25) + { + msurface_hl25_t* surfaces = reinterpret_cast(mapModel->surfaces); + msurface_hl25_t* surface = &surfaces[mapModel->firstmodelsurface + i]; + firstPoly = surface->polys; + } + else + { + msurface_t* surface = &mapModel->surfaces[mapModel->firstmodelsurface + i]; + firstPoly = surface->polys; + } std::vector surfaceVerts; + glpoly_t* poly = firstPoly; while (poly) { if (poly->numverts <= 0) + { continue; + } for (int j = 0; j < poly->numverts; ++j) { @@ -83,8 +98,10 @@ namespace MetaAudio poly = poly->next; // escape rings - if (poly == surface.polys) + if (poly == firstPoly) + { break; + } } // triangulation