ScummVM API documentation
cast_spell.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef MM1_VIEWS_SPELLS_CAST_SPELL_H
23 #define MM1_VIEWS_SPELLS_CAST_SPELL_H
24 
25 #include "mm/mm1/views/spells/spell_view.h"
26 #include "mm/mm1/views/text_entry.h"
27 #include "mm/mm1/game/spell_casting.h"
28 
29 namespace MM {
30 namespace MM1 {
31 namespace Views {
32 namespace Spells {
33 
35  enum State {
36  NONE, SELECT_SPELL, SELECT_NUMBER, SELECT_CHAR, PRESS_ENTER, ENDING
37  };
38 private:
39  State _state = SELECT_SPELL;
40  TextEntry _textEntry;
41  static void abortFunc();
42  static void enterSpellLevelFunc(const Common::String &text);
43  static void enterSpellNumberFunc(const Common::String &text);
44  int _spellLevel = -1;
45  int _spellNumber = -1;
46  Common::String _spellResult;
47  int _spellResultX = -1;
48 
49 private:
53  void setState(State state);
54 
58  void spellLevelEntered(uint level);
59 
63  void spellNumberEntered(uint num);
64 
68  void performSpell(Character *chr = nullptr);
69 
73  void spellDone();
74  void spellDone(const Common::String &msg, int xp);
75 public:
76  CastSpell();
77  virtual ~CastSpell() {
78  }
79 
80  bool msgGame(const GameMessage &msg) override;
81  bool msgFocus(const FocusMessage &msg) override;
82  void draw() override;
83  bool msgAction(const ActionMessage &msg) override;
84  void timeout() override;
85 };
86 
87 } // namespace Spells
88 } // namespace Views
89 } // namespace MM1
90 } // namespace MM
91 
92 #endif
Definition: str.h:59
Definition: spell_casting.h:40
Definition: messages.h:49
Definition: cast_spell.h:34
Definition: text_entry.h:34
Definition: detection.h:27
Definition: character.h:432
Definition: messages.h:87
Definition: spell_view.h:33
Definition: messages.h:41