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

Function DrawSpellList

Source/control.cpp:287–410  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

285}
286
287void DrawSpellList()
288{
289 int i, j, x, y, c, s, t, v, lx, ly, trans;
290 unsigned __int64 mask, spl;
291
292 pSpell = SPL_INVALID;
293 infostr[0] = '\0';
294 x = PANEL_X + 12 + 56 * 10;
295 y = PANEL_Y - 17;
296 ClearPanel();
297 for (i = 0; i < 4; i++) {
298 switch ((spell_type)i) {
299 case RSPLTYPE_SKILL:
300 SetSpellTrans(RSPLTYPE_SKILL);
301 c = 46;
302 mask = plr[myplr]._pAblSpells;
303 break;
304 case RSPLTYPE_SPELL:
305 c = 47;
306 mask = plr[myplr]._pMemSpells;
307 break;
308 case RSPLTYPE_SCROLL:
309 SetSpellTrans(RSPLTYPE_SCROLL);
310 c = 44;
311 mask = plr[myplr]._pScrlSpells;
312 break;
313 case RSPLTYPE_CHARGES:
314 SetSpellTrans(RSPLTYPE_CHARGES);
315 c = 45;
316 mask = plr[myplr]._pISpells;
317 break;
318 }
319 for (spl = 1, j = 1; j < MAX_SPELLS; spl <<= 1, j++) {
320 if (!(mask & spl))
321 continue;
322 if (i == RSPLTYPE_SPELL) {
323 s = plr[myplr]._pISplLvlAdd + plr[myplr]._pSplLvl[j];
324 if (s < 0)
325 s = 0;
326 if (s > 0)
327 trans = RSPLTYPE_SPELL;
328 else
329 trans = RSPLTYPE_INVALID;
330 SetSpellTrans(trans);
331 }
332 if (currlevel == 0 && !spelldata[j].sTownSpell)
333 SetSpellTrans(RSPLTYPE_INVALID);
334 DrawSpellCel(x, y, pSpellCels, SpellITbl[j], 56);
335 lx = x - BORDER_LEFT;
336 ly = y - BORDER_TOP - 56;
337 if (MouseX >= lx && MouseX < lx + 56 && MouseY >= ly && MouseY < ly + 56) {
338 pSpell = j;
339 pSplType = i;
340 DrawSpellCel(x, y, pSpellCels, c, 56);
341 switch (i) {
342 case RSPLTYPE_SKILL:
343 sprintf(infostr, "%s Skill", spelldata[pSpell].sSkillText);
344 break;

Callers 1

DrawViewFunction · 0.85

Calls 4

ClearPanelFunction · 0.85
SetSpellTransFunction · 0.85
DrawSpellCelFunction · 0.85
AddPanelStringFunction · 0.85

Tested by

no test coverage detected