Index: code/ai/aibig.cpp
===================================================================
--- code/ai/aibig.cpp	(revision 9440)
+++ code/ai/aibig.cpp	(working copy)
@@ -20,6 +20,7 @@
 #include "mission/missionparse.h"
 #include "iff_defs/iff_defs.h"
 #include "math/staticrand.h"
+#include "ai/aigoals.h"
 
 
 
@@ -721,71 +722,75 @@
 					if (En_objp->phys_info.speed * dist_to_enemy < 5000.0f)		//	Don't select a bomb if enemy moving fast relative to distance
 						priority1 = WIF_BOMB;
 
-				if (!(En_objp->flags & OF_PROTECTED)) {
+				if (!(En_objp->flags & OF_PROTECTED) || (aip->goals[0].ai_mode & (AI_GOAL_DISABLE_SHIP | AI_GOAL_DISARM_SHIP))) {
 					//ai_select_secondary_weapon(Pl_objp, tswp, priority1, priority2);	//	Note, need to select to get weapon speed and lifetime
-
+					if(aip->goals[0].ai_mode & (AI_GOAL_DISABLE_SHIP | AI_GOAL_DISARM_SHIP)) {
+						priority1 = WIF_PUNCTURE;
+					}
 					ai_choose_secondary_weapon(Pl_objp, aip, En_objp);
 					int current_bank = tswp->current_secondary_bank;
 					weapon_info	*swip = &Weapon_info[tswp->secondary_bank_weapons[current_bank]];
 
-					//	If ship is protected and very low on hits, don't fire missiles.
-					if ((current_bank > -1) &&  (!(En_objp->flags & OF_PROTECTED) || (En_objp->hull_strength > 10*swip->damage))) {
-						if (aip->ai_flags & AIF_UNLOAD_SECONDARIES) {
-							if (timestamp_until(swp->next_secondary_fire_stamp[current_bank]) > swip->fire_wait*1000.0f) {
-								swp->next_secondary_fire_stamp[current_bank] = timestamp((int) (swip->fire_wait*1000.0f));
+					if(!(En_objp->flags & OF_PROTECTED) || ((aip->goals[0].ai_mode & (AI_GOAL_DISABLE_SHIP | AI_GOAL_DISARM_SHIP)) && swip->wi_flags & WIF_PUNCTURE )) { //override lockdown on protected ships when using anti subsystem weapons - Valathil
+						//	If ship is protected and very low on hits, don't fire missiles.
+						if ((current_bank > -1) &&  (!(En_objp->flags & OF_PROTECTED) || (En_objp->hull_strength > 10*swip->damage))) {
+							if (aip->ai_flags & AIF_UNLOAD_SECONDARIES) {
+								if (timestamp_until(swp->next_secondary_fire_stamp[current_bank]) > swip->fire_wait*1000.0f) {
+									swp->next_secondary_fire_stamp[current_bank] = timestamp((int) (swip->fire_wait*1000.0f));
+								}
 							}
-						}
 
-						if (timestamp_elapsed(swp->next_secondary_fire_stamp[current_bank])) {
-							float firing_range;
-							if (swip->wi_flags2 & WIF2_LOCAL_SSM)
-								firing_range=swip->lssm_lock_range;
-							else
-								firing_range = MIN((swip->max_speed * swip->lifetime), swip->weapon_range);
-							// reduce firing range of secondaries in nebula
-							extern int Nebula_sec_range;
-							if ((The_mission.flags & MISSION_FLAG_FULLNEB) && Nebula_sec_range) {
-								firing_range *= 0.8f;
-							}
+							if (timestamp_elapsed(swp->next_secondary_fire_stamp[current_bank])) {
+								float firing_range;
+								if (swip->wi_flags2 & WIF2_LOCAL_SSM)
+									firing_range=swip->lssm_lock_range;
+								else
+									firing_range = MIN((swip->max_speed * swip->lifetime), swip->weapon_range);
+								// reduce firing range of secondaries in nebula
+								extern int Nebula_sec_range;
+								if ((The_mission.flags & MISSION_FLAG_FULLNEB) && Nebula_sec_range) {
+									firing_range *= 0.8f;
+								}
 
-							float t = 0.25f;	//	default delay in seconds until next fire.
+								float t = 0.25f;	//	default delay in seconds until next fire.
 
-							if (dist_to_enemy < firing_range*1.0f) {
+								if (dist_to_enemy < firing_range*1.0f) {
 
 
-								//vm_vec_scale_add(&future_enemy_pos, enemy_pos, enemy_vel, dist_to_enemy/swip->max_speed);
-								//if (vm_vec_dist_quick(&future_enemy_pos, firing_pos) < firing_range * 0.8f) {
-									if (ai_fire_secondary_weapon(Pl_objp)) {
-										if ((aip->ai_flags & AIF_UNLOAD_SECONDARIES) || (swip->burst_flags & WBF_FAST_FIRING)) {
-											if (swip->burst_shots > swp->burst_counter[current_bank]) {
-												t = swip->burst_delay;
-												swp->burst_counter[current_bank]++;
-											} else {
-												t = swip->fire_wait;
-												if ((swip->burst_shots > 0) && (swip->burst_flags & WBF_RANDOM_LENGTH)) {
-													swp->burst_counter[current_bank] = myrand() % swip->burst_shots;
+									//vm_vec_scale_add(&future_enemy_pos, enemy_pos, enemy_vel, dist_to_enemy/swip->max_speed);
+									//if (vm_vec_dist_quick(&future_enemy_pos, firing_pos) < firing_range * 0.8f) {
+										if (ai_fire_secondary_weapon(Pl_objp)) {
+											if ((aip->ai_flags & AIF_UNLOAD_SECONDARIES) || (swip->burst_flags & WBF_FAST_FIRING)) {
+												if (swip->burst_shots > swp->burst_counter[current_bank]) {
+													t = swip->burst_delay;
+													swp->burst_counter[current_bank]++;
 												} else {
- 													swp->burst_counter[current_bank] = 0;
+													t = swip->fire_wait;
+													if ((swip->burst_shots > 0) && (swip->burst_flags & WBF_RANDOM_LENGTH)) {
+														swp->burst_counter[current_bank] = myrand() % swip->burst_shots;
+													} else {
+ 														swp->burst_counter[current_bank] = 0;
+													}
 												}
-											}
-										} else {
-											if (swip->burst_shots > swp->burst_counter[current_bank]) {
-												t = set_secondary_fire_delay(aip, temp_shipp, swip, true);
-												swp->burst_counter[current_bank]++;
 											} else {
-												t = set_secondary_fire_delay(aip, temp_shipp, swip, false);
-												if ((swip->burst_shots > 0) && (swip->burst_flags & WBF_RANDOM_LENGTH)) {
-													swp->burst_counter[current_bank] = myrand() % swip->burst_shots;
+												if (swip->burst_shots > swp->burst_counter[current_bank]) {
+													t = set_secondary_fire_delay(aip, temp_shipp, swip, true);
+													swp->burst_counter[current_bank]++;
 												} else {
-													swp->burst_counter[current_bank] = 0;
+													t = set_secondary_fire_delay(aip, temp_shipp, swip, false);
+													if ((swip->burst_shots > 0) && (swip->burst_flags & WBF_RANDOM_LENGTH)) {
+														swp->burst_counter[current_bank] = myrand() % swip->burst_shots;
+													} else {
+														swp->burst_counter[current_bank] = 0;
+													}
 												}
 											}
+											swp->next_secondary_fire_stamp[current_bank] = timestamp((int) (t*1000.0f));
 										}
-										swp->next_secondary_fire_stamp[current_bank] = timestamp((int) (t*1000.0f));
-									}
-								//}
+									//}
+								}
+								swp->next_secondary_fire_stamp[current_bank] = timestamp((int) (t*1000.0f));
 							}
-							swp->next_secondary_fire_stamp[current_bank] = timestamp((int) (t*1000.0f));
 						}
 					}
 				}
