X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=src%2Fcmd2.c;h=bafddf74f86cf7cbb0c7751c0183fc1e6fc1d4e2;hb=643861c992b8d0a9f447f48fc4ec19dabb5c165b;hp=67af4b23d7daca3d22076ca49d801ceed7f38efa;hpb=bf3562737ea5c7bb69f6b1393d903d3aea8272cd;p=hengband%2Fhengband.git diff --git a/src/cmd2.c b/src/cmd2.c index 67af4b23d..bafddf74f 100644 --- a/src/cmd2.c +++ b/src/cmd2.c @@ -11,7 +11,8 @@ */ #include "angband.h" - +#include "chest.h" +#include "object-hook.h" /*! * @brief ããã¢è±åºæã«åºæ»ããä¸å¯è½ã ã£ãå ´åã«è¦åãå ããå¦ç @@ -31,13 +32,8 @@ bool confirm_leave_level(bool down_stair) ((q_ptr->status != QUEST_STATUS_STAGE_COMPLETED) || (down_stair && (quest[QUEST_TOWER1].status != QUEST_STATUS_COMPLETED)))))) { -#ifdef JP - msg_print("ãã®éãä¸åº¦å»ãã¨äºåº¦ã¨æ»ã£ã¦æ¥ããã¾ããã"); - if (get_check("æ¬å½ã«ãã®éãå»ãã¾ããï¼")) return TRUE; -#else - msg_print("You can't come back here once you leave this floor."); - if (get_check("Really leave this floor? ")) return TRUE; -#endif + msg_print(_("ãã®éãä¸åº¦å»ãã¨äºåº¦ã¨æ»ã£ã¦æ¥ããã¾ããã", "You can't come back here once you leave this floor.")); + if (get_check(_("æ¬å½ã«ãã®éãå»ãã¾ããï¼", "Really leave this floor? "))) return TRUE; } else { @@ -80,14 +76,10 @@ void do_cmd_go_up(void) /* Success */ -#ifdef JP if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON)) - msg_print("ãªãã ãã®é段ã¯ï¼"); + msg_print(_("ãªãã ãã®é段ã¯ï¼", "What's this STAIRWAY!")); else - msg_print("ä¸ã®éã«ç»ã£ãã"); -#else - msg_print("You enter the up staircase."); -#endif + msg_print(_("ä¸ã®éã«ç»ã£ãã", "You enter the up staircase.")); leave_quest_check(); @@ -187,7 +179,7 @@ void do_cmd_go_up(void) /* Success */ if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON)) - msg_print(_("ãªãã ãã®é段ã¯ï¼", "")); + msg_print(_("ãªãã ãã®é段ã¯ï¼", "What's this STAIRWAY!")); else if (up_num == dun_level) msg_print(_("å°ä¸ã«æ»ã£ãã", "You go back to the surface.")); else @@ -237,14 +229,10 @@ void do_cmd_go_down(void) /* Confirm Leaving */ if(!confirm_leave_level(TRUE)) return; -#ifdef JP if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON)) - msg_print("ãªãã ãã®é段ã¯ï¼"); + msg_print(_("ãªãã ãã®é段ã¯ï¼", "What's this STAIRWAY!")); else - msg_print("ä¸ã®éã«éããã"); -#else - msg_print("You enter the down staircase."); -#endif + msg_print(_("ä¸ã®éã«éããã", "You enter the down staircase.")); leave_quest_check(); leave_tower_check(); @@ -347,7 +335,7 @@ void do_cmd_go_down(void) else { if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON)) - msg_print(_("ãªãã ãã®é段ã¯ï¼", "")); + msg_print(_("ãªãã ãã®é段ã¯ï¼", "What's this STAIRWAY!")); else msg_print(_("é段ãä¸ãã¦æ°ããªãè¿·å®®ã¸ã¨è¶³ãè¸ã¿å ¥ããã", "You enter a maze of down staircases.")); } @@ -396,8 +384,6 @@ void do_cmd_search(void) /* Cancel the arg */ command_arg = 0; } - - /* Take a turn */ p_ptr->energy_use = 100; /* Search */ @@ -412,22 +398,17 @@ void do_cmd_search(void) * @param trapped TRUEãªãã°ãã©ãããåå¨ããç®±ã®ã¿ãFALSEãªãã°ç©ºã§ãªãç®±å ¨ã¦ã対象ã«ãã * @return ç®±ãåå¨ããå ´åãã®ãªãã¸ã§ã¯ãIDãåå¨ããªãå ´å0ãè¿ãã */ -static s16b chest_check(int y, int x, bool trapped) +static OBJECT_IDX chest_check(POSITION y, POSITION x, bool trapped) { cave_type *c_ptr = &cave[y][x]; - - s16b this_o_idx, next_o_idx = 0; - + OBJECT_IDX this_o_idx, next_o_idx = 0; /* 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 next object */ next_o_idx = o_ptr->next_o_idx; /* Skip unknown chests XXX XXX */ @@ -441,354 +422,9 @@ static s16b chest_check(int y, int x, bool trapped) return (this_o_idx); } } - - /* No chest */ return (0); } - -/*! - * @brief ç®±ããã¢ã¤ãã ãå¼ãåºã / - * Allocates objects upon opening a chest -BEN- - * @param scatter TRUEãªãã°ãã©ããã«ããã¢ã¤ãã ã®æ¡æ£å¦ç - * @param y ç®±ã®åå¨ãããã¹ã®Yåº§æ¨ - * @param x ç®±ã®åå¨ãããã¹ã®Xåº§æ¨ - * @param o_idx ç®±ã®ãªãã¸ã§ã¯ãID - * @return ãªã - * @details - *
- * Disperse treasures from the given chest, centered at (x,y). - * - * Small chests often contain "gold", while Large chests always contain - * items. Wooden chests contain 2 items, Iron chests contain 4 items, - * and Steel chests contain 6 items. The "value" of the items in a - * chest is based on the "power" of the chest, which is in turn based - * on the level on which the chest is generated. - *- */ -static void chest_death(bool scatter, int y, int x, s16b o_idx) -{ - int number; - - bool small; - u32b mode = AM_GOOD; - - object_type forge; - object_type *q_ptr; - - object_type *o_ptr = &o_list[o_idx]; - - - /* Small chests often hold "gold" */ - small = (o_ptr->sval < SV_CHEST_MIN_LARGE); - - /* Determine how much to drop (see above) */ - number = (o_ptr->sval % SV_CHEST_MIN_LARGE) * 2; - - if (o_ptr->sval == SV_CHEST_KANDUME) - { - number = 5; - small = FALSE; - mode |= AM_GREAT; - object_level = o_ptr->xtra3; - } - else - { - /* Determine the "value" of the items */ - object_level = ABS(o_ptr->pval) + 10; - } - - /* Zero pval means empty chest */ - if (!o_ptr->pval) number = 0; - - /* Opening a chest */ - opening_chest = TRUE; - - /* Drop some objects (non-chests) */ - for (; number > 0; --number) - { - /* Get local object */ - q_ptr = &forge; - - /* Wipe the object */ - object_wipe(q_ptr); - - /* Small chests often drop gold */ - if (small && (randint0(100) < 25)) - { - /* Make some gold */ - if (!make_gold(q_ptr)) continue; - } - - /* Otherwise drop an item */ - else - { - /* Make a good object */ - if (!make_object(q_ptr, mode)) continue; - } - - /* If chest scatters its contents, pick any floor square. */ - if (scatter) - { - int i; - for (i = 0; i < 200; i++) - { - /* Pick a totally random spot. */ - y = randint0(MAX_HGT); - x = randint0(MAX_WID); - - /* Must be an empty floor. */ - if (!cave_empty_bold(y, x)) continue; - - /* Place the object there. */ - drop_near(q_ptr, -1, y, x); - - /* Done. */ - break; - } - } - /* Normally, drop object near the chest. */ - else drop_near(q_ptr, -1, y, x); - } - - /* Reset the object level */ - object_level = base_level; - - /* No longer opening a chest */ - opening_chest = FALSE; - - /* Empty */ - o_ptr->pval = 0; - - /* Known */ - object_known(o_ptr); -} - - -/*! - * @brief ç®±ã®ãã©ããå¦ç / - * Chests have traps too. - * @param y ç®±ã®åå¨ãããã¹ã®Yåº§æ¨ - * @param x ç®±ã®åå¨ãããã¹ã®Xåº§æ¨ - * @param o_idx ç®±ã®ãªãã¸ã§ã¯ãID - * @return ãªã - * @details - *
- * Exploding chest destroys contents (and traps). - * Note that the chest itself is never destroyed. - *- */ -static void chest_trap(int y, int x, s16b o_idx) -{ - int i, trap; - - object_type *o_ptr = &o_list[o_idx]; - - int mon_level = o_ptr->xtra3; - - /* Ignore disarmed chests */ - if (o_ptr->pval <= 0) return; - - /* Obtain the traps */ - trap = chest_traps[o_ptr->pval]; - - /* Lose strength */ - if (trap & (CHEST_LOSE_STR)) - { -#ifdef JP - msg_print("ä»æãããã¦ããå°ããªéã«åºããã¦ãã¾ã£ãï¼"); - take_hit(DAMAGE_NOESCAPE, damroll(1, 4), "æ¯é", -1); -#else - msg_print("A small needle has pricked you!"); - take_hit(DAMAGE_NOESCAPE, damroll(1, 4), "a poison needle", -1); -#endif - - (void)do_dec_stat(A_STR); - } - - /* Lose constitution */ - if (trap & (CHEST_LOSE_CON)) - { -#ifdef JP - msg_print("ä»æãããã¦ããå°ããªéã«åºããã¦ãã¾ã£ãï¼"); - take_hit(DAMAGE_NOESCAPE, damroll(1, 4), "æ¯é", -1); -#else - msg_print("A small needle has pricked you!"); - take_hit(DAMAGE_NOESCAPE, damroll(1, 4), "a poison needle", -1); -#endif - - (void)do_dec_stat(A_CON); - } - - /* Poison */ - if (trap & (CHEST_POISON)) - { - msg_print(_("çªå¦å¹ãåºããç·è²ã®ã¬ã¹ã«å ã¿è¾¼ã¾ããï¼", "A puff of green gas surrounds you!")); - if (!(p_ptr->resist_pois || IS_OPPOSE_POIS())) - { - (void)set_poisoned(p_ptr->poisoned + 10 + randint1(20)); - } - } - - /* Paralyze */ - if (trap & (CHEST_PARALYZE)) - { - msg_print(_("çªå¦å¹ãåºããé»è²ãã¬ã¹ã«å ã¿è¾¼ã¾ããï¼", "A puff of yellow gas surrounds you!")); - if (!p_ptr->free_act) - { - (void)set_paralyzed(p_ptr->paralyzed + 10 + randint1(20)); - } - } - - /* Summon monsters */ - if (trap & (CHEST_SUMMON)) - { - int num = 2 + randint1(3); - msg_print(_("çªå¦å¹ãåºããç ã«å ã¿è¾¼ã¾ããï¼", "You are enveloped in a cloud of smoke!")); - for (i = 0; i < num; i++) - { - if (randint1(100)
- * XXX XXX XXX Let user choose a pile of spikes, perhaps? + * Let user choose a pile of spikes, perhaps? **/ -static bool get_spike(int *ip) +static bool get_spike(INVENTORY_IDX *ip) { - int i; + INVENTORY_IDX i; /* Check every item in the pack */ for (i = 0; i < INVEN_PACK; i++) @@ -2397,7 +1906,6 @@ static bool get_spike(int *ip) } } - /* Oops */ return (FALSE); } @@ -2413,7 +1921,7 @@ static bool get_spike(int *ip) */ void do_cmd_spike(void) { - int dir; + DIRECTION dir; if (p_ptr->special_defense & KATA_MUSOU) { @@ -2423,9 +1931,10 @@ void do_cmd_spike(void) /* Get a "repeated" direction */ if (get_rep_dir(&dir,FALSE)) { - int y, x, item; + POSITION y, x; + INVENTORY_IDX item; cave_type *c_ptr; - s16b feat; + FEAT_IDX feat; /* Get location */ y = p_ptr->y + ddy[dir]; @@ -2440,24 +1949,20 @@ void do_cmd_spike(void) /* Require closed door */ if (!have_flag(f_info[feat].flags, FF_SPIKE)) { - /* Message */ msg_print(_("ããã«ã¯ããã³ãæã¦ããã®ãè¦å½ãããªãã", "You see nothing there to spike.")); } /* Get a spike */ else if (!get_spike(&item)) { - /* Message */ msg_print(_("ããã³ãæã£ã¦ããªãï¼", "You have no spikes!")); } /* Is a monster in the way? */ else if (c_ptr->m_idx) { - /* Take a turn */ p_ptr->energy_use = 100; - /* Message */ msg_print(_("ã¢ã³ã¹ã¿ã¼ãç«ã¡ãµããã£ã¦ããï¼", "There is a monster in the way!")); /* Attack */ @@ -2467,7 +1972,6 @@ void do_cmd_spike(void) /* Go for it */ else { - /* Take a turn */ p_ptr->energy_use = 100; /* Successful jamming */ @@ -2492,7 +1996,7 @@ void do_cmd_spike(void) */ void do_cmd_walk(bool pickup) { - int dir; + DIRECTION dir; bool more = FALSE; @@ -2511,9 +2015,8 @@ void do_cmd_walk(bool pickup) } /* Get a "repeated" direction */ - if (get_rep_dir(&dir,FALSE)) + if (get_rep_dir(&dir, FALSE)) { - /* Take a turn */ p_ptr->energy_use = 100; if ((dir != 5) && (p_ptr->special_defense & KATA_MUSOU)) @@ -2557,7 +2060,7 @@ void do_cmd_walk(bool pickup) } /* Cancel repeat unless we may continue */ - if (!more) disturb(0, 0); + if (!more) disturb(FALSE, FALSE); } @@ -2568,7 +2071,7 @@ void do_cmd_walk(bool pickup) */ void do_cmd_run(void) { - int dir; + DIRECTION dir; /* Hack -- no running when confused */ if (p_ptr->confused) @@ -2618,7 +2121,6 @@ void do_cmd_stay(bool pickup) command_arg = 0; } - /* Take a turn */ p_ptr->energy_use = 100; if (pickup) mpe_mode |= MPE_DO_PICKUP; @@ -2636,7 +2138,7 @@ void do_cmd_rest(void) set_action(ACTION_NONE); - if ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0] || p_ptr->magic_num1[1])) + if ((p_ptr->pclass == CLASS_BARD) && (SINGING_SONG_EFFECT(p_ptr) || INTERUPTING_SONG_EFFECT(p_ptr))) { stop_singing(); } @@ -2662,19 +2164,19 @@ void do_cmd_rest(void) /* Rest until done */ if (out_val[0] == '&') { - command_arg = (-2); + command_arg = COMMAND_ARG_REST_UNTIL_DONE; } /* Rest a lot */ else if (out_val[0] == '*') { - command_arg = (-1); + command_arg = COMMAND_ARG_REST_FULL_HEALING; } /* Rest some */ else { - command_arg = atoi(out_val); + command_arg = (COMMAND_ARG)atoi(out_val); if (command_arg <= 0) return; } } @@ -2685,7 +2187,7 @@ void do_cmd_rest(void) if (p_ptr->special_defense & NINJA_S_STEALTH) set_superstealth(FALSE); - /* Take a turn XXX XXX XXX (?) */ + /* Take a turn (?) */ p_ptr->energy_use = 100; /* The sin of sloth */ @@ -2712,8 +2214,6 @@ void do_cmd_rest(void) /* Redraw the state */ p_ptr->redraw |= (PR_STATE); - - /* Handle stuff */ handle_stuff(); /* Refresh */ @@ -2729,9 +2229,9 @@ void do_cmd_rest(void) * @details * Note that artifacts never break, see the "drop_near()" function. */ -static int breakage_chance(object_type *o_ptr) +static PERCENTAGE breakage_chance(object_type *o_ptr) { - int archer_bonus = (p_ptr->pclass == CLASS_ARCHER ? (p_ptr->lev-1)/7 + 4: 0); + PERCENTAGE archer_bonus = (p_ptr->pclass == CLASS_ARCHER ? (PERCENTAGE)(p_ptr->lev-1)/7 + 4: 0); /* Examine the snipe type */ if (snipe_type) @@ -2793,7 +2293,7 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr) monster_race *r_ptr = &r_info[m_ptr->r_idx]; - u32b flgs[TR_FLAG_SIZE]; + BIT_FLAGS flgs[TR_FLAG_SIZE]; /* Extract the flags */ object_flags(o_ptr, flgs); @@ -3188,13 +2688,15 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr) * Note that Bows of "Extra Shots" give an extra shot. * */ -void do_cmd_fire_aux(int item, object_type *j_ptr) +void do_cmd_fire_aux(INVENTORY_IDX item, object_type *j_ptr) { - int dir; - int i, j, y, x, ny, nx, ty, tx, prev_y, prev_x; + DIRECTION dir; + int i; + POSITION y, x, ny, nx, ty, tx, prev_y, prev_x; int tdam_base, tdis, thits, tmul; int bonus, chance; int cur_dis, visible; + PERCENTAGE j; object_type forge; object_type *q_ptr; @@ -3225,7 +2727,6 @@ void do_cmd_fire_aux(int item, object_type *j_ptr) /* Sniper - Cannot shot a single arrow twice */ if ((snipe_type == SP_DOUBLE) && (o_ptr->number < 2)) snipe_type = SP_NONE; - /* Describe the object */ object_desc(o_name, o_ptr, OD_OMIT_PREFIX); /* Use the proper number of shots */ @@ -3321,8 +2822,6 @@ void do_cmd_fire_aux(int item, object_type *j_ptr) /* Start at the player */ y = p_ptr->y; x = p_ptr->x; - - /* Get local object */ q_ptr = &forge; /* Obtain a local object */ @@ -3346,10 +2845,7 @@ void do_cmd_fire_aux(int item, object_type *j_ptr) floor_item_optimize(0 - item); } - /* Sound */ sound(SOUND_SHOOT); - - /* Hack -- Handle stuff */ handle_stuff(); /* Save the old location */ @@ -3404,10 +2900,8 @@ void do_cmd_fire_aux(int item, object_type *j_ptr) { cave[ny][nx].info |= (CAVE_GLOW); - /* Notice */ note_spot(ny, nx); - /* Redraw */ lite_spot(ny, nx); } @@ -3445,10 +2939,8 @@ void do_cmd_fire_aux(int item, object_type *j_ptr) { cave[ny][nx].info &= ~(CAVE_GLOW | CAVE_MARK); - /* Notice */ note_spot(ny, nx); - /* Redraw */ lite_spot(ny, nx); } @@ -3464,10 +2956,9 @@ void do_cmd_fire_aux(int item, object_type *j_ptr) /* Monster here, Try to hit it */ if (cave[y][x].m_idx) { - int armour; - cave_type *c_ptr = &cave[y][x]; + cave_type *c_mon_ptr = &cave[y][x]; - monster_type *m_ptr = &m_list[c_ptr->m_idx]; + monster_type *m_ptr = &m_list[c_mon_ptr->m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; /* Check the visibility */ @@ -3487,7 +2978,7 @@ void do_cmd_fire_aux(int item, object_type *j_ptr) int now_exp = p_ptr->weapon_exp[0][j_ptr->sval]; if (now_exp < s_info[p_ptr->pclass].w_max[0][j_ptr->sval]) { - int amount = 0; + SUB_EXP amount = 0; if (now_exp < WEAPON_EXP_BEGINNER) amount = 80; else if (now_exp < WEAPON_EXP_SKILLED) amount = 25; else if ((now_exp < WEAPON_EXP_EXPERT) && (p_ptr->lev > 19)) amount = 10; @@ -3532,7 +3023,6 @@ void do_cmd_fire_aux(int item, object_type *j_ptr) /* Get "the monster" or "it" */ monster_desc(m_name, m_ptr, 0); - /* Message */ msg_format(_("%sã%sã«å½ä¸ããã", "The %s hits %s."), o_name, m_name); if (m_ptr->ml) @@ -3541,7 +3031,7 @@ void do_cmd_fire_aux(int item, object_type *j_ptr) if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx); /* Hack -- Track this monster */ - health_track(c_ptr->m_idx); + health_track(c_mon_ptr->m_idx); } } @@ -3562,7 +3052,7 @@ void do_cmd_fire_aux(int item, object_type *j_ptr) } else { - /* Apply special damage XXX XXX XXX */ + /* Apply special damage */ tdam = tot_dam_aux_shot(q_ptr, tdam, m_ptr); tdam = critical_shot(q_ptr->weight, q_ptr->to_h, j_ptr->to_h, tdam); @@ -3573,11 +3063,9 @@ void do_cmd_fire_aux(int item, object_type *j_ptr) tdam = mon_damage_mod(m_ptr, tdam, FALSE); } - /* Complex message */ - if (p_ptr->wizard || cheat_xtra) - { - msg_format(_("%d/%d ã®ãã¡ã¼ã¸ãä¸ããã", "You do %d (out of %d) damage."), tdam, m_ptr->hp); - } + msg_format_wizard(CHEAT_MONSTER, + _("%dã®ãã¡ã¼ã¸ãä¸ããã(æ®ãHP %d/%d(%d))", "You do %d damage. (left HP %d/%d(%d))"), + tdam, m_ptr->hp - tdam, m_ptr->maxhp, m_ptr->max_maxhp); /* Sniper */ if (snipe_type == SP_EXPLODE) @@ -3594,15 +3082,13 @@ void do_cmd_fire_aux(int item, object_type *j_ptr) { cave[ny][nx].info |= (CAVE_GLOW); - /* Notice */ note_spot(ny, nx); - /* Redraw */ lite_spot(ny, nx); } /* Hit the monster, check for death */ - if (mon_take_hit(c_ptr->m_idx, tdam, &fear, extract_note_dies(real_r_ptr(m_ptr)))) + if (mon_take_hit(c_mon_ptr->m_idx, tdam, &fear, extract_note_dies(real_r_ptr(m_ptr)))) { /* Dead monster */ } @@ -3622,8 +3108,7 @@ void do_cmd_fire_aux(int item, object_type *j_ptr) msg_format(_("%sã¯%sã«çªãåºãã£ãï¼", "%^s have stuck into %s!"),o_name, m_name); } - /* Message */ - message_pain(c_ptr->m_idx, tdam); + message_pain(c_mon_ptr->m_idx, tdam); /* Anger the monster */ if (tdam > 0) anger_monster(m_ptr); @@ -3633,13 +3118,11 @@ void do_cmd_fire_aux(int item, object_type *j_ptr) { char m_name[80]; - /* Sound */ sound(SOUND_FLEE); /* Get the monster name (or "it") */ monster_desc(m_name, m_ptr, 0); - /* Message */ msg_format(_("%^sã¯ææãã¦éãåºããï¼", "%^s flees in terror!"), m_name); } @@ -3649,12 +3132,12 @@ void do_cmd_fire_aux(int item, object_type *j_ptr) if (snipe_type == SP_RUSH) { int n = randint1(5) + 3; - int m_idx = c_ptr->m_idx; + MONSTER_IDX m_idx = c_mon_ptr->m_idx; for ( ; cur_dis <= tdis; ) { - int ox = nx; - int oy = ny; + POSITION ox = nx; + POSITION oy = ny; if (!n) break; @@ -3677,7 +3160,7 @@ void do_cmd_fire_aux(int item, object_type *j_ptr) m_ptr->fy = ny; /* Update the monster (new location) */ - update_mon(c_ptr->m_idx, TRUE); + update_monster(c_mon_ptr->m_idx, TRUE); lite_spot(ny, nx); lite_spot(oy, ox); @@ -3712,9 +3195,9 @@ void do_cmd_fire_aux(int item, object_type *j_ptr) if (stick_to) { - int m_idx = cave[y][x].m_idx; + MONSTER_IDX m_idx = cave[y][x].m_idx; monster_type *m_ptr = &m_list[m_idx]; - int o_idx = o_pop(); + OBJECT_IDX o_idx = o_pop(); if (!o_idx) { @@ -3768,7 +3251,7 @@ void do_cmd_fire_aux(int item, object_type *j_ptr) */ void do_cmd_fire(void) { - int item; + OBJECT_IDX item; object_type *j_ptr; cptr q, s; @@ -3808,7 +3291,6 @@ void do_cmd_fire(void) /* Require proper missile */ item_tester_tval = p_ptr->tval_ammo; - /* Get an item */ q = _("ã©ããæã¡ã¾ãã? ", "Fire which item? "); s = _("çºå°ãããã¢ã¤ãã ãããã¾ããã", "You have nothing to fire."); if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) @@ -3835,22 +3317,9 @@ void do_cmd_fire(void) } } -/*! - * @brief ãªãã¸ã§ã¯ããæå°å¯è½ãªæ¦å¨ãã©ãããè¿ãã - * @param o_ptr å¤å®ãããªãã¸ã§ã¯ãã®æ§é ä½åç §ãã¤ã³ã¿ - * @return æå°å¯è½ãªæ¦å¨ãªãã°TRUE - */ -static bool item_tester_hook_boomerang(object_type *o_ptr) -{ - if ((o_ptr->tval==TV_DIGGING) || (o_ptr->tval == TV_SWORD) || (o_ptr->tval == TV_POLEARM) || (o_ptr->tval == TV_HAFTED)) return (TRUE); - - /* Assume not */ - return (FALSE); -} - /*! - * @brief æå°å¦çã®ãµãã«ã¼ãã³ / + * @brief æå°å¦çã¡ã¤ã³ã«ã¼ãã³ / * Throw an object from the pack or floor. * @param mult å¨åã®åç * @param boomerang ãã¼ã¡ã©ã³å¦çãªãã°TRUE @@ -3865,14 +3334,17 @@ static bool item_tester_hook_boomerang(object_type *o_ptr) * the item to be destroyed? Should it do any damage at all? * */ -bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken) +bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken) { - int dir, item; - int i, j, y, x, ty, tx, prev_y, prev_x; - int ny[19], nx[19]; + DIRECTION dir; + OBJECT_IDX item; + int i; + POSITION y, x, ty, tx, prev_y, prev_x; + POSITION ny[19], nx[19]; int chance, tdam, tdis; int mul, div, dd, ds; int cur_dis, visible; + PERCENTAGE j; object_type forge; object_type *q_ptr; @@ -3888,7 +3360,7 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken) int msec = delay_factor * delay_factor * delay_factor; - u32b flgs[TR_FLAG_SIZE]; + BIT_FLAGS flgs[TR_FLAG_SIZE]; cptr q, s; bool come_back = FALSE; bool do_drop = TRUE; @@ -3921,7 +3393,6 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken) } else { - /* Get an item */ q = _("ã©ã®ã¢ã¤ãã ãæãã¾ãã? ", "Throw which item? "); s = _("æããã¢ã¤ãã ããªãã", "You have nothing to throw."); if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR | USE_EQUIP))) @@ -3941,14 +3412,11 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken) o_ptr = &o_list[0 - item]; } - /* Item is cursed */ if (object_is_cursed(o_ptr) && (item >= INVEN_RARM)) { - /* Oops */ msg_print(_("ãµã¼ããã©ãããåªããã¦ããããã ã", "Hmmm, it seems to be cursed.")); - /* Nope */ return FALSE; } @@ -3959,12 +3427,10 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken) msg_print(_("ã¢ãªã¼ãã§ã¯ã¢ã¤ãã ã使ããªãï¼", "You're in the arena now. This is hand-to-hand!")); msg_print(NULL); - /* Nope */ return FALSE; } - } - /* Get local object */ + } q_ptr = &forge; /* Obtain a local object */ @@ -4001,8 +3467,8 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken) if (shuriken >= 0) { - ty = randint0(101)-50+p_ptr->y; - tx = randint0(101)-50+p_ptr->x; + ty = randint0(101) - 50 + p_ptr->y; + tx = randint0(101) - 50 + p_ptr->x; } else { @@ -4050,7 +3516,6 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken) p_ptr->redraw |= (PR_EQUIPPY); } - /* Take a turn */ p_ptr->energy_use = 100; /* Rogue and Ninja gets bonus */ @@ -4061,8 +3526,6 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken) y = p_ptr->y; x = p_ptr->x; - - /* Hack -- Handle stuff */ handle_stuff(); if ((p_ptr->pclass == CLASS_NINJA) && ((q_ptr->tval == TV_SPIKE) || ((have_flag(flgs, TR_THROW)) && (q_ptr->tval == TV_SWORD)))) shuriken = TRUE; @@ -4134,7 +3597,6 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken) if (cave[y][x].m_idx) { cave_type *c_ptr = &cave[y][x]; - monster_type *m_ptr = &m_list[c_ptr->m_idx]; /* Check the visibility */ @@ -4163,7 +3625,6 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken) /* Get "the monster" or "it" */ monster_desc(m_name, m_ptr, 0); - /* Message */ msg_format(_("%sã%sã«å½ä¸ããã", "The %s hits %s."), o_name, m_name); if (m_ptr->ml) @@ -4181,7 +3642,7 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken) ds = q_ptr->ds; torch_dice(q_ptr, &dd, &ds); /* throwing a torch */ tdam = damroll(dd, ds); - /* Apply special damage XXX XXX XXX */ + /* Apply special damage */ tdam = tot_dam_aux(q_ptr, tdam, m_ptr, 0, TRUE); tdam = critical_shot(q_ptr->weight, q_ptr->to_h, 0, tdam); if (q_ptr->to_d > 0) @@ -4214,11 +3675,8 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken) /* Modify the damage */ tdam = mon_damage_mod(m_ptr, tdam, FALSE); - /* Complex message */ - if (p_ptr->wizard) - { - msg_format(_("%d/%dã®ãã¡ã¼ã¸ãä¸ããã", "You do %d (out of %d) damage."), tdam, m_ptr->hp); - } + msg_format_wizard(CHEAT_MONSTER, _("%dã®ãã¡ã¼ã¸ãä¸ããã(æ®ãHP %d/%d(%d))", "You do %d damage. (left HP %d/%d(%d))"), + tdam, m_ptr->hp - tdam, m_ptr->maxhp, m_ptr->max_maxhp); /* Hit the monster, check for death */ if (mon_take_hit(c_ptr->m_idx, tdam, &fear, extract_note_dies(real_r_ptr(m_ptr)))) @@ -4229,7 +3687,6 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken) /* No death */ else { - /* Message */ message_pain(c_ptr->m_idx, tdam); /* Anger the monster */ @@ -4241,13 +3698,11 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken) { char m_name[80]; - /* Sound */ sound(SOUND_FLEE); /* Get the monster name (or "it") */ monster_desc(m_name, m_ptr, 0); - /* Message */ msg_format(_("%^sã¯ææãã¦éãåºããï¼", "%^s flees in terror!"), m_name); } } @@ -4283,7 +3738,6 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken) { if (hit_body || hit_wall || (randint1(100) < j)) { - /* Message */ msg_format(_("%sã¯ç ãæ£ã£ãï¼", "The %s shatters!"), o_name); if (potion_smash_effect(0, y, x, q_ptr->k_idx)) @@ -4393,7 +3847,6 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken) /* Recalculate mana XXX */ p_ptr->update |= (PU_MANA); - /* Window stuff */ p_ptr->window |= (PW_EQUIP); } else @@ -4427,17 +3880,6 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken) } -/*! - * @brief æå°å¦çã®ã¡ã¤ã³ã«ã¼ãã³ / - * Throw an object from the pack or floor. - * @return ãªã - */ -void do_cmd_throw(void) -{ - do_cmd_throw_aux(1, FALSE, -1); -} - - #ifdef TRAVEL /* * Hack: travel command @@ -4446,8 +3888,8 @@ void do_cmd_throw(void) static int flow_head = 0; static int flow_tail = 0; -static s16b temp2_x[MAX_SHORT]; -static s16b temp2_y[MAX_SHORT]; +static POSITION temp2_x[MAX_SHORT]; +static POSITION temp2_y[MAX_SHORT]; /*! * @brief ãã©ãã«å¦çã®è¨æ¶é åãåæåãã Hack: forget the "flow" information @@ -4455,7 +3897,7 @@ static s16b temp2_y[MAX_SHORT]; */ void forget_travel_flow(void) { - int x, y; + POSITION x, y; /* Check the entire dungeon */ for (y = 0; y < cur_hgt; y++) @@ -4476,7 +3918,7 @@ void forget_travel_flow(void) * @param x 該å½å°ç¹ã®Xåº§æ¨ * @return ã³ã¹ãå¤ */ -static int travel_flow_cost(int y, int x) +static int travel_flow_cost(POSITION y, POSITION x) { feature_type *f_ptr = &f_info[cave[y][x].feat]; int cost = 1; @@ -4519,7 +3961,7 @@ static int travel_flow_cost(int y, int x) * @param wall ãã¬ã¤ã¤ã¼ãå£ã®ä¸ã«ãããªãã°TRUE * @return ãªã */ -static void travel_flow_aux(int y, int x, int n, bool wall) +static void travel_flow_aux(POSITION y, POSITION x, int n, bool wall) { cave_type *c_ptr = &cave[y][x]; feature_type *f_ptr = &f_info[c_ptr->feat]; @@ -4576,9 +4018,9 @@ static void travel_flow_aux(int y, int x, int n, bool wall) * @param tx ç®æ¨å°ç¹ã®Xåº§æ¨ * @return ãªã */ -static void travel_flow(int ty, int tx) +static void travel_flow(POSITION ty, POSITION tx) { - int x, y, d; + POSITION x, y, d; bool wall = FALSE; feature_type *f_ptr = &f_info[cave[p_ptr->y][p_ptr->x].feat]; @@ -4622,7 +4064,8 @@ static void travel_flow(int ty, int tx) */ void do_cmd_travel(void) { - int x, y, i; + POSITION x, y; + int i; int dx, dy, sx, sy; feature_type *f_ptr;