From bc21b45fa2e431dab77fe02741769061a6fcb9e4 Mon Sep 17 00:00:00 2001 From: dshaligram Date: Sat, 30 Dec 2006 07:00:01 +0000 Subject: [1624529] Added display of turns used in main play screen. Zero-based, which may seem odd to some players, but I like it. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@735 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/acr.cc | 4 ++++ crawl-ref/source/delay.cc | 7 +++++++ crawl-ref/source/output.cc | 17 +++++++++++++++++ crawl-ref/source/output.h | 9 ++------- crawl-ref/source/stuff.cc | 1 + crawl-ref/source/view.cc | 1 + 6 files changed, 32 insertions(+), 7 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index 5a3a678895..7b109730ee 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -2089,7 +2089,10 @@ static void world_reacts() bool its_quiet; //jmf: for silence messages if (you.num_turns != -1) + { you.num_turns++; + update_turn_count(); + } run_environment_effects(); @@ -2758,6 +2761,7 @@ static bool initialise(void) draw_border(); new_level(); + update_turn_count(); init_new_level(false); // Mark items in inventory as of unknown origin. diff --git a/crawl-ref/source/delay.cc b/crawl-ref/source/delay.cc index 659a1b76a5..f48947e93f 100644 --- a/crawl-ref/source/delay.cc +++ b/crawl-ref/source/delay.cc @@ -227,6 +227,9 @@ void stop_delay( void ) default: break; } + + if (is_run_delay(delay.type)) + update_turn_count(); } bool you_are_delayed( void ) @@ -760,6 +763,7 @@ static void handle_run_delays(const delay_queue_item &delay) // We don't want to send the game into a deadlock. if (!you.running) { + update_turn_count(); pop_delay(); return; } @@ -790,7 +794,10 @@ static void handle_run_delays(const delay_queue_item &delay) // removed, remove it now. This is needed to clean up after // find_travel_pos() function in travel.cc. if (!you.running && is_run_delay(current_delay_action())) + { pop_delay(); + update_turn_count(); + } } static void handle_macro_delay() diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc index a742add6e2..4ab715cfa4 100644 --- a/crawl-ref/source/output.cc +++ b/crawl-ref/source/output.cc @@ -58,6 +58,23 @@ static void dur_colour( int colour, bool running_out ) } } +void update_turn_count() +{ + // Don't update turn counter when running/resting/traveling to + // prevent pointless screen updates. + if (you.running > 0 || (you.running < 0 && Options.travel_delay == -1)) + return; + + // FIXME: Create some kind of layout manager class so we can + // templatise the heads-up display layout and stop hardcoding + // these coords. + gotoxy(61, 10); + textcolor(LIGHTGREY); + + // Show the turn count starting from 1. You can still quit on turn 0. + cprintf("%ld", you.num_turns); +} + void print_stats(void) { textcolor(LIGHTGREY); diff --git a/crawl-ref/source/output.h b/crawl-ref/source/output.h index 685216d502..76956cd5cf 100644 --- a/crawl-ref/source/output.h +++ b/crawl-ref/source/output.h @@ -16,15 +16,10 @@ #include "menu.h" -// last updated 12may2000 {dlb} -/* *********************************************************************** - * called from: acr - player - stuff - * *********************************************************************** */ +void update_turn_count(); + void print_stats(void); -/* *********************************************************************** - * called from: chardump - * *********************************************************************** */ std::vector get_full_detail(bool calc_unid); const char *equip_slot_to_name(int equip); diff --git a/crawl-ref/source/stuff.cc b/crawl-ref/source/stuff.cc index 8525c56113..0d31b8ee28 100644 --- a/crawl-ref/source/stuff.cc +++ b/crawl-ref/source/stuff.cc @@ -513,6 +513,7 @@ void redraw_screen(void) bool note_status = notes_are_active(); activate_notes(false); new_level(); + update_turn_count(); activate_notes(note_status); viewwindow(1, false); diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc index 52d83285aa..8010d78673 100644 --- a/crawl-ref/source/view.cc +++ b/crawl-ref/source/view.cc @@ -1666,6 +1666,7 @@ void draw_border(void) gotoxy(40, 8); cprintf("Int:"); gotoxy(40, 9); cprintf("Dex:"); gotoxy(40, 10); cprintf("Gold:"); + gotoxy(55, 10); cprintf("Turn:"); gotoxy(40, 11); cprintf("Experience:"); gotoxy(40, 12); cprintf("Level"); } // end draw_border() -- cgit v1.2.3-54-g00ecf