Mario: formatting
Some checks reported errors
continuous-integration/drone/push Build is passing
continuous-integration/drone Build was killed

This commit is contained in:
zv0n 2021-10-18 10:10:43 +02:00
parent 303490a619
commit 0d855ed218
20 changed files with 541 additions and 490 deletions

View File

@ -2,14 +2,15 @@
#include "../sprites.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);
bounce_speed = 0.75;
bounce_ticks = 150;
}
void CoinBlock::custom_move(int ticks) {
if(_parent != nullptr && !_parent->isBouncing() && !isBouncing()) {
if (_parent != nullptr && !_parent->isBouncing() && !isBouncing()) {
setHidden(false);
bounce();
_parent = nullptr;

View File

@ -5,9 +5,10 @@
class CoinBlock : public MarioBlock {
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 setParent(MarioBlock *parent);
private:
MarioBlock *_parent = nullptr;
};

View File

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

View File

@ -8,22 +8,21 @@
class CoinEditorBlock : public MarioBlock {
public:
CoinEditorBlock( int x, int y,
std::shared_ptr< SDLPP::Renderer > renderer );
CoinEditorBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> renderer);
void render() override;
void updateSizeAndPosition() override;
void addOne();
void subtractOne();
void setAmount( int amount );
void setAmount(int amount);
void onScrollUp() override;
void onScrollDown() override;
uint8_t getData() const override;
void setData( uint8_t data ) override;
void setData(uint8_t data) override;
private:
void updateText();
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 uint8_t max_amount = 15;
};

View File

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

View File

@ -5,10 +5,11 @@
class GoombaBlock : public MarioBlock {
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 move(int ticks) override;
void handleVisitor(SDLPP::Visitor &visitor) override;
private:
void startDeath();
int death_countdown = 100;

View File

@ -4,29 +4,31 @@
#include "../objectids.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);
ensureCollision();
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.setOutlineColor("#FF0000");
bottom_detect.setMinHeight(1);
addCollision(bottom_detect);
addCollision(SDLPP::RectColider(0, 0.25, 0.1, 0.6, NPC_LEFT_SIDE_DETECT));
addCollision(
SDLPP::RectColider( 0, 0.25, 0.1, 0.6, NPC_LEFT_SIDE_DETECT ) );
addCollision(
SDLPP::RectColider( 0.9, 0.25, 0.1, 0.6, NPC_RIGHT_SIDE_DETECT ) );
SDLPP::RectColider(0.9, 0.25, 0.1, 0.6, NPC_RIGHT_SIDE_DETECT));
}
void MushroomBlock::custom_move(int ticks) {
if(_parent != nullptr && !_parent->isBouncing() && !isTraveling()) {
if (_parent != nullptr && !_parent->isBouncing() && !isTraveling()) {
setHidden(false);
travelToPos(_parent->getPos() - SDLPP::Vec2D<double>(0, BLOCK_SIZE));
_parent = nullptr;
} else if(_parent == nullptr && !isTraveling() && !_started_movement) {
} else if (_parent == nullptr && !isTraveling() && !_started_movement) {
_started_movement = true;
setMovement(movementSpeed/2, 0);
setMovement(movementSpeed / 2, 0);
}
gravity(ticks);
MarioBlock::custom_move(ticks);
@ -37,19 +39,19 @@ void MushroomBlock::setParent(MarioBlock *parent) {
}
void MushroomBlock::handleVisitor(SDLPP::Visitor &visitor) {
if(!_started_movement) {
if (!_started_movement) {
return;
}
auto &m_visitor = dynamic_cast<MushroomVisitor&>(visitor);
auto &m_visitor = dynamic_cast<MushroomVisitor &>(visitor);
setOnGround(m_visitor.isOnGround());
if(isOnGround()) {
if (isOnGround()) {
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());
setMovement(-getMovement().getX(), getMovement().getY());
}
if(m_visitor.getDeath()) {
if (m_visitor.getDeath()) {
destroy();
}
}

View File

@ -5,10 +5,11 @@
class MushroomBlock : public MarioBlock {
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 setParent(MarioBlock *parent);
void handleVisitor(SDLPP::Visitor &visitor) override;
private:
MarioBlock *_parent = nullptr;
bool _started_movement = false;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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