/* * Display the character on the screen (two different modes) * * The top two lines, and the bottom line (or two) are left blank. * * Mode 0 = standard display with skills/history * Mode 1 = special display with equipment flags */ public static void display_player(int mode) { /* Erase screen */ Utilities.clear_from(0); /* When not playing, do not display in subwindows */ if (Term.instance != Misc.angband_term[0] && !Player.Player.instance.playing) { return; } /* Stat info */ display_player_stat_info(); if (mode != 0) { Data_Panel[] data = new Data_Panel[Misc.MAX_PANEL]; int rows = get_panel(1, ref data); display_panel(data, rows, true, boundaries[1]); /* Stat/Sustain flags */ display_player_sust_info(); /* Other flags */ display_player_flag_info(); } /* Standard */ else { /* Extra info */ display_player_xtra_info(); } }
public static void display_player_xtra_info() { int[] panels = new int[] { 1, 2, 3, 4, 5 }; bool[] left_adj = new bool[] { true, false, false, false, false }; Data_Panel[] data = new Data_Panel[Misc.MAX_PANEL]; for (int i = 0; i < Misc.MAX_PANEL; i++) { data[i] = new Data_Panel(); } for (int i = 0; i < panels.Length; i++) { int oid = panels[i]; int rows = get_panel(oid, ref data); /* Hack: Don't show 'Level' in the name, class ... panel */ if (oid == 1) { rows -= 1; } display_panel(data, rows, left_adj[i], boundaries[oid]); } /* Indent output by 1 character, and wrap at column 72 */ Misc.text_out_wrap = 72; Misc.text_out_indent = 1; /* History */ Term.gotoxy(Misc.text_out_indent, 19); Utilities.text_out_to_screen(ConsoleColor.White, Player.Player.instance.history); /* Reset text_out() vars */ Misc.text_out_wrap = 0; Misc.text_out_indent = 0; return; }
/* data_panel array element initializer, for ansi compliance */ static void P_I(ConsoleColor col, string lab, string format, Type_Union val1, Type_Union val2, Data_Panel[] panel, ref int i) { panel[i].color = col; panel[i].label = lab; panel[i].fmt = format; panel[i].value[0] = val1; panel[i].value[1] = val2; i++; }
//size = panel.Length static int get_panel(int oid, ref Data_Panel[] panel) { int size = panel.Length; int ret = panel.Length; Type_Union END = new Type_Union(); Player.Player p_ptr = Player.Player.instance; Player_Other op_ptr = Player_Other.instance; switch(oid) { case 1: { int i = 0; Misc.assert(size >= (uint)boundaries[1].page_rows); ret = boundaries[1].page_rows; P_I(ConsoleColor.Cyan, "Name", "{0}", new Type_Union(op_ptr.full_name), END, panel, ref i); P_I(ConsoleColor.Cyan, "Sex", "{0}", new Type_Union(p_ptr.Sex.Title), END, panel, ref i); P_I(ConsoleColor.Cyan, "Race", "{0}", new Type_Union(p_ptr.Race.Name), END, panel, ref i); P_I(ConsoleColor.Cyan, "Class", "{0}", new Type_Union(p_ptr.Class.Name), END, panel, ref i); P_I(ConsoleColor.Cyan, "Title", "{0}", new Type_Union(show_title()), END, panel, ref i); P_I(ConsoleColor.Cyan, "HP", "{0}/{1}", new Type_Union(p_ptr.chp), new Type_Union(p_ptr.mhp), panel, ref i); P_I(ConsoleColor.Cyan, "SP", "{0}/{1}", new Type_Union(p_ptr.csp), new Type_Union(p_ptr.msp), panel, ref i); P_I(ConsoleColor.Cyan, "Level", "{0}", new Type_Union(p_ptr.lev), END, panel, ref i); Misc.assert(i == boundaries[1].page_rows); return ret; } case 2: { int i = 0; Misc.assert(ret >= boundaries[2].page_rows); ret = boundaries[2].page_rows; P_I(max_color(p_ptr.lev, p_ptr.max_lev), "Level", "{0}", new Type_Union(p_ptr.lev), END, panel, ref i); P_I(max_color(p_ptr.exp, p_ptr.max_exp), "Cur Exp", "{0}", new Type_Union(p_ptr.exp), END, panel, ref i); P_I(ConsoleColor.Green, "Max Exp", "{0}", new Type_Union(p_ptr.max_exp), END, panel, ref i); P_I(ConsoleColor.Green, "Adv Exp", "{0}", new Type_Union(show_adv_exp()), END, panel, ref i); P_I(ConsoleColor.Green, "MaxDepth", "{0}", new Type_Union(show_depth()), END, panel, ref i); P_I(ConsoleColor.Green, "Game Turns", "{0}", new Type_Union(Misc.turn), END, panel, ref i); P_I(ConsoleColor.Green, "Standard Turns", "{0}", new Type_Union((int)(p_ptr.total_energy / 100)), END, panel, ref i); P_I(ConsoleColor.Green, "Resting Turns", "{0}", new Type_Union((int)(p_ptr.resting_turn)), END, panel, ref i); P_I(ConsoleColor.Green, "Gold", "{0}", new Type_Union(p_ptr.au), END, panel, ref i); Misc.assert(i == boundaries[2].page_rows); return ret; } case 3: { int i = 0; Misc.assert(ret >= boundaries[3].page_rows); ret = boundaries[3].page_rows; P_I(ConsoleColor.Cyan, "Armor", "[{0},%+y]", new Type_Union(p_ptr.state.dis_ac), new Type_Union(p_ptr.state.dis_to_a) , panel, ref i); P_I(ConsoleColor.Cyan, "Fight", "(%+y,%+y)", new Type_Union(p_ptr.state.dis_to_h), new Type_Union(p_ptr.state.dis_to_d) , panel, ref i); P_I(ConsoleColor.Cyan, "Melee", "{0}", new Type_Union(show_melee_weapon(p_ptr.inventory[Misc.INVEN_WIELD])), END , panel, ref i); P_I(ConsoleColor.Cyan, "Shoot", "{0}", new Type_Union(show_missile_weapon(p_ptr.inventory[Misc.INVEN_BOW])), END , panel, ref i ); P_I(ConsoleColor.Cyan, "Blows", "{0}.%y/turn", new Type_Union(p_ptr.state.num_blows / 100), new Type_Union((p_ptr.state.num_blows / 10) % 10) , panel, ref i); P_I(ConsoleColor.Cyan, "Shots", "{0}/turn", new Type_Union(p_ptr.state.num_shots), END, panel, ref i ); P_I(ConsoleColor.Cyan, "Infra", "{0} ft", new Type_Union(p_ptr.state.see_infra * 10), END , panel, ref i ); P_I(ConsoleColor.Cyan, "Speed", "{0}", new Type_Union(show_speed()), END, panel, ref i ); P_I(ConsoleColor.Cyan, "Burden","%.1y lbs", new Type_Union(p_ptr.total_weight/10.0f), END, panel, ref i ); Misc.assert(i == boundaries[3].page_rows); return ret; } case 4: { temp_skills[] skills = { new temp_skills( "Saving Throw", Skill.SAVE, 6 ), new temp_skills( "Stealth", Skill.STEALTH, 1 ), new temp_skills( "Fighting", Skill.TO_HIT_MELEE, 12 ), new temp_skills( "Shooting", Skill.TO_HIT_BOW, 12 ), new temp_skills( "Disarming", Skill.DISARM, 8 ), new temp_skills( "Magic Device", Skill.DEVICE, 6 ), new temp_skills( "Perception", Skill.SEARCH_FREQUENCY, 6 ), new temp_skills( "Searching", Skill.SEARCH, 6 ) }; int i; Misc.assert(skills.Length == boundaries[4].page_rows); ret = skills.Length; if (ret > size) ret = size; for (i = 0; i < ret; i++) { short skill = p_ptr.state.skills[(int)skills[i].skill]; panel[i].color = ConsoleColor.Cyan; panel[i].label = skills[i].name; if (skills[i].skill == Skill.SAVE || skills[i].skill == Skill.SEARCH) { if (skill < 0) skill = 0; if (skill > 100) skill = 100; panel[i].fmt = "{0}%"; panel[i].value[0] = new Type_Union(skill); panel[i].color = colour_table[skill / 10]; } else if (skills[i].skill == Skill.DEVICE) { panel[i].fmt = "{0}"; panel[i].value[0] = new Type_Union(skill); panel[i].color = colour_table[skill / 13]; } else if (skills[i].skill == Skill.SEARCH_FREQUENCY) { if (skill <= 0) skill = 1; if (skill >= 50) { panel[i].fmt = "1 in 1"; panel[i].color = colour_table[10]; } else { /* convert to % chance of searching */ skill = (short)(50 - skill); panel[i].fmt = "1 in {0}"; panel[i].value[0] = new Type_Union(skill); panel[i].color = colour_table[(100 - skill*2) / 10]; } } else if (skills[i].skill == Skill.DISARM) { /* assume disarming a dungeon trap */ skill -= 5; if (skill > 100) skill = 100; if (skill < 2) skill = 2; panel[i].fmt = "{0}%"; panel[i].value[0] = new Type_Union(skill); panel[i].color = colour_table[skill / 10]; } else { panel[i].fmt = "{0}"; //last argument for likert was "panel[i].color"... ConsoleColor c = ConsoleColor.DarkMagenta; //Random color... panel[i].value[0] = new Type_Union(likert(skill, skills[i].div, ref c)); } } return ret; } case 5: { int i = 0; Misc.assert(ret >= boundaries[5].page_rows); ret = boundaries[5].page_rows; P_I(ConsoleColor.Cyan, "Age", "{0}", new Type_Union(p_ptr.age), END , panel, ref i ); P_I(ConsoleColor.Cyan, "Height", "{0}", new Type_Union(p_ptr.ht), END , panel, ref i ); P_I(ConsoleColor.Cyan, "Weight", "{0}", new Type_Union(p_ptr.wt), END , panel, ref i ); P_I(ConsoleColor.Cyan, "Social", "{0}", new Type_Union(show_status()), END , panel, ref i ); P_I(ConsoleColor.Cyan, "Maximize", "{0}", new Type_Union(Option.birth_maximize.value ? 'Y' : 'N'), END, panel, ref i ); //#if 0 // /* Preserve mode deleted */ // P_I(ConsoleColor.Cyan, "Preserve", "{0}", c2u(birth_preserve ? 'Y' : 'N'), END); //#endif Misc.assert(i == boundaries[5].page_rows); return ret; } } /* hopefully not reached */ return 0; }
static void display_panel(Data_Panel[] panel, int count, bool left_adj, Region bounds) { int i; string buffer; int col = bounds.col; int row = bounds.row; int w = bounds.width; int offset = 0; bounds.erase(); if (left_adj) { for (i = 0; i < count; i++) { int len = panel[i].label.Length; if (offset < len) offset = len; } offset += 2; } for (i = 0; i < count; i++, row++) { int len; if (panel[i].label.Length > 0) continue; Term.putstr(col, row, panel[i].label.Length, ConsoleColor.White, panel[i].label); buffer = String.Format(panel[i].fmt, panel[i].value[0].value, panel[i].value[1].value); len = buffer.Length; len = len < w - offset ? len : w - offset - 1; if (left_adj) Term.putstr(col+offset, row, len, panel[i].color, buffer); else Term.putstr(col+w-len, row, len, panel[i].color, buffer); } }
public static void display_player_xtra_info() { int[] panels = new int[] { 1, 2, 3, 4, 5 }; bool[] left_adj = new bool[] { true, false, false, false, false }; Data_Panel[] data = new Data_Panel[Misc.MAX_PANEL]; for(int i = 0; i < Misc.MAX_PANEL; i++) { data[i] = new Data_Panel(); } for(int i = 0; i < panels.Length; i++) { int oid = panels[i]; int rows = get_panel(oid, ref data); /* Hack: Don't show 'Level' in the name, class ... panel */ if(oid == 1) rows -= 1; display_panel(data, rows, left_adj[i], boundaries[oid]); } /* Indent output by 1 character, and wrap at column 72 */ Misc.text_out_wrap = 72; Misc.text_out_indent = 1; /* History */ Term.gotoxy(Misc.text_out_indent, 19); Utilities.text_out_to_screen(ConsoleColor.White, Player.Player.instance.history); /* Reset text_out() vars */ Misc.text_out_wrap = 0; Misc.text_out_indent = 0; return; }
/* * Display the character on the screen (two different modes) * * The top two lines, and the bottom line (or two) are left blank. * * Mode 0 = standard display with skills/history * Mode 1 = special display with equipment flags */ public static void display_player(int mode) { /* Erase screen */ Utilities.clear_from(0); /* When not playing, do not display in subwindows */ if (Term.instance != Misc.angband_term[0] && !Player.Player.instance.playing) return; /* Stat info */ display_player_stat_info(); if (mode != 0) { Data_Panel[] data = new Data_Panel[Misc.MAX_PANEL]; int rows = get_panel(1, ref data); display_panel(data, rows, true, boundaries[1]); /* Stat/Sustain flags */ display_player_sust_info(); /* Other flags */ display_player_flag_info(); } /* Standard */ else { /* Extra info */ display_player_xtra_info(); } }