Mario: prepartations for multiple moving objects
This commit is contained in:
parent
37f7bab63e
commit
bfe658618e
@ -22,7 +22,7 @@ COMMON_OBJECTS = global_vars.${OBJEXT} sprites.${OBJEXT} maploader.${OBJEXT} map
|
|||||||
ifneq ($(UNAME_S),Windows)
|
ifneq ($(UNAME_S),Windows)
|
||||||
COMMON_OBJECTS += libsdlpp.a
|
COMMON_OBJECTS += libsdlpp.a
|
||||||
endif
|
endif
|
||||||
MARIO_OBJECTS = main.${OBJEXT} blocks.${OBJEXT} mario_visitor.${OBJEXT} ${COMMON_OBJECTS}
|
MARIO_OBJECTS = main.${OBJEXT} blocks.${OBJEXT} mario_visitor.${OBJEXT} bounce_visitor.${OBJEXT} visitor_generator.${OBJEXT} ${COMMON_OBJECTS}
|
||||||
EDITOR_OBJECTS = editor.${OBJEXT} editor_blocks.${OBJEXT} edit_box.${OBJEXT} tool_box.${OBJEXT} editor_visitor.${OBJEXT} ${COMMON_OBJECTS}
|
EDITOR_OBJECTS = editor.${OBJEXT} editor_blocks.${OBJEXT} edit_box.${OBJEXT} tool_box.${OBJEXT} editor_visitor.${OBJEXT} ${COMMON_OBJECTS}
|
||||||
|
|
||||||
ifeq ($(UNAME_S),Windows)
|
ifeq ($(UNAME_S),Windows)
|
||||||
@ -59,7 +59,11 @@ sprites.${OBJEXT}: sprites.cpp ../sdlpp/sdlpp.hpp sprites.hpp
|
|||||||
$(CXX) $(CXXFLAGS) -c ${OUTPUTFLAG}$@ $<
|
$(CXX) $(CXXFLAGS) -c ${OUTPUTFLAG}$@ $<
|
||||||
maploader.${OBJEXT}: maploader.cpp ../sdlpp/sdlpp.hpp maploader.hpp sprites.hpp blocks.hpp
|
maploader.${OBJEXT}: maploader.cpp ../sdlpp/sdlpp.hpp maploader.hpp sprites.hpp blocks.hpp
|
||||||
$(CXX) $(CXXFLAGS) -c ${OUTPUTFLAG}$@ $<
|
$(CXX) $(CXXFLAGS) -c ${OUTPUTFLAG}$@ $<
|
||||||
mario_visitor.${OBJEXT}: mario_visitor.cpp ../sdlpp/sdlpp.hpp mario_visitor.hpp objectids.hpp
|
mario_visitor.${OBJEXT}: visitors/mario_visitor.cpp ../sdlpp/sdlpp.hpp visitors/mario_visitor.hpp objectids.hpp
|
||||||
|
$(CXX) $(CXXFLAGS) -c ${OUTPUTFLAG}$@ $<
|
||||||
|
bounce_visitor.${OBJEXT}: visitors/bounce_visitor.cpp ../sdlpp/sdlpp.hpp visitors/bounce_visitor.hpp objectids.hpp
|
||||||
|
$(CXX) $(CXXFLAGS) -c ${OUTPUTFLAG}$@ $<
|
||||||
|
visitor_generator.${OBJEXT}: visitors/visitor_generator.cpp ../sdlpp/sdlpp.hpp visitors/visitor_generator.hpp objectids.hpp
|
||||||
$(CXX) $(CXXFLAGS) -c ${OUTPUTFLAG}$@ $<
|
$(CXX) $(CXXFLAGS) -c ${OUTPUTFLAG}$@ $<
|
||||||
editor.${OBJEXT}: editor.cpp ../sdlpp/sdlpp.hpp sprites.hpp
|
editor.${OBJEXT}: editor.cpp ../sdlpp/sdlpp.hpp sprites.hpp
|
||||||
$(CXX) $(CXXFLAGS) -c ${OUTPUTFLAG}$@ $<
|
$(CXX) $(CXXFLAGS) -c ${OUTPUTFLAG}$@ $<
|
||||||
|
@ -5,7 +5,8 @@
|
|||||||
#include "editor_visitor.hpp"
|
#include "editor_visitor.hpp"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include "mario_visitor.hpp"
|
#include "visitors/mario_visitor.hpp"
|
||||||
|
#include "visitors/bounce_visitor.hpp"
|
||||||
#include "blocks/simpleblocks.hpp"
|
#include "blocks/simpleblocks.hpp"
|
||||||
#include "blocks/coineditorblock.hpp"
|
#include "blocks/coineditorblock.hpp"
|
||||||
#include "blocks/coinblock.hpp"
|
#include "blocks/coinblock.hpp"
|
||||||
@ -49,7 +50,7 @@ void MarioBlock::visit( SDLPP::Visitor &visitor ) {
|
|||||||
|
|
||||||
setPos( getPos() - SDLPP::Vec2D< double >( 0, BLOCK_SIZE ) );
|
setPos( getPos() - SDLPP::Vec2D< double >( 0, BLOCK_SIZE ) );
|
||||||
if ( getCollisions().size() < 2 )
|
if ( getCollisions().size() < 2 )
|
||||||
addCollision( SDLPP::RectColider( 0.1, 0.1, 0.8, 0.8, 69 ) );
|
addCollision( SDLPP::RectColider( 0.1, 0.1, 0.8, 0.8, BOUNCE_COLLISION ) );
|
||||||
updateSizeAndPosition();
|
updateSizeAndPosition();
|
||||||
g_playground->visitCollisions( *this, bv );
|
g_playground->visitCollisions( *this, bv );
|
||||||
setPos( getPos() + SDLPP::Vec2D< double >( 0, BLOCK_SIZE ) );
|
setPos( getPos() + SDLPP::Vec2D< double >( 0, BLOCK_SIZE ) );
|
||||||
@ -494,18 +495,22 @@ createBlockById( uint64_t id, int x, int y,
|
|||||||
result = std::static_pointer_cast< MarioBlock >(
|
result = std::static_pointer_cast< MarioBlock >(
|
||||||
std::make_shared< BackgroundModifierBlock >( x, y, renderer ) );
|
std::make_shared< BackgroundModifierBlock >( x, y, renderer ) );
|
||||||
break;
|
break;
|
||||||
|
#ifdef EDITOR
|
||||||
case COIN_MODIFIER_ID:
|
case COIN_MODIFIER_ID:
|
||||||
result = std::static_pointer_cast< MarioBlock >(
|
result = std::static_pointer_cast< MarioBlock >(
|
||||||
std::make_shared< CoinEditorBlock >( x, y, renderer ) );
|
std::make_shared< CoinEditorBlock >( x, y, renderer ) );
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
case MUSHROOM_MODIFIER_ID:
|
case MUSHROOM_MODIFIER_ID:
|
||||||
result = std::static_pointer_cast< MarioBlock >(
|
result = std::static_pointer_cast< MarioBlock >(
|
||||||
std::make_shared< MushroomModifierBlock >( x, y, renderer ) );
|
std::make_shared< MushroomModifierBlock >( x, y, renderer ) );
|
||||||
break;
|
break;
|
||||||
|
#ifndef EDITOR
|
||||||
case COIN_ID:
|
case COIN_ID:
|
||||||
result = std::static_pointer_cast< MarioBlock >(
|
result = std::static_pointer_cast< MarioBlock >(
|
||||||
std::make_shared< CoinBlock >( x, y, renderer ) );
|
std::make_shared< CoinBlock >( x, y, renderer ) );
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ public:
|
|||||||
void setTool( bool tool = true );
|
void setTool( bool tool = true );
|
||||||
void setTerrain( bool terrain = true );
|
void setTerrain( bool terrain = true );
|
||||||
void bounce();
|
void bounce();
|
||||||
virtual void custom_move( int ticks ) override;
|
void custom_move( int ticks ) override;
|
||||||
void setType( LandType::Value type );
|
void setType( LandType::Value type );
|
||||||
LandType::Value getType() const;
|
LandType::Value getType() const;
|
||||||
virtual void onScrollUp() {}
|
virtual void onScrollUp() {}
|
||||||
@ -27,6 +27,8 @@ public:
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
virtual void setData( uint8_t /*UNUSED*/ ) {}
|
virtual void setData( uint8_t /*UNUSED*/ ) {}
|
||||||
|
// handle own visitor
|
||||||
|
virtual void handleVisitor(SDLPP::Visitor &visitor) {}
|
||||||
bool hasCoin();
|
bool hasCoin();
|
||||||
bool hasMushroom();
|
bool hasMushroom();
|
||||||
void removeCoin();
|
void removeCoin();
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#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;
|
||||||
|
@ -5,11 +5,11 @@
|
|||||||
|
|
||||||
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 );
|
||||||
virtual void custom_move(int ticks) override;
|
void custom_move(int ticks) override;
|
||||||
void setParent(MarioBlock *parent);
|
void setParent(MarioBlock *parent);
|
||||||
private:
|
private:
|
||||||
MarioBlock *_parent;
|
MarioBlock *_parent = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -7,7 +7,7 @@ CoinEditorBlock::CoinEditorBlock( int x, int y,
|
|||||||
false, false ) {
|
false, false ) {
|
||||||
setId( COIN_MODIFIER_ID );
|
setId( COIN_MODIFIER_ID );
|
||||||
auto mypos = getDoubleRect();
|
auto mypos = getDoubleRect();
|
||||||
auto size = mypos.second.getX() / 1.5;
|
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,
|
||||||
@ -18,7 +18,7 @@ CoinEditorBlock::CoinEditorBlock( int x, int y,
|
|||||||
|
|
||||||
void CoinEditorBlock::render() {
|
void CoinEditorBlock::render() {
|
||||||
MarioBlock::render();
|
MarioBlock::render();
|
||||||
if ( _amount_text != NULL && !hidden ) {
|
if ( _amount_text != nullptr && !hidden ) {
|
||||||
_amount_text->render();
|
_amount_text->render();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -26,12 +26,12 @@ 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 / 1.5 );
|
_amount_text->setPos( getPos() + block_size - block_size / size_divisor );
|
||||||
_amount_text->updateSizeAndPosition();
|
_amount_text->updateSizeAndPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CoinEditorBlock::addOne() {
|
void CoinEditorBlock::addOne() {
|
||||||
if ( _amount < 15 ) {
|
if ( _amount < max_amount ) {
|
||||||
_amount++;
|
_amount++;
|
||||||
updateText();
|
updateText();
|
||||||
}
|
}
|
||||||
@ -47,8 +47,8 @@ void CoinEditorBlock::subtractOne() {
|
|||||||
void CoinEditorBlock::setAmount( int amount ) {
|
void CoinEditorBlock::setAmount( int amount ) {
|
||||||
if ( amount < 1 ) {
|
if ( amount < 1 ) {
|
||||||
amount = 1;
|
amount = 1;
|
||||||
} else if ( amount > 15 ) {
|
} else if ( amount > max_amount ) {
|
||||||
amount = 15;
|
amount = max_amount;
|
||||||
}
|
}
|
||||||
_amount = amount;
|
_amount = amount;
|
||||||
updateText();
|
updateText();
|
||||||
|
@ -10,20 +10,22 @@ 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 );
|
||||||
virtual void render() override;
|
void render() override;
|
||||||
virtual void updateSizeAndPosition() override;
|
void updateSizeAndPosition() override;
|
||||||
void addOne();
|
void addOne();
|
||||||
void subtractOne();
|
void subtractOne();
|
||||||
void setAmount( int amount );
|
void setAmount( int amount );
|
||||||
virtual void onScrollUp() override;
|
void onScrollUp() override;
|
||||||
virtual void onScrollDown() override;
|
void onScrollDown() override;
|
||||||
virtual uint8_t getData() override;
|
uint8_t getData() override;
|
||||||
virtual 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 uint8_t max_amount = 15;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -4,118 +4,118 @@
|
|||||||
#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, std::shared_ptr< SDLPP::Renderer > renderer )
|
int x, int y, 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, std::shared_ptr< SDLPP::Renderer > renderer )
|
int x, int y, 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, 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_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, false ) {
|
CLOUD_MIDDLE_BOTTOM_SRC, 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, 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_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();
|
||||||
@ -123,7 +123,7 @@ PipeLeftBottomBlock::PipeLeftBottomBlock(
|
|||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
@ -131,7 +131,7 @@ PipeRightBottomBlock::PipeRightBottomBlock(
|
|||||||
}
|
}
|
||||||
|
|
||||||
PipeLeftTopBlock::PipeLeftTopBlock(
|
PipeLeftTopBlock::PipeLeftTopBlock(
|
||||||
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_TOP_SRC,
|
: MarioBlock( x, y, renderer, g_terrain_texture, PIPE_LEFT_TOP_SRC,
|
||||||
false ) {
|
false ) {
|
||||||
ensureCollision();
|
ensureCollision();
|
||||||
@ -139,7 +139,7 @@ PipeLeftTopBlock::PipeLeftTopBlock(
|
|||||||
}
|
}
|
||||||
|
|
||||||
PipeRightTopBlock::PipeRightTopBlock(
|
PipeRightTopBlock::PipeRightTopBlock(
|
||||||
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_TOP_SRC,
|
: MarioBlock( x, y, renderer, g_terrain_texture, PIPE_RIGHT_TOP_SRC,
|
||||||
false ) {
|
false ) {
|
||||||
ensureCollision();
|
ensureCollision();
|
||||||
@ -147,56 +147,56 @@ PipeRightTopBlock::PipeRightTopBlock(
|
|||||||
}
|
}
|
||||||
|
|
||||||
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, std::shared_ptr< SDLPP::Renderer > renderer )
|
int x, int y, 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, std::shared_ptr< SDLPP::Renderer > renderer )
|
int x, int y, 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, std::shared_ptr< SDLPP::Renderer > renderer )
|
int x, int y, 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, std::shared_ptr< SDLPP::Renderer > renderer )
|
int x, int y, 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, false ) {
|
CASTLE_TOWER_FILLED_SRC, 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();
|
||||||
@ -204,14 +204,14 @@ VineBottomBlock::VineBottomBlock( int x, int y,
|
|||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
@ -219,34 +219,34 @@ PoleBottomBlock::PoleBottomBlock( int x, int y,
|
|||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
@ -254,7 +254,7 @@ SidewayPipeEndTopBlock::SidewayPipeEndTopBlock(
|
|||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
@ -262,7 +262,7 @@ SidewayPipeEndBottomBlock::SidewayPipeEndBottomBlock(
|
|||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
@ -270,7 +270,7 @@ SidewayPipeMiddleTopBlock::SidewayPipeMiddleTopBlock(
|
|||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
@ -278,7 +278,7 @@ SidewayPipeMiddleBottomBlock::SidewayPipeMiddleBottomBlock(
|
|||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
@ -286,7 +286,7 @@ SidewayPipeConnectorTopBlock::SidewayPipeConnectorTopBlock(
|
|||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
@ -294,7 +294,7 @@ SidewayPipeConnectorBottomBlock::SidewayPipeConnectorBottomBlock(
|
|||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
@ -302,7 +302,7 @@ TreePlatformTopLeftBlock::TreePlatformTopLeftBlock(
|
|||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
@ -310,7 +310,7 @@ TreePlatformTopMiddleBlock::TreePlatformTopMiddleBlock(
|
|||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
@ -318,7 +318,7 @@ TreePlatformTopRightBlock::TreePlatformTopRightBlock(
|
|||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
@ -326,7 +326,7 @@ TreePlatformBarkBlock::TreePlatformBarkBlock(
|
|||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
@ -334,7 +334,7 @@ WaterTopBlock::WaterTopBlock( int x, int y,
|
|||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
@ -342,7 +342,7 @@ WaterFillBlock::WaterFillBlock( int x, int y,
|
|||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
@ -350,7 +350,7 @@ MushroomPlatformTopLeftBlock::MushroomPlatformTopLeftBlock(
|
|||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
@ -358,7 +358,7 @@ MushroomPlatformTopMiddleBlock::MushroomPlatformTopMiddleBlock(
|
|||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
@ -366,7 +366,7 @@ MushroomPlatformTopRightBlock::MushroomPlatformTopRightBlock(
|
|||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
@ -374,7 +374,7 @@ MushroomPlatformBarkTopBlock::MushroomPlatformBarkTopBlock(
|
|||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
@ -382,7 +382,7 @@ MushroomPlatformBarkBottomBlock::MushroomPlatformBarkBottomBlock(
|
|||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
@ -390,7 +390,7 @@ TreeBarkBlock::TreeBarkBlock( int x, int y,
|
|||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
@ -398,7 +398,7 @@ TreeLeavesSmallBlock::TreeLeavesSmallBlock(
|
|||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
@ -406,7 +406,7 @@ TreeLeavesTopBlock::TreeLeavesTopBlock(
|
|||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
@ -414,7 +414,7 @@ TreeLeavesBottomBlock::TreeLeavesBottomBlock(
|
|||||||
}
|
}
|
||||||
|
|
||||||
CannonTowerBlock::CannonTowerBlock(
|
CannonTowerBlock::CannonTowerBlock(
|
||||||
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_TOWER_SRC,
|
: MarioBlock( x, y, renderer, g_terrain_texture, CANNON_TOWER_SRC,
|
||||||
false ) {
|
false ) {
|
||||||
ensureCollision();
|
ensureCollision();
|
||||||
@ -422,7 +422,7 @@ CannonTowerBlock::CannonTowerBlock(
|
|||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
@ -430,21 +430,21 @@ CannonPedestalBlock::CannonPedestalBlock(
|
|||||||
}
|
}
|
||||||
|
|
||||||
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( int x, int y,
|
DestructibleModifierBlock::DestructibleModifierBlock( int x, int y,
|
||||||
std::shared_ptr< SDLPP::Renderer > renderer ) : MarioBlock( x, y, renderer, g_mod_texture, MOD_DESTRUCTIBLE_SRC, false ) {
|
std::shared_ptr< SDLPP::Renderer > &renderer ) : MarioBlock( x, y, renderer, g_mod_texture, MOD_DESTRUCTIBLE_SRC, false ) {
|
||||||
setId( DESTRUCTIBLE_MODIFIER_ID );
|
setId( DESTRUCTIBLE_MODIFIER_ID );
|
||||||
}
|
}
|
||||||
BackgroundModifierBlock::BackgroundModifierBlock( int x, int y,
|
BackgroundModifierBlock::BackgroundModifierBlock( int x, int y,
|
||||||
std::shared_ptr< SDLPP::Renderer > renderer ) : MarioBlock (x, y, renderer, g_mod_texture, MOD_BACKGROUND_SRC, false ) {
|
std::shared_ptr< SDLPP::Renderer > &renderer ) : MarioBlock (x, y, renderer, g_mod_texture, MOD_BACKGROUND_SRC, false ) {
|
||||||
setId( BACKGROUND_MODIFIER_ID );
|
setId( BACKGROUND_MODIFIER_ID );
|
||||||
}
|
}
|
||||||
MushroomModifierBlock::MushroomModifierBlock( int x, int y,
|
MushroomModifierBlock::MushroomModifierBlock( int x, int y,
|
||||||
std::shared_ptr< SDLPP::Renderer > renderer ) : MarioBlock (x, y, renderer, g_mod_texture, MOD_MUSHROOM_SRC, false ) {
|
std::shared_ptr< SDLPP::Renderer > &renderer ) : MarioBlock (x, y, renderer, g_mod_texture, MOD_MUSHROOM_SRC, false ) {
|
||||||
setId( MUSHROOM_MODIFIER_ID );
|
setId( MUSHROOM_MODIFIER_ID );
|
||||||
}
|
}
|
||||||
|
@ -5,295 +5,297 @@
|
|||||||
|
|
||||||
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, std::shared_ptr< SDLPP::Renderer > renderer );
|
BushRightBlock( int x, int y,
|
||||||
|
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( int x, int y,
|
SidewayPipeMiddleBottomBlock(
|
||||||
std::shared_ptr< SDLPP::Renderer > renderer );
|
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer );
|
||||||
};
|
};
|
||||||
class SidewayPipeConnectorTopBlock : public MarioBlock {
|
class SidewayPipeConnectorTopBlock : public MarioBlock {
|
||||||
public:
|
public:
|
||||||
SidewayPipeConnectorTopBlock( int x, int y,
|
SidewayPipeConnectorTopBlock(
|
||||||
std::shared_ptr< SDLPP::Renderer > renderer );
|
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer );
|
||||||
};
|
};
|
||||||
class SidewayPipeConnectorBottomBlock : public MarioBlock {
|
class SidewayPipeConnectorBottomBlock : public MarioBlock {
|
||||||
public:
|
public:
|
||||||
SidewayPipeConnectorBottomBlock(
|
SidewayPipeConnectorBottomBlock(
|
||||||
int x, int y, std::shared_ptr< SDLPP::Renderer > renderer );
|
int x, int y, 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, std::shared_ptr< SDLPP::Renderer > renderer );
|
WaterFillBlock( int x, int y,
|
||||||
|
std::shared_ptr< SDLPP::Renderer > &renderer );
|
||||||
};
|
};
|
||||||
class MushroomPlatformTopLeftBlock : public MarioBlock {
|
class MushroomPlatformTopLeftBlock : public MarioBlock {
|
||||||
public:
|
public:
|
||||||
MushroomPlatformTopLeftBlock( int x, int y,
|
MushroomPlatformTopLeftBlock(
|
||||||
std::shared_ptr< SDLPP::Renderer > renderer );
|
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer );
|
||||||
};
|
};
|
||||||
class MushroomPlatformTopMiddleBlock : public MarioBlock {
|
class MushroomPlatformTopMiddleBlock : public MarioBlock {
|
||||||
public:
|
public:
|
||||||
MushroomPlatformTopMiddleBlock(
|
MushroomPlatformTopMiddleBlock(
|
||||||
int x, int y, std::shared_ptr< SDLPP::Renderer > renderer );
|
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer );
|
||||||
};
|
};
|
||||||
class MushroomPlatformTopRightBlock : public MarioBlock {
|
class MushroomPlatformTopRightBlock : public MarioBlock {
|
||||||
public:
|
public:
|
||||||
MushroomPlatformTopRightBlock(
|
MushroomPlatformTopRightBlock(
|
||||||
int x, int y, std::shared_ptr< SDLPP::Renderer > renderer );
|
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer );
|
||||||
};
|
};
|
||||||
class MushroomPlatformBarkTopBlock : public MarioBlock {
|
class MushroomPlatformBarkTopBlock : public MarioBlock {
|
||||||
public:
|
public:
|
||||||
MushroomPlatformBarkTopBlock( int x, int y,
|
MushroomPlatformBarkTopBlock(
|
||||||
std::shared_ptr< SDLPP::Renderer > renderer );
|
int x, int y, std::shared_ptr< SDLPP::Renderer > &renderer );
|
||||||
};
|
};
|
||||||
class MushroomPlatformBarkBottomBlock : public MarioBlock {
|
class MushroomPlatformBarkBottomBlock : public MarioBlock {
|
||||||
public:
|
public:
|
||||||
MushroomPlatformBarkBottomBlock(
|
MushroomPlatformBarkBottomBlock(
|
||||||
int x, int y, std::shared_ptr< SDLPP::Renderer > renderer );
|
int x, int y, 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
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
#include "objectids.hpp"
|
#include "objectids.hpp"
|
||||||
#include "blocks.hpp"
|
#include "blocks.hpp"
|
||||||
#include "maploader.hpp"
|
#include "maploader.hpp"
|
||||||
#include "mario_visitor.hpp"
|
|
||||||
#include "mario.hpp"
|
#include "mario.hpp"
|
||||||
|
#include "visitors/visitor_generator.hpp"
|
||||||
|
|
||||||
bool quit = false;
|
bool quit = false;
|
||||||
bool update = false;
|
bool update = false;
|
||||||
@ -27,6 +27,8 @@ std::shared_ptr< SDLPP::TextRenderer > fps = nullptr;
|
|||||||
std::shared_ptr< SDLPP::TextRenderer > coins = nullptr;
|
std::shared_ptr< SDLPP::TextRenderer > coins = nullptr;
|
||||||
int coin_count = 0;
|
int coin_count = 0;
|
||||||
|
|
||||||
|
std::vector< std::shared_ptr< MarioBlock > > moving_objects = {};
|
||||||
|
|
||||||
std::mutex render_mutex;
|
std::mutex render_mutex;
|
||||||
|
|
||||||
void handleKeyDown( SDL_Keycode key, SDLPP::Scene &scene ) {
|
void handleKeyDown( SDL_Keycode key, SDLPP::Scene &scene ) {
|
||||||
@ -51,8 +53,9 @@ void handleKeyDown( SDL_Keycode key, SDLPP::Scene &scene ) {
|
|||||||
!scene.getRenderer().getRenderColiders() );
|
!scene.getRenderer().getRenderColiders() );
|
||||||
break;
|
break;
|
||||||
case SDLK_f:
|
case SDLK_f:
|
||||||
if(fps)
|
if ( fps ) {
|
||||||
fps->setHidden( !fps->getHidden() );
|
fps->setHidden( !fps->getHidden() );
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -82,8 +85,9 @@ void pollEvents( SDLPP::Scene &scene ) {
|
|||||||
quit = true;
|
quit = true;
|
||||||
break;
|
break;
|
||||||
case SDL_KEYDOWN:
|
case SDL_KEYDOWN:
|
||||||
if ( !event.key.repeat )
|
if ( !event.key.repeat ) {
|
||||||
handleKeyDown( event.key.keysym.sym, scene );
|
handleKeyDown( event.key.keysym.sym, scene );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case SDL_KEYUP:
|
case SDL_KEYUP:
|
||||||
handleKeyUp( event.key.keysym.sym );
|
handleKeyUp( event.key.keysym.sym );
|
||||||
@ -132,22 +136,15 @@ void doInput( std::shared_ptr< SDLPP::Scene > scene ) {
|
|||||||
pollEvents( *scene );
|
pollEvents( *scene );
|
||||||
std::lock_guard< std::mutex > lock( render_mutex );
|
std::lock_guard< std::mutex > lock( render_mutex );
|
||||||
scene->updateScene();
|
scene->updateScene();
|
||||||
MarioVisitor mv(mario->getMovement().getY() < 0);
|
auto prev_coin_count = coin_count;
|
||||||
scene->visitCollisions( *mario, mv );
|
// TODO visit all moving objects
|
||||||
if ( mv.isDead() ) {
|
auto visitor = getVisitor(*mario, *scene, quit, coin_count, moving_objects);
|
||||||
quit = true;
|
scene->visitCollisions( *mario, *visitor );
|
||||||
}
|
mario->handleVisitor( *visitor );
|
||||||
mario->handleVisitor(mv);
|
|
||||||
if ( mv.hasCoin() ) {
|
if(coin_count != prev_coin_count) {
|
||||||
coin_count++;
|
|
||||||
coins->changeText( std::to_string( coin_count ) + " COINS" );
|
coins->changeText( std::to_string( coin_count ) + " COINS" );
|
||||||
}
|
}
|
||||||
if ( mv.hasCoinBlock() ) {
|
|
||||||
auto coin = mv.getCoinBlock();
|
|
||||||
scene->addObject(coin);
|
|
||||||
scene->setZIndex(coin, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// if player is > 0.7 of playground, move everything left
|
// if player is > 0.7 of playground, move everything left
|
||||||
auto playerX = mario->getRect().x;
|
auto playerX = mario->getRect().x;
|
||||||
auto width = scene->getWidth();
|
auto width = scene->getWidth();
|
||||||
@ -189,9 +186,8 @@ int main() {
|
|||||||
scene->addObject( bg );
|
scene->addObject( bg );
|
||||||
g_mario_texture = std::make_shared< SDLPP::Texture >(
|
g_mario_texture = std::make_shared< SDLPP::Texture >(
|
||||||
renderer, "sprites/mario.png", MARIO_OVERWORLD_COLORKEY );
|
renderer, "sprites/mario.png", MARIO_OVERWORLD_COLORKEY );
|
||||||
g_translucent_terrain_texture =
|
g_translucent_terrain_texture = std::make_shared< SDLPP::Texture >(
|
||||||
std::make_shared< SDLPP::Texture >( renderer, "sprites/terrain.png",
|
renderer, "sprites/terrain.png", MARIO_OVERWORLD_COLORKEY );
|
||||||
MARIO_OVERWORLD_COLORKEY );
|
|
||||||
g_translucent_terrain_texture->setAlpha( 100 );
|
g_translucent_terrain_texture->setAlpha( 100 );
|
||||||
mario = std::make_shared< Mario >( renderer );
|
mario = std::make_shared< Mario >( renderer );
|
||||||
scene->addObject( mario );
|
scene->addObject( mario );
|
||||||
@ -221,14 +217,18 @@ int main() {
|
|||||||
loadMap( scene, mario, "test_binary2.bin" );
|
loadMap( scene, mario, "test_binary2.bin" );
|
||||||
|
|
||||||
auto font = std::make_shared< SDLPP::Font >( "testfont.ttf", 36 );
|
auto font = std::make_shared< SDLPP::Font >( "testfont.ttf", 36 );
|
||||||
fps = std::make_shared<SDLPP::TextRenderer>(0.2, 0, 0.78, 0.1, renderer, font, "0fps", "#FFFFFF", "#000000", 0.1, SDLPP_TEXT_RIGHT);
|
fps = std::make_shared< SDLPP::TextRenderer >(
|
||||||
|
0.2, 0, 0.78, 0.1, renderer, font, "0fps", "#FFFFFF", "#000000", 0.1,
|
||||||
|
SDLPP_TEXT_RIGHT );
|
||||||
fps->setAlignment( SDLPP::OBJ_END, SDLPP::OBJ_START );
|
fps->setAlignment( SDLPP::OBJ_END, SDLPP::OBJ_START );
|
||||||
fps->setId( 0 );
|
fps->setId( 0 );
|
||||||
fps->setPermanent();
|
fps->setPermanent();
|
||||||
fps->setHidden( true );
|
fps->setHidden( true );
|
||||||
scene->addObject( fps );
|
scene->addObject( fps );
|
||||||
|
|
||||||
coins = std::make_shared<SDLPP::TextRenderer>(0.2, 0, 0.78, 0.1, renderer, font, "0 COINS", "#FFFFFF", "#000000", 0.1, SDLPP_TEXT_RIGHT);
|
coins = std::make_shared< SDLPP::TextRenderer >(
|
||||||
|
0.2, 0, 0.78, 0.1, renderer, font, "0 COINS", "#FFFFFF", "#000000", 0.1,
|
||||||
|
SDLPP_TEXT_RIGHT );
|
||||||
coins->setAlignment( SDLPP::OBJ_START, SDLPP::OBJ_START );
|
coins->setAlignment( SDLPP::OBJ_START, SDLPP::OBJ_START );
|
||||||
coins->setId( 0 );
|
coins->setId( 0 );
|
||||||
coins->setPermanent();
|
coins->setPermanent();
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#include "global_vars.hpp"
|
#include "global_vars.hpp"
|
||||||
#include "objectids.hpp"
|
#include "objectids.hpp"
|
||||||
#include "sprites.hpp"
|
#include "sprites.hpp"
|
||||||
|
#include "visitors/mario_visitor.hpp"
|
||||||
|
|
||||||
Mario::Mario(int x, int y, const std::shared_ptr< SDLPP::Renderer > &renderer) : MarioBlock(x, y, renderer, g_mario_texture, MARIO_STANDING_SRC) {
|
Mario::Mario(int x, int y, const std::shared_ptr< SDLPP::Renderer > &renderer) : MarioBlock(x, y, renderer, g_mario_texture, MARIO_STANDING_SRC) {
|
||||||
setAnimationFrames( MARIO_WALK_ANIM );
|
setAnimationFrames( MARIO_WALK_ANIM );
|
||||||
@ -60,10 +61,12 @@ void Mario::setStanding() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mario::handleVisitor(MarioVisitor &visitor) {
|
void Mario::handleVisitor(SDLPP::Visitor &visitor) {
|
||||||
|
#ifndef EDITOR
|
||||||
// TODO - https://web.archive.org/web/20130807122227/http://i276.photobucket.com/albums/kk21/jdaster64/smb_playerphysics.png
|
// TODO - https://web.archive.org/web/20130807122227/http://i276.photobucket.com/albums/kk21/jdaster64/smb_playerphysics.png
|
||||||
|
auto &m_visitor = dynamic_cast<MarioVisitor&>(visitor);
|
||||||
// handle gravity
|
// handle gravity
|
||||||
on_ground = visitor.isOnGround();
|
on_ground = m_visitor.isOnGround();
|
||||||
if(!jumping && on_ground) {
|
if(!jumping && on_ground) {
|
||||||
resetMovementY();
|
resetMovementY();
|
||||||
setTextureSourceRect(MARIO_STANDING_SRC);
|
setTextureSourceRect(MARIO_STANDING_SRC);
|
||||||
@ -71,34 +74,35 @@ void Mario::handleVisitor(MarioVisitor &visitor) {
|
|||||||
resumeAnimation();
|
resumeAnimation();
|
||||||
// for some reason falling of the edge causes on_ground to be true, but
|
// for some reason falling of the edge causes on_ground to be true, but
|
||||||
// visitor ground_y is 0
|
// visitor ground_y is 0
|
||||||
if(visitor.getGroundY() != 0) {
|
if(m_visitor.getGroundY() != 0) {
|
||||||
setPos(getPos().getX(), visitor.getGroundY() - BLOCK_SIZE);
|
setPos(getPos().getX(), m_visitor.getGroundY() - BLOCK_SIZE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if we just left ground gravity didn't work in custom_move
|
// if we just left ground gravity didn't work in custom_move
|
||||||
if(!on_ground && !jumping && getMovement().getY() == 0) {
|
if(!on_ground && !jumping && getMovement().getY() == 0) {
|
||||||
addMovement(0, 2*gravity_add_falling);
|
addMovement(0, 2*gravity_add_falling);
|
||||||
}
|
}
|
||||||
if(visitor.topBlock() && getMovement().getY() < 0) {
|
if(m_visitor.topBlock() && getMovement().getY() < 0) {
|
||||||
resetMovementY();
|
resetMovementY();
|
||||||
stop_jump = true;
|
stop_jump = true;
|
||||||
}
|
}
|
||||||
// make sure Mario isn't stuck inside a wall
|
// make sure Mario isn't stuck inside a wall
|
||||||
// TODO more readable function names
|
// TODO more readable function names
|
||||||
if ( visitor.isStopped() ) {
|
if ( m_visitor.isStopped() ) {
|
||||||
setPos( visitor.getStopX(), getPos().getY());
|
setPos( m_visitor.getStopX(), getPos().getY());
|
||||||
} else if ( visitor.canGoLeft() != visitor.canGoRight() && !(on_ground && visitor.getMovementBlockage().getY() > getPos().getY() + BLOCK_SIZE/2) ) {
|
} else if ( m_visitor.canGoLeft() != m_visitor.canGoRight() && !(on_ground && m_visitor.getMovementBlockage().getY() > getPos().getY() + BLOCK_SIZE/2) ) {
|
||||||
// only stop mario on ground if the block obstructs at least half of him (important for bug when mario lands from a high jump and is teleported if visitor is fired at wrong moment)
|
// only stop mario on ground if the block obstructs at least half of him (important for bug when mario lands from a high jump and is teleported if visitor is fired at wrong moment)
|
||||||
SDLPP::Vec2D<double> next_pos = { visitor.getMovementBlockage().getX() + (visitor.canGoLeft() * -1 + visitor.canGoRight() * 1) * BLOCK_SIZE, getPos().getY() };
|
SDLPP::Vec2D<double> next_pos = { m_visitor.getMovementBlockage().getX() + (m_visitor.canGoLeft() * -1 + m_visitor.canGoRight() * 1) * BLOCK_SIZE, getPos().getY() };
|
||||||
setPos(next_pos);
|
setPos(next_pos);
|
||||||
} else if (visitor.moveTop() && jumping && !stop_jump) {
|
} else if (m_visitor.moveTop() && jumping && !stop_jump) {
|
||||||
auto objPos = visitor.getRightLeftPos();
|
auto objPos = m_visitor.getRightLeftPos();
|
||||||
if(objPos.getX() < getPos().getX()) {
|
if(objPos.getX() < getPos().getX()) {
|
||||||
setPos( objPos.getX() + BLOCK_SIZE, getPos().getY() );
|
setPos( objPos.getX() + BLOCK_SIZE, getPos().getY() );
|
||||||
} else {
|
} else {
|
||||||
setPos( objPos.getX() - BLOCK_SIZE, getPos().getY() );
|
setPos( objPos.getX() - BLOCK_SIZE, getPos().getY() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mario::jump() {
|
void Mario::jump() {
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
#define MARIO_H
|
#define MARIO_H
|
||||||
|
|
||||||
#include "../sdlpp/sdlpp_rectrenderer.hpp"
|
#include "../sdlpp/sdlpp_rectrenderer.hpp"
|
||||||
#include "mario_visitor.hpp"
|
|
||||||
#include "sprites.hpp"
|
#include "sprites.hpp"
|
||||||
#include "blocks.hpp"
|
#include "blocks.hpp"
|
||||||
|
|
||||||
@ -13,10 +12,10 @@ public:
|
|||||||
void walkLeft();
|
void walkLeft();
|
||||||
void walkRight();
|
void walkRight();
|
||||||
void setStanding();
|
void setStanding();
|
||||||
void handleVisitor( MarioVisitor &visitor );
|
void handleVisitor( SDLPP::Visitor &visitor ) override;
|
||||||
void jump();
|
void jump();
|
||||||
void stopJump();
|
void stopJump();
|
||||||
virtual void custom_move( int ticks ) override;
|
void custom_move( int ticks ) override;
|
||||||
void visit( SDLPP::Visitor &visitor ) override;
|
void visit( SDLPP::Visitor &visitor ) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -35,7 +34,7 @@ private:
|
|||||||
const double gravity_add_jumping = jump_movement / 32.0;
|
const double gravity_add_jumping = jump_movement / 32.0;
|
||||||
const double gravity_add_falling = jump_movement / ( 64.0 / 7.0 );
|
const double gravity_add_falling = jump_movement / ( 64.0 / 7.0 );
|
||||||
std::shared_ptr< SDLPP::RectColider > top_collision = nullptr;
|
std::shared_ptr< SDLPP::RectColider > top_collision = nullptr;
|
||||||
virtual void setWorldTypeSrc( LandType::Value world ) override;
|
void setWorldTypeSrc( LandType::Value world ) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -100,4 +100,7 @@
|
|||||||
#define MOUSE_VISITOR_TYPE 0xE003
|
#define MOUSE_VISITOR_TYPE 0xE003
|
||||||
#define MARIO_VISITOR_TYPE 0xE004
|
#define MARIO_VISITOR_TYPE 0xE004
|
||||||
|
|
||||||
|
// Collisions
|
||||||
|
#define BOUNCE_COLLISION 0x0045
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
17
mario/visitors/bounce_visitor.cpp
Normal file
17
mario/visitors/bounce_visitor.cpp
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#include "bounce_visitor.hpp"
|
||||||
|
#include "../../sdlpp/sdlpp_renderobject.hpp"
|
||||||
|
#include "../objectids.hpp"
|
||||||
|
|
||||||
|
void BounceVisitor::visit( const SDLPP::RenderObject &obj ) {
|
||||||
|
auto id = obj.getId();
|
||||||
|
switch ( id ) {
|
||||||
|
case FLOOR_ID:
|
||||||
|
case BRICK_ID:
|
||||||
|
case BRICK_TOP_ID:
|
||||||
|
if(from == BOUNCE_COLLISION) {
|
||||||
|
hits += 1;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
34
mario/visitors/bounce_visitor.hpp
Normal file
34
mario/visitors/bounce_visitor.hpp
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
#ifndef BOUNCE_VISITOR_HPP
|
||||||
|
#define BOUNCE_VISITOR_HPP
|
||||||
|
|
||||||
|
#include "../../sdlpp/sdlpp_visitor.hpp"
|
||||||
|
#include "../../sdlpp/sdlpp_geometry.hpp"
|
||||||
|
|
||||||
|
class BounceVisitor : public SDLPP::Visitor {
|
||||||
|
public:
|
||||||
|
BounceVisitor() {}
|
||||||
|
virtual void visit( const SDLPP::RenderObject &obj ) override;
|
||||||
|
virtual void setFromId( uint64_t id ) override {
|
||||||
|
from = id;
|
||||||
|
}
|
||||||
|
virtual uint64_t getFromId() override {
|
||||||
|
return from;
|
||||||
|
}
|
||||||
|
virtual void setVisitorType( uint64_t type ) override {
|
||||||
|
_type = type;
|
||||||
|
}
|
||||||
|
virtual uint64_t getVisitorType() override {
|
||||||
|
return _type;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool canBounce() {
|
||||||
|
return hits < 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
int hits = 0;
|
||||||
|
uint64_t from;
|
||||||
|
uint64_t _type;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
@ -1,7 +1,7 @@
|
|||||||
#include "mario_visitor.hpp"
|
#include "mario_visitor.hpp"
|
||||||
#include "../sdlpp/sdlpp_renderobject.hpp"
|
#include "../../sdlpp/sdlpp_renderobject.hpp"
|
||||||
#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();
|
||||||
@ -32,12 +32,14 @@ void MarioVisitor::visit( const SDLPP::RenderObject &obj ) {
|
|||||||
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;
|
||||||
@ -47,7 +49,9 @@ void MarioVisitor::visit( const SDLPP::RenderObject &obj ) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DEATH_ID:
|
case DEATH_ID:
|
||||||
|
// TODO remove death?
|
||||||
death = true;
|
death = true;
|
||||||
|
_quit = true;
|
||||||
break;
|
break;
|
||||||
case STOP_MOVEMENT:
|
case STOP_MOVEMENT:
|
||||||
stop = true;
|
stop = true;
|
||||||
@ -58,17 +62,3 @@ void MarioVisitor::visit( const SDLPP::RenderObject &obj ) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BounceVisitor::visit( const SDLPP::RenderObject &obj ) {
|
|
||||||
auto id = obj.getId();
|
|
||||||
switch ( id ) {
|
|
||||||
case FLOOR_ID:
|
|
||||||
case BRICK_ID:
|
|
||||||
case BRICK_TOP_ID:
|
|
||||||
if(from == 69) {
|
|
||||||
hits += 1;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,13 +1,14 @@
|
|||||||
#ifndef MARIO_VISITOR_H
|
#ifndef MARIO_VISITOR_H
|
||||||
#define MARIO_VISITOR_H
|
#define MARIO_VISITOR_H
|
||||||
|
|
||||||
#include "../sdlpp/sdlpp_visitor.hpp"
|
#include "../../sdlpp/sdlpp_visitor.hpp"
|
||||||
#include "../sdlpp/sdlpp_geometry.hpp"
|
#include "../../sdlpp/sdlpp_geometry.hpp"
|
||||||
#include "blocks.hpp"
|
#include "../../sdlpp/sdlpp_scene.hpp"
|
||||||
|
#include "../blocks.hpp"
|
||||||
|
|
||||||
class MarioVisitor : public SDLPP::Visitor {
|
class MarioVisitor : public SDLPP::Visitor {
|
||||||
public:
|
public:
|
||||||
MarioVisitor(bool is_jumping) : jumping(is_jumping) {}
|
MarioVisitor(bool is_jumping, SDLPP::Scene &scene, bool &quit, int &coin_count) : jumping(is_jumping), _scene(scene), _quit(quit), _coin_count(coin_count) {}
|
||||||
virtual void visit( const SDLPP::RenderObject &obj ) override;
|
virtual void visit( const SDLPP::RenderObject &obj ) override;
|
||||||
bool isOnGround() {
|
bool isOnGround() {
|
||||||
return onGround;
|
return onGround;
|
||||||
@ -65,7 +66,9 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setCoin() {
|
void setCoin() {
|
||||||
|
// TODO remove coin?
|
||||||
coin = true;
|
coin = true;
|
||||||
|
_coin_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hasCoin() {
|
bool hasCoin() {
|
||||||
@ -73,7 +76,10 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setCoinBlock(std::shared_ptr<MarioBlock> &coin) {
|
void setCoinBlock(std::shared_ptr<MarioBlock> &coin) {
|
||||||
|
// TODO remove coin_block?
|
||||||
coin_block = coin;
|
coin_block = coin;
|
||||||
|
_scene.addObject(coin);
|
||||||
|
_scene.setZIndex(coin, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hasCoinBlock() {
|
bool hasCoinBlock() {
|
||||||
@ -101,33 +107,9 @@ private:
|
|||||||
bool coin = false;
|
bool coin = false;
|
||||||
SDLPP::Vec2D<double> movement_blockage;
|
SDLPP::Vec2D<double> movement_blockage;
|
||||||
std::shared_ptr<MarioBlock> coin_block = nullptr;
|
std::shared_ptr<MarioBlock> coin_block = nullptr;
|
||||||
};
|
SDLPP::Scene &_scene;
|
||||||
|
bool &_quit;
|
||||||
class BounceVisitor : public SDLPP::Visitor {
|
int &_coin_count;
|
||||||
public:
|
|
||||||
BounceVisitor() {}
|
|
||||||
virtual void visit( const SDLPP::RenderObject &obj ) override;
|
|
||||||
virtual void setFromId( uint64_t id ) override {
|
|
||||||
from = id;
|
|
||||||
}
|
|
||||||
virtual uint64_t getFromId() override {
|
|
||||||
return from;
|
|
||||||
}
|
|
||||||
virtual void setVisitorType( uint64_t type ) override {
|
|
||||||
_type = type;
|
|
||||||
}
|
|
||||||
virtual uint64_t getVisitorType() override {
|
|
||||||
return _type;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool canBounce() {
|
|
||||||
return hits < 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
int hits = 0;
|
|
||||||
uint64_t from;
|
|
||||||
uint64_t _type;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
17
mario/visitors/visitor_generator.cpp
Normal file
17
mario/visitors/visitor_generator.cpp
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#include "visitor_generator.hpp"
|
||||||
|
#include "../objectids.hpp"
|
||||||
|
#include "mario_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));
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
11
mario/visitors/visitor_generator.hpp
Normal file
11
mario/visitors/visitor_generator.hpp
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#ifndef MARIO_VISITOR_GENERATOR_HPP
|
||||||
|
#define MARIO_VISITOR_GENERATOR_HPP
|
||||||
|
|
||||||
|
#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 );
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in New Issue
Block a user