Skip to content

Commit

Permalink
fix #5806
Browse files Browse the repository at this point in the history
  • Loading branch information
rt committed Dec 1, 2017
1 parent 1b52666 commit 7a48d99
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
20 changes: 10 additions & 10 deletions rts/Rendering/Env/Particles/Classes/ExploSpikeProjectile.cpp
Expand Up @@ -60,6 +60,16 @@ CExploSpikeProjectile::CExploSpikeProjectile(
SetRadiusAndHeight(length + lengthGrowth * alpha / alphaDecay, 0.0f);
}

void CExploSpikeProjectile::Init(const CUnit* owner, const float3& offset)
{
CProjectile::Init(owner, offset);

lengthGrowth = dir.Length() * (0.5f + guRNG.NextFloat() * 0.4f);
dir /= lengthGrowth;

SetRadiusAndHeight(length + lengthGrowth * alpha / alphaDecay, 0.0f);
}

void CExploSpikeProjectile::Update()
{
pos += speed;
Expand Down Expand Up @@ -92,16 +102,6 @@ void CExploSpikeProjectile::Draw(GL::RenderDataBufferTC* va) const
#undef let
}

void CExploSpikeProjectile::Init(const CUnit* owner, const float3& offset)
{
CProjectile::Init(owner, offset);

lengthGrowth = dir.Length() * (0.5f + guRNG.NextFloat() * 0.4f);
dir /= lengthGrowth;

SetRadiusAndHeight(length + lengthGrowth * alpha / alphaDecay, 0.0f);
}


bool CExploSpikeProjectile::GetMemberInfo(SExpGenSpawnableMemberInfo& memberInfo)
{
Expand Down
3 changes: 2 additions & 1 deletion rts/Sim/Projectiles/ProjectileHandler.cpp
Expand Up @@ -27,6 +27,7 @@
#include "System/Config/ConfigHandler.h"
#include "System/EventHandler.h"
#include "System/Log/ILog.h"
#include "System/myMath.h"
#include "System/TimeProfiler.h"
#include "System/creg/STL_Deque.h"

Expand Down Expand Up @@ -607,7 +608,7 @@ void CProjectileHandler::CheckGroundCollisions(ProjectileContainer& pc)
// where we can not live, adjust it and explode us now
// (if the projectile does not set deleteMe = true, it
// will keep hugging the terrain)
p->SetPosition(p->pos * XZVector + UpVector * groundHeight * belowGround);
p->SetPosition((p->pos * XZVector) + (UpVector * mix(p->pos.y, groundHeight, belowGround)));
p->Collision();
}
}
Expand Down

0 comments on commit 7a48d99

Please sign in to comment.