Browse Source

Clean up DrawSpellList.

pull/124/head
Sergey Semushin 7 years ago committed by Anders Jenbo
parent
commit
ca3841a7dc
  1. 252
      Source/control.cpp

252
Source/control.cpp

@ -376,189 +376,127 @@ void DrawSpell()
void DrawSpellList() void DrawSpellList()
{ {
int v0; // esi int i, j, x, y, c, s, t, v, lx, ly, trans;
signed int v1; // edi unsigned __int64 mask, spl;
signed int v4; // ebp
int v5; // eax
int v6; // esi
int v7; // eax
BOOLEAN v8; // sf
int v9; // esi
int v10; // eax
int v11; // ebp
int v12; // edx
int *v13; // ecx
int *v14; // eax
signed int v15; // edx
signed int v16; // edi
int v17; // [esp+Ch] [ebp-34h]
__int32 xp; // [esp+10h] [ebp-30h]
__int32 yp; // [esp+14h] [ebp-2Ch]
BOOL *v20; // [esp+18h] [ebp-28h]
__int32 nCel; // [esp+1Ch] [ebp-24h]
int v22; // [esp+20h] [ebp-20h]
__int32 v23; // [esp+24h] [ebp-1Ch]
signed int v24; // [esp+28h] [ebp-18h]
unsigned __int64 v25; // [esp+2Ch] [ebp-14h]
signed __int64 v26; // [esp+34h] [ebp-Ch]
pSpell = -1; pSpell = -1;
infostr[0] = 0; infostr[0] = '\0';
v17 = 636; x = 636;
xp = 495; y = 495;
ClearPanel(); ClearPanel();
v0 = myplr; for (i = 0; i < 4; i++) {
v1 = RSPLTYPE_SKILL; switch ((spell_type)i) {
v24 = 0;
do {
switch (v1) {
case RSPLTYPE_SKILL: case RSPLTYPE_SKILL:
SetSpellTrans(RSPLTYPE_SKILL); SetSpellTrans(RSPLTYPE_SKILL);
yp = 46; c = 46;
v25 = plr[v0]._pAblSpells; mask = plr[myplr]._pAblSpells;
break; break;
case RSPLTYPE_SPELL: case RSPLTYPE_SPELL:
yp = 47; c = 47;
v25 = plr[v0]._pMemSpells; mask = plr[myplr]._pMemSpells;
break; break;
case RSPLTYPE_SCROLL: case RSPLTYPE_SCROLL:
SetSpellTrans(RSPLTYPE_SCROLL); SetSpellTrans(RSPLTYPE_SCROLL);
yp = 44; c = 44;
v25 = plr[v0]._pScrlSpells; mask = plr[myplr]._pScrlSpells;
break; break;
case RSPLTYPE_CHARGES: case RSPLTYPE_CHARGES:
SetSpellTrans(RSPLTYPE_CHARGES); SetSpellTrans(RSPLTYPE_CHARGES);
yp = 45; c = 45;
v25 = plr[v0]._pISpells; mask = plr[myplr]._pISpells;
break; break;
} }
v20 = &spelldata[1].sTownSpell; for (spl = 1, j = 1; j < MAX_SPELLS; spl <<= 1, j++) {
v4 = 1; if (!(mask & spl))
v26 = (__int64)1; continue;
v23 = 1; if (i == RSPLTYPE_SPELL) {
v22 = xp - 216; s = plr[myplr]._pISplLvlAdd + plr[myplr]._pSplLvl[j];
do { if (s < 0)
if (!(v25 & v26)) s = 0;
goto LABEL_68; if (s > 0)
if (v1 == RSPLTYPE_SPELL) { trans = RSPLTYPE_SPELL;
v5 = v0; else
v6 = plr[v0]._pSplLvl[v4]; trans = RSPLTYPE_INVALID;
v7 = plr[v5]._pISplLvlAdd; SetSpellTrans(trans);
v8 = v7 + v6 < 0;
v9 = v7 + v6;
nCel = v9;
if (v8) {
nCel = 0;
v9 = 0;
}
SetSpellTrans(v9 <= 0 ? RSPLTYPE_INVALID : RSPLTYPE_SPELL);
} else {
v9 = nCel;
} }
if (!currlevel && !*v20) if (currlevel == 0 && !spelldata[j].sTownSpell)
SetSpellTrans(RSPLTYPE_INVALID); SetSpellTrans(RSPLTYPE_INVALID);
DrawSpellCel(v17, xp, pSpellCels, SpellITbl[v4], 56); DrawSpellCel(x, y, pSpellCels, SpellITbl[j], 56);
if (MouseX >= v17 - 64 && MouseX < v17 - 64 + 56 && MouseY >= v22 && MouseY < v22 + 56) { lx = x - 64;
pSpell = v4; ly = y - 216;
pSplType = v1; if (MouseX >= lx && MouseX < lx + 56 && MouseY >= ly && MouseY < ly + 56) {
DrawSpellCel(v17, xp, pSpellCels, yp, 56); pSpell = j;
if (v1) { pSplType = i;
switch (v1) { DrawSpellCel(x, y, pSpellCels, c, 56);
case RSPLTYPE_SPELL: switch (i) {
sprintf(infostr, "%s Spell", spelldata[pSpell].sNameText); case RSPLTYPE_SKILL:
if (pSpell == 31) { sprintf(infostr, "%s Skill", spelldata[pSpell].sSkillText);
sprintf(tempstr, "Damages undead only"); break;
AddPanelString(tempstr, 1); case RSPLTYPE_SPELL:
} sprintf(infostr, "%s Spell", spelldata[pSpell].sNameText);
if (v9) if (pSpell == SPL_HBOLT) {
sprintf(tempstr, "Spell Level %i", v9); sprintf(tempstr, "Damages undead only");
else
sprintf(tempstr, "Spell Level 0 - Unusable");
LABEL_32:
AddPanelString(tempstr, 1); AddPanelString(tempstr, 1);
break; }
case RSPLTYPE_SCROLL: if (s == 0)
sprintf(infostr, "Scroll of %s", spelldata[pSpell].sNameText); sprintf(tempstr, "Spell Level 0 - Unusable");
v10 = myplr; else
v11 = 0; sprintf(tempstr, "Spell Level %i", s);
v12 = plr[myplr]._pNumInv; AddPanelString(tempstr, TRUE);
if (v12 > 0) { break;
v13 = &plr[v10].InvList[0]._iMiscId; case RSPLTYPE_SCROLL:
do { sprintf(infostr, "Scroll of %s", spelldata[pSpell].sNameText);
if (*(v13 - 53) != -1 v = 0;
&& (*v13 == IMISC_SCROLL || *v13 == IMISC_SCROLLT) for (t = 0; t < plr[myplr]._pNumInv; t++) {
&& v13[1] == pSpell) { if (plr[myplr].InvList[t]._itype != ITYPE_NONE
++v11; && (plr[myplr].InvList[t]._iMiscId == IMISC_SCROLL || plr[myplr].InvList[t]._iMiscId == IMISC_SCROLLT)
} && plr[myplr].InvList[t]._iSpell == pSpell) {
v13 += 92; v++;
--v12;
} while (v12);
} }
v14 = &plr[v10].SpdList[0]._iMiscId;
v15 = MAXBELTITEMS;
do {
if (*(v14 - 53) != -1
&& (*v14 == IMISC_SCROLL || *v14 == IMISC_SCROLLT)
&& v14[1] == pSpell) {
++v11;
}
v14 += 92;
--v15;
} while (v15);
if (v11 == 1)
strcpy(tempstr, "1 Scroll");
else
sprintf(tempstr, "%i Scrolls", v11);
AddPanelString(tempstr, 1);
v4 = v23;
break;
case RSPLTYPE_CHARGES:
sprintf(infostr, "Staff of %s", spelldata[pSpell].sNameText);
if (plr[myplr].InvBody[INVLOC_HAND_LEFT]._iCharges == 1)
strcpy(tempstr, "1 Charge");
else
sprintf(tempstr, "%i Charges", plr[myplr].InvBody[INVLOC_HAND_LEFT]._iCharges);
goto LABEL_32;
} }
} else { for (t = 0; t < MAXBELTITEMS; t++) {
sprintf(infostr, "%s Skill", spelldata[pSpell].sSkillText); if (plr[myplr].SpdList[t]._itype != ITYPE_NONE
&& (plr[myplr].SpdList[t]._iMiscId == IMISC_SCROLL || plr[myplr].SpdList[t]._iMiscId == IMISC_SCROLLT)
&& plr[myplr].SpdList[t]._iSpell == pSpell) {
v++;
}
}
if (v == 1)
strcpy(tempstr, "1 Scroll");
else
sprintf(tempstr, "%i Scrolls", v);
AddPanelString(tempstr, TRUE);
break;
case RSPLTYPE_CHARGES:
sprintf(infostr, "Staff of %s", spelldata[pSpell].sNameText);
if (plr[myplr].InvBody[INVLOC_HAND_LEFT]._iCharges == 1)
strcpy(tempstr, "1 Charge");
else
sprintf(tempstr, "%i Charges", plr[myplr].InvBody[INVLOC_HAND_LEFT]._iCharges);
AddPanelString(tempstr, TRUE);
break;
} }
v0 = myplr; for (t = 0; t < 4; t++) {
v16 = 0; if (plr[myplr]._pSplHotKey[t] == pSpell && plr[myplr]._pSplTHotKey[t] == pSplType) {
do { DrawSpellCel(x, y, pSpellCels, t + 48, 56);
if (plr[v0]._pSplHotKey[v16] == pSpell && plr[v0]._pSplTHotKey[v16] == pSplType) { printf(tempstr, "Spell Hot Key #F%i", t + 5);
DrawSpellCel(v17, xp, pSpellCels, v16 + 48, 56);
sprintf(tempstr, "Spell Hot Key #F%i", v16 + 5);
AddPanelString(tempstr, 1); AddPanelString(tempstr, 1);
v0 = myplr;
} }
++v16; }
} while (v16 < 4);
v1 = v24;
goto LABEL_66;
} }
v0 = myplr; x -= 56;
LABEL_66: if (x == 20) {
v17 -= 56; y -= 56;
if (v17 == 20) { x = 636;
xp -= 56;
v22 -= 56;
v17 = 636;
} }
LABEL_68:
v20 += 14;
++v4;
v26 *= (__int64)2;
v23 = v4;
} while ((signed int)v20 < (signed int)&spelldata[MAX_SPELLS].sTownSpell);
if (v25 && v17 != 636)
v17 -= 56;
if (v17 == 20) {
xp -= 56;
v17 = 636;
} }
v24 = ++v1; if (mask != 0 && x != 636)
} while (v1 < 4); x -= 56;
if (x == 20) {
y -= 56;
x = 636;
}
}
} }
// 4B8834: using guessed type int pSpell; // 4B8834: using guessed type int pSpell;
// 4B8954: using guessed type int pSplType; // 4B8954: using guessed type int pSplType;

Loading…
Cancel
Save