diff options
author | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2006-08-02 12:54:15 +0000 |
---|---|---|
committer | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2006-08-02 12:54:15 +0000 |
commit | d5e5340c3926d1cf97f6cba151ffaecb20bfb35f (patch) | |
tree | d1faf7d5b27df8f3c523a8dd33357804118e62b1 /trunk/source/output.cc | |
parent | 7b2204d69f21d7075e4666ee032d7a129081bc4b (diff) | |
download | crawl-ref-d5e5340c3926d1cf97f6cba151ffaecb20bfb35f.tar.gz crawl-ref-d5e5340c3926d1cf97f6cba151ffaecb20bfb35f.zip |
Integrated travel patch as of 20060727
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'trunk/source/output.cc')
-rw-r--r-- | trunk/source/output.cc | 279 |
1 files changed, 278 insertions, 1 deletions
diff --git a/trunk/source/output.cc b/trunk/source/output.cc index 6b7568710b..415e970fc0 100644 --- a/trunk/source/output.cc +++ b/trunk/source/output.cc @@ -22,9 +22,14 @@ #include "externs.h" +#include "fight.h" #include "itemname.h" +#include "menu.h" #include "ouch.h" #include "player.h" +#include "religion.h" +#include "skills2.h" +#include "stuff.h" static int bad_ench_colour( int lvl, int orange, int red ) { @@ -271,7 +276,13 @@ void print_stats(void) textcolor(you.inv[you.equip[EQ_WEAPON]].colour); char str_pass[ ITEMNAME_SIZE ]; - in_name( you.equip[EQ_WEAPON], DESC_INVENTORY, str_pass, Options.terse_hand ); + in_name( you.equip[EQ_WEAPON], DESC_INVENTORY, str_pass, false ); + int prefcol = menu_colour(str_pass); + if (prefcol != -1) + textcolor(prefcol); + + in_name( you.equip[EQ_WEAPON], DESC_INVENTORY, str_pass, + Options.terse_hand ); str_pass[39] = '\0'; cprintf(str_pass); @@ -539,3 +550,269 @@ void print_stats(void) update_screen(); #endif } // end print_stats() + +unsigned char* itosym1(int stat) +{ + return (unsigned char*)( (stat >= 1) ? "+ " : ". " ); +} + +unsigned char* itosym3(int stat) +{ + return (unsigned char*)( (stat >= 3) ? "+ + +" : + (stat == 2) ? "+ + ." : + (stat == 1) ? "+ . ." : + (stat == 0) ? ". . ." : + "x . ."); +} + +static const char *s_equip_slot_names[] = +{ + "Weapon", + "Cloak", + "Helmet", + "Gloves", + "Boots", + "Shield", + "Armour", + "Left Ring", + "Right Ring", + "Amulet", +}; + +const char *equip_slot_to_name(int equip) +{ + if (equip == EQ_RINGS) + return "Ring"; + if (equip < 0 || equip >= NUM_EQUIP) + return ""; + return s_equip_slot_names[equip]; +} + +int equip_name_to_slot(const char *s) +{ + for (int i = 0; i < NUM_EQUIP; ++i) + { + if (!stricmp(s_equip_slot_names[i], s)) + return i; + } + return -1; +} + +void get_full_detail(char* buffer, bool calc_unid) +{ +#define FIR_AD buffer,44 +#define CUR_AD &buffer[++lines*45],44 +#define BUF_SIZE 25*3*45 + int lines = 0; + + memset(buffer, 0, BUF_SIZE); + + snprintf(CUR_AD, "%s the %s", you.your_name, player_title()); + lines++; + snprintf(CUR_AD, "Race : %s", species_name(you.species,you.experience_level) ); + snprintf(CUR_AD, "Class : %s", you.class_name); + snprintf(CUR_AD, "Worship : %s", + you.religion == GOD_NO_GOD? "" : god_name(you.religion) ); + snprintf(CUR_AD, "Level : %7d", you.experience_level); + snprintf(CUR_AD, "Exp : %7lu", you.experience); + + if (you.experience_level < 27) + { + int xp_needed = (exp_needed(you.experience_level+2) - you.experience) + 1; + snprintf(CUR_AD, "Next Level : %7lu", exp_needed(you.experience_level + 2) + 1); + snprintf(CUR_AD, "Exp Needed : %7d", xp_needed); + } + else + { + snprintf(CUR_AD, " "); + snprintf(CUR_AD, " "); + } + + snprintf(CUR_AD, "Spls.Left : %7d", player_spell_levels() ); + snprintf(CUR_AD, "Gold : %7d", you.gold ); + + lines++; + + if (!player_rotted()) + { + if (you.hp < you.hp_max) + snprintf(CUR_AD, "HP : %3d/%d", you.hp, you.hp_max); + else + snprintf(CUR_AD, "HP : %3d", you.hp); + } + else + { + snprintf(CUR_AD, "HP : %3d/%d (%d)", + you.hp, you.hp_max, you.hp_max + player_rotted() ); + } + + if (you.magic_points < you.max_magic_points) + snprintf(CUR_AD, "MP : %3d/%d", + you.magic_points, you.max_magic_points); + else + snprintf(CUR_AD, "MP : %3d", you.magic_points); + + if (you.strength == you.max_strength) + snprintf(CUR_AD, "Str : %3d", you.strength); + else + snprintf(CUR_AD, "Str : %3d (%d)", + you.strength, you.max_strength); + + if (you.intel == you.max_intel) + snprintf(CUR_AD, "Int : %3d", you.intel); + else + snprintf(CUR_AD, "Int : %3d (%d)", you.intel, you.max_intel); + + if (you.dex == you.max_dex) + snprintf(CUR_AD, "Dex : %3d", you.dex); + else + snprintf(CUR_AD, "Dex : %3d (%d)", you.dex, you.max_dex); + + snprintf(CUR_AD, "AC : %3d", player_AC() ); + snprintf(CUR_AD, "Evasion : %3d", player_evasion() ); + snprintf(CUR_AD, "Shield : %3d", player_shield_class() ); + lines++; + + 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(CUR_AD, "Play time : %10s", buff); + snprintf(CUR_AD, "Turns : %10ld", you.num_turns ); + } + + lines = 27; + + snprintf(CUR_AD, "Res.Fire : %s", + itosym3( player_res_fire(calc_unid) ) ); + snprintf(CUR_AD, "Res.Cold : %s", + itosym3( player_res_cold(calc_unid) ) ); + snprintf(CUR_AD, "Life Prot.: %s", + itosym3( player_prot_life(calc_unid) ) ); + snprintf(CUR_AD, "Res.Poison: %s", + itosym1( player_res_poison(calc_unid) ) ); + snprintf(CUR_AD, "Res.Elec. : %s", + itosym1( player_res_electricity(calc_unid) ) ); + lines++; + + snprintf(CUR_AD, "Sust.Abil.: %s", + itosym1( player_sust_abil(calc_unid) ) ); + snprintf(CUR_AD, "Res.Mut. : %s", + itosym1( wearing_amulet( AMU_RESIST_MUTATION, calc_unid) ) ); + snprintf(CUR_AD, "Res.Slow : %s", + itosym1( wearing_amulet( AMU_RESIST_SLOW, calc_unid) ) ); + snprintf(CUR_AD, "Clarity : %s", + itosym1( wearing_amulet( AMU_CLARITY, calc_unid) ) ); + lines++; + lines++; + + { + 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) + { + in_name( you.equip[ e_order[i] ], DESC_PLAIN, + str_pass, Options.terse_hand ); + snprintf(CUR_AD, "%-7s: %s", slot, str_pass); + } + else + { + if (e_order[i] == EQ_WEAPON) + { + if (you.attribute[ATTR_TRANSFORMATION] == TRAN_BLADE_HANDS) + snprintf(CUR_AD, "%-7s: Blade Hands", slot); + else if (you.skills[SK_UNARMED_COMBAT]) + snprintf(CUR_AD, "%-7s: Unarmed", slot); + else + snprintf(CUR_AD, "%-7s:", slot); + } + else + { + snprintf(CUR_AD, "%-7s:", slot); + } + } + } + } + + lines = 52; + snprintf(CUR_AD, "See Invis. : %s", + itosym1( player_see_invis(calc_unid) ) ); + snprintf(CUR_AD, "Warding : %s", + itosym1( wearing_amulet(AMU_WARDING, calc_unid) + || (you.religion == GOD_VEHUMET && + you.duration[DUR_PRAYER] && + !player_under_penance() && + you.piety >= 75) ) ); + snprintf(CUR_AD, "Conserve : %s", + itosym1( wearing_amulet( AMU_CONSERVATION, calc_unid) ) ); + snprintf(CUR_AD, "Res.Corr. : %s", + itosym1( wearing_amulet( AMU_RESIST_CORROSION, calc_unid) ) ); + + if ( !wearing_amulet( AMU_THE_GOURMAND, calc_unid) ) + { + switch (you.species) + { + case SP_GHOUL: + snprintf(CUR_AD, "Saprovore : %s", itosym3(3) ); + break; + + case SP_KOBOLD: + case SP_TROLL: + snprintf(CUR_AD, "Saprovore : %s", itosym3(2) ); + break; + + case SP_HILL_ORC: + case SP_OGRE: + snprintf(CUR_AD, "Saprovore : %s", itosym3(1) ); + break; +#ifdef V_FIX + case SP_OGRE_MAGE: + snprintf(CUR_AD, "Voracious : %s", itosym1(1) ); + break; +#endif + default: + snprintf(CUR_AD, "Gourmand : %s", itosym1(0) ); + break; + } + } + else + { + snprintf(CUR_AD, "Gourmand : %s", + itosym1( wearing_amulet( AMU_THE_GOURMAND, calc_unid) ) ); + } + + lines++; + + if ( scan_randarts(RAP_PREVENT_TELEPORTATION, calc_unid) ) + snprintf(CUR_AD, "Prev.Telep.: %s", + itosym1( scan_randarts(RAP_PREVENT_TELEPORTATION, calc_unid) ) ); + else + snprintf(CUR_AD, "Rnd.Telep. : %s", + itosym1( player_teleport(calc_unid) ) ); + snprintf(CUR_AD, "Ctrl.Telep.: %s", + itosym1( you.attribute[ATTR_CONTROL_TELEPORT] ) ); + snprintf(CUR_AD, "Levitation : %s", itosym1( player_is_levitating() ) ); + snprintf(CUR_AD, "Ctrl.Flight: %s", + itosym1( wearing_amulet(AMU_CONTROLLED_FLIGHT, calc_unid) ) ); + lines++; + + return; +} |