OSDN Git Service

[Refactor] Separated player-processor.c/h and music-checker.c/h from core.c/h
[hengband/hengband.git] / src / core.c
index 7f2feb3..dc69b9f 100644 (file)
@@ -16,7 +16,6 @@
 #include "core.h"
 #include "core/angband-version.h"
 #include "core/stuff-handler.h"
-#include "core/special-internal-keys.h"
 #include "inet.h"
 #include "gameterm.h"
 #include "chuukei.h"
 #include "birth/birth.h"
 #include "market/building.h"
 #include "io/write-diary.h"
-#include "cmd/cmd-activate.h"
-#include "cmd/cmd-autopick.h"
-#include "cmd/cmd-diary.h"
-#include "cmd/cmd-draw.h"
-#include "cmd/cmd-dump.h"
-#include "cmd/cmd-process-screen.h"
-#include "cmd/cmd-eat.h"
-#include "cmd/cmd-help.h"
-#include "cmd/cmd-hissatsu.h"
-#include "cmd/cmd-item.h"
-#include "cmd/cmd-knowledge.h"
-#include "cmd/cmd-magiceat.h"
-#include "cmd/cmd-mane.h"
-#include "cmd/cmd-macro.h"
-#include "cmd/cmd-quaff.h"
-#include "cmd/cmd-read.h"
-#include "cmd/cmd-save.h"
-#include "cmd/cmd-smith.h"
-#include "cmd/cmd-usestaff.h"
-#include "cmd/cmd-zaprod.h"
-#include "cmd/cmd-zapwand.h"
-#include "cmd/cmd-pet.h"
-#include "cmd/cmd-basic.h"
-#include "cmd/cmd-visuals.h"
-#include "racial.h"
-#include "snipe.h"
 #include "dungeon.h"
 #include "feature.h"
 #include "floor.h"
 #include "floor-events.h"
 #include "grid.h"
 #include "object-flavor.h"
-#include "knowledge/knowledge-autopick.h"
-#include "knowledge/knowledge-quests.h"
 #include "market/store.h"
 #include "spell/technic-info-table.h"
-#include "spells-object.h"
 #include "spells-status.h"
-#include "monster-spell.h"
-#include "mind.h"
 #include "world.h"
-#include "mutation/mutation.h"
 #include "market/arena-info-table.h"
 #include "market/store-util.h"
 #include "quest.h"
 #include "player-personality.h"
 #include "player-damage.h"
 #include "player-effects.h"
-#include "cmd-spell.h"
-#include "realm/realm-hex.h"
 #include "wild.h"
 #include "monster-process.h"
 #include "monster-status.h"
-#include "monsterrace-hook.h"
 #include "floor-save.h"
 #include "feature.h"
 #include "player-skill.h"
-#include "player-inventory.h"
 
 #include "view/display-main-window.h"
 #include "dungeon-file.h"
 #include "realm/realm.h"
 #include "realm/realm-song.h"
 #include "targeting.h"
-#include "spell/spells-util.h"
-#include "spell/spells-execution.h"
-#include "spell/spells2.h"
-#include "spell/spells3.h"
 #include "core/output-updater.h"
 #include "core/game-closer.h"
 #include "core/turn-compensator.h"
 #include "core/magic-effects-timeout-reducer.h"
 #include "inventory/inventory-curse.h"
 #include "inventory/recharge-processor.h"
-#include "wizard/wizard-spoiler.h"
-#include "wizard/wizard-special-process.h"
+#include "io/input-key-processor.h"
+#include "core/player-processor.h"
+
+#include "cmd/cmd-save.h"
+#include "cmd/cmd-dump.h"
+
 
  /*!
   * コピーライト情報 /
@@ -131,12 +94,7 @@ const concptr copyright[5] =
        "are included in all such copies."
 };
 
-bool can_save = FALSE;
-
-COMMAND_CODE now_message;
-
-bool repair_monsters;
-bool repair_objects;
+static bool repair_objects;
 
 concptr ANGBAND_SYS = "xxx";
 
@@ -148,78 +106,12 @@ concptr ANGBAND_KEYBOARD = "0";
 
 concptr ANGBAND_GRAF = "ascii";
 
-static bool load = TRUE; /*!<ロード処理中の分岐フラグ*/
-
 /*
  * Flags for initialization
  */
 int init_flags;
 
 /*!
- * @brief プレイヤーの歌に関する継続処理
- * @return なし
- */
-static void check_music(player_type *caster_ptr)
-{
-       if (caster_ptr->pclass != CLASS_BARD) return;
-       if (!SINGING_SONG_EFFECT(caster_ptr) && !INTERUPTING_SONG_EFFECT(caster_ptr)) return;
-
-       if (caster_ptr->anti_magic)
-       {
-               stop_singing(caster_ptr);
-               return;
-       }
-
-       int spell = SINGING_SONG_ID(caster_ptr);
-       const magic_type *s_ptr;
-       s_ptr = &technic_info[REALM_MUSIC - MIN_TECHNIC][spell];
-
-       MANA_POINT need_mana = mod_need_mana(caster_ptr, s_ptr->smana, spell, REALM_MUSIC);
-       u32b need_mana_frac = 0;
-
-       s64b_RSHIFT(need_mana, need_mana_frac, 1);
-       if (s64b_cmp(caster_ptr->csp, caster_ptr->csp_frac, need_mana, need_mana_frac) < 0)
-       {
-               stop_singing(caster_ptr);
-               return;
-       }
-       else
-       {
-               s64b_sub(&(caster_ptr->csp), &(caster_ptr->csp_frac), need_mana, need_mana_frac);
-
-               caster_ptr->redraw |= PR_MANA;
-               if (INTERUPTING_SONG_EFFECT(caster_ptr))
-               {
-                       SINGING_SONG_EFFECT(caster_ptr) = INTERUPTING_SONG_EFFECT(caster_ptr);
-                       INTERUPTING_SONG_EFFECT(caster_ptr) = MUSIC_NONE;
-                       msg_print(_("歌を再開した。", "You restart singing."));
-                       caster_ptr->action = ACTION_SING;
-                       caster_ptr->update |= (PU_BONUS | PU_HP | PU_MONSTERS);
-                       caster_ptr->redraw |= (PR_MAP | PR_STATUS | PR_STATE);
-                       caster_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
-               }
-       }
-
-       if (caster_ptr->spell_exp[spell] < SPELL_EXP_BEGINNER)
-               caster_ptr->spell_exp[spell] += 5;
-       else if (caster_ptr->spell_exp[spell] < SPELL_EXP_SKILLED)
-       {
-               if (one_in_(2) && (caster_ptr->current_floor_ptr->dun_level > 4) && ((caster_ptr->current_floor_ptr->dun_level + 10) > caster_ptr->lev)) caster_ptr->spell_exp[spell] += 1;
-       }
-       else if (caster_ptr->spell_exp[spell] < SPELL_EXP_EXPERT)
-       {
-               if (one_in_(5) && ((caster_ptr->current_floor_ptr->dun_level + 5) > caster_ptr->lev) && ((caster_ptr->current_floor_ptr->dun_level + 5) > s_ptr->slevel)) caster_ptr->spell_exp[spell] += 1;
-       }
-       else if (caster_ptr->spell_exp[spell] < SPELL_EXP_MASTER)
-       {
-               if (one_in_(5) && ((caster_ptr->current_floor_ptr->dun_level + 5) > caster_ptr->lev) && (caster_ptr->current_floor_ptr->dun_level > s_ptr->slevel)) caster_ptr->spell_exp[spell] += 1;
-       }
-
-       exe_spell(caster_ptr, REALM_MUSIC, spell, SPELL_CONT);
-}
-
-
-/*!
  * @brief 10ゲームターンが進行するごとにプレイヤーの腹を減らす
  * @param creature_ptr プレーヤーへの参照ポインタ
  * @return なし
@@ -632,1114 +524,8 @@ static void process_world(player_type *player_ptr)
 
 
 /*!
- * @brief ウィザードモードへの導入処理
- * / Verify use of "wizard" mode
- * @param player_ptr プレーヤーへの参照ポインタ
- * @return 実際にウィザードモードへ移行したらTRUEを返す。
- */
-static bool enter_wizard_mode(player_type *player_ptr)
-{
-       if (!current_world_ptr->noscore)
-       {
-               if (!allow_debug_opts || arg_wizard)
-               {
-                       msg_print(_("ウィザードモードは許可されていません。 ", "Wizard mode is not permitted."));
-                       return FALSE;
-               }
-
-               msg_print(_("ウィザードモードはデバッグと実験のためのモードです。 ", "Wizard mode is for debugging and experimenting."));
-               msg_print(_("一度ウィザードモードに入るとスコアは記録されません。", "The game will not be scored if you enter wizard mode."));
-               msg_print(NULL);
-               if (!get_check(_("本当にウィザードモードに入りたいのですか? ", "Are you sure you want to enter wizard mode? ")))
-               {
-                       return FALSE;
-               }
-
-               exe_write_diary(player_ptr, DIARY_DESCRIPTION, 0, _("ウィザードモードに突入してスコアを残せなくなった。", "gave up recording score to enter wizard mode."));
-               current_world_ptr->noscore |= 0x0002;
-       }
-
-       return TRUE;
-}
-
-
-/*!
- * @brief デバッグコマンドへの導入処理
- * / Verify use of "debug" commands
- * @param player_ptr プレーヤーへの参照ポインタ
- * @return 実際にデバッグコマンドへ移行したらTRUEを返す。
- */
-static bool enter_debug_mode(player_type *player_ptr)
-{
-       if (!current_world_ptr->noscore)
-       {
-               if (!allow_debug_opts)
-               {
-                       msg_print(_("デバッグコマンドは許可されていません。 ", "Use of debug command is not permitted."));
-                       return FALSE;
-               }
-
-               msg_print(_("デバッグ・コマンドはデバッグと実験のためのコマンドです。 ", "The debug commands are for debugging and experimenting."));
-               msg_print(_("デバッグ・コマンドを使うとスコアは記録されません。", "The game will not be scored if you use debug commands."));
-               msg_print(NULL);
-               if (!get_check(_("本当にデバッグ・コマンドを使いますか? ", "Are you sure you want to use debug commands? ")))
-               {
-                       return FALSE;
-               }
-
-               exe_write_diary(player_ptr, DIARY_DESCRIPTION, 0, _("デバッグモードに突入してスコアを残せなくなった。", "gave up sending score to use debug commands."));
-               current_world_ptr->noscore |= 0x0008;
-       }
-
-       return TRUE;
-}
-
-/*!
- * @brief プレイヤーから受けた入力コマンドの分岐処理。
- * / Parse and execute the current command Give "Warning" on illegal commands.
- * @todo Make some "blocks"
- * @return なし
- */
-static void process_command(player_type *creature_ptr)
-{
-       COMMAND_CODE old_now_message = now_message;
-       repeat_check();
-       now_message = 0;
-       if ((creature_ptr->pclass == CLASS_SNIPER) && (creature_ptr->concent))
-               creature_ptr->reset_concent = TRUE;
-
-       floor_type *floor_ptr = creature_ptr->current_floor_ptr;
-       switch (command_cmd)
-       {
-       case ESCAPE:
-       case ' ':
-       {
-               /* Ignore */
-               break;
-       }
-       case '\r':
-       case '\n':
-       {
-               /* todo 嘘。returnしていない
-                * Ignore return
-                */
-               break;
-       }
-       case KTRL('W'):
-       {
-               if (current_world_ptr->wizard)
-               {
-                       current_world_ptr->wizard = FALSE;
-                       msg_print(_("ウィザードモード解除。", "Wizard mode off."));
-               }
-               else if (enter_wizard_mode(creature_ptr))
-               {
-                       current_world_ptr->wizard = TRUE;
-                       msg_print(_("ウィザードモード突入。", "Wizard mode on."));
-               }
-               creature_ptr->update |= (PU_MONSTERS);
-               creature_ptr->redraw |= (PR_TITLE);
-
-               break;
-       }
-       case KTRL('A'):
-       {
-               if (enter_debug_mode(creature_ptr))
-               {
-                       do_cmd_debug(creature_ptr);
-               }
-               break;
-       }
-       case 'w':
-       {
-               if (!creature_ptr->wild_mode) do_cmd_wield(creature_ptr);
-               break;
-       }
-       case 't':
-       {
-               if (!creature_ptr->wild_mode) do_cmd_takeoff(creature_ptr);
-               break;
-       }
-       case 'd':
-       {
-               if (!creature_ptr->wild_mode) do_cmd_drop(creature_ptr);
-               break;
-       }
-       case 'k':
-       {
-               do_cmd_destroy(creature_ptr);
-               break;
-       }
-       case 'e':
-       {
-               do_cmd_equip(creature_ptr);
-               break;
-       }
-       case 'i':
-       {
-               do_cmd_inven(creature_ptr);
-               break;
-       }
-       case 'I':
-       {
-               do_cmd_observe(creature_ptr);
-               break;
-       }
-
-       case KTRL('I'):
-       {
-               toggle_inventory_equipment(creature_ptr);
-               break;
-       }
-       case '+':
-       {
-               if (!creature_ptr->wild_mode) do_cmd_alter(creature_ptr);
-               break;
-       }
-       case 'T':
-       {
-               if (!creature_ptr->wild_mode) do_cmd_tunnel(creature_ptr);
-               break;
-       }
-       case ';':
-       {
-               do_cmd_walk(creature_ptr, FALSE);
-               break;
-       }
-       case '-':
-       {
-               do_cmd_walk(creature_ptr, TRUE);
-               break;
-       }
-       case '.':
-       {
-               if (!creature_ptr->wild_mode) do_cmd_run(creature_ptr);
-               break;
-       }
-       case ',':
-       {
-               do_cmd_stay(creature_ptr, always_pickup);
-               break;
-       }
-       case 'g':
-       {
-               do_cmd_stay(creature_ptr, !always_pickup);
-               break;
-       }
-       case 'R':
-       {
-               do_cmd_rest(creature_ptr);
-               break;
-       }
-       case 's':
-       {
-               do_cmd_search(creature_ptr);
-               break;
-       }
-       case 'S':
-       {
-               if (creature_ptr->action == ACTION_SEARCH) set_action(creature_ptr, ACTION_NONE);
-               else set_action(creature_ptr, ACTION_SEARCH);
-               break;
-       }
-       case SPECIAL_KEY_STORE:
-       {
-               do_cmd_store(creature_ptr);
-               break;
-       }
-       case SPECIAL_KEY_BUILDING:
-       {
-               do_cmd_bldg(creature_ptr);
-               break;
-       }
-       case SPECIAL_KEY_QUEST:
-       {
-               do_cmd_quest(creature_ptr);
-               break;
-       }
-       case '<':
-       {
-               if (!creature_ptr->wild_mode && !floor_ptr->dun_level && !floor_ptr->inside_arena && !floor_ptr->inside_quest)
-               {
-                       if (vanilla_town) break;
-
-                       if (creature_ptr->ambush_flag)
-                       {
-                               msg_print(_("襲撃から逃げるにはマップの端まで移動しなければならない。", "To flee the ambush you have to reach the edge of the map."));
-                               break;
-                       }
-
-                       if (creature_ptr->food < PY_FOOD_WEAK)
-                       {
-                               msg_print(_("その前に食事をとらないと。", "You must eat something here."));
-                               break;
-                       }
-
-                       change_wild_mode(creature_ptr, FALSE);
-               }
-               else
-                       do_cmd_go_up(creature_ptr);
-
-               break;
-       }
-       case '>':
-       {
-               if (creature_ptr->wild_mode)
-                       change_wild_mode(creature_ptr, FALSE);
-               else
-                       do_cmd_go_down(creature_ptr);
-               break;
-       }
-       case 'o':
-       {
-               do_cmd_open(creature_ptr);
-               break;
-       }
-       case 'c':
-       {
-               do_cmd_close(creature_ptr);
-               break;
-       }
-       case 'j':
-       {
-               do_cmd_spike(creature_ptr);
-               break;
-       }
-       case 'B':
-       {
-               do_cmd_bash(creature_ptr);
-               break;
-       }
-       case 'D':
-       {
-               do_cmd_disarm(creature_ptr);
-               break;
-       }
-       case 'G':
-       {
-               if ((creature_ptr->pclass == CLASS_SORCERER) || (creature_ptr->pclass == CLASS_RED_MAGE))
-                       msg_print(_("呪文を学習する必要はない!", "You don't have to learn spells!"));
-               else if (creature_ptr->pclass == CLASS_SAMURAI)
-                       do_cmd_gain_hissatsu(creature_ptr);
-               else if (creature_ptr->pclass == CLASS_MAGIC_EATER)
-                       import_magic_device(creature_ptr);
-               else
-                       do_cmd_study(creature_ptr);
-               break;
-       }
-       case 'b':
-       {
-               if ((creature_ptr->pclass == CLASS_MINDCRAFTER) ||
-                       (creature_ptr->pclass == CLASS_BERSERKER) ||
-                       (creature_ptr->pclass == CLASS_NINJA) ||
-                       (creature_ptr->pclass == CLASS_MIRROR_MASTER)
-                       ) do_cmd_mind_browse(creature_ptr);
-               else if (creature_ptr->pclass == CLASS_SMITH)
-                       do_cmd_kaji(creature_ptr, TRUE);
-               else if (creature_ptr->pclass == CLASS_MAGIC_EATER)
-                       do_cmd_magic_eater(creature_ptr, TRUE, FALSE);
-               else if (creature_ptr->pclass == CLASS_SNIPER)
-                       do_cmd_snipe_browse(creature_ptr);
-               else do_cmd_browse(creature_ptr);
-               break;
-       }
-       case 'm':
-       {
-               if (!creature_ptr->wild_mode)
-               {
-                       if ((creature_ptr->pclass == CLASS_WARRIOR) || (creature_ptr->pclass == CLASS_ARCHER) || (creature_ptr->pclass == CLASS_CAVALRY))
-                       {
-                               msg_print(_("呪文を唱えられない!", "You cannot cast spells!"));
-                       }
-                       else if (floor_ptr->dun_level && (d_info[creature_ptr->dungeon_idx].flags1 & DF1_NO_MAGIC) && (creature_ptr->pclass != CLASS_BERSERKER) && (creature_ptr->pclass != CLASS_SMITH))
-                       {
-                               msg_print(_("ダンジョンが魔法を吸収した!", "The dungeon absorbs all attempted magic!"));
-                               msg_print(NULL);
-                       }
-                       else if (creature_ptr->anti_magic && (creature_ptr->pclass != CLASS_BERSERKER) && (creature_ptr->pclass != CLASS_SMITH))
-                       {
-                               concptr which_power = _("魔法", "magic");
-                               if (creature_ptr->pclass == CLASS_MINDCRAFTER)
-                                       which_power = _("超能力", "psionic powers");
-                               else if (creature_ptr->pclass == CLASS_IMITATOR)
-                                       which_power = _("ものまね", "imitation");
-                               else if (creature_ptr->pclass == CLASS_SAMURAI)
-                                       which_power = _("必殺剣", "hissatsu");
-                               else if (creature_ptr->pclass == CLASS_MIRROR_MASTER)
-                                       which_power = _("鏡魔法", "mirror magic");
-                               else if (creature_ptr->pclass == CLASS_NINJA)
-                                       which_power = _("忍術", "ninjutsu");
-                               else if (mp_ptr->spell_book == TV_LIFE_BOOK)
-                                       which_power = _("祈り", "prayer");
-
-                               msg_format(_("反魔法バリアが%sを邪魔した!", "An anti-magic shell disrupts your %s!"), which_power);
-                               free_turn(creature_ptr);
-                       }
-                       else if (creature_ptr->shero && (creature_ptr->pclass != CLASS_BERSERKER))
-                       {
-                               msg_format(_("狂戦士化していて頭が回らない!", "You cannot think directly!"));
-                               free_turn(creature_ptr);
-                       }
-                       else
-                       {
-                               if ((creature_ptr->pclass == CLASS_MINDCRAFTER) ||
-                                       (creature_ptr->pclass == CLASS_BERSERKER) ||
-                                       (creature_ptr->pclass == CLASS_NINJA) ||
-                                       (creature_ptr->pclass == CLASS_MIRROR_MASTER)
-                                       )
-                                       do_cmd_mind(creature_ptr);
-                               else if (creature_ptr->pclass == CLASS_IMITATOR)
-                                       do_cmd_mane(creature_ptr, FALSE);
-                               else if (creature_ptr->pclass == CLASS_MAGIC_EATER)
-                                       do_cmd_magic_eater(creature_ptr, FALSE, FALSE);
-                               else if (creature_ptr->pclass == CLASS_SAMURAI)
-                                       do_cmd_hissatsu(creature_ptr);
-                               else if (creature_ptr->pclass == CLASS_BLUE_MAGE)
-                                       do_cmd_cast_learned(creature_ptr);
-                               else if (creature_ptr->pclass == CLASS_SMITH)
-                                       do_cmd_kaji(creature_ptr, FALSE);
-                               else if (creature_ptr->pclass == CLASS_SNIPER)
-                                       do_cmd_snipe(creature_ptr);
-                               else
-                                       do_cmd_cast(creature_ptr);
-                       }
-               }
-
-               break;
-       }
-       case 'p':
-       {
-               do_cmd_pet(creature_ptr);
-               break;
-       }
-       case '{':
-       {
-               do_cmd_inscribe(creature_ptr);
-               break;
-       }
-       case '}':
-       {
-               do_cmd_uninscribe(creature_ptr);
-               break;
-       }
-       case 'A':
-       {
-               do_cmd_activate(creature_ptr);
-               break;
-       }
-       case 'E':
-       {
-               do_cmd_eat_food(creature_ptr);
-               break;
-       }
-       case 'F':
-       {
-               do_cmd_refill(creature_ptr);
-               break;
-       }
-       case 'f':
-       {
-               do_cmd_fire(creature_ptr, SP_NONE);
-               break;
-       }
-       case 'v':
-       {
-               do_cmd_throw(creature_ptr, 1, FALSE, -1);
-               break;
-       }
-       case 'a':
-       {
-               do_cmd_aim_wand(creature_ptr);
-               break;
-       }
-       case 'z':
-       {
-               if (use_command && rogue_like_commands)
-               {
-                       do_cmd_use(creature_ptr);
-               }
-               else
-               {
-                       do_cmd_zap_rod(creature_ptr);
-               }
-               break;
-       }
-       case 'q':
-       {
-               do_cmd_quaff_potion(creature_ptr);
-               break;
-       }
-       case 'r':
-       {
-               do_cmd_read_scroll(creature_ptr);
-               break;
-       }
-       case 'u':
-       {
-               if (use_command && !rogue_like_commands)
-                       do_cmd_use(creature_ptr);
-               else
-                       do_cmd_use_staff(creature_ptr);
-               break;
-       }
-       case 'U':
-       {
-               do_cmd_racial_power(creature_ptr);
-               break;
-       }
-       case 'M':
-       {
-               do_cmd_view_map(creature_ptr);
-               break;
-       }
-       case 'L':
-       {
-               do_cmd_locate(creature_ptr);
-               break;
-       }
-       case 'l':
-       {
-               do_cmd_look(creature_ptr);
-               break;
-       }
-       case '*':
-       {
-               do_cmd_target(creature_ptr);
-               break;
-       }
-       case '?':
-       {
-               do_cmd_help(creature_ptr);
-               break;
-       }
-       case '/':
-       {
-               do_cmd_query_symbol(creature_ptr);
-               break;
-       }
-       case 'C':
-       {
-               do_cmd_player_status(creature_ptr);
-               break;
-       }
-       case '!':
-       {
-               (void)Term_user(0);
-               break;
-       }
-       case '"':
-       {
-               do_cmd_pref(creature_ptr);
-               break;
-       }
-       case '$':
-       {
-               do_cmd_reload_autopick(creature_ptr);
-               break;
-       }
-       case '_':
-       {
-               do_cmd_edit_autopick(creature_ptr);
-               break;
-       }
-       case '@':
-       {
-               do_cmd_macros(creature_ptr, process_autopick_file_command);
-               break;
-       }
-       case '%':
-       {
-               do_cmd_visuals(creature_ptr, process_autopick_file_command);
-               do_cmd_redraw(creature_ptr);
-               break;
-       }
-       case '&':
-       {
-               do_cmd_colors(creature_ptr, process_autopick_file_command);
-               do_cmd_redraw(creature_ptr);
-               break;
-       }
-       case '=':
-       {
-               do_cmd_options();
-               (void)combine_and_reorder_home(STORE_HOME);
-               do_cmd_redraw(creature_ptr);
-               break;
-       }
-       case ':':
-       {
-               do_cmd_note();
-               break;
-       }
-       case 'V':
-       {
-               do_cmd_version();
-               break;
-       }
-       case KTRL('F'):
-       {
-               do_cmd_feeling(creature_ptr);
-               break;
-       }
-       case KTRL('O'):
-       {
-               do_cmd_message_one();
-               break;
-       }
-       case KTRL('P'):
-       {
-               do_cmd_messages(old_now_message);
-               break;
-       }
-       case KTRL('Q'):
-       {
-               do_cmd_checkquest(creature_ptr);
-               break;
-       }
-       case KTRL('R'):
-       {
-               now_message = old_now_message;
-               do_cmd_redraw(creature_ptr);
-               break;
-       }
-       case KTRL('S'):
-       {
-               do_cmd_save_game(creature_ptr, FALSE);
-               break;
-       }
-       case KTRL('T'):
-       {
-               do_cmd_time(creature_ptr);
-               break;
-       }
-       case KTRL('X'):
-       case SPECIAL_KEY_QUIT:
-       {
-               do_cmd_save_and_exit(creature_ptr);
-               break;
-       }
-       case 'Q':
-       {
-               do_cmd_suicide(creature_ptr);
-               break;
-       }
-       case '|':
-       {
-               do_cmd_diary(creature_ptr);
-               break;
-       }
-       case '~':
-       {
-               do_cmd_knowledge(creature_ptr);
-               break;
-       }
-       case '(':
-       {
-               do_cmd_load_screen();
-               break;
-       }
-       case ')':
-       {
-               do_cmd_save_screen(creature_ptr, handle_stuff, process_autopick_file_command);
-               break;
-       }
-       case ']':
-       {
-               prepare_movie_hooks();
-               break;
-       }
-       case KTRL('V'):
-       {
-               spoil_random_artifact(creature_ptr, "randifact.txt");
-               break;
-       }
-       case '`':
-       {
-               if (!creature_ptr->wild_mode) do_cmd_travel(creature_ptr);
-               if (creature_ptr->special_defense & KATA_MUSOU)
-               {
-                       set_action(creature_ptr, ACTION_NONE);
-               }
-               break;
-       }
-       default:
-       {
-               if (flush_failure) flush();
-               if (one_in_(2))
-               {
-                       char error_m[1024];
-                       sound(SOUND_ILLEGAL);
-                       if (!get_rnd_line(_("error_j.txt", "error.txt"), 0, error_m))
-                               msg_print(error_m);
-               }
-               else
-               {
-                       prt(_(" '?' でヘルプが表示されます。", "Type '?' for help."), 0, 0);
-               }
-
-               break;
-       }
-       }
-
-       if (!creature_ptr->energy_use && !now_message)
-               now_message = old_now_message;
-}
-
-
-/*!
- * @brief アイテムの所持種類数が超えた場合にアイテムを床に落とす処理 / Hack -- Pack Overflow
- * @return なし
- */
-static void pack_overflow(player_type *owner_ptr)
-{
-       if (owner_ptr->inventory_list[INVEN_PACK].k_idx == 0) return;
-
-       GAME_TEXT o_name[MAX_NLEN];
-       object_type *o_ptr;
-       update_creature(owner_ptr);
-       if (!owner_ptr->inventory_list[INVEN_PACK].k_idx) return;
-
-       o_ptr = &owner_ptr->inventory_list[INVEN_PACK];
-       disturb(owner_ptr, FALSE, TRUE);
-       msg_print(_("ザックからアイテムがあふれた!", "Your pack overflows!"));
-
-       object_desc(owner_ptr, o_name, o_ptr, 0);
-       msg_format(_("%s(%c)を落とした。", "You drop %s (%c)."), o_name, index_to_label(INVEN_PACK));
-       (void)drop_near(owner_ptr, o_ptr, 0, owner_ptr->y, owner_ptr->x);
-
-       vary_item(owner_ptr, INVEN_PACK, -255);
-       handle_stuff(owner_ptr);
-}
-
-
-/*!
- * @brief プレイヤーの行動エネルギーが充填される(=プレイヤーのターンが回る)毎に行われる処理  / process the effects per 100 energy at player speed.
- * @return なし
- */
-static void process_upkeep_with_speed(player_type *creature_ptr)
-{
-       if (!load && creature_ptr->enchant_energy_need > 0 && !creature_ptr->leaving)
-       {
-               creature_ptr->enchant_energy_need -= SPEED_TO_ENERGY(creature_ptr->pspeed);
-       }
-
-       if (creature_ptr->enchant_energy_need > 0) return;
-
-       while (creature_ptr->enchant_energy_need <= 0)
-       {
-               if (!load) check_music(creature_ptr);
-               if (!load) check_hex(creature_ptr);
-               if (!load) revenge_spell(creature_ptr);
-
-               creature_ptr->enchant_energy_need += ENERGY_NEED();
-       }
-}
-
-
-static void process_fishing(player_type *creature_ptr)
-{
-       Term_xtra(TERM_XTRA_DELAY, 10);
-       if (one_in_(1000))
-       {
-               MONRACE_IDX r_idx;
-               bool success = FALSE;
-               get_mon_num_prep(creature_ptr, monster_is_fishing_target, NULL);
-               r_idx = get_mon_num(creature_ptr, creature_ptr->current_floor_ptr->dun_level ? creature_ptr->current_floor_ptr->dun_level : wilderness[creature_ptr->wilderness_y][creature_ptr->wilderness_x].level, 0);
-               msg_print(NULL);
-               if (r_idx && one_in_(2))
-               {
-                       POSITION y, x;
-                       y = creature_ptr->y + ddy[creature_ptr->fishing_dir];
-                       x = creature_ptr->x + ddx[creature_ptr->fishing_dir];
-                       if (place_monster_aux(creature_ptr, 0, y, x, r_idx, PM_NO_KAGE))
-                       {
-                               GAME_TEXT m_name[MAX_NLEN];
-                               monster_desc(creature_ptr, m_name, &creature_ptr->current_floor_ptr->m_list[creature_ptr->current_floor_ptr->grid_array[y][x].m_idx], 0);
-                               msg_format(_("%sが釣れた!", "You have a good catch!"), m_name);
-                               success = TRUE;
-                       }
-               }
-
-               if (!success)
-               {
-                       msg_print(_("餌だけ食われてしまった!くっそ~!", "Damn!  The fish stole your bait!"));
-               }
-
-               disturb(creature_ptr, FALSE, TRUE);
-       }
-}
-
-
-/*!
- * @brief プレイヤーの行動処理 / Process the player
- * @return なし
- * @note
- * Notice the annoying code to handle "pack overflow", which\n
- * must come first just in case somebody manages to corrupt\n
- * the savefiles by clever use of menu commands or something.\n
- */
-static void process_player(player_type *creature_ptr)
-{
-       if (creature_ptr->hack_mutation)
-       {
-               msg_print(_("何か変わった気がする!", "You feel different!"));
-
-               (void)gain_mutation(creature_ptr, 0);
-               creature_ptr->hack_mutation = FALSE;
-       }
-
-       if (creature_ptr->invoking_midnight_curse)
-       {
-               int count = 0;
-               activate_ty_curse(creature_ptr, FALSE, &count);
-               creature_ptr->invoking_midnight_curse = FALSE;
-       }
-
-       if (creature_ptr->phase_out)
-       {
-               for (MONSTER_IDX m_idx = 1; m_idx < creature_ptr->current_floor_ptr->m_max; m_idx++)
-               {
-                       monster_type *m_ptr = &creature_ptr->current_floor_ptr->m_list[m_idx];
-                       if (!monster_is_valid(m_ptr)) continue;
-
-                       m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
-                       update_monster(creature_ptr, m_idx, FALSE);
-               }
-
-               print_time(creature_ptr);
-       }
-       else if (!(load && creature_ptr->energy_need <= 0))
-       {
-               creature_ptr->energy_need -= SPEED_TO_ENERGY(creature_ptr->pspeed);
-       }
-
-       if (creature_ptr->energy_need > 0) return;
-       if (!command_rep) print_time(creature_ptr);
-
-       if (creature_ptr->resting < 0)
-       {
-               if (creature_ptr->resting == COMMAND_ARG_REST_FULL_HEALING)
-               {
-                       if ((creature_ptr->chp == creature_ptr->mhp) &&
-                               (creature_ptr->csp >= creature_ptr->msp))
-                       {
-                               set_action(creature_ptr, ACTION_NONE);
-                       }
-               }
-               else if (creature_ptr->resting == COMMAND_ARG_REST_UNTIL_DONE)
-               {
-                       if ((creature_ptr->chp == creature_ptr->mhp) &&
-                               (creature_ptr->csp >= creature_ptr->msp) &&
-                               !creature_ptr->blind && !creature_ptr->confused &&
-                               !creature_ptr->poisoned && !creature_ptr->afraid &&
-                               !creature_ptr->stun && !creature_ptr->cut &&
-                               !creature_ptr->slow && !creature_ptr->paralyzed &&
-                               !creature_ptr->image && !creature_ptr->word_recall &&
-                               !creature_ptr->alter_reality)
-                       {
-                               set_action(creature_ptr, ACTION_NONE);
-                       }
-               }
-       }
-
-       if (creature_ptr->action == ACTION_FISH) process_fishing(creature_ptr);
-
-       if (check_abort)
-       {
-               if (creature_ptr->running || travel.run || command_rep || (creature_ptr->action == ACTION_REST) || (creature_ptr->action == ACTION_FISH))
-               {
-                       inkey_scan = TRUE;
-                       if (inkey())
-                       {
-                               flush();
-                               disturb(creature_ptr, FALSE, TRUE);
-                               msg_print(_("中断しました。", "Canceled."));
-                       }
-               }
-       }
-
-       if (creature_ptr->riding && !creature_ptr->confused && !creature_ptr->blind)
-       {
-               monster_type *m_ptr = &creature_ptr->current_floor_ptr->m_list[creature_ptr->riding];
-               monster_race *r_ptr = &r_info[m_ptr->r_idx];
-               if (MON_CSLEEP(m_ptr))
-               {
-                       GAME_TEXT m_name[MAX_NLEN];
-                       (void)set_monster_csleep(creature_ptr, creature_ptr->riding, 0);
-                       monster_desc(creature_ptr, m_name, m_ptr, 0);
-                       msg_format(_("%^sを起こした。", "You have woken %s up."), m_name);
-               }
-
-               if (MON_STUNNED(m_ptr))
-               {
-                       if (set_monster_stunned(creature_ptr, creature_ptr->riding,
-                               (randint0(r_ptr->level) < creature_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_STUNNED(m_ptr) - 1)))
-                       {
-                               GAME_TEXT m_name[MAX_NLEN];
-                               monster_desc(creature_ptr, m_name, m_ptr, 0);
-                               msg_format(_("%^sを朦朧状態から立ち直らせた。", "%^s is no longer stunned."), m_name);
-                       }
-               }
-
-               if (MON_CONFUSED(m_ptr))
-               {
-                       if (set_monster_confused(creature_ptr, creature_ptr->riding,
-                               (randint0(r_ptr->level) < creature_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_CONFUSED(m_ptr) - 1)))
-                       {
-                               GAME_TEXT m_name[MAX_NLEN];
-                               monster_desc(creature_ptr, m_name, m_ptr, 0);
-                               msg_format(_("%^sを混乱状態から立ち直らせた。", "%^s is no longer confused."), m_name);
-                       }
-               }
-
-               if (MON_MONFEAR(m_ptr))
-               {
-                       if (set_monster_monfear(creature_ptr, creature_ptr->riding,
-                               (randint0(r_ptr->level) < creature_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_MONFEAR(m_ptr) - 1)))
-                       {
-                               GAME_TEXT m_name[MAX_NLEN];
-                               monster_desc(creature_ptr, m_name, m_ptr, 0);
-                               msg_format(_("%^sを恐怖から立ち直らせた。", "%^s is no longer afraid."), m_name);
-                       }
-               }
-
-               handle_stuff(creature_ptr);
-       }
-
-       load = FALSE;
-       if (creature_ptr->lightspeed)
-       {
-               (void)set_lightspeed(creature_ptr, creature_ptr->lightspeed - 1, TRUE);
-       }
-
-       if ((creature_ptr->pclass == CLASS_FORCETRAINER) && P_PTR_KI)
-       {
-               if (P_PTR_KI < 40) P_PTR_KI = 0;
-               else P_PTR_KI -= 40;
-               creature_ptr->update |= (PU_BONUS);
-       }
-
-       if (creature_ptr->action == ACTION_LEARN)
-       {
-               s32b cost = 0L;
-               u32b cost_frac = (creature_ptr->msp + 30L) * 256L;
-               s64b_LSHIFT(cost, cost_frac, 16);
-               if (s64b_cmp(creature_ptr->csp, creature_ptr->csp_frac, cost, cost_frac) < 0)
-               {
-                       creature_ptr->csp = 0;
-                       creature_ptr->csp_frac = 0;
-                       set_action(creature_ptr, ACTION_NONE);
-               }
-               else
-               {
-                       s64b_sub(&(creature_ptr->csp), &(creature_ptr->csp_frac), cost, cost_frac);
-               }
-
-               creature_ptr->redraw |= PR_MANA;
-       }
-
-       if (creature_ptr->special_defense & KATA_MASK)
-       {
-               if (creature_ptr->special_defense & KATA_MUSOU)
-               {
-                       if (creature_ptr->csp < 3)
-                       {
-                               set_action(creature_ptr, ACTION_NONE);
-                       }
-                       else
-                       {
-                               creature_ptr->csp -= 2;
-                               creature_ptr->redraw |= (PR_MANA);
-                       }
-               }
-       }
-
-       /*** Handle actual user input ***/
-       while (creature_ptr->energy_need <= 0)
-       {
-               creature_ptr->window |= PW_PLAYER;
-               creature_ptr->sutemi = FALSE;
-               creature_ptr->counter = FALSE;
-               creature_ptr->now_damaged = FALSE;
-
-               handle_stuff(creature_ptr);
-               move_cursor_relative(creature_ptr->y, creature_ptr->x);
-               if (fresh_before) Term_fresh();
-
-               pack_overflow(creature_ptr);
-               if (!command_new) command_see = FALSE;
-
-               free_turn(creature_ptr);
-               if (creature_ptr->phase_out)
-               {
-                       move_cursor_relative(creature_ptr->y, creature_ptr->x);
-                       command_cmd = SPECIAL_KEY_BUILDING;
-                       process_command(creature_ptr);
-               }
-               else if (creature_ptr->paralyzed || (creature_ptr->stun >= 100))
-               {
-                       take_turn(creature_ptr, 100);
-               }
-               else if (creature_ptr->action == ACTION_REST)
-               {
-                       if (creature_ptr->resting > 0)
-                       {
-                               creature_ptr->resting--;
-                               if (!creature_ptr->resting) set_action(creature_ptr, ACTION_NONE);
-                               creature_ptr->redraw |= (PR_STATE);
-                       }
-
-                       take_turn(creature_ptr, 100);
-               }
-               else if (creature_ptr->action == ACTION_FISH)
-               {
-                       take_turn(creature_ptr, 100);
-               }
-               else if (creature_ptr->running)
-               {
-                       run_step(creature_ptr, 0);
-               }
-               else if (travel.run)
-               {
-                       travel_step(creature_ptr);
-               }
-               else if (command_rep)
-               {
-                       command_rep--;
-                       creature_ptr->redraw |= (PR_STATE);
-                       handle_stuff(creature_ptr);
-                       msg_flag = FALSE;
-                       prt("", 0, 0);
-                       process_command(creature_ptr);
-               }
-               else
-               {
-                       move_cursor_relative(creature_ptr->y, creature_ptr->x);
-                       can_save = TRUE;
-                       request_command(creature_ptr, FALSE);
-                       can_save = FALSE;
-                       process_command(creature_ptr);
-               }
-
-               pack_overflow(creature_ptr);
-               if (creature_ptr->energy_use)
-               {
-                       if (creature_ptr->timewalk || creature_ptr->energy_use > 400)
-                       {
-                               creature_ptr->energy_need += creature_ptr->energy_use * TURNS_PER_TICK / 10;
-                       }
-                       else
-                       {
-                               creature_ptr->energy_need += (s16b)((s32b)creature_ptr->energy_use * ENERGY_NEED() / 100L);
-                       }
-
-                       if (creature_ptr->image) creature_ptr->redraw |= (PR_MAP);
-
-                       for (MONSTER_IDX m_idx = 1; m_idx < creature_ptr->current_floor_ptr->m_max; m_idx++)
-                       {
-                               monster_type *m_ptr;
-                               monster_race *r_ptr;
-                               m_ptr = &creature_ptr->current_floor_ptr->m_list[m_idx];
-                               if (!monster_is_valid(m_ptr)) continue;
-                               if (!m_ptr->ml) continue;
-
-                               r_ptr = &r_info[m_ptr->ap_r_idx];
-                               if (!(r_ptr->flags1 & (RF1_ATTR_MULTI | RF1_SHAPECHANGER)))
-                                       continue;
-
-                               lite_spot(creature_ptr, m_ptr->fy, m_ptr->fx);
-                       }
-
-                       if (repair_monsters)
-                       {
-                               repair_monsters = FALSE;
-                               for (MONSTER_IDX m_idx = 1; m_idx < creature_ptr->current_floor_ptr->m_max; m_idx++)
-                               {
-                                       monster_type *m_ptr;
-                                       m_ptr = &creature_ptr->current_floor_ptr->m_list[m_idx];
-                                       if (!monster_is_valid(m_ptr)) continue;
-
-                                       if (m_ptr->mflag & MFLAG_NICE)
-                                       {
-                                               m_ptr->mflag &= ~(MFLAG_NICE);
-                                       }
-
-                                       if (m_ptr->mflag2 & MFLAG2_MARK)
-                                       {
-                                               if (m_ptr->mflag2 & MFLAG2_SHOW)
-                                               {
-                                                       m_ptr->mflag2 &= ~(MFLAG2_SHOW);
-                                                       repair_monsters = TRUE;
-                                               }
-                                               else
-                                               {
-                                                       m_ptr->mflag2 &= ~(MFLAG2_MARK);
-                                                       m_ptr->ml = FALSE;
-                                                       update_monster(creature_ptr, m_idx, FALSE);
-                                                       if (creature_ptr->health_who == m_idx) creature_ptr->redraw |= (PR_HEALTH);
-                                                       if (creature_ptr->riding == m_idx) creature_ptr->redraw |= (PR_UHEALTH);
-
-                                                       lite_spot(creature_ptr, m_ptr->fy, m_ptr->fx);
-                                               }
-                                       }
-                               }
-                       }
-
-                       if (creature_ptr->pclass == CLASS_IMITATOR)
-                       {
-                               if (creature_ptr->mane_num > (creature_ptr->lev > 44 ? 3 : creature_ptr->lev > 29 ? 2 : 1))
-                               {
-                                       creature_ptr->mane_num--;
-                                       for (int j = 0; j < creature_ptr->mane_num; j++)
-                                       {
-                                               creature_ptr->mane_spell[j] = creature_ptr->mane_spell[j + 1];
-                                               creature_ptr->mane_dam[j] = creature_ptr->mane_dam[j + 1];
-                                       }
-                               }
-
-                               creature_ptr->new_mane = FALSE;
-                               creature_ptr->redraw |= (PR_IMITATION);
-                       }
-
-                       if (creature_ptr->action == ACTION_LEARN)
-                       {
-                               creature_ptr->new_mane = FALSE;
-                               creature_ptr->redraw |= (PR_STATE);
-                       }
-
-                       if (creature_ptr->timewalk && (creature_ptr->energy_need > -1000))
-                       {
-
-                               creature_ptr->redraw |= (PR_MAP);
-                               creature_ptr->update |= (PU_MONSTERS);
-                               creature_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
-
-                               msg_print(_("「時は動きだす…」", "You feel time flowing around you once more."));
-                               msg_print(NULL);
-                               creature_ptr->timewalk = FALSE;
-                               creature_ptr->energy_need = ENERGY_NEED();
-
-                               handle_stuff(creature_ptr);
-                       }
-               }
-
-               if (!creature_ptr->playing || creature_ptr->is_dead)
-               {
-                       creature_ptr->timewalk = FALSE;
-                       break;
-               }
-
-               if (creature_ptr->energy_use && creature_ptr->reset_concent)
-                       reset_concentration(creature_ptr, TRUE);
-
-               if (creature_ptr->leaving) break;
-       }
-
-       update_smell(creature_ptr->current_floor_ptr, creature_ptr);
-}
-
-
-/*!
+ * process_player()、process_world() をcore.c から移設するのが先.
+ * process_upkeep_with_speed() はこの関数と同じところでOK
  * @brief 現在プレイヤーがいるダンジョンの全体処理 / Interact with the current dungeon level.
  * @return なし
  * @details