*/
static void pattern_teleport(void)
{
- int min_level = 0;
- int max_level = 99;
+ DEPTH min_level = 0;
+ DEPTH max_level = 99;
/* Ask for level */
if (get_check(_("他の階にテレポートしますか?", "Teleport level? ")))
sprintf(ppp, _("テレポート先:(%d-%d)", "Teleport to level (%d-%d): "), min_level, max_level);
/* Default */
- sprintf(tmp_val, "%d", dun_level);
+ sprintf(tmp_val, "%d", (int)dun_level);
/* Ask for a level */
if (!get_string(ppp, tmp_val, 10)) return;
/* Extract request */
- command_arg = atoi(tmp_val);
+ command_arg = (COMMAND_ARG)atoi(tmp_val);
}
else if (get_check(_("通常テレポート?", "Normal teleport? ")))
{
}
/* Paranoia */
- if (command_arg < min_level) command_arg = min_level;
+ if (command_arg < min_level) command_arg = (COMMAND_ARG)min_level;
/* Paranoia */
- if (command_arg > max_level) command_arg = max_level;
+ if (command_arg > max_level) command_arg = (COMMAND_ARG)max_level;
/* Accept request */
msg_format(_("%d 階にテレポートしました。", "You teleport to dungeon level %d."), command_arg);
if (record_stair) do_cmd_write_nikki(NIKKI_PAT_TELE,0,NULL);
p_ptr->inside_quest = 0;
- energy_use = 0;
+ p_ptr->energy_use = 0;
/*
* Clear all saved floors
*/
static void wreck_the_pattern(void)
{
- int to_ruin = 0, r_y, r_x;
- int pattern_type = f_info[cave[py][px].feat].subtype;
+ int to_ruin = 0;
+ POSITION r_y, r_x;
+ int pattern_type = f_info[cave[p_ptr->y][p_ptr->x].feat].subtype;
if (pattern_type == PATTERN_TILE_WRECKED)
{
while (to_ruin--)
{
- scatter(&r_y, &r_x, py, px, 4, 0);
+ scatter(&r_y, &r_x, p_ptr->y, p_ptr->x, 4, 0);
if (pattern_tile(r_y, r_x) &&
(f_info[cave[r_y][r_x].feat].subtype != PATTERN_TILE_WRECKED))
}
}
- cave_set_feat(py, px, feat_pattern_corrupted);
+ cave_set_feat(p_ptr->y, p_ptr->x, feat_pattern_corrupted);
}
/*!
{
int pattern_type;
- if (!pattern_tile(py, px)) return FALSE;
+ if (!pattern_tile(p_ptr->y, p_ptr->x)) return FALSE;
if ((prace_is_(RACE_AMBERITE)) &&
(p_ptr->cut > 0) && one_in_(10))
wreck_the_pattern();
}
- pattern_type = f_info[cave[py][px].feat].subtype;
+ pattern_type = f_info[cave[p_ptr->y][p_ptr->x].feat].subtype;
switch (pattern_type)
{
(void)restore_level();
(void)hp_player(1000);
- cave_set_feat(py, px, feat_pattern_old);
+ cave_set_feat(p_ptr->y, p_ptr->x, feat_pattern_old);
msg_print(_("「パターン」のこの部分は他の部分より強力でないようだ。", "This section of the Pattern looks less powerful."));
/*
*/
static void process_world_aux_hp_and_sp(void)
{
- feature_type *f_ptr = &f_info[cave[py][px].feat];
+ feature_type *f_ptr = &f_info[cave[p_ptr->y][p_ptr->x].feat];
bool cave_no_regen = FALSE;
int upkeep_factor = 0;
{
if (!dun_level && !p_ptr->resist_lite && !IS_INVULN() && is_daytime())
{
- if ((cave[py][px].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
+ if ((cave[p_ptr->y][p_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
{
/* Take damage */
msg_print(_("日光があなたのアンデッドの肉体を焼き焦がした!", "The sun's rays scorch your undead flesh!"));
{
msg_print(_("熱で火傷した!", "The heat burns you!"));
take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
- f_name + f_info[get_feat_mimic(&cave[py][px])].name), -1);
+ f_name + f_info[get_feat_mimic(&cave[p_ptr->y][p_ptr->x])].name), -1);
}
else
{
- cptr name = f_name + f_info[get_feat_mimic(&cave[py][px])].name;
+ cptr name = f_name + f_info[get_feat_mimic(&cave[p_ptr->y][p_ptr->x])].name;
msg_format(_("%sで火傷した!", "The %s burns you!"), name);
take_hit(DAMAGE_NOESCAPE, damage, name, -1);
}
if (pet) mode |= PM_FORCE_PET;
else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
- if (summon_specific((pet ? -1 : 0), py, px,
+ if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x,
dun_level, SUMMON_DEMON, mode))
{
msg_print(_("あなたはデーモンを引き寄せた!", "You have attracted a demon!"));
msg_print(NULL);
/* Absorb light from the current possition */
- if ((cave[py][px].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
+ if ((cave[p_ptr->y][p_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
{
hp_player(10);
}
if (pet) mode |= PM_FORCE_PET;
else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
- if (summon_specific((pet ? -1 : 0), py, px, dun_level, SUMMON_ANIMAL, mode))
+ if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, dun_level, SUMMON_ANIMAL, mode))
{
msg_print(_("動物を引き寄せた!", "You have attracted an animal!"));
disturb(0, 1);
if (pet) mode |= PM_FORCE_PET;
else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
- if (summon_specific((pet ? -1 : 0), py, px, dun_level, SUMMON_DRAGON, mode))
+ if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, dun_level, SUMMON_DRAGON, mode))
{
msg_print(_("ドラゴンを引き寄せた!", "You have attracted a dragon!"));
disturb(0, 1);
/* Call animal */
if ((p_ptr->cursed & TRC_CALL_ANIMAL) && one_in_(2500))
{
- if (summon_specific(0, py, px, dun_level, SUMMON_ANIMAL,
+ if (summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_ANIMAL,
(PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
{
char o_name[MAX_NLEN];
/* Call demon */
if ((p_ptr->cursed & TRC_CALL_DEMON) && one_in_(1111))
{
- if (summon_specific(0, py, px, dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
+ if (summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
{
char o_name[MAX_NLEN];
/* Call dragon */
if ((p_ptr->cursed & TRC_CALL_DRAGON) && one_in_(800))
{
- if (summon_specific(0, py, px, dun_level, SUMMON_DRAGON,
+ if (summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_DRAGON,
(PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
{
char o_name[MAX_NLEN];
/* Call undead */
if ((p_ptr->cursed & TRC_CALL_UNDEAD) && one_in_(1111))
{
- if (summon_specific(0, py, px, dun_level, SUMMON_UNDEAD,
+ if (summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_UNDEAD,
(PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
{
char o_name[MAX_NLEN];
if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
{
/* Determine how many rods are charging. */
- int temp = (o_ptr->timeout + (k_ptr->pval - 1)) / k_ptr->pval;
- if (temp > o_ptr->number) temp = o_ptr->number;
+ TIME_EFFECT temp = (o_ptr->timeout + (k_ptr->pval - 1)) / k_ptr->pval;
+ if (temp > o_ptr->number) temp = (TIME_EFFECT)o_ptr->number;
/* Decrease timeout by that number. */
o_ptr->timeout -= temp;
if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
{
/* Charge it */
- o_ptr->timeout -= o_ptr->number;
+ o_ptr->timeout -= (TIME_EFFECT)o_ptr->number;
/* Boundary control. */
if (o_ptr->timeout < 0) o_ptr->timeout = 0;
if (p_ptr->wild_mode)
{
- p_ptr->wilderness_y = py;
- p_ptr->wilderness_x = px;
+ p_ptr->wilderness_y = p_ptr->y;
+ p_ptr->wilderness_x = p_ptr->x;
}
else
{
/* Save player position */
- p_ptr->oldpx = px;
- p_ptr->oldpy = py;
+ p_ptr->oldpx = p_ptr->x;
+ p_ptr->oldpy = p_ptr->y;
}
p_ptr->wild_mode = FALSE;
* @param m_idx 隣接数を調べたいモンスターのID
* @return 隣接しているモンスターの数
*/
-static int get_monster_crowd_number(int m_idx)
+static int get_monster_crowd_number(MONSTER_IDX m_idx)
{
monster_type *m_ptr = &m_list[m_idx];
int my = m_ptr->fy;
{
const int base = 10;
int rating = 0;
- int i;
+ IDX i;
/* Hack -- no feeling in the town */
if (!dun_level) return 0;
/* Update dungeon feeling, and announce it if changed */
update_dungeon_feeling();
+ /* 帰還無しモード時のレベルテレポバグ対策 / Fix for level teleport bugs on ironman_downward.*/
+ if (ironman_downward && (dungeon_type != DUNGEON_ANGBAND && dungeon_type != 0))
+ {
+ dun_level = 0;
+ dungeon_type = 0;
+ prepare_change_floor_mode(CFM_FIRST_FLOOR | CFM_RAND_PLACE);
+ p_ptr->inside_arena = FALSE;
+ p_ptr->wild_mode = FALSE;
+ p_ptr->leaving = TRUE;
+ }
+
/*** Check monster arena ***/
if (p_ptr->inside_battle && !p_ptr->leaving)
{
if (p_ptr->special_defense & NINJA_S_STEALTH)
{
- if (cave[py][px].info & CAVE_GLOW) set_superstealth(FALSE);
+ if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
}
}
}
which_power = _("祈り", "prayer");
msg_format(_("反魔法バリアが%sを邪魔した!", "An anti-magic shell disrupts your %s!"), which_power);
- energy_use = 0;
+ p_ptr->energy_use = 0;
}
else if (p_ptr->shero && (p_ptr->pclass != CLASS_BERSERKER))
{
msg_format(_("狂戦士化していて頭が回らない!", "You cannot think directly!"));
- energy_use = 0;
+ p_ptr->energy_use = 0;
}
else
{
break;
}
}
- if (!energy_use && !now_message)
+ if (!p_ptr->energy_use && !now_message)
now_message = old_now_message;
}
* @param r_idx 判定したいモンスター種族のID
* @return 釣れる対象ならばTRUEを返す
*/
-static bool monster_tsuri(int r_idx)
+static bool monster_tsuri(MONRACE_IDX r_idx)
{
monster_race *r_ptr = &r_info[r_idx];
msg_format(_("%s(%c)を落とした。", "You drop %s (%c)."), o_name, index_to_label(INVEN_PACK));
/* Drop it (carefully) near the player */
- (void)drop_near(o_ptr, 0, py, px);
+ (void)drop_near(o_ptr, 0, p_ptr->y, p_ptr->x);
/* Modify, Describe, Optimize */
inven_item_increase(INVEN_PACK, -255);
*/
static void process_player(void)
{
- int i;
+ IDX i;
/*** Apply energy ***/
Term_xtra(TERM_XTRA_DELAY, 10);
if (one_in_(1000))
{
- int r_idx;
+ MONRACE_IDX r_idx;
bool success = FALSE;
get_mon_num_prep(monster_tsuri,NULL);
r_idx = get_mon_num(dun_level ? dun_level : wilderness[p_ptr->wilderness_y][p_ptr->wilderness_x].level);
if (r_idx && one_in_(2))
{
int y, x;
- y = py+ddy[tsuri_dir];
- x = px+ddx[tsuri_dir];
+ y = p_ptr->y+ddy[tsuri_dir];
+ x = p_ptr->x+ddx[tsuri_dir];
if (place_monster_aux(0, y, x, r_idx, PM_NO_KAGE))
{
char m_name[80];
{
(void)set_lightspeed(p_ptr->lightspeed - 1, TRUE);
}
- if ((p_ptr->pclass == CLASS_FORCETRAINER) && (p_ptr->magic_num1[0]))
+ if ((p_ptr->pclass == CLASS_FORCETRAINER) && P_PTR_KI)
{
- if (p_ptr->magic_num1[0] < 40)
+ if (P_PTR_KI < 40)
{
- p_ptr->magic_num1[0] = 0;
+ P_PTR_KI = 0;
}
- else p_ptr->magic_num1[0] -= 40;
+ else P_PTR_KI -= 40;
p_ptr->update |= (PU_BONUS);
}
if (p_ptr->action == ACTION_LEARN)
handle_stuff();
/* Place the cursor on the player */
- move_cursor_relative(py, px);
+ move_cursor_relative(p_ptr->y, p_ptr->x);
/* Refresh (optional) */
if (fresh_before) Term_fresh();
/* Assume free turn */
- energy_use = 0;
+ p_ptr->energy_use = 0;
if (p_ptr->inside_battle)
{
/* Place the cursor on the player */
- move_cursor_relative(py, px);
+ move_cursor_relative(p_ptr->y, p_ptr->x);
command_cmd = SPECIAL_KEY_BUILDING;
else if (p_ptr->paralyzed || (p_ptr->stun >= 100))
{
/* Take a turn */
- energy_use = 100;
+ p_ptr->energy_use = 100;
}
/* Resting */
}
/* Take a turn */
- energy_use = 100;
+ p_ptr->energy_use = 100;
}
/* Fishing */
else if (p_ptr->action == ACTION_FISH)
{
/* Take a turn */
- energy_use = 100;
+ p_ptr->energy_use = 100;
}
/* Running */
else
{
/* Place the cursor on the player */
- move_cursor_relative(py, px);
+ move_cursor_relative(p_ptr->y, p_ptr->x);
can_save = TRUE;
/* Get a command (normal) */
/*** Clean up ***/
/* Significant */
- if (energy_use)
+ if (p_ptr->energy_use)
{
/* Use some energy */
- if (world_player || energy_use > 400)
+ if (world_player || p_ptr->energy_use > 400)
{
/* The Randomness is irrelevant */
- p_ptr->energy_need += energy_use * TURNS_PER_TICK / 10;
+ p_ptr->energy_need += p_ptr->energy_use * TURNS_PER_TICK / 10;
}
else
{
/* There is some randomness of needed energy */
- p_ptr->energy_need += (s16b)((s32b)energy_use * ENERGY_NEED() / 100L);
+ p_ptr->energy_need += (s16b)((s32b)p_ptr->energy_use * ENERGY_NEED() / 100L);
}
/* Hack -- constant hallucination */
}
/* Sniper */
- if (energy_use && reset_concent) reset_concentration(TRUE);
+ if (p_ptr->energy_use && reset_concent) reset_concentration(TRUE);
/* Handle "leaving" */
if (p_ptr->leaving) break;
handle_stuff();
/* Hack -- Hilite the player */
- move_cursor_relative(py, px);
+ move_cursor_relative(p_ptr->y, p_ptr->x);
/* Optional fresh */
if (fresh_after) Term_fresh();
handle_stuff();
/* Hack -- Hilite the player */
- move_cursor_relative(py, px);
+ move_cursor_relative(p_ptr->y, p_ptr->x);
/* Optional fresh */
if (fresh_after) Term_fresh();
handle_stuff();
/* Hack -- Hilite the player */
- move_cursor_relative(py, px);
+ move_cursor_relative(p_ptr->y, p_ptr->x);
/* Optional fresh */
if (fresh_after) Term_fresh();
*/
void play_game(bool new_game)
{
- int i;
+ MONSTER_IDX i;
bool load_game = TRUE;
bool init_random_seed = FALSE;
p_ptr->is_dead = TRUE;
- start_time = time(NULL);
+ start_time = (u32b)time(NULL);
/* No suspending now */
signals_ignore_tstp();
{
p_ptr->wizard = TRUE;
- if (p_ptr->is_dead || !py || !px)
+ if (p_ptr->is_dead || !p_ptr->y || !p_ptr->x)
{
/* Initialize the saved floors data */
init_saved_floors(TRUE);
p_ptr->inside_quest = 0;
/* Avoid crash in update_view() */
- py = px = 10;
+ p_ptr->y = p_ptr->x = 10;
}
}
else if (p_ptr->is_dead)
if (p_ptr->panic_save)
{
/* No player? -- Try to regenerate floor */
- if (!py || !px)
+ if (!p_ptr->y || !p_ptr->x)
{
msg_print(_("プレイヤーの位置がおかしい。フロアを再生成します。", "What a strange player location. Regenerate the dungeon floor."));
change_floor();
}
/* Still no player? -- Try to locate random place */
- if (!py || !px) py = px = 10;
+ if (!p_ptr->y || !p_ptr->x) p_ptr->y = p_ptr->x = 10;
/* No longer in panic */
p_ptr->panic_save = 0;
if (new_game && ((p_ptr->pclass == CLASS_CAVALRY) || (p_ptr->pclass == CLASS_BEASTMASTER)))
{
monster_type *m_ptr;
- int pet_r_idx = ((p_ptr->pclass == CLASS_CAVALRY) ? MON_HORSE : MON_YASE_HORSE);
+ IDX pet_r_idx = ((p_ptr->pclass == CLASS_CAVALRY) ? MON_HORSE : MON_YASE_HORSE);
monster_race *r_ptr = &r_info[pet_r_idx];
- place_monster_aux(0, py, px - 1, pet_r_idx,
+ place_monster_aux(0, p_ptr->y, p_ptr->x - 1, pet_r_idx,
(PM_FORCE_PET | PM_NO_KAGE));
m_ptr = &m_list[hack_m_idx_ii];
m_ptr->mspeed = r_ptr->speed;
if (p_ptr->pclass == CLASS_MAGIC_EATER)
{
- for (i = 0; i < EATER_EXT*2; i++)
+ int magic_idx;
+ for (magic_idx = 0; magic_idx < EATER_EXT*2; magic_idx++)
{
- p_ptr->magic_num1[i] = p_ptr->magic_num2[i]*EATER_CHARGE;
+ p_ptr->magic_num1[magic_idx] = p_ptr->magic_num2[magic_idx]*EATER_CHARGE;
}
- for (; i < EATER_EXT*3; i++)
+ for (; magic_idx < EATER_EXT*3; magic_idx++)
{
- p_ptr->magic_num1[i] = 0;
+ p_ptr->magic_num1[magic_idx] = 0;
}
}
/* Restore spell points */