diff options
author | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-03-04 16:29:14 +0100 |
---|---|---|
committer | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-03-04 20:20:52 +0100 |
commit | 5c7f9d1d216fd1edca231ed274ac3077cb34909f (patch) | |
tree | 234405f8f9d0b422a02d8cc44854aaa6992cf2d9 /src/gui/charcreatedialog.cpp | |
parent | d5ebad4e74da011777f9ba1a13fbb37d18c827b9 (diff) | |
download | Mana-5c7f9d1d216fd1edca231ed274ac3077cb34909f.tar.gz Mana-5c7f9d1d216fd1edca231ed274ac3077cb34909f.tar.bz2 Mana-5c7f9d1d216fd1edca231ed274ac3077cb34909f.tar.xz Mana-5c7f9d1d216fd1edca231ed274ac3077cb34909f.zip |
Fixed character display
This change fixes hair style to take into account "race", which makes
the faces visible again. Hair colors should also be fixed now, with
partial support for itemcolors.xml added.
The Mana client now also supports per-character gender, and it now hides
the hair style and color buttons on character creation, when there are
none to choose from.
Closes #43
Diffstat (limited to 'src/gui/charcreatedialog.cpp')
-rw-r--r-- | src/gui/charcreatedialog.cpp | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/src/gui/charcreatedialog.cpp b/src/gui/charcreatedialog.cpp index 0d8a928e..fa1144b6 100644 --- a/src/gui/charcreatedialog.cpp +++ b/src/gui/charcreatedialog.cpp @@ -21,18 +21,13 @@ #include "gui/charcreatedialog.h" -#include "game.h" #include "localplayer.h" -#include "main.h" -#include "units.h" #include "gui/charselectdialog.h" -#include "gui/confirmdialog.h" #include "gui/okdialog.h" #include "gui/widgets/button.h" #include "gui/widgets/label.h" -#include "gui/widgets/layout.h" #include "gui/widgets/playerbox.h" #include "gui/widgets/radiobutton.h" #include "gui/widgets/slider.h" @@ -55,7 +50,7 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *parent, int slot): mSlot(slot) { mPlayer = new Being(0, ActorSprite::PLAYER, 0, nullptr); - mPlayer->setGender(GENDER_MALE); + mPlayer->setGender(Gender::MALE); const std::vector<int> &items = CharDB::getDefaultItems(); for (size_t i = 0; i < items.size(); ++i) @@ -66,6 +61,7 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *parent, int slot): mHairStyleId = rand() * mHairStylesIds.size() / RAND_MAX; mHairColorsIds = hairDB.getHairColorIds( + Net::getCharHandler()->getCharCreateMinHairColorId(), Net::getCharHandler()->getCharCreateMaxHairColorId()); mHairColorId = rand() * mHairColorsIds.size() / RAND_MAX; @@ -137,12 +133,21 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *parent, int slot): add(mPlayerBox); add(mNameField); add(mNameLabel); - add(mNextHairColorButton); - add(mPrevHairColorButton); - add(mHairColorLabel); - add(mNextHairStyleButton); - add(mPrevHairStyleButton); - add(mHairStyleLabel); + + if (mHairColorsIds.size() > 1) + { + add(mNextHairColorButton); + add(mPrevHairColorButton); + add(mHairColorLabel); + } + + if (mHairStylesIds.size() > 1) + { + add(mNextHairStyleButton); + add(mPrevHairStyleButton); + add(mHairStyleLabel); + } + add(mAttributesLeft); add(mCreateButton); add(mCancelButton); @@ -226,9 +231,9 @@ void CharCreateDialog::action(const gcn::ActionEvent &event) else if (event.getId() == "gender") { if (mMale->isSelected()) - mPlayer->setGender(GENDER_MALE); + mPlayer->setGender(Gender::MALE); else - mPlayer->setGender(GENDER_FEMALE); + mPlayer->setGender(Gender::FEMALE); } } @@ -366,9 +371,9 @@ void CharCreateDialog::setAttributes(const std::vector<std::string> &labels, center(); } -void CharCreateDialog::setFixedGender(bool fixed, Gender gender) +void CharCreateDialog::setDefaultGender(Gender gender) { - if (gender == GENDER_FEMALE) + if (gender == Gender::FEMALE) { mFemale->setSelected(true); mMale->setSelected(false); @@ -380,12 +385,6 @@ void CharCreateDialog::setFixedGender(bool fixed, Gender gender) } mPlayer->setGender(gender); - - if (fixed) - { - mMale->setEnabled(false); - mFemale->setEnabled(false); - } } void CharCreateDialog::updateHair() |