Skip to content

Commit

Permalink
Remove spell handle from repel undead spell effect
Browse files Browse the repository at this point in the history
  • Loading branch information
Eli2 committed Jun 9, 2014
1 parent 32c215d commit eeb41b6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 22 deletions.
20 changes: 16 additions & 4 deletions src/game/magic/spells/SpellsLvl05.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ void RepelUndeadSpell::Launch()
m_fManaCostPerSecond = 1.f;

CRepelUndead * effect = new CRepelUndead();
effect->spellinstance = m_thisHandle;
effect->Create(player.pos, MAKEANGLE(player.angle.getPitch()));
effect->SetDuration(m_tolive);
m_pSpellFx = effect;
Expand All @@ -234,9 +233,22 @@ void RepelUndeadSpell::End()

void RepelUndeadSpell::Update(float timeDelta)
{
if(m_pSpellFx) {
m_pSpellFx->Update(timeDelta);
m_pSpellFx->Render();
CRepelUndead * effect = static_cast<CRepelUndead *>(m_pSpellFx);

if(effect) {
Vec3f pos = entities[m_target]->pos;

float rot;
if(m_target == PlayerEntityHandle) {
rot = player.angle.getPitch();
} else {
rot = entities[m_target]->angle.getPitch();
}

effect->SetPos(pos);
effect->SetRotation(rot);
effect->Update(timeDelta);
effect->Render();

if (m_target == PlayerEntityHandle)
ARX_SOUND_RefreshPosition(m_snd_loop, entities[m_target]->pos);
Expand Down
21 changes: 4 additions & 17 deletions src/graphics/spells/Spells05.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -865,30 +865,17 @@ void CRepelUndead::Create(Vec3f aeSrc, float afBeta) {
SetAngle(afBeta);
}

void CRepelUndead::SetPos(const Vec3f & pos)
{

void CRepelUndead::SetPos(const Vec3f & pos) {
eSrc = pos;
}

void CRepelUndead::SetRotation(float rotation)
{

void CRepelUndead::SetRotation(float rotation) {
fBeta = rotation;
}

void CRepelUndead::Update(unsigned long _ulTime) {

ulCurrentTime += _ulTime;
if(spellinstance < 0) {
return;
}

eSrc = entities[spells[spellinstance]->m_target]->pos;

if(spells[spellinstance]->m_target == PlayerEntityHandle) {
fBeta = player.angle.getPitch();
} else {
fBeta = entities[spells[spellinstance]->m_target]->angle.getPitch();
}
}

void CRepelUndead::Render() {
Expand Down
1 change: 0 additions & 1 deletion src/graphics/spells/Spells05.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ class CRepelUndead : public CSpellFx {
void Update(unsigned long);
void Render();

SpellHandle spellinstance;
private:
Vec3f eSrc;
TextureContainer * tex_p2;
Expand Down

0 comments on commit eeb41b6

Please sign in to comment.