Skip to content

Commit

Permalink
Add screenshot command! Fix settings!
Browse files Browse the repository at this point in the history
  • Loading branch information
UnrealKaraulov committed Dec 9, 2024
1 parent b91b542 commit fc63c57
Show file tree
Hide file tree
Showing 12 changed files with 343 additions and 83 deletions.
2 changes: 1 addition & 1 deletion src/cli/CommandLine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ CommandLine::CommandLine(int argc, char* argv[])
options.push_back(arg);
}

if ((i == 1 || i == 2) && starts_with(larg,"help") || starts_with(larg,"/?") || starts_with(larg,"--help") || starts_with(larg,"-help") || starts_with(larg,"-h"))
if ((i == 1 || i == 2) && starts_with(larg,"help") || starts_with(larg,"/?") || starts_with(larg,"--help") || starts_with(larg, "-help") || starts_with(larg, "/help"))
{
askingForHelp = true;
}
Expand Down
22 changes: 11 additions & 11 deletions src/editor/BspRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2994,7 +2994,7 @@ void BspRenderer::render(bool modelVertsDraw, int clipnodeHull)



if (g_app->pickMode == PICK_FACE_LEAF && !ortho_overview)
if (g_app->pickMode == PICK_FACE_LEAF && !ortho_overview && !make_screenshot)
{
glDepthMask(GL_FALSE);
glDepthFunc(GL_ALWAYS);
Expand Down Expand Up @@ -3026,7 +3026,7 @@ void BspRenderer::drawModelClipnodes(int modelIdx, bool highlight, int hullIdx)
hullIdx = getBestClipnodeHull(modelIdx);
}

if (hullIdx <= -1 || hullIdx > 3 || ortho_overview)
if (hullIdx <= -1 || hullIdx > 3 || ortho_overview || make_screenshot)
{
return; // nothing can be drawn
}
Expand Down Expand Up @@ -3102,7 +3102,7 @@ void BspRenderer::drawModel(RenderEnt* ent, int pass, bool highlight, bool edges
if (pass == REND_PASS_COLORSHADER)
{
RenderModel* rend_mdl = renderModels[modelIdx];
if (rend_mdl->wireframeBuffer && !ortho_overview)
if (rend_mdl->wireframeBuffer && !ortho_overview && !make_screenshot)
{
if (ent && ent->isDuplicateModel)
rend_mdl->wireframeBuffer->frameId--;
Expand Down Expand Up @@ -3187,7 +3187,7 @@ void BspRenderer::drawModel(RenderEnt* ent, int pass, bool highlight, bool edges
{
if (rgroup.special)
{
if (ortho_overview)
if (ortho_overview | make_screenshot)
continue;

if (modelIdx == 0 && !(g_render_flags & RENDER_SPECIAL))
Expand Down Expand Up @@ -3273,7 +3273,7 @@ void BspRenderer::drawModel(RenderEnt* ent, int pass, bool highlight, bool edges
}


if (g_app->pickMode != PICK_OBJECT && highlight && !ortho_overview)
if (g_app->pickMode != PICK_OBJECT && highlight && !ortho_overview && !make_screenshot)
{
if (ent)
{
Expand All @@ -3285,7 +3285,7 @@ void BspRenderer::drawModel(RenderEnt* ent, int pass, bool highlight, bool edges
}
else
{
if (highlight && !ortho_overview)
if (highlight && !ortho_overview && !make_screenshot)
{
if (ent)
{
Expand Down Expand Up @@ -3329,7 +3329,7 @@ void BspRenderer::drawPointEntities(std::vector<int> highlightEnts, int pass)
if (mapEnt->hide)
continue;

if (ortho_overview)
if (ortho_overview || make_screenshot)
{
if (!starts_with(mapEnt->classname, "cycler_") &&
!starts_with(mapEnt->classname, "func_"))
Expand All @@ -3338,7 +3338,7 @@ void BspRenderer::drawPointEntities(std::vector<int> highlightEnts, int pass)
}
}

if (g_app->pickInfo.IsSelectedEnt(i) && !ortho_overview)
if (g_app->pickInfo.IsSelectedEnt(i) && !ortho_overview && !make_screenshot)
{
if (g_render_flags & RENDER_SELECTED_AT_TOP)
glDepthFunc(GL_ALWAYS);
Expand All @@ -3359,7 +3359,7 @@ void BspRenderer::drawPointEntities(std::vector<int> highlightEnts, int pass)
renderEnts[i].spr->DrawSprite();
}
}
else if (pass == REND_PASS_COLORSHADER && !ortho_overview)
else if (pass == REND_PASS_COLORSHADER && !ortho_overview && !make_screenshot)
{
g_app->matmodel = renderEnts[i].modelMat4x4_calc_angles;
g_app->colorShader->updateMatrixes();
Expand All @@ -3380,7 +3380,7 @@ void BspRenderer::drawPointEntities(std::vector<int> highlightEnts, int pass)
}
else
{
if (pass == REND_PASS_COLORSHADER && !ortho_overview)
if (pass == REND_PASS_COLORSHADER && !ortho_overview && !make_screenshot)
{
g_app->matmodel = renderEnts[i].modelMat4x4_calc_angles;
g_app->colorShader->updateMatrixes();
Expand Down Expand Up @@ -3434,7 +3434,7 @@ void BspRenderer::drawPointEntities(std::vector<int> highlightEnts, int pass)
}
else
{
if (pass == REND_PASS_COLORSHADER && !ortho_overview)
if (pass == REND_PASS_COLORSHADER && !ortho_overview && !make_screenshot)
{
g_app->matmodel = renderEnts[i].modelMat4x4_calc_angles;
g_app->colorShader->updateMatrixes();
Expand Down
6 changes: 4 additions & 2 deletions src/editor/Gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7011,7 +7011,8 @@ void Gui::drawOverviewWidget()
ImGui::DragInt("Height###3", &ortho_tga_h, 1.0f, 256, 4096);
ImGui::PopItemWidth();

if (ImGui::Button("Save .tga")) {
if (ImGui::Button("Save .tga"))
{
ortho_save_tga = true;
imgFormat = ".tga";
}
Expand Down Expand Up @@ -9908,7 +9909,8 @@ void Gui::drawSettings()
g_settings.selected_lang = langForSelect;
g_settings.palette_name = palForSelect;
set_localize_lang(g_settings.selected_lang);


g_settings.saveSettings();
if (!app->reloading)
{
app->reloading = true;
Expand Down
Loading

0 comments on commit fc63c57

Please sign in to comment.