From ff4f81af1bf8eeaf8c6ae81c1c11fa0b7ed9dbed Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Sat, 21 Oct 2023 18:42:40 +0300 Subject: [PATCH] Make rolling boulders hit walls and trees While testing something else, I noticed rolling boulders just ignored walls and trees; in normal play this isn't a problem - but should probably make boulders handle other terrain too. Lava and water is already handled correctly. --- doc/fixes3-7-0.txt | 1 + src/trap.c | 27 ++++++++++++++++++--------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index b45e86c9a..3a7b7d34b 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -1262,6 +1262,7 @@ buff scroll of confuse monster and blessed potion of monster detection if a temple was entered while blind, #overview could show a line of just "." when describing altars if no other interesting features on that level were known +rolling boulders ignored walls and trees Fixes to 3.7.0-x General Problems Exposed Via git Repository diff --git a/src/trap.c b/src/trap.c index 621d7bc4c..32b161e4e 100644 --- a/src/trap.c +++ b/src/trap.c @@ -3294,16 +3294,25 @@ launch_obj( unblock_point(gb.bhitpos.x, gb.bhitpos.y); } - /* if about to hit iron bars, do so now */ - if (dist > 0 && isok(gb.bhitpos.x + dx, gb.bhitpos.y + dy) - && levl[gb.bhitpos.x + dx][gb.bhitpos.y + dy].typ == IRONBARS) { - x2 = gb.bhitpos.x, y2 = gb.bhitpos.y; /* object stops here */ - if (hits_bars(&singleobj, x2, y2, x2 + dx, y2 + dy, !rn2(20), 0)) { - if (!singleobj) { - used_up = TRUE; - launch_drop_spot((struct obj *) 0, 0, 0); + /* if about to hit something, do so now */ + if (dist > 0 && isok(gb.bhitpos.x + dx, gb.bhitpos.y + dy)) { + coordxy fx = gb.bhitpos.x + dx, fy = gb.bhitpos.y + dy; + uchar typ = levl[fx][fy].typ; + + if (typ == IRONBARS) { + x2 = gb.bhitpos.x, y2 = gb.bhitpos.y; /* object stops here */ + if (hits_bars(&singleobj, x2, y2, fx, fy, !rn2(20), 0)) { + if (!singleobj) { + used_up = TRUE; + launch_drop_spot((struct obj *) 0, 0, 0); + } + break; } - break; + } else if (IS_STWALL(typ) || IS_TREE(typ)) { + x2 = gb.bhitpos.x, y2 = gb.bhitpos.y; /* object stops here */ + if (!Deaf) + pline("Thump!"); + wake_nearto(x2, y2, 16); } } }