2020-05-30 10:49 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000632Spring engineGeneralpublic2007-09-14 19:57
ReporterKDR_11k 
Assigned ToKloot 
PrioritynormalSeverityfeatureReproducibilityN/A
StatusresolvedResolutionfixed 
Product Version 
Target VersionFixed in Version 
Summary0000632: [patch] Dancing Missiles
DescriptionThis adds the dance tag for missilelaunchers that makes the missile move around randomly. Unlike wobble it doesn't rotate the missile and it prevents the missile from going too far off course so a dancing swarm will remain coherent.

Demonstration picture: http://mitglied.lycos.de/KDR_11k/pics/ext/dance%20my%20missiles!.jpg

It's mostly for looking cool but could be used to prevent missiles from being accurate vs smaller targets without having their accuracy change over distance.
TagsNo tags attached.
Checked infolog.txt for Errors
Attached Files
  • patch file icon danceMissiles.patch (3,320 bytes) 2007-09-14 11:33 -
    Index: Lua/LuaWeaponDefs.cpp
    ===================================================================
    --- Lua/LuaWeaponDefs.cpp	(revision 4376)
    +++ Lua/LuaWeaponDefs.cpp	(working copy)
    @@ -516,6 +516,7 @@
     	ADD_FLOAT("explosionSpeed", wd.explosionSpeed);
     
     	ADD_FLOAT("wobble", wd.wobble);
    +	ADD_FLOAT("dance", wd.dance);
     	ADD_FLOAT("trajectoryHeight", wd.trajectoryHeight);
     
     	ADD_BOOL("largeBeamLaser", wd.largeBeamLaser);
    Index: Sim/Projectiles/WeaponProjectiles/MissileProjectile.cpp
    ===================================================================
    --- Sim/Projectiles/WeaponProjectiles/MissileProjectile.cpp	(revision 4376)
    +++ Sim/Projectiles/WeaponProjectiles/MissileProjectile.cpp	(working copy)
    @@ -40,6 +40,10 @@
     	CR_MEMBER(wobbleDir),
     	CR_MEMBER(wobbleTime),
     	CR_MEMBER(wobbleDif),
    +	CR_MEMBER(danceMove),
    +	CR_MEMBER(danceCenter),
    +	CR_MEMBER(danceTime),
    +	CR_MEMBER(isDancing),
     	CR_MEMBER(extraHeight),
     	CR_MEMBER(extraHeightDecay),
     	CR_MEMBER(extraHeightTime),
    @@ -62,6 +66,10 @@
     	wobbleTime(1),
     	wobbleDir(0,0,0),
     	wobbleDif(0,0,0),
    +	danceMove(0,0,0),
    +	danceCenter(0,0,0),
    +	danceTime(1),
    +	isDancing(weaponDef?weaponDef->dance>0:false),
     	isWobbling(weaponDef?weaponDef->wobble>0:false),
     	extraHeightTime(0)
     {
    @@ -172,6 +180,16 @@
     			dir+=wobbleDir*weaponDef->wobble*(owner?(1-owner->limExperience*0.5f):1);
     			dir.Normalize();
     		}
    +		
    +		if(isDancing) {
    +			--danceTime;
    +			if(danceTime<=0) {
    +				danceMove = gs->randVector() * weaponDef->dance - danceCenter;
    +				danceCenter += danceMove;
    +				danceTime=8;
    +			}
    +			pos+=danceMove;
    +		}
     
     		float3 orgTargPos(targPos);
     		float dist=targPos.distance(pos);
    Index: Sim/Projectiles/WeaponProjectiles/MissileProjectile.h
    ===================================================================
    --- Sim/Projectiles/WeaponProjectiles/MissileProjectile.h	(revision 4376)
    +++ Sim/Projectiles/WeaponProjectiles/MissileProjectile.h	(working copy)
    @@ -40,6 +40,11 @@
     	float3 wobbleDir;
     	int wobbleTime;
     	float3 wobbleDif;
    +	
    +	bool isDancing;
    +	int danceTime;
    +	float3 danceMove;
    +	float3 danceCenter;	//vector that points towards the center of the dance to keep the movement "coherent"
     
     	float extraHeight;
     	float extraHeightDecay;
    Index: Sim/Weapons/WeaponDefHandler.cpp
    ===================================================================
    --- Sim/Weapons/WeaponDefHandler.cpp	(revision 4376)
    +++ Sim/Weapons/WeaponDefHandler.cpp	(working copy)
    @@ -353,6 +353,7 @@
     	wd.interceptedByShieldType = wdTable.GetInt("interceptedByShieldType", defInterceptType);
     
     	wd.wobble = wdTable.GetFloat("wobble", 0.0f) * PI / 0x7fff / 30.0f;
    +	wd.dance = wdTable.GetFloat("dance", 0.0f) / GAME_SPEED;
     	wd.trajectoryHeight = wdTable.GetFloat("trajectoryHeight", 0.0f);
     
     	wd.noAutoTarget = (wd.manualfire || wd.interceptor || wd.isShield);
    Index: Sim/Weapons/WeaponDefHandler.h
    ===================================================================
    --- Sim/Weapons/WeaponDefHandler.h	(revision 4376)
    +++ Sim/Weapons/WeaponDefHandler.h	(working copy)
    @@ -127,6 +127,7 @@
     	unsigned int onlyTargetCategory;
     
     	float wobble;						//how much the missile will wobble around its course
    +	float dance;	//how much the missile will dance
     	float trajectoryHeight;			//how high trajectory missiles will try to fly in
     
     	struct Visuals
    
    patch file icon danceMissiles.patch (3,320 bytes) 2007-09-14 11:33 +

-Relationships
+Relationships

-Notes

~0001257

Kloot (developer)

committed, r4380 (more cool
simple patches like this are
most welcome ;))
+Notes

-Issue History
Date Modified Username Field Change
2007-09-14 11:33 KDR_11k New Issue
2007-09-14 11:33 KDR_11k File Added: danceMissiles.patch
2007-09-14 19:57 Kloot Note Added: 0001257
2007-09-14 19:57 Kloot Status new => resolved
2007-09-14 19:57 Kloot Resolution open => fixed
2007-09-14 19:57 Kloot Assigned To => Kloot
+Issue History