From 4349e9eaf10441afe0794f432a67c2b833e8988f Mon Sep 17 00:00:00 2001 From: mogami Date: Wed, 12 Jun 2002 11:43:28 +0000 Subject: [PATCH] =?utf8?q?Vanilla=E3=81=AB=E3=81=AA=E3=82=89=E3=81=A3?= =?utf8?q?=E3=81=A6=E3=80=81=E3=82=AD=E3=83=A3=E3=83=A9=E3=82=AF=E3=82=BF?= =?utf8?q?=E3=83=BC=E3=81=AE=E7=8A=B6=E6=85=8B=E3=82=92=E8=A1=A8=E3=82=8F?= =?utf8?q?=E3=81=99=E3=82=B0=E3=83=AD=E3=83=BC=E3=83=90=E3=83=AB=E5=A4=89?= =?utf8?q?=E6=95=B0=E3=81=AE=E5=A4=9A=E3=81=8F=E3=82=92=20p=5Fptr=20?= =?utf8?q?=E3=81=AE=E4=B8=AD=E3=81=AB=E7=A7=BB=E3=81=97=E3=81=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/artifact.c | 2 +- src/birth.c | 116 ++++++++++++++++++++--------------------- src/cmd1.c | 62 +++++++++++----------- src/cmd2.c | 16 +++--- src/cmd4.c | 58 ++++++++++----------- src/cmd5.c | 107 ++++++++++++++++++++------------------ src/dungeon.c | 102 ++++++++++++++++++------------------ src/effects.c | 116 ++++++++++++++++++++--------------------- src/externs.h | 24 +-------- src/files.c | 132 +++++++++++++++++++++++----------------------- src/hissatsu.c | 28 +++++----- src/load.c | 82 ++++++++++++++--------------- src/mane.c | 30 +++++------ src/melee1.c | 68 ++++++++++++------------ src/melee2.c | 2 +- src/monster1.c | 2 +- src/monster2.c | 2 +- src/mspells1.c | 20 +++---- src/mspells2.c | 20 +++---- src/object2.c | 14 ++--- src/racial.c | 2 +- src/report.c | 2 +- src/save.c | 56 ++++++++++---------- src/scores.c | 16 +++--- src/spells1.c | 2 +- src/spells2.c | 2 +- src/spells3.c | 40 +++++++------- src/types.h | 161 +++++++++++++++++++++++++++++++++++---------------------- src/util.c | 2 +- src/variable.c | 52 ------------------- src/wild.c | 4 +- src/wizard2.c | 26 +++++----- src/xtra1.c | 82 ++++++++++++++--------------- src/xtra2.c | 6 +-- 34 files changed, 711 insertions(+), 745 deletions(-) diff --git a/src/artifact.c b/src/artifact.c index 95877e0d3..c98b6d804 100644 --- a/src/artifact.c +++ b/src/artifact.c @@ -1661,7 +1661,7 @@ bool create_artifact(object_type *o_ptr, bool a_scroll) random_slay(o_ptr); break; default: - if (wizard) msg_print("Switch error in create_artifact!"); + if (p_ptr->wizard) msg_print("Switch error in create_artifact!"); powers++; } }; diff --git a/src/birth.c b/src/birth.c index dbb32bf1f..85c98f331 100644 --- a/src/birth.c +++ b/src/birth.c @@ -2464,7 +2464,7 @@ static void save_prev_data(birther *birther_ptr) /* Save the hp */ for (i = 0; i < PY_MAX_LEVEL; i++) { - birther_ptr->player_hp[i] = player_hp[i]; + birther_ptr->player_hp[i] = p_ptr->player_hp[i]; } birther_ptr->chaos_patron = p_ptr->chaos_patron; @@ -2478,7 +2478,7 @@ static void save_prev_data(birther *birther_ptr) /* Save the history */ for (i = 0; i < 4; i++) { - strcpy(birther_ptr->history[i], history[i]); + strcpy(birther_ptr->history[i], p_ptr->history[i]); } } @@ -2521,10 +2521,10 @@ static void load_prev_data(bool swap) /* Load the hp */ for (i = 0; i < PY_MAX_LEVEL; i++) { - player_hp[i] = previous_char.player_hp[i]; + p_ptr->player_hp[i] = previous_char.player_hp[i]; } - p_ptr->mhp = player_hp[0]; - p_ptr->chp = player_hp[0]; + p_ptr->mhp = p_ptr->player_hp[0]; + p_ptr->chp = p_ptr->player_hp[0]; p_ptr->chaos_patron = previous_char.chaos_patron; @@ -2536,7 +2536,7 @@ static void load_prev_data(bool swap) /* Load the history */ for (i = 0; i < 4; i++) { - strcpy(history[i], previous_char.history[i]); + strcpy(p_ptr->history[i], previous_char.history[i]); } /*** Save the previous data ***/ @@ -2721,21 +2721,21 @@ static void get_extra(bool roll_hitdie) for (i = 0; i < 64; i++) { - if (p_ptr->pclass == CLASS_SORCERER) spell_exp[i] = 1600; - else if (p_ptr->pclass == CLASS_RED_MAGE) spell_exp[i] = 1200; - else spell_exp[i] = 0; + if (p_ptr->pclass == CLASS_SORCERER) p_ptr->spell_exp[i] = 1600; + else if (p_ptr->pclass == CLASS_RED_MAGE) p_ptr->spell_exp[i] = 1200; + else p_ptr->spell_exp[i] = 0; } for (i = 0; i < 5; i++) for (j = 0; j < 64; j++) - weapon_exp[i][j] = s_info[p_ptr->pclass].w_start[i][j]; + p_ptr->weapon_exp[i][j] = s_info[p_ptr->pclass].w_start[i][j]; if(p_ptr->pseikaku == SEIKAKU_SEXY) { - weapon_exp[TV_HAFTED-TV_BOW][SV_WHIP] = 4000; + p_ptr->weapon_exp[TV_HAFTED-TV_BOW][SV_WHIP] = 4000; } for (i = 0; i < 10; i++) - skill_exp[i] = s_info[p_ptr->pclass].s_start[i]; + p_ptr->skill_exp[i] = s_info[p_ptr->pclass].s_start[i]; /* Hitdice */ if (p_ptr->pclass == CLASS_SORCERER) @@ -2758,26 +2758,26 @@ static void get_extra(bool roll_hitdie) while (TRUE) { /* Pre-calculate level 1 hitdice */ - player_hp[0] = p_ptr->hitdie; + p_ptr->player_hp[0] = p_ptr->hitdie; for (i = 1; i < 4; i++) { j = randint1(p_ptr->hitdie); - player_hp[0] += j; + p_ptr->player_hp[0] += j; } /* Roll the hitpoint values */ for (i = 1; i < PY_MAX_LEVEL; i++) { j = randint1(p_ptr->hitdie); - player_hp[i] = player_hp[i - 1] + j; + p_ptr->player_hp[i] = p_ptr->player_hp[i - 1] + j; } /* XXX Could also require acceptable "mid-level" hitpoints */ /* Require "valid" hitpoints at highest level */ - if (player_hp[PY_MAX_LEVEL - 1] < min_value) continue; - if (player_hp[PY_MAX_LEVEL - 1] > max_value) continue; + if (p_ptr->player_hp[PY_MAX_LEVEL - 1] < min_value) continue; + if (p_ptr->player_hp[PY_MAX_LEVEL - 1] > max_value) continue; /* Acceptable */ break; @@ -2785,7 +2785,7 @@ static void get_extra(bool roll_hitdie) } /* Initial hitpoints */ - p_ptr->mhp = player_hp[0]; + p_ptr->mhp = p_ptr->player_hp[0]; } @@ -2801,7 +2801,7 @@ static void get_history(void) char buf[240]; /* Clear the previous history strings */ - for (i = 0; i < 4; i++) history[i][0] = '\0'; + for (i = 0; i < 4; i++) p_ptr->history[i][0] = '\0'; /* Clear the history text */ buf[0] = '\0'; @@ -3041,7 +3041,7 @@ static void get_history(void) t = temp; for(i=0 ; i<4 ; i++){ if(t[0]==0)break; - else {strcpy(history[i], t);t += strlen(t)+1;} + else {strcpy(p_ptr->history[i], t);t += strlen(t)+1;} } } } @@ -3191,7 +3191,7 @@ static void player_wipe(void) /* Wipe the history */ for (i = 0; i < 4; i++) { - strcpy(history[i], ""); + strcpy(p_ptr->history[i], ""); } /* Wipe the quests */ @@ -3258,16 +3258,16 @@ static void player_wipe(void) /* Wipe the spells */ if (p_ptr->pclass == CLASS_SORCERER) { - spell_learned1 = spell_learned2 = 0xffffffffL; - spell_worked1 = spell_worked2 = 0xffffffffL; + p_ptr->spell_learned1 = p_ptr->spell_learned2 = 0xffffffffL; + p_ptr->spell_worked1 = p_ptr->spell_worked2 = 0xffffffffL; } else { - spell_learned1 = spell_learned2 = 0L; - spell_worked1 = spell_worked2 = 0L; + p_ptr->spell_learned1 = p_ptr->spell_learned2 = 0L; + p_ptr->spell_worked1 = p_ptr->spell_worked2 = 0L; } - spell_forgotten1 = spell_forgotten2 = 0L; - for (i = 0; i < 64; i++) spell_order[i] = 99; + p_ptr->spell_forgotten1 = p_ptr->spell_forgotten2 = 0L; + for (i = 0; i < 64; i++) p_ptr->spell_order[i] = 99; p_ptr->learned_spells = 0; p_ptr->add_spells = 0; p_ptr->knowledge = 0; @@ -3284,19 +3284,19 @@ static void player_wipe(void) cheat_live = FALSE; /* Assume no winning game */ - total_winner = FALSE; + p_ptr->total_winner = FALSE; world_player = FALSE; /* Assume no panic save */ - panic_save = 0; + p_ptr->panic_save = 0; /* Assume no cheating */ - noscore = 0; - wizard = FALSE; + p_ptr->noscore = 0; + p_ptr->wizard = FALSE; /* Not waiting to report score */ - wait_report_score = FALSE; + p_ptr->wait_report_score = FALSE; /* Default pet command settings */ p_ptr->pet_follow_distance = PET_FOLLOW_DIST; @@ -3329,10 +3329,10 @@ static void player_wipe(void) p_ptr->leftbldg = FALSE; for (i = 0; i < MAX_MANE; i++) { - mane_spell[i] = -1; - mane_dam[i] = 0; + p_ptr->mane_spell[i] = -1; + p_ptr->mane_dam[i] = 0; } - mane_num = 0; + p_ptr->mane_num = 0; p_ptr->exit_bldg = TRUE; /* only used for arena now -KMW- */ /* Reset rewards */ @@ -5132,15 +5132,15 @@ static void edit_history(void) /* Edit character background */ for (i = 0; i < 4; i++) { - sprintf(old_history[i], "%s", history[i]); + sprintf(old_history[i], "%s", p_ptr->history[i]); } /* Turn 0 to space */ for (i = 0; i < 4; i++) { - for (j = 0; history[i][j]; j++) /* loop */; + for (j = 0; p_ptr->history[i][j]; j++) /* loop */; - for (; j < 59; j++) history[i][j] = ' '; - history[i][59] = '\0'; + for (; j < 59; j++) p_ptr->history[i][j] = ' '; + p_ptr->history[i][59] = '\0'; } display_player(1); #ifdef JP @@ -5153,14 +5153,14 @@ static void edit_history(void) { for (i = 0; i < 4; i++) { - put_str(history[i], i + 12, 10); + put_str(p_ptr->history[i], i + 12, 10); } #ifdef JP - if (iskanji2(history[y], x)) - c_put_str(TERM_L_BLUE, format("%c%c", history[y][x],history[y][x+1]), y + 12, x + 10); + if (iskanji2(p_ptr->history[y], x)) + c_put_str(TERM_L_BLUE, format("%c%c", p_ptr->history[y][x],p_ptr->history[y][x+1]), y + 12, x + 10); else #endif - c_put_str(TERM_L_BLUE, format("%c", history[y][x]), y + 12, x + 10); + c_put_str(TERM_L_BLUE, format("%c", p_ptr->history[y][x]), y + 12, x + 10); /* Place cursor just after cost of current stat */ Term_gotoxy(x + 10, y + 12); @@ -5172,7 +5172,7 @@ static void edit_history(void) y--; if (y < 0) y = 3; #ifdef JP - if ((x > 0) && (iskanji2(history[y], x-1))) x--; + if ((x > 0) && (iskanji2(p_ptr->history[y], x-1))) x--; #endif } else if (c == '2') @@ -5180,13 +5180,13 @@ static void edit_history(void) y++; if (y > 3) y = 0; #ifdef JP - if ((x > 0) && (iskanji2(history[y], x-1))) x--; + if ((x > 0) && (iskanji2(p_ptr->history[y], x-1))) x--; #endif } else if (c == '6') { #ifdef JP - if (iskanji2(history[y], x)) x++; + if (iskanji2(p_ptr->history[y], x)) x++; #endif x++; if (x > 58) x = 0; @@ -5195,7 +5195,7 @@ static void edit_history(void) { x--; #ifdef JP - if ((x > 0) && (iskanji2(history[y], x-1))) x--; + if ((x > 0) && (iskanji2(p_ptr->history[y], x-1))) x--; #endif if (x < 0) x = 58; } @@ -5207,20 +5207,20 @@ static void edit_history(void) { for (i = 0; i < 4; i++) { - sprintf(history[i], "%s", old_history[i]); - put_str(history[i], i + 12, 10); + sprintf(p_ptr->history[i], "%s", old_history[i]); + put_str(p_ptr->history[i], i + 12, 10); } break; } else if (c == '\010') { x--; - history[y][x] = ' '; + p_ptr->history[y][x] = ' '; #ifdef JP - if ((x > 0) && (iskanji2(history[y], x-1))) + if ((x > 0) && (iskanji2(p_ptr->history[y], x-1))) { x--; - history[y][x] = ' '; + p_ptr->history[y][x] = ' '; } #endif if (x < 0) x = 58; @@ -5232,9 +5232,9 @@ static void edit_history(void) #endif { #ifdef JP - if (iskanji2(history[y], x)) + if (iskanji2(p_ptr->history[y], x)) { - history[y][x+1] = ' '; + p_ptr->history[y][x+1] = ' '; } if (iskanji(c)) @@ -5246,17 +5246,17 @@ static void edit_history(void) if (y > 3) y = 0; } - if (iskanji2(history[y], x+1)) + if (iskanji2(p_ptr->history[y], x+1)) { - history[y][x+2] = ' '; + p_ptr->history[y][x+2] = ' '; } - history[y][x++] = c; + p_ptr->history[y][x++] = c; c = inkey(); } #endif - history[y][x++] = c; + p_ptr->history[y][x++] = c; if (x > 58) { x = 0; diff --git a/src/cmd1.c b/src/cmd1.c index 215221620..9e4ff68e1 100644 --- a/src/cmd1.c +++ b/src/cmd1.c @@ -1720,7 +1720,7 @@ static void natural_attack(s16b m_idx, int attack, bool *fear, bool *mdeath) k = mon_damage_mod(m_ptr, k, FALSE); /* Complex message */ - if (wizard) + if (p_ptr->wizard) { #ifdef JP msg_format("%d/%d ¤Î¥À¥á¡¼¥¸¤òÍ¿¤¨¤¿¡£", k, m_ptr->hp); @@ -1840,16 +1840,16 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int { if ((r_ptr->level + 10) > p_ptr->lev) { - if (skill_exp[GINOU_SUDE] < s_info[p_ptr->pclass].s_max[GINOU_SUDE]) + if (p_ptr->skill_exp[GINOU_SUDE] < s_info[p_ptr->pclass].s_max[GINOU_SUDE]) { - if (skill_exp[GINOU_SUDE] < 4000) - skill_exp[GINOU_SUDE]+=40; - else if((skill_exp[GINOU_SUDE] < 6000)) - skill_exp[GINOU_SUDE]+=5; - else if((skill_exp[GINOU_SUDE] < 7000) && (p_ptr->lev > 19)) - skill_exp[GINOU_SUDE]+=1; - else if((skill_exp[GINOU_SUDE] < 8000) && (p_ptr->lev > 34)) - if (one_in_(3)) skill_exp[GINOU_SUDE]+=1; + if (p_ptr->skill_exp[GINOU_SUDE] < 4000) + p_ptr->skill_exp[GINOU_SUDE]+=40; + else if((p_ptr->skill_exp[GINOU_SUDE] < 6000)) + p_ptr->skill_exp[GINOU_SUDE]+=5; + else if((p_ptr->skill_exp[GINOU_SUDE] < 7000) && (p_ptr->lev > 19)) + p_ptr->skill_exp[GINOU_SUDE]+=1; + else if((p_ptr->skill_exp[GINOU_SUDE] < 8000) && (p_ptr->lev > 34)) + if (one_in_(3)) p_ptr->skill_exp[GINOU_SUDE]+=1; p_ptr->update |= (PU_BONUS); } } @@ -1860,7 +1860,7 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int { int tval = inventory[INVEN_RARM+hand].tval - TV_BOW; int sval = inventory[INVEN_RARM+hand].sval; - int now_exp = weapon_exp[tval][sval]; + int now_exp = p_ptr->weapon_exp[tval][sval]; if (now_exp < s_info[p_ptr->pclass].w_max[tval][sval]) { int amount = 0; @@ -1868,7 +1868,7 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int else if(now_exp < 6000) amount = 10; else if((now_exp < 7000) && (p_ptr->lev > 19)) amount = 1; else if((p_ptr->lev > 34) && one_in_(2)) amount = 1; - weapon_exp[tval][sval] += amount; + p_ptr->weapon_exp[tval][sval] += amount; p_ptr->update |= (PU_BONUS); } } @@ -1907,7 +1907,7 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int else num_blow = p_ptr->num_blow[hand]; /* Attack once for each legal blow */ - while ((num++ < num_blow) && !death) + while ((num++ < num_blow) && !p_ptr->is_dead) { if (((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) || (mode == HISSATSU_KYUSHO)) { @@ -2067,7 +2067,7 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int { old_ptr = ma_ptr; - if (wizard && cheat_xtra) + if (p_ptr->wizard && cheat_xtra) { #ifdef JP msg_print("¹¶·â¤òºÆÁªÂò¤·¤Þ¤·¤¿¡£"); @@ -2470,7 +2470,7 @@ msg_format(" } /* Complex message */ - if (wizard || cheat_xtra) + if (p_ptr->wizard || cheat_xtra) { #ifdef JP msg_format("%d/%d ¤Î¥À¥á¡¼¥¸¤òÍ¿¤¨¤¿¡£", k, m_ptr->hp); @@ -3050,16 +3050,16 @@ bool py_attack(int y, int x, int mode) if (p_ptr->migite && p_ptr->hidarite) { - if ((skill_exp[GINOU_NITOURYU] < s_info[p_ptr->pclass].s_max[GINOU_NITOURYU]) && ((skill_exp[GINOU_NITOURYU] - 1000) / 200 < r_info[m_ptr->r_idx].level)) + if ((p_ptr->skill_exp[GINOU_NITOURYU] < s_info[p_ptr->pclass].s_max[GINOU_NITOURYU]) && ((p_ptr->skill_exp[GINOU_NITOURYU] - 1000) / 200 < r_info[m_ptr->r_idx].level)) { - if (skill_exp[GINOU_NITOURYU] < 4000) - skill_exp[GINOU_NITOURYU]+=80; - else if(skill_exp[GINOU_NITOURYU] < 6000) - skill_exp[GINOU_NITOURYU]+=4; - else if(skill_exp[GINOU_NITOURYU] < 7000) - skill_exp[GINOU_NITOURYU]+=1; - else if(skill_exp[GINOU_NITOURYU] < 8000) - if (one_in_(3)) skill_exp[GINOU_NITOURYU]+=1; + if (p_ptr->skill_exp[GINOU_NITOURYU] < 4000) + p_ptr->skill_exp[GINOU_NITOURYU]+=80; + else if(p_ptr->skill_exp[GINOU_NITOURYU] < 6000) + p_ptr->skill_exp[GINOU_NITOURYU]+=4; + else if(p_ptr->skill_exp[GINOU_NITOURYU] < 7000) + p_ptr->skill_exp[GINOU_NITOURYU]+=1; + else if(p_ptr->skill_exp[GINOU_NITOURYU] < 8000) + if (one_in_(3)) p_ptr->skill_exp[GINOU_NITOURYU]+=1; p_ptr->update |= (PU_BONUS); } } @@ -3067,13 +3067,13 @@ bool py_attack(int y, int x, int mode) if (p_ptr->riding) { int ridinglevel = r_info[m_list[p_ptr->riding].r_idx].level; - if ((skill_exp[GINOU_RIDING] < s_info[p_ptr->pclass].s_max[GINOU_RIDING]) && ((skill_exp[GINOU_RIDING] - 1000) / 200 < r_info[m_ptr->r_idx].level) && (skill_exp[GINOU_RIDING]/100 - 2000 < ridinglevel)) - skill_exp[GINOU_RIDING]++; - if ((skill_exp[GINOU_RIDING] < s_info[p_ptr->pclass].s_max[GINOU_RIDING]) && (skill_exp[GINOU_RIDING]/100 < ridinglevel)) + if ((p_ptr->skill_exp[GINOU_RIDING] < s_info[p_ptr->pclass].s_max[GINOU_RIDING]) && ((p_ptr->skill_exp[GINOU_RIDING] - 1000) / 200 < r_info[m_ptr->r_idx].level) && (p_ptr->skill_exp[GINOU_RIDING]/100 - 2000 < ridinglevel)) + p_ptr->skill_exp[GINOU_RIDING]++; + if ((p_ptr->skill_exp[GINOU_RIDING] < s_info[p_ptr->pclass].s_max[GINOU_RIDING]) && (p_ptr->skill_exp[GINOU_RIDING]/100 < ridinglevel)) { - if (ridinglevel*100 > (skill_exp[GINOU_RIDING] + 1500)) - skill_exp[GINOU_RIDING] += (1+(ridinglevel - skill_exp[GINOU_RIDING]/100 - 15)); - else skill_exp[GINOU_RIDING]++; + if (ridinglevel*100 > (p_ptr->skill_exp[GINOU_RIDING] + 1500)) + p_ptr->skill_exp[GINOU_RIDING] += (1+(ridinglevel - p_ptr->skill_exp[GINOU_RIDING]/100 - 15)); + else p_ptr->skill_exp[GINOU_RIDING]++; } p_ptr->update |= (PU_BONUS); } @@ -3232,7 +3232,7 @@ static bool pattern_seq(int c_y, int c_x, int n_y, int n_x) ok_move = FEAT_PATTERN_1; break; default: - if (wizard) + if (p_ptr->wizard) #ifdef JP msg_format("¤ª¤«¤·¤Ê¥Ñ¥¿¡¼¥óÊâ¹Ô¡¢%d¡£", cave[c_y][c_x]); #else diff --git a/src/cmd2.c b/src/cmd2.c index d6d812bd8..7471da31f 100644 --- a/src/cmd2.c +++ b/src/cmd2.c @@ -3567,9 +3567,9 @@ void do_cmd_fire_aux(int item, object_type *j_ptr) /* Actually "fire" the object */ bonus = (p_ptr->to_h_b + o_ptr->to_h + j_ptr->to_h); if ((j_ptr->sval == SV_LIGHT_XBOW) || (j_ptr->sval == SV_HEAVY_XBOW)) - chance = (p_ptr->skill_thb + ((weapon_exp[0][j_ptr->sval])/400 + bonus) * BTH_PLUS_ADJ); + chance = (p_ptr->skill_thb + ((p_ptr->weapon_exp[0][j_ptr->sval])/400 + bonus) * BTH_PLUS_ADJ); else - chance = (p_ptr->skill_thb + ((weapon_exp[0][j_ptr->sval]-4000)/200 + bonus) * BTH_PLUS_ADJ); + chance = (p_ptr->skill_thb + ((p_ptr->weapon_exp[0][j_ptr->sval]-4000)/200 + bonus) * BTH_PLUS_ADJ); energy_use = bow_energy(j_ptr->sval); tmul = bow_tmul(j_ptr->sval); @@ -3721,7 +3721,7 @@ void do_cmd_fire_aux(int item, object_type *j_ptr) if ((r_ptr->level + 10) > p_ptr->lev) { - int now_exp = weapon_exp[0][j_ptr->sval]; + int now_exp = p_ptr->weapon_exp[0][j_ptr->sval]; if (now_exp < s_info[p_ptr->pclass].w_max[0][j_ptr->sval]) { int amount = 0; @@ -3729,16 +3729,16 @@ void do_cmd_fire_aux(int item, object_type *j_ptr) else if (now_exp < 6000) amount = 25; else if ((now_exp < 7000) && (p_ptr->lev > 19)) amount = 10; else if (p_ptr->lev > 34) amount = 2; - weapon_exp[0][j_ptr->sval] += amount; + p_ptr->weapon_exp[0][j_ptr->sval] += amount; p_ptr->update |= (PU_BONUS); } } if (p_ptr->riding) { - if (skill_exp[GINOU_RIDING] < s_info[p_ptr->pclass].s_max[GINOU_RIDING] && ((skill_exp[GINOU_RIDING] - 1000) / 200 < r_info[m_list[p_ptr->riding].r_idx].level) && one_in_(2)) + if (p_ptr->skill_exp[GINOU_RIDING] < s_info[p_ptr->pclass].s_max[GINOU_RIDING] && ((p_ptr->skill_exp[GINOU_RIDING] - 1000) / 200 < r_info[m_list[p_ptr->riding].r_idx].level) && one_in_(2)) { - skill_exp[GINOU_RIDING]+=1; + p_ptr->skill_exp[GINOU_RIDING]+=1; p_ptr->update |= (PU_BONUS); } } @@ -3828,7 +3828,7 @@ note_dies = " tdam = mon_damage_mod(m_ptr, tdam, FALSE); /* Complex message */ - if (wizard || cheat_xtra) + if (p_ptr->wizard || cheat_xtra) { #ifdef JP msg_format("%d/%d ¤Î¥À¥á¡¼¥¸¤òÍ¿¤¨¤¿¡£", @@ -4433,7 +4433,7 @@ note_dies = " tdam = mon_damage_mod(m_ptr, tdam, FALSE); /* Complex message */ - if (wizard) + if (p_ptr->wizard) { #ifdef JP msg_format("%d/%d¤Î¥À¥á¡¼¥¸¤òÍ¿¤¨¤¿¡£", diff --git a/src/cmd4.c b/src/cmd4.c index 887a95036..b767495a4 100644 --- a/src/cmd4.c +++ b/src/cmd4.c @@ -1544,13 +1544,13 @@ static void do_cmd_options_cheat(cptr info) case 'Y': case '6': { - if(!noscore) + if(!p_ptr->noscore) #ifdef JP do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "º¾µ½¥ª¥×¥·¥ç¥ó¤òON¤Ë¤·¤Æ¡¢¥¹¥³¥¢¤ò»Ä¤»¤Ê¤¯¤Ê¤Ã¤¿¡£"); #else do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up sending score to use cheating options."); #endif - noscore |= (cheat_info[k].o_set * 256 + cheat_info[k].o_bit); + p_ptr->noscore |= (cheat_info[k].o_set * 256 + cheat_info[k].o_bit); (*cheat_info[k].o_var) = TRUE; k = (k + 1) % n; break; @@ -5997,17 +5997,17 @@ static void do_cmd_knowledge_weapon_exp(void) { if((k_ptr->tval == TV_BOW) && (k_ptr->sval == SV_CRIMSON)) continue; - if(weapon_exp[4-i][num]<4000) shougou=0; - else if(weapon_exp[4-i][num]<6000) shougou=1; - else if(weapon_exp[4-i][num]<7000) shougou=2; - else if(weapon_exp[4-i][num]<8000) shougou=3; + if(p_ptr->weapon_exp[4-i][num]<4000) shougou=0; + else if(p_ptr->weapon_exp[4-i][num]<6000) shougou=1; + else if(p_ptr->weapon_exp[4-i][num]<7000) shougou=2; + else if(p_ptr->weapon_exp[4-i][num]<8000) shougou=3; else shougou=4; strip_name(tmp, j); fprintf(fff,"%-25s ",tmp); - if (weapon_exp[4-i][num] >= s_info[p_ptr->pclass].w_max[4-i][num]) fprintf(fff,"!"); + if (p_ptr->weapon_exp[4-i][num] >= s_info[p_ptr->pclass].w_max[4-i][num]) fprintf(fff,"!"); else fprintf(fff," "); fprintf(fff,"%s",shougou_moji[shougou]); - if (cheat_xtra) fprintf(fff," %d",weapon_exp[4-i][num]); + if (cheat_xtra) fprintf(fff," %d",p_ptr->weapon_exp[4-i][num]); fprintf(fff,"\n"); break; } @@ -6073,10 +6073,10 @@ static void do_cmd_knowledge_spell_exp(void) s_ptr = &mp_ptr->info[p_ptr->realm1 - 1][i]; } if(s_ptr->slevel == 99) continue; - if(spell_exp[i]<900) shougou=0; - else if(spell_exp[i]<1200) shougou=1; - else if(spell_exp[i]<1400) shougou=2; - else if(spell_exp[i]<1600) shougou=3; + if(p_ptr->spell_exp[i]<900) shougou=0; + else if(p_ptr->spell_exp[i]<1200) shougou=1; + else if(p_ptr->spell_exp[i]<1400) shougou=2; + else if(p_ptr->spell_exp[i]<1600) shougou=3; else shougou=4; fprintf(fff,"%-25s ",spell_names[technic2magic(p_ptr->realm1)-1][i]); if (p_ptr->realm1 == REALM_HISSATSU) @@ -6087,7 +6087,7 @@ static void do_cmd_knowledge_spell_exp(void) else fprintf(fff," "); fprintf(fff,"%s",shougou_moji[shougou]); } - if (cheat_xtra) fprintf(fff," %d",spell_exp[i]); + if (cheat_xtra) fprintf(fff," %d",p_ptr->spell_exp[i]); fprintf(fff,"\n"); } } @@ -6107,15 +6107,15 @@ static void do_cmd_knowledge_spell_exp(void) } if(s_ptr->slevel == 99) continue; - if(spell_exp[i+32]<900) shougou=0; - else if(spell_exp[i+32]<1200) shougou=1; - else if(spell_exp[i+32]<1400) shougou=2; + if(p_ptr->spell_exp[i+32]<900) shougou=0; + else if(p_ptr->spell_exp[i+32]<1200) shougou=1; + else if(p_ptr->spell_exp[i+32]<1400) shougou=2; else shougou=3; fprintf(fff,"%-25s ",spell_names[technic2magic(p_ptr->realm2)-1][i]); if (shougou == 3) fprintf(fff,"!"); else fprintf(fff," "); fprintf(fff,"%s",shougou_moji[shougou]); - if (cheat_xtra) fprintf(fff," %d",spell_exp[i+32]); + if (cheat_xtra) fprintf(fff," %d",p_ptr->spell_exp[i+32]); fprintf(fff,"\n"); } } @@ -6168,25 +6168,25 @@ static void do_cmd_knowledge_skill_exp(void) { if(i == GINOU_RIDING) { - if(skill_exp[i]<500) shougou=0; - else if(skill_exp[i]<2000) shougou=1; - else if(skill_exp[i]<5000) shougou=2; - else if(skill_exp[i]<8000) shougou=3; + if(p_ptr->skill_exp[i]<500) shougou=0; + else if(p_ptr->skill_exp[i]<2000) shougou=1; + else if(p_ptr->skill_exp[i]<5000) shougou=2; + else if(p_ptr->skill_exp[i]<8000) shougou=3; else shougou=4; } else { - if(skill_exp[i]<4000) shougou=0; - else if(skill_exp[i]<6000) shougou=1; - else if(skill_exp[i]<7000) shougou=2; - else if(skill_exp[i]<8000) shougou=3; + if(p_ptr->skill_exp[i]<4000) shougou=0; + else if(p_ptr->skill_exp[i]<6000) shougou=1; + else if(p_ptr->skill_exp[i]<7000) shougou=2; + else if(p_ptr->skill_exp[i]<8000) shougou=3; else shougou=4; } fprintf(fff,"%-20s ",skill_name[i]); - if (skill_exp[i] == s_info[p_ptr->pclass].s_max[i]) fprintf(fff,"!"); + if (p_ptr->skill_exp[i] == s_info[p_ptr->pclass].s_max[i]) fprintf(fff,"!"); else fprintf(fff," "); fprintf(fff,"%s",shougou_moji[shougou]); - if (cheat_xtra) fprintf(fff," %d",skill_exp[i]); + if (cheat_xtra) fprintf(fff," %d",p_ptr->skill_exp[i]); fprintf(fff,"\n"); } @@ -6866,7 +6866,7 @@ static void do_cmd_knowledge_stat(void) if (fff) { - percent = (int)(((long)player_hp[PY_MAX_LEVEL - 1] * 200L) / + percent = (int)(((long)p_ptr->player_hp[PY_MAX_LEVEL - 1] * 200L) / (2 * p_ptr->hitdie + ((PY_MAX_LEVEL - 1+3) * (p_ptr->hitdie + 1)))); @@ -7236,7 +7236,7 @@ sprintf(rand_tmp_str,"%s (%d if (!total) fprintf(fff, "Nothing.\n"); #endif - if (wizard) { + if (p_ptr->wizard) { #ifdef JP fprintf(fff, "\n¡Ô»Ä¤ê¤Î¥é¥ó¥À¥à¥¯¥¨¥¹¥È¡Õ\n"); #else diff --git a/src/cmd5.c b/src/cmd5.c index 7880da824..ac9ff3646 100644 --- a/src/cmd5.c +++ b/src/cmd5.c @@ -287,12 +287,8 @@ static int get_spell(int *sn, cptr prompt, int sval, bool learned, int use_realm } else { - if (p_ptr->pclass == CLASS_SORCERER) - shouhimana = s_ptr->smana*2200 + 2399; - else if (p_ptr->pclass == CLASS_RED_MAGE) - shouhimana = s_ptr->smana*2600 + 2399; - else - shouhimana = (s_ptr->smana*(3800-spell_exp[spell])+2399); + /* Extract mana consumption rate */ + shouhimana = s_ptr->smana*(3800 - experience_of_spell(spell, use_realm)) + 2399; if(p_ptr->dec_mana) shouhimana *= 3; else shouhimana *= 4; @@ -573,19 +569,19 @@ static void change_realm2(int next_realm) for (i = 0; i < 64; i++) { - spell_order[j] = spell_order[i]; - if(spell_order[i] < 32) j++; + p_ptr->spell_order[j] = p_ptr->spell_order[i]; + if(p_ptr->spell_order[i] < 32) j++; } for (; j < 64; j++) - spell_order[j] = 99; + p_ptr->spell_order[j] = 99; for (i = 32; i < 64; i++) { - spell_exp[i] = 0; + p_ptr->spell_exp[i] = 0; } - spell_learned2 = 0L; - spell_worked2 = 0L; - spell_forgotten2 = 0L; + p_ptr->spell_learned2 = 0L; + p_ptr->spell_worked2 = 0L; + p_ptr->spell_forgotten2 = 0L; #ifdef JP sprintf(tmp,"ËâË¡¤ÎÎΰè¤ò%s¤«¤é%s¤ËÊѹ¹¤·¤¿¡£", realm_names[p_ptr->realm2], realm_names[next_realm]); @@ -803,19 +799,19 @@ msg_format(" /* Learn the spell */ if (spell < 32) { - if (spell_learned1 & (1L << spell)) learned = TRUE; - else spell_learned1 |= (1L << spell); + if (p_ptr->spell_learned1 & (1L << spell)) learned = TRUE; + else p_ptr->spell_learned1 |= (1L << spell); } else { - if (spell_learned2 & (1L << (spell - 32))) learned = TRUE; - else spell_learned2 |= (1L << (spell - 32)); + if (p_ptr->spell_learned2 & (1L << (spell - 32))) learned = TRUE; + else p_ptr->spell_learned2 |= (1L << (spell - 32)); } if (learned) { int max_exp = (spell < 32) ? 1600 : 1400; - int old_exp = spell_exp[spell]; + int old_exp = p_ptr->spell_exp[spell]; int new_rank = 0; cptr name = spell_names[technic2magic(increment ? p_ptr->realm2 : p_ptr->realm1)-1][spell%32]; @@ -838,23 +834,23 @@ msg_format(" } else if (old_exp >= 1400) { - spell_exp[spell] = 1600; + p_ptr->spell_exp[spell] = 1600; new_rank = 4; } else if (old_exp >= 1200) { - if (spell >= 32) spell_exp[spell] = 1400; - else spell_exp[spell] += 200; + if (spell >= 32) p_ptr->spell_exp[spell] = 1400; + else p_ptr->spell_exp[spell] += 200; new_rank = 3; } else if (old_exp >= 900) { - spell_exp[spell] = 1200+(old_exp-900)*2/3; + p_ptr->spell_exp[spell] = 1200+(old_exp-900)*2/3; new_rank = 2; } else { - spell_exp[spell] = 900+(old_exp)/3; + p_ptr->spell_exp[spell] = 900+(old_exp)/3; new_rank = 1; } #ifdef JP @@ -865,15 +861,15 @@ msg_format(" } else { - /* Find the next open entry in "spell_order[]" */ + /* Find the next open entry in "p_ptr->spell_order[]" */ for (i = 0; i < 64; i++) { /* Stop at the first empty space */ - if (spell_order[i] == 99) break; + if (p_ptr->spell_order[i] == 99) break; } /* Add the spell to the known list */ - spell_order[i++] = spell; + p_ptr->spell_order[i++] = spell; /* Mention the result */ #ifdef JP @@ -4844,12 +4840,8 @@ s = " s_ptr = &mp_ptr->info[realm - 1][spell]; } - if (p_ptr->pclass == CLASS_SORCERER) - shouhimana = s_ptr->smana*2200 + 2399; - else if (p_ptr->pclass == CLASS_RED_MAGE) - shouhimana = s_ptr->smana*2600 + 2399; - else - shouhimana = (s_ptr->smana*(3800-spell_exp[(increment ? spell+32 : spell)])+2399); + /* Extract mana consumption rate */ + shouhimana = s_ptr->smana*(3800 - experience_of_spell(spell, realm)) + 2399; if(p_ptr->dec_mana) shouhimana *= 3; else shouhimana *= 4; @@ -5033,8 +5025,8 @@ msg_print("An infernal sound echoed."); /* A spell was cast */ if (!(increment ? - (spell_worked2 & (1L << spell)) : - (spell_worked1 & (1L << spell))) + (p_ptr->spell_worked2 & (1L << spell)) : + (p_ptr->spell_worked1 & (1L << spell))) && (p_ptr->pclass != CLASS_SORCERER) && (p_ptr->pclass != CLASS_RED_MAGE)) { @@ -5043,11 +5035,11 @@ msg_print("An infernal sound echoed."); /* The spell worked */ if (realm == p_ptr->realm1) { - spell_worked1 |= (1L << spell); + p_ptr->spell_worked1 |= (1L << spell); } else { - spell_worked2 |= (1L << spell); + p_ptr->spell_worked2 |= (1L << spell); } /* Gain experience */ @@ -5124,14 +5116,27 @@ msg_print("An infernal sound echoed."); } if (mp_ptr->spell_xtra & MAGIC_GAIN_EXP) { - if (spell_exp[(increment ? 32 : 0)+spell] < 900) - spell_exp[(increment ? 32 : 0)+spell]+=60; - else if(spell_exp[(increment ? 32 : 0)+spell] < 1200) - {if ((dun_level > 4) && ((dun_level + 10) > p_ptr->lev)) spell_exp[(increment ? 32 : 0)+spell]+=8;} - else if(spell_exp[(increment ? 32 : 0)+spell] < 1400) - {if (((dun_level + 5) > p_ptr->lev) && ((dun_level + 5) > s_ptr->slevel)) spell_exp[(increment ? 32 : 0)+spell]+=2;} - else if((spell_exp[(increment ? 32 : 0)+spell] < 1600) && !increment) - {if (((dun_level + 5) > p_ptr->lev) && (dun_level > s_ptr->slevel)) spell_exp[(increment ? 32 : 0)+spell]+=1;} + s16b cur_exp = p_ptr->spell_exp[(increment ? 32 : 0)+spell]; + s16b exp_gain = 0; + + if (cur_exp < 900) + exp_gain+=60; + else if(cur_exp < 1200) + { + if ((dun_level > 4) && ((dun_level + 10) > p_ptr->lev)) + exp_gain = 8; + } + else if(cur_exp < 1400) + { + if (((dun_level + 5) > p_ptr->lev) && ((dun_level + 5) > s_ptr->slevel)) + exp_gain = 2; + } + else if((cur_exp < 1600) && !increment) + { + if (((dun_level + 5) > p_ptr->lev) && (dun_level > s_ptr->slevel)) + exp_gain = 1; + } + p_ptr->spell_exp[(increment ? 32 : 0)+spell] += exp_gain; } } @@ -5483,16 +5488,16 @@ bool rakuba(int dam, bool force) { int level = r_ptr->level; if (p_ptr->riding_ryoute) level += 20; - if ((dam/2 + r_ptr->level) > (skill_exp[GINOU_RIDING]/30+10)) + if ((dam/2 + r_ptr->level) > (p_ptr->skill_exp[GINOU_RIDING]/30+10)) { - if((skill_exp[GINOU_RIDING] < s_info[p_ptr->pclass].s_max[GINOU_RIDING]) && s_info[p_ptr->pclass].s_max[GINOU_RIDING] > 1000) + if((p_ptr->skill_exp[GINOU_RIDING] < s_info[p_ptr->pclass].s_max[GINOU_RIDING]) && s_info[p_ptr->pclass].s_max[GINOU_RIDING] > 1000) { - if (r_ptr->level*100 > (skill_exp[GINOU_RIDING] + 1500)) - skill_exp[GINOU_RIDING] += (1+(r_ptr->level - skill_exp[GINOU_RIDING]/100 - 15)); - else skill_exp[GINOU_RIDING]++; + if (r_ptr->level*100 > (p_ptr->skill_exp[GINOU_RIDING] + 1500)) + p_ptr->skill_exp[GINOU_RIDING] += (1+(r_ptr->level - p_ptr->skill_exp[GINOU_RIDING]/100 - 15)); + else p_ptr->skill_exp[GINOU_RIDING]++; } } - if (randint0(dam/2 + level*2) < (skill_exp[GINOU_RIDING]/30+10)) + if (randint0(dam/2 + level*2) < (p_ptr->skill_exp[GINOU_RIDING]/30+10)) { if ((((p_ptr->pclass == CLASS_BEASTMASTER) || (p_ptr->pclass == CLASS_CAVALRY)) && !p_ptr->riding_ryoute) || !one_in_(p_ptr->lev*(p_ptr->riding_ryoute ? 2 : 3)+30)) { @@ -5695,7 +5700,7 @@ msg_print(" return FALSE; } - if (r_info[m_ptr->r_idx].level > randint1((skill_exp[GINOU_RIDING]/50 + p_ptr->lev/2 +20))) + if (r_info[m_ptr->r_idx].level > randint1((p_ptr->skill_exp[GINOU_RIDING]/50 + p_ptr->lev/2 +20))) { #ifdef JP msg_print("¤¦¤Þ¤¯¾è¤ì¤Ê¤«¤Ã¤¿¡£"); diff --git a/src/dungeon.c b/src/dungeon.c index 4c14b95e6..7fb5c4f49 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -1396,7 +1396,7 @@ static void check_music(void) s_ptr = &technic_info[REALM_MUSIC - MIN_TECHNIC - 1][p_ptr->magic_num2[0]]; - shouhimana = (s_ptr->smana*(3800-spell_exp[p_ptr->magic_num2[0]])+2399); + shouhimana = (s_ptr->smana*(3800-p_ptr->spell_exp[p_ptr->magic_num2[0]])+2399); if(p_ptr->dec_mana) shouhimana *= 3; else shouhimana *= 4; @@ -1441,14 +1441,14 @@ static void check_music(void) p_ptr->redraw |= (PR_STATUS); } } - if (spell_exp[p_ptr->magic_num2[0]] < 900) - spell_exp[p_ptr->magic_num2[0]]+=5; - else if(spell_exp[p_ptr->magic_num2[0]] < 1200) - {if (one_in_(2) && (dun_level > 4) && ((dun_level + 10) > p_ptr->lev)) spell_exp[p_ptr->magic_num2[0]]+=1;} - else if(spell_exp[p_ptr->magic_num2[0]] < 1400) - {if (one_in_(5) && ((dun_level + 5) > p_ptr->lev) && ((dun_level + 5) > s_ptr->slevel)) spell_exp[p_ptr->magic_num2[0]]+=1;} - else if(spell_exp[p_ptr->magic_num2[0]] < 1600) - {if (one_in_(5) && ((dun_level + 5) > p_ptr->lev) && (dun_level > s_ptr->slevel)) spell_exp[p_ptr->magic_num2[0]]+=1;} + if (p_ptr->spell_exp[p_ptr->magic_num2[0]] < 900) + p_ptr->spell_exp[p_ptr->magic_num2[0]]+=5; + else if(p_ptr->spell_exp[p_ptr->magic_num2[0]] < 1200) + {if (one_in_(2) && (dun_level > 4) && ((dun_level + 10) > p_ptr->lev)) p_ptr->spell_exp[p_ptr->magic_num2[0]]+=1;} + else if(p_ptr->spell_exp[p_ptr->magic_num2[0]] < 1400) + {if (one_in_(5) && ((dun_level + 5) > p_ptr->lev) && ((dun_level + 5) > s_ptr->slevel)) p_ptr->spell_exp[p_ptr->magic_num2[0]]+=1;} + else if(p_ptr->spell_exp[p_ptr->magic_num2[0]] < 1600) + {if (one_in_(5) && ((dun_level + 5) > p_ptr->lev) && (dun_level > s_ptr->slevel)) p_ptr->spell_exp[p_ptr->magic_num2[0]]+=1;} gere_music(p_ptr->magic_num1[0]); } @@ -1633,7 +1633,7 @@ msg_print(" /* Stop playing */ - alive = FALSE; + p_ptr->playing = FALSE; /* Leaving */ p_ptr->leaving = TRUE; @@ -2337,7 +2337,7 @@ msg_print(" regenmana(upkeep_regen/100); #ifdef TRACK_FRIENDS - if (wizard) + if (p_ptr->wizard) { #ifdef JP msg_format("£Í£Ð²óÉü: %d/%d", upkeep_regen, regen_amount); @@ -3802,7 +3802,7 @@ msg_print(" static bool enter_wizard_mode(void) { /* Ask first time */ - if (!noscore) + if (!p_ptr->noscore) { /* Mention effects */ #ifdef JP @@ -3827,7 +3827,7 @@ if (!get_check(" } /* Mark savefile */ - noscore |= 0x0002; + p_ptr->noscore |= 0x0002; } /* Success */ @@ -3843,7 +3843,7 @@ if (!get_check(" static bool enter_debug_mode(void) { /* Ask first time */ - if (!noscore) + if (!p_ptr->noscore) { /* Mention effects */ #ifdef JP @@ -3873,7 +3873,7 @@ if (!get_check(" do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up sending score to use debug commands."); #endif /* Mark savefile */ - noscore |= 0x0008; + p_ptr->noscore |= 0x0008; } /* Success */ @@ -3896,7 +3896,7 @@ extern void do_cmd_debug(void); static bool enter_borg_mode(void) { /* Ask first time */ - if (!(noscore & 0x0010)) + if (!(p_ptr->noscore & 0x0010)) { /* Mention effects */ #ifdef JP @@ -3921,7 +3921,7 @@ if (!get_check(" } /* Mark savefile */ - noscore |= 0x0010; + p_ptr->noscore |= 0x0010; } /* Success */ @@ -3978,9 +3978,9 @@ static void process_command(void) /* Toggle Wizard Mode */ case KTRL('W'): { - if (wizard) + if (p_ptr->wizard) { - wizard = FALSE; + p_ptr->wizard = FALSE; #ifdef JP msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É²ò½ü¡£"); #else @@ -3990,7 +3990,7 @@ msg_print(" } else if (enter_wizard_mode()) { - wizard = TRUE; + p_ptr->wizard = TRUE; #ifdef JP msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥ÉÆÍÆþ¡£"); #else @@ -5109,7 +5109,7 @@ msg_format("%^s int d = 1; /* Make a "saving throw" against stun */ - if (randint0(r_info[m_ptr->r_idx].level) < skill_exp[GINOU_RIDING]) + if (randint0(r_info[m_ptr->r_idx].level) < p_ptr->skill_exp[GINOU_RIDING]) { /* Recover fully */ d = m_ptr->stunned; @@ -5149,7 +5149,7 @@ msg_format("%^s int d = 1; /* Make a "saving throw" against stun */ - if (randint0(r_info[m_ptr->r_idx].level) < skill_exp[GINOU_RIDING]) + if (randint0(r_info[m_ptr->r_idx].level) < p_ptr->skill_exp[GINOU_RIDING]) { /* Recover fully */ d = m_ptr->confused; @@ -5189,7 +5189,7 @@ msg_format("%^s int d = 1; /* Make a "saving throw" against stun */ - if (randint0(r_info[m_ptr->r_idx].level) < skill_exp[GINOU_RIDING]) + if (randint0(r_info[m_ptr->r_idx].level) < p_ptr->skill_exp[GINOU_RIDING]) { /* Recover fully */ d = m_ptr->monfear; @@ -5577,13 +5577,13 @@ msg_format("%s(%c) } if (p_ptr->pclass == CLASS_IMITATOR) { - if (mane_num > (p_ptr->lev > 44 ? 3 : p_ptr->lev > 29 ? 2 : 1)) + if (p_ptr->mane_num > (p_ptr->lev > 44 ? 3 : p_ptr->lev > 29 ? 2 : 1)) { - mane_num--; - for (i = 0; i < mane_num; i++) + p_ptr->mane_num--; + for (i = 0; i < p_ptr->mane_num; i++) { - mane_spell[i] = mane_spell[i+1]; - mane_dam[i] = mane_dam[i+1]; + p_ptr->mane_spell[i] = p_ptr->mane_spell[i+1]; + p_ptr->mane_dam[i] = p_ptr->mane_dam[i+1]; } } new_mane = FALSE; @@ -5620,7 +5620,7 @@ msg_format("%s(%c) } /* Hack -- notice death */ - if (!alive || death) + if (!p_ptr->playing || p_ptr->is_dead) { world_player = FALSE; break; @@ -5848,7 +5848,7 @@ msg_print(" p_ptr->magic_num1[0] = MUSIC_DETECT; /* Hack -- notice death or departure */ - if (!alive || death) return; + if (!p_ptr->playing || p_ptr->is_dead) return; /* Print quest message if appropriate */ if (!p_ptr->inside_quest && (dungeon_type == DUNGEON_ANGBAND)) @@ -5939,7 +5939,7 @@ msg_print(" if (fresh_after) Term_fresh(); /* Hack -- Notice death or departure */ - if (!alive || death) break; + if (!p_ptr->playing || p_ptr->is_dead) break; /* Process all of the monsters */ process_monsters(); @@ -5963,7 +5963,7 @@ msg_print(" if (fresh_after) Term_fresh(); /* Hack -- Notice death or departure */ - if (!alive || death) break; + if (!p_ptr->playing || p_ptr->is_dead) break; /* Process the world */ @@ -5988,7 +5988,7 @@ msg_print(" if (fresh_after) Term_fresh(); /* Hack -- Notice death or departure */ - if (!alive || death) break; + if (!p_ptr->playing || p_ptr->is_dead) break; /* Handle "leaving" */ if (p_ptr->leaving) break; @@ -6008,7 +6008,7 @@ msg_print(" } /* Not save-and-quit and not dead? */ - if (alive && !death) + if (p_ptr->playing && !p_ptr->is_dead) { for(num = 0; num < 21; num++) { @@ -6229,7 +6229,7 @@ quit(" } /* Report waited score */ - if (wait_report_score) + if (p_ptr->wait_report_score) { char buf[1024]; bool success; @@ -6247,7 +6247,7 @@ quit(" /* Update stuff */ update_stuff(); - death = TRUE; + p_ptr->is_dead = TRUE; start_time = time(NULL); @@ -6281,7 +6281,7 @@ quit(" } else { - wait_report_score = FALSE; + p_ptr->wait_report_score = FALSE; top_twenty(); #ifdef JP if (!save_player()) msg_print("¥»¡¼¥Ö¼ºÇÔ¡ª"); @@ -6522,7 +6522,7 @@ prt(" /* Hack -- Enter wizard mode */ - if (arg_wizard && enter_wizard_mode()) wizard = TRUE; + if (arg_wizard && enter_wizard_mode()) p_ptr->wizard = TRUE; /* Initialize the town-buildings if necessary */ if (!dun_level && !p_ptr->inside_quest) @@ -6559,7 +6559,7 @@ if (init_v_info()) quit(" /* Start game */ - alive = TRUE; + p_ptr->playing = TRUE; /* Reset the visual mappings */ reset_visuals(); @@ -6585,7 +6585,7 @@ if (init_v_info()) quit(" if (arg_force_roguelike) rogue_like_commands = TRUE; /* Hack -- Enforce "delayed death" */ - if (p_ptr->chp < 0) death = TRUE; + if (p_ptr->chp < 0) p_ptr->is_dead = TRUE; if (p_ptr->prace == RACE_ANDROID) calc_android_exp(); @@ -6640,11 +6640,11 @@ if (init_v_info()) quit(" clear_mon_lite(); /* Handle "quit and save" */ - if (!alive && !death) break; + if (!p_ptr->playing && !p_ptr->is_dead) break; /* Erase the old cave */ wipe_o_list(); - if (!death) wipe_m_list(); + if (!p_ptr->is_dead) wipe_m_list(); /* XXX XXX XXX */ @@ -6653,7 +6653,7 @@ if (init_v_info()) quit(" load_game = FALSE; /* Accidental Death */ - if (alive && death) + if (p_ptr->playing && p_ptr->is_dead) { if (p_ptr->inside_arena) { @@ -6662,7 +6662,7 @@ if (init_v_info()) quit(" p_ptr->arena_number++; else p_ptr->arena_number = 99; - death = FALSE; + p_ptr->is_dead = FALSE; p_ptr->chp = 0; p_ptr->chp_frac = 0; p_ptr->exit_bldg = TRUE; @@ -6672,9 +6672,9 @@ if (init_v_info()) quit(" { /* Mega-Hack -- Allow player to cheat death */ #ifdef JP -if ((wizard || cheat_live) && !get_check("»à¤Ë¤Þ¤¹¤«? ")) +if ((p_ptr->wizard || cheat_live) && !get_check("»à¤Ë¤Þ¤¹¤«? ")) #else - if ((wizard || cheat_live) && !get_check("Die? ")) + if ((p_ptr->wizard || cheat_live) && !get_check("Die? ")) #endif { @@ -6685,7 +6685,7 @@ if ((wizard || cheat_live) && !get_check(" p_ptr->age++; /* Mark savefile */ - noscore |= 0x0001; + p_ptr->noscore |= 0x0001; /* Message */ #ifdef JP @@ -6748,14 +6748,14 @@ msg_print("Ä¥ /* Note cause of death XXX XXX XXX */ #ifdef JP -(void)strcpy(died_from, "»à¤Îµ½¤­"); +(void)strcpy(p_ptr->died_from, "»à¤Îµ½¤­"); #else - (void)strcpy(died_from, "Cheating death"); + (void)strcpy(p_ptr->died_from, "Cheating death"); #endif /* Do not die */ - death = FALSE; + p_ptr->is_dead = FALSE; dun_level = 0; p_ptr->inside_arena = FALSE; @@ -6801,7 +6801,7 @@ msg_print("Ä¥ } /* Handle "death" */ - if (death) break; + if (p_ptr->is_dead) break; /* Make a new level */ generate_cave(); diff --git a/src/effects.c b/src/effects.c index ff11c56a6..592e7c174 100644 --- a/src/effects.c +++ b/src/effects.c @@ -236,7 +236,7 @@ bool set_mimic(int v, int p, bool do_dec) /* Hack -- Force good values */ v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; - if (death) return FALSE; + if (p_ptr->is_dead) return FALSE; /* Open */ if (v) @@ -312,7 +312,7 @@ bool set_blind(int v) /* Hack -- Force good values */ v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; - if (death) return FALSE; + if (p_ptr->is_dead) return FALSE; /* Open */ if (v) @@ -406,7 +406,7 @@ bool set_confused(int v) /* Hack -- Force good values */ v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; - if (death) return FALSE; + if (p_ptr->is_dead) return FALSE; /* Open */ if (v) @@ -498,7 +498,7 @@ bool set_poisoned(int v) /* Hack -- Force good values */ v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; - if (death) return FALSE; + if (p_ptr->is_dead) return FALSE; /* Open */ if (v) @@ -560,7 +560,7 @@ bool set_afraid(int v) /* Hack -- Force good values */ v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; - if (death) return FALSE; + if (p_ptr->is_dead) return FALSE; /* Open */ if (v) @@ -639,7 +639,7 @@ bool set_paralyzed(int v) /* Hack -- Force good values */ v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; - if (death) return FALSE; + if (p_ptr->is_dead) return FALSE; /* Open */ if (v) @@ -707,7 +707,7 @@ bool set_image(int v) /* Hack -- Force good values */ v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; - if (death) return FALSE; + if (p_ptr->is_dead) return FALSE; /* Open */ @@ -781,7 +781,7 @@ bool set_fast(int v, bool do_dec) /* Hack -- Force good values */ v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; - if (death) return FALSE; + if (p_ptr->is_dead) return FALSE; /* Open */ if (v) @@ -849,7 +849,7 @@ bool set_lightspeed(int v, bool do_dec) /* Hack -- Force good values */ v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; - if (death) return FALSE; + if (p_ptr->is_dead) return FALSE; /* Open */ if (v) @@ -917,7 +917,7 @@ bool set_slow(int v, bool do_dec) /* Hack -- Force good values */ v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; - if (death) return FALSE; + if (p_ptr->is_dead) return FALSE; /* Open */ if (v) @@ -983,7 +983,7 @@ bool set_shield(int v, bool do_dec) /* Hack -- Force good values */ v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; - if (death) return FALSE; + if (p_ptr->is_dead) return FALSE; /* Open */ if (v) @@ -1053,7 +1053,7 @@ bool set_tsubureru(int v, bool do_dec) /* Hack -- Force good values */ v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; - if (death) return FALSE; + if (p_ptr->is_dead) return FALSE; /* Open */ if (v) @@ -1123,7 +1123,7 @@ bool set_magicdef(int v, bool do_dec) /* Hack -- Force good values */ v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; - if (death) return FALSE; + if (p_ptr->is_dead) return FALSE; /* Open */ if (v) @@ -1193,7 +1193,7 @@ bool set_blessed(int v, bool do_dec) /* Hack -- Force good values */ v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; - if (death) return FALSE; + if (p_ptr->is_dead) return FALSE; /* Open */ if (v) @@ -1262,7 +1262,7 @@ bool set_hero(int v, bool do_dec) /* Hack -- Force good values */ v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; - if (death) return FALSE; + if (p_ptr->is_dead) return FALSE; /* Open */ if (v) @@ -1334,7 +1334,7 @@ bool set_shero(int v, bool do_dec) /* Hack -- Force good values */ v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; - if (death) return FALSE; + if (p_ptr->is_dead) return FALSE; if (p_ptr->pclass == CLASS_BERSERKER) v = 1; /* Open */ @@ -1407,7 +1407,7 @@ bool set_protevil(int v, bool do_dec) /* Hack -- Force good values */ v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; - if (death) return FALSE; + if (p_ptr->is_dead) return FALSE; /* Open */ if (v) @@ -1472,7 +1472,7 @@ bool set_wraith_form(int v, bool do_dec) /* Hack -- Force good values */ v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; - if (death) return FALSE; + if (p_ptr->is_dead) return FALSE; /* Open */ if (v) @@ -1568,7 +1568,7 @@ bool set_invuln(int v, bool do_dec) /* Hack -- Force good values */ v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; - if (death) return FALSE; + if (p_ptr->is_dead) return FALSE; /* Open */ if (v) @@ -1662,7 +1662,7 @@ bool set_tim_esp(int v, bool do_dec) /* Hack -- Force good values */ v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; - if (death) return FALSE; + if (p_ptr->is_dead) return FALSE; /* Open */ if (v) @@ -1734,7 +1734,7 @@ bool set_tim_invis(int v, bool do_dec) /* Hack -- Force good values */ v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; - if (death) return FALSE; + if (p_ptr->is_dead) return FALSE; /* Open */ if (v) @@ -1806,7 +1806,7 @@ bool set_tim_infra(int v, bool do_dec) /* Hack -- Force good values */ v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; - if (death) return FALSE; + if (p_ptr->is_dead) return FALSE; /* Open */ if (v) @@ -1878,7 +1878,7 @@ bool set_tim_regen(int v, bool do_dec) /* Hack -- Force good values */ v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; - if (death) return FALSE; + if (p_ptr->is_dead) return FALSE; /* Open */ if (v) @@ -1947,7 +1947,7 @@ bool set_tim_stealth(int v, bool do_dec) /* Hack -- Force good values */ v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; - if (death) return FALSE; + if (p_ptr->is_dead) return FALSE; /* Open */ if (v) @@ -2010,7 +2010,7 @@ bool set_superstealth(bool set) { bool notice = FALSE; - if (death) return FALSE; + if (p_ptr->is_dead) return FALSE; /* Open */ if (set) @@ -2085,7 +2085,7 @@ bool set_tim_ffall(int v, bool do_dec) /* Hack -- Force good values */ v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; - if (death) return FALSE; + if (p_ptr->is_dead) return FALSE; /* Open */ if (v) @@ -2154,7 +2154,7 @@ bool set_tim_sh_touki(int v, bool do_dec) /* Hack -- Force good values */ v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; - if (death) return FALSE; + if (p_ptr->is_dead) return FALSE; /* Open */ if (v) @@ -2220,7 +2220,7 @@ bool set_tim_sh_fire(int v, bool do_dec) /* Hack -- Force good values */ v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; - if (death) return FALSE; + if (p_ptr->is_dead) return FALSE; /* Open */ if (v) @@ -2289,7 +2289,7 @@ bool set_tim_sh_holy(int v, bool do_dec) /* Hack -- Force good values */ v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; - if (death) return FALSE; + if (p_ptr->is_dead) return FALSE; /* Open */ if (v) @@ -2359,7 +2359,7 @@ bool set_tim_eyeeye(int v, bool do_dec) /* Hack -- Force good values */ v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; - if (death) return FALSE; + if (p_ptr->is_dead) return FALSE; /* Open */ if (v) @@ -2429,7 +2429,7 @@ bool set_resist_magic(int v, bool do_dec) /* Hack -- Force good values */ v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; - if (death) return FALSE; + if (p_ptr->is_dead) return FALSE; /* Open */ if (v) @@ -2498,7 +2498,7 @@ bool set_tim_reflect(int v, bool do_dec) /* Hack -- Force good values */ v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; - if (death) return FALSE; + if (p_ptr->is_dead) return FALSE; /* Open */ if (v) @@ -2567,7 +2567,7 @@ bool set_multishadow(int v, bool do_dec) /* Hack -- Force good values */ v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; - if (death) return FALSE; + if (p_ptr->is_dead) return FALSE; /* Open */ if (v) @@ -2636,7 +2636,7 @@ bool set_dustrobe(int v, bool do_dec) /* Hack -- Force good values */ v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; - if (death) return FALSE; + if (p_ptr->is_dead) return FALSE; /* Open */ if (v) @@ -2705,7 +2705,7 @@ bool set_kabenuke(int v, bool do_dec) /* Hack -- Force good values */ v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; - if (death) return FALSE; + if (p_ptr->is_dead) return FALSE; /* Open */ if (v) @@ -2768,7 +2768,7 @@ bool set_tsuyoshi(int v, bool do_dec) /* Hack -- Force good values */ v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; - if (death) return FALSE; + if (p_ptr->is_dead) return FALSE; /* Open */ if (v) @@ -3043,7 +3043,7 @@ bool set_oppose_acid(int v, bool do_dec) /* Hack -- Force good values */ v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; - if (death) return FALSE; + if (p_ptr->is_dead) return FALSE; /* Open */ if (v) @@ -3109,7 +3109,7 @@ bool set_oppose_elec(int v, bool do_dec) /* Hack -- Force good values */ v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; - if (death) return FALSE; + if (p_ptr->is_dead) return FALSE; /* Open */ if (v) @@ -3175,7 +3175,7 @@ bool set_oppose_fire(int v, bool do_dec) /* Hack -- Force good values */ v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; - if (death) return FALSE; + if (p_ptr->is_dead) return FALSE; if ((prace_is_(RACE_DEMON) && (p_ptr->lev > 44)) || (p_ptr->mimic_form == MIMIC_DEMON)) v = 1; /* Open */ @@ -3242,7 +3242,7 @@ bool set_oppose_cold(int v, bool do_dec) /* Hack -- Force good values */ v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; - if (death) return FALSE; + if (p_ptr->is_dead) return FALSE; /* Open */ if (v) @@ -3309,7 +3309,7 @@ bool set_oppose_pois(int v, bool do_dec) v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; if ((p_ptr->pclass == CLASS_NINJA) && (p_ptr->lev > 44)) v = 1; - if (death) return FALSE; + if (p_ptr->is_dead) return FALSE; /* Open */ if (v) @@ -3379,7 +3379,7 @@ bool set_stun(int v) /* Hack -- Force good values */ v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; - if (death) return FALSE; + if (p_ptr->is_dead) return FALSE; if (prace_is_(RACE_GOLEM) || ((p_ptr->pclass == CLASS_BERSERKER) && (p_ptr->lev > 34))) v = 0; @@ -3567,7 +3567,7 @@ bool set_cut(int v) /* Hack -- Force good values */ v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; - if (death) return FALSE; + if (p_ptr->is_dead) return FALSE; if ((p_ptr->prace == RACE_GOLEM || p_ptr->prace == RACE_SKELETON || @@ -4977,7 +4977,7 @@ int take_hit(int damage_type, int damage, cptr hit_from, int monspell) int warning = (p_ptr->mhp * hitpoint_warn / 10); /* Paranoia */ - if (death) return 0; + if (p_ptr->is_dead) return 0; if (p_ptr->sutemi) damage *= 2; if (p_ptr->special_defense & KATA_IAI) damage += (damage + 4) / 5; @@ -5111,7 +5111,7 @@ int take_hit(int damage_type, int damage, cptr hit_from, int monspell) p_ptr->leaving = TRUE; /* Note death */ - death = TRUE; + p_ptr->is_dead = TRUE; if (p_ptr->inside_arena) { @@ -5133,13 +5133,13 @@ int take_hit(int damage_type, int damage, cptr hit_from, int monspell) /* Note cause of death */ #ifdef JP - sprintf(died_from, "%s%s%s", !p_ptr->paralyzed ? "" : p_ptr->free_act ? "ĦÁü¾õÂÖ¤Ç":"Ëãáã¾õÂÖ¤Ç", p_ptr->image ? "¸¸³Ð¤ËÏĤó¤À" : "", hit_from); + sprintf(p_ptr->died_from, "%s%s%s", !p_ptr->paralyzed ? "" : p_ptr->free_act ? "ĦÁü¾õÂÖ¤Ç":"Ëãáã¾õÂÖ¤Ç", p_ptr->image ? "¸¸³Ð¤ËÏĤó¤À" : "", hit_from); #else - sprintf(died_from, "%s%s", hit_from, !p_ptr->paralyzed ? "" : " while helpless"); + sprintf(p_ptr->died_from, "%s%s", hit_from, !p_ptr->paralyzed ? "" : " while helpless"); #endif /* No longer a winner */ - total_winner = FALSE; + p_ptr->total_winner = FALSE; if (p_ptr->inside_arena) #ifdef JP @@ -5166,9 +5166,9 @@ int take_hit(int damage_type, int damage, cptr hit_from, int monspell) sprintf(buf,"level %d", dun_level); #endif #ifdef JP - sprintf(tmp,"%s¤Ç%s¤Ë»¦¤µ¤ì¤¿¡£",buf, died_from); + sprintf(tmp,"%s¤Ç%s¤Ë»¦¤µ¤ì¤¿¡£",buf, p_ptr->died_from); #else - sprintf(tmp,"killed by %s %s.", died_from, buf); + sprintf(tmp,"killed by %s %s.", p_ptr->died_from, buf); #endif do_cmd_write_nikki(NIKKI_BUNSHOU, 0, tmp); #ifdef JP @@ -5205,7 +5205,7 @@ msg_format(" } else { - if (streq(died_from, "Seppuku")) + if (streq(p_ptr->died_from, "Seppuku")) { #ifdef JP get_rnd_line("seppuku_j.txt", 0, death_message); @@ -5222,7 +5222,7 @@ get_rnd_line("death_j.txt", 0, death_message); #endif } #ifdef JP - while (!get_string(streq(died_from, "Seppuku") ? "¼­À¤¤Î¶ç: " : "ÃÇËöËâ¤Î¶«¤Ó: ", death_message, 1024)) ; + while (!get_string(streq(p_ptr->died_from, "Seppuku") ? "¼­À¤¤Î¶ç: " : "ÃÇËöËâ¤Î¶«¤Ó: ", death_message, 1024)) ; #else while (!get_string("Last word: ", death_message, 1024)) ; #endif @@ -5234,7 +5234,7 @@ get_rnd_line("death_j.txt", 0, death_message); strcpy(death_message, android ? "You are broken." : "You die."); #endif } - if (streq(died_from, "Seppuku")) + if (streq(p_ptr->died_from, "Seppuku")) { #ifdef JP int i, len; @@ -5346,7 +5346,7 @@ msg_print("*** */ void gain_exp(s32b amount) { - if (death) return; + if (p_ptr->is_dead) return; if (p_ptr->prace == RACE_ANDROID) return; @@ -5369,7 +5369,7 @@ void calc_android_exp(void) { int i; u32b total_exp = 0; - if (death) return; + if (p_ptr->is_dead) return; if (p_ptr->prace != RACE_ANDROID) return; @@ -5460,7 +5460,7 @@ bool set_ultimate_res(int v, bool do_dec) /* Hack -- Force good values */ v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; - if (death) return FALSE; + if (p_ptr->is_dead) return FALSE; /* Open */ if (v) @@ -5525,7 +5525,7 @@ bool set_tim_res_nether(int v, bool do_dec) /* Hack -- Force good values */ v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; - if (death) return FALSE; + if (p_ptr->is_dead) return FALSE; /* Open */ if (v) @@ -5590,7 +5590,7 @@ bool set_tim_res_time(int v, bool do_dec) /* Hack -- Force good values */ v = (v > 10000) ? 10000 : (v < 0) ? 0 : v; - if (death) return FALSE; + if (p_ptr->is_dead) return FALSE; /* Open */ if (v) diff --git a/src/externs.h b/src/externs.h index 5a9d822a0..8f54a4c89 100644 --- a/src/externs.h +++ b/src/externs.h @@ -151,8 +151,6 @@ extern s16b energy_use; extern byte create_up_stair; extern byte create_down_stair; extern bool msg_flag; -extern bool alive; -extern bool death; extern s16b running; extern s16b resting; extern s16b cur_hgt; @@ -166,14 +164,9 @@ extern s32b turn; extern s32b dungeon_turn; extern s32b old_turn; extern s32b old_battle; -extern bool wizard; extern bool use_sound; extern bool use_graphics; extern bool use_bigtile; -extern u16b total_winner; -extern u16b panic_save; -extern u16b noscore; -extern bool wait_report_score; extern s16b signal_count; extern bool inkey_base; extern bool inkey_xtra; @@ -338,8 +331,6 @@ extern int player_euid; extern int player_egid; extern char player_name[32]; extern char player_base[32]; -extern char died_from[80]; -extern char history[4][60]; extern char savefile[1024]; extern char savefile_base[40]; extern s16b lite_n; @@ -396,14 +387,6 @@ extern player_race *rp_ptr; extern player_class *cp_ptr; extern player_seikaku *ap_ptr; extern player_magic *mp_ptr; -extern u32b spell_learned1; -extern u32b spell_learned2; -extern u32b spell_worked1; -extern u32b spell_worked2; -extern u32b spell_forgotten1; -extern u32b spell_forgotten2; -extern byte spell_order[64]; -extern s16b player_hp[PY_MAX_LEVEL]; extern birther previous_char; extern vault_type *v_info; extern char *v_name; @@ -497,14 +480,8 @@ extern bool preserve_mode; extern bool autoroller; extern bool autochara; extern bool can_save; -extern s16b spell_exp[64]; -extern s16b weapon_exp[5][64]; -extern s16b skill_exp[10]; extern bool world_monster; extern bool world_player; -extern s16b mane_spell[MAX_MANE]; -extern s16b mane_dam[MAX_MANE]; -extern s16b mane_num; extern int cap_mon; extern int cap_mspeed; extern int cap_hp; @@ -1095,6 +1072,7 @@ extern bool bless_weapon(void); extern bool pulish_shield(void); extern bool potion_smash_effect(int who, int y, int x, int k_idx); extern void display_spell_list(void); +extern s16b experience_of_spell(int spell, int realm); extern s16b spell_chance(int spell,int realm); extern bool spell_okay(int spell, bool learned, bool study_pray, int realm); extern void print_spells(int target_spell, byte *spells, int num, int y, int x, int realm); diff --git a/src/files.c b/src/files.c index 88f49d148..658145278 100644 --- a/src/files.c +++ b/src/files.c @@ -590,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); @@ -630,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); @@ -1754,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); @@ -4083,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, "¡Ä¤¢¤Ê¤¿¤Ï¾¡Íø¤Î¸å°úÂष¤¿¡£"); @@ -4096,7 +4096,7 @@ 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) { @@ -4108,25 +4108,25 @@ void display_player(int mode) 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) @@ -4373,7 +4373,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"); @@ -4591,7 +4591,7 @@ errr make_character_dump(FILE *fff) #endif } - if (noscore) + if (p_ptr->noscore) #ifdef JP fprintf(fff, "\n ²¿¤«ÉÔÀµ¤Ê¤³¤È¤ò¤·¤Æ¤·¤Þ¤Ã¤Æ¤Þ¤¹¡£"); #else @@ -5933,7 +5933,7 @@ void do_cmd_suicide(void) flush(); /* Verify Retirement */ - if (total_winner) + if (p_ptr->total_winner) { /* Verify */ #ifdef JP @@ -5956,7 +5956,7 @@ if (!get_check(" } - if (!noscore) + if (!p_ptr->noscore) { /* Special Verification for suicide */ #ifdef JP @@ -5972,15 +5972,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, "¥À¥ó¥¸¥ç¥ó¤Îõº÷¤ËÀä˾¤·¤Æ¼«»¦¤·¤¿¡£"); @@ -5994,9 +5994,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 } @@ -6043,9 +6043,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 @@ -6082,9 +6082,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 } @@ -6095,7 +6095,7 @@ prt(" */ void do_cmd_save_and_exit(void) { - alive = FALSE; + p_ptr->playing = FALSE; /* Leaving */ p_ptr->leaving = TRUE; @@ -6162,7 +6162,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); @@ -6206,7 +6206,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) @@ -6320,7 +6320,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 /* ±ÑÆüÀÚ¤êÂؤ¨ */ @@ -6382,34 +6382,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); } @@ -6420,7 +6420,7 @@ static void print_tomb(void) } else { - if(streq(died_from, "ÅÓÃ潪λ")) + if(streq(p_ptr->died_from, "ÅÓÃ潪λ")) { sprintf(tmp, "Ãϲ¼ %d ³¬¤Ç»à¤ó¤À", dun_level); } @@ -6438,14 +6438,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); @@ -6679,7 +6679,7 @@ msg_print(" #ifndef SCORE_WIZARDS /* Wizard-mode pre-empts scoring */ - if (noscore & 0x000F) + if (p_ptr->noscore & 0x000F) { #ifdef JP msg_print("¥¦¥£¥¶¡¼¥É¡¦¥â¡¼¥É¤Ç¤Ï¥¹¥³¥¢¤¬µ­Ï¿¤µ¤ì¤Þ¤»¤ó¡£"); @@ -6694,7 +6694,7 @@ msg_print(" #ifndef SCORE_BORGS /* Borg-mode pre-empts scoring */ - if (noscore & 0x00F0) + if (p_ptr->noscore & 0x00F0) { #ifdef JP msg_print("¥Ü¡¼¥°¡¦¥â¡¼¥É¤Ç¤Ï¥¹¥³¥¢¤¬µ­Ï¿¤µ¤ì¤Þ¤»¤ó¡£"); @@ -6709,7 +6709,7 @@ msg_print(" #ifndef SCORE_CHEATERS /* Cheaters are not scored */ - if (noscore & 0xFF00) + if (p_ptr->noscore & 0xFF00) { #ifdef JP msg_print("º¾µ½¤ò¤ä¤Ã¤¿¿Í¤Ï¥¹¥³¥¢¤¬µ­Ï¿¤µ¤ì¤Þ¤»¤ó¡£"); @@ -6724,9 +6724,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 { @@ -6742,9 +6742,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 { @@ -6798,10 +6798,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 @@ -6840,8 +6840,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 @@ -6849,7 +6849,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) @@ -6922,19 +6922,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 @@ -7330,13 +7330,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(); @@ -7360,9 +7360,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 @@ -7371,10 +7371,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; @@ -7470,13 +7470,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 diff --git a/src/hissatsu.c b/src/hissatsu.c index a63abba91..ada37dbbe 100644 --- a/src/hissatsu.c +++ b/src/hissatsu.c @@ -119,7 +119,7 @@ cptr p = "ɬ { menu_line += 31; if (menu_line > 32) menu_line -= 32; - } while(!(spell_learned1 & (1L << (menu_line-1)))); + } while(!(p_ptr->spell_learned1 & (1L << (menu_line-1)))); break; } @@ -131,7 +131,7 @@ cptr p = "ɬ { menu_line++; if (menu_line > 32) menu_line -= 32; - } while(!(spell_learned1 & (1L << (menu_line-1)))); + } while(!(p_ptr->spell_learned1 & (1L << (menu_line-1)))); break; } @@ -150,7 +150,7 @@ cptr p = "ɬ reverse = TRUE; } else menu_line+=16; - while(!(spell_learned1 & (1L << (menu_line-1)))) + while(!(p_ptr->spell_learned1 & (1L << (menu_line-1)))) { if (reverse) { @@ -207,11 +207,11 @@ put_str("name Lv SP name Lv SP ", y, x + 5); if (spell.slevel > PY_MAX_LEVEL) continue; line++; - if (!(spell_learned1 >> i)) break; + if (!(p_ptr->spell_learned1 >> i)) break; /* Access the spell */ if (spell.slevel > plev) continue; - if (!(spell_learned1 & (1L << i))) continue; + if (!(p_ptr->spell_learned1 & (1L << i))) continue; if (use_menu) { if (i == (menu_line-1)) @@ -278,7 +278,7 @@ put_str("name Lv SP name Lv SP ", y, x + 5); } /* Totally Illegal */ - if ((i < 0) || (i >= 32) || !(spell_learned1 & (1 << sentaku[i]))) + if ((i < 0) || (i >= 32) || !(p_ptr->spell_learned1 & (1 << sentaku[i]))) { bell(); continue; @@ -1192,10 +1192,10 @@ prt(" i = inkey(); prt("", 0, 0); if (i != '@') return FALSE; - if (total_winner) + if (p_ptr->total_winner) { take_hit(DAMAGE_FORCE, 9999, "Seppuku", -1); - total_winner = TRUE; + p_ptr->total_winner = TRUE; } else { @@ -1255,7 +1255,7 @@ msg_print(" return; } - if (!spell_learned1) + if (!p_ptr->spell_learned1) { #ifdef JP msg_print("²¿¤âµ»¤òÃΤé¤Ê¤¤¡£"); @@ -1404,11 +1404,11 @@ s = " for (i = o_ptr->sval * 8; i < o_ptr->sval * 8 + 8; i++) { - if (spell_learned1 & (1L << i)) continue; + if (p_ptr->spell_learned1 & (1L << i)) continue; if (technic_info[TECHNIC_HISSATSU][i].slevel > p_ptr->lev) continue; - spell_learned1 |= (1L << i); - spell_worked1 |= (1L << i); + p_ptr->spell_learned1 |= (1L << i); + p_ptr->spell_worked1 |= (1L << i); #ifdef JP msg_format("%s¤Îµ»¤ò³Ð¤¨¤¿¡£", spell_names[technic2magic(REALM_HISSATSU)-1][i]); #else @@ -1417,9 +1417,9 @@ s = " for (j = 0; j < 64; j++) { /* Stop at the first empty space */ - if (spell_order[j] == 99) break; + if (p_ptr->spell_order[j] == 99) break; } - spell_order[j] = i; + p_ptr->spell_order[j] = i; gain = TRUE; } if (!gain) diff --git a/src/load.c b/src/load.c index 04d5c6345..22a768a30 100644 --- a/src/load.c +++ b/src/load.c @@ -969,7 +969,7 @@ static void rd_options(void) rd_u16b(&c); - if (c & 0x0002) wizard = TRUE; + if (c & 0x0002) p_ptr->wizard = TRUE; cheat_peek = (c & 0x0100) ? TRUE : FALSE; cheat_hear = (c & 0x0200) ? TRUE : FALSE; @@ -1160,13 +1160,13 @@ static void rd_extra(void) rd_string(player_name, 32); - rd_string(died_from, 80); + rd_string(p_ptr->died_from, 80); load_quick_start(); for (i = 0; i < 4; i++) { - rd_string(history[i], 60); + rd_string(p_ptr->history[i], 60); } /* Class/Race/Seikaku/Gender/Spells */ @@ -1210,20 +1210,20 @@ static void rd_extra(void) rd_s16b(&p_ptr->lev); - for (i = 0; i < 64; i++) rd_s16b(&spell_exp[i]); + for (i = 0; i < 64; i++) rd_s16b(&p_ptr->spell_exp[i]); if ((p_ptr->pclass == CLASS_SORCERER) && z_older_than(10, 4, 2)) { - for (i = 0; i < 64; i++) spell_exp[i] = 1600; + for (i = 0; i < 64; i++) p_ptr->spell_exp[i] = 1600; } if (z_older_than(10, 3, 6)) - for (i = 0; i < 5; i++) for (j = 0; j < 60; j++) rd_s16b(&weapon_exp[i][j]); + for (i = 0; i < 5; i++) for (j = 0; j < 60; j++) rd_s16b(&p_ptr->weapon_exp[i][j]); else - for (i = 0; i < 5; i++) for (j = 0; j < 64; j++) rd_s16b(&weapon_exp[i][j]); - for (i = 0; i < 10; i++) rd_s16b(&skill_exp[i]); + for (i = 0; i < 5; i++) for (j = 0; j < 64; j++) rd_s16b(&p_ptr->weapon_exp[i][j]); + for (i = 0; i < 10; i++) rd_s16b(&p_ptr->skill_exp[i]); if (z_older_than(10, 4, 1)) { - if (p_ptr->pclass != CLASS_BEASTMASTER) skill_exp[GINOU_RIDING] /= 2; - skill_exp[GINOU_RIDING] = MIN(skill_exp[GINOU_RIDING], s_info[p_ptr->pclass].s_max[GINOU_RIDING]); + if (p_ptr->pclass != CLASS_BEASTMASTER) p_ptr->skill_exp[GINOU_RIDING] /= 2; + p_ptr->skill_exp[GINOU_RIDING] = MIN(p_ptr->skill_exp[GINOU_RIDING], s_info[p_ptr->pclass].s_max[GINOU_RIDING]); } if (z_older_than(10, 3, 14)) { @@ -1256,10 +1256,10 @@ static void rd_extra(void) { for (i = 0; i < OLD_MAX_MANE; i++) { - mane_spell[i] = -1; - mane_dam[i] = 0; + p_ptr->mane_spell[i] = -1; + p_ptr->mane_dam[i] = 0; } - mane_num = 0; + p_ptr->mane_num = 0; } else if (z_older_than(10, 2, 3)) { @@ -1270,20 +1270,20 @@ static void rd_extra(void) } for (i = 0; i < MAX_MANE; i++) { - mane_spell[i] = -1; - mane_dam[i] = 0; + p_ptr->mane_spell[i] = -1; + p_ptr->mane_dam[i] = 0; } rd_s16b(&tmp16s); - mane_num = 0; + p_ptr->mane_num = 0; } else { for (i = 0; i < MAX_MANE; i++) { - rd_s16b(&mane_spell[i]); - rd_s16b(&mane_dam[i]); + rd_s16b(&p_ptr->mane_spell[i]); + rd_s16b(&p_ptr->mane_dam[i]); } - rd_s16b(&mane_num); + rd_s16b(&p_ptr->mane_num); } if (z_older_than(10, 0, 3)) @@ -1604,7 +1604,7 @@ note(format(" if (tmp8u) p_ptr->action = ACTION_LEARN; } rd_byte((byte *)&preserve_mode); - rd_byte((byte *)&wait_report_score); + rd_byte((byte *)&p_ptr->wait_report_score); /* Future use */ for (i = 0; i < 48; i++) rd_byte(&tmp8u); @@ -1619,14 +1619,14 @@ note(format(" /* Special stuff */ - rd_u16b(&panic_save); - rd_u16b(&total_winner); - rd_u16b(&noscore); + rd_u16b(&p_ptr->panic_save); + rd_u16b(&p_ptr->total_winner); + rd_u16b(&p_ptr->noscore); /* Read "death" */ rd_byte(&tmp8u); - death = tmp8u; + p_ptr->is_dead = tmp8u; /* Read "feeling" */ rd_byte(&tmp8u); @@ -2282,7 +2282,7 @@ if (arg_fiddle) note(" if (munchkin_death) { /* Mark savefile */ - noscore |= 0x0001; + p_ptr->noscore |= 0x0001; } /* Then the "messages" */ @@ -2664,7 +2664,7 @@ note(format(" /* Read the player_hp array */ for (i = 0; i < tmp16u; i++) { - rd_s16b(&player_hp[i]); + rd_s16b(&p_ptr->player_hp[i]); } /* Important -- Initialize the sex */ @@ -2675,22 +2675,22 @@ note(format(" cp_ptr = &class_info[p_ptr->pclass]; ap_ptr = &seikaku_info[p_ptr->pseikaku]; - if(z_older_than(10, 2, 2) && (p_ptr->pclass == CLASS_BEASTMASTER) && !death) + if(z_older_than(10, 2, 2) && (p_ptr->pclass == CLASS_BEASTMASTER) && !p_ptr->is_dead) { p_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp; do_cmd_rerate(FALSE); } - if(z_older_than(10, 3, 2) && (p_ptr->pclass == CLASS_ARCHER) && !death) + if(z_older_than(10, 3, 2) && (p_ptr->pclass == CLASS_ARCHER) && !p_ptr->is_dead) { p_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp; do_cmd_rerate(FALSE); } - if(z_older_than(10, 2, 6) && (p_ptr->pclass == CLASS_SORCERER) && !death) + if(z_older_than(10, 2, 6) && (p_ptr->pclass == CLASS_SORCERER) && !p_ptr->is_dead) { p_ptr->hitdie = rp_ptr->r_mhp/2 + cp_ptr->c_mhp + ap_ptr->a_mhp; do_cmd_rerate(FALSE); } - if(z_older_than(10, 4, 7) && (p_ptr->pclass == CLASS_BLUE_MAGE) && !death) + if(z_older_than(10, 4, 7) && (p_ptr->pclass == CLASS_BLUE_MAGE) && !p_ptr->is_dead) { p_ptr->hitdie = rp_ptr->r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp; do_cmd_rerate(FALSE); @@ -2701,12 +2701,12 @@ note(format(" /* Read spell info */ - rd_u32b(&spell_learned1); - rd_u32b(&spell_learned2); - rd_u32b(&spell_worked1); - rd_u32b(&spell_worked2); - rd_u32b(&spell_forgotten1); - rd_u32b(&spell_forgotten2); + rd_u32b(&p_ptr->spell_learned1); + rd_u32b(&p_ptr->spell_learned2); + rd_u32b(&p_ptr->spell_worked1); + rd_u32b(&p_ptr->spell_worked2); + rd_u32b(&p_ptr->spell_forgotten1); + rd_u32b(&p_ptr->spell_forgotten2); if (z_older_than(10,0,5)) { @@ -2715,8 +2715,8 @@ note(format(" { /* Count known spells */ if ((i < 32) ? - (spell_learned1 & (1L << i)) : - (spell_learned2 & (1L << (i - 32)))) + (p_ptr->spell_learned1 & (1L << i)) : + (p_ptr->spell_learned2 & (1L << (i - 32)))) { p_ptr->learned_spells++; } @@ -2733,7 +2733,7 @@ note(format(" for (i = 0; i < 64; i++) { - rd_byte(&spell_order[i]); + rd_byte(&p_ptr->spell_order[i]); } @@ -2811,7 +2811,7 @@ note(" if (buf[0]) screen_dump = string_make(buf); } - if (death) + if (p_ptr->is_dead) { for (i = MIN_RANDOM_QUEST; i < MAX_RANDOM_QUEST + 1; i++) { @@ -2821,7 +2821,7 @@ note(" /* I'm not dead yet... */ - if (!death) + if (!p_ptr->is_dead) { /* Dead players have no dungeon */ #ifdef JP diff --git a/src/mane.c b/src/mane.c index eeef76578..79a8d0372 100644 --- a/src/mane.c +++ b/src/mane.c @@ -111,7 +111,7 @@ cptr p = "ǽ /* No redraw yet */ redraw = FALSE; - num = mane_num; + num = p_ptr->mane_num; /* Build a prompt (accept all spells) */ #ifdef JP @@ -163,7 +163,7 @@ put_str(" for (i = 0; i < num; i++) { /* Access the spell */ - spell = monster_powers[mane_spell[i]]; + spell = monster_powers[p_ptr->mane_spell[i]]; chance = spell.manefail; @@ -173,7 +173,7 @@ put_str(" /* Reduce failure rate by INT/WIS adjustment */ chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[spell.use_stat]] + adj_mag_stat[p_ptr->stat_ind[A_DEX]] - 2) / 2; - if (spell.manedam) chance = chance * mane_dam[i] / spell.manedam; + if (spell.manedam) chance = chance * p_ptr->mane_dam[i] / spell.manedam; chance += p_ptr->to_m_chance; @@ -191,7 +191,7 @@ put_str(" if (chance > 95) chance = 95; /* Get info */ - mane_info(comment, mane_spell[i], (baigaesi ? mane_dam[i]*2 : mane_dam[i])); + mane_info(comment, p_ptr->mane_spell[i], (baigaesi ? p_ptr->mane_dam[i]*2 : p_ptr->mane_dam[i])); /* Dump the spell --(-- */ sprintf(psi_desc, " %c) %-30s %3d%%%s", @@ -235,7 +235,7 @@ put_str(" } /* Save the spell index */ - spell = monster_powers[mane_spell[i]]; + spell = monster_powers[p_ptr->mane_spell[i]]; /* Verify it */ if (ask) @@ -244,9 +244,9 @@ put_str(" /* Prompt */ #ifdef JP -(void) strnfmt(tmp_val, 78, "%s¤ò¤Þ¤Í¤Þ¤¹¤«¡©", monster_powers[mane_spell[i]].name); +(void) strnfmt(tmp_val, 78, "%s¤ò¤Þ¤Í¤Þ¤¹¤«¡©", monster_powers[p_ptr->mane_spell[i]].name); #else - (void)strnfmt(tmp_val, 78, "Use %s? ", monster_powers[mane_spell[i]].name); + (void)strnfmt(tmp_val, 78, "Use %s? ", monster_powers[p_ptr->mane_spell[i]].name); #endif @@ -277,7 +277,7 @@ put_str(" /* Save the choice */ (*sn) = i; - damage = (baigaesi ? mane_dam[i]*2 : mane_dam[i]); + damage = (baigaesi ? p_ptr->mane_dam[i]*2 : p_ptr->mane_dam[i]); /* Success */ return (TRUE); @@ -1315,7 +1315,7 @@ msg_print(" return TRUE; } - if (!mane_num) + if (!p_ptr->mane_num) { #ifdef JP msg_print("¤Þ¤Í¤é¤ì¤ë¤â¤Î¤¬²¿¤â¤Ê¤¤¡ª"); @@ -1329,7 +1329,7 @@ msg_print(" /* get power */ if (!get_mane_power(&n, baigaesi)) return FALSE; - spell = monster_powers[mane_spell[n]]; + spell = monster_powers[p_ptr->mane_spell[n]]; /* Spell failure chance */ chance = spell.manefail; @@ -1375,16 +1375,16 @@ msg_print(" sound(SOUND_ZAP); /* Cast the spell */ - cast = use_mane(mane_spell[n]); + cast = use_mane(p_ptr->mane_spell[n]); if (!cast) return FALSE; } - mane_num--; - for (j = n; j < mane_num;j++) + p_ptr->mane_num--; + for (j = n; j < p_ptr->mane_num;j++) { - mane_spell[j] = mane_spell[j+1]; - mane_dam[j] = mane_dam[j+1]; + p_ptr->mane_spell[j] = p_ptr->mane_spell[j+1]; + p_ptr->mane_dam[j] = p_ptr->mane_dam[j+1]; } /* Take a turn */ diff --git a/src/melee1.c b/src/melee1.c index 1fe8f6667..5700b81dc 100644 --- a/src/melee1.c +++ b/src/melee1.c @@ -241,7 +241,7 @@ bool make_attack_normal(int m_idx) } /* Stop if player is dead or gone */ - if (!alive || death) break; + if (!p_ptr->playing || p_ptr->is_dead) break; if (distance(py, px, m_ptr->fy, m_ptr->fx) > 1) break; /* Handle "leaving" */ @@ -823,7 +823,7 @@ bool make_attack_normal(int m_idx) /* Take some damage */ get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1); - if (death) break; + if (p_ptr->is_dead) break; /* Find an item */ for (k = 0; k < 10; k++) @@ -893,7 +893,7 @@ bool make_attack_normal(int m_idx) /* Confused monsters cannot steal successfully. -LM-*/ if (m_ptr->confused) break; - if (death) break; + if (p_ptr->is_dead) break; /* Obvious */ obvious = TRUE; @@ -977,7 +977,7 @@ bool make_attack_normal(int m_idx) /* Confused monsters cannot steal successfully. -LM-*/ if (m_ptr->confused) break; - if (death) break; + if (p_ptr->is_dead) break; /* Saving throw (unless paralyzed) based on dex and level */ if (!p_ptr->paralyzed && @@ -1099,7 +1099,7 @@ bool make_attack_normal(int m_idx) /* Take some damage */ get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1); - if (death) break; + if (p_ptr->is_dead) break; /* Steal some food */ for (k = 0; k < 10; k++) @@ -1153,7 +1153,7 @@ bool make_attack_normal(int m_idx) /* Take some damage */ get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1); - if (death) break; + if (p_ptr->is_dead) break; /* Drain fuel */ if ((o_ptr->xtra4 > 0) && (!artifact_p(o_ptr))) @@ -1278,7 +1278,7 @@ bool make_attack_normal(int m_idx) /* Take damage */ get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1); - if (death) break; + if (p_ptr->is_dead) break; /* Increase "blind" */ if (!p_ptr->resist_blind) @@ -1306,7 +1306,7 @@ bool make_attack_normal(int m_idx) /* Take damage */ get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1); - if (death) break; + if (p_ptr->is_dead) break; /* Increase "confused" */ if (!p_ptr->resist_conf) @@ -1328,7 +1328,7 @@ bool make_attack_normal(int m_idx) /* Take damage */ get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1); - if (death) break; + if (p_ptr->is_dead) break; /* Increase "afraid" */ if (p_ptr->resist_fear) @@ -1370,7 +1370,7 @@ bool make_attack_normal(int m_idx) /* Take damage */ get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1); - if (death) break; + if (p_ptr->is_dead) break; /* Increase "paralyzed" */ if (p_ptr->free_act) @@ -1415,7 +1415,7 @@ bool make_attack_normal(int m_idx) /* Damage (physical) */ get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1); - if (death) break; + if (p_ptr->is_dead) break; /* Damage (stat) */ if (do_dec_stat(A_STR)) obvious = TRUE; @@ -1428,7 +1428,7 @@ bool make_attack_normal(int m_idx) /* Damage (physical) */ get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1); - if (death) break; + if (p_ptr->is_dead) break; /* Damage (stat) */ if (do_dec_stat(A_INT)) obvious = TRUE; @@ -1441,7 +1441,7 @@ bool make_attack_normal(int m_idx) /* Damage (physical) */ get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1); - if (death) break; + if (p_ptr->is_dead) break; /* Damage (stat) */ if (do_dec_stat(A_WIS)) obvious = TRUE; @@ -1454,7 +1454,7 @@ bool make_attack_normal(int m_idx) /* Damage (physical) */ get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1); - if (death) break; + if (p_ptr->is_dead) break; /* Damage (stat) */ if (do_dec_stat(A_DEX)) obvious = TRUE; @@ -1467,7 +1467,7 @@ bool make_attack_normal(int m_idx) /* Damage (physical) */ get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1); - if (death) break; + if (p_ptr->is_dead) break; /* Damage (stat) */ if (do_dec_stat(A_CON)) obvious = TRUE; @@ -1480,7 +1480,7 @@ bool make_attack_normal(int m_idx) /* Damage (physical) */ get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1); - if (death) break; + if (p_ptr->is_dead) break; /* Damage (stat) */ if (do_dec_stat(A_CHR)) obvious = TRUE; @@ -1493,7 +1493,7 @@ bool make_attack_normal(int m_idx) /* Damage (physical) */ get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1); - if (death) break; + if (p_ptr->is_dead) break; /* Damage (stats) */ if (do_dec_stat(A_STR)) obvious = TRUE; @@ -1534,7 +1534,7 @@ bool make_attack_normal(int m_idx) /* Take damage */ get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1); - if (death) break; + if (p_ptr->is_dead) break; if (p_ptr->prace == RACE_ANDROID) { @@ -1583,7 +1583,7 @@ bool make_attack_normal(int m_idx) /* Take damage */ get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1); - if (death) break; + if (p_ptr->is_dead) break; if (p_ptr->prace == RACE_ANDROID) { @@ -1632,7 +1632,7 @@ bool make_attack_normal(int m_idx) /* Take damage */ get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1); - if (death) break; + if (p_ptr->is_dead) break; if (p_ptr->prace == RACE_ANDROID) { @@ -1681,7 +1681,7 @@ bool make_attack_normal(int m_idx) /* Take damage */ get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1); - if (death) break; + if (p_ptr->is_dead) break; if (p_ptr->prace == RACE_ANDROID) { @@ -1727,7 +1727,7 @@ bool make_attack_normal(int m_idx) /* Take some damage */ get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1); - if (death) break; + if (p_ptr->is_dead) break; /* Take "poison" effect */ if (!(p_ptr->resist_pois || p_ptr->oppose_pois)) @@ -1845,7 +1845,7 @@ bool make_attack_normal(int m_idx) /* Take damage */ get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1); - if (death) break; + if (p_ptr->is_dead) break; if (p_ptr->prace == RACE_ANDROID) { @@ -2026,7 +2026,7 @@ msg_format("%s if (touched) { - if (p_ptr->sh_fire && alive && !death) + if (p_ptr->sh_fire && alive && !p_ptr->is_dead) { if (!(r_ptr->flags3 & RF3_IM_FIRE)) { @@ -2058,7 +2058,7 @@ msg_format("%s } } - if (p_ptr->sh_elec && alive && !death) + if (p_ptr->sh_elec && alive && !p_ptr->is_dead) { if (!(r_ptr->flags3 & RF3_IM_ELEC)) { @@ -2090,7 +2090,7 @@ msg_format("%s } } - if (p_ptr->sh_cold && alive && !death) + if (p_ptr->sh_cold && alive && !p_ptr->is_dead) { if (!(r_ptr->flags3 & RF3_IM_COLD)) { @@ -2123,7 +2123,7 @@ msg_format("%s } /* by henkma */ - if (p_ptr->dustrobe && alive && !death) + if (p_ptr->dustrobe && alive && !p_ptr->is_dead) { if (!(r_ptr->flags4 & RF4_BR_SHAR)) { @@ -2153,7 +2153,7 @@ msg_format("%s } } - if (p_ptr->tim_sh_holy && alive && !death) + if (p_ptr->tim_sh_holy && alive && !p_ptr->is_dead) { if (r_ptr->flags3 & RF3_EVIL) { @@ -2182,7 +2182,7 @@ msg_format("%s } } - if (p_ptr->tim_sh_touki && alive && !death) + if (p_ptr->tim_sh_touki && alive && !p_ptr->is_dead) { int dam = damroll(2, 6); @@ -2286,7 +2286,7 @@ msg_format("%^s } } - if (p_ptr->tim_eyeeye && get_damage > 0 && !death) + if (p_ptr->tim_eyeeye && get_damage > 0 && !p_ptr->is_dead) { #ifdef JP msg_format("¹¶·â¤¬%s¼«¿È¤ò½ý¤Ä¤±¤¿¡ª", m_name); @@ -2303,7 +2303,7 @@ msg_format("%^s } - if ((p_ptr->counter || (p_ptr->special_defense & KATA_MUSOU)) && alive && !death && m_ptr->ml && (p_ptr->csp > 7)) + if ((p_ptr->counter || (p_ptr->special_defense & KATA_MUSOU)) && alive && !p_ptr->is_dead && m_ptr->ml && (p_ptr->csp > 7)) { char m_name[80]; monster_desc(m_name, m_ptr, 0); @@ -2319,7 +2319,7 @@ msg_format("%^s } /* Blink away */ - if (blinked && alive && !death) + if (blinked && alive && !p_ptr->is_dead) { #ifdef JP msg_print("Å¥ËÀ¤Ï¾Ð¤Ã¤Æƨ¤²¤¿¡ª"); @@ -2332,12 +2332,12 @@ msg_format("%^s /* Always notice cause of death */ - if (death && (r_ptr->r_deaths < MAX_SHORT) && !p_ptr->inside_arena) + if (p_ptr->is_dead && (r_ptr->r_deaths < MAX_SHORT) && !p_ptr->inside_arena) { r_ptr->r_deaths++; } - if (m_ptr->ml && fear && alive && !death) + if (m_ptr->ml && fear && alive && !p_ptr->is_dead) { sound(SOUND_FLEE); #ifdef JP diff --git a/src/melee2.c b/src/melee2.c index ee3833e91..36fc30474 100644 --- a/src/melee2.c +++ b/src/melee2.c @@ -3986,7 +3986,7 @@ void process_monsters(void) m_ptr->mflag2 |= MFLAG_NOFLOW; /* Hack -- notice death or departure */ - if (!alive || death) break; + if (!p_ptr->playing || p_ptr->is_dead) break; /* Notice leaving */ if (p_ptr->leaving) break; diff --git a/src/monster1.c b/src/monster1.c index 0039ec9d3..9535329fe 100644 --- a/src/monster1.c +++ b/src/monster1.c @@ -3113,7 +3113,7 @@ void roff_top(int r_idx) Term_addstr(-1, TERM_WHITE, "'):"); /* Wizards get extra info */ - if (wizard) + if (p_ptr->wizard) { char buf[6]; diff --git a/src/monster2.c b/src/monster2.c index f493c942d..4489a3d64 100644 --- a/src/monster2.c +++ b/src/monster2.c @@ -1934,7 +1934,7 @@ msg_format("%s%s /* Demon characters are unaffected */ if ((p_ptr->prace == RACE_IMP) || (p_ptr->prace == RACE_DEMON) || (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_DEMON)) return; - if (wizard) return; + if (p_ptr->wizard) return; /* Undead characters are 50% likely to be unaffected */ if ((p_ptr->prace == RACE_SKELETON) || (p_ptr->prace == RACE_ZOMBIE) diff --git a/src/mspells1.c b/src/mspells1.c index 2e2873838..519657c9e 100644 --- a/src/mspells1.c +++ b/src/mspells1.c @@ -1501,7 +1501,7 @@ bool make_attack_spell(int m_idx) if (!num) return (FALSE); /* Stop if player is dead or gone */ - if (!alive || death) return (FALSE); + if (!p_ptr->playing || p_ptr->is_dead) return (FALSE); /* Stop if player is leaving */ if (p_ptr->leaving) return (FALSE); @@ -4607,19 +4607,19 @@ msg_print("¿ { if (thrown_spell != 167) { - if (mane_num == MAX_MANE) + if (p_ptr->mane_num == MAX_MANE) { int i; - mane_num--; - for (i = 0;i < mane_num;i++) + p_ptr->mane_num--; + for (i = 0;i < p_ptr->mane_num;i++) { - mane_spell[i] = mane_spell[i+1]; - mane_dam[i] = mane_dam[i+1]; + p_ptr->mane_spell[i] = p_ptr->mane_spell[i+1]; + p_ptr->mane_dam[i] = p_ptr->mane_dam[i+1]; } } - mane_spell[mane_num] = thrown_spell - 96; - mane_dam[mane_num] = dam; - mane_num++; + p_ptr->mane_spell[p_ptr->mane_num] = thrown_spell - 96; + p_ptr->mane_dam[p_ptr->mane_num] = dam; + p_ptr->mane_num++; new_mane = TRUE; p_ptr->redraw |= (PR_MANE); @@ -4653,7 +4653,7 @@ msg_print("¿ /* Always take note of monsters that kill you */ - if (death && (r_ptr->r_deaths < MAX_SHORT) && !p_ptr->inside_arena) + if (p_ptr->is_dead && (r_ptr->r_deaths < MAX_SHORT) && !p_ptr->inside_arena) { r_ptr->r_deaths++; } diff --git a/src/mspells2.c b/src/mspells2.c index f2e8286a3..37154bc2d 100644 --- a/src/mspells2.c +++ b/src/mspells2.c @@ -416,7 +416,7 @@ bool monst_spell_monst(int m_idx) if (!num) return (FALSE); /* Stop if player is dead or gone */ - if (!alive || death) return (FALSE); + if (!p_ptr->playing || p_ptr->is_dead) return (FALSE); /* Handle "leaving" */ if (p_ptr->leaving) return (FALSE); @@ -4193,19 +4193,19 @@ msg_format("%^s { if (thrown_spell != 167) { - if (mane_num == MAX_MANE) + if (p_ptr->mane_num == MAX_MANE) { int i; - mane_num--; - for (i = 0;i < mane_num-1;i++) + p_ptr->mane_num--; + for (i = 0;i < p_ptr->mane_num-1;i++) { - mane_spell[i] = mane_spell[i+1]; - mane_dam[i] = mane_dam[i+1]; + p_ptr->mane_spell[i] = p_ptr->mane_spell[i+1]; + p_ptr->mane_dam[i] = p_ptr->mane_dam[i+1]; } } - mane_spell[mane_num] = thrown_spell - 96; - mane_dam[mane_num] = dam; - mane_num++; + p_ptr->mane_spell[p_ptr->mane_num] = thrown_spell - 96; + p_ptr->mane_dam[p_ptr->mane_num] = dam; + p_ptr->mane_num++; new_mane = TRUE; p_ptr->redraw |= (PR_MANE); @@ -4238,7 +4238,7 @@ msg_format("%^s } /* Always take note of monsters that kill you */ - if (death && (r_ptr->r_deaths < MAX_SHORT) && !p_ptr->inside_arena) + if (p_ptr->is_dead && (r_ptr->r_deaths < MAX_SHORT) && !p_ptr->inside_arena) { r_ptr->r_deaths++; } diff --git a/src/object2.c b/src/object2.c index cfd7f7115..6f5fa3701 100644 --- a/src/object2.c +++ b/src/object2.c @@ -775,7 +775,7 @@ void object_aware(object_type *o_ptr) #endif /* SCRIPT_OBJ_KIND */ if(mihanmei && !(k_info[o_ptr->k_idx].gen_flags & TRG_INSTA_ART) && record_ident && - !death && ((o_ptr->tval >= TV_AMULET && o_ptr->tval <= TV_POTION) || (o_ptr->tval == TV_FOOD))) + !p_ptr->is_dead && ((o_ptr->tval >= TV_AMULET && o_ptr->tval <= TV_POTION) || (o_ptr->tval == TV_FOOD))) { object_type forge; object_type *q_ptr; @@ -4791,9 +4791,9 @@ s16b drop_near(object_type *j_ptr, int chance, int y, int x) /* Debug */ #ifdef JP - if (wizard) msg_print("(ÇË»)"); + if (p_ptr->wizard) msg_print("(ÇË»)"); #else - if (wizard) msg_print("(breakage)"); + if (p_ptr->wizard) msg_print("(breakage)"); #endif @@ -4917,9 +4917,9 @@ s16b drop_near(object_type *j_ptr, int chance, int y, int x) /* Debug */ #ifdef JP - if (wizard) msg_print("(¾²¥¹¥Ú¡¼¥¹¤¬¤Ê¤¤)"); + if (p_ptr->wizard) msg_print("(¾²¥¹¥Ú¡¼¥¹¤¬¤Ê¤¤)"); #else - if (wizard) msg_print("(no floor space)"); + if (p_ptr->wizard) msg_print("(no floor space)"); #endif @@ -5012,9 +5012,9 @@ s16b drop_near(object_type *j_ptr, int chance, int y, int x) /* Debug */ #ifdef JP - if (wizard) msg_print("(¥¢¥¤¥Æ¥à¤¬Â¿²á¤®¤ë)"); + if (p_ptr->wizard) msg_print("(¥¢¥¤¥Æ¥à¤¬Â¿²á¤®¤ë)"); #else - if (wizard) msg_print("(too many objects)"); + if (p_ptr->wizard) msg_print("(too many objects)"); #endif diff --git a/src/racial.c b/src/racial.c index c25fe84c7..9f34f0bea 100644 --- a/src/racial.c +++ b/src/racial.c @@ -1317,7 +1317,7 @@ msg_print(" rlev = r_ptr->level; if (r_ptr->flags1 & RF1_UNIQUE) rlev = rlev * 3 / 2; if (rlev > 60) rlev = 60+(rlev-60)/2; - if ((randint1(skill_exp[GINOU_RIDING]/120+p_ptr->lev*2/3) > rlev) && one_in_(2) && !p_ptr->inside_arena && !p_ptr->inside_battle && !(r_ptr->flags7 & (RF7_GUARDIAN)) && !(r_ptr->flags1 & (RF1_QUESTOR)) && (rlev < p_ptr->lev*3/2+randint0(p_ptr->lev/5))) + if ((randint1(p_ptr->skill_exp[GINOU_RIDING]/120+p_ptr->lev*2/3) > rlev) && one_in_(2) && !p_ptr->inside_arena && !p_ptr->inside_battle && !(r_ptr->flags7 & (RF7_GUARDIAN)) && !(r_ptr->flags1 & (RF1_QUESTOR)) && (rlev < p_ptr->lev*3/2+randint0(p_ptr->lev/5))) { #ifdef JP msg_format("%s¤ò¼ê¤Ê¤º¤±¤¿¡£",m_name); diff --git a/src/report.c b/src/report.c index a9a585ed2..f5a502e8d 100644 --- a/src/report.c +++ b/src/report.c @@ -428,7 +428,7 @@ errr report_score(void) buf_sprintf(score, "seikaku: %s\n", seikakutmp); buf_sprintf(score, "realm1: %s\n", realm_names[p_ptr->realm1]); buf_sprintf(score, "realm2: %s\n", realm_names[p_ptr->realm2]); - buf_sprintf(score, "killer: %s\n", died_from); + buf_sprintf(score, "killer: %s\n", p_ptr->died_from); buf_sprintf(score, "-----charcter dump-----\n"); make_dump(score); diff --git a/src/save.c b/src/save.c index 451895bde..a2739d3a8 100644 --- a/src/save.c +++ b/src/save.c @@ -804,7 +804,7 @@ static void wr_options(void) c = 0; - if (wizard) c |= 0x0002; + if (p_ptr->wizard) c |= 0x0002; if (cheat_peek) c |= 0x0100; if (cheat_hear) c |= 0x0200; @@ -921,7 +921,7 @@ static void save_quick_start(void) wr_byte(previous_char.quests); /* No quick start after using debug mode or cheat options */ - if (noscore || munchkin_death) previous_char.quick_ok = FALSE; + if (p_ptr->noscore || munchkin_death) previous_char.quick_ok = FALSE; wr_byte((byte)previous_char.quick_ok); } @@ -936,13 +936,13 @@ static void wr_extra(void) wr_string(player_name); - wr_string(died_from); + wr_string(p_ptr->died_from); save_quick_start(); for (i = 0; i < 4; i++) { - wr_string(history[i]); + wr_string(p_ptr->history[i]); } /* Race/Class/Gender/Spells */ @@ -976,9 +976,9 @@ static void wr_extra(void) wr_u16b(p_ptr->exp_frac); wr_s16b(p_ptr->lev); - for (i = 0; i < 64; i++) wr_s16b(spell_exp[i]); - for (i = 0; i < 5; i++) for (j = 0; j < 64; j++) wr_s16b(weapon_exp[i][j]); - for (i = 0; i < 10; i++) wr_s16b(skill_exp[i]); + for (i = 0; i < 64; i++) wr_s16b(p_ptr->spell_exp[i]); + for (i = 0; i < 5; i++) for (j = 0; j < 64; j++) wr_s16b(p_ptr->weapon_exp[i][j]); + for (i = 0; i < 10; i++) wr_s16b(p_ptr->skill_exp[i]); for (i = 0; i < 108; i++) wr_s32b(p_ptr->magic_num1[i]); for (i = 0; i < 108; i++) wr_byte(p_ptr->magic_num2[i]); @@ -989,10 +989,10 @@ static void wr_extra(void) for (i = 0; i < MAX_MANE; i++) { - wr_s16b(mane_spell[i]); - wr_s16b(mane_dam[i]); + wr_s16b(p_ptr->mane_spell[i]); + wr_s16b(p_ptr->mane_dam[i]); } - wr_s16b(mane_num); + wr_s16b(p_ptr->mane_num); for (i = 0; i < MAX_KUBI; i++) { @@ -1123,7 +1123,7 @@ static void wr_extra(void) wr_byte(p_ptr->action); wr_byte(0); wr_byte(preserve_mode); - wr_byte(wait_report_score); + wr_byte(p_ptr->wait_report_score); /* Future use */ for (i = 0; i < 12; i++) wr_u32b(0L); @@ -1140,13 +1140,13 @@ static void wr_extra(void) /* Special stuff */ - wr_u16b(panic_save); - wr_u16b(total_winner); - wr_u16b(noscore); + wr_u16b(p_ptr->panic_save); + wr_u16b(p_ptr->total_winner); + wr_u16b(p_ptr->noscore); /* Write death */ - wr_byte(death); + wr_byte(p_ptr->is_dead); /* Write feeling */ wr_byte(feeling); @@ -1588,17 +1588,17 @@ static bool wr_savefile_new(void) wr_u16b(tmp16u); for (i = 0; i < tmp16u; i++) { - wr_s16b(player_hp[i]); + wr_s16b(p_ptr->player_hp[i]); } /* Write spell data */ - wr_u32b(spell_learned1); - wr_u32b(spell_learned2); - wr_u32b(spell_worked1); - wr_u32b(spell_worked2); - wr_u32b(spell_forgotten1); - wr_u32b(spell_forgotten2); + wr_u32b(p_ptr->spell_learned1); + wr_u32b(p_ptr->spell_learned2); + wr_u32b(p_ptr->spell_worked1); + wr_u32b(p_ptr->spell_worked2); + wr_u32b(p_ptr->spell_forgotten1); + wr_u32b(p_ptr->spell_forgotten2); wr_s16b(p_ptr->learned_spells); wr_s16b(p_ptr->add_spells); @@ -1606,7 +1606,7 @@ static bool wr_savefile_new(void) /* Dump the ordered spells */ for (i = 0; i < 64; i++) { - wr_byte(spell_order[i]); + wr_byte(p_ptr->spell_order[i]); } @@ -1650,7 +1650,7 @@ static bool wr_savefile_new(void) wr_s16b(p_ptr->pet_extra_flags); /* Write screen dump for sending score */ - if (screen_dump && (wait_report_score || !death)) + if (screen_dump && (p_ptr->wait_report_score || !p_ptr->is_dead)) { wr_string(screen_dump); } @@ -1660,7 +1660,7 @@ static bool wr_savefile_new(void) } /* Player is not dead, write the dungeon */ - if (!death) + if (!p_ptr->is_dead) { /* Dump the dungeon */ wr_dungeon(); @@ -1894,7 +1894,7 @@ bool load_player(void) turn = 0; /* Paranoia */ - death = FALSE; + p_ptr->is_dead = FALSE; /* Allow empty savefile name */ @@ -2147,10 +2147,10 @@ bool load_player(void) } /* Player is dead */ - if (death) + if (p_ptr->is_dead) { /* Player is no longer "dead" */ - death = FALSE; + p_ptr->is_dead = FALSE; /* Cheat death */ if (arg_wizard) diff --git a/src/scores.c b/src/scores.c index f1f08f32d..d98c2290b 100644 --- a/src/scores.c +++ b/src/scores.c @@ -531,7 +531,7 @@ errr top_twenty(void) { /* 2byte ʸ»ú¤ò¹Íθ¤·¤Ê¤¬¤é¥³¥Ô¡¼(EUC ¤ò²¾Äê) */ int cnt = 0; - unsigned char *d = (unsigned char*)died_from; + unsigned char *d = (unsigned char*)p_ptr->died_from; unsigned char *h = (unsigned char*)the_score.how; while(*d && cnt < 31){ if(iskanji(*d)){ @@ -548,16 +548,16 @@ errr top_twenty(void) *h = '\0'; } #endif - if (strlen(died_from) >= 39) + if (strlen(p_ptr->died_from) >= 39) { - mb_strlcpy(the_score.how, died_from, 37+1); + mb_strlcpy(the_score.how, p_ptr->died_from, 37+1); strcat(the_score.how, "¡Ä"); } else - strcpy(the_score.how, died_from); + strcpy(the_score.how, p_ptr->died_from); #else - sprintf(the_score.how, "%-.31s", died_from); + sprintf(the_score.how, "%-.31s", p_ptr->died_from); #endif @@ -901,12 +901,12 @@ void kingly(void) dun_level = 0; /* Fake death */ - if (!streq(died_from, "Seppuku")) + if (!streq(p_ptr->died_from, "Seppuku")) #ifdef JP /* °úÂष¤¿¤È¤­¤Î¼±ÊÌʸ»ú */ - (void)strcpy(died_from, "ripe"); + (void)strcpy(p_ptr->died_from, "ripe"); #else - (void)strcpy(died_from, "Ripe Old Age"); + (void)strcpy(p_ptr->died_from, "Ripe Old Age"); #endif diff --git a/src/spells1.c b/src/spells1.c index c195b9cf2..40cc48711 100644 --- a/src/spells1.c +++ b/src/spells1.c @@ -7478,7 +7478,7 @@ if (fuzzy) msg_print(" } } - if (p_ptr->tim_eyeeye && get_damage > 0 && !death) + if (p_ptr->tim_eyeeye && get_damage > 0 && !p_ptr->is_dead) { #ifdef JP msg_format("¹¶·â¤¬%s¼«¿È¤ò½ý¤Ä¤±¤¿¡ª", m_name); diff --git a/src/spells2.c b/src/spells2.c index e9a8d57e4..cb70feac2 100644 --- a/src/spells2.c +++ b/src/spells2.c @@ -51,7 +51,7 @@ void self_knowledge(void) strcpy(Dummy, ""); - percent = (int)(((long)player_hp[PY_MAX_LEVEL - 1] * 200L) / + percent = (int)(((long)p_ptr->player_hp[PY_MAX_LEVEL - 1] * 200L) / (2 * p_ptr->hitdie + ((PY_MAX_LEVEL - 1+3) * (p_ptr->hitdie + 1)))); diff --git a/src/spells3.c b/src/spells3.c index 0980c5e50..789741d7d 100644 --- a/src/spells3.c +++ b/src/spells3.c @@ -3861,8 +3861,8 @@ strcpy(name, "(Ƚ /* Forgotten */ else if ((j < 1) ? - ((spell_forgotten1 & (1L << i))) : - ((spell_forgotten2 & (1L << (i % 32))))) + ((p_ptr->spell_forgotten1 & (1L << i))) : + ((p_ptr->spell_forgotten2 & (1L << (i % 32))))) { /* Forgotten */ a = TERM_ORANGE; @@ -3870,8 +3870,8 @@ strcpy(name, "(Ƚ /* Unknown */ else if (!((j < 1) ? - (spell_learned1 & (1L << i)) : - (spell_learned2 & (1L << (i % 32))))) + (p_ptr->spell_learned1 & (1L << i)) : + (p_ptr->spell_learned2 & (1L << (i % 32))))) { /* Unknown */ a = TERM_RED; @@ -3879,8 +3879,8 @@ strcpy(name, "(Ƚ /* Untried */ else if (!((j < 1) ? - (spell_worked1 & (1L << i)) : - (spell_worked2 & (1L << (i % 32))))) + (p_ptr->spell_worked1 & (1L << i)) : + (p_ptr->spell_worked2 & (1L << (i % 32))))) { /* Untried */ a = TERM_YELLOW; @@ -3910,8 +3910,8 @@ s16b experience_of_spell(int spell, int realm) { if (p_ptr->pclass == CLASS_SORCERER) return 1600; else if (p_ptr->pclass == CLASS_RED_MAGE) return 1200; - else if (realm+1 == p_ptr->realm1) return spell_exp[spell]; - else if (realm+1 == p_ptr->realm2) return spell_exp[spell + 32]; + else if (realm+1 == p_ptr->realm1) return p_ptr->spell_exp[spell]; + else if (realm+1 == p_ptr->realm2) return p_ptr->spell_exp[spell + 32]; else return 0; } @@ -3952,7 +3952,7 @@ s16b spell_chance(int spell, int realm) chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[mp_ptr->spell_stat]] - 1); if (p_ptr->riding) - chance += (MAX(r_info[m_list[p_ptr->riding].r_idx].level-skill_exp[GINOU_RIDING]/100-10,0)); + chance += (MAX(r_info[m_list[p_ptr->riding].r_idx].level-p_ptr->skill_exp[GINOU_RIDING]/100-10,0)); /* Extract mana consumption rate */ shouhimana = s_ptr->smana*(3800 - experience_of_spell(spell, realm)) + 2399; @@ -4048,8 +4048,8 @@ bool spell_okay(int spell, bool learned, bool study_pray, int realm) /* Spell is forgotten */ if ((realm == p_ptr->realm2 - 1) ? - (spell_forgotten2 & (1L << spell)) : - (spell_forgotten1 & (1L << spell))) + (p_ptr->spell_forgotten2 & (1L << spell)) : + (p_ptr->spell_forgotten1 & (1L << spell))) { /* Never okay */ return (FALSE); @@ -4060,8 +4060,8 @@ bool spell_okay(int spell, bool learned, bool study_pray, int realm) /* Spell is learned */ if ((realm == p_ptr->realm2 - 1) ? - (spell_learned2 & (1L << spell)) : - (spell_learned1 & (1L << spell))) + (p_ptr->spell_learned2 & (1L << spell)) : + (p_ptr->spell_learned1 & (1L << spell))) { /* Always true */ return (!study_pray); @@ -4421,7 +4421,7 @@ void print_spells(int target_spell, byte *spells, int num, int y, int x, int rea bool max = FALSE; - if (((realm < 0) || (realm > MAX_REALM - 1)) && wizard) + if (((realm < 0) || (realm > MAX_REALM - 1)) && p_ptr->wizard) #ifdef JP msg_print("·Ù¹ð¡ª print_spell ¤¬Îΰè¤Ê¤·¤Ë¸Æ¤Ð¤ì¤¿"); #else @@ -4576,8 +4576,8 @@ comment = " ̤ line_attr = TERM_L_BLUE; } else if ((realm + 1 == p_ptr->realm1) ? - ((spell_forgotten1 & (1L << spell))) : - ((spell_forgotten2 & (1L << spell)))) + ((p_ptr->spell_forgotten1 & (1L << spell))) : + ((p_ptr->spell_forgotten2 & (1L << spell)))) { #ifdef JP comment = " ˺µÑ"; @@ -4588,8 +4588,8 @@ comment = " ˺ line_attr = TERM_YELLOW; } else if (!((realm + 1 == p_ptr->realm1) ? - (spell_learned1 & (1L << spell)) : - (spell_learned2 & (1L << spell)))) + (p_ptr->spell_learned1 & (1L << spell)) : + (p_ptr->spell_learned2 & (1L << spell)))) { #ifdef JP comment = " ̤ÃÎ"; @@ -4600,8 +4600,8 @@ comment = " ̤ line_attr = TERM_L_BLUE; } else if (!((realm + 1 == p_ptr->realm1) ? - (spell_worked1 & (1L << spell)) : - (spell_worked2 & (1L << spell)))) + (p_ptr->spell_worked1 & (1L << spell)) : + (p_ptr->spell_worked2 & (1L << spell)))) { #ifdef JP comment = " ̤·Ð¸³"; diff --git a/src/types.h b/src/types.h index bf614f694..ed909c99f 100644 --- a/src/types.h +++ b/src/types.h @@ -974,9 +974,9 @@ struct player_type byte hitdie; /* Hit dice (sides) */ u16b expfact; /* Experience factor - * Note: was byte, causing overflow for Amberite - * characters (such as Amberite Paladins) - */ + * Note: was byte, causing overflow for Amberite + * characters (such as Amberite Paladins) + */ s16b age; /* Characters age */ s16b ht; /* Height */ @@ -1018,24 +1018,27 @@ struct player_type s16b stat_max_max[6]; /* Maximal "maximal" stat values */ s16b stat_cur[6]; /* Current "natural" stat values */ + s16b learned_spells; + s16b add_spells; + u32b count; - s16b fast; /* Timed -- Fast */ - s16b slow; /* Timed -- Slow */ - s16b blind; /* Timed -- Blindness */ + s16b fast; /* Timed -- Fast */ + s16b slow; /* Timed -- Slow */ + s16b blind; /* Timed -- Blindness */ s16b paralyzed; /* Timed -- Paralysis */ s16b confused; /* Timed -- Confusion */ s16b afraid; /* Timed -- Fear */ - s16b image; /* Timed -- Hallucination */ + s16b image; /* Timed -- Hallucination */ s16b poisoned; /* Timed -- Poisoned */ - s16b cut; /* Timed -- Cut */ - s16b stun; /* Timed -- Stun */ + s16b cut; /* Timed -- Cut */ + s16b stun; /* Timed -- Stun */ s16b protevil; /* Timed -- Protection */ s16b invuln; /* Timed -- Invulnerable */ s16b ult_res; /* Timed -- Ultimate Resistance */ - s16b hero; /* Timed -- Heroism */ - s16b shero; /* Timed -- Super Heroism */ + s16b hero; /* Timed -- Heroism */ + s16b shero; /* Timed -- Super Heroism */ s16b shield; /* Timed -- Shield Spell */ s16b blessed; /* Timed -- Blessed */ s16b tim_invis; /* Timed -- See Invisible */ @@ -1084,18 +1087,77 @@ struct player_type s16b virtues[8]; s16b vir_types[8]; - s16b word_recall; /* Word of recall counter */ - byte recall_dungeon; + s16b word_recall; /* Word of recall counter */ + byte recall_dungeon; /* Dungeon set to be recalled */ - s16b energy_need; /* Energy needed for next move */ + s16b energy_need; /* Energy needed for next move */ - s16b food; /* Current nutrition */ + s16b food; /* Current nutrition */ - u32b total_weight; /* Total weight being carried */ + u32b special_attack; /* Special attack capacity -LM- */ + u32b special_defense; /* Special block capacity -LM- */ + byte action; /* Currently action */ + + u32b spell_learned1; /* bit mask of spells learned */ + u32b spell_learned2; /* bit mask of spells learned */ + u32b spell_worked1; /* bit mask of spells tried and worked */ + u32b spell_worked2; /* bit mask of spells tried and worked */ + u32b spell_forgotten1; /* bit mask of spells learned but forgotten */ + u32b spell_forgotten2; /* bit mask of spells learned but forgotten */ + byte spell_order[64]; /* order spells learned/remembered/forgotten */ + + s16b spell_exp[64]; /* Proficiency of spells */ + s16b weapon_exp[5][64]; /* Proficiency of weapons */ + s16b skill_exp[10]; /* Proficiency of misc. skill */ + + s32b magic_num1[108]; /* Array for non-spellbook type magic */ + byte magic_num2[108]; /* Flags for non-spellbook type magics */ + + s16b mane_spell[MAX_MANE]; + s16b mane_dam[MAX_MANE]; + s16b mane_num; + + s16b player_hp[PY_MAX_LEVEL]; + char died_from[80]; /* What killed the player */ + char history[4][60]; /* Textual "history" for the Player */ + + u16b total_winner; /* Total winner */ + u16b panic_save; /* Panic save */ + + u16b noscore; /* Cheating flags */ + + bool wait_report_score; /* Waiting to report score */ + bool is_dead; /* Player is dead */ + + bool wizard; /* Player is in wizard mode */ + + s16b riding; /* Riding on a monster of this index */ + byte knowledge; /* Knowledge about yourself */ + s32b visit; /* Visited towns */ + + byte start_race; /* Race at birth */ + s32b old_race1; /* Record of race changes */ + s32b old_race2; /* Record of race changes */ + s16b old_realm; /* Record of realm changes */ + + s16b pet_follow_distance; /* Length of the imaginary "leash" for pets */ + s16b pet_extra_flags; /* Various flags for controling pets */ - u32b special_attack; /* Special attack capacity -LM- */ - u32b special_defense; /* Special block capacity -LM- */ - byte action; /* Currently action */ + s16b today_mon; /* Wanted monster */ + + bool dtrap; /* Whether you are on trap-safe grids */ + + + /*** Temporary fields ***/ + + bool playing; /* True if player is playing */ + bool leaving; /* True if player is leaving */ + + byte exit_bldg; /* Goal obtained in arena? -KMW- */ + byte leftbldg; /* did we just leave a special area? -KMW- */ + + bool leaving_dungeon; /* True if player is leaving the dungeon */ + bool teleport_town; s16b health_who; /* Health bar trackee */ @@ -1104,10 +1166,9 @@ struct player_type s16b object_kind_idx; /* Object kind trackee */ s16b new_spells; /* Number of spells available */ - s16b old_spells; - s16b learned_spells; - s16b add_spells; + + s16b old_food_aux; /* Old value of food */ bool old_cumber_armor; bool old_cumber_glove; @@ -1119,10 +1180,6 @@ struct player_type bool old_monlite; s16b old_lite; /* Old radius of lite (if any) */ - s16b old_view; /* Old radius of view (if any) */ - - s16b old_food_aux; /* Old value of food */ - bool cumber_armor; /* Mana draining armor */ bool cumber_glove; /* Mana draining gloves */ @@ -1144,6 +1201,18 @@ struct player_type s16b stat_use[6]; /* Current modified stats */ s16b stat_top[6]; /* Maximal modified stats */ + bool sutemi; + bool counter; + + s32b align; /* Good/evil/neutral */ + s16b run_py; + s16b run_px; + + + /*** Extracted fields ***/ + + u32b total_weight; /* Total weight being carried */ + s16b stat_add[6]; /* Modifiers to stat values */ s16b stat_ind[6]; /* Indexes into stat tables */ @@ -1187,12 +1256,10 @@ struct player_type bool sustain_chr; /* Keep charisma */ u32b cursed; /* Player is cursed */ - bool sutemi; - bool counter; - bool can_swim; /* No damage falling */ - bool ffall; /* No damage falling */ - bool lite; /* Permanent light */ + bool can_swim; /* No damage falling */ + bool ffall; /* No damage falling */ + bool lite; /* Permanent light */ bool free_act; /* Never paralyzed */ bool see_inv; /* Can see invisible */ bool regenerate; /* Regenerate hit pts */ @@ -1254,38 +1321,6 @@ struct player_type byte tval_ammo; /* Correct ammo tval */ s16b pspeed; /* Current speed */ - - /*** Pet commands ***/ - s16b pet_follow_distance; /* Length of the imaginary "leash" for pets */ - s16b pet_extra_flags; /* Length of the imaginary "leash" for pets */ - - /*** Temporary fields ***/ - byte exit_bldg; /* Goal obtained in arena? -KMW- */ - byte leftbldg; /* did we just leave a special area? -KMW- */ - bool leaving; /* True if player is leaving */ - - bool leaving_dungeon; /* True if player is leaving the dungeon */ - bool teleport_town; - - s32b align; /* Good/evil/neutral */ - s16b today_mon; - - s16b riding; - byte knowledge; - s32b visit; - - s32b magic_num1[108]; - byte magic_num2[108]; - - byte start_race; - s32b old_race1; - s32b old_race2; - s16b old_realm; - - s16b run_py; - s16b run_px; - - bool dtrap; }; diff --git a/src/util.c b/src/util.c index e4c3fec48..781a3c3c3 100644 --- a/src/util.c +++ b/src/util.c @@ -2574,7 +2574,7 @@ static void msg_flush(int x) } now_damaged = FALSE; - if (!alive || !nagasu) + if (!p_ptr->playing || !nagasu) { /* Pause for response */ #ifdef JP diff --git a/src/variable.c b/src/variable.c index 584f951e7..11433973e 100644 --- a/src/variable.c +++ b/src/variable.c @@ -118,10 +118,6 @@ byte create_down_stair; /* Auto-create "down stairs" */ bool msg_flag; /* Used in msg_print() for "buffering" */ -bool alive; /* True if game is running */ - -bool death; /* True if player has died */ - s16b running; /* Current counter for running, if any */ s16b resting; /* Current counter for resting, if any */ @@ -138,18 +134,10 @@ s32b dungeon_turn; /* Game turn in dungeon */ s32b old_turn; /* Turn when level began (feelings) */ s32b old_battle; -bool wizard; /* Is the player currently in Wizard mode? */ - bool use_sound; /* The "sound" mode is enabled */ bool use_graphics; /* The "graphics" mode is enabled */ bool use_bigtile = FALSE; -u16b total_winner; /* Semi-Hack -- Game has been won */ - -u16b panic_save; /* Track some special "conditions" */ -u16b noscore; /* Track various "cheating" conditions */ -bool wait_report_score; /* Waiting to report score */ - s16b signal_count; /* Hack -- Count interupts */ bool inkey_base; /* See the "inkey()" function */ @@ -386,15 +374,6 @@ char player_name[32]; */ char player_base[32]; -/* - * What killed the player - */ -char died_from[80]; - -/* - * Hack -- Textual "history" for the Player - */ -char history[4][60]; /* * Buffer to hold the current savefile name @@ -737,27 +716,6 @@ player_magic *mp_ptr; /* - * More spell info - */ -u32b spell_learned1; /* bit mask of spells learned */ -u32b spell_learned2; /* bit mask of spells learned */ -u32b spell_worked1; /* bit mask of spells tried and worked */ -u32b spell_worked2; /* bit mask of spells tried and worked */ -u32b spell_forgotten1; /* bit mask of spells learned but forgotten */ -u32b spell_forgotten2; /* bit mask of spells learned but forgotten */ -byte spell_order[64]; /* order spells learned/remembered/forgotten */ - - -/* - * Calculated base hp values for player at each level, - * store them so that drain life + restore life does not - * affect hit points. Also prevents shameless use of backup - * savefiles for hitpoint acquirement. - */ -s16b player_hp[PY_MAX_LEVEL]; - - -/* * The last character rolled, * holded for quick start */ @@ -1150,19 +1108,9 @@ bool autochara; bool can_save = FALSE; /* Game can be saved */ -s16b spell_exp[64]; /* mahou keikenchi */ - -s16b weapon_exp[5][64]; /* weapon keikenchi */ - -s16b skill_exp[10]; /* ginou keikenchi */ - bool world_monster; bool world_player; -s16b mane_spell[MAX_MANE]; -s16b mane_dam[MAX_MANE]; -s16b mane_num; - int cap_mon; int cap_mspeed; int cap_hp; diff --git a/src/wild.c b/src/wild.c index 7d4926e9c..8521d7792 100644 --- a/src/wild.c +++ b/src/wild.c @@ -605,7 +605,7 @@ static void generate_area(int y, int x, bool border, bool corner) } } - if (wilderness[y][x].entrance && !wilderness[y][x].town && (total_winner || !(d_info[wilderness[y][x].entrance].flags1 & DF1_WINNER))) + if (wilderness[y][x].entrance && !wilderness[y][x].town && (p_ptr->total_winner || !(d_info[wilderness[y][x].entrance].flags1 & DF1_WINNER))) { int dy, dx; @@ -886,7 +886,7 @@ void wilderness_gen_small() cave[j][i].special = wilderness[j][i].town; } else if (wilderness[j][i].road) cave[j][i].feat = FEAT_FLOOR; - else if (wilderness[j][i].entrance && (total_winner || !(d_info[wilderness[j][i].entrance].flags1 & DF1_WINNER))) + else if (wilderness[j][i].entrance && (p_ptr->total_winner || !(d_info[wilderness[j][i].entrance].flags1 & DF1_WINNER))) { cave[j][i].feat = FEAT_ENTRANCE; cave[j][i].special = (byte)wilderness[j][i].entrance; diff --git a/src/wizard2.c b/src/wizard2.c index 767d966f0..cfb78d607 100644 --- a/src/wizard2.c +++ b/src/wizard2.c @@ -29,27 +29,27 @@ void do_cmd_rerate(bool display) /* Rerate */ while (1) { - player_hp[0] = p_ptr->hitdie; + p_ptr->player_hp[0] = p_ptr->hitdie; for (i = 1; i < 4; i++) { j = randint1(p_ptr->hitdie); - player_hp[0] += j; + p_ptr->player_hp[0] += j; } /* Collect values */ for (i = 1; i < PY_MAX_LEVEL; i++) { - player_hp[i] = randint1(p_ptr->hitdie); - player_hp[i] += player_hp[i - 1]; + p_ptr->player_hp[i] = randint1(p_ptr->hitdie); + p_ptr->player_hp[i] += p_ptr->player_hp[i - 1]; } /* Legal values */ - if ((player_hp[PY_MAX_LEVEL - 1] >= min_value) && - (player_hp[PY_MAX_LEVEL - 1] <= max_value)) break; + if ((p_ptr->player_hp[PY_MAX_LEVEL - 1] >= min_value) && + (p_ptr->player_hp[PY_MAX_LEVEL - 1] <= max_value)) break; } - percent = (int)(((long)player_hp[PY_MAX_LEVEL - 1] * 200L) / + percent = (int)(((long)p_ptr->player_hp[PY_MAX_LEVEL - 1] * 200L) / (2 * p_ptr->hitdie + ((PY_MAX_LEVEL - 1+3) * (p_ptr->hitdie + 1)))); @@ -400,21 +400,21 @@ static void do_cmd_wiz_change_aux(void) { for (i = 0;i < 64;i++) { - weapon_exp[j][i] = tmp_s16b; - if (weapon_exp[j][i] > s_info[p_ptr->pclass].w_max[j][i]) weapon_exp[j][i] = s_info[p_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 (j = 0; j < 10; j++) { - skill_exp[j] = tmp_s16b; - if (skill_exp[j] > s_info[p_ptr->pclass].s_max[j]) skill_exp[j] = s_info[p_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]; } for (j = 0; j < 32; j++) - spell_exp[j] = (tmp_s16b > 1600 ? 1600 : tmp_s16b); + p_ptr->spell_exp[j] = (tmp_s16b > 1600 ? 1600 : tmp_s16b); for (; j < 64; j++) - spell_exp[j] = (tmp_s16b > 1400 ? 1400 : tmp_s16b); + p_ptr->spell_exp[j] = (tmp_s16b > 1400 ? 1400 : tmp_s16b); /* Default */ sprintf(tmp_val, "%ld", (long)(p_ptr->au)); diff --git a/src/xtra1.c b/src/xtra1.c index a9fa07dd3..8e27d2c34 100644 --- a/src/xtra1.c +++ b/src/xtra1.c @@ -652,7 +652,7 @@ static void prt_title(void) char str[14]; /* Wizard */ - if (wizard) + if (p_ptr->wizard) { #ifdef JP /* ±ÑÆüÀÚ¤êÂؤ¨µ¡Ç½ ¾Î¹æ */ @@ -664,7 +664,7 @@ static void prt_title(void) } /* Winner */ - else if (total_winner || (p_ptr->lev > PY_MAX_LEVEL)) + else if (p_ptr->total_winner || (p_ptr->lev > PY_MAX_LEVEL)) { if ((p_ptr->arena_number > MAX_ARENA_MONS+2) && (p_ptr->arena_number < 99)) { @@ -1330,7 +1330,7 @@ static void prt_mane(void) if (p_ptr->pclass == CLASS_IMITATOR) { - if (mane_num) + if (p_ptr->mane_num) { byte attr; if (new_mane) attr = TERM_L_RED; @@ -2123,8 +2123,8 @@ static void calc_spells(void) { /* Count known spells */ if ((j < 32) ? - (spell_forgotten1 & (1L << j)) : - (spell_forgotten2 & (1L << (j - 32)))) + (p_ptr->spell_forgotten1 & (1L << j)) : + (p_ptr->spell_forgotten2 & (1L << (j - 32)))) { num_boukyaku++; } @@ -2137,10 +2137,10 @@ static void calc_spells(void) for (i = 63; i >= 0; i--) { /* Efficiency -- all done */ - if (!spell_learned1 && !spell_learned2) break; + if (!p_ptr->spell_learned1 && !p_ptr->spell_learned2) break; /* Access the spell */ - j = spell_order[i]; + j = p_ptr->spell_order[i]; /* Skip non-spells */ if (j >= 99) continue; @@ -2164,30 +2164,30 @@ static void calc_spells(void) /* Is it known? */ if ((j < 32) ? - (spell_learned1 & (1L << j)) : - (spell_learned2 & (1L << (j - 32)))) + (p_ptr->spell_learned1 & (1L << j)) : + (p_ptr->spell_learned2 & (1L << (j - 32)))) { /* Mark as forgotten */ if (j < 32) { - spell_forgotten1 |= (1L << j); + p_ptr->spell_forgotten1 |= (1L << j); which = use_realm1; } else { - spell_forgotten2 |= (1L << (j - 32)); + p_ptr->spell_forgotten2 |= (1L << (j - 32)); which = use_realm2; } /* No longer known */ if (j < 32) { - spell_learned1 &= ~(1L << j); + p_ptr->spell_learned1 &= ~(1L << j); which = use_realm1; } else { - spell_learned2 &= ~(1L << (j - 32)); + p_ptr->spell_learned2 &= ~(1L << (j - 32)); which = use_realm2; } @@ -2214,40 +2214,40 @@ static void calc_spells(void) if (p_ptr->new_spells >= 0) break; /* Efficiency -- all done */ - if (!spell_learned1 && !spell_learned2) break; + if (!p_ptr->spell_learned1 && !p_ptr->spell_learned2) break; /* Get the (i+1)th spell learned */ - j = spell_order[i]; + j = p_ptr->spell_order[i]; /* Skip unknown spells */ if (j >= 99) continue; /* Forget it (if learned) */ if ((j < 32) ? - (spell_learned1 & (1L << j)) : - (spell_learned2 & (1L << (j - 32)))) + (p_ptr->spell_learned1 & (1L << j)) : + (p_ptr->spell_learned2 & (1L << (j - 32)))) { /* Mark as forgotten */ if (j < 32) { - spell_forgotten1 |= (1L << j); + p_ptr->spell_forgotten1 |= (1L << j); which = use_realm1; } else { - spell_forgotten2 |= (1L << (j - 32)); + p_ptr->spell_forgotten2 |= (1L << (j - 32)); which = use_realm2; } /* No longer known */ if (j < 32) { - spell_learned1 &= ~(1L << j); + p_ptr->spell_learned1 &= ~(1L << j); which = use_realm1; } else { - spell_learned2 &= ~(1L << (j - 32)); + p_ptr->spell_learned2 &= ~(1L << (j - 32)); which = use_realm2; } @@ -2274,10 +2274,10 @@ static void calc_spells(void) if (p_ptr->new_spells <= 0) break; /* Efficiency -- all done */ - if (!spell_forgotten1 && !spell_forgotten2) break; + if (!p_ptr->spell_forgotten1 && !p_ptr->spell_forgotten2) break; /* Get the next spell we learned */ - j = spell_order[i]; + j = p_ptr->spell_order[i]; /* Skip unknown spells */ if (j >= 99) break; @@ -2300,30 +2300,30 @@ static void calc_spells(void) /* First set of spells */ if ((j < 32) ? - (spell_forgotten1 & (1L << j)) : - (spell_forgotten2 & (1L << (j - 32)))) + (p_ptr->spell_forgotten1 & (1L << j)) : + (p_ptr->spell_forgotten2 & (1L << (j - 32)))) { /* No longer forgotten */ if (j < 32) { - spell_forgotten1 &= ~(1L << j); + p_ptr->spell_forgotten1 &= ~(1L << j); which = use_realm1; } else { - spell_forgotten2 &= ~(1L << (j - 32)); + p_ptr->spell_forgotten2 &= ~(1L << (j - 32)); which = use_realm2; } /* Known once more */ if (j < 32) { - spell_learned1 |= (1L << j); + p_ptr->spell_learned1 |= (1L << j); which = use_realm1; } else { - spell_learned2 |= (1L << (j - 32)); + p_ptr->spell_learned2 |= (1L << (j - 32)); which = use_realm2; } @@ -2356,7 +2356,7 @@ static void calc_spells(void) if (s_ptr->slevel > p_ptr->lev) continue; /* Skip spells we already know */ - if (spell_learned1 & (1L << j)) + if (p_ptr->spell_learned1 & (1L << j)) { continue; } @@ -2749,7 +2749,7 @@ static void calc_hitpoints(void) bonus = ((int)(adj_con_mhp[p_ptr->stat_ind[A_CON]]) - 128) * p_ptr->lev / 4; /* Calculate hitpoints */ - mhp = player_hp[p_ptr->lev - 1]; + mhp = p_ptr->player_hp[p_ptr->lev - 1]; if (p_ptr->mimic_form) { @@ -4437,15 +4437,15 @@ void calc_bonuses(void) if (!buki_motteruka(INVEN_RARM) && !buki_motteruka(INVEN_LARM)) { - p_ptr->to_h[0] += (skill_exp[GINOU_SUDE]-4000)/200; - p_ptr->dis_to_h[0] += (skill_exp[GINOU_SUDE]-4000)/200; + p_ptr->to_h[0] += (p_ptr->skill_exp[GINOU_SUDE]-4000)/200; + p_ptr->dis_to_h[0] += (p_ptr->skill_exp[GINOU_SUDE]-4000)/200; } if (buki_motteruka(INVEN_RARM) && buki_motteruka(INVEN_LARM)) { int penalty1, penalty2; - penalty1 = ((100-skill_exp[GINOU_NITOURYU]/160) - (130-inventory[INVEN_RARM].weight)/8); - penalty2 = ((100-skill_exp[GINOU_NITOURYU]/160) - (130-inventory[INVEN_LARM].weight)/8); + penalty1 = ((100-p_ptr->skill_exp[GINOU_NITOURYU]/160) - (130-inventory[INVEN_RARM].weight)/8); + penalty2 = ((100-p_ptr->skill_exp[GINOU_NITOURYU]/160) - (130-inventory[INVEN_LARM].weight)/8); if ((inventory[INVEN_RARM].name1 == ART_QUICKTHORN) && (inventory[INVEN_LARM].name1 == ART_TINYTHORN)) { penalty1 = penalty1 / 2 - 5; @@ -4497,7 +4497,7 @@ void calc_bonuses(void) int speed = m_list[p_ptr->riding].mspeed; if (m_list[p_ptr->riding].mspeed > 110) { - p_ptr->pspeed = 110 + (s16b)((speed-110)*(skill_exp[GINOU_RIDING]*3 + p_ptr->lev*160L - 10000L)/(22000L)); + p_ptr->pspeed = 110 + (s16b)((speed-110)*(p_ptr->skill_exp[GINOU_RIDING]*3 + p_ptr->lev*160L - 10000L)/(22000L)); if (p_ptr->pspeed < 110) p_ptr->pspeed = 110; } else @@ -4509,7 +4509,7 @@ void calc_bonuses(void) if (r_info[m_list[p_ptr->riding].r_idx].flags7 & RF7_CAN_FLY) p_ptr->ffall = TRUE; if (r_info[m_list[p_ptr->riding].r_idx].flags7 & (RF7_CAN_SWIM | RF7_AQUATIC)) p_ptr->can_swim = TRUE; - if (skill_exp[GINOU_RIDING] < 2000) j += (p_ptr->wt*3*(2000 - skill_exp[GINOU_RIDING]))/2000; + if (p_ptr->skill_exp[GINOU_RIDING] < 2000) j += (p_ptr->wt*3*(2000 - p_ptr->skill_exp[GINOU_RIDING]))/2000; i = 3000 + r_info[m_list[p_ptr->riding].r_idx].level * 50; } @@ -4899,7 +4899,7 @@ void calc_bonuses(void) } else { - penalty = r_info[m_list[p_ptr->riding].r_idx].level - skill_exp[GINOU_RIDING] / 80; + penalty = r_info[m_list[p_ptr->riding].r_idx].level - p_ptr->skill_exp[GINOU_RIDING] / 80; penalty += 30; if (penalty < 30) penalty = 30; } @@ -4925,7 +4925,7 @@ void calc_bonuses(void) } else { - penalty = r_info[m_list[p_ptr->riding].r_idx].level - skill_exp[GINOU_RIDING] / 80; + penalty = r_info[m_list[p_ptr->riding].r_idx].level - p_ptr->skill_exp[GINOU_RIDING] / 80; penalty += 30; if (penalty < 30) penalty = 30; } @@ -5031,8 +5031,8 @@ void calc_bonuses(void) int tval = inventory[INVEN_RARM+i].tval - TV_BOW; int sval = inventory[INVEN_RARM+i].sval; - p_ptr->to_h[i] += (weapon_exp[tval][sval]-4000)/200; - p_ptr->dis_to_h[i] += (weapon_exp[tval][sval]-4000)/200; + p_ptr->to_h[i] += (p_ptr->weapon_exp[tval][sval]-4000)/200; + p_ptr->dis_to_h[i] += (p_ptr->weapon_exp[tval][sval]-4000)/200; if ((p_ptr->pclass == CLASS_MONK) && !(s_info[CLASS_MONK].w_max[tval][sval])) { p_ptr->to_h[i] -= 40; diff --git a/src/xtra2.c b/src/xtra2.c index 97aa9d34d..b05507162 100644 --- a/src/xtra2.c +++ b/src/xtra2.c @@ -1332,7 +1332,7 @@ msg_print(" break; } - if ((a_idx > 0) && ((randint0(100) < chance) || (wizard))) + if ((a_idx > 0) && ((randint0(100) < chance) || (p_ptr->wizard))) { if (a_info[a_idx].cur_num == 0) { @@ -1460,7 +1460,7 @@ msg_print(" if (m_ptr->r_idx == MON_SERPENT) { /* Total winner */ - total_winner = TRUE; + p_ptr->total_winner = TRUE; /* Redraw the "title" */ p_ptr->redraw |= (PR_TITLE); @@ -3618,7 +3618,7 @@ s2 = " } /* Display a message */ - if (wizard) + if (p_ptr->wizard) #ifdef JP sprintf(out_val, "%s%s%s%s[%s] %x %d %d %d %d (%d,%d)", s1, name, s2, s3, info, c_ptr->info, c_ptr->feat, c_ptr->dist, c_ptr->cost, c_ptr->when, x, y); #else -- 2.11.0