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:
parent
5a938b4bf9
commit
5fe41e5625
@ -26,12 +26,12 @@
|
||||
|
||||
AnimationBase::AnimationBase(const XMLNode &node, float fps)
|
||||
{
|
||||
for(unsigned int i=0; i<node.getNumNodes(); i++)
|
||||
{
|
||||
Ipo *ipo = new Ipo(*node.getNode(i), fps);
|
||||
m_all_ipos.push_back(ipo);
|
||||
} // for i<getNumNodes()
|
||||
m_playing = true;
|
||||
for(unsigned int i=0; i<node.getNumNodes(); i++)
|
||||
{
|
||||
Ipo *ipo = new Ipo(*node.getNode(i), fps);
|
||||
m_all_ipos.push_back(ipo);
|
||||
} // for i<getNumNodes()
|
||||
m_playing = true;
|
||||
|
||||
} // AnimationBase
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -39,8 +39,8 @@ AnimationBase::AnimationBase(const XMLNode &node, float fps)
|
||||
*/
|
||||
AnimationBase::~AnimationBase()
|
||||
{
|
||||
std::vector<Ipo*>::iterator i;
|
||||
for(i=m_all_ipos.begin(); i<m_all_ipos.end(); i++)
|
||||
std::vector<Ipo*>::iterator i;
|
||||
for(i=m_all_ipos.begin(); i<m_all_ipos.end(); i++)
|
||||
delete *i;
|
||||
m_all_ipos.clear();
|
||||
} // ~AnimationBase
|
||||
@ -52,13 +52,13 @@ AnimationBase::~AnimationBase()
|
||||
* \param hpr Rotation of the object.
|
||||
*/
|
||||
void AnimationBase::setInitialTransform(const core::vector3df &xyz,
|
||||
const core::vector3df &hpr)
|
||||
const core::vector3df &hpr)
|
||||
{
|
||||
std::vector<Ipo*>::iterator i;
|
||||
for(i=m_all_ipos.begin(); i<m_all_ipos.end(); i++)
|
||||
{
|
||||
(*i)->setInitialTransform(xyz, hpr);
|
||||
} // for i in m_all_ipos
|
||||
std::vector<Ipo*>::iterator i;
|
||||
for(i=m_all_ipos.begin(); i<m_all_ipos.end(); i++)
|
||||
{
|
||||
(*i)->setInitialTransform(xyz, hpr);
|
||||
} // for i in m_all_ipos
|
||||
} // setTransform
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -66,11 +66,11 @@ void AnimationBase::setInitialTransform(const core::vector3df &xyz,
|
||||
*/
|
||||
void AnimationBase::reset()
|
||||
{
|
||||
std::vector<Ipo*>::iterator i;
|
||||
for(i=m_all_ipos.begin(); i<m_all_ipos.end(); i++)
|
||||
{
|
||||
(*i)->reset();
|
||||
} // for i in m_all_ipos
|
||||
std::vector<Ipo*>::iterator i;
|
||||
for(i=m_all_ipos.begin(); i<m_all_ipos.end(); i++)
|
||||
{
|
||||
(*i)->reset();
|
||||
} // for i in m_all_ipos
|
||||
} // reset
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -80,12 +80,12 @@ void AnimationBase::reset()
|
||||
* \param hpr Rotation to be updated.
|
||||
*/
|
||||
void AnimationBase::update(float dt, core::vector3df *xyz,
|
||||
core::vector3df *hpr)
|
||||
core::vector3df *hpr)
|
||||
{
|
||||
std::vector<Ipo*>::iterator i;
|
||||
for(i=m_all_ipos.begin(); i<m_all_ipos.end(); i++)
|
||||
{
|
||||
(*i)->update(dt, xyz, hpr);
|
||||
} // for i in m_all_ipos
|
||||
std::vector<Ipo*>::iterator i;
|
||||
for(i=m_all_ipos.begin(); i<m_all_ipos.end(); i++)
|
||||
{
|
||||
(*i)->update(dt, xyz, hpr);
|
||||
} // for i in m_all_ipos
|
||||
|
||||
} // float dt
|
||||
|
@ -27,20 +27,20 @@
|
||||
|
||||
AnimationManager::AnimationManager(const Track &track, const XMLNode &node)
|
||||
{
|
||||
for(unsigned int i=0; i<node.getNumNodes(); i++)
|
||||
{
|
||||
const XMLNode *anim_node = node.getNode(i);
|
||||
std::string type = anim_node->getName();
|
||||
float fps=25;
|
||||
anim_node->get("fps", &fps);
|
||||
if(type=="anim_billboard")
|
||||
m_all_animations.push_back(new BillboardAnimation(track, *anim_node, fps));
|
||||
else if(type=="animations-IPO")
|
||||
m_all_animations.push_back(new ThreeDAnimation(track, *anim_node, fps));
|
||||
else
|
||||
fprintf(stderr, "Unknown animation type '%s' - ignored.\n",
|
||||
type.c_str());
|
||||
} // for i<node.getNumNodes
|
||||
for(unsigned int i=0; i<node.getNumNodes(); i++)
|
||||
{
|
||||
const XMLNode *anim_node = node.getNode(i);
|
||||
std::string type = anim_node->getName();
|
||||
float fps=25;
|
||||
anim_node->get("fps", &fps);
|
||||
if(type=="anim_billboard")
|
||||
m_all_animations.push_back(new BillboardAnimation(track, *anim_node, fps));
|
||||
else if(type=="animations-IPO")
|
||||
m_all_animations.push_back(new ThreeDAnimation(track, *anim_node, fps));
|
||||
else
|
||||
fprintf(stderr, "Unknown animation type '%s' - ignored.\n",
|
||||
type.c_str());
|
||||
} // for i<node.getNumNodes
|
||||
} // AnimationManager
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -49,9 +49,9 @@ AnimationManager::AnimationManager(const Track &track, const XMLNode &node)
|
||||
*/
|
||||
AnimationManager::~AnimationManager()
|
||||
{
|
||||
std::vector<AnimationBase*>::iterator i;
|
||||
for(i=m_all_animations.begin(); i!=m_all_animations.end(); i++)
|
||||
delete *i;
|
||||
std::vector<AnimationBase*>::iterator i;
|
||||
for(i=m_all_animations.begin(); i!=m_all_animations.end(); i++)
|
||||
delete *i;
|
||||
m_all_animations.clear();
|
||||
} // ~AnimationManager
|
||||
|
||||
@ -60,9 +60,9 @@ AnimationManager::~AnimationManager()
|
||||
*/
|
||||
void AnimationManager::reset()
|
||||
{
|
||||
std::vector<AnimationBase*>::iterator i;
|
||||
for(i=m_all_animations.begin(); i!=m_all_animations.end(); i++)
|
||||
(*i)->reset();
|
||||
std::vector<AnimationBase*>::iterator i;
|
||||
for(i=m_all_animations.begin(); i!=m_all_animations.end(); i++)
|
||||
(*i)->reset();
|
||||
} // reset
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -71,7 +71,7 @@ void AnimationManager::reset()
|
||||
*/
|
||||
void AnimationManager::update(float dt)
|
||||
{
|
||||
std::vector<AnimationBase*>::iterator i;
|
||||
for(i=m_all_animations.begin(); i!=m_all_animations.end(); i++)
|
||||
(*i)->update(dt);
|
||||
std::vector<AnimationBase*>::iterator i;
|
||||
for(i=m_all_animations.begin(); i!=m_all_animations.end(); i++)
|
||||
(*i)->update(dt);
|
||||
} // update
|
||||
|
@ -23,7 +23,7 @@ class XMLNode;
|
||||
|
||||
/** A 2d billboard animation. */
|
||||
BillboardAnimation::BillboardAnimation(const Track &track_name,
|
||||
const XMLNode &node, float fps)
|
||||
const XMLNode &node, float fps)
|
||||
: AnimationBase(node, fps)
|
||||
{
|
||||
} // BillboardAnimation
|
||||
@ -33,9 +33,9 @@ BillboardAnimation::BillboardAnimation(const Track &track_name,
|
||||
* \param dt Time since last call. */
|
||||
void BillboardAnimation::update(float dt)
|
||||
{
|
||||
// FIXME: not implemented yet.
|
||||
core::vector3df xyz(0, 0, 0);
|
||||
core::vector3df hpr(0, 0, 0);
|
||||
AnimationBase::update(dt, &xyz, &hpr);
|
||||
// FIXME: not implemented yet.
|
||||
core::vector3df xyz(0, 0, 0);
|
||||
core::vector3df hpr(0, 0, 0);
|
||||
AnimationBase::update(dt, &xyz, &hpr);
|
||||
|
||||
} // update
|
||||
|
@ -132,7 +132,7 @@ void MusicInformation::startMusic()
|
||||
{
|
||||
delete m_normal_music;
|
||||
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());
|
||||
return;
|
||||
}
|
||||
@ -160,7 +160,7 @@ void MusicInformation::startMusic()
|
||||
{
|
||||
delete m_fast_music;
|
||||
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());
|
||||
return;
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ MusicOggStream::MusicOggStream()
|
||||
MusicOggStream::~MusicOggStream()
|
||||
{
|
||||
if(stopMusic() == false)
|
||||
fprintf(stderr, "WARNING: problems while stopping music.\n");
|
||||
fprintf(stderr, "WARNING: problems while stopping music.\n");
|
||||
} // ~MusicOggStream
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -250,7 +250,7 @@ void MusicOggStream::update()
|
||||
if(!active)
|
||||
{
|
||||
// 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
|
||||
//fprintf(stdout,"Music buffer under-run.\n");
|
||||
}
|
||||
@ -266,7 +266,7 @@ void MusicOggStream::update()
|
||||
alGetSourcei(m_soundSource, AL_SOURCE_STATE, &state);
|
||||
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);
|
||||
alSourcePlay(m_soundSource);
|
||||
}
|
||||
|
@ -122,8 +122,8 @@ void SFXManager::loadSfx()
|
||||
loadSingleSfx(lisp, "ugh", SOUND_UGH );
|
||||
loadSingleSfx(lisp, "skid", SOUND_SKID );
|
||||
loadSingleSfx(lisp, "locked", SOUND_LOCKED );
|
||||
loadSingleSfx(lisp, "bowling_roll", SOUND_BOWLING_ROLL );
|
||||
loadSingleSfx(lisp, "bowling_strike",SOUND_BOWLING_STRIKE );
|
||||
loadSingleSfx(lisp, "bowling_roll", SOUND_BOWLING_ROLL );
|
||||
loadSingleSfx(lisp, "bowling_strike",SOUND_BOWLING_STRIKE );
|
||||
loadSingleSfx(lisp, "winner", SOUND_WINNER );
|
||||
loadSingleSfx(lisp, "crash", SOUND_CRASH );
|
||||
loadSingleSfx(lisp, "grab", SOUND_GRAB );
|
||||
|
@ -44,7 +44,7 @@ public:
|
||||
enum SFXType
|
||||
{
|
||||
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_PRESTART, SOUND_START, SOUND_ENGINE_SMALL, SOUND_ENGINE_LARGE,
|
||||
NUM_SOUNDS
|
||||
@ -81,7 +81,7 @@ public:
|
||||
SFX_INITIAL = 3
|
||||
};
|
||||
|
||||
private:
|
||||
private:
|
||||
/** The buffers for all sound effects. These are shared among all
|
||||
* instances of SFXOpenal. */
|
||||
std::vector<ALuint> m_sfx_buffers;
|
||||
|
@ -174,7 +174,7 @@ SFXManager::SFXStatus SFXOpenAL::getStatus()
|
||||
{
|
||||
if(!sfx_manager->sfxAllowed()||!m_ok) return SFXManager::SFX_UNKNOWN;
|
||||
|
||||
int state = 0;
|
||||
int state = 0;
|
||||
alGetSourcei(m_soundSource, AL_SOURCE_STATE, &state);
|
||||
switch(state)
|
||||
{
|
||||
|
@ -49,7 +49,7 @@ public:
|
||||
virtual void position(const Vec3 &position);
|
||||
virtual void volume(float gain);
|
||||
virtual SFXManager::SFXStatus getStatus();
|
||||
|
||||
|
||||
}; // SFXOpenAL
|
||||
|
||||
#endif // HEADER_SFX_OPENAL_HPP
|
||||
|
@ -35,7 +35,7 @@ extern bool IS_LITTLE_ENDIAN;
|
||||
|
||||
class SoundManager
|
||||
{
|
||||
private:
|
||||
private:
|
||||
MusicInformation *m_current_music;
|
||||
|
||||
/** If the sound could not be initialized, e.g. if the player doesn't has
|
||||
|
@ -586,7 +586,7 @@ void IrrDriver::renderBulletDebugView()
|
||||
GLfloat light_ambient[] = { 0.0, 0.0, 0.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 };
|
||||
/* 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_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_camera = irr_driver->getSceneManager()->addCameraSceneNode();
|
||||
m_camera = irr_driver->getSceneManager()->addCameraSceneNode();
|
||||
|
||||
m_camera->setPosition( core::vector3df(0.0, 20.0f, 70.0f) );
|
||||
m_camera->setUpVector( core::vector3df(0.0, 1.0, 0.0) );
|
||||
|
@ -84,7 +84,7 @@ public:
|
||||
video::ITexture *getTexture(const std::string &filename);
|
||||
scene::IMesh *createQuadMesh(const video::SMaterial *material=NULL,
|
||||
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,
|
||||
float wave_speed, float wave_length);
|
||||
scene::ISceneNode *addOctTree(scene::IMesh *mesh);
|
||||
|
@ -43,7 +43,7 @@ public:
|
||||
void reInit ();
|
||||
void setAllMaterialFlags(video::ITexture* t,
|
||||
scene::IMeshBuffer *mb) const;
|
||||
void setAllUntexturedMaterialFlags(scene::IMeshBuffer *mb) const;
|
||||
void setAllUntexturedMaterialFlags(scene::IMeshBuffer *mb) const;
|
||||
int addEntity (Material *m);
|
||||
Material *getMaterial (const std::string& t, bool is_full_path=false,
|
||||
bool make_permanent=false);
|
||||
|
@ -179,7 +179,7 @@ void init(IrrlichtDevice* device_a, IVideoDriver* driver_a, AbstractStateManager
|
||||
g_focus_for_player[n] = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
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.
|
||||
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_env->setSkin(g_skin);
|
||||
//g_skin = g_env->getSkin();
|
||||
//g_skin = g_env->getSkin();
|
||||
|
||||
// font size is resolution-dependent.
|
||||
// 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;
|
||||
|
||||
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);
|
||||
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
|
||||
g_device->setEventReceiver(EventHandler::get());
|
||||
|
@ -49,7 +49,7 @@ ModalDialog::ModalDialog(const float percentWidth, const float percentHeight)
|
||||
if (modalWindow != NULL) delete modalWindow;
|
||||
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_size = 0.0f;
|
||||
@ -79,7 +79,7 @@ void ModalDialog::clearWindow()
|
||||
m_children.clearAndDeleteAll();
|
||||
|
||||
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();
|
||||
|
@ -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);
|
||||
|
||||
//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.Y = center.Y + (int)(((int)rect.LowerRightCorner.Y - (int)center.Y)*texture_size);
|
||||
|
||||
/*
|
||||
std::cout << texture_size << " : " << rect.UpperLeftCorner.X << ", " << rect.UpperLeftCorner.Y << " : " <<
|
||||
rect.LowerRightCorner.X << ", " << rect.LowerRightCorner.Y << " ---> " <<
|
||||
sized_rect.UpperLeftCorner.X << ", " << sized_rect.UpperLeftCorner.Y << " : " <<
|
||||
sized_rect.LowerRightCorner.X << ", " << sized_rect.LowerRightCorner.Y << std::endl;
|
||||
rect.LowerRightCorner.X << ", " << rect.LowerRightCorner.Y << " ---> " <<
|
||||
sized_rect.UpperLeftCorner.X << ", " << sized_rect.UpperLeftCorner.Y << " : " <<
|
||||
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
|
||||
{
|
||||
GUIEngine::getDriver()->draw2DRectangle( color, rect );
|
||||
GUIEngine::getDriver()->draw2DRectangle( color, rect );
|
||||
}
|
||||
}
|
||||
return;
|
||||
@ -1294,7 +1294,7 @@ core::rect< s32 > Skin::draw3DWindowBackground (IGUIElement *element, bool drawT
|
||||
}
|
||||
else
|
||||
{
|
||||
drawBoxFromStretchableTexture( ModalDialog::getCurrent(), rect, SkinConfig::m_render_params["window::neutral"]);
|
||||
drawBoxFromStretchableTexture( ModalDialog::getCurrent(), rect, SkinConfig::m_render_params["window::neutral"]);
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
/*
|
||||
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_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_LIGHT Light color for three-dimensional display elements (for edges facing the light source.).
|
||||
EGDC_ACTIVE_BORDER Active window border.
|
||||
EGDC_ACTIVE_CAPTION Active window title bar text.
|
||||
EGDC_APP_WORKSPACE Background color of multiple document interface (MDI) applications.
|
||||
EGDC_BUTTON_TEXT Text on a button.
|
||||
EGDC_GRAY_TEXT Grayed (disabled) text.
|
||||
EGDC_HIGH_LIGHT 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_CAPTION Inactive window caption.
|
||||
EGDC_TOOLTIP Tool tip text color.
|
||||
EGDC_TOOLTIP_BACKGROUND Tool tip background color.
|
||||
EGDC_SCROLLBAR Scrollbar gray area.
|
||||
EGDC_WINDOW Window background.
|
||||
EGDC_WINDOW_SYMBOL Window symbols like on close buttons, scroll bars and check boxes.
|
||||
EGDC_ICON Icons in a list or tree.
|
||||
EGDC_ICON_HIGH_LIGHT Selected icons in a list or tree.
|
||||
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_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_LIGHT Light color for three-dimensional display elements (for edges facing the light source.).
|
||||
EGDC_ACTIVE_BORDER Active window border.
|
||||
EGDC_ACTIVE_CAPTION Active window title bar text.
|
||||
EGDC_APP_WORKSPACE Background color of multiple document interface (MDI) applications.
|
||||
EGDC_BUTTON_TEXT Text on a button.
|
||||
EGDC_GRAY_TEXT Grayed (disabled) text.
|
||||
EGDC_HIGH_LIGHT 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_CAPTION Inactive window caption.
|
||||
EGDC_TOOLTIP Tool tip text color.
|
||||
EGDC_TOOLTIP_BACKGROUND Tool tip background color.
|
||||
EGDC_SCROLLBAR Scrollbar gray area.
|
||||
EGDC_WINDOW Window background.
|
||||
EGDC_WINDOW_SYMBOL Window symbols like on close buttons, scroll bars and check boxes.
|
||||
EGDC_ICON Icons in a list or tree.
|
||||
EGDC_ICON_HIGH_LIGHT Selected icons in a list or tree.
|
||||
*/
|
||||
|
||||
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";
|
||||
}
|
||||
@ -1395,7 +1395,7 @@ IGUISpriteBank* Skin::getSpriteBank () const
|
||||
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)
|
||||
{
|
||||
|
@ -246,29 +246,29 @@ namespace GUIEngine
|
||||
void drawBadgeOn(const Widget* widget, const irr::core::rect<irr::s32>& rect);
|
||||
|
||||
// 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 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 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 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 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 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 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::u32 getIcon (irr::gui::EGUI_DEFAULT_ICON icon) const ;
|
||||
virtual irr::s32 getSize (irr::gui::EGUI_DEFAULT_SIZE size) const ;
|
||||
virtual irr::gui::IGUISpriteBank * getSpriteBank () const ;
|
||||
//virtual EGUI_SKIN_TYPE getType () const;
|
||||
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 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 setSize (irr::gui::EGUI_DEFAULT_SIZE which, irr::s32 size);
|
||||
virtual void setSpriteBank (irr::gui::IGUISpriteBank *bank);
|
||||
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 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 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 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 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 irr::video::SColor getColor (irr::gui::EGUI_DEFAULT_COLOR color) 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::u32 getIcon (irr::gui::EGUI_DEFAULT_ICON icon) const ;
|
||||
virtual irr::s32 getSize (irr::gui::EGUI_DEFAULT_SIZE size) const ;
|
||||
virtual irr::gui::IGUISpriteBank * getSpriteBank () const ;
|
||||
//virtual EGUI_SKIN_TYPE getType () const;
|
||||
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 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 setSize (irr::gui::EGUI_DEFAULT_SIZE which, irr::s32 size);
|
||||
virtual void setSpriteBank (irr::gui::IGUISpriteBank *bank);
|
||||
|
||||
};
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ void LabelWidget::add()
|
||||
irrwidget->setOverrideFont( GUIEngine::getTitleFont() );
|
||||
}
|
||||
//irrwidget->setBackgroundColor( video::SColor(255,255,0,0) );
|
||||
//irrwidget->setDrawBackground(true);
|
||||
//irrwidget->setDrawBackground(true);
|
||||
|
||||
id = m_element->getID();
|
||||
//m_element->setTabOrder(id);
|
||||
|
@ -249,7 +249,7 @@ bool DeviceManager::translateInput( Input::InputType type,
|
||||
if (device != NULL && abs(value) > Input::MAX_VALUE/2)
|
||||
{
|
||||
//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;
|
||||
}
|
||||
|
@ -49,113 +49,113 @@ irr::core::stringw Input::getInputAsString(const Input::InputType type, const in
|
||||
case KEY_RBUTTON :
|
||||
s = "right mouse button";
|
||||
break;
|
||||
case KEY_CANCEL :
|
||||
case KEY_CANCEL :
|
||||
s = "cancel";
|
||||
break;
|
||||
case KEY_MBUTTON :
|
||||
case KEY_MBUTTON :
|
||||
s = "middle mouse button";
|
||||
break;
|
||||
case KEY_XBUTTON1 :
|
||||
case KEY_XBUTTON1 :
|
||||
s = "X1 mouse button";
|
||||
break;
|
||||
case KEY_XBUTTON2 :
|
||||
case KEY_XBUTTON2 :
|
||||
s = "X2 mouse button";
|
||||
break;
|
||||
case KEY_BACK :
|
||||
case KEY_BACK :
|
||||
s = "backspace";
|
||||
break;
|
||||
case KEY_TAB :
|
||||
case KEY_TAB :
|
||||
s = "tab";
|
||||
break;
|
||||
case KEY_CLEAR :
|
||||
case KEY_CLEAR :
|
||||
s = "clear";
|
||||
break;
|
||||
case KEY_RETURN :
|
||||
case KEY_RETURN :
|
||||
s = "return";
|
||||
break;
|
||||
case KEY_SHIFT :
|
||||
s = "shift";
|
||||
break;
|
||||
case KEY_CONTROL :
|
||||
case KEY_CONTROL :
|
||||
s = "control";
|
||||
break;
|
||||
case KEY_MENU :
|
||||
case KEY_MENU :
|
||||
s = "alt/menu";
|
||||
break;
|
||||
case KEY_PAUSE :
|
||||
s = "pause";
|
||||
break;
|
||||
case KEY_CAPITAL :
|
||||
case KEY_CAPITAL :
|
||||
s = "caps lock";
|
||||
break;
|
||||
case KEY_KANA :
|
||||
case KEY_KANA :
|
||||
s = "kana";
|
||||
break;
|
||||
//case KEY_HANGUEL :
|
||||
//case KEY_HANGUEL :
|
||||
//case KEY_HANGUL :
|
||||
// s = "hangul";
|
||||
break;
|
||||
case KEY_JUNJA :
|
||||
case KEY_JUNJA :
|
||||
s = "junja";
|
||||
break;
|
||||
case KEY_FINAL :
|
||||
case KEY_FINAL :
|
||||
s = "final";
|
||||
break;
|
||||
//case KEY_HANJA :
|
||||
//case KEY_HANJA :
|
||||
// s = "hanja";
|
||||
// break;
|
||||
//case KEY_KANJI :
|
||||
//case KEY_KANJI :
|
||||
// s = "kanji";
|
||||
// break;
|
||||
case KEY_ESCAPE :
|
||||
case KEY_ESCAPE :
|
||||
s = "escape";
|
||||
break;
|
||||
case KEY_CONVERT :
|
||||
case KEY_CONVERT :
|
||||
s = "convert";
|
||||
break;
|
||||
case KEY_NONCONVERT :
|
||||
case KEY_NONCONVERT :
|
||||
s = "nonconvert";
|
||||
break;
|
||||
case KEY_ACCEPT :
|
||||
case KEY_ACCEPT :
|
||||
s = "accept";
|
||||
break;
|
||||
case KEY_MODECHANGE :
|
||||
case KEY_MODECHANGE :
|
||||
s = "modechange";
|
||||
break;
|
||||
case KEY_SPACE :
|
||||
case KEY_SPACE :
|
||||
s = "space";
|
||||
break;
|
||||
case KEY_PRIOR :
|
||||
case KEY_PRIOR :
|
||||
s = "page up";
|
||||
break;
|
||||
case KEY_NEXT :
|
||||
case KEY_NEXT :
|
||||
s = "page down";
|
||||
break;
|
||||
case KEY_END :
|
||||
s = "end";
|
||||
break;
|
||||
case KEY_HOME :
|
||||
case KEY_HOME :
|
||||
s = "home";
|
||||
break;
|
||||
case KEY_LEFT :
|
||||
case KEY_LEFT :
|
||||
s = "left";
|
||||
break;
|
||||
case KEY_UP :
|
||||
case KEY_UP :
|
||||
s = "up";
|
||||
break;
|
||||
case KEY_RIGHT :
|
||||
s = "right";
|
||||
break;
|
||||
case KEY_DOWN :
|
||||
case KEY_DOWN :
|
||||
s = "down";
|
||||
break;
|
||||
case KEY_SELECT :
|
||||
case KEY_SELECT :
|
||||
s = "select";
|
||||
break;
|
||||
case KEY_PRINT :
|
||||
case KEY_PRINT :
|
||||
s = "print";
|
||||
break;
|
||||
case KEY_EXECUT :
|
||||
case KEY_EXECUT :
|
||||
s = "exec";
|
||||
break;
|
||||
case KEY_SNAPSHOT :
|
||||
@ -164,142 +164,142 @@ irr::core::stringw Input::getInputAsString(const Input::InputType type, const in
|
||||
case KEY_INSERT :
|
||||
s = "insert";
|
||||
break;
|
||||
case KEY_DELETE :
|
||||
case KEY_DELETE :
|
||||
s = "delete";
|
||||
break;
|
||||
case KEY_HELP :
|
||||
case KEY_HELP :
|
||||
s = "help";
|
||||
break;
|
||||
case KEY_KEY_0 :
|
||||
case KEY_KEY_0 :
|
||||
s = "0";
|
||||
break;
|
||||
case KEY_KEY_1 :
|
||||
case KEY_KEY_1 :
|
||||
s = "1";
|
||||
break;
|
||||
case KEY_KEY_2 :
|
||||
s = "2";
|
||||
break;
|
||||
case KEY_KEY_3 :
|
||||
case KEY_KEY_3 :
|
||||
s = "3";
|
||||
break;
|
||||
case KEY_KEY_4 :
|
||||
s = "4";
|
||||
break;
|
||||
case KEY_KEY_5 :
|
||||
case KEY_KEY_5 :
|
||||
s = "5";
|
||||
break;
|
||||
case KEY_KEY_6 :
|
||||
case KEY_KEY_6 :
|
||||
s = "6";
|
||||
break;
|
||||
case KEY_KEY_7 :
|
||||
case KEY_KEY_7 :
|
||||
s = "7";
|
||||
break;
|
||||
case KEY_KEY_8 :
|
||||
case KEY_KEY_8 :
|
||||
s = "8";
|
||||
break;
|
||||
case KEY_KEY_9 :
|
||||
case KEY_KEY_9 :
|
||||
s = "9";
|
||||
break;
|
||||
case KEY_KEY_A :
|
||||
case KEY_KEY_A :
|
||||
s = "A";
|
||||
break;
|
||||
case KEY_KEY_B :
|
||||
case KEY_KEY_B :
|
||||
s = "B";
|
||||
break;
|
||||
case KEY_KEY_C :
|
||||
case KEY_KEY_C :
|
||||
s = "C";
|
||||
break;
|
||||
case KEY_KEY_D :
|
||||
case KEY_KEY_D :
|
||||
s = "D";
|
||||
break;
|
||||
case KEY_KEY_E :
|
||||
case KEY_KEY_E :
|
||||
s = "E";
|
||||
break;
|
||||
case KEY_KEY_F :
|
||||
case KEY_KEY_F :
|
||||
s = "F";
|
||||
break;
|
||||
case KEY_KEY_G :
|
||||
case KEY_KEY_G :
|
||||
s = "G";
|
||||
break;
|
||||
case KEY_KEY_H :
|
||||
s = "H";
|
||||
break;
|
||||
case KEY_KEY_I :
|
||||
case KEY_KEY_I :
|
||||
s = "I";
|
||||
break;
|
||||
case KEY_KEY_J :
|
||||
case KEY_KEY_J :
|
||||
s = "J";
|
||||
break;
|
||||
case KEY_KEY_K :
|
||||
case KEY_KEY_K :
|
||||
s = "K";
|
||||
break;
|
||||
case KEY_KEY_L :
|
||||
case KEY_KEY_L :
|
||||
s = "L";
|
||||
break;
|
||||
case KEY_KEY_M :
|
||||
case KEY_KEY_M :
|
||||
s = "M";
|
||||
break;
|
||||
case KEY_KEY_N :
|
||||
case KEY_KEY_N :
|
||||
s = "N";
|
||||
break;
|
||||
case KEY_KEY_O :
|
||||
case KEY_KEY_O :
|
||||
s = "O";
|
||||
break;
|
||||
case KEY_KEY_P :
|
||||
case KEY_KEY_P :
|
||||
s = "P";
|
||||
break;
|
||||
case KEY_KEY_Q :
|
||||
case KEY_KEY_Q :
|
||||
s = "Q";
|
||||
break;
|
||||
case KEY_KEY_R :
|
||||
case KEY_KEY_R :
|
||||
s = "R";
|
||||
break;
|
||||
case KEY_KEY_S :
|
||||
case KEY_KEY_S :
|
||||
s = "S";
|
||||
break;
|
||||
case KEY_KEY_T :
|
||||
case KEY_KEY_T :
|
||||
s = "T";
|
||||
break;
|
||||
case KEY_KEY_U :
|
||||
case KEY_KEY_U :
|
||||
s = "U";
|
||||
break;
|
||||
case KEY_KEY_V :
|
||||
case KEY_KEY_V :
|
||||
s = "V";
|
||||
break;
|
||||
case KEY_KEY_W :
|
||||
case KEY_KEY_W :
|
||||
s = "W";
|
||||
break;
|
||||
case KEY_KEY_X :
|
||||
s = "X";
|
||||
break;
|
||||
case KEY_KEY_Y :
|
||||
case KEY_KEY_Y :
|
||||
s = "Y";
|
||||
break;
|
||||
case KEY_KEY_Z :
|
||||
case KEY_KEY_Z :
|
||||
s = "Z";
|
||||
break;
|
||||
case KEY_LWIN :
|
||||
case KEY_LWIN :
|
||||
s = "Left Logo";
|
||||
break;
|
||||
case KEY_RWIN :
|
||||
case KEY_RWIN :
|
||||
s = "Right Logo";
|
||||
break;
|
||||
case KEY_APPS :
|
||||
case KEY_APPS :
|
||||
s = "apps";
|
||||
break;
|
||||
case KEY_SLEEP :
|
||||
case KEY_SLEEP :
|
||||
s = "sleep";
|
||||
break;
|
||||
case KEY_NUMPAD0 :
|
||||
case KEY_NUMPAD0 :
|
||||
s = "numpad 0";
|
||||
break;
|
||||
case KEY_NUMPAD1 :
|
||||
case KEY_NUMPAD1 :
|
||||
s = "numpad 1";
|
||||
break;
|
||||
case KEY_NUMPAD2 :
|
||||
case KEY_NUMPAD2 :
|
||||
s = "numpad 2";
|
||||
break;
|
||||
case KEY_NUMPAD3 :
|
||||
case KEY_NUMPAD3 :
|
||||
s = "numpad 3";
|
||||
break;
|
||||
case KEY_NUMPAD4 :
|
||||
@ -308,133 +308,133 @@ irr::core::stringw Input::getInputAsString(const Input::InputType type, const in
|
||||
case KEY_NUMPAD5 :
|
||||
s = "numpad 5";
|
||||
break;
|
||||
case KEY_NUMPAD6 :
|
||||
case KEY_NUMPAD6 :
|
||||
s = "numpad 6";
|
||||
break;
|
||||
case KEY_NUMPAD7 :
|
||||
case KEY_NUMPAD7 :
|
||||
s = "numpad 7";
|
||||
break;
|
||||
case KEY_NUMPAD8 :
|
||||
case KEY_NUMPAD8 :
|
||||
s = "numpad 8";
|
||||
break;
|
||||
case KEY_NUMPAD9 :
|
||||
case KEY_NUMPAD9 :
|
||||
s = "numpad 9";
|
||||
break;
|
||||
case KEY_MULTIPLY :
|
||||
case KEY_MULTIPLY :
|
||||
s = "*";
|
||||
break;
|
||||
case KEY_ADD :
|
||||
case KEY_ADD :
|
||||
s = "+";
|
||||
break;
|
||||
case KEY_SEPARATOR :
|
||||
case KEY_SEPARATOR :
|
||||
s = "separator";
|
||||
break;
|
||||
case KEY_SUBTRACT :
|
||||
case KEY_SUBTRACT :
|
||||
s = "- (subtract)";
|
||||
break;
|
||||
case KEY_DECIMAL :
|
||||
case KEY_DECIMAL :
|
||||
s = "decimal";
|
||||
break;
|
||||
case KEY_DIVIDE :
|
||||
case KEY_DIVIDE :
|
||||
s = "/ (divide)";
|
||||
break;
|
||||
case KEY_F1 :
|
||||
case KEY_F1 :
|
||||
s = "F1";
|
||||
break;
|
||||
case KEY_F2 :
|
||||
case KEY_F2 :
|
||||
s = "F2";
|
||||
break;
|
||||
case KEY_F3 :
|
||||
case KEY_F3 :
|
||||
s = "F3";
|
||||
break;
|
||||
case KEY_F4 :
|
||||
case KEY_F4 :
|
||||
s = "F4";
|
||||
break;
|
||||
case KEY_F5 :
|
||||
case KEY_F5 :
|
||||
s = "F5";
|
||||
break;
|
||||
case KEY_F6 :
|
||||
case KEY_F6 :
|
||||
s = "F6";
|
||||
break;
|
||||
case KEY_F7 :
|
||||
case KEY_F7 :
|
||||
s = "F7";
|
||||
break;
|
||||
case KEY_F8 :
|
||||
case KEY_F8 :
|
||||
s = "F8";
|
||||
break;
|
||||
case KEY_F9 :
|
||||
s = "F9";
|
||||
break;
|
||||
case KEY_F10 :
|
||||
case KEY_F10 :
|
||||
s = "F10";
|
||||
break;
|
||||
case KEY_F11 :
|
||||
case KEY_F11 :
|
||||
s = "F11";
|
||||
break;
|
||||
case KEY_F12 :
|
||||
case KEY_F12 :
|
||||
s = "F12";
|
||||
break;
|
||||
case KEY_F13 :
|
||||
case KEY_F13 :
|
||||
s = "F13";
|
||||
break;
|
||||
case KEY_F14 :
|
||||
case KEY_F14 :
|
||||
s = "F14";
|
||||
break;
|
||||
case KEY_F15 :
|
||||
case KEY_F15 :
|
||||
s = "F15";
|
||||
break;
|
||||
case KEY_F16 :
|
||||
case KEY_F16 :
|
||||
s = "F16";
|
||||
break;
|
||||
case KEY_F17 :
|
||||
case KEY_F17 :
|
||||
s = "F17";
|
||||
break;
|
||||
case KEY_F18 :
|
||||
case KEY_F18 :
|
||||
s = "F18";
|
||||
break;
|
||||
case KEY_F19 :
|
||||
case KEY_F19 :
|
||||
s = "F19";
|
||||
break;
|
||||
case KEY_F20 :
|
||||
case KEY_F20 :
|
||||
s = "F20";
|
||||
break;
|
||||
case KEY_F21 :
|
||||
case KEY_F21 :
|
||||
s = "F21";
|
||||
break;
|
||||
case KEY_F22 :
|
||||
s = "F22";
|
||||
break;
|
||||
case KEY_F23 :
|
||||
case KEY_F23 :
|
||||
s = "F23";
|
||||
break;
|
||||
case KEY_F24 :
|
||||
case KEY_F24 :
|
||||
s = "F24";
|
||||
break;
|
||||
case KEY_NUMLOCK :
|
||||
case KEY_NUMLOCK :
|
||||
s = "num lock";
|
||||
break;
|
||||
case KEY_SCROLL :
|
||||
case KEY_SCROLL :
|
||||
s = "scroll lock";
|
||||
break;
|
||||
case KEY_LSHIFT :
|
||||
s = "left shift";
|
||||
break;
|
||||
case KEY_RSHIFT :
|
||||
case KEY_RSHIFT :
|
||||
s = "right shift";
|
||||
break;
|
||||
case KEY_LCONTROL :
|
||||
case KEY_LCONTROL :
|
||||
s = "left control";
|
||||
break;
|
||||
case KEY_RCONTROL :
|
||||
case KEY_RCONTROL :
|
||||
s = "right control";
|
||||
break;
|
||||
case KEY_LMENU :
|
||||
case KEY_LMENU :
|
||||
s = "left menu";
|
||||
break;
|
||||
case KEY_RMENU :
|
||||
case KEY_RMENU :
|
||||
s = "right menu";
|
||||
break;
|
||||
case KEY_PLUS :
|
||||
case KEY_PLUS :
|
||||
s = "+";
|
||||
break;
|
||||
case KEY_COMMA :
|
||||
@ -446,7 +446,7 @@ irr::core::stringw Input::getInputAsString(const Input::InputType type, const in
|
||||
case KEY_PERIOD :
|
||||
s = ".";
|
||||
break;
|
||||
case KEY_ATTN :
|
||||
case KEY_ATTN :
|
||||
s = "attn";
|
||||
break;
|
||||
case KEY_CRSEL :
|
||||
@ -455,16 +455,16 @@ irr::core::stringw Input::getInputAsString(const Input::InputType type, const in
|
||||
case KEY_EXSEL :
|
||||
s = "exsel";
|
||||
break;
|
||||
case KEY_EREOF :
|
||||
case KEY_EREOF :
|
||||
s = "ereof";
|
||||
break;
|
||||
case KEY_PLAY :
|
||||
case KEY_PLAY :
|
||||
s = "play";
|
||||
break;
|
||||
case KEY_ZOOM :
|
||||
s = "zoom";
|
||||
break;
|
||||
case KEY_PA1 :
|
||||
case KEY_PA1 :
|
||||
s = "pa1";
|
||||
break;
|
||||
case KEY_OEM_CLEAR:
|
||||
|
@ -54,40 +54,40 @@ struct Input
|
||||
int btnID; // or axis ID for gamepads axes
|
||||
int axisDirection;
|
||||
|
||||
Input()
|
||||
: type(IT_NONE), deviceID(0), btnID(0), axisDirection(0)
|
||||
{
|
||||
// Nothing to do.
|
||||
}
|
||||
|
||||
/** Creates an Input instance which represents an arbitrary way of getting
|
||||
* game input using a type specifier and 3 integers.
|
||||
*
|
||||
* Meaning of the 3 integers for each InputType:
|
||||
* IT_NONE: This means nothing. In certain cases this is regarded as an
|
||||
* unset binding.
|
||||
* IT_KEYBOARD: id0 is a irrLicht value.
|
||||
* 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
|
||||
Input()
|
||||
: type(IT_NONE), deviceID(0), btnID(0), axisDirection(0)
|
||||
{
|
||||
// Nothing to do.
|
||||
}
|
||||
|
||||
/** Creates an Input instance which represents an arbitrary way of getting
|
||||
* game input using a type specifier and 3 integers.
|
||||
*
|
||||
* Meaning of the 3 integers for each InputType:
|
||||
* IT_NONE: This means nothing. In certain cases this is regarded as an
|
||||
* unset binding.
|
||||
* IT_KEYBOARD: id0 is a irrLicht value.
|
||||
* 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 direction is to the left and that axis 1 is the Y-Axis with the
|
||||
* negative direction being upwards.
|
||||
* IT_STICKBUTTON: id0 - stick index, id1 - button index. Button 0 and 1 are
|
||||
* usually reached most easily.
|
||||
* IT_STICKHAT: This is not yet implemented.
|
||||
* IT_MOUSEMOTION: id0 - axis index (0 -> X, 1 -> Y). Mouse wheel is
|
||||
* represented as buttons!
|
||||
* IT_MOUSEBUTTON: id0 - button number (1 -> left, 2 -> middle, 3 -> right,
|
||||
* ...)
|
||||
*
|
||||
* 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
|
||||
* to the system.
|
||||
*/
|
||||
Input(InputType ntype, int deviceID , int btnID = 0, int axisDirection= 0)
|
||||
: type(ntype), deviceID(deviceID), btnID(btnID), axisDirection(axisDirection)
|
||||
{
|
||||
// Nothing to do.
|
||||
}
|
||||
* negative direction being upwards.
|
||||
* IT_STICKBUTTON: id0 - stick index, id1 - button index. Button 0 and 1 are
|
||||
* usually reached most easily.
|
||||
* IT_STICKHAT: This is not yet implemented.
|
||||
* IT_MOUSEMOTION: id0 - axis index (0 -> X, 1 -> Y). Mouse wheel is
|
||||
* represented as buttons!
|
||||
* IT_MOUSEBUTTON: id0 - button number (1 -> left, 2 -> middle, 3 -> right,
|
||||
* ...)
|
||||
*
|
||||
* 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
|
||||
* to the system.
|
||||
*/
|
||||
Input(InputType ntype, int deviceID , int btnID = 0, int axisDirection= 0)
|
||||
: type(ntype), deviceID(deviceID), btnID(btnID), axisDirection(axisDirection)
|
||||
{
|
||||
// Nothing to do.
|
||||
}
|
||||
|
||||
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_LEFT = 0,
|
||||
PA_RIGHT,
|
||||
PA_ACCEL,
|
||||
PA_BRAKE,
|
||||
PA_NITRO,
|
||||
PA_DRIFT,
|
||||
PA_RESCUE,
|
||||
PA_FIRE,
|
||||
PA_LOOK_BACK,
|
||||
PA_LEFT = 0,
|
||||
PA_RIGHT,
|
||||
PA_ACCEL,
|
||||
PA_BRAKE,
|
||||
PA_NITRO,
|
||||
PA_DRIFT,
|
||||
PA_RESCUE,
|
||||
PA_FIRE,
|
||||
PA_LOOK_BACK,
|
||||
|
||||
PA_COUNT
|
||||
};
|
||||
@ -122,41 +122,41 @@ static std::string KartActionStrings[PA_COUNT] = {std::string("left"),
|
||||
|
||||
enum StaticAction
|
||||
{
|
||||
// Below this are synthetic game actions which are never triggered through
|
||||
// an input device.
|
||||
GA_NULL, // Nothing dummy entry.
|
||||
GA_SENSE_CANCEL, // Input sensing canceled.
|
||||
GA_SENSE_COMPLETE, // Input sensing successfully finished.
|
||||
|
||||
// Below this point are the game actions which can happen while in menu
|
||||
// mode.
|
||||
|
||||
GA_ENTER, // Enter menu, acknowledge, ...
|
||||
GA_LEAVE, // Leave a menu.
|
||||
|
||||
GA_CLEAR_MAPPING, // Clear an input mapping.
|
||||
|
||||
GA_INC_SCROLL_SPEED,
|
||||
GA_INC_SCROLL_SPEED_FAST,
|
||||
GA_DEC_SCROLL_SPEED,
|
||||
GA_DEC_SCROLL_SPEED_FAST,
|
||||
|
||||
GA_CURSOR_UP,
|
||||
GA_CURSOR_DOWN,
|
||||
GA_CURSOR_LEFT,
|
||||
GA_CURSOR_RIGHT,
|
||||
|
||||
// Below this are synthetic game actions which are never triggered through
|
||||
// an input device.
|
||||
GA_NULL, // Nothing dummy entry.
|
||||
GA_SENSE_CANCEL, // Input sensing canceled.
|
||||
GA_SENSE_COMPLETE, // Input sensing successfully finished.
|
||||
|
||||
// Below this point are the game actions which can happen while in menu
|
||||
// mode.
|
||||
|
||||
GA_ENTER, // Enter menu, acknowledge, ...
|
||||
GA_LEAVE, // Leave a menu.
|
||||
|
||||
GA_CLEAR_MAPPING, // Clear an input mapping.
|
||||
|
||||
GA_INC_SCROLL_SPEED,
|
||||
GA_INC_SCROLL_SPEED_FAST,
|
||||
GA_DEC_SCROLL_SPEED,
|
||||
GA_DEC_SCROLL_SPEED_FAST,
|
||||
|
||||
GA_CURSOR_UP,
|
||||
GA_CURSOR_DOWN,
|
||||
GA_CURSOR_LEFT,
|
||||
GA_CURSOR_RIGHT,
|
||||
|
||||
|
||||
GA_TOGGLE_FULLSCREEN, // Switch between windowed/fullscreen mode
|
||||
GA_LEAVE_RACE, // Switch from race to menu.
|
||||
|
||||
GA_DEBUG_ADD_MISSILE,
|
||||
GA_DEBUG_ADD_BOWLING,
|
||||
GA_DEBUG_ADD_HOMING,
|
||||
GA_DEBUG_TOGGLE_FPS,
|
||||
GA_DEBUG_TOGGLE_WIREFRAME,
|
||||
GA_DEBUG_HISTORY
|
||||
|
||||
GA_TOGGLE_FULLSCREEN, // Switch between windowed/fullscreen mode
|
||||
GA_LEAVE_RACE, // Switch from race to menu.
|
||||
|
||||
GA_DEBUG_ADD_MISSILE,
|
||||
GA_DEBUG_ADD_BOWLING,
|
||||
GA_DEBUG_ADD_HOMING,
|
||||
GA_DEBUG_TOGGLE_FPS,
|
||||
GA_DEBUG_TOGGLE_WIREFRAME,
|
||||
GA_DEBUG_HISTORY
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -402,7 +402,7 @@ void InputManager::setMasterPlayerOnly(bool enabled)
|
||||
/** Returns whether only the master player should be allowed to perform changes in menus */
|
||||
bool InputManager::masterPlayerOnly() const
|
||||
{
|
||||
return m_device_manager->getAssignMode() == ASSIGN && m_master_player_only;
|
||||
return m_device_manager->getAssignMode() == ASSIGN && m_master_player_only;
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
/**
|
||||
|
@ -53,7 +53,7 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
Input *m_sensed_input;
|
||||
Input *m_sensed_input;
|
||||
DeviceManager *m_device_manager;
|
||||
|
||||
/** Stores the maximum sensed input values. This allows to select the
|
||||
@ -61,39 +61,39 @@ private:
|
||||
int m_max_sensed_input;
|
||||
Input::InputType m_max_sensed_type;
|
||||
|
||||
InputDriverMode m_mode;
|
||||
|
||||
InputDriverMode m_mode;
|
||||
|
||||
/** When at true, only the master player can play with menus */
|
||||
bool m_master_player_only;
|
||||
|
||||
/* 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
|
||||
* makes the mouse behave like an analog axis on a gamepad/joystick.
|
||||
*/
|
||||
int m_mouse_val_x, m_mouse_val_y;
|
||||
/* 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
|
||||
* makes the mouse behave like an analog axis on a gamepad/joystick.
|
||||
*/
|
||||
int m_mouse_val_x, m_mouse_val_y;
|
||||
|
||||
void dispatchInput(Input::InputType, int, int, int, int);
|
||||
void handleStaticAction(int id0, int value);
|
||||
void handlePlayerAction(PlayerAction pa, const int playerNo, int value);
|
||||
void inputSensing(Input::InputType type, int deviceID, int btnID, int axisDirection, int value);
|
||||
public:
|
||||
InputManager();
|
||||
InputManager();
|
||||
~InputManager();
|
||||
// void initGamePadDevices();
|
||||
// void initGamePadDevices();
|
||||
|
||||
//void input();
|
||||
//void input();
|
||||
GUIEngine::EventPropagation input(const irr::SEvent& event);
|
||||
|
||||
DeviceManager* getDeviceList() { return m_device_manager; }
|
||||
|
||||
void setMode(InputDriverMode);
|
||||
bool isInMode(InputDriverMode);
|
||||
void setMode(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) */
|
||||
void setMasterPlayerOnly(bool enabled);
|
||||
|
||||
/** Returns whether only the master player should be allowed to perform changes in menus */
|
||||
bool masterPlayerOnly() const;
|
||||
bool masterPlayerOnly() const;
|
||||
|
||||
void update(float dt);
|
||||
|
||||
|
@ -53,7 +53,7 @@ public:
|
||||
int get(const std::string &attribute, float *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, 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, video::SColorf *value) const;
|
||||
int get(const std::string &attribute, video::SColor *value) const;
|
||||
|
@ -62,10 +62,10 @@ Bowling::Bowling(Kart *kart) : Flyable(kart, POWERUP_BOWLING, 50.0f /* mass */)
|
||||
int flag = getBody()->getCollisionFlags();
|
||||
flag = flag & (~ btCollisionObject::CF_NO_CONTACT_RESPONSE);
|
||||
getBody()->setCollisionFlags(flag);
|
||||
|
||||
// should not live forever, auto-destruct after 20 seconds
|
||||
m_max_lifespan = 20;
|
||||
|
||||
|
||||
// should not live forever, auto-destruct after 20 seconds
|
||||
m_max_lifespan = 20;
|
||||
|
||||
} // Bowling
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -37,8 +37,8 @@ public:
|
||||
static void init(const lisp::Lisp* lisp, scene::IMesh *bowling);
|
||||
virtual void update(float dt);
|
||||
|
||||
int getExplosionSound() const { return SFXManager::SOUND_BOWLING_STRIKE; }
|
||||
|
||||
int getExplosionSound() const { return SFXManager::SOUND_BOWLING_STRIKE; }
|
||||
|
||||
}; // Bowling
|
||||
|
||||
#endif
|
||||
|
@ -48,12 +48,12 @@ Cake::Cake (Kart *kart) : Flyable(kart, POWERUP_CAKE)
|
||||
// give a speed proportional to kart speed
|
||||
m_speed = kart->getSpeed() * m_speed / 23.0f;
|
||||
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;
|
||||
|
||||
if (m_speed < 1.0f)
|
||||
m_speed = 1.0f;
|
||||
m_speed = 1.0f;
|
||||
|
||||
btTransform trans = kart->getTrans();
|
||||
|
||||
|
@ -60,9 +60,9 @@ Flyable::Flyable(Kart *kart, PowerupType type, float mass) : Moveable()
|
||||
m_mass = mass;
|
||||
m_adjust_z_velocity = true;
|
||||
|
||||
m_time_since_thrown = 0;
|
||||
m_owner_has_temporary_immunity = true;
|
||||
m_max_lifespan = -1;
|
||||
m_time_since_thrown = 0;
|
||||
m_owner_has_temporary_immunity = true;
|
||||
m_max_lifespan = -1;
|
||||
|
||||
// Add the graphical model
|
||||
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)
|
||||
{
|
||||
m_time_since_thrown += dt;
|
||||
if(m_max_lifespan > -1 && m_time_since_thrown > m_max_lifespan) hit(NULL);
|
||||
m_time_since_thrown += dt;
|
||||
if(m_max_lifespan > -1 && m_time_since_thrown > m_max_lifespan) hit(NULL);
|
||||
|
||||
if(m_exploded) return;
|
||||
|
||||
@ -301,7 +301,7 @@ void Flyable::updateFromServer(const FlyableInfo &f, float dt)
|
||||
*/
|
||||
bool Flyable::isOwnerImmunity(const Kart* kart_hit) const
|
||||
{
|
||||
return m_owner_has_temporary_immunity &&
|
||||
return m_owner_has_temporary_immunity &&
|
||||
kart_hit == m_owner &&
|
||||
m_time_since_thrown < 2.0f;
|
||||
} // isOwnerImmunity
|
||||
@ -309,15 +309,15 @@ bool Flyable::isOwnerImmunity(const Kart* kart_hit) const
|
||||
// -----------------------------------------------------------------------------
|
||||
void Flyable::hit(Kart *kart_hit, PhysicalObject* object)
|
||||
{
|
||||
// the owner of this flyable should not be hit by his own flyable
|
||||
if(m_exploded || isOwnerImmunity(kart_hit)) return;
|
||||
// the owner of this flyable should not be hit by his own flyable
|
||||
if(m_exploded || isOwnerImmunity(kart_hit)) return;
|
||||
|
||||
m_has_hit_something=true;
|
||||
// Notify the projectile manager that this rocket has hit something.
|
||||
// The manager will create the appropriate explosion object.
|
||||
projectile_manager->notifyRemove();
|
||||
|
||||
m_exploded=true;
|
||||
m_exploded=true;
|
||||
|
||||
if(!needsExplosion()) return;
|
||||
|
||||
|
@ -70,16 +70,16 @@ protected:
|
||||
static float m_st_force_updown[POWERUP_MAX]; // force pushing up/down
|
||||
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,
|
||||
and also to put some time limit to some collectibles */
|
||||
float m_time_since_thrown;
|
||||
/** time since thrown. used so a kart can't hit himself when trying something,
|
||||
and also to put some time limit to some collectibles */
|
||||
float m_time_since_thrown;
|
||||
|
||||
/** set to something > -1 if this flyable should auto-destrcut after a while */
|
||||
float m_max_lifespan;
|
||||
/** set to something > -1 if this flyable should auto-destrcut after a while */
|
||||
float m_max_lifespan;
|
||||
|
||||
/** if set to true, the kart that throwns this flyable can't collide with it
|
||||
for a short time */
|
||||
bool m_owner_has_temporary_immunity;
|
||||
/** if set to true, the kart that throwns this flyable can't collide with it
|
||||
for a short time */
|
||||
bool m_owner_has_temporary_immunity;
|
||||
|
||||
/** Returns information on what is the closest kart and at what
|
||||
distance it is. All 3 parameters first are of type 'out'.
|
||||
@ -126,8 +126,8 @@ public:
|
||||
* be removed. */
|
||||
void setHasHit () { m_has_hit_something = true; }
|
||||
void reset () { Moveable::reset(); }
|
||||
bool isOwnerImmunity(const Kart *kart_hit) const;
|
||||
virtual int getExplosionSound() const { return SFXManager::SOUND_EXPLOSION; }
|
||||
bool isOwnerImmunity(const Kart *kart_hit) const;
|
||||
virtual int getExplosionSound() const { return SFXManager::SOUND_EXPLOSION; }
|
||||
/** Indicates if an explosion needs to be added if this flyable
|
||||
* is removed. */
|
||||
virtual bool needsExplosion() const {return true;}
|
||||
|
@ -81,7 +81,7 @@ void Item::update(float delta)
|
||||
Vec3 hell(m_coord.getXYZ());
|
||||
|
||||
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());
|
||||
}
|
||||
else
|
||||
|
@ -67,7 +67,7 @@ public:
|
||||
virtual ~Item ();
|
||||
void update (float delta);
|
||||
virtual void collected(float t=2.0f);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns true if the Kart is close enough to hit this item, and
|
||||
* the item is not deactivated anymore.
|
||||
|
@ -36,7 +36,7 @@
|
||||
Powerup::Powerup(Kart* kart_)
|
||||
{
|
||||
m_owner = kart_;
|
||||
m_sound_use = NULL;
|
||||
m_sound_use = NULL;
|
||||
reset();
|
||||
} // Powerup
|
||||
|
||||
@ -56,7 +56,7 @@ void Powerup::reset()
|
||||
|
||||
int type, number;
|
||||
RaceManager::getWorld()->getDefaultCollectibles( type, number );
|
||||
set( (PowerupType)type, number );
|
||||
set( (PowerupType)type, number );
|
||||
} // reset
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -69,42 +69,42 @@ void Powerup::set(PowerupType type, int n)
|
||||
}
|
||||
m_type=type;
|
||||
m_number=n;
|
||||
|
||||
if(m_sound_use != NULL)
|
||||
{
|
||||
sfx_manager->deleteSFX(m_sound_use);
|
||||
m_sound_use = NULL;
|
||||
}
|
||||
|
||||
switch (m_type)
|
||||
|
||||
if(m_sound_use != NULL)
|
||||
{
|
||||
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 ;
|
||||
sfx_manager->deleteSFX(m_sound_use);
|
||||
m_sound_use = NULL;
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -121,9 +121,9 @@ void Powerup::use()
|
||||
// Play custom kart sound when collectible is used
|
||||
if (m_type != POWERUP_NOTHING && m_type != POWERUP_ZIPPER) m_owner->playCustomSFX(SFXManager::CUSTOM_SHOOT);
|
||||
|
||||
// FIXME - for some collectibles, set() is never called
|
||||
if(m_sound_use == NULL) m_sound_use = sfx_manager->newSFX(SFXManager::SOUND_SHOT);
|
||||
|
||||
// FIXME - for some collectibles, set() is never called
|
||||
if(m_sound_use == NULL) m_sound_use = sfx_manager->newSFX(SFXManager::SOUND_SHOT);
|
||||
|
||||
m_number--;
|
||||
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)
|
||||
{
|
||||
m_random.get(100); // keep random numbers in sync
|
||||
set( (PowerupType)add_info, 1);
|
||||
set( (PowerupType)add_info, 1);
|
||||
return;
|
||||
}
|
||||
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->getPosition() == 1 && kart->hasFinishedRace())
|
||||
{
|
||||
set(POWERUP_PARACHUTE, 1);
|
||||
set(POWERUP_PARACHUTE, 1);
|
||||
if(network_manager->getMode()==NetworkManager::NW_SERVER)
|
||||
{
|
||||
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)
|
||||
{
|
||||
@ -289,7 +289,7 @@ void Powerup::hitBonusBox(int n, const Item &item, int add_info)
|
||||
{
|
||||
if(m_type==POWERUP_NOTHING)
|
||||
{
|
||||
set( (PowerupType)add_info, n );
|
||||
set( (PowerupType)add_info, n );
|
||||
}
|
||||
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)
|
||||
{
|
||||
set( newC, n );
|
||||
set( newC, n );
|
||||
}
|
||||
else if(newC==m_type)
|
||||
{
|
||||
|
@ -36,7 +36,7 @@ private:
|
||||
SFXBase *m_sound_use;
|
||||
PowerupType m_type;
|
||||
int m_number;
|
||||
|
||||
|
||||
protected:
|
||||
Kart* m_owner;
|
||||
|
||||
|
@ -126,7 +126,7 @@ private:
|
||||
* kart down onto the track if one axis
|
||||
* loses contact with the track. */
|
||||
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_z_rescue_offset; // z offset after rescue
|
||||
float m_upright_tolerance;
|
||||
|
@ -232,7 +232,7 @@ int KartPropertiesManager::getKartByGroup(const std::string& group, int n) const
|
||||
for(KartPropertiesVector::const_iterator i = m_karts_properties.begin();
|
||||
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(count==n) return (int)(i-m_karts_properties.begin());
|
||||
count=count+1;
|
||||
|
@ -38,10 +38,10 @@ private:
|
||||
std::vector<std::string> m_all_groups;
|
||||
/** Mapping of group names to list of kart indices in each group. */
|
||||
std::map<std::string, std::vector<int> > m_groups;
|
||||
/** Vector containing kart numbers that have been selected in multiplayer
|
||||
* games. This it used to ensure the same kart can not be selected more
|
||||
* than once. */
|
||||
std::vector<int> m_selected_karts;
|
||||
/** Vector containing kart numbers that have been selected in multiplayer
|
||||
* games. This it used to ensure the same kart can not be selected more
|
||||
* than once. */
|
||||
std::vector<int> m_selected_karts;
|
||||
/** Contains a flag for each kart indicating wether it is available on
|
||||
* all clients or not. */
|
||||
std::vector<bool> m_kart_available;
|
||||
@ -55,7 +55,7 @@ protected:
|
||||
public:
|
||||
KartPropertiesManager();
|
||||
~KartPropertiesManager();
|
||||
static void addKartSearchDir (const std::string &s);
|
||||
static void addKartSearchDir (const std::string &s);
|
||||
const KartProperties* getKartById (int i) const;
|
||||
const KartProperties* getKart (const std::string &ident) const;
|
||||
const int getKartId (const std::string &ident) const;
|
||||
|
@ -193,19 +193,19 @@ namespace lisp
|
||||
|
||||
case '_': // can be begin translation
|
||||
try
|
||||
{
|
||||
nextChar();
|
||||
if(*m_c == '(')
|
||||
{
|
||||
nextChar();
|
||||
return TOKEN_TRANSLATION;
|
||||
}
|
||||
m_token_string[m_token_length++] = '_';
|
||||
// Fall through to symbol handling
|
||||
}
|
||||
{
|
||||
nextChar();
|
||||
if(*m_c == '(')
|
||||
{
|
||||
nextChar();
|
||||
return TOKEN_TRANSLATION;
|
||||
}
|
||||
m_token_string[m_token_length++] = '_';
|
||||
// Fall through to symbol handling
|
||||
}
|
||||
catch(EOFException& )
|
||||
{
|
||||
}
|
||||
}
|
||||
default:
|
||||
if(isdigit(*m_c) || *m_c == '-')
|
||||
{
|
||||
|
@ -31,7 +31,7 @@ namespace lisp
|
||||
TOKEN_EOF,
|
||||
TOKEN_OPEN_PAREN,
|
||||
TOKEN_CLOSE_PAREN,
|
||||
TOKEN_TRANSLATION,
|
||||
TOKEN_TRANSLATION,
|
||||
TOKEN_SYMBOL,
|
||||
TOKEN_STRING,
|
||||
TOKEN_INTEGER,
|
||||
|
@ -97,7 +97,7 @@ namespace lisp
|
||||
}
|
||||
case Lexer::TOKEN_TRANSLATION:
|
||||
{
|
||||
result = new Lisp(Lisp::TYPE_STRING);
|
||||
result = new Lisp(Lisp::TYPE_STRING);
|
||||
m_token = m_lexer->getNextToken();
|
||||
Lisp* next=read();
|
||||
if(next->getType()!=Lisp::TYPE_STRING)
|
||||
|
@ -33,9 +33,9 @@ namespace lisp
|
||||
{
|
||||
m_owner = true;
|
||||
#ifdef WIN32
|
||||
// With mingw, the files are written dos style (crlf), but
|
||||
// these files can't be read with the lexer here. So we have
|
||||
// to force the file to be written as binary for windows.
|
||||
// With mingw, the files are written dos style (crlf), but
|
||||
// these files can't be read with the lexer here. So we have
|
||||
// to force the file to be written as binary for windows.
|
||||
m_out = new std::ofstream(filename.c_str(),::std::ios_base::binary);
|
||||
#else
|
||||
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)
|
||||
{
|
||||
indent();
|
||||
|
32
src/main.cpp
32
src/main.cpp
@ -163,13 +163,13 @@ int handleCmdLinePreliminary(int argc, char **argv)
|
||||
{
|
||||
// Check that current res is not blacklisted
|
||||
std::ostringstream o;
|
||||
o << UserConfigParams::m_width << "x" << UserConfigParams::m_height;
|
||||
std::string res = o.str();
|
||||
o << UserConfigParams::m_width << "x" << UserConfigParams::m_height;
|
||||
std::string res = o.str();
|
||||
if (std::find(UserConfigParams::m_blacklist_res.begin(),
|
||||
UserConfigParams::m_blacklist_res.end(),res) == UserConfigParams::m_blacklist_res.end())
|
||||
UserConfigParams::m_fullscreen = true;
|
||||
else
|
||||
fprintf ( stdout, "Resolution %s has been blacklisted, so it is not available!\n", res.c_str());
|
||||
UserConfigParams::m_fullscreen = true;
|
||||
else
|
||||
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"))
|
||||
{
|
||||
@ -189,19 +189,19 @@ int handleCmdLinePreliminary(int argc, char **argv)
|
||||
int width, height;
|
||||
if (sscanf(argv[i+1], "%dx%d", &width, &height) == 2)
|
||||
{
|
||||
std::ostringstream o;
|
||||
o << width << "x" << height;
|
||||
std::string res = o.str();
|
||||
std::ostringstream o;
|
||||
o << width << "x" << height;
|
||||
std::string res = o.str();
|
||||
if (!UserConfigParams::m_fullscreen || std::find(UserConfigParams::m_blacklist_res.begin(),
|
||||
UserConfigParams::m_blacklist_res.end(),res) == UserConfigParams::m_blacklist_res.end())
|
||||
{
|
||||
UserConfigParams::m_prev_width = UserConfigParams::m_width = width;
|
||||
UserConfigParams::m_prev_height = UserConfigParams::m_height = height;
|
||||
fprintf ( stdout, "You choose to be in %dx%d.\n", (int)UserConfigParams::m_width,
|
||||
UserConfigParams::m_prev_width = UserConfigParams::m_width = width;
|
||||
UserConfigParams::m_prev_height = UserConfigParams::m_height = height;
|
||||
fprintf ( stdout, "You choose to be in %dx%d.\n", (int)UserConfigParams::m_width,
|
||||
(int)UserConfigParams::m_height );
|
||||
}
|
||||
else
|
||||
fprintf ( stdout, "Resolution %s has been blacklisted, so it is not available!\n", res.c_str());
|
||||
}
|
||||
else
|
||||
fprintf ( stdout, "Resolution %s has been blacklisted, so it is not available!\n", res.c_str());
|
||||
i++;
|
||||
}
|
||||
else
|
||||
@ -301,8 +301,8 @@ int handleCmdLine(int argc, char **argv)
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stdout, "Kart '%s' not found, ignored.\n",
|
||||
argv[i+1]);
|
||||
fprintf(stdout, "Kart '%s' not found, ignored.\n",
|
||||
argv[i+1]);
|
||||
}
|
||||
}
|
||||
else if( (!strcmp(argv[i], "--mode") && i+1<argc ))
|
||||
|
@ -30,7 +30,7 @@ FollowTheLeaderRace::FollowTheLeaderRace() : LinearWorld()
|
||||
{
|
||||
m_leader_intervals = stk_config->m_leader_intervals;
|
||||
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()
|
||||
{
|
||||
LinearWorld::restartRace();
|
||||
m_leader_intervals.clear();
|
||||
m_leader_intervals.clear();
|
||||
m_leader_intervals = stk_config->m_leader_intervals;
|
||||
TimedRace::setClockMode(COUNTDOWN, m_leader_intervals[0]);
|
||||
TimedRace::setClockMode(COUNTDOWN, m_leader_intervals[0]);
|
||||
} // restartRace
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -167,11 +167,11 @@ void FollowTheLeaderRace::raceResultOrder( int* order )
|
||||
order[kart_id] = kart_id;
|
||||
scores[kart_id] = race_manager->getKartScore(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
|
||||
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))
|
||||
scores[kart_id] = 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) >
|
||||
m_kart_info[0].m_race_lap * RaceManager::getTrack()->getTrackLength() + getDistanceDownTrackForKart(0))
|
||||
scores[kart_id] = 0;
|
||||
}
|
||||
|
||||
//Bubblesort
|
||||
@ -192,7 +192,7 @@ void FollowTheLeaderRace::raceResultOrder( int* order )
|
||||
}
|
||||
}
|
||||
} while(!sorted);
|
||||
|
||||
|
||||
for(unsigned int i=1; i<NUM_KARTS; i++)
|
||||
RaceManager::getKart(order[i])->setPosition(i);
|
||||
|
||||
|
@ -299,7 +299,7 @@ void World::resetAllKarts()
|
||||
if(!material)
|
||||
{
|
||||
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);
|
||||
}
|
||||
all_finished=false;
|
||||
@ -503,7 +503,7 @@ void World::restartRace()
|
||||
|
||||
// Start music from beginning
|
||||
sound_manager->stopMusic();
|
||||
m_track->reset();
|
||||
m_track->reset();
|
||||
m_track->startMusic();
|
||||
|
||||
// Enable SFX again
|
||||
|
@ -49,8 +49,8 @@ NetworkManager::NetworkManager()
|
||||
|
||||
if (enet_initialize () != 0)
|
||||
{
|
||||
fprintf (stderr, "An error occurred while initializing ENet.\n");
|
||||
exit(-1);
|
||||
fprintf (stderr, "An error occurred while initializing ENet.\n");
|
||||
exit(-1);
|
||||
}
|
||||
} // NetworkManager
|
||||
|
||||
@ -212,7 +212,7 @@ void NetworkManager::handleDisconnection(ENetEvent *event)
|
||||
return;
|
||||
}
|
||||
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--;
|
||||
} // handleDisconnection
|
||||
|
||||
|
@ -51,89 +51,89 @@ btKart::~btKart()
|
||||
// ----------------------------------------------------------------------------
|
||||
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;
|
||||
|
||||
btVector3 rayvector = wheel.m_raycastInfo.m_wheelDirectionWS * (raylen);
|
||||
const btVector3& source = wheel.m_raycastInfo.m_hardPointWS;
|
||||
wheel.m_raycastInfo.m_contactPointWS = source + rayvector;
|
||||
const btVector3& target = wheel.m_raycastInfo.m_contactPointWS;
|
||||
btVector3 rayvector = wheel.m_raycastInfo.m_wheelDirectionWS * (raylen);
|
||||
const btVector3& source = wheel.m_raycastInfo.m_hardPointWS;
|
||||
wheel.m_raycastInfo.m_contactPointWS = source + rayvector;
|
||||
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)
|
||||
{
|
||||
param = rayResults.m_distFraction;
|
||||
depth = raylen * rayResults.m_distFraction;
|
||||
wheel.m_raycastInfo.m_contactNormalWS = rayResults.m_hitNormalInWorld;
|
||||
wheel.m_raycastInfo.m_isInContact = true;
|
||||
if (object)
|
||||
{
|
||||
param = rayResults.m_distFraction;
|
||||
depth = raylen * rayResults.m_distFraction;
|
||||
wheel.m_raycastInfo.m_contactNormalWS = rayResults.m_hitNormalInWorld;
|
||||
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 = object;
|
||||
wheel.m_raycastInfo.m_groundObject = &s_fixedObject;//todo for driving on dynamic/movable objects!;
|
||||
//wheel.m_raycastInfo.m_groundObject = object;
|
||||
|
||||
|
||||
btScalar hitDistance = param*raylen;
|
||||
wheel.m_raycastInfo.m_suspensionLength = hitDistance - wheel.m_wheelsRadius;
|
||||
//clamp on max suspension travel
|
||||
btScalar hitDistance = param*raylen;
|
||||
wheel.m_raycastInfo.m_suspensionLength = hitDistance - wheel.m_wheelsRadius;
|
||||
//clamp on max suspension travel
|
||||
|
||||
btScalar minSuspensionLength = 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)
|
||||
{
|
||||
wheel.m_raycastInfo.m_suspensionLength = minSuspensionLength;
|
||||
}
|
||||
if (wheel.m_raycastInfo.m_suspensionLength > maxSuspensionLength)
|
||||
{
|
||||
wheel.m_raycastInfo.m_suspensionLength = maxSuspensionLength;
|
||||
}
|
||||
btScalar minSuspensionLength = 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)
|
||||
{
|
||||
wheel.m_raycastInfo.m_suspensionLength = minSuspensionLength;
|
||||
}
|
||||
if (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 relpos = wheel.m_raycastInfo.m_contactPointWS-getRigidBody()->getCenterOfMassPosition();
|
||||
btVector3 chassis_velocity_at_contactPoint;
|
||||
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))
|
||||
{
|
||||
wheel.m_suspensionRelativeVelocity = btScalar(0.0);
|
||||
wheel.m_clippedInvContactDotSuspension = btScalar(1.0) / btScalar(0.1);
|
||||
}
|
||||
else
|
||||
{
|
||||
btScalar inv = btScalar(-1.) / denominator;
|
||||
wheel.m_suspensionRelativeVelocity = projVel * inv;
|
||||
wheel.m_clippedInvContactDotSuspension = inv;
|
||||
}
|
||||
if ( denominator >= btScalar(-0.1))
|
||||
{
|
||||
wheel.m_suspensionRelativeVelocity = btScalar(0.0);
|
||||
wheel.m_clippedInvContactDotSuspension = btScalar(1.0) / btScalar(0.1);
|
||||
}
|
||||
else
|
||||
{
|
||||
btScalar inv = btScalar(-1.) / denominator;
|
||||
wheel.m_suspensionRelativeVelocity = projVel * inv;
|
||||
wheel.m_clippedInvContactDotSuspension = inv;
|
||||
}
|
||||
|
||||
} else
|
||||
{
|
||||
//put wheel info as in rest position
|
||||
wheel.m_raycastInfo.m_suspensionLength = wheel.getSuspensionRestLength();
|
||||
wheel.m_suspensionRelativeVelocity = btScalar(0.0);
|
||||
wheel.m_raycastInfo.m_contactNormalWS = - wheel.m_raycastInfo.m_wheelDirectionWS;
|
||||
wheel.m_clippedInvContactDotSuspension = btScalar(1.0);
|
||||
} else
|
||||
{
|
||||
//put wheel info as in rest position
|
||||
wheel.m_raycastInfo.m_suspensionLength = wheel.getSuspensionRestLength();
|
||||
wheel.m_suspensionRelativeVelocity = btScalar(0.0);
|
||||
wheel.m_raycastInfo.m_contactNormalWS = - wheel.m_raycastInfo.m_wheelDirectionWS;
|
||||
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 )
|
||||
{
|
||||
{
|
||||
for (int i=0;i<getNumWheels();i++)
|
||||
{
|
||||
updateWheelTransform(i,false);
|
||||
}
|
||||
}
|
||||
{
|
||||
for (int i=0;i<getNumWheels();i++)
|
||||
{
|
||||
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 (
|
||||
chassisTrans.getBasis()[0][m_indexForwardAxis],
|
||||
chassisTrans.getBasis()[1][m_indexForwardAxis],
|
||||
chassisTrans.getBasis()[2][m_indexForwardAxis]);
|
||||
btVector3 forwardW (
|
||||
chassisTrans.getBasis()[0][m_indexForwardAxis],
|
||||
chassisTrans.getBasis()[1][m_indexForwardAxis],
|
||||
chassisTrans.getBasis()[2][m_indexForwardAxis]);
|
||||
|
||||
if (forwardW.dot(getRigidBody()->getLinearVelocity()) < btScalar(0.))
|
||||
{
|
||||
m_currentVehicleSpeedKmHour *= btScalar(-1.);
|
||||
}
|
||||
if (forwardW.dot(getRigidBody()->getLinearVelocity()) < btScalar(0.))
|
||||
{
|
||||
m_currentVehicleSpeedKmHour *= btScalar(-1.);
|
||||
}
|
||||
|
||||
//
|
||||
// simulate suspension
|
||||
//
|
||||
//
|
||||
// simulate suspension
|
||||
//
|
||||
|
||||
int i=0;
|
||||
m_num_wheels_on_ground = 0;
|
||||
|
||||
for (i=0;i<m_wheelInfo.size();i++)
|
||||
{
|
||||
btScalar depth;
|
||||
depth = rayCast( m_wheelInfo[i]);
|
||||
|
||||
if (m_wheelInfo[i].m_raycastInfo.m_isInContact)
|
||||
m_num_wheels_on_ground++;
|
||||
}
|
||||
int i=0;
|
||||
m_num_wheels_on_ground = 0;
|
||||
|
||||
for (i=0;i<m_wheelInfo.size();i++)
|
||||
{
|
||||
btScalar depth;
|
||||
depth = rayCast( m_wheelInfo[i]);
|
||||
|
||||
if (m_wheelInfo[i].m_raycastInfo.m_isInContact)
|
||||
m_num_wheels_on_ground++;
|
||||
}
|
||||
|
||||
// Work around: make sure that either both wheels on one axis
|
||||
// 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
|
||||
|
||||
updateSuspension(step);
|
||||
updateSuspension(step);
|
||||
|
||||
for (i=0;i<m_wheelInfo.size();i++)
|
||||
{
|
||||
//apply suspension force
|
||||
btWheelInfo& wheel = m_wheelInfo[i];
|
||||
for (i=0;i<m_wheelInfo.size();i++)
|
||||
{
|
||||
//apply suspension force
|
||||
btWheelInfo& wheel = m_wheelInfo[i];
|
||||
|
||||
btScalar suspensionForce = wheel.m_wheelsSuspensionForce;
|
||||
btScalar suspensionForce = wheel.m_wheelsSuspensionForce;
|
||||
|
||||
btScalar gMaxSuspensionForce = btScalar(6000.);
|
||||
if (suspensionForce > gMaxSuspensionForce)
|
||||
{
|
||||
suspensionForce = gMaxSuspensionForce;
|
||||
}
|
||||
btVector3 impulse = wheel.m_raycastInfo.m_contactNormalWS * suspensionForce * step;
|
||||
btVector3 relpos = wheel.m_raycastInfo.m_contactPointWS - getRigidBody()->getCenterOfMassPosition();
|
||||
btScalar gMaxSuspensionForce = btScalar(6000.);
|
||||
if (suspensionForce > gMaxSuspensionForce)
|
||||
{
|
||||
suspensionForce = gMaxSuspensionForce;
|
||||
}
|
||||
btVector3 impulse = wheel.m_raycastInfo.m_contactNormalWS * suspensionForce * step;
|
||||
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++)
|
||||
{
|
||||
btWheelInfo& wheel = m_wheelInfo[i];
|
||||
btVector3 relpos = wheel.m_raycastInfo.m_hardPointWS - getRigidBody()->getCenterOfMassPosition();
|
||||
btVector3 vel = getRigidBody()->getVelocityInLocalPoint( relpos );
|
||||
for (i=0;i<m_wheelInfo.size();i++)
|
||||
{
|
||||
btWheelInfo& wheel = m_wheelInfo[i];
|
||||
btVector3 relpos = wheel.m_raycastInfo.m_hardPointWS - getRigidBody()->getCenterOfMassPosition();
|
||||
btVector3 vel = getRigidBody()->getVelocityInLocalPoint( relpos );
|
||||
|
||||
if (wheel.m_raycastInfo.m_isInContact)
|
||||
{
|
||||
const btTransform& chassisWorldTransform = getChassisWorldTransform();
|
||||
if (wheel.m_raycastInfo.m_isInContact)
|
||||
{
|
||||
const btTransform& chassisWorldTransform = getChassisWorldTransform();
|
||||
|
||||
btVector3 fwd (
|
||||
chassisWorldTransform.getBasis()[0][m_indexForwardAxis],
|
||||
chassisWorldTransform.getBasis()[1][m_indexForwardAxis],
|
||||
chassisWorldTransform.getBasis()[2][m_indexForwardAxis]);
|
||||
btVector3 fwd (
|
||||
chassisWorldTransform.getBasis()[0][m_indexForwardAxis],
|
||||
chassisWorldTransform.getBasis()[1][m_indexForwardAxis],
|
||||
chassisWorldTransform.getBasis()[2][m_indexForwardAxis]);
|
||||
|
||||
btScalar proj = fwd.dot(wheel.m_raycastInfo.m_contactNormalWS);
|
||||
fwd -= wheel.m_raycastInfo.m_contactNormalWS * proj;
|
||||
btScalar proj = fwd.dot(wheel.m_raycastInfo.m_contactNormalWS);
|
||||
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_rotation += wheel.m_deltaRotation;
|
||||
wheel.m_deltaRotation = (proj2 * step) / (wheel.m_wheelsRadius);
|
||||
wheel.m_rotation += wheel.m_deltaRotation;
|
||||
|
||||
} else
|
||||
{
|
||||
wheel.m_rotation += wheel.m_deltaRotation;
|
||||
}
|
||||
} else
|
||||
{
|
||||
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)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++)
|
||||
{
|
||||
btWheelInfo &wheel_info = m_wheelInfo[w_it];
|
||||
for (int w_it=0; w_it<getNumWheels(); w_it++)
|
||||
{
|
||||
btWheelInfo &wheel_info = m_wheelInfo[w_it];
|
||||
|
||||
if ( wheel_info.m_raycastInfo.m_isInContact )
|
||||
{
|
||||
btScalar force;
|
||||
// Spring
|
||||
{
|
||||
btScalar susp_length = wheel_info.getSuspensionRestLength();
|
||||
btScalar current_length = wheel_info.m_raycastInfo.m_suspensionLength;
|
||||
if ( wheel_info.m_raycastInfo.m_isInContact )
|
||||
{
|
||||
btScalar force;
|
||||
// Spring
|
||||
{
|
||||
btScalar susp_length = wheel_info.getSuspensionRestLength();
|
||||
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
|
||||
* length_diff * wheel_info.m_clippedInvContactDotSuspension;
|
||||
}
|
||||
* length_diff * wheel_info.m_clippedInvContactDotSuspension;
|
||||
}
|
||||
|
||||
// Damper
|
||||
{
|
||||
btScalar projected_rel_vel = wheel_info.m_suspensionRelativeVelocity;
|
||||
{
|
||||
btScalar susp_damping;
|
||||
if ( projected_rel_vel < btScalar(0.0) )
|
||||
{
|
||||
susp_damping = wheel_info.m_wheelsDampingCompression;
|
||||
}
|
||||
else
|
||||
{
|
||||
susp_damping = wheel_info.m_wheelsDampingRelaxation;
|
||||
}
|
||||
force -= susp_damping * projected_rel_vel;
|
||||
}
|
||||
}
|
||||
// Damper
|
||||
{
|
||||
btScalar projected_rel_vel = wheel_info.m_suspensionRelativeVelocity;
|
||||
{
|
||||
btScalar susp_damping;
|
||||
if ( projected_rel_vel < btScalar(0.0) )
|
||||
{
|
||||
susp_damping = wheel_info.m_wheelsDampingCompression;
|
||||
}
|
||||
else
|
||||
{
|
||||
susp_damping = wheel_info.m_wheelsDampingRelaxation;
|
||||
}
|
||||
force -= susp_damping * projected_rel_vel;
|
||||
}
|
||||
}
|
||||
|
||||
// RESULT
|
||||
wheel_info.m_wheelsSuspensionForce = force * chassisMass;
|
||||
if (wheel_info.m_wheelsSuspensionForce < btScalar(0.))
|
||||
{
|
||||
wheel_info.m_wheelsSuspensionForce = btScalar(0.);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// RESULT
|
||||
wheel_info.m_wheelsSuspensionForce = force * chassisMass;
|
||||
if (wheel_info.m_wheelsSuspensionForce < btScalar(0.))
|
||||
{
|
||||
wheel_info.m_wheelsSuspensionForce = btScalar(0.);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// A very unphysical thing to handle slopes that are a bit too steep
|
||||
// or uneven (resulting in only one wheel on the ground)
|
||||
// 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
|
||||
// are on the ground, so we have to test only one of the wheels
|
||||
wheel_info.m_wheelsSuspensionForce = -m_track_connect_accel*chassisMass ;
|
||||
}
|
||||
}
|
||||
} // 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.
|
||||
struct btWheelContactPoint
|
||||
{
|
||||
btRigidBody* m_body0;
|
||||
btRigidBody* m_body1;
|
||||
btVector3 m_frictionPositionWorld;
|
||||
btVector3 m_frictionDirectionWorld;
|
||||
btScalar m_jacDiagABInv;
|
||||
btScalar m_maxImpulse;
|
||||
btRigidBody* m_body0;
|
||||
btRigidBody* m_body1;
|
||||
btVector3 m_frictionPositionWorld;
|
||||
btVector3 m_frictionDirectionWorld;
|
||||
btScalar m_jacDiagABInv;
|
||||
btScalar m_maxImpulse;
|
||||
|
||||
|
||||
btWheelContactPoint(btRigidBody* body0,btRigidBody* body1,const btVector3& frictionPosWorld,const btVector3& frictionDirectionWorld, btScalar maxImpulse)
|
||||
:m_body0(body0),
|
||||
m_body1(body1),
|
||||
m_frictionPositionWorld(frictionPosWorld),
|
||||
m_frictionDirectionWorld(frictionDirectionWorld),
|
||||
m_maxImpulse(maxImpulse)
|
||||
{
|
||||
btScalar denom0 = body0->computeImpulseDenominator(frictionPosWorld,frictionDirectionWorld);
|
||||
btScalar denom1 = body1->computeImpulseDenominator(frictionPosWorld,frictionDirectionWorld);
|
||||
btScalar relaxation = 1.f;
|
||||
m_jacDiagABInv = relaxation/(denom0+denom1);
|
||||
}
|
||||
btWheelContactPoint(btRigidBody* body0,btRigidBody* body1,const btVector3& frictionPosWorld,const btVector3& frictionDirectionWorld, btScalar maxImpulse)
|
||||
:m_body0(body0),
|
||||
m_body1(body1),
|
||||
m_frictionPositionWorld(frictionPosWorld),
|
||||
m_frictionDirectionWorld(frictionDirectionWorld),
|
||||
m_maxImpulse(maxImpulse)
|
||||
{
|
||||
btScalar denom0 = body0->computeImpulseDenominator(frictionPosWorld,frictionDirectionWorld);
|
||||
btScalar denom1 = body1->computeImpulseDenominator(frictionPosWorld,frictionDirectionWorld);
|
||||
btScalar relaxation = 1.f;
|
||||
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
|
||||
@ -674,7 +674,7 @@ void btKart::updateFriction(btScalar timeStep)
|
||||
btWheelInfo& wheelInfo = m_wheelInfo[wheel];
|
||||
class btRigidBody* groundObject = (class btRigidBody*) wheelInfo.m_raycastInfo.m_groundObject;
|
||||
|
||||
btScalar rollingFriction = 0.f;
|
||||
btScalar rollingFriction = 0.f;
|
||||
|
||||
m_forwardImpulse[wheel] = btScalar(0.);
|
||||
m_wheelInfo[wheel].m_skidInfo= btScalar(1.);
|
||||
|
@ -28,20 +28,20 @@ subject to the following restrictions:
|
||||
//!
|
||||
|
||||
void btUprightConstraint::solveAngularLimit(
|
||||
btUprightConstraintLimit *limit,
|
||||
btUprightConstraintLimit *limit,
|
||||
btScalar timeStep, btScalar jacDiagABInv,
|
||||
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;
|
||||
|
||||
limit->m_currentLimitError = (limit->m_angle<m_loLimit)
|
||||
? limit->m_angle - m_loLimit
|
||||
: limit->m_angle - m_hiLimit;
|
||||
|
||||
btScalar targetVelocity = -m_ERP*limit->m_currentLimitError/(3.1415f/8.0f*timeStep);
|
||||
btScalar maxMotorForce = m_maxLimitForce;
|
||||
btScalar targetVelocity = -m_ERP*limit->m_currentLimitError/(3.1415f/8.0f*timeStep);
|
||||
btScalar maxMotorForce = m_maxLimitForce;
|
||||
|
||||
maxMotorForce *= timeStep;
|
||||
|
||||
@ -55,7 +55,7 @@ void btUprightConstraint::solveAngularLimit(
|
||||
// correction impulse
|
||||
btScalar unclippedMotorImpulse = (1+m_bounce)*motorVelocity*jacDiagABInv;
|
||||
|
||||
// clip correction impulse
|
||||
// clip correction impulse
|
||||
btScalar clippedMotorImpulse = unclippedMotorImpulse;
|
||||
|
||||
//todo: should clip against accumulated impulse
|
||||
@ -69,7 +69,7 @@ void btUprightConstraint::solveAngularLimit(
|
||||
clippedMotorImpulse = unclippedMotorImpulse < -maxMotorForce ? -maxMotorForce: unclippedMotorImpulse;
|
||||
}
|
||||
|
||||
// sort with accumulated impulses
|
||||
// sort with accumulated impulses
|
||||
btScalar lo = btScalar(-1e30);
|
||||
btScalar hi = btScalar(1e30);
|
||||
|
||||
@ -77,7 +77,7 @@ void btUprightConstraint::solveAngularLimit(
|
||||
|
||||
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;
|
||||
|
||||
@ -102,9 +102,9 @@ btUprightConstraint::btUprightConstraint(btRigidBody& rbA, const btTransform& fr
|
||||
m_disable_time = 0.0f;
|
||||
m_limit[0].m_accumulatedImpulse = 0.0f;
|
||||
m_limit[1].m_accumulatedImpulse = 0.0f;
|
||||
m_limit[ 0 ].m_axis = btVector3( 1, 0, 0 );
|
||||
m_limit[ 1 ].m_axis = btVector3( 0, 1, 0 );
|
||||
setLimit( SIMD_PI * 0.4f );
|
||||
m_limit[ 0 ].m_axis = btVector3( 1, 0, 0 );
|
||||
m_limit[ 1 ].m_axis = btVector3( 0, 1, 0 );
|
||||
setLimit( SIMD_PI * 0.4f );
|
||||
}
|
||||
|
||||
//!
|
||||
@ -115,22 +115,22 @@ void btUprightConstraint::buildJacobian()
|
||||
{
|
||||
btTransform worldTransform = m_rbA.getCenterOfMassTransform() * m_frameInA;
|
||||
btVector3 upAxis = worldTransform.getBasis().getColumn(2);
|
||||
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[ 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;
|
||||
|
||||
for ( int i = 0; i < 2; i++ )
|
||||
{
|
||||
if ( m_limit[ i ].m_angle < -SIMD_PI )
|
||||
m_limit[ i ].m_angle += 2 * SIMD_PI;
|
||||
if ( m_limit[ i ].m_angle > SIMD_PI )
|
||||
m_limit[ i ].m_angle -= 2 * SIMD_PI;
|
||||
for ( int i = 0; i < 2; i++ )
|
||||
{
|
||||
if ( m_limit[ i ].m_angle < -SIMD_PI )
|
||||
m_limit[ i ].m_angle += 2 * SIMD_PI;
|
||||
if ( m_limit[ i ].m_angle > SIMD_PI )
|
||||
m_limit[ i ].m_angle -= 2 * SIMD_PI;
|
||||
|
||||
new (&m_jacAng[ i ]) btJacobianEntry( m_limit[ i ].m_axis,
|
||||
m_rbA.getCenterOfMassTransform().getBasis().transpose(),
|
||||
m_rbB.getCenterOfMassTransform().getBasis().transpose(),
|
||||
m_rbA.getInvInertiaDiagLocal(),
|
||||
m_rbB.getInvInertiaDiagLocal());
|
||||
}
|
||||
new (&m_jacAng[ i ]) btJacobianEntry( m_limit[ i ].m_axis,
|
||||
m_rbA.getCenterOfMassTransform().getBasis().transpose(),
|
||||
m_rbB.getCenterOfMassTransform().getBasis().transpose(),
|
||||
m_rbA.getInvInertiaDiagLocal(),
|
||||
m_rbB.getInvInertiaDiagLocal());
|
||||
}
|
||||
}
|
||||
|
||||
//!
|
||||
@ -148,7 +148,7 @@ void btUprightConstraint::solveConstraint(btScalar timeStep)
|
||||
if(m_disable_time>0.0f) return;
|
||||
}
|
||||
|
||||
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[ 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 );
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ void HighscoreManager::Load()
|
||||
{
|
||||
|
||||
const lisp::Lisp* root = 0;
|
||||
std::exception err;
|
||||
std::exception err;
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -55,7 +55,7 @@ bool ReplayRecorder::initRecorder( unsigned int number_karts, size_t number_prea
|
||||
|
||||
bool ReplayRecorder::pushFrame()
|
||||
{
|
||||
// we dont record the startphase ..
|
||||
// we dont record the startphase ..
|
||||
assert( RaceManager::getWorld()->getPhase() != World::START_PHASE );
|
||||
assert( RaceManager::getWorld()->getNumKarts() == m_ReplayBuffers.getNumberKarts() );
|
||||
|
||||
|
@ -192,7 +192,7 @@ void FeatureUnlockedCutScene::onUpdate(float dt, irr::video::IVideoDriver* drive
|
||||
//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) );
|
||||
|
||||
const int GIFT_EXIT_FROM = 7;
|
||||
const int GIFT_EXIT_FROM = 7;
|
||||
const int GIFT_EXIT_TO = 20;
|
||||
|
||||
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 ));
|
||||
if (chest_top_angle < 110.0)
|
||||
{
|
||||
core::vector3df chestpos = m_chest_top->getPosition();
|
||||
chestpos.Y += dt*6;
|
||||
m_chest_top->setPosition(chestpos);
|
||||
core::vector3df chestpos = m_chest_top->getPosition();
|
||||
chestpos.Y += dt*6;
|
||||
m_chest_top->setPosition(chestpos);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
m_camera->setTarget( m_root_gift_node->getPosition() + core::vector3df(0.0f, 10.0f, 0.0f) );
|
||||
m_camera->updateAbsolutePosition();
|
||||
m_camera->setTarget( m_root_gift_node->getPosition() + core::vector3df(0.0f, 10.0f, 0.0f) );
|
||||
m_camera->updateAbsolutePosition();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_camera->setTarget( core::vector3df(0, 10, 0.0f) );
|
||||
m_camera->updateAbsolutePosition();
|
||||
m_camera->updateAbsolutePosition();
|
||||
}
|
||||
|
||||
static const int w = irr_driver->getFrameSize().Width;
|
||||
|
@ -65,14 +65,14 @@ void MainMenuScreen::eventCallback(Widget* widget, const std::string& name, cons
|
||||
|
||||
if (i % 2 == 0)
|
||||
{
|
||||
// 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")) );
|
||||
StateManager::get()->pushScreen(scene);
|
||||
// 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")) );
|
||||
StateManager::get()->pushScreen(scene);
|
||||
}
|
||||
else
|
||||
{
|
||||
scene->setUnlockedPicture( GUIEngine::getDriver()->getTexture(track_manager->getTrack("beach")->getScreenshotFile().c_str()) );
|
||||
StateManager::get()->pushScreen(scene);
|
||||
scene->setUnlockedPicture( GUIEngine::getDriver()->getTexture(track_manager->getTrack("beach")->getScreenshotFile().c_str()) );
|
||||
StateManager::get()->pushScreen(scene);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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 gamepad = (sensedInput->type == Input::IT_STICKMOTION ||
|
||||
sensedInput->type == Input::IT_STICKBUTTON) &&
|
||||
deviceID.find("gamepad") != std::string::npos;
|
||||
deviceID.find("gamepad") != std::string::npos;
|
||||
|
||||
if (!keyboard && !gamepad) return;
|
||||
if (gamepad)
|
||||
@ -275,7 +275,7 @@ void OptionsScreenInput::eventCallback(Widget* widget, const std::string& name,
|
||||
read = sscanf( selection.c_str(), "keyboard%i", &i );
|
||||
if (read == 1 && i != -1)
|
||||
{
|
||||
updateInputButtons( input_manager->getDeviceList()->getKeyboardConfig(i) );
|
||||
updateInputButtons( input_manager->getDeviceList()->getKeyboardConfig(i) );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -295,7 +295,7 @@ void RaceGUI::drawGlobalMiniMap()
|
||||
{
|
||||
const Kart *kart = RaceManager::getKart(i);
|
||||
if(kart->isEliminated()) continue; // don't draw eliminated kart
|
||||
const Vec3& xyz = kart->getXYZ();
|
||||
const Vec3& xyz = kart->getXYZ();
|
||||
Vec3 draw_at;
|
||||
RaceManager::getTrack()->mapPoint2MiniMap(xyz, &draw_at);
|
||||
// int marker_height = m_marker->getOriginalSize().Height;
|
||||
|
@ -39,7 +39,7 @@ AmbientLightSphere::AmbientLightSphere(CheckManager *check_manager,
|
||||
{
|
||||
m_ambient_color = video::SColor(255, 0, 255, 0); // green
|
||||
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
|
||||
node.get("color", &m_ambient_color);
|
||||
} // AmbientLightSphere
|
||||
|
@ -23,39 +23,39 @@
|
||||
|
||||
BezierCurve::BezierCurve(const XMLNode &node)
|
||||
{
|
||||
for(unsigned int i=0; i<node.getNumNodes(); i++)
|
||||
{
|
||||
const XMLNode *p = node.getNode(i);
|
||||
BezierData b;
|
||||
p->get("c", &b.m_control_point);
|
||||
p->get("h1", &b.m_handle1);
|
||||
p->get("h2", &b.m_handle2);
|
||||
m_all_data.push_back(b);
|
||||
} // for i<node.getNumNodes()
|
||||
for(unsigned int i=0; i<node.getNumNodes(); i++)
|
||||
{
|
||||
const XMLNode *p = node.getNode(i);
|
||||
BezierData b;
|
||||
p->get("c", &b.m_control_point);
|
||||
p->get("h1", &b.m_handle1);
|
||||
p->get("h2", &b.m_handle2);
|
||||
m_all_data.push_back(b);
|
||||
} // for i<node.getNumNodes()
|
||||
} // BezierCurve
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
Vec3 BezierCurve::getXYZ(float t) const
|
||||
{
|
||||
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;
|
||||
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;
|
||||
|
||||
const BezierData &p0 = m_all_data[i];
|
||||
const BezierData &p1 = m_all_data[i+1];
|
||||
const BezierData &p0 = m_all_data[i];
|
||||
const BezierData &p1 = m_all_data[i+1];
|
||||
|
||||
Vec3 c = 3*(p0.m_handle2-p0.m_control_point);
|
||||
Vec3 b = 3*(p1.m_handle1-p0.m_handle2)-c;
|
||||
Vec3 a = p1.m_control_point - p0.m_control_point - c - b;
|
||||
Vec3 c = 3*(p0.m_handle2-p0.m_control_point);
|
||||
Vec3 b = 3*(p1.m_handle1-p0.m_handle2)-c;
|
||||
Vec3 a = p1.m_control_point - p0.m_control_point - c - b;
|
||||
|
||||
t = t-i;
|
||||
Vec3 r = a*t*t*t + b*t*t + c*t + p0.m_control_point;
|
||||
return r;
|
||||
t = t-i;
|
||||
Vec3 r = a*t*t*t + b*t*t + c*t + p0.m_control_point;
|
||||
return r;
|
||||
} // getXYZ
|
||||
// ----------------------------------------------------------------------------
|
||||
Vec3 BezierCurve::getHPR(float t) const
|
||||
{
|
||||
// FIXME: not yet implemented
|
||||
Vec3 hpr;
|
||||
return hpr;
|
||||
// FIXME: not yet implemented
|
||||
Vec3 hpr;
|
||||
return hpr;
|
||||
} // getHPR
|
||||
|
||||
|
@ -34,9 +34,9 @@ CheckLine::CheckLine(CheckManager *check_manager, const XMLNode &node)
|
||||
{
|
||||
m_previous_sign.resize(race_manager->getNumKarts());
|
||||
core::vector2df p1, p2;
|
||||
node.get("p1", &p1);
|
||||
node.get("p2", &p2);
|
||||
node.get("min-height", &m_min_height);
|
||||
node.get("p1", &p1);
|
||||
node.get("p2", &p2);
|
||||
node.get("min-height", &m_min_height);
|
||||
m_line.setLine(p1, p2);
|
||||
} // CheckLine
|
||||
|
||||
|
@ -29,25 +29,25 @@
|
||||
|
||||
CheckManager::CheckManager(const XMLNode &node, Track *track)
|
||||
{
|
||||
for(unsigned int i=0; i<node.getNumNodes(); i++)
|
||||
{
|
||||
const XMLNode *check_node = node.getNode(i);
|
||||
const std::string &type = check_node->getName();
|
||||
if(type=="check-line")
|
||||
{
|
||||
for(unsigned int i=0; i<node.getNumNodes(); i++)
|
||||
{
|
||||
const XMLNode *check_node = node.getNode(i);
|
||||
const std::string &type = check_node->getName();
|
||||
if(type=="check-line")
|
||||
{
|
||||
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)
|
||||
{
|
||||
track->getQuadGraph().setStartCoordinate(*cl);
|
||||
}
|
||||
} // checkline
|
||||
} // checkline
|
||||
else if(type=="check-sphere")
|
||||
{
|
||||
AmbientLightSphere *cs = new AmbientLightSphere(this, *check_node);
|
||||
m_all_checks.push_back(cs);
|
||||
} // checksphere
|
||||
} // for i<node.getNumNodes
|
||||
} // for i<node.getNumNodes
|
||||
} // CheckManager
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -55,8 +55,8 @@ CheckManager::CheckManager(const XMLNode &node, Track *track)
|
||||
void CheckManager::reset(const Track &track)
|
||||
{
|
||||
std::vector<CheckStructure*>::iterator i;
|
||||
for(i=m_all_checks.begin(); i!=m_all_checks.end(); i++)
|
||||
(*i)->reset(track);
|
||||
for(i=m_all_checks.begin(); i!=m_all_checks.end(); i++)
|
||||
(*i)->reset(track);
|
||||
} // reset
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -65,8 +65,8 @@ void CheckManager::reset(const Track &track)
|
||||
*/
|
||||
void CheckManager::update(float dt)
|
||||
{
|
||||
std::vector<CheckStructure*>::iterator i;
|
||||
for(i=m_all_checks.begin(); i!=m_all_checks.end(); i++)
|
||||
(*i)->update(dt);
|
||||
std::vector<CheckStructure*>::iterator i;
|
||||
for(i=m_all_checks.begin(); i!=m_all_checks.end(); i++)
|
||||
(*i)->update(dt);
|
||||
} // update
|
||||
|
||||
|
@ -36,7 +36,7 @@ CheckSphere::CheckSphere(CheckManager *check_manager, const XMLNode &node)
|
||||
{
|
||||
m_radius2 = 1;
|
||||
|
||||
node.get("radius", &m_radius2);
|
||||
node.get("radius", &m_radius2);
|
||||
m_radius2 *= m_radius2;
|
||||
node.get("xyz", &m_center_point);
|
||||
m_is_inside.resize(race_manager->getNumKarts());
|
||||
|
Loading…
x
Reference in New Issue
Block a user