From dceec6c6c746aebca316f8094dda44a8d4d1c00a Mon Sep 17 00:00:00 2001 From: Warmist Date: Tue, 25 Jun 2013 01:25:38 +0300 Subject: [PATCH] Plantfix, viewport height fix, and fov viewport fix. --- plugins/rendermax/renderer_light.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/plugins/rendermax/renderer_light.cpp b/plugins/rendermax/renderer_light.cpp index 765613bac..fea6999d1 100644 --- a/plugins/rendermax/renderer_light.cpp +++ b/plugins/rendermax/renderer_light.cpp @@ -66,7 +66,7 @@ rect2d getMapViewport() if(menu_pos < 2) menu_x = menu_x1; 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) { @@ -123,8 +123,7 @@ lightCell blend(lightCell a,lightCell b) } bool lightingEngineViewscreen::lightUpCell(lightCell& power,int dx,int dy,int tx,int ty) { - - if(tx>=mapPort.first.x && ty>=mapPort.first.y && tx<=mapPort.second.x && ty<=mapPort.second.y) + if(isInViewport(coord2d(tx,ty),mapPort)) { size_t tile=getIndex(tx,ty); int dsq=dx*dx+dy*dy; @@ -524,8 +523,11 @@ void lightingEngineViewscreen::doOcupancyAndLights() } } } - //flows + df::map_block* block=b->getRaw(); + if(!block) + continue; + //flows for(int i=0;iflows.size();i++) { df::flow_info* f=block->flows[i]; @@ -554,6 +556,7 @@ void lightingEngineViewscreen::doOcupancyAndLights() } } } + //plants for(int i=0;iplants.size();i++) { df::plant* cPlant=block->plants[i]; @@ -563,7 +566,7 @@ void lightingEngineViewscreen::doOcupancyAndLights() int tile=getIndex(pos.x,pos.y); if(isInViewport(pos,vp)) { - applyMaterial(tile,cPlant->material,-1); + applyMaterial(tile,419,cPlant->material); } } }