X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=src%2Fxtra2.c;h=2b46503fb1895ed49dd1f8751dc94a528a52a61a;hb=f3f34986b26c373491579443ce163995330a9b76;hp=f40f1f844e00137ebc0bf60e371417cc62a4bc02;hpb=ecd6cbce6eb5930b854fcfe3c2b181fe298ecf25;p=hengband%2Fhengband.git diff --git a/src/xtra2.c b/src/xtra2.c index f40f1f844..2b46503fb 100644 --- a/src/xtra2.c +++ b/src/xtra2.c @@ -12,6 +12,11 @@ #include "angband.h" +#include "cmd-pet.h" +#include "object-curse.h" +#include "monsterrace-hook.h" +#include "objectkind-hook.h" +#include "sort.h" #define REWARD_CHANCE 10 @@ -47,8 +52,6 @@ void check_experience(void) /* Redraw experience */ p_ptr->redraw |= (PR_EXP); - - /* Handle stuff */ handle_stuff(); @@ -58,17 +61,9 @@ void check_experience(void) { /* Lose a level */ p_ptr->lev--; - - /* Update some stuff */ p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS); - - /* Redraw some stuff */ p_ptr->redraw |= (PR_LEV | PR_TITLE); - - /* Window stuff */ p_ptr->window |= (PW_PLAYER); - - /* Handle stuff */ handle_stuff(); } @@ -99,30 +94,16 @@ void check_experience(void) do_cmd_write_nikki(NIKKI_LEVELUP, p_ptr->lev, NULL); } - /* Sound */ sound(SOUND_LEVEL); - /* Message */ -#ifdef JP -msg_format("ã¬ãã« %d ã«ããããã", p_ptr->lev); -#else - msg_format("Welcome to level %d.", p_ptr->lev); - -#endif + msg_format(_("ã¬ãã« %d ã«ããããã", "Welcome to level %d."), p_ptr->lev); - /* Update some stuff */ p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS); - - /* Redraw some stuff */ p_ptr->redraw |= (PR_LEV | PR_TITLE | PR_EXP); - - /* Window stuff */ p_ptr->window |= (PW_PLAYER | PW_SPELL | PW_INVEN); /* HPã¨MPã®ä¸æéã表示 */ level_up = 1; - - /* Handle stuff */ handle_stuff(); level_up = 0; @@ -138,43 +119,28 @@ msg_format("ã¬ãã« %d ã«ããããã", p_ptr->lev); int n; char tmp[32]; -#ifdef JP - cnv_stat(p_ptr->stat_max[0], tmp); - prt(format(" a) è å (ç¾å¨å¤ %s)", tmp), 2, 14); - cnv_stat(p_ptr->stat_max[1], tmp); - prt(format(" b) ç¥è½ (ç¾å¨å¤ %s)", tmp), 3, 14); - cnv_stat(p_ptr->stat_max[2], tmp); - prt(format(" c) è³¢ã (ç¾å¨å¤ %s)", tmp), 4, 14); - cnv_stat(p_ptr->stat_max[3], tmp); - prt(format(" d) å¨ç¨ (ç¾å¨å¤ %s)", tmp), 5, 14); - cnv_stat(p_ptr->stat_max[4], tmp); - prt(format(" e) èä¹ (ç¾å¨å¤ %s)", tmp), 6, 14); - cnv_stat(p_ptr->stat_max[5], tmp); - prt(format(" f) é å (ç¾å¨å¤ %s)", tmp), 7, 14); - prt("", 8, 14); - prt(" ã©ã®è½åå¤ãä¸ãã¾ããï¼", 1, 14); -#else cnv_stat(p_ptr->stat_max[0], tmp); - prt(format(" a) Str (cur %s)", tmp), 2, 14); + prt(format(_(" a) è å (ç¾å¨å¤ %s)", " a) Str (cur %s)"), tmp), 2, 14); cnv_stat(p_ptr->stat_max[1], tmp); - prt(format(" b) Int (cur %s)", tmp), 3, 14); + prt(format(_(" b) ç¥è½ (ç¾å¨å¤ %s)", " a) Int (cur %s)"), tmp), 3, 14); cnv_stat(p_ptr->stat_max[2], tmp); - prt(format(" c) Wis (cur %s)", tmp), 4, 14); + prt(format(_(" c) è³¢ã (ç¾å¨å¤ %s)", " a) Wis (cur %s)"), tmp), 4, 14); cnv_stat(p_ptr->stat_max[3], tmp); - prt(format(" d) Dex (cur %s)", tmp), 5, 14); + prt(format(_(" d) å¨ç¨ (ç¾å¨å¤ %s)", " a) Dex (cur %s)"), tmp), 5, 14); cnv_stat(p_ptr->stat_max[4], tmp); - prt(format(" e) Con (cur %s)", tmp), 6, 14); + prt(format(_(" e) èä¹ (ç¾å¨å¤ %s)", " a) Con (cur %s)"), tmp), 6, 14); cnv_stat(p_ptr->stat_max[5], tmp); - prt(format(" f) Chr (cur %s)", tmp), 7, 14); + prt(format(_(" f) é å (ç¾å¨å¤ %s)", " a) Chr (cur %s)"), tmp), 7, 14); + prt("", 8, 14); - prt(" Which stat do you want to raise?", 1, 14); -#endif + prt(_(" ã©ã®è½åå¤ãä¸ãã¾ããï¼", " Which stat do you want to raise?"), 1, 14); + while(1) { choice = inkey(); if ((choice >= 'a') && (choice <= 'f')) break; } - for(n = 0; n < 6; n++) + for(n = 0; n < A_MAX; n++) if (n != choice - 'a') prt("",n+2,14); if (get_check(_("ããããã§ããï¼", "Are you sure? "))) break; @@ -203,16 +169,9 @@ msg_format("ã¬ãã« %d ã«ããããã", p_ptr->lev); level_reward = FALSE; } - /* Update some stuff */ p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS); - - /* Redraw some stuff */ p_ptr->redraw |= (PR_LEV | PR_TITLE); - - /* Window stuff */ p_ptr->window |= (PW_PLAYER | PW_SPELL); - - /* Handle stuff */ handle_stuff(); } @@ -228,9 +187,9 @@ msg_format("ã¬ãã« %d ã«ããããã", p_ptr->lev); * @details * Hack -- Return the "automatic coin type" of a monster race * Used to allocate proper treasure when "Creeping coins" die - * XXX XXX XXX Note the use of actual "monster names" + * Note the use of actual "monster names" */ -static int get_coin_type(MONRACE_IDX r_idx) +static OBJECT_SUBTYPE_VALUE get_coin_type(MONRACE_IDX r_idx) { /* Analyze monsters */ switch (r_idx) @@ -248,158 +207,13 @@ static int get_coin_type(MONRACE_IDX r_idx) } -/*! - * @brief ãªãã¸ã§ã¯ããã¯ãã¼ã¯ãã©ãããå¤å®ãã / - * Hack -- determine if a template is Cloak - * @param k_idx å¤å®ããããªãã¸ã§ã¯ãã®ãã¼ã¹ã¢ã¤ãã ID - * @return ãªãã¸ã§ã¯ããã¯ãã¼ã¯ãªãã°TRUEãè¿ã - */ -static bool kind_is_cloak(KIND_OBJECT_IDX k_idx) -{ - object_kind *k_ptr = &k_info[k_idx]; - - /* Analyze the item type */ - if (k_ptr->tval == TV_CLOAK) - { - return (TRUE); - } - - /* Assume not good */ - return (FALSE); -} - - -/*! - * @brief ãªãã¸ã§ã¯ããç«¿ç¶æ¦å¨ãã©ãããå¤å®ãã / - * Hack -- determine if a template is Polearm - * @param k_idx å¤å®ããããªãã¸ã§ã¯ãã®ãã¼ã¹ã¢ã¤ãã ID - * @return ãªãã¸ã§ã¯ããç«¿ç¶æ¦å¨ãªãã°TRUEãè¿ã - */ -static bool kind_is_polearm(KIND_OBJECT_IDX k_idx) -{ - object_kind *k_ptr = &k_info[k_idx]; - - /* Analyze the item type */ - if (k_ptr->tval == TV_POLEARM) - { - return (TRUE); - } - - /* Assume not good */ - return (FALSE); -} - - -/*! - * @brief ãªãã¸ã§ã¯ããå£ãã©ãããå¤å®ãã / - * Hack -- determine if a template is Sword - * @param k_idx å¤å®ããããªãã¸ã§ã¯ãã®ãã¼ã¹ã¢ã¤ãã ID - * @return ãªãã¸ã§ã¯ããå£ãªãã°TRUEãè¿ã - */ -static bool kind_is_sword(KIND_OBJECT_IDX k_idx) -{ - object_kind *k_ptr = &k_info[k_idx]; - - /* Analyze the item type */ - if ((k_ptr->tval == TV_SWORD) && (k_ptr->sval > 2)) - { - return (TRUE); - } - - /* Assume not good */ - return (FALSE); -} - - -/*! - * @brief ãªãã¸ã§ã¯ããéæ³æ¸ãã©ãããå¤å®ãã / - * Hack -- determine if a template is Book - * @param k_idx å¤å®ããããªãã¸ã§ã¯ãã®ãã¼ã¹ã¢ã¤ãã ID - * @return ãªãã¸ã§ã¯ããéæ³æ¸ãªãã°TRUEãè¿ã - */ -static bool kind_is_book(KIND_OBJECT_IDX k_idx) -{ - object_kind *k_ptr = &k_info[k_idx]; - - /* Analyze the item type */ - if ((k_ptr->tval >= TV_LIFE_BOOK) && (k_ptr->tval <= TV_CRUSADE_BOOK)) - { - return (TRUE); - } - - /* Assume not good */ - return (FALSE); -} - - -/*! - * @brief ãªãã¸ã§ã¯ãããã¼ã¹ã¢ã¤ãã æç¹ã§GOODãã©ãããå¤å®ãã / - * Hack -- determine if a template is Good book - * @param k_idx å¤å®ããããªãã¸ã§ã¯ãã®ãã¼ã¹ã¢ã¤ãã ID - * @return ãªãã¸ã§ã¯ãããã¼ã¹ã¢ã¤ãã æç¹ã§GOODãªã¢ã¤ãã ãªãã°TRUEãè¿ã - */ -static bool kind_is_good_book(KIND_OBJECT_IDX k_idx) -{ - object_kind *k_ptr = &k_info[k_idx]; - - /* Analyze the item type */ - if ((k_ptr->tval >= TV_LIFE_BOOK) && (k_ptr->tval <= TV_CRUSADE_BOOK) && (k_ptr->tval != TV_ARCANE_BOOK) && (k_ptr->sval > 1)) - { - return (TRUE); - } - - /* Assume not good */ - return (FALSE); -} - - -/*! - * @brief ãªãã¸ã§ã¯ããé§ãã©ãããå¤å®ãã / - * Hack -- determine if a template is Armor - * @param k_idx å¤å®ããããªãã¸ã§ã¯ãã®ãã¼ã¹ã¢ã¤ãã ID - * @return ãªãã¸ã§ã¯ããé§ãªãã°TRUEãè¿ã - */ -static bool kind_is_armor(KIND_OBJECT_IDX k_idx) -{ - object_kind *k_ptr = &k_info[k_idx]; - - /* Analyze the item type */ - if (k_ptr->tval == TV_HARD_ARMOR) - { - return (TRUE); - } - - /* Assume not good */ - return (FALSE); -} - - -/*! - * @brief ãªãã¸ã§ã¯ããæææ¦å¨ãã©ãããå¤å®ãã / - * Hack -- determine if a template is hafted weapon - * @param k_idx å¤å®ããããªãã¸ã§ã¯ãã®ãã¼ã¹ã¢ã¤ãã ID - * @return ãªãã¸ã§ã¯ããæææ¦å¨ãªãã°TRUEãè¿ã - */ -static bool kind_is_hafted(KIND_OBJECT_IDX k_idx) -{ - object_kind *k_ptr = &k_info[k_idx]; - - /* Analyze the item type */ - if (k_ptr->tval == TV_HAFTED) - { - return (TRUE); - } - - /* Assume not good */ - return (FALSE); -} /*! * @brief ã¯ã¨ã¹ããéæç¶æ ã«ãã / * @param quest_num éæç¶æ ã«ãããã¯ã¨ã¹ãã®ID * @return ãªã */ -void complete_quest(int quest_num) +void complete_quest(QUEST_IDX quest_num) { quest_type* const q_ptr = &quest[quest_num]; @@ -430,10 +244,10 @@ void complete_quest(int quest_num) * @brief ç¾å¨ããã¢ã«æ®ã£ã¦ããæµã¢ã³ã¹ã¿ã¼ã®æ°ãè¿ã / * @return ç¾å¨ã®æµã¢ã³ã¹ã¿ã¼ã®æ° */ -static int count_all_hostile_monsters(void) +static MONSTER_NUMBER count_all_hostile_monsters(void) { - int x, y; - int number_mon = 0; + POSITION x, y; + MONSTER_NUMBER number_mon = 0; for (x = 0; x < cur_wid; ++ x) { @@ -443,7 +257,7 @@ static int count_all_hostile_monsters(void) if (m_idx > 0 && is_hostile(&m_list[m_idx])) { - ++ number_mon; + ++number_mon; } } } @@ -460,8 +274,7 @@ static int count_all_hostile_monsters(void) void check_quest_completion(monster_type *m_ptr) { POSITION y, x; - - int quest_num; + QUEST_IDX quest_num; bool create_stairs = FALSE; bool reward = FALSE; @@ -469,19 +282,18 @@ void check_quest_completion(monster_type *m_ptr) object_type forge; object_type *o_ptr; - /* Get the location */ y = m_ptr->fy; x = m_ptr->fx; /* Inside a quest */ - quest_num = p_ptr->inside_quest; + quest_num = p_ptr->inside_quest; /* Search for an active quest on this dungeon level */ if (!quest_num) { - int i; + QUEST_IDX i; - for (i = max_quests - 1; i > 0; i--) + for (i = max_q_idx - 1; i > 0; i--) { quest_type* const q_ptr = &quest[i]; @@ -655,16 +467,11 @@ void check_quest_completion(monster_type *m_ptr) for (i = 0; i < (dun_level / 15)+1; i++) { - /* Get local object */ o_ptr = &forge; - - /* Wipe the object */ object_wipe(o_ptr); /* Make a great object */ make_object(o_ptr, AM_GOOD | AM_GREAT); - - /* Drop it in the dungeon */ (void)drop_near(o_ptr, -1, y, x); } } @@ -678,13 +485,13 @@ void check_quest_completion(monster_type *m_ptr) */ void check_find_art_quest_completion(object_type *o_ptr) { - int i; + QUEST_IDX i; /* Check if completed a quest */ - for (i = 0; i < max_quests; i++) + for (i = 0; i < max_q_idx; i++) { - if ((quest[i].type == QUEST_TYPE_FIND_ARTIFACT) && - (quest[i].status == QUEST_STATUS_TAKEN) && - (quest[i].k_idx == o_ptr->name1)) + if((quest[i].type == QUEST_TYPE_FIND_ARTIFACT) && + (quest[i].status == QUEST_STATUS_TAKEN) && + (quest[i].k_idx == o_ptr->name1)) { complete_quest(i); } @@ -698,10 +505,11 @@ void check_find_art_quest_completion(object_type *o_ptr) * @param r_ptr æç ´ãããã¢ã³ã¹ã¿ã¼ã®ç¨®ææ å ±ãæã¤æ§é ä½ã®åç §ãã¤ã³ã¿ * @return æç ´ãããã¢ã³ã¹ã¿ã¼ã®è¿°èª */ -cptr extract_note_dies(monster_race *r_ptr) +cptr extract_note_dies(MONRACE_IDX r_idx) { + monster_race *r_ptr = &r_info[r_idx]; /* Some monsters get "destroyed" */ - if (!monster_living(r_ptr)) + if (!monster_living(r_idx)) { int i; @@ -739,15 +547,14 @@ cptr extract_note_dies(monster_race *r_ptr) */ void monster_death(MONSTER_IDX m_idx, bool drop_item) { - int i, j, y, x; + int i, j; + POSITION y, x; int dump_item = 0; int dump_gold = 0; - int number = 0; monster_type *m_ptr = &m_list[m_idx]; - monster_race *r_ptr = &r_info[m_ptr->r_idx]; bool visible = ((m_ptr->ml && !p_ptr->image) || (r_ptr->flags1 & RF1_UNIQUE)); @@ -775,13 +582,12 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item) p_ptr->update |= (PU_MON_LITE); } - /* Get the location */ y = m_ptr->fy; x = m_ptr->fx; if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname) { - char m_name[80]; + GAME_TEXT m_name[MAX_NLEN]; monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE); do_cmd_write_nikki(NIKKI_NAMED_PET, 3, m_name); @@ -793,7 +599,7 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item) if (r_ptr->blow[i].method == RBM_EXPLODE) { BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL; - int typ = mbe_info[r_ptr->blow[i].effect].explode_type; + EFFECT_ID typ = mbe_info[r_ptr->blow[i].effect].explode_type; DICE_NUMBER d_dice = r_ptr->blow[i].d_dice; DICE_SID d_side = r_ptr->blow[i].d_side; HIT_POINT damage = damroll(d_dice, d_side); @@ -828,15 +634,11 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item) if (arena_info[p_ptr->arena_number].tval) { - /* Get local object */ q_ptr = &forge; /* Prepare to make a prize */ object_prep(q_ptr, lookup_kind(arena_info[p_ptr->arena_number].tval, arena_info[p_ptr->arena_number].sval)); - apply_magic(q_ptr, object_level, AM_NO_FIXED_ART); - - /* Drop it in the dungeon */ (void)drop_near(q_ptr, -1, y, x); } @@ -844,7 +646,7 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item) p_ptr->arena_number++; if (record_arena) { - char m_name[80]; + GAME_TEXT m_name[MAX_NLEN]; /* Extract monster name */ monster_desc(m_name, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE); @@ -891,8 +693,6 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item) if (!one_in_(5)) corpse = TRUE; } } - - /* Get local object */ q_ptr = &forge; /* Prepare to make an object */ @@ -901,8 +701,6 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item) apply_magic(q_ptr, object_level, AM_NO_FIXED_ART); q_ptr->pval = m_ptr->r_idx; - - /* Drop it in the dungeon */ (void)drop_near(q_ptr, -1, y, x); } @@ -922,21 +720,19 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item) for (i = 0; i < 2; i++) { - int wy = y, wx = x; + POSITION wy = y, wx = x; bool pet = is_pet(m_ptr); BIT_FLAGS mode = 0L; if (pet) mode |= PM_FORCE_PET; - if (summon_specific((pet ? -1 : m_idx), wy, wx, 100, SUMMON_BLUE_HORROR, mode)) + if (summon_specific((pet ? -1 : m_idx), wy, wx, 100, SUMMON_BLUE_HORROR, mode, '\0')) { - if (player_can_see_bold(wy, wx)) - notice = TRUE; + if (player_can_see_bold(wy, wx)) notice = TRUE; } } - if (notice) - msg_print(_("ãã³ã¯ã»ãã©ã¼ã¯åè£ããï¼", "The Pink horror divides!")); + if (notice) msg_print(_("ãã³ã¯ã»ãã©ã¼ã¯åè£ããï¼", "The Pink horror divides!")); } break; @@ -944,15 +740,12 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item) /* Bloodletters of Khorne may drop a blade of chaos */ if (drop_chosen_item && (randint1(100) < 15)) { - /* Get local object */ q_ptr = &forge; /* Prepare to make a Blade of Chaos */ object_prep(q_ptr, lookup_kind(TV_SWORD, SV_BLADE_OF_CHAOS)); apply_magic(q_ptr, object_level, AM_NO_FIXED_ART | mo_mode); - - /* Drop it in the dungeon */ (void)drop_near(q_ptr, -1, y, x); } break; @@ -960,10 +753,7 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item) case MON_RAAL: if (drop_chosen_item && (dun_level > 9)) { - /* Get local object */ q_ptr = &forge; - - /* Wipe the object */ object_wipe(q_ptr); /* Activate restriction */ @@ -974,8 +764,6 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item) /* Make a book */ make_object(q_ptr, mo_mode); - - /* Drop it in the dungeon */ (void)drop_near(q_ptr, -1, y, x); } break; @@ -1004,7 +792,7 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item) BIT_FLAGS mode = 0L; if (pet) mode |= PM_FORCE_PET; - if (summon_specific((pet ? -1 : m_idx), wy, wx, 100, SUMMON_DAWN, mode)) + if (summon_specific((pet ? -1 : m_idx), wy, wx, 100, SUMMON_DAWN, mode, '\0')) { if (player_can_see_bold(wy, wx)) msg_print(_("æ°ããªæ¦å£«ãç¾ããï¼", "A new warrior steps forth!")); @@ -1028,7 +816,7 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item) /* Reward for "lazy" player */ if (p_ptr->pseikaku == SEIKAKU_NAMAKE) { - int a_idx = 0; + ARTIFACT_IDX a_idx = 0; artifact_type *a_ptr = NULL; if (!drop_chosen_item) break; @@ -1066,8 +854,6 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item) case MON_SERPENT: if (!drop_chosen_item) break; - - /* Get local object */ q_ptr = &forge; /* Mega-Hack -- Prepare to make "Grond" */ @@ -1078,11 +864,7 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item) /* Mega-Hack -- Actually create "Grond" */ apply_magic(q_ptr, -1, AM_GOOD | AM_GREAT); - - /* Drop it in the dungeon */ (void)drop_near(q_ptr, -1, y, x); - - /* Get local object */ q_ptr = &forge; /* Mega-Hack -- Prepare to make "Chaos" */ @@ -1093,21 +875,16 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item) /* Mega-Hack -- Actually create "Chaos" */ apply_magic(q_ptr, -1, AM_GOOD | AM_GREAT); - - /* Drop it in the dungeon */ (void)drop_near(q_ptr, -1, y, x); break; case MON_B_DEATH_SWORD: if (drop_chosen_item) { - /* Get local object */ q_ptr = &forge; /* Prepare to make a broken sword */ object_prep(q_ptr, lookup_kind(TV_SWORD, randint1(2))); - - /* Drop it in the dungeon */ (void)drop_near(q_ptr, -1, y, x); } break; @@ -1117,15 +894,12 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item) if (drop_chosen_item && ((m_ptr->r_idx == MON_A_GOLD) || ((m_ptr->r_idx == MON_A_SILVER) && (r_ptr->r_akills % 5 == 0)))) { - /* Get local object */ q_ptr = &forge; /* Prepare to make a Can of Toys */ object_prep(q_ptr, lookup_kind(TV_CHEST, SV_CHEST_KANDUME)); apply_magic(q_ptr, object_level, AM_NO_FIXED_ART); - - /* Drop it in the dungeon */ (void)drop_near(q_ptr, -1, y, x); } break; @@ -1145,10 +919,7 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item) case '(': if (dun_level > 0) { - /* Get local object */ q_ptr = &forge; - - /* Wipe the object */ object_wipe(q_ptr); /* Activate restriction */ @@ -1156,8 +927,6 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item) /* Make a cloak */ make_object(q_ptr, mo_mode); - - /* Drop it in the dungeon */ (void)drop_near(q_ptr, -1, y, x); } break; @@ -1165,10 +934,7 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item) case '/': if (dun_level > 4) { - /* Get local object */ q_ptr = &forge; - - /* Wipe the object */ object_wipe(q_ptr); /* Activate restriction */ @@ -1176,8 +942,6 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item) /* Make a poleweapon */ make_object(q_ptr, mo_mode); - - /* Drop it in the dungeon */ (void)drop_near(q_ptr, -1, y, x); } break; @@ -1185,10 +949,7 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item) case '[': if (dun_level > 19) { - /* Get local object */ q_ptr = &forge; - - /* Wipe the object */ object_wipe(q_ptr); /* Activate restriction */ @@ -1196,8 +957,6 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item) /* Make a hard armor */ make_object(q_ptr, mo_mode); - - /* Drop it in the dungeon */ (void)drop_near(q_ptr, -1, y, x); } break; @@ -1205,10 +964,7 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item) case '\\': if (dun_level > 4) { - /* Get local object */ q_ptr = &forge; - - /* Wipe the object */ object_wipe(q_ptr); /* Activate restriction */ @@ -1216,8 +972,6 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item) /* Make a hafted weapon */ make_object(q_ptr, mo_mode); - - /* Drop it in the dungeon */ (void)drop_near(q_ptr, -1, y, x); } break; @@ -1225,10 +979,7 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item) case '|': if (m_ptr->r_idx != MON_STORMBRINGER) { - /* Get local object */ q_ptr = &forge; - - /* Wipe the object */ object_wipe(q_ptr); /* Activate restriction */ @@ -1236,8 +987,6 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item) /* Make a sword */ make_object(q_ptr, mo_mode); - - /* Drop it in the dungeon */ (void)drop_near(q_ptr, -1, y, x); } break; @@ -1248,7 +997,7 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item) /* Mega-Hack -- drop fixed items */ if (drop_chosen_item) { - int a_idx = 0; + ARTIFACT_IDX a_idx = 0; int chance = 0; for(i = 0; i < 4; i++) @@ -1278,7 +1027,7 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item) if ((r_ptr->flags7 & RF7_GUARDIAN) && (d_info[dungeon_type].final_guardian == m_ptr->r_idx)) { - IDX k_idx = d_info[dungeon_type].final_object ? d_info[dungeon_type].final_object + KIND_OBJECT_IDX k_idx = d_info[dungeon_type].final_object ? d_info[dungeon_type].final_object : lookup_kind(TV_SCROLL, SV_SCROLL_ACQUIREMENT); if (d_info[dungeon_type].final_artifact) @@ -1305,15 +1054,12 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item) if (k_idx) { - /* Get local object */ q_ptr = &forge; /* Prepare to make a reward */ object_prep(q_ptr, k_idx); apply_magic(q_ptr, object_level, AM_NO_FIXED_ART | AM_GOOD); - - /* Drop it in the dungeon */ (void)drop_near(q_ptr, -1, y, x); } msg_format(_("ããªãã¯%sãå¶è¦ããï¼", "You have conquered %s!"),d_name+d_info[dungeon_type].name); @@ -1347,10 +1093,7 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item) /* Drop some objects */ for (j = 0; j < number; j++) { - /* Get local object */ q_ptr = &forge; - - /* Wipe the object */ object_wipe(q_ptr); /* Make Gold */ @@ -1359,7 +1102,6 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item) /* Make some gold */ if (!make_gold(q_ptr)) continue; - /* XXX XXX XXX */ dump_gold++; } @@ -1369,11 +1111,8 @@ void monster_death(MONSTER_IDX m_idx, bool drop_item) /* Make an object */ if (!make_object(q_ptr, mo_mode)) continue; - /* XXX XXX XXX */ dump_item++; } - - /* Drop it in the dungeon */ (void)drop_near(q_ptr, -1, y, x); } @@ -1527,7 +1266,7 @@ static void get_exp_from_mon(HIT_POINT dam, monster_type *m_ptr) } /* Special penalty for rest_and_shoot exp scum */ - if ((m_ptr->dealt_damage > (u32b)m_ptr->max_maxhp) && (m_ptr->hp >= 0)) + if ((m_ptr->dealt_damage > m_ptr->max_maxhp) && (m_ptr->hp >= 0)) { int over_damage = m_ptr->dealt_damage / m_ptr->max_maxhp; if (over_damage > 32) over_damage = 32; @@ -1570,7 +1309,7 @@ static void get_exp_from_mon(HIT_POINT dam, monster_type *m_ptr) * Made name, sex, and capitalization generic -BEN- * As always, the "ghost" processing is a total hack. * Hack -- we "delay" fear messages by passing around a "fear" flag. - * XXX XXX XXX Consider decreasing monster experience over time, say, + * Consider decreasing monster experience over time, say, * by using "(m_exp * m_lev * (m_lev)) / (p_lev * (m_lev + n_killed))" * instead of simply "(m_exp * m_lev) / (p_lev)", to make the first * monster worth more than subsequent monsters. This would also need @@ -1579,16 +1318,14 @@ static void get_exp_from_mon(HIT_POINT dam, monster_type *m_ptr) */ bool mon_take_hit(MONSTER_IDX m_idx, HIT_POINT dam, bool *fear, cptr note) { - monster_type *m_ptr = &m_list[m_idx]; - monster_race *r_ptr = &r_info[m_ptr->r_idx]; - - monster_type exp_mon; + monster_type *m_ptr = &m_list[m_idx]; + monster_race *r_ptr = &r_info[m_ptr->r_idx]; + monster_type exp_mon; /* Innocent until proven otherwise */ - bool innocent = TRUE, thief = FALSE; - int i; - int expdam; - int dealt_damage; + bool innocent = TRUE, thief = FALSE; + int i; + HIT_POINT expdam; (void)COPY(&exp_mon, m_ptr, monster_type); @@ -1603,7 +1340,6 @@ bool mon_take_hit(MONSTER_IDX m_idx, HIT_POINT dam, bool *fear, cptr note) if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH); if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH); - /* Wake it up */ (void)set_monster_csleep(m_idx, 0); /* Hack - Cancel any special player stealth magics. -LM- */ @@ -1615,24 +1351,20 @@ bool mon_take_hit(MONSTER_IDX m_idx, HIT_POINT dam, bool *fear, cptr note) /* Genocided by chaos patron */ if (!m_idx) return TRUE; - /* Remember dealt_damage before this attack*/ - dealt_damage = m_ptr->dealt_damage; - - /* Hurt it */ m_ptr->hp -= dam; - m_ptr->dealt_damage += dam; - if(m_ptr->dealt_damage > (u32b)m_ptr->max_maxhp * 100) m_ptr->dealt_damage = m_ptr->max_maxhp * 100; + + if(m_ptr->dealt_damage > m_ptr->max_maxhp * 100) m_ptr->dealt_damage = m_ptr->max_maxhp * 100; + if (p_ptr->wizard) { - msg_format( _("åè¨%d/%dã®ãã¡ã¼ã¸ãä¸ããã","You do %d (out of %d) damage."), - m_ptr->dealt_damage, m_ptr->maxhp); + msg_format( _("åè¨%d/%dã®ãã¡ã¼ã¸ãä¸ããã","You do %d (out of %d) damage."), m_ptr->dealt_damage, m_ptr->maxhp); } /* It is dead now */ if (m_ptr->hp < 0) { - char m_name[80]; + GAME_TEXT m_name[MAX_NLEN]; if (r_info[m_ptr->r_idx].flags7 & RF7_TANUKI) { @@ -1722,16 +1454,14 @@ bool mon_take_hit(MONSTER_IDX m_idx, HIT_POINT dam, bool *fear, cptr note) if (r_ptr->flags2 & RF2_CAN_SPEAK) { char line_got[1024]; - - /* Dump a message */ if (!get_rnd_line(_("mondeath_j.txt", "mondeath.txt"), m_ptr->r_idx, line_got)) - + { msg_format("%^s %s", m_name, line_got); + } #ifdef WORLD_SCORE if (m_ptr->r_idx == MON_SERPENT) { - /* Make screen dump */ screen_dump = make_screen_dump(); } #endif @@ -1774,8 +1504,7 @@ bool mon_take_hit(MONSTER_IDX m_idx, HIT_POINT dam, bool *fear, cptr note) chg_virtue(V_COMPASSION, -1); } - if ((r_ptr->flags3 & RF3_GOOD) && - ((r_ptr->level) / 10 + (3 * dun_level) >= randint1(100))) + if ((r_ptr->flags3 & RF3_GOOD) && ((r_ptr->level) / 10 + (3 * dun_level) >= randint1(100))) chg_virtue(V_UNLIFE, 1); if (r_ptr->d_char == 'A') @@ -1832,8 +1561,7 @@ bool mon_take_hit(MONSTER_IDX m_idx, HIT_POINT dam, bool *fear, cptr note) { if (r_ptr->flags1 & RF1_UNIQUE) chg_virtue(V_JUSTICE, 3); - else if (1+((r_ptr->level) / 10 + (2 * dun_level)) - >= randint1(100)) + else if (1+((r_ptr->level) / 10 + (2 * dun_level)) >= randint1(100)) chg_virtue(V_JUSTICE, 1); } else if (innocent) @@ -1849,11 +1577,7 @@ bool mon_take_hit(MONSTER_IDX m_idx, HIT_POINT dam, bool *fear, cptr note) if ((r_ptr->flags1 & RF1_UNIQUE) && record_destroy_uniq) { char note_buf[160]; -#ifdef JP - sprintf(note_buf, "%s%s", r_name + r_ptr->name, (m_ptr->smart & SM_CLONED) ? "(ã¯ãã¼ã³)" : ""); -#else - sprintf(note_buf, "%s%s", r_name + r_ptr->name, (m_ptr->smart & SM_CLONED) ? "(Clone)" : ""); -#endif + sprintf(note_buf, "%s%s", r_name + r_ptr->name, (m_ptr->smart & SM_CLONED) ? _("(ã¯ãã¼ã³)", "(Clone)") : ""); do_cmd_write_nikki(NIKKI_UNIQUE, 0, note_buf); } @@ -1881,7 +1605,7 @@ bool mon_take_hit(MONSTER_IDX m_idx, HIT_POINT dam, bool *fear, cptr note) } /* Death by Physical attack -- non-living monster */ - else if (!monster_living(r_ptr)) + else if (!monster_living(m_ptr->r_idx)) { bool explode = FALSE; @@ -1899,7 +1623,7 @@ bool mon_take_hit(MONSTER_IDX m_idx, HIT_POINT dam, bool *fear, cptr note) if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON)) msg_format("ãã£ããã ãã%sãåããã", m_name); else -msg_format("%sãåããã", m_name); + msg_format("%sãåããã", m_name); #else msg_format("You have destroyed %s.", m_name); #endif @@ -1913,7 +1637,7 @@ msg_format("%sãåããã", m_name); if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON)) msg_format("ãã£ããã ãã%sãè¬ãå»ã£ãã", m_name); else -msg_format("%sãè¬ãå»ã£ãã", m_name); + msg_format("%sãè¬ãå»ã£ãã", m_name); #else msg_format("You have slain %s.", m_name); #endif @@ -1935,18 +1659,13 @@ msg_format("%sãè¬ãå»ã£ãã", m_name); monster_death(m_idx, TRUE); /* Mega hack : replace IKETA to BIKETAL */ - if ((m_ptr->r_idx == MON_IKETA) && - !(p_ptr->inside_arena || p_ptr->inside_battle)) + if ((m_ptr->r_idx == MON_IKETA) && !(p_ptr->inside_arena || p_ptr->inside_battle)) { - int dummy_y = m_ptr->fy; - int dummy_x = m_ptr->fx; + POSITION dummy_y = m_ptr->fy; + POSITION dummy_x = m_ptr->fx; BIT_FLAGS mode = 0L; - if (is_pet(m_ptr)) mode |= PM_FORCE_PET; - - /* Delete the monster */ delete_monster_idx(m_idx); - if (summon_named_creature(0, dummy_y, dummy_x, MON_BIKETAL, mode)) { msg_print(_("ããã¡ããããããï¼ï¼ç§ããã¤ã±ã¿ã«ã ï¼ï¼ã", "Uwa-hahaha! *I* am Biketal!")); @@ -1954,7 +1673,6 @@ msg_format("%sãè¬ãå»ã£ãã", m_name); } else { - /* Delete the monster */ delete_monster_idx(m_idx); } @@ -1991,13 +1709,12 @@ msg_format("%sãè¬ãå»ã£ãã", m_name); * Run (sometimes) if at 10% or less of max hit points, * or (usually) when hit for half its current hit points */ - if ((randint1(10) >= percentage) || - ((dam >= m_ptr->hp) && (randint0(100) < 80))) + if ((randint1(10) >= percentage) || ((dam >= m_ptr->hp) && (randint0(100) < 80))) { /* Hack -- note fear */ (*fear) = TRUE; - /* XXX XXX XXX Hack -- Add some timed fear */ + /* Hack -- Add some timed fear */ (void)set_monster_monfear(m_idx, (randint1(10) + (((dam >= m_ptr->hp) && (percentage > 7)) ? 20 : ((11 - percentage) * 5)))); @@ -2006,22 +1723,6 @@ msg_format("%sãè¬ãå»ã£ãã", m_name); #endif -#if 0 - if (p_ptr->riding && (p_ptr->riding == m_idx) && (dam > 0)) - { - char m_name[80]; - - /* Extract monster name */ - monster_desc(m_name, m_ptr, 0); - - if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2; - if (rakuba((dam > 200) ? 200 : dam, FALSE)) - { - msg_format(_("%^sã«æ¯ãè½ã¨ãããï¼", "%^s has thrown you off!"), m_name); - } - } -#endif - /* Not dead yet */ return (FALSE); } @@ -2034,7 +1735,7 @@ msg_format("%sãè¬ãå»ã£ãã", m_name); * @param hgt_p ã³ã³ã½ã¼ã«ã®è¡¨ç¤ºè¡æ°ãè¿ã * @return ãªã */ -void get_screen_size(int *wid_p, int *hgt_p) +void get_screen_size(TERM_LEN *wid_p, TERM_LEN *hgt_p) { Term_get_size(wid_p, hgt_p); *hgt_p -= ROW_MAP + 2; @@ -2050,9 +1751,8 @@ void get_screen_size(int *wid_p, int *hgt_p) */ void panel_bounds_center(void) { - int wid, hgt; + TERM_LEN wid, hgt; - /* Get size */ get_screen_size(&wid, &hgt); panel_row_max = panel_row_min + hgt - 1; @@ -2082,25 +1782,13 @@ void resize_map(void) verify_panel(); - /* Update stuff */ p_ptr->update |= (PU_TORCH | PU_BONUS | PU_HP | PU_MANA | PU_SPELLS); - - /* Forget lite/view */ p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE); - - /* Update lite/view */ p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE); - - /* Update monsters */ p_ptr->update |= (PU_MONSTERS); - - /* Redraw everything */ p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY); - /* Hack -- update */ handle_stuff(); - - /* Redraw */ Term_redraw(); /* @@ -2109,7 +1797,6 @@ void resize_map(void) */ if (can_save) move_cursor_relative(p_ptr->y, p_ptr->x); - /* Refresh */ Term_fresh(); } @@ -2123,16 +1810,10 @@ void redraw_window(void) /* Only if the dungeon exists */ if (!character_dungeon) return; - /* Window stuff */ p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER); - - /* Window stuff */ p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT); - /* Hack -- update */ handle_stuff(); - - /* Redraw */ Term_redraw(); } @@ -2146,12 +1827,11 @@ void redraw_window(void) * Also used in do_cmd_locate * @return å®éã«åæç»ãå¿ è¦ã ã£ãå ´åTRUEãè¿ã */ -bool change_panel(int dy, int dx) +bool change_panel(POSITION dy, POSITION dx) { - int y, x; - int wid, hgt; + POSITION y, x; + TERM_LEN wid, hgt; - /* Get size */ get_screen_size(&wid, &hgt); /* Apply the motion */ @@ -2176,13 +1856,8 @@ bool change_panel(int dy, int dx) /* Recalculate the boundaries */ panel_bounds_center(); - /* Update stuff */ p_ptr->update |= (PU_MONSTERS); - - /* Redraw map */ p_ptr->redraw |= (PR_MAP); - - /* Handle stuff */ handle_stuff(); /* Success */ @@ -2203,12 +1878,11 @@ bool change_panel(int dy, int dx) * Also used in do_cmd_locate * @return å®éã«åæç»ãå¿ è¦ã ã£ãå ´åTRUEãè¿ã */ -bool change_panel_xy(int y, int x) +static bool change_panel_xy(POSITION y, POSITION x) { - int dy = 0, dx = 0; - int wid, hgt; + POSITION dy = 0, dx = 0; + TERM_LEN wid, hgt; - /* Get size */ get_screen_size(&wid, &hgt); if (y < panel_row_min) dy = -1; @@ -2233,16 +1907,15 @@ bool change_panel_xy(int y, int x) */ void verify_panel(void) { - int y = p_ptr->y; - int x = p_ptr->x; - int wid, hgt; + POSITION y = p_ptr->y; + POSITION x = p_ptr->x; + TERM_LEN wid, hgt; int prow_min; int pcol_min; int max_prow_min; int max_pcol_min; - /* Get size */ get_screen_size(&wid, &hgt); max_prow_min = cur_hgt - hgt; @@ -2319,18 +1992,13 @@ void verify_panel(void) panel_col_min = pcol_min; /* Hack -- optional disturb on "panel change" */ - if (disturb_panel && !center_player) disturb(0, 0); + if (disturb_panel && !center_player) disturb(FALSE, FALSE); /* Recalculate the boundaries */ panel_bounds_center(); - /* Update stuff */ p_ptr->update |= (PU_MONSTERS); - - /* Redraw map */ p_ptr->redraw |= (PR_MAP); - - /* Window stuff */ p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON); } @@ -2341,70 +2009,44 @@ void verify_panel(void) cptr look_mon_desc(monster_type *m_ptr, BIT_FLAGS mode) { monster_race *ap_r_ptr = &r_info[m_ptr->ap_r_idx]; - bool living; - int perc; + bool living; + int perc; cptr desc; cptr attitude; cptr clone; /* Determine if the monster is "living" */ - living = monster_living(ap_r_ptr); + living = monster_living(m_ptr->ap_r_idx); /* Calculate a health "percentage" */ - perc = 100L * m_ptr->hp / m_ptr->maxhp; + perc = m_ptr->maxhp > 0 ? 100L * m_ptr->hp / m_ptr->maxhp : 0; /* Healthy monsters */ if (m_ptr->hp >= m_ptr->maxhp) { - /* No damage */ -#ifdef JP - desc = living ? "ç¡å·" : "ç¡ãã¡ã¼ã¸"; -#else - desc = living ? "unhurt" : "undamaged"; -#endif - + desc = living ? _("ç¡å·", "unhurt") : _("ç¡ãã¡ã¼ã¸", "undamaged"); } else if (perc >= 60) { -#ifdef JP - desc = living ? "軽å·" : "å°ãã¡ã¼ã¸"; -#else - desc = living ? "somewhat wounded" : "somewhat damaged"; -#endif - + desc = living ? _("軽å·", "somewhat wounded") : _("å°ãã¡ã¼ã¸", "somewhat damaged"); } else if (perc >= 25) { -#ifdef JP - desc = living ? "è² å·" : "ä¸ãã¡ã¼ã¸"; -#else - desc = living ? "wounded" : "damaged"; -#endif - + desc = living ? _("è² å·", "wounded") : _("ä¸ãã¡ã¼ã¸", "damaged"); } else if (perc >= 10) { -#ifdef JP - desc = living ? "éå·" : "大ãã¡ã¼ã¸"; -#else - desc = living ? "badly wounded" : "badly damaged"; -#endif - + desc = living ? _("éå·", "badly wounded") : _("大ãã¡ã¼ã¸", "badly damaged"); } else { -#ifdef JP - desc = living ? "åæ»åç" : "åããã"; -#else - desc = living ? "almost dead" : "almost destroyed"; -#endif + desc = living ? _("åæ»åç", "almost dead") : _("åããã", "almost destroyed"); } - /* Need attitude information? */ if (!(mode & 0x01)) { @@ -2424,7 +2066,6 @@ cptr look_mon_desc(monster_type *m_ptr, BIT_FLAGS mode) attitude = _("", ""); } - /* Clone monster? */ if (m_ptr->smart & SM_CLONED) { @@ -2444,71 +2085,7 @@ cptr look_mon_desc(monster_type *m_ptr, BIT_FLAGS mode) { return format(_("ã¬ãã«???, %s%s%s", "Level ???, %s%s%s"), desc, attitude, clone); } -} - - - -/* - * Angband sorting algorithm -- quick sort in place - * - * Note that the details of the data we are sorting is hidden, - * and we rely on the "ang_sort_comp()" and "ang_sort_swap()" - * function hooks to interact with the data, which is given as - * two pointers, and which may have any user-defined form. - */ -void ang_sort_aux(vptr u, vptr v, int p, int q) -{ - int z, a, b; - - /* Done sort */ - if (p >= q) return; - - /* Pivot */ - z = p; - - /* Begin */ - a = p; - b = q; - - /* Partition */ - while (TRUE) - { - /* Slide i2 */ - while (!(*ang_sort_comp)(u, v, b, z)) b--; - - /* Slide i1 */ - while (!(*ang_sort_comp)(u, v, z, a)) a++; - - /* Done partition */ - if (a >= b) break; - - /* Swap */ - (*ang_sort_swap)(u, v, a, b); - - /* Advance */ - a++, b--; - } - - /* Recurse left side */ - ang_sort_aux(u, v, p, b); - - /* Recurse right side */ - ang_sort_aux(u, v, b+1, q); -} - -/* - * Angband sorting algorithm -- quick sort in place - * - * Note that the details of the data we are sorting is hidden, - * and we rely on the "ang_sort_comp()" and "ang_sort_swap()" - * function hooks to interact with the data, which is given as - * two pointers, and which may have any user-defined form. - */ -void ang_sort(vptr u, vptr v, int n) -{ - /* Sort the array */ - ang_sort_aux(u, v, 0, n-1); } @@ -2548,7 +2125,7 @@ bool target_able(MONSTER_IDX m_idx) /* Monster must be projectable */ if (!projectable(p_ptr->y, p_ptr->x, m_ptr->fy, m_ptr->fx)) return (FALSE); - /* XXX XXX XXX Hack -- Never target trappers */ + /* Hack -- Never target trappers */ /* if (CLEAR_ATTR && (CLEAR_CHAR)) return (FALSE); */ /* Assume okay */ @@ -2720,13 +2297,11 @@ static void ang_sort_swap_distance(vptr u, vptr v, int a, int b) /* * Hack -- help "select" a location (see below) */ -static s16b target_pick(POSITION y1, POSITION x1, POSITION dy, POSITION dx) +static POSITION_IDX target_pick(POSITION y1, POSITION x1, POSITION dy, POSITION dx) { - int i, v; - - int x2, y2, x3, y3, x4, y4; - - int b_i = -1, b_v = 9999; + POSITION_IDX i, v; + POSITION x2, y2, x3, y3, x4, y4; + POSITION_IDX b_i = -1, b_v = 9999; /* Scan the locations */ @@ -2755,7 +2330,7 @@ static s16b target_pick(POSITION y1, POSITION x1, POSITION dy, POSITION dx) /* Approximate Double Distance */ v = ((x4 > y4) ? (x4 + x4 + y4) : (y4 + y4 + x4)); - /* XXX XXX XXX Penalize location */ + /* Penalize location */ /* Track best */ if ((b_i >= 0) && (v >= b_v)) continue; @@ -2763,8 +2338,6 @@ static s16b target_pick(POSITION y1, POSITION x1, POSITION dy, POSITION dx) /* Track best */ b_i = i; b_v = v; } - - /* Result */ return (b_i); } @@ -2772,11 +2345,10 @@ static s16b target_pick(POSITION y1, POSITION x1, POSITION dy, POSITION dx) /* * Hack -- determine if a given location is "interesting" */ -static bool target_set_accept(int y, int x) +static bool target_set_accept(POSITION y, POSITION x) { cave_type *c_ptr; - - s16b this_o_idx, next_o_idx = 0; + OBJECT_IDX this_o_idx, next_o_idx = 0; /* Bounds */ if (!(in_bounds(y, x))) return (FALSE); @@ -2784,11 +2356,9 @@ static bool target_set_accept(int y, int x) /* Player grid is always interesting */ if (player_bold(y, x)) return (TRUE); - /* Handle hallucination */ if (p_ptr->image) return (FALSE); - /* Examine the grid */ c_ptr = &cave[y][x]; @@ -2805,8 +2375,6 @@ static bool target_set_accept(int y, int x) for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx) { object_type *o_ptr; - - /* Acquire object */ o_ptr = &o_list[this_o_idx]; /* Acquire next object */ @@ -2826,7 +2394,6 @@ static bool target_set_accept(int y, int x) if (have_flag(f_info[get_feat_mimic(c_ptr)].flags, FF_NOTICE)) return TRUE; } - /* Nope */ return (FALSE); } @@ -2838,8 +2405,8 @@ static bool target_set_accept(int y, int x) */ static void target_set_prepare(BIT_FLAGS mode) { - int y, x; - int min_hgt, max_hgt, min_wid, max_wid; + POSITION y, x; + POSITION min_hgt, max_hgt, min_wid, max_wid; if (mode & TARGET_KILL) { @@ -2994,22 +2561,20 @@ bool show_gold_on_floor = FALSE; * recall info and the health bar info to track that monster. * * Eventually, we may allow multiple objects per grid, or objects - * and terrain features in the same grid. XXX XXX XXX + * and terrain features in the same grid. * * This function must handle blindness/hallucination. */ -static int target_set_aux(int y, int x, BIT_FLAGS mode, cptr info) +static char target_set_aux(POSITION y, POSITION x, BIT_FLAGS mode, cptr info) { cave_type *c_ptr = &cave[y][x]; - s16b this_o_idx, next_o_idx = 0; + OBJECT_IDX this_o_idx, next_o_idx = 0; cptr s1 = "", s2 = "", s3 = "", x_info = ""; bool boring = TRUE; - s16b feat; + FEAT_IDX feat; feature_type *f_ptr; - int query = '\001'; + char query = '\001'; char out_val[MAX_NLEN+80]; - -#ifdef ALLOW_EASY_FLOOR OBJECT_IDX floor_list[23]; ITEM_NUMBER floor_num = 0; @@ -3024,20 +2589,15 @@ static int target_set_aux(int y, int x, BIT_FLAGS mode, cptr info) } } -#endif /* ALLOW_EASY_FLOOR */ - /* Hack -- under the player */ if (player_bold(y, x)) { - /* Description */ #ifdef JP s1 = "ããªãã¯"; s2 = "ã®ä¸"; s3 = "ã«ãã"; #else s1 = "You are "; - - /* Preposition */ s2 = "on "; #endif } @@ -3075,22 +2635,15 @@ static int target_set_aux(int y, int x, BIT_FLAGS mode, cptr info) { monster_type *m_ptr = &m_list[c_ptr->m_idx]; monster_race *ap_r_ptr = &r_info[m_ptr->ap_r_idx]; - char m_name[80]; + GAME_TEXT m_name[MAX_NLEN]; bool recall = FALSE; /* Not boring */ boring = FALSE; - /* Get the monster name ("a kobold") */ monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE); - - /* Hack -- track this monster race */ monster_race_track(m_ptr->ap_r_idx); - - /* Hack -- health bar for this monster */ health_track(c_ptr->m_idx); - - /* Hack -- handle stuff */ handle_stuff(); /* Interact */ @@ -3101,7 +2654,6 @@ static int target_set_aux(int y, int x, BIT_FLAGS mode, cptr info) /* Recall */ if (recall) { - /* Save */ screen_save(); /* Recall on screen */ @@ -3113,7 +2665,6 @@ static int target_set_aux(int y, int x, BIT_FLAGS mode, cptr info) /* Command */ query = inkey(); - /* Restore */ screen_load(); /* Normal commands */ @@ -3177,11 +2728,9 @@ static int target_set_aux(int y, int x, BIT_FLAGS mode, cptr info) /* Scan all objects being carried */ for (this_o_idx = m_ptr->hold_o_idx; this_o_idx; this_o_idx = next_o_idx) { - char o_name[MAX_NLEN]; + GAME_TEXT o_name[MAX_NLEN]; object_type *o_ptr; - - /* Acquire object */ o_ptr = &o_list[this_o_idx]; /* Acquire next object */ @@ -3190,7 +2739,6 @@ static int target_set_aux(int y, int x, BIT_FLAGS mode, cptr info) /* Obtain an object description */ object_desc(o_name, o_ptr, 0); - /* Describe the object */ #ifdef JP sprintf(out_val, "%s%s%s%s[%s]", s1, o_name, s2, s3, info); #else @@ -3220,8 +2768,6 @@ static int target_set_aux(int y, int x, BIT_FLAGS mode, cptr info) #endif } - -#ifdef ALLOW_EASY_FLOOR if (floor_num) { int min_width = 0; @@ -3230,23 +2776,17 @@ static int target_set_aux(int y, int x, BIT_FLAGS mode, cptr info) { if (floor_num == 1) { - char o_name[MAX_NLEN]; + GAME_TEXT o_name[MAX_NLEN]; object_type *o_ptr; - - /* Acquire object */ o_ptr = &o_list[floor_list[0]]; - /* Describe the object */ object_desc(o_name, o_ptr, 0); - /* Message */ #ifdef JP - sprintf(out_val, "%s%s%s%s[%s]", - s1, o_name, s2, s3, info); + sprintf(out_val, "%s%s%s%s[%s]", s1, o_name, s2, s3, info); #else - sprintf(out_val, "%s%s%s%s [%s]", - s1, s2, s3, o_name, info); + sprintf(out_val, "%s%s%s%s [%s]", s1, s2, s3, o_name, info); #endif prt(out_val, 0, 0); @@ -3264,11 +2804,9 @@ static int target_set_aux(int y, int x, BIT_FLAGS mode, cptr info) { /* Display rough information about items */ #ifdef JP - sprintf(out_val, "%s %dåã®ã¢ã¤ãã %s%s ['x'ã§ä¸è¦§, %s]", - s1, (int)floor_num, s2, s3, info); + sprintf(out_val, "%s %dåã®ã¢ã¤ãã %s%s ['x'ã§ä¸è¦§, %s]", s1, (int)floor_num, s2, s3, info); #else - sprintf(out_val, "%s%s%sa pile of %d items [x,%s]", - s1, s2, s3, (int)floor_num, info); + sprintf(out_val, "%s%s%sa pile of %d items [x,%s]", s1, s2, s3, (int)floor_num, info); #endif prt(out_val, 0, 0); @@ -3288,9 +2826,7 @@ static int target_set_aux(int y, int x, BIT_FLAGS mode, cptr info) while (1) { int i; - IDX o_idx; - - /* Save screen */ + OBJECT_IDX o_idx; screen_save(); /* Display */ @@ -3300,19 +2836,13 @@ static int target_set_aux(int y, int x, BIT_FLAGS mode, cptr info) /* Prompt */ #ifdef JP - sprintf(out_val, "%s %dåã®ã¢ã¤ãã %s%s [Enterã§æ¬¡ã¸, %s]", - s1, (int)floor_num, s2, s3, info); + sprintf(out_val, "%s %dåã®ã¢ã¤ãã %s%s [Enterã§æ¬¡ã¸, %s]", s1, (int)floor_num, s2, s3, info); #else - sprintf(out_val, "%s%s%sa pile of %d items [Enter,%s]", - s1, s2, s3, (int)floor_num, info); + sprintf(out_val, "%s%s%sa pile of %d items [Enter,%s]", s1, s2, s3, (int)floor_num, info); #endif prt(out_val, 0, 0); - - /* Wait */ query = inkey(); - - /* Load screen */ screen_load(); /* Exit unless 'Enter' */ @@ -3344,24 +2874,19 @@ static int target_set_aux(int y, int x, BIT_FLAGS mode, cptr info) /* NOTREACHED */ } -#endif /* ALLOW_EASY_FLOOR */ - /* Scan all objects in the grid */ for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx) { object_type *o_ptr; - - /* Acquire object */ o_ptr = &o_list[this_o_idx]; /* Acquire next object */ next_o_idx = o_ptr->next_o_idx; - /* Describe it */ if (o_ptr->marked & OM_FOUND) { - char o_name[MAX_NLEN]; + GAME_TEXT o_name[MAX_NLEN]; /* Not boring */ boring = FALSE; @@ -3369,7 +2894,6 @@ static int target_set_aux(int y, int x, BIT_FLAGS mode, cptr info) /* Obtain an object description */ object_desc(o_name, o_ptr, 0); - /* Describe the object */ #ifdef JP sprintf(out_val, "%s%s%s%s[%s]", s1, o_name, s2, s3, info); #else @@ -3484,11 +3008,7 @@ static int target_set_aux(int y, int x, BIT_FLAGS mode, cptr info) (have_flag(f_ptr->flags, FF_BLDG) && !p_ptr->inside_arena) || have_flag(f_ptr->flags, FF_ENTRANCE)) { -#ifdef JP - s2 = "ã®å ¥å£"; -#else - s3 = ""; -#endif + s2 = _("ã®å ¥å£", ""); } #ifndef JP else if (have_flag(f_ptr->flags, FF_FLOOR) || @@ -3512,9 +3032,9 @@ static int target_set_aux(int y, int x, BIT_FLAGS mode, cptr info) if (c_ptr->mimic) sprintf(f_idx_str, "%d/%d", c_ptr->feat, c_ptr->mimic); else sprintf(f_idx_str, "%d", c_ptr->feat); #ifdef JP - sprintf(out_val, "%s%s%s%s[%s] %x %s %d %d %d (%d,%d) %d", s1, name, s2, s3, info, c_ptr->info, f_idx_str, c_ptr->dist, c_ptr->cost, c_ptr->when, y, x, travel.cost[y][x]); + sprintf(out_val, "%s%s%s%s[%s] %x %s %d %d %d (%d,%d) %d", s1, name, s2, s3, info, (unsigned int)c_ptr->info, f_idx_str, c_ptr->dist, c_ptr->cost, c_ptr->when, (int)y, (int)x, travel.cost[y][x]); #else - sprintf(out_val, "%s%s%s%s [%s] %x %s %d %d %d (%d,%d)", s1, s2, s3, name, info, c_ptr->info, f_idx_str, c_ptr->dist, c_ptr->cost, c_ptr->when, y, x); + sprintf(out_val, "%s%s%s%s [%s] %x %s %d %d %d (%d,%d)", s1, s2, s3, name, info, c_ptr->info, f_idx_str, c_ptr->dist, c_ptr->cost, c_ptr->when, (int)y, (int)x); #endif } else @@ -3547,10 +3067,10 @@ static int target_set_aux(int y, int x, BIT_FLAGS mode, cptr info) * * All locations must be on the current panel. Consider the use of * "panel_bounds()" to allow "off-panel" targets, perhaps by using - * some form of "scrolling" the map around the cursor. XXX XXX XXX + * some form of "scrolling" the map around the cursor. * That is, consider the possibility of "auto-scrolling" the screen * while the cursor moves around. This may require changes in the - * "update_mon()" code to allow "visibility" even if off panel, and + * "update_monster()" code to allow "visibility" even if off panel, and * may require dynamic recalculation of the "temp" grid set. * * Hack -- targeting/observing an "outer border grid" may induce @@ -3583,30 +3103,23 @@ static int target_set_aux(int y, int x, BIT_FLAGS mode, cptr info) */ bool target_set(BIT_FLAGS mode) { - int i, d, m, t, bd; + int i, d, m, t, bd; POSITION y = p_ptr->y; POSITION x = p_ptr->x; - bool done = FALSE; - bool flag = TRUE; - char query; - char info[80]; - char same_key; - - cave_type *c_ptr; - - int wid, hgt; + bool done = FALSE; + bool flag = TRUE; + char query; + char info[80]; + char same_key; + cave_type *c_ptr; + TERM_LEN wid, hgt; - /* Get size */ get_screen_size(&wid, &hgt); /* Cancel target */ target_who = 0; - - /* Cancel tracking */ - /* health_track(0); */ - if (rogue_like_commands) { same_key = 'x'; @@ -3650,6 +3163,14 @@ bool target_set(BIT_FLAGS mode) { strcpy(info, _("qæ¢ pèª oç¾ +次 -å", "q,p,o,+,-,