From 72a82d2e50e9232c79edb7905dd2a214a95d66b6 Mon Sep 17 00:00:00 2001 From: Japa Date: Sun, 16 May 2010 14:02:26 +0000 Subject: [PATCH] made day/night toggleable --- Config.cpp | 6 +++++- WorldSegment.cpp | 3 ++- commonTypes.h | 1 + init.txt | 17 ++++++++++------- main.cpp | 2 +- 5 files changed, 19 insertions(+), 10 deletions(-) diff --git a/Config.cpp b/Config.cpp index 1ce23494..25c890b2 100644 --- a/Config.cpp +++ b/Config.cpp @@ -544,12 +544,16 @@ void parseConfigLine( string line ){ if(value < 0) value = 0; config.colors.white_b = value; } - if( line.find("[RENDERER") != -1){ + if( line.find("[RENDERER") != -1){ string result = parseStrFromLine( "RENDERER", line ); config.opengl = (result == "OPENGL"); config.software = (result == "SOFTWARE"); config.directX = (result == "DIRECTX"); } + if( line.find("[NIGHT") != -1){ + string result = parseStrFromLine( "NIGHT", line ); + config.dayNightCycle = (result == "YES"); + } } diff --git a/WorldSegment.cpp b/WorldSegment.cpp index 29d06197..63d23dae 100644 --- a/WorldSegment.cpp +++ b/WorldSegment.cpp @@ -188,7 +188,8 @@ void WorldSegment::drawAllBlocks(){ { if (config.show_osd) DrawCurrentLevelOutline(true); } - al_set_separate_blender(op, src, dst, alpha_op, alpha_src, alpha_dst, color*getDayShade(contentLoader.currentHour, contentLoader.currentTickRel)); + if(config.dayNightCycle) + al_set_separate_blender(op, src, dst, alpha_op, alpha_src, alpha_dst, color*getDayShade(contentLoader.currentHour, contentLoader.currentTickRel)); al_hold_bitmap_drawing(true); for(int32_t vsx=1; vsx < vsxmax; vsx++) { diff --git a/commonTypes.h b/commonTypes.h index da0a4038..bc34b34d 100644 --- a/commonTypes.h +++ b/commonTypes.h @@ -166,6 +166,7 @@ typedef struct { int currentSpriteOverlay; bool showRenderStatus; + bool dayNightCycle; } GameConfiguration; diff --git a/init.txt b/init.txt index e59a7d2b..28dc4fcc 100644 --- a/init.txt +++ b/init.txt @@ -52,15 +52,18 @@ Fog color, and alpha at the bottom z-level. Setting the alpha to 0, or SHOW_FOG to NO disables fog, for a slight performance increase. Color and alpha ranges are 0 (min) to 255 (max) [SHOW_FOG:YES] -[FOG_RED:0] -[FOG_GREEN:0] -[FOG_BLUE:0] -[FOG_ALPHA:20] +[FOG_RED:128] +[FOG_GREEN:158] +[FOG_BLUE:177] +[FOG_ALPHA:10] Background color. setting this the same as the fog color produces a nice effect. -[BACK_RED:0] -[BACK_GREEN:0] -[BACK_BLUE:0] +[BACK_RED:128] +[BACK_GREEN:158] +[BACK_BLUE:177] + +Sets weather Stonesense should use a day/night effect +[NIGHT:NO] This value, in milliseconds, is how long Stonesense waits between reloading the map. If zero, the autoreload will be disabled until diff --git a/main.cpp b/main.cpp index 7577d70c..090d3c81 100644 --- a/main.cpp +++ b/main.cpp @@ -296,7 +296,7 @@ int main(void) al_set_display_icon(IMGIcon); //al_set_blender(ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA, al_map_rgba_f(1.0, 1.0, 1.0, 1.0)); - al_set_separate_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA, ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_ONE, al_map_rgba_f(1, 1, 1, 1)); + al_set_separate_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA, ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_ONE, al_map_rgba_f(1.0, 1.0, 1.0, 1.0)); loadGraphicsFromDisk(); al_clear_to_color(al_map_rgb(0,0,0)); draw_textf_border(font, al_get_bitmap_width(al_get_target_bitmap())/2, al_get_bitmap_height(al_get_target_bitmap())/2, ALLEGRO_ALIGN_CENTRE, "Starting up...");