]> granicus.if.org Git - nethack/commitdiff
optimization of output was ruining display effects
authornhmall <nhmall@nethack.org>
Tue, 8 May 2018 00:20:36 +0000 (20:20 -0400)
committernhmall <nhmall@nethack.org>
Tue, 8 May 2018 00:20:36 +0000 (20:20 -0400)
sys/winnt/nttty.c

index 2ed5d7c143810bf44c5b2719c6cd96700a0419c1..9d1114498b9b69ae7f9ea8442408c7cb23f77117 100644 (file)
@@ -252,6 +252,8 @@ cell_t undefined_cell;
 
 static boolean buffer_flipping_initialized = FALSE;
 
+boolean do_immediate_flips = FALSE;
+
 static void check_buffer_size(int width, int height);
 static cell_t * buffer_get_cell(console_buffer_t * buffer, int x, int y);
 
@@ -367,12 +369,18 @@ static void buffer_fill_to_end(console_buffer_t * buffer, cell_t * src,
     cell_t * sentinel = buffer_get_cell(buffer, 0, buffer_height);
     while (dst != sentinel)
         *dst++ = clear_cell;
+
+    if (do_immediate_flips && buffer == &back_buffer)
+        back_buffer_flip();
 }
 
 static void back_buffer_write(cell_t * cell, int x, int y)
 {
     cell_t * dst = buffer_get_cell(&back_buffer, x, y);
     *dst = *cell;
+
+    if (do_immediate_flips)
+        back_buffer_flip();
 }
 
 static void back_buffer_clear_to_end_of_line(int x, int y)
@@ -384,6 +392,9 @@ static void back_buffer_clear_to_end_of_line(int x, int y)
     sentinel = buffer_get_cell(&back_buffer, 0, y+1);
     while (cell != sentinel)
         *cell++ = clear_cell;
+
+    if (do_immediate_flips)
+        back_buffer_flip();
 }
 
 /*
@@ -922,6 +933,7 @@ tty_delay_output()
     int k;
 
     goal = 50 + clock();
+    back_buffer_flip();
     while (goal > clock()) {
         k = junk; /* Do nothing */
     }