#include "object/endsequence_walkright.hpp"
#include "object/level_time.hpp"
#include "object/player.hpp"
+#include "scripting/scripting.hpp"
+#include "scripting/squirrel_util.hpp"
#include "scripting/squirrel_util.hpp"
#include "supertux/gameconfig.hpp"
#include "supertux/globals.hpp"
speed_before_pause = ScreenManager::current()->get_speed();
ScreenManager::current()->set_speed(0);
MenuManager::instance().set_menu(MenuStorage::GAME_MENU);
+ SoundManager::current()->pause_music();
game_pause = true;
}
GameSession::update(float elapsed_time)
{
// handle controller
- if(InputManager::current()->get_controller()->pressed(Controller::PAUSE_MENU))
+ if(InputManager::current()->get_controller()->pressed(Controller::ESCAPE) ||
+ InputManager::current()->get_controller()->pressed(Controller::START))
{
on_escape_press();
}
- if(InputManager::current()->get_controller()->pressed(Controller::CHEAT_MENU))
+ if(InputManager::current()->get_controller()->pressed(Controller::CHEAT_MENU) &&
+ g_config->developer_mode)
{
if (!MenuManager::instance().is_active())
{
// Unpause the game if the menu has been closed
if (game_pause && !MenuManager::instance().is_active()) {
ScreenManager::current()->set_speed(speed_before_pause);
+ SoundManager::current()->resume_music();
game_pause = false;
}
}
}
+ if(currentsector == NULL)
+ return;
+
// update sounds
- if (currentsector && currentsector->camera) SoundManager::current()->set_listener_position(currentsector->camera->get_center());
+ if (currentsector->camera) SoundManager::current()->set_listener_position(currentsector->camera->get_center());
/* Handle music: */
if (end_sequence)
if (sequencename == "endsequence") {
if (currentsector->get_players()[0]->get_physic().get_velocity_x() < 0) {
- end_sequence = new EndSequenceWalkLeft();
+ end_sequence = std::make_shared<EndSequenceWalkLeft>();
} else {
- end_sequence = new EndSequenceWalkRight();
+ end_sequence = std::make_shared<EndSequenceWalkRight>();
}
} else if (sequencename == "fireworks") {
- end_sequence = new EndSequenceFireworks();
+ end_sequence = std::make_shared<EndSequenceFireworks>();
} else {
log_warning << "Unknown sequence '" << sequencename << "'. Ignoring." << std::endl;
return;
currentsector->player->set_winning();
// Stop all clocks.
- for(std::vector<GameObject*>::iterator i = currentsector->gameobjects.begin();
+ for(auto i = currentsector->gameobjects.begin();
i != currentsector->gameobjects.end(); ++i)
{
- GameObject* obj = *i;
+ GameObjectPtr obj = *i;
- LevelTime* lt = dynamic_cast<LevelTime*> (obj);
+ auto lt = std::dynamic_pointer_cast<LevelTime>(obj);
if(lt)
lt->stop();
}