OSDN Git Service

[Fix] fresh-afterコマンドの修正
authordis- <dis.rogue@gmail.com>
Tue, 26 Jan 2021 10:35:29 +0000 (19:35 +0900)
committerdis- <dis.rogue@gmail.com>
Tue, 26 Jan 2021 14:38:27 +0000 (23:38 +0900)
コマンド自動繰り返しにのみ効いていたfresh-afterをマクロ全般に拡張した。

15 files changed:
src/cmd-action/cmd-move.c
src/cmd-action/cmd-pet.c
src/cmd-item/cmd-throw.c
src/combat/shoot.c
src/core/window-redrawer.c
src/dungeon/dungeon-processor.c
src/effect/effect-processor.c
src/io/input-key-requester.c
src/mind/mind-mirror-master.c
src/spell-kind/spells-genocide.c
src/spell-kind/spells-sight.c
src/term/z-term.c
src/term/z-term.h
src/window/display-sub-window-spells.c
src/wizard/wizard-item-modifier.c

index 250afa5..0188bf0 100644 (file)
@@ -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();
 }
index 208412b..998de47 100644 (file)
@@ -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);
 
index ec34be7..5e2c1cf 100644 (file)
@@ -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);
index e41feaf..e5a9daa 100644 (file)
@@ -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;
index 135bd71..ad8faab 100644 (file)
@@ -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])
index f4e295d..f8d189d 100644 (file)
@@ -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;
index e4d5e95..e694a25 100644 (file)
@@ -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();
         }
     }
 
index b8a3891..2a80fd5 100644 (file)
@@ -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);
index cc91911..dd0a9e7 100644 (file)
@@ -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);
+                        }
                     }
                 }
             }
index dbaf394..75ed892 100644 (file)
@@ -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);
index 5f83261..3040cb9 100644 (file)
@@ -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);
index f925d5f..f43f6ef 100644 (file)
@@ -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
  */
index 989727e..8decb17 100644 (file)
@@ -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);
index 5459e5f..d4e7fd5 100644 (file)
@@ -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);
     }
 }
index 92eeb09..de18096 100644 (file)
@@ -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;