Hero movement affects water bubble direction

This commit is contained in:
Pasi Kallinen
2024-04-10 21:57:05 +03:00
parent 46370fc124
commit 62b78ba037
4 changed files with 27 additions and 1 deletions
+1
View File
@@ -1396,6 +1396,7 @@ unblind telepathy range depends on number of telepathy granting items worn
gold thrown or kicked at a sleeping monster with the 'greedy' attribute gets gold thrown or kicked at a sleeping monster with the 'greedy' attribute gets
caught instead of being treated as an attack but the catch message caught instead of being treated as an attack but the catch message
neglected to report that target monster was awakened in the process neglected to report that target monster was awakened in the process
hero movement affects the water bubble movement direction
Fixes to 3.7.0-x General Problems Exposed Via git Repository Fixes to 3.7.0-x General Problems Exposed Via git Repository
+1
View File
@@ -1550,6 +1550,7 @@ extern void movebubbles(void);
extern void water_friction(void); extern void water_friction(void);
extern void save_waterlevel(NHFILE *) NONNULLARG1; extern void save_waterlevel(NHFILE *) NONNULLARG1;
extern void restore_waterlevel(NHFILE *) NONNULLARG1; extern void restore_waterlevel(NHFILE *) NONNULLARG1;
extern void maybe_adjust_hero_bubble(void);
/* ### mkobj.c ### */ /* ### mkobj.c ### */
+3 -1
View File
@@ -2506,8 +2506,10 @@ domove(void)
gd.domove_succeeded = 0L; gd.domove_succeeded = 0L;
domove_core(); domove_core();
/* gd.domove_succeeded is available to make assessments now */ /* gd.domove_succeeded is available to make assessments now */
if ((gd.domove_succeeded & (DOMOVE_RUSH | DOMOVE_WALK)) != 0) if ((gd.domove_succeeded & (DOMOVE_RUSH | DOMOVE_WALK)) != 0) {
maybe_smudge_engr(ux1, uy1, u.ux, u.uy); maybe_smudge_engr(ux1, uy1, u.ux, u.uy);
maybe_adjust_hero_bubble();
}
gd.domove_attempting = 0L; gd.domove_attempting = 0L;
} }
+22
View File
@@ -1489,6 +1489,9 @@ fumaroles(void)
#define gbxmax (gx.xmax - 1) #define gbxmax (gx.xmax - 1)
#define gbymax (gy.ymax - 1) #define gbymax (gy.ymax - 1)
/* the bubble hero is in */
static struct bubble *hero_bubble = NULL;
staticfn void set_wportal(void); staticfn void set_wportal(void);
staticfn void mk_bubble(coordxy, coordxy, int); staticfn void mk_bubble(coordxy, coordxy, int);
staticfn void mv_bubble(struct bubble *, coordxy, coordxy, boolean); staticfn void mv_bubble(struct bubble *, coordxy, coordxy, boolean);
@@ -1513,6 +1516,8 @@ movebubbles(void)
vision_recalc(2); vision_recalc(2);
hero_bubble = NULL;
if (Is_waterlevel(&u.uz)) { if (Is_waterlevel(&u.uz)) {
/* keep attached ball&chain separate from bubble objects */ /* keep attached ball&chain separate from bubble objects */
if (Punished) if (Punished)
@@ -1583,6 +1588,7 @@ movebubbles(void)
cons->next = b->cons; cons->next = b->cons;
b->cons = cons; b->cons = cons;
hero_bubble = b;
} }
if ((btrap = t_at(x, y)) != 0) { if ((btrap = t_at(x, y)) != 0) {
cons = (struct container *) alloc(sizeof *cons); cons = (struct container *) alloc(sizeof *cons);
@@ -1875,6 +1881,22 @@ mk_bubble(coordxy x, coordxy y, int n)
mv_bubble(b, 0, 0, TRUE); mv_bubble(b, 0, 0, TRUE);
} }
/* maybe change the movement direction of the bubble hero is in */
void
maybe_adjust_hero_bubble(void)
{
if (!Is_waterlevel(&u.uz))
return;
if (!u.dx && !u.dy)
return;
if (hero_bubble && !rn2(2)) {
hero_bubble->dx = u.dx;
hero_bubble->dy = u.dy;
}
}
/* /*
* The player, the portal and all other objects and monsters * The player, the portal and all other objects and monsters
* float along with their associated bubbles. Bubbles may overlap * float along with their associated bubbles. Bubbles may overlap