From 65f1bf941932b6d02fdba31cfc3f95dea7ef3e6e Mon Sep 17 00:00:00 2001 From: Deskull Date: Wed, 3 Oct 2018 22:51:41 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#37353=E3=80=80dungeon=EF=BD=9Espel?= =?utf8?q?l2=E9=96=93=E6=95=B4=E7=90=86=E3=80=82=20/=20Refactor=20between?= =?utf8?q?=20dungeon=20and=20spell2.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/dungeon.c | 125 +--------------------------------------------------------- src/externs.h | 5 ++- src/spells2.c | 124 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 129 insertions(+), 125 deletions(-) diff --git a/src/dungeon.c b/src/dungeon.c index 9b6718c4f..28a77d289 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -30,7 +30,7 @@ static int wild_regen = 20; /*!<広域マップ移動時の自然回復処理カ * @param o_ptr 擬似鑑定を行うオブジェクトの参照ポインタ。 * @return 擬似鑑定結果のIDを返す。 */ -static byte value_check_aux1(object_type *o_ptr) +byte value_check_aux1(object_type *o_ptr) { /* Artifacts */ if (object_is_artifact(o_ptr)) @@ -75,7 +75,7 @@ static byte value_check_aux1(object_type *o_ptr) * @param o_ptr 擬似鑑定を行うオブジェクトの参照ポインタ。 * @return 擬似鑑定結果のIDを返す。 */ -static byte value_check_aux2(object_type *o_ptr) +byte value_check_aux2(object_type *o_ptr) { /* Cursed items (all of them) */ if (object_is_cursed(o_ptr)) return FEEL_CURSED; @@ -1209,127 +1209,6 @@ void leave_tower_check(void) } } -/*! - * @brief 超能力者のサイコメトリー処理/ Forcibly pseudo-identify an object in the inventory (or on the floor) - * @return なし - * @todo mind.cにこの関数を移動させるべき。 - * @note - * currently this function allows pseudo-id of any object, - * including silly ones like potions & scrolls, which always - * get '{average}'. This should be changed, either to stop such - * items from being pseudo-id'd, or to allow psychometry to - * detect whether the unidentified potion/scroll/etc is - * good (Cure Light Wounds, Restore Strength, etc) or - * bad (Poison, Weakness etc) or 'useless' (Slime Mold Juice, etc). - */ -bool psychometry(void) -{ - OBJECT_IDX item; - object_type *o_ptr; - char o_name[MAX_NLEN]; - byte feel; - cptr q, s; - bool okay = FALSE; - - item_tester_no_ryoute = TRUE; - /* Get an item */ - q = _("どのアイテムを調べますか?", "Meditate on which item? "); - s = _("調べるアイテムがありません。", "You have nothing appropriate."); - - if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE); - - /* Get the item (in the pack) */ - if (item >= 0) - { - o_ptr = &inventory[item]; - } - - /* Get the item (on the floor) */ - else - { - o_ptr = &o_list[0 - item]; - } - - /* It is fully known, no information needed */ - if (object_is_known(o_ptr)) - { - msg_print(_("何も新しいことは判らなかった。", "You cannot find out anything more about that.")); - return TRUE; - } - - /* Check for a feeling */ - feel = value_check_aux1(o_ptr); - - /* Get an object description */ - object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY)); - - /* Skip non-feelings */ - if (!feel) - { - msg_format(_("%sからは特に変わった事は感じとれなかった。", "You do not perceive anything unusual about the %s."), o_name); - return TRUE; - } - -#ifdef JP -msg_format("%sは%sという感じがする...", - o_name, game_inscriptions[feel]); -#else - msg_format("You feel that the %s %s %s...", - o_name, ((o_ptr->number == 1) ? "is" : "are"), - game_inscriptions[feel]); -#endif - - - /* We have "felt" it */ - o_ptr->ident |= (IDENT_SENSE); - - /* "Inscribe" it */ - o_ptr->feeling = feel; - - /* Player touches it */ - o_ptr->marked |= OM_TOUCHED; - - /* Combine / Reorder the pack (later) */ - p_ptr->notice |= (PN_COMBINE | PN_REORDER); - - /* Window stuff */ - p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER); - - /* Valid "tval" codes */ - switch (o_ptr->tval) - { - case TV_SHOT: - case TV_ARROW: - case TV_BOLT: - case TV_BOW: - case TV_DIGGING: - case TV_HAFTED: - case TV_POLEARM: - case TV_SWORD: - case TV_BOOTS: - case TV_GLOVES: - case TV_HELM: - case TV_CROWN: - case TV_SHIELD: - case TV_CLOAK: - case TV_SOFT_ARMOR: - case TV_HARD_ARMOR: - case TV_DRAG_ARMOR: - case TV_CARD: - case TV_RING: - case TV_AMULET: - case TV_LITE: - case TV_FIGURINE: - okay = TRUE; - break; - } - - /* Auto-inscription/destroy */ - autopick_alter_item(item, (bool)(okay && destroy_feeling)); - - /* Something happened */ - return (TRUE); -} /*! * @brief !!を刻んだ魔道具の時間経過による再充填を知らせる処理 / If player has inscribed the object with "!!", let him know when it's recharged. -LM- diff --git a/src/externs.h b/src/externs.h index b87d72e40..a408f6245 100644 --- a/src/externs.h +++ b/src/externs.h @@ -790,9 +790,11 @@ extern void extract_option_vars(void); extern void determine_bounty_uniques(void); extern void determine_today_mon(bool conv_old); extern void play_game(bool new_game); -extern bool psychometry(void); extern s32b turn_real(s32b hoge); extern void prevent_turn_overflow(void); +extern byte value_check_aux1(object_type *o_ptr); +extern byte value_check_aux2(object_type *o_ptr); + /* files.c */ @@ -1182,6 +1184,7 @@ extern bool restore_all_status(void); extern void stop_mouth(void); extern bool_hack vampirism(void); extern bool panic_hit(void); +extern bool psychometry(void); /* spells3.c */ extern bool teleport_away(MONSTER_IDX m_idx, int dis, BIT_FLAGS mode); diff --git a/src/spells2.c b/src/spells2.c index 113235a6a..495c4ef43 100644 --- a/src/spells2.c +++ b/src/spells2.c @@ -5202,4 +5202,126 @@ bool panic_hit(void) return FALSE; } -} \ No newline at end of file +} + +/*! +* @brief 超能力者のサイコメトリー処理/ Forcibly pseudo-identify an object in the inventory (or on the floor) +* @return なし +* @todo mind.cにこの関数を移動させるべき。 +* @note +* currently this function allows pseudo-id of any object, +* including silly ones like potions & scrolls, which always +* get '{average}'. This should be changed, either to stop such +* items from being pseudo-id'd, or to allow psychometry to +* detect whether the unidentified potion/scroll/etc is +* good (Cure Light Wounds, Restore Strength, etc) or +* bad (Poison, Weakness etc) or 'useless' (Slime Mold Juice, etc). +*/ +bool psychometry(void) +{ + OBJECT_IDX item; + object_type *o_ptr; + char o_name[MAX_NLEN]; + byte feel; + cptr q, s; + bool okay = FALSE; + + item_tester_no_ryoute = TRUE; + /* Get an item */ + q = _("どのアイテムを調べますか?", "Meditate on which item? "); + s = _("調べるアイテムがありません。", "You have nothing appropriate."); + + if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE); + + /* Get the item (in the pack) */ + if (item >= 0) + { + o_ptr = &inventory[item]; + } + + /* Get the item (on the floor) */ + else + { + o_ptr = &o_list[0 - item]; + } + + /* It is fully known, no information needed */ + if (object_is_known(o_ptr)) + { + msg_print(_("何も新しいことは判らなかった。", "You cannot find out anything more about that.")); + return TRUE; + } + + /* Check for a feeling */ + feel = value_check_aux1(o_ptr); + + /* Get an object description */ + object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY)); + + /* Skip non-feelings */ + if (!feel) + { + msg_format(_("%sからは特に変わった事は感じとれなかった。", "You do not perceive anything unusual about the %s."), o_name); + return TRUE; + } + +#ifdef JP + msg_format("%sは%sという感じがする...", + o_name, game_inscriptions[feel]); +#else + msg_format("You feel that the %s %s %s...", + o_name, ((o_ptr->number == 1) ? "is" : "are"), + game_inscriptions[feel]); +#endif + + + /* We have "felt" it */ + o_ptr->ident |= (IDENT_SENSE); + + /* "Inscribe" it */ + o_ptr->feeling = feel; + + /* Player touches it */ + o_ptr->marked |= OM_TOUCHED; + + /* Combine / Reorder the pack (later) */ + p_ptr->notice |= (PN_COMBINE | PN_REORDER); + + /* Window stuff */ + p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER); + + /* Valid "tval" codes */ + switch (o_ptr->tval) + { + case TV_SHOT: + case TV_ARROW: + case TV_BOLT: + case TV_BOW: + case TV_DIGGING: + case TV_HAFTED: + case TV_POLEARM: + case TV_SWORD: + case TV_BOOTS: + case TV_GLOVES: + case TV_HELM: + case TV_CROWN: + case TV_SHIELD: + case TV_CLOAK: + case TV_SOFT_ARMOR: + case TV_HARD_ARMOR: + case TV_DRAG_ARMOR: + case TV_CARD: + case TV_RING: + case TV_AMULET: + case TV_LITE: + case TV_FIGURINE: + okay = TRUE; + break; + } + + /* Auto-inscription/destroy */ + autopick_alter_item(item, (bool)(okay && destroy_feeling)); + + /* Something happened */ + return (TRUE); +} -- 2.11.0