From 5f3c58154ce4720eefbe954865ea661220a4985c Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Sun, 8 Jan 2023 04:01:14 +0100 Subject: [PATCH] fixed Princess using boat --- environment.cpp | 12 ++++++++---- passable.cpp | 11 ++++------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/environment.cpp b/environment.cpp index 52e8e74d..9acffdbe 100644 --- a/environment.cpp +++ b/environment.cpp @@ -239,11 +239,15 @@ EX void computePathdist(eMonster param, bool include_allies IS(true)) { // printf("i=%d cd=%d\n", i, c->move(i)->cpdist); cell *c2 = cw1.peek(); - flagtype f = P_MONSTER | P_REVDIR; - if(param == moTameBomberbird) f |= P_FLYING; + flagtype f = P_MONSTER; + if(param == moTameBomberbird) f |= P_FLYING | P_ISFRIEND; + if(isPrincess(param)) f |= P_ISFRIEND | P_USEBOAT | P_CHAIN; + if(param == moGolem) f |= P_ISFRIEND; + bool pass = c2 && c2->pathdist == PINFD; + if(pass && qb < qtarg && !nonAdjacent(c, c2) && !thruVine(c,c2)) pass = passable(c2, NULL, f); + else pass = pass && passable(c, c2, f); - if(c2 && c2->pathdist == PINFD && - passable(c2, (qb= qtarg) { if(param == moTortoise && nogoSlow(c, c2)) continue; diff --git a/passable.cpp b/passable.cpp index 42d8a463..a5f8f910 100644 --- a/passable.cpp +++ b/passable.cpp @@ -104,7 +104,7 @@ EX bool anti_alchemy(cell *w, cell *from) { #if HDR #define P_MONSTER Flag(0) // can move through monsters #define P_MIRROR Flag(1) // can move through mirrors -#define P_REVDIR Flag(2) // reverse direction movement +// unused #define P_WIND Flag(3) // can move against the wind #define P_GRAVITY Flag(4) // can move against the gravity #define P_ISPLAYER Flag(5) // player-only moves (like the Round Table jump) @@ -141,8 +141,7 @@ EX bool anti_alchemy(cell *w, cell *from) { #endif EX bool passable(cell *w, cell *from, flagtype flags) { - bool revdir = (flags&P_REVDIR); - bool vrevdir = revdir ^ bool(flags&P_VOID); + bool vrevdir = bool(flags&P_VOID); if(from && from != w && nonAdjacent(from, w) && !F(P_IGNORE37 | P_BULLET)) return false; @@ -151,7 +150,6 @@ EX bool passable(cell *w, cell *from, flagtype flags) { for(cell *pp: player_positions()) { if(w == pp && F(P_ONPLAYER)) return true; - if(from == pp && F(P_ONPLAYER) && F(P_REVDIR)) return true; if(from && !((flags & P_ISPLAYER) && pp->monst)) { int i = vrevdir ? incline(w, from) : incline(from, w); @@ -180,9 +178,6 @@ EX bool passable(cell *w, cell *from, flagtype flags) { if(from && (vrevdir ? againstWind(from,w) : againstWind(w, from)) && !F(P_WIND | P_BLOW | P_JUMP1 | P_JUMP2 | P_BULLET | P_AETHER)) return false; - if(revdir && from && w->monst && passable(from, w, flags &~ (P_REVDIR|P_MONSTER))) - return true; - if(!shmup::on && sword::at(w, flags & P_ISPLAYER) && !F(P_DEADLY | P_BULLET | P_ROSE)) return false; @@ -267,6 +262,8 @@ EX bool passable(cell *w, cell *from, flagtype flags) { if(in_gravity_zone(w)) ; else if(from && from->wall == waBoat && F(P_USEBOAT) && (!againstCurrent(w, from) || F(P_MARKWATER)) && !(from->item == itOrbYendor)) ; + else if(from && isWatery(from) && F(P_CHAIN) && F(P_USEBOAT) && !againstCurrent(w, from)) ; + else if(!from && F(P_CHAIN) && F(P_USEBOAT)) ; else if(!F(P_AETHER | P_FISH | P_FLYING | P_BLOW | P_JUMP1 | P_BULLET | P_DEADLY | P_REPTILE)) return false; } if(isChasmy(w)) {