PaulMoore: I just saw this idea on rec.games.roguelike.angband, from "remuz", and it immediately struck me as useful. A window option to show the items on the floor under the character (much like the visible monsters window). This would be very useful to me when sorting through loot. At the moment, something like 'I-*'works, but it doesn't half get tedious after you've just cleared out a dragon pit...

JohnGilmore: I actually implemented this for 2.3.? but never bothered to make the patch public. I'm not even sure if I have it around anymore. I decided to wait for the 3.0 release before really putting the effort into a final (most debugged) version. The 2.3.x series are closed to feature enhancements anyway (or at least that's my impression) and the 3.0 release needs more urgent things than the floor stacks window. Like going through the scrolls and fixing the plethora of lua errors...

Now, if this is something that would actually be accepted into a 2.3.x release, I'd be happy to see if I can't dig the code out of whatever corner it's hiding in.

NeilStevens: We won't be making any more ToME 2 releases unless there's some horrible crash bug out there, so I'd hold off until 3.0 is sent out for playtesting.

TheFury: If the code works, I could throw it into furyband.... :)

JohnGilmore: It's been awhile since I looked at it, but as I recall, the code does work. That being said, I've never played furyband, and as I understand it, it will probably be ported over to the 3.0 engine at some point anyway. That being so, why not wait till it's done, and avoid implementing it again? Like I said, I'm not even sure that I even have that code around anymore, and even if I do, it'd be as part of an old copy of tome sitting on my hard drive, not in isolation. I.E. It's not a clean patch.

Oh, wait. I just took a quick glance, and it is a clean patch. Here it is, though it's a bit bigger than I recall, and it may have gotten some of my 'better visible monsters list' on it. Hrrmmm, on second quick glance through, it seems that the bit of code I thought might be from the monsters list is actually to display the list of items that a monster is carrying when you 'l'ook at them.

TheFury: FuryBand probably won't be ported over. FuryMod may, but seriously, when is tome 3 getting out of alpha? :)

ShrikeDeCil I think it would be useful to extend this to 'Everything I know about this square I'm in'. Like: You are standing in swamp. There is an arrow trap. _then_ the objects.

JohnGilmore: I like that idea. Now that you mention it, it should logicaly include the terrian type and traps, as well as the monster, what the monster is carrying, and what is sitting on the floor. I'm not sure that this patch is worth even looking at for 2.x though, so going to the additional effort to add terrain and traps is contraindicated. Unless, of course, somebody decides that there will be an additional release of 2.x, perhaps specifically to include this patch. Seems pretty unlikely, but feel free to go ahead and modify 2.x according to your plan. Just don't count on it getting into any sort of official codebase.

diff -udprBb --exclude='*.o' --exclude='*.raw' tome-225-src/src/cmd1.c floor_patch/src/cmd1.c
--- tome-225-src/src/cmd1.c     2003-12-11 13:32:40.000000000 -0700
+++ floor_patch/src/cmd1.c      2004-02-02 12:22:05.000000000 -0700
@@ -3740,7 +3748,7 @@ void move_player_aux(int dir, int do_pic
                p_ptr->update |= (PU_DISTANCE);
 
                /* Window stuff */
-               if (!run) p_ptr->window |= (PW_OVERHEAD);
+               if (!run) p_ptr->window |= (PW_OVERHEAD | PW_FLOOR);
 
                /* Some feature descs */
                if (f_info[cave[p_ptr->py][p_ptr->px].feat].text > 1)
diff -udprBb --exclude='*.o' --exclude='*.raw' tome-225-src/src/cmd3.c floor_patch/src/cmd3.c
--- tome-225-src/src/cmd3.c     2003-12-11 13:32:40.000000000 -0700
+++ floor_patch/src/cmd3.c      2004-01-09 16:49:46.000000000 -0700
@@ -477,7 +477,7 @@ void do_cmd_wield(void)
        /* Redraw monster hitpoint */
        p_ptr->redraw |= (PR_MH);
 
-       p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
+       p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER | PW_FLOOR );
 }
 
 
@@ -727,7 +727,7 @@ void do_cmd_destroy(void)
                p_ptr->notice |= (PN_COMBINE);
 
                /* Window stuff */
-               p_ptr->window |= (PW_INVEN | PW_EQUIP);
+               p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_FLOOR);
 
                /* Done */
                return;
@@ -945,7 +945,7 @@ void do_cmd_inscribe(void)
                p_ptr->notice |= (PN_COMBINE);
 
                /* Window stuff */
-               p_ptr->window |= (PW_INVEN | PW_EQUIP);
+               p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_FLOOR);
        }
 }
 
@@ -1125,6 +1125,7 @@ static void do_cmd_refill_torch(void)
                inven_item_increase(item, -1);
                inven_item_describe(item);
                inven_item_optimize(item);
+               p_ptr->window |= (PW_INVEN);
        }
 
        /* Decrease the item (from the floor) */
@@ -1133,7 +1134,9 @@ static void do_cmd_refill_torch(void)
                floor_item_increase(0 - item, -1);
                floor_item_describe(0 - item);
                floor_item_optimize(0 - item);
+               p_ptr->window |= (PW_FLOOR);
        }
+       p_ptr->window |= (PW_EQUIP);
 
        /* Recalculate torch */
        p_ptr->update |= (PU_TORCH);
diff -udprBb --exclude='*.o' --exclude='*.raw' tome-225-src/src/cmd4.c floor_patch/src/cmd4.c
--- tome-225-src/src/cmd4.c     2003-12-11 13:32:41.000000000 -0700
+++ floor_patch/src/cmd4.c      2004-01-09 16:51:20.000000000 -0700
@@ -62,7 +62,7 @@ void do_cmd_redraw(void)
        p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP);
 
        /* Window stuff */
-       p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER | PW_M_LIST);
+       p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER | PW_M_LIST | PW_FLOOR);
 
        /* Window stuff */
        p_ptr->window |= (PW_MESSAGE | PW_IRC | PW_OVERHEAD | PW_MONSTER | PW_OBJECT);
diff -udprBb --exclude='*.o' --exclude='*.raw' tome-225-src/src/cmd5.c floor_patch/src/cmd5.c
--- tome-225-src/src/cmd5.c     2003-12-11 13:32:40.000000000 -0700
+++ floor_patch/src/cmd5.c      2004-01-09 16:52:29.000000000 -0700
@@ -548,6 +548,7 @@ void fetch(int dir, int wgt, bool requir
 
        note_spot(p_ptr->py, p_ptr->px);
        p_ptr->redraw |= PR_MAP;
+       p_ptr->window |= PW_FLOOR;
 }
 
 
diff -udprBb --exclude='*.o' --exclude='*.raw' tome-225-src/src/cmd6.c floor_patch/src/cmd6.c
--- tome-225-src/src/cmd6.c     2003-12-11 13:32:41.000000000 -0700
+++ floor_patch/src/cmd6.c      2004-01-09 16:54:07.000000000 -0700
@@ -1443,7 +1443,7 @@ void do_cmd_eat_food(void)
        }
 
        /* Window stuff */
-       p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
+       p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER | PW_FLOOR);
 
        if (!fval) fval = o_ptr->pval;
 
@@ -2592,7 +2592,7 @@ void do_cmd_quaff_potion(void)
        }
 
        /* Window stuff */
-       p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
+       p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER | PW_FLOOR);
 
 
        /* Potions can feed the player */
@@ -3684,7 +3684,7 @@ void do_cmd_read_scroll(void)
        }
 
        /* Window stuff */
-       p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
+       p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER | PW_FLOOR);
 
 
        /* Hack -- allow certain scrolls to be "preserved" */
@@ -3866,7 +3866,7 @@ void do_cmd_use_staff(void)
 
        /* An identification was made */
        /* Window stuff */
-       p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
+       p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER | PW_FLOOR);
 
 
        /* Hack -- some uses are "free" */
@@ -4080,7 +4080,7 @@ void do_cmd_aim_wand(void)
        }
 
        /* Window stuff */
-       p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
+       p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER | PW_FLOOR);
 
 
        /* Use a single charge */
@@ -4701,7 +4701,7 @@ void do_cmd_zap_rod(void)
        }
 
        /* Window stuff */
-       p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
+       p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER | PW_FLOOR);
 
        /* Hack -- deal with cancelled zap */
        if (!use_charge)
diff -udprBb --exclude='*.o' --exclude='*.raw' tome-225-src/src/cmd7.c floor_patch/src/cmd7.c
--- tome-225-src/src/cmd7.c     2003-12-11 13:32:40.000000000 -0700
+++ floor_patch/src/cmd7.c      2004-01-28 10:38:22.000000000 -0700
@@ -3985,7 +3985,7 @@ void do_cmd_alchemist(void)
                p_ptr->notice |= (PN_COMBINE | PN_REORDER);
 
                /* Window stuff */
-               p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
+               p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER | PW_FLOOR);
 
                /* Optimize the entire p_ptr->inventory - needed because we
                 don't know how many essences where used, and we may
@@ -4268,7 +4268,7 @@ void do_cmd_alchemist(void)
                p_ptr->notice |= (PN_COMBINE | PN_REORDER);
 
                /* Window stuff */
-               p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
+               p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER | PW_FLOOR);
 
                /******* Recharge an item *******/
        }
@@ -7104,6 +7119,7 @@ void do_cmd_summoner_extract()
                floor_item_increase( -item, -1);
                floor_item_describe( -item);
                floor_item_optimize( -item);
+               p_ptr->window |= PW_FLOOR;
        }
 
        if (magik(r_info[o_ptr->pval2].level - get_skill(SKILL_SUMMON)))
@@ -7232,6 +7248,7 @@ void summon_true(int r_idx, int item)
                        floor_item_increase(0 - item, -1);
                        floor_item_describe(0 - item);
                        floor_item_optimize(0 - item);
+                       p_ptr->window |= PW_FLOOR;
                }
        }
 
diff -udprBb --exclude='*.o' --exclude='*.raw' tome-225-src/src/defines.h floor_patch/src/defines.h
--- tome-225-src/src/defines.h  2003-12-11 13:32:40.000000000 -0700
+++ floor_patch/src/defines.h   2004-01-09 16:45:22.000000000 -0700
@@ -2325,7 +2325,7 @@
 #define PW_OVERHEAD     0x00000080L     /* Display overhead view */
 #define PW_MONSTER      0x00000100L     /* Display monster recall */
 #define PW_OBJECT       0x00000200L     /* Display object recall */
-/* xxx */
+#define PW_FLOOR        0x00000400L     /* Display Stacks of objects on the floor */
 #define PW_SNAPSHOT     0x00000800L     /* Display snap-shot */
 /* xxx */
 /* xxx */
diff -udprBb --exclude='*.o' --exclude='*.raw' tome-225-src/src/dungeon.c floor_patch/src/dungeon.c
--- tome-225-src/src/dungeon.c  2003-12-11 13:32:40.000000000 -0700
+++ floor_patch/src/dungeon.c   2004-01-09 16:57:51.000000000 -0700
@@ -892,7 +892,7 @@ bool psychometry(void)
        p_ptr->notice |= (PN_COMBINE | PN_REORDER);
 
        /* Window stuff */
-       p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
+       p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER | PW_FLOOR);
 
        /* Something happened */
        return (TRUE);
@@ -5268,7 +5268,7 @@ static void dungeon(void)
        character_xtra = TRUE;
 
        /* Window stuff */
-       p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
+       p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER | PW_FLOOR);
 
        /* Window stuff */
        p_ptr->window |= (PW_MONSTER);
@@ -5785,7 +5785,7 @@ void play_game(bool new_game)
        reset_visuals();
 
        /* Window stuff */
-       p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
+       p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER | PW_FLOOR);
 
        /* Window stuff */
        p_ptr->window |= (PW_MONSTER);
diff -udprBb --exclude='*.o' --exclude='*.raw' tome-225-src/src/externs.h floor_patch/src/externs.h
--- tome-225-src/src/externs.h  2003-12-11 13:32:40.000000000 -0700
+++ floor_patch/src/externs.h   2004-01-29 10:07:32.000000000 -0700
@@ -1156,6 +1156,7 @@ extern s16b inven_carry(object_type *o_p
 extern s16b inven_takeoff(int item, int amt, bool force_drop);
 extern void inven_drop(int item, int amt, int dy, int dx, bool silent);
 extern bool item_tester_okay(object_type *o_ptr);
+extern void display_floor(int y, int x);
 extern void display_inven(void);
 extern void display_equip(void);
 extern void show_inven(bool mirror);
diff -udprBb --exclude='*.o' --exclude='*.raw' tome-225-src/src/monster2.c floor_patch/src/monster2.c
--- tome-225-src/src/monster2.c 2003-12-11 13:32:41.000000000 -0700
+++ floor_patch/src/monster2.c  2004-01-27 16:30:44.000000000 -0700
@@ -4085,6 +4085,18 @@ void monster_drop_carried_objects(monste
 
                /* Drop it */
                drop_near(q_ptr, -1, m_ptr->fy, m_ptr->fx);
+               /* Comment on visible drops */
+               if( m_ptr->ml)
+               {
+                       char m_name[80];
+                       char o_name[80];
+                       /* get monster's name */
+                       monster_desc(m_name,m_ptr,0);
+                       /* get Object's name */
+                       object_desc(o_name,q_ptr, TRUE, 0);
+                       /* Print the message */
+                       msg_format("%s drops %s",m_name,o_name);
+               }
        }
 
        /* Forget objects */
diff -udprBb --exclude='*.o' --exclude='*.raw' tome-225-src/src/object1.c floor_patch/src/object1.c
--- tome-225-src/src/object1.c  2003-12-11 13:32:40.000000000 -0700
+++ floor_patch/src/object1.c   2004-01-29 19:18:46.000000000 -0700
@@ -5110,11 +5110,19 @@ static bool get_item_allow(int item)
  */
 static bool get_item_okay(int i)
 {
+       /* Test an item on the floor */
+       if( i < 0)
+       {
+               if(!item_tester_okay(&o_list[0-i])) return (FALSE);
+       }
+       else
+       {
        /* Illegal items */
-       if ((i < 0) || (i >= INVEN_TOTAL)) return (FALSE);
+               if (i >= INVEN_TOTAL) return (FALSE);
 
        /* Verify the item */
        if (!item_tester_okay(&p_ptr->inventory[i])) return (FALSE);
+       }
 
        /* Assume okay */
        return (TRUE);
@@ -5145,6 +5153,10 @@ static int get_tag(int *cp, char tag)
                /* Skip non-objects */
                if (!o_ptr->k_idx) continue;
 
+               /* Skip non-usefull objects */
+               if (!item_tester_okay(o_ptr))
+                       continue;
+
                /* Skip empty inscriptions */
                if (!o_ptr->note) continue;
 
@@ -5241,10 +5253,32 @@ bool scan_floor(int *items, int *item_nu
 /*
  * Display a list of the items on the floor at the given location.
  */
+void show_floor_aux(bool mirror, bool everything, int y, int x);
 void show_floor(int y, int x)
 {
+       show_floor_aux(FALSE,FALSE,y,x);
+}
+
+void display_floor(int y, int x)
+{
+       show_floor_aux(TRUE,TRUE,y,x);
+}
+
+/*
+       Displays the items on the floor, either in a shadow window, or on the main screen.
+       If on the main window, it'll be shown offset a bit to overwrite only the map.
+       Indices will be shown only for the player's location. 
+       The inventory_no_move option is respected. 
+       Weights are shown if possible. 
+       If there is a monster at the location, what they're carrying will be displayed. 
+       Mimics are show as objects if needed.
+       Only 'visible' monsters will have their inventories displayed.
+*/
+void show_floor_aux(bool mirror, bool everything, int y, int x)
+{
        int i, j, k, l;
-       int col, len, lim;
+       int col, len, lim, row, wid, hgt;
+       cave_type *c_ptr;
 
        object_type *o_ptr;
 
@@ -5258,19 +5292,36 @@ void show_floor(int y, int x)
 
        int floor_list[23], floor_num;
 
+       /* Retrive current screen size */
+       Term_get_size(&wid, &hgt);
+
        /* Default length */
-       len = 79 - 50;
+       len = wid - 50 - 1;
 
        /* Maximum space allowed for descriptions */
-       lim = 79 - 3;
+       lim = wid - 3;
 
        /* Require space for weight (if needed) */
        if (show_weights) lim -= 9;
 
+       /* Test to be sure y,x is in bounds */
+       if(!in_bounds(y,x))
+               return;
+
+       c_ptr = &cave[y][x];
+
        /* Scan for objects in the grid, using item_tester_okay() */
+       if(everything || inventory_no_move)
+               /* Ignore item_tester_okay() */
+               (void) scan_floor(floor_list, &floor_num, y, x, 0x00);
+       else
+               /* Use item_tester_okay() */
        (void) scan_floor(floor_list, &floor_num, y, x, 0x01);
 
-       /* Display the inventory */
+       /* limit display for small mirror windows */
+       if( floor_num > hgt) floor_num = hgt;
+
+       /* process the list of floor items, getting indices and descriptions */
        for (k = 0, i = 0; i < floor_num; i++)
        {
                o_ptr = &o_list[floor_list[i]];
@@ -5282,7 +5333,17 @@ void show_floor(int y, int x)
                o_name[lim] = '\0';
 
                /* Save the index */
-               out_index[k] = i;
+               if ( !everything && !item_tester_okay(o_ptr))
+               {
+                       out_index[k] = -i-1;
+                       if( !everything )
+                               continue;
+               }
+               else
+               {
+                       /* Save the object index */
+                       out_index[k] = i+1;
+               }
 
                /* Acquire inventory color */
                out_color[k] = tval_to_attr[o_ptr->tval & 0x7F];
@@ -5304,40 +5365,141 @@ void show_floor(int y, int x)
        }
 
        /* Find the column to start in */
-       col = (len > 76) ? 0 : (79 - len);
+       col = mirror ? 0 :((len > wid-4) ? 0 : (wid - len - 1));
+
+       /* Find the Row to start in */
+       row = mirror ? 0 : 1;
 
        /* Output each entry */
        for (j = 0; j < k; j++)
        {
-               /* Get the index */
-               i = floor_list[out_index[j]];
-
-               /* Get the item */
-               o_ptr = &o_list[i];
-
                /* Clear the line */
-               prt("", j + 1, col ? col - 2 : col);
+               prt("", j + row, col ? col - 2 : col);
 
                /* Prepare an index --(-- */
-               sprintf(tmp_val, "%c)", index_to_label(j));
+               if(out_index[j] < 0)
+               {
+                       sprintf(tmp_val,"  ");
+                       out_index[j]*=-1;
+               }
+               else
+                       sprintf(tmp_val, "%c)", index_to_label(out_index[j]-1));
 
                /* Clear the line with the (possibly indented) index */
-               put_str(tmp_val, j + 1, col);
+               put_str(tmp_val, j + row, col);
 
                /* Display the entry itself */
-               c_put_str(out_color[j], out_desc[j], j + 1, col + 3);
+               c_put_str(out_color[j], out_desc[j], j + row, col + 3);
 
                /* Display the weight if needed */
                if (show_weights)
                {
+                       i = floor_list[out_index[j] - 1 ];
+
+                       /* Get the item */
+                       o_ptr = &o_list[i];
+
                        int wgt = o_ptr->weight * o_ptr->number;
                        sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
-                       put_str(tmp_val, j + 1, 71);
+                       put_str(tmp_val, j + row, wid-9);
+               }
+       }
+       row += j;
+       /* Display the monster's name, and any objects they're holding... */
+       if (c_ptr->m_idx)
+       {
+               monster_type *m_ptr = &m_list[c_ptr->m_idx];
+               monster_race *r_ptr = race_inf(m_ptr);
+               int this_o_idx = m_ptr->hold_o_idx;
+               int next_o_idx;
+               
+               /* Mimics special treatment -- looks like an object */
+               /* Only Visible monsters get shown */
+               if ( !((r_ptr->flags9 & RF9_MIMIC) && (m_ptr->csleep)) && m_ptr->ml)
+               {
+                       char *mstat;
+
+                       /* Get the monster name ("the kobold") */
+                       monster_desc(o_name, m_ptr, 0x04);
+
+                       /* HACK! Capitalize the sentance... */
+                       o_name[0] ^= ' ';
+
+                       switch (m_ptr->status)
+                       {
+                       case MSTATUS_NEUTRAL:
+                       case MSTATUS_NEUTRAL_M:
+                       case MSTATUS_NEUTRAL_P:
+                               mstat = " (neutral) ";
+                               break;
+                       case MSTATUS_PET:
+                               mstat = " (pet) ";
+                               break;
+                       case MSTATUS_FRIEND:
+                               mstat = " (coaligned) ";
+                               break;
+                       case MSTATUS_COMPANION:
+                               mstat = " (companion) ";
+                               break;
+                       default:
+                               mstat = " ";
+                               break;
                }
+                       if (m_ptr->mflag & MFLAG_PARTIAL) mstat = " (partial) ";
+                       if(this_o_idx)
+                               sprintf(tmp_val,"%s%sis carrying:",o_name,mstat);
+                       else
+                               sprintf(tmp_val,"%s%sisn't carrying anything.",o_name,mstat);
+                       prt(tmp_val, row++, col ? col - 2 : col);
        }
 
+               /* Scan all objects being carried */
+               if ( ((r_ptr->flags9 & RF9_MIMIC) && (m_ptr->csleep)) || m_ptr->ml)
+               for (this_o_idx = m_ptr->hold_o_idx; this_o_idx; this_o_idx = next_o_idx)
+               {
+                       /* Acquire object */
+                       o_ptr = &o_list[this_o_idx];
+
+                       /* Acquire next object */
+                       next_o_idx = o_ptr->next_o_idx;
+
+                       /* Obtain an object description */
+                       object_desc(o_name, o_ptr, TRUE, 3);
+
+                       /* Clear the line. */
+                       prt("", row, col ? col - 2 : col);
+
+                       /* Display the entry itself */
+                       c_put_str(tval_to_attr[o_ptr->tval & 0x7F], o_name, row, col + 3);
+
+                       /* Display the weight if needed */
+                       if (show_weights)
+                       {
+                               int wgt = o_ptr->weight * o_ptr->number;
+                               sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
+                               put_str(tmp_val, row, wid-9);
+                       }
+                       row++;
+                       if( !(row < hgt) )
+                               break;
+               }
+       }
+       /* Shadow windows */
+       if (mirror)
+       {
+               /* Erase the rest of the window */
+               for (j = row ; j < hgt; j++)
+               {
+                       /* Erase the line */
+                       Term_erase(0, j, 255);
+               }
+       }
+       /* Main window */
+       else
+       {
        /* Make a "shadow" below the list (only if needed) */
-       if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
+               if (row && (row < 23)) prt("", row , col ? col - 2 : col);
+       }
 }
 
 /*
@@ -5349,7 +5511,7 @@ bool get_item_floor(int *cp, cptr pmt, c
 {
        char n1 = 0, n2 = 0, which = ' ';
 
-       int j, k, i1, i2, e1, e2;
+       int j, k, i1, i2, e1, e2, f1, f2;
 
        bool done, item;
 
@@ -5370,7 +5532,7 @@ bool get_item_floor(int *cp, cptr pmt, c
        char tmp_val[160];
        char out_val[160];
 
-       int floor_num, floor_list[23], floor_top = 0;
+       int floor_num, floor_list[23];
 
 #ifdef ALLOW_REPEAT
 
@@ -5462,13 +5624,28 @@ bool get_item_floor(int *cp, cptr pmt, c
 
 
        /* Count "okay" floor items */
-       floor_num = 0;
+       f1 = f2 = floor_num = 0;
 
        /* Restrict floor usage */
        if (floor)
        {
                /* Scan all objects in the grid */
+               if(inventory_no_move)
+               {
+                       (void) scan_floor(floor_list, &floor_num, p_ptr->py, p_ptr->px, 0x00);
+                       f1=0;f2=MIN(23,floor_num)-1;
+                       while ((f1 <= f2) && (!get_item_okay(0-floor_list[f1]))) f1++;
+                       while ((f1 <= f2) && (!get_item_okay(0-floor_list[f2]))) f2--;
+               }
+               else
+               {
                (void) scan_floor(floor_list, &floor_num, p_ptr->py, p_ptr->px, 0x01);
+                       f1=0;f2=MIN(23,floor_num)-1;
+               }
+
+               /* Display Truncated list of floor items */
+               p_ptr->window |= (PW_FLOOR);
+               window_stuff();
        }
 
        /* Accept inventory */
@@ -5478,7 +5655,8 @@ bool get_item_floor(int *cp, cptr pmt, c
        if (e1 <= e2) allow_equip = TRUE;
 
        /* Accept floor */
-       if (floor_num) allow_floor = TRUE;
+       if (f1 <= f2) allow_floor = TRUE;
+
 
        /* Require at least one legal choice */
        if (!allow_inven && !allow_equip && !allow_floor)
@@ -5537,6 +5715,7 @@ bool get_item_floor(int *cp, cptr pmt, c
                {
                        int ni = 0;
                        int ne = 0;
+                       int fl = 0;
 
                        /* Scan windows */
                        for (j = 0; j < 8; j++)
@@ -5594,12 +5773,9 @@ bool get_item_floor(int *cp, cptr pmt, c
                /* Floor screen */
                else if (command_wrk == (USE_FLOOR))
                {
-                       j = floor_top;
-                       k = MIN(floor_top + 23, floor_num) - 1;
-
                        /* Extract the legal requests */
-                       n1 = I2A(j - floor_top);
-                       n2 = I2A(k - floor_top);
+                       n1 = I2A(f1);
+                       n2 = I2A(f2);
 
                        /* Redraw if needed */
                        if (command_see) show_floor(p_ptr->py, p_ptr->px);
@@ -5805,10 +5981,22 @@ bool get_item_floor(int *cp, cptr pmt, c
                                 * one item, we will select it if floor_query_flag
                                 * is FALSE.
                                 */
-                               if (floor_num == 1)
-                               {
                                        if (command_wrk == (USE_FLOOR))
                                        {
+                                       k = 0;
+
+                                       /* scan the floor, stoping at the first acceptable item. */
+                                       /* Note that this call *should* always return a list of one. */
+                                       /* but we'll check that anyway */
+                                       (void) scan_floor(floor_list, &floor_num, p_ptr->py, p_ptr->px, 0x05);
+
+                                       /* Check that we got an item */
+                                       if( floor_num <= 0 )
+                                       {
+                                               bell();
+                                               break;
+                                       }
+
                                                /* Special index */
                                                k = 0 - floor_list[0];
 
@@ -5826,7 +6014,6 @@ bool get_item_floor(int *cp, cptr pmt, c
 
                                                break;
                                        }
-                               }
 
                                /* Hack -- Fix screen */
                                if (command_see)
@@ -5895,35 +6076,28 @@ bool get_item_floor(int *cp, cptr pmt, c
                                /* Choose "default" inventory item */
                                if (command_wrk == (USE_INVEN))
                                {
-                                       k = ((i1 == i2) ? i1 : -1);
+                                       k = i1;
                                }
 
                                /* Choose "default" equipment item */
                                else if (command_wrk == (USE_EQUIP))
                                {
-                                       k = ((e1 == e2) ? e1 : -1);
+                                       k = e1;
                                }
 
                                /* Choose "default" floor item */
                                else if (command_wrk == (USE_FLOOR))
                                {
-                                       if (floor_num == 1)
-                                       {
                                                /* Special index */
                                                k = 0 - floor_list[0];
-
-                                               /* Allow player to "refuse" certain actions */
-                                               if (!get_item_allow(k))
-                                               {
-                                                       done = TRUE;
-                                                       break;
                                                }
 
-                                               /* Accept that choice */
-                                               (*cp) = k;
-                                               item = TRUE;
-                                               done = TRUE;
-                                       }
+                               /* Break if more than one item in current list */
+                               if( (command_wrk == (USE_FLOOR) && floor_num != 1 ) 
+                               ||  (command_wrk == (USE_EQUIP) && e1 != e2)
+                               ||  (command_wrk == (USE_INVEN) && i1 != i2))
+                               {
+                                       bell();
                                        break;
                                }
 
@@ -6011,7 +6185,7 @@ bool get_item_floor(int *cp, cptr pmt, c
                                }
 
                                /* Validate the item */
-                               if ((k >= 0) && !get_item_okay(k))
+                               if (!get_item_okay(k))
                                {
                                        bell();
                                        break;
@@ -6057,18 +6231,6 @@ bool get_item_floor(int *cp, cptr pmt, c
        /* Forget the item_tester_hook restriction */
        item_tester_hook = NULL;
 
-       /* Track */
-       if (item && done)
-       {
-               if (*cp >= 0)
-               {
-                       object_track(&p_ptr->inventory[*cp]);
-               }
-               else
-               {
-                       object_track(&o_list[0 - *cp]);
-               }
-       }
 
        /* Clean up */
        if (show_choices)
@@ -6077,7 +6239,7 @@ bool get_item_floor(int *cp, cptr pmt, c
                if (toggle) toggle_inven_equip();
 
                /* Update */
-               p_ptr->window |= (PW_INVEN | PW_EQUIP);
+               p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_FLOOR);
 
                /* Window stuff */
                window_stuff();
@@ -6447,7 +6609,7 @@ void py_pickup_floor(int pickup)
                        p_ptr->redraw |= (PR_GOLD);
 
                        /* Window stuff */
-                       p_ptr->window |= (PW_PLAYER);
+                       p_ptr->window |= (PW_PLAYER | PW_FLOOR);
 
                        /* Delete the gold */
                        delete_object_idx(this_o_idx);
@@ -6566,6 +6729,7 @@ void py_pickup_floor(int pickup)
        if (do_pickup)
        {
                object_pickup(this_o_idx);
+               p_ptr->window |= (PW_FLOOR);
        }
 }
 
diff -udprBb --exclude='*.o' --exclude='*.raw' tome-225-src/src/object2.c floor_patch/src/object2.c
--- tome-225-src/src/object2.c  2003-12-11 13:32:40.000000000 -0700
+++ floor_patch/src/object2.c   2004-01-09 17:00:05.000000000 -0700
@@ -5428,6 +5428,10 @@ s16b drop_near(object_type *j_ptr, int c
                sound(SOUND_DROP);
        }
 
+       /* Update the mirror window list of items on the floor */
+       if ( by == p_ptr->py && bx == p_ptr->px )
+               p_ptr->window |= PW_FLOOR;
+
        /* XXX XXX XXX */
 
        /* Result */
@@ -5708,6 +5712,9 @@ void floor_item_increase(int item, int n
 
        /* Change the number */
        o_ptr->number += num;
+
+       /* Update the mirror Window */
+       p_ptr->window |= PW_FLOOR;
 }
 
 
@@ -5726,6 +5733,9 @@ void floor_item_optimize(int item)
 
        /* Delete the object */
        delete_object_idx(item);
+
+       /* Update the mirror Window */
+       p_ptr->window |= PW_FLOOR;
 }
 
 
diff -udprBb --exclude='*.o' --exclude='*.raw' tome-225-src/src/powers.c floor_patch/src/powers.c
--- tome-225-src/src/powers.c   2003-12-11 13:32:41.000000000 -0700
+++ floor_patch/src/powers.c    2004-01-09 17:00:42.000000000 -0700
@@ -244,7 +244,7 @@ static void power_activate(int power)
                                        p_ptr->notice |= (PN_COMBINE);
 
                                        /* Window stuff */
-                                       p_ptr->window |= (PW_INVEN | PW_EQUIP);
+                                       p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_FLOOR);
                                }
                        }
                }
@@ -1118,7 +1118,7 @@ static void power_activate(int power)
                        }
 
                        p_ptr->notice |= (PN_COMBINE | PN_REORDER);
-                       p_ptr->window |= (PW_INVEN);
+                       p_ptr->window |= (PW_INVEN | PW_FLOOR);
                }
                break;
 
diff -udprBb --exclude='*.o' --exclude='*.raw' tome-225-src/src/randart.c floor_patch/src/randart.c
--- tome-225-src/src/randart.c  2003-12-11 13:32:40.000000000 -0700
+++ floor_patch/src/randart.c   2004-01-09 17:01:01.000000000 -0700
@@ -392,7 +392,7 @@ bool create_artifact(object_type *o_ptr,
        o_ptr->name2 = o_ptr->name2b = 0;
 
        /* Window stuff */
-       p_ptr->window |= (PW_INVEN | PW_EQUIP);
+       p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_FLOOR);
 
        /* HACKS for ToME */
        if (o_ptr->tval == TV_CLOAK && o_ptr->sval == SV_MIMIC_CLOAK)
diff -udprBb --exclude='*.o' --exclude='*.raw' tome-225-src/src/spells1.c floor_patch/src/spells1.c
--- tome-225-src/src/spells1.c  2003-12-11 13:32:39.000000000 -0700
+++ floor_patch/src/spells1.c   2004-01-29 10:14:11.000000000 -0700
@@ -4279,6 +4321,13 @@ static bool project_o(int who, int r, in
 
                                /* Redraw */
                                lite_spot(y, x);
+
+                               /* Conditionally redraw the 'floor items' window */
+                               if( y == p_ptr->py && x == p_ptr->px)
+                               {
+                                       p_ptr->window |= PW_FLOOR;
+                               }
+
                        }
                }
        }
diff -udprBb --exclude='*.o' --exclude='*.raw' tome-225-src/src/spells2.c floor_patch/src/spells2.c
--- tome-225-src/src/spells2.c  2003-12-11 13:32:40.000000000 -0700
+++ floor_patch/src/spells2.c   2004-01-09 17:05:48.000000000 -0700
@@ -4304,7 +4304,7 @@ bool ident_spell(void)
        p_ptr->notice |= (PN_COMBINE | PN_REORDER);
 
        /* Window stuff */
-       p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
+       p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER | PW_FLOOR);
 
        /* Description */
        object_desc(o_name, o_ptr, TRUE, 3);
@@ -4437,7 +4437,7 @@ bool identify_fully(void)
        p_ptr->notice |= (PN_COMBINE | PN_REORDER);
 
        /* Window stuff */
-       p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
+       p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER | PW_FLOOR);
 
        /* Handle stuff */
        handle_stuff();
diff -udprBb --exclude='*.o' --exclude='*.raw' tome-225-src/src/tables.c floor_patch/src/tables.c
--- tome-225-src/src/tables.c   2003-12-11 13:32:40.000000000 -0700
+++ floor_patch/src/tables.c    2004-01-30 10:25:24.000000000 -0700
@@ -1306,7 +1306,7 @@ cptr window_flag_desc[32] =
        "Display overhead view",
        "Display monster recall",
        "Display object recall",
-       NULL,
+       "Display Floor objects",
        "Display snap-shot",
        NULL,
        NULL,
diff -udprBb --exclude='*.o' --exclude='*.raw' tome-225-src/src/xtra1.c floor_patch/src/xtra1.c
--- tome-225-src/src/xtra1.c    2003-12-11 13:32:41.000000000 -0700
+++ floor_patch/src/xtra1.c     2004-01-30 13:54:52.000000000 -0700
@@ -1167,6 +1167,41 @@ static void fix_equip(void)
        }
 }
 
+
+/*
+ * Hack -- display inventory in sub-windows
+ */
+static void fix_floor(void)
+{
+       int j;
+
+       /* Scan windows */
+       for (j = 0; j < 8; j++)
+       {
+               term *old = Term;
+
+               /* No window */
+               if (!angband_term[j]) continue;
+
+               /* No relevant flags */
+               if (!(window_flag[j] & (PW_FLOOR))) continue;
+
+               /* Activate */
+               Term_activate(angband_term[j]);
+
+               /* Display inventory */
+               display_floor(p_ptr->py,p_ptr->px);
+
+               /* Fresh */
+               Term_fresh();
+
+               /* Restore */
+               Term_activate(old);
+       }
+}
+
+
+
 /*
  * Hack -- display character in sub-windows
  */
@@ -4404,6 +4636,13 @@ void window_stuff(void)
                fix_equip();
        }
 
+       /* Display equipment */
+       if (p_ptr->window & (PW_FLOOR))
+       {
+               p_ptr->window &= ~(PW_FLOOR);
+               fix_floor();
+       }
+
        /* Display player */
        if (p_ptr->window & (PW_PLAYER))
        {
diff -udprBb --exclude='*.o' --exclude='*.raw' tome-225-src/src/xtra2.c floor_patch/src/xtra2.c
--- tome-225-src/src/xtra2.c    2003-12-11 13:32:40.000000000 -0700
+++ floor_patch/src/xtra2.c     2004-01-29 11:04:57.000000000 -0700
@@ -5697,6 +5697,8 @@ static int target_set_aux(int y, int x, 
 
        int query;
 
+       int i;
+
        char out_val[160];
 
 
@@ -5724,6 +5726,32 @@ static int target_set_aux(int y, int x, 
                        s2 = "on ";
                }
 
+               /* Update floor stacks window to show objects */
+               for (i = 0; i < 8; i++)
+               {
+                       term *old = Term;
+
+                       /* No window */
+                       if (!angband_term[i]) continue;
+
+                       /* No relevant flags */
+                       if (!(window_flag[i] & (PW_FLOOR))) continue;
+
+                       /* Activate */
+                       Term_activate(angband_term[i]);
+
+                       /* Display inventory */
+                       display_floor(y,x);
+
+                       /* Fresh */
+                       Term_fresh();
+
+                       /* Restore */
+                       Term_activate(old);
+
+               }
+
+
 
                /* Hack -- hallucination */
                if (p_ptr->image)
@@ -6494,7 +6521,7 @@ bool target_set(int mode)
        p_ptr->redraw |= (PR_MAP);
 
        /* Window stuff */
-       p_ptr->window |= (PW_OVERHEAD);
+       p_ptr->window |= (PW_OVERHEAD | PW_FLOOR);
 
        /* Handle stuff */
        handle_stuff();

IdeaArchive/Interface/Items I'm standing on window (last edited 2006-03-08 02:46:31 by JohnGilmore)