Browse Source

Clean up spells.cpp

pull/100/head
Anders Jenbo 7 years ago
parent
commit
66438890aa
  1. 2
      Source/player.cpp
  2. 16
      Source/spells.cpp
  3. 2
      Source/spells.h

2
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) {

16
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;

2
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);

Loading…
Cancel
Save