Add continue button to cutscenes

This commit is contained in:
Deve 2019-11-24 00:55:57 +01:00
parent 1a2beedb68
commit 426be8f3c1
7 changed files with 145 additions and 1 deletions

View File

@ -32,6 +32,7 @@
#include "modes/overworld.hpp"
#include "physics/physics.hpp"
#include "states_screens/credits.hpp"
#include "states_screens/cutscene_general.hpp"
#include "states_screens/cutscene_gui.hpp"
#include "states_screens/feature_unlocked.hpp"
#include "states_screens/offline_kart_selection.hpp"
@ -591,6 +592,14 @@ void CutsceneWorld::enterRaceOverState()
race_manager->exitRace();
race_manager->startSingleRace(next_part, 999, race_manager->raceWasStartedFromOverworld());
// Keep showing cutscene gui if previous scene was using it
CutSceneGeneral* csg = dynamic_cast<CutSceneGeneral*>(cs);
if (csg != NULL)
{
CutSceneGeneral* scene = CutSceneGeneral::getInstance();
scene->push();
}
}
}

View File

@ -0,0 +1,63 @@
//
// SuperTuxKart - a fun racing game with go-kart
// Copyright (C) 2010-2015 SuperTuxKart-Team
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 3
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "states_screens/cutscene_general.hpp"
#include "modes/cutscene_world.hpp"
CutSceneGeneral::CutSceneGeneral() : CutsceneScreen("cutscene.stkgui")
{
} // CutSceneGeneral
// ----------------------------------------------------------------------------
void CutSceneGeneral::loadedFromFile()
{
} // loadedFromFile
// ----------------------------------------------------------------------------
void CutSceneGeneral::init()
{
} // init
// ----------------------------------------------------------------------------
void CutSceneGeneral::tearDown()
{
Screen::tearDown();
} // tearDown
// ----------------------------------------------------------------------------
bool CutSceneGeneral::onEscapePressed()
{
((CutsceneWorld*)World::getWorld())->abortCutscene();
return false;
} // onEscapePressed
// ----------------------------------------------------------------------------
void CutSceneGeneral::eventCallback(GUIEngine::Widget* widget,
const std::string& name,
const int playerID)
{
if (name == "continue")
{
onEscapePressed();
}
} // eventCallback

View File

@ -0,0 +1,58 @@
//
// SuperTuxKart - a fun racing game with go-kart
// Copyright (C) 2010-2015 SuperTuxKart-Team
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 3
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef CUTSCENE_GENERAL_HPP
#define CUTSCENE_GENERAL_HPP
#include "guiengine/screen.hpp"
/**
* \brief Screen shown when a feature has been unlocked
* \ingroup states_screens
*/
class CutSceneGeneral : public GUIEngine::CutsceneScreen,
public GUIEngine::ScreenSingleton<CutSceneGeneral>
{
friend class GUIEngine::ScreenSingleton<CutSceneGeneral>;
CutSceneGeneral();
public:
virtual void onCutsceneEnd() OVERRIDE {};
/** \brief implement optional callback from parent class GUIEngine::Screen */
void onUpdate(float dt) OVERRIDE {};
/** \brief implement callback from parent class GUIEngine::Screen */
virtual void loadedFromFile() OVERRIDE;
/** \brief implement callback from parent class GUIEngine::Screen */
void init() OVERRIDE;
/** \brief implement callback from parent class GUIEngine::Screen */
void tearDown() OVERRIDE;
void eventCallback(GUIEngine::Widget* widget, const std::string& name,
const int playerID) OVERRIDE;
/** override from base class to handle escape press */
virtual bool onEscapePressed() OVERRIDE;
};
#endif

View File

@ -165,7 +165,7 @@ FeatureUnlockedCutScene::UnlockedThing::~UnlockedThing()
#endif
FeatureUnlockedCutScene::FeatureUnlockedCutScene()
: CutsceneScreen("feature_unlocked.stkgui")
: CutsceneScreen("cutscene.stkgui")
{
m_key_angle = 0;
} // FeatureUnlockedCutScene

View File

@ -42,6 +42,7 @@
#include "online/request_manager.hpp"
#include "states_screens/addons_screen.hpp"
#include "states_screens/credits.hpp"
#include "states_screens/cutscene_general.hpp"
#include "states_screens/grand_prix_editor_screen.hpp"
#include "states_screens/help_screen_1.hpp"
#include "states_screens/offline_kart_selection.hpp"
@ -381,6 +382,9 @@ void MainMenuScreen::eventCallback(Widget* widget, const std::string& name,
parts.push_back("introcutscene2");
((CutsceneWorld*)World::getWorld())->setParts(parts);
//race_manager->startSingleRace("introcutscene2", 999, false);
CutSceneGeneral* scene = CutSceneGeneral::getInstance();
scene->push();
return;
}
else if (selection == "test_outro")
@ -396,6 +400,9 @@ void MainMenuScreen::eventCallback(Widget* widget, const std::string& name,
std::vector<std::string> parts;
parts.push_back("endcutscene");
((CutsceneWorld*)World::getWorld())->setParts(parts);
CutSceneGeneral* scene = CutSceneGeneral::getInstance();
scene->push();
}
else
#endif
@ -494,6 +501,9 @@ void MainMenuScreen::eventCallback(Widget* widget, const std::string& name,
parts.push_back("introcutscene2");
((CutsceneWorld*)World::getWorld())->setParts(parts);
//race_manager->startSingleRace("introcutscene2", 999, false);
CutSceneGeneral* scene = CutSceneGeneral::getInstance();
scene->push();
return;
}
else

View File

@ -55,6 +55,7 @@
#include "replay/replay_play.hpp"
#include "replay/replay_recorder.hpp"
#include "scriptengine/property_animator.hpp"
#include "states_screens/cutscene_general.hpp"
#include "states_screens/feature_unlocked.hpp"
#include "states_screens/main_menu_screen.hpp"
#include "states_screens/online/networking_lobby.hpp"
@ -376,6 +377,9 @@ void RaceResultGUI::eventCallback(GUIEngine::Widget* widget,
std::vector<std::string> parts;
parts.push_back("endcutscene");
((CutsceneWorld*)World::getWorld())->setParts(parts);
CutSceneGeneral* scene = CutSceneGeneral::getInstance();
scene->push();
}
else
{