From a79a1e6ac086355639fcbf995e1c6399199e4476 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 11 May 2012 23:26:03 +0300 Subject: Add alt emotes id support. Limit tmw emotes. --- src/resources/emotedb.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/resources/emotedb.cpp') 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); -- cgit v1.2.3-60-g2f50