X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=src%2Fmonster-process.c;h=5239eab40b48c9790cec9e4578d4625d1b37e7f8;hb=3f5ead8a475d7459e387297f2f122ca035d48aba;hp=2e1122219b17f07d0d7407a93d2b82bff5d6885d;hpb=4b1c8c76a81038fc42938b2276e6ee72473b2a2a;p=hengband%2Fhengband.git diff --git a/src/monster-process.c b/src/monster-process.c index 2e1122219..5239eab40 100644 --- a/src/monster-process.c +++ b/src/monster-process.c @@ -215,7 +215,7 @@ void mon_take_hit_mon(MONSTER_IDX m_idx, HIT_POINT dam, bool *fear, cptr note, I /* Wake it up */ (void)set_monster_csleep(m_idx, 0); - if (p_ptr->riding && (m_idx == p_ptr->riding)) disturb(1, 1); + if (p_ptr->riding && (m_idx == p_ptr->riding)) disturb(TRUE, TRUE); if (MON_INVULNER(m_ptr) && randint0(PENETRATE_INVULNERABILITY)) { @@ -298,7 +298,7 @@ void mon_take_hit_mon(MONSTER_IDX m_idx, HIT_POINT dam, bool *fear, cptr note, I /* Generate treasure */ monster_death(m_idx, FALSE); - /* Delete the monster */ + delete_monster_idx(m_idx); /* Not afraid */ @@ -338,7 +338,7 @@ void mon_take_hit_mon(MONSTER_IDX m_idx, HIT_POINT dam, bool *fear, cptr note, I /* Hack -- note fear */ (*fear) = TRUE; - /* XXX XXX XXX Hack -- Add some timed fear */ + /* Hack -- Add some timed fear */ (void)set_monster_monfear(m_idx, (randint1(10) + (((dam >= m_ptr->hp) && (percentage > 7)) ? 20 : ((11 - percentage) * 5)))); @@ -707,7 +707,7 @@ static bool get_fear_moves_aux(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp) /* Check nearby grids, diagonals first */ for (i = 7; i >= 0; i--) { - int dis, s; + POSITION dis, s; /* Get the location */ y = fy + ddy_ddd[i]; @@ -764,53 +764,30 @@ static bool get_fear_moves_aux(MONSTER_IDX m_idx, POSITION *yp, POSITION *xp) * It is probably better to replace these arrays with code to compute * the relevant arrays, even if the storage is pre-allocated in hard * coded sizes. At the very least, code should be included which is - * able to generate and dump these arrays (ala "los()"). XXX XXX XXX + * able to generate and dump these arrays (ala "los()"). * - * Also, the storage needs could be halved by using bytes. XXX XXX XXX + * Also, the storage needs could be halved by using bytes. * * These arrays could be combined into two big arrays, using sub-arrays * to hold the offsets and lengths of each portion of the sub-arrays, and - * this could perhaps also be used somehow in the "look" code. XXX XXX XXX + * this could perhaps also be used somehow in the "look" code. */ -static sint d_off_y_0[] = -{ 0 }; - -static sint d_off_x_0[] = -{ 0 }; - - -static sint d_off_y_1[] = -{ -1, -1, -1, 0, 0, 1, 1, 1, 0 }; - -static sint d_off_x_1[] = -{ -1, 0, 1, -1, 1, -1, 0, 1, 0 }; - +static sint d_off_y_0[] = { 0 }; +static sint d_off_x_0[] = { 0 }; -static sint d_off_y_2[] = -{ -1, -1, -2, -2, -2, 0, 0, 1, 1, 2, 2, 2, 0 }; +static sint d_off_y_1[] = { -1, -1, -1, 0, 0, 1, 1, 1, 0 }; +static sint d_off_x_1[] = { -1, 0, 1, -1, 1, -1, 0, 1, 0 }; -static sint d_off_x_2[] = -{ -2, 2, -1, 0, 1, -2, 2, -2, 2, -1, 0, 1, 0 }; +static sint d_off_y_2[] = { -1, -1, -2, -2, -2, 0, 0, 1, 1, 2, 2, 2, 0 }; +static sint d_off_x_2[] = { -2, 2, -1, 0, 1, -2, 2, -2, 2, -1, 0, 1, 0 }; +static sint d_off_y_3[] = { -1, -1, -2, -2, -3, -3, -3, 0, 0, 1, 1, 2, 2, 3, 3, 3, 0 }; +static sint d_off_x_3[] = { -3, 3, -2, 2, -1, 0, 1, -3, 3, -3, 3, -2, 2, -1, 0, 1, 0 }; -static sint d_off_y_3[] = -{ -1, -1, -2, -2, -3, -3, -3, 0, 0, 1, 1, 2, 2, - 3, 3, 3, 0 }; - -static sint d_off_x_3[] = -{ -3, 3, -2, 2, -1, 0, 1, -3, 3, -3, 3, -2, 2, - -1, 0, 1, 0 }; - - -static sint d_off_y_4[] = -{ -1, -1, -2, -2, -3, -3, -3, -3, -4, -4, -4, 0, - 0, 1, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 0 }; - -static sint d_off_x_4[] = -{ -4, 4, -3, 3, -2, -3, 2, 3, -1, 0, 1, -4, 4, - -4, 4, -3, 3, -2, -3, 2, 3, -1, 0, 1, 0 }; +static sint d_off_y_4[] = { -1, -1, -2, -2, -3, -3, -3, -3, -4, -4, -4, 0, 0, 1, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 0 }; +static sint d_off_x_4[] = { -4, 4, -3, 3, -2, -3, 2, 3, -1, 0, 1, -4, 4, -4, 4, -3, 3, -2, -3, 2, 3, -1, 0, 1, 0 }; static sint d_off_y_5[] = @@ -1181,7 +1158,6 @@ static bool get_moves(MONSTER_IDX m_idx, int *mm) y = m_ptr->fy - y2; x = m_ptr->fx - x2; - /* Done */ done = TRUE; } } @@ -1406,7 +1382,7 @@ static bool get_moves(MONSTER_IDX m_idx, int *mm) * @param stun 攻撃側モンスターが朦朧状態ならTRUEを返す * @return 命中ならばTRUEを返す */ -static int check_hit2(int power, int level, int ac, int stun) +static int check_hit2(int power, DEPTH level, ARMOUR_CLASS ac, int stun) { int i, k; @@ -1441,7 +1417,7 @@ static int check_hit2(int power, int level, int ac, int stun) * @param t_idx 目標側モンスターの参照ID * @return 実際に打撃処理が行われた場合TRUEを返す */ -static bool monst_attack_monst(MONSTER_IDX m_idx, IDX t_idx) +static bool monst_attack_monst(MONSTER_IDX m_idx, MONSTER_IDX t_idx) { monster_type *m_ptr = &m_list[m_idx]; monster_type *t_ptr = &m_list[t_idx]; @@ -1449,8 +1425,10 @@ static bool monst_attack_monst(MONSTER_IDX m_idx, IDX t_idx) monster_race *r_ptr = &r_info[m_ptr->r_idx]; monster_race *tr_ptr = &r_info[t_ptr->r_idx]; - int ap_cnt; - int ac, rlev, pt; + ARMOUR_CLASS ap_cnt; + ARMOUR_CLASS ac; + DEPTH rlev; + int pt; char m_name[80], t_name[80]; char temp[MAX_NLEN]; bool blinked; @@ -1495,7 +1473,7 @@ static bool monst_attack_monst(MONSTER_IDX m_idx, IDX t_idx) mon_fight = TRUE; } - if (p_ptr->riding && (m_idx == p_ptr->riding)) disturb(1, 1); + if (p_ptr->riding && (m_idx == p_ptr->riding)) disturb(TRUE, TRUE); /* Scan through all four blows */ for (ap_cnt = 0; ap_cnt < 4; ap_cnt++) @@ -1649,7 +1627,7 @@ static bool monst_attack_monst(MONSTER_IDX m_idx, IDX t_idx) case RBM_EXPLODE: { - if (see_either) disturb(1, 1); + if (see_either) disturb(TRUE, TRUE); act = _("爆発した。", "explodes."); explode = TRUE; touched = FALSE; @@ -1713,7 +1691,6 @@ static bool monst_attack_monst(MONSTER_IDX m_idx, IDX t_idx) } } - /* Message */ if (act && see_either) { #ifdef JP @@ -1991,9 +1968,8 @@ static bool monst_attack_monst(MONSTER_IDX m_idx, IDX t_idx) /* Visible monsters */ if (see_m) { - /* Message */ #ifdef JP - msg_format("%sは%^sの攻撃をかわした。", t_name,m_name); + msg_format("%sは%^sの攻撃をかわした。", t_name, m_name); #else msg_format("%^s misses %s.", m_name, t_name); #endif @@ -2092,7 +2068,7 @@ static bool check_hp_for_feat_destruction(feature_type *f_ptr, monster_type *m_p * fixate on opening a door even if they cannot open it. Actually,\n * the same thing happens to normal monsters when they hit a door\n *\n - * XXX XXX XXX In addition, monsters which *cannot* open or bash\n + * In addition, monsters which *cannot* open or bash\n * down a door will still stand there trying to open it...\n *\n * XXX Technically, need to check for monster in the way\n @@ -2191,7 +2167,7 @@ void process_monster(MONSTER_IDX m_idx) do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_LOSE_PARENT, m_name); } - /* Delete the monster */ + delete_monster_idx(m_idx); return; @@ -2218,14 +2194,13 @@ void process_monster(MONSTER_IDX m_idx) /* Acquire the monster name */ monster_desc(m_name, m_ptr, 0); - /* Oops */ msg_format(_("%sは消え去った!", "%^s disappears!"), m_name); } /* Generate treasure, etc */ monster_death(m_idx, FALSE); - /* Delete the monster */ + delete_monster_idx(m_idx); if (sad) @@ -2256,7 +2231,7 @@ void process_monster(MONSTER_IDX m_idx) msg_format(_("%sは傷の痛さの余りあなたの束縛から逃れようとしている。", "%^s seems to be in so much pain, and trying to escape from your restriction."), m_name); riding_pinch++; - disturb(1, 1); + disturb(TRUE, TRUE); } else { @@ -2605,7 +2580,7 @@ void process_monster(MONSTER_IDX m_idx) if (avoid || lonely || distant) { /* Remember the leash length */ - int dis = p_ptr->pet_follow_distance; + POSITION dis = p_ptr->pet_follow_distance; /* Hack -- adjust follow distance temporarily */ if (p_ptr->pet_follow_distance > PET_SEEK_DIST) @@ -2740,14 +2715,13 @@ void process_monster(MONSTER_IDX m_idx) /* Do not bash the door */ may_bash = FALSE; - /* Take a turn */ do_turn = TRUE; } /* Locked doors (not jammed) */ else { - /* Try to unlock it XXX XXX XXX */ + /* Try to unlock it */ if (randint0(m_ptr->hp / 10) > f_ptr->power) { /* Unlock the door */ @@ -2756,7 +2730,6 @@ void process_monster(MONSTER_IDX m_idx) /* Do not bash the door */ may_bash = FALSE; - /* Take a turn */ do_turn = TRUE; } } @@ -2766,17 +2739,16 @@ void process_monster(MONSTER_IDX m_idx) if (may_bash && (r_ptr->flags2 & RF2_BASH_DOOR) && have_flag(f_ptr->flags, FF_BASH) && (!is_pet(m_ptr) || (p_ptr->pet_extra_flags & PF_OPEN_DOORS))) { - /* Attempt to Bash XXX XXX XXX */ + /* Attempt to Bash */ if (check_hp_for_feat_destruction(f_ptr, m_ptr) && (randint0(m_ptr->hp / 10) > f_ptr->power)) { - /* Message */ if (have_flag(f_ptr->flags, FF_GLASS)) msg_print(_("ガラスが砕ける音がした!", "You hear a glass was crashed!")); else msg_print(_("ドアを叩き開ける音がした!", "You hear a door burst open!")); /* Disturb (sometimes) */ - if (disturb_minor) disturb(0, 0); + if (disturb_minor) disturb(FALSE, FALSE); /* The door was bashed open */ did_bash_door = TRUE; @@ -2846,7 +2818,6 @@ void process_monster(MONSTER_IDX m_idx) /* Allow movement */ do_move = TRUE; - /* Notice */ note_spot(ny, nx); } } @@ -2988,7 +2959,7 @@ void process_monster(MONSTER_IDX m_idx) /* Wake up the moved monster */ (void)set_monster_csleep(c_ptr->m_idx, 0); - /* XXX XXX XXX Message */ + /* Message */ } } @@ -3024,7 +2995,6 @@ void process_monster(MONSTER_IDX m_idx) /* Note changes to viewable region */ do_view = TRUE; - /* Take a turn */ do_turn = TRUE; } @@ -3062,7 +3032,6 @@ void process_monster(MONSTER_IDX m_idx) /* Creature has been allowed move */ if (do_move) { - /* Take a turn */ do_turn = TRUE; if (have_flag(f_ptr->flags, FF_TREE)) @@ -3119,22 +3088,21 @@ void process_monster(MONSTER_IDX m_idx) (disturb_near && (m_ptr->mflag & MFLAG_VIEW) && projectable(p_ptr->y, p_ptr->x, m_ptr->fy, m_ptr->fx)) || (disturb_high && ap_r_ptr->r_tkills && ap_r_ptr->level >= p_ptr->lev))) { - /* Disturb */ if (is_hostile(m_ptr)) - disturb(0, 1); + disturb(FALSE, TRUE); } /* Take or Kill objects on the floor */ if (c_ptr->o_idx && (r_ptr->flags2 & (RF2_TAKE_ITEM | RF2_KILL_ITEM)) && (!is_pet(m_ptr) || ((p_ptr->pet_extra_flags & PF_PICKUP_ITEMS) && (r_ptr->flags2 & RF2_TAKE_ITEM)))) { - s16b this_o_idx, next_o_idx; + OBJECT_IDX this_o_idx, next_o_idx; bool do_take = (r_ptr->flags2 & RF2_TAKE_ITEM) ? TRUE : FALSE; /* Scan all objects in the grid */ for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx) { - u32b flgs[TR_FLAG_SIZE], flg2 = 0L, flg3 = 0L, flgr = 0L; + BIT_FLAGS flgs[TR_FLAG_SIZE], flg2 = 0L, flg3 = 0L, flgr = 0L; char m_name[80], o_name[MAX_NLEN]; /* Acquire object */ @@ -3255,7 +3223,6 @@ void process_monster(MONSTER_IDX m_idx) msg_format(_("%^sが%sを破壊した。", "%^s destroys %s."), m_name, o_name); } - /* Delete the object */ delete_object_idx(this_o_idx); } } @@ -3290,7 +3257,6 @@ void process_monster(MONSTER_IDX m_idx) /* Update some things */ p_ptr->update |= (PU_FLOW); - /* Window stuff */ p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON); } @@ -3348,7 +3314,7 @@ void process_monster(MONSTER_IDX m_idx) if (m_ptr->ml) chg_virtue(V_COMPASSION, -1); - /* XXX XXX XXX Actually do something now (?) */ + /* Actually do something now (?) */ } } @@ -3590,7 +3556,6 @@ void process_monsters(void) (old_r_blows3 != r_ptr->r_blows[3]) || (old_r_cast_spell != r_ptr->r_cast_spell)) { - /* Window stuff */ p_ptr->window |= (PW_MONSTER); } }