MCPcopy Create free account
hub / github.com/DFHack/dfhack / fixAdvMode

Method fixAdvMode

plugins/rendermax/renderer_light.cpp:326–361  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

324
325}
326void lightingEngineViewscreen::fixAdvMode(int mode)
327{
328
329 MapExtras::MapCache mc;
330 const rgbf dim(levelDim,levelDim,levelDim);
331 rect2d vp=getMapViewport();
332 int window_x=*df::global::window_x;
333 int window_y=*df::global::window_y;
334 int window_z=*df::global::window_z;
335 //mode 0-> make dark non-visible parts
336 if(mode==0)
337 {
338 for(int x=vp.first.x;x<vp.second.x;x++)
339 for(int y=vp.first.y;y<vp.second.y;y++)
340 {
341 df::tile_designation d=mc.designationAt(DFCoord(window_x+x,window_y+y,window_z));
342 if(d.bits.pile!=1)
343 {
344 lightMap[getIndex(x,y)]=dim;
345 }
346 }
347 }
348 //mode 1-> make everything visible, let the lighting hide stuff
349 else if(mode==1)
350 {
351 for(int x=vp.first.x;x<vp.second.x;x++)
352 for(int y=vp.first.y;y<vp.second.y;y++)
353 {
354 df::tile_designation d=mc.designationAt(DFCoord(window_x+x,window_y+y,window_z));
355 d.bits.dig=df::tile_dig_designation::Default;//TODO add union and flag there
356 d.bits.hidden=0;
357 d.bits.pile = 1;
358 mc.setDesignationAt(DFCoord(window_x+x,window_y+y,window_z),d);
359 }
360 }
361}
362void lightSource::combine(const lightSource& other)
363{
364 power=blend(power,other.power);

Callers

nothing calls this directly

Calls 2

getMapViewportFunction · 0.85
setDesignationAtMethod · 0.80

Tested by

no test coverage detected