Example #1
0
void MapTests::makeVisionBlockerArray(const coord& origin, bool arrayToFill[MAP_X_CELLS][MAP_Y_CELLS], const int MAX_VISION_RANMGE) {
  const int X0 = max(0, origin.x - MAX_VISION_RANMGE - 1);
  const int Y0 = max(0, origin.y - MAX_VISION_RANMGE - 1);
  const int X1 = min(MAP_X_CELLS - 1, origin.x + MAX_VISION_RANMGE + 1);
  const int Y1 = min(MAP_Y_CELLS - 1, origin.y + MAX_VISION_RANMGE + 1);

  for(int y = Y0; y <= Y1; y++) {
    for(int x = X0; x <= X1; x++) {
      arrayToFill[x][y] = eng->map->featuresStatic[x][y]->isVisionPassable() == false;
    }
  }

  const unsigned int FEATURE_MOBS_SIZE = eng->gameTime->getFeatureMobsSize();
  int x = 0;
  int y = 0;
  FeatureMob* f = NULL;
  for(unsigned int i = 0; i < FEATURE_MOBS_SIZE; i++) {
    f = eng->gameTime->getFeatureMobAt(i);
    x = f->getX();
    y = f->getY();
    if(arrayToFill[x][y] == false) {
      arrayToFill[x][y] = f->isVisionPassable() == false;
    }
  }
}
Example #2
0
void MapTests::makeShootBlockerFeaturesArray(bool arrayToFill[MAP_X_CELLS][MAP_Y_CELLS]) {
  for(int y = 0; y < MAP_Y_CELLS; y++) {
    for(int x = 0; x < MAP_X_CELLS; x++) {
      arrayToFill[x][y] = eng->map->featuresStatic[x][y]->isShootPassable() == false;
    }
  }
  FeatureMob* f = NULL;
  const unsigned int FEATURE_MOBS_SIZE = eng->gameTime->getFeatureMobsSize();
  for(unsigned int i = 0; i < FEATURE_MOBS_SIZE; i++) {
    f = eng->gameTime->getFeatureMobAt(i);
    if(arrayToFill[f->getX()][f->getY()] == false) {
      arrayToFill[f->getX()][f->getY()] = f->isShootPassable() == false;
    }
  }
}
Example #3
0
void MapTests::makeMoveBlockerArrayForMoveTypeFeaturesOnly(const MoveType_t moveType, bool arrayToFill[MAP_X_CELLS][MAP_Y_CELLS]) {
  for(int y = 0; y < MAP_Y_CELLS; y++) {
    for(int x = 0; x < MAP_X_CELLS; x++) {
      arrayToFill[x][y] = !(eng->map->featuresStatic[x][y]->isMoveTypePassable(moveType));
    }
  }
  FeatureMob* f = NULL;
  const unsigned int FEATURE_MOBS_SIZE = eng->gameTime->getFeatureMobsSize();
  for(unsigned int i = 0; i < FEATURE_MOBS_SIZE; i++) {
    f = eng->gameTime->getFeatureMobAt(i);
    if(arrayToFill[f->getX()][f->getY()] == false) {
      arrayToFill[f->getX()][f->getY()] = !(f->isMoveTypePassable(moveType));
    }
  }
}
Example #4
0
void MapTests::makeItemBlockerArray(bool arrayToFill[MAP_X_CELLS][MAP_Y_CELLS]) {
  for(int y = MAP_Y_CELLS - 1; y >= 0; y--) {
    for(int x = MAP_X_CELLS - 1; x >= 0; x--) {
      arrayToFill[x][y] = !eng->map->featuresStatic[x][y]->canHaveItem();
    }
  }
  FeatureMob* f = NULL;
  const unsigned int FEATURE_MOBS_SIZE = eng->gameTime->getFeatureMobsSize();
  for(unsigned int i = 0; i < FEATURE_MOBS_SIZE; i++) {
    f = eng->gameTime->getFeatureMobAt(i);
    if(arrayToFill[f->getX()][f->getY()] == false) {
      arrayToFill[f->getX()][f->getY()] = !f->canHaveItem();
    }
  }
  //addActorsToBlockerArray(arrayToFill); //Why?
}
Example #5
0
bool BlocksItems::check(const FeatureMob& f) const {
  return f.canHaveItem() == false;
}
Example #6
0
bool BlocksProjectiles::check(const FeatureMob& f)  const {
  return f.isProjectilePassable() == false;
}
Example #7
0
bool BlocksActor::check(const FeatureMob& f) const {
  return f.canMove(actorsProps_) == false;
}
Example #8
0
bool BlocksMoveCmn::check(const FeatureMob& f) const {
  return f.canMoveCmn() == false;
}
Example #9
0
bool BlocksVision::check(const FeatureMob& f) const {
  return f.isVisionPassable() == false;
}