OSDN Git Service

Revert "Merge branch 'master' of git.osdn.net:/gitroot/hengband/hengband"
[hengband/hengband.git] / src / wizard2.c
index 7f9429d..c395224 100644 (file)
  */
 
 #include "angband.h"
-#include "core/angband-version.h"
-#include "core/stuff-handler.h"
-#include "gameterm.h"
-
-#include "dungeon.h"
-#include "io/write-diary.h"
-#include "cmd/cmd-draw.h"
-#include "cmd/cmd-dump.h"
-#include "cmd/cmd-help.h"
-#include "cmd/cmd-save.h"
-#include "util.h"
-#include "birth/birth.h"
 #include "selfinfo.h"
 #include "patron.h"
 #include "mutation.h"
 #include "quest.h"
 #include "artifact.h"
 #include "player-status.h"
-#include "player-effects.h"
-#include "player-skill.h"
-#include "player-class.h"
-#include "player-inventory.h"
 
-#include "spell/spells-util.h"
+#include "spells.h"
 #include "spells-object.h"
 #include "spells-summon.h"
 #include "spells-status.h"
 #include "spells-world.h"
 #include "spells-floor.h"
 
-#include "object-flavor.h"
 #include "object-hook.h"
 #include "monster-status.h"
 
 #include "floor.h"
 #include "floor-save.h"
-#include "grid.h"
-#include "dungeon-file.h"
-#include "files.h"
-#include "monster-spell.h"
-#include "market/building.h"
-#include "object/object-kind.h"
-#include "targeting.h"
-#include "view/display-main-window.h"
-#include "world.h"
-#include "spell/spells2.h"
-#include "spell/spells3.h"
-
-#define NUM_O_SET 8
-#define NUM_O_BIT 32
-
-extern void do_cmd_debug(player_type *creature_ptr);
-
-typedef union spell_functions {
-       struct debug_spell_type1 { bool(*spell_function)(player_type *, floor_type *); } spell1;
-       struct debug_spell_type2 { bool(*spell_function)(player_type *); } spell2;
-       struct debug_spell_type3 { bool(*spell_function)(player_type *, HIT_POINT); } spell3;
-} spell_functions;
-
-typedef struct debug_spell_command
-{
-       int type;
-       char *command_name;
-       spell_functions command_function;
-} debug_spell_command;
-
-#define SPELL_MAX 3
-debug_spell_command debug_spell_commands_list[SPELL_MAX] =
-{
-       { 2, "vanish dungeon", {.spell2 = { vanish_dungeon } } },
-       { 3, "true healing", {.spell3 = { true_healing } } },
-       { 2, "drop weapons", {.spell2 = { drop_weapons } } }
-};
-
-/*!
- * @brief コマンド入力により任意にスペル効果を起こす / Wizard spells
- * @return 実際にテレポートを行ったらTRUEを返す
- */
-static bool do_cmd_debug_spell(player_type *creature_ptr)
-{
-       char tmp_val[50] = "\0";
-       int tmp_int;
-
-       if (!get_string("SPELL: ", tmp_val, 32)) return FALSE;
-
-       for (int i = 0; i < SPELL_MAX; i++)
-       {
-               if (strcmp(tmp_val, debug_spell_commands_list[i].command_name) != 0)
-                       continue;
-               switch (debug_spell_commands_list[i].type)
-               {
-               case 2:
-                       (*(debug_spell_commands_list[i].command_function.spell2.spell_function))(creature_ptr);
-                       return TRUE;
-                       break;
-               case 3:
-                       tmp_val[0] = '\0';
-                       if (!get_string("POWER:", tmp_val, 32)) return FALSE;
-                       tmp_int = atoi(tmp_val);
-                       (*(debug_spell_commands_list[i].command_function.spell3.spell_function))(creature_ptr, tmp_int);
-                       return TRUE;
-                       break;
-               default:
-                       break;
-               }
-       }
-
-       msg_format("Command not found.");
-
-       return FALSE;
-}
 
+#ifdef ALLOW_WIZARD
 
 /*!
  * @brief 必ず成功するウィザードモード用次元の扉処理 / Wizard Dimension Door
- * @param caster_ptr プレーヤーへの参照ポインタ
  * @return 実際にテレポートを行ったらTRUEを返す
  */
-static bool wiz_dimension_door(player_type *caster_ptr)
+static bool wiz_dimension_door(void)
 {
        POSITION x = 0, y = 0;
-       if (!tgt_pt(caster_ptr, &x, &y)) return FALSE;
-       teleport_player_to(caster_ptr, y, x, TELEPORT_NONMAGICAL);
-       return TRUE;
+       if (!tgt_pt(&x, &y)) return FALSE;
+       teleport_player_to(y, x, TELEPORT_NONMAGICAL);
+       return (TRUE);
 }
 
 /*!
  * @brief 指定されたIDの固定アーティファクトを生成する / Create the artifact of the specified number
- * @param caster_ptr プレーヤーへの参照ポインタ
  * @return なし
  */
-static void wiz_create_named_art(player_type *caster_ptr)
+static void wiz_create_named_art(void)
 {
        char tmp_val[10] = "";
        ARTIFACT_IDX a_idx;
@@ -152,10 +59,11 @@ static void wiz_create_named_art(player_type *caster_ptr)
 
        /* Extract */
        a_idx = (ARTIFACT_IDX)atoi(tmp_val);
-       if (a_idx < 0) a_idx = 0;
-       if (a_idx >= max_a_idx) a_idx = 0;
+       if(a_idx < 0) a_idx = 0;
+       if(a_idx >= max_a_idx) a_idx = 0; 
 
-       (void)create_named_art(caster_ptr, a_idx, caster_ptr->y, caster_ptr->x);
+       /* Create the artifact */
+       (void)create_named_art(a_idx, p_ptr->y, p_ptr->x);
 
        /* All done */
        msg_print("Allocated.");
@@ -163,21 +71,20 @@ static void wiz_create_named_art(player_type *caster_ptr)
 
 /*!
  * @brief ウィザードモード用モンスターの群れ生成 / Summon a horde of monsters
- * @param caster_ptr プレーヤーへの参照ポインタ
  * @return なし
  */
-static void do_cmd_summon_horde(player_type *caster_ptr)
+static void do_cmd_summon_horde(void)
 {
-       POSITION wy = caster_ptr->y, wx = caster_ptr->x;
+       POSITION wy = p_ptr->y, wx = p_ptr->x;
        int attempts = 1000;
 
        while (--attempts)
        {
-               scatter(caster_ptr, &wy, &wx, caster_ptr->y, caster_ptr->x, 3, 0);
-               if (is_cave_empty_bold(caster_ptr, wy, wx)) break;
+               scatter(&wy, &wx, p_ptr->y, p_ptr->x, 3, 0);
+               if (cave_empty_bold(wy, wx)) break;
        }
 
-       (void)alloc_horde(caster_ptr, wy, wx);
+       (void)alloc_horde(wy, wx);
 }
 
 /*!
@@ -219,21 +126,28 @@ static void prt_binary(BIT_FLAGS flags, int row, int col)
  */
 static void prt_alloc(OBJECT_TYPE_VALUE tval, OBJECT_SUBTYPE_VALUE sval, TERM_LEN row, TERM_LEN col)
 {
+       int i, j;
+       int home = 0;
        u32b rarity[K_MAX_DEPTH];
-       (void)C_WIPE(rarity, K_MAX_DEPTH, u32b);
        u32b total[K_MAX_DEPTH];
-       (void)C_WIPE(total, K_MAX_DEPTH, u32b);
        s32b display[22];
+       concptr r = "+---Rate---+";
+       object_kind *k_ptr;
+
+
+       /* Get the entry */
+       alloc_entry *table = alloc_kind_table;
+
+       /* Wipe the tables */
+       (void)C_WIPE(rarity, K_MAX_DEPTH, u32b);
+       (void)C_WIPE(total, K_MAX_DEPTH, u32b);
        (void)C_WIPE(display, 22, s32b);
 
        /* Scan all entries */
-       int home = 0;
-       for (int i = 0; i < K_MAX_DEPTH; i++)
+       for (i = 0; i < K_MAX_DEPTH; i++)
        {
                int total_frac = 0;
-               object_kind *k_ptr;
-               alloc_entry *table = alloc_kind_table;
-               for (int j = 0; j < alloc_kind_size; j++)
+               for (j = 0; j < alloc_kind_size; j++)
                {
                        PERCENTAGE prob = 0;
 
@@ -264,19 +178,19 @@ static void prt_alloc(OBJECT_TYPE_VALUE tval, OBJECT_SUBTYPE_VALUE sval, TERM_LE
        }
 
        /* Calculate probabilities for each range */
-       for (int i = 0; i < 22; i++)
+       for (i = 0; i < 22; i++)
        {
                /* Shift the values into view */
                int possibility = 0;
-               for (int j = i * K_MAX_DEPTH / 22; j < (i + 1) * K_MAX_DEPTH / 22; j++)
+               for (j = i * K_MAX_DEPTH / 22; j < (i + 1) * K_MAX_DEPTH / 22; j++)
                        possibility += rarity[j] * 100000 / total[j];
                display[i] = possibility / 5;
        }
 
        /* Graph the rarities */
-       for (int i = 0; i < 22; i++)
+       for (i = 0; i < 22; i++)
        {
-               Term_putch(col, row + i + 1, TERM_WHITE, '|');
+               Term_putch(col, row + i + 1, TERM_WHITE,  '|');
 
                prt(format("%2dF", (i * 5)), row + i + 1, col);
 
@@ -293,7 +207,6 @@ static void prt_alloc(OBJECT_TYPE_VALUE tval, OBJECT_SUBTYPE_VALUE sval, TERM_LE
        }
 
        /* Make it look nice */
-       concptr r = "+---Rate---+";
        prt(r, row, col);
 }
 
@@ -302,35 +215,37 @@ static void prt_alloc(OBJECT_TYPE_VALUE tval, OBJECT_SUBTYPE_VALUE sval, TERM_LE
  * @return なし
  * @todo 魔法領域の再選択などがまだ不完全、要実装。
  */
-static void do_cmd_wiz_reset_class(player_type *creature_ptr)
+static void do_cmd_wiz_reset_class(void)
 {
-       /* Prompt */
+       int tmp_int;
+       char tmp_val[160];
        char ppp[80];
+
+       /* Prompt */
        sprintf(ppp, "Class (0-%d): ", MAX_CLASS - 1);
 
        /* Default */
-       char tmp_val[160];
-       sprintf(tmp_val, "%d", creature_ptr->pclass);
+       sprintf(tmp_val, "%d", p_ptr->pclass);
 
        /* Query */
        if (!get_string(ppp, tmp_val, 2)) return;
 
        /* Extract */
-       int tmp_int = atoi(tmp_val);
+       tmp_int = atoi(tmp_val);
 
        /* Verify */
        if (tmp_int < 0 || tmp_int >= MAX_CLASS) return;
 
        /* Save it */
-       creature_ptr->pclass = (byte)tmp_int;
+       p_ptr->pclass = (byte_hack)tmp_int;
 
        /* Redraw inscription */
-       creature_ptr->window |= (PW_PLAYER);
+       p_ptr->window |= (PW_PLAYER);
 
-       /* {.} and {$} effect creature_ptr->warning and TRC_TELEPORT_SELF */
-       creature_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
+       /* {.} and {$} effect p_ptr->warning and TRC_TELEPORT_SELF */
+       p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
 
-       handle_stuff(creature_ptr);
+       handle_stuff();
 }
 
 
@@ -338,13 +253,13 @@ static void do_cmd_wiz_reset_class(player_type *creature_ptr)
  * @brief ウィザードモード用処理としてターゲット中の相手をテレポートバックする / Hack -- Teleport to the target
  * @return なし
  */
-static void do_cmd_wiz_bamf(player_type *caster_ptr)
+static void do_cmd_wiz_bamf(void)
 {
        /* Must have a target */
        if (!target_who) return;
 
        /* Teleport to the target */
-       teleport_player_to(caster_ptr, target_row, target_col, TELEPORT_NONMAGICAL);
+       teleport_player_to(target_row, target_col, TELEPORT_NONMAGICAL);
 }
 
 
@@ -353,22 +268,24 @@ static void do_cmd_wiz_bamf(player_type *caster_ptr)
  * Aux function for "do_cmd_wiz_change()".     -RAK-
  * @return なし
  */
-static void do_cmd_wiz_change_aux(player_type *creature_ptr)
+static void do_cmd_wiz_change_aux(void)
 {
+       int i, j;
        int tmp_int;
        long tmp_long;
        s16b tmp_s16b;
        char tmp_val[160];
        char ppp[80];
 
+
        /* Query the stats */
-       for (int i = 0; i < A_MAX; i++)
+       for (i = 0; i < A_MAX; i++)
        {
                /* Prompt */
-               sprintf(ppp, "%s (3-%d): ", stat_names[i], creature_ptr->stat_max_max[i]);
+               sprintf(ppp, "%s (3-%d): ", stat_names[i], p_ptr->stat_max_max[i]);
 
                /* Default */
-               sprintf(tmp_val, "%d", creature_ptr->stat_max[i]);
+               sprintf(tmp_val, "%d", p_ptr->stat_max[i]);
 
                /* Query */
                if (!get_string(ppp, tmp_val, 3)) return;
@@ -377,11 +294,11 @@ static void do_cmd_wiz_change_aux(player_type *creature_ptr)
                tmp_int = atoi(tmp_val);
 
                /* Verify */
-               if (tmp_int > creature_ptr->stat_max_max[i]) tmp_int = creature_ptr->stat_max_max[i];
+               if (tmp_int > p_ptr->stat_max_max[i]) tmp_int = p_ptr->stat_max_max[i];
                else if (tmp_int < 3) tmp_int = 3;
 
                /* Save it */
-               creature_ptr->stat_cur[i] = creature_ptr->stat_max[i] = (BASE_STATUS)tmp_int;
+               p_ptr->stat_cur[i] = p_ptr->stat_max[i] = (BASE_STATUS)tmp_int;
        }
 
 
@@ -398,29 +315,28 @@ static void do_cmd_wiz_change_aux(player_type *creature_ptr)
        if (tmp_s16b < WEAPON_EXP_UNSKILLED) tmp_s16b = WEAPON_EXP_UNSKILLED;
        if (tmp_s16b > WEAPON_EXP_MASTER) tmp_s16b = WEAPON_EXP_MASTER;
 
-       for (int j = 0; j <= TV_WEAPON_END - TV_WEAPON_BEGIN; j++)
+       for (j = 0; j <= TV_WEAPON_END - TV_WEAPON_BEGIN; j++)
        {
-               for (int i = 0; i < 64; i++)
+               for (i = 0;i < 64;i++)
                {
-                       creature_ptr->weapon_exp[j][i] = tmp_s16b;
-                       if (creature_ptr->weapon_exp[j][i] > s_info[creature_ptr->pclass].w_max[j][i]) creature_ptr->weapon_exp[j][i] = s_info[creature_ptr->pclass].w_max[j][i];
+                       p_ptr->weapon_exp[j][i] = tmp_s16b;
+                       if (p_ptr->weapon_exp[j][i] > s_info[p_ptr->pclass].w_max[j][i]) p_ptr->weapon_exp[j][i] = s_info[p_ptr->pclass].w_max[j][i];
                }
        }
 
-       for (int j = 0; j < 10; j++)
+       for (j = 0; j < 10; j++)
        {
-               creature_ptr->skill_exp[j] = tmp_s16b;
-               if (creature_ptr->skill_exp[j] > s_info[creature_ptr->pclass].s_max[j]) creature_ptr->skill_exp[j] = s_info[creature_ptr->pclass].s_max[j];
+               p_ptr->skill_exp[j] = tmp_s16b;
+               if (p_ptr->skill_exp[j] > s_info[p_ptr->pclass].s_max[j]) p_ptr->skill_exp[j] = s_info[p_ptr->pclass].s_max[j];
        }
 
-       int k;
-       for (k = 0; k < 32; k++)
-               creature_ptr->spell_exp[k] = (tmp_s16b > SPELL_EXP_MASTER ? SPELL_EXP_MASTER : tmp_s16b);
-       for (; k < 64; k++)
-               creature_ptr->spell_exp[k] = (tmp_s16b > SPELL_EXP_EXPERT ? SPELL_EXP_EXPERT : tmp_s16b);
+       for (j = 0; j < 32; j++)
+               p_ptr->spell_exp[j] = (tmp_s16b > SPELL_EXP_MASTER ? SPELL_EXP_MASTER : tmp_s16b);
+       for (; j < 64; j++)
+               p_ptr->spell_exp[j] = (tmp_s16b > SPELL_EXP_EXPERT ? SPELL_EXP_EXPERT : tmp_s16b);
 
        /* Default */
-       sprintf(tmp_val, "%ld", (long)(creature_ptr->au));
+       sprintf(tmp_val, "%ld", (long)(p_ptr->au));
 
        /* Query */
        if (!get_string("Gold: ", tmp_val, 9)) return;
@@ -432,10 +348,10 @@ static void do_cmd_wiz_change_aux(player_type *creature_ptr)
        if (tmp_long < 0) tmp_long = 0L;
 
        /* Save */
-       creature_ptr->au = tmp_long;
+       p_ptr->au = tmp_long;
 
        /* Default */
-       sprintf(tmp_val, "%ld", (long)(creature_ptr->max_exp));
+       sprintf(tmp_val, "%ld", (long)(p_ptr->max_exp));
 
        /* Query */
        if (!get_string("Experience: ", tmp_val, 9)) return;
@@ -446,14 +362,15 @@ static void do_cmd_wiz_change_aux(player_type *creature_ptr)
        /* Verify */
        if (tmp_long < 0) tmp_long = 0L;
 
-       if (creature_ptr->prace == RACE_ANDROID) return;
-
-       /* Save */
-       creature_ptr->max_exp = tmp_long;
-       creature_ptr->exp = tmp_long;
+       if (p_ptr->prace != RACE_ANDROID)
+       {
+               /* Save */
+               p_ptr->max_exp = tmp_long;
+               p_ptr->exp = tmp_long;
 
-       /* Update */
-       check_experience(creature_ptr);
+               /* Update */
+               check_experience();
+       }
 }
 
 
@@ -462,18 +379,17 @@ static void do_cmd_wiz_change_aux(player_type *creature_ptr)
  * Change various "permanent" player variables.
  * @return なし
  */
-static void do_cmd_wiz_change(player_type *creature_ptr)
+static void do_cmd_wiz_change(void)
 {
        /* Interact */
-       do_cmd_wiz_change_aux(creature_ptr);
-       do_cmd_redraw(creature_ptr);
+       do_cmd_wiz_change_aux();
+       do_cmd_redraw();
 }
 
 
 /*!
- * @brief アイテムの詳細ステータスを表示する /
+ * @brief アイテムの詳細ステータスを表示する / 
  * Change various "permanent" player variables.
- * @param player_ptr プレーヤーへの参照ポインタ
  * @param o_ptr 詳細を表示するアイテム情報の参照ポインタ
  * @return なし
  * @details
@@ -501,7 +417,7 @@ static void do_cmd_wiz_change(player_type *creature_ptr)
  *     thus accepting the default-values for the remaining values.
  *     pval comes first now, since it is most important.
  * - wiz_reroll_item()
- *     apply some magic to the item or turn it into an artifact.
+ *     apply some magic to the item or current_world_ptr->game_turn it into an artifact.
  * - wiz_roll_item()
  *     Get some statistics about the rarity of an item:
  *     We create a lot of fake items and see if they are of the
@@ -534,42 +450,42 @@ static void do_cmd_wiz_change(player_type *creature_ptr)
  * Originally by David Reeve Sward <sward+@CMU.EDU>
  * Verbose item flags by -Bernd-
  */
-static void wiz_display_item(player_type *player_ptr, object_type *o_ptr)
+static void wiz_display_item(object_type *o_ptr)
 {
+       int i, j = 13;
        BIT_FLAGS flgs[TR_FLAG_SIZE];
+       char buf[256];
        object_flags(o_ptr, flgs);
 
        /* Clear the screen */
-       int j = 13;
-       for (int i = 1; i <= 23; i++) prt("", i, j - 2);
+       for (i = 1; i <= 23; i++) prt("", i, j - 2);
 
        prt_alloc(o_ptr->tval, o_ptr->sval, 1, 0);
 
        /* Describe fully */
-       char buf[256];
-       object_desc(player_ptr, buf, o_ptr, OD_STORE);
+       object_desc(buf, o_ptr, OD_STORE);
 
        prt(buf, 2, j);
 
        prt(format("kind = %-5d  level = %-4d  tval = %-5d  sval = %-5d",
-               o_ptr->k_idx, k_info[o_ptr->k_idx].level,
-               o_ptr->tval, o_ptr->sval), 4, j);
+                  o_ptr->k_idx, k_info[o_ptr->k_idx].level,
+                  o_ptr->tval, o_ptr->sval), 4, j);
 
        prt(format("number = %-3d  wgt = %-6d  ac = %-5d    damage = %dd%d",
-               o_ptr->number, o_ptr->weight,
-               o_ptr->ac, o_ptr->dd, o_ptr->ds), 5, j);
+                  o_ptr->number, o_ptr->weight,
+                  o_ptr->ac, o_ptr->dd, o_ptr->ds), 5, j);
 
        prt(format("pval = %-5d  toac = %-5d  tohit = %-4d  todam = %-4d",
-               o_ptr->pval, o_ptr->to_a, o_ptr->to_h, o_ptr->to_d), 6, j);
+                  o_ptr->pval, o_ptr->to_a, o_ptr->to_h, o_ptr->to_d), 6, j);
 
        prt(format("name1 = %-4d  name2 = %-4d  cost = %ld",
-               o_ptr->name1, o_ptr->name2, (long)object_value_real(o_ptr)), 7, j);
+                  o_ptr->name1, o_ptr->name2, (long)object_value_real(o_ptr)), 7, j);
 
        prt(format("ident = %04x  xtra1 = %-4d  xtra2 = %-4d  timeout = %-d",
-               o_ptr->ident, o_ptr->xtra1, o_ptr->xtra2, o_ptr->timeout), 8, j);
+                  o_ptr->ident, o_ptr->xtra1, o_ptr->xtra2, o_ptr->timeout), 8, j);
 
        prt(format("xtra3 = %-4d  xtra4 = %-4d  xtra5 = %-4d  cursed  = %-d",
-               o_ptr->xtra3, o_ptr->xtra4, o_ptr->xtra5, o_ptr->curse_flags), 9, j);
+                  o_ptr->xtra3, o_ptr->xtra4, o_ptr->xtra5, o_ptr->curse_flags), 9, j);
 
        prt("+------------FLAGS1------------+", 10, j);
        prt("AFFECT........SLAY........BRAND.", 11, j);
@@ -587,21 +503,21 @@ static void wiz_display_item(player_type *player_ptr, object_type *o_ptr)
        prt("rtsxnaeydcedwlatdcedsrekdfddrxss", 22, j);
        prt_binary(flgs[1], 23, j);
 
-       prt("+------------FLAGS3------------+", 10, j + 32);
-       prt("fe cnn t      stdrmsiiii d ab   ", 11, j + 32);
-       prt("aa aoomywhs lleeieihgggg rtgl   ", 12, j + 32);
-       prt("uu utmacaih eielgggonnnnaaere   ", 13, j + 32);
-       prt("rr reanurdo vtieeehtrrrrcilas   ", 14, j + 32);
-       prt("aa algarnew ienpsntsaefctnevs   ", 15, j + 32);
-       prt_binary(flgs[2], 16, j + 32);
-
-       prt("+------------FLAGS4------------+", 17, j + 32);
-       prt("KILL....ESP.........            ", 18, j + 32);
-       prt("aeud tghaud tgdhegnu            ", 19, j + 32);
-       prt("nvneoriunneoriruvoon            ", 20, j + 32);
-       prt("iidmroamidmroagmionq            ", 21, j + 32);
-       prt("mlenclnmmenclnnnldlu            ", 22, j + 32);
-       prt_binary(flgs[3], 23, j + 32);
+       prt("+------------FLAGS3------------+", 10, j+32);
+       prt("fe cnn t      stdrmsiiii d ab   ", 11, j+32);
+       prt("aa aoomywhs lleeieihgggg rtgl   ", 12, j+32);
+       prt("uu utmacaih eielgggonnnnaaere   ", 13, j+32);
+       prt("rr reanurdo vtieeehtrrrrcilas   ", 14, j+32);
+       prt("aa algarnew ienpsntsaefctnevs   ", 15, j+32);
+       prt_binary(flgs[2], 16, j+32);
+
+       prt("+------------FLAGS4------------+", 17, j+32);
+       prt("KILL....ESP.........            ", 18, j+32);
+       prt("aeud tghaud tgdhegnu            ", 19, j+32);
+       prt("nvneoriunneoriruvoon            ", 20, j+32);
+       prt("iidmroamidmroagmionq            ", 21, j+32);
+       prt("mlenclnmmenclnnnldlu            ", 22, j+32);
+       prt_binary(flgs[3], 23, j+32);
 }
 
 
@@ -675,18 +591,36 @@ static tval_desc tvals[] =
 
 
 /*!
- * 選択処理用キーコード /
- * Global array for converting numbers to a logical list symbol
+ * @brief nameバッファ内からベースアイテム名を返す / Strip an "object name" into a buffer
+ * @param buf ベースアイテム格納先の参照ポインタ
+ * @param k_idx ベースアイテムID
+ * @return なし
  */
-static const char listsym[] =
+void strip_name(char *buf, KIND_OBJECT_IDX k_idx)
 {
-       '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
-       'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
-       'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
-       'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
-       'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
-       '\0'
-};
+       char *t;
+
+       object_kind *k_ptr = &k_info[k_idx];
+
+       concptr str = (k_name + k_ptr->name);
+
+
+       /* Skip past leading characters */
+       while ((*str == ' ') || (*str == '&')) str++;
+
+       /* Copy useful chars */
+       for (t = buf; *str; str++)
+       {
+#ifdef JP
+               if (iskanji(*str)) {*t++ = *str++; *t++ = *str; continue;}
+#endif
+               if (*str != '~') *t++ = *str;
+       }
+
+       /* Terminate the new name */
+       *t = '\0';
+}
+
 
 /*!
  * @brief ベースアイテムのウィザード生成のために大項目IDと小項目IDを取得する /
@@ -726,7 +660,7 @@ static KIND_OBJECT_IDX wiz_create_itemtype(void)
        max_num = num;
 
        /* Choose! */
-       if (!get_com("Get what type of object? ", &ch, FALSE)) return 0;
+       if (!get_com("Get what type of object? ", &ch, FALSE)) return (0);
 
        /* Analyze choice */
        for (num = 0; num < max_num; num++)
@@ -735,12 +669,13 @@ static KIND_OBJECT_IDX wiz_create_itemtype(void)
        }
 
        /* Bail out if choice is illegal */
-       if ((num < 0) || (num >= max_num)) return 0;
+       if ((num < 0) || (num >= max_num)) return (0);
 
        /* Base object type chosen, fill in tval */
        tval = tvals[num].tval;
        tval_desc = tvals[num].desc;
 
+
        /*** And now we go for k_idx ***/
        Term_clear();
 
@@ -750,29 +685,30 @@ static KIND_OBJECT_IDX wiz_create_itemtype(void)
                object_kind *k_ptr = &k_info[i];
 
                /* Analyze matching items */
-               if (k_ptr->tval != tval) continue;
-
-               /* Prepare it */
-               row = 2 + (num % 20);
-               col = 20 * (num / 20);
-               ch = listsym[num];
-               strcpy(buf, "                    ");
+               if (k_ptr->tval == tval)
+               {
+                       /* Prepare it */
+                       row = 2 + (num % 20);
+                       col = 20 * (num / 20);
+                       ch = listsym[num];
+                       strcpy(buf,"                    ");
 
-               /* Acquire the "name" of object "i" */
-               strip_name(buf, i);
+                       /* Acquire the "name" of object "i" */
+                       strip_name(buf, i);
 
-               /* Print it */
-               prt(format("[%c] %s", ch, buf), row, col);
+                       /* Print it */
+                       prt(format("[%c] %s", ch, buf), row, col);
 
-               /* Remember the object index */
-               choice[num++] = i;
+                       /* Remember the object index */
+                       choice[num++] = i;
+               }
        }
 
        /* Me need to know the maximal possible remembered object_index */
        max_num = num;
 
        /* Choose! */
-       if (!get_com(format("What Kind of %s? ", tval_desc), &ch, FALSE)) return 0;
+       if (!get_com(format("What Kind of %s? ", tval_desc), &ch, FALSE)) return (0);
 
        /* Analyze choice */
        for (num = 0; num < max_num; num++)
@@ -781,7 +717,7 @@ static KIND_OBJECT_IDX wiz_create_itemtype(void)
        }
 
        /* Bail out if choice is "illegal" */
-       if ((num < 0) || (num >= max_num)) return 0;
+       if ((num < 0) || (num >= max_num)) return (0);
 
        /* And return successful */
        return (choice[num]);
@@ -790,63 +726,73 @@ static KIND_OBJECT_IDX wiz_create_itemtype(void)
 
 /*!
  * @briefアイテムの基礎能力値を調整する / Tweak an item
- * @param player_ptr プレーヤーへの参照ポインタ
  * @param o_ptr 調整するアイテムの参照ポインタ
  * @return なし
  */
-static void wiz_tweak_item(player_type *player_ptr, object_type *o_ptr)
+static void wiz_tweak_item(object_type *o_ptr)
 {
+       concptr p;
+       char tmp_val[80];
+
+       /* Hack -- leave artifacts alone */
        if (object_is_artifact(o_ptr)) return;
 
-       concptr p = "Enter new 'pval' setting: ";
-       char tmp_val[80];
+       p = "Enter new 'pval' setting: ";
        sprintf(tmp_val, "%d", o_ptr->pval);
        if (!get_string(p, tmp_val, 5)) return;
        o_ptr->pval = (s16b)atoi(tmp_val);
-       wiz_display_item(player_ptr, o_ptr);
+       wiz_display_item(o_ptr);
 
        p = "Enter new 'to_a' setting: ";
        sprintf(tmp_val, "%d", o_ptr->to_a);
        if (!get_string(p, tmp_val, 5)) return;
        o_ptr->to_a = (s16b)atoi(tmp_val);
-       wiz_display_item(player_ptr, o_ptr);
+       wiz_display_item(o_ptr);
 
        p = "Enter new 'to_h' setting: ";
        sprintf(tmp_val, "%d", o_ptr->to_h);
        if (!get_string(p, tmp_val, 5)) return;
        o_ptr->to_h = (s16b)atoi(tmp_val);
-       wiz_display_item(player_ptr, o_ptr);
+       wiz_display_item(o_ptr);
 
        p = "Enter new 'to_d' setting: ";
        sprintf(tmp_val, "%d", (int)o_ptr->to_d);
        if (!get_string(p, tmp_val, 5)) return;
        o_ptr->to_d = (s16b)atoi(tmp_val);
-       wiz_display_item(player_ptr, o_ptr);
+       wiz_display_item(o_ptr);
 }
 
 
 /*!
  * @brief アイテムの質を選択して再生成する /
- * Apply magic to an item or turn it into an artifact. -Bernd-
+ * Apply magic to an item or current_world_ptr->game_turn it into an artifact. -Bernd-
  * @param o_ptr 再生成の対象となるアイテム情報の参照ポインタ
  * @return なし
  */
-static void wiz_reroll_item(player_type *owner_ptr, object_type *o_ptr)
+static void wiz_reroll_item(object_type *o_ptr)
 {
-       if (object_is_artifact(o_ptr)) return;
-
        object_type forge;
        object_type *q_ptr;
+
+       char ch;
+
+       bool changed = FALSE;
+
+
+       /* Hack -- leave artifacts alone */
+       if (object_is_artifact(o_ptr)) return;
+
        q_ptr = &forge;
+
+       /* Copy the object */
        object_copy(q_ptr, o_ptr);
 
+
        /* Main loop. Ask for magification and artifactification */
-       char ch;
-       bool changed = FALSE;
        while (TRUE)
        {
                /* Display full item debug information */
-               wiz_display_item(owner_ptr, q_ptr);
+               wiz_display_item(q_ptr);
 
                /* Ask wizard what to do. */
                if (!get_com("[a]ccept, [w]orthless, [c]ursed, [n]ormal, [g]ood, [e]xcellent, [s]pecial? ", &ch, FALSE))
@@ -876,76 +822,78 @@ static void wiz_reroll_item(player_type *owner_ptr, object_type *o_ptr)
                        q_ptr->name1 = 0;
                }
 
-               switch (ch)
+               switch(ch)
                {
                        /* Apply bad magic, but first clear object */
-               case 'w': case 'W':
-               {
-                       object_prep(q_ptr, o_ptr->k_idx);
-                       apply_magic(owner_ptr, q_ptr, owner_ptr->current_floor_ptr->dun_level, AM_NO_FIXED_ART | AM_GOOD | AM_GREAT | AM_CURSED);
-                       break;
-               }
-               /* Apply bad magic, but first clear object */
-               case 'c': case 'C':
-               {
-                       object_prep(q_ptr, o_ptr->k_idx);
-                       apply_magic(owner_ptr, q_ptr, owner_ptr->current_floor_ptr->dun_level, AM_NO_FIXED_ART | AM_GOOD | AM_CURSED);
-                       break;
-               }
-               /* Apply normal magic, but first clear object */
-               case 'n': case 'N':
-               {
-                       object_prep(q_ptr, o_ptr->k_idx);
-                       apply_magic(owner_ptr, q_ptr, owner_ptr->current_floor_ptr->dun_level, AM_NO_FIXED_ART);
-                       break;
-               }
-               /* Apply good magic, but first clear object */
-               case 'g': case 'G':
-               {
-                       object_prep(q_ptr, o_ptr->k_idx);
-                       apply_magic(owner_ptr, q_ptr, owner_ptr->current_floor_ptr->dun_level, AM_NO_FIXED_ART | AM_GOOD);
-                       break;
-               }
-               /* Apply great magic, but first clear object */
-               case 'e': case 'E':
-               {
-                       object_prep(q_ptr, o_ptr->k_idx);
-                       apply_magic(owner_ptr, q_ptr, owner_ptr->current_floor_ptr->dun_level, AM_NO_FIXED_ART | AM_GOOD | AM_GREAT);
-                       break;
-               }
-               /* Apply special magic, but first clear object */
-               case 's': case 'S':
-               {
-                       object_prep(q_ptr, o_ptr->k_idx);
-                       apply_magic(owner_ptr, q_ptr, owner_ptr->current_floor_ptr->dun_level, AM_GOOD | AM_GREAT | AM_SPECIAL);
+                       case 'w': case 'W':
+                       {
+                               object_prep(q_ptr, o_ptr->k_idx);
+                               apply_magic(q_ptr, current_floor_ptr->dun_level, AM_NO_FIXED_ART | AM_GOOD | AM_GREAT | AM_CURSED);
+                               break;
+                       }
+                       /* Apply bad magic, but first clear object */
+                       case 'c': case 'C':
+                       {
+                               object_prep(q_ptr, o_ptr->k_idx);
+                               apply_magic(q_ptr, current_floor_ptr->dun_level, AM_NO_FIXED_ART | AM_GOOD | AM_CURSED);
+                               break;
+                       }
+                       /* Apply normal magic, but first clear object */
+                       case 'n': case 'N':
+                       {
+                               object_prep(q_ptr, o_ptr->k_idx);
+                               apply_magic(q_ptr, current_floor_ptr->dun_level, AM_NO_FIXED_ART);
+                               break;
+                       }
+                       /* Apply good magic, but first clear object */
+                       case 'g': case 'G':
+                       {
+                               object_prep(q_ptr, o_ptr->k_idx);
+                               apply_magic(q_ptr, current_floor_ptr->dun_level, AM_NO_FIXED_ART | AM_GOOD);
+                               break;
+                       }
+                       /* Apply great magic, but first clear object */
+                       case 'e': case 'E':
+                       {
+                               object_prep(q_ptr, o_ptr->k_idx);
+                               apply_magic(q_ptr, current_floor_ptr->dun_level, AM_NO_FIXED_ART | AM_GOOD | AM_GREAT);
+                               break;
+                       }
+                       /* Apply special magic, but first clear object */
+                       case 's': case 'S':
+                       {
+                               object_prep(q_ptr, o_ptr->k_idx);
+                               apply_magic(q_ptr, current_floor_ptr->dun_level, AM_GOOD | AM_GREAT | AM_SPECIAL);
 
-                       /* Failed to create artifact; make a random one */
-                       if (!object_is_artifact(q_ptr)) become_random_artifact(owner_ptr, q_ptr, FALSE);
-                       break;
-               }
+                               /* Failed to create artifact; make a random one */
+                               if (!object_is_artifact(q_ptr)) create_artifact(q_ptr, FALSE);
+                               break;
+                       }
                }
-
                q_ptr->iy = o_ptr->iy;
                q_ptr->ix = o_ptr->ix;
                q_ptr->next_o_idx = o_ptr->next_o_idx;
                q_ptr->marked = o_ptr->marked;
        }
 
+
        /* Notice change */
        if (changed)
        {
+               /* Apply changes */
                object_copy(o_ptr, q_ptr);
-               owner_ptr->update |= (PU_BONUS);
-               owner_ptr->update |= (PU_COMBINE | PU_REORDER);
-               owner_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
+               p_ptr->update |= (PU_BONUS);
+               p_ptr->update |= (PU_COMBINE | PU_REORDER);
+
+               p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
        }
 }
 
 
+
 /*!
  * @brief 検査対象のアイテムを基準とした生成テストを行う /
  * Try to create an item again. Output some statistics.    -Bernd-
- * @param caster_ptr プレーヤーへの参照ポインタ
  * @param o_ptr 生成テストの基準となるアイテム情報の参照ポインタ
  * @return なし
  * The statistics are correct now.  We acquire a clean grid, and then
@@ -954,30 +902,37 @@ static void wiz_reroll_item(player_type *owner_ptr, object_type *o_ptr)
  * counter flags to prevent weirdness.  We use the items to collect
  * statistics on item creation relative to the initial item.
  */
-static void wiz_statistics(player_type *caster_ptr, object_type *o_ptr)
+static void wiz_statistics(object_type *o_ptr)
 {
+       u32b i, matches, better, worse, other, correct;
+
+       u32b test_roll = 1000000;
+
+       char ch;
+       concptr quality;
+
+       BIT_FLAGS mode;
+
        object_type forge;
        object_type     *q_ptr;
 
        concptr q = "Rolls: %ld  Correct: %ld  Matches: %ld  Better: %ld  Worse: %ld  Other: %ld";
+
        concptr p = "Enter number of items to roll: ";
        char tmp_val[80];
 
+
        /* Mega-Hack -- allow multiple artifacts */
        if (object_is_fixed_artifact(o_ptr)) a_info[o_ptr->name1].cur_num = 0;
 
+
        /* Interact */
-       u32b i, matches, better, worse, other, correct;
-       u32b test_roll = 1000000;
-       char ch;
-       concptr quality;
-       BIT_FLAGS mode;
        while (TRUE)
        {
                concptr pmt = "Roll for [n]ormal, [g]ood, or [e]xcellent treasure? ";
 
                /* Display item */
-               wiz_display_item(caster_ptr, o_ptr);
+               wiz_display_item(o_ptr);
 
                /* Get choices */
                if (!get_com(pmt, &ch, FALSE)) break;
@@ -1008,7 +963,7 @@ static void wiz_statistics(player_type *caster_ptr, object_type *o_ptr)
 
                /* Let us know what we are doing */
                msg_format("Creating a lot of %s items. Base level = %d.",
-                       quality, caster_ptr->current_floor_ptr->dun_level);
+                                         quality, current_floor_ptr->dun_level);
                msg_print(NULL);
 
                /* Set counters to zero */
@@ -1038,7 +993,7 @@ static void wiz_statistics(player_type *caster_ptr, object_type *o_ptr)
                        object_wipe(q_ptr);
 
                        /* Create an object */
-                       make_object(caster_ptr, q_ptr, mode);
+                       make_object(q_ptr, mode);
 
 
                        /* Mega-Hack -- allow multiple artifacts */
@@ -1054,28 +1009,28 @@ static void wiz_statistics(player_type *caster_ptr, object_type *o_ptr)
 
                        /* Check for match */
                        if ((q_ptr->pval == o_ptr->pval) &&
-                               (q_ptr->to_a == o_ptr->to_a) &&
-                               (q_ptr->to_h == o_ptr->to_h) &&
-                               (q_ptr->to_d == o_ptr->to_d) &&
-                               (q_ptr->name1 == o_ptr->name1))
+                                (q_ptr->to_a == o_ptr->to_a) &&
+                                (q_ptr->to_h == o_ptr->to_h) &&
+                                (q_ptr->to_d == o_ptr->to_d) &&
+                                (q_ptr->name1 == o_ptr->name1))
                        {
                                matches++;
                        }
 
                        /* Check for better */
                        else if ((q_ptr->pval >= o_ptr->pval) &&
-                               (q_ptr->to_a >= o_ptr->to_a) &&
-                               (q_ptr->to_h >= o_ptr->to_h) &&
-                               (q_ptr->to_d >= o_ptr->to_d))
+                                               (q_ptr->to_a >= o_ptr->to_a) &&
+                                               (q_ptr->to_h >= o_ptr->to_h) &&
+                                               (q_ptr->to_d >= o_ptr->to_d))
                        {
                                better++;
                        }
 
                        /* Check for worse */
                        else if ((q_ptr->pval <= o_ptr->pval) &&
-                               (q_ptr->to_a <= o_ptr->to_a) &&
-                               (q_ptr->to_h <= o_ptr->to_h) &&
-                               (q_ptr->to_d <= o_ptr->to_d))
+                                               (q_ptr->to_a <= o_ptr->to_a) &&
+                                               (q_ptr->to_h <= o_ptr->to_h) &&
+                                               (q_ptr->to_d <= o_ptr->to_d))
                        {
                                worse++;
                        }
@@ -1092,6 +1047,7 @@ static void wiz_statistics(player_type *caster_ptr, object_type *o_ptr)
                msg_print(NULL);
        }
 
+
        /* Hack -- Normally only make a single artifact */
        if (object_is_fixed_artifact(o_ptr)) a_info[o_ptr->name1].cur_num = 1;
 }
@@ -1100,32 +1056,35 @@ static void wiz_statistics(player_type *caster_ptr, object_type *o_ptr)
 /*!
  * @brief 検査対象のアイテムの数を変更する /
  * Change the quantity of a the item
- * @param caster_ptr プレーヤーへの参照ポインタ
  * @param o_ptr 変更するアイテム情報構造体の参照ポインタ
  * @return なし
  */
 static void wiz_quantity_item(object_type *o_ptr)
 {
+       int         tmp_int, tmp_qnt;
+
+       char        tmp_val[100];
+
+
        /* Never duplicate artifacts */
        if (object_is_artifact(o_ptr)) return;
 
        /* Store old quantity. -LM- */
-       int tmp_qnt = o_ptr->number;
+       tmp_qnt = o_ptr->number;
 
        /* Default */
-       char tmp_val[100];
        sprintf(tmp_val, "%d", (int)o_ptr->number);
 
        /* Query */
        if (get_string("Quantity: ", tmp_val, 2))
        {
                /* Extract */
-               int tmp_int = atoi(tmp_val);
+               tmp_int = atoi(tmp_val);
                if (tmp_int < 1) tmp_int = 1;
                if (tmp_int > 99) tmp_int = 99;
 
                /* Accept modifications */
-               o_ptr->number = (byte)tmp_int;
+               o_ptr->number = (byte_hack)tmp_int;
        }
 
        if (o_ptr->tval == TV_ROD)
@@ -1134,33 +1093,32 @@ static void wiz_quantity_item(object_type *o_ptr)
        }
 }
 
-
 /*!
  * @brief 青魔導師の魔法を全て習得済みにする /
  * debug command for blue mage
  * @return なし
  */
-static void do_cmd_wiz_blue_mage(player_type *caster_ptr)
+static void do_cmd_wiz_blue_mage(void)
 {
+       int i = 0;
+       int j = 0;
        BIT_FLAGS f4 = 0L, f5 = 0L, f6 = 0L;
-       for (int j = 1; j < A_MAX; j++)
+
+       for (j = 1; j < A_MAX; j++)
        {
                set_rf_masks(&f4, &f5, &f6, j);
 
-               int i;
                for (i = 0; i < 32; i++)
                {
-                       if ((0x00000001 << i) & f4) caster_ptr->magic_num2[i] = 1;
+                       if ((0x00000001 << i) & f4) p_ptr->magic_num2[i] = 1;
                }
-
                for (; i < 64; i++)
                {
-                       if ((0x00000001 << (i - 32)) & f5) caster_ptr->magic_num2[i] = 1;
+                       if ((0x00000001 << (i - 32)) & f5) p_ptr->magic_num2[i] = 1;
                }
-
                for (; i < 96; i++)
                {
-                       if ((0x00000001 << (i - 64)) & f6) caster_ptr->magic_num2[i] = 1;
+                       if ((0x00000001 << (i - 64)) & f6) p_ptr->magic_num2[i] = 1;
                }
        }
 }
@@ -1170,37 +1128,43 @@ static void do_cmd_wiz_blue_mage(player_type *caster_ptr)
  * @brief アイテム検査のメインルーチン /
  * Play with an item. Options include:
  * @return なし
- * @details
+ * @details 
  *   - Output statistics (via wiz_roll_item)<br>
  *   - Reroll item (via wiz_reroll_item)<br>
  *   - Change properties (via wiz_tweak_item)<br>
  *   - Change the number of items (via wiz_quantity_item)<br>
  */
-static void do_cmd_wiz_play(player_type *creature_ptr)
+static void do_cmd_wiz_play(void)
 {
-       concptr q = "Play with which object? ";
-       concptr s = "You have nothing to play with.";
-
        OBJECT_IDX item;
+       object_type     forge;
+       object_type *q_ptr;
        object_type *o_ptr;
-       o_ptr = choose_object(creature_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
+       char ch;
+       bool changed;
+       concptr q, s;
+
+       q = "Play with which object? ";
+       s = "You have nothing to play with.";
+
+       o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
 
        if (!o_ptr) return;
+       
+       /* The item was not changed */
+       changed = FALSE;
 
-       screen_save(creature_ptr);
+       screen_save();
 
-       object_type     forge;
-       object_type *q_ptr;
        q_ptr = &forge;
        object_copy(q_ptr, o_ptr);
 
+
        /* The main loop */
-       char ch;
-       bool changed = FALSE;
        while (TRUE)
        {
                /* Display the item */
-               wiz_display_item(creature_ptr, q_ptr);
+               wiz_display_item(q_ptr);
 
                /* Get choice */
                if (!get_com("[a]ccept [s]tatistics [r]eroll [t]weak [q]uantity? ", &ch, FALSE))
@@ -1217,17 +1181,17 @@ static void do_cmd_wiz_play(player_type *creature_ptr)
 
                if (ch == 's' || ch == 'S')
                {
-                       wiz_statistics(creature_ptr, q_ptr);
+                       wiz_statistics(q_ptr);
                }
 
                if (ch == 'r' || ch == 'r')
                {
-                       wiz_reroll_item(creature_ptr, q_ptr);
+                       wiz_reroll_item(q_ptr);
                }
 
                if (ch == 't' || ch == 'T')
                {
-                       wiz_tweak_item(creature_ptr, q_ptr);
+                       wiz_tweak_item(q_ptr);
                }
 
                if (ch == 'q' || ch == 'Q')
@@ -1236,7 +1200,8 @@ static void do_cmd_wiz_play(player_type *creature_ptr)
                }
        }
 
-       screen_load(creature_ptr);
+       screen_load();
+
 
        /* Accept change */
        if (changed)
@@ -1246,17 +1211,17 @@ static void do_cmd_wiz_play(player_type *creature_ptr)
                /* Recalcurate object's weight */
                if (item >= 0)
                {
-                       creature_ptr->total_weight += (q_ptr->weight * q_ptr->number)
+                       p_ptr->total_weight += (q_ptr->weight * q_ptr->number)
                                - (o_ptr->weight * o_ptr->number);
                }
 
                /* Change */
                object_copy(o_ptr, q_ptr);
 
-               creature_ptr->update |= (PU_BONUS);
-               creature_ptr->update |= (PU_COMBINE | PU_REORDER);
+               p_ptr->update |= (PU_BONUS);
+               p_ptr->update |= (PU_COMBINE | PU_REORDER);
 
-               creature_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
+               p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
        }
 
        /* Ignore change */
@@ -1279,14 +1244,18 @@ static void do_cmd_wiz_play(player_type *creature_ptr)
  * Hack -- this routine always makes a "dungeon object", and applies
  * magic to it, and attempts to decline cursed items.
  */
-static void wiz_create_item(player_type *caster_ptr)
+static void wiz_create_item(void)
 {
-       screen_save(caster_ptr);
+       object_type     forge;
+       object_type *q_ptr;
+
+       OBJECT_IDX k_idx;
+       screen_save();
 
        /* Get object base type */
-       OBJECT_IDX k_idx = wiz_create_itemtype();
+       k_idx = wiz_create_itemtype();
 
-       screen_load(caster_ptr);
+       screen_load();
 
        /* Return if failed */
        if (!k_idx) return;
@@ -1305,7 +1274,7 @@ static void wiz_create_item(player_type *caster_ptr)
                        if (a_info[i].sval != k_info[k_idx].sval) continue;
 
                        /* Create this artifact */
-                       (void)create_named_art(caster_ptr, i, caster_ptr->y, caster_ptr->x);
+                       (void)create_named_art(i, p_ptr->y, p_ptr->x);
 
                        /* All done */
                        msg_print("Allocated(INSTA_ART).");
@@ -1313,16 +1282,13 @@ static void wiz_create_item(player_type *caster_ptr)
                        return;
                }
        }
-
-       object_type     forge;
-       object_type *q_ptr;
        q_ptr = &forge;
        object_prep(q_ptr, k_idx);
 
-       apply_magic(caster_ptr, q_ptr, caster_ptr->current_floor_ptr->dun_level, AM_NO_FIXED_ART);
+       apply_magic(q_ptr, current_floor_ptr->dun_level, AM_NO_FIXED_ART);
 
        /* Drop the object from heaven */
-       (void)drop_near(caster_ptr, q_ptr, -1, caster_ptr->y, caster_ptr->x);
+       (void)drop_near(q_ptr, -1, p_ptr->y, p_ptr->x);
 
        /* All done */
        msg_print("Allocated.");
@@ -1334,11 +1300,11 @@ static void wiz_create_item(player_type *caster_ptr)
  * Cure everything instantly
  * @return なし
  */
-static void do_cmd_wiz_cure_all(player_type *creature_ptr)
+static void do_cmd_wiz_cure_all(void)
 {
-       (void)life_stream(creature_ptr, FALSE, FALSE);
-       (void)restore_mana(creature_ptr, TRUE);
-       (void)set_food(creature_ptr, PY_FOOD_MAX - 1);
+       (void)life_stream(FALSE, FALSE);
+       (void)restore_mana(TRUE);
+       (void)set_food(PY_FOOD_MAX - 1);
 }
 
 
@@ -1347,7 +1313,7 @@ static void do_cmd_wiz_cure_all(player_type *creature_ptr)
  * Go to any level
  * @return なし
  */
-static void do_cmd_wiz_jump(player_type *creature_ptr)
+static void do_cmd_wiz_jump(void)
 {
        /* Ask for level */
        if (command_arg <= 0)
@@ -1360,20 +1326,20 @@ static void do_cmd_wiz_jump(player_type *creature_ptr)
                sprintf(ppp, "Jump which dungeon : ");
 
                /* Default */
-               sprintf(tmp_val, "%d", creature_ptr->dungeon_idx);
+               sprintf(tmp_val, "%d", p_ptr->dungeon_idx);
 
                /* Ask for a level */
                if (!get_string(ppp, tmp_val, 2)) return;
 
                tmp_dungeon_type = (DUNGEON_IDX)atoi(tmp_val);
-               if (!d_info[tmp_dungeon_type].maxdepth || (tmp_dungeon_type > current_world_ptr->max_d_idx)) tmp_dungeon_type = DUNGEON_ANGBAND;
+               if (!d_info[tmp_dungeon_type].maxdepth || (tmp_dungeon_type > max_d_idx)) tmp_dungeon_type = DUNGEON_ANGBAND;
 
                /* Prompt */
                sprintf(ppp, "Jump to level (0, %d-%d): ",
                        (int)d_info[tmp_dungeon_type].mindepth, (int)d_info[tmp_dungeon_type].maxdepth);
 
                /* Default */
-               sprintf(tmp_val, "%d", (int)creature_ptr->current_floor_ptr->dun_level);
+               sprintf(tmp_val, "%d", (int)current_floor_ptr->dun_level);
 
                /* Ask for a level */
                if (!get_string(ppp, tmp_val, 10)) return;
@@ -1381,57 +1347,58 @@ static void do_cmd_wiz_jump(player_type *creature_ptr)
                /* Extract request */
                command_arg = (COMMAND_ARG)atoi(tmp_val);
 
-               creature_ptr->dungeon_idx = tmp_dungeon_type;
+               p_ptr->dungeon_idx = tmp_dungeon_type;
        }
-
-       if (command_arg < d_info[creature_ptr->dungeon_idx].mindepth) command_arg = 0;
-       if (command_arg > d_info[creature_ptr->dungeon_idx].maxdepth) command_arg = (COMMAND_ARG)d_info[creature_ptr->dungeon_idx].maxdepth;
+       if (command_arg < d_info[p_ptr->dungeon_idx].mindepth) command_arg = 0;
+       if (command_arg > d_info[p_ptr->dungeon_idx].maxdepth) command_arg = (COMMAND_ARG)d_info[p_ptr->dungeon_idx].maxdepth;
 
        /* Accept request */
        msg_format("You jump to dungeon level %d.", command_arg);
 
-       if (autosave_l) do_cmd_save_game(creature_ptr, TRUE);
+       if (autosave_l) do_cmd_save_game(TRUE);
 
        /* Change level */
-       creature_ptr->current_floor_ptr->dun_level = command_arg;
+       current_floor_ptr->dun_level = command_arg;
 
-       prepare_change_floor_mode(creature_ptr, CFM_RAND_PLACE);
+       prepare_change_floor_mode(CFM_RAND_PLACE);
 
-       if (!creature_ptr->current_floor_ptr->dun_level) creature_ptr->dungeon_idx = 0;
-       creature_ptr->current_floor_ptr->inside_arena = FALSE;
-       creature_ptr->wild_mode = FALSE;
+       if (!current_floor_ptr->dun_level) p_ptr->dungeon_idx = 0;
+       p_ptr->inside_arena = FALSE;
+       p_ptr->wild_mode = FALSE;
 
-       leave_quest_check(creature_ptr);
+       leave_quest_check();
 
-       if (record_stair) exe_write_diary(creature_ptr, DIARY_WIZ_TELE, 0, NULL);
+       if (record_stair) do_cmd_write_nikki(NIKKI_WIZ_TELE,0,NULL);
 
-       creature_ptr->current_floor_ptr->inside_quest = 0;
-       free_turn(creature_ptr);
+       p_ptr->inside_quest = 0;
+       free_turn(p_ptr);
 
        /* Prevent energy_need from being too lower than 0 */
-       creature_ptr->energy_need = 0;
+       p_ptr->energy_need = 0;
 
        /*
         * Clear all saved floors
         * and create a first saved floor
         */
-       prepare_change_floor_mode(creature_ptr, CFM_FIRST_FLOOR);
-       creature_ptr->leaving = TRUE;
+       prepare_change_floor_mode(CFM_FIRST_FLOOR);
+       p_ptr->leaving = TRUE;
 }
 
 
 /*!
  * @brief 全ベースアイテムを鑑定済みにする /
  * Become aware of a lot of objects
- * @param caster_ptr プレーヤーへの参照ポインタ
  * @return なし
  */
-static void do_cmd_wiz_learn(player_type *caster_ptr)
+static void do_cmd_wiz_learn(void)
 {
-       /* Scan every object */
+       KIND_OBJECT_IDX i;
+
        object_type forge;
        object_type *q_ptr;
-       for (KIND_OBJECT_IDX i = 1; i < max_k_idx; i++)
+
+       /* Scan every object */
+       for (i = 1; i < max_k_idx; i++)
        {
                object_kind *k_ptr = &k_info[i];
 
@@ -1440,7 +1407,7 @@ static void do_cmd_wiz_learn(player_type *caster_ptr)
                {
                        q_ptr = &forge;
                        object_prep(q_ptr, i);
-                       object_aware(caster_ptr, q_ptr);
+                       object_aware(q_ptr);
                }
        }
 }
@@ -1449,19 +1416,20 @@ static void do_cmd_wiz_learn(player_type *caster_ptr)
 /*!
  * @brief 現在のフロアに合ったモンスターをランダムに召喚する /
  * Summon some creatures
- * @param caster_ptr プレーヤーへの参照ポインタ
  * @param num 生成処理回数
  * @return なし
  */
-static void do_cmd_wiz_summon(player_type *caster_ptr, int num)
+static void do_cmd_wiz_summon(int num)
 {
-       for (int i = 0; i < num; i++)
+       int i;
+       for (i = 0; i < num; i++)
        {
-               (void)summon_specific(caster_ptr, 0, caster_ptr->y, caster_ptr->x, caster_ptr->current_floor_ptr->dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
+               (void)summon_specific(0, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE), '\0');
        }
 }
 
 
+
 /*!
  * @brief モンスターを種族IDを指定して敵対的に召喚する /
  * Summon a creature of the specified type
@@ -1470,9 +1438,9 @@ static void do_cmd_wiz_summon(player_type *caster_ptr, int num)
  * @details
  * This function is rather dangerous
  */
-static void do_cmd_wiz_named(player_type *summoner_ptr, MONRACE_IDX r_idx)
+static void do_cmd_wiz_named(MONRACE_IDX r_idx)
 {
-       (void)summon_named_creature(summoner_ptr, 0, summoner_ptr->y, summoner_ptr->x, r_idx, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
+       (void)summon_named_creature(0, p_ptr->y, p_ptr->x, r_idx, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
 }
 
 
@@ -1484,40 +1452,44 @@ static void do_cmd_wiz_named(player_type *summoner_ptr, MONRACE_IDX r_idx)
  * @details
  * This function is rather dangerous
  */
-static void do_cmd_wiz_named_friendly(player_type *summoner_ptr, MONRACE_IDX r_idx)
+static void do_cmd_wiz_named_friendly(MONRACE_IDX r_idx)
 {
-       (void)summon_named_creature(summoner_ptr, 0, summoner_ptr->y, summoner_ptr->x, r_idx, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP | PM_FORCE_PET));
+       (void)summon_named_creature(0, p_ptr->y, p_ptr->x, r_idx, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP | PM_FORCE_PET));
 }
 
 
+
 /*!
  * @brief プレイヤー近辺の全モンスターを消去する /
  * Hack -- Delete all nearby monsters
  * @return なし
  */
-static void do_cmd_wiz_zap(player_type *caster_ptr)
+static void do_cmd_wiz_zap(void)
 {
+       MONSTER_IDX i;
+
        /* Genocide everyone nearby */
-       for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
+       for (i = 1; i < m_max; i++)
        {
-               monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
+               monster_type *m_ptr = &current_floor_ptr->m_list[i];
                if (!monster_is_valid(m_ptr)) continue;
 
                /* Skip the mount */
-               if (i == caster_ptr->riding) continue;
+               if (i == p_ptr->riding) continue;
 
                /* Delete nearby monsters */
-               if (m_ptr->cdis > MAX_SIGHT) continue;
-
-               if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
+               if (m_ptr->cdis <= MAX_SIGHT)
                {
-                       GAME_TEXT m_name[MAX_NLEN];
+                       if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
+                       {
+                               GAME_TEXT m_name[MAX_NLEN];
 
-                       monster_desc(caster_ptr, m_name, m_ptr, MD_INDEF_VISIBLE);
-                       exe_write_diary(caster_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_WIZ_ZAP, m_name);
-               }
+                               monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
+                               do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_WIZ_ZAP, m_name);
+                       }
 
-               delete_monster_idx(caster_ptr, i);
+                       delete_monster_idx(i);
+               }
        }
 }
 
@@ -1525,30 +1497,31 @@ static void do_cmd_wiz_zap(player_type *caster_ptr)
 /*!
  * @brief フロアに存在する全モンスターを消去する /
  * Hack -- Delete all monsters
- * @param caster_ptr 術者の参照ポインタ
  * @return なし
  */
-static void do_cmd_wiz_zap_all(player_type *caster_ptr)
+static void do_cmd_wiz_zap_all(void)
 {
+       MONSTER_IDX i;
+
        /* Genocide everyone */
-       for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
+       for (i = 1; i < m_max; i++)
        {
-               monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
+               monster_type *m_ptr = &current_floor_ptr->m_list[i];
                if (!monster_is_valid(m_ptr)) continue;
 
                /* Skip the mount */
-               if (i == caster_ptr->riding) continue;
+               if (i == p_ptr->riding) continue;
 
                if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
                {
                        GAME_TEXT m_name[MAX_NLEN];
 
-                       monster_desc(caster_ptr, m_name, m_ptr, MD_INDEF_VISIBLE);
-                       exe_write_diary(caster_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_WIZ_ZAP, m_name);
+                       monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
+                       do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_WIZ_ZAP, m_name);
                }
 
                /* Delete this monster */
-               delete_monster_idx(caster_ptr, i);
+               delete_monster_idx(i);
        }
 }
 
@@ -1556,77 +1529,86 @@ static void do_cmd_wiz_zap_all(player_type *caster_ptr)
 /*!
  * @brief 指定された地点の地形IDを変更する /
  * Create desired feature
- * @param creaturer_ptr プレーヤーへの参照ポインタ
  * @return なし
  */
-static void do_cmd_wiz_create_feature(player_type *creature_ptr)
+static void do_cmd_wiz_create_feature(void)
 {
+       static int   prev_feat = 0;
+       static int   prev_mimic = 0;
+       grid_type    *g_ptr;
+       feature_type *f_ptr;
+       char         tmp_val[160];
+       IDX          tmp_feat, tmp_mimic;
        POSITION y, x;
-       if (!tgt_pt(creature_ptr, &x, &y)) return;
 
-       grid_type *g_ptr;
-       g_ptr = &creature_ptr->current_floor_ptr->grid_array[y][x];
+       if (!tgt_pt(&x, &y)) return;
+
+       g_ptr = &current_floor_ptr->grid_array[y][x];
 
        /* Default */
-       static int prev_feat = 0;
-       char tmp_val[160];
        sprintf(tmp_val, "%d", prev_feat);
 
        /* Query */
        if (!get_string(_("地形: ", "Feature: "), tmp_val, 3)) return;
 
        /* Extract */
-       FEAT_IDX tmp_feat = (FEAT_IDX)atoi(tmp_val);
+       tmp_feat = (IDX)atoi(tmp_val);
        if (tmp_feat < 0) tmp_feat = 0;
        else if (tmp_feat >= max_f_idx) tmp_feat = max_f_idx - 1;
 
        /* Default */
-       static int prev_mimic = 0;
        sprintf(tmp_val, "%d", prev_mimic);
 
        /* Query */
        if (!get_string(_("地形 (mimic): ", "Feature (mimic): "), tmp_val, 3)) return;
 
        /* Extract */
-       FEAT_IDX tmp_mimic = (FEAT_IDX)atoi(tmp_val);
+       tmp_mimic = (IDX)atoi(tmp_val);
        if (tmp_mimic < 0) tmp_mimic = 0;
        else if (tmp_mimic >= max_f_idx) tmp_mimic = max_f_idx - 1;
 
-       cave_set_feat(creature_ptr, y, x, tmp_feat);
+       cave_set_feat(y, x, tmp_feat);
        g_ptr->mimic = (s16b)tmp_mimic;
 
-       feature_type *f_ptr;
        f_ptr = &f_info[get_feat_mimic(g_ptr)];
 
        if (have_flag(f_ptr->flags, FF_GLYPH) ||
-               have_flag(f_ptr->flags, FF_MINOR_GLYPH))
+           have_flag(f_ptr->flags, FF_MINOR_GLYPH))
                g_ptr->info |= (CAVE_OBJECT);
        else if (have_flag(f_ptr->flags, FF_MIRROR))
                g_ptr->info |= (CAVE_GLOW | CAVE_OBJECT);
 
-       note_spot(creature_ptr, y, x);
-       lite_spot(creature_ptr, y, x);
-       creature_ptr->update |= (PU_FLOW);
+       note_spot(y, x);
+       lite_spot(y, x);
+       p_ptr->update |= (PU_FLOW);
 
        prev_feat = tmp_feat;
        prev_mimic = tmp_mimic;
 }
 
 
+#define NUM_O_SET 8
+#define NUM_O_BIT 32
+
 /*!
  * @brief 現在のオプション設定をダンプ出力する /
- * @param creature_ptr プレーヤーへの参照ポインタ
  * Hack -- Dump option bits usage
  * @return なし
  */
-static void do_cmd_dump_options()
+static void do_cmd_dump_options(void)
 {
+       int  i, j;
+       FILE *fff;
        char buf[1024];
+       int  **exist;
+
+       /* Build the filename */
        path_build(buf, sizeof buf, ANGBAND_DIR_USER, "opt_info.txt");
 
        /* File type is "TEXT" */
-       FILE *fff;
        FILE_TYPE(FILE_TYPE_TEXT);
+
+       /* Open the file */
        fff = my_fopen(buf, "a");
 
        if (!fff)
@@ -1637,41 +1619,38 @@ static void do_cmd_dump_options()
        }
 
        /* Allocate the "exist" array (2-dimension) */
-       int  **exist;
        C_MAKE(exist, NUM_O_SET, int *);
        C_MAKE(*exist, NUM_O_BIT * NUM_O_SET, int);
-       for (int i = 1; i < NUM_O_SET; i++) exist[i] = *exist + i * NUM_O_BIT;
+       for (i = 1; i < NUM_O_SET; i++) exist[i] = *exist + i * NUM_O_BIT;
 
        /* Check for exist option bits */
-       for (int i = 0; option_info[i].o_desc; i++)
+       for (i = 0; option_info[i].o_desc; i++)
        {
                const option_type *ot_ptr = &option_info[i];
                if (ot_ptr->o_var) exist[ot_ptr->o_set][ot_ptr->o_bit] = i + 1;
        }
 
        fprintf(fff, "[Option bits usage on Hengband %d.%d.%d]\n\n",
-               FAKE_VER_MAJOR - 10, FAKE_VER_MINOR, FAKE_VER_PATCH);
+               FAKE_VER_MAJOR - 10, FAKE_VER_MINOR, FAKE_VER_PATCH);
 
        fputs("Set - Bit (Page) Option Name\n", fff);
        fputs("------------------------------------------------\n", fff);
-
        /* Dump option bits usage */
-       for (int i = 0; i < NUM_O_SET; i++)
+       for (i = 0; i < NUM_O_SET; i++)
        {
-               for (int j = 0; j < NUM_O_BIT; j++)
+               for (j = 0; j < NUM_O_BIT; j++)
                {
                        if (exist[i][j])
                        {
                                const option_type *ot_ptr = &option_info[exist[i][j] - 1];
                                fprintf(fff, "  %d -  %02d (%4d) %s\n",
-                                       i, j, ot_ptr->o_page, ot_ptr->o_text);
+                                       i, j, ot_ptr->o_page, ot_ptr->o_text);
                        }
                        else
                        {
                                fprintf(fff, "  %d -  %02d\n", i, j);
                        }
                }
-
                fputc('\n', fff);
        }
 
@@ -1684,208 +1663,233 @@ static void do_cmd_dump_options()
 }
 
 
+#ifdef ALLOW_SPOILERS
+
+/*
+ * External function
+ */
+extern void do_cmd_spoilers(void);
+
+#endif /* ALLOW_SPOILERS */
+
+
+
+/*
+ * Hack -- declare external function
+ */
+extern void do_cmd_debug(void);
+
+
+
 /*!
  * @brief デバッグコマンドを選択する処理のメインルーチン /
  * Ask for and parse a "debug command"
  * The "command_arg" may have been set.
- * @param creature_ptr プレーヤーへの参照ポインタ
  * @return なし
  */
-void do_cmd_debug(player_type *creature_ptr)
+void do_cmd_debug(void)
 {
-       char cmd;
+       int     x, y;
+       char    cmd;
+
+       /* Get a "debug command" */
        get_com("Debug Command: ", &cmd, FALSE);
 
+       /* Analyze the command */
        switch (cmd)
        {
+       /* Nothing */
        case ESCAPE:
        case ' ':
        case '\n':
        case '\r':
                break;
 
-               /* Hack -- Generate Spoilers */
+#ifdef ALLOW_SPOILERS
+
+       /* Hack -- Generate Spoilers */
        case '"':
-               do_cmd_spoilers(creature_ptr);
+               do_cmd_spoilers();
                break;
 
-               /* Hack -- Help */
+#endif /* ALLOW_SPOILERS */
+
+       /* Hack -- Help */
        case '?':
-               do_cmd_help(creature_ptr);
+               do_cmd_help();
                break;
 
-               /* Cure all maladies */
+       /* Cure all maladies */
        case 'a':
-               do_cmd_wiz_cure_all(creature_ptr);
+               do_cmd_wiz_cure_all();
                break;
 
-               /* Know alignment */
+       /* Know alignment */
        case 'A':
-               msg_format("Your alignment is %d.", creature_ptr->align);
+               msg_format("Your alignment is %d.", p_ptr->align);
                break;
 
-               /* Teleport to target */
+       /* Teleport to target */
        case 'b':
-               do_cmd_wiz_bamf(creature_ptr);
+               do_cmd_wiz_bamf();
                break;
 
        case 'B':
-               update_gambling_monsters(creature_ptr);
+               battle_monsters();
                break;
 
-               /* Create any object */
+       /* Create any object */
        case 'c':
-               wiz_create_item(creature_ptr);
+               wiz_create_item();
                break;
 
-               /* Create a named artifact */
+       /* Create a named artifact */
        case 'C':
-               wiz_create_named_art(creature_ptr);
+               wiz_create_named_art();
                break;
 
-               /* Detect everything */
+       /* Detect everything */
        case 'd':
-               detect_all(creature_ptr, DETECT_RAD_ALL * 3);
+               detect_all(DETECT_RAD_ALL * 3);
                break;
 
-               /* Dimension_door */
+       /* Dimension_door */
        case 'D':
-               wiz_dimension_door(creature_ptr);
+               wiz_dimension_door();
                break;
 
-               /* Edit character */
+       /* Edit character */
        case 'e':
-               do_cmd_wiz_change(creature_ptr);
+               do_cmd_wiz_change();
                break;
 
-               /* Blue Mage Only */
+       /* Blue Mage Only */
        case 'E':
-               if (creature_ptr->pclass == CLASS_BLUE_MAGE)
+               if (p_ptr->pclass == CLASS_BLUE_MAGE)
                {
-                       do_cmd_wiz_blue_mage(creature_ptr);
+                       do_cmd_wiz_blue_mage();
                }
                break;
 
-               /* View item info */
+       /* View item info */
        case 'f':
-               identify_fully(creature_ptr, FALSE, 0);
+               identify_fully(FALSE);
                break;
 
-               /* Create desired feature */
+       /* Create desired feature */
        case 'F':
-               do_cmd_wiz_create_feature(creature_ptr);
+               do_cmd_wiz_create_feature();
                break;
 
-               /* Good Objects */
+       /* Good Objects */
        case 'g':
                if (command_arg <= 0) command_arg = 1;
-               acquirement(creature_ptr, creature_ptr->y, creature_ptr->x, command_arg, FALSE, FALSE, TRUE);
+               acquirement(p_ptr->y, p_ptr->x, command_arg, FALSE, FALSE, TRUE);
                break;
 
-               /* Hitpoint rerating */
+       /* Hitpoint rerating */
        case 'h':
-               roll_hitdice(creature_ptr, SPOP_DISPLAY_MES | SPOP_DEBUG);
+               roll_hitdice(p_ptr, SPOP_DISPLAY_MES | SPOP_DEBUG);
                break;
 
        case 'H':
-               do_cmd_summon_horde(creature_ptr);
+               do_cmd_summon_horde();
                break;
 
-               /* Identify */
+       /* Identify */
        case 'i':
-               (void)ident_spell(creature_ptr, FALSE, 0);
+               (void)ident_spell(FALSE);
                break;
 
-               /* Go up or down in the dungeon */
+       /* Go up or down in the dungeon */
        case 'j':
-               do_cmd_wiz_jump(creature_ptr);
+               do_cmd_wiz_jump();
                break;
 
-               /* Self-Knowledge */
+       /* Self-Knowledge */
        case 'k':
-               self_knowledge(creature_ptr);
+               self_knowledge();
                break;
 
-               /* Learn about objects */
+       /* Learn about objects */
        case 'l':
-               do_cmd_wiz_learn(creature_ptr);
+               do_cmd_wiz_learn();
                break;
 
-               /* Magic Mapping */
+       /* Magic Mapping */
        case 'm':
-               map_area(creature_ptr, DETECT_RAD_ALL * 3);
+               map_area(DETECT_RAD_ALL * 3);
                break;
 
-               /* Mutation */
+       /* Mutation */
        case 'M':
-               (void)gain_mutation(creature_ptr, command_arg);
+               (void)gain_mutation(p_ptr, command_arg);
                break;
 
-               /* Reset Class */
+       /* Reset Class */
        case 'R':
-               (void)do_cmd_wiz_reset_class(creature_ptr);
+               (void)do_cmd_wiz_reset_class();
                break;
 
-               /* Specific reward */
+       /* Specific reward */
        case 'r':
-               (void)gain_level_reward(creature_ptr, command_arg);
+               (void)gain_level_reward(command_arg);
                break;
 
-               /* Summon _friendly_ named monster */
+       /* Summon _friendly_ named monster */
        case 'N':
-               do_cmd_wiz_named_friendly(creature_ptr, command_arg);
+               do_cmd_wiz_named_friendly(command_arg);
                break;
 
-               /* Summon Named Monster */
+       /* Summon Named Monster */
        case 'n':
-               do_cmd_wiz_named(creature_ptr, command_arg);
+               do_cmd_wiz_named(command_arg);
                break;
 
-               /* Dump option bits usage */
+       /* Dump option bits usage */
        case 'O':
                do_cmd_dump_options();
                break;
 
-               /* Object playing routines */
+       /* Object playing routines */
        case 'o':
-               do_cmd_wiz_play(creature_ptr);
+               do_cmd_wiz_play();
                break;
 
-               /* Phase Door */
+       /* Phase Door */
        case 'p':
-               teleport_player(creature_ptr, 10, TELEPORT_SPONTANEOUS);
+               teleport_player(10, 0L);
                break;
 
-               /* Take a Quests */
+       /* Take a Quests */
        case 'Q':
-       {
-               char ppp[30];
-               char tmp_val[5];
-               int tmp_int;
-               sprintf(ppp, "QuestID (0-%d):", max_q_idx - 1);
-               sprintf(tmp_val, "%d", 0);
-
-               if (!get_string(ppp, tmp_val, 3)) return;
-               tmp_int = atoi(tmp_val);
+               {
+                       char ppp[30];
+                       char tmp_val[5];
+                       int tmp_int;
+                       sprintf(ppp, "QuestID (0-%d):", max_q_idx - 1);
+                       sprintf(tmp_val, "%d", 0);
 
-               if (tmp_int < 0) break;
-               if (tmp_int >= max_q_idx) break;
+                       if (!get_string(ppp, tmp_val, 3)) return;
+                       tmp_int = atoi(tmp_val);
 
-               creature_ptr->current_floor_ptr->inside_quest = (QUEST_IDX)tmp_int;
-               process_dungeon_file(creature_ptr, "q_info.txt", 0, 0, 0, 0);
-               quest[tmp_int].status = QUEST_STATUS_TAKEN;
-               creature_ptr->current_floor_ptr->inside_quest = 0;
-       }
+                       if(tmp_int < 0) break;
+                       if(tmp_int >= max_q_idx) break;
 
-       break;
+                       p_ptr->inside_quest = (QUEST_IDX)tmp_int;
+                       process_dungeon_file("q_info.txt", 0, 0, 0, 0);
+                       quest[tmp_int].status = QUEST_STATUS_TAKEN;
+                       p_ptr->inside_quest = 0;
+               }
+               break;
 
        /* Complete a Quest -KMW- */
        case 'q':
-               if (creature_ptr->current_floor_ptr->inside_quest)
+               if(p_ptr->inside_quest)
                {
-                       if (quest[creature_ptr->current_floor_ptr->inside_quest].status == QUEST_STATUS_TAKEN)
+                       if (quest[p_ptr->inside_quest].status == QUEST_STATUS_TAKEN)
                        {
-                               complete_quest(creature_ptr, creature_ptr->current_floor_ptr->inside_quest);
+                               complete_quest(p_ptr->inside_quest);
                                break;
                        }
                }
@@ -1894,97 +1898,206 @@ void do_cmd_debug(player_type *creature_ptr)
                        msg_print("No current quest");
                        msg_print(NULL);
                }
-
                break;
 
-               /* Make every dungeon square "known" to test streamers -KMW- */
+       /* Make every dungeon square "known" to test streamers -KMW- */
        case 'u':
-               for (int y = 0; y < creature_ptr->current_floor_ptr->height; y++)
+               for (y = 0; y < current_floor_ptr->height; y++)
                {
-                       for (int x = 0; x < creature_ptr->current_floor_ptr->width; x++)
+                       for (x = 0; x < current_floor_ptr->width; x++)
                        {
-                               creature_ptr->current_floor_ptr->grid_array[y][x].info |= (CAVE_GLOW | CAVE_MARK);
+                               current_floor_ptr->grid_array[y][x].info |= (CAVE_GLOW | CAVE_MARK);
                        }
                }
-
-               wiz_lite(creature_ptr, FALSE);
+               wiz_lite(FALSE);
                break;
 
-               /* Summon Random Monster(s) */
+       /* Summon Random Monster(s) */
        case 's':
                if (command_arg <= 0) command_arg = 1;
-               do_cmd_wiz_summon(creature_ptr, command_arg);
+               do_cmd_wiz_summon(command_arg);
                break;
 
-               /* Special(Random Artifact) Objects */
+       /* Special(Random Artifact) Objects */
        case 'S':
                if (command_arg <= 0) command_arg = 1;
-               acquirement(creature_ptr, creature_ptr->y, creature_ptr->x, command_arg, TRUE, TRUE, TRUE);
+               acquirement(p_ptr->y, p_ptr->x, command_arg, TRUE, TRUE, TRUE);
                break;
 
-               /* Teleport */
+       /* Teleport */
        case 't':
-               teleport_player(creature_ptr, 100, TELEPORT_SPONTANEOUS);
+               teleport_player(100, 0L);
                break;
 
-               /* Game Time Setting */
+       /* Game Time Setting */
        case 'T':
                set_gametime();
                break;
 
-               /* Very Good Objects */
+
+       /* Very Good Objects */
        case 'v':
                if (command_arg <= 0) command_arg = 1;
-               acquirement(creature_ptr, creature_ptr->y, creature_ptr->x, command_arg, TRUE, FALSE, TRUE);
+               acquirement(p_ptr->y, p_ptr->x, command_arg, TRUE, FALSE, TRUE);
                break;
 
-               /* Wizard Light the Level */
+       /* Wizard Light the Level */
        case 'w':
-               wiz_lite(creature_ptr, (bool)(creature_ptr->pclass == CLASS_NINJA));
+               wiz_lite((bool)(p_ptr->pclass == CLASS_NINJA));
                break;
 
-               /* Increase Experience */
+       /* Increase Experience */
        case 'x':
-               gain_exp(creature_ptr, command_arg ? command_arg : (creature_ptr->exp + 1));
+               gain_exp(command_arg ? command_arg : (p_ptr->exp + 1));
                break;
 
-               /* Zap Monsters (Genocide) */
+       /* Zap Monsters (Genocide) */
        case 'z':
-               do_cmd_wiz_zap(creature_ptr);
+               do_cmd_wiz_zap();
                break;
 
-               /* Zap Monsters (Omnicide) */
+       /* Zap Monsters (Omnicide) */
        case 'Z':
-               do_cmd_wiz_zap_all(creature_ptr);
+               do_cmd_wiz_zap_all();
                break;
 
-               /* Hack -- whatever I desire */
+       /* Hack -- whatever I desire */
        case '_':
-               probing(creature_ptr);
+               probing();
                break;
 
-               /* For temporary test. */
+       /* For temporary test. */
        case 'X':
        {
                INVENTORY_IDX i;
-               for (i = INVEN_TOTAL - 1; i >= 0; i--)
+               for(i = INVEN_TOTAL - 1; i >= 0; i--)
                {
-                       if (creature_ptr->inventory_list[i].k_idx) drop_from_inventory(creature_ptr, i, 999);
+                       if(inventory[i].k_idx) inven_drop(i, 999);
                }
-               player_outfit(creature_ptr);
+               player_outfit();
                break;
        }
 
        case 'V':
-               do_cmd_wiz_reset_class(creature_ptr);
-               break;
-
-       case '@':
-               do_cmd_debug_spell(creature_ptr);
+               do_cmd_wiz_reset_class();
                break;
 
+       /* Not a Wizard Command */
        default:
                msg_print("That is not a valid debug command.");
                break;
        }
 }
+
+void cheat_death(player_type *creature_ptr)
+{
+       /* Mark social class, reset age, if needed */
+       if (creature_ptr->sc) creature_ptr->sc = creature_ptr->age = 0;
+
+       /* Increase age */
+       creature_ptr->age++;
+
+       /* Mark savefile */
+       creature_ptr->noscore |= 0x0001;
+
+       msg_print(_("ウィザードモードに念を送り、死を欺いた。", "You invoke wizard mode and cheat death."));
+       msg_print(NULL);
+
+       (void)life_stream(FALSE, FALSE);
+
+       if (creature_ptr->pclass == CLASS_MAGIC_EATER)
+       {
+               int magic_idx;
+               for (magic_idx = 0; magic_idx < EATER_EXT * 2; magic_idx++)
+               {
+                       creature_ptr->magic_num1[magic_idx] = creature_ptr->magic_num2[magic_idx] * EATER_CHARGE;
+               }
+               for (; magic_idx < EATER_EXT * 3; magic_idx++)
+               {
+                       creature_ptr->magic_num1[magic_idx] = 0;
+               }
+       }
+
+       /* Restore spell points */
+       creature_ptr->csp = creature_ptr->msp;
+       creature_ptr->csp_frac = 0;
+
+       /* Hack -- cancel recall */
+       if (creature_ptr->word_recall)
+       {
+               msg_print(_("張りつめた大気が流れ去った...", "A tension leaves the air around you..."));
+               msg_print(NULL);
+
+               /* Hack -- Prevent recall */
+               creature_ptr->word_recall = 0;
+               creature_ptr->redraw |= (PR_STATUS);
+       }
+
+       /* Hack -- cancel alter */
+       if (creature_ptr->alter_reality)
+       {
+               /* Hack -- Prevent alter */
+               creature_ptr->alter_reality = 0;
+               creature_ptr->redraw |= (PR_STATUS);
+       }
+
+       /* Note cause of death */
+       (void)strcpy(creature_ptr->died_from, _("死の欺き", "Cheating death"));
+
+       /* Do not die */
+       creature_ptr->is_dead = FALSE;
+
+       /* Hack -- Prevent starvation */
+       (void)set_food(PY_FOOD_MAX - 1);
+
+       current_floor_ptr->dun_level = 0;
+       creature_ptr->inside_arena = FALSE;
+       creature_ptr->inside_battle = FALSE;
+       leaving_quest = 0;
+       creature_ptr->inside_quest = 0;
+       if (p_ptr->dungeon_idx) creature_ptr->recall_dungeon = p_ptr->dungeon_idx;
+       p_ptr->dungeon_idx = 0;
+       if (lite_town || vanilla_town)
+       {
+               creature_ptr->wilderness_y = 1;
+               creature_ptr->wilderness_x = 1;
+               if (vanilla_town)
+               {
+                       creature_ptr->oldpy = 10;
+                       creature_ptr->oldpx = 34;
+               }
+               else
+               {
+                       creature_ptr->oldpy = 33;
+                       creature_ptr->oldpx = 131;
+               }
+       }
+       else
+       {
+               creature_ptr->wilderness_y = 48;
+               creature_ptr->wilderness_x = 5;
+               creature_ptr->oldpy = 33;
+               creature_ptr->oldpx = 131;
+       }
+       creature_ptr->wild_mode = FALSE;
+       creature_ptr->leaving = TRUE;
+
+       do_cmd_write_nikki(NIKKI_BUNSHOU, 1,
+               _("                            しかし、生き返った。",
+                       "                            but revived."));
+
+       /* Prepare next floor */
+       leave_floor();
+       wipe_m_list();
+
+}
+
+
+#else
+
+#ifdef MACINTOSH
+static int i = 0;
+#endif
+
+#endif
+