Skip to content

Commit

Permalink
update, bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
UnrealKaraulov committed Feb 2, 2025
1 parent acc06b6 commit 54ae75a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/bsp/Bsp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6740,7 +6740,7 @@ int Bsp::pointContents(int iNode, const vec3& p, int hull, std::vector<int>& nod
childIdx = 0;
}
}

leafIdx = iNode;
return iNode;
}
}
Expand Down Expand Up @@ -12723,7 +12723,7 @@ void Bsp::ExportToMapWIP(const std::string& path, bool selected, bool merge_face
int headNode = models[0].iHeadnodes[0];
int contents = pointContents(headNode, test_vert, 0, nodeBranch, leafIdx, childIdx);

if (contents != CONTENTS_SOLID && leafIdx != 0)
if (contents != CONTENTS_SOLID && leafIdx > 0)
{
back_face_is_empty = false;
}
Expand Down
9 changes: 5 additions & 4 deletions src/editor/BspRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2713,11 +2713,12 @@ void BspRenderer::render(bool modelVertsDraw, int clipnodeHull)
std::vector<int> nodeBranch;
int childIdx = -1;
int headNode = map->models[0].iHeadnodes[0];
map->pointContents(headNode, localCameraOrigin, 0, nodeBranch, curLeafIdx, childIdx);
if (curLeafIdx < 0)
curLeafIdx = 0;
int hull = g_app->clipnodeRenderHull;
if (hull < 0)
hull = 0;
map->pointContents(headNode, localCameraOrigin, hull, nodeBranch, curLeafIdx, childIdx);

if (g_app->pickMode == PICK_FACE_LEAF)
if (g_app->pickMode == PICK_FACE_LEAF && hull == 0)
{
if (!g_app->gui->showFaceEditWidget)
{
Expand Down
19 changes: 14 additions & 5 deletions src/editor/Gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4304,6 +4304,7 @@ void Gui::drawMenuBar()

if (ImGui::BeginMenu(get_localized_string(LANG_0566).c_str(), map))
{
auto oldHull = app->clipnodeRenderHull;
if (ImGui::MenuItem(get_localized_string(LANG_0567).c_str(), NULL, app->clipnodeRenderHull == -1))
{
app->clipnodeRenderHull = -1;
Expand All @@ -4324,6 +4325,11 @@ void Gui::drawMenuBar()
{
app->clipnodeRenderHull = 3;
}
if (app->clipnodeRenderHull != oldHull)
{
rend->curLeafIdx = 0;
}

ImGui::EndMenu();
}

Expand Down Expand Up @@ -4645,7 +4651,7 @@ void Gui::drawMenuBar()
}
IMGUI_TOOLTIP(g, "Subdivides faces until they have valid extents. The drawback to this method is reduced in-game performace from higher poly counts.");

ImGui::MenuItem("##", "WIP");
ImGui::MenuItem("[WARNING]", "WIP");
IMGUI_TOOLTIP(g, "Anything you choose here will break lightmaps. "
"Run the map through a RAD compiler to fix, and pray that the mapper didn't "
"customize compile settings much.");
Expand Down Expand Up @@ -5304,7 +5310,7 @@ void Gui::drawMenuBar()
ImGui::TextUnformatted("WARNING! Can remove unexpected faces if VIS has been edited previously.");
ImGui::EndTooltip();
}
if (rend->curLeafIdx > 0)
if (rend->curLeafIdx > 0 && app->clipnodeRenderHull <= 0)
{
if (ImGui::MenuItem(fmt::format("Delete from [{} leaf]", rend->curLeafIdx).c_str()))
{
Expand Down Expand Up @@ -6302,7 +6308,10 @@ void Gui::drawMenuBar()
{
ImGui::TextUnformatted(fmt::format("Click [{:^5},{:^5},{:^5}]", floatRound(rend->intersectVec.x), floatRound(rend->intersectVec.y), floatRound(rend->intersectVec.z)).c_str());

ImGui::TextUnformatted(fmt::format("Leaf [{}]", rend->curLeafIdx).c_str());
if (app->clipnodeRenderHull <= 0)
ImGui::TextUnformatted(fmt::format("Leaf [{}]", rend->curLeafIdx).c_str());
else
ImGui::TextUnformatted(fmt::format("Contents [{}]", rend->curLeafIdx).c_str());

ImGui::TextUnformatted(fmt::format("Dist [{:^5}]", floatRound(rend->intersectDist)).c_str());
}
Expand Down Expand Up @@ -9041,7 +9050,7 @@ void Gui::loadFonts()
}
std::error_code err{};

for (const auto& entry : fs::directory_iterator(fontPath,err)) {
for (const auto& entry : fs::directory_iterator(fontPath, err)) {
if (entry.is_regular_file()) {
auto extension = entry.path().extension().string();
extension = toLowerCase(extension);
Expand Down Expand Up @@ -12773,7 +12782,7 @@ void Gui::drawFaceEditorWidget()

if ((last_leaf != mapRenderer->curLeafIdx && auto_update_leaf) || new_last_leaf)
{
if (auto_update_leaf)
if (auto_update_leaf && app->clipnodeRenderHull <= 0)
{
if (last_leaf != mapRenderer->curLeafIdx)
{
Expand Down

0 comments on commit 54ae75a

Please sign in to comment.