1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-30 03:32:36 +00:00
OpenMW/apps/openmw/mwgui/charactercreation.hpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

137 lines
4.3 KiB
C++
Raw Normal View History

2012-01-30 19:27:49 +02:00
#ifndef CHARACTER_CREATION_HPP
#define CHARACTER_CREATION_HPP
#include <components/esm3/loadclas.hpp>
2014-02-23 20:11:05 +01:00
#include <map>
#include <memory>
2015-01-10 01:00:52 +01:00
#include <vector>
2020-06-05 18:22:53 +04:00
#include "statswatcher.hpp"
namespace osg
2015-05-20 02:18:20 +02:00
{
class Group;
2015-05-20 02:18:20 +02:00
}
namespace Resource
{
class ResourceSystem;
}
2012-01-30 19:27:49 +02:00
namespace MWGui
{
class WindowBase;
2012-01-30 19:27:49 +02:00
class TextInputDialog;
class InfoBoxDialog;
class RaceDialog;
class DialogueWindow;
class ClassChoiceDialog;
class GenerateClassResultDialog;
class PickClassDialog;
class CreateClassDialog;
class BirthDialog;
class ReviewDialog;
class MessageBoxManager;
2020-06-05 18:22:53 +04:00
class CharacterCreation : public StatsListener
2012-01-30 19:27:49 +02:00
{
public:
CharacterCreation(osg::Group* parent, Resource::ResourceSystem* resourceSystem);
2020-06-05 18:22:53 +04:00
virtual ~CharacterCreation();
2012-01-30 19:27:49 +02:00
// Show a dialog
void spawnDialog(const char id);
2023-08-03 20:21:44 +02:00
void setAttribute(ESM::RefId id, const MWMechanics::AttributeValue& value) override;
void setValue(std::string_view id, const MWMechanics::DynamicStat<float>& value) override;
2023-06-06 12:35:01 +02:00
void setValue(ESM::RefId id, const MWMechanics::SkillValue& value) override;
void configureSkills(const std::vector<ESM::RefId>& major, const std::vector<ESM::RefId>& minor) override;
void onFrame(float duration);
2012-01-30 19:27:49 +02:00
private:
osg::Group* mParent;
2015-05-20 02:18:20 +02:00
Resource::ResourceSystem* mResourceSystem;
2022-09-22 21:26:05 +03:00
std::vector<ESM::RefId> mPlayerMajorSkills, mPlayerMinorSkills;
2023-08-03 20:21:44 +02:00
std::map<ESM::RefId, MWMechanics::AttributeValue> mPlayerAttributes;
2023-06-06 12:35:01 +02:00
std::map<ESM::RefId, MWMechanics::SkillValue> mPlayerSkillValues;
2022-09-22 21:26:05 +03:00
2012-01-30 19:27:49 +02:00
// Dialogs
std::unique_ptr<TextInputDialog> mNameDialog;
std::unique_ptr<RaceDialog> mRaceDialog;
std::unique_ptr<ClassChoiceDialog> mClassChoiceDialog;
std::unique_ptr<InfoBoxDialog> mGenerateClassQuestionDialog;
std::unique_ptr<GenerateClassResultDialog> mGenerateClassResultDialog;
std::unique_ptr<PickClassDialog> mPickClassDialog;
std::unique_ptr<CreateClassDialog> mCreateClassDialog;
std::unique_ptr<BirthDialog> mBirthSignDialog;
std::unique_ptr<ReviewDialog> mReviewDialog;
2022-09-22 21:26:05 +03:00
2012-01-30 19:27:49 +02:00
// Player data
std::string mPlayerName;
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID Slowly going through all the changes to make, still hundreds of errors a lot of functions/structures use std::string or stringview to designate an ID. So it takes time Continues slowly replacing ids. There are technically more and more compilation errors I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type Continue moving forward, changes to the stores slowly moving along Starting to see the fruit of those changes. still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type. More replacements. Things are starting to get easier I can see more and more often the issue is that the function is awaiting a RefId, but is given a string there is less need to go down functions and to fix a long list of them. Still moving forward, and for the first time error count is going down! Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably Cells are back to using string for the name, haven't fixed everything yet. Many other changes Under the bar of 400 compilation errors. more good progress <100 compile errors! More progress Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string some more progress on other fronts Mostly game settings clean one error opened a lot of other errors. Down to 18, but more will prbably appear only link errors left?? Fixed link errors OpenMW compiles, and launches, with some issues, but still!
2022-09-25 13:17:09 +02:00
ESM::RefId mPlayerRaceId;
ESM::RefId mPlayerBirthSignId;
ESM::Class mPlayerClass;
2022-09-22 21:26:05 +03:00
// Class generation vars
unsigned mGenerateClassStep; // Keeps track of current step in Generate Class dialog
2019-08-12 00:22:02 +12:00
ESM::Class::Specialization mGenerateClassResponses[3];
unsigned mGenerateClassSpecializations[3]; // A counter for each specialization which is increased when an
// answer is chosen
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID Slowly going through all the changes to make, still hundreds of errors a lot of functions/structures use std::string or stringview to designate an ID. So it takes time Continues slowly replacing ids. There are technically more and more compilation errors I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type Continue moving forward, changes to the stores slowly moving along Starting to see the fruit of those changes. still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type. More replacements. Things are starting to get easier I can see more and more often the issue is that the function is awaiting a RefId, but is given a string there is less need to go down functions and to fix a long list of them. Still moving forward, and for the first time error count is going down! Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably Cells are back to using string for the name, haven't fixed everything yet. Many other changes Under the bar of 400 compilation errors. more good progress <100 compile errors! More progress Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string some more progress on other fronts Mostly game settings clean one error opened a lot of other errors. Down to 18, but more will prbably appear only link errors left?? Fixed link errors OpenMW compiles, and launches, with some issues, but still!
2022-09-25 13:17:09 +02:00
ESM::RefId mGenerateClass; // In order: Combat, Magic, Stealth
2022-09-22 21:26:05 +03:00
2012-01-30 19:27:49 +02:00
////Dialog events
// Name dialog
void onNameDialogDone(WindowBase* parWindow);
2022-09-22 21:26:05 +03:00
2012-01-30 19:27:49 +02:00
// Race dialog
void onRaceDialogDone(WindowBase* parWindow);
void onRaceDialogBack();
void selectRace();
2022-09-22 21:26:05 +03:00
// Class dialogs
2012-01-30 19:27:49 +02:00
void onClassChoice(int _index);
void onPickClassDialogDone(WindowBase* parWindow);
void onPickClassDialogBack();
void onCreateClassDialogDone(WindowBase* parWindow);
void onCreateClassDialogBack();
void showClassQuestionDialog();
void onClassQuestionChosen(int _index);
void onGenerateClassBack();
void onGenerateClassDone(WindowBase* parWindow);
void selectGeneratedClass();
void selectCreatedClass();
void selectPickedClass();
2022-09-22 21:26:05 +03:00
// Birthsign dialog
void onBirthSignDialogDone(WindowBase* parWindow);
void onBirthSignDialogBack();
void selectBirthSign();
2022-09-22 21:26:05 +03:00
// Review dialog
void onReviewDialogDone(WindowBase* parWindow);
void onReviewDialogBack();
void onReviewActivateDialog(int parDialog);
2022-09-22 21:26:05 +03:00
enum CSE // Creation Stage Enum
2012-01-30 19:27:49 +02:00
{
CSE_NotStarted,
CSE_NameChosen,
CSE_RaceChosen,
CSE_ClassChosen,
CSE_BirthSignChosen,
CSE_ReviewBack,
CSE_ReviewNext
2012-01-30 19:27:49 +02:00
};
2022-09-22 21:26:05 +03:00
CSE mCreationStage; // Which state the character creating is in, controls back/next/ok buttons
2022-09-22 21:26:05 +03:00
2015-03-12 00:43:28 +01:00
void handleDialogDone(CSE currentStage, int nextMode);
};
2012-01-30 19:27:49 +02:00
}
#endif