View Issue Details

IDProjectCategoryView StatusLast Update
0002202FSSCPtablespublic2010-05-13 02:45
ReporterThe_E Assigned ToThe_E  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.6.12 RC2 
Summary0002202: Spawn weapons cannot be swarmers
DescriptionWhile creating new weapons for WiH, Fury ran across a curious issue. Apparently, a weapon that has the $Swarm field can not be a spawner weapon, as it seems as if the child weapons do not inherit the carrier missile's target. TBL entry is attached.
Additional Information$Name: Apocalypse MIRV#Karuna
$Model File: MissileM.pof
$Mass: 30.0
$Velocity: 200.0
$Fire Wait: 20.0
$Damage: 10
$Damage Type: HugeWeapon
$Detonation Radius: 1000
$Blast Force: 10.0
$Inner Radius: 15.0
$Outer Radius: 30.0
$Shockwave Speed: 0
$Armor Factor: 1.0
$Shield Factor: 0.1
$Subsystem Factor: 0.5
$Lifetime: 36.0
$Energy Consumed: 0.0
$Cargo Size: 2.5
$Homing: YES
    +Type: ASPECT
    +Turn Time: 0.5
    +View Cone: 360.0
    +Min Lock Time: 4.0
    +Lock Pixels/Sec: 25
    +Catch-up Pixels/Sec: 10
    +Catch-up Penalty: 15
$Swarm: 4
    +SwarmWait: 1.5
$Free Flight Time: 3.0
$LaunchSnd: 19
$ImpactSnd: 101
$FlyBySnd: -1
$Rearm Rate: 0.02
+Weapon Range: 6000
$Flags: ( "Huge" "particle spew" "bomb" "same turret cooldown" "no lifeleft penalty" "smart spawn" "Spawn ApocalypseMIRV, 4" )
$Trail:
    +Start Width: 1.4
    +End Width: 2.8
    +Start Alpha: 1.0
    +End Alpha: 0.0
    +Max Life: 4.0
    +Bitmap: missiletrail02
$Icon: GBU-240
$Anim: gbu-240ext8
$Impact Explosion: ExpMissileHit1
$Impact Explosion Radius: 14.32
$Piercing Impact Explosion: exp06
$Piercing Impact Radius: 14.32
$Piercing Impact Velocity: 50.0
$Piercing Impact Splash Velocity: -5.00
$Piercing Impact Variance: 0.0
$Piercing Impact Life: 0.25
$Piercing Impact Particles: 14
$Pspew:
    +Count: 1
    +Time: 1
    +Vel: 0.0
    +Radius: 0.7
    +Life: 2.0
    +Scale: 0.0
    +Bitmap: missilespew02
$Thruster Flame Effect: missilethruster02
$Thruster Glow Effect: missileglow02

$Name: ApocalypseMIRV
$Model File: GBU-240.pof
$Mass: 20.0
$Velocity: 100.0
$Fire Wait: 0.1
$Damage: 125
$Damage Type: HugeWeapon
$Arm radius: 250
$Blast Force: 250.0
$Inner Radius: 25.0
$Outer Radius: 50.0
$Shockwave Speed: 50
$Dinky shockwave:
    +Blast Force: 50
    +Inner Radius: 5
    +Outer Radius: 15
    +Shockwave Speed: 0.0
$Armor Factor: 1.0
$Shield Factor: 0.1
$Subsystem Factor: 1.0
$Lifetime: 24.0
$Energy Consumed: 0.0
$Cargo Size: 2.5
$Homing: YES
    +Type: ASPECT
    +Turn Time: 1.0
    +View Cone: 270.0
$LaunchSnd: 19
$ImpactSnd: 101
$FlyBySnd: -1
$Rearm Rate: 0.02
+Weapon Range: 4000
$Flags: ( "Huge" "particle spew" "bomb" "no lifeleft penalty" "capital+" "child" "inherit parent target" )
$Trail:
    +Start Width: 0.2
    +End Width: 0.6
    +Start Alpha: 1.0
    +End Alpha: 0.0
    +Max Life: 2.0
    +Bitmap: missiletrail02
$Icon: GBU-240
$Anim: gbu-240ext8
$Impact Explosion: ExpMissileHit1
$Impact Explosion Radius: 3.88
$Dinky impact explosion: ExpMissileHit1
$Dinky impact explosion radius: 1.94
$Piercing Impact Explosion: exp06
$Piercing Impact Radius: 25.0
$Piercing Impact Velocity: 25.0
$Piercing Impact Splash Velocity: -2.50
$Piercing Impact Variance: 0.0
$Piercing Impact Life: 0.25
$Piercing Impact Particles: 4
$spawn Angle: 15
$Pspew:
    +Count: 1
    +Time: 1
    +Vel: 0.0
    +Radius: 0.15
    +Life: 1.0
    +Scale: 0.0
    +Bitmap: missilespew02
$Thruster Flame Effect: missilethruster02
$Thruster Glow Effect: missileglow02
TagsNo tags attached.

Activities

iss_mneur

2010-05-06 19:11

developer   ~0011937

What does it do instead? IE. does the engine throw a parse error? Does the engine crash? When it is time to spawn does the parent just vanish?

The_E

2010-05-06 19:35

administrator   ~0011938

Parent explodes as normal, but the children just fly off into random directions, without homing in on the intended target.

2010-05-09 02:28

 

spawnswarm.patch (3,334 bytes)   
Index: code/weapon/swarm.cpp
===================================================================
--- code/weapon/swarm.cpp	(revision 6091)
+++ code/weapon/swarm.cpp	(working copy)
@@ -37,26 +37,9 @@
 #define SWARM_USED						(1<<0)
 #define SWARM_POSITIVE_PATH			(1<<1)
 
-typedef struct swarm_info {
-	int		flags;
-	int		change_timestamp;
-	vec3d	original_target;
-	vec3d	new_target;
-	vec3d	circle_rvec, circle_uvec;
-	vec3d	last_offset;
-	uint		change_count;		
-	int		path_num;			// which path swarm missile is currently following
-	int		homing_objnum;		// object number that swarm missile is homing on, -1 if not homing
-	int		change_time;		// when swarm missile should next update direction, based on missile speed
-	float		angle_offset;
-	float		last_dist;			// last distance to target
-} swarm_info;
 
-
-#define MAX_SWARM_MISSILES	100
 swarm_info	Swarm_missiles[MAX_SWARM_MISSILES];
 
-#define MAX_TURRET_SWARM_INFO	100
 turret_swarm_info Turret_swarm_info[MAX_TURRET_SWARM_INFO];
 
 int Turret_swarm_validity_next_check_time;
Index: code/weapon/swarm.h
===================================================================
--- code/weapon/swarm.h	(revision 6091)
+++ code/weapon/swarm.h	(working copy)
@@ -12,6 +12,8 @@
 #ifndef __FREESPACE_SWARM_H__
 #define __FREESPACE_SWARM_H__
 
+#include "globalincs/pstypes.h"
+
 struct object;
 struct ship_subsys;
 
@@ -29,8 +31,29 @@
 	int				weapon_num;
 } turret_swarm_info;
 
+typedef struct swarm_info {
+	int		flags;
+	int		change_timestamp;
+	vec3d	original_target;
+	vec3d	new_target;
+	vec3d	circle_rvec, circle_uvec;
+	vec3d	last_offset;
+	uint		change_count;		
+	int		path_num;			// which path swarm missile is currently following
+	int		homing_objnum;		// object number that swarm missile is homing on, -1 if not homing
+	int		change_time;		// when swarm missile should next update direction, based on missile speed
+	float		angle_offset;
+	float		last_dist;			// last distance to target
+} swarm_info;
+
 #define SWARM_DEFAULT_NUM_MISSILES_FIRED					4		// number of swarm missiles that launch when fired
 
+#define MAX_SWARM_MISSILES	100
+extern swarm_info	Swarm_missiles[MAX_SWARM_MISSILES];
+
+#define MAX_TURRET_SWARM_INFO	100
+extern turret_swarm_info Turret_swarm_info[MAX_TURRET_SWARM_INFO];
+
 void	swarm_level_init();
 void	swarm_delete(int index);
 int	swarm_create();
Index: code/weapon/weapons.cpp
===================================================================
--- code/weapon/weapons.cpp	(revision 6091)
+++ code/weapon/weapons.cpp	(working copy)
@@ -5090,7 +5090,15 @@
 			//if the child inherits parent target, do it only if the parent weapon was locked to begin with
 			if ((child_wip->wi_flags2 & WIF2_INHERIT_PARENT_TARGET) && (wp->homing_object != &obj_used_list))
 			{
-				weapon_set_tracking_info(weapon_objnum, parent_num, wp->target_num, 1, wp->homing_subsys);
+				//Deal with swarm weapons
+				if (wp->swarm_index >= 0) {
+					swarm_info	*swarmp;
+					swarmp = &Swarm_missiles[wp->swarm_index];
+
+					weapon_set_tracking_info(weapon_objnum, parent_num, swarmp->homing_objnum, 1, wp->homing_subsys);
+				} else {
+					weapon_set_tracking_info(weapon_objnum, parent_num, wp->target_num, 1, wp->homing_subsys);
+				}
 			}
 
     		//	Assign a little randomness to lifeleft so they don't all disappear at the same time.
spawnswarm.patch (3,334 bytes)   

The_E

2010-05-09 02:29

administrator   ~0011946

Added a patch for this issue. It seems that the code was never built to handle weapons that could be both Swarm AND Spawn at the same time.

The_E

2010-05-09 15:05

administrator   ~0011953

Added to trunk in revision 6095

Issue History

Date Modified Username Field Change
2010-05-06 16:15 The_E New Issue
2010-05-06 19:11 iss_mneur Note Added: 0011937
2010-05-06 19:35 The_E Note Added: 0011938
2010-05-09 02:28 The_E File Added: spawnswarm.patch
2010-05-09 02:29 The_E Note Added: 0011946
2010-05-09 15:05 The_E Note Added: 0011953
2010-05-13 02:45 The_E Status new => resolved
2010-05-13 02:45 The_E Resolution open => fixed
2010-05-13 02:45 The_E Assigned To => The_E