summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--src/being.cpp1
-rw-r--r--src/being.h13
-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
-rw-r--r--src/main.cpp15
-rw-r--r--src/net/beinghandler.cpp4
-rw-r--r--src/net/charserverhandler.cpp1
-rw-r--r--src/player.cpp4
12 files changed, 56 insertions, 34 deletions
diff --git a/ChangeLog b/ChangeLog
index a3a25f2f..e073866d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,12 @@
data/graphics/sprites/monster11.png,
data/graphics/sprites/monster17.png: Fixed attack animation of monster
11 and added a new monster.
+ * data/graphics/sprites/Makefile.am,
+ data/graphics/sprites/player_female_base.png, src/being.cpp,
+ src/being.h, src/gui/char_select.cpp, src/gui/char_select.h,
+ src/gui/playerbox.cpp, src/gui/playerbox.h, src/gui/register.cpp,
+ src/main.cpp, src/net/beinghandler.cpp, src/net/charserverhandler.cpp,
+ src/player.cpp: Added female players.
2006-06-19 Philipp Sehmisch <tmw@crushnet.org>
diff --git a/src/being.cpp b/src/being.cpp
index a9bbc5e1..8963ed3c 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -54,6 +54,7 @@ Being::Being(Uint32 id, Uint16 job, Map *map):
mWalkSpeed(150),
mMap(NULL),
mHairStyle(1), mHairColor(1),
+ mSex(0),
mSpeechTime(0),
mDamageTime(0),
mShowSpeech(false), mShowDamage(false),
diff --git a/src/being.h b/src/being.h
index fbc03456..685f786b 100644
--- a/src/being.h
+++ b/src/being.h
@@ -169,6 +169,18 @@ class Being : public Sprite
*/
Uint16
getHairStyle() const { return mHairStyle; }
+
+ /**
+ * Sets the sex for this being.
+ */
+ void
+ setSex(Uint8 sex) { mSex = sex; }
+
+ /**
+ * Gets the sex for this being.
+ */
+ Uint8
+ getSex() const { return mSex; }
/**
* Makes this being take the next step of his path.
@@ -315,6 +327,7 @@ class Being : public Sprite
std::string mSpeech;
std::string mDamage;
Uint16 mHairStyle, mHairColor;
+ Uint8 mSex;
Uint32 mSpeechTime;
Uint32 mDamageTime;
bool mShowSpeech, mShowDamage;
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);
diff --git a/src/main.cpp b/src/main.cpp
index f7c36b18..5713b7db 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -83,7 +83,7 @@
char n_server, n_character;
std::vector<Spriteset *> hairset;
-Spriteset *playerset = NULL;
+Spriteset *playerset[2];
Spriteset *equipmentset = NULL;
Graphics *graphics;
@@ -248,9 +248,12 @@ void init_engine()
// Initialize for drawing
graphics->_beginDraw();
- playerset = resman->createSpriteset(
+ playerset[0] = resman->createSpriteset(
"graphics/sprites/player_male_base.png", 64, 64);
- if (!playerset) logger->error("Couldn't load player spriteset!");
+ playerset[1] = resman->createSpriteset(
+ "graphics/sprites/player_female_base.png", 64, 64);
+ if (!playerset[0]) logger->error("Couldn't load male player spriteset!");
+ if (!playerset[1]) logger->error("Couldn't load female player spriteset!");
equipmentset = resman->createSpriteset(
"graphics/sprites/item1202.png", 64, 64);
if (!equipmentset) logger->error("Couldn't load player equipmentset!");
@@ -293,7 +296,8 @@ void exit_engine()
delete graphics;
for_each(hairset.begin(), hairset.end(), make_dtor(hairset));
hairset.clear();
- delete playerset;
+ delete playerset[0];
+ delete playerset[1];
delete equipmentset;
// Shutdown libxml
@@ -620,7 +624,8 @@ int main(int argc, char *argv[])
case CHAR_SELECT_STATE:
logger->log("State: CHAR_SELECT");
- currentDialog = new CharSelectDialog(network, &charInfo);
+ currentDialog = new CharSelectDialog(network, &charInfo,
+ 1 - loginData.sex);
if (options.chooseDefault) {
((CharSelectDialog*)currentDialog)->action("ok");
}
diff --git a/src/net/beinghandler.cpp b/src/net/beinghandler.cpp
index e95f785e..f8e6baef 100644
--- a/src/net/beinghandler.cpp
+++ b/src/net/beinghandler.cpp
@@ -125,7 +125,7 @@ void BeingHandler::handleMessage(MessageIn *msg)
msg->readInt16(); // manner
msg->readInt16(); // karma
msg->readInt8(); // unknown
- msg->readInt8(); // sex
+ dstBeing->setSex(1 - msg->readInt8()); // sex
if (msg->getId() == SMSG_BEING_MOVE)
{
@@ -318,7 +318,7 @@ void BeingHandler::handleMessage(MessageIn *msg)
msg->readInt32(); // emblem
msg->readInt16(); // manner
msg->readInt8(); // karma
- msg->readInt8(); // sex
+ dstBeing->setSex(1 - msg->readInt8()); // sex
if (msg->getId() == SMSG_PLAYER_MOVE)
{
diff --git a/src/net/charserverhandler.cpp b/src/net/charserverhandler.cpp
index 55bfa0c6..12813795 100644
--- a/src/net/charserverhandler.cpp
+++ b/src/net/charserverhandler.cpp
@@ -163,6 +163,7 @@ void CharServerHandler::handleMessage(MessageIn *msg)
LocalPlayer* CharServerHandler::readPlayerData(MessageIn *msg, int &slot)
{
LocalPlayer *tempPlayer = new LocalPlayer(mLoginData->account_ID, 0, NULL);
+ tempPlayer->setSex(1 - mLoginData->sex);
tempPlayer->mCharId = msg->readInt32();
tempPlayer->mTotalWeight = 0;
diff --git a/src/player.cpp b/src/player.cpp
index c7e2d911..830c92aa 100644
--- a/src/player.cpp
+++ b/src/player.cpp
@@ -32,7 +32,7 @@
#include "gui/gui.h"
extern std::vector<Spriteset *> hairset;
-extern Spriteset *playerset;
+extern Spriteset *playerset[2];
extern std::vector<Spriteset *> weaponset;
extern Spriteset *equipmentset;
@@ -128,7 +128,7 @@ void Player::draw(Graphics *graphics, int offsetX, int offsetY)
unsigned char dir = 0;
while (!(mDirection & (1 << dir))) dir++;
- graphics->drawImage(playerset->get(frame + 18 * dir),
+ graphics->drawImage(playerset[mSex]->get(frame + 18 * dir),
px - 16, py - 32);
Item *item = mEquipment->getEquipment(3);