static void mon_summary(int gid, const int *object_list, int n, int top, int row, int col) { int i; int kills = 0; /* Access the race */ for (i = 0; i < n; i++) { int oid = default_join[object_list[i + top]].oid; kills += l_list[oid].pkills; } /* Different display for the first item if we've got uniques to show */ if (gid == 0 && (rf_has((&r_info[default_join[object_list[0]].oid])->flags, RF_UNIQUE))) { c_prt(TERM_L_BLUE, format("%d known uniques, %d slain.", n, kills), row, col); } else { int tkills = 0; for (i = 0; i < z_info->r_max; i++) tkills += l_list[i].pkills; c_prt(TERM_L_BLUE, format("Creatures slain: %d/%d (in group/in total)", kills, tkills), row, col); } }
/* * 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); } } }
/* * Display a monster */ static void display_monster(int col, int row, bool cursor, int oid) { /* HACK Get the race index. (Should be a wrapper function) */ int r_idx = default_join[oid].oid; /* Access the race */ monster_race *r_ptr = &r_info[r_idx]; monster_lore *l_ptr = &l_list[r_idx]; /* Choose colors */ byte attr = curs_attrs[CURS_KNOWN][(int) cursor]; byte a = r_ptr->x_attr; byte c = r_ptr->x_char; /* Display the name */ c_prt(attr, r_ptr->name, row, col); if ((tile_width > 1) || (tile_height > 1)) return; /* Display symbol */ big_pad(66, row, a, c); /* Display kills */ if (rf_has(r_ptr->flags, RF_UNIQUE)) put_str(format("%s", (r_ptr->max_num == 0) ? " dead" : "alive"), row, 70); else put_str(format("%5d", l_ptr->pkills), row, 70); }
/* * Display the features in a group. */ static void display_feature(int col, int row, bool cursor, int oid) { /* Get the feature index */ int f_idx = oid; /* Access the feature */ feature_type *f_ptr = &f_info[f_idx]; /* Choose a color */ byte attr = curs_attrs[CURS_KNOWN][(int) cursor]; /* Display the name */ c_prt(attr, f_ptr->name, row, col); if (tile_height == 1) { /* Display symbols */ col = 65; col += big_pad(col, row, f_ptr->x_attr[FEAT_LIGHTING_DARK], f_ptr->x_char[FEAT_LIGHTING_DARK]); col += big_pad(col, row, f_ptr->x_attr[FEAT_LIGHTING_LIT], f_ptr->x_char[FEAT_LIGHTING_LIT]); col += big_pad(col, row, f_ptr->x_attr[FEAT_LIGHTING_TORCH], f_ptr->x_char[FEAT_LIGHTING_TORCH]); col += big_pad(col, row, f_ptr->x_attr[FEAT_LIGHTING_LOS], f_ptr->x_char[FEAT_LIGHTING_LOS]); } }
void textui_textblock_place(textblock *tb, region orig_area, const char *header) { const char *text = textblock_text(tb); const byte *attrs = textblock_attrs(tb); /* xxx on resize this should be recalculated */ region area = region_calculate(orig_area); size_t *line_starts = NULL, *line_lengths = NULL; size_t n_lines; n_lines = textblock_calculate_lines(tb, &line_starts, &line_lengths, area.width); area.page_rows--; if (n_lines > (size_t) area.page_rows) n_lines = area.page_rows; c_prt(TERM_L_BLUE, header, area.row, area.col); area.row++; display_area(text, attrs, line_starts, line_lengths, n_lines, area, 0); mem_free(line_starts); mem_free(line_lengths); }
static void wiz_create_item_display(menu_type *m, int oid, bool cursor, int row, int col, int width) { char buf[80]; object_base_name(buf, sizeof buf, oid, TRUE); c_prt(curs_attrs[CURS_KNOWN][0 != cursor], buf, row, col); }
static void spoil_spells_by_realm(void) { int i, row, col, realm_idx; while (1) { Term_clear(); prt("Realm Spoilers", 2, 0); /* Realms */ row = 4; col = 2; c_prt(TERM_RED, "Realms", row++, col - 2); for (realm_idx = REALM_LIFE; realm_idx <= MAX_MAGIC; realm_idx++) { prt(format("(%c) %s", 'a' + realm_idx - 1, realm_names[realm_idx]), row++, col); } i = inkey(); if (i == ESCAPE) break; realm_idx = i - 'a' + 1; if (REALM_LIFE <= realm_idx && realm_idx <= MAX_MAGIC) _spoil_spells_by_realm_aux1(realm_idx); } }
static void _spoil_spells_by_realm_aux2(int realm_idx, int class1_idx) { int i, row, col, class_idx, choice; vec_ptr vec = vec_alloc(NULL); for (class_idx = 0; class_idx < MAX_CLASS; class_idx++) { if (_check_realm(class_idx, realm_idx)) vec_add_int(vec, class_idx); } vec_sort(vec, (vec_cmp_f)_cmp_class_name); while (1) { Term_clear(); c_prt(TERM_L_BLUE, format("%s", realm_names[realm_idx]), 2, 0); c_prt(TERM_L_BLUE, format("First Class: %s", get_class_aux(class1_idx, 0)->name), 3, 0); /* Classes */ row = 4; col = 2; c_prt(TERM_RED, "Second Class", row++, col - 2); for (i = 0; i < vec_length(vec); i++) { int class_idx = vec_get_int(vec, i); class_t *class_ptr = get_class_aux(class_idx, 0); prt(format("(%c) %s", 'a' + i, class_ptr->name), row++, col); } i = inkey(); if (i == ESCAPE) break; choice = i - 'a'; if (0 <= choice && choice < vec_length(vec)) { class_idx = vec_get_int(vec, choice); _spoil_spells_by_realm_aux3(realm_idx, class1_idx, class_idx); } } vec_free(vec); }
void wiz_create_item_subdisplay(menu_type * m, int oid, bool cursor, int row, int col, int width) { int *choices = menu_priv(m); char buf[80]; /* Artifacts */ if (choose_artifact) { get_art_name(buf, choices[oid]); c_prt(curs_attrs[CURS_KNOWN][0 != cursor], buf, row, col); } /* Regular objects */ else { object_kind_name(buf, sizeof buf, choices[oid], TRUE); c_prt(curs_attrs[CURS_KNOWN][0 != cursor], buf, row, col); } }
/** Object kind selection */ void wiz_create_item_subdisplay(menu_type *m, int oid, bool cursor, int row, int col, int width) { object_kind **choices = menu_priv(m); char buf[80]; object_kind_name(buf, sizeof buf, choices[oid], TRUE); c_prt(curs_attrs[CURS_KNOWN][0 != cursor], buf, row, col); }
/** * Displays an option entry. */ static void option_toggle_display(struct menu *m, int oid, bool cursor, int row, int col, int width) { byte attr = curs_attrs[CURS_KNOWN][cursor != 0]; bool *options = menu_priv(m); c_prt(attr, format("%-45s: %s (%s)", option_desc(oid), options[oid] ? "yes" : "no ", option_name(oid)), row, col); }
/* * Display an artifact label */ static void display_artifact(int col, int row, bool cursor, int oid) { byte attr = curs_attrs[CURS_KNOWN][(int) cursor]; char o_name[80]; get_artifact_display_name(o_name, sizeof o_name, oid); c_prt(attr, o_name, row, col); }
/** * Display an entry on the jump menu */ void jump_display(menu_type *menu, int oid, bool cursor, int row, int col, int width) { const u16b *choice = menu_priv(menu); byte attr = (cursor ? TERM_L_BLUE : TERM_WHITE); c_prt(attr, locality_name[stage_map[choice[oid]][LOCALITY]], row, col); }
static void display_ego_item(int col, int row, bool cursor, int oid) { /* HACK: Access the object */ ego_item_type *e_ptr = &e_info[default_join[oid].oid]; /* Choose a color */ byte attr = curs_attrs[0 != (int) e_ptr->everseen][0 != (int) cursor]; /* Display the name */ c_prt(attr, e_ptr->name, row, col); }
static void display_options_item(struct menu *menu, int oid, bool cursor, int row, int col, int width) { size_t line = (size_t) oid; /* Most of the menu is svals, with a small "extra options" section below */ if (line < N_ELEMENTS(sval_dependent)) { bool known = seen_tval(sval_dependent[line].tval); byte attr = curs_attrs[known ? CURS_KNOWN: CURS_UNKNOWN][(int)cursor]; c_prt(attr, sval_dependent[line].desc, row, col); } else { byte attr = curs_attrs[CURS_KNOWN][(int)cursor]; line = line - N_ELEMENTS(sval_dependent) - 1; if (line < N_ELEMENTS(extra_item_options)) c_prt(attr, extra_item_options[line].name, row, col); } }
/* * 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); } }
static void _list(menu_ptr menu, char *keys) { char temp[255]; int i; int y = 1; int x = 13; Term_erase(x, y, 255); if (menu->heading) put_str(format(" %s", menu->heading), y++, x); for (i = 0; i < menu->count; i++) { byte attr = TERM_WHITE; variant key, text, color; var_init(&key); var_init(&text); var_init(&color); menu->fn(MENU_KEY, i, menu->cookie, &key); if (var_is_null(&key)) keys[i] = I2A(i); else keys[i] = (char)var_get_int(&key); if (menu->count <= 26) keys[i] = tolower(keys[i]); menu->fn(MENU_TEXT, i, menu->cookie, &text); if (var_is_null(&text)) var_set_string(&text, ""); menu->fn(MENU_COLOR, i, menu->cookie, &color); if (!var_is_null(&color)) attr = var_get_int(&color); if (attr == TERM_DARK) keys[i] = '\0'; sprintf(temp, " %c) %s", keys[i], var_get_string(&text)); c_prt(attr, temp, y + i, x); var_clear(&key); var_clear(&text); var_clear(&color); } Term_erase(x, y + menu->count, 255); }
static void display_options_item(menu_type *menu, int oid, bool cursor, int row, int col, int width) { size_t line = (size_t) oid; /* First section of menu - the svals */ if (line < N_ELEMENTS(sval_dependent)) { bool known = seen_tval(sval_dependent[line].tval); byte attr = curs_attrs[known ? CURS_KNOWN: CURS_UNKNOWN][(int)cursor]; c_prt(attr, sval_dependent[line].desc, row, col); } /* Second section - the "extra options" */ else { byte attr = curs_attrs[CURS_KNOWN][(int)cursor]; line = line - N_ELEMENTS(sval_dependent) - 1; if (line < N_ELEMENTS(extra_item_options)) c_prt(attr, extra_item_options[line].name, row, col); } }
/* * Display the objects in a group. */ static void display_object(int col, int row, bool cursor, int oid) { int k_idx = oid; object_kind *k_ptr = &k_info[k_idx]; const char *inscrip = get_autoinscription(oid); char o_name[80]; /* Choose a color */ bool aware = (!k_ptr->flavor || k_ptr->aware); byte attr = curs_attrs[(int) aware][(int) cursor]; /* Find graphics bits -- versions of the object_char and object_attr * defines */ bool use_flavour = (k_ptr->flavor) && !(aware && k_ptr->tval == TV_SCROLL); byte a = use_flavour ? flavor_info[k_ptr->flavor].x_attr : k_ptr->x_attr; byte c = use_flavour ? flavor_info[k_ptr->flavor].x_char : k_ptr->x_char; /* Display known artifacts differently */ if (kf_has(k_ptr->flags_kind, KF_INSTA_ART) && artifact_is_known(get_artifact_from_kind(k_ptr))) { get_artifact_display_name(o_name, sizeof(o_name), get_artifact_from_kind(k_ptr)); } else { object_kind_name(o_name, sizeof(o_name), k_idx, OPT(cheat_know)); } /* If the type is "tried", display that */ if (k_ptr->tried && !aware) my_strcat(o_name, " {tried}", sizeof(o_name)); /* Display the name */ c_prt(attr, o_name, row, col); /* Show autoinscription if around */ if (aware && inscrip) c_put_str(TERM_YELLOW, inscrip, row, 55); /* Hack - don't use if double tile */ if ((tile_width > 1) || (tile_height > 1)) return; /* Display symbol */ big_pad(76, row, a, c); }
/* * Display the features in a group. */ static void display_feature(int col, int row, bool cursor, int oid ) { feature_type *f_ptr = &f_info[oid]; byte attr = curs_attrs[CURS_KNOWN][(int)cursor]; c_prt(attr, f_ptr->name, row, col); if (tile_height == 1) { /* Display symbols */ col = 66; col += big_pad(col, row, f_ptr->x_attr[FEAT_LIGHTING_DARK], f_ptr->x_char[FEAT_LIGHTING_DARK]); col += big_pad(col, row, f_ptr->x_attr[FEAT_LIGHTING_LIT], f_ptr->x_char[FEAT_LIGHTING_LIT]); col += big_pad(col, row, f_ptr->x_attr[FEAT_LIGHTING_BRIGHT], f_ptr->x_char[FEAT_LIGHTING_BRIGHT]); } }
/* * Display the objects in a group. */ static void display_object(int col, int row, bool cursor, int oid) { object_kind *kind = &k_info[oid]; const char *inscrip = get_autoinscription(kind); char o_name[80]; /* Choose a color */ bool aware = (!kind->flavor || kind->aware); byte attr = curs_attrs[(int)aware][(int)cursor]; /* Find graphics bits -- versions of the object_char and object_attr defines */ bool use_flavour = (kind->flavor) && !(aware && kind->tval == TV_SCROLL); byte a = use_flavour ? kind->flavor->x_attr : kind->x_attr; byte c = use_flavour ? kind->flavor->x_char : kind->x_char; /* Display known artifacts differently */ if (of_has(kind->flags, OF_INSTA_ART) && artifact_is_known(get_artifact_from_kind(kind))) get_artifact_display_name(o_name, sizeof(o_name), get_artifact_from_kind(kind)); else object_kind_name(o_name, sizeof(o_name), kind, OPT(cheat_know)); /* If the type is "tried", display that */ if (kind->tried && !aware) my_strcat(o_name, " {tried}", sizeof(o_name)); /* Display the name */ c_prt(attr, o_name, row, col); /* Show squelch status */ if ((aware && kind_is_squelched_aware(kind)) || (!aware && kind_is_squelched_unaware(kind))) c_put_str(attr, "Yes", row, 46); /* Show autoinscription if around */ if (aware && inscrip) c_put_str(TERM_YELLOW, inscrip, row, 55); if (tile_height == 1) { big_pad(76, row, a, c); } }
/** * Display a row of the spell menu */ static void spell_menu_display(struct menu *m, int oid, bool cursor, int row, int col, int wid) { struct spell_menu_data *d = menu_priv(m); int spell_index = d->spells[oid]; const struct class_spell *spell = spell_by_index(spell_index); char help[30]; char out[80]; int attr; const char *illegible = NULL; const char *comment = NULL; if (spell->slevel >= 99) { illegible = "(illegible)"; attr = COLOUR_L_DARK; } else if (player->spell_flags[spell_index] & PY_SPELL_FORGOTTEN) { comment = " forgotten"; attr = COLOUR_YELLOW; } else if (player->spell_flags[spell_index] & PY_SPELL_LEARNED) { if (player->spell_flags[spell_index] & PY_SPELL_WORKED) { /* Get extra info */ get_spell_info(spell_index, help, sizeof(help)); comment = help; attr = COLOUR_WHITE; } else { comment = " untried"; attr = COLOUR_L_GREEN; } } else if (spell->slevel <= player->lev) { comment = " unknown"; attr = COLOUR_L_BLUE; } else { comment = " difficult"; attr = COLOUR_RED; } /* Dump the spell --(-- */ strnfmt(out, sizeof(out), "%-30s%2d %4d %3d%%%s", spell->name, spell->slevel, spell->smana, spell_chance(spell_index), comment); c_prt(attr, illegible ? illegible : out, row, col); }
/* * Display a monster */ static void display_monster(int col, int row, bool cursor, int oid) { /* HACK Get the race index. (Should be a wrapper function) */ int r_idx = default_join[oid].oid; /* Access the race */ monster_race *r_ptr = &r_info[r_idx]; monster_lore *l_ptr = &l_list[r_idx]; /* Choose colors */ byte attr = curs_attrs[CURS_KNOWN][(int) cursor]; byte a = r_ptr->x_attr; wchar_t c = r_ptr->x_char; if ((tile_height != 1) && (a & 0x80)) { a = r_ptr->d_attr; c = r_ptr->d_char; } /* Display the name */ c_prt(attr, r_ptr->name, row, col); /* Monster recall window */ if (cursor) { character_icky--; character_icky--; p_ptr->monster_race_idx = r_idx; p_ptr->redraw |= PR_MONSTER; handle_stuff(p_ptr); character_icky++; character_icky++; } /* Display symbol */ big_pad(66, row, a, c); /* Display kills */ if (rf_has(r_ptr->flags, RF_UNIQUE)) put_str(format("%s", (r_ptr->max_num == 0) ? " dead" : "alive"), row, 70); else put_str(format("%5d", l_ptr->pkills), row, 70); }
static void gf_display(menu_type *m, int type, bool cursor, int row, int col, int wid) { size_t i; byte attr = curs_attrs[CURS_KNOWN][(int)cursor]; const char *gf_name = gf_idx_to_name(type); if (type % 2) c_prt(attr, ".........................", row, col); c_put_str(attr, gf_name, row, col); col += 25; if (tile_height == 1) { for (i = 0; i < BOLT_MAX; i++) { col += big_pad(col, row, gf_to_attr[type][i], gf_to_char[type][i]); } } else { prt("Change tile_height to 1 to see graphics.", row, col); } }
/* * Display the features in a group. */ static void display_feature(int col, int row, bool cursor, int oid) { /* Get the feature index */ int f_idx = oid; /* Access the feature */ feature_type *f_ptr = &f_info[f_idx]; /* Choose a color */ byte attr = curs_attrs[CURS_KNOWN][(int) cursor]; /* Display the name */ c_prt(attr, f_ptr->name, row, col); if ((tile_width > 1) || (tile_height > 1)) return; /* Display symbol */ big_pad(68, row, f_ptr->x_attr, f_ptr->x_char); /* ILLUMINATION AND DARKNESS GO HERE */ }
/* * Display a monster */ static void display_monster(int col, int row, bool cursor, int oid) { /* HACK Get the race index. (Should be a wrapper function) */ int r_idx = default_join[oid].oid; /* Access the race */ monster_race *r_ptr = &r_info[r_idx]; monster_lore *l_ptr = &l_list[r_idx]; /* Choose colors */ byte attr = curs_attrs[CURS_KNOWN][(int)cursor]; byte a = r_ptr->x_attr; byte c = r_ptr->x_char; if ((tile_height != 1) && (a & 0x80)) { a = r_ptr->d_attr; c = r_ptr->d_char; /* If uniques are purple, make it so */ if (OPT(purple_uniques) && rf_has(r_ptr->flags, RF_UNIQUE)) a = TERM_VIOLET; } /* If uniques are purple, make it so */ else if (OPT(purple_uniques) && !(a & 0x80) && rf_has(r_ptr->flags, RF_UNIQUE)) a = TERM_VIOLET; /* Display the name */ c_prt(attr, r_ptr->name, row, col); /* Display symbol */ big_pad(66, row, a, c); /* Display kills */ if (rf_has(r_ptr->flags, RF_UNIQUE)) put_str(format("%s", (r_ptr->max_num == 0)? " dead" : "alive"), row, 70); else put_str(format("%5d", l_ptr->pkills), row, 70); }
/* * As above, but in "white" */ void prt(const char *str, int row, int col) { /* Spawn */ c_prt(TERM_WHITE, str, row, col); }
static void _list_forms(int ct) { char temp[140]; int i; int y = 1; int x = 10; int col_height = _col_height(ct); int col_width; Term_erase(x, y, 255); if (col_height == ct) { Term_erase(x, y, 255); put_str("Lv Cost Fail", y, x + 29); } else { col_width = 42; x = 1; Term_erase(x, y, 255); put_str("Lv Cost Fail", y, x + 29); put_str("Lv Cost Fail", y, x + col_width + 29); } for (i = 0; i < ct; i++) { char letter = '\0'; byte attr = TERM_WHITE; int level = _forms[i].level; int race_idx = _forms[i].race; race_t *race_ptr = get_race_t_aux(race_idx, 0); int cost = _form_cost(race_ptr->exp); int fail = calculate_fail_rate(level, _forms[i].fail, p_ptr->stat_ind[A_DEX]); if (i < 26) letter = I2A(i); else if (i < 52) letter = 'A' + i - 26; else letter = '0' + i - 52; sprintf(temp, " %c) ", letter); strcat(temp, format("%-23.23s %2d %4d %3d%%", race_ptr->name, level, cost, fail)); if (fail == 100) attr = TERM_L_DARK; if (i < col_height) { c_prt(attr, temp, y + i + 1, x); } else { c_prt(attr, temp, y + (i - col_height) + 1, (x + col_width)); } } }
void textui_textblock_show(textblock *tb, region orig_area, const char *header) { const char *text = textblock_text(tb); const byte *attrs = textblock_attrs(tb); /* xxx on resize this should be recalculated */ region area = region_calculate(orig_area); size_t *line_starts = NULL, *line_lengths = NULL; size_t n_lines; n_lines = textblock_calculate_lines(tb, &line_starts, &line_lengths, area.width); screen_save(); /* make room for the header & footer */ area.page_rows -= 3; c_prt(TERM_L_BLUE, header, area.row, area.col); area.row++; if (n_lines > (size_t) area.page_rows) { int start_line = 0; c_prt(TERM_WHITE, "", area.row + area.page_rows, area.col); c_prt(TERM_L_BLUE, "(Up/down or ESCAPE to exit.)", area.row + area.page_rows + 1, area.col); /* Pager mode */ while (1) { struct keypress ch; display_area(text, attrs, line_starts, line_lengths, n_lines, area, start_line); ch = inkey(); if (ch.code == ARROW_UP) start_line--; else if (ch.code== ESCAPE || ch.code == 'q') break; else if (ch.code == ARROW_DOWN) start_line++; else if (ch.code == ' ') start_line += area.page_rows; if (start_line < 0) start_line = 0; if (start_line + (size_t) area.page_rows > n_lines) start_line = n_lines - area.page_rows; } } else { display_area(text, attrs, line_starts, line_lengths, n_lines, area, 0); c_prt(TERM_WHITE, "", area.row + n_lines, area.col); c_prt(TERM_L_BLUE, "(Press any key to continue.)", area.row + n_lines + 1, area.col); inkey(); } mem_free(line_starts); mem_free(line_lengths); screen_load(); return; }
/** * As above, but in white */ void prt(const char *str, int row, int col) { c_prt(COLOUR_WHITE, str, row, col); }