summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugenio Favalli <elvenprogrammer@gmail.com>2006-07-03 21:05:19 +0000
committerEugenio Favalli <elvenprogrammer@gmail.com>2006-07-03 21:05:19 +0000
commite3a2cd1e6f685c921bd73e9cb1f0f8fcf0b6a939 (patch)
tree77afd116346f3e107c80c4126c8e44399ec24f11
parent852626d562a6b40f37a25dc2784492ede80ee78b (diff)
downloadmana-client-e3a2cd1e6f685c921bd73e9cb1f0f8fcf0b6a939.tar.gz
mana-client-e3a2cd1e6f685c921bd73e9cb1f0f8fcf0b6a939.tar.bz2
mana-client-e3a2cd1e6f685c921bd73e9cb1f0f8fcf0b6a939.tar.xz
mana-client-e3a2cd1e6f685c921bd73e9cb1f0f8fcf0b6a939.zip
Fixed visible equipment initialization and hack to see 2 kinds of visible equipments.
-rw-r--r--src/main.cpp17
-rw-r--r--src/net/charserverhandler.cpp6
-rw-r--r--src/player.cpp5
3 files changed, 17 insertions, 11 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 5713b7db..20a1771c 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -84,7 +84,7 @@ char n_server, n_character;
std::vector<Spriteset *> hairset;
Spriteset *playerset[2];
-Spriteset *equipmentset = NULL;
+Spriteset *equipmentset[2];
Graphics *graphics;
// TODO Anyone knows a good location for this? Or a way to make it non-global?
@@ -250,13 +250,17 @@ void init_engine()
playerset[0] = resman->createSpriteset(
"graphics/sprites/player_male_base.png", 64, 64);
+ if (!playerset[0]) logger->error("Couldn't load male 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!");
+ equipmentset[0] = resman->createSpriteset(
+ "graphics/sprites/item001.png", 64, 64);
+ if (!equipmentset[0]) logger->error("Couldn't load player equipmentset!");
+ equipmentset[1] = resman->createSpriteset(
+ "graphics/sprites/item002.png", 64, 64);
+ if (!equipmentset[1]) logger->error("Couldn't load player equipmentset!");
+
for (int i=0; i < NR_HAIR_STYLES; i++)
{
@@ -298,7 +302,8 @@ void exit_engine()
hairset.clear();
delete playerset[0];
delete playerset[1];
- delete equipmentset;
+ delete equipmentset[0];
+ delete equipmentset[1];
// Shutdown libxml
xmlCleanupParser();
diff --git a/src/net/charserverhandler.cpp b/src/net/charserverhandler.cpp
index 12813795..9857ddc0 100644
--- a/src/net/charserverhandler.cpp
+++ b/src/net/charserverhandler.cpp
@@ -191,10 +191,10 @@ LocalPlayer* CharServerHandler::readPlayerData(MessageIn *msg, int &slot)
tempPlayer->setWeapon(weapon);
tempPlayer->mLevel = msg->readInt16();
msg->readInt16(); // skill point
- msg->readInt16(); // head bottom
+ tempPlayer->mVisibleEquipment[3] = msg->readInt16(); // head bottom
msg->readInt16(); // shield
- msg->readInt16(); // head option top
- msg->readInt16(); // head option mid
+ tempPlayer->mVisibleEquipment[4] = msg->readInt16(); // head option top
+ tempPlayer->mVisibleEquipment[5] = msg->readInt16(); // head option mid
tempPlayer->setHairColor(msg->readInt16());
msg->readInt16(); // unknown
tempPlayer->setName(msg->readString(24));
diff --git a/src/player.cpp b/src/player.cpp
index b014a390..43439ab1 100644
--- a/src/player.cpp
+++ b/src/player.cpp
@@ -34,7 +34,7 @@
extern std::vector<Spriteset *> hairset;
extern Spriteset *playerset[2];
extern std::vector<Spriteset *> weaponset;
-extern Spriteset *equipmentset;
+extern Spriteset *equipmentset[2];
signed char hairtable[19][4][2] = {
// S(x,y) W(x,y) N(x,y) E(x,y)
@@ -154,7 +154,8 @@ void Player::draw(Graphics *graphics, int offsetX, int offsetY)
// Display middle equipment
if (mVisibleEquipment[5])
{
- graphics->drawImage(equipmentset->get(frame + 18 * dir),
+ graphics->drawImage(
+ equipmentset[mVisibleEquipment[5] - 1]->get(frame + 18 * dir),
px - 16, py - 32);
}
}