From ae52d223d1356db508cb257415754b22dc61521f Mon Sep 17 00:00:00 2001 From: "Christopher M. Hobbs" Date: Thu, 8 Aug 2019 21:19:11 -0500 Subject: [PATCH 1/9] Update debug docs for consistency --- docs/debug.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/debug.md b/docs/debug.md index 7adb07656..c1f74334c 100644 --- a/docs/debug.md +++ b/docs/debug.md @@ -3,7 +3,7 @@ There are debug features available through both in-game and through the command- Command-line parameters - `-^` : enable god mode and debug tools - `-$` : enable god mode with less stuff (further documenting needed) [NOT YET IMPLEMENTED] -- `-b` : enables item drop log [NOT YET IMPLEMENTED] +- `-b` : enable item drop log [NOT YET IMPLEMENTED] - `-d` : disable startup video + increased item drops [PARTIALLY IMPLEMENTED] - `-f` : display frames per second - `-i` : disable network timeout From d6d60f0109178631397141d51f2b4be86375a477 Mon Sep 17 00:00:00 2001 From: Marco Date: Sat, 28 Dec 2019 16:25:29 +0100 Subject: [PATCH 2/9] OperateSkelBook const IMISC_SCROLL --- Source/objects.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/objects.cpp b/Source/objects.cpp index a9d1e1d2e..3e1ce135b 100644 --- a/Source/objects.cpp +++ b/Source/objects.cpp @@ -3470,9 +3470,9 @@ void OperateSkelBook(int pnum, int i, BOOL sendmsg) if (!deltaload) { SetRndSeed(object[i]._oRndSeed); if (random_(161, 5)) - CreateTypeItem(object[i]._ox, object[i]._oy, FALSE, ITYPE_MISC, 21, sendmsg, FALSE); + CreateTypeItem(object[i]._ox, object[i]._oy, FALSE, ITYPE_MISC, IMISC_SCROLL, sendmsg, FALSE); else - CreateTypeItem(object[i]._ox, object[i]._oy, FALSE, ITYPE_MISC, 24, sendmsg, FALSE); + CreateTypeItem(object[i]._ox, object[i]._oy, FALSE, ITYPE_MISC, IMISC_BOOK, sendmsg, FALSE); if (pnum == myplr) NetSendCmdParam1(FALSE, CMD_OPERATEOBJ, i); } From 4626450e11cc7a3ba5b916cde0dfed8f986319f7 Mon Sep 17 00:00:00 2001 From: Marco Date: Sat, 28 Dec 2019 20:48:58 +0100 Subject: [PATCH 3/9] some more item based enum consts --- Source/items.cpp | 12 ++++++------ Source/monster.cpp | 4 ++-- Source/objects.cpp | 12 ++++++------ 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Source/items.cpp b/Source/items.cpp index 4b72600de..ffc156f7a 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -2504,8 +2504,8 @@ void CheckIdentify(int pnum, int cii) { ItemStruct *pi; - if (cii >= 7) - pi = &plr[pnum].InvList[cii - 7]; + if (cii >= NUM_INVLOC) + pi = &plr[pnum].InvList[cii - NUM_INVLOC]; else pi = &plr[pnum].InvBody[cii]; @@ -2524,8 +2524,8 @@ void DoRepair(int pnum, int cii) p = &plr[pnum]; PlaySfxLoc(IS_REPAIR, p->WorldX, p->WorldY); - if (cii >= 7) { - pi = &p->InvList[cii - 7]; + if (cii >= NUM_INVLOC) { + pi = &p->InvList[cii - NUM_INVLOC]; } else { pi = &p->InvBody[cii]; } @@ -2575,8 +2575,8 @@ void DoRecharge(int pnum, int cii) int r; p = &plr[pnum]; - if (cii >= 7) { - pi = &p->InvList[cii - 7]; + if (cii >= NUM_INVLOC) { + pi = &p->InvList[cii - NUM_INVLOC]; } else { pi = &p->InvBody[cii]; } diff --git a/Source/monster.cpp b/Source/monster.cpp index 2255a50c8..cc4e88648 100644 --- a/Source/monster.cpp +++ b/Source/monster.cpp @@ -1643,7 +1643,7 @@ void MonstStartKill(int i, int pnum, BOOL sendmsg) monster[i]._mhitpoints = 0; SetRndSeed(monster[i]._mRndSeed); if (QuestStatus(QTYPE_GARB) && monster[i].mName == UniqMonst[UMT_GARBUD].mName) { - CreateTypeItem(monster[i]._mx + 1, monster[i]._my + 1, TRUE, 4, 0, TRUE, FALSE); + CreateTypeItem(monster[i]._mx + 1, monster[i]._my + 1, TRUE, ITYPE_MACE, IMISC_NONE, TRUE, FALSE); } else if (i > 3) { SpawnItem(i, monster[i]._mx, monster[i]._my, sendmsg); } @@ -2396,7 +2396,7 @@ int M_DoTalk(int i) && !(Monst->_mFlags & MFLAG_QUEST_COMPLETE)) { quests[QTYPE_ZHAR]._qactive = 2; quests[QTYPE_ZHAR]._qlog = TRUE; - CreateTypeItem(Monst->_mx + 1, Monst->_my + 1, FALSE, 0, 24, TRUE, FALSE); + CreateTypeItem(Monst->_mx + 1, Monst->_my + 1, FALSE, ITYPE_MISC, IMISC_BOOK, TRUE, FALSE); Monst->_mFlags |= MFLAG_QUEST_COMPLETE; } if (Monst->mName == UniqMonst[UMT_SNOTSPIL].mName) { diff --git a/Source/objects.cpp b/Source/objects.cpp index 3e1ce135b..feb6621cf 100644 --- a/Source/objects.cpp +++ b/Source/objects.cpp @@ -3528,13 +3528,13 @@ void OperateArmorStand(int pnum, int i, BOOL sendmsg) SetRndSeed(object[i]._oRndSeed); uniqueRnd = random_(0, 2); if (currlevel <= 5) { - CreateTypeItem(object[i]._ox, object[i]._oy, TRUE, ITYPE_LARMOR, 0, sendmsg, FALSE); + CreateTypeItem(object[i]._ox, object[i]._oy, TRUE, ITYPE_LARMOR, IMISC_NONE, sendmsg, FALSE); } else if (currlevel >= 6 && currlevel <= 9) { - CreateTypeItem(object[i]._ox, object[i]._oy, uniqueRnd, ITYPE_MARMOR, 0, sendmsg, FALSE); + CreateTypeItem(object[i]._ox, object[i]._oy, uniqueRnd, ITYPE_MARMOR, IMISC_NONE, sendmsg, FALSE); } else if (currlevel >= 10 && currlevel <= 12) { - CreateTypeItem(object[i]._ox, object[i]._oy, FALSE, ITYPE_HARMOR, 0, sendmsg, FALSE); + CreateTypeItem(object[i]._ox, object[i]._oy, FALSE, ITYPE_HARMOR, IMISC_NONE, sendmsg, FALSE); } else if (currlevel >= 13 && currlevel <= 16) { - CreateTypeItem(object[i]._ox, object[i]._oy, TRUE, ITYPE_HARMOR, 0, sendmsg, FALSE); + CreateTypeItem(object[i]._ox, object[i]._oy, TRUE, ITYPE_HARMOR, IMISC_NONE, sendmsg, FALSE); } if (pnum == myplr) NetSendCmdParam1(FALSE, CMD_OPERATEOBJ, i); @@ -3737,9 +3737,9 @@ void OperateWeaponRack(int pnum, int i, BOOL sendmsg) return; if (leveltype > 1) - CreateTypeItem(object[i]._ox, object[i]._oy, TRUE, weaponType, 0, sendmsg, FALSE); + CreateTypeItem(object[i]._ox, object[i]._oy, TRUE, weaponType, IMISC_NONE, sendmsg, FALSE); else - CreateTypeItem(object[i]._ox, object[i]._oy, FALSE, weaponType, 0, sendmsg, FALSE); + CreateTypeItem(object[i]._ox, object[i]._oy, FALSE, weaponType, IMISC_NONE, sendmsg, FALSE); if (pnum == myplr) NetSendCmdParam1(FALSE, CMD_OPERATEOBJ, i); } From f761c737230352e1b2d494696a24e1bc9b014d87 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Tue, 22 Oct 2019 01:56:18 +0200 Subject: [PATCH 4/9] Correct CelBlitWidth signature --- Source/engine.cpp | 15 +++++++++++---- Source/engine.h | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Source/engine.cpp b/Source/engine.cpp index 87547a96b..d71fa31fa 100644 --- a/Source/engine.cpp +++ b/Source/engine.cpp @@ -1594,9 +1594,16 @@ void CelDrawLightRedSafe(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, i } /** - * @brief Same as CelBlit but cropped to given width + * @brief Blit to a buffer at given coordinates + * @param pBuff Target buffer + * @param x Cordinate in pBuff buffer + * @param y Cordinate in pBuff buffer + * @param wdt Width of pBuff + * @param pCelBuff Cel data + * @param nCel Frame of cel + * @param nWidth Width of cel */ -void CelBlitWidth(BYTE *pBuff, int CelSkip, int hgt, int wdt, BYTE *pCelBuff, int nCel, int nWidth) +void CelBlitWidth(BYTE *pBuff, int x, int y, int wdt, BYTE *pCelBuff, int nCel, int nWidth) { BYTE *pRLEBytes, *dst, *end; @@ -1621,7 +1628,7 @@ void CelBlitWidth(BYTE *pBuff, int CelSkip, int hgt, int wdt, BYTE *pCelBuff, in mov pRLEBytes, eax } - dst = &pBuff[hgt * wdt + CelSkip]; + dst = &pBuff[y * wdt + x]; __asm { mov esi, pRLEBytes @@ -1671,7 +1678,7 @@ void CelBlitWidth(BYTE *pBuff, int CelSkip, int hgt, int wdt, BYTE *pCelBuff, in pRLEBytes = CelGetFrame(pCelBuff, nCel, &nDataSize); end = &pRLEBytes[nDataSize]; - dst = &pBuff[hgt * wdt + CelSkip]; + dst = &pBuff[y * wdt + x]; for (; pRLEBytes != end; dst -= wdt + nWidth) { for (i = nWidth; i;) { diff --git a/Source/engine.h b/Source/engine.h index faa424e33..26075080b 100644 --- a/Source/engine.h +++ b/Source/engine.h @@ -32,7 +32,7 @@ void CelBlitLightTransSafe(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int void CelDrawLightSafe(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int CelSkip, int CelCap); void CelClippedBlitLightTransSafe(BYTE *pBuff, BYTE *pCelBuff, int nCel, int nWidth, int CelSkip, int CelCap); void CelDrawLightRedSafe(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int CelSkip, int CelCap, char light); -void CelBlitWidth(BYTE *pBuff, int always_0, int hgt, int wdt, BYTE *pCelBuff, int nCel, int nWidth); +void CelBlitWidth(BYTE *pBuff, int x, int y, int wdt, BYTE *pCelBuff, int nCel, int nWidth); void CelBlitOutline(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int CelSkip, int CelCap); void CelBlitOutlineSafe(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int CelSkip, int CelCap); void ENG_set_pixel(int sx, int sy, BYTE col); From 9d028a418d9155105e7fe1dd1503c4b24c0a193d Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Mon, 30 Dec 2019 21:40:07 +0100 Subject: [PATCH 5/9] Correct _SNETUIDATA struct UiProfileGetString returns a list of pointer to strings (4), not an int --- DiabloUI/bn_prof.cpp | 2 +- DiabloUI/diabloui.h | 2 +- structs.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/DiabloUI/bn_prof.cpp b/DiabloUI/bn_prof.cpp index 560d6cee6..a1be67af5 100644 --- a/DiabloUI/bn_prof.cpp +++ b/DiabloUI/bn_prof.cpp @@ -10,7 +10,7 @@ signed int bn_prof_100014E8() { return 0; } // 10029404: using guessed type int dword_10029404; // ref: 0x100014F3 -int __stdcall UiProfileGetString() { return 0; } +const char **__stdcall UiProfileGetString() { return NULL; } //const char *UiProfileGetString() { return 0; } /* { return "profile\\sex"; diff --git a/DiabloUI/diabloui.h b/DiabloUI/diabloui.h index b89796754..923a26398 100644 --- a/DiabloUI/diabloui.h +++ b/DiabloUI/diabloui.h @@ -37,7 +37,7 @@ BOOL __stdcall UiSelHeroSingDialog(BOOL(__stdcall *fninfo)(BOOL(__stdcall *fninf BOOL __stdcall UiCreditsDialog(int a1); BOOL __stdcall UiMainMenuDialog(char *name, int *pdwResult, void(__stdcall *fnSound)(char *file), int a4); BOOL __stdcall UiProgressDialog(HWND window, char *msg, int enable, int(*fnfunc)(), int rate); -int __stdcall UiProfileGetString(); +const char **__stdcall UiProfileGetString(); void __cdecl UiProfileCallback(); void __cdecl UiProfileDraw(); BOOL __stdcall UiCategoryCallback(int a1, int a2, int a3, int a4, int a5, DWORD *a6, DWORD *a7); diff --git a/structs.h b/structs.h index 34227e647..00a82282c 100644 --- a/structs.h +++ b/structs.h @@ -1327,7 +1327,7 @@ typedef struct _SNETUIDATA { void(* categorylistcallback)(); void(* newaccountcallback)(); void(* profilecallback)(); - int profilefields; + const char **profilefields; void(* profilebitmapcallback)(); int(__stdcall *selectnamecallback)( const struct _SNETPROGRAMDATA *, From 6dd9e0dffd08313b883fa490e68bfe7388762d58 Mon Sep 17 00:00:00 2001 From: qndel Date: Thu, 2 Jan 2020 15:01:25 +0100 Subject: [PATCH 6/9] gamemenu_gamma cleanup --- Source/gamemenu.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/gamemenu.cpp b/Source/gamemenu.cpp index c18ca4668..63926f846 100644 --- a/Source/gamemenu.cpp +++ b/Source/gamemenu.cpp @@ -283,7 +283,8 @@ void gamemenu_gamma(BOOL bActivate) { int gamma; if (bActivate) { - if (UpdateGamma(0) == 30) + gamma = UpdateGamma(0); + if (gamma == 30) gamma = 100; else gamma = 30; From 3f9398812a9c3be9a334226c792f42e330b42224 Mon Sep 17 00:00:00 2001 From: qndel Date: Thu, 2 Jan 2020 21:25:19 +0100 Subject: [PATCH 7/9] SyncDoors cleanup --- Source/objects.cpp | 30 ++++++++---------------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/Source/objects.cpp b/Source/objects.cpp index feb6621cf..03120ee61 100644 --- a/Source/objects.cpp +++ b/Source/objects.cpp @@ -4266,30 +4266,22 @@ void SyncPedistal(int i) void SyncL2Doors(int i) { - int val; int x, y; - val = object[i]._oVar4; - if (!val) + if (object[i]._oVar4 == 0) object[i]._oMissFlag = FALSE; else object[i]._oMissFlag = TRUE; x = object[i]._ox; y = object[i]._oy; object[i]._oSelFlag = 2; - if (object[i]._otype == OBJ_L2LDOOR && val == 0) { + if (object[i]._otype == OBJ_L2LDOOR && object[i]._oVar4 == 0) { ObjSetMicro(x, y, 538); - return; - } - if (object[i]._otype == OBJ_L2LDOOR && (val == 1 || val == 2)) { + } else if (object[i]._otype == OBJ_L2LDOOR && (object[i]._oVar4 == 1 || object[i]._oVar4 == 2)) { ObjSetMicro(x, y, 13); - return; - } - if (object[i]._otype == OBJ_L2RDOOR && val == 0) { + } else if (object[i]._otype == OBJ_L2RDOOR && object[i]._oVar4 == 0) { ObjSetMicro(x, y, 540); - return; - } - if (object[i]._otype == OBJ_L2RDOOR && (val == 1 || val == 2)) { + } else if (object[i]._otype == OBJ_L2RDOOR && (object[i]._oVar4 == 1 || object[i]._oVar4 == 2)) { ObjSetMicro(x, y, 17); } } @@ -4304,17 +4296,11 @@ void SyncL3Doors(int i) object[i]._oSelFlag = 2; if (object[i]._otype == OBJ_L3LDOOR && object[i]._oVar4 == 0) { ObjSetMicro(x, y, 531); - return; - } - if (object[i]._otype == OBJ_L3LDOOR && (object[i]._oVar4 == 1 || object[i]._oVar4 == 2)) { + } else if (object[i]._otype == OBJ_L3LDOOR && (object[i]._oVar4 == 1 || object[i]._oVar4 == 2)) { ObjSetMicro(x, y, 538); - return; - } - if (object[i]._otype == OBJ_L3RDOOR && object[i]._oVar4 == 0) { + } else if (object[i]._otype == OBJ_L3RDOOR && object[i]._oVar4 == 0) { ObjSetMicro(x, y, 534); - return; - } - if (object[i]._otype == OBJ_L3RDOOR && (object[i]._oVar4 == 1 || object[i]._oVar4 == 2)) { + } else if (object[i]._otype == OBJ_L3RDOOR && (object[i]._oVar4 == 1 || object[i]._oVar4 == 2)) { ObjSetMicro(x, y, 541); } } From 3a66af638dad39d87a1a174783d85954814ad9d2 Mon Sep 17 00:00:00 2001 From: qndel Date: Thu, 2 Jan 2020 21:02:49 +0100 Subject: [PATCH 8/9] OperateTrapLvr cleanup --- Source/objects.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/objects.cpp b/Source/objects.cpp index 03120ee61..e3accae06 100644 --- a/Source/objects.cpp +++ b/Source/objects.cpp @@ -2716,8 +2716,8 @@ void OperateTrapLvr(int i) for (; j < nobjects; j++) { oi = objectactive[j]; if (object[oi]._otype == object[i]._oVar2 && object[oi]._oVar1 == object[i]._oVar1) { - object[oi]._oAnimFlag = 0; object[oi]._oVar2 = 1; + object[oi]._oAnimFlag = 0; } } return; From 1abb61cb640f7840971b1b31388378991d69c929 Mon Sep 17 00:00:00 2001 From: qndel Date: Thu, 2 Jan 2020 20:23:32 +0100 Subject: [PATCH 9/9] OperateCauldron cleanup --- Source/objects.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/objects.cpp b/Source/objects.cpp index e3accae06..72c0366eb 100644 --- a/Source/objects.cpp +++ b/Source/objects.cpp @@ -3584,8 +3584,8 @@ void OperateCauldron(int pnum, int i, int sType) SetRndSeed(object[i]._oRndSeed); object[i]._oVar1 = FindValidShrine(i); OperateShrine(pnum, i, sType); - object[i]._oAnimFlag = 0; object[i]._oAnimFrame = 3; + object[i]._oAnimFlag = 0; force_redraw = 255; }