1212#include " weapon/weapon.h"
1313#include " mission/missionload.h"
1414#include " prop/prop.h"
15+ #include " controlconfig/controlsconfig.h"
1516
1617using namespace ImGui ;
1718
19+ namespace {
20+ SCP_string get_binding_text (int action_id)
21+ {
22+ const auto & action = Control_config[action_id];
23+
24+ if (!action.first .empty () && !action.second .empty ()) {
25+ return action.first .textify () + " or " + action.second .textify ();
26+ }
27+
28+ if (!action.first .empty ()) {
29+ return action.first .textify ();
30+ }
31+
32+ if (!action.second .empty ()) {
33+ return action.second .textify ();
34+ }
35+
36+ return " Unbound" ;
37+ }
38+
39+ void controls_reference_entry (const char * label, const SCP_string& description)
40+ {
41+ Bullet ();
42+ SameLine ();
43+ TextWrapped (" %s: %s" , label, description.c_str ());
44+ }
45+
46+ void controls_reference_entry (const char * label, const char * description)
47+ {
48+ Bullet ();
49+ SameLine ();
50+ TextWrapped (" %s: %s" , label, description);
51+ }
52+ } // namespace
53+
1854std::map<animation::ModelAnimationTriggerType, std::map<SCP_string, bool >> manual_animation_triggers = {};
1955std::map<animation::ModelAnimationTriggerType, bool > manual_animations = {};
2056
@@ -269,6 +305,8 @@ void LabUi::build_options_menu()
269305 MenuItem (" Object selector" , nullptr , &show_object_selection_dialog);
270306 MenuItem (" Background selector" , nullptr , &show_background_selection_dialog);
271307 MenuItem (" Object options" , nullptr , &show_object_options_dialog);
308+ MenuItem (" Controls reference" , nullptr , &show_controls_reference_dialog);
309+ MenuItem (" Reset View" , nullptr , &reset_view);
272310 MenuItem (" Close lab" , " ESC" , &close_lab);
273311 }
274312}
@@ -280,6 +318,11 @@ void LabUi::build_toolbar_entries()
280318 build_options_menu ();
281319 }
282320
321+ if (reset_view) {
322+ getLabManager ()->Renderer ->resetView ();
323+ reset_view = false ;
324+ }
325+
283326 if (close_lab) {
284327 getLabManager ()->notify_close ();
285328 close_lab = false ;
@@ -330,9 +373,45 @@ void LabUi::create_ui()
330373 if (show_object_selection_dialog)
331374 show_object_selector ();
332375
376+ if (show_controls_reference_dialog)
377+ show_controls_reference ();
378+
333379 rebuild_after_object_change = false ;
334380}
335381
382+ void LabUi::show_controls_reference ()
383+ {
384+ with_Window (" Lab controls reference" )
385+ {
386+ TextWrapped (" Mouse controls" );
387+ controls_reference_entry (" LMB + drag" , " Orient the displayed object." );
388+ controls_reference_entry (" RMB + drag" , " Rotate the camera." );
389+ controls_reference_entry (" Shift + RMB + drag" , " Pan the camera on the X/Y plane." );
390+ controls_reference_entry (" Mouse wheel" , " Zoom the camera in or out." );
391+ TextWrapped (" Rotation axis limits and rotation speed apply only to object orientation (LMB), not "
392+ " camera controls (RMB)." );
393+
394+ Separator ();
395+ TextWrapped (" Keyboard shortcuts" );
396+ controls_reference_entry (" R" , " Cycle object orientation (LMB) axis mode (Yaw, Pitch, Roll, or Both)." );
397+ controls_reference_entry (" S" , " Cycle object orientation (LMB) speed." );
398+ controls_reference_entry (" V" , " Reset camera view." );
399+ controls_reference_entry (" T / Y" , " Cycle team color presets." );
400+ controls_reference_entry (" 1-9" , " Switch anti-aliasing presets." );
401+ controls_reference_entry (" M" , " Export an environment map." );
402+ controls_reference_entry (" ESC" , " Close the lab." );
403+
404+ if (getLabManager ()->CurrentMode == LabMode::Ship) {
405+ Separator ();
406+ TextWrapped (" Ship-only controls (from current control bindings)" );
407+ // These don't work in the new lab yet
408+ // controls_reference_entry("Increase throttle by 5%", get_binding_text(PLUS_5_PERCENT_THROTTLE));
409+ // controls_reference_entry("Decrease throttle by 5%", get_binding_text(MINUS_5_PERCENT_THROTTLE));
410+ controls_reference_entry (" Afterburner" , get_binding_text (AFTERBURNER));
411+ }
412+ }
413+ }
414+
336415const char * antialiasing_settings[] = {
337416 " None" ,
338417 " FXAA Low" ,
@@ -604,7 +683,7 @@ void LabUi::show_render_options()
604683 getLabManager ()->Renderer ->setRenderFlag (LabRenderFlag::NoLighting, no_lighting);
605684 getLabManager ()->Renderer ->setRenderFlag (LabRenderFlag::ShowFullDetail, show_full_detail);
606685 getLabManager ()->Renderer ->setRenderFlag (LabRenderFlag::ShowThrusters, show_thrusters);
607- getLabManager ()->Renderer ->setRenderFlag (LabRenderFlag::ShowAfterburners, show_afterburners);
686+ getLabManager ()->Renderer ->setRenderFlag (LabRenderFlag::ShowAfterburners, show_afterburners || getLabManager ()-> Lab_thrust_afterburn );
608687 getLabManager ()->Renderer ->setRenderFlag (LabRenderFlag::ShowWeapons, show_weapons);
609688 getLabManager ()->Renderer ->setRenderFlag (LabRenderFlag::ShowEmissiveLighting, show_emissive_lighting);
610689 getLabManager ()->Renderer ->setRenderFlag (LabRenderFlag::MoveSubsystems, animate_subsystems);
0 commit comments