Fixed bug with buildings and added gems to material definition.

develop
Warmist 2013-06-27 18:11:50 +03:00
parent b12fd5a4c5
commit 28985167c9
3 changed files with 17 additions and 4 deletions

@ -884,11 +884,15 @@ void lightingEngineViewscreen::doOcupancyAndLights()
df::coord2d p1(bld->x1,bld->y1);
df::coord2d p2(bld->x2,bld->y2);
p1=worldToViewportCoord(p1,vp,window2d);
p2=worldToViewportCoord(p1,vp,window2d);
p2=worldToViewportCoord(p2,vp,window2d);
if(isInViewport(p1,vp)||isInViewport(p2,vp))
{
int tile=getIndex(p1.x,p1.y); //TODO multitile buildings. How they would work?
int tile;
if(isInViewport(p1,vp))
tile=getIndex(p1.x,p1.y); //TODO multitile buildings. How they would work?
else
tile=getIndex(p2.x,p2.y);
df::building_type type = bld->getType();
buildingLightDef* def=getBuilding(bld);
if(!def)

@ -114,7 +114,6 @@ struct matLightDef
matLightDef(lightCell transparency):isTransparent(true),isEmiting(false),transparency(transparency){}
lightSource makeSource(float size=1) const
{
//TODO implement sizeModifiesPower/range
if(size>0.999 && size<1.001)
return lightSource(emitColor,radius);
else

@ -92,6 +92,16 @@ function makeMaterialDef(transparency,emitance,radius,flags)
end
return {tr=transparency,em=emitance,rad=radius,flags=flg}
end
function colorFrom16(col16)
return copyall(df.global.enabler.ccolor[col16])
end
function addGems()
for k,v in pairs(df.global.world.raws.inorganics) do
if v.material.flags.IS_GEM then
addMaterial("INORGANIC:"..v.id,colorFrom16(v.material.build_color[0]))
end
end
end
------------------------------------------------------------------------
---------------- Configuration Starts Here -------------------------
------------------------------------------------------------------------
@ -128,7 +138,7 @@ addMaterial("PLANT:MUSHROOM_HELMET_PLUMP",nil,{0.2,0.1,0.6},2)
addMaterial("INORGANIC:ADAMANTINE",{0.1,0.3,0.3},{0.1,0.3,0.3},4)
-- creature stuff
addMaterial("CREATURE:DRAGON:BLOOD",nil,{0.6,0.1,0.1},4)
-- TODO gems
addGems()
--buildings
addBuilding("Statue",{1,1,1},{0.9,0.75,0.3},8)
addBuilding("Bed",{1,1,1},{0.3,0.2,0.0},2)