Skip to content

Commit

Permalink
Merge branch 'updates' into merges
Browse files Browse the repository at this point in the history
  • Loading branch information
elunna committed Dec 7, 2024
2 parents 1971659 + 863d455 commit b268b15
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 24 deletions.
2 changes: 2 additions & 0 deletions include/extern.h
Original file line number Diff line number Diff line change
Expand Up @@ -1856,6 +1856,8 @@ extern void adj_erinys(unsigned);
extern boolean calculate_flankers(struct monst *, struct monst *);
extern coord find_flanking_pos(struct monst *, struct monst *);
extern int flank_bonus(struct monst *);
extern void see_monster_closeup(struct monst *) NONNULLARG1;
extern void see_nearby_monsters(void);

/* ### mondata.c ### */

Expand Down
23 changes: 0 additions & 23 deletions src/allmain.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

staticfn void moveloop_preamble(boolean);
staticfn void u_calc_moveamt(int);
staticfn void see_nearby_monsters(void);
#ifdef POSITIONBAR
staticfn void do_positionbar(void);
#endif
Expand Down Expand Up @@ -155,28 +154,6 @@ u_calc_moveamt(int wtcap)
u.umovement = 0;
}

/* mark a monster type as seen when we see it next to us */
staticfn void
see_nearby_monsters(void)
{
coordxy x, y;

if (Blind || !Role_if(PM_TOURIST))
return;

for (x = u.ux - 1; x <= u.ux + 1; x++)
for (y = u.uy - 1; y <= u.uy + 1; y++)
if (isok(x, y) && MON_AT(x, y)) {
struct monst *mtmp = m_at(x, y);

if (canseemon(mtmp) && !svm.mvitals[monsndx(mtmp->data)].seen_close) {
svm.mvitals[monsndx(mtmp->data)].seen_close = TRUE;
more_experienced(experience(mtmp, 0), 0);
newexplevel();
}
}
}

#if defined(MICRO) || defined(WIN32)
static int mvl_abort_lev;
#endif
Expand Down
5 changes: 4 additions & 1 deletion src/apply.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,11 @@ do_blinding_ray(struct obj *obj)
(int (*) (OBJ_P, OBJ_P)) 0, &obj);

obj->ox = u.ux, obj->oy = u.uy; /* flash_hits_mon() wants this */
if (mtmp)
if (mtmp) {
(void) flash_hits_mon(mtmp, obj);
if (obj->otyp == EXPENSIVE_CAMERA)
see_monster_closeup(mtmp);
}
/* normally bhit() would do this but for FLASHED_LIGHT we want it
to be deferred until after flash_hits_mon() */
transient_light_cleanup();
Expand Down
34 changes: 34 additions & 0 deletions src/mon.c
Original file line number Diff line number Diff line change
Expand Up @@ -7329,4 +7329,38 @@ msummon_dies(struct monst *mtmp)
}
}


/* mark monster type as seen from close-up */
void
see_monster_closeup(struct monst *mtmp)
{
if (!svm.mvitals[monsndx(mtmp->data)].seen_close) {
svm.mvitals[monsndx(mtmp->data)].seen_close = TRUE;
if (Role_if(PM_TOURIST)) {
more_experienced(experience(mtmp, 0), 0);
newexplevel();
}
}
}

/* mark a monster type as seen clse-up when we see it next to us */
void
see_nearby_monsters(void)
{
coordxy x, y;

/* currently used only for tourists ... */
if (Blind || !Role_if(PM_TOURIST))
return;

for (x = u.ux - 1; x <= u.ux + 1; x++)
for (y = u.uy - 1; y <= u.uy + 1; y++)
if (isok(x, y) && MON_AT(x, y)) {
struct monst *mtmp = m_at(x, y);

if (canseemon(mtmp))
see_monster_closeup(mtmp);
}
}

/*mon.c*/

0 comments on commit b268b15

Please sign in to comment.