diff options
| author | Japa Illo | 2012-03-26 13:16:58 +0200 |
|---|---|---|
| committer | Japa Illo | 2012-03-26 13:16:58 +0200 |
| commit | df37cc7e59b3cf5fadfa680a68793b91810a30ff (patch) | |
| tree | c1f9e2b3d4e2d1cf6d2fe7b9a15e801d441cbae9 /Block.cpp | |
| parent | 3f7c63d777bf3722c07fdea721652da22fd2bbc2 (diff) | |
| download | stonesense-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.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
@@ -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);
}
|
