|
|
|
|
@ -310,6 +310,38 @@ void SetSpellTrans(spell_type t)
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void PrintSBookSpellType(const Surface &out, Point position, const std::string &text, uint8_t rectColorIndex) |
|
|
|
|
{ |
|
|
|
|
Point rect { position }; |
|
|
|
|
rect += Displacement { 0, -SPLICONLENGTH + 1 }; |
|
|
|
|
|
|
|
|
|
// Top
|
|
|
|
|
DrawHorizontalLine(out, rect, SPLICONLENGTH, rectColorIndex); |
|
|
|
|
DrawHorizontalLine(out, rect + Displacement { 0, 1 }, SPLICONLENGTH, rectColorIndex); |
|
|
|
|
|
|
|
|
|
// Bottom
|
|
|
|
|
DrawHorizontalLine(out, rect + Displacement { 0, SPLICONLENGTH - 2 }, SPLICONLENGTH, rectColorIndex); |
|
|
|
|
DrawHorizontalLine(out, rect + Displacement { 0, SPLICONLENGTH - 1 }, SPLICONLENGTH, rectColorIndex); |
|
|
|
|
|
|
|
|
|
// Left Side
|
|
|
|
|
DrawVerticalLine(out, rect, SPLICONLENGTH, rectColorIndex); |
|
|
|
|
DrawVerticalLine(out, rect + Displacement { 1, 0 }, SPLICONLENGTH, rectColorIndex); |
|
|
|
|
|
|
|
|
|
// Right Side
|
|
|
|
|
DrawVerticalLine(out, rect + Displacement { SPLICONLENGTH - 2, 0 }, SPLICONLENGTH, rectColorIndex); |
|
|
|
|
DrawVerticalLine(out, rect + Displacement { SPLICONLENGTH - 1, 0 }, SPLICONLENGTH, rectColorIndex); |
|
|
|
|
|
|
|
|
|
// Align the spell type text with bottom of spell icon
|
|
|
|
|
position += Displacement { SPLICONLENGTH / 2 - GetLineWidth(text.c_str()) / 2, -15 }; |
|
|
|
|
|
|
|
|
|
// Draw a drop shadow below and to the left of the text
|
|
|
|
|
DrawString(out, text, position + Displacement { -1, 1 }, UiFlags::ColorBlack); |
|
|
|
|
DrawString(out, text, position + Displacement { -1, -1 }, UiFlags::ColorBlack); |
|
|
|
|
DrawString(out, text, position + Displacement { 1, -1 }, UiFlags::ColorBlack); |
|
|
|
|
// Then draw the text over the top
|
|
|
|
|
DrawString(out, text, position, UiFlags::ColorWhite); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void PrintSBookHotkey(const Surface &out, Point position, const std::string &text) |
|
|
|
|
{ |
|
|
|
|
// Align the hot key text with the top-right corner of the spell icon
|
|
|
|
|
@ -710,13 +742,19 @@ void DrawSpellList(const Surface &out)
|
|
|
|
|
if (!spellListItem.isSelected) |
|
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
uint8_t spellColor = PAL16_GRAY + 5; |
|
|
|
|
|
|
|
|
|
switch (spellListItem.type) { |
|
|
|
|
case RSPLTYPE_SKILL: |
|
|
|
|
DrawSpellCel(out, spellListItem.location, *pSpellCels, SPLICONLAST + 3); |
|
|
|
|
spellColor = PAL16_YELLOW - 46; |
|
|
|
|
PrintSBookSpellType(out, spellListItem.location, _("Skill"), spellColor); |
|
|
|
|
strcpy(infostr, fmt::format(_("{:s} Skill"), pgettext("spell", spellDataItem.sSkillText)).c_str()); |
|
|
|
|
break; |
|
|
|
|
case RSPLTYPE_SPELL: |
|
|
|
|
DrawSpellCel(out, spellListItem.location, *pSpellCels, SPLICONLAST + 4); |
|
|
|
|
if (myPlayer.plrlevel != 0) { |
|
|
|
|
spellColor = PAL16_BLUE + 5; |
|
|
|
|
} |
|
|
|
|
PrintSBookSpellType(out, spellListItem.location, _("Spell"), spellColor); |
|
|
|
|
strcpy(infostr, fmt::format(_("{:s} Spell"), pgettext("spell", spellDataItem.sNameText)).c_str()); |
|
|
|
|
if (spellId == SPL_HBOLT) { |
|
|
|
|
strcpy(tempstr, _("Damages undead only")); |
|
|
|
|
@ -729,7 +767,10 @@ void DrawSpellList(const Surface &out)
|
|
|
|
|
AddPanelString(tempstr); |
|
|
|
|
break; |
|
|
|
|
case RSPLTYPE_SCROLL: { |
|
|
|
|
DrawSpellCel(out, spellListItem.location, *pSpellCels, SPLICONLAST + 1); |
|
|
|
|
if (myPlayer.plrlevel != 0) { |
|
|
|
|
spellColor = PAL16_RED - 59; |
|
|
|
|
} |
|
|
|
|
PrintSBookSpellType(out, spellListItem.location, _("Scroll"), spellColor); |
|
|
|
|
strcpy(infostr, fmt::format(_("Scroll of {:s}"), pgettext("spell", spellDataItem.sNameText)).c_str()); |
|
|
|
|
const InventoryAndBeltPlayerItemsRange items { myPlayer }; |
|
|
|
|
const int scrollCount = std::count_if(items.begin(), items.end(), [spellId](const Item &item) { |
|
|
|
|
@ -738,7 +779,10 @@ void DrawSpellList(const Surface &out)
|
|
|
|
|
strcpy(tempstr, fmt::format(ngettext("{:d} Scroll", "{:d} Scrolls", scrollCount), scrollCount).c_str()); |
|
|
|
|
} break; |
|
|
|
|
case RSPLTYPE_CHARGES: { |
|
|
|
|
DrawSpellCel(out, spellListItem.location, *pSpellCels, SPLICONLAST + 2); |
|
|
|
|
if (myPlayer.plrlevel != 0) { |
|
|
|
|
spellColor = PAL16_ORANGE + 5; |
|
|
|
|
} |
|
|
|
|
PrintSBookSpellType(out, spellListItem.location, _("Staff"), spellColor); |
|
|
|
|
strcpy(infostr, fmt::format(_("Staff of {:s}"), pgettext("spell", spellDataItem.sNameText)).c_str()); |
|
|
|
|
int charges = myPlayer.InvBody[INVLOC_HAND_LEFT]._iCharges; |
|
|
|
|
strcpy(tempstr, fmt::format(ngettext("{:d} Charge", "{:d} Charges", charges), charges).c_str()); |
|
|
|
|
|