Browse Source

Remove most uses of BFLAG_MONSTLR

pull/2891/head
obligaron 5 years ago committed by Anders Jenbo
parent
commit
74a1810576
  1. 4
      Source/loadsave.cpp
  2. 13
      Source/monster.cpp

4
Source/loadsave.cpp

@ -1772,7 +1772,7 @@ void LoadGame(bool firstflag)
}
for (int j = 0; j < MAXDUNY; j++) {
for (int i = 0; i < MAXDUNX; i++) // NOLINT(modernize-loop-convert)
dFlags[i][j] = file.NextLE<int8_t>() & ~BFLAG_PLAYERLR;
dFlags[i][j] = file.NextLE<int8_t>() & ~(BFLAG_PLAYERLR | BFLAG_MONSTLR);
}
for (int j = 0; j < MAXDUNY; j++) {
for (int i = 0; i < MAXDUNX; i++) // NOLINT(modernize-loop-convert)
@ -2159,7 +2159,7 @@ void LoadLevel()
for (int j = 0; j < MAXDUNY; j++) {
for (int i = 0; i < MAXDUNX; i++) // NOLINT(modernize-loop-convert)
dFlags[i][j] = file.NextLE<int8_t>() & ~BFLAG_PLAYERLR;
dFlags[i][j] = file.NextLE<int8_t>() & ~(BFLAG_PLAYERLR | BFLAG_MONSTLR);
}
for (int j = 0; j < MAXDUNY; j++) {
for (int i = 0; i < MAXDUNX; i++) // NOLINT(modernize-loop-convert)

13
Source/monster.cpp

@ -975,7 +975,6 @@ void StartWalk3(int i, int xvel, int yvel, int xoff, int yoff, int xadd, int yad
dMonster[monster.position.tile.x][monster.position.tile.y] = -(i + 1);
dMonster[fx][fy] = i + 1;
monster.position.temp = { x, y };
dFlags[x][y] |= BFLAG_MONSTLR;
monster.position.old = monster.position.tile;
monster.position.future = { fx, fy };
monster.position.offset = { xoff, yoff };
@ -1356,7 +1355,6 @@ bool MonsterWalk(int i, MonsterMode variant)
case MonsterMode::MoveSideways:
dMonster[monster.position.tile.x][monster.position.tile.y] = 0;
monster.position.tile = { monster._mVar1, monster._mVar2 };
dFlags[monster.position.temp.x][monster.position.temp.y] &= ~BFLAG_MONSTLR;
// dMonster is set here for backwards comparability, without it the monster would be invisible if loaded from a vanilla save.
dMonster[monster.position.tile.x][monster.position.tile.y] = i + 1;
break;
@ -3959,11 +3957,6 @@ void M_ClearSquares(int i)
}
}
}
if (mx + 1 < MAXDUNX)
dFlags[mx + 1][my] &= ~BFLAG_MONSTLR;
if (my + 1 < MAXDUNY)
dFlags[mx][my + 1] &= ~BFLAG_MONSTLR;
}
void M_GetKnockback(int i)
@ -4402,10 +4395,10 @@ bool DirOK(int i, Direction mdir)
if (futurePosition.y < 0 || futurePosition.y >= MAXDUNY || futurePosition.x < 0 || futurePosition.x >= MAXDUNX || !IsTileAvailable(monster, futurePosition))
return false;
if (mdir == Direction::East) {
if (IsTileSolid(position + Direction::SouthEast) || (dFlags[position.x + 1][position.y] & BFLAG_MONSTLR) != 0)
if (IsTileSolid(position + Direction::SouthEast))
return false;
} else if (mdir == Direction::West) {
if (IsTileSolid(position + Direction::SouthWest) || (dFlags[position.x][position.y + 1] & BFLAG_MONSTLR) != 0)
if (IsTileSolid(position + Direction::SouthWest))
return false;
} else if (mdir == Direction::North) {
if (IsTileSolid(position + Direction::NorthEast) || IsTileSolid(position + Direction::NorthWest))
@ -4440,7 +4433,7 @@ bool DirOK(int i, Direction mdir)
bool PosOkMissile(Point position)
{
return !nMissileTable[dPiece[position.x][position.y]] && (dFlags[position.x][position.y] & BFLAG_MONSTLR) == 0;
return !nMissileTable[dPiece[position.x][position.y]];
}
bool LineClearMissile(Point startPoint, Point endPoint)

Loading…
Cancel
Save