From c7dec38b967f9506f53679116738e904cbc52e4c Mon Sep 17 00:00:00 2001 From: obligaron Date: Mon, 13 Sep 2021 21:56:13 +0200 Subject: [PATCH] Player: rename _pVar4 to spellLevel --- Source/loadsave.cpp | 4 ++-- Source/player.cpp | 14 +++++++------- Source/player.h | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Source/loadsave.cpp b/Source/loadsave.cpp index bb27646b7..f49beedd3 100644 --- a/Source/loadsave.cpp +++ b/Source/loadsave.cpp @@ -415,7 +415,7 @@ void LoadPlayer(LoadHelper &file, Player &player) player.position.temp.x = file.NextLE(); player.position.temp.y = file.NextLE(); player.tempDirection = static_cast(file.NextLE()); - player._pVar4 = file.NextLE(); + player.spellLevel = file.NextLE(); 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(); player.position.offset2.deltaY = file.NextLE(); @@ -1090,7 +1090,7 @@ void SavePlayer(SaveHelper &file, const Player &player) file.WriteLE(player.position.temp.x); file.WriteLE(player.position.temp.y); file.WriteLE(static_cast(player.tempDirection)); - file.WriteLE(player._pVar4); + file.WriteLE(player.spellLevel); file.Skip(); // skip _pVar5, was used for storing position of a tile which should have its BFLAG_PLAYERLR flag removed after walking file.WriteLE(player.position.offset2.deltaX); file.WriteLE(player.position.offset2.deltaY); diff --git a/Source/player.cpp b/Source/player.cpp index f6923c1c8..1d49d076d 100644 --- a/Source/player.cpp +++ b/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(player.destParam3); + player.spellLevel = static_cast(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); diff --git a/Source/player.h b/Source/player.h index f820033e0..70fe77858 100644 --- a/Source/player.h +++ b/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];