2020-05-30 11:13 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000613Spring engineGeneralpublic2007-08-29 19:40
ReporterKDR_11k 
Assigned ToKloot 
PrioritynormalSeverityfeatureReproducibilityN/A
StatusresolvedResolutionfixed 
Product Version 
Target VersionFixed in Version 
Summary0000613: [patch] Beamlaser fade-out
DescriptionThis patch adds the tags beamttl (default: 0) and beamdecay (default: 1) for the beamlaser. Beamttl defines the time (in frames) the beam will stay after being fired and beamdecay defines the speed of the fadeout (each frame the beam's intensity is multiplied with that value). This applies to the single-frame beams the weapon emits, if it has a beamtime it will emit one such beam every frame, which is only useful if the source of the beam moves a lot (gives a cool trail effect). It's primarily intended for beams with a beamtime of one frame (which often simulate very fast shots instead of constant streams, e.g. railguns) so they don't disappear immediately.
Additional InformationThis does not apply to largebeamlasers.
TagsNo tags attached.
Checked infolog.txt for Errors
Attached Files
  • patch file icon beamlaserFadeout.patch (5,095 bytes) 2007-08-29 16:00 -
    Index: Sim/Projectiles/BeamLaserProjectile.cpp
    ===================================================================
    --- Sim/Projectiles/BeamLaserProjectile.cpp	(revision 4261)
    +++ Sim/Projectiles/BeamLaserProjectile.cpp	(working copy)
    @@ -7,7 +7,7 @@
     #include "Sim/Weapons/WeaponDefHandler.h"
     #include "mmgr.h"
     
    -CR_BIND_DERIVED(CBeamLaserProjectile, CWeaponProjectile, (float3(0,0,0),float3(0,0,0),0,0,float3(0,0,0),float3(0,0,0),NULL,0,0,0,NULL));
    +CR_BIND_DERIVED(CBeamLaserProjectile, CWeaponProjectile, (float3(0,0,0),float3(0,0,0),0,0,float3(0,0,0),float3(0,0,0),NULL,0,0,0,NULL,0,0));
     
     CR_REG_METADATA(CBeamLaserProjectile,(
     	CR_MEMBER(startPos),
    @@ -19,17 +19,21 @@
     	CR_MEMBER(thickness),
     	CR_MEMBER(corethickness),
     	CR_MEMBER(flaresize),
    +	CR_MEMBER(ttl),
    +	CR_MEMBER(decay),
     	CR_MEMBER(midtexx),
     	CR_RESERVED(16)
     	));
     
    -CBeamLaserProjectile::CBeamLaserProjectile(const float3& startPos, const float3& endPos, float startAlpha, float endAlpha, const float3& color, const float3& color2, CUnit* owner, float thickness, float corethickness, float flaresize, const WeaponDef* weaponDef)
    +CBeamLaserProjectile::CBeamLaserProjectile(const float3& startPos, const float3& endPos, float startAlpha, float endAlpha, const float3& color, const float3& color2, CUnit* owner, float thickness, float corethickness, float flaresize, const WeaponDef* weaponDef, int ttl, float decay)
     :	CWeaponProjectile((startPos+endPos)*0.5f, ZeroVector, owner, 0, ZeroVector, weaponDef, 0, false), //CProjectile((startPos+endPos)*0.5f,ZeroVector,owner),
     	startPos(startPos),
     	endPos(endPos),
     	thickness(thickness),
     	corethickness(corethickness),
    -	flaresize(flaresize)
    +	flaresize(flaresize),
    +	ttl(ttl),
    +	decay(decay)
     {
     	checkCol=false;
     	useAirLos=true;
    @@ -62,7 +66,16 @@
     
     void CBeamLaserProjectile::Update(void)
     {
    -	deleteMe=true;
    +	if (ttl <= 0) deleteMe=true;
    +	else {
    +		ttl--;
    +		for (int i = 0; i < 3; i++) {
    +			corecolstart[i]*=decay;
    +			corecolend[i]*=decay;
    +			kocolstart[i]*=decay;
    +			kocolend[i]*=decay;
    +		}
    +	}
     }
     
     void CBeamLaserProjectile::Draw(void)
    Index: Sim/Projectiles/BeamLaserProjectile.h
    ===================================================================
    --- Sim/Projectiles/BeamLaserProjectile.h	(revision 4261)
    +++ Sim/Projectiles/BeamLaserProjectile.h	(working copy)
    @@ -8,7 +8,7 @@
     {
     	CR_DECLARE(CBeamLaserProjectile);
     public:
    -	CBeamLaserProjectile(const float3& startPos, const float3& endPos, float startAlpha, float endAlpha, const float3& color, const float3& color2, CUnit* owner, float thickness, float corethickness, float flaresize, const WeaponDef* weaponDef);
    +	CBeamLaserProjectile(const float3& startPos, const float3& endPos, float startAlpha, float endAlpha, const float3& color, const float3& color2, CUnit* owner, float thickness, float corethickness, float flaresize, const WeaponDef* weaponDef, int ttl, float decay);
     	~CBeamLaserProjectile(void);
     
     	float3 startPos;
    @@ -24,6 +24,9 @@
     	float corethickness;
     	float flaresize;
     	float midtexx;
    +	
    +	int ttl;
    +	float decay;
     
     	void Update(void);
     	void Draw(void);
    Index: Sim/Weapons/BeamLaser.cpp
    ===================================================================
    --- Sim/Weapons/BeamLaser.cpp	(revision 4261)
    +++ Sim/Weapons/BeamLaser.cpp	(working copy)
    @@ -201,7 +201,7 @@
     		if(weaponDef->largeBeamLaser)
     			SAFE_NEW CLargeBeamLaserProjectile(curPos, hitPos, color, weaponDef->visuals.color2, owner,weaponDef);
     		else
    -			SAFE_NEW CBeamLaserProjectile(curPos,hitPos,startAlpha,endAlpha,color,weaponDef->visuals.color2, owner,weaponDef->thickness,weaponDef->corethickness, weaponDef->laserflaresize, weaponDef);
    +			SAFE_NEW CBeamLaserProjectile(curPos,hitPos,startAlpha,endAlpha,color,weaponDef->visuals.color2, owner,weaponDef->thickness,weaponDef->corethickness, weaponDef->laserflaresize, weaponDef, weaponDef->visuals.beamttl, weaponDef->visuals.beamdecay);
     
     		curPos=hitPos;
     		curLength+=length;
    Index: Sim/Weapons/WeaponDefHandler.cpp
    ===================================================================
    --- Sim/Weapons/WeaponDefHandler.cpp	(revision 4261)
    +++ Sim/Weapons/WeaponDefHandler.cpp	(working copy)
    @@ -324,6 +324,8 @@
     	sunparser->GetDef(weaponDefs[id].visuals.scrollspeed, "5", weaponname + "\\scrollspeed");
     	sunparser->GetDef(weaponDefs[id].visuals.pulseSpeed, "1", weaponname + "\\pulseSpeed");
     	sunparser->GetDef(weaponDefs[id].largeBeamLaser, "0", weaponname + "\\largeBeamLaser");
    +	sunparser->GetDef(weaponDefs[id].visuals.beamttl, "0", weaponname + "\\beamttl");
    +	sunparser->GetDef(weaponDefs[id].visuals.beamdecay, "1", weaponname + "\\beamdecay");
     
     	std::string hmod = sunparser->SGetValueDef("", weaponname+"\\heightmod");
     	if (hmod == "") {
    Index: Sim/Weapons/WeaponDefHandler.h
    ===================================================================
    --- Sim/Weapons/WeaponDefHandler.h	(revision 4261)
    +++ Sim/Weapons/WeaponDefHandler.h	(working copy)
    @@ -141,6 +141,8 @@
     		float tilelength;
     		float scrollspeed;
     		float pulseSpeed;
    +		int beamttl;
    +		float beamdecay;
     
     		int stages;
     		float alphaDecay;
    
    patch file icon beamlaserFadeout.patch (5,095 bytes) 2007-08-29 16:00 +

-Relationships
+Relationships

-Notes

~0001187

imbaczek (reporter)

gimme git so I can apply this patch and still be able to commit fixes without having to store a gazillion copies of the source tree...

~0001188

Kloot (developer)

commited with very minor modifications in r4262, thanks!
+Notes

-Issue History
Date Modified Username Field Change
2007-08-29 16:00 KDR_11k New Issue
2007-08-29 16:00 KDR_11k File Added: beamlaserFadeout.patch
2007-08-29 17:24 imbaczek Note Added: 0001187
2007-08-29 19:39 Kloot Note Added: 0001188
2007-08-29 19:40 Kloot Status new => resolved
2007-08-29 19:40 Kloot Resolution open => fixed
2007-08-29 19:40 Kloot Assigned To => Kloot
+Issue History