diff options
| author | Japa Illo | 2012-03-24 13:27:25 +0100 |
|---|---|---|
| committer | Japa Illo | 2012-03-24 13:27:25 +0100 |
| commit | 3f7c63d777bf3722c07fdea721652da22fd2bbc2 (patch) | |
| tree | fdafc632a4c9fa26cfc82df51bd2be6261dc5bda | |
| parent | 9e7bff5c321b3da4cf73546ede00095351ee1b43 (diff) | |
| download | stonesense-3f7c63d777bf3722c07fdea721652da22fd2bbc2.tar.gz stonesense-3f7c63d777bf3722c07fdea721652da22fd2bbc2.tar.bz2 stonesense-3f7c63d777bf3722c07fdea721652da22fd2bbc2.tar.xz | |
Added rudimentary floor item showage.
Signed-off-by: Japa Illo <japa.mala.illo@gmail.com>
| -rw-r--r-- | Block.cpp | 7 | ||||
| -rw-r--r-- | Block.h | 6 | ||||
| -rw-r--r-- | MapLoading.cpp | 39 |
3 files changed, 51 insertions, 1 deletions
@@ -63,6 +63,8 @@ Block::Block(WorldSegment* ownerSegment) creature = 0;
engraving_character = 0;
visible = true;
+
+ this->Item.item.type =-1;
}
@@ -281,6 +283,11 @@ void Block::Draw() // vegetationsprite->draw_world(x, y, z);
//}
+ //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);
+ }
//shadow
@@ -143,6 +143,12 @@ public: bool obscuringCreature;
bool obscuringBuilding;
+ struct SS_Item
+ {
+ DFHack::t_matglossPair item;
+ DFHack::t_matglossPair matt;
+ } Item;
+
//These are actually applied to the creature standing here, but there's only one creature shown, so it's okay.
Unit_Inventory * inv;
diff --git a/MapLoading.cpp b/MapLoading.cpp index c4d0524..9037947 100644 --- a/MapLoading.cpp +++ b/MapLoading.cpp @@ -10,7 +10,9 @@ #include "Occlusion_Test.h"
#include <df/plant.h>
#include <df/effect.h>
-
+#include "df/item_constructed.h"
+#include "df/itemimprovement.h"
+#include "df/itemimprovement_threadst.h"
/*
static DFHack::Core* pDFApiHandle = 0;
static DFHack::Process * DFProc = 0;
@@ -491,6 +493,41 @@ void ReadCellToSegment(DFHack::Core& DF, WorldSegment& segment, int CellX, int C }
}
+ //add items
+ for(auto iter = trueBlock->items.begin(); iter != trueBlock->items.end(); iter++)
+ {
+ int32_t item_index = *iter;
+ df::item * found_item = df::item::find(item_index);
+ if(!found_item) continue;
+ Block* b = segment.getBlock( found_item->pos.x, found_item->pos.y, found_item->pos.z);
+ if(!b) continue;
+ b->Item.item.type = found_item->getType(); //itemtype
+ b->Item.item.index = found_item->getSubtype(); //item subtype
+
+ b->Item.matt.type = found_item->getActualMaterial();
+ b->Item.matt.index = found_item->getActualMaterialIndex();
+
+ if(found_item->isDyed())
+ {
+ auto Constructed_Item = virtual_cast<df::item_constructed>(found_item);
+ if(Constructed_Item)
+ {
+ for(int idex = 0; idex < Constructed_Item->improvements.size(); idex++)
+ {
+ if(!Constructed_Item->improvements[idex])
+ continue;
+ if(Constructed_Item->improvements[idex]->getType() != improvement_type::THREAD)
+ continue;
+ auto Improvement_Thread = virtual_cast<df::itemimprovement_threadst>(Constructed_Item->improvements[idex]);
+ if(!Improvement_Thread)
+ continue;
+ b->Item.matt.type = Improvement_Thread->dye.mat_type;
+ b->Item.matt.index = Improvement_Thread->dye.mat_index;
+ }
+ }
+ }
+ }
+
//add effects
for(auto iter = trueBlock->effects.begin(); iter != trueBlock->effects.end(); iter++)
{
|
