fix drawing of hangable objects
This commit is contained in:
parent
ef96215421
commit
2eec08d091
|
@ -24,6 +24,7 @@
|
||||||
#include "thingstype.h"
|
#include "thingstype.h"
|
||||||
#include "spritemanager.h"
|
#include "spritemanager.h"
|
||||||
#include "thing.h"
|
#include "thing.h"
|
||||||
|
#include "tile.h"
|
||||||
#include <framework/core/clock.h>
|
#include <framework/core/clock.h>
|
||||||
#include <framework/core/eventdispatcher.h>
|
#include <framework/core/eventdispatcher.h>
|
||||||
#include <framework/graphics/graphics.h>
|
#include <framework/graphics/graphics.h>
|
||||||
|
@ -33,7 +34,7 @@
|
||||||
Item::Item() : Thing()
|
Item::Item() : Thing()
|
||||||
{
|
{
|
||||||
m_id = 0;
|
m_id = 0;
|
||||||
m_countOrSubType = 1;
|
m_countOrSubType = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemPtr Item::create(int id)
|
ItemPtr Item::create(int id)
|
||||||
|
@ -87,10 +88,13 @@ void Item::draw(const Point& dest, float scaleFactor, bool animate)
|
||||||
yPattern = 1;
|
yPattern = 1;
|
||||||
}
|
}
|
||||||
} else if(isHangable()) {
|
} else if(isHangable()) {
|
||||||
if(isHookSouth())
|
const TilePtr& tile = getTile();
|
||||||
|
if(tile) {
|
||||||
|
if(tile->mustHookSouth())
|
||||||
xPattern = getNumPatternsX() >= 2 ? 1 : 0;
|
xPattern = getNumPatternsX() >= 2 ? 1 : 0;
|
||||||
else if(isHookEast())
|
else if(tile->mustHookSouth())
|
||||||
xPattern = getNumPatternsX() >= 3 ? 2 : 0;
|
xPattern = getNumPatternsX() >= 3 ? 2 : 0;
|
||||||
|
}
|
||||||
} else if(isFluid() || isFluidContainer()) {
|
} else if(isFluid() || isFluidContainer()) {
|
||||||
int color = Otc::FluidTransparent;
|
int color = Otc::FluidTransparent;
|
||||||
switch(m_countOrSubType) {
|
switch(m_countOrSubType) {
|
||||||
|
|
|
@ -374,6 +374,22 @@ bool Tile::isEmpty()
|
||||||
return m_things.size() == 0;
|
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()
|
bool Tile::hasCreature()
|
||||||
{
|
{
|
||||||
for(const ThingPtr& thing : m_things)
|
for(const ThingPtr& thing : m_things)
|
||||||
|
|
|
@ -63,6 +63,8 @@ public:
|
||||||
bool isLookPossible();
|
bool isLookPossible();
|
||||||
bool isClickable();
|
bool isClickable();
|
||||||
bool isEmpty();
|
bool isEmpty();
|
||||||
|
bool mustHookSouth();
|
||||||
|
bool mustHookEast();
|
||||||
bool hasCreature();
|
bool hasCreature();
|
||||||
bool limitsFloorsView();
|
bool limitsFloorsView();
|
||||||
int getThingCount() { return m_things.size() + m_effects.size(); }
|
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>("isPickupable", &Thing::isPickupable);
|
||||||
g_lua.bindClassMemberFunction<Thing>("isIgnoreLook", &Thing::isIgnoreLook);
|
g_lua.bindClassMemberFunction<Thing>("isIgnoreLook", &Thing::isIgnoreLook);
|
||||||
g_lua.bindClassMemberFunction<Thing>("isStackable", &Thing::isStackable);
|
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>("isTranslucent", &Thing::isTranslucent);
|
||||||
g_lua.bindClassMemberFunction<Thing>("isFullGround", &Thing::isFullGround);
|
g_lua.bindClassMemberFunction<Thing>("isFullGround", &Thing::isFullGround);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue