/* * Hack -- describe the given monster race at the top of the screen */ void screen_roff(int r_idx) { /* Flush messages */ message_flush(); /* Begin recall */ Term_erase(0, 1, 255); /* Output to the screen */ text_out_hook = text_out_to_screen; /* Recall monster */ describe_monster(r_idx, FALSE); /* Describe monster */ roff_top(r_idx); }
/* * Hack -- describe the given monster race at the top of the screen */ void screen_roff(const int r_idx, const monster_lore *l_ptr) { monster_race *r_ptr = &r_info[r_idx]; /* Flush messages */ message_flush(); /* Begin recall */ Term_erase(0, 1, 255); /* Output to the screen */ text_out_hook = text_out_to_screen; /* Recall monster */ describe_monster_race(r_ptr, l_ptr, FALSE); /* Describe monster */ roff_top(r_idx, 0); }
/* * Hack -- describe the given monster race in the current "term" window */ void display_roff(int r_idx) { int y; /* Erase the window */ for (y = 0; y < Term->hgt; y++) { /* Erase the line */ Term_erase(0, y, 255); } /* Begin recall */ Term_gotoxy(0, 1); /* Output to the screen */ text_out_hook = text_out_to_screen; /* Recall monster */ describe_monster(r_idx, FALSE); /* Describe monster */ roff_top(r_idx); }
static void mon_lore(int oid) { /* Update the monster recall window */ monster_race_track(default_join[oid].oid); handle_stuff(p_ptr); /* Save the screen */ screen_save(); /* Describe */ text_out_hook = text_out_to_screen; /* Recall monster */ roff_top(default_join[oid].oid); Term_gotoxy(0, 2); describe_monster(default_join[oid].oid, FALSE); text_out_c(TERM_L_BLUE, "\n[Press any key to continue]\n"); (void) anykey(); /* Load the screen */ screen_load(); }
/* * Hack -- describe the given monster race at the top of the screen */ void screen_monster_look(const int m_idx) { monster_type *m_ptr = &m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; monster_race race; /* Scale monster */ if (((r_ptr->flags9 & RF9_LEVEL_MASK) == 0) && monster_scale(&race, m_idx, p_ptr->depth)) { /* Scaled the monster successfully */ } /* Make copy in order to genderise monster, if required */ else { COPY(&race, r_ptr, monster_race); } /* Remove genders */ if ((race.flags1 & (RF1_FEMALE)) && (m_idx % 2)) race.flags1 &= ~(RF1_MALE); else if (race.flags1 & (RF1_MALE)) race.flags1 &= ~(RF1_FEMALE); /* Flush messages */ message_flush(); /* Begin recall */ Term_erase(0, 1, 255); /* Output to the screen */ text_out_hook = text_out_to_screen; /* Recall monster */ describe_monster_race(&race, &l_list[m_ptr->r_idx], FALSE); /* Describe monster */ roff_top(m_ptr->r_idx, m_idx); }
/* * Hack -- describe the given monster race in the current "term" window */ void display_roff(const int r_idx, const monster_lore *l_ptr) { monster_race *r_ptr = &r_info[r_idx]; int y; /* Erase the window */ for (y = 0; y < Term->hgt; y++) { /* Erase the line */ Term_erase(0, y, 255); } /* Begin recall */ Term_gotoxy(0, 1); /* Output to the screen */ text_out_hook = text_out_to_screen; /* Recall monster */ describe_monster_race(r_ptr, l_ptr, FALSE); /* Describe monster */ roff_top(r_idx, 0); }
/* * Identify a character, allow recall of monsters * * Several "special" responses recall "mulitple" monsters: * ^A (all monsters) * ^U (all unique monsters) * ^N (all non-unique monsters) * * The responses may be sorted in several ways, see below. * * Note that the player ghosts are ignored, since they do not exist. */ void do_cmd_query_symbol(void) { int i, n, r_idx; char sym, query; char buf[128]; bool all = FALSE; bool uniq = FALSE; bool norm = FALSE; bool kill = TRUE; bool recall = FALSE; u16b why = 0; u16b *who; /* Get a character, or abort */ if (!get_com("Enter character to be identified: ", &sym)) return; /* Find that character info, and describe it */ for (i = 0; ident_info[i]; ++i) { if (sym == ident_info[i][0]) break; } /* Describe */ if (sym == KTRL('A')) { all = TRUE; strcpy(buf, "Full monster list."); } else if (sym == KTRL('U')) { all = uniq = TRUE; strcpy(buf, "Unique monster list."); } else if (sym == KTRL('N')) { all = norm = TRUE; strcpy(buf, "Non-unique monster list."); } else if (sym == KTRL('K')) { all = kill = TRUE; strcpy(buf, "Killed monster list."); } else if (ident_info[i]) { sprintf(buf, "%c - %s.", sym, ident_info[i] + 2); } else { sprintf(buf, "%c - %s.", sym, "Unknown Symbol"); } /* Display the result */ prt(buf, 0, 0); /* Allocate the "who" array */ C_MAKE(who, z_info->r_max, u16b); /* Collect matching monsters */ for (n = 0, i = 1; i < z_info->r_max - 1; i++) { monster_race *r_ptr = &r_info[i]; monster_lore *l_ptr = &l_list[i]; /* Nothing to recall */ if (!cheat_know && !l_ptr->sights) continue; /* Skip unused monsters */ if (!(r_ptr->hdice)) continue; /* Require non-unique monsters if needed */ if (norm && (r_ptr->flags1 & (RF1_UNIQUE))) continue; /* Require unique monsters if needed */ if (uniq && !(r_ptr->flags1 & (RF1_UNIQUE))) continue; /* Require killed if needed */ if (kill && !(l_ptr->pkills)) continue; /* Collect "appropriate" monsters */ if (all || (r_ptr->d_char == sym)) who[n++] = i; } /* Nothing to recall */ if (!n) { /* XXX XXX Free the "who" array */ FREE(who); return; } /* Prompt */ put_str("Recall details? (k/K/p/P/a/A/y/n): ", 0, 40); /* Query */ query = inkey(); /* Restore */ prt(buf, 0, 0); /* Sort by kills (and level) */ if (query == 'k') { why = 4; query = 'y'; } if (query == 'K') { why = 4+16; query = 'y'; } /* Sort by total kills (and level) */ if (query == 'a') { why = 3; query = 'y'; } if (query == 'A') { why = 3+16; query = 'y'; } /* Sort by level (and experience) */ if (query == 'p') { why = 2; query = 'y'; } if (query == 'P') { why = 2+16; query = 'y'; } /* Catch "escape" */ if (query != 'y') { /* XXX XXX Free the "who" array */ FREE(who); return; } /* Sort if needed */ if (why) { /* Select the sort method */ ang_sort_comp = ang_sort_comp_hook; ang_sort_swap = ang_sort_swap_hook; /* Sort the array */ ang_sort(who, &why, n); } /* Start at the end */ i = n - 1; /* Scan the monster memory */ while (1) { /* Extract a race */ r_idx = who[i]; /* Hack -- Auto-recall */ monster_race_track(r_idx); /* Hack -- Handle stuff */ handle_stuff(); /* Hack -- Begin the prompt */ roff_top(r_idx); /* Hack -- Complete the prompt */ Term_addstr(-1, TERM_WHITE, " [(r)ecall, ESC]"); /* Interact */ while (1) { /* Recall */ if (recall) { /* Save screen */ screen_save(); /* Recall on screen */ screen_roff(who[i]); /* Hack -- Complete the prompt (again) */ Term_addstr(-1, TERM_WHITE, " [(r)ecall, ESC]"); } /* Command */ query = inkey(); /* Unrecall */ if (recall) { /* Load screen */ screen_load(); } /* Normal commands */ if (query != 'r') break; /* Toggle recall */ recall = !recall; } /* Stop scanning */ if (query == ESCAPE) break; /* Move to "prev" monster */ if (query == '-') { if (++i == n) { i = 0; if (!expand_list) break; } } /* Move to "next" monster */ else { if (i-- == 0) { i = n - 1; if (!expand_list) break; } } } /* Re-display the identity */ prt(buf, 0, 0); /* Free the "who" array */ FREE(who); }
/* * Identify a character, allow recall of monsters * * Several "special" responses recall "multiple" monsters: * ^A (all monsters) * ^U (all unique monsters) * ^N (all non-unique monsters) * * The responses may be sorted in several ways, see below. * * Note that the player ghosts are ignored. XXX XXX XXX */ void do_cmd_query_symbol(void) { int i, n, r_idx; char sym, query; char buf[128]; bool all = FALSE; bool uniq = FALSE; bool norm = FALSE; bool ride = FALSE; char temp[80] = ""; bool recall = FALSE; u16b why = 0; u16b *who; /* Get a character, or abort */ if (!get_com("Enter character to be identified(^A:All,^U:Uniqs,^N:Non uniqs,^M:Name): ", &sym, FALSE)) return; /* Find that character info, and describe it */ for (i = 0; ident_info[i]; ++i) { if (sym == ident_info[i][0]) break; } /* Describe */ if (sym == KTRL('A')) { all = TRUE; strcpy(buf, "Full monster list."); } else if (sym == KTRL('U')) { all = uniq = TRUE; strcpy(buf, "Unique monster list."); } else if (sym == KTRL('N')) { all = norm = TRUE; strcpy(buf, "Non-unique monster list."); } else if (sym == KTRL('R')) { all = ride = TRUE; strcpy(buf, "Ridable monster list."); } /* XTRA HACK WHATSEARCH */ else if (sym == KTRL('M')) { all = TRUE; if (!get_string("Enter name:",temp, 70)) { temp[0]=0; return; } sprintf(buf, "Monsters with a name \"%s\"",temp); } else if (ident_info[i]) { sprintf(buf, "%c - %s.", sym, ident_info[i] + 2); } else { sprintf(buf, "%c - %s.", sym, "Unknown Symbol"); } /* Display the result */ prt(buf, 0, 0); /* Allocate the "who" array */ C_MAKE(who, max_r_idx, u16b); /* Collect matching monsters */ for (n = 0, i = 1; i < max_r_idx; i++) { monster_race *r_ptr = &r_info[i]; /* Nothing to recall */ if (!(cheat_know || p_ptr->wizard) && !r_ptr->r_sights) continue; /* Require non-unique monsters if needed */ if (norm && (r_ptr->flags1 & (RF1_UNIQUE))) continue; /* Require unique monsters if needed */ if (uniq && !(r_ptr->flags1 & (RF1_UNIQUE))) continue; /* Require ridable monsters if needed */ if (ride && !(r_ptr->flags7 & (RF7_RIDING))) continue; /* XTRA HACK WHATSEARCH */ if (temp[0]) { int xx; char temp2[80]; for (xx=0; temp[xx] && xx<80; xx++) { if (isupper(temp[xx])) temp[xx]=tolower(temp[xx]); } strcpy(temp2, r_name+r_ptr->name); for (xx=0; temp2[xx] && xx<80; xx++) if (isupper(temp2[xx])) temp2[xx]=tolower(temp2[xx]); if (my_strstr(temp2, temp)) who[n++]=i; } /* Collect "appropriate" monsters */ else if (all || (r_ptr->d_char == sym)) who[n++] = i; } /* Nothing to recall */ if (!n) { /* Free the "who" array */ C_KILL(who, max_r_idx, u16b); return; } /* Prompt XXX XXX XXX */ put_str("Recall details? (k/y/n): ", 0, 40); /* Query */ query = inkey(); /* Restore */ prt(buf, 0, 0); why = 2; /* Select the sort method */ ang_sort_comp = ang_sort_comp_hook; ang_sort_swap = ang_sort_swap_hook; /* Sort the array */ ang_sort(who, &why, n); /* Sort by kills (and level) */ if (query == 'k') { why = 4; query = 'y'; } /* Catch "escape" */ if (query != 'y') { /* Free the "who" array */ C_KILL(who, max_r_idx, u16b); return; } /* Sort if needed */ if (why == 4) { /* Select the sort method */ ang_sort_comp = ang_sort_comp_hook; ang_sort_swap = ang_sort_swap_hook; /* Sort the array */ ang_sort(who, &why, n); } /* Start at the end */ i = n - 1; /* Scan the monster memory */ while (1) { /* Extract a race */ r_idx = who[i]; /* Hack -- Auto-recall */ monster_race_track(r_idx); /* Hack -- Handle stuff */ handle_stuff(); /* Interact */ while (1) { /* Recall */ if (recall) { /* Save the screen */ screen_save(); /* Recall on screen */ screen_roff(who[i], 0); } /* Hack -- Begin the prompt */ roff_top(r_idx); /* Hack -- Complete the prompt */ Term_addstr(-1, TERM_WHITE, " [(r)ecall, ESC]"); /* Command */ query = inkey(); /* Unrecall */ if (recall) { /* Restore */ screen_load(); } /* Normal commands */ if (query != 'r') break; /* Toggle recall */ recall = !recall; } /* Stop scanning */ if (query == ESCAPE) break; /* Move to "prev" monster */ if (query == '-') { if (++i == n) { i = 0; if (!expand_list) break; } } /* Move to "next" monster */ else { if (i-- == 0) { i = n - 1; if (!expand_list) break; } } } /* Free the "who" array */ C_KILL(who, max_r_idx, u16b); /* Re-display the identity */ prt(buf, 0, 0); }
/* * research_mon * -KMW- */ bool research_mon(void) { int i, n, r_idx; char sym, query; char buf[128]; s16b oldkills; byte oldwake; bool oldcheat; bool notpicked; bool recall = FALSE; u16b why = 0; monster_race *r2_ptr; u16b *who; #ifdef JP /* XTRA HACK WHATSEARCH */ bool all = FALSE; bool uniq = FALSE; bool norm = FALSE; char temp[80] = ""; /* XTRA HACK REMEMBER_IDX */ static int old_sym = '\0'; static int old_i = 0; #endif oldcheat = cheat_know; /* Save the screen */ screen_save(); /* Get a character, or abort */ #ifdef JP if (!get_com("モンスターの文字を入力して下さい(記号 or ^A全,^Uユ,^N非ユ,^M名前):", &sym)) #else if (!get_com("Enter character of monster: ", &sym)) #endif { /* Restore */ screen_load(); return (FALSE); } /* Allocate the "who" array */ C_MAKE(who, max_r_idx, u16b); /* Find that character info, and describe it */ for (i = 0; ident_info[i]; ++i) { if (sym == ident_info[i][0]) break; } #ifdef JP /* XTRA HACK WHATSEARCH */ if (sym == KTRL('A')) { all = TRUE; strcpy(buf, "全モンスターのリスト"); } else if (sym == KTRL('U')) { all = uniq = TRUE; strcpy(buf, "ユニーク・モンスターのリスト"); } else if (sym == KTRL('N')) { all = norm = TRUE; strcpy(buf, "ユニーク外モンスターのリスト"); } else if (sym == KTRL('M')) { all = TRUE; if (!get_string("名前(英語の場合小文字で可)", temp, 70)) { all = FALSE; temp[0] = 0; } sprintf(buf, "名前:%sにマッチ",temp); } else if (ident_info[i]) { sprintf(buf, "%c - %s.", sym, ident_info[i] + 2); } #else if (ident_info[i]) { sprintf(buf, "%c - %s.", sym, ident_info[i] + 2); } #endif else { #ifdef JP sprintf(buf, "%c - %s", sym, "無効な文字"); #else sprintf(buf, "%c - %s.", sym, "Unknown Symbol"); #endif } /* Display the result */ prt(buf, 16, 10); /* Collect matching monsters */ for (n = 0, i = 1; i < max_r_idx; i++) { monster_race *r_ptr = &r_info[i]; cheat_know = TRUE; #ifdef JP /* XTRA HACK WHATSEARCH */ /* Require non-unique monsters if needed */ if (norm && (r_ptr->flags1 & (RF1_UNIQUE))) continue; /* Require unique monsters if needed */ if (uniq && !(r_ptr->flags1 & (RF1_UNIQUE))) continue; /* 名前検索 */ if (temp[0]){ char temp2[80]; int xx; for (xx=0; temp[xx] && xx<80; xx++){ if (iskanji(temp[xx])) { xx++; continue; } if (isupper(temp[xx])) temp[xx]=tolower(temp[xx]); } strcpy(temp2, r_name+r_ptr->E_name); for (xx=0; temp2[xx] && xx<80; xx++) if (isupper(temp2[xx])) temp2[xx]=tolower(temp2[xx]); if (my_strstr(temp2, temp) || my_strstr(r_name + r_ptr->name, temp) ) who[n++]=i; } else if (all || (r_ptr->d_char == sym)) who[n++] = i; #else /* Collect "appropriate" monsters */ if (r_ptr->d_char == sym) who[n++] = i; #endif } /* Nothing to recall */ if (!n) { cheat_know = oldcheat; /* Free the "who" array */ C_KILL(who, max_r_idx, u16b); /* Restore */ screen_load(); return (FALSE); } /* Sort by level */ why = 2; query = 'y'; /* Sort if needed */ if (why) { /* Select the sort method */ ang_sort_comp = ang_sort_comp_hook; ang_sort_swap = ang_sort_swap_hook; /* Sort the array */ ang_sort(who, &why, n); } /* Start at the end */ #ifdef JP /* XTRA HACK REMEMBER_IDX */ if (old_sym == sym && old_i < n) i = old_i; else i = n - 1; #else i = n - 1; #endif notpicked = TRUE; /* Scan the monster memory */ while (notpicked) { /* Extract a race */ r_idx = who[i]; /* Save this monster ID */ p_ptr->monster_race_idx = r_idx; /* Hack -- Handle stuff */ handle_stuff(); /* Hack -- Begin the prompt */ roff_top(r_idx); /* Hack -- Complete the prompt */ #ifdef JP Term_addstr(-1, TERM_WHITE, " ['r'思い出, ' 'で続行, ESC]"); #else Term_addstr(-1, TERM_WHITE, " [(r)ecall, ESC, space to continue]"); #endif /* Interact */ while (1) { /* Recall */ if (recall) { /* Recall on screen */ r2_ptr = &r_info[r_idx]; oldkills = r2_ptr->r_tkills; oldwake = r2_ptr->r_wake; screen_roff(who[i], 1); r2_ptr->r_tkills = oldkills; r2_ptr->r_wake = oldwake; cheat_know = oldcheat; notpicked = FALSE; #ifdef JP /* XTRA HACK REMEMBER_IDX */ old_sym = sym; old_i = i; #endif } /* Command */ query = inkey(); /* Normal commands */ if (query != 'r') break; /* Toggle recall */ recall = !recall; } /* Stop scanning */ if (query == ESCAPE) break; /* Move to "prev" monster */ if (query == '-') { if (++i == n) { i = 0; if (!expand_list) break; } } /* Move to "next" monster */ else { if (i-- == 0) { i = n - 1; if (!expand_list) break; } } } /* Re-display the identity */ /* prt(buf, 5, 5);*/ cheat_know = oldcheat; /* Free the "who" array */ C_KILL(who, max_r_idx, u16b); /* Restore */ screen_load(); return (!notpicked); }
/* * Identify a character, allow recall of monsters * * Several "special" responses recall "multiple" monsters: * ^A (all monsters) * ^U (all unique monsters) * ^N (all non-unique monsters) * * The responses may be sorted in several ways, see below. * * Note that the player ghosts are ignored, since they do not exist. */ void do_cmd_query_symbol(void) { int i, n, r_idx; char buf[128]; struct keypress sym; struct keypress query; bool all = FALSE; bool uniq = FALSE; bool norm = FALSE; bool recall = FALSE; u16b *who; /* Get a character, or abort */ if (!get_com("Enter character to be identified, or control+[ANU]: ", &sym)) return; /* Describe */ if (sym.code == KTRL('A')) { all = TRUE; my_strcpy(buf, "Full monster list.", sizeof(buf)); } else if (sym.code == KTRL('U')) { all = uniq = TRUE; my_strcpy(buf, "Unique monster list.", sizeof(buf)); } else if (sym.code == KTRL('N')) { all = norm = TRUE; my_strcpy(buf, "Non-unique monster list.", sizeof(buf)); } else { lookup_symbol(sym, buf, sizeof(buf)); } /* Display the result */ prt(buf, 0, 0); /* Allocate the "who" array */ who = C_ZNEW(z_info->r_max, u16b); /* Collect matching monsters */ for (n = 0, i = 1; i < z_info->r_max - 1; i++) { monster_race *r_ptr = &r_info[i]; monster_lore *l_ptr = &l_list[i]; /* Nothing to recall */ if (!OPT(cheat_know) && !l_ptr->sights) continue; /* Require non-unique monsters if needed */ if (norm && rf_has(r_ptr->flags, RF_UNIQUE)) continue; /* Require unique monsters if needed */ if (uniq && !rf_has(r_ptr->flags, RF_UNIQUE)) continue; /* Collect "appropriate" monsters */ if (all || (r_ptr->d_char == (char)sym.code)) who[n++] = i; } /* Nothing to recall */ if (!n) { /* XXX XXX Free the "who" array */ FREE(who); return; } /* Buttons */ button_add("[y]", 'y'); button_add("[k]", 'k'); /* Don't collide with the repeat button */ button_add("[n]", 'q'); redraw_stuff(p_ptr); /* Prompt */ put_str("Recall details? (y/k/n): ", 0, 40); /* Query */ query = inkey(); /* Restore */ prt(buf, 0, 0); /* Buttons */ button_kill('y'); button_kill('k'); button_kill('q'); redraw_stuff(p_ptr); /* Interpret the response */ if (query.code == 'k') { /* Sort by kills (and level) */ sort(who, n, sizeof(*who), cmp_pkill); } else if (query.code == 'y' || query.code == 'p') { /* Sort by level; accept 'p' as legacy */ sort(who, n, sizeof(*who), cmp_level); } else { /* Any unsupported response is "nope, no history please" */ /* XXX XXX Free the "who" array */ FREE(who); return; } /* Start at the end */ i = n - 1; /* Button */ button_add("[r]", 'r'); button_add("[-]", '-'); button_add("[+]", '+'); redraw_stuff(p_ptr); /* Scan the monster memory */ while (1) { /* Extract a race */ r_idx = who[i]; /* Hack -- Auto-recall */ monster_race_track(r_idx); /* Hack -- Handle stuff */ handle_stuff(p_ptr); /* Hack -- Begin the prompt */ roff_top(r_idx); /* Hack -- Complete the prompt */ Term_addstr(-1, TERM_WHITE, " [(r)ecall, ESC]"); /* Interact */ while (1) { /* Recall */ if (recall) { /* Save screen */ screen_save(); /* Recall on screen */ screen_roff(who[i]); /* Hack -- Complete the prompt (again) */ Term_addstr(-1, TERM_WHITE, " [(r)ecall, ESC]"); } /* Command */ query = inkey(); /* Unrecall */ if (recall) { /* Load screen */ screen_load(); } /* Normal commands */ if (query.code != 'r') break; /* Toggle recall */ recall = !recall; } /* Stop scanning */ if (query.code == ESCAPE) break; /* Move to "prev" monster */ if (query.code == '-') { if (++i == n) i = 0; } /* Move to "next" monster */ else { if (i-- == 0) i = n - 1; } } /* Button */ button_kill('r'); button_kill('-'); button_kill('+'); redraw_stuff(p_ptr); /* Re-display the identity */ prt(buf, 0, 0); /* Free the "who" array */ FREE(who); }