From e42488ca1049228afb739afc978a6f29e1d0ad7e Mon Sep 17 00:00:00 2001 From: PatR Date: Sun, 10 Oct 2021 18:05:11 -0700 Subject: [PATCH] and even more boulders... Revise the m-toward-boulder handling to let a hero who would be able to squeese into the boulder's spot if it was blocked from being pushed to do the squeeze without any pushing. Unlike the previous changes, this might have an impact on play. It allows squeezing under then stepping past an unblocked boulder that's in a corridor in order to be able to push it back the other direction where maybe there's more room to maneuver it out of the way. --- doc/fixes37.0 | 3 ++- src/hack.c | 33 +++++++++++++++++++++------------ 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/doc/fixes37.0 b/doc/fixes37.0 index 49a4a3ef5..3f8066990 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -640,7 +640,8 @@ blessed scroll of remove curse read while confused blesses or curses any object traversal would process items on the floor at hero's spot instead of the rest of inventory can now use m to try to move to an adjacent boulder's spot without - pushing it; hero poly'd into a giant will succeed, others will fail + pushing it; hero poly'd into a giant or a tiny creature or carrying so + little as to be able to squeeze there will succeed, others will fail Fixes to 3.7.0-x Problems that Were Exposed Via git Repository diff --git a/src/hack.c b/src/hack.c index da66a9ea6..d0b4e5977 100644 --- a/src/hack.c +++ b/src/hack.c @@ -94,6 +94,8 @@ revive_nasty(int x, int y, const char *msg) return revived; } +#define squeezeablylightinvent() (!g.invent || inv_weight() <= -850) + static int moverock(void) { @@ -124,11 +126,14 @@ moverock(void) ry = u.uy + 2 * u.dy; nomul(0); - /* using m towards an adjacent boulder steps over/onto it - if poly'd into a giant but is a no-op in other circumstances - unless the move attempt reveals an unseen boulder or lack of - remembered, unseen monster */ + /* using m towards an adjacent boulder steps over/onto it if + poly'd into a giant or squeezes under/beside it if small/light + enough but is a no-op in other circumstances unless move attempt + reveals an unseen boulder or lack of remembered, unseen monster */ if (g.context.nopick) { + int oldglyph = glyph_at(sx, sy); /* before feel_location() */ + + feel_location(sx, sy); /* same for all 3 if/else-if/else cases */ if (throws_rocks(g.youmonst.data)) { /* player has used 'm' to move, so step to boulder's spot without pushing it; hero is poly'd into a giant, @@ -139,10 +144,12 @@ moverock(void) /* ["over" seems weird on air level but what else to say?] */ sokoban_guilt(); res = 0; /* move to */ + } else if (!u.usteed && (squeezeablylightinvent() + || verysmall(g.youmonst.data))) { + You("squeeze yourself against the boulder."); + sokoban_guilt(); + res = 0; /* move to */ } else { - int oldglyph = glyph_at(sx, sy); - - feel_location(sx, sy); There("is a boulder in your way."); /* use a move if hero learns something; see test_move() for how/why 'context.door_opened' is being dragged into this */ @@ -424,11 +431,13 @@ moverock(void) break; } - if (!u.usteed - && (((!g.invent || inv_weight() <= -850) - && (!u.dx || !u.dy || (IS_ROCK(levl[u.ux][sy].typ) - && IS_ROCK(levl[sx][u.uy].typ)))) - || verysmall(g.youmonst.data))) { + /* similar to m above, but that doesn't care if you're + moving orthogonally or toward a diagonal squeeze */ + if (!u.usteed && ((squeezeablylightinvent() + && (!u.dx || !u.dy + || (IS_ROCK(levl[u.ux][sy].typ) + && IS_ROCK(levl[sx][u.uy].typ)))) + || verysmall(g.youmonst.data))) { pline( "However, you can squeeze yourself into a small opening."); sokoban_guilt();