xoreos  0.0.5
charactergeneration.cpp
Go to the documentation of this file.
1 /* xoreos - A reimplementation of BioWare's Aurora engine
2  *
3  * xoreos is the legal property of its developers, whose names
4  * can be found in the AUTHORS file distributed with this source
5  * distribution.
6  *
7  * xoreos is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 3
10  * of the License, or (at your option) any later version.
11  *
12  * xoreos 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 xoreos. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
25 #include "src/aurora/talkman.h"
26 
34 
35 namespace Engines {
36 
37 namespace KotOR2 {
38 
40  GUI(console), _module(module), _chargenInfo(info), _step(0) {
41  load("maincg_p");
42 
43  switch (_chargenInfo->getClass()) {
44  case kClassJediConsular:
45  getLabel("LBL_CLASS")->setText(TalkMan.getString(354));
46  break;
47  case kClassJediGuardian:
48  getLabel("LBL_CLASS")->setText(TalkMan.getString(355));
49  break;
50  case kClassJediSentinel:
51  getLabel("LBL_CLASS")->setText(TalkMan.getString(353));
52  break;
53  default:
54  getLabel("LBL_CLASS")->setText("");
55  }
56 
57  getLabel("LBL_NAME")->setText("");
58  getLabel("LBL_LEVEL_VAL")->setText("");
59 
60  getLabel("PORTRAIT_LBL")->setFill(_chargenInfo->getPortrait());
61 
63 }
64 
66  if (_quickCharPanel)
68  if (_customCharPanel)
70 
71  _quickOrCustomPanel.reset(new QuickOrCustomPanel(this));
73 }
74 
77 
78  _quickCharPanel.reset(new QuickCharPanel(this));
80 }
81 
84 
85  _customCharPanel.reset(new CustomCharPanel(this));
87 }
88 
91 
93  sub(*_charGenMenu, kStartCodeNone, true, false);
94 
95  if (_charGenMenu->isAccepted()) {
96  _step += 1;
97  _chargenInfo->setName(info.getName());
98  getLabel("LBL_NAME")->setText(_chargenInfo->getName());
99  }
100 }
101 
104 
106  sub(*_charGenMenu);
107 
108  if (_charGenMenu->isAccepted()) {
109  _step += 1;
110  _chargenInfo->setFace(info.getFace());
111  _chargenInfo->setSkin(info.getSkin());
112  getLabel("PORTRAIT_LBL")->setFill(_chargenInfo->getPortrait());
113  }
114 }
115 
117  return _step;
118 }
119 
121  _step = MIN(0, _step - 1);
122 }
123 
125  _step = 0;
126 }
127 
129  try {
131  _module->load("001EBO");
132  } catch (...) {
134  return;
135  }
136 
137  _returnCode = 2;
138 }
139 
140 } // End of namespace KotOR2
141 
142 } // End of namespace Engines
void load(const Common::UString &resref)
Definition: gui.cpp:103
void setFill(const Common::UString &fill)
const Common::UString & getName() const
Get the name of the character.
A label widget for Star Wars: Knights of the Old Republic and Jade Empire.
#define TalkMan
Shortcut for accessing the talk manager.
Definition: talkman.h:111
uint32 _returnCode
The GUI&#39;s return code.
Definition: gui.h:75
Common::ScopedPtr< GUI > _quickCharPanel
The KotOR 2 custom character panel.
CharacterGenerationInfo * _chargenInfo
The KotOR 2 quick character panel.
Common::ScopedPtr< GUI > _quickOrCustomPanel
void load(const Common::UString &module, const Common::UString &entryLocation="", ObjectType entryLocationType=kObjectTypeAll)
Load a module.
Definition: module.cpp:103
The KotOR 2 quick or custom panel.
void setFace(unsigned int face)
Set the face index of the character.
void setSkin(Skin skin)
Set the skin type of the Character.
void exceptionDispatcherWarning(const char *s,...)
Exception dispatcher that prints the exception as a warning, and adds another reason on top...
Definition: error.cpp:158
void removeChild(GUI *gui)
Remove a child GUI object from this GUI.
Definition: gui.cpp:245
Common::ScopedPtr< CharacterGenerationBaseMenu > _charGenMenu
The KotOR 2 character generation portrait menu.
void info(const char *s,...)
Definition: util.cpp:69
T MIN(T a, T b)
Definition: util.h:70
uint32 sub(GUI &gui, uint32 startCode=kStartCodeNone, bool showSelf=true, bool hideSelf=true)
Open up a sub GUI.
Definition: gui.cpp:349
void usePC(Creature *pc)
Use this character as the player character.
Definition: module.cpp:143
CharacterGeneration(Module *module, CharacterGenerationInfo *info, Engines::Console *console=0)
WidgetLabel * getLabel(const Common::UString &tag, bool vital=false)
Definition: gui.cpp:204
The global talk manager for Aurora strings.
The KotOR 2 character generation name menu.
Common::ScopedPtr< GUI > _customCharPanel
void setText(const Common::UString &text)
void setName(const Common::UString &name)
Set the name of the Character.
static const uint32 kStartCodeNone
Definition: gui.h:45
The KotOR 2 character generation.
Creature * getCharacter() const
Create a creature object from the info.
void addChild(GUI *gui)
Add a child GUI object to this GUI.
Definition: gui.cpp:240