diff --git a/Source/control.cpp b/Source/control.cpp index d18c7f725..5dcfdd50d 100644 --- a/Source/control.cpp +++ b/Source/control.cpp @@ -1669,18 +1669,20 @@ void ReleaseChrBtns() void DrawDurIcon() { PlayerStruct *p; - int x1, x2, x3, x4; + int x; - if (!chrflag && !questlog || !invflag && !sbookflag) { - x1 = 272 + RIGHT_PANEL_X; - if (invflag || sbookflag) - x1 = 272 + PANEL_X; - p = &plr[myplr]; - x2 = DrawDurIcon4Item(&p->InvBody[INVLOC_HEAD], x1, 4); - x3 = DrawDurIcon4Item(&p->InvBody[INVLOC_CHEST], x2, 3); - x4 = DrawDurIcon4Item(&p->InvBody[INVLOC_HAND_LEFT], x3, 0); - DrawDurIcon4Item(&p->InvBody[INVLOC_HAND_RIGHT], x4, 0); - } + if ((chrflag || questlog) && (invflag || sbookflag)) + return; + + x = PANEL_X + PANEL_WIDTH - 32 - 16; + if (invflag || sbookflag) + x -= SPANEL_WIDTH; + + p = &plr[myplr]; + x = DrawDurIcon4Item(&p->InvBody[INVLOC_HEAD], x, 4); + x = DrawDurIcon4Item(&p->InvBody[INVLOC_CHEST], x, 3); + x = DrawDurIcon4Item(&p->InvBody[INVLOC_HAND_LEFT], x, 0); + DrawDurIcon4Item(&p->InvBody[INVLOC_HAND_RIGHT], x, 0); } int DrawDurIcon4Item(ItemStruct *pItem, int x, int c) @@ -1715,7 +1717,7 @@ int DrawDurIcon4Item(ItemStruct *pItem, int x, int c) if (pItem->_iDurability > 2) c += 8; CelDraw(x, -17 + PANEL_Y, pDurIcons, c, 32); - return x - 40; + return x - 32 + 8; } void RedBack() @@ -1842,7 +1844,7 @@ void PrintSBookStr(int x, int y, BOOL cjustflag, char *pszStr, char col) char *tmp; int screen_x, line, sx; - sx = x + RIGHT_PANEL + 120; + sx = x + RIGHT_PANEL_X + SPLICONLENGTH; line = 0; if (cjustflag) { screen_x = 0; @@ -2072,7 +2074,8 @@ char *control_print_talk_msg(char *msg, int *x, int y, int color) BYTE c; int width; - *x += 264; + *x += 200 + SCREEN_X; + y += 22 + PANEL_Y; width = *x; while (*msg) { @@ -2082,7 +2085,7 @@ char *control_print_talk_msg(char *msg, int *x, int y, int color) return msg; msg++; if (c != 0) { - PrintChar(*x, y + 22 + PANEL_Y, c, color); + PrintChar(*x, y, c, color); } *x += fontkern[c] + 1; } diff --git a/Source/drlg_l1.cpp b/Source/drlg_l1.cpp index 08166c16c..b1f6730d2 100644 --- a/Source/drlg_l1.cpp +++ b/Source/drlg_l1.cpp @@ -1727,20 +1727,20 @@ static void DRLG_L5(int entry) if (QuestStatus(Q_PWATER)) { if (entry == 0) { - if (DRLG_PlaceMiniSet(PWATERIN, 1, 1, 0, 0, 1, -1, 0) < 0) + if (DRLG_PlaceMiniSet(PWATERIN, 1, 1, 0, 0, TRUE, -1, 0) < 0) doneflag = FALSE; } else { - if (DRLG_PlaceMiniSet(PWATERIN, 1, 1, 0, 0, 0, -1, 0) < 0) + if (DRLG_PlaceMiniSet(PWATERIN, 1, 1, 0, 0, FALSE, -1, 0) < 0) doneflag = FALSE; ViewY--; } } if (QuestStatus(Q_LTBANNER)) { if (entry == 0) { - if (DRLG_PlaceMiniSet(STAIRSUP, 1, 1, 0, 0, 1, -1, 0) < 0) + if (DRLG_PlaceMiniSet(STAIRSUP, 1, 1, 0, 0, TRUE, -1, 0) < 0) doneflag = FALSE; } else { - if (DRLG_PlaceMiniSet(STAIRSUP, 1, 1, 0, 0, 0, -1, 0) < 0) + if (DRLG_PlaceMiniSet(STAIRSUP, 1, 1, 0, 0, FALSE, -1, 0) < 0) doneflag = FALSE; if (entry == 1) { ViewX = 2 * setpc_x + 20; @@ -1750,14 +1750,14 @@ static void DRLG_L5(int entry) } } } else if (entry == 0) { - if (DRLG_PlaceMiniSet(L5STAIRSUP, 1, 1, 0, 0, 1, -1, 0) < 0) + if (DRLG_PlaceMiniSet(L5STAIRSUP, 1, 1, 0, 0, TRUE, -1, 0) < 0) doneflag = FALSE; - else if (DRLG_PlaceMiniSet(STAIRSDOWN, 1, 1, 0, 0, 0, -1, 1) < 0) + else if (DRLG_PlaceMiniSet(STAIRSDOWN, 1, 1, 0, 0, FALSE, -1, 1) < 0) doneflag = FALSE; } else { - if (DRLG_PlaceMiniSet(L5STAIRSUP, 1, 1, 0, 0, 0, -1, 0) < 0) + if (DRLG_PlaceMiniSet(L5STAIRSUP, 1, 1, 0, 0, FALSE, -1, 0) < 0) doneflag = FALSE; - else if (DRLG_PlaceMiniSet(STAIRSDOWN, 1, 1, 0, 0, 1, -1, 1) < 0) + else if (DRLG_PlaceMiniSet(STAIRSDOWN, 1, 1, 0, 0, TRUE, -1, 1) < 0) doneflag = FALSE; ViewY--; } @@ -1787,7 +1787,7 @@ static void DRLG_L5(int entry) DRLG_L5Subs(); DRLG_L1Shadows(); - DRLG_PlaceMiniSet(LAMPS, 5, 10, 0, 0, 0, -1, 4); + DRLG_PlaceMiniSet(LAMPS, 5, 10, 0, 0, FALSE, -1, 4); DRLG_L1Floor(); for (j = 0; j < DMAXY; j++) { diff --git a/Source/drlg_l2.cpp b/Source/drlg_l2.cpp index 0e4d8fb15..60bde24e6 100644 --- a/Source/drlg_l2.cpp +++ b/Source/drlg_l2.cpp @@ -3133,29 +3133,29 @@ static void DRLG_L2(int entry) DRLG_L2FloodTVal(); DRLG_L2TransFix(); if (entry == 0) { - doneflag = DRLG_L2PlaceMiniSet(USTAIRS, 1, 1, -1, -1, 1, 0); + doneflag = DRLG_L2PlaceMiniSet(USTAIRS, 1, 1, -1, -1, TRUE, 0); if (doneflag) { - doneflag = DRLG_L2PlaceMiniSet(DSTAIRS, 1, 1, -1, -1, 0, 1); + doneflag = DRLG_L2PlaceMiniSet(DSTAIRS, 1, 1, -1, -1, FALSE, 1); if (doneflag && currlevel == 5) { - doneflag = DRLG_L2PlaceMiniSet(WARPSTAIRS, 1, 1, -1, -1, 0, 6); + doneflag = DRLG_L2PlaceMiniSet(WARPSTAIRS, 1, 1, -1, -1, FALSE, 6); } } ViewY -= 2; } else if (entry == 1) { - doneflag = DRLG_L2PlaceMiniSet(USTAIRS, 1, 1, -1, -1, 0, 0); + doneflag = DRLG_L2PlaceMiniSet(USTAIRS, 1, 1, -1, -1, FALSE, 0); if (doneflag) { - doneflag = DRLG_L2PlaceMiniSet(DSTAIRS, 1, 1, -1, -1, 1, 1); + doneflag = DRLG_L2PlaceMiniSet(DSTAIRS, 1, 1, -1, -1, TRUE, 1); if (doneflag && currlevel == 5) { - doneflag = DRLG_L2PlaceMiniSet(WARPSTAIRS, 1, 1, -1, -1, 0, 6); + doneflag = DRLG_L2PlaceMiniSet(WARPSTAIRS, 1, 1, -1, -1, FALSE, 6); } } ViewX--; } else { - doneflag = DRLG_L2PlaceMiniSet(USTAIRS, 1, 1, -1, -1, 0, 0); + doneflag = DRLG_L2PlaceMiniSet(USTAIRS, 1, 1, -1, -1, FALSE, 0); if (doneflag) { - doneflag = DRLG_L2PlaceMiniSet(DSTAIRS, 1, 1, -1, -1, 0, 1); + doneflag = DRLG_L2PlaceMiniSet(DSTAIRS, 1, 1, -1, -1, FALSE, 1); if (doneflag && currlevel == 5) { - doneflag = DRLG_L2PlaceMiniSet(WARPSTAIRS, 1, 1, -1, -1, 1, 6); + doneflag = DRLG_L2PlaceMiniSet(WARPSTAIRS, 1, 1, -1, -1, TRUE, 6); } } ViewY -= 2; diff --git a/Source/drlg_l3.cpp b/Source/drlg_l3.cpp index 8804c5141..1f33dbc0f 100644 --- a/Source/drlg_l3.cpp +++ b/Source/drlg_l3.cpp @@ -1947,29 +1947,29 @@ static void DRLG_L3(int entry) } while (!found); DRLG_L3MakeMegas(); if (entry == 0) { - genok = DRLG_L3PlaceMiniSet(L3UP, 1, 1, -1, -1, 1, 0); + genok = DRLG_L3PlaceMiniSet(L3UP, 1, 1, -1, -1, TRUE, 0); if (!genok) { - genok = DRLG_L3PlaceMiniSet(L3DOWN, 1, 1, -1, -1, 0, 1); + genok = DRLG_L3PlaceMiniSet(L3DOWN, 1, 1, -1, -1, FALSE, 1); if (!genok && currlevel == 9) { - genok = DRLG_L3PlaceMiniSet(L3HOLDWARP, 1, 1, -1, -1, 0, 6); + genok = DRLG_L3PlaceMiniSet(L3HOLDWARP, 1, 1, -1, -1, FALSE, 6); } } } else if (entry == 1) { - genok = DRLG_L3PlaceMiniSet(L3UP, 1, 1, -1, -1, 0, 0); + genok = DRLG_L3PlaceMiniSet(L3UP, 1, 1, -1, -1, FALSE, 0); if (!genok) { - genok = DRLG_L3PlaceMiniSet(L3DOWN, 1, 1, -1, -1, 1, 1); + genok = DRLG_L3PlaceMiniSet(L3DOWN, 1, 1, -1, -1, TRUE, 1); ViewX += 2; ViewY -= 2; if (!genok && currlevel == 9) { - genok = DRLG_L3PlaceMiniSet(L3HOLDWARP, 1, 1, -1, -1, 0, 6); + genok = DRLG_L3PlaceMiniSet(L3HOLDWARP, 1, 1, -1, -1, FALSE, 6); } } } else { - genok = DRLG_L3PlaceMiniSet(L3UP, 1, 1, -1, -1, 0, 0); + genok = DRLG_L3PlaceMiniSet(L3UP, 1, 1, -1, -1, FALSE, 0); if (!genok) { - genok = DRLG_L3PlaceMiniSet(L3DOWN, 1, 1, -1, -1, 0, 1); + genok = DRLG_L3PlaceMiniSet(L3DOWN, 1, 1, -1, -1, FALSE, 1); if (!genok && currlevel == 9) { - genok = DRLG_L3PlaceMiniSet(L3HOLDWARP, 1, 1, -1, -1, 1, 6); + genok = DRLG_L3PlaceMiniSet(L3HOLDWARP, 1, 1, -1, -1, TRUE, 6); } } } diff --git a/Source/drlg_l4.cpp b/Source/drlg_l4.cpp index f9d3bf323..b3632c7ca 100644 --- a/Source/drlg_l4.cpp +++ b/Source/drlg_l4.cpp @@ -1616,72 +1616,72 @@ static void DRLG_L4(int entry) } if (QuestStatus(Q_WARLORD)) { if (entry == 0) { - doneflag = DRLG_L4PlaceMiniSet(L4USTAIRS, 1, 1, -1, -1, 1, 0); + doneflag = DRLG_L4PlaceMiniSet(L4USTAIRS, 1, 1, -1, -1, TRUE, 0); if (doneflag && currlevel == 13) { - doneflag = DRLG_L4PlaceMiniSet(L4TWARP, 1, 1, -1, -1, 0, 6); + doneflag = DRLG_L4PlaceMiniSet(L4TWARP, 1, 1, -1, -1, FALSE, 6); } ViewX++; } else if (entry == 1) { - doneflag = DRLG_L4PlaceMiniSet(L4USTAIRS, 1, 1, -1, -1, 0, 0); + doneflag = DRLG_L4PlaceMiniSet(L4USTAIRS, 1, 1, -1, -1, FALSE, 0); if (doneflag && currlevel == 13) { - doneflag = DRLG_L4PlaceMiniSet(L4TWARP, 1, 1, -1, -1, 0, 6); + doneflag = DRLG_L4PlaceMiniSet(L4TWARP, 1, 1, -1, -1, FALSE, 6); } ViewX = 2 * setpc_x + 22; ViewY = 2 * setpc_y + 22; } else { - doneflag = DRLG_L4PlaceMiniSet(L4USTAIRS, 1, 1, -1, -1, 0, 0); + doneflag = DRLG_L4PlaceMiniSet(L4USTAIRS, 1, 1, -1, -1, FALSE, 0); if (doneflag && currlevel == 13) { - doneflag = DRLG_L4PlaceMiniSet(L4TWARP, 1, 1, -1, -1, 1, 6); + doneflag = DRLG_L4PlaceMiniSet(L4TWARP, 1, 1, -1, -1, TRUE, 6); } ViewX++; } } else if (currlevel != 15) { if (entry == 0) { - doneflag = DRLG_L4PlaceMiniSet(L4USTAIRS, 1, 1, -1, -1, 1, 0); + doneflag = DRLG_L4PlaceMiniSet(L4USTAIRS, 1, 1, -1, -1, TRUE, 0); if (doneflag && currlevel != 16) { - doneflag = DRLG_L4PlaceMiniSet(L4DSTAIRS, 1, 1, -1, -1, 0, 1); + doneflag = DRLG_L4PlaceMiniSet(L4DSTAIRS, 1, 1, -1, -1, FALSE, 1); } if (doneflag && currlevel == 13) { - doneflag = DRLG_L4PlaceMiniSet(L4TWARP, 1, 1, -1, -1, 0, 6); + doneflag = DRLG_L4PlaceMiniSet(L4TWARP, 1, 1, -1, -1, FALSE, 6); } ViewX++; } else if (entry == 1) { - doneflag = DRLG_L4PlaceMiniSet(L4USTAIRS, 1, 1, -1, -1, 0, 0); + doneflag = DRLG_L4PlaceMiniSet(L4USTAIRS, 1, 1, -1, -1, FALSE, 0); if (doneflag && currlevel != 16) { - doneflag = DRLG_L4PlaceMiniSet(L4DSTAIRS, 1, 1, -1, -1, 1, 1); + doneflag = DRLG_L4PlaceMiniSet(L4DSTAIRS, 1, 1, -1, -1, TRUE, 1); } if (doneflag && currlevel == 13) { - doneflag = DRLG_L4PlaceMiniSet(L4TWARP, 1, 1, -1, -1, 0, 6); + doneflag = DRLG_L4PlaceMiniSet(L4TWARP, 1, 1, -1, -1, FALSE, 6); } ViewY++; } else { - doneflag = DRLG_L4PlaceMiniSet(L4USTAIRS, 1, 1, -1, -1, 0, 0); + doneflag = DRLG_L4PlaceMiniSet(L4USTAIRS, 1, 1, -1, -1, FALSE, 0); if (doneflag && currlevel != 16) { - doneflag = DRLG_L4PlaceMiniSet(L4DSTAIRS, 1, 1, -1, -1, 0, 1); + doneflag = DRLG_L4PlaceMiniSet(L4DSTAIRS, 1, 1, -1, -1, FALSE, 1); } if (doneflag && currlevel == 13) { - doneflag = DRLG_L4PlaceMiniSet(L4TWARP, 1, 1, -1, -1, 1, 6); + doneflag = DRLG_L4PlaceMiniSet(L4TWARP, 1, 1, -1, -1, TRUE, 6); } ViewX++; } } else { if (entry == 0) { - doneflag = DRLG_L4PlaceMiniSet(L4USTAIRS, 1, 1, -1, -1, 1, 0); + doneflag = DRLG_L4PlaceMiniSet(L4USTAIRS, 1, 1, -1, -1, TRUE, 0); if (doneflag) { if (gbMaxPlayers == 1 && quests[Q_DIABLO]._qactive != QUEST_ACTIVE) { - doneflag = DRLG_L4PlaceMiniSet(L4PENTA, 1, 1, -1, -1, 0, 1); + doneflag = DRLG_L4PlaceMiniSet(L4PENTA, 1, 1, -1, -1, FALSE, 1); } else { - doneflag = DRLG_L4PlaceMiniSet(L4PENTA2, 1, 1, -1, -1, 0, 1); + doneflag = DRLG_L4PlaceMiniSet(L4PENTA2, 1, 1, -1, -1, FALSE, 1); } } ViewX++; } else { - doneflag = DRLG_L4PlaceMiniSet(L4USTAIRS, 1, 1, -1, -1, 0, 0); + doneflag = DRLG_L4PlaceMiniSet(L4USTAIRS, 1, 1, -1, -1, FALSE, 0); if (doneflag) { if (gbMaxPlayers == 1 && quests[Q_DIABLO]._qactive != QUEST_ACTIVE) { - doneflag = DRLG_L4PlaceMiniSet(L4PENTA, 1, 1, -1, -1, 1, 1); + doneflag = DRLG_L4PlaceMiniSet(L4PENTA, 1, 1, -1, -1, TRUE, 1); } else { - doneflag = DRLG_L4PlaceMiniSet(L4PENTA2, 1, 1, -1, -1, 1, 1); + doneflag = DRLG_L4PlaceMiniSet(L4PENTA2, 1, 1, -1, -1, TRUE, 1); } } ViewY++; diff --git a/Source/inv.cpp b/Source/inv.cpp index 4d44ff87b..3aead181e 100644 --- a/Source/inv.cpp +++ b/Source/inv.cpp @@ -688,7 +688,7 @@ void CheckInvPaste(int pnum, int mx, int my) sx = icursW28; sy = icursH28; done = FALSE; - for (r = 0; r < sizeof(InvRect) / sizeof(InvRect[0]) && !done; r++) { + for (r = 0; (DWORD)r < NUM_XY_SLOTS && !done; r++) { if (i >= InvRect[r].X && i < InvRect[r].X + INV_SLOT_SIZE_PX) { if (j >= InvRect[r].Y - INV_SLOT_SIZE_PX - 1 && j < InvRect[r].Y) { done = TRUE; @@ -1740,7 +1740,7 @@ BOOL TryInvPut() { int dir; - if (numitems >= 127) + if (numitems >= MAXITEMS) return FALSE; dir = GetDirection(plr[myplr]._px, plr[myplr]._py, cursmx, cursmy); @@ -1780,7 +1780,7 @@ int InvPutItem(int pnum, int x, int y) int xx, yy; int xp, yp; - if (numitems >= 127) + if (numitems >= MAXITEMS) return -1; if (FindGetItem(plr[pnum].HoldItem.IDidx, plr[pnum].HoldItem._iCreateInfo, plr[pnum].HoldItem._iSeed) != -1) { @@ -1849,7 +1849,7 @@ int SyncPutItem(int pnum, int x, int y, int idx, WORD icreateinfo, int iseed, in int xx, yy; int xp, yp; - if (numitems >= 127) + if (numitems >= MAXITEMS) return -1; if (FindGetItem(idx, icreateinfo, iseed) != -1) { @@ -1926,7 +1926,7 @@ char CheckInvHLight() PlayerStruct *p; char rv; - for (r = 0; (DWORD)r < 73; r++) { + for (r = 0; (DWORD)r < NUM_XY_SLOTS; r++) { if (MouseX >= InvRect[r].X && MouseX < InvRect[r].X + 29 && MouseY >= InvRect[r].Y - 29 @@ -1935,7 +1935,7 @@ char CheckInvHLight() } } - if ((DWORD)r >= 73) + if ((DWORD)r >= NUM_XY_SLOTS) return -1; rv = -1; diff --git a/Source/monster.cpp b/Source/monster.cpp index c7463a763..c6922b706 100644 --- a/Source/monster.cpp +++ b/Source/monster.cpp @@ -4542,7 +4542,7 @@ void ProcessMonsters() Monst->_menemyx = plr[Monst->_menemy]._pfutx; Monst->_menemyy = plr[Monst->_menemy]._pfuty; if (dFlags[mx][my] & BFLAG_VISIBLE) { - Monst->_msquelch = 255; + Monst->_msquelch = UCHAR_MAX; Monst->_lastx = plr[Monst->_menemy]._pfutx; Monst->_lasty = plr[Monst->_menemy]._pfuty; } else if (Monst->_msquelch != 0 && Monst->_mAi != MT_DIABLO) { /// BUGFIX: change '_mAi' to 'MType->mtype' diff --git a/Source/plrmsg.cpp b/Source/plrmsg.cpp index 83d3a73d3..e0a4f137a 100644 --- a/Source/plrmsg.cpp +++ b/Source/plrmsg.cpp @@ -95,11 +95,11 @@ void DrawPlrMsg() _plrmsg *pMsg; if (chrflag || questlog) { - x = 330 + SCREEN_X; - width -= 300; + x += SPANEL_WIDTH; + width -= SPANEL_WIDTH; } if (invflag || sbookflag) - width -= 300; + width -= SPANEL_WIDTH; if (width < 300) return;