void GridDialog::item_click() { QString item_id = QObject::sender()->objectName(); QChar kind = item_id.at(0); int idx = item_id.mid(1).toInt(); if (kind == 'm') { describe_monster(mon_list[idx].r_idx, false, ""); } else if (kind == 'o') { object_info_screen(o_list + idx); } else { describe_feature(idx, false); } }
/* * 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 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(); }
/* * Create a spoiler file for monsters (-SHAWN-) */ static void spoil_mon_info(const char *fname) { char buf[1024]; int i, n; u16b *who; int count = 0; /* Open the file */ path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname); fh = file_open(buf, MODE_WRITE, FTYPE_TEXT); /* Oops */ if (!fh) { msg("Cannot create spoiler file."); return; } /* Dump to the spoiler file */ text_out_hook = text_out_to_file; text_out_file = fh; /* Dump the header */ text_out("Monster Spoilers for %s\n", buildid); text_out("------------------------------------------\n\n"); /* Allocate the "who" array */ who = C_ZNEW(z_info->r_max, u16b); /* Scan the monsters */ for (i = 1; i < z_info->r_max; i++) { monster_race *r_ptr = &r_info[i]; /* Use that monster */ if (r_ptr->name) who[count++] = (u16b)i; } sort(who, count, sizeof(*who), cmp_monsters); /* * List all monsters in order (except the ghost). */ for (n = 0; n < count; n++) { int r_idx = who[n]; monster_race *r_ptr = &r_info[r_idx]; /* Prefix */ if (rf_has(r_ptr->flags, RF_QUESTOR)) { text_out("[Q] "); } else if (rf_has(r_ptr->flags, RF_UNIQUE)) { text_out("[U] "); } else { text_out("The "); } /* Name */ text_out("%s (", r_ptr->name); /* ---)--- */ /* Color */ text_out(attr_to_text(r_ptr->d_attr)); /* Symbol --(-- */ text_out(" '%c')\n", r_ptr->d_char); /* Indent */ text_out("=== "); /* Number */ text_out("Num:%d ", r_idx); /* Level */ text_out("Lev:%d ", r_ptr->level); /* Rarity */ text_out("Rar:%d ", r_ptr->rarity); /* Speed */ if (r_ptr->speed >= 110) { text_out("Spd:+%d ", (r_ptr->speed - 110)); } else { text_out("Spd:-%d ", (110 - r_ptr->speed)); } /* Hitpoints */ text_out("Hp:%d ", r_ptr->avg_hp); /* Armor Class */ text_out("Ac:%d ", r_ptr->ac); /* Experience */ text_out("Exp:%ld\n", (long)(r_ptr->mexp)); /* Describe */ describe_monster(r_idx, TRUE); /* Terminate the entry */ text_out("\n"); } /* Free the "who" array */ FREE(who); /* Check for errors */ if (!file_close(fh)) { msg("Cannot close spoiler file."); return; } msg("Successfully created a spoiler file."); }
/* * Create a spoiler file for monsters * [email protected] (Shawn McHorse) */ static void spoil_mon_info(cptr fname) { char buf[1024]; int i, n; u16b why = 2; u16b *who; int count = 0; /* Build the filename */ (void)path_build(buf, sizeof(buf), ANGBAND_DIR_INFO, fname); /* File type is "TEXT" */ FILE_TYPE(FILE_TYPE_TEXT); /* Open the file */ fff = my_fopen(buf, "w"); /* Oops */ if (!fff) { msg_print("Cannot create spoiler file."); return; } /* Dump to the spoiler file */ text_out_hook = text_out_to_file; text_out_file = fff; /* Print header */ print_header("Full Monster"); /* Allocate the "who" array */ C_MAKE(who, z_info->r_max, u16b); /* Scan the monsters */ for (i = 1; i < z_info->r_max; i++) { monster_race *r_ptr = &r_info[i]; /* Use that monster */ if (r_ptr->name) who[count++] = (u16b)i; } /* Select the sort method */ ang_sort_comp = ang_sort_comp_hook; ang_sort_swap = ang_sort_swap_hook; /* Sort the array by dungeon depth of monsters */ ang_sort(who, &why, count); /* * List all monsters in order. */ for (n = 0; n < count; n++) { int r_idx = who[n]; monster_race *r_ptr = &r_info[r_idx]; /* Prefix */ if (r_ptr->flags1 & RF1_QUESTOR) { text_out("[Q] "); } else if (r_ptr->flags1 & RF1_UNIQUE) { text_out("[U] "); } else { text_out("The "); } /* Name */ (void)strnfmt(buf, sizeof(buf), "%s (", (r_name + r_ptr->name)); /* ---)--- */ text_out(buf); /* Color */ text_out(attr_to_text(r_ptr->d_attr)); /* Symbol --(-- */ (void)strnfmt(buf, sizeof(buf), " '%c')\n", r_ptr->d_char); text_out(buf); /* Indent */ (void)strnfmt(buf, sizeof(buf), "=== "); text_out(buf); /* Number */ (void)strnfmt(buf, sizeof(buf), "Num:%d ", r_idx); text_out(buf); /* Level */ (void)strnfmt(buf, sizeof(buf), "Lev:%d ", r_ptr->level); text_out(buf); /* Rarity */ (void)strnfmt(buf, sizeof(buf), "Rar:%d ", r_ptr->rarity); text_out(buf); /* Speed */ if (r_ptr->speed >= 110) { (void)strnfmt(buf, sizeof(buf), "Spd:+%d ", (r_ptr->speed - 110)); } else { (void)strnfmt(buf, sizeof(buf), "Spd:-%d ", (110 - r_ptr->speed)); } text_out(buf); /* Hitpoints */ if (r_ptr->flags1 & (RF1_FIXED_HPS)) { (void)strnfmt(buf, sizeof(buf), "%d", r_ptr->hitpoints); } else { (void)strnfmt(buf, sizeof(buf), "~%d", r_ptr->hitpoints); } text_out(buf); /* Armor Class */ (void)strnfmt(buf, sizeof(buf), "Ac:%d ", r_ptr->ac); text_out(buf); /* Experience */ (void)strnfmt(buf, sizeof(buf), "Exp:%ld\n", (long)(r_ptr->mexp)); text_out(buf); /* Describe */ describe_monster(r_idx, TRUE); /* Terminate the entry */ text_out("\n"); } /* Free the "who" array */ FREE(who); /* Check for errors */ if (ferror(fff) || my_fclose(fff)) { msg_print("Cannot close spoiler file."); return; } msg_print("Successfully created a spoiler file."); }