Browse Source

Merge a section of the Hellfire item and quest code

pull/973/head
Anders Jenbo 5 years ago
parent
commit
01590d3757
  1. 6
      Source/inv.cpp
  2. 180
      Source/items.cpp
  3. 2
      Source/items.h
  4. 6
      Source/player.cpp
  5. 4
      Source/player.h
  6. 4
      Source/quests.cpp
  7. 2
      Source/scrollrt.cpp
  8. 93
      Source/stores.cpp
  9. 38
      Source/town.cpp
  10. 1004
      Source/towners.cpp
  11. 2
      Source/trigs.cpp
  12. 4
      defs.h
  13. 2
      structs.h

6
Source/inv.cpp

@ -2524,9 +2524,7 @@ void UseStaffCharge(int pnum)
{
if (plr[pnum].InvBody[INVLOC_HAND_LEFT]._itype != ITYPE_NONE
&& (plr[pnum].InvBody[INVLOC_HAND_LEFT]._iMiscId == IMISC_STAFF
#ifdef HELLFIRE
|| plr[myplr].InvBody[INVLOC_HAND_LEFT]._iMiscId == IMISC_UNIQUE // BUGFIX: myplr->pnum
#endif
)
&& plr[pnum].InvBody[INVLOC_HAND_LEFT]._iSpell == plr[pnum]._pRSpell
&& plr[pnum].InvBody[INVLOC_HAND_LEFT]._iCharges > 0) {
@ -2539,11 +2537,7 @@ BOOL UseStaff()
{
if (pcurs == CURSOR_HAND) {
if (plr[myplr].InvBody[INVLOC_HAND_LEFT]._itype != ITYPE_NONE
#ifdef HELLFIRE
&& (plr[myplr].InvBody[INVLOC_HAND_LEFT]._iMiscId == IMISC_STAFF || plr[myplr].InvBody[INVLOC_HAND_LEFT]._iMiscId == IMISC_UNIQUE)
#else
&& plr[myplr].InvBody[INVLOC_HAND_LEFT]._iMiscId == IMISC_STAFF
#endif
&& plr[myplr].InvBody[INVLOC_HAND_LEFT]._iSpell == plr[myplr]._pRSpell
&& plr[myplr].InvBody[INVLOC_HAND_LEFT]._iCharges > 0) {
return TRUE;

180
Source/items.cpp

@ -136,7 +136,6 @@ const char *const ItemDropNames[] = {
"Bldstn",
"Fanvil",
"FLazStaf",
#ifdef HELLFIRE
"bombs1",
"halfps1",
"wholeps1",
@ -145,7 +144,6 @@ const char *const ItemDropNames[] = {
"cows1",
"donkys1",
"mooses1",
#endif
};
/** Maps of item drop animation length. */
BYTE ItemAnimLs[] = {
@ -184,7 +182,6 @@ BYTE ItemAnimLs[] = {
13,
13,
8,
#ifdef HELLFIRE
10,
16,
16,
@ -193,7 +190,6 @@ BYTE ItemAnimLs[] = {
15,
15,
15,
#endif
};
/** Maps of drop sounds effect of dropping the item on ground. */
int ItemDropSnds[] = {
@ -232,7 +228,6 @@ int ItemDropSnds[] = {
IS_FBLST,
IS_FANVL,
IS_FSTAF,
#ifdef HELLFIRE
IS_FROCK,
IS_FSCRL,
IS_FSCRL,
@ -241,7 +236,6 @@ int ItemDropSnds[] = {
IS_FHARM,
IS_FLARM,
IS_FLARM,
#endif
};
/** Maps of drop sounds effect of placing the item in the inventory. */
int ItemInvSnds[] = {
@ -280,7 +274,6 @@ int ItemInvSnds[] = {
IS_IBLST,
IS_IANVL,
IS_ISTAF,
#ifdef HELLFIRE
IS_IROCK,
IS_ISCROL,
IS_ISCROL,
@ -289,7 +282,6 @@ int ItemInvSnds[] = {
IS_IHARM,
IS_ILARM,
IS_ILARM,
#endif
};
char *off_4A5AC4 = "SItem";
/** Specifies the current Y-coordinate used for validation of items on ground. */
@ -510,14 +502,9 @@ int items_get_currlevel()
void InitItemGFX()
{
#ifdef HELLFIRE
DWORD i;
#else
int i;
#endif
char arglist[64];
for (i = 0; i < ITEMTYPES; i++) {
for (int i = 0; i < ITEMTYPES; i++) {
sprintf(arglist, "Items\\%s.CEL", ItemDropNames[i]);
itemanims[i] = LoadFileInMem(arglist, NULL);
}
@ -546,9 +533,7 @@ void AddInitItems()
{
int x, y, i, j, rnd;
#ifdef HELLFIRE
int curlv = items_get_currlevel();
#endif
rnd = random_(11, 3) + 3;
for (j = 0; j < rnd; j++) {
i = itemavail[0];
@ -565,19 +550,11 @@ void AddInitItems()
dItem[x][y] = i + 1;
item[i]._iSeed = GetRndSeed();
SetRndSeed(item[i]._iSeed);
#ifdef HELLFIRE
if (random_(12, 2) != 0)
GetItemAttrs(i, IDI_HEAL, curlv);
else
GetItemAttrs(i, IDI_MANA, curlv);
item[i]._iCreateInfo = curlv - CF_PREGEN;
#else
if (random_(12, 2) != 0)
GetItemAttrs(i, IDI_HEAL, currlevel);
else
GetItemAttrs(i, IDI_MANA, currlevel);
item[i]._iCreateInfo = currlevel - CF_PREGEN;
#endif
SetupItem(i);
item[i]._iAnimFrame = item[i]._iAnimLen;
item[i]._iAnimFlag = FALSE;
@ -642,18 +619,14 @@ void InitItems()
SpawnRock();
if (QuestStatus(Q_ANVIL))
SpawnQuestItem(IDI_ANVIL, 2 * setpc_x + 27, 2 * setpc_y + 27, 0, 1);
#ifdef HELLFIRE
if (UseCowFarmer && currlevel == 20)
SpawnQuestItem(IDI_BROWNSUIT, 25, 25, 3, 1);
if (UseCowFarmer && currlevel == 19)
SpawnQuestItem(IDI_GREYSUIT, 25, 25, 3, 1);
#endif
if (currlevel > 0 && currlevel < 16)
AddInitItems();
#ifdef HELLFIRE
if (currlevel >= 21 && currlevel <= 23)
items_42390F();
#endif
}
uitemflag = FALSE;
@ -677,9 +650,7 @@ void CalcPlrItemVals(int p, BOOL Loadgfx)
int iflgs = ISPL_NONE; // item_special_effect flags
#ifdef HELLFIRE
int pDamAcFlags = 0;
#endif
int sadd = 0; // added strength
int madd = 0; // added magic
@ -732,9 +703,7 @@ void CalcPlrItemVals(int p, BOOL Loadgfx)
bac += tmpac;
}
iflgs |= itm->_iFlags;
#ifdef HELLFIRE
pDamAcFlags |= itm->_iDamAcFlags;
#endif
sadd += itm->_iPLStr;
madd += itm->_iPLMag;
dadd += itm->_iPLDex;
@ -795,9 +764,7 @@ void CalcPlrItemVals(int p, BOOL Loadgfx)
plr[p]._pIBonusToHit = btohit;
plr[p]._pIBonusAC = bac;
plr[p]._pIFlags = iflgs;
#ifdef HELLFIRE
plr[p].pDamAcFlags = pDamAcFlags;
#endif
plr[p]._pIBonusDamMod = dmod;
plr[p]._pIGetHit = ghit;
@ -915,10 +882,8 @@ void CalcPlrItemVals(int p, BOOL Loadgfx)
if (mr > MAXRESIST)
mr = MAXRESIST;
#ifdef HELLFIRE
else if (mr < 0)
mr = 0;
#endif
plr[p]._pMagResist = mr;
if (fr > MAXRESIST)
@ -1081,9 +1046,7 @@ void CalcPlrItemVals(int p, BOOL Loadgfx)
if (missile[mi]._mitype == MIS_MANASHIELD && missile[mi]._misource == p) {
missile[mi]._miVar1 = plr[p]._pHitPoints;
missile[mi]._miVar2 = plr[p]._pHPBase;
#ifdef HELLFIRE
break;
#endif
}
}
#ifdef HELLFIRE
@ -1652,9 +1615,7 @@ void GetBookSpell(int i, int lvl)
lvl = 5;
s = SPL_FIREBOLT;
#ifdef HELLFIRE
bs = SPL_FIREBOLT;
#endif
while (rv > 0) {
int sLevel = GetSpellBookLevel(s);
if (sLevel != -1 && lvl >= sLevel) {
@ -1681,15 +1642,9 @@ void GetBookSpell(int i, int lvl)
item[i]._iIvalue += spelldata[bs].sBookCost;
if (spelldata[bs].sType == STYPE_FIRE)
item[i]._iCurs = ICURS_BOOK_RED;
#ifdef HELLFIRE
else
#endif
if (spelldata[bs].sType == STYPE_LIGHTNING)
else if (spelldata[bs].sType == STYPE_LIGHTNING)
item[i]._iCurs = ICURS_BOOK_BLUE;
#ifdef HELLFIRE
else
#endif
if (spelldata[bs].sType == STYPE_MAGIC)
else if (spelldata[bs].sType == STYPE_MAGIC)
item[i]._iCurs = ICURS_BOOK_GREY;
}
@ -1970,11 +1925,9 @@ void SaveItemPower(int i, int power, int param1, int param2, int minval, int max
case IPL_DAMP_CURSE:
item[i]._iPLDam -= r;
break;
#ifdef HELLFIRE
case IPL_DOPPELGANGER:
item[i]._iDamAcFlags |= 16;
// no break
#endif
case IPL_TOHIT_DAMP:
r = RndPL(param1, param2);
item[i]._iPLDam += r;
@ -2139,11 +2092,9 @@ void SaveItemPower(int i, int power, int param1, int param2, int minval, int max
item[i]._iMaxDur += r2;
item[i]._iDurability += r2;
break;
#ifdef HELLFIRE
case IPL_CRYSTALLINE:
item[i]._iPLDam += 140 + r * 2;
// no break
#endif
case IPL_DUR_CURSE:
item[i]._iMaxDur -= r * item[i]._iMaxDur / 100;
if (item[i]._iMaxDur < 1)
@ -2160,11 +2111,9 @@ void SaveItemPower(int i, int power, int param1, int param2, int minval, int max
case IPL_LIGHT_CURSE:
item[i]._iPLLight -= param1;
break;
#ifdef HELLFIRE
case IPL_MULT_ARROWS:
item[i]._iFlags |= ISPL_MULT_ARROWS;
break;
#endif
case IPL_FIRE_ARROWS:
item[i]._iFlags |= ISPL_FIRE_ARROWS;
#ifdef HELLFIRE
@ -2327,7 +2276,6 @@ void SaveItemPower(int i, int power, int param1, int param2, int minval, int max
if (item[i]._iPLFR < 0)
item[i]._iPLFR = 0;
break;
#ifdef HELLFIRE
case IPL_FIRERES_CURSE:
item[i]._iPLFR -= r;
break;
@ -2371,7 +2319,6 @@ void SaveItemPower(int i, int power, int param1, int param2, int minval, int max
item[i]._iPLHP -= (r2 << 6);
item[i]._iPLMana += (r2 << 6);
break;
#endif
}
if (item[i]._iVAdd1 || item[i]._iVMult1) {
item[i]._iVAdd2 = PLVal(r, param1, param2, minval, maxval);
@ -2461,15 +2408,11 @@ void GetItemPower(int i, int minlvl, int maxlvl, int flgs, BOOL onlygood)
}
}
if (!control_WriteStringToBuffer((BYTE *)item[i]._iIName)) {
#ifdef HELLFIRE
int aii = item[i].IDidx;
if (AllItemsList[aii].iSName)
strcpy(item[i]._iIName, AllItemsList[aii].iSName);
else
item[i]._iName[0] = 0;
#else
strcpy(item[i]._iIName, AllItemsList[item[i].IDidx].iSName);
#endif
if (preidx != -1) {
sprintf(istr, "%s %s", PL_Prefix[preidx].PLName, item[i]._iIName);
@ -2607,9 +2550,7 @@ int RndUItem(int m)
if (m != -1 && (monster[m].MData->mTreasure & 0x8000) != 0 && gbMaxPlayers == 1)
return -1 - (monster[m].MData->mTreasure & 0xFFF);
#ifdef HELLFIRE
int curlv = items_get_currlevel();
#endif
ri = 0;
for (i = 0; AllItemsList[i].iLoc != ILOC_INVALID; i++) {
okflag = TRUE;
@ -2619,11 +2560,7 @@ int RndUItem(int m)
if (monster[m].mLevel < AllItemsList[i].iMinMLvl)
okflag = FALSE;
} else {
#ifdef HELLFIRE
if (2 * curlv < AllItemsList[i].iMinMLvl)
#else
if (2 * currlevel < AllItemsList[i].iMinMLvl)
#endif
okflag = FALSE;
}
if (AllItemsList[i].itype == ITYPE_MISC)
@ -2659,16 +2596,10 @@ int RndAllItems()
if (random_(26, 100) > 25)
return 0;
#ifdef HELLFIRE
int curlv = items_get_currlevel();
#endif
ri = 0;
for (i = 0; AllItemsList[i].iLoc != ILOC_INVALID; i++) {
#ifdef HELLFIRE
if (AllItemsList[i].iRnd != IDROP_NEVER && 2 * curlv >= AllItemsList[i].iMinMLvl && ri < 512) {
#else
if (AllItemsList[i].iRnd != IDROP_NEVER && 2 * currlevel >= AllItemsList[i].iMinMLvl) {
#endif
ril[ri] = i;
ri++;
}
@ -2681,11 +2612,7 @@ int RndAllItems()
return ril[random_(26, ri)];
}
#ifdef HELLFIRE
int RndTypeItems(int itype, int imid, int lvl)
#else
int RndTypeItems(int itype, int imid)
#endif
{
int i, ri;
BOOL okflag;
@ -2696,21 +2623,13 @@ int RndTypeItems(int itype, int imid)
okflag = TRUE;
if (AllItemsList[i].iRnd == IDROP_NEVER)
okflag = FALSE;
#ifdef HELLFIRE
if (lvl << 1 < AllItemsList[i].iMinMLvl)
#else
if (currlevel << 1 < AllItemsList[i].iMinMLvl)
#endif
okflag = FALSE;
if (AllItemsList[i].itype != itype)
okflag = FALSE;
if (imid != -1 && AllItemsList[i].iMiscId != imid)
okflag = FALSE;
#ifdef HELLFIRE
if (okflag && ri < 512) {
#else
if (okflag) {
#endif
ril[ri] = i;
ri++;
}
@ -2787,9 +2706,7 @@ void SpawnUnique(int uid, int x, int y)
{
int ii, itype;
#ifdef HELLFIRE
int curlv = items_get_currlevel();
#endif
if (numitems >= MAXITEMS)
return;
@ -2803,11 +2720,7 @@ void SpawnUnique(int uid, int x, int y)
itype++;
}
#ifdef HELLFIRE
GetItemAttrs(ii, itype, curlv);
#else
GetItemAttrs(ii, itype, currlevel);
#endif
GetUniqueItem(ii, uid);
SetupItem(ii);
numitems++;
@ -2931,9 +2844,7 @@ void CreateItem(int uid, int x, int y)
{
int ii, idx;
#ifdef HELLFIRE
int curlv = items_get_currlevel();
#endif
if (numitems < MAXITEMS) {
ii = itemavail[0];
GetSuperItemSpace(x, y, ii);
@ -2945,11 +2856,7 @@ void CreateItem(int uid, int x, int y)
idx++;
}
#ifdef HELLFIRE
GetItemAttrs(ii, idx, curlv);
#else
GetItemAttrs(ii, idx, currlevel);
#endif
GetUniqueItem(ii, uid);
SetupItem(ii);
item[ii]._iMagical = ITEM_QUALITY_UNIQUE;
@ -2961,9 +2868,7 @@ void CreateRndItem(int x, int y, BOOL onlygood, BOOL sendmsg, BOOL delta)
{
int idx, ii;
#ifdef HELLFIRE
int curlv = items_get_currlevel();
#endif
if (onlygood)
idx = RndUItem(-1);
else
@ -2974,11 +2879,7 @@ void CreateRndItem(int x, int y, BOOL onlygood, BOOL sendmsg, BOOL delta)
GetSuperItemSpace(x, y, ii);
itemavail[0] = itemavail[MAXITEMS - numitems - 1];
itemactive[numitems] = ii;
#ifdef HELLFIRE
SetupAllItems(ii, idx, GetRndSeed(), 2 * curlv, 1, onlygood, FALSE, delta);
#else
SetupAllItems(ii, idx, GetRndSeed(), 2 * currlevel, 1, onlygood, FALSE, delta);
#endif
if (sendmsg)
NetSendCmdDItem(FALSE, ii);
if (delta)
@ -3041,19 +2942,13 @@ void CreateRndUseful(int pnum, int x, int y, BOOL sendmsg)
{
int ii;
#ifdef HELLFIRE
int curlv = items_get_currlevel();
#endif
if (numitems < MAXITEMS) {
ii = itemavail[0];
GetSuperItemSpace(x, y, ii);
itemavail[0] = itemavail[MAXITEMS - numitems - 1];
itemactive[numitems] = ii;
#ifdef HELLFIRE
SetupAllUseful(ii, GetRndSeed(), curlv);
#else
SetupAllUseful(ii, GetRndSeed(), currlevel);
#endif
if (sendmsg) {
NetSendCmdDItem(FALSE, ii);
}
@ -3065,14 +2960,9 @@ void CreateTypeItem(int x, int y, BOOL onlygood, int itype, int imisc, BOOL send
{
int idx, ii;
#ifdef HELLFIRE
int curlv = items_get_currlevel();
if (itype != ITYPE_GOLD)
idx = RndTypeItems(itype, imisc, curlv);
#else
if (itype != ITYPE_GOLD)
idx = RndTypeItems(itype, imisc);
#endif
else
idx = 0;
@ -3081,11 +2971,7 @@ void CreateTypeItem(int x, int y, BOOL onlygood, int itype, int imisc, BOOL send
GetSuperItemSpace(x, y, ii);
itemavail[0] = itemavail[MAXITEMS - numitems - 1];
itemactive[numitems] = ii;
#ifdef HELLFIRE
SetupAllItems(ii, idx, GetRndSeed(), 2 * curlv, 1, onlygood, FALSE, delta);
#else
SetupAllItems(ii, idx, GetRndSeed(), 2 * currlevel, 1, onlygood, FALSE, delta);
#endif
if (sendmsg)
NetSendCmdDItem(FALSE, ii);
@ -3226,9 +3112,7 @@ void SpawnQuestItem(int itemid, int x, int y, int randarea, int selflag)
BOOL failed;
int i, j, tries;
#ifdef HELLFIRE
int curlv = items_get_currlevel();
#endif
if (randarea) {
tries = 0;
while (1) {
@ -3255,11 +3139,7 @@ void SpawnQuestItem(int itemid, int x, int y, int randarea, int selflag)
item[i]._ix = x;
item[i]._iy = y;
dItem[x][y] = i + 1;
#ifdef HELLFIRE
GetItemAttrs(i, itemid, curlv);
#else
GetItemAttrs(i, itemid, currlevel);
#endif
SetupItem(i);
item[i]._iPostDraw = TRUE;
if (selflag) {
@ -3282,9 +3162,7 @@ void SpawnRock()
ii = objectactive[i];
ostand = object[ii]._otype == OBJ_STAND;
}
#ifdef HELLFIRE
int curlv = items_get_currlevel();
#endif
if (ostand) {
i = itemavail[0];
itemavail[0] = itemavail[127 - numitems - 1];
@ -3294,11 +3172,7 @@ void SpawnRock()
item[i]._ix = xx;
item[i]._iy = yy;
dItem[xx][item[i]._iy] = i + 1;
#ifdef HELLFIRE
GetItemAttrs(i, IDI_ROCK, curlv);
#else
GetItemAttrs(i, IDI_ROCK, currlevel);
#endif
SetupItem(i);
item[i]._iSelFlag = 2;
item[i]._iPostDraw = TRUE;
@ -5698,26 +5572,21 @@ void CreateSpellBook(int x, int y, int ispell, BOOL sendmsg, BOOL delta)
BOOL done;
done = FALSE;
#ifdef HELLFIRE
int lvl = GetSpellBookLevel(ispell) + 1;
if (lvl < 1) {
return;
int lvl = currlevel;
if (gbIsHellfire) {
lvl = GetSpellBookLevel(ispell) + 1;
if (lvl < 1) {
return;
}
}
idx = RndTypeItems(ITYPE_MISC, IMISC_BOOK, lvl);
#else
idx = RndTypeItems(ITYPE_MISC, IMISC_BOOK);
#endif
if (numitems < MAXITEMS) {
ii = itemavail[0];
GetSuperItemSpace(x, y, ii);
itemavail[0] = itemavail[MAXITEMS - numitems - 1];
itemactive[numitems] = ii;
while (!done) {
#ifdef HELLFIRE
SetupAllItems(ii, idx, GetRndSeed(), 2 * lvl, 1, TRUE, FALSE, delta);
#else
SetupAllItems(ii, idx, GetRndSeed(), 2 * currlevel, 1, TRUE, FALSE, delta);
#endif
if (item[ii]._iMiscId == IMISC_BOOK && item[ii]._iSpell == ispell)
done = TRUE;
}
@ -5735,33 +5604,19 @@ void CreateMagicArmor(int x, int y, int imisc, int icurs, BOOL sendmsg, BOOL del
BOOL done;
done = FALSE;
#ifdef HELLFIRE
int curlv = items_get_currlevel();
#endif
if (numitems < MAXITEMS) {
ii = itemavail[0];
GetSuperItemSpace(x, y, ii);
itemavail[0] = itemavail[MAXITEMS - numitems - 1];
itemactive[numitems] = ii;
#ifdef HELLFIRE
idx = RndTypeItems(imisc, IMISC_NONE, curlv);
#else
idx = RndTypeItems(imisc, IMISC_NONE);
#endif
while (!done) {
#ifdef HELLFIRE
SetupAllItems(ii, idx, GetRndSeed(), 2 * curlv, 1, TRUE, FALSE, delta);
#else
SetupAllItems(ii, idx, GetRndSeed(), 2 * currlevel, 1, TRUE, FALSE, delta);
#endif
if (item[ii]._iCurs == icurs)
done = TRUE;
else
#ifdef HELLFIRE
idx = RndTypeItems(imisc, IMISC_NONE, curlv);
#else
idx = RndTypeItems(imisc, IMISC_NONE);
#endif
}
if (sendmsg)
NetSendCmdDItem(FALSE, ii);
@ -5771,7 +5626,6 @@ void CreateMagicArmor(int x, int y, int imisc, int icurs, BOOL sendmsg, BOOL del
}
}
#ifdef HELLFIRE
void CreateAmulet(int x, int y, int curlv, BOOL sendmsg, BOOL delta)
{
int ii, idx;
@ -5799,46 +5653,30 @@ void CreateAmulet(int x, int y, int curlv, BOOL sendmsg, BOOL delta)
numitems++;
}
}
#endif
void CreateMagicWeapon(int x, int y, int imisc, int icurs, BOOL sendmsg, BOOL delta)
{
int ii, idx;
BOOL done;
done = FALSE;
#ifdef HELLFIRE
int imid;
if (imisc == ITYPE_STAFF)
imid = IMISC_STAFF;
else
imid = IMISC_NONE;
int curlv = items_get_currlevel();
#endif
if (numitems < MAXITEMS) {
ii = itemavail[0];
GetSuperItemSpace(x, y, ii);
itemavail[0] = itemavail[MAXITEMS - numitems - 1];
itemactive[numitems] = ii;
#ifdef HELLFIRE
idx = RndTypeItems(imisc, imid, curlv);
#else
idx = RndTypeItems(imisc, IMISC_NONE);
#endif
while (!done) {
#ifdef HELLFIRE
SetupAllItems(ii, idx, GetRndSeed(), 2 * curlv, 1, TRUE, FALSE, delta);
#else
SetupAllItems(ii, idx, GetRndSeed(), 2 * currlevel, 1, TRUE, FALSE, delta);
#endif
if (item[ii]._iCurs == icurs)
done = TRUE;
else
#ifdef HELLFIRE
idx = RndTypeItems(imisc, imid, curlv);
#else
idx = RndTypeItems(imisc, IMISC_NONE);
#endif
}
if (sendmsg)
NetSendCmdDItem(FALSE, ii);

2
Source/items.h

@ -98,9 +98,7 @@ void RecalcStoreStats();
int ItemNoFlippy();
void CreateSpellBook(int x, int y, int ispell, BOOL sendmsg, BOOL delta);
void CreateMagicArmor(int x, int y, int imisc, int icurs, BOOL sendmsg, BOOL delta);
#ifdef HELLFIRE
void CreateAmulet(int x, int y, int curlv, BOOL sendmsg, BOOL delta);
#endif
void CreateMagicWeapon(int x, int y, int imisc, int icurs, BOOL sendmsg, BOOL delta);
BOOL GetItemRecord(int nSeed, WORD wCI, int nIndex);
void SetItemRecord(int nSeed, WORD wCI, int nIndex);

6
Source/player.cpp

@ -135,11 +135,9 @@ const char *const ClassStrTblOld[] = {
"Warrior",
"Rogue",
"Sorceror",
#ifdef HELLFIRE
"Monk",
"Bard",
"Barbarian",
#endif
};
/** Maps from player_class to maximum stats. */
int MaxStats[NUM_CLASSES][4] = {
@ -599,7 +597,6 @@ void SetPlrAnims(int pnum)
plr[pnum]._pAFrames = 24;
plr[pnum]._pAFNum = 16;
}
#ifdef HELLFIRE
} else if (pc == PC_MONK) {
plr[pnum]._pNWidth = 112;
plr[pnum]._pWWidth = 112;
@ -657,7 +654,6 @@ void SetPlrAnims(int pnum)
} else if (gn == ANIM_ID_MACE || gn == ANIM_ID_MACE_SHIELD) {
plr[pnum]._pAFNum = 8;
}
#endif
}
}
@ -889,10 +885,8 @@ void NextPlrLevel(int pnum)
if (plr[pnum]._pClass == PC_WARRIOR)
mana = 64;
#ifdef HELLFIRE
else if (plr[pnum]._pClass == PC_BARBARIAN)
mana = 0;
#endif
else
mana = 128;

4
Source/player.h

@ -45,9 +45,7 @@ void RemovePlrFromMap(int pnum);
void StartPlrHit(int pnum, int dam, BOOL forcehit);
void StartPlayerKill(int pnum, int earflag);
void DropHalfPlayersGold(int pnum);
#ifdef HELLFIRE
void StripTopGold(int pnum);
#endif
void SyncPlrKill(int pnum, int earflag);
void RemovePlrMissiles(int pnum);
void StartNewLvl(int pnum, int fom, int lvl);
@ -73,11 +71,9 @@ void SetPlrDex(int p, int v);
void SetPlrVit(int p, int v);
void InitDungMsgs(int pnum);
void PlayDungMsgs();
#ifdef HELLFIRE
int get_max_strength(int i);
int get_max_magic(int i);
int get_max_dexterity(int i);
#endif
/* data */

4
Source/quests.cpp

@ -115,6 +115,8 @@ void InitQuests()
initiatedQuests = 0;
for (z = 0; z < MAXQUESTS; z++) {
if (!gbIsHellfire && z >= 16)
break;
if (gbMaxPlayers > 1 && !(questlist[z]._qflags & QUEST_ANY))
continue;
quests[z]._qtype = questlist[z]._qdtype;
@ -696,7 +698,6 @@ void ResyncMPQuests()
}
if (QuestStatus(Q_BETRAYER))
AddObject(OBJ_ALTBOY, 2 * setpc_x + 20, 2 * setpc_y + 22);
#ifdef HELLFIRE
if (quests[Q_GRAVE]._qactive == 1 && currlevel == quests[Q_GRAVE]._qlevel - 1) {
quests[Q_GRAVE]._qactive = 2;
NetSendCmdQuest(TRUE, Q_GRAVE);
@ -713,7 +714,6 @@ void ResyncMPQuests()
quests[Q_JERSEY]._qactive = 2;
NetSendCmdQuest(TRUE, Q_JERSEY);
}
#endif
}
void ResyncQuests()

2
Source/scrollrt.cpp

@ -404,7 +404,6 @@ static void DrawPlayer(int pnum, int x, int y, int px, int py, BYTE *pCelBuff, i
misfiledata[MFILE_MANASHLD].mAnimWidth[0]);
} else if (!(dFlags[x][y] & BFLAG_LIT) || plr[myplr]._pInfraFlag && light_table_index > 8) {
Cl2DrawLightTbl(px, py, pCelBuff, nCel, nWidth, 1);
#ifndef HELLFIRE
if (plr[pnum].pManaShield)
Cl2DrawLightTbl(
px + plr[pnum]._pAnimWidth2 - misfiledata[MFILE_MANASHLD].mAnimWidth2[0],
@ -413,7 +412,6 @@ static void DrawPlayer(int pnum, int x, int y, int px, int py, BYTE *pCelBuff, i
1,
misfiledata[MFILE_MANASHLD].mAnimWidth[0],
1);
#endif
} else {
l = light_table_index;
if (light_table_index < 5)

93
Source/stores.cpp

@ -575,7 +575,6 @@ BOOL S_StartSPBuy()
BOOL SmithSellOk(int i)
{
#ifdef HELLFIRE
ItemStruct *pI;
if (i >= 0) {
@ -596,26 +595,12 @@ BOOL SmithSellOk(int i)
return FALSE;
if (pI->_itype == ITYPE_MEAT)
return FALSE;
if (pI->_itype == ITYPE_STAFF && pI->_iSpell != SPL_NULL)
if (pI->_itype == ITYPE_STAFF && (!gbIsHellfire || pI->_iSpell != SPL_NULL))
return FALSE;
if (pI->_iClass == ICLASS_QUEST)
return FALSE;
if (pI->IDidx == IDI_LAZSTAFF)
return FALSE;
#else
if (plr[myplr].InvList[i]._itype == ITYPE_NONE)
return FALSE;
if (plr[myplr].InvList[i]._itype == ITYPE_MISC)
return FALSE;
if (plr[myplr].InvList[i]._itype == ITYPE_GOLD)
return FALSE;
if (plr[myplr].InvList[i]._itype == ITYPE_MEAT)
return FALSE;
if (plr[myplr].InvList[i]._itype == ITYPE_STAFF)
return FALSE;
if (plr[myplr].InvList[i].IDidx == IDI_LAZSTAFF)
return FALSE;
#endif
return TRUE;
}
@ -673,10 +658,8 @@ void S_StartSSell()
storehold[i]._itype = ITYPE_NONE;
for (i = 0; i < plr[myplr]._pNumInv; i++) {
#ifdef HELLFIRE
if (storenumh >= 48)
break;
#endif
if (SmithSellOk(i)) {
sellok = TRUE;
storehold[storenumh] = plr[myplr].InvList[i];
@ -691,7 +674,6 @@ void S_StartSSell()
storehidx[storenumh++] = i;
}
}
#ifdef HELLFIRE
for (i = 0; i < MAXBELTITEMS; i++) {
if (storenumh >= 48)
@ -710,7 +692,6 @@ void S_StartSSell()
storehidx[storenumh++] = -(i + 1);
}
}
#endif
if (!sellok) {
stextscrl = FALSE;
@ -800,10 +781,8 @@ void S_StartSRepair()
AddStoreHoldRepair(&plr[myplr].InvBody[INVLOC_HAND_RIGHT], -4);
}
for (i = 0; i < plr[myplr]._pNumInv; i++) {
#ifdef HELLFIRE
if (storenumh >= 48)
break;
#endif
if (SmithRepairOk(i)) {
repairok = TRUE;
AddStoreHoldRepair(&plr[myplr].InvList[i], i);
@ -923,15 +902,11 @@ BOOL WitchSellOk(int i)
if (pI->_itype == ITYPE_MISC)
rv = TRUE;
#ifdef HELLFIRE
if (pI->_iMiscId > 29 && pI->_iMiscId < 41)
rv = FALSE;
if (pI->_iClass == ICLASS_QUEST)
rv = FALSE;
if (pI->_itype == ITYPE_STAFF && pI->_iSpell != SPL_NULL)
#else
if (pI->_itype == ITYPE_STAFF)
#endif
if (pI->_itype == ITYPE_STAFF && (!gbIsHellfire || pI->_iSpell != SPL_NULL))
rv = TRUE;
if (pI->IDidx >= IDI_FIRSTQUEST && pI->IDidx <= IDI_LASTQUEST)
rv = FALSE;
@ -953,10 +928,8 @@ void S_StartWSell()
storehold[i]._itype = ITYPE_NONE;
for (i = 0; i < plr[myplr]._pNumInv; i++) {
#ifdef HELLFIRE
if (storenumh >= 48)
break;
#endif
if (WitchSellOk(i)) {
sellok = TRUE;
storehold[storenumh] = plr[myplr].InvList[i];
@ -973,10 +946,8 @@ void S_StartWSell()
}
for (i = 0; i < MAXBELTITEMS; i++) {
#ifdef HELLFIRE
if (storenumh >= 48)
break;
#endif
if (plr[myplr].SpdList[i]._itype != ITYPE_NONE && WitchSellOk(-(i + 1))) {
sellok = TRUE;
storehold[storenumh] = plr[myplr].SpdList[i];
@ -1023,12 +994,10 @@ BOOL WitchRechargeOk(int i)
&& plr[myplr].InvList[i]._iCharges != plr[myplr].InvList[i]._iMaxCharges) {
rv = TRUE;
}
#ifdef HELLFIRE
if ((plr[myplr].InvList[i]._iMiscId == IMISC_UNIQUE || plr[myplr].InvList[i]._iMiscId == IMISC_STAFF)
&& plr[myplr].InvList[i]._iCharges < plr[myplr].InvList[i]._iMaxCharges) {
rv = TRUE;
}
#endif
return rv;
}
@ -1055,21 +1024,15 @@ void S_StartWRecharge()
storehold[i]._itype = ITYPE_NONE;
}
#ifdef HELLFIRE
if ((plr[myplr].InvBody[INVLOC_HAND_LEFT]._itype == ITYPE_STAFF || plr[myplr].InvBody[INVLOC_HAND_LEFT]._iMiscId == IMISC_UNIQUE)
#else
if (plr[myplr].InvBody[INVLOC_HAND_LEFT]._itype == ITYPE_STAFF
#endif
&& plr[myplr].InvBody[INVLOC_HAND_LEFT]._iCharges != plr[myplr].InvBody[INVLOC_HAND_LEFT]._iMaxCharges) {
rechargeok = TRUE;
AddStoreHoldRecharge(plr[myplr].InvBody[INVLOC_HAND_LEFT], -1);
}
for (i = 0; i < plr[myplr]._pNumInv; i++) {
#ifdef HELLFIRE
if (storenumh >= 48)
break;
#endif
if (WitchRechargeOk(i)) {
rechargeok = TRUE;
AddStoreHoldRecharge(plr[myplr].InvList[i], i);
@ -1231,30 +1194,35 @@ void S_StartBBoy()
OffsetSTextY(22, 6);
}
void S_StartHealer()
static void HealPlayer()
{
#ifdef HELLFIRE
if (plr[myplr]._pHitPoints != plr[myplr]._pMaxHP) {
PlaySFX(IS_CAST8);
}
plr[myplr]._pHitPoints = plr[myplr]._pMaxHP;
plr[myplr]._pHPBase = plr[myplr]._pMaxHPBase;
drawhpflag = TRUE;
#endif
}
void S_StartHealer()
{
if (gbIsHellfire) {
HealPlayer();
}
stextsize = FALSE;
stextscrl = FALSE;
AddSText(0, 1, TRUE, "Welcome to the", COL_GOLD, FALSE);
AddSText(0, 3, TRUE, "Healer's home", COL_GOLD, FALSE);
AddSText(0, 9, TRUE, "Would you like to:", COL_GOLD, FALSE);
AddSText(0, 12, TRUE, "Talk to Pepin", COL_BLUE, TRUE);
#ifdef HELLFIRE
AddSText(0, 14, TRUE, "Buy items", COL_WHITE, TRUE);
AddSText(0, 16, TRUE, "Leave Healer's home", COL_WHITE, TRUE);
#else
AddSText(0, 14, TRUE, "Receive healing", COL_WHITE, TRUE);
AddSText(0, 16, TRUE, "Buy items", COL_WHITE, TRUE);
AddSText(0, 18, TRUE, "Leave Healer's home", COL_WHITE, TRUE);
#endif
if (gbIsHellfire) {
AddSText(0, 14, TRUE, "Buy items", COL_WHITE, TRUE);
AddSText(0, 16, TRUE, "Leave Healer's home", COL_WHITE, TRUE);
} else {
AddSText(0, 14, TRUE, "Receive healing", COL_WHITE, TRUE);
AddSText(0, 16, TRUE, "Buy items", COL_WHITE, TRUE);
AddSText(0, 18, TRUE, "Leave Healer's home", COL_WHITE, TRUE);
}
AddSLine(5);
storenumh = 20;
}
@ -1383,10 +1351,8 @@ void S_StartSIdentify()
}
for (i = 0; i < plr[myplr]._pNumInv; i++) {
#ifdef HELLFIRE
if (storenumh >= 48)
break;
#endif
if (IdItemOk(&plr[myplr].InvList[i])) {
idok = TRUE;
AddStoreHoldId(plr[myplr].InvList[i], i);
@ -2572,28 +2538,21 @@ void S_HealerEnter()
gossipend = TEXT_PEPIN11;
StartStore(STORE_GOSSIP);
break;
#ifdef HELLFIRE
case 14:
StartStore(STORE_HBUY);
break;
case 16:
stextflag = STORE_NONE;
break;
#else
case 14:
if (plr[myplr]._pHitPoints != plr[myplr]._pMaxHP)
PlaySFX(IS_CAST8);
drawhpflag = TRUE;
plr[myplr]._pHitPoints = plr[myplr]._pMaxHP;
plr[myplr]._pHPBase = plr[myplr]._pMaxHPBase;
if (gbIsHellfire)
StartStore(STORE_HBUY);
else
HealPlayer();
break;
case 16:
StartStore(STORE_HBUY);
if (gbIsHellfire)
stextflag = STORE_NONE;
else
StartStore(STORE_HBUY);
break;
case 18:
stextflag = STORE_NONE;
break;
#endif
}
}

38
Source/town.cpp

@ -243,47 +243,20 @@ void T_Pass3()
mem_free_dbg(pSector);
if (gbIsSpawn || gbMaxPlayers == 1) {
#ifdef HELLFIRE
if (quests[Q_FARMER]._qactive == 3 || quests[Q_FARMER]._qactive == 10
|| quests[Q_JERSEY]._qactive == 3 || quests[Q_JERSEY]._qactive == 10) {
town_4751C6();
} else {
town_475379();
}
if (quests[Q_GRAVE]._qactive == 3 || plr[myplr]._pLvlVisited[21])
town_475595();
else
town_47552C();
#endif
#ifdef HELLFIRE
if (gbIsSpawn || !(plr[myplr].pTownWarps & 1) && plr[myplr]._pLevel < 10)
#else
if (gbIsSpawn || !(plr[myplr].pTownWarps & 1))
#endif
{
if (gbIsSpawn || !(plr[myplr].pTownWarps & 1) && (!gbIsHellfire || plr[myplr]._pLevel < 10)) {
T_FillTile(P3Tiles, 48, 20, 320);
}
#ifdef HELLFIRE
if (gbIsSpawn || !(plr[myplr].pTownWarps & 2) && plr[myplr]._pLevel < 15)
#else
if (gbIsSpawn || !(plr[myplr].pTownWarps & 2))
#endif
{
if (gbIsSpawn || !(plr[myplr].pTownWarps & 2) && (!gbIsHellfire || plr[myplr]._pLevel < 15)) {
T_FillTile(P3Tiles, 16, 68, 332);
T_FillTile(P3Tiles, 16, 70, 331);
}
#ifdef HELLFIRE
if (gbIsSpawn || !(plr[myplr].pTownWarps & 4) && plr[myplr]._pLevel < 20) {
#else
if (gbIsSpawn || !(plr[myplr].pTownWarps & 4)) {
#endif
if (gbIsSpawn || !(plr[myplr].pTownWarps & 4) && (!gbIsHellfire || plr[myplr]._pLevel < 20)) {
for (x = 36; x < 46; x++) {
T_FillTile(P3Tiles, x, 78, random_(0, 4) + 1);
}
}
}
#ifdef HELLFIRE
else {
if (gbIsHellfire) {
if (quests[Q_FARMER]._qactive == 3 || quests[Q_FARMER]._qactive == 10
|| quests[Q_JERSEY]._qactive == 3 || quests[Q_JERSEY]._qactive == 10) {
town_4751C6();
@ -295,7 +268,6 @@ void T_Pass3()
else
town_47552C();
}
#endif
if (quests[Q_PWATER]._qactive != QUEST_DONE && quests[Q_PWATER]._qactive) {
T_FillTile(P3Tiles, 60, 70, 342);
@ -340,7 +312,6 @@ void CreateTown(int entry)
ViewX = 41;
ViewY = 81;
}
#ifdef HELLFIRE
if (TWarpFrom == 21) {
ViewX = 36;
ViewY = 25;
@ -349,7 +320,6 @@ void CreateTown(int entry)
ViewX = 79;
ViewY = 62;
}
#endif
}
T_Pass3();

1004
Source/towners.cpp

File diff suppressed because it is too large Load Diff

2
Source/trigs.cpp

@ -140,7 +140,6 @@ void InitTownTriggers()
numtrigs++;
}
}
#ifdef HELLFIRE
if (quests[Q_GRAVE]._qactive == 3) {
trigs[numtrigs]._tx = 36;
trigs[numtrigs]._ty = 24;
@ -148,6 +147,7 @@ void InitTownTriggers()
trigs[numtrigs]._tlvl = 21;
numtrigs++;
}
#ifdef HELLFIRE
trigs[numtrigs]._tx = 80;
trigs[numtrigs]._ty = 62;
trigs[numtrigs]._tmsg = WM_DIABTOWNWARP;

4
defs.h

@ -44,11 +44,7 @@
#define MAXOBJECTS 127
#define MAXPORTAL 4
#ifdef HELLFIRE
#define MAXQUESTS 24
#else
#define MAXQUESTS 16
#endif
#define MAXMULTIQUESTS 10
#define MAXTHEMES 50

2
structs.h

@ -1146,7 +1146,6 @@ typedef struct QuestTalkData {
int _qpw;
int _qbone;
int _qvb;
#ifdef HELLFIRE
int _qgrv;
int _qfarm;
int _qgirl;
@ -1155,7 +1154,6 @@ typedef struct QuestTalkData {
int _qnakrul;
int _qjersy;
int _qhf8;
#endif
} QuestTalkData;
//////////////////////////////////////////////////

Loading…
Cancel
Save