1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-29 19:40:35 +00:00

recallCell now remembers orientation (is cellwalker)

This commit is contained in:
Zeno Rogue 2019-05-29 02:21:47 +02:00
parent baa1871d01
commit 6467e38537
4 changed files with 24 additions and 18 deletions

View File

@ -6369,29 +6369,30 @@ void placeItems(int qty, eItem it) {
}
}
cell *recallCell;
cellwalker recallCell;
bool activateRecall() {
if(!recallCell) {
if(!recallCell.at) {
addMessage("Error: no recall");
return false;
}
items[itOrbRecall] = 0; items[itOrbSafety] = 0;
if(!makeEmpty(recallCell)) {
if(!makeEmpty(recallCell.at)) {
addMessage(XLAT("Your Orb of Recall is blocked by something big!"));
recallCell = NULL;
recallCell.at = NULL;
return false;
}
killFriendlyIvy();
movecost(cwt.at, recallCell, 3);
playerMoveEffects(cwt.at, recallCell);
movecost(cwt.at, recallCell.at, 3);
playerMoveEffects(cwt.at, recallCell.at);
mirror::destroyAll();
sword::reset();
cwt.at = recallCell; recallCell = NULL;
cwt.spin = hrand(cwt.at->type); flipplayer = !!(hrand(2));
cwt = recallCell;
recallCell.at = NULL;
flipplayer = true;
fullcenter();
makeEmpty(cwt.at);
forCellEx(c2, cwt.at)
@ -6406,12 +6407,12 @@ bool activateRecall() {
return true;
}
void saveRecall(cell *c2) {
if(!recallCell) recallCell = c2;
void saveRecall(cellwalker cw2) {
if(!recallCell.at) recallCell = cw2;
}
void activateSafety(eLand l) {
if(recallCell && activateRecall())
if(recallCell.at && activateRecall())
return;
savePrincesses();
int gg = countMyGolems(moGolem);
@ -6514,7 +6515,7 @@ void checkmove() {
items[itWarning]-=2;
for(int i=0; i<ittypes; i++) orbused[i] = orbusedbak[i];
if(recallCell && !markOrb(itOrbRecall)) activateRecall();
if(recallCell.at && !markOrb(itOrbRecall)) activateRecall();
}
// move the PC. Warning: a very long function! todo: refactor
@ -6966,7 +6967,12 @@ bool collectItem(cell *c2, bool telekinesis) {
}
else if(orbcharges(c2->item)) {
eItem it = c2->item;
if(it == itOrbRecall) saveRecall(c2);
if(it == itOrbRecall) {
cellwalker cw2 = cwt;
cw2++;
cw2.at = c2;
saveRecall(cw2);
}
if(it == itOrbFire) playSound(c2, "fire");
else if(it == itOrbFire) playSound(c2, "fire");
else if(it == itOrbWinter) playSound(c2, "pickup-winter");

View File

@ -2248,7 +2248,7 @@ int reptilemax();
extern bool mousing;
#define IFM(x) (mousing?"":x)
extern cell *recallCell;
extern cellwalker recallCell;
extern eLand cheatdest;
void cheatMoveTo(eLand l);

View File

@ -92,9 +92,9 @@ void save_memory() {
heptagon *at = cwt.at->master;
heptagon *orig = currentmap->gamestart()->master;
if(recallCell) {
if(unsafeLand(recallCell)) return;
heptagon *at2 = recallCell->master;
if(recallCell.at) {
if(unsafeLand(recallCell.at)) return;
heptagon *at2 = recallCell.at->master;
int t = 0;
while(at != at2) {
t++; if(t > 10000) return;

View File

@ -3427,7 +3427,7 @@ void turn(int delta) {
buildRosemap();
if(havewhat&HF_RIVER) prairie::move();
}
if(recallCell && !markOrb(itOrbRecall)) activateRecall();
if(recallCell.at && !markOrb(itOrbRecall)) activateRecall();
save_memory();
}
if(elec::havecharge) elec::act();