mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-23 21:07:17 +00:00
added dragon dismounting easier
This commit is contained in:
parent
6a9453f8c9
commit
e45fb6bb20
17
flags.cpp
17
flags.cpp
@ -137,13 +137,20 @@ bool isFriendlyOrPlayer(eMonster m) {
|
|||||||
return isFriendly(m) || m == moPlayer;
|
return isFriendly(m) || m == moPlayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isFriendly(cell *c) {
|
bool isMounted(cell *c) {
|
||||||
if(items[itOrbDomination] && c->monst && c->monst != moTentacleGhost) {
|
if(c && c->monst && c->monst != moTentacleGhost) {
|
||||||
for(int i=0; i<numplayers(); i++)
|
for(int i=0; i<numplayers(); i++) {
|
||||||
if(sameMonster(c, playerpos(i)))
|
if(playerpos(i)->monst && sameMonster(c, playerpos(i)))
|
||||||
|
return true;
|
||||||
|
if(lastmountpos[i] && lastmountpos[i]->monst && sameMonster(c, lastmountpos[i]))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return isFriendly(c->monst);
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isFriendly(cell *c) {
|
||||||
|
return isMounted(c) || isFriendly(c->monst);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isBug(eMonster m) {
|
bool isBug(eMonster m) {
|
||||||
|
48
game.cpp
48
game.cpp
@ -482,7 +482,7 @@ bool passable(cell *w, cell *from, flagtype flags) {
|
|||||||
if(w == pp && F(P_ONPLAYER)) return true;
|
if(w == pp && F(P_ONPLAYER)) return true;
|
||||||
if(from == pp && F(P_ONPLAYER) && F(P_REVDIR)) return true;
|
if(from == pp && F(P_ONPLAYER) && F(P_REVDIR)) return true;
|
||||||
|
|
||||||
if(from && !((flags & P_ISPLAYER) && getMount(i))) {
|
if(from && !((flags & P_ISPLAYER) && pp->monst)) {
|
||||||
int i = vrevdir ? incline(w, from) : incline(from, w);
|
int i = vrevdir ? incline(w, from) : incline(from, w);
|
||||||
if(i < -1 && F(P_ROSE)) return false;
|
if(i < -1 && F(P_ROSE)) return false;
|
||||||
if((i > 1) && !F(P_JUMP1 | P_JUMP2 | P_BULLET | P_FLYING | P_BLOW | P_CLIMBUP | P_AETHER | P_REPTILE))
|
if((i > 1) && !F(P_JUMP1 | P_JUMP2 | P_BULLET | P_FLYING | P_BLOW | P_CLIMBUP | P_AETHER | P_REPTILE))
|
||||||
@ -2760,15 +2760,11 @@ void computePathdist(eMonster param) {
|
|||||||
pathqm.push_back(c);
|
pathqm.push_back(c);
|
||||||
continue; // no paths going through monsters
|
continue; // no paths going through monsters
|
||||||
}
|
}
|
||||||
for(int i=0; i<numplayers(); i++) {
|
if(isMounted(c) && !isPlayerOn(c)) {
|
||||||
cell *pc = playerpos(i);
|
|
||||||
if(!pc) continue;
|
|
||||||
if(c->monst && c != pc && getMount(i) && !isDragon(c->monst) && sameMonster(c, pc)) {
|
|
||||||
// don't treat the Worm you are riding as passable
|
// don't treat the Worm you are riding as passable
|
||||||
pathqm.push_back(c);
|
pathqm.push_back(c);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if(c->cpdist > 7 && !(c->land == laTrollheim && turncount < c->landparam)) continue;
|
if(c->cpdist > 7 && !(c->land == laTrollheim && turncount < c->landparam)) continue;
|
||||||
int d = c->pathdist;
|
int d = c->pathdist;
|
||||||
if(d == PINFD - 1) continue;
|
if(d == PINFD - 1) continue;
|
||||||
@ -2853,7 +2849,8 @@ void bfs() {
|
|||||||
for(int i=0; i<numplayers(); i++) {
|
for(int i=0; i<numplayers(); i++) {
|
||||||
cell *c = playerpos(i);
|
cell *c = playerpos(i);
|
||||||
if(!c) continue;
|
if(!c) continue;
|
||||||
if(getMount(i) && (c->monst == moTentacle || c->monst == moTentaclewait || c->monst == moTentacleEscaping))
|
if(items[itOrbDomination])
|
||||||
|
if(c->monst == moTentacle || c->monst == moTentaclewait || c->monst == moTentacleEscaping)
|
||||||
worms.push_back(c);
|
worms.push_back(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4131,18 +4128,23 @@ void mountmove(cell *c, int spin, bool fp, int id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void mountmove(cell *c, int spin, bool fp, cell *ppos) {
|
void mountmove(cell *c, int spin, bool fp, cell *ppos) {
|
||||||
for(int i=0; i<numplayers(); i++) if(playerpos(i) == ppos) {
|
for(int i=0; i<numplayers(); i++) {
|
||||||
|
if(playerpos(i) == ppos) {
|
||||||
animateMovement(ppos, c, LAYER_SMALL);
|
animateMovement(ppos, c, LAYER_SMALL);
|
||||||
mountmove(c, spin, fp, i);
|
mountmove(c, spin, fp, i);
|
||||||
}
|
}
|
||||||
|
if(lastmountpos[i] == ppos && ppos != NULL) {
|
||||||
|
lastmountpos[i] = c;
|
||||||
|
}
|
||||||
|
else if(lastmountpos[i] == c) {
|
||||||
|
lastmountpos[i] = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void moveWorm(cell *c) {
|
void moveWorm(cell *c) {
|
||||||
|
|
||||||
bool mounted = false;
|
bool mounted = isMounted(c);
|
||||||
for(int i=0; i<numplayers(); i++)
|
|
||||||
if(multi::playerActive(i) && getMount(i) && sameMonster(c, playerpos(i)))
|
|
||||||
mounted = true;
|
|
||||||
|
|
||||||
if(c->monst == moWormwait) { c->monst = moWorm; return; }
|
if(c->monst == moWormwait) { c->monst = moWorm; return; }
|
||||||
else if(c->monst == moTentaclewait) { c->monst = moTentacle; return; }
|
else if(c->monst == moTentaclewait) { c->monst = moTentacle; return; }
|
||||||
@ -4395,13 +4397,6 @@ bool earthMove(cell *from, int dir) {
|
|||||||
|
|
||||||
vector<cell*> gendfs;
|
vector<cell*> gendfs;
|
||||||
|
|
||||||
bool isMounted(cell *c) {
|
|
||||||
for(int i=0; i<numplayers(); i++)
|
|
||||||
if(multi::playerActive(i) && sameMonster(c, playerpos(i)))
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int targetcount;
|
int targetcount;
|
||||||
|
|
||||||
bool isTargetOrAdjacent(cell *c) {
|
bool isTargetOrAdjacent(cell *c) {
|
||||||
@ -4753,6 +4748,8 @@ void movemutant() {
|
|||||||
cell *shpos[MAXPLAYER][SHSIZE];
|
cell *shpos[MAXPLAYER][SHSIZE];
|
||||||
int cshpos = 0;
|
int cshpos = 0;
|
||||||
|
|
||||||
|
cell *lastmountpos[MAXPLAYER];
|
||||||
|
|
||||||
void clearshadow() {
|
void clearshadow() {
|
||||||
for(int i=0; i<SHSIZE; i++) for(int p=0; p<MAXPLAYER; p++)
|
for(int i=0; i<SHSIZE; i++) for(int p=0; p<MAXPLAYER; p++)
|
||||||
shpos[p][i] = NULL;
|
shpos[p][i] = NULL;
|
||||||
@ -7270,6 +7267,11 @@ bool movepcto(int d, int subdir, bool checkonly) {
|
|||||||
if(!checkonly) invismove = false;
|
if(!checkonly) invismove = false;
|
||||||
bool boatmove = false;
|
bool boatmove = false;
|
||||||
|
|
||||||
|
if(multi::players > 1)
|
||||||
|
lastmountpos[multi::cpid] = cwt.c;
|
||||||
|
else
|
||||||
|
lastmountpos[0] = cwt.c;
|
||||||
|
|
||||||
if(againstRose(cwt.c, NULL) && d<0 && !scentResistant()) {
|
if(againstRose(cwt.c, NULL) && d<0 && !scentResistant()) {
|
||||||
if(checkonly) return false;
|
if(checkonly) return false;
|
||||||
addMessage("You just cannot stand in place, those roses smell too nicely.");
|
addMessage("You just cannot stand in place, those roses smell too nicely.");
|
||||||
@ -7922,6 +7924,7 @@ int wormpos(cell *c) {
|
|||||||
|
|
||||||
// currently works for worms only
|
// currently works for worms only
|
||||||
bool sameMonster(cell *c1, cell *c2) {
|
bool sameMonster(cell *c1, cell *c2) {
|
||||||
|
if(!c1 || !c2) return false;
|
||||||
if(c1 == c2) return true;
|
if(c1 == c2) return true;
|
||||||
if(isWorm(c1->monst) && isWorm(c2->monst))
|
if(isWorm(c1->monst) && isWorm(c2->monst))
|
||||||
return wormhead(c1) == wormhead(c2);
|
return wormhead(c1) == wormhead(c2);
|
||||||
@ -7930,14 +7933,9 @@ bool sameMonster(cell *c1, cell *c2) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
eMonster getMount(int i) {
|
|
||||||
if(!items[itOrbDomination]) return moNone;
|
|
||||||
return playerpos(i)->monst;
|
|
||||||
}
|
|
||||||
|
|
||||||
eMonster haveMount() {
|
eMonster haveMount() {
|
||||||
for(int i=0; i<numplayers(); i++) if(multi::playerActive(i)) {
|
for(int i=0; i<numplayers(); i++) if(multi::playerActive(i)) {
|
||||||
eMonster m = getMount(i);
|
eMonster m = playerpos(i)->monst;
|
||||||
if(m) return m;
|
if(m) return m;
|
||||||
}
|
}
|
||||||
return moNone;
|
return moNone;
|
||||||
|
2
hyper.h
2
hyper.h
@ -2673,3 +2673,5 @@ extern bool nohud, nofps;
|
|||||||
template<class T> array<T, 3> make_array(T a, T b, T c) { array<T,3> x; x[0] = a; x[1] = b; x[2] = c; return x; }
|
template<class T> array<T, 3> make_array(T a, T b, T c) { array<T,3> x; x[0] = a; x[1] = b; x[2] = c; return x; }
|
||||||
template<class T> array<T, 2> make_array(T a, T b) { array<T,2> x; x[0] = a; x[1] = b; return x; }
|
template<class T> array<T, 2> make_array(T a, T b) { array<T,2> x; x[0] = a; x[1] = b; return x; }
|
||||||
|
|
||||||
|
extern cell *lastmountpos[MAXPLAYER];
|
||||||
|
|
||||||
|
@ -1199,6 +1199,7 @@ auto cgm = addHook(clearmemory, 40, [] () {
|
|||||||
pathq.clear();
|
pathq.clear();
|
||||||
dcal.clear();
|
dcal.clear();
|
||||||
clearshadow();
|
clearshadow();
|
||||||
|
for(int i=0; i<MAXPLAYER; i++) lastmountpos[i] = NULL;
|
||||||
seenSevenMines = false;
|
seenSevenMines = false;
|
||||||
recallCell = NULL;
|
recallCell = NULL;
|
||||||
butterflies.clear();
|
butterflies.clear();
|
||||||
|
Loading…
Reference in New Issue
Block a user