implement #986 - camera flash 'tweak'
Implement the suggested feature that a camera's flash actually update hero's memory of the map as it traverses across the level. Turned out to be more work than anticipated despite having the code for a thrown or kicked lit candle or lamp to build upon. Among other things it needed to update the circle code to handle previously unused radius 0 to operate on the center point only. I've never touched that before and hope this hasn't introduced any bugs. Also removes several instances of vision code operating on column #0. (At least one is still present.)
This commit is contained in:
22
src/uhitm.c
22
src/uhitm.c
@@ -3110,14 +3110,21 @@ struct monst *mon;
|
||||
u.umconf--;
|
||||
}
|
||||
|
||||
/* returns 1 if light flash has noticeable effect on 'mtmp', 0 otherwise */
|
||||
int
|
||||
flash_hits_mon(mtmp, otmp)
|
||||
struct monst *mtmp;
|
||||
struct obj *otmp; /* source of flash */
|
||||
{
|
||||
int tmp, amt, res = 0, useeit = canseemon(mtmp);
|
||||
struct rm *lev;
|
||||
int tmp, amt, useeit, res = 0;
|
||||
|
||||
if (mtmp->msleeping) {
|
||||
if (g.notonhead)
|
||||
return 0;
|
||||
lev = &levl[mtmp->mx][mtmp->my];
|
||||
useeit = canseemon(mtmp);
|
||||
|
||||
if (mtmp->msleeping && haseyes(mtmp->data)) {
|
||||
mtmp->msleeping = 0;
|
||||
if (useeit) {
|
||||
pline_The("flash awakens %s.", mon_nam(mtmp));
|
||||
@@ -3144,8 +3151,19 @@ struct obj *otmp; /* source of flash */
|
||||
mtmp->mcansee = 0;
|
||||
mtmp->mblinded = (tmp < 3) ? 0 : rnd(1 + 50 / tmp);
|
||||
}
|
||||
} else if (flags.verbose && useeit) {
|
||||
if (lev->lit)
|
||||
pline("The flash of light shines on %s.", mon_nam(mtmp));
|
||||
else
|
||||
pline("%s is illuminated.", Monnam(mtmp));
|
||||
res = 2; /* 'message has been given' temporary value */
|
||||
}
|
||||
}
|
||||
if (res) {
|
||||
if (!lev->lit)
|
||||
display_nhwindow(WIN_MESSAGE, TRUE);
|
||||
res &= 1; /* change temporary 2 back to 0 */
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user