Skip to content

Commit

Permalink
made day/night toggleable
Browse files Browse the repository at this point in the history
  • Loading branch information
RosaryMala committed May 16, 2010
1 parent 2525b74 commit 72a82d2
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 10 deletions.
6 changes: 5 additions & 1 deletion Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}


Expand Down
3 changes: 2 additions & 1 deletion WorldSegment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++)
{
Expand Down
1 change: 1 addition & 0 deletions commonTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ typedef struct {
int currentSpriteOverlay;

bool showRenderStatus;
bool dayNightCycle;
} GameConfiguration;


Expand Down
17 changes: 10 additions & 7 deletions init.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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...");
Expand Down

0 comments on commit 72a82d2

Please sign in to comment.