New patch attached, with a very small change that should fix the destruction bug. Apply to trunk.
Can you upload the model you used for testing?
Index: code/object/object.cpp
===================================================================
--- code/object/object.cpp (revision 7007)
+++ code/object/object.cpp (working copy)
@@ -1369,104 +1369,93 @@
MONITOR_INC( NumObjects, Num_objects );
- objp = GET_FIRST(&obj_used_list);
- while( objp !=END_OF_LIST(&obj_used_list) ) {
+ for (objp = GET_FIRST(&obj_used_list); objp != END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp)) {
// skip objects which should be dead
- if ( !(objp->flags&OF_SHOULD_BE_DEAD) ) {
- vec3d cur_pos = objp->pos; // Save the current position
+ if (objp->flags & OF_SHOULD_BE_DEAD) {
+ continue;
+ }
- // if this is an observer object, skip it
- if(objp->type == OBJ_OBSERVER){
- objp = GET_NEXT(objp);
- continue;
- }
+ // Goober5000 - skip objects which don't move, but only until they're destroyed
+ if (objp->flags & OF_IMMOBILE && objp->hull_strength > 0.0f) {
+ continue;
+ }
- // if we're playing a demo back, only sim stuff that we're supposed to
- if((Game_mode & GM_DEMO_PLAYBACK) && !demo_should_sim(objp)){
- objp = GET_NEXT(objp);
- continue;
- }
+ // if this is an observer object, skip it
+ if (objp->type == OBJ_OBSERVER) {
+ continue;
+ }
+ // if we're playing a demo back, only sim stuff that we're supposed to
+ if ((Game_mode & GM_DEMO_PLAYBACK) && !demo_should_sim(objp)) {
+ continue;
+ }
+
+ vec3d cur_pos = objp->pos; // Save the current position
+
#ifdef OBJECT_CHECK
- // if(! ((Game_mode & GM_MULTIPLAYER) && (Net_player != NULL) && !(Net_player->flags & NETINFO_FLAG_AM_MASTER)) ){
- obj_check_object( objp );
- // }
+ // if(! ((Game_mode & GM_MULTIPLAYER) && (Net_player != NULL) && !(Net_player->flags & NETINFO_FLAG_AM_MASTER)) ){
+ obj_check_object( objp );
+ // }
#endif
- // pre-move
- obj_move_all_pre(objp, frametime);
+ // pre-move
+ obj_move_all_pre(objp, frametime);
- // store last pos and orient
- objp->last_pos = cur_pos;
- objp->last_orient = objp->orient;
+ // store last pos and orient
+ objp->last_pos = cur_pos;
+ objp->last_orient = objp->orient;
- // if this is an object which should be interpolated in multiplayer, do so
- if(multi_oo_is_interp_object(objp)){
- multi_oo_interp(objp);
- } else {
- // physics
- obj_move_call_physics(objp, frametime);
- }
+ // if this is an object which should be interpolated in multiplayer, do so
+ if (multi_oo_is_interp_object(objp)) {
+ multi_oo_interp(objp);
+ } else {
+ // physics
+ obj_move_call_physics(objp, frametime);
+ }
- // move post
- obj_move_all_post(objp, frametime);
+ // move post
+ obj_move_all_post(objp, frametime);
- //Equipment script processing
- if (objp->type == OBJ_SHIP) {
- ship* shipp = &Ships[objp->instance];
- object* target;
- if (Ai_info[shipp->ai_index].target_objnum != -1)
- target = &Objects[Ai_info[shipp->ai_index].target_objnum];
- else
- target = NULL;
- if (objp == Player_obj && Player_ai->target_objnum != -1)
- target = &Objects[Player_ai->target_objnum];
- Script_system.SetHookObjects(2, "User", objp, "Target", target);
- Script_system.RunCondition(CHA_ONWPEQUIPPED, 0, NULL, objp);
- }
+ // Equipment script processing
+ if (objp->type == OBJ_SHIP) {
+ ship* shipp = &Ships[objp->instance];
+ object* target;
+
+ if (Ai_info[shipp->ai_index].target_objnum != -1)
+ target = &Objects[Ai_info[shipp->ai_index].target_objnum];
+ else
+ target = NULL;
+ if (objp == Player_obj && Player_ai->target_objnum != -1)
+ target = &Objects[Player_ai->target_objnum];
+
+ Script_system.SetHookObjects(2, "User", objp, "Target", target);
+ Script_system.RunCondition(CHA_ONWPEQUIPPED, 0, NULL, objp);
}
- objp = GET_NEXT(objp);
}
// After all objects have been moved, move all docked objects.
- if(!(Game_mode & GM_DEMO_PLAYBACK)){
- objp = GET_FIRST(&obj_used_list);
- while( objp !=END_OF_LIST(&obj_used_list) ) {
+ if (!(Game_mode & GM_DEMO_PLAYBACK)) {
+ for (objp = GET_FIRST(&obj_used_list); objp != END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp)) {
dock_move_docked_objects(objp);
// unflag all objects as being updates
objp->flags &= ~OF_JUST_UPDATED;
-
- objp = GET_NEXT(objp);
}
}
- // Now that all objects have moved, we should calculate the
- // velocities from how far they moved.
- // DA: Commented out 2/23, unnecessary since colliding objects calculate their post collision velocities through physics.
- /*
- objp = GET_FIRST(&obj_used_list);
- while( objp !=END_OF_LIST(&obj_used_list) ) {
- if ( !(objp->flags&OF_SHOULD_BE_DEAD) && (objp->type != OBJ_OBSERVER) && (objp->type != OBJ_ASTEROID) && (objp->type != OBJ_DEBRIS)) {
- objp->phys_info.vel.x = (objp->pos.x - objp->last_pos.x) / frametime;
- objp->phys_info.vel.y = (objp->pos.y - objp->last_pos.y) / frametime;
- objp->phys_info.vel.z = (objp->pos.z - objp->last_pos.z) / frametime;
- }
- objp = GET_NEXT(objp);
- } */
-
- if(!(Game_mode & GM_DEMO_PLAYBACK)){
- find_homing_object_cmeasures(); // If any cmeasures fired, maybe steer away homing missiles
+ // If any cmeasures fired, maybe steer away homing missiles
+ if (!(Game_mode & GM_DEMO_PLAYBACK)) {
+ find_homing_object_cmeasures();
}
// do pre-collision stuff for beam weapons
beam_move_all_pre();
- if ( Collisions_enabled ) {
+ if ( Collisions_enabled ) {
obj_check_all_collisions();
}
- if(!(Game_mode & GM_DEMO_PLAYBACK)){
+ if (!(Game_mode & GM_DEMO_PLAYBACK)) {
turret_swarm_check_validity();
}
[attachment deleted by ninja]