Compare commits

...

2 Commits

Author SHA1 Message Date
0d855ed218 Mario: formatting
Some checks reported errors
continuous-integration/drone/push Build is passing
continuous-integration/drone Build was killed
2021-10-18 10:10:43 +02:00
303490a619 CI: fix formatting check 2021-10-18 10:10:28 +02:00
21 changed files with 542 additions and 491 deletions

View File

@ -28,4 +28,4 @@ steps:
image: cppbuilder:v0.5 image: cppbuilder:v0.5
commands: commands:
- cd mario - cd mario
- find . -path "./build" -prune -or \( -iname "*.cpp" -or -iname "*.hpp" \) | xargs -P0 -I{} clang-format -style=file --dry-run -Werror {} - find . -path "./build" -prune -or -path "./.cache" -prune -or -iname "*.cpp" -or -iname "*.hpp" -print | xargs -P0 -I{} clang-format -style=file --dry-run -Werror {}

View File

@ -2,14 +2,15 @@
#include "../sprites.hpp" #include "../sprites.hpp"
#include "../global_vars.hpp" #include "../global_vars.hpp"
CoinBlock::CoinBlock( int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ) : MarioBlock(x, y, renderer, g_terrain_texture, COIN_SRC, true, true) { CoinBlock::CoinBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock(x, y, renderer, g_terrain_texture, COIN_SRC, true, true) {
setHidden(true); setHidden(true);
bounce_speed = 0.75; bounce_speed = 0.75;
bounce_ticks = 150; bounce_ticks = 150;
} }
void CoinBlock::custom_move(int ticks) { void CoinBlock::custom_move(int ticks) {
if(_parent != nullptr && !_parent->isBouncing() && !isBouncing()) { if (_parent != nullptr && !_parent->isBouncing() && !isBouncing()) {
setHidden(false); setHidden(false);
bounce(); bounce();
_parent = nullptr; _parent = nullptr;

View File

@ -5,9 +5,10 @@
class CoinBlock : public MarioBlock { class CoinBlock : public MarioBlock {
public: public:
CoinBlock( int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ); CoinBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
void custom_move(int ticks) override; void custom_move(int ticks) override;
void setParent(MarioBlock *parent); void setParent(MarioBlock *parent);
private: private:
MarioBlock *_parent = nullptr; MarioBlock *_parent = nullptr;
}; };

View File

@ -1,24 +1,24 @@
#include "coineditorblock.hpp" #include "coineditorblock.hpp"
#include "../objectids.hpp" #include "../objectids.hpp"
CoinEditorBlock::CoinEditorBlock( int x, int y, CoinEditorBlock::CoinEditorBlock(int x, int y,
std::shared_ptr< SDLPP::Renderer > renderer ) std::shared_ptr<SDLPP::Renderer> renderer)
: MarioBlock( x, y, renderer, g_translucent_mod_texture, MOD_COIN_SRC, : MarioBlock(x, y, renderer, g_translucent_mod_texture, MOD_COIN_SRC,
false, false ) { false, false) {
setId( COIN_MODIFIER_ID ); setId(COIN_MODIFIER_ID);
auto mypos = getDoubleRect(); auto mypos = getDoubleRect();
auto size = mypos.second.getX() / size_divisor; auto size = mypos.second.getX() / size_divisor;
_amount_text = std::make_shared< SDLPP::TextRenderer >( _amount_text = std::make_shared<SDLPP::TextRenderer>(
mypos.first.getX() + mypos.second.getX() - size, mypos.first.getX() + mypos.second.getX() - size,
mypos.first.getY() + mypos.second.getX() - size, size, size, renderer, mypos.first.getY() + mypos.second.getX() - size, size, size, renderer,
"1", g_text_config ); "1", g_text_config);
setAlignment( SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER ); setAlignment(SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER);
_amount_text->setAlignment( SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER ); _amount_text->setAlignment(SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER);
} }
void CoinEditorBlock::render() { void CoinEditorBlock::render() {
MarioBlock::render(); MarioBlock::render();
if ( _amount_text != nullptr && !hidden ) { if (_amount_text != nullptr && !hidden) {
_amount_text->render(); _amount_text->render();
} }
} }
@ -26,28 +26,28 @@ void CoinEditorBlock::render() {
void CoinEditorBlock::updateSizeAndPosition() { void CoinEditorBlock::updateSizeAndPosition() {
MarioBlock::updateSizeAndPosition(); MarioBlock::updateSizeAndPosition();
auto block_size = getDoubleRect().second; auto block_size = getDoubleRect().second;
_amount_text->setPos( getPos() + block_size - block_size / size_divisor ); _amount_text->setPos(getPos() + block_size - block_size / size_divisor);
_amount_text->updateSizeAndPosition(); _amount_text->updateSizeAndPosition();
} }
void CoinEditorBlock::addOne() { void CoinEditorBlock::addOne() {
if ( _amount < max_amount ) { if (_amount < max_amount) {
_amount++; _amount++;
updateText(); updateText();
} }
} }
void CoinEditorBlock::subtractOne() { void CoinEditorBlock::subtractOne() {
if ( _amount > 1 ) { if (_amount > 1) {
_amount--; _amount--;
updateText(); updateText();
} }
} }
void CoinEditorBlock::setAmount( int amount ) { void CoinEditorBlock::setAmount(int amount) {
if ( amount < 1 ) { if (amount < 1) {
amount = 1; amount = 1;
} else if ( amount > max_amount ) { } else if (amount > max_amount) {
amount = max_amount; amount = max_amount;
} }
_amount = amount; _amount = amount;
@ -55,7 +55,7 @@ void CoinEditorBlock::setAmount( int amount ) {
} }
void CoinEditorBlock::updateText() { void CoinEditorBlock::updateText() {
_amount_text->changeText( std::to_string( _amount ) ); _amount_text->changeText(std::to_string(_amount));
} }
void CoinEditorBlock::onScrollUp() { void CoinEditorBlock::onScrollUp() {
@ -70,6 +70,6 @@ uint8_t CoinEditorBlock::getData() const {
return _amount; return _amount;
} }
void CoinEditorBlock::setData( uint8_t data ) { void CoinEditorBlock::setData(uint8_t data) {
setAmount( data ); setAmount(data);
} }

View File

@ -8,22 +8,21 @@
class CoinEditorBlock : public MarioBlock { class CoinEditorBlock : public MarioBlock {
public: public:
CoinEditorBlock( int x, int y, CoinEditorBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> renderer);
std::shared_ptr< SDLPP::Renderer > renderer );
void render() override; void render() override;
void updateSizeAndPosition() override; void updateSizeAndPosition() override;
void addOne(); void addOne();
void subtractOne(); void subtractOne();
void setAmount( int amount ); void setAmount(int amount);
void onScrollUp() override; void onScrollUp() override;
void onScrollDown() override; void onScrollDown() override;
uint8_t getData() const override; uint8_t getData() const override;
void setData( uint8_t data ) override; void setData(uint8_t data) override;
private: private:
void updateText(); void updateText();
int _amount = 1; int _amount = 1;
std::shared_ptr< SDLPP::TextRenderer > _amount_text; std::shared_ptr<SDLPP::TextRenderer> _amount_text;
constexpr static double size_divisor = 1.5; constexpr static double size_divisor = 1.5;
constexpr static uint8_t max_amount = 15; constexpr static uint8_t max_amount = 15;
}; };

View File

@ -4,21 +4,24 @@
#include "../objectids.hpp" #include "../objectids.hpp"
#include "../visitors/goomba_visitor.hpp" #include "../visitors/goomba_visitor.hpp"
GoombaBlock::GoombaBlock( int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ) : MarioBlock(x, y, renderer, g_enemies_texture, GOOMBA_WALK_ANIM[0], true, true) { GoombaBlock::GoombaBlock(int x, int y,
std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock(x, y, renderer, g_enemies_texture, GOOMBA_WALK_ANIM[0],
true, true) {
#ifndef EDITOR #ifndef EDITOR
setAnimationFrames(GOOMBA_WALK_ANIM); setAnimationFrames(GOOMBA_WALK_ANIM);
setAnimationSpeed(12.5); setAnimationSpeed(12.5);
resumeAnimation(); resumeAnimation();
#endif #endif
setId(GOOMBA_ID); setId(GOOMBA_ID);
auto bottom_detect = SDLPP::RectColider( 0.2, 1, 0.6, 0, NPC_FLOOR_DETECT ); auto bottom_detect = SDLPP::RectColider(0.2, 1, 0.6, 0, NPC_FLOOR_DETECT);
bottom_detect.setMinHeight(1); bottom_detect.setMinHeight(1);
addCollision(bottom_detect); addCollision(bottom_detect);
addCollision(SDLPP::RectColider(0, 0.25, 0.1, 0.6, NPC_LEFT_SIDE_DETECT));
addCollision( addCollision(
SDLPP::RectColider( 0, 0.25, 0.1, 0.6, NPC_LEFT_SIDE_DETECT ) ); SDLPP::RectColider(0.9, 0.25, 0.1, 0.6, NPC_RIGHT_SIDE_DETECT));
addCollision( addCollision(std::make_shared<SDLPP::RectColider>(0.5, 0, 0.2, 0.15,
SDLPP::RectColider( 0.9, 0.25, 0.1, 0.6, NPC_RIGHT_SIDE_DETECT ) ); NPC_TOP_DETECT));
addCollision( std::make_shared<SDLPP::RectColider>( 0.5, 0, 0.2, 0.15, NPC_TOP_DETECT ) );
#ifndef EDITOR #ifndef EDITOR
setMovement(-0.19, 0); setMovement(-0.19, 0);
#endif #endif
@ -26,7 +29,7 @@ GoombaBlock::GoombaBlock( int x, int y, std::shared_ptr< SDLPP::Renderer > &rend
void GoombaBlock::move(int ticks) { void GoombaBlock::move(int ticks) {
#ifndef EDITOR #ifndef EDITOR
if(wasVisible()) { if (wasVisible()) {
MarioBlock::move(ticks); MarioBlock::move(ticks);
} }
#else #else
@ -36,9 +39,9 @@ void GoombaBlock::move(int ticks) {
void GoombaBlock::custom_move(int ticks) { void GoombaBlock::custom_move(int ticks) {
#ifndef EDITOR #ifndef EDITOR
if(death_started) { if (death_started) {
death_countdown -= ticks; death_countdown -= ticks;
if(death_countdown <= 0) { if (death_countdown <= 0) {
destroy(); destroy();
} }
} else { } else {
@ -50,22 +53,22 @@ void GoombaBlock::custom_move(int ticks) {
void GoombaBlock::handleVisitor(SDLPP::Visitor &visitor) { void GoombaBlock::handleVisitor(SDLPP::Visitor &visitor) {
#ifndef EDITOR #ifndef EDITOR
auto &g_visitor = dynamic_cast<GoombaVisitor&>(visitor); auto &g_visitor = dynamic_cast<GoombaVisitor &>(visitor);
setOnGround(g_visitor.isOnGround()); setOnGround(g_visitor.isOnGround());
if(isOnGround()) { if (isOnGround()) {
setPos(getPos().getX(), g_visitor.getGroundY() - BLOCK_SIZE); setPos(getPos().getX(), g_visitor.getGroundY() - BLOCK_SIZE);
} }
if(!g_visitor.canGoLeft() || !g_visitor.canGoRight()) { if (!g_visitor.canGoLeft() || !g_visitor.canGoRight()) {
setPos(g_visitor.getValidXPos(), getPos().getY()); setPos(g_visitor.getValidXPos(), getPos().getY());
setMovement(-getMovement().getX(), getMovement().getY()); setMovement(-getMovement().getX(), getMovement().getY());
} }
if(g_visitor.isDead()) { if (g_visitor.isDead()) {
removeCollisions(); removeCollisions();
pauseAnimation(); pauseAnimation();
setBaseRect(GOOMBA_DEATH_SRC); setBaseRect(GOOMBA_DEATH_SRC);
setMovement(0, 0); setMovement(0, 0);
startDeath(); startDeath();
//destroy(); // destroy();
} }
#endif #endif
} }

View File

@ -5,10 +5,11 @@
class GoombaBlock : public MarioBlock { class GoombaBlock : public MarioBlock {
public: public:
GoombaBlock( int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ); GoombaBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
void custom_move(int ticks) override; void custom_move(int ticks) override;
void move(int ticks) override; void move(int ticks) override;
void handleVisitor(SDLPP::Visitor &visitor) override; void handleVisitor(SDLPP::Visitor &visitor) override;
private: private:
void startDeath(); void startDeath();
int death_countdown = 100; int death_countdown = 100;

View File

@ -4,29 +4,31 @@
#include "../objectids.hpp" #include "../objectids.hpp"
#include "../visitors/mushroom_visitor.hpp" #include "../visitors/mushroom_visitor.hpp"
MushroomBlock::MushroomBlock( int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ) : MarioBlock(x, y, renderer, g_terrain_texture, MUSHROOM_SRC, true, true) { MushroomBlock::MushroomBlock(int x, int y,
std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock(x, y, renderer, g_terrain_texture, MUSHROOM_SRC, true,
true) {
setHidden(true); setHidden(true);
ensureCollision(); ensureCollision();
setId(MUSHROOM_ID); setId(MUSHROOM_ID);
auto bottom_detect = SDLPP::RectColider( 0.2, 1, 0.6, 0, NPC_FLOOR_DETECT ); auto bottom_detect = SDLPP::RectColider(0.2, 1, 0.6, 0, NPC_FLOOR_DETECT);
bottom_detect.setColor("#FF0000"); bottom_detect.setColor("#FF0000");
bottom_detect.setOutlineColor("#FF0000"); bottom_detect.setOutlineColor("#FF0000");
bottom_detect.setMinHeight(1); bottom_detect.setMinHeight(1);
addCollision(bottom_detect); addCollision(bottom_detect);
addCollision(SDLPP::RectColider(0, 0.25, 0.1, 0.6, NPC_LEFT_SIDE_DETECT));
addCollision( addCollision(
SDLPP::RectColider( 0, 0.25, 0.1, 0.6, NPC_LEFT_SIDE_DETECT ) ); SDLPP::RectColider(0.9, 0.25, 0.1, 0.6, NPC_RIGHT_SIDE_DETECT));
addCollision(
SDLPP::RectColider( 0.9, 0.25, 0.1, 0.6, NPC_RIGHT_SIDE_DETECT ) );
} }
void MushroomBlock::custom_move(int ticks) { void MushroomBlock::custom_move(int ticks) {
if(_parent != nullptr && !_parent->isBouncing() && !isTraveling()) { if (_parent != nullptr && !_parent->isBouncing() && !isTraveling()) {
setHidden(false); setHidden(false);
travelToPos(_parent->getPos() - SDLPP::Vec2D<double>(0, BLOCK_SIZE)); travelToPos(_parent->getPos() - SDLPP::Vec2D<double>(0, BLOCK_SIZE));
_parent = nullptr; _parent = nullptr;
} else if(_parent == nullptr && !isTraveling() && !_started_movement) { } else if (_parent == nullptr && !isTraveling() && !_started_movement) {
_started_movement = true; _started_movement = true;
setMovement(movementSpeed/2, 0); setMovement(movementSpeed / 2, 0);
} }
gravity(ticks); gravity(ticks);
MarioBlock::custom_move(ticks); MarioBlock::custom_move(ticks);
@ -37,19 +39,19 @@ void MushroomBlock::setParent(MarioBlock *parent) {
} }
void MushroomBlock::handleVisitor(SDLPP::Visitor &visitor) { void MushroomBlock::handleVisitor(SDLPP::Visitor &visitor) {
if(!_started_movement) { if (!_started_movement) {
return; return;
} }
auto &m_visitor = dynamic_cast<MushroomVisitor&>(visitor); auto &m_visitor = dynamic_cast<MushroomVisitor &>(visitor);
setOnGround(m_visitor.isOnGround()); setOnGround(m_visitor.isOnGround());
if(isOnGround()) { if (isOnGround()) {
setPos(getPos().getX(), m_visitor.getGroundY() - BLOCK_SIZE); setPos(getPos().getX(), m_visitor.getGroundY() - BLOCK_SIZE);
} }
if(!m_visitor.canGoLeft() || !m_visitor.canGoRight()) { if (!m_visitor.canGoLeft() || !m_visitor.canGoRight()) {
setPos(m_visitor.getValidXPos(), getPos().getY()); setPos(m_visitor.getValidXPos(), getPos().getY());
setMovement(-getMovement().getX(), getMovement().getY()); setMovement(-getMovement().getX(), getMovement().getY());
} }
if(m_visitor.getDeath()) { if (m_visitor.getDeath()) {
destroy(); destroy();
} }
} }

View File

@ -5,10 +5,11 @@
class MushroomBlock : public MarioBlock { class MushroomBlock : public MarioBlock {
public: public:
MushroomBlock( int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ); MushroomBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
void custom_move(int ticks) override; void custom_move(int ticks) override;
void setParent(MarioBlock *parent); void setParent(MarioBlock *parent);
void handleVisitor(SDLPP::Visitor &visitor) override; void handleVisitor(SDLPP::Visitor &visitor) override;
private: private:
MarioBlock *_parent = nullptr; MarioBlock *_parent = nullptr;
bool _started_movement = false; bool _started_movement = false;

View File

@ -3,453 +3,444 @@
#include "../sprites.hpp" #include "../sprites.hpp"
#include "../objectids.hpp" #include "../objectids.hpp"
FloorBlock::FloorBlock( int x, int y, FloorBlock::FloorBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer)
std::shared_ptr< SDLPP::Renderer > &renderer ) : MarioBlock(x, y, renderer, g_terrain_texture, FLOOR_SRC, true) {
: MarioBlock( x, y, renderer, g_terrain_texture, FLOOR_SRC, true ) {
ensureCollision(); ensureCollision();
setId( FLOOR_ID ); setId(FLOOR_ID);
} }
HillInclineBlock::HillInclineBlock( HillInclineBlock::HillInclineBlock(int x, int y,
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ) std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, HILL_INCLINE_SRC, : MarioBlock(x, y, renderer, g_terrain_texture, HILL_INCLINE_SRC,
false ) { false) {
setId( HILL_INCLINE_ID ); setId(HILL_INCLINE_ID);
} }
HillDeclineBlock::HillDeclineBlock( HillDeclineBlock::HillDeclineBlock(int x, int y,
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ) std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, HILL_DECLINE_SRC, : MarioBlock(x, y, renderer, g_terrain_texture, HILL_DECLINE_SRC,
false ) { false) {
setId( HILL_INCLINE_ID ); setId(HILL_INCLINE_ID);
} }
HillDotsRightBlock::HillDotsRightBlock( HillDotsRightBlock::HillDotsRightBlock(
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ) int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, HILL_DOTS_RIGHT_SRC, : MarioBlock(x, y, renderer, g_terrain_texture, HILL_DOTS_RIGHT_SRC,
false ) { false) {
setId( HILL_DOTS_RIGHT_ID ); setId(HILL_DOTS_RIGHT_ID);
} }
HillDotsLeftBlock::HillDotsLeftBlock( HillDotsLeftBlock::HillDotsLeftBlock(int x, int y,
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ) std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, HILL_DOTS_LEFT_SRC, : MarioBlock(x, y, renderer, g_terrain_texture, HILL_DOTS_LEFT_SRC,
false ) { false) {
setId( HILL_DOTS_LEFT_ID ); setId(HILL_DOTS_LEFT_ID);
} }
HillFillBlock::HillFillBlock( int x, int y, HillFillBlock::HillFillBlock(int x, int y,
std::shared_ptr< SDLPP::Renderer > &renderer ) std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, HILL_FILL_SRC, : MarioBlock(x, y, renderer, g_terrain_texture, HILL_FILL_SRC, false) {
false ) { setId(HILL_FILL_ID);
setId( HILL_FILL_ID );
} }
HillTopBlock::HillTopBlock( int x, int y, HillTopBlock::HillTopBlock(int x, int y,
std::shared_ptr< SDLPP::Renderer > &renderer ) std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, HILL_TOP_SRC, false ) { : MarioBlock(x, y, renderer, g_terrain_texture, HILL_TOP_SRC, false) {
setId( HILL_TOP_ID ); setId(HILL_TOP_ID);
} }
BushLeftBlock::BushLeftBlock( int x, int y, BushLeftBlock::BushLeftBlock(int x, int y,
std::shared_ptr< SDLPP::Renderer > &renderer ) std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, BUSH_LEFT_SRC, : MarioBlock(x, y, renderer, g_terrain_texture, BUSH_LEFT_SRC, false) {
false ) { setId(BUSH_LEFT_ID);
setId( BUSH_LEFT_ID );
} }
BushMiddleBlock::BushMiddleBlock( int x, int y, BushMiddleBlock::BushMiddleBlock(int x, int y,
std::shared_ptr< SDLPP::Renderer > &renderer ) std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, BUSH_MIDDLE_SRC, : MarioBlock(x, y, renderer, g_terrain_texture, BUSH_MIDDLE_SRC,
false ) { false) {
setId( BUSH_MIDDLE_ID ); setId(BUSH_MIDDLE_ID);
} }
BushRightBlock::BushRightBlock( int x, int y, BushRightBlock::BushRightBlock(int x, int y,
std::shared_ptr< SDLPP::Renderer > &renderer ) std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, BUSH_RIGHT_SRC, : MarioBlock(x, y, renderer, g_terrain_texture, BUSH_RIGHT_SRC, false) {
false ) { setId(BUSH_RIGHT_ID);
setId( BUSH_RIGHT_ID );
} }
CloudLeftBottomBlock::CloudLeftBottomBlock( CloudLeftBottomBlock::CloudLeftBottomBlock(
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ) int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, CLOUD_LEFT_BOTTOM_SRC, : MarioBlock(x, y, renderer, g_terrain_texture, CLOUD_LEFT_BOTTOM_SRC,
false ) { false) {
setId( CLOUD_LEFT_BOTTOM_ID ); setId(CLOUD_LEFT_BOTTOM_ID);
} }
CloudMiddleBottomBlock::CloudMiddleBottomBlock( CloudMiddleBottomBlock::CloudMiddleBottomBlock(
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ) int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, : MarioBlock(x, y, renderer, g_terrain_texture, CLOUD_MIDDLE_BOTTOM_SRC,
CLOUD_MIDDLE_BOTTOM_SRC, false ) { false) {
setId( CLOUD_MIDDLE_BOTTOM_ID ); setId(CLOUD_MIDDLE_BOTTOM_ID);
} }
CloudRightBottomBlock::CloudRightBottomBlock( CloudRightBottomBlock::CloudRightBottomBlock(
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ) int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, CLOUD_RIGHT_BOTTOM_SRC, : MarioBlock(x, y, renderer, g_terrain_texture, CLOUD_RIGHT_BOTTOM_SRC,
false ) { false) {
setId( CLOUD_RIGHT_BOTTOM_ID ); setId(CLOUD_RIGHT_BOTTOM_ID);
} }
CloudLeftTopBlock::CloudLeftTopBlock( CloudLeftTopBlock::CloudLeftTopBlock(int x, int y,
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ) std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, CLOUD_LEFT_TOP_SRC, : MarioBlock(x, y, renderer, g_terrain_texture, CLOUD_LEFT_TOP_SRC,
false ) { false) {
setId( CLOUD_LEFT_TOP_ID ); setId(CLOUD_LEFT_TOP_ID);
} }
CloudMiddleTopBlock::CloudMiddleTopBlock( CloudMiddleTopBlock::CloudMiddleTopBlock(
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ) int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, CLOUD_MIDDLE_TOP_SRC, : MarioBlock(x, y, renderer, g_terrain_texture, CLOUD_MIDDLE_TOP_SRC,
false ) { false) {
setId( CLOUD_MIDDLE_TOP_ID ); setId(CLOUD_MIDDLE_TOP_ID);
} }
CloudRightTopBlock::CloudRightTopBlock( CloudRightTopBlock::CloudRightTopBlock(
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ) int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, CLOUD_RIGHT_TOP_SRC, : MarioBlock(x, y, renderer, g_terrain_texture, CLOUD_RIGHT_TOP_SRC,
false ) { false) {
setId( CLOUD_RIGHT_TOP_ID ); setId(CLOUD_RIGHT_TOP_ID);
} }
PipeLeftBottomBlock::PipeLeftBottomBlock( PipeLeftBottomBlock::PipeLeftBottomBlock(
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ) int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, PIPE_LEFT_BOTTOM_SRC, : MarioBlock(x, y, renderer, g_terrain_texture, PIPE_LEFT_BOTTOM_SRC,
false ) { false) {
ensureCollision(); ensureCollision();
setId( PIPE_LEFT_BOTTOM_ID ); setId(PIPE_LEFT_BOTTOM_ID);
} }
PipeRightBottomBlock::PipeRightBottomBlock( PipeRightBottomBlock::PipeRightBottomBlock(
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ) int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, PIPE_RIGHT_BOTTOM_SRC, : MarioBlock(x, y, renderer, g_terrain_texture, PIPE_RIGHT_BOTTOM_SRC,
false ) { false) {
ensureCollision(); ensureCollision();
setId( PIPE_RIGHT_BOTTOM_ID ); setId(PIPE_RIGHT_BOTTOM_ID);
} }
PipeLeftTopBlock::PipeLeftTopBlock( PipeLeftTopBlock::PipeLeftTopBlock(int x, int y,
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ) std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, PIPE_LEFT_TOP_SRC, : MarioBlock(x, y, renderer, g_terrain_texture, PIPE_LEFT_TOP_SRC,
false ) { false) {
ensureCollision(); ensureCollision();
setId( PIPE_LEFT_TOP_ID ); setId(PIPE_LEFT_TOP_ID);
} }
PipeRightTopBlock::PipeRightTopBlock( PipeRightTopBlock::PipeRightTopBlock(int x, int y,
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ) std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, PIPE_RIGHT_TOP_SRC, : MarioBlock(x, y, renderer, g_terrain_texture, PIPE_RIGHT_TOP_SRC,
false ) { false) {
ensureCollision(); ensureCollision();
setId( PIPE_RIGHT_TOP_ID ); setId(PIPE_RIGHT_TOP_ID);
} }
CastleLeftBlock::CastleLeftBlock( int x, int y, CastleLeftBlock::CastleLeftBlock(int x, int y,
std::shared_ptr< SDLPP::Renderer > &renderer ) std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, CASTLE_LEFT_SRC, : MarioBlock(x, y, renderer, g_terrain_texture, CASTLE_LEFT_SRC,
false ) { false) {
setId( CASTLE_LEFT_ID ); setId(CASTLE_LEFT_ID);
} }
CastleRightBlock::CastleRightBlock( CastleRightBlock::CastleRightBlock(int x, int y,
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ) std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, CASTLE_RIGHT_SRC, : MarioBlock(x, y, renderer, g_terrain_texture, CASTLE_RIGHT_SRC,
false ) { false) {
setId( CASTLE_RIGHT_ID ); setId(CASTLE_RIGHT_ID);
} }
CastleBlackBlock::CastleBlackBlock( CastleBlackBlock::CastleBlackBlock(int x, int y,
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ) std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, CASTLE_BLACK_SRC, : MarioBlock(x, y, renderer, g_terrain_texture, CASTLE_BLACK_SRC,
false ) { false) {
setId( CASTLE_BLACK_ID ); setId(CASTLE_BLACK_ID);
} }
CastleEntryBlock::CastleEntryBlock( CastleEntryBlock::CastleEntryBlock(int x, int y,
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ) std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, CASTLE_ENTRY_SRC, : MarioBlock(x, y, renderer, g_terrain_texture, CASTLE_ENTRY_SRC,
false ) { false) {
setId( CASTLE_ENTRY_ID ); setId(CASTLE_ENTRY_ID);
} }
CastleTowerBlock::CastleTowerBlock( CastleTowerBlock::CastleTowerBlock(int x, int y,
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ) std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, CASTLE_TOWER_SRC, : MarioBlock(x, y, renderer, g_terrain_texture, CASTLE_TOWER_SRC,
false ) { false) {
setId( CASTLE_TOWER_ID ); setId(CASTLE_TOWER_ID);
} }
CastleTowerFilledBlock::CastleTowerFilledBlock( CastleTowerFilledBlock::CastleTowerFilledBlock(
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ) int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, : MarioBlock(x, y, renderer, g_terrain_texture, CASTLE_TOWER_FILLED_SRC,
CASTLE_TOWER_FILLED_SRC, false ) { false) {
setId( CASTLE_TOWER_FILLED_ID ); setId(CASTLE_TOWER_FILLED_ID);
} }
VineTopBlock::VineTopBlock( int x, int y, VineTopBlock::VineTopBlock(int x, int y,
std::shared_ptr< SDLPP::Renderer > &renderer ) std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, VINE_TOP_SRC, false ) { : MarioBlock(x, y, renderer, g_terrain_texture, VINE_TOP_SRC, false) {
ensureCollision(); ensureCollision();
setId( VINE_TOP_ID ); setId(VINE_TOP_ID);
} }
VineBottomBlock::VineBottomBlock( int x, int y, VineBottomBlock::VineBottomBlock(int x, int y,
std::shared_ptr< SDLPP::Renderer > &renderer ) std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, VINE_BOTTOM_SRC, : MarioBlock(x, y, renderer, g_terrain_texture, VINE_BOTTOM_SRC,
false ) { false) {
ensureCollision(); ensureCollision();
setId( VINE_BOTTOM_ID ); setId(VINE_BOTTOM_ID);
} }
PoleTopBlock::PoleTopBlock( int x, int y, PoleTopBlock::PoleTopBlock(int x, int y,
std::shared_ptr< SDLPP::Renderer > &renderer ) std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, POLE_TOP_SRC, false ) { : MarioBlock(x, y, renderer, g_terrain_texture, POLE_TOP_SRC, false) {
ensureCollision(); ensureCollision();
setId( POLE_TOP_ID ); setId(POLE_TOP_ID);
} }
PoleBottomBlock::PoleBottomBlock( int x, int y, PoleBottomBlock::PoleBottomBlock(int x, int y,
std::shared_ptr< SDLPP::Renderer > &renderer ) std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, POLE_BOTTOM_SRC, : MarioBlock(x, y, renderer, g_terrain_texture, POLE_BOTTOM_SRC,
false ) { false) {
ensureCollision(); ensureCollision();
setId( POLE_BOTTOM_ID ); setId(POLE_BOTTOM_ID);
} }
FlagBlock::FlagBlock( int x, int y, FlagBlock::FlagBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer)
std::shared_ptr< SDLPP::Renderer > &renderer ) : MarioBlock(x, y, renderer, g_terrain_texture, FLAG_SRC, false) {
: MarioBlock( x, y, renderer, g_terrain_texture, FLAG_SRC, false ) { setId(FLAG_ID);
setId( FLAG_ID );
} }
StepBlock::StepBlock( int x, int y, StepBlock::StepBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer)
std::shared_ptr< SDLPP::Renderer > &renderer ) : MarioBlock(x, y, renderer, g_terrain_texture, STEP_SRC, true) {
: MarioBlock( x, y, renderer, g_terrain_texture, STEP_SRC, true ) {
ensureCollision(); ensureCollision();
setId( STEP_ID ); setId(STEP_ID);
} }
BrickBlock::BrickBlock( int x, int y, BrickBlock::BrickBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer)
std::shared_ptr< SDLPP::Renderer > &renderer ) : MarioBlock(x, y, renderer, g_terrain_texture, BRICK_SRC, true) {
: MarioBlock( x, y, renderer, g_terrain_texture, BRICK_SRC, true ) {
ensureCollision(); ensureCollision();
setId( BRICK_ID ); setId(BRICK_ID);
} }
BrickTopBlock::BrickTopBlock( int x, int y, BrickTopBlock::BrickTopBlock(int x, int y,
std::shared_ptr< SDLPP::Renderer > &renderer ) std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, BRICK_TOP_SRC, true ) { : MarioBlock(x, y, renderer, g_terrain_texture, BRICK_TOP_SRC, true) {
ensureCollision(); ensureCollision();
setId( BRICK_TOP_ID ); setId(BRICK_TOP_ID);
} }
SidewayPipeEndTopBlock::SidewayPipeEndTopBlock( SidewayPipeEndTopBlock::SidewayPipeEndTopBlock(
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ) int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, : MarioBlock(x, y, renderer, g_terrain_texture,
SIDEWAY_PIPE_END_TOP_SRC, false ) { SIDEWAY_PIPE_END_TOP_SRC, false) {
ensureCollision(); ensureCollision();
setId( SIDEWAY_PIPE_END_TOP_ID ); setId(SIDEWAY_PIPE_END_TOP_ID);
} }
SidewayPipeEndBottomBlock::SidewayPipeEndBottomBlock( SidewayPipeEndBottomBlock::SidewayPipeEndBottomBlock(
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ) int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, : MarioBlock(x, y, renderer, g_terrain_texture,
SIDEWAY_PIPE_END_BOTTOM_SRC, false ) { SIDEWAY_PIPE_END_BOTTOM_SRC, false) {
ensureCollision(); ensureCollision();
setId( SIDEWAY_PIPE_END_BOTTOM_ID ); setId(SIDEWAY_PIPE_END_BOTTOM_ID);
} }
SidewayPipeMiddleTopBlock::SidewayPipeMiddleTopBlock( SidewayPipeMiddleTopBlock::SidewayPipeMiddleTopBlock(
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ) int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, : MarioBlock(x, y, renderer, g_terrain_texture,
SIDEWAY_PIPE_MIDDLE_TOP_SRC, false ) { SIDEWAY_PIPE_MIDDLE_TOP_SRC, false) {
ensureCollision(); ensureCollision();
setId( SIDEWAY_PIPE_MIDDLE_TOP_ID ); setId(SIDEWAY_PIPE_MIDDLE_TOP_ID);
} }
SidewayPipeMiddleBottomBlock::SidewayPipeMiddleBottomBlock( SidewayPipeMiddleBottomBlock::SidewayPipeMiddleBottomBlock(
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ) int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, : MarioBlock(x, y, renderer, g_terrain_texture,
SIDEWAY_PIPE_MIDDLE_BOTTOM_SRC, false ) { SIDEWAY_PIPE_MIDDLE_BOTTOM_SRC, false) {
ensureCollision(); ensureCollision();
setId( SIDEWAY_PIPE_MIDDLE_BOTTOM_ID ); setId(SIDEWAY_PIPE_MIDDLE_BOTTOM_ID);
} }
SidewayPipeConnectorTopBlock::SidewayPipeConnectorTopBlock( SidewayPipeConnectorTopBlock::SidewayPipeConnectorTopBlock(
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ) int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, : MarioBlock(x, y, renderer, g_terrain_texture,
SIDEWAY_PIPE_CONNECTOR_TOP_SRC, false ) { SIDEWAY_PIPE_CONNECTOR_TOP_SRC, false) {
ensureCollision(); ensureCollision();
setId( SIDEWAY_PIPE_CONNECTOR_TOP_ID ); setId(SIDEWAY_PIPE_CONNECTOR_TOP_ID);
} }
SidewayPipeConnectorBottomBlock::SidewayPipeConnectorBottomBlock( SidewayPipeConnectorBottomBlock::SidewayPipeConnectorBottomBlock(
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ) int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, : MarioBlock(x, y, renderer, g_terrain_texture,
SIDEWAY_PIPE_CONNECTOR_BOTTOM_SRC, false ) { SIDEWAY_PIPE_CONNECTOR_BOTTOM_SRC, false) {
ensureCollision(); ensureCollision();
setId( SIDEWAY_PIPE_CONNECTOR_BOTTOM_ID ); setId(SIDEWAY_PIPE_CONNECTOR_BOTTOM_ID);
} }
TreePlatformTopLeftBlock::TreePlatformTopLeftBlock( TreePlatformTopLeftBlock::TreePlatformTopLeftBlock(
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ) int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, : MarioBlock(x, y, renderer, g_terrain_texture,
TREE_PLATFORM_TOP_LEFT_SRC, false ) { TREE_PLATFORM_TOP_LEFT_SRC, false) {
ensureCollision(); ensureCollision();
setId( TREE_PLATFORM_TOP_LEFT_ID ); setId(TREE_PLATFORM_TOP_LEFT_ID);
} }
TreePlatformTopMiddleBlock::TreePlatformTopMiddleBlock( TreePlatformTopMiddleBlock::TreePlatformTopMiddleBlock(
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ) int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, : MarioBlock(x, y, renderer, g_terrain_texture,
TREE_PLATFORM_TOP_MIDDLE_SRC, false ) { TREE_PLATFORM_TOP_MIDDLE_SRC, false) {
ensureCollision(); ensureCollision();
setId( TREE_PLATFORM_TOP_MIDDLE_ID ); setId(TREE_PLATFORM_TOP_MIDDLE_ID);
} }
TreePlatformTopRightBlock::TreePlatformTopRightBlock( TreePlatformTopRightBlock::TreePlatformTopRightBlock(
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ) int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, : MarioBlock(x, y, renderer, g_terrain_texture,
TREE_PLATFORM_TOP_RIGHT_SRC, false ) { TREE_PLATFORM_TOP_RIGHT_SRC, false) {
ensureCollision(); ensureCollision();
setId( TREE_PLATFORM_TOP_RIGHT_ID ); setId(TREE_PLATFORM_TOP_RIGHT_ID);
} }
TreePlatformBarkBlock::TreePlatformBarkBlock( TreePlatformBarkBlock::TreePlatformBarkBlock(
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ) int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, TREE_PLATFORM_BARK_SRC, : MarioBlock(x, y, renderer, g_terrain_texture, TREE_PLATFORM_BARK_SRC,
false ) { false) {
ensureCollision(); ensureCollision();
setId( TREE_PLATFORM_BARK_ID ); setId(TREE_PLATFORM_BARK_ID);
} }
WaterTopBlock::WaterTopBlock( int x, int y, WaterTopBlock::WaterTopBlock(int x, int y,
std::shared_ptr< SDLPP::Renderer > &renderer ) std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, WATER_TOP_SRC, : MarioBlock(x, y, renderer, g_terrain_texture, WATER_TOP_SRC, false) {
false ) {
ensureCollision(); ensureCollision();
setId( WATER_TOP_ID ); setId(WATER_TOP_ID);
} }
WaterFillBlock::WaterFillBlock( int x, int y, WaterFillBlock::WaterFillBlock(int x, int y,
std::shared_ptr< SDLPP::Renderer > &renderer ) std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, WATER_FILL_SRC, : MarioBlock(x, y, renderer, g_terrain_texture, WATER_FILL_SRC, false) {
false ) {
ensureCollision(); ensureCollision();
setId( WATER_FILL_ID ); setId(WATER_FILL_ID);
} }
MushroomPlatformTopLeftBlock::MushroomPlatformTopLeftBlock( MushroomPlatformTopLeftBlock::MushroomPlatformTopLeftBlock(
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ) int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, : MarioBlock(x, y, renderer, g_terrain_texture,
MUSHROOM_PLATFORM_TOP_LEFT_SRC, false ) { MUSHROOM_PLATFORM_TOP_LEFT_SRC, false) {
ensureCollision(); ensureCollision();
setId( MUSHROOM_PLATFORM_TOP_LEFT_ID ); setId(MUSHROOM_PLATFORM_TOP_LEFT_ID);
} }
MushroomPlatformTopMiddleBlock::MushroomPlatformTopMiddleBlock( MushroomPlatformTopMiddleBlock::MushroomPlatformTopMiddleBlock(
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ) int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, : MarioBlock(x, y, renderer, g_terrain_texture,
MUSHROOM_PLATFORM_TOP_MIDDLE_SRC, false ) { MUSHROOM_PLATFORM_TOP_MIDDLE_SRC, false) {
ensureCollision(); ensureCollision();
setId( MUSHROOM_PLATFORM_TOP_MIDDLE_ID ); setId(MUSHROOM_PLATFORM_TOP_MIDDLE_ID);
} }
MushroomPlatformTopRightBlock::MushroomPlatformTopRightBlock( MushroomPlatformTopRightBlock::MushroomPlatformTopRightBlock(
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ) int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, : MarioBlock(x, y, renderer, g_terrain_texture,
MUSHROOM_PLATFORM_TOP_RIGHT_SRC, false ) { MUSHROOM_PLATFORM_TOP_RIGHT_SRC, false) {
ensureCollision(); ensureCollision();
setId( MUSHROOM_PLATFORM_TOP_RIGHT_ID ); setId(MUSHROOM_PLATFORM_TOP_RIGHT_ID);
} }
MushroomPlatformBarkTopBlock::MushroomPlatformBarkTopBlock( MushroomPlatformBarkTopBlock::MushroomPlatformBarkTopBlock(
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ) int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, : MarioBlock(x, y, renderer, g_terrain_texture,
MUSHROOM_PLATFORM_BARK_TOP_SRC, false ) { MUSHROOM_PLATFORM_BARK_TOP_SRC, false) {
ensureCollision(); ensureCollision();
setId( MUSHROOM_PLATFORM_BARK_TOP_ID ); setId(MUSHROOM_PLATFORM_BARK_TOP_ID);
} }
MushroomPlatformBarkBottomBlock::MushroomPlatformBarkBottomBlock( MushroomPlatformBarkBottomBlock::MushroomPlatformBarkBottomBlock(
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ) int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, : MarioBlock(x, y, renderer, g_terrain_texture,
MUSHROOM_PLATFORM_BARK_BOTTOM_SRC, false ) { MUSHROOM_PLATFORM_BARK_BOTTOM_SRC, false) {
ensureCollision(); ensureCollision();
setId( MUSHROOM_PLATFORM_BARK_BOTTOM_ID ); setId(MUSHROOM_PLATFORM_BARK_BOTTOM_ID);
} }
TreeBarkBlock::TreeBarkBlock( int x, int y, TreeBarkBlock::TreeBarkBlock(int x, int y,
std::shared_ptr< SDLPP::Renderer > &renderer ) std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, TREE_BARK_SRC, : MarioBlock(x, y, renderer, g_terrain_texture, TREE_BARK_SRC, false) {
false ) {
ensureCollision(); ensureCollision();
setId( TREE_BARK_ID ); setId(TREE_BARK_ID);
} }
TreeLeavesSmallBlock::TreeLeavesSmallBlock( TreeLeavesSmallBlock::TreeLeavesSmallBlock(
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ) int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, TREE_LEAVES_SMALL_SRC, : MarioBlock(x, y, renderer, g_terrain_texture, TREE_LEAVES_SMALL_SRC,
false ) { false) {
ensureCollision(); ensureCollision();
setId( TREE_LEAVES_SMALL_ID ); setId(TREE_LEAVES_SMALL_ID);
} }
TreeLeavesTopBlock::TreeLeavesTopBlock( TreeLeavesTopBlock::TreeLeavesTopBlock(
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ) int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, TREE_LEAVES_TOP_SRC, : MarioBlock(x, y, renderer, g_terrain_texture, TREE_LEAVES_TOP_SRC,
false ) { false) {
ensureCollision(); ensureCollision();
setId( TREE_LEAVES_TOP_ID ); setId(TREE_LEAVES_TOP_ID);
} }
TreeLeavesBottomBlock::TreeLeavesBottomBlock( TreeLeavesBottomBlock::TreeLeavesBottomBlock(
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ) int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, TREE_LEAVES_BOTTOM_SRC, : MarioBlock(x, y, renderer, g_terrain_texture, TREE_LEAVES_BOTTOM_SRC,
false ) { false) {
ensureCollision(); ensureCollision();
setId( TREE_LEAVES_BOTTOM_ID ); setId(TREE_LEAVES_BOTTOM_ID);
} }
CannonTowerBlock::CannonTowerBlock( CannonTowerBlock::CannonTowerBlock(int x, int y,
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ) std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, CANNON_TOWER_SRC, : MarioBlock(x, y, renderer, g_terrain_texture, CANNON_TOWER_SRC,
false ) { false) {
ensureCollision(); ensureCollision();
setId( CANNON_TOWER_ID ); setId(CANNON_TOWER_ID);
} }
CannonPedestalBlock::CannonPedestalBlock( CannonPedestalBlock::CannonPedestalBlock(
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ) int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, CANNON_PEDESTAL_SRC, : MarioBlock(x, y, renderer, g_terrain_texture, CANNON_PEDESTAL_SRC,
false ) { false) {
ensureCollision(); ensureCollision();
setId( CANNON_PEDESTAL_ID ); setId(CANNON_PEDESTAL_ID);
} }
CannonBlock::CannonBlock( int x, int y, CannonBlock::CannonBlock(int x, int y,
std::shared_ptr< SDLPP::Renderer > &renderer ) std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_terrain_texture, CANNON_SRC, false ) { : MarioBlock(x, y, renderer, g_terrain_texture, CANNON_SRC, false) {
ensureCollision(); ensureCollision();
setId( CANNON_ID ); setId(CANNON_ID);
} }
DestructibleModifierBlock::DestructibleModifierBlock( DestructibleModifierBlock::DestructibleModifierBlock(
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ) int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_mod_texture, MOD_DESTRUCTIBLE_SRC, : MarioBlock(x, y, renderer, g_mod_texture, MOD_DESTRUCTIBLE_SRC,
false ) { false) {
setId( DESTRUCTIBLE_MODIFIER_ID ); setId(DESTRUCTIBLE_MODIFIER_ID);
} }
BackgroundModifierBlock::BackgroundModifierBlock( BackgroundModifierBlock::BackgroundModifierBlock(
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ) int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_mod_texture, MOD_BACKGROUND_SRC, : MarioBlock(x, y, renderer, g_mod_texture, MOD_BACKGROUND_SRC, false) {
false ) { setId(BACKGROUND_MODIFIER_ID);
setId( BACKGROUND_MODIFIER_ID );
} }
MushroomModifierBlock::MushroomModifierBlock( MushroomModifierBlock::MushroomModifierBlock(
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ) int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer)
: MarioBlock( x, y, renderer, g_mod_texture, MOD_MUSHROOM_SRC, false ) { : MarioBlock(x, y, renderer, g_mod_texture, MOD_MUSHROOM_SRC, false) {
setId( MUSHROOM_MODIFIER_ID ); setId(MUSHROOM_MODIFIER_ID);
} }

View File

@ -5,297 +5,339 @@
class FloorBlock : public MarioBlock { class FloorBlock : public MarioBlock {
public: public:
FloorBlock( int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ); FloorBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
}; };
class HillInclineBlock : public MarioBlock { class HillInclineBlock : public MarioBlock {
public: public:
HillInclineBlock( int x, int y, HillInclineBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
std::shared_ptr< SDLPP::Renderer > &renderer );
}; };
class HillDeclineBlock : public MarioBlock { class HillDeclineBlock : public MarioBlock {
public: public:
HillDeclineBlock( int x, int y, HillDeclineBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
std::shared_ptr< SDLPP::Renderer > &renderer );
}; };
class HillDotsRightBlock : public MarioBlock { class HillDotsRightBlock : public MarioBlock {
public: public:
HillDotsRightBlock( int x, int y, HillDotsRightBlock(int x, int y,
std::shared_ptr< SDLPP::Renderer > &renderer ); std::shared_ptr<SDLPP::Renderer> &renderer);
}; };
class HillDotsLeftBlock : public MarioBlock { class HillDotsLeftBlock : public MarioBlock {
public: public:
HillDotsLeftBlock( int x, int y, HillDotsLeftBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
std::shared_ptr< SDLPP::Renderer > &renderer );
}; };
class HillFillBlock : public MarioBlock { class HillFillBlock : public MarioBlock {
public: public:
HillFillBlock( int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ); HillFillBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
}; };
class HillTopBlock : public MarioBlock { class HillTopBlock : public MarioBlock {
public: public:
HillTopBlock( int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ); HillTopBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
}; };
class BushLeftBlock : public MarioBlock { class BushLeftBlock : public MarioBlock {
public: public:
BushLeftBlock( int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ); BushLeftBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
}; };
class BushMiddleBlock : public MarioBlock { class BushMiddleBlock : public MarioBlock {
public: public:
BushMiddleBlock( int x, int y, BushMiddleBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
std::shared_ptr< SDLPP::Renderer > &renderer );
}; };
class BushRightBlock : public MarioBlock { class BushRightBlock : public MarioBlock {
public: public:
BushRightBlock( int x, int y, BushRightBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
std::shared_ptr< SDLPP::Renderer > &renderer );
}; };
class CloudLeftBottomBlock : public MarioBlock { class CloudLeftBottomBlock : public MarioBlock {
public: public:
CloudLeftBottomBlock( int x, int y, CloudLeftBottomBlock(int x, int y,
std::shared_ptr< SDLPP::Renderer > &renderer ); std::shared_ptr<SDLPP::Renderer> &renderer);
}; };
class CloudMiddleBottomBlock : public MarioBlock { class CloudMiddleBottomBlock : public MarioBlock {
public: public:
CloudMiddleBottomBlock( int x, int y, CloudMiddleBottomBlock(int x, int y,
std::shared_ptr< SDLPP::Renderer > &renderer ); std::shared_ptr<SDLPP::Renderer> &renderer);
}; };
class CloudRightBottomBlock : public MarioBlock { class CloudRightBottomBlock : public MarioBlock {
public: public:
CloudRightBottomBlock( int x, int y, CloudRightBottomBlock(int x, int y,
std::shared_ptr< SDLPP::Renderer > &renderer ); std::shared_ptr<SDLPP::Renderer> &renderer);
}; };
class CloudLeftTopBlock : public MarioBlock { class CloudLeftTopBlock : public MarioBlock {
public: public:
CloudLeftTopBlock( int x, int y, CloudLeftTopBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
std::shared_ptr< SDLPP::Renderer > &renderer );
}; };
class CloudMiddleTopBlock : public MarioBlock { class CloudMiddleTopBlock : public MarioBlock {
public: public:
CloudMiddleTopBlock( int x, int y, CloudMiddleTopBlock(int x, int y,
std::shared_ptr< SDLPP::Renderer > &renderer ); std::shared_ptr<SDLPP::Renderer> &renderer);
}; };
class CloudRightTopBlock : public MarioBlock { class CloudRightTopBlock : public MarioBlock {
public: public:
CloudRightTopBlock( int x, int y, CloudRightTopBlock(int x, int y,
std::shared_ptr< SDLPP::Renderer > &renderer ); std::shared_ptr<SDLPP::Renderer> &renderer);
}; };
class PipeLeftBottomBlock : public MarioBlock { class PipeLeftBottomBlock : public MarioBlock {
public: public:
PipeLeftBottomBlock( int x, int y, PipeLeftBottomBlock(int x, int y,
std::shared_ptr< SDLPP::Renderer > &renderer ); std::shared_ptr<SDLPP::Renderer> &renderer);
}; };
class PipeRightBottomBlock : public MarioBlock { class PipeRightBottomBlock : public MarioBlock {
public: public:
PipeRightBottomBlock( int x, int y, PipeRightBottomBlock(int x, int y,
std::shared_ptr< SDLPP::Renderer > &renderer ); std::shared_ptr<SDLPP::Renderer> &renderer);
}; };
class PipeLeftTopBlock : public MarioBlock { class PipeLeftTopBlock : public MarioBlock {
public: public:
PipeLeftTopBlock( int x, int y, PipeLeftTopBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
std::shared_ptr< SDLPP::Renderer > &renderer );
}; };
class PipeRightTopBlock : public MarioBlock { class PipeRightTopBlock : public MarioBlock {
public: public:
PipeRightTopBlock( int x, int y, PipeRightTopBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
std::shared_ptr< SDLPP::Renderer > &renderer );
}; };
class CastleLeftBlock : public MarioBlock { class CastleLeftBlock : public MarioBlock {
public: public:
CastleLeftBlock( int x, int y, CastleLeftBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
std::shared_ptr< SDLPP::Renderer > &renderer );
}; };
class CastleRightBlock : public MarioBlock { class CastleRightBlock : public MarioBlock {
public: public:
CastleRightBlock( int x, int y, CastleRightBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
std::shared_ptr< SDLPP::Renderer > &renderer );
}; };
class CastleBlackBlock : public MarioBlock { class CastleBlackBlock : public MarioBlock {
public: public:
CastleBlackBlock( int x, int y, CastleBlackBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
std::shared_ptr< SDLPP::Renderer > &renderer );
}; };
class CastleEntryBlock : public MarioBlock { class CastleEntryBlock : public MarioBlock {
public: public:
CastleEntryBlock( int x, int y, CastleEntryBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
std::shared_ptr< SDLPP::Renderer > &renderer );
}; };
class CastleTowerBlock : public MarioBlock { class CastleTowerBlock : public MarioBlock {
public: public:
CastleTowerBlock( int x, int y, CastleTowerBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
std::shared_ptr< SDLPP::Renderer > &renderer );
}; };
class CastleTowerFilledBlock : public MarioBlock { class CastleTowerFilledBlock : public MarioBlock {
public: public:
CastleTowerFilledBlock( int x, int y, CastleTowerFilledBlock(int x, int y,
std::shared_ptr< SDLPP::Renderer > &renderer ); std::shared_ptr<SDLPP::Renderer> &renderer);
}; };
class VineTopBlock : public MarioBlock { class VineTopBlock : public MarioBlock {
public: public:
VineTopBlock( int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ); VineTopBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
}; };
class VineBottomBlock : public MarioBlock { class VineBottomBlock : public MarioBlock {
public: public:
VineBottomBlock( int x, int y, VineBottomBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
std::shared_ptr< SDLPP::Renderer > &renderer );
}; };
class PoleTopBlock : public MarioBlock { class PoleTopBlock : public MarioBlock {
public: public:
PoleTopBlock( int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ); PoleTopBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
}; };
class PoleBottomBlock : public MarioBlock { class PoleBottomBlock : public MarioBlock {
public: public:
PoleBottomBlock( int x, int y, PoleBottomBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
std::shared_ptr< SDLPP::Renderer > &renderer );
}; };
class FlagBlock : public MarioBlock { class FlagBlock : public MarioBlock {
public: public:
FlagBlock( int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ); FlagBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
}; };
class StepBlock : public MarioBlock { class StepBlock : public MarioBlock {
public: public:
StepBlock( int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ); StepBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
}; };
class BrickBlock : public MarioBlock { class BrickBlock : public MarioBlock {
public: public:
BrickBlock( int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ); BrickBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
}; };
class BrickTopBlock : public MarioBlock { class BrickTopBlock : public MarioBlock {
public: public:
BrickTopBlock( int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ); BrickTopBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
}; };
class SidewayPipeEndTopBlock : public MarioBlock { class SidewayPipeEndTopBlock : public MarioBlock {
public: public:
SidewayPipeEndTopBlock( int x, int y, SidewayPipeEndTopBlock(int x, int y,
std::shared_ptr< SDLPP::Renderer > &renderer ); std::shared_ptr<SDLPP::Renderer> &renderer);
}; };
class SidewayPipeEndBottomBlock : public MarioBlock { class SidewayPipeEndBottomBlock : public MarioBlock {
public: public:
SidewayPipeEndBottomBlock( int x, int y, SidewayPipeEndBottomBlock(int x, int y,
std::shared_ptr< SDLPP::Renderer > &renderer ); std::shared_ptr<SDLPP::Renderer> &renderer);
}; };
class SidewayPipeMiddleTopBlock : public MarioBlock { class SidewayPipeMiddleTopBlock : public MarioBlock {
public: public:
SidewayPipeMiddleTopBlock( int x, int y, SidewayPipeMiddleTopBlock(int x, int y,
std::shared_ptr< SDLPP::Renderer > &renderer ); std::shared_ptr<SDLPP::Renderer> &renderer);
}; };
class SidewayPipeMiddleBottomBlock : public MarioBlock { class SidewayPipeMiddleBottomBlock : public MarioBlock {
public: public:
SidewayPipeMiddleBottomBlock( SidewayPipeMiddleBottomBlock(int x, int y,
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ); std::shared_ptr<SDLPP::Renderer> &renderer);
}; };
class SidewayPipeConnectorTopBlock : public MarioBlock { class SidewayPipeConnectorTopBlock : public MarioBlock {
public: public:
SidewayPipeConnectorTopBlock( SidewayPipeConnectorTopBlock(int x, int y,
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ); std::shared_ptr<SDLPP::Renderer> &renderer);
}; };
class SidewayPipeConnectorBottomBlock : public MarioBlock { class SidewayPipeConnectorBottomBlock : public MarioBlock {
public: public:
SidewayPipeConnectorBottomBlock( SidewayPipeConnectorBottomBlock(int x, int y,
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ); std::shared_ptr<SDLPP::Renderer> &renderer);
}; };
class TreePlatformTopLeftBlock : public MarioBlock { class TreePlatformTopLeftBlock : public MarioBlock {
public: public:
TreePlatformTopLeftBlock( int x, int y, TreePlatformTopLeftBlock(int x, int y,
std::shared_ptr< SDLPP::Renderer > &renderer ); std::shared_ptr<SDLPP::Renderer> &renderer);
}; };
class TreePlatformTopMiddleBlock : public MarioBlock { class TreePlatformTopMiddleBlock : public MarioBlock {
public: public:
TreePlatformTopMiddleBlock( int x, int y, TreePlatformTopMiddleBlock(int x, int y,
std::shared_ptr< SDLPP::Renderer > &renderer ); std::shared_ptr<SDLPP::Renderer> &renderer);
}; };
class TreePlatformTopRightBlock : public MarioBlock { class TreePlatformTopRightBlock : public MarioBlock {
public: public:
TreePlatformTopRightBlock( int x, int y, TreePlatformTopRightBlock(int x, int y,
std::shared_ptr< SDLPP::Renderer > &renderer ); std::shared_ptr<SDLPP::Renderer> &renderer);
}; };
class TreePlatformBarkBlock : public MarioBlock { class TreePlatformBarkBlock : public MarioBlock {
public: public:
TreePlatformBarkBlock( int x, int y, TreePlatformBarkBlock(int x, int y,
std::shared_ptr< SDLPP::Renderer > &renderer ); std::shared_ptr<SDLPP::Renderer> &renderer);
}; };
class WaterTopBlock : public MarioBlock { class WaterTopBlock : public MarioBlock {
public: public:
WaterTopBlock( int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ); WaterTopBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
}; };
class WaterFillBlock : public MarioBlock { class WaterFillBlock : public MarioBlock {
public: public:
WaterFillBlock( int x, int y, WaterFillBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
std::shared_ptr< SDLPP::Renderer > &renderer );
}; };
class MushroomPlatformTopLeftBlock : public MarioBlock { class MushroomPlatformTopLeftBlock : public MarioBlock {
public: public:
MushroomPlatformTopLeftBlock( MushroomPlatformTopLeftBlock(int x, int y,
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ); std::shared_ptr<SDLPP::Renderer> &renderer);
}; };
class MushroomPlatformTopMiddleBlock : public MarioBlock { class MushroomPlatformTopMiddleBlock : public MarioBlock {
public: public:
MushroomPlatformTopMiddleBlock( MushroomPlatformTopMiddleBlock(int x, int y,
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ); std::shared_ptr<SDLPP::Renderer> &renderer);
}; };
class MushroomPlatformTopRightBlock : public MarioBlock { class MushroomPlatformTopRightBlock : public MarioBlock {
public: public:
MushroomPlatformTopRightBlock( MushroomPlatformTopRightBlock(int x, int y,
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ); std::shared_ptr<SDLPP::Renderer> &renderer);
}; };
class MushroomPlatformBarkTopBlock : public MarioBlock { class MushroomPlatformBarkTopBlock : public MarioBlock {
public: public:
MushroomPlatformBarkTopBlock( MushroomPlatformBarkTopBlock(int x, int y,
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ); std::shared_ptr<SDLPP::Renderer> &renderer);
}; };
class MushroomPlatformBarkBottomBlock : public MarioBlock { class MushroomPlatformBarkBottomBlock : public MarioBlock {
public: public:
MushroomPlatformBarkBottomBlock( MushroomPlatformBarkBottomBlock(int x, int y,
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ); std::shared_ptr<SDLPP::Renderer> &renderer);
}; };
class TreeBarkBlock : public MarioBlock { class TreeBarkBlock : public MarioBlock {
public: public:
TreeBarkBlock( int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ); TreeBarkBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
}; };
class TreeLeavesSmallBlock : public MarioBlock { class TreeLeavesSmallBlock : public MarioBlock {
public: public:
TreeLeavesSmallBlock( int x, int y, TreeLeavesSmallBlock(int x, int y,
std::shared_ptr< SDLPP::Renderer > &renderer ); std::shared_ptr<SDLPP::Renderer> &renderer);
}; };
class TreeLeavesTopBlock : public MarioBlock { class TreeLeavesTopBlock : public MarioBlock {
public: public:
TreeLeavesTopBlock( int x, int y, TreeLeavesTopBlock(int x, int y,
std::shared_ptr< SDLPP::Renderer > &renderer ); std::shared_ptr<SDLPP::Renderer> &renderer);
}; };
class TreeLeavesBottomBlock : public MarioBlock { class TreeLeavesBottomBlock : public MarioBlock {
public: public:
TreeLeavesBottomBlock( int x, int y, TreeLeavesBottomBlock(int x, int y,
std::shared_ptr< SDLPP::Renderer > &renderer ); std::shared_ptr<SDLPP::Renderer> &renderer);
}; };
class CannonTowerBlock : public MarioBlock { class CannonTowerBlock : public MarioBlock {
public: public:
CannonTowerBlock( int x, int y, CannonTowerBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
std::shared_ptr< SDLPP::Renderer > &renderer );
}; };
class CannonPedestalBlock : public MarioBlock { class CannonPedestalBlock : public MarioBlock {
public: public:
CannonPedestalBlock( int x, int y, CannonPedestalBlock(int x, int y,
std::shared_ptr< SDLPP::Renderer > &renderer ); std::shared_ptr<SDLPP::Renderer> &renderer);
}; };
class CannonBlock : public MarioBlock { class CannonBlock : public MarioBlock {
public: public:
CannonBlock( int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer ); CannonBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> &renderer);
}; };
//------------------ MODS------------------------------------------------------ //------------------ MODS------------------------------------------------------
class DestructibleModifierBlock : public MarioBlock { class DestructibleModifierBlock : public MarioBlock {
public: public:
DestructibleModifierBlock( int x, int y, DestructibleModifierBlock(int x, int y,
std::shared_ptr< SDLPP::Renderer > &renderer ); std::shared_ptr<SDLPP::Renderer> &renderer);
}; };
class BackgroundModifierBlock : public MarioBlock { class BackgroundModifierBlock : public MarioBlock {
public: public:
BackgroundModifierBlock( int x, int y, BackgroundModifierBlock(int x, int y,
std::shared_ptr< SDLPP::Renderer > &renderer ); std::shared_ptr<SDLPP::Renderer> &renderer);
}; };
class MushroomModifierBlock : public MarioBlock { class MushroomModifierBlock : public MarioBlock {
public: public:
MushroomModifierBlock( int x, int y, MushroomModifierBlock(int x, int y,
std::shared_ptr< SDLPP::Renderer > &renderer ); std::shared_ptr<SDLPP::Renderer> &renderer);
}; };
#endif #endif

View File

@ -2,13 +2,13 @@
#include "../../sdlpp/sdlpp_renderobject.hpp" #include "../../sdlpp/sdlpp_renderobject.hpp"
#include "../objectids.hpp" #include "../objectids.hpp"
void BounceVisitor::visit( const SDLPP::RenderObject &obj ) { void BounceVisitor::visit(const SDLPP::RenderObject &obj) {
auto id = obj.getId(); auto id = obj.getId();
switch ( id ) { switch (id) {
case FLOOR_ID: case FLOOR_ID:
case BRICK_ID: case BRICK_ID:
case BRICK_TOP_ID: case BRICK_TOP_ID:
if(from == BOUNCE_COLLISION) { if (from == BOUNCE_COLLISION) {
hits += 1; hits += 1;
} }
default: default:

View File

@ -7,14 +7,14 @@
class BounceVisitor : public SDLPP::Visitor { class BounceVisitor : public SDLPP::Visitor {
public: public:
BounceVisitor() = default; BounceVisitor() = default;
void visit( const SDLPP::RenderObject &obj ) override; void visit(const SDLPP::RenderObject &obj) override;
void setFromId( uint64_t id ) override { void setFromId(uint64_t id) override {
from = id; from = id;
} }
uint64_t getFromId() const override { uint64_t getFromId() const override {
return from; return from;
} }
void setVisitorType( uint64_t type ) override { void setVisitorType(uint64_t type) override {
_type = type; _type = type;
} }
uint64_t getVisitorType() const override { uint64_t getVisitorType() const override {

View File

@ -3,9 +3,9 @@
#include "../objectids.hpp" #include "../objectids.hpp"
#include "../sprites.hpp" #include "../sprites.hpp"
void GoombaVisitor::visit( const SDLPP::RenderObject &obj ) { void GoombaVisitor::visit(const SDLPP::RenderObject &obj) {
auto id = obj.getId(); auto id = obj.getId();
switch ( id ) { switch (id) {
case FLOOR_ID: case FLOOR_ID:
case BRICK_ID: case BRICK_ID:
case BRICK_TOP_ID: case BRICK_TOP_ID:
@ -28,17 +28,17 @@ void GoombaVisitor::visit( const SDLPP::RenderObject &obj ) {
case CANNON_TOWER_ID: case CANNON_TOWER_ID:
case CANNON_PEDESTAL_ID: case CANNON_PEDESTAL_ID:
case CANNON_ID: case CANNON_ID:
if ( from == NPC_FLOOR_DETECT ) { if (from == NPC_FLOOR_DETECT) {
onGround = true; onGround = true;
groundY = obj.getPos().getY(); groundY = obj.getPos().getY();
} else if ( from == NPC_LEFT_SIDE_DETECT ) { } else if (from == NPC_LEFT_SIDE_DETECT) {
if(!left && !right) { if (!left && !right) {
movement_blockage = obj.getPos(); movement_blockage = obj.getPos();
validXPos = movement_blockage.getX() + BLOCK_SIZE; validXPos = movement_blockage.getX() + BLOCK_SIZE;
} }
left = true; left = true;
} else if (from == NPC_RIGHT_SIDE_DETECT ) { } else if (from == NPC_RIGHT_SIDE_DETECT) {
if(!left && !right) { if (!left && !right) {
movement_blockage = obj.getPos(); movement_blockage = obj.getPos();
validXPos = movement_blockage.getX() - BLOCK_SIZE; validXPos = movement_blockage.getX() - BLOCK_SIZE;
} }

View File

@ -9,17 +9,17 @@
class GoombaVisitor : public SDLPP::Visitor { class GoombaVisitor : public SDLPP::Visitor {
public: public:
GoombaVisitor() = default; GoombaVisitor() = default;
void visit( const SDLPP::RenderObject &obj ) override; void visit(const SDLPP::RenderObject &obj) override;
bool isOnGround() const { bool isOnGround() const {
return onGround; return onGround;
} }
bool isDead() const { bool isDead() const {
return death; return death;
} }
void setFromId( uint64_t id ) override { void setFromId(uint64_t id) override {
from = id; from = id;
} }
void setVisitorType( uint64_t type ) override { void setVisitorType(uint64_t type) override {
_type = type; _type = type;
} }
uint64_t getVisitorType() const override { uint64_t getVisitorType() const override {

View File

@ -3,9 +3,9 @@
#include "../objectids.hpp" #include "../objectids.hpp"
#include "../sprites.hpp" #include "../sprites.hpp"
void MarioVisitor::visit( const SDLPP::RenderObject &obj ) { void MarioVisitor::visit(const SDLPP::RenderObject &obj) {
auto id = obj.getId(); auto id = obj.getId();
switch ( id ) { switch (id) {
case FLOOR_ID: case FLOOR_ID:
case BRICK_ID: case BRICK_ID:
case BRICK_TOP_ID: case BRICK_TOP_ID:
@ -28,22 +28,23 @@ void MarioVisitor::visit( const SDLPP::RenderObject &obj ) {
case CANNON_TOWER_ID: case CANNON_TOWER_ID:
case CANNON_PEDESTAL_ID: case CANNON_PEDESTAL_ID:
case CANNON_ID: case CANNON_ID:
if ( from == MARIO_FLOOR_DETECT ) { if (from == MARIO_FLOOR_DETECT) {
onGround = true; onGround = true;
groundY = obj.getPos().getY(); groundY = obj.getPos().getY();
} else if ( from == MARIO_LEFT_SIDE_DETECT ) { } else if (from == MARIO_LEFT_SIDE_DETECT) {
if(!left && !right) { if (!left && !right) {
movement_blockage = obj.getPos(); movement_blockage = obj.getPos();
} }
left = true; left = true;
} else if (from == MARIO_RIGHT_SIDE_DETECT ) { } else if (from == MARIO_RIGHT_SIDE_DETECT) {
if(!left && !right) { if (!left && !right) {
movement_blockage = obj.getPos(); movement_blockage = obj.getPos();
} }
right = true; right = true;
} else if (from == MARIO_TOP_DETECT) { } else if (from == MARIO_TOP_DETECT) {
top_hit = true; top_hit = true;
} else if (from == MARIO_TOP_LEFT_DETECT || from == MARIO_TOP_RIGHT_DETECT) { } else if (from == MARIO_TOP_LEFT_DETECT ||
from == MARIO_TOP_RIGHT_DETECT) {
rightleftpos = obj.getPos(); rightleftpos = obj.getPos();
top_left_right = true; top_left_right = true;
} }
@ -54,7 +55,7 @@ void MarioVisitor::visit( const SDLPP::RenderObject &obj ) {
_quit = true; _quit = true;
break; break;
case GOOMBA_ID: case GOOMBA_ID:
if(from != MARIO_FLOOR_DETECT && from != MARIO_ENEMY_DETECT) { if (from != MARIO_FLOOR_DETECT && from != MARIO_ENEMY_DETECT) {
death = true; death = true;
_quit = true; _quit = true;
} else { } else {

View File

@ -8,8 +8,12 @@
class MarioVisitor : public SDLPP::Visitor { class MarioVisitor : public SDLPP::Visitor {
public: public:
MarioVisitor(bool is_jumping, SDLPP::Scene &scene, bool &quit, int &coin_count, std::vector< std::shared_ptr< MarioBlock > > &moving_objects) : jumping(is_jumping), _scene(scene), _quit(quit), _coin_count(coin_count), _moving_objects(moving_objects) {} MarioVisitor(bool is_jumping, SDLPP::Scene &scene, bool &quit,
void visit( const SDLPP::RenderObject &obj ) override; int &coin_count,
std::vector<std::shared_ptr<MarioBlock>> &moving_objects)
: jumping(is_jumping), _scene(scene), _quit(quit),
_coin_count(coin_count), _moving_objects(moving_objects) {}
void visit(const SDLPP::RenderObject &obj) override;
bool isOnGround() const { bool isOnGround() const {
return onGround; return onGround;
} }
@ -22,13 +26,13 @@ public:
double newXPos() const { double newXPos() const {
return newX; return newX;
} }
void setFromId( uint64_t id ) override { void setFromId(uint64_t id) override {
from = id; from = id;
} }
uint64_t getFromId() const override { uint64_t getFromId() const override {
return from; return from;
} }
void setVisitorType( uint64_t type ) override { void setVisitorType(uint64_t type) override {
_type = type; _type = type;
} }
uint64_t getVisitorType() const override { uint64_t getVisitorType() const override {
@ -125,7 +129,7 @@ private:
bool &_quit; bool &_quit;
int &_coin_count; int &_coin_count;
bool mushroom = false; bool mushroom = false;
std::vector< std::shared_ptr< MarioBlock > > &_moving_objects; std::vector<std::shared_ptr<MarioBlock>> &_moving_objects;
bool _bounce = false; bool _bounce = false;
}; };

View File

@ -3,9 +3,9 @@
#include "../objectids.hpp" #include "../objectids.hpp"
#include "../sprites.hpp" #include "../sprites.hpp"
void MushroomVisitor::visit( const SDLPP::RenderObject &obj ) { void MushroomVisitor::visit(const SDLPP::RenderObject &obj) {
auto id = obj.getId(); auto id = obj.getId();
switch ( id ) { switch (id) {
case FLOOR_ID: case FLOOR_ID:
case BRICK_ID: case BRICK_ID:
case BRICK_TOP_ID: case BRICK_TOP_ID:
@ -28,17 +28,17 @@ void MushroomVisitor::visit( const SDLPP::RenderObject &obj ) {
case CANNON_TOWER_ID: case CANNON_TOWER_ID:
case CANNON_PEDESTAL_ID: case CANNON_PEDESTAL_ID:
case CANNON_ID: case CANNON_ID:
if ( from == NPC_FLOOR_DETECT ) { if (from == NPC_FLOOR_DETECT) {
onGround = true; onGround = true;
groundY = obj.getPos().getY(); groundY = obj.getPos().getY();
} else if ( from == NPC_LEFT_SIDE_DETECT ) { } else if (from == NPC_LEFT_SIDE_DETECT) {
if(!left && !right) { if (!left && !right) {
movement_blockage = obj.getPos(); movement_blockage = obj.getPos();
validXPos = movement_blockage.getX() + BLOCK_SIZE; validXPos = movement_blockage.getX() + BLOCK_SIZE;
} }
left = true; left = true;
} else if (from == NPC_RIGHT_SIDE_DETECT ) { } else if (from == NPC_RIGHT_SIDE_DETECT) {
if(!left && !right) { if (!left && !right) {
movement_blockage = obj.getPos(); movement_blockage = obj.getPos();
validXPos = movement_blockage.getX() - BLOCK_SIZE; validXPos = movement_blockage.getX() - BLOCK_SIZE;
} }

View File

@ -9,17 +9,17 @@
class MushroomVisitor : public SDLPP::Visitor { class MushroomVisitor : public SDLPP::Visitor {
public: public:
MushroomVisitor() = default; MushroomVisitor() = default;
void visit( const SDLPP::RenderObject &obj ) override; void visit(const SDLPP::RenderObject &obj) override;
bool isOnGround() const { bool isOnGround() const {
return onGround; return onGround;
} }
void setFromId( uint64_t id ) override { void setFromId(uint64_t id) override {
from = id; from = id;
} }
uint64_t getFromId() const override { uint64_t getFromId() const override {
return from; return from;
} }
void setVisitorType( uint64_t type ) override { void setVisitorType(uint64_t type) override {
_type = type; _type = type;
} }
uint64_t getVisitorType() const override { uint64_t getVisitorType() const override {

View File

@ -4,23 +4,28 @@
#include "mushroom_visitor.hpp" #include "mushroom_visitor.hpp"
#include "goomba_visitor.hpp" #include "goomba_visitor.hpp"
std::shared_ptr< SDLPP::Visitor > std::shared_ptr<SDLPP::Visitor>
getVisitor( const MarioBlock &block, SDLPP::Scene &scene, bool &quit, getVisitor(const MarioBlock &block, SDLPP::Scene &scene, bool &quit,
int &coin_count, int &coin_count,
std::vector< std::shared_ptr< MarioBlock > > &moving_objects ) { std::vector<std::shared_ptr<MarioBlock>> &moving_objects) {
std::shared_ptr< SDLPP::Visitor > result{}; std::shared_ptr<SDLPP::Visitor> result{};
switch(block.getId()) { switch (block.getId()) {
case MARIO_ID: case MARIO_ID:
result = std::static_pointer_cast<SDLPP::Visitor>(std::make_shared<MarioVisitor>(block.getMovement().getY() < 0, scene, quit, coin_count, moving_objects)); result = std::static_pointer_cast<SDLPP::Visitor>(
break; std::make_shared<MarioVisitor>(block.getMovement().getY() < 0,
case MUSHROOM_ID: scene, quit, coin_count,
result = std::static_pointer_cast<SDLPP::Visitor>(std::make_shared<MushroomVisitor>()); moving_objects));
break; break;
case GOOMBA_ID: case MUSHROOM_ID:
result = std::static_pointer_cast<SDLPP::Visitor>(std::make_shared<GoombaVisitor>()); result = std::static_pointer_cast<SDLPP::Visitor>(
break; std::make_shared<MushroomVisitor>());
default: break;
break; case GOOMBA_ID:
result = std::static_pointer_cast<SDLPP::Visitor>(
std::make_shared<GoombaVisitor>());
break;
default:
break;
} }
return result; return result;
} }

View File

@ -3,9 +3,9 @@
#include "../blocks.hpp" #include "../blocks.hpp"
std::shared_ptr< SDLPP::Visitor > std::shared_ptr<SDLPP::Visitor>
getVisitor( const MarioBlock &block, SDLPP::Scene &scene, bool &quit, getVisitor(const MarioBlock &block, SDLPP::Scene &scene, bool &quit,
int &coin_count, int &coin_count,
std::vector< std::shared_ptr< MarioBlock > > &moving_objects ); std::vector<std::shared_ptr<MarioBlock>> &moving_objects);
#endif #endif