diff --git a/source/animated_sprite.cpp b/source/animated_sprite.cpp index a818d81..d671202 100644 --- a/source/animated_sprite.cpp +++ b/source/animated_sprite.cpp @@ -510,8 +510,11 @@ void AnimatedSprite::setCurrentAnimation(int index) // Actualiza las variables del objeto void AnimatedSprite::update() { - animate(); - MovingSprite::update(); + if (enabled_) + { + animate(); + MovingSprite::update(); + } } // Establece el rectangulo para un frame de una animación diff --git a/source/game.cpp b/source/game.cpp index 0a3c879..c3c4b43 100644 --- a/source/game.cpp +++ b/source/game.cpp @@ -1049,7 +1049,7 @@ void Game::updateBalloonSpeed() } // Explosiona un globo. Lo destruye y crea otros dos si es el caso -void Game::popBalloon(std::shared_ptr &balloon) +void Game::popBalloon(std::shared_ptr balloon) { // Aumenta el poder de la fase increaseStageCurrentPower(1); @@ -1072,11 +1072,11 @@ void Game::popBalloon(std::shared_ptr &balloon) } else { // En cualquier otro caso, crea dos globos de un tipo inferior - const auto bLeft = createBalloon(0, balloon->getPosY(), balloon->getKind() - 1, BALLOON_VELX_NEGATIVE, enemySpeed, 0); + auto bLeft = createBalloon(0, balloon->getPosY(), balloon->getKind() - 1, BALLOON_VELX_NEGATIVE, enemySpeed, 0); bLeft->allignTo(balloon->getPosX() + (balloon->getWidth() / 2)); bLeft->setVelY(bLeft->getClass() == BALLOON_CLASS ? -2.50f : BALLOON_VELX_NEGATIVE); - const auto bRight = createBalloon(0, balloon->getPosY(), balloon->getKind() - 1, BALLOON_VELX_POSITIVE, enemySpeed, 0); + auto bRight = createBalloon(0, balloon->getPosY(), balloon->getKind() - 1, BALLOON_VELX_POSITIVE, enemySpeed, 0); bRight->allignTo(balloon->getPosX() + (balloon->getWidth() / 2)); bRight->setVelY(bRight->getClass() == BALLOON_CLASS ? -2.50f : BALLOON_VELX_NEGATIVE); diff --git a/source/game.h b/source/game.h index 4a6989b..5f9423c 100644 --- a/source/game.h +++ b/source/game.h @@ -277,7 +277,7 @@ private: void updateBalloonSpeed(); // Explosiona un globo. Lo destruye y crea otros dos si es el caso - void popBalloon(std::shared_ptr &balloon); + void popBalloon(std::shared_ptr balloon); // Explosiona un globo. Lo destruye void destroyBalloon(std::shared_ptr &balloon); diff --git a/source/moving_sprite.cpp b/source/moving_sprite.cpp index 2eeb42e..44ce667 100644 --- a/source/moving_sprite.cpp +++ b/source/moving_sprite.cpp @@ -68,7 +68,10 @@ void MovingSprite::move() // Muestra el sprite por pantalla void MovingSprite::render() { - texture_->render((int)x_, (int)y_, &spriteClip_, zoomW_, zoomH_, angle_, center_, currentFlip_); + if (enabled_) + { + texture_->render((int)x_, (int)y_, &spriteClip_, zoomW_, zoomH_, angle_, center_, currentFlip_); + } } // Obtiene el valor de la variable @@ -259,9 +262,12 @@ void MovingSprite::disableRotate() // Actualiza las variables internas del objeto void MovingSprite::update() { - move(); - rotate(); - ++counter_ %= 60000; + if (enabled_) + { + move(); + rotate(); + ++counter_ %= 60000; + } } // Cambia el sentido de la rotación diff --git a/source/screen.cpp b/source/screen.cpp index e70cd30..a44ca7c 100644 --- a/source/screen.cpp +++ b/source/screen.cpp @@ -232,7 +232,7 @@ void Screen::setVideoMode(ScreenVideoMode videoMode) // Reinicia los shaders if (options.video.shaders) { -#ifdef SHADERS +#ifndef NO_SHADERS std::ifstream f(asset->get("crtpi.glsl").c_str()); std::string source((std::istreambuf_iterator(f)), std::istreambuf_iterator()); diff --git a/source/smart_sprite.cpp b/source/smart_sprite.cpp index 168ae22..bbfa0e1 100644 --- a/source/smart_sprite.cpp +++ b/source/smart_sprite.cpp @@ -19,20 +19,18 @@ void SmartSprite::init() destX_ = 0; destY_ = 0; finished_ = false; + enabled_ = false; } // Actualiza la posición y comprueba si ha llegado a su destino void SmartSprite::update() { - MovingSprite::update(); - checkMove(); - checkFinished(); -} - -// Pinta el objeto en pantalla -void SmartSprite::render() -{ - MovingSprite::render(); + if (enabled_) + { + MovingSprite::update(); + checkMove(); + checkFinished(); + } } // Establece el valor de la variable diff --git a/source/smart_sprite.h b/source/smart_sprite.h index a64ff52..16d4ece 100644 --- a/source/smart_sprite.h +++ b/source/smart_sprite.h @@ -34,9 +34,6 @@ public: // Actualiza la posición y comprueba si ha llegado a su destino void update(); - // Pinta el objeto en pantalla - void render(); - // Establece el valor de la variable void setFinishedCounter(int value);