#include "quest.h"
#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)
return _("アリーナ", "Arena");
else if (p_ptr->inside_battle)
return _("闘技場", "Monster Arena");
- else if (!dun_level && p_ptr->town_num)
- return town[p_ptr->town_num].name;
+ else if (!current_floor_ptr->dun_level && p_ptr->town_num)
+ return town_info[p_ptr->town_num].name;
else
- return d_name+d_info[dungeon_type].name;
+ return d_name+d_info[p_ptr->dungeon_idx].name;
}
/*!
*/
static void prt_stat(int stat)
{
- char tmp[32];
+ GAME_TEXT tmp[32];
/* Display "injured" stat */
if (p_ptr->stat_cur[stat] < p_ptr->stat_max[stat])
{
char tmp[32];
- sprintf(tmp, _("%5d", "%6d"), p_ptr->lev);
+ sprintf(tmp, "%5d", p_ptr->lev);
if (p_ptr->lev >= p_ptr->max_plv)
{
col_depth = wid + COL_DEPTH;
row_depth = hgt + ROW_DEPTH;
- if (!dun_level)
+ if (!current_floor_ptr->dun_level)
{
strcpy(depths, _("地上", "Surf."));
}
- else if (p_ptr->inside_quest && !dungeon_type)
+ else if (p_ptr->inside_quest && !p_ptr->dungeon_idx)
{
strcpy(depths, _("地上", "Quest"));
}
else
{
- if (depth_in_feet) (void)sprintf(depths, _("%d ft", "%d ft"), (int)dun_level * 50);
- else (void)sprintf(depths, _("%d 階", "Lev %d"), (int)dun_level);
+ if (depth_in_feet) (void)sprintf(depths, _("%d ft", "%d ft"), (int)current_floor_ptr->dun_level * 50);
+ else (void)sprintf(depths, _("%d 階", "Lev %d"), (int)current_floor_ptr->dun_level);
/* Get color of level based on feeling -JSV- */
switch (p_ptr->feeling)
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"));
{
if (p_ptr->riding)
{
- monster_type *m_ptr = &m_list[p_ptr->riding];
+ monster_type *m_ptr = ¤t_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;
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 */
{
if (p_ptr->riding)
{
- monster_type *m_ptr = &m_list[p_ptr->riding];
+ monster_type *m_ptr = ¤t_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;
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)
{
col = COL_INFO;
}
- m_ptr = &m_list[health_who];
+ m_ptr = ¤t_floor_ptr->m_list[health_who];
if (p_ptr->wizard && p_ptr->inside_battle)
{
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
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
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);
}
*/
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();
}
/* Display inventory */
display_inven();
Term_fresh();
-
- /* Restore */
Term_activate(old);
}
}
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;
}
int n_same = 0;
int i;
- for(i=0;i<temp_n;i++){
- cave_type* c_ptr = &cave[temp_y[i]][temp_x[i]];
- if(!c_ptr->m_idx || !m_list[c_ptr->m_idx].ml)continue;//no mons or cannot look
- m_ptr = &m_list[c_ptr->m_idx];
+ for(i=0;i<tmp_pos.n;i++){
+ grid_type* g_ptr = ¤t_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 = ¤t_floor_ptr->m_list[g_ptr->m_idx];
if(is_pet(m_ptr))continue;//pet
if(!m_ptr->r_idx)continue;//dead?
{
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{
target_set_prepare_look();//モンスター一覧を生成,ソート
print_monster_list(0, 0, h);
Term_fresh();
-
- /* Restore */
Term_activate(old);
}
}
/* Display equipment */
display_equip();
Term_fresh();
-
- /* Restore */
Term_activate(old);
}
}
/* Display spell list */
display_spell_list();
Term_fresh();
-
- /* Restore */
Term_activate(old);
}
}
update_playtime();
display_player(0);
Term_fresh();
-
- /* Restore */
Term_activate(old);
}
}
Term_erase(x, y, 255);
}
Term_fresh();
-
- /* Restore */
Term_activate(old);
}
}
display_map(&cy, &cx);
Term_fresh();
}
-
- /* Restore */
Term_activate(old);
}
}
/* Redraw dungeon view */
display_dungeon();
Term_fresh();
-
- /* Restore */
Term_activate(old);
}
}
/* Display monster race info */
if (p_ptr->monster_race_idx) display_roff(p_ptr->monster_race_idx);
Term_fresh();
-
- /* Restore */
Term_activate(old);
}
}
/* Display monster race info */
if (p_ptr->object_kind_idx) display_koff(p_ptr->object_kind_idx);
Term_fresh();
-
- /* Restore */
Term_activate(old);
}
}
if (start_time != 0)
{
u32b tmp = (u32b)time(NULL);
- playtime += (tmp - start_time);
+ current_world_ptr->play_time += (tmp - start_time);
start_time = tmp;
}
}
+
+
+
+/*!
+ * @brief コンソールのリサイズに合わせてマップを再描画する /
+ * Map resizing whenever the main term changes size
+ * @return なし
+ */
+void resize_map(void)
+{
+ /* Only if the dungeon exists */
+ if (!character_dungeon) return;
+
+ /* Mega-Hack -- no panel yet */
+ panel_row_max = 0;
+ panel_col_max = 0;
+
+ /* Reset the panels */
+ panel_row_min = current_floor_ptr->height;
+ panel_col_min = current_floor_ptr->width;
+
+ verify_panel();
+
+ p_ptr->update |= (PU_TORCH | PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
+ p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
+ p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
+ p_ptr->update |= (PU_MONSTERS);
+ p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
+
+ handle_stuff();
+ Term_redraw();
+
+ /*
+ * Waiting command;
+ * Place the cursor on the player
+ */
+ if (can_save) move_cursor_relative(p_ptr->y, p_ptr->x);
+
+ Term_fresh();
+}
+
+/*!
+ * @brief コンソールを再描画する /
+ * Redraw a term when it is resized
+ * @return なし
+ */
+void redraw_window(void)
+{
+ /* Only if the dungeon exists */
+ if (!character_dungeon) return;
+
+ p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
+ p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
+
+ handle_stuff();
+ Term_redraw();
+}
+
+
+/*!
+ * @brief フォーカスを当てるべきマップ描画の基準座標を指定する(サブルーチン)
+ * @param dy 変更先のフロアY座標
+ * @param dx 変更先のフロアX座標
+ * Handle a request to change the current panel
+ * Return TRUE if the panel was changed.
+ * Also used in do_cmd_locate
+ * @return 実際に再描画が必要だった場合TRUEを返す
+ */
+bool change_panel(POSITION dy, POSITION dx)
+{
+ POSITION y, x;
+ TERM_LEN wid, hgt;
+
+ get_screen_size(&wid, &hgt);
+
+ /* Apply the motion */
+ y = panel_row_min + dy * hgt / 2;
+ x = panel_col_min + dx * wid / 2;
+
+ /* Verify the row */
+ if (y > current_floor_ptr->height - hgt) y = current_floor_ptr->height - hgt;
+ if (y < 0) y = 0;
+
+ /* Verify the col */
+ if (x > current_floor_ptr->width - wid) x = current_floor_ptr->width - wid;
+ if (x < 0) x = 0;
+
+ /* Handle "changes" */
+ if ((y != panel_row_min) || (x != panel_col_min))
+ {
+ /* Save the new panel info */
+ panel_row_min = y;
+ panel_col_min = x;
+
+ panel_bounds_center();
+
+ p_ptr->update |= (PU_MONSTERS);
+ p_ptr->redraw |= (PR_MAP);
+ handle_stuff();
+
+ /* Success */
+ return (TRUE);
+ }
+
+ /* No change */
+ 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;
+}