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/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); diff --git a/Source/gamemenu.cpp b/Source/gamemenu.cpp index 500357b9e..32653fcf5 100644 --- a/Source/gamemenu.cpp +++ b/Source/gamemenu.cpp @@ -294,7 +294,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; diff --git a/Source/items.cpp b/Source/items.cpp index 3f4f9e0d3..db629c600 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -3111,8 +3111,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]; @@ -3131,8 +3131,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]; } @@ -3182,8 +3182,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 b31df5d6a..4b637e4cb 100644 --- a/Source/monster.cpp +++ b/Source/monster.cpp @@ -1848,7 +1848,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); } @@ -2652,7 +2652,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 cba8cdeb3..dab605826 100644 --- a/Source/objects.cpp +++ b/Source/objects.cpp @@ -2848,8 +2848,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; @@ -3602,9 +3602,9 @@ void OperateSkelBook(int pnum, int i, DIABOOL 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); } @@ -3660,16 +3660,16 @@ void OperateArmorStand(int pnum, int i, DIABOOL 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); #ifdef HELLFIRE } else if (currlevel >= 17) { - 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); #endif } if (pnum == myplr) @@ -3720,8 +3720,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; } @@ -3873,9 +3873,9 @@ void OperateWeaponRack(int pnum, int i, DIABOOL 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); } @@ -4396,30 +4396,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); } } @@ -4434,17 +4426,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); } } 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 diff --git a/structs.h b/structs.h index 957ef75ea..3fd9fd50d 100644 --- a/structs.h +++ b/structs.h @@ -1374,7 +1374,7 @@ typedef struct _SNETUIDATA { void(* categorylistcallback)(); void(* newaccountcallback)(); void(* profilecallback)(); - int profilefields; + const char **profilefields; void(* profilebitmapcallback)(); int(__stdcall *selectnamecallback)( const struct _SNETPROGRAMDATA *,