Mario: formatting

This commit is contained in:
2021-10-18 09:08:35 +02:00
parent f3062464d2
commit 8ca70fa11e
19 changed files with 1262 additions and 1250 deletions
+32 -33
View File
@@ -11,24 +11,23 @@ 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 );
void visit( SDLPP::Visitor &visitor ) override;
void setTool( bool tool = true );
void setTerrain( bool terrain = true );
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();
void travelToPos(const SDLPP::Vec2D<double> &target);
void custom_move( int ticks ) override;
void setType( LandType::Value type );
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() const {
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();
@@ -36,8 +35,8 @@ public:
void removeCoin();
void removeMushroom();
void addMushroom();
void setCoinCount( int coins );
void setDestructible( bool destructible = true );
void setCoinCount(int coins);
void setDestructible(bool destructible = true);
void ensureCollision();
bool isBouncing() const;
bool isTraveling() const;
@@ -52,7 +51,7 @@ protected:
void gravity(int ticks);
void setOnGround(bool on_ground = true) {
_on_ground = on_ground;
if(on_ground) {
if (on_ground) {
setMovement(getMovement().getX(), 0);
}
}
@@ -63,7 +62,7 @@ protected:
_base_gravity_ticks = ticks;
}
virtual void setWorldTypeSrc( LandType::Value world );
virtual void setWorldTypeSrc(LandType::Value world);
private:
bool _tool = false;
@@ -76,22 +75,22 @@ private:
bool _mushroom = false;
bool _release_coin = false;
int ticks_to_bounce = 0;
SDLPP::Vec2D< double > og_pos = {};
SDLPP::Vec2D<double> og_pos = {};
LandType::Value _type;
SDL_Rect _base_src;
SDLPP::Vec2D<double> _target = {0,0};
SDLPP::Vec2D<double> _target = { 0, 0 };
bool _on_ground = true;
int _base_gravity_ticks = 1000 / 60;
int _ticks_till_gravity = 0;
double _gravity_acceleration = 1.0/(64.0/7.0);
double _gravity_acceleration = 1.0 / (64.0 / 7.0);
bool _was_visible = false;
};
extern const std::vector< uint64_t > possibleBlocks;
extern const std::vector< uint64_t > possibleMods;
extern const std::vector< uint64_t > possibleCharacters;
extern const std::vector< LandType::Value > possibleLands;
extern const std::vector<uint64_t> possibleBlocks;
extern const std::vector<uint64_t> possibleMods;
extern const std::vector<uint64_t> possibleCharacters;
extern const std::vector<LandType::Value> possibleLands;
struct BlockRole {
enum Value {
@@ -102,18 +101,18 @@ struct BlockRole {
};
};
std::shared_ptr< MarioBlock >
createTerrainBlock( uint64_t block_id, LandType::Value type,
std::shared_ptr< SDLPP::Renderer > &renderer,
bool destructible = false, bool editor = false );
std::shared_ptr< MarioBlock >
createTerrainBlock( uint64_t block_id, LandType::Value type,
std::shared_ptr< SDLPP::Renderer > &renderer, int x, int y,
bool destructible = false, bool editor = false );
std::shared_ptr< MarioBlock >
createMario( LandType::Value type, std::shared_ptr< SDLPP::Renderer > &renderer,
int x, int y, bool editor = false );
std::shared_ptr<MarioBlock>
createTerrainBlock(uint64_t block_id, LandType::Value type,
std::shared_ptr<SDLPP::Renderer> &renderer,
bool destructible = false, bool editor = false);
std::shared_ptr<MarioBlock>
createTerrainBlock(uint64_t block_id, LandType::Value type,
std::shared_ptr<SDLPP::Renderer> &renderer, int x, int y,
bool destructible = false, bool editor = false);
std::shared_ptr<MarioBlock>
createMario(LandType::Value type, std::shared_ptr<SDLPP::Renderer> &renderer,
int x, int y, bool editor = false);
enum BlockRole::Value getBlockRole( uint64_t id );
enum BlockRole::Value getBlockRole(uint64_t id);
#endif