diff --git a/Source/player.cpp b/Source/player.cpp index 89cb7238a..778640b5f 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -3244,7 +3244,6 @@ BOOL PM_DoSpell(int pnum) plr[pnum]._py, plr[pnum]._pVar1, plr[pnum]._pVar2, - 0, plr[pnum]._pVar4); if (plr[pnum]._pSplFrom == 0) { diff --git a/Source/spells.cpp b/Source/spells.cpp index be2399282..dac0fa746 100644 --- a/Source/spells.cpp +++ b/Source/spells.cpp @@ -185,39 +185,24 @@ BOOL CheckSpell(int id, int sn, char st, BOOL manaonly) return result; } -void CastSpell(int id, int spl, int sx, int sy, int dx, int dy, int caster, int spllvl) +void CastSpell(int id, int spl, int sx, int sy, int dx, int dy, int spllvl) { - int i; - int dir; // missile direction - - switch (caster) { - case TARGET_PLAYERS: - dir = monster[id]._mdir; - break; - case TARGET_MONSTERS: - // caster must be 0 already in this case, but oh well, - // it's needed to generate the right code - caster = TARGET_MONSTERS; - dir = plr[id]._pdir; - - if (spl == SPL_FIREWALL || spl == SPL_LIGHTWALL) { - dir = plr[id]._pVar3; - } - break; + int dir = plr[id]._pdir; + if (spl == SPL_FIREWALL || spl == SPL_LIGHTWALL) { + dir = plr[id]._pVar3; } - for (i = 0; spelldata[spl].sMissiles[i] != MIS_ARROW && i < 3; i++) { - AddMissile(sx, sy, dx, dy, dir, spelldata[spl].sMissiles[i], caster, id, 0, spllvl); + for (int i = 0; spelldata[spl].sMissiles[i] != 0 && i < 3; i++) { + AddMissile(sx, sy, dx, dy, dir, spelldata[spl].sMissiles[i], TARGET_MONSTERS, id, 0, spllvl); } - if (spelldata[spl].sMissiles[0] == MIS_TOWN) { + if (spl == SPL_TOWN) { UseMana(id, SPL_TOWN); - } - if (spelldata[spl].sMissiles[0] == MIS_CBOLT) { + } else if (spl == SPL_CBOLT) { UseMana(id, SPL_CBOLT); - for (i = (spllvl >> 1) + 3; i > 0; i--) { - AddMissile(sx, sy, dx, dy, dir, MIS_CBOLT, caster, id, 0, spllvl); + for (int i = (spllvl >> 1) + 3; i > 0; i--) { + AddMissile(sx, sy, dx, dy, dir, MIS_CBOLT, TARGET_MONSTERS, id, 0, spllvl); } } } diff --git a/Source/spells.h b/Source/spells.h index 3d7f7c81f..ebf54c590 100644 --- a/Source/spells.h +++ b/Source/spells.h @@ -16,7 +16,7 @@ int GetManaAmount(int id, int sn); void UseMana(int id, int sn); BOOL CheckSpell(int id, int sn, char st, BOOL manaonly); void EnsureValidReadiedSpell(PlayerStruct &player); -void CastSpell(int id, int spl, int sx, int sy, int dx, int dy, int caster, int spllvl); +void CastSpell(int id, int spl, int sx, int sy, int dx, int dy, int spllvl); void DoResurrect(int pnum, int rid); void DoHealOther(int pnum, int rid); int GetSpellBookLevel(int s);