fix drawing of hangable objects

master
Eduardo Bart 12 years ago
parent ef96215421
commit 2eec08d091

@ -24,6 +24,7 @@
#include "thingstype.h"
#include "spritemanager.h"
#include "thing.h"
#include "tile.h"
#include <framework/core/clock.h>
#include <framework/core/eventdispatcher.h>
#include <framework/graphics/graphics.h>
@ -33,7 +34,7 @@
Item::Item() : Thing()
{
m_id = 0;
m_countOrSubType = 1;
m_countOrSubType = 0;
}
ItemPtr Item::create(int id)
@ -87,10 +88,13 @@ void Item::draw(const Point& dest, float scaleFactor, bool animate)
yPattern = 1;
}
} else if(isHangable()) {
if(isHookSouth())
xPattern = getNumPatternsX() >= 2 ? 1 : 0;
else if(isHookEast())
xPattern = getNumPatternsX() >= 3 ? 2 : 0;
const TilePtr& tile = getTile();
if(tile) {
if(tile->mustHookSouth())
xPattern = getNumPatternsX() >= 2 ? 1 : 0;
else if(tile->mustHookSouth())
xPattern = getNumPatternsX() >= 3 ? 2 : 0;
}
} else if(isFluid() || isFluidContainer()) {
int color = Otc::FluidTransparent;
switch(m_countOrSubType) {

@ -374,6 +374,22 @@ bool Tile::isEmpty()
return m_things.size() == 0;
}
bool Tile::mustHookEast()
{
for(const ThingPtr& thing : m_things)
if(thing->isHookEast())
return true;
return false;
}
bool Tile::mustHookSouth()
{
for(const ThingPtr& thing : m_things)
if(thing->isHookSouth())
return true;
return false;
}
bool Tile::hasCreature()
{
for(const ThingPtr& thing : m_things)

@ -63,6 +63,8 @@ public:
bool isLookPossible();
bool isClickable();
bool isEmpty();
bool mustHookSouth();
bool mustHookEast();
bool hasCreature();
bool limitsFloorsView();
int getThingCount() { return m_things.size() + m_effects.size(); }

@ -113,6 +113,7 @@ void OTClient::registerLuaFunctions()
g_lua.bindClassMemberFunction<Thing>("isPickupable", &Thing::isPickupable);
g_lua.bindClassMemberFunction<Thing>("isIgnoreLook", &Thing::isIgnoreLook);
g_lua.bindClassMemberFunction<Thing>("isStackable", &Thing::isStackable);
g_lua.bindClassMemberFunction<Thing>("isHookSouth", &Thing::isHookSouth);
g_lua.bindClassMemberFunction<Thing>("isTranslucent", &Thing::isTranslucent);
g_lua.bindClassMemberFunction<Thing>("isFullGround", &Thing::isFullGround);

Loading…
Cancel
Save