Mario: teleport to hardcoded level
This commit is contained in:
+18
-2
@@ -1,5 +1,6 @@
|
||||
#include "blocks.hpp"
|
||||
#include "global_vars.hpp"
|
||||
#include "maploader.hpp"
|
||||
#include "objectids.hpp"
|
||||
#include "sprites.hpp"
|
||||
#include "editor_visitor.hpp"
|
||||
@@ -200,6 +201,9 @@ bool MarioBlock::hasCoin() {
|
||||
bool MarioBlock::hasMushroom() {
|
||||
return _mushroom;
|
||||
}
|
||||
bool MarioBlock::hasTeleport() {
|
||||
return !_teleport_level.empty();
|
||||
}
|
||||
void MarioBlock::removeCoin() {
|
||||
_coins--;
|
||||
}
|
||||
@@ -212,6 +216,9 @@ void MarioBlock::addMushroom() {
|
||||
void MarioBlock::setCoinCount(int coins) {
|
||||
_coins = coins;
|
||||
}
|
||||
void MarioBlock::setTeleportLevel(const std::string &level) {
|
||||
_teleport_level = level;
|
||||
}
|
||||
void MarioBlock::setDestructible(bool destructible) {
|
||||
_destructible = destructible;
|
||||
}
|
||||
@@ -309,6 +316,7 @@ const std::vector<uint64_t> possibleMods = {
|
||||
BACKGROUND_MODIFIER_ID,
|
||||
COIN_MODIFIER_ID,
|
||||
MUSHROOM_MODIFIER_ID,
|
||||
TELEPORT_MODIFIER_ID,
|
||||
};
|
||||
|
||||
const std::vector<uint64_t> possibleCharacters = {
|
||||
@@ -565,6 +573,7 @@ createBlockById(uint64_t id, int x, int y,
|
||||
result = std::static_pointer_cast<MarioBlock>(
|
||||
std::make_shared<GoombaBlock>(x, y, renderer));
|
||||
break;
|
||||
#ifdef EDITOR
|
||||
case DESTRUCTIBLE_MODIFIER_ID:
|
||||
result = std::static_pointer_cast<MarioBlock>(
|
||||
std::make_shared<DestructibleModifierBlock>(x, y, renderer));
|
||||
@@ -573,16 +582,19 @@ createBlockById(uint64_t id, int x, int y,
|
||||
result = std::static_pointer_cast<MarioBlock>(
|
||||
std::make_shared<BackgroundModifierBlock>(x, y, renderer));
|
||||
break;
|
||||
#ifdef EDITOR
|
||||
case COIN_MODIFIER_ID:
|
||||
result = std::static_pointer_cast<MarioBlock>(
|
||||
std::make_shared<CoinEditorBlock>(x, y, renderer));
|
||||
break;
|
||||
#endif
|
||||
case MUSHROOM_MODIFIER_ID:
|
||||
result = std::static_pointer_cast<MarioBlock>(
|
||||
std::make_shared<MushroomModifierBlock>(x, y, renderer));
|
||||
break;
|
||||
case TELEPORT_MODIFIER_ID:
|
||||
result = std::static_pointer_cast<MarioBlock>(
|
||||
std::make_shared<TeleportModifierBlock>(x, y, renderer));
|
||||
break;
|
||||
#endif
|
||||
#ifndef EDITOR
|
||||
case COIN_ID:
|
||||
result = std::static_pointer_cast<MarioBlock>(
|
||||
@@ -678,3 +690,7 @@ void MarioBlock::harden() {
|
||||
setBouncable(false);
|
||||
setTextureSourceRect(HARD_SRC);
|
||||
}
|
||||
|
||||
const std::string &MarioBlock::getTeleportLevel() {
|
||||
return _teleport_level;
|
||||
}
|
||||
Reference in New Issue
Block a user