Remove redundant functions from blocks.cpp, fix editor problem with pagination

This commit is contained in:
2021-07-24 19:59:25 +02:00
parent 3be728843a
commit d638108223
8 changed files with 113 additions and 381 deletions
+15 -13
View File
@@ -2,7 +2,6 @@
#define BLOCKS_H
#include "../sdlpp/sdlpp_rectrenderer.hpp"
#include "../sdlpp/sdlpp_fontconfiguration.hpp"
#include <memory>
struct LandType {
@@ -11,25 +10,29 @@ struct LandType {
class MarioBlock : public SDLPP::RectangleRender {
public:
MarioBlock( int x, int y, const std::shared_ptr< SDLPP::Renderer > &renderer,
std::shared_ptr< SDLPP::Texture > texture, SDL_Rect src, bool can_be_destroyed = false, bool destructible = false );
MarioBlock( int x, int y,
const std::shared_ptr< SDLPP::Renderer > &renderer,
std::shared_ptr< SDLPP::Texture > texture, SDL_Rect src,
bool can_be_destroyed = false, bool destructible = false );
void visit( SDLPP::Visitor &visitor ) override;
void setTool( bool tool = true );
void setTerrain( bool terrain = true );
void bounce();
virtual void custom_move(int ticks) override;
void setType(LandType::Value type);
virtual void custom_move( int ticks ) override;
void setType( LandType::Value type );
LandType::Value getType() const;
virtual void onScrollUp() {}
virtual void onScrollDown() {}
virtual uint8_t getData() {return 0;}
virtual void setData(uint8_t /*UNUSED*/) {}
virtual uint8_t getData() {
return 0;
}
virtual void setData( uint8_t /*UNUSED*/ ) {}
bool hasCoin();
bool hasMushroom();
void removeCoin();
void removeMushroom();
void setCoinCount(int coins);
void setDestructible(bool destructible = true);
void setCoinCount( int coins );
void setDestructible( bool destructible = true );
void ensureCollision();
private:
@@ -42,10 +45,11 @@ private:
bool _mushroom = false;
const int bounce_ticks = 100;
int ticks_to_bounce = bounce_ticks;
SDLPP::Vec2D<double> og_pos = {};
SDLPP::Vec2D< double > og_pos = {};
LandType::Value _type;
SDL_Rect _base_src;
virtual void setWorldTypeSrc(LandType::Value world);
virtual void setWorldTypeSrc( LandType::Value world );
};
extern const std::vector< uint64_t > possibleBlocks;
@@ -76,6 +80,4 @@ createMario( LandType::Value type, std::shared_ptr< SDLPP::Renderer > &renderer,
enum BlockRole::Value getBlockRole( uint64_t id );
SDL_Rect getSourceRectByID( uint64_t id, LandType::Value type );
#endif