OSDN Git Service

Changed the English description of Wahha-man: interpolated between what was there...
[hengbandforosx/hengbandosx.git] / src / view-mainwindow.c
index 24d0f0f..4a6cdf1 100644 (file)
 #include "artifact.h"
 #include "avatar.h"
 #include "player-status.h"
+#include "monster.h"
 
-/*!
- * @brief 現在の修正後能力値を3~17及び18/xxx形式に変換する / Converts stat num into a six-char (right justified) string
- * @param val 能力値
- * @param out_val 出力先文字列ポインタ
- * @return なし
- */
-void cnv_stat(int val, char *out_val)
-{
-       /* Above 18 */
-       if (val > 18)
-       {
-               int bonus = (val - 18);
+ /*
+  * Some screen locations for various display routines
+  * Currently, row 8 and 15 are the only "blank" rows.
+  * That leaves a "border" around the "stat" values.
+  */
 
-               if (bonus >= 220)
-               {
-                       sprintf(out_val, "18/%3s", "***");
-               }
-               else if (bonus >= 100)
-               {
-                       sprintf(out_val, "18/%03d", bonus);
-               }
-               else
-               {
-                       sprintf(out_val, " 18/%02d", bonus);
-               }
-       }
+#define ROW_RACE                1
+#define COL_RACE                0       /* <race name> */
 
-       /* From 3 to 18 */
-       else
-       {
-               sprintf(out_val, "    %2d", val);
-       }
-}
+  /*#define ROW_CLASS               2 */
+  /*#define COL_CLASS               0 */      /* <class name> */
 
-/*!
- * @brief 能力値現在値から3~17及び18/xxx様式に基づく加減算を行う。
- * Modify a stat value by a "modifier", return new value
- * @param value 現在値
- * @param amount 加減算値
- * @return 加減算後の値
- * @details
- * <pre>
- * Stats go up: 3,4,...,17,18,18/10,18/20,...,18/220
- * Or even: 18/13, 18/23, 18/33, ..., 18/220
- * Stats go down: 18/220, 18/210,..., 18/10, 18, 17, ..., 3
- * Or even: 18/13, 18/03, 18, 17, ..., 3
- * </pre>
- */
-s16b modify_stat_value(int value, int amount)
-{
-       int    i;
+#define ROW_TITLE               2
+#define COL_TITLE               0       /* <title> or <mode> */
 
-       /* Reward */
-       if (amount > 0)
-       {
-               /* Apply each point */
-               for (i = 0; i < amount; i++)
-               {
-                       /* One point at a time */
-                       if (value < 18) value++;
+/*#define ROW_SEIKAKU          4 */
+/*#define COL_SEIKAKU          0*/     /* <seikaku> */
 
-                       /* Ten "points" at a time */
-                       else value += 10;
-               }
-       }
+#define ROW_DAY                 21
+#define COL_DAY                 0       /* day */
 
-       /* Penalty */
-       else if (amount < 0)
-       {
-               /* Apply each point */
-               for (i = 0; i < (0 - amount); i++)
-               {
-                       /* Ten points at a time */
-                       if (value >= 18+10) value -= 10;
+#define ROW_DUNGEON             22
+#define COL_DUNGEON             0       /* dungeon */
 
-                       /* Hack -- prevent weirdness */
-                       else if (value > 18) value = 18;
+#define ROW_LEVEL               3
+#define COL_LEVEL               0       /* "LEVEL xxxxxx" */
 
-                       /* One point at a time */
-                       else if (value > 3) value--;
-               }
-       }
+#define ROW_EXP                 4
+#define COL_EXP                 0       /* "EXP xxxxxxxx" */
 
-       /* Return new value */
-       return (s16b)(value);
-}
+#define ROW_GOLD                5
+#define COL_GOLD                0       /* "AU xxxxxxxxx" */
+
+#define ROW_EQUIPPY             6
+#define COL_EQUIPPY             0       /* equippy chars */
+
+#define ROW_STAT                7
+#define COL_STAT                0       /* "xxx   xxxxxx" */
+
+#define ROW_AC                  13
+#define COL_AC                  0       /* "Cur AC xxxxx" */
+
+#define ROW_HPMP                14
+#define COL_HPMP                0
+
+#define ROW_CURHP               14
+#define COL_CURHP               0       /* "Cur HP xxxxx" */
+
+#define ROW_CURSP               15
+#define COL_CURSP               0       /* "Cur SP xxxxx" */
+
+#define ROW_RIDING_INFO         16
+#define COL_RIDING_INFO         0       /* "xxxxxxxxxxxx" */
+
+#define ROW_INFO                17
+#define COL_INFO                0       /* "xxxxxxxxxxxx" */
+
+#define ROW_CUT                 18
+#define COL_CUT                 0       /* <cut> */
+
+#define ROW_STUN                19
+#define COL_STUN                0       /* <stun> */
+
+#define ROW_HUNGRY              20
+#define COL_HUNGRY              0       /* "Weak" / "Hungry" / "Full" / "Gorged" */
+
+#define ROW_STATE               20
+#define COL_STATE                7      /* <state> */
+
+#define ROW_SPEED               (-1)
+#define COL_SPEED               (-24)      /* "Slow (-NN)" or "Fast (+NN)" */
+
+#define ROW_STUDY               (-1)
+#define COL_STUDY               (-13)      /* "Study" */
+
+#define ROW_DEPTH               (-1)
+#define COL_DEPTH               (-8)      /* "Lev NNN" / "NNNN ft" */
+
+#define ROW_STATBAR             (-1)
+#define COL_STATBAR              0
+#define MAX_COL_STATBAR         (-26)
 
 
 
@@ -742,7 +738,7 @@ static void prt_level(void)
 {
        char tmp[32];
 
-       sprintf(tmp, _("%5d", "%6d"), p_ptr->lev);
+       sprintf(tmp, "%5d", p_ptr->lev);
 
        if (p_ptr->lev >= p_ptr->max_plv)
        {
@@ -1050,60 +1046,23 @@ static void prt_state(void)
                                break;
                        }
                        case ACTION_REST:
-                       {
-                               int i;
-
                                /* Start with "Rest" */
                                strcpy(text, _("    ", "    "));
 
-                               /* Extensive (timed) rest */
-                               if (resting >= 1000)
+                               if (p_ptr->resting > 0)
                                {
-                                       i = resting / 100;
-                                       text[3] = '0';
-                                       text[2] = '0';
-                                       text[1] = '0' + (i % 10);
-                                       text[0] = '0' + (i / 10);
+                                       sprintf(text, "%4d", p_ptr->resting);
                                }
-
-                               /* Long (timed) rest */
-                               else if (resting >= 100)
-                               {
-                                       i = resting;
-                                       text[3] = '0' + (i % 10);
-                                       i = i / 10;
-                                       text[2] = '0' + (i % 10);
-                                       text[1] = '0' + (i / 10);
-                               }
-
-                               /* Medium (timed) rest */
-                               else if (resting >= 10)
-                               {
-                                       i = resting;
-                                       text[3] = '0' + (i % 10);
-                                       text[2] = '0' + (i / 10);
-                               }
-
-                               /* Short (timed) rest */
-                               else if (resting > 0)
-                               {
-                                       i = resting;
-                                       text[3] = '0' + (i);
-                               }
-
-                               /* Rest until healed */
-                               else if (resting == COMMAND_ARG_REST_FULL_HEALING)
+                               else if (p_ptr->resting == COMMAND_ARG_REST_FULL_HEALING)
                                {
                                        text[0] = text[1] = text[2] = text[3] = '*';
                                }
-
-                               /* Rest until done */
-                               else if (resting == COMMAND_ARG_REST_UNTIL_DONE)
+                               else if (p_ptr->resting == COMMAND_ARG_REST_UNTIL_DONE)
                                {
                                        text[0] = text[1] = text[2] = text[3] = '&';
                                }
                                break;
-                       }
+
                        case ACTION_LEARN:
                        {
                                strcpy(text, _("学習", "lear"));
@@ -1191,7 +1150,7 @@ static void prt_speed(void)
        {
                if (p_ptr->riding)
                {
-                       monster_type *m_ptr = &m_list[p_ptr->riding];
+                       monster_type *m_ptr = &current_floor_ptr->m_list[p_ptr->riding];
                        if (MON_FAST(m_ptr) && !MON_SLOW(m_ptr)) attr = TERM_L_BLUE;
                        else if (MON_SLOW(m_ptr) && !MON_FAST(m_ptr)) attr = TERM_VIOLET;
                        else attr = TERM_GREEN;
@@ -1199,12 +1158,7 @@ static void prt_speed(void)
                else if ((is_fast && !p_ptr->slow) || p_ptr->lightspeed) attr = TERM_YELLOW;
                else if (p_ptr->slow && !is_fast) attr = TERM_VIOLET;
                else attr = TERM_L_GREEN;
-#ifdef JP
-               sprintf(buf, "%s(+%d)", (p_ptr->riding ? "乗馬" : "加速"), (i - 110));
-#else
-               sprintf(buf, "Fast(+%d)", (i - 110));
-#endif
-
+               sprintf(buf, "%s(+%d)", (p_ptr->riding ? _("乗馬", "Ride") : _("加速", "Fast")), (i - 110));
        }
 
        /* Slow */
@@ -1212,7 +1166,7 @@ static void prt_speed(void)
        {
                if (p_ptr->riding)
                {
-                       monster_type *m_ptr = &m_list[p_ptr->riding];
+                       monster_type *m_ptr = &current_floor_ptr->m_list[p_ptr->riding];
                        if (MON_FAST(m_ptr) && !MON_SLOW(m_ptr)) attr = TERM_L_BLUE;
                        else if (MON_SLOW(m_ptr) && !MON_FAST(m_ptr)) attr = TERM_VIOLET;
                        else attr = TERM_RED;
@@ -1220,11 +1174,7 @@ static void prt_speed(void)
                else if (is_fast && !p_ptr->slow) attr = TERM_YELLOW;
                else if (p_ptr->slow && !is_fast) attr = TERM_VIOLET;
                else attr = TERM_L_UMBER;
-#ifdef JP
-               sprintf(buf, "%s(-%d)", (p_ptr->riding ? "乗馬" : "減速"), (110 - i));
-#else
-               sprintf(buf, "Slow(-%d)", (110 - i));
-#endif
+               sprintf(buf, "%s(-%d)", (p_ptr->riding ? _("乗馬", "Ride") : _("減速", "Slow")), (110 - i));
        }
        else if (p_ptr->riding)
        {
@@ -1398,7 +1348,7 @@ static void health_redraw(bool riding)
                col = COL_INFO;
        }
 
-       m_ptr = &m_list[health_who];
+       m_ptr = &current_floor_ptr->m_list[health_who];
 
        if (p_ptr->wizard && p_ptr->inside_battle)
        {
@@ -1410,32 +1360,32 @@ static void health_redraw(bool riding)
                Term_putstr(col - 2, row + 2, 12, TERM_WHITE, "      /     ");
                Term_putstr(col - 2, row + 3, 12, TERM_WHITE, "      /     ");
 
-               if(m_list[1].r_idx)
+               if(current_floor_ptr->m_list[1].r_idx)
                {
-                       Term_putstr(col - 2, row, 2, r_info[m_list[1].r_idx].x_attr, format("%c", r_info[m_list[1].r_idx].x_char));
-                       Term_putstr(col - 1, row, 5, TERM_WHITE, format("%5d", m_list[1].hp));
-                       Term_putstr(col + 5, row, 6, TERM_WHITE, format("%5d", m_list[1].max_maxhp));
+                       Term_putstr(col - 2, row, 2, r_info[current_floor_ptr->m_list[1].r_idx].x_attr, format("%c", r_info[current_floor_ptr->m_list[1].r_idx].x_char));
+                       Term_putstr(col - 1, row, 5, TERM_WHITE, format("%5d", current_floor_ptr->m_list[1].hp));
+                       Term_putstr(col + 5, row, 6, TERM_WHITE, format("%5d", current_floor_ptr->m_list[1].max_maxhp));
                }
 
-               if(m_list[2].r_idx)
+               if(current_floor_ptr->m_list[2].r_idx)
                {
-                       Term_putstr(col - 2, row + 1, 2, r_info[m_list[2].r_idx].x_attr, format("%c", r_info[m_list[2].r_idx].x_char));
-                       Term_putstr(col - 1, row + 1, 5, TERM_WHITE, format("%5d", m_list[2].hp));
-                       Term_putstr(col + 5, row + 1, 6, TERM_WHITE, format("%5d", m_list[2].max_maxhp));
+                       Term_putstr(col - 2, row + 1, 2, r_info[current_floor_ptr->m_list[2].r_idx].x_attr, format("%c", r_info[current_floor_ptr->m_list[2].r_idx].x_char));
+                       Term_putstr(col - 1, row + 1, 5, TERM_WHITE, format("%5d", current_floor_ptr->m_list[2].hp));
+                       Term_putstr(col + 5, row + 1, 6, TERM_WHITE, format("%5d", current_floor_ptr->m_list[2].max_maxhp));
                }
 
-               if(m_list[3].r_idx)
+               if(current_floor_ptr->m_list[3].r_idx)
                {
-                       Term_putstr(col - 2, row + 2, 2, r_info[m_list[3].r_idx].x_attr, format("%c", r_info[m_list[3].r_idx].x_char));
-                       Term_putstr(col - 1, row + 2, 5, TERM_WHITE, format("%5d", m_list[3].hp));
-                       Term_putstr(col + 5, row + 2, 6, TERM_WHITE, format("%5d", m_list[3].max_maxhp));
+                       Term_putstr(col - 2, row + 2, 2, r_info[current_floor_ptr->m_list[3].r_idx].x_attr, format("%c", r_info[current_floor_ptr->m_list[3].r_idx].x_char));
+                       Term_putstr(col - 1, row + 2, 5, TERM_WHITE, format("%5d", current_floor_ptr->m_list[3].hp));
+                       Term_putstr(col + 5, row + 2, 6, TERM_WHITE, format("%5d", current_floor_ptr->m_list[3].max_maxhp));
                }
 
-               if(m_list[4].r_idx)
+               if(current_floor_ptr->m_list[4].r_idx)
                {
-                       Term_putstr(col - 2, row + 3, 2, r_info[m_list[4].r_idx].x_attr, format("%c", r_info[m_list[4].r_idx].x_char));
-                       Term_putstr(col - 1, row + 3, 5, TERM_WHITE, format("%5d", m_list[4].hp));
-                       Term_putstr(col + 5, row + 3, 6, TERM_WHITE, format("%5d", m_list[4].max_maxhp));
+                       Term_putstr(col - 2, row + 3, 2, r_info[current_floor_ptr->m_list[4].r_idx].x_attr, format("%c", r_info[current_floor_ptr->m_list[4].r_idx].x_char));
+                       Term_putstr(col - 1, row + 3, 5, TERM_WHITE, format("%5d", current_floor_ptr->m_list[4].hp));
+                       Term_putstr(col + 5, row + 3, 6, TERM_WHITE, format("%5d", current_floor_ptr->m_list[4].max_maxhp));
                }
        }
        else
@@ -1521,8 +1471,6 @@ static void health_redraw(bool riding)
 static void prt_frame_basic(void)
 {
        int i;
-
-       /* Race and Class */
        if (p_ptr->mimic_form)
                prt_field(mimic_info[p_ptr->mimic_form].title, ROW_RACE, COL_RACE);
        else
@@ -1531,36 +1479,16 @@ static void prt_frame_basic(void)
                my_strcpy(str, rp_ptr->title, sizeof(str));
                prt_field(str, ROW_RACE, COL_RACE);
        }
-/*     prt_field(cp_ptr->title, ROW_CLASS, COL_CLASS); */
-/*     prt_field(ap_ptr->title, ROW_SEIKAKU, COL_SEIKAKU); */
-
 
-       /* Title */
        prt_title();
-
-       /* Level/Experience */
        prt_level();
        prt_exp();
-
-       /* All Stats */
        for (i = 0; i < A_MAX; i++) prt_stat(i);
-
-       /* Armor */
        prt_ac();
-
-       /* Hitpoints */
        prt_hp();
-
-       /* Spellpoints */
        prt_sp();
-
-       /* Gold */
        prt_gold();
-
-       /* Current depth */
        prt_depth();
-
-       /* Special */
        health_redraw(FALSE);
        health_redraw(TRUE);
 }
@@ -1572,24 +1500,13 @@ static void prt_frame_basic(void)
  */
 static void prt_frame_extra(void)
 {
-       /* Cut/Stun */
        prt_cut();
        prt_stun();
-
-       /* Food */
        prt_hunger();
-
-       /* State */
        prt_state();
-
-       /* Speed */
        prt_speed();
-
-       /* Study spells */
        prt_study();
-
        prt_imitation();
-
        prt_status();
 }
 
@@ -1652,7 +1569,7 @@ static void print_monster_line(TERM_LEN x, TERM_LEN y, monster_type* m_ptr, int
        if(r_ptr->flags1&RF1_UNIQUE){//unique
                bool is_kubi = FALSE;
                for(i=0;i<MAX_KUBI;i++){
-                       if(kubi_r_idx[i] == r_idx){
+                       if(current_world_ptr->bounty_r_idx[i] == r_idx){
                                is_kubi = TRUE;
                                break;
                        }
@@ -1694,10 +1611,10 @@ void print_monster_list(TERM_LEN x, TERM_LEN y, TERM_LEN max_lines){
        int n_same = 0;
        int i;
 
-       for(i=0;i<temp_n;i++){
-               grid_type* g_ptr = &current_floor_ptr->grid_array[temp_y[i]][temp_x[i]];
-               if(!g_ptr->m_idx || !m_list[g_ptr->m_idx].ml)continue;//no mons or cannot look
-               m_ptr = &m_list[g_ptr->m_idx];
+       for(i=0;i<tmp_pos.n;i++){
+               grid_type* g_ptr = &current_floor_ptr->grid_array[tmp_pos.y[i]][tmp_pos.x[i]];
+               if(!g_ptr->m_idx || !current_floor_ptr->m_list[g_ptr->m_idx].ml)continue;//no mons or cannot look
+               m_ptr = &current_floor_ptr->m_list[g_ptr->m_idx];
                if(is_pet(m_ptr))continue;//pet
                if(!m_ptr->r_idx)continue;//dead?
                {
@@ -1737,7 +1654,7 @@ void print_monster_list(TERM_LEN x, TERM_LEN y, TERM_LEN max_lines){
                        break;
                }
        }
-       if(line-y-1==max_lines && i!=temp_n){
+       if(line-y-1==max_lines && i!=tmp_pos.n){
                Term_gotoxy(x, line);
                Term_addstr(-1, TERM_WHITE, "-- and more --");
        }else{
@@ -2413,7 +2330,7 @@ void update_playtime(void)
        if (start_time != 0)
        {
                u32b tmp = (u32b)time(NULL);
-               playtime += (tmp - start_time);
+               current_world_ptr->play_time += (tmp - start_time);
                start_time = tmp;
        }
 }
@@ -2511,7 +2428,6 @@ bool change_panel(POSITION dy, POSITION dx)
                panel_row_min = y;
                panel_col_min = x;
 
-               /* Recalculate the boundaries */
                panel_bounds_center();
 
                p_ptr->update |= (PU_MONSTERS);
@@ -2526,3 +2442,26 @@ bool change_panel(POSITION dy, POSITION dx)
        return (FALSE);
 }
 
+/*!
+ * @brief プレイヤーの装備一覧シンボルを固定位置に表示する
+ * @return なし
+ */
+void print_equippy(void)
+{
+       display_player_equippy(ROW_EQUIPPY, COL_EQUIPPY, 0);
+}
+
+/*!
+ * @brief 現在のコンソール表示の縦横を返す。 /
+ * Get term size and calculate screen size
+ * @param wid_p コンソールの表示幅文字数を返す
+ * @param hgt_p コンソールの表示行数を返す
+ * @return なし
+ */
+void get_screen_size(TERM_LEN *wid_p, TERM_LEN *hgt_p)
+{
+       Term_get_size(wid_p, hgt_p);
+       *hgt_p -= ROW_MAP + 2;
+       *wid_p -= COL_MAP + 2;
+       if (use_bigtile) *wid_p /= 2;
+}