1) The number of drivelines per kart is now limited (stk_config.data setting)
2) Reduced smoke effect somewhat (and made it dependent on actually turning the wheel) 3) Removed skid marks when restarting a race. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@2576 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
bf18cd156b
commit
e76c1dc87c
@ -13,6 +13,7 @@
|
|||||||
(menu-background "st_title_screen.rgb")
|
(menu-background "st_title_screen.rgb")
|
||||||
(game-style "nitro") ;; "wheelie" or "nitro"
|
(game-style "nitro") ;; "wheelie" or "nitro"
|
||||||
(max-history 10000) ;; maximum number of history frames.
|
(max-history 10000) ;; maximum number of history frames.
|
||||||
|
(max-skidmarks 100) ;; max. number of skidmarks per kart.
|
||||||
(delay-finish-time 10) ;; delay till race results are displayed.
|
(delay-finish-time 10) ;; delay till race results are displayed.
|
||||||
(music-credit-time 10) ;; time for which the music credits are displayed.
|
(music-credit-time 10) ;; time for which the music credits are displayed.
|
||||||
|
|
||||||
|
@ -27,33 +27,42 @@
|
|||||||
/** Initialises empty skid marks. */
|
/** Initialises empty skid marks. */
|
||||||
SkidMarks::SkidMarks(const Kart& kart, float width) : m_kart(kart)
|
SkidMarks::SkidMarks(const Kart& kart, float width) : m_kart(kart)
|
||||||
{
|
{
|
||||||
m_width = width;
|
m_width = width;
|
||||||
m_skid_state = new ssgSimpleState();
|
m_skid_state = new ssgSimpleState();
|
||||||
m_skid_state->ref();
|
m_skid_state->ref();
|
||||||
m_skid_state->enable(GL_BLEND);
|
m_skid_state->enable(GL_BLEND);
|
||||||
//This is just for the skidmarks, so the ones drawn when the kart is in
|
|
||||||
//reverse get drawn
|
|
||||||
// m_skid_state -> disable (GL_CULL_FACE);
|
|
||||||
m_skid_marking = false;
|
m_skid_marking = false;
|
||||||
|
m_current = -1;
|
||||||
} // SkidMark
|
} // SkidMark
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
/** Removes all skid marks from the scene graph and frees the state. */
|
||||||
SkidMarks::~SkidMarks()
|
SkidMarks::~SkidMarks()
|
||||||
{
|
{
|
||||||
#ifdef NOTYET
|
reset(); // remove all skid marks
|
||||||
if(!m_skid_marks.empty())
|
|
||||||
{
|
|
||||||
const unsigned int SIZE = (unsigned int)m_skid_marks.size() -1;
|
|
||||||
for(unsigned int i = 0; i < SIZE; ++i)
|
|
||||||
{
|
|
||||||
ssgDeRefDelete(m_skid_marks[i]);
|
|
||||||
} // for
|
|
||||||
} // if !empty
|
|
||||||
ssgDeRefDelete(m_skid_state);
|
ssgDeRefDelete(m_skid_state);
|
||||||
#endif
|
|
||||||
} // ~SkidMarks
|
} // ~SkidMarks
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
/** Removes all skid marks, called when a race is restarted.
|
||||||
|
*/
|
||||||
|
void SkidMarks::reset()
|
||||||
|
{
|
||||||
|
for(unsigned int i=0; i<m_left.size(); i++)
|
||||||
|
{
|
||||||
|
scene->remove(m_left[i]);
|
||||||
|
scene->remove(m_right[i]);
|
||||||
|
}
|
||||||
|
m_left.clear();
|
||||||
|
m_right.clear();
|
||||||
|
m_skid_marking = false;
|
||||||
|
} // reset
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
/** Either adds to an existing skid mark quad, or (if the kart is skidding)
|
||||||
|
* starts a new skid mark quad.
|
||||||
|
* \param dt Time step.
|
||||||
|
*/
|
||||||
void SkidMarks::update(float dt)
|
void SkidMarks::update(float dt)
|
||||||
{
|
{
|
||||||
if(m_skid_marking)
|
if(m_skid_marking)
|
||||||
@ -66,8 +75,6 @@ void SkidMarks::update(float dt)
|
|||||||
m_kart.getVehicle()->getWheelInfo(3).m_raycastInfo;
|
m_kart.getVehicle()->getWheelInfo(3).m_raycastInfo;
|
||||||
Vec3 delta = raycast_right.m_contactPointWS - raycast_left.m_contactPointWS;
|
Vec3 delta = raycast_right.m_contactPointWS - raycast_left.m_contactPointWS;
|
||||||
|
|
||||||
int current=m_left.size()-1;
|
|
||||||
|
|
||||||
// We were skid marking, but not anymore (either because the
|
// We were skid marking, but not anymore (either because the
|
||||||
// wheels don't touch the ground, or the kart has stopped
|
// wheels don't touch the ground, or the kart has stopped
|
||||||
// skidding). One special case: the physics force both wheels
|
// skidding). One special case: the physics force both wheels
|
||||||
@ -80,8 +87,8 @@ void SkidMarks::update(float dt)
|
|||||||
delta.length2()<0.0001)
|
delta.length2()<0.0001)
|
||||||
{
|
{
|
||||||
m_skid_marking = false;
|
m_skid_marking = false;
|
||||||
m_left[current]->makeDList();
|
m_left[m_current]->makeDList();
|
||||||
m_right[current]->makeDList();
|
m_right[m_current]->makeDList();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,10 +98,10 @@ void SkidMarks::update(float dt)
|
|||||||
delta.normalize();
|
delta.normalize();
|
||||||
delta *= m_width;
|
delta *= m_width;
|
||||||
|
|
||||||
m_left [current]->add(raycast_left.m_contactPointWS,
|
m_left [m_current]->add(raycast_left.m_contactPointWS,
|
||||||
raycast_left.m_contactPointWS + delta);
|
raycast_left.m_contactPointWS + delta);
|
||||||
m_right[current]->add(raycast_right.m_contactPointWS-delta,
|
m_right[m_current]->add(raycast_right.m_contactPointWS-delta,
|
||||||
raycast_right.m_contactPointWS);
|
raycast_right.m_contactPointWS);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -108,6 +115,7 @@ void SkidMarks::update(float dt)
|
|||||||
m_kart.getVehicle()->getWheelInfo(2).m_raycastInfo;
|
m_kart.getVehicle()->getWheelInfo(2).m_raycastInfo;
|
||||||
// No skidmarking if wheels don't have contact
|
// No skidmarking if wheels don't have contact
|
||||||
if(!raycast_right.m_isInContact) return;
|
if(!raycast_right.m_isInContact) return;
|
||||||
|
|
||||||
const btWheelInfo::RaycastInfo raycast_left =
|
const btWheelInfo::RaycastInfo raycast_left =
|
||||||
m_kart.getVehicle()->getWheelInfo(3).m_raycastInfo;
|
m_kart.getVehicle()->getWheelInfo(3).m_raycastInfo;
|
||||||
|
|
||||||
@ -123,13 +131,28 @@ void SkidMarks::update(float dt)
|
|||||||
raycast_left.m_contactPointWS + delta,
|
raycast_left.m_contactPointWS + delta,
|
||||||
m_skid_state);
|
m_skid_state);
|
||||||
scene->add(smq_left);
|
scene->add(smq_left);
|
||||||
m_left.push_back(smq_left);
|
|
||||||
SkidMarkQuads *smq_right = new SkidMarkQuads(raycast_right.m_contactPointWS
|
SkidMarkQuads *smq_right = new SkidMarkQuads(raycast_right.m_contactPointWS
|
||||||
- delta,
|
- delta,
|
||||||
raycast_right.m_contactPointWS,
|
raycast_right.m_contactPointWS,
|
||||||
m_skid_state);
|
m_skid_state);
|
||||||
scene->add(smq_right);
|
scene->add(smq_right);
|
||||||
m_right.push_back(smq_right);
|
m_current++;
|
||||||
|
if(m_current>=stk_config->m_max_skidmarks)
|
||||||
|
m_current = 0;
|
||||||
|
if(m_current>=(int)m_left.size())
|
||||||
|
{
|
||||||
|
m_left. push_back(smq_left );
|
||||||
|
m_right.push_back(smq_right);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
scene->remove(m_left [m_current]);
|
||||||
|
scene->remove(m_right[m_current]);
|
||||||
|
m_left [m_current] = smq_left;
|
||||||
|
m_right[m_current] = smq_right;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
m_skid_marking = true;
|
m_skid_marking = true;
|
||||||
|
|
||||||
} // update
|
} // update
|
||||||
@ -148,10 +171,6 @@ SkidMarks::SkidMarkQuads::SkidMarkQuads(const Vec3 &left, const Vec3 &right,
|
|||||||
} // SkidMarkQuads
|
} // SkidMarkQuads
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
SkidMarks::SkidMarkQuads::~SkidMarkQuads()
|
|
||||||
{} // ~SkidMarkPos
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void SkidMarks::SkidMarkQuads::recalcBSphere()
|
void SkidMarks::SkidMarkQuads::recalcBSphere()
|
||||||
{
|
{
|
||||||
|
@ -39,30 +39,29 @@ private:
|
|||||||
bool m_skid_marking;
|
bool m_skid_marking;
|
||||||
/** Reduce effect of Z-fighting. */
|
/** Reduce effect of Z-fighting. */
|
||||||
float m_width;
|
float m_width;
|
||||||
|
/** Index of current (last added) skid mark quad. */
|
||||||
|
int m_current;
|
||||||
|
|
||||||
class SkidMarkQuads : public ssgVtxTable
|
class SkidMarkQuads : public ssgVtxTable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SkidMarkQuads (const Vec3 &left, const Vec3 &right,
|
SkidMarkQuads (const Vec3 &left, const Vec3 &right,
|
||||||
ssgSimpleState *state);
|
ssgSimpleState *state);
|
||||||
~SkidMarkQuads();
|
|
||||||
void recalcBSphere();
|
void recalcBSphere();
|
||||||
void add (const Vec3 &left,
|
void add (const Vec3 &left,
|
||||||
const Vec3 &right);
|
const Vec3 &right);
|
||||||
private:
|
|
||||||
float m_track_offset; // Amount of which the skidmark is lifted
|
|
||||||
// above the track to avoid z-buffer errors
|
|
||||||
}; // SkidMarkQuads
|
}; // SkidMarkQuads
|
||||||
|
|
||||||
/** Two skidmark objects for the left and right wheel. */
|
/** Two skidmark objects for the left and right wheel. */
|
||||||
std::vector <SkidMarkQuads *> m_left, m_right;
|
std::vector <SkidMarkQuads *> m_left, m_right;
|
||||||
ssgSimpleState *m_skid_state;
|
/** The state for colour etc. */
|
||||||
|
ssgSimpleState *m_skid_state;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SkidMarks(const Kart& kart, float width=0.2f);
|
SkidMarks(const Kart& kart, float width=0.2f);
|
||||||
~SkidMarks();
|
~SkidMarks();
|
||||||
void update (float dt);
|
void update (float dt);
|
||||||
|
void reset();
|
||||||
}; // SkidMarks
|
}; // SkidMarks
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -71,7 +71,7 @@ void Smoke::particle_create(int, Particle *p)
|
|||||||
sgSetVec3(p->m_vel, 0, 0, 0 );
|
sgSetVec3(p->m_vel, 0, 0, 0 );
|
||||||
sgSetVec3(p->m_acc, 0, 0, 2.0f ); /* Gravity */
|
sgSetVec3(p->m_acc, 0, 0, 2.0f ); /* Gravity */
|
||||||
p->m_size = 0.5f;
|
p->m_size = 0.5f;
|
||||||
p->m_time_to_live = 0.8f;
|
p->m_time_to_live = 0.4f;
|
||||||
|
|
||||||
// Change from left to right wheel and back for each new particle
|
// Change from left to right wheel and back for each new particle
|
||||||
static int wheel_number = 2;
|
static int wheel_number = 2;
|
||||||
|
@ -342,6 +342,7 @@ void Kart::reset()
|
|||||||
m_vehicle->applyEngineForce (0.0f, 3);
|
m_vehicle->applyEngineForce (0.0f, 3);
|
||||||
|
|
||||||
Moveable::reset();
|
Moveable::reset();
|
||||||
|
m_skidmarks->reset();
|
||||||
for(int j=0; j<m_vehicle->getNumWheels(); j++)
|
for(int j=0; j<m_vehicle->getNumWheels(); j++)
|
||||||
{
|
{
|
||||||
m_vehicle->updateWheelTransform(j, true);
|
m_vehicle->updateWheelTransform(j, true);
|
||||||
@ -887,7 +888,7 @@ void Kart::endRescue()
|
|||||||
} // endRescue
|
} // endRescue
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
#include <scene.hpp>
|
|
||||||
void Kart::loadData()
|
void Kart::loadData()
|
||||||
{
|
{
|
||||||
float r [ 2 ] = { -10.0f, 100.0f } ;
|
float r [ 2 ] = { -10.0f, 100.0f } ;
|
||||||
@ -959,7 +960,10 @@ void Kart::updateGraphics(const Vec3& off_xyz, const Vec3& off_hpr)
|
|||||||
const float offset_pitch = DEGREE_TO_RAD(m_wheelie_angle);
|
const float offset_pitch = DEGREE_TO_RAD(m_wheelie_angle);
|
||||||
|
|
||||||
if(m_smoke_system)
|
if(m_smoke_system)
|
||||||
m_smoke_system->setCreationRate((m_skidding-1)*100.0f);
|
{
|
||||||
|
float f = fabsf(m_controls.lr) > 0.8 ? 50.0f : 0.0f;
|
||||||
|
m_smoke_system->setCreationRate((m_skidding-1)*f);
|
||||||
|
}
|
||||||
if(m_nitro)
|
if(m_nitro)
|
||||||
m_nitro->setCreationRate(m_controls.wheelie && m_collected_energy>0
|
m_nitro->setCreationRate(m_controls.wheelie && m_collected_energy>0
|
||||||
? getSpeed()*5.0f : 0);
|
? getSpeed()*5.0f : 0);
|
||||||
|
@ -106,6 +106,7 @@ void STKConfig::load(const std::string &filename)
|
|||||||
CHECK_NEG(m_explosion_impulse, "explosion-impulse" );
|
CHECK_NEG(m_explosion_impulse, "explosion-impulse" );
|
||||||
CHECK_NEG(m_explosion_impulse_objects, "explosion-impulse-objects" );
|
CHECK_NEG(m_explosion_impulse_objects, "explosion-impulse-objects" );
|
||||||
CHECK_NEG(m_max_history, "max-history" );
|
CHECK_NEG(m_max_history, "max-history" );
|
||||||
|
CHECK_NEG(m_max_skidmarks, "max-skidmarks" );
|
||||||
CHECK_NEG(m_delay_finish_time, "delay-finish-time" );
|
CHECK_NEG(m_delay_finish_time, "delay-finish-time" );
|
||||||
CHECK_NEG(m_music_credit_time, "music-credit-time" );
|
CHECK_NEG(m_music_credit_time, "music-credit-time" );
|
||||||
m_kart_properties.checkAllSet(filename);
|
m_kart_properties.checkAllSet(filename);
|
||||||
@ -131,6 +132,7 @@ void STKConfig::init_defaults()
|
|||||||
m_max_karts = -100;
|
m_max_karts = -100;
|
||||||
m_grid_order = -100;
|
m_grid_order = -100;
|
||||||
m_max_history = -100;
|
m_max_history = -100;
|
||||||
|
m_max_skidmarks = -100;
|
||||||
m_title_music = NULL;
|
m_title_music = NULL;
|
||||||
m_game_style = GS_WHEELIE;
|
m_game_style = GS_WHEELIE;
|
||||||
m_scores.clear();
|
m_scores.clear();
|
||||||
@ -166,6 +168,7 @@ void STKConfig::getAllData(const lisp::Lisp* lisp)
|
|||||||
lisp->get("grid-order", m_grid_order );
|
lisp->get("grid-order", m_grid_order );
|
||||||
lisp->getVector("scores", m_scores );
|
lisp->getVector("scores", m_scores );
|
||||||
lisp->get("max-history", m_max_history );
|
lisp->get("max-history", m_max_history );
|
||||||
|
lisp->get("max-skidmarks", m_max_skidmarks );
|
||||||
lisp->get("delay-finish-time", m_delay_finish_time );
|
lisp->get("delay-finish-time", m_delay_finish_time );
|
||||||
lisp->get("music-credit-time", m_music_credit_time );
|
lisp->get("music-credit-time", m_music_credit_time );
|
||||||
lisp->get("menu-background", m_menu_background );
|
lisp->get("menu-background", m_menu_background );
|
||||||
|
@ -67,6 +67,7 @@ public:
|
|||||||
or reverse point order. */
|
or reverse point order. */
|
||||||
int m_max_history; /**<Maximum number of frames to save in
|
int m_max_history; /**<Maximum number of frames to save in
|
||||||
a history files. */
|
a history files. */
|
||||||
|
int m_max_skidmarks; /**<Maximum number of skid marks/kart. */
|
||||||
/** Gaming style: in wheelie, karts can do wheelies, collected coins
|
/** Gaming style: in wheelie, karts can do wheelies, collected coins
|
||||||
* increase the number of items you get. With nitro, collected coins
|
* increase the number of items you get. With nitro, collected coins
|
||||||
* can be used as a speed boost (nitro), but no wheelies are possible.
|
* can be used as a speed boost (nitro), but no wheelies are possible.
|
||||||
|
Loading…
Reference in New Issue
Block a user