OSDN Git Service

Save damages dealt by player for each monster. (Do not use yet)
[hengband/hengband.git] / src / dungeon.c
index 2f772a1..d984c7d 100644 (file)
@@ -869,9 +869,10 @@ static void regenhp(int percent)
 /*
  * Regenerate mana points
  */
-static void regenmana(int percent)
+static void regenmana(int upkeep_factor, int regen_amount)
 {
        s32b old_csp = p_ptr->csp;
+       s32b regen_rate = regen_amount * 100 - upkeep_factor * PY_REGEN_NORMAL;
 
        /*
         * Excess mana will decay 32 times faster than normal
@@ -898,11 +899,11 @@ static void regenmana(int percent)
        }
 
        /* Regenerating mana (unless the player has excess mana) */
-       else if (percent > 0)
+       else if (regen_rate > 0)
        {
                /* (percent/100) is the Regen factor in unit (1/2^16) */
                s32b new_mana = 0;
-               u32b new_mana_frac = (p_ptr->msp * percent / 100 + PY_REGEN_MNBASE);
+               u32b new_mana_frac = (p_ptr->msp * regen_rate / 100 + PY_REGEN_MNBASE);
 
                /* Convert the unit (1/2^16) to (1/2^32) */
                s64b_LSHIFT(new_mana, new_mana_frac, 16);
@@ -920,11 +921,11 @@ static void regenmana(int percent)
 
 
        /* Reduce mana (even when the player has excess mana) */
-       if (percent < 0)
+       if (regen_rate < 0)
        {
                /* PY_REGEN_NORMAL is the Regen factor in unit (1/2^16) */
                s32b reduce_mana = 0;
-               u32b reduce_mana_frac = (p_ptr->msp * PY_REGEN_NORMAL + PY_REGEN_MNBASE);
+               u32b reduce_mana_frac = (p_ptr->msp * (-1) * regen_rate / 100 + PY_REGEN_MNBASE);
 
                /* Convert the unit (1/2^16) to (1/2^32) */
                s64b_LSHIFT(reduce_mana, reduce_mana_frac, 16);
@@ -959,17 +960,22 @@ static void regenmana(int percent)
 
 /*
  * Regenerate magic
+ * regen_amount: PY_REGEN_NORMAL * 2 (if resting) * 2 (if having regenarate)
  */
-static void regenmagic(int percent)
+static void regenmagic(int regen_amount)
 {
-       s32b        new_mana;
+       s32b new_mana;
        int i;
+       int dev = 30;
+       int mult = (dev + adj_mag_mana[p_ptr->stat_ind[A_INT]]); /* x1 to x2 speed bonus for recharging */
 
        for (i = 0; i < EATER_EXT*2; i++)
        {
                if (!p_ptr->magic_num2[i]) continue;
                if (p_ptr->magic_num1[i] == ((long)p_ptr->magic_num2[i] << 16)) continue;
-               new_mana = ((long)p_ptr->magic_num2[i]+adj_mag_mana[A_INT]+13) * percent / 8;
+
+               /* Increase remaining charge number like float value */
+               new_mana = (regen_amount * mult * ((long)p_ptr->magic_num2[i] + 13)) / (dev * 8);
                p_ptr->magic_num1[i] += new_mana;
 
                /* Check maximum charge */
@@ -983,7 +989,13 @@ static void regenmagic(int percent)
        {
                if (!p_ptr->magic_num1[i]) continue;
                if (!p_ptr->magic_num2[i]) continue;
-               p_ptr->magic_num1[i] -= (long)(p_ptr->magic_num2[i] * (adj_mag_mana[A_INT] + 10)) * EATER_ROD_CHARGE/16;
+
+               /* Decrease remaining period for charging */
+               new_mana = (regen_amount * mult * ((long)p_ptr->magic_num2[i] + 10) * EATER_ROD_CHARGE) 
+                                       / (dev * 16 * PY_REGEN_NORMAL); 
+               p_ptr->magic_num1[i] -= new_mana;
+
+               /* Check minimum remaining period for charging */
                if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0;
                wild_regen = 20;
        }
@@ -1117,7 +1129,7 @@ static void notice_lite_change(object_type *o_ptr)
        /* The light is now out */
        else if (o_ptr->xtra4 == 0)
        {
-               disturb(0, 0);
+               disturb(0, 1);
 #ifdef JP
 msg_print("ÌÀ¤«¤ê¤¬¾Ã¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª");
 #else
@@ -1137,7 +1149,7 @@ msg_print("
                if ((o_ptr->xtra4 < 50) && (!(o_ptr->xtra4 % 5))
                    && (turn % (TURNS_PER_TICK*2)))
                {
-                       if (disturb_minor) disturb(0, 0);
+                       if (disturb_minor) disturb(0, 1);
 #ifdef JP
 msg_print("ÌÀ¤«¤ê¤¬Èù¤«¤Ë¤Ê¤Ã¤Æ¤­¤Æ¤¤¤ë¡£");
 #else
@@ -1150,7 +1162,7 @@ msg_print("
        /* The light is getting dim */
        else if ((o_ptr->xtra4 < 100) && (!(o_ptr->xtra4 % 10)))
        {
-               if (disturb_minor) disturb(0, 0);
+               if (disturb_minor) disturb(0, 1);
 #ifdef JP
 msg_print("ÌÀ¤«¤ê¤¬Èù¤«¤Ë¤Ê¤Ã¤Æ¤­¤Æ¤¤¤ë¡£");
 #else
@@ -1173,17 +1185,50 @@ void leave_quest_check(void)
        {
                quest[leaving_quest].status = QUEST_STATUS_FAILED;
                quest[leaving_quest].complev = (byte)p_ptr->lev;
-               if (quest[leaving_quest].type == QUEST_TYPE_RANDOM)
+
+               /* Additional settings */
+               switch (quest[leaving_quest].type)
                {
+               case QUEST_TYPE_TOWER:
+                       quest[QUEST_TOWER1].status = QUEST_STATUS_FAILED;
+                       quest[QUEST_TOWER1].complev = (byte)p_ptr->lev;
+                       break;
+               case QUEST_TYPE_FIND_ARTIFACT:
+                       a_info[quest[leaving_quest].k_idx].gen_flags &= ~(TRG_QUESTITEM);
+                       break;
+               case QUEST_TYPE_RANDOM:
                        r_info[quest[leaving_quest].r_idx].flags1 &= ~(RF1_QUESTOR);
-                       if (record_rand_quest)
-                               do_cmd_write_nikki(NIKKI_RAND_QUEST_F, leaving_quest, NULL);
 
                        /* Floor of random quest will be blocked */
                        prepare_change_floor_mode(CFM_NO_RETURN);
+                       break;
+               }
+
+               /* Record finishing a quest */
+               if (quest[leaving_quest].type == QUEST_TYPE_RANDOM)
+               {
+                       if (record_rand_quest) do_cmd_write_nikki(NIKKI_RAND_QUEST_F, leaving_quest, NULL);
+               }
+               else
+               {
+                       if (record_fix_quest) do_cmd_write_nikki(NIKKI_FIX_QUEST_F, leaving_quest, NULL);
+               }
+       }
+}
+
+void leave_tower_check(void)
+{
+       leaving_quest = p_ptr->inside_quest;
+       /* Check for Tower Quest */
+       if (leaving_quest &&
+               (quest[leaving_quest].type == QUEST_TYPE_TOWER) &&
+               (quest[QUEST_TOWER1].status != QUEST_STATUS_COMPLETED))
+       {
+               if(quest[leaving_quest].type == QUEST_TYPE_TOWER)
+               {
+                       quest[QUEST_TOWER1].status = QUEST_STATUS_FAILED;
+                       quest[QUEST_TOWER1].complev = (byte)p_ptr->lev;
                }
-               else if (record_fix_quest)
-                       do_cmd_write_nikki(NIKKI_FIX_QUEST_F, leaving_quest, NULL);
        }
 }
 
@@ -1374,7 +1419,7 @@ static void recharged_notice(object_type *o_ptr)
 
 static void check_music(void)
 {
-       magic_type *s_ptr;
+       const magic_type *s_ptr;
        int spell;
        s32b need_mana;
        u32b need_mana_frac;
@@ -1466,6 +1511,17 @@ static object_type *choose_cursed_obj_name(u32b flag)
                        choices[number] = i;
                        number++;
                }
+               else if ((flag == TRC_ADD_L_CURSE) || (flag == TRC_ADD_H_CURSE))
+               {
+                       u32b cf = (flag == TRC_ADD_L_CURSE) ? TR_ADD_L_CURSE : TR_ADD_H_CURSE;
+                       u32b flgs[4];
+                       object_flags(o_ptr, flgs);
+                       if (have_flag(flgs, cf))
+                       {
+                               choices[number] = i;
+                               number++;
+                       }
+               }
        }
 
        /* Choice one of them */
@@ -1481,7 +1537,6 @@ static void process_world_aux_hp_and_sp(void)
        feature_type *f_ptr = &f_info[cave[py][px].feat];
        bool cave_no_regen = FALSE;
        int upkeep_factor = 0;
-       int upkeep_regen;
 
        /* Default regeneration */
        int regen_amount = PY_REGEN_NORMAL;
@@ -1820,8 +1875,7 @@ take_hit(DAMAGE_NOESCAPE, damage, "
        }
 
        /* Regenerate the mana */
-       upkeep_regen = (100 - upkeep_factor) * regen_amount;
-       regenmana(upkeep_regen);
+       regenmana(upkeep_factor, regen_amount);
 
 
        /* Recharge magic eater's power */
@@ -2226,7 +2280,7 @@ static void process_world_aux_mutation(void)
 
        if ((p_ptr->muta2 & MUT2_BERS_RAGE) && one_in_(3000))
        {
-               disturb(0, 0);
+               disturb(0, 1);
 #ifdef JP
                msg_print("¥¦¥¬¥¡¥¡¥¢¡ª");
                msg_print("·ãÅܤÎȯºî¤Ë½±¤ï¤ì¤¿¡ª");
@@ -2243,7 +2297,7 @@ static void process_world_aux_mutation(void)
        {
                if (!p_ptr->resist_fear)
                {
-                       disturb(0, 0);
+                       disturb(0, 1);
 #ifdef JP
                        msg_print("¤È¤Æ¤â°Å¤¤... ¤È¤Æ¤â¶²¤¤¡ª");
 #else
@@ -2259,7 +2313,7 @@ static void process_world_aux_mutation(void)
                if (!p_ptr->resist_nexus && !(p_ptr->muta1 & MUT1_VTELEPORT) &&
                    !p_ptr->anti_tele)
                {
-                       disturb(0, 0);
+                       disturb(0, 1);
 
                        /* Teleport player */
 #ifdef JP
@@ -2277,7 +2331,7 @@ static void process_world_aux_mutation(void)
        {
                if (!p_ptr->resist_conf && !p_ptr->resist_chaos)
                {
-                       disturb(0, 0);
+                       disturb(0, 1);
                        p_ptr->redraw |= PR_EXTRA;
 #ifdef JP
                        msg_print("¤¤¤Ò¤­¤¬¤â¡¼¤í¡¼¤È¤Ò¤Æ¤­¤¿¤­¤¬¤Õ¤ë...¥Ò¥Ã¥¯¡ª");
@@ -2330,7 +2384,7 @@ static void process_world_aux_mutation(void)
        {
                if (!p_ptr->resist_chaos)
                {
-                       disturb(0, 0);
+                       disturb(0, 1);
                        p_ptr->redraw |= PR_EXTRA;
                        (void)set_image(p_ptr->image + randint0(50) + 20);
                }
@@ -2338,7 +2392,7 @@ static void process_world_aux_mutation(void)
 
        if ((p_ptr->muta2 & MUT2_FLATULENT) && (randint1(3000) == 13))
        {
-               disturb(0, 0);
+               disturb(0, 1);
 
 #ifdef JP
                msg_print("¥Ö¥¥¡¼¡¼¥Ã¡ª¤ª¤Ã¤È¡£");
@@ -2354,7 +2408,7 @@ static void process_world_aux_mutation(void)
            !p_ptr->anti_magic && one_in_(9000))
        {
                int dire = 0;
-               disturb(0, 0);
+               disturb(0, 1);
 #ifdef JP
                msg_print("ËâË¡¤Î¥¨¥Í¥ë¥®¡¼¤¬ÆÍÁ³¤¢¤Ê¤¿¤ÎÃæ¤Ëή¤ì¹þ¤ó¤Ç¤­¤¿¡ª¥¨¥Í¥ë¥®¡¼¤ò²òÊü¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡ª");
 #else
@@ -2385,13 +2439,13 @@ static void process_world_aux_mutation(void)
                        msg_print("You have attracted a demon!");
 #endif
 
-                       disturb(0, 0);
+                       disturb(0, 1);
                }
        }
 
        if ((p_ptr->muta2 & MUT2_SPEED_FLUX) && one_in_(6000))
        {
-               disturb(0, 0);
+               disturb(0, 1);
                if (one_in_(2))
                {
 #ifdef JP
@@ -2430,7 +2484,7 @@ static void process_world_aux_mutation(void)
        }
        if ((p_ptr->muta2 & MUT2_BANISH_ALL) && one_in_(9000))
        {
-               disturb(0, 0);
+               disturb(0, 1);
 #ifdef JP
                msg_print("ÆÍÁ³¤Û¤È¤ó¤É¸ÉÆȤˤʤ俵¤¤¬¤¹¤ë¡£");
 #else
@@ -2528,14 +2582,14 @@ static void process_world_aux_mutation(void)
                        msg_print("You have attracted an animal!");
 #endif
 
-                       disturb(0, 0);
+                       disturb(0, 1);
                }
        }
 
        if ((p_ptr->muta2 & MUT2_RAW_CHAOS) &&
            !p_ptr->anti_magic && one_in_(8000))
        {
-               disturb(0, 0);
+               disturb(0, 1);
 #ifdef JP
                msg_print("¼þ¤ê¤Î¶õ´Ö¤¬ÏĤó¤Ç¤¤¤ëµ¤¤¬¤¹¤ë¡ª");
 #else
@@ -2557,7 +2611,7 @@ static void process_world_aux_mutation(void)
        }
        if ((p_ptr->muta2 & MUT2_WRAITH) && !p_ptr->anti_magic && one_in_(3000))
        {
-               disturb(0, 0);
+               disturb(0, 1);
 #ifdef JP
                msg_print("Èóʪ¼Á²½¤·¤¿¡ª");
 #else
@@ -2608,7 +2662,7 @@ static void process_world_aux_mutation(void)
 
                if (!sustained)
                {
-                       disturb(0, 0);
+                       disturb(0, 1);
 #ifdef JP
                        msg_print("¼«Ê¬¤¬¿ê¼å¤·¤Æ¤¤¤¯¤Î¤¬Ê¬¤«¤ë¡ª");
 #else
@@ -2636,7 +2690,7 @@ static void process_world_aux_mutation(void)
                        msg_print("You have attracted a dragon!");
 #endif
 
-                       disturb(0, 0);
+                       disturb(0, 1);
                }
        }
        if ((p_ptr->muta2 & MUT2_WEIRD_MIND) && !p_ptr->anti_magic &&
@@ -2666,7 +2720,7 @@ static void process_world_aux_mutation(void)
        if ((p_ptr->muta2 & MUT2_NAUSEA) && !p_ptr->slow_digest &&
            one_in_(9000))
        {
-               disturb(0, 0);
+               disturb(0, 1);
 #ifdef JP
                msg_print("°ß¤¬áÛÚ»¤·¡¢¿©»ö¤ò¼º¤Ã¤¿¡ª");
 #else
@@ -2750,7 +2804,7 @@ static void process_world_aux_mutation(void)
        if ((p_ptr->muta2 & MUT2_INVULN) && !p_ptr->anti_magic &&
            one_in_(5000))
        {
-               disturb(0, 0);
+               disturb(0, 1);
 #ifdef JP
                msg_print("̵Ũ¤Êµ¤¤¬¤¹¤ë¡ª");
 #else
@@ -2811,7 +2865,7 @@ static void process_world_aux_mutation(void)
                int slot = 0;
                object_type *o_ptr = NULL;
 
-               disturb(0, 0);
+               disturb(0, 1);
 #ifdef JP
                msg_print("­¤¬¤â¤Ä¤ì¤Æž¤ó¤À¡ª");
                take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), "žÅÝ", -1);
@@ -2850,7 +2904,6 @@ static void process_world_aux_mutation(void)
        }
 }
 
-
 /*
  * Handle curse effects once every 10 game turns
  */
@@ -2906,7 +2959,7 @@ static void process_world_aux_curse(void)
                        if (get_check_strict("Teleport? ", CHECK_OKAY_CANCEL))
 #endif
                        {
-                               disturb(0, 0);
+                               disturb(0, 1);
                                teleport_player(50, 0L);
                        }
                        else
@@ -2916,7 +2969,7 @@ static void process_world_aux_curse(void)
 #else
                                msg_format("You can inscribe {.} on your %s to disable random teleportation. ", o_name);
 #endif
-                               disturb(1, 0);
+                               disturb(1, 1);
                        }
                }
                /* Make a chainsword noise */
@@ -3016,7 +3069,7 @@ static void process_world_aux_curse(void)
                                msg_format("Your %s have attracted an animal!", o_name);
 #endif
 
-                               disturb(0, 0);
+                               disturb(0, 1);
                        }
                }
                /* Call demon */
@@ -3033,7 +3086,7 @@ static void process_world_aux_curse(void)
                                msg_format("Your %s have attracted a demon!", o_name);
 #endif
 
-                               disturb(0, 0);
+                               disturb(0, 1);
                        }
                }
                /* Call dragon */
@@ -3051,14 +3104,14 @@ static void process_world_aux_curse(void)
                                msg_format("Your %s have attracted an animal!", o_name);
 #endif
 
-                               disturb(0, 0);
+                               disturb(0, 1);
                        }
                }
                if ((p_ptr->cursed & TRC_COWARDICE) && one_in_(1500))
                {
                        if (!p_ptr->resist_fear)
                        {
-                               disturb(0, 0);
+                               disturb(0, 1);
 #ifdef JP
                                msg_print("¤È¤Æ¤â°Å¤¤... ¤È¤Æ¤â¶²¤¤¡ª");
 #else
@@ -3071,7 +3124,7 @@ static void process_world_aux_curse(void)
                /* Teleport player */
                if ((p_ptr->cursed & TRC_TELEPORT) && one_in_(200) && !p_ptr->anti_tele)
                {
-                       disturb(0, 0);
+                       disturb(0, 1);
 
                        /* Teleport player */
                        teleport_player(40, TELEPORT_PASSIVE);
@@ -3271,16 +3324,13 @@ static void process_world_aux_movement(void)
                if (!p_ptr->word_recall)
                {
                        /* Disturbing! */
-                       disturb(0, 0);
+                       disturb(0, 1);
 
                        /* Determine the level */
-                       if (dun_level || p_ptr->inside_quest)
+                       if (dun_level || p_ptr->inside_quest || p_ptr->enter_dungeon)
                        {
-#ifdef JP
-msg_print("¾å¤Ë°ú¤ÃÄ¥¤ê¤¢¤²¤é¤ì¤ë´¶¤¸¤¬¤¹¤ë¡ª");
-#else
-                               msg_print("You feel yourself yanked upwards!");
-#endif
+                               msg_print(_("¾å¤Ë°ú¤ÃÄ¥¤ê¤¢¤²¤é¤ì¤ë´¶¤¸¤¬¤¹¤ë¡ª",
+                                                       "You feel yourself yanked upwards!"));
 
                                if (dungeon_type) p_ptr->recall_dungeon = dungeon_type;
                                if (record_stair)
@@ -3290,6 +3340,7 @@ msg_print("
                                dungeon_type = 0;
 
                                leave_quest_check();
+                               leave_tower_check();
 
                                p_ptr->inside_quest = 0;
 
@@ -3297,11 +3348,8 @@ msg_print("
                        }
                        else
                        {
-#ifdef JP
-msg_print("²¼¤Ë°ú¤­¤º¤ê¹ß¤í¤µ¤ì¤ë´¶¤¸¤¬¤¹¤ë¡ª");
-#else
-                               msg_print("You feel yourself yanked downwards!");
-#endif
+                               msg_print(_("²¼¤Ë°ú¤­¤º¤ê¹ß¤í¤µ¤ì¤ë´¶¤¸¤¬¤¹¤ë¡ª",
+                                                       "You feel yourself yanked downwards!"));
 
                                dungeon_type = p_ptr->recall_dungeon;
 
@@ -3390,7 +3438,7 @@ msg_print("
                if (!p_ptr->alter_reality)
                {
                        /* Disturbing! */
-                       disturb(0, 0);
+                       disturb(0, 1);
 
                        /* Determine the level */
                        if (!quest_number(dun_level) && dun_level)
@@ -3776,7 +3824,7 @@ static void process_world(void)
                        if (closing_flag <= 2)
                        {
                                /* Disturb */
-                               disturb(0, 0);
+                               disturb(0, 1);
 
                                /* Count warnings */
                                closing_flag++;
@@ -4040,7 +4088,7 @@ msg_print("
                if ((hour == 23) && !(min % 15))
                {
                        /* Disturbing */
-                       disturb(0, 0);
+                       disturb(0, 1);
 
                        switch (min / 15)
                        {
@@ -4083,7 +4131,7 @@ msg_print("
                {
                        int count = 0;
 
-                       disturb(1, 0);
+                       disturb(1, 1);
 #ifdef JP
                        msg_print("±ó¤¯¤Ç¾â¤¬²¿²ó¤âÌĤꡢ»à¤ó¤À¤è¤¦¤ÊÀŤ±¤µ¤ÎÃæ¤Ø¾Ã¤¨¤Æ¤¤¤Ã¤¿¡£");
 #else
@@ -4147,7 +4195,7 @@ msg_print("
                                msg_print("You faint from the lack of food.");
 #endif
 
-                               disturb(1, 0);
+                               disturb(1, 1);
 
                                /* Hack -- faint (bypass free action) */
                                (void)set_paralyzed(p_ptr->paralyzed + 1 + randint0(5));
@@ -4771,7 +4819,7 @@ msg_print("
                        else if (p_ptr->pclass == CLASS_SMITH)
                                do_cmd_kaji(TRUE);
                        else if (p_ptr->pclass == CLASS_MAGIC_EATER)
-                               do_cmd_magic_eater(TRUE);
+                               do_cmd_magic_eater(TRUE, FALSE);
                        else if (p_ptr->pclass == CLASS_SNIPER)
                                do_cmd_snipe_browse();
                        else do_cmd_browse();
@@ -4873,7 +4921,7 @@ msg_print("
                                        else if (p_ptr->pclass == CLASS_IMITATOR)
                                                do_cmd_mane(FALSE);
                                        else if (p_ptr->pclass == CLASS_MAGIC_EATER)
-                                               do_cmd_magic_eater(FALSE);
+                                               do_cmd_magic_eater(FALSE, FALSE);
                                        else if (p_ptr->pclass == CLASS_SAMURAI)
                                                do_cmd_hissatsu();
                                        else if (p_ptr->pclass == CLASS_BLUE_MAGE)
@@ -5400,7 +5448,7 @@ static void pack_overflow(void)
                o_ptr = &inventory[INVEN_PACK];
 
                /* Disturbing */
-               disturb(0, 0);
+               disturb(0, 1);
 
                /* Warning */
 #ifdef JP
@@ -5435,6 +5483,34 @@ static void pack_overflow(void)
        }
 }
 
+/*
+ * process the effects per 100 energy at player speed.
+ */
+static void process_upkeep_with_speed(void)
+{
+       /* Give the player some energy */
+       if (!load && p_ptr->enchant_energy_need > 0 && !p_ptr->leaving)
+       {
+               p_ptr->enchant_energy_need -= SPEED_TO_ENERGY(p_ptr->pspeed);
+       }
+       
+       /* No turn yet */
+       if (p_ptr->enchant_energy_need > 0) return;
+       
+       while (p_ptr->enchant_energy_need <= 0)
+       {
+               /* Handle the player song */
+               if (!load) check_music();
+
+               /* Hex - Handle the hex spells */
+               if (!load) check_hex();
+               if (!load) revenge_spell();
+               
+               /* There is some randomness of needed energy */
+               p_ptr->enchant_energy_need += ENERGY_NEED();
+       }
+}
+
 
 /*
  * Process the player
@@ -5558,7 +5634,7 @@ msg_print("
                                msg_print("Damn!  The fish stole your bait!");
 #endif
                        }
-                       disturb(0, 0);
+                       disturb(0, 1);
                }
        }
 
@@ -5566,7 +5642,7 @@ msg_print("
        if (check_abort)
        {
                /* Check for "player abort" (semi-efficiently for resting) */
-               if (running || command_rep || (p_ptr->action == ACTION_REST) || (p_ptr->action == ACTION_FISH))
+               if (running || travel.run || command_rep || (p_ptr->action == ACTION_REST) || (p_ptr->action == ACTION_FISH))
                {
                        /* Do not wait */
                        inkey_scan = TRUE;
@@ -5578,7 +5654,7 @@ msg_print("
                                flush();
 
                                /* Disturb */
-                               disturb(0, 0);
+                               disturb(0, 1);
 
                                /* Hack -- Show a Message */
 #ifdef JP
@@ -5675,14 +5751,7 @@ msg_print("
                /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
                handle_stuff();
        }
-
-       /* Handle the player song */
-       if (!load) check_music();
-
-       /* Hex - Handle the hex spells */
-       if (!load) check_hex();
-       if (!load) revenge_spell();
-
+       
        load = FALSE;
 
        /* Fast */
@@ -6104,7 +6173,7 @@ static void dungeon(bool load_game)
 
 
        /* Disturb */
-       disturb(1, 0);
+       disturb(1, 1);
 
        /* Get index of current quest (if any) */
        quest_num = quest_number(dun_level);
@@ -6270,9 +6339,11 @@ msg_print("
                /* Hack -- Compress the object list occasionally */
                if (o_cnt + 32 < o_max) compact_objects(0);
 
-
+               
                /* Process the player */
                process_player();
+               
+               process_upkeep_with_speed();
 
                /* Handle "p_ptr->notice" */
                notice_stuff();
@@ -6565,6 +6636,7 @@ void play_game(bool new_game)
 {
        int i;
        bool load_game = TRUE;
+       bool init_random_seed = FALSE;
 
 #ifdef CHUUKEI
        if (chuukei_client)
@@ -6712,7 +6784,7 @@ quit("
                character_dungeon = FALSE;
 
                /* Prepare to init the RNG */
-               Rand_quick = TRUE;
+               init_random_seed = TRUE;
 
                /* Initialize the saved floors data */
                init_saved_floors(FALSE);
@@ -6733,7 +6805,7 @@ quit("
        }
 
        /* Init the RNG */
-       if (Rand_quick)
+       if (init_random_seed)
        {
                u32b seed;
 
@@ -6747,10 +6819,7 @@ quit("
 
 #endif
 
-               /* Use the complex RNG */
-               Rand_quick = FALSE;
-
-               /* Seed the "complex" RNG */
+               /* Seed the RNG */
                Rand_state_init(seed);
        }
 
@@ -6992,6 +7061,7 @@ prt("
                m_ptr->maxhp = r_ptr->hdice*(r_ptr->hside+1)/2;
                m_ptr->max_maxhp = m_ptr->maxhp;
                m_ptr->hp = r_ptr->hdice*(r_ptr->hside+1)/2;
+               m_ptr->dealt_damage = 0;
                m_ptr->energy_need = ENERGY_NEED() + ENERGY_NEED();
        }