summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorEugenio Favalli <elvenprogrammer@gmail.com>2006-06-21 17:06:57 +0000
committerEugenio Favalli <elvenprogrammer@gmail.com>2006-06-21 17:06:57 +0000
commite87c165b31b3bdb784f23fd7d1e6a795859aa24c (patch)
tree913263b303ff1019d8be92ade326a028c012db16 /src/gui
parent46cf032fc0eea43743b86d9e05950dd7a65728b7 (diff)
downloadmana-e87c165b31b3bdb784f23fd7d1e6a795859aa24c.tar.gz
mana-e87c165b31b3bdb784f23fd7d1e6a795859aa24c.tar.bz2
mana-e87c165b31b3bdb784f23fd7d1e6a795859aa24c.tar.xz
mana-e87c165b31b3bdb784f23fd7d1e6a795859aa24c.zip
Added female players.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/char_select.cpp15
-rw-r--r--src/gui/char_select.h8
-rw-r--r--src/gui/playerbox.cpp7
-rw-r--r--src/gui/playerbox.h3
-rw-r--r--src/gui/register.cpp13
5 files changed, 21 insertions, 25 deletions
diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp
index 2657c604..a1ce5dec 100644
--- a/src/gui/char_select.cpp
+++ b/src/gui/char_select.cpp
@@ -69,9 +69,11 @@ void CharDeleteConfirm::action(const std::string &eventId)
ConfirmDialog::action(eventId);
}
-CharSelectDialog::CharSelectDialog(Network *network, LockedArray<LocalPlayer*> *charInfo):
+CharSelectDialog::CharSelectDialog(Network *network,
+ LockedArray<LocalPlayer*> *charInfo,
+ unsigned char sex):
Window("Select Character"), mNetwork(network),
- mCharInfo(charInfo), mCharSelected(false)
+ mCharInfo(charInfo), mSex(sex), mCharSelected(false)
{
mSelectButton = new Button("Ok", "ok", this);
mCancelButton = new Button("Cancel", "cancel", this);
@@ -84,7 +86,7 @@ CharSelectDialog::CharSelectDialog(Network *network, LockedArray<LocalPlayer*> *
mLevelLabel = new gcn::Label("Level");
mJobLevelLabel = new gcn::Label("Job Level");
mMoneyLabel = new gcn::Label("Money");
- mPlayerBox = new PlayerBox();
+ mPlayerBox = new PlayerBox(sex);
int w = 195;
int h = 220;
@@ -146,7 +148,7 @@ void CharSelectDialog::action(const std::string& eventId)
if (n_character < MAX_SLOT + 1)
{
// Start new character dialog
- new CharCreateDialog(this, mCharInfo->getPos(), mNetwork);
+ new CharCreateDialog(this, mCharInfo->getPos(), mNetwork, mSex);
mCharInfo->lock();
}
}
@@ -225,7 +227,8 @@ void CharSelectDialog::logic()
updatePlayerInfo();
}
-CharCreateDialog::CharCreateDialog(Window *parent, int slot, Network *network):
+CharCreateDialog::CharCreateDialog(Window *parent, int slot, Network *network,
+ unsigned char sex):
Window("Create Character", true, parent), mNetwork(network), mSlot(slot)
{
mNameField = new TextField("");
@@ -238,7 +241,7 @@ CharCreateDialog::CharCreateDialog(Window *parent, int slot, Network *network):
mHairStyleLabel = new gcn::Label("Hair Style:");
mCreateButton = new Button("Create", "create", this);
mCancelButton = new Button("Cancel", "cancel", this);
- mPlayerBox = new PlayerBox();
+ mPlayerBox = new PlayerBox(sex);
mPlayerBox->mShowPlayer = true;
mNameField->setEventId("create");
diff --git a/src/gui/char_select.h b/src/gui/char_select.h
index 4531592e..8fc7cd01 100644
--- a/src/gui/char_select.h
+++ b/src/gui/char_select.h
@@ -45,7 +45,9 @@ class CharSelectDialog : public Window, public gcn::ActionListener
/**
* Constructor.
*/
- CharSelectDialog(Network *network, LockedArray<LocalPlayer*> *charInfo);
+ CharSelectDialog(Network *network,
+ LockedArray<LocalPlayer*> *charInfo,
+ unsigned char sex);
void action(const std::string& eventId);
@@ -71,6 +73,7 @@ class CharSelectDialog : public Window, public gcn::ActionListener
PlayerBox *mPlayerBox;
+ unsigned char mSex;
bool mCharSelected;
/**
@@ -95,7 +98,8 @@ class CharCreateDialog : public Window, public gcn::ActionListener
/**
* Constructor.
*/
- CharCreateDialog(Window *parent, int slot, Network *network);
+ CharCreateDialog(Window *parent, int slot, Network *network,
+ unsigned char sex);
void action(const std::string& eventId);
diff --git a/src/gui/playerbox.cpp b/src/gui/playerbox.cpp
index 8174ad77..d5c70ffe 100644
--- a/src/gui/playerbox.cpp
+++ b/src/gui/playerbox.cpp
@@ -35,14 +35,15 @@
#include "../utils/dtor.h"
extern std::vector<Spriteset *> hairset;
-extern Spriteset *playerset;
+extern Spriteset *playerset[2];
int PlayerBox::instances = 0;
ImageRect PlayerBox::background;
-PlayerBox::PlayerBox():
+PlayerBox::PlayerBox(unsigned char sex):
mHairColor(0),
mHairStyle(0),
+ mSex(sex),
mShowPlayer(false)
{
setBorderSize(2);
@@ -90,7 +91,7 @@ void PlayerBox::draw(gcn::Graphics *graphics)
// Draw character
dynamic_cast<Graphics*>(graphics)->drawImage(
- playerset->get(0), 23, 12);
+ playerset[mSex]->get(0), 23, 12);
// Draw his hair
if (mHairColor >= 0 && mHairStyle >= 0 &&
diff --git a/src/gui/playerbox.h b/src/gui/playerbox.h
index 86e911e9..79f7c2aa 100644
--- a/src/gui/playerbox.h
+++ b/src/gui/playerbox.h
@@ -40,7 +40,7 @@ class PlayerBox : public gcn::ScrollArea
/**
* Constructor.
*/
- PlayerBox();
+ PlayerBox(unsigned char sex);
/**
* Destructor.
@@ -59,6 +59,7 @@ class PlayerBox : public gcn::ScrollArea
int mHairColor; /**< The hair color index */
int mHairStyle; /**< The hair style index */
+ unsigned char mSex; /**< Sex */
bool mShowPlayer; /**< Wether to show the player or not */
private:
diff --git a/src/gui/register.cpp b/src/gui/register.cpp
index 41d2db6c..b99568a8 100644
--- a/src/gui/register.cpp
+++ b/src/gui/register.cpp
@@ -56,9 +56,7 @@ RegisterDialog::RegisterDialog(LoginData *loginData):
mConfirmField = new PasswordField();
mServerField = new TextField();
mMaleButton = new RadioButton("Male", "sex", true);
- mMaleButton->setEnabled(false);
mFemaleButton = new RadioButton("Female", "sex", false);
- mFemaleButton->setEnabled(false);
mRegisterButton = new Button("Register", "register", this);
mCancelButton = new Button("Cancel", "cancel", this);
@@ -92,17 +90,6 @@ RegisterDialog::RegisterDialog(LoginData *loginData):
mCancelButton->setPosition(10 + mRegisterButton->getWidth(),
mRegisterButton->getY());
-
- /*mUserField->setEventId("register");
- mPasswordField->setEventId("register");
- mConfirmField->setEventId("register");
- mServerField->setEventId("register");*/
-
- /*mUserField->addActionListener(this);
- mPasswordField->addActionListener(this);
- mConfirmField->addActionListener(this);
- mServerField->addActionListener(this);*/
-
add(userLabel);
add(passwordLabel);
add(serverLabel);