@@ -4506,31 +4506,34 @@ void model_set_up_techroom_instance(ship_info *sip, int model_instance_num)
45064506{
45074507 auto pmi = model_get_instance (model_instance_num);
45084508 auto pm = model_get (pmi->model_num );
4509-
45104509 flagset<Ship::Subsystem_Flags> empty;
4510+
45114511 for (int i = 0 ; i < sip->n_subsystems ; ++i)
45124512 {
45134513 model_subsystem *msp = &sip->subsystems [i];
4514- if (msp->type == SUBSYSTEM_TURRET)
4514+
4515+ for (int j = 0 ; j < msp->n_triggers ; ++j)
45154516 {
4516- if (msp->subobj_num >= 0 )
4517+ if (msp->triggers [j]. type == AnimationTriggerType::Initial )
45174518 {
45184519 // special case for turrets
4519- if (msp->n_triggers > 0 )
4520- pmi->submodel [msp->subobj_num ].angs .h = msp->triggers [msp->n_triggers - 1 ].angle .xyz .y ;
4521-
4522- model_update_instance (pm, pmi, msp->subobj_num , empty);
4523- }
4520+ if (msp->type == SUBSYSTEM_TURRET)
4521+ {
4522+ if (msp->subobj_num >= 0 )
4523+ pmi->submodel [msp->subobj_num ].angs .h = msp->triggers [j].angle .xyz .y ;
45244524
4525- if ((msp->subobj_num != msp->turret_gun_sobj ) && (msp->turret_gun_sobj >= 0 ))
4526- {
4527- // special case for turrets
4528- if (msp->n_triggers > 0 )
4529- pmi->submodel [msp->turret_gun_sobj ].angs .p = msp->triggers [msp->n_triggers - 1 ].angle .xyz .x ;
4530-
4531- model_update_instance (pm, pmi, msp->turret_gun_sobj , empty);
4525+ if ((msp->subobj_num != msp->turret_gun_sobj ) && (msp->turret_gun_sobj >= 0 ))
4526+ pmi->submodel [msp->turret_gun_sobj ].angs .p = msp->triggers [j].angle .xyz .x ;
4527+ }
4528+ // we can't support non-turrets, as in modelanim, because we need a ship subsystem but we don't actually have a ship
45324529 }
45334530 }
4531+
4532+ if (msp->subobj_num >= 0 )
4533+ model_update_instance (pm, pmi, msp->subobj_num , empty);
4534+
4535+ if (msp->turret_gun_sobj >= 0 )
4536+ model_update_instance (pm, pmi, msp->turret_gun_sobj , empty);
45344537 }
45354538}
45364539
0 commit comments