Mario Editor: add land type switching

This commit is contained in:
2021-05-31 14:03:11 +02:00
parent af94cc0e03
commit cd0a301e52
6 changed files with 145 additions and 31 deletions
+10 -2
View File
@@ -1,5 +1,6 @@
#include "editor_visitor.hpp"
#include "../sdlpp/sdlpp_renderobject.hpp"
#include "blocks.hpp"
#include "objectids.hpp"
#include "edit_box.hpp"
#include "tool_box.hpp"
@@ -91,18 +92,25 @@ bool MouseVisitor::moveCharactersRight( uint64_t flags ) {
void ToolVisitor::visit( const SDLPP::RenderObject &obj ) {
auto id = obj.getCollisions()[0]->getId();
switch ( id ) {
case EDITOR_TERRAIN_ID:
case EDITOR_TERRAIN_ID: {
const MarioBlock &m_obj = dynamic_cast<const MarioBlock&>(obj);
remove_block = true;
if ( obj.getId() == source_id &&
m_obj.getType() == source_type &&
getVisitorType() == VisitorType::Terrain ) {
add_block = false;
}
case EDITOR_CHARACTER_ID:
}
break;
case EDITOR_CHARACTER_ID: {
const MarioBlock &m_obj = dynamic_cast<const MarioBlock&>(obj);
remove_block = true;
if ( obj.getId() == source_id &&
m_obj.getType() == source_type &&
getVisitorType() == VisitorType::Modifier ) {
add_block = false;
}
}
default:
break;
}