diff options
author | Ira Rice <irarice@gmail.com> | 2009-01-16 08:36:33 -0700 |
---|---|---|
committer | Ira Rice <irarice@gmail.com> | 2009-01-16 08:36:33 -0700 |
commit | 50335c6b1470c45753d720cebdf4af830ba7a46c (patch) | |
tree | b18dd0bbc7f11e70860a617e9db597fd243b3283 /src | |
parent | 29a65dd896255e6e173201dcc0d50bfc273afb61 (diff) | |
download | mana-50335c6b1470c45753d720cebdf4af830ba7a46c.tar.gz mana-50335c6b1470c45753d720cebdf4af830ba7a46c.tar.bz2 mana-50335c6b1470c45753d720cebdf4af830ba7a46c.tar.xz mana-50335c6b1470c45753d720cebdf4af830ba7a46c.zip |
Made emotes load in only one location, as well as fixing the code on the
being so that the last emote draws (which got broken).
Signed-off-by: Ira Rice <irarice@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/being.cpp | 11 | ||||
-rw-r--r-- | src/being.h | 2 | ||||
-rw-r--r-- | src/gui/emotecontainer.cpp | 10 | ||||
-rw-r--r-- | src/gui/emoteshortcutcontainer.cpp | 9 |
4 files changed, 9 insertions, 23 deletions
diff --git a/src/being.cpp b/src/being.cpp index 883344d8..98aaeec2 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -93,12 +93,9 @@ Being::Being(int id, int job, Map *map): { EmoteInfo info = EmoteDB::get(i); - if (info.sprites != EmoteDB::getUnknown().sprites) - { - std::string file = "graphics/sprites/" + info.sprites.front()->sprite; - int variant = info.sprites.front()->variant; - emotionSet.push_back(AnimatedSprite::load(file, variant)); - } + std::string file = "graphics/sprites/" + info.sprites.front()->sprite; + int variant = info.sprites.front()->variant; + emotionSet.push_back(AnimatedSprite::load(file, variant)); } // Hairstyles are encoded as negative numbers. Count how far negative we can go. @@ -456,7 +453,7 @@ void Being::drawEmotion(Graphics *graphics, int offsetX, int offsetY) const int py = mPy + offsetY - 60; const int emotionIndex = mEmotion - 1; - if (emotionIndex >= 0 && emotionIndex < EmoteDB::getLast()) + if (emotionIndex >= 0 && emotionIndex <= EmoteDB::getLast()) emotionSet[emotionIndex]->draw(graphics, px, py); } diff --git a/src/being.h b/src/being.h index 4534b1ea..6dbcdfdd 100644 --- a/src/being.h +++ b/src/being.h @@ -351,6 +351,8 @@ class Being : public Sprite */ void controlParticle(Particle *particle); + AnimatedSprite* getEmote(int index) { return emotionSet[index]; } + void setEmote(Uint8 emotion, Uint8 emote_time) { mEmotion = emotion; diff --git a/src/gui/emotecontainer.cpp b/src/gui/emotecontainer.cpp index 691211ca..cba744dd 100644 --- a/src/gui/emotecontainer.cpp +++ b/src/gui/emotecontainer.cpp @@ -28,6 +28,7 @@ #include "../animatedsprite.h" #include "../configuration.h" #include "../graphics.h" +#include "../localplayer.h" #include "../log.h" #include "../resources/emotedb.h" @@ -52,14 +53,7 @@ EmoteContainer::EmoteContainer(): // Setup emote sprites for (int i = 0; i <= EmoteDB::getLast(); i++) { - EmoteInfo info = EmoteDB::get(i); - - if (info.sprites != EmoteDB::getUnknown().sprites) - { - std::string file = "graphics/sprites/" + info.sprites.front()->sprite; - int variant = info.sprites.front()->variant; - mEmoteImg.push_back(AnimatedSprite::load(file, variant)); - } + mEmoteImg.push_back(player_node->getEmote(i)); } mSelImg = resman->getImage("graphics/gui/selection.png"); diff --git a/src/gui/emoteshortcutcontainer.cpp b/src/gui/emoteshortcutcontainer.cpp index edaa8602..a7347bb0 100644 --- a/src/gui/emoteshortcutcontainer.cpp +++ b/src/gui/emoteshortcutcontainer.cpp @@ -57,14 +57,7 @@ EmoteShortcutContainer::EmoteShortcutContainer(): // Setup emote sprites for (int i = 0; i <= EmoteDB::getLast(); i++) { - EmoteInfo info = EmoteDB::get(i); - - if (info.sprites != EmoteDB::getUnknown().sprites) - { - std::string file = "graphics/sprites/" + info.sprites.front()->sprite; - int variant = info.sprites.front()->variant; - mEmoteImg.push_back(AnimatedSprite::load(file, variant)); - } + mEmoteImg.push_back(player_node->getEmote(i)); } mMaxItems = MAX_ITEMS; |