1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2026-03-17 02:29:44 +00:00

movei used in more places, also improved push in shmup

This commit is contained in:
Zeno Rogue
2019-11-22 17:31:23 +01:00
parent 8ddd95d44e
commit 2172ca6fd7
4 changed files with 97 additions and 85 deletions

View File

@@ -1062,10 +1062,9 @@ void movePlayer(monster *m, int delta) {
}
}
else if(isPushable(c2->wall) && !nonAdjacent(c2, m->base)) {
int sd = neighborId(c2, m->base);
int sd = neighborId(m->base, c2);
int subdir = 1;
double bestd = 9999;
pushmonsters();
for(int di=-1; di<2; di+=2) {
cell *c = c2->modmove(sd+di);
if(!c) continue;
@@ -1073,16 +1072,11 @@ void movePlayer(monster *m, int delta) {
double d = sqdist(gmatrix[c] * C0, m->pat * C0);
if(d<bestd) bestd=d, subdir = di;
}
pushmonsters();
auto mip = determinePush(cellwalker(c2, sd), subdir, [m, c2] (cell *c) { return canPushThumperOn(c, c2, m->base); });
visibleFor(300);
cellwalker push(c2, neighborId(c2, m->base));
push = push + 3 * (-subdir) + wstep;
if(!canPushThumperOn(push.at, c2, m->base) && c2->type == 7) {
push = push + wstep - subdir + wstep;
}
if(!canPushThumperOn(push.at, c2, m->base)) {
go = false;
}
else pushThumper(c2, push.at);
if(!mip.proper()) go = false;
else pushThumper(mip);
popmonsters();
}
else if(c2->wall == waRose && !nonAdjacent(m->base, c2)) {