Index: src/cmd-obj.c =================================================================== --- src/cmd-obj.c (revision 1502) +++ src/cmd-obj.c (working copy) @@ -244,6 +244,8 @@ /*** Examination ***/ static void obj_examine(object_type *o_ptr, int item) { + track_object(item); + text_out_hook = text_out_to_screen; screen_save(); @@ -374,15 +376,14 @@ /* Peruse spells in a book */ static void obj_browse(object_type *o_ptr, int item) { - do_cmd_browse_aux(o_ptr); + do_cmd_browse_aux(o_ptr, item); } /* Study a book to gain a new spell */ static void obj_study(object_type *o_ptr, int item) { /* Track the object kind */ - object_kind_track(o_ptr->k_idx); - handle_stuff(); + track_object(item); /* Mage -- Choose a spell to study */ if (cp_ptr->flags & CF_CHOOSE_SPELLS) @@ -406,8 +407,7 @@ cptr noun = ((cp_ptr->spell_book == TV_MAGIC_BOOK) ? "spell" : "prayer"); /* Track the object kind */ - object_kind_track(o_ptr->k_idx); - handle_stuff(); + track_object(item); /* Ask for a spell */ spell = get_spell(o_ptr, verb, TRUE, FALSE); @@ -526,6 +526,9 @@ return; } + /* track the object used */ + track_object(item); + /* Figure out effect to use */ if (o_ptr->name1) effect = a_info[o_ptr->name1].effect; @@ -575,9 +578,8 @@ /* Mark as tried and redisplay */ p_ptr->notice |= (PN_COMBINE | PN_REORDER); - p_ptr->redraw |= (PR_INVEN | PR_EQUIP); + p_ptr->redraw |= (PR_INVEN | PR_EQUIP | PR_OBJECT); - /* * If the player becomes aware of the item's function, then mark it as * aware and reward the player with some experience. Otherwise, mark Index: src/object/obj-util.c =================================================================== --- src/object/obj-util.c (revision 1502) +++ src/object/obj-util.c (working copy) @@ -3349,6 +3349,49 @@ } +/** + * Helper to draw the Object Recall subwindow; this actually does the work. + */ +void display_object_recall(object_type *o_ptr) +{ + clear_from(0); + prt("", 0, 0); + object_info_header(o_ptr); + if (!object_info(o_ptr, FALSE)) + text_out("This item does not seem to possess any special abilities."); +} + + +/** + * This draws the Object Recall subwindow when displaying a particular object + * (e.g. a helmet in the backpack, or a scroll on the ground) + */ +void display_object_idx_recall(s16b item) +{ + object_type *o_ptr = object_from_item_idx(item); + display_object_recall(o_ptr); +} + + +/** + * This draws the Object Recall subwindow when displaying a recalled item kind + * (e.g. a generic ring of acid or a generic blade of chaos) + */ +void display_object_kind_recall(s16b k_idx) +{ + /* Initialize and prepare a fake object; it will be deallocated when we */ + /* leave the function. */ + object_type object; + object_type *o_ptr = &object; + object_wipe(o_ptr); + object_prep(o_ptr, k_idx); + if (k_info[k_idx].aware) o_ptr->ident |= (IDENT_STORE); + if (!k_info[k_idx].flavor) object_known(o_ptr); + + /* draw it */ + display_object_recall(o_ptr); +} + /* * Display visible items, similar to display_monlist */ Index: src/target.c =================================================================== --- src/target.c (revision 1502) +++ src/target.c (working copy) @@ -720,6 +720,9 @@ /* Not boring */ boring = FALSE; + track_object(-floor_list[0]); + handle_stuff(); + /* If there is more than one item... */ if (floor_num > 1) while (1) { @@ -746,6 +749,10 @@ /* Display objects */ if (query.key == 'r') { + + int rdone = 0; + while(!rdone) + { /* Save screen */ screen_save(); @@ -759,10 +766,21 @@ /* Load screen */ screen_load(); - /* Continue on 'r' only */ - if (query.key == 'r') continue; + int pos = query.key - 'a'; + if (0 <= pos && pos < floor_num) + { + track_object(-floor_list[pos]); + handle_stuff(); + continue; } + rdone = 1; + } + /* Now that the user's done with the display loop, let's */ + /* the outer loop over again */ + continue; + } + /* Done */ break; } Index: src/store.c =================================================================== --- src/store.c (revision 1502) +++ src/store.c (working copy) @@ -2663,7 +2663,7 @@ if (o_ptr->tval == cp_ptr->spell_book) { /* Call the aux function */ - do_cmd_browse_aux(o_ptr); + do_cmd_browse_aux(o_ptr, item); } } Index: src/player/calcs.c =================================================================== --- src/player/calcs.c (revision 1502) +++ src/player/calcs.c (working copy) @@ -1469,6 +1469,7 @@ { PR_MONLIST, EVENT_MONSTERLIST }, { PR_ITEMLIST, EVENT_ITEMLIST }, { PR_MONSTER, EVENT_MONSTERTARGET }, + { PR_OBJECT, EVENT_OBJECTTARGET }, { PR_MESSAGE, EVENT_MESSAGE }, }; Index: src/player/types.h =================================================================== --- src/player/types.h (revision 1502) +++ src/player/types.h (working copy) @@ -195,6 +195,7 @@ s16b monster_race_idx; /* Monster race trackee */ + s16b object_idx; /* Object trackee */ s16b object_kind_idx; /* Object kind trackee */ s16b energy_use; /* Energy use this turn */ Index: src/cave.c =================================================================== --- src/cave.c (revision 1502) +++ src/cave.c (working copy) @@ -3808,17 +3808,20 @@ /* * Hack -- track the given object kind */ -void object_kind_track(int k_idx) +void track_object(int item) { - /* Save this object ID */ + p_ptr->object_idx = item; + p_ptr->object_kind_idx = 0; + p_ptr->redraw |= (PR_OBJECT); +} + +void track_object_kind(int k_idx) +{ + p_ptr->object_idx = 0; p_ptr->object_kind_idx = k_idx; - - /* Window stuff */ p_ptr->redraw |= (PR_OBJECT); } - - /* * Something has happened to disturb the player. * Index: src/cmd-know.c =================================================================== --- src/cmd-know.c (revision 1502) +++ src/cmd-know.c (working copy) @@ -1037,6 +1037,10 @@ static void mon_lore(int oid) { + /* Update the monster recall window */ + monster_race_track(default_join[oid].oid); + handle_stuff(); + /* Save the screen */ screen_save(); @@ -1588,6 +1592,10 @@ return; } + /* Update the object recall window */ + track_object_kind(k_idx); + handle_stuff(); + /* Wipe the object */ object_wipe(o_ptr); Index: src/cmd5.c =================================================================== --- src/cmd5.c (revision 1502) +++ src/cmd5.c (working copy) @@ -480,15 +480,13 @@ } -void do_cmd_browse_aux(const object_type *o_ptr) +void do_cmd_browse_aux(const object_type *o_ptr, int item) { int spell; /* Track the object kind */ - object_kind_track(o_ptr->k_idx); - - /* Hack -- Handle stuff */ + track_object(item); handle_stuff(); Index: src/game-event.h =================================================================== --- src/game-event.h (revision 1502) +++ src/game-event.h (working copy) @@ -33,6 +33,7 @@ EVENT_ITEMLIST, EVENT_MONSTERLIST, EVENT_MONSTERTARGET, + EVENT_OBJECTTARGET, EVENT_MESSAGE, EVENT_INITSTATUS, /* New status message for initialisation */ Index: src/xtra3.c =================================================================== --- src/xtra3.c (revision 1502) +++ src/xtra3.c (working copy) @@ -1225,6 +1225,25 @@ } +static void update_object_subwindow(game_event_type type, game_event_data *data, void *user) +{ + term *old = Term; + term *inv_term = user; + + /* Activate */ + Term_activate(inv_term); + + if (p_ptr->object_idx) + display_object_idx_recall(p_ptr->object_idx); + else if(p_ptr->object_kind_idx) + display_object_kind_recall(p_ptr->object_kind_idx); + Term_fresh(); + + /* Restore */ + Term_activate(old); +} + + static void update_messages_subwindow(game_event_type type, game_event_data *data, void *user) { term *old = Term; @@ -1528,6 +1547,14 @@ break; } + case PW_OBJECT: + { + register_or_deregister(EVENT_OBJECTTARGET, + update_object_subwindow, + angband_term[win_idx]); + break; + } + case PW_MONLIST: { register_or_deregister(EVENT_MONSTERLIST, Index: src/externs.h =================================================================== --- src/externs.h (revision 1502) +++ src/externs.h (working copy) @@ -290,7 +290,8 @@ extern void scatter(int *yp, int *xp, int y, int x, int d, int m); extern void health_track(int m_idx); extern void monster_race_track(int r_idx); -extern void object_kind_track(int k_idx); +extern void track_object(int item); +extern void track_object_kind(int k_idx); extern void disturb(int stop_search, int unused_flag); extern bool is_quest(int level); extern bool dtrap_edge(int y, int x); @@ -307,7 +308,7 @@ void spell_learn(int spell); int get_spell(const object_type *o_ptr, cptr prompt, bool known, bool browse); -void do_cmd_browse_aux(const object_type *o_ptr); +void do_cmd_browse_aux(const object_type *o_ptr, int item); /* death.c */ void death_screen(void); @@ -406,6 +407,8 @@ /* obj-util.c */ extern void display_itemlist(void); +extern void display_object_idx_recall(s16b o_idx); +extern void display_object_kind_recall(s16b k_idx); /* pathfind.c */ extern bool findpath(int y, int x);