Blocks.cpp: add character support to
This commit is contained in:
parent
c7309d56a3
commit
c183e58f6e
@ -11,6 +11,7 @@
|
|||||||
#include "blocks/coineditorblock.hpp"
|
#include "blocks/coineditorblock.hpp"
|
||||||
#include "blocks/coinblock.hpp"
|
#include "blocks/coinblock.hpp"
|
||||||
#include "blocks/mushroomblock.hpp"
|
#include "blocks/mushroomblock.hpp"
|
||||||
|
#include "blocks/goombablock.hpp"
|
||||||
#include "mario.hpp"
|
#include "mario.hpp"
|
||||||
|
|
||||||
#define CAN_BE_DESTROYED_FLAG 0x0000000000000001
|
#define CAN_BE_DESTROYED_FLAG 0x0000000000000001
|
||||||
@ -36,7 +37,8 @@ void MarioBlock::visit( SDLPP::Visitor &visitor ) {
|
|||||||
destroy();
|
destroy();
|
||||||
}
|
}
|
||||||
if ( !_tool && !_terrain &&
|
if ( !_tool && !_terrain &&
|
||||||
visitor.getVisitorType() == VisitorType::Modifier ) {
|
(visitor.getVisitorType() == VisitorType::Modifier ||
|
||||||
|
visitor.getVisitorType() == VisitorType::Character)) {
|
||||||
destroy();
|
destroy();
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@ -305,6 +307,7 @@ const std::vector< uint64_t > possibleMods = {
|
|||||||
|
|
||||||
const std::vector< uint64_t > possibleCharacters = {
|
const std::vector< uint64_t > possibleCharacters = {
|
||||||
MARIO_ID,
|
MARIO_ID,
|
||||||
|
GOOMBA_ID,
|
||||||
};
|
};
|
||||||
|
|
||||||
const std::vector< LandType::Value > possibleLands = {
|
const std::vector< LandType::Value > possibleLands = {
|
||||||
@ -560,6 +563,10 @@ createBlockById( uint64_t id, int x, int y,
|
|||||||
result = std::static_pointer_cast< MarioBlock >(
|
result = std::static_pointer_cast< MarioBlock >(
|
||||||
std::make_shared< Mario >( x, y, renderer ) );
|
std::make_shared< Mario >( x, y, renderer ) );
|
||||||
break;
|
break;
|
||||||
|
case GOOMBA_ID:
|
||||||
|
result = std::static_pointer_cast< MarioBlock >(
|
||||||
|
std::make_shared< GoombaBlock >( x, y, renderer ) );
|
||||||
|
break;
|
||||||
case DESTRUCTIBLE_MODIFIER_ID:
|
case DESTRUCTIBLE_MODIFIER_ID:
|
||||||
result = std::static_pointer_cast< MarioBlock >(
|
result = std::static_pointer_cast< MarioBlock >(
|
||||||
std::make_shared< DestructibleModifierBlock >( x, y, renderer ) );
|
std::make_shared< DestructibleModifierBlock >( x, y, renderer ) );
|
||||||
@ -647,8 +654,7 @@ enum BlockRole::Value getBlockRole( uint64_t id ) {
|
|||||||
if ( id == MARIO_ID )
|
if ( id == MARIO_ID )
|
||||||
return BlockRole::MARIO;
|
return BlockRole::MARIO;
|
||||||
if ( id < MARIO_ID )
|
if ( id < MARIO_ID )
|
||||||
return BlockRole::MODIFIER;
|
return BlockRole::CHARACTER;
|
||||||
// TODO modifier/character
|
|
||||||
return BlockRole::MODIFIER;
|
return BlockRole::MODIFIER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user