Prevent rescuing in soccer mode to go back to self goal immediately
This commit is contained in:
parent
487227630f
commit
1f7f64f3b5
@ -38,6 +38,8 @@
|
||||
#include "network/stk_host.hpp"
|
||||
#include "physics/physics.hpp"
|
||||
#include "states_screens/race_gui_base.hpp"
|
||||
#include "tracks/graph.hpp"
|
||||
#include "tracks/quad.hpp"
|
||||
#include "tracks/track.hpp"
|
||||
#include "tracks/track_object_manager.hpp"
|
||||
#include "tracks/track_sector.hpp"
|
||||
@ -211,10 +213,10 @@ const std::string& SoccerWorld::getIdent() const
|
||||
void SoccerWorld::update(int ticks)
|
||||
{
|
||||
updateBallPosition(ticks);
|
||||
updateSectorForKarts();
|
||||
if (Track::getCurrentTrack()->hasNavMesh() &&
|
||||
!NetworkConfig::get()->isNetworking())
|
||||
{
|
||||
updateSectorForKarts();
|
||||
updateAIData();
|
||||
}
|
||||
|
||||
@ -808,13 +810,26 @@ int SoccerWorld::getTeamNum(SoccerTeam team) const
|
||||
//-----------------------------------------------------------------------------
|
||||
unsigned int SoccerWorld::getRescuePositionIndex(AbstractKart *kart)
|
||||
{
|
||||
std::map<int, unsigned int>::const_iterator n =
|
||||
m_kart_position_map.find(kart->getWorldKartId());
|
||||
|
||||
assert (n != m_kart_position_map.end());
|
||||
return n->second;
|
||||
int last_valid_node =
|
||||
getTrackSector(kart->getWorldKartId())->getLastValidGraphNode();
|
||||
if (last_valid_node >= 0)
|
||||
return last_valid_node;
|
||||
Log::warn("SoccerWorld", "Missing last valid node for rescuing");
|
||||
return 0;
|
||||
} // getRescuePositionIndex
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
btTransform SoccerWorld::getRescueTransform(unsigned int rescue_pos) const
|
||||
{
|
||||
const Vec3 &xyz = Graph::get()->getQuad(rescue_pos)->getCenter();
|
||||
const Vec3 &normal = Graph::get()->getQuad(rescue_pos)->getNormal();
|
||||
btTransform pos;
|
||||
pos.setOrigin(xyz);
|
||||
btQuaternion q1 = shortestArcQuat(Vec3(0.0f, 1.0f, 0.0f), normal);
|
||||
pos.setRotation(q1);
|
||||
return pos;
|
||||
} // getRescueTransform
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void SoccerWorld::enterRaceOverState()
|
||||
{
|
||||
|
@ -329,7 +329,8 @@ public:
|
||||
virtual void reset() OVERRIDE;
|
||||
|
||||
virtual unsigned int getRescuePositionIndex(AbstractKart *kart) OVERRIDE;
|
||||
|
||||
virtual btTransform getRescueTransform(unsigned int rescue_pos) const
|
||||
OVERRIDE;
|
||||
virtual bool useFastMusicNearEnd() const OVERRIDE { return false; }
|
||||
virtual void getKartsDisplayInfo(
|
||||
std::vector<RaceGUIBase::KartIconDisplayInfo> *info) OVERRIDE {}
|
||||
|
@ -74,18 +74,21 @@ void TrackSector::update(const Vec3 &xyz, bool ignore_vertical)
|
||||
prev_sector, test_nodes, ignore_vertical);
|
||||
}
|
||||
|
||||
// ArenaGraph (battle and soccer mode) doesn't need the code below
|
||||
if (ag) return;
|
||||
// Keep the last valid graph node for arena mode
|
||||
if (ag)
|
||||
{
|
||||
if (prev_sector != Graph::UNKNOWN_SECTOR)
|
||||
m_last_valid_graph_node = prev_sector;
|
||||
return;
|
||||
}
|
||||
|
||||
// keep the current quad as the latest valid one IF the player has one
|
||||
// of the required checklines
|
||||
const DriveNode* dn = DriveGraph::get()->getNode(m_current_graph_node);
|
||||
const std::vector<int>& checkline_requirements = dn->getChecklineRequirements();
|
||||
|
||||
bool isValidQuad = false;
|
||||
if (checkline_requirements.size() == 0)
|
||||
{
|
||||
isValidQuad = true;
|
||||
if (m_on_road)
|
||||
m_last_valid_graph_node = m_current_graph_node;
|
||||
}
|
||||
@ -98,7 +101,6 @@ void TrackSector::update(const Vec3 &xyz, bool ignore_vertical)
|
||||
//has_prerequisite = true;
|
||||
if (m_on_road)
|
||||
m_last_valid_graph_node = m_current_graph_node;
|
||||
isValidQuad = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -81,6 +81,8 @@ public:
|
||||
bool isOnRoad() const { return m_on_road; }
|
||||
// ------------------------------------------------------------------------
|
||||
void setLastTriggeredCheckline(int i) { m_last_triggered_checkline = i; }
|
||||
// ------------------------------------------------------------------------
|
||||
int getLastValidGraphNode() const { return m_last_valid_graph_node; }
|
||||
|
||||
}; // TrackSector
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user