Merge remote-tracking branch 'upstream/master' into kart-properties
Conflicts: data/stk_config.xml sources.cmake src/karts/kart.cpp src/karts/kart.hpp src/karts/kart_properties.cpp src/karts/kart_properties.hpp src/tracks/track.cpp
This commit is contained in:
commit
5d36b95c95
Binary file not shown.
@ -39,31 +39,31 @@
|
||||
<spacer width="10" height="10" />
|
||||
|
||||
<buttonbar id="menu_bottomrow" x="0" y="0" width="38%" height="100%" align="center">
|
||||
<icon-button id="test_gpwin" width="64" height="64" icon="gui/main_options.png" extend_label="50"
|
||||
<icon-button id="test_gpwin" width="64" height="64" icon="gui/main_options.png"
|
||||
raw_text="TEST: GPWin" label_location="hover"/>
|
||||
<icon-button id="test_gplose" width="64" height="64" icon="gui/main_options.png" extend_label="50"
|
||||
<icon-button id="test_gplose" width="64" height="64" icon="gui/main_options.png"
|
||||
raw_text="TEST: GPLose" label_location="hover"/>
|
||||
<icon-button id="test_unlocked" width="64" height="64" icon="gui/main_options.png" extend_label="50"
|
||||
<icon-button id="test_unlocked" width="64" height="64" icon="gui/main_options.png"
|
||||
raw_text="TEST: Unlocked" label_location="hover"/>
|
||||
<icon-button id="test_unlocked2" width="64" height="64" icon="gui/main_options.png" extend_label="50"
|
||||
<icon-button id="test_unlocked2" width="64" height="64" icon="gui/main_options.png"
|
||||
raw_text="TEST: Unlocked 2" label_location="hover"/>
|
||||
<icon-button id="test_intro" width="64" height="64" icon="gui/main_options.png" extend_label="50"
|
||||
<icon-button id="test_intro" width="64" height="64" icon="gui/main_options.png"
|
||||
raw_text="TEST: Intro" label_location="hover"/>
|
||||
<icon-button id="test_outro" width="64" height="64" icon="gui/main_options.png" extend_label="50"
|
||||
<icon-button id="test_outro" width="64" height="64" icon="gui/main_options.png"
|
||||
raw_text="TEST: Outro" label_location="hover"/>
|
||||
<icon-button id="options" width="64" height="64" icon="gui/main_options.png" extend_label="50"
|
||||
<icon-button id="options" width="64" height="64" icon="gui/main_options.png"
|
||||
I18N="In the main screen" text="Options" label_location="hover"/>
|
||||
<icon-button id="help" width="64" height="64" icon="gui/main_help.png" extend_label="50"
|
||||
<icon-button id="help" width="64" height="64" icon="gui/main_help.png"
|
||||
I18N="In the main screen" text="Help" label_location="hover"/>
|
||||
<icon-button id="startTutorial" width="64" height="64" icon="gui/tutorial.png" extend_label="150"
|
||||
<icon-button id="startTutorial" width="64" height="64" icon="gui/tutorial.png"
|
||||
I18N="In the main screen" text="Tutorial" label_location="hover"/>
|
||||
<icon-button id="achievements" width="64" height="64" icon="gui/gp_copy.png" extend_label="150"
|
||||
<icon-button id="achievements" width="64" height="64" icon="gui/gp_copy.png"
|
||||
I18N="In the main screen" text="Achievements" label_location="hover"/>
|
||||
<icon-button id="gpEditor" width="64" height="64" icon="gui/gpeditor.png" extend_label="150"
|
||||
<icon-button id="gpEditor" width="64" height="64" icon="gui/gpeditor.png"
|
||||
I18N="In the main screen" text="Grand Prix Editor" label_location="hover"/>
|
||||
<icon-button id="about" width="64" height="64" icon="gui/main_about.png" extend_label="50"
|
||||
<icon-button id="about" width="64" height="64" icon="gui/main_about.png"
|
||||
I18N="In the main screen" text="About" label_location="hover"/>
|
||||
<icon-button id="quit" width="64" height="64" icon="gui/main_quit.png" extend_label="50"
|
||||
<icon-button id="quit" width="64" height="64" icon="gui/main_quit.png"
|
||||
I18N="In the main screen" text="Quit" label_location="hover"/>
|
||||
</buttonbar>
|
||||
</bottombar>
|
||||
|
@ -16,9 +16,11 @@ void main()
|
||||
col += .25 * texture(tex_256, uv);
|
||||
col += .5 * texture(tex_512, uv);
|
||||
|
||||
// Blue color for lens flare
|
||||
/*col *= 0.5;
|
||||
float final = max(col.r,max(col.g,col.b));
|
||||
//final = final * 2;
|
||||
vec3 blue = vec3(final * 0.1, final * 0.2, final);
|
||||
final = final * 2;
|
||||
vec3 blue = vec3(final * 0.1, final * 0.2, final);*/
|
||||
|
||||
FragColor = vec4(blue, 1.);
|
||||
FragColor = vec4(col.rgb, 1.);
|
||||
}
|
||||
|
@ -115,6 +115,11 @@
|
||||
work anymore - so for now don't enable this. -->
|
||||
<networking enable="false"/>
|
||||
|
||||
<!-- The field od views for 1-4 player split screen. fov-3 is
|
||||
actually not used (since 3 player split screen uses the
|
||||
same layout as 4 player split screen) -->
|
||||
<camera fov-1="80" fov-2="65" fov-3="50" fov-4="75" />
|
||||
|
||||
<!-- disable-while-unskid: Disable steering when stop skidding during
|
||||
the time it takes to adjust the physical body with the graphics.
|
||||
camera-follow-skid: If true the camera will stay behind the kart,
|
||||
@ -126,15 +131,6 @@
|
||||
<!-- Default values for all karts
|
||||
============================ -->
|
||||
<general-kart-defaults>
|
||||
<!-- Options to affect the graphical chassis:
|
||||
y-offset: Additional offset to move graphical chassis with regards
|
||||
to the physics, used to reduce frequencey of graphical
|
||||
chassis in terrain.
|
||||
prevent-chassis-in-terrain: a hard flag to prevent nearly all instances
|
||||
of chassis in terrain. Can (atm) cause some stuttering. -->
|
||||
<graphics y-offset="0.0"
|
||||
prevent-chassis-in-terrain="true"
|
||||
/>
|
||||
|
||||
<!-- Skidding: increase: multiplicative increase of skidding factor in each frame.
|
||||
decrease: multiplicative decrease of skidding factor in each frame.
|
||||
|
@ -77,7 +77,7 @@ btWheelInfo& btRaycastVehicle::addWheel( const btVector3& connectionPointCS, con
|
||||
ci.m_wheelsDampingRelaxation = tuning.m_suspensionDamping;
|
||||
ci.m_frictionSlip = tuning.m_frictionSlip;
|
||||
ci.m_bIsFrontWheel = isFrontWheel;
|
||||
ci.m_maxSuspensionTravelCm = tuning.m_maxSuspensionTravelCm;
|
||||
ci.m_maxSuspensionTravel = tuning.m_maxSuspensionTravel;
|
||||
ci.m_maxSuspensionForce = tuning.m_maxSuspensionForce;
|
||||
|
||||
m_wheelInfo.push_back( btWheelInfo(ci));
|
||||
@ -118,7 +118,7 @@ void btRaycastVehicle::updateWheelTransform( int wheelIndex , bool interpolatedT
|
||||
btQuaternion steeringOrn(up,steering);//wheel.m_steering);
|
||||
btMatrix3x3 steeringMat(steeringOrn);
|
||||
|
||||
btQuaternion rotatingOrn(right,-wheel.m_rotation);
|
||||
btQuaternion rotatingOrn(right,0);
|
||||
btMatrix3x3 rotatingMat(rotatingOrn);
|
||||
|
||||
btMatrix3x3 basis2(
|
||||
@ -203,8 +203,8 @@ btScalar btRaycastVehicle::rayCast(btWheelInfo& wheel)
|
||||
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);
|
||||
btScalar minSuspensionLength = wheel.getSuspensionRestLength() - wheel.m_maxSuspensionTravel;
|
||||
btScalar maxSuspensionLength = wheel.getSuspensionRestLength()+ wheel.m_maxSuspensionTravel;
|
||||
if (wheel.m_raycastInfo.m_suspensionLength < minSuspensionLength)
|
||||
{
|
||||
wheel.m_raycastInfo.m_suspensionLength = minSuspensionLength;
|
||||
@ -345,17 +345,7 @@ void btRaycastVehicle::updateVehicle( btScalar step )
|
||||
fwd -= wheel.m_raycastInfo.m_contactNormalWS * proj;
|
||||
|
||||
btScalar proj2 = fwd.dot(vel);
|
||||
|
||||
wheel.m_deltaRotation = (proj2 * step) / (wheel.m_wheelsRadius);
|
||||
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
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -43,7 +43,7 @@ public:
|
||||
:m_suspensionStiffness(btScalar(5.88)),
|
||||
m_suspensionCompression(btScalar(0.83)),
|
||||
m_suspensionDamping(btScalar(0.88)),
|
||||
m_maxSuspensionTravelCm(btScalar(500.)),
|
||||
m_maxSuspensionTravel(btScalar(5.)),
|
||||
m_frictionSlip(btScalar(10.5)),
|
||||
m_maxSuspensionForce(btScalar(6000.))
|
||||
{
|
||||
@ -51,7 +51,7 @@ public:
|
||||
btScalar m_suspensionStiffness;
|
||||
btScalar m_suspensionCompression;
|
||||
btScalar m_suspensionDamping;
|
||||
btScalar m_maxSuspensionTravelCm;
|
||||
btScalar m_maxSuspensionTravel;
|
||||
btScalar m_frictionSlip;
|
||||
btScalar m_maxSuspensionForce;
|
||||
|
||||
|
@ -22,7 +22,7 @@ struct btWheelInfoConstructionInfo
|
||||
btVector3 m_wheelDirectionCS;
|
||||
btVector3 m_wheelAxleCS;
|
||||
btScalar m_suspensionRestLength;
|
||||
btScalar m_maxSuspensionTravelCm;
|
||||
btScalar m_maxSuspensionTravel;
|
||||
btScalar m_wheelRadius;
|
||||
|
||||
btScalar m_suspensionStiffness;
|
||||
@ -59,7 +59,7 @@ struct btWheelInfo
|
||||
btVector3 m_wheelDirectionCS;//const
|
||||
btVector3 m_wheelAxleCS; // const or modified by steering
|
||||
btScalar m_suspensionRestLength1;//const
|
||||
btScalar m_maxSuspensionTravelCm;
|
||||
btScalar m_maxSuspensionTravel;
|
||||
btScalar getSuspensionRestLength() const;
|
||||
btScalar m_wheelsRadius;//const
|
||||
btScalar m_suspensionStiffness;//const
|
||||
@ -67,8 +67,6 @@ struct btWheelInfo
|
||||
btScalar m_wheelsDampingRelaxation;//const
|
||||
btScalar m_frictionSlip;
|
||||
btScalar m_steering;
|
||||
btScalar m_rotation;
|
||||
btScalar m_deltaRotation;
|
||||
btScalar m_rollInfluence;
|
||||
btScalar m_maxSuspensionForce;
|
||||
|
||||
@ -87,7 +85,7 @@ struct btWheelInfo
|
||||
{
|
||||
|
||||
m_suspensionRestLength1 = ci.m_suspensionRestLength;
|
||||
m_maxSuspensionTravelCm = ci.m_maxSuspensionTravelCm;
|
||||
m_maxSuspensionTravel = ci.m_maxSuspensionTravel;
|
||||
|
||||
m_wheelsRadius = ci.m_wheelRadius;
|
||||
m_suspensionStiffness = ci.m_suspensionStiffness;
|
||||
@ -99,8 +97,6 @@ struct btWheelInfo
|
||||
m_frictionSlip = ci.m_frictionSlip;
|
||||
m_steering = btScalar(0.);
|
||||
m_engineForce = btScalar(0.);
|
||||
m_rotation = btScalar(0.);
|
||||
m_deltaRotation = btScalar(0.);
|
||||
m_brake = btScalar(0.);
|
||||
m_rollInfluence = btScalar(0.1);
|
||||
m_bIsFrontWheel = ci.m_bIsFrontWheel;
|
||||
|
@ -70,7 +70,7 @@ inline void GrahamScanConvexHull2D(btAlignedObjectArray<GrahamVector2>& original
|
||||
{
|
||||
const btVector3& left = originalPoints[i];
|
||||
const btVector3& right = originalPoints[0];
|
||||
if (left.x() < right.x() || !(right.x() < left.x()) && left.y() < right.y())
|
||||
if (left.x() < right.x() || (!(right.x() < left.x()) && left.y() < right.y()))
|
||||
{
|
||||
originalPoints.swap(0,i);
|
||||
}
|
||||
|
@ -83,6 +83,8 @@ enet_protocol_dispatch_incoming_commands (ENetHost * host, ENetEvent * event)
|
||||
}
|
||||
|
||||
return 1;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -863,6 +865,8 @@ enet_protocol_handle_acknowledge (ENetHost * host, ENetEvent * event, ENetPeer *
|
||||
enet_list_empty (& peer -> sentReliableCommands))
|
||||
enet_peer_disconnect (peer, peer -> eventData);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -87,7 +87,7 @@ void CAnimatedMeshSceneNode::buildFrameNr(u32 timeMs)
|
||||
}
|
||||
}
|
||||
|
||||
if ((StartFrame==EndFrame))
|
||||
if (StartFrame == EndFrame)
|
||||
{
|
||||
CurrentFrameNr = (f32)StartFrame; //Support for non animated meshes
|
||||
}
|
||||
|
@ -1867,6 +1867,9 @@ public:
|
||||
// Attribute implemented for texture references
|
||||
class CTextureAttribute : public IAttribute
|
||||
{
|
||||
// Explicitly hide base method
|
||||
using IAttribute::setTexture;
|
||||
|
||||
public:
|
||||
|
||||
CTextureAttribute(const char* name, video::ITexture* value, video::IVideoDriver* driver, const io::path& filename)
|
||||
|
@ -697,6 +697,8 @@ void CColorConverter::convert_viaFormat(const void* sP, ECOLOR_FORMAT sF, s32 sN
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -233,7 +233,6 @@ void CGUIButton::draw()
|
||||
return;
|
||||
|
||||
IGUISkin* skin = Environment->getSkin();
|
||||
video::IVideoDriver* driver = Environment->getVideoDriver();
|
||||
|
||||
// todo: move sprite up and text down if the pressed state has a sprite
|
||||
const core::position2di spritePos = AbsoluteRect.getCenter();
|
||||
@ -254,6 +253,7 @@ void CGUIButton::draw()
|
||||
core::recti(pos, ImageRect.getSize()),
|
||||
ImageRect, &AbsoluteClippingRect,
|
||||
0, UseAlphaChannel);
|
||||
//video::IVideoDriver* driver = Environment->getVideoDriver();
|
||||
//driver->draw2DImage(Image,
|
||||
// ScaleImage? AbsoluteRect :
|
||||
// core::recti(pos, ImageRect.getSize()),
|
||||
|
@ -73,12 +73,12 @@ u32 CGUIContextMenu::getItemCount() const
|
||||
//! Adds a menu item.
|
||||
u32 CGUIContextMenu::addItem(const wchar_t* text, s32 commandId, bool enabled, bool hasSubMenu, bool checked, bool autoChecking)
|
||||
{
|
||||
return insertItem(Items.size(), text, commandId, enabled, hasSubMenu, checked, autoChecking);
|
||||
return insertItem(Items.size(), text, commandId, enabled, hasSubMenu, checked, autoChecking);
|
||||
}
|
||||
|
||||
//! Insert a menu item at specified position.
|
||||
u32 CGUIContextMenu::insertItem(u32 idx, const wchar_t* text, s32 commandId, bool enabled,
|
||||
bool hasSubMenu, bool checked, bool autoChecking)
|
||||
bool hasSubMenu, bool checked, bool autoChecking)
|
||||
{
|
||||
SItem s;
|
||||
s.Enabled = enabled;
|
||||
@ -96,16 +96,16 @@ u32 CGUIContextMenu::insertItem(u32 idx, const wchar_t* text, s32 commandId, boo
|
||||
s.SubMenu->setVisible(false);
|
||||
}
|
||||
|
||||
u32 result = idx;
|
||||
if ( idx < Items.size() )
|
||||
{
|
||||
Items.insert(s, idx);
|
||||
}
|
||||
else
|
||||
{
|
||||
Items.push_back(s);
|
||||
result = Items.size() - 1;
|
||||
}
|
||||
u32 result = idx;
|
||||
if ( idx < Items.size() )
|
||||
{
|
||||
Items.insert(s, idx);
|
||||
}
|
||||
else
|
||||
{
|
||||
Items.push_back(s);
|
||||
result = Items.size() - 1;
|
||||
}
|
||||
|
||||
recalculateSize();
|
||||
return result;
|
||||
@ -129,8 +129,8 @@ void CGUIContextMenu::setSubMenu(u32 index, CGUIContextMenu* menu)
|
||||
if (index >= Items.size())
|
||||
return;
|
||||
|
||||
if (menu)
|
||||
menu->grab();
|
||||
if (menu)
|
||||
menu->grab();
|
||||
if (Items[index].SubMenu)
|
||||
Items[index].SubMenu->drop();
|
||||
|
||||
@ -522,8 +522,6 @@ void CGUIContextMenu::draw()
|
||||
recalculateSize();
|
||||
}
|
||||
|
||||
IGUISpriteBank* sprites = skin->getSpriteBank();
|
||||
|
||||
core::rect<s32> rect = AbsoluteRect;
|
||||
core::rect<s32>* clip = 0;
|
||||
|
||||
@ -583,12 +581,14 @@ void CGUIContextMenu::draw()
|
||||
font->draw(Items[i].Text.c_str(), rect,
|
||||
skin->getColor(c), false, true, clip);
|
||||
|
||||
|
||||
// draw submenu symbol
|
||||
//IGUISpriteBank* sprites = skin->getSpriteBank();
|
||||
//if (Items[i].SubMenu && sprites)
|
||||
//{
|
||||
// core::rect<s32> r = rect;
|
||||
// r.UpperLeftCorner.X = r.LowerRightCorner.X - 15;
|
||||
//
|
||||
//
|
||||
// sprites->draw2DSprite(skin->getIcon(EGDI_CURSOR_RIGHT),
|
||||
// r.getCenter(), clip, skin->getColor(c),
|
||||
// (i == HighLighted) ? ChangeTime : 0,
|
||||
@ -667,19 +667,19 @@ void CGUIContextMenu::recalculateSize()
|
||||
const s32 w = Items[i].SubMenu->getAbsolutePosition().getWidth();
|
||||
const s32 h = Items[i].SubMenu->getAbsolutePosition().getHeight();
|
||||
|
||||
core::rect<s32> subRect(width-5, Items[i].PosY, width+w-5, Items[i].PosY+h);
|
||||
core::rect<s32> subRect(width-5, Items[i].PosY, width+w-5, Items[i].PosY+h);
|
||||
|
||||
// if it would be drawn beyond the right border, then add it to the left side
|
||||
gui::IGUIElement * root = Environment->getRootGUIElement();
|
||||
if ( root )
|
||||
{
|
||||
core::rect<s32> rectRoot( root->getAbsolutePosition() );
|
||||
if ( getAbsolutePosition().UpperLeftCorner.X+subRect.LowerRightCorner.X > rectRoot.LowerRightCorner.X )
|
||||
{
|
||||
subRect.UpperLeftCorner.X = -w;
|
||||
subRect.LowerRightCorner.X = 0;
|
||||
}
|
||||
}
|
||||
// if it would be drawn beyond the right border, then add it to the left side
|
||||
gui::IGUIElement * root = Environment->getRootGUIElement();
|
||||
if ( root )
|
||||
{
|
||||
core::rect<s32> rectRoot( root->getAbsolutePosition() );
|
||||
if ( getAbsolutePosition().UpperLeftCorner.X+subRect.LowerRightCorner.X > rectRoot.LowerRightCorner.X )
|
||||
{
|
||||
subRect.UpperLeftCorner.X = -w;
|
||||
subRect.LowerRightCorner.X = 0;
|
||||
}
|
||||
}
|
||||
|
||||
Items[i].SubMenu->setRelativePosition(subRect);
|
||||
}
|
||||
|
@ -74,7 +74,6 @@ void CGUIImage::draw()
|
||||
return;
|
||||
|
||||
IGUISkin* skin = Environment->getSkin();
|
||||
video::IVideoDriver* driver = Environment->getVideoDriver();
|
||||
|
||||
if (Texture)
|
||||
{
|
||||
@ -88,7 +87,7 @@ void CGUIImage::draw()
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// driver->draw2DImage(Texture, AbsoluteRect.UpperLeftCorner,
|
||||
// Environment->getVideoDriver()->draw2DImage(Texture, AbsoluteRect.UpperLeftCorner,
|
||||
// core::rect<s32>(core::position2d<s32>(0,0), core::dimension2di(Texture->getOriginalSize())),
|
||||
// &AbsoluteClippingRect, Color, UseAlphaChannel);
|
||||
//}
|
||||
|
@ -547,12 +547,6 @@ static GLXContext getMeAGLContext(Display *display, GLXFBConfig glxFBConfig, boo
|
||||
GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_CORE_PROFILE_BIT_ARB,
|
||||
None
|
||||
};
|
||||
int legacyctx[] =
|
||||
{
|
||||
GLX_CONTEXT_MAJOR_VERSION_ARB, 2,
|
||||
GLX_CONTEXT_MINOR_VERSION_ARB, 1,
|
||||
None
|
||||
};
|
||||
PFNGLXCREATECONTEXTATTRIBSARBPROC glXCreateContextAttribsARB = 0;
|
||||
glXCreateContextAttribsARB = (PFNGLXCREATECONTEXTATTRIBSARBPROC)
|
||||
glXGetProcAddressARB( (const GLubyte *) "glXCreateContextAttribsARB" );
|
||||
|
@ -155,6 +155,8 @@ namespace video
|
||||
SColor color,
|
||||
bool useAlphaChannelOfTexture);
|
||||
|
||||
// Import draw2DImage method from base class
|
||||
using CNullDriver::draw2DImage;
|
||||
//! draws an 2d image, using a color (if color is other then Color(255,255,255,255)) and the alpha channel of the texture if wanted.
|
||||
virtual void draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos,
|
||||
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0,
|
||||
|
@ -28,7 +28,7 @@ CParticleAnimatedMeshSceneNodeEmitter::CParticleAnimatedMeshSceneNodeEmitter(
|
||||
MinStartColor(minStartColor), MaxStartColor(maxStartColor),
|
||||
MinLifeTime(lifeTimeMin), MaxLifeTime(lifeTimeMax),
|
||||
MaxStartSize(maxStartSize), MinStartSize(minStartSize),
|
||||
Time(0), Emitted(0), MaxAngleDegrees(maxAngleDegrees),
|
||||
Time(0), MaxAngleDegrees(maxAngleDegrees),
|
||||
EveryMeshVertex(everyMeshVertex), UseNormalDirection(useNormalDirection)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
|
@ -146,7 +146,6 @@ private:
|
||||
core::dimension2df MaxStartSize, MinStartSize;
|
||||
|
||||
u32 Time;
|
||||
u32 Emitted;
|
||||
s32 MaxAngleDegrees;
|
||||
|
||||
bool EveryMeshVertex;
|
||||
|
@ -25,7 +25,7 @@ CParticleBoxEmitter::CParticleBoxEmitter(
|
||||
MaxParticlesPerSecond(maxParticlesPerSecond),
|
||||
MinStartColor(minStartColor), MaxStartColor(maxStartColor),
|
||||
MinLifeTime(lifeTimeMin), MaxLifeTime(lifeTimeMax),
|
||||
Time(0), Emitted(0), MaxAngleDegrees(maxAngleDegrees)
|
||||
Time(0), MaxAngleDegrees(maxAngleDegrees)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
setDebugName("CParticleBoxEmitter");
|
||||
|
@ -121,7 +121,6 @@ private:
|
||||
u32 MinLifeTime, MaxLifeTime;
|
||||
|
||||
u32 Time;
|
||||
u32 Emitted;
|
||||
s32 MaxAngleDegrees;
|
||||
};
|
||||
|
||||
|
@ -27,7 +27,7 @@ CParticleCylinderEmitter::CParticleCylinderEmitter(
|
||||
MaxParticlesPerSecond(maxParticlesPerSecond),
|
||||
MinStartColor(minStartColor), MaxStartColor(maxStartColor),
|
||||
MinLifeTime(lifeTimeMin), MaxLifeTime(lifeTimeMax),
|
||||
Radius(radius), Length(length), Time(0), Emitted(0),
|
||||
Radius(radius), Length(length), Time(0),
|
||||
MaxAngleDegrees(maxAngleDegrees), OutlineOnly(outlineOnly)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
|
@ -150,7 +150,6 @@ private:
|
||||
f32 Length;
|
||||
|
||||
u32 Time;
|
||||
u32 Emitted;
|
||||
s32 MaxAngleDegrees;
|
||||
|
||||
bool OutlineOnly;
|
||||
|
@ -27,7 +27,7 @@ CParticleRingEmitter::CParticleRingEmitter(
|
||||
MaxParticlesPerSecond(maxParticlesPerSecond),
|
||||
MinStartColor(minStartColor), MaxStartColor(maxStartColor),
|
||||
MinLifeTime(lifeTimeMin), MaxLifeTime(lifeTimeMax),
|
||||
Time(0), Emitted(0), MaxAngleDegrees(maxAngleDegrees)
|
||||
Time(0), MaxAngleDegrees(maxAngleDegrees)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
setDebugName("CParticleRingEmitter");
|
||||
|
@ -136,7 +136,6 @@ private:
|
||||
u32 MinLifeTime, MaxLifeTime;
|
||||
|
||||
u32 Time;
|
||||
u32 Emitted;
|
||||
s32 MaxAngleDegrees;
|
||||
};
|
||||
|
||||
|
@ -27,7 +27,7 @@ CParticleSphereEmitter::CParticleSphereEmitter(
|
||||
MaxParticlesPerSecond(maxParticlesPerSecond),
|
||||
MinStartColor(minStartColor), MaxStartColor(maxStartColor),
|
||||
MinLifeTime(lifeTimeMin), MaxLifeTime(lifeTimeMax),
|
||||
Time(0), Emitted(0), MaxAngleDegrees(maxAngleDegrees)
|
||||
Time(0), MaxAngleDegrees(maxAngleDegrees)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
setDebugName("CParticleSphereEmitter");
|
||||
|
@ -129,7 +129,6 @@ private:
|
||||
u32 MinLifeTime, MaxLifeTime;
|
||||
|
||||
u32 Time;
|
||||
u32 Emitted;
|
||||
s32 MaxAngleDegrees;
|
||||
};
|
||||
|
||||
|
@ -2286,6 +2286,7 @@ IMeshWriter* CSceneManager::createMeshWriter(EMESH_WRITER_TYPE type)
|
||||
case EMWT_COLLADA:
|
||||
case EMWT_STL:
|
||||
case EMWT_OBJ:
|
||||
case EMWT_PLY:
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#include "IrrCompileConfig.h"
|
||||
|
||||
static const char* const copyright = "Irrlicht Engine (c) 2002-2012 Nikolaus Gebhardt";
|
||||
//static const char* const copyright = "Irrlicht Engine (c) 2002-2012 Nikolaus Gebhardt";
|
||||
|
||||
#ifdef _IRR_WINDOWS_
|
||||
#include <windows.h>
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Modify this file to change the last-modified date when you add/remove a file.
|
||||
# This will then trigger a new cmake run automatically.
|
||||
# This will then trigger a new cmake run automatically.
|
||||
file(GLOB_RECURSE STK_HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*.hpp")
|
||||
file(GLOB_RECURSE STK_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*.cpp")
|
||||
file(GLOB_RECURSE STK_SHADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "data/shaders/*")
|
||||
|
@ -50,9 +50,6 @@ private:
|
||||
/** The current time used in the IPOs. */
|
||||
float m_current_time;
|
||||
|
||||
/** For cyclic animations: duration of the cycle. */
|
||||
float m_cycle_length;
|
||||
|
||||
/** The inital position of this object. */
|
||||
Vec3 m_initial_xyz;
|
||||
|
||||
|
@ -257,7 +257,8 @@ void SFXManager::queueCommand(SFXCommand *command)
|
||||
race_manager->getMinorMode() != RaceManager::MINOR_MODE_CUTSCENE)
|
||||
{
|
||||
if(command->m_command==SFX_POSITION || command->m_command==SFX_LOOP ||
|
||||
command->m_command==SFX_SPEED )
|
||||
command->m_command==SFX_SPEED ||
|
||||
command->m_command==SFX_SPEED_POSITION )
|
||||
{
|
||||
delete command;
|
||||
static int count_messages = 0;
|
||||
|
@ -258,6 +258,14 @@ void STKConfig::getAllData(const XMLNode * root)
|
||||
steer_node->get("camera-follow-skid", &m_camera_follow_skid );
|
||||
}
|
||||
|
||||
if (const XMLNode *camera = root->getNode("camera"))
|
||||
{
|
||||
camera->get("fov-1", &m_camera_fov[0]);
|
||||
camera->get("fov-2", &m_camera_fov[1]);
|
||||
camera->get("fov-3", &m_camera_fov[2]);
|
||||
camera->get("fov-4", &m_camera_fov[3]);
|
||||
}
|
||||
|
||||
if (const XMLNode *music_node = root->getNode("music"))
|
||||
{
|
||||
std::string title_music;
|
||||
|
@ -140,6 +140,9 @@ public:
|
||||
* be generated. */
|
||||
float m_replay_delta_angle;
|
||||
|
||||
/** The field of view for 1, 2, 3, 4 player split screen. */
|
||||
float m_camera_fov[4];
|
||||
|
||||
private:
|
||||
/** True if stk_config has been loaded. This is necessary if the
|
||||
* --stk-config command line parameter has been specified to avoid
|
||||
|
@ -469,8 +469,6 @@ void draw2DVertexPrimitiveList(video::ITexture *tex, const void* vertices,
|
||||
|
||||
Primitive2DList::getInstance()->use();
|
||||
Primitive2DList::getInstance()->setUniforms();
|
||||
const video::SOverrideMaterial &m = irr_driver->getVideoDriver()
|
||||
->getOverrideMaterial();
|
||||
compressTexture(tex, false);
|
||||
Primitive2DList::getInstance()->setTextureUnits(getTextureGLuint(tex));
|
||||
glDrawElements(GL_TRIANGLE_FAN, primitiveCount, GL_UNSIGNED_SHORT, 0);
|
||||
|
@ -223,7 +223,7 @@ void Camera::setupCamera()
|
||||
irr_driver->getActualScreenSize().Width,
|
||||
irr_driver->getActualScreenSize().Height);
|
||||
m_scaling = core::vector2df(1.0f, 1.0f);
|
||||
m_fov = DEGREE_TO_RAD*75.0f;
|
||||
m_fov = DEGREE_TO_RAD*stk_config->m_camera_fov[0];
|
||||
break;
|
||||
case 2: m_viewport = core::recti(0,
|
||||
m_index==0 ? 0
|
||||
@ -233,7 +233,7 @@ void Camera::setupCamera()
|
||||
: irr_driver->getActualScreenSize().Height);
|
||||
m_scaling = core::vector2df(1.0f, 0.5f);
|
||||
m_aspect *= 2.0f;
|
||||
m_fov = DEGREE_TO_RAD*65.0f;
|
||||
m_fov = DEGREE_TO_RAD*stk_config->m_camera_fov[1];
|
||||
break;
|
||||
case 3:
|
||||
/*
|
||||
@ -266,7 +266,7 @@ void Camera::setupCamera()
|
||||
const int y2 = (m_index<2 ? irr_driver->getActualScreenSize().Height>>1 : irr_driver->getActualScreenSize().Height);
|
||||
m_viewport = core::recti(x1, y1, x2, y2);
|
||||
m_scaling = core::vector2df(0.5f, 0.5f);
|
||||
m_fov = DEGREE_TO_RAD*50.0f;
|
||||
m_fov = DEGREE_TO_RAD*stk_config->m_camera_fov[3];
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -464,7 +464,7 @@ void Camera::getCameraSettings(float *above_kart, float *cam_angle,
|
||||
{
|
||||
*above_kart = 0;
|
||||
*cam_angle = 0;
|
||||
*distance = -m_kart->getKartModel()->getLength();
|
||||
*distance = -m_kart->getKartModel()->getLength()-1.0f;
|
||||
}
|
||||
else if(UserConfigParams::m_camera_debug==4)
|
||||
{
|
||||
@ -549,6 +549,14 @@ void Camera::update(float dt)
|
||||
// - the kart should not be visible, but it works)
|
||||
m_camera->setNearValue(27.0);
|
||||
}
|
||||
else if (UserConfigParams::m_camera_debug==5)
|
||||
{
|
||||
core::vector3df xyz = m_kart->getXYZ().toIrrVector();
|
||||
Vec3 offset(3, 0, 0);
|
||||
offset = m_kart->getTrans()(offset);
|
||||
m_camera->setTarget(xyz);
|
||||
m_camera->setPosition(offset.toIrrVector());
|
||||
}
|
||||
// Update the first person camera
|
||||
else if (UserConfigParams::m_camera_debug == 3)
|
||||
{
|
||||
|
@ -329,7 +329,6 @@ private:
|
||||
void renderNormalsVisualisation();
|
||||
void renderTransparent();
|
||||
void renderParticles();
|
||||
void computeSunVisibility();
|
||||
void renderShadows();
|
||||
void renderRSM();
|
||||
void renderGlow(std::vector<GlowData>& glows);
|
||||
|
@ -77,12 +77,7 @@ int LODNode::getLevel()
|
||||
Camera* camera = Camera::getActiveCamera();
|
||||
if (camera == NULL)
|
||||
return (int)m_detail.size() - 1;
|
||||
AbstractKart* kart = camera->getKart();
|
||||
// use kart position and not camera position when a kart is available,
|
||||
// because for some effects the camera will be moved to various locations
|
||||
// (for instance shadows), so using camera position for LOD may result
|
||||
// in objects being culled when they shouldn't
|
||||
const Vec3 &pos = (kart != NULL ? kart->getFrontXYZ() : camera->getCameraSceneNode()->getAbsolutePosition());
|
||||
const Vec3 &pos = camera->getCameraSceneNode()->getAbsolutePosition();
|
||||
|
||||
const int dist =
|
||||
(int)((m_nodes[0]->getAbsolutePosition()).getDistanceFromSQ(pos.toIrrVector() ));
|
||||
@ -153,7 +148,7 @@ void LODNode::updateVisibility(bool* shown)
|
||||
|
||||
void LODNode::OnRegisterSceneNode()
|
||||
{
|
||||
bool shown;
|
||||
bool shown = false;
|
||||
updateVisibility(&shown);
|
||||
|
||||
const u32 now = irr_driver->getDevice()->getTimer()->getTime();
|
||||
|
@ -796,6 +796,8 @@ void Material::setMaterialProperties(video::SMaterial *m, scene::IMeshBuffer* m
|
||||
m->MaterialType = Shaders::getShader(ES_GRASS_REF);
|
||||
m->setTexture(1, glossytex);
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (!m->getTexture(0))
|
||||
|
@ -522,10 +522,6 @@ void IrrDriver::renderScene(scene::ICameraSceneNode * const camnode, unsigned po
|
||||
} // end glow
|
||||
PROFILER_POP_CPU_MARKER();
|
||||
|
||||
PROFILER_PUSH_CPU_MARKER("- Lensflare/godray", 0x00, 0xFF, 0xFF);
|
||||
computeSunVisibility();
|
||||
PROFILER_POP_CPU_MARKER();
|
||||
|
||||
// Render transparent
|
||||
{
|
||||
PROFILER_PUSH_CPU_MARKER("- Transparent Pass", 0xFF, 0x00, 0x00);
|
||||
@ -629,17 +625,6 @@ void IrrDriver::renderFixed(float dt)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void IrrDriver::computeSunVisibility()
|
||||
{
|
||||
// Is the lens flare enabled & visible? Check last frame's query.
|
||||
bool hasgodrays = false;
|
||||
|
||||
if (World::getWorld() != NULL)
|
||||
{
|
||||
hasgodrays = World::getWorld()->getTrack()->hasGodRays();
|
||||
}
|
||||
}
|
||||
|
||||
void IrrDriver::renderParticles()
|
||||
{
|
||||
glDepthMask(GL_FALSE);
|
||||
|
@ -53,7 +53,10 @@ public:
|
||||
}; // SkyboxShader
|
||||
|
||||
// ============================================================================
|
||||
static float getTexelValue(unsigned i, unsigned j, size_t width, size_t height,
|
||||
//***************************************************************************
|
||||
// Currently unused functions, they will be used later so please DON'T remove
|
||||
//***************************************************************************
|
||||
/*static float getTexelValue(unsigned i, unsigned j, size_t width, size_t height,
|
||||
float *Coeff, float *Y00, float *Y1minus1,
|
||||
float *Y10, float *Y11, float *Y2minus2,
|
||||
float * Y2minus1, float * Y20, float *Y21,
|
||||
@ -70,10 +73,10 @@ static float getTexelValue(unsigned i, unsigned j, size_t width, size_t height,
|
||||
+ Y21[idx] * Coeff[7] + Y22[idx] * Coeff[8];
|
||||
reconstructedVal /= solidangle;
|
||||
return MAX2(255.0f * reconstructedVal, 0.f);
|
||||
} // getTexelValue
|
||||
}*/ // getTexelValue
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
static void unprojectSH(float *output[], size_t width, size_t height,
|
||||
/*static void unprojectSH(float *output[], size_t width, size_t height,
|
||||
float *Y00[], float *Y1minus1[], float *Y10[],
|
||||
float *Y11[], float *Y2minus2[], float *Y2minus1[],
|
||||
float * Y20[], float *Y21[], float *Y22[],
|
||||
@ -108,16 +111,16 @@ static void unprojectSH(float *output[], size_t width, size_t height,
|
||||
}
|
||||
}
|
||||
}
|
||||
} // unprojectSH
|
||||
}*/ // unprojectSH
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
static void displayCoeff(float *SHCoeff)
|
||||
/*static void displayCoeff(float *SHCoeff)
|
||||
{
|
||||
printf("L00:%f\n", SHCoeff[0]);
|
||||
printf("L1-1:%f, L10:%f, L11:%f\n", SHCoeff[1], SHCoeff[2], SHCoeff[3]);
|
||||
printf("L2-2:%f, L2-1:%f, L20:%f, L21:%f, L22:%f\n",
|
||||
SHCoeff[4], SHCoeff[5], SHCoeff[6], SHCoeff[7], SHCoeff[8]);
|
||||
} // displayCoeff
|
||||
}*/ // displayCoeff
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void swapPixels(char *old_img, char *new_img, unsigned stride, unsigned old_i,
|
||||
|
@ -64,7 +64,7 @@ private:
|
||||
|
||||
bool m_diffuse_coefficients_calculated;
|
||||
|
||||
unsigned shadowColorTex, shadowNormalTex, shadowDepthTex;
|
||||
unsigned shadowColorTex, shadowDepthTex;
|
||||
unsigned RSM_Color, RSM_Normal, RSM_Depth;
|
||||
unsigned RH_Red, RH_Green, RH_Blue;
|
||||
FrameBuffer* m_shadow_FBO, *m_RSM, *m_RH_FBO;
|
||||
|
@ -18,23 +18,28 @@
|
||||
|
||||
#include "graphics/shadow.hpp"
|
||||
#include "graphics/irr_driver.hpp"
|
||||
#include "karts/kart_properties.hpp"
|
||||
|
||||
#include <IMesh.h>
|
||||
#include <IMeshSceneNode.h>
|
||||
#include <ISceneNode.h>
|
||||
|
||||
Shadow::Shadow(video::ITexture *texture, scene::ISceneNode *node,
|
||||
float scale = 1.0, float x_offset = 0.0, float y_offset = 0.0,
|
||||
float z_offset = 0.0)
|
||||
Shadow::Shadow(const KartProperties *kart_properties,
|
||||
scene::ISceneNode *node,
|
||||
float y_offset = 0.0)
|
||||
{
|
||||
m_shadow_enabled = false;
|
||||
video::SMaterial m;
|
||||
m.setTexture(0, texture);
|
||||
m.setTexture(0, kart_properties->getShadowTexture());
|
||||
m.BackfaceCulling = false;
|
||||
m.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
||||
m.setFlag(video::EMF_ZWRITE_ENABLE , false);
|
||||
m_mesh = irr_driver->createQuadMesh(&m, /*create_one_quad*/true);
|
||||
scene::IMeshBuffer *buffer = m_mesh->getMeshBuffer(0);
|
||||
irr::video::S3DVertex* v=(video::S3DVertex*)buffer->getVertices();
|
||||
float scale = kart_properties->getShadowScale();
|
||||
float x_offset = kart_properties->getShadowXOffset();
|
||||
float z_offset = kart_properties->getShadowXOffset();
|
||||
v[0].Pos.X = -scale+x_offset; v[0].Pos.Z = scale+z_offset; v[0].Pos.Y = 0.01f-y_offset;
|
||||
v[1].Pos.X = scale+x_offset; v[1].Pos.Z = scale+z_offset; v[1].Pos.Y = 0.01f-y_offset;
|
||||
v[2].Pos.X = scale+x_offset; v[2].Pos.Z = -scale+z_offset; v[2].Pos.Y = 0.01f-y_offset;
|
||||
@ -70,18 +75,17 @@ Shadow::~Shadow()
|
||||
} // ~Shadow
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Removes the shadow, used for the simplified shadow when the kart is in
|
||||
* the air.
|
||||
/** Updates the simulated shadow. It takes the offset (distance from visual
|
||||
* chassis to ground) to position the shadow quad exactly on the ground.
|
||||
* It also disables the shadow if requested (e.g. if the kart is in the air).
|
||||
* \param enabled If the shadow should be shown or not.
|
||||
* \param offset Distance from visual chassis to ground = position of the
|
||||
* shadow to make sure it is exactly on the ground.
|
||||
*/
|
||||
void Shadow::disableShadow()
|
||||
void Shadow::update(bool enabled, float offset)
|
||||
{
|
||||
m_node->setVisible(false);
|
||||
}
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Enables the shadow again, after it was disabled with disableShadow().
|
||||
*/
|
||||
void Shadow::enableShadow()
|
||||
{
|
||||
m_node->setVisible(true);
|
||||
}
|
||||
// ----------------------------------------------------------------------------
|
||||
m_node->setVisible(enabled);
|
||||
core::vector3df pos = m_node->getPosition();
|
||||
pos.Y = offset;
|
||||
m_node->setPosition(pos);
|
||||
} // update
|
@ -21,7 +21,7 @@
|
||||
|
||||
#include "utils/no_copy.hpp"
|
||||
|
||||
#include <string>
|
||||
class KartProperties;
|
||||
|
||||
namespace irr
|
||||
{
|
||||
@ -41,19 +41,24 @@ class Shadow : public NoCopy
|
||||
private:
|
||||
/** The scene node for the shadow. */
|
||||
scene::ISceneNode *m_node;
|
||||
|
||||
/** The mesh of the shadow. */
|
||||
scene::IMesh *m_mesh;
|
||||
|
||||
/** The scene node of the kart to which this shadow belongs. */
|
||||
scene::ISceneNode *m_parent_kart_node;
|
||||
|
||||
/** If a kart is flying, the shadow is disabled (since it is
|
||||
* stuck to the kart, i.e. the shadow would be flying, too). */
|
||||
bool m_shadow_enabled;
|
||||
|
||||
public:
|
||||
Shadow(video::ITexture *texture, scene::ISceneNode *node,
|
||||
float scale, float x_offset, float y_offset,float z_offset);
|
||||
Shadow(const KartProperties *kart_properties,
|
||||
scene::ISceneNode *node, float y_offset);
|
||||
~Shadow();
|
||||
void enableShadow();
|
||||
void disableShadow();
|
||||
void update(bool enabled, float hot);
|
||||
}; // Shadow
|
||||
#endif
|
||||
|
||||
/* EOF */
|
||||
|
||||
|
||||
|
@ -55,9 +55,6 @@ private:
|
||||
/** For debugging: a simple quad to display where slipstream works. */
|
||||
scene::IMesh *m_debug_mesh;
|
||||
|
||||
/** The texture matrix for the slipstream effect. */
|
||||
core::matrix4 *m_matrix;
|
||||
|
||||
/** The length of the slipstream cylinder. This is used to scale
|
||||
* the actual scene node correctly. */
|
||||
float m_length;
|
||||
|
@ -1192,8 +1192,6 @@ namespace GUIEngine
|
||||
// further render)
|
||||
g_env->drawAll();
|
||||
|
||||
MessageQueue::update(elapsed_time);
|
||||
|
||||
// ---- some menus may need updating
|
||||
if (gamestate != GAME)
|
||||
{
|
||||
@ -1215,6 +1213,7 @@ namespace GUIEngine
|
||||
}
|
||||
}
|
||||
|
||||
MessageQueue::update(elapsed_time);
|
||||
|
||||
if (gamestate == INGAME_MENU && dynamic_cast<CutsceneWorld*>(World::getWorld()) != NULL)
|
||||
{
|
||||
|
@ -1267,6 +1267,12 @@ void Skin::drawSpinnerBody(const core::recti &rect, Widget* widget,
|
||||
params=&SkinConfig::m_render_params["spinner3::neutral"];
|
||||
else if(player_id==3)
|
||||
params=&SkinConfig::m_render_params["spinner4::neutral"];
|
||||
else
|
||||
{
|
||||
Log::fatal("Skin::drawSpinnerBody", "Unknown playerID (more than 4 players?)");
|
||||
// Silence compiler warning
|
||||
params = NULL;
|
||||
}
|
||||
}
|
||||
else if (widget->m_deactivated)
|
||||
{
|
||||
|
@ -26,7 +26,7 @@ CGUISTKListBox::CGUISTKListBox(IGUIEnvironment* environment, IGUIElement* parent
|
||||
: IGUIElement(EGUIET_LIST_BOX, environment, parent, id, rectangle), Selected(-1),
|
||||
ItemHeight(0),ItemHeightOverride(0),
|
||||
TotalItemHeight(0), ItemsIconWidth(0), Font(0), IconBank(0),
|
||||
ScrollBar(0), selectTime(0), LastKeyTime(0), Selecting(false), DrawBack(drawBack),
|
||||
ScrollBar(0), selectTime(0), Selecting(false), DrawBack(drawBack),
|
||||
MoveOverSelect(moveOverSelect), AutoScroll(true), HighlightWhenNotFocused(true)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
|
@ -182,7 +182,6 @@ namespace irr
|
||||
gui::IGUISpriteBank* IconBank;
|
||||
gui::IGUIScrollBar* ScrollBar;
|
||||
u32 selectTime;
|
||||
u32 LastKeyTime;
|
||||
core::stringw KeyBuffer;
|
||||
bool Selecting;
|
||||
bool DrawBack;
|
||||
|
@ -167,11 +167,34 @@ void IconButtonWidget::add()
|
||||
|
||||
if (m_properties[PROP_LABELS_LOCATION] == "hover")
|
||||
{
|
||||
widget_size = rect<s32>(m_x - label_extra_size/2,
|
||||
m_y - (word_wrap ? GUIEngine::getFontHeight()*2 :
|
||||
GUIEngine::getFontHeight()) - 15,
|
||||
m_x + m_w + label_extra_size/2,
|
||||
m_y - 15);
|
||||
core::dimension2du text_size = GUIEngine::getFont()->getDimension(message.c_str());
|
||||
core::recti pos = btn->getAbsolutePosition();
|
||||
int center_x = pos.UpperLeftCorner.X + pos.getWidth() / 2;
|
||||
int x1 = center_x - text_size.Width / 2 - label_extra_size / 2;
|
||||
int y1 = pos.UpperLeftCorner.Y - (word_wrap ? GUIEngine::getFontHeight() * 2 :
|
||||
GUIEngine::getFontHeight()) - 15;
|
||||
int x2 = center_x + text_size.Width / 2 + label_extra_size / 2;
|
||||
int y2 = pos.UpperLeftCorner.Y - 15;
|
||||
|
||||
if (x1 < 0)
|
||||
{
|
||||
int diff = -x1;
|
||||
x1 += diff;
|
||||
x2 += diff;
|
||||
}
|
||||
else if (x2 > irr_driver->getActualScreenSize().Width)
|
||||
{
|
||||
int diff = x2 - irr_driver->getActualScreenSize().Width;
|
||||
x2 -= diff;
|
||||
x1 -= diff;
|
||||
}
|
||||
|
||||
core::recti parent_pos = m_parent->getAbsolutePosition();
|
||||
x1 -= parent_pos.UpperLeftCorner.X;
|
||||
x2 -= parent_pos.UpperLeftCorner.X;
|
||||
y1 -= parent_pos.UpperLeftCorner.Y;
|
||||
y2 -= parent_pos.UpperLeftCorner.Y;
|
||||
widget_size = rect<s32>(x1, y1, x2, y2);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -105,21 +105,8 @@ void LabelWidget::add()
|
||||
m_element->setTabStop(false);
|
||||
m_element->setTabGroup(false);
|
||||
|
||||
if (m_scroll_speed > 0)
|
||||
{
|
||||
IGUIFont* font = m_title_font ? GUIEngine::getTitleFont()
|
||||
: GUIEngine::getFont();
|
||||
core::dimension2du r = font->getDimension(getText().c_str());
|
||||
|
||||
//m_scroll_offset = (float)r.Width;
|
||||
|
||||
// start scrolled off
|
||||
m_scroll_offset = -999;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_scroll_speed <= 0)
|
||||
m_element->setNotClipped(true);
|
||||
}
|
||||
} // add
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -139,16 +126,11 @@ void LabelWidget::setText(const wchar_t *text, bool expandIfNeeded)
|
||||
rect.LowerRightCorner.X = rect.UpperLeftCorner.X + fwidth;
|
||||
m_element->setRelativePosition(rect);
|
||||
m_element->updateAbsolutePosition();
|
||||
|
||||
//((IGUIStaticText*)m_element)->setBackgroundColor( video::SColor(255,255,0,0) );
|
||||
}
|
||||
}
|
||||
|
||||
if (m_scroll_speed > 0)
|
||||
{
|
||||
//m_scroll_offset = (float)m_element->getAbsolutePosition().getWidth();
|
||||
m_scroll_offset = (float)m_w;
|
||||
}
|
||||
|
||||
Widget::setText(text);
|
||||
if (m_element)
|
||||
@ -181,7 +163,6 @@ bool LabelWidget::scrolledOff() const
|
||||
|
||||
void LabelWidget::setScrollSpeed(float speed)
|
||||
{
|
||||
//m_scroll_offset = 0;
|
||||
m_scroll_speed = speed;
|
||||
} // setScrollSpeed
|
||||
|
||||
|
@ -43,7 +43,10 @@ namespace GUIEngine
|
||||
|
||||
/** Current scroll offset. */
|
||||
float m_scroll_offset;
|
||||
|
||||
|
||||
// Hide overloaded methods
|
||||
using Widget::setText;
|
||||
|
||||
public:
|
||||
|
||||
LEAK_CHECK()
|
||||
|
@ -50,8 +50,6 @@ namespace GUIEngine
|
||||
AlignedArray<Vec3> m_model_scale;
|
||||
std::vector<int> m_model_frames;
|
||||
|
||||
video::ITexture* m_texture;
|
||||
|
||||
RTT* m_rtt_provider;
|
||||
|
||||
float angle;
|
||||
|
@ -30,8 +30,6 @@
|
||||
#include "states_screens/kart_selection.hpp"
|
||||
#include <IGUIEnvironment.h>
|
||||
|
||||
static const char RANDOM_KART_ID[] = "randomkart";
|
||||
|
||||
using namespace GUIEngine;
|
||||
|
||||
PlayerKartWidget::PlayerKartWidget(KartSelectionScreen* parent,
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#include "items/flyable.hpp"
|
||||
|
||||
#include <math.h>
|
||||
#include <cmath>
|
||||
|
||||
#include <IMeshManipulator.h>
|
||||
#include <IMeshSceneNode.h>
|
||||
@ -231,7 +231,7 @@ void Flyable::getClosestKart(const AbstractKart **minKart,
|
||||
Vec3 delta = t.getOrigin()-trans_projectile.getOrigin();
|
||||
// the Y distance is added again because karts above or below should//
|
||||
// not be prioritized when aiming
|
||||
float distance2 = delta.length2() + abs(t.getOrigin().getY()
|
||||
float distance2 = delta.length2() + std::abs(t.getOrigin().getY()
|
||||
- trans_projectile.getOrigin().getY())*2;
|
||||
|
||||
if(inFrontOf != NULL)
|
||||
|
@ -374,7 +374,7 @@ void Item::collected(const AbstractKart *kart, float t)
|
||||
|
||||
if (m_listener != NULL)
|
||||
{
|
||||
m_listener->onTriggerItemApproached(this);
|
||||
m_listener->onTriggerItemApproached();
|
||||
}
|
||||
|
||||
if (dynamic_cast<ThreeStrikesBattle*>(World::getWorld()) != NULL)
|
||||
|
@ -51,7 +51,7 @@ class TriggerItemListener
|
||||
{
|
||||
public:
|
||||
virtual ~TriggerItemListener() {}
|
||||
virtual void onTriggerItemApproached(Item* who) = 0;
|
||||
virtual void onTriggerItemApproached() = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -58,8 +58,6 @@ Plunger::Plunger(AbstractKart *kart)
|
||||
|
||||
btTransform kart_transform = kart->getAlignedTransform();
|
||||
btMatrix3x3 kart_rotation = kart_transform.getBasis();
|
||||
// The current forward vector is rotation*(0,0,1), or:
|
||||
btVector3 forward(kart_rotation.getColumn(2));
|
||||
|
||||
float heading =kart->getHeading();
|
||||
float pitch = kart->getTerrainPitch(heading);
|
||||
|
@ -199,7 +199,7 @@ private:
|
||||
enum {PSA_DEFAULT, PSA_FIXED, PSA_NEW}
|
||||
m_point_selection_algorithm;
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef AI_DEBUG
|
||||
/** For skidding debugging: shows the estimated turn shape. */
|
||||
ShowCurve **m_curve;
|
||||
|
||||
|
@ -62,6 +62,7 @@
|
||||
#include "physics/btKartRaycast.hpp"
|
||||
#include "physics/physics.hpp"
|
||||
#include "race/history.hpp"
|
||||
#include "tracks/terrain_info.hpp"
|
||||
#include "tracks/track.hpp"
|
||||
#include "tracks/track_manager.hpp"
|
||||
#include "utils/constants.hpp"
|
||||
@ -74,7 +75,7 @@
|
||||
|
||||
#include <algorithm> // for min and max
|
||||
#include <iostream>
|
||||
#include <math.h>
|
||||
#include <cmath>
|
||||
|
||||
|
||||
#if defined(WIN32) && !defined(__CYGWIN__) && !defined(__MINGW32__)
|
||||
@ -117,7 +118,6 @@ Kart::Kart (const std::string& ident, unsigned int world_kart_id,
|
||||
m_bubblegum_torque = 0.0f;
|
||||
m_invulnerable_time = 0.0f;
|
||||
m_squash_time = 0.0f;
|
||||
m_shadow_enabled = false;
|
||||
|
||||
m_shadow = NULL;
|
||||
m_wheel_box = NULL;
|
||||
@ -144,8 +144,6 @@ Kart::Kart (const std::string& ident, unsigned int world_kart_id,
|
||||
// Set position and heading:
|
||||
m_reset_transform = init_transform;
|
||||
m_speed = 0.0f;
|
||||
m_wheel_rotation = 0;
|
||||
m_wheel_rotation_dt = 0;
|
||||
|
||||
m_kart_model->setKart(this);
|
||||
|
||||
@ -349,7 +347,6 @@ void Kart::reset()
|
||||
m_node->setScale(core::vector3df(1.0f, 1.0f, 1.0f));
|
||||
m_collected_energy = 0;
|
||||
m_has_started = false;
|
||||
m_wheel_rotation = 0;
|
||||
m_bounce_back_time = 0.0f;
|
||||
m_brake_time = 0.0f;
|
||||
m_time_last_crash = 0.0f;
|
||||
@ -387,22 +384,6 @@ void Kart::reset()
|
||||
{
|
||||
m_vehicle->reset();
|
||||
}
|
||||
// Randomize wheel rotation if needed
|
||||
if (m_kart_properties->hasRandomWheels() && m_vehicle && m_kart_model)
|
||||
{
|
||||
scene::ISceneNode** graphic_wheels = m_kart_model->getWheelNodes();
|
||||
// FIXME Hardcoded i < 4 comes from the arrays in KartModel
|
||||
for (int i = 0; i < m_vehicle->getNumWheels() && i < 4; i++)
|
||||
{
|
||||
// Physics
|
||||
btWheelInfo& wheel = m_vehicle->getWheelInfo(i);
|
||||
wheel.m_rotation = btScalar(rand() % 360);
|
||||
// And graphics
|
||||
core::vector3df wheel_rotation(wheel.m_rotation, 0, 0);
|
||||
if (graphic_wheels[i])
|
||||
graphic_wheels[i]->setRotation(wheel_rotation);
|
||||
} // for wheels
|
||||
} // if random wheel rotation
|
||||
|
||||
setTrans(m_reset_transform);
|
||||
|
||||
@ -420,7 +401,7 @@ void Kart::reset()
|
||||
Vec3 front(0, 0, getKartLength()*0.5f);
|
||||
m_xyz_front = getTrans()(front);
|
||||
|
||||
m_terrain_info->update(getTrans());
|
||||
m_terrain_info->update(getTrans().getBasis());
|
||||
|
||||
// Reset is also called when the kart is created, at which time
|
||||
// m_controller is not yet defined, so this has to be tested here.
|
||||
@ -625,17 +606,12 @@ void Kart::createPhysics()
|
||||
// All wheel positions are relative to the center of
|
||||
// the collision shape.
|
||||
wheel_pos[index].setX(x*0.5f*kart_width);
|
||||
float radius = m_characteristic->getWheelsRadius();
|
||||
// The y position of the wheels (i.e. the points where
|
||||
// the suspension is attached to) is just at the
|
||||
// bottom of the kart. That is half the kart height
|
||||
// down. The wheel radius is added to the suspension
|
||||
// length in the physics, so we move the connection
|
||||
// point 'radius' up. That means that if the suspension
|
||||
// is fully compressed (0), the wheel will just be at
|
||||
// the bottom of the kart chassis and touch the ground
|
||||
wheel_pos[index].setY(- 0.5f*kart_height + radius);
|
||||
wheel_pos[index].setZ((0.5f*kart_length - radius)* z);
|
||||
// down.
|
||||
wheel_pos[index].setY(- 0.5f*kart_height);
|
||||
wheel_pos[index].setZ((0.5f*kart_length-0.25f)* z);
|
||||
|
||||
}
|
||||
else
|
||||
@ -690,14 +666,13 @@ void Kart::createPhysics()
|
||||
|
||||
// Add wheels
|
||||
// ----------
|
||||
float wheel_radius = m_characteristic->getWheelsRadius();
|
||||
float suspension_rest = m_characteristic->getSuspensionRest();
|
||||
|
||||
btVector3 wheel_direction(0.0f, -1.0f, 0.0f);
|
||||
btVector3 wheel_axle(-1.0f, 0.0f, 0.0f);
|
||||
|
||||
btKart::btVehicleTuning tuning;
|
||||
tuning.m_maxSuspensionTravelCm =
|
||||
tuning.m_maxSuspensionTravel =
|
||||
m_characteristic->getSuspensionTravelCm();
|
||||
tuning.m_maxSuspensionForce =
|
||||
m_characteristic->getSuspensionMaxForce();
|
||||
@ -709,7 +684,8 @@ void Kart::createPhysics()
|
||||
btWheelInfo& wheel = m_vehicle->addWheel(
|
||||
wheel_pos[i]+cs,
|
||||
wheel_direction, wheel_axle, suspension_rest,
|
||||
wheel_radius, tuning, is_front_wheel);
|
||||
m_kart_model->getWheelGraphicsRadius(i),
|
||||
tuning, is_front_wheel);
|
||||
wheel.m_suspensionStiffness = m_characteristic->getSuspensionStiffness();
|
||||
wheel.m_wheelsDampingRelaxation = m_characteristic->getWheelsDampingRelaxation();
|
||||
wheel.m_wheelsDampingCompression = m_characteristic->getWheelsDampingCompression();
|
||||
@ -1227,11 +1203,6 @@ void Kart::update(float dt)
|
||||
m_characteristic->getStabilityChassisAngularDamping());
|
||||
}
|
||||
|
||||
//m_wheel_rotation gives the rotation around the X-axis
|
||||
m_wheel_rotation_dt = m_speed*dt / m_characteristic->getWheelsRadius();
|
||||
m_wheel_rotation += m_wheel_rotation_dt;
|
||||
m_wheel_rotation = fmodf(m_wheel_rotation, 2*M_PI);
|
||||
|
||||
if(m_kart_animation)
|
||||
m_kart_animation->update(dt);
|
||||
|
||||
@ -1281,14 +1252,6 @@ void Kart::update(float dt)
|
||||
new RescueAnimation(this, /*is_auto_rescue*/true);
|
||||
}
|
||||
|
||||
// Add a certain epsilon (0.3) to the height of the kart. This avoids
|
||||
// problems of the ray being cast from under the track (which happened
|
||||
// e.g. on tux tollway when jumping down from the ramp, when the chassis
|
||||
// partly tunnels through the track). While tunneling should not be
|
||||
// happening (since Z velocity is clamped), the epsilon is left in place
|
||||
// just to be on the safe side (it will not hit the chassis itself).
|
||||
Vec3 epsilon(0,0.3f,0);
|
||||
|
||||
// Make sure that the ray doesn't hit the kart. This is done by
|
||||
// resetting the collision filter group, so that this collision
|
||||
// object is ignored during raycasting.
|
||||
@ -1302,7 +1265,34 @@ void Kart::update(float dt)
|
||||
Vec3 front(0, 0, getKartLength()*0.5f);
|
||||
m_xyz_front = getTrans()(front);
|
||||
|
||||
m_terrain_info->update(getTrans(), epsilon);
|
||||
// After the physics step was done, the position of the wheels (as stored
|
||||
// in wheelInfo) is actually outdated, since the chassis was moved
|
||||
// according to the force acting from the wheels. So the cnter of the
|
||||
// chassis is not at the center of the wheels anymore, it is somewhat
|
||||
// moved forward (depending on speed and fps). In very extreme cases
|
||||
// (see bug 2246) the center of the chassis can actually be ahead of the
|
||||
// front wheels. So if we do a raycast to detect the terrain from the
|
||||
// current chassis, that raycast might be ahead of the wheels - which
|
||||
// results in incorrect rescues (the wheels are still on the ground,
|
||||
// but the raycast happens ahead of the front wheels and are over
|
||||
// a rescue texture).
|
||||
// To avoid this problem, we do the raycast for terrain detection from
|
||||
// the center of the 4 wheel positions (in world coordinates).
|
||||
|
||||
Vec3 from(0, 0, 0);
|
||||
for (unsigned int i = 0; i < 4; i++)
|
||||
from += m_vehicle->getWheelInfo(i).m_raycastInfo.m_hardPointWS;
|
||||
|
||||
// Add a certain epsilon (0.3) to the height of the kart. This avoids
|
||||
// problems of the ray being cast from under the track (which happened
|
||||
// e.g. on tux tollway when jumping down from the ramp, when the chassis
|
||||
// partly tunnels through the track). While tunneling should not be
|
||||
// happening (since Z velocity is clamped), the epsilon is left in place
|
||||
// just to be on the safe side (it will not hit the chassis itself).
|
||||
from = from/4 + Vec3(0,0.3f,0);
|
||||
|
||||
m_terrain_info->update(getTrans().getBasis(), from);
|
||||
|
||||
if(m_body->getBroadphaseHandle())
|
||||
{
|
||||
m_body->getBroadphaseHandle()->m_collisionFilterGroup = old_group;
|
||||
@ -1440,21 +1430,6 @@ void Kart::update(float dt)
|
||||
}
|
||||
}
|
||||
|
||||
//const bool dyn_shadows = World::getWorld()->getTrack()->hasShadows() &&
|
||||
// UserConfigParams::m_shadows &&
|
||||
// irr_driver->isGLSL();
|
||||
|
||||
// Disable the fake shadow if we're flying
|
||||
if(m_shadow && (!isOnGround() || emergency) && m_shadow_enabled)
|
||||
{
|
||||
m_shadow_enabled = false;
|
||||
m_shadow->disableShadow();
|
||||
}
|
||||
if(m_shadow && !m_shadow_enabled && isOnGround() && !emergency)
|
||||
{
|
||||
m_shadow->enableShadow();
|
||||
m_shadow_enabled = true;
|
||||
}
|
||||
} // update
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -2326,7 +2301,7 @@ void Kart::updateEnginePowerAndBrakes(float dt)
|
||||
|
||||
// If not giving power (forward or reverse gear), and speed is low
|
||||
// we are "parking" the kart, so in battle mode we can ambush people
|
||||
if(abs(m_speed) < 5.0f)
|
||||
if(std::abs(m_speed) < 5.0f)
|
||||
m_vehicle->setAllBrakes(20.0f);
|
||||
} // !m_brake
|
||||
} // not accelerating
|
||||
@ -2481,12 +2456,8 @@ void Kart::loadData(RaceManager::KartType type, bool is_animated_model)
|
||||
|
||||
if (!CVS->supportsShadows())
|
||||
{
|
||||
m_shadow = new Shadow(m_kart_properties->getShadowTexture(),
|
||||
m_node,
|
||||
m_kart_properties->getShadowScale(),
|
||||
m_kart_properties->getShadowXOffset(),
|
||||
m_kart_properties->getGraphicalYOffset(),
|
||||
m_kart_properties->getShadowZOffset());
|
||||
m_shadow = new Shadow(m_kart_properties, m_node,
|
||||
-m_kart_model->getLowestPoint());
|
||||
}
|
||||
World::getWorld()->kartAdded(this, m_node);
|
||||
} // loadData
|
||||
@ -2520,11 +2491,12 @@ void Kart::applyEngineForce(float force)
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Computes the transform of the graphical kart chasses with regards to the
|
||||
* physical chassis. This function is called once the kart comes to rest
|
||||
* before the race starts. Based on the current physical kart position, it
|
||||
* computes an (at this stage Y-only) offset by which the graphical chassis
|
||||
* is moved so that it appears the way it is designed in blender. This means
|
||||
* that the distance of the wheels from the chassis (i.e. suspension) appears
|
||||
* as in blender when karts are in rest.
|
||||
* before the race starts (see World::resetAllKarts). Based on the current
|
||||
* physical kart position it computes an (at this stage Y-only) offset by
|
||||
* which the graphical chassis is moved so that it appears the way it is
|
||||
* designed in blender. This means that the distance of the wheels from the
|
||||
* chassis (i.e. suspension) appears as in blender when karts are in rest.
|
||||
* See updateGraphics for more details.
|
||||
*/
|
||||
void Kart::kartIsInRestNow()
|
||||
{
|
||||
@ -2533,21 +2505,116 @@ void Kart::kartIsInRestNow()
|
||||
for(int i=0; i<m_vehicle->getNumWheels(); i++)
|
||||
{
|
||||
const btWheelInfo &wi = m_vehicle->getWheelInfo(i);
|
||||
f += wi.m_chassisConnectionPointCS.getY()
|
||||
- wi.m_raycastInfo.m_suspensionLength - wi.m_wheelsRadius;
|
||||
f += wi.m_raycastInfo.m_suspensionLength;
|
||||
}
|
||||
m_graphical_y_offset = f/m_vehicle->getNumWheels()
|
||||
+ getKartProperties()->getGraphicalYOffset();
|
||||
|
||||
// The offset 'lowest point' is added to avoid that the
|
||||
// visual chassis appears in the ground (it could be any
|
||||
// constant, there is no real reason to use the lowest point
|
||||
// but that value has worked good in the past). See documentation
|
||||
// for updateGraphics() for full details.
|
||||
m_graphical_y_offset = -f / m_vehicle->getNumWheels()
|
||||
+ m_kart_model->getLowestPoint();
|
||||
|
||||
m_kart_model->setDefaultSuspension();
|
||||
} // kartIsInRestNow
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Updates the graphics model. Mainly set the graphical position to be the
|
||||
* same as the physics position, but uses offsets to position and rotation
|
||||
* for special gfx effects (e.g. skidding will turn the karts more). These
|
||||
* variables are actually not used here atm, but are defined here and then
|
||||
* used in Moveable.
|
||||
/** Updates the graphics model. It is responsible for positioning the graphical
|
||||
* chasses at an 'appropriate' position: typically, the physical model has
|
||||
* much longer suspension, so if the graphical chassis would be at the same
|
||||
* location as the physical chassis, the wheels would be too far away.
|
||||
* Instead the default suspension length is saved once the kart have been
|
||||
* settled at start up (see World::resetAllKarts, which just runs several
|
||||
* physics-only simulation steps so that karts come to a rest). Then at
|
||||
* race time, only the difference between the current suspension length and
|
||||
* this default suspension length is used. The graphical kart chassis will be
|
||||
* offset so that when the kart is in rest, i.e. suspension length ==
|
||||
* default suspension length, the kart will look the way it was modelled in
|
||||
* blender. To explain the various offsets used, here a view from the side
|
||||
* focusing on the Y axis only (X/Z position of the graphical chassis is
|
||||
* identical to the physical chassis):
|
||||
*
|
||||
* Y| | visual kart | physical kart
|
||||
* | | |
|
||||
* | | |
|
||||
* | | |
|
||||
* | | +-------------COG---------------
|
||||
* | | :
|
||||
* | +---------low------ :
|
||||
* | O :
|
||||
* +--------------------------------------------------------------------------
|
||||
* X
|
||||
* 'O' : visual wheel ':' : raycast from physics
|
||||
* 'low' : lowest Y coordinate of COG : Center of gravity (at bottom of
|
||||
* model chassis)
|
||||
*
|
||||
* The visual kart is stored so that if it is shown at (0,0,0) it would be
|
||||
* the same as in blender. This on the other hand means, if the kart is shown
|
||||
* at the position of the physical chassis (which is at COG in the picture
|
||||
* above), the kart and its wheels would be floating in the air (exactly by
|
||||
* as much as the suspension length), and the wheels would be exactly at the
|
||||
* bottom of the physical chassis (i.e. just on the plane going through COG
|
||||
* and parallel to the ground).
|
||||
* If we want to align the visual chassis to be the same as the physical
|
||||
* chassis, we would need to subtract 'low' from the physical position.
|
||||
* If the kart is then displayed at COG.y-low, the bottom of the kart (which
|
||||
* is at 'low' above ground) would be at COG.y-low + low = COG.y --> visual
|
||||
* and physical chassis are identical.
|
||||
*
|
||||
* Unfortunately, the suspension length used in the physics is much too high,
|
||||
* the karts would be way above their wheels, basically disconneccted
|
||||
* (typical physical suspension length is around 0.28, while the distance
|
||||
* between wheel and chassis in blender is in the order of 0.10 --> so there
|
||||
* would be an additional distance of around 0.18 between wheel chassis as
|
||||
* designed in blender and in stk - even more if the kart is driving downhill
|
||||
* when the suspension extends further to keep contact with the ground).
|
||||
* To make the visuals look closer to what they are in blender, an additional
|
||||
* offset is added: before the start of a race the physics simulation is run
|
||||
* to find a stable position for each kart (see World::resetAllKarts). Once
|
||||
* a kart is stable, we save this suspension length in m_graphical_y_offset.
|
||||
* This offset is subtracted from the COG of the kart. So if the kart is in
|
||||
* rest (i.e. suspenion == default_suspension == m_graphical_y_offset),
|
||||
* The kart is showen exactly at the same height above ground as it is in
|
||||
* blender. If the suspension is shorter by DY (because the kart is
|
||||
* accelerating, the ground goes up, ...), the visual chassis is lowered by
|
||||
* DY as well.
|
||||
*
|
||||
* While the above algorithm indeed results in the right position of the
|
||||
* visual chassis, in reality the visual chassis is too low. For example,
|
||||
* nolok's chassis has its lowest point at the rear at around 0.10 above the
|
||||
* ground (and the lowest point overall is 0.05, though this is at the front
|
||||
* and so not easily visible), so if the suspension is compressed by more than
|
||||
* that, the chassiswill appear to be in the ground. Testing on the sand track
|
||||
* shows that the suspension is compressed by 0.12 (and up to 0.16 in some
|
||||
* extreme points), which means that the chassis will appear to be in the
|
||||
* ground quite easily. Therefore the chassis is actually moved up a bit to
|
||||
* avoid this problem. Historically (due to never sorting out that formula
|
||||
* properly) the chassis was moved twice as high as its lowest point, e.g.
|
||||
* nolok's lowest point is at 0.05, so the whole chassis was raised by 0.05
|
||||
* (this was not done by design, but because of a bug ;) ). Since this visual
|
||||
* offset has worked well in the past, the visual chassis is moved by the
|
||||
* same amount higher.
|
||||
*
|
||||
* Of course this means that the Y position of the wheels (relative to the
|
||||
* visual kart chassis) needs to be adjusted: if the kart is in rest, the
|
||||
* wheels are exactly on the ground. If the suspension is shorter, that wheel
|
||||
* would appear to be partly in the ground, and if the suspension is longer,
|
||||
* the wheel would not touch the ground.
|
||||
*
|
||||
* The wheels must be offset by how much the current suspension length is
|
||||
* longer or shorter than the default (i.e. at rest) suspension length.
|
||||
* This is done in KartModel (pos is the position of the wheel relative
|
||||
* to the visual kart chassis):
|
||||
* pos.Y += m_default_physics_suspension[i]
|
||||
* - wi.m_raycastInfo.m_suspensionLength
|
||||
* But since the chassis is raised an additional 'getLowestPoint' (see
|
||||
* desctiption two paragraphs above), the wheels need to be lowered by that
|
||||
* amount so that they still touch the ground (the wheel nodes are child of
|
||||
* the chassis scene node, so if the chassis is raised by X, the wheels need
|
||||
* to be lowered by X).
|
||||
* This function also takes additional graphical effects into account, e.g.
|
||||
* a (visual only) jump when skidding, and leaning of the kart.
|
||||
* \param offset_xyz Offset to be added to the position.
|
||||
* \param rotation Additional rotation.
|
||||
*/
|
||||
@ -2627,60 +2694,37 @@ void Kart::updateGraphics(float dt, const Vec3& offset_xyz,
|
||||
}
|
||||
}
|
||||
|
||||
m_kart_model->update(dt, m_wheel_rotation_dt, getSteerPercent(), m_speed);
|
||||
|
||||
// If the kart is leaning, part of the kart might end up 'in' the track.
|
||||
// To avoid this, raise the kart enough to offset the leaning.
|
||||
float lean_height = tan(fabsf(m_current_lean)) * getKartWidth()*0.5f;
|
||||
|
||||
float heading = m_skidding->getVisualSkidRotation();
|
||||
float xx = fabsf(m_speed) * m_characteristic->getStabilityDownwardImpulseFactor() * 0.0006f;
|
||||
Vec3 center_shift = Vec3(0, m_skidding->getGraphicalJumpOffset()
|
||||
+ lean_height +m_graphical_y_offset+xx, 0);
|
||||
|
||||
// Try to prevent the graphical chassis to be inside of the terrain:
|
||||
if(m_kart_properties->getPreventChassisInTerrain())
|
||||
{
|
||||
// Get the shortest suspension length (=closest point to terrain).
|
||||
float min_susp_len = 99.9f;
|
||||
for (int i = 0; i < getVehicle()->getNumWheels(); i++)
|
||||
{
|
||||
float susp_len = getVehicle()->getWheelInfo(i).m_raycastInfo
|
||||
.m_suspensionLength;
|
||||
if (susp_len < min_susp_len)
|
||||
min_susp_len = susp_len;
|
||||
} // for i<num_wheels
|
||||
|
||||
const btWheelInfo &w = getVehicle()->getWheelInfo(0);
|
||||
// Recompute the default average suspension length, see
|
||||
// kartIsInRestNow() how to get from y-offset to susp. len.
|
||||
float av_sus_len = -m_graphical_y_offset
|
||||
+ w.m_chassisConnectionPointCS.getY()
|
||||
- w.m_wheelsRadius;
|
||||
|
||||
float delta = av_sus_len - min_susp_len;
|
||||
// If the suspension length is so short, that it is less than the
|
||||
// lowest point of the kart, it indicates that the graphical chassis
|
||||
// would be inside of the track:
|
||||
if (delta > m_kart_model->getLowestPoint())
|
||||
{
|
||||
center_shift.setY(center_shift.getY() + delta - m_kart_model->getLowestPoint());
|
||||
}
|
||||
|
||||
// FIXME: for now, debug output in case we have to debug it
|
||||
//Log::verbose("kart", "min %f y off %f overall off %f lowest %f delta %f asl %f",
|
||||
// min_susp_len, m_graphical_y_offset, center_shift.getY(),
|
||||
// m_kart_model->getLowestPoint(),
|
||||
// delta,
|
||||
// av_sus_len
|
||||
// );
|
||||
}
|
||||
Vec3 center_shift(0, 0, 0);
|
||||
|
||||
center_shift.setY(m_skidding->getGraphicalJumpOffset()
|
||||
+ lean_height
|
||||
+m_graphical_y_offset);
|
||||
center_shift = getTrans().getBasis() * center_shift;
|
||||
|
||||
float heading = m_skidding->getVisualSkidRotation();
|
||||
Moveable::updateGraphics(dt, center_shift,
|
||||
btQuaternion(heading, 0, m_current_lean));
|
||||
|
||||
// m_speed*dt is the distance the kart has moved, which determines
|
||||
// how much the wheels need to rotate.
|
||||
m_kart_model->update(dt, m_speed*dt, getSteerPercent(), m_speed);
|
||||
|
||||
// Determine the shadow position from the terrain Y position. This
|
||||
// leaves the shadow on the ground even if the kart is jumping because
|
||||
// of skidding (shadows are disabled when wheel are not on the track).
|
||||
if (m_shadow)
|
||||
{
|
||||
const bool emergency = getKartAnimation() != NULL;
|
||||
m_shadow->update(isOnGround() && !emergency,
|
||||
m_terrain_info->getHoT() - getXYZ().getY()
|
||||
- m_skidding->getGraphicalJumpOffset()
|
||||
- m_graphical_y_offset
|
||||
- m_kart_model->getLowestPoint());
|
||||
}
|
||||
#ifdef XX
|
||||
// cheap wheelie effect
|
||||
if (m_controls.m_nitro)
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include "items/powerup.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "karts/kart_properties.hpp"
|
||||
#include "tracks/terrain_info.hpp"
|
||||
#include "utils/no_copy.hpp"
|
||||
|
||||
class btKart;
|
||||
@ -51,6 +50,7 @@ class Skidding;
|
||||
class SkidMarks;
|
||||
class SlipStream;
|
||||
class Stars;
|
||||
class TerrainInfo;
|
||||
|
||||
/** The main kart class. All type of karts are of this object, but with
|
||||
* different controllers. The controllers are what turn a kart into a
|
||||
@ -172,10 +172,6 @@ private:
|
||||
/** The shadow of a kart. */
|
||||
Shadow *m_shadow;
|
||||
|
||||
/** If a kart is flying, the shadow is disabled (since it is
|
||||
* stuck to the kart, i.e. the shadow would be flying, too). */
|
||||
bool m_shadow_enabled;
|
||||
|
||||
ParticleEmitter *m_sky_particles_emitter;
|
||||
|
||||
/** All particle effects. */
|
||||
@ -187,12 +183,6 @@ private:
|
||||
/** Handles all slipstreaming. */
|
||||
SlipStream *m_slipstream;
|
||||
|
||||
/** Rotation compared to the start position, same for all wheels */
|
||||
float m_wheel_rotation;
|
||||
|
||||
/** Rotation change in the last time delta, same for all wheels */
|
||||
float m_wheel_rotation_dt;
|
||||
|
||||
/** The skidmarks object for this kart. */
|
||||
SkidMarks *m_skidmarks;
|
||||
|
||||
|
@ -49,30 +49,38 @@ float KartModel::UNDEFINED = -99.9f;
|
||||
|
||||
SpeedWeightedObject::Properties::Properties()
|
||||
{
|
||||
m_strength_factor = m_speed_factor = m_texture_speed.X = m_texture_speed.Y = SPEED_WEIGHTED_OBJECT_PROPERTY_UNDEFINED;
|
||||
}
|
||||
m_strength_factor = SPEED_WEIGHTED_OBJECT_PROPERTY_UNDEFINED;
|
||||
m_speed_factor = SPEED_WEIGHTED_OBJECT_PROPERTY_UNDEFINED;
|
||||
m_texture_speed.X = SPEED_WEIGHTED_OBJECT_PROPERTY_UNDEFINED;
|
||||
m_texture_speed.Y = SPEED_WEIGHTED_OBJECT_PROPERTY_UNDEFINED;
|
||||
} // SpeedWeightedObject::Properties::Properties
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void SpeedWeightedObject::Properties::loadFromXMLNode(const XMLNode* xml_node)
|
||||
{
|
||||
xml_node->get("strength-factor", &m_strength_factor);
|
||||
xml_node->get("speed-factor", &m_speed_factor);
|
||||
xml_node->get("texture-speed-x", &m_texture_speed.X);
|
||||
xml_node->get("texture-speed-y", &m_texture_speed.Y);
|
||||
}
|
||||
} // SpeedWeightedObject::Properties::loadFromXMLNode
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void SpeedWeightedObject::Properties::checkAllSet()
|
||||
{
|
||||
#define CHECK_NEG( a,strA) if(a<=SPEED_WEIGHTED_OBJECT_PROPERTY_UNDEFINED) { \
|
||||
Log::fatal("SpeedWeightedObject", "Missing default value for '%s'.", \
|
||||
strA); \
|
||||
#define CHECK_NEG( a,strA) if(a<=SPEED_WEIGHTED_OBJECT_PROPERTY_UNDEFINED) \
|
||||
{ \
|
||||
Log::fatal("SpeedWeightedObject", \
|
||||
"Missing default value for '%s'.", \
|
||||
strA); \
|
||||
}
|
||||
CHECK_NEG(m_strength_factor, "speed-weighted strength-factor" );
|
||||
CHECK_NEG(m_speed_factor, "speed-weighted speed-factor" );
|
||||
CHECK_NEG(m_strength_factor, "speed-weighted strength-factor" );
|
||||
CHECK_NEG(m_speed_factor, "speed-weighted speed-factor" );
|
||||
CHECK_NEG(m_texture_speed.X, "speed-weighted texture speed X" );
|
||||
CHECK_NEG(m_texture_speed.Y, "speed-weighted texture speed Y" );
|
||||
#undef CHECK_NEG
|
||||
}
|
||||
} // SpeedWeightedObject::Properties::checkAllSet
|
||||
|
||||
// ============================================================================
|
||||
/** Default constructor which initialises all variables with defaults.
|
||||
* Note that the KartModel is copied, so make sure to update makeCopy
|
||||
* if any more variables are added to this object.
|
||||
@ -158,8 +166,8 @@ void KartModel::loadInfo(const XMLNode &node)
|
||||
animation_node->get("start-jump", &m_animation_frame[AF_JUMP_START]);
|
||||
animation_node->get("start-jump-loop",&m_animation_frame[AF_JUMP_LOOP] );
|
||||
animation_node->get("end-jump", &m_animation_frame[AF_JUMP_END] );
|
||||
animation_node->get("start-speed-weighted", &m_animation_frame[AF_SPEED_WEIGHTED_START] );
|
||||
animation_node->get("end-speed-weighted", &m_animation_frame[AF_SPEED_WEIGHTED_END] );
|
||||
animation_node->get("start-speed-weighted", &m_animation_frame[AF_SPEED_WEIGHTED_START]);
|
||||
animation_node->get("end-speed-weighted", &m_animation_frame[AF_SPEED_WEIGHTED_END] );
|
||||
animation_node->get("speed", &m_animation_speed );
|
||||
}
|
||||
|
||||
@ -451,10 +459,12 @@ scene::ISceneNode* KartModel::attachModel(bool animated_models, bool always_anim
|
||||
obj.m_node = NULL;
|
||||
if(obj.m_model)
|
||||
{
|
||||
obj.m_node = irr_driver->addAnimatedMesh(obj.m_model, "speedweighted", node);
|
||||
obj.m_node = irr_driver->addAnimatedMesh(obj.m_model,
|
||||
"speedweighted", node);
|
||||
obj.m_node->grab();
|
||||
|
||||
obj.m_node->setFrameLoop(m_animation_frame[AF_SPEED_WEIGHTED_START], m_animation_frame[AF_SPEED_WEIGHTED_END]);
|
||||
obj.m_node->setFrameLoop(m_animation_frame[AF_SPEED_WEIGHTED_START],
|
||||
m_animation_frame[AF_SPEED_WEIGHTED_END]);
|
||||
|
||||
#ifdef DEBUG
|
||||
std::string debug_name = obj.m_name+" (speed-weighted)";
|
||||
@ -553,14 +563,6 @@ bool KartModel::loadModels(const KartProperties &kart_properties)
|
||||
}
|
||||
}
|
||||
|
||||
float y_off = kart_properties.getGraphicalYOffset();
|
||||
if(y_off!=0)
|
||||
{
|
||||
for (unsigned int i = 0; i < 4; i++)
|
||||
m_wheel_graphics_position[i].setY(
|
||||
m_wheel_graphics_position[i].getY() - y_off);
|
||||
}
|
||||
|
||||
// Load the wheel models. This can't be done early, since the default
|
||||
// values for the graphical position must be defined, which in turn
|
||||
// depend on the size of the model.
|
||||
@ -644,6 +646,14 @@ void KartModel::loadWheelInfo(const XMLNode &node,
|
||||
*/
|
||||
void KartModel::reset()
|
||||
{
|
||||
for (unsigned int i = 0; i < 4; i++)
|
||||
{
|
||||
if (m_wheel_node[i])
|
||||
{
|
||||
core::vector3df rotation(btScalar(rand() % 360), 0, 0);
|
||||
m_wheel_node[i]->setRotation(rotation);
|
||||
}
|
||||
}
|
||||
update(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
// Stop any animations currently being played.
|
||||
@ -766,49 +776,44 @@ void KartModel::setDefaultSuspension()
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Rotates and turns the wheels appropriately, and adjust for suspension
|
||||
+ updates the speed-weighted objects' animations.
|
||||
* updates the speed-weighted objects' animations.
|
||||
*
|
||||
* \param dt time since last frame
|
||||
* \param rotation_dt How far the wheels have rotated since last time.
|
||||
* \param distance How far the wheels have rotated since last time.
|
||||
* \param steer The actual steer settings.
|
||||
* \param suspension Suspension height for all four wheels.
|
||||
* \param speed The speed of the kart in meters/sec, used for the
|
||||
* speed-weighted objects' animations
|
||||
*/
|
||||
void KartModel::update(float dt, float rotation_dt, float steer, float speed)
|
||||
void KartModel::update(float dt, float distance, float steer, float speed)
|
||||
{
|
||||
core::vector3df wheel_steer(0, steer*30.0f, 0);
|
||||
core::vector3df wheel_steer(0, steer*30.0f, 0);
|
||||
|
||||
for(unsigned int i=0; i<4; i++)
|
||||
{
|
||||
if(!m_kart || !m_wheel_node[i]) continue;
|
||||
float rel_suspension = 0;
|
||||
if (!dynamic_cast<GhostKart*>(m_kart))
|
||||
{
|
||||
const btWheelInfo &wi = m_kart->getVehicle()->getWheelInfo(i);
|
||||
if (!m_kart || !m_wheel_node[i]) continue;
|
||||
#ifdef DEBUG
|
||||
if (UserConfigParams::m_physics_debug && m_kart)
|
||||
{
|
||||
// Make wheels that are not touching the ground invisible
|
||||
m_wheel_node[i]->setVisible(wi.m_raycastInfo.m_isInContact);
|
||||
}
|
||||
if (UserConfigParams::m_physics_debug &&
|
||||
!dynamic_cast<GhostKart*>(m_kart) )
|
||||
{
|
||||
const btWheelInfo &wi = m_kart->getVehicle()->getWheelInfo(i);
|
||||
// Make wheels that are not touching the ground invisible
|
||||
m_wheel_node[i]->setVisible(wi.m_raycastInfo.m_isInContact);
|
||||
}
|
||||
#endif
|
||||
rel_suspension = wi.m_raycastInfo.m_suspensionLength
|
||||
- m_default_physics_suspension[i];
|
||||
}
|
||||
// If the suspension is too compressed
|
||||
if(rel_suspension< m_min_suspension[i])
|
||||
rel_suspension = m_min_suspension[i];
|
||||
else if(rel_suspension > m_max_suspension[i])
|
||||
rel_suspension = m_max_suspension[i];
|
||||
|
||||
core::vector3df pos = m_wheel_graphics_position[i].toIrrVector();
|
||||
pos.Y -= rel_suspension;
|
||||
|
||||
const btWheelInfo &wi = m_kart->getVehicle()->getWheelInfo(i);
|
||||
|
||||
// Check documentation of Kart::updateGraphics for the following line
|
||||
pos.Y += m_default_physics_suspension[i]
|
||||
- wi.m_raycastInfo.m_suspensionLength
|
||||
- m_kart_lowest_point;
|
||||
m_wheel_node[i]->setPosition(pos);
|
||||
|
||||
// Now calculate the new rotation: (old + change) mod 360
|
||||
float new_rotation = m_wheel_node[i]->getRotation().X
|
||||
+ rotation_dt * RAD_TO_DEGREE;
|
||||
+ distance / m_wheel_graphics_radius[i] * RAD_TO_DEGREE;
|
||||
new_rotation = fmodf(new_rotation, 360);
|
||||
core::vector3df wheel_rotation(new_rotation, 0, 0);
|
||||
// Only apply steer to first 2 wheels.
|
||||
|
@ -232,7 +232,7 @@ public:
|
||||
void loadInfo(const XMLNode &node);
|
||||
bool loadModels(const KartProperties &kart_properties);
|
||||
void setDefaultSuspension();
|
||||
void update(float dt, float rotation_dt, float steer,
|
||||
void update(float dt, float distance, float steer,
|
||||
float speed);
|
||||
void finishedRace();
|
||||
scene::ISceneNode*
|
||||
|
@ -82,19 +82,16 @@ KartProperties::KartProperties(const std::string &filename)
|
||||
// if everything is defined properly.
|
||||
m_wheel_base = m_friction_slip = m_collision_terrain_impulse =
|
||||
m_collision_impulse = m_restitution = m_collision_impulse_time =
|
||||
m_max_lean = m_lean_speed = m_physical_wheel_position =
|
||||
m_graphical_y_offset = UNDEFINED;
|
||||
m_max_lean = m_lean_speed = m_physical_wheel_position = UNDEFINED;
|
||||
|
||||
m_terrain_impulse_type = IMPULSE_NONE;
|
||||
m_gravity_center_shift = Vec3(UNDEFINED);
|
||||
m_bevel_factor = Vec3(UNDEFINED);
|
||||
m_prevent_chassis_in_terrain = false;
|
||||
m_version = 0;
|
||||
m_color = video::SColor(255, 0, 0, 0);
|
||||
m_shape = 32; // close enough to a circle.
|
||||
m_engine_sfx_type = "engine_small";
|
||||
m_kart_model = NULL;
|
||||
m_has_rand_wheels = false;
|
||||
m_nitro_min_consumption = 0.53f;
|
||||
// The default constructor for stk_config uses filename=""
|
||||
if (filename != "")
|
||||
@ -282,7 +279,13 @@ void KartProperties::load(const std::string &filename, const std::string &node)
|
||||
{
|
||||
m_gravity_center_shift.setX(0);
|
||||
// Default: center at the very bottom of the kart.
|
||||
m_gravity_center_shift.setY(m_kart_model->getHeight()*0.5f);
|
||||
// If the kart is 'too high', its height will be changed in
|
||||
// kart.cpp, the same adjustment needs to be made here.
|
||||
if (m_kart_model->getHeight() > m_kart_model->getLength()*0.6f)
|
||||
m_gravity_center_shift.setY(m_kart_model->getLength()*0.6f*0.5f);
|
||||
else
|
||||
m_gravity_center_shift.setY(m_kart_model->getHeight()*0.5f);
|
||||
|
||||
m_gravity_center_shift.setZ(0);
|
||||
}
|
||||
|
||||
@ -292,9 +295,11 @@ void KartProperties::load(const std::string &filename, const std::string &node)
|
||||
// stable, the physical wheel position (i.e. location of raycast) were
|
||||
// moved to be on the corner of the shape. In order to retain the same
|
||||
// steering behaviour, the wheel base (which in turn determines the
|
||||
// turn angle at certain speeds) is shortened by 2 * wheel_radius
|
||||
m_wheel_base = fabsf(m_kart_model->getLength() - 2 *
|
||||
m_combined_characteristic->getWheelsRadius());
|
||||
// turn angle at certain speeds) is shortened by 2*wheel_radius
|
||||
// Wheel radius was always 0.25, and is now not used anymore, but in order
|
||||
// to keep existing steering behaviour, the same formula is still
|
||||
// used.
|
||||
m_wheel_base = fabsf(m_kart_model->getLength() - 2*0.25f);
|
||||
|
||||
m_shadow_texture = irr_driver->getTexture(m_shadow_file);
|
||||
|
||||
@ -347,8 +352,6 @@ void KartProperties::getAllData(const XMLNode * root)
|
||||
|
||||
root->get("groups", &m_groups );
|
||||
|
||||
root->get("random-wheel-rot", &m_has_rand_wheels );
|
||||
|
||||
root->get("shadow-scale", &m_shadow_scale );
|
||||
root->get("shadow-x-offset", &m_shadow_x_offset );
|
||||
root->get("shadow-z-offset", &m_shadow_z_offset );
|
||||
@ -467,13 +470,6 @@ void KartProperties::getAllData(const XMLNode * root)
|
||||
m_lean_speed *= DEGREE_TO_RAD;
|
||||
}
|
||||
|
||||
if(const XMLNode *graphics_node = root->getNode("graphics"))
|
||||
{
|
||||
graphics_node->get("y-offset", &m_graphical_y_offset);
|
||||
graphics_node->get("prevent-chassis-in-terrain",
|
||||
&m_prevent_chassis_in_terrain);
|
||||
}
|
||||
|
||||
if(m_kart_model)
|
||||
m_kart_model->loadInfo(*root);
|
||||
} // getAllData
|
||||
@ -501,7 +497,6 @@ void KartProperties::checkAllSet(const std::string &filename)
|
||||
|
||||
CHECK_NEG(m_max_lean, "lean max" );
|
||||
CHECK_NEG(m_lean_speed, "lean speed" );
|
||||
CHECK_NEG(m_graphical_y_offset, "graphics y-offset" );
|
||||
|
||||
m_speed_weighted_object_properties.checkAllSet();
|
||||
|
||||
@ -554,4 +549,3 @@ float KartProperties::getAvgPower() const
|
||||
sum += gear_power_increase[i] * power;
|
||||
return sum / gear_power_increase.size();
|
||||
} // getAvgPower
|
||||
|
||||
|
@ -159,11 +159,6 @@ private:
|
||||
* chassis. Useful for karts that don't have enough space for suspension
|
||||
* compression. */
|
||||
float m_graphical_y_offset;
|
||||
/** A hard flag that moves the graphical chassis higher if it's insde
|
||||
* the track. Might cause stuttering. */
|
||||
bool m_prevent_chassis_in_terrain;
|
||||
/** If the kart is supposed to have random wheel rotation at start. */
|
||||
bool m_has_rand_wheels;
|
||||
/** Wheel base of the kart. */
|
||||
float m_wheel_base;
|
||||
|
||||
@ -326,18 +321,6 @@ public:
|
||||
/** Returns friction slip. */
|
||||
float getFrictionSlip () const {return m_friction_slip; }
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Return the additional Y offset added to the y position of the graphical
|
||||
* chassis. Useful for karts that don't have enough space for suspension
|
||||
* compression. */
|
||||
float getGraphicalYOffset() const {return m_graphical_y_offset; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** A hard flag that moves the graphical chassis higher if it's insde
|
||||
* the track. Might cause stuttering. */
|
||||
bool getPreventChassisInTerrain() const
|
||||
{
|
||||
return m_prevent_chassis_in_terrain;
|
||||
} // getPreventChassisInTerrain
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns parameters for the speed-weighted objects */
|
||||
const SpeedWeightedObject::Properties& getSpeedWeightedObjectProperties() const
|
||||
@ -417,8 +400,6 @@ public:
|
||||
/** The speed with which a kart should lean (in radians/s). */
|
||||
float getLeanSpeed() const { return m_lean_speed; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns true if wheels should have random rotation at start. */
|
||||
bool hasRandomWheels() const { return m_has_rand_wheels; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns minimum time during which nitro is consumed when pressing nitro
|
||||
* key, to prevent using nitro in very short bursts
|
||||
@ -443,5 +424,3 @@ public:
|
||||
}; // KartProperties
|
||||
|
||||
#endif
|
||||
|
||||
/* EOF */
|
||||
|
71
src/karts/patch
Normal file
71
src/karts/patch
Normal file
@ -0,0 +1,71 @@
|
||||
diff --git a/src/karts/kart.cpp b/src/karts/kart.cpp
|
||||
index de14bbe..47bbee9 100644
|
||||
--- a/src/karts/kart.cpp
|
||||
+++ b/src/karts/kart.cpp
|
||||
@@ -2476,11 +2476,12 @@ void Kart::kartIsInRestNow()
|
||||
for(int i=0; i<m_vehicle->getNumWheels(); i++)
|
||||
{
|
||||
const btWheelInfo &wi = m_vehicle->getWheelInfo(i);
|
||||
- f += wi.m_chassisConnectionPointCS.getY()
|
||||
- - wi.m_raycastInfo.m_suspensionLength - wi.m_wheelsRadius;
|
||||
+ f += wi.m_raycastInfo.m_suspensionLength;
|
||||
}
|
||||
+ m_terrain_info->update(getTrans());
|
||||
m_graphical_y_offset = f/m_vehicle->getNumWheels()
|
||||
+ getKartProperties()->getGraphicalYOffset();
|
||||
+ m_graphical_y_offset = m_kart_model->getLowestPoint() - (getXYZ().getY() - m_terrain_info->getHoT());
|
||||
|
||||
m_kart_model->setDefaultSuspension();
|
||||
} // kartIsInRestNow
|
||||
@@ -2595,11 +2596,6 @@ void Kart::updateGraphics(float dt, const Vec3& offset_xyz,
|
||||
} // for i<num_wheels
|
||||
const btWheelInfo &w = getVehicle()->getWheelInfo(0);
|
||||
|
||||
- // Determine the shadow position from the terrain Y position. This
|
||||
- // leaves the shadow on the ground even if the kart is jumping because
|
||||
- // of skidding (shadows are disabled when wheel are not on the track).
|
||||
- m_shadow->update(m_terrain_info->getHoT() - getXYZ().getY()
|
||||
- -m_skidding->getGraphicalJumpOffset());
|
||||
// Recompute the default average suspension length, see
|
||||
// kartIsInRestNow() how to get from y-offset to susp. len.
|
||||
float av_sus_len = -m_graphical_y_offset
|
||||
@@ -2628,6 +2624,9 @@ void Kart::updateGraphics(float dt, const Vec3& offset_xyz,
|
||||
+ lean_height
|
||||
- m_kart_model->getLowestPoint());
|
||||
|
||||
+ center_shift.setY(m_skidding->getGraphicalJumpOffset()
|
||||
+ + lean_height
|
||||
+ +m_graphical_y_offset);
|
||||
center_shift = getTrans().getBasis() * center_shift;
|
||||
|
||||
Moveable::updateGraphics(dt, center_shift,
|
||||
@@ -2637,6 +2636,14 @@ void Kart::updateGraphics(float dt, const Vec3& offset_xyz,
|
||||
// how much the wheels need to rotate.
|
||||
m_kart_model->update(dt, m_speed*dt, getSteerPercent(), m_speed);
|
||||
|
||||
+ // Determine the shadow position from the terrain Y position. This
|
||||
+ // leaves the shadow on the ground even if the kart is jumping because
|
||||
+ // of skidding (shadows are disabled when wheel are not on the track).
|
||||
+ m_shadow->update( m_terrain_info->getHoT() - getXYZ().getY()
|
||||
+ - m_skidding->getGraphicalJumpOffset()
|
||||
+ - m_graphical_y_offset
|
||||
+ - m_kart_model->getLowestPoint());
|
||||
+
|
||||
#ifdef XX
|
||||
// cheap wheelie effect
|
||||
if (m_controls.m_nitro)
|
||||
diff --git a/src/karts/kart_model.cpp b/src/karts/kart_model.cpp
|
||||
index 65879d3..36b03b7 100644
|
||||
--- a/src/karts/kart_model.cpp
|
||||
+++ b/src/karts/kart_model.cpp
|
||||
@@ -813,7 +813,9 @@ void KartModel::update(float dt, float distance, float steer, float speed)
|
||||
core::vector3df pos = m_wheel_graphics_position[i].toIrrVector();
|
||||
|
||||
const btWheelInfo &wi = m_kart->getVehicle()->getWheelInfo(i);
|
||||
- pos.Y = -wi.m_raycastInfo.m_suspensionLength + m_wheel_graphics_radius[i] + getLowestPoint();
|
||||
+ pos.Y += m_default_physics_suspension[i]
|
||||
+ - wi.m_raycastInfo.m_suspensionLength
|
||||
+ - getLowestPoint();
|
||||
m_wheel_node[i]->setPosition(pos);
|
||||
|
||||
// Now calculate the new rotation: (old + change) mod 360
|
@ -67,7 +67,7 @@ Skidding::~Skidding()
|
||||
void Skidding::reset()
|
||||
{
|
||||
m_skid_time = 0.0f;
|
||||
m_skid_state = m_skid_visual_time<=0 ? SKID_OLD : SKID_NONE;
|
||||
m_skid_state = SKID_NONE;
|
||||
m_skid_factor = 1.0f;
|
||||
m_real_steering = 0.0f;
|
||||
m_visual_rotation = 0.0f;
|
||||
@ -95,20 +95,8 @@ void Skidding::reset()
|
||||
*/
|
||||
void Skidding::updateSteering(float steer, float dt)
|
||||
{
|
||||
if(m_skid_state==SKID_OLD)
|
||||
{
|
||||
float speed = m_kart->getSpeed();
|
||||
float current_max_speed = m_kart->getCurrentMaxSpeed();
|
||||
float speed_ratio = speed / current_max_speed;
|
||||
m_real_steering = steer * m_skid_factor;
|
||||
m_visual_rotation = m_real_steering /m_skid_max * speed_ratio;
|
||||
return;
|
||||
}
|
||||
// Now only new skidding is happening
|
||||
switch(m_skid_state)
|
||||
{
|
||||
case SKID_OLD: assert(false);
|
||||
break;
|
||||
case SKID_SHOW_GFX_LEFT:
|
||||
case SKID_SHOW_GFX_RIGHT:
|
||||
case SKID_NONE:
|
||||
@ -178,7 +166,6 @@ float Skidding::getSteeringWhenSkidding(float steering) const
|
||||
{
|
||||
switch(m_skid_state)
|
||||
{
|
||||
case SKID_OLD: assert(false); break;
|
||||
case SKID_SHOW_GFX_LEFT:
|
||||
case SKID_SHOW_GFX_RIGHT:
|
||||
case SKID_BREAK:
|
||||
@ -257,13 +244,6 @@ void Skidding::update(float dt, bool is_on_ground,
|
||||
else
|
||||
if(m_skid_factor<1.0f) m_skid_factor = 1.0f;
|
||||
|
||||
// FIXME hiker: remove once the new skidding code is finished.
|
||||
if(m_skid_state == SKID_OLD)
|
||||
{
|
||||
updateSteering(steering, dt);
|
||||
return;
|
||||
}
|
||||
|
||||
// If skidding was started and a graphical jump should still
|
||||
// be displayed, update the data
|
||||
if(m_remaining_jump_time>0)
|
||||
|
@ -74,7 +74,6 @@ private:
|
||||
float m_jump_speed;
|
||||
|
||||
public:
|
||||
/** SKID_OLD: old skidding, will be removed. */
|
||||
/** SKID_NONE: Kart is currently not skidding.
|
||||
* SKID_ACCUMULATE_LEFT: Kart is skidding to the left and accumulating
|
||||
* for bonus.
|
||||
@ -83,9 +82,8 @@ public:
|
||||
* and the kart was turning left.
|
||||
* SKID_SHOW_GFX_RIGHT: Similar for turning right.
|
||||
* SKID_BREAK: Skidding was stopped without bonus */
|
||||
enum SkidState {SKID_OLD, SKID_NONE, SKID_ACCUMULATE_LEFT,
|
||||
SKID_ACCUMULATE_RIGHT, SKID_SHOW_GFX_LEFT,
|
||||
SKID_SHOW_GFX_RIGHT, SKID_BREAK} ;
|
||||
enum SkidState { SKID_NONE, SKID_ACCUMULATE_LEFT, SKID_ACCUMULATE_RIGHT,
|
||||
SKID_SHOW_GFX_LEFT, SKID_SHOW_GFX_RIGHT, SKID_BREAK} ;
|
||||
|
||||
private:
|
||||
/** The current skidding state. */
|
||||
|
@ -549,6 +549,9 @@ void cmdLineHelp()
|
||||
" -h, --help Show this help.\n"
|
||||
" --log=N Set the verbosity to a value between\n"
|
||||
" 0 (Debug) and 5 (Only Fatal messages)\n"
|
||||
" --root=DIR Path to add to the list of STK root directories.\n"
|
||||
" You can specify more than one by separating them\n"
|
||||
" with colons (:).\n"
|
||||
"\n"
|
||||
"You can visit SuperTuxKart's homepage at "
|
||||
"http://supertuxkart.sourceforge.net\n\n",
|
||||
|
@ -40,8 +40,7 @@
|
||||
MainLoop* main_loop = 0;
|
||||
|
||||
MainLoop::MainLoop() :
|
||||
m_abort(false),
|
||||
m_frame_count(0)
|
||||
m_abort(false)
|
||||
{
|
||||
m_curr_time = 0;
|
||||
m_prev_time = 0;
|
||||
|
@ -31,7 +31,6 @@ private:
|
||||
bool m_abort;
|
||||
bool m_throttle_fps;
|
||||
|
||||
int m_frame_count;
|
||||
Uint32 m_curr_time;
|
||||
Uint32 m_prev_time;
|
||||
float getLimitedDt();
|
||||
|
@ -54,8 +54,11 @@ FollowTheLeaderRace::FollowTheLeaderRace() : LinearWorld()
|
||||
void FollowTheLeaderRace::init()
|
||||
{
|
||||
LinearWorld::init();
|
||||
// WorldWithRank determines the score based on getNumKarts(), but since
|
||||
// we ignore the leader, the points need to be based on number of karts -1
|
||||
stk_config->getAllScores(&m_score_for_position, getNumKarts() - 1);
|
||||
getKart(0)->setOnScreenText(_("Leader"));
|
||||
}
|
||||
} // init
|
||||
|
||||
#if 0
|
||||
#pragma mark -
|
||||
@ -83,6 +86,20 @@ void FollowTheLeaderRace::reset()
|
||||
m_is_over_delay = 2.0f;
|
||||
} // reset
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Returns the number of points for a kart at a specified position.
|
||||
* \param p Position (starting with 1).
|
||||
*/
|
||||
int FollowTheLeaderRace::getScoreForPosition(int p)
|
||||
{
|
||||
// Kart 0 (the leader) does not get any points
|
||||
if (p == 1) return 0;
|
||||
|
||||
assert(p-2 >= 0);
|
||||
assert(p - 2 <(int) m_score_for_position.size());
|
||||
return m_score_for_position[p - 2];
|
||||
} // getScoreForPosition
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Returns the original time at which the countdown timer started. This is
|
||||
* used by the race_gui to display the music credits in FTL mode correctly.
|
||||
@ -169,43 +186,6 @@ void FollowTheLeaderRace::countdownReachedZero()
|
||||
music_manager->switchToFastMusic();
|
||||
}
|
||||
|
||||
if (isRaceOver())
|
||||
{
|
||||
// Handle special FTL situation: the leader is kart number 3 when
|
||||
// the last kart gets eliminated. In this case kart on position 1
|
||||
// is eliminated, and the kart formerly on position 2 is on
|
||||
// position 1, the leader now position 2. In this case the kart
|
||||
// on position 1 would get more points for this victory. So if
|
||||
// this is the case, change the position
|
||||
if(m_karts[0]->getPosition()!=1)
|
||||
{
|
||||
// Adjust the position of all still driving karts that
|
||||
// are ahead of the leader by +1, and move the leader
|
||||
// to position 1.
|
||||
for (unsigned int i=1; i<m_karts.size(); i++)
|
||||
{
|
||||
if(!m_karts[i]->hasFinishedRace() &&
|
||||
!m_karts[i]->isEliminated() &&
|
||||
m_karts[i]->getPosition()<m_karts[0]->getPosition())
|
||||
{
|
||||
m_karts[i]->setPosition(m_karts[i]->getPosition()+1);
|
||||
}
|
||||
}
|
||||
m_karts[0]->setPosition(1);
|
||||
}
|
||||
|
||||
// Mark all still racing karts to be finished.
|
||||
for (unsigned int n=0; n<m_karts.size(); n++)
|
||||
{
|
||||
if (!m_karts[n]->isEliminated() &&
|
||||
!m_karts[n]->hasFinishedRace())
|
||||
{
|
||||
m_karts[n]->finishedRace(getTime());
|
||||
}
|
||||
}
|
||||
}
|
||||
// End of race is detected from World::updateWorld()
|
||||
|
||||
} // countdownReachedZero
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -233,6 +213,56 @@ bool FollowTheLeaderRace::isRaceOver()
|
||||
}
|
||||
} // isRaceOver
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Called at the end of a race. Updates highscores, pauses the game, and
|
||||
* informs the unlock manager about the finished race. This function must
|
||||
* be called after all other stats were updated from the different game
|
||||
* modes.
|
||||
*/
|
||||
void FollowTheLeaderRace::terminateRace()
|
||||
{
|
||||
int pos_leader = m_karts[0]->getPosition();
|
||||
|
||||
// Handle special FTL situations: the leader is kart number 3 when
|
||||
// the last kart gets eliminated. In this case kart on position 1
|
||||
// is eliminated, and the kart formerly on position 2 is on
|
||||
// position 1, the leader now position 2, but the point distribution
|
||||
// depends on the 'first' (non-leader) kart to be on position 2.
|
||||
// That situation can also occur during the delay after eliminating
|
||||
// the last kart before the race result is shown.
|
||||
// To avoid this problem, adjust the position of any kart that is
|
||||
// ahead of the leader.
|
||||
beginSetKartPositions();
|
||||
for (unsigned int i = 0; i < getNumKarts(); i++)
|
||||
{
|
||||
if (!m_karts[i]->hasFinishedRace() && !m_karts[i]->isEliminated())
|
||||
{
|
||||
if (m_karts[i]->getPosition() < pos_leader)
|
||||
{
|
||||
setKartPosition(i, m_karts[i]->getPosition() + 1);
|
||||
}
|
||||
// Update the estimated finishing time for all karts that haven't
|
||||
// finished yet.
|
||||
m_karts[i]->finishedRace(0.0f);
|
||||
}
|
||||
} // i < number of karts
|
||||
setKartPosition(/*kart id*/0, /*position*/1);
|
||||
endSetKartPositions();
|
||||
|
||||
// Mark all still racing karts to be finished.
|
||||
for (unsigned int n = 0; n < m_karts.size(); n++)
|
||||
{
|
||||
if (!m_karts[n]->isEliminated() &&
|
||||
!m_karts[n]->hasFinishedRace())
|
||||
{
|
||||
m_karts[n]->finishedRace(getTime());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
World::terminateRace();
|
||||
} // terminateRace
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Returns the internal identifier for this kind of race.
|
||||
*/
|
||||
|
@ -27,8 +27,11 @@
|
||||
class FollowTheLeaderRace : public LinearWorld
|
||||
{
|
||||
private:
|
||||
std::vector<float> m_leader_intervals; // time till elimination in follow leader
|
||||
float m_is_over_delay; //!< A timer used before terminating the race
|
||||
// time till elimination in follow leader
|
||||
std::vector<float> m_leader_intervals;
|
||||
|
||||
/** A timer used before terminating the race. */
|
||||
float m_is_over_delay;
|
||||
|
||||
public:
|
||||
|
||||
@ -37,6 +40,7 @@ public:
|
||||
|
||||
// clock events
|
||||
virtual void countdownReachedZero() OVERRIDE;
|
||||
virtual int getScoreForPosition(int p) OVERRIDE;
|
||||
|
||||
// overriding World methods
|
||||
virtual void reset() OVERRIDE;
|
||||
@ -46,10 +50,9 @@ public:
|
||||
virtual void getKartsDisplayInfo(
|
||||
std::vector<RaceGUIBase::KartIconDisplayInfo> *info) OVERRIDE;
|
||||
virtual void init() OVERRIDE;
|
||||
|
||||
virtual void terminateRace() OVERRIDE;
|
||||
virtual bool isRaceOver() OVERRIDE;
|
||||
virtual bool raceHasLaps() OVERRIDE { return false; }
|
||||
|
||||
}; // FollowTheLeader
|
||||
|
||||
|
||||
|
@ -173,7 +173,13 @@ public:
|
||||
{
|
||||
return m_kart_info[kart_index].m_track_sector;
|
||||
} // getTrackSector
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
void setLastTriggeredCheckline(unsigned int kart_index, int index)
|
||||
{
|
||||
if (m_kart_info.size() == 0)
|
||||
return;
|
||||
m_kart_info[kart_index].m_track_sector.setLastTriggeredCheckline(index);
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns how far the kart has driven so far (i.e.
|
||||
* number-of-laps-finished times track-length plus distance-on-track.
|
||||
|
@ -128,6 +128,7 @@ void OverWorld::update(float dt)
|
||||
m_karts[n]->setEnergy(100.0f);
|
||||
}
|
||||
|
||||
/*
|
||||
TrackObjectManager* tom = getTrack()->getTrackObjectManager();
|
||||
PtrVector<TrackObject>& objects = tom->getObjects();
|
||||
for(unsigned int i=0; i<objects.size(); i++)
|
||||
@ -145,6 +146,7 @@ void OverWorld::update(float dt)
|
||||
obj->reset();
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
if (m_return_to_garage)
|
||||
{
|
||||
|
@ -123,6 +123,7 @@ World::World() : WorldStatus(), m_clear_color(255,100,101,140)
|
||||
m_schedule_tutorial = false;
|
||||
m_is_network_world = false;
|
||||
m_weather = NULL;
|
||||
m_force_disable_fog = false;
|
||||
|
||||
m_stop_music_when_dialog_open = true;
|
||||
|
||||
@ -738,6 +739,12 @@ void World::moveKartTo(AbstractKart* kart, const btTransform &transform)
|
||||
kart->setRotation(pos.getRotation());
|
||||
|
||||
kart->getBody()->setCenterOfMassTransform(pos);
|
||||
// The raycast to determine the terrain underneath the kart is done from
|
||||
// the centre point of the 4 wheel positions. After a rescue, the wheel
|
||||
// positions need to be updated (otherwise the raycast will be done from
|
||||
// the previous position, which might be the position that triggered
|
||||
// the rescue in the first place).
|
||||
kart->getVehicle()->updateAllWheelPositions();
|
||||
|
||||
// Project kart to surface of track
|
||||
// This will set the physics transform
|
||||
|
@ -37,6 +37,8 @@ void WorldWithRank::init()
|
||||
m_position_used.resize(m_karts.size());
|
||||
m_position_setting_initialised = false;
|
||||
#endif
|
||||
stk_config->getAllScores(&m_score_for_position, getNumKarts());
|
||||
|
||||
} // init
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -173,3 +175,13 @@ btTransform WorldWithRank::getRescueTransform(unsigned int rescue_pos) const
|
||||
return getTrack()->getStartTransform(rescue_pos);
|
||||
} // getRescueTransform
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Returns the number of points for a kart at a specified position.
|
||||
* \param p Position (starting with 1).
|
||||
*/
|
||||
int WorldWithRank::getScoreForPosition(int p)
|
||||
{
|
||||
assert(p-1 >= 0);
|
||||
assert(p - 1 <(int) m_score_for_position.size());
|
||||
return m_score_for_position[p - 1];
|
||||
} // getScoreForPosition
|
||||
|
@ -43,6 +43,10 @@ protected:
|
||||
/** Whether to display the rank in the race GUI */
|
||||
bool m_display_rank;
|
||||
|
||||
/** The points given to a kart on a given position (index is
|
||||
* 0 based, so using race-position - 1. */
|
||||
std::vector<int> m_score_for_position;
|
||||
|
||||
#ifdef DEBUG
|
||||
/** Used for debugging to help detect if the same kart position
|
||||
* is used more than once. */
|
||||
@ -70,6 +74,8 @@ public:
|
||||
unsigned int position);
|
||||
void endSetKartPositions();
|
||||
AbstractKart* getKartAtPosition(unsigned int p) const;
|
||||
virtual int getScoreForPosition(int p);
|
||||
|
||||
|
||||
virtual unsigned int getNumberOfRescuePositions() const OVERRIDE;
|
||||
virtual unsigned int getRescuePositionIndex(AbstractKart *kart) OVERRIDE;
|
||||
|
@ -173,22 +173,29 @@ class NetworkString
|
||||
return result;
|
||||
}
|
||||
|
||||
// Another function for n == 1 to surpress warnings in clang
|
||||
template<typename T>
|
||||
T get(int pos) const
|
||||
{
|
||||
return m_string[pos];
|
||||
}
|
||||
|
||||
inline int getInt(int pos = 0) const { return get<int,4>(pos); }
|
||||
inline uint32_t getUInt(int pos = 0) const { return get<uint32_t,4>(pos); }
|
||||
inline uint32_t getUInt32(int pos = 0) const { return get<uint32_t,4>(pos); }
|
||||
inline uint16_t getUInt16(int pos = 0) const { return get<uint16_t,2>(pos); }
|
||||
inline uint8_t getUInt8(int pos = 0) const { return get<uint8_t,1>(pos); }
|
||||
inline char getChar(int pos = 0) const { return get<char,1>(pos); }
|
||||
inline unsigned char getUChar(int pos = 0) const { return get<unsigned char,1>(pos); }
|
||||
inline uint8_t getUInt8(int pos = 0) const { return get<uint8_t>(pos); }
|
||||
inline char getChar(int pos = 0) const { return get<char>(pos); }
|
||||
inline unsigned char getUChar(int pos = 0) const { return get<unsigned char>(pos); }
|
||||
std::string getString(int pos, int len) const { return std::string(m_string.begin()+pos, m_string.begin()+pos+len); }
|
||||
|
||||
inline int gi(int pos = 0) const { return get<int,4>(pos); }
|
||||
inline uint32_t gui(int pos = 0) const { return get<uint32_t,4>(pos); }
|
||||
inline uint32_t gui32(int pos = 0) const { return get<uint32_t,4>(pos); }
|
||||
inline uint16_t gui16(int pos = 0) const { return get<uint16_t,2>(pos); }
|
||||
inline uint8_t gui8(int pos = 0) const { return get<uint8_t,1>(pos); }
|
||||
inline char gc(int pos = 0) const { return get<char,1>(pos); }
|
||||
inline unsigned char guc(int pos = 0) const { return get<unsigned char,1>(pos); }
|
||||
inline uint8_t gui8(int pos = 0) const { return get<uint8_t>(pos); }
|
||||
inline char gc(int pos = 0) const { return get<char>(pos); }
|
||||
inline unsigned char guc(int pos = 0) const { return get<unsigned char>(pos); }
|
||||
std::string gs(int pos, int len) const { return std::string(m_string.begin()+pos, m_string.begin()+pos+len); }
|
||||
|
||||
double getDouble(int pos = 0) //!< BEWARE OF PRECISION
|
||||
@ -219,13 +226,22 @@ class NetworkString
|
||||
return result;
|
||||
}
|
||||
|
||||
// Another function for n == 1 to surpress warnings in clang
|
||||
template<typename T>
|
||||
T getAndRemove(int pos)
|
||||
{
|
||||
T result = m_string[pos];
|
||||
remove(pos, 1);
|
||||
return result;
|
||||
}
|
||||
|
||||
inline int getAndRemoveInt(int pos = 0) { return getAndRemove<int,4>(pos); }
|
||||
inline uint32_t getAndRemoveUInt(int pos = 0) { return getAndRemove<uint32_t,4>(pos); }
|
||||
inline uint32_t getAndRemoveUInt32(int pos = 0) { return getAndRemove<uint32_t,4>(pos); }
|
||||
inline uint16_t getAndRemoveUInt16(int pos = 0) { return getAndRemove<uint16_t,2>(pos); }
|
||||
inline uint8_t getAndRemoveUInt8(int pos = 0) { return getAndRemove<uint8_t,1>(pos); }
|
||||
inline char getAndRemoveChar(int pos = 0) { return getAndRemove<char,1>(pos); }
|
||||
inline unsigned char getAndRemoveUChar(int pos = 0) { return getAndRemove<unsigned char,1>(pos); }
|
||||
inline uint8_t getAndRemoveUInt8(int pos = 0) { return getAndRemove<uint8_t>(pos); }
|
||||
inline char getAndRemoveChar(int pos = 0) { return getAndRemove<char>(pos); }
|
||||
inline unsigned char getAndRemoveUChar(int pos = 0) { return getAndRemove<unsigned char>(pos); }
|
||||
double getAndRemoveDouble(int pos = 0) //!< BEWARE OF PRECISION
|
||||
{
|
||||
for (int i = 0; i < 8; i++)
|
||||
|
@ -47,6 +47,7 @@ bool SynchronizationProtocol::notifyEventAsynchronous(Event* event)
|
||||
uint32_t sequence = data.gui32(6);
|
||||
|
||||
std::vector<STKPeer*> peers = NetworkManager::getInstance()->getPeers();
|
||||
assert(peers.size() > 0);
|
||||
|
||||
if (m_listener->isServer())
|
||||
{
|
||||
@ -57,7 +58,7 @@ bool SynchronizationProtocol::notifyEventAsynchronous(Event* event)
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t peer_id;
|
||||
uint8_t peer_id = 0;
|
||||
for (unsigned int i = 0; i < peers.size(); i++)
|
||||
{
|
||||
if (peers[i]->isSamePeer(*event->peer))
|
||||
|
@ -29,7 +29,7 @@
|
||||
template<typename S>
|
||||
S getHighestInHistogram(std::map<S,int>* histogram)
|
||||
{
|
||||
S best_item;
|
||||
S best_item = histogram->begin()->first;
|
||||
uint8_t highest_count = histogram->begin()->second;
|
||||
for (typename std::map<S, int>::iterator it = histogram->begin();
|
||||
it != histogram->end(); it++)
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "karts/kart.hpp"
|
||||
#include "modes/world.hpp"
|
||||
#include "physics/triangle_mesh.hpp"
|
||||
#include "tracks/terrain_info.hpp"
|
||||
#include "tracks/track.hpp"
|
||||
|
||||
#define ROLLING_INFLUENCE_FIX
|
||||
@ -84,7 +85,7 @@ btWheelInfo& btKart::addWheel(const btVector3& connectionPointCS,
|
||||
ci.m_wheelsDampingCompression = tuning.m_suspensionCompression;
|
||||
ci.m_wheelsDampingRelaxation = tuning.m_suspensionDamping;
|
||||
ci.m_frictionSlip = tuning.m_frictionSlip;
|
||||
ci.m_maxSuspensionTravelCm = tuning.m_maxSuspensionTravelCm;
|
||||
ci.m_maxSuspensionTravel = tuning.m_maxSuspensionTravel;
|
||||
ci.m_maxSuspensionForce = tuning.m_maxSuspensionForce;
|
||||
|
||||
m_wheelInfo.push_back( btWheelInfo(ci));
|
||||
@ -113,7 +114,6 @@ void btKart::reset()
|
||||
{
|
||||
btWheelInfo &wheel = m_wheelInfo[i];
|
||||
wheel.m_raycastInfo.m_suspensionLength = 0;
|
||||
wheel.m_rotation = 0;
|
||||
updateWheelTransform(i, true);
|
||||
}
|
||||
m_visual_wheels_touch_ground = false;
|
||||
@ -160,16 +160,13 @@ void btKart::updateWheelTransform(int wheelIndex, bool interpolatedTransform)
|
||||
btQuaternion steeringOrn(up,steering);//wheel.m_steering);
|
||||
btMatrix3x3 steeringMat(steeringOrn);
|
||||
|
||||
btQuaternion rotatingOrn(right,-wheel.m_rotation);
|
||||
btMatrix3x3 rotatingMat(rotatingOrn);
|
||||
|
||||
btMatrix3x3 basis2(
|
||||
right[0],fwd[0],up[0],
|
||||
right[1],fwd[1],up[1],
|
||||
right[2],fwd[2],up[2]
|
||||
);
|
||||
|
||||
wheel.m_worldTransform.setBasis(steeringMat * rotatingMat * basis2);
|
||||
wheel.m_worldTransform.setBasis(steeringMat * basis2);
|
||||
wheel.m_worldTransform.setOrigin(
|
||||
wheel.m_raycastInfo.m_hardPointWS
|
||||
+ wheel.m_raycastInfo.m_wheelDirectionWS
|
||||
@ -236,8 +233,8 @@ btScalar btKart::rayCast(unsigned int index)
|
||||
|
||||
updateWheelTransformsWS( wheel,false);
|
||||
|
||||
btScalar max_susp_len = wheel.getSuspensionRestLength()+wheel.m_wheelsRadius
|
||||
+ wheel.m_maxSuspensionTravelCm*0.01f;
|
||||
btScalar max_susp_len = wheel.getSuspensionRestLength()
|
||||
+ wheel.m_maxSuspensionTravel;
|
||||
|
||||
// Do a slightly longer raycast to see if the kart might soon hit the
|
||||
// ground and some 'cushioning' is needed to avoid that the chassis
|
||||
@ -267,13 +264,13 @@ btScalar btKart::rayCast(unsigned int index)
|
||||
wheel.m_raycastInfo.m_triangle_index = rayResults.m_triangle_index;;
|
||||
wheel.m_raycastInfo.m_groundObject = &getFixedBody();
|
||||
|
||||
wheel.m_raycastInfo.m_suspensionLength = depth - wheel.m_wheelsRadius;
|
||||
wheel.m_raycastInfo.m_suspensionLength = depth;
|
||||
|
||||
//clamp on max suspension travel
|
||||
btScalar minSuspensionLength = wheel.getSuspensionRestLength()
|
||||
- wheel.m_maxSuspensionTravelCm*btScalar(0.01);
|
||||
- wheel.m_maxSuspensionTravel;
|
||||
btScalar maxSuspensionLength = wheel.getSuspensionRestLength()
|
||||
+ wheel.m_maxSuspensionTravelCm*btScalar(0.01);
|
||||
+ wheel.m_maxSuspensionTravel;
|
||||
if (wheel.m_raycastInfo.m_suspensionLength < minSuspensionLength)
|
||||
{
|
||||
wheel.m_raycastInfo.m_suspensionLength = minSuspensionLength;
|
||||
@ -366,13 +363,20 @@ const btTransform& btKart::getChassisWorldTransform() const
|
||||
} // getChassisWorldTransform
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void btKart::updateVehicle( btScalar step )
|
||||
void btKart::updateAllWheelPositions()
|
||||
{
|
||||
for (int i=0;i<getNumWheels();i++)
|
||||
{
|
||||
updateWheelTransform(i,false);
|
||||
}
|
||||
|
||||
} // updateAllWheelPositions
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void btKart::updateVehicle( btScalar step )
|
||||
{
|
||||
updateAllWheelPositions();
|
||||
|
||||
const btTransform& chassisTrans = getChassisWorldTransform();
|
||||
|
||||
btVector3 forwardW(chassisTrans.getBasis()[0][m_indexForwardAxis],
|
||||
@ -444,6 +448,16 @@ void btKart::updateVehicle( btScalar step )
|
||||
btVector3 kart_up = getChassisWorldTransform().getBasis().getColumn(1);
|
||||
btVector3 terrain_up(0,1,0);
|
||||
btVector3 axis = kart_up.cross(terrain_up);
|
||||
if(!axis.fuzzyZero())
|
||||
axis.normalize();
|
||||
|
||||
// To avoid the kart going backwards/forwards (or rolling sideways),
|
||||
// set the pitch/roll to 0 before applying the 'straightening' impulse.
|
||||
// TODO: make this works if gravity is changed.
|
||||
btVector3 av = m_chassisBody->getAngularVelocity();
|
||||
av.setX(0);
|
||||
av.setZ(0);
|
||||
m_chassisBody->setAngularVelocity(av);
|
||||
// Give a nicely balanced feeling for rebalancing the kart
|
||||
m_chassisBody->applyTorqueImpulse(axis * m_kart->getCharacteristic()->getStabilitySmoothFlyingImpulse());
|
||||
}
|
||||
@ -525,15 +539,8 @@ void btKart::updateVehicle( btScalar step )
|
||||
|
||||
btScalar proj2 = fwd.dot(vel);
|
||||
|
||||
wheel.m_deltaRotation = (proj2 * step) / (wheel.m_wheelsRadius);
|
||||
wheel.m_rotation += wheel.m_deltaRotation;
|
||||
|
||||
} else
|
||||
{
|
||||
wheel.m_rotation += wheel.m_deltaRotation;
|
||||
}
|
||||
//damping of rotation when not in contact
|
||||
wheel.m_deltaRotation *= btScalar(0.99);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -983,6 +990,10 @@ void btKart::updateFriction(btScalar timeStep)
|
||||
// ----------------------------------------------------------------------------
|
||||
void btKart::debugDraw(btIDebugDraw* debugDrawer)
|
||||
{
|
||||
const btVector3 &from = m_kart->getTerrainInfo()->getOrigin();
|
||||
const btVector3 &to = m_kart->getTerrainInfo()->getHitPoint();
|
||||
debugDrawer->drawLine(from, to, btVector3(0.5, 0.5, 0));
|
||||
|
||||
for (int v=0;v<getNumWheels();v++)
|
||||
{
|
||||
btVector3 wheelColor(0,1,1);
|
||||
|
@ -37,7 +37,7 @@ public:
|
||||
:m_suspensionStiffness(btScalar(5.88)),
|
||||
m_suspensionCompression(btScalar(0.83)),
|
||||
m_suspensionDamping(btScalar(0.88)),
|
||||
m_maxSuspensionTravelCm(btScalar(500.)),
|
||||
m_maxSuspensionTravel(btScalar(5.)),
|
||||
m_frictionSlip(btScalar(10.5)),
|
||||
m_maxSuspensionForce(btScalar(6000.))
|
||||
{
|
||||
@ -46,7 +46,7 @@ public:
|
||||
btScalar m_suspensionStiffness;
|
||||
btScalar m_suspensionCompression;
|
||||
btScalar m_suspensionDamping;
|
||||
btScalar m_maxSuspensionTravelCm;
|
||||
btScalar m_maxSuspensionTravel;
|
||||
btScalar m_frictionSlip;
|
||||
btScalar m_maxSuspensionForce;
|
||||
|
||||
@ -180,6 +180,7 @@ public:
|
||||
void setSliding(bool active);
|
||||
void instantSpeedIncreaseTo(float speed);
|
||||
void capSpeed(float max_speed);
|
||||
void updateAllWheelPositions();
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns true if both rear visual wheels touch the ground. */
|
||||
bool visualWheelsTouchGround() const
|
||||
|
@ -173,7 +173,7 @@ void Physics::update(float dt)
|
||||
Scripting::ScriptEngine* script_engine = World::getWorld()->getScriptEngine();
|
||||
int kartid1 = p->getUserPointer(0)->getPointerKart()->getWorldKartId();
|
||||
int kartid2 = p->getUserPointer(1)->getPointerKart()->getWorldKartId();
|
||||
script_engine->runFunction("void onKartKartCollision(int, int)",
|
||||
script_engine->runFunction(false, "void onKartKartCollision(int, int)",
|
||||
[=](asIScriptContext* ctx) {
|
||||
ctx->SetArgDWord(0, kartid1);
|
||||
ctx->SetArgDWord(1, kartid2);
|
||||
@ -202,7 +202,7 @@ void Physics::update(float dt)
|
||||
|
||||
if (scripting_function.size() > 0)
|
||||
{
|
||||
script_engine->runFunction("void " + scripting_function + "(int, const string, const string)",
|
||||
script_engine->runFunction(true, "void " + scripting_function + "(int, const string, const string)",
|
||||
[&](asIScriptContext* ctx) {
|
||||
ctx->SetArgDWord(0, kartId);
|
||||
ctx->SetArgObject(1, lib_id_ptr);
|
||||
@ -275,7 +275,7 @@ void Physics::update(float dt)
|
||||
std::string scripting_function = obj->getOnItemCollisionFunction();
|
||||
if (scripting_function.size() > 0)
|
||||
{
|
||||
script_engine->runFunction("void " + scripting_function + "(int, int, const string)",
|
||||
script_engine->runFunction(true, "void " + scripting_function + "(int, int, const string)",
|
||||
[&](asIScriptContext* ctx) {
|
||||
ctx->SetArgDWord(0, (int)flyable->getType());
|
||||
ctx->SetArgDWord(1, flyable->getOwnerId());
|
||||
|
@ -416,7 +416,6 @@ void RaceManager::startNextRace()
|
||||
// Uncomment to debug audio leaks
|
||||
// sfx_manager->dump();
|
||||
|
||||
stk_config->getAllScores(&m_score_for_position, m_num_karts);
|
||||
IrrlichtDevice* device = irr_driver->getDevice();
|
||||
GUIEngine::renderLoading();
|
||||
device->getVideoDriver()->endScene();
|
||||
@ -760,7 +759,17 @@ void RaceManager::kartFinishedRace(const AbstractKart *kart, float time)
|
||||
assert(pos-1 < (int)m_kart_status.size());
|
||||
|
||||
m_kart_status[id].m_last_score = m_kart_status[id].m_score;
|
||||
m_kart_status[id].m_score += m_score_for_position[pos-1];
|
||||
|
||||
// In follow the leader mode, the winner is actually the kart with
|
||||
// position 2, so adjust the points (#points for leader do not matter)
|
||||
WorldWithRank *wwr = dynamic_cast<WorldWithRank*>(World::getWorld());
|
||||
if (wwr)
|
||||
m_kart_status[id].m_score += wwr->getScoreForPosition(pos);
|
||||
else
|
||||
{
|
||||
Log::error("RaceManager", "World with scores that is not a WorldWithRank??");
|
||||
}
|
||||
|
||||
m_kart_status[id].m_overall_time += time;
|
||||
m_kart_status[id].m_last_time = time;
|
||||
m_num_finished_karts ++;
|
||||
|
@ -313,10 +313,6 @@ private:
|
||||
/** Whether a track should be reversed */
|
||||
std::vector<bool> m_reverse_track;
|
||||
|
||||
/** The points given to a kart on a given position (index is
|
||||
* 0 based, so using race-position - 1. */
|
||||
std::vector<int> m_score_for_position;
|
||||
|
||||
/** The list of default AI karts to use. This is from the command line. */
|
||||
std::vector<std::string> m_default_ai_list;
|
||||
|
||||
@ -592,8 +588,6 @@ public:
|
||||
// ------------------------------------------------------------------------
|
||||
float getTimeTarget() const { return m_time_target; }
|
||||
// ------------------------------------------------------------------------
|
||||
int getPositionScore(int p) const { return m_score_for_position[p-1]; }
|
||||
// ------------------------------------------------------------------------
|
||||
int getTrackNumber() const { return m_track_number; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the list of AI karts to use. Used for networking, and for
|
||||
|
@ -175,20 +175,20 @@ namespace Scripting
|
||||
/** runs the specified script
|
||||
* \param string scriptName = name of script to run
|
||||
*/
|
||||
void ScriptEngine::runFunction(std::string function_name)
|
||||
void ScriptEngine::runFunction(bool warn_if_not_found, std::string function_name)
|
||||
{
|
||||
std::function<void(asIScriptContext*)> callback;
|
||||
std::function<void(asIScriptContext*)> get_return_value;
|
||||
runFunction(function_name, callback, get_return_value);
|
||||
runFunction(warn_if_not_found, function_name, callback, get_return_value);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void ScriptEngine::runFunction(std::string function_name,
|
||||
void ScriptEngine::runFunction(bool warn_if_not_found, std::string function_name,
|
||||
std::function<void(asIScriptContext*)> callback)
|
||||
{
|
||||
std::function<void(asIScriptContext*)> get_return_value;
|
||||
runFunction(function_name, callback, get_return_value);
|
||||
runFunction(warn_if_not_found, function_name, callback, get_return_value);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -196,7 +196,7 @@ namespace Scripting
|
||||
/** runs the specified script
|
||||
* \param string scriptName = name of script to run
|
||||
*/
|
||||
void ScriptEngine::runFunction(std::string function_name,
|
||||
void ScriptEngine::runFunction(bool warn_if_not_found, std::string function_name,
|
||||
std::function<void(asIScriptContext*)> callback,
|
||||
std::function<void(asIScriptContext*)> get_return_value)
|
||||
{
|
||||
@ -217,7 +217,10 @@ namespace Scripting
|
||||
|
||||
if (func == NULL)
|
||||
{
|
||||
Log::debug("Scripting", "Scripting function was not found : %s", function_name.c_str());
|
||||
if (warn_if_not_found)
|
||||
Log::warn("Scripting", "Scripting function was not found : %s", function_name.c_str());
|
||||
else
|
||||
Log::debug("Scripting", "Scripting function was not found : %s", function_name.c_str());
|
||||
m_functions_cache[function_name] = NULL; // remember that this function is unavailable
|
||||
return;
|
||||
}
|
||||
@ -233,6 +236,8 @@ namespace Scripting
|
||||
|
||||
if (func == NULL)
|
||||
{
|
||||
if (warn_if_not_found)
|
||||
Log::warn("Scripting", "Scripting function was not found : %s", function_name.c_str());
|
||||
return; // function unavailable
|
||||
}
|
||||
|
||||
@ -425,7 +430,7 @@ namespace Scripting
|
||||
curr.m_time -= dt;
|
||||
if (curr.m_time <= 0.0)
|
||||
{
|
||||
runFunction("void " + curr.m_callback_name + "()");
|
||||
runFunction(true, "void " + curr.m_callback_name + "()");
|
||||
m_pending_timeouts.erase(m_pending_timeouts.begin() + i);
|
||||
}
|
||||
}
|
||||
|
@ -47,10 +47,10 @@ namespace Scripting
|
||||
ScriptEngine();
|
||||
~ScriptEngine();
|
||||
|
||||
void runFunction(std::string function_name);
|
||||
void runFunction(std::string function_name,
|
||||
void runFunction(bool warn_if_not_found, std::string function_name);
|
||||
void runFunction(bool warn_if_not_found, std::string function_name,
|
||||
std::function<void(asIScriptContext*)> callback);
|
||||
void runFunction(std::string function_name,
|
||||
void runFunction(bool warn_if_not_found, std::string function_name,
|
||||
std::function<void(asIScriptContext*)> callback,
|
||||
std::function<void(asIScriptContext*)> get_return_value);
|
||||
void evalScript(std::string script_fragment);
|
||||
|
@ -55,7 +55,6 @@ namespace Scripting
|
||||
kart->setXYZ(v);
|
||||
unsigned int index = World::getWorld()->getRescuePositionIndex(kart);
|
||||
btTransform s = World::getWorld()->getRescueTransform(index);
|
||||
const btVector3 &xyz = s.getOrigin();
|
||||
s.setRotation(btQuaternion(btVector3(0.0f, 1.0f, 0.0f), 0.0f));
|
||||
World::getWorld()->moveKartTo(kart, s);
|
||||
}
|
||||
|
@ -101,11 +101,11 @@ namespace Scripting
|
||||
return StringUtils::wide_to_utf8(out.c_str());
|
||||
}
|
||||
|
||||
/** Runs the script specified by the given string */
|
||||
/** Runs the script function specified by the given string */
|
||||
void runScript(const std::string* str)
|
||||
{
|
||||
ScriptEngine* script_engine = World::getWorld()->getScriptEngine();
|
||||
script_engine->runFunction(*str);
|
||||
script_engine->runFunction(true, *str);
|
||||
}
|
||||
|
||||
/** Generate a random integer value */
|
||||
|
@ -67,11 +67,3 @@ void CutsceneGUI::renderGlobal(float dt)
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void CutsceneGUI::renderPlayerView(const AbstractKart *kart)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -53,7 +53,7 @@ public:
|
||||
void setSubtitle(const core::stringw& subtitle) { m_subtitle = subtitle; }
|
||||
|
||||
virtual void renderGlobal(float dt);
|
||||
virtual void renderPlayerView(const AbstractKart *kart);
|
||||
virtual void renderPlayerView(const Camera *camera, float dt){}
|
||||
|
||||
virtual const core::dimension2du getMiniMapSize() const OVERRIDE
|
||||
{
|
||||
|
@ -162,18 +162,18 @@ void AddonsLoading::beforeAddingWidgets()
|
||||
float f = ((int)(n/1024.0f/1024.0f*10.0f+0.5f))/10.0f;
|
||||
char s[32];
|
||||
sprintf(s, "%.1f", f);
|
||||
unit=_("%s MB", s);
|
||||
unit = _LTR("%s MB", s);
|
||||
}
|
||||
else if(n>1024)
|
||||
{
|
||||
float f = ((int)(n/1024.0f*10.0f+0.5f))/10.0f;
|
||||
char s[32];
|
||||
sprintf(s, "%.1f", f);
|
||||
unit=_("%s KB", s);
|
||||
unit = _LTR("%s KB", s);
|
||||
}
|
||||
else
|
||||
// Anything smaller just let it be 1 KB
|
||||
unit=_("%s KB", 1);
|
||||
unit = _LTR("%s KB", 1);
|
||||
core::stringw size = _("Size: %s", unit.c_str());
|
||||
getWidget<LabelWidget>("size")->setText(size, false);
|
||||
} // AddonsLoading
|
||||
|
@ -34,7 +34,6 @@ namespace Online { class HTTPRequest; }
|
||||
class AddonsLoading : public GUIEngine::ModalDialog
|
||||
{
|
||||
private:
|
||||
GUIEngine::LabelWidget *m_state;
|
||||
GUIEngine::ProgressBarWidget *m_progress;
|
||||
GUIEngine::IconButtonWidget *m_back_button;
|
||||
GUIEngine::IconButtonWidget *m_install_button;
|
||||
|
@ -52,7 +52,6 @@ using namespace irr::core;
|
||||
using namespace irr::gui;
|
||||
using namespace irr::video;
|
||||
|
||||
const float ANIM_FROM = 3.0f;
|
||||
const float ANIM_TO = 7.0f;
|
||||
const int GIFT_EXIT_FROM = (int)ANIM_TO;
|
||||
const int GIFT_EXIT_TO = GIFT_EXIT_FROM + 7;
|
||||
|
@ -52,17 +52,8 @@ using namespace irr::core;
|
||||
using namespace irr::gui;
|
||||
using namespace irr::video;
|
||||
|
||||
const float INITIAL_Y = -3.0f;
|
||||
|
||||
const float DURATION = 15.0f;
|
||||
|
||||
const float CAMERA_END_X = -15.0f;
|
||||
const float CAMERA_END_Y = 1.5f;
|
||||
const float CAMERA_END_Z = 5.0f;
|
||||
const float CAMERA_START_X = -17.0f;
|
||||
const float CAMERA_START_Y = 2.0f;
|
||||
const float CAMERA_START_Z = 5.5f;
|
||||
|
||||
const float DISTANCE_BETWEEN_KARTS = 2.0f;
|
||||
|
||||
const float KART_SCALE = 0.75f;
|
||||
@ -72,9 +63,6 @@ const float KART_END_X = -5.0f;
|
||||
const float KART_Y = 0.0f;
|
||||
const float KART_Z = 0.0f;
|
||||
|
||||
|
||||
const float GARAGE_DOOR_OPEN_TIME = 6.0f;
|
||||
|
||||
const int MAX_KART_COUNT = 4;
|
||||
|
||||
DEFINE_SCREEN_SINGLETON( GrandPrixLose );
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include "network/network_manager.hpp"
|
||||
#include "states_screens/state_manager.hpp"
|
||||
|
||||
static const char RANDOM_KART_ID[] = "randomkart";
|
||||
static const char ID_LOCKED[] = "locked/";
|
||||
|
||||
using namespace GUIEngine;
|
||||
|
@ -272,7 +272,6 @@ void OptionsScreenInput::filterInput(Input::InputType type,
|
||||
int deviceID,
|
||||
int btnID,
|
||||
int axisDir,
|
||||
int axisRange,
|
||||
int value)
|
||||
{
|
||||
if (type == Input::IT_STICKMOTION || type == Input::IT_STICKBUTTON)
|
||||
|
@ -70,7 +70,6 @@ public:
|
||||
int deviceID,
|
||||
int btnID,
|
||||
int axisDir,
|
||||
int axisRange,
|
||||
int value);
|
||||
|
||||
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||
|
@ -46,9 +46,6 @@ private:
|
||||
|
||||
// Minimap related variables
|
||||
// -------------------------
|
||||
/** The mini map of the track. */
|
||||
video::ITexture *m_mini_map;
|
||||
|
||||
/** The size of a single marker on the screen for AI karts,
|
||||
* need not be a power of 2. */
|
||||
int m_minimap_ai_size;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user