MCPcopy Create free account
hub / github.com/diasurgical/devilution / DrawSpell

Function DrawSpell

Source/control.cpp:260–285  ·  view source on GitHub ↗

* Sets the spell frame to draw and its position then draws it. */

Source from the content-addressed store, hash-verified

258 * Sets the spell frame to draw and its position then draws it.
259 */
260void 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
287void DrawSpellList()
288{

Callers 1

UpdateManaFlaskFunction · 0.85

Calls 3

CheckSpellFunction · 0.85
SetSpellTransFunction · 0.85
DrawSpellCelFunction · 0.85

Tested by

no test coverage detected