summaryrefslogtreecommitdiff
path: root/src/being.cpp
diff options
context:
space:
mode:
authorEugenio Favalli <elvenprogrammer@gmail.com>2005-04-18 12:20:33 +0000
committerEugenio Favalli <elvenprogrammer@gmail.com>2005-04-18 12:20:33 +0000
commit05e45f0619982c0e1d8db1dd1db0d8ab9cbd7833 (patch)
treeb502cd7f6f302f4bea538399deecb60a0ad5ced2 /src/being.cpp
parent6c7e3f28ef63310d7635bfdaf9802b950d6db73e (diff)
downloadmana-client-05e45f0619982c0e1d8db1dd1db0d8ab9cbd7833.tar.gz
mana-client-05e45f0619982c0e1d8db1dd1db0d8ab9cbd7833.tar.bz2
mana-client-05e45f0619982c0e1d8db1dd1db0d8ab9cbd7833.tar.xz
mana-client-05e45f0619982c0e1d8db1dd1db0d8ab9cbd7833.zip
- New hat
- New way of loading monstersets - New monsters
Diffstat (limited to 'src/being.cpp')
-rw-r--r--src/being.cpp26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/being.cpp b/src/being.cpp
index 3411d5c7..d3e51a4d 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -23,8 +23,10 @@
#include "being.h"
#include "game.h"
+#include "engine.h"
#include "net/protocol.h"
#include "net/network.h"
+#include "resources/resourcemanager.h"
Being *player_node = NULL;
@@ -38,11 +40,25 @@ PATH_NODE::PATH_NODE(unsigned short x, unsigned short y):
void add_node(Being *being) {
beings.push_back(being);
// If the being is a player, request the name
- //if (being-> job < 10) {
- WFIFOW(0) = net_w_value(0x0094);
- WFIFOL(2) = net_l_value(RFIFOL(2));
- WFIFOSET(6);
- // }
+ if (being-> job < 10) {
+ WFIFOW(0) = net_w_value(0x0094);
+ WFIFOL(2) = net_l_value(RFIFOL(2));
+ WFIFOSET(6);
+ }
+ // If the being is a monster then load the monsterset
+ else if (being->job >= 1002 && monsterset[being->job - 1002] == NULL) {
+ std::stringstream filename;
+ filename << "graphics/sprites/monster" << (being->job - 1002) << ".png";
+ logger.log("%s",filename.str().c_str());
+ ResourceManager *resman = ResourceManager::getInstance();
+ Image *monsterbitmap = resman->getImage(filename.str());
+ if (!monsterbitmap) {
+ logger.error("Unable to load monster.png");
+ }
+ else {
+ monsterset[being->job - 1002] = new Spriteset(monsterbitmap, 60, 60);
+ }
+ }
}