/* * Display known objects */ void textui_browse_object_knowledge(void *obj, const char *name) { group_funcs kind_f = { TV_GOLD, FALSE, kind_name, o_cmp_tval, obj2gid, 0 }; member_funcs obj_f = { display_object, desc_obj_fake, o_xchar, o_xattr, o_xtra_prompt, o_xtra_act, 0 }; int *objects; int o_count = 0; int i; object_kind *k_ptr; objects = C_ZNEW(z_info->k_max, int); for (i = 0; i < z_info->k_max; i++) { k_ptr = &k_info[i]; /* It's in the list if we've ever seen it, or it has a flavour, and * either it's not one of the special artifacts, or if it is, we're not * aware of it yet. This way the flavour appears in the list until it * is found. */ if ((k_ptr->everseen || k_ptr->flavor || OPT(cheat_xtra)) && (!kf_has(k_ptr->flags_kind, KF_INSTA_ART) || !artifact_is_known(get_artifact_from_kind(k_ptr)))) { int c = obj_group_order[k_info[i].tval]; if (c >= 0) objects[o_count++] = i; } } display_knowledge("known objects", objects, o_count, kind_f, obj_f, "Squelch Inscribed Sym"); FREE(objects); }
/* * Describe fake object */ static void desc_obj_fake(int k_idx) { object_kind *k_ptr = &k_info[k_idx]; object_type object_type_body; object_type *o_ptr = &object_type_body; char header[120]; textblock *tb; region area = { 0, 0, 0, 0 }; /* Check for known artifacts, display them as artifacts */ if (kf_has(k_ptr->flags_kind, KF_INSTA_ART) && artifact_is_known(get_artifact_from_kind(k_ptr))) { desc_art_fake(get_artifact_from_kind(k_ptr)); return; } /* Update the object recall window */ track_object_kind(k_idx); handle_stuff(p_ptr); /* Wipe the object */ object_wipe(o_ptr); /* Create the artifact */ object_prep(o_ptr, k_idx, EXTREMIFY); /* Hack -- its in the store */ if (k_info[k_idx].aware) o_ptr->ident |= (IDENT_STORE); /* It's fully know */ if (!k_info[k_idx].flavor) object_known(o_ptr); /* Hack -- Handle stuff */ handle_stuff(p_ptr); /* Describe */ tb = object_info(o_ptr, OINFO_DUMMY); object_desc(header, sizeof(header), o_ptr, ODESC_PREFIX | ODESC_FULL | ODESC_CAPITAL); textui_textblock_show(tb, area, format("%s", header)); textblock_free(tb); }
/* * 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 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); } }