OSDN Git Service

[Fix] delay=0のとき射撃/魔法の描写をカット
authordis- <dis.rogue@gmail.com>
Sun, 31 Jan 2021 04:07:03 +0000 (13:07 +0900)
committerdis- <dis.rogue@gmail.com>
Sun, 31 Jan 2021 04:07:03 +0000 (13:07 +0900)
delay=0のときに不要な再描写がかかり動作を重くしていた。
該当の場合に画面再描写をキャンセルし挙動を軽快にする。

src/cmd-item/cmd-throw.c
src/combat/shoot.c

index 6fb39a9..e85e612 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 (it_ptr->msec > 0) {
+        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,13 +434,15 @@ 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 (it_ptr->msec > 0) {
+            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 6d6712a..4bde8d5 100644 (file)
@@ -548,18 +548,22 @@ void exe_fire(player_type *shooter_ptr, INVENTORY_IDX item, object_type *j_ptr,
                 byte a = object_attr(q_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 (msec > 0) {
+                    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();
+                }
             }
 
             /* The player cannot see the missile */
             else {
-                /* Pause anyway, for consistancy */
-                term_xtra(TERM_XTRA_DELAY, msec);
+                /* Pause anyway, for consistancy **/
+                if (msec > 0) {
+                    term_xtra(TERM_XTRA_DELAY, msec);
+                }
             }
 
             /* Sniper */
@@ -770,10 +774,12 @@ void exe_fire(player_type *shooter_ptr, INVENTORY_IDX item, object_type *j_ptr,
 
                                 update_monster(shooter_ptr, c_mon_ptr->m_idx, TRUE);
 
-                                lite_spot(shooter_ptr, ny, nx);
-                                lite_spot(shooter_ptr, oy, ox);
-                                term_fresh();
-                                term_xtra(TERM_XTRA_DELAY, msec);
+                                if (msec > 0) {
+                                    lite_spot(shooter_ptr, ny, nx);
+                                    lite_spot(shooter_ptr, oy, ox);
+                                    term_fresh();
+                                    term_xtra(TERM_XTRA_DELAY, msec);
+                                }
 
                                 x = nx;
                                 y = ny;