develop
Japa 2013-06-24 05:37:59 +05:30
commit ec913c2c5e
2 changed files with 47 additions and 9 deletions

@ -2,12 +2,14 @@
#include <functional> #include <functional>
#include <string> #include <string>
#include <math.h>
#include "Types.h" #include "Types.h"
#include "modules/Gui.h" #include "modules/Gui.h"
#include "modules/Screen.h" #include "modules/Screen.h"
#include "modules/Maps.h" #include "modules/Maps.h"
#include "modules/Units.h"
#include "df/graphic.h" #include "df/graphic.h"
#include "df/viewscreen_dwarfmodest.h" #include "df/viewscreen_dwarfmodest.h"
@ -266,13 +268,16 @@ void lightingEngineViewscreen::initRawSpecific()
static size_t max_list_size = 100000; // Avoid iterating over huge lists static size_t max_list_size = 100000; // Avoid iterating over huge lists
void lightingEngineViewscreen::doOcupancyAndLights() void lightingEngineViewscreen::doOcupancyAndLights()
{ {
lightSource sun(lightCell(1,1,1),15); // TODO better curve (+red dawn ?)
float daycol = abs((*df::global::cur_year_tick % 1200) - 600.0) / 600.0;
lightCell sky_col(daycol, daycol, daycol);
lightSource sky(sky_col, 15);
lightSource lava(lightCell(0.8f,0.2f,0.2f),5); lightSource lava(lightCell(0.8f,0.2f,0.2f),5);
lightSource candle(lightCell(0.96f,0.84f,0.03f),5); lightSource candle(lightCell(0.96f,0.84f,0.03f),5);
lightSource torch(lightCell(0.9f,0.75f,0.3f),8); lightSource torch(lightCell(0.9f,0.75f,0.3f),8);
rect2d vp=getMapViewport(); rect2d vp=getMapViewport();
int window_x=*df::global::window_x; int window_x=*df::global::window_x;
int window_y=*df::global::window_y; int window_y=*df::global::window_y;
int window_z=*df::global::window_z; int window_z=*df::global::window_z;
@ -290,7 +295,7 @@ void lightingEngineViewscreen::doOcupancyAndLights()
for(int block_x = 0; block_x < 16; block_x++) for(int block_x = 0; block_x < 16; block_x++)
for(int block_y = 0; block_y < 16; block_y++) for(int block_y = 0; block_y < 16; block_y++)
{ {
cellArray[block_x][block_y] = lightCell(1,1,1); cellArray[block_x][block_y] = sky_col;
} }
int totalBlank = 0; int totalBlank = 0;
int topLevel = df::global::world->map.z_count-1; int topLevel = df::global::world->map.z_count-1;
@ -360,7 +365,7 @@ void lightingEngineViewscreen::doOcupancyAndLights()
if(!type) if(!type)
{ {
//unallocated, do sky //unallocated, do sky
addLight(tile,sun); addLight(tile,sky);
continue; continue;
} }
df::tiletype_shape shape = ENUM_ATTR(tiletype,shape,*type); df::tiletype_shape shape = ENUM_ATTR(tiletype,shape,*type);
@ -451,7 +456,7 @@ void lightingEngineViewscreen::doOcupancyAndLights()
} }
if(d->bits.outside && d->bits.flow_size==0) if(d->bits.outside && d->bits.flow_size==0)
{ {
addLight(tile,sun); addLight(tile,sky);
} }
} }
@ -518,4 +523,15 @@ void lightingEngineViewscreen::doOcupancyAndLights()
int tile=getIndex(wx,wy); int tile=getIndex(wx,wy);
addLight(tile,cursor); addLight(tile,cursor);
} }
lightSource citizen(lightCell(0.80f,0.80f,0.90f),6);
for (int i=0;i<df::global::world->units.active.size();++i)
{
df::unit *u = df::global::world->units.active[i];
if (u->pos.z != window_z ||
(u->pos.x < window_x || u->pos.x >= window_x+vpW) ||
(u->pos.y < window_y || u->pos.y >= window_y+vpH))
continue;
if (DFHack::Units::isCitizen(u))
addLight(getIndex(u->pos.x-window_x+1, u->pos.y-window_y+1),citizen);
}
} }

@ -1306,6 +1306,27 @@ local function find_cur_year_tick()
ms.found_offset('cur_year_tick', addr) ms.found_offset('cur_year_tick', addr)
end end
local function find_cur_year_tick_advmode()
stop_autosave()
local feed = dwarfmode_to_top()
local addr = searcher:find_interactive(
'Searching for cur_year_tick_advmode.',
'int32_t',
function(idx)
if idx > 0 then
if not step_n_frames(1, feed) then
return false
end
end
return true, nil, 144
end,
20
)
ms.found_offset('cur_year_tick_advmode', addr)
end
-- --
-- cur_season_tick -- cur_season_tick
-- --
@ -1329,7 +1350,7 @@ menu, then do as instructed below:]],
return false return false
end end
end end
return true, math.floor(((df.global.cur_year_tick+10)%100800)/10) return true, math.floor((df.global.cur_year_tick%100800)/10)
end end
) )
ms.found_offset('cur_season_tick', addr) ms.found_offset('cur_season_tick', addr)
@ -1361,7 +1382,7 @@ menu, then do as instructed below:]],
return false return false
end end
end end
return true, math.floor((df.global.cur_year_tick+10)/100800)%4 return true, math.floor(df.global.cur_year_tick/100800)%4
end end
) )
ms.found_offset('cur_season', addr) ms.found_offset('cur_season', addr)
@ -1499,6 +1520,7 @@ print('\nUnpausing globals:\n')
exec_finder(find_cur_year, 'cur_year') exec_finder(find_cur_year, 'cur_year')
exec_finder(find_cur_year_tick, 'cur_year_tick') exec_finder(find_cur_year_tick, 'cur_year_tick')
exec_finder(find_cur_year_tick_advmode, 'cur_year_tick_advmode')
exec_finder(find_cur_season_tick, 'cur_season_tick') exec_finder(find_cur_season_tick, 'cur_season_tick')
exec_finder(find_cur_season, 'cur_season') exec_finder(find_cur_season, 'cur_season')
exec_finder(find_process_jobs, 'process_jobs') exec_finder(find_process_jobs, 'process_jobs')