Create new world type for overworld for customized behavior. Hide overworld in track seelciton screen. Launch overworld when clicking on story mode button.
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@10443 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
9eb21b24d0
commit
92b077a250
File diff suppressed because one or more lines are too long
@ -335,6 +335,7 @@
|
||||
958D8C54104F523000A81934 /* race_paused_dialog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 958D8C53104F523000A81934 /* race_paused_dialog.cpp */; };
|
||||
958D924213DA48A70097BC82 /* post_processing.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 958D924013DA48A70097BC82 /* post_processing.cpp */; };
|
||||
9592DC6D13021B350039DBC8 /* minimal_race_gui.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9592DC6B13021B350039DBC8 /* minimal_race_gui.cpp */; };
|
||||
9593366B149EC9B10031FD41 /* overworld.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95933669149EC9B10031FD41 /* overworld.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 */; };
|
||||
9598A5B613CFBA83000B83EA /* hardware_skinning.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9598A5B413CFBA83000B83EA /* hardware_skinning.cpp */; };
|
||||
@ -1132,6 +1133,8 @@
|
||||
958D924113DA48A70097BC82 /* post_processing.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = post_processing.hpp; path = ../../graphics/post_processing.hpp; sourceTree = SOURCE_ROOT; };
|
||||
9592DC6B13021B350039DBC8 /* minimal_race_gui.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = minimal_race_gui.cpp; path = ../../states_screens/minimal_race_gui.cpp; sourceTree = SOURCE_ROOT; };
|
||||
9592DC6C13021B350039DBC8 /* minimal_race_gui.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = minimal_race_gui.hpp; path = ../../states_screens/minimal_race_gui.hpp; sourceTree = SOURCE_ROOT; };
|
||||
95933669149EC9B10031FD41 /* overworld.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = overworld.cpp; path = ../../modes/overworld.cpp; sourceTree = SOURCE_ROOT; };
|
||||
9593366A149EC9B10031FD41 /* overworld.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = overworld.hpp; path = ../../modes/overworld.hpp; sourceTree = SOURCE_ROOT; };
|
||||
959482CF10EBC0790031BADF /* track_object_manager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = track_object_manager.cpp; path = ../../tracks/track_object_manager.cpp; sourceTree = SOURCE_ROOT; };
|
||||
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; };
|
||||
@ -2538,6 +2541,8 @@
|
||||
95C2B14B0F296545000D3E5D /* follow_the_leader.hpp */,
|
||||
95C2B14C0F296545000D3E5D /* linear_world.cpp */,
|
||||
95C2B14D0F296545000D3E5D /* linear_world.hpp */,
|
||||
95933669149EC9B10031FD41 /* overworld.cpp */,
|
||||
9593366A149EC9B10031FD41 /* overworld.hpp */,
|
||||
952A1552103F68D000B1895D /* profile_world.cpp */,
|
||||
952A1553103F68D000B1895D /* profile_world.hpp */,
|
||||
95C2B14E0F296545000D3E5D /* standard_race.cpp */,
|
||||
@ -3201,6 +3206,7 @@
|
||||
95E5C318148C17E500AD3FCC /* story_mode_lobby.cpp in Sources */,
|
||||
95E5C335148C19F500AD3FCC /* story_mode_new.cpp in Sources */,
|
||||
95E5C3C2148C418100AD3FCC /* game_slot.cpp in Sources */,
|
||||
9593366B149EC9B10031FD41 /* overworld.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -58,6 +58,7 @@ void LinearWorld::init()
|
||||
m_last_lap_sfx_played = false;
|
||||
m_last_lap_sfx_playing = false;
|
||||
const unsigned int kart_amount = m_karts.size();
|
||||
|
||||
m_kart_display_info = new RaceGUIBase::KartIconDisplayInfo[kart_amount];
|
||||
|
||||
for(unsigned int n=0; n<kart_amount; n++)
|
||||
|
@ -103,7 +103,7 @@ protected:
|
||||
* It may need to do some specific world before calling the generic Kart::forceRescue
|
||||
*/
|
||||
void rescueKartAfterShortcut(Kart* kart, KartInfo& kart_info);
|
||||
void checkForWrongDirection(unsigned int i);
|
||||
virtual void checkForWrongDirection(unsigned int i);
|
||||
void updateRacePosition();
|
||||
virtual float estimateFinishTimeForKart(Kart* kart);
|
||||
|
||||
|
59
src/modes/overworld.cpp
Normal file
59
src/modes/overworld.cpp
Normal file
@ -0,0 +1,59 @@
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2004 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 "modes/overworld.hpp"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
OverWorld::OverWorld() : LinearWorld()
|
||||
{
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Actually initialises the world, i.e. creates all data structures to
|
||||
* for all karts etc. In init functions can be called that use
|
||||
* World::getWorld().
|
||||
*/
|
||||
void OverWorld::init()
|
||||
{
|
||||
LinearWorld::init();
|
||||
} // init
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
OverWorld::~OverWorld()
|
||||
{
|
||||
} // ~OverWorld
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** General update function called once per frame.
|
||||
* \param dt Time step size.
|
||||
*/
|
||||
void OverWorld::update(float dt)
|
||||
{
|
||||
LinearWorld::update(dt);
|
||||
} // update
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Override the base class method to change behavior. We don't want wrong
|
||||
* direction messages in the overworld since there is no direction there.
|
||||
* \param i Kart id.
|
||||
*/
|
||||
void OverWorld::checkForWrongDirection(unsigned int i)
|
||||
{
|
||||
} // checkForWrongDirection
|
||||
|
||||
//-----------------------------------------------------------------------------
|
60
src/modes/overworld.hpp
Normal file
60
src/modes/overworld.hpp
Normal file
@ -0,0 +1,60 @@
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2004 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 HEADER_OVERWORLD_HPP
|
||||
#define HEADER_OVERWORLD_HPP
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "modes/linear_world.hpp"
|
||||
#include "utils/aligned_array.hpp"
|
||||
|
||||
|
||||
/*
|
||||
* The overworld map where challenges are played.
|
||||
* \note This mode derives from LinearWorld to get support for drivelines,
|
||||
* minimap and rescue, even though this world is not technically
|
||||
* linear.
|
||||
* \ingroup modes
|
||||
*/
|
||||
class OverWorld : public LinearWorld
|
||||
{
|
||||
|
||||
public:
|
||||
OverWorld();
|
||||
/** call just after instanciating. can't be moved to the contructor as child
|
||||
classes must be instanciated, otherwise polymorphism will fail and the
|
||||
results will be incorrect */
|
||||
virtual void init();
|
||||
virtual ~OverWorld();
|
||||
|
||||
virtual void update(float delta);
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns if this race mode has laps. */
|
||||
virtual bool raceHasLaps(){ return false; }
|
||||
// ------------------------------------------------------------------------
|
||||
virtual void checkForWrongDirection(unsigned int i);
|
||||
// ------------------------------------------------------------------------
|
||||
/** The overworld is not a race per se so it's never over */
|
||||
virtual bool isRaceOver() { return false; }
|
||||
// ------------------------------------------------------------------------
|
||||
virtual const std::string&
|
||||
getIdent() const { return IDENT_OVERWORLD; }
|
||||
};
|
||||
|
||||
#endif
|
@ -28,6 +28,7 @@
|
||||
#include "input/input_manager.hpp"
|
||||
#include "karts/kart_properties_manager.hpp"
|
||||
#include "modes/follow_the_leader.hpp"
|
||||
#include "modes/overworld.hpp"
|
||||
#include "modes/profile_world.hpp"
|
||||
#include "modes/standard_race.hpp"
|
||||
#include "modes/world.hpp"
|
||||
@ -353,6 +354,8 @@ void RaceManager::startNextRace()
|
||||
World::setWorld(new StandardRace());
|
||||
else if(m_minor_mode==MINOR_MODE_3_STRIKES)
|
||||
World::setWorld(new ThreeStrikesBattle());
|
||||
else if(m_minor_mode==MINOR_MODE_OVERWORLD)
|
||||
World::setWorld(new OverWorld());
|
||||
else
|
||||
{
|
||||
fprintf(stderr,"Could not create given race mode\n");
|
||||
|
@ -41,6 +41,7 @@ static const std::string IDENT_STD ("STANDARD" );
|
||||
static const std::string IDENT_TTRIAL ("STD_TIMETRIAL" );
|
||||
static const std::string IDENT_FTL ("FOLLOW_LEADER" );
|
||||
static const std::string IDENT_STRIKES ("BATTLE_3_STRIKES");
|
||||
static const std::string IDENT_OVERWORLD("OVERWORLD" );
|
||||
|
||||
/**
|
||||
* The race manager has two functions:
|
||||
@ -99,6 +100,7 @@ public:
|
||||
MINOR_MODE_NORMAL_RACE = LINEAR_RACE(0, true),
|
||||
MINOR_MODE_TIME_TRIAL = LINEAR_RACE(1, true),
|
||||
MINOR_MODE_FOLLOW_LEADER = LINEAR_RACE(2, false),
|
||||
MINOR_MODE_OVERWORLD = LINEAR_RACE(3, false),
|
||||
|
||||
MINOR_MODE_3_STRIKES = BATTLE_ARENA(0)
|
||||
};
|
||||
|
@ -32,6 +32,8 @@
|
||||
#include "io/file_manager.hpp"
|
||||
#include "karts/kart_properties_manager.hpp"
|
||||
#include "main_loop.hpp"
|
||||
#include "modes/overworld.hpp"
|
||||
#include "network/network_manager.hpp"
|
||||
#include "states_screens/addons_screen.hpp"
|
||||
#include "states_screens/challenges.hpp"
|
||||
#include "states_screens/credits.hpp"
|
||||
@ -282,7 +284,33 @@ void MainMenuScreen::eventCallback(Widget* widget, const std::string& name,
|
||||
}
|
||||
else if (selection == "story")
|
||||
{
|
||||
/*
|
||||
StateManager::get()->pushScreen(ChallengesScreen::getInstance());
|
||||
*/
|
||||
|
||||
race_manager->setNumLocalPlayers(1);
|
||||
race_manager->setMajorMode (RaceManager::MAJOR_MODE_SINGLE);
|
||||
race_manager->setMinorMode (RaceManager::MINOR_MODE_OVERWORLD);
|
||||
race_manager->setNumKarts( 1 );
|
||||
race_manager->setTrack( "overworld" );
|
||||
race_manager->setDifficulty(RaceManager::RD_HARD);
|
||||
|
||||
// Use keyboard 0 by default (FIXME: let player choose?)
|
||||
InputDevice* device = input_manager->getDeviceList()->getKeyboard(0);
|
||||
|
||||
// Create player and associate player with keyboard
|
||||
StateManager::get()->createActivePlayer(
|
||||
UserConfigParams::m_all_players.get(0), device );
|
||||
|
||||
race_manager->setLocalKartInfo(0, "tux");
|
||||
|
||||
// ASSIGN should make sure that only input from assigned devices
|
||||
// is read.
|
||||
input_manager->getDeviceList()->setAssignMode(ASSIGN);
|
||||
|
||||
StateManager::get()->enterGameState();
|
||||
network_manager->setupPlayerKartInfo();
|
||||
race_manager->startNew();
|
||||
}
|
||||
else if (selection == "tutorial")
|
||||
{
|
||||
|
@ -303,6 +303,7 @@ void TracksScreen::buildTrackList()
|
||||
{
|
||||
Track* curr = track_manager->getTrack( n );
|
||||
if (curr->isArena()) continue;
|
||||
if (curr->isInternal()) continue;
|
||||
|
||||
if (unlock_manager->getCurrentSlot()->isLocked(curr->getIdent()))
|
||||
{
|
||||
@ -328,6 +329,7 @@ void TracksScreen::buildTrackList()
|
||||
{
|
||||
Track* curr = track_manager->getTrack( curr_group[n] );
|
||||
if (curr->isArena()) continue;
|
||||
if (curr->isInternal()) continue;
|
||||
|
||||
if (unlock_manager->getCurrentSlot()->isLocked(curr->getIdent()))
|
||||
{
|
||||
|
@ -80,6 +80,7 @@ Track::Track(const std::string &filename)
|
||||
m_version = 0;
|
||||
m_track_mesh = NULL;
|
||||
m_gfx_effect_mesh = NULL;
|
||||
m_internal = false;
|
||||
m_all_nodes.clear();
|
||||
m_all_cached_meshes.clear();
|
||||
m_is_arena = false;
|
||||
@ -291,6 +292,7 @@ void Track::loadTrackInfo()
|
||||
root->get("gravity", &m_gravity);
|
||||
root->get("arena", &m_is_arena);
|
||||
root->get("groups", &m_groups);
|
||||
root->get("internal", &m_internal);
|
||||
|
||||
for(unsigned int i=0; i<root->getNumNodes(); i++)
|
||||
{
|
||||
|
@ -139,6 +139,10 @@ private:
|
||||
int m_version;
|
||||
/** Far value for cameras for this track. */
|
||||
float m_camera_far;
|
||||
/** Whether this is an "internal" track. If so it won't be offered
|
||||
* in the track seelction screen
|
||||
*/
|
||||
bool m_internal;
|
||||
|
||||
/** The type of sky to be used for the track. */
|
||||
enum {SKY_NONE, SKY_BOX,
|
||||
@ -386,6 +390,10 @@ public:
|
||||
|
||||
CheckManager* getCheckManager() { return m_check_manager; }
|
||||
|
||||
/** Whether this is an "internal" track. If so it won't be offered
|
||||
* in the track seelction screen
|
||||
*/
|
||||
bool isInternal() const { return m_internal; }
|
||||
|
||||
core::vector3df getSunRotation();
|
||||
|
||||
|
@ -180,6 +180,9 @@ bool TrackManager::loadTrack(const std::string& dirname)
|
||||
void TrackManager::removeTrack(const std::string &ident)
|
||||
{
|
||||
Track *track = getTrack(ident);
|
||||
|
||||
if (track->isInternal()) return;
|
||||
|
||||
std::vector<Track*>::iterator it = std::find(m_tracks.begin(),
|
||||
m_tracks.end(), track);
|
||||
assert(it!=m_tracks.end());
|
||||
@ -239,6 +242,8 @@ void TrackManager::removeTrack(const std::string &ident)
|
||||
*/
|
||||
void TrackManager::updateGroups(const Track* track)
|
||||
{
|
||||
if (track->isInternal()) return;
|
||||
|
||||
const std::vector<std::string>& new_groups = track->getGroups();
|
||||
|
||||
Group2Indices &group_2_indices = track->isArena() ? m_arena_groups
|
||||
|
Loading…
Reference in New Issue
Block a user