summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/output.cc
diff options
context:
space:
mode:
authorpauldubois <pauldubois@c06c8d41-db1a-0410-9941-cceddc491573>2008-03-24 01:59:23 +0000
committerpauldubois <pauldubois@c06c8d41-db1a-0410-9941-cceddc491573>2008-03-24 01:59:23 +0000
commit9db21d960f2efe9b3f94d35e7462d5d236f71f86 (patch)
tree673fe13d3fdf00f48fd8313b5cf823fc5632be09 /crawl-ref/source/output.cc
parent78ed182cbb25a262df02c6e8fb6b9d85d7fca85a (diff)
downloadcrawl-ref-9db21d960f2efe9b3f94d35e7462d5d236f71f86.tar.gz
crawl-ref-9db21d960f2efe9b3f94d35e7462d5d236f71f86.zip
Break print_stats into a bunch of smaller functions
Add an (easily commented-out) _print_stats_line4_monsters(), that dumps JPEG's monster list to the screen. Lots of polish needed; see the comments git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3847 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/output.cc')
-rw-r--r--crawl-ref/source/output.cc923
1 files changed, 480 insertions, 443 deletions
diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc
index 71eae98663..9f5f00d271 100644
--- a/crawl-ref/source/output.cc
+++ b/crawl-ref/source/output.cc
@@ -215,563 +215,600 @@ static std::string describe_hunger()
}
}
-void print_stats(void)
+static void _print_stats_mp()
{
+ int mp_percent;
+ if ( you.max_magic_points )
+ mp_percent = (you.magic_points * 100) / you.max_magic_points;
+ else
+ mp_percent = 100;
+ for ( unsigned int i = 0; i < Options.mp_colour.size(); ++i )
+ {
+ if ( i+1 == Options.mp_colour.size() ||
+ mp_percent > Options.mp_colour[i+1].first )
+ {
+ textcolor(Options.mp_colour[i].second);
+ break;
+ }
+ }
+ cgotoxy(8, 4, GOTO_STAT);
+
+ cprintf( "%d", you.magic_points);
+
textcolor(LIGHTGREY);
+ cprintf("/%d", you.max_magic_points );
#ifdef USE_TILE
- if (you.redraw_armour_class || you.wield_change)
- TilePlayerRefresh();
+ int col = count_digits(you.magic_points) +
+ count_digits(you.max_magic_points) + 1;
+ for (int i = 12-col; i > 0; i--)
+ cprintf(" ");
+ draw_mp_bar(you.magic_points, you.max_magic_points);
+#else
+ clear_to_end_of_line();
#endif
+}
- // Displayed evasion is now tied to dex.
- if (you.redraw_dexterity)
- you.redraw_evasion = true;
+// Helper for print_stats
+static void _print_stats_hp()
+{
+ const int max_max_hp = you.hp_max + player_rotted();
+ int hp_percent;
+ if ( max_max_hp )
+ hp_percent = (you.hp * 100) / max_max_hp;
+ else
+ hp_percent = 100;
- if (you.redraw_hit_points)
+ for ( unsigned int i = 0; i < Options.hp_colour.size(); ++i )
{
- const int max_max_hp = you.hp_max + player_rotted();
- int hp_percent;
- if ( max_max_hp )
- hp_percent = (you.hp * 100) / max_max_hp;
- else
- hp_percent = 100;
-
- for ( unsigned int i = 0; i < Options.hp_colour.size(); ++i )
+ if ( i+1 == Options.hp_colour.size() ||
+ hp_percent > Options.hp_colour[i+1].first )
{
- if ( i+1 == Options.hp_colour.size() ||
- hp_percent > Options.hp_colour[i+1].first )
- {
- textcolor(Options.hp_colour[i].second);
- break;
- }
+ textcolor(Options.hp_colour[i].second);
+ break;
}
+ }
- cgotoxy(5, 3, GOTO_STAT);
-
- cprintf( "%d", you.hp );
+ cgotoxy(5, 3, GOTO_STAT);
- textcolor(LIGHTGREY);
- cprintf( "/%d", you.hp_max );
+ cprintf( "%d", you.hp );
- if (max_max_hp != you.hp_max)
- cprintf( " (%d)", max_max_hp );
+ textcolor(LIGHTGREY);
+ cprintf( "/%d", you.hp_max );
- you.redraw_hit_points = 0;
+ if (max_max_hp != you.hp_max)
+ cprintf( " (%d)", max_max_hp );
#ifdef USE_TILE
- int col = count_digits(you.hp)+count_digits(you.hp_max) + 1;
- if (max_max_hp != you.hp_max)
- col += count_digits(max_max_hp) + 3;
- for (int i = 15-col; i > 0; i--)
- cprintf(" ");
- draw_hp_bar(you.hp, you.hp_max);
+ int col = count_digits(you.hp)+count_digits(you.hp_max) + 1;
+ if (max_max_hp != you.hp_max)
+ col += count_digits(max_max_hp) + 3;
+ for (int i = 15-col; i > 0; i--)
+ cprintf(" ");
+ draw_hp_bar(you.hp, you.hp_max);
#else
- clear_to_end_of_line();
+ clear_to_end_of_line();
#endif
- }
+}
- if (you.redraw_magic_points)
- {
- int mp_percent;
- if ( you.max_magic_points )
- mp_percent = (you.magic_points * 100) / you.max_magic_points;
- else
- mp_percent = 100;
- for ( unsigned int i = 0; i < Options.mp_colour.size(); ++i )
- {
- if ( i+1 == Options.mp_colour.size() ||
- mp_percent > Options.mp_colour[i+1].first )
- {
- textcolor(Options.mp_colour[i].second);
- break;
- }
- }
- cgotoxy(8, 4, GOTO_STAT);
+static void _print_stats_str()
+{
+ if (you.strength < 0)
+ you.strength = 0;
+ else if (you.strength > 72)
+ you.strength = 72;
- cprintf( "%d", you.magic_points);
+ if (you.max_strength > 72)
+ you.max_strength = 72;
- textcolor(LIGHTGREY);
- cprintf("/%d", you.max_magic_points );
+ cgotoxy(6, 7, GOTO_STAT);
- you.redraw_magic_points = 0;
+ if (you.duration[DUR_MIGHT])
+ textcolor(LIGHTBLUE); // no end of effect warning
+ else if (you.strength < you.max_strength)
+ textcolor(YELLOW);
-#ifdef USE_TILE
- int col = count_digits(you.magic_points) +
- count_digits(you.max_magic_points) + 1;
- for (int i = 12-col; i > 0; i--)
- cprintf(" ");
- draw_mp_bar(you.magic_points, you.max_magic_points);
-#else
- clear_to_end_of_line();
-#endif
- }
+ cprintf( "%d", you.strength );
+ textcolor(LIGHTGREY);
- if (you.redraw_strength)
- {
- if (you.strength < 0)
- you.strength = 0;
- else if (you.strength > 72)
- you.strength = 72;
+ if (you.strength != you.max_strength)
+ cprintf( " (%d) ", you.max_strength );
+ else
+ cprintf( " " );
- if (you.max_strength > 72)
- you.max_strength = 72;
+ burden_change();
+}
- cgotoxy(6, 7, GOTO_STAT);
+static void _print_stats_int()
+{
+ if (you.intel < 0)
+ you.intel = 0;
+ else if (you.intel > 72)
+ you.intel = 72;
- if (you.duration[DUR_MIGHT])
- textcolor(LIGHTBLUE); // no end of effect warning
- else if (you.strength < you.max_strength)
- textcolor(YELLOW);
+ if (you.max_intel > 72)
+ you.max_intel = 72;
- cprintf( "%d", you.strength );
- textcolor(LIGHTGREY);
+ cgotoxy(6, 8, GOTO_STAT);
- if (you.strength != you.max_strength)
- cprintf( " (%d) ", you.max_strength );
- else
- cprintf( " " );
+ if (you.intel < you.max_intel)
+ textcolor(YELLOW);
- you.redraw_strength = 0;
+ cprintf( "%d", you.intel );
+ textcolor(LIGHTGREY);
- burden_change();
- }
+ if (you.intel != you.max_intel)
+ cprintf( " (%d) ", you.max_intel );
+ else
+ cprintf( " " );
+}
- if (you.redraw_intelligence)
- {
- if (you.intel < 0)
- you.intel = 0;
- else if (you.intel > 72)
- you.intel = 72;
+static void _print_stats_dex()
+{
+ if (you.dex < 0)
+ you.dex = 0;
+ else if (you.dex > 72)
+ you.dex = 72;
- if (you.max_intel > 72)
- you.max_intel = 72;
+ if (you.max_dex > 72)
+ you.max_dex = 72;
- cgotoxy(6, 8, GOTO_STAT);
+ cgotoxy(6, 9, GOTO_STAT);
- if (you.intel < you.max_intel)
- textcolor(YELLOW);
+ if (you.dex < you.max_dex)
+ textcolor(YELLOW);
- cprintf( "%d", you.intel );
- textcolor(LIGHTGREY);
+ cprintf( "%d", you.dex );
+ textcolor(LIGHTGREY);
- if (you.intel != you.max_intel)
- cprintf( " (%d) ", you.max_intel );
- else
- cprintf( " " );
+ if (you.dex != you.max_dex)
+ cprintf( " (%d) ", you.max_dex );
+ else
+ cprintf( " " );
+}
- you.redraw_intelligence = 0;
+static void _print_stats_ac()
+{
+ cgotoxy(5, 5, GOTO_STAT);
+
+ if (you.duration[DUR_STONEMAIL])
+ dur_colour( BLUE, (you.duration[DUR_STONEMAIL] <= 6) );
+ else if (you.duration[DUR_ICY_ARMOUR] || you.duration[DUR_STONESKIN])
+ textcolor( LIGHTBLUE ); // no end of effect warning
+
+ cprintf( "%d ", player_AC() );
+ textcolor( LIGHTGREY );
+
+ cgotoxy(11, 5, GOTO_STAT);
+
+ if (you.duration[DUR_CONDENSATION_SHIELD]
+ || you.duration[DUR_DIVINE_SHIELD])
+ {
+ textcolor( LIGHTBLUE ); // no end of effect warning
}
+ cprintf( "(%d) ", player_shield_class() );
+ textcolor( LIGHTGREY );
+}
- if (you.redraw_dexterity)
+static void _print_stats_wp()
+{
+ cgotoxy(1, 13, GOTO_STAT);
+ textcolor(Options.status_caption_colour);
+ cprintf("Wp: ");
+ if (you.weapon())
{
- if (you.dex < 0)
- you.dex = 0;
- else if (you.dex > 72)
- you.dex = 72;
+ const item_def& wpn = *you.weapon();
+ textcolor(wpn.colour);
- if (you.max_dex > 72)
- you.max_dex = 72;
+ const std::string prefix = menu_colour_item_prefix(wpn);
+ const int prefcol = menu_colour(wpn.name(DESC_INVENTORY), prefix);
+ if (prefcol != -1)
+ textcolor(prefcol);
- cgotoxy(6, 9, GOTO_STAT);
+ cprintf("%s",
+ wpn.name(DESC_INVENTORY, true)
+ .substr(0, crawl_view.hudsz.x - 5).c_str());
+ textcolor(LIGHTGREY);
+ }
+ else
+ {
+ if (you.attribute[ATTR_TRANSFORMATION] == TRAN_BLADE_HANDS)
+ {
+ textcolor(RED);
+ cprintf("Blade Hands");
+ textcolor(LIGHTGREY);
+ }
+ else
+ {
+ textcolor(LIGHTGREY);
+ cprintf("Nothing wielded");
+ }
+ }
+ clear_to_end_of_line();
+}
- if (you.dex < you.max_dex)
- textcolor(YELLOW);
+static void _print_stats_qv()
+{
+ cgotoxy(1, 14, GOTO_STAT);
+ textcolor(Options.status_caption_colour);
+ cprintf("Qv: ");
+
+ int q = you.quiver[get_quiver_type()] = get_current_fire_item();
- cprintf( "%d", you.dex );
+ if (q != ENDOFPACK)
+ {
+ const item_def& quiver = you.inv[q];
+ textcolor(quiver.colour);
+
+ const std::string prefix = menu_colour_item_prefix(quiver);
+ const int prefcol =
+ menu_colour(quiver.name(DESC_INVENTORY), prefix);
+ if (prefcol != -1)
+ textcolor(prefcol);
+
+ cprintf("%s",
+ quiver.name(DESC_INVENTORY, true)
+ .substr(0, crawl_view.hudsz.x - 5)
+ .c_str());
textcolor(LIGHTGREY);
+ }
+ else
+ textcolor(LIGHTGREY);
+ clear_to_end_of_line();
+}
- if (you.dex != you.max_dex)
- cprintf( " (%d) ", you.max_dex );
- else
- cprintf( " " );
+// The colour scheme for these flags is currently:
+//
+// - yellow, "orange", red for bad conditions
+// - light grey, white for god based conditions
+// - green, light green for good conditions
+// - blue, light blue for good enchantments
+// - magenta, light magenta for "better" enchantments (deflect, fly)
+static void _print_stats_line1()
+{
+ cgotoxy(1, 15, GOTO_STAT);
+ clear_to_end_of_line();
+ cgotoxy(1, 15, GOTO_STAT);
- you.redraw_dexterity = 0;
+ switch (you.burden_state)
+ {
+ case BS_OVERLOADED:
+ textcolor( RED );
+ cprintf( "Overloaded " );
+ break;
+
+ case BS_ENCUMBERED:
+ textcolor( LIGHTRED );
+ cprintf( "Encumbered " );
+ break;
+
+ case BS_UNENCUMBERED:
+ break;
}
- if (you.redraw_armour_class)
+ switch (you.hunger_state)
{
- cgotoxy(5, 5, GOTO_STAT);
-
- if (you.duration[DUR_STONEMAIL])
- dur_colour( BLUE, (you.duration[DUR_STONEMAIL] <= 6) );
- else if (you.duration[DUR_ICY_ARMOUR] || you.duration[DUR_STONESKIN])
- textcolor( LIGHTBLUE ); // no end of effect warning
+ case HS_ENGORGED:
+ textcolor( LIGHTGREEN );
+ break;
+
+ case HS_VERY_FULL:
+ case HS_FULL:
+ case HS_SATIATED:
+ textcolor( GREEN );
+ break;
+
+ case HS_HUNGRY:
+ case HS_VERY_HUNGRY:
+ case HS_NEAR_STARVING:
+ textcolor( YELLOW );
+ break;
+
+ case HS_STARVING:
+ textcolor( RED );
+ break;
+ }
+ const std::string state = describe_hunger();
+ if (!state.empty())
+ cprintf(state.c_str());
- cprintf( "%d ", player_AC() );
- textcolor( LIGHTGREY );
+ textcolor( LIGHTGREY );
- cgotoxy(11, 5, GOTO_STAT);
+#if DEBUG_DIAGNOSTICS
+ // debug mode hunger-o-meter
+ cprintf( " (%d:%d) ", you.hunger - you.old_hunger, you.hunger );
+#endif
+}
- if (you.duration[DUR_CONDENSATION_SHIELD]
- || you.duration[DUR_DIVINE_SHIELD])
- {
- textcolor( LIGHTBLUE ); // no end of effect warning
- }
- cprintf( "(%d) ", player_shield_class() );
- textcolor( LIGHTGREY );
+// For colors, see comment at _print_stats_line1
+static void _print_stats_line2()
+{
+ cgotoxy(1, 16, GOTO_STAT);
+ clear_to_end_of_line();
+ cgotoxy(1, 16, GOTO_STAT);
+ // Max length of this line = 8 * 5 - 1 = 39
- you.redraw_armour_class = 0;
+ if (you.duration[DUR_PRAYER])
+ {
+ textcolor( WHITE ); // no end of effect warning
+ cprintf( "Pray " );
}
- if (you.redraw_evasion)
+ if (you.duration[DUR_REPEL_UNDEAD])
{
- cgotoxy(5, 6, GOTO_STAT);
-
- if (you.duration[DUR_FORESCRY])
- textcolor(LIGHTBLUE); // no end of effect warning
-
- cprintf( "%d ", player_evasion() );
- textcolor(LIGHTGREY);
-
- you.redraw_evasion = 0;
+ dur_colour( LIGHTGREY, (you.duration[DUR_REPEL_UNDEAD] <= 4) );
+ cprintf( "Holy " );
}
- if (you.redraw_gold)
+ if (you.duration[DUR_TELEPORT])
{
- cgotoxy(7, 10, GOTO_STAT);
- cprintf( "%-8d", you.gold );
- you.redraw_gold = 0;
+ textcolor( LIGHTBLUE );
+ cprintf( "Tele " );
}
- if (you.redraw_experience)
+ if (you.duration[DUR_DEFLECT_MISSILES])
{
- cgotoxy(13, 11, GOTO_STAT);
-#if DEBUG_DIAGNOSTICS
- cprintf( "%d/%lu (%d/%d)",
- you.experience_level, you.experience,
- you.skill_cost_level, you.exp_available );
-#else
- cprintf( "%d/%lu (%d)",
- you.experience_level, you.experience, you.exp_available );
-#endif
+ dur_colour( MAGENTA, (you.duration[DUR_DEFLECT_MISSILES] <= 6) );
+ cprintf( "DMsl " );
+ }
+ else if (you.duration[DUR_REPEL_MISSILES])
+ {
+ dur_colour( BLUE, (you.duration[DUR_REPEL_MISSILES] <= 6) );
+ cprintf( "RMsl " );
+ }
- clear_to_end_of_line();
- you.redraw_experience = 0;
+ if (you.duration[DUR_REGENERATION])
+ {
+ dur_colour( BLUE, (you.duration[DUR_REGENERATION] <= 6) );
+ cprintf( "Regen " );
}
- if (you.wield_change)
+ if (you.duration[DUR_INSULATION])
{
- cgotoxy(1, 13, GOTO_STAT);
- textcolor(Options.status_caption_colour);
- cprintf("Wp: ");
- if (you.weapon())
- {
- const item_def& wpn = *you.weapon();
- textcolor(wpn.colour);
+ dur_colour( BLUE, (you.duration[DUR_INSULATION] <= 6) );
+ cprintf( "Ins " );
+ }
- const std::string prefix = menu_colour_item_prefix(wpn);
- const int prefcol = menu_colour(wpn.name(DESC_INVENTORY), prefix);
- if (prefcol != -1)
- textcolor(prefcol);
+ if (player_is_airborne())
+ {
+ const bool perm = you.permanent_flight();
- cprintf("%s",
- wpn.name(DESC_INVENTORY, true)
- .substr(0, crawl_view.hudsz.x - 5).c_str());
- textcolor(LIGHTGREY);
+ if (wearing_amulet( AMU_CONTROLLED_FLIGHT ))
+ {
+ dur_colour( you.light_flight()? BLUE : MAGENTA,
+ (you.duration[DUR_LEVITATION] <= 10 && !perm) );
+ cprintf( "Fly " );
}
else
{
- if (you.attribute[ATTR_TRANSFORMATION] == TRAN_BLADE_HANDS)
- {
- textcolor(RED);
- cprintf("Blade Hands");
- textcolor(LIGHTGREY);
- }
- else
- {
- textcolor(LIGHTGREY);
- cprintf("Nothing wielded");
- }
+ dur_colour(BLUE, (you.duration[DUR_LEVITATION] <= 10 && !perm));
+ cprintf( "Lev " );
}
- clear_to_end_of_line();
- you.wield_change = false;
}
- if (you.quiver_change)
+ if (you.duration[DUR_INVIS])
{
- cgotoxy(1, 14, GOTO_STAT);
- textcolor(Options.status_caption_colour);
- cprintf("Qv: ");
-
- int q = you.quiver[get_quiver_type()] = get_current_fire_item();
-
- if (q != ENDOFPACK)
- {
- const item_def& quiver = you.inv[q];
- textcolor(quiver.colour);
-
- const std::string prefix = menu_colour_item_prefix(quiver);
- const int prefcol =
- menu_colour(quiver.name(DESC_INVENTORY), prefix);
- if (prefcol != -1)
- textcolor(prefcol);
-
- cprintf("%s",
- quiver.name(DESC_INVENTORY, true)
- .substr(0, crawl_view.hudsz.x - 5)
- .c_str());
- textcolor(LIGHTGREY);
- }
- else
- textcolor(LIGHTGREY);
- clear_to_end_of_line();
- you.quiver_change = false;
+ dur_colour( BLUE, (you.duration[DUR_INVIS] <= 6) );
+ cprintf( "Invis " );
}
-
- // The colour scheme for these flags is currently:
- //
- // - yellow, "orange", red for bad conditions
- // - light grey, white for god based conditions
- // - green, light green for good conditions
- // - blue, light blue for good enchantments
- // - magenta, light magenta for "better" enchantments (deflect, fly)
- if (you.redraw_status_flags & REDRAW_LINE_1_MASK)
+ if (you.duration[DUR_SILENCE])
{
- cgotoxy(1, 15, GOTO_STAT);
- clear_to_end_of_line();
- cgotoxy(1, 15, GOTO_STAT);
-
- switch (you.burden_state)
- {
- case BS_OVERLOADED:
- textcolor( RED );
- cprintf( "Overloaded " );
- break;
-
- case BS_ENCUMBERED:
- textcolor( LIGHTRED );
- cprintf( "Encumbered " );
- break;
-
- case BS_UNENCUMBERED:
- break;
- }
-
- switch (you.hunger_state)
- {
- case HS_ENGORGED:
- textcolor( LIGHTGREEN );
- break;
+ dur_colour( BLUE, (you.duration[DUR_SILENCE] <= 5) );
+ cprintf( "Sil " );
+ }
- case HS_VERY_FULL:
- case HS_FULL:
- case HS_SATIATED:
- textcolor( GREEN );
- break;
+ // Perhaps this should be reversed to show when it can be used?
+ // In that case, it should be probably be GREEN, and we'd have
+ // to check to see if the player does have a breath weapon. -- bwr
+ if (you.duration[DUR_BREATH_WEAPON] &&
+ wherex() < get_number_of_cols() - 5)
+ {
+ textcolor( YELLOW ); // no warning
+ cprintf( "BWpn " );
+ }
+
+ if (you.duration[DUR_BARGAIN] && wherex() < get_number_of_cols() - 5)
+ {
+ dur_colour( BLUE, (you.duration[DUR_BARGAIN] <= 15) );
+ cprintf( "Brgn " );
+ }
- case HS_HUNGRY:
- case HS_VERY_HUNGRY:
- case HS_NEAR_STARVING:
- textcolor( YELLOW );
- break;
+ if (you.duration[DUR_SAGE] && wherex() < get_number_of_cols() - 5)
+ {
+ dur_colour( BLUE, (you.duration[DUR_SAGE] <= 15) );
+ cprintf( "Sage " );
+ }
- case HS_STARVING:
- textcolor( RED );
- break;
- }
- const std::string state = describe_hunger();
- if (!state.empty())
- cprintf(state.c_str());
+ textcolor( LIGHTGREY );
+}
- textcolor( LIGHTGREY );
+// For colors, see comment at _print_stats_line1
+static void _print_stats_line3()
+{
+ cgotoxy(1, 17, GOTO_STAT);
+ clear_to_end_of_line();
+ cgotoxy(1, 17, GOTO_STAT);
+ // Max length of this line = 7 * 5 + 3 - 1 = 37
+
+ // Note the usage of bad_ench_colour() correspond to levels that
+ // can be found in player.cc, ie those that the player can tell by
+ // using the '@' command. Things like confusion and sticky flame
+ // hide their amounts and are thus always the same colour (so
+ // we're not really exposing any new information). --bwr
+ if (you.duration[DUR_CONF])
+ {
+ textcolor( RED ); // no different levels
+ cprintf( "Conf " );
+ }
+
+ if (you.duration[DUR_BEHELD])
+ {
+ textcolor( RED ); // no different levels
+ cprintf( "Bhld " );
+ }
-#if DEBUG_DIAGNOSTICS
- // debug mode hunger-o-meter
- cprintf( " (%d:%d) ", you.hunger - you.old_hunger, you.hunger );
-#endif
+ if (you.duration[DUR_LIQUID_FLAMES])
+ {
+ textcolor( RED ); // no different levels
+ cprintf( "Fire " );
}
- if (you.redraw_status_flags & REDRAW_LINE_2_MASK)
+ if (you.duration[DUR_POISONING])
{
- cgotoxy(1, 16, GOTO_STAT);
- clear_to_end_of_line();
- cgotoxy(1, 16, GOTO_STAT);
- // Max length of this line = 8 * 5 - 1 = 39
+ // We skip marking "quite" poisoned and instead mark the
+ // levels where the rules for dealing poison damage change
+ // significantly. See acr.cc for that code. -- bwr
+ textcolor( bad_ench_colour( you.duration[DUR_POISONING], 5, 10 ) );
+ cprintf( "Pois " );
+ }
- if (you.duration[DUR_PRAYER])
- {
- textcolor( WHITE ); // no end of effect warning
- cprintf( "Pray " );
- }
+ if (you.disease)
+ {
+ textcolor( bad_ench_colour( you.disease, 40, 120 ) );
+ cprintf( "Sick " );
+ }
- if (you.duration[DUR_REPEL_UNDEAD])
- {
- dur_colour( LIGHTGREY, (you.duration[DUR_REPEL_UNDEAD] <= 4) );
- cprintf( "Holy " );
- }
+ if (you.rotting)
+ {
+ textcolor( bad_ench_colour( you.rotting, 4, 8 ) );
+ cprintf( "Rot " );
+ }
- if (you.duration[DUR_TELEPORT])
- {
- textcolor( LIGHTBLUE );
- cprintf( "Tele " );
- }
+ if (you.attribute[ATTR_HELD])
+ {
+ textcolor( RED );
+ cprintf( "Held " );
+ }
- if (you.duration[DUR_DEFLECT_MISSILES])
- {
+ if (you.backlit())
+ {
+ textcolor(
+ you.magic_contamination > 5 ?
+ bad_ench_colour( you.magic_contamination, 15, 25 )
+ : LIGHTBLUE );
+ cprintf( "Glow " );
+ }
- dur_colour( MAGENTA, (you.duration[DUR_DEFLECT_MISSILES] <= 6) );
- cprintf( "DMsl " );
- }
- else if (you.duration[DUR_REPEL_MISSILES])
- {
- dur_colour( BLUE, (you.duration[DUR_REPEL_MISSILES] <= 6) );
- cprintf( "RMsl " );
- }
+ if (you.duration[DUR_SWIFTNESS])
+ {
+ dur_colour( BLUE, (you.duration[DUR_SWIFTNESS] <= 6) );
+ cprintf( "Swift " );
+ }
- if (you.duration[DUR_REGENERATION])
- {
- dur_colour( BLUE, (you.duration[DUR_REGENERATION] <= 6) );
- cprintf( "Regen " );
- }
+ if (you.duration[DUR_SLOW] && !you.duration[DUR_HASTE])
+ {
+ textcolor( RED ); // no end of effect warning
+ cprintf( "Slow" );
+ }
+ else if (you.duration[DUR_HASTE] && !you.duration[DUR_SLOW])
+ {
+ dur_colour( BLUE, (you.duration[DUR_HASTE] <= 6) );
+ cprintf( "Fast" );
+ }
- if (you.duration[DUR_INSULATION])
- {
- dur_colour( BLUE, (you.duration[DUR_INSULATION] <= 6) );
- cprintf( "Ins " );
- }
+ textcolor( LIGHTGREY );
+}
- if (player_is_airborne())
- {
- const bool perm = you.permanent_flight();
+static void _print_stats_line4_monsters(int start_row)
+{
+ // TODO:
+ // - print monster glyph, in proper color
+ // - get health and friendliness in there (using color and/or text)
+ // - don't squeeze down into the message area
+ extern void get_visible_monsters(std::vector<std::string>& );
+ std::vector<std::string> describe;
+ get_visible_monsters(describe);
+
+ const int max_print = get_number_of_lines()-start_row;
+ const int num_print = MIN(max_print, int(describe.size()));
+ // Print the visible monsters
+ for (int i=0; i<num_print; i++)
+ {
+ cgotoxy(1, start_row+i, GOTO_STAT);
+ clear_to_end_of_line();
+ cgotoxy(1, start_row+i, GOTO_STAT);
+ cprintf(describe[i].c_str());
+ }
- if (wearing_amulet( AMU_CONTROLLED_FLIGHT ))
- {
- dur_colour( you.light_flight()? BLUE : MAGENTA,
- (you.duration[DUR_LEVITATION] <= 10 && !perm) );
- cprintf( "Fly " );
- }
- else
- {
- dur_colour(BLUE, (you.duration[DUR_LEVITATION] <= 10 && !perm));
- cprintf( "Lev " );
- }
- }
+ // Clear out the rest
+ for (int i=num_print; i<max_print; i++)
+ {
+ cgotoxy(1, start_row+i, GOTO_STAT);
+ clear_to_end_of_line();
+ }
+}
- if (you.duration[DUR_INVIS])
- {
- dur_colour( BLUE, (you.duration[DUR_INVIS] <= 6) );
- cprintf( "Invis " );
- }
+void print_stats(void)
+{
+ textcolor(LIGHTGREY);
- if (you.duration[DUR_SILENCE])
- {
- dur_colour( BLUE, (you.duration[DUR_SILENCE] <= 5) );
- cprintf( "Sil " );
- }
+#ifdef USE_TILE
+ if (you.redraw_armour_class || you.wield_change)
+ TilePlayerRefresh();
+#endif
- // Perhaps this should be reversed to show when it can be used?
- // In that case, it should be probably be GREEN, and we'd have
- // to check to see if the player does have a breath weapon. -- bwr
- if (you.duration[DUR_BREATH_WEAPON] &&
- wherex() < get_number_of_cols() - 5)
- {
- textcolor( YELLOW ); // no warning
- cprintf( "BWpn " );
- }
-
- if (you.duration[DUR_BARGAIN] && wherex() < get_number_of_cols() - 5)
- {
- dur_colour( BLUE, (you.duration[DUR_BARGAIN] <= 15) );
- cprintf( "Brgn " );
- }
+ // Displayed evasion is now tied to dex.
+ if (you.redraw_dexterity)
+ you.redraw_evasion = true;
- if (you.duration[DUR_SAGE] && wherex() < get_number_of_cols() - 5)
- {
- dur_colour( BLUE, (you.duration[DUR_SAGE] <= 15) );
- cprintf( "Sage " );
- }
+ if (you.redraw_hit_points) { you.redraw_hit_points = false; _print_stats_hp(); }
+ if (you.redraw_magic_points) { you.redraw_magic_points = false; _print_stats_mp(); }
+ if (you.redraw_strength) { you.redraw_strength = false; _print_stats_str(); }
+ if (you.redraw_intelligence) { you.redraw_intelligence = false; _print_stats_int(); }
+ if (you.redraw_dexterity) { you.redraw_dexterity = false; _print_stats_dex(); }
+ if (you.redraw_armour_class) { you.redraw_armour_class = false; _print_stats_ac(); }
- textcolor( LIGHTGREY );
+ if (you.redraw_evasion)
+ {
+ cgotoxy(5, 6, GOTO_STAT);
+ if (you.duration[DUR_FORESCRY])
+ textcolor(LIGHTBLUE); // no end of effect warning
+ cprintf( "%d ", player_evasion() );
+ textcolor(LIGHTGREY);
+ you.redraw_evasion = 0;
}
- if (you.redraw_status_flags & REDRAW_LINE_3_MASK)
+ if (you.redraw_gold)
{
- cgotoxy(1, 17, GOTO_STAT);
- clear_to_end_of_line();
- cgotoxy(1, 17, GOTO_STAT);
- // Max length of this line = 7 * 5 + 3 - 1 = 37
-
- // Note the usage of bad_ench_colour() correspond to levels that
- // can be found in player.cc, ie those that the player can tell by
- // using the '@' command. Things like confusion and sticky flame
- // hide their amounts and are thus always the same colour (so
- // we're not really exposing any new information). --bwr
- if (you.duration[DUR_CONF])
- {
- textcolor( RED ); // no different levels
- cprintf( "Conf " );
- }
-
- if (you.duration[DUR_BEHELD])
- {
- textcolor( RED ); // no different levels
- cprintf( "Bhld " );
- }
-
- if (you.duration[DUR_LIQUID_FLAMES])
- {
- textcolor( RED ); // no different levels
- cprintf( "Fire " );
- }
+ cgotoxy(7, 10, GOTO_STAT);
+ cprintf( "%-8d", you.gold );
+ you.redraw_gold = 0;
+ }
- if (you.duration[DUR_POISONING])
- {
- // We skip marking "quite" poisoned and instead mark the
- // levels where the rules for dealing poison damage change
- // significantly. See acr.cc for that code. -- bwr
- textcolor( bad_ench_colour( you.duration[DUR_POISONING], 5, 10 ) );
- cprintf( "Pois " );
- }
+ if (you.redraw_experience)
+ {
+ cgotoxy(13, 11, GOTO_STAT);
- if (you.disease)
- {
- textcolor( bad_ench_colour( you.disease, 40, 120 ) );
- cprintf( "Sick " );
- }
+#if DEBUG_DIAGNOSTICS
+ cprintf( "%d/%lu (%d/%d)",
+ you.experience_level, you.experience,
+ you.skill_cost_level, you.exp_available );
+#else
+ cprintf( "%d/%lu (%d)",
+ you.experience_level, you.experience, you.exp_available );
+#endif
- if (you.rotting)
- {
- textcolor( bad_ench_colour( you.rotting, 4, 8 ) );
- cprintf( "Rot " );
- }
+ clear_to_end_of_line();
+ you.redraw_experience = 0;
+ }
- if (you.attribute[ATTR_HELD])
- {
- textcolor( RED );
- cprintf( "Held " );
- }
+ if (you.wield_change) { you.wield_change = false; _print_stats_wp(); }
+ if (you.quiver_change) { you.quiver_change = false; _print_stats_qv(); }
- if (you.backlit())
- {
- textcolor(
- you.magic_contamination > 5 ?
- bad_ench_colour( you.magic_contamination, 15, 25 )
- : LIGHTBLUE );
- cprintf( "Glow " );
- }
+
+ if (you.redraw_status_flags & REDRAW_LINE_1_MASK)
+ _print_stats_line1();
- if (you.duration[DUR_SWIFTNESS])
- {
- dur_colour( BLUE, (you.duration[DUR_SWIFTNESS] <= 6) );
- cprintf( "Swift " );
- }
+ if (you.redraw_status_flags & REDRAW_LINE_2_MASK)
+ _print_stats_line2();
- if (you.duration[DUR_SLOW] && !you.duration[DUR_HASTE])
- {
- textcolor( RED ); // no end of effect warning
- cprintf( "Slow" );
- }
- else if (you.duration[DUR_HASTE] && !you.duration[DUR_SLOW])
- {
- dur_colour( BLUE, (you.duration[DUR_HASTE] <= 6) );
- cprintf( "Fast" );
- }
+ if (you.redraw_status_flags & REDRAW_LINE_3_MASK)
+ _print_stats_line3();
- textcolor( LIGHTGREY );
- }
+ if (true /* xxx: expensive? */)
+ _print_stats_line4_monsters(18);
you.redraw_status_flags = 0;