summaryrefslogtreecommitdiff
path: root/Block.cpp
diff options
context:
space:
mode:
authorJapa Illo2012-03-26 13:16:58 +0200
committerJapa Illo2012-03-26 13:16:58 +0200
commitdf37cc7e59b3cf5fadfa680a68793b91810a30ff (patch)
treec1f9e2b3d4e2d1cf6d2fe7b9a15e801d441cbae9 /Block.cpp
parent3f7c63d777bf3722c07fdea721652da22fd2bbc2 (diff)
downloadstonesense-df37cc7e59b3cf5fadfa680a68793b91810a30ff.tar.gz
stonesense-df37cc7e59b3cf5fadfa680a68793b91810a30ff.tar.bz2
stonesense-df37cc7e59b3cf5fadfa680a68793b91810a30ff.tar.xz
Added configurable sprite support for items on the floor.
Signed-off-by: Japa Illo <japa.mala.illo@gmail.com>
Diffstat (limited to 'Block.cpp')
-rw-r--r--Block.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/Block.cpp b/Block.cpp
index d165a8d..4327792 100644
--- a/Block.cpp
+++ b/Block.cpp
@@ -64,7 +64,10 @@ Block::Block(WorldSegment* ownerSegment)
engraving_character = 0;
visible = true;
- this->Item.item.type =-1;
+ Item.item.type =-1;
+ Item.dyed = 0;
+ Item.matt.type=-1;
+ Item.matt.index=-1;
}
@@ -286,7 +289,21 @@ void Block::Draw()
//items
if(Item.item.type >= 0)
{
- DrawSpriteFromSheet( 350, IMGObjectSheet, lookupMaterialColor(Item.matt.type, Item.matt.index), drawx, (tileShapeBasic==tiletype_shape_basic::Ramp)?(drawy - ((WALLHEIGHT/2)*config.scale)):drawy , this);
+ if(
+ contentLoader->itemConfigs[Item.item.type] &&
+ (Item.item.type < contentLoader->itemConfigs[Item.item.type]->subItems.size()) &&
+ contentLoader->itemConfigs[Item.item.type]->subItems[Item.item.type])
+ {
+ contentLoader->itemConfigs[Item.item.type]->subItems[Item.item.type]->sprite.draw_world(x, y, z, this);
+ }
+ else if (
+ contentLoader->itemConfigs[Item.item.type] &&
+ contentLoader->itemConfigs[Item.item.type]->configured)
+ {
+ contentLoader->itemConfigs[Item.item.type]->default_sprite.draw_world(x, y, z, this);
+ }
+ else
+ DrawSpriteFromSheet( 350, IMGObjectSheet, lookupMaterialColor(Item.matt.type, Item.matt.index, Item.dyed), drawx, (tileShapeBasic==tiletype_shape_basic::Ramp)?(drawy - ((WALLHEIGHT/2)*config.scale)):drawy , this);
}