From 66438890aada0c0e2a7173e82970f3dbc6af42e4 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Tue, 30 Apr 2019 19:27:19 +0200 Subject: [PATCH] Clean up spells.cpp --- Source/player.cpp | 2 +- Source/spells.cpp | 16 ++++++++-------- Source/spells.h | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Source/player.cpp b/Source/player.cpp index ef65ac296..849614279 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -2795,7 +2795,7 @@ BOOL PM_DoSpell(int pnum) plr[pnum].WorldY, plr[pnum]._pVar1, plr[pnum]._pVar2, - FALSE, + 0, plr[pnum]._pVar4); if (!plr[pnum]._pSplFrom) { diff --git a/Source/spells.cpp b/Source/spells.cpp index bb7a336e3..49b314685 100644 --- a/Source/spells.cpp +++ b/Source/spells.cpp @@ -25,8 +25,7 @@ int GetManaAmount(int id, int sn) adj = sl * (spelldata[SPL_RESURRECT].sManaCost / 8); } - if (spelldata[sn].sManaCost == 255) // TODO: check sign - { + if (spelldata[sn].sManaCost == 255) { i = (BYTE)plr[id]._pMaxManaBase; } else { i = spelldata[sn].sManaCost; @@ -105,17 +104,16 @@ BOOL CheckSpell(int id, int sn, BYTE st, BOOL manaonly) return result; } -void CastSpell(int id, int spl, int sx, int sy, int dx, int dy, BOOL caster, int spllvl) +void CastSpell(int id, int spl, int sx, int sy, int dx, int dy, int caster, int spllvl) { int i; int dir; // missile direction - // ugly switch, but generates the right code switch (caster) { - case TRUE: + case 1: dir = monster[id]._mdir; break; - case FALSE: + case 0: // caster must be 0 already in this case, but oh well, // it's needed to generate the right code caster = 0; @@ -143,8 +141,10 @@ void CastSpell(int id, int spl, int sx, int sy, int dx, int dy, BOOL caster, int } } -// pnum: player index -// rid: target player index +/** + * @param pnum player index + * @param rid target player index + */ void DoResurrect(int pnum, int rid) { int hp; diff --git a/Source/spells.h b/Source/spells.h index d0a58a8f9..9376d27c3 100644 --- a/Source/spells.h +++ b/Source/spells.h @@ -5,7 +5,7 @@ int GetManaAmount(int id, int sn); void UseMana(int id, int sn); BOOL CheckSpell(int id, int sn, BYTE st, BOOL manaonly); -void CastSpell(int id, int spl, int sx, int sy, int dx, int dy, BOOL caster, int spllvl); +void CastSpell(int id, int spl, int sx, int sy, int dx, int dy, int caster, int spllvl); void DoResurrect(int pnum, int rid); void PlacePlayer(int pnum); void DoHealOther(int pnum, int rid);