cleaned up where summoned creature appears for Orb of Life and Orb of Friendship

This commit is contained in:
Zeno Rogue 2021-08-08 19:04:58 +02:00
parent 683ab67ad9
commit 025893e946
8 changed files with 24 additions and 24 deletions

View File

@ -144,7 +144,7 @@ EX namespace whirlwind {
animateMovement(match(whirlline[i+1], whirlline[i]), LAYER_BOAT); animateMovement(match(whirlline[i+1], whirlline[i]), LAYER_BOAT);
} }
for(int i=0; i<z; i++) for(int i=0; i<z; i++)
pickupMovedItems(whirlline[i]); pickupMovedItems(whirlline[i], i==z-1 ? whirlline[0] : whirlline[i+1]);
} }
EX void move() { EX void move() {
@ -1119,8 +1119,8 @@ EX namespace whirlpool {
if(wfrom->item == itKey || wfrom->item == itOrbYendor) if(wfrom->item == itKey || wfrom->item == itOrbYendor)
for(int i=0; i<wto->type; i++) createMov(wto, i); for(int i=0; i<wto->type; i++) createMov(wto, i);
moveItem(wfrom, wto, false); moveItem(wfrom, wto, false);
pickupMovedItems(wfrom); pickupMovedItems(wfrom, wto);
pickupMovedItems(wto); pickupMovedItems(wto, wfrom);
} }
if(wto && !wfrom) if(wto && !wfrom)
@ -2466,7 +2466,7 @@ EX void livecaves() {
if(hv > 0 && c->wall == waNone) { if(hv > 0 && c->wall == waNone) {
if(c->item && c->cpdist == 1 && markOrb(itOrbWater)) { if(c->item && c->cpdist == 1 && markOrb(itOrbWater)) {
bool saf = c->item == itOrbSafety; bool saf = c->item == itOrbSafety;
collectItem(c); collectItem(c, c);
if(saf) return; if(saf) return;
} }
c->wall = waSea; c->wall = waSea;

View File

@ -261,7 +261,7 @@ EX namespace westwall {
animateMovement(match(whirlline[i+1], whirlline[i]), LAYER_BOAT); animateMovement(match(whirlline[i+1], whirlline[i]), LAYER_BOAT);
} }
for(int i=0; i<z; i++) for(int i=0; i<z; i++)
pickupMovedItems(whirlline[i]); pickupMovedItems(whirlline[i], i<z-1 ? whirlline[i+1] : whirlline[0]);
} }
EX void move() { EX void move() {

View File

@ -799,7 +799,7 @@ EX void monstersTurn() {
if(!phase2) movemonsters(); if(!phase2) movemonsters();
for(cell *pc: player_positions()) if(pc->item == itOrbSafety) { for(cell *pc: player_positions()) if(pc->item == itOrbSafety) {
collectItem(pc, true); collectItem(pc, pc, true);
return; return;
} }

View File

@ -661,7 +661,7 @@ EX namespace inv {
eItem it = cwt.at->item; eItem it = cwt.at->item;
cwt.at->item = orbmap[uni]; cwt.at->item = orbmap[uni];
inv::activating = true; inv::activating = true;
collectItem(cwt.at, true); collectItem(cwt.at, cwt.at, true);
inv::activating = false; inv::activating = false;
addMessage(XLAT("You activate %the1.", orbmap[uni])); addMessage(XLAT("You activate %the1.", orbmap[uni]));
if(!cwt.at->item) usedup[orbmap[uni]]++; if(!cwt.at->item) usedup[orbmap[uni]]++;

View File

@ -57,23 +57,23 @@ EX bool doPickupItemsWithMagnetism(cell *c) {
else if(c3->item == itOrbSafety || c3->item == itBuggy || c3->item == itBuggy2) else if(c3->item == itOrbSafety || c3->item == itBuggy || c3->item == itBuggy2)
csaf = c3; csaf = c3;
else if(markOrb(itOrbMagnetism)) else if(markOrb(itOrbMagnetism))
collectItem(c3, false); collectItem(c3, c3, false);
} }
if(csaf) if(csaf)
return collectItem(csaf, false); return collectItem(csaf, csaf, false);
return false; return false;
} }
EX void pickupMovedItems(cell *c) { EX void pickupMovedItems(cell *c, cell *from) {
if(!c->item) return; if(!c->item) return;
if(c->item == itOrbSafety) return; if(c->item == itOrbSafety) return;
if(isPlayerOn(c)) collectItem(c, true); if(isPlayerOn(c)) collectItem(c, from, true);
if(items[itOrbMagnetism]) if(items[itOrbMagnetism])
forCellEx(c2, c) forCellEx(c2, c)
if(isPlayerOn(c2) && canPickupItemWithMagnetism(c, c2)) { if(isPlayerOn(c2) && canPickupItemWithMagnetism(c, c2)) {
changes.ccell(c2); changes.ccell(c2);
changes.ccell(c); changes.ccell(c);
collectItem(c, true); collectItem(c, c2, true);
} }
} }
@ -81,7 +81,7 @@ EX bool in_lovasz() {
return specialland == laMotion && bounded && ls::single() && !daily::on; return specialland == laMotion && bounded && ls::single() && !daily::on;
} }
EX bool collectItem(cell *c2, bool telekinesis IS(false)) { EX bool collectItem(cell *c2, cell *last, bool telekinesis IS(false)) {
bool dopickup = true; bool dopickup = true;
bool had_choice = false; bool had_choice = false;
@ -119,7 +119,7 @@ EX bool collectItem(cell *c2, bool telekinesis IS(false)) {
#endif #endif
if(isRevivalOrb(c2->item) && multi::revive_queue.size()) { if(isRevivalOrb(c2->item) && multi::revive_queue.size()) {
multiRevival(cwt.at, c2); multiRevival(last, c2);
} }
else if(isShmupLifeOrb(c2->item) && shmup::on) { else if(isShmupLifeOrb(c2->item) && shmup::on) {
playSound(c2, "pickup-orb"); // TODO summon playSound(c2, "pickup-orb"); // TODO summon
@ -165,12 +165,12 @@ EX bool collectItem(cell *c2, bool telekinesis IS(false)) {
} }
else if(c2->item == itOrbLife) { else if(c2->item == itOrbLife) {
playSound(c2, "pickup-orb"); // TODO summon playSound(c2, "pickup-orb"); // TODO summon
placeGolem(cwt.at, c2, moGolem); placeGolem(last, c2, moGolem);
if(cwt.at->monst == moGolem) cwt.at->stuntime = 0; if(cwt.at->monst == moGolem) cwt.at->stuntime = 0;
} }
else if(c2->item == itOrbFriend) { else if(c2->item == itOrbFriend) {
playSound(c2, "pickup-orb"); // TODO summon playSound(c2, "pickup-orb"); // TODO summon
placeGolem(cwt.at, c2, moTameBomberbird); placeGolem(last, c2, moTameBomberbird);
if(cwt.at->monst == moTameBomberbird) cwt.at->stuntime = 0; if(cwt.at->monst == moTameBomberbird) cwt.at->stuntime = 0;
} }
#if CAP_TOUR #if CAP_TOUR
@ -209,7 +209,7 @@ EX bool collectItem(cell *c2, bool telekinesis IS(false)) {
changes.value_set(tortoise::seekbits, bnew); changes.value_set(tortoise::seekbits, bnew);
changes.value_set(tortoise::last, seekbits); changes.value_set(tortoise::last, seekbits);
if(seek()) { if(seek()) {
cell *c = passable(cwt.at, NULL, 0) ? cwt.at : c2; cell *c = passable(last, NULL, 0) ? last : c2;
changes.ccell(c); changes.ccell(c);
c->item = itBabyTortoise; c->item = itBabyTortoise;
if(c == c2) dopickup = false; if(c == c2) dopickup = false;

View File

@ -695,7 +695,7 @@ EX bool jumpTo(orbAction a, cell *dest, eItem byWhat, int bonuskill IS(0), eMons
from = NULL; from = NULL;
} }
if(cwt.at->item != itOrbYendor && cwt.at->item != itHolyGrail) { if(cwt.at->item != itOrbYendor && cwt.at->item != itHolyGrail) {
auto c = collectItem(cwt.at, true); auto c = collectItem(cwt.at, from, true);
if(c) { if(c) {
return true; return true;
} }
@ -777,7 +777,7 @@ void telekinesis(cell *dest) {
} }
moveItem(dest, cwt.at, true); moveItem(dest, cwt.at, true);
collectItem(cwt.at, true); collectItem(cwt.at, cwt.at, true);
useupOrb(itOrbSpace, cost.first); useupOrb(itOrbSpace, cost.first);
if(cost.second) if(cost.second)
markOrb(itOrbMagnetism); markOrb(itOrbMagnetism);

View File

@ -1147,11 +1147,11 @@ bool pcmove::perform_actual_move() {
movecost(cwt.at, c2, 1); movecost(cwt.at, c2, 1);
if(!boatmove && collectItem(c2)) return true; if(!boatmove && collectItem(c2, cwt.at)) return true;
if(boatmove && c2->item && cwt.at->item) { if(boatmove && c2->item && cwt.at->item) {
eItem it = c2->item; eItem it = c2->item;
c2->item = cwt.at->item; c2->item = cwt.at->item;
if(collectItem(c2)) return true; if(collectItem(c2, cwt.at)) return true;
eItem it2 = c2->item; eItem it2 = c2->item;
c2->item = it; c2->item = it;
cwt.at->item = it2; cwt.at->item = it2;
@ -1167,7 +1167,7 @@ bool pcmove::perform_actual_move() {
forCellEx(c3, c2) if(c3->wall == waIcewall && c3->item) { forCellEx(c3, c2) if(c3->wall == waIcewall && c3->item) {
changes.ccell(c3); changes.ccell(c3);
markOrb(itOrbWinter); markOrb(itOrbWinter);
if(collectItem(c3)) return true; if(collectItem(c3, cwt.at)) return true;
} }
movecost(cwt.at, c2, 2); movecost(cwt.at, c2, 2);

View File

@ -1098,7 +1098,7 @@ void movePlayer(monster *m, int delta) {
} }
else if(m->inBoat && !isWateryOrBoat(c2) && passable(c2, m->base, P_ISPLAYER | P_MIRROR | reflectflag)) { else if(m->inBoat && !isWateryOrBoat(c2) && passable(c2, m->base, P_ISPLAYER | P_MIRROR | reflectflag)) {
if(boatGoesThrough(c2) && markOrb(itOrbWater)) { if(boatGoesThrough(c2) && markOrb(itOrbWater)) {
collectItem(c2); collectItem(c2, m->base);
c2->wall = isIcyLand(m->base) ? waLake : waSea; c2->wall = isIcyLand(m->base) ? waLake : waSea;
} }
else { else {
@ -1249,7 +1249,7 @@ void movePlayer(monster *m, int delta) {
} }
if(c2->item == itOrbYendor && !peace::on) yendor::check(c2); if(c2->item == itOrbYendor && !peace::on) yendor::check(c2);
collectItem(c2); collectItem(c2, m->base);
movecost(m->base, c2, 2); movecost(m->base, c2, 2);
} }
} }