Make OverWorld be derived from World
This commit is contained in:
@@ -39,7 +39,7 @@
|
||||
#include "tracks/track_object_manager.hpp"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
OverWorld::OverWorld() : WorldWithRank()
|
||||
OverWorld::OverWorld() : World()
|
||||
{
|
||||
m_return_to_garage = false;
|
||||
m_stop_music_when_dialog_open = false;
|
||||
@@ -118,8 +118,8 @@ void OverWorld::update(float dt)
|
||||
music_manager->startMusic();
|
||||
m_karts[0]->startEngineSFX();
|
||||
}
|
||||
WorldWithRank::update(dt);
|
||||
WorldWithRank::updateTrack(dt);
|
||||
World::update(dt);
|
||||
World::updateTrack(dt);
|
||||
const unsigned int kart_amount = (unsigned int)m_karts.size();
|
||||
|
||||
// isn't it cool, on the overworld nitro is free!
|
||||
@@ -269,7 +269,7 @@ void OverWorld::onMouseClick(int x, int y)
|
||||
if(challenge)
|
||||
{
|
||||
// Use the 'get closest start point' rescue function
|
||||
// from WorldWithRank by setting the kart's position to
|
||||
// from World by setting the kart's position to
|
||||
// be the location of the challenge bubble.
|
||||
AbstractKart* kart = getKart(0);
|
||||
kart->setXYZ(challenge->m_position);
|
||||
|
||||
@@ -20,19 +20,18 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "modes/world_with_rank.hpp"
|
||||
#include "modes/world.hpp"
|
||||
#include "utils/aligned_array.hpp"
|
||||
|
||||
#include "LinearMath/btTransform.h"
|
||||
|
||||
/*
|
||||
* 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.
|
||||
* \note Extends world to make a simple world where karts can drive around,
|
||||
* it adds challenges and starting of races.
|
||||
* \ingroup modes
|
||||
*/
|
||||
class OverWorld : public WorldWithRank
|
||||
class OverWorld : public World
|
||||
{
|
||||
protected:
|
||||
|
||||
|
||||
@@ -95,27 +95,27 @@ public:
|
||||
ThreeStrikesBattle();
|
||||
virtual ~ThreeStrikesBattle();
|
||||
|
||||
virtual void init();
|
||||
virtual void init() OVERRIDE;
|
||||
|
||||
// clock events
|
||||
virtual bool isRaceOver();
|
||||
virtual void terminateRace();
|
||||
virtual bool isRaceOver() OVERRIDE;
|
||||
virtual void terminateRace() OVERRIDE;
|
||||
|
||||
// overriding World methods
|
||||
virtual void reset();
|
||||
virtual void reset() OVERRIDE;
|
||||
|
||||
//virtual void getDefaultCollectibles(int& collectible_type, int& amount);
|
||||
virtual bool useFastMusicNearEnd() const { return false; }
|
||||
virtual bool useFastMusicNearEnd() const OVERRIDE { return false; }
|
||||
virtual void getKartsDisplayInfo(
|
||||
std::vector<RaceGUIBase::KartIconDisplayInfo> *info);
|
||||
virtual bool raceHasLaps(){ return false; }
|
||||
std::vector<RaceGUIBase::KartIconDisplayInfo> *info) OVERRIDE;
|
||||
virtual bool raceHasLaps() OVERRIDE { return false; }
|
||||
|
||||
virtual const std::string& getIdent() const;
|
||||
virtual const std::string& getIdent() const OVERRIDE;
|
||||
|
||||
virtual void kartHit(const unsigned int kart_id);
|
||||
virtual void update(float dt);
|
||||
virtual void kartHit(const unsigned int kart_id) OVERRIDE;
|
||||
virtual void update(float dt) OVERRIDE;
|
||||
|
||||
virtual void kartAdded(AbstractKart* kart, scene::ISceneNode* node);
|
||||
virtual void kartAdded(AbstractKart* kart, scene::ISceneNode* node) OVERRIDE;
|
||||
virtual void enterRaceOverState() OVERRIDE;
|
||||
|
||||
int getKartNode(unsigned int kart_id) const;
|
||||
|
||||
@@ -1237,20 +1237,36 @@ void World::unpause()
|
||||
void World::delayedSelfDestruct()
|
||||
{
|
||||
m_self_destruct = true;
|
||||
}
|
||||
} // delayedSelfDestruct
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void World::escapePressed()
|
||||
{
|
||||
new RacePausedDialog(0.8f, 0.6f);
|
||||
}
|
||||
} // escapePressed
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
bool World::isFogEnabled() const
|
||||
{
|
||||
return !m_force_disable_fog && (m_track != NULL && m_track->isFogEnabled());
|
||||
}
|
||||
} // isFogEnabled
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Returns the start transform with the give index.
|
||||
* \param rescue_pos Index of the start position to be returned.
|
||||
* \returns The transform of the corresponding start position.
|
||||
*/
|
||||
btTransform World::getRescueTransform(unsigned int rescue_pos) const
|
||||
{
|
||||
return m_track->getStartTransform(rescue_pos);
|
||||
} // getRescueTransform
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Uses the start position as rescue positions, override if necessary
|
||||
*/
|
||||
unsigned int World::getNumberOfRescuePositions() const
|
||||
{
|
||||
return m_track->getNumberOfStartPositions();
|
||||
} // getNumberOfRescuePositions
|
||||
|
||||
/* EOF */
|
||||
|
||||
@@ -221,13 +221,13 @@ public:
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the number of rescue positions on a given track and game
|
||||
* mode. */
|
||||
virtual unsigned int getNumberOfRescuePositions() const = 0;
|
||||
virtual unsigned int getNumberOfRescuePositions() const;
|
||||
// ------------------------------------------------------------------------
|
||||
/** Determines the rescue position index of the specified kart. */
|
||||
virtual unsigned int getRescuePositionIndex(AbstractKart *kart) = 0;
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the bullet transformation for the specified rescue index. */
|
||||
virtual btTransform getRescueTransform(unsigned int index) const = 0;
|
||||
virtual btTransform getRescueTransform(unsigned int index) const;
|
||||
// ------------------------------------------------------------------------
|
||||
virtual void moveKartAfterRescue(AbstractKart* kart);
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
@@ -124,16 +124,6 @@ void WorldWithRank::endSetKartPositions()
|
||||
#endif
|
||||
} // endSetKartPositions
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** WorldWithRank uses the start position as rescue positions. So return
|
||||
* the number of start positions.
|
||||
*/
|
||||
unsigned int WorldWithRank::getNumberOfRescuePositions() const
|
||||
{
|
||||
return getTrack()->getNumberOfStartPositions();
|
||||
} // getNumberOfRescuePositions
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Determines the rescue position for a kart. The rescue position is the
|
||||
* start position which is has the biggest accumulated distance to all other
|
||||
@@ -184,16 +174,6 @@ unsigned int WorldWithRank::getRescuePositionIndex(AbstractKart *kart)
|
||||
return furthest_id_found;
|
||||
} // getRescuePositionIndex
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Returns the start transform with the give index.
|
||||
* \param rescue_pos Index of the start position to be returned.
|
||||
* \returns The transform of the corresponding start position.
|
||||
*/
|
||||
btTransform WorldWithRank::getRescueTransform(unsigned int rescue_pos) const
|
||||
{
|
||||
return getTrack()->getStartTransform(rescue_pos);
|
||||
} // getRescueTransform
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Returns the number of points for a kart at a specified position.
|
||||
* \param p Position (starting with 1).
|
||||
|
||||
@@ -71,17 +71,11 @@ public:
|
||||
|
||||
void beginSetKartPositions();
|
||||
bool setKartPosition(unsigned int kart_id,
|
||||
unsigned int position);
|
||||
unsigned int position);
|
||||
void endSetKartPositions();
|
||||
AbstractKart* getKartAtPosition(unsigned int p) const;
|
||||
virtual int getScoreForPosition(int p);
|
||||
|
||||
|
||||
virtual unsigned int getNumberOfRescuePositions() const OVERRIDE;
|
||||
virtual unsigned int getRescuePositionIndex(AbstractKart *kart) OVERRIDE;
|
||||
virtual btTransform getRescueTransform(unsigned int index) const OVERRIDE;
|
||||
|
||||
|
||||
|
||||
}; // WorldWithRank
|
||||
|
||||
|
||||
Reference in New Issue
Block a user