2020-05-30 09:44 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000635Spring engineGeneralpublic2007-09-16 19:50
ReporterKDR_11k 
Assigned ToKloot 
PrioritynormalSeverityfeatureReproducibilityN/A
StatusresolvedResolutionfixed 
Product Version 
Target VersionFixed in Version 
Summary0000635: [patch] BeamBurst tag
DescriptionThis adds the beamburst tag (bool) which changes a beamlaser to act like a regular weapon when it comes to burst, the beam won't use beamtime then. This is primarily for beamlasers that are used to simulate other types of weapons that don't have a stream of damage but instead do it all in one hit (rifles, shotguns, railguns, ...). A beamlaser with the tag will go through a normal burst, can use the sprayangle and projectiles tags and will track the target during the burst. It will do full damage with each shot instead of having all shots together do the damage set in the damage section.

The patch also makes beamttl and beamdecay apply to largebeamlasers, too.
TagsNo tags attached.
Checked infolog.txt for Errors
Attached Files
  • patch file icon beamBurst.patch (4,930 bytes) 2007-09-15 15:01 -
    Index: Lua/LuaWeaponDefs.cpp
    ===================================================================
    --- Lua/LuaWeaponDefs.cpp	(revision 4384)
    +++ Lua/LuaWeaponDefs.cpp	(working copy)
    @@ -467,6 +467,7 @@
     	ADD_FLOAT("salvoDelay", wd.salvodelay);
     	ADD_FLOAT("reload",     wd.reload);
     	ADD_FLOAT("beamtime",   wd.beamtime);
    +	ADD_BOOL("beamburst",   wd.beamburst);
     
     	ADD_FLOAT("maxAngle", wd.maxAngle);
     	ADD_FLOAT("restTime", wd.restTime);
    Index: Sim/Projectiles/WeaponProjectiles/LargeBeamLaserProjectile.cpp
    ===================================================================
    --- Sim/Projectiles/WeaponProjectiles/LargeBeamLaserProjectile.cpp	(revision 4384)
    +++ Sim/Projectiles/WeaponProjectiles/LargeBeamLaserProjectile.cpp	(working copy)
    @@ -28,7 +28,9 @@
     CLargeBeamLaserProjectile::CLargeBeamLaserProjectile(const float3& startPos, const float3& endPos, const float3& color, const float3& color2, CUnit* owner, const WeaponDef* weaponDef)
     :	CWeaponProjectile(startPos+(endPos-startPos)*0.5f, ZeroVector, owner, 0, ZeroVector, weaponDef, 0, false),//CProjectile((startPos+endPos)*0.5f,ZeroVector,owner),
     	startPos(startPos),
    -	endPos(endPos)
    +	endPos(endPos),
    +	ttl(0),
    +	decay(1.0f)
     	//thickness(thickness),
     	//corethickness(corethickness),
     	//flaresize(flaresize),
    @@ -71,6 +73,8 @@
     		tilelength = weaponDef->visuals.tilelength;
     		scrollspeed = weaponDef->visuals.scrollspeed;
     		pulseSpeed = weaponDef->visuals.pulseSpeed;
    +		ttl = weaponDef->visuals.beamttl;
    +		decay = weaponDef->visuals.beamdecay;
     	}
     
     	//tilelength = 200;
    @@ -85,7 +89,16 @@
     
     void CLargeBeamLaserProjectile::Update(void)
     {
    -	deleteMe=true;
    +	if (ttl > 0) {
    +		ttl--;
    +		for (int i = 0; i < 3; i++) {
    +			corecolstart[i] = (unsigned char) (corecolstart[i] * decay);
    +			kocolstart[i] = (unsigned char) (kocolstart[i] * decay);
    +		}
    +	}
    +	else {
    +		deleteMe=true;
    +	}
     }
     
     void CLargeBeamLaserProjectile::Draw(void)
    Index: Sim/Projectiles/WeaponProjectiles/LargeBeamLaserProjectile.h
    ===================================================================
    --- Sim/Projectiles/WeaponProjectiles/LargeBeamLaserProjectile.h	(revision 4384)
    +++ Sim/Projectiles/WeaponProjectiles/LargeBeamLaserProjectile.h	(working copy)
    @@ -27,6 +27,8 @@
     	float tilelength;
     	float scrollspeed;
     	float pulseSpeed;
    +	float decay;
    +	int ttl;
     
     	AtlasedTexture beamtex;
     	AtlasedTexture side;
    Index: Sim/Weapons/BeamLaser.cpp
    ===================================================================
    --- Sim/Weapons/BeamLaser.cpp	(revision 4384)
    +++ Sim/Weapons/BeamLaser.cpp	(working copy)
    @@ -48,7 +48,8 @@
     			wantedDir=targetPos-weaponPos;
     			wantedDir.Normalize();
     		}
    -		predict=salvoSize/2;
    +		if (!weaponDef->beamburst) predict=salvoSize/2;
    +		else predict=0; //beamburst tracks the target during the burst so there's no need to lead
     	}
     	CWeapon::Update();
     
    @@ -111,10 +112,15 @@
     
     void CBeamLaser::Init(void)
     {
    -	salvoDelay=0;
    -	salvoSize=(int)(weaponDef->beamtime*30);
    -	if (salvoSize <= 0) salvoSize = 1;
    -	damageMul = 1.0f/(float)salvoSize;		//multiply damage with this on each shot so the total damage done is correct
    +	if(!weaponDef->beamburst) {
    +		salvoDelay=0;
    +		salvoSize=(int)(weaponDef->beamtime*30);
    +		if (salvoSize <= 0) salvoSize = 1;
    +		damageMul = 1.0f/(float)salvoSize;		//multiply damage with this on each shot so the total damage done is correct
    +	}
    +	else {
    +		damageMul=1.0f;
    +	}
     
     	CWeapon::Init();
     
    @@ -133,6 +139,11 @@
     			dir=targetPos-weaponMuzzlePos;
     			dir.Normalize();
     			oldDir=dir;
    +		} else if (weaponDef->beamburst) {
    +			if(fireSoundId && !weaponDef->soundTrigger)
    +				sound->PlaySample(fireSoundId,owner,fireSoundVolume);
    +			dir=targetPos-weaponMuzzlePos;
    +			dir.Normalize();
     		} else {
     			dir=oldDir;
     		}
    @@ -156,6 +167,8 @@
     	float curLength=0;
     	float3 curPos=weaponMuzzlePos;
     	float3 hitPos;
    +	dir+= gs->randVector()*sprayangle*(1-owner->limExperience*0.7f);
    +	dir.Normalize();
     
     	bool tryAgain=true;
     	CUnit* hit;
    Index: Sim/Weapons/WeaponDefHandler.cpp
    ===================================================================
    --- Sim/Weapons/WeaponDefHandler.cpp	(revision 4384)
    +++ Sim/Weapons/WeaponDefHandler.cpp	(working copy)
    @@ -122,6 +122,7 @@
     	wd.isShield      = wdTable.GetBool("isShield",      false);
     	wd.maxvelocity   = wdTable.GetFloat("weaponVelocity", 0.0f);
     	wd.beamtime      = wdTable.GetFloat("beamTime",       1.0f);
    +	wd.beamburst     = wdTable.GetBool("beamburst",     false);
     
     	wd.thickness      = wdTable.GetFloat("thickness",       2.0f);
     	wd.corethickness  = wdTable.GetFloat("coreThickness",   0.25f);
    Index: Sim/Weapons/WeaponDefHandler.h
    ===================================================================
    --- Sim/Weapons/WeaponDefHandler.h	(revision 4384)
    +++ Sim/Weapons/WeaponDefHandler.h	(working copy)
    @@ -63,6 +63,7 @@
     	float salvodelay;
     	float reload;
     	float beamtime;
    +	bool beamburst;
     
     	float maxAngle;
     	float restTime;
    
    patch file icon beamBurst.patch (4,930 bytes) 2007-09-15 15:01 +

-Relationships
+Relationships

-Notes

~0001267

Kloot (developer)

committed, r4403
+Notes

-Issue History
Date Modified Username Field Change
2007-09-15 15:01 KDR_11k New Issue
2007-09-15 15:01 KDR_11k File Added: beamBurst.patch
2007-09-16 19:50 Kloot Note Added: 0001267
2007-09-16 19:50 Kloot Status new => resolved
2007-09-16 19:50 Kloot Resolution open => fixed
2007-09-16 19:50 Kloot Assigned To => Kloot
+Issue History