Browse Source

GetBookSpell bin exact

pull/90/head^2^2
qndel 7 years ago committed by Anders Jenbo
parent
commit
e6744a4f0d
  1. 76
      Source/items.cpp

76
Source/items.cpp

@ -1583,58 +1583,40 @@ void CalcItemValue(int i)
void GetBookSpell(int i, int lvl) void GetBookSpell(int i, int lvl)
{ {
int v2; // edi int rv, s, bs;
int v3; // esi
int v4; // eax
int v5; // edx
signed int v6; // ecx
int v7; // esi
const char **v8; // ebx
int v9; // eax
char v10; // al
int v11; // [esp+8h] [ebp-4h]
v2 = lvl;
v3 = i;
if (!lvl) if (!lvl)
v2 = lvl + 1; lvl = 1;
v4 = random(14, MAX_SPELLS) + 1; rv = random(14, MAX_SPELLS) + 1;
LABEL_13: s = 1;
v6 = 1; while (rv > 0) {
while (v4 > 0) { if (spelldata[s].sBookLvl != -1 && lvl >= spelldata[s].sBookLvl) {
v5 = spelldata[v6].sBookLvl; rv--;
if (v5 != -1 && v2 >= v5) { bs = s;
--v4;
v11 = v6;
} }
++v6; s++;
if (gbMaxPlayers == 1) { if (gbMaxPlayers == 1) {
if (v6 == SPL_RESURRECT) if (s == SPL_RESURRECT)
v6 = SPL_TELEKINESIS; s = SPL_TELEKINESIS;
if (v6 == SPL_HEALOTHER) if (s == SPL_HEALOTHER)
v6 = SPL_FLARE; s = SPL_FLARE;
} }
if (v6 == MAX_SPELLS) if (s == MAX_SPELLS)
goto LABEL_13; s = 1;
} }
v7 = v3; strcat(item[i]._iName, spelldata[bs].sNameText);
v8 = (const char **)&spelldata[v11].sNameText; strcat(item[i]._iIName, spelldata[bs].sNameText);
strcat(item[v7]._iName, *v8); item[i]._iSpell = bs;
strcat(item[v7]._iIName, *v8); item[i]._iMinMag = spelldata[bs].sMinInt;
item[v7]._iSpell = v11; item[i]._ivalue += spelldata[bs].sBookCost;
item[v7]._iMinMag = spelldata[v11].sMinInt; item[i]._iIvalue += spelldata[bs].sBookCost;
v9 = spelldata[v11].sBookCost; if (spelldata[bs].sType == STYPE_FIRE)
item[v7]._ivalue += v9; item[i]._iCurs = ICURS_BOOK_RED;
item[v7]._iIvalue += v9; if (spelldata[bs].sType == STYPE_LIGHTNING)
v10 = spelldata[v11].sType; item[i]._iCurs = ICURS_BOOK_BLUE;
if (v10 == STYPE_FIRE) if (spelldata[bs].sType == STYPE_MAGIC)
item[v7]._iCurs = ICURS_BOOK_RED; item[i]._iCurs = ICURS_BOOK_GREY;
if (v10 == STYPE_LIGHTNING)
item[v7]._iCurs = ICURS_BOOK_BLUE;
if (v10 == STYPE_MAGIC)
item[v7]._iCurs = ICURS_BOOK_GREY;
} }
// 679660: using guessed type char gbMaxPlayers;
void GetStaffPower(int i, int lvl, int bs, unsigned char onlygood) void GetStaffPower(int i, int lvl, int bs, unsigned char onlygood)
{ {

Loading…
Cancel
Save