1 #include "cmd-io/cmd-floor.h"
2 #include "core/asking-player.h"
3 #include "core/stuff-handler.h"
4 #include "core/window-redrawer.h"
5 #include "floor/geometry.h"
6 #include "game-option/keymap-directory-getter.h"
8 #include "io/screen-util.h"
9 #include "main/sound-of-music.h"
10 #include "system/player-type-definition.h"
11 #include "system/redrawing-flags-updater.h"
12 #include "target/target-checker.h"
13 #include "target/target-setter.h"
14 #include "target/target-types.h"
15 #include "term/z-form.h"
16 #include "util/bit-flags-calculator.h"
17 #include "view/display-messages.h"
18 #include "window/main-window-util.h"
21 * @brief ターゲットを設定するコマンドのメインルーチン
24 void do_cmd_target(PlayerType *player_ptr)
26 if (player_ptr->wild_mode) {
30 if (target_set(player_ptr, TARGET_KILL)) {
31 msg_print(_("ターゲット決定。", "Target Selected."));
33 msg_print(_("ターゲット解除。", "Target Aborted."));
38 * @brief 周囲を見渡すコマンドのメインルーチン
41 void do_cmd_look(PlayerType *player_ptr)
43 static constexpr auto flags = {
44 SubWindowRedrawingFlag::SIGHT_MONSTERS,
45 SubWindowRedrawingFlag::FLOOR_ITEMS,
47 RedrawingFlagsUpdater::get_instance().set_flags(flags);
48 handle_stuff(player_ptr);
49 if (target_set(player_ptr, TARGET_LOOK)) {
50 msg_print(_("ターゲット決定。", "Target Selected."));
55 * @brief 位置を確認するコマンドのメインルーチン
56 * Allow the player to examine other sectors on the map
58 void do_cmd_locate(PlayerType *player_ptr)
60 const char *dirstrings[3][3] = {
61 { _("北西", " northwest of"), _("北", " north of"), _("北東", " northeast of") },
62 { _("西", " west of"), _("真上", ""), _("東", " east of") },
63 { _("南西", " southwest of"), _("南", " south of"), _("南東", " southeast of") },
68 get_screen_size(&wid, &hgt);
69 POSITION y2 = y1 = panel_row_min;
70 POSITION x2 = x1 = panel_col_min;
71 constexpr auto fmt = _("マップ位置 [%d(%02d),%d(%02d)] (プレイヤーの%s) 方向?", "Map sector [%d(%02d),%d(%02d)], which is%s your sector. Direction?");
73 std::string_view dirstring = dirstrings[(y2 < y1) ? 0 : ((y2 > y1) ? 2 : 1)][(x2 < x1) ? 0 : ((x2 > x1) ? 2 : 1)];
74 std::string out_val = format(fmt, y2 / (hgt / 2), y2 % (hgt / 2), x2 / (wid / 2), x2 % (wid / 2), dirstring.data());
79 if (!get_com(out_val, &command, true)) {
83 dir = get_keymap_dir(command);
93 if (change_panel(player_ptr, ddy[dir], ddx[dir])) {
99 verify_panel(player_ptr);
100 auto &rfu = RedrawingFlagsUpdater::get_instance();
101 rfu.set_flag(StatusRecalculatingFlag::MONSTER_STATUSES);
102 rfu.set_flag(MainWindowRedrawingFlag::MAP);
103 static constexpr auto flags = {
104 SubWindowRedrawingFlag::OVERHEAD,
105 SubWindowRedrawingFlag::DUNGEON,
107 rfu.set_flags(flags);
108 handle_stuff(player_ptr);