OSDN Git Service

[Refactor] #37353 コメント整理。 / Refactor comments.
[hengband/hengband.git] / src / dungeon.c
index 2e47cb6..b70e1a9 100644 (file)
 #include "cmd-zaprod.h"
 #include "cmd-zapwand.h"
 #include "cmd-pet.h"
+#include "floor.h"
 #include "floor-events.h"
 #include "object-curse.h"
 #include "store.h"
+#include "spells-summon.h"
+#include "spells-object.h"
 #include "monsterrace-hook.h"
 #include "world.h"
+#include "mutation.h"
+#include "quest.h"
+#include "artifact.h"
+#include "avatar.h"
+#include "player-status.h"
 
 static bool load = TRUE; /*!<ロード処理中の分岐フラグ*/
 static int wild_regen = 20; /*!<広域マップ移動時の自然回復処理カウンタ(広域マップ1マス毎に20回処理を基本とする)*/
@@ -147,8 +155,6 @@ static void sense_inventory_aux(INVENTORY_IDX slot, bool heavy)
 
        /* Auto-inscription/destroy */
        autopick_alter_item(slot, destroy_feeling);
-
-       /* Combine / Reorder the pack (later) */
        p_ptr->update |= (PU_COMBINE | PU_REORDER);
 
        p_ptr->window |= (PW_INVEN | PW_EQUIP);
@@ -523,8 +529,8 @@ static void pattern_teleport(void)
        /* Ask for level */
        if (get_check(_("他の階にテレポートしますか?", "Teleport level? ")))
        {
-               char    ppp[80];
-               char    tmp_val[160];
+               char ppp[80];
+               char tmp_val[160];
 
                /* Only downward in ironman mode */
                if (ironman_downward)
@@ -582,7 +588,7 @@ static void pattern_teleport(void)
 
        leave_quest_check();
 
-       if (record_stair) do_cmd_write_nikki(NIKKI_PAT_TELE,0,NULL);
+       if (record_stair) do_cmd_write_nikki(NIKKI_PAT_TELE, 0, NULL);
 
        p_ptr->inside_quest = 0;
        p_ptr->energy_use = 0;
@@ -616,9 +622,7 @@ static void wreck_the_pattern(void)
        msg_print(_("パターンを血で汚してしまった!", "You bleed on the Pattern!"));
        msg_print(_("何か恐ろしい事が起こった!", "Something terrible happens!"));
 
-       if (!IS_INVULN())
-               take_hit(DAMAGE_NOESCAPE, damroll(10, 8), _("パターン損壊", "corrupting the Pattern"), -1);
-
+       if (!IS_INVULN()) take_hit(DAMAGE_NOESCAPE, damroll(10, 8), _("パターン損壊", "corrupting the Pattern"), -1);
        to_ruin = randint1(45) + 35;
 
        while (to_ruin--)
@@ -1049,7 +1053,7 @@ void leave_quest_check(void)
               (q_ptr->status == QUEST_STATUS_TAKEN))
                {
                        q_ptr->status = QUEST_STATUS_FAILED;
-                       q_ptr->complev = (byte)p_ptr->lev;
+                       q_ptr->complev = p_ptr->lev;
                        update_playtime();
                        q_ptr->comptime = playtime;
 
@@ -1058,7 +1062,7 @@ void leave_quest_check(void)
                        {
                          case QUEST_TYPE_TOWER:
                                quest[QUEST_TOWER1].status = QUEST_STATUS_FAILED;
-                               quest[QUEST_TOWER1].complev = (byte)p_ptr->lev;
+                               quest[QUEST_TOWER1].complev = p_ptr->lev;
                                break;
                          case QUEST_TYPE_FIND_ARTIFACT:
                                a_info[q_ptr->k_idx].gen_flags &= ~(TRG_QUESTITEM);
@@ -1099,7 +1103,7 @@ void leave_tower_check(void)
                if(quest[leaving_quest].type == QUEST_TYPE_TOWER)
                {
                        quest[QUEST_TOWER1].status = QUEST_STATUS_FAILED;
-                       quest[QUEST_TOWER1].complev = (byte)p_ptr->lev;
+                       quest[QUEST_TOWER1].complev = p_ptr->lev;
                        update_playtime();
                        quest[QUEST_TOWER1].comptime = playtime;
                }
@@ -1116,7 +1120,7 @@ static void recharged_notice(object_type *o_ptr)
 {
        GAME_TEXT o_name[MAX_NLEN];
 
-       cptr s;
+       concptr s;
 
        /* No inscription */
        if (!o_ptr->inscription) return;
@@ -1200,12 +1204,8 @@ static void check_music(void)
                        INTERUPTING_SONG_EFFECT(p_ptr) = MUSIC_NONE;
                        msg_print(_("歌を再開した。", "You restart singing."));
                        p_ptr->action = ACTION_SING;
-                       p_ptr->update |= (PU_BONUS | PU_HP);
-
-                       /* Redraw map and status bar */
+                       p_ptr->update |= (PU_BONUS | PU_HP | PU_MONSTERS);
                        p_ptr->redraw |= (PR_MAP | PR_STATUS | PR_STATE);
-                       p_ptr->update |= (PU_MONSTERS);
-
                        p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
                }
        }
@@ -1492,7 +1492,7 @@ static void process_world_aux_hp_and_sp(void)
                        }
                        else
                        {
-                               cptr name = f_name + f_info[get_feat_mimic(&cave[p_ptr->y][p_ptr->x])].name;
+                               concptr name = f_name + f_info[get_feat_mimic(&cave[p_ptr->y][p_ptr->x])].name;
                                msg_format(_("%sで火傷した!", "The %s burns you!"), name);
                                take_hit(DAMAGE_NOESCAPE, damage, name, -1);
                        }
@@ -1530,7 +1530,7 @@ static void process_world_aux_hp_and_sp(void)
                        }
                        else
                        {
-                               cptr name = f_name + f_info[get_feat_mimic(&cave[p_ptr->y][p_ptr->x])].name;
+                               concptr name = f_name + f_info[get_feat_mimic(&cave[p_ptr->y][p_ptr->x])].name;
                                msg_format(_("%sに凍えた!", "The %s frostbites you!"), name);
                                take_hit(DAMAGE_NOESCAPE, damage, name, -1);
                        }
@@ -1568,7 +1568,7 @@ static void process_world_aux_hp_and_sp(void)
                        }
                        else
                        {
-                               cptr name = f_name + f_info[get_feat_mimic(&cave[p_ptr->y][p_ptr->x])].name;
+                               concptr name = f_name + f_info[get_feat_mimic(&cave[p_ptr->y][p_ptr->x])].name;
                                msg_format(_("%sに感電した!", "The %s shocks you!"), name);
                                take_hit(DAMAGE_NOESCAPE, damage, name, -1);
                        }
@@ -1606,7 +1606,7 @@ static void process_world_aux_hp_and_sp(void)
                        }
                        else
                        {
-                               cptr name = f_name + f_info[get_feat_mimic(&cave[p_ptr->y][p_ptr->x])].name;
+                               concptr name = f_name + f_info[get_feat_mimic(&cave[p_ptr->y][p_ptr->x])].name;
                                msg_format(_("%sに溶かされた!", "The %s melts you!"), name);
                                take_hit(DAMAGE_NOESCAPE, damage, name, -1);
                        }
@@ -1645,7 +1645,7 @@ static void process_world_aux_hp_and_sp(void)
                        }
                        else
                        {
-                               cptr name = f_name + f_info[get_feat_mimic(&cave[p_ptr->y][p_ptr->x])].name;
+                               concptr name = f_name + f_info[get_feat_mimic(&cave[p_ptr->y][p_ptr->x])].name;
                                msg_format(_("%sに毒された!", "The %s poisons you!"), name);
                                take_hit(DAMAGE_NOESCAPE, damage, name, -1);
                                if (p_ptr->resist_pois) (void)set_poisoned(p_ptr->poisoned + 3);
@@ -1656,7 +1656,7 @@ static void process_world_aux_hp_and_sp(void)
        }
 
        if (have_flag(f_ptr->flags, FF_WATER) && have_flag(f_ptr->flags, FF_DEEP) &&
-           !p_ptr->levitation && !p_ptr->can_swim)
+           !p_ptr->levitation && !p_ptr->can_swim && !p_ptr->resist_water)
        {
                if (p_ptr->total_weight > weight_limit())
                {
@@ -1708,7 +1708,7 @@ static void process_world_aux_hp_and_sp(void)
        {
                if (!IS_INVULN() && !p_ptr->wraith_form && !p_ptr->kabenuke && ((p_ptr->chp > (p_ptr->lev / 5)) || !p_ptr->pass_wall))
                {
-                       cptr dam_desc;
+                       concptr dam_desc;
                        cave_no_regen = TRUE;
 
                        if (p_ptr->pass_wall)
@@ -2595,18 +2595,18 @@ static void process_world_aux_mutation(void)
                take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), _("転倒", "tripping"), -1);
 
                msg_print(NULL);
-               if (buki_motteruka(INVEN_RARM))
+               if (has_melee_weapon(INVEN_RARM))
                {
                        slot = INVEN_RARM;
                        o_ptr = &inventory[INVEN_RARM];
 
-                       if (buki_motteruka(INVEN_LARM) && one_in_(2))
+                       if (has_melee_weapon(INVEN_LARM) && one_in_(2))
                        {
                                o_ptr = &inventory[INVEN_LARM];
                                slot = INVEN_LARM;
                        }
                }
-               else if (buki_motteruka(INVEN_LARM))
+               else if (has_melee_weapon(INVEN_LARM))
                {
                        o_ptr = &inventory[INVEN_LARM];
                        slot = INVEN_LARM;
@@ -2947,7 +2947,6 @@ static void process_world_aux_recharge(void)
        /* Process objects on floor */
        for (i = 1; i < o_max; i++)
        {
-               /* Access object */
                object_type *o_ptr = &o_list[i];
 
                /* Skip dead objects */
@@ -4163,7 +4162,7 @@ static void process_command(void)
                        else if (p_ptr->pclass == CLASS_SAMURAI)
                                do_cmd_gain_hissatsu();
                        else if (p_ptr->pclass == CLASS_MAGIC_EATER)
-                               gain_magic();
+                               import_magic_device();
                        else
                                do_cmd_study();
                        break;
@@ -4204,7 +4203,7 @@ static void process_command(void)
                                }
                                else if (p_ptr->anti_magic && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH))
                                {
-                                       cptr which_power = _("魔法", "magic");
+                                       concptr which_power = _("魔法", "magic");
                                        if (p_ptr->pclass == CLASS_MINDCRAFTER)
                                                which_power = _("超能力", "psionic powers");
                                        else if (p_ptr->pclass == CLASS_IMITATOR)
@@ -4499,7 +4498,7 @@ static void process_command(void)
                /* Repeat level feeling */
                case KTRL('F'):
                {
-                       if (!p_ptr->wild_mode) do_cmd_feeling();
+                       do_cmd_feeling();
                        break;
                }
 
@@ -6118,7 +6117,6 @@ void play_game(bool new_game)
                /* Process the level */
                dungeon(load_game);
 
-
                /* Hack -- prevent "icky" message */
                character_xtra = TRUE;
 
@@ -6175,106 +6173,7 @@ void play_game(bool new_game)
                                /* Mega-Hack -- Allow player to cheat death */
                                if ((p_ptr->wizard || cheat_live) && !get_check(_("死にますか? ", "Die? ")))
                                {
-                                       /* Mark social class, reset age, if needed */
-                                       if (p_ptr->sc) p_ptr->sc = p_ptr->age = 0;
-
-                                       /* Increase age */
-                                       p_ptr->age++;
-
-                                       /* Mark savefile */
-                                       p_ptr->noscore |= 0x0001;
-
-                                       msg_print(_("ウィザードモードに念を送り、死を欺いた。", "You invoke wizard mode and cheat death."));
-                                       msg_print(NULL);
-
-                                       (void)life_stream(FALSE, FALSE);
-
-                                       if (p_ptr->pclass == CLASS_MAGIC_EATER)
-                                       {
-                                               int magic_idx;
-                                               for (magic_idx = 0; magic_idx < EATER_EXT*2; magic_idx++)
-                                               {
-                                                       p_ptr->magic_num1[magic_idx] = p_ptr->magic_num2[magic_idx]*EATER_CHARGE;
-                                               }
-                                               for (; magic_idx < EATER_EXT*3; magic_idx++)
-                                               {
-                                                       p_ptr->magic_num1[magic_idx] = 0;
-                                               }
-                                       }
-
-                                       /* Restore spell points */
-                                       p_ptr->csp = p_ptr->msp;
-                                       p_ptr->csp_frac = 0;
-
-                                       /* Hack -- cancel recall */
-                                       if (p_ptr->word_recall)
-                                       {
-                                               msg_print(_("張りつめた大気が流れ去った...", "A tension leaves the air around you..."));
-                                               msg_print(NULL);
-
-                                               /* Hack -- Prevent recall */
-                                               p_ptr->word_recall = 0;
-                                               p_ptr->redraw |= (PR_STATUS);
-                                       }
-
-                                       /* Hack -- cancel alter */
-                                       if (p_ptr->alter_reality)
-                                       {
-                                               /* Hack -- Prevent alter */
-                                               p_ptr->alter_reality = 0;
-                                               p_ptr->redraw |= (PR_STATUS);
-                                       }
-
-                                       /* Note cause of death */
-                                       (void)strcpy(p_ptr->died_from, _("死の欺き", "Cheating death"));
-
-                                       /* Do not die */
-                                       p_ptr->is_dead = FALSE;
-
-                                       /* Hack -- Prevent starvation */
-                                       (void)set_food(PY_FOOD_MAX - 1);
-
-                                       dun_level = 0;
-                                       p_ptr->inside_arena = FALSE;
-                                       p_ptr->inside_battle = FALSE;
-                                       leaving_quest = 0;
-                                       p_ptr->inside_quest = 0;
-                                       if (dungeon_type) p_ptr->recall_dungeon = dungeon_type;
-                                       dungeon_type = 0;
-                                       if (lite_town || vanilla_town)
-                                       {
-                                               p_ptr->wilderness_y = 1;
-                                               p_ptr->wilderness_x = 1;
-                                               if (vanilla_town)
-                                               {
-                                                       p_ptr->oldpy = 10;
-                                                       p_ptr->oldpx = 34;
-                                               }
-                                               else
-                                               {
-                                                       p_ptr->oldpy = 33;
-                                                       p_ptr->oldpx = 131;
-                                               }
-                                       }
-                                       else
-                                       {
-                                               p_ptr->wilderness_y = 48;
-                                               p_ptr->wilderness_x = 5;
-                                               p_ptr->oldpy = 33;
-                                               p_ptr->oldpx = 131;
-                                       }
-
-                                       /* Leaving */
-                                       p_ptr->wild_mode = FALSE;
-                                       p_ptr->leaving = TRUE;
-
-                                       do_cmd_write_nikki(NIKKI_BUNSHOU, 1, 
-                                                               _("                            しかし、生き返った。", 
-                                                                 "                            but revived."));
-
-                                       /* Prepare next floor */
-                                       leave_floor();
-                                       wipe_m_list();
+                                       cheat_death(p_ptr);
                                }
                        }
                }