stack/render order working more like tibia
This commit is contained in:
parent
0b4d7ace05
commit
3b5dd3ecf9
|
@ -42,10 +42,24 @@ void Tile::draw(int x, int y)
|
|||
// first bottom items
|
||||
for(const ThingPtr& thing : m_things) {
|
||||
const ThingType& type = thing->getType();
|
||||
if(thing->asCreature() || type.isOnTop)
|
||||
continue;
|
||||
if(!type.isGround && !type.isGroundClip && !type.isOnBottom)
|
||||
break;
|
||||
thing->draw(x - m_drawElevation, y - m_drawElevation);
|
||||
m_drawElevation += type.elevation;
|
||||
if(m_drawElevation > MAX_DRAW_ELEVATION)
|
||||
m_drawElevation = MAX_DRAW_ELEVATION;
|
||||
}
|
||||
|
||||
// now common items
|
||||
for(auto it = m_things.rbegin(); it != m_things.rend(); ++it) {
|
||||
const ThingPtr& thing = *it;
|
||||
const ThingType& type = thing->getType();
|
||||
if(type.isOnTop || type.isOnBottom || type.isGround || type.isGroundClip)
|
||||
break;
|
||||
thing->draw(x - m_drawElevation, y - m_drawElevation);
|
||||
m_drawElevation += type.elevation;
|
||||
if(m_drawElevation > MAX_DRAW_ELEVATION)
|
||||
m_drawElevation = MAX_DRAW_ELEVATION;
|
||||
}
|
||||
|
||||
// creatures
|
||||
|
@ -164,7 +178,7 @@ bool Tile::isFullyOpaque()
|
|||
ThingPtr firstObject = getThing(0);
|
||||
if(firstObject) {
|
||||
const ThingType& type = firstObject->getType();
|
||||
if(type.isGround && !type.isTranslucent)
|
||||
if(type.isFullGround)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -28,6 +28,9 @@
|
|||
|
||||
class Tile : public LuaObject
|
||||
{
|
||||
enum {
|
||||
MAX_DRAW_ELEVATION = 24
|
||||
};
|
||||
public:
|
||||
Tile(const Position& position);
|
||||
|
||||
|
|
|
@ -903,7 +903,7 @@ void ProtocolGame::setTileDescription(InputMessage& msg, Position position)
|
|||
logWarning("Too many things!");
|
||||
|
||||
ThingPtr thing = internalGetThing(msg);
|
||||
g_map.addThing(thing, position);
|
||||
g_map.addThing(thing, position, 255);
|
||||
}
|
||||
stackPos++;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue