/*
+ * For delayed visual update
+ */
+#define cave_note_and_redraw_later(C,Y,X) \
+{\
+ (C)->info |= CAVE_NOTE; \
+ cave_redraw_later((C), (Y), (X)); \
+}
+
+
+/*
+ * For delayed visual update
+ */
+#define cave_redraw_later(C,Y,X) \
+{\
+ if (!((C)->info & CAVE_REDRAW)) \
+ { \
+ (C)->info |= CAVE_REDRAW; \
+ redraw_y[redraw_n] = (Y); \
+ redraw_x[redraw_n++] = (X); \
+ } \
+}
+
+
+/*
* XXX XXX XXX
*
* This macro allows us to efficiently add a grid to the "lite" array,
{
int i, x, y, min_x, max_x, min_y, max_y;
int p = p_ptr->cur_lite;
+ cave_type *c_ptr;
/*** Special case ***/
/* Forget the old lite */
/* forget_lite(); Perhaps don't need? */
- /* Draw the player */
- lite_spot(py, px);
+ /* Add it to later visual update */
+ cave_redraw_later(&cave[py][px], py, px);
}
#endif
y = lite_y[i];
x = lite_x[i];
- /* Update fresh grids */
- if (cave[y][x].info & (CAVE_TEMP)) continue;
+ c_ptr = &cave[y][x];
- /* Note */
- note_spot(y, x);
+ /* Update fresh grids */
+ if (c_ptr->info & (CAVE_TEMP)) continue;
- /* Redraw */
- lite_spot(y, x);
+ /* Add it to later visual update */
+ cave_note_and_redraw_later(c_ptr, y, x);
}
/* Clear them all */
y = temp_y[i];
x = temp_x[i];
+ c_ptr = &cave[y][x];
+
/* No longer in the array */
- cave[y][x].info &= ~(CAVE_TEMP);
+ c_ptr->info &= ~(CAVE_TEMP);
/* Update stale grids */
- if (cave[y][x].info & (CAVE_LITE)) continue;
+ if (c_ptr->info & (CAVE_LITE)) continue;
- /* Redraw */
- lite_spot(y, x);
+ /* Add it to later visual update */
+ cave_redraw_later(c_ptr, y, x);
}
/* None left */
temp_n = 0;
+
+ /* Mega-Hack -- Visual update later */
+ p_ptr->update |= (PU_DELAY_VIS);
}
/* It it no longer lit? */
if (!(c_ptr->info & CAVE_MNLT) && player_has_los_grid(c_ptr))
{
- /* It is now unlit */
- note_spot(fy, fx);
- lite_spot(fy, fx);
+ /* Add it to later visual update */
+ cave_note_and_redraw_later(c_ptr, fy, fx);
}
/* Add to end of temp array */
if ((c_ptr->info & (CAVE_VIEW | CAVE_TEMP)) == CAVE_VIEW)
{
/* It is now lit */
-
- /* Note */
- note_spot(fy, fx);
-
- /* Redraw */
- lite_spot(fy, fx);
+ /* Add it to later visual update */
+ cave_note_and_redraw_later(c_ptr, fy, fx);
}
/* Save in the monster lit array */
/* Finished with temp_n */
temp_n = 0;
+ /* Mega-Hack -- Visual update later */
+ p_ptr->update |= (PU_DELAY_VIS);
+
p_ptr->monlite = (cave[py][px].info & CAVE_MNLT) ? TRUE : FALSE;
if (p_ptr->special_defense & NINJA_S_STEALTH)
/* Update only newly viewed grids */
if (c_ptr->info & (CAVE_TEMP)) continue;
- /* Note */
- note_spot(y, x);
-
- /* Redraw */
- lite_spot(y, x);
+ /* Add it to later visual update */
+ cave_note_and_redraw_later(c_ptr, y, x);
}
/* Wipe the old grids, update as needed */
/* Update only non-viewable grids */
if (c_ptr->info & (CAVE_VIEW)) continue;
- /* Redraw */
- lite_spot(y, x);
+ /* Add it to later visual update */
+ cave_redraw_later(c_ptr, y, x);
}
/* None left */
temp_n = 0;
+
+ /* Mega-Hack -- Visual update later */
+ p_ptr->update |= (PU_DELAY_VIS);
}
+/*
+ * Mega-Hack -- Delayed visual update
+ * Only used if update_view(), update_lite() or update_mon_lite() was called
+ */
+void delayed_visual_update(void)
+{
+ int i, y, x;
+ cave_type *c_ptr;
+
+ /* Update needed grids */
+ for (i = 0; i < redraw_n; i++)
+ {
+ y = redraw_y[i];
+ x = redraw_x[i];
+
+ /* Access the grid */
+ c_ptr = &cave[y][x];
+
+ /* Update only needed grids (prevent multiple updating) */
+ if (!(c_ptr->info & CAVE_REDRAW)) continue;
+
+ /* If required, note */
+ if (c_ptr->info & CAVE_NOTE) note_spot(y, x);
+
+ /* Redraw */
+ lite_spot(y, x);
+
+ /* Hack -- Visual update of monster on this grid */
+ if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE);
+
+ /* No longer in the array */
+ c_ptr->info &= ~(CAVE_NOTE | CAVE_REDRAW);
+ }
+
+ /* None left */
+ redraw_n = 0;
+}
+
/*
* Hack -- forget the "flow" information
/* Used only after cave generation */
#define CAVE_XXXX1 0x0200
-#define CAVE_XXXX2 0x0400
-#define CAVE_XXXX3 0x0800
-#define CAVE_OBJECT 0x1000 /* mirror */
+#define CAVE_NOTE 0x0400 /* Flag for delayed visual update (needs note_spot()) */
+#define CAVE_REDRAW 0x0800 /* Flag for delayed visual update (needs lite_spot()) */
+#define CAVE_OBJECT 0x1000 /* mirror */
#define CAVE_UNSAFE 0x2000 /* Might have trap */
#define CAVE_IN_DETECT 0x4000 /* trap detected area (inner circle only) */
#define PU_VIEW 0x00100000L /* Update view */
#define PU_LITE 0x00200000L /* Update lite */
#define PU_MON_LITE 0x00400000L /* Monster illumination */
-/* xxx */
+#define PU_DELAY_VIS 0x00800000L /* Mega-Hack -- Delayed visual update */
#define PU_MONSTERS 0x01000000L /* Update monsters */
#define PU_DISTANCE 0x02000000L /* Update distances */
/* xxx */