diff --git a/Source/items.cpp b/Source/items.cpp index e8878ee69..73eb235d5 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -2593,7 +2593,7 @@ void GetItemBonus(int i, int idata, int minlvl, int maxlvl, BOOL onlygood) GetStaffSpell(i, maxlvl, onlygood); #ifdef HELLFIRE else - GetItemPower(i, minlvl, maxlvl, 0x100, onlygood); + GetItemPower(i, minlvl, maxlvl, PLT_STAFF, onlygood); #endif break; case ITYPE_RING: @@ -5277,7 +5277,7 @@ void SpawnWitch(int lvl) j = 3; #ifdef HELLFIRE - iCnt = random_(51, 15) + 10; + iCnt = random_(51, WITCH_ITEMS - 10) + 10; int books = random_(3, 4); #endif diff --git a/Source/missiles.cpp b/Source/missiles.cpp index 853251cb2..48124cd75 100644 --- a/Source/missiles.cpp +++ b/Source/missiles.cpp @@ -404,7 +404,7 @@ int GetDirection16(int x1, int y1, int x2, int y2) my = abs(y2 - y1); if (my > 15) my = 15; - md = Dirs[my][mx]; + md = Dirs[my][mx]; // BUGFIX, md can be 99, leading to an OOB read if (x1 > x2) { if (y1 > y2) md = urtoll[md]; diff --git a/Source/monster.cpp b/Source/monster.cpp index d3e60ca6f..da7f35b90 100644 --- a/Source/monster.cpp +++ b/Source/monster.cpp @@ -1868,7 +1868,7 @@ void SpawnLoot(int i, BOOL sendmsg) CreateMagicWeapon(Monst->_mx, Monst->_my, ITYPE_STAFF, ICURS_WAR_STAFF, FALSE, TRUE); CreateMagicWeapon(Monst->_mx, Monst->_my, ITYPE_BOW, ICURS_LONG_WAR_BOW, FALSE, TRUE); CreateSpellBook(Monst->_mx, Monst->_my, SPL_APOCA, FALSE, TRUE); - } else if (i > 3) { + } else if (i > MAX_PLRS - 1) { // Golems should not spawn loot SpawnItem(i, Monst->_mx, Monst->_my, sendmsg); } } @@ -1932,7 +1932,7 @@ void MonstStartKill(int i, int pnum, BOOL sendmsg) app_fatal("MonstStartKill: Invalid monster %d", i); #endif } - if (!monster[i].MType) { + if (monster[i].MType == NULL) { #ifdef HELLFIRE return; #else @@ -2002,7 +2002,7 @@ void M2MStartKill(int i, int mid) if ((DWORD)i >= MAXMONSTERS) { /// BUGFIX: should check `mid` app_fatal("M2MStartKill: Invalid monster (killed) %d", mid); } - if (!monster[i].MType) + if (monster[i].MType == NULL) app_fatal("M2MStartKill: Monster %d \"%s\" MType NULL", mid, monster[mid].mName); delta_kill_monster(mid, monster[mid]._mx, monster[mid]._my, currlevel); diff --git a/Source/objects.cpp b/Source/objects.cpp index 1da7f3b24..b5577faa3 100644 --- a/Source/objects.cpp +++ b/Source/objects.cpp @@ -3514,7 +3514,7 @@ void OperateShrine(int pnum, int i, int sType) DWORD lv, t; int xx, yy; int v1, v2, v3, v4; - unsigned __int64 spell; + unsigned __int64 spell, spells; if (dropGoldFlag) { dropGoldFlag = FALSE; @@ -3745,8 +3745,13 @@ void OperateShrine(int pnum, int i, int sType) return; cnt = 0; spell = 1; + spells = plr[pnum]._pMemSpells; for (j = 0; j < MAX_SPELLS; j++) { +#ifdef HELLFIRE if (spell & plr[pnum]._pMemSpells) +#else + if (spell & spells) +#endif cnt++; spell <<= 1; } diff --git a/Source/pfile.cpp b/Source/pfile.cpp index b4e4faf12..ff4728bd9 100644 --- a/Source/pfile.cpp +++ b/Source/pfile.cpp @@ -391,7 +391,7 @@ static char pfile_get_player_class(unsigned int player_class_nr) return pc_class; } -static BYTE game_2_ui_class(const PlayerStruct *p) // game_2_ui_class +static BYTE game_2_ui_class(const PlayerStruct *p) { BYTE uiclass; if (p->_pClass == PC_WARRIOR) diff --git a/Source/player.cpp b/Source/player.cpp index 1be0d0a51..bd451cade 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -4387,7 +4387,7 @@ void ModifyPlrStr(int p, int l) CalcPlrInv(p, TRUE); if (p == myplr) { - NetSendCmdParam1(FALSE, CMD_SETSTR, plr[p]._pBaseStr); //60 + NetSendCmdParam1(FALSE, CMD_SETSTR, plr[p]._pBaseStr); } }