static void class_help(int i, void *db, const region *l) { int j; size_t k; struct player_class *c = player_id2class(i); int len = (A_MAX + 1) / 2; int n_flags = 0; int flag_space = 5; if (!c) return; /* Output to the screen */ text_out_hook = text_out_to_screen; /* Indent output */ text_out_indent = CLASS_AUX_COL; Term_gotoxy(CLASS_AUX_COL, TABLE_ROW); for (j = 0; j < len; j++) { const char *name1 = stat_names_reduced[j]; const char *name2 = stat_names_reduced[j + len]; int adj1 = c->c_adj[j]; int adj2 = c->c_adj[j + len]; text_out_e("%s%+3d %s%+3d\n", name1, adj1, name2, adj2); } text_out_e("\n"); skill_help(c->c_skills, c->c_mhp, c->c_exp, -1); if (c->spell_book == TV_MAGIC_BOOK) { text_out_e("\nLearns arcane magic"); } else if (c->spell_book == TV_PRAYER_BOOK) { text_out_e("\nLearns divine magic"); } for (k = 0; k < PF_MAX; k++) { const char *s; if (n_flags >= flag_space) break; if (!pf_has(c->pflags, k)) continue; s = get_pflag_desc(k); if (!s) continue; text_out_e("\n%s", s); n_flags++; } while(n_flags < flag_space) { text_out_e("\n"); n_flags++; } /* Reset text_out() indentation */ text_out_indent = 0; }
/* * Display the scores in a given range. */ static void display_scores_aux(const high_score scores[], int from, int to, int highlight) { struct keypress ch; int j, k, n, place; int count; /* Assume we will show the first 10 */ if (from < 0) from = 0; if (to < 0) to = 10; if (to > MAX_HISCORES) to = MAX_HISCORES; /* Hack -- Count the high scores */ for (count = 0; count < MAX_HISCORES; count++) { if (!scores[count].what[0]) break; } /* Forget about the last entries */ if (count > to) count = to; /* Show 5 per page, until "done" */ for (k = from, j = from, place = k+1; k < count; k += 5) { char out_val[160]; char tmp_val[160]; /* Clear screen */ Term_clear(); /* Title */ if (k > 0) put_str(format("%s Hall of Fame (from position %d)", VERSION_NAME, place), 0, 21); else put_str(format("%s Hall of Fame", VERSION_NAME), 0, 30); /* Dump 5 entries */ for (n = 0; j < count && n < 5; place++, j++, n++) { const high_score *score = &scores[j]; byte attr; int clev, mlev, cdun, mdun; const char *user, *gold, *when, *aged; struct player_class *c; struct player_race *r; /* Hack -- indicate death in yellow */ attr = (j == highlight) ? TERM_L_GREEN : TERM_WHITE; c = player_id2class(atoi(score->p_c)); r = player_id2race(atoi(score->p_r)); /* Extract the level info */ clev = atoi(score->cur_lev); mlev = atoi(score->max_lev); cdun = atoi(score->cur_dun); mdun = atoi(score->max_dun); /* Hack -- extract the gold and such */ for (user = score->uid; isspace((unsigned char)*user); user++) /* loop */; for (when = score->day; isspace((unsigned char)*when); when++) /* loop */; for (gold = score->gold; isspace((unsigned char)*gold); gold++) /* loop */; for (aged = score->turns; isspace((unsigned char)*aged); aged++) /* loop */; /* Dump some info */ strnfmt(out_val, sizeof(out_val), "%3d.%9s %s the %s %s, Level %d", place, score->pts, score->who, r ? r->name : "<none>", c ? c->name : "<none>", clev); /* Append a "maximum level" */ if (mlev > clev) my_strcat(out_val, format(" (Max %d)", mlev), sizeof(out_val)); /* Dump the first line */ c_put_str(attr, out_val, n*4 + 2, 0); /* Died where? */ if (!cdun) strnfmt(out_val, sizeof(out_val), "Killed by %s in the town", score->how); else strnfmt(out_val, sizeof(out_val), "Killed by %s on dungeon level %d", score->how, cdun); /* Append a "maximum level" */ if (mdun > cdun) my_strcat(out_val, format(" (Max %d)", mdun), sizeof(out_val)); /* Dump the info */ c_put_str(attr, out_val, n*4 + 3, 15); /* Clean up standard encoded form of "when" */ if ((*when == '@') && strlen(when) == 9) { strnfmt(tmp_val, sizeof(tmp_val), "%.4s-%.2s-%.2s", when + 1, when + 5, when + 7); when = tmp_val; } /* And still another line of info */ strnfmt(out_val, sizeof(out_val), "(User %s, Date %s, Gold %s, Turn %s).", user, when, gold, aged); c_put_str(attr, out_val, n*4 + 4, 15); } /* Wait for response */ prt("[Press ESC to exit, any other key to continue.]", 23, 17); ch = inkey(); prt("", 23, 0); /* Hack -- notice Escape */ if (ch.code == ESCAPE) break; } return; }
static void class_help(int i, void *db, const region *l) { int j; size_t k; struct player_class *c = player_id2class(i); const struct player_race *r = player->race; int len = (STAT_MAX + 1) / 2; int n_flags = 0; int flag_space = 5; if (!c) return; /* Output to the screen */ text_out_hook = text_out_to_screen; /* Indent output */ text_out_indent = CLASS_AUX_COL; Term_gotoxy(CLASS_AUX_COL, TABLE_ROW); for (j = 0; j < len; j++) { const char *name = stat_names_reduced[j]; int adj = c->c_adj[j] + r->r_adj[j]; text_out_e("%s%+3d", name, adj); if (j*2 + 1 < STAT_MAX) { name = stat_names_reduced[j + len]; adj = c->c_adj[j + len] + r->r_adj[j + len]; text_out_e(" %s%+3d", name, adj); } text_out("\n"); } text_out_e("\n"); skill_help(r->r_skills, c->c_skills, r->r_mhp + c->c_mhp, r->r_exp + c->c_exp, -1); if (c->magic.spell_realm->index != REALM_NONE) text_out_e("\nLearns %s magic", c->magic.spell_realm->adjective); for (k = 0; k < PF_MAX; k++) { const char *s; if (n_flags >= flag_space) break; if (!pf_has(c->pflags, k)) continue; s = get_pflag_desc(k); if (!s) continue; text_out_e("\n%s", s); n_flags++; } while(n_flags < flag_space) { text_out_e("\n"); n_flags++; } /* Reset text_out() indentation */ text_out_indent = 0; }