diff --git a/plugins/rendermax/renderer_light.cpp b/plugins/rendermax/renderer_light.cpp index 753fefcba..c6b8f67e0 100644 --- a/plugins/rendermax/renderer_light.cpp +++ b/plugins/rendermax/renderer_light.cpp @@ -25,6 +25,7 @@ using namespace DFHack; using df::coord2d; const float levelDim=0.2f; +const float RootTwo = 1.4142135623730950488016887242097f; rect2d getMapViewport() { @@ -94,8 +95,9 @@ void plotLine(int x0, int y0, int x1, int y1,std::function=mapPort.first.x && ty>=mapPort.first.y && tx<=mapPort.second.x && ty<=mapPort.second.y) { size_t tile=getIndex(tx,ty); - float dsq=dx*dx+dy*dy; - float dt=sqrt(dsq); + int dsq=dx*dx+dy*dy; + float dt=1; + if(dsq == 1) + dt=1; + else if(dsq == 2) + dt = RootTwo; + else if(dsq == 0) + dt = 0; + else + dt=sqrt((float)dsq); lightCell& v=ocupancy[tile]; lightSource& ls=lights[tile]; bool wallhack=false; @@ -173,7 +183,7 @@ void lightingEngineViewscreen::doFovs() int surrounds = 0; lightCell curPower; - if(lightUpCell(curPower = power, 0, 0,i+0, j+0)) + lightUpCell(curPower = power, 0, 0,i+0, j+0); { surrounds += lightUpCell(curPower = power, 0, 1,i+0, j+1); surrounds += lightUpCell(curPower = power, 1, 1,i+1, j+1); @@ -521,7 +531,7 @@ void lightingEngineViewscreen::doOcupancyAndLights() if(df::global::cursor->x>-30000) { lightSource cursor(lightCell(0.96f,0.84f,0.03f),11); - cursor.flicker=true; + cursor.flicker=false; int wx=df::global::cursor->x-window_x+vp.first.x; int wy=df::global::cursor->y-window_y+vp.first.y; int tile=getIndex(wx,wy); diff --git a/plugins/rendermax/renderer_light.hpp b/plugins/rendermax/renderer_light.hpp index 3744fd5bc..98ea502bd 100644 --- a/plugins/rendermax/renderer_light.hpp +++ b/plugins/rendermax/renderer_light.hpp @@ -127,4 +127,4 @@ private: int w,h; DFHack::rect2d mapPort; }; -#endif \ No newline at end of file +#endif