Skip to content

Commit

Permalink
crash fix
Browse files Browse the repository at this point in the history
  • Loading branch information
UnrealKaraulov committed Feb 3, 2024
1 parent 920fd9e commit 29399c9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/editor/BspRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,7 @@ int BspRenderer::refreshModel(int modelIdx, bool refreshClipnodes, bool noTriang
verts[e].g = 0.0f;
}
verts[e].b = 0.0f;
verts[e].a = isSky || isTrigger || ent->rendermode == 5 ? 1.0f - opacity : 0.0f;
verts[e].a = isSky || isTrigger || ( ent && ent->rendermode == 5 ) ? 1.0f - opacity : 0.0f;

// texture coords
float tw = 1.0f;
Expand Down
5 changes: 4 additions & 1 deletion src/editor/Gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2697,11 +2697,13 @@ void Gui::drawMenuBar()

std::vector<int> newVertIndexes;
size_t newVertCount = map->vertCount + mesh.buffer->numVerts;

vec3* newverts = new vec3[newVertCount];
memcpy(newverts, map->verts, map->vertCount * sizeof(vec3));

std::vector<vec2> newuv;
newuv.resize(newVertCount);

memcpy(newverts, map->verts, map->vertCount * sizeof(vec3));
int v = 0;

for (v = map->vertCount; v < newVertCount; v++)
Expand Down Expand Up @@ -2867,6 +2869,7 @@ void Gui::drawMenuBar()
vertexes.push_back(vertex1);
vertexes.push_back(vertex2);
vertexes.push_back(vertex3);

// Texture coordinates
std::vector<vec2> uvs{};
uvs.push_back(newsurfedges[firstEdge] > 0 ? newuv[newedges[abs(newsurfedges[firstEdge])].iVertex[0]]
Expand Down
4 changes: 2 additions & 2 deletions vs-project/bspguy.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
<AdditionalIncludeDirectories>.\..\src;.\..\src\bsp;.\..\src\cli;.\..\src\data;.\..\src\editor;.\..\src\filedialog;.\..\src\gl;.\..\src\qtools;.\..\src\util;.\..\src\mdl;.\..\imgui;.\..\imgui\examples;.\..\imgui\backends;.\..\imgui\misc\cpp;.\..\glew\include;.\..\glfw\include;.\..\fmt\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4244;4018</DisableSpecificWarnings>
<ExceptionHandling>Sync</ExceptionHandling>
<InlineFunctionExpansion>Disabled</InlineFunctionExpansion>
Expand Down Expand Up @@ -162,7 +162,7 @@
</BaseAddress>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<FixedBaseAddress>true</FixedBaseAddress>
<Profile>true</Profile>
<Profile>false</Profile>
</Link>
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
Expand Down
2 changes: 1 addition & 1 deletion vs-project/fmt/fmt.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
<AdditionalIncludeDirectories>.\..\..\src;.\..\..\src\bsp;.\..\..\src\cli;.\..\..\src\data;.\..\..\src\editor;.\..\..\src\filedialog;.\..\..\src\gl;.\..\..\src\qtools;.\..\..\src\util;.\..\..\src\mdl;.\..\..\imgui;.\..\..\imgui\examples;.\..\..\imgui\misc\cpp;.\..\..\imgui\backends;.\..\..\fmt;.\..\..\fmt\include;.\..\..\glew\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<ExceptionHandling>Sync</ExceptionHandling>
<InlineFunctionExpansion>Disabled</InlineFunctionExpansion>
<Optimization>Disabled</Optimization>
Expand Down

0 comments on commit 29399c9

Please sign in to comment.