domove_core() out of domove(); assess domove_core() results

new domove_core() assessment results

potentially smudge engravings

Proceed to wipe engraving after domove_core() now, but only under
all of the following conditions:
    - you can reach the floor
    - preceding domove_core() move attempt was marked as
      having succeeded in domove_core()
    - there is actually an engraving there to impact at
      your original spot, or your new spot, or both
This commit is contained in:
nhmall
2019-01-27 11:55:23 -05:00
parent d63c9d866c
commit 55fdfb9200
5 changed files with 64 additions and 17 deletions

View File

@@ -16,6 +16,8 @@ STATIC_DCL boolean FDECL(trapmove, (int, int, struct trap *));
STATIC_DCL struct monst *FDECL(monstinroom, (struct permonst *, int));
STATIC_DCL boolean FDECL(doorless_door, (int, int));
STATIC_DCL void FDECL(move_update, (BOOLEAN_P));
STATIC_DCL void FDECL(maybe_smudge_engr, (int, int, int, int));
STATIC_DCL void NDECL(domove_core);
#define IS_SHOP(x) (rooms[x].rtype >= SHOPBASE)
@@ -1329,6 +1331,19 @@ u_rooted()
void
domove()
{
int ux1 = u.ux, uy1 = u.uy;
domove_succeeded = 0L;
domove_core();
/* domove_succeeded is available for making assessments now */
if ((domove_succeeded & (DOMOVE_RUSH | DOMOVE_WALK)) != 0)
maybe_smudge_engr(ux1, uy1, u.ux, u.uy);
domove_attempting = 0L;
}
void
domove_core()
{
register struct monst *mtmp;
register struct rm *tmpr;
@@ -1341,8 +1356,6 @@ domove()
int bc_control = 0; /* control for ball&chain */
boolean cause_delay = FALSE; /* dragging ball will skip a move */
u_wipe_engr(rnd(5));
if (context.travel) {
if (!findtravelpath(FALSE))
(void) findtravelpath(TRUE);
@@ -1860,6 +1873,8 @@ domove()
check_leash(u.ux0, u.uy0);
if (u.ux0 != u.ux || u.uy0 != u.uy) {
/* let caller know so that an evaluation may take place */
domove_succeeded |= (domove_attempting & (DOMOVE_RUSH | DOMOVE_WALK));
u.umoved = TRUE;
/* Clean old position -- vision_recalc() will print our new one. */
newsym(u.ux0, u.uy0);
@@ -1899,6 +1914,21 @@ domove()
}
}
void
maybe_smudge_engr(x1,y1,x2,y2)
int x1, y1, x2, y2;
{
struct engr *ep;
if (can_reach_floor(TRUE)) {
if ((ep = engr_at(x1, y1)) && ep->engr_type != HEADSTONE)
wipe_engr_at(x1, y1, rnd(5), FALSE);
if ((x2 != x1 || y2 != y1)
&& (ep = engr_at(x2, y2)) && ep->engr_type != HEADSTONE)
wipe_engr_at(x2, y2, rnd(5), FALSE);
}
}
/* combat increases metabolism */
boolean
overexertion()