From 8b20bad661aaca8414c3f48842d880ae16422004 Mon Sep 17 00:00:00 2001 From: Unreal Karaulov Date: Sat, 9 Nov 2024 14:37:50 +0300 Subject: [PATCH] Fix crash export models! --- .github/workflows/build.yml | 28 ++++++++++++++++++---------- src/editor/Gui.cpp | 5 +++-- vs-project/bspguy.vcxproj | 3 +-- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b8a5fbb6..e1459c45 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -61,7 +61,7 @@ jobs: needs: get_time_build runs-on: windows-latest env: - solution: vs-project/bspguy.sln + solution: vs-project/bspguy.vcxproj GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - name: Checkout @@ -90,9 +90,11 @@ jobs: Write-Host "components were not installed" exit 1 } - - name: Build app for release - run: > - msbuild ${{ env.solution }} -m -t:rebuild -verbosity:diag -property:Configuration=Release + - name: Set up Visual Studio shell + uses: egor-tensin/vs-shell@v2 + - name: Build release + run: | + msbuild ${{ env.solution }} -m /p:Configuration=Release /p:Platform=x64 - name: Create Windows release archive run: > mkdir -p build\win64_release @@ -108,9 +110,13 @@ jobs: tag_name: ${{ needs.get_time_build.outputs.release_tag }} files: | build/newbspguy_win7_x64_release.zip - - name: Build app for release WinXP 32bit - run: > - msbuild ${{ env.solution }} -m -t:rebuild -verbosity:diag -property:Configuration=ReleaseXPx86 + - name: Set up Visual Studio shell + uses: egor-tensin/vs-shell@v2 + with: + arch: Win32 + - name: Build XP + run: | + msbuild ${{ env.solution }} -m /p:Configuration=ReleaseXPx86 /p:Platform=x86 - name: Create Windows release WinXP archive run: > mkdir -p build\win32_release @@ -126,9 +132,11 @@ jobs: tag_name: ${{ needs.get_time_build.outputs.release_tag }} files: | build/newbspguy_winxp_x86_release.zip - - name: Build app for debug - run: > - msbuild ${{ env.solution }} -m -t:rebuild -verbosity:diag -property:Configuration=DebugGithub + - name: Set up Visual Studio shell + uses: egor-tensin/vs-shell@v2 + - name: Build Debug + run: | + msbuild ${{ env.solution }} -m /p:Configuration=Debug /p:Platform=x64 - name: Create Windows debug archive run: > mkdir -p build\win64_debug diff --git a/src/editor/Gui.cpp b/src/editor/Gui.cpp index 9d45a193..37350511 100644 --- a/src/editor/Gui.cpp +++ b/src/editor/Gui.cpp @@ -572,7 +572,7 @@ int ImportModel(Bsp* map, const std::string& mdl_path, bool noclip) void ExportModel(Bsp* src_map, int model_id, int ExportType, bool movemodel) { Bsp* bspModel = new Bsp(); - bspModel->setBspRender(bspModel->getBspRender()); + bspModel->setBspRender(src_map->getBspRender()); bspModel->bsp_valid = true; for (int i = 0; i < HEADER_LUMPS; i++) @@ -782,7 +782,7 @@ void ExportModel(Bsp* src_map, int model_id, int ExportType, bool movemodel) bspModel->models[newModelIdx].iHeadnodes[i] = bspModel->models[newModelIdx].iHeadnodes[i] < 0 ? -1 : remap.clipnodes[bspModel->models[newModelIdx].iHeadnodes[i]]; } - //app->deselectObject(); + bspModel->models[newModelIdx].nVisLeafs = bspModel->leafCount - 1; STRUCTCOUNT removed = bspModel->remove_unused_model_structures(); if (!removed.allZero()) @@ -827,6 +827,7 @@ void ExportModel(Bsp* src_map, int model_id, int ExportType, bool movemodel) unsigned char* tmpCompressed = new unsigned char[MAX_MAP_LEAVES / 8]; memset(tmpCompressed, 0xFF, MAX_MAP_LEAVES / 8); + // ADD LEAFS TO ALL VISIBILITY BYTES for (int i = 0; i < bspModel->leafCount; i++) { diff --git a/vs-project/bspguy.vcxproj b/vs-project/bspguy.vcxproj index 11c8f464..c0de2820 100644 --- a/vs-project/bspguy.vcxproj +++ b/vs-project/bspguy.vcxproj @@ -484,8 +484,7 @@ del "$(TargetDir)bspguy.cfg_bak" Level4 %(PreprocessorDefinitions);WIN32;_WINDOWS;NDEBUG;GLEW_STATIC;NOMINMAX;_CRT_SECURE_NO_WARNINGS $(IntDir) - - + ProgramDatabase stdcpplatest false true