item animation sync fixed
This commit is contained in:
parent
b66cf3373f
commit
1406e23c23
|
@ -36,12 +36,7 @@ void Item::draw(int x, int y)
|
|||
{
|
||||
const ThingType& type = g_thingsType.getItemType(m_id);
|
||||
|
||||
if(type.animationPhases > 1) {
|
||||
if(g_platform.getTicks() - m_lastTicks > 500) {
|
||||
m_animation++;
|
||||
m_lastTicks = g_platform.getTicks();
|
||||
}
|
||||
}
|
||||
m_animation = (g_platform.getTicks() % (500 * type.animationPhases)) / 500;
|
||||
|
||||
/*if(type.group == Otc::ThingSplashGroup || type.group == Otc::ThingFluidGroup) {
|
||||
//xPattern = m_count % type.xPattern;
|
||||
|
|
|
@ -32,6 +32,14 @@ Thing::Thing() : m_id(0)
|
|||
m_animation = 0;
|
||||
}
|
||||
|
||||
void Thing::setId(uint32 id)
|
||||
{
|
||||
int oldId = m_id;
|
||||
m_id = id;
|
||||
|
||||
onIdChange(oldId);
|
||||
}
|
||||
|
||||
void Thing::setPosition(const Position& position)
|
||||
{
|
||||
Position oldPosition = m_position;
|
||||
|
|
|
@ -41,7 +41,7 @@ public:
|
|||
|
||||
virtual void draw(int x, int y) = 0;
|
||||
|
||||
void setId(uint32 id) { m_id = id; }
|
||||
void setId(uint32 id);
|
||||
void setPosition(const Position& position);
|
||||
|
||||
uint32 getId() const { return m_id; }
|
||||
|
@ -49,6 +49,7 @@ public:
|
|||
int getStackPriority();
|
||||
virtual const ThingType& getType() = 0;
|
||||
|
||||
virtual void onIdChange(int) {}
|
||||
virtual void onPositionChange(const Position&) {}
|
||||
|
||||
ThingPtr asThing() { return std::static_pointer_cast<Thing>(shared_from_this()); }
|
||||
|
|
Loading…
Reference in New Issue