@@ -1079,8 +1079,8 @@ void asteroid_delete( object * obj )
10791079 */
10801080static void asteroid_maybe_reposition (object *objp, asteroid_field *asfieldp)
10811081{
1082- // passive field does not wrap
1083- if (asfieldp->field_type == FT_PASSIVE) {
1082+ // passive field does not wrap if there is no gravity
1083+ if (IS_VEC_NULL (&The_mission. gravity ) && ( asfieldp->field_type == FT_PASSIVE) ) {
10841084 return ;
10851085 }
10861086
@@ -1106,31 +1106,38 @@ static void asteroid_maybe_reposition(object *objp, asteroid_field *asfieldp)
11061106 asteroid_wrap_pos (objp, asfieldp);
11071107 asteroid* astp = &Asteroids[objp->instance ];
11081108
1109- // this doesnt count as a thrown asteroid anymore
1110- for (asteroid_target& target : Asteroid_targets)
1111- if (target.objnum == astp->target_objnum )
1112- target.incoming_asteroids --;
1109+ if (asfieldp->field_type == FT_ACTIVE) {
1110+ // this doesnt count as a thrown asteroid anymore
1111+ for (asteroid_target& target : Asteroid_targets)
1112+ if (target.objnum == astp->target_objnum )
1113+ target.incoming_asteroids --;
11131114
1114- astp->target_objnum = -1 ;
1115+ astp->target_objnum = -1 ;
1116+ }
11151117
11161118 dist = vm_vec_normalized_dir (&vec_to_asteroid, &objp->pos , &Eye_position);
11171119 dot = vm_vec_dot (&Eye_matrix.vec .fvec , &vec_to_asteroid);
11181120
1119- if ( (dot > 0 .7f ) && (dist < (asfieldp->bound_rad * 1 .3f )) ) {
1120- // player would see asteroid pop out other side, so reverse velocity instead of wrapping
1121- objp->pos = old_asteroid_pos;
1122- vm_vec_copy_scale (&objp->phys_info .vel , &old_vel, -1 .0f );
1123- objp->phys_info .desired_vel = objp->phys_info .vel ;
1124- Asteroids[objp->instance ].target_objnum = -1 ;
1121+ // probably don't reverse direction if there's gravity involved
1122+ if (IS_VEC_NULL (&The_mission.gravity )) {
1123+ if ((dot > 0 .7f ) && (dist < (asfieldp->bound_rad * 1 .3f ))) {
1124+ // player would see asteroid pop out other side, so reverse velocity instead of wrapping
1125+ objp->pos = old_asteroid_pos;
1126+ vm_vec_copy_scale (&objp->phys_info .vel , &old_vel, -1 .0f );
1127+ objp->phys_info .desired_vel = objp->phys_info .vel ;
1128+ Asteroids[objp->instance ].target_objnum = -1 ;
1129+ }
11251130 }
11261131
11271132 // update last pos (after vel is known)
11281133 vm_vec_scale_add (&objp->last_pos , &objp->pos , &objp->phys_info .vel , -flFrametime);
11291134
11301135 asteroid_update_collide (objp);
11311136
1132- if ( MULTIPLAYER_MASTER )
1133- send_asteroid_throw ( objp );
1137+ if (asfieldp->field_type == FT_ACTIVE) {
1138+ if (MULTIPLAYER_MASTER)
1139+ send_asteroid_throw (objp);
1140+ }
11341141 }
11351142 }
11361143 }
@@ -1972,12 +1979,11 @@ void asteroid_process_post(object * obj)
19721979
19731980 asteroid *asp = &Asteroids[num];
19741981
1975- // Only wrap if active field
1976- if (Asteroid_field.field_type == FT_ACTIVE) {
1977- if ( timestamp_elapsed (asp->check_for_wrap ) ) {
1978- asteroid_maybe_reposition (obj, &Asteroid_field);
1979- asp->check_for_wrap = _timestamp (ASTEROID_CHECK_WRAP_TIMESTAMP);
1980- }
1982+ // Passive fields might wrap if there's gravity so do
1983+ // this for all fields now-Mjn
1984+ if ( timestamp_elapsed (asp->check_for_wrap ) ) {
1985+ asteroid_maybe_reposition (obj, &Asteroid_field);
1986+ asp->check_for_wrap = _timestamp (ASTEROID_CHECK_WRAP_TIMESTAMP);
19811987 }
19821988
19831989 asteroid_verify_collide_objnum (asp);
0 commit comments