diff --git a/Source/automap.cpp b/Source/automap.cpp index f8594724..ab5fd987 100644 --- a/Source/automap.cpp +++ b/Source/automap.cpp @@ -285,8 +285,8 @@ void SearchAutomapItem(const CelOutputBuffer &out) int px = i - 2 * AutoMapXOfs - ViewX; int py = j - 2 * AutoMapYOfs - ViewY; - x = (ScrollInfo._sxoff * AutoMapScale / 100 >> 1) + (px - py) * AmLine16 + gnScreenWidth / 2; - y = (ScrollInfo._syoff * AutoMapScale / 100 >> 1) + (px + py) * AmLine8 + (gnScreenHeight - PANEL_HEIGHT) / 2; + x = (ScrollInfo._sxoff * AutoMapScale / 100 / 2) + (px - py) * AmLine16 + gnScreenWidth / 2; + y = (ScrollInfo._syoff * AutoMapScale / 100 / 2) + (px + py) * AmLine8 + (gnScreenHeight - PANEL_HEIGHT) / 2; if (PANELS_COVER) { if (invflag || sbookflag) @@ -325,8 +325,8 @@ void DrawAutomapPlr(const CelOutputBuffer &out, int pnum) int px = x - 2 * AutoMapXOfs - ViewX; int py = y - 2 * AutoMapYOfs - ViewY; - x = (plr[pnum]._pxoff * AutoMapScale / 100 >> 1) + (ScrollInfo._sxoff * AutoMapScale / 100 >> 1) + (px - py) * AmLine16 + gnScreenWidth / 2; - y = (plr[pnum]._pyoff * AutoMapScale / 100 >> 1) + (ScrollInfo._syoff * AutoMapScale / 100 >> 1) + (px + py) * AmLine8 + (gnScreenHeight - PANEL_HEIGHT) / 2; + x = (plr[pnum]._pxoff * AutoMapScale / 100 / 2) + (ScrollInfo._sxoff * AutoMapScale / 100 / 2) + (px - py) * AmLine16 + gnScreenWidth / 2; + y = (plr[pnum]._pyoff * AutoMapScale / 100 / 2) + (ScrollInfo._syoff * AutoMapScale / 100 / 2) + (px + py) * AmLine8 + (gnScreenHeight - PANEL_HEIGHT) / 2; if (PANELS_COVER) { if (invflag || sbookflag) @@ -562,11 +562,11 @@ void AutomapZoomIn() { if (AutoMapScale < 200) { AutoMapScale += 5; - AmLine64 = (AutoMapScale << 6) / 100; - AmLine32 = AmLine64 >> 1; - AmLine16 = AmLine32 >> 1; - AmLine8 = AmLine16 >> 1; - AmLine4 = AmLine8 >> 1; + AmLine64 = (AutoMapScale * 64) / 100; + AmLine32 = AmLine64 / 2; + AmLine16 = AmLine32 / 2; + AmLine8 = AmLine16 / 2; + AmLine4 = AmLine8 / 2; } } @@ -574,11 +574,11 @@ void AutomapZoomOut() { if (AutoMapScale > 50) { AutoMapScale -= 5; - AmLine64 = (AutoMapScale << 6) / 100; - AmLine32 = AmLine64 >> 1; - AmLine16 = AmLine32 >> 1; - AmLine8 = AmLine16 >> 1; - AmLine4 = AmLine8 >> 1; + AmLine64 = (AutoMapScale * 64) / 100; + AmLine32 = AmLine64 / 2; + AmLine16 = AmLine32 / 2; + AmLine8 = AmLine16 / 2; + AmLine4 = AmLine8 / 2; } } @@ -592,25 +592,25 @@ void DrawAutomap(const CelOutputBuffer &out) return; } - AutoMapX = (ViewX - 16) >> 1; + AutoMapX = (ViewX - 16) / 2; while (AutoMapX + AutoMapXOfs < 0) AutoMapXOfs++; while (AutoMapX + AutoMapXOfs >= DMAXX) AutoMapXOfs--; AutoMapX += AutoMapXOfs; - AutoMapY = (ViewY - 16) >> 1; + AutoMapY = (ViewY - 16) / 2; while (AutoMapY + AutoMapYOfs < 0) AutoMapYOfs++; while (AutoMapY + AutoMapYOfs >= DMAXY) AutoMapYOfs--; AutoMapY += AutoMapYOfs; - int d = (AutoMapScale << 6) / 100; + int d = (AutoMapScale * 64) / 100; int cells = 2 * (gnScreenWidth / 2 / d) + 1; if (((gnScreenWidth / 2) % d) != 0) cells++; - if ((gnScreenWidth / 2) % d >= (AutoMapScale << 5) / 100) + if ((gnScreenWidth / 2) % d >= (AutoMapScale * 32) / 100) cells++; if ((ScrollInfo._sxoff + ScrollInfo._syoff) != 0) @@ -619,11 +619,11 @@ void DrawAutomap(const CelOutputBuffer &out) int mapy = AutoMapY - 1; if ((cells & 1) != 0) { - sx = gnScreenWidth / 2 - AmLine64 * ((cells - 1) >> 1); - sy = (gnScreenHeight - PANEL_HEIGHT) / 2 - AmLine32 * ((cells + 1) >> 1); + sx = gnScreenWidth / 2 - AmLine64 * ((cells - 1) / 2); + sy = (gnScreenHeight - PANEL_HEIGHT) / 2 - AmLine32 * ((cells + 1) / 2); } else { - sx = gnScreenWidth / 2 - AmLine64 * (cells >> 1) + AmLine32; - sy = (gnScreenHeight - PANEL_HEIGHT) / 2 - AmLine32 * (cells >> 1) - AmLine16; + sx = gnScreenWidth / 2 - AmLine64 * (cells / 2) + AmLine32; + sy = (gnScreenHeight - PANEL_HEIGHT) / 2 - AmLine32 * (cells / 2) - AmLine16; } if ((ViewX & 1) != 0) { sx -= AmLine16; @@ -634,8 +634,8 @@ void DrawAutomap(const CelOutputBuffer &out) sy -= AmLine8; } - sx += AutoMapScale * ScrollInfo._sxoff / 100 >> 1; - sy += AutoMapScale * ScrollInfo._syoff / 100 >> 1; + sx += AutoMapScale * ScrollInfo._sxoff / 100 / 2; + sy += AutoMapScale * ScrollInfo._syoff / 100 / 2; if (PANELS_COVER) { if (invflag || sbookflag) { sx -= gnScreenWidth / 4; @@ -680,8 +680,8 @@ void DrawAutomap(const CelOutputBuffer &out) void SetAutomapView(int x, int y) { - int xx = (x - 16) >> 1; - int yy = (y - 16) >> 1; + int xx = (x - 16) / 2; + int yy = (y - 16) / 2; if (xx < 0 || xx >= DMAXX || yy < 0 || yy >= DMAXY) { return; @@ -751,11 +751,11 @@ void AutomapZoomReset() { AutoMapXOfs = 0; AutoMapYOfs = 0; - AmLine64 = (AutoMapScale << 6) / 100; - AmLine32 = AmLine64 >> 1; - AmLine16 = AmLine32 >> 1; - AmLine8 = AmLine16 >> 1; - AmLine4 = AmLine8 >> 1; + AmLine64 = (AutoMapScale * 64) / 100; + AmLine32 = AmLine64 / 2; + AmLine16 = AmLine32 / 2; + AmLine8 = AmLine16 / 2; + AmLine4 = AmLine8 / 2; } } // namespace devilution diff --git a/Source/control.cpp b/Source/control.cpp index 81dcd91c..e1c9cea9 100644 --- a/Source/control.cpp +++ b/Source/control.cpp @@ -1210,7 +1210,7 @@ static void CPrintString(const CelOutputBuffer &out, int y, const char *str, boo strWidth += fontkern[fontframe[c]] + 2; } if (strWidth < 288) - lineOffset = (288 - strWidth) >> 1; + lineOffset = (288 - strWidth) / 2; sx += lineOffset; } while (*str != '\0') { @@ -1340,7 +1340,7 @@ static void MY_PlrStringXY(const CelOutputBuffer &out, int x, int y, int endX, c screenX += fontkern[fontframe[c]] + base; } if (screenX < widthOffset) - line = (widthOffset - screenX) >> 1; + line = (widthOffset - screenX) / 2; x += line; while (*pszStr != 0) { BYTE c = gbFontTransTbl[(BYTE)*pszStr++]; @@ -1395,7 +1395,7 @@ void DrawChr(const CelOutputBuffer &out) col = COL_BLUE; if (plr[myplr]._pIBonusToHit < 0) col = COL_RED; - sprintf(chrstr, "%i%%", (plr[myplr]._pDexterity >> 1) + plr[myplr]._pIBonusToHit + 50); + sprintf(chrstr, "%i%%", (plr[myplr]._pDexterity / 2) + plr[myplr]._pIBonusToHit + 50); ADD_PlrStringXY(out, 258, 211, 301, chrstr, col); col = COL_WHITE; @@ -1410,7 +1410,7 @@ void DrawChr(const CelOutputBuffer &out) if (plr[myplr]._pClass == HeroClass::Rogue) mindam += plr[myplr]._pDamageMod; else - mindam += plr[myplr]._pDamageMod >> 1; + mindam += plr[myplr]._pDamageMod / 2; } else { mindam += plr[myplr]._pDamageMod; } @@ -1421,7 +1421,7 @@ void DrawChr(const CelOutputBuffer &out) if (plr[myplr]._pClass == HeroClass::Rogue) maxdam += plr[myplr]._pDamageMod; else - maxdam += plr[myplr]._pDamageMod >> 1; + maxdam += plr[myplr]._pDamageMod / 2; } else { maxdam += plr[myplr]._pDamageMod; } @@ -1767,7 +1767,7 @@ static void PrintSBookStr(const CelOutputBuffer &out, int x, int y, bool cjustfl screenX += fontkern[fontframe[c]] + 1; } if (screenX < 222) - line = (222 - screenX) >> 1; + line = (222 - screenX) / 2; sx += line; } while (*pszStr != 0) { @@ -2025,7 +2025,7 @@ void DrawTalkPan(const CelOutputBuffer &out) DrawPanelBox(out, 175, sgbPlrTalkTbl + 20, 294, 5, PANEL_X + 175, PANEL_Y + 4); int off = 0; for (int i = 293; i > 283; off++, i--) { - DrawPanelBox(out, (off >> 1) + 175, sgbPlrTalkTbl + off + 25, i, 1, (off >> 1) + PANEL_X + 175, off + PANEL_Y + 9); + DrawPanelBox(out, (off / 2) + 175, sgbPlrTalkTbl + off + 25, i, 1, (off / 2) + PANEL_X + 175, off + PANEL_Y + 9); } DrawPanelBox(out, 185, sgbPlrTalkTbl + 35, 274, 30, PANEL_X + 185, PANEL_Y + 19); DrawPanelBox(out, 180, sgbPlrTalkTbl + 65, 284, 5, PANEL_X + 180, PANEL_Y + 49); diff --git a/Source/cursor.cpp b/Source/cursor.cpp index 055c4c60..bbb435bb 100644 --- a/Source/cursor.cpp +++ b/Source/cursor.cpp @@ -245,8 +245,8 @@ void CheckCursMove() } if (!zoomflag) { - sx >>= 1; - sy >>= 1; + sx /= 2; + sy /= 2; } // Adjust by player offset and tile grid alignment @@ -296,11 +296,11 @@ void CheckCursMove() py = sy % TILE_HEIGHT; // Shift position to match diamond grid aligment - flipy = py < (px >> 1); + flipy = py < (px / 2); if (flipy) { my--; } - flipx = py >= TILE_HEIGHT - (px >> 1); + flipx = py >= TILE_HEIGHT - (px / 2); if (flipx) { mx++; } diff --git a/Source/drlg_l1.cpp b/Source/drlg_l1.cpp index e7f25b8e..5b4d7123 100644 --- a/Source/drlg_l1.cpp +++ b/Source/drlg_l1.cpp @@ -1521,8 +1521,8 @@ static void L5makeDungeon() for (j = 0; j < DMAXY; j++) { for (i = 0; i < DMAXX; i++) { - j_2 = j << 1; - i_2 = i << 1; + j_2 = j * 2; + i_2 = i * 2; L5dungeon[i_2][j_2] = dungeon[i][j]; L5dungeon[i_2][j_2 + 1] = dungeon[i][j]; L5dungeon[i_2 + 1][j_2] = dungeon[i][j]; diff --git a/Source/drlg_l4.cpp b/Source/drlg_l4.cpp index 00840819..b9b71ef3 100644 --- a/Source/drlg_l4.cpp +++ b/Source/drlg_l4.cpp @@ -952,8 +952,8 @@ static void L4makeDungeon() for (j = 0; j < 20; j++) { for (i = 0; i < 20; i++) { - k = i << 1; - l = j << 1; + k = i * 2; + l = j * 2; L4dungeon[k][l] = dung[i][j]; L4dungeon[k][l + 1] = dung[i][j]; L4dungeon[k + 1][l] = dung[i][j]; @@ -962,8 +962,8 @@ static void L4makeDungeon() } for (j = 0; j < 20; j++) { for (i = 0; i < 20; i++) { - k = i << 1; - l = j << 1; + k = i * 2; + l = j * 2; L4dungeon[k][l + 40] = dung[i][19 - j]; L4dungeon[k][l + 41] = dung[i][19 - j]; L4dungeon[k + 1][l + 40] = dung[i][19 - j]; @@ -972,8 +972,8 @@ static void L4makeDungeon() } for (j = 0; j < 20; j++) { for (i = 0; i < 20; i++) { - k = i << 1; - l = j << 1; + k = i * 2; + l = j * 2; L4dungeon[k + 40][l] = dung[19 - i][j]; L4dungeon[k + 40][l + 1] = dung[19 - i][j]; L4dungeon[k + 41][l] = dung[19 - i][j]; @@ -982,8 +982,8 @@ static void L4makeDungeon() } for (j = 0; j < 20; j++) { for (i = 0; i < 20; i++) { - k = i << 1; - l = j << 1; + k = i * 2; + l = j * 2; L4dungeon[k + 40][l + 40] = dung[19 - i][19 - j]; L4dungeon[k + 40][l + 41] = dung[19 - i][19 - j]; L4dungeon[k + 41][l + 40] = dung[19 - i][19 - j]; @@ -1198,7 +1198,7 @@ static void L4firstRoom() h = 14; } - xmin = (20 - w) >> 1; + xmin = (20 - w) / 2; xmax = 19 - w; rndx = random_(0, xmax - xmin + 1) + xmin; if (rndx + w > 19) { @@ -1207,7 +1207,7 @@ static void L4firstRoom() } else { x = rndx; } - ymin = (20 - h) >> 1; + ymin = (20 - h) / 2; ymax = 19 - h; rndy = random_(0, ymax - ymin + 1) + ymin; if (rndy + h > 19) { diff --git a/Source/dvlnet/zerotier_lwip.cpp b/Source/dvlnet/zerotier_lwip.cpp index a4a5633a..f110af21 100644 --- a/Source/dvlnet/zerotier_lwip.cpp +++ b/Source/dvlnet/zerotier_lwip.cpp @@ -20,7 +20,7 @@ namespace devilution::net { void print_ip6_addr(void *x) { char ipstr[INET6_ADDRSTRLEN]; - auto *in = static_cast(x); + auto *in = static_cast(x); lwip_inet_ntop(AF_INET6, &(in->sin6_addr), ipstr, INET6_ADDRSTRLEN); SDL_Log("ZeroTier: ZTS_EVENT_ADDR_NEW_IP6, addr=%s\n", ipstr); } diff --git a/Source/engine.cpp b/Source/engine.cpp index 410f420e..d9056ba7 100644 --- a/Source/engine.cpp +++ b/Source/engine.cpp @@ -194,14 +194,14 @@ void CelBlitLightSafeTo(CelOutputBuffer out, int sx, int sy, BYTE *pRLEBytes, in src++; dst++; } - width >>= 1; + width /= 2; if (width & 1) { dst[0] = tbl[src[0]]; dst[1] = tbl[src[1]]; src += 2; dst += 2; } - width >>= 1; + width /= 2; for (; width; width--) { dst[0] = tbl[src[0]]; dst[1] = tbl[src[1]]; @@ -253,13 +253,13 @@ void CelBlitLightTransSafeTo(CelOutputBuffer out, int sx, int sy, BYTE *pRLEByte src++; dst++; L_EVEN: - width >>= 1; + width /= 2; if (width & 1) { dst[0] = tbl[src[0]]; src += 2; dst += 2; } - width >>= 1; + width /= 2; for (; width; width--) { dst[0] = tbl[src[0]]; dst[2] = tbl[src[2]]; @@ -275,13 +275,13 @@ void CelBlitLightTransSafeTo(CelOutputBuffer out, int sx, int sy, BYTE *pRLEByte src++; dst++; L_ODD: - width >>= 1; + width /= 2; if (width & 1) { dst[1] = tbl[src[1]]; src += 2; dst += 2; } - width >>= 1; + width /= 2; for (; width; width--) { dst[1] = tbl[src[1]]; dst[3] = tbl[src[3]]; @@ -336,14 +336,14 @@ static void CelBlitLightBlendedSafeTo(CelOutputBuffer out, int sx, int sy, BYTE src++; dst++; } - width >>= 1; + width /= 2; if (width & 1) { dst[0] = paletteTransparencyLookup[dst[0]][tbl[src[0]]]; dst[1] = paletteTransparencyLookup[dst[1]][tbl[src[1]]]; src += 2; dst += 2; } - width >>= 1; + width /= 2; for (; width; width--) { dst[0] = paletteTransparencyLookup[dst[0]][tbl[src[0]]]; dst[1] = paletteTransparencyLookup[dst[1]][tbl[src[1]]]; diff --git a/Source/error.cpp b/Source/error.cpp index 028858b8..4c7bcfb4 100644 --- a/Source/error.cpp +++ b/Source/error.cpp @@ -140,7 +140,7 @@ void DrawDiabloMsg(CelOutputBuffer out) } if (width < 442) { - sx += (442 - width) >> 1; + sx += (442 - width) / 2; } for (i = 0; i < len; i++) { diff --git a/Source/inv.cpp b/Source/inv.cpp index 675d5e41..f273b920 100644 --- a/Source/inv.cpp +++ b/Source/inv.cpp @@ -869,8 +869,8 @@ void CheckInvPaste(int pnum, int mx, int my) ItemStruct tempitem; SetICursor(plr[pnum].HoldItem._iCurs + CURSOR_FIRSTITEM); - i = mx + (icursW >> 1); - j = my + (icursH >> 1); + i = mx + (icursW / 2); + j = my + (icursH / 2); sx = icursW28; sy = icursH28; done = false; @@ -953,13 +953,13 @@ void CheckInvPaste(int pnum, int mx, int my) } } } else { - yy = 10 * ((ii / 10) - ((sy - 1) >> 1)); + yy = 10 * ((ii / 10) - ((sy - 1) / 2)); if (yy < 0) yy = 0; for (j = 0; j < sy && done; j++) { if (yy >= NUM_INV_GRID_ELEM) done = false; - xx = (ii % 10) - ((sx - 1) >> 1); + xx = (ii % 10) - ((sx - 1) / 2); if (xx < 0) xx = 0; for (i = 0; i < sx && done; i++) { @@ -1187,8 +1187,8 @@ void CheckInvPaste(int pnum, int mx, int my) // Calculate top-left position of item for InvGrid and then add item to InvGrid - yy = 10 * (ii / 10 - ((sy - 1) >> 1)); - xx = (ii % 10 - ((sx - 1) >> 1)); + yy = 10 * (ii / 10 - ((sy - 1) / 2)); + xx = (ii % 10 - ((sx - 1) / 2)); if (yy < 0) yy = 0; if (xx < 0) @@ -1238,7 +1238,7 @@ void CheckInvPaste(int pnum, int mx, int my) CalcPlrInv(pnum, true); if (pnum == myplr) { if (cn == CURSOR_HAND) - SetCursorPos(MouseX + (cursW >> 1), MouseY + (cursH >> 1)); + SetCursorPos(MouseX + (cursW / 2), MouseY + (cursH / 2)); NewCursor(cn); } } @@ -1483,7 +1483,7 @@ void CheckInvCut(int pnum, int mx, int my, bool automaticMove) holdItem._itype = ITYPE_NONE; } else { NewCursor(holdItem._iCurs + CURSOR_FIRSTITEM); - SetCursorPos(mx - (cursW >> 1), MouseY - (cursH >> 1)); + SetCursorPos(mx - (cursW / 2), MouseY - (cursH / 2)); } } } diff --git a/Source/items.cpp b/Source/items.cpp index 3b486609..d2aa04c5 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -641,7 +641,7 @@ void CalcPlrItemVals(int p, bool Loadgfx) } if (plr[p]._pClass == HeroClass::Monk) { - mind = std::max(mind, plr[p]._pLevel >> 1); + mind = std::max(mind, plr[p]._pLevel / 2); maxd = std::max(maxd, (int)plr[p]._pLevel); } } @@ -791,22 +791,22 @@ void CalcPlrItemVals(int p, bool Loadgfx) plr[p]._pLghtResist = lr; if (plr[p]._pClass == HeroClass::Warrior) { - vadd <<= 1; + vadd *= 2; } else if (plr[p]._pClass == HeroClass::Barbarian) { vadd += vadd; - vadd += (vadd >> 2); + vadd += (vadd / 4); } else if (plr[p]._pClass == HeroClass::Rogue || plr[p]._pClass == HeroClass::Monk || plr[p]._pClass == HeroClass::Bard) { - vadd += vadd >> 1; + vadd += vadd / 2; } ihp += (vadd << 6); // BUGFIX: blood boil can cause negative shifts here (see line 757) if (plr[p]._pClass == HeroClass::Sorcerer) { - madd <<= 1; + madd *= 2; } if (plr[p]._pClass == HeroClass::Rogue || plr[p]._pClass == HeroClass::Monk) { - madd += madd >> 1; + madd += madd / 2; } else if (plr[p]._pClass == HeroClass::Bard) { - madd += (madd >> 2) + (madd >> 1); + madd += (madd / 4) + (madd / 2); } imana += (madd << 6); @@ -898,18 +898,18 @@ void CalcPlrItemVals(int p, bool Loadgfx) if (plr[p].InvBody[INVLOC_CHEST]._itype == ITYPE_HARMOR && plr[p].InvBody[INVLOC_CHEST]._iStatFlag) { if (plr[p]._pClass == HeroClass::Monk && plr[p].InvBody[INVLOC_CHEST]._iMagical == ITEM_QUALITY_UNIQUE) - plr[p]._pIAC += plr[p]._pLevel >> 1; + plr[p]._pIAC += plr[p]._pLevel / 2; g += ANIM_ID_HEAVY_ARMOR; } else if (plr[p].InvBody[INVLOC_CHEST]._itype == ITYPE_MARMOR && plr[p].InvBody[INVLOC_CHEST]._iStatFlag) { if (plr[p]._pClass == HeroClass::Monk) { if (plr[p].InvBody[INVLOC_CHEST]._iMagical == ITEM_QUALITY_UNIQUE) - plr[p]._pIAC += plr[p]._pLevel << 1; + plr[p]._pIAC += plr[p]._pLevel * 2; else - plr[p]._pIAC += plr[p]._pLevel >> 1; + plr[p]._pIAC += plr[p]._pLevel / 2; } g += ANIM_ID_MEDIUM_ARMOR; } else if (plr[p]._pClass == HeroClass::Monk) { - plr[p]._pIAC += plr[p]._pLevel << 1; + plr[p]._pIAC += plr[p]._pLevel * 2; } if (plr[p]._pgfxnum != g && Loadgfx) { @@ -1608,10 +1608,10 @@ void GetStaffSpell(int i, int lvl, bool onlygood) char istr[68]; if (!gbIsHellfire && random_(17, 4) == 0) { - GetItemPower(i, lvl >> 1, lvl, PLT_STAFF, onlygood); + GetItemPower(i, lvl / 2, lvl, PLT_STAFF, onlygood); } else { int maxSpells = gbIsHellfire ? MAX_SPELLS : 37; - l = lvl >> 1; + l = lvl / 2; if (l == 0) l = 1; rv = random_(18, maxSpells) + 1; @@ -1735,7 +1735,7 @@ void GetItemAttrs(int i, int idata, int lvl) break; } if (leveltype == DTYPE_HELL) - rndv += rndv >> 3; + rndv += rndv / 8; if (rndv > GOLD_MAX_LIMIT) rndv = GOLD_MAX_LIMIT; @@ -2453,7 +2453,7 @@ int RndTypeItems(int itype, int imid, int lvl) okflag = true; if (AllItemsList[i].iRnd == IDROP_NEVER) okflag = false; - if (lvl << 1 < AllItemsList[i].iMinMLvl) + if (lvl * 2 < AllItemsList[i].iMinMLvl) okflag = false; if (AllItemsList[i].itype != itype) okflag = false; @@ -2557,7 +2557,7 @@ void SpawnUnique(_unique_items uid, int x, int y) void ItemRndDur(int ii) { if (items[ii]._iDurability && items[ii]._iDurability != DUR_INDESTRUCTIBLE) - items[ii]._iDurability = random_(0, items[ii]._iMaxDur >> 1) + (items[ii]._iMaxDur >> 2) + 1; + items[ii]._iDurability = random_(0, items[ii]._iMaxDur / 2) + (items[ii]._iMaxDur / 4) + 1; } void SetupAllItems(int ii, int idx, int iseed, int lvl, int uper, bool onlygood, bool recreate, bool pregen) @@ -2566,7 +2566,7 @@ void SetupAllItems(int ii, int idx, int iseed, int lvl, int uper, bool onlygood, items[ii]._iSeed = iseed; SetRndSeed(iseed); - GetItemAttrs(ii, idx, lvl >> 1); + GetItemAttrs(ii, idx, lvl / 2); items[ii]._iCreateInfo = lvl; if (pregen) @@ -2600,7 +2600,7 @@ void SetupAllItems(int ii, int idx, int iseed, int lvl, int uper, bool onlygood, if (iblvl != -1) { _unique_items uid = CheckUnique(ii, iblvl, uper, recreate); if (uid == UITEM_INVALID) { - GetItemBonus(ii, idx, iblvl >> 1, iblvl, onlygood, true); + GetItemBonus(ii, idx, iblvl / 2, iblvl, onlygood, true); } else { GetUniqueItem(ii, uid); } @@ -3090,7 +3090,7 @@ void ProcessItems() if (items[ii]._iSelFlag == 2 && items[ii]._iAnimFrame == 21) items[ii]._iAnimFrame = 11; } else { - if (items[ii]._iAnimFrame == items[ii]._iAnimLen >> 1) + if (items[ii]._iAnimFrame == items[ii]._iAnimLen / 2) PlaySfxLoc(ItemDropSnds[ItemCAnimTbl[items[ii]._iCurs]], items[ii]._ix, items[ii]._iy); if (items[ii]._iAnimFrame >= items[ii]._iAnimLen) { @@ -3843,7 +3843,7 @@ void PrintUString(CelOutputBuffer out, int x, int y, bool cjustflag, const char for (i = 0; i < len; i++) width += fontkern[fontframe[gbFontTransTbl[(BYTE)str[i]]]] + 1; if (width < 257) - k = (257 - width) >> 1; + k = (257 - width) / 2; sx += k; } @@ -4066,9 +4066,9 @@ void UseItem(int p, item_misc_id Mid, spell_id spl) j = plr[p]._pMaxHP >> 8; l = ((j >> 1) + random_(39, j)) << 6; if (plr[p]._pClass == HeroClass::Warrior || plr[p]._pClass == HeroClass::Barbarian) - l <<= 1; + l *= 2; if (plr[p]._pClass == HeroClass::Rogue || plr[p]._pClass == HeroClass::Monk || plr[p]._pClass == HeroClass::Bard) - l += l >> 1; + l += l / 2; plr[p]._pHitPoints += l; if (plr[p]._pHitPoints > plr[p]._pMaxHP) plr[p]._pHitPoints = plr[p]._pMaxHP; @@ -4086,9 +4086,9 @@ void UseItem(int p, item_misc_id Mid, spell_id spl) j = plr[p]._pMaxMana >> 8; l = ((j >> 1) + random_(40, j)) << 6; if (plr[p]._pClass == HeroClass::Sorcerer) - l <<= 1; + l *= 2; if (plr[p]._pClass == HeroClass::Rogue || plr[p]._pClass == HeroClass::Monk || plr[p]._pClass == HeroClass::Bard) - l += l >> 1; + l += l / 2; if (!(plr[p]._pIFlags & ISPL_NOMANA)) { plr[p]._pMana += l; if (plr[p]._pMana > plr[p]._pMaxMana) @@ -4130,11 +4130,11 @@ void UseItem(int p, item_misc_id Mid, spell_id spl) break; case IMISC_REJUV: j = plr[p]._pMaxHP >> 8; - l = ((j >> 1) + random_(39, j)) << 6; + l = ((j / 2) + random_(39, j)) << 6; if (plr[p]._pClass == HeroClass::Warrior || plr[p]._pClass == HeroClass::Barbarian) - l <<= 1; + l *= 2; if (plr[p]._pClass == HeroClass::Rogue) - l += l >> 1; + l += l / 2; plr[p]._pHitPoints += l; if (plr[p]._pHitPoints > plr[p]._pMaxHP) plr[p]._pHitPoints = plr[p]._pMaxHP; @@ -4143,11 +4143,11 @@ void UseItem(int p, item_misc_id Mid, spell_id spl) plr[p]._pHPBase = plr[p]._pMaxHPBase; drawhpflag = true; j = plr[p]._pMaxMana >> 8; - l = ((j >> 1) + random_(40, j)) << 6; + l = ((j / 2) + random_(40, j)) << 6; if (plr[p]._pClass == HeroClass::Sorcerer) - l <<= 1; + l *= 2; if (plr[p]._pClass == HeroClass::Rogue) - l += l >> 1; + l += l / 2; if (!(plr[p]._pIFlags & ISPL_NOMANA)) { plr[p]._pMana += l; if (plr[p]._pMana > plr[p]._pMaxMana) @@ -4484,9 +4484,9 @@ static void SpawnOnePremium(int i, int plvl, int myplr) memset(&items[0], 0, sizeof(*items)); items[0]._iSeed = AdvanceRndSeed(); SetRndSeed(items[0]._iSeed); - int itype = RndPremiumItem(plvl >> 2, plvl) - 1; + int itype = RndPremiumItem(plvl / 4, plvl) - 1; GetItemAttrs(0, itype, plvl); - GetItemBonus(0, itype, plvl >> 1, plvl, true, !gbIsHellfire); + GetItemBonus(0, itype, plvl / 2, plvl, true, !gbIsHellfire); if (!gbIsHellfire) { if (items[0]._iIvalue > 140000) { @@ -4747,7 +4747,7 @@ void SpawnWitch(int lvl) if (maxlvl == -1 && items[0]._iMiscId == IMISC_STAFF) maxlvl = 2 * lvl; if (maxlvl != -1) - GetItemBonus(0, idata, maxlvl >> 1, maxlvl, true, true); + GetItemBonus(0, idata, maxlvl / 2, maxlvl, true, true); } while (items[0]._iIvalue > maxValue); witchitem[i] = items[0]; witchitem[i]._iCreateInfo = lvl | CF_WITCH; @@ -4798,7 +4798,7 @@ void SpawnBoy(int lvl) dexterity *= 1.2; magic *= 1.2; - if (boylevel < (lvl >> 1) || boyitem.isEmpty()) { + if (boylevel < (lvl / 2) || boyitem.isEmpty()) { do { keepgoing = false; memset(&items[0], 0, sizeof(*items)); @@ -4894,7 +4894,7 @@ void SpawnBoy(int lvl) boyitem._iCreateInfo = lvl | CF_BOY; boyitem._iIdentified = true; boyitem._iStatFlag = StoreStatOk(&boyitem); - boylevel = lvl >> 1; + boylevel = lvl / 2; } } @@ -5037,9 +5037,9 @@ void RecreateSmithItem(int ii, int idx, int lvl, int iseed) void RecreatePremiumItem(int ii, int idx, int plvl, int iseed) { SetRndSeed(iseed); - int itype = RndPremiumItem(plvl >> 2, plvl) - 1; + int itype = RndPremiumItem(plvl / 4, plvl) - 1; GetItemAttrs(ii, itype, plvl); - GetItemBonus(ii, itype, plvl >> 1, plvl, true, !gbIsHellfire); + GetItemBonus(ii, itype, plvl / 2, plvl, true, !gbIsHellfire); items[ii]._iSeed = iseed; items[ii]._iCreateInfo = plvl | CF_SMITHPREMIUM; @@ -5076,7 +5076,7 @@ void RecreateWitchItem(int ii, int idx, int lvl, int iseed) if (iblvl == -1 && items[ii]._iMiscId == IMISC_STAFF) iblvl = 2 * lvl; if (iblvl != -1) - GetItemBonus(ii, itype, iblvl >> 1, iblvl, true, true); + GetItemBonus(ii, itype, iblvl / 2, iblvl, true, true); } items[ii]._iSeed = iseed; diff --git a/Source/missiles.cpp b/Source/missiles.cpp index d270fdcd..a48454c3 100644 --- a/Source/missiles.cpp +++ b/Source/missiles.cpp @@ -42,15 +42,15 @@ void GetDamageAmt(int i, int *mind, int *maxd) switch (i) { case SPL_FIREBOLT: - *mind = (plr[myplr]._pMagic >> 3) + sl + 1; - *maxd = (plr[myplr]._pMagic >> 3) + sl + 10; + *mind = (plr[myplr]._pMagic / 8) + sl + 1; + *maxd = (plr[myplr]._pMagic / 8) + sl + 10; break; case SPL_HEAL: /// BUGFIX: healing calculation is unused *mind = plr[myplr]._pLevel + sl + 1; if (plr[myplr]._pClass == HeroClass::Warrior || plr[myplr]._pClass == HeroClass::Monk || plr[myplr]._pClass == HeroClass::Barbarian) { - *mind <<= 1; + *mind *= 2; } else if (plr[myplr]._pClass == HeroClass::Rogue || plr[myplr]._pClass == HeroClass::Bard) { - *mind += *mind >> 1; + *mind += *mind / 2; } *maxd = 10; for (k = 0; k < plr[myplr]._pLevel; k++) { @@ -60,9 +60,9 @@ void GetDamageAmt(int i, int *mind, int *maxd) *maxd += 6; } if (plr[myplr]._pClass == HeroClass::Warrior || plr[myplr]._pClass == HeroClass::Monk || plr[myplr]._pClass == HeroClass::Barbarian) { - *maxd <<= 1; + *maxd *= 2; } else if (plr[myplr]._pClass == HeroClass::Rogue || plr[myplr]._pClass == HeroClass::Bard) { - *maxd += *maxd >> 1; + *maxd += *maxd / 2; } *mind = -1; *maxd = -1; @@ -75,9 +75,9 @@ void GetDamageAmt(int i, int *mind, int *maxd) case SPL_FLASH: *mind = plr[myplr]._pLevel; for (k = 0; k < sl; k++) { - *mind += *mind >> 3; + *mind += *mind / 8; } - *mind += *mind >> 1; + *mind += *mind / 2; *maxd = *mind * 2; break; case SPL_IDENTIFY: @@ -116,21 +116,21 @@ void GetDamageAmt(int i, int *mind, int *maxd) case SPL_RUNEFIRE: *mind = 2 * plr[myplr]._pLevel + 4; for (k = 0; k < sl; k++) { - *mind += *mind >> 3; + *mind += *mind / 8; } *maxd = 2 * plr[myplr]._pLevel + 40; for (k = 0; k < sl; k++) { - *maxd += *maxd >> 3; + *maxd += *maxd / 8; } break; case SPL_GUARDIAN: - *mind = (plr[myplr]._pLevel >> 1) + 1; + *mind = (plr[myplr]._pLevel / 2) + 1; for (k = 0; k < sl; k++) { - *mind += *mind >> 3; + *mind += *mind / 8; } - *maxd = (plr[myplr]._pLevel >> 1) + 10; + *maxd = (plr[myplr]._pLevel / 2) + 10; for (k = 0; k < sl; k++) { - *maxd += *maxd >> 3; + *maxd += *maxd / 8; } break; case SPL_CHAIN: @@ -145,21 +145,21 @@ void GetDamageAmt(int i, int *mind, int *maxd) case SPL_IMMOLAT: case SPL_RUNEIMMOLAT: case SPL_RUNENOVA: - *mind = (plr[myplr]._pLevel + 5) >> 1; + *mind = (plr[myplr]._pLevel + 5) / 2; for (k = 0; k < sl; k++) { - *mind += *mind >> 3; + *mind += *mind / 8; } *mind *= 5; - *maxd = (plr[myplr]._pLevel + 30) >> 1; + *maxd = (plr[myplr]._pLevel + 30) / 2; for (k = 0; k < sl; k++) { - *maxd += *maxd >> 3; + *maxd += *maxd / 8; } *maxd *= 5; break; case SPL_FLAME: *mind = 3; *maxd = plr[myplr]._pLevel + 4; - *maxd += *maxd >> 1; + *maxd += *maxd / 2; break; case SPL_GOLEM: *mind = 11; @@ -178,18 +178,18 @@ void GetDamageAmt(int i, int *mind, int *maxd) case SPL_ELEMENT: *mind = 2 * plr[myplr]._pLevel + 4; for (k = 0; k < sl; k++) { - *mind += *mind >> 3; + *mind += *mind / 8; } - /// BUGFIX: add here '*mind >>= 1;' + /// BUGFIX: add here '*mind /= 2;' *maxd = 2 * plr[myplr]._pLevel + 40; for (k = 0; k < sl; k++) { - *maxd += *maxd >> 3; + *maxd += *maxd / 8; } - /// BUGFIX: add here '*maxd >>= 1;' + /// BUGFIX: add here '*maxd /= 2;' break; case SPL_CBOLT: *mind = 1; - *maxd = (plr[myplr]._pMagic >> 2) + 1; + *maxd = (plr[myplr]._pMagic / 4) + 1; break; case SPL_HBOLT: *mind = plr[myplr]._pLevel + 9; @@ -198,10 +198,10 @@ void GetDamageAmt(int i, int *mind, int *maxd) case SPL_HEALOTHER: /// BUGFIX: healing calculation is unused *mind = plr[myplr]._pLevel + sl + 1; if (plr[myplr]._pClass == HeroClass::Warrior || plr[myplr]._pClass == HeroClass::Monk || plr[myplr]._pClass == HeroClass::Barbarian) { - *mind <<= 1; + *mind *= 2; } if (plr[myplr]._pClass == HeroClass::Rogue || plr[myplr]._pClass == HeroClass::Bard) { - *mind += *mind >> 1; + *mind += *mind / 2; } *maxd = 10; for (k = 0; k < plr[myplr]._pLevel; k++) { @@ -211,16 +211,16 @@ void GetDamageAmt(int i, int *mind, int *maxd) *maxd += 6; } if (plr[myplr]._pClass == HeroClass::Warrior || plr[myplr]._pClass == HeroClass::Monk || plr[myplr]._pClass == HeroClass::Barbarian) { - *maxd <<= 1; + *maxd *= 2; } if (plr[myplr]._pClass == HeroClass::Rogue || plr[myplr]._pClass == HeroClass::Bard) { - *maxd += *maxd >> 1; + *maxd += *maxd / 2; } *mind = -1; *maxd = -1; break; case SPL_FLARE: - *mind = (plr[myplr]._pMagic >> 1) + 3 * sl - (plr[myplr]._pMagic >> 3); + *mind = (plr[myplr]._pMagic / 2) + 3 * sl - (plr[myplr]._pMagic / 8); *maxd = *mind; break; } @@ -306,30 +306,30 @@ direction GetDirection8(int x1, int y1, int x2, int y2) int my = y2 - y1; if (mx >= 0) { if (my >= 0) { - if (5 * mx <= (my << 1)) // mx/my <= 0.4, approximation of tan(22.5) + if (5 * mx <= (my * 2)) // mx/my <= 0.4, approximation of tan(22.5) return DIR_SW; md = DIR_S; } else { my = -my; - if (5 * mx <= (my << 1)) + if (5 * mx <= (my * 2)) return DIR_NE; md = DIR_E; } - if (5 * my <= (mx << 1)) // my/mx <= 0.4 + if (5 * my <= (mx * 2)) // my/mx <= 0.4 md = DIR_SE; } else { mx = -mx; if (my >= 0) { - if (5 * mx <= (my << 1)) + if (5 * mx <= (my * 2)) return DIR_SW; md = DIR_W; } else { my = -my; - if (5 * mx <= (my << 1)) + if (5 * mx <= (my * 2)) return DIR_NE; md = DIR_N; } - if (5 * my <= (mx << 1)) + if (5 * my <= (mx * 2)) md = DIR_NW; } return md; @@ -362,22 +362,22 @@ int GetDirection16(int x1, int y1, int x2, int y2) my = y2 - y1; if (mx >= 0) { if (my >= 0) { - if (3 * mx <= (my << 1)) { // mx/my <= 2/3, approximation of tan(33.75) - if (5 * mx < my) // mx/my < 0.2, approximation of tan(11.25) - return 2; // DIR_SW; - return 1; // DIR_Sw; + if (3 * mx <= (my * 2)) { // mx/my <= 2/3, approximation of tan(33.75) + if (5 * mx < my) // mx/my < 0.2, approximation of tan(11.25) + return 2; // DIR_SW; + return 1; // DIR_Sw; } md = 0; // DIR_S; } else { my = -my; - if (3 * mx <= (my << 1)) { + if (3 * mx <= (my * 2)) { if (5 * mx < my) return 10; // DIR_NE; return 11; // DIR_nE; } md = 12; // DIR_E; } - if (3 * my <= (mx << 1)) { // my/mx <= 2/3 + if (3 * my <= (mx * 2)) { // my/mx <= 2/3 if (5 * my < mx) // my/mx < 0.2 return 14; // DIR_SE; return md == 0 ? 15 : 13; // DIR_S ? DIR_Se : DIR_sE; @@ -385,7 +385,7 @@ int GetDirection16(int x1, int y1, int x2, int y2) } else { mx = -mx; if (my >= 0) { - if (3 * mx <= (my << 1)) { + if (3 * mx <= (my * 2)) { if (5 * mx < my) return 2; // DIR_SW; return 3; // DIR_sW; @@ -393,14 +393,14 @@ int GetDirection16(int x1, int y1, int x2, int y2) md = 4; // DIR_W; } else { my = -my; - if (3 * mx <= (my << 1)) { + if (3 * mx <= (my * 2)) { if (5 * mx < my) return 10; // DIR_NE; return 9; // DIR_Ne; } md = 8; // DIR_N; } - if (3 * my <= (mx << 1)) { + if (3 * my <= (mx * 2)) { if (5 * my < mx) return 6; // DIR_NW; return md == 4 ? 5 : 7; // DIR_W ? DIR_nW : DIR_Nw; @@ -533,8 +533,8 @@ void MoveMissilePos(int i) if (PosOkMonst(missile[i]._misource, x, y)) { missile[i]._mix += dx; missile[i]._miy += dy; - missile[i]._mixoff += (dy << 5) - (dx << 5); - missile[i]._miyoff -= (dy << 4) + (dx << 4); + missile[i]._mixoff += (dy * 32) - (dx * 32); + missile[i]._miyoff -= (dy * 16) + (dx * 16); } } @@ -587,7 +587,7 @@ bool MonsterTrapHit(int m, int mindam, int maxdam, int dist, int t, bool shift) if (!shift) dam <<= 6; if (resist) - monster[m]._mhitpoints -= dam >> 2; + monster[m]._mhitpoints -= dam / 4; else monster[m]._mhitpoints -= dam; #ifdef _DEBUG @@ -659,7 +659,7 @@ bool MonsterMHit(int pnum, int m, int mindam, int maxdam, int dist, int t, bool hper += plr[pnum]._pIBonusToHit; hper += plr[pnum]._pLevel; hper -= monster[m].mArmorClass; - hper -= (dist * dist) >> 1; + hper -= (dist * dist) / 2; hper += plr[pnum]._pIEnAc; hper += 50; if (plr[pnum]._pClass == HeroClass::Rogue) @@ -667,7 +667,7 @@ bool MonsterMHit(int pnum, int m, int mindam, int maxdam, int dist, int t, bool if (plr[pnum]._pClass == HeroClass::Warrior || plr[pnum]._pClass == HeroClass::Bard) hper += 10; } else { - hper = plr[pnum]._pMagic - (monster[m].mLevel << 1) - dist + 50; + hper = plr[pnum]._pMagic - (monster[m].mLevel * 2) - dist + 50; if (plr[pnum]._pClass == HeroClass::Sorcerer) hper += 20; else if (plr[pnum]._pClass == HeroClass::Bard) @@ -700,7 +700,7 @@ bool MonsterMHit(int pnum, int m, int mindam, int maxdam, int dist, int t, bool if (plr[pnum]._pClass == HeroClass::Rogue) dam += plr[pnum]._pDamageMod; else - dam += (plr[pnum]._pDamageMod >> 1); + dam += (plr[pnum]._pDamageMod / 2); } if (!shift) dam <<= 6; @@ -773,13 +773,13 @@ bool PlayerMHit(int pnum, int m, int dist, int mind, int maxd, int mtype, bool s hper = monster[m].mHit + ((monster[m].mLevel - plr[pnum]._pLevel) * 2) + 30 - - (dist << 1) - tac; + - (dist * 2) - tac; } else { - hper = 100 - (tac >> 1) - (dist << 1); + hper = 100 - (tac / 2) - (dist * 2); } } else { if (m != -1) { - hper = +40 - (plr[pnum]._pLevel << 1) - (dist << 1) + (monster[m].mLevel << 1); + hper = +40 - (plr[pnum]._pLevel * 2) - (dist * 2) + (monster[m].mLevel * 2); } else { hper = 40; } @@ -841,13 +841,13 @@ bool PlayerMHit(int pnum, int m, int dist, int mind, int maxd, int mtype, bool s dam = (mind << 6) + random_(75, (maxd - mind + 1) << 6); if (m == -1) if (plr[pnum]._pIFlags & ISPL_ABSHALFTRAP) - dam >>= 1; - dam += (plr[pnum]._pIGetHit * 64); + dam /= 2; + dam += (plr[pnum]._pIGetHit << 6); } else { dam = mind + random_(75, maxd - mind + 1); if (m == -1) if (plr[pnum]._pIFlags & ISPL_ABSHALFTRAP) - dam >>= 1; + dam /= 2; dam += plr[pnum]._pIGetHit; } @@ -926,7 +926,7 @@ bool Plr2PlrMHit(int pnum, int p, int mindam, int maxdam, int dist, int mtype, b if (missiledata[mtype].mType == 0) { hit = plr[pnum]._pIBonusToHit + plr[pnum]._pLevel - - (dist * dist >> 1) + - (dist * dist / 2) - plr[p]._pDexterity / 5 - plr[p]._pIBonusAC - plr[p]._pIAC @@ -937,7 +937,7 @@ bool Plr2PlrMHit(int pnum, int p, int mindam, int maxdam, int dist, int mtype, b hit += 10; } else { hit = plr[pnum]._pMagic - - (plr[p]._pLevel << 1) + - (plr[p]._pLevel * 2) - dist + 50; if (plr[pnum]._pClass == HeroClass::Sorcerer) @@ -957,7 +957,7 @@ bool Plr2PlrMHit(int pnum, int p, int mindam, int maxdam, int dist, int mtype, b } if (shift) blkper = 100; - blk = plr[p]._pDexterity + plr[p]._pBaseToBlk + (plr[p]._pLevel << 1) - (plr[pnum]._pLevel << 1); + blk = plr[p]._pDexterity + plr[p]._pBaseToBlk + (plr[p]._pLevel * 2) - (plr[pnum]._pLevel * 2); if (blk < 0) { blk = 0; @@ -976,7 +976,7 @@ bool Plr2PlrMHit(int pnum, int p, int mindam, int maxdam, int dist, int mtype, b dam <<= 6; } if (missiledata[mtype].mType != 0) - dam >>= 1; + dam /= 2; if (resper > 0) { dam -= (dam * resper) / 100; if (pnum == myplr) @@ -1677,9 +1677,9 @@ void AddSpecArrow(Sint32 mi, Sint32 sx, Sint32 sy, Sint32 dx, Sint32 dy, Sint32 av = 0; if (mienemy == TARGET_MONSTERS) { if (plr[id]._pClass == HeroClass::Rogue) - av += (plr[id]._pLevel - 1) >> 2; + av += (plr[id]._pLevel - 1) / 4; else if (plr[id]._pClass == HeroClass::Warrior || plr[id]._pClass == HeroClass::Bard) - av += (plr[id]._pLevel - 1) >> 3; + av += (plr[id]._pLevel - 1) / 8; if (plr[id]._pIFlags & ISPL_QUICKATTACK) av++; @@ -1759,7 +1759,7 @@ void AddRuneExplosion(Sint32 mi, Sint32 sx, Sint32 sy, Sint32 dx, Sint32 dy, Sin if (mienemy == TARGET_MONSTERS || mienemy == TARGET_BOTH) { missile[mi]._midam = 2 * (plr[id]._pLevel + random_(60, 10) + random_(60, 10)) + 4; for (i = missile[mi]._mispllvl; i > 0; i--) { - missile[mi]._midam += missile[mi]._midam >> 3; + missile[mi]._midam += missile[mi]._midam / 8; } dmg = missile[mi]._midam; @@ -1790,7 +1790,7 @@ void AddImmolation(Sint32 mi, Sint32 sx, Sint32 sy, Sint32 dx, Sint32 dy, Sint32 if (mienemy == TARGET_MONSTERS) { missile[mi]._midam = 2 * (plr[id]._pLevel + random_(60, 10) + random_(60, 10)) + 4; for (i = missile[mi]._mispllvl; i > 0; i--) { - missile[mi]._midam += missile[mi]._midam >> 3; + missile[mi]._midam += missile[mi]._midam / 8; } i = 2 * missile[mi]._mispllvl + 16; if (i > 50) @@ -1885,9 +1885,9 @@ void AddMana(Sint32 mi, Sint32 sx, Sint32 sy, Sint32 dx, Sint32 dy, Sint32 midir ManaAmount += (random_(57, 6) + 1) << 6; } if (plr[id]._pClass == HeroClass::Sorcerer) - ManaAmount <<= 1; + ManaAmount *= 2; if (plr[id]._pClass == HeroClass::Rogue || plr[id]._pClass == HeroClass::Bard) - ManaAmount += ManaAmount >> 1; + ManaAmount += ManaAmount / 2; plr[id]._pMana += ManaAmount; if (plr[id]._pMana > plr[id]._pMaxMana) plr[id]._pMana = plr[id]._pMaxMana; @@ -2024,9 +2024,9 @@ void AddLArrow(Sint32 mi, Sint32 sx, Sint32 sy, Sint32 dx, Sint32 dy, Sint32 mid int av = 32; if (plr[id]._pClass == HeroClass::Rogue) - av += (plr[id]._pLevel) >> 2; + av += (plr[id]._pLevel) / 4; else if (plr[id]._pClass == HeroClass::Warrior || plr[id]._pClass == HeroClass::Bard) - av += (plr[id]._pLevel) >> 3; + av += (plr[id]._pLevel) / 8; if (gbIsHellfire) { if (plr[id]._pIFlags & ISPL_QUICKATTACK) @@ -2067,9 +2067,9 @@ void AddArrow(Sint32 mi, Sint32 sx, Sint32 sy, Sint32 dx, Sint32 dy, Sint32 midi av = random_(64, 32) + 16; } if (plr[id]._pClass == HeroClass::Rogue) - av += (plr[id]._pLevel - 1) >> 2; + av += (plr[id]._pLevel - 1) / 4; else if (plr[id]._pClass == HeroClass::Warrior || plr[id]._pClass == HeroClass::Bard) - av += (plr[id]._pLevel - 1) >> 3; + av += (plr[id]._pLevel - 1) / 8; if (gbIsHellfire) { if (plr[id]._pIFlags & ISPL_QUICKATTACK) av++; @@ -2274,8 +2274,8 @@ void AddFirewall(Sint32 mi, Sint32 sx, Sint32 sy, Sint32 dx, Sint32 dy, Sint32 m if (mienemy == TARGET_PLAYERS || id < 0) missile[mi]._mirange += currlevel; else - missile[mi]._mirange += (plr[id]._pISplDur * missile[mi]._mirange) >> 7; - missile[mi]._mirange <<= 4; + missile[mi]._mirange += (plr[id]._pISplDur * missile[mi]._mirange) / 128; + missile[mi]._mirange *= 16; missile[mi]._miVar1 = missile[mi]._mirange - missile[mi]._miAnimLen; missile[mi]._miVar2 = 0; } @@ -2291,7 +2291,7 @@ void AddFireball(Sint32 mi, Sint32 sx, Sint32 sy, Sint32 dx, Sint32 dy, Sint32 m if (mienemy == TARGET_MONSTERS) { missile[mi]._midam = 2 * (plr[id]._pLevel + random_(60, 10) + random_(60, 10)) + 4; for (i = missile[mi]._mispllvl; i > 0; i--) { - missile[mi]._midam += missile[mi]._midam >> 3; + missile[mi]._midam += missile[mi]._midam / 8; } i = 2 * missile[mi]._mispllvl + 16; if (i > 50) @@ -2340,7 +2340,7 @@ void AddLightning(Sint32 mi, Sint32 sx, Sint32 sy, Sint32 dx, Sint32 dy, Sint32 else missile[mi]._mirange = 10; } else { - missile[mi]._mirange = (missile[mi]._mispllvl >> 1) + 6; + missile[mi]._mirange = (missile[mi]._mispllvl / 2) + 6; } missile[mi]._mlid = AddLight(missile[mi]._mix, missile[mi]._miy, 4); } @@ -2475,15 +2475,15 @@ void AddFlash(Sint32 mi, Sint32 sx, Sint32 sy, Sint32 dx, Sint32 dy, Sint32 midi missile[mi]._midam += random_(55, 20) + 1; } for (i = missile[mi]._mispllvl; i > 0; i--) { - missile[mi]._midam += missile[mi]._midam >> 3; + missile[mi]._midam += missile[mi]._midam / 8; } - missile[mi]._midam += missile[mi]._midam >> 1; + missile[mi]._midam += missile[mi]._midam / 2; UseMana(id, SPL_FLASH); } else { - missile[mi]._midam = monster[id].mLevel << 1; + missile[mi]._midam = monster[id].mLevel * 2; } } else { - missile[mi]._midam = currlevel >> 1; + missile[mi]._midam = currlevel / 2; } missile[mi]._mirange = 19; } @@ -2499,11 +2499,11 @@ void AddFlash2(Sint32 mi, Sint32 sx, Sint32 sy, Sint32 dx, Sint32 dy, Sint32 mid missile[mi]._midam += random_(56, 20) + 1; } for (i = missile[mi]._mispllvl; i > 0; i--) { - missile[mi]._midam += missile[mi]._midam >> 3; + missile[mi]._midam += missile[mi]._midam / 8; } - missile[mi]._midam += missile[mi]._midam >> 1; + missile[mi]._midam += missile[mi]._midam / 2; } else { - missile[mi]._midam = currlevel >> 1; + missile[mi]._midam = currlevel / 2; } } missile[mi]._miPreFlag = true; @@ -2536,9 +2536,9 @@ void AddGuardian(Sint32 mi, Sint32 sx, Sint32 sy, Sint32 dx, Sint32 dy, Sint32 m { int i, pn, k, j, tx, ty; - missile[mi]._midam = random_(62, 10) + (plr[id]._pLevel >> 1) + 1; + missile[mi]._midam = random_(62, 10) + (plr[id]._pLevel / 2) + 1; for (i = missile[mi]._mispllvl; i > 0; i--) { - missile[mi]._midam += missile[mi]._midam >> 3; + missile[mi]._midam += missile[mi]._midam / 8; } missile[mi]._miDelFlag = true; @@ -2570,8 +2570,8 @@ void AddGuardian(Sint32 mi, Sint32 sx, Sint32 sy, Sint32 dx, Sint32 dy, Sint32 m if (!missile[mi]._miDelFlag) { missile[mi]._misource = id; missile[mi]._mlid = AddLight(missile[mi]._mix, missile[mi]._miy, 1); - missile[mi]._mirange = missile[mi]._mispllvl + (plr[id]._pLevel >> 1); - missile[mi]._mirange += (missile[mi]._mirange * plr[id]._pISplDur) >> 7; + missile[mi]._mirange = missile[mi]._mispllvl + (plr[id]._pLevel / 2); + missile[mi]._mirange += (missile[mi]._mirange * plr[id]._pISplDur) / 128; if (missile[mi]._mirange > 30) missile[mi]._mirange = 30; @@ -2789,7 +2789,7 @@ void AddStone(Sint32 mi, Sint32 sx, Sint32 sy, Sint32 dx, Sint32 dy, Sint32 midi missile[mi]._misx = missile[mi]._mix; missile[mi]._misy = missile[mi]._miy; missile[mi]._mirange = missile[mi]._mispllvl + 6; - missile[mi]._mirange += (missile[mi]._mirange * plr[id]._pISplDur) >> 7; + missile[mi]._mirange += (missile[mi]._mirange * plr[id]._pISplDur) / 128; if (missile[mi]._mirange > 15) missile[mi]._mirange = 15; @@ -2826,11 +2826,11 @@ void AddEtherealize(Sint32 mi, Sint32 sx, Sint32 sy, Sint32 dx, Sint32 dy, Sint3 { int i; - missile[mi]._mirange = 16 * plr[id]._pLevel >> 1; + missile[mi]._mirange = 16 * plr[id]._pLevel / 2; for (i = missile[mi]._mispllvl; i > 0; i--) { - missile[mi]._mirange += missile[mi]._mirange >> 3; + missile[mi]._mirange += missile[mi]._mirange / 8; } - missile[mi]._mirange += missile[mi]._mirange * plr[id]._pISplDur >> 7; + missile[mi]._mirange += missile[mi]._mirange * plr[id]._pISplDur / 128; missile[mi]._miVar1 = plr[id]._pHitPoints; missile[mi]._miVar2 = plr[id]._pHPBase; if (mienemy == TARGET_MONSTERS) @@ -2885,9 +2885,9 @@ void AddHeal(Sint32 mi, Sint32 sx, Sint32 sy, Sint32 dx, Sint32 dy, Sint32 midir } if (plr[id]._pClass == HeroClass::Warrior || plr[id]._pClass == HeroClass::Barbarian || plr[id]._pClass == HeroClass::Monk) - HealAmount <<= 1; + HealAmount *= 2; else if (plr[id]._pClass == HeroClass::Rogue || plr[id]._pClass == HeroClass::Bard) - HealAmount += HealAmount >> 1; + HealAmount += HealAmount / 2; plr[id]._pHitPoints += HealAmount; if (plr[id]._pHitPoints > plr[id]._pMaxHP) @@ -2923,9 +2923,9 @@ void AddElement(Sint32 mi, Sint32 sx, Sint32 sy, Sint32 dx, Sint32 dy, Sint32 mi } missile[mi]._midam = 2 * (plr[id]._pLevel + random_(60, 10) + random_(60, 10)) + 4; for (i = missile[mi]._mispllvl; i > 0; i--) { - missile[mi]._midam += missile[mi]._midam >> 3; + missile[mi]._midam += missile[mi]._midam / 8; } - missile[mi]._midam >>= 1; + missile[mi]._midam /= 2; GetMissileVel(mi, sx, sy, dx, dy, 16); SetMissDir(mi, GetDirection8(sx, sy, dx, dy)); missile[mi]._mirange = 256; @@ -3001,9 +3001,9 @@ void AddInfra(Sint32 mi, Sint32 sx, Sint32 sy, Sint32 dx, Sint32 dy, Sint32 midi missile[mi]._mirange = 1584; for (i = missile[mi]._mispllvl; i > 0; i--) { - missile[mi]._mirange += missile[mi]._mirange >> 3; + missile[mi]._mirange += missile[mi]._mirange / 8; } - missile[mi]._mirange += missile[mi]._mirange * plr[id]._pISplDur >> 7; + missile[mi]._mirange += missile[mi]._mirange * plr[id]._pISplDur / 128; if (mienemy == TARGET_MONSTERS) UseMana(id, SPL_INFRA); } @@ -3028,14 +3028,14 @@ void AddNova(Sint32 mi, Sint32 sx, Sint32 sy, Sint32 dx, Sint32 dy, Sint32 midir if (id != -1) { missile[mi]._midam = (random_(66, 6) + random_(66, 6) + random_(66, 6) + random_(66, 6) + random_(66, 6)); missile[mi]._midam += plr[id]._pLevel + 5; - missile[mi]._midam >>= 1; + missile[mi]._midam /= 2; for (k = missile[mi]._mispllvl; k > 0; k--) { - missile[mi]._midam += missile[mi]._midam >> 3; + missile[mi]._midam += missile[mi]._midam / 8; } if (mienemy == TARGET_MONSTERS) UseMana(id, SPL_NOVA); } else { - missile[mi]._midam = ((DWORD)currlevel >> 1) + random_(66, 3) + random_(66, 3) + random_(66, 3); + missile[mi]._midam = ((DWORD)currlevel / 2) + random_(66, 3) + random_(66, 3) + random_(66, 3); } missile[mi]._mirange = 1; } @@ -3152,7 +3152,7 @@ void AddFlame(Sint32 mi, Sint32 sx, Sint32 sy, Sint32 dx, Sint32 dy, Sint32 midi missile[mi]._mlid = AddLight(sx, sy, 1); if (mienemy == TARGET_MONSTERS) { i = random_(79, plr[id]._pLevel) + random_(79, 2); - missile[mi]._midam = 8 * i + 16 + ((8 * i + 16) >> 1); + missile[mi]._midam = 8 * i + 16 + ((8 * i + 16) / 2); } else { missile[mi]._midam = monster[id].mMinDamage + random_(77, monster[id].mMaxDamage - monster[id].mMinDamage + 1); } @@ -3180,10 +3180,10 @@ void AddCbolt(Sint32 mi, Sint32 sx, Sint32 sy, Sint32 dx, Sint32 dy, Sint32 midi if (micaster == 0) { if (id == myplr) { missile[mi]._mirnd = random_(63, 15) + 1; - missile[mi]._midam = random_(68, plr[id]._pMagic >> 2) + 1; + missile[mi]._midam = random_(68, plr[id]._pMagic / 4) + 1; } else { missile[mi]._mirnd = random_(63, 15) + 1; - missile[mi]._midam = random_(68, plr[id]._pMagic >> 2) + 1; + missile[mi]._midam = random_(68, plr[id]._pMagic / 4) + 1; } } else { missile[mi]._mirnd = random_(63, 15) + 1; @@ -3560,10 +3560,10 @@ void MI_Firebolt(Sint32 i) if (missile[i]._micaster == TARGET_MONSTERS) { switch (missile[i]._mitype) { case MIS_FIREBOLT: - d = random_(75, 10) + (plr[p]._pMagic >> 3) + missile[i]._mispllvl + 1; + d = random_(75, 10) + (plr[p]._pMagic / 8) + missile[i]._mispllvl + 1; break; case MIS_FLARE: - d = 3 * missile[i]._mispllvl - (plr[p]._pMagic >> 3) + (plr[p]._pMagic >> 1); + d = 3 * missile[i]._mispllvl - (plr[p]._pMagic / 8) + (plr[p]._pMagic / 2); break; case MIS_BONESPIRIT: d = 0; @@ -4101,8 +4101,8 @@ void MI_FlashFront(Sint32 i) if (missile[i]._micaster == TARGET_MONSTERS && src != -1) { missile[i]._mix = plr[src]._px; missile[i]._miy = plr[src]._py; - missile[i]._mitxoff = plr[src]._pxoff * 65536; - missile[i]._mityoff = plr[src]._pyoff * 65536; + missile[i]._mitxoff = plr[src]._pxoff << 16; + missile[i]._mityoff = plr[src]._pyoff << 16; } missile[i]._mirange--; if (missile[i]._mirange == 0) { @@ -4135,8 +4135,8 @@ void MI_Reflect(Sint32 i) int src; src = missile[i]._misource; - missile[i]._mitxoff = plr[src]._pxoff * 65536; - missile[i]._mityoff = plr[src]._pyoff * 65536; + missile[i]._mitxoff = plr[src]._pxoff << 16; + missile[i]._mityoff = plr[src]._pyoff << 16; if (plr[src]._pmode == PM_WALK3) { missile[i]._misx = plr[src]._pfutx + 2; missile[i]._misy = plr[src]._pfuty - 1; @@ -4173,7 +4173,7 @@ void MI_FireRing(Sint32 i) lvl = plr[src]._pLevel; else lvl = currlevel; - dmg = 16 * (random_(53, 10) + random_(53, 10) + lvl + 2) >> 1; + dmg = 16 * (random_(53, 10) + random_(53, 10) + lvl + 2) / 2; for (j = CrawlTable[b]; j > 0; j--, k += 2) { tx = missile[i]._miVar1 + CrawlTable[k - 1]; ty = missile[i]._miVar2 + CrawlTable[k]; @@ -4204,7 +4204,7 @@ void MI_LightningRing(Sint32 i) lvl = plr[src]._pLevel; else lvl = currlevel; - dmg = 16 * (random_(53, 10) + random_(53, 10) + lvl + 2) >> 1; + dmg = 16 * (random_(53, 10) + random_(53, 10) + lvl + 2) / 2; for (j = CrawlTable[b]; j > 0; j--, k += 2) { tx = missile[i]._miVar1 + CrawlTable[k - 1]; ty = missile[i]._miVar2 + CrawlTable[k]; @@ -4526,8 +4526,8 @@ void MI_Manashield(Sint32 i) id = missile[i]._misource; missile[i]._mix = plr[id]._px; missile[i]._miy = plr[id]._py; - missile[i]._mitxoff = plr[id]._pxoff * 65536; - missile[i]._mityoff = plr[id]._pyoff * 65536; + missile[i]._mitxoff = plr[id]._pxoff << 16; + missile[i]._mityoff = plr[id]._pyoff << 16; if (plr[id]._pmode == PM_WALK3) { missile[i]._misx = plr[id]._pfutx; missile[i]._misy = plr[id]._pfuty; @@ -4565,8 +4565,8 @@ void MI_Etherealize(Sint32 i) src = missile[i]._misource; missile[i]._mix = plr[src]._px; missile[i]._miy = plr[src]._py; - missile[i]._mitxoff = plr[src]._pxoff * 65536; - missile[i]._mityoff = plr[src]._pyoff * 65536; + missile[i]._mitxoff = plr[src]._pxoff << 16; + missile[i]._mityoff = plr[src]._pyoff << 16; if (plr[src]._pmode == PM_WALK3) { missile[i]._misx = plr[src]._pfutx; missile[i]._misy = plr[src]._pfuty; @@ -5075,7 +5075,7 @@ void MI_Wave(Sint32 i) nya += YDirAdd[dira]; nxb = sx + XDirAdd[sd] + XDirAdd[dirb]; nyb = sy + YDirAdd[sd] + YDirAdd[dirb]; - for (j = 0; j < (missile[i]._mispllvl >> 1) + 2; j++) { + for (j = 0; j < (missile[i]._mispllvl / 2) + 2; j++) { pn = dPiece[nxa][nya]; // BUGFIX: dPiece is accessed before check against dungeon size and 0 assert((DWORD)pn <= MAXTILES); if (nMissileTable[pn] || f1 || nxa <= 0 || nxa >= MAXDUNX || nya <= 0 || nya >= MAXDUNY) { diff --git a/Source/monster.cpp b/Source/monster.cpp index b06a90fd..fa887667 100644 --- a/Source/monster.cpp +++ b/Source/monster.cpp @@ -369,7 +369,7 @@ void InitMonsterGFX(int monst) } Monsters[monst].width = monsterdata[mtype].width; - Monsters[monst].width2 = (monsterdata[mtype].width - 64) >> 1; + Monsters[monst].width2 = (monsterdata[mtype].width - 64) / 2; Monsters[monst].mMinHP = monsterdata[mtype].mMinHP; Monsters[monst].mMaxHP = monsterdata[mtype].mMaxHP; if (!gbIsHellfire && mtype == MT_DIABLO) { @@ -502,7 +502,7 @@ void InitMonster(int i, direction rd, int mtype, int x, int y) } if (!gbIsMultiplayer) { - monster[i]._mmaxhp >>= 1; + monster[i]._mmaxhp /= 2; if (monster[i]._mmaxhp < 64) { monster[i]._mmaxhp = 64; } @@ -689,7 +689,7 @@ void PlaceUniqueMonst(int uniqindex, int miniontype, int bosspacksize) count = 0; Uniq = &UniqMonst[uniqindex]; - if ((uniquetrans + 19) << 8 >= LIGHTSIZE) { + if ((uniquetrans + 19) * 256 >= LIGHTSIZE) { return; } @@ -804,7 +804,7 @@ void PlaceUniqueMonst(int uniqindex, int miniontype, int bosspacksize) Monst->_mmaxhp = Uniq->mmaxhp << 6; if (!gbIsMultiplayer) { - Monst->_mmaxhp = Monst->_mmaxhp >> 1; + Monst->_mmaxhp = Monst->_mmaxhp / 2; if (Monst->_mmaxhp < 64) { Monst->_mmaxhp = 64; } @@ -1160,7 +1160,7 @@ void InitMonsters() na++; numplacemonsters = na / 30; if (gbIsMultiplayer) - numplacemonsters += numplacemonsters >> 1; + numplacemonsters += numplacemonsters / 2; if (nummonsters + numplacemonsters > MAXMONSTERS - 10) numplacemonsters = MAXMONSTERS - 10 - nummonsters; totalmonsters = nummonsters + numplacemonsters; @@ -1213,8 +1213,8 @@ void SetMapMonsters(BYTE *pMap, int startx, int starty) rw = SDL_SwapLE16(*lm++); rh = SDL_SwapLE16(*lm++); lm += rw * rh; - rw = rw << 1; - rh = rh << 1; + rw = rw * 2; + rh = rh * 2; lm += rw * rh; for (j = 0; j < rh; j++) { @@ -2013,7 +2013,7 @@ void M_ChangeLightOffset(int monst) sign = 1; } - _mxoff = sign * (lx >> 3); + _mxoff = sign * (lx / 8); if (ly < 0) { _myoff = -1; ly = -ly; @@ -2021,7 +2021,7 @@ void M_ChangeLightOffset(int monst) _myoff = 1; } - _myoff *= (ly >> 3); + _myoff *= (ly / 8); if (monster[monst].mlid != NO_LIGHT) ChangeLightOff(monster[monst].mlid, _mxoff, _myoff); } @@ -2184,8 +2184,8 @@ void M_TryH2HHit(int i, int pnum, int Hit, int MinDam, int MaxDam) } blk = plr[pnum]._pDexterity + plr[pnum]._pBaseToBlk - - (monster[i].mLevel << 1) - + (plr[pnum]._pLevel << 1); + - (monster[i].mLevel * 2) + + (plr[pnum]._pLevel * 2); if (blk < 0) blk = 0; if (blk > 100) @@ -2513,10 +2513,10 @@ bool M_DoTalk(int i) } if (monster[i]._uniqtype - 1 == UMT_SNOTSPIL) { if (monster[i].mtalkmsg == TEXT_BANNER10 && !(monster[i]._mFlags & MFLAG_QUEST_COMPLETE)) { - ObjChangeMap(setpc_x, setpc_y, (setpc_w >> 1) + setpc_x + 2, (setpc_h >> 1) + setpc_y - 2); + ObjChangeMap(setpc_x, setpc_y, (setpc_w / 2) + setpc_x + 2, (setpc_h / 2) + setpc_y - 2); tren = TransVal; TransVal = 9; - DRLG_MRectTrans(setpc_x, setpc_y, (setpc_w >> 1) + setpc_x + 4, setpc_y + (setpc_h >> 1)); + DRLG_MRectTrans(setpc_x, setpc_y, (setpc_w / 2) + setpc_x + 4, setpc_y + (setpc_h / 2)); TransVal = tren; quests[Q_LTBANNER]._qvar1 = 2; if (quests[Q_LTBANNER]._qactive == QUEST_INIT) @@ -3555,7 +3555,7 @@ void MAI_Round(int i, bool special) } } else if (v < 2 * Monst->_mint + 23) { Monst->_mdir = md; - if (special && Monst->_mhitpoints < (Monst->_mmaxhp >> 1) && random_(117, 2) != 0) + if (special && Monst->_mhitpoints < (Monst->_mmaxhp / 2) && random_(117, 2) != 0) M_StartSpAttack(i); else M_StartAttack(i); @@ -3672,7 +3672,7 @@ void MAI_Scav(int i) done = false; if (monster[i]._mmode != MM_STAND) return; - if (Monst->_mhitpoints < (Monst->_mmaxhp >> 1) && Monst->_mgoal != MGOAL_HEALING) { + if (Monst->_mhitpoints < (Monst->_mmaxhp / 2) && Monst->_mgoal != MGOAL_HEALING) { if (Monst->leaderflag != 0) { monster[Monst->leader].packsize--; Monst->leaderflag = 0; @@ -3687,7 +3687,7 @@ void MAI_Scav(int i) if (!(Monst->_mFlags & MFLAG_NOHEAL)) { if (gbIsHellfire) { int mMaxHP = Monst->_mmaxhp; // BUGFIX use _mmaxhp or we loose health when difficulty isn't normal (fixed) - Monst->_mhitpoints += mMaxHP >> 3; + Monst->_mhitpoints += mMaxHP / 8; if (Monst->_mhitpoints > Monst->_mmaxhp) Monst->_mhitpoints = Monst->_mmaxhp; if (Monst->_mgoalvar3 <= 0 || Monst->_mhitpoints == Monst->_mmaxhp) @@ -3698,7 +3698,7 @@ void MAI_Scav(int i) } int targetHealth = Monst->_mmaxhp; if (!gbIsHellfire) - targetHealth = (Monst->_mmaxhp >> 1) + (Monst->_mmaxhp >> 2); + targetHealth = (Monst->_mmaxhp / 2) + (Monst->_mmaxhp / 4); if (Monst->_mhitpoints >= targetHealth) { Monst->_mgoal = MGOAL_NORMAL; Monst->_mgoalvar1 = 0; @@ -3784,7 +3784,7 @@ void MAI_Garg(int i) return; } - if (Monst->_mhitpoints < (Monst->_mmaxhp >> 1)) + if (Monst->_mhitpoints < (Monst->_mmaxhp / 2)) if (!(Monst->_mFlags & MFLAG_NOHEAL)) Monst->_mgoal = MGOAL_RETREAT; if (Monst->_mgoal == MGOAL_RETREAT) { @@ -4284,7 +4284,7 @@ void MAI_Counselor(int i) M_StartDelay(i, random_(105, 10) + 2 * (5 - Monst->_mint)); } else { Monst->_mdir = md; - if (Monst->_mhitpoints < (Monst->_mmaxhp >> 1)) { + if (Monst->_mhitpoints < (Monst->_mmaxhp / 2)) { Monst->_mgoal = MGOAL_RETREAT; Monst->_mgoalvar1 = 0; M_StartFadeout(i, md, false); @@ -4646,7 +4646,7 @@ void ProcessMonsters() } if (!(monster[mi]._mFlags & MFLAG_NOHEAL) && Monst->_mhitpoints < Monst->_mmaxhp && Monst->_mhitpoints >> 6 > 0) { if (Monst->mLevel > 1) { - Monst->_mhitpoints += Monst->mLevel >> 1; + Monst->_mhitpoints += Monst->mLevel / 2; } else { Monst->_mhitpoints += Monst->mLevel; } @@ -5160,8 +5160,8 @@ void PrintMonstHistory(int mt) maxHP -= 2000; } if (!gbIsMultiplayer) { - minHP >>= 1; - maxHP >>= 1; + minHP /= 2; + maxHP /= 2; } if (minHP < 1) minHP = 1; diff --git a/Source/msg.cpp b/Source/msg.cpp index 99fe56f7..f99e98bf 100644 --- a/Source/msg.cpp +++ b/Source/msg.cpp @@ -2242,7 +2242,7 @@ static DWORD On_PLAYER_JOINLEVEL(TCmd *pCmd, int pnum) plr[pnum]._pmode = PM_DEATH; NewPlrAnim(pnum, plr[pnum]._pDAnim[DIR_S], plr[pnum]._pDFrames, 1, plr[pnum]._pDWidth); plr[pnum]._pAnimFrame = plr[pnum]._pAnimLen - 1; - plr[pnum]._pVar8 = plr[pnum]._pAnimLen << 1; + plr[pnum]._pVar8 = plr[pnum]._pAnimLen * 2; dFlags[plr[pnum]._px][plr[pnum]._py] |= BFLAG_DEAD_PLAYER; } diff --git a/Source/nthread.cpp b/Source/nthread.cpp index 31b86e11..a3d543e5 100644 --- a/Source/nthread.cpp +++ b/Source/nthread.cpp @@ -177,7 +177,7 @@ void nthread_start(bool set_turn_upper_bit) largestMsgSize = 512; if (caps.maxmessagesize < 0x200) largestMsgSize = caps.maxmessagesize; - gdwDeltaBytesSec = caps.bytessec >> 2; + gdwDeltaBytesSec = caps.bytessec / 4; gdwLargestMsgSize = largestMsgSize; gdwNormalMsgSize = caps.bytessec * sgbNetUpdateRate / 20; gdwNormalMsgSize *= 3; diff --git a/Source/objects.cpp b/Source/objects.cpp index 0720e578..861e1927 100644 --- a/Source/objects.cpp +++ b/Source/objects.cpp @@ -571,7 +571,7 @@ void InitRndBarrels() AddObject(o, xp, yp); c++; } - p = c >> 1; + p = c / 2; } } } @@ -774,8 +774,8 @@ void LoadMapObjects(BYTE *pMap, int startx, int starty, int x1, int y1, int w, i lm += 2; rh = *lm; mapoff = (rw * rh + 1) * 2; - rw <<= 1; - rh <<= 1; + rw *= 2; + rh *= 2; mapoff += rw * 2 * rh * 2; lm += mapoff; @@ -808,8 +808,8 @@ void LoadMapObjs(BYTE *pMap, int startx, int starty) lm += 2; rh = *lm; mapoff = (rw * rh + 1) * 2; - rw <<= 1; - rh <<= 1; + rw *= 2; + rh *= 2; mapoff += 2 * rw * rh * 2; lm += mapoff; @@ -1221,8 +1221,8 @@ void SetMapObjects(BYTE *pMap, int startx, int starty) lm += 2; rh = *lm; mapoff = (rw * rh + 1) * 2; - rw <<= 1; - rh <<= 1; + rw *= 2; + rh *= 2; mapoff += 2 * rw * rh * 2; lm += mapoff; h = lm; @@ -1601,7 +1601,7 @@ void AddStoryBook(int i) object[i]._oVar2 = StoryText[object[i]._oVar1][1]; else if (currlevel == 12) object[i]._oVar2 = StoryText[object[i]._oVar1][2]; - object[i]._oVar3 = (currlevel >> 2) + 3 * object[i]._oVar1 - 1; + object[i]._oVar3 = (currlevel / 4) + 3 * object[i]._oVar1 - 1; object[i]._oAnimFrame = 5 - 2 * object[i]._oVar1; object[i]._oVar4 = object[i]._oAnimFrame + 1; } @@ -1684,7 +1684,7 @@ void objects_44D8C5(_object_id ot, int v2, int ox, int oy) dObject[ox][oy] = oi + 1; SetupObject(oi, ox, oy, ot); objects_44DA68(oi, v2); - object[oi]._oAnimWidth2 = (object[oi]._oAnimWidth - 64) >> 1; + object[oi]._oAnimWidth2 = (object[oi]._oAnimWidth - 64) / 2; nobjects++; } @@ -1904,7 +1904,7 @@ void AddObject(_object_id ot, int ox, int oy) default: break; } - object[oi]._oAnimWidth2 = (object[oi]._oAnimWidth - 64) >> 1; + object[oi]._oAnimWidth2 = (object[oi]._oAnimWidth - 64) / 2; nobjects++; } @@ -3660,7 +3660,7 @@ bool OperateShrineEnchanted(int pnum) for (int j = 0; j < maxSpells; j++) { if (spell & spells) cnt++; - spell <<= 1; + spell *= 2; } if (cnt > 1) { spell = 1; @@ -3669,7 +3669,7 @@ bool OperateShrineEnchanted(int pnum) if (plr[pnum]._pSplLvl[j] < MAX_SPELL_LEVEL) plr[pnum]._pSplLvl[j]++; } - spell <<= 1; + spell *= 2; } int r; do { diff --git a/Source/palette.cpp b/Source/palette.cpp index 20813761..d283c8a5 100644 --- a/Source/palette.cpp +++ b/Source/palette.cpp @@ -214,9 +214,9 @@ void SetFadeLevel(DWORD fadeval) int i; for (i = 0; i < 256; i++) { // BUGFIX: should be 256 (fixed) - system_palette[i].r = (fadeval * logical_palette[i].r) >> 8; - system_palette[i].g = (fadeval * logical_palette[i].g) >> 8; - system_palette[i].b = (fadeval * logical_palette[i].b) >> 8; + system_palette[i].r = (fadeval * logical_palette[i].r) / 256; + system_palette[i].g = (fadeval * logical_palette[i].g) / 256; + system_palette[i].b = (fadeval * logical_palette[i].b) / 256; } palette_update(); } diff --git a/Source/player.cpp b/Source/player.cpp index 0f5f28c9..efeeba78 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -536,7 +536,7 @@ void NewPlrAnim(int pnum, BYTE *Peq, int numFrames, int Delay, int width, int nu plr[pnum]._pAnimCnt = 0; plr[pnum]._pAnimDelay = Delay; plr[pnum]._pAnimWidth = width; - plr[pnum]._pAnimWidth2 = (width - 64) >> 1; + plr[pnum]._pAnimWidth2 = (width - 64) / 2; plr[pnum]._pAnimNumSkippedFrames = numSkippedFrames; plr[pnum]._pAnimGameTicksSinceSequenceStarted = processAnimationPending ? -1 : 0; plr[pnum]._pAnimStopDistributingAfterFrame = stopDistributingAfterFrame; @@ -745,9 +745,9 @@ void CreatePlayer(int pnum, HeroClass c) plr[pnum]._pHitPoints = (plr[pnum]._pVitality + 10) << 6; if (plr[pnum]._pClass == HeroClass::Warrior || plr[pnum]._pClass == HeroClass::Barbarian) { - plr[pnum]._pHitPoints <<= 1; + plr[pnum]._pHitPoints *= 2; } else if (plr[pnum]._pClass == HeroClass::Rogue || plr[pnum]._pClass == HeroClass::Monk || plr[pnum]._pClass == HeroClass::Bard) { - plr[pnum]._pHitPoints += plr[pnum]._pHitPoints >> 1; + plr[pnum]._pHitPoints += plr[pnum]._pHitPoints / 2; } plr[pnum]._pMaxHP = plr[pnum]._pHitPoints; @@ -756,11 +756,11 @@ void CreatePlayer(int pnum, HeroClass c) plr[pnum]._pMana = plr[pnum]._pMagic << 6; if (plr[pnum]._pClass == HeroClass::Sorcerer) { - plr[pnum]._pMana <<= 1; + plr[pnum]._pMana *= 2; } else if (plr[pnum]._pClass == HeroClass::Bard) { plr[pnum]._pMana += plr[pnum]._pMana * 3 / 4; } else if (plr[pnum]._pClass == HeroClass::Rogue || plr[pnum]._pClass == HeroClass::Monk) { - plr[pnum]._pMana += plr[pnum]._pMana >> 1; + plr[pnum]._pMana += plr[pnum]._pMana / 2; } plr[pnum]._pMaxMana = plr[pnum]._pMana; @@ -1319,12 +1319,12 @@ void PM_ChangeLightOff(int pnum) ymul = 1; } - x = (x >> 3) * xmul; - y = (y >> 3) * ymul; - lx = x + (l->_lx << 3); - ly = y + (l->_ly << 3); - offx = l->_xoff + (l->_lx << 3); - offy = l->_yoff + (l->_ly << 3); + x = (x / 8) * xmul; + y = (y / 8) * ymul; + lx = x + (l->_lx * 8); + ly = y + (l->_ly * 8); + offx = l->_xoff + (l->_lx * 8); + offy = l->_yoff + (l->_ly * 8); if (abs(lx - offx) < 3 && abs(ly - offy) < 3) return; @@ -1898,7 +1898,7 @@ void DropHalfPlayersGold(int pnum) app_fatal("DropHalfPlayersGold: illegal player %d", pnum); } - hGold = plr[pnum]._pGold >> 1; + hGold = plr[pnum]._pGold / 2; for (i = 0; i < MAXBELTITEMS && hGold > 0; i++) { if (plr[pnum].SpdList[i]._itype == ITYPE_GOLD && plr[pnum].SpdList[i]._ivalue != MaxGold) { if (hGold < plr[pnum].SpdList[i]._ivalue) { @@ -2473,7 +2473,7 @@ bool PlrHitMonst(int pnum, int m) if (_pIEnAc > 0) tmac >>= _pIEnAc; else - tmac -= tmac >> 2; + tmac -= tmac / 4; if (plr[pnum]._pClass == HeroClass::Barbarian) { tmac -= monster[m].mArmorClass / 8; @@ -2485,7 +2485,7 @@ bool PlrHitMonst(int pnum, int m) tmac -= plr[pnum]._pIEnAc; } - hper += (plr[pnum]._pDexterity >> 1) + plr[pnum]._pLevel + 50 - tmac; + hper += (plr[pnum]._pDexterity / 2) + plr[pnum]._pLevel + 50 - tmac; if (plr[pnum]._pClass == HeroClass::Warrior) { hper += 20; } @@ -2519,7 +2519,7 @@ bool PlrHitMonst(int pnum, int m) if (plr[pnum]._pClass == HeroClass::Warrior || plr[pnum]._pClass == HeroClass::Barbarian) { ddp = plr[pnum]._pLevel; if (random_(6, 100) < ddp) { - dam <<= 1; + dam *= 2; } } @@ -2534,16 +2534,16 @@ bool PlrHitMonst(int pnum, int m) switch (monster[m].MData->mMonstClass) { case MC_UNDEAD: if (phanditype == ITYPE_SWORD) { - dam -= dam >> 1; + dam -= dam / 2; } else if (phanditype == ITYPE_MACE) { - dam += dam >> 1; + dam += dam / 2; } break; case MC_ANIMAL: if (phanditype == ITYPE_MACE) { - dam -= dam >> 1; + dam -= dam / 2; } else if (phanditype == ITYPE_SWORD) { - dam += dam >> 1; + dam += dam / 2; } break; case MC_DEMON: @@ -2578,13 +2578,13 @@ bool PlrHitMonst(int pnum, int m) if (dam2 >= 0) { ApplyPlrDamage(pnum, 0, 1, dam2); } - dam <<= 1; + dam *= 2; } monster[m]._mhitpoints -= dam; } if (plr[pnum]._pIFlags & ISPL_RNDSTEALLIFE) { - skdam = random_(7, dam >> 3); + skdam = random_(7, dam / 8); plr[pnum]._pHitPoints += skdam; if (plr[pnum]._pHitPoints > plr[pnum]._pMaxHP) { plr[pnum]._pHitPoints = plr[pnum]._pMaxHP; @@ -2686,7 +2686,7 @@ bool PlrHitPlr(int pnum, int8_t p) hit = random_(4, 100); - hper = (plr[pnum]._pDexterity >> 1) + plr[pnum]._pLevel + 50 - (plr[p]._pIBonusAC + plr[p]._pIAC + plr[p]._pDexterity / 5); + hper = (plr[pnum]._pDexterity / 2) + plr[pnum]._pLevel + 50 - (plr[p]._pIBonusAC + plr[p]._pIAC + plr[p]._pDexterity / 5); if (plr[pnum]._pClass == HeroClass::Warrior) { hper += 20; @@ -2705,7 +2705,7 @@ bool PlrHitPlr(int pnum, int8_t p) blk = 100; } - blkper = plr[p]._pDexterity + plr[p]._pBaseToBlk + (plr[p]._pLevel << 1) - (plr[pnum]._pLevel << 1); + blkper = plr[p]._pDexterity + plr[p]._pBaseToBlk + (plr[p]._pLevel * 2) - (plr[pnum]._pLevel * 2); if (blkper < 0) { blkper = 0; } @@ -2727,12 +2727,12 @@ bool PlrHitPlr(int pnum, int8_t p) if (plr[pnum]._pClass == HeroClass::Warrior || plr[pnum]._pClass == HeroClass::Barbarian) { lvl = plr[pnum]._pLevel; if (random_(6, 100) < lvl) { - dam <<= 1; + dam *= 2; } } skdam = dam << 6; if (plr[pnum]._pIFlags & ISPL_RNDSTEALLIFE) { - tac = random_(7, skdam >> 3); + tac = random_(7, skdam / 8); plr[pnum]._pHitPoints += tac; if (plr[pnum]._pHitPoints > plr[pnum]._pMaxHP) { plr[pnum]._pHitPoints = plr[pnum]._pMaxHP; @@ -4148,9 +4148,9 @@ void ModifyPlrMag(int p, int l) int ms = l << 6; if (plr[p]._pClass == HeroClass::Sorcerer) { - ms <<= 1; + ms *= 2; } else if (plr[p]._pClass == HeroClass::Bard) { - ms += ms >> 1; + ms += ms / 2; } plr[p]._pMaxManaBase += ms; @@ -4207,9 +4207,9 @@ void ModifyPlrVit(int p, int l) int ms = l << 6; if (plr[p]._pClass == HeroClass::Warrior) { - ms <<= 1; + ms *= 2; } else if (plr[p]._pClass == HeroClass::Barbarian) { - ms <<= 1; + ms *= 2; } plr[p]._pHPBase += ms; @@ -4270,9 +4270,9 @@ void SetPlrMag(int p, int v) m = v << 6; if (plr[p]._pClass == HeroClass::Sorcerer) { - m <<= 1; + m *= 2; } else if (plr[p]._pClass == HeroClass::Bard) { - m += m >> 1; + m += m / 2; } plr[p]._pMaxManaBase = m; @@ -4312,9 +4312,9 @@ void SetPlrVit(int p, int v) hp = v << 6; if (plr[p]._pClass == HeroClass::Warrior) { - hp <<= 1; + hp *= 2; } else if (plr[p]._pClass == HeroClass::Barbarian) { - hp <<= 1; + hp *= 2; } plr[p]._pHPBase = hp; diff --git a/Source/quests.cpp b/Source/quests.cpp index 5eca8614..a98e3fb3 100644 --- a/Source/quests.cpp +++ b/Source/quests.cpp @@ -671,12 +671,12 @@ void ResyncQuests() setpc_h + setpc_y - 2, setpc_w + setpc_x + 1, setpc_h + setpc_y + 1); - ObjChangeMapResync(setpc_x, setpc_y, (setpc_w >> 1) + setpc_x + 2, (setpc_h >> 1) + setpc_y - 2); + ObjChangeMapResync(setpc_x, setpc_y, (setpc_w / 2) + setpc_x + 2, (setpc_h / 2) + setpc_y - 2); for (i = 0; i < nobjects; i++) SyncObjectAnim(objectactive[i]); tren = TransVal; TransVal = 9; - DRLG_MRectTrans(setpc_x, setpc_y, (setpc_w >> 1) + setpc_x + 4, setpc_y + (setpc_h >> 1)); + DRLG_MRectTrans(setpc_x, setpc_y, (setpc_w / 2) + setpc_x + 4, setpc_y + (setpc_h / 2)); TransVal = tren; } if (quests[Q_LTBANNER]._qvar1 == 3) { @@ -687,7 +687,7 @@ void ResyncQuests() SyncObjectAnim(objectactive[i]); tren = TransVal; TransVal = 9; - DRLG_MRectTrans(setpc_x, setpc_y, (setpc_w >> 1) + setpc_x + 4, setpc_y + (setpc_h >> 1)); + DRLG_MRectTrans(setpc_x, setpc_y, (setpc_w / 2) + setpc_x + 4, setpc_y + (setpc_h / 2)); TransVal = tren; } } @@ -742,7 +742,7 @@ static void PrintQLString(CelOutputBuffer out, int x, int y, bool cjustflag, con for (i = 0; i < len; i++) width += fontkern[fontframe[gbFontTransTbl[(BYTE)str[i]]]] + 1; if (width < 257) - k = (257 - width) >> 1; + k = (257 - width) / 2; sx += k; } if (qline == y) { @@ -787,7 +787,7 @@ void StartQuestlog() } } if (numqlines > 5) { - qtopline = 5 - (numqlines >> 1); + qtopline = 5 - (numqlines / 2); } else { qtopline = 8; } @@ -829,7 +829,7 @@ void QuestlogEnter() { PlaySFX(IS_TITLSLCT); if (numqlines && qline != 22) - InitQTextMsg(quests[qlist[(qline - qtopline) >> 1]]._qmsg); + InitQTextMsg(quests[qlist[(qline - qtopline) / 2]]._qmsg); questlog = false; } diff --git a/Source/scrollrt.cpp b/Source/scrollrt.cpp index 307548e6..3bc6a5e6 100644 --- a/Source/scrollrt.cpp +++ b/Source/scrollrt.cpp @@ -519,8 +519,8 @@ static void DrawObject(CelOutputBuffer out, int x, int y, int ox, int oy, bool p return; int xx = object[bv]._ox - x; int yy = object[bv]._oy - y; - sx = (xx << 5) + ox - object[bv]._oAnimWidth2 - (yy << 5); - sy = oy + (yy << 4) + (xx << 4); + sx = (xx * TILE_WIDTH / 2) + ox - object[bv]._oAnimWidth2 - (yy * TILE_WIDTH / 2); + sy = oy + (yy * TILE_HEIGHT / 2) + (xx * TILE_HEIGHT / 2); } assert(bv >= 0 && bv < MAXOBJECTS); @@ -563,7 +563,7 @@ static void drawCell(CelOutputBuffer out, int x, int y, int sx, int sy) level_piece_id = dPiece[x][y]; cel_transparency_active = (BYTE)(nTransTable[level_piece_id] & TransList[dTransVal[x][y]]); cel_foliage_active = !nSolidTable[level_piece_id]; - for (int i = 0; i < (MicroTileLen >> 1); i++) { + for (int i = 0; i < (MicroTileLen / 2); i++) { level_cel_block = pMap->mt[2 * i]; if (level_cel_block != 0) { arch_draw_type = i == 0 ? 1 : 0; diff --git a/Source/setmaps.cpp b/Source/setmaps.cpp index d9c56b93..bf4bdd0f 100644 --- a/Source/setmaps.cpp +++ b/Source/setmaps.cpp @@ -129,8 +129,8 @@ void DRLG_SetMapTrans(const char *sFileName) x = pLevelMap[0]; y = *d; dwOffset = (x * y + 1) * 2; - x <<= 1; - y <<= 1; + x *= 2; + y *= 2; dwOffset += 3 * x * y * 2; d += dwOffset; diff --git a/Source/spells.cpp b/Source/spells.cpp index 6d567fb7..7efa9f5f 100644 --- a/Source/spells.cpp +++ b/Source/spells.cpp @@ -30,7 +30,7 @@ int GetManaAmount(int id, spell_id sn) adj = sl * spelldata[sn].sManaAdj; } if (sn == SPL_FIREBOLT) { - adj >>= 1; + adj /= 2; } if (sn == SPL_RESURRECT && sl > 0) { adj = sl * (spelldata[SPL_RESURRECT].sManaCost / 8); @@ -49,9 +49,9 @@ int GetManaAmount(int id, spell_id sn) ma <<= 6; if (gbIsHellfire && plr[id]._pClass == HeroClass::Sorcerer) { - ma >>= 1; + ma /= 2; } else if (plr[id]._pClass == HeroClass::Rogue || plr[id]._pClass == HeroClass::Monk || plr[id]._pClass == HeroClass::Bard) { - ma -= ma >> 2; + ma -= ma / 4; } if (spelldata[sn].sMinMana > ma >> 6) { @@ -204,7 +204,7 @@ void CastSpell(int id, int spl, int sx, int sy, int dx, int dy, int spllvl) } else if (spl == SPL_CBOLT) { UseMana(id, SPL_CBOLT); - for (int i = (spllvl >> 1) + 3; i > 0; i--) { + for (int i = (spllvl / 2) + 3; i > 0; i--) { AddMissile(sx, sy, dx, dy, dir, MIS_CBOLT, TARGET_MONSTERS, id, 0, spllvl); } } @@ -325,9 +325,9 @@ void DoHealOther(int pnum, int rid) } if (plr[pnum]._pClass == HeroClass::Warrior || plr[pnum]._pClass == HeroClass::Barbarian) { - hp <<= 1; + hp *= 2; } else if (plr[pnum]._pClass == HeroClass::Rogue || plr[pnum]._pClass == HeroClass::Bard) { - hp += hp >> 1; + hp += hp / 2; } else if (plr[pnum]._pClass == HeroClass::Monk) { hp *= 3; } diff --git a/Source/stores.cpp b/Source/stores.cpp index 594a98c0..6979dc2d 100644 --- a/Source/stores.cpp +++ b/Source/stores.cpp @@ -108,7 +108,7 @@ void DrawSSlider(CelOutputBuffer out, int y1, int y2) else yd3 = stextsel; if (storenumh > 1) - yd3 = 1000 * (stextsval + ((yd3 - stextup) >> 2)) / (storenumh - 1) * (y2 * 12 - y1 * 12 - 24) / 1000; + yd3 = 1000 * (stextsval + ((yd3 - stextup) / 4)) / (storenumh - 1) * (y2 * 12 - y1 * 12 - 24) / 1000; else yd3 = 0; CelDrawTo(out, PANEL_X + 601, (y1 + 1) * 12 + 44 + UI_OFFSET_Y + yd3, pSTextSlidCels, 13, 12); @@ -923,9 +923,9 @@ void S_StartBBoy() AddSText(20, 10, false, boyitem._iName, iclr, true); if (gbIsHellfire) - AddSTextVal(10, boyitem._iIvalue - (boyitem._iIvalue >> 2)); + AddSTextVal(10, boyitem._iIvalue - (boyitem._iIvalue / 4)); else - AddSTextVal(10, boyitem._iIvalue + (boyitem._iIvalue >> 1)); + AddSTextVal(10, boyitem._iIvalue + (boyitem._iIvalue / 2)); PrintStoreItem(&boyitem, 11, iclr); AddSText(0, 22, true, "Leave", COL_WHITE, true); OffsetSTextY(22, 6); @@ -1145,7 +1145,7 @@ void S_StartTalk() } if (sn > 6) { - sn = 14 - (sn >> 1); + sn = 14 - (sn / 2); la = 1; } else { sn = 15 - sn; @@ -1241,7 +1241,7 @@ void SmithBuyItem() if (plr[myplr].HoldItem._iMagical == ITEM_QUALITY_NORMAL) plr[myplr].HoldItem._iIdentified = false; StoreAutoPlace(); - idx = stextvhold + ((stextlhold - stextup) >> 2); + idx = stextvhold + ((stextlhold - stextup) / 4); if (idx == SMITH_ITEMS - 1) { smithitem[SMITH_ITEMS - 1]._itype = ITYPE_NONE; } else { @@ -1265,7 +1265,7 @@ void S_SBuyEnter() stextlhold = stextsel; stextvhold = stextsval; stextshold = STORE_SBUY; - idx = stextsval + ((stextsel - stextup) >> 2); + idx = stextsval + ((stextsel - stextup) / 4); if (plr[myplr]._pGold < smithitem[idx]._iIvalue) { StartStore(STORE_NOMONEY); } else { @@ -1297,7 +1297,7 @@ void SmithBuyPItem() plr[myplr].HoldItem._iIdentified = false; StoreAutoPlace(); - idx = stextvhold + ((stextlhold - stextup) >> 2); + idx = stextvhold + ((stextlhold - stextup) / 4); xx = 0; for (i = 0; idx >= 0; i++) { if (!premiumitems[i].isEmpty()) { @@ -1323,7 +1323,7 @@ void S_SPBuyEnter() stextshold = STORE_SPBUY; stextlhold = stextsel; stextvhold = stextsval; - xx = stextsval + ((stextsel - stextup) >> 2); + xx = stextsval + ((stextsel - stextup) / 4); idx = 0; for (i = 0; xx >= 0; i++) { if (!premiumitems[i].isEmpty()) { @@ -1421,7 +1421,7 @@ void StoreSellItem() { int i, idx, cost; - idx = stextvhold + ((stextlhold - stextup) >> 2); + idx = stextvhold + ((stextlhold - stextup) / 4); if (storehidx[idx] >= 0) RemoveInvItem(myplr, storehidx[idx]); else @@ -1467,7 +1467,7 @@ void S_SSellEnter() stextsel = 16; } else { stextlhold = stextsel; - idx = stextsval + ((stextsel - stextup) >> 2); + idx = stextsval + ((stextsel - stextup) / 4); stextshold = STORE_SSELL; stextvhold = stextsval; plr[myplr].HoldItem = storehold[idx]; @@ -1488,7 +1488,7 @@ void SmithRepairItem() TakePlrsMoney(plr[myplr].HoldItem._iIvalue); - idx = stextvhold + ((stextlhold - stextup) >> 2); + idx = stextvhold + ((stextlhold - stextup) / 4); storehold[idx]._iDurability = storehold[idx]._iMaxDur; i = storehidx[idx]; @@ -1517,7 +1517,7 @@ void S_SRepairEnter() stextshold = STORE_SREPAIR; stextlhold = stextsel; stextvhold = stextsval; - idx = stextsval + ((stextsel - stextup) >> 2); + idx = stextsval + ((stextsel - stextup) / 4); plr[myplr].HoldItem = storehold[idx]; if (plr[myplr]._pGold < storehold[idx]._iIvalue) StartStore(STORE_NOMONEY); @@ -1559,7 +1559,7 @@ void WitchBuyItem() { int idx; - idx = stextvhold + ((stextlhold - stextup) >> 2); + idx = stextvhold + ((stextlhold - stextup) / 4); if (idx < 3) plr[myplr].HoldItem._iSeed = AdvanceRndSeed(); @@ -1593,7 +1593,7 @@ void S_WBuyEnter() stextlhold = stextsel; stextvhold = stextsval; stextshold = STORE_WBUY; - idx = stextsval + ((stextsel - stextup) >> 2); + idx = stextsval + ((stextsel - stextup) / 4); if (plr[myplr]._pGold < witchitem[idx]._iIvalue) { StartStore(STORE_NOMONEY); @@ -1624,7 +1624,7 @@ void S_WSellEnter() stextsel = 16; } else { stextlhold = stextsel; - idx = stextsval + ((stextsel - stextup) >> 2); + idx = stextsval + ((stextsel - stextup) / 4); stextshold = STORE_WSELL; stextvhold = stextsval; plr[myplr].HoldItem = storehold[idx]; @@ -1644,7 +1644,7 @@ void WitchRechargeItem() TakePlrsMoney(plr[myplr].HoldItem._iIvalue); - idx = stextvhold + ((stextlhold - stextup) >> 2); + idx = stextvhold + ((stextlhold - stextup) / 4); storehold[idx]._iCharges = storehold[idx]._iMaxCharges; i = storehidx[idx]; @@ -1667,7 +1667,7 @@ void S_WRechargeEnter() stextshold = STORE_WRECHARGE; stextlhold = stextsel; stextvhold = stextsval; - idx = stextsval + ((stextsel - stextup) >> 2); + idx = stextsval + ((stextsel - stextup) / 4); plr[myplr].HoldItem = storehold[idx]; if (plr[myplr]._pGold < storehold[idx]._iIvalue) StartStore(STORE_NOMONEY); @@ -1717,7 +1717,7 @@ void HealerBuyItem() { int idx; - idx = stextvhold + ((stextlhold - stextup) >> 2); + idx = stextvhold + ((stextlhold - stextup) / 4); if (!gbIsMultiplayer) { if (idx < 2) plr[myplr].HoldItem._iSeed = AdvanceRndSeed(); @@ -1738,7 +1738,7 @@ void HealerBuyItem() if (idx < 3) return; } - idx = stextvhold + ((stextlhold - stextup) >> 2); + idx = stextvhold + ((stextlhold - stextup) / 4); if (idx == 19) { healitem[19]._itype = ITYPE_NONE; } else { @@ -1762,9 +1762,9 @@ void S_BBuyEnter() stextlhold = 10; int price = boyitem._iIvalue; if (gbIsHellfire) - price -= boyitem._iIvalue >> 2; + price -= boyitem._iIvalue / 4; else - price += boyitem._iIvalue >> 1; + price += boyitem._iIvalue / 2; if (plr[myplr]._pGold < price) { StartStore(STORE_NOMONEY); @@ -1793,7 +1793,7 @@ void StoryIdItem() { int idx; - idx = storehidx[((stextlhold - stextup) >> 2) + stextvhold]; + idx = storehidx[((stextlhold - stextup) / 4) + stextvhold]; if (idx < 0) { if (idx == -1) plr[myplr].InvBody[INVLOC_HEAD]._iIdentified = true; @@ -1900,7 +1900,7 @@ void S_HBuyEnter() stextlhold = stextsel; stextvhold = stextsval; stextshold = STORE_HBUY; - idx = stextsval + ((stextsel - stextup) >> 2); + idx = stextsval + ((stextsel - stextup) / 4); if (plr[myplr]._pGold < healitem[idx]._iIvalue) { StartStore(STORE_NOMONEY); @@ -1953,7 +1953,7 @@ void S_SIDEnter() stextshold = STORE_SIDENTIFY; stextlhold = stextsel; stextvhold = stextsval; - idx = stextsval + ((stextsel - stextup) >> 2); + idx = stextsval + ((stextsel - stextup) / 4); plr[myplr].HoldItem = storehold[idx]; if (plr[myplr]._pGold < storehold[idx]._iIvalue) StartStore(STORE_NOMONEY); @@ -1978,7 +1978,7 @@ void S_TalkEnter() sn++; } if (sn > 6) { - sn = 14 - (sn >> 1); + sn = 14 - (sn / 2); la = 1; } else { sn = 15 - sn; @@ -2138,7 +2138,7 @@ void SetupTownStores() l = i; } } else { - l = plr[myplr]._pLevel >> 1; + l = plr[myplr]._pLevel / 2; } l += 2; if (l < 6) @@ -2185,7 +2185,7 @@ void PrintSString(CelOutputBuffer out, int x, int y, bool cjustflag, const char for (i = 0; i < len; i++) width += fontkern[fontframe[gbFontTransTbl[(BYTE)str[i]]]] + 1; if (width < yy) - k = (yy - width) >> 1; + k = (yy - width) / 2; sx += k; } if (stextsel == y) { diff --git a/Source/themes.cpp b/Source/themes.cpp index f873a5a9..e03ab2fd 100644 --- a/Source/themes.cpp +++ b/Source/themes.cpp @@ -700,7 +700,7 @@ void Theme_Treasure(int t) if (rv == 0 || rv >= treasrnd[leveltype - 1] - 2) { i = ItemNoFlippy(); if (rv >= treasrnd[leveltype - 1] - 2 && leveltype != DTYPE_CATHEDRAL) { - items[i]._ivalue >>= 1; + items[i]._ivalue /= 2; } } } diff --git a/Source/towners.cpp b/Source/towners.cpp index f5e21a04..1d343700 100644 --- a/Source/towners.cpp +++ b/Source/towners.cpp @@ -204,7 +204,7 @@ void InitTownerInfo(int i, int w, int sel, _talker_id t, int x, int y, int ao) memset(&towners[i], 0, sizeof(TownerStruct)); towners[i]._tSelFlag = sel; towners[i]._tAnimWidth = w; - towners[i]._tAnimWidth2 = (w - 64) >> 1; + towners[i]._tAnimWidth2 = (w - 64) / 2; towners[i]._tMsgSaid = false; towners[i]._ttype = t; towners[i]._tx = x;