ScummVM API documentation
create_characters.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_ENH_CREATE_CHARACTERS_H
23 #define MM1_VIEWS_ENH_CREATE_CHARACTERS_H
24 
25 #include "mm/mm1/data/roster.h"
26 #include "mm/mm1/views_enh/scroll_view.h"
27 #include "mm/mm1/views_enh/text_entry.h"
28 
29 namespace MM {
30 namespace MM1 {
31 namespace ViewsEnh {
32 
33 class CreateCharacters : public ScrollView {
34  enum State {
35  SELECT_CLASS, SELECT_RACE, SELECT_ALIGNMENT,
36  SELECT_SEX, SELECT_PORTRAIT, SELECT_NAME, SAVE_PROMPT
37  };
38  enum Attribute {
39  INTELLECT, MIGHT, PERSONALITY, ENDURANCE, SPEED,
40  ACCURACY, LUCK
41  };
42  struct NewCharacter {
43  private:
44  void setHP(int hp);
45  void setSP(int sp);
46  public:
48  uint8 _attribs1[LUCK + 1] = { 0 };
49  uint8 _attribs2[LUCK + 1] = { 0 };
50  CharacterClass _class = KNIGHT;
51  Race _race = HUMAN;
52  Alignment _alignment = GOOD;
53  Sex _sex = MALE;
54  Common::String _name;
55  int _portrait = 0;
56 
57  bool _classesAllowed[7] = { false };
58 
59  void clear();
60  void reroll();
61  void save();
62 
63  void loadPortrait();
64  };
65 
66 private:
67  TextEntry _textEntry;
68  static void abortFunc();
69  static void enterFunc(const Common::String &name);
71  State _state = SELECT_CLASS;
72  NewCharacter _newChar;
73  //int _portraitNum = 0;
74 
78  void printAttributes();
79 
83  void addSelection(int yStart, int num);
84 
88  void printClasses();
89 
93  void printRaces();
94 
98  void printAlignments();
99 
103  void printSexes();
104 
108  void printSelections();
109 
113  void printPortraits();
114 
118  void printSelectName();
119 
123  void printSummary();
124 
128  void setState(State state);
129 
130 public:
132  virtual ~CreateCharacters() {}
133 
134  bool msgFocus(const FocusMessage &msg) override;
135  void draw() override;
136  bool msgKeypress(const KeypressMessage &msg) override;
137  bool msgAction(const ActionMessage &msg) override;
138 };
139 
140 } // namespace ViewsEnh
141 } // namespace MM1
142 } // namespace MM
143 
144 #endif
Definition: str.h:59
Definition: sprites.h:52
Definition: text_entry.h:34
Definition: messages.h:56
Definition: scroll_view.h:35
Definition: messages.h:49
Definition: detection.h:27
Definition: create_characters.h:33
Definition: messages.h:41