From 2b24b00c82f3905945c63debfd92f4eb2738c115 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sat, 9 Jan 2021 20:46:01 +0100 Subject: [PATCH 01/11] Use enums for Hellfire enteries --- Source/drlg_l1.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/drlg_l1.cpp b/Source/drlg_l1.cpp index 4c7f8833a..69892eeef 100644 --- a/Source/drlg_l1.cpp +++ b/Source/drlg_l1.cpp @@ -2641,7 +2641,7 @@ static void DRLG_L5(int entry) } } #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; @@ -2662,7 +2662,7 @@ static void DRLG_L5(int entry) } ViewY++; } - } else if (entry == 1) { + } else if (entry == ENTRY_PREV) { if (currlevel < 21) { if (DRLG_PlaceMiniSet(STAIRSUP, 1, 1, 0, 0, FALSE, -1, 0) < 0) doneflag = FALSE; From 8d27b1db63d4fb0b30080a96612721aaff46f949 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sun, 10 Jan 2021 09:52:31 +0100 Subject: [PATCH 02/11] [hellfire] CreatePlayer --- Source/player.cpp | 105 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 79 insertions(+), 26 deletions(-) diff --git a/Source/player.cpp b/Source/player.cpp index 382a56c08..5ed703898 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -734,6 +734,9 @@ void CreatePlayer(int pnum, char c) int hp, mana; int i; +#ifdef HELLFIRE + memset(&plr[pnum], 0, sizeof(PlayerStruct)); +#endif ClearPlrRVars(&plr[pnum]); SetRndSeed(GetTickCount()); @@ -773,10 +776,22 @@ void CreatePlayer(int pnum, char c) plr[pnum]._pStatPts = 0; plr[pnum].pTownWarps = 0; plr[pnum].pDungMsgs = 0; +#ifdef HELLFIRE + plr[pnum].pDungMsgs2 = 0; +#endif plr[pnum].pLvlLoad = 0; plr[pnum].pDiabloKillLevel = 0; +#ifdef HELLFIRE + plr[pnum].pDifficulty = DIFF_NORMAL; +#endif - if (c == PC_ROGUE) { +#ifdef HELLFIRE + if (plr[pnum]._pClass == PC_MONK) { + plr[pnum]._pDamageMod = (plr[pnum]._pStrength + plr[pnum]._pDexterity) * plr[pnum]._pLevel / 150; + } else if (plr[pnum]._pClass == PC_ROGUE || plr[pnum]._pClass == PC_BARD) { +#else + if (plr[pnum]._pClass == PC_ROGUE) { +#endif plr[pnum]._pDamageMod = plr[pnum]._pLevel * (plr[pnum]._pStrength + plr[pnum]._pDexterity) / 200; } else { plr[pnum]._pDamageMod = plr[pnum]._pStrength * plr[pnum]._pLevel / 100; @@ -784,41 +799,64 @@ void CreatePlayer(int pnum, char c) plr[pnum]._pBaseToBlk = ToBlkTbl[c]; - plr[pnum]._pHitPoints = (val + 10) << 6; - if (c == PC_WARRIOR) { - plr[pnum]._pHitPoints *= 2; + plr[pnum]._pHitPoints = (plr[pnum]._pVitality + 10) << 6; + if (plr[pnum]._pClass == PC_WARRIOR +#ifdef HELLFIRE + || plr[pnum]._pClass == PC_BARBARIAN +#endif + ) { + plr[pnum]._pHitPoints <<= 1; +#ifdef HELLFIRE + } else if (plr[pnum]._pClass == PC_ROGUE || plr[pnum]._pClass == PC_MONK || plr[pnum]._pClass == PC_BARD) { +#else } - if (c == PC_ROGUE) { + if (plr[pnum]._pClass == PC_ROGUE == PC_ROGUE) { +#endif plr[pnum]._pHitPoints += plr[pnum]._pHitPoints >> 1; } - hp = plr[pnum]._pHitPoints; - plr[pnum]._pMaxHP = hp; - plr[pnum]._pHPBase = hp; - plr[pnum]._pMaxHPBase = hp; + plr[pnum]._pMaxHP = plr[pnum]._pHitPoints; + plr[pnum]._pHPBase = plr[pnum]._pHitPoints; + plr[pnum]._pMaxHPBase = plr[pnum]._pHitPoints; plr[pnum]._pMana = plr[pnum]._pMagic << 6; - if (c == PC_SORCERER) { - plr[pnum]._pMana *= 2; + if (plr[pnum]._pClass == PC_SORCERER) { + plr[pnum]._pMana <<= 1; +#ifdef HELLFIRE + } else if (plr[pnum]._pClass == PC_BARD) { + plr[pnum]._pMana += plr[pnum]._pMana * 3 / 4; + } else if (plr[pnum]._pClass == PC_ROGUE + || plr[pnum]._pClass == PC_MONK) { +#else } - if (c == PC_ROGUE) { + if (plr[pnum]._pClass == PC_ROGUE) { +#endif plr[pnum]._pMana += plr[pnum]._pMana >> 1; } - mana = plr[pnum]._pMana; - plr[pnum]._pMaxMana = mana; - plr[pnum]._pManaBase = mana; - plr[pnum]._pMaxManaBase = mana; + plr[pnum]._pMaxMana = plr[pnum]._pMana; + plr[pnum]._pManaBase = plr[pnum]._pMana; + plr[pnum]._pMaxManaBase = plr[pnum]._pMana; plr[pnum]._pLevel = 1; - plr[pnum]._pMaxLvl = 1; + plr[pnum]._pMaxLvl = plr[pnum]._pLevel; plr[pnum]._pExperience = 0; - plr[pnum]._pMaxExp = 0; + plr[pnum]._pMaxExp = plr[pnum]._pExperience; plr[pnum]._pNextExper = ExpLvlsTbl[1]; plr[pnum]._pArmorClass = 0; - plr[pnum]._pMagResist = 0; - plr[pnum]._pFireResist = 0; - plr[pnum]._pLghtResist = 0; +#ifdef HELLFIRE + if (plr[pnum]._pClass == PC_BARBARIAN) { + plr[pnum]._pMagResist = 1; + plr[pnum]._pFireResist = 1; + plr[pnum]._pLghtResist = 1; + } else { +#endif + plr[pnum]._pMagResist = 0; + plr[pnum]._pFireResist = 0; + plr[pnum]._pLghtResist = 0; +#ifdef HELLFIRE + } +#endif plr[pnum]._pLightRad = 10; plr[pnum]._pInfraFlag = FALSE; @@ -829,6 +867,14 @@ void CreatePlayer(int pnum, char c) plr[pnum]._pAblSpells = SPELLBIT(SPL_DISARM); } else if (c == PC_SORCERER) { plr[pnum]._pAblSpells = SPELLBIT(SPL_RECHARGE); +#endif +#ifdef HELLFIRE + } else if (c == PC_MONK) { + plr[pnum]._pAblSpells = SPELLBIT(SPL_SEARCH); + } else if (c == PC_BARD) { + plr[pnum]._pAblSpells = SPELLBIT(SPL_IDENTIFY); + } else if (c == PC_BARBARIAN) { + plr[pnum]._pAblSpells = SPELLBIT(SPL_BLODBOIL); #endif } @@ -861,6 +907,14 @@ void CreatePlayer(int pnum, char c) plr[pnum]._pgfxnum = ANIM_ID_BOW; } else if (c == PC_SORCERER) { plr[pnum]._pgfxnum = ANIM_ID_STAFF; +#endif +#ifdef HELLFIRE + } else if (c == PC_MONK) { + plr[pnum]._pgfxnum = ANIM_ID_STAFF; + } else if (c == PC_BARD) { + plr[pnum]._pgfxnum = ANIM_ID_SWORD_SHIELD; + } else if (c == PC_BARBARIAN) { + plr[pnum]._pgfxnum = ANIM_ID_SWORD_SHIELD; #endif } @@ -878,6 +932,9 @@ void CreatePlayer(int pnum, char c) #ifndef HELLFIRE plr[pnum].pBattleNet = FALSE; plr[pnum].pManaShield = FALSE; +#else + plr[pnum].pDamAcFlags = 0; + plr[pnum].wReflection = 0; #endif InitDungMsgs(pnum); @@ -4114,11 +4171,7 @@ void CheckPlrSpell() if (((MouseY >= PANEL_TOP) || (chrflag && MouseX < SPANEL_WIDTH) || (invflag && MouseX > RIGHT_PANEL)) - && ((MouseY >= PANEL_TOP) || ( - rspell != SPL_HEAL && - rspell != SPL_IDENTIFY && - rspell != SPL_REPAIR && - rspell != SPL_INFRA && rspell != SPL_RECHARGE))) { + && ((MouseY >= PANEL_TOP) || (rspell != SPL_HEAL && rspell != SPL_IDENTIFY && rspell != SPL_REPAIR && rspell != SPL_INFRA && rspell != SPL_RECHARGE))) { return; } From 51c6104edfe7cf45f56afff6d0c71c5d85a4518b Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sun, 10 Jan 2021 10:02:55 +0100 Subject: [PATCH 03/11] [hellfire] StartPlrHit --- Source/player.cpp | 41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/Source/player.cpp b/Source/player.cpp index 5ed703898..a083b86fa 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -1922,25 +1922,42 @@ void StartPlrHit(int pnum, int dam, BOOL forcehit) PlaySfxLoc(PS_ROGUE69, plr[pnum]._px, plr[pnum]._py); } else if (plr[pnum]._pClass == PC_SORCERER) { PlaySfxLoc(PS_MAGE69, plr[pnum]._px, plr[pnum]._py); +#endif +#ifdef HELLFIRE + } else if (plr[pnum]._pClass == PC_MONK) { + PlaySfxLoc(PS_MONK69, plr[pnum]._px, plr[pnum]._py); + } else if (plr[pnum]._pClass == PC_BARD) { + PlaySfxLoc(PS_ROGUE69, plr[pnum]._px, plr[pnum]._py); + } else if (plr[pnum]._pClass == PC_BARBARIAN) { + PlaySfxLoc(PS_WARR69, plr[pnum]._px, plr[pnum]._py); #endif } drawhpflag = TRUE; - if (dam >> 6 >= plr[pnum]._pLevel || forcehit) { - pd = plr[pnum]._pdir; - - if (!(plr[pnum]._pGFXLoad & PFILE_HIT)) { - LoadPlrGFX(pnum, PFILE_HIT); +#ifdef HELLFIRE + if (plr[pnum]._pClass == PC_BARBARIAN) { + if (dam >> 6 < plr[pnum]._pLevel + plr[pnum]._pLevel / 4 && !forcehit) { + return; } - NewPlrAnim(pnum, plr[pnum]._pHAnim[pd], plr[pnum]._pHFrames, 0, plr[pnum]._pHWidth); + } else +#endif + if (dam >> 6 < plr[pnum]._pLevel && !forcehit) { + return; + } - plr[pnum]._pmode = PM_GOTHIT; - FixPlayerLocation(pnum, pd); - plr[pnum]._pVar8 = 1; - FixPlrWalkTags(pnum); - dPlayer[plr[pnum]._px][plr[pnum]._py] = pnum + 1; - SetPlayerOld(pnum); + pd = plr[pnum]._pdir; + + if (!(plr[pnum]._pGFXLoad & PFILE_HIT)) { + LoadPlrGFX(pnum, PFILE_HIT); } + NewPlrAnim(pnum, plr[pnum]._pHAnim[pd], plr[pnum]._pHFrames, 0, plr[pnum]._pHWidth); + + plr[pnum]._pmode = PM_GOTHIT; + FixPlayerLocation(pnum, pd); + plr[pnum]._pVar8 = 1; + FixPlrWalkTags(pnum); + dPlayer[plr[pnum]._px][plr[pnum]._py] = pnum + 1; + SetPlayerOld(pnum); } void RespawnDeadItem(ItemStruct *itm, int x, int y) From 7c22dd2bd5ea946558913ef03dd1007811c1b1bf Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sun, 10 Jan 2021 17:35:04 +0100 Subject: [PATCH 04/11] [hellfire] PlrHitPlr --- Source/player.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Source/player.cpp b/Source/player.cpp index a083b86fa..edec59eb2 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -3029,7 +3029,11 @@ BOOL PlrHitPlr(int pnum, char p) dam += (dam * plr[pnum]._pIBonusDam) / 100; dam += plr[pnum]._pIBonusDamMod + plr[pnum]._pDamageMod; - if (plr[pnum]._pClass == PC_WARRIOR) { + if (plr[pnum]._pClass == PC_WARRIOR +#ifdef HELLFIRE + || plr[pnum]._pClass == PC_BARBARIAN +#endif + ) { lvl = plr[pnum]._pLevel; if (random_(6, 100) < lvl) { dam <<= 1; From 8bf14c1e1342109626429a4cbcd89f92d424d940 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sun, 10 Jan 2021 20:21:28 +0100 Subject: [PATCH 05/11] [hellfire] PM_DoAttack --- Source/player.cpp | 54 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 43 insertions(+), 11 deletions(-) diff --git a/Source/player.cpp b/Source/player.cpp index edec59eb2..982a9e302 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -3085,7 +3085,7 @@ BOOL PlrHitObj(int pnum, int mx, int my) BOOL PM_DoAttack(int pnum) { int frame, dir, dx, dy, m; - BOOL didhit; + BOOL didhit = FALSE; if ((DWORD)pnum >= MAX_PLRS) { app_fatal("PM_DoAttack: illegal player %d", pnum); @@ -3109,9 +3109,8 @@ BOOL PM_DoAttack(int pnum) } if (plr[pnum]._pAnimFrame == plr[pnum]._pAFNum) { - dir = plr[pnum]._pdir; - dx = plr[pnum]._px + offset_x[dir]; - dy = plr[pnum]._py + offset_y[dir]; + dx = plr[pnum]._px + offset_x[plr[pnum]._pdir]; + dy = plr[pnum]._py + offset_y[plr[pnum]._pdir]; if (dMonster[dx][dy] != 0) { if (dMonster[dx][dy] > 0) { @@ -3125,14 +3124,19 @@ BOOL PM_DoAttack(int pnum) } } - if (plr[pnum]._pIFlags & ISPL_FIREDAM) { - AddMissile(dx, dy, 1, 0, 0, MIS_WEAPEXP, TARGET_MONSTERS, pnum, 0, 0); - } - if (plr[pnum]._pIFlags & ISPL_LIGHTDAM) { - AddMissile(dx, dy, 2, 0, 0, MIS_WEAPEXP, TARGET_MONSTERS, pnum, 0, 0); - } +#ifdef HELLFIRE + if (!(plr[pnum]._pIFlags & ISPL_FIREDAM) || !(plr[pnum]._pIFlags & ISPL_LIGHTDAM)) +#endif + if (plr[pnum]._pIFlags & ISPL_FIREDAM) { + AddMissile(dx, dy, 1, 0, 0, MIS_WEAPEXP, TARGET_MONSTERS, pnum, 0, 0); + } +#ifdef HELLFIRE + else +#endif + if (plr[pnum]._pIFlags & ISPL_LIGHTDAM) { + AddMissile(dx, dy, 2, 0, 0, MIS_WEAPEXP, TARGET_MONSTERS, pnum, 0, 0); + } - didhit = FALSE; if (dMonster[dx][dy]) { m = dMonster[dx][dy]; if (dMonster[dx][dy] > 0) { @@ -3152,6 +3156,34 @@ BOOL PM_DoAttack(int pnum) } else if (dObject[dx][dy] > 0) { didhit = PlrHitObj(pnum, dx, dy); } +#ifdef HELLFIRE + if ((plr[pnum]._pClass == PC_MONK + && (plr[pnum].InvBody[INVLOC_HAND_LEFT]._itype == ITYPE_STAFF || plr[pnum].InvBody[INVLOC_HAND_RIGHT]._itype == ITYPE_STAFF)) + || (plr[pnum]._pClass == PC_BARD + && plr[pnum].InvBody[INVLOC_HAND_LEFT]._itype == ITYPE_SWORD && plr[pnum].InvBody[INVLOC_HAND_RIGHT]._itype == ITYPE_SWORD) + || (plr[pnum]._pClass == PC_BARBARIAN + && (plr[pnum].InvBody[INVLOC_HAND_LEFT]._itype == ITYPE_AXE || plr[pnum].InvBody[INVLOC_HAND_RIGHT]._itype == ITYPE_AXE + || (((plr[pnum].InvBody[INVLOC_HAND_LEFT]._itype == ITYPE_MACE && plr[pnum].InvBody[INVLOC_HAND_LEFT]._iLoc == ILOC_TWOHAND) + || (plr[pnum].InvBody[INVLOC_HAND_RIGHT]._itype == ITYPE_MACE && plr[pnum].InvBody[INVLOC_HAND_RIGHT]._iLoc == ILOC_TWOHAND) + || (plr[pnum].InvBody[INVLOC_HAND_LEFT]._itype == ITYPE_SWORD && plr[pnum].InvBody[INVLOC_HAND_LEFT]._iLoc == ILOC_TWOHAND) + || (plr[pnum].InvBody[INVLOC_HAND_RIGHT]._itype == ITYPE_SWORD && plr[pnum].InvBody[INVLOC_HAND_RIGHT]._iLoc == ILOC_TWOHAND)) + && !(plr[pnum].InvBody[INVLOC_HAND_LEFT]._itype == ITYPE_SHIELD || plr[pnum].InvBody[INVLOC_HAND_RIGHT]._itype == ITYPE_SHIELD))))) { + dx = plr[pnum]._px + offset_x[(plr[pnum]._pdir + 1) % 8]; + dy = plr[pnum]._py + offset_y[(plr[pnum]._pdir + 1) % 8]; + m = ((dMonster[dx][dy] > 0) ? dMonster[dx][dy] : -dMonster[dx][dy]) - 1; + if (dMonster[dx][dy] != 0 && !CanTalkToMonst(m) && monster[m]._moldx == dx && monster[m]._moldy == dy) { + if (PlrHitMonst(-pnum, m)) + didhit = TRUE; + } + dx = plr[pnum]._px + offset_x[(plr[pnum]._pdir + 7) % 8]; + dy = plr[pnum]._py + offset_y[(plr[pnum]._pdir + 7) % 8]; + m = ((dMonster[dx][dy] > 0) ? dMonster[dx][dy] : -dMonster[dx][dy]) - 1; + if (dMonster[dx][dy] != 0 && !CanTalkToMonst(m) && monster[m]._moldx == dx && monster[m]._moldy == dy) { + if (PlrHitMonst(-pnum, m)) + didhit = TRUE; + } + } +#endif if (didhit && WeaponDur(pnum, 30)) { StartStand(pnum, plr[pnum]._pdir); From abec004ba6d5e7a7e571e260097f5c6891e176c3 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sun, 10 Jan 2021 22:36:09 +0100 Subject: [PATCH 06/11] [hellfire] PosOkPlayer --- Source/player.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/Source/player.cpp b/Source/player.cpp index 982a9e302..9a2ee4a19 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -4062,16 +4062,26 @@ BOOL PosOkPlayer(int pnum, int x, int y) DWORD p; char bv; +#ifndef HELLFIRE PosOK = FALSE; - if (x >= 0 && x < MAXDUNX && y >= 0 && y < MAXDUNY && !SolidLoc(x, y) && dPiece[x][y]) { - + if (x >= 0 && x < MAXDUNX && y >= 0 && y < MAXDUNY && !SolidLoc(x, y) && dPiece[x][y] != 0) { +#else + if (dPiece[x][y] == 0) + return FALSE; + if (SolidLoc(x, y)) + return FALSE; +#endif if (dPlayer[x][y] != 0) { if (dPlayer[x][y] > 0) { p = dPlayer[x][y] - 1; } else { p = -(dPlayer[x][y] + 1); } - if (p != pnum && p < MAX_PLRS && plr[p]._pHitPoints != 0) { + if (p != pnum +#ifndef HELLFIRE + && p < MAX_PLRS +#endif + && plr[p]._pHitPoints != 0) { return FALSE; } } @@ -4099,11 +4109,13 @@ BOOL PosOkPlayer(int pnum, int x, int y) } } +#ifndef HELLFIRE PosOK = TRUE; } if (!PosOK) return FALSE; +#endif return TRUE; } From 869c4907151dec069337c370d44d82da14b320e1 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Mon, 11 Jan 2021 11:09:24 +0100 Subject: [PATCH 07/11] [hellfire] NetSendCmdGItem --- Source/msg.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Source/msg.cpp b/Source/msg.cpp index 8f655dad7..52638b2b2 100644 --- a/Source/msg.cpp +++ b/Source/msg.cpp @@ -1040,6 +1040,14 @@ void NetSendCmdGItem(BOOL bHiPri, BYTE bCmd, BYTE mast, BYTE pnum, BYTE ii) cmd.bCh = item[ii]._iCharges; cmd.bMCh = item[ii]._iMaxCharges; cmd.wValue = item[ii]._ivalue; +#ifdef HELLFIRE + cmd.wToHit = item[ii]._iPLToHit; + cmd.wMaxDam = item[ii]._iMaxDam; + cmd.bMinStr = item[ii]._iMinStr; + cmd.bMinMag = item[ii]._iMinMag; + cmd.bMinDex = item[ii]._iMinDex; + cmd.bAC = item[ii]._iAC; +#endif } if (bHiPri) From 3a8dab462e2c926f1b2a4db807947ca9bce308e8 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Mon, 11 Jan 2021 11:39:06 +0100 Subject: [PATCH 08/11] [hellfire] multi_send_msg_packet --- Source/multi.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/multi.cpp b/Source/multi.cpp index 15de1a8d9..530024d9d 100644 --- a/Source/multi.cpp +++ b/Source/multi.cpp @@ -214,7 +214,7 @@ void multi_send_msg_packet(int pmask, BYTE *src, BYTE len) memcpy(pkt.body, src, len); for (v = 1, p = 0; p < MAX_PLRS; p++, v <<= 1) { if (v & pmask) { - if (!SNetSendMessage(p, &pkt.hdr, t) && SErrGetLastError() != STORM_ERROR_INVALID_PLAYER) { + if (!SNetSendMessage(p, &pkt.hdr, t) && DERROR() != STORM_ERROR_INVALID_PLAYER) { nthread_terminate_game("SNetSendMessage"); return; } From 5bb5d842d39eed0dca6d5ed5e473b9e0c3544227 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Mon, 11 Jan 2021 11:42:43 +0100 Subject: [PATCH 09/11] [hellfire] multi_process_network_packets --- Source/multi.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/multi.cpp b/Source/multi.cpp index 530024d9d..789854827 100644 --- a/Source/multi.cpp +++ b/Source/multi.cpp @@ -547,7 +547,7 @@ void multi_process_network_packets() } multi_handle_all_packets(dwID, (BYTE *)(pkt + 1), dwMsgSize - sizeof(TPktHdr)); } - if (SErrGetLastError() != STORM_ERROR_NO_MESSAGES_WAITING) + if (DERROR() != STORM_ERROR_NO_MESSAGES_WAITING) nthread_terminate_game("SNetReceiveMsg"); } From 78eca7c8926ef944e150cfe09cbfe7d830cf94cc Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Mon, 11 Jan 2021 18:50:04 +0100 Subject: [PATCH 10/11] [hellfire] NetInit --- Source/multi.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Source/multi.cpp b/Source/multi.cpp index 789854827..f29eea23f 100644 --- a/Source/multi.cpp +++ b/Source/multi.cpp @@ -789,6 +789,9 @@ BOOL NetInit(BOOL bSinglePlayer, BOOL *pfExitProgram) while (1) { *pfExitProgram = FALSE; +#ifdef HELLFIRE + pfile_create_player_description(NULL, 0); +#endif SetRndSeed(0); sgGameInitInfo.dwSeed = time(NULL); sgGameInitInfo.bDiff = gnDifficulty; @@ -806,7 +809,9 @@ BOOL NetInit(BOOL bSinglePlayer, BOOL *pfExitProgram) ProgramData.initdata = &sgGameInitInfo; ProgramData.initdatabytes = sizeof(sgGameInitInfo); ProgramData.optcategorybits = 15; +#ifndef HELLFIRE ProgramData.lcid = 1033; /* LANG_ENGLISH */ +#endif memset(&plrdata, 0, sizeof(plrdata)); plrdata.size = sizeof(plrdata); memset(&UiData, 0, sizeof(UiData)); @@ -862,8 +867,8 @@ BOOL NetInit(BOOL bSinglePlayer, BOOL *pfExitProgram) nthread_send_and_recv_turn(0, 0); SetupLocalCoords(); multi_send_pinfo(-2, CMD_SEND_PLRINFO); - gbActivePlayers = 1; plr[myplr].plractive = TRUE; + gbActivePlayers = 1; if (sgbPlayerTurnBitTbl[myplr] == FALSE || msg_wait_resync()) break; NetClose(); @@ -889,7 +894,7 @@ BOOL multi_init_single(_SNETPROGRAMDATA *client_info, _SNETPLAYERDATA *user_info int unused; if (!SNetInitializeProvider(0, client_info, user_info, ui_info, &fileinfo)) { - SErrGetLastError(); + DERROR(); return FALSE; } @@ -914,7 +919,7 @@ BOOL multi_init_multi(_SNETPROGRAMDATA *client_info, _SNETPLAYERDATA *user_info, type = 0x00; if (gbSelectProvider) { if (!UiSelectProvider(0, client_info, user_info, ui_info, &fileinfo, &type) - && (!first || SErrGetLastError() != STORM_ERROR_REQUIRES_UPGRADE || !multi_upgrade(pfExitProgram))) { + && (!first || DERROR() != STORM_ERROR_REQUIRES_UPGRADE || !multi_upgrade(pfExitProgram))) { return FALSE; } #ifndef HELLFIRE From e19150bd0a239368b7e87bbaad33c28767a1ab21 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sun, 10 Jan 2021 14:30:30 +0100 Subject: [PATCH 11/11] [hellfire] NetInit --- Source/player.cpp | 107 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 100 insertions(+), 7 deletions(-) diff --git a/Source/player.cpp b/Source/player.cpp index 9a2ee4a19..142960b86 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -2791,6 +2791,11 @@ BOOL PlrHitMonst(int pnum, int m) { BOOL rv, ret; int hit, hper, mind, maxd, ddp, dam, skdam, phanditype, tmac; + hper = 0; +#ifdef HELLFIRE + ret = FALSE; + BOOL adjacentDamage = FALSE; +#endif if ((DWORD)m >= MAXMONSTERS) { app_fatal("PlrHitMonst: illegal monster %d", m); @@ -2808,6 +2813,17 @@ BOOL PlrHitMonst(int pnum, int m) return FALSE; } +#ifdef HELLFIRE + if (pnum < 0) { + adjacentDamage = TRUE; + pnum = -pnum; + if (plr[pnum]._pLevel > 20) + hper -= 30; + else + hper -= (35 - plr[pnum]._pLevel) * 2; + } +#endif + if ((DWORD)pnum >= MAX_PLRS) { app_fatal("PlrHitMonst: illegal player %d", pnum); } @@ -2819,8 +2835,27 @@ BOOL PlrHitMonst(int pnum, int m) hit = 0; } - tmac = monster[m].mArmorClass - plr[pnum]._pIEnAc; - hper = (plr[pnum]._pDexterity >> 1) + plr[pnum]._pLevel + 50 - tmac; + tmac = monster[m].mArmorClass; +#ifdef HELLFIRE + if (plr[pnum]._pIEnAc > 0) { + int _pIEnAc = plr[pnum]._pIEnAc - 1; + if (_pIEnAc > 0) + tmac >>= _pIEnAc; + else + tmac -= tmac >> 2; + + if (plr[pnum]._pClass == PC_BARBARIAN) { + tmac -= monster[m].mArmorClass / 8; + } + + if (tmac < 0) + tmac = 0; + } +#else + tmac -= plr[pnum]._pIEnAc; +#endif + + hper += (plr[pnum]._pDexterity >> 1) + plr[pnum]._pLevel + 50 - tmac; if (plr[pnum]._pClass == PC_WARRIOR) { hper += 20; } @@ -2839,16 +2874,30 @@ BOOL PlrHitMonst(int pnum, int m) if (hit < hper || debug_mode_key_inverted_v || debug_mode_dollar_sign) { #else if (hit < hper) { +#endif +#ifdef HELLFIRE + if (plr[pnum]._pIFlags & ISPL_FIREDAM && plr[pnum]._pIFlags & ISPL_LIGHTDAM) { + int midam = plr[pnum]._pIFMinDam + random_(3, plr[pnum]._pIFMaxDam - plr[pnum]._pIFMinDam); + AddMissile(plr[pnum]._px, plr[pnum]._py, plr[pnum]._pVar1, plr[pnum]._pVar2, plr[pnum]._pdir, MIS_SPECARROW, TARGET_MONSTERS, pnum, midam, 0); + } #endif mind = plr[pnum]._pIMinDam; maxd = plr[pnum]._pIMaxDam; dam = random_(5, maxd - mind + 1) + mind; dam += dam * plr[pnum]._pIBonusDam / 100; - dam += plr[pnum]._pDamageMod + plr[pnum]._pIBonusDamMod; - if (plr[pnum]._pClass == PC_WARRIOR) { + dam += plr[pnum]._pIBonusDamMod; +#ifdef HELLFIRE + int dam2 = dam << 6; +#endif + dam += plr[pnum]._pDamageMod; + if (plr[pnum]._pClass == PC_WARRIOR +#ifdef HELLFIRE + || plr[pnum]._pClass == PC_BARBARIAN +#endif + ) { ddp = plr[pnum]._pLevel; if (random_(6, 100) < ddp) { - dam *= 2; + dam <<= 1; } } @@ -2865,7 +2914,10 @@ BOOL PlrHitMonst(int pnum, int m) if (phanditype == ITYPE_SWORD) { dam -= dam >> 1; } - if (phanditype == ITYPE_MACE) { +#ifdef HELLFIRE + else +#endif + if (phanditype == ITYPE_MACE) { dam += dam >> 1; } break; @@ -2873,7 +2925,10 @@ BOOL PlrHitMonst(int pnum, int m) if (phanditype == ITYPE_MACE) { dam -= dam >> 1; } - if (phanditype == ITYPE_SWORD) { +#ifdef HELLFIRE + else +#endif + if (phanditype == ITYPE_SWORD) { dam += dam >> 1; } break; @@ -2883,8 +2938,46 @@ BOOL PlrHitMonst(int pnum, int m) dam *= 3; } +#ifdef HELLFIRE + if (plr[pnum].pDamAcFlags & 0x01 && random_(6, 100) < 5) { + dam *= 3; + } + + if (plr[pnum].pDamAcFlags & 0x10 && monster[m].MType->mtype != MT_DIABLO && monster[m]._uniqtype == 0 && random_(6, 100) < 10) { + monster_43C785(m); + } +#endif + dam <<= 6; +#ifdef HELLFIRE + if (plr[pnum].pDamAcFlags & 0x08) { + int r = random_(6, 201); + if (r >= 100) + r = 100 + (r - 100) * 5; + dam = dam * r / 100; + } + + if (adjacentDamage) + dam >>= 2; +#endif + if (pnum == myplr) { +#ifdef HELLFIRE + if (plr[pnum].pDamAcFlags & 0x04) { + dam2 += plr[pnum]._pIGetHit << 6; + if (dam2 >= 0) { + if (plr[pnum]._pHitPoints > dam2) { + plr[pnum]._pHitPoints -= dam2; + plr[pnum]._pHPBase -= dam2; + } else { + dam2 = (1 << 6); + plr[pnum]._pHPBase -= plr[pnum]._pHitPoints - dam2; + plr[pnum]._pHitPoints = dam2; + } + } + dam <<= 1; + } +#endif monster[m]._mhitpoints -= dam; }