1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-06-15 01:39:57 +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() { bool activateRecall() {
if(!recallCell) { if(!recallCell.at) {
addMessage("Error: no recall"); addMessage("Error: no recall");
return false; return false;
} }
items[itOrbRecall] = 0; items[itOrbSafety] = 0; items[itOrbRecall] = 0; items[itOrbSafety] = 0;
if(!makeEmpty(recallCell)) { if(!makeEmpty(recallCell.at)) {
addMessage(XLAT("Your Orb of Recall is blocked by something big!")); addMessage(XLAT("Your Orb of Recall is blocked by something big!"));
recallCell = NULL; recallCell.at = NULL;
return false; return false;
} }
killFriendlyIvy(); killFriendlyIvy();
movecost(cwt.at, recallCell, 3); movecost(cwt.at, recallCell.at, 3);
playerMoveEffects(cwt.at, recallCell); playerMoveEffects(cwt.at, recallCell.at);
mirror::destroyAll(); mirror::destroyAll();
sword::reset(); sword::reset();
cwt.at = recallCell; recallCell = NULL; cwt = recallCell;
cwt.spin = hrand(cwt.at->type); flipplayer = !!(hrand(2)); recallCell.at = NULL;
flipplayer = true;
fullcenter(); fullcenter();
makeEmpty(cwt.at); makeEmpty(cwt.at);
forCellEx(c2, cwt.at) forCellEx(c2, cwt.at)
@ -6406,12 +6407,12 @@ bool activateRecall() {
return true; return true;
} }
void saveRecall(cell *c2) { void saveRecall(cellwalker cw2) {
if(!recallCell) recallCell = c2; if(!recallCell.at) recallCell = cw2;
} }
void activateSafety(eLand l) { void activateSafety(eLand l) {
if(recallCell && activateRecall()) if(recallCell.at && activateRecall())
return; return;
savePrincesses(); savePrincesses();
int gg = countMyGolems(moGolem); int gg = countMyGolems(moGolem);
@ -6514,7 +6515,7 @@ void checkmove() {
items[itWarning]-=2; items[itWarning]-=2;
for(int i=0; i<ittypes; i++) orbused[i] = orbusedbak[i]; 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 // 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)) { else if(orbcharges(c2->item)) {
eItem it = 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"); if(it == itOrbFire) playSound(c2, "fire");
else if(it == itOrbFire) playSound(c2, "fire"); else if(it == itOrbFire) playSound(c2, "fire");
else if(it == itOrbWinter) playSound(c2, "pickup-winter"); else if(it == itOrbWinter) playSound(c2, "pickup-winter");

View File

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

View File

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

View File

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