@@ -95,10 +95,10 @@ void LabUi::build_weapon_list() const
9595{
9696 // weapon display needs to be rethought
9797
98- // with_TreeNode("Weapon Classes")
99- // {
100- // build_weapon_subtype_list();
101- // }
98+ with_TreeNode (" Weapon Classes" )
99+ {
100+ build_weapon_subtype_list ();
101+ }
102102}
103103
104104void LabUi::build_background_list () const
@@ -342,13 +342,17 @@ void LabUi::show_render_options()
342342
343343 with_CollapsingHeader (" Model features" )
344344 {
345- Checkbox (" Rotate/Translate Subsystems" , &animate_subsystems);
345+ if (getLabManager ()->CurrentMode == LabMode::Ship) {
346+ Checkbox (" Rotate/Translate Subsystems" , &animate_subsystems);
347+ }
346348 Checkbox (" Show full detail" , &show_full_detail);
347349 Checkbox (" Show thrusters" , &show_thrusters);
348- Checkbox (" Show afterburners" , &show_afterburners);
349- Checkbox (" Show weapons" , &show_weapons);
350- Checkbox (" Show Insignia" , &show_insignia);
351- Checkbox (" Show damage lightning" , &show_damage_lightning);
350+ if (getLabManager ()->CurrentMode == LabMode::Ship) {
351+ Checkbox (" Show afterburners" , &show_afterburners);
352+ Checkbox (" Show weapons" , &show_weapons);
353+ Checkbox (" Show Insignia" , &show_insignia);
354+ Checkbox (" Show damage lightning" , &show_damage_lightning);
355+ }
352356 Checkbox (" No glowpoints" , &no_glowpoints);
353357 }
354358
@@ -372,6 +376,7 @@ void LabUi::show_render_options()
372376 with_CollapsingHeader (" Scene rendering options" )
373377 {
374378 Checkbox (" Hide Post Processing" , &hide_post_processing);
379+ Checkbox (" Hide particles" , &no_particles);
375380 Checkbox (" Render as wireframe" , &use_wireframe_rendering);
376381 Checkbox (" Render without light" , &no_lighting);
377382 Checkbox (" Render with emissive lighting" , &show_emissive_lighting);
@@ -487,6 +492,7 @@ void LabUi::show_render_options()
487492 getLabManager ()->Renderer ->setRenderFlag (LabRenderFlag::ShowWeapons, show_weapons);
488493 getLabManager ()->Renderer ->setRenderFlag (LabRenderFlag::ShowEmissiveLighting, show_emissive_lighting);
489494 getLabManager ()->Renderer ->setRenderFlag (LabRenderFlag::MoveSubsystems, animate_subsystems);
495+ getLabManager ()->Renderer ->setRenderFlag (LabRenderFlag::NoParticles, no_particles);
490496 getLabManager ()->Renderer ->setEmissiveFactor (emissive_factor);
491497 getLabManager ()->Renderer ->setAmbientFactor (ambient_factor);
492498 getLabManager ()->Renderer ->setLightFactor (light_factor);
@@ -523,7 +529,7 @@ void LabUi::do_triggered_anim(animation::ModelAnimationTriggerType type,
523529 TextUnformatted (colB); \
524530
525531
526- void LabUi::build_table_info_txtbox (ship_info* sip) const
532+ static void build_ship_table_info_txtbox (ship_info* sip)
527533{
528534 with_TreeNode (" Table information" )
529535 {
@@ -543,6 +549,26 @@ void LabUi::build_table_info_txtbox(ship_info* sip) const
543549 }
544550}
545551
552+ static void build_weapon_table_info_txtbox (weapon_info* wip)
553+ {
554+ with_TreeNode (" Table information" )
555+ {
556+ // Cache result across frames for performance
557+ static SCP_string table_text;
558+ static int old_class = getLabManager ()->CurrentClass ;
559+
560+ if (table_text.length () == 0 || old_class != getLabManager ()->CurrentClass ) {
561+ table_text = get_weapon_table_text (wip);
562+ }
563+
564+ InputTextMultiline (" ##weapon_table_text" ,
565+ const_cast <char *>(table_text.c_str ()),
566+ table_text.length (),
567+ ImVec2 (-FLT_MIN , GetTextLineHeight () * 16 ),
568+ ImGuiInputTextFlags_ReadOnly);
569+ }
570+ }
571+
546572void LabUi::build_model_info_box_actual (ship_info* sip, polymodel* pm) const
547573{
548574 ImGuiTableFlags flags = ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg;
@@ -751,15 +777,9 @@ void LabUi::build_weapon_options(ship* shipp) const {
751777
752778 build_primary_weapon_combobox (text, wip, primary_slot);
753779 SameLine ();
754- static bool should_fire[MAX_SHIP_PRIMARY_BANKS ] = {false , false , false };
755780 SCP_string cb_text;
756781 sprintf (cb_text, " Fire bank %i" , bank);
757- Checkbox (cb_text.c_str (), &should_fire[bank]);
758- if (should_fire[bank]) {
759- getLabManager ()->FirePrimaries |= 1 << bank;
760- } else {
761- getLabManager ()->FirePrimaries &= ~(1 << bank);
762- }
782+ Checkbox (cb_text.c_str (), &getLabManager ()->FirePrimaries [bank]);
763783
764784 bank++;
765785 }
@@ -777,15 +797,9 @@ void LabUi::build_weapon_options(ship* shipp) const {
777797 sprintf (text, " ##Secondary bank %i" , bank);
778798 build_secondary_weapon_combobox (text, wip, secondary_slot);
779799 SameLine ();
780- static bool should_fire[MAX_SHIP_SECONDARY_BANKS ] = {false , false , false , false };
781800 SCP_string cb_text;
782801 sprintf (cb_text, " Fire bank %i##secondary" , bank);
783- Checkbox (cb_text.c_str (), &should_fire[bank]);
784- if (should_fire[bank]) {
785- getLabManager ()->FireSecondaries |= 1 << bank;
786- } else {
787- getLabManager ()->FireSecondaries &= ~(1 << bank);
788- }
802+ Checkbox (cb_text.c_str (), &getLabManager ()->FireSecondaries [bank]);
789803
790804 bank++;
791805 }
@@ -1127,7 +1141,7 @@ void LabUi::show_object_options() const
11271141
11281142 with_CollapsingHeader (sip->name )
11291143 {
1130- build_table_info_txtbox (sip);
1144+ build_ship_table_info_txtbox (sip);
11311145
11321146 build_model_info_box (sip, pm);
11331147
@@ -1154,6 +1168,24 @@ void LabUi::show_object_options() const
11541168 {
11551169 build_weapon_options (shipp);
11561170 }
1171+ } else if (getLabManager ()->CurrentMode == LabMode::Weapon && getLabManager ()->isSafeForWeapons ()) {
1172+ auto wip = &Weapon_info[getLabManager ()->CurrentClass ];
1173+
1174+ with_CollapsingHeader (" Weapon Info" )
1175+ {
1176+ build_weapon_table_info_txtbox (wip);
1177+ }
1178+
1179+ with_CollapsingHeader (" Object Actions" )
1180+ {
1181+ Checkbox (" Progress weapon lifetime" , &getLabManager ()->AllowWeaponDestruction );
1182+
1183+ if (VALID_FNAME (wip->tech_model )) {
1184+ if (Checkbox (" Show Tech Model" , &getLabManager ()->ShowingTechModel )) {
1185+ getLabManager ()->changeDisplayedObject (LabMode::Weapon, getLabManager ()->CurrentClass );
1186+ }
1187+ }
1188+ }
11571189 }
11581190 }
11591191}
0 commit comments