Level::Level* getLevel(size_t levelNum, const DiabloExe::DiabloExe& exe) { switch(levelNum) { case 0: { Level::Dun sector1("levels/towndata/sector1s.dun"); Level::Dun sector2("levels/towndata/sector2s.dun"); Level::Dun sector3("levels/towndata/sector3s.dun"); Level::Dun sector4("levels/towndata/sector4s.dun"); return new Level::Level(Level::Dun::getTown(sector1, sector2, sector3, sector4), "levels/towndata/town.til", "levels/towndata/town.min", "levels/towndata/town.sol", "levels/towndata/town.cel", std::make_pair(25,29), std::make_pair(0,0), std::map<size_t, size_t>()); break; } case 1: { return FALevelGen::generate(100, 100, levelNum, exe, "levels/l1data/l1.cel"); break; } case 2: case 3: case 4: { std::cerr << "level not supported yet" << std::endl; break; } } return NULL; }
void World::generateLevels() { Level::Dun sector1("levels/towndata/sector1s.dun"); Level::Dun sector2("levels/towndata/sector2s.dun"); Level::Dun sector3("levels/towndata/sector3s.dun"); Level::Dun sector4("levels/towndata/sector4s.dun"); mLevels.push_back(Level::Level(Level::Dun::getTown(sector1, sector2, sector3, sector4), "levels/towndata/town.til", "levels/towndata/town.min", "levels/towndata/town.sol", "levels/towndata/town.cel", std::make_pair(25,29), std::make_pair(75,68), std::map<size_t, size_t>(), -1, 1)); for(int32_t i = 1; i < 13; i++) { mLevels.push_back(FALevelGen::generate(100, 100, i, mDiabloExe, i-1, i+1)); } }
Level::Level* getLevel(size_t dLvl, const DiabloExe::DiabloExe& exe) { if(dLvl == 0) { Level::Dun sector1("levels/towndata/sector1s.dun"); Level::Dun sector2("levels/towndata/sector2s.dun"); Level::Dun sector3("levels/towndata/sector3s.dun"); Level::Dun sector4("levels/towndata/sector4s.dun"); return new Level::Level(Level::Dun::getTown(sector1, sector2, sector3, sector4), "levels/towndata/town.til", "levels/towndata/town.min", "levels/towndata/town.sol", "levels/towndata/town.cel", std::make_pair(25,29), std::make_pair(75,68), std::map<size_t, size_t>()); } else if(dLvl < 9) { return FALevelGen::generate(100, 100, dLvl, exe); } else { std::cerr << "level not supported yet" << std::endl; exit(1); return NULL; } }