mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-05-29 20:44:07 +00:00
more fixes to multiplayer
This commit is contained in:
parent
032a6b6df2
commit
40d450676e
@ -1178,9 +1178,9 @@ EX void killThePlayer(eMonster m, int id, flagtype flags) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
EX void killThePlayerAt(eMonster m, cell *c, flagtype flags) {
|
EX void killThePlayerAt(eMonster m, cell *c, flagtype flags) {
|
||||||
for(int i=0; i<numplayers(); i++)
|
for(int i: player_indices())
|
||||||
if(playerpos(i) == c)
|
if(playerpos(i) == c)
|
||||||
killThePlayer(m, i, flags);
|
killThePlayer(m, i, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HDR
|
#if HDR
|
||||||
|
@ -585,7 +585,9 @@ void celldrawer::setcolors() {
|
|||||||
bool inrange = c->mpdist <= GUNRANGE;
|
bool inrange = c->mpdist <= GUNRANGE;
|
||||||
if(inrange) {
|
if(inrange) {
|
||||||
inrange = false;
|
inrange = false;
|
||||||
for(int i=0; i<numplayers(); i++) for(cell *c1: gun_targets(playerpos(i))) if(c1 == c) inrange = true;
|
for(cell *pc: player_positions())
|
||||||
|
for(cell *c1: gun_targets(pc)) if(c1 == c)
|
||||||
|
inrange = true;
|
||||||
}
|
}
|
||||||
if(!inrange)
|
if(!inrange)
|
||||||
fcol = gradient(fcol, 0, 0, 25, 100),
|
fcol = gradient(fcol, 0, 0, 25, 100),
|
||||||
@ -1842,13 +1844,12 @@ void celldrawer::bookkeeping() {
|
|||||||
playerfound = true;
|
playerfound = true;
|
||||||
|
|
||||||
if(multi::players > 1) {
|
if(multi::players > 1) {
|
||||||
for(int i=0; i<numplayers(); i++)
|
for(int i: player_indices()) if(playerpos(i) == c) {
|
||||||
if(playerpos(i) == c) {
|
playerV = V * ddspin(c, multi::player[i].spin, 0);
|
||||||
playerV = V * ddspin(c, multi::player[i].spin, 0);
|
if(multi::player[i].mirrored) playerV = playerV * Mirror;
|
||||||
if(multi::player[i].mirrored) playerV = playerV * Mirror;
|
if(orig)
|
||||||
if(orig)
|
multi::whereis[i] = playerV;
|
||||||
multi::whereis[i] = playerV;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
playerV = V * ddspin(c, cwt.spin, 0);
|
playerV = V * ddspin(c, cwt.spin, 0);
|
||||||
|
14
complex2.cpp
14
complex2.cpp
@ -671,8 +671,8 @@ EX void check_around(cell *c) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
EX void check() {
|
EX void check() {
|
||||||
for(int i=0; i<numplayers(); i++)
|
for(cell *pc: player_positions())
|
||||||
forCellEx(c, playerpos(i)) {
|
forCellEx(c, pc) {
|
||||||
if(shmup::on) {
|
if(shmup::on) {
|
||||||
forCellEx(c2, c)
|
forCellEx(c2, c)
|
||||||
check(c2);
|
check(c2);
|
||||||
@ -709,16 +709,16 @@ EX void check_state() {
|
|||||||
}
|
}
|
||||||
if(items[itHunting] > 5 && items[itHunting] <= 22) {
|
if(items[itHunting] > 5 && items[itHunting] <= 22) {
|
||||||
int q = 0;
|
int q = 0;
|
||||||
for(int i=0; i<numplayers(); i++)
|
for(cell *pc: player_positions())
|
||||||
forCellEx(c2, playerpos(i))
|
forCellEx(c2, pc)
|
||||||
if(cl.listed(c2))
|
if(cl.listed(c2))
|
||||||
q++;
|
q++;
|
||||||
if(q == 1) havewhat |= HF_FAILED_AMBUSH;
|
if(q == 1) havewhat |= HF_FAILED_AMBUSH;
|
||||||
if(q == 2) {
|
if(q == 2) {
|
||||||
for(int i=0; i<numplayers(); i++)
|
for(cell *pc: player_positions())
|
||||||
forCellEx(c2, playerpos(i))
|
forCellEx(c2, pc)
|
||||||
if(cl.listed(c2))
|
if(cl.listed(c2))
|
||||||
forCellEx(c3, playerpos(i))
|
forCellEx(c3, pc)
|
||||||
if(c3 != c2 && isNeighbor(c2,c3))
|
if(c3 != c2 && isNeighbor(c2,c3))
|
||||||
if(cl.listed(c3))
|
if(cl.listed(c3))
|
||||||
havewhat |= HF_FAILED_AMBUSH;
|
havewhat |= HF_FAILED_AMBUSH;
|
||||||
|
@ -286,9 +286,7 @@ EX void bfs() {
|
|||||||
|
|
||||||
recalcTide = false;
|
recalcTide = false;
|
||||||
|
|
||||||
for(int i=0; i<numplayers(); i++) {
|
for(cell *c: player_positions()) {
|
||||||
cell *c = playerpos(i);
|
|
||||||
if(!c) continue;
|
|
||||||
if(c->cpdist == 0) continue;
|
if(c->cpdist == 0) continue;
|
||||||
c->cpdist = 0;
|
c->cpdist = 0;
|
||||||
checkTide(c);
|
checkTide(c);
|
||||||
@ -299,9 +297,7 @@ EX void bfs() {
|
|||||||
|
|
||||||
int distlimit = gamerange();
|
int distlimit = gamerange();
|
||||||
|
|
||||||
for(int i=0; i<numplayers(); i++) {
|
for(cell *c: player_positions()) {
|
||||||
cell *c = playerpos(i);
|
|
||||||
if(!c) continue;
|
|
||||||
if(items[itOrbDomination])
|
if(items[itOrbDomination])
|
||||||
if(c->monst == moTentacle || c->monst == moTentaclewait || c->monst == moTentacleEscaping)
|
if(c->monst == moTentacle || c->monst == moTentaclewait || c->monst == moTentacleEscaping)
|
||||||
worms.push_back(c);
|
worms.push_back(c);
|
||||||
@ -799,8 +795,9 @@ EX void monstersTurn() {
|
|||||||
DEBB(DF_TURN, ("mmo"));
|
DEBB(DF_TURN, ("mmo"));
|
||||||
int phase2 = (1 & items[itOrbSpeed]);
|
int phase2 = (1 & items[itOrbSpeed]);
|
||||||
if(!phase2) movemonsters();
|
if(!phase2) movemonsters();
|
||||||
for(int i=0; i<numplayers(); i++) if(playerpos(i)->item == itOrbSafety) {
|
|
||||||
collectItem(playerpos(i), true);
|
for(cell *pc: player_positions()) if(pc->item == itOrbSafety) {
|
||||||
|
collectItem(pc, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -852,9 +849,8 @@ EX void monstersTurn() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(items[itOrbFreedom])
|
if(items[itOrbFreedom])
|
||||||
for(int i=0; i<numplayers(); i++)
|
for(cell *pc: player_positions())
|
||||||
if(multi::playerActive(i))
|
checkFreedom(pc);
|
||||||
checkFreedom(playerpos(i));
|
|
||||||
|
|
||||||
DEBB(DF_TURN, ("check"));
|
DEBB(DF_TURN, ("check"));
|
||||||
checkmove();
|
checkmove();
|
||||||
@ -862,9 +858,8 @@ EX void monstersTurn() {
|
|||||||
|
|
||||||
|
|
||||||
#if CAP_HISTORY
|
#if CAP_HISTORY
|
||||||
for(int i=0; i<numplayers(); i++)
|
for(cell *pc: player_positions())
|
||||||
if(multi::playerActive(i))
|
history::movehistory.push_back(pc);
|
||||||
history::movehistory.push_back(playerpos(i));
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ EX int mirrorcolor(bool mirrored) {
|
|||||||
|
|
||||||
EX bool isMounted(cell *c) {
|
EX bool isMounted(cell *c) {
|
||||||
if(c && c->monst && c->monst != moTentacleGhost && isMountable(c->monst)) {
|
if(c && c->monst && c->monst != moTentacleGhost && isMountable(c->monst)) {
|
||||||
for(int i=0; i<numplayers(); i++) {
|
for(int i: player_indices()) {
|
||||||
if(playerpos(i)->monst && sameMonster(c, playerpos(i)))
|
if(playerpos(i)->monst && sameMonster(c, playerpos(i)))
|
||||||
return true;
|
return true;
|
||||||
if(lastmountpos[i] && lastmountpos[i]->monst && sameMonster(c, lastmountpos[i]))
|
if(lastmountpos[i] && lastmountpos[i]->monst && sameMonster(c, lastmountpos[i]))
|
||||||
|
4
game.cpp
4
game.cpp
@ -449,8 +449,8 @@ EX bool sameMonster(cell *c1, cell *c2) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
EX eMonster haveMount() {
|
EX eMonster haveMount() {
|
||||||
for(int i=0; i<numplayers(); i++) if(multi::playerActive(i)) {
|
for(cell *pc: player_positions()) {
|
||||||
eMonster m = playerpos(i)->monst;
|
eMonster m = pc->monst;
|
||||||
if(m) return m;
|
if(m) return m;
|
||||||
}
|
}
|
||||||
return moNone;
|
return moNone;
|
||||||
|
@ -178,8 +178,8 @@ EX int flip_dark(int f, int a0, int a1) {
|
|||||||
color_t fc(int ph, color_t col, int z) {
|
color_t fc(int ph, color_t col, int z) {
|
||||||
if(items[itOrbFire]) col = darkena(firecolor(ph), 0, 0xFF);
|
if(items[itOrbFire]) col = darkena(firecolor(ph), 0, 0xFF);
|
||||||
if(items[itOrbAether]) col = (col &~0XFF) | (col&0xFF) / 2;
|
if(items[itOrbAether]) col = (col &~0XFF) | (col&0xFF) / 2;
|
||||||
for(int i=0; i<numplayers(); i++) if(multi::playerActive(i))
|
for(cell *pc: player_positions())
|
||||||
if(items[itOrbFish] && isWatery(playerpos(i)) && z != 3) return watercolor(ph);
|
if(items[itOrbFish] && isWatery(pc) && z != 3) return watercolor(ph);
|
||||||
if(invismove)
|
if(invismove)
|
||||||
col =
|
col =
|
||||||
shmup::on ?
|
shmup::on ?
|
||||||
@ -4194,7 +4194,7 @@ EX void drawMarkers() {
|
|||||||
if(!(cmode & sm::NORMAL)) return;
|
if(!(cmode & sm::NORMAL)) return;
|
||||||
|
|
||||||
if(should_draw_mouse_cursor()) {
|
if(should_draw_mouse_cursor()) {
|
||||||
for(int i=0; i<numplayers(); i++) if(multi::playerActive(i)) {
|
for(int i: player_indices()) {
|
||||||
queueline(ggmatrix(playerpos(i)) * (WDIM == 2 && GDIM == 3 ? zpush0(cgi.WALL) : C0), mouseh, 0xFF00FF, grid_prec() + 1);
|
queueline(ggmatrix(playerpos(i)) * (WDIM == 2 && GDIM == 3 ? zpush0(cgi.WALL) : C0), mouseh, 0xFF00FF, grid_prec() + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5269,7 +5269,7 @@ EX void drawscreen() {
|
|||||||
|
|
||||||
if(tmines == 7) seenSevenMines = true;
|
if(tmines == 7) seenSevenMines = true;
|
||||||
|
|
||||||
for(int p=0; p<numplayers(); p++) if(multi::playerActive(p))
|
for(int p: player_indices())
|
||||||
displayfr(vid.xres * (p+.5) / numplayers(),
|
displayfr(vid.xres * (p+.5) / numplayers(),
|
||||||
current_display->ycenter - current_display->radius * 3/4, 2,
|
current_display->ycenter - current_display->radius * 3/4, 2,
|
||||||
vid.fsize,
|
vid.fsize,
|
||||||
|
@ -442,14 +442,12 @@ EX namespace inv {
|
|||||||
|
|
||||||
void evokeOrb(eItem it) {
|
void evokeOrb(eItem it) {
|
||||||
if(it == itOrbFreedom)
|
if(it == itOrbFreedom)
|
||||||
for(int i=0; i<numplayers(); i++)
|
for(cell *pc: player_positions())
|
||||||
if(multi::playerActive(i))
|
checkFreedom(pc);
|
||||||
checkFreedom(playerpos(i));
|
|
||||||
|
|
||||||
if(it == itOrbBeauty) {
|
if(it == itOrbBeauty) {
|
||||||
for(int i=0; i<numplayers(); i++)
|
for(cell *pc: player_positions())
|
||||||
if(multi::playerActive(i))
|
evokeBeautyAt(pc);
|
||||||
evokeBeautyAt(playerpos(i));
|
|
||||||
if(items[itOrbEmpathy])
|
if(items[itOrbEmpathy])
|
||||||
for(cell *c: dcal) if(isFriendly(c->monst))
|
for(cell *c: dcal) if(isFriendly(c->monst))
|
||||||
evokeBeautyAt(c);
|
evokeBeautyAt(c);
|
||||||
@ -464,12 +462,11 @@ EX namespace inv {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(it == itOrbSword || it == itOrbSword2) {
|
if(it == itOrbSword || it == itOrbSword2) {
|
||||||
for(int i=0; i<numplayers(); i++)
|
for(int i: player_indices()) {
|
||||||
if(multi::playerActive(i)) {
|
cwt.at = playerpos(i);
|
||||||
cwt.at = playerpos(i);
|
multi::cpid = i;
|
||||||
multi::cpid = i;
|
swordAttackStatic(it == itOrbSword2);
|
||||||
swordAttackStatic(it == itOrbSword2);
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,8 +29,8 @@ EX bool chaosUnlocked = false;
|
|||||||
EX bool chaosAchieved = false;
|
EX bool chaosAchieved = false;
|
||||||
|
|
||||||
EX void doOvergenerate() {
|
EX void doOvergenerate() {
|
||||||
for(int i=0; i<numplayers(); i++)
|
for(cell *pc: player_positions())
|
||||||
setdist(playerpos(i), 7 - getDistLimit() - genrange_bonus, NULL);
|
setdist(pc, 7 - getDistLimit() - genrange_bonus, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
EX bool notDippingFor(eItem i) {
|
EX bool notDippingFor(eItem i) {
|
||||||
|
@ -555,7 +555,7 @@ EX int stayval(cell *c, flagtype mf) {
|
|||||||
EX int totalbulldistance(cell *c, int k) {
|
EX int totalbulldistance(cell *c, int k) {
|
||||||
shpos.resize(SHSIZE);
|
shpos.resize(SHSIZE);
|
||||||
int tbd = 0;
|
int tbd = 0;
|
||||||
for(int p=0; p<numplayers(); p++) {
|
for(int p: player_indices()) {
|
||||||
cell *c2 = shpos[p][(cshpos+SHSIZE-k-1)%SHSIZE];
|
cell *c2 = shpos[p][(cshpos+SHSIZE-k-1)%SHSIZE];
|
||||||
if(c2) tbd += bulldistance(c, c2);
|
if(c2) tbd += bulldistance(c, c2);
|
||||||
}
|
}
|
||||||
@ -1172,11 +1172,9 @@ EX void groupmove(eMonster movtype, flagtype mf) {
|
|||||||
else {
|
else {
|
||||||
if(!peace::on) for(int i=0; i<isize(targets); i++) gendfs.push_back(targets[i]);
|
if(!peace::on) for(int i=0; i<isize(targets); i++) gendfs.push_back(targets[i]);
|
||||||
|
|
||||||
if(invisfish && (movtype == moSlime || movtype == moShark || movtype == moKrakenH)) for(int i=0; i<numplayers(); i++) {
|
if(invisfish && (movtype == moSlime || movtype == moShark || movtype == moKrakenH))
|
||||||
cell *c = playerpos(i);
|
for(cell *pc: player_positions())
|
||||||
if(!c) continue;
|
gendfs.push_back(pc);
|
||||||
gendfs.push_back(c);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
targetcount = isize(gendfs);
|
targetcount = isize(gendfs);
|
||||||
@ -1433,7 +1431,7 @@ EX void moveshadow() {
|
|||||||
cell *shfrom = NULL;
|
cell *shfrom = NULL;
|
||||||
|
|
||||||
shpos.resize(SHSIZE);
|
shpos.resize(SHSIZE);
|
||||||
for(int p=0; p<numplayers(); p++) {
|
for(int p: player_indices()) {
|
||||||
cell *c = shpos[p][cshpos];
|
cell *c = shpos[p][cshpos];
|
||||||
if(c && c->monst == moShadow) {
|
if(c && c->monst == moShadow) {
|
||||||
for(int j=0; j<c->type; j++)
|
for(int j=0; j<c->type; j++)
|
||||||
@ -1445,7 +1443,7 @@ EX void moveshadow() {
|
|||||||
shpos[p][cshpos] = playerpos(p);
|
shpos[p][cshpos] = playerpos(p);
|
||||||
}
|
}
|
||||||
cshpos = (cshpos+1) % SHSIZE;
|
cshpos = (cshpos+1) % SHSIZE;
|
||||||
for(int p=0; p<numplayers(); p++) {
|
for(int p: player_indices()) {
|
||||||
cell* where = shpos[p][cshpos];
|
cell* where = shpos[p][cshpos];
|
||||||
if(where && where->monst == moNone && where->cpdist && where->land == laGraveyard &&
|
if(where && where->monst == moNone && where->cpdist && where->land == laGraveyard &&
|
||||||
!sword::at(where)) {
|
!sword::at(where)) {
|
||||||
@ -2038,7 +2036,9 @@ EX void movemonsters() {
|
|||||||
DEBB(DF_TURN, ("westwall"));
|
DEBB(DF_TURN, ("westwall"));
|
||||||
if(havewhat & HF_WESTWALL) westwall::move();
|
if(havewhat & HF_WESTWALL) westwall::move();
|
||||||
#endif
|
#endif
|
||||||
for(int i=0; i<numplayers(); i++) if(playerpos(i)->item == itOrbSafety) return;
|
for(cell *pc: player_positions())
|
||||||
|
if(pc->item == itOrbSafety)
|
||||||
|
return;
|
||||||
DEBB(DF_TURN, ("river"));
|
DEBB(DF_TURN, ("river"));
|
||||||
if(havewhat & HF_RIVER) prairie::move();
|
if(havewhat & HF_RIVER) prairie::move();
|
||||||
/* DEBB(DF_TURN, ("magnet"));
|
/* DEBB(DF_TURN, ("magnet"));
|
||||||
|
10
multi.cpp
10
multi.cpp
@ -797,7 +797,7 @@ EX void handleInput(int delta) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
EX void checklastmove() {
|
EX void checklastmove() {
|
||||||
for(int i=0; i<numplayers(); i++) if(playerActive(i)) {
|
for(int i: player_indices()) {
|
||||||
multi::cpid = i;
|
multi::cpid = i;
|
||||||
cwt = multi::player[i]; break;
|
cwt = multi::player[i]; break;
|
||||||
}
|
}
|
||||||
@ -824,7 +824,7 @@ EX void handleInput(int delta) {
|
|||||||
multi::player[0] = cwt;
|
multi::player[0] = cwt;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i=0; i<numplayers(); i++) if(playerActive(i)) {
|
for(int i: player_indices()) {
|
||||||
|
|
||||||
using namespace multi;
|
using namespace multi;
|
||||||
|
|
||||||
@ -908,13 +908,13 @@ EX void handleInput(int delta) {
|
|||||||
// check for crashes
|
// check for crashes
|
||||||
needinput = true;
|
needinput = true;
|
||||||
|
|
||||||
for(int i=0; i<numplayers(); i++) if(playerActive(i)) {
|
for(int i: player_indices()) {
|
||||||
origpos[i] = player[i].at;
|
origpos[i] = player[i].at;
|
||||||
origtarget[i] = multiPlayerTarget(i);
|
origtarget[i] = multiPlayerTarget(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i=0; i<numplayers(); i++) if(playerActive(i))
|
for(int i: player_indices())
|
||||||
for(int j=0; j<numplayers(); j++) if(playerActive(j)) if(i != j) {
|
for(int j: player_indices()) if(i != j) {
|
||||||
if(origtarget[i] == origtarget[j]) {
|
if(origtarget[i] == origtarget[j]) {
|
||||||
addMessage("Two players cannot move/attack the same location!");
|
addMessage("Two players cannot move/attack the same location!");
|
||||||
return;
|
return;
|
||||||
|
12
orbs.cpp
12
orbs.cpp
@ -293,8 +293,8 @@ EX void checkFreedom(cell *cf) {
|
|||||||
}
|
}
|
||||||
addMessage(XLAT("Your %1 activates!", itOrbFreedom));
|
addMessage(XLAT("Your %1 activates!", itOrbFreedom));
|
||||||
drainOrb(itOrbFreedom);
|
drainOrb(itOrbFreedom);
|
||||||
for(int i=0; i<numplayers(); i++)
|
for(cell *pc: player_positions())
|
||||||
drawBigFlash(playerpos(i));
|
drawBigFlash(pc);
|
||||||
for(int i=0; i<isize(dcal); i++) {
|
for(int i=0; i<isize(dcal); i++) {
|
||||||
cell *c = dcal[i];
|
cell *c = dcal[i];
|
||||||
if(c == cf && !shmup::on) continue;
|
if(c == cf && !shmup::on) continue;
|
||||||
@ -306,8 +306,8 @@ EX void checkFreedom(cell *cf) {
|
|||||||
EX void activateFlash() {
|
EX void activateFlash() {
|
||||||
int tk = tkills();
|
int tk = tkills();
|
||||||
|
|
||||||
for(int i=0; i<numplayers(); i++)
|
for(cell *pc: player_positions())
|
||||||
drawFlash(playerpos(i));
|
drawFlash(pc);
|
||||||
|
|
||||||
addMessage(XLAT("You activate the Flash spell!"));
|
addMessage(XLAT("You activate the Flash spell!"));
|
||||||
playSound(cwt.at, "storm");
|
playSound(cwt.at, "storm");
|
||||||
@ -513,8 +513,8 @@ EX void activateLightning() {
|
|||||||
|
|
||||||
drainOrb(itOrbLightning);
|
drainOrb(itOrbLightning);
|
||||||
|
|
||||||
for(int i=0; i<numplayers(); i++)
|
for(cell *pc: player_positions())
|
||||||
castLightningBoltFrom(playerpos(i));
|
castLightningBoltFrom(pc);
|
||||||
|
|
||||||
elec::afterOrb = true;
|
elec::afterOrb = true;
|
||||||
elec::act();
|
elec::act();
|
||||||
|
@ -137,9 +137,7 @@ EX bool passable(cell *w, cell *from, flagtype flags) {
|
|||||||
|
|
||||||
if(from && from != w && nonAdjacent(from, w) && !F(P_IGNORE37 | P_BULLET)) return false;
|
if(from && from != w && nonAdjacent(from, w) && !F(P_IGNORE37 | P_BULLET)) return false;
|
||||||
|
|
||||||
for(int i=0; i<numplayers(); i++) {
|
for(cell *pp: player_positions()) {
|
||||||
cell *pp = playerpos(i);
|
|
||||||
if(!pp) continue;
|
|
||||||
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;
|
||||||
|
|
||||||
|
34
pcmove.cpp
34
pcmove.cpp
@ -324,8 +324,8 @@ bool pcmove::after_move() {
|
|||||||
invisfish = false;
|
invisfish = false;
|
||||||
if(items[itOrbFish]) {
|
if(items[itOrbFish]) {
|
||||||
invisfish = true;
|
invisfish = true;
|
||||||
for(int i=0; i<numplayers(); i++)
|
for(cell *pc: player_positions())
|
||||||
if(multi::playerActive(i) && !isWatery(playerpos(i)))
|
if(!isWatery(pc))
|
||||||
invisfish = false;
|
invisfish = false;
|
||||||
if(d < 0) invisfish = false; // no invisibility if staying still
|
if(d < 0) invisfish = false; // no invisibility if staying still
|
||||||
if(invisfish) invismove = true, markOrb(itOrbFish);
|
if(invisfish) invismove = true, markOrb(itOrbFish);
|
||||||
@ -1193,8 +1193,8 @@ EX bool warningprotection_hit(eMonster m) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
EX bool playerInWater() {
|
EX bool playerInWater() {
|
||||||
for(int i=0; i<numplayers(); i++)
|
for(int i: player_indices())
|
||||||
if(multi::playerActive(i) && isWatery(playerpos(i)) && !playerInBoat(i))
|
if(isWatery(playerpos(i)) && !playerInBoat(i))
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1203,6 +1203,22 @@ EX int numplayers() {
|
|||||||
return multi::players;
|
return multi::players;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EX vector<cell*> player_positions() {
|
||||||
|
vector<cell*> res;
|
||||||
|
for(int i=0; i<numplayers(); i++)
|
||||||
|
if(multi::playerActive(i))
|
||||||
|
res.push_back(playerpos(i));
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
EX vector<int> player_indices() {
|
||||||
|
vector<int> res;
|
||||||
|
for(int i=0; i<numplayers(); i++)
|
||||||
|
if(multi::playerActive(i))
|
||||||
|
res.push_back(i);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
EX cell *playerpos(int i) {
|
EX cell *playerpos(int i) {
|
||||||
if(shmup::on) return shmup::playerpos(i);
|
if(shmup::on) return shmup::playerpos(i);
|
||||||
if(multi::players > 1) return multi::player[i].at;
|
if(multi::players > 1) return multi::player[i].at;
|
||||||
@ -1210,14 +1226,14 @@ EX cell *playerpos(int i) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
EX bool allPlayersInBoats() {
|
EX bool allPlayersInBoats() {
|
||||||
for(int i=0; i<numplayers(); i++)
|
for(cell *pc: player_positions())
|
||||||
if(multi::playerActive(i) && playerpos(i)->wall != waBoat) return true;
|
if(pc->wall != waBoat) return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
EX int whichPlayerOn(cell *c) {
|
EX int whichPlayerOn(cell *c) {
|
||||||
if(singleused()) return c == singlepos() ? 0 : -1;
|
if(singleused()) return c == singlepos() ? 0 : -1;
|
||||||
for(int i=0; i<numplayers(); i++)
|
for(int i: player_indices())
|
||||||
if(playerpos(i) == c) return i;
|
if(playerpos(i) == c) return i;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1245,8 +1261,8 @@ EX bool isPlayerInBoatOn(cell *c) {
|
|||||||
EX bool playerInPower() {
|
EX bool playerInPower() {
|
||||||
if(singleused())
|
if(singleused())
|
||||||
return singlepos()->land == laPower || singlepos()->land == laHalloween;
|
return singlepos()->land == laPower || singlepos()->land == laHalloween;
|
||||||
for(int i=0; i<numplayers(); i++)
|
for(cell *pc: player_positions())
|
||||||
if(multi::playerActive(i) && (playerpos(i)->land == laPower || playerpos(i)->land == laHalloween))
|
if(pc->land == laPower || pc->land == laHalloween)
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
12
system.cpp
12
system.cpp
@ -326,12 +326,11 @@ EX void initgame() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(multi::players > 1 && !shmup::on) {
|
if(multi::players > 1 && !shmup::on) {
|
||||||
for(int i=0; i<numplayers(); i++)
|
for(cell *pc: player_positions())
|
||||||
makeEmpty(playerpos(i));
|
makeEmpty(pc);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for(int i=0; i<numplayers(); i++)
|
makeEmpty(cwt.at);
|
||||||
makeEmpty(cwt.at);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(specialland == laMinefield && bounded) {
|
if(specialland == laMinefield && bounded) {
|
||||||
@ -1258,9 +1257,8 @@ EX void stop_game() {
|
|||||||
for(int i=0; i<10; i++) for(int l=0; l<landtypes; l++)
|
for(int i=0; i<10; i++) for(int l=0; l<landtypes; l++)
|
||||||
exploreland[i][l] = 0;
|
exploreland[i][l] = 0;
|
||||||
|
|
||||||
for(int i=0; i<numplayers(); i++)
|
for(int i: player_indices())
|
||||||
if(multi::playerActive(i))
|
multi::deaths[i]++;
|
||||||
multi::deaths[i]++;
|
|
||||||
|
|
||||||
#if CAP_SAVE
|
#if CAP_SAVE
|
||||||
anticheat::tampered = false;
|
anticheat::tampered = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user