@@ -127,13 +127,13 @@ SCP_vector<glow_point_bank_override> glowpoint_bank_overrides;
127127// Goober5000 - reimplementation of Bobboau's $dumb_rotation feature in a way that works with the rest of the model instance system
128128// note: since these data types are only ever used in this file, they don't need to be in model.h
129129
130- class submodel_dumb_rotation
130+ class submodel_intrinsic_rotation
131131{
132132public:
133133 int submodel_num;
134134 submodel_instance_info submodel_info_1;
135135
136- submodel_dumb_rotation (int _submodel_num, float _turn_rate)
136+ submodel_intrinsic_rotation (int _submodel_num, float _turn_rate)
137137 : submodel_num(_submodel_num)
138138 {
139139 memset (&submodel_info_1, 0 , sizeof (submodel_info_1));
@@ -142,19 +142,19 @@ class submodel_dumb_rotation
142142 }
143143};
144144
145- class dumb_rotation
145+ class intrinsic_rotation
146146{
147147public:
148148 bool is_ship;
149149 int model_instance_num;
150- SCP_vector<submodel_dumb_rotation > list;
150+ SCP_vector<submodel_intrinsic_rotation > list;
151151
152- dumb_rotation (bool _is_ship, int _model_instance_num)
152+ intrinsic_rotation (bool _is_ship, int _model_instance_num)
153153 : is_ship(_is_ship), model_instance_num(_model_instance_num), list()
154154 {}
155155};
156156
157- SCP_vector<dumb_rotation> Dumb_rotations ;
157+ SCP_vector<intrinsic_rotation> Intrinsic_rotations ;
158158
159159
160160// Free up a model, getting rid of all its memory
@@ -955,10 +955,6 @@ int read_model_file(polymodel * pm, char *filename, int n_subsystems, model_subs
955955 int i,j;
956956 vec3d temp_vec;
957957
958- // little test code i used in fred2
959- // char pwd[128];
960- // getcwd(pwd, 128);
961-
962958 fp = cfopen (filename," rb" );
963959
964960 if (!fp) {
@@ -1268,10 +1264,10 @@ int read_model_file(polymodel * pm, char *filename, int n_subsystems, model_subs
12681264
12691265 // note, this should come BEFORE do_new_subsystem() for proper error handling (to avoid both rotating and dumb-rotating submodel)
12701266 if ( ( p = strstr (props, " $dumb_rotate" ) ) != NULL ) {
1271- pm->submodel [n].movement_type = MOVEMENT_TYPE_DUMB_ROTATE ;
1272- pm->submodel [n]. dumb_turn_rate = ( float ) atof (p+ 13 ) ;
1267+ pm->submodel [n].movement_type = MOVEMENT_TYPE_INTRINSIC_ROTATE ;
1268+ pm->flags |= PM_FLAG_HAS_INTRINSIC_ROTATE ;
12731269
1274- pm->flags |= PM_FLAG_HAS_DUMB_ROTATE ;
1270+ pm->submodel [n]. dumb_turn_rate = ( float ) atof (p + 13 ) ;
12751271 } else {
12761272 pm->submodel [n].dumb_turn_rate = 0 .0f ;
12771273 }
@@ -1311,8 +1307,8 @@ int read_model_file(polymodel * pm, char *filename, int n_subsystems, model_subs
13111307 if (pm->submodel [n].movement_type == MOVEMENT_TYPE_ROT) {
13121308 Warning (LOCATION, " Rotation without rotation axis defined on submodel '%s' of model '%s'!" , pm->submodel [n].name , pm->filename );
13131309 }
1314- else if (pm->submodel [n].movement_type == MOVEMENT_TYPE_DUMB_ROTATE ) {
1315- Warning (LOCATION, " Dumb rotation without rotation axis defined on submodel '%s' of model '%s'!" , pm->submodel [n].name , pm->filename );
1310+ else if (pm->submodel [n].movement_type == MOVEMENT_TYPE_INTRINSIC_ROTATE ) {
1311+ Warning (LOCATION, " Intrinsic rotation (e.g. dumb-rotate) without rotation axis defined on submodel '%s' of model '%s'!" , pm->submodel [n].name , pm->filename );
13161312 }
13171313 }
13181314
@@ -2791,20 +2787,20 @@ int model_create_instance(bool is_ship, int model_num)
27912787 model_clear_submodel_instance ( &pmi->submodel [i], &pm->submodel [i] );
27922788 }
27932789
2794- // add dumb_rotate instances if this model is dumb -rotating
2795- if (pm->flags & PM_FLAG_HAS_DUMB_ROTATE ) {
2796- dumb_rotation dumb_rot (is_ship, open_slot);
2790+ // add intrinsic_rotation instances if this model is intrinsic -rotating
2791+ if (pm->flags & PM_FLAG_HAS_INTRINSIC_ROTATE ) {
2792+ intrinsic_rotation intrinsic_rotate (is_ship, open_slot);
27972793
27982794 for (i = 0 ; i < pm->n_models ; i++) {
2799- if (pm->submodel [i].movement_type == MOVEMENT_TYPE_DUMB_ROTATE ) {
2800- dumb_rot .list .push_back (submodel_dumb_rotation (i, pm->submodel [i].dumb_turn_rate ));
2795+ if (pm->submodel [i].movement_type == MOVEMENT_TYPE_INTRINSIC_ROTATE ) {
2796+ intrinsic_rotate .list .push_back (submodel_intrinsic_rotation (i, pm->submodel [i].dumb_turn_rate ));
28012797 }
28022798 }
28032799
2804- if (dumb_rot .list .empty ()) {
2805- Assertion (!dumb_rot .list .empty (), " This model has the HAS_DUMB_ROTATE flag; why doesn't it have a dumb -rotating submodel?" );
2800+ if (intrinsic_rotate .list .empty ()) {
2801+ Assertion (!intrinsic_rotate .list .empty (), " This model has the PM_FLAG_HAS_INTRINSIC_ROTATE flag; why doesn't it have an intrinsic -rotating submodel?" );
28062802 } else {
2807- Dumb_rotations .push_back (dumb_rot );
2803+ Intrinsic_rotations .push_back (intrinsic_rotate );
28082804 }
28092805 }
28102806
@@ -2827,10 +2823,10 @@ void model_delete_instance(int model_instance_num)
28272823
28282824 Polygon_model_instances[model_instance_num] = NULL ;
28292825
2830- // delete dumb rotations associated with this instance
2831- for (auto dumb_it = Dumb_rotations .begin (); dumb_it != Dumb_rotations .end (); ++dumb_it ) {
2832- if (dumb_it ->model_instance_num == model_instance_num) {
2833- Dumb_rotations .erase (dumb_it );
2826+ // delete intrinsic rotations associated with this instance
2827+ for (auto intrinsic_it = Intrinsic_rotations .begin (); intrinsic_it != Intrinsic_rotations .end (); ++intrinsic_it ) {
2828+ if (intrinsic_it ->model_instance_num == model_instance_num) {
2829+ Intrinsic_rotations .erase (intrinsic_it );
28342830 break ;
28352831 }
28362832 }
@@ -3401,7 +3397,7 @@ void model_get_rotating_submodel_axis(vec3d *model_axis, vec3d *world_axis, int
34013397 polymodel *pm = model_get (modelnum);
34023398
34033399 bsp_info *sm = &pm->submodel [submodel_num];
3404- Assert (sm->movement_type == MOVEMENT_TYPE_ROT || sm->movement_type == MOVEMENT_TYPE_DUMB_ROTATE );
3400+ Assert (sm->movement_type == MOVEMENT_TYPE_ROT || sm->movement_type == MOVEMENT_TYPE_INTRINSIC_ROTATE );
34053401
34063402 if (sm->movement_axis == MOVEMENT_AXIS_X) {
34073403 vm_vec_make (model_axis, 1 .0f , 0 .0f , 0 .0f );
@@ -4411,7 +4407,7 @@ int rotating_submodel_has_ship_subsys(int submodel, ship *shipp)
44114407
44124408/*
44134409 * Get all submodel indexes that satisfy the following:
4414- * 1) Have the rotating or dumb -rotating movement type
4410+ * 1) Have the rotating or intrinsic -rotating movement type
44154411 * 2) Are currently rotating (i.e. actually moving and not part of the superstructure due to being destroyed or replaced)
44164412 * 3) Are not rotating too far for collision detection (c.f. MAX_SUBMODEL_COLLISION_ROT_ANGLE)
44174413 */
@@ -4459,8 +4455,8 @@ void model_get_rotating_submodel_list(SCP_vector<int> *submodel_vector, object *
44594455 // Don't check it or its children if it is destroyed or it is a replacement (non-moving)
44604456 if ( !child_submodel->blown_off && (child_submodel->i_replace == -1 ) && !child_submodel->no_collisions && !child_submodel->nocollide_this_only ) {
44614457
4462- // Only look for submodels that rotate or dumb -rotate
4463- if (child_submodel->movement_type == MOVEMENT_TYPE_ROT || child_submodel->movement_type == MOVEMENT_TYPE_DUMB_ROTATE ) {
4458+ // Only look for submodels that rotate or intrinsic -rotate
4459+ if (child_submodel->movement_type == MOVEMENT_TYPE_ROT || child_submodel->movement_type == MOVEMENT_TYPE_INTRINSIC_ROTATE ) {
44644460
44654461 // check submodel rotation is less than max allowed.
44664462 submodel_instance_info *sii = pmi->submodel [i].sii ;
@@ -4790,52 +4786,52 @@ void model_update_instance(int model_instance_num, int sub_model_num, submodel_i
47904786 }
47914787}
47924788
4793- void model_do_dumb_rotations_sub (dumb_rotation *dr )
4789+ void model_do_intrinsic_rotations_sub (intrinsic_rotation *ir )
47944790{
4795- polymodel_instance *pmi = model_get_instance (dr ->model_instance_num );
4791+ polymodel_instance *pmi = model_get_instance (ir ->model_instance_num );
47964792 Assert (pmi != nullptr );
47974793
47984794 // Handle all submodels which have $dumb_rotate
4799- for (auto sub_it = dr ->list .begin (); sub_it != dr ->list .end (); ++sub_it )
4795+ for (auto submodel_it = ir ->list .begin (); submodel_it != ir ->list .end (); ++submodel_it )
48004796 {
48014797 polymodel *pm = model_get (pmi->model_num );
4802- bsp_info *sm = &pm-> submodel [sub_it-> submodel_num ] ;
4803- Assert (pm != nullptr && sm != nullptr ) ;
4798+ Assert (pm != nullptr ) ;
4799+ bsp_info * sm = &pm-> submodel [submodel_it-> submodel_num ] ;
48044800
48054801 // First, calculate the angles for the rotation
4806- submodel_rotate (sm, &sub_it ->submodel_info_1 );
4802+ submodel_rotate (sm, &submodel_it ->submodel_info_1 );
48074803
48084804 // Now actually rotate the submodel instance
4809- // (Since this is a dumb rotation, we have no associated subsystem, so pass 0 for subsystem flags.)
4810- model_update_instance (dr ->model_instance_num , sub_it ->submodel_num , &sub_it ->submodel_info_1 , 0 );
4805+ // (Since this is an intrinsic rotation, we have no associated subsystem, so pass 0 for subsystem flags.)
4806+ model_update_instance (ir ->model_instance_num , submodel_it ->submodel_num , &submodel_it ->submodel_info_1 , 0 );
48114807 }
48124808}
48134809
4814- // Handle the $dumb_rotate rotations for either a) a single ship model; or b) all non-ship models. The reason for the two cases is that ship_model_update_instance will
4810+ // Handle the intrinsic rotations for either a) a single ship model; or b) all non-ship models. The reason for the two cases is that ship_model_update_instance will
48154811// be called for each ship via obj_move_all_post, but we also need to handle non-ship models once obj_move_all_post exits. Since the two processes are almost identical,
48164812// they are both handled here.
48174813//
48184814// This function is quite a bit different than Bobboau's old model_do_dumb_rotation function. Whereas Bobboau used the brute-force technique of navigating through
48194815// each model hierarchy as it was rendered, this function should be seen as a version of obj_move_all_post, but for models rather than objects. In fact, the only reason
4820- // for the special ship case is that the ship dumb rotations kind of need to be handled where all the other ship rotations are. (Unless you want inconsistent collisions
4816+ // for the special ship case is that the ship intrinsic rotations kind of need to be handled where all the other ship rotations are. (Unless you want inconsistent collisions
48214817// or damage sparks that aren't attached to models.)
48224818//
48234819// -- Goober5000
4824- void model_do_dumb_rotations (int model_instance_num)
4820+ void model_do_intrinsic_rotations (int model_instance_num)
48254821{
48264822 // we are handling a specific ship
48274823 if (model_instance_num >= 0 )
48284824 {
4829- for (auto dumb_it = Dumb_rotations .begin (); dumb_it != Dumb_rotations .end (); ++dumb_it )
4825+ for (auto intrinsic_it = Intrinsic_rotations .begin (); intrinsic_it != Intrinsic_rotations .end (); ++intrinsic_it )
48304826 {
4831- if (dumb_it ->model_instance_num == model_instance_num)
4827+ if (intrinsic_it ->model_instance_num == model_instance_num)
48324828 {
4833- Assertion (dumb_it ->is_ship , " This code path is only for ship dumb_rotations ! See the comments associated with the model_do_dumb_rotations function!" );
4829+ Assertion (intrinsic_it ->is_ship , " This code path is only for ship rotations ! See the comments associated with the model_do_intrinsic_rotations function!" );
48344830
48354831 // we're just doing one ship, and in ship_model_update_instance, that ship's angles were already set to zero
48364832
48374833 // Now update the angles in the submodels
4838- model_do_dumb_rotations_sub (&(*dumb_it ));
4834+ model_do_intrinsic_rotations_sub (&(*intrinsic_it ));
48394835
48404836 // once we've handled this one ship, we're done
48414837 break ;
@@ -4845,15 +4841,15 @@ void model_do_dumb_rotations(int model_instance_num)
48454841 // we are handling all non-ships
48464842 else
48474843 {
4848- for (auto dumb_it = Dumb_rotations .begin (); dumb_it != Dumb_rotations .end (); ++dumb_it )
4844+ for (auto intrinsic_it = Intrinsic_rotations .begin (); intrinsic_it != Intrinsic_rotations .end (); ++intrinsic_it )
48494845 {
4850- if (!dumb_it ->is_ship )
4846+ if (!intrinsic_it ->is_ship )
48514847 {
48524848 // Just as in ship_model_update_instance: first clear all the angles in the model to zero
4853- model_clear_submodel_instances (dumb_it ->model_instance_num );
4849+ model_clear_submodel_instances (intrinsic_it ->model_instance_num );
48544850
48554851 // Now update the angles in the submodels
4856- model_do_dumb_rotations_sub (&(*dumb_it ));
4852+ model_do_intrinsic_rotations_sub (&(*intrinsic_it ));
48574853 }
48584854 }
48594855 }
@@ -4886,7 +4882,7 @@ void model_init_submodel_axis_pt(submodel_instance_info *sii, int model_num, int
48864882 vec3d p1, v1, p2, v2, int1;
48874883
48884884 polymodel *pm = model_get (model_num);
4889- Assert (pm->submodel [submodel_num].movement_type == MOVEMENT_TYPE_ROT || pm->submodel [submodel_num].movement_type == MOVEMENT_TYPE_DUMB_ROTATE );
4885+ Assert (pm->submodel [submodel_num].movement_type == MOVEMENT_TYPE_ROT || pm->submodel [submodel_num].movement_type == MOVEMENT_TYPE_INTRINSIC_ROTATE );
48904886 Assert (sii);
48914887
48924888 mpoint1 = NULL ;
0 commit comments