Mario: add a dictionary of flags for each block

This commit is contained in:
2021-05-31 18:54:59 +02:00
parent af3954cb61
commit 243c1d9d04
4 changed files with 137 additions and 28 deletions
+5 -5
View File
@@ -593,7 +593,7 @@ void placeTool( SDLPP::Scene &scene ) {
createTerrainBlock( global_vars.current_tool->getId(),
global_vars.current_world_type, renderer,
global_vars.mouse.edit_box.getX(),
global_vars.mouse.edit_box.getY(), true );
global_vars.mouse.edit_box.getY(), false, true );
new_obj->getCollisions()[0]->setId( EDITOR_TERRAIN_ID );
break;
case VisitorType::Modifier:
@@ -623,7 +623,7 @@ void placeTool( SDLPP::Scene &scene ) {
global_vars.current_world_type, renderer,
global_vars.mouse.edit_box.getX(),
global_vars.mouse.edit_box.getY(),
global_vars.translucent_terrain_texture, true );
global_vars.translucent_terrain_texture, false, true );
new_obj->getCollisions()[0]->setId( EDITOR_TERRAIN_ID );
// TODO createModifierBlock
dynamic_cast< MarioBlock * >( new_obj.get() )
@@ -813,7 +813,7 @@ void populateToolGrid(
case ToolType::BLOCK:
case ToolType::MOD:
tool_store.push_back( createTerrainBlock(
block, global_vars.current_world_type, renderer, false ) );
block, global_vars.current_world_type, renderer, false, true ) );
default:
break;
}
@@ -860,7 +860,7 @@ void populateWorldType(
}
int tool_index = 0;
for ( auto &type : possibleLands ) {
auto land = createTerrainBlock( BRICK_ID, type, renderer, false );
auto land = createTerrainBlock( BRICK_ID, type, renderer, false, true );
auto x = tool_index % count_x;
auto y = tool_index / count_x;
land->setId( EDITOR_WORLD_CHANGE_ID );
@@ -917,7 +917,6 @@ int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
#else
int main() {
#endif
// TODO the code setting up UI is terrible, terrible mess, make it cleaner
SDLPP::init();
SDLPP::Window w( "Mario editor!" );
w.setResizable( true );
@@ -1043,6 +1042,7 @@ int main() {
global_vars.current_tool = createTerrainBlock(
possibleBlocks[global_vars.tool.index], global_vars.current_world_type,
renderer, global_vars.translucent_terrain_texture, false );
global_vars.current_tool->removeCollisions();
global_vars.current_tool->addCollision(
SDLPP::RectColider( 0.1, 0.1, 0.8, 0.8 ) );
dynamic_cast< MarioBlock & >( *global_vars.current_tool ).setTool();