tibia-client/src/otclient/core/item.cpp

36 lines
943 B
C++
Raw Normal View History

2011-08-15 16:11:24 +02:00
#include "item.h"
2011-08-15 21:15:49 +02:00
#include "datmanager.h"
#include "spritemanager.h"
2011-08-15 16:11:24 +02:00
#include <framework/graphics/graphics.h>
#include "thing.h"
2011-08-15 23:02:52 +02:00
Item::Item() : Thing(THING_ITEM)
2011-08-15 16:11:24 +02:00
{
2011-08-15 23:02:52 +02:00
m_count = 0;
2011-08-15 16:11:24 +02:00
}
void Item::draw(int x, int y)
{
2011-08-15 23:02:52 +02:00
const ThingAttributes& attributes = g_dat.getItemAttributes(m_id);
2011-08-15 16:11:24 +02:00
int xdiv = 0, ydiv = 0, zdiv = 0, anim = 0;
2011-08-15 21:15:49 +02:00
if(attributes.group == THING_GROUP_SPLASH || attributes.group == THING_GROUP_FLUID || attributes.stackable) {
2011-08-15 16:11:24 +02:00
//cDivX = subType % itemAttributes->xdiv;
//cDivY = subType / itemAttributes->xdiv;
}
2011-08-15 21:15:49 +02:00
else if(!attributes.moveable) {
xdiv = m_position.x % attributes.xdiv;
ydiv = m_position.y % attributes.ydiv;
zdiv = m_position.z % attributes.zdiv;
2011-08-15 16:11:24 +02:00
}
2011-08-15 21:15:49 +02:00
for(int b = 0; b < attributes.blendframes; b++)
2011-08-15 16:11:24 +02:00
internalDraw(x, y, b, xdiv, ydiv, zdiv, anim);
}
2011-08-15 23:02:52 +02:00
const ThingAttributes& Item::getAttributes()
{
return g_dat.getItemAttributes(m_id);
}