/* * Draw the skill tree */ void print_skills(s32b **table, s32b max, s32b sel, s32b start) { s32b i, j; s32b wid, hgt; cptr keys; Term_clear(); Term_get_size(&wid, &hgt); c_prt(TERM_WHITE, format("%s Skills Screen", game_module), 0, 28); keys = format("#BEnter#W to develop a branch, #Bup#W/#Bdown#W to move, #Bright#W/#Bleft#W to modify, #B?#W for help"); display_message(0, 1, strlen(keys), TERM_WHITE, keys); c_prt((p_ptr->skill_points) ? TERM_L_BLUE : TERM_L_RED, format("Skill points left: %d", p_ptr->skill_points), 2, 0); print_desc_aux(s_info[table[sel][0]].desc, 3, 0); for (j = start; j < start + (hgt - 7); j++) { byte color = TERM_WHITE; char deb = ' ', end = ' '; if (j >= max) break; i = table[j][0]; if (get_skill(i) == 0) { if (s_info[i].mod == 0) color = TERM_L_DARK; else color = TERM_ORANGE; } else if (get_skill_raw(i) == SKILL_MAX) color = TERM_L_BLUE; if (s_info[i].hidden) color = TERM_L_RED; if (j == sel) { color = TERM_L_GREEN; deb = '['; end = ']'; } if (!has_child(i)) { c_prt(color, format("%c.%c%s", deb, end, s_info[i].name), j + 7 - start, table[j][1] * 4); } else if (s_info[i].dev) { c_prt(color, format("%c-%c%s", deb, end, s_info[i].name), j + 7 - start, table[j][1] * 4); } else { c_prt(color, format("%c+%c%s", deb, end, s_info[i].name), j + 7 - start, table[j][1] * 4); } c_prt(color, format("%c%02ld.%03ld [%01d.%03d]", (get_skill_raw(i) < 0) ? '-' : ' ', abs(get_skill_raw(i)) / SKILL_STEP, abs(get_skill_raw(i)) % SKILL_STEP, s_info[i].mod / 1000, s_info[i].mod % 1000), j + 7 - start, 60); } }
/* * Draw the abilities list */ void print_abilities(s32b table[], s32b max, s32b sel, s32b start) { s32b i, j; s32b wid, hgt; cptr keys; Term_clear(); Term_get_size(&wid, &hgt); c_prt(TERM_WHITE, format("%s Abilities Screen", game_module), 0, 28); keys = format("#Bup#W/#Bdown#W to move, #Bright#W to buy, #B?#W for help"); display_message(0, 1, strlen(keys), TERM_WHITE, keys); c_prt((p_ptr->skill_points) ? TERM_L_BLUE : TERM_L_RED, format("Skill points left: %d", p_ptr->skill_points), 2, 0); print_desc_aux(ab_info[table[sel]].desc, 3, 0); for (j = start; j < start + (hgt - 7); j++) { byte color = TERM_WHITE; char deb = ' ', end = ' '; if (j >= max) break; i = table[j]; if (ab_info[i].acquired) color = TERM_L_BLUE; else if (can_learn_ability(i)) color = TERM_WHITE; else color = TERM_L_DARK; if (j == sel) { color = TERM_L_GREEN; deb = '['; end = ']'; } c_prt(color, format("%c.%c%s", deb, end, ab_info[i].name), j + 7 - start, 0); if (!ab_info[i].acquired) { c_prt(color, format("%d", ab_info[i].cost), j + 7 - start, 60); } else { c_prt(color, "Known", j + 7 - start, 60); } } }
static void dump_modules(int sel, int max) { int i; char buf[40], pre = ' ', post = ')'; cptr name; char ind; for (i = 0; i < max; i++) { ind = I2A(i % 26); if (i >= 26) ind = toupper(ind); if (sel == i) { pre = '['; post = ']'; } else { pre = ' '; post = ')'; } call_lua("get_module_name", "(d)", "s", i, &name); strnfmt(buf, 40, "%c%c%c %s", pre, ind, post, name); if (sel == i) { call_lua("get_module_desc", "(d)", "s", i, &name); print_desc_aux(name, 5, 0); c_put_str(TERM_L_BLUE, buf, 10 + (i / 4), 20 * (i % 4)); } else put_str(buf, 10 + (i / 4), 20 * (i % 4)); } }
/* * Draw the skill tree */ void print_skills(int table[MAX_SKILLS][2], int max, int sel, int start) { int i, j; int wid, hgt; cptr keys; Term_clear(); Term_get_size(&wid, &hgt); c_prt(TERM_WHITE, format("%s Skills Screen", game_module), 0, 28); keys = format("#BEnter#W to develop a branch, #Bup#W/#Bdown#W to move, #Bright#W/#Bleft#W to modify, #B?#W for help"); display_message(0, 1, strlen(keys), TERM_WHITE, keys); c_prt((p_ptr->skill_points) ? TERM_L_BLUE : TERM_L_RED, format("Skill points left: %d", p_ptr->skill_points), 2, 0); print_desc_aux(s_info[table[sel][0]].desc + s_text, 3, 0); for (j = start; j < start + (hgt - 7); j++) { byte color = TERM_WHITE; char deb = ' ', end = ' '; if (j >= max) break; i = table[j][0]; if ((s_info[i].value == 0) && (i != SKILL_MISC)) { if (s_info[i].mod == 0) color = TERM_L_DARK; else color = TERM_ORANGE; } else if (s_info[i].value == SKILL_MAX) color = TERM_L_BLUE; if (s_info[i].hidden) color = TERM_L_RED; if (j == sel) { color = TERM_L_GREEN; deb = '['; end = ']'; } if (!has_child(i)) { c_prt(color, format("%c.%c%s", deb, end, s_info[i].name + s_name), j + 7 - start, table[j][1] * 4); } else if (s_info[i].dev) { c_prt(color, format("%c-%c%s", deb, end, s_info[i].name + s_name), j + 7 - start, table[j][1] * 4); } else { c_prt(color, format("%c+%c%s", deb, end, s_info[i].name + s_name), j + 7 - start, table[j][1] * 4); } c_prt(color, format("%s%02ld.%03ld [%01d.%03d]", s_info[i].value < 0 ? "-" : " ", ABS(s_info[i].value) / SKILL_STEP, ABS(s_info[i].value) % SKILL_STEP, ABS(s_info[i].mod) / 1000, ABS(s_info[i].mod) % 1000), j + 7 - start, 60); } }
static void print_all(s32b **table, s32b max, s32b table_ab[], s32b max_ab, s32b sel, s32b start) { s32b i, j; s32b wid, hgt; cptr keys; Term_clear(); Term_get_size(&wid, &hgt); c_prt(TERM_WHITE, format("%s Skills and Abilities Screen", game_module), 0, 24); keys = format("#BEnter#W to develop a branch, #Bup#W/#Bdown#W to move, #Bright#W/#Bleft#W to modify, #B?#W for help"); display_message(0, 1, strlen(keys), TERM_WHITE, keys); c_prt((p_ptr->skill_points) ? TERM_L_BLUE : TERM_L_RED, format("Skill points left: %d", p_ptr->skill_points), 2, 0); if (sel == 0) { c_prt(TERM_YELLOW, "Skills represent your level of proficiency in the various fields of mastery", 3, 0); c_prt(TERM_YELLOW, "available to your character.", 4, 0); c_prt(TERM_YELLOW, format("Skills can naturally be raised to %ld.", SKILL_MAX / SKILL_STEP), 5, 0); } else if (sel == max) { c_prt(TERM_YELLOW, "Abilities are various traits your character may acquire. Contrary to skills", 3, 0); c_prt(TERM_YELLOW, "abilities are on/off toggles, you either now them or not, there is no level", 4, 0); c_prt(TERM_YELLOW, "involved.", 5, 0); } else if (sel < max) print_desc_aux(s_info[table[sel-1][0]].desc, 3, 0); else print_desc_aux(ab_info[table_ab[sel-1 - max]].desc, 3, 0); for (j = start; j < start + (hgt - 7); j++) { byte color = TERM_WHITE; char deb = ' ', end = ' '; if ((j == 0) && max) { deb = end = '-'; color = TERM_YELLOW; if (j == sel) { color = TERM_ORANGE; deb = '['; end = ']'; } c_prt(color, format("%c-%c---------------------------------------------------------------------- Skills", deb, end), j + 7 - start, 0); } else if ((j == max) && max_ab) { deb = end = '-'; color = TERM_YELLOW; if (j == sel) { color = TERM_ORANGE; deb = '['; end = ']'; } c_prt(color, format("%c-%c------------------------------------------------------------------- Abilities", deb, end), j + 7 - start, 0); } else if (j < max) { i = table[j-1][0]; if (get_skill(i) == 0) { if (s_info[i].mod == 0) color = TERM_L_DARK; else color = TERM_ORANGE; } else if (get_skill_raw(i) == SKILL_MAX) color = TERM_L_BLUE; if (s_info[i].hidden) color = TERM_L_RED; if (j == sel) { color = TERM_L_GREEN; deb = '['; end = ']'; } if (!has_child(i)) { c_prt(color, format("%c.%c%s", deb, end, s_info[i].name), j + 7 - start, table[j-1][1] * 4); } else if (s_info[i].dev) { c_prt(color, format("%c-%c%s", deb, end, s_info[i].name), j + 7 - start, table[j-1][1] * 4); } else { c_prt(color, format("%c+%c%s", deb, end, s_info[i].name), j + 7 - start, table[j-1][1] * 4); } c_prt(color, format("%c%02ld.%03ld [%01d.%03d]", (get_skill_raw(i) < 0) ? '-' : ' ', abs(get_skill_raw(i)) / SKILL_STEP, abs(get_skill_raw(i)) % SKILL_STEP, s_info[i].mod / 1000, s_info[i].mod % 1000), j + 7 - start, 60); } else { byte color = TERM_WHITE; char deb = ' ', end = ' '; if (j - max >= max_ab) break; i = table_ab[j-1 - max]; if (ab_info[i].acquired) color = TERM_L_BLUE; else if (can_learn_ability(i)) color = TERM_WHITE; else color = TERM_L_DARK; if (j == sel) { color = TERM_L_GREEN; deb = '['; end = ']'; } c_prt(color, format("%c.%c%s", deb, end, ab_info[i].name), j + 7 - start, 0); if (!ab_info[i].acquired) { c_prt(color, format("%d", ab_info[i].cost), j + 7 - start, 61); } else { c_prt(color, "Known", j + 7 - start, 61); } } } }