Experiment to use local color-shift in ToD areas.

Currently disabled because it's dumb code just to see how it looks (no
light transition yet).

Change 'local_light' to 'yes' in game_config.cfg to test it.
This commit is contained in:
Ali El Gariani 2010-07-18 17:10:26 +00:00
parent 033d07ea66
commit 715cb43ac1
4 changed files with 24 additions and 4 deletions

View file

@ -81,8 +81,9 @@
xp_bar_scaling=0.5
#temporary disable hex brightening
hex_brightening=1.0
hex_brightening=1.0
hex_semi_brightening=1.25
local_light=no
flag_image="flags/flag-1.png:150,flags/flag-2.png:150,flags/flag-3.png:150,flags/flag-4.png:150"
flag_icon_image="flags/flag-icon.png"

View file

@ -689,6 +689,14 @@ std::vector<surface> display::get_terrain_images(const map_location &loc,
const terrain_builder::imagelist* const terrains = builder_->get_terrain_at(loc,
timeid, builder_terrain_type);
std::string color_mod;
if(game_config::local_light){
const time_of_day tod = get_time_of_day(loc);
std::ostringstream mod;
mod << "~CS(" << tod.red << "," << tod.green << "," <<tod.blue << ")";
color_mod = mod.str();
}
if(terrains != NULL) {
// Cache the offmap name.
// Since it is themabel it can change,
@ -705,9 +713,17 @@ std::vector<surface> display::get_terrain_images(const map_location &loc,
// We need to test for the tile to be rendered and
// not the location, since the transitions are rendered
// over the offmap-terrain and these need a ToD coloring.
const bool off_map = (image.get_filename() == off_map_name);
const surface surf(image::get_image(image,
off_map ? image::UNMASKED : image_type));
surface surf;
if(!game_config::local_light) {
const bool off_map = (image.get_filename() == off_map_name);
surf = image::get_image(image, off_map ? image::UNMASKED : image_type);
} else {
std::string mod = image.get_modifications() + color_mod;
image::locator colored_image(image.get_filename(), image.get_loc(), image.get_center_x(), image.get_center_y(), mod);
surf = image::get_image(colored_image, image::UNMASKED);
}
if (!surf.null()) {
res.push_back(surf);

View file

@ -86,6 +86,7 @@ namespace game_config
double hex_brightening = 1.5;
double hex_semi_brightening = 1.25;
bool local_light = false;
std::vector<std::string> foot_speed_prefix;
std::string foot_teleport_enter = "footsteps/teleport-in.png";
@ -198,6 +199,7 @@ namespace game_config
xp_bar_scaling = v["xp_bar_scaling"].to_double(0.5);
hex_brightening = v["hex_brightening"].to_double(1.5);
hex_semi_brightening = v["hex_semi_brightening"].to_double(1.25);
local_light = v["local_light"].to_bool(false);
foot_speed_prefix = utils::split(v["footprint_prefix"]);
foot_teleport_enter = v["footprint_teleport_enter"].str();

View file

@ -80,6 +80,7 @@ namespace game_config
extern double hp_bar_scaling, xp_bar_scaling;
extern double hex_brightening;
extern double hex_semi_brightening;
extern bool local_light;
extern std::string flag_rgb;
extern std::vector<Uint32> red_green_scale;