From a320981303fe11bb37c082d7642bb14dc1b42608 Mon Sep 17 00:00:00 2001 From: haranp Date: Thu, 30 Nov 2006 16:48:54 +0000 Subject: Added some colour to the resists screen. Added piety levels and penance to the resists screen. (Penance is signified by a * before the god name, piety levels by *s after the god name.) git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@535 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/describe.cc | 1 - crawl-ref/source/output.cc | 34 ++++++++++++++++++++++++++++------ crawl-ref/source/religion.cc | 16 ++++++++++++++-- crawl-ref/source/religion.h | 1 + 4 files changed, 43 insertions(+), 9 deletions(-) (limited to 'crawl-ref/source') diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc index e2994c1d2e..0140b02222 100644 --- a/crawl-ref/source/describe.cc +++ b/crawl-ref/source/describe.cc @@ -6387,7 +6387,6 @@ static void print_god_abil_desc( int abil ) cprintf( "%s", str.c_str() ); } - //--------------------------------------------------------------- // // describe_god diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc index 728f568452..d63d2f9344 100644 --- a/crawl-ref/source/output.cc +++ b/crawl-ref/source/output.cc @@ -623,17 +623,38 @@ std::vector get_full_detail(bool calc_unid) char buf[1000]; // 3 columns, splits at columns 32, 52 column_composer cols(3, 32, 52); + char god_colour_tag[20]; + god_colour_tag[0] = 0; + std::string godpowers(god_name(you.religion)); + if ( you.religion != GOD_NO_GOD ) + { + if ( player_under_penance() ) + strcpy(god_colour_tag, "*"); + else + { + snprintf(god_colour_tag, sizeof god_colour_tag, "<%s>", + colour_to_str(god_colour(you.religion))); + // piety rankings + int prank = piety_rank() - 1; + if ( prank < 0 ) + prank = 0; + // Careful about overflow. We erase some of the god's name + // if necessary. + godpowers = godpowers.substr(0, 17 - prank) + + std::string(prank, '*'); + } + } snprintf(buf, sizeof buf, - "%s the %s\n\n" + "%s the %s\n\n" "Race : %s\n" "Class : %s\n" - "Worship : %s\n" + "Worship : %s%s\n" "Level : %7d\n" "Exp : %7lu\n", you.your_name, player_title(), species_name(you.species,you.experience_level), you.class_name, - you.religion == GOD_NO_GOD? "" : god_name(you.religion), + god_colour_tag, godpowers.c_str(), you.experience_level, you.experience); cols.add_formatted(0, buf, false); @@ -682,21 +703,22 @@ std::vector get_full_detail(bool calc_unid) if (you.strength == you.max_strength) snprintf(buf, sizeof buf, "Str : %3d", you.strength); else - snprintf(buf, sizeof buf, "Str : %3d (%d)", + snprintf(buf, sizeof buf, "Str : %3d (%d)", you.strength, you.max_strength); cols.add_formatted(0, buf, false); if (you.intel == you.max_intel) snprintf(buf, sizeof buf, "Int : %3d", you.intel); else - snprintf(buf, sizeof buf, "Int : %3d (%d)", + snprintf(buf, sizeof buf, "Int : %3d (%d)", you.intel, you.max_intel); cols.add_formatted(0, buf, false); if (you.dex == you.max_dex) snprintf(buf, sizeof buf, "Dex : %3d", you.dex); else - snprintf(buf, sizeof buf, "Dex : %3d (%d)",you.dex,you.max_dex); + snprintf(buf, sizeof buf, "Dex : %3d (%d)", + you.dex, you.max_dex); cols.add_formatted(0, buf, false); snprintf(buf, sizeof buf, diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index 72089060fd..7c1e3400ca 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -484,7 +484,7 @@ char *god_name( int which_god, bool long_name ) // mv - rewritten sprintf(godname_buff, "Zin%s", long_name ? " the Law-Giver" : ""); break; case GOD_SHINING_ONE: - sprintf(godname_buff, "The Shining One"); + strcpy(godname_buff, "The Shining One"); break; case GOD_KIKUBAAQUDGHA: strcpy(godname_buff, "Kikubaaqudgha"); @@ -497,7 +497,7 @@ char *god_name( int which_god, bool long_name ) // mv - rewritten if (long_name) { strcat(godname_buff, " "); - switch(random2(1000)) + switch(random2(30)) { default: strcat(godname_buff, "of Chaos"); @@ -2838,3 +2838,15 @@ char god_colour( char god ) //mv - added return(YELLOW); } + +int piety_rank( int piety ) +{ + const int breakpoints[] = { 161, 120, 100, 75, 50, 30, 6 }; + const int numbreakpoints = sizeof(breakpoints) / sizeof(int); + if ( piety < 0 ) + piety = you.piety; + for ( int i = 0; i < numbreakpoints; ++i ) + if ( piety >= breakpoints[i] ) + return numbreakpoints - i; + return 0; +} diff --git a/crawl-ref/source/religion.h b/crawl-ref/source/religion.h index 0e4f65a7cf..67ef4b15f6 100644 --- a/crawl-ref/source/religion.h +++ b/crawl-ref/source/religion.h @@ -31,5 +31,6 @@ void pray(void); void handle_god_time(void); char god_colour(char god); void god_pitch(unsigned char which_god); +int piety_rank(int piety = -1); #endif -- cgit v1.2.3-54-g00ecf