OSDN Git Service

[Refactor] #38844 inventory を player_type 構造体に inventory_list に改名して取り込み (コメントの修正は後日)
[hengband/hengband.git] / src / view-mainwindow.c
index 44dde0f..f7aabf3 100644 (file)
@@ -11,6 +11,8 @@
  */
 
 #include "angband.h"
+#include "util.h"
+
 #include "files.h"
 #include "world.h"
 #include "quest.h"
 #include "avatar.h"
 #include "player-status.h"
 #include "monster.h"
-#include "realm-hex.h"
 #include "view-mainwindow.h"
 
+#include "spells.h"
+#include "realm-hex.h"
+
 #include "object-flavor.h"
 
 #include "grid.h"
+#include "dungeon.h"
 #include "floor.h"
+#include "feature.h"
 
 static int feat_priority; /*!< マップ縮小表示時に表示すべき地形の優先度を保管する */
 static byte display_autopick; /*!< 自動拾い状態の設定フラグ */
@@ -1525,7 +1531,7 @@ static void prt_frame_extra(void)
 
 
 /*!
- * @brief サブウィンドウに所持品一覧を表示する / Hack -- display inventory in sub-windows
+ * @brief サブウィンドウに所持品一覧を表示する / Hack -- display p_ptr->inventory_list in sub-windows
  * @return なし
  */
 static void fix_inven(void)
@@ -1546,7 +1552,7 @@ static void fix_inven(void)
                /* Activate */
                Term_activate(angband_term[j]);
 
-               /* Display inventory */
+               /* Display p_ptr->inventory_list */
                display_inven();
                Term_fresh();
                Term_activate(old);
@@ -1888,6 +1894,53 @@ static void fix_overhead(void)
        }
 }
 
+static void display_dungeon(void)
+{
+       TERM_LEN x, y;
+       TERM_COLOR a;
+       SYMBOL_CODE c;
+
+       TERM_COLOR ta = 0;
+       SYMBOL_CODE tc = '\0';
+
+       for (x = p_ptr->x - Term->wid / 2 + 1; x <= p_ptr->x + Term->wid / 2; x++)
+       {
+               for (y = p_ptr->y - Term->hgt / 2 + 1; y <= p_ptr->y + Term->hgt / 2; y++)
+               {
+                       if (in_bounds2(y, x))
+                       {
+                               map_info(y, x, &a, &c, &ta, &tc);
+
+                               /* Hack -- fake monochrome */
+                               if (!use_graphics)
+                               {
+                                       if (current_world_ptr->timewalk_m_idx) a = TERM_DARK;
+                                       else if (IS_INVULN() || p_ptr->timewalk) a = TERM_WHITE;
+                                       else if (p_ptr->wraith_form) a = TERM_L_DARK;
+                               }
+
+                               /* Hack -- Queue it */
+                               Term_queue_char(x - p_ptr->x + Term->wid / 2 - 1, y - p_ptr->y + Term->hgt / 2 - 1, a, c, ta, tc);
+                       }
+                       else
+                       {
+                               /* Clear out-of-bound tiles */
+
+                               /* Access darkness */
+                               feature_type *f_ptr = &f_info[feat_none];
+
+                               /* Normal attr */
+                               a = f_ptr->x_attr[F_LIT_STANDARD];
+
+                               /* Normal char */
+                               c = f_ptr->x_char[F_LIT_STANDARD];
+
+                               /* Hack -- Queue it */
+                               Term_queue_char(x - p_ptr->x + Term->wid / 2 - 1, y - p_ptr->y + Term->hgt / 2 - 1, a, c, ta, tc);
+                       }
+               }
+       }
+}
 
 /*!
  * @brief ダンジョンの地形をサブウィンドウに表示する / 
@@ -1995,43 +2048,6 @@ bool is_heavy_shoot(object_type *o_ptr)
        return (hold < o_ptr->weight / 10);
 }
 
-/*!
- * @brief 射撃武器に対応する矢/弾薬のベースアイテムIDを返す /
- * @param o_ptr 判定する射撃武器のアイテム情報参照ポインタ
- * @return 対応する矢/弾薬のベースアイテムID
- */
-int bow_tval_ammo(object_type *o_ptr)
-{
-       /* Analyze the launcher */
-       switch (o_ptr->sval)
-       {
-               case SV_SLING:
-               {
-                       return TV_SHOT;
-               }
-
-               case SV_SHORT_BOW:
-               case SV_LONG_BOW:
-               case SV_NAMAKE_BOW:
-               {
-                       return TV_ARROW;
-               }
-
-               case SV_LIGHT_XBOW:
-               case SV_HEAVY_XBOW:
-               {
-                       return TV_BOLT;
-               }
-               case SV_CRIMSON:
-               case SV_HARP:
-               {
-                       return TV_NO_AMMO;
-               }
-       }
-       
-       return 0;
-}
-
 
 /*! 
  * @brief p_ptr->redraw のフラグに応じた更新をまとめて行う / Handle "p_ptr->redraw"
@@ -2244,7 +2260,7 @@ static void window_stuff(void)
        /* Nothing to do */
        if (!p_ptr->window) return;
 
-       /* Display inventory */
+       /* Display p_ptr->inventory_list */
        if (p_ptr->window & (PW_INVEN))
        {
                p_ptr->window &= ~(PW_INVEN);
@@ -3760,3 +3776,108 @@ void health_track(MONSTER_IDX m_idx)
 }
 
 
+/*
+ * Moves the cursor to a given MAP (y,x) location
+ */
+void move_cursor_relative(int row, int col)
+{
+       /* Real co-ords convert to screen positions */
+       row -= panel_row_prt;
+
+       /* Go there */
+       Term_gotoxy(panel_col_of(col), row);
+}
+
+
+/*
+ * print project path
+ */
+void prt_path(POSITION y, POSITION x)
+{
+       int i;
+       int path_n;
+       u16b path_g[512];
+       byte_hack default_color = TERM_SLATE;
+
+       if (!display_path) return;
+       if (-1 == project_length)
+               return;
+
+       /* Get projection path */
+       path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), p_ptr->y, p_ptr->x, y, x, PROJECT_PATH | PROJECT_THRU);
+
+       p_ptr->redraw |= (PR_MAP);
+       handle_stuff();
+
+       /* Draw path */
+       for (i = 0; i < path_n; i++)
+       {
+               POSITION ny = GRID_Y(path_g[i]);
+               POSITION nx = GRID_X(path_g[i]);
+               grid_type *g_ptr = &current_floor_ptr->grid_array[ny][nx];
+
+               if (panel_contains(ny, nx))
+               {
+                       TERM_COLOR a = default_color;
+                       char c;
+
+                       TERM_COLOR ta = default_color;
+                       char tc = '*';
+
+                       if (g_ptr->m_idx && current_floor_ptr->m_list[g_ptr->m_idx].ml)
+                       {
+                               /* Determine what is there */
+                               map_info(ny, nx, &a, &c, &ta, &tc);
+
+                               if (!is_ascii_graphics(a))
+                                       a = default_color;
+                               else if (c == '.' && (a == TERM_WHITE || a == TERM_L_WHITE))
+                                       a = default_color;
+                               else if (a == default_color)
+                                       a = TERM_WHITE;
+                       }
+
+                       if (!use_graphics)
+                       {
+                               if (current_world_ptr->timewalk_m_idx) a = TERM_DARK;
+                               else if (IS_INVULN() || p_ptr->timewalk) a = TERM_WHITE;
+                               else if (p_ptr->wraith_form) a = TERM_L_DARK;
+                       }
+
+                       c = '*';
+
+                       /* Hack -- Queue it */
+                       Term_queue_bigchar(panel_col_of(nx), ny - panel_row_prt, a, c, ta, tc);
+               }
+
+               /* Known Wall */
+               if ((g_ptr->info & CAVE_MARK) && !cave_have_flag_grid(g_ptr, FF_PROJECT)) break;
+
+               /* Change color */
+               if (nx == x && ny == y) default_color = TERM_L_DARK;
+       }
+}
+
+
+/*
+ * Hack -- track the given monster race
+ */
+void monster_race_track(MONRACE_IDX r_idx)
+{
+       /* Save this monster ID */
+       p_ptr->monster_race_idx = r_idx;
+
+       p_ptr->window |= (PW_MONSTER);
+}
+
+/*
+ * Hack -- track the given object kind
+ */
+void object_kind_track(KIND_OBJECT_IDX k_idx)
+{
+       /* Save this monster ID */
+       p_ptr->object_kind_idx = k_idx;
+
+       p_ptr->window |= (PW_OBJECT);
+}
+