diff --git a/Source/itemdat.h b/Source/itemdat.h index d73d85a4c..3bd15a394 100644 --- a/Source/itemdat.h +++ b/Source/itemdat.h @@ -13,7 +13,7 @@ namespace devilution { /** @todo add missing values and apply */ -enum _item_indexes : uint16_t { +enum _item_indexes : int16_t { IDI_GOLD, IDI_WARRIOR, IDI_WARRSHLD, @@ -64,6 +64,7 @@ enum _item_indexes : uint16_t { IDI_FULLNOTE, IDI_BROWNSUIT, IDI_GREYSUIT, + IDI_NONE = -1, }; enum item_drop_rate : uint8_t { diff --git a/Source/pack.cpp b/Source/pack.cpp index 4814e7466..41a54fc3a 100644 --- a/Source/pack.cpp +++ b/Source/pack.cpp @@ -126,7 +126,7 @@ void PackPlayer(PkPlayerStruct *pPack, const PlayerStruct &player, bool manashie void UnPackItem(const PkItemStruct *is, ItemStruct *id, bool isHellfire) { auto idx = static_cast<_item_indexes>(SDL_SwapLE16(is->idx)); - if (idx == 0xFFFF) { + if (idx == IDI_NONE) { id->_itype = ITYPE_NONE; return; } diff --git a/Source/player.cpp b/Source/player.cpp index 29d02d48c..567288b5a 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -3671,17 +3671,22 @@ void SyncPlrAnim(int pnum) case PM_BLOCK: graphic = player_graphic::Block; break; - case PM_SPELL: { - magic_type sType = STYPE_FIRE; - if (pnum == myplr) - sType = spelldata[player._pSpell].sType; - if (sType == STYPE_FIRE) - graphic = player_graphic::Fire; - else if (sType == STYPE_LIGHTNING) - graphic = player_graphic::Lightning; - else if (sType == STYPE_MAGIC) - graphic = player_graphic::Magic; - } break; + case PM_SPELL: + graphic = player_graphic::Fire; + if (pnum == myplr) { + switch (spelldata[player._pSpell].sType) { + case STYPE_FIRE: + graphic = player_graphic::Fire; + break; + case STYPE_LIGHTNING: + graphic = player_graphic::Lightning; + break; + case STYPE_MAGIC: + graphic = player_graphic::Magic; + break; + } + } + break; case PM_GOTHIT: graphic = player_graphic::Hit; break; diff --git a/Source/qol/itemlabels.cpp b/Source/qol/itemlabels.cpp index 17872bae9..c7222531e 100644 --- a/Source/qol/itemlabels.cpp +++ b/Source/qol/itemlabels.cpp @@ -160,7 +160,7 @@ void DrawItemNameLabels(const Surface &out) FillRect(out, label.pos.x, label.pos.y - Height + MarginY, label.width, Height, PAL8_BLUE + 6); else DrawHalfTransparentRectTo(out, label.pos.x, label.pos.y - Height + MarginY, label.width, Height); - DrawString(out, label.text.c_str(), { label.pos.x + MarginX, label.pos.y, label.width, Height }, itm.getTextColor()); + DrawString(out, label.text.c_str(), { { label.pos.x + MarginX, label.pos.y }, { label.width, Height } }, itm.getTextColor()); } labelQueue.clear(); } diff --git a/Source/qol/monhealthbar.cpp b/Source/qol/monhealthbar.cpp index 978786ed4..7686da067 100644 --- a/Source/qol/monhealthbar.cpp +++ b/Source/qol/monhealthbar.cpp @@ -96,7 +96,7 @@ void DrawMonsterHealthBar(const Surface &out) } int barLabelY = yPos + 10 + (height - 11) / 2; - DrawString(out, mon.mName, { xPos - 1, barLabelY + 1, width, height }, UIS_CENTER | UIS_BLACK); + DrawString(out, mon.mName, { { xPos - 1, barLabelY + 1 }, { width, height } }, UIS_CENTER | UIS_BLACK); uint16_t style = UIS_SILVER; if (mon._uniqtype != 0) style = UIS_GOLD;