summaryrefslogtreecommitdiff
path: root/src/npc.cpp
diff options
context:
space:
mode:
authorPhilipp Sehmisch <tmw@crushnet.org>2008-03-31 23:18:19 +0000
committerPhilipp Sehmisch <tmw@crushnet.org>2008-03-31 23:18:19 +0000
commita1226761e08f33146e5e175c9d8786dbc56fde82 (patch)
tree14bb520f37e4b2f05a6aa1a87d0e432a57b3faa8 /src/npc.cpp
parent434b8d571266c4eb90c4f8e9bfa0cc97f9172797 (diff)
downloadmana-client-a1226761e08f33146e5e175c9d8786dbc56fde82.tar.gz
mana-client-a1226761e08f33146e5e175c9d8786dbc56fde82.tar.bz2
mana-client-a1226761e08f33146e5e175c9d8786dbc56fde82.tar.xz
mana-client-a1226761e08f33146e5e175c9d8786dbc56fde82.zip
Implemented NPC XML database which maps NPC IDs to one or more animation files and thus enables animated NPCs.
Diffstat (limited to 'src/npc.cpp')
-rw-r--r--src/npc.cpp23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/npc.cpp b/src/npc.cpp
index 8e0b00a5..9336986d 100644
--- a/src/npc.cpp
+++ b/src/npc.cpp
@@ -29,14 +29,29 @@
#include "gui/gui.h"
#include "net/messageout.h"
#include "net/gameserver/player.h"
+#include "resources/npcdb.h"
NPC *current_npc = 0;
-NPC::NPC(Uint16 id, Uint16 job, Map *map):
- Being(id, job, map)
+NPC::NPC(Uint16 id, int sprite, Map *map):
+ Being(id, sprite, map)
{
- mSprites[BASE_SPRITE] = AnimatedSprite::load("graphics/sprites/npc.xml",
- job - 100);
+ NPCInfo info = NPCDB::get(sprite);
+ int c = BASE_SPRITE;
+
+ for (NPCInfo::const_iterator i = info.begin();
+ i != info.end();
+ i++)
+ {
+ if (c == VECTOREND_SPRITE) break;
+
+ std::string file = "graphics/sprites/" + (*i)->sprite;
+ int variant = (*i)->variant;
+ mSprites[c] = AnimatedSprite::load(file, variant);
+ c++;
+ }
+
+ mName = "NPC";
}
Being::Type