diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-05-11 23:26:03 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-05-11 23:26:03 +0300 |
commit | a79a1e6ac086355639fcbf995e1c6399199e4476 (patch) | |
tree | 51c6285f18fcafaa0908764cc3f3336dbacac447 /src/resources/emotedb.cpp | |
parent | eb3cee0bc68ee576ed0eb429d22c6031f27def07 (diff) | |
download | manaplus-a79a1e6ac086355639fcbf995e1c6399199e4476.tar.gz manaplus-a79a1e6ac086355639fcbf995e1c6399199e4476.tar.bz2 manaplus-a79a1e6ac086355639fcbf995e1c6399199e4476.tar.xz manaplus-a79a1e6ac086355639fcbf995e1c6399199e4476.zip |
Add alt emotes id support.
Limit tmw emotes.
Diffstat (limited to 'src/resources/emotedb.cpp')
-rw-r--r-- | src/resources/emotedb.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/resources/emotedb.cpp b/src/resources/emotedb.cpp index 045900415..b3628cdeb 100644 --- a/src/resources/emotedb.cpp +++ b/src/resources/emotedb.cpp @@ -22,6 +22,7 @@ #include "resources/emotedb.h" #include "animatedsprite.h" +#include "client.h" #include "logger.h" #include "utils/xml.h" @@ -32,6 +33,7 @@ namespace { EmoteInfos mEmoteInfos; + EmoteToEmote mEmotesAlt; EmoteInfo mUnknown; bool mLoaded = false; int mLastEmote = 0; @@ -69,7 +71,7 @@ void EmoteDB::load() int id = XML::getProperty(emoteNode, "id", -1); // skip hight images - if (id > 19) + if (id > 19 || (Client::isTmw() && id > 13)) continue; if (id == -1) @@ -133,6 +135,7 @@ void EmoteDB::load() "manaplus_emotes.xml!"); continue; } + int altId = XML::getProperty(emoteNode, "altid", -1); EmoteInfo *currentInfo = new EmoteInfo; @@ -161,6 +164,9 @@ void EmoteDB::load() } } mEmoteInfos[id] = currentInfo; + if (altId != -1) + mEmotesAlt[altId] = id; + if (id > mLastEmote) mLastEmote = id; } @@ -223,6 +229,14 @@ const AnimatedSprite *EmoteDB::getAnimation(int id, bool allowNull) return info->sprites.front()->sprite; } +const AnimatedSprite *EmoteDB::getAnimation2(int id, bool allowNull) +{ + EmoteToEmote::const_iterator it = mEmotesAlt.find(id); + if (it != mEmotesAlt.end()) + id = (*it).second; + return getAnimation(id, allowNull); +} + const EmoteSprite *EmoteDB::getSprite(int id, bool allowNull) { const EmoteInfo *info = get(id, allowNull); |