Mario editor: started refactoring
This commit is contained in:
+5
-5
@@ -39,7 +39,7 @@ void loadMap(std::shared_ptr<SDLPP::Scene> &scene, std::shared_ptr<SDLPP::Rectan
|
||||
collision = true;
|
||||
}
|
||||
// TODO add modifiers to createTerrainBlock
|
||||
auto obj = createTerrainBlock(id, static_cast<BlockType>(type), renderer, i, j, collision);
|
||||
auto obj = createTerrainBlock(id, static_cast<LandType::Value>(type), renderer, i, j, collision);
|
||||
if(obj != nullptr)
|
||||
scene->addObject(obj);
|
||||
if(character) {
|
||||
@@ -53,7 +53,7 @@ void loadMap(std::shared_ptr<SDLPP::Scene> &scene, std::shared_ptr<SDLPP::Rectan
|
||||
}
|
||||
|
||||
// editor loader
|
||||
void loadMap(std::shared_ptr<SDLPP::Scene> &scene, const std::string &file, std::shared_ptr<SDLPP::Renderer> &renderer, std::vector<std::array<std::tuple<uint8_t, uint16_t, uint8_t, uint8_t, uint8_t, uint8_t>,16>> &objects) {
|
||||
void loadMap(std::shared_ptr<SDLPP::Scene> &scene, const std::string &file, std::shared_ptr<SDLPP::Renderer> &renderer, std::vector<mapColumnType> &objects) {
|
||||
std::ifstream map_file;
|
||||
map_file.open(file, std::ios::in | std::ios::binary);
|
||||
uint16_t cols;
|
||||
@@ -84,12 +84,12 @@ void loadMap(std::shared_ptr<SDLPP::Scene> &scene, const std::string &file, std:
|
||||
}
|
||||
col[j] = {type, id, character_type, character, modifier_type, modifier_data};
|
||||
// TODO add modifiers to createTerrainBlock
|
||||
auto obj = createTerrainBlock(id, static_cast<BlockType>(type), renderer, i, j, true);
|
||||
auto obj = createTerrainBlock(id, static_cast<LandType::Value>(type), renderer, i, j, true);
|
||||
obj->getCollisions()[0]->setId(EDITOR_TERRAIN_ID);
|
||||
scene->addObject(obj);
|
||||
if(character) {
|
||||
if(character == MARIO_ID) {
|
||||
scene->addObject(createMario(static_cast<BlockType>(character_type), renderer, i, j));
|
||||
scene->addObject(createMario(static_cast<LandType::Value>(character_type), renderer, i, j));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -100,7 +100,7 @@ void loadMap(std::shared_ptr<SDLPP::Scene> &scene, const std::string &file, std:
|
||||
}
|
||||
|
||||
// tuple - world object type, object, world character type, character, modifier type, modifier data
|
||||
void saveMap(const std::string &file, std::vector<std::array<std::tuple<uint8_t, uint16_t, uint8_t, uint8_t, uint8_t, uint8_t>,16>> &objects) {
|
||||
void saveMap(const std::string &file, std::vector<mapColumnType> &objects) {
|
||||
std::ofstream output_file;
|
||||
output_file.open(file, std::ios::out | std::ios::binary);
|
||||
uint16_t cols = objects.size();
|
||||
|
||||
Reference in New Issue
Block a user