-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMagicScreen.cpp
88 lines (70 loc) · 2.41 KB
/
MagicScreen.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// --------------------------------------------------------------------------------------------------------------------------------
// DEMISERL
// Copyright 2014 Corremn
//
// $LastChangedBy$
// $LastChangedDate$
// $LastChangedRevision$
// $HeadURL: $
// --------------------------------------------------------------------------------------------------------------------------------
#include ".\magicscreen.h"
#include "WorldBuilder.h"
MagicScreen::MagicScreen(void)
{
}
MagicScreen::~MagicScreen(void)
{
}
int MagicScreen::SelectSpell(bool *keys)
{
if (keys[VC_X] || keys[VK_ESC]) //inventory look
{
keys[VK_ESC] = false;
keys[VC_X] = false;
return 0;
}
else
{
return CastSpell(keys);
}
}
int MagicScreen::CastSpell(bool *keys)
{
int ret = 1;
for (int i = 65; i < 89; i++) //a - w
{
if (keys[i] == true)
{
MonsterData* player = World.getMonsterManager().Player();
//ret = World.getSpellManager().CallSpellRoutine(World.getMonsterManager().Player(),i-65);
ret = player->NextAction(World.getActionManager().UpdateAction(&player->action, aCastSpell, i - 65));
keys[i] = false;
break;
}
}
return ret; //return 0 for sucess or 1 for non valid spell. This will keep the screen open
}
void MagicScreen::Display()
{
World.getTextManager().ClearDisplayLines();
MonsterData* player = World.getMonsterManager().Player();
World.getTextManager().SetDisplayLine(0, "Spell List");
World.getTextManager().SetDisplayLine(1, "==========");
if (player->spellList.size() == 0)
{
World.getTextManager().SetDisplayLine(3, "You know no spells. ");
}
else
{
World.getTextManager().SetDisplayLine(3, "You shuffle your deck, you now have the power of Zagor at your command. ");
World.getTextManager().SetDisplayLine(5, " Spell Description");
}
MONSTERSPELLLIST::iterator sp;
int start = 7;
int i = start;
for (sp = player->spellList.begin(); sp != player->spellList.end(); sp++, i++)
{
World.getTextManager().SetDisplayLine(i, "(%c) %s %s ", i + 97 - start, (*sp)->Name(), (*sp)->Desription().c_str());
}
World.getTextManager().SetDisplayLine(39, "[a-d] to select spell, [x] to cancel");
}