summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/emotedb.cpp16
-rw-r--r--src/resources/emotedb.h3
2 files changed, 18 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);
diff --git a/src/resources/emotedb.h b/src/resources/emotedb.h
index 24ceb40db..847f3f0ee 100644
--- a/src/resources/emotedb.h
+++ b/src/resources/emotedb.h
@@ -42,6 +42,7 @@ struct EmoteInfo
};
typedef std::map<int, EmoteInfo*> EmoteInfos;
+typedef std::map<int, int> EmoteToEmote;
/**
* Emote information database.
@@ -56,6 +57,8 @@ namespace EmoteDB
const AnimatedSprite *getAnimation(int id, bool allowNull = false);
+ const AnimatedSprite *getAnimation2(int id, bool allowNull = false);
+
const EmoteSprite *getSprite(int id, bool allowNull = false);
const int &getLast();