161 int num_playable_actors = 0;
164 if (!actor->ar_hide_in_actor_list)
166 num_playable_actors++;
170 std::string sim_title =
_LC(
"TopMenubar",
"Simulation");
171 std::string actors_title = fmt::format(
"{} ({})",
_LC(
"TopMenubar",
"Vehicles"), num_playable_actors);
172 std::string savegames_title =
_LC(
"TopMenubar",
"Saves");
173 std::string settings_title =
_LC(
"TopMenubar",
"Settings");
174 std::string tools_title =
_LC(
"TopMenubar",
"Tools");
175 std::string ai_title =
_LC(
"TopMenubar",
"Vehicle AI");
176 std::string tuning_title =
_LC(
"TopMenubar",
"Tuning");
178 int menubar_num_buttons = 5;
179 float menubar_content_width =
180 ImGui::CalcTextSize(sim_title.c_str()).x +
181 ImGui::CalcTextSize(actors_title.c_str()).x +
182 ImGui::CalcTextSize(savegames_title.c_str()).x +
183 ImGui::CalcTextSize(settings_title.c_str()).x +
184 ImGui::CalcTextSize(tools_title.c_str()).x;
188 menubar_num_buttons += 1;
189 menubar_content_width += ImGui::CalcTextSize(ai_title.c_str()).x;
194 menubar_num_buttons += 1;
195 menubar_content_width += ImGui::CalcTextSize(tuning_title.c_str()).x;
198 menubar_content_width +=
199 (ImGui::GetStyle().ItemSpacing.x * (menubar_num_buttons - 1)) +
200 (ImGui::GetStyle().FramePadding.x * (menubar_num_buttons * 2));
202 ImVec2 window_target_pos = ImVec2((ImGui::GetIO().DisplaySize.x/2.f) - (menubar_content_width / 2.f), theme.
screen_edge_padding.y);
212 ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0,0,0,0));
215 int flags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove
216 | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_AlwaysAutoResize;
217 ImGui::SetNextWindowContentSize(ImVec2(menubar_content_width, 0.f));
218 ImGui::SetNextWindowPos(window_target_pos);
219 ImGui::Begin(
"Top menubar",
nullptr, flags);
221 if (ImGui::IsWindowHovered())
227 ImVec2 window_pos = ImGui::GetWindowPos();
228 ImVec2 sim_cursor = ImGui::GetCursorPos();
229 ImGui::Button(sim_title.c_str());
236 ImVec2 tuning_cursor = ImVec2(0, 0);
240 tuning_cursor = ImGui::GetCursorPos();
241 ImGui::Button(tuning_title.c_str());
249 ImVec2 ai_cursor = ImVec2(0, 0);
253 ai_cursor = ImGui::GetCursorPos();
254 ImGui::Button(ai_title.c_str());
264 ImVec2 actors_cursor = ImGui::GetCursorPos();
265 ImGui::Button(actors_title.c_str());
274 ImVec2 savegames_cursor = ImGui::GetCursorPos();
275 ImGui::Button(savegames_title.c_str());
282 for (
int i = 0; i <= 9; i++)
284 Ogre::String filename = Ogre::StringUtil::format(
"quicksave-%d.sav", i);
292 ImVec2 settings_cursor = ImGui::GetCursorPos();
293 ImGui::Button(settings_title.c_str());
306 ImVec2 tools_cursor = ImGui::GetCursorPos();
307 ImGui::Button(tools_title.c_str());
313 ImVec2 topmenu_final_size = ImGui::GetWindowSize();
317 this->
DrawSpecialStateBox(window_target_pos.y + topmenu_final_size.y + ImGui::GetFontSize() * 0.625f);
324 menu_pos.y = window_pos.y + sim_cursor.y +
MENU_Y_OFFSET * ImGui::GetFontSize();
325 menu_pos.x = sim_cursor.x + window_pos.x - ImGui::GetStyle().WindowPadding.x;
326 ImGui::SetNextWindowPos(menu_pos);
327 if (ImGui::Begin(
_LC(
"TopMenubar",
"Sim menu"),
nullptr,
static_cast<ImGuiWindowFlags_
>(flags)))
331 if (ImGui::Button(
_LC(
"TopMenubar",
"Get new vehicle")))
340 if (current_actor !=
nullptr)
342 if (ImGui::Button(
_LC(
"TopMenubar",
"Show vehicle description")))
349 if (ImGui::Button(
_LC(
"TopMenubar",
"Reload current vehicle")))
357 if (ImGui::Button(
_LC(
"TopMenubar",
"Remove current vehicle")))
365 if (ImGui::Button(
_LC(
"TopMenubar",
"Activate last spawned vehicle")))
373 if (ImGui::Button(
_LC(
"TopMenubar",
"Reload last spawned vehicle")))
381 if (ImGui::Button(
_LC(
"TopMenubar",
"Remove last spawned vehicle")))
390 if (ImGui::Button(
_LC(
"TopMenubar",
"Remove all vehicles")))
397 if (ImGui::Button(
_LC(
"TopMenubar",
" [!] Confirm removal")))
401 if (!actor->ar_hide_in_actor_list && !actor->isPreloadedWithTerrain() &&
409 ImGui::PopStyleColor();
412 if (ImGui::Button(
_LC(
"TopMenubar",
"Activate all vehicles")))
418 if (ImGui::Checkbox(
_LC(
"TopMenubar",
"Activated vehicles never sleep"), &force_trucks_active))
423 if (ImGui::Button(
_LC(
"TopMenubar",
"Send all vehicles to sleep")))
431 if (ImGui::Button(
_LC(
"TopMenubar",
"Reload current terrain")))
442 &&
App::GetGameContext()->GetTerrain()->getCacheEntry()->resource_bundle_type ==
"FileSystem"
443 && ImGui::Button(
_LC(
"TopMenubar",
"Save changes to terrain")))
452 if (ImGui::Button(
_LC(
"TopMenubar",
"Back to menu")))
462 if (ImGui::Button(
_LC(
"TopMenubar",
"Exit")))
476 menu_pos.y = window_pos.y + actors_cursor.y +
MENU_Y_OFFSET * ImGui::GetFontSize();
477 menu_pos.x = actors_cursor.x + window_pos.x - ImGui::GetStyle().WindowPadding.x;
478 ImGui::SetNextWindowPos(menu_pos);
479 if (ImGui::Begin(
_LC(
"TopMenubar",
"Actors menu"),
nullptr,
static_cast<ImGuiWindowFlags_
>(flags)))
492 for (
auto& user: remote_users)
507 menu_pos.y = window_pos.y + savegames_cursor.y +
MENU_Y_OFFSET * ImGui::GetFontSize();
508 menu_pos.x = savegames_cursor.x + window_pos.x - ImGui::GetStyle().WindowPadding.x;
509 ImGui::SetNextWindowPos(menu_pos);
510 if (ImGui::Begin(
_LC(
"TopMenubar",
"Savegames"),
nullptr,
static_cast<ImGuiWindowFlags_
>(flags)))
512 if (ImGui::Button(
_LC(
"TopMenubar",
"Quicksave")))
522 if (ImGui::Button(
_LC(
"TopMenubar",
"Quickload")))
533 ImGui::TextColored(
GRAY_HINT_TEXT,
"%s",
_LC(
"TopMenubar",
"(Save with CTRL+ALT+1..5)"));
534 for (
int i = 1; i <= 5; i++)
536 Ogre::String name =
_LC(
"TopMenubar",
"Empty Slot");
541 Ogre::String caption = Ogre::StringUtil::format(
"%d. %s##Save", i, name.c_str());
542 if (ImGui::Button(caption.c_str()))
544 Ogre::String filename = Ogre::StringUtil::format(
"quicksave-%d.sav", i);
550 ImGui::TextColored(
GRAY_HINT_TEXT,
"%s",
_LC(
"TopMenubar",
"(Load with ALT+1..5)"));
551 for (
int i = 1; i <= 5; i++)
556 Ogre::String caption = Ogre::StringUtil::format(
"%d. %s##Load", i, name.c_str());
557 if (ImGui::Button(caption.c_str()))
559 Ogre::String filename = Ogre::StringUtil::format(
"quicksave-%d.sav", i);
575 menu_pos.y = window_pos.y + settings_cursor.y +
MENU_Y_OFFSET * ImGui::GetFontSize();
576 menu_pos.x = settings_cursor.x + window_pos.x - ImGui::GetStyle().WindowPadding.x;
577 ImGui::SetNextWindowPos(menu_pos);
578 if (ImGui::Begin(
_LC(
"TopMenubar",
"Settings menu"),
nullptr,
static_cast<ImGuiWindowFlags_
>(flags)))
582 ImGui::PushItemWidth(ImGui::GetFontSize() * 7.8125f);
588 ImGui::TextColored(
GRAY_HINT_TEXT,
"%s",
_LC(
"TopMenubar",
"Frames per second:"));
598 float slowmotion = std::min(
App::GetGameContext()->GetActorManager()->GetSimulationSpeed(), 1.0f);
599 if (ImGui::SliderFloat(
_LC(
"TopMenubar",
"Slow motion"), &slowmotion, 0.01f, 1.0f))
603 float timelapse = std::max(
App::GetGameContext()->GetActorManager()->GetSimulationSpeed(), 1.0f);
604 if (ImGui::SliderFloat(
_LC(
"TopMenubar",
"Time lapse"), &timelapse, 1.0f, 10.0f))
624 if (ImGui::SliderInt(
_LC(
"TopMenubar",
"FOV"), &fov, 10, 120))
632 if (ImGui::SliderInt(
_LC(
"TopMenubar",
"FOV"), &fov, 10, 120))
668 ImGui::PushID(
"waves");
679 if (current_actor !=
nullptr)
682 ImGui::TextColored(
GRAY_HINT_TEXT,
"%s",
_LC(
"TopMenubar",
"Vehicle control options:"));
694 ImGui::PopItemWidth();
704 menu_pos.y = window_pos.y + tools_cursor.y +
MENU_Y_OFFSET * ImGui::GetFontSize();
705 menu_pos.x = tools_cursor.x + window_pos.x - ImGui::GetStyle().WindowPadding.x;
706 ImGui::SetNextWindowPos(menu_pos);
707 if (ImGui::Begin(
_LC(
"TopMenubar",
"Tools menu"),
nullptr,
static_cast<ImGuiWindowFlags_
>(flags)))
709 if (ImGui::Button(
_LC(
"TopMenubar",
"Friction settings")))
715 if (ImGui::Button(
_LC(
"TopMenubar",
"Show console")))
721 if (ImGui::Button(
_LC(
"TopMenubar",
"Texture tool")))
727 if (ImGui::Button(
_LC(
"TopMenubar",
"Collisions debug")))
733 if (current_actor !=
nullptr)
735 if (ImGui::Button(
_LC(
"TopMenubar",
"Node / Beam utility")))
741 if (ImGui::Button(
_LC(
"TopMenubar",
"FlexBody debug")))
748 if (ImGui::Button(
_LC(
"TopMenubar",
"Browse gadgets ...")))
754 if (ImGui::Button(
_LC(
"TopMenubar",
"Browse repository ...")))
761 ImGui::TextColored(
GRAY_HINT_TEXT,
"%s",
_LC(
"TopMenubar",
"Pre-spawn diag. options:"));
764 if (ImGui::Checkbox(
_LC(
"TopMenubar",
"Node mass recalc. logging"), &diag_mass))
768 if (ImGui::IsItemHovered())
770 ImGui::BeginTooltip();
771 ImGui::Text(
"%s",
_LC(
"TopMenubar",
"Extra logging on runtime - mass recalculation"));
776 if (ImGui::Checkbox(
_LC(
"TopMenubar",
"Beam break logging"), &diag_break))
780 if (ImGui::IsItemHovered())
782 ImGui::BeginTooltip();
783 ImGui::Text(
"%s",
_LC(
"TopMenubar",
"Extra logging on runtime"));
788 if (ImGui::Checkbox(
_LC(
"TopMenubar",
"Beam deform. logging"), &diag_deform))
792 if (ImGui::IsItemHovered())
794 ImGui::BeginTooltip();
795 ImGui::Text(
"%s",
_LC(
"TopMenubar",
"Extra logging on runtime"));
800 if (ImGui::Checkbox(
_LC(
"TopMenubar",
"Trigger logging"), &diag_trig))
804 if (ImGui::IsItemHovered())
806 ImGui::BeginTooltip();
807 ImGui::Text(
"%s",
_LC(
"TopMenubar",
"Extra logging on runtime - trigger beams activity"));
812 if (ImGui::Checkbox(
_LC(
"TopMenubar",
"VideoCamera direction marker"), &diag_vcam))
816 if (ImGui::IsItemHovered())
818 ImGui::BeginTooltip();
819 ImGui::Text(
"%s",
_LC(
"TopMenubar",
"Visual marker of VideoCameras direction"));
823 ImGui::PushItemWidth(ImGui::GetFontSize() * 7.8125f);
827 if (ImGui::IsItemHovered())
829 ImGui::BeginTooltip();
830 ImGui::Text(
"%s",
_LC(
"TopMenubar",
"1 = Solid"));
831 ImGui::Text(
"%s",
_LC(
"TopMenubar",
"2 = Wireframe"));
832 ImGui::Text(
"%s",
_LC(
"TopMenubar",
"3 = Points"));
845 menu_pos.y = window_pos.y + ai_cursor.y +
MENU_Y_OFFSET * ImGui::GetFontSize();
846 menu_pos.x = ai_cursor.x + window_pos.x - ImGui::GetStyle().WindowPadding.x;
847 ImGui::SetNextWindowPos(menu_pos);
848 if (ImGui::Begin(
_LC(
"TopMenubar",
"AI menu"),
nullptr,
static_cast<ImGuiWindowFlags_
>(flags)))
850 if (ImGui::IsWindowHovered())
855 ImGui::PushItemWidth(ImGui::GetFontSize() * 7.8125f);
864 ImGui::PushItemFlag(ImGuiItemFlags_Disabled,
true);
865 ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f);
868 ImGui::InputInt(
_LC(
"TopMenubar",
"Vehicle count"), &
ai_num, 1, 100);
869 if (ImGui::IsItemHovered())
871 ImGui::BeginTooltip();
872 ImGui::Text(
"%s",
_LC(
"TopMenubar",
"Number of vehicles"));
878 ImGui::PopItemFlag();
879 ImGui::PopStyleVar();
884 ImGui::PushItemFlag(ImGuiItemFlags_Disabled,
true);
885 ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f);
890 ImGui::PushItemFlag(ImGuiItemFlags_Disabled,
true);
891 ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f);
894 ImGui::InputInt(
_LC(
"TopMenubar",
"Distance"), &
ai_distance, 1, 100);
895 if (ImGui::IsItemHovered())
897 ImGui::BeginTooltip();
898 ImGui::Text(
"%s",
_LC(
"TopMenubar",
"Following distance in meters"));
904 ImGui::PopItemFlag();
905 ImGui::PopStyleVar();
908 std::string label1 =
"Behind";
920 ImGui::PushItemFlag(ImGuiItemFlags_Disabled,
true);
921 ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f);
924 if (ImGui::BeginCombo(
"Position", label1.c_str()))
926 if (ImGui::Selectable(
"Behind"))
930 if (ImGui::Selectable(
"Parallel"))
936 if (ImGui::IsItemHovered())
938 ImGui::BeginTooltip();
939 ImGui::Text(
"%s",
_LC(
"TopMenubar",
"Positioning scheme"));
941 ImGui::Text(
"%s",
_LC(
"TopMenubar",
"Behind: Set vehicle behind vehicle, in line"));
942 ImGui::Text(
"%s",
_LC(
"TopMenubar",
"Parallel: Set vehicles in parallel, useful for certain scenarios like drag races"));
948 ImGui::PopItemFlag();
949 ImGui::PopStyleVar();
957 ImGui::PushItemFlag(ImGuiItemFlags_Disabled,
true);
958 ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f);
961 ImGui::InputInt(
_LC(
"TopMenubar",
"Repeat times"), &
ai_times, 1, 100);
962 if (ImGui::IsItemHovered())
964 ImGui::BeginTooltip();
965 ImGui::Text(
"%s",
_LC(
"TopMenubar",
"How many times to loop the path"));
971 ImGui::PopItemFlag();
972 ImGui::PopStyleVar();
977 ImGui::PopItemFlag();
978 ImGui::PopStyleVar();
984 std::string label2 =
"Normal";
991 label2 =
"Drag Race";
1004 if (actor->ar_driveable ==
AI)
1006 ImGui::PushItemFlag(ImGuiItemFlags_Disabled,
true);
1007 ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f);
1012 if (ImGui::BeginCombo(
"Mode", label2.c_str()))
1014 if (ImGui::Selectable(
"Normal"))
1027 if (ImGui::Selectable(
"Race"))
1040 if (ImGui::Selectable(
"Drag Race"))
1057 if (ImGui::Selectable(
"Crash"))
1073 if (ImGui::Selectable(
"Chase"))
1088 if (ImGui::IsItemHovered())
1090 ImGui::BeginTooltip();
1091 ImGui::Text(
"%s",
_LC(
"TopMenubar",
"Land vehicle driving mode"));
1093 ImGui::Text(
"%s",
_LC(
"TopMenubar",
"Normal: Modify speed according to turns, other vehicles and character"));
1094 ImGui::Text(
"%s",
_LC(
"TopMenubar",
"Race: Always keep defined speed"));
1095 ImGui::Text(
"%s",
_LC(
"TopMenubar",
"Drag Race: Two vehicles performing a drag race"));
1096 ImGui::Text(
"%s",
_LC(
"TopMenubar",
"Crash: Two vehicles driving in opposite direction"));
1097 ImGui::Text(
"%s",
_LC(
"TopMenubar",
"Chase: Follow character and player vehicle"));
1098 ImGui::EndTooltip();
1103 if (actor->ar_driveable ==
AI)
1105 ImGui::PopItemFlag();
1106 ImGui::PopStyleVar();
1114 ImGui::InputInt(
_LC(
"TopMenubar",
"Speed"), &
ai_speed, 1, 100);
1115 if (ImGui::IsItemHovered())
1117 ImGui::BeginTooltip();
1118 ImGui::Text(
"%s",
_LC(
"TopMenubar",
"Speed in km/h for land vehicles or knots/s for boats"));
1119 ImGui::EndTooltip();
1125 ImGui::InputInt(
_LC(
"TopMenubar",
"Altitude"), &
ai_altitude, 1, 100);
1126 if (ImGui::IsItemHovered())
1128 ImGui::BeginTooltip();
1129 ImGui::Text(
"%s",
_LC(
"TopMenubar",
"Airplane maximum altitude in feet"));
1130 ImGui::EndTooltip();
1143 if (ImGui::IsItemHovered())
1145 ImGui::BeginTooltip();
1146 ImGui::Text(
"%s",
_LC(
"TopMenubar",
"Land vehicles, boats and airplanes"));
1147 ImGui::EndTooltip();
1152 ImGui::PushID(
"vehicle2");
1161 if (ImGui::IsItemHovered())
1163 ImGui::BeginTooltip();
1164 ImGui::Text(
"%s",
_LC(
"TopMenubar",
"Land vehicles, boats and airplanes"));
1165 ImGui::EndTooltip();
1174 ImGui::PushItemFlag(ImGuiItemFlags_Disabled,
true);
1175 ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f);
1180 ImGui::PushStyleColor(ImGuiCol_Button, ImGui::GetStyle().Colors[ImGuiCol_ButtonActive]);
1183 if (ImGui::Button(
_LC(
"TopMenubar",
"Start"), ImVec2(ImGui::GetFontSize() * 5.f, 0)))
1205 fmt::format(
_LC(
"TopMenubar",
"Select a preset, record or open survey map ({}) to set waypoints."),
1219 ImGui::PopStyleColor();
1224 if (ImGui::Button(
_LC(
"TopMenubar",
"Stop All"), ImVec2(ImGui::GetFontSize() * 5.f, 0)))
1245 if (actor->ar_driveable ==
AI)
1255 ImGui::PopItemFlag();
1256 ImGui::PopStyleVar();
1261 ImGui::PushStyleColor(ImGuiCol_Button, ImGui::GetStyle().Colors[ImGuiCol_Button]);
1262 std::string label =
"Record";
1265 label =
"Recording";
1266 ImGui::PushStyleColor(ImGuiCol_Button,
RED_TEXT);
1269 if (ImGui::Button(label.c_str(), ImVec2(ImGui::GetFontSize() * 5.f, 0)))
1282 ImGui::PopStyleColor();
1285 if (ImGui::CollapsingHeader(
_LC(
"TopMenubar",
"Presets")))
1289 int display_count = 0;
1290 for (
size_t i = 0; i < num_rows; i++)
1292 rapidjson::Value& j_row =
ai_presets_all[
static_cast<rapidjson::SizeType
>(i)];
1297 if (ImGui::Button(j_row[
"preset"].GetString(), ImVec2(ImGui::GetFontSize() * 15.625f, 0)))
1301 for (
size_t i = 0; i < j_row[
"waypoints"].Size(); i++)
1303 float x = j_row[
"waypoints"][i][0].GetFloat();
1304 float y = j_row[
"waypoints"][i][1].GetFloat();
1305 float z = j_row[
"waypoints"][i][2].GetFloat();
1311 if (j_row[
"waypoints"][i].Size() == 4)
1313 speed = j_row[
"waypoints"][i][3].GetInt();
1319 waypoint.
speed = speed;
1331 float spinner_size = ImGui::GetFontSize() * 0.5f;
1332 ImGui::SetCursorPosX((ImGui::GetWindowSize().
x / 2.f) - spinner_size);
1337 ImGui::TextColored(
RED_TEXT,
"%s",
_LC(
"TopMenubar",
"Failed to fetch external presets."));
1338 if (ImGui::Button(
_LC(
"TopMenubar",
"Retry")))
1352 ImGui::Text(
"%s",
_LC(
"TopMenubar",
"No presets found for this terrain :("));
1353 ImGui::Text(
"%s",
_LC(
"TopMenubar",
"Supported terrains:"));
1356 ImGui::BeginChild(
"terrains-scrolling", ImVec2(0.f, ImGui::GetFontSize() * 12.5f),
false);
1358 for (
size_t i = 0; i < num_rows; i++)
1360 rapidjson::Value& j_row_terrains =
ai_presets_all[
static_cast<rapidjson::SizeType
>(i)];
1361 if (j_row_terrains.HasMember(
"terrains"))
1363 for (
size_t i = 0; i < j_row_terrains[
"terrains"].Size(); i++)
1365 ImGui::Text(
"%s", j_row_terrains[
"terrains"][i].GetString());
1374 if (ImGui::CollapsingHeader(
_LC(
"TopMenubar",
"Waypoints")))
1378 ImGui::Text(
"%s",
_LC(
"TopMenubar",
"No waypoints defined."));
1382 if (ImGui::Button(
_LC(
"TopMenubar",
"Export"), ImVec2(ImGui::GetFontSize() * 15.625f, 0)))
1405 std::string json = fmt::format(
"\n {{\n \"terrain\":\"{}\",\n \"preset\":\"Preset name\",\n \"waypoints\":\n [{}\n ]\n }}",
App::sim_terrain_name->getStr(), s);
1409 fmt::format(
_LC(
"TopMenubar",
"{} waypoints exported to RoR.log"),
1413 ImGui::BeginChild(
"waypoints-scrolling", ImVec2(0.f, ImGui::GetFontSize() * 12.5f),
false);
1418 ImGui::AlignTextToFramePadding();
1419 ImGui::Text(
"%d", i);
1421 if (ImGui::Button(
"teleport", ImVec2(ImGui::GetFontSize() * 3.75f, 0)))
1423 Ogre::Vector3* payload =
new Ogre::Vector3(
ai_waypoints[i].position);
1426 if (ImGui::IsItemHovered())
1428 ImGui::BeginTooltip();
1430 ImGui::Text(
w.c_str());
1431 ImGui::EndTooltip();
1434 ImGui::SetNextItemWidth(ImGui::GetFontSize() * 5.625f);
1440 ImGui::InputInt(
_LC(
"TopMenubar",
"speed"), &
ai_waypoints[i].speed, 1, 100);
1441 if (ImGui::IsItemHovered())
1443 ImGui::BeginTooltip();
1444 ImGui::Text(
_LC(
"TopMenubar",
"Set waypoint speed in km/h for land vehicles"));
1446 ImGui::Text(
_LC(
"TopMenubar",
"Value -1: Ignore, vehicle will use default speed"));
1447 ImGui::Text(
_LC(
"TopMenubar",
"Value >= 5: Override default speed"));
1448 ImGui::EndTooltip();
1457 ImGui::PopItemWidth();
1467 menu_pos.y = window_pos.y + tuning_cursor.y +
MENU_Y_OFFSET * ImGui::GetFontSize();
1468 menu_pos.x = tuning_cursor.x + window_pos.x - ImGui::GetStyle().WindowPadding.x;
1469 ImGui::SetNextWindowPos(menu_pos);
1470 if (ImGui::Begin(
_LC(
"TopMenubar",
"Tuning menu"),
nullptr,
static_cast<ImGuiWindowFlags_
>(flags)))
1476 ImGui::Text(
"%s",
_LC(
"Tuning",
"You are on foot."));
1477 ImGui::Text(
"%s",
_LC(
"Tuning",
"Enter a vehicle to tune it."));
1478 ImGui::PopStyleColor();
1489 ImGui::PushID(tuneup_result.cqr_entry->fname.c_str());
1491 ImGui::AlignTextToFramePadding();
1496 if (ImGui::Button(tuneup_result.cqr_entry->dname.c_str()))
1500 req->
mpr_subject = tuneup_result.cqr_entry->fname;
1512 std::string delbtn_text =
_LC(
"Tuning",
"Delete");
1513 float delbtn_w = ImGui::CalcTextSize(delbtn_text.c_str()).x + ImGui::GetStyle().FramePadding.x * 2;
1514 float delbtn_cursorx = ImGui::GetWindowContentRegionWidth() - delbtn_w;
1517 ImGui::SetCursorPosX(delbtn_cursorx);
1520 ImGui::PopStyleColor();
1531 ImGui::AlignTextToFramePadding();
1532 ImGui::TextDisabled(
_LC(
"Tuning",
"Working tuneup"));
1537 if (ImGui::Button(
_LC(
"Tuning",
"Save")))
1553 std::string cancelbtn_text =
_LC(
"Tuning",
"Cancel");
1554 float cancelbtn_w = ImGui::CalcTextSize(cancelbtn_text.c_str()).x + ImGui::GetStyle().FramePadding.x * 2;
1555 float cancelbtn_cursorx = ImGui::GetWindowContentRegionWidth() - cancelbtn_w;
1558 ImGui::SetCursorPosX(cancelbtn_cursorx);
1559 if (ImGui::SmallButton(
_LC(
"Tuning",
"Cancel")))
1565 else if (tuneup_def)
1568 if (ImGui::Button(
_LC(
"Tuning",
"Save as...")))
1577 ImGui::AlignTextToFramePadding();
1578 std::string resetbtn_text =
_LC(
"Tuning",
"Reset");
1579 float delbtn_w = ImGui::CalcTextSize(resetbtn_text.c_str()).x + ImGui::GetStyle().FramePadding.x * 2;
1580 float delbtn_cursorx = ImGui::GetWindowContentRegionWidth() - delbtn_w;
1583 ImGui::SetCursorPosX(delbtn_cursorx);
1586 ImGui::PopStyleColor();
1587 if (resetbtn_pressed)
1598 ImGui::SetNextItemOpen(
true, ImGuiCond_FirstUseEver);
1599 std::string addonparts_title = fmt::format(
_LC(
"TopMenubar",
"Addon parts ({})"),
tuning_addonparts.size());
1600 if (ImGui::CollapsingHeader(addonparts_title.c_str()))
1606 ImGui::PushID(addonpart_entry->
fname.c_str());
1611 const ImVec2 checkbox_cursor = ImGui::GetCursorScreenPos();
1612 if (ImGui::Checkbox(addonpart_entry->
dname.c_str(), &used)
1613 && !conflict_w_hovered
1628 const float square_sz = ImGui::GetFrameHeight();
1629 const ImVec2 min = checkbox_cursor + ImGui::GetStyle().FramePadding*1.4f;
1630 const ImVec2 max = checkbox_cursor + (ImVec2(square_sz, square_sz) - ImGui::GetStyle().FramePadding*1.5f);
1631 const ImColor X_COLOR(0.5f, 0.48f, 0.45f);
1632 ImGui::GetWindowDrawList()->AddLine(min, max, X_COLOR, ImGui::GetFontSize() * 0.25f);
1633 ImGui::GetWindowDrawList()->AddLine(ImVec2(min.x, max.y), ImVec2(max.x, min.y), X_COLOR, ImGui::GetFontSize() * 0.25f);
1635 if (conflict_w_hovered)
1638 const float square_sz = ImGui::GetFrameHeight();
1639 const ImVec2 min = checkbox_cursor;
1640 const ImVec2 max = checkbox_cursor + ImVec2(square_sz + 0.5f, square_sz);
1641 const ImColor SQ_COLOR(0.7f, 0.1f, 0.f);
1642 ImGui::GetWindowDrawList()->AddRect(min, max, SQ_COLOR, 0.f, ImDrawCornerFlags_None, ImGui::GetFontSize() * 0.1875f);
1645 if (ImGui::IsItemHovered())
1657 ImGui::AlignTextToFramePadding();
1658 std::string reloadbtn_text =
_LC(
"Tuning",
"Reload");
1659 const float reloadbtn_w = ImGui::CalcTextSize(reloadbtn_text.c_str()).x + ImGui::GetStyle().FramePadding.x * 2;
1661 ImGui::SetCursorPosX(reloadbtn_cursorx);
1662 const bool reloadbtn_pressed = ImGui::SmallButton(reloadbtn_text.c_str());
1663 if (reloadbtn_pressed)
1686 if (ImGui::Button(
_LC(
"Tuning",
"Browse all parts")))
1696 std::string props_title = fmt::format(
_LC(
"Tuning",
"Props ({})"), total_props);
1697 if (ImGui::CollapsingHeader(props_title.c_str()))
1702 ImGui::PushID(p.pp_id);
1703 ImGui::AlignTextToFramePadding();
1716 if (p.pp_beacon_type ==
'L' || p.pp_beacon_type ==
'R' || p.pp_beacon_type ==
'w')
1719 ImGui::TextDisabled(
"(special!)");
1720 if (ImGui::IsItemHovered())
1722 ImGui::BeginTooltip();
1723 ImGui::Text(
"special prop - aerial nav light");
1724 ImGui::EndTooltip();
1727 else if (p.pp_wheel_mesh_obj)
1730 ImGui::TextDisabled(
"(special!)");
1731 if (ImGui::IsItemHovered())
1733 ImGui::BeginTooltip();
1734 ImGui::Text(
"special prop - dashboard + dirwheel");
1735 ImGui::EndTooltip();
1754 std::string flexbodies_title = fmt::format(
_LC(
"Tuning",
"Flexbodies ({})"), total_flexbodies);
1755 if (ImGui::CollapsingHeader(flexbodies_title.c_str()))
1760 ImGui::PushID(flexbody->getID());
1761 ImGui::AlignTextToFramePadding();
1767 flexbody->getOrigMeshName(),
1785 std::string wheels_title = fmt::format(
_LC(
"TopMenubar",
"Wheels ({})"), total_wheels);
1786 if (ImGui::CollapsingHeader(wheels_title.c_str()))
1788 for (
WheelID_t i = 0; i < total_wheels; i++)
1791 ImGui::AlignTextToFramePadding();
1799 ImGui::PushStyleColor(ImGuiCol_Border,
ORANGE_TEXT);
1800 ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.f);
1807 ImGui::TextDisabled(
"|");
1818 bool resetPressed =
false;
1824 resetPressed = ImGui::SmallButton(
_LC(
"Tuning",
"Reset"));
1825 ImGui::PopStyleColor();
1826 ImGui::PopStyleVar();
1827 ImGui::PopStyleColor();
1831 if (selected_side != active_side)
1840 else if (resetPressed)
1861 std::string flares_title = fmt::format(
_LC(
"Tuning",
"Flares ({})"), total_flares);
1862 if (ImGui::CollapsingHeader(flares_title.c_str()))
1867 ImGui::PushID(flareid);
1868 ImGui::AlignTextToFramePadding();
1874 std::string flarename;
1878 flarename = fmt::format(
"{} {}", (
char)flaretype, controlnumber);
1883 flarename = fmt::format(
"{} {}", (
char)flaretype, linkname);
1887 flarename = fmt::format(
"{}", (
char)flaretype);
1910 std::string exhausts_title = fmt::format(
_LC(
"Tuning",
"Exhausts ({})"), total_exhausts);
1911 if (ImGui::CollapsingHeader(exhausts_title.c_str()))
1914 for (
ExhaustID_t exhaustid = 0; exhaustid < (int)total_exhausts; exhaustid++)
1916 ImGui::PushID(exhaustid);
1917 ImGui::AlignTextToFramePadding();
1941 std::string materials_title = fmt::format(
_LC(
"Tuning",
"Managed Materials ({})"), total_materials);
1942 if (ImGui::CollapsingHeader(materials_title.c_str()))
1947 const std::string& material_name = mm_pair.first;
1948 ImGui::PushID(material_name.c_str());
1949 ImGui::AlignTextToFramePadding();
1972 std::string videocameras_title = fmt::format(
_LC(
"Tuning",
"Videocameras ({})"), total_videocameras);
1973 if (ImGui::CollapsingHeader(videocameras_title.c_str()))
1976 for (
VideoCameraID_t videocameraid = 0; videocameraid < (int)total_videocameras; videocameraid++)
1978 ImGui::PushID(videocameraid);
1979 ImGui::AlignTextToFramePadding();
1987 ImGui::Dummy(ImVec2(ImGui::GetFontSize() * 0.1875f, ImGui::GetFontSize() * 0.1875f));
1996 ImGui::PushStyleColor(ImGuiCol_Border,
ORANGE_TEXT);
1997 ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.f);
2003 bool checkbox_pressed =
false;
2005 if ((is_mirror_flip || is_mirror_noflip))
2008 bool checkbox_checked = is_mirror_flip;
2009 checkbox_pressed = ImGui::Checkbox(
_LC(
"Tuning",
"Flipped"), &checkbox_checked);
2027 default: ImGui::TextDisabled(
_LC(
"Tuning",
"(Videocamera)"));
break;
2033 bool reset_pressed =
false;
2039 reset_pressed = ImGui::SmallButton(
_LC(
"Tuning",
"Reset"));
2040 ImGui::PopStyleColor();
2041 ImGui::PopStyleVar();
2042 ImGui::PopStyleColor();
2046 if (checkbox_pressed)
2055 else if (reset_pressed)
2083 ImGui::PopStyleColor(2);
2275 float content_width = 0.f;
2277 std::string special_text;
2278 ImVec4 special_color = ImGui::GetStyle().Colors[ImGuiCol_Text];
2279 float special_text_centering_weight = 1.f;
2281 std::string special_text_b;
2282 std::string special_text_c;
2283 std::string special_text_d;
2284 ImVec4 special_color_c = ImVec4(0,0,0,0);
2291 special_text = fmt::format(
_LC(
"TopMenubar",
"All physics paused, press {} to resume"),
2293 content_width = ImGui::CalcTextSize(special_text.c_str()).x;
2300 special_text = fmt::format(
_LC(
"TopMenubar",
"Vehicle physics paused, press {} to resume"),
2302 content_width = ImGui::CalcTextSize(special_text.c_str()).x;
2307 content_width = ImGui::GetFontSize() * 18.75f;
2309 special_text =
_LC(
"TopMenubar",
"Replay");
2313 special_text = fmt::format(
_LC(
"TopMenubar",
"Live repair mode, hit '{}' to stop"),
2315 content_width = ImGui::GetFontSize() * 28.125f;
2318 special_text_centering_weight = 0.7f;
2322 special_text = fmt::format(
_LC(
"TopMenubar",
"Quick repair ('{}' for Live repair)"),
2324 content_width = ImGui::GetFontSize() * 28.125f;
2327 special_text_centering_weight = 0.7f;
2336 float distance = 0.0f;
2350 special_text_b = fmt::format(
"{:.1f} {}", distance,
_LC(
"DirectionArrow",
"meter"));
2351 content_width = ImGui::CalcTextSize(special_text.c_str()).x + ImGui::CalcTextSize(special_text_b.c_str()).x;
2354 special_text_c = fmt::format(
"{:02d}.{:02d}.{:02d}", (
int)(time) / 60, (
int)(time) % 60, (
int)(time * 100.0) % 100);
2356 special_color_c = (time_diff > 0.0f)
2363 special_text_d = fmt::format(
"{:02d}.{:02d}.{:02d}", (
int)(best_time) / 60, (
int)(best_time) % 60, (
int)(best_time * 100.0) % 100);
2369 special_text = fmt::format(
_LC(
"TopMenubar",
"Terrain editing mode, press {} to exit"),
2375 content_width = ImGui::CalcTextSize(special_text.c_str()).x + ImGui::GetFontSize() * 1.5625f;
2380 special_text = fmt::format(
_LC(
"TopMenubar",
"Terrain editing mode, press {} to exit"),
2382 content_width = ImGui::CalcTextSize(special_text.c_str()).x;
2388 if (!special_text.empty())
2391 box_pos.y = top_offset;
2392 box_pos.x = (ImGui::GetIO().DisplaySize.x / 2) - ((content_width / 2) + ImGui::GetStyle().FramePadding.x);
2393 ImGui::SetNextWindowPos(box_pos);
2394 ImGui::SetNextWindowSize(ImVec2(0.f, 0.f));
2395 ImGui::SetNextWindowContentWidth(content_width);
2396 ImGuiWindowFlags flags = ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove |
2397 ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse;
2398 ImGui::PushStyleColor(ImGuiCol_WindowBg,
App::GetGuiManager()->GetTheme().semitransparent_window_bg);
2399 if (ImGui::Begin(special_text.c_str(),
nullptr, flags))
2404 float text_w = ImGui::CalcTextSize(special_text.c_str()).x;
2405 ImGui::SetCursorPosX(((content_width / 2) - (text_w / 2)) * special_text_centering_weight);
2407 ImGui::TextColored(special_color,
"%s", special_text.c_str());
2417 float pbar_width = content_width - (ImGui::GetStyle().ItemSpacing.x + ImGui::CalcTextSize(special_text.c_str()).x);
2418 ImGui::ProgressBar(fraction, ImVec2(pbar_width, ImGui::GetTextLineHeight()), pbar_text.
ToCStr());
2426 int min = (int)time_sec / 60;
2427 str_pos = snprintf(str, 200,
"%dmin ", min);
2428 time_sec -= (float)min * 60.f;
2430 snprintf(str+str_pos, 200-str_pos,
"%.2fsec", time_sec);
2431 ImGui::TextDisabled(
"%s: %s",
_LC(
"TopMenubar",
"Time"), str);
2437 ImGui::Text(special_text_b.c_str());
2438 ImGui::SetCursorPosX((ImGui::GetWindowSize().
x / 2) - (ImGui::CalcTextSize(special_text_c.c_str()).x / 2));
2439 ImGui::TextColored(special_color_c,
"%s", special_text_c.c_str());
2442 text <<
"Best Time: " << special_text_d.c_str();
2443 ImGui::SetCursorPosX((ImGui::GetWindowSize().
x / 2) - (ImGui::CalcTextSize(text).
x / 2));
2445 if (!special_text_d.empty())
2447 ImGui::TextDisabled(text);
2454 ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(ImGui::GetFontSize() * 0.125f, 0.f));
2458 ImGui::ProgressBar(fraction, ImVec2(ImGui::GetFontSize() * 0.9375f, ImGui::GetTextLineHeight() / 2.f),
"");
2462 ImGui::PopStyleVar();
2464 const ImVec2 MINI_SPACING = ImVec2(ImGui::GetFontSize() * 0.125f, 0.f);
2465 ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, MINI_SPACING);
2469 const float INDENT = ImGui::GetFontSize() * 0.9375f;
2471 ImGui::TextDisabled(
"%s:",
_LC(
"LiveRepair",
"Movement"));
2473 ImGui::SetColumnWidth(0, INDENT);
2474 ImGui::NextColumn();
2477 ImGui::NextColumn();
2480 ImGui::NextColumn();
2485 ImGui::TextDisabled(
"%s:",
_LC(
"LiveRepair",
"Rotation"));
2487 ImGui::SetColumnWidth(0, INDENT);
2488 ImGui::NextColumn();
2493 ImGui::TextDisabled(
"%s:",
_LC(
"LiveRepair",
"Modifiers"));
2495 ImGui::SetColumnWidth(0, INDENT);
2496 ImGui::SetColumnWidth(1, ImGui::GetFontSize() * 7.8125f);
2497 ImGui::SetColumnWidth(2, ImGui::GetFontSize() * 7.8125f);
2498 ImGui::NextColumn();
2505 ImGui::TextDisabled(
"%s (%s):",
_LC(
"LiveRepair",
"Reset mode"),
ToLocalizedString(resetmode).c_str());
2506 ImGui::Dummy(ImVec2(INDENT, 1.f));
2510 ImGui::PopStyleVar();
2516 std::string lbl_readonly =
_LC(
"TopMenubar",
"This terrain is read only.");
2517 ImGui::SetCursorPosX(ImGui::GetCursorPosX()
2518 + (ImGui::GetWindowContentRegionWidth() / 2 - ImGui::CalcTextSize(lbl_readonly.c_str()).x/2));
2519 ImGui::TextDisabled(
"%s", lbl_readonly.c_str());
2521 ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.2, 0.2, 0.2, 1.0));
2522 std::string btn_import =
_LC(
"TopMenubar",
"Import as editable project.");
2523 ImGui::SetCursorPosX(ImGui::GetCursorPosX()
2524 + ((ImGui::GetWindowContentRegionWidth() / 2 - ImGui::CalcTextSize(btn_import.c_str()).x / 2) - ImGui::GetStyle().FramePadding.x));
2533 ImGui::PopStyleColor();
2538 std::string lbl_usemenu =
_LC(
"TopMenubar",
"Use 'Simulation' menu to save changes.");
2539 ImGui::SetCursorPosX(ImGui::GetCursorPosX()
2540 + (ImGui::GetWindowContentRegionWidth() / 2 - ImGui::CalcTextSize(lbl_usemenu.c_str()).x / 2));
2541 ImGui::TextDisabled(
"%s", lbl_usemenu.c_str());
2543 const ImVec2 PAD = ImVec2(ImGui::GetFontSize() * 0.3125f, ImGui::GetFontSize() * 0.3125f);
2551 ImGui::PopStyleColor(1);