| 1742 | } |
| 1743 | |
| 1744 | void DrawSpellBook() |
| 1745 | { |
| 1746 | int i, sn, mana, lvl, yp, min, max; |
| 1747 | char st; |
| 1748 | unsigned __int64 spl; |
| 1749 | |
| 1750 | CelDraw(RIGHT_PANEL_X, 351 + SCREEN_Y, pSpellBkCel, 1, SPANEL_WIDTH); |
| 1751 | CelDraw(RIGHT_PANEL_X + 76 * sbooktab + 7, 348 + SCREEN_Y, pSBkBtnCel, sbooktab + 1, 76); |
| 1752 | |
| 1753 | spl = plr[myplr]._pMemSpells | plr[myplr]._pISpells | plr[myplr]._pAblSpells; |
| 1754 | |
| 1755 | yp = 215; |
| 1756 | for (i = 1; i < 8; i++) { |
| 1757 | sn = SpellPages[sbooktab][i - 1]; |
| 1758 | if (sn != -1 && spl & (__int64)1 << (sn - 1)) { |
| 1759 | st = GetSBookTrans(sn, TRUE); |
| 1760 | SetSpellTrans(st); |
| 1761 | DrawSpellCel(RIGHT_PANEL + 75, yp, pSBkIconCels, SpellITbl[sn], 37); |
| 1762 | if (sn == plr[myplr]._pRSpell && st == plr[myplr]._pRSplType) { |
| 1763 | SetSpellTrans(RSPLTYPE_SKILL); |
| 1764 | DrawSpellCel(RIGHT_PANEL + 75, yp, pSBkIconCels, 43, 37); |
| 1765 | } |
| 1766 | PrintSBookStr(10, yp - 23, FALSE, spelldata[sn].sNameText, COL_WHITE); |
| 1767 | switch (GetSBookTrans(sn, FALSE)) { |
| 1768 | case RSPLTYPE_SKILL: |
| 1769 | strcpy(tempstr, "Skill"); |
| 1770 | break; |
| 1771 | case RSPLTYPE_CHARGES: |
| 1772 | sprintf(tempstr, "Staff (%i charges)", plr[myplr].InvBody[INVLOC_HAND_LEFT]._iCharges); |
| 1773 | break; |
| 1774 | default: |
| 1775 | mana = GetManaAmount(myplr, sn) >> 6; |
| 1776 | GetDamageAmt(sn, &min, &max); |
| 1777 | if (min != -1) { |
| 1778 | sprintf(tempstr, "Mana: %i Dam: %i - %i", mana, min, max); |
| 1779 | } else { |
| 1780 | sprintf(tempstr, "Mana: %i Dam: n/a", mana); |
| 1781 | } |
| 1782 | if (sn == SPL_BONESPIRIT) { |
| 1783 | sprintf(tempstr, "Mana: %i Dam: 1/3 tgt hp", mana); |
| 1784 | } |
| 1785 | PrintSBookStr(10, yp - 1, FALSE, tempstr, COL_WHITE); |
| 1786 | lvl = plr[myplr]._pSplLvl[sn] + plr[myplr]._pISplLvlAdd; |
| 1787 | if (lvl < 0) { |
| 1788 | lvl = 0; |
| 1789 | } |
| 1790 | if (lvl == 0) { |
| 1791 | sprintf(tempstr, "Spell Level 0 - Unusable"); |
| 1792 | } else { |
| 1793 | sprintf(tempstr, "Spell Level %i", lvl); |
| 1794 | } |
| 1795 | break; |
| 1796 | } |
| 1797 | PrintSBookStr(10, yp - 12, FALSE, tempstr, COL_WHITE); |
| 1798 | } |
| 1799 | yp += 43; |
| 1800 | } |
| 1801 | } |
no test coverage detected