Added support for checklines to be specified by two 3d points
instead of 2d points and the minimum height. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@11125 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
b71a93feb9
commit
5eafaaa918
@ -18,15 +18,16 @@
|
|||||||
|
|
||||||
#include "tracks/check_line.hpp"
|
#include "tracks/check_line.hpp"
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#include "irrlicht.h"
|
|
||||||
|
|
||||||
#include "io/xml_node.hpp"
|
#include "io/xml_node.hpp"
|
||||||
#include "karts/abstract_kart.hpp"
|
#include "karts/abstract_kart.hpp"
|
||||||
#include "modes/world.hpp"
|
#include "modes/world.hpp"
|
||||||
#include "race/race_manager.hpp"
|
#include "race/race_manager.hpp"
|
||||||
|
|
||||||
|
#include "irrlicht.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
/** Constructor for a checkline.
|
/** Constructor for a checkline.
|
||||||
* \param node XML node containing the parameters for this checkline.
|
* \param node XML node containing the parameters for this checkline.
|
||||||
* \param index Index of this check structure in the check manager.
|
* \param index Index of this check structure in the check manager.
|
||||||
@ -38,9 +39,21 @@ CheckLine::CheckLine(const XMLNode &node, unsigned int index)
|
|||||||
// in world, so we can't call world->getNumKarts()
|
// in world, so we can't call world->getNumKarts()
|
||||||
m_previous_sign.resize(race_manager->getNumberOfKarts());
|
m_previous_sign.resize(race_manager->getNumberOfKarts());
|
||||||
core::vector2df p1, p2;
|
core::vector2df p1, p2;
|
||||||
node.get("p1", &p1);
|
if(node.get("p1", &p1) &&
|
||||||
node.get("p2", &p2);
|
node.get("p2", &p2) &&
|
||||||
node.get("min-height", &m_min_height);
|
node.get("min-height", &m_min_height))
|
||||||
|
{
|
||||||
|
m_left_point = Vec3(p1.X, m_min_height, p1.Y);
|
||||||
|
m_right_point = Vec3(p2.X, m_min_height, p2.Y);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
node.get("p1", &m_left_point);
|
||||||
|
p1 = core::vector2df(m_left_point.getX(), m_left_point.getZ());
|
||||||
|
node.get("p2", &m_right_point);
|
||||||
|
p2 = core::vector2df(m_right_point.getX(), m_right_point.getZ());
|
||||||
|
m_min_height = std::min(m_left_point.getY(), m_right_point.getY());
|
||||||
|
}
|
||||||
m_line.setLine(p1, p2);
|
m_line.setLine(p1, p2);
|
||||||
if(UserConfigParams::m_check_debug)
|
if(UserConfigParams::m_check_debug)
|
||||||
{
|
{
|
||||||
|
@ -51,6 +51,11 @@ private:
|
|||||||
/** The minimum height of the checkline. */
|
/** The minimum height of the checkline. */
|
||||||
float m_min_height;
|
float m_min_height;
|
||||||
|
|
||||||
|
/** The actual (or estimated) left and right end points in 3d. This is
|
||||||
|
* used by the cannon. If the xml file stores only the min_height, those
|
||||||
|
* points are set from the 2d points and the min height. */
|
||||||
|
Vec3 m_left_point, m_right_point;
|
||||||
|
|
||||||
/** Stores the sign (i.e. side) of the previous line to save some
|
/** Stores the sign (i.e. side) of the previous line to save some
|
||||||
* computations. True if the value is >=0, i.e. the point is on
|
* computations. True if the value is >=0, i.e. the point is on
|
||||||
* or to the right of the line. */
|
* or to the right of the line. */
|
||||||
|
Loading…
Reference in New Issue
Block a user