summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/being.cpp37
-rw-r--r--src/beingmanager.cpp4
-rw-r--r--src/npc.cpp25
-rw-r--r--src/npc.h2
4 files changed, 64 insertions, 4 deletions
diff --git a/src/being.cpp b/src/being.cpp
index 843f7da6..e24dee21 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -718,10 +718,34 @@ void Being::logic()
if (mUsedTargetCursor)
mUsedTargetCursor->update(tick_time * 10);
+ if (getType() == NPC)
+ {
+ for (int i = 0; i < VECTOREND_SPRITE; i++)
+ {
+ if (mSprites[i])
+ printf("Has sprite %d\n", i);
+ else
+ printf("Has not sprite %d\n", i);
+ }
+ }
+
for (int i = 0; i < VECTOREND_SPRITE; i++)
{
if (mSprites[i])
mSprites[i]->update(tick_time * 10);
+ }////
+
+ if (getType() == NPC)
+ {
+ for (int i = 0; i < VECTOREND_SPRITE; i++)
+ {
+ if (mSprites[i])
+ printf("Has sprite %d\n", i);
+ else
+ printf("Has not sprite %d\n", i);
+ }
+
+ assert(false);
}
// Restart status/particle effects, if needed
@@ -757,6 +781,19 @@ void Being::draw(Graphics *graphics, int offsetX, int offsetY) const
mSprites[i]->draw(graphics, px, py);
}
}
+
+ if (getType() == NPC)
+ {
+ for (int i = 0; i < VECTOREND_SPRITE; i++)
+ {
+ if (mSprites[i])
+ printf("Has sprite %d\n", i);
+ else
+ printf("Has not sprite %d\n", i);
+ }
+
+ assert(false);
+ }
}
void Being::drawEmotion(Graphics *graphics, int offsetX, int offsetY)
diff --git a/src/beingmanager.cpp b/src/beingmanager.cpp
index d128c3e0..284f1343 100644
--- a/src/beingmanager.cpp
+++ b/src/beingmanager.cpp
@@ -107,10 +107,6 @@ Being *BeingManager::createBeing(int id, Being::Type type, int subtype)
void BeingManager::destroyBeing(Being *being)
{
mBeings.remove(being);
-#ifdef TMWSERV_SUPPORT
- if(being == player_node->getTarget())
- player_node->setTarget(NULL);
-#endif
delete being;
}
diff --git a/src/npc.cpp b/src/npc.cpp
index a49ef406..89b92ffe 100644
--- a/src/npc.cpp
+++ b/src/npc.cpp
@@ -52,6 +52,10 @@ NPC::NPC(int id, int job, Map *map):
std::string file = "graphics/sprites/" + (*i)->sprite;
int variant = (*i)->variant;
mSprites[c] = AnimatedSprite::load(file, variant);
+ if (mSprites[c])
+ printf("Placed sprite '%s'(%d) at %d\n", file.c_str(), variant, c);
+ else
+ printf("Placed nonsprite '%s'(%d) at %d\n", file.c_str(), variant, c);
c++;
}
@@ -69,6 +73,14 @@ NPC::NPC(int id, int job, Map *map):
mName = 0;
mNameColor = &guiPalette->getColor(Palette::NPC);
+
+ for (int i = 0; i < VECTOREND_SPRITE; i++)
+ {
+ if (mSprites[i])
+ printf("Has sprite %d\n", i);
+ else
+ printf("Has not sprite %d\n", i);
+ }
}
NPC::~NPC()
@@ -112,6 +124,8 @@ void NPC::talk()
isTalking = true;
+ checkSprites();
+
Net::getNpcHandler()->talk(mId);
}
@@ -122,3 +136,14 @@ void NPC::updateCoords()
mName->adviseXY(getPixelX(), getPixelY());
}
}
+
+void NPC::checkSprites()
+{
+ for (int i = 0; i < VECTOREND_SPRITE; i++)
+ {
+ if (mSprites[i])
+ printf("Has sprite %d\n", i);
+ else
+ printf("Has not sprite %d\n", i);
+ }
+}
diff --git a/src/npc.h b/src/npc.h
index 57e6d5a8..cd31e060 100644
--- a/src/npc.h
+++ b/src/npc.h
@@ -48,6 +48,8 @@ class NPC : public Player
virtual unsigned char getWalkMask() const
{ return 0x83; } // blocked like a monster by walls, monsters and characters ( bin 1000 0011)
+ void checkSprites();
+
static bool isTalking;
protected: