1) Applied Jonan's patch to fix the layout for many files.
2) Moved STK specific extensions to bullet out of bullet src tree. 3) Started to move more files into separate subdirs. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@3027 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
115f15d0f2
commit
340fc18548
@ -139,11 +139,7 @@ supertuxkart_SOURCES = \
|
|||||||
race_manager.hpp \
|
race_manager.hpp \
|
||||||
string_utils.cpp \
|
string_utils.cpp \
|
||||||
string_utils.hpp \
|
string_utils.hpp \
|
||||||
track_manager.cpp \
|
|
||||||
track_manager.hpp \
|
|
||||||
callback.hpp \
|
callback.hpp \
|
||||||
moving_physics.hpp \
|
|
||||||
moving_physics.cpp \
|
|
||||||
moving_texture.hpp \
|
moving_texture.hpp \
|
||||||
moving_texture.cpp \
|
moving_texture.cpp \
|
||||||
callback_manager.cpp \
|
callback_manager.cpp \
|
||||||
@ -244,13 +240,6 @@ supertuxkart_SOURCES = \
|
|||||||
gui/feature_unlocked.hpp \
|
gui/feature_unlocked.hpp \
|
||||||
gui/font.hpp \
|
gui/font.hpp \
|
||||||
gui/font.cpp \
|
gui/font.cpp \
|
||||||
physics/physics.cpp \
|
|
||||||
physics/physics.hpp \
|
|
||||||
physics/kart_motion_state.hpp \
|
|
||||||
robots/default_robot.cpp \
|
|
||||||
robots/default_robot.hpp \
|
|
||||||
robots/track_info.cpp \
|
|
||||||
robots/track_info.hpp \
|
|
||||||
modes/follow_the_leader.cpp \
|
modes/follow_the_leader.cpp \
|
||||||
modes/follow_the_leader.hpp \
|
modes/follow_the_leader.hpp \
|
||||||
modes/standard_race.cpp \
|
modes/standard_race.cpp \
|
||||||
@ -263,15 +252,32 @@ supertuxkart_SOURCES = \
|
|||||||
modes/linear_world.hpp \
|
modes/linear_world.hpp \
|
||||||
modes/three_strikes_battle.cpp \
|
modes/three_strikes_battle.cpp \
|
||||||
modes/three_strikes_battle.hpp \
|
modes/three_strikes_battle.hpp \
|
||||||
replay_buffer_tpl.hpp \
|
physics/btKart.cpp \
|
||||||
replay_buffers.hpp \
|
physics/btKart.hpp \
|
||||||
replay_buffers.cpp \
|
physics/btUprightConstraint.cpp \
|
||||||
replay_base.hpp \
|
physics/btUprightConstraint.hpp \
|
||||||
replay_base.cpp \
|
physics/moving_physics.hpp \
|
||||||
replay_player.hpp \
|
physics/moving_physics.hpp \
|
||||||
replay_player.cpp \
|
physics/moving_physics.cpp \
|
||||||
replay_recorder.hpp \
|
physics/moving_physics.cpp \
|
||||||
replay_recorder.cpp
|
physics/physics.cpp \
|
||||||
|
physics/physics.hpp \
|
||||||
|
physics/kart_motion_state.hpp \
|
||||||
|
robots/default_robot.cpp \
|
||||||
|
robots/default_robot.hpp \
|
||||||
|
robots/track_info.cpp \
|
||||||
|
robots/track_info.hpp \
|
||||||
|
tracks/track_manager.cpp \
|
||||||
|
tracks/track_manager.hpp \
|
||||||
|
replay/replay_buffer_tpl.hpp \
|
||||||
|
replay/replay_buffers.hpp \
|
||||||
|
replay/replay_buffers.cpp \
|
||||||
|
replay/replay_base.hpp \
|
||||||
|
replay/replay_base.cpp \
|
||||||
|
replay/replay_player.hpp \
|
||||||
|
replay/replay_player.cpp \
|
||||||
|
replay/replay_recorder.hpp \
|
||||||
|
replay/replay_recorder.cpp
|
||||||
|
|
||||||
# This is a VERY ugly work-around for a compiler bug: if static_ssg s compiled with -O2
|
# This is a VERY ugly work-around for a compiler bug: if static_ssg s compiled with -O2
|
||||||
# (more particularly: with -fregmove, which is part of -O2), it will causes the kart
|
# (more particularly: with -fregmove, which is part of -O2), it will causes the kart
|
||||||
|
@ -21,14 +21,14 @@
|
|||||||
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
#include "audio/music_ogg.hpp"
|
|
||||||
#include "lisp/lisp.hpp"
|
|
||||||
#include "lisp/parser.hpp"
|
|
||||||
#include "string_utils.hpp"
|
#include "string_utils.hpp"
|
||||||
#include "track_manager.hpp"
|
|
||||||
#include "translation.hpp"
|
#include "translation.hpp"
|
||||||
#include "user_config.hpp"
|
#include "user_config.hpp"
|
||||||
#include "track.hpp"
|
#include "track.hpp"
|
||||||
|
#include "audio/music_ogg.hpp"
|
||||||
|
#include "lisp/lisp.hpp"
|
||||||
|
#include "lisp/parser.hpp"
|
||||||
|
#include "tracks/track_manager.hpp"
|
||||||
|
|
||||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||||
# define snprintf _snprintf
|
# define snprintf _snprintf
|
||||||
|
@ -199,8 +199,6 @@ libbulletdynamics_a_SOURCES = \
|
|||||||
BulletDynamics/ConstraintSolver/btSolverBody.h \
|
BulletDynamics/ConstraintSolver/btSolverBody.h \
|
||||||
BulletDynamics/ConstraintSolver/btSolverConstraint.h \
|
BulletDynamics/ConstraintSolver/btSolverConstraint.h \
|
||||||
BulletDynamics/ConstraintSolver/btTypedConstraint.cpp \
|
BulletDynamics/ConstraintSolver/btTypedConstraint.cpp \
|
||||||
BulletDynamics/ConstraintSolver/btUprightConstraint.h \
|
|
||||||
BulletDynamics/ConstraintSolver/btUprightConstraint.cpp \
|
|
||||||
BulletDynamics/ConstraintSolver/btTypedConstraint.h \
|
BulletDynamics/ConstraintSolver/btTypedConstraint.h \
|
||||||
BulletDynamics/Dynamics/btContinuousDynamicsWorld.cpp \
|
BulletDynamics/Dynamics/btContinuousDynamicsWorld.cpp \
|
||||||
BulletDynamics/Dynamics/btContinuousDynamicsWorld.h \
|
BulletDynamics/Dynamics/btContinuousDynamicsWorld.h \
|
||||||
@ -212,8 +210,6 @@ libbulletdynamics_a_SOURCES = \
|
|||||||
BulletDynamics/Dynamics/btSimpleDynamicsWorld.cpp \
|
BulletDynamics/Dynamics/btSimpleDynamicsWorld.cpp \
|
||||||
BulletDynamics/Dynamics/btSimpleDynamicsWorld.h \
|
BulletDynamics/Dynamics/btSimpleDynamicsWorld.h \
|
||||||
BulletDynamics/Dynamics/Bullet-C-API.cpp \
|
BulletDynamics/Dynamics/Bullet-C-API.cpp \
|
||||||
BulletDynamics/Vehicle/btKart.cpp \
|
|
||||||
BulletDynamics/Vehicle/btKart.h \
|
|
||||||
BulletDynamics/Vehicle/btRaycastVehicle.cpp \
|
BulletDynamics/Vehicle/btRaycastVehicle.cpp \
|
||||||
BulletDynamics/Vehicle/btRaycastVehicle.h \
|
BulletDynamics/Vehicle/btRaycastVehicle.h \
|
||||||
BulletDynamics/Vehicle/btVehicleRaycaster.h \
|
BulletDynamics/Vehicle/btVehicleRaycaster.h \
|
||||||
|
@ -30,7 +30,6 @@ subject to the following restrictions:
|
|||||||
#include "BulletDynamics/ConstraintSolver/btConeTwistConstraint.h"
|
#include "BulletDynamics/ConstraintSolver/btConeTwistConstraint.h"
|
||||||
#include "BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.h"
|
#include "BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.h"
|
||||||
#include "BulletDynamics/ConstraintSolver/btSliderConstraint.h"
|
#include "BulletDynamics/ConstraintSolver/btSliderConstraint.h"
|
||||||
#include "BulletDynamics/ConstraintSolver/btUprightConstraint.h"
|
|
||||||
|
|
||||||
#include "BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.h"
|
#include "BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.h"
|
||||||
///Optional ODE quickstep constraint solver, redistributed under ZLib license
|
///Optional ODE quickstep constraint solver, redistributed under ZLib license
|
||||||
@ -39,7 +38,6 @@ subject to the following restrictions:
|
|||||||
|
|
||||||
///Vehicle simulation, with wheel contact simulated by raycasts
|
///Vehicle simulation, with wheel contact simulated by raycasts
|
||||||
#include "BulletDynamics/Vehicle/btRaycastVehicle.h"
|
#include "BulletDynamics/Vehicle/btRaycastVehicle.h"
|
||||||
#include "BulletDynamics/Vehicle/btKart.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#include "callback_manager.hpp"
|
#include "callback_manager.hpp"
|
||||||
#include "moving_physics.hpp"
|
#include "physics/moving_physics.hpp"
|
||||||
|
|
||||||
CallbackManager *callback_manager=NULL;
|
CallbackManager *callback_manager=NULL;
|
||||||
|
|
||||||
|
@ -17,13 +17,14 @@
|
|||||||
// along with this program; if not, write to the Free Software
|
// along with this program; if not, write to the Free Software
|
||||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#ifndef CALLBACK_MANAGER_H
|
#ifndef CALLBACK_MANAGER_HPP
|
||||||
#define CALLBACK_MANAGER_H
|
#define CALLBACK_MANAGER_HPP
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "btBulletDynamicsCommon.h"
|
#include "btBulletDynamicsCommon.h"
|
||||||
#include "callback.hpp"
|
#include "callback.hpp"
|
||||||
#include "moving_physics.hpp"
|
|
||||||
|
class MovingPhysics;
|
||||||
|
|
||||||
// It might actually be enough to have only two different values: track (which
|
// It might actually be enough to have only two different values: track (which
|
||||||
// get deleted and loaded more than one), and everything else, which only
|
// get deleted and loaded more than one), and everything else, which only
|
||||||
|
@ -20,48 +20,16 @@
|
|||||||
#include "translation.hpp"
|
#include "translation.hpp"
|
||||||
#include "challenges/challenge.hpp"
|
#include "challenges/challenge.hpp"
|
||||||
#include "race_manager.hpp"
|
#include "race_manager.hpp"
|
||||||
#include "track_manager.hpp"
|
|
||||||
#include "track.hpp"
|
#include "track.hpp"
|
||||||
|
#include "grand_prix_manager.hpp"
|
||||||
#include "karts/kart_properties_manager.hpp"
|
#include "karts/kart_properties_manager.hpp"
|
||||||
#include "karts/kart_properties.hpp"
|
#include "karts/kart_properties.hpp"
|
||||||
#include "grand_prix_manager.hpp"
|
#include "tracks/track_manager.hpp"
|
||||||
|
|
||||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||||
# define snprintf _snprintf
|
# define snprintf _snprintf
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
Challenge::Challenge(std::string id, std::string name) :
|
|
||||||
m_state(CH_INACTIVE), m_Id(id), m_Name(name)
|
|
||||||
{
|
|
||||||
} // Challenge
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
/** Loads the state for a challenge object (esp. m_state), and calls the
|
|
||||||
* virtual function loadState for additional information
|
|
||||||
*/
|
|
||||||
void Challenge::load(const lisp::Lisp* config)
|
|
||||||
{
|
|
||||||
const lisp::Lisp* subnode= config->getLisp(getId());
|
|
||||||
if(!subnode) return;
|
|
||||||
|
|
||||||
// See if the challenge is solved (it's activated later from the
|
|
||||||
// unlock_manager).
|
|
||||||
bool finished=false;
|
|
||||||
subnode->get("solved", finished);
|
|
||||||
m_state = finished ? CH_SOLVED : CH_INACTIVE;
|
|
||||||
if(!finished) loadState(subnode);
|
|
||||||
} // load
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
void Challenge::save(lisp::Writer* writer)
|
|
||||||
{
|
|
||||||
writer->beginList(getId());
|
|
||||||
writer->write("solved", isSolved());
|
|
||||||
if(!isSolved()) saveState(writer);
|
|
||||||
writer->endList(getId());
|
|
||||||
} // save
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void Challenge::addUnlockTrackReward(std::string track_name)
|
void Challenge::addUnlockTrackReward(std::string track_name)
|
||||||
{
|
{
|
||||||
@ -70,6 +38,7 @@ void Challenge::addUnlockTrackReward(std::string track_name)
|
|||||||
feature.type = UNLOCK_TRACK;
|
feature.type = UNLOCK_TRACK;
|
||||||
m_feature.push_back(feature);
|
m_feature.push_back(feature);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void Challenge::addUnlockModeReward(std::string internal_mode_name, std::string user_mode_name)
|
void Challenge::addUnlockModeReward(std::string internal_mode_name, std::string user_mode_name)
|
||||||
{
|
{
|
||||||
@ -79,6 +48,7 @@ void Challenge::addUnlockModeReward(std::string internal_mode_name, std::string
|
|||||||
feature.user_name = user_mode_name;
|
feature.user_name = user_mode_name;
|
||||||
m_feature.push_back(feature);
|
m_feature.push_back(feature);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void Challenge::addUnlockGPReward(std::string gp_name)
|
void Challenge::addUnlockGPReward(std::string gp_name)
|
||||||
{
|
{
|
||||||
@ -87,6 +57,7 @@ void Challenge::addUnlockGPReward(std::string gp_name)
|
|||||||
feature.type = UNLOCK_GP;
|
feature.type = UNLOCK_GP;
|
||||||
m_feature.push_back(feature);
|
m_feature.push_back(feature);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void Challenge::addUnlockDifficultyReward(std::string internal_name, std::string user_name)
|
void Challenge::addUnlockDifficultyReward(std::string internal_name, std::string user_name)
|
||||||
{
|
{
|
||||||
@ -96,6 +67,7 @@ void Challenge::addUnlockDifficultyReward(std::string internal_name, std::string
|
|||||||
feature.user_name = user_name;
|
feature.user_name = user_name;
|
||||||
m_feature.push_back(feature);
|
m_feature.push_back(feature);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void Challenge::addUnlockKartReward(std::string internal_name, std::string user_name)
|
void Challenge::addUnlockKartReward(std::string internal_name, std::string user_name)
|
||||||
{
|
{
|
||||||
@ -105,19 +77,20 @@ void Challenge::addUnlockKartReward(std::string internal_name, std::string user_
|
|||||||
feature.user_name = user_name;
|
feature.user_name = user_name;
|
||||||
m_feature.push_back(feature);
|
m_feature.push_back(feature);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
const std::string Challenge::getUnlockedMessage() const
|
const std::string Challenge::getUnlockedMessage() const
|
||||||
{
|
{
|
||||||
std::string unlocked_message;
|
std::string unlocked_message;
|
||||||
|
|
||||||
const unsigned int amount = (unsigned int)m_feature.size();
|
const unsigned int amount = (unsigned int)m_feature.size();
|
||||||
for(unsigned int n=0; n<amount; n++)
|
for(unsigned int n=0; n<amount; n++)
|
||||||
{
|
{
|
||||||
// add line break if we are showing multiple messages
|
// add line break if we are showing multiple messages
|
||||||
if(n>0) unlocked_message+='\n';
|
if(n>0) unlocked_message+='\n';
|
||||||
|
|
||||||
char message[128];
|
char message[128];
|
||||||
|
|
||||||
// write message depending on feature type
|
// write message depending on feature type
|
||||||
switch(m_feature[n].type)
|
switch(m_feature[n].type)
|
||||||
{
|
{
|
||||||
@ -125,7 +98,7 @@ const std::string Challenge::getUnlockedMessage() const
|
|||||||
{ // {} avoids compiler warning
|
{ // {} avoids compiler warning
|
||||||
Track* track = track_manager->getTrack( m_feature[n].name );
|
Track* track = track_manager->getTrack( m_feature[n].name );
|
||||||
snprintf(message, 127, _("New track '%s'\nnow available"), _(track->getName()) );
|
snprintf(message, 127, _("New track '%s'\nnow available"), _(track->getName()) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case UNLOCK_MODE:
|
case UNLOCK_MODE:
|
||||||
snprintf(message, 127, _("New game mode\n'%s'\nnow available"), m_feature[n].user_name.c_str() );
|
snprintf(message, 127, _("New game mode\n'%s'\nnow available"), m_feature[n].user_name.c_str() );
|
||||||
@ -146,6 +119,32 @@ const std::string Challenge::getUnlockedMessage() const
|
|||||||
} // switch
|
} // switch
|
||||||
unlocked_message += message;
|
unlocked_message += message;
|
||||||
} // for n
|
} // for n
|
||||||
|
|
||||||
return unlocked_message;
|
return unlocked_message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
/** Loads the state for a challenge object (esp. m_state), and calls the
|
||||||
|
* virtual function loadState for additional information
|
||||||
|
*/
|
||||||
|
void Challenge::load(const lisp::Lisp* config)
|
||||||
|
{
|
||||||
|
const lisp::Lisp* subnode= config->getLisp(getId());
|
||||||
|
if(!subnode) return;
|
||||||
|
|
||||||
|
// See if the challenge is solved (it's activated later from the
|
||||||
|
// unlock_manager).
|
||||||
|
bool finished=false;
|
||||||
|
subnode->get("solved", finished);
|
||||||
|
m_state = finished ? CH_SOLVED : CH_INACTIVE;
|
||||||
|
if(!finished) loadState(subnode);
|
||||||
|
} // load
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
void Challenge::save(lisp::Writer* writer)
|
||||||
|
{
|
||||||
|
writer->beginList(getId());
|
||||||
|
writer->write("solved", isSolved());
|
||||||
|
if(!isSolved()) saveState(writer);
|
||||||
|
writer->endList(getId());
|
||||||
|
} // save
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
// along with this program; if not, write to the Free Software
|
// along with this program; if not, write to the Free Software
|
||||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#ifndef HEADER_CHALLENGE_H
|
#ifndef HEADER_CHALLENGE_HPP
|
||||||
#define HEADER_CHALLENGE_H
|
#define HEADER_CHALLENGE_HPP
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -36,7 +36,7 @@ enum REWARD_TYPE
|
|||||||
|
|
||||||
struct UnlockableFeature
|
struct UnlockableFeature
|
||||||
{
|
{
|
||||||
std::string name; // itnernal name
|
std::string name; // internal name
|
||||||
std::string user_name; // not all types of feature have one
|
std::string user_name; // not all types of feature have one
|
||||||
REWARD_TYPE type;
|
REWARD_TYPE type;
|
||||||
};
|
};
|
||||||
@ -44,6 +44,7 @@ struct UnlockableFeature
|
|||||||
// A base class for all challenges
|
// A base class for all challenges
|
||||||
class Challenge
|
class Challenge
|
||||||
{
|
{
|
||||||
|
private:
|
||||||
enum {CH_INACTIVE, // challenge not yet possible
|
enum {CH_INACTIVE, // challenge not yet possible
|
||||||
CH_ACTIVE, // challenge possible, but not yet solved
|
CH_ACTIVE, // challenge possible, but not yet solved
|
||||||
CH_SOLVED} m_state; // challenge was solved
|
CH_SOLVED} m_state; // challenge was solved
|
||||||
@ -56,15 +57,17 @@ public:
|
|||||||
Challenge(std::string id, std::string name);
|
Challenge(std::string id, std::string name);
|
||||||
Challenge() {m_Id=""; m_Name="";m_state=CH_INACTIVE;}
|
Challenge() {m_Id=""; m_Name="";m_state=CH_INACTIVE;}
|
||||||
virtual ~Challenge() {};
|
virtual ~Challenge() {};
|
||||||
const std::string& getId() const { return m_Id; }
|
const std::string
|
||||||
const std::string& getName() const { return m_Name; }
|
&getId() const { return m_Id; }
|
||||||
void setName(const std::string& s) { m_Name = s; }
|
const std::string
|
||||||
void setId(const std::string& s) { m_Id = s; }
|
&getName() const { return m_Name; }
|
||||||
void addUnlockTrackReward(std::string track_name);
|
void setName(const std::string& s) { m_Name = s; }
|
||||||
void addUnlockModeReward(std::string internal_mode_name, std::string user_mode_name);
|
void setId(const std::string& s) { m_Id = s; }
|
||||||
void addUnlockGPReward(std::string gp_name);
|
void addUnlockTrackReward(std::string track_name);
|
||||||
void addUnlockDifficultyReward(std::string internal_name, std::string user_name);
|
void addUnlockModeReward(std::string internal_mode_name, std::string user_mode_name);
|
||||||
void addUnlockKartReward(std::string internal_name, std::string user_name);
|
void addUnlockGPReward(std::string gp_name);
|
||||||
|
void addUnlockDifficultyReward(std::string internal_name, std::string user_name);
|
||||||
|
void addUnlockKartReward(std::string internal_name, std::string user_name);
|
||||||
|
|
||||||
const std::string getUnlockedMessage() const;
|
const std::string getUnlockedMessage() const;
|
||||||
const std::vector<UnlockableFeature>&
|
const std::vector<UnlockableFeature>&
|
||||||
|
@ -24,17 +24,16 @@
|
|||||||
#include "translation.hpp"
|
#include "translation.hpp"
|
||||||
#include "grand_prix_data.hpp"
|
#include "grand_prix_data.hpp"
|
||||||
#include "grand_prix_manager.hpp"
|
#include "grand_prix_manager.hpp"
|
||||||
#include "track_manager.hpp"
|
|
||||||
#include "karts/kart.hpp"
|
#include "karts/kart.hpp"
|
||||||
#include "lisp/lisp.hpp"
|
#include "lisp/lisp.hpp"
|
||||||
#include "lisp/parser.hpp"
|
#include "lisp/parser.hpp"
|
||||||
#include "modes/linear_world.hpp"
|
#include "modes/linear_world.hpp"
|
||||||
|
#include "tracks/track_manager.hpp"
|
||||||
|
|
||||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||||
# define snprintf _snprintf
|
# define snprintf _snprintf
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
ChallengeData::ChallengeData(const std::string& filename)
|
ChallengeData::ChallengeData(const std::string& filename)
|
||||||
{
|
{
|
||||||
m_filename = filename;
|
m_filename = filename;
|
||||||
@ -72,7 +71,7 @@ ChallengeData::ChallengeData(const std::string& filename)
|
|||||||
m_major = RaceManager::MAJOR_MODE_SINGLE;
|
m_major = RaceManager::MAJOR_MODE_SINGLE;
|
||||||
else
|
else
|
||||||
error("major");
|
error("major");
|
||||||
|
|
||||||
lisp->get("minor", mode);
|
lisp->get("minor", mode);
|
||||||
if(mode=="timetrial")
|
if(mode=="timetrial")
|
||||||
m_minor = RaceManager::MINOR_MODE_TIME_TRIAL;
|
m_minor = RaceManager::MINOR_MODE_TIME_TRIAL;
|
||||||
@ -91,9 +90,9 @@ ChallengeData::ChallengeData(const std::string& filename)
|
|||||||
setChallengeDescription(s);
|
setChallengeDescription(s);
|
||||||
if(!lisp->get("karts", m_num_karts) ) error("karts");
|
if(!lisp->get("karts", m_num_karts) ) error("karts");
|
||||||
// Position is optional except in GP and FTL
|
// Position is optional except in GP and FTL
|
||||||
if(!lisp->get("position", m_position) &&
|
if(!lisp->get("position", m_position) &&
|
||||||
//RaceManager::getWorld()->areKartsOrdered() ) // FIXME - order and optional are not the same thing
|
//RaceManager::getWorld()->areKartsOrdered() ) // FIXME - order and optional are not the same thing
|
||||||
(m_minor==RaceManager::MINOR_MODE_FOLLOW_LEADER ||
|
(m_minor==RaceManager::MINOR_MODE_FOLLOW_LEADER ||
|
||||||
m_major==RaceManager::MAJOR_MODE_GRAND_PRIX))
|
m_major==RaceManager::MAJOR_MODE_GRAND_PRIX))
|
||||||
error("position");
|
error("position");
|
||||||
lisp->get("difficulty", s);
|
lisp->get("difficulty", s);
|
||||||
@ -115,13 +114,13 @@ ChallengeData::ChallengeData(const std::string& filename)
|
|||||||
if(!lisp->get("track", m_track_name )) error("track");
|
if(!lisp->get("track", m_track_name )) error("track");
|
||||||
if(!lisp->get("laps", m_num_laps ) &&
|
if(!lisp->get("laps", m_num_laps ) &&
|
||||||
m_minor!=RaceManager::MINOR_MODE_FOLLOW_LEADER)
|
m_minor!=RaceManager::MINOR_MODE_FOLLOW_LEADER)
|
||||||
error("laps");
|
error("laps");
|
||||||
}
|
}
|
||||||
else // GP
|
else // GP
|
||||||
{
|
{
|
||||||
if(!lisp->get("gp", m_gp_id )) error("gp");
|
if(!lisp->get("gp", m_gp_id )) error("gp");
|
||||||
}
|
}
|
||||||
|
|
||||||
getUnlocks(lisp, "unlock-track", UNLOCK_TRACK);
|
getUnlocks(lisp, "unlock-track", UNLOCK_TRACK);
|
||||||
getUnlocks(lisp, "unlock-gp", UNLOCK_GP );
|
getUnlocks(lisp, "unlock-gp", UNLOCK_GP );
|
||||||
getUnlocks(lisp, "unlock-mode", UNLOCK_MODE );
|
getUnlocks(lisp, "unlock-mode", UNLOCK_MODE );
|
||||||
@ -275,6 +274,7 @@ bool ChallengeData::raceFinished()
|
|||||||
if(m_time>0.0f && kart->getFinishTime()>m_time) return false; // too slow
|
if(m_time>0.0f && kart->getFinishTime()>m_time) return false; // too slow
|
||||||
return true;
|
return true;
|
||||||
} // raceFinished
|
} // raceFinished
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
bool ChallengeData::grandPrixFinished()
|
bool ChallengeData::grandPrixFinished()
|
||||||
{
|
{
|
||||||
@ -291,6 +291,6 @@ bool ChallengeData::grandPrixFinished()
|
|||||||
const int rank = race_manager->getKartFinalGPRank(kart->getWorldKartId());
|
const int rank = race_manager->getKartFinalGPRank(kart->getWorldKartId());
|
||||||
//printf("getting rank for %s : %i \n", kart->getName().c_str(), rank );
|
//printf("getting rank for %s : %i \n", kart->getName().c_str(), rank );
|
||||||
if( rank != 0 ) return false;
|
if( rank != 0 ) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} // grandPrixFinished
|
} // grandPrixFinished
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
// along with this program; if not, write to the Free Software
|
// along with this program; if not, write to the Free Software
|
||||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#ifndef HEADER_CHALLENGE_DATA_H
|
#ifndef HEADER_CHALLENGE_DATA_HPP
|
||||||
#define HEADER_CHALLENGE_DATA_H
|
#define HEADER_CHALLENGE_DATA_HPP
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -27,7 +27,7 @@
|
|||||||
#include "challenges/challenge.hpp"
|
#include "challenges/challenge.hpp"
|
||||||
#include "race_manager.hpp"
|
#include "race_manager.hpp"
|
||||||
|
|
||||||
class ChallengeData : public Challenge
|
class ChallengeData : public Challenge
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
RaceManager::MajorRaceModeType m_major;
|
RaceManager::MajorRaceModeType m_major;
|
||||||
@ -42,8 +42,8 @@ private:
|
|||||||
int m_energy;
|
int m_energy;
|
||||||
std::vector<std::string> m_depends_on;
|
std::vector<std::string> m_depends_on;
|
||||||
std::vector<UnlockableFeature> m_unlock;
|
std::vector<UnlockableFeature> m_unlock;
|
||||||
|
|
||||||
std::string m_filename;
|
std::string m_filename;
|
||||||
|
|
||||||
void getUnlocks(const lisp::Lisp *lisp, const char* type, REWARD_TYPE reward);
|
void getUnlocks(const lisp::Lisp *lisp, const char* type, REWARD_TYPE reward);
|
||||||
void error(const char *id) const;
|
void error(const char *id) const;
|
||||||
|
|
||||||
@ -55,4 +55,4 @@ public:
|
|||||||
virtual bool grandPrixFinished();
|
virtual bool grandPrixFinished();
|
||||||
}; // ChallengeData
|
}; // ChallengeData
|
||||||
|
|
||||||
#endif
|
#endif // HEADER_CHALLENGE_DATA_HPP
|
||||||
|
@ -42,8 +42,6 @@
|
|||||||
#include <plib/ul.h>
|
#include <plib/ul.h>
|
||||||
#include "file_manager.hpp"
|
#include "file_manager.hpp"
|
||||||
#include "btBulletDynamicsCommon.h"
|
#include "btBulletDynamicsCommon.h"
|
||||||
#include "moving_physics.hpp"
|
|
||||||
#include "moving_texture.hpp"
|
|
||||||
#include "translation.hpp"
|
#include "translation.hpp"
|
||||||
#include "material_manager.hpp"
|
#include "material_manager.hpp"
|
||||||
#include "string_utils.hpp"
|
#include "string_utils.hpp"
|
||||||
|
@ -17,10 +17,9 @@
|
|||||||
// along with this program; if not, write to the Free Software
|
// along with this program; if not, write to the Free Software
|
||||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#ifndef HEADER_FLYABLE_H
|
#ifndef HEADER_FLYABLE_HPP
|
||||||
#define HEADER_FLYABLE_H
|
#define HEADER_FLYABLE_HPP
|
||||||
|
|
||||||
#include "moving_physics.hpp"
|
|
||||||
#include "terrain_info.hpp"
|
#include "terrain_info.hpp"
|
||||||
#include "audio/sfx_manager.hpp"
|
#include "audio/sfx_manager.hpp"
|
||||||
#include "items/powerup_manager.hpp"
|
#include "items/powerup_manager.hpp"
|
||||||
@ -28,6 +27,7 @@
|
|||||||
|
|
||||||
class FlyableInfo;
|
class FlyableInfo;
|
||||||
class Kart;
|
class Kart;
|
||||||
|
class MovingPhysics;
|
||||||
|
|
||||||
class Flyable : public Moveable, public TerrainInfo
|
class Flyable : public Moveable, public TerrainInfo
|
||||||
{
|
{
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#include "lisp/lisp.hpp"
|
#include "lisp/lisp.hpp"
|
||||||
#include "grand_prix_data.hpp"
|
#include "grand_prix_data.hpp"
|
||||||
#include "string_utils.hpp"
|
#include "string_utils.hpp"
|
||||||
#include "track_manager.hpp"
|
#include "tracks/track_manager.hpp"
|
||||||
|
|
||||||
GrandPrixData::GrandPrixData(const std::string filename)
|
GrandPrixData::GrandPrixData(const std::string filename)
|
||||||
{
|
{
|
||||||
|
@ -22,11 +22,11 @@
|
|||||||
#include "widget_manager.hpp"
|
#include "widget_manager.hpp"
|
||||||
#include "menu_manager.hpp"
|
#include "menu_manager.hpp"
|
||||||
#include "race_manager.hpp"
|
#include "race_manager.hpp"
|
||||||
#include "track_manager.hpp"
|
|
||||||
#include "material_manager.hpp"
|
#include "material_manager.hpp"
|
||||||
#include "unlock_manager.hpp"
|
#include "unlock_manager.hpp"
|
||||||
#include "translation.hpp"
|
#include "translation.hpp"
|
||||||
#include "grand_prix_manager.hpp"
|
#include "grand_prix_manager.hpp"
|
||||||
|
#include "tracks/track_manager.hpp"
|
||||||
|
|
||||||
enum WidgetTokens
|
enum WidgetTokens
|
||||||
{
|
{
|
||||||
|
@ -20,12 +20,12 @@
|
|||||||
#include "track_sel.hpp"
|
#include "track_sel.hpp"
|
||||||
#include "widget_manager.hpp"
|
#include "widget_manager.hpp"
|
||||||
#include "race_manager.hpp"
|
#include "race_manager.hpp"
|
||||||
#include "track_manager.hpp"
|
|
||||||
#include "track.hpp"
|
#include "track.hpp"
|
||||||
#include "menu_manager.hpp"
|
#include "menu_manager.hpp"
|
||||||
#include "user_config.hpp"
|
#include "user_config.hpp"
|
||||||
#include "translation.hpp"
|
#include "translation.hpp"
|
||||||
#include "unlock_manager.hpp"
|
#include "unlock_manager.hpp"
|
||||||
|
#include "tracks/track_manager.hpp"
|
||||||
|
|
||||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||||
# define snprintf _snprintf
|
# define snprintf _snprintf
|
||||||
|
@ -19,15 +19,16 @@
|
|||||||
|
|
||||||
#include "widget.hpp"
|
#include "widget.hpp"
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
//FIXME: this should be removed when the scrolling is cleaned
|
//FIXME: this should be removed when the scrolling is cleaned
|
||||||
#include "user_config.hpp"
|
#include "user_config.hpp"
|
||||||
|
|
||||||
#include "constants.hpp"
|
#include "constants.hpp"
|
||||||
#include "track_manager.hpp"
|
|
||||||
#include "material_manager.hpp"
|
#include "material_manager.hpp"
|
||||||
#include "track.hpp"
|
#include "track.hpp"
|
||||||
#include <cmath>
|
#include "tracks/track_manager.hpp"
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
const int Widget::MAX_SCROLL = 1000000;
|
const int Widget::MAX_SCROLL = 1000000;
|
||||||
|
|
||||||
|
@ -487,10 +487,6 @@
|
|||||||
RelativePath="..\..\bullet\src\BulletDynamics\ConstraintSolver\btTypedConstraint.cpp"
|
RelativePath="..\..\bullet\src\BulletDynamics\ConstraintSolver\btTypedConstraint.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\..\bullet\src\BulletDynamics\ConstraintSolver\btUprightConstraint.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
Name="Dynamics"
|
Name="Dynamics"
|
||||||
@ -519,10 +515,6 @@
|
|||||||
<Filter
|
<Filter
|
||||||
Name="Vehicle"
|
Name="Vehicle"
|
||||||
>
|
>
|
||||||
<File
|
|
||||||
RelativePath="..\..\bullet\src\BulletDynamics\Vehicle\btKart.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\bullet\src\BulletDynamics\Vehicle\btRaycastVehicle.cpp"
|
RelativePath="..\..\bullet\src\BulletDynamics\Vehicle\btRaycastVehicle.cpp"
|
||||||
>
|
>
|
||||||
@ -1089,10 +1081,6 @@
|
|||||||
RelativePath="..\..\bullet\src\BulletDynamics\ConstraintSolver\btTypedConstraint.h"
|
RelativePath="..\..\bullet\src\BulletDynamics\ConstraintSolver\btTypedConstraint.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\..\bullet\src\BulletDynamics\ConstraintSolver\btUprightConstraint.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
Name="Dynamics"
|
Name="Dynamics"
|
||||||
@ -1121,10 +1109,6 @@
|
|||||||
<Filter
|
<Filter
|
||||||
Name="Vehicle"
|
Name="Vehicle"
|
||||||
>
|
>
|
||||||
<File
|
|
||||||
RelativePath="..\..\bullet\src\BulletDynamics\Vehicle\btKart.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\bullet\src\BulletDynamics\Vehicle\btRaycastVehicle.h"
|
RelativePath="..\..\bullet\src\BulletDynamics\Vehicle\btRaycastVehicle.h"
|
||||||
>
|
>
|
||||||
|
@ -735,10 +735,6 @@
|
|||||||
RelativePath="../../../src\material_manager.cpp"
|
RelativePath="../../../src\material_manager.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="../../../src\moving_physics.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="../../../src\moving_texture.cpp"
|
RelativePath="../../../src\moving_texture.cpp"
|
||||||
>
|
>
|
||||||
@ -747,22 +743,6 @@
|
|||||||
RelativePath="../../../src\race_manager.cpp"
|
RelativePath="../../../src\race_manager.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="../../../src\replay_base.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="../../../src\replay_buffers.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="../../../src\replay_player.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="../../../src\replay_recorder.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="../../../src\scene.cpp"
|
RelativePath="../../../src\scene.cpp"
|
||||||
>
|
>
|
||||||
@ -795,10 +775,6 @@
|
|||||||
RelativePath="../../../src\track.cpp"
|
RelativePath="../../../src\track.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="../../../src\track_manager.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\translation.cpp"
|
RelativePath="..\..\translation.cpp"
|
||||||
>
|
>
|
||||||
@ -1106,6 +1082,18 @@
|
|||||||
<Filter
|
<Filter
|
||||||
Name="physics"
|
Name="physics"
|
||||||
>
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\physics\btKart.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\physics\btUprightConstraint.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\physics\moving_physics.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\physics\physics.cpp"
|
RelativePath="..\..\physics\physics.cpp"
|
||||||
>
|
>
|
||||||
@ -1199,6 +1187,34 @@
|
|||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="tracks"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\tracks\track_manager.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="replay"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\replay\replay_base.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\replay\replay_buffers.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\replay\replay_player.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\replay\replay_recorder.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
Name="Headerdateien"
|
Name="Headerdateien"
|
||||||
@ -1313,26 +1329,6 @@
|
|||||||
RelativePath="../../../src\race_manager.hpp"
|
RelativePath="../../../src\race_manager.hpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="../../../src\replay_base.hpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="../../../src\replay_buffer_tpl.hpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="../../../src\replay_buffers.hpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="../../../src\replay_player.hpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="../../../src\replay_recorder.hpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="../../../src\scene.hpp"
|
RelativePath="../../../src\scene.hpp"
|
||||||
>
|
>
|
||||||
@ -1369,10 +1365,6 @@
|
|||||||
RelativePath="../../../src\track.hpp"
|
RelativePath="../../../src\track.hpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="../../../src\track_manager.hpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="../../../src\translation.hpp"
|
RelativePath="../../../src\translation.hpp"
|
||||||
>
|
>
|
||||||
@ -1780,6 +1772,14 @@
|
|||||||
<Filter
|
<Filter
|
||||||
Name="physics"
|
Name="physics"
|
||||||
>
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\physics\btKart.hpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\physics\btUprightConstraint.hpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\physics\kart_motion_state.hpp"
|
RelativePath="..\..\physics\kart_motion_state.hpp"
|
||||||
>
|
>
|
||||||
@ -1845,6 +1845,38 @@
|
|||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="tracks"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\tracks\track_manager.hpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="replay"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\replay\replay_base.hpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\replay\replay_buffer_tpl.hpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\replay\replay_buffers.hpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\replay\replay_player.hpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\replay\replay_recorder.hpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
Name="Ressourcendateien"
|
Name="Ressourcendateien"
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include "items/projectile_manager.hpp"
|
#include "items/projectile_manager.hpp"
|
||||||
#include "karts/player_kart.hpp"
|
#include "karts/player_kart.hpp"
|
||||||
#include "modes/world.hpp"
|
#include "modes/world.hpp"
|
||||||
|
#include "physics/moving_physics.hpp"
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
Plunger::Plunger(Kart *kart) : Flyable(kart, POWERUP_PLUNGER)
|
Plunger::Plunger(Kart *kart) : Flyable(kart, POWERUP_PLUNGER)
|
||||||
|
@ -51,6 +51,7 @@
|
|||||||
#include "karts/kart_properties_manager.hpp"
|
#include "karts/kart_properties_manager.hpp"
|
||||||
#include "network/race_state.hpp"
|
#include "network/race_state.hpp"
|
||||||
#include "network/network_manager.hpp"
|
#include "network/network_manager.hpp"
|
||||||
|
#include "physics/btUprightConstraint.hpp"
|
||||||
#include "physics/physics.hpp"
|
#include "physics/physics.hpp"
|
||||||
#include "utils/coord.hpp"
|
#include "utils/coord.hpp"
|
||||||
#include "utils/ssg_help.hpp"
|
#include "utils/ssg_help.hpp"
|
||||||
@ -221,7 +222,7 @@ void Kart::createPhysics()
|
|||||||
m_uprightConstraint->setErp(1.0f);
|
m_uprightConstraint->setErp(1.0f);
|
||||||
m_uprightConstraint->setLimitSoftness(1.0f);
|
m_uprightConstraint->setLimitSoftness(1.0f);
|
||||||
m_uprightConstraint->setDamping(0.0f);
|
m_uprightConstraint->setDamping(0.0f);
|
||||||
RaceManager::getWorld()->getPhysics()->addKart(this, m_vehicle);
|
RaceManager::getWorld()->getPhysics()->addKart(this);
|
||||||
|
|
||||||
//create the engine sound
|
//create the engine sound
|
||||||
if(m_engine_sound)
|
if(m_engine_sound)
|
||||||
@ -316,7 +317,7 @@ void Kart::reset()
|
|||||||
// physics world. Add it again.
|
// physics world. Add it again.
|
||||||
if(m_eliminated || m_rescue)
|
if(m_eliminated || m_rescue)
|
||||||
{
|
{
|
||||||
RaceManager::getWorld()->getPhysics()->addKart(this, m_vehicle);
|
RaceManager::getWorld()->getPhysics()->addKart(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_attachment.clear();
|
m_attachment.clear();
|
||||||
@ -968,7 +969,7 @@ void Kart::endRescue()
|
|||||||
// let the mode decide where to put the kart
|
// let the mode decide where to put the kart
|
||||||
RaceManager::getWorld()->moveKartAfterRescue(this, m_body);
|
RaceManager::getWorld()->moveKartAfterRescue(this, m_body);
|
||||||
|
|
||||||
RaceManager::getWorld()->getPhysics()->addKart(this, m_vehicle);
|
RaceManager::getWorld()->getPhysics()->addKart(this);
|
||||||
} // endRescue
|
} // endRescue
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -26,25 +26,27 @@
|
|||||||
#include "btBulletDynamicsCommon.h"
|
#include "btBulletDynamicsCommon.h"
|
||||||
|
|
||||||
#include "terrain_info.hpp"
|
#include "terrain_info.hpp"
|
||||||
|
#include "items/attachment.hpp"
|
||||||
|
#include "items/powerup.hpp"
|
||||||
#include "karts/moveable.hpp"
|
#include "karts/moveable.hpp"
|
||||||
#include "karts/kart_properties.hpp"
|
#include "karts/kart_properties.hpp"
|
||||||
#include "karts/kart_control.hpp"
|
#include "karts/kart_control.hpp"
|
||||||
#include "items/attachment.hpp"
|
|
||||||
#include "items/powerup.hpp"
|
|
||||||
#include "karts/kart_model.hpp"
|
#include "karts/kart_model.hpp"
|
||||||
|
#include "physics/btKart.hpp"
|
||||||
|
|
||||||
class SkidMarks;
|
class SkidMarks;
|
||||||
class Item;
|
class Item;
|
||||||
class Smoke;
|
class Smoke;
|
||||||
class Nitro;
|
class Nitro;
|
||||||
class SFXBase;
|
class SFXBase;
|
||||||
|
class btUprightConstraint;
|
||||||
|
|
||||||
class Kart : public TerrainInfo, public Moveable
|
class Kart : public TerrainInfo, public Moveable
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
btTransform m_reset_transform; // reset position
|
btTransform m_reset_transform; // reset position
|
||||||
unsigned int m_world_kart_id; // index of kart in world
|
unsigned int m_world_kart_id; // index of kart in world
|
||||||
float m_skidding; /**< Accumulated skidding factor. */
|
float m_skidding; ///< Accumulated skidding factor.
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Attachment m_attachment;
|
Attachment m_attachment;
|
||||||
@ -59,63 +61,58 @@ protected:
|
|||||||
* This reduction is accumulated in m_max_speed_reduction. */
|
* This reduction is accumulated in m_max_speed_reduction. */
|
||||||
float m_max_speed_reduction;
|
float m_max_speed_reduction;
|
||||||
float m_power_reduction;
|
float m_power_reduction;
|
||||||
float m_max_gear_rpm; //maximum engine rpm's for the current gear
|
float m_max_gear_rpm; /**<Maximum engine rpm's for the current gear*/
|
||||||
float m_max_speed_reverse_ratio;
|
float m_max_speed_reverse_ratio;
|
||||||
float m_zipper_time_left; // zipper time left
|
float m_zipper_time_left; /**<Zipper time left. */
|
||||||
float m_bounce_back_time; // a short time after a collision acceleration
|
float m_bounce_back_time; /**<A short time after a collision acceleration
|
||||||
// is disabled to allow the karts to bounce back
|
* is disabled to allow the karts to bounce back*/
|
||||||
|
|
||||||
// physics parameters, storing it saves time
|
// physics parameters, storing it saves time
|
||||||
btKart::btVehicleTuning *m_tuning;
|
btKart::btVehicleTuning *m_tuning;
|
||||||
btCompoundShape m_kart_chassis;
|
btCompoundShape m_kart_chassis;
|
||||||
btVehicleRaycaster *m_vehicle_raycaster;
|
btVehicleRaycaster *m_vehicle_raycaster;
|
||||||
btKart *m_vehicle;
|
btKart *m_vehicle;
|
||||||
btUprightConstraint *m_uprightConstraint;
|
btUprightConstraint *m_uprightConstraint;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** The amount of energy collected bu hitting coins. */
|
/** The amount of energy collected by hitting coins. */
|
||||||
float m_collected_energy;
|
float m_collected_energy;
|
||||||
/** The shadow of the kart. */
|
ssgTransform *m_shadow; /**<The shadow of the kart. */
|
||||||
ssgTransform *m_shadow;
|
|
||||||
/** If a kart is flying, the shadow is disabled (since it is
|
/** If a kart is flying, the shadow is disabled (since it is
|
||||||
* stuck to the kart, i.e. the shadow would be flying, too). */
|
* stuck to the kart, i.e. the shadow would be flying, too). */
|
||||||
bool m_shadow_enabled;
|
bool m_shadow_enabled;
|
||||||
|
Smoke *m_smoke_system; /**<Smoke from skidding. */
|
||||||
/** Smoke from skidding. */
|
|
||||||
Smoke *m_smoke_system;
|
|
||||||
|
|
||||||
/** Fire when using a nitro. */
|
/** Fire when using a nitro. */
|
||||||
Nitro *m_nitro;
|
Nitro *m_nitro;
|
||||||
|
|
||||||
float m_wheel_rotation;
|
float m_wheel_rotation;
|
||||||
/** For each wheel it stores the suspension length after the karts are at
|
/** For each wheel it stores the suspension length after the karts are at
|
||||||
* the start position, i.e. the suspension will be somewhat compressed.
|
* the start position, i.e. the suspension will be somewhat compressed.
|
||||||
* The bullet suspensionRestLength is the value when the suspension is not
|
* The bullet suspensionRestLength is the value when the suspension is not
|
||||||
* at all compressed. */
|
* at all compressed. */
|
||||||
float m_default_suspension_length[4];
|
float m_default_suspension_length[4];
|
||||||
|
|
||||||
/** The skidmarks object for this kart. */
|
/** The skidmarks object for this kart. */
|
||||||
SkidMarks* m_skidmarks;
|
SkidMarks *m_skidmarks;
|
||||||
|
|
||||||
float m_finish_time;
|
float m_finish_time;
|
||||||
bool m_finished_race;
|
bool m_finished_race;
|
||||||
|
|
||||||
/* When a kart has its view blocked by the plunger, this variable will be > 0
|
/** When a kart has its view blocked by the plunger, this variable will be
|
||||||
the number it contains is the time left before removing plunger */
|
* > 0 the number it contains is the time left before removing plunger. */
|
||||||
float m_view_blocked_by_plunger;
|
float m_view_blocked_by_plunger;
|
||||||
|
float m_speed;
|
||||||
float m_speed;
|
float m_current_gear_ratio;
|
||||||
|
bool m_rescue;
|
||||||
|
bool m_eliminated;
|
||||||
|
|
||||||
float m_current_gear_ratio;
|
SFXBase *m_engine_sound;
|
||||||
bool m_rescue;
|
SFXBase *m_beep_sound;
|
||||||
bool m_eliminated;
|
SFXBase *m_crash_sound;
|
||||||
|
SFXBase *m_skid_sound;
|
||||||
SFXBase *m_engine_sound;
|
SFXBase *m_goo_sound;
|
||||||
SFXBase *m_beep_sound;
|
float m_time_last_crash;
|
||||||
SFXBase *m_crash_sound;
|
|
||||||
SFXBase *m_skid_sound;
|
|
||||||
SFXBase *m_goo_sound;
|
|
||||||
float m_time_last_crash;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
float m_rescue_pitch, m_rescue_roll;
|
float m_rescue_pitch, m_rescue_roll;
|
||||||
@ -129,22 +126,45 @@ public:
|
|||||||
unsigned int getWorldKartId() const { return m_world_kart_id; }
|
unsigned int getWorldKartId() const { return m_world_kart_id; }
|
||||||
void setWorldKartId(unsigned int n) { m_world_kart_id=n; }
|
void setWorldKartId(unsigned int n) { m_world_kart_id=n; }
|
||||||
void loadData();
|
void loadData();
|
||||||
virtual void updateGraphics (const Vec3& off_xyz, const Vec3& off_hpr);
|
virtual void updateGraphics(const Vec3& off_xyz, const Vec3& off_hpr);
|
||||||
const KartProperties*
|
const KartProperties*
|
||||||
getKartProperties () const { return m_kart_properties; }
|
getKartProperties() const { return m_kart_properties; }
|
||||||
void setKartProperties (const KartProperties *kp)
|
// ------------------------------------------------------------------------
|
||||||
{ m_kart_properties=kp; }
|
/** Sets the kart properties. */
|
||||||
void attach (attachmentType attachment_, float time)
|
void setKartProperties(const KartProperties *kp)
|
||||||
{ m_attachment.set(attachment_, time); }
|
{
|
||||||
void setPowerup (PowerupType t, int n)
|
m_kart_properties=kp;
|
||||||
{ m_powerup.set(t, n); }
|
}
|
||||||
virtual void setPosition (int p)
|
// ------------------------------------------------------------------------
|
||||||
{ m_race_position = p; }
|
/** Sets the attachment and time it stays attached. */
|
||||||
|
void attach(attachmentType attachment_, float time)
|
||||||
Attachment *getAttachment () { return &m_attachment; }
|
{
|
||||||
void setAttachmentType (attachmentType t, float time_left=0.0f,
|
m_attachment.set(attachment_, time);
|
||||||
Kart*k=NULL)
|
}
|
||||||
{ m_attachment.set(t, time_left, k); }
|
// ------------------------------------------------------------------------
|
||||||
|
/** Sets a new powerup. */
|
||||||
|
void setPowerup (PowerupType t, int n)
|
||||||
|
{
|
||||||
|
m_powerup.set(t, n);
|
||||||
|
}
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
/** Sets the position in race this kart has (1<=p<=n). */
|
||||||
|
virtual void setPosition(int p)
|
||||||
|
{
|
||||||
|
m_race_position = p;
|
||||||
|
}
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
Attachment *getAttachment()
|
||||||
|
{
|
||||||
|
return &m_attachment;
|
||||||
|
}
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
void setAttachmentType(attachmentType t, float time_left=0.0f, Kart*k=NULL)
|
||||||
|
{
|
||||||
|
m_attachment.set(t, time_left, k);
|
||||||
|
}
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
|
||||||
Powerup *getPowerup () { return &m_powerup; }
|
Powerup *getPowerup () { return &m_powerup; }
|
||||||
int getNumPowerup () const { return m_powerup.getNum();}
|
int getNumPowerup () const { return m_powerup.getNum();}
|
||||||
float getEnergy () const { return m_collected_energy;}
|
float getEnergy () const { return m_collected_energy;}
|
||||||
|
@ -45,12 +45,20 @@ Moveable::~Moveable()
|
|||||||
// FIXME LEAK: what about model? ssgDeRefDelete(m_model_transform)
|
// FIXME LEAK: what about model? ssgDeRefDelete(m_model_transform)
|
||||||
} // ~Moveable
|
} // ~Moveable
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
void Moveable::updateGraphics(const Vec3& off_xyz, const Vec3& off_hpr)
|
||||||
|
{
|
||||||
|
Vec3 xyz=getXYZ()+off_xyz;
|
||||||
|
Vec3 hpr=getHPR()+off_hpr;
|
||||||
|
sgCoord c=Coord(xyz, hpr).toSgCoord();
|
||||||
|
|
||||||
|
m_model_transform->setTransform(&c);
|
||||||
|
} // updateGraphics
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// The reset position must be set before calling reset
|
// The reset position must be set before calling reset
|
||||||
void Moveable::reset()
|
void Moveable::reset()
|
||||||
{
|
{
|
||||||
m_material_hot = NULL;
|
|
||||||
m_normal_hot = NULL;
|
|
||||||
if(m_body)
|
if(m_body)
|
||||||
{
|
{
|
||||||
m_body->setLinearVelocity(btVector3(0.0, 0.0, 0.0));
|
m_body->setLinearVelocity(btVector3(0.0, 0.0, 0.0));
|
||||||
@ -62,9 +70,20 @@ void Moveable::reset()
|
|||||||
} // reset
|
} // reset
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void Moveable::createBody(float mass, btTransform& trans,
|
void Moveable::update(float dt)
|
||||||
|
{
|
||||||
|
m_motion_state->getWorldTransform(m_transform);
|
||||||
|
m_velocityLC = getVelocity()*getTrans().getBasis();
|
||||||
|
m_hpr.setHPR(m_transform.getBasis());
|
||||||
|
|
||||||
|
updateGraphics(Vec3(0,0,0), Vec3(0,0,0));
|
||||||
|
m_first_time = false ;
|
||||||
|
} // update
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
void Moveable::createBody(float mass, btTransform& trans,
|
||||||
btCollisionShape *shape) {
|
btCollisionShape *shape) {
|
||||||
|
|
||||||
btVector3 inertia;
|
btVector3 inertia;
|
||||||
shape->calculateLocalInertia(mass, inertia);
|
shape->calculateLocalInertia(mass, inertia);
|
||||||
m_transform = trans;
|
m_transform = trans;
|
||||||
@ -95,25 +114,3 @@ void Moveable::setTrans(const btTransform &t)
|
|||||||
m_transform=t;
|
m_transform=t;
|
||||||
m_motion_state->setWorldTransform(t);
|
m_motion_state->setWorldTransform(t);
|
||||||
} // setTrans
|
} // setTrans
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
void Moveable::update(float dt)
|
|
||||||
{
|
|
||||||
m_motion_state->getWorldTransform(m_transform);
|
|
||||||
m_velocityLC = getVelocity()*getTrans().getBasis();
|
|
||||||
m_hpr.setHPR(m_transform.getBasis());
|
|
||||||
|
|
||||||
updateGraphics(Vec3(0,0,0), Vec3(0,0,0));
|
|
||||||
m_first_time = false ;
|
|
||||||
} // update
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
void Moveable::updateGraphics(const Vec3& off_xyz, const Vec3& off_hpr)
|
|
||||||
{
|
|
||||||
Vec3 xyz=getXYZ()+off_xyz;
|
|
||||||
Vec3 hpr=getHPR()+off_hpr;
|
|
||||||
sgCoord c=Coord(xyz, hpr).toSgCoord();
|
|
||||||
|
|
||||||
m_model_transform->setTransform(&c);
|
|
||||||
} // updateGraphics
|
|
||||||
|
|
||||||
|
@ -18,8 +18,8 @@
|
|||||||
// along with this program; if not, write to the Free Software
|
// along with this program; if not, write to the Free Software
|
||||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#ifndef HEADER_MOVEABLE_H
|
#ifndef HEADER_MOVEABLE_HPP
|
||||||
#define HEADER_MOVEABLE_H
|
#define HEADER_MOVEABLE_HPP
|
||||||
|
|
||||||
#define _WINSOCKAPI_
|
#define _WINSOCKAPI_
|
||||||
#include <plib/ssg.h>
|
#include <plib/ssg.h>
|
||||||
@ -36,50 +36,66 @@ class Material;
|
|||||||
#define MAX_ITEMS_COLLECTED 20
|
#define MAX_ITEMS_COLLECTED 20
|
||||||
|
|
||||||
|
|
||||||
class Moveable
|
class Moveable
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
btVector3 m_velocityLC; /* velocity in kart coordinates */
|
btVector3 m_velocityLC; /**<Velocity in kart coordinates */
|
||||||
btTransform m_transform;
|
btTransform m_transform;
|
||||||
Vec3 m_hpr;
|
Vec3 m_hpr;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
UserPointer m_user_pointer;
|
UserPointer m_user_pointer;
|
||||||
sgVec4 *m_normal_hot; /* plane on which HOT was computed */
|
ssgTransform *m_model_transform; /**<The transform the model is attached to. */
|
||||||
Material *m_material_hot; /* Material at HOT */
|
|
||||||
ssgTransform *m_model_transform; // The transform where the model is under
|
|
||||||
int m_first_time ;
|
int m_first_time ;
|
||||||
btRigidBody *m_body;
|
btRigidBody *m_body;
|
||||||
KartMotionState *m_motion_state;
|
KartMotionState *m_motion_state;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
Moveable();
|
||||||
Moveable ();
|
virtual ~Moveable();
|
||||||
virtual ~Moveable();
|
ssgTransform *getModelTransform() {return m_model_transform; }
|
||||||
|
virtual const btVector3
|
||||||
ssgTransform* getModelTransform() {return m_model_transform; }
|
&getVelocity() const {return m_body->getLinearVelocity();}
|
||||||
virtual const btVector3 &getVelocity() const {return m_body->getLinearVelocity();}
|
const btVector3
|
||||||
const btVector3 &getVelocityLC() const {return m_velocityLC; }
|
&getVelocityLC() const {return m_velocityLC; }
|
||||||
virtual void setVelocity(const btVector3& v) {m_body->setLinearVelocity(v); }
|
virtual void setVelocity(const btVector3& v) {m_body->setLinearVelocity(v); }
|
||||||
const Vec3& getXYZ () const {return (Vec3&)m_transform.getOrigin();}
|
const Vec3& getXYZ() const {return (Vec3&)m_transform.getOrigin();}
|
||||||
const Vec3& getHPR () const {return m_hpr; }
|
const Vec3& getHPR() const {return m_hpr; }
|
||||||
const btQuaternion getRotation() const {return m_transform.getRotation(); }
|
const btQuaternion
|
||||||
void setXYZ (const Vec3& a) {m_transform.setOrigin(a);
|
getRotation() const {return m_transform.getRotation(); }
|
||||||
m_motion_state->setWorldTransform(m_transform);}
|
|
||||||
void setRotation (const btQuaternion&a){m_transform.setRotation(a);
|
/** Sets the XYZ coordinates of the moveable. */
|
||||||
m_motion_state->setWorldTransform(m_transform);}
|
void setXYZ(const Vec3& a)
|
||||||
void setXYZRotation(const Vec3& xyz, const btQuaternion& a)
|
{
|
||||||
{m_transform.setRotation(a);
|
m_transform.setOrigin(a);
|
||||||
m_transform.setOrigin(xyz);
|
m_motion_state->setWorldTransform(m_transform);
|
||||||
m_motion_state->setWorldTransform(m_transform);}
|
}
|
||||||
const sgVec4* getNormalHOT () const {return m_normal_hot; }
|
// ------------------------------------------------------------------------
|
||||||
|
/** Sets the rotation of this moveable. */
|
||||||
|
void setRotation(const btQuaternion&a)
|
||||||
|
{
|
||||||
|
m_transform.setRotation(a);
|
||||||
|
m_motion_state->setWorldTransform(m_transform);
|
||||||
|
}
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
/** Sets XYZ position and rotation of this moveable. */
|
||||||
|
void setXYZRotation(const Vec3& xyz, const btQuaternion& a)
|
||||||
|
{
|
||||||
|
m_transform.setRotation(a);
|
||||||
|
m_transform.setOrigin(xyz);
|
||||||
|
m_motion_state->setWorldTransform(m_transform);
|
||||||
|
}
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
virtual void handleZipper () {};
|
||||||
virtual void updateGraphics(const Vec3& off_xyz, const Vec3& off_hpr);
|
virtual void updateGraphics(const Vec3& off_xyz, const Vec3& off_hpr);
|
||||||
virtual void handleZipper () {};
|
virtual void reset();
|
||||||
virtual void reset ();
|
virtual void update(float dt) ;
|
||||||
virtual void update (float dt) ;
|
btRigidBody *getBody() const {return m_body; }
|
||||||
btRigidBody* getBody () const {return m_body; }
|
|
||||||
void createBody(float mass, btTransform& trans,
|
void createBody(float mass, btTransform& trans,
|
||||||
btCollisionShape *shape);
|
btCollisionShape *shape);
|
||||||
const btTransform& getTrans() const {return m_transform;}
|
const btTransform
|
||||||
void setTrans (const btTransform& t);
|
&getTrans() const {return m_transform;}
|
||||||
|
void setTrans(const btTransform& t);
|
||||||
}
|
}
|
||||||
; // class Moveable
|
; // class Moveable
|
||||||
|
|
||||||
|
@ -33,11 +33,11 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "loader.hpp"
|
#include "loader.hpp"
|
||||||
#include "moving_physics.hpp"
|
|
||||||
#include "moving_texture.hpp"
|
#include "moving_texture.hpp"
|
||||||
#include "material_manager.hpp"
|
#include "material_manager.hpp"
|
||||||
#include "file_manager.hpp"
|
#include "file_manager.hpp"
|
||||||
#include "material.hpp"
|
#include "material.hpp"
|
||||||
|
#include "physics/moving_physics.hpp"
|
||||||
|
|
||||||
Loader* loader = 0;
|
Loader* loader = 0;
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
#include "user_config.hpp"
|
#include "user_config.hpp"
|
||||||
#include "unlock_manager.hpp"
|
#include "unlock_manager.hpp"
|
||||||
#include "track_manager.hpp"
|
#include "tracks/track_manager.hpp"
|
||||||
#include "track.hpp"
|
#include "track.hpp"
|
||||||
#include "race_manager.hpp"
|
#include "race_manager.hpp"
|
||||||
#include "file_manager.hpp"
|
#include "file_manager.hpp"
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
#include "file_manager.hpp"
|
#include "file_manager.hpp"
|
||||||
#include "track.hpp"
|
#include "track.hpp"
|
||||||
#include "track_manager.hpp"
|
|
||||||
#include "race_manager.hpp"
|
#include "race_manager.hpp"
|
||||||
#include "user_config.hpp"
|
#include "user_config.hpp"
|
||||||
#include "callback_manager.hpp"
|
#include "callback_manager.hpp"
|
||||||
@ -45,10 +44,11 @@
|
|||||||
#include "karts/auto_kart.hpp"
|
#include "karts/auto_kart.hpp"
|
||||||
#include "karts/player_kart.hpp"
|
#include "karts/player_kart.hpp"
|
||||||
#include "karts/kart_properties_manager.hpp"
|
#include "karts/kart_properties_manager.hpp"
|
||||||
|
#include "modes/world.hpp"
|
||||||
#include "network/network_manager.hpp"
|
#include "network/network_manager.hpp"
|
||||||
#include "network/race_state.hpp"
|
#include "network/race_state.hpp"
|
||||||
#include "robots/default_robot.hpp"
|
#include "robots/default_robot.hpp"
|
||||||
#include "modes/world.hpp"
|
#include "tracks/track_manager.hpp"
|
||||||
|
|
||||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||||
# define snprintf _snprintf
|
# define snprintf _snprintf
|
||||||
|
@ -27,8 +27,8 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "user_config.hpp"
|
#include "user_config.hpp"
|
||||||
#include "track_manager.hpp"
|
|
||||||
#include "karts/kart_properties_manager.hpp"
|
#include "karts/kart_properties_manager.hpp"
|
||||||
|
#include "tracks/track_manager.hpp"
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
/** Creates the connect message. It includes the id of the client (currently
|
/** Creates the connect message. It includes the id of the client (currently
|
||||||
|
@ -9,18 +9,16 @@
|
|||||||
* It is provided "as is" without express or implied warranty.
|
* It is provided "as is" without express or implied warranty.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "LinearMath/btVector3.h"
|
#include "physics/btKart.hpp"
|
||||||
#include "btKart.h"
|
|
||||||
|
|
||||||
|
#include "LinearMath/btMinMax.h"
|
||||||
|
#include "LinearMath/btVector3.h"
|
||||||
|
#include "LinearMath/btQuaternion.h"
|
||||||
#include "BulletDynamics/ConstraintSolver/btSolve2LinearConstraint.h"
|
#include "BulletDynamics/ConstraintSolver/btSolve2LinearConstraint.h"
|
||||||
#include "BulletDynamics/ConstraintSolver/btJacobianEntry.h"
|
#include "BulletDynamics/ConstraintSolver/btJacobianEntry.h"
|
||||||
#include "LinearMath/btQuaternion.h"
|
|
||||||
#include "BulletDynamics/Dynamics/btDynamicsWorld.h"
|
#include "BulletDynamics/Dynamics/btDynamicsWorld.h"
|
||||||
#include "btVehicleRaycaster.h"
|
#include "BulletDynamics/Vehicle/btVehicleRaycaster.h"
|
||||||
#include "btWheelInfo.h"
|
#include "bulletDynamics/Vehicle/btWheelInfo.h"
|
||||||
#include "LinearMath/btMinMax.h"
|
|
||||||
|
|
||||||
|
|
||||||
#include "BulletDynamics/ConstraintSolver/btContactConstraint.h"
|
#include "BulletDynamics/ConstraintSolver/btContactConstraint.h"
|
||||||
|
|
||||||
struct btWheelContactPoint;
|
struct btWheelContactPoint;
|
@ -8,13 +8,10 @@
|
|||||||
* of this software for any purpose.
|
* of this software for any purpose.
|
||||||
* It is provided "as is" without express or implied warranty.
|
* It is provided "as is" without express or implied warranty.
|
||||||
*/
|
*/
|
||||||
#ifndef BT_KART_H
|
#ifndef HEADER_BT_KART_HPP
|
||||||
#define BT_KART_H
|
#define HEADER_BT_KART_HPP
|
||||||
|
|
||||||
#include "BulletDynamics/Dynamics/btRigidBody.h"
|
#include "btBulletDynamicsCommon.h"
|
||||||
#include "btVehicleRaycaster.h"
|
|
||||||
#include "LinearMath/btAlignedObjectArray.h"
|
|
||||||
#include "btRaycastVehicle.h"
|
|
||||||
|
|
||||||
class btDynamicsWorld;
|
class btDynamicsWorld;
|
||||||
struct btWheelInfo;
|
struct btWheelInfo;
|
@ -15,11 +15,13 @@ subject to the following restrictions:
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "btUprightConstraint.h"
|
#include "physics/btUprightConstraint.hpp"
|
||||||
|
|
||||||
|
#include <new>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "BulletDynamics/Dynamics/btRigidBody.h"
|
#include "BulletDynamics/Dynamics/btRigidBody.h"
|
||||||
#include "LinearMath/btTransformUtil.h"
|
#include "LinearMath/btTransformUtil.h"
|
||||||
#include <new>
|
|
||||||
#include "stdio.h"
|
|
||||||
|
|
||||||
//!
|
//!
|
||||||
//!
|
//!
|
@ -14,12 +14,12 @@ subject to the following restrictions:
|
|||||||
3. This notice may not be removed or altered from any source distribution.
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef UPRIGHT_CONSTRAINT_H
|
#ifndef HEADER_UPRIGHT_CONSTRAINT_HPP
|
||||||
#define UPRIGHT_CONSTRAINT_H
|
#define HEADER_UPRIGHT_CONSTRAINT_HPP
|
||||||
|
|
||||||
#include "LinearMath/btVector3.h"
|
#include "LinearMath/btVector3.h"
|
||||||
#include "btJacobianEntry.h"
|
#include "BulletDynamics/ConstraintSolver/btJacobianEntry.h"
|
||||||
#include "btTypedConstraint.h"
|
#include "BulletDynamics/ConstraintSolver/btTypedConstraint.h"
|
||||||
|
|
||||||
class btRigidBody;
|
class btRigidBody;
|
||||||
|
|
@ -16,53 +16,53 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program; if not, write to the Free Software
|
// along with this program; if not, write to the Free Software
|
||||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#ifndef HEADER_KART_MOTION_STATE_HPP
|
#ifndef HEADER_KART_MOTION_STATE_HPP
|
||||||
#define HEADER_KART_MOTION_STATE_HPP
|
#define HEADER_KART_MOTION_STATE_HPP
|
||||||
|
|
||||||
#include "LinearMath/btMotionState.h"
|
#include "LinearMath/btMotionState.h"
|
||||||
|
|
||||||
/** This is a very simple motion state implementation for bullet, which does
|
/** This is a very simple motion state implementation for bullet, which does
|
||||||
* not support any transformation from physics transform to graphics
|
* not support any transformation from physics transform to graphics
|
||||||
* transform.
|
* transform.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class KartMotionState : public btMotionState
|
class KartMotionState : public btMotionState
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
btTransform m_center_of_mass;
|
btTransform m_center_of_mass;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/** Constructor.
|
/** Constructor.
|
||||||
* \param start_trans An optional start transformation. Defaults to
|
* \param start_trans An optional start transformation. Defaults to
|
||||||
* identity.
|
* identity.
|
||||||
*/
|
*/
|
||||||
KartMotionState(const btTransform& start_trans = btTransform::getIdentity())
|
KartMotionState(const btTransform& start_trans = btTransform::getIdentity())
|
||||||
: m_center_of_mass(start_trans)
|
: m_center_of_mass(start_trans)
|
||||||
|
|
||||||
{
|
{
|
||||||
} // KartMotionState
|
} // KartMotionState
|
||||||
|
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
/** Returns the current world transform.
|
/** Returns the current world transform.
|
||||||
* \param center_of_mass The btTransform object that stores the current
|
* \param center_of_mass The btTransform object that stores the current
|
||||||
* transformation.
|
* transformation.
|
||||||
*/
|
*/
|
||||||
virtual void getWorldTransform(btTransform& center_of_mass) const
|
virtual void getWorldTransform(btTransform& center_of_mass) const
|
||||||
{
|
{
|
||||||
center_of_mass = m_center_of_mass;
|
center_of_mass = m_center_of_mass;
|
||||||
} // getWorldTransform
|
} // getWorldTransform
|
||||||
|
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
/** Synchronizes world transform from physics to user.
|
/** Synchronizes world transform from physics to user.
|
||||||
* Bullet calls the update of worldtransform for active objects.
|
* Bullet calls the update of worldtransform for active objects.
|
||||||
* \param new_trans The new transformation for the object.
|
* \param new_trans The new transformation for the object.
|
||||||
*/
|
*/
|
||||||
virtual void setWorldTransform(const btTransform &new_trans)
|
virtual void setWorldTransform(const btTransform &new_trans)
|
||||||
{
|
{
|
||||||
m_center_of_mass = new_trans;
|
m_center_of_mass = new_trans;
|
||||||
} // setWorldTransform
|
} // setWorldTransform
|
||||||
|
|
||||||
}; // KartMotionState
|
}; // KartMotionState
|
||||||
|
|
||||||
#endif // HEADER_KART_MOTION_STATE
|
#endif // HEADER_KART_MOTION_STATE_HPP
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#include "user_config.hpp"
|
#include "user_config.hpp"
|
||||||
#include "network/race_state.hpp"
|
#include "network/race_state.hpp"
|
||||||
|
#include "physics/btUprightConstraint.hpp"
|
||||||
#include "utils/ssg_help.hpp"
|
#include "utils/ssg_help.hpp"
|
||||||
#include "track.hpp"
|
#include "track.hpp"
|
||||||
|
|
||||||
@ -30,8 +31,8 @@
|
|||||||
*/
|
*/
|
||||||
Physics::Physics() : btSequentialImpulseConstraintSolver()
|
Physics::Physics() : btSequentialImpulseConstraintSolver()
|
||||||
{
|
{
|
||||||
m_collision_conf = new btDefaultCollisionConfiguration();
|
m_collision_conf = new btDefaultCollisionConfiguration();
|
||||||
m_dispatcher = new btCollisionDispatcher(m_collision_conf);
|
m_dispatcher = new btCollisionDispatcher(m_collision_conf);
|
||||||
} // Physics
|
} // Physics
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -41,17 +42,17 @@ Physics::Physics() : btSequentialImpulseConstraintSolver()
|
|||||||
*/
|
*/
|
||||||
void Physics::init(const Vec3 &world_min, const Vec3 &world_max)
|
void Physics::init(const Vec3 &world_min, const Vec3 &world_max)
|
||||||
{
|
{
|
||||||
m_axis_sweep = new btAxisSweep3(world_min, world_max);
|
m_axis_sweep = new btAxisSweep3(world_min, world_max);
|
||||||
m_dynamics_world = new btDiscreteDynamicsWorld(m_dispatcher,
|
m_dynamics_world = new btDiscreteDynamicsWorld(m_dispatcher,
|
||||||
m_axis_sweep,
|
m_axis_sweep,
|
||||||
this,
|
this,
|
||||||
m_collision_conf);
|
m_collision_conf);
|
||||||
m_dynamics_world->setGravity(btVector3(0.0f, 0.0f,
|
m_dynamics_world->setGravity(btVector3(0.0f, 0.0f,
|
||||||
-RaceManager::getTrack()->getGravity()));
|
-RaceManager::getTrack()->getGravity()));
|
||||||
#ifdef HAVE_GLUT
|
#ifdef HAVE_GLUT
|
||||||
if(user_config->m_bullet_debug)
|
if(user_config->m_bullet_debug)
|
||||||
{
|
{
|
||||||
m_debug_drawer=new GLDebugDrawer();
|
m_debug_drawer = new GLDebugDrawer();
|
||||||
m_debug_drawer->setDebugMode(btIDebugDraw::DBG_DrawWireframe);
|
m_debug_drawer->setDebugMode(btIDebugDraw::DBG_DrawWireframe);
|
||||||
m_dynamics_world->setDebugDrawer(m_debug_drawer);
|
m_dynamics_world->setDebugDrawer(m_debug_drawer);
|
||||||
}
|
}
|
||||||
@ -68,7 +69,6 @@ Physics::~Physics()
|
|||||||
delete m_axis_sweep;
|
delete m_axis_sweep;
|
||||||
delete m_dispatcher;
|
delete m_dispatcher;
|
||||||
delete m_collision_conf;
|
delete m_collision_conf;
|
||||||
|
|
||||||
} // ~Physics
|
} // ~Physics
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
@ -77,10 +77,10 @@ Physics::~Physics()
|
|||||||
* \param kart The kart to add.
|
* \param kart The kart to add.
|
||||||
* \param vehicle The raycast vehicle object.
|
* \param vehicle The raycast vehicle object.
|
||||||
*/
|
*/
|
||||||
void Physics::addKart(const Kart *kart, btKart *vehicle)
|
void Physics::addKart(const Kart *kart)
|
||||||
{
|
{
|
||||||
m_dynamics_world->addRigidBody(kart->getBody());
|
m_dynamics_world->addRigidBody(kart->getBody());
|
||||||
m_dynamics_world->addVehicle(vehicle);
|
m_dynamics_world->addVehicle(kart->getVehicle());
|
||||||
m_dynamics_world->addConstraint(kart->getUprightConstraint());
|
m_dynamics_world->addConstraint(kart->getUprightConstraint());
|
||||||
} // addKart
|
} // addKart
|
||||||
|
|
||||||
@ -102,9 +102,9 @@ void Physics::removeKart(const Kart *kart)
|
|||||||
*/
|
*/
|
||||||
void Physics::update(float dt)
|
void Physics::update(float dt)
|
||||||
{
|
{
|
||||||
// Bullet can report the same collision more than once (up to 4
|
// Bullet can report the same collision more than once (up to 4
|
||||||
// contact points per collision. Additionally, more than one internal
|
// contact points per collision. Additionally, more than one internal
|
||||||
// substep might be taken, resulting in potentially even more
|
// substep might be taken, resulting in potentially even more
|
||||||
// duplicates. To handle this, all collisions (i.e. pair of objects)
|
// duplicates. To handle this, all collisions (i.e. pair of objects)
|
||||||
// are stored in a vector, but only one entry per collision pair
|
// are stored in a vector, but only one entry per collision pair
|
||||||
// of objects.
|
// of objects.
|
||||||
@ -154,7 +154,7 @@ void Physics::update(float dt)
|
|||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
/** Handles the special case of two karts colliding with each other, which means
|
/** Handles the special case of two karts colliding with each other, which means
|
||||||
* that bombs must be passed on. If both karts have a bomb, they'll explode
|
* that bombs must be passed on. If both karts have a bomb, they'll explode
|
||||||
* immediately. This function is called from physics::update on the server
|
* immediately. This function is called from physics::update on the server
|
||||||
* (and if no networking is used), and from race_state on the client to replay
|
* (and if no networking is used), and from race_state on the client to replay
|
||||||
* what happened on the server.
|
* what happened on the server.
|
||||||
@ -164,7 +164,7 @@ void Physics::update(float dt)
|
|||||||
void Physics::KartKartCollision(Kart *kartA, Kart *kartB)
|
void Physics::KartKartCollision(Kart *kartA, Kart *kartB)
|
||||||
{
|
{
|
||||||
kartA->crashed(kartB); // will play crash sound for player karts
|
kartA->crashed(kartB); // will play crash sound for player karts
|
||||||
kartB->crashed(kartA);
|
kartB->crashed(kartA);
|
||||||
Attachment *attachmentA=kartA->getAttachment();
|
Attachment *attachmentA=kartA->getAttachment();
|
||||||
Attachment *attachmentB=kartB->getAttachment();
|
Attachment *attachmentB=kartB->getAttachment();
|
||||||
|
|
||||||
@ -175,7 +175,7 @@ void Physics::KartKartCollision(Kart *kartA, Kart *kartB)
|
|||||||
{
|
{
|
||||||
attachmentA->setTimeLeft(0.0f);
|
attachmentA->setTimeLeft(0.0f);
|
||||||
attachmentB->setTimeLeft(0.0f);
|
attachmentB->setTimeLeft(0.0f);
|
||||||
}
|
}
|
||||||
else // only A has a bomb, move it to B (unless it was from B)
|
else // only A has a bomb, move it to B (unless it was from B)
|
||||||
{
|
{
|
||||||
if(attachmentA->getPreviousOwner()!=kartB)
|
if(attachmentA->getPreviousOwner()!=kartB)
|
||||||
@ -321,15 +321,14 @@ void Physics::draw()
|
|||||||
* \param color Colour to use.
|
* \param color Colour to use.
|
||||||
*/
|
*/
|
||||||
void Physics::debugDraw(float m[16], btCollisionShape *s, const btVector3 color)
|
void Physics::debugDraw(float m[16], btCollisionShape *s, const btVector3 color)
|
||||||
|
|
||||||
{
|
{
|
||||||
#ifdef HAVE_GLUT
|
#ifdef HAVE_GLUT
|
||||||
m_shape_drawer.drawOpenGL(m, s, color, 0);
|
m_shape_drawer.drawOpenGL(m, s, color, 0);
|
||||||
// btIDebugDraw::DBG_DrawWireframe);
|
// btIDebugDraw::DBG_DrawWireframe);
|
||||||
// btIDebugDraw::DBG_DrawAabb);
|
// btIDebugDraw::DBG_DrawAabb);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} // debugDraw
|
} // debugDraw
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
// along with this program; if not, write to the Free Software
|
// along with this program; if not, write to the Free Software
|
||||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#ifndef HEADER_PHYSICS_H
|
#ifndef HEADER_PHYSICS_HPP
|
||||||
#define HEADER_PHYSICS_H
|
#define HEADER_PHYSICS_HPP
|
||||||
|
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -37,19 +37,10 @@ class Kart;
|
|||||||
class Physics : public btSequentialImpulseConstraintSolver
|
class Physics : public btSequentialImpulseConstraintSolver
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
btDynamicsWorld *m_dynamics_world;
|
|
||||||
Kart *m_kart;
|
|
||||||
#ifdef HAVE_GLUT
|
|
||||||
GLDebugDrawer *m_debug_drawer;
|
|
||||||
GL_ShapeDrawer m_shape_drawer;
|
|
||||||
#endif
|
|
||||||
btCollisionDispatcher *m_dispatcher;
|
|
||||||
btBroadphaseInterface *m_axis_sweep;
|
|
||||||
btDefaultCollisionConfiguration *m_collision_conf;
|
|
||||||
|
|
||||||
// Bullet can report the same collision more than once (up to 4
|
// Bullet can report the same collision more than once (up to 4
|
||||||
// contact points per collision. Additionally, more than one internal
|
// contact points per collision. Additionally, more than one internal
|
||||||
// substep might be taken, resulting in potentially even more
|
// substep might be taken, resulting in potentially even more
|
||||||
// duplicates. To handle this, all collisions (i.e. pair of objects)
|
// duplicates. To handle this, all collisions (i.e. pair of objects)
|
||||||
// are stored in a vector, but only one entry per collision pair
|
// are stored in a vector, but only one entry per collision pair
|
||||||
// of objects.
|
// of objects.
|
||||||
@ -61,23 +52,21 @@ private:
|
|||||||
class CollisionPair {
|
class CollisionPair {
|
||||||
public:
|
public:
|
||||||
const UserPointer *a, *b;
|
const UserPointer *a, *b;
|
||||||
|
|
||||||
// The entries in Collision Pairs are sorted: if a projectile
|
// The entries in Collision Pairs are sorted: if a projectile
|
||||||
// is included, it's always 'a'. If only two karts are reported
|
// is included, it's always 'a'. If only two karts are reported
|
||||||
// the first kart pointer is the smaller one
|
// the first kart pointer is the smaller one
|
||||||
CollisionPair(const UserPointer *a1, const UserPointer *b1) {
|
CollisionPair(const UserPointer *a1, const UserPointer *b1) {
|
||||||
if(a1->is(UserPointer::UP_KART) &&
|
if(a1->is(UserPointer::UP_KART) &&
|
||||||
b1->is(UserPointer::UP_KART) && a1>b1) {
|
b1->is(UserPointer::UP_KART) && a1>b1) {
|
||||||
a=b1;b=a1;
|
a=b1;b=a1;
|
||||||
} else {
|
} else {
|
||||||
a=a1; b=b1;
|
a=a1; b=b1;
|
||||||
}
|
}
|
||||||
}; // CollisionPair
|
}; // CollisionPair
|
||||||
bool operator==(const CollisionPair p) {
|
bool operator==(const CollisionPair p) {return (p.a==a && p.b==b);}
|
||||||
return (p.a==a && p.b==b);
|
}; // CollisionPair
|
||||||
} // operator==
|
|
||||||
}; // CollisionPair
|
|
||||||
// ------------------------------------------------------------------------
|
|
||||||
// This class is the list of collision objects, where each collision
|
// This class is the list of collision objects, where each collision
|
||||||
// pair is stored as most once.
|
// pair is stored as most once.
|
||||||
class CollisionList : public std::vector<CollisionPair> {
|
class CollisionList : public std::vector<CollisionPair> {
|
||||||
@ -88,20 +77,28 @@ private:
|
|||||||
if((*i)==p) return;
|
if((*i)==p) return;
|
||||||
}
|
}
|
||||||
std::vector<CollisionPair>::push_back(p);
|
std::vector<CollisionPair>::push_back(p);
|
||||||
}; // push_back
|
}; // push_back
|
||||||
public:
|
public:
|
||||||
void push_back(const UserPointer* a, const UserPointer*b) {
|
void push_back(const UserPointer* a, const UserPointer*b) {
|
||||||
push_back(CollisionPair(a, b));
|
push_back(CollisionPair(a, b));
|
||||||
}
|
}
|
||||||
}; // CollisionList
|
}; // CollisionList
|
||||||
// ------------------------------------------------------------------------
|
|
||||||
CollisionList m_all_collisions;
|
btDynamicsWorld *m_dynamics_world;
|
||||||
|
#ifdef HAVE_GLUT
|
||||||
|
GLDebugDrawer *m_debug_drawer;
|
||||||
|
GL_ShapeDrawer m_shape_drawer;
|
||||||
|
#endif
|
||||||
|
btCollisionDispatcher *m_dispatcher;
|
||||||
|
btBroadphaseInterface *m_axis_sweep;
|
||||||
|
btDefaultCollisionConfiguration *m_collision_conf;
|
||||||
|
CollisionList m_all_collisions;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Physics ();
|
Physics ();
|
||||||
~Physics ();
|
~Physics ();
|
||||||
void init (const Vec3 &min_world, const Vec3 &max_world);
|
void init (const Vec3 &min_world, const Vec3 &max_world);
|
||||||
void addKart (const Kart *k, btKart *v);
|
void addKart (const Kart *k);
|
||||||
void addBody (btRigidBody* b) {m_dynamics_world->addRigidBody(b);}
|
void addBody (btRigidBody* b) {m_dynamics_world->addRigidBody(b);}
|
||||||
void removeKart (const Kart *k);
|
void removeKart (const Kart *k);
|
||||||
void removeBody (btRigidBody* b) {m_dynamics_world->removeRigidBody(b);}
|
void removeBody (btRigidBody* b) {m_dynamics_world->removeRigidBody(b);}
|
||||||
@ -118,6 +115,5 @@ public:
|
|||||||
btIDebugDraw* debugDrawer, btStackAlloc* stackAlloc,
|
btIDebugDraw* debugDrawer, btStackAlloc* stackAlloc,
|
||||||
btDispatcher* dispatcher);
|
btDispatcher* dispatcher);
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
/* EOF */
|
|
||||||
|
|
||||||
|
#endif // HEADER_PHYSICS_HPP
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include "track_manager.hpp"
|
|
||||||
#include "unlock_manager.hpp"
|
#include "unlock_manager.hpp"
|
||||||
#include "modes/world.hpp"
|
#include "modes/world.hpp"
|
||||||
#include "scene.hpp"
|
#include "scene.hpp"
|
||||||
@ -33,6 +32,7 @@
|
|||||||
#include "modes/standard_race.hpp"
|
#include "modes/standard_race.hpp"
|
||||||
#include "modes/follow_the_leader.hpp"
|
#include "modes/follow_the_leader.hpp"
|
||||||
#include "modes/three_strikes_battle.hpp"
|
#include "modes/three_strikes_battle.hpp"
|
||||||
|
#include "tracks/track_manager.hpp"
|
||||||
|
|
||||||
RaceManager* race_manager= NULL;
|
RaceManager* race_manager= NULL;
|
||||||
|
|
||||||
|
@ -24,6 +24,13 @@
|
|||||||
#include "constants.hpp"
|
#include "constants.hpp"
|
||||||
#include "track.hpp"
|
#include "track.hpp"
|
||||||
|
|
||||||
|
TerrainInfo::TerrainInfo(int frequency)
|
||||||
|
{
|
||||||
|
m_HoT_frequency=frequency;
|
||||||
|
m_HoT_counter=frequency;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
TerrainInfo::TerrainInfo(const Vec3 &pos, int frequency)
|
TerrainInfo::TerrainInfo(const Vec3 &pos, int frequency)
|
||||||
{
|
{
|
||||||
m_HoT_frequency = frequency;
|
m_HoT_frequency = frequency;
|
||||||
@ -37,8 +44,8 @@ void TerrainInfo::update(const Vec3& pos)
|
|||||||
m_HoT_counter++;
|
m_HoT_counter++;
|
||||||
if(m_HoT_counter>=m_HoT_frequency)
|
if(m_HoT_counter>=m_HoT_frequency)
|
||||||
{
|
{
|
||||||
RaceManager::getTrack()->getTerrainInfo(pos, &m_HoT,
|
RaceManager::getTrack()->getTerrainInfo(pos, &m_HoT,
|
||||||
&m_normal, &m_material);
|
&m_normal, &m_material);
|
||||||
m_normal.normalize();
|
m_normal.normalize();
|
||||||
m_HoT_counter = 0;
|
m_HoT_counter = 0;
|
||||||
}
|
}
|
||||||
@ -56,13 +63,9 @@ float TerrainInfo::getTerrainPitch(float heading) const {
|
|||||||
// (x,y,0). (x,y,0) is normalised, so are the coordinates of the plane,
|
// (x,y,0). (x,y,0) is normalised, so are the coordinates of the plane,
|
||||||
// simplifying the computation of the scalar product.
|
// simplifying the computation of the scalar product.
|
||||||
float pitch = ( m_normal.getX()*X + m_normal.getY()*Y ); // use ( x,y,0)
|
float pitch = ( m_normal.getX()*X + m_normal.getY()*Y ); // use ( x,y,0)
|
||||||
|
|
||||||
// The actual angle computed above is between the normal and the (x,y,0)
|
// The actual angle computed above is between the normal and the (x,y,0)
|
||||||
// line, so to compute the actual angles 90 degrees must be subtracted.
|
// line, so to compute the actual angles 90 degrees must be subtracted.
|
||||||
pitch = acosf(pitch) - NINETY_DEGREE_RAD;
|
pitch = acosf(pitch) - NINETY_DEGREE_RAD;
|
||||||
return pitch;
|
return pitch;
|
||||||
} // getTerrainPitch
|
} // getTerrainPitch
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/* EOF */
|
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
// along with this program; if not, write to the Free Software
|
// along with this program; if not, write to the Free Software
|
||||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#ifndef HEADER_TERRAIN_INFO_H
|
#ifndef HEADER_TERRAIN_INFO_HPP
|
||||||
#define HEADER_TERRAIN_INFO_H
|
#define HEADER_TERRAIN_INFO_HPP
|
||||||
|
|
||||||
#include "material.hpp"
|
#include "material.hpp"
|
||||||
#include "utils/vec3.hpp"
|
#include "utils/vec3.hpp"
|
||||||
@ -36,16 +36,16 @@ private:
|
|||||||
float m_HoT; // height of terrain
|
float m_HoT; // height of terrain
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TerrainInfo(int frequency=1) {m_HoT_frequency=frequency;
|
TerrainInfo(int frequency=1);
|
||||||
m_HoT_counter=frequency; }
|
TerrainInfo(const Vec3 &pos, int frequency=1);
|
||||||
TerrainInfo(const Vec3 &pos, int frequency=1);
|
virtual ~TerrainInfo() {};
|
||||||
virtual ~TerrainInfo() {};
|
|
||||||
virtual void update(const Vec3 &pos);
|
|
||||||
float getHoT() const { return m_HoT; }
|
|
||||||
const Material *getMaterial() const { return m_material; }
|
|
||||||
const Vec3 &getNormal() const { return m_normal; }
|
|
||||||
float getTerrainPitch(float heading) const;
|
|
||||||
|
|
||||||
}; // TerrainInfo
|
virtual void update(const Vec3 &pos);
|
||||||
|
|
||||||
#endif
|
float getHoT() const {return m_HoT; }
|
||||||
|
const Material *getMaterial() const {return m_material;}
|
||||||
|
const Vec3 &getNormal() const {return m_normal; }
|
||||||
|
float getTerrainPitch(float heading) const;
|
||||||
|
}; // TerrainInfo
|
||||||
|
|
||||||
|
#endif // HEADER_TERRAIN_INFO_HPP
|
||||||
|
@ -28,20 +28,20 @@
|
|||||||
#include "file_manager.hpp"
|
#include "file_manager.hpp"
|
||||||
#include "loader.hpp"
|
#include "loader.hpp"
|
||||||
#include "string_utils.hpp"
|
#include "string_utils.hpp"
|
||||||
#include "lisp/lisp.hpp"
|
|
||||||
#include "lisp/parser.hpp"
|
|
||||||
#include "stk_config.hpp"
|
#include "stk_config.hpp"
|
||||||
#include "translation.hpp"
|
#include "translation.hpp"
|
||||||
#include "scene.hpp"
|
#include "scene.hpp"
|
||||||
#include "moving_physics.hpp"
|
|
||||||
#include "modes/world.hpp"
|
|
||||||
#include "material_manager.hpp"
|
#include "material_manager.hpp"
|
||||||
#include "isect.hpp"
|
#include "isect.hpp"
|
||||||
#include "user_config.hpp"
|
#include "user_config.hpp"
|
||||||
|
#include "audio/sound_manager.hpp"
|
||||||
#include "items/item.hpp"
|
#include "items/item.hpp"
|
||||||
#include "items/item_manager.hpp"
|
#include "items/item_manager.hpp"
|
||||||
|
#include "lisp/lisp.hpp"
|
||||||
|
#include "lisp/parser.hpp"
|
||||||
|
#include "modes/world.hpp"
|
||||||
|
#include "physics/moving_physics.hpp"
|
||||||
#include "race_manager.hpp"
|
#include "race_manager.hpp"
|
||||||
#include "audio/sound_manager.hpp"
|
|
||||||
#include "utils/ssg_help.hpp"
|
#include "utils/ssg_help.hpp"
|
||||||
|
|
||||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||||
|
@ -25,8 +25,8 @@
|
|||||||
#include "track_manager.hpp"
|
#include "track_manager.hpp"
|
||||||
#include "track.hpp"
|
#include "track.hpp"
|
||||||
#include "stk_config.hpp"
|
#include "stk_config.hpp"
|
||||||
#include "audio/sound_manager.hpp"
|
|
||||||
#include "translation.hpp"
|
#include "translation.hpp"
|
||||||
|
#include "audio/sound_manager.hpp"
|
||||||
|
|
||||||
TrackManager* track_manager = 0;
|
TrackManager* track_manager = 0;
|
||||||
|
|
@ -17,8 +17,8 @@
|
|||||||
// along with this program; if not, write to the Free Software
|
// along with this program; if not, write to the Free Software
|
||||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#ifndef HEADER_TRACKMANAGER_H
|
#ifndef HEADER_TRACK_MANAGER_HPP
|
||||||
#define HEADER_TRACKMANAGER_H
|
#define HEADER_TRACK_MANAGER_HPP
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -66,4 +66,4 @@ public:
|
|||||||
|
|
||||||
extern TrackManager* track_manager;
|
extern TrackManager* track_manager;
|
||||||
|
|
||||||
#endif
|
#endif // HEADER_TRACK_MANAGER_HPP
|
@ -159,34 +159,27 @@ void UserConfig::setDefaults()
|
|||||||
Input(Input::IT_KEYBOARD, SDLK_UP),
|
Input(Input::IT_KEYBOARD, SDLK_UP),
|
||||||
Input(Input::IT_MOUSEBUTTON, 4),
|
Input(Input::IT_MOUSEBUTTON, 4),
|
||||||
Input(Input::IT_STICKMOTION, 0, 1, Input::AD_NEGATIVE));
|
Input(Input::IT_STICKMOTION, 0, 1, Input::AD_NEGATIVE));
|
||||||
|
|
||||||
set(GA_CURSOR_DOWN,
|
set(GA_CURSOR_DOWN,
|
||||||
Input(Input::IT_KEYBOARD, SDLK_DOWN),
|
Input(Input::IT_KEYBOARD, SDLK_DOWN),
|
||||||
Input(Input::IT_MOUSEBUTTON, 5),
|
Input(Input::IT_MOUSEBUTTON, 5),
|
||||||
Input(Input::IT_STICKMOTION, 0, 1, Input::AD_POSITIVE));
|
Input(Input::IT_STICKMOTION, 0, 1, Input::AD_POSITIVE));
|
||||||
|
|
||||||
set(GA_CURSOR_LEFT,
|
set(GA_CURSOR_LEFT,
|
||||||
Input(Input::IT_KEYBOARD, SDLK_LEFT),
|
Input(Input::IT_KEYBOARD, SDLK_LEFT),
|
||||||
Input(Input::IT_STICKMOTION, 0, 0, Input::AD_NEGATIVE));
|
Input(Input::IT_STICKMOTION, 0, 0, Input::AD_NEGATIVE));
|
||||||
|
|
||||||
set(GA_CURSOR_RIGHT,
|
set(GA_CURSOR_RIGHT,
|
||||||
Input(Input::IT_KEYBOARD, SDLK_RIGHT),
|
Input(Input::IT_KEYBOARD, SDLK_RIGHT),
|
||||||
Input(Input::IT_STICKMOTION, 0, 0, Input::AD_POSITIVE));
|
Input(Input::IT_STICKMOTION, 0, 0, Input::AD_POSITIVE));
|
||||||
|
|
||||||
set(GA_CLEAR_MAPPING,
|
set(GA_CLEAR_MAPPING,
|
||||||
Input(Input::IT_KEYBOARD, SDLK_BACKSPACE),
|
Input(Input::IT_KEYBOARD, SDLK_BACKSPACE),
|
||||||
Input(Input::IT_STICKBUTTON, 0, 2));
|
Input(Input::IT_STICKBUTTON, 0, 2));
|
||||||
|
|
||||||
set(GA_INC_SCROLL_SPEED,
|
set(GA_INC_SCROLL_SPEED,
|
||||||
Input(Input::IT_KEYBOARD, SDLK_PLUS));
|
Input(Input::IT_KEYBOARD, SDLK_PLUS));
|
||||||
set(GA_INC_SCROLL_SPEED_FAST,
|
set(GA_INC_SCROLL_SPEED_FAST,
|
||||||
Input(Input::IT_KEYBOARD, SDLK_PAGEDOWN));
|
Input(Input::IT_KEYBOARD, SDLK_PAGEDOWN));
|
||||||
|
|
||||||
set(GA_DEC_SCROLL_SPEED,
|
set(GA_DEC_SCROLL_SPEED,
|
||||||
Input(Input::IT_KEYBOARD, SDLK_MINUS));
|
Input(Input::IT_KEYBOARD, SDLK_MINUS));
|
||||||
set(GA_DEC_SCROLL_SPEED_FAST,
|
set(GA_DEC_SCROLL_SPEED_FAST,
|
||||||
Input(Input::IT_KEYBOARD, SDLK_PAGEUP));
|
Input(Input::IT_KEYBOARD, SDLK_PAGEUP));
|
||||||
|
|
||||||
set(GA_TOGGLE_FULLSCREEN,
|
set(GA_TOGGLE_FULLSCREEN,
|
||||||
Input(Input::IT_KEYBOARD, SDLK_F9));
|
Input(Input::IT_KEYBOARD, SDLK_F9));
|
||||||
set(GA_LEAVE_RACE,
|
set(GA_LEAVE_RACE,
|
||||||
@ -212,44 +205,26 @@ void UserConfig::setDefaults()
|
|||||||
// b) prevent loading those defaults if config file contains any bindings
|
// b) prevent loading those defaults if config file contains any bindings
|
||||||
|
|
||||||
/* Player 1 default input settings */
|
/* Player 1 default input settings */
|
||||||
set(GA_P1_LEFT,
|
set(GA_P1_LEFT, Input(Input::IT_KEYBOARD, SDLK_LEFT));
|
||||||
Input(Input::IT_KEYBOARD, SDLK_LEFT));
|
set(GA_P1_RIGHT, Input(Input::IT_KEYBOARD, SDLK_RIGHT));
|
||||||
set(GA_P1_RIGHT,
|
set(GA_P1_ACCEL, Input(Input::IT_KEYBOARD, SDLK_UP));
|
||||||
Input(Input::IT_KEYBOARD, SDLK_RIGHT));
|
set(GA_P1_BRAKE, Input(Input::IT_KEYBOARD, SDLK_DOWN));
|
||||||
set(GA_P1_ACCEL,
|
set(GA_P1_NITRO, Input(Input::IT_KEYBOARD, SDLK_l));
|
||||||
Input(Input::IT_KEYBOARD, SDLK_UP));
|
set(GA_P1_DRIFT, Input(Input::IT_KEYBOARD, SDLK_k));
|
||||||
set(GA_P1_BRAKE,
|
set(GA_P1_RESCUE, Input(Input::IT_KEYBOARD, SDLK_h));
|
||||||
Input(Input::IT_KEYBOARD, SDLK_DOWN));
|
set(GA_P1_FIRE, Input(Input::IT_KEYBOARD, SDLK_SPACE));
|
||||||
set(GA_P1_NITRO,
|
set(GA_P1_LOOK_BACK, Input(Input::IT_KEYBOARD, SDLK_j));
|
||||||
Input(Input::IT_KEYBOARD, SDLK_l));
|
|
||||||
set(GA_P1_DRIFT,
|
|
||||||
Input(Input::IT_KEYBOARD, SDLK_k));
|
|
||||||
set(GA_P1_RESCUE,
|
|
||||||
Input(Input::IT_KEYBOARD, SDLK_h));
|
|
||||||
set(GA_P1_FIRE,
|
|
||||||
Input(Input::IT_KEYBOARD, SDLK_SPACE));
|
|
||||||
set(GA_P1_LOOK_BACK,
|
|
||||||
Input(Input::IT_KEYBOARD, SDLK_j));
|
|
||||||
|
|
||||||
/* Player 2 default input settings */
|
/* Player 2 default input settings */
|
||||||
set(GA_P2_LEFT,
|
set(GA_P2_LEFT, Input(Input::IT_KEYBOARD, SDLK_a));
|
||||||
Input(Input::IT_KEYBOARD, SDLK_a));
|
set(GA_P2_RIGHT, Input(Input::IT_KEYBOARD, SDLK_d));
|
||||||
set(GA_P2_RIGHT,
|
set(GA_P2_ACCEL, Input(Input::IT_KEYBOARD, SDLK_w));
|
||||||
Input(Input::IT_KEYBOARD, SDLK_d));
|
set(GA_P2_BRAKE, Input(Input::IT_KEYBOARD, SDLK_s));
|
||||||
set(GA_P2_ACCEL,
|
set(GA_P2_NITRO, Input(Input::IT_KEYBOARD, SDLK_LSHIFT));
|
||||||
Input(Input::IT_KEYBOARD, SDLK_w));
|
set(GA_P2_DRIFT, Input(Input::IT_KEYBOARD, SDLK_CAPSLOCK));
|
||||||
set(GA_P2_BRAKE,
|
set(GA_P2_RESCUE, Input(Input::IT_KEYBOARD, SDLK_q));
|
||||||
Input(Input::IT_KEYBOARD, SDLK_s));
|
set(GA_P2_FIRE, Input(Input::IT_KEYBOARD, SDLK_LCTRL));
|
||||||
set(GA_P2_NITRO,
|
set(GA_P2_LOOK_BACK, Input(Input::IT_KEYBOARD, SDLK_LALT));
|
||||||
Input(Input::IT_KEYBOARD, SDLK_LSHIFT));
|
|
||||||
set(GA_P2_DRIFT,
|
|
||||||
Input(Input::IT_KEYBOARD, SDLK_CAPSLOCK));
|
|
||||||
set(GA_P2_RESCUE,
|
|
||||||
Input(Input::IT_KEYBOARD, SDLK_q));
|
|
||||||
set(GA_P2_FIRE,
|
|
||||||
Input(Input::IT_KEYBOARD, SDLK_LCTRL));
|
|
||||||
set(GA_P2_LOOK_BACK,
|
|
||||||
Input(Input::IT_KEYBOARD, SDLK_LALT));
|
|
||||||
|
|
||||||
// If the same key is used for more than one player, the setting
|
// If the same key is used for more than one player, the setting
|
||||||
// is overwritten when reading back the file. To allow us to have
|
// is overwritten when reading back the file. To allow us to have
|
||||||
@ -259,44 +234,26 @@ void UserConfig::setDefaults()
|
|||||||
#undef DEFAULTS_FOR_PLAYER34
|
#undef DEFAULTS_FOR_PLAYER34
|
||||||
#ifdef DEFAULTS_FOR_PLAYER34
|
#ifdef DEFAULTS_FOR_PLAYER34
|
||||||
/* Player 3 default input settings */
|
/* Player 3 default input settings */
|
||||||
set(GA_P3_LEFT,
|
set(GA_P3_LEFT, Input(Input::IT_KEYBOARD, SDLK_f));
|
||||||
Input(Input::IT_KEYBOARD, SDLK_f));
|
set(GA_P3_RIGHT, Input(Input::IT_KEYBOARD, SDLK_h));
|
||||||
set(GA_P3_RIGHT,
|
set(GA_P3_ACCEL, Input(Input::IT_KEYBOARD, SDLK_t));
|
||||||
Input(Input::IT_KEYBOARD, SDLK_h));
|
set(GA_P3_BRAKE, Input(Input::IT_KEYBOARD, SDLK_g));
|
||||||
set(GA_P3_ACCEL,
|
set(GA_P3_NITRO, Input(Input::IT_KEYBOARD, SDLK_c));
|
||||||
Input(Input::IT_KEYBOARD, SDLK_t));
|
set(GA_P3_DRIFT, Input(Input::IT_KEYBOARD, SDLK_v));
|
||||||
set(GA_P3_BRAKE,
|
set(GA_P3_RESCUE, Input(Input::IT_KEYBOARD, SDLK_r));
|
||||||
Input(Input::IT_KEYBOARD, SDLK_g));
|
set(GA_P3_FIRE, Input(Input::IT_KEYBOARD, SDLK_b));
|
||||||
set(GA_P3_NITRO,
|
set(GA_P3_LOOK_BACK, Input(Input::IT_KEYBOARD, SDLK_n));
|
||||||
Input(Input::IT_KEYBOARD, SDLK_c));
|
|
||||||
set(GA_P3_DRIFT,
|
|
||||||
Input(Input::IT_KEYBOARD, SDLK_v));
|
|
||||||
set(GA_P3_RESCUE,
|
|
||||||
Input(Input::IT_KEYBOARD, SDLK_r));
|
|
||||||
set(GA_P3_FIRE,
|
|
||||||
Input(Input::IT_KEYBOARD, SDLK_b));
|
|
||||||
set(GA_P3_LOOK_BACK,
|
|
||||||
Input(Input::IT_KEYBOARD, SDLK_n));
|
|
||||||
|
|
||||||
/* Player 4 default input settings */
|
/* Player 4 default input settings */
|
||||||
set(GA_P4_LEFT,
|
set(GA_P4_LEFT, Input(Input::IT_KEYBOARD, SDLK_j));
|
||||||
Input(Input::IT_KEYBOARD, SDLK_j));
|
set(GA_P4_RIGHT, Input(Input::IT_KEYBOARD, SDLK_l));
|
||||||
set(GA_P4_RIGHT,
|
set(GA_P4_ACCEL, Input(Input::IT_KEYBOARD, SDLK_i));
|
||||||
Input(Input::IT_KEYBOARD, SDLK_l));
|
set(GA_P4_BRAKE, Input(Input::IT_KEYBOARD, SDLK_k));
|
||||||
set(GA_P4_ACCEL,
|
set(GA_P4_NITRO, Input(Input::IT_KEYBOARD, SDLK_m));
|
||||||
Input(Input::IT_KEYBOARD, SDLK_i));
|
set(GA_P4_DRIFT, Input(Input::IT_KEYBOARD, SDLK_COMMA));
|
||||||
set(GA_P4_BRAKE,
|
set(GA_P4_RESCUE, Input(Input::IT_KEYBOARD, SDLK_u));
|
||||||
Input(Input::IT_KEYBOARD, SDLK_k));
|
set(GA_P4_FIRE, Input(Input::IT_KEYBOARD, SDLK_PERIOD));
|
||||||
set(GA_P4_NITRO,
|
set(GA_P4_LOOK_BACK, Input(Input::IT_KEYBOARD, SDLK_SLASH));
|
||||||
Input(Input::IT_KEYBOARD, SDLK_m));
|
|
||||||
set(GA_P4_DRIFT,
|
|
||||||
Input(Input::IT_KEYBOARD, SDLK_COMMA));
|
|
||||||
set(GA_P4_RESCUE,
|
|
||||||
Input(Input::IT_KEYBOARD, SDLK_u));
|
|
||||||
set(GA_P4_FIRE,
|
|
||||||
Input(Input::IT_KEYBOARD, SDLK_PERIOD));
|
|
||||||
set(GA_P4_LOOK_BACK,
|
|
||||||
Input(Input::IT_KEYBOARD, SDLK_SLASH));
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} // setDefaults
|
} // setDefaults
|
||||||
@ -354,7 +311,6 @@ int UserConfig::CheckAndCreateDir()
|
|||||||
printf("Config directory '%s' successfully created.\n",DIRNAME.c_str());
|
printf("Config directory '%s' successfully created.\n",DIRNAME.c_str());
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // CheckAndCreateDir
|
} // CheckAndCreateDir
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
@ -377,7 +333,7 @@ void UserConfig::loadConfig(const std::string& filename)
|
|||||||
catch(std::exception& e)
|
catch(std::exception& e)
|
||||||
{
|
{
|
||||||
(void)e; // avoid warning about unreferenced local variable
|
(void)e; // avoid warning about unreferenced local variable
|
||||||
printf("Config file '%s' does not exist, it will be created.\n",
|
printf("Config file '%s' does not exist, it will be created.\n",
|
||||||
filename.c_str());
|
filename.c_str());
|
||||||
// This will initialise the last input configuration with the
|
// This will initialise the last input configuration with the
|
||||||
// default values from the current (=default) player input
|
// default values from the current (=default) player input
|
||||||
@ -461,13 +417,13 @@ void UserConfig::loadConfig(const std::string& filename)
|
|||||||
/*get resolution width/height*/
|
/*get resolution width/height*/
|
||||||
lisp->get("width", m_width);
|
lisp->get("width", m_width);
|
||||||
lisp->get("height", m_height);
|
lisp->get("height", m_height);
|
||||||
lisp->get("prev_width", m_prev_width);
|
lisp->get("prev_width", m_prev_width);
|
||||||
lisp->get("prev_height", m_prev_height);
|
lisp->get("prev_height", m_prev_height);
|
||||||
lisp->get("prev_windowed", m_prev_windowed);
|
lisp->get("prev_windowed", m_prev_windowed);
|
||||||
//detect if resolution change previously crashed STK
|
//detect if resolution change previously crashed STK
|
||||||
lisp->get("crash_detected", m_crashed);
|
lisp->get("crash_detected", m_crashed);
|
||||||
// blacklisted resolutions
|
// blacklisted resolutions
|
||||||
lisp->getVector("blacklisted_resolutions",
|
lisp->getVector("blacklisted_resolutions",
|
||||||
m_blacklist_res);
|
m_blacklist_res);
|
||||||
/*Get default number of karts, number of laps, and difficulty. */
|
/*Get default number of karts, number of laps, and difficulty. */
|
||||||
lisp->get("karts", m_num_karts);
|
lisp->get("karts", m_num_karts);
|
||||||
@ -507,9 +463,9 @@ void UserConfig::loadConfig(const std::string& filename)
|
|||||||
}
|
}
|
||||||
std::string name;
|
std::string name;
|
||||||
reader->get("name", name);
|
reader->get("name", name);
|
||||||
if (configFileVersion <= 3)
|
if (configFileVersion <= 3)
|
||||||
{
|
{
|
||||||
// For older config files, replace the default player
|
// For older config files, replace the default player
|
||||||
// names "Player %d" with the user name
|
// names "Player %d" with the user name
|
||||||
char sDefaultName[10];
|
char sDefaultName[10];
|
||||||
snprintf(sDefaultName, sizeof(sDefaultName),
|
snprintf(sDefaultName, sizeof(sDefaultName),
|
||||||
@ -524,14 +480,14 @@ void UserConfig::loadConfig(const std::string& filename)
|
|||||||
reader->get("lastKartId", lastKartId);
|
reader->get("lastKartId", lastKartId);
|
||||||
m_player[i].setLastKartId(lastKartId);
|
m_player[i].setLastKartId(lastKartId);
|
||||||
|
|
||||||
// Don't read the key bindings from a config file earlier than
|
// Don't read the key bindings from a config file earlier than
|
||||||
// version 5. These config files contain (unused) keybindings for
|
// version 5. These config files contain (unused) keybindings for
|
||||||
// jumping, so it is possible that the same key is used for
|
// jumping, so it is possible that the same key is used for
|
||||||
// jumping for player 1 and something else for another player.
|
// jumping for player 1 and something else for another player.
|
||||||
// In this case jumping for player one would be disabled (see
|
// In this case jumping for player one would be disabled (see
|
||||||
// unsetDuplicates). To be on the safe side, old key bindings
|
// unsetDuplicates). To be on the safe side, old key bindings
|
||||||
// are just discarded.
|
// are just discarded.
|
||||||
if (configFileVersion <= 4)
|
if (configFileVersion <= 4)
|
||||||
{
|
{
|
||||||
m_warning=_("Old config file found, check your key bindings!");
|
m_warning=_("Old config file found, check your key bindings!");
|
||||||
} // configFileVersion <= 4
|
} // configFileVersion <= 4
|
||||||
@ -545,8 +501,8 @@ void UserConfig::loadConfig(const std::string& filename)
|
|||||||
// Leave those in for backwards compatibility (i.e. config files
|
// Leave those in for backwards compatibility (i.e. config files
|
||||||
// with jump/wheelie). If jump/wheelie are not defined, nothing
|
// with jump/wheelie). If jump/wheelie are not defined, nothing
|
||||||
// happens (the same input is read again).
|
// happens (the same input is read again).
|
||||||
readPlayerInput(reader, nitro_name, KA_NITRO, i);
|
readPlayerInput(reader, nitro_name, KA_NITRO, i);
|
||||||
readPlayerInput(reader, drift_name, KA_DRIFT, i);
|
readPlayerInput(reader, drift_name, KA_DRIFT, i);
|
||||||
} // for i < PLAYERS
|
} // for i < PLAYERS
|
||||||
|
|
||||||
// Read the last input device configurations. It is important that this
|
// Read the last input device configurations. It is important that this
|
||||||
@ -554,7 +510,6 @@ void UserConfig::loadConfig(const std::string& filename)
|
|||||||
// is given, the last config is initialised with the current player
|
// is given, the last config is initialised with the current player
|
||||||
// config.
|
// config.
|
||||||
readLastInputConfigurations(lisp);
|
readLastInputConfigurations(lisp);
|
||||||
|
|
||||||
}
|
}
|
||||||
catch(std::exception& e)
|
catch(std::exception& e)
|
||||||
{
|
{
|
||||||
@ -563,12 +518,10 @@ void UserConfig::loadConfig(const std::string& filename)
|
|||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
delete root;
|
delete root;
|
||||||
} // loadConfig
|
} // loadConfig
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
void UserConfig::readStickConfigs(const lisp::Lisp *r)
|
void UserConfig::readStickConfigs(const lisp::Lisp *r)
|
||||||
{
|
{
|
||||||
std::string temp;
|
std::string temp;
|
||||||
@ -597,9 +550,7 @@ void UserConfig::readStickConfigs(const lisp::Lisp *r)
|
|||||||
m_stickconfigs.push_back(sc);
|
m_stickconfigs.push_back(sc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // readStickConfigs
|
} // readStickConfigs
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
@ -611,7 +562,7 @@ void UserConfig::readStickConfigs(const lisp::Lisp *r)
|
|||||||
*/
|
*/
|
||||||
void UserConfig::readLastInputConfigurations(const lisp::Lisp *reader)
|
void UserConfig::readLastInputConfigurations(const lisp::Lisp *reader)
|
||||||
{
|
{
|
||||||
const lisp::Lisp* nodeReader = reader
|
const lisp::Lisp* nodeReader = reader
|
||||||
? reader->getLisp("last-input-configurations")
|
? reader->getLisp("last-input-configurations")
|
||||||
: NULL;
|
: NULL;
|
||||||
// No last input configuration specified. Use the current player mappings
|
// No last input configuration specified. Use the current player mappings
|
||||||
@ -649,7 +600,6 @@ void UserConfig::readLastInputConfigurations(const lisp::Lisp *reader)
|
|||||||
m_last_input_configuration[device_name].m_input[ka] = input;
|
m_last_input_configuration[device_name].m_input[ka] = input;
|
||||||
} // for ka=KA_FIRST, KA_LAST
|
} // for ka=KA_FIRST, KA_LAST
|
||||||
} // for i<count
|
} // for i<count
|
||||||
|
|
||||||
} // readLastInputConfigurations
|
} // readLastInputConfigurations
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
@ -678,7 +628,6 @@ void UserConfig::readInputNode(const lisp::Lisp* r, const std::string &node,
|
|||||||
{
|
{
|
||||||
setInput(action, input);
|
setInput(action, input);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // readInputNode
|
} // readInputNode
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
@ -732,13 +681,6 @@ Input UserConfig::readInput(const lisp::Lisp* nodeReader)
|
|||||||
return input;
|
return input;
|
||||||
} // readInput
|
} // readInput
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
/** Call saveConfig with the default filename for this platform. */
|
|
||||||
void UserConfig::saveConfig()
|
|
||||||
{
|
|
||||||
saveConfig(m_filename);
|
|
||||||
} // saveConfig
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
/** Write settings to config file. */
|
/** Write settings to config file. */
|
||||||
void UserConfig::saveConfig(const std::string& filename)
|
void UserConfig::saveConfig(const std::string& filename)
|
||||||
@ -847,12 +789,11 @@ void UserConfig::saveConfig(const std::string& filename)
|
|||||||
fprintf(stderr, e.what());
|
fprintf(stderr, e.what());
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
delete writer;
|
delete writer;
|
||||||
} // saveConfig
|
} // saveConfig
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
void UserConfig::writeStickConfigs(lisp::Writer *writer)
|
void UserConfig::writeStickConfigs(lisp::Writer *writer)
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
@ -922,7 +863,7 @@ void UserConfig::writePlayerInput(lisp::Writer *writer, const std::string &node,
|
|||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
void UserConfig::writeInputNode(lisp::Writer *writer, const std::string &node,
|
void UserConfig::writeInputNode(lisp::Writer *writer, const std::string &node,
|
||||||
GameAction action)
|
GameAction action)
|
||||||
{
|
{
|
||||||
writer->beginList(node);
|
writer->beginList(node);
|
||||||
|
|
||||||
@ -981,7 +922,7 @@ std::string UserConfig::getInputAsString(const Input &input)
|
|||||||
{
|
{
|
||||||
char msg[MAX_MESSAGE_LENGTH];
|
char msg[MAX_MESSAGE_LENGTH];
|
||||||
std::ostringstream stm;
|
std::ostringstream stm;
|
||||||
|
|
||||||
switch (input.type)
|
switch (input.type)
|
||||||
{
|
{
|
||||||
case Input::IT_NONE:
|
case Input::IT_NONE:
|
||||||
@ -1011,9 +952,9 @@ std::string UserConfig::getInputAsString(const Input &input)
|
|||||||
default:
|
default:
|
||||||
snprintf(msg, sizeof(msg), _("Invalid"));
|
snprintf(msg, sizeof(msg), _("Invalid"));
|
||||||
}
|
}
|
||||||
|
|
||||||
stm << msg;
|
stm << msg;
|
||||||
|
|
||||||
return stm.str();
|
return stm.str();
|
||||||
} // GetKeyAsString
|
} // GetKeyAsString
|
||||||
|
|
||||||
@ -1120,13 +1061,13 @@ std::string UserConfig::getInputDeviceName(int player_index) const
|
|||||||
{
|
{
|
||||||
case Input::IT_KEYBOARD : { // config name: keyboard+player_index
|
case Input::IT_KEYBOARD : { // config name: keyboard+player_index
|
||||||
std::ostringstream s;
|
std::ostringstream s;
|
||||||
s<<"keyboard-"<<left_input.id0;
|
s<<"keyboard-"<<left_input.id0;
|
||||||
config_name = s.str();
|
config_name = s.str();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Input::IT_STICKBUTTON :
|
case Input::IT_STICKBUTTON :
|
||||||
case Input::IT_STICKHAT :
|
case Input::IT_STICKHAT :
|
||||||
case Input::IT_STICKMOTION : config_name=m_stickconfigs[left_input.id0]->m_id;
|
case Input::IT_STICKMOTION : config_name=m_stickconfigs[left_input.id0]->m_id;
|
||||||
break;
|
break;
|
||||||
case Input::IT_MOUSEBUTTON :
|
case Input::IT_MOUSEBUTTON :
|
||||||
case Input::IT_MOUSEMOTION : config_name="mouse"; break;
|
case Input::IT_MOUSEMOTION : config_name="mouse"; break;
|
||||||
@ -1134,6 +1075,7 @@ std::string UserConfig::getInputDeviceName(int player_index) const
|
|||||||
} // switch left_input.type
|
} // switch left_input.type
|
||||||
return config_name;
|
return config_name;
|
||||||
} // getInputDeviceName
|
} // getInputDeviceName
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
void UserConfig::setInput(int player_index, KartAction ka, const Input &input)
|
void UserConfig::setInput(int player_index, KartAction ka, const Input &input)
|
||||||
{
|
{
|
||||||
@ -1141,7 +1083,7 @@ void UserConfig::setInput(int player_index, KartAction ka, const Input &input)
|
|||||||
+ player_index * KC_COUNT + ka),
|
+ player_index * KC_COUNT + ka),
|
||||||
input);
|
input);
|
||||||
|
|
||||||
// Now save the (complete) current configuration as the last used
|
// Now save the (complete) current configuration as the last used
|
||||||
// configuration for the input device that is defined for the left
|
// configuration for the input device that is defined for the left
|
||||||
// action. First determine the name of the device, and then
|
// action. First determine the name of the device, and then
|
||||||
// copy the configuration.
|
// copy the configuration.
|
||||||
@ -1159,8 +1101,8 @@ void UserConfig::setInput(int player_index, KartAction ka, const Input &input)
|
|||||||
// to change the left axis for a gamepad anymore.
|
// to change the left axis for a gamepad anymore.
|
||||||
if(i==KA_LEFT) continue;
|
if(i==KA_LEFT) continue;
|
||||||
Input last_inp = m_last_input_configuration[device_name].m_input[(KartAction)i];
|
Input last_inp = m_last_input_configuration[device_name].m_input[(KartAction)i];
|
||||||
if(last_inp.type==Input::IT_STICKBUTTON ||
|
if(last_inp.type==Input::IT_STICKBUTTON ||
|
||||||
last_inp.type==Input::IT_STICKHAT ||
|
last_inp.type==Input::IT_STICKHAT ||
|
||||||
last_inp.type==Input::IT_STICKMOTION )
|
last_inp.type==Input::IT_STICKMOTION )
|
||||||
{ // in case of joystick, adjust the joystick index - in case
|
{ // in case of joystick, adjust the joystick index - in case
|
||||||
// that there are two joystickts with the same name
|
// that there are two joystickts with the same name
|
||||||
@ -1177,7 +1119,7 @@ void UserConfig::setInput(int player_index, KartAction ka, const Input &input)
|
|||||||
// We change an entry (but not left) --> save as new 'last configuration'
|
// We change an entry (but not left) --> save as new 'last configuration'
|
||||||
for(int i=KA_FIRST; i<=KA_LAST; i++)
|
for(int i=KA_FIRST; i<=KA_LAST; i++)
|
||||||
{
|
{
|
||||||
m_last_input_configuration[device_name].m_input[(KartAction)i] =
|
m_last_input_configuration[device_name].m_input[(KartAction)i] =
|
||||||
getInput(player_index, (KartAction)i);
|
getInput(player_index, (KartAction)i);
|
||||||
} // for i=KA_FIRST, KA_LAST
|
} // for i=KA_FIRST, KA_LAST
|
||||||
} // ka!=KA_LEFT
|
} // ka!=KA_LEFT
|
||||||
@ -1234,7 +1176,7 @@ ActionMap *UserConfig::newIngameActionMap()
|
|||||||
// (in MenuManager) and RaceGUI needs race_manager, too.
|
// (in MenuManager) and RaceGUI needs race_manager, too.
|
||||||
|
|
||||||
// TODO: Reorder ingame GameAction values so that they start with
|
// TODO: Reorder ingame GameAction values so that they start with
|
||||||
// the fixed ones. This would allow simpler looking code here.
|
// the fixed ones. This would allow simpler looking code here.
|
||||||
|
|
||||||
GameAction gaEnd = GA_NULL;
|
GameAction gaEnd = GA_NULL;
|
||||||
|
|
||||||
@ -1282,24 +1224,3 @@ bool UserConfig::isFixedInput(Input::InputType type, int id0, int id1, int id2)
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
} // isFixedInput
|
} // isFixedInput
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
void UserConfig::addStickConfig(StickConfig *sc)
|
|
||||||
{
|
|
||||||
m_stickconfigs.push_back(sc);
|
|
||||||
} // addStickConfig
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
const std::vector<UserConfig::StickConfig *> *UserConfig::getStickConfigs() const
|
|
||||||
{
|
|
||||||
return &m_stickconfigs;
|
|
||||||
} // getStickConfigs
|
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
UserConfig::StickConfig::StickConfig(const std::string &newId)
|
|
||||||
: m_id(newId)
|
|
||||||
{
|
|
||||||
// Nothing else to do.
|
|
||||||
}
|
|
||||||
|
|
||||||
/*EOF*/
|
|
||||||
|
@ -18,8 +18,8 @@
|
|||||||
// along with this program; if not, write to the Free Software
|
// along with this program; if not, write to the Free Software
|
||||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#ifndef HEADER_USERCONFIG_HPP
|
#ifndef HEADER_USER_CONFIG_HPP
|
||||||
#define HEADER_USERCONFIG_HPP
|
#define HEADER_USER_CONFIG_HPP
|
||||||
|
|
||||||
#define PLAYERS 4
|
#define PLAYERS 4
|
||||||
|
|
||||||
@ -59,18 +59,17 @@ class UserConfig
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Stores information about joystick and gamepads. */
|
/** Stores information about joystick and gamepads. */
|
||||||
class StickConfig
|
class StickConfig
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
std::string m_id;
|
std::string m_id;
|
||||||
int m_preferredIndex;
|
int m_preferredIndex;
|
||||||
int m_deadzone;
|
int m_deadzone;
|
||||||
StickConfig(const std::string &id);
|
StickConfig(const std::string &id) : m_id(id) {}
|
||||||
|
};
|
||||||
};
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// This class stores the last used input configuration (i.e. which action
|
// This class stores the last used input configuration (i.e. which action
|
||||||
// is used for left, right, ..., look back) for a certain input
|
// is used for left, right, ..., look back) for a certain input
|
||||||
// device (i.e. keyboard, joystick, ...)
|
// device (i.e. keyboard, joystick, ...)
|
||||||
struct InputConfiguration
|
struct InputConfiguration
|
||||||
@ -84,25 +83,25 @@ private:
|
|||||||
|
|
||||||
std::string getInputDeviceName(int player_index) const;
|
std::string getInputDeviceName(int player_index) const;
|
||||||
|
|
||||||
std::vector <StickConfig *> m_stickconfigs;
|
std::vector <StickConfig *> m_stickconfigs;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int count;
|
int count;
|
||||||
Input inputs[4];
|
Input inputs[4];
|
||||||
} InputMapEntry;
|
} InputMapEntry;
|
||||||
|
|
||||||
/** Filename of the user config file. */
|
/** Filename of the user config file. */
|
||||||
std::string m_filename;
|
std::string m_filename;
|
||||||
|
|
||||||
/** Stores the GameAction->Input mappings in a way that is suitable for
|
/** Stores the GameAction->Input mappings in a way that is suitable for
|
||||||
* quick modification of the mappings. Internally this allows multiple
|
* quick modification of the mappings. Internally this allows multiple
|
||||||
* Input instances per GameAction but the public methods allow only one
|
* Input instances per GameAction but the public methods allow only one
|
||||||
* mapping.
|
* mapping.
|
||||||
*
|
*
|
||||||
* It is named after what is put in as values.
|
* It is named after what is put in as values.
|
||||||
*/
|
*/
|
||||||
InputMapEntry m_input_map[GA_COUNT];
|
InputMapEntry m_input_map[GA_COUNT];
|
||||||
|
|
||||||
void setFilename ();
|
void setFilename ();
|
||||||
int CheckAndCreateDir();
|
int CheckAndCreateDir();
|
||||||
@ -121,67 +120,67 @@ private:
|
|||||||
/** Index of current background image. */
|
/** Index of current background image. */
|
||||||
int m_background_index;
|
int m_background_index;
|
||||||
|
|
||||||
void readStickConfigs(const lisp::Lisp *);
|
void readStickConfigs(const lisp::Lisp *);
|
||||||
void readLastInputConfigurations(const lisp::Lisp *);
|
void readLastInputConfigurations(const lisp::Lisp *);
|
||||||
|
|
||||||
void writeStickConfigs(lisp::Writer *);
|
void writeStickConfigs(lisp::Writer *);
|
||||||
void writeLastInputConfigurations(lisp::Writer *);
|
void writeLastInputConfigurations(lisp::Writer *);
|
||||||
|
|
||||||
void readPlayerInput(const lisp::Lisp *,
|
void readPlayerInput(const lisp::Lisp *,
|
||||||
const std::string& node,
|
const std::string& node,
|
||||||
KartAction ka,
|
KartAction ka,
|
||||||
int);
|
int);
|
||||||
|
|
||||||
void writePlayerInput(lisp::Writer *,
|
void writePlayerInput(lisp::Writer *,
|
||||||
const std::string &node,
|
const std::string &node,
|
||||||
KartAction,
|
KartAction,
|
||||||
int);
|
int);
|
||||||
|
|
||||||
|
|
||||||
void readInputNode(const lisp::Lisp *,
|
void readInputNode(const lisp::Lisp *,
|
||||||
const std::string &node,
|
const std::string &node,
|
||||||
GameAction);
|
GameAction);
|
||||||
|
|
||||||
Input readInput(const lisp::Lisp* nodeReader);
|
Input readInput(const lisp::Lisp* nodeReader);
|
||||||
|
|
||||||
void writeInputNode(lisp::Writer *,
|
void writeInputNode(lisp::Writer *,
|
||||||
const std::string &node,
|
const std::string &node,
|
||||||
GameAction);
|
GameAction);
|
||||||
|
|
||||||
void writeInput(lisp::Writer *writer, const Input &input);
|
void writeInput(lisp::Writer *writer, const Input &input);
|
||||||
|
|
||||||
/** Iterates through the input mapping and unsets all
|
/** Iterates through the input mapping and unsets all
|
||||||
* where the given input occurs.
|
* where the given input occurs.
|
||||||
*
|
*
|
||||||
* This makes sure an input is not bound multiple times.
|
* This makes sure an input is not bound multiple times.
|
||||||
*/
|
*/
|
||||||
void unsetDuplicates(GameAction, const Input &);
|
void unsetDuplicates(GameAction, const Input &);
|
||||||
|
|
||||||
/** Creates an GameAction->Input mapping with one Input */
|
|
||||||
void set(GameAction, const Input &);
|
|
||||||
|
|
||||||
/** Creates an GameAction->Input mapping with two Inputs */
|
|
||||||
void set(GameAction, const Input &, const Input &);
|
|
||||||
|
|
||||||
/** Creates an GameAction->Input mapping with three Inputs */
|
|
||||||
void set(GameAction, const Input &, const Input &, const Input &);
|
|
||||||
|
|
||||||
/** Creates an GameAction->Input mapping with four Inputs */
|
|
||||||
void set(GameAction, const Input &, const Input &, const Input &, const Input &);
|
|
||||||
|
|
||||||
std::string getInputAsString(const Input &);
|
/** Creates an GameAction->Input mapping with one Input */
|
||||||
|
void set(GameAction, const Input &);
|
||||||
|
|
||||||
/** Creates an ActionMap for the GameAction values of the specified
|
/** Creates an GameAction->Input mapping with two Inputs */
|
||||||
* range.
|
void set(GameAction, const Input &, const Input &);
|
||||||
*/
|
|
||||||
ActionMap *newActionMap(const int, const int);
|
/** Creates an GameAction->Input mapping with three Inputs */
|
||||||
|
void set(GameAction, const Input &, const Input &, const Input &);
|
||||||
/** Sets the Input for the given GameAction. Includes a check for
|
|
||||||
* duplicates and automatic removing of the other candidate(s).
|
/** Creates an GameAction->Input mapping with four Inputs */
|
||||||
*
|
void set(GameAction, const Input &, const Input &, const Input &, const Input &);
|
||||||
* For use when reading from file.
|
|
||||||
*/
|
std::string getInputAsString(const Input &);
|
||||||
void setInput(GameAction, const Input &);
|
|
||||||
|
/** Creates an ActionMap for the GameAction values of the specified
|
||||||
|
* range.
|
||||||
|
*/
|
||||||
|
ActionMap *newActionMap(const int, const int);
|
||||||
|
|
||||||
|
/** Sets the Input for the given GameAction. Includes a check for
|
||||||
|
* duplicates and automatic removing of the other candidate(s).
|
||||||
|
*
|
||||||
|
* For use when reading from file.
|
||||||
|
*/
|
||||||
|
void setInput(GameAction, const Input &);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum UC_Mode {UC_ENABLE, UC_DISABLE, UC_TEMPORARY_DISABLE};
|
enum UC_Mode {UC_ENABLE, UC_DISABLE, UC_TEMPORARY_DISABLE};
|
||||||
@ -202,28 +201,29 @@ public:
|
|||||||
std::string m_item_style;
|
std::string m_item_style;
|
||||||
std::string m_username;
|
std::string m_username;
|
||||||
std::string m_background_music;
|
std::string m_background_music;
|
||||||
std::string m_kart_group; //< Kart group used last
|
std::string m_kart_group; /**< Kart group used last. */
|
||||||
std::string m_track_group; //< Track group used last
|
std::string m_track_group; /**< Track group used last. */
|
||||||
std::string m_last_track; //< name of the last track used
|
std::string m_last_track; /**< name of the last track used. */
|
||||||
std::string m_server_address;
|
std::string m_server_address;
|
||||||
int m_server_port;
|
int m_server_port;
|
||||||
bool m_use_kph;
|
bool m_use_kph;
|
||||||
int m_width;
|
int m_width;
|
||||||
int m_height;
|
int m_height;
|
||||||
int m_prev_width;
|
int m_prev_width;
|
||||||
int m_prev_height;
|
int m_prev_height;
|
||||||
bool m_prev_windowed;
|
bool m_prev_windowed;
|
||||||
bool m_crashed;
|
bool m_crashed;
|
||||||
std::vector<std::string> m_blacklist_res;
|
std::vector<std::string>
|
||||||
|
m_blacklist_res;
|
||||||
Player m_player[PLAYERS];
|
Player m_player[PLAYERS];
|
||||||
bool m_log_errors;
|
bool m_log_errors;
|
||||||
|
|
||||||
UserConfig();
|
UserConfig();
|
||||||
UserConfig(const std::string& filename);
|
UserConfig(const std::string& filename);
|
||||||
~UserConfig();
|
~UserConfig();
|
||||||
void setDefaults();
|
void setDefaults();
|
||||||
void setMusic(int m) { m_music = m; }
|
void setMusic(int m) { m_music = m; }
|
||||||
void setSFX (int m) { m_sfx = m; }
|
void setSFX(int m) { m_sfx = m; }
|
||||||
bool doMusic() const { return m_music == UC_ENABLE;}
|
bool doMusic() const { return m_music == UC_ENABLE;}
|
||||||
bool doSFX() const { return m_sfx == UC_ENABLE;}
|
bool doSFX() const { return m_sfx == UC_ENABLE;}
|
||||||
/** Sets the default number of karts. This is only used to store
|
/** Sets the default number of karts. This is only used to store
|
||||||
@ -243,52 +243,50 @@ public:
|
|||||||
void setDefaultNumDifficulty(int n) { m_difficulty = n; }
|
void setDefaultNumDifficulty(int n) { m_difficulty = n; }
|
||||||
/** Returns the default difficulty. */
|
/** Returns the default difficulty. */
|
||||||
int getDefaultDifficulty() const { return m_difficulty; }
|
int getDefaultDifficulty() const { return m_difficulty; }
|
||||||
|
|
||||||
void nextBackgroundIndex();
|
void nextBackgroundIndex();
|
||||||
|
|
||||||
/** Get the index of the background image. */
|
/** Get the index of the background image. */
|
||||||
int getBackgroundIndex() const { return m_background_index; }
|
int getBackgroundIndex() const { return m_background_index; }
|
||||||
|
|
||||||
void loadConfig();
|
void loadConfig();
|
||||||
void loadConfig(const std::string& filename);
|
void loadConfig(const std::string& filename);
|
||||||
void saveConfig();
|
void saveConfig() { saveConfig(m_filename); }
|
||||||
void saveConfig(const std::string& filename);
|
void saveConfig(const std::string& filename);
|
||||||
|
void addStickConfig(UserConfig::StickConfig *sc)
|
||||||
void addStickConfig(UserConfig::StickConfig *);
|
{m_stickconfigs.push_back(sc);}
|
||||||
|
const std::vector<StickConfig *>
|
||||||
const std::vector<StickConfig *> *getStickConfigs() const;
|
*getStickConfigs() const { return &m_stickconfigs; }
|
||||||
|
|
||||||
|
|
||||||
/** Retrieves a human readable string of the mapping for a GameAction */
|
/** Retrieves a human readable string of the mapping for a GameAction */
|
||||||
std::string getMappingAsString(GameAction);
|
std::string getMappingAsString(GameAction);
|
||||||
/** Retrieves a human readable string of the mapping for the given
|
/** Retrieves a human readable string of the mapping for the given
|
||||||
* player and KartAction.
|
* player and KartAction.
|
||||||
*/
|
*/
|
||||||
std::string getMappingAsString(int, KartAction);
|
std::string getMappingAsString(int, KartAction);
|
||||||
|
|
||||||
/** Sets the Input for the given Player and KartAction. Includes a check
|
/** Sets the Input for the given Player and KartAction. Includes a check
|
||||||
* for duplicates and automatic removing of the other candidate(s).
|
* for duplicates and automatic removing of the other candidate(s).
|
||||||
*
|
*
|
||||||
* For use when sensing input.
|
* For use when sensing input.
|
||||||
*/
|
*/
|
||||||
void setInput(int player_number, KartAction ka, const Input &i0);
|
void setInput(int player_number, KartAction ka, const Input &i0);
|
||||||
|
|
||||||
const Input &getInput(int player_index, KartAction ka) const;
|
const Input &getInput(int player_index, KartAction ka) const;
|
||||||
|
|
||||||
/** Clears the mapping for a given Player and KartAction. */
|
/** Clears the mapping for a given Player and KartAction. */
|
||||||
void clearInput(int, KartAction);
|
void clearInput(int, KartAction);
|
||||||
|
bool isFixedInput(Input::InputType, int, int, int);
|
||||||
bool isFixedInput(Input::InputType, int, int, int);
|
const std::string
|
||||||
const std::string& getWarning() {return m_warning;}
|
&getWarning() { return m_warning; }
|
||||||
void resetWarning() {m_warning="";}
|
void resetWarning() { m_warning=""; }
|
||||||
void setWarning(std::string& warning) {m_warning=warning;}
|
void setWarning(std::string& warning) { m_warning=warning; }
|
||||||
|
|
||||||
|
/** Creates ActionMap for use in menu mode. */
|
||||||
|
ActionMap *newMenuActionMap();
|
||||||
|
|
||||||
|
/** Creates ActionMap for use in ingame mode. */
|
||||||
|
ActionMap *newIngameActionMap();
|
||||||
|
|
||||||
/** Creates ActionMap for use in menu mode. */
|
|
||||||
ActionMap *newMenuActionMap();
|
|
||||||
|
|
||||||
/** Creates ActionMap for use in ingame mode. */
|
|
||||||
ActionMap *newIngameActionMap();
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
#include "random_generator.hpp"
|
#include "random_generator.hpp"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <algorithm>
|
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
|
||||||
std::vector<RandomGenerator*> RandomGenerator::m_all_random_generators;
|
std::vector<RandomGenerator*> RandomGenerator::m_all_random_generators;
|
||||||
@ -28,7 +27,7 @@ std::vector<RandomGenerator*> RandomGenerator::m_all_random_generators;
|
|||||||
RandomGenerator::RandomGenerator()
|
RandomGenerator::RandomGenerator()
|
||||||
{
|
{
|
||||||
m_a = 1103515245;
|
m_a = 1103515245;
|
||||||
m_c = 12345;
|
m_c = 12345;
|
||||||
m_all_random_generators.push_back(this);
|
m_all_random_generators.push_back(this);
|
||||||
m_random_value = 3141591;
|
m_random_value = 3141591;
|
||||||
std::srand((unsigned int)std::time(0));
|
std::srand((unsigned int)std::time(0));
|
||||||
@ -42,32 +41,19 @@ std::vector<int> RandomGenerator::generateAllSeeds()
|
|||||||
{
|
{
|
||||||
int seed = rand();
|
int seed = rand();
|
||||||
all_seeds.push_back(seed);
|
all_seeds.push_back(seed);
|
||||||
|
m_all_random_generators[i]->seed(seed);
|
||||||
}
|
}
|
||||||
seedAll(all_seeds);
|
|
||||||
return all_seeds;
|
return all_seeds;
|
||||||
|
|
||||||
} // generateAllSeeds
|
} // generateAllSeeds
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
void RandomGenerator::seedAll(std::vector<int> all_seeds)
|
|
||||||
{
|
|
||||||
for(unsigned int i=0; i<all_seeds.size(); i++)
|
|
||||||
{
|
|
||||||
m_all_random_generators[i]->seed(all_seeds[i]);
|
|
||||||
}
|
|
||||||
} // seed
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
#if 0
|
||||||
void RandomGenerator::seed(int s)
|
|
||||||
{
|
|
||||||
m_random_value = s;
|
|
||||||
} // seed
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
int RandomGenerator::get(int n)
|
int RandomGenerator::get(int n)
|
||||||
{
|
{
|
||||||
// This generator is (currently) not good enough, i.e. it often gives
|
// This generator is (currently) not good enough, i.e. it often gives
|
||||||
// long sequences of same numbers. And the seeding is not done (the
|
// long sequences of same numbers. And the seeding is not done (the
|
||||||
// mid term goal is to synchronise all random number generators on
|
// mid term goal is to synchronise all random number generators on
|
||||||
// client and server to make less communication necessary).
|
// client and server to make less communication necessary).
|
||||||
// For now: just use standard random numbers:
|
// For now: just use standard random numbers:
|
||||||
return rand() % n;
|
return rand() % n;
|
||||||
@ -81,5 +67,4 @@ int RandomGenerator::get(int n)
|
|||||||
#endif
|
#endif
|
||||||
} // get
|
} // get
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
#endif // if 0
|
||||||
|
|
||||||
|
@ -17,12 +17,13 @@
|
|||||||
// along with this program; if not, write to the Free Software
|
// along with this program; if not, write to the Free Software
|
||||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#ifndef HEADER_RANDOM_NUMBER_H
|
#ifndef HEADER_RANDOM_GENERATOR_HPP
|
||||||
#define HEADER_RANDOM_NUMBER_H
|
#define HEADER_RANDOM_GENERATOR_HPP
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
/** A random number generator. Each objects that needs a random number uses
|
/** A random number generator. Each objects that needs a random number uses
|
||||||
its own number random generator. They are all seeded with number provided
|
its own number random generator. They are all seeded with number provided
|
||||||
by the server. This guarantees that in a network game all 'random' values
|
by the server. This guarantees that in a network game all 'random' values
|
||||||
are actually identical among all machines.
|
are actually identical among all machines.
|
||||||
@ -32,18 +33,17 @@
|
|||||||
class RandomGenerator
|
class RandomGenerator
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
unsigned int m_random_value;
|
unsigned int m_random_value;
|
||||||
unsigned int m_a, m_c;
|
unsigned int m_a, m_c;
|
||||||
static std::vector<RandomGenerator*> m_all_random_generators;
|
static std::vector<RandomGenerator*> m_all_random_generators;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RandomGenerator();
|
RandomGenerator();
|
||||||
static void seedAll(std::vector<int> all_seeds);
|
|
||||||
std::vector<int> generateAllSeeds();
|
std::vector<int> generateAllSeeds();
|
||||||
void seed(int s);
|
|
||||||
/** Returns a pseudo random number between 0 and n-1 inclusive */
|
/** Returns a pseudo random number between 0 and n-1 inclusive */
|
||||||
int get (int n);
|
int get(int n) {return rand() % n; }
|
||||||
|
void seed(int s) {m_random_value = s;}
|
||||||
|
}; // RandomGenerator
|
||||||
}; // RandomGenerator
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
#endif // HEADER_RANDOM_GENERATOR_HPP
|
||||||
|
@ -29,22 +29,21 @@ class Vec3 : public btVector3
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
inline float clampToUnity(float f) {return f<-1?f:(f>1?1:f);}
|
inline float clampToUnity(float f) {return f<-1?f:(f>1?1:f);}
|
||||||
void setPitchRoll(const Vec3 &normal);
|
void setPitchRoll(const Vec3 &normal);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
inline Vec3(sgVec3 a) : btVector3(a[0], a[1], a[2]) {}
|
inline Vec3(sgVec3 a) : btVector3(a[0], a[1], a[2]) {}
|
||||||
inline Vec3(const btVector3& a) : btVector3(a) {}
|
inline Vec3(const btVector3& a) : btVector3(a) {}
|
||||||
inline Vec3() : btVector3() {}
|
inline Vec3() : btVector3() {}
|
||||||
inline Vec3(float x, float y, float z)
|
inline Vec3(float x, float y, float z) : btVector3(x,y,z) {}
|
||||||
: btVector3(x,y,z) {}
|
inline Vec3(float x) : btVector3(x,x,x) {}
|
||||||
inline Vec3(float x) : btVector3(x,x,x) {}
|
/** Sets the heading, and computes pitch and roll dependent
|
||||||
/** Sets the heading, and computes pitch and roll dependent
|
* on the normal it is displayed on.
|
||||||
* on the normal it is displayed on.
|
* \param heading The heading to set.
|
||||||
* \param heading The heading to set.
|
* \param normal The normal from which pitch and roll should be computed. */
|
||||||
* \param normal The normal from which pitch and roll
|
inline Vec3(float heading, const Vec3& normal)
|
||||||
should be computed. */
|
{m_x=heading;
|
||||||
inline Vec3(float heading, const Vec3& normal)
|
setPitchRoll(normal);}
|
||||||
{m_x=heading;
|
|
||||||
setPitchRoll(normal);}
|
|
||||||
|
|
||||||
void setHPR(const btMatrix3x3& m);
|
void setHPR(const btMatrix3x3& m);
|
||||||
inline const float operator[](int n) const {return *(&m_x+n); }
|
inline const float operator[](int n) const {return *(&m_x+n); }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user