int mut_gain_choice(mut_pred pred) { int choices[MAX_MUTATIONS]; int i; int ct = 0; menu_list_t list = { "Gain which mutation?", "Browse which mutation?", NULL, _mut_name, NULL, NULL, choices, 0}; for (i = 0; i < MAX_MUTATIONS; i++) { if (!mut_present(i)) { if (pred == NULL || (pred(i))) choices[ct++] = i; } } if (ct == 0) return -1; list.count = ct; for (;;) { i = menu_choose(&list); if (i >= 0) { char buf[1024]; char buf2[1024]; int idx = choices[i]; mut_name(idx, buf2); sprintf(buf, "You will gain %s. Are you sure?", buf2); if (get_check(buf)) { mut_gain(idx); return idx; } } msg_print("Please make a choice!"); } return -1; }
static cptr _mut_name(menu_choices choices, int which) { static char buf[255]; mut_name(((int*)choices)[which], buf); return buf; }
static void _demigods_help(FILE* fff) { int i; fprintf(fff, "[[[[B| Demigod Parentage\n\n"); for (i = 0; i < MAX_DEMIGOD_TYPES; i++) { _demigod_help(fff, i); } fprintf(fff, "***** <Tables>\n"); fprintf(fff, "[[[[y| Table 1 - Race Statistic Bonus Table ---\n\n"); fprintf(fff, "[[[[r| STR INT WIS DEX CON CHR Life Exp\n"); for (i = 0; i < MAX_DEMIGOD_TYPES; i++) { race_t *race_ptr = get_race_t_aux(RACE_DEMIGOD, i); fprintf(fff, " %-14s %+3d %+3d %+3d %+3d %+3d %+3d %3d%% %3d%%\n", demigod_info[i].name, race_ptr->stats[A_STR], race_ptr->stats[A_INT], race_ptr->stats[A_WIS], race_ptr->stats[A_DEX], race_ptr->stats[A_CON], race_ptr->stats[A_CHR], race_ptr->life, race_ptr->exp ); } fprintf(fff, "\n\n"); fprintf(fff, "[[[[y| Table 2 - Race Skill Bonus Table\n\n"); fprintf(fff, "[[[[r| Dsrm Dvce Save Stlh Srch Prcp Melee Bows Infra\n"); for (i = 0; i < MAX_DEMIGOD_TYPES; i++) { race_t *race_ptr = get_race_t_aux(RACE_DEMIGOD, i); fprintf(fff, " %-14s %+4d %+4d %+4d %+4d %+4d %+4d %+5d %+4d %4d'\n", demigod_info[i].name, race_ptr->skills.dis, race_ptr->skills.dev, race_ptr->skills.sav, race_ptr->skills.stl, race_ptr->skills.srh, race_ptr->skills.fos, race_ptr->skills.thn, race_ptr->skills.thb, race_ptr->infra*10 ); } fprintf(fff, "\n\n"); fprintf(fff, "[[[[y| Table 3 - Demigod Special Powers\n\n"); _wrap_text(fff, "All demigods have access to special powers. When they reach level 20, they may choose " "a single power from the following list. When they reach level, 40, they may choose another. " "These powers can never be removed or changed, so you might want to study this list to " "decide which powers you will choose for your character.", 2, 80); fprintf(fff, "\n"); for (i = 0; i < MAX_MUTATIONS; i++) { if (mut_demigod_pred(i)) { char b1[255], b2[255]; mut_name(i, b1); mut_help_desc(i, b2); fprintf(fff, " [[[[r|%-19s| %s\n", b1, b2); } } fprintf(fff, "\n\n"); }