make display effect code reusable and move it to display.c

This commit is contained in:
nhmall
2019-06-08 23:19:29 -04:00
parent ea9a385d67
commit 54d24d0333
3 changed files with 28 additions and 13 deletions

View File

@@ -360,6 +360,7 @@ E void FDECL(newsym, (int, int));
E void FDECL(newsym_force, (int, int));
E void FDECL(shieldeff, (XCHAR_P, XCHAR_P));
E void FDECL(tmp_at, (int, int));
E void FDECL(flash_glyph_at, (int, int, int));
E void FDECL(swallowed, (int));
E void FDECL(under_ground, (int));
E void FDECL(under_water, (int));

View File

@@ -1067,6 +1067,28 @@ int x, y;
} /* end case */
}
/*
* flash_glyph_at(x, y, glyph)
*
* Briefly flash between the passed glyph and the glyph that's
* meant to be at the location.
*/
void
flash_glyph_at(x, y, tg)
int x, y, tg;
{
int i, glyph[2];
glyph[0] = tg;
glyph[1] = glyph_at(x, y);
for (i = 0; i < 15; i++) {
show_glyph(x, y, glyph[i % 2]);
flush_screen(1);
delay_output();
}
newsym(x, y);
}
/*
* swallowed()
*

View File

@@ -2579,21 +2579,13 @@ struct _create_particular_data *d;
if (d->sleeping)
mtmp->msleeping = 1;
if (d->hidden && is_hider(mtmp->data)) {
if (wizard && cansee(mtmp->mx, mtmp->my)) {
int i, glyph[2];
int saveglyph = glyph_at(mtmp->mx, mtmp->my);
glyph[0] = glyph_at(mtmp->mx, mtmp->my);
mtmp->mundetected = 1;
newsym(mtmp->mx, mtmp->my);
glyph[1] = glyph_at(mtmp->mx, mtmp->my);
if (!canseemon(mtmp) && !sensemon(mtmp))
for (i = 0; i < 15; i++) {
show_glyph(mtmp->mx, mtmp->my, glyph[i % 2]);
flush_screen(1);
delay_output();
}
}
mtmp->mundetected = 1;
newsym(mtmp->mx, mtmp->my);
if (wizard && cansee(mtmp->mx, mtmp->my))
if (!canseemon(mtmp) && !sensemon(mtmp))
flash_glyph_at(mtmp->mx, mtmp->my, saveglyph);
}
madeany = TRUE;
/* in case we got a doppelganger instead of what was asked