From d05f4fbe1580806c9aac67efbbc31d0695e35272 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sat, 9 Jan 2021 22:36:59 +0100 Subject: [PATCH] Merge recently cleaned hellfire code --- Source/drlg_l1.cpp | 60 ++++++++++++++++++++++------------------------ Source/items.cpp | 36 ++++++++++------------------ Source/player.cpp | 18 +++----------- 3 files changed, 45 insertions(+), 69 deletions(-) diff --git a/Source/drlg_l1.cpp b/Source/drlg_l1.cpp index d7b32a65a..d75d2b6ea 100644 --- a/Source/drlg_l1.cpp +++ b/Source/drlg_l1.cpp @@ -146,8 +146,7 @@ const BYTE STAIRSUP[] = { 0, 0, 0, 0, // clang-format on }; -#ifdef HELLFIRE -const BYTE L5STAIRSUP[] = { +const BYTE L5STAIRSUPHF[] = { // clang-format off 4, 5, // width, height @@ -164,7 +163,6 @@ const BYTE L5STAIRSUP[] = { 0, 0, 0, 0 // clang-format on }; -#else /** Miniset: stairs up. */ const BYTE L5STAIRSUP[] = { // clang-format off @@ -181,7 +179,6 @@ const BYTE L5STAIRSUP[] = { 0, 0, 0, 0, // clang-format on }; -#endif /** Miniset: stairs down. */ const BYTE STAIRSDOWN[] = { // clang-format off @@ -2569,13 +2566,19 @@ static void DRLG_L5(int entry) ViewY--; } } -#ifdef HELLFIRE - } else if (entry == 0) { + } else if (entry == ENTRY_MAIN) { if (currlevel < 21) { - if (DRLG_PlaceMiniSet(STAIRSUP, 1, 1, 0, 0, TRUE, -1, 0) < 0) - doneflag = FALSE; - if (DRLG_PlaceMiniSet(STAIRSDOWN, 1, 1, 0, 0, FALSE, -1, 1) < 0) - doneflag = FALSE; + if (gbIsHellfire) { + if (DRLG_PlaceMiniSet(STAIRSUP, 1, 1, 0, 0, TRUE, -1, 0) < 0) + doneflag = FALSE; + if (DRLG_PlaceMiniSet(STAIRSDOWN, 1, 1, 0, 0, FALSE, -1, 1) < 0) + doneflag = FALSE; + } else { + if (DRLG_PlaceMiniSet(L5STAIRSUP, 1, 1, 0, 0, TRUE, -1, 0) < 0) + doneflag = FALSE; + else if (DRLG_PlaceMiniSet(STAIRSDOWN, 1, 1, 0, 0, FALSE, -1, 1) < 0) + doneflag = FALSE; + } } else if (currlevel == 21) { if (DRLG_PlaceMiniSet(L5STAIRSTOWN, 1, 1, 0, 0, FALSE, -1, 6) < 0) doneflag = FALSE; @@ -2583,7 +2586,7 @@ static void DRLG_L5(int entry) doneflag = FALSE; ViewY++; } else { - if (DRLG_PlaceMiniSet(L5STAIRSUP, 1, 1, 0, 0, TRUE, -1, 0) < 0) + if (DRLG_PlaceMiniSet(L5STAIRSUPHF, 1, 1, 0, 0, TRUE, -1, 0) < 0) doneflag = FALSE; if (currlevel != 24) { if (DRLG_PlaceMiniSet(L5STAIRSDOWN, 1, 1, 0, 0, FALSE, -1, 1) < 0) @@ -2591,7 +2594,7 @@ static void DRLG_L5(int entry) } ViewY++; } - } else if (entry == 1) { + } else if (gbIsHellfire && entry == 1) { if (currlevel < 21) { if (DRLG_PlaceMiniSet(STAIRSUP, 1, 1, 0, 0, FALSE, -1, 0) < 0) doneflag = FALSE; @@ -2605,7 +2608,7 @@ static void DRLG_L5(int entry) doneflag = FALSE; ViewY += 3; } else { - if (DRLG_PlaceMiniSet(L5STAIRSUP, 1, 1, 0, 0, TRUE, -1, 0) < 0) + if (DRLG_PlaceMiniSet(L5STAIRSUPHF, 1, 1, 0, 0, TRUE, -1, 0) < 0) doneflag = FALSE; if (currlevel != 24) { if (DRLG_PlaceMiniSet(L5STAIRSDOWN, 1, 1, 0, 0, TRUE, -1, 1) < 0) @@ -2615,36 +2618,31 @@ static void DRLG_L5(int entry) } } else { if (currlevel < 21) { - if (DRLG_PlaceMiniSet(STAIRSUP, 1, 1, 0, 0, FALSE, -1, 0) < 0) - doneflag = FALSE; - if (DRLG_PlaceMiniSet(STAIRSDOWN, 1, 1, 0, 0, FALSE, -1, 1) < 0) - doneflag = FALSE; + if (gbIsHellfire) { + if (DRLG_PlaceMiniSet(STAIRSUP, 1, 1, 0, 0, FALSE, -1, 0) < 0) + doneflag = FALSE; + if (DRLG_PlaceMiniSet(STAIRSDOWN, 1, 1, 0, 0, FALSE, -1, 1) < 0) + doneflag = FALSE; + } else { + if (DRLG_PlaceMiniSet(L5STAIRSUP, 1, 1, 0, 0, FALSE, -1, 0) < 0) + doneflag = FALSE; + else if (DRLG_PlaceMiniSet(STAIRSDOWN, 1, 1, 0, 0, TRUE, -1, 1) < 0) + doneflag = FALSE; + ViewY--; + } } else if (currlevel == 21) { if (DRLG_PlaceMiniSet(L5STAIRSTOWN, 1, 1, 0, 0, TRUE, -1, 6) < 0) doneflag = FALSE; if (DRLG_PlaceMiniSet(L5STAIRSDOWN, 1, 1, 0, 0, FALSE, -1, 1) < 0) doneflag = FALSE; } else { - if (DRLG_PlaceMiniSet(L5STAIRSUP, 1, 1, 0, 0, TRUE, -1, 0) < 0) + if (DRLG_PlaceMiniSet(L5STAIRSUPHF, 1, 1, 0, 0, TRUE, -1, 0) < 0) doneflag = FALSE; if (currlevel != 24) { if (DRLG_PlaceMiniSet(L5STAIRSDOWN, 1, 1, 0, 0, FALSE, -1, 1) < 0) doneflag = FALSE; } } -#else - } else if (entry == ENTRY_MAIN) { - if (DRLG_PlaceMiniSet(L5STAIRSUP, 1, 1, 0, 0, TRUE, -1, 0) < 0) - doneflag = FALSE; - else if (DRLG_PlaceMiniSet(STAIRSDOWN, 1, 1, 0, 0, FALSE, -1, 1) < 0) - doneflag = FALSE; - } else { - if (DRLG_PlaceMiniSet(L5STAIRSUP, 1, 1, 0, 0, FALSE, -1, 0) < 0) - doneflag = FALSE; - else if (DRLG_PlaceMiniSet(STAIRSDOWN, 1, 1, 0, 0, TRUE, -1, 1) < 0) - doneflag = FALSE; - ViewY--; -#endif } } while (doneflag == FALSE); diff --git a/Source/items.cpp b/Source/items.cpp index 11b51cc49..79e72286e 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -4276,22 +4276,22 @@ void UseItem(int p, int Mid, int spl) break; case IMISC_ELIXMAG: ModifyPlrMag(p, 1); -#ifdef HELLFIRE - plr[p]._pMana = plr[p]._pMaxMana; - plr[p]._pManaBase = plr[p]._pMaxManaBase; - drawmanaflag = TRUE; -#endif + if (gbIsHellfire) { + plr[p]._pMana = plr[p]._pMaxMana; + plr[p]._pManaBase = plr[p]._pMaxManaBase; + drawmanaflag = TRUE; + } break; case IMISC_ELIXDEX: ModifyPlrDex(p, 1); break; case IMISC_ELIXVIT: ModifyPlrVit(p, 1); -#ifdef HELLFIRE - plr[p]._pHitPoints = plr[p]._pMaxHP; - plr[p]._pHPBase = plr[p]._pMaxHPBase; - drawhpflag = TRUE; -#endif + if (gbIsHellfire) { + plr[p]._pHitPoints = plr[p]._pMaxHP; + plr[p]._pHPBase = plr[p]._pMaxHPBase; + drawhpflag = TRUE; + } break; case IMISC_REJUV: j = plr[p]._pMaxHP >> 8; @@ -4347,10 +4347,8 @@ void UseItem(int p, int Mid, int spl) plr[p].destAction = ACTION_SPELL; plr[p].destParam1 = cursmx; plr[p].destParam2 = cursmy; -#ifndef HELLFIRE if (p == myplr && spl == SPL_NOVA) NetSendCmdLoc(TRUE, CMD_NOVA, cursmx, cursmy); -#endif } break; case IMISC_SCROLLT: @@ -4578,31 +4576,23 @@ BOOL PremiumItemOk(int i) BOOL rv; rv = TRUE; -#ifdef HELLFIRE - if (AllItemsList[i].itype == ITYPE_MISC || AllItemsList[i].itype == ITYPE_GOLD || AllItemsList[i].itype == ITYPE_FOOD) - rv = FALSE; - - if (gbMaxPlayers != 1) { - if (AllItemsList[i].iMiscId == IMISC_OILOF || AllItemsList[i].itype == ITYPE_RING || AllItemsList[i].itype == ITYPE_AMULET) - rv = FALSE; - } -#else if (AllItemsList[i].itype == ITYPE_MISC) rv = FALSE; if (AllItemsList[i].itype == ITYPE_GOLD) rv = FALSE; if (AllItemsList[i].itype == ITYPE_FOOD) rv = FALSE; - if (AllItemsList[i].itype == ITYPE_STAFF) + if (!gbIsHellfire && AllItemsList[i].itype == ITYPE_STAFF) rv = FALSE; if (gbMaxPlayers != 1) { + if (AllItemsList[i].iMiscId == IMISC_OILOF) + rv = FALSE; if (AllItemsList[i].itype == ITYPE_RING) rv = FALSE; if (AllItemsList[i].itype == ITYPE_AMULET) rv = FALSE; } -#endif return rv; } diff --git a/Source/player.cpp b/Source/player.cpp index 5bc08b5ec..b3e40f856 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -3593,13 +3593,9 @@ void ValidatePlayer() gt = 0; for (i = 0; i < plr[myplr]._pNumInv; i++) { if (plr[myplr].InvList[i]._itype == ITYPE_GOLD) { -#ifdef HELLFIRE - if (plr[myplr].InvList[i]._ivalue > auricGold) { - plr[myplr].InvList[i]._ivalue = auricGold; -#else - if (plr[myplr].InvList[i]._ivalue > GOLD_MAX_LIMIT) { - plr[myplr].InvList[i]._ivalue = GOLD_MAX_LIMIT; -#endif + int maxGold = gbIsHellfire ? auricGold : GOLD_MAX_LIMIT; + if (plr[myplr].InvList[i]._ivalue > maxGold) { + plr[myplr].InvList[i]._ivalue = maxGold; } gt += plr[myplr].InvList[i]._ivalue; } @@ -4204,13 +4200,11 @@ void ModifyPlrStr(int p, int l) plr[p]._pStrength += l; plr[p]._pBaseStr += l; -#ifndef HELLFIRE if (plr[p]._pClass == PC_ROGUE) { plr[p]._pDamageMod = plr[p]._pLevel * (plr[p]._pStrength + plr[p]._pDexterity) / 200; } else { plr[p]._pDamageMod = plr[p]._pLevel * plr[p]._pStrength / 100; } -#endif CalcPlrInv(p, TRUE); @@ -4273,11 +4267,9 @@ void ModifyPlrDex(int p, int l) plr[p]._pBaseDex += l; CalcPlrInv(p, TRUE); -#ifndef HELLFIRE if (plr[p]._pClass == PC_ROGUE) { plr[p]._pDamageMod = plr[p]._pLevel * (plr[p]._pDexterity + plr[p]._pStrength) / 200; } -#endif if (p == myplr) { NetSendCmdParam1(FALSE, CMD_SETDEX, plr[p]._pBaseDex); @@ -4344,7 +4336,6 @@ void SetPlrStr(int p, int v) plr[p]._pBaseStr = v; CalcPlrInv(p, TRUE); -#ifndef HELLFIRE if (plr[p]._pClass == PC_ROGUE) { dm = plr[p]._pLevel * (plr[p]._pStrength + plr[p]._pDexterity) / 200; } else { @@ -4352,7 +4343,6 @@ void SetPlrStr(int p, int v) } plr[p]._pDamageMod = dm; -#endif } void SetPlrMag(int p, int v) @@ -4388,7 +4378,6 @@ void SetPlrDex(int p, int v) plr[p]._pBaseDex = v; CalcPlrInv(p, TRUE); -#ifndef HELLFIRE if (plr[p]._pClass == PC_ROGUE) { dm = plr[p]._pLevel * (plr[p]._pStrength + plr[p]._pDexterity) / 200; } else { @@ -4396,7 +4385,6 @@ void SetPlrDex(int p, int v) } plr[p]._pDamageMod = dm; -#endif } void SetPlrVit(int p, int v)