Entity list & asset list & debug windows fixes

This commit is contained in:
Federico Cecchetto 2022-01-08 01:28:46 +01:00
parent 4d9935b568
commit 72a02c2deb
3 changed files with 27 additions and 13 deletions

View File

@ -64,12 +64,14 @@ namespace asset_list
ImGui::InputText("asset name", &assets_name_filter[type]); ImGui::InputText("asset name", &assets_name_filter[type]);
ImGui::BeginChild("assets list"); ImGui::BeginChild("assets list");
fastfiles::enum_assets(type, [type](const game::XAssetHeader header) const auto lowercase_filter = utils::string::to_lower(assets_name_filter[type]);
fastfiles::enum_assets(type, [&lowercase_filter, type](const game::XAssetHeader header)
{ {
const auto asset = game::XAsset{type, header}; const auto asset = game::XAsset{type, header};
const auto* const asset_name = game::DB_GetXAssetName(&asset); const auto* const asset_name = game::DB_GetXAssetName(&asset);
if (utils::string::find_lower(asset_name, assets_name_filter[type]) && ImGui::Button(asset_name)) if (strstr(asset_name, lowercase_filter.data()) && ImGui::Button(asset_name))
{ {
gui::copy_to_clipboard(asset_name); gui::copy_to_clipboard(asset_name);
} }

View File

@ -81,7 +81,7 @@ namespace gui_debug
vector_dot(local, axis[0]) vector_dot(local, axis[0])
}; };
if (transform[2] < 0.1f) if (transform[2] < 0.01f)
{ {
return false; return false;
} }
@ -375,11 +375,12 @@ namespace gui_debug
} }
window->DrawList->PathFillConvex(color_); window->DrawList->PathFillConvex(color_);
for (auto i = 0; i < max_points - 1; i++) for (auto i = 0; i < max_points; i++)
{ {
window->DrawList->PathClear(); window->DrawList->PathClear();
if (!points_bottom[i].valid) if (!points_bottom[i].valid ||
!points_top[i].valid)
{ {
continue; continue;
} }
@ -388,11 +389,21 @@ namespace gui_debug
if (i == max_points - 1) if (i == max_points - 1)
{ {
if (!points_bottom[0].valid || !points_top[0].valid)
{
continue;
}
window->DrawList->PathLineTo(points_bottom[0].point); window->DrawList->PathLineTo(points_bottom[0].point);
window->DrawList->PathLineTo(points_top[0].point); window->DrawList->PathLineTo(points_top[0].point);
} }
else else
{ {
if (!points_bottom[i + 1].valid || !points_top[i + 1].valid)
{
continue;
}
window->DrawList->PathLineTo(points_bottom[i + 1].point); window->DrawList->PathLineTo(points_bottom[i + 1].point);
window->DrawList->PathLineTo(points_top[i + 1].point); window->DrawList->PathLineTo(points_top[i + 1].point);
} }
@ -592,8 +603,7 @@ namespace gui_debug
continue; continue;
} }
float top[3] = {origin[0], origin[1], origin[2] + entity->halfSize[2] * 2.f}; draw_cylinder(origin, radius, height, trigger_settings.color, trigger_settings.mesh_thickness);
draw_cylinder(top, radius, height, trigger_settings.color, trigger_settings.mesh_thickness);
} }
} }
@ -637,7 +647,6 @@ namespace gui_debug
void post_unpack() override void post_unpack() override
{ {
gui::on_frame(draw_window); gui::on_frame(draw_window);
gui::on_frame(draw_nodes, true);
gui::on_frame([]() gui::on_frame([]()
{ {
if (!game::SV_Loaded() || cl_paused->current.integer) if (!game::SV_Loaded() || cl_paused->current.integer)
@ -651,10 +660,10 @@ namespace gui_debug
end_render_window(); end_render_window();
}, true); }, true);
scheduler::on_game_initialized([]() scheduler::once([]()
{ {
cl_paused = game::Dvar_FindVar("cl_paused"); cl_paused = game::Dvar_FindVar("cl_paused");
}); }, scheduler::pipeline::main);
scheduler::loop([]() scheduler::loop([]()
{ {

View File

@ -666,7 +666,7 @@ namespace entity_list
ImGui::Text("Fields"); ImGui::Text("Fields");
auto index = 0; auto index = 0;
for (auto i = data.filters.fields.begin(); i != data.filters.fields.end(); ++i) for (auto i = data.filters.fields.begin(); i != data.filters.fields.end();)
{ {
if (ImGui::TreeNode(utils::string::va("Filter #%i", index++))) if (ImGui::TreeNode(utils::string::va("Filter #%i", index++)))
{ {
@ -675,12 +675,15 @@ namespace entity_list
if (ImGui::Button("Erase")) if (ImGui::Button("Erase"))
{ {
data.filters.fields.erase(i); i = data.filters.fields.erase(i);
--i; ImGui::TreePop();
continue;
} }
ImGui::TreePop(); ImGui::TreePop();
} }
++i;
} }
if (ImGui::Button("Add field filter")) if (ImGui::Button("Add field filter"))