Mario: add MapObject and use that instead of tuples

This commit is contained in:
2021-06-07 23:48:28 +02:00
parent 76f55fd98c
commit a54d079fd2
9 changed files with 329 additions and 169 deletions
+3 -17
View File
@@ -3,30 +3,16 @@
#include "../sdlpp/sdlpp_scene.hpp"
#include "../sdlpp/sdlpp_rectrenderer.hpp"
#include "mapobject.hpp"
struct MapObject {
enum Index {
TERRAIN_TYPE = 0,
TERRAIN_ID = 1,
CHARACTER_TYPE = 2,
CHARACTER_ID = 3,
MODIFIER_TYPE = 4,
MODIFIER_DATA = 5,
};
};
typedef std::tuple< uint8_t, uint16_t, uint8_t, uint8_t, uint8_t, uint8_t >
mapObjectType;
typedef std::array< mapObjectType, 16 > mapColumnType;
typedef std::array< MapObject, 16 > mapColumnType;
void loadMap( std::shared_ptr< SDLPP::Scene > &scene,
std::shared_ptr< SDLPP::RenderObject > mario,
const std::string &file,
std::shared_ptr< SDLPP::Renderer > &renderer );
const std::string &file );
void loadMap( std::shared_ptr< SDLPP::Scene > &scene,
std::shared_ptr< SDLPP::RenderObject > &mario,
const std::string &file,
std::shared_ptr< SDLPP::Renderer > &renderer,
std::vector< mapColumnType > &objects, bool editor = false, size_t editor_width = 0 );
void saveMap( const std::string &file, std::vector< mapColumnType > &objects );