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/net | |
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/net')
-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 |
12 files changed, 135 insertions, 49 deletions
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 |