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; } } }
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)); } } }
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; } } }
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? }