No more crash on end of GP (nothing useful show yet)
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@4784 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
6cba2be139
commit
a148a2f46b
5
data/gui/grand_prix_over.stkgui
Normal file
5
data/gui/grand_prix_over.stkgui
Normal file
@ -0,0 +1,5 @@
|
||||
<stkgui>
|
||||
|
||||
<button id="continue" x="20" y="-40" width="250" height="35" align="left" text="Continue"/>
|
||||
|
||||
</stkgui>
|
@ -282,6 +282,8 @@ supertuxkart_SOURCES = \
|
||||
states_screens/arenas_screen.hpp \
|
||||
states_screens/feature_unlocked.cpp \
|
||||
states_screens/feature_unlocked.hpp \
|
||||
states_screens/grand_prix_over.cpp \
|
||||
states_screens/grand_prix_over.hpp \
|
||||
states_screens/help_screen_1.cpp \
|
||||
states_screens/help_screen_1.hpp \
|
||||
states_screens/help_screen_2.cpp \
|
||||
|
@ -268,6 +268,7 @@
|
||||
958D8C54104F523000A81934 /* race_paused_dialog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 958D8C53104F523000A81934 /* race_paused_dialog.cpp */; };
|
||||
959482D310EBC0790031BADF /* track_object_manager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 959482CF10EBC0790031BADF /* track_object_manager.cpp */; };
|
||||
959482D410EBC0790031BADF /* track_object.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 959482D110EBC0790031BADF /* track_object.cpp */; };
|
||||
959D42FD1130C4F2005077E2 /* grand_prix_over.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 959D42FB1130C4F2005077E2 /* grand_prix_over.cpp */; };
|
||||
95B5CD14102DE08F00EF2001 /* device_config.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95B5CD13102DE08F00EF2001 /* device_config.cpp */; };
|
||||
95C77D631069589B0080838E /* ambient_light_sphere.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C77D621069589B0080838E /* ambient_light_sphere.cpp */; };
|
||||
95C77D66106958A50080838E /* check_line.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C77D65106958A50080838E /* check_line.cpp */; };
|
||||
@ -494,6 +495,8 @@
|
||||
959482D010EBC0790031BADF /* track_object_manager.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = track_object_manager.hpp; path = ../../tracks/track_object_manager.hpp; sourceTree = SOURCE_ROOT; };
|
||||
959482D110EBC0790031BADF /* track_object.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = track_object.cpp; path = ../../tracks/track_object.cpp; sourceTree = SOURCE_ROOT; };
|
||||
959482D210EBC0790031BADF /* track_object.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = track_object.hpp; path = ../../tracks/track_object.hpp; sourceTree = SOURCE_ROOT; };
|
||||
959D42FB1130C4F2005077E2 /* grand_prix_over.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = grand_prix_over.cpp; path = ../../states_screens/grand_prix_over.cpp; sourceTree = SOURCE_ROOT; };
|
||||
959D42FC1130C4F2005077E2 /* grand_prix_over.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = grand_prix_over.hpp; path = ../../states_screens/grand_prix_over.hpp; sourceTree = SOURCE_ROOT; };
|
||||
95A118290F77EA3100B18B3D /* input.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = input.hpp; path = ../../input/input.hpp; sourceTree = SOURCE_ROOT; };
|
||||
95A1182A0F77EA3100B18B3D /* input_manager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = input_manager.cpp; path = ../../input/input_manager.cpp; sourceTree = SOURCE_ROOT; };
|
||||
95A1182B0F77EA3100B18B3D /* input_manager.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = input_manager.hpp; path = ../../input/input_manager.hpp; sourceTree = SOURCE_ROOT; };
|
||||
@ -1313,6 +1316,8 @@
|
||||
958330C310122B4A00C5137E /* credits.hpp */,
|
||||
95D2343E1078227A00625256 /* feature_unlocked.cpp */,
|
||||
95D2343D1078227A00625256 /* feature_unlocked.hpp */,
|
||||
959D42FB1130C4F2005077E2 /* grand_prix_over.cpp */,
|
||||
959D42FC1130C4F2005077E2 /* grand_prix_over.hpp */,
|
||||
9522F1DE10795E8A0067ECF5 /* help_screen_1.cpp */,
|
||||
9522F1DF10795E8A0067ECF5 /* help_screen_1.hpp */,
|
||||
9522F1E210795EFF0067ECF5 /* help_screen_2.cpp */,
|
||||
@ -2613,6 +2618,7 @@
|
||||
956C6ED51128D3FB004336C8 /* end_controller.cpp in Sources */,
|
||||
956C6ED61128D3FB004336C8 /* new_ai_controller.cpp in Sources */,
|
||||
956C6ED71128D3FB004336C8 /* player_controller.cpp in Sources */,
|
||||
959D42FD1130C4F2005077E2 /* grand_prix_over.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -24,8 +24,6 @@
|
||||
#include "challenges/unlock_manager.hpp"
|
||||
#include "config/user_config.hpp"
|
||||
#include "config/stk_config.hpp"
|
||||
#include "states_screens/kart_selection.hpp"
|
||||
#include "states_screens/state_manager.hpp"
|
||||
#include "input/device_manager.hpp"
|
||||
#include "input/input_manager.hpp"
|
||||
#include "karts/kart_properties_manager.hpp"
|
||||
@ -35,6 +33,10 @@
|
||||
#include "modes/world.hpp"
|
||||
#include "modes/three_strikes_battle.hpp"
|
||||
#include "network/network_manager.hpp"
|
||||
#include "states_screens/grand_prix_over.hpp"
|
||||
#include "states_screens/kart_selection.hpp"
|
||||
#include "states_screens/main_menu_screen.hpp"
|
||||
#include "states_screens/state_manager.hpp"
|
||||
#include "tracks/track_manager.hpp"
|
||||
|
||||
RaceManager* race_manager= NULL;
|
||||
@ -360,8 +362,9 @@ void RaceManager::exitRace()
|
||||
delete []race_time;
|
||||
|
||||
unlock_manager->grandPrixFinished();
|
||||
// TODO - Grand Prix ending
|
||||
// menu_manager->switchToGrandPrixEnding();
|
||||
|
||||
StateManager::get()->resetAndGoToScreen( MainMenuScreen::getInstance() );
|
||||
StateManager::get()->pushScreen ( GrandPrixOver::getInstance() );
|
||||
}
|
||||
|
||||
delete World::getWorld();
|
||||
|
@ -290,6 +290,8 @@ void startGame(const std::string trackIdent, const int num_laps)
|
||||
|
||||
if (num_laps != -1) race_manager->setNumLaps( num_laps );
|
||||
|
||||
race_manager->setMajorMode(RaceManager::MAJOR_MODE_SINGLE);
|
||||
|
||||
race_manager->setCoinTarget( 0 ); // Might still be set from a previous challenge
|
||||
//race_manager->setNumKarts( 1 );
|
||||
network_manager->setupPlayerKartInfo();
|
||||
|
111
src/states_screens/grand_prix_over.cpp
Normal file
111
src/states_screens/grand_prix_over.cpp
Normal file
@ -0,0 +1,111 @@
|
||||
|
||||
#include "states_screens/grand_prix_over.hpp"
|
||||
|
||||
|
||||
#include "guiengine/engine.hpp"
|
||||
#include "io/file_manager.hpp"
|
||||
#include "items/item_manager.hpp"
|
||||
#include "states_screens/state_manager.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
|
||||
#include <SColor.h>
|
||||
|
||||
using namespace irr::core;
|
||||
using namespace irr::gui;
|
||||
using namespace irr::video;
|
||||
|
||||
// -------------------------------------------------------------------------------------
|
||||
|
||||
GrandPrixOver::GrandPrixOver() : Screen("grand_prix_over.stkgui")
|
||||
{
|
||||
setNeeds3D(true);
|
||||
|
||||
throttleFPS = false;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------
|
||||
|
||||
void GrandPrixOver::init()
|
||||
{
|
||||
m_sky_angle = 0.0f;
|
||||
m_global_time = 0.0f;
|
||||
|
||||
//m_sky = irr_driver->addSkyDome(file_manager->getTextureFile("lscales.png"), 16 /* hori_res */, 16 /* vert_res */,
|
||||
// 1.0f /* texture_percent */, 2.0f /* sphere_percent */);
|
||||
|
||||
std::vector<std::string> texture_names(6);
|
||||
texture_names[0] = file_manager->getTextureFile("purplenebula.png");
|
||||
texture_names[1] = file_manager->getTextureFile("purplenebula2.png");
|
||||
texture_names[2] = file_manager->getTextureFile("purplenebula.png");
|
||||
texture_names[3] = file_manager->getTextureFile("purplenebula2.png");
|
||||
texture_names[4] = file_manager->getTextureFile("purplenebula.png");
|
||||
texture_names[5] = file_manager->getTextureFile("purplenebula2.png");
|
||||
m_sky = irr_driver->addSkyBox(texture_names);
|
||||
|
||||
m_camera = irr_driver->addCameraSceneNode();
|
||||
m_camera->setPosition( core::vector3df(0.0, 30.0f, 70.0f) );
|
||||
m_camera->setUpVector( core::vector3df(0.0, 1.0, 0.0) );
|
||||
m_camera->setTarget( core::vector3df(0, 10, 0.0f) );
|
||||
m_camera->setFOV( DEGREE_TO_RAD*50.0f );
|
||||
m_camera->updateAbsolutePosition();
|
||||
|
||||
irr_driver->getSceneManager()->setAmbientLight(video::SColor(255, 120, 120, 120));
|
||||
|
||||
const core::vector3df &sun_pos = core::vector3df( 0, 200, 100.0f );
|
||||
m_light = irr_driver->getSceneManager()->addLightSceneNode(NULL, sun_pos, video::SColorf(1.0f,1.0f,1.0f), 10000.0f /* radius */);
|
||||
m_light->getLightData().DiffuseColor = irr::video::SColorf(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
m_light->getLightData().SpecularColor = irr::video::SColorf(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------
|
||||
|
||||
void GrandPrixOver::tearDown()
|
||||
{
|
||||
irr_driver->removeNode(m_sky);
|
||||
m_sky = NULL;
|
||||
|
||||
irr_driver->removeCameraSceneNode(m_camera);
|
||||
m_camera = NULL;
|
||||
|
||||
irr_driver->removeNode(m_light);
|
||||
m_light = NULL;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------
|
||||
|
||||
void GrandPrixOver::onUpdate(float dt, irr::video::IVideoDriver* driver)
|
||||
{
|
||||
m_global_time += dt;
|
||||
|
||||
m_sky_angle += dt*2;
|
||||
if (m_sky_angle > 360) m_sky_angle -= 360;
|
||||
m_sky->setRotation( core::vector3df(0, m_sky_angle, 0) );
|
||||
|
||||
|
||||
static const int w = irr_driver->getFrameSize().Width;
|
||||
static const int h = irr_driver->getFrameSize().Height;
|
||||
const irr::video::SColor color(255, 255, 255, 255);
|
||||
|
||||
static int test_y = 0;
|
||||
|
||||
GUIEngine::getTitleFont()->draw(_("Grand Prix Results"),
|
||||
core::rect< s32 >( 0, test_y, w, h/10 ),
|
||||
color,
|
||||
true/* center h */, true /* center v */ );
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------
|
||||
|
||||
void GrandPrixOver::eventCallback(GUIEngine::Widget* widget,
|
||||
const std::string& name,
|
||||
const int playerID)
|
||||
{
|
||||
if (name == "continue")
|
||||
{
|
||||
// we assume the main menu was pushed before showing this menu
|
||||
StateManager::get()->popMenu();
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------
|
39
src/states_screens/grand_prix_over.hpp
Normal file
39
src/states_screens/grand_prix_over.hpp
Normal file
@ -0,0 +1,39 @@
|
||||
#ifndef HEADER_GRAND_PRIX_OVER_HPP
|
||||
#define HEADER_GRAND_PRIX_OVER_HPP
|
||||
|
||||
#include "guiengine/screen.hpp"
|
||||
|
||||
namespace irr { namespace scene { class ISceneNode; class ICameraSceneNode; class ILightSceneNode; } }
|
||||
class KartProperties;
|
||||
|
||||
|
||||
class GrandPrixOver : public GUIEngine::Screen, public GUIEngine::ScreenSingleton<GrandPrixOver>
|
||||
{
|
||||
friend class GUIEngine::ScreenSingleton<GrandPrixOver>;
|
||||
|
||||
GrandPrixOver();
|
||||
|
||||
/** sky angle, 0-360 */
|
||||
float m_sky_angle;
|
||||
|
||||
/** Global evolution of time */
|
||||
double m_global_time;
|
||||
|
||||
|
||||
irr::scene::ISceneNode* m_sky;
|
||||
irr::scene::ICameraSceneNode* m_camera;
|
||||
|
||||
irr::scene::ILightSceneNode* m_light;
|
||||
public:
|
||||
|
||||
void onUpdate(float dt, irr::video::IVideoDriver*);
|
||||
|
||||
void init();
|
||||
void tearDown();
|
||||
|
||||
void eventCallback(GUIEngine::Widget* widget, const std::string& name, const int playerID);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user