game/mario/blocks/simpleblocks.cpp
zv0n aa5043a811
All checks were successful
continuous-integration/drone/push Build is passing
Mario: disable bouncing on some blocks
2022-09-24 20:45:21 +02:00

467 lines
16 KiB
C++

#include "simpleblocks.hpp"
#include "../global_vars.hpp"
#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) {
ensureCollision();
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);
}
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);
}
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);
}
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);
}
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);
}
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);
}
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);
}
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);
}
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);
}
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);
}
PipeLeftBottomBlock::PipeLeftBottomBlock(
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);
}
PipeRightBottomBlock::PipeRightBottomBlock(
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);
}
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);
}
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);
}
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);
}
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);
}
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);
}
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);
setBouncable(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);
setBouncable(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);
setBouncable(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);
setBouncable(false);
}
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);
setBouncable(false);
}
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);
}
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);
}
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);
}
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) {
ensureCollision();
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) {
ensureCollision();
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) {
ensureCollision();
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) {
ensureCollision();
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) {
ensureCollision();
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) {
ensureCollision();
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) {
ensureCollision();
setId(TREE_PLATFORM_TOP_LEFT_ID);
setBouncable(false);
}
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) {
ensureCollision();
setId(TREE_PLATFORM_TOP_MIDDLE_ID);
setBouncable(false);
}
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) {
ensureCollision();
setId(TREE_PLATFORM_TOP_RIGHT_ID);
setBouncable(false);
}
TreePlatformBarkBlock::TreePlatformBarkBlock(
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);
setBouncable(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);
setBouncable(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);
setBouncable(false);
}
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) {
ensureCollision();
setId(MUSHROOM_PLATFORM_TOP_LEFT_ID);
setBouncable(false);
}
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) {
ensureCollision();
setId(MUSHROOM_PLATFORM_TOP_MIDDLE_ID);
setBouncable(false);
}
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) {
ensureCollision();
setId(MUSHROOM_PLATFORM_TOP_RIGHT_ID);
setBouncable(false);
}
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) {
ensureCollision();
setId(MUSHROOM_PLATFORM_BARK_TOP_ID);
setBouncable(false);
}
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) {
ensureCollision();
setId(MUSHROOM_PLATFORM_BARK_BOTTOM_ID);
setBouncable(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);
setBouncable(false);
}
TreeLeavesSmallBlock::TreeLeavesSmallBlock(
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);
setBouncable(false);
}
TreeLeavesTopBlock::TreeLeavesTopBlock(
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);
setBouncable(false);
}
TreeLeavesBottomBlock::TreeLeavesBottomBlock(
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);
setBouncable(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);
}
CannonPedestalBlock::CannonPedestalBlock(
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);
}
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);
}
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);
}
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);
}
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);
}