From: nhmall Date: Tue, 8 May 2018 00:20:36 +0000 (-0400) Subject: optimization of output was ruining display effects X-Git-Tag: NetHack-3.6.2_Released~280^2~7^2~13 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e90b20a3a9bd5dedac96722b370a70da9c1c0d89;p=nethack optimization of output was ruining display effects --- diff --git a/sys/winnt/nttty.c b/sys/winnt/nttty.c index 2ed5d7c14..9d1114498 100644 --- a/sys/winnt/nttty.c +++ b/sys/winnt/nttty.c @@ -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 */ }