diff options
author | Jared Adams <jaxad0127@gmail.com> | 2010-01-24 14:43:14 -0700 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2010-01-24 14:43:14 -0700 |
commit | 3730a6028626cfcdab9bd98aecfeadf6c884b505 (patch) | |
tree | f78d37fae95f74625a745f5e551c40ae337976d9 /src | |
parent | 889108ea9a75a0591cac7efb49bac65629b6fb86 (diff) | |
download | mana-3730a6028626cfcdab9bd98aecfeadf6c884b505.tar.gz mana-3730a6028626cfcdab9bd98aecfeadf6c884b505.tar.bz2 mana-3730a6028626cfcdab9bd98aecfeadf6c884b505.tar.xz mana-3730a6028626cfcdab9bd98aecfeadf6c884b505.zip |
Remove some more _SUPPORT ifdefs
Diffstat (limited to 'src')
-rw-r--r-- | src/being.cpp | 1 | ||||
-rw-r--r-- | src/being.h | 2 | ||||
-rw-r--r-- | src/beingmanager.cpp | 8 | ||||
-rw-r--r-- | src/gui/charcreatedialog.cpp | 2 | ||||
-rw-r--r-- | src/monster.cpp | 4 | ||||
-rw-r--r-- | src/monster.h | 2 | ||||
-rw-r--r-- | src/net/charhandler.h | 6 | ||||
-rw-r--r-- | src/net/ea/beinghandler.cpp | 66 | ||||
-rw-r--r-- | src/net/ea/charserverhandler.cpp | 37 | ||||
-rw-r--r-- | src/net/ea/charserverhandler.h | 6 | ||||
-rw-r--r-- | src/net/ea/gamehandler.h | 2 | ||||
-rw-r--r-- | src/net/ea/protocol.h | 17 | ||||
-rw-r--r-- | src/net/gamehandler.h | 2 | ||||
-rw-r--r-- | src/net/manaserv/beinghandler.cpp | 8 | ||||
-rw-r--r-- | src/net/manaserv/charhandler.cpp | 19 | ||||
-rw-r--r-- | src/net/manaserv/charhandler.h | 6 | ||||
-rw-r--r-- | src/net/manaserv/gamehandler.h | 2 | ||||
-rw-r--r-- | src/net/manaserv/protocol.h | 13 | ||||
-rw-r--r-- | src/player.cpp | 25 | ||||
-rw-r--r-- | src/player.h | 28 |
20 files changed, 162 insertions, 94 deletions
diff --git a/src/being.cpp b/src/being.cpp index 63b18dee..b8fb4df7 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -66,6 +66,7 @@ extern const int MILLISECONDS_IN_A_TICK; int Being::mNumberOfHairstyles = 1; Being::Being(int id, int job, Map *map): + mFrame(0), #ifdef EATHENA_SUPPORT mWalkTime(0), #endif diff --git a/src/being.h b/src/being.h index 5e17a1df..fe4ab475 100644 --- a/src/being.h +++ b/src/being.h @@ -115,8 +115,8 @@ class Being : public Sprite, public ConfigListener */ enum { DOWN = 1, LEFT = 2, UP = 4, RIGHT = 8 }; -#ifdef EATHENA_SUPPORT int mFrame; +#ifdef EATHENA_SUPPORT int mWalkTime; #endif int mEmotion; /**< Currently showing emotion */ diff --git a/src/beingmanager.cpp b/src/beingmanager.cpp index cc3d68e5..1f1230d4 100644 --- a/src/beingmanager.cpp +++ b/src/beingmanager.cpp @@ -26,6 +26,9 @@ #include "npc.h" #include "player.h" +#include "net/gamehandler.h" +#include "net/net.h" + #include "utils/stringutils.h" #include "utils/dtor.h" @@ -180,14 +183,13 @@ void BeingManager::logic() being->logic(); -#ifdef EATHENA_SUPPORT - if (being->mAction == Being::DEAD && being->mFrame >= 20) + if (being->mAction == Being::DEAD && + Net::getGameHandler()->removeDeadBeings() && being->mFrame >= 20) { delete being; i = mBeings.erase(i); } else -#endif { ++i; } diff --git a/src/gui/charcreatedialog.cpp b/src/gui/charcreatedialog.cpp index 698fe58c..f01fa15a 100644 --- a/src/gui/charcreatedialog.cpp +++ b/src/gui/charcreatedialog.cpp @@ -361,6 +361,6 @@ void CharCreateDialog::updateHair() if (mHairColor < 0) mHairColor += ColorDB::size(); - mPlayer->setSprite(Player::HAIR_SPRITE, + mPlayer->setSprite(Net::getCharHandler()->hairSprite(), mHairStyle * -1, ColorDB::get(mHairColor)); } diff --git a/src/monster.cpp b/src/monster.cpp index 34390982..fd3c220e 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -69,9 +69,9 @@ Monster::Monster(int id, int job, Map *map): Being::setName(getInfo().getName()); } -#ifdef EATHENA_SUPPORT void Monster::logic() { +#ifdef EATHENA_SUPPORT if (mAction != STAND) { mFrame = (get_elapsed_time(mWalkTime) * 4) / getWalkSpeed(); @@ -79,10 +79,10 @@ void Monster::logic() if (mFrame >= 4 && mAction != DEAD) nextStep(); } +#endif Being::logic(); } -#endif void Monster::setAction(Action action, int attackType) { diff --git a/src/monster.h b/src/monster.h index 1cfb8e93..7fffaac7 100644 --- a/src/monster.h +++ b/src/monster.h @@ -32,9 +32,7 @@ class Monster : public Being public: Monster(int id, int job, Map *map); -#ifdef EATHENA_SUPPORT virtual void logic(); -#endif virtual void setAction(Action action, int attackType = 0); diff --git a/src/net/charhandler.h b/src/net/charhandler.h index 0ad3c1b7..52ae2b51 100644 --- a/src/net/charhandler.h +++ b/src/net/charhandler.h @@ -55,6 +55,12 @@ class CharHandler virtual void deleteCharacter(int slot, LocalPlayer* character) = 0; virtual void switchCharacter() = 0; + + virtual unsigned int baseSprite() const = 0; + + virtual unsigned int hairSprite() const = 0; + + virtual unsigned int maxSprite() const = 0; }; } // namespace Net diff --git a/src/net/ea/beinghandler.cpp b/src/net/ea/beinghandler.cpp index dbe108a0..b80410ff 100644 --- a/src/net/ea/beinghandler.cpp +++ b/src/net/ea/beinghandler.cpp @@ -192,14 +192,14 @@ void BeingHandler::handleMessage(Net::MessageIn &msg) player->setGender((gender == 0) ? GENDER_FEMALE : GENDER_MALE); // Set these after the gender, as the sprites may be gender-specific - player->setSprite(Player::HAIR_SPRITE, hairStyle * -1, ColorDB::get(hairColor)); - player->setSprite(Player::BOTTOMCLOTHES_SPRITE, headBottom); - player->setSprite(Player::TOPCLOTHES_SPRITE, headMid); - player->setSprite(Player::HAT_SPRITE, headTop); - player->setSprite(Player::SHOE_SPRITE, shoes); - player->setSprite(Player::GLOVES_SPRITE, gloves); - player->setSprite(Player::WEAPON_SPRITE, weapon); - player->setSprite(Player::SHIELD_SPRITE, shield); + player->setSprite(SPRITE_HAIR, hairStyle * -1, ColorDB::get(hairColor)); + player->setSprite(SPRITE_BOTTOMCLOTHES, headBottom); + player->setSprite(SPRITE_TOPCLOTHES, headMid); + player->setSprite(SPRITE_HAT, headTop); + player->setSprite(SPRITE_SHOE, shoes); + player->setSprite(SPRITE_GLOVES, gloves); + player->setSprite(SPRITE_WEAPON, weapon, "", true); + player->setSprite(SPRITE_SHIELD, shield); } if (msg.getId() == SMSG_BEING_MOVE) @@ -431,41 +431,41 @@ void BeingHandler::handleMessage(Net::MessageIn &msg) switch (type) { case 1: // eAthena LOOK_HAIR - player->setSpriteID(Player::HAIR_SPRITE, id *-1); + player->setSpriteID(SPRITE_HAIR, id *-1); break; case 2: // Weapon ID in id, Shield ID in id2 - player->setSprite(Player::WEAPON_SPRITE, id); - player->setSprite(Player::SHIELD_SPRITE, id2); + player->setSprite(SPRITE_WEAPON, id, "", true); + player->setSprite(SPRITE_SHIELD, id2); break; case 3: // Change lower headgear for eAthena, pants for us - player->setSprite(Player::BOTTOMCLOTHES_SPRITE, id); + player->setSprite(SPRITE_BOTTOMCLOTHES, id); break; case 4: // Change upper headgear for eAthena, hat for us - player->setSprite(Player::HAT_SPRITE, id); + player->setSprite(SPRITE_HAT, id); break; case 5: // Change middle headgear for eathena, armor for us - player->setSprite(Player::TOPCLOTHES_SPRITE, id); + player->setSprite(SPRITE_TOPCLOTHES, id); break; case 6: // eAthena LOOK_HAIR_COLOR - player->setSpriteColor(Player::HAIR_SPRITE, ColorDB::get(id)); + player->setSpriteColor(SPRITE_HAIR, ColorDB::get(id)); break; case 8: // eAthena LOOK_SHIELD - player->setSprite(Player::SHIELD_SPRITE, id); + player->setSprite(SPRITE_SHIELD, id); break; case 9: // eAthena LOOK_SHOES - player->setSprite(Player::SHOE_SPRITE, id); + player->setSprite(SPRITE_SHOE, id); break; case 10: // LOOK_GLOVES - player->setSprite(Player::GLOVES_SPRITE, id); + player->setSprite(SPRITE_GLOVES, id); break; case 11: // LOOK_CAPE - player->setSprite(Player::CAPE_SPRITE, id); + player->setSprite(SPRITE_CAPE, id); break; case 12: - player->setSprite(Player::MISC1_SPRITE, id); + player->setSprite(SPRITE_MISC1, id); break; case 13: - player->setSprite(Player::MISC2_SPRITE, id); + player->setSprite(SPRITE_MISC2, id); break; default: logger->log("SMSG_BEING_CHANGE_LOOKS: unsupported type: " @@ -538,8 +538,8 @@ void BeingHandler::handleMessage(Net::MessageIn &msg) headTop = msg.readInt16(); headMid = msg.readInt16(); hairColor = msg.readInt16(); - msg.readInt16(); // clothes color - Aethyra-"abused" as shoes, we ignore it - msg.readInt16(); // head dir - Aethyra-"abused" as gloves, we ignore it + shoes = msg.readInt16(); + gloves = msg.readInt16(); msg.readInt32(); // guild msg.readInt16(); // emblem msg.readInt16(); // manner @@ -549,15 +549,17 @@ void BeingHandler::handleMessage(Net::MessageIn &msg) ? GENDER_FEMALE : GENDER_MALE); // Set these after the gender, as the sprites may be gender-specific - player->setSprite(Player::WEAPON_SPRITE, weapon); - player->setSprite(Player::SHIELD_SPRITE, shield); - player->setSprite(Player::BOTTOMCLOTHES_SPRITE, headBottom); - player->setSprite(Player::TOPCLOTHES_SPRITE, headMid); - player->setSprite(Player::HAT_SPRITE, headTop); - //player->setSprite(Player::CAPE_SPRITE, cape); - //player->setSprite(Player::MISC1_SPRITE, misc1); - //player->setSprite(Player::MISC2_SPRITE, misc2); - player->setSprite(Player::HAIR_SPRITE, hairStyle * -1, ColorDB::get(hairColor)); + player->setSprite(SPRITE_WEAPON, weapon, "", true); + player->setSprite(SPRITE_SHIELD, shield); + player->setSprite(SPRITE_SHOE, shoes); + player->setSprite(SPRITE_BOTTOMCLOTHES, headBottom); + player->setSprite(SPRITE_TOPCLOTHES, headMid); + player->setSprite(SPRITE_HAT, headTop); + player->setSprite(SPRITE_GLOVES, gloves); + //player->setSprite(SPRITE_CAPE, cape); + //player->setSprite(SPRITE_MISC1, misc1); + //player->setSprite(SPRITE_MISC2, misc2); + player->setSprite(SPRITE_HAIR, hairStyle * -1, ColorDB::get(hairColor)); if (msg.getId() == SMSG_PLAYER_MOVE) { diff --git a/src/net/ea/charserverhandler.cpp b/src/net/ea/charserverhandler.cpp index a8a5260f..4e3f3c37 100644 --- a/src/net/ea/charserverhandler.cpp +++ b/src/net/ea/charserverhandler.cpp @@ -191,10 +191,10 @@ LocalPlayer *CharServerHandler::readPlayerData(Net::MessageIn &msg, int &slot) int temp = msg.readInt32(); tempPlayer->setAttributeBase(JOB, temp, false); tempPlayer->setAttributeEffective(JOB, temp); - tempPlayer->setSprite(Player::SHOE_SPRITE, msg.readInt16()); - tempPlayer->setSprite(Player::GLOVES_SPRITE, msg.readInt16()); - tempPlayer->setSprite(Player::CAPE_SPRITE, msg.readInt16()); - tempPlayer->setSprite(Player::MISC1_SPRITE, msg.readInt16()); + tempPlayer->setSprite(SPRITE_SHOE, msg.readInt16()); + tempPlayer->setSprite(SPRITE_GLOVES, msg.readInt16()); + tempPlayer->setSprite(SPRITE_CAPE, msg.readInt16()); + tempPlayer->setSprite(SPRITE_MISC1, msg.readInt16()); msg.readInt32(); // option msg.readInt32(); // karma msg.readInt32(); // manner @@ -207,15 +207,15 @@ LocalPlayer *CharServerHandler::readPlayerData(Net::MessageIn &msg, int &slot) msg.readInt16(); // class int hairStyle = msg.readInt16(); Uint16 weapon = msg.readInt16(); - tempPlayer->setSprite(Player::WEAPON_SPRITE, weapon); + tempPlayer->setSprite(SPRITE_WEAPON, weapon, "", true); tempPlayer->setLevel(msg.readInt16()); msg.readInt16(); // skill point - tempPlayer->setSprite(Player::BOTTOMCLOTHES_SPRITE, msg.readInt16()); // head bottom - tempPlayer->setSprite(Player::SHIELD_SPRITE, msg.readInt16()); - tempPlayer->setSprite(Player::HAT_SPRITE, msg.readInt16()); // head option top - tempPlayer->setSprite(Player::TOPCLOTHES_SPRITE, msg.readInt16()); // head option mid - tempPlayer->setSprite(Player::HAIR_SPRITE, hairStyle * -1, ColorDB::get(msg.readInt16())); - tempPlayer->setSprite(Player::MISC2_SPRITE, msg.readInt16()); + tempPlayer->setSprite(SPRITE_BOTTOMCLOTHES, msg.readInt16()); // head bottom + tempPlayer->setSprite(SPRITE_SHIELD, msg.readInt16()); + tempPlayer->setSprite(SPRITE_HAT, msg.readInt16()); // head option top + tempPlayer->setSprite(SPRITE_TOPCLOTHES, msg.readInt16()); // head option mid + tempPlayer->setSprite(SPRITE_HAIR, hairStyle * -1, ColorDB::get(msg.readInt16())); + tempPlayer->setSprite(SPRITE_MISC2, msg.readInt16()); tempPlayer->setName(msg.readString(24)); for (int i = 0; i < 6; i++) tempPlayer->setAttributeBase(i + STR, msg.readInt8(), false); @@ -291,6 +291,21 @@ void CharServerHandler::switchCharacter() outMsg.writeInt8(1); } +unsigned int CharServerHandler::baseSprite() const +{ + return SPRITE_BASE; +} + +unsigned int CharServerHandler::hairSprite() const +{ + return SPRITE_HAIR; +} + +unsigned int CharServerHandler::maxSprite() const +{ + return SPRITE_VECTOREND; +} + void CharServerHandler::connect() { const Token &token = diff --git a/src/net/ea/charserverhandler.h b/src/net/ea/charserverhandler.h index b1e2b797..b29e9518 100644 --- a/src/net/ea/charserverhandler.h +++ b/src/net/ea/charserverhandler.h @@ -65,6 +65,12 @@ class CharServerHandler : public MessageHandler, public Net::CharHandler void switchCharacter(); + unsigned int baseSprite() const; + + unsigned int hairSprite() const; + + unsigned int maxSprite() const; + void connect(); protected: diff --git a/src/net/ea/gamehandler.h b/src/net/ea/gamehandler.h index 0095ada3..39abbbd1 100644 --- a/src/net/ea/gamehandler.h +++ b/src/net/ea/gamehandler.h @@ -54,6 +54,8 @@ class GameHandler : public MessageHandler, public Net::GameHandler void ping(int tick); + bool removeDeadBeings() const { return true; } + void clear(); }; diff --git a/src/net/ea/protocol.h b/src/net/ea/protocol.h index f17ded61..767e7f82 100644 --- a/src/net/ea/protocol.h +++ b/src/net/ea/protocol.h @@ -41,6 +41,23 @@ enum { CRIT }; +enum +{ + SPRITE_BASE = 0, + SPRITE_SHOE, + SPRITE_BOTTOMCLOTHES, + SPRITE_TOPCLOTHES, + SPRITE_MISC1, + SPRITE_MISC2, + SPRITE_HAIR, + SPRITE_HAT, + SPRITE_CAPE, + SPRITE_GLOVES, + SPRITE_WEAPON, + SPRITE_SHIELD, + SPRITE_VECTOREND +}; + static const int INVENTORY_OFFSET = 2; static const int STORAGE_OFFSET = 1; diff --git a/src/net/gamehandler.h b/src/net/gamehandler.h index 34a36e61..113da6b1 100644 --- a/src/net/gamehandler.h +++ b/src/net/gamehandler.h @@ -46,6 +46,8 @@ class GameHandler virtual void quit() = 0; virtual void ping(int tick) = 0; + + virtual bool removeDeadBeings() const = 0; }; } // namespace Net diff --git a/src/net/manaserv/beinghandler.cpp b/src/net/manaserv/beinghandler.cpp index 585f0823..2db76255 100644 --- a/src/net/manaserv/beinghandler.cpp +++ b/src/net/manaserv/beinghandler.cpp @@ -96,8 +96,8 @@ static void handleLooks(Player *being, Net::MessageIn &msg) // Order of sent slots. Has to be in sync with the server code. static int const nb_slots = 4; static int const slots[nb_slots] = - { Player::WEAPON_SPRITE, Player::HAT_SPRITE, Player::TOPCLOTHES_SPRITE, - Player::BOTTOMCLOTHES_SPRITE }; + { SPRITE_WEAPON, SPRITE_HAT, SPRITE_TOPCLOTHES, + SPRITE_BOTTOMCLOTHES }; int mask = msg.readInt8(); @@ -145,7 +145,7 @@ void BeingHandler::handleBeingEnterMessage(Net::MessageIn &msg) } Player *p = static_cast< Player * >(being); int hs = msg.readInt8(), hc = msg.readInt8(); - p->setSprite(Player::HAIR_SPRITE, hs * -1, ColorDB::get(hc)); + p->setSprite(SPRITE_HAIR, hs * -1, ColorDB::get(hc)); p->setGender(msg.readInt8() == GENDER_MALE ? GENDER_MALE : GENDER_FEMALE); handleLooks(p, msg); @@ -302,7 +302,7 @@ void BeingHandler::handleBeingLooksChangeMessage(Net::MessageIn &msg) { int style = msg.readInt16(); int color = msg.readInt16(); - player->setSprite(Player::HAIR_SPRITE, style * -1, ColorDB::get(color)); + player->setSprite(SPRITE_HAIR, style * -1, ColorDB::get(color)); } } diff --git a/src/net/manaserv/charhandler.cpp b/src/net/manaserv/charhandler.cpp index 622fceaa..916e05b8 100644 --- a/src/net/manaserv/charhandler.cpp +++ b/src/net/manaserv/charhandler.cpp @@ -157,7 +157,7 @@ void CharHandler::handleMessage(Net::MessageIn &msg) LocalPlayer *tempPlayer = new LocalPlayer(); tempPlayer->setName(info.name); tempPlayer->setGender(info.gender); - tempPlayer->setSprite(Player::HAIR_SPRITE, info.hs * -1, + tempPlayer->setSprite(SPRITE_HAIR, info.hs * -1, ColorDB::get(info.hc)); tempPlayer->setLevel(info.level); tempPlayer->setCharacterPoints(info.charPoints); @@ -332,7 +332,7 @@ void CharHandler::getCharacters() tempPlayer = new LocalPlayer(); tempPlayer->setName(info.name); tempPlayer->setGender(info.gender); - tempPlayer->setSprite(Player::HAIR_SPRITE, info.hs * -1, + tempPlayer->setSprite(SPRITE_HAIR, info.hs * -1, ColorDB::get(info.hc)); tempPlayer->setLevel(info.level); tempPlayer->setCharacterPoints(info.charPoints); @@ -400,4 +400,19 @@ void CharHandler::switchCharacter() gameHandler->quit(true); } +unsigned int CharHandler::baseSprite() const +{ + return SPRITE_BASE; +} + +unsigned int CharHandler::hairSprite() const +{ + return SPRITE_HAIR; +} + +unsigned int CharHandler::maxSprite() const +{ + return SPRITE_VECTOREND; +} + } // namespace ManaServ diff --git a/src/net/manaserv/charhandler.h b/src/net/manaserv/charhandler.h index fca2b30a..ff89a639 100644 --- a/src/net/manaserv/charhandler.h +++ b/src/net/manaserv/charhandler.h @@ -68,6 +68,12 @@ class CharHandler : public MessageHandler, public Net::CharHandler void switchCharacter(); + unsigned int baseSprite() const; + + unsigned int hairSprite() const; + + unsigned int maxSprite() const; + protected: void handleCharCreateResponse(Net::MessageIn &msg); diff --git a/src/net/manaserv/gamehandler.h b/src/net/manaserv/gamehandler.h index 85fa7465..6eaa2a95 100644 --- a/src/net/manaserv/gamehandler.h +++ b/src/net/manaserv/gamehandler.h @@ -53,6 +53,8 @@ class GameHandler : public MessageHandler, public Net::GameHandler void quit() { quit(false); } void ping(int tick); + + bool removeDeadBeings() const { return false; } void clear(); }; diff --git a/src/net/manaserv/protocol.h b/src/net/manaserv/protocol.h index c0add694..3aac1955 100644 --- a/src/net/manaserv/protocol.h +++ b/src/net/manaserv/protocol.h @@ -313,4 +313,17 @@ enum { GUILD_EVENT_OFFLINE_PLAYER }; + +enum +{ + SPRITE_BASE = 0, + SPRITE_SHOE, + SPRITE_BOTTOMCLOTHES, + SPRITE_TOPCLOTHES, + SPRITE_HAIR, + SPRITE_HAT, + SPRITE_WEAPON, + SPRITE_VECTOREND +}; + #endif // MANASERV_PROTOCOL_H diff --git a/src/player.cpp b/src/player.cpp index 3cee0d1e..152e2919 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -30,6 +30,9 @@ #include "gui/palette.h" +#include "net/charhandler.h" +#include "net/net.h" + #include "resources/colordb.h" #include "resources/itemdb.h" #include "resources/iteminfo.h" @@ -44,7 +47,7 @@ Player::Player(int id, int job, Map *map, bool isNPC): { if (!isNPC) { - for (int i = 0; i < VECTOREND_SPRITE; i++) + for (unsigned int i = 0; i < Net::getCharHandler()->maxSprite(); i++) { mSprites.push_back(NULL); mSpriteIDs.push_back(0); @@ -55,7 +58,7 @@ Player::Player(int id, int job, Map *map, bool isNPC): * line and set the base sprite when setting the race of the player * character. */ - setSprite(BASE_SPRITE, -100); + setSprite(Net::getCharHandler()->baseSprite(), -100); } mShowName = config.getValue("visiblenames", 1); config.addListener("visiblenames", this); @@ -68,9 +71,9 @@ Player::~Player() config.removeListener("visiblenames", this); } -#ifdef EATHENA_SUPPORT void Player::logic() { +#ifdef EATHENA_SUPPORT switch (mAction) { case STAND: @@ -123,10 +126,10 @@ void Player::logic() break; } +#endif Being::logic(); } -#endif void Player::setGender(Gender gender) { @@ -150,9 +153,13 @@ void Player::setGM(bool gm) updateColors(); } -void Player::setSprite(unsigned int slot, int id, const std::string &color) +void Player::setSprite(unsigned int slot, int id, const std::string &color, + bool isWeapon) { - assert(slot >= BASE_SPRITE && slot < VECTOREND_SPRITE); + if (getType() == NPC) + return; + + assert(slot < Net::getCharHandler()->maxSprite()); // id = 0 means unequip if (id == 0) @@ -160,10 +167,8 @@ void Player::setSprite(unsigned int slot, int id, const std::string &color) delete mSprites[slot]; mSprites[slot] = NULL; -#ifdef EATHENA_SUPPORT - if (slot == WEAPON_SPRITE) + if (isWeapon) mEquippedWeapon = NULL; -#endif } else { @@ -187,7 +192,7 @@ void Player::setSprite(unsigned int slot, int id, const std::string &color) mSprites[slot] = equipmentSprite; - if (slot == WEAPON_SPRITE) + if (isWeapon) mEquippedWeapon = &ItemDB::get(id); setAction(mAction); diff --git a/src/player.h b/src/player.h index 5cdc35a7..78368b43 100644 --- a/src/player.h +++ b/src/player.h @@ -43,29 +43,6 @@ enum Gender class Player : public Being { public: - enum Sprite - { - BASE_SPRITE = 0, - SHOE_SPRITE, - BOTTOMCLOTHES_SPRITE, - TOPCLOTHES_SPRITE, -#ifdef EATHENA_SUPPORT - MISC1_SPRITE, - MISC2_SPRITE, -#endif - HAIR_SPRITE, - HAT_SPRITE, -#ifdef EATHENA_SUPPORT - CAPE_SPRITE, - GLOVES_SPRITE, -#endif - WEAPON_SPRITE, -#ifdef EATHENA_SUPPORT - SHIELD_SPRITE, -#endif - VECTOREND_SPRITE - }; - /** * Constructor. */ @@ -73,9 +50,7 @@ class Player : public Being ~Player(); -#ifdef EATHENA_SUPPORT virtual void logic(); -#endif virtual Type getType() const { return PLAYER; } @@ -100,7 +75,8 @@ class Player : public Being * Sets visible equipments for this player. */ virtual void setSprite(unsigned int slot, int id, - const std::string &color = ""); + const std::string &color = "", + bool isWeapon = false); virtual void setSpriteID(unsigned int slot, int id); |