Skip to content

Commit

Permalink
Fix crash export models!
Browse files Browse the repository at this point in the history
  • Loading branch information
UnrealKaraulov committed Nov 9, 2024
1 parent dcae773 commit 8b20bad
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 14 deletions.
28 changes: 18 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
5 changes: 3 additions & 2 deletions src/editor/Gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++)
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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++)
{
Expand Down
3 changes: 1 addition & 2 deletions vs-project/bspguy.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -484,8 +484,7 @@ del "$(TargetDir)bspguy.cfg_bak"</Command>
<WarningLevel>Level4</WarningLevel>
<PreprocessorDefinitions>%(PreprocessorDefinitions);WIN32;_WINDOWS;NDEBUG;GLEW_STATIC;NOMINMAX;_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
<ObjectFileName>$(IntDir)</ObjectFileName>
<DebugInformationFormat>
</DebugInformationFormat>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<LanguageStandard>stdcpplatest</LanguageStandard>
<SDLCheck>false</SDLCheck>
<IntrinsicFunctions>true</IntrinsicFunctions>
Expand Down

0 comments on commit 8b20bad

Please sign in to comment.