OSDN Git Service

Implement allow_debug_opts. Fixed the bug that allows to change birth options before...
authormogami <mogami@0568b783-4c39-0410-ac80-bf13821ea2a2>
Wed, 6 Nov 2002 11:42:29 +0000 (11:42 +0000)
committermogami <mogami@0568b783-4c39-0410-ac80-bf13821ea2a2>
Wed, 6 Nov 2002 11:42:29 +0000 (11:42 +0000)
src/birth.c
src/cmd4.c
src/dungeon.c
src/effects.c
src/externs.h
src/files.c
src/load.c
src/save.c
src/tables.c
src/variable.c

index b8ae231..961109c 100644 (file)
@@ -3307,6 +3307,7 @@ static void player_wipe(void)
        cheat_xtra = FALSE;
        cheat_know = FALSE;
        cheat_live = FALSE;
+       cheat_save = FALSE;
 
        /* Assume no winning game */
        p_ptr->total_winner = FALSE;
@@ -5419,88 +5420,6 @@ static bool player_birth_aux(void)
 #endif
 
 
-       /*** Quick Start ***/
-
-       if (previous_char.quick_ok)
-       {
-               bool do_quick_start = FALSE;
-
-               /* Extra info */
-#ifdef JP
-       put_str("¥¯¥¤¥Ã¥¯¡¦¥¹¥¿¡¼¥È¤ò»È¤¦¤È°ÊÁ°¤ÈÁ´¤¯Æ±¤¸¥­¥ã¥é¥¯¥¿¡¼¤Ç»Ï¤á¤é¤ì¤Þ¤¹¡£", 11, 5);
-#else
-       put_str("Do you want to use the quick start function(same character as your last one).", 11, 2);
-#endif
-
-               /* Choose */
-               while (1)
-               {
-#ifdef JP
-                       put_str("¥¯¥¤¥Ã¥¯¡¦¥¹¥¿¡¼¥È¤ò»È¤¤¤Þ¤¹¤«¡©[y/n]", 14, 10);
-#else
-                       put_str("Use quick start? [y/n]", 14, 10);
-#endif
-                       c = inkey();
-                       if (c == 'Q') quit(NULL);
-                       else if (c == 'S') return (FALSE);
-                        else if (c == '?')
-                        {
-#ifdef JP                 
-                                show_help("jbirth.txt#QuickStart");
-#else
-                                show_help("birth.txt#QuickStart");
-#endif
-                        }
-                       else if ((c == 'y') || (c == 'Y'))
-                       {
-                               do_quick_start = TRUE;
-                               break;
-                       }
-                       else
-                       {
-                               do_quick_start = FALSE;
-                               break;
-                       }
-               }
-
-               if (do_quick_start)
-               {
-                       load_prev_data(FALSE);
-                       init_dungeon_quests(previous_char.quests);
-                       init_turn();
-
-                       sp_ptr = &sex_info[p_ptr->psex];
-                       rp_ptr = &race_info[p_ptr->prace];
-                       cp_ptr = &class_info[p_ptr->pclass];
-                        mp_ptr = &m_info[p_ptr->pclass];
-                       ap_ptr = &seikaku_info[p_ptr->pseikaku];
-
-                       /* Calc hitdie, but don't roll */
-                       get_extra(FALSE);
-
-                       /* Calculate the bonuses and hitpoints */
-                       p_ptr->update |= (PU_BONUS | PU_HP);
-
-                       /* Update stuff */
-                       update_stuff();
-
-                       /* Fully healed */
-                       p_ptr->chp = p_ptr->mhp;
-
-                       /* Fully rested */
-                       p_ptr->csp = p_ptr->msp;
-
-                       /* Process the player name */
-                       process_player_name(FALSE);
-
-                       return TRUE;
-               }
-
-               /* Clean up */
-               clear_from(10);
-       }
-
-
        /*** Player sex ***/
 
        /* Extra info */
@@ -6233,6 +6152,91 @@ static bool player_birth_aux(void)
 
 
 /*
+ * Ask whether the player use Quick Start or not.
+ */
+static bool ask_quick_start(void)
+{
+        /* Doesn't have previous data */
+       if (!previous_char.quick_ok) return FALSE;
+
+
+       /* Clear screen */
+       Term_clear();
+
+        /* Extra info */
+#ifdef JP
+        put_str("¥¯¥¤¥Ã¥¯¡¦¥¹¥¿¡¼¥È¤ò»È¤¦¤È°ÊÁ°¤ÈÁ´¤¯Æ±¤¸¥­¥ã¥é¥¯¥¿¡¼¤Ç»Ï¤á¤é¤ì¤Þ¤¹¡£", 11, 5);
+#else
+        put_str("Do you want to use the quick start function(same character as your last one).", 11, 2);
+#endif
+
+        /* Choose */
+        while (1)
+        {
+                char c;
+
+#ifdef JP
+                put_str("¥¯¥¤¥Ã¥¯¡¦¥¹¥¿¡¼¥È¤ò»È¤¤¤Þ¤¹¤«¡©[y/n]", 14, 10);
+#else
+                put_str("Use quick start? [y/n]", 14, 10);
+#endif
+                c = inkey();
+
+                if (c == 'Q') quit(NULL);
+                else if (c == 'S') return (FALSE);
+                else if (c == '?')
+                {
+#ifdef JP                 
+                        show_help("jbirth.txt#QuickStart");
+#else
+                        show_help("birth.txt#QuickStart");
+#endif
+                }
+                else if ((c == 'y') || (c == 'Y'))
+                {
+                        /* Yes */
+                        break;
+                }
+                else
+                {
+                        /* No */
+                        return FALSE;
+                }
+        }
+
+        load_prev_data(FALSE);
+        init_dungeon_quests(previous_char.quests);
+        init_turn();
+
+        sp_ptr = &sex_info[p_ptr->psex];
+        rp_ptr = &race_info[p_ptr->prace];
+        cp_ptr = &class_info[p_ptr->pclass];
+        mp_ptr = &m_info[p_ptr->pclass];
+        ap_ptr = &seikaku_info[p_ptr->pseikaku];
+
+        /* Calc hitdie, but don't roll */
+        get_extra(FALSE);
+
+        /* Calculate the bonuses and hitpoints */
+        p_ptr->update |= (PU_BONUS | PU_HP);
+
+        /* Update stuff */
+        update_stuff();
+
+        /* Fully healed */
+        p_ptr->chp = p_ptr->mhp;
+
+        /* Fully rested */
+        p_ptr->csp = p_ptr->msp;
+
+        /* Process the player name */
+        process_player_name(FALSE);
+
+        return TRUE;
+}
+
+
+/*
  * Create a new character.
  *
  * Note that we may be called with "junk" leftover in the various
@@ -6251,15 +6255,24 @@ void player_birth(void)
         */
        wipe_m_list();
 
+        /* Wipe the player */
+        player_wipe();
+
        /* Create a new character */
-       while (1)
-       {
-               /* Wipe the player */
-               player_wipe();
 
-               /* Roll up a new character */
-               if (player_birth_aux()) break;
-       }
+        /* Quick start? */
+        if (!ask_quick_start())
+        {
+                /* No, normal start */
+                while (1)
+                {
+                        /* Roll up a new character */
+                        if (player_birth_aux()) break;
+
+                        /* Wipe the player */
+                        player_wipe();
+                }
+        }
 
        /* Note player birth in the message recall */
        message_add(" ");
index 58e3851..0da0a74 100644 (file)
@@ -1425,7 +1425,7 @@ void do_cmd_messages(int num_now)
 /*
  * Number of cheating options
  */
-#define CHEAT_MAX 6
+#define CHEAT_MAX 7
 
 /*
  * Cheating options
@@ -1478,6 +1478,14 @@ static option_type cheat_info[CHEAT_MAX] =
 #else
        "cheat_live",           "Allow player to avoid death"
 #endif
+        },
+
+       { &cheat_save,          FALSE,  255,    0x40, 0x00,
+#ifdef JP
+       "cheat_save",           "»à¤ó¤À»þ¥»¡¼¥Ö¤¹¤ë¤«³Îǧ¤¹¤ë"
+#else
+       "cheat_save",           "Ask for saving death"
+#endif
         }
 };
 
@@ -2204,8 +2212,6 @@ void do_cmd_options(void)
                prt("(A)    ¼«Æ°¥»¡¼¥Ö         ¥ª¥×¥·¥ç¥ó", 14, 5);
                /* Window flags */
                prt("(W) ¥¦¥¤¥ó¥É¥¦¥Õ¥é¥°", 15, 5);
-               /* Cheating */
-               prt("(C)       º¾µ½            ¥ª¥×¥·¥ç¥ó", 16, 5);
 #else
                prt("(1) Input Options", 4, 5);
                prt("(2) Output Options", 5, 5);
@@ -2223,10 +2229,17 @@ void do_cmd_options(void)
 
                /* Window flags */
                prt("(W) Window Flags", 15, 5);
+#endif
 
-               /* Cheating */
-               prt("(C) Cheating Options", 16, 5);
+                if (p_ptr->noscore || allow_debug_opts)
+                {
+                        /* Cheating */
+#ifdef JP
+                        prt("(C)       º¾µ½            ¥ª¥×¥·¥ç¥ó", 16, 5);
+#else
+                        prt("(C) Cheating Options", 16, 5);
 #endif
+                }
 
 
                /* Prompt */
@@ -2339,6 +2352,13 @@ void do_cmd_options(void)
                        /* Cheating Options */
                        case 'C':
                        {
+                                if (!p_ptr->noscore && !allow_debug_opts)
+                                {
+                                        /* Cheat options are not permitted */
+                                        bell();
+                                        break;
+                                }
+
                                /* Spawn */
 #ifdef JP
                                do_cmd_options_cheat("º¾µ½»Õ¤Ï·è¤·¤Æ¾¡Íø¤Ç¤­¤Ê¤¤¡ª");
index 5cca529..46a731d 100644 (file)
@@ -3861,6 +3861,17 @@ static bool enter_wizard_mode(void)
        /* Ask first time */
        if (!p_ptr->noscore)
        {
+                /* Wizard mode is not permitted */
+                if (!allow_debug_opts)
+                {
+#ifdef JP
+                        msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤Ïµö²Ä¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£ ");
+#else
+                        msg_print("Wizard mode is not permitted.");
+#endif
+                        return FALSE;
+                }
+
                /* Mention effects */
 #ifdef JP
 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤Ï¥Ç¥Ð¥°¤È¼Â¸³¤Î¤¿¤á¤Î¥â¡¼¥É¤Ç¤¹¡£ ");
@@ -3902,6 +3913,17 @@ static bool enter_debug_mode(void)
        /* Ask first time */
        if (!p_ptr->noscore)
        {
+                /* Debug mode is not permitted */
+                if (!allow_debug_opts)
+                {
+#ifdef JP
+                        msg_print("¥Ç¥Ð¥Ã¥°¥³¥Þ¥ó¥É¤Ïµö²Ä¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£ ");
+#else
+                        msg_print("Use of debug command is not permitted.");
+#endif
+                        return FALSE;
+                }
+
                /* Mention effects */
 #ifdef JP
 msg_print("¥Ç¥Ð¥°¡¦¥³¥Þ¥ó¥É¤Ï¥Ç¥Ð¥°¤È¼Â¸³¤Î¤¿¤á¤Î¥³¥Þ¥ó¥É¤Ç¤¹¡£ ");
index 2476680..cb9a6ff 100644 (file)
@@ -5104,7 +5104,7 @@ int take_hit(int damage_type, int damage, cptr hit_from, int monspell)
                bool android = (p_ptr->prace == RACE_ANDROID ? TRUE : FALSE);
 
 #ifdef JP       /* »à¤ó¤À»þ¤Ë¶¯À©½ªÎ»¤·¤Æ»à¤ò²óÈò¤Ç¤­¤Ê¤¯¤·¤Æ¤ß¤¿ by Habu */
-               if (!munchkin_death)
+               if (!cheat_save)
                        if(!save_player()) msg_print("¥»¡¼¥Ö¼ºÇÔ¡ª");
 #endif
 
index e4ec4ea..92cb0a3 100644 (file)
@@ -238,6 +238,7 @@ extern bool always_show_list;
 extern bool powerup_home;
 extern bool change_numeral;
 extern bool send_score;
+extern bool allow_debug_opts;   /* Allow use of debug/cheat options */
 
 extern bool display_mutations;     /* Skip mutations screen in 'C'haracter display */
 extern bool plain_descriptions;
@@ -272,6 +273,7 @@ extern bool cheat_room;
 extern bool cheat_xtra;
 extern bool cheat_know;
 extern bool cheat_live;
+extern bool cheat_save;
 extern bool last_words;              /* Zangband options */
 extern bool over_exert;
 extern bool small_levels;
@@ -470,7 +472,6 @@ extern bool ironman_autoscum;
 extern bool lite_town;
 extern bool ironman_empty_levels;
 extern bool terrain_streams;
-extern bool munchkin_death;
 extern bool ironman_rooms;
 extern bool ironman_nightmare;
 extern bool left_hander;
index ff05c15..e915cb7 100644 (file)
@@ -4561,13 +4561,6 @@ fprintf(fff, "\n Ũ
 #endif
 
 
-       if (munchkin_death)
-#ifdef JP
-fprintf(fff, "\n ¤¢¤Ê¤¿¤Ï»à¤ò²óÈò¤¹¤ë¥¤¥ó¥Á¥­¤ÊÎϤò»ý¤Ã¤Æ¤¤¤Þ¤¹¡£");
-#else
-               fprintf(fff, "\n You possess munchkinish power over death.");
-#endif
-
        fprintf(fff,"\n");
 
        /* Monsters slain */
@@ -6702,9 +6695,9 @@ void close_game(void)
 
                /* Save memories */
 #ifdef JP
-               if (!munchkin_death || get_check("»à¤ó¤À¥Ç¡¼¥¿¤ò¥»¡¼¥Ö¤·¤Þ¤¹¤«¡© "))
+               if (!cheat_save || get_check("»à¤ó¤À¥Ç¡¼¥¿¤ò¥»¡¼¥Ö¤·¤Þ¤¹¤«¡© "))
 #else
-               if (!munchkin_death || get_check("Save death? "))
+               if (!cheat_save || get_check("Save death? "))
 #endif
                {
 
index 7d81776..ed651e1 100644 (file)
@@ -965,6 +965,7 @@ static void rd_options(void)
        cheat_xtra = (c & 0x0800) ? TRUE : FALSE;
        cheat_know = (c & 0x1000) ? TRUE : FALSE;
        cheat_live = (c & 0x2000) ? TRUE : FALSE;
+       cheat_save = (c & 0x4000) ? TRUE : FALSE;
 
        rd_byte((byte *)&autosave_l);
        rd_byte((byte *)&autosave_t);
@@ -2357,18 +2358,6 @@ if (arg_fiddle) note("
        if (arg_fiddle) note("Loaded Option Flags");
 #endif
 
-       /*
-        * Munchkin players are marked
-        *
-        * XXX - should be replaced with a better method,
-        * after the new scorefile-handling is implemented.
-        */
-       if (munchkin_death)
-       {
-               /* Mark savefile */
-               p_ptr->noscore |= 0x0001;
-       }
-
        /* Then the "messages" */
        rd_messages();
 #ifdef JP
index 411aa87..806c592 100644 (file)
@@ -362,6 +362,7 @@ static void wr_options(void)
        if (cheat_xtra) c |= 0x0800;
        if (cheat_know) c |= 0x1000;
        if (cheat_live) c |= 0x2000;
+       if (cheat_save) c |= 0x4000;
 
        wr_u16b(c);
 
@@ -471,7 +472,7 @@ static void save_quick_start(void)
        wr_byte(previous_char.quests);
 
        /* No quick start after using debug mode or cheat options */
-       if (p_ptr->noscore || munchkin_death) previous_char.quick_ok = FALSE;
+       if (p_ptr->noscore) previous_char.quick_ok = FALSE;
 
        wr_byte((byte)previous_char.quick_ok);
 }
index c2dbe02..dca6eb7 100644 (file)
@@ -6873,6 +6873,17 @@ option_type option_info[] =
 #endif
 
 
+#ifdef JP
+       { &allow_debug_opts,            FALSE, 3, 6, 11,
+       "allow_debug_opts",             "¥Ç¥Ð¥Ã¥°/º¾µ½¥ª¥×¥·¥ç¥ó¤òµö²Ä¤¹¤ë" },
+#else
+       { &allow_debug_opts,            FALSE, 3, 6, 11,
+       "allow_debug_opts",             "Allow use of debug/cheat options" },
+#endif
+
+
+
+
        /*** Disturbance ***/
 
 #ifdef JP
@@ -7213,15 +7224,6 @@ option_type option_info[] =
 
 
 #ifdef JP
-       { &munchkin_death,               FALSE, 6, 6, 11,
-       "munchkin_death",                "¡Ê¤¤¤ó¤Á¤­¡Ë»à¤ó¤À»þ¥»¡¼¥Ö¤¹¤ë¤«³Îǧ¤¹¤ë(*)" },
-#else
-       { &munchkin_death,              FALSE, 6, 6, 11,
-       "munchkin_death",               "(Cheating) Ask for death saves (*)" },
-#endif
-
-
-#ifdef JP
        { &ironman_rooms,                FALSE, 6, 6, 12,
        "ironman_rooms",                 "¡ÊÅ´¿ÍÍѡ˾ï¤ËÉáÄ̤Ǥʤ¤Éô²°¤òÀ¸À®¤¹¤ë(*)" },
 #else
index 9519f9b..abad001 100644 (file)
@@ -294,6 +294,7 @@ bool always_show_list;
 bool powerup_home;
 bool change_numeral;
 bool send_score;
+bool allow_debug_opts;   /* Allow use of debug/cheat options */
 
 /* Cheating options */
 
@@ -303,6 +304,7 @@ bool cheat_room;            /* Peek into dungeon creation */
 bool cheat_xtra;               /* Peek into something else */
 bool cheat_know;               /* Know complete monster info */
 bool cheat_live;               /* Allow player to avoid death */
+bool cheat_save;               /* Ask for saving death */
 
 
 /* Special options */
@@ -1092,7 +1094,6 @@ bool ironman_autoscum;        /* Permanently enable the autoscummer */
 bool lite_town;               /* Use "lite" town without wilderness */
 bool ironman_empty_levels;    /* Always create empty 'arena' levels */
 bool terrain_streams;         /* Create terrain 'streamers' in the dungeon */
-bool munchkin_death;          /* Ask for saving death */
 bool ironman_rooms;           /* Always generate very unusual rooms */
 bool ironman_nightmare;                        /* Play the game in Nightmare mode */
 bool left_hander;