integrate aklys feature introduced in 3.6.1 into display

(cherry picked from commit 3fe8325f14)
This commit is contained in:
nhmall
2018-04-29 10:40:11 -04:00
parent 340ff13a1d
commit cc1d43fad4
8 changed files with 98 additions and 26 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 display.c $NHDT-Date: 1524780381 2018/04/26 22:06:21 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.90 $ */
/* NetHack 3.6 display.c $NHDT-Date: 1525012604 2018/04/29 14:36:44 $ $NHDT-Branch: master $:$NHDT-Revision: 1.91 $ */
/* Copyright (c) Dean Luick, with acknowledgements to Kevin Darcy */
/* and Dave Cohrs, 1990. */
/* NetHack may be freely redistributed. See license for details. */
@@ -892,6 +892,15 @@ xchar x, y;
}
}
int
tether_glyph(x, y)
{
int tdx, tdy;
tdx = u.ux - x;
tdy = u.uy - y;
return zapdir_to_glyph(sgn(tdx),sgn(tdy), 2);
}
/*
* tmp_at()
*
@@ -912,6 +921,9 @@ xchar x, y;
*
* DISP_BEAM - Display the given glyph at each location, but do not erase
* any until the close call.
* DISP_TETHER- Display a tether glyph at each location, and the tethered
* object at the farthest location, but do not erase any
* until the return trip or close.
* DISP_FLASH - Display the given glyph at each location, but erase the
* previous location's glyph.
* DISP_ALWAYS- Like DISP_FLASH, but vision is not taken into account.
@@ -937,6 +949,7 @@ int x, y;
switch (x) {
case DISP_BEAM:
case DISP_ALL:
case DISP_TETHER:
case DISP_FLASH:
case DISP_ALWAYS:
if (!tglyph)
@@ -979,6 +992,22 @@ int x, y;
/* Erase (reset) from source to end */
for (i = 0; i < tglyph->sidx; i++)
newsym(tglyph->saved[i].x, tglyph->saved[i].y);
} else if (tglyph->style == DISP_TETHER) {
int i;
if (y == BACKTRACK && tglyph->sidx > 1) {
/* backtrack */
for (i = tglyph->sidx - 1; i > 0; i--) {
newsym(tglyph->saved[i].x, tglyph->saved[i].y);
show_glyph(tglyph->saved[i - 1].x,
tglyph->saved[i - 1].y, tglyph->glyph);
flush_screen(0); /* make sure it shows up */
delay_output();
}
tglyph->sidx = 1;
}
for (i = 0; i < tglyph->sidx; i++)
newsym(tglyph->saved[i].x, tglyph->saved[i].y);
} else { /* DISP_FLASH or DISP_ALWAYS */
if (tglyph->sidx) /* been called at least once */
newsym(tglyph->saved[0].x, tglyph->saved[0].y);
@@ -1002,6 +1031,20 @@ int x, y;
tglyph->saved[tglyph->sidx].x = x;
tglyph->saved[tglyph->sidx].y = y;
tglyph->sidx += 1;
} else if (tglyph->style == DISP_TETHER) {
if (tglyph->sidx >= TMP_AT_MAX_GLYPHS)
break; /* too many locations */
if (tglyph->sidx) {
int px, py;
px = tglyph->saved[tglyph->sidx-1].x;
py = tglyph->saved[tglyph->sidx-1].y;
show_glyph(px, py, tether_glyph(px, py));
}
/* save pos for later use or erasure */
tglyph->saved[tglyph->sidx].x = x;
tglyph->saved[tglyph->sidx].y = y;
tglyph->sidx += 1;
} else { /* DISP_FLASH/ALWAYS */
if (tglyph->sidx) { /* not first call, so reset previous pos */
newsym(tglyph->saved[0].x, tglyph->saved[0].y);