Browse Source

Player: rename _pVar4 to spellLevel

pull/2891/head
obligaron 5 years ago committed by Anders Jenbo
parent
commit
c7dec38b96
  1. 4
      Source/loadsave.cpp
  2. 14
      Source/player.cpp
  3. 2
      Source/player.h

4
Source/loadsave.cpp

@ -415,7 +415,7 @@ void LoadPlayer(LoadHelper &file, Player &player)
player.position.temp.x = file.NextLE<int32_t>();
player.position.temp.y = file.NextLE<int32_t>();
player.tempDirection = static_cast<Direction>(file.NextLE<int32_t>());
player._pVar4 = file.NextLE<int32_t>();
player.spellLevel = file.NextLE<int32_t>();
file.Skip(4); // skip _pVar5, was used for storing position of a tile which should have its BFLAG_PLAYERLR flag removed after walking
player.position.offset2.deltaX = file.NextLE<int32_t>();
player.position.offset2.deltaY = file.NextLE<int32_t>();
@ -1090,7 +1090,7 @@ void SavePlayer(SaveHelper &file, const Player &player)
file.WriteLE<int32_t>(player.position.temp.x);
file.WriteLE<int32_t>(player.position.temp.y);
file.WriteLE<int32_t>(static_cast<int32_t>(player.tempDirection));
file.WriteLE<int32_t>(player._pVar4);
file.WriteLE<int32_t>(player.spellLevel);
file.Skip<int32_t>(); // skip _pVar5, was used for storing position of a tile which should have its BFLAG_PLAYERLR flag removed after walking
file.WriteLE<int32_t>(player.position.offset2.deltaX);
file.WriteLE<int32_t>(player.position.offset2.deltaY);

14
Source/player.cpp

@ -407,7 +407,7 @@ void ClearStateVariables(Player &player)
{
player.position.temp = { 0, 0 };
player.tempDirection = Direction::South;
player._pVar4 = 0;
player.spellLevel = 0;
player.position.offset2 = { 0, 0 };
player.deathFrame = 0;
}
@ -561,7 +561,7 @@ void StartSpell(int pnum, Direction d, int cx, int cy)
SetPlayerOld(player);
player.position.temp = { cx, cy };
player._pVar4 = GetSpellLevel(pnum, player._pSpell);
player.spellLevel = GetSpellLevel(pnum, player._pSpell);
}
void RespawnDeadItem(Item *itm, Point target)
@ -1456,7 +1456,7 @@ bool DoSpell(int pnum)
player.position.tile.y,
player.position.temp.x,
player.position.temp.y,
player._pVar4);
player.spellLevel);
if (player._pSplFrom == 0) {
EnsureValidReadiedSpell(player);
@ -1701,22 +1701,22 @@ void CheckNewPath(int pnum, bool pmWillBeCalled)
case ACTION_SPELL:
d = GetDirection(player.position.tile, { player.destParam1, player.destParam2 });
StartSpell(pnum, d, player.destParam1, player.destParam2);
player._pVar4 = static_cast<int>(player.destParam3);
player.spellLevel = static_cast<int>(player.destParam3);
break;
case ACTION_SPELLWALL:
StartSpell(pnum, player.destParam3, player.destParam1, player.destParam2);
player.tempDirection = player.destParam3;
player._pVar4 = player.destParam4;
player.spellLevel = player.destParam4;
break;
case ACTION_SPELLMON:
d = GetDirection(player.position.tile, monster->position.future);
StartSpell(pnum, d, monster->position.future.x, monster->position.future.y);
player._pVar4 = player.destParam2;
player.spellLevel = player.destParam2;
break;
case ACTION_SPELLPLR:
d = GetDirection(player.position.tile, target->position.future);
StartSpell(pnum, d, target->position.future.x, target->position.future.y);
player._pVar4 = player.destParam2;
player.spellLevel = player.destParam2;
break;
case ACTION_OPERATE:
x = abs(player.position.tile.x - object->position.x);

2
Source/player.h

@ -243,7 +243,7 @@ struct Player {
/** Player's direction when ending movement. Also used for casting direction of SPL_FIREWALL. */
Direction tempDirection;
/** Used for spell level */
int _pVar4;
int spellLevel;
/** Used for stalling the appearance of the options screen after dying in singleplayer */
int deathFrame;
bool _pLvlVisited[NUMLEVELS];

Loading…
Cancel
Save