From 39984e016dabe4287f65f671bab3fbff350d6a3e Mon Sep 17 00:00:00 2001 From: dis- Date: Tue, 26 Jan 2021 19:35:29 +0900 Subject: [PATCH] =?utf8?q?[Fix]=20fresh-after=E3=82=B3=E3=83=9E=E3=83=B3?= =?utf8?q?=E3=83=89=E3=81=AE=E4=BF=AE=E6=AD=A3=20=E3=82=B3=E3=83=9E?= =?utf8?q?=E3=83=B3=E3=83=89=E8=87=AA=E5=8B=95=E7=B9=B0=E3=82=8A=E8=BF=94?= =?utf8?q?=E3=81=97=E3=81=AB=E3=81=AE=E3=81=BF=E5=8A=B9=E3=81=84=E3=81=A6?= =?utf8?q?=E3=81=84=E3=81=9Ffresh-after=E3=82=92=E3=83=9E=E3=82=AF?= =?utf8?q?=E3=83=AD=E5=85=A8=E8=88=AC=E3=81=AB=E6=8B=A1=E5=BC=B5=E3=81=97?= =?utf8?q?=E3=81=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/cmd-action/cmd-move.c | 3 ++- src/cmd-action/cmd-pet.c | 3 ++- src/cmd-item/cmd-throw.c | 24 ++++++++++++++---------- src/combat/shoot.c | 16 ++++++++++------ src/core/window-redrawer.c | 3 +++ src/dungeon/dungeon-processor.c | 10 ++++++---- src/effect/effect-processor.c | 17 +++++++++++------ src/io/input-key-requester.c | 3 +++ src/mind/mind-mirror-master.c | 6 ++++-- src/spell-kind/spells-genocide.c | 3 ++- src/spell-kind/spells-sight.c | 3 ++- src/term/z-term.c | 8 ++++++++ src/term/z-term.h | 1 + src/window/display-sub-window-spells.c | 5 ++++- src/wizard/wizard-item-modifier.c | 3 ++- 15 files changed, 74 insertions(+), 34 deletions(-) diff --git a/src/cmd-action/cmd-move.c b/src/cmd-action/cmd-move.c index 250afa516..0188bf0eb 100644 --- a/src/cmd-action/cmd-move.c +++ b/src/cmd-action/cmd-move.c @@ -425,5 +425,6 @@ void do_cmd_rest(player_type *creature_ptr) update_creature(creature_ptr); creature_ptr->redraw |= (PR_STATE); update_output(creature_ptr); - term_fresh(); + if (need_term_fresh()) + term_fresh(); } diff --git a/src/cmd-action/cmd-pet.c b/src/cmd-action/cmd-pet.c index 208412b0a..998de47d4 100644 --- a/src/cmd-action/cmd-pet.c +++ b/src/cmd-action/cmd-pet.c @@ -170,7 +170,8 @@ void do_cmd_pet_dismiss(player_type *creature_ptr) Term->scr->cu = cu; Term->scr->cv = cv; - term_fresh(); + if (need_term_fresh()) + term_fresh(); C_KILL(who, current_world_ptr->max_m_idx, MONSTER_IDX); diff --git a/src/cmd-item/cmd-throw.c b/src/cmd-item/cmd-throw.c index ec34be739..5e2c1cfc0 100644 --- a/src/cmd-item/cmd-throw.c +++ b/src/cmd-item/cmd-throw.c @@ -243,10 +243,12 @@ static void check_racial_target_seen(player_type *creature_ptr, it_type *it_ptr) TERM_COLOR a = object_attr(it_ptr->q_ptr); print_rel(creature_ptr, c, a, it_ptr->ny[it_ptr->cur_dis], it_ptr->nx[it_ptr->cur_dis]); move_cursor_relative(it_ptr->ny[it_ptr->cur_dis], it_ptr->nx[it_ptr->cur_dis]); - term_fresh(); - term_xtra(TERM_XTRA_DELAY, it_ptr->msec); - lite_spot(creature_ptr, it_ptr->ny[it_ptr->cur_dis], it_ptr->nx[it_ptr->cur_dis]); - term_fresh(); + if (need_term_fresh()) { + term_fresh(); + term_xtra(TERM_XTRA_DELAY, it_ptr->msec); + lite_spot(creature_ptr, it_ptr->ny[it_ptr->cur_dis], it_ptr->nx[it_ptr->cur_dis]); + term_fresh(); + } } static bool check_racial_target_monster(player_type *creature_ptr, it_type *it_ptr) @@ -432,12 +434,14 @@ static void process_boomerang_throw(player_type *creature_ptr, it_type *it_ptr) SYMBOL_CODE c = object_char(it_ptr->q_ptr); byte a = object_attr(it_ptr->q_ptr); - print_rel(creature_ptr, c, a, it_ptr->ny[i], it_ptr->nx[i]); - move_cursor_relative(it_ptr->ny[i], it_ptr->nx[i]); - term_fresh(); - term_xtra(TERM_XTRA_DELAY, it_ptr->msec); - lite_spot(creature_ptr, it_ptr->ny[i], it_ptr->nx[i]); - term_fresh(); + if (need_term_fresh()) { + print_rel(creature_ptr, c, a, it_ptr->ny[i], it_ptr->nx[i]); + move_cursor_relative(it_ptr->ny[i], it_ptr->nx[i]); + term_fresh(); + term_xtra(TERM_XTRA_DELAY, it_ptr->msec); + lite_spot(creature_ptr, it_ptr->ny[i], it_ptr->nx[i]); + term_fresh(); + } } display_boomerang_throw(creature_ptr, it_ptr); diff --git a/src/combat/shoot.c b/src/combat/shoot.c index e41feafe8..e5a9daaaf 100644 --- a/src/combat/shoot.c +++ b/src/combat/shoot.c @@ -551,10 +551,12 @@ void exe_fire(player_type *shooter_ptr, INVENTORY_IDX item, object_type *j_ptr, /* Draw, Hilite, Fresh, Pause, Erase */ print_rel(shooter_ptr, c, a, ny, nx); move_cursor_relative(ny, nx); - term_fresh(); - term_xtra(TERM_XTRA_DELAY, msec); - lite_spot(shooter_ptr, ny, nx); - term_fresh(); + if (need_term_fresh()) { + term_fresh(); + term_xtra(TERM_XTRA_DELAY, msec); + lite_spot(shooter_ptr, ny, nx); + term_fresh(); + } } /* The player cannot see the missile */ @@ -774,8 +776,10 @@ void exe_fire(player_type *shooter_ptr, INVENTORY_IDX item, object_type *j_ptr, lite_spot(shooter_ptr, ny, nx); lite_spot(shooter_ptr, oy, ox); - term_fresh(); - term_xtra(TERM_XTRA_DELAY, msec); + if (need_term_fresh()) { + term_fresh(); + term_xtra(TERM_XTRA_DELAY, msec); + } x = nx; y = ny; diff --git a/src/core/window-redrawer.c b/src/core/window-redrawer.c index 135bd71d2..ad8faab69 100644 --- a/src/core/window-redrawer.c +++ b/src/core/window-redrawer.c @@ -229,6 +229,9 @@ void window_stuff(player_type *player_ptr) if (!player_ptr->window) return; + if (!need_term_fresh()) + return; + BIT_FLAGS mask = 0L; for (int j = 0; j < 8; j++) { if (angband_term[j]) diff --git a/src/dungeon/dungeon-processor.c b/src/dungeon/dungeon-processor.c index f4e295d84..f8d189d28 100644 --- a/src/dungeon/dungeon-processor.c +++ b/src/dungeon/dungeon-processor.c @@ -102,7 +102,8 @@ void process_dungeon(player_type *player_ptr, bool load_game) player_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS); player_ptr->update |= (PU_COMBINE | PU_REORDER); handle_stuff(player_ptr); - term_fresh(); + if (need_term_fresh()) + term_fresh(); if (quest_num && (is_fixed_quest_idx(quest_num) && !((quest_num == QUEST_OBERON) || (quest_num == QUEST_SERPENT) || !(quest[quest_num].flags & QUEST_FLAG_PRESET)))) @@ -169,7 +170,7 @@ void process_dungeon(player_type *player_ptr, bool load_game) handle_stuff(player_ptr); move_cursor_relative(player_ptr->y, player_ptr->x); - if (fresh_after) + if (need_term_fresh()) term_fresh(); if (!player_ptr->playing || player_ptr->is_dead) @@ -179,7 +180,7 @@ void process_dungeon(player_type *player_ptr, bool load_game) handle_stuff(player_ptr); move_cursor_relative(player_ptr->y, player_ptr->x); - if (fresh_after) + if (need_term_fresh()) term_fresh(); if (!player_ptr->playing || player_ptr->is_dead) @@ -189,8 +190,9 @@ void process_dungeon(player_type *player_ptr, bool load_game) handle_stuff(player_ptr); move_cursor_relative(player_ptr->y, player_ptr->x); - if (fresh_after) + if (need_term_fresh()) { term_fresh(); + } if (!player_ptr->playing || player_ptr->is_dead) break; diff --git a/src/effect/effect-processor.c b/src/effect/effect-processor.c index e4d5e9588..e694a257a 100644 --- a/src/effect/effect-processor.c +++ b/src/effect/effect-processor.c @@ -203,10 +203,12 @@ bool project(player_type *caster_ptr, const MONSTER_IDX who, POSITION rad, POSIT SYMBOL_CODE c = PICT_C(p); print_rel(caster_ptr, c, a, y, x); move_cursor_relative(y, x); - term_fresh(); - term_xtra(TERM_XTRA_DELAY, msec); - lite_spot(caster_ptr, y, x); - term_fresh(); + if (need_term_fresh()) { + term_fresh(); + term_xtra(TERM_XTRA_DELAY, msec); + lite_spot(caster_ptr, y, x); + term_fresh(); + } if (flag & (PROJECT_BEAM)) { p = bolt_pict(y, x, y, x, typ); a = PICT_A(p); @@ -516,7 +518,9 @@ bool project(player_type *caster_ptr, const MONSTER_IDX who, POSITION rad, POSIT } move_cursor_relative(by, bx); - term_fresh(); + + if (need_term_fresh()) + term_fresh(); if (visual || drawn) { term_xtra(TERM_XTRA_DELAY, msec); } @@ -532,7 +536,8 @@ bool project(player_type *caster_ptr, const MONSTER_IDX who, POSITION rad, POSIT } move_cursor_relative(by, bx); - term_fresh(); + if (need_term_fresh()) + term_fresh(); } } diff --git a/src/io/input-key-requester.c b/src/io/input-key-requester.c index b8a3891e4..2a80fd577 100644 --- a/src/io/input-key-requester.c +++ b/src/io/input-key-requester.c @@ -208,6 +208,9 @@ void request_command(player_type *player_ptr, int shopping) msg_flag = FALSE; num_more = 0; inkey_flag = TRUE; + if (need_term_fresh()) { + term_fresh(); + } cmd = inkey(); if (!shopping && command_menu && ((cmd == '\r') || (cmd == '\n') || (cmd == 'x') || (cmd == 'X')) && !keymap_act[mode][(byte)(cmd)]) cmd = inkey_from_menu(player_ptr); diff --git a/src/mind/mind-mirror-master.c b/src/mind/mind-mirror-master.c index cc9191113..dd0a9e745 100644 --- a/src/mind/mind-mirror-master.c +++ b/src/mind/mind-mirror-master.c @@ -168,8 +168,10 @@ bool binding_field(player_type *caster_ptr, HIT_POINT dam) u16b p = bolt_pict(y, x, y, x, GF_MANA); print_rel(caster_ptr, PICT_C(p), PICT_A(p), y, x); move_cursor_relative(y, x); - term_fresh(); - term_xtra(TERM_XTRA_DELAY, msec); + if (need_term_fresh()) { + term_fresh(); + term_xtra(TERM_XTRA_DELAY, msec); + } } } } diff --git a/src/spell-kind/spells-genocide.c b/src/spell-kind/spells-genocide.c index dbaf394d1..75ed89270 100644 --- a/src/spell-kind/spells-genocide.c +++ b/src/spell-kind/spells-genocide.c @@ -100,7 +100,8 @@ bool genocide_aux(player_type *caster_ptr, MONSTER_IDX m_idx, int power, bool pl caster_ptr->redraw |= (PR_HP); caster_ptr->window |= (PW_PLAYER); handle_stuff(caster_ptr); - term_fresh(); + if (need_term_fresh()) + term_fresh(); int msec = delay_factor * delay_factor * delay_factor; term_xtra(TERM_XTRA_DELAY, msec); diff --git a/src/spell-kind/spells-sight.c b/src/spell-kind/spells-sight.c index 5f832615d..3040cb9f4 100644 --- a/src/spell-kind/spells-sight.c +++ b/src/spell-kind/spells-sight.c @@ -396,7 +396,8 @@ bool probing(player_type *caster_ptr) Term->scr->cu = cu; Term->scr->cv = cv; - term_fresh(); + if (need_term_fresh()) + term_fresh(); if (probe) { chg_virtue(caster_ptr, V_KNOWLEDGE, 1); diff --git a/src/term/z-term.c b/src/term/z-term.c index f925d5f19..f43f6ef3a 100644 --- a/src/term/z-term.c +++ b/src/term/z-term.c @@ -12,6 +12,8 @@ #include "game-option/special-options.h" #include "term/term-color-types.h" #include "term/z-virt.h" +#include "term/gameterm.h" +#include "game-option/map-screen-options.h" /* Special flags in the attr data */ #define AF_BIGTILE2 0xf0 @@ -1021,6 +1023,12 @@ static void term_fresh_row_text(TERM_LEN y, TERM_LEN x1, TERM_LEN x2) } } +bool macro_running(void) { + int diff = angband_term[0]->key_head - angband_term[0]->key_tail; + return diff < -1 || 1 < diff; +} + +bool need_term_fresh(void) { return !macro_running() || fresh_after; } /* * @brief Actually perform all requested changes to the window */ diff --git a/src/term/z-term.h b/src/term/z-term.h index 989727e34..8decb17dc 100644 --- a/src/term/z-term.h +++ b/src/term/z-term.h @@ -144,6 +144,7 @@ void term_queue_char(TERM_LEN x, TERM_LEN y, TERM_COLOR a, char c, TERM_COLOR ta void term_queue_bigchar(TERM_LEN x, TERM_LEN y, TERM_COLOR a, char c, TERM_COLOR ta, char tc); void term_queue_line(TERM_LEN x, TERM_LEN y, int n, TERM_COLOR *a, char *c, TERM_COLOR *ta, char *tc); +bool need_term_fresh(void); errr term_fresh(void); errr term_set_cursor(int v); diff --git a/src/window/display-sub-window-spells.c b/src/window/display-sub-window-spells.c index 5459e5fa3..d4e7fd5df 100644 --- a/src/window/display-sub-window-spells.c +++ b/src/window/display-sub-window-spells.c @@ -184,7 +184,10 @@ void fix_spell(player_type *player_ptr) term_activate(angband_term[j]); display_spell_list(player_ptr); - term_fresh(); + if (need_term_fresh()) { + term_fresh(); + player_ptr->window &= ~(PW_SPELL); + } term_activate(old); } } diff --git a/src/wizard/wizard-item-modifier.c b/src/wizard/wizard-item-modifier.c index 92eeb0927..de1809685 100644 --- a/src/wizard/wizard-item-modifier.c +++ b/src/wizard/wizard-item-modifier.c @@ -226,7 +226,8 @@ static void wiz_statistics(player_type *caster_ptr, object_type *o_ptr) } prt(format(q, i, correct, matches, better, worse, other), 0, 0); - term_fresh(); + if (need_term_fresh()) + term_fresh(); } object_type forge; -- 2.11.0