Run expand -t4 to convert tabs to spaces. No other whitespace fixes, but

there are still trailing spaces and lines with 5 spaces as indent (fix them
as the files are changed for other reasons). src/guiengine/CGUIFont.* and
src/bullet/ not processed to allow cleaner updates from upstream.


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@4320 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
mbjornstk 2009-12-18 00:36:35 +00:00
parent 5a938b4bf9
commit 5fe41e5625
57 changed files with 743 additions and 743 deletions

View File

@ -26,12 +26,12 @@
AnimationBase::AnimationBase(const XMLNode &node, float fps) AnimationBase::AnimationBase(const XMLNode &node, float fps)
{ {
for(unsigned int i=0; i<node.getNumNodes(); i++) for(unsigned int i=0; i<node.getNumNodes(); i++)
{ {
Ipo *ipo = new Ipo(*node.getNode(i), fps); Ipo *ipo = new Ipo(*node.getNode(i), fps);
m_all_ipos.push_back(ipo); m_all_ipos.push_back(ipo);
} // for i<getNumNodes() } // for i<getNumNodes()
m_playing = true; m_playing = true;
} // AnimationBase } // AnimationBase
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -39,8 +39,8 @@ AnimationBase::AnimationBase(const XMLNode &node, float fps)
*/ */
AnimationBase::~AnimationBase() AnimationBase::~AnimationBase()
{ {
std::vector<Ipo*>::iterator i; std::vector<Ipo*>::iterator i;
for(i=m_all_ipos.begin(); i<m_all_ipos.end(); i++) for(i=m_all_ipos.begin(); i<m_all_ipos.end(); i++)
delete *i; delete *i;
m_all_ipos.clear(); m_all_ipos.clear();
} // ~AnimationBase } // ~AnimationBase
@ -52,13 +52,13 @@ AnimationBase::~AnimationBase()
* \param hpr Rotation of the object. * \param hpr Rotation of the object.
*/ */
void AnimationBase::setInitialTransform(const core::vector3df &xyz, void AnimationBase::setInitialTransform(const core::vector3df &xyz,
const core::vector3df &hpr) const core::vector3df &hpr)
{ {
std::vector<Ipo*>::iterator i; std::vector<Ipo*>::iterator i;
for(i=m_all_ipos.begin(); i<m_all_ipos.end(); i++) for(i=m_all_ipos.begin(); i<m_all_ipos.end(); i++)
{ {
(*i)->setInitialTransform(xyz, hpr); (*i)->setInitialTransform(xyz, hpr);
} // for i in m_all_ipos } // for i in m_all_ipos
} // setTransform } // setTransform
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -66,11 +66,11 @@ void AnimationBase::setInitialTransform(const core::vector3df &xyz,
*/ */
void AnimationBase::reset() void AnimationBase::reset()
{ {
std::vector<Ipo*>::iterator i; std::vector<Ipo*>::iterator i;
for(i=m_all_ipos.begin(); i<m_all_ipos.end(); i++) for(i=m_all_ipos.begin(); i<m_all_ipos.end(); i++)
{ {
(*i)->reset(); (*i)->reset();
} // for i in m_all_ipos } // for i in m_all_ipos
} // reset } // reset
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -80,12 +80,12 @@ void AnimationBase::reset()
* \param hpr Rotation to be updated. * \param hpr Rotation to be updated.
*/ */
void AnimationBase::update(float dt, core::vector3df *xyz, void AnimationBase::update(float dt, core::vector3df *xyz,
core::vector3df *hpr) core::vector3df *hpr)
{ {
std::vector<Ipo*>::iterator i; std::vector<Ipo*>::iterator i;
for(i=m_all_ipos.begin(); i<m_all_ipos.end(); i++) for(i=m_all_ipos.begin(); i<m_all_ipos.end(); i++)
{ {
(*i)->update(dt, xyz, hpr); (*i)->update(dt, xyz, hpr);
} // for i in m_all_ipos } // for i in m_all_ipos
} // float dt } // float dt

View File

@ -27,20 +27,20 @@
AnimationManager::AnimationManager(const Track &track, const XMLNode &node) AnimationManager::AnimationManager(const Track &track, const XMLNode &node)
{ {
for(unsigned int i=0; i<node.getNumNodes(); i++) for(unsigned int i=0; i<node.getNumNodes(); i++)
{ {
const XMLNode *anim_node = node.getNode(i); const XMLNode *anim_node = node.getNode(i);
std::string type = anim_node->getName(); std::string type = anim_node->getName();
float fps=25; float fps=25;
anim_node->get("fps", &fps); anim_node->get("fps", &fps);
if(type=="anim_billboard") if(type=="anim_billboard")
m_all_animations.push_back(new BillboardAnimation(track, *anim_node, fps)); m_all_animations.push_back(new BillboardAnimation(track, *anim_node, fps));
else if(type=="animations-IPO") else if(type=="animations-IPO")
m_all_animations.push_back(new ThreeDAnimation(track, *anim_node, fps)); m_all_animations.push_back(new ThreeDAnimation(track, *anim_node, fps));
else else
fprintf(stderr, "Unknown animation type '%s' - ignored.\n", fprintf(stderr, "Unknown animation type '%s' - ignored.\n",
type.c_str()); type.c_str());
} // for i<node.getNumNodes } // for i<node.getNumNodes
} // AnimationManager } // AnimationManager
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -49,9 +49,9 @@ AnimationManager::AnimationManager(const Track &track, const XMLNode &node)
*/ */
AnimationManager::~AnimationManager() AnimationManager::~AnimationManager()
{ {
std::vector<AnimationBase*>::iterator i; std::vector<AnimationBase*>::iterator i;
for(i=m_all_animations.begin(); i!=m_all_animations.end(); i++) for(i=m_all_animations.begin(); i!=m_all_animations.end(); i++)
delete *i; delete *i;
m_all_animations.clear(); m_all_animations.clear();
} // ~AnimationManager } // ~AnimationManager
@ -60,9 +60,9 @@ AnimationManager::~AnimationManager()
*/ */
void AnimationManager::reset() void AnimationManager::reset()
{ {
std::vector<AnimationBase*>::iterator i; std::vector<AnimationBase*>::iterator i;
for(i=m_all_animations.begin(); i!=m_all_animations.end(); i++) for(i=m_all_animations.begin(); i!=m_all_animations.end(); i++)
(*i)->reset(); (*i)->reset();
} // reset } // reset
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -71,7 +71,7 @@ void AnimationManager::reset()
*/ */
void AnimationManager::update(float dt) void AnimationManager::update(float dt)
{ {
std::vector<AnimationBase*>::iterator i; std::vector<AnimationBase*>::iterator i;
for(i=m_all_animations.begin(); i!=m_all_animations.end(); i++) for(i=m_all_animations.begin(); i!=m_all_animations.end(); i++)
(*i)->update(dt); (*i)->update(dt);
} // update } // update

View File

@ -23,7 +23,7 @@ class XMLNode;
/** A 2d billboard animation. */ /** A 2d billboard animation. */
BillboardAnimation::BillboardAnimation(const Track &track_name, BillboardAnimation::BillboardAnimation(const Track &track_name,
const XMLNode &node, float fps) const XMLNode &node, float fps)
: AnimationBase(node, fps) : AnimationBase(node, fps)
{ {
} // BillboardAnimation } // BillboardAnimation
@ -33,9 +33,9 @@ BillboardAnimation::BillboardAnimation(const Track &track_name,
* \param dt Time since last call. */ * \param dt Time since last call. */
void BillboardAnimation::update(float dt) void BillboardAnimation::update(float dt)
{ {
// FIXME: not implemented yet. // FIXME: not implemented yet.
core::vector3df xyz(0, 0, 0); core::vector3df xyz(0, 0, 0);
core::vector3df hpr(0, 0, 0); core::vector3df hpr(0, 0, 0);
AnimationBase::update(dt, &xyz, &hpr); AnimationBase::update(dt, &xyz, &hpr);
} // update } // update

View File

@ -132,7 +132,7 @@ void MusicInformation::startMusic()
{ {
delete m_normal_music; delete m_normal_music;
m_normal_music=0; m_normal_music=0;
fprintf(stderr, "WARNING: Unabled to load music %s, not supported or not found.\n", fprintf(stderr, "WARNING: Unabled to load music %s, not supported or not found.\n",
m_normal_filename.c_str()); m_normal_filename.c_str());
return; return;
} }
@ -160,7 +160,7 @@ void MusicInformation::startMusic()
{ {
delete m_fast_music; delete m_fast_music;
m_fast_music=0; m_fast_music=0;
fprintf(stderr, "WARNING: Unabled to load fast music %s, not supported or not found.\n", fprintf(stderr, "WARNING: Unabled to load fast music %s, not supported or not found.\n",
m_fast_filename.c_str()); m_fast_filename.c_str());
return; return;
} }

View File

@ -43,7 +43,7 @@ MusicOggStream::MusicOggStream()
MusicOggStream::~MusicOggStream() MusicOggStream::~MusicOggStream()
{ {
if(stopMusic() == false) if(stopMusic() == false)
fprintf(stderr, "WARNING: problems while stopping music.\n"); fprintf(stderr, "WARNING: problems while stopping music.\n");
} // ~MusicOggStream } // ~MusicOggStream
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -250,7 +250,7 @@ void MusicOggStream::update()
if(!active) if(!active)
{ {
// no more data. Seek to beginning (causes the sound to loop) // no more data. Seek to beginning (causes the sound to loop)
ov_time_seek(&m_oggStream, 0); ov_time_seek(&m_oggStream, 0);
active = streamIntoBuffer(buffer);//now there really should be data active = streamIntoBuffer(buffer);//now there really should be data
//fprintf(stdout,"Music buffer under-run.\n"); //fprintf(stdout,"Music buffer under-run.\n");
} }
@ -266,7 +266,7 @@ void MusicOggStream::update()
alGetSourcei(m_soundSource, AL_SOURCE_STATE, &state); alGetSourcei(m_soundSource, AL_SOURCE_STATE, &state);
if (state != AL_PLAYING) if (state != AL_PLAYING)
{ {
fprintf(stderr,"WARNING: Music not playing when it should be. Source state: %d\n", state); fprintf(stderr,"WARNING: Music not playing when it should be. Source state: %d\n", state);
alGetSourcei(m_soundSource, AL_BUFFERS_PROCESSED, &processed); alGetSourcei(m_soundSource, AL_BUFFERS_PROCESSED, &processed);
alSourcePlay(m_soundSource); alSourcePlay(m_soundSource);
} }

View File

@ -122,8 +122,8 @@ void SFXManager::loadSfx()
loadSingleSfx(lisp, "ugh", SOUND_UGH ); loadSingleSfx(lisp, "ugh", SOUND_UGH );
loadSingleSfx(lisp, "skid", SOUND_SKID ); loadSingleSfx(lisp, "skid", SOUND_SKID );
loadSingleSfx(lisp, "locked", SOUND_LOCKED ); loadSingleSfx(lisp, "locked", SOUND_LOCKED );
loadSingleSfx(lisp, "bowling_roll", SOUND_BOWLING_ROLL ); loadSingleSfx(lisp, "bowling_roll", SOUND_BOWLING_ROLL );
loadSingleSfx(lisp, "bowling_strike",SOUND_BOWLING_STRIKE ); loadSingleSfx(lisp, "bowling_strike",SOUND_BOWLING_STRIKE );
loadSingleSfx(lisp, "winner", SOUND_WINNER ); loadSingleSfx(lisp, "winner", SOUND_WINNER );
loadSingleSfx(lisp, "crash", SOUND_CRASH ); loadSingleSfx(lisp, "crash", SOUND_CRASH );
loadSingleSfx(lisp, "grab", SOUND_GRAB ); loadSingleSfx(lisp, "grab", SOUND_GRAB );

View File

@ -44,7 +44,7 @@ public:
enum SFXType enum SFXType
{ {
SOUND_UGH, SOUND_SKID, SOUND_BOWLING_ROLL, SOUND_BOWLING_STRIKE, SOUND_WINNER, SOUND_CRASH, SOUND_GRAB, SOUND_UGH, SOUND_SKID, SOUND_BOWLING_ROLL, SOUND_BOWLING_STRIKE, SOUND_WINNER, SOUND_CRASH, SOUND_GRAB,
SOUND_SHOT, SOUND_GOO, SOUND_WEE, SOUND_EXPLOSION, SOUND_BZZT, SOUND_BEEP, SOUND_BACK_MENU, SOUND_USE_ANVIL, SOUND_SHOT, SOUND_GOO, SOUND_WEE, SOUND_EXPLOSION, SOUND_BZZT, SOUND_BEEP, SOUND_BACK_MENU, SOUND_USE_ANVIL,
SOUND_USE_PARACHUTE, SOUND_SELECT_MENU, SOUND_MOVE_MENU, SOUND_FULL, SOUND_LOCKED, SOUND_USE_PARACHUTE, SOUND_SELECT_MENU, SOUND_MOVE_MENU, SOUND_FULL, SOUND_LOCKED,
SOUND_PRESTART, SOUND_START, SOUND_ENGINE_SMALL, SOUND_ENGINE_LARGE, SOUND_PRESTART, SOUND_START, SOUND_ENGINE_SMALL, SOUND_ENGINE_LARGE,
NUM_SOUNDS NUM_SOUNDS
@ -81,7 +81,7 @@ public:
SFX_INITIAL = 3 SFX_INITIAL = 3
}; };
private: private:
/** The buffers for all sound effects. These are shared among all /** The buffers for all sound effects. These are shared among all
* instances of SFXOpenal. */ * instances of SFXOpenal. */
std::vector<ALuint> m_sfx_buffers; std::vector<ALuint> m_sfx_buffers;

View File

@ -174,7 +174,7 @@ SFXManager::SFXStatus SFXOpenAL::getStatus()
{ {
if(!sfx_manager->sfxAllowed()||!m_ok) return SFXManager::SFX_UNKNOWN; if(!sfx_manager->sfxAllowed()||!m_ok) return SFXManager::SFX_UNKNOWN;
int state = 0; int state = 0;
alGetSourcei(m_soundSource, AL_SOURCE_STATE, &state); alGetSourcei(m_soundSource, AL_SOURCE_STATE, &state);
switch(state) switch(state)
{ {

View File

@ -49,7 +49,7 @@ public:
virtual void position(const Vec3 &position); virtual void position(const Vec3 &position);
virtual void volume(float gain); virtual void volume(float gain);
virtual SFXManager::SFXStatus getStatus(); virtual SFXManager::SFXStatus getStatus();
}; // SFXOpenAL }; // SFXOpenAL
#endif // HEADER_SFX_OPENAL_HPP #endif // HEADER_SFX_OPENAL_HPP

View File

@ -35,7 +35,7 @@ extern bool IS_LITTLE_ENDIAN;
class SoundManager class SoundManager
{ {
private: private:
MusicInformation *m_current_music; MusicInformation *m_current_music;
/** If the sound could not be initialized, e.g. if the player doesn't has /** If the sound could not be initialized, e.g. if the player doesn't has

View File

@ -586,7 +586,7 @@ void IrrDriver::renderBulletDebugView()
GLfloat light_ambient[] = { 0.0, 0.0, 0.0, 1.0 }; GLfloat light_ambient[] = { 0.0, 0.0, 0.0, 1.0 };
GLfloat light_diffuse[] = { 1.0, 1.0, 1.0, 1.0 }; GLfloat light_diffuse[] = { 1.0, 1.0, 1.0, 1.0 };
GLfloat light_specular[] = { 1.0, 1.0, 1.0, 1.0 }; GLfloat light_specular[] = { 1.0, 1.0, 1.0, 1.0 };
/* light_position is NOT default value */ /* light_position is NOT default value */
GLfloat light_position0[] = { 1.0, 1.0, 1.0, 0.0 }; GLfloat light_position0[] = { 1.0, 1.0, 1.0, 0.0 };
GLfloat light_position1[] = { -1.0, -1.0, -1.0, 0.0 }; GLfloat light_position1[] = { -1.0, -1.0, -1.0, 0.0 };
@ -856,7 +856,7 @@ void IrrDriver::RTTProvider::setupRTTScene(ptr_vector<scene::IMesh, REF>& mesh,
m_rtt_main_node->getMaterial(n).setFlag(EMF_GOURAUD_SHADING , true); m_rtt_main_node->getMaterial(n).setFlag(EMF_GOURAUD_SHADING , true);
} }
m_camera = irr_driver->getSceneManager()->addCameraSceneNode(); m_camera = irr_driver->getSceneManager()->addCameraSceneNode();
m_camera->setPosition( core::vector3df(0.0, 20.0f, 70.0f) ); m_camera->setPosition( core::vector3df(0.0, 20.0f, 70.0f) );
m_camera->setUpVector( core::vector3df(0.0, 1.0, 0.0) ); m_camera->setUpVector( core::vector3df(0.0, 1.0, 0.0) );

View File

@ -84,7 +84,7 @@ public:
video::ITexture *getTexture(const std::string &filename); video::ITexture *getTexture(const std::string &filename);
scene::IMesh *createQuadMesh(const video::SMaterial *material=NULL, scene::IMesh *createQuadMesh(const video::SMaterial *material=NULL,
bool create_one_quad=false); bool create_one_quad=false);
scene::IMesh *createTexturedQuadMesh(const video::SMaterial *material, const double w, const double h); scene::IMesh *createTexturedQuadMesh(const video::SMaterial *material, const double w, const double h);
scene::ISceneNode *addWaterNode(scene::IMesh *mesh, float wave_height, scene::ISceneNode *addWaterNode(scene::IMesh *mesh, float wave_height,
float wave_speed, float wave_length); float wave_speed, float wave_length);
scene::ISceneNode *addOctTree(scene::IMesh *mesh); scene::ISceneNode *addOctTree(scene::IMesh *mesh);

View File

@ -43,7 +43,7 @@ public:
void reInit (); void reInit ();
void setAllMaterialFlags(video::ITexture* t, void setAllMaterialFlags(video::ITexture* t,
scene::IMeshBuffer *mb) const; scene::IMeshBuffer *mb) const;
void setAllUntexturedMaterialFlags(scene::IMeshBuffer *mb) const; void setAllUntexturedMaterialFlags(scene::IMeshBuffer *mb) const;
int addEntity (Material *m); int addEntity (Material *m);
Material *getMaterial (const std::string& t, bool is_full_path=false, Material *getMaterial (const std::string& t, bool is_full_path=false,
bool make_permanent=false); bool make_permanent=false);

View File

@ -179,7 +179,7 @@ void init(IrrlichtDevice* device_a, IVideoDriver* driver_a, AbstractStateManager
g_focus_for_player[n] = NULL; g_focus_for_player[n] = NULL;
} }
/* /*
To make the g_font a little bit nicer, we load an external g_font To make the g_font a little bit nicer, we load an external g_font
and set it as the new default g_font in the g_skin. and set it as the new default g_font in the g_skin.
To keep the standard g_font for tool tip text, we set it to To keep the standard g_font for tool tip text, we set it to
@ -187,7 +187,7 @@ void init(IrrlichtDevice* device_a, IVideoDriver* driver_a, AbstractStateManager
*/ */
g_skin = new Skin(g_env->getSkin()); g_skin = new Skin(g_env->getSkin());
g_env->setSkin(g_skin); g_env->setSkin(g_skin);
//g_skin = g_env->getSkin(); //g_skin = g_env->getSkin();
// font size is resolution-dependent. // font size is resolution-dependent.
// normal text will range from 0.8, in 640x* resolutions (won't scale below that) to // normal text will range from 0.8, in 640x* resolutions (won't scale below that) to
@ -204,14 +204,14 @@ void init(IrrlichtDevice* device_a, IVideoDriver* driver_a, AbstractStateManager
g_font = sfont; g_font = sfont;
ScalableFont* sfont2 = new ScalableFont(g_env, (file_manager->getGUIDir() + "/title_font.xml").c_str()); ScalableFont* sfont2 = new ScalableFont(g_env, (file_manager->getGUIDir() + "/title_font.xml").c_str());
sfont2->setScale(title_text_scale); sfont2->setScale(title_text_scale);
sfont2->setKerningWidth(-18); sfont2->setKerningWidth(-18);
g_title_font = sfont2; g_title_font = sfont2;
if (g_font != NULL) g_skin->setFont(g_font); if (g_font != NULL) g_skin->setFont(g_font);
//g_skin->setFont(g_env->getBuiltInFont(), EGDF_TOOLTIP); //g_skin->setFont(g_env->getBuiltInFont(), EGDF_TOOLTIP);
// set event receiver // set event receiver
g_device->setEventReceiver(EventHandler::get()); g_device->setEventReceiver(EventHandler::get());

View File

@ -49,7 +49,7 @@ ModalDialog::ModalDialog(const float percentWidth, const float percentHeight)
if (modalWindow != NULL) delete modalWindow; if (modalWindow != NULL) delete modalWindow;
modalWindow = this; modalWindow = this;
m_irrlicht_window = GUIEngine::getGUIEnv()->addWindow ( m_area, true /* modal */ ); m_irrlicht_window = GUIEngine::getGUIEnv()->addWindow ( m_area, true /* modal */ );
GUIEngine::getSkin()->m_dialog = true; GUIEngine::getSkin()->m_dialog = true;
GUIEngine::getSkin()->m_dialog_size = 0.0f; GUIEngine::getSkin()->m_dialog_size = 0.0f;
@ -79,7 +79,7 @@ void ModalDialog::clearWindow()
m_children.clearAndDeleteAll(); m_children.clearAndDeleteAll();
m_irrlicht_window->remove(); m_irrlicht_window->remove();
m_irrlicht_window = GUIEngine::getGUIEnv()->addWindow ( m_area, true /* modal */ ); m_irrlicht_window = GUIEngine::getGUIEnv()->addWindow ( m_area, true /* modal */ );
/* /*
const core::list<IGUIElement*>& remainingChildren = m_irrlicht_window->getChildren(); const core::list<IGUIElement*>& remainingChildren = m_irrlicht_window->getChildren();

View File

@ -946,16 +946,16 @@ void Skin::drawIconButton(const core::rect< s32 > &rect, Widget* widget, const b
sized_rect.UpperLeftCorner.Y = center.Y + (int)(((int)rect.UpperLeftCorner.Y - (int)center.Y)*texture_size); sized_rect.UpperLeftCorner.Y = center.Y + (int)(((int)rect.UpperLeftCorner.Y - (int)center.Y)*texture_size);
//std::cout << "y is " << center.Y << " + (" << rect.UpperLeftCorner.Y << " - " << center.Y << ")*" << texture_size << " = " //std::cout << "y is " << center.Y << " + (" << rect.UpperLeftCorner.Y << " - " << center.Y << ")*" << texture_size << " = "
// << center.Y + (int)((rect.UpperLeftCorner.Y - center.Y)*texture_size) << std::endl; // << center.Y + (int)((rect.UpperLeftCorner.Y - center.Y)*texture_size) << std::endl;
sized_rect.LowerRightCorner.X = center.X + (int)(((int)rect.LowerRightCorner.X - (int)center.X)*texture_size); sized_rect.LowerRightCorner.X = center.X + (int)(((int)rect.LowerRightCorner.X - (int)center.X)*texture_size);
sized_rect.LowerRightCorner.Y = center.Y + (int)(((int)rect.LowerRightCorner.Y - (int)center.Y)*texture_size); sized_rect.LowerRightCorner.Y = center.Y + (int)(((int)rect.LowerRightCorner.Y - (int)center.Y)*texture_size);
/* /*
std::cout << texture_size << " : " << rect.UpperLeftCorner.X << ", " << rect.UpperLeftCorner.Y << " : " << std::cout << texture_size << " : " << rect.UpperLeftCorner.X << ", " << rect.UpperLeftCorner.Y << " : " <<
rect.LowerRightCorner.X << ", " << rect.LowerRightCorner.Y << " ---> " << rect.LowerRightCorner.X << ", " << rect.LowerRightCorner.Y << " ---> " <<
sized_rect.UpperLeftCorner.X << ", " << sized_rect.UpperLeftCorner.Y << " : " << sized_rect.UpperLeftCorner.X << ", " << sized_rect.UpperLeftCorner.Y << " : " <<
sized_rect.LowerRightCorner.X << ", " << sized_rect.LowerRightCorner.Y << std::endl; sized_rect.LowerRightCorner.X << ", " << sized_rect.LowerRightCorner.Y << std::endl;
*/ */
} }
@ -1246,7 +1246,7 @@ void Skin::draw3DSunkenPane (IGUIElement *element, video::SColor bgcolor, bool f
} }
else else
{ {
GUIEngine::getDriver()->draw2DRectangle( color, rect ); GUIEngine::getDriver()->draw2DRectangle( color, rect );
} }
} }
return; return;
@ -1294,7 +1294,7 @@ core::rect< s32 > Skin::draw3DWindowBackground (IGUIElement *element, bool drawT
} }
else else
{ {
drawBoxFromStretchableTexture( ModalDialog::getCurrent(), rect, SkinConfig::m_render_params["window::neutral"]); drawBoxFromStretchableTexture( ModalDialog::getCurrent(), rect, SkinConfig::m_render_params["window::neutral"]);
} }
return rect; return rect;
@ -1327,27 +1327,27 @@ void Skin::drawIcon (IGUIElement *element, EGUI_DEFAULT_ICON icon, const core::p
video::SColor Skin::getColor (EGUI_DEFAULT_COLOR color) const video::SColor Skin::getColor (EGUI_DEFAULT_COLOR color) const
{ {
/* /*
EGDC_3D_DARK_SHADOW Dark shadow for three-dimensional display elements. EGDC_3D_DARK_SHADOW Dark shadow for three-dimensional display elements.
EGDC_3D_SHADOW Shadow color for three-dimensional display elements (for edges facing away from the light source). EGDC_3D_SHADOW Shadow color for three-dimensional display elements (for edges facing away from the light source).
EGDC_3D_FACE Face color for three-dimensional display elements and for dialog box backgrounds. EGDC_3D_FACE Face color for three-dimensional display elements and for dialog box backgrounds.
EGDC_3D_HIGH_LIGHT Highlight color for three-dimensional display elements (for edges facing the light source.). EGDC_3D_HIGH_LIGHT Highlight color for three-dimensional display elements (for edges facing the light source.).
EGDC_3D_LIGHT Light color for three-dimensional display elements (for edges facing the light source.). EGDC_3D_LIGHT Light color for three-dimensional display elements (for edges facing the light source.).
EGDC_ACTIVE_BORDER Active window border. EGDC_ACTIVE_BORDER Active window border.
EGDC_ACTIVE_CAPTION Active window title bar text. EGDC_ACTIVE_CAPTION Active window title bar text.
EGDC_APP_WORKSPACE Background color of multiple document interface (MDI) applications. EGDC_APP_WORKSPACE Background color of multiple document interface (MDI) applications.
EGDC_BUTTON_TEXT Text on a button. EGDC_BUTTON_TEXT Text on a button.
EGDC_GRAY_TEXT Grayed (disabled) text. EGDC_GRAY_TEXT Grayed (disabled) text.
EGDC_HIGH_LIGHT Item(s) selected in a control. EGDC_HIGH_LIGHT Item(s) selected in a control.
EGDC_HIGH_LIGHT_TEXT Text of item(s) selected in a control. EGDC_HIGH_LIGHT_TEXT Text of item(s) selected in a control.
EGDC_INACTIVE_BORDER Inactive window border. EGDC_INACTIVE_BORDER Inactive window border.
EGDC_INACTIVE_CAPTION Inactive window caption. EGDC_INACTIVE_CAPTION Inactive window caption.
EGDC_TOOLTIP Tool tip text color. EGDC_TOOLTIP Tool tip text color.
EGDC_TOOLTIP_BACKGROUND Tool tip background color. EGDC_TOOLTIP_BACKGROUND Tool tip background color.
EGDC_SCROLLBAR Scrollbar gray area. EGDC_SCROLLBAR Scrollbar gray area.
EGDC_WINDOW Window background. EGDC_WINDOW Window background.
EGDC_WINDOW_SYMBOL Window symbols like on close buttons, scroll bars and check boxes. EGDC_WINDOW_SYMBOL Window symbols like on close buttons, scroll bars and check boxes.
EGDC_ICON Icons in a list or tree. EGDC_ICON Icons in a list or tree.
EGDC_ICON_HIGH_LIGHT Selected icons in a list or tree. EGDC_ICON_HIGH_LIGHT Selected icons in a list or tree.
*/ */
switch(color) switch(color)
@ -1368,7 +1368,7 @@ video::SColor Skin::getColor (EGUI_DEFAULT_COLOR color) const
} }
const wchar_t* Skin::getDefaultText (EGUI_DEFAULT_TEXT text) const const wchar_t* Skin::getDefaultText (EGUI_DEFAULT_TEXT text) const
{ {
return L"SuperTuxKart"; return L"SuperTuxKart";
} }
@ -1395,7 +1395,7 @@ IGUISpriteBank* Skin::getSpriteBank () const
return m_fallback_skin->getSpriteBank(); return m_fallback_skin->getSpriteBank();
} }
//EGUI_SKIN_TYPE getType () const //EGUI_SKIN_TYPE getType () const
void Skin::setColor (EGUI_DEFAULT_COLOR which, video::SColor newColor) void Skin::setColor (EGUI_DEFAULT_COLOR which, video::SColor newColor)
{ {

View File

@ -246,29 +246,29 @@ namespace GUIEngine
void drawBadgeOn(const Widget* widget, const irr::core::rect<irr::s32>& rect); void drawBadgeOn(const Widget* widget, const irr::core::rect<irr::s32>& rect);
// irrlicht's callbacks // irrlicht's callbacks
virtual void draw2DRectangle (irr::gui::IGUIElement *element, const irr::video::SColor &color, const irr::core::rect< irr::s32 > &pos, const irr::core::rect< irr::s32 > *clip); virtual void draw2DRectangle (irr::gui::IGUIElement *element, const irr::video::SColor &color, const irr::core::rect< irr::s32 > &pos, const irr::core::rect< irr::s32 > *clip);
virtual void draw3DButtonPanePressed (irr::gui::IGUIElement *element, const irr::core::rect< irr::s32 > &rect, const irr::core::rect< irr::s32 > *clip); virtual void draw3DButtonPanePressed (irr::gui::IGUIElement *element, const irr::core::rect< irr::s32 > &rect, const irr::core::rect< irr::s32 > *clip);
virtual void draw3DButtonPaneStandard (irr::gui::IGUIElement *element, const irr::core::rect< irr::s32 > &rect, const irr::core::rect< irr::s32 > *clip); virtual void draw3DButtonPaneStandard (irr::gui::IGUIElement *element, const irr::core::rect< irr::s32 > &rect, const irr::core::rect< irr::s32 > *clip);
virtual void draw3DMenuPane (irr::gui::IGUIElement *element, const irr::core::rect< irr::s32 > &rect, const irr::core::rect< irr::s32 > *clip); virtual void draw3DMenuPane (irr::gui::IGUIElement *element, const irr::core::rect< irr::s32 > &rect, const irr::core::rect< irr::s32 > *clip);
virtual void draw3DSunkenPane (irr::gui::IGUIElement *element, irr::video::SColor bgcolor, bool flat, bool fillBackGround, const irr::core::rect< irr::s32 > &rect, const irr::core::rect< irr::s32 > *clip); virtual void draw3DSunkenPane (irr::gui::IGUIElement *element, irr::video::SColor bgcolor, bool flat, bool fillBackGround, const irr::core::rect< irr::s32 > &rect, const irr::core::rect< irr::s32 > *clip);
virtual void draw3DTabBody (irr::gui::IGUIElement *element, bool border, bool background, const irr::core::rect< irr::s32 > &rect, const irr::core::rect< irr::s32 > *clip, irr::s32 tabHeight=-1, irr::gui::EGUI_ALIGNMENT alignment=irr::gui::EGUIA_UPPERLEFT); virtual void draw3DTabBody (irr::gui::IGUIElement *element, bool border, bool background, const irr::core::rect< irr::s32 > &rect, const irr::core::rect< irr::s32 > *clip, irr::s32 tabHeight=-1, irr::gui::EGUI_ALIGNMENT alignment=irr::gui::EGUIA_UPPERLEFT);
virtual void draw3DTabButton (irr::gui::IGUIElement *element, bool active, const irr::core::rect< irr::s32 > &rect, const irr::core::rect< irr::s32 > *clip, irr::gui::EGUI_ALIGNMENT alignment=irr::gui::EGUIA_UPPERLEFT); virtual void draw3DTabButton (irr::gui::IGUIElement *element, bool active, const irr::core::rect< irr::s32 > &rect, const irr::core::rect< irr::s32 > *clip, irr::gui::EGUI_ALIGNMENT alignment=irr::gui::EGUIA_UPPERLEFT);
virtual void draw3DToolBar (irr::gui::IGUIElement *element, const irr::core::rect< irr::s32 > &rect, const irr::core::rect< irr::s32 > *clip); virtual void draw3DToolBar (irr::gui::IGUIElement *element, const irr::core::rect< irr::s32 > &rect, const irr::core::rect< irr::s32 > *clip);
virtual irr::core::rect< irr::s32 > draw3DWindowBackground (irr::gui::IGUIElement *element, bool drawTitleBar, irr::video::SColor titleBarColor, const irr::core::rect< irr::s32 > &rect, const irr::core::rect< irr::s32 > *clip); virtual irr::core::rect< irr::s32 > draw3DWindowBackground (irr::gui::IGUIElement *element, bool drawTitleBar, irr::video::SColor titleBarColor, const irr::core::rect< irr::s32 > &rect, const irr::core::rect< irr::s32 > *clip);
virtual void drawIcon (irr::gui::IGUIElement *element, irr::gui::EGUI_DEFAULT_ICON icon, const irr::core::position2di position, irr::u32 starttime, irr::u32 currenttime, bool loop=false, const irr::core::rect< irr::s32 > *clip=NULL); virtual void drawIcon (irr::gui::IGUIElement *element, irr::gui::EGUI_DEFAULT_ICON icon, const irr::core::position2di position, irr::u32 starttime, irr::u32 currenttime, bool loop=false, const irr::core::rect< irr::s32 > *clip=NULL);
virtual irr::video::SColor getColor (irr::gui::EGUI_DEFAULT_COLOR color) const; virtual irr::video::SColor getColor (irr::gui::EGUI_DEFAULT_COLOR color) const;
virtual const wchar_t* getDefaultText (irr::gui::EGUI_DEFAULT_TEXT text) const; virtual const wchar_t* getDefaultText (irr::gui::EGUI_DEFAULT_TEXT text) const;
virtual irr::gui::IGUIFont* getFont (irr::gui::EGUI_DEFAULT_FONT which=irr::gui::EGDF_DEFAULT) const ; virtual irr::gui::IGUIFont* getFont (irr::gui::EGUI_DEFAULT_FONT which=irr::gui::EGDF_DEFAULT) const ;
virtual irr::u32 getIcon (irr::gui::EGUI_DEFAULT_ICON icon) const ; virtual irr::u32 getIcon (irr::gui::EGUI_DEFAULT_ICON icon) const ;
virtual irr::s32 getSize (irr::gui::EGUI_DEFAULT_SIZE size) const ; virtual irr::s32 getSize (irr::gui::EGUI_DEFAULT_SIZE size) const ;
virtual irr::gui::IGUISpriteBank * getSpriteBank () const ; virtual irr::gui::IGUISpriteBank * getSpriteBank () const ;
//virtual EGUI_SKIN_TYPE getType () const; //virtual EGUI_SKIN_TYPE getType () const;
virtual void setColor (irr::gui::EGUI_DEFAULT_COLOR which, irr::video::SColor newColor); virtual void setColor (irr::gui::EGUI_DEFAULT_COLOR which, irr::video::SColor newColor);
virtual void setDefaultText (irr::gui::EGUI_DEFAULT_TEXT which, const wchar_t* newText); virtual void setDefaultText (irr::gui::EGUI_DEFAULT_TEXT which, const wchar_t* newText);
virtual void setFont (irr::gui::IGUIFont *font, irr::gui::EGUI_DEFAULT_FONT which=irr::gui::EGDF_DEFAULT); virtual void setFont (irr::gui::IGUIFont *font, irr::gui::EGUI_DEFAULT_FONT which=irr::gui::EGDF_DEFAULT);
virtual void setIcon (irr::gui::EGUI_DEFAULT_ICON icon, irr::u32 index); virtual void setIcon (irr::gui::EGUI_DEFAULT_ICON icon, irr::u32 index);
virtual void setSize (irr::gui::EGUI_DEFAULT_SIZE which, irr::s32 size); virtual void setSize (irr::gui::EGUI_DEFAULT_SIZE which, irr::s32 size);
virtual void setSpriteBank (irr::gui::IGUISpriteBank *bank); virtual void setSpriteBank (irr::gui::IGUISpriteBank *bank);
}; };
} }

View File

@ -48,7 +48,7 @@ void LabelWidget::add()
irrwidget->setOverrideFont( GUIEngine::getTitleFont() ); irrwidget->setOverrideFont( GUIEngine::getTitleFont() );
} }
//irrwidget->setBackgroundColor( video::SColor(255,255,0,0) ); //irrwidget->setBackgroundColor( video::SColor(255,255,0,0) );
//irrwidget->setDrawBackground(true); //irrwidget->setDrawBackground(true);
id = m_element->getID(); id = m_element->getID();
//m_element->setTabOrder(id); //m_element->setTabOrder(id);

View File

@ -249,7 +249,7 @@ bool DeviceManager::translateInput( Input::InputType type,
if (device != NULL && abs(value) > Input::MAX_VALUE/2) if (device != NULL && abs(value) > Input::MAX_VALUE/2)
{ {
//std::cout<< "========== Setting latest device " << (device->getType() == DT_KEYBOARD ? "keyboard" : "gamepad") //std::cout<< "========== Setting latest device " << (device->getType() == DT_KEYBOARD ? "keyboard" : "gamepad")
// << " #" << deviceID << " button=" << btnID << " value=" << value << " ==========\n"; // << " #" << deviceID << " button=" << btnID << " value=" << value << " ==========\n";
m_latest_used_device = device; m_latest_used_device = device;
} }

View File

@ -49,113 +49,113 @@ irr::core::stringw Input::getInputAsString(const Input::InputType type, const in
case KEY_RBUTTON : case KEY_RBUTTON :
s = "right mouse button"; s = "right mouse button";
break; break;
case KEY_CANCEL : case KEY_CANCEL :
s = "cancel"; s = "cancel";
break; break;
case KEY_MBUTTON : case KEY_MBUTTON :
s = "middle mouse button"; s = "middle mouse button";
break; break;
case KEY_XBUTTON1 : case KEY_XBUTTON1 :
s = "X1 mouse button"; s = "X1 mouse button";
break; break;
case KEY_XBUTTON2 : case KEY_XBUTTON2 :
s = "X2 mouse button"; s = "X2 mouse button";
break; break;
case KEY_BACK : case KEY_BACK :
s = "backspace"; s = "backspace";
break; break;
case KEY_TAB : case KEY_TAB :
s = "tab"; s = "tab";
break; break;
case KEY_CLEAR : case KEY_CLEAR :
s = "clear"; s = "clear";
break; break;
case KEY_RETURN : case KEY_RETURN :
s = "return"; s = "return";
break; break;
case KEY_SHIFT : case KEY_SHIFT :
s = "shift"; s = "shift";
break; break;
case KEY_CONTROL : case KEY_CONTROL :
s = "control"; s = "control";
break; break;
case KEY_MENU : case KEY_MENU :
s = "alt/menu"; s = "alt/menu";
break; break;
case KEY_PAUSE : case KEY_PAUSE :
s = "pause"; s = "pause";
break; break;
case KEY_CAPITAL : case KEY_CAPITAL :
s = "caps lock"; s = "caps lock";
break; break;
case KEY_KANA : case KEY_KANA :
s = "kana"; s = "kana";
break; break;
//case KEY_HANGUEL : //case KEY_HANGUEL :
//case KEY_HANGUL : //case KEY_HANGUL :
// s = "hangul"; // s = "hangul";
break; break;
case KEY_JUNJA : case KEY_JUNJA :
s = "junja"; s = "junja";
break; break;
case KEY_FINAL : case KEY_FINAL :
s = "final"; s = "final";
break; break;
//case KEY_HANJA : //case KEY_HANJA :
// s = "hanja"; // s = "hanja";
// break; // break;
//case KEY_KANJI : //case KEY_KANJI :
// s = "kanji"; // s = "kanji";
// break; // break;
case KEY_ESCAPE : case KEY_ESCAPE :
s = "escape"; s = "escape";
break; break;
case KEY_CONVERT : case KEY_CONVERT :
s = "convert"; s = "convert";
break; break;
case KEY_NONCONVERT : case KEY_NONCONVERT :
s = "nonconvert"; s = "nonconvert";
break; break;
case KEY_ACCEPT : case KEY_ACCEPT :
s = "accept"; s = "accept";
break; break;
case KEY_MODECHANGE : case KEY_MODECHANGE :
s = "modechange"; s = "modechange";
break; break;
case KEY_SPACE : case KEY_SPACE :
s = "space"; s = "space";
break; break;
case KEY_PRIOR : case KEY_PRIOR :
s = "page up"; s = "page up";
break; break;
case KEY_NEXT : case KEY_NEXT :
s = "page down"; s = "page down";
break; break;
case KEY_END : case KEY_END :
s = "end"; s = "end";
break; break;
case KEY_HOME : case KEY_HOME :
s = "home"; s = "home";
break; break;
case KEY_LEFT : case KEY_LEFT :
s = "left"; s = "left";
break; break;
case KEY_UP : case KEY_UP :
s = "up"; s = "up";
break; break;
case KEY_RIGHT : case KEY_RIGHT :
s = "right"; s = "right";
break; break;
case KEY_DOWN : case KEY_DOWN :
s = "down"; s = "down";
break; break;
case KEY_SELECT : case KEY_SELECT :
s = "select"; s = "select";
break; break;
case KEY_PRINT : case KEY_PRINT :
s = "print"; s = "print";
break; break;
case KEY_EXECUT : case KEY_EXECUT :
s = "exec"; s = "exec";
break; break;
case KEY_SNAPSHOT : case KEY_SNAPSHOT :
@ -164,142 +164,142 @@ irr::core::stringw Input::getInputAsString(const Input::InputType type, const in
case KEY_INSERT : case KEY_INSERT :
s = "insert"; s = "insert";
break; break;
case KEY_DELETE : case KEY_DELETE :
s = "delete"; s = "delete";
break; break;
case KEY_HELP : case KEY_HELP :
s = "help"; s = "help";
break; break;
case KEY_KEY_0 : case KEY_KEY_0 :
s = "0"; s = "0";
break; break;
case KEY_KEY_1 : case KEY_KEY_1 :
s = "1"; s = "1";
break; break;
case KEY_KEY_2 : case KEY_KEY_2 :
s = "2"; s = "2";
break; break;
case KEY_KEY_3 : case KEY_KEY_3 :
s = "3"; s = "3";
break; break;
case KEY_KEY_4 : case KEY_KEY_4 :
s = "4"; s = "4";
break; break;
case KEY_KEY_5 : case KEY_KEY_5 :
s = "5"; s = "5";
break; break;
case KEY_KEY_6 : case KEY_KEY_6 :
s = "6"; s = "6";
break; break;
case KEY_KEY_7 : case KEY_KEY_7 :
s = "7"; s = "7";
break; break;
case KEY_KEY_8 : case KEY_KEY_8 :
s = "8"; s = "8";
break; break;
case KEY_KEY_9 : case KEY_KEY_9 :
s = "9"; s = "9";
break; break;
case KEY_KEY_A : case KEY_KEY_A :
s = "A"; s = "A";
break; break;
case KEY_KEY_B : case KEY_KEY_B :
s = "B"; s = "B";
break; break;
case KEY_KEY_C : case KEY_KEY_C :
s = "C"; s = "C";
break; break;
case KEY_KEY_D : case KEY_KEY_D :
s = "D"; s = "D";
break; break;
case KEY_KEY_E : case KEY_KEY_E :
s = "E"; s = "E";
break; break;
case KEY_KEY_F : case KEY_KEY_F :
s = "F"; s = "F";
break; break;
case KEY_KEY_G : case KEY_KEY_G :
s = "G"; s = "G";
break; break;
case KEY_KEY_H : case KEY_KEY_H :
s = "H"; s = "H";
break; break;
case KEY_KEY_I : case KEY_KEY_I :
s = "I"; s = "I";
break; break;
case KEY_KEY_J : case KEY_KEY_J :
s = "J"; s = "J";
break; break;
case KEY_KEY_K : case KEY_KEY_K :
s = "K"; s = "K";
break; break;
case KEY_KEY_L : case KEY_KEY_L :
s = "L"; s = "L";
break; break;
case KEY_KEY_M : case KEY_KEY_M :
s = "M"; s = "M";
break; break;
case KEY_KEY_N : case KEY_KEY_N :
s = "N"; s = "N";
break; break;
case KEY_KEY_O : case KEY_KEY_O :
s = "O"; s = "O";
break; break;
case KEY_KEY_P : case KEY_KEY_P :
s = "P"; s = "P";
break; break;
case KEY_KEY_Q : case KEY_KEY_Q :
s = "Q"; s = "Q";
break; break;
case KEY_KEY_R : case KEY_KEY_R :
s = "R"; s = "R";
break; break;
case KEY_KEY_S : case KEY_KEY_S :
s = "S"; s = "S";
break; break;
case KEY_KEY_T : case KEY_KEY_T :
s = "T"; s = "T";
break; break;
case KEY_KEY_U : case KEY_KEY_U :
s = "U"; s = "U";
break; break;
case KEY_KEY_V : case KEY_KEY_V :
s = "V"; s = "V";
break; break;
case KEY_KEY_W : case KEY_KEY_W :
s = "W"; s = "W";
break; break;
case KEY_KEY_X : case KEY_KEY_X :
s = "X"; s = "X";
break; break;
case KEY_KEY_Y : case KEY_KEY_Y :
s = "Y"; s = "Y";
break; break;
case KEY_KEY_Z : case KEY_KEY_Z :
s = "Z"; s = "Z";
break; break;
case KEY_LWIN : case KEY_LWIN :
s = "Left Logo"; s = "Left Logo";
break; break;
case KEY_RWIN : case KEY_RWIN :
s = "Right Logo"; s = "Right Logo";
break; break;
case KEY_APPS : case KEY_APPS :
s = "apps"; s = "apps";
break; break;
case KEY_SLEEP : case KEY_SLEEP :
s = "sleep"; s = "sleep";
break; break;
case KEY_NUMPAD0 : case KEY_NUMPAD0 :
s = "numpad 0"; s = "numpad 0";
break; break;
case KEY_NUMPAD1 : case KEY_NUMPAD1 :
s = "numpad 1"; s = "numpad 1";
break; break;
case KEY_NUMPAD2 : case KEY_NUMPAD2 :
s = "numpad 2"; s = "numpad 2";
break; break;
case KEY_NUMPAD3 : case KEY_NUMPAD3 :
s = "numpad 3"; s = "numpad 3";
break; break;
case KEY_NUMPAD4 : case KEY_NUMPAD4 :
@ -308,133 +308,133 @@ irr::core::stringw Input::getInputAsString(const Input::InputType type, const in
case KEY_NUMPAD5 : case KEY_NUMPAD5 :
s = "numpad 5"; s = "numpad 5";
break; break;
case KEY_NUMPAD6 : case KEY_NUMPAD6 :
s = "numpad 6"; s = "numpad 6";
break; break;
case KEY_NUMPAD7 : case KEY_NUMPAD7 :
s = "numpad 7"; s = "numpad 7";
break; break;
case KEY_NUMPAD8 : case KEY_NUMPAD8 :
s = "numpad 8"; s = "numpad 8";
break; break;
case KEY_NUMPAD9 : case KEY_NUMPAD9 :
s = "numpad 9"; s = "numpad 9";
break; break;
case KEY_MULTIPLY : case KEY_MULTIPLY :
s = "*"; s = "*";
break; break;
case KEY_ADD : case KEY_ADD :
s = "+"; s = "+";
break; break;
case KEY_SEPARATOR : case KEY_SEPARATOR :
s = "separator"; s = "separator";
break; break;
case KEY_SUBTRACT : case KEY_SUBTRACT :
s = "- (subtract)"; s = "- (subtract)";
break; break;
case KEY_DECIMAL : case KEY_DECIMAL :
s = "decimal"; s = "decimal";
break; break;
case KEY_DIVIDE : case KEY_DIVIDE :
s = "/ (divide)"; s = "/ (divide)";
break; break;
case KEY_F1 : case KEY_F1 :
s = "F1"; s = "F1";
break; break;
case KEY_F2 : case KEY_F2 :
s = "F2"; s = "F2";
break; break;
case KEY_F3 : case KEY_F3 :
s = "F3"; s = "F3";
break; break;
case KEY_F4 : case KEY_F4 :
s = "F4"; s = "F4";
break; break;
case KEY_F5 : case KEY_F5 :
s = "F5"; s = "F5";
break; break;
case KEY_F6 : case KEY_F6 :
s = "F6"; s = "F6";
break; break;
case KEY_F7 : case KEY_F7 :
s = "F7"; s = "F7";
break; break;
case KEY_F8 : case KEY_F8 :
s = "F8"; s = "F8";
break; break;
case KEY_F9 : case KEY_F9 :
s = "F9"; s = "F9";
break; break;
case KEY_F10 : case KEY_F10 :
s = "F10"; s = "F10";
break; break;
case KEY_F11 : case KEY_F11 :
s = "F11"; s = "F11";
break; break;
case KEY_F12 : case KEY_F12 :
s = "F12"; s = "F12";
break; break;
case KEY_F13 : case KEY_F13 :
s = "F13"; s = "F13";
break; break;
case KEY_F14 : case KEY_F14 :
s = "F14"; s = "F14";
break; break;
case KEY_F15 : case KEY_F15 :
s = "F15"; s = "F15";
break; break;
case KEY_F16 : case KEY_F16 :
s = "F16"; s = "F16";
break; break;
case KEY_F17 : case KEY_F17 :
s = "F17"; s = "F17";
break; break;
case KEY_F18 : case KEY_F18 :
s = "F18"; s = "F18";
break; break;
case KEY_F19 : case KEY_F19 :
s = "F19"; s = "F19";
break; break;
case KEY_F20 : case KEY_F20 :
s = "F20"; s = "F20";
break; break;
case KEY_F21 : case KEY_F21 :
s = "F21"; s = "F21";
break; break;
case KEY_F22 : case KEY_F22 :
s = "F22"; s = "F22";
break; break;
case KEY_F23 : case KEY_F23 :
s = "F23"; s = "F23";
break; break;
case KEY_F24 : case KEY_F24 :
s = "F24"; s = "F24";
break; break;
case KEY_NUMLOCK : case KEY_NUMLOCK :
s = "num lock"; s = "num lock";
break; break;
case KEY_SCROLL : case KEY_SCROLL :
s = "scroll lock"; s = "scroll lock";
break; break;
case KEY_LSHIFT : case KEY_LSHIFT :
s = "left shift"; s = "left shift";
break; break;
case KEY_RSHIFT : case KEY_RSHIFT :
s = "right shift"; s = "right shift";
break; break;
case KEY_LCONTROL : case KEY_LCONTROL :
s = "left control"; s = "left control";
break; break;
case KEY_RCONTROL : case KEY_RCONTROL :
s = "right control"; s = "right control";
break; break;
case KEY_LMENU : case KEY_LMENU :
s = "left menu"; s = "left menu";
break; break;
case KEY_RMENU : case KEY_RMENU :
s = "right menu"; s = "right menu";
break; break;
case KEY_PLUS : case KEY_PLUS :
s = "+"; s = "+";
break; break;
case KEY_COMMA : case KEY_COMMA :
@ -446,7 +446,7 @@ irr::core::stringw Input::getInputAsString(const Input::InputType type, const in
case KEY_PERIOD : case KEY_PERIOD :
s = "."; s = ".";
break; break;
case KEY_ATTN : case KEY_ATTN :
s = "attn"; s = "attn";
break; break;
case KEY_CRSEL : case KEY_CRSEL :
@ -455,16 +455,16 @@ irr::core::stringw Input::getInputAsString(const Input::InputType type, const in
case KEY_EXSEL : case KEY_EXSEL :
s = "exsel"; s = "exsel";
break; break;
case KEY_EREOF : case KEY_EREOF :
s = "ereof"; s = "ereof";
break; break;
case KEY_PLAY : case KEY_PLAY :
s = "play"; s = "play";
break; break;
case KEY_ZOOM : case KEY_ZOOM :
s = "zoom"; s = "zoom";
break; break;
case KEY_PA1 : case KEY_PA1 :
s = "pa1"; s = "pa1";
break; break;
case KEY_OEM_CLEAR: case KEY_OEM_CLEAR:

View File

@ -54,40 +54,40 @@ struct Input
int btnID; // or axis ID for gamepads axes int btnID; // or axis ID for gamepads axes
int axisDirection; int axisDirection;
Input() Input()
: type(IT_NONE), deviceID(0), btnID(0), axisDirection(0) : type(IT_NONE), deviceID(0), btnID(0), axisDirection(0)
{ {
// Nothing to do. // Nothing to do.
} }
/** Creates an Input instance which represents an arbitrary way of getting /** Creates an Input instance which represents an arbitrary way of getting
* game input using a type specifier and 3 integers. * game input using a type specifier and 3 integers.
* *
* Meaning of the 3 integers for each InputType: * Meaning of the 3 integers for each InputType:
* IT_NONE: This means nothing. In certain cases this is regarded as an * IT_NONE: This means nothing. In certain cases this is regarded as an
* unset binding. * unset binding.
* IT_KEYBOARD: id0 is a irrLicht value. * IT_KEYBOARD: id0 is a irrLicht value.
* IT_STICKMOTION: id0 - stick index, id1 - axis index, id2 - axis direction * IT_STICKMOTION: id0 - stick index, id1 - axis index, id2 - axis direction
* (negative, positive). You can assume that axis 0 is the X-Axis where the * (negative, positive). You can assume that axis 0 is the X-Axis where the
* negative direction is to the left and that axis 1 is the Y-Axis with the * negative direction is to the left and that axis 1 is the Y-Axis with the
* negative direction being upwards. * negative direction being upwards.
* IT_STICKBUTTON: id0 - stick index, id1 - button index. Button 0 and 1 are * IT_STICKBUTTON: id0 - stick index, id1 - button index. Button 0 and 1 are
* usually reached most easily. * usually reached most easily.
* IT_STICKHAT: This is not yet implemented. * IT_STICKHAT: This is not yet implemented.
* IT_MOUSEMOTION: id0 - axis index (0 -> X, 1 -> Y). Mouse wheel is * IT_MOUSEMOTION: id0 - axis index (0 -> X, 1 -> Y). Mouse wheel is
* represented as buttons! * represented as buttons!
* IT_MOUSEBUTTON: id0 - button number (1 -> left, 2 -> middle, 3 -> right, * IT_MOUSEBUTTON: id0 - button number (1 -> left, 2 -> middle, 3 -> right,
* ...) * ...)
* *
* Note: For joystick bindings that are actice in the menu the joystick's * Note: For joystick bindings that are actice in the menu the joystick's
* index should be zero. The binding will react to all joysticks connected * index should be zero. The binding will react to all joysticks connected
* to the system. * to the system.
*/ */
Input(InputType ntype, int deviceID , int btnID = 0, int axisDirection= 0) Input(InputType ntype, int deviceID , int btnID = 0, int axisDirection= 0)
: type(ntype), deviceID(deviceID), btnID(btnID), axisDirection(axisDirection) : type(ntype), deviceID(deviceID), btnID(btnID), axisDirection(axisDirection)
{ {
// Nothing to do. // Nothing to do.
} }
static irr::core::stringw getInputAsString(const Input::InputType type, const int id, const Input::AxisDirection dir=AD_NEUTRAL); static irr::core::stringw getInputAsString(const Input::InputType type, const int id, const Input::AxisDirection dir=AD_NEUTRAL);
@ -97,15 +97,15 @@ enum PlayerAction
{ {
PA_FIRST = -1, PA_FIRST = -1,
PA_LEFT = 0, PA_LEFT = 0,
PA_RIGHT, PA_RIGHT,
PA_ACCEL, PA_ACCEL,
PA_BRAKE, PA_BRAKE,
PA_NITRO, PA_NITRO,
PA_DRIFT, PA_DRIFT,
PA_RESCUE, PA_RESCUE,
PA_FIRE, PA_FIRE,
PA_LOOK_BACK, PA_LOOK_BACK,
PA_COUNT PA_COUNT
}; };
@ -122,41 +122,41 @@ static std::string KartActionStrings[PA_COUNT] = {std::string("left"),
enum StaticAction enum StaticAction
{ {
// Below this are synthetic game actions which are never triggered through // Below this are synthetic game actions which are never triggered through
// an input device. // an input device.
GA_NULL, // Nothing dummy entry. GA_NULL, // Nothing dummy entry.
GA_SENSE_CANCEL, // Input sensing canceled. GA_SENSE_CANCEL, // Input sensing canceled.
GA_SENSE_COMPLETE, // Input sensing successfully finished. GA_SENSE_COMPLETE, // Input sensing successfully finished.
// Below this point are the game actions which can happen while in menu // Below this point are the game actions which can happen while in menu
// mode. // mode.
GA_ENTER, // Enter menu, acknowledge, ... GA_ENTER, // Enter menu, acknowledge, ...
GA_LEAVE, // Leave a menu. GA_LEAVE, // Leave a menu.
GA_CLEAR_MAPPING, // Clear an input mapping. GA_CLEAR_MAPPING, // Clear an input mapping.
GA_INC_SCROLL_SPEED, GA_INC_SCROLL_SPEED,
GA_INC_SCROLL_SPEED_FAST, GA_INC_SCROLL_SPEED_FAST,
GA_DEC_SCROLL_SPEED, GA_DEC_SCROLL_SPEED,
GA_DEC_SCROLL_SPEED_FAST, GA_DEC_SCROLL_SPEED_FAST,
GA_CURSOR_UP, GA_CURSOR_UP,
GA_CURSOR_DOWN, GA_CURSOR_DOWN,
GA_CURSOR_LEFT, GA_CURSOR_LEFT,
GA_CURSOR_RIGHT, GA_CURSOR_RIGHT,
GA_TOGGLE_FULLSCREEN, // Switch between windowed/fullscreen mode GA_TOGGLE_FULLSCREEN, // Switch between windowed/fullscreen mode
GA_LEAVE_RACE, // Switch from race to menu. GA_LEAVE_RACE, // Switch from race to menu.
GA_DEBUG_ADD_MISSILE, GA_DEBUG_ADD_MISSILE,
GA_DEBUG_ADD_BOWLING, GA_DEBUG_ADD_BOWLING,
GA_DEBUG_ADD_HOMING, GA_DEBUG_ADD_HOMING,
GA_DEBUG_TOGGLE_FPS, GA_DEBUG_TOGGLE_FPS,
GA_DEBUG_TOGGLE_WIREFRAME, GA_DEBUG_TOGGLE_WIREFRAME,
GA_DEBUG_HISTORY GA_DEBUG_HISTORY
}; };

View File

@ -402,7 +402,7 @@ void InputManager::setMasterPlayerOnly(bool enabled)
/** Returns whether only the master player should be allowed to perform changes in menus */ /** Returns whether only the master player should be allowed to perform changes in menus */
bool InputManager::masterPlayerOnly() const bool InputManager::masterPlayerOnly() const
{ {
return m_device_manager->getAssignMode() == ASSIGN && m_master_player_only; return m_device_manager->getAssignMode() == ASSIGN && m_master_player_only;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
/** /**

View File

@ -53,7 +53,7 @@ public:
private: private:
Input *m_sensed_input; Input *m_sensed_input;
DeviceManager *m_device_manager; DeviceManager *m_device_manager;
/** Stores the maximum sensed input values. This allows to select the /** Stores the maximum sensed input values. This allows to select the
@ -61,39 +61,39 @@ private:
int m_max_sensed_input; int m_max_sensed_input;
Input::InputType m_max_sensed_type; Input::InputType m_max_sensed_type;
InputDriverMode m_mode; InputDriverMode m_mode;
/** When at true, only the master player can play with menus */ /** When at true, only the master player can play with menus */
bool m_master_player_only; bool m_master_player_only;
/* Helper values to store and track the relative mouse movements. If these /* Helper values to store and track the relative mouse movements. If these
* values exceed the deadzone value the input is reported to the game. This * values exceed the deadzone value the input is reported to the game. This
* makes the mouse behave like an analog axis on a gamepad/joystick. * makes the mouse behave like an analog axis on a gamepad/joystick.
*/ */
int m_mouse_val_x, m_mouse_val_y; int m_mouse_val_x, m_mouse_val_y;
void dispatchInput(Input::InputType, int, int, int, int); void dispatchInput(Input::InputType, int, int, int, int);
void handleStaticAction(int id0, int value); void handleStaticAction(int id0, int value);
void handlePlayerAction(PlayerAction pa, const int playerNo, int value); void handlePlayerAction(PlayerAction pa, const int playerNo, int value);
void inputSensing(Input::InputType type, int deviceID, int btnID, int axisDirection, int value); void inputSensing(Input::InputType type, int deviceID, int btnID, int axisDirection, int value);
public: public:
InputManager(); InputManager();
~InputManager(); ~InputManager();
// void initGamePadDevices(); // void initGamePadDevices();
//void input(); //void input();
GUIEngine::EventPropagation input(const irr::SEvent& event); GUIEngine::EventPropagation input(const irr::SEvent& event);
DeviceManager* getDeviceList() { return m_device_manager; } DeviceManager* getDeviceList() { return m_device_manager; }
void setMode(InputDriverMode); void setMode(InputDriverMode);
bool isInMode(InputDriverMode); bool isInMode(InputDriverMode);
/** When this mode is enabled, only the master player will be able to play with menus (only works in 'assign' mode) */ /** When this mode is enabled, only the master player will be able to play with menus (only works in 'assign' mode) */
void setMasterPlayerOnly(bool enabled); void setMasterPlayerOnly(bool enabled);
/** Returns whether only the master player should be allowed to perform changes in menus */ /** Returns whether only the master player should be allowed to perform changes in menus */
bool masterPlayerOnly() const; bool masterPlayerOnly() const;
void update(float dt); void update(float dt);

View File

@ -53,7 +53,7 @@ public:
int get(const std::string &attribute, float *value) const; int get(const std::string &attribute, float *value) const;
int get(const std::string &attribute, bool *value) const; int get(const std::string &attribute, bool *value) const;
int get(const std::string &attribute, Vec3 *value) const; int get(const std::string &attribute, Vec3 *value) const;
int get(const std::string &attribute, core::vector2df *value) const; int get(const std::string &attribute, core::vector2df *value) const;
int get(const std::string &attribute, core::vector3df *value) const; int get(const std::string &attribute, core::vector3df *value) const;
int get(const std::string &attribute, video::SColorf *value) const; int get(const std::string &attribute, video::SColorf *value) const;
int get(const std::string &attribute, video::SColor *value) const; int get(const std::string &attribute, video::SColor *value) const;

View File

@ -62,10 +62,10 @@ Bowling::Bowling(Kart *kart) : Flyable(kart, POWERUP_BOWLING, 50.0f /* mass */)
int flag = getBody()->getCollisionFlags(); int flag = getBody()->getCollisionFlags();
flag = flag & (~ btCollisionObject::CF_NO_CONTACT_RESPONSE); flag = flag & (~ btCollisionObject::CF_NO_CONTACT_RESPONSE);
getBody()->setCollisionFlags(flag); getBody()->setCollisionFlags(flag);
// should not live forever, auto-destruct after 20 seconds // should not live forever, auto-destruct after 20 seconds
m_max_lifespan = 20; m_max_lifespan = 20;
} // Bowling } // Bowling
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------

View File

@ -37,8 +37,8 @@ public:
static void init(const lisp::Lisp* lisp, scene::IMesh *bowling); static void init(const lisp::Lisp* lisp, scene::IMesh *bowling);
virtual void update(float dt); virtual void update(float dt);
int getExplosionSound() const { return SFXManager::SOUND_BOWLING_STRIKE; } int getExplosionSound() const { return SFXManager::SOUND_BOWLING_STRIKE; }
}; // Bowling }; // Bowling
#endif #endif

View File

@ -48,12 +48,12 @@ Cake::Cake (Kart *kart) : Flyable(kart, POWERUP_CAKE)
// give a speed proportional to kart speed // give a speed proportional to kart speed
m_speed = kart->getSpeed() * m_speed / 23.0f; m_speed = kart->getSpeed() * m_speed / 23.0f;
if (kart->getSpeed() < 0) if (kart->getSpeed() < 0)
m_speed /= 3.6f; //when going backwards, decrease speed of cake by less m_speed /= 3.6f; //when going backwards, decrease speed of cake by less
m_speed += 16.0f; m_speed += 16.0f;
if (m_speed < 1.0f) if (m_speed < 1.0f)
m_speed = 1.0f; m_speed = 1.0f;
btTransform trans = kart->getTrans(); btTransform trans = kart->getTrans();

View File

@ -60,9 +60,9 @@ Flyable::Flyable(Kart *kart, PowerupType type, float mass) : Moveable()
m_mass = mass; m_mass = mass;
m_adjust_z_velocity = true; m_adjust_z_velocity = true;
m_time_since_thrown = 0; m_time_since_thrown = 0;
m_owner_has_temporary_immunity = true; m_owner_has_temporary_immunity = true;
m_max_lifespan = -1; m_max_lifespan = -1;
// Add the graphical model // Add the graphical model
setNode(irr_driver->addMesh(m_st_model[type])); setNode(irr_driver->addMesh(m_st_model[type]));
@ -240,8 +240,8 @@ void Flyable::getLinearKartItemIntersection (const btVector3 origin, const Kart
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void Flyable::update(float dt) void Flyable::update(float dt)
{ {
m_time_since_thrown += dt; m_time_since_thrown += dt;
if(m_max_lifespan > -1 && m_time_since_thrown > m_max_lifespan) hit(NULL); if(m_max_lifespan > -1 && m_time_since_thrown > m_max_lifespan) hit(NULL);
if(m_exploded) return; if(m_exploded) return;
@ -301,7 +301,7 @@ void Flyable::updateFromServer(const FlyableInfo &f, float dt)
*/ */
bool Flyable::isOwnerImmunity(const Kart* kart_hit) const bool Flyable::isOwnerImmunity(const Kart* kart_hit) const
{ {
return m_owner_has_temporary_immunity && return m_owner_has_temporary_immunity &&
kart_hit == m_owner && kart_hit == m_owner &&
m_time_since_thrown < 2.0f; m_time_since_thrown < 2.0f;
} // isOwnerImmunity } // isOwnerImmunity
@ -309,15 +309,15 @@ bool Flyable::isOwnerImmunity(const Kart* kart_hit) const
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void Flyable::hit(Kart *kart_hit, PhysicalObject* object) void Flyable::hit(Kart *kart_hit, PhysicalObject* object)
{ {
// the owner of this flyable should not be hit by his own flyable // the owner of this flyable should not be hit by his own flyable
if(m_exploded || isOwnerImmunity(kart_hit)) return; if(m_exploded || isOwnerImmunity(kart_hit)) return;
m_has_hit_something=true; m_has_hit_something=true;
// Notify the projectile manager that this rocket has hit something. // Notify the projectile manager that this rocket has hit something.
// The manager will create the appropriate explosion object. // The manager will create the appropriate explosion object.
projectile_manager->notifyRemove(); projectile_manager->notifyRemove();
m_exploded=true; m_exploded=true;
if(!needsExplosion()) return; if(!needsExplosion()) return;

View File

@ -70,16 +70,16 @@ protected:
static float m_st_force_updown[POWERUP_MAX]; // force pushing up/down static float m_st_force_updown[POWERUP_MAX]; // force pushing up/down
static btVector3 m_st_extend[POWERUP_MAX]; // size of the model static btVector3 m_st_extend[POWERUP_MAX]; // size of the model
/** time since thrown. used so a kart can't hit himself when trying something, /** time since thrown. used so a kart can't hit himself when trying something,
and also to put some time limit to some collectibles */ and also to put some time limit to some collectibles */
float m_time_since_thrown; float m_time_since_thrown;
/** set to something > -1 if this flyable should auto-destrcut after a while */ /** set to something > -1 if this flyable should auto-destrcut after a while */
float m_max_lifespan; float m_max_lifespan;
/** if set to true, the kart that throwns this flyable can't collide with it /** if set to true, the kart that throwns this flyable can't collide with it
for a short time */ for a short time */
bool m_owner_has_temporary_immunity; bool m_owner_has_temporary_immunity;
/** Returns information on what is the closest kart and at what /** Returns information on what is the closest kart and at what
distance it is. All 3 parameters first are of type 'out'. distance it is. All 3 parameters first are of type 'out'.
@ -126,8 +126,8 @@ public:
* be removed. */ * be removed. */
void setHasHit () { m_has_hit_something = true; } void setHasHit () { m_has_hit_something = true; }
void reset () { Moveable::reset(); } void reset () { Moveable::reset(); }
bool isOwnerImmunity(const Kart *kart_hit) const; bool isOwnerImmunity(const Kart *kart_hit) const;
virtual int getExplosionSound() const { return SFXManager::SOUND_EXPLOSION; } virtual int getExplosionSound() const { return SFXManager::SOUND_EXPLOSION; }
/** Indicates if an explosion needs to be added if this flyable /** Indicates if an explosion needs to be added if this flyable
* is removed. */ * is removed. */
virtual bool needsExplosion() const {return true;} virtual bool needsExplosion() const {return true;}

View File

@ -81,7 +81,7 @@ void Item::update(float delta)
Vec3 hell(m_coord.getXYZ()); Vec3 hell(m_coord.getXYZ());
hell.setZ( (m_time_till_return>1.0f) ? -1000000.0f hell.setZ( (m_time_till_return>1.0f) ? -1000000.0f
: m_coord.getXYZ().getZ() - m_time_till_return / 2.0f); : m_coord.getXYZ().getZ() - m_time_till_return / 2.0f);
m_node->setPosition(hell.toIrrVector()); m_node->setPosition(hell.toIrrVector());
} }
else else

View File

@ -67,7 +67,7 @@ public:
virtual ~Item (); virtual ~Item ();
void update (float delta); void update (float delta);
virtual void collected(float t=2.0f); virtual void collected(float t=2.0f);
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
/** Returns true if the Kart is close enough to hit this item, and /** Returns true if the Kart is close enough to hit this item, and
* the item is not deactivated anymore. * the item is not deactivated anymore.

View File

@ -36,7 +36,7 @@
Powerup::Powerup(Kart* kart_) Powerup::Powerup(Kart* kart_)
{ {
m_owner = kart_; m_owner = kart_;
m_sound_use = NULL; m_sound_use = NULL;
reset(); reset();
} // Powerup } // Powerup
@ -56,7 +56,7 @@ void Powerup::reset()
int type, number; int type, number;
RaceManager::getWorld()->getDefaultCollectibles( type, number ); RaceManager::getWorld()->getDefaultCollectibles( type, number );
set( (PowerupType)type, number ); set( (PowerupType)type, number );
} // reset } // reset
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -69,42 +69,42 @@ void Powerup::set(PowerupType type, int n)
} }
m_type=type; m_type=type;
m_number=n; m_number=n;
if(m_sound_use != NULL) if(m_sound_use != NULL)
{
sfx_manager->deleteSFX(m_sound_use);
m_sound_use = NULL;
}
switch (m_type)
{ {
case POWERUP_ZIPPER: sfx_manager->deleteSFX(m_sound_use);
break ; m_sound_use = NULL;
case POWERUP_BOWLING:
m_sound_use = sfx_manager->newSFX(SFXManager::SOUND_BOWLING_ROLL);
break ;
case POWERUP_ANVIL:
m_sound_use = sfx_manager->newSFX(SFXManager::SOUND_USE_ANVIL);
break;
case POWERUP_PARACHUTE:
m_sound_use = sfx_manager->newSFX(SFXManager::SOUND_USE_PARACHUTE);
break;
case POWERUP_BUBBLEGUM:
m_sound_use = sfx_manager->newSFX(SFXManager::SOUND_GOO);
break ;
case POWERUP_NOTHING:
case POWERUP_CAKE:
case POWERUP_PLUNGER:
default :
m_sound_use = sfx_manager->newSFX(SFXManager::SOUND_SHOT);
break ;
} }
switch (m_type)
{
case POWERUP_ZIPPER:
break ;
case POWERUP_BOWLING:
m_sound_use = sfx_manager->newSFX(SFXManager::SOUND_BOWLING_ROLL);
break ;
case POWERUP_ANVIL:
m_sound_use = sfx_manager->newSFX(SFXManager::SOUND_USE_ANVIL);
break;
case POWERUP_PARACHUTE:
m_sound_use = sfx_manager->newSFX(SFXManager::SOUND_USE_PARACHUTE);
break;
case POWERUP_BUBBLEGUM:
m_sound_use = sfx_manager->newSFX(SFXManager::SOUND_GOO);
break ;
case POWERUP_NOTHING:
case POWERUP_CAKE:
case POWERUP_PLUNGER:
default :
m_sound_use = sfx_manager->newSFX(SFXManager::SOUND_SHOT);
break ;
}
} // set } // set
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -121,9 +121,9 @@ void Powerup::use()
// Play custom kart sound when collectible is used // Play custom kart sound when collectible is used
if (m_type != POWERUP_NOTHING && m_type != POWERUP_ZIPPER) m_owner->playCustomSFX(SFXManager::CUSTOM_SHOOT); if (m_type != POWERUP_NOTHING && m_type != POWERUP_ZIPPER) m_owner->playCustomSFX(SFXManager::CUSTOM_SHOOT);
// FIXME - for some collectibles, set() is never called // FIXME - for some collectibles, set() is never called
if(m_sound_use == NULL) m_sound_use = sfx_manager->newSFX(SFXManager::SOUND_SHOT); if(m_sound_use == NULL) m_sound_use = sfx_manager->newSFX(SFXManager::SOUND_SHOT);
m_number--; m_number--;
switch (m_type) switch (m_type)
{ {
@ -243,7 +243,7 @@ void Powerup::hitBonusBox(int n, const Item &item, int add_info)
if(network_manager->getMode()==NetworkManager::NW_CLIENT) if(network_manager->getMode()==NetworkManager::NW_CLIENT)
{ {
m_random.get(100); // keep random numbers in sync m_random.get(100); // keep random numbers in sync
set( (PowerupType)add_info, 1); set( (PowerupType)add_info, 1);
return; return;
} }
const int SPECIAL_PROB = (int)(15.0 / ((float)RaceManager::getWorld()->getCurrentNumKarts() / const int SPECIAL_PROB = (int)(15.0 / ((float)RaceManager::getWorld()->getCurrentNumKarts() /
@ -259,7 +259,7 @@ void Powerup::hitBonusBox(int n, const Item &item, int add_info)
if(kart->isEliminated() || kart == m_owner) continue; if(kart->isEliminated() || kart == m_owner) continue;
if(kart->getPosition() == 1 && kart->hasFinishedRace()) if(kart->getPosition() == 1 && kart->hasFinishedRace())
{ {
set(POWERUP_PARACHUTE, 1); set(POWERUP_PARACHUTE, 1);
if(network_manager->getMode()==NetworkManager::NW_SERVER) if(network_manager->getMode()==NetworkManager::NW_SERVER)
{ {
race_state->itemCollected(m_owner->getWorldKartId(), race_state->itemCollected(m_owner->getWorldKartId(),
@ -270,7 +270,7 @@ void Powerup::hitBonusBox(int n, const Item &item, int add_info)
} }
} }
set( (m_random.get(2) == 0 ? POWERUP_ANVIL : POWERUP_PARACHUTE), 1 ); set( (m_random.get(2) == 0 ? POWERUP_ANVIL : POWERUP_PARACHUTE), 1 );
if(network_manager->getMode()==NetworkManager::NW_SERVER) if(network_manager->getMode()==NetworkManager::NW_SERVER)
{ {
@ -289,7 +289,7 @@ void Powerup::hitBonusBox(int n, const Item &item, int add_info)
{ {
if(m_type==POWERUP_NOTHING) if(m_type==POWERUP_NOTHING)
{ {
set( (PowerupType)add_info, n ); set( (PowerupType)add_info, n );
} }
else if((PowerupType)add_info==m_type) else if((PowerupType)add_info==m_type)
{ {
@ -326,7 +326,7 @@ void Powerup::hitBonusBox(int n, const Item &item, int add_info)
if(m_type==POWERUP_NOTHING) if(m_type==POWERUP_NOTHING)
{ {
set( newC, n ); set( newC, n );
} }
else if(newC==m_type) else if(newC==m_type)
{ {

View File

@ -36,7 +36,7 @@ private:
SFXBase *m_sound_use; SFXBase *m_sound_use;
PowerupType m_type; PowerupType m_type;
int m_number; int m_number;
protected: protected:
Kart* m_owner; Kart* m_owner;

View File

@ -126,7 +126,7 @@ private:
* kart down onto the track if one axis * kart down onto the track if one axis
* loses contact with the track. */ * loses contact with the track. */
float m_suspension_rest; float m_suspension_rest;
float m_suspension_travel_cm; float m_suspension_travel_cm;
float m_jump_velocity; // z velocity set when jumping float m_jump_velocity; // z velocity set when jumping
float m_z_rescue_offset; // z offset after rescue float m_z_rescue_offset; // z offset after rescue
float m_upright_tolerance; float m_upright_tolerance;

View File

@ -232,7 +232,7 @@ int KartPropertiesManager::getKartByGroup(const std::string& group, int n) const
for(KartPropertiesVector::const_iterator i = m_karts_properties.begin(); for(KartPropertiesVector::const_iterator i = m_karts_properties.begin();
i != m_karts_properties.end(); ++i) i != m_karts_properties.end(); ++i)
{ {
std::vector<std::string> groups=(*i)->getGroups(); std::vector<std::string> groups=(*i)->getGroups();
if (std::find(groups.begin(), groups.end(), group)==groups.end()) continue; if (std::find(groups.begin(), groups.end(), group)==groups.end()) continue;
if(count==n) return (int)(i-m_karts_properties.begin()); if(count==n) return (int)(i-m_karts_properties.begin());
count=count+1; count=count+1;

View File

@ -38,10 +38,10 @@ private:
std::vector<std::string> m_all_groups; std::vector<std::string> m_all_groups;
/** Mapping of group names to list of kart indices in each group. */ /** Mapping of group names to list of kart indices in each group. */
std::map<std::string, std::vector<int> > m_groups; std::map<std::string, std::vector<int> > m_groups;
/** Vector containing kart numbers that have been selected in multiplayer /** Vector containing kart numbers that have been selected in multiplayer
* games. This it used to ensure the same kart can not be selected more * games. This it used to ensure the same kart can not be selected more
* than once. */ * than once. */
std::vector<int> m_selected_karts; std::vector<int> m_selected_karts;
/** Contains a flag for each kart indicating wether it is available on /** Contains a flag for each kart indicating wether it is available on
* all clients or not. */ * all clients or not. */
std::vector<bool> m_kart_available; std::vector<bool> m_kart_available;
@ -55,7 +55,7 @@ protected:
public: public:
KartPropertiesManager(); KartPropertiesManager();
~KartPropertiesManager(); ~KartPropertiesManager();
static void addKartSearchDir (const std::string &s); static void addKartSearchDir (const std::string &s);
const KartProperties* getKartById (int i) const; const KartProperties* getKartById (int i) const;
const KartProperties* getKart (const std::string &ident) const; const KartProperties* getKart (const std::string &ident) const;
const int getKartId (const std::string &ident) const; const int getKartId (const std::string &ident) const;

View File

@ -193,19 +193,19 @@ namespace lisp
case '_': // can be begin translation case '_': // can be begin translation
try try
{ {
nextChar(); nextChar();
if(*m_c == '(') if(*m_c == '(')
{ {
nextChar(); nextChar();
return TOKEN_TRANSLATION; return TOKEN_TRANSLATION;
} }
m_token_string[m_token_length++] = '_'; m_token_string[m_token_length++] = '_';
// Fall through to symbol handling // Fall through to symbol handling
} }
catch(EOFException& ) catch(EOFException& )
{ {
} }
default: default:
if(isdigit(*m_c) || *m_c == '-') if(isdigit(*m_c) || *m_c == '-')
{ {

View File

@ -31,7 +31,7 @@ namespace lisp
TOKEN_EOF, TOKEN_EOF,
TOKEN_OPEN_PAREN, TOKEN_OPEN_PAREN,
TOKEN_CLOSE_PAREN, TOKEN_CLOSE_PAREN,
TOKEN_TRANSLATION, TOKEN_TRANSLATION,
TOKEN_SYMBOL, TOKEN_SYMBOL,
TOKEN_STRING, TOKEN_STRING,
TOKEN_INTEGER, TOKEN_INTEGER,

View File

@ -97,7 +97,7 @@ namespace lisp
} }
case Lexer::TOKEN_TRANSLATION: case Lexer::TOKEN_TRANSLATION:
{ {
result = new Lisp(Lisp::TYPE_STRING); result = new Lisp(Lisp::TYPE_STRING);
m_token = m_lexer->getNextToken(); m_token = m_lexer->getNextToken();
Lisp* next=read(); Lisp* next=read();
if(next->getType()!=Lisp::TYPE_STRING) if(next->getType()!=Lisp::TYPE_STRING)

View File

@ -33,9 +33,9 @@ namespace lisp
{ {
m_owner = true; m_owner = true;
#ifdef WIN32 #ifdef WIN32
// With mingw, the files are written dos style (crlf), but // With mingw, the files are written dos style (crlf), but
// these files can't be read with the lexer here. So we have // these files can't be read with the lexer here. So we have
// to force the file to be written as binary for windows. // to force the file to be written as binary for windows.
m_out = new std::ofstream(filename.c_str(),::std::ios_base::binary); m_out = new std::ofstream(filename.c_str(),::std::ios_base::binary);
#else #else
m_out = new std::ofstream(filename.c_str()); m_out = new std::ofstream(filename.c_str());
@ -187,8 +187,8 @@ namespace lisp
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void void
Writer::write(const std::string& name, const std::vector<std::string>& value) Writer::write(const std::string& name, const std::vector<std::string>& value)
{ {
indent(); indent();

View File

@ -163,13 +163,13 @@ int handleCmdLinePreliminary(int argc, char **argv)
{ {
// Check that current res is not blacklisted // Check that current res is not blacklisted
std::ostringstream o; std::ostringstream o;
o << UserConfigParams::m_width << "x" << UserConfigParams::m_height; o << UserConfigParams::m_width << "x" << UserConfigParams::m_height;
std::string res = o.str(); std::string res = o.str();
if (std::find(UserConfigParams::m_blacklist_res.begin(), if (std::find(UserConfigParams::m_blacklist_res.begin(),
UserConfigParams::m_blacklist_res.end(),res) == UserConfigParams::m_blacklist_res.end()) UserConfigParams::m_blacklist_res.end(),res) == UserConfigParams::m_blacklist_res.end())
UserConfigParams::m_fullscreen = true; UserConfigParams::m_fullscreen = true;
else else
fprintf ( stdout, "Resolution %s has been blacklisted, so it is not available!\n", res.c_str()); fprintf ( stdout, "Resolution %s has been blacklisted, so it is not available!\n", res.c_str());
} }
else if ( !strcmp(argv[i], "--windowed") || !strcmp(argv[i], "-w")) else if ( !strcmp(argv[i], "--windowed") || !strcmp(argv[i], "-w"))
{ {
@ -189,19 +189,19 @@ int handleCmdLinePreliminary(int argc, char **argv)
int width, height; int width, height;
if (sscanf(argv[i+1], "%dx%d", &width, &height) == 2) if (sscanf(argv[i+1], "%dx%d", &width, &height) == 2)
{ {
std::ostringstream o; std::ostringstream o;
o << width << "x" << height; o << width << "x" << height;
std::string res = o.str(); std::string res = o.str();
if (!UserConfigParams::m_fullscreen || std::find(UserConfigParams::m_blacklist_res.begin(), if (!UserConfigParams::m_fullscreen || std::find(UserConfigParams::m_blacklist_res.begin(),
UserConfigParams::m_blacklist_res.end(),res) == UserConfigParams::m_blacklist_res.end()) UserConfigParams::m_blacklist_res.end(),res) == UserConfigParams::m_blacklist_res.end())
{ {
UserConfigParams::m_prev_width = UserConfigParams::m_width = width; UserConfigParams::m_prev_width = UserConfigParams::m_width = width;
UserConfigParams::m_prev_height = UserConfigParams::m_height = height; UserConfigParams::m_prev_height = UserConfigParams::m_height = height;
fprintf ( stdout, "You choose to be in %dx%d.\n", (int)UserConfigParams::m_width, fprintf ( stdout, "You choose to be in %dx%d.\n", (int)UserConfigParams::m_width,
(int)UserConfigParams::m_height ); (int)UserConfigParams::m_height );
} }
else else
fprintf ( stdout, "Resolution %s has been blacklisted, so it is not available!\n", res.c_str()); fprintf ( stdout, "Resolution %s has been blacklisted, so it is not available!\n", res.c_str());
i++; i++;
} }
else else
@ -301,8 +301,8 @@ int handleCmdLine(int argc, char **argv)
} }
else else
{ {
fprintf(stdout, "Kart '%s' not found, ignored.\n", fprintf(stdout, "Kart '%s' not found, ignored.\n",
argv[i+1]); argv[i+1]);
} }
} }
else if( (!strcmp(argv[i], "--mode") && i+1<argc )) else if( (!strcmp(argv[i], "--mode") && i+1<argc ))

View File

@ -30,7 +30,7 @@ FollowTheLeaderRace::FollowTheLeaderRace() : LinearWorld()
{ {
m_leader_intervals = stk_config->m_leader_intervals; m_leader_intervals = stk_config->m_leader_intervals;
m_use_highscores = false; // disable high scores m_use_highscores = false; // disable high scores
TimedRace::setClockMode(COUNTDOWN, m_leader_intervals[0]); TimedRace::setClockMode(COUNTDOWN, m_leader_intervals[0]);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -133,9 +133,9 @@ void FollowTheLeaderRace::update(float delta)
void FollowTheLeaderRace::restartRace() void FollowTheLeaderRace::restartRace()
{ {
LinearWorld::restartRace(); LinearWorld::restartRace();
m_leader_intervals.clear(); m_leader_intervals.clear();
m_leader_intervals = stk_config->m_leader_intervals; m_leader_intervals = stk_config->m_leader_intervals;
TimedRace::setClockMode(COUNTDOWN, m_leader_intervals[0]); TimedRace::setClockMode(COUNTDOWN, m_leader_intervals[0]);
} // restartRace } // restartRace
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -167,11 +167,11 @@ void FollowTheLeaderRace::raceResultOrder( int* order )
order[kart_id] = kart_id; order[kart_id] = kart_id;
scores[kart_id] = race_manager->getKartScore(kart_id); scores[kart_id] = race_manager->getKartScore(kart_id);
race_time[kart_id] = race_manager->getOverallTime(kart_id); race_time[kart_id] = race_manager->getOverallTime(kart_id);
// check this kart is not in front of leader. If it is, give a score of 0 // check this kart is not in front of leader. If it is, give a score of 0
if(m_kart_info[kart_id].m_race_lap * RaceManager::getTrack()->getTrackLength() + getDistanceDownTrackForKart(kart_id) > if(m_kart_info[kart_id].m_race_lap * RaceManager::getTrack()->getTrackLength() + getDistanceDownTrackForKart(kart_id) >
m_kart_info[0].m_race_lap * RaceManager::getTrack()->getTrackLength() + getDistanceDownTrackForKart(0)) m_kart_info[0].m_race_lap * RaceManager::getTrack()->getTrackLength() + getDistanceDownTrackForKart(0))
scores[kart_id] = 0; scores[kart_id] = 0;
} }
//Bubblesort //Bubblesort
@ -192,7 +192,7 @@ void FollowTheLeaderRace::raceResultOrder( int* order )
} }
} }
} while(!sorted); } while(!sorted);
for(unsigned int i=1; i<NUM_KARTS; i++) for(unsigned int i=1; i<NUM_KARTS; i++)
RaceManager::getKart(order[i])->setPosition(i); RaceManager::getKart(order[i])->setPosition(i);

View File

@ -299,7 +299,7 @@ void World::resetAllKarts()
if(!material) if(!material)
{ {
fprintf(stderr, "ERROR: no valid starting position for kart %d on track %s.\n", fprintf(stderr, "ERROR: no valid starting position for kart %d on track %s.\n",
(int)(i-m_kart.begin()), m_track->getIdent().c_str()); (int)(i-m_kart.begin()), m_track->getIdent().c_str());
exit(-1); exit(-1);
} }
all_finished=false; all_finished=false;
@ -503,7 +503,7 @@ void World::restartRace()
// Start music from beginning // Start music from beginning
sound_manager->stopMusic(); sound_manager->stopMusic();
m_track->reset(); m_track->reset();
m_track->startMusic(); m_track->startMusic();
// Enable SFX again // Enable SFX again

View File

@ -49,8 +49,8 @@ NetworkManager::NetworkManager()
if (enet_initialize () != 0) if (enet_initialize () != 0)
{ {
fprintf (stderr, "An error occurred while initializing ENet.\n"); fprintf (stderr, "An error occurred while initializing ENet.\n");
exit(-1); exit(-1);
} }
} // NetworkManager } // NetworkManager
@ -212,7 +212,7 @@ void NetworkManager::handleDisconnection(ENetEvent *event)
return; return;
} }
fprintf(stderr, "%x:%d disconnected (host id %d).\n", event->peer->address.host, fprintf(stderr, "%x:%d disconnected (host id %d).\n", event->peer->address.host,
event->peer->address.port, (int)(long)event->peer->data ); event->peer->address.port, (int)(long)event->peer->data );
m_num_clients--; m_num_clients--;
} // handleDisconnection } // handleDisconnection

View File

@ -51,89 +51,89 @@ btKart::~btKart()
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
btScalar btKart::rayCast(btWheelInfo& wheel) btScalar btKart::rayCast(btWheelInfo& wheel)
{ {
updateWheelTransformsWS( wheel,false); updateWheelTransformsWS( wheel,false);
btScalar depth = -1; btScalar depth = -1;
btScalar raylen = wheel.getSuspensionRestLength()+wheel.m_wheelsRadius+ btScalar raylen = wheel.getSuspensionRestLength()+wheel.m_wheelsRadius+
wheel.m_maxSuspensionTravelCm*0.01f; wheel.m_maxSuspensionTravelCm*0.01f;
btVector3 rayvector = wheel.m_raycastInfo.m_wheelDirectionWS * (raylen); btVector3 rayvector = wheel.m_raycastInfo.m_wheelDirectionWS * (raylen);
const btVector3& source = wheel.m_raycastInfo.m_hardPointWS; const btVector3& source = wheel.m_raycastInfo.m_hardPointWS;
wheel.m_raycastInfo.m_contactPointWS = source + rayvector; wheel.m_raycastInfo.m_contactPointWS = source + rayvector;
const btVector3& target = wheel.m_raycastInfo.m_contactPointWS; const btVector3& target = wheel.m_raycastInfo.m_contactPointWS;
btScalar param = btScalar(0.); btScalar param = btScalar(0.);
btVehicleRaycaster::btVehicleRaycasterResult rayResults; btVehicleRaycaster::btVehicleRaycasterResult rayResults;
assert(m_vehicleRaycaster); assert(m_vehicleRaycaster);
void* object = m_vehicleRaycaster->castRay(source,target,rayResults); void* object = m_vehicleRaycaster->castRay(source,target,rayResults);
wheel.m_raycastInfo.m_groundObject = 0; wheel.m_raycastInfo.m_groundObject = 0;
if (object) if (object)
{ {
param = rayResults.m_distFraction; param = rayResults.m_distFraction;
depth = raylen * rayResults.m_distFraction; depth = raylen * rayResults.m_distFraction;
wheel.m_raycastInfo.m_contactNormalWS = rayResults.m_hitNormalInWorld; wheel.m_raycastInfo.m_contactNormalWS = rayResults.m_hitNormalInWorld;
wheel.m_raycastInfo.m_isInContact = true; wheel.m_raycastInfo.m_isInContact = true;
wheel.m_raycastInfo.m_groundObject = &s_fixedObject;//todo for driving on dynamic/movable objects!; wheel.m_raycastInfo.m_groundObject = &s_fixedObject;//todo for driving on dynamic/movable objects!;
//wheel.m_raycastInfo.m_groundObject = object; //wheel.m_raycastInfo.m_groundObject = object;
btScalar hitDistance = param*raylen; btScalar hitDistance = param*raylen;
wheel.m_raycastInfo.m_suspensionLength = hitDistance - wheel.m_wheelsRadius; wheel.m_raycastInfo.m_suspensionLength = hitDistance - wheel.m_wheelsRadius;
//clamp on max suspension travel //clamp on max suspension travel
btScalar minSuspensionLength = wheel.getSuspensionRestLength() - wheel.m_maxSuspensionTravelCm*btScalar(0.01); btScalar minSuspensionLength = wheel.getSuspensionRestLength() - wheel.m_maxSuspensionTravelCm*btScalar(0.01);
btScalar maxSuspensionLength = wheel.getSuspensionRestLength()+ wheel.m_maxSuspensionTravelCm*btScalar(0.01); btScalar maxSuspensionLength = wheel.getSuspensionRestLength()+ wheel.m_maxSuspensionTravelCm*btScalar(0.01);
if (wheel.m_raycastInfo.m_suspensionLength < minSuspensionLength) if (wheel.m_raycastInfo.m_suspensionLength < minSuspensionLength)
{ {
wheel.m_raycastInfo.m_suspensionLength = minSuspensionLength; wheel.m_raycastInfo.m_suspensionLength = minSuspensionLength;
} }
if (wheel.m_raycastInfo.m_suspensionLength > maxSuspensionLength) if (wheel.m_raycastInfo.m_suspensionLength > maxSuspensionLength)
{ {
wheel.m_raycastInfo.m_suspensionLength = maxSuspensionLength; wheel.m_raycastInfo.m_suspensionLength = maxSuspensionLength;
} }
wheel.m_raycastInfo.m_contactPointWS = rayResults.m_hitPointInWorld; wheel.m_raycastInfo.m_contactPointWS = rayResults.m_hitPointInWorld;
btScalar denominator= wheel.m_raycastInfo.m_contactNormalWS.dot( wheel.m_raycastInfo.m_wheelDirectionWS ); btScalar denominator= wheel.m_raycastInfo.m_contactNormalWS.dot( wheel.m_raycastInfo.m_wheelDirectionWS );
btVector3 chassis_velocity_at_contactPoint; btVector3 chassis_velocity_at_contactPoint;
btVector3 relpos = wheel.m_raycastInfo.m_contactPointWS-getRigidBody()->getCenterOfMassPosition(); btVector3 relpos = wheel.m_raycastInfo.m_contactPointWS-getRigidBody()->getCenterOfMassPosition();
chassis_velocity_at_contactPoint = getRigidBody()->getVelocityInLocalPoint(relpos); chassis_velocity_at_contactPoint = getRigidBody()->getVelocityInLocalPoint(relpos);
btScalar projVel = wheel.m_raycastInfo.m_contactNormalWS.dot( chassis_velocity_at_contactPoint ); btScalar projVel = wheel.m_raycastInfo.m_contactNormalWS.dot( chassis_velocity_at_contactPoint );
if ( denominator >= btScalar(-0.1)) if ( denominator >= btScalar(-0.1))
{ {
wheel.m_suspensionRelativeVelocity = btScalar(0.0); wheel.m_suspensionRelativeVelocity = btScalar(0.0);
wheel.m_clippedInvContactDotSuspension = btScalar(1.0) / btScalar(0.1); wheel.m_clippedInvContactDotSuspension = btScalar(1.0) / btScalar(0.1);
} }
else else
{ {
btScalar inv = btScalar(-1.) / denominator; btScalar inv = btScalar(-1.) / denominator;
wheel.m_suspensionRelativeVelocity = projVel * inv; wheel.m_suspensionRelativeVelocity = projVel * inv;
wheel.m_clippedInvContactDotSuspension = inv; wheel.m_clippedInvContactDotSuspension = inv;
} }
} else } else
{ {
//put wheel info as in rest position //put wheel info as in rest position
wheel.m_raycastInfo.m_suspensionLength = wheel.getSuspensionRestLength(); wheel.m_raycastInfo.m_suspensionLength = wheel.getSuspensionRestLength();
wheel.m_suspensionRelativeVelocity = btScalar(0.0); wheel.m_suspensionRelativeVelocity = btScalar(0.0);
wheel.m_raycastInfo.m_contactNormalWS = - wheel.m_raycastInfo.m_wheelDirectionWS; wheel.m_raycastInfo.m_contactNormalWS = - wheel.m_raycastInfo.m_wheelDirectionWS;
wheel.m_clippedInvContactDotSuspension = btScalar(1.0); wheel.m_clippedInvContactDotSuspension = btScalar(1.0);
} }
return depth; return depth;
} }
@ -390,43 +390,43 @@ bool btKart::projectVehicleToSurface(const btVector3& ray, bool translate_vehicl
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void btKart::updateVehicle( btScalar step ) void btKart::updateVehicle( btScalar step )
{ {
{ {
for (int i=0;i<getNumWheels();i++) for (int i=0;i<getNumWheels();i++)
{ {
updateWheelTransform(i,false); updateWheelTransform(i,false);
} }
} }
m_currentVehicleSpeedKmHour = btScalar(3.6) * getRigidBody()->getLinearVelocity().length(); m_currentVehicleSpeedKmHour = btScalar(3.6) * getRigidBody()->getLinearVelocity().length();
const btTransform& chassisTrans = getChassisWorldTransform(); const btTransform& chassisTrans = getChassisWorldTransform();
btVector3 forwardW ( btVector3 forwardW (
chassisTrans.getBasis()[0][m_indexForwardAxis], chassisTrans.getBasis()[0][m_indexForwardAxis],
chassisTrans.getBasis()[1][m_indexForwardAxis], chassisTrans.getBasis()[1][m_indexForwardAxis],
chassisTrans.getBasis()[2][m_indexForwardAxis]); chassisTrans.getBasis()[2][m_indexForwardAxis]);
if (forwardW.dot(getRigidBody()->getLinearVelocity()) < btScalar(0.)) if (forwardW.dot(getRigidBody()->getLinearVelocity()) < btScalar(0.))
{ {
m_currentVehicleSpeedKmHour *= btScalar(-1.); m_currentVehicleSpeedKmHour *= btScalar(-1.);
} }
// //
// simulate suspension // simulate suspension
// //
int i=0; int i=0;
m_num_wheels_on_ground = 0; m_num_wheels_on_ground = 0;
for (i=0;i<m_wheelInfo.size();i++) for (i=0;i<m_wheelInfo.size();i++)
{ {
btScalar depth; btScalar depth;
depth = rayCast( m_wheelInfo[i]); depth = rayCast( m_wheelInfo[i]);
if (m_wheelInfo[i].m_raycastInfo.m_isInContact) if (m_wheelInfo[i].m_raycastInfo.m_isInContact)
m_num_wheels_on_ground++; m_num_wheels_on_ground++;
} }
// Work around: make sure that either both wheels on one axis // Work around: make sure that either both wheels on one axis
// are on ground, or none of them. This avoids the problem of // are on ground, or none of them. This avoids the problem of
@ -452,115 +452,115 @@ void btKart::updateVehicle( btScalar step )
} }
} // for i=0; i<m_wheelInfo.size(); i+=2 } // for i=0; i<m_wheelInfo.size(); i+=2
updateSuspension(step); updateSuspension(step);
for (i=0;i<m_wheelInfo.size();i++) for (i=0;i<m_wheelInfo.size();i++)
{ {
//apply suspension force //apply suspension force
btWheelInfo& wheel = m_wheelInfo[i]; btWheelInfo& wheel = m_wheelInfo[i];
btScalar suspensionForce = wheel.m_wheelsSuspensionForce; btScalar suspensionForce = wheel.m_wheelsSuspensionForce;
btScalar gMaxSuspensionForce = btScalar(6000.); btScalar gMaxSuspensionForce = btScalar(6000.);
if (suspensionForce > gMaxSuspensionForce) if (suspensionForce > gMaxSuspensionForce)
{ {
suspensionForce = gMaxSuspensionForce; suspensionForce = gMaxSuspensionForce;
} }
btVector3 impulse = wheel.m_raycastInfo.m_contactNormalWS * suspensionForce * step; btVector3 impulse = wheel.m_raycastInfo.m_contactNormalWS * suspensionForce * step;
btVector3 relpos = wheel.m_raycastInfo.m_contactPointWS - getRigidBody()->getCenterOfMassPosition(); btVector3 relpos = wheel.m_raycastInfo.m_contactPointWS - getRigidBody()->getCenterOfMassPosition();
getRigidBody()->applyImpulse(impulse, relpos); getRigidBody()->applyImpulse(impulse, relpos);
} }
updateFriction( step); updateFriction( step);
for (i=0;i<m_wheelInfo.size();i++) for (i=0;i<m_wheelInfo.size();i++)
{ {
btWheelInfo& wheel = m_wheelInfo[i]; btWheelInfo& wheel = m_wheelInfo[i];
btVector3 relpos = wheel.m_raycastInfo.m_hardPointWS - getRigidBody()->getCenterOfMassPosition(); btVector3 relpos = wheel.m_raycastInfo.m_hardPointWS - getRigidBody()->getCenterOfMassPosition();
btVector3 vel = getRigidBody()->getVelocityInLocalPoint( relpos ); btVector3 vel = getRigidBody()->getVelocityInLocalPoint( relpos );
if (wheel.m_raycastInfo.m_isInContact) if (wheel.m_raycastInfo.m_isInContact)
{ {
const btTransform& chassisWorldTransform = getChassisWorldTransform(); const btTransform& chassisWorldTransform = getChassisWorldTransform();
btVector3 fwd ( btVector3 fwd (
chassisWorldTransform.getBasis()[0][m_indexForwardAxis], chassisWorldTransform.getBasis()[0][m_indexForwardAxis],
chassisWorldTransform.getBasis()[1][m_indexForwardAxis], chassisWorldTransform.getBasis()[1][m_indexForwardAxis],
chassisWorldTransform.getBasis()[2][m_indexForwardAxis]); chassisWorldTransform.getBasis()[2][m_indexForwardAxis]);
btScalar proj = fwd.dot(wheel.m_raycastInfo.m_contactNormalWS); btScalar proj = fwd.dot(wheel.m_raycastInfo.m_contactNormalWS);
fwd -= wheel.m_raycastInfo.m_contactNormalWS * proj; fwd -= wheel.m_raycastInfo.m_contactNormalWS * proj;
btScalar proj2 = fwd.dot(vel); btScalar proj2 = fwd.dot(vel);
wheel.m_deltaRotation = (proj2 * step) / (wheel.m_wheelsRadius); wheel.m_deltaRotation = (proj2 * step) / (wheel.m_wheelsRadius);
wheel.m_rotation += wheel.m_deltaRotation; wheel.m_rotation += wheel.m_deltaRotation;
} else } else
{ {
wheel.m_rotation += wheel.m_deltaRotation; wheel.m_rotation += wheel.m_deltaRotation;
} }
wheel.m_deltaRotation *= btScalar(0.99);//damping of rotation when not in contact wheel.m_deltaRotation *= btScalar(0.99);//damping of rotation when not in contact
} }
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void btKart::updateSuspension(btScalar deltaTime) void btKart::updateSuspension(btScalar deltaTime)
{ {
(void)deltaTime; (void)deltaTime;
btScalar chassisMass = btScalar(1.) / m_chassisBody->getInvMass(); btScalar chassisMass = btScalar(1.) / m_chassisBody->getInvMass();
for (int w_it=0; w_it<getNumWheels(); w_it++) for (int w_it=0; w_it<getNumWheels(); w_it++)
{ {
btWheelInfo &wheel_info = m_wheelInfo[w_it]; btWheelInfo &wheel_info = m_wheelInfo[w_it];
if ( wheel_info.m_raycastInfo.m_isInContact ) if ( wheel_info.m_raycastInfo.m_isInContact )
{ {
btScalar force; btScalar force;
// Spring // Spring
{ {
btScalar susp_length = wheel_info.getSuspensionRestLength(); btScalar susp_length = wheel_info.getSuspensionRestLength();
btScalar current_length = wheel_info.m_raycastInfo.m_suspensionLength; btScalar current_length = wheel_info.m_raycastInfo.m_suspensionLength;
btScalar length_diff = (susp_length - current_length); btScalar length_diff = (susp_length - current_length);
force = wheel_info.m_suspensionStiffness force = wheel_info.m_suspensionStiffness
* length_diff * wheel_info.m_clippedInvContactDotSuspension; * length_diff * wheel_info.m_clippedInvContactDotSuspension;
} }
// Damper // Damper
{ {
btScalar projected_rel_vel = wheel_info.m_suspensionRelativeVelocity; btScalar projected_rel_vel = wheel_info.m_suspensionRelativeVelocity;
{ {
btScalar susp_damping; btScalar susp_damping;
if ( projected_rel_vel < btScalar(0.0) ) if ( projected_rel_vel < btScalar(0.0) )
{ {
susp_damping = wheel_info.m_wheelsDampingCompression; susp_damping = wheel_info.m_wheelsDampingCompression;
} }
else else
{ {
susp_damping = wheel_info.m_wheelsDampingRelaxation; susp_damping = wheel_info.m_wheelsDampingRelaxation;
} }
force -= susp_damping * projected_rel_vel; force -= susp_damping * projected_rel_vel;
} }
} }
// RESULT // RESULT
wheel_info.m_wheelsSuspensionForce = force * chassisMass; wheel_info.m_wheelsSuspensionForce = force * chassisMass;
if (wheel_info.m_wheelsSuspensionForce < btScalar(0.)) if (wheel_info.m_wheelsSuspensionForce < btScalar(0.))
{ {
wheel_info.m_wheelsSuspensionForce = btScalar(0.); wheel_info.m_wheelsSuspensionForce = btScalar(0.);
} }
} }
else else
{ {
// A very unphysical thing to handle slopes that are a bit too steep // A very unphysical thing to handle slopes that are a bit too steep
// or uneven (resulting in only one wheel on the ground) // or uneven (resulting in only one wheel on the ground)
// If only the front or only the rear wheels are on the ground, add // If only the front or only the rear wheels are on the ground, add
@ -568,7 +568,7 @@ void btKart::updateSuspension(btScalar deltaTime)
// is already guaranteed that either both or no wheels on one axis // is already guaranteed that either both or no wheels on one axis
// are on the ground, so we have to test only one of the wheels // are on the ground, so we have to test only one of the wheels
wheel_info.m_wheelsSuspensionForce = -m_track_connect_accel*chassisMass ; wheel_info.m_wheelsSuspensionForce = -m_track_connect_accel*chassisMass ;
} }
} // for w_it<number of wheels } // for w_it<number of wheels
} }
@ -578,32 +578,32 @@ void btKart::updateSuspension(btScalar deltaTime)
// Unfortunately bullet (atm) does not declare this struct in the header file. // Unfortunately bullet (atm) does not declare this struct in the header file.
struct btWheelContactPoint struct btWheelContactPoint
{ {
btRigidBody* m_body0; btRigidBody* m_body0;
btRigidBody* m_body1; btRigidBody* m_body1;
btVector3 m_frictionPositionWorld; btVector3 m_frictionPositionWorld;
btVector3 m_frictionDirectionWorld; btVector3 m_frictionDirectionWorld;
btScalar m_jacDiagABInv; btScalar m_jacDiagABInv;
btScalar m_maxImpulse; btScalar m_maxImpulse;
btWheelContactPoint(btRigidBody* body0,btRigidBody* body1,const btVector3& frictionPosWorld,const btVector3& frictionDirectionWorld, btScalar maxImpulse) btWheelContactPoint(btRigidBody* body0,btRigidBody* body1,const btVector3& frictionPosWorld,const btVector3& frictionDirectionWorld, btScalar maxImpulse)
:m_body0(body0), :m_body0(body0),
m_body1(body1), m_body1(body1),
m_frictionPositionWorld(frictionPosWorld), m_frictionPositionWorld(frictionPosWorld),
m_frictionDirectionWorld(frictionDirectionWorld), m_frictionDirectionWorld(frictionDirectionWorld),
m_maxImpulse(maxImpulse) m_maxImpulse(maxImpulse)
{ {
btScalar denom0 = body0->computeImpulseDenominator(frictionPosWorld,frictionDirectionWorld); btScalar denom0 = body0->computeImpulseDenominator(frictionPosWorld,frictionDirectionWorld);
btScalar denom1 = body1->computeImpulseDenominator(frictionPosWorld,frictionDirectionWorld); btScalar denom1 = body1->computeImpulseDenominator(frictionPosWorld,frictionDirectionWorld);
btScalar relaxation = 1.f; btScalar relaxation = 1.f;
m_jacDiagABInv = relaxation/(denom0+denom1); m_jacDiagABInv = relaxation/(denom0+denom1);
} }
}; };
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void btKart::updateFriction(btScalar timeStep) void btKart::updateFriction(btScalar timeStep)
{ {
//calculate the impulse, so that the wheels don't move sidewards //calculate the impulse, so that the wheels don't move sidewards
@ -674,7 +674,7 @@ void btKart::updateFriction(btScalar timeStep)
btWheelInfo& wheelInfo = m_wheelInfo[wheel]; btWheelInfo& wheelInfo = m_wheelInfo[wheel];
class btRigidBody* groundObject = (class btRigidBody*) wheelInfo.m_raycastInfo.m_groundObject; class btRigidBody* groundObject = (class btRigidBody*) wheelInfo.m_raycastInfo.m_groundObject;
btScalar rollingFriction = 0.f; btScalar rollingFriction = 0.f;
m_forwardImpulse[wheel] = btScalar(0.); m_forwardImpulse[wheel] = btScalar(0.);
m_wheelInfo[wheel].m_skidInfo= btScalar(1.); m_wheelInfo[wheel].m_skidInfo= btScalar(1.);

View File

@ -28,20 +28,20 @@ subject to the following restrictions:
//! //!
void btUprightConstraint::solveAngularLimit( void btUprightConstraint::solveAngularLimit(
btUprightConstraintLimit *limit, btUprightConstraintLimit *limit,
btScalar timeStep, btScalar jacDiagABInv, btScalar timeStep, btScalar jacDiagABInv,
btRigidBody * body0 ) btRigidBody * body0 )
{ {
// Work out if limit is violated // Work out if limit is violated
if(limit->m_angle>=m_loLimit && limit->m_angle<=m_hiLimit) return; if(limit->m_angle>=m_loLimit && limit->m_angle<=m_hiLimit) return;
limit->m_currentLimitError = (limit->m_angle<m_loLimit) limit->m_currentLimitError = (limit->m_angle<m_loLimit)
? limit->m_angle - m_loLimit ? limit->m_angle - m_loLimit
: limit->m_angle - m_hiLimit; : limit->m_angle - m_hiLimit;
btScalar targetVelocity = -m_ERP*limit->m_currentLimitError/(3.1415f/8.0f*timeStep); btScalar targetVelocity = -m_ERP*limit->m_currentLimitError/(3.1415f/8.0f*timeStep);
btScalar maxMotorForce = m_maxLimitForce; btScalar maxMotorForce = m_maxLimitForce;
maxMotorForce *= timeStep; maxMotorForce *= timeStep;
@ -55,7 +55,7 @@ void btUprightConstraint::solveAngularLimit(
// correction impulse // correction impulse
btScalar unclippedMotorImpulse = (1+m_bounce)*motorVelocity*jacDiagABInv; btScalar unclippedMotorImpulse = (1+m_bounce)*motorVelocity*jacDiagABInv;
// clip correction impulse // clip correction impulse
btScalar clippedMotorImpulse = unclippedMotorImpulse; btScalar clippedMotorImpulse = unclippedMotorImpulse;
//todo: should clip against accumulated impulse //todo: should clip against accumulated impulse
@ -69,7 +69,7 @@ void btUprightConstraint::solveAngularLimit(
clippedMotorImpulse = unclippedMotorImpulse < -maxMotorForce ? -maxMotorForce: unclippedMotorImpulse; clippedMotorImpulse = unclippedMotorImpulse < -maxMotorForce ? -maxMotorForce: unclippedMotorImpulse;
} }
// sort with accumulated impulses // sort with accumulated impulses
btScalar lo = btScalar(-1e30); btScalar lo = btScalar(-1e30);
btScalar hi = btScalar(1e30); btScalar hi = btScalar(1e30);
@ -77,7 +77,7 @@ void btUprightConstraint::solveAngularLimit(
btScalar sum = oldaccumImpulse + clippedMotorImpulse; btScalar sum = oldaccumImpulse + clippedMotorImpulse;
limit->m_accumulatedImpulse = sum > hi ? btScalar(0.) : sum < lo ? btScalar(0.) : sum; limit->m_accumulatedImpulse = sum > hi ? btScalar(0.) : sum < lo ? btScalar(0.) : sum;
clippedMotorImpulse = limit->m_accumulatedImpulse - oldaccumImpulse; clippedMotorImpulse = limit->m_accumulatedImpulse - oldaccumImpulse;
@ -102,9 +102,9 @@ btUprightConstraint::btUprightConstraint(btRigidBody& rbA, const btTransform& fr
m_disable_time = 0.0f; m_disable_time = 0.0f;
m_limit[0].m_accumulatedImpulse = 0.0f; m_limit[0].m_accumulatedImpulse = 0.0f;
m_limit[1].m_accumulatedImpulse = 0.0f; m_limit[1].m_accumulatedImpulse = 0.0f;
m_limit[ 0 ].m_axis = btVector3( 1, 0, 0 ); m_limit[ 0 ].m_axis = btVector3( 1, 0, 0 );
m_limit[ 1 ].m_axis = btVector3( 0, 1, 0 ); m_limit[ 1 ].m_axis = btVector3( 0, 1, 0 );
setLimit( SIMD_PI * 0.4f ); setLimit( SIMD_PI * 0.4f );
} }
//! //!
@ -115,22 +115,22 @@ void btUprightConstraint::buildJacobian()
{ {
btTransform worldTransform = m_rbA.getCenterOfMassTransform() * m_frameInA; btTransform worldTransform = m_rbA.getCenterOfMassTransform() * m_frameInA;
btVector3 upAxis = worldTransform.getBasis().getColumn(2); btVector3 upAxis = worldTransform.getBasis().getColumn(2);
m_limit[ 0 ].m_angle = btAtan2( upAxis.getZ(), upAxis.getY() )-SIMD_PI/2.0f; m_limit[ 0 ].m_angle = btAtan2( upAxis.getZ(), upAxis.getY() )-SIMD_PI/2.0f;
m_limit[ 1 ].m_angle = -btAtan2( upAxis.getZ(), upAxis.getX() )+SIMD_PI/2.0f; m_limit[ 1 ].m_angle = -btAtan2( upAxis.getZ(), upAxis.getX() )+SIMD_PI/2.0f;
for ( int i = 0; i < 2; i++ ) for ( int i = 0; i < 2; i++ )
{ {
if ( m_limit[ i ].m_angle < -SIMD_PI ) if ( m_limit[ i ].m_angle < -SIMD_PI )
m_limit[ i ].m_angle += 2 * SIMD_PI; m_limit[ i ].m_angle += 2 * SIMD_PI;
if ( m_limit[ i ].m_angle > SIMD_PI ) if ( m_limit[ i ].m_angle > SIMD_PI )
m_limit[ i ].m_angle -= 2 * SIMD_PI; m_limit[ i ].m_angle -= 2 * SIMD_PI;
new (&m_jacAng[ i ]) btJacobianEntry( m_limit[ i ].m_axis, new (&m_jacAng[ i ]) btJacobianEntry( m_limit[ i ].m_axis,
m_rbA.getCenterOfMassTransform().getBasis().transpose(), m_rbA.getCenterOfMassTransform().getBasis().transpose(),
m_rbB.getCenterOfMassTransform().getBasis().transpose(), m_rbB.getCenterOfMassTransform().getBasis().transpose(),
m_rbA.getInvInertiaDiagLocal(), m_rbA.getInvInertiaDiagLocal(),
m_rbB.getInvInertiaDiagLocal()); m_rbB.getInvInertiaDiagLocal());
} }
} }
//! //!
@ -148,7 +148,7 @@ void btUprightConstraint::solveConstraint(btScalar timeStep)
if(m_disable_time>0.0f) return; if(m_disable_time>0.0f) return;
} }
solveAngularLimit( &m_limit[ 0 ], m_timeStep, btScalar(1.) / m_jacAng[ 0 ].getDiagonal(), &m_rbA ); solveAngularLimit( &m_limit[ 0 ], m_timeStep, btScalar(1.) / m_jacAng[ 0 ].getDiagonal(), &m_rbA );
solveAngularLimit( &m_limit[ 1 ], m_timeStep, btScalar(1.) / m_jacAng[ 1 ].getDiagonal(), &m_rbA ); solveAngularLimit( &m_limit[ 1 ], m_timeStep, btScalar(1.) / m_jacAng[ 1 ].getDiagonal(), &m_rbA );
} }

View File

@ -71,7 +71,7 @@ void HighscoreManager::Load()
{ {
const lisp::Lisp* root = 0; const lisp::Lisp* root = 0;
std::exception err; std::exception err;
try try
{ {

View File

@ -55,7 +55,7 @@ bool ReplayRecorder::initRecorder( unsigned int number_karts, size_t number_prea
bool ReplayRecorder::pushFrame() bool ReplayRecorder::pushFrame()
{ {
// we dont record the startphase .. // we dont record the startphase ..
assert( RaceManager::getWorld()->getPhase() != World::START_PHASE ); assert( RaceManager::getWorld()->getPhase() != World::START_PHASE );
assert( RaceManager::getWorld()->getNumKarts() == m_ReplayBuffers.getNumberKarts() ); assert( RaceManager::getWorld()->getNumKarts() == m_ReplayBuffers.getNumberKarts() );

View File

@ -192,7 +192,7 @@ void FeatureUnlockedCutScene::onUpdate(float dt, irr::video::IVideoDriver* drive
//printf("m_key_angle = %f\n", m_key_angle); //printf("m_key_angle = %f\n", m_key_angle);
m_key->setRotation( core::vector3df(0, m_key_angle*90.0f, -m_key_angle*90.0f) ); m_key->setRotation( core::vector3df(0, m_key_angle*90.0f, -m_key_angle*90.0f) );
const int GIFT_EXIT_FROM = 7; const int GIFT_EXIT_FROM = 7;
const int GIFT_EXIT_TO = 20; const int GIFT_EXIT_TO = 20;
if (m_global_time > GIFT_EXIT_FROM && m_global_time < GIFT_EXIT_TO && m_root_gift_node != NULL) if (m_global_time > GIFT_EXIT_FROM && m_global_time < GIFT_EXIT_TO && m_root_gift_node != NULL)
@ -201,9 +201,9 @@ void FeatureUnlockedCutScene::onUpdate(float dt, irr::video::IVideoDriver* drive
m_chest_top->setRotation( core::vector3df( 360.0f-(float)std::min(110.0, chest_top_angle), 0, 0 )); m_chest_top->setRotation( core::vector3df( 360.0f-(float)std::min(110.0, chest_top_angle), 0, 0 ));
if (chest_top_angle < 110.0) if (chest_top_angle < 110.0)
{ {
core::vector3df chestpos = m_chest_top->getPosition(); core::vector3df chestpos = m_chest_top->getPosition();
chestpos.Y += dt*6; chestpos.Y += dt*6;
m_chest_top->setPosition(chestpos); m_chest_top->setPosition(chestpos);
} }
core::vector3df pos = m_root_gift_node->getPosition(); core::vector3df pos = m_root_gift_node->getPosition();
@ -235,13 +235,13 @@ void FeatureUnlockedCutScene::onUpdate(float dt, irr::video::IVideoDriver* drive
if (m_root_gift_node != NULL) if (m_root_gift_node != NULL)
{ {
m_camera->setTarget( m_root_gift_node->getPosition() + core::vector3df(0.0f, 10.0f, 0.0f) ); m_camera->setTarget( m_root_gift_node->getPosition() + core::vector3df(0.0f, 10.0f, 0.0f) );
m_camera->updateAbsolutePosition(); m_camera->updateAbsolutePosition();
} }
else else
{ {
m_camera->setTarget( core::vector3df(0, 10, 0.0f) ); m_camera->setTarget( core::vector3df(0, 10, 0.0f) );
m_camera->updateAbsolutePosition(); m_camera->updateAbsolutePosition();
} }
static const int w = irr_driver->getFrameSize().Width; static const int w = irr_driver->getFrameSize().Width;

View File

@ -65,14 +65,14 @@ void MainMenuScreen::eventCallback(Widget* widget, const std::string& name, cons
if (i % 2 == 0) if (i % 2 == 0)
{ {
// the passed kart will not be modified, that's why I allow myself to use const_cast // the passed kart will not be modified, that's why I allow myself to use const_cast
scene->setUnlockedKart( const_cast<KartProperties*>(kart_properties_manager->getKart("gnu")) ); scene->setUnlockedKart( const_cast<KartProperties*>(kart_properties_manager->getKart("gnu")) );
StateManager::get()->pushScreen(scene); StateManager::get()->pushScreen(scene);
} }
else else
{ {
scene->setUnlockedPicture( GUIEngine::getDriver()->getTexture(track_manager->getTrack("beach")->getScreenshotFile().c_str()) ); scene->setUnlockedPicture( GUIEngine::getDriver()->getTexture(track_manager->getTrack("beach")->getScreenshotFile().c_str()) );
StateManager::get()->pushScreen(scene); StateManager::get()->pushScreen(scene);
} }
} }

View File

@ -157,7 +157,7 @@ void OptionsScreenInput::gotSensedInput(Input* sensedInput)
const bool keyboard = sensedInput->type == Input::IT_KEYBOARD && deviceID.find("keyboard") != std::string::npos; const bool keyboard = sensedInput->type == Input::IT_KEYBOARD && deviceID.find("keyboard") != std::string::npos;
const bool gamepad = (sensedInput->type == Input::IT_STICKMOTION || const bool gamepad = (sensedInput->type == Input::IT_STICKMOTION ||
sensedInput->type == Input::IT_STICKBUTTON) && sensedInput->type == Input::IT_STICKBUTTON) &&
deviceID.find("gamepad") != std::string::npos; deviceID.find("gamepad") != std::string::npos;
if (!keyboard && !gamepad) return; if (!keyboard && !gamepad) return;
if (gamepad) if (gamepad)
@ -275,7 +275,7 @@ void OptionsScreenInput::eventCallback(Widget* widget, const std::string& name,
read = sscanf( selection.c_str(), "keyboard%i", &i ); read = sscanf( selection.c_str(), "keyboard%i", &i );
if (read == 1 && i != -1) if (read == 1 && i != -1)
{ {
updateInputButtons( input_manager->getDeviceList()->getKeyboardConfig(i) ); updateInputButtons( input_manager->getDeviceList()->getKeyboardConfig(i) );
} }
else else
{ {

View File

@ -295,7 +295,7 @@ void RaceGUI::drawGlobalMiniMap()
{ {
const Kart *kart = RaceManager::getKart(i); const Kart *kart = RaceManager::getKart(i);
if(kart->isEliminated()) continue; // don't draw eliminated kart if(kart->isEliminated()) continue; // don't draw eliminated kart
const Vec3& xyz = kart->getXYZ(); const Vec3& xyz = kart->getXYZ();
Vec3 draw_at; Vec3 draw_at;
RaceManager::getTrack()->mapPoint2MiniMap(xyz, &draw_at); RaceManager::getTrack()->mapPoint2MiniMap(xyz, &draw_at);
// int marker_height = m_marker->getOriginalSize().Height; // int marker_height = m_marker->getOriginalSize().Height;

View File

@ -39,7 +39,7 @@ AmbientLightSphere::AmbientLightSphere(CheckManager *check_manager,
{ {
m_ambient_color = video::SColor(255, 0, 255, 0); // green m_ambient_color = video::SColor(255, 0, 255, 0); // green
m_inner_radius2 = 1; m_inner_radius2 = 1;
node.get("inner-radius", &m_inner_radius2); node.get("inner-radius", &m_inner_radius2);
m_inner_radius2 *= m_inner_radius2; // store the squared value m_inner_radius2 *= m_inner_radius2; // store the squared value
node.get("color", &m_ambient_color); node.get("color", &m_ambient_color);
} // AmbientLightSphere } // AmbientLightSphere

View File

@ -23,39 +23,39 @@
BezierCurve::BezierCurve(const XMLNode &node) BezierCurve::BezierCurve(const XMLNode &node)
{ {
for(unsigned int i=0; i<node.getNumNodes(); i++) for(unsigned int i=0; i<node.getNumNodes(); i++)
{ {
const XMLNode *p = node.getNode(i); const XMLNode *p = node.getNode(i);
BezierData b; BezierData b;
p->get("c", &b.m_control_point); p->get("c", &b.m_control_point);
p->get("h1", &b.m_handle1); p->get("h1", &b.m_handle1);
p->get("h2", &b.m_handle2); p->get("h2", &b.m_handle2);
m_all_data.push_back(b); m_all_data.push_back(b);
} // for i<node.getNumNodes() } // for i<node.getNumNodes()
} // BezierCurve } // BezierCurve
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
Vec3 BezierCurve::getXYZ(float t) const Vec3 BezierCurve::getXYZ(float t) const
{ {
unsigned int i=int(t); // FIXME: have to figure out which point we want here unsigned int i=int(t); // FIXME: have to figure out which point we want here
if(i>=m_all_data.size()-1) return m_all_data[i].m_control_point; if(i>=m_all_data.size()-1) return m_all_data[i].m_control_point;
const BezierData &p0 = m_all_data[i]; const BezierData &p0 = m_all_data[i];
const BezierData &p1 = m_all_data[i+1]; const BezierData &p1 = m_all_data[i+1];
Vec3 c = 3*(p0.m_handle2-p0.m_control_point); Vec3 c = 3*(p0.m_handle2-p0.m_control_point);
Vec3 b = 3*(p1.m_handle1-p0.m_handle2)-c; Vec3 b = 3*(p1.m_handle1-p0.m_handle2)-c;
Vec3 a = p1.m_control_point - p0.m_control_point - c - b; Vec3 a = p1.m_control_point - p0.m_control_point - c - b;
t = t-i; t = t-i;
Vec3 r = a*t*t*t + b*t*t + c*t + p0.m_control_point; Vec3 r = a*t*t*t + b*t*t + c*t + p0.m_control_point;
return r; return r;
} // getXYZ } // getXYZ
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
Vec3 BezierCurve::getHPR(float t) const Vec3 BezierCurve::getHPR(float t) const
{ {
// FIXME: not yet implemented // FIXME: not yet implemented
Vec3 hpr; Vec3 hpr;
return hpr; return hpr;
} // getHPR } // getHPR

View File

@ -34,9 +34,9 @@ CheckLine::CheckLine(CheckManager *check_manager, const XMLNode &node)
{ {
m_previous_sign.resize(race_manager->getNumKarts()); m_previous_sign.resize(race_manager->getNumKarts());
core::vector2df p1, p2; core::vector2df p1, p2;
node.get("p1", &p1); node.get("p1", &p1);
node.get("p2", &p2); node.get("p2", &p2);
node.get("min-height", &m_min_height); node.get("min-height", &m_min_height);
m_line.setLine(p1, p2); m_line.setLine(p1, p2);
} // CheckLine } // CheckLine

View File

@ -29,25 +29,25 @@
CheckManager::CheckManager(const XMLNode &node, Track *track) CheckManager::CheckManager(const XMLNode &node, Track *track)
{ {
for(unsigned int i=0; i<node.getNumNodes(); i++) for(unsigned int i=0; i<node.getNumNodes(); i++)
{ {
const XMLNode *check_node = node.getNode(i); const XMLNode *check_node = node.getNode(i);
const std::string &type = check_node->getName(); const std::string &type = check_node->getName();
if(type=="check-line") if(type=="check-line")
{ {
CheckLine *cl = new CheckLine(this, *check_node); CheckLine *cl = new CheckLine(this, *check_node);
m_all_checks.push_back(cl); m_all_checks.push_back(cl);
if(cl->getType()==CheckStructure::CT_NEW_LAP) if(cl->getType()==CheckStructure::CT_NEW_LAP)
{ {
track->getQuadGraph().setStartCoordinate(*cl); track->getQuadGraph().setStartCoordinate(*cl);
} }
} // checkline } // checkline
else if(type=="check-sphere") else if(type=="check-sphere")
{ {
AmbientLightSphere *cs = new AmbientLightSphere(this, *check_node); AmbientLightSphere *cs = new AmbientLightSphere(this, *check_node);
m_all_checks.push_back(cs); m_all_checks.push_back(cs);
} // checksphere } // checksphere
} // for i<node.getNumNodes } // for i<node.getNumNodes
} // CheckManager } // CheckManager
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -55,8 +55,8 @@ CheckManager::CheckManager(const XMLNode &node, Track *track)
void CheckManager::reset(const Track &track) void CheckManager::reset(const Track &track)
{ {
std::vector<CheckStructure*>::iterator i; std::vector<CheckStructure*>::iterator i;
for(i=m_all_checks.begin(); i!=m_all_checks.end(); i++) for(i=m_all_checks.begin(); i!=m_all_checks.end(); i++)
(*i)->reset(track); (*i)->reset(track);
} // reset } // reset
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -65,8 +65,8 @@ void CheckManager::reset(const Track &track)
*/ */
void CheckManager::update(float dt) void CheckManager::update(float dt)
{ {
std::vector<CheckStructure*>::iterator i; std::vector<CheckStructure*>::iterator i;
for(i=m_all_checks.begin(); i!=m_all_checks.end(); i++) for(i=m_all_checks.begin(); i!=m_all_checks.end(); i++)
(*i)->update(dt); (*i)->update(dt);
} // update } // update

View File

@ -36,7 +36,7 @@ CheckSphere::CheckSphere(CheckManager *check_manager, const XMLNode &node)
{ {
m_radius2 = 1; m_radius2 = 1;
node.get("radius", &m_radius2); node.get("radius", &m_radius2);
m_radius2 *= m_radius2; m_radius2 *= m_radius2;
node.get("xyz", &m_center_point); node.get("xyz", &m_center_point);
m_is_inside.resize(race_manager->getNumKarts()); m_is_inside.resize(race_manager->getNumKarts());