Skip to content
Permalink
Browse files
Always check entity handles in spell End methods
  • Loading branch information
Eli2 committed Dec 29, 2016
1 parent de119b5 commit 75e8040e25e455b9b074d6a2b40b229e8abfdfca
@@ -66,7 +66,10 @@ void MagicSightSpell::End()
player.m_improve = false;
ARX_SOUND_Stop(m_snd_loop);
}
ARX_SOUND_PlaySFX(SND_SPELL_VISION_START, &entities[m_caster]->pos);

if(ValidIONum(m_caster)) {
ARX_SOUND_PlaySFX(SND_SPELL_VISION_START, &entities[m_caster]->pos);
}
}

void MagicSightSpell::Update() {
@@ -238,9 +238,9 @@ void ArmorSpell::Launch()
void ArmorSpell::End()
{
ARX_SOUND_Stop(m_snd_loop);
ARX_SOUND_PlaySFX(SND_SPELL_ARMOR_END, &entities[m_target]->pos);

if(ValidIONum(m_target)) {
ARX_SOUND_PlaySFX(SND_SPELL_ARMOR_END, &entities[m_target]->pos);
ARX_HALO_SetToNative(entities[m_target]);
}

@@ -308,11 +308,13 @@ void LowerArmorSpell::Launch()
void LowerArmorSpell::End()
{
ARX_SOUND_PlaySFX(SND_SPELL_LOWER_ARMOR_END);
Entity *io = entities[m_target];

if(m_haloCreated) {
io->halo.flags &= ~HALO_ACTIVE;
ARX_HALO_SetToNative(io);
if(ValidIONum(m_target)) {
Entity *io = entities[m_target];
io->halo.flags &= ~HALO_ACTIVE;
ARX_HALO_SetToNative(io);
}
}

m_targets.clear();
@@ -99,7 +99,9 @@ void SpeedSpell::End() {
if(m_caster == EntityHandle_Player)
ARX_SOUND_Stop(m_snd_loop);

ARX_SOUND_PlaySFX(SND_SPELL_SPEED_END, &entities[m_target]->pos);
if(ValidIONum(m_target)) {
ARX_SOUND_PlaySFX(SND_SPELL_SPEED_END, &entities[m_target]->pos);
}

for(size_t i = 0; i < m_trails.size(); i++) {
delete m_trails[i].trail;
@@ -266,11 +266,13 @@ void FireProtectionSpell::Launch()
void FireProtectionSpell::End()
{
ARX_SOUND_Stop(m_snd_loop);
ARX_SOUND_PlaySFX(SND_SPELL_FIRE_PROTECTION_END, &entities[m_target]->pos);
m_targets.clear();

if(ValidIONum(m_target))
if(ValidIONum(m_target)) {
ARX_SOUND_PlaySFX(SND_SPELL_FIRE_PROTECTION_END, &entities[m_target]->pos);
ARX_HALO_SetToNative(entities[m_target]);
}

m_targets.clear();
}

void FireProtectionSpell::Update() {
@@ -325,11 +327,13 @@ void ColdProtectionSpell::Launch()
void ColdProtectionSpell::End()
{
ARX_SOUND_Stop(m_snd_loop);
ARX_SOUND_PlaySFX(SND_SPELL_COLD_PROTECTION_END, &entities[m_target]->pos);
m_targets.clear();

if(ValidIONum(m_target))
if(ValidIONum(m_target)) {
ARX_SOUND_PlaySFX(SND_SPELL_COLD_PROTECTION_END, &entities[m_target]->pos);
ARX_HALO_SetToNative(entities[m_target]);
}

m_targets.clear();
}

void ColdProtectionSpell::Update() {
@@ -371,7 +375,9 @@ void TelekinesisSpell::End()
if(m_caster == EntityHandle_Player)
player.m_telekinesis = false;

ARX_SOUND_PlaySFX(SND_SPELL_TELEKINESIS_END, &entities[m_caster]->pos);
if(ValidIONum(m_caster)) {
ARX_SOUND_PlaySFX(SND_SPELL_TELEKINESIS_END, &entities[m_caster]->pos);
}
}


@@ -203,7 +203,11 @@ void LevitateSpell::Launch()
void LevitateSpell::End()
{
ARX_SOUND_Stop(m_snd_loop);
ARX_SOUND_PlaySFX(SND_SPELL_LEVITATE_END, &entities[m_target]->pos);

if(ValidIONum(m_target)) {
ARX_SOUND_PlaySFX(SND_SPELL_LEVITATE_END, &entities[m_target]->pos);
}

m_targets.clear();

if(m_target == EntityHandle_Player)
@@ -247,7 +247,10 @@ void ParalyseSpell::Launch()
void ParalyseSpell::End()
{
m_targets.clear();
entities[m_target]->ioflags &= ~IO_FREEZESCRIPT;

if(ValidIONum(m_target)) {
entities[m_target]->ioflags &= ~IO_FREEZESCRIPT;
}

ARX_SOUND_PlaySFX(SND_SPELL_PARALYSE_END);
}
@@ -115,7 +115,9 @@ void FlyingEyeSpell::Launch()

void FlyingEyeSpell::End()
{
ARX_SOUND_PlaySFX(SND_MAGIC_FIZZLE, &entities[m_caster]->pos);
if(ValidIONum(m_caster)) {
ARX_SOUND_PlaySFX(SND_MAGIC_FIZZLE, &entities[m_caster]->pos);
}

static TextureContainer * tc4=TextureContainer::Load("graph/particles/smoke");

@@ -552,10 +554,12 @@ void LightningStrikeSpell::Launch() {

void LightningStrikeSpell::End()
{
ARX_SOUND_PlaySFX(SND_SPELL_ELECTRIC, &entities[m_caster]->pos);

ARX_SOUND_Stop(m_snd_loop);
ARX_SOUND_PlaySFX(SND_SPELL_LIGHTNING_END, &entities[m_caster]->pos);

if(ValidIONum(m_caster)) {
ARX_SOUND_PlaySFX(SND_SPELL_ELECTRIC, &entities[m_caster]->pos);
ARX_SOUND_PlaySFX(SND_SPELL_LIGHTNING_END, &entities[m_caster]->pos);
}
}

static Vec3f GetChestPos(EntityHandle num) {
@@ -377,7 +377,10 @@ void FreezeTimeSpell::Launch()
void FreezeTimeSpell::End()
{
GLOBAL_SLOWDOWN += m_slowdown;
ARX_SOUND_PlaySFX(SND_SPELL_TELEKINESIS_END, &entities[m_caster]->pos);

if(ValidIONum(m_caster)) {
ARX_SOUND_PlaySFX(SND_SPELL_TELEKINESIS_END, &entities[m_caster]->pos);
}
}

void MassIncinerateSpell::Launch()

0 comments on commit 75e8040

Please sign in to comment.