From 3e749824ba7ecb63858063e6319a2b54e8abcf8c Mon Sep 17 00:00:00 2001 From: dshaligram Date: Mon, 12 Mar 2007 17:04:52 +0000 Subject: New % overview screen (JPEG). git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1026 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/output.cc | 1303 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1303 insertions(+) (limited to 'crawl-ref/source/output.cc') diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc index 154fea9e56..178c0f1e64 100644 --- a/crawl-ref/source/output.cc +++ b/crawl-ref/source/output.cc @@ -961,3 +961,1306 @@ std::vector get_full_detail(bool calc_unid) return cols.formatted_lines(); } + +// new status overview screen, including stats, mutations etc. +// TODO: add abilities +void print_overview_screen() +{ + clrscr(); + + formatted_string fs = get_full_detail2(false); + gotoxy(1, 1); + fs.display(); + + getch(); + redraw_screen(); +} + +formatted_string get_full_detail2(bool calc_unid) +{ + std::string text; + formatted_string output; + + char title[50]; + snprintf(title, sizeof title, " the %s ", player_title()); + + char race_class[50]; + snprintf(race_class, sizeof race_class, + "(%s %s)", + species_name(you.species, you.experience_level), you.class_name); + + char time_turns[50] = ""; + + if (you.real_time != -1) + { + const time_t curr = you.real_time + (time(NULL) - you.start_time); + char buff[200]; + make_time_string( curr, buff, sizeof(buff), true ); + + snprintf(time_turns, sizeof time_turns, + " Turns: %ld, Time: %s", + you.num_turns, buff ); + } + + int linelength = strlen(you.your_name) + strlen(title) + + strlen(race_class) + strlen(time_turns); + for (int count = 0; linelength >= 80 && count < 2; count++ ) + { + switch (count) + { + case 0: + snprintf(race_class, sizeof race_class, + "(%s%s)", + get_species_abbrev(you.species), + get_class_abbrev(you.char_class) ); + break; + case 1: + strcpy(title, ""); + break; + default: + break; + } + linelength = strlen(you.your_name) + strlen(title) + + strlen(race_class) + strlen(time_turns); + } + + output.textcolor(YELLOW); + output.cprintf("%s%s%s", you.your_name, title, race_class); + output.gotoxy(get_number_of_cols() - strlen(time_turns), -1); + output.cprintf("%s", time_turns); + output.textcolor(LIGHTGREY); + output.cprintf(EOL); + + std::vector vfs = get_stat_info(); + for (unsigned int i = 0; i < vfs.size(); i++) + { + output += vfs[i]; + output += formatted_string::parse_string("\n"); + } + output += formatted_string::parse_string("\n"); + + vfs = get_res_info(calc_unid); + for (unsigned int i = 0; i < vfs.size(); i++) + { + output += vfs[i]; + output += formatted_string::parse_string("\n"); + } + + //---------------------------- + // print status information + //---------------------------- + text = "\n@: "; + + if (you.burden_state == BS_ENCUMBERED) + text += "burdened, "; + else if (you.burden_state == BS_OVERLOADED) + text += "overloaded, "; + + if (you.duration[DUR_BREATH_WEAPON]) + text += "short of breath, "; + + if (you.duration[DUR_REPEL_UNDEAD]) + text += "repel undead, "; + + if (you.duration[DUR_LIQUID_FLAMES]) + text += "liquid flames, "; + + if (you.duration[DUR_ICY_ARMOUR]) + text += "icy shield, "; + + if (you.duration[DUR_DEFLECT_MISSILES]) + text += "deflect missiles, "; + else if (you.duration[DUR_REPEL_MISSILES]) + text += "repel missiles, "; + + if (you.duration[DUR_PRAYER]) + text += "praying, "; + + if (you.duration[DUR_REGENERATION]) + text += "regenerating, "; + +// if (you.duration[DUR_INSULATION]) +// text += "insulated, "; + + if (you.duration[DUR_STONEMAIL]) + text += "stone mail, "; + + if (you.duration[DUR_STONESKIN]) + text += "stone skin, "; + +// if (you.duration[DUR_CONTROLLED_FLIGHT]) +// text += "control flight, "; + + if (you.duration[DUR_TELEPORT]) + text += "about to teleport, "; + +// if (you.duration[DUR_CONTROL_TELEPORT]) +// text += "control teleport, "; + + if (you.duration[DUR_DEATH_CHANNEL]) + text += "death channel, "; + + if (you.duration[DUR_FORESCRY]) //jmf: added 19mar2000 + text += "forewarned, "; + + if (you.duration[DUR_SILENCE]) //jmf: added 27mar2000 + text += "radiating silence, "; + +// if (you.duration[DUR_SEE_INVISIBLE]) +// text += "see invisible, "; + + if (you.invis) + text += "invisible, "; + + if (you.conf) + text += "confused, "; + + if (you.paralysis) + text += "paralysed, "; + + if (you.exhausted) + text += "exhausted, "; + + if (you.might) + text += "mighty, "; + + if (you.berserker) + text += "berserking, "; + + if (player_is_levitating()) + text += "levitating, "; + + if (you.poisoning) + { + text += (you.poisoning > 10) ? "extremely" : + (you.poisoning > 5) ? "very" : + (you.poisoning > 3) ? "quite" + : "mildly"; + text += " poisoned, "; + } + + if (you.disease) + { + text += (you.disease > 120) ? "badly " : + (you.disease > 40) ? "" + : "mildly "; + text += "diseased, "; + } + + if (you.rotting || you.species == SP_GHOUL) + text += "rotting, "; +// contaminate_player( 0, true ); + + if (you.confusing_touch) + text += "confusing touch, "; + + if (you.sure_blade) + text += "bonded with blade, "; + + int move_cost = (player_speed() * player_movement_speed()) / 10; + if ( you.slow ) + move_cost *= 2; + + text += (move_cost < 8) ? "very quick, " : + (move_cost < 10) ? "quick, " : + (move_cost == 10) ? "" : + (move_cost < 13) ? "slow, " : ""; + + if (you.slow && !you.haste) + text += "slowed, "; + else if (you.haste && !you.slow) + text += "hasted, "; + else if (!you.haste && you.duration[DUR_SWIFTNESS]) + text += "swift, "; + + const int mr = player_res_magic(); + snprintf(info, INFO_SIZE, "%s resistant to magic, ", + (mr < 10) ? "not" : + (mr < 30) ? "slightly" : + (mr < 60) ? "somewhat" : + (mr < 90) ? "quite" : + (mr < 120) ? "very" : + (mr < 140) ? "extremely" : + "incredibly"); + text += info; + + // character evaluates their ability to sneak around: + const int ustealth = check_stealth(); + + snprintf( info, INFO_SIZE, "%sstealthy", + (ustealth < 10) ? "extremely un" : + (ustealth < 20) ? "very un" : + (ustealth < 30) ? "un" : + (ustealth < 50) ? "fairly " : + (ustealth < 80) ? "" : + (ustealth < 120) ? "quite " : + (ustealth < 160) ? "very " : + (ustealth < 200) ? "extremely " + : "incredibly " ); + + text += info; + + size_t start = 0, pos = 0, oldpos = 0; + for (; pos < strlen(text.c_str()); oldpos++) { + + // get next "word" + pos = text.find(' ', oldpos); + if (pos - start >= 80 && pos < strlen(text.c_str())) { + output += formatted_string::parse_string( + text.substr(start, oldpos-start)); + output += formatted_string::parse_string(EOL); + start = oldpos; + } + oldpos = pos; + } + + output += formatted_string::parse_string(text.substr(start, pos-start)); + text = ""; + + switch (you.attribute[ATTR_TRANSFORMATION]) + { + case TRAN_SPIDER: + text += "\nYou are in spider-form."; + break; + case TRAN_BLADE_HANDS: + text += "\nYou have blades for hands."; + break; + case TRAN_STATUE: + text += "\nYou are a statue."; + break; + case TRAN_ICE_BEAST: + text += "\nYou are an ice creature."; + break; + case TRAN_DRAGON: + text += "\nYou are in dragon-form."; + break; + case TRAN_LICH: + text += "\nYou are in lich-form."; + break; + case TRAN_SERPENT_OF_HELL: + text += "\nYou are a huge demonic serpent."; + break; + case TRAN_AIR: + text += "\nYou are a cloud of diffuse gas."; + break; + } + + text += EOL; + const int to_hit = calc_your_to_hit( false ) * 2; + + snprintf( info, INFO_SIZE, + "%s in your current equipment.", + (to_hit < 1) ? "You are completely incapable of fighting" : + (to_hit < 5) ? "Hitting even clumsy monsters is extremely awkward" : + (to_hit < 10) ? "Hitting average monsters is awkward" : + (to_hit < 15) ? "Hitting average monsters is difficult" : + (to_hit < 20) ? "Hitting average monsters is hard" : + (to_hit < 30) ? "Very agile monsters are a bit awkward to hit" : + (to_hit < 45) ? "Very agile monsters are a bit difficult to hit" : + (to_hit < 60) ? "Very agile monsters are a bit hard to hit" : + (to_hit < 100) ? "You feel comfortable with your ability to fight" + : "You feel confident with your ability to fight" ); + text += info; + + if (you.deaths_door) + text += "\nYou are standing in death's doorway."; + + output += formatted_string::parse_string(text); + + //---------------------------- + // print mutation information + //---------------------------- + text = "\nA: "; + + bool have_any = false; + int AC_change = 0; + int EV_change = 0; + int Str_change = 0; + int Int_change = 0; + int Dex_change = 0; + + switch (you.species) //mv: following code shows innate abilities - if any + { + case SP_MERFOLK: + text += "change form in water"; + have_any = true; + break; + + case SP_NAGA: + // breathe poison replaces spit poison: + if (!you.mutation[MUT_BREATHE_POISON]) + text += "spit poison" EOL; + else + text += "breathe poison"; + + have_any = true; + break; + + case SP_TROLL: + text += "saprovore 2"; + have_any = true; + break; + + case SP_GHOUL: + text += "saprovore 3"; + text += ", deterioriation"; + have_any = true; + break; + + case SP_GREY_ELF: + if (you.experience_level > 4) + { + text += "charming"; + have_any = true; + } + break; + + case SP_HIGH_ELF: + if (you.experience_level > 14) + { + text += "charming"; + have_any = true; + } + break; + + case SP_KENKU: + text += "cannot wear helmets"; + if (you.experience_level > 4) + { + text += ", able to fly"; + if (you.experience_level > 14) + text += " continuously"; + have_any = true; + } + break; + + case SP_MUMMY: + text += "in touch with death"; + +// if (you.experience_level > 12) +// text += "You can restore your body by infusing magical energy." EOL; + + have_any = true; + break; + + case SP_GREY_DRACONIAN: + if (you.experience_level > 6) + { + text += "spiky tail"; + have_any = true; + } + break; + + case SP_GREEN_DRACONIAN: + if (you.experience_level > 6) + { + text += "breathe poison"; + have_any = true; + } + break; + + case SP_RED_DRACONIAN: + if (you.experience_level > 6) + { + text += "breathe fire"; + have_any = true; + } + break; + + case SP_WHITE_DRACONIAN: + if (you.experience_level > 6) + { + text += "breathe frost"; + have_any = true; + } + break; + + case SP_BLACK_DRACONIAN: + if (you.experience_level > 6) + { + text += "breathe lightning"; + have_any = true; + } + break; + + case SP_GOLDEN_DRACONIAN: + if (you.experience_level > 6) + { + text += "spit acid"; + text += ", acid resistance"; + have_any = true; + } + break; + + case SP_PURPLE_DRACONIAN: + if (you.experience_level > 6) + { + text += "breathe power"; + have_any = true; + } + break; + + case SP_MOTTLED_DRACONIAN: + if (you.experience_level > 6) + { + text += "breathe sticky flames"; + have_any = true; + } + break; + + case SP_PALE_DRACONIAN: + if (you.experience_level > 6) + { + text += "breathe steam"; + have_any = true; + } + break; + + case SP_KOBOLD: + text += "saprovore 2" EOL; + have_any = true; + break; + + case SP_HILL_ORC: + case SP_OGRE: + text += "saprovore 1" EOL; + have_any = true; + break; + } //end switch - innate abilities + + // a bit more stuff + if ( (you.species >= SP_OGRE && you.species <= SP_OGRE_MAGE) || + player_genus(GENPC_DRACONIAN) || + you.species == SP_SPRIGGAN ) + { + if (have_any) + text += ", "; + text += "unfitting armour"; + have_any = true; + } + + for (unsigned i = 0; i < 100; i++) { + if (!you.mutation[i]) + continue; + + int level = you.mutation[ i ]; + + switch(i) { + case MUT_TOUGH_SKIN: + AC_change += level; + break; + case MUT_STRONG: + Str_change += level; + break; + case MUT_CLEVER: + Int_change += level; + break; + case MUT_AGILE: + Dex_change += level; + break; + case MUT_GREEN_SCALES: + AC_change += 2*level-1; + break; + case MUT_BLACK_SCALES: + AC_change += 3*level; + Dex_change -= level; + break; + case MUT_GREY_SCALES: + AC_change += level; + break; + case MUT_BONEY_PLATES: + AC_change += level+1; + Dex_change -= level; + break; + case MUT_REPULSION_FIELD: + EV_change += 2*level-1; + if (level == 3) { + if (have_any) + text += ", "; + text += "repel missiles"; + have_any = true; + } + break; + case MUT_POISON_RESISTANCE: + if (have_any) + text += ", "; + text += "poison resistance"; + have_any = true; + break; + case MUT_CARNIVOROUS: + if (have_any) + text += ", "; + snprintf(info, INFO_SIZE, "carnivore %d", level); + text += info; + have_any = true; + break; + case MUT_HERBIVOROUS: + if (have_any) + text += ", "; + snprintf(info, INFO_SIZE, "herbivore %d", level); + text += info; + have_any = true; + break; + case MUT_HEAT_RESISTANCE: + if (have_any) + text += ", "; + snprintf(info, INFO_SIZE, "fire resistance %d", level); + text += info; + have_any = true; + break; + case MUT_COLD_RESISTANCE: + if (have_any) + text += ", "; + snprintf(info, INFO_SIZE, "cold resistance %d", level); + text += info; + have_any = true; + break; + case MUT_SHOCK_RESISTANCE: + if (have_any) + text += ", "; + text += "electricity resistance"; + have_any = true; + break; + case MUT_REGENERATION: + if (have_any) + text += ", "; + snprintf(info, INFO_SIZE, "regeneration %d", level); + text += info; + have_any = true; + break; + case MUT_FAST_METABOLISM: + if (have_any) + text += ", "; + snprintf(info, INFO_SIZE, "fast metabolism %d", level); + text += info; + have_any = true; + break; + case MUT_SLOW_METABOLISM: + if (have_any) + text += ", "; + snprintf(info, INFO_SIZE, "slow metabolism %d", level); + text += info; + have_any = true; + break; + case MUT_WEAK: + Str_change -= level; + break; + case MUT_DOPEY: + Int_change -= level; + break; + case MUT_CLUMSY: + Dex_change -= level; + break; + case MUT_TELEPORT_CONTROL: + if (have_any) + text += ", "; + text += "teleport control"; + have_any = true; + break; + case MUT_TELEPORT: + if (have_any) + text += ", "; + snprintf(info, INFO_SIZE, "teleportitis %d", level); + text += info; + have_any = true; + break; + case MUT_MAGIC_RESISTANCE: + if (have_any) + text += ", "; + snprintf(info, INFO_SIZE, "magic resistance %d", level); + text += info; + have_any = true; + break; + case MUT_FAST: + if (have_any) + text += ", "; + snprintf(info, INFO_SIZE, "speed %d", level); + text += info; + have_any = true; + break; + case MUT_ACUTE_VISION: + if (have_any) + text += ", "; + text += "see invisible"; + have_any = true; + break; + case MUT_DEFORMED: + if (have_any) + text += ", "; + snprintf(info, INFO_SIZE, "deformed body %d", level); + text += info; + have_any = true; + break; + case MUT_TELEPORT_AT_WILL: + snprintf(info, INFO_SIZE, "teleport at will %d", level); + if (have_any) + text += ", "; + text += info; + have_any = true; + break; + case MUT_SPIT_POISON: + if (have_any) + text += ", "; + text += "spit poison"; + have_any = true; + break; + case MUT_MAPPING: + if (have_any) + text += ", "; + snprintf(info, INFO_SIZE, "sense surroundings %d", level); + text += info; + have_any = true; + break; + case MUT_BREATHE_FLAMES: + if (have_any) + text += ", "; + snprintf(info, INFO_SIZE, "breathe flames %d", level); + text += info; + have_any = true; + break; + case MUT_BLINK: + if (have_any) + text += ", "; + text += "blink"; + have_any = true; + break; + case MUT_HORNS: + if (have_any) + text += ", "; + snprintf(info, INFO_SIZE, "horns %d", level); + text += info; + have_any = true; + break; + case MUT_STRONG_STIFF: + Str_change += level; + Dex_change -= level; + break; + case MUT_FLEXIBLE_WEAK: + Str_change -= level; + Dex_change += level; + break; + case MUT_LOST: + if (have_any) + text += ", "; + snprintf(info, INFO_SIZE, "forgetfulness %d", level); + text += info; + have_any = true; + break; + case MUT_CLARITY: + if (have_any) + text += ", "; + snprintf(info, INFO_SIZE, "clarity %d", level); + text += info; + have_any = true; + break; + case MUT_BERSERK: + if (have_any) + text += ", "; + snprintf(info, INFO_SIZE, "berserk %d", level); + text += info; + have_any = true; + break; + case MUT_DETERIORATION: + if (have_any) + text += ", "; + snprintf(info, INFO_SIZE, "deteriotation %d", level); + text += info; + have_any = true; + break; + case MUT_BLURRY_VISION: + if (have_any) + text += ", "; + snprintf(info, INFO_SIZE, "blurry vision %d", level); + text += info; + have_any = true; + break; + case MUT_MUTATION_RESISTANCE: + if (have_any) + text += ", "; + snprintf(info, INFO_SIZE, "mutation resistance %d", level); + text += info; + have_any = true; + break; + case MUT_FRAIL: + if (have_any) + text += ", "; + snprintf(info, INFO_SIZE, "-%d hp", level*10); + text += info; + have_any = true; + break; + case MUT_ROBUST: + if (have_any) + text += ", "; + snprintf(info, INFO_SIZE, "+%d hp", level*10); + text += info; + have_any = true; + break; + case MUT_TORMENT_RESISTANCE: + if (have_any) + text += ", "; + text += "torment resistance"; + have_any = true; + break; + case MUT_NEGATIVE_ENERGY_RESISTANCE: + if (have_any) + text += ", "; + snprintf(info, INFO_SIZE, "life protection %d", level); + text += info; + have_any = true; + break; + case MUT_SUMMON_MINOR_DEMONS: + if (have_any) + text += ", "; + text += "summon minor demons"; + have_any = true; + break; + case MUT_SUMMON_DEMONS: + if (have_any) + text += ", "; + text += "summon demons"; + have_any = true; + break; + case MUT_HURL_HELLFIRE: + if (have_any) + text += ", "; + text += "hurl hellfire"; + have_any = true; + break; + case MUT_CALL_TORMENT: + if (have_any) + text += ", "; + text += "call torment"; + have_any = true; + break; + case MUT_RAISE_DEAD: + if (have_any) + text += ", "; + text += "raise dead"; + have_any = true; + break; + case MUT_CONTROL_DEMONS: + if (have_any) + text += ", "; + text += "control demons"; + have_any = true; + break; + case MUT_PANDEMONIUM: + if (have_any) + text += ", "; + text += "portal to Pandemonium"; + have_any = true; + break; + case MUT_DEATH_STRENGTH: + if (have_any) + text += ", "; + text += "draw strength from death and destruction"; + have_any = true; + break; + case MUT_CHANNEL_HELL: + if (have_any) + text += ", "; + text += "channel magical energy from Hell"; + have_any = true; + break; + case MUT_DRAIN_LIFE: + if (have_any) + text += ", "; + text += "drain life"; + have_any = true; + break; + case MUT_THROW_FLAMES: + if (have_any) + text += ", "; + text += "throw flames of Gehenna"; + have_any = true; + break; + case MUT_THROW_FROST: + if (have_any) + text += ", "; + text += "throw frost of Cocytus"; + have_any = true; + break; + case MUT_SMITE: + if (have_any) + text += ", "; + text += "invoke powers of Tartarus"; + have_any = true; + break; + case MUT_CLAWS: + if (have_any) + text += ", "; + snprintf(info, INFO_SIZE, "claws %d", level); + text += info; + have_any = true; + break; + case MUT_HOOVES: + if (have_any) + text += ", "; + text += "hooves"; + have_any = true; + break; + case MUT_BREATHE_POISON: + if (have_any) + text += ", "; + text += "breathe poison"; + have_any = true; + break; + case MUT_STINGER: + if (have_any) + text += ", "; + snprintf(info, INFO_SIZE, "stinger %d", level); + text += info; + have_any = true; + break; + case MUT_BIG_WINGS: + if (have_any) + text += ", "; + text += "large and strong wings"; + have_any = true; + break; + case MUT_BLUE_MARKS: + if (have_any) + text += ", "; + snprintf(info, INFO_SIZE, "blue evil mark %d", level); + text += info; + have_any = true; + break; + case MUT_GREEN_MARKS: + if (have_any) + text += ", "; + snprintf(info, INFO_SIZE, "green evil mark %d", level); + text += info; + have_any = true; + break; + case MUT_RED_SCALES: + AC_change += level; + if (level == 3) + AC_change++; + break; + case MUT_NACREOUS_SCALES: + AC_change += 2*level-1; + break; + case MUT_GREY2_SCALES: + AC_change += 2*level; + Dex_change -= 1; + if (level == 3) + Dex_change--; + break; + case MUT_METALLIC_SCALES: + AC_change += 3*level+1; + if (level == 1) + AC_change--; + Dex_change -= level + 1; + break; + case MUT_BLACK2_SCALES: + AC_change += 2*level-1; + break; + case MUT_WHITE_SCALES: + AC_change += 2*level-1; + break; + case MUT_YELLOW_SCALES: + AC_change += 2*level; + Dex_change -= level-1; + break; + case MUT_BROWN_SCALES: + AC_change += 2*level; + if (level == 3) + AC_change--; + break; + case MUT_BLUE_SCALES: + AC_change += level; + break; + case MUT_PURPLE_SCALES: + AC_change += 2*level; + break; + case MUT_SPECKLED_SCALES: + AC_change += level; + break; + case MUT_ORANGE_SCALES: + AC_change += level; + if (level > 1) + AC_change++; + break; + case MUT_INDIGO_SCALES: + AC_change += 2*level-1; + if (level == 1) + AC_change++; + break; + case MUT_RED2_SCALES: + AC_change += 2*level; + if (level > 1) + AC_change++; + Dex_change -= level - 1; + break; + case MUT_IRIDESCENT_SCALES: + AC_change += level; + break; + case MUT_PATTERNED_SCALES: + AC_change += level; + break; + default: break; + } + } + + if (AC_change) + { + if (have_any) + text += ", "; + snprintf(info, INFO_SIZE, "AC %s%d", (AC_change > 0 ? "+" : ""), AC_change); + text += info; + have_any = true; + } + if (EV_change) + { + if (have_any) + text += ", "; + snprintf(info, INFO_SIZE, "EV +%d", EV_change); + text += info; + have_any = true; + } + if (Str_change) + { + if (have_any) + text += ", "; + snprintf(info, INFO_SIZE, "Str %s%d", (Str_change > 0 ? "+" : ""), Str_change); + text += info; + have_any = true; + } + if (Int_change) + { + if (have_any) + text += ", "; + snprintf(info, INFO_SIZE, "Int %s%d", (Int_change > 0 ? "+" : ""), Int_change); + text += info; + have_any = true; + } + if (Dex_change) + { + if (have_any) + text += ", "; + snprintf(info, INFO_SIZE, "Dex %s%d", (Dex_change > 0 ? "+" : ""), Dex_change); + text += info; + have_any = true; + } + + if (!have_any) + text += "no striking features"; + + start = 0; + oldpos = 0; + for (pos = 0; pos < strlen(text.c_str()); oldpos++) + { + // get next "word" + pos = text.find(' ', oldpos); + if (pos - start >= 80 && pos < strlen(text.c_str())) + { + output += formatted_string::parse_string(text.substr(start, oldpos-start)); + output += formatted_string::parse_string(EOL); + start = oldpos; + } + oldpos = pos; + } + + output += formatted_string::parse_string(text.substr(start, pos-start)); + + //---------------------------- + // print ability information + //---------------------------- +/* + text = "\na: "; + + have_any = false; + for (unsigned int loopy = 0; loopy < 52; loopy++) + { + if (Curr_abil[loopy].which != ABIL_NON_ABILITY) + { + have_any = true; + + const struct ability_def abil = get_ability_def( Curr_abil[loopy].which ); + + if (have_any) + text += ", "; + snprintf(info, INFO_SIZE, "%s", abil.name ); + text += info; + } + + } + if (!have_any) + text += "no special abilities"; + + start = 0; + oldpos = 0; + for (pos = 0; pos < strlen(text.c_str()); oldpos++) + { + // get next "word" + pos = text.find(' ', oldpos); + if (pos - start >= 80 && pos < strlen(text.c_str())) + { + output += formatted_string::parse_string(text.substr(start, oldpos-start)); + output += formatted_string::parse_string(EOL); + start = oldpos; + } + oldpos = pos; + } + + output += formatted_string::parse_string(text.substr(start, pos-start)); +*/ + + return output; +} + +std::vector get_stat_info() +{ + char buf[1000]; + // 3 columns, splits at columns 32, 52 + column_composer cols(4, 16, 27, 38); + + if (!player_rotted()) + snprintf(buf, sizeof buf, "HP %3d/%d",you.hp,you.hp_max); + else + snprintf(buf, sizeof buf, "HP %3d/%d (%d)", + you.hp, you.hp_max, you.hp_max + player_rotted() ); + + cols.add_formatted(0, buf, false); + + snprintf(buf, sizeof buf, "MP %3d/%d", + you.magic_points, you.max_magic_points); + + cols.add_formatted(0, buf, false); + + if (you.strength == you.max_strength) + snprintf(buf, sizeof buf, "Str %3d", you.strength); + else + snprintf(buf, sizeof buf, "Str %3d (%d)", + you.strength, you.max_strength); + cols.add_formatted(1, buf, false); + + if (you.intel == you.max_intel) + snprintf(buf, sizeof buf, "Int %3d", you.intel); + else + snprintf(buf, sizeof buf, "Int %3d (%d)", + you.intel, you.max_intel); + cols.add_formatted(1, 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); + cols.add_formatted(1, buf, false); + + snprintf(buf, sizeof buf, + "AC %3d\n" + "EV %3d\n" + "Sh %3d\n", + player_AC(), + player_evasion(), + player_shield_class()); + cols.add_formatted(2, buf, false); + + 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, + "Experience: %d/%lu (%d)\n" + "Spells: %2d memorised, %2d level%s left\n" + "God: %s%s Gold: %d\n", + you.experience_level, you.experience, you.exp_available, + you.spell_no, player_spell_levels(), (player_spell_levels() == 1) ? "" : "s", + god_colour_tag, godpowers.c_str(), you.gold); + cols.add_formatted(3, buf, false); + + return cols.formatted_lines(); +} + +std::vector get_res_info(bool calc_unid) +{ + char buf[1000]; + // 3 columns, splits at columns 21, 38 + column_composer cols(3, 21, 38); + + const int rfire = player_res_fire(calc_unid); + const int rcold = player_res_cold(calc_unid); + const int rlife = player_prot_life(calc_unid); + const int rpois = player_res_poison(calc_unid); + const int relec = player_res_electricity(calc_unid); + const int rsust = player_sust_abil(calc_unid); + const int rmuta = wearing_amulet(AMU_RESIST_MUTATION, calc_unid); + const int rslow = wearing_amulet(AMU_RESIST_SLOW, calc_unid); + + snprintf(buf, sizeof buf, + "%sRes.Fire : %s\n" + "%sRes.Cold : %s\n" + "%sLife Prot.: %s\n" + "%sRes.Poison: %s\n" + "%sRes.Elec. : %s\n" + "\n" + "%sSust.Abil.: %s\n" + "%sRes.Mut. : %s\n" + "%sRes.Slow : %s\n", + determine_color_string(rfire), itosym3(rfire), + determine_color_string(rcold), itosym3(rcold), + determine_color_string(rlife), itosym3(rlife), + determine_color_string(rpois), itosym1(rpois), + determine_color_string(relec), itosym1(relec), + determine_color_string(rsust), itosym1(rsust), + determine_color_string(rmuta), itosym1(rmuta), + determine_color_string(rslow), itosym1(rslow)); + cols.add_formatted(0, buf, false); + + int saplevel = 0; + switch (you.species) + { + case SP_GHOUL: + saplevel = 3; + snprintf(buf, sizeof buf, "%sSaprovore : %s", + determine_color_string(3), itosym3(3) ); + break; + + case SP_KOBOLD: + case SP_TROLL: + saplevel = 2; + snprintf(buf, sizeof buf, "%sSaprovore : %s", + determine_color_string(2), itosym3(2) ); + break; + + case SP_HILL_ORC: + case SP_OGRE: + saplevel = 1; + break; + default: + saplevel = 0; + break; + } + const char* pregourmand; + const char* postgourmand; + if ( wearing_amulet(AMU_THE_GOURMAND, calc_unid) ) + { + pregourmand = "Gourmand : "; + postgourmand = itosym1(1); + saplevel = 1; + } + else + { + pregourmand = "Saprovore : "; + postgourmand = itosym3(saplevel); + } + snprintf(buf, sizeof buf, "%s%s%s", + determine_color_string(saplevel), pregourmand, postgourmand); + cols.add_formatted(0, buf, false); + + + const int rinvi = player_see_invis(calc_unid); + const int rward = wearing_amulet(AMU_WARDING, calc_unid) || + (you.religion == GOD_VEHUMET && you.duration[DUR_PRAYER] && + !player_under_penance() && you.piety >= piety_breakpoint(2)); + const int rcons = wearing_amulet(AMU_CONSERVATION, calc_unid); + const int rcorr = wearing_amulet(AMU_RESIST_CORROSION, calc_unid); + const int rclar = wearing_amulet(AMU_CLARITY, calc_unid); + snprintf(buf, sizeof buf, + "%sSee Invis. : %s\n" + "%sWarding : %s\n" + "%sConserve : %s\n" + "%sRes.Corr. : %s\n" + "%sClarity : %s\n" + "\n", + determine_color_string(rinvi), itosym1(rinvi), + determine_color_string(rward), itosym1(rward), + determine_color_string(rcons), itosym1(rcons), + determine_color_string(rcorr), itosym1(rcorr), + determine_color_string(rclar), itosym1(rclar)); + cols.add_formatted(1, buf, false); + + if ( scan_randarts(RAP_PREVENT_TELEPORTATION, calc_unid) ) + snprintf(buf, sizeof buf, "\n%sPrev.Telep.: %s", + determine_color_string(-1), itosym1(1)); + else + { + const int rrtel = player_teleport(calc_unid); + snprintf(buf, sizeof buf, "\n%sRnd.Telep. : %s", + determine_color_string(rrtel), itosym1(rrtel)); + } + cols.add_formatted(1, buf, false); + + const int rctel = player_control_teleport(calc_unid); + const int rlevi = player_is_levitating(); + const int rcfli = wearing_amulet(AMU_CONTROLLED_FLIGHT, calc_unid); + snprintf(buf, sizeof buf, + "%sCtrl.Telep.: %s\n" + "%sLevitation : %s\n" + "%sCtrl.Flight: %s\n", + determine_color_string(rctel), itosym1(rctel), + determine_color_string(rlevi), itosym1(rlevi), + determine_color_string(rcfli), itosym1(rcfli)); + cols.add_formatted(1, buf, false); + + + { + char str_pass[ITEMNAME_SIZE]; + const int e_order[] = + { + EQ_WEAPON, EQ_BODY_ARMOUR, EQ_SHIELD, EQ_HELMET, EQ_CLOAK, + EQ_GLOVES, EQ_BOOTS, EQ_AMULET, EQ_RIGHT_RING, EQ_LEFT_RING + }; + + for(int i = 0; i < NUM_EQUIP; i++) + { + int eqslot = e_order[i]; + const char *slot = equip_slot_to_name( eqslot ); + if (eqslot == EQ_LEFT_RING || eqslot == EQ_RIGHT_RING) + slot = "Ring"; + else if (eqslot == EQ_BOOTS && + (you.species == SP_CENTAUR || you.species == SP_NAGA)) + slot = "Barding"; + + if ( you.equip[ e_order[i] ] != -1) + { + const int inum = you.equip[e_order[i]]; + in_name( inum, DESC_PLAIN, str_pass, true ); + str_pass[38] = 0; // truncate + const char* colname = colour_to_str(you.inv[inum].colour); + snprintf(buf, sizeof buf, "%-7s: <%s>%s", + slot, colname, str_pass, colname); + } + else + { + if (e_order[i] == EQ_WEAPON) + { + if (you.attribute[ATTR_TRANSFORMATION] == TRAN_BLADE_HANDS) + snprintf(buf, sizeof buf, "%-7s: Blade Hands", slot); + else if (you.skills[SK_UNARMED_COMBAT]) + snprintf(buf, sizeof buf, "%-7s: Unarmed", slot); + else + snprintf(buf, sizeof buf, "%-7s:", slot); + } + else + { + snprintf(buf, sizeof buf, "%-7s:", slot); + } + } + cols.add_formatted(2, buf, false); + } + } + + return cols.formatted_lines(); +} + -- cgit v1.2.3-54-g00ecf