2010-09-14 20:13:26 +00:00
|
|
|
#ifndef MWGUI_RACE_H
|
|
|
|
#define MWGUI_RACE_H
|
2010-09-12 12:06:10 +00:00
|
|
|
|
2012-09-14 22:57:29 +00:00
|
|
|
#include "../mwrender/characterpreview.hpp"
|
|
|
|
|
2013-04-10 04:32:05 +00:00
|
|
|
#include "windowbase.hpp"
|
2010-09-12 12:06:10 +00:00
|
|
|
|
|
|
|
|
2011-02-21 19:36:35 +00:00
|
|
|
namespace MWGui
|
2010-09-14 12:16:26 +00:00
|
|
|
{
|
2011-02-21 19:36:35 +00:00
|
|
|
class WindowManager;
|
2010-09-14 12:16:26 +00:00
|
|
|
}
|
|
|
|
|
2010-09-12 12:06:10 +00:00
|
|
|
/*
|
2010-09-14 20:15:35 +00:00
|
|
|
This file contains the dialog for choosing a race.
|
2012-07-03 09:34:20 +00:00
|
|
|
Layout is defined by resources/mygui/openmw_chargen_race.layout.
|
2010-09-12 12:06:10 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
namespace MWGui
|
|
|
|
{
|
2013-02-25 05:57:32 +00:00
|
|
|
class RaceDialog : public WindowModal
|
2010-09-14 19:55:41 +00:00
|
|
|
{
|
|
|
|
public:
|
2013-04-10 18:46:21 +00:00
|
|
|
RaceDialog();
|
2010-09-14 19:27:40 +00:00
|
|
|
|
|
|
|
enum Gender
|
|
|
|
{
|
|
|
|
GM_Male,
|
|
|
|
GM_Female
|
|
|
|
};
|
|
|
|
|
2012-11-10 07:41:12 +00:00
|
|
|
const ESM::NPC &getResult() const { return mPreview->getPrototype(); }
|
2012-07-13 10:51:58 +00:00
|
|
|
const std::string &getRaceId() const { return mCurrentRaceId; }
|
|
|
|
Gender getGender() const { return mGenderIndex == 0 ? GM_Male : GM_Female; }
|
2010-09-14 19:27:40 +00:00
|
|
|
// getFace()
|
|
|
|
// getHair()
|
2010-09-14 12:16:26 +00:00
|
|
|
|
2010-09-15 11:04:57 +00:00
|
|
|
void setRaceId(const std::string &raceId);
|
2012-07-13 10:51:58 +00:00
|
|
|
void setGender(Gender gender) { mGenderIndex = gender == GM_Male ? 0 : 1; }
|
2010-09-14 19:27:40 +00:00
|
|
|
// setFace()
|
|
|
|
// setHair()
|
2010-09-12 12:06:10 +00:00
|
|
|
|
2010-09-15 17:37:06 +00:00
|
|
|
void setNextButtonShow(bool shown);
|
2012-08-27 19:29:04 +00:00
|
|
|
virtual void open();
|
2012-09-23 22:42:05 +00:00
|
|
|
virtual void close();
|
2010-09-15 17:37:06 +00:00
|
|
|
|
2010-09-14 17:33:40 +00:00
|
|
|
// Events
|
2012-09-10 07:10:50 +00:00
|
|
|
typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void;
|
2010-09-14 17:33:40 +00:00
|
|
|
|
|
|
|
/** Event : Back button clicked.\n
|
2010-09-14 19:55:41 +00:00
|
|
|
signature : void method()\n
|
|
|
|
*/
|
|
|
|
EventHandle_Void eventBack;
|
2010-09-14 17:33:40 +00:00
|
|
|
|
2014-09-07 01:21:24 +00:00
|
|
|
/** Event : Dialog finished, OK button clicked.\n
|
|
|
|
signature : void method()\n
|
|
|
|
*/
|
|
|
|
EventHandle_WindowBase eventDone;
|
|
|
|
|
2013-07-06 15:02:40 +00:00
|
|
|
void doRenderUpdate();
|
|
|
|
|
2010-09-14 17:33:40 +00:00
|
|
|
protected:
|
2012-03-22 14:23:23 +00:00
|
|
|
void onHeadRotate(MyGUI::ScrollBar* _sender, size_t _position);
|
2010-09-12 12:06:10 +00:00
|
|
|
|
2010-09-14 19:55:41 +00:00
|
|
|
void onSelectPreviousGender(MyGUI::Widget* _sender);
|
|
|
|
void onSelectNextGender(MyGUI::Widget* _sender);
|
2010-09-12 12:06:10 +00:00
|
|
|
|
2010-09-14 19:55:41 +00:00
|
|
|
void onSelectPreviousFace(MyGUI::Widget* _sender);
|
|
|
|
void onSelectNextFace(MyGUI::Widget* _sender);
|
2010-09-12 12:06:10 +00:00
|
|
|
|
2010-09-14 19:55:41 +00:00
|
|
|
void onSelectPreviousHair(MyGUI::Widget* _sender);
|
|
|
|
void onSelectNextHair(MyGUI::Widget* _sender);
|
2010-09-12 12:06:10 +00:00
|
|
|
|
2012-03-22 14:28:06 +00:00
|
|
|
void onSelectRace(MyGUI::ListBox* _sender, size_t _index);
|
2014-01-28 19:12:37 +00:00
|
|
|
void onAccept(MyGUI::ListBox* _sender, size_t _index);
|
2010-09-12 12:06:10 +00:00
|
|
|
|
2010-09-14 17:33:40 +00:00
|
|
|
void onOkClicked(MyGUI::Widget* _sender);
|
|
|
|
void onBackClicked(MyGUI::Widget* _sender);
|
|
|
|
|
2010-09-14 19:55:41 +00:00
|
|
|
private:
|
|
|
|
void updateRaces();
|
|
|
|
void updateSkills();
|
|
|
|
void updateSpellPowers();
|
2012-11-10 15:57:50 +00:00
|
|
|
void updatePreview();
|
2012-11-10 17:30:16 +00:00
|
|
|
void recountParts();
|
2010-09-12 12:06:10 +00:00
|
|
|
|
2013-04-17 22:19:34 +00:00
|
|
|
void getBodyParts (int part, std::vector<std::string>& out);
|
|
|
|
|
|
|
|
std::vector<std::string> mAvailableHeads;
|
|
|
|
std::vector<std::string> mAvailableHairs;
|
2013-03-30 19:04:05 +00:00
|
|
|
|
2012-09-13 17:03:31 +00:00
|
|
|
MyGUI::ImageBox* mPreviewImage;
|
2012-07-13 10:51:58 +00:00
|
|
|
MyGUI::ListBox* mRaceList;
|
|
|
|
MyGUI::ScrollBar* mHeadRotate;
|
2010-09-12 12:06:10 +00:00
|
|
|
|
2013-03-03 12:11:02 +00:00
|
|
|
MyGUI::Widget* mSkillList;
|
|
|
|
std::vector<MyGUI::Widget*> mSkillItems;
|
2010-09-12 12:06:10 +00:00
|
|
|
|
2013-03-03 12:11:02 +00:00
|
|
|
MyGUI::Widget* mSpellPowerList;
|
|
|
|
std::vector<MyGUI::Widget*> mSpellPowerItems;
|
2010-09-12 12:06:10 +00:00
|
|
|
|
2012-07-13 10:51:58 +00:00
|
|
|
int mGenderIndex, mFaceIndex, mHairIndex;
|
2010-09-14 12:16:26 +00:00
|
|
|
|
2012-07-13 10:51:58 +00:00
|
|
|
std::string mCurrentRaceId;
|
2012-09-13 17:03:31 +00:00
|
|
|
|
|
|
|
float mCurrentAngle;
|
2012-09-14 22:57:29 +00:00
|
|
|
|
2014-08-13 17:30:46 +00:00
|
|
|
std::auto_ptr<MWRender::RaceSelectionPreview> mPreview;
|
2013-07-06 15:02:40 +00:00
|
|
|
|
|
|
|
bool mPreviewDirty;
|
2010-09-14 19:55:41 +00:00
|
|
|
};
|
2010-09-12 12:06:10 +00:00
|
|
|
}
|
|
|
|
#endif
|