forked from mirror/openmw-tes3mp
Finished handling of Create Class dialog, now a new class is created and set in the mechanics manager.
This commit is contained in:
parent
232164bfb0
commit
0cc8f84393
4 changed files with 134 additions and 5 deletions
|
@ -525,6 +525,51 @@ CreateClassDialog::~CreateClassDialog()
|
||||||
delete descDialog;
|
delete descDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string CreateClassDialog::getName() const
|
||||||
|
{
|
||||||
|
return editName->getOnlyText();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CreateClassDialog::getDescription() const
|
||||||
|
{
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
ESM::Class::Specialization CreateClassDialog::getSpecializationId() const
|
||||||
|
{
|
||||||
|
return specializationId;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<int> CreateClassDialog::getFavoriteAttributes() const
|
||||||
|
{
|
||||||
|
std::vector<int> v;
|
||||||
|
v.push_back(favoriteAttribute0->getAttributeId());
|
||||||
|
v.push_back(favoriteAttribute1->getAttributeId());
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<ESM::Skill::SkillEnum> CreateClassDialog::getMajorSkills() const
|
||||||
|
{
|
||||||
|
std::vector<ESM::Skill::SkillEnum> v;
|
||||||
|
v.push_back(majorSkill0->getSkillId());
|
||||||
|
v.push_back(majorSkill1->getSkillId());
|
||||||
|
v.push_back(majorSkill2->getSkillId());
|
||||||
|
v.push_back(majorSkill3->getSkillId());
|
||||||
|
v.push_back(majorSkill4->getSkillId());
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<ESM::Skill::SkillEnum> CreateClassDialog::getMinorSkills() const
|
||||||
|
{
|
||||||
|
std::vector<ESM::Skill::SkillEnum> v;
|
||||||
|
v.push_back(majorSkill0->getSkillId());
|
||||||
|
v.push_back(majorSkill1->getSkillId());
|
||||||
|
v.push_back(majorSkill2->getSkillId());
|
||||||
|
v.push_back(majorSkill3->getSkillId());
|
||||||
|
v.push_back(majorSkill4->getSkillId());
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
void CreateClassDialog::setNextButtonShow(bool shown)
|
void CreateClassDialog::setNextButtonShow(bool shown)
|
||||||
{
|
{
|
||||||
MyGUI::ButtonPtr descriptionButton;
|
MyGUI::ButtonPtr descriptionButton;
|
||||||
|
|
|
@ -288,8 +288,12 @@ namespace MWGui
|
||||||
CreateClassDialog(MWWorld::Environment& environment, MyGUI::IntSize gameWindowSize);
|
CreateClassDialog(MWWorld::Environment& environment, MyGUI::IntSize gameWindowSize);
|
||||||
virtual ~CreateClassDialog();
|
virtual ~CreateClassDialog();
|
||||||
|
|
||||||
// const std::string &getClassId() const { return currentClassId; }
|
std::string getName() const;
|
||||||
// void setClassId(const std::string &classId);
|
std::string getDescription() const;
|
||||||
|
ESM::Class::Specialization getSpecializationId() const;
|
||||||
|
std::vector<int> getFavoriteAttributes() const;
|
||||||
|
std::vector<ESM::Skill::SkillEnum> getMajorSkills() const;
|
||||||
|
std::vector<ESM::Skill::SkillEnum> getMinorSkills() const;
|
||||||
|
|
||||||
void setNextButtonShow(bool shown);
|
void setNextButtonShow(bool shown);
|
||||||
void open();
|
void open();
|
||||||
|
|
|
@ -25,6 +25,7 @@ WindowManager::WindowManager(MyGUI::Gui *_gui, MWWorld::Environment& environment
|
||||||
, generateClassQuestionDialog(nullptr)
|
, generateClassQuestionDialog(nullptr)
|
||||||
, generateClassResultDialog(nullptr)
|
, generateClassResultDialog(nullptr)
|
||||||
, pickClassDialog(nullptr)
|
, pickClassDialog(nullptr)
|
||||||
|
, createClassDialog(nullptr)
|
||||||
, birthSignDialog(nullptr)
|
, birthSignDialog(nullptr)
|
||||||
, nameChosen(false)
|
, nameChosen(false)
|
||||||
, raceChosen(false)
|
, raceChosen(false)
|
||||||
|
@ -74,6 +75,7 @@ WindowManager::~WindowManager()
|
||||||
delete generateClassQuestionDialog;
|
delete generateClassQuestionDialog;
|
||||||
delete generateClassResultDialog;
|
delete generateClassResultDialog;
|
||||||
delete pickClassDialog;
|
delete pickClassDialog;
|
||||||
|
delete createClassDialog;
|
||||||
delete birthSignDialog;
|
delete birthSignDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,8 +165,12 @@ void WindowManager::updateVisible()
|
||||||
|
|
||||||
if (mode == GM_ClassCreate)
|
if (mode == GM_ClassCreate)
|
||||||
{
|
{
|
||||||
CreateClassDialog *ccd = new CreateClassDialog(environment, gui->getViewSize());
|
if (createClassDialog)
|
||||||
ccd->open();
|
delete createClassDialog;
|
||||||
|
createClassDialog = new CreateClassDialog(environment, gui->getViewSize());
|
||||||
|
createClassDialog->eventDone = MyGUI::newDelegate(this, &WindowManager::onCreateClassDialogDone);
|
||||||
|
createClassDialog->eventBack = MyGUI::newDelegate(this, &WindowManager::onCreateClassDialogBack);
|
||||||
|
createClassDialog->open();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -439,6 +445,9 @@ void WindowManager::onClassQuestionChosen(MyGUI::Widget* _sender, int _index)
|
||||||
|
|
||||||
void WindowManager::onGenerateClassBack()
|
void WindowManager::onGenerateClassBack()
|
||||||
{
|
{
|
||||||
|
bool goNext = classChosen; // Go to next dialog if class was previously chosen
|
||||||
|
classChosen = true;
|
||||||
|
|
||||||
if (generateClassResultDialog)
|
if (generateClassResultDialog)
|
||||||
{
|
{
|
||||||
generateClassResultDialog->setVisible(false);
|
generateClassResultDialog->setVisible(false);
|
||||||
|
@ -452,6 +461,9 @@ void WindowManager::onGenerateClassBack()
|
||||||
|
|
||||||
void WindowManager::onGenerateClassDone()
|
void WindowManager::onGenerateClassDone()
|
||||||
{
|
{
|
||||||
|
bool goNext = classChosen; // Go to next dialog if class was previously chosen
|
||||||
|
classChosen = true;
|
||||||
|
|
||||||
if (generateClassResultDialog)
|
if (generateClassResultDialog)
|
||||||
{
|
{
|
||||||
generateClassResultDialog->setVisible(false);
|
generateClassResultDialog->setVisible(false);
|
||||||
|
@ -460,7 +472,12 @@ void WindowManager::onGenerateClassDone()
|
||||||
|
|
||||||
updateCharacterGeneration();
|
updateCharacterGeneration();
|
||||||
|
|
||||||
environment.mInputManager->setGuiMode(GM_Review);
|
if (reviewNext)
|
||||||
|
environment.mInputManager->setGuiMode(GM_Review);
|
||||||
|
else if (goNext)
|
||||||
|
environment.mInputManager->setGuiMode(GM_Birth);
|
||||||
|
else
|
||||||
|
environment.mInputManager->setGuiMode(GM_Game);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -499,6 +516,63 @@ void WindowManager::onPickClassDialogBack()
|
||||||
environment.mInputManager->setGuiMode(GM_Class);
|
environment.mInputManager->setGuiMode(GM_Class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WindowManager::onCreateClassDialogDone()
|
||||||
|
{
|
||||||
|
createClassDialog->eventDone = MWGui::CreateClassDialog::EventHandle_Void();
|
||||||
|
|
||||||
|
bool goNext = classChosen; // Go to next dialog if class was previously chosen
|
||||||
|
classChosen = true;
|
||||||
|
if (createClassDialog)
|
||||||
|
{
|
||||||
|
createClassDialog->setVisible(false);
|
||||||
|
|
||||||
|
// TODO: The ESM::Class should have methods to set these values to ensure correct data is assigned
|
||||||
|
ESM::Class klass;
|
||||||
|
klass.name = createClassDialog->getName();
|
||||||
|
klass.description = createClassDialog->getDescription();
|
||||||
|
klass.data.specialization = createClassDialog->getSpecializationId();
|
||||||
|
klass.data.isPlayable = 0x1;
|
||||||
|
|
||||||
|
std::vector<int> attributes = createClassDialog->getFavoriteAttributes();
|
||||||
|
assert(attributes.size() == 2);
|
||||||
|
klass.data.attribute[0] = attributes[0];
|
||||||
|
klass.data.attribute[1] = attributes[1];
|
||||||
|
|
||||||
|
std::vector<ESM::Skill::SkillEnum> majorSkills = createClassDialog->getMajorSkills();
|
||||||
|
std::vector<ESM::Skill::SkillEnum> minorSkills = createClassDialog->getMinorSkills();
|
||||||
|
assert(majorSkills.size() >= sizeof(klass.data.skills)/sizeof(klass.data.skills[0]));
|
||||||
|
assert(minorSkills.size() >= sizeof(klass.data.skills)/sizeof(klass.data.skills[0]));
|
||||||
|
for (size_t i = 0; i < sizeof(klass.data.skills)/sizeof(klass.data.skills[0]); ++i)
|
||||||
|
{
|
||||||
|
klass.data.skills[i][1] = majorSkills[i];
|
||||||
|
klass.data.skills[i][0] = minorSkills[i];
|
||||||
|
}
|
||||||
|
environment.mMechanicsManager->setPlayerClass(klass);
|
||||||
|
}
|
||||||
|
|
||||||
|
updateCharacterGeneration();
|
||||||
|
|
||||||
|
if (reviewNext)
|
||||||
|
environment.mInputManager->setGuiMode(GM_Review);
|
||||||
|
else if (goNext)
|
||||||
|
environment.mInputManager->setGuiMode(GM_Birth);
|
||||||
|
else
|
||||||
|
environment.mInputManager->setGuiMode(GM_Game);
|
||||||
|
}
|
||||||
|
|
||||||
|
void WindowManager::onCreateClassDialogBack()
|
||||||
|
{
|
||||||
|
if (pickClassDialog)
|
||||||
|
{
|
||||||
|
pickClassDialog->setVisible(false);
|
||||||
|
environment.mMechanicsManager->setPlayerClass(pickClassDialog->getClassId());
|
||||||
|
}
|
||||||
|
|
||||||
|
updateCharacterGeneration();
|
||||||
|
|
||||||
|
environment.mInputManager->setGuiMode(GM_Class);
|
||||||
|
}
|
||||||
|
|
||||||
void WindowManager::onBirthSignDialogDone()
|
void WindowManager::onBirthSignDialogDone()
|
||||||
{
|
{
|
||||||
birthSignDialog->eventDone = MWGui::BirthDialog::EventHandle_Void();
|
birthSignDialog->eventDone = MWGui::BirthDialog::EventHandle_Void();
|
||||||
|
|
|
@ -48,6 +48,7 @@ namespace MWGui
|
||||||
class ClassChoiceDialog;
|
class ClassChoiceDialog;
|
||||||
class GenerateClassResultDialog;
|
class GenerateClassResultDialog;
|
||||||
class PickClassDialog;
|
class PickClassDialog;
|
||||||
|
class CreateClassDialog;
|
||||||
class BirthDialog;
|
class BirthDialog;
|
||||||
|
|
||||||
class WindowManager
|
class WindowManager
|
||||||
|
@ -69,6 +70,7 @@ namespace MWGui
|
||||||
InfoBoxDialog *generateClassQuestionDialog;
|
InfoBoxDialog *generateClassQuestionDialog;
|
||||||
GenerateClassResultDialog *generateClassResultDialog;
|
GenerateClassResultDialog *generateClassResultDialog;
|
||||||
PickClassDialog *pickClassDialog;
|
PickClassDialog *pickClassDialog;
|
||||||
|
CreateClassDialog *createClassDialog;
|
||||||
BirthDialog *birthSignDialog;
|
BirthDialog *birthSignDialog;
|
||||||
|
|
||||||
// Which dialogs have been shown, controls back/next/ok buttons
|
// Which dialogs have been shown, controls back/next/ok buttons
|
||||||
|
@ -213,6 +215,10 @@ namespace MWGui
|
||||||
void onPickClassDialogDone();
|
void onPickClassDialogDone();
|
||||||
void onPickClassDialogBack();
|
void onPickClassDialogBack();
|
||||||
|
|
||||||
|
// Character generation: Create Class dialog
|
||||||
|
void onCreateClassDialogDone();
|
||||||
|
void onCreateClassDialogBack();
|
||||||
|
|
||||||
// Character generation: Birth sign dialog
|
// Character generation: Birth sign dialog
|
||||||
void onBirthSignDialogDone();
|
void onBirthSignDialogDone();
|
||||||
void onBirthSignDialogBack();
|
void onBirthSignDialogBack();
|
||||||
|
|
Loading…
Reference in a new issue