}
}
+
/*!
* @brief パターン終点到達時のテレポート処理を行う
+ * @param creature_ptr プレーヤーへの参照ポインタ
* @return なし
*/
static void pattern_teleport(player_type *creature_ptr)
/* Accept request */
msg_format(_("%d 階にテレポートしました。", "You teleport to dungeon level %d."), command_arg);
- if (autosave_l) do_cmd_save_game(TRUE);
+ if (autosave_l) do_cmd_save_game(creature_ptr, TRUE);
/* Change level */
creature_ptr->current_floor_ptr->dun_level = command_arg;
- leave_quest_check();
+ leave_quest_check(creature_ptr);
if (record_stair) exe_write_diary(creature_ptr, NIKKI_PAT_TELE, 0, NULL);
* Clear all saved floors
* and create a first saved floor
*/
- prepare_change_floor_mode(CFM_FIRST_FLOOR);
+ prepare_change_floor_mode(creature_ptr, CFM_FIRST_FLOOR);
creature_ptr->leaving = TRUE;
}
wreck_the_pattern(creature_ptr);
}
- pattern_type = f_info[p_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat].subtype;
+ floor_type *floor_ptr = creature_ptr->current_floor_ptr;
+ pattern_type = f_info[floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat].subtype;
switch (pattern_type)
{
(void)restore_level(creature_ptr);
(void)cure_critical_wounds(creature_ptr, 1000);
- cave_set_feat(creature_ptr->current_floor_ptr, creature_ptr->y, creature_ptr->x, feat_pattern_old);
+ cave_set_feat(floor_ptr, creature_ptr->y, creature_ptr->x, feat_pattern_old);
msg_print(_("「パターン」のこの部分は他の部分より強力でないようだ。", "This section of the Pattern looks less powerful."));
/*
spell = SINGING_SONG_ID(caster_ptr);
s_ptr = &technic_info[REALM_MUSIC - MIN_TECHNIC][spell];
- need_mana = mod_need_mana(s_ptr->smana, spell, REALM_MUSIC);
+ need_mana = mod_need_mana(caster_ptr, s_ptr->smana, spell, REALM_MUSIC);
need_mana_frac = 0;
/* Divide by 2 */
return (&p_ptr->inventory_list[choices[randint0(number)]]);
}
+
static void process_world_aux_digestion(player_type *creature_ptr)
{
if (!creature_ptr->phase_out)
flush();
msg_print(NULL);
- (void)get_hack_dir(&dire);
+ (void)get_hack_dir(creature_ptr, &dire);
fire_ball(creature_ptr, GF_MANA, dire, creature_ptr->lev * 2, 3);
}
disturb(creature_ptr, FALSE, TRUE);
msg_print(_("突然ほとんど孤独になった気がする。", "You suddenly feel almost lonely."));
- banish_monsters(100);
+ banish_monsters(creature_ptr, 100);
if (!creature_ptr->current_floor_ptr->dun_level && creature_ptr->town_num)
{
int n;
* Unlite the area (radius 10) around player and
* do 50 points damage to every affected monster
*/
- unlite_area(50, 10);
+ unlite_area(creature_ptr, 50, 10);
}
if ((creature_ptr->muta2 & MUT2_ATT_ANIMAL) && !creature_ptr->anti_magic && one_in_(7000))
if (slot && !object_is_cursed(o_ptr))
{
msg_print(_("武器を落としてしまった!", "You drop your weapon!"));
- inven_drop(slot, 1);
+ drop_from_inventory(creature_ptr, slot, 1);
}
}
}
/* Process objects on floor */
- for (i = 1; i < p_ptr->current_floor_ptr->o_max; i++)
+ for (i = 1; i < creature_ptr->current_floor_ptr->o_max; i++)
{
- object_type *o_ptr = &p_ptr->current_floor_ptr->o_list[i];
+ object_type *o_ptr = &creature_ptr->current_floor_ptr->o_list[i];
if (!OBJECT_IS_VALID(o_ptr)) continue;
* he loads the autosaved game.
*/
if (autosave_l && (creature_ptr->word_recall == 1) && !creature_ptr->phase_out)
- do_cmd_save_game(TRUE);
+ do_cmd_save_game(creature_ptr, TRUE);
/* Count down towards recall */
creature_ptr->word_recall--;
floor_ptr->dun_level = 0;
creature_ptr->dungeon_idx = 0;
- leave_quest_check();
+ leave_quest_check(creature_ptr);
leave_tower_check();
creature_ptr->current_floor_ptr->inside_quest = 0;
* Clear all saved floors
* and create a first saved floor
*/
- prepare_change_floor_mode(CFM_FIRST_FLOOR);
+ prepare_change_floor_mode(creature_ptr, CFM_FIRST_FLOOR);
creature_ptr->leaving = TRUE;
if (creature_ptr->dungeon_idx == DUNGEON_ANGBAND)
if (creature_ptr->alter_reality)
{
if (autosave_l && (creature_ptr->alter_reality == 1) && !creature_ptr->phase_out)
- do_cmd_save_game(TRUE);
+ do_cmd_save_game(creature_ptr, TRUE);
/* Count down towards alter */
creature_ptr->alter_reality--;
* Clear all saved floors
* and create a first saved floor
*/
- prepare_change_floor_mode(CFM_FIRST_FLOOR);
+ prepare_change_floor_mode(creature_ptr, CFM_FIRST_FLOOR);
creature_ptr->leaving = TRUE;
}
else
{
player_ptr->current_floor_ptr->dun_level = 0;
player_ptr->dungeon_idx = 0;
- prepare_change_floor_mode(CFM_FIRST_FLOOR | CFM_RAND_PLACE);
+ prepare_change_floor_mode(player_ptr, CFM_FIRST_FLOOR | CFM_RAND_PLACE);
player_ptr->current_floor_ptr->inside_arena = FALSE;
player_ptr->wild_mode = FALSE;
player_ptr->leaving = TRUE;
if (autosave_t && autosave_freq && !player_ptr->phase_out)
{
if (!(current_world_ptr->game_turn % ((s32b)autosave_freq * TURNS_PER_TICK)))
- do_cmd_save_game(TRUE);
+ do_cmd_save_game(player_ptr, TRUE);
}
if (player_ptr->current_floor_ptr->monster_noise && !ignore_unview)
creature_ptr->reset_concent = TRUE;
/* Parse the command */
+ floor_type *floor_ptr = creature_ptr->current_floor_ptr;
switch (command_cmd)
{
/* Ignore */
/* Enter store */
case SPECIAL_KEY_STORE:
{
- do_cmd_store();
+ do_cmd_store(creature_ptr);
break;
}
/* Enter quest level -KMW- */
case SPECIAL_KEY_QUEST:
{
- do_cmd_quest();
+ do_cmd_quest(creature_ptr);
break;
}
/* Go up staircase */
case '<':
{
- if (!creature_ptr->wild_mode && !p_ptr->current_floor_ptr->dun_level && !creature_ptr->current_floor_ptr->inside_arena && !creature_ptr->current_floor_ptr->inside_quest)
+ if (!creature_ptr->wild_mode && !floor_ptr->dun_level && !floor_ptr->inside_arena && !floor_ptr->inside_quest)
{
if (vanilla_town) break;
{
msg_print(_("呪文を唱えられない!", "You cannot cast spells!"));
}
- else if (p_ptr->current_floor_ptr->dun_level && (d_info[creature_ptr->dungeon_idx].flags1 & DF1_NO_MAGIC) && (creature_ptr->pclass != CLASS_BERSERKER) && (creature_ptr->pclass != CLASS_SMITH))
+ else if (floor_ptr->dun_level && (d_info[creature_ptr->dungeon_idx].flags1 & DF1_NO_MAGIC) && (creature_ptr->pclass != CLASS_BERSERKER) && (creature_ptr->pclass != CLASS_SMITH))
{
msg_print(_("ダンジョンが魔法を吸収した!", "The dungeon absorbs all attempted magic!"));
msg_print(NULL);
else if (creature_ptr->pclass == CLASS_SAMURAI)
do_cmd_hissatsu(creature_ptr);
else if (creature_ptr->pclass == CLASS_BLUE_MAGE)
- do_cmd_cast_learned();
+ do_cmd_cast_learned(creature_ptr);
else if (creature_ptr->pclass == CLASS_SMITH)
do_cmd_kaji(creature_ptr, FALSE);
else if (creature_ptr->pclass == CLASS_SNIPER)
/* Identify symbol */
case '/':
{
- do_cmd_query_symbol();
+ do_cmd_query_symbol(creature_ptr);
break;
}
case '_':
{
- do_cmd_edit_autopick();
+ do_cmd_edit_autopick(creature_ptr);
break;
}
/* Show quest status -KMW- */
case KTRL('Q'):
{
- do_cmd_checkquest();
+ do_cmd_checkquest(creature_ptr);
break;
}
/* Hack -- Save and don't quit */
case KTRL('S'):
{
- do_cmd_save_game(FALSE);
+ do_cmd_save_game(creature_ptr, FALSE);
break;
}
case KTRL('T'):
{
- do_cmd_time();
+ do_cmd_time(creature_ptr);
break;
}
case '|':
{
- do_cmd_nikki();
+ do_cmd_diary(creature_ptr);
break;
}
/* Save "screen dump" */
case ')':
{
- do_cmd_save_screen();
+ do_cmd_save_screen(creature_ptr);
break;
}
*/
static void pack_overflow(player_type *owner_ptr)
{
- if (owner_ptr->inventory_list[INVEN_PACK].k_idx)
- {
- GAME_TEXT o_name[MAX_NLEN];
- object_type *o_ptr;
+ if (owner_ptr->inventory_list[INVEN_PACK].k_idx == 0) return;
- /* Is auto-destroy done? */
- update_creature(owner_ptr);
- if (!owner_ptr->inventory_list[INVEN_PACK].k_idx) return;
+ GAME_TEXT o_name[MAX_NLEN];
+ object_type *o_ptr;
- /* Access the slot to be dropped */
- o_ptr = &owner_ptr->inventory_list[INVEN_PACK];
+ /* Is auto-destroy done? */
+ update_creature(owner_ptr);
+ if (!owner_ptr->inventory_list[INVEN_PACK].k_idx) return;
- disturb(owner_ptr, FALSE, TRUE);
+ /* Access the slot to be dropped */
+ o_ptr = &owner_ptr->inventory_list[INVEN_PACK];
- /* Warning */
- msg_print(_("ザックからアイテムがあふれた!", "Your pack overflows!"));
- object_desc(o_name, o_ptr, 0);
+ disturb(owner_ptr, FALSE, TRUE);
- msg_format(_("%s(%c)を落とした。", "You drop %s (%c)."), o_name, index_to_label(INVEN_PACK));
+ /* Warning */
+ msg_print(_("ザックからアイテムがあふれた!", "Your pack overflows!"));
+ object_desc(o_name, o_ptr, 0);
- /* Drop it (carefully) near the player */
- (void)drop_near(o_ptr, 0, owner_ptr->y, owner_ptr->x);
+ msg_format(_("%s(%c)を落とした。", "You drop %s (%c)."), o_name, index_to_label(INVEN_PACK));
- vary_item(INVEN_PACK, -255);
- handle_stuff();
- }
+ /* Drop it (carefully) near the player */
+ (void)drop_near(owner_ptr, o_ptr, 0, owner_ptr->y, owner_ptr->x);
+
+ vary_item(owner_ptr, INVEN_PACK, -255);
+ handle_stuff(owner_ptr);
}
/*!
}
}
- handle_stuff();
+ handle_stuff(creature_ptr);
}
load = FALSE;
creature_ptr->counter = FALSE;
creature_ptr->now_damaged = FALSE;
- handle_stuff();
+ handle_stuff(creature_ptr);
/* Place the cursor on the player */
move_cursor_relative(creature_ptr->y, creature_ptr->x);
command_rep--;
creature_ptr->redraw |= (PR_STATE);
- handle_stuff();
+ handle_stuff(creature_ptr);
/* Hack -- Assume messages were seen */
msg_flag = FALSE;
creature_ptr->timewalk = FALSE;
creature_ptr->energy_need = ENERGY_NEED();
- handle_stuff();
+ handle_stuff(creature_ptr);
}
}
player_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_EQUIPPY | PR_MAP);
player_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS | PU_VIEW | PU_LITE | PU_MON_LITE | PU_TORCH | PU_MONSTERS | PU_DISTANCE | PU_FLOW);
- handle_stuff();
+ handle_stuff(player_ptr);
/* Leave "xtra" mode */
current_world_ptr->character_xtra = FALSE;
player_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
player_ptr->update |= (PU_COMBINE | PU_REORDER);
- handle_stuff();
+ handle_stuff(player_ptr);
Term_fresh();
if (quest_num && (is_fixed_quest_idx(quest_num) &&
process_player(player_ptr);
process_upkeep_with_speed(player_ptr);
- handle_stuff();
+ handle_stuff(player_ptr);
/* Hack -- Hilite the player */
move_cursor_relative(player_ptr->y, player_ptr->x);
if (!player_ptr->playing || player_ptr->is_dead) break;
/* Process all of the monsters */
- process_monsters();
+ process_monsters(player_ptr);
- handle_stuff();
+ handle_stuff(player_ptr);
/* Hack -- Hilite the player */
move_cursor_relative(player_ptr->y, player_ptr->x);
/* Process the world */
process_world(player_ptr);
- handle_stuff();
+ handle_stuff(player_ptr);
/* Hack -- Hilite the player */
move_cursor_relative(player_ptr->y, player_ptr->x);
autopick_load_pref(FALSE);
}
+
/*!
* @brief 1ゲームプレイの主要ルーチン / Actually play a game
* @return なし
highscore_fd = fd_open(buf, O_RDWR);
/* 町名消失バグ対策(#38205)のためここで世界マップ情報を読み出す */
- process_dungeon_file("w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
+ process_dungeon_file(player_ptr, "w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
/* Handle score, show Top scores */
- success = send_world_score(TRUE);
+ success = send_world_score(player_ptr, TRUE);
if (!success && !get_check_strict(_("スコア登録を諦めますか?", "Do you give up score registration? "), CHECK_NO_HISTORY))
{
{
player_ptr->wait_report_score = FALSE;
top_twenty(player_ptr);
- if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
+ if (!save_player(player_ptr)) msg_print(_("セーブ失敗!", "death save failed!"));
}
/* Shut the high score file */
(void)fd_close(highscore_fd);
init_random_seed = TRUE;
/* Initialize the saved floors data */
- init_saved_floors(FALSE);
+ init_saved_floors(player_ptr, FALSE);
}
/* Old game is loaded. But new game is requested. */
else if (new_game)
{
/* Initialize the saved floors data */
- init_saved_floors(TRUE);
+ init_saved_floors(player_ptr, TRUE);
}
/* Process old character */
if (player_ptr->is_dead || !player_ptr->y || !player_ptr->x)
{
/* Initialize the saved floors data */
- init_saved_floors(TRUE);
+ init_saved_floors(player_ptr, TRUE);
/* Avoid crash */
player_ptr->current_floor_ptr->inside_quest = 0;
/* Initialize the town-buildings if necessary */
if (!player_ptr->current_floor_ptr->dun_level && !player_ptr->current_floor_ptr->inside_quest)
{
- process_dungeon_file("w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
+ process_dungeon_file(player_ptr, "w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
init_flags = INIT_ONLY_BUILDINGS;
- process_dungeon_file("t_info.txt", 0, 0, MAX_HGT, MAX_WID);
+ process_dungeon_file(player_ptr, "t_info.txt", 0, 0, MAX_HGT, MAX_WID);
select_floor_music(player_ptr);
}
player_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
player_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
- handle_stuff();
+ handle_stuff(player_ptr);
/* Set or clear "rogue_like_commands" if requested */
if (arg_force_original) rogue_like_commands = FALSE;
/* Hack -- prevent "icky" message */
current_world_ptr->character_xtra = TRUE;
- handle_stuff();
+ handle_stuff(player_ptr);
current_world_ptr->character_xtra = FALSE;
reset_tim_flags(player_ptr);
/* Leave through the exit */
- prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_RAND_CONNECT);
+ prepare_change_floor_mode(player_ptr, CFM_SAVE_FLOORS | CFM_RAND_CONNECT);
/* prepare next floor */
leave_floor(player_ptr);
}
/* Close stuff */
- close_game();
+ close_game(player_ptr);
/* Quit */
quit(NULL);
}
}
+
/*!
* @brief ターンのオーバーフローに対する対処
* @details ターン及びターンを記録する変数をターンの限界の1日前まで巻き戻す.
}
}
+
/*!
* @brief ゲーム終了処理 /
* Close up the current game (player may or may not be dead)
+ * @param creature_ptr プレーヤーへの参照ポインタ
* @return なし
* @details
* <pre>
* This function is called only from "main.c" and "signals.c".
* </pre>
*/
-void close_game(void)
+void close_game(player_type *player_ptr)
{
char buf[1024];
bool do_send = TRUE;
/* concptr p = "[i:キャラクタの情報, f:ファイル書き出し, t:スコア, x:*鑑定*, ESC:ゲーム終了]"; */
- handle_stuff();
+ handle_stuff(player_ptr);
/* Flush the messages */
msg_print(NULL);
safe_setuid_drop();
/* Handle death */
- if (p_ptr->is_dead)
+ if (player_ptr->is_dead)
{
/* Handle retirement */
- if (current_world_ptr->total_winner) kingly(p_ptr);
+ if (current_world_ptr->total_winner) kingly(player_ptr);
/* Save memories */
if (!cheat_save || get_check(_("死んだデータをセーブしますか? ", "Save death? ")))
{
- if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
+ if (!save_player(player_ptr)) msg_print(_("セーブ失敗!", "death save failed!"));
}
else do_send = FALSE;
/* You are dead */
- print_tomb();
+ print_tomb(player_ptr);
flush();
/* Show more info */
- show_info();
+ show_info(player_ptr);
Term_clear();
if (check_score())
{
- if ((!send_world_score(do_send)))
+ if ((!send_world_score(player_ptr, do_send)))
{
if (get_check_strict(_("後でスコアを登録するために待機しますか?", "Stand by for later score registration? "),
(CHECK_NO_ESCAPE | CHECK_NO_HISTORY)))
{
- p_ptr->wait_report_score = TRUE;
- p_ptr->is_dead = FALSE;
- if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
+ player_ptr->wait_report_score = TRUE;
+ player_ptr->is_dead = FALSE;
+ if (!save_player(player_ptr)) msg_print(_("セーブ失敗!", "death save failed!"));
}
}
- if (!p_ptr->wait_report_score)
- (void)top_twenty(p_ptr);
+ if (!player_ptr->wait_report_score)
+ (void)top_twenty(player_ptr);
}
else if (highscore_fd >= 0)
{
else
{
/* Save the game */
- do_cmd_save_game(FALSE);
+ do_cmd_save_game(player_ptr, FALSE);
/* Prompt for scores */
prt(_("リターンキーか ESC キーを押して下さい。", "Press Return (or Escape)."), 0, 40);
play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_EXIT);
/* Predict score (or ESCAPE) */
- if (inkey() != ESCAPE) predict_score(p_ptr);
+ if (inkey() != ESCAPE) predict_score(player_ptr);
}
/* Forget the high score fd */
highscore_fd = -1;
- /* Kill all temporal files */
- clear_saved_floor_files();
+ /* Kill all temporary files */
+ clear_saved_floor_files(player_ptr);
/* Allow suspending now */
signals_handle_tstp();
* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window"
* @return なし
*/
-void handle_stuff(void)
+void handle_stuff(player_type *player_ptr)
{
- if (p_ptr->update) update_creature(p_ptr);
- if (p_ptr->redraw) redraw_stuff(p_ptr);
- if (p_ptr->window) window_stuff();
+ if (player_ptr->update) update_creature(player_ptr);
+ if (player_ptr->redraw) redraw_stuff(player_ptr);
+ if (player_ptr->window) window_stuff(player_ptr);
}
-void update_output(void)
+
+void update_output(player_type *player_ptr)
{
- if (p_ptr->redraw) redraw_stuff(p_ptr);
- if (p_ptr->window) window_stuff();
+ if (player_ptr->redraw) redraw_stuff(player_ptr);
+ if (player_ptr->window) window_stuff(player_ptr);
}
-