summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-05-11 23:26:03 +0300
committerAndrei Karas <akaras@inbox.ru>2012-05-11 23:26:03 +0300
commita79a1e6ac086355639fcbf995e1c6399199e4476 (patch)
tree51c6285f18fcafaa0908764cc3f3336dbacac447 /src/resources
parenteb3cee0bc68ee576ed0eb429d22c6031f27def07 (diff)
downloadManaVerse-a79a1e6ac086355639fcbf995e1c6399199e4476.tar.gz
ManaVerse-a79a1e6ac086355639fcbf995e1c6399199e4476.tar.bz2
ManaVerse-a79a1e6ac086355639fcbf995e1c6399199e4476.tar.xz
ManaVerse-a79a1e6ac086355639fcbf995e1c6399199e4476.zip
Add alt emotes id support.
Limit tmw emotes.
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();