X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=src%2Fcmd-visual%2Fcmd-draw.cpp;h=62404b34e74e0dea416371762aabbf3525d50764;hb=23cf9fbcf5bcaddd0d8c2ff163a3c2791c201751;hp=bd2fb14fe4c1271c3e37d8d82c91eedd5f292d37;hpb=78db5e729992e370178a589fdda6a8a4ce54c25b;p=hengbandforosx%2Fhengbandosx.git diff --git a/src/cmd-visual/cmd-draw.cpp b/src/cmd-visual/cmd-draw.cpp index bd2fb14fe..62404b34e 100644 --- a/src/cmd-visual/cmd-draw.cpp +++ b/src/cmd-visual/cmd-draw.cpp @@ -1,29 +1,30 @@ #include "cmd-visual/cmd-draw.h" #include "core/asking-player.h" -#include "core/player-redraw-types.h" -#include "core/player-update-types.h" #include "core/stuff-handler.h" #include "core/window-redrawer.h" #include "io/files-util.h" #include "io/input-key-acceptor.h" #include "main/sound-of-music.h" -#include "player/player-race-types.h" +#include "player-base/player-race.h" +#include "player-info/race-types.h" #include "player/process-name.h" #include "racial/racial-android.h" +#include "system/player-type-definition.h" +#include "system/redrawing-flags-updater.h" #include "term/gameterm.h" #include "term/screen-processor.h" #include "term/term-color-types.h" +#include "term/z-form.h" #include "util/int-char-converter.h" #include "util/string-processor.h" #include "view/display-messages.h" -#include "view/display-player.h" // æ«å®ãå¾ã§æ¶ã. +#include "view/display-player.h" #include "world/world.h" /*! * @brief ç»é¢ãåæç»ããã³ãã³ãã®ã¡ã¤ã³ã«ã¼ãã³ * Hack -- redraw the screen - * @param creature_ptr ãã¬ã¼ã¤ã¼ã¸ã®åç §ãã¤ã³ã¿ - * @return ãªã + * @param player_ptr ãã¬ã¤ã¤ã¼ã¸ã®åç §ãã¤ã³ã¿ * @details *
* This command performs various low level updates, clears all the "extra" @@ -35,114 +36,127 @@ * the "TERM_XTRA_REACT" hook before redrawing the windows. **/ -void do_cmd_redraw(player_type *creature_ptr) +void do_cmd_redraw(PlayerType *player_ptr) { - term_xtra(TERM_XTRA_REACT, 0); + term_xtra(TERM_XTRA_REACT, 0); - creature_ptr->update |= (PU_COMBINE | PU_REORDER); - creature_ptr->update |= (PU_TORCH); - creature_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS); - creature_ptr->update |= (PU_UN_VIEW | PU_UN_LITE); - creature_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE); - creature_ptr->update |= (PU_MONSTERS); + auto &rfu = RedrawingFlagsUpdater::get_instance(); + const auto flags_srf = { + StatusRedrawingFlag::COMBINATION, + StatusRedrawingFlag::REORDER, + StatusRedrawingFlag::TORCH, + StatusRedrawingFlag::BONUS, + StatusRedrawingFlag::HP, + StatusRedrawingFlag::MP, + StatusRedrawingFlag::SPELLS, + StatusRedrawingFlag::UN_VIEW, + StatusRedrawingFlag::UN_LITE, + StatusRedrawingFlag::VIEW, + StatusRedrawingFlag::LITE, + StatusRedrawingFlag::MONSTER_LITE, + StatusRedrawingFlag::MONSTER_STATUSES, + }; + rfu.set_flags(flags_srf); + const auto flags_mwrf = { + MainWindowRedrawingFlag::WIPE, + MainWindowRedrawingFlag::BASIC, + MainWindowRedrawingFlag::EXTRA, + MainWindowRedrawingFlag::EQUIPPY, + MainWindowRedrawingFlag::MAP, + }; + rfu.set_flags(flags_mwrf); + player_ptr->window_flags |= (PW_INVENTORY | PW_EQUIPMENT | PW_SPELL | PW_PLAYER); + player_ptr->window_flags |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER_LORE | PW_ITEM_KNOWLEDGTE); + update_playtime(); + handle_stuff(player_ptr); + if (PlayerRace(player_ptr).equals(PlayerRaceType::ANDROID)) { + calc_android_exp(player_ptr); + } - creature_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY); + term_type *old = game_term; + for (auto i = 0U; i < angband_terms.size(); ++i) { + if (!angband_terms[i]) { + continue; + } - creature_ptr->window_flags |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER); - creature_ptr->window_flags |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT); - - update_playtime(); - handle_stuff(creature_ptr); - if (creature_ptr->prace == RACE_ANDROID) calc_android_exp(creature_ptr); - - term_type *old = Term; - for (int j = 0; j < 8; j++) - { - if (!angband_term[j]) continue; - - term_activate(angband_term[j]); - term_redraw(); - term_fresh(); - term_activate(old); - } + term_activate(angband_terms[i]); + term_redraw(); + term_fresh(); + term_activate(old); + } } - /*! * @brief ãã¬ã¤ã¤ã¼ã®ã¹ãã¼ã¿ã¹è¡¨ç¤º - * @return ãªã */ -void do_cmd_player_status(player_type *creature_ptr) +void do_cmd_player_status(PlayerType *player_ptr) { - int mode = 0; - char tmp[160]; - screen_save(); - while (TRUE) - { - update_playtime(); - display_player(creature_ptr, mode); + int mode = 0; + char tmp[160]; + screen_save(); + while (true) { + TermCenteredOffsetSetter tcos(MAIN_TERM_MIN_COLS, MAIN_TERM_MIN_ROWS); - if (mode == 5) - { - mode = 0; - display_player(creature_ptr, mode); - } + update_playtime(); + (void)display_player(player_ptr, mode); - term_putstr(2, 23, -1, TERM_WHITE, - _("['c'ã§ååå¤æ´, 'f'ã§ãã¡ã¤ã«ã¸æ¸åº, 'h'ã§ã¢ã¼ãå¤æ´, ESCã§çµäº]", "['c' to change name, 'f' to file, 'h' to change mode, or ESC]")); - char c = inkey(); - if (c == ESCAPE) break; + if (mode == 5) { + mode = 0; + (void)display_player(player_ptr, mode); + } - if (c == 'c') - { - get_name(creature_ptr); - process_player_name(creature_ptr); - } - else if (c == 'f') - { - sprintf(tmp, "%s.txt", creature_ptr->base_name); - if (get_string(_("ãã¡ã¤ã«å: ", "File name: "), tmp, 80)) - { - if (tmp[0] && (tmp[0] != ' ')) - { - update_playtime(); - file_character(creature_ptr, tmp, display_player); - } - } - } - else if (c == 'h') - { - mode++; - } - else - { - bell(); - } + term_putstr(2, 23, -1, TERM_WHITE, + _("['c'ã§ååå¤æ´, 'f'ã§ãã¡ã¤ã«ã¸æ¸åº, 'h'ã§ã¢ã¼ãå¤æ´, ESCã§çµäº]", "['c' to change name, 'f' to file, 'h' to change mode, or ESC]")); + char c = inkey(); + if (c == ESCAPE) { + break; + } - msg_erase(); - } + if (c == 'c') { + get_name(player_ptr); + process_player_name(player_ptr); + } else if (c == 'f') { + strnfmt(tmp, sizeof(tmp), "%s.txt", player_ptr->base_name); + if (get_string(_("ãã¡ã¤ã«å: ", "File name: "), tmp, 80)) { + if (tmp[0] && (tmp[0] != ' ')) { + update_playtime(); + file_character(player_ptr, tmp); + } + } + } else if (c == 'h') { + mode++; + } else { + bell(); + } - screen_load(); - creature_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY); - handle_stuff(creature_ptr); -} + msg_erase(); + } + screen_load(); + auto &rfu = RedrawingFlagsUpdater::get_instance(); + const auto flags_mwrf = { + MainWindowRedrawingFlag::WIPE, + MainWindowRedrawingFlag::BASIC, + MainWindowRedrawingFlag::EXTRA, + MainWindowRedrawingFlag::EQUIPPY, + MainWindowRedrawingFlag::MAP, + }; + rfu.set_flags(flags_mwrf); + handle_stuff(player_ptr); +} /*! * @brief æè¿è¡¨ç¤ºãããã¡ãã»ã¼ã¸ãå表示ããã³ãã³ãã®ã¡ã¤ã³ã«ã¼ãã³ * Recall the most recent message - * @return ãªã */ void do_cmd_message_one(void) { - prt(format("> %s", message_str(0)), 0, 0); + prt(format("> %s", message_str(0)), 0, 0); } - /*! * @brief ã¡ãã»ã¼ã¸ã®ãã°ã表示ããã³ãã³ãã®ã¡ã¤ã³ã«ã¼ãã³ * Recall the most recent message - * @return ãªã * @details *
* Show previous messages to the user -BEN- @@ -162,127 +176,123 @@ void do_cmd_message_one(void) */ void do_cmd_messages(int num_now) { - char shower_str[81]; - char finder_str[81]; - char back_str[81]; - concptr shower = NULL; - int wid, hgt; - term_get_size(&wid, &hgt); - int num_lines = hgt - 4; - strcpy(finder_str, ""); - strcpy(shower_str, ""); - int n = message_num(); - int i = 0; - screen_save(); - term_clear(); - while (TRUE) - { - int j; - int skey; - for (j = 0; (j < num_lines) && (i + j < n); j++) - { - concptr msg = message_str(i + j); - c_prt((i + j < num_now ? TERM_WHITE : TERM_SLATE), msg, num_lines + 1 - j, 0); - if (!shower || !shower[0]) continue; + char shower_str[81]; + char finder_str[81]; + char back_str[81]; + concptr shower = nullptr; + int wid, hgt; + term_get_size(&wid, &hgt); + int num_lines = hgt - 4; + strcpy(finder_str, ""); + strcpy(shower_str, ""); + int n = message_num(); + int i = 0; + screen_save(); + term_clear(); + while (true) { + int j; + int skey; + for (j = 0; (j < num_lines) && (i + j < n); j++) { + concptr msg = message_str(i + j); + c_prt((i + j < num_now ? TERM_WHITE : TERM_SLATE), msg, num_lines + 1 - j, 0); + if (!shower || !shower[0]) { + continue; + } - concptr str = msg; - while ((str = angband_strstr(str, shower)) != NULL) - { - int len = strlen(shower); - term_putstr(str - msg, num_lines + 1 - j, len, TERM_YELLOW, shower); - str += len; - } - } + concptr str = msg; + while ((str = angband_strstr(str, shower)) != nullptr) { + int len = strlen(shower); + term_putstr(str - msg, num_lines + 1 - j, len, TERM_YELLOW, shower); + str += len; + } + } - for (; j < num_lines; j++) - term_erase(0, num_lines + 1 - j, 255); + for (; j < num_lines; j++) { + term_erase(0, num_lines + 1 - j, 255); + } - prt(format(_("以åã®ã¡ãã»ã¼ã¸ %d-%d å ¨é¨ã§(%d)", "Message Recall (%d-%d of %d)"), - i, i + j - 1, n), 0, 0); - prt(_("[ 'p' ã§æ´ã«å¤ããã®, 'n' ã§æ´ã«æ°ãããã®, '/' ã§æ¤ç´¢, ESC ã§ä¸æ ]", - "[Press 'p' for older, 'n' for newer, ..., or ESCAPE]"), hgt - 1, 0); - skey = inkey_special(TRUE); - if (skey == ESCAPE) break; + prt(format(_("以åã®ã¡ãã»ã¼ã¸ %d-%d å ¨é¨ã§(%d)", "Message Recall (%d-%d of %d)"), i, i + j - 1, n), 0, 0); + prt(_("[ 'p' ã§æ´ã«å¤ããã®, 'n' ã§æ´ã«æ°ãããã®, '/' ã§æ¤ç´¢, ESC ã§ä¸æ ]", "[Press 'p' for older, 'n' for newer, ..., or ESCAPE]"), hgt - 1, 0); + skey = inkey_special(true); + if (skey == ESCAPE) { + break; + } - j = i; - switch (skey) - { - case '=': - prt(_("強調: ", "Show: "), hgt - 1, 0); - strcpy(back_str, shower_str); - if (askfor(shower_str, 80)) - shower = shower_str[0] ? shower_str : NULL; - else - strcpy(shower_str, back_str); + j = i; + switch (skey) { + case '=': + prt(_("強調: ", "Show: "), hgt - 1, 0); + strcpy(back_str, shower_str); + if (askfor(shower_str, 80)) { + shower = shower_str[0] ? shower_str : nullptr; + } else { + strcpy(shower_str, back_str); + } - continue; - case '/': - case KTRL('s'): - { - prt(_("æ¤ç´¢: ", "Find: "), hgt - 1, 0); - strcpy(back_str, finder_str); - if (!askfor(finder_str, 80)) - { - strcpy(finder_str, back_str); - continue; - } - else if (!finder_str[0]) - { - shower = NULL; - continue; - } + continue; + case '/': + case KTRL('s'): { + prt(_("æ¤ç´¢: ", "Find: "), hgt - 1, 0); + strcpy(back_str, finder_str); + if (!askfor(finder_str, 80)) { + strcpy(finder_str, back_str); + continue; + } else if (!finder_str[0]) { + shower = nullptr; + continue; + } - shower = finder_str; - for (int z = i + 1; z < n; z++) - { - concptr msg = message_str(z); - if (angband_strstr(msg, finder_str)) - { - i = z; - break; - } - } - } + shower = finder_str; + for (int z = i + 1; z < n; z++) { + concptr msg = message_str(z); + if (angband_strstr(msg, finder_str)) { + i = z; + break; + } + } + } - break; + break; - case SKEY_TOP: - i = n - num_lines; - break; - case SKEY_BOTTOM: - i = 0; - break; - case '8': - case SKEY_UP: - case '\n': - case '\r': - i = MIN(i + 1, n - num_lines); - break; - case '+': - i = MIN(i + 10, n - num_lines); - break; - case 'p': - case KTRL('P'): - case ' ': - case SKEY_PGUP: - i = MIN(i + num_lines, n - num_lines); - break; - case 'n': - case KTRL('N'): - case SKEY_PGDOWN: - i = MAX(0, i - num_lines); - break; - case '-': - i = MAX(0, i - 10); - break; - case '2': - case SKEY_DOWN: - i = MAX(0, i - 1); - break; - } + case SKEY_TOP: + i = n - num_lines; + break; + case SKEY_BOTTOM: + i = 0; + break; + case '8': + case SKEY_UP: + case '\n': + case '\r': + i = std::min(i + 1, n - num_lines); + break; + case '+': + i = std::min(i + 10, n - num_lines); + break; + case 'p': + case KTRL('P'): + case ' ': + case SKEY_PGUP: + i = std::min(i + num_lines, n - num_lines); + break; + case 'n': + case KTRL('N'): + case SKEY_PGDOWN: + i = std::max(0, i - num_lines); + break; + case '-': + i = std::max(0, i - 10); + break; + case '2': + case SKEY_DOWN: + i = std::max(0, i - 1); + break; + } - if (i == j) bell(); - } + if (i == j) { + bell(); + } + } - screen_load(); + screen_load(); }