* Sets the spell frame to draw and its position then draws it. */
| 258 | * Sets the spell frame to draw and its position then draws it. |
| 259 | */ |
| 260 | void DrawSpell() |
| 261 | { |
| 262 | char st; |
| 263 | int spl, tlvl; |
| 264 | |
| 265 | spl = plr[myplr]._pRSpell; |
| 266 | st = plr[myplr]._pRSplType; |
| 267 | |
| 268 | // BUGFIX: Move the next line into the if statement to avoid OOB (SPL_INVALID is -1) (fixed) |
| 269 | if (st == RSPLTYPE_SPELL && spl != SPL_INVALID) { |
| 270 | tlvl = plr[myplr]._pISplLvlAdd + plr[myplr]._pSplLvl[spl]; |
| 271 | if (!CheckSpell(myplr, spl, RSPLTYPE_SPELL, TRUE)) |
| 272 | st = RSPLTYPE_INVALID; |
| 273 | if (tlvl <= 0) |
| 274 | st = RSPLTYPE_INVALID; |
| 275 | } |
| 276 | if (!currlevel && st != RSPLTYPE_INVALID && !spelldata[spl].sTownSpell) |
| 277 | st = RSPLTYPE_INVALID; |
| 278 | if (plr[myplr]._pRSpell < 0) |
| 279 | st = RSPLTYPE_INVALID; |
| 280 | SetSpellTrans(st); |
| 281 | if (spl != SPL_INVALID) |
| 282 | DrawSpellCel(PANEL_X + 565, PANEL_Y + 119, pSpellCels, SpellITbl[spl], 56); |
| 283 | else |
| 284 | DrawSpellCel(PANEL_X + 565, PANEL_Y + 119, pSpellCels, 27, 56); |
| 285 | } |
| 286 | |
| 287 | void DrawSpellList() |
| 288 | { |
no test coverage detected