/*!
* @file xtra1.c
- * @brief 雑多なその他の処理1 / misc code
- * @date 2014/08/17
+ * @brief プレイヤーのステータス処理 / status
+ * @date 2018/09/25
* @author
* Copyright (c) 1989 James E. Wilson, Robert A. Koeneke\n
* This software may be copied and distributed for educational, research, and\n
}
/* Return new value */
- return (value);
+ return (s16b)(value);
}
-/*
+/*!
+ * @brief 画面左の能力値表示を行うために指定位置から13キャラ分を空白消去後指定のメッセージを明るい青で描画する /
* Print character info at given row, column in a 13 char field
+ * @param info 表示文字列
+ * @param row 描画列
+ * @param col 描画行
+ * @return なし
*/
static void prt_field(cptr info, int row, int col)
{
}
-/*
- * Whether daytime or not
+/*!
+ * @brief ゲーム時間が日中かどうかを返す /
+ * Whether daytime or not
+ * @return 日中ならばTRUE、夜ならばFALSE
*/
bool is_daytime(void)
{
return FALSE;
}
-/*
+/*!
+ * @brief 現在の日数、時刻を返す /
* Extract day, hour, min
+ * @param day 日数を返すための参照ポインタ
+ * @param hour 時数を返すための参照ポインタ
+ * @param min 分数を返すための参照ポインタ
*/
void extract_day_hour_min(int *day, int *hour, int *min)
{
*min = (1440 * turn_in_today / A_DAY) % 60;
}
-/*
+/*!
+ * @brief ゲーム時刻を表示する /
* Print time
+ * @return なし
*/
void prt_time(void)
{
c_put_str(TERM_WHITE, format("%2d:%02d", hour, min), ROW_DAY, COL_DAY+7);
}
-
+/*!
+ * @brief 現在のマップ名を返す /
+ * @return マップ名の文字列参照ポインタ
+ */
cptr map_name(void)
{
if (p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)
return d_name+d_info[dungeon_type].name;
}
-/*
- * Print dungeon
+/*!
+ * @brief 現在のマップ名を描画する / Print dungeon
+ * @return なし
*/
static void prt_dungeon(void)
{
}
-
-
-/*
- * Print character stat in given row, column
+/*!
+ * @brief プレイヤー能力値を描画する / Print character stat in given row, column
+ * @param stat 描画するステータスのID
+ * @return なし
*/
static void prt_stat(int stat)
{
/*
- * Data structure for status bar
+ * 画面下部に表示する状態表示定義ID / Data structure for status bar
*/
-#define BAR_TSUYOSHI 0
-#define BAR_HALLUCINATION 1
-#define BAR_BLINDNESS 2
-#define BAR_PARALYZE 3
-#define BAR_CONFUSE 4
-#define BAR_POISONED 5
-#define BAR_AFRAID 6
-#define BAR_LEVITATE 7
-#define BAR_REFLECTION 8
-#define BAR_PASSWALL 9
-#define BAR_WRAITH 10
-#define BAR_PROTEVIL 11
-#define BAR_KAWARIMI 12
-#define BAR_MAGICDEFENSE 13
-#define BAR_EXPAND 14
-#define BAR_STONESKIN 15
-#define BAR_MULTISHADOW 16
-#define BAR_REGMAGIC 17
-#define BAR_ULTIMATE 18
-#define BAR_INVULN 19
-#define BAR_IMMACID 20
-#define BAR_RESACID 21
-#define BAR_IMMELEC 22
-#define BAR_RESELEC 23
-#define BAR_IMMFIRE 24
-#define BAR_RESFIRE 25
-#define BAR_IMMCOLD 26
-#define BAR_RESCOLD 27
-#define BAR_RESPOIS 28
-#define BAR_RESNETH 29
-#define BAR_RESTIME 30
-#define BAR_DUSTROBE 31
-#define BAR_SHFIRE 32
-#define BAR_TOUKI 33
-#define BAR_SHHOLY 34
-#define BAR_EYEEYE 35
-#define BAR_BLESSED 36
-#define BAR_HEROISM 37
-#define BAR_BERSERK 38
-#define BAR_ATTKFIRE 39
-#define BAR_ATTKCOLD 40
-#define BAR_ATTKELEC 41
-#define BAR_ATTKACID 42
-#define BAR_ATTKPOIS 43
-#define BAR_ATTKCONF 44
-#define BAR_SENSEUNSEEN 45
-#define BAR_TELEPATHY 46
-#define BAR_REGENERATION 47
-#define BAR_INFRAVISION 48
-#define BAR_STEALTH 49
-#define BAR_SUPERSTEALTH 50
-#define BAR_RECALL 51
-#define BAR_ALTER 52
-#define BAR_SHCOLD 53
-#define BAR_SHELEC 54
-#define BAR_SHSHADOW 55
-#define BAR_MIGHT 56
-#define BAR_BUILD 57
-#define BAR_ANTIMULTI 58
-#define BAR_ANTITELE 59
-#define BAR_ANTIMAGIC 60
-#define BAR_PATIENCE 61
-#define BAR_REVENGE 62
-#define BAR_RUNESWORD 63
-#define BAR_VAMPILIC 64
-#define BAR_CURE 65
-#define BAR_ESP_EVIL 66
+#define BAR_TSUYOSHI 0 /*!< 下部ステータス表示: オクレ兄さん状態 */
+#define BAR_HALLUCINATION 1 /*!< 下部ステータス表示: 幻覚 */
+#define BAR_BLINDNESS 2 /*!< 下部ステータス表示: 盲目 */
+#define BAR_PARALYZE 3 /*!< 下部ステータス表示: 麻痺 */
+#define BAR_CONFUSE 4 /*!< 下部ステータス表示: 混乱 */
+#define BAR_POISONED 5 /*!< 下部ステータス表示: 毒 */
+#define BAR_AFRAID 6 /*!< 下部ステータス表示: 恐怖 */
+#define BAR_LEVITATE 7 /*!< 下部ステータス表示: 浮遊 */
+#define BAR_REFLECTION 8 /*!< 下部ステータス表示: 反射 */
+#define BAR_PASSWALL 9 /*!< 下部ステータス表示: 壁抜け */
+#define BAR_WRAITH 10 /*!< 下部ステータス表示: 幽体化 */
+#define BAR_PROTEVIL 11 /*!< 下部ステータス表示: 対邪悪結界 */
+#define BAR_KAWARIMI 12 /*!< 下部ステータス表示: 変わり身 */
+#define BAR_MAGICDEFENSE 13 /*!< 下部ステータス表示: 魔法の鎧 */
+#define BAR_EXPAND 14 /*!< 下部ステータス表示: 横伸び */
+#define BAR_STONESKIN 15 /*!< 下部ステータス表示: 石肌化 */
+#define BAR_MULTISHADOW 16 /*!< 下部ステータス表示: 影分身 */
+#define BAR_REGMAGIC 17 /*!< 下部ステータス表示: 魔法防御 */
+#define BAR_ULTIMATE 18 /*!< 下部ステータス表示: 究極の耐性 */
+#define BAR_INVULN 19 /*!< 下部ステータス表示: 無敵化 */
+#define BAR_IMMACID 20 /*!< 下部ステータス表示: 酸免疫 */
+#define BAR_RESACID 21 /*!< 下部ステータス表示: 酸耐性 */
+#define BAR_IMMELEC 22 /*!< 下部ステータス表示: 電撃免疫 */
+#define BAR_RESELEC 23 /*!< 下部ステータス表示: 電撃耐性 */
+#define BAR_IMMFIRE 24 /*!< 下部ステータス表示: 火炎免疫 */
+#define BAR_RESFIRE 25 /*!< 下部ステータス表示: 火炎耐性 */
+#define BAR_IMMCOLD 26 /*!< 下部ステータス表示: 冷気免疫 */
+#define BAR_RESCOLD 27 /*!< 下部ステータス表示: 冷気耐性 */
+#define BAR_RESPOIS 28 /*!< 下部ステータス表示: 毒耐性 */
+#define BAR_RESNETH 29 /*!< 下部ステータス表示: 地獄耐性 */
+#define BAR_RESTIME 30 /*!< 下部ステータス表示: 時間逆転耐性 */
+#define BAR_DUSTROBE 31 /*!< 下部ステータス表示: 破片オーラ */
+#define BAR_SHFIRE 32 /*!< 下部ステータス表示: 火炎オーラ */
+#define BAR_TOUKI 33 /*!< 下部ステータス表示: 闘気 */
+#define BAR_SHHOLY 34 /*!< 下部ステータス表示: 聖なるオーラ */
+#define BAR_EYEEYE 35 /*!< 下部ステータス表示: 目には目を */
+#define BAR_BLESSED 36 /*!< 下部ステータス表示: 祝福 */
+#define BAR_HEROISM 37 /*!< 下部ステータス表示: 士気高揚 */
+#define BAR_BERSERK 38 /*!< 下部ステータス表示: 狂戦士化 */
+#define BAR_ATTKFIRE 39 /*!< 下部ステータス表示: 焼棄スレイ */
+#define BAR_ATTKCOLD 40 /*!< 下部ステータス表示: 冷凍スレイ */
+#define BAR_ATTKELEC 41 /*!< 下部ステータス表示: 電撃スレイ */
+#define BAR_ATTKACID 42 /*!< 下部ステータス表示: 溶解スレイ */
+#define BAR_ATTKPOIS 43 /*!< 下部ステータス表示: 毒殺スレイ */
+#define BAR_ATTKCONF 44 /*!< 下部ステータス表示: 混乱打撃 */
+#define BAR_SENSEUNSEEN 45 /*!< 下部ステータス表示: 透明視 */
+#define BAR_TELEPATHY 46 /*!< 下部ステータス表示: テレパシー */
+#define BAR_REGENERATION 47 /*!< 下部ステータス表示: 急回復 */
+#define BAR_INFRAVISION 48 /*!< 下部ステータス表示: 赤外線視力 */
+#define BAR_STEALTH 49 /*!< 下部ステータス表示: 隠密 */
+#define BAR_SUPERSTEALTH 50 /*!< 下部ステータス表示: 超隠密 */
+#define BAR_RECALL 51 /*!< 下部ステータス表示: 帰還待ち */
+#define BAR_ALTER 52 /*!< 下部ステータス表示: 現実変容待ち */
+#define BAR_SHCOLD 53 /*!< 下部ステータス表示: 冷気オーラ */
+#define BAR_SHELEC 54 /*!< 下部ステータス表示: 電撃オーラ */
+#define BAR_SHSHADOW 55 /*!< 下部ステータス表示: 影のオーラ */
+#define BAR_MIGHT 56 /*!< 下部ステータス表示: 腕力強化 */
+#define BAR_BUILD 57 /*!< 下部ステータス表示: 肉体強化 */
+#define BAR_ANTIMULTI 58 /*!< 下部ステータス表示: 反増殖 */
+#define BAR_ANTITELE 59 /*!< 下部ステータス表示: 反テレポート */
+#define BAR_ANTIMAGIC 60 /*!< 下部ステータス表示: 反魔法 */
+#define BAR_PATIENCE 61 /*!< 下部ステータス表示: 我慢 */
+#define BAR_REVENGE 62 /*!< 下部ステータス表示: 宣告 */
+#define BAR_RUNESWORD 63 /*!< 下部ステータス表示: 魔剣化 */
+#define BAR_VAMPILIC 64 /*!< 下部ステータス表示: 吸血 */
+#define BAR_CURE 65 /*!< 下部ステータス表示: 回復 */
+#define BAR_ESP_EVIL 66 /*!< 下部ステータス表示: 邪悪感知 */
static struct {
byte attr;
};
#endif
+/*!
+ * @brief 32ビット変数配列の指定位置のビットフラグを1にする。
+ * @param FLG フラグ位置(ビット)
+ * @return なし
+ */
#define ADD_FLG(FLG) (bar_flags[FLG / 32] |= (1L << (FLG % 32)))
+
+/*!
+ * @brief 32ビット変数配列の指定位置のビットフラグが1かどうかを返す。
+ * @param FLG フラグ位置(ビット)
+ * @return 1ならば0以外を返す
+ */
#define IS_FLG(FLG) (bar_flags[FLG / 32] & (1L << (FLG % 32)))
-/*
- * Show status bar
+/*!
+ * @brief 下部に状態表示を行う / Show status bar
+ * @return なし
*/
static void prt_status(void)
{
hex_spelling(HEX_CURE_SERIOUS) ||
hex_spelling(HEX_CURE_CRITICAL)) ADD_FLG(BAR_CURE);
- if (p_ptr->magic_num2[2])
+ if (HEX_REVENGE_TURN(p_ptr))
{
- if (p_ptr->magic_num2[1] == 1) ADD_FLG(BAR_PATIENCE);
- if (p_ptr->magic_num2[1] == 2) ADD_FLG(BAR_REVENGE);
+ if (HEX_REVENGE_TYPE(p_ptr) == 1) ADD_FLG(BAR_PATIENCE);
+ if (HEX_REVENGE_TYPE(p_ptr) == 2) ADD_FLG(BAR_REVENGE);
}
}
}
-
-/*
- * Prints "title", including "wizard" or "winner" as needed.
+/*!
+ * @brief プレイヤーの称号を表示する / Prints "title", including "wizard" or "winner" as needed.
+ * @return なし
*/
static void prt_title(void)
{
}
-/*
- * Prints level
+/*!
+ * @brief プレイヤーのレベルを表示する / Prints level
+ * @return なし
*/
static void prt_level(void)
{
}
-/*
- * Display the experience
+/*!
+ * @brief プレイヤーの経験値を表示する / Display the experience
+ * @return なし
*/
static void prt_exp(void)
{
}
}
-/*
- * Prints current gold
+/*!
+ * @brief プレイヤーの所持金を表示する / Prints current gold
+ * @return なし
*/
static void prt_gold(void)
{
}
-
-/*
- * Prints current AC
+/*!
+ * @brief プレイヤーのACを表示する / Prints current AC
+ * @return なし
*/
static void prt_ac(void)
{
}
-/*
- * Prints Cur/Max hit points
+/*!
+ * @brief プレイヤーのHPを表示する / Prints Cur/Max hit points
+ * @return なし
*/
static void prt_hp(void)
{
}
-/*
- * Prints players max/cur spell points
+/*!
+ * @brief プレイヤーのMPを表示する / Prints players max/cur spell points
+ * @return なし
*/
static void prt_sp(void)
{
}
-/*
- * Prints depth in stat area
+/*!
+ * @brief 現在のフロアの深さを表示する / Prints depth in stat area
+ * @return なし
*/
static void prt_depth(void)
{
}
else
{
- if (depth_in_feet) (void)sprintf(depths, _("%d ft", "%d ft"), dun_level * 50);
- else (void)sprintf(depths, _("%d 階", "Lev %d"), dun_level);
+ 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);
/* Get color of level based on feeling -JSV- */
switch (p_ptr->feeling)
}
-/*
- * Prints status of hunger
+/*!
+ * @brief プレイヤーの空腹状態を表示する / Prints status of hunger
+ * @return なし
*/
static void prt_hunger(void)
{
}
-/*
- * Prints Searching, Resting, Paralysis, or 'count' status
+/*!
+ * @brief プレイヤーの行動状態を表示する / Prints Searching, Resting, Paralysis, or 'count' status
+ * @return なし
+ * @details
* Display is always exactly 10 characters wide (see below)
- *
* This function was a major bottleneck when resting, so a lot of
* the text formatting code was optimized in place below.
*/
{
byte attr = TERM_WHITE;
- char text[5];
+ char text[16];
/* Repeating */
if (command_rep)
}
/* Rest until healed */
- else if (resting == -1)
+ else if (resting == COMMAND_ARG_REST_FULL_HEALING)
{
text[0] = text[1] = text[2] = text[3] = '*';
}
/* Rest until done */
- else if (resting == -2)
+ else if (resting == COMMAND_ARG_REST_UNTIL_DONE)
{
text[0] = text[1] = text[2] = text[3] = '&';
}
}
-/*
- * Prints the speed of a character. -CJS-
+/*!
+ * @brief プレイヤーの行動速度を表示する / Prints the speed of a character. -CJS-
+ * @return なし
*/
static void prt_speed(void)
{
}
+/*!
+ * @brief プレイヤーの呪文学習可能状態を表示する
+ * @return なし
+ */
static void prt_study(void)
{
int wid, hgt, row_study, col_study;
}
+/*!
+ * @brief プレイヤーのものまね可能状態を表示する
+ * @return なし
+ */
static void prt_imitation(void)
{
int wid, hgt, row_study, col_study;
}
}
-
+/*!
+ * @brief プレイヤーの負傷状態を表示する
+ * @return なし
+ */
static void prt_cut(void)
{
int c = p_ptr->cut;
}
-
+/*!
+ * @brief プレイヤーの朦朧状態を表示する
+ * @return なし
+ */
static void prt_stun(void)
{
int s = p_ptr->stun;
-/*
+/*!
+ * @brief モンスターの体力ゲージを表示する
+ * @param riding TRUEならば騎乗中のモンスターの体力、FALSEならターゲットモンスターの体力を表示する。表示位置は固定。
+ * @return なし
+ * @details
+ * <pre>
* Redraw the "monster health bar" -DRS-
* Rather extensive modifications by -BEN-
*
* "health-o-meter"). Clear health bar if nothing is being tracked.
* Auto-track current target monster when bored. Note that the
* health-bar stops tracking any monster that "disappears".
+ * </pre>
*/
static void health_redraw(bool riding)
{
-/*
- * Display basic info (mostly left of map)
+/*!
+ * @brief プレイヤーのステータスを一括表示する(左側部分) / Display basic info (mostly left of map)
+ * @return なし
*/
static void prt_frame_basic(void)
{
}
-/*
- * Display extra info (mostly below map)
+/*!
+ * @brief プレイヤーのステータスを一括表示する(下部分) / Display extra info (mostly below map)
+ * @return なし
*/
static void prt_frame_extra(void)
{
}
-/*
- * Hack -- display inventory in sub-windows
+/*!
+ * @brief サブウィンドウに所持品一覧を表示する / Hack -- display inventory in sub-windows
+ * @return なし
*/
static void fix_inven(void)
{
}
-/*
- * Print monster info in line
+/*!
+ * @brief モンスターの現在数を一行で表現する / Print monster info in line
+ * @param x 表示列
+ * @param y 表示行
+ * @param m_ptr 思い出を表示するモンスター情報の参照ポインタ
+ * @param n_same モンスターの数の現在数
+ * @details
+ * <pre>
* nnn X LV name
* nnn : number or unique(U) or wanted unique(W)
* X : symbol of monster
* LV : monster lv if known
* name: name of monster
+ * @return なし
+ * </pre>
*/
-static void print_monster_line(int x, int y, monster_type* m_ptr, int n_same){
+static void print_monster_line(TERM_LEN x, TERM_LEN y, monster_type* m_ptr, int n_same){
char buf[256];
int i;
- int r_idx = m_ptr->ap_r_idx;
+ MONRACE_IDX r_idx = m_ptr->ap_r_idx;
monster_race* r_ptr = &r_info[r_idx];
Term_gotoxy(x, y);
Term_add_bigch(r_ptr->x_attr, r_ptr->x_char);
//LV
if (r_ptr->r_tkills && !(m_ptr->mflag2 & MFLAG2_KAGE)){
- sprintf(buf, " %2d", r_ptr->level);
+ sprintf(buf, " %2d", (int)r_ptr->level);
}else{
strcpy(buf, " ??");
}
//Term_addstr(-1, TERM_WHITE, look_mon_desc(m_ptr, 0));
}
- /*
- max_lines : 最大何行描画するか.
-*/
-void print_monster_list(int x, int y, int max_lines){
- int line = y;
+/*!
+ * @brief モンスターの出現リストを表示する / Print monster info in line
+ * @param x 表示列
+ * @param y 表示行
+ * @param max_lines 最大何行描画するか
+ */
+void print_monster_list(TERM_LEN x, TERM_LEN y, TERM_LEN max_lines){
+ TERM_LEN line = y;
monster_type* last_mons = NULL;
monster_type* m_ptr = NULL;
int n_same = 0;
if(!m_ptr->r_idx)continue;//dead?
{
/*
- int r_idx = m_ptr->ap_r_idx;
+ MONRACE_IDX r_idx = m_ptr->ap_r_idx;
monster_race* r_ptr = &r_info[r_idx];
cptr name = (r_name + r_ptr->name);
cptr ename = (r_name + r_ptr->name);
if(last_mons)print_monster_line(x, line++, last_mons, n_same);
}
}
-/*
- * Hack -- display monster list in sub-windows
+
+/*!
+ * @brief 出現中モンスターのリストをサブウィンドウに表示する / Hack -- display monster list in sub-windows
+ * @return なし
*/
static void fix_monster_list(void)
{
-
-/*
+/*!
+ * @brief 現在の装備品をサブウィンドウに表示する /
* Hack -- display equipment in sub-windows
+ * @return なし
*/
static void fix_equip(void)
{
}
-/*
- * Hack -- display equipment in sub-windows
+/*!
+ * @brief 現在の習得済魔法をサブウィンドウに表示する /
+ * Hack -- display spells in sub-windows
+ * @return なし
*/
static void fix_spell(void)
{
}
-/*
+/*!
+ * @brief 現在のプレイヤーステータスをサブウィンドウに表示する /
* Hack -- display character in sub-windows
+ * @return なし
*/
static void fix_player(void)
{
}
}
-
-
-/*
+/*!
+ * @brief ゲームメッセージ履歴をサブウィンドウに表示する /
* Hack -- display recent messages in sub-windows
- *
* XXX XXX XXX Adjust for width and split messages
+ * @return なし
*/
static void fix_message(void)
{
int j, i;
- int w, h;
- int x, y;
+ TERM_LEN w, h;
+ TERM_LEN x, y;
/* Scan windows */
for (j = 0; j < 8; j++)
}
-/*
+/*!
+ * @brief 簡易マップをサブウィンドウに表示する /
* Hack -- display overhead view in sub-windows
- *
+ * XXX XXX XXX Adjust for width and split messages
+ * @return なし
+ * @details
* Note that the "player" symbol does NOT appear on the map.
*/
static void fix_overhead(void)
}
-/*
+/*!
+ * @brief ダンジョンの地形をサブウィンドウに表示する /
* Hack -- display dungeon view in sub-windows
+ * @return なし
*/
static void fix_dungeon(void)
{
}
-/*
- * Hack -- display monster recall in sub-windows
+/*!
+ * @brief モンスターの思い出をサブウィンドウに表示する /
+ * Hack -- display dungeon view in sub-windows
+ * @return なし
*/
static void fix_monster(void)
{
}
-/*
+/*!
+ * @brief ベースアイテム情報をサブウィンドウに表示する /
* Hack -- display object recall in sub-windows
+ * @return なし
*/
static void fix_object(void)
{
}
-/*
+
+/*!
+ * @brief プレイヤーの現在学習可能な魔法数を計算し、増減に応じて魔法の忘却、再学習を処置する。 /
* Calculate number of spells player should have, and forget,
* or remember, spells until that number is properly reflected.
- *
+ * @return なし
+ * @details
* Note that this function induces various "status" messages,
* which must be bypasses until the character is created.
*/
static void calc_spells(void)
{
- int i, j, k, levels;
- int num_allowed;
- int num_boukyaku = 0;
+ int i, j, k, levels;
+ int num_allowed;
+ int num_boukyaku = 0;
const magic_type *s_ptr;
- int which;
+ REALM_IDX which;
int bonus = 0;
which = p_ptr->realm2;
}
- /* Message */
#ifdef JP
- msg_format("%sの%sを忘れてしまった。",
- do_spell(which, j%32, SPELL_NAME), p );
+ msg_format("%sの%sを忘れてしまった。", do_spell(which, j%32, SPELL_NAME), p );
#else
- msg_format("You have forgotten the %s of %s.", p,
- do_spell(which, j%32, SPELL_NAME));
+ msg_format("You have forgotten the %s of %s.", p, do_spell(which, j%32, SPELL_NAME));
#endif
which = p_ptr->realm2;
}
- /* Message */
#ifdef JP
msg_format("%sの%sを忘れてしまった。",
do_spell(which, j%32, SPELL_NAME), p );
which = p_ptr->realm2;
}
- /* Message */
#ifdef JP
- msg_format("%sの%sを思い出した。",
- do_spell(which, j%32, SPELL_NAME), p );
+ msg_format("%sの%sを思い出した。", do_spell(which, j%32, SPELL_NAME), p );
#else
- msg_format("You have remembered the %s of %s.",
- p, do_spell(which, j%32, SPELL_NAME));
+ msg_format("You have remembered the %s of %s.", p, do_spell(which, j%32, SPELL_NAME));
#endif
k++;
}
if (k > 32) k = 32;
- if ((p_ptr->new_spells > k) && ((mp_ptr->spell_book == TV_LIFE_BOOK) || (mp_ptr->spell_book == TV_HISSATSU_BOOK))) p_ptr->new_spells = k;
+ if ((p_ptr->new_spells > k) &&
+ ((mp_ptr->spell_book == TV_LIFE_BOOK) || (mp_ptr->spell_book == TV_HISSATSU_BOOK)))
+ {
+ p_ptr->new_spells = (s16b)k;
+ }
}
if (p_ptr->new_spells < 0) p_ptr->new_spells = 0;
/* Message if needed */
if (p_ptr->new_spells)
{
- /* Message */
#ifdef JP
if( p_ptr->new_spells < 10 ){
msg_format("あと %d つの%sを学べる。", p_ptr->new_spells, p);
}
}
-
-/*
+/*!
+ * @brief プレイヤーの最大MPを計算する /
* Calculate maximum mana. You do not need to know any spells.
* Note that mana is lowered by heavy (or inappropriate) armor.
- *
+ * @return なし
+ * @details
* This function induces status messages.
*/
static void calc_mana(void)
{
- int msp, levels, cur_wgt, max_wgt;
+ int msp, levels, cur_wgt, max_wgt;
object_type *o_ptr;
/* Only mages are affected */
if (mp_ptr->spell_xtra & MAGIC_GLOVE_REDUCE_MANA)
{
- u32b flgs[TR_FLAG_SIZE];
+ BIT_FLAGS flgs[TR_FLAG_SIZE];
/* Assume player is not encumbered by gloves */
p_ptr->cumber_glove = FALSE;
/* レベルアップの時は上昇量を表示する */
if ((level_up == 1) && (msp > p_ptr->msp))
{
- msg_format("最大マジック・ポイントが %d 増加した!",
- (msp - p_ptr->msp));
+ msg_format("最大マジック・ポイントが %d 増加した!", (msp - p_ptr->msp));
}
#endif
/* Save new mana */
/* Take note when "glove state" changes */
if (p_ptr->old_cumber_glove != p_ptr->cumber_glove)
{
- /* Message */
if (p_ptr->cumber_glove)
{
msg_print(_("手が覆われて呪文が唱えにくい感じがする。", "Your covered hands feel unsuitable for spellcasting."));
/* Take note when "armor state" changes */
if (p_ptr->old_cumber_armor != p_ptr->cumber_armor)
{
- /* Message */
if (p_ptr->cumber_armor)
{
msg_print(_("装備の重さで動きが鈍くなってしまっている。", "The weight of your equipment encumbers your movement."));
-/*
+/*!
+ * @brief プレイヤーの最大HPを計算する /
* Calculate the players (maximal) hit points
* Adjust current hitpoints if necessary
+ * @return なし
+ * @details
*/
static void calc_hitpoints(void)
{
/* レベルアップの時は上昇量を表示する */
if ((level_up == 1) && (mhp > p_ptr->mhp))
{
- msg_format("最大ヒット・ポイントが %d 増加した!",
- (mhp - p_ptr->mhp) );
+ msg_format("最大ヒット・ポイントが %d 増加した!", (mhp - p_ptr->mhp) );
}
#endif
/* Save the new max-hitpoints */
}
}
-
-
-/*
- * Extract and set the current "lite radius"
- *
+/*!
+ * @brief プレイヤーの光源半径を計算する / Extract and set the current "lite radius"
+ * @return なし
+ * @details
* SWD: Experimental modification: multiple light sources have additive effect.
- *
*/
static void calc_torch(void)
{
int i, rad;
object_type *o_ptr;
- u32b flgs[TR_FLAG_SIZE];
+ BIT_FLAGS flgs[TR_FLAG_SIZE];
/* Assume no light */
p_ptr->cur_lite = 0;
if (have_flag(flgs, TR_LITE_M1)) rad -= 1;
if (have_flag(flgs, TR_LITE_M2)) rad -= 2;
if (have_flag(flgs, TR_LITE_M3)) rad -= 3;
- p_ptr->cur_lite += rad;
+ p_ptr->cur_lite += (s16b)rad;
}
/* max radius is 14 (was 5) without rewriting other code -- */
}
-
-/*
+/*!
+ * @brief プレイヤーの所持重量制限を計算する /
* Computes current weight limit.
+ * @return 制限重量(ポンド)
*/
-u32b weight_limit(void)
+WEIGHT weight_limit(void)
{
- u32b i;
+ WEIGHT i;
/* Weight limit based only on strength */
- i = (u32b)adj_str_wgt[p_ptr->stat_ind[A_STR]] * 50; /* Constant was 100 */
+ i = (WEIGHT)adj_str_wgt[p_ptr->stat_ind[A_STR]] * 50; /* Constant was 100 */
if (p_ptr->pclass == CLASS_BERSERKER) i = i * 3 / 2;
/* Return the result */
return i;
}
-
+/*!
+ * @brief プレイヤーが現在右手/左手に武器を持っているか判定する /
+ * @param i 判定する手のID(右手:0 左手:1)
+ * @return 持っているならばTRUE
+ */
bool buki_motteruka(int i)
{
return ((inventory[i].k_idx && object_is_melee_weapon(&inventory[i])) ? TRUE : FALSE);
}
+/*!
+ * @brief 射撃武器がプレイヤーにとって重すぎるかどうかの判定 /
+ * @param o_ptr 判定する射撃武器のアイテム情報参照ポインタ
+ * @return 重すぎるならばTRUE
+ */
bool is_heavy_shoot(object_type *o_ptr)
{
int hold = adj_str_hold[p_ptr->stat_ind[A_STR]];
return (hold < o_ptr->weight / 10);
}
+/*!
+ * @brief 射撃武器に対応する矢/弾薬のベースアイテムIDを返す /
+ * @param o_ptr 判定する射撃武器のアイテム情報参照ポインタ
+ * @return 対応する矢/弾薬のベースアイテムID
+ */
int bow_tval_ammo(object_type *o_ptr)
{
/* Analyze the launcher */
return TV_BOLT;
}
case SV_CRIMSON:
+ case SV_HARP:
{
return TV_NO_AMMO;
}
return 0;
}
-/* calcurate the fire rate of target object */
+/*!
+ * @brief 装備中の射撃武器の威力倍率を返す /
+ * calcurate the fire rate of target object
+ * @param o_ptr 計算する射撃武器のアイテム情報参照ポインタ
+ * @return 射撃倍率の値(100で1.00倍)
+ */
s16b calc_num_fire(object_type *o_ptr)
{
int extra_shots = 0;
int i;
int num = 0;
- int tval_ammo = bow_tval_ammo(o_ptr);
+ OBJECT_TYPE_VALUE tval_ammo = bow_tval_ammo(o_ptr);
object_type *q_ptr;
- u32b flgs[TR_FLAG_SIZE];
+ BIT_FLAGS flgs[TR_FLAG_SIZE];
/* Scan the usable inventory */
for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
num += (p_ptr->lev * 4);
}
}
- return num;
+ return (s16b)num;
}
-/*
+/*!
+ * @brief プレイヤーの全ステータスを更新する /
* Calculate the players current "state", taking into account
* not only race/class intrinsics, but also objects being worn
* and temporary spell effects.
- *
+ * @return なし
+ * @details
+ * <pre>
* See also calc_mana() and calc_hitpoints().
*
* Take note of the new "speed code", in particular, a very strong
* are actually added in later, at the appropriate place.
*
* This function induces various "status" messages.
+ * </pre>
*/
void calc_bonuses(void)
{
int empty_hands_status = empty_hands(TRUE);
int extra_blows[2];
object_type *o_ptr;
- u32b flgs[TR_FLAG_SIZE];
+ BIT_FLAGS flgs[TR_FLAG_SIZE];
bool omoi = FALSE;
bool yoiyami = FALSE;
bool down_saving = FALSE;
bool have_sw = FALSE, have_kabe = FALSE;
bool easy_2weapon = FALSE;
bool riding_levitation = FALSE;
- s16b this_o_idx, next_o_idx = 0;
+ OBJECT_IDX this_o_idx, next_o_idx = 0;
const player_race *tmp_rp_ptr;
/* Save the old vision stuff */
bool old_mighty_throw = p_ptr->mighty_throw;
/* Save the old armor class */
- bool old_dis_ac = p_ptr->dis_ac;
- bool old_dis_to_a = p_ptr->dis_to_a;
+ s16b old_dis_ac = p_ptr->dis_ac;
+ s16b old_dis_to_a = p_ptr->dis_to_a;
/* Clear extra blows/shots */
/* To Bow and Natural attack */
/* Apply the bonuses to hit/damage */
- p_ptr->to_h_b += bonus_to_h;
- p_ptr->to_h_m += bonus_to_h;
- p_ptr->to_d_m += bonus_to_d;
+ p_ptr->to_h_b += (s16b)bonus_to_h;
+ p_ptr->to_h_m += (s16b)bonus_to_h;
+ p_ptr->to_d_m += (s16b)bonus_to_d;
/* Apply the mental bonuses tp hit/damage, if known */
- if (object_is_known(o_ptr)) p_ptr->dis_to_h_b += bonus_to_h;
+ if (object_is_known(o_ptr)) p_ptr->dis_to_h_b += (s16b)bonus_to_h;
/* To Melee */
if ((i == INVEN_LEFT || i == INVEN_RIGHT) && !p_ptr->ryoute)
{
/* Apply the bonuses to hit/damage */
- p_ptr->to_h[i-INVEN_RIGHT] += bonus_to_h;
- p_ptr->to_d[i-INVEN_RIGHT] += bonus_to_d;
+ p_ptr->to_h[i-INVEN_RIGHT] += (s16b)bonus_to_h;
+ p_ptr->to_d[i-INVEN_RIGHT] += (s16b)bonus_to_d;
/* Apply the mental bonuses tp hit/damage, if known */
if (object_is_known(o_ptr))
{
- p_ptr->dis_to_h[i-INVEN_RIGHT] += bonus_to_h;
- p_ptr->dis_to_d[i-INVEN_RIGHT] += bonus_to_d;
+ p_ptr->dis_to_h[i-INVEN_RIGHT] += (s16b)bonus_to_h;
+ p_ptr->dis_to_d[i-INVEN_RIGHT] += (s16b)bonus_to_d;
}
}
else if (p_ptr->migite && p_ptr->hidarite)
else
{
/* Apply the bonuses to hit/damage */
- p_ptr->to_h[default_hand] += bonus_to_h;
- p_ptr->to_d[default_hand] += bonus_to_d;
+ p_ptr->to_h[default_hand] += (s16b)bonus_to_h;
+ p_ptr->to_d[default_hand] += (s16b)bonus_to_d;
/* Apply the mental bonuses to hit/damage, if known */
if (object_is_known(o_ptr))
{
- p_ptr->dis_to_h[default_hand] += bonus_to_h;
- p_ptr->dis_to_d[default_hand] += bonus_to_d;
+ p_ptr->dis_to_h[default_hand] += (s16b)bonus_to_h;
+ p_ptr->dis_to_d[default_hand] += (s16b)bonus_to_d;
}
}
}
/* Hex bonuses */
if (p_ptr->realm1 == REALM_HEX)
{
- if (hex_spelling_any()) p_ptr->skill_stl -= (1 + p_ptr->magic_num2[0]);
+ if (hex_spelling_any()) p_ptr->skill_stl -= (1 + CASTING_HEX_NUM(p_ptr));
if (hex_spelling(HEX_DETECT_EVIL)) p_ptr->esp_evil = TRUE;
if (hex_spelling(HEX_XTRA_MIGHT)) p_ptr->stat_add[A_STR] += 4;
if (hex_spelling(HEX_BUILDING))
}
for (i = INVEN_RARM; i <= INVEN_FEET; i++)
{
- int ac = 0;
+ ARMOUR_CLASS ac = 0;
o_ptr = &inventory[i];
if (!o_ptr->k_idx) continue;
if (!object_is_armour(o_ptr)) continue;
ac += 5;
if (o_ptr->curse_flags & TRC_HEAVY_CURSE) ac += 7;
if (o_ptr->curse_flags & TRC_PERMA_CURSE) ac += 13;
- p_ptr->to_a += ac;
- p_ptr->dis_to_a += ac;
+ p_ptr->to_a += (s16b)ac;
+ p_ptr->dis_to_a += (s16b)ac;
}
}
if (p_ptr->stat_top[i] != top)
{
/* Save the new value */
- p_ptr->stat_top[i] = top;
+ p_ptr->stat_top[i] = (s16b)top;
/* Redisplay the stats later */
p_ptr->redraw |= (PR_STATS);
if (p_ptr->stat_use[i] != use)
{
/* Save the new value */
- p_ptr->stat_use[i] = use;
+ p_ptr->stat_use[i] = (s16b)use;
/* Redisplay the stats later */
p_ptr->redraw |= (PR_STATS);
if (p_ptr->stat_ind[i] != ind)
{
/* Save the new index */
- p_ptr->stat_ind[i] = ind;
+ p_ptr->stat_ind[i] = (s16b)ind;
/* Change in CON affects Hitpoints */
if (i == A_CON)
}
if (inventory[INVEN_RARM].tval == TV_POLEARM) penalty1 += 10;
if (inventory[INVEN_LARM].tval == TV_POLEARM) penalty2 += 10;
- p_ptr->to_h[0] -= penalty1;
- p_ptr->to_h[1] -= penalty2;
- p_ptr->dis_to_h[0] -= penalty1;
- p_ptr->dis_to_h[1] -= penalty2;
+ p_ptr->to_h[0] -= (s16b)penalty1;
+ p_ptr->to_h[1] -= (s16b)penalty2;
+ p_ptr->dis_to_h[0] -= (s16b)penalty1;
+ p_ptr->dis_to_h[1] -= (s16b)penalty2;
}
/* Extract the current weight (in tenth pounds) */
/* Compute "extra shots" if needed */
if (o_ptr->k_idx)
{
- p_ptr->tval_ammo = bow_tval_ammo(o_ptr);
+ p_ptr->tval_ammo = (byte_hack)bow_tval_ammo(o_ptr);
/* Apply special flags */
if (o_ptr->k_idx && !p_ptr->heavy_shoot)
}
}
- if (p_ptr->ryoute)
- hold *= 2;
+ if (p_ptr->ryoute) hold *= 2;
for(i = 0 ; i < 2 ; i++)
{
p_ptr->num_blow[i] = blows_table[str_index][dex_index];
/* Maximal value */
- if (p_ptr->num_blow[i] > num) p_ptr->num_blow[i] = num;
+ if (p_ptr->num_blow[i] > num) p_ptr->num_blow[i] = (s16b)num;
/* Add in the "bonus blows" */
- p_ptr->num_blow[i] += extra_blows[i];
+ p_ptr->num_blow[i] += (s16b)extra_blows[i];
if (p_ptr->pclass == CLASS_WARRIOR) p_ptr->num_blow[i] += (p_ptr->lev / 40);
penalty += 30;
if (penalty < 30) penalty = 30;
}
- p_ptr->to_h[i] -= penalty;
- p_ptr->dis_to_h[i] -= penalty;
+ p_ptr->to_h[i] -= (s16b)penalty;
+ p_ptr->dis_to_h[i] -= (s16b)penalty;
/* Riding weapon */
p_ptr->riding_wield[i] = TRUE;
if (penalty < 30) penalty = 30;
}
if (p_ptr->tval_ammo == TV_BOLT) penalty *= 2;
- p_ptr->to_h_b -= penalty;
- p_ptr->dis_to_h_b -= penalty;
+ p_ptr->to_h_b -= (s16b)penalty;
+ p_ptr->dis_to_h_b -= (s16b)penalty;
}
/* Different calculation for monks with empty hands */
if (blow_base > 31) p_ptr->num_blow[0]++;
if (blow_base > 44) p_ptr->num_blow[0]++;
if (blow_base > 58) p_ptr->num_blow[0]++;
- if (p_ptr->magic_num1[0])
+ if (P_PTR_KI)
{
- p_ptr->to_d[0] += (p_ptr->magic_num1[0]/5);
- p_ptr->dis_to_d[0] += (p_ptr->magic_num1[0]/5);
+ p_ptr->to_d[0] += P_PTR_KI / 5;
+ p_ptr->dis_to_d[0] += P_PTR_KI / 5;
}
}
else
{
if (buki_motteruka(INVEN_RARM+i))
{
- int tval = inventory[INVEN_RARM+i].tval - TV_WEAPON_BEGIN;
- int sval = inventory[INVEN_RARM+i].sval;
+ OBJECT_TYPE_VALUE tval = inventory[INVEN_RARM+i].tval - TV_WEAPON_BEGIN;
+ OBJECT_SUBTYPE_VALUE sval = inventory[INVEN_RARM+i].sval;
p_ptr->to_h[i] += (p_ptr->weapon_exp[tval][sval] - WEAPON_EXP_BEGINNER) / 200;
p_ptr->dis_to_h[i] += (p_ptr->weapon_exp[tval][sval] - WEAPON_EXP_BEGINNER) / 200;
/* Take note when "heavy bow" changes */
if (p_ptr->old_heavy_shoot != p_ptr->heavy_shoot)
{
- /* Message */
if (p_ptr->heavy_shoot)
{
msg_print(_("こんな重い弓を装備しているのは大変だ。", "You have trouble wielding such a heavy bow."));
/* Take note when "heavy weapon" changes */
if (p_ptr->old_heavy_wield[i] != p_ptr->heavy_wield[i])
{
- /* Message */
if (p_ptr->heavy_wield[i])
{
msg_print(_("こんな重い武器を装備しているのは大変だ。", "You have trouble wielding such a heavy weapon."));
/* Take note when "heavy weapon" changes */
if (p_ptr->old_riding_wield[i] != p_ptr->riding_wield[i])
{
- /* Message */
if (p_ptr->riding_wield[i])
{
msg_print(_("この武器は乗馬中に使うにはむかないようだ。", "This weapon is not suitable for use while riding."));
/* Take note when "illegal weapon" changes */
if (p_ptr->old_icky_wield[i] != p_ptr->icky_wield[i])
{
- /* Message */
if (p_ptr->icky_wield[i])
{
msg_print(_("今の装備はどうも自分にふさわしくない気がする。", "You do not feel comfortable with your weapon."));
- if (hack_mind)
+ if (is_loading_now)
{
chg_virtue(V_FAITH, -1);
}
if (p_ptr->riding && (p_ptr->old_riding_ryoute != p_ptr->riding_ryoute))
{
- /* Message */
if (p_ptr->riding_ryoute)
{
#ifdef JP
if (heavy_armor())
{
msg_print(_("装備が重くてバランスを取れない。", "The weight of your armor disrupts your balance."));
- if (hack_mind)
+ if (is_loading_now)
{
chg_virtue(V_HARMONY, -1);
}
if ((inventory[i].tval == TV_NATURE_BOOK) && (inventory[i].sval == 2)) have_sw = TRUE;
if ((inventory[i].tval == TV_CRAFT_BOOK) && (inventory[i].sval == 2)) have_kabe = TRUE;
}
- for (this_o_idx = cave[py][px].o_idx; this_o_idx; this_o_idx = next_o_idx)
- {
- object_type *o_ptr;
+ for (this_o_idx = cave[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
+ {
/* Acquire object */
o_ptr = &o_list[this_o_idx];
-/*
- * Handle "p_ptr->notice"
+/*!
+ * @brief p_ptr->notice のフラグに応じた更新をまとめて行う / Handle "p_ptr->notice"
+ * @return なし
+ * @details 更新処理の対象はアイテムの自動破壊/アイテムの結合/アイテムの並び替え。
*/
void notice_stuff(void)
{
}
-/*
- * Handle "p_ptr->update"
+/*!
+ * @brief p_ptr->update のフラグに応じた更新をまとめて行う / Handle "p_ptr->update"
+ * @return なし
+ * @details 更新処理の対象はプレイヤーの能力修正/光源寿命/HP/MP/魔法の学習状態、他多数の外界の状態判定。
*/
void update_stuff(void)
{
}
-/*
- * Handle "p_ptr->redraw"
+/*!
+ * @brief p_ptr->redraw のフラグに応じた更新をまとめて行う / Handle "p_ptr->redraw"
+ * @return なし
+ * @details 更新処理の対象はゲーム中の全描画処理
*/
void redraw_stuff(void)
{
}
-/*
- * Handle "p_ptr->window"
+/*!
+ * @brief p_ptr->window のフラグに応じた更新をまとめて行う / Handle "p_ptr->window"
+ * @return なし
+ * @details 更新処理の対象はサブウィンドウ全般
*/
void window_stuff(void)
{
}
-/*
+/*!
+ * @brief 全更新処理をチェックして処理していく
* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window"
+ * @return なし
*/
void handle_stuff(void)
{
if (p_ptr->window) window_stuff();
}
-
+/*!
+ * @brief プレイヤーの現在開いている手の状態を返す
+ * @param riding_control 乗馬中により片手を必要としている状態ならばTRUEを返す。
+ * @return 開いている手のビットフラグ
+ */
s16b empty_hands(bool riding_control)
{
s16b status = EMPTY_HAND_NONE;
}
+/*!
+ * @brief プレイヤーが防具重量制限のある職業時にペナルティを受ける状態にあるかどうかを返す。
+ * @return ペナルティが適用されるならばTRUE。
+ */
bool heavy_armor(void)
{
- u16b monk_arm_wgt = 0;
+ WEIGHT monk_arm_wgt = 0;
if ((p_ptr->pclass != CLASS_MONK) && (p_ptr->pclass != CLASS_FORCETRAINER) && (p_ptr->pclass != CLASS_NINJA)) return FALSE;
return (monk_arm_wgt > (100 + (p_ptr->lev * 4)));
}
+/*!
+ * @brief 実ゲームプレイ時間を更新する
+ */
void update_playtime(void)
{
/* Check if the game has started */
if (start_time != 0)
{
- u32b tmp = time(NULL);
+ u32b tmp = (u32b)time(NULL);
playtime += (tmp - start_time);
start_time = tmp;
}