Browse Source

Remove unused varialbes

pull/25/head
Anders Jenbo 8 years ago
parent
commit
48a1035d4a
  1. 37
      Source/control.cpp
  2. 4
      Source/debug.cpp
  3. 5
      Source/inv.cpp
  4. 16
      Source/items.cpp
  5. 25
      Source/objects.cpp
  6. 4
      Source/pack.cpp
  7. 26
      Source/player.cpp
  8. 20
      structs.h

37
Source/control.cpp

@ -445,21 +445,21 @@ void __cdecl DrawSpellList()
case RSPLTYPE_SKILL:
SetSpellTrans(RSPLTYPE_SKILL);
yp = 46;
v25 = plr[v0]._pAblSpells64;
v25 = plr[v0]._pAblSpells;
break;
case RSPLTYPE_SPELL:
yp = 47;
v25 = plr[v0]._pMemSpells64;
v25 = plr[v0]._pMemSpells;
break;
case RSPLTYPE_SCROLL:
SetSpellTrans(RSPLTYPE_SCROLL);
yp = 44;
v25 = plr[v0]._pScrlSpells64;
v25 = plr[v0]._pScrlSpells;
break;
case RSPLTYPE_CHARGES:
SetSpellTrans(RSPLTYPE_CHARGES);
yp = 45;
v25 = plr[v0]._pISpells64;
v25 = plr[v0]._pISpells;
break;
}
v20 = &spelldata[1].sTownSpell;
@ -674,16 +674,16 @@ void __fastcall ToggleSpell(int slot)
unsigned __int64 spells;
switch ( plr[myplr]._pSplTHotKey[slot] ) {
case RSPLTYPE_SKILL:
spells = plr[myplr]._pAblSpells64;
spells = plr[myplr]._pAblSpells;
break;
case RSPLTYPE_SPELL:
spells = plr[myplr]._pMemSpells64;
spells = plr[myplr]._pMemSpells;
break;
case RSPLTYPE_SCROLL:
spells = plr[myplr]._pScrlSpells64;
spells = plr[myplr]._pScrlSpells;
break;
case RSPLTYPE_CHARGES:
spells = plr[myplr]._pISpells64;
spells = plr[myplr]._pISpells;
break;
}
@ -1239,16 +1239,16 @@ void __cdecl DoSpeedBook()
for ( int i = 0; i < 4; i++ ) {
switch ( i ) {
case RSPLTYPE_SKILL:
spells = plr[myplr]._pAblSpells64;
spells = plr[myplr]._pAblSpells;
break;
case RSPLTYPE_SPELL:
spells = plr[myplr]._pMemSpells64;
spells = plr[myplr]._pMemSpells;
break;
case RSPLTYPE_SCROLL:
spells = plr[myplr]._pScrlSpells64;
spells = plr[myplr]._pScrlSpells;
break;
case RSPLTYPE_CHARGES:
spells = plr[myplr]._pISpells64;
spells = plr[myplr]._pISpells;
break;
}
spell = (__int64)1;
@ -1700,7 +1700,6 @@ void __cdecl DrawInfoBox()
int v3; // esi
char *v4; // eax
const char *v5; // eax
char v6;
signed int v7; // edi
signed int v8; // ebp
int v9; // esi
@ -2559,9 +2558,9 @@ void __cdecl RedBack()
char __fastcall GetSBookTrans(int ii, BOOL townok)
{
char result = RSPLTYPE_SPELL;
if ( (__int64)1 << (ii - 1) & plr[myplr]._pISpells64 )
if ( (__int64)1 << (ii - 1) & plr[myplr]._pISpells )
result = RSPLTYPE_CHARGES;
if ( 1 << (ii - 1) & plr[myplr]._pAblSpells64 )
if ( 1 << (ii - 1) & plr[myplr]._pAblSpells )
result = RSPLTYPE_SKILL;
if ( result == RSPLTYPE_SPELL ) {
@ -2597,7 +2596,7 @@ void __cdecl DrawSpellBook()
CelDecodeOnly(76 * sbooktab + 391, 508, pSBkBtnCel, sbooktab + 1, 76);
v9 = 1;
v8 = 214;
v0 = plr[myplr]._pISpells64 | plr[myplr]._pMemSpells64 | plr[myplr]._pAblSpells64;
v0 = plr[myplr]._pISpells | plr[myplr]._pMemSpells | plr[myplr]._pAblSpells;
do
{
v2 = SpellPages[0][v9 + 7 * sbooktab - 1]; // *(&attribute_inc_rects[3].h + v9 + 7 * sbooktab); /* check */
@ -2712,11 +2711,11 @@ void __cdecl CheckSBook()
if ( MouseX >= 331 && MouseX < 368 && MouseY >= 18 && MouseY < 314 ) {
int spell = SpellPages[sbooktab][(MouseY - 18) / 43];
if ( spell != -1 ) {
if ( (__int64)1 << (spell - 1) & (plr[myplr]._pAblSpells64 | plr[myplr]._pMemSpells64 | plr[myplr]._pISpells64)) {
if ( (__int64)1 << (spell - 1) & (plr[myplr]._pAblSpells | plr[myplr]._pMemSpells | plr[myplr]._pISpells)) {
char splType = RSPLTYPE_SPELL;
if ( (__int64)1 << (spell - 1) & plr[myplr]._pISpells64 )
if ( (__int64)1 << (spell - 1) & plr[myplr]._pISpells )
splType = RSPLTYPE_CHARGES;
if ( (__int64)1 << (spell - 1) & plr[myplr]._pAblSpells64 )
if ( (__int64)1 << (spell - 1) & plr[myplr]._pAblSpells )
splType = RSPLTYPE_SKILL;
plr[myplr]._pRSpell = spell;
plr[myplr]._pRSplType = splType;

4
Source/debug.cpp

@ -105,7 +105,7 @@ void __cdecl MaxSpellsCheat()
{
for(int i = 1; i < MAX_SPELLS; i++) {
if ( spelldata[i].sBookLvl != -1 ) {
plr[myplr]._pMemSpells64 |= (__int64)1 << (i - 1);
plr[myplr]._pMemSpells |= (__int64)1 << (i - 1);
plr[myplr]._pSplLvl[i] = 10;
}
}
@ -113,7 +113,7 @@ void __cdecl MaxSpellsCheat()
void __fastcall SetSpellLevelCheat(char spl, int spllvl)
{
plr[myplr]._pMemSpells64 |= (__int64)1 << (spl - 1);
plr[myplr]._pMemSpells |= (__int64)1 << (spl - 1);
plr[myplr]._pSplLvl[spl] = spllvl;
}

5
Source/inv.cpp

@ -1828,7 +1828,7 @@ void __fastcall RemoveInvItem(int pnum, int iv)
// BUGFIX: Cast the literal `1` to `unsigned __int64` to make that bitshift 64bit
// this causes the last 4 skills to not reset correctly after use
if ( !(
plr[pnum]._pScrlSpells64
plr[pnum]._pScrlSpells
& (1 << (plr[pnum]._pRSpell - 1))) )
{
plr[pnum]._pRSpell = SPL_INVALID;
@ -1852,7 +1852,7 @@ void __fastcall RemoveSpdBarItem(int pnum, int iv)
// BUGFIX: Cast the literal `1` to `unsigned __int64` to make that bitshift 64bit
// this causes the last 4 skills to not reset correctly after use
if ( !(
plr[pnum]._pScrlSpells64
plr[pnum]._pScrlSpells
& (1 << (plr[pnum]._pRSpell - 1))) )
{
plr[pnum]._pRSpell = SPL_INVALID;
@ -2759,7 +2759,6 @@ int __cdecl CheckInvHLight()
int v5; // ebx
int v6; // edi
char *v7; // eax
char v8;
char v9; // [esp+Fh] [ebp-1h]
v0 = 0;

16
Source/items.cpp

@ -934,7 +934,7 @@ void __fastcall CalcPlrItemVals(int p, BOOL Loadgfx)
plr[p]._pDamageMod = plr[p]._pLevel * plr[p]._pStrength / 100;
}
plr[p]._pISpells64 = spl;
plr[p]._pISpells = spl;
// check if the current RSplType is a valid/allowed spell
if ( plr[p]._pRSplType == RSPLTYPE_CHARGES
@ -1119,22 +1119,22 @@ void __fastcall CalcPlrItemVals(int p, BOOL Loadgfx)
void __fastcall CalcPlrScrolls(int p)
{
plr[p]._pScrlSpells64 = 0;
plr[p]._pScrlSpells = 0;
for (int i = 0; i < plr[p]._pNumInv; i++ ) {
if ( plr[p].InvList[i]._itype != ITYPE_NONE && (plr[p].InvList[i]._iMiscId == IMISC_SCROLL || plr[p].InvList[i]._iMiscId == IMISC_SCROLLT) ) {
if ( plr[p].InvList[i]._iStatFlag )
plr[p]._pScrlSpells64 |= (__int64)1 << (plr[p].InvList[i]._iSpell - 1);
plr[p]._pScrlSpells |= (__int64)1 << (plr[p].InvList[i]._iSpell - 1);
}
}
for (int j = 0; j < MAXBELTITEMS; j++) {
if ( plr[p].SpdList[j]._itype != ITYPE_NONE && (plr[p].SpdList[j]._iMiscId == IMISC_SCROLL || plr[p].SpdList[j]._iMiscId == IMISC_SCROLLT) ) {
if ( plr[p].SpdList[j]._iStatFlag )
plr[p]._pScrlSpells64 |= (__int64)1 << (plr[p].SpdList[j]._iSpell - 1);
plr[p]._pScrlSpells |= (__int64)1 << (plr[p].SpdList[j]._iSpell - 1);
}
}
if ( plr[p]._pRSplType == RSPLTYPE_SCROLL ) {
if ( !(plr[p]._pScrlSpells64 & 1 << (plr[p]._pRSpell - 1)) ) {
if ( !(plr[p]._pScrlSpells & 1 << (plr[p]._pRSpell - 1)) ) {
plr[p]._pRSpell = SPL_INVALID;
plr[p]._pRSplType = RSPLTYPE_INVALID;
drawpanflag = 255;
@ -1145,9 +1145,9 @@ void __fastcall CalcPlrScrolls(int p)
void __fastcall CalcPlrStaff(int pnum)
{
plr[pnum]._pISpells64 = 0;
plr[pnum]._pISpells = 0;
if ( plr[pnum].InvBody[INVLOC_HAND_LEFT]._itype != ITYPE_NONE && plr[pnum].InvBody[INVLOC_HAND_LEFT]._iStatFlag && plr[pnum].InvBody[INVLOC_HAND_LEFT]._iCharges > 0 ) {
plr[pnum]._pISpells64 |= (__int64)1 << (plr[pnum].InvBody[INVLOC_HAND_LEFT]._iSpell - 1);
plr[pnum]._pISpells |= (__int64)1 << (plr[pnum].InvBody[INVLOC_HAND_LEFT]._iSpell - 1);
}
}
@ -4537,7 +4537,7 @@ LABEL_71:
if ( v24 != 2 )
return;
v25 = p;
plr[p]._pMemSpells64 |= (__int64)1 << (spl - 1);
plr[p]._pMemSpells |= (__int64)1 << (spl - 1);
v26 = &plr[p]._pSplLvl[spl];
if ( *v26 < 15 )
++*v26;

25
Source/objects.cpp

@ -3971,7 +3971,6 @@ LABEL_17:
void __fastcall OperateBook(int pnum, int i)
{
int v3; // edx
signed int v4; // ecx
int v5; // eax
bool v6; // zf
@ -4029,7 +4028,7 @@ LABEL_17:
if ( !v6 )
{
if ( setlvlnum == SL_BONECHAMB ) {
plr[myplr]._pMemSpells64 |= (__int64)1 << (SPL_GUARDIAN - 1);
plr[myplr]._pMemSpells |= (__int64)1 << (SPL_GUARDIAN - 1);
if ( plr[pnum]._pSplLvl[SPL_GUARDIAN] < 15 )
plr[myplr]._pSplLvl[SPL_GUARDIAN]++;
quests[QTYPE_BONE]._qactive = 3;
@ -4722,19 +4721,14 @@ void __fastcall OperateShrine(int pnum, int i, int sType)
signed int v51; // ecx
__int64 v52; // edi
int v53; // esi
int v54; // ebx
int v55; // eax
bool v56; // zf
__int64 v57; // ebx
unsigned int v58; // edi
signed int v59; // edx
int v60; // ebx
char *v61; // esi
int j; // edi
int v63; // esi
int v64; // eax
int *v65; // eax
int v66; // edx
char v67; // al
char v68; // al
int v69; // esi
@ -4761,8 +4755,6 @@ void __fastcall OperateShrine(int pnum, int i, int sType)
int v91; // esi
int v92; // eax
int v93; // edx
int *v94; // eax
int v95; // edx
char v96; // al
char v97; // al
int v98; // esi
@ -4780,8 +4772,6 @@ void __fastcall OperateShrine(int pnum, int i, int sType)
int v110; // eax
_BYTE *v111; // eax
signed int v112; // edx
int *v113; // eax
int v114; // edx
char v115; // al
char v116; // al
int v117; // esi
@ -4804,7 +4794,6 @@ void __fastcall OperateShrine(int pnum, int i, int sType)
int v135; // edi
int v136; // esi
unsigned short param2; // [esp+Ch] [ebp-18h]
int v138; // [esp+14h] [ebp-10h]
signed int v139; // [esp+1Ch] [ebp-8h]
int *v140; // [esp+1Ch] [ebp-8h]
signed int v141; // [esp+1Ch] [ebp-8h]
@ -5156,7 +5145,7 @@ LABEL_47:
v139 = MAX_SPELLS;
do
{
if ( v52 & plr[arglist]._pMemSpells64 )
if ( v52 & plr[arglist]._pMemSpells )
++sfx_ida;
v52 *= 2;
v56 = v139-- == 1;
@ -5168,7 +5157,7 @@ LABEL_47:
v59 = 1;
do
{
if ( v57 & plr[v53]._pMemSpells64 ) {
if ( v57 & plr[v53]._pMemSpells ) {
v7 = (int)&plr[v53]._pSplLvl[v59];
if ( *(_BYTE *)v7 < 15 )
++*(_BYTE *)v7;
@ -5181,7 +5170,7 @@ LABEL_47:
{
v60 = random(0, MAX_SPELLS);
}
while ( !(plr[v53]._pMemSpells64 & ((__int64)1 << v60)) );
while ( !(plr[v53]._pMemSpells & ((__int64)1 << v60)) );
v61 = &plr[v53]._pSplLvl[v60 + 1];
if ( *v61 < 2 )
*v61 = 0;
@ -5214,7 +5203,7 @@ LABEL_47:
if ( v5 || arglist != myplr )
return;
v7 = 21720 * arglist;
plr[arglist]._pMemSpells64 |= (__int64)1 << (SPL_FIREBOLT - 1);
plr[arglist]._pMemSpells |= (__int64)1 << (SPL_FIREBOLT - 1);
v67 = plr[arglist]._pSplLvl[SPL_FIREBOLT];
if ( v67 < 15 )
plr[0]._pSplLvl[v7 + SPL_FIREBOLT] = v67 + 1;
@ -5407,7 +5396,7 @@ LABEL_47:
if ( v5 || arglist != myplr )
return;
v7 = 21720 * arglist;
plr[arglist]._pMemSpells64 |= (__int64)1 << (SPL_CBOLT - 1);
plr[arglist]._pMemSpells |= (__int64)1 << (SPL_CBOLT - 1);
v96 = plr[arglist]._pSplLvl[SPL_CBOLT];
if ( v96 < 15 )
plr[0]._pSplLvl[v7 + SPL_CBOLT] = v96 + 1;
@ -5533,7 +5522,7 @@ LABEL_47:
if ( v5 || arglist != myplr )
return;
v7 = 21720 * arglist;
plr[arglist]._pMemSpells64 |= (__int64)1 << (SPL_HBOLT - 1);
plr[arglist]._pMemSpells |= (__int64)1 << (SPL_HBOLT - 1);
v115 = plr[arglist]._pSplLvl[SPL_HBOLT];
if ( v115 < 15 )
plr[0]._pSplLvl[v7 + SPL_HBOLT] = v115 + 1;

4
Source/pack.cpp

@ -47,7 +47,7 @@ void __fastcall PackPlayer(PkPlayerStruct *pPack, int pnum, BOOL manashield)
pPack->pMaxHPBase = pPlayer->_pMaxHPBase;
pPack->pManaBase = pPlayer->_pManaBase;
pPack->pMaxManaBase = pPlayer->_pMaxManaBase;
pPack->pMemSpells = pPlayer->_pMemSpells64;
pPack->pMemSpells = pPlayer->_pMemSpells;
for(i = 0; i < MAX_SPELLS; i++)
pPack->pSplLvl[i] = pPlayer->_pSplLvl[i];
@ -195,7 +195,7 @@ void __fastcall UnPackPlayer(PkPlayerStruct *pPack, int pnum, bool killok)
}
pPlayer->_pMaxManaBase = pPack->pMaxManaBase;
pPlayer->_pManaBase = pPack->pManaBase;
pPlayer->_pMemSpells64 = pPack->pMemSpells;
pPlayer->_pMemSpells = pPack->pMemSpells;
for(i = 0; i < MAX_SPELLS; i++)
pPlayer->_pSplLvl[i] = pPack->pSplLvl[i];

26
Source/player.cpp

@ -601,17 +601,17 @@ void __fastcall CreatePlayer(int pnum, char c)
plr[pnum]._pInfraFlag = 0;
if (c == PC_WARRIOR) {
plr[pnum]._pAblSpells64 = (__int64)1 << (SPL_REPAIR - 1);
plr[pnum]._pAblSpells = (__int64)1 << (SPL_REPAIR - 1);
} else if (c == PC_ROGUE) {
plr[pnum]._pAblSpells64 = (__int64)1 << (SPL_DISARM - 1);
plr[pnum]._pAblSpells = (__int64)1 << (SPL_DISARM - 1);
} else if (c == PC_SORCERER) {
plr[pnum]._pAblSpells64 = (__int64)1 << (SPL_RECHARGE - 1);
plr[pnum]._pAblSpells = (__int64)1 << (SPL_RECHARGE - 1);
}
if (c == PC_SORCERER) {
plr[pnum]._pMemSpells64 = 1;
plr[pnum]._pMemSpells = 1;
} else {
plr[pnum]._pMemSpells64 = 0;
plr[pnum]._pMemSpells = 0;
}
int i;
@ -878,22 +878,22 @@ void __fastcall InitPlayer(int pnum, BOOL FirstTime)
}
if (plr[pnum]._pClass == PC_WARRIOR) {
plr[pnum]._pAblSpells64 = 1 << (SPL_REPAIR - 1);
plr[pnum]._pAblSpells = 1 << (SPL_REPAIR - 1);
} else if (plr[pnum]._pClass == PC_ROGUE) {
plr[pnum]._pAblSpells64 = 1 << (SPL_DISARM - 1);
plr[pnum]._pAblSpells = 1 << (SPL_DISARM - 1);
} else if (plr[pnum]._pClass == PC_SORCERER) {
plr[pnum]._pAblSpells64 = 1 << (SPL_RECHARGE - 1);
plr[pnum]._pAblSpells = 1 << (SPL_RECHARGE - 1);
}
#ifdef _DEBUG
if (debug_mode_dollar_sign && FirstTime) {
plr[pnum]._pMemSpells64 |= 1 << (SPL_TELEPORT - 1);
plr[pnum]._pMemSpells |= 1 << (SPL_TELEPORT - 1);
if (!plr[myplr]._pSplLvl[SPL_TELEPORT]) {
plr[myplr]._pSplLvl[SPL_TELEPORT] = 1;
}
}
if (debug_mode_key_inverted_v && FirstTime) {
plr[pnum]._pMemSpells64 = SPL_INVALID;
plr[pnum]._pMemSpells = SPL_INVALID;
}
#endif
@ -2773,7 +2773,7 @@ BOOL __fastcall PM_DoSpell(int pnum)
if (!plr[pnum]._pSplFrom) {
if (plr[pnum]._pRSplType == RSPLTYPE_SCROLL) {
if (!(plr[pnum]._pScrlSpells64
if (!(plr[pnum]._pScrlSpells
& (unsigned __int64)1 << (plr[pnum]._pRSpell - 1))) {
plr[pnum]._pRSpell = SPL_INVALID;
plr[pnum]._pRSplType = RSPLTYPE_INVALID;
@ -2782,7 +2782,7 @@ BOOL __fastcall PM_DoSpell(int pnum)
}
if (plr[pnum]._pRSplType == RSPLTYPE_CHARGES) {
if (!(plr[pnum]._pISpells64
if (!(plr[pnum]._pISpells
& (unsigned __int64)1 << (plr[pnum]._pRSpell - 1))) {
plr[pnum]._pRSpell = SPL_INVALID;
plr[pnum]._pRSplType = RSPLTYPE_INVALID;
@ -3315,7 +3315,7 @@ void __cdecl ValidatePlayer()
}
}
plr[myplr]._pMemSpells64 &= msk;
plr[myplr]._pMemSpells &= msk;
}
void __cdecl ProcessPlayers()

20
structs.h

@ -206,18 +206,9 @@ struct PlayerStruct {
int _pSBkSpell;
char _pSBkSplType;
char _pSplLvl[64];
union {
unsigned __int64 _pMemSpells64;
int _pMemSpells[2];
};
union {
unsigned __int64 _pAblSpells64;
int _pAblSpells[2];
};
union {
unsigned __int64 _pScrlSpells64;
int _pScrlSpells[2];
};
unsigned __int64 _pMemSpells;
unsigned __int64 _pAblSpells;
unsigned __int64 _pScrlSpells;
UCHAR _pSpellFlags;
int _pSplHotKey[4];
char _pSplTHotKey[4];
@ -315,10 +306,7 @@ struct PlayerStruct {
int _pIBonusToHit;
int _pIBonusAC;
int _pIBonusDamMod;
union {
unsigned __int64 _pISpells64;
int _pISpells[2];
};
unsigned __int64 _pISpells;
int _pIFlags;
int _pIGetHit;
char _pISplLvlAdd;

Loading…
Cancel
Save