mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-01-23 15:36:59 +00:00
movei in more functions, also fixed wind crows
This commit is contained in:
parent
9b329ef901
commit
95c41684df
@ -643,7 +643,9 @@ struct info {
|
|||||||
else if(i) setdist(i, OUT_OF_PRISON);
|
else if(i) setdist(i, OUT_OF_PRISON);
|
||||||
}
|
}
|
||||||
|
|
||||||
EX void move(cell *ct, cell *cf) {
|
EX void move(const movei& mi) {
|
||||||
|
auto& cf = mi.s;
|
||||||
|
auto& ct = mi.t;
|
||||||
if(euclid) return;
|
if(euclid) return;
|
||||||
princess::info *i = princess::getPrincessInfo(cf);
|
princess::info *i = princess::getPrincessInfo(cf);
|
||||||
if(!i) {
|
if(!i) {
|
||||||
@ -2641,7 +2643,9 @@ EX namespace dragon {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EX bool move(cell *dt, cell *df) {
|
EX bool move(const movei& mi) {
|
||||||
|
auto& df = mi.s;
|
||||||
|
auto& dt = mi.t;
|
||||||
if(df->monst == moDragonHead) {
|
if(df->monst == moDragonHead) {
|
||||||
dt->mondir = neighborId(dt,df);
|
dt->mondir = neighborId(dt,df);
|
||||||
// printf("pull back\n");
|
// printf("pull back\n");
|
||||||
|
20
game.cpp
20
game.cpp
@ -3616,7 +3616,7 @@ EX void moveEffect(const movei& mi, eMonster m) {
|
|||||||
ct->wparam = 1;
|
ct->wparam = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cf && isPrincess(m)) princess::move(ct, cf);
|
if(cf && isPrincess(m)) princess::move(mi);
|
||||||
|
|
||||||
if(cf && m == moTortoise) {
|
if(cf && m == moTortoise) {
|
||||||
tortoise::emap[ct] = tortoise::getb(cf);
|
tortoise::emap[ct] = tortoise::getb(cf);
|
||||||
@ -4979,7 +4979,9 @@ EX bool isTargetOrAdjacent(cell *c) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
EX void groupmove2(cell *c, cell *from, int d, eMonster movtype, flagtype mf) {
|
EX void groupmove2(const movei& mi, eMonster movtype, flagtype mf) {
|
||||||
|
auto& c = mi.s;
|
||||||
|
auto& from = mi.t; // note: we are moving from 'c' to 'from'!'
|
||||||
if(!c) return;
|
if(!c) return;
|
||||||
|
|
||||||
if(c->pathdist == 0) return;
|
if(c->pathdist == 0) return;
|
||||||
@ -5002,7 +5004,7 @@ EX void groupmove2(cell *c, cell *from, int d, eMonster movtype, flagtype mf) {
|
|||||||
passable_for(movtype, from, c, P_CHAIN | P_MONSTER)
|
passable_for(movtype, from, c, P_CHAIN | P_MONSTER)
|
||||||
&& passable_for(movtype, c, c2, P_CHAIN | P_MONSTER);
|
&& passable_for(movtype, c, c2, P_CHAIN | P_MONSTER);
|
||||||
c3->monst = m2;
|
c3->monst = m2;
|
||||||
if(ok) groupmove2(c2, c, d, movtype, mf);
|
if(ok) groupmove2(movei(c, d).rev(), movtype, mf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else return;
|
else return;
|
||||||
@ -5064,11 +5066,11 @@ EX void groupmove2(cell *c, cell *from, int d, eMonster movtype, flagtype mf) {
|
|||||||
if(from->cpdist == 0 || from->monst) { onpath(c, 0); return; }
|
if(from->cpdist == 0 || from->monst) { onpath(c, 0); return; }
|
||||||
|
|
||||||
if(movtype == moDragonHead) {
|
if(movtype == moDragonHead) {
|
||||||
dragon::move(from, c);
|
dragon::move(mi);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
moveMonster(movei(from, d).rev());
|
moveMonster(mi);
|
||||||
onpath(from, 0);
|
onpath(from, 0);
|
||||||
}
|
}
|
||||||
onpath(c, 0);
|
onpath(c, 0);
|
||||||
@ -5088,7 +5090,7 @@ EX void groupmove(eMonster movtype, flagtype mf) {
|
|||||||
if(!c->monst) continue;
|
if(!c->monst) continue;
|
||||||
if(isFriendlyOrBug(c)) continue;
|
if(isFriendlyOrBug(c)) continue;
|
||||||
forCellIdEx(c2, d, c) if(c2->monst && isMounted(c2)) {
|
forCellIdEx(c2, d, c) if(c2->monst && isMounted(c2)) {
|
||||||
groupmove2(c2,c,d,movtype,mf);
|
groupmove2(movei(c,d).rev(),movtype,mf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5114,12 +5116,12 @@ EX void groupmove(eMonster movtype, flagtype mf) {
|
|||||||
|
|
||||||
while(qdirtable--) {
|
while(qdirtable--) {
|
||||||
int t = dirtable[qdirtable];
|
int t = dirtable[qdirtable];
|
||||||
groupmove2(c->move(t),c,t,movtype,mf);
|
groupmove2(movei(c, t).rev(),movtype,mf);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(movtype == moEagle && c->monst == moNone && !isPlayerOn(c) && !bird_disruption(c)) {
|
if(movtype == moEagle && c->monst == moNone && !isPlayerOn(c) && !bird_disruption(c)) {
|
||||||
cell *c2 = whirlwind::jumpFromWhereTo(c, false);
|
cell *c2 = whirlwind::jumpFromWhereTo(c, false);
|
||||||
groupmove2(c2, c, NODIR, movtype, mf);
|
groupmove2(movei(c2, c, STRONGWIND), movtype, mf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8036,7 +8038,7 @@ EX void handle_switchplaces(cell *c1, cell *c2, bool& switchplaces) {
|
|||||||
princess::mouseSqueak(c2);
|
princess::mouseSqueak(c2);
|
||||||
else if(isPrincess(c2->monst)) {
|
else if(isPrincess(c2->monst)) {
|
||||||
princess::line(c2);
|
princess::line(c2);
|
||||||
princess::move(c1, c2);
|
princess::move(match(c2, c1));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
pswitch = true;
|
pswitch = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user