Plantfix, viewport height fix, and fov viewport fix.

develop
Warmist 2013-06-25 01:25:38 +03:00
parent 4ccc95bc97
commit dceec6c6c7
1 changed files with 8 additions and 5 deletions

@ -66,7 +66,7 @@ rect2d getMapViewport()
if(menu_pos < 2) menu_x = menu_x1; if(menu_pos < 2) menu_x = menu_x1;
view_rb = menu_x; view_rb = menu_x;
} }
return mkrect_wh(1,1,view_rb,view_height); return mkrect_wh(1,1,view_rb,view_height+1);
} }
lightingEngineViewscreen::lightingEngineViewscreen(renderer_light* target):lightingEngine(target) lightingEngineViewscreen::lightingEngineViewscreen(renderer_light* target):lightingEngine(target)
{ {
@ -123,8 +123,7 @@ lightCell blend(lightCell a,lightCell b)
} }
bool lightingEngineViewscreen::lightUpCell(lightCell& power,int dx,int dy,int tx,int ty) bool lightingEngineViewscreen::lightUpCell(lightCell& power,int dx,int dy,int tx,int ty)
{ {
if(isInViewport(coord2d(tx,ty),mapPort))
if(tx>=mapPort.first.x && ty>=mapPort.first.y && tx<=mapPort.second.x && ty<=mapPort.second.y)
{ {
size_t tile=getIndex(tx,ty); size_t tile=getIndex(tx,ty);
int dsq=dx*dx+dy*dy; int dsq=dx*dx+dy*dy;
@ -524,8 +523,11 @@ void lightingEngineViewscreen::doOcupancyAndLights()
} }
} }
} }
//flows
df::map_block* block=b->getRaw(); df::map_block* block=b->getRaw();
if(!block)
continue;
//flows
for(int i=0;i<block->flows.size();i++) for(int i=0;i<block->flows.size();i++)
{ {
df::flow_info* f=block->flows[i]; df::flow_info* f=block->flows[i];
@ -554,6 +556,7 @@ void lightingEngineViewscreen::doOcupancyAndLights()
} }
} }
} }
//plants
for(int i=0;i<block->plants.size();i++) for(int i=0;i<block->plants.size();i++)
{ {
df::plant* cPlant=block->plants[i]; df::plant* cPlant=block->plants[i];
@ -563,7 +566,7 @@ void lightingEngineViewscreen::doOcupancyAndLights()
int tile=getIndex(pos.x,pos.y); int tile=getIndex(pos.x,pos.y);
if(isInViewport(pos,vp)) if(isInViewport(pos,vp))
{ {
applyMaterial(tile,cPlant->material,-1); applyMaterial(tile,419,cPlant->material);
} }
} }
} }