From 2194eb2a7e65d9ce5ceb9764eee9c07aef7941e5 Mon Sep 17 00:00:00 2001 From: mogami Date: Thu, 21 Nov 2002 14:13:13 +0000 Subject: [PATCH] =?utf8?q?easy=5Ffloor=EF=BD=BB=EF=BE=88=EF=BE=8D=EF=BE=91?= =?utf8?q?=EF=BE=83=E8=AE=80=EF=BE=8E=20look/target=20=EF=BD=A5=EF=BD=B3?= =?utf8?q?=EF=BD=A5=EF=BE=9E=EF=BD=A5=EE=8A=98=EF=BE=89=EF=BD=A4=EE=87=B2?= =?utf8?q?=EF=BE=88=EF=BD=A4=EF=BD=A4=EF=BD=A4=E8=8D=80=EF=BD=B9=EF=BD=A4?= =?utf8?q?=EF=BD=AF=EF=BD=A4=EF=BD=B7=EF=BD=A4=EF=BD=BF=EF=BD=A1=EF=BD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/cmd4.c | 2 +- src/externs.h | 2 +- src/xtra2.c | 940 +++++++++++++++++++++++++++++----------------------------- 3 files changed, 474 insertions(+), 470 deletions(-) diff --git a/src/cmd4.c b/src/cmd4.c index c285534f0..4c77be355 100644 --- a/src/cmd4.c +++ b/src/cmd4.c @@ -7011,7 +7011,7 @@ static void do_cmd_knowledge_pets(void) char pet_name[80]; t_friends++; monster_desc(pet_name, m_ptr, 0x88); - fprintf(fff, "%s (%s)", pet_name, look_mon_desc(i)); + fprintf(fff, "%s (%s)", pet_name, look_mon_desc(i, 0x00)); if (p_ptr->riding == i) #ifdef JP fprintf(fff, " ¾èÇÏÃæ"); diff --git a/src/externs.h b/src/externs.h index 3cc190668..93c08154d 100644 --- a/src/externs.h +++ b/src/externs.h @@ -1291,7 +1291,7 @@ extern void resize_map(void); extern void redraw_window(void); extern bool change_panel(int dy, int dx); extern void verify_panel(void); -extern cptr look_mon_desc(int m_idx); +extern cptr look_mon_desc(int m_idx, u32b mode); extern void ang_sort_aux(vptr u, vptr v, int p, int q); extern void ang_sort(vptr u, vptr v, int n); extern bool target_able(int m_idx); diff --git a/src/xtra2.c b/src/xtra2.c index 56856a96d..b08e7c635 100644 --- a/src/xtra2.c +++ b/src/xtra2.c @@ -2421,13 +2421,15 @@ void verify_panel(void) /* * Monster health description */ -cptr look_mon_desc(int m_idx) +cptr look_mon_desc(int m_idx, u32b mode) { monster_type *m_ptr = &m_list[m_idx]; monster_race *ap_r_ptr = &r_info[m_ptr->ap_r_idx]; bool living; int perc; - cptr desc = NULL; + cptr desc; + cptr attitude; + cptr clone; /* Determine if the monster is "living" */ living = monster_living(ap_r_ptr); @@ -2486,21 +2488,64 @@ cptr look_mon_desc(int m_idx) #endif } + + /* Need attitude information? */ + if (!(mode & 0x01)) + { + /* Full information is not needed */ + attitude = ""; + } + else if (is_pet(m_ptr)) + { +#ifdef JP + attitude = ", ¥Ú¥Ã¥È"; +#else + attitude = ", pet"; +#endif + } + else if (is_friendly(m_ptr)) + { +#ifdef JP + attitude = ", ͧ¹¥Åª"; +#else + attitude = ", friendly"; +#endif + } + else + { +#ifdef JP + attitude = ""; +#else + attitude = ""; +#endif + } + + + /* Clone monster? */ + if (m_ptr->smart & SM_CLONED) + { + clone = ", clone"; + } + else + { + clone = ""; + } + /* Display monster's level --- idea borrowed from ToME */ if (ap_r_ptr->r_tkills && !(m_ptr->mflag2 & MFLAG_KAGE)) { #ifdef JP - return format("¥ì¥Ù¥ë%d, %s", ap_r_ptr->level, desc); + return format("¥ì¥Ù¥ë%d, %s%s%s", ap_r_ptr->level, desc, attitude, clone); #else - return format("Level %d, %s", ap_r_ptr->level, desc); + return format("Level %d, %s%s%s", ap_r_ptr->level, desc, attitude, clone); #endif } else { #ifdef JP - return format("¥ì¥Ù¥ë???, %s", desc); + return format("¥ì¥Ù¥ë???, %s%s%s", desc, attitude, clone); #else - return format("Level ???, %s", desc); + return format("Level ???, %s%s%s", desc, attitude, clone); #endif } } @@ -2934,6 +2979,67 @@ static void target_set_prepare(int mode) /* + * Evaluate number of kill needed to gain level + */ +static void evaluate_monster_exp(char *buf, monster_type *m_ptr) +{ +#define M_INT_GREATER(h1,l1,h2,l2) ( (h1>h2)||( (h1==h2)&&(l1>=l2))) +#define M_INT_SUB(h1,l1, h2,l2) {h1-=h2;if(l1=0x10000L){l1&=0xFFFF;h1++;}} +#define M_INT_LSHIFT(h1,l1) {h1=(h1<<1)|(l1>>15);l1=(l1<<1)&0xffff;} +#define M_INT_RSHIFT(h1,l1) {l1=(l1>>1)|((h1&1)<<15);h1>>=1;} +#define M_INT_MULT(h1,l1,mul,h2,l2) {l2=(l1*mul)&0xffff;h2=((l1*mul)>>16)+h1*mul;} + + monster_race *ap_r_ptr = &r_info[m_ptr->ap_r_idx]; + + u32b tmp_h,tmp_l; + int bit,result; + u32b exp_mon= (ap_r_ptr->mexp)*(ap_r_ptr->level); + u32b exp_mon_h= exp_mon / (p_ptr->max_plv+2); + u32b exp_mon_l= ((exp_mon % (p_ptr->max_plv+2))*0x10000/(p_ptr->max_plv+2))&0xFFFF; + + u32b exp_adv_h = player_exp[p_ptr->lev -1] * p_ptr->expfact /100; + u32b exp_adv_l = ((player_exp[p_ptr->lev -1]%100) * p_ptr->expfact *0x10000/100)&0xFFFF; + + M_INT_SUB(exp_adv_h, exp_adv_l, p_ptr->exp, p_ptr->exp_frac); + if ((p_ptr->lev>=PY_MAX_LEVEL) || (p_ptr->prace == RACE_ANDROID)) + sprintf(buf,"**"); + else if (!ap_r_ptr->r_tkills || (m_ptr->mflag2 & MFLAG_KAGE)) + sprintf(buf,"??"); + else if (M_INT_GREATER(exp_mon_h, exp_mon_l, exp_adv_h, exp_adv_l)) + sprintf(buf,"001"); + else + { + M_INT_MULT(exp_mon_h, exp_mon_l, 1000,tmp_h, tmp_l); + if( M_INT_GREATER(exp_adv_h, exp_adv_l, tmp_h, tmp_l) ) + sprintf(buf,"999"); + else + { + bit=1; result=0; + M_INT_ADD(exp_adv_h, exp_adv_l, exp_mon_h, exp_mon_l); + M_INT_SUB(exp_adv_h, exp_adv_l, 0, 1); + while(M_INT_GREATER(exp_adv_h, exp_adv_l, exp_mon_h,exp_mon_l)) + { + M_INT_LSHIFT(exp_mon_h,exp_mon_l); + bit <<= 1; + } + M_INT_RSHIFT(exp_mon_h,exp_mon_l);bit>>=1; + for(;bit>=1;bit>>=1) + { + if(M_INT_GREATER(exp_adv_h,exp_adv_l,exp_mon_h,exp_mon_l)) + { + result |= bit; + M_INT_SUB(exp_adv_h,exp_adv_l,exp_mon_h,exp_mon_l); + } + M_INT_RSHIFT(exp_mon_h,exp_mon_l); + } + sprintf(buf,"%03d",result); + } + } +} + + +/* * Examine a grid, return a keypress. * * The "mode" argument contains the "TARGET_LOOK" bit flag, which @@ -2957,686 +3063,583 @@ static void target_set_prepare(int mode) static int target_set_aux(int y, int x, int mode, cptr info) { cave_type *c_ptr = &cave[y][x]; - s16b this_o_idx, next_o_idx = 0; - - cptr s1, s2, s3; - - bool boring; - + cptr s1 = "", s2 = "", s3 = "", x_info = ""; + bool boring = TRUE; byte feat; - - int query; - + int query = '\001'; char out_val[MAX_NLEN+80]; +#ifdef ALLOW_EASY_FLOOR + int floor_list[23], floor_num = 0; - /* Repeat forever */ - while (1) + /* Scan all objects in the grid */ + if (easy_floor && (mode & TARGET_LOOK)) { - /* Paranoia */ - query = ' '; + floor_num = scan_floor(floor_list, y, x, 0x02); - /* Assume boring */ - boring = TRUE; - - /* Default */ + if (floor_num) + { #ifdef JP -s1 = ""; + x_info = "xʪ "; #else - s1 = "You see "; + x_info = "x,"; #endif + } + } - s2 = ""; - s3 = ""; +#endif /* ALLOW_EASY_FLOOR */ - /* Hack -- under the player */ - if ((y == py) && (x == px)) - { - /* Description */ + /* Hack -- under the player */ + if ((y == py) && (x == px)) + { + /* Description */ #ifdef JP - s1 = "¤¢¤Ê¤¿¤Ï"; - s2 = "¤Î¾å"; - s3 = "¤Ë¤¤¤ë"; + s1 = "¤¢¤Ê¤¿¤Ï"; + s2 = "¤Î¾å"; + s3 = "¤Ë¤¤¤ë"; #else - s1 = "You are "; + s1 = "You are "; - /* Preposition */ - s2 = "on "; + /* Preposition */ + s2 = "on "; #endif - - } - else - { + } + else + { #ifdef JP - s1 = "¥¿¡¼¥²¥Ã¥È:"; + s1 = "¥¿¡¼¥²¥Ã¥È:"; #else - s1 = "Target:"; + s1 = "Target:"; #endif - } + } - /* Hack -- hallucination */ - if (p_ptr->image) - { + /* Hack -- hallucination */ + if (p_ptr->image) + { #ifdef JP -cptr name = "²¿¤«´ñ̯¤Êʪ"; + cptr name = "²¿¤«´ñ̯¤Êʪ"; #else - cptr name = "something strange"; + cptr name = "something strange"; #endif - /* Display a message */ + /* Display a message */ #ifdef JP - sprintf(out_val, "%s%s%s%s [%s]", s1, name, s2, s3, info); + sprintf(out_val, "%s%s%s%s [%s]", s1, name, s2, s3, info); #else - sprintf(out_val, "%s%s%s%s [%s]", s1, s2, s3, name, info); + sprintf(out_val, "%s%s%s%s [%s]", s1, s2, s3, name, info); #endif - prt(out_val, 0, 0); - move_cursor_relative(y, x); - query = inkey(); - - /* Stop on everything but "return" */ - if ((query != '\r') && (query != '\n')) break; + prt(out_val, 0, 0); + move_cursor_relative(y, x); + query = inkey(); - /* Repeat forever */ - continue; - } + /* Stop on everything but "return" */ + if ((query != '\r') && (query != '\n')) return query; + /* Repeat forever */ + return 0; + } - /* Actual monsters */ - if (c_ptr->m_idx) - { - monster_type *m_ptr = &m_list[c_ptr->m_idx]; - monster_race *ap_r_ptr = &r_info[m_ptr->ap_r_idx]; - /* Visible */ - if (m_ptr->ml) - { - bool recall = FALSE; + /* Actual monsters */ + if (c_ptr->m_idx && m_list[c_ptr->m_idx].ml) + { + monster_type *m_ptr = &m_list[c_ptr->m_idx]; + monster_race *ap_r_ptr = &r_info[m_ptr->ap_r_idx]; + bool recall = FALSE; - char m_name[80]; + /* Not boring */ + boring = FALSE; - /* Not boring */ - boring = FALSE; + /* Get the monster name ("a kobold") */ + monster_desc(m_name, m_ptr, 0x08); - /* Get the monster name ("a kobold") */ - monster_desc(m_name, m_ptr, 0x08); + /* Hack -- track this monster race */ + monster_race_track(m_ptr->ap_r_idx); - /* Hack -- track this monster race */ - monster_race_track(m_ptr->ap_r_idx); + /* Hack -- health bar for this monster */ + health_track(c_ptr->m_idx); - /* Hack -- health bar for this monster */ - health_track(c_ptr->m_idx); + /* Hack -- handle stuff */ + handle_stuff(); - /* Hack -- handle stuff */ - handle_stuff(); + /* Interact */ + while (1) + { + char acount[10]; - /* Interact */ - while (1) - { - /* Recall */ - if (recall) - { - /* Save */ - screen_save(); + /* Recall */ + if (recall) + { + /* Save */ + screen_save(); - /* Recall on screen */ - screen_roff(m_ptr->ap_r_idx, 0); + /* Recall on screen */ + screen_roff(m_ptr->ap_r_idx, 0); - /* Hack -- Complete the prompt (again) */ + /* Hack -- Complete the prompt (again) */ #ifdef JP -Term_addstr(-1, TERM_WHITE, format(" [r»× %s]", info)); + Term_addstr(-1, TERM_WHITE, format(" [r»× %s%s]", x_info, info)); #else - Term_addstr(-1, TERM_WHITE, format(" [r,%s]", info)); + Term_addstr(-1, TERM_WHITE, format(" [r,%s%s]", x_info, info)); #endif + /* Command */ + query = inkey(); - /* Command */ - query = inkey(); + /* Restore */ + screen_load(); - /* Restore */ - screen_load(); - } + /* Normal commands */ + if (query != 'r') break; - /* Normal */ - else - { - cptr attitude; - cptr tekitou; + /* Toggle recall */ + recall = FALSE; - if (p_ptr->riding && (p_ptr->riding == c_ptr->m_idx)) - { -#ifdef JP - tekitou = "(¥Ú¥Ã¥È)"; -#else - tekitou = "(pet)"; -#endif - } - else - { - tekitou = ""; - } - - if (is_pet(m_ptr) && (p_ptr->riding != c_ptr->m_idx)) -#ifdef JP -attitude = " (¥Ú¥Ã¥È) "; -#else - attitude = " (pet) "; -#endif - - else if (is_friendly(m_ptr)) -#ifdef JP -attitude = " (ͧ¹¥Åª) "; -#else - attitude = " (friendly) "; -#endif + /* Cleare recall text and repeat */ + continue; + } - else -#ifdef JP -attitude = " "; -#else - attitude = " "; -#endif + /*** Normal ***/ + /* Describe, and prompt for recall */ + evaluate_monster_exp(acount, m_ptr); - /* Describe, and prompt for recall */ -{ -#define M_INT_GREATER(h1,l1,h2,l2) ( (h1>h2)||( (h1==h2)&&(l1>=l2))) -#define M_INT_SUB(h1,l1, h2,l2) {h1-=h2;if(l1=0x10000L){l1&=0xFFFF;h1++;}} -#define M_INT_LSHIFT(h1,l1) {h1=(h1<<1)|(l1>>15);l1=(l1<<1)&0xffff;} -#define M_INT_RSHIFT(h1,l1) {l1=(l1>>1)|((h1&1)<<15);h1>>=1;} -#define M_INT_MULT(h1,l1,mul,h2,l2) {l2=(l1*mul)&0xffff;h2=((l1*mul)>>16)+h1*mul;} - char acount[10]; - u32b tmp_h,tmp_l; - int bit,result; - u32b exp_mon= (ap_r_ptr->mexp)*(ap_r_ptr->level); - u32b exp_mon_h= exp_mon / (p_ptr->max_plv+2); - u32b exp_mon_l= ((exp_mon % (p_ptr->max_plv+2))*0x10000/(p_ptr->max_plv+2))&0xFFFF; - - u32b exp_adv_h = player_exp[p_ptr->lev -1] * p_ptr->expfact /100; - u32b exp_adv_l = ((player_exp[p_ptr->lev -1]%100) * p_ptr->expfact *0x10000/100)&0xFFFF; - - M_INT_SUB(exp_adv_h, exp_adv_l, p_ptr->exp, p_ptr->exp_frac); - if ((p_ptr->lev>=PY_MAX_LEVEL) || (p_ptr->prace == RACE_ANDROID)) - sprintf(acount,"[**]"); - else if (!ap_r_ptr->r_tkills || (m_ptr->mflag2 & MFLAG_KAGE)) - sprintf(acount,"[??]"); - else if (M_INT_GREATER(exp_mon_h, exp_mon_l, exp_adv_h, exp_adv_l)) - sprintf(acount,"[001]"); - else - { - M_INT_MULT(exp_mon_h, exp_mon_l, 1000,tmp_h, tmp_l); - if( M_INT_GREATER(exp_adv_h, exp_adv_l, tmp_h, tmp_l) ) - sprintf(acount,"[999]"); - else - { - bit=1; result=0; - M_INT_ADD(exp_adv_h, exp_adv_l, exp_mon_h, exp_mon_l); - M_INT_SUB(exp_adv_h, exp_adv_l, 0, 1); - while(M_INT_GREATER(exp_adv_h, exp_adv_l, exp_mon_h,exp_mon_l)) - { - M_INT_LSHIFT(exp_mon_h,exp_mon_l); - bit <<= 1; - } - M_INT_RSHIFT(exp_mon_h,exp_mon_l);bit>>=1; - for(;bit>=1;bit>>=1) - { - if(M_INT_GREATER(exp_adv_h,exp_adv_l,exp_mon_h,exp_mon_l)) - { - result |= bit; - M_INT_SUB(exp_adv_h,exp_adv_l,exp_mon_h,exp_mon_l); - } - M_INT_RSHIFT(exp_mon_h,exp_mon_l); - } - sprintf(acount,"[%03d]",result); - } - } - sprintf(out_val, #ifdef JP - "%s%s%s(%s)%s%s%s%s%s[r»× %s]", - acount, s1, m_name, look_mon_desc(c_ptr->m_idx), tekitou, s2, s3, + sprintf(out_val, "[%s]%s%s(%s)%s%s [r»× %s%s]", acount, s1, m_name, look_mon_desc(c_ptr->m_idx, 0x01), s2, s3, x_info, info); #else - "%s%s%s%s%s(%s)%s%s%s[r, %s]", - acount, s1, s2, s3, m_name, look_mon_desc(c_ptr->m_idx), tekitou, + sprintf(out_val, "[%s]%s%s%s%s(%s) [r, %s%s]", acount, s1, s2, s3, m_name, look_mon_desc(c_ptr->m_idx, 0x01), x_info, info); #endif - (m_ptr->smart & SM_CLONED ? " (clone)": ""), - attitude,info); -} - prt(out_val, 0, 0); + prt(out_val, 0, 0); - /* Place cursor */ - move_cursor_relative(y, x); + /* Place cursor */ + move_cursor_relative(y, x); - /* Command */ - query = inkey(); - } + /* Command */ + query = inkey(); - /* Normal commands */ - if (query != 'r') break; + /* Normal commands */ + if (query != 'r') break; - /* Toggle recall */ - recall = !recall; - } + /* Toggle recall */ + recall = TRUE; + } - /* Always stop at "normal" keys */ - if ((query != '\r') && (query != '\n') && (query != ' ')) break; + /* Always stop at "normal" keys */ + if ((query != '\r') && (query != '\n') && (query != ' ') && (query != 'x')) return query; - /* Sometimes stop at "space" key */ - if ((query == ' ') && !(mode & (TARGET_LOOK))) break; + /* Sometimes stop at "space" key */ + if ((query == ' ' || query == 'x') && !(mode & (TARGET_LOOK))) return query; - /* Change the intro */ + /* Change the intro */ #ifdef JP -s1 = "¤½¤ì¤Ï"; + s1 = "¤½¤ì¤Ï"; #else - s1 = "It is "; + s1 = "It is "; #endif - /* Hack -- take account of gender */ + /* Hack -- take account of gender */ #ifdef JP -if (ap_r_ptr->flags1 & (RF1_FEMALE)) s1 = "Èà½÷¤Ï"; + if (ap_r_ptr->flags1 & (RF1_FEMALE)) s1 = "Èà½÷¤Ï"; #else - if (ap_r_ptr->flags1 & (RF1_FEMALE)) s1 = "She is "; + if (ap_r_ptr->flags1 & (RF1_FEMALE)) s1 = "She is "; #endif #ifdef JP -else if (ap_r_ptr->flags1 & (RF1_MALE)) s1 = "Èà¤Ï"; + else if (ap_r_ptr->flags1 & (RF1_MALE)) s1 = "Èà¤Ï"; #else - else if (ap_r_ptr->flags1 & (RF1_MALE)) s1 = "He is "; + else if (ap_r_ptr->flags1 & (RF1_MALE)) s1 = "He is "; #endif - /* Use a preposition */ + /* Use a preposition */ #ifdef JP - s2 = "¤ò"; - s3 = "»ý¤Ã¤Æ¤¤¤ë"; + s2 = "¤ò"; + s3 = "»ý¤Ã¤Æ¤¤¤ë"; #else - s2 = "carrying "; + s2 = "carrying "; #endif - /* Scan all objects being carried */ - for (this_o_idx = m_ptr->hold_o_idx; this_o_idx; this_o_idx = next_o_idx) - { - char o_name[MAX_NLEN]; + /* Scan all objects being carried */ + for (this_o_idx = m_ptr->hold_o_idx; this_o_idx; this_o_idx = next_o_idx) + { + char o_name[MAX_NLEN]; - object_type *o_ptr; + object_type *o_ptr; - /* Acquire object */ - o_ptr = &o_list[this_o_idx]; + /* Acquire object */ + o_ptr = &o_list[this_o_idx]; - /* Acquire next object */ - next_o_idx = o_ptr->next_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); + /* Obtain an object description */ + object_desc(o_name, o_ptr, TRUE, 3); - /* Describe the object */ + /* Describe the object */ #ifdef JP - sprintf(out_val, "%s%s%s%s[%s]", s1, o_name, s2, s3, info); + sprintf(out_val, "%s%s%s%s[%s]", s1, o_name, s2, s3, info); #else - sprintf(out_val, "%s%s%s%s [%s]", s1, s2, s3, o_name, info); + sprintf(out_val, "%s%s%s%s [%s]", s1, s2, s3, o_name, info); #endif - prt(out_val, 0, 0); - move_cursor_relative(y, x); - query = inkey(); + prt(out_val, 0, 0); + move_cursor_relative(y, x); + query = inkey(); - /* Always stop at "normal" keys */ - if ((query != '\r') && (query != '\n') && (query != ' ')) break; + /* Always stop at "normal" keys */ + if ((query != '\r') && (query != '\n') && (query != ' ') && (query != 'x')) return query; - /* Sometimes stop at "space" key */ - if ((query == ' ') && !(mode & (TARGET_LOOK))) break; + /* Sometimes stop at "space" key */ + if ((query == ' ' || query == 'x') && !(mode & (TARGET_LOOK))) return query; - /* Change the intro */ + /* Change the intro */ #ifdef JP -s2 = "¤ò¤Þ¤¿"; + s2 = "¤ò¤Þ¤¿"; #else - s2 = "also carrying "; + s2 = "also carrying "; #endif + } - } - - /* Double break */ - if (this_o_idx) break; - - /* Use a preposition */ + /* Use a preposition */ #ifdef JP - s2 = "¤Î¾å"; - s3 = "¤Ë¤¤¤ë"; + s2 = "¤Î¾å"; + s3 = "¤Ë¤¤¤ë"; #else - s2 = "on "; + s2 = "on "; #endif - - } - } + } #ifdef ALLOW_EASY_FLOOR + if (floor_num) + { + int min_width = 0; - /* Scan all objects in the grid */ - if (easy_floor) + while (1) { - int floor_list[23], floor_num; - int min_width = 0; - - floor_num = scan_floor(floor_list, y, x, 0x02); - - if (floor_num) + if (floor_num == 1) { - /* Not boring */ - boring = FALSE; - - while (1) - { - if (floor_num == 1) - { - char o_name[MAX_NLEN]; + char o_name[MAX_NLEN]; - object_type *o_ptr; + object_type *o_ptr; - /* Acquire object */ - o_ptr = &o_list[floor_list[0]]; + /* Acquire object */ + o_ptr = &o_list[floor_list[0]]; - /* Describe the object */ - object_desc(o_name, o_ptr, TRUE, 3); + /* Describe the object */ + object_desc(o_name, o_ptr, TRUE, 3); - /* Message */ + /* Message */ #ifdef JP -sprintf(out_val, "%s%s%s%s[%s]", -s1, o_name, s2, s3, info); + sprintf(out_val, "%s%s%s%s[%s]", + s1, o_name, s2, s3, info); #else - sprintf(out_val, "%s%s%s%s [%s]", - s1, s2, s3, o_name, info); + sprintf(out_val, "%s%s%s%s [%s]", + s1, s2, s3, o_name, info); #endif - } - else - { - /* Message */ + prt(out_val, 0, 0); + move_cursor_relative(y, x); + + /* Command */ + query = inkey(); + + /* End this grid */ + return query; + } + + /* Provide one cushion before item listing */ + if (boring) + { + /* Display rough information about items */ #ifdef JP - sprintf(out_val, "%s %d¸Ä¤Î¥¢¥¤¥Æ¥à%s%s ['x'¤Ç°ìÍ÷, %s]", - s1, floor_num, s2, s3, info); + sprintf(out_val, "%s %d¸Ä¤Î¥¢¥¤¥Æ¥à%s%s ['x'¤Ç°ìÍ÷, %s]", + s1, floor_num, s2, s3, info); #else - sprintf(out_val, "%s%s%sa pile of %d items [x,%s]", - s1, s2, s3, floor_num, info); + sprintf(out_val, "%s%s%sa pile of %d items [x,%s]", + s1, s2, s3, floor_num, info); #endif - } + prt(out_val, 0, 0); + move_cursor_relative(y, x); - prt(out_val, 0, 0); - move_cursor_relative(y, x); + /* Command */ + query = inkey(); - /* Command */ - query = inkey(); + /* No request for listing */ + if (query != 'x' && query != ' ') return query; + } - /* Display list of items (query == "el", not "won") */ - if (floor_num == 1 || query != 'x') - { - /* Stop */ - break; - } - else while (1) - { - int i, o_idx; - cave_type *c_ptr; - /* Save screen */ - screen_save(); + /** Display list of items **/ - /* Display */ - (void)show_floor(0, y, x, &min_width); + /* Continue scrolling list if requested */ + while (1) + { + int i, o_idx; + cave_type *c_ptr; + + /* Save screen */ + screen_save(); - /* Prompt */ + /* Display */ + (void)show_floor(0, y, x, &min_width); + + /* Prompt */ #ifdef JP - prt("Enter¤Ç¼¡¤Ø¡¢Â¾¤Î¥­¡¼¤ò²¡¤¹¤È¥²¡¼¥à¤ËÌá¤ê¤Þ¤¹", 0, 0); + sprintf(out_val, "%s %d¸Ä¤Î¥¢¥¤¥Æ¥à%s%s [Enter¤Ç¼¡¤Ø, %s]", + s1, floor_num, s2, s3, info); #else - prt("Hit Enter to scroll, Hit any other key to continue", 0, 0); + sprintf(out_val, "%s%s%sa pile of %d items [Enter,%s]", + s1, s2, s3, floor_num, info); #endif + prt(out_val, 0, 0); + - /* Wait */ - query = inkey(); + /* Wait */ + query = inkey(); - /* Load screen */ - screen_load(); + /* Load screen */ + screen_load(); - /* Exit unless 'Enter' */ - if (query != '\n' && query != '\r') break; + /* Exit unless 'Enter' */ + if (query != '\n' && query != '\r') + { + return query; + } - /* Get the object being moved. */ - c_ptr = &cave[y][x]; - o_idx = c_ptr->o_idx; + /* Get the object being moved. */ + c_ptr = &cave[y][x]; + o_idx = c_ptr->o_idx; - /* Only rotate a pile of two or more objects. */ - if (o_idx && o_list[o_idx].next_o_idx) - { + /* Only rotate a pile of two or more objects. */ + if (!(o_idx && o_list[o_idx].next_o_idx)) continue; - /* Remove the first object from the list. */ - excise_object_idx(o_idx); + /* Remove the first object from the list. */ + excise_object_idx(o_idx); - /* Find end of the list. */ - i = c_ptr->o_idx; - while (o_list[i].next_o_idx) - i = o_list[i].next_o_idx; + /* Find end of the list. */ + i = c_ptr->o_idx; + while (o_list[i].next_o_idx) + i = o_list[i].next_o_idx; - /* Add after the last object. */ - o_list[i].next_o_idx = o_idx; - } - } - } + /* Add after the last object. */ + o_list[i].next_o_idx = o_idx; - /* Stop */ - break; + /* Loop and re-display the list */ } } + /* End this grid */ + return query; + } #endif /* ALLOW_EASY_FLOOR */ - /* Scan all objects in the grid */ - for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx) - { - object_type *o_ptr; + /* Scan all objects in the grid */ + for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx) + { + object_type *o_ptr; - /* Acquire object */ - o_ptr = &o_list[this_o_idx]; + /* Acquire object */ + o_ptr = &o_list[this_o_idx]; - /* Acquire next object */ - next_o_idx = o_ptr->next_o_idx; + /* Acquire next object */ + next_o_idx = o_ptr->next_o_idx; - /* Describe it */ - if (o_ptr->marked) - { - char o_name[MAX_NLEN]; + /* Describe it */ + if (o_ptr->marked) + { + char o_name[MAX_NLEN]; - /* Not boring */ - boring = FALSE; + /* Not boring */ + boring = FALSE; - /* Obtain an object description */ - object_desc(o_name, o_ptr, TRUE, 3); + /* Obtain an object description */ + object_desc(o_name, o_ptr, TRUE, 3); - /* Describe the object */ + /* Describe the object */ #ifdef JP -sprintf(out_val, "%s%s%s%s[%s]", s1, o_name, s2, s3, info); + sprintf(out_val, "%s%s%s%s[%s]", s1, o_name, s2, s3, info); #else - sprintf(out_val, "%s%s%s%s [%s]", s1, s2, s3, o_name, info); + sprintf(out_val, "%s%s%s%s [%s]", s1, s2, s3, o_name, info); #endif - prt(out_val, 0, 0); - move_cursor_relative(y, x); - query = inkey(); + prt(out_val, 0, 0); + move_cursor_relative(y, x); + query = inkey(); - /* Always stop at "normal" keys */ - if ((query != '\r') && (query != '\n') && (query != ' ')) break; + /* Always stop at "normal" keys */ + if ((query != '\r') && (query != '\n') && (query != ' ')) return query; - /* Sometimes stop at "space" key */ - if ((query == ' ') && !(mode & TARGET_LOOK)) break; + /* Sometimes stop at "space" key */ + if ((query == ' ') && !(mode & TARGET_LOOK)) return query; - /* Change the intro */ + /* Change the intro */ #ifdef JP -s1 = "¤½¤ì¤Ï"; + s1 = "¤½¤ì¤Ï"; #else - s1 = "It is "; + s1 = "It is "; #endif - /* Plurals */ + /* Plurals */ #ifdef JP -if (o_ptr->number != 1) s1 = "¤½¤ì¤é¤Ï"; + if (o_ptr->number != 1) s1 = "¤½¤ì¤é¤Ï"; #else - if (o_ptr->number != 1) s1 = "They are "; + if (o_ptr->number != 1) s1 = "They are "; #endif - /* Preposition */ + /* Preposition */ #ifdef JP - s2 = "¤Î¾å"; - s3 = "¤Ë¸«¤¨¤ë"; + s2 = "¤Î¾å"; + s3 = "¤Ë¸«¤¨¤ë"; #else - s2 = "on "; + s2 = "on "; #endif - } } + } - /* Double break */ - if (this_o_idx) break; - /* Feature code (applying "mimic" field) */ - feat = c_ptr->mimic ? c_ptr->mimic : f_info[c_ptr->feat].mimic; + /* Feature code (applying "mimic" field) */ + feat = c_ptr->mimic ? c_ptr->mimic : f_info[c_ptr->feat].mimic; + + /* Require knowledge about grid, or ability to see grid */ + if (!(c_ptr->info & CAVE_MARK) && !player_can_see_bold(y, x)) + { + /* Forget feature */ + feat = FEAT_NONE; + } + + /* Terrain feature if needed */ + if (boring || (feat > FEAT_INVIS)) + { + cptr name; - /* Require knowledge about grid, or ability to see grid */ - if (!(c_ptr->info & CAVE_MARK) && !player_can_see_bold(y, x)) + /* Hack -- special handling for building doors */ + if ((feat >= FEAT_BLDG_HEAD) && (feat <= FEAT_BLDG_TAIL)) { - /* Forget feature */ - feat = FEAT_NONE; + name = building[feat - FEAT_BLDG_HEAD].name; } - - /* Terrain feature if needed */ - if (boring || (feat > FEAT_INVIS)) + else if (feat == FEAT_ENTRANCE) { - cptr name; - - /* Hack -- special handling for building doors */ - if ((feat >= FEAT_BLDG_HEAD) && (feat <= FEAT_BLDG_TAIL)) - { - name = building[feat - FEAT_BLDG_HEAD].name; - } - else if (feat == FEAT_ENTRANCE) - { #ifdef JP - name = format("%s(%d³¬ÁêÅö)", d_text + d_info[c_ptr->special].text, d_info[c_ptr->special].mindepth); + name = format("%s(%d³¬ÁêÅö)", d_text + d_info[c_ptr->special].text, d_info[c_ptr->special].mindepth); #else - name = format("%s(level %d)", d_text + d_info[c_ptr->special].text, d_info[c_ptr->special].mindepth); + name = format("%s(level %d)", d_text + d_info[c_ptr->special].text, d_info[c_ptr->special].mindepth); #endif - } - else if (feat == FEAT_TOWN) - { - name = town[c_ptr->special].name; - } - else if (p_ptr->wild_mode && (feat == FEAT_FLOOR)) - { + } + else if (feat == FEAT_TOWN) + { + name = town[c_ptr->special].name; + } + else if (p_ptr->wild_mode && (feat == FEAT_FLOOR)) + { #ifdef JP - name = "Æ»"; + name = "Æ»"; #else - name = "road"; + name = "road"; #endif - } - else - { - name = f_name + f_info[feat].name; - } + } + else + { + name = f_name + f_info[feat].name; + } - /* Pick a prefix */ - if (*s2 && ((feat >= FEAT_MINOR_GLYPH) && - (feat <= FEAT_PATTERN_XTRA2))) - { + /* Pick a prefix */ + if (*s2 && ((feat >= FEAT_MINOR_GLYPH) && + (feat <= FEAT_PATTERN_XTRA2))) + { #ifdef JP -s2 = "¤Î¾å"; + s2 = "¤Î¾å"; #else - s2 = "on "; + s2 = "on "; #endif - } - else if (*s2 && ((feat >= FEAT_DOOR_HEAD) && - (feat <= FEAT_PERM_SOLID))) - { + } + else if (*s2 && ((feat >= FEAT_DOOR_HEAD) && + (feat <= FEAT_PERM_SOLID))) + { #ifdef JP -s2 = "¤ÎÃæ"; + s2 = "¤ÎÃæ"; #else - s2 = "in "; + s2 = "in "; #endif - } - else if (*s2 && (feat == FEAT_TOWN)) - { + } + else if (*s2 && (feat == FEAT_TOWN)) + { #ifdef JP -s2 = "¤ÎÃæ"; + s2 = "¤ÎÃæ"; #else - s2 = "in "; + s2 = "in "; #endif - } + } - /* Hack -- special introduction for store & building doors -KMW- */ - if (((feat >= FEAT_SHOP_HEAD) && (feat <= FEAT_SHOP_TAIL)) || - ((feat >= FEAT_BLDG_HEAD) && (feat <= FEAT_BLDG_TAIL)) || - (feat == FEAT_MUSEUM) || - (feat == FEAT_ENTRANCE)) - { + /* Hack -- special introduction for store & building doors -KMW- */ + if (((feat >= FEAT_SHOP_HEAD) && (feat <= FEAT_SHOP_TAIL)) || + ((feat >= FEAT_BLDG_HEAD) && (feat <= FEAT_BLDG_TAIL)) || + (feat == FEAT_MUSEUM) || + (feat == FEAT_ENTRANCE)) + { #ifdef JP -s2 = "¤ÎÆþ¸ý"; + s2 = "¤ÎÆþ¸ý"; #else - s3 = ""; + s3 = ""; #endif - } - else if ((feat == FEAT_TOWN) || (feat == FEAT_FLOOR) || (feat == FEAT_DIRT) || (feat == FEAT_FLOWER)) - { + } + else if ((feat == FEAT_TOWN) || (feat == FEAT_FLOOR) || (feat == FEAT_DIRT) || (feat == FEAT_FLOWER)) + { #ifndef JP - s3 =""; + s3 =""; #endif - } - else - { - /* Pick proper indefinite article */ + } + else + { + /* Pick proper indefinite article */ #ifndef JP - s3 = (is_a_vowel(name[0])) ? "an " : "a "; + s3 = (is_a_vowel(name[0])) ? "an " : "a "; #endif - } + } - /* Display a message */ - if (p_ptr->wizard) + /* Display a message */ + if (p_ptr->wizard) #ifdef JP sprintf(out_val, "%s%s%s%s[%s] %x %d %d %d %d (%d,%d)", s1, name, s2, s3, info, c_ptr->info, c_ptr->feat, c_ptr->dist, c_ptr->cost, c_ptr->when, x, y); #else - sprintf(out_val, "%s%s%s%s [%s] %x %d %d %d %d (%d,%d)", s1, s2, s3, name, info, c_ptr->info, c_ptr->feat, c_ptr->dist, c_ptr->cost, c_ptr->when, x, y); + sprintf(out_val, "%s%s%s%s [%s] %x %d %d %d %d (%d,%d)", s1, s2, s3, name, info, c_ptr->info, c_ptr->feat, c_ptr->dist, c_ptr->cost, c_ptr->when, x, y); #endif - else + else #ifdef JP sprintf(out_val, "%s%s%s%s[%s]", s1, name, s2, s3, info); #else - sprintf(out_val, "%s%s%s%s [%s]", s1, s2, s3, name, info); + sprintf(out_val, "%s%s%s%s [%s]", s1, s2, s3, name, info); #endif - prt(out_val, 0, 0); - move_cursor_relative(y, x); - query = inkey(); - - /* Always stop at "normal" keys */ - if ((query != '\r') && (query != '\n') && (query != ' ')) break; - } + prt(out_val, 0, 0); + move_cursor_relative(y, x); + query = inkey(); - /* Stop on everything but "return" */ - if ((query != '\r') && (query != '\n')) break; + /* Always stop at "normal" keys */ + if ((query != '\r') && (query != '\n') && (query != ' ')) return query; } - /* Keep going */ - return (query); + /* Stop on everything but "return" */ + if ((query != '\r') && (query != '\n')) return query; + + /* Repeat forever */ + return 0; } @@ -3699,6 +3702,7 @@ bool target_set(int mode) int wid, hgt; + /* Get size */ get_screen_size(&wid, &hgt); @@ -3753,7 +3757,7 @@ strcpy(info, "q } /* Describe and Prompt */ - query = target_set_aux(y, x, mode, info); + while (!(query = target_set_aux(y, x, mode, info))); /* Cancel tracking */ /* health_track(0); */ @@ -3983,7 +3987,7 @@ strcpy(info, "q /* Describe and Prompt (enable "TARGET_LOOK") */ - query = target_set_aux(y, x, mode | TARGET_LOOK, info); + while (!(query = target_set_aux(y, x, mode | TARGET_LOOK, info))); /* Cancel tracking */ /* health_track(0); */ -- 2.11.0