Index: src/cmd4.c =================================================================== --- src/cmd4.c (revision 2930) +++ src/cmd4.c (working copy) @@ -2580,7 +2580,8 @@ p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER | PW_MESSAGE | PW_OVERHEAD | PW_MONSTER | PW_OBJECT | PW_SNAPSHOT | - PW_BORG_1 | PW_BORG_2 | PW_DUNGEON); + PW_BORG_1 | PW_BORG_2 | PW_DUNGEON | + PW_MONSTER_LIST); break; } Index: src/xtra2.c =================================================================== --- src/xtra2.c (revision 2930) +++ src/xtra2.c (working copy) @@ -3031,6 +3031,9 @@ } } +void target_set_prepare_look(){ + target_set_prepare(TARGET_LOOK); +} /* * Evaluate number of kill needed to gain level @@ -3770,6 +3773,7 @@ int wid, hgt; + bool first_look = (mode&TARGET_LOOK)!=0; /* Get size */ get_screen_size(&wid, &hgt); @@ -3824,8 +3828,24 @@ } + /* if first look, show monster list */ + if(first_look){ + int w,h; + Term_get_size(&w, &h); + print_monster_list(13, 1, h-3);//-3 = -1(top) -2(bottom) + //first_look = FALSE; + } + /* Describe and Prompt */ - while (!(query = target_set_aux(y, x, mode, info))); + while (TRUE){ + query = target_set_aux(y, x, mode, info); + if(first_look){ + p_ptr->redraw |= PR_MAP; + handle_stuff(); + first_look = FALSE; + } + if(query)break; + } /* Cancel tracking */ /* health_track(0); */ Index: src/defines.h =================================================================== --- src/defines.h (revision 2930) +++ src/defines.h (working copy) @@ -527,7 +527,7 @@ /* * Random energy */ -#define ENERGY_NEED() (randnor(100, 25)) +#define ENERGY_NEED() (randnor(100, 31)) /* @@ -2777,8 +2777,8 @@ #define PW_EQUIP 0x00000002L /* Display equip/inven */ #define PW_SPELL 0x00000004L /* Display spell list */ #define PW_PLAYER 0x00000008L /* Display character */ +#define PW_MONSTER_LIST 0x00000010L /* Display monster list */ /* xxx */ -/* xxx */ #define PW_MESSAGE 0x00000040L /* Display messages */ #define PW_OVERHEAD 0x00000080L /* Display overhead view */ #define PW_MONSTER 0x00000100L /* Display monster recall */ Index: src/cmd3.c =================================================================== --- src/cmd3.c (revision 2930) +++ src/cmd3.c (working copy) @@ -1746,6 +1746,11 @@ */ void do_cmd_look(void) { +/*TEST*/ + p_ptr->window |= PW_MONSTER_LIST; + window_stuff(); +/*TEST*/ + /* Look around */ if (target_set(TARGET_LOOK)) { Index: src/xtra1.c =================================================================== --- src/xtra1.c (revision 2930) +++ src/xtra1.c (working copy) @@ -1812,9 +1812,152 @@ } } +/* + * Print monster info in line + * nnn X LV name + * nnn : number or unique(U) or wanted unique(W) + * X : symbol of monster + * LV : monster lv if known + * name: name of monster + */ +static void print_monster_line(int x, int y, monster_type* m_ptr, int n_same){ + char buf[256]; + int i; + int r_idx = m_ptr->ap_r_idx; + monster_race* r_ptr = &r_info[r_idx]; + Term_gotoxy(x, y); + if(!r_ptr)return; + //Number of 'U'nique + if(r_ptr->flags1&RF1_UNIQUE){//unique + bool is_kubi = FALSE; + for(i=0;id_attr, r_ptr->d_char); + //Term_addstr(-1, TERM_WHITE, "/"); + Term_add_bigch(r_ptr->x_attr, r_ptr->x_char); + //LV + if (r_ptr->r_tkills && !(m_ptr->mflag2 & MFLAG2_KAGE)){ + sprintf(buf, " %2d", r_ptr->level); + }else{ + strcpy(buf, " ??"); + } + Term_addstr(-1, TERM_WHITE, buf); + //name + sprintf(buf, " %s ", r_name+r_ptr->name); + Term_addstr(-1, TERM_WHITE, buf); + //Term_addstr(-1, TERM_WHITE, look_mon_desc(m_ptr, 0)); +} + /* + max_lines : 最大何行描画するか. +*/ +void print_monster_list(int x, int y, int max_lines){ + int line = y; + monster_type* last_mons = NULL; + monster_type* m_ptr = NULL; + int n_same = 0; + int i; + + for(i=0;im_idx || !m_list[c_ptr->m_idx].ml)continue;//no mons or cannot look + m_ptr = &m_list[c_ptr->m_idx]; + if(is_pet(m_ptr))continue;//pet + if(!m_ptr->r_idx)continue;//dead? + { + int r_idx = m_ptr->ap_r_idx; + monster_race* r_ptr = &r_info[r_idx]; + cptr name = (r_name + r_ptr->name); + cptr ename = (r_name + r_ptr->name); + //ミミック類や「それ」等は、一覧に出てはいけない + if(r_ptr->flags1&RF1_CHAR_CLEAR)continue; + if((r_ptr->flags1&RF1_NEVER_MOVE)&&(r_ptr->flags2&RF2_CHAR_MULTI))continue; + //『ヌル』は、一覧に出てはいけない + if((strcmp(name, "生ける虚無『ヌル』")==0)|| + (strcmp(ename, "Null the Living Void")==0))continue; + //"金無垢の指輪"は、一覧に出てはいけない + if((strcmp(name, "金無垢の指輪")==0)|| + (strcmp(ename, "Plain Gold Ring")==0))continue; + } + + //ソート済みなので同じモンスターは連続する.これを利用して同じモンスターをカウント,まとめて表示する. + if(!last_mons){//先頭モンスター + last_mons = m_ptr; + n_same = 1; + continue; + } + //same race? + if(last_mons->ap_r_idx == m_ptr->ap_r_idx){ + n_same++; + continue;//表示処理を次に回す + } + //print last mons info + print_monster_line(x, line++, last_mons, n_same); + n_same = 1; + last_mons = m_ptr; + if(line-y-1==max_lines){//残り1行 + break; + } + } + if(line-y-1==max_lines && i!=temp_n){ + Term_gotoxy(x, line); + Term_addstr(-1, TERM_WHITE, "-- and more --"); + }else{ + if(last_mons)print_monster_line(x, line++, last_mons, n_same); + } +} +/* + * Hack -- display monster list in sub-windows + */ +static void fix_monster_list(void) +{ + int j; + int w, h; + + /* 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_MONSTER_LIST))) continue; + + /* Activate */ + Term_activate(angband_term[j]); + Term_get_size(&w, &h); + + Term_clear(); + + target_set_prepare_look();//モンスター一覧を生成,ソート + print_monster_list(0, 0, h); + + /* Fresh */ + Term_fresh(); + + /* Restore */ + Term_activate(old); + } +} + + + +/* * Hack -- display recent messages in sub-windows * * XXX XXX XXX Adjust for width and split messages @@ -5990,6 +6133,13 @@ fix_player(); } + /* Display monster list */ + if (p_ptr->window & (PW_MONSTER_LIST)) + { + p_ptr->window &= ~(PW_MONSTER_LIST); + fix_monster_list(); + } + /* Display overhead view */ if (p_ptr->window & (PW_MESSAGE)) { Index: src/tables.c =================================================================== --- src/tables.c (revision 2930) +++ src/tables.c (working copy) @@ -5344,8 +5344,13 @@ "Display character", #endif +#ifdef JP + "モンスターリスト", +#else + "Display monster list", +#endif + NULL, - NULL, #ifdef JP "メッセージ", #else Index: src/externs.h =================================================================== --- src/externs.h (revision 2930) +++ src/externs.h (working copy) @@ -1376,8 +1376,10 @@ extern void handle_stuff(void); extern s16b empty_hands(bool riding_control); extern bool heavy_armor(void); +extern void print_monster_list(int x, int y, int max_lines); + /* effects.c */ extern void set_action(int typ); extern void reset_tim_flags(void); @@ -1467,6 +1469,7 @@ extern bool target_able(int m_idx); extern bool target_okay(void); extern bool target_set(int mode); +extern void target_set_prepare_look(); extern bool get_aim_dir(int *dp); extern bool get_hack_dir(int *dp); extern bool get_rep_dir(int *dp, bool under);