OSDN Git Service

クエスト達成時に, 階段が鏡の上(下?)に作られるのを禁止.
[hengbandforosx/hengbandosx.git] / src / files.c
index 787c8cd..801191e 100644 (file)
@@ -327,6 +327,10 @@ static named_num gf_desc[] =
        {"GF_SEEKER",                   GF_SEEKER                       },
        {"GF_SUPER_RAY",                GF_SUPER_RAY                    },
        {"GF_STAR_HEAL",                GF_STAR_HEAL                    },
+       {"GF_WATER_FLOW",               GF_WATER_FLOW                   },
+       {"GF_CRUSADE",          GF_CRUSADE                      },
+       {"GF_STASIS_EVIL",                      GF_STASIS_EVIL          },
+       {"GF_WOUNDS",                   GF_WOUNDS               },
        {NULL,                                          0                                               }
 };
 
@@ -586,7 +590,7 @@ errr process_pref_file_command(char *buf)
                            option_info[i].o_text &&
                            streq(option_info[i].o_text, buf + 2))
                        {
-                               if (alive && 6 == option_info[i].o_page && !wizard)
+                               if (p_ptr->playing && 6 == option_info[i].o_page && !p_ptr->wizard)
                                {
 #ifdef JP
                                        msg_format("½é´ü¥ª¥×¥·¥ç¥ó¤ÏÊѹ¹¤Ç¤­¤Þ¤»¤ó! '%s'", buf);        
@@ -626,7 +630,7 @@ errr process_pref_file_command(char *buf)
                            option_info[i].o_text &&
                            streq(option_info[i].o_text, buf + 2))
                        {
-                               if (alive && 6 == option_info[i].o_page && !wizard)
+                               if (p_ptr->playing && 6 == option_info[i].o_page && !p_ptr->wizard)
                                {
 #ifdef JP
                                        msg_format("½é´ü¥ª¥×¥·¥ç¥ó¤ÏÊѹ¹¤Ç¤­¤Þ¤»¤ó! '%s'", buf);        
@@ -1040,10 +1044,12 @@ static cptr process_pref_file_expr(char **sp, char *fp)
  */
 static errr process_pickpref_file_line(char *buf)
 {
-       char *s, *s2;
+       autopick_type entry;
        int i;
-       byte act = 0;
 
+       if (max_autopick == MAX_AUTOPICK)
+               return 1;
+       
        /* Nuke illegal char */
        for(i = 0; buf[i]; i++)
        {
@@ -1059,71 +1065,15 @@ static errr process_pickpref_file_line(char *buf)
        }
        buf[i] = 0;
        
-       s = buf;
-
-       act = DO_AUTOPICK | DO_DISPLAY;
-       while (1)
-       {
-               if (*s == '!')
-               {
-                       act &= ~DO_AUTOPICK;
-                       act |= DO_AUTODESTROY;
-                       s++;
-               }
-               else if (*s == '~')
-               {
-                       act &= ~DO_AUTOPICK;
-                       act |= DONT_AUTOPICK;
-                       s++;
-               }
-               else if (*s == '(')
-               {
-                       act &= ~DO_DISPLAY;
-                       s++;
-               }
-               else
-                       break;
-       }
+       if (!autopick_new_entry(&entry, buf)) return 0;
 
-       /* don't mind upper or lower case */
-       s2 = NULL;
-       for (i = 0; s[i]; i++)
-       {
-#ifdef JP
-               if (iskanji(s[i]))
-               {
-                       i++;
-                       continue;
-               }
-#endif
-               if (isupper(s[i]))
-                       s[i] = tolower(s[i]);
-
-               /* Auto-inscription? */
-               if (s[i] == '#')
-               {
-                       s[i] = '\0';
-                       s2 = s + i + 1;
-                       break;
-               }
-       }
-       
-       /* Skip empty line */
-       if (*s == 0)
-               return 0;
-       if (max_autopick == MAX_AUTOPICK)
-               return 1;
-       
        /* Already has the same entry? */ 
        for(i = 0; i < max_autopick; i++)
-               if(!strcmp(s, autopick_name[i]))
-                       return 0;
-
-       autopick_name[max_autopick] = string_make(s);
-       autopick_action[max_autopick] = act;
+               if(!strcmp(entry.name, autopick_list[i].name)
+                  && entry.flag[0] == autopick_list[i].flag[0]
+                  && entry.flag[1] == autopick_list[i].flag[1]) return 0;
 
-       autopick_insc[max_autopick] = string_make(s2);
-       max_autopick++;
+       autopick_list[max_autopick++] = entry;
        return 0;
 }
 
@@ -1804,9 +1754,9 @@ static void display_player_middle(void)
        if (object_known_p(o_ptr)) show_todam += o_ptr->to_d;
 
        if ((o_ptr->sval == SV_LIGHT_XBOW) || (o_ptr->sval == SV_HEAVY_XBOW))
-               show_tohit += (weapon_exp[0][o_ptr->sval])/400;
+               show_tohit += (p_ptr->weapon_exp[0][o_ptr->sval])/400;
        else
-               show_tohit += (weapon_exp[0][o_ptr->sval]-4000)/200;
+               show_tohit += (p_ptr->weapon_exp[0][o_ptr->sval]-4000)/200;
 
        /* Range attacks */
        display_player_one_line(ENTRY_SHOOT_HIT_DAM, format("(%+d,%+d)", show_tohit, show_todam), TERM_L_BLUE);
@@ -1932,23 +1882,16 @@ static void display_player_middle(void)
 
        /* Dump Day */
        {
-               s32b len = 20L * TOWN_DAWN;
-               s32b tick = turn % len + len / 4;
+               int day, hour, min;
+               extract_day_hour_min(&day, &hour, &min);
 
                sprintf(buf, 
 #ifdef JP
-                       "%ldÆüÌÜ %2ld:%02ld", 
+                       "%dÆüÌÜ %2d:%02d", 
 #else
-                       "Day %ld %2ld:%02ld", 
+                       "Day %d %2d:%02d", 
 #endif
-                       ((p_ptr->prace == RACE_VAMPIRE) ||
-                        (p_ptr->prace == RACE_SKELETON) ||
-                        (p_ptr->prace == RACE_ZOMBIE) ||
-                        (p_ptr->prace == RACE_SPECTRE))
-                       ? (turn - (15L * TOWN_DAWN)) / len + 1
-                       : (turn + (5L * TOWN_DAWN))/ len + 1,
-                       (24 * tick / len) % 24,
-                       (1440 * tick / len) % 60);
+                       day, hour, min);
        }
        display_player_one_line(ENTRY_DAY, buf, TERM_L_GREEN);
 
@@ -2966,7 +2909,7 @@ static void player_vuln_flags(u32b *f1, u32b *f2, u32b *f3)
 /*
  * Helper function, see below
  */
-static void display_player_flag_aux(int row, int col, char *header,
+static void display_player_flag_aux(int row, int col, cptr header,
                                    int n, u32b flag1, u32b flag2,
                                    u32b im_f[], u32b vul_f)
 {
@@ -4023,7 +3966,7 @@ void display_player(int mode)
 
 
        /* XXX XXX XXX */
-       if ((p_ptr->muta1 || p_ptr->muta2 || p_ptr->muta3) && skip_mutations)
+       if ((p_ptr->muta1 || p_ptr->muta2 || p_ptr->muta3) && display_mutations)
                mode = (mode % 7);
        else
                mode = (mode % 6);
@@ -4055,7 +3998,7 @@ void display_player(int mode)
                        display_player_one_line(ENTRY_REALM, tmp, TERM_L_BLUE);
                }
 
-               if (p_ptr->pclass == CLASS_CHAOS_WARRIOR)
+               if ((p_ptr->pclass == CLASS_CHAOS_WARRIOR) || (p_ptr->muta2 & MUT2_CHAOS_GIFT))
                        display_player_one_line(ENTRY_PATRON, chaos_patrons[p_ptr->chaos_patron], TERM_L_BLUE);
 
                /* Age, Height, Weight, Social */
@@ -4140,12 +4083,12 @@ void display_player(int mode)
 
                        for (i = 0; i < 4; i++)
                        {
-                               put_str(history[i], i + 12, 10);
+                               put_str(p_ptr->history[i], i + 12, 10);
                        }
 
                        *statmsg = '\0';
 
-                       if (death && total_winner)
+                       if (p_ptr->is_dead && p_ptr->total_winner)
                        {
 #ifdef JP
                                strcpy(statmsg, "¡Ä¤¢¤Ê¤¿¤Ï¾¡Íø¤Î¸å°úÂष¤¿¡£");
@@ -4153,32 +4096,37 @@ void display_player(int mode)
                                strcpy(statmsg, "...You retired from the adventure after the winning.");
 #endif
                        }
-                       else if (death)
+                       else if (p_ptr->is_dead)
                        {
                                if (dun_level)
                                {
                                        if (p_ptr->inside_quest && (p_ptr->inside_quest < MIN_RANDOM_QUEST))
                                        {
+                                               /* Get the quest text */
+                                               init_flags = INIT_ASSIGN;
+
+                                               process_dungeon_file("q_info_j.txt", 0, 0, 0, 0);
+
 #ifdef JP
-                                               sprintf(statmsg, "¡Ä¤¢¤Ê¤¿¤Ï¡¢¥¯¥¨¥¹¥È¡Ö%s¡×¤Ç%s¤Ë»¦¤µ¤ì¤¿¡£", quest[p_ptr->inside_quest].name, died_from);
+                                               sprintf(statmsg, "¡Ä¤¢¤Ê¤¿¤Ï¡¢¥¯¥¨¥¹¥È¡Ö%s¡×¤Ç%s¤Ë»¦¤µ¤ì¤¿¡£", quest[p_ptr->inside_quest].name, p_ptr->died_from);
 #else
-                                               sprintf(statmsg, "...You were killed by %s in the quest '%s'.", died_from, quest[p_ptr->inside_quest].name);
+                                               sprintf(statmsg, "...You were killed by %s in the quest '%s'.", p_ptr->died_from, quest[p_ptr->inside_quest].name);
 #endif
                                        }
                                        else
                                        {                                       
 #ifdef JP
-                                               sprintf(statmsg, "¡Ä¤¢¤Ê¤¿¤Ï¡¢%s¤Î%d³¬¤Ç%s¤Ë»¦¤µ¤ì¤¿¡£", map_name(), dun_level, died_from);
+                                               sprintf(statmsg, "¡Ä¤¢¤Ê¤¿¤Ï¡¢%s¤Î%d³¬¤Ç%s¤Ë»¦¤µ¤ì¤¿¡£", map_name(), dun_level, p_ptr->died_from);
 #else
-                                               sprintf(statmsg, "...You were killed by %s on level %d of %s.", died_from, dun_level, map_name());
+                                               sprintf(statmsg, "...You were killed by %s on level %d of %s.", p_ptr->died_from, dun_level, map_name());
 #endif
                                        }
                                }
                                else
 #ifdef JP
-                                       sprintf(statmsg, "¡Ä¤¢¤Ê¤¿¤Ï%s¤Ç%s¤Ë»¦¤µ¤ì¤¿¡£", map_name(), died_from);
+                                       sprintf(statmsg, "¡Ä¤¢¤Ê¤¿¤Ï%s¤Ç%s¤Ë»¦¤µ¤ì¤¿¡£", map_name(), p_ptr->died_from);
 #else
-                                       sprintf(statmsg, "...You were killed by %s in %s.", died_from, map_name());
+                                       sprintf(statmsg, "...You were killed by %s in %s.", p_ptr->died_from, map_name());
 #endif
                        }
                        else if (character_dungeon)
@@ -4187,6 +4135,11 @@ void display_player(int mode)
                                {
                                        if (p_ptr->inside_quest && (p_ptr->inside_quest < MIN_RANDOM_QUEST))
                                        {
+                                               /* Get the quest text */
+                                               init_flags = INIT_ASSIGN;
+
+                                               process_dungeon_file("q_info_j.txt", 0, 0, 0, 0);
+
 #ifdef JP
                                                sprintf(statmsg, "¡Ä¤¢¤Ê¤¿¤Ï¸½ºß¡¢ ¥¯¥¨¥¹¥È¡Ö%s¡×¤ò¿ë¹ÔÃæ¤À¡£", quest[p_ptr->inside_quest].name);
 #else
@@ -4277,11 +4230,6 @@ errr make_character_dump(FILE *fff)
        char            buf[1024];
 
 
-#ifndef FAKE_VERSION
-       /* Begin dump */
-       fprintf(fff, "  [Angband %d.%d.%d Character Dump]\n\n",
-               VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH);
-#else
 #ifdef JP
        fprintf(fff, "  [ÊѶòÈÚÅÜ %d.%d.%d ¥­¥ã¥é¥¯¥¿¾ðÊó]\n\n",
                FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
@@ -4290,8 +4238,6 @@ errr make_character_dump(FILE *fff)
                FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
 #endif
 
-#endif
-
        update_playtime();
 
        /* Display player */
@@ -4381,10 +4327,10 @@ errr make_character_dump(FILE *fff)
                fprintf(fff, "%s\n", buf);
        }
 
-       for (i = 0; i < p_ptr->count / 80; i++)
+       for (i = 0; (unsigned int) i < (p_ptr->count / 80); i++)
                fprintf(fff, " ");
        fprintf(fff, "\n");
-       for (i = 0; i < p_ptr->count % 80; i++)
+       for (i = 0; (unsigned int) i < (p_ptr->count % 80); i++)
                fprintf(fff, " ");
 
        {
@@ -4420,7 +4366,7 @@ errr make_character_dump(FILE *fff)
                if (pet) fprintf(fff, "\n");
        }
 
-       if (death && !total_winner)
+       if (p_ptr->is_dead && !p_ptr->total_winner)
        {
 #ifdef JP
                fprintf(fff, "\n  [»à¤ÌľÁ°¤Î¥á¥Ã¥»¡¼¥¸]\n\n");
@@ -4638,7 +4584,7 @@ errr make_character_dump(FILE *fff)
 #endif
        }
 
-       if (noscore)
+       if (p_ptr->noscore)
 #ifdef JP
 fprintf(fff, "\n ²¿¤«ÉÔÀµ¤Ê¤³¤È¤ò¤·¤Æ¤·¤Þ¤Ã¤Æ¤Þ¤¹¡£");
 #else
@@ -5058,6 +5004,9 @@ bool show_file(bool show_version, cptr name, cptr what, int line, int mode)
        /* Backup value for "line" */
        int back = 0;
 
+       /* Color of the next line */
+       byte color = TERM_WHITE;
+
        /* Loop counter */
        int cnt;
 
@@ -5237,35 +5186,41 @@ msg_format("'%s'
        /* Pre-Parse the file */
        while (TRUE)
        {
+               char *str;
+
                /* Read a line or stop */
                if (my_fgets(fff, buf, 1024)) break;
 
+               /* Get a color */
+               if (prefix(buf, "#####")) str = &buf[6];
+               else str = buf;
+
                /* XXX Parse "menu" items */
-               if (prefix(buf, "***** "))
+               if (prefix(str, "***** "))
                {
                        /* Notice "menu" requests */
-                       if ((buf[6] == '[') && (isdigit(buf[7]) || isalpha(buf[7])))
+                       if ((str[6] == '[') && isalpha(str[7]))
                        {
                                /* This is a menu file */
                                menu = TRUE;
 
                                /* Extract the menu item */
-                               k = isdigit(buf[7]) ? D2I(buf[7]) : buf[7] - 'A' + 10;
+                               k = str[7] - 'A';
 
-                               if ((buf[8] == ']') && (buf[9] == ' '))
+                               if ((str[8] == ']') && (str[9] == ' '))
                                {
                                        /* Extract the menu item */
-                                       strncpy(hook[k], buf + 10, 31);
+                                       strncpy(hook[k], str + 10, 31);
 
                                        /* Make sure it's null-terminated */
                                        hook[k][31] = '\0';
                                }
                        }
                        /* Notice "tag" requests */
-                       else if (buf[6] == '<')
+                       else if (str[6] == '<')
                        {
-                               buf[strlen(buf) - 1] = '\0';
-                               add_tag(&tags, buf + 7, next);
+                               str[strlen(str) - 1] = '\0';
+                               add_tag(&tags, str + 7, next);
                        }
 
                        /* Skip this */
@@ -5292,8 +5247,8 @@ msg_format("'%s'
                Term_clear();
 
                /* Restart when necessary */
-               if (line >= size) line = 0;
-
+               if (line >= size - rows) line = size - rows;
+               if (line < 0) line = 0;
 
                /* Re-open the file if needed */
                if (next > line)
@@ -5324,9 +5279,12 @@ msg_format("'%s'
                        next++;
                }
 
-               /* Dump the next rows lines of the file */
+               /* Dump the next 20, or rows, lines of the file */
                for (i = 0; i < rows; )
                {
+                       int print_x, x;
+                       cptr str;
+
                        /* Hack -- track the "first" line */
                        if (!i) line = next;
 
@@ -5336,11 +5294,23 @@ msg_format("'%s'
                        /* Hack -- skip "special" lines */
                        if (prefix(buf, "***** ")) continue;
 
+                       /* Get a color */
+                       if (prefix(buf, "#####"))
+                       {
+                               color = color_char_to_attr(buf[5]);
+                               str = &buf[6];
+                       }
+                       else
+                       {
+                               color = TERM_WHITE;
+                               str = buf;
+                       }
+
                        /* Count the "real" lines */
                        next++;
 
-                       /* Make a lower case version of buf for searching */
-                       strcpy(lc_buf, buf);
+                       /* Make a lower case version of str for searching */
+                       strcpy(lc_buf, str);
 
                        for (lc_buf_ptr = lc_buf; *lc_buf_ptr != 0; lc_buf_ptr++)
                        {
@@ -5359,23 +5329,48 @@ msg_format("'%s'
                        find = NULL;
 
                        /* Dump the line */
-                       Term_putstr(0, i+2, -1, TERM_WHITE, buf);
+                       x = 0;
+                       print_x = 0;
+                       while (str[x])
+                       {
+                               /* Color ? */
+                               if (prefix(str + x, "[[[[["))
+                               {
+                                       byte c = color_char_to_attr(str[x + 5]);
+                                       x += 6;
+
+                                       /* Ok print the link name */
+                                       while (str[x] != ']')
+                                       {
+                                               Term_putch(print_x, i + 2, c, str[x]);
+                                               x++;
+                                               print_x++;
+                                       }
+                               }
+                               else
+                               {
+                                       Term_putch(print_x, i + 2, color, str[x]);
+                                       print_x++;
+                               }
+
+                               x++;
+                       }
 
                        /* Hilite "shower" */
                        if (shower[0])
                        {
-                               cptr str = lc_buf;
+                               cptr s2 = lc_buf;
 
                                /* Display matches */
-                               while ((str = strstr(str, shower)) != NULL)
+                               while ((s2 = strstr(s2, shower)) != NULL)
                                {
                                        int len = strlen(shower);
 
                                        /* Display the match */
-                                       Term_putstr(str-lc_buf, i+2, len, TERM_YELLOW, &buf[str-lc_buf]);
+                                       Term_putstr(s2-lc_buf, i+2, len, TERM_YELLOW, &str[s2-lc_buf]);
 
                                        /* Advance */
-                                       str += len;
+                                       s2 += len;
                                }
                        }
 
@@ -5417,20 +5412,8 @@ msg_format("'%s'
                                caption, line, size), 0, 0);
                }
 
-               /* Prompt -- menu screen */
-               if (menu)
-               {
-                       /* Wait for it */
-#ifdef JP
-prt("[ ÈÖ¹æ¤òÆþÎϤ·¤Æ²¼¤µ¤¤( ESC¤Ç½ªÎ» ) ]", hgt - 1, 0);
-#else
-                       prt("[Press a Number, or ESC to exit.]", hgt - 1, 0);
-#endif
-
-               }
-
                /* Prompt -- small files */
-               else if (size <= rows)
+               if (size <= rows)
                {
                        /* Wait for it */
 #ifdef JP
@@ -5557,20 +5540,30 @@ strcpy(tmp, "jhelp.hlp");
                        }
                }
 
-               /* Hack -- Allow backing up */
+               /* Allow backing up */
                if (k == '-')
                {
                        line = line + (reverse ? rows : -rows);
-                       if (line < 0) line = ((size-1)/rows)*rows;
+                       if (line < 0) line = 0;
                }
 
-               /* Hack -- Advance a single line */
+               /* Advance a single line */
                if ((k == '\n') || (k == '\r'))
                {
                        line = line + (reverse ? -1 : 1);
-                       if (line < 0) line = ((size-1)/rows)*rows;
+                       if (line < 0) line = 0;
                }
 
+
+               /* Move up / down */
+               if (k == '8')
+               {
+                       line--;
+                       if (line < 0) line = 0;
+               }
+
+               if (k == '2') line++;
+
                /* Advance one page */
                if (k == ' ')
                {
@@ -5583,8 +5576,8 @@ strcpy(tmp, "jhelp.hlp");
                {
                        int key = -1;
 
-                       if (isdigit(k)) key = D2I(k);
-                       else if (isalpha(k)) key = k - 'A' + 10;
+                       if (isalpha(k))
+                               key = k - 'A';
 
                        if ((key > -1) && hook[key][0])
                        {
@@ -5913,6 +5906,7 @@ void get_name(void)
        strcat(tmp,player_name);
 
        /* Re-Draw the name (in light blue) */
+       Term_erase(34, 1, 255);
        c_put_str(TERM_L_BLUE, tmp, 1, 34);
 
        /* Erase the prompt, etc */
@@ -5932,7 +5926,7 @@ void do_cmd_suicide(void)
        flush();
 
        /* Verify Retirement */
-       if (total_winner)
+       if (p_ptr->total_winner)
        {
                /* Verify */
 #ifdef JP
@@ -5955,7 +5949,7 @@ if (!get_check("
        }
 
 
-       if (!noscore)
+       if (!p_ptr->noscore)
        {
                /* Special Verification for suicide */
 #ifdef JP
@@ -5971,15 +5965,15 @@ prt("
        }
 
        /* Stop playing */
-       alive = FALSE;
+       p_ptr->playing = FALSE;
 
        /* Kill the player */
-       death = TRUE;
+       p_ptr->is_dead = TRUE;
 
        /* Leaving */
        p_ptr->leaving = TRUE;
 
-       if (!total_winner)
+       if (!p_ptr->total_winner)
        {
 #ifdef JP
                do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¥À¥ó¥¸¥ç¥ó¤Îõº÷¤ËÀä˾¤·¤Æ¼«»¦¤·¤¿¡£");
@@ -5993,9 +5987,9 @@ prt("
 
        /* Cause of death */
 #ifdef JP
-(void)strcpy(died_from, "ÅÓÃ潪λ");
+(void)strcpy(p_ptr->died_from, "ÅÓÃ潪λ");
 #else
-       (void)strcpy(died_from, "Quitting");
+       (void)strcpy(p_ptr->died_from, "Quitting");
 #endif
 
 }
@@ -6042,9 +6036,9 @@ prt("
 
        /* The player is not dead */
 #ifdef JP
-(void)strcpy(died_from, "(¥»¡¼¥Ö)");
+(void)strcpy(p_ptr->died_from, "(¥»¡¼¥Ö)");
 #else
-       (void)strcpy(died_from, "(saved)");
+       (void)strcpy(p_ptr->died_from, "(saved)");
 #endif
 
 
@@ -6081,9 +6075,9 @@ prt("
 
        /* Note that the player is not dead */
 #ifdef JP
-(void)strcpy(died_from, "(¸µµ¤¤ËÀ¸¤­¤Æ¤¤¤ë)");
+(void)strcpy(p_ptr->died_from, "(¸µµ¤¤ËÀ¸¤­¤Æ¤¤¤ë)");
 #else
-       (void)strcpy(died_from, "(alive and well)");
+       (void)strcpy(p_ptr->died_from, "(alive and well)");
 #endif
 
 }
@@ -6094,7 +6088,7 @@ prt("
  */
 void do_cmd_save_and_exit(void)
 {
-       alive = FALSE;
+       p_ptr->playing = FALSE;
 
        /* Leaving */
        p_ptr->leaving = TRUE;
@@ -6161,7 +6155,7 @@ long total_points(void)
        if ((p_ptr->pseikaku == SEIKAKU_MUNCHKIN) && point)
        {
                point = 1;
-               if (total_winner) point = 2;
+               if (p_ptr->total_winner) point = 2;
        }
        if (easy_band) point = (0 - point);
 
@@ -6205,7 +6199,7 @@ static void make_bones(void)
 
 
        /* Ignore wizards and borgs */
-       if (!(noscore & 0x00FF))
+       if (!(p_ptr->noscore & 0x00FF))
        {
                /* Ignore people who die in town */
                if (dun_level)
@@ -6319,7 +6313,7 @@ static void print_tomb(void)
 
 
                /* King or Queen */
-               if (total_winner || (p_ptr->lev > PY_MAX_LEVEL))
+               if (p_ptr->total_winner || (p_ptr->lev > PY_MAX_LEVEL))
                {
 #ifdef JP
                 /* ±ÑÆüÀÚ¤êÂؤ¨ */
@@ -6381,34 +6375,34 @@ static void print_tomb(void)
 
 #ifdef JP
         /* Êè¤Ë¹ï¤à¸ÀÍÕ¤ò¥ª¥ê¥¸¥Ê¥ë¤è¤êºÙ¤«¤¯É½¼¨ */
-        if (streq(died_from, "ÅÓÃ潪λ"))
+        if (streq(p_ptr->died_from, "ÅÓÃ潪λ"))
         {
                 strcpy(tmp, "<¼«»¦>");
         }
         else
         {
-                if (streq(died_from, "ripe"))
+                if (streq(p_ptr->died_from, "ripe"))
                 {
                         strcpy(tmp, "°úÂà¸å¤ËÅ·¼÷¤òÁ´¤¦");
                 }
-                else if (streq(died_from, "Seppuku"))
+                else if (streq(p_ptr->died_from, "Seppuku"))
                 {
                         strcpy(tmp, "¾¡Íø¤Î¸å¡¢ÀÚÊ¢");
                 }
                 else
                 {
-                        strcpy(tmp, died_from);
+                        strcpy(tmp, p_ptr->died_from);
                 }
         }
         center_string(buf, tmp);
         put_str(buf, 14, 11);
 
-        if(!streq(died_from, "ripe") && !streq(died_from, "Seppuku"))
+        if(!streq(p_ptr->died_from, "ripe") && !streq(p_ptr->died_from, "Seppuku"))
         {
                 if( dun_level == 0 )
                 {
                        cptr town = (p_ptr->town_num ? "³¹" : "¹ÓÌî");
-                        if(streq(died_from, "ÅÓÃ潪λ"))
+                        if(streq(p_ptr->died_from, "ÅÓÃ潪λ"))
                         {
                                 sprintf(tmp, "%s¤Ç»à¤ó¤À", town);
                         }
@@ -6419,7 +6413,7 @@ static void print_tomb(void)
                 }
                 else
                 {
-                        if(streq(died_from, "ÅÓÃ潪λ"))
+                        if(streq(p_ptr->died_from, "ÅÓÃ潪λ"))
                         {
                                 sprintf(tmp, "Ãϲ¼ %d ³¬¤Ç»à¤ó¤À", dun_level);
                         }
@@ -6437,14 +6431,14 @@ static void print_tomb(void)
                put_str(buf, 14, 11);
 
 
-               if (strlen(died_from) > 24)
+               if (strlen(p_ptr->died_from) > 24)
                {
-                       strncpy(dummy, died_from, 24);
+                       strncpy(dummy, p_ptr->died_from, 24);
                        dummy[24] = '\0';
                        (void)sprintf(tmp, "by %s.", dummy);
                }
                else
-                       (void)sprintf(tmp, "by %s.", died_from);
+                       (void)sprintf(tmp, "by %s.", p_ptr->died_from);
 
                center_string(buf, tmp);
                put_str(buf, 15, 11);
@@ -6678,7 +6672,7 @@ msg_print("
 
 #ifndef SCORE_WIZARDS
        /* Wizard-mode pre-empts scoring */
-       if (noscore & 0x000F)
+       if (p_ptr->noscore & 0x000F)
        {
 #ifdef JP
 msg_print("¥¦¥£¥¶¡¼¥É¡¦¥â¡¼¥É¤Ç¤Ï¥¹¥³¥¢¤¬µ­Ï¿¤µ¤ì¤Þ¤»¤ó¡£");
@@ -6693,7 +6687,7 @@ msg_print("
 
 #ifndef SCORE_BORGS
        /* Borg-mode pre-empts scoring */
-       if (noscore & 0x00F0)
+       if (p_ptr->noscore & 0x00F0)
        {
 #ifdef JP
 msg_print("¥Ü¡¼¥°¡¦¥â¡¼¥É¤Ç¤Ï¥¹¥³¥¢¤¬µ­Ï¿¤µ¤ì¤Þ¤»¤ó¡£");
@@ -6708,7 +6702,7 @@ msg_print("
 
 #ifndef SCORE_CHEATERS
        /* Cheaters are not scored */
-       if (noscore & 0xFF00)
+       if (p_ptr->noscore & 0xFF00)
        {
 #ifdef JP
 msg_print("º¾µ½¤ò¤ä¤Ã¤¿¿Í¤Ï¥¹¥³¥¢¤¬µ­Ï¿¤µ¤ì¤Þ¤»¤ó¡£");
@@ -6723,9 +6717,9 @@ msg_print("
 
        /* Interupted */
 #ifdef JP
-if (!total_winner && streq(died_from, "¶¯À©½ªÎ»"))
+if (!p_ptr->total_winner && streq(p_ptr->died_from, "¶¯À©½ªÎ»"))
 #else
-       if (!total_winner && streq(died_from, "Interrupting"))
+       if (!p_ptr->total_winner && streq(p_ptr->died_from, "Interrupting"))
 #endif
 
        {
@@ -6741,9 +6735,9 @@ msg_print("
 
        /* Quitter */
 #ifdef JP
-if (!total_winner && streq(died_from, "ÅÓÃ潪λ"))
+if (!p_ptr->total_winner && streq(p_ptr->died_from, "ÅÓÃ潪λ"))
 #else
-       if (!total_winner && streq(died_from, "Quitting"))
+       if (!p_ptr->total_winner && streq(p_ptr->died_from, "Quitting"))
 #endif
 
        {
@@ -6797,10 +6791,10 @@ void close_game(void)
 
 
        /* Handle death */
-       if (death)
+       if (p_ptr->is_dead)
        {
                /* Handle retirement */
-               if (total_winner) kingly();
+               if (p_ptr->total_winner) kingly();
 
                /* Save memories */
 #ifdef JP
@@ -6839,8 +6833,8 @@ if (!save_player()) msg_print("
                                if (get_check_strict("Stand by for later score registration? ", (CHECK_NO_ESCAPE | CHECK_NO_HISTORY)))
 #endif
                                {
-                                       wait_report_score = TRUE;
-                                       death = FALSE;
+                                       p_ptr->wait_report_score = TRUE;
+                                       p_ptr->is_dead = FALSE;
 #ifdef JP
                                        if (!save_player()) msg_print("¥»¡¼¥Ö¼ºÇÔ¡ª");
 #else
@@ -6848,7 +6842,7 @@ if (!save_player()) msg_print("
 #endif
                                }
                        }
-                       if (!wait_report_score)
+                       if (!p_ptr->wait_report_score)
                                (void)top_twenty();
                }
                else if (highscore_fd >= 0)
@@ -6921,19 +6915,19 @@ if (!character_generated || character_saved) quit("
        disturb(1, 0);
 
        /* Mega-Hack -- Delay death */
-       if (p_ptr->chp < 0) death = FALSE;
+       if (p_ptr->chp < 0) p_ptr->is_dead = FALSE;
 
        /* Hardcode panic save */
-       panic_save = 1;
+       p_ptr->panic_save = 1;
 
        /* Forbid suspend */
        signals_ignore_tstp();
 
        /* Indicate panic save */
 #ifdef JP
-(void)strcpy(died_from, "(¶ÛµÞ¥»¡¼¥Ö)");
+(void)strcpy(p_ptr->died_from, "(¶ÛµÞ¥»¡¼¥Ö)");
 #else
-       (void)strcpy(died_from, "(panic save)");
+       (void)strcpy(p_ptr->died_from, "(panic save)");
 #endif
 
 
@@ -7329,13 +7323,13 @@ static void handle_signal_simple(int sig)
 
 
        /* Terminate dead characters */
-       if (death)
+       if (p_ptr->is_dead)
        {
                /* Mark the savefile */
 #ifdef JP
-(void)strcpy(died_from, "¶¯À©½ªÎ»");
+(void)strcpy(p_ptr->died_from, "¶¯À©½ªÎ»");
 #else
-               (void)strcpy(died_from, "Abortion");
+               (void)strcpy(p_ptr->died_from, "Abortion");
 #endif
 
                forget_lite();
@@ -7359,9 +7353,9 @@ quit("
        {
                /* Cause of "death" */
 #ifdef JP
-(void)strcpy(died_from, "¶¯À©½ªÎ»Ãæ");
+(void)strcpy(p_ptr->died_from, "¶¯À©½ªÎ»Ãæ");
 #else
-               (void)strcpy(died_from, "Interrupting");
+               (void)strcpy(p_ptr->died_from, "Interrupting");
 #endif
 
 
@@ -7370,10 +7364,10 @@ quit("
                clear_mon_lite();
 
                /* Stop playing */
-               alive = FALSE;
+               p_ptr->playing = FALSE;
 
                /* Suicide */
-               death = TRUE;
+               p_ptr->is_dead = TRUE;
 
                /* Leaving */
                p_ptr->leaving = TRUE;
@@ -7469,13 +7463,13 @@ Term_putstr(45, hgt - 1, -1, TERM_RED, "
        Term_fresh();
 
        /* Panic Save */
-       panic_save = 1;
+       p_ptr->panic_save = 1;
 
        /* Panic save */
 #ifdef JP
-(void)strcpy(died_from, "(¶ÛµÞ¥»¡¼¥Ö)");
+(void)strcpy(p_ptr->died_from, "(¶ÛµÞ¥»¡¼¥Ö)");
 #else
-       (void)strcpy(died_from, "(panic save)");
+       (void)strcpy(p_ptr->died_from, "(panic save)");
 #endif