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" />
|
<spacer width="10" height="10" />
|
||||||
|
|
||||||
<buttonbar id="menu_bottomrow" x="0" y="0" width="38%" height="100%" align="center">
|
<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"/>
|
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"/>
|
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"/>
|
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"/>
|
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"/>
|
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"/>
|
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"/>
|
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"/>
|
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"/>
|
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"/>
|
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"/>
|
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"/>
|
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"/>
|
I18N="In the main screen" text="Quit" label_location="hover"/>
|
||||||
</buttonbar>
|
</buttonbar>
|
||||||
</bottombar>
|
</bottombar>
|
||||||
|
@ -16,9 +16,11 @@ void main()
|
|||||||
col += .25 * texture(tex_256, uv);
|
col += .25 * texture(tex_256, uv);
|
||||||
col += .5 * texture(tex_512, 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));
|
float final = max(col.r,max(col.g,col.b));
|
||||||
//final = final * 2;
|
final = final * 2;
|
||||||
vec3 blue = vec3(final * 0.1, final * 0.2, final);
|
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. -->
|
work anymore - so for now don't enable this. -->
|
||||||
<networking enable="false"/>
|
<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
|
<!-- disable-while-unskid: Disable steering when stop skidding during
|
||||||
the time it takes to adjust the physical body with the graphics.
|
the time it takes to adjust the physical body with the graphics.
|
||||||
camera-follow-skid: If true the camera will stay behind the kart,
|
camera-follow-skid: If true the camera will stay behind the kart,
|
||||||
@ -126,15 +131,6 @@
|
|||||||
<!-- Default values for all karts
|
<!-- Default values for all karts
|
||||||
============================ -->
|
============================ -->
|
||||||
<general-kart-defaults>
|
<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.
|
<!-- Skidding: increase: multiplicative increase of skidding factor in each frame.
|
||||||
decrease: multiplicative decrease 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_wheelsDampingRelaxation = tuning.m_suspensionDamping;
|
||||||
ci.m_frictionSlip = tuning.m_frictionSlip;
|
ci.m_frictionSlip = tuning.m_frictionSlip;
|
||||||
ci.m_bIsFrontWheel = isFrontWheel;
|
ci.m_bIsFrontWheel = isFrontWheel;
|
||||||
ci.m_maxSuspensionTravelCm = tuning.m_maxSuspensionTravelCm;
|
ci.m_maxSuspensionTravel = tuning.m_maxSuspensionTravel;
|
||||||
ci.m_maxSuspensionForce = tuning.m_maxSuspensionForce;
|
ci.m_maxSuspensionForce = tuning.m_maxSuspensionForce;
|
||||||
|
|
||||||
m_wheelInfo.push_back( btWheelInfo(ci));
|
m_wheelInfo.push_back( btWheelInfo(ci));
|
||||||
@ -118,7 +118,7 @@ void btRaycastVehicle::updateWheelTransform( int wheelIndex , bool interpolatedT
|
|||||||
btQuaternion steeringOrn(up,steering);//wheel.m_steering);
|
btQuaternion steeringOrn(up,steering);//wheel.m_steering);
|
||||||
btMatrix3x3 steeringMat(steeringOrn);
|
btMatrix3x3 steeringMat(steeringOrn);
|
||||||
|
|
||||||
btQuaternion rotatingOrn(right,-wheel.m_rotation);
|
btQuaternion rotatingOrn(right,0);
|
||||||
btMatrix3x3 rotatingMat(rotatingOrn);
|
btMatrix3x3 rotatingMat(rotatingOrn);
|
||||||
|
|
||||||
btMatrix3x3 basis2(
|
btMatrix3x3 basis2(
|
||||||
@ -203,8 +203,8 @@ btScalar btRaycastVehicle::rayCast(btWheelInfo& wheel)
|
|||||||
wheel.m_raycastInfo.m_suspensionLength = hitDistance - wheel.m_wheelsRadius;
|
wheel.m_raycastInfo.m_suspensionLength = hitDistance - wheel.m_wheelsRadius;
|
||||||
//clamp on max suspension travel
|
//clamp on max suspension travel
|
||||||
|
|
||||||
btScalar minSuspensionLength = wheel.getSuspensionRestLength() - wheel.m_maxSuspensionTravelCm*btScalar(0.01);
|
btScalar minSuspensionLength = wheel.getSuspensionRestLength() - wheel.m_maxSuspensionTravel;
|
||||||
btScalar maxSuspensionLength = wheel.getSuspensionRestLength()+ wheel.m_maxSuspensionTravelCm*btScalar(0.01);
|
btScalar maxSuspensionLength = wheel.getSuspensionRestLength()+ wheel.m_maxSuspensionTravel;
|
||||||
if (wheel.m_raycastInfo.m_suspensionLength < minSuspensionLength)
|
if (wheel.m_raycastInfo.m_suspensionLength < minSuspensionLength)
|
||||||
{
|
{
|
||||||
wheel.m_raycastInfo.m_suspensionLength = minSuspensionLength;
|
wheel.m_raycastInfo.m_suspensionLength = minSuspensionLength;
|
||||||
@ -345,17 +345,7 @@ void btRaycastVehicle::updateVehicle( btScalar step )
|
|||||||
fwd -= wheel.m_raycastInfo.m_contactNormalWS * proj;
|
fwd -= wheel.m_raycastInfo.m_contactNormalWS * proj;
|
||||||
|
|
||||||
btScalar proj2 = fwd.dot(vel);
|
btScalar proj2 = fwd.dot(vel);
|
||||||
|
|
||||||
wheel.m_deltaRotation = (proj2 * step) / (wheel.m_wheelsRadius);
|
|
||||||
wheel.m_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_suspensionStiffness(btScalar(5.88)),
|
||||||
m_suspensionCompression(btScalar(0.83)),
|
m_suspensionCompression(btScalar(0.83)),
|
||||||
m_suspensionDamping(btScalar(0.88)),
|
m_suspensionDamping(btScalar(0.88)),
|
||||||
m_maxSuspensionTravelCm(btScalar(500.)),
|
m_maxSuspensionTravel(btScalar(5.)),
|
||||||
m_frictionSlip(btScalar(10.5)),
|
m_frictionSlip(btScalar(10.5)),
|
||||||
m_maxSuspensionForce(btScalar(6000.))
|
m_maxSuspensionForce(btScalar(6000.))
|
||||||
{
|
{
|
||||||
@ -51,7 +51,7 @@ public:
|
|||||||
btScalar m_suspensionStiffness;
|
btScalar m_suspensionStiffness;
|
||||||
btScalar m_suspensionCompression;
|
btScalar m_suspensionCompression;
|
||||||
btScalar m_suspensionDamping;
|
btScalar m_suspensionDamping;
|
||||||
btScalar m_maxSuspensionTravelCm;
|
btScalar m_maxSuspensionTravel;
|
||||||
btScalar m_frictionSlip;
|
btScalar m_frictionSlip;
|
||||||
btScalar m_maxSuspensionForce;
|
btScalar m_maxSuspensionForce;
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ struct btWheelInfoConstructionInfo
|
|||||||
btVector3 m_wheelDirectionCS;
|
btVector3 m_wheelDirectionCS;
|
||||||
btVector3 m_wheelAxleCS;
|
btVector3 m_wheelAxleCS;
|
||||||
btScalar m_suspensionRestLength;
|
btScalar m_suspensionRestLength;
|
||||||
btScalar m_maxSuspensionTravelCm;
|
btScalar m_maxSuspensionTravel;
|
||||||
btScalar m_wheelRadius;
|
btScalar m_wheelRadius;
|
||||||
|
|
||||||
btScalar m_suspensionStiffness;
|
btScalar m_suspensionStiffness;
|
||||||
@ -59,7 +59,7 @@ struct btWheelInfo
|
|||||||
btVector3 m_wheelDirectionCS;//const
|
btVector3 m_wheelDirectionCS;//const
|
||||||
btVector3 m_wheelAxleCS; // const or modified by steering
|
btVector3 m_wheelAxleCS; // const or modified by steering
|
||||||
btScalar m_suspensionRestLength1;//const
|
btScalar m_suspensionRestLength1;//const
|
||||||
btScalar m_maxSuspensionTravelCm;
|
btScalar m_maxSuspensionTravel;
|
||||||
btScalar getSuspensionRestLength() const;
|
btScalar getSuspensionRestLength() const;
|
||||||
btScalar m_wheelsRadius;//const
|
btScalar m_wheelsRadius;//const
|
||||||
btScalar m_suspensionStiffness;//const
|
btScalar m_suspensionStiffness;//const
|
||||||
@ -67,8 +67,6 @@ struct btWheelInfo
|
|||||||
btScalar m_wheelsDampingRelaxation;//const
|
btScalar m_wheelsDampingRelaxation;//const
|
||||||
btScalar m_frictionSlip;
|
btScalar m_frictionSlip;
|
||||||
btScalar m_steering;
|
btScalar m_steering;
|
||||||
btScalar m_rotation;
|
|
||||||
btScalar m_deltaRotation;
|
|
||||||
btScalar m_rollInfluence;
|
btScalar m_rollInfluence;
|
||||||
btScalar m_maxSuspensionForce;
|
btScalar m_maxSuspensionForce;
|
||||||
|
|
||||||
@ -87,7 +85,7 @@ struct btWheelInfo
|
|||||||
{
|
{
|
||||||
|
|
||||||
m_suspensionRestLength1 = ci.m_suspensionRestLength;
|
m_suspensionRestLength1 = ci.m_suspensionRestLength;
|
||||||
m_maxSuspensionTravelCm = ci.m_maxSuspensionTravelCm;
|
m_maxSuspensionTravel = ci.m_maxSuspensionTravel;
|
||||||
|
|
||||||
m_wheelsRadius = ci.m_wheelRadius;
|
m_wheelsRadius = ci.m_wheelRadius;
|
||||||
m_suspensionStiffness = ci.m_suspensionStiffness;
|
m_suspensionStiffness = ci.m_suspensionStiffness;
|
||||||
@ -99,8 +97,6 @@ struct btWheelInfo
|
|||||||
m_frictionSlip = ci.m_frictionSlip;
|
m_frictionSlip = ci.m_frictionSlip;
|
||||||
m_steering = btScalar(0.);
|
m_steering = btScalar(0.);
|
||||||
m_engineForce = btScalar(0.);
|
m_engineForce = btScalar(0.);
|
||||||
m_rotation = btScalar(0.);
|
|
||||||
m_deltaRotation = btScalar(0.);
|
|
||||||
m_brake = btScalar(0.);
|
m_brake = btScalar(0.);
|
||||||
m_rollInfluence = btScalar(0.1);
|
m_rollInfluence = btScalar(0.1);
|
||||||
m_bIsFrontWheel = ci.m_bIsFrontWheel;
|
m_bIsFrontWheel = ci.m_bIsFrontWheel;
|
||||||
|
@ -70,7 +70,7 @@ inline void GrahamScanConvexHull2D(btAlignedObjectArray<GrahamVector2>& original
|
|||||||
{
|
{
|
||||||
const btVector3& left = originalPoints[i];
|
const btVector3& left = originalPoints[i];
|
||||||
const btVector3& right = originalPoints[0];
|
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);
|
originalPoints.swap(0,i);
|
||||||
}
|
}
|
||||||
|
@ -83,6 +83,8 @@ enet_protocol_dispatch_incoming_commands (ENetHost * host, ENetEvent * event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -863,6 +865,8 @@ enet_protocol_handle_acknowledge (ENetHost * host, ENetEvent * event, ENetPeer *
|
|||||||
enet_list_empty (& peer -> sentReliableCommands))
|
enet_list_empty (& peer -> sentReliableCommands))
|
||||||
enet_peer_disconnect (peer, peer -> eventData);
|
enet_peer_disconnect (peer, peer -> eventData);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
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
|
CurrentFrameNr = (f32)StartFrame; //Support for non animated meshes
|
||||||
}
|
}
|
||||||
|
@ -1867,6 +1867,9 @@ public:
|
|||||||
// Attribute implemented for texture references
|
// Attribute implemented for texture references
|
||||||
class CTextureAttribute : public IAttribute
|
class CTextureAttribute : public IAttribute
|
||||||
{
|
{
|
||||||
|
// Explicitly hide base method
|
||||||
|
using IAttribute::setTexture;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
CTextureAttribute(const char* name, video::ITexture* value, video::IVideoDriver* driver, const io::path& filename)
|
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
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -233,7 +233,6 @@ void CGUIButton::draw()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
IGUISkin* skin = Environment->getSkin();
|
IGUISkin* skin = Environment->getSkin();
|
||||||
video::IVideoDriver* driver = Environment->getVideoDriver();
|
|
||||||
|
|
||||||
// todo: move sprite up and text down if the pressed state has a sprite
|
// todo: move sprite up and text down if the pressed state has a sprite
|
||||||
const core::position2di spritePos = AbsoluteRect.getCenter();
|
const core::position2di spritePos = AbsoluteRect.getCenter();
|
||||||
@ -254,6 +253,7 @@ void CGUIButton::draw()
|
|||||||
core::recti(pos, ImageRect.getSize()),
|
core::recti(pos, ImageRect.getSize()),
|
||||||
ImageRect, &AbsoluteClippingRect,
|
ImageRect, &AbsoluteClippingRect,
|
||||||
0, UseAlphaChannel);
|
0, UseAlphaChannel);
|
||||||
|
//video::IVideoDriver* driver = Environment->getVideoDriver();
|
||||||
//driver->draw2DImage(Image,
|
//driver->draw2DImage(Image,
|
||||||
// ScaleImage? AbsoluteRect :
|
// ScaleImage? AbsoluteRect :
|
||||||
// core::recti(pos, ImageRect.getSize()),
|
// core::recti(pos, ImageRect.getSize()),
|
||||||
|
@ -522,8 +522,6 @@ void CGUIContextMenu::draw()
|
|||||||
recalculateSize();
|
recalculateSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
IGUISpriteBank* sprites = skin->getSpriteBank();
|
|
||||||
|
|
||||||
core::rect<s32> rect = AbsoluteRect;
|
core::rect<s32> rect = AbsoluteRect;
|
||||||
core::rect<s32>* clip = 0;
|
core::rect<s32>* clip = 0;
|
||||||
|
|
||||||
@ -583,7 +581,9 @@ void CGUIContextMenu::draw()
|
|||||||
font->draw(Items[i].Text.c_str(), rect,
|
font->draw(Items[i].Text.c_str(), rect,
|
||||||
skin->getColor(c), false, true, clip);
|
skin->getColor(c), false, true, clip);
|
||||||
|
|
||||||
|
|
||||||
// draw submenu symbol
|
// draw submenu symbol
|
||||||
|
//IGUISpriteBank* sprites = skin->getSpriteBank();
|
||||||
//if (Items[i].SubMenu && sprites)
|
//if (Items[i].SubMenu && sprites)
|
||||||
//{
|
//{
|
||||||
// core::rect<s32> r = rect;
|
// core::rect<s32> r = rect;
|
||||||
|
@ -74,7 +74,6 @@ void CGUIImage::draw()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
IGUISkin* skin = Environment->getSkin();
|
IGUISkin* skin = Environment->getSkin();
|
||||||
video::IVideoDriver* driver = Environment->getVideoDriver();
|
|
||||||
|
|
||||||
if (Texture)
|
if (Texture)
|
||||||
{
|
{
|
||||||
@ -88,7 +87,7 @@ void CGUIImage::draw()
|
|||||||
//}
|
//}
|
||||||
//else
|
//else
|
||||||
//{
|
//{
|
||||||
// driver->draw2DImage(Texture, AbsoluteRect.UpperLeftCorner,
|
// Environment->getVideoDriver()->draw2DImage(Texture, AbsoluteRect.UpperLeftCorner,
|
||||||
// core::rect<s32>(core::position2d<s32>(0,0), core::dimension2di(Texture->getOriginalSize())),
|
// core::rect<s32>(core::position2d<s32>(0,0), core::dimension2di(Texture->getOriginalSize())),
|
||||||
// &AbsoluteClippingRect, Color, UseAlphaChannel);
|
// &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,
|
GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_CORE_PROFILE_BIT_ARB,
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
int legacyctx[] =
|
|
||||||
{
|
|
||||||
GLX_CONTEXT_MAJOR_VERSION_ARB, 2,
|
|
||||||
GLX_CONTEXT_MINOR_VERSION_ARB, 1,
|
|
||||||
None
|
|
||||||
};
|
|
||||||
PFNGLXCREATECONTEXTATTRIBSARBPROC glXCreateContextAttribsARB = 0;
|
PFNGLXCREATECONTEXTATTRIBSARBPROC glXCreateContextAttribsARB = 0;
|
||||||
glXCreateContextAttribsARB = (PFNGLXCREATECONTEXTATTRIBSARBPROC)
|
glXCreateContextAttribsARB = (PFNGLXCREATECONTEXTATTRIBSARBPROC)
|
||||||
glXGetProcAddressARB( (const GLubyte *) "glXCreateContextAttribsARB" );
|
glXGetProcAddressARB( (const GLubyte *) "glXCreateContextAttribsARB" );
|
||||||
|
@ -155,6 +155,8 @@ namespace video
|
|||||||
SColor color,
|
SColor color,
|
||||||
bool useAlphaChannelOfTexture);
|
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.
|
//! 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,
|
virtual void draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos,
|
||||||
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0,
|
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0,
|
||||||
|
@ -28,7 +28,7 @@ CParticleAnimatedMeshSceneNodeEmitter::CParticleAnimatedMeshSceneNodeEmitter(
|
|||||||
MinStartColor(minStartColor), MaxStartColor(maxStartColor),
|
MinStartColor(minStartColor), MaxStartColor(maxStartColor),
|
||||||
MinLifeTime(lifeTimeMin), MaxLifeTime(lifeTimeMax),
|
MinLifeTime(lifeTimeMin), MaxLifeTime(lifeTimeMax),
|
||||||
MaxStartSize(maxStartSize), MinStartSize(minStartSize),
|
MaxStartSize(maxStartSize), MinStartSize(minStartSize),
|
||||||
Time(0), Emitted(0), MaxAngleDegrees(maxAngleDegrees),
|
Time(0), MaxAngleDegrees(maxAngleDegrees),
|
||||||
EveryMeshVertex(everyMeshVertex), UseNormalDirection(useNormalDirection)
|
EveryMeshVertex(everyMeshVertex), UseNormalDirection(useNormalDirection)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
|
@ -146,7 +146,6 @@ private:
|
|||||||
core::dimension2df MaxStartSize, MinStartSize;
|
core::dimension2df MaxStartSize, MinStartSize;
|
||||||
|
|
||||||
u32 Time;
|
u32 Time;
|
||||||
u32 Emitted;
|
|
||||||
s32 MaxAngleDegrees;
|
s32 MaxAngleDegrees;
|
||||||
|
|
||||||
bool EveryMeshVertex;
|
bool EveryMeshVertex;
|
||||||
|
@ -25,7 +25,7 @@ CParticleBoxEmitter::CParticleBoxEmitter(
|
|||||||
MaxParticlesPerSecond(maxParticlesPerSecond),
|
MaxParticlesPerSecond(maxParticlesPerSecond),
|
||||||
MinStartColor(minStartColor), MaxStartColor(maxStartColor),
|
MinStartColor(minStartColor), MaxStartColor(maxStartColor),
|
||||||
MinLifeTime(lifeTimeMin), MaxLifeTime(lifeTimeMax),
|
MinLifeTime(lifeTimeMin), MaxLifeTime(lifeTimeMax),
|
||||||
Time(0), Emitted(0), MaxAngleDegrees(maxAngleDegrees)
|
Time(0), MaxAngleDegrees(maxAngleDegrees)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
setDebugName("CParticleBoxEmitter");
|
setDebugName("CParticleBoxEmitter");
|
||||||
|
@ -121,7 +121,6 @@ private:
|
|||||||
u32 MinLifeTime, MaxLifeTime;
|
u32 MinLifeTime, MaxLifeTime;
|
||||||
|
|
||||||
u32 Time;
|
u32 Time;
|
||||||
u32 Emitted;
|
|
||||||
s32 MaxAngleDegrees;
|
s32 MaxAngleDegrees;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ CParticleCylinderEmitter::CParticleCylinderEmitter(
|
|||||||
MaxParticlesPerSecond(maxParticlesPerSecond),
|
MaxParticlesPerSecond(maxParticlesPerSecond),
|
||||||
MinStartColor(minStartColor), MaxStartColor(maxStartColor),
|
MinStartColor(minStartColor), MaxStartColor(maxStartColor),
|
||||||
MinLifeTime(lifeTimeMin), MaxLifeTime(lifeTimeMax),
|
MinLifeTime(lifeTimeMin), MaxLifeTime(lifeTimeMax),
|
||||||
Radius(radius), Length(length), Time(0), Emitted(0),
|
Radius(radius), Length(length), Time(0),
|
||||||
MaxAngleDegrees(maxAngleDegrees), OutlineOnly(outlineOnly)
|
MaxAngleDegrees(maxAngleDegrees), OutlineOnly(outlineOnly)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
|
@ -150,7 +150,6 @@ private:
|
|||||||
f32 Length;
|
f32 Length;
|
||||||
|
|
||||||
u32 Time;
|
u32 Time;
|
||||||
u32 Emitted;
|
|
||||||
s32 MaxAngleDegrees;
|
s32 MaxAngleDegrees;
|
||||||
|
|
||||||
bool OutlineOnly;
|
bool OutlineOnly;
|
||||||
|
@ -27,7 +27,7 @@ CParticleRingEmitter::CParticleRingEmitter(
|
|||||||
MaxParticlesPerSecond(maxParticlesPerSecond),
|
MaxParticlesPerSecond(maxParticlesPerSecond),
|
||||||
MinStartColor(minStartColor), MaxStartColor(maxStartColor),
|
MinStartColor(minStartColor), MaxStartColor(maxStartColor),
|
||||||
MinLifeTime(lifeTimeMin), MaxLifeTime(lifeTimeMax),
|
MinLifeTime(lifeTimeMin), MaxLifeTime(lifeTimeMax),
|
||||||
Time(0), Emitted(0), MaxAngleDegrees(maxAngleDegrees)
|
Time(0), MaxAngleDegrees(maxAngleDegrees)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
setDebugName("CParticleRingEmitter");
|
setDebugName("CParticleRingEmitter");
|
||||||
|
@ -136,7 +136,6 @@ private:
|
|||||||
u32 MinLifeTime, MaxLifeTime;
|
u32 MinLifeTime, MaxLifeTime;
|
||||||
|
|
||||||
u32 Time;
|
u32 Time;
|
||||||
u32 Emitted;
|
|
||||||
s32 MaxAngleDegrees;
|
s32 MaxAngleDegrees;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ CParticleSphereEmitter::CParticleSphereEmitter(
|
|||||||
MaxParticlesPerSecond(maxParticlesPerSecond),
|
MaxParticlesPerSecond(maxParticlesPerSecond),
|
||||||
MinStartColor(minStartColor), MaxStartColor(maxStartColor),
|
MinStartColor(minStartColor), MaxStartColor(maxStartColor),
|
||||||
MinLifeTime(lifeTimeMin), MaxLifeTime(lifeTimeMax),
|
MinLifeTime(lifeTimeMin), MaxLifeTime(lifeTimeMax),
|
||||||
Time(0), Emitted(0), MaxAngleDegrees(maxAngleDegrees)
|
Time(0), MaxAngleDegrees(maxAngleDegrees)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
setDebugName("CParticleSphereEmitter");
|
setDebugName("CParticleSphereEmitter");
|
||||||
|
@ -129,7 +129,6 @@ private:
|
|||||||
u32 MinLifeTime, MaxLifeTime;
|
u32 MinLifeTime, MaxLifeTime;
|
||||||
|
|
||||||
u32 Time;
|
u32 Time;
|
||||||
u32 Emitted;
|
|
||||||
s32 MaxAngleDegrees;
|
s32 MaxAngleDegrees;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2286,6 +2286,7 @@ IMeshWriter* CSceneManager::createMeshWriter(EMESH_WRITER_TYPE type)
|
|||||||
case EMWT_COLLADA:
|
case EMWT_COLLADA:
|
||||||
case EMWT_STL:
|
case EMWT_STL:
|
||||||
case EMWT_OBJ:
|
case EMWT_OBJ:
|
||||||
|
case EMWT_PLY:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
#include "IrrCompileConfig.h"
|
#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_
|
#ifdef _IRR_WINDOWS_
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
@ -50,9 +50,6 @@ private:
|
|||||||
/** The current time used in the IPOs. */
|
/** The current time used in the IPOs. */
|
||||||
float m_current_time;
|
float m_current_time;
|
||||||
|
|
||||||
/** For cyclic animations: duration of the cycle. */
|
|
||||||
float m_cycle_length;
|
|
||||||
|
|
||||||
/** The inital position of this object. */
|
/** The inital position of this object. */
|
||||||
Vec3 m_initial_xyz;
|
Vec3 m_initial_xyz;
|
||||||
|
|
||||||
|
@ -257,7 +257,8 @@ void SFXManager::queueCommand(SFXCommand *command)
|
|||||||
race_manager->getMinorMode() != RaceManager::MINOR_MODE_CUTSCENE)
|
race_manager->getMinorMode() != RaceManager::MINOR_MODE_CUTSCENE)
|
||||||
{
|
{
|
||||||
if(command->m_command==SFX_POSITION || command->m_command==SFX_LOOP ||
|
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;
|
delete command;
|
||||||
static int count_messages = 0;
|
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 );
|
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"))
|
if (const XMLNode *music_node = root->getNode("music"))
|
||||||
{
|
{
|
||||||
std::string title_music;
|
std::string title_music;
|
||||||
|
@ -140,6 +140,9 @@ public:
|
|||||||
* be generated. */
|
* be generated. */
|
||||||
float m_replay_delta_angle;
|
float m_replay_delta_angle;
|
||||||
|
|
||||||
|
/** The field of view for 1, 2, 3, 4 player split screen. */
|
||||||
|
float m_camera_fov[4];
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** True if stk_config has been loaded. This is necessary if the
|
/** True if stk_config has been loaded. This is necessary if the
|
||||||
* --stk-config command line parameter has been specified to avoid
|
* --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()->use();
|
||||||
Primitive2DList::getInstance()->setUniforms();
|
Primitive2DList::getInstance()->setUniforms();
|
||||||
const video::SOverrideMaterial &m = irr_driver->getVideoDriver()
|
|
||||||
->getOverrideMaterial();
|
|
||||||
compressTexture(tex, false);
|
compressTexture(tex, false);
|
||||||
Primitive2DList::getInstance()->setTextureUnits(getTextureGLuint(tex));
|
Primitive2DList::getInstance()->setTextureUnits(getTextureGLuint(tex));
|
||||||
glDrawElements(GL_TRIANGLE_FAN, primitiveCount, GL_UNSIGNED_SHORT, 0);
|
glDrawElements(GL_TRIANGLE_FAN, primitiveCount, GL_UNSIGNED_SHORT, 0);
|
||||||
|
@ -223,7 +223,7 @@ void Camera::setupCamera()
|
|||||||
irr_driver->getActualScreenSize().Width,
|
irr_driver->getActualScreenSize().Width,
|
||||||
irr_driver->getActualScreenSize().Height);
|
irr_driver->getActualScreenSize().Height);
|
||||||
m_scaling = core::vector2df(1.0f, 1.0f);
|
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;
|
break;
|
||||||
case 2: m_viewport = core::recti(0,
|
case 2: m_viewport = core::recti(0,
|
||||||
m_index==0 ? 0
|
m_index==0 ? 0
|
||||||
@ -233,7 +233,7 @@ void Camera::setupCamera()
|
|||||||
: irr_driver->getActualScreenSize().Height);
|
: irr_driver->getActualScreenSize().Height);
|
||||||
m_scaling = core::vector2df(1.0f, 0.5f);
|
m_scaling = core::vector2df(1.0f, 0.5f);
|
||||||
m_aspect *= 2.0f;
|
m_aspect *= 2.0f;
|
||||||
m_fov = DEGREE_TO_RAD*65.0f;
|
m_fov = DEGREE_TO_RAD*stk_config->m_camera_fov[1];
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
/*
|
/*
|
||||||
@ -266,7 +266,7 @@ void Camera::setupCamera()
|
|||||||
const int y2 = (m_index<2 ? irr_driver->getActualScreenSize().Height>>1 : irr_driver->getActualScreenSize().Height);
|
const int y2 = (m_index<2 ? irr_driver->getActualScreenSize().Height>>1 : irr_driver->getActualScreenSize().Height);
|
||||||
m_viewport = core::recti(x1, y1, x2, y2);
|
m_viewport = core::recti(x1, y1, x2, y2);
|
||||||
m_scaling = core::vector2df(0.5f, 0.5f);
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -464,7 +464,7 @@ void Camera::getCameraSettings(float *above_kart, float *cam_angle,
|
|||||||
{
|
{
|
||||||
*above_kart = 0;
|
*above_kart = 0;
|
||||||
*cam_angle = 0;
|
*cam_angle = 0;
|
||||||
*distance = -m_kart->getKartModel()->getLength();
|
*distance = -m_kart->getKartModel()->getLength()-1.0f;
|
||||||
}
|
}
|
||||||
else if(UserConfigParams::m_camera_debug==4)
|
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)
|
// - the kart should not be visible, but it works)
|
||||||
m_camera->setNearValue(27.0);
|
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
|
// Update the first person camera
|
||||||
else if (UserConfigParams::m_camera_debug == 3)
|
else if (UserConfigParams::m_camera_debug == 3)
|
||||||
{
|
{
|
||||||
|
@ -329,7 +329,6 @@ private:
|
|||||||
void renderNormalsVisualisation();
|
void renderNormalsVisualisation();
|
||||||
void renderTransparent();
|
void renderTransparent();
|
||||||
void renderParticles();
|
void renderParticles();
|
||||||
void computeSunVisibility();
|
|
||||||
void renderShadows();
|
void renderShadows();
|
||||||
void renderRSM();
|
void renderRSM();
|
||||||
void renderGlow(std::vector<GlowData>& glows);
|
void renderGlow(std::vector<GlowData>& glows);
|
||||||
|
@ -77,12 +77,7 @@ int LODNode::getLevel()
|
|||||||
Camera* camera = Camera::getActiveCamera();
|
Camera* camera = Camera::getActiveCamera();
|
||||||
if (camera == NULL)
|
if (camera == NULL)
|
||||||
return (int)m_detail.size() - 1;
|
return (int)m_detail.size() - 1;
|
||||||
AbstractKart* kart = camera->getKart();
|
const Vec3 &pos = camera->getCameraSceneNode()->getAbsolutePosition();
|
||||||
// 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 int dist =
|
const int dist =
|
||||||
(int)((m_nodes[0]->getAbsolutePosition()).getDistanceFromSQ(pos.toIrrVector() ));
|
(int)((m_nodes[0]->getAbsolutePosition()).getDistanceFromSQ(pos.toIrrVector() ));
|
||||||
@ -153,7 +148,7 @@ void LODNode::updateVisibility(bool* shown)
|
|||||||
|
|
||||||
void LODNode::OnRegisterSceneNode()
|
void LODNode::OnRegisterSceneNode()
|
||||||
{
|
{
|
||||||
bool shown;
|
bool shown = false;
|
||||||
updateVisibility(&shown);
|
updateVisibility(&shown);
|
||||||
|
|
||||||
const u32 now = irr_driver->getDevice()->getTimer()->getTime();
|
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->MaterialType = Shaders::getShader(ES_GRASS_REF);
|
||||||
m->setTexture(1, glossytex);
|
m->setTexture(1, glossytex);
|
||||||
return;
|
return;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m->getTexture(0))
|
if (!m->getTexture(0))
|
||||||
|
@ -522,10 +522,6 @@ void IrrDriver::renderScene(scene::ICameraSceneNode * const camnode, unsigned po
|
|||||||
} // end glow
|
} // end glow
|
||||||
PROFILER_POP_CPU_MARKER();
|
PROFILER_POP_CPU_MARKER();
|
||||||
|
|
||||||
PROFILER_PUSH_CPU_MARKER("- Lensflare/godray", 0x00, 0xFF, 0xFF);
|
|
||||||
computeSunVisibility();
|
|
||||||
PROFILER_POP_CPU_MARKER();
|
|
||||||
|
|
||||||
// Render transparent
|
// Render transparent
|
||||||
{
|
{
|
||||||
PROFILER_PUSH_CPU_MARKER("- Transparent Pass", 0xFF, 0x00, 0x00);
|
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()
|
void IrrDriver::renderParticles()
|
||||||
{
|
{
|
||||||
glDepthMask(GL_FALSE);
|
glDepthMask(GL_FALSE);
|
||||||
|
@ -53,7 +53,10 @@ public:
|
|||||||
}; // SkyboxShader
|
}; // 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 *Coeff, float *Y00, float *Y1minus1,
|
||||||
float *Y10, float *Y11, float *Y2minus2,
|
float *Y10, float *Y11, float *Y2minus2,
|
||||||
float * Y2minus1, float * Y20, float *Y21,
|
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];
|
+ Y21[idx] * Coeff[7] + Y22[idx] * Coeff[8];
|
||||||
reconstructedVal /= solidangle;
|
reconstructedVal /= solidangle;
|
||||||
return MAX2(255.0f * reconstructedVal, 0.f);
|
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 *Y00[], float *Y1minus1[], float *Y10[],
|
||||||
float *Y11[], float *Y2minus2[], float *Y2minus1[],
|
float *Y11[], float *Y2minus2[], float *Y2minus1[],
|
||||||
float * Y20[], float *Y21[], float *Y22[],
|
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("L00:%f\n", SHCoeff[0]);
|
||||||
printf("L1-1:%f, L10:%f, L11:%f\n", SHCoeff[1], SHCoeff[2], SHCoeff[3]);
|
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",
|
printf("L2-2:%f, L2-1:%f, L20:%f, L21:%f, L22:%f\n",
|
||||||
SHCoeff[4], SHCoeff[5], SHCoeff[6], SHCoeff[7], SHCoeff[8]);
|
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,
|
void swapPixels(char *old_img, char *new_img, unsigned stride, unsigned old_i,
|
||||||
|
@ -64,7 +64,7 @@ private:
|
|||||||
|
|
||||||
bool m_diffuse_coefficients_calculated;
|
bool m_diffuse_coefficients_calculated;
|
||||||
|
|
||||||
unsigned shadowColorTex, shadowNormalTex, shadowDepthTex;
|
unsigned shadowColorTex, shadowDepthTex;
|
||||||
unsigned RSM_Color, RSM_Normal, RSM_Depth;
|
unsigned RSM_Color, RSM_Normal, RSM_Depth;
|
||||||
unsigned RH_Red, RH_Green, RH_Blue;
|
unsigned RH_Red, RH_Green, RH_Blue;
|
||||||
FrameBuffer* m_shadow_FBO, *m_RSM, *m_RH_FBO;
|
FrameBuffer* m_shadow_FBO, *m_RSM, *m_RH_FBO;
|
||||||
|
@ -18,23 +18,28 @@
|
|||||||
|
|
||||||
#include "graphics/shadow.hpp"
|
#include "graphics/shadow.hpp"
|
||||||
#include "graphics/irr_driver.hpp"
|
#include "graphics/irr_driver.hpp"
|
||||||
|
#include "karts/kart_properties.hpp"
|
||||||
|
|
||||||
#include <IMesh.h>
|
#include <IMesh.h>
|
||||||
#include <IMeshSceneNode.h>
|
#include <IMeshSceneNode.h>
|
||||||
#include <ISceneNode.h>
|
#include <ISceneNode.h>
|
||||||
|
|
||||||
Shadow::Shadow(video::ITexture *texture, scene::ISceneNode *node,
|
Shadow::Shadow(const KartProperties *kart_properties,
|
||||||
float scale = 1.0, float x_offset = 0.0, float y_offset = 0.0,
|
scene::ISceneNode *node,
|
||||||
float z_offset = 0.0)
|
float y_offset = 0.0)
|
||||||
{
|
{
|
||||||
|
m_shadow_enabled = false;
|
||||||
video::SMaterial m;
|
video::SMaterial m;
|
||||||
m.setTexture(0, texture);
|
m.setTexture(0, kart_properties->getShadowTexture());
|
||||||
m.BackfaceCulling = false;
|
m.BackfaceCulling = false;
|
||||||
m.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
m.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
||||||
m.setFlag(video::EMF_ZWRITE_ENABLE , false);
|
m.setFlag(video::EMF_ZWRITE_ENABLE , false);
|
||||||
m_mesh = irr_driver->createQuadMesh(&m, /*create_one_quad*/true);
|
m_mesh = irr_driver->createQuadMesh(&m, /*create_one_quad*/true);
|
||||||
scene::IMeshBuffer *buffer = m_mesh->getMeshBuffer(0);
|
scene::IMeshBuffer *buffer = m_mesh->getMeshBuffer(0);
|
||||||
irr::video::S3DVertex* v=(video::S3DVertex*)buffer->getVertices();
|
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[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[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;
|
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
|
} // ~Shadow
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
/** Removes the shadow, used for the simplified shadow when the kart is in
|
/** Updates the simulated shadow. It takes the offset (distance from visual
|
||||||
* the air.
|
* 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);
|
m_node->setVisible(enabled);
|
||||||
}
|
core::vector3df pos = m_node->getPosition();
|
||||||
// ----------------------------------------------------------------------------
|
pos.Y = offset;
|
||||||
/** Enables the shadow again, after it was disabled with disableShadow().
|
m_node->setPosition(pos);
|
||||||
*/
|
} // update
|
||||||
void Shadow::enableShadow()
|
|
||||||
{
|
|
||||||
m_node->setVisible(true);
|
|
||||||
}
|
|
||||||
// ----------------------------------------------------------------------------
|
|
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
#include "utils/no_copy.hpp"
|
#include "utils/no_copy.hpp"
|
||||||
|
|
||||||
#include <string>
|
class KartProperties;
|
||||||
|
|
||||||
namespace irr
|
namespace irr
|
||||||
{
|
{
|
||||||
@ -41,19 +41,24 @@ class Shadow : public NoCopy
|
|||||||
private:
|
private:
|
||||||
/** The scene node for the shadow. */
|
/** The scene node for the shadow. */
|
||||||
scene::ISceneNode *m_node;
|
scene::ISceneNode *m_node;
|
||||||
|
|
||||||
/** The mesh of the shadow. */
|
/** The mesh of the shadow. */
|
||||||
scene::IMesh *m_mesh;
|
scene::IMesh *m_mesh;
|
||||||
|
|
||||||
/** The scene node of the kart to which this shadow belongs. */
|
/** The scene node of the kart to which this shadow belongs. */
|
||||||
scene::ISceneNode *m_parent_kart_node;
|
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:
|
public:
|
||||||
Shadow(video::ITexture *texture, scene::ISceneNode *node,
|
Shadow(const KartProperties *kart_properties,
|
||||||
float scale, float x_offset, float y_offset,float z_offset);
|
scene::ISceneNode *node, float y_offset);
|
||||||
~Shadow();
|
~Shadow();
|
||||||
void enableShadow();
|
void update(bool enabled, float hot);
|
||||||
void disableShadow();
|
|
||||||
}; // Shadow
|
}; // Shadow
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
||||||
|
|
||||||
|
@ -55,9 +55,6 @@ private:
|
|||||||
/** For debugging: a simple quad to display where slipstream works. */
|
/** For debugging: a simple quad to display where slipstream works. */
|
||||||
scene::IMesh *m_debug_mesh;
|
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 length of the slipstream cylinder. This is used to scale
|
||||||
* the actual scene node correctly. */
|
* the actual scene node correctly. */
|
||||||
float m_length;
|
float m_length;
|
||||||
|
@ -1192,8 +1192,6 @@ namespace GUIEngine
|
|||||||
// further render)
|
// further render)
|
||||||
g_env->drawAll();
|
g_env->drawAll();
|
||||||
|
|
||||||
MessageQueue::update(elapsed_time);
|
|
||||||
|
|
||||||
// ---- some menus may need updating
|
// ---- some menus may need updating
|
||||||
if (gamestate != GAME)
|
if (gamestate != GAME)
|
||||||
{
|
{
|
||||||
@ -1215,6 +1213,7 @@ namespace GUIEngine
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MessageQueue::update(elapsed_time);
|
||||||
|
|
||||||
if (gamestate == INGAME_MENU && dynamic_cast<CutsceneWorld*>(World::getWorld()) != NULL)
|
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"];
|
params=&SkinConfig::m_render_params["spinner3::neutral"];
|
||||||
else if(player_id==3)
|
else if(player_id==3)
|
||||||
params=&SkinConfig::m_render_params["spinner4::neutral"];
|
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)
|
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),
|
: IGUIElement(EGUIET_LIST_BOX, environment, parent, id, rectangle), Selected(-1),
|
||||||
ItemHeight(0),ItemHeightOverride(0),
|
ItemHeight(0),ItemHeightOverride(0),
|
||||||
TotalItemHeight(0), ItemsIconWidth(0), Font(0), IconBank(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)
|
MoveOverSelect(moveOverSelect), AutoScroll(true), HighlightWhenNotFocused(true)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
|
@ -182,7 +182,6 @@ namespace irr
|
|||||||
gui::IGUISpriteBank* IconBank;
|
gui::IGUISpriteBank* IconBank;
|
||||||
gui::IGUIScrollBar* ScrollBar;
|
gui::IGUIScrollBar* ScrollBar;
|
||||||
u32 selectTime;
|
u32 selectTime;
|
||||||
u32 LastKeyTime;
|
|
||||||
core::stringw KeyBuffer;
|
core::stringw KeyBuffer;
|
||||||
bool Selecting;
|
bool Selecting;
|
||||||
bool DrawBack;
|
bool DrawBack;
|
||||||
|
@ -167,11 +167,34 @@ void IconButtonWidget::add()
|
|||||||
|
|
||||||
if (m_properties[PROP_LABELS_LOCATION] == "hover")
|
if (m_properties[PROP_LABELS_LOCATION] == "hover")
|
||||||
{
|
{
|
||||||
widget_size = rect<s32>(m_x - label_extra_size/2,
|
core::dimension2du text_size = GUIEngine::getFont()->getDimension(message.c_str());
|
||||||
m_y - (word_wrap ? GUIEngine::getFontHeight()*2 :
|
core::recti pos = btn->getAbsolutePosition();
|
||||||
GUIEngine::getFontHeight()) - 15,
|
int center_x = pos.UpperLeftCorner.X + pos.getWidth() / 2;
|
||||||
m_x + m_w + label_extra_size/2,
|
int x1 = center_x - text_size.Width / 2 - label_extra_size / 2;
|
||||||
m_y - 15);
|
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
|
else
|
||||||
{
|
{
|
||||||
|
@ -105,21 +105,8 @@ void LabelWidget::add()
|
|||||||
m_element->setTabStop(false);
|
m_element->setTabStop(false);
|
||||||
m_element->setTabGroup(false);
|
m_element->setTabGroup(false);
|
||||||
|
|
||||||
if (m_scroll_speed > 0)
|
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
|
|
||||||
{
|
|
||||||
m_element->setNotClipped(true);
|
m_element->setNotClipped(true);
|
||||||
}
|
|
||||||
} // add
|
} // add
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@ -139,16 +126,11 @@ void LabelWidget::setText(const wchar_t *text, bool expandIfNeeded)
|
|||||||
rect.LowerRightCorner.X = rect.UpperLeftCorner.X + fwidth;
|
rect.LowerRightCorner.X = rect.UpperLeftCorner.X + fwidth;
|
||||||
m_element->setRelativePosition(rect);
|
m_element->setRelativePosition(rect);
|
||||||
m_element->updateAbsolutePosition();
|
m_element->updateAbsolutePosition();
|
||||||
|
|
||||||
//((IGUIStaticText*)m_element)->setBackgroundColor( video::SColor(255,255,0,0) );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_scroll_speed > 0)
|
if (m_scroll_speed > 0)
|
||||||
{
|
|
||||||
//m_scroll_offset = (float)m_element->getAbsolutePosition().getWidth();
|
|
||||||
m_scroll_offset = (float)m_w;
|
m_scroll_offset = (float)m_w;
|
||||||
}
|
|
||||||
|
|
||||||
Widget::setText(text);
|
Widget::setText(text);
|
||||||
if (m_element)
|
if (m_element)
|
||||||
@ -181,7 +163,6 @@ bool LabelWidget::scrolledOff() const
|
|||||||
|
|
||||||
void LabelWidget::setScrollSpeed(float speed)
|
void LabelWidget::setScrollSpeed(float speed)
|
||||||
{
|
{
|
||||||
//m_scroll_offset = 0;
|
|
||||||
m_scroll_speed = speed;
|
m_scroll_speed = speed;
|
||||||
} // setScrollSpeed
|
} // setScrollSpeed
|
||||||
|
|
||||||
|
@ -44,6 +44,9 @@ namespace GUIEngine
|
|||||||
/** Current scroll offset. */
|
/** Current scroll offset. */
|
||||||
float m_scroll_offset;
|
float m_scroll_offset;
|
||||||
|
|
||||||
|
// Hide overloaded methods
|
||||||
|
using Widget::setText;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
LEAK_CHECK()
|
LEAK_CHECK()
|
||||||
|
@ -50,8 +50,6 @@ namespace GUIEngine
|
|||||||
AlignedArray<Vec3> m_model_scale;
|
AlignedArray<Vec3> m_model_scale;
|
||||||
std::vector<int> m_model_frames;
|
std::vector<int> m_model_frames;
|
||||||
|
|
||||||
video::ITexture* m_texture;
|
|
||||||
|
|
||||||
RTT* m_rtt_provider;
|
RTT* m_rtt_provider;
|
||||||
|
|
||||||
float angle;
|
float angle;
|
||||||
|
@ -30,8 +30,6 @@
|
|||||||
#include "states_screens/kart_selection.hpp"
|
#include "states_screens/kart_selection.hpp"
|
||||||
#include <IGUIEnvironment.h>
|
#include <IGUIEnvironment.h>
|
||||||
|
|
||||||
static const char RANDOM_KART_ID[] = "randomkart";
|
|
||||||
|
|
||||||
using namespace GUIEngine;
|
using namespace GUIEngine;
|
||||||
|
|
||||||
PlayerKartWidget::PlayerKartWidget(KartSelectionScreen* parent,
|
PlayerKartWidget::PlayerKartWidget(KartSelectionScreen* parent,
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
#include "items/flyable.hpp"
|
#include "items/flyable.hpp"
|
||||||
|
|
||||||
#include <math.h>
|
#include <cmath>
|
||||||
|
|
||||||
#include <IMeshManipulator.h>
|
#include <IMeshManipulator.h>
|
||||||
#include <IMeshSceneNode.h>
|
#include <IMeshSceneNode.h>
|
||||||
@ -231,7 +231,7 @@ void Flyable::getClosestKart(const AbstractKart **minKart,
|
|||||||
Vec3 delta = t.getOrigin()-trans_projectile.getOrigin();
|
Vec3 delta = t.getOrigin()-trans_projectile.getOrigin();
|
||||||
// the Y distance is added again because karts above or below should//
|
// the Y distance is added again because karts above or below should//
|
||||||
// not be prioritized when aiming
|
// 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;
|
- trans_projectile.getOrigin().getY())*2;
|
||||||
|
|
||||||
if(inFrontOf != NULL)
|
if(inFrontOf != NULL)
|
||||||
|
@ -374,7 +374,7 @@ void Item::collected(const AbstractKart *kart, float t)
|
|||||||
|
|
||||||
if (m_listener != NULL)
|
if (m_listener != NULL)
|
||||||
{
|
{
|
||||||
m_listener->onTriggerItemApproached(this);
|
m_listener->onTriggerItemApproached();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dynamic_cast<ThreeStrikesBattle*>(World::getWorld()) != NULL)
|
if (dynamic_cast<ThreeStrikesBattle*>(World::getWorld()) != NULL)
|
||||||
|
@ -51,7 +51,7 @@ class TriggerItemListener
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~TriggerItemListener() {}
|
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();
|
btTransform kart_transform = kart->getAlignedTransform();
|
||||||
btMatrix3x3 kart_rotation = kart_transform.getBasis();
|
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 heading =kart->getHeading();
|
||||||
float pitch = kart->getTerrainPitch(heading);
|
float pitch = kart->getTerrainPitch(heading);
|
||||||
|
@ -199,7 +199,7 @@ private:
|
|||||||
enum {PSA_DEFAULT, PSA_FIXED, PSA_NEW}
|
enum {PSA_DEFAULT, PSA_FIXED, PSA_NEW}
|
||||||
m_point_selection_algorithm;
|
m_point_selection_algorithm;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef AI_DEBUG
|
||||||
/** For skidding debugging: shows the estimated turn shape. */
|
/** For skidding debugging: shows the estimated turn shape. */
|
||||||
ShowCurve **m_curve;
|
ShowCurve **m_curve;
|
||||||
|
|
||||||
|
@ -62,6 +62,7 @@
|
|||||||
#include "physics/btKartRaycast.hpp"
|
#include "physics/btKartRaycast.hpp"
|
||||||
#include "physics/physics.hpp"
|
#include "physics/physics.hpp"
|
||||||
#include "race/history.hpp"
|
#include "race/history.hpp"
|
||||||
|
#include "tracks/terrain_info.hpp"
|
||||||
#include "tracks/track.hpp"
|
#include "tracks/track.hpp"
|
||||||
#include "tracks/track_manager.hpp"
|
#include "tracks/track_manager.hpp"
|
||||||
#include "utils/constants.hpp"
|
#include "utils/constants.hpp"
|
||||||
@ -74,7 +75,7 @@
|
|||||||
|
|
||||||
#include <algorithm> // for min and max
|
#include <algorithm> // for min and max
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <math.h>
|
#include <cmath>
|
||||||
|
|
||||||
|
|
||||||
#if defined(WIN32) && !defined(__CYGWIN__) && !defined(__MINGW32__)
|
#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_bubblegum_torque = 0.0f;
|
||||||
m_invulnerable_time = 0.0f;
|
m_invulnerable_time = 0.0f;
|
||||||
m_squash_time = 0.0f;
|
m_squash_time = 0.0f;
|
||||||
m_shadow_enabled = false;
|
|
||||||
|
|
||||||
m_shadow = NULL;
|
m_shadow = NULL;
|
||||||
m_wheel_box = NULL;
|
m_wheel_box = NULL;
|
||||||
@ -144,8 +144,6 @@ Kart::Kart (const std::string& ident, unsigned int world_kart_id,
|
|||||||
// Set position and heading:
|
// Set position and heading:
|
||||||
m_reset_transform = init_transform;
|
m_reset_transform = init_transform;
|
||||||
m_speed = 0.0f;
|
m_speed = 0.0f;
|
||||||
m_wheel_rotation = 0;
|
|
||||||
m_wheel_rotation_dt = 0;
|
|
||||||
|
|
||||||
m_kart_model->setKart(this);
|
m_kart_model->setKart(this);
|
||||||
|
|
||||||
@ -349,7 +347,6 @@ void Kart::reset()
|
|||||||
m_node->setScale(core::vector3df(1.0f, 1.0f, 1.0f));
|
m_node->setScale(core::vector3df(1.0f, 1.0f, 1.0f));
|
||||||
m_collected_energy = 0;
|
m_collected_energy = 0;
|
||||||
m_has_started = false;
|
m_has_started = false;
|
||||||
m_wheel_rotation = 0;
|
|
||||||
m_bounce_back_time = 0.0f;
|
m_bounce_back_time = 0.0f;
|
||||||
m_brake_time = 0.0f;
|
m_brake_time = 0.0f;
|
||||||
m_time_last_crash = 0.0f;
|
m_time_last_crash = 0.0f;
|
||||||
@ -387,22 +384,6 @@ void Kart::reset()
|
|||||||
{
|
{
|
||||||
m_vehicle->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);
|
setTrans(m_reset_transform);
|
||||||
|
|
||||||
@ -420,7 +401,7 @@ void Kart::reset()
|
|||||||
Vec3 front(0, 0, getKartLength()*0.5f);
|
Vec3 front(0, 0, getKartLength()*0.5f);
|
||||||
m_xyz_front = getTrans()(front);
|
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
|
// 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.
|
// 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
|
// All wheel positions are relative to the center of
|
||||||
// the collision shape.
|
// the collision shape.
|
||||||
wheel_pos[index].setX(x*0.5f*kart_width);
|
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 y position of the wheels (i.e. the points where
|
||||||
// the suspension is attached to) is just at the
|
// the suspension is attached to) is just at the
|
||||||
// bottom of the kart. That is half the kart height
|
// bottom of the kart. That is half the kart height
|
||||||
// down. The wheel radius is added to the suspension
|
// down.
|
||||||
// length in the physics, so we move the connection
|
wheel_pos[index].setY(- 0.5f*kart_height);
|
||||||
// point 'radius' up. That means that if the suspension
|
wheel_pos[index].setZ((0.5f*kart_length-0.25f)* z);
|
||||||
// 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);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -690,14 +666,13 @@ void Kart::createPhysics()
|
|||||||
|
|
||||||
// Add wheels
|
// Add wheels
|
||||||
// ----------
|
// ----------
|
||||||
float wheel_radius = m_characteristic->getWheelsRadius();
|
|
||||||
float suspension_rest = m_characteristic->getSuspensionRest();
|
float suspension_rest = m_characteristic->getSuspensionRest();
|
||||||
|
|
||||||
btVector3 wheel_direction(0.0f, -1.0f, 0.0f);
|
btVector3 wheel_direction(0.0f, -1.0f, 0.0f);
|
||||||
btVector3 wheel_axle(-1.0f, 0.0f, 0.0f);
|
btVector3 wheel_axle(-1.0f, 0.0f, 0.0f);
|
||||||
|
|
||||||
btKart::btVehicleTuning tuning;
|
btKart::btVehicleTuning tuning;
|
||||||
tuning.m_maxSuspensionTravelCm =
|
tuning.m_maxSuspensionTravel =
|
||||||
m_characteristic->getSuspensionTravelCm();
|
m_characteristic->getSuspensionTravelCm();
|
||||||
tuning.m_maxSuspensionForce =
|
tuning.m_maxSuspensionForce =
|
||||||
m_characteristic->getSuspensionMaxForce();
|
m_characteristic->getSuspensionMaxForce();
|
||||||
@ -709,7 +684,8 @@ void Kart::createPhysics()
|
|||||||
btWheelInfo& wheel = m_vehicle->addWheel(
|
btWheelInfo& wheel = m_vehicle->addWheel(
|
||||||
wheel_pos[i]+cs,
|
wheel_pos[i]+cs,
|
||||||
wheel_direction, wheel_axle, suspension_rest,
|
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_suspensionStiffness = m_characteristic->getSuspensionStiffness();
|
||||||
wheel.m_wheelsDampingRelaxation = m_characteristic->getWheelsDampingRelaxation();
|
wheel.m_wheelsDampingRelaxation = m_characteristic->getWheelsDampingRelaxation();
|
||||||
wheel.m_wheelsDampingCompression = m_characteristic->getWheelsDampingCompression();
|
wheel.m_wheelsDampingCompression = m_characteristic->getWheelsDampingCompression();
|
||||||
@ -1227,11 +1203,6 @@ void Kart::update(float dt)
|
|||||||
m_characteristic->getStabilityChassisAngularDamping());
|
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)
|
if(m_kart_animation)
|
||||||
m_kart_animation->update(dt);
|
m_kart_animation->update(dt);
|
||||||
|
|
||||||
@ -1281,14 +1252,6 @@ void Kart::update(float dt)
|
|||||||
new RescueAnimation(this, /*is_auto_rescue*/true);
|
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
|
// Make sure that the ray doesn't hit the kart. This is done by
|
||||||
// resetting the collision filter group, so that this collision
|
// resetting the collision filter group, so that this collision
|
||||||
// object is ignored during raycasting.
|
// object is ignored during raycasting.
|
||||||
@ -1302,7 +1265,34 @@ void Kart::update(float dt)
|
|||||||
Vec3 front(0, 0, getKartLength()*0.5f);
|
Vec3 front(0, 0, getKartLength()*0.5f);
|
||||||
m_xyz_front = getTrans()(front);
|
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())
|
if(m_body->getBroadphaseHandle())
|
||||||
{
|
{
|
||||||
m_body->getBroadphaseHandle()->m_collisionFilterGroup = old_group;
|
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
|
} // update
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -2326,7 +2301,7 @@ void Kart::updateEnginePowerAndBrakes(float dt)
|
|||||||
|
|
||||||
// If not giving power (forward or reverse gear), and speed is low
|
// 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
|
// 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_vehicle->setAllBrakes(20.0f);
|
||||||
} // !m_brake
|
} // !m_brake
|
||||||
} // not accelerating
|
} // not accelerating
|
||||||
@ -2481,12 +2456,8 @@ void Kart::loadData(RaceManager::KartType type, bool is_animated_model)
|
|||||||
|
|
||||||
if (!CVS->supportsShadows())
|
if (!CVS->supportsShadows())
|
||||||
{
|
{
|
||||||
m_shadow = new Shadow(m_kart_properties->getShadowTexture(),
|
m_shadow = new Shadow(m_kart_properties, m_node,
|
||||||
m_node,
|
-m_kart_model->getLowestPoint());
|
||||||
m_kart_properties->getShadowScale(),
|
|
||||||
m_kart_properties->getShadowXOffset(),
|
|
||||||
m_kart_properties->getGraphicalYOffset(),
|
|
||||||
m_kart_properties->getShadowZOffset());
|
|
||||||
}
|
}
|
||||||
World::getWorld()->kartAdded(this, m_node);
|
World::getWorld()->kartAdded(this, m_node);
|
||||||
} // loadData
|
} // loadData
|
||||||
@ -2520,11 +2491,12 @@ void Kart::applyEngineForce(float force)
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
/** Computes the transform of the graphical kart chasses with regards to the
|
/** Computes the transform of the graphical kart chasses with regards to the
|
||||||
* physical chassis. This function is called once the kart comes to rest
|
* physical chassis. This function is called once the kart comes to rest
|
||||||
* before the race starts. Based on the current physical kart position, it
|
* before the race starts (see World::resetAllKarts). Based on the current
|
||||||
* computes an (at this stage Y-only) offset by which the graphical chassis
|
* physical kart position it computes an (at this stage Y-only) offset by
|
||||||
* is moved so that it appears the way it is designed in blender. This means
|
* which the graphical chassis is moved so that it appears the way it is
|
||||||
* that the distance of the wheels from the chassis (i.e. suspension) appears
|
* designed in blender. This means that the distance of the wheels from the
|
||||||
* as in blender when karts are in rest.
|
* chassis (i.e. suspension) appears as in blender when karts are in rest.
|
||||||
|
* See updateGraphics for more details.
|
||||||
*/
|
*/
|
||||||
void Kart::kartIsInRestNow()
|
void Kart::kartIsInRestNow()
|
||||||
{
|
{
|
||||||
@ -2533,21 +2505,116 @@ void Kart::kartIsInRestNow()
|
|||||||
for(int i=0; i<m_vehicle->getNumWheels(); i++)
|
for(int i=0; i<m_vehicle->getNumWheels(); i++)
|
||||||
{
|
{
|
||||||
const btWheelInfo &wi = m_vehicle->getWheelInfo(i);
|
const btWheelInfo &wi = m_vehicle->getWheelInfo(i);
|
||||||
f += wi.m_chassisConnectionPointCS.getY()
|
f += wi.m_raycastInfo.m_suspensionLength;
|
||||||
- wi.m_raycastInfo.m_suspensionLength - wi.m_wheelsRadius;
|
|
||||||
}
|
}
|
||||||
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();
|
m_kart_model->setDefaultSuspension();
|
||||||
} // kartIsInRestNow
|
} // kartIsInRestNow
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
/** Updates the graphics model. Mainly set the graphical position to be the
|
/** Updates the graphics model. It is responsible for positioning the graphical
|
||||||
* same as the physics position, but uses offsets to position and rotation
|
* chasses at an 'appropriate' position: typically, the physical model has
|
||||||
* for special gfx effects (e.g. skidding will turn the karts more). These
|
* much longer suspension, so if the graphical chassis would be at the same
|
||||||
* variables are actually not used here atm, but are defined here and then
|
* location as the physical chassis, the wheels would be too far away.
|
||||||
* used in Moveable.
|
* 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 offset_xyz Offset to be added to the position.
|
||||||
* \param rotation Additional rotation.
|
* \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.
|
// 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.
|
// To avoid this, raise the kart enough to offset the leaning.
|
||||||
float lean_height = tan(fabsf(m_current_lean)) * getKartWidth()*0.5f;
|
float lean_height = tan(fabsf(m_current_lean)) * getKartWidth()*0.5f;
|
||||||
|
|
||||||
float heading = m_skidding->getVisualSkidRotation();
|
Vec3 center_shift(0, 0, 0);
|
||||||
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
|
|
||||||
// );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
center_shift.setY(m_skidding->getGraphicalJumpOffset()
|
||||||
|
+ lean_height
|
||||||
|
+m_graphical_y_offset);
|
||||||
center_shift = getTrans().getBasis() * center_shift;
|
center_shift = getTrans().getBasis() * center_shift;
|
||||||
|
|
||||||
|
float heading = m_skidding->getVisualSkidRotation();
|
||||||
Moveable::updateGraphics(dt, center_shift,
|
Moveable::updateGraphics(dt, center_shift,
|
||||||
btQuaternion(heading, 0, m_current_lean));
|
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
|
#ifdef XX
|
||||||
// cheap wheelie effect
|
// cheap wheelie effect
|
||||||
if (m_controls.m_nitro)
|
if (m_controls.m_nitro)
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
#include "items/powerup.hpp"
|
#include "items/powerup.hpp"
|
||||||
#include "karts/abstract_kart.hpp"
|
#include "karts/abstract_kart.hpp"
|
||||||
#include "karts/kart_properties.hpp"
|
#include "karts/kart_properties.hpp"
|
||||||
#include "tracks/terrain_info.hpp"
|
|
||||||
#include "utils/no_copy.hpp"
|
#include "utils/no_copy.hpp"
|
||||||
|
|
||||||
class btKart;
|
class btKart;
|
||||||
@ -51,6 +50,7 @@ class Skidding;
|
|||||||
class SkidMarks;
|
class SkidMarks;
|
||||||
class SlipStream;
|
class SlipStream;
|
||||||
class Stars;
|
class Stars;
|
||||||
|
class TerrainInfo;
|
||||||
|
|
||||||
/** The main kart class. All type of karts are of this object, but with
|
/** 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
|
* different controllers. The controllers are what turn a kart into a
|
||||||
@ -172,10 +172,6 @@ private:
|
|||||||
/** The shadow of a kart. */
|
/** The shadow of a kart. */
|
||||||
Shadow *m_shadow;
|
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;
|
ParticleEmitter *m_sky_particles_emitter;
|
||||||
|
|
||||||
/** All particle effects. */
|
/** All particle effects. */
|
||||||
@ -187,12 +183,6 @@ private:
|
|||||||
/** Handles all slipstreaming. */
|
/** Handles all slipstreaming. */
|
||||||
SlipStream *m_slipstream;
|
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. */
|
/** The skidmarks object for this kart. */
|
||||||
SkidMarks *m_skidmarks;
|
SkidMarks *m_skidmarks;
|
||||||
|
|
||||||
|
@ -49,21 +49,28 @@ float KartModel::UNDEFINED = -99.9f;
|
|||||||
|
|
||||||
SpeedWeightedObject::Properties::Properties()
|
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)
|
void SpeedWeightedObject::Properties::loadFromXMLNode(const XMLNode* xml_node)
|
||||||
{
|
{
|
||||||
xml_node->get("strength-factor", &m_strength_factor);
|
xml_node->get("strength-factor", &m_strength_factor);
|
||||||
xml_node->get("speed-factor", &m_speed_factor);
|
xml_node->get("speed-factor", &m_speed_factor);
|
||||||
xml_node->get("texture-speed-x", &m_texture_speed.X);
|
xml_node->get("texture-speed-x", &m_texture_speed.X);
|
||||||
xml_node->get("texture-speed-y", &m_texture_speed.Y);
|
xml_node->get("texture-speed-y", &m_texture_speed.Y);
|
||||||
}
|
} // SpeedWeightedObject::Properties::loadFromXMLNode
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
void SpeedWeightedObject::Properties::checkAllSet()
|
void SpeedWeightedObject::Properties::checkAllSet()
|
||||||
{
|
{
|
||||||
#define CHECK_NEG( a,strA) if(a<=SPEED_WEIGHTED_OBJECT_PROPERTY_UNDEFINED) { \
|
#define CHECK_NEG( a,strA) if(a<=SPEED_WEIGHTED_OBJECT_PROPERTY_UNDEFINED) \
|
||||||
Log::fatal("SpeedWeightedObject", "Missing default value for '%s'.", \
|
{ \
|
||||||
|
Log::fatal("SpeedWeightedObject", \
|
||||||
|
"Missing default value for '%s'.", \
|
||||||
strA); \
|
strA); \
|
||||||
}
|
}
|
||||||
CHECK_NEG(m_strength_factor, "speed-weighted strength-factor" );
|
CHECK_NEG(m_strength_factor, "speed-weighted strength-factor" );
|
||||||
@ -71,8 +78,9 @@ void SpeedWeightedObject::Properties::checkAllSet()
|
|||||||
CHECK_NEG(m_texture_speed.X, "speed-weighted texture speed X" );
|
CHECK_NEG(m_texture_speed.X, "speed-weighted texture speed X" );
|
||||||
CHECK_NEG(m_texture_speed.Y, "speed-weighted texture speed Y" );
|
CHECK_NEG(m_texture_speed.Y, "speed-weighted texture speed Y" );
|
||||||
#undef CHECK_NEG
|
#undef CHECK_NEG
|
||||||
}
|
} // SpeedWeightedObject::Properties::checkAllSet
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
/** Default constructor which initialises all variables with defaults.
|
/** Default constructor which initialises all variables with defaults.
|
||||||
* Note that the KartModel is copied, so make sure to update makeCopy
|
* Note that the KartModel is copied, so make sure to update makeCopy
|
||||||
* if any more variables are added to this object.
|
* if any more variables are added to this object.
|
||||||
@ -158,7 +166,7 @@ void KartModel::loadInfo(const XMLNode &node)
|
|||||||
animation_node->get("start-jump", &m_animation_frame[AF_JUMP_START]);
|
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("start-jump-loop",&m_animation_frame[AF_JUMP_LOOP] );
|
||||||
animation_node->get("end-jump", &m_animation_frame[AF_JUMP_END] );
|
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("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("end-speed-weighted", &m_animation_frame[AF_SPEED_WEIGHTED_END] );
|
||||||
animation_node->get("speed", &m_animation_speed );
|
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;
|
obj.m_node = NULL;
|
||||||
if(obj.m_model)
|
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->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
|
#ifdef DEBUG
|
||||||
std::string debug_name = obj.m_name+" (speed-weighted)";
|
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
|
// Load the wheel models. This can't be done early, since the default
|
||||||
// values for the graphical position must be defined, which in turn
|
// values for the graphical position must be defined, which in turn
|
||||||
// depend on the size of the model.
|
// depend on the size of the model.
|
||||||
@ -644,6 +646,14 @@ void KartModel::loadWheelInfo(const XMLNode &node,
|
|||||||
*/
|
*/
|
||||||
void KartModel::reset()
|
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);
|
update(0.0f, 0.0f, 0.0f, 0.0f);
|
||||||
|
|
||||||
// Stop any animations currently being played.
|
// Stop any animations currently being played.
|
||||||
@ -766,49 +776,44 @@ void KartModel::setDefaultSuspension()
|
|||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
/** Rotates and turns the wheels appropriately, and adjust for suspension
|
/** 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 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 steer The actual steer settings.
|
||||||
* \param suspension Suspension height for all four wheels.
|
* \param suspension Suspension height for all four wheels.
|
||||||
* \param speed The speed of the kart in meters/sec, used for the
|
* \param speed The speed of the kart in meters/sec, used for the
|
||||||
* speed-weighted objects' animations
|
* 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++)
|
for(unsigned int i=0; i<4; i++)
|
||||||
{
|
{
|
||||||
if(!m_kart || !m_wheel_node[i]) continue;
|
if (!m_kart || !m_wheel_node[i]) continue;
|
||||||
float rel_suspension = 0;
|
#ifdef DEBUG
|
||||||
if (!dynamic_cast<GhostKart*>(m_kart))
|
if (UserConfigParams::m_physics_debug &&
|
||||||
|
!dynamic_cast<GhostKart*>(m_kart) )
|
||||||
{
|
{
|
||||||
const btWheelInfo &wi = m_kart->getVehicle()->getWheelInfo(i);
|
const btWheelInfo &wi = m_kart->getVehicle()->getWheelInfo(i);
|
||||||
#ifdef DEBUG
|
|
||||||
if (UserConfigParams::m_physics_debug && m_kart)
|
|
||||||
{
|
|
||||||
// Make wheels that are not touching the ground invisible
|
// Make wheels that are not touching the ground invisible
|
||||||
m_wheel_node[i]->setVisible(wi.m_raycastInfo.m_isInContact);
|
m_wheel_node[i]->setVisible(wi.m_raycastInfo.m_isInContact);
|
||||||
}
|
}
|
||||||
#endif
|
#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();
|
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);
|
m_wheel_node[i]->setPosition(pos);
|
||||||
|
|
||||||
// Now calculate the new rotation: (old + change) mod 360
|
// Now calculate the new rotation: (old + change) mod 360
|
||||||
float new_rotation = m_wheel_node[i]->getRotation().X
|
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);
|
new_rotation = fmodf(new_rotation, 360);
|
||||||
core::vector3df wheel_rotation(new_rotation, 0, 0);
|
core::vector3df wheel_rotation(new_rotation, 0, 0);
|
||||||
// Only apply steer to first 2 wheels.
|
// Only apply steer to first 2 wheels.
|
||||||
|
@ -232,7 +232,7 @@ public:
|
|||||||
void loadInfo(const XMLNode &node);
|
void loadInfo(const XMLNode &node);
|
||||||
bool loadModels(const KartProperties &kart_properties);
|
bool loadModels(const KartProperties &kart_properties);
|
||||||
void setDefaultSuspension();
|
void setDefaultSuspension();
|
||||||
void update(float dt, float rotation_dt, float steer,
|
void update(float dt, float distance, float steer,
|
||||||
float speed);
|
float speed);
|
||||||
void finishedRace();
|
void finishedRace();
|
||||||
scene::ISceneNode*
|
scene::ISceneNode*
|
||||||
|
@ -82,19 +82,16 @@ KartProperties::KartProperties(const std::string &filename)
|
|||||||
// if everything is defined properly.
|
// if everything is defined properly.
|
||||||
m_wheel_base = m_friction_slip = m_collision_terrain_impulse =
|
m_wheel_base = m_friction_slip = m_collision_terrain_impulse =
|
||||||
m_collision_impulse = m_restitution = m_collision_impulse_time =
|
m_collision_impulse = m_restitution = m_collision_impulse_time =
|
||||||
m_max_lean = m_lean_speed = m_physical_wheel_position =
|
m_max_lean = m_lean_speed = m_physical_wheel_position = UNDEFINED;
|
||||||
m_graphical_y_offset = UNDEFINED;
|
|
||||||
|
|
||||||
m_terrain_impulse_type = IMPULSE_NONE;
|
m_terrain_impulse_type = IMPULSE_NONE;
|
||||||
m_gravity_center_shift = Vec3(UNDEFINED);
|
m_gravity_center_shift = Vec3(UNDEFINED);
|
||||||
m_bevel_factor = Vec3(UNDEFINED);
|
m_bevel_factor = Vec3(UNDEFINED);
|
||||||
m_prevent_chassis_in_terrain = false;
|
|
||||||
m_version = 0;
|
m_version = 0;
|
||||||
m_color = video::SColor(255, 0, 0, 0);
|
m_color = video::SColor(255, 0, 0, 0);
|
||||||
m_shape = 32; // close enough to a circle.
|
m_shape = 32; // close enough to a circle.
|
||||||
m_engine_sfx_type = "engine_small";
|
m_engine_sfx_type = "engine_small";
|
||||||
m_kart_model = NULL;
|
m_kart_model = NULL;
|
||||||
m_has_rand_wheels = false;
|
|
||||||
m_nitro_min_consumption = 0.53f;
|
m_nitro_min_consumption = 0.53f;
|
||||||
// The default constructor for stk_config uses filename=""
|
// The default constructor for stk_config uses filename=""
|
||||||
if (filename != "")
|
if (filename != "")
|
||||||
@ -282,7 +279,13 @@ void KartProperties::load(const std::string &filename, const std::string &node)
|
|||||||
{
|
{
|
||||||
m_gravity_center_shift.setX(0);
|
m_gravity_center_shift.setX(0);
|
||||||
// Default: center at the very bottom of the kart.
|
// Default: center at the very bottom of the kart.
|
||||||
|
// 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.setY(m_kart_model->getHeight()*0.5f);
|
||||||
|
|
||||||
m_gravity_center_shift.setZ(0);
|
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
|
// 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
|
// 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
|
// steering behaviour, the wheel base (which in turn determines the
|
||||||
// turn angle at certain speeds) is shortened by 2 * wheel_radius
|
// turn angle at certain speeds) is shortened by 2*wheel_radius
|
||||||
m_wheel_base = fabsf(m_kart_model->getLength() - 2 *
|
// Wheel radius was always 0.25, and is now not used anymore, but in order
|
||||||
m_combined_characteristic->getWheelsRadius());
|
// 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);
|
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("groups", &m_groups );
|
||||||
|
|
||||||
root->get("random-wheel-rot", &m_has_rand_wheels );
|
|
||||||
|
|
||||||
root->get("shadow-scale", &m_shadow_scale );
|
root->get("shadow-scale", &m_shadow_scale );
|
||||||
root->get("shadow-x-offset", &m_shadow_x_offset );
|
root->get("shadow-x-offset", &m_shadow_x_offset );
|
||||||
root->get("shadow-z-offset", &m_shadow_z_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;
|
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)
|
if(m_kart_model)
|
||||||
m_kart_model->loadInfo(*root);
|
m_kart_model->loadInfo(*root);
|
||||||
} // getAllData
|
} // getAllData
|
||||||
@ -501,7 +497,6 @@ void KartProperties::checkAllSet(const std::string &filename)
|
|||||||
|
|
||||||
CHECK_NEG(m_max_lean, "lean max" );
|
CHECK_NEG(m_max_lean, "lean max" );
|
||||||
CHECK_NEG(m_lean_speed, "lean speed" );
|
CHECK_NEG(m_lean_speed, "lean speed" );
|
||||||
CHECK_NEG(m_graphical_y_offset, "graphics y-offset" );
|
|
||||||
|
|
||||||
m_speed_weighted_object_properties.checkAllSet();
|
m_speed_weighted_object_properties.checkAllSet();
|
||||||
|
|
||||||
@ -554,4 +549,3 @@ float KartProperties::getAvgPower() const
|
|||||||
sum += gear_power_increase[i] * power;
|
sum += gear_power_increase[i] * power;
|
||||||
return sum / gear_power_increase.size();
|
return sum / gear_power_increase.size();
|
||||||
} // getAvgPower
|
} // getAvgPower
|
||||||
|
|
||||||
|
@ -159,11 +159,6 @@ private:
|
|||||||
* chassis. Useful for karts that don't have enough space for suspension
|
* chassis. Useful for karts that don't have enough space for suspension
|
||||||
* compression. */
|
* compression. */
|
||||||
float m_graphical_y_offset;
|
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. */
|
/** Wheel base of the kart. */
|
||||||
float m_wheel_base;
|
float m_wheel_base;
|
||||||
|
|
||||||
@ -326,18 +321,6 @@ public:
|
|||||||
/** Returns friction slip. */
|
/** Returns friction slip. */
|
||||||
float getFrictionSlip () const {return m_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 */
|
/** Returns parameters for the speed-weighted objects */
|
||||||
const SpeedWeightedObject::Properties& getSpeedWeightedObjectProperties() const
|
const SpeedWeightedObject::Properties& getSpeedWeightedObjectProperties() const
|
||||||
@ -417,8 +400,6 @@ public:
|
|||||||
/** The speed with which a kart should lean (in radians/s). */
|
/** The speed with which a kart should lean (in radians/s). */
|
||||||
float getLeanSpeed() const { return m_lean_speed; }
|
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
|
/** Returns minimum time during which nitro is consumed when pressing nitro
|
||||||
* key, to prevent using nitro in very short bursts
|
* key, to prevent using nitro in very short bursts
|
||||||
@ -443,5 +424,3 @@ public:
|
|||||||
}; // KartProperties
|
}; // KartProperties
|
||||||
|
|
||||||
#endif
|
#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()
|
void Skidding::reset()
|
||||||
{
|
{
|
||||||
m_skid_time = 0.0f;
|
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_skid_factor = 1.0f;
|
||||||
m_real_steering = 0.0f;
|
m_real_steering = 0.0f;
|
||||||
m_visual_rotation = 0.0f;
|
m_visual_rotation = 0.0f;
|
||||||
@ -95,20 +95,8 @@ void Skidding::reset()
|
|||||||
*/
|
*/
|
||||||
void Skidding::updateSteering(float steer, float dt)
|
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)
|
switch(m_skid_state)
|
||||||
{
|
{
|
||||||
case SKID_OLD: assert(false);
|
|
||||||
break;
|
|
||||||
case SKID_SHOW_GFX_LEFT:
|
case SKID_SHOW_GFX_LEFT:
|
||||||
case SKID_SHOW_GFX_RIGHT:
|
case SKID_SHOW_GFX_RIGHT:
|
||||||
case SKID_NONE:
|
case SKID_NONE:
|
||||||
@ -178,7 +166,6 @@ float Skidding::getSteeringWhenSkidding(float steering) const
|
|||||||
{
|
{
|
||||||
switch(m_skid_state)
|
switch(m_skid_state)
|
||||||
{
|
{
|
||||||
case SKID_OLD: assert(false); break;
|
|
||||||
case SKID_SHOW_GFX_LEFT:
|
case SKID_SHOW_GFX_LEFT:
|
||||||
case SKID_SHOW_GFX_RIGHT:
|
case SKID_SHOW_GFX_RIGHT:
|
||||||
case SKID_BREAK:
|
case SKID_BREAK:
|
||||||
@ -257,13 +244,6 @@ void Skidding::update(float dt, bool is_on_ground,
|
|||||||
else
|
else
|
||||||
if(m_skid_factor<1.0f) m_skid_factor = 1.0f;
|
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
|
// If skidding was started and a graphical jump should still
|
||||||
// be displayed, update the data
|
// be displayed, update the data
|
||||||
if(m_remaining_jump_time>0)
|
if(m_remaining_jump_time>0)
|
||||||
|
@ -74,7 +74,6 @@ private:
|
|||||||
float m_jump_speed;
|
float m_jump_speed;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/** SKID_OLD: old skidding, will be removed. */
|
|
||||||
/** SKID_NONE: Kart is currently not skidding.
|
/** SKID_NONE: Kart is currently not skidding.
|
||||||
* SKID_ACCUMULATE_LEFT: Kart is skidding to the left and accumulating
|
* SKID_ACCUMULATE_LEFT: Kart is skidding to the left and accumulating
|
||||||
* for bonus.
|
* for bonus.
|
||||||
@ -83,9 +82,8 @@ public:
|
|||||||
* and the kart was turning left.
|
* and the kart was turning left.
|
||||||
* SKID_SHOW_GFX_RIGHT: Similar for turning right.
|
* SKID_SHOW_GFX_RIGHT: Similar for turning right.
|
||||||
* SKID_BREAK: Skidding was stopped without bonus */
|
* SKID_BREAK: Skidding was stopped without bonus */
|
||||||
enum SkidState {SKID_OLD, SKID_NONE, SKID_ACCUMULATE_LEFT,
|
enum SkidState { SKID_NONE, SKID_ACCUMULATE_LEFT, SKID_ACCUMULATE_RIGHT,
|
||||||
SKID_ACCUMULATE_RIGHT, SKID_SHOW_GFX_LEFT,
|
SKID_SHOW_GFX_LEFT, SKID_SHOW_GFX_RIGHT, SKID_BREAK} ;
|
||||||
SKID_SHOW_GFX_RIGHT, SKID_BREAK} ;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** The current skidding state. */
|
/** The current skidding state. */
|
||||||
|
@ -549,6 +549,9 @@ void cmdLineHelp()
|
|||||||
" -h, --help Show this help.\n"
|
" -h, --help Show this help.\n"
|
||||||
" --log=N Set the verbosity to a value between\n"
|
" --log=N Set the verbosity to a value between\n"
|
||||||
" 0 (Debug) and 5 (Only Fatal messages)\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"
|
"\n"
|
||||||
"You can visit SuperTuxKart's homepage at "
|
"You can visit SuperTuxKart's homepage at "
|
||||||
"http://supertuxkart.sourceforge.net\n\n",
|
"http://supertuxkart.sourceforge.net\n\n",
|
||||||
|
@ -40,8 +40,7 @@
|
|||||||
MainLoop* main_loop = 0;
|
MainLoop* main_loop = 0;
|
||||||
|
|
||||||
MainLoop::MainLoop() :
|
MainLoop::MainLoop() :
|
||||||
m_abort(false),
|
m_abort(false)
|
||||||
m_frame_count(0)
|
|
||||||
{
|
{
|
||||||
m_curr_time = 0;
|
m_curr_time = 0;
|
||||||
m_prev_time = 0;
|
m_prev_time = 0;
|
||||||
|
@ -31,7 +31,6 @@ private:
|
|||||||
bool m_abort;
|
bool m_abort;
|
||||||
bool m_throttle_fps;
|
bool m_throttle_fps;
|
||||||
|
|
||||||
int m_frame_count;
|
|
||||||
Uint32 m_curr_time;
|
Uint32 m_curr_time;
|
||||||
Uint32 m_prev_time;
|
Uint32 m_prev_time;
|
||||||
float getLimitedDt();
|
float getLimitedDt();
|
||||||
|
@ -54,8 +54,11 @@ FollowTheLeaderRace::FollowTheLeaderRace() : LinearWorld()
|
|||||||
void FollowTheLeaderRace::init()
|
void FollowTheLeaderRace::init()
|
||||||
{
|
{
|
||||||
LinearWorld::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"));
|
getKart(0)->setOnScreenText(_("Leader"));
|
||||||
}
|
} // init
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
@ -83,6 +86,20 @@ void FollowTheLeaderRace::reset()
|
|||||||
m_is_over_delay = 2.0f;
|
m_is_over_delay = 2.0f;
|
||||||
} // reset
|
} // 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
|
/** 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.
|
* used by the race_gui to display the music credits in FTL mode correctly.
|
||||||
@ -169,43 +186,6 @@ void FollowTheLeaderRace::countdownReachedZero()
|
|||||||
music_manager->switchToFastMusic();
|
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
|
} // countdownReachedZero
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -233,6 +213,56 @@ bool FollowTheLeaderRace::isRaceOver()
|
|||||||
}
|
}
|
||||||
} // 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.
|
/** Returns the internal identifier for this kind of race.
|
||||||
*/
|
*/
|
||||||
|
@ -27,8 +27,11 @@
|
|||||||
class FollowTheLeaderRace : public LinearWorld
|
class FollowTheLeaderRace : public LinearWorld
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
std::vector<float> m_leader_intervals; // time till elimination in follow leader
|
// time till elimination in follow leader
|
||||||
float m_is_over_delay; //!< A timer used before terminating the race
|
std::vector<float> m_leader_intervals;
|
||||||
|
|
||||||
|
/** A timer used before terminating the race. */
|
||||||
|
float m_is_over_delay;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -37,6 +40,7 @@ public:
|
|||||||
|
|
||||||
// clock events
|
// clock events
|
||||||
virtual void countdownReachedZero() OVERRIDE;
|
virtual void countdownReachedZero() OVERRIDE;
|
||||||
|
virtual int getScoreForPosition(int p) OVERRIDE;
|
||||||
|
|
||||||
// overriding World methods
|
// overriding World methods
|
||||||
virtual void reset() OVERRIDE;
|
virtual void reset() OVERRIDE;
|
||||||
@ -46,10 +50,9 @@ public:
|
|||||||
virtual void getKartsDisplayInfo(
|
virtual void getKartsDisplayInfo(
|
||||||
std::vector<RaceGUIBase::KartIconDisplayInfo> *info) OVERRIDE;
|
std::vector<RaceGUIBase::KartIconDisplayInfo> *info) OVERRIDE;
|
||||||
virtual void init() OVERRIDE;
|
virtual void init() OVERRIDE;
|
||||||
|
virtual void terminateRace() OVERRIDE;
|
||||||
virtual bool isRaceOver() OVERRIDE;
|
virtual bool isRaceOver() OVERRIDE;
|
||||||
virtual bool raceHasLaps() OVERRIDE { return false; }
|
virtual bool raceHasLaps() OVERRIDE { return false; }
|
||||||
|
|
||||||
}; // FollowTheLeader
|
}; // FollowTheLeader
|
||||||
|
|
||||||
|
|
||||||
|
@ -173,7 +173,13 @@ public:
|
|||||||
{
|
{
|
||||||
return m_kart_info[kart_index].m_track_sector;
|
return m_kart_info[kart_index].m_track_sector;
|
||||||
} // getTrackSector
|
} // 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.
|
/** Returns how far the kart has driven so far (i.e.
|
||||||
* number-of-laps-finished times track-length plus distance-on-track.
|
* 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);
|
m_karts[n]->setEnergy(100.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
TrackObjectManager* tom = getTrack()->getTrackObjectManager();
|
TrackObjectManager* tom = getTrack()->getTrackObjectManager();
|
||||||
PtrVector<TrackObject>& objects = tom->getObjects();
|
PtrVector<TrackObject>& objects = tom->getObjects();
|
||||||
for(unsigned int i=0; i<objects.size(); i++)
|
for(unsigned int i=0; i<objects.size(); i++)
|
||||||
@ -145,6 +146,7 @@ void OverWorld::update(float dt)
|
|||||||
obj->reset();
|
obj->reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
if (m_return_to_garage)
|
if (m_return_to_garage)
|
||||||
{
|
{
|
||||||
|
@ -123,6 +123,7 @@ World::World() : WorldStatus(), m_clear_color(255,100,101,140)
|
|||||||
m_schedule_tutorial = false;
|
m_schedule_tutorial = false;
|
||||||
m_is_network_world = false;
|
m_is_network_world = false;
|
||||||
m_weather = NULL;
|
m_weather = NULL;
|
||||||
|
m_force_disable_fog = false;
|
||||||
|
|
||||||
m_stop_music_when_dialog_open = true;
|
m_stop_music_when_dialog_open = true;
|
||||||
|
|
||||||
@ -738,6 +739,12 @@ void World::moveKartTo(AbstractKart* kart, const btTransform &transform)
|
|||||||
kart->setRotation(pos.getRotation());
|
kart->setRotation(pos.getRotation());
|
||||||
|
|
||||||
kart->getBody()->setCenterOfMassTransform(pos);
|
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
|
// Project kart to surface of track
|
||||||
// This will set the physics transform
|
// This will set the physics transform
|
||||||
|
@ -37,6 +37,8 @@ void WorldWithRank::init()
|
|||||||
m_position_used.resize(m_karts.size());
|
m_position_used.resize(m_karts.size());
|
||||||
m_position_setting_initialised = false;
|
m_position_setting_initialised = false;
|
||||||
#endif
|
#endif
|
||||||
|
stk_config->getAllScores(&m_score_for_position, getNumKarts());
|
||||||
|
|
||||||
} // init
|
} // init
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -173,3 +175,13 @@ btTransform WorldWithRank::getRescueTransform(unsigned int rescue_pos) const
|
|||||||
return getTrack()->getStartTransform(rescue_pos);
|
return getTrack()->getStartTransform(rescue_pos);
|
||||||
} // getRescueTransform
|
} // 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 */
|
/** Whether to display the rank in the race GUI */
|
||||||
bool m_display_rank;
|
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
|
#ifdef DEBUG
|
||||||
/** Used for debugging to help detect if the same kart position
|
/** Used for debugging to help detect if the same kart position
|
||||||
* is used more than once. */
|
* is used more than once. */
|
||||||
@ -70,6 +74,8 @@ public:
|
|||||||
unsigned int position);
|
unsigned int position);
|
||||||
void endSetKartPositions();
|
void endSetKartPositions();
|
||||||
AbstractKart* getKartAtPosition(unsigned int p) const;
|
AbstractKart* getKartAtPosition(unsigned int p) const;
|
||||||
|
virtual int getScoreForPosition(int p);
|
||||||
|
|
||||||
|
|
||||||
virtual unsigned int getNumberOfRescuePositions() const OVERRIDE;
|
virtual unsigned int getNumberOfRescuePositions() const OVERRIDE;
|
||||||
virtual unsigned int getRescuePositionIndex(AbstractKart *kart) OVERRIDE;
|
virtual unsigned int getRescuePositionIndex(AbstractKart *kart) OVERRIDE;
|
||||||
|
@ -173,22 +173,29 @@ class NetworkString
|
|||||||
return result;
|
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 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 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 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 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 uint8_t getUInt8(int pos = 0) const { return get<uint8_t>(pos); }
|
||||||
inline char getChar(int pos = 0) const { return get<char,1>(pos); }
|
inline char getChar(int pos = 0) const { return get<char>(pos); }
|
||||||
inline unsigned char getUChar(int pos = 0) const { return get<unsigned char,1>(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); }
|
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 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 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 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 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 uint8_t gui8(int pos = 0) const { return get<uint8_t>(pos); }
|
||||||
inline char gc(int pos = 0) const { return get<char,1>(pos); }
|
inline char gc(int pos = 0) const { return get<char>(pos); }
|
||||||
inline unsigned char guc(int pos = 0) const { return get<unsigned char,1>(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); }
|
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
|
double getDouble(int pos = 0) //!< BEWARE OF PRECISION
|
||||||
@ -219,13 +226,22 @@ class NetworkString
|
|||||||
return result;
|
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 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 getAndRemoveUInt(int pos = 0) { return getAndRemove<uint32_t,4>(pos); }
|
||||||
inline uint32_t getAndRemoveUInt32(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 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 uint8_t getAndRemoveUInt8(int pos = 0) { return getAndRemove<uint8_t>(pos); }
|
||||||
inline char getAndRemoveChar(int pos = 0) { return getAndRemove<char,1>(pos); }
|
inline char getAndRemoveChar(int pos = 0) { return getAndRemove<char>(pos); }
|
||||||
inline unsigned char getAndRemoveUChar(int pos = 0) { return getAndRemove<unsigned char,1>(pos); }
|
inline unsigned char getAndRemoveUChar(int pos = 0) { return getAndRemove<unsigned char>(pos); }
|
||||||
double getAndRemoveDouble(int pos = 0) //!< BEWARE OF PRECISION
|
double getAndRemoveDouble(int pos = 0) //!< BEWARE OF PRECISION
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 8; i++)
|
for (int i = 0; i < 8; i++)
|
||||||
|
@ -47,6 +47,7 @@ bool SynchronizationProtocol::notifyEventAsynchronous(Event* event)
|
|||||||
uint32_t sequence = data.gui32(6);
|
uint32_t sequence = data.gui32(6);
|
||||||
|
|
||||||
std::vector<STKPeer*> peers = NetworkManager::getInstance()->getPeers();
|
std::vector<STKPeer*> peers = NetworkManager::getInstance()->getPeers();
|
||||||
|
assert(peers.size() > 0);
|
||||||
|
|
||||||
if (m_listener->isServer())
|
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++)
|
for (unsigned int i = 0; i < peers.size(); i++)
|
||||||
{
|
{
|
||||||
if (peers[i]->isSamePeer(*event->peer))
|
if (peers[i]->isSamePeer(*event->peer))
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
template<typename S>
|
template<typename S>
|
||||||
S getHighestInHistogram(std::map<S,int>* histogram)
|
S getHighestInHistogram(std::map<S,int>* histogram)
|
||||||
{
|
{
|
||||||
S best_item;
|
S best_item = histogram->begin()->first;
|
||||||
uint8_t highest_count = histogram->begin()->second;
|
uint8_t highest_count = histogram->begin()->second;
|
||||||
for (typename std::map<S, int>::iterator it = histogram->begin();
|
for (typename std::map<S, int>::iterator it = histogram->begin();
|
||||||
it != histogram->end(); it++)
|
it != histogram->end(); it++)
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include "karts/kart.hpp"
|
#include "karts/kart.hpp"
|
||||||
#include "modes/world.hpp"
|
#include "modes/world.hpp"
|
||||||
#include "physics/triangle_mesh.hpp"
|
#include "physics/triangle_mesh.hpp"
|
||||||
|
#include "tracks/terrain_info.hpp"
|
||||||
#include "tracks/track.hpp"
|
#include "tracks/track.hpp"
|
||||||
|
|
||||||
#define ROLLING_INFLUENCE_FIX
|
#define ROLLING_INFLUENCE_FIX
|
||||||
@ -84,7 +85,7 @@ btWheelInfo& btKart::addWheel(const btVector3& connectionPointCS,
|
|||||||
ci.m_wheelsDampingCompression = tuning.m_suspensionCompression;
|
ci.m_wheelsDampingCompression = tuning.m_suspensionCompression;
|
||||||
ci.m_wheelsDampingRelaxation = tuning.m_suspensionDamping;
|
ci.m_wheelsDampingRelaxation = tuning.m_suspensionDamping;
|
||||||
ci.m_frictionSlip = tuning.m_frictionSlip;
|
ci.m_frictionSlip = tuning.m_frictionSlip;
|
||||||
ci.m_maxSuspensionTravelCm = tuning.m_maxSuspensionTravelCm;
|
ci.m_maxSuspensionTravel = tuning.m_maxSuspensionTravel;
|
||||||
ci.m_maxSuspensionForce = tuning.m_maxSuspensionForce;
|
ci.m_maxSuspensionForce = tuning.m_maxSuspensionForce;
|
||||||
|
|
||||||
m_wheelInfo.push_back( btWheelInfo(ci));
|
m_wheelInfo.push_back( btWheelInfo(ci));
|
||||||
@ -113,7 +114,6 @@ void btKart::reset()
|
|||||||
{
|
{
|
||||||
btWheelInfo &wheel = m_wheelInfo[i];
|
btWheelInfo &wheel = m_wheelInfo[i];
|
||||||
wheel.m_raycastInfo.m_suspensionLength = 0;
|
wheel.m_raycastInfo.m_suspensionLength = 0;
|
||||||
wheel.m_rotation = 0;
|
|
||||||
updateWheelTransform(i, true);
|
updateWheelTransform(i, true);
|
||||||
}
|
}
|
||||||
m_visual_wheels_touch_ground = false;
|
m_visual_wheels_touch_ground = false;
|
||||||
@ -160,16 +160,13 @@ void btKart::updateWheelTransform(int wheelIndex, bool interpolatedTransform)
|
|||||||
btQuaternion steeringOrn(up,steering);//wheel.m_steering);
|
btQuaternion steeringOrn(up,steering);//wheel.m_steering);
|
||||||
btMatrix3x3 steeringMat(steeringOrn);
|
btMatrix3x3 steeringMat(steeringOrn);
|
||||||
|
|
||||||
btQuaternion rotatingOrn(right,-wheel.m_rotation);
|
|
||||||
btMatrix3x3 rotatingMat(rotatingOrn);
|
|
||||||
|
|
||||||
btMatrix3x3 basis2(
|
btMatrix3x3 basis2(
|
||||||
right[0],fwd[0],up[0],
|
right[0],fwd[0],up[0],
|
||||||
right[1],fwd[1],up[1],
|
right[1],fwd[1],up[1],
|
||||||
right[2],fwd[2],up[2]
|
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_worldTransform.setOrigin(
|
||||||
wheel.m_raycastInfo.m_hardPointWS
|
wheel.m_raycastInfo.m_hardPointWS
|
||||||
+ wheel.m_raycastInfo.m_wheelDirectionWS
|
+ wheel.m_raycastInfo.m_wheelDirectionWS
|
||||||
@ -236,8 +233,8 @@ btScalar btKart::rayCast(unsigned int index)
|
|||||||
|
|
||||||
updateWheelTransformsWS( wheel,false);
|
updateWheelTransformsWS( wheel,false);
|
||||||
|
|
||||||
btScalar max_susp_len = wheel.getSuspensionRestLength()+wheel.m_wheelsRadius
|
btScalar max_susp_len = wheel.getSuspensionRestLength()
|
||||||
+ wheel.m_maxSuspensionTravelCm*0.01f;
|
+ wheel.m_maxSuspensionTravel;
|
||||||
|
|
||||||
// Do a slightly longer raycast to see if the kart might soon hit the
|
// 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
|
// 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_triangle_index = rayResults.m_triangle_index;;
|
||||||
wheel.m_raycastInfo.m_groundObject = &getFixedBody();
|
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
|
//clamp on max suspension travel
|
||||||
btScalar minSuspensionLength = wheel.getSuspensionRestLength()
|
btScalar minSuspensionLength = wheel.getSuspensionRestLength()
|
||||||
- wheel.m_maxSuspensionTravelCm*btScalar(0.01);
|
- wheel.m_maxSuspensionTravel;
|
||||||
btScalar maxSuspensionLength = wheel.getSuspensionRestLength()
|
btScalar maxSuspensionLength = wheel.getSuspensionRestLength()
|
||||||
+ wheel.m_maxSuspensionTravelCm*btScalar(0.01);
|
+ wheel.m_maxSuspensionTravel;
|
||||||
if (wheel.m_raycastInfo.m_suspensionLength < minSuspensionLength)
|
if (wheel.m_raycastInfo.m_suspensionLength < minSuspensionLength)
|
||||||
{
|
{
|
||||||
wheel.m_raycastInfo.m_suspensionLength = minSuspensionLength;
|
wheel.m_raycastInfo.m_suspensionLength = minSuspensionLength;
|
||||||
@ -366,13 +363,20 @@ const btTransform& btKart::getChassisWorldTransform() const
|
|||||||
} // getChassisWorldTransform
|
} // getChassisWorldTransform
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
void btKart::updateVehicle( btScalar step )
|
void btKart::updateAllWheelPositions()
|
||||||
{
|
{
|
||||||
for (int i=0;i<getNumWheels();i++)
|
for (int i=0;i<getNumWheels();i++)
|
||||||
{
|
{
|
||||||
updateWheelTransform(i,false);
|
updateWheelTransform(i,false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // updateAllWheelPositions
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
void btKart::updateVehicle( btScalar step )
|
||||||
|
{
|
||||||
|
updateAllWheelPositions();
|
||||||
|
|
||||||
const btTransform& chassisTrans = getChassisWorldTransform();
|
const btTransform& chassisTrans = getChassisWorldTransform();
|
||||||
|
|
||||||
btVector3 forwardW(chassisTrans.getBasis()[0][m_indexForwardAxis],
|
btVector3 forwardW(chassisTrans.getBasis()[0][m_indexForwardAxis],
|
||||||
@ -444,6 +448,16 @@ void btKart::updateVehicle( btScalar step )
|
|||||||
btVector3 kart_up = getChassisWorldTransform().getBasis().getColumn(1);
|
btVector3 kart_up = getChassisWorldTransform().getBasis().getColumn(1);
|
||||||
btVector3 terrain_up(0,1,0);
|
btVector3 terrain_up(0,1,0);
|
||||||
btVector3 axis = kart_up.cross(terrain_up);
|
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
|
// Give a nicely balanced feeling for rebalancing the kart
|
||||||
m_chassisBody->applyTorqueImpulse(axis * m_kart->getCharacteristic()->getStabilitySmoothFlyingImpulse());
|
m_chassisBody->applyTorqueImpulse(axis * m_kart->getCharacteristic()->getStabilitySmoothFlyingImpulse());
|
||||||
}
|
}
|
||||||
@ -525,15 +539,8 @@ void btKart::updateVehicle( btScalar step )
|
|||||||
|
|
||||||
btScalar proj2 = fwd.dot(vel);
|
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)
|
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++)
|
for (int v=0;v<getNumWheels();v++)
|
||||||
{
|
{
|
||||||
btVector3 wheelColor(0,1,1);
|
btVector3 wheelColor(0,1,1);
|
||||||
|
@ -37,7 +37,7 @@ public:
|
|||||||
:m_suspensionStiffness(btScalar(5.88)),
|
:m_suspensionStiffness(btScalar(5.88)),
|
||||||
m_suspensionCompression(btScalar(0.83)),
|
m_suspensionCompression(btScalar(0.83)),
|
||||||
m_suspensionDamping(btScalar(0.88)),
|
m_suspensionDamping(btScalar(0.88)),
|
||||||
m_maxSuspensionTravelCm(btScalar(500.)),
|
m_maxSuspensionTravel(btScalar(5.)),
|
||||||
m_frictionSlip(btScalar(10.5)),
|
m_frictionSlip(btScalar(10.5)),
|
||||||
m_maxSuspensionForce(btScalar(6000.))
|
m_maxSuspensionForce(btScalar(6000.))
|
||||||
{
|
{
|
||||||
@ -46,7 +46,7 @@ public:
|
|||||||
btScalar m_suspensionStiffness;
|
btScalar m_suspensionStiffness;
|
||||||
btScalar m_suspensionCompression;
|
btScalar m_suspensionCompression;
|
||||||
btScalar m_suspensionDamping;
|
btScalar m_suspensionDamping;
|
||||||
btScalar m_maxSuspensionTravelCm;
|
btScalar m_maxSuspensionTravel;
|
||||||
btScalar m_frictionSlip;
|
btScalar m_frictionSlip;
|
||||||
btScalar m_maxSuspensionForce;
|
btScalar m_maxSuspensionForce;
|
||||||
|
|
||||||
@ -180,6 +180,7 @@ public:
|
|||||||
void setSliding(bool active);
|
void setSliding(bool active);
|
||||||
void instantSpeedIncreaseTo(float speed);
|
void instantSpeedIncreaseTo(float speed);
|
||||||
void capSpeed(float max_speed);
|
void capSpeed(float max_speed);
|
||||||
|
void updateAllWheelPositions();
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
/** Returns true if both rear visual wheels touch the ground. */
|
/** Returns true if both rear visual wheels touch the ground. */
|
||||||
bool visualWheelsTouchGround() const
|
bool visualWheelsTouchGround() const
|
||||||
|
@ -173,7 +173,7 @@ void Physics::update(float dt)
|
|||||||
Scripting::ScriptEngine* script_engine = World::getWorld()->getScriptEngine();
|
Scripting::ScriptEngine* script_engine = World::getWorld()->getScriptEngine();
|
||||||
int kartid1 = p->getUserPointer(0)->getPointerKart()->getWorldKartId();
|
int kartid1 = p->getUserPointer(0)->getPointerKart()->getWorldKartId();
|
||||||
int kartid2 = p->getUserPointer(1)->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) {
|
[=](asIScriptContext* ctx) {
|
||||||
ctx->SetArgDWord(0, kartid1);
|
ctx->SetArgDWord(0, kartid1);
|
||||||
ctx->SetArgDWord(1, kartid2);
|
ctx->SetArgDWord(1, kartid2);
|
||||||
@ -202,7 +202,7 @@ void Physics::update(float dt)
|
|||||||
|
|
||||||
if (scripting_function.size() > 0)
|
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) {
|
[&](asIScriptContext* ctx) {
|
||||||
ctx->SetArgDWord(0, kartId);
|
ctx->SetArgDWord(0, kartId);
|
||||||
ctx->SetArgObject(1, lib_id_ptr);
|
ctx->SetArgObject(1, lib_id_ptr);
|
||||||
@ -275,7 +275,7 @@ void Physics::update(float dt)
|
|||||||
std::string scripting_function = obj->getOnItemCollisionFunction();
|
std::string scripting_function = obj->getOnItemCollisionFunction();
|
||||||
if (scripting_function.size() > 0)
|
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) {
|
[&](asIScriptContext* ctx) {
|
||||||
ctx->SetArgDWord(0, (int)flyable->getType());
|
ctx->SetArgDWord(0, (int)flyable->getType());
|
||||||
ctx->SetArgDWord(1, flyable->getOwnerId());
|
ctx->SetArgDWord(1, flyable->getOwnerId());
|
||||||
|
@ -416,7 +416,6 @@ void RaceManager::startNextRace()
|
|||||||
// Uncomment to debug audio leaks
|
// Uncomment to debug audio leaks
|
||||||
// sfx_manager->dump();
|
// sfx_manager->dump();
|
||||||
|
|
||||||
stk_config->getAllScores(&m_score_for_position, m_num_karts);
|
|
||||||
IrrlichtDevice* device = irr_driver->getDevice();
|
IrrlichtDevice* device = irr_driver->getDevice();
|
||||||
GUIEngine::renderLoading();
|
GUIEngine::renderLoading();
|
||||||
device->getVideoDriver()->endScene();
|
device->getVideoDriver()->endScene();
|
||||||
@ -760,7 +759,17 @@ void RaceManager::kartFinishedRace(const AbstractKart *kart, float time)
|
|||||||
assert(pos-1 < (int)m_kart_status.size());
|
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_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_overall_time += time;
|
||||||
m_kart_status[id].m_last_time = time;
|
m_kart_status[id].m_last_time = time;
|
||||||
m_num_finished_karts ++;
|
m_num_finished_karts ++;
|
||||||
|
@ -313,10 +313,6 @@ private:
|
|||||||
/** Whether a track should be reversed */
|
/** Whether a track should be reversed */
|
||||||
std::vector<bool> m_reverse_track;
|
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. */
|
/** The list of default AI karts to use. This is from the command line. */
|
||||||
std::vector<std::string> m_default_ai_list;
|
std::vector<std::string> m_default_ai_list;
|
||||||
|
|
||||||
@ -592,8 +588,6 @@ public:
|
|||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
float getTimeTarget() const { return m_time_target; }
|
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; }
|
int getTrackNumber() const { return m_track_number; }
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
/** Returns the list of AI karts to use. Used for networking, and for
|
/** Returns the list of AI karts to use. Used for networking, and for
|
||||||
|
@ -175,20 +175,20 @@ namespace Scripting
|
|||||||
/** runs the specified script
|
/** runs the specified script
|
||||||
* \param string scriptName = name of script to run
|
* \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*)> callback;
|
||||||
std::function<void(asIScriptContext*)> get_return_value;
|
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*)> callback)
|
||||||
{
|
{
|
||||||
std::function<void(asIScriptContext*)> get_return_value;
|
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
|
/** runs the specified script
|
||||||
* \param string scriptName = name of script to run
|
* \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*)> callback,
|
||||||
std::function<void(asIScriptContext*)> get_return_value)
|
std::function<void(asIScriptContext*)> get_return_value)
|
||||||
{
|
{
|
||||||
@ -217,6 +217,9 @@ namespace Scripting
|
|||||||
|
|
||||||
if (func == NULL)
|
if (func == NULL)
|
||||||
{
|
{
|
||||||
|
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());
|
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
|
m_functions_cache[function_name] = NULL; // remember that this function is unavailable
|
||||||
return;
|
return;
|
||||||
@ -233,6 +236,8 @@ namespace Scripting
|
|||||||
|
|
||||||
if (func == NULL)
|
if (func == NULL)
|
||||||
{
|
{
|
||||||
|
if (warn_if_not_found)
|
||||||
|
Log::warn("Scripting", "Scripting function was not found : %s", function_name.c_str());
|
||||||
return; // function unavailable
|
return; // function unavailable
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -425,7 +430,7 @@ namespace Scripting
|
|||||||
curr.m_time -= dt;
|
curr.m_time -= dt;
|
||||||
if (curr.m_time <= 0.0)
|
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);
|
m_pending_timeouts.erase(m_pending_timeouts.begin() + i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,10 +47,10 @@ namespace Scripting
|
|||||||
ScriptEngine();
|
ScriptEngine();
|
||||||
~ScriptEngine();
|
~ScriptEngine();
|
||||||
|
|
||||||
void runFunction(std::string function_name);
|
void runFunction(bool warn_if_not_found, std::string function_name);
|
||||||
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*)> 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*)> callback,
|
||||||
std::function<void(asIScriptContext*)> get_return_value);
|
std::function<void(asIScriptContext*)> get_return_value);
|
||||||
void evalScript(std::string script_fragment);
|
void evalScript(std::string script_fragment);
|
||||||
|
@ -55,7 +55,6 @@ namespace Scripting
|
|||||||
kart->setXYZ(v);
|
kart->setXYZ(v);
|
||||||
unsigned int index = World::getWorld()->getRescuePositionIndex(kart);
|
unsigned int index = World::getWorld()->getRescuePositionIndex(kart);
|
||||||
btTransform s = World::getWorld()->getRescueTransform(index);
|
btTransform s = World::getWorld()->getRescueTransform(index);
|
||||||
const btVector3 &xyz = s.getOrigin();
|
|
||||||
s.setRotation(btQuaternion(btVector3(0.0f, 1.0f, 0.0f), 0.0f));
|
s.setRotation(btQuaternion(btVector3(0.0f, 1.0f, 0.0f), 0.0f));
|
||||||
World::getWorld()->moveKartTo(kart, s);
|
World::getWorld()->moveKartTo(kart, s);
|
||||||
}
|
}
|
||||||
|
@ -101,11 +101,11 @@ namespace Scripting
|
|||||||
return StringUtils::wide_to_utf8(out.c_str());
|
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)
|
void runScript(const std::string* str)
|
||||||
{
|
{
|
||||||
ScriptEngine* script_engine = World::getWorld()->getScriptEngine();
|
ScriptEngine* script_engine = World::getWorld()->getScriptEngine();
|
||||||
script_engine->runFunction(*str);
|
script_engine->runFunction(true, *str);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Generate a random integer value */
|
/** 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; }
|
void setSubtitle(const core::stringw& subtitle) { m_subtitle = subtitle; }
|
||||||
|
|
||||||
virtual void renderGlobal(float dt);
|
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
|
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;
|
float f = ((int)(n/1024.0f/1024.0f*10.0f+0.5f))/10.0f;
|
||||||
char s[32];
|
char s[32];
|
||||||
sprintf(s, "%.1f", f);
|
sprintf(s, "%.1f", f);
|
||||||
unit=_("%s MB", s);
|
unit = _LTR("%s MB", s);
|
||||||
}
|
}
|
||||||
else if(n>1024)
|
else if(n>1024)
|
||||||
{
|
{
|
||||||
float f = ((int)(n/1024.0f*10.0f+0.5f))/10.0f;
|
float f = ((int)(n/1024.0f*10.0f+0.5f))/10.0f;
|
||||||
char s[32];
|
char s[32];
|
||||||
sprintf(s, "%.1f", f);
|
sprintf(s, "%.1f", f);
|
||||||
unit=_("%s KB", s);
|
unit = _LTR("%s KB", s);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
// Anything smaller just let it be 1 KB
|
// 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());
|
core::stringw size = _("Size: %s", unit.c_str());
|
||||||
getWidget<LabelWidget>("size")->setText(size, false);
|
getWidget<LabelWidget>("size")->setText(size, false);
|
||||||
} // AddonsLoading
|
} // AddonsLoading
|
||||||
|
@ -34,7 +34,6 @@ namespace Online { class HTTPRequest; }
|
|||||||
class AddonsLoading : public GUIEngine::ModalDialog
|
class AddonsLoading : public GUIEngine::ModalDialog
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
GUIEngine::LabelWidget *m_state;
|
|
||||||
GUIEngine::ProgressBarWidget *m_progress;
|
GUIEngine::ProgressBarWidget *m_progress;
|
||||||
GUIEngine::IconButtonWidget *m_back_button;
|
GUIEngine::IconButtonWidget *m_back_button;
|
||||||
GUIEngine::IconButtonWidget *m_install_button;
|
GUIEngine::IconButtonWidget *m_install_button;
|
||||||
|
@ -52,7 +52,6 @@ using namespace irr::core;
|
|||||||
using namespace irr::gui;
|
using namespace irr::gui;
|
||||||
using namespace irr::video;
|
using namespace irr::video;
|
||||||
|
|
||||||
const float ANIM_FROM = 3.0f;
|
|
||||||
const float ANIM_TO = 7.0f;
|
const float ANIM_TO = 7.0f;
|
||||||
const int GIFT_EXIT_FROM = (int)ANIM_TO;
|
const int GIFT_EXIT_FROM = (int)ANIM_TO;
|
||||||
const int GIFT_EXIT_TO = GIFT_EXIT_FROM + 7;
|
const int GIFT_EXIT_TO = GIFT_EXIT_FROM + 7;
|
||||||
|
@ -52,17 +52,8 @@ using namespace irr::core;
|
|||||||
using namespace irr::gui;
|
using namespace irr::gui;
|
||||||
using namespace irr::video;
|
using namespace irr::video;
|
||||||
|
|
||||||
const float INITIAL_Y = -3.0f;
|
|
||||||
|
|
||||||
const float DURATION = 15.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 DISTANCE_BETWEEN_KARTS = 2.0f;
|
||||||
|
|
||||||
const float KART_SCALE = 0.75f;
|
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_Y = 0.0f;
|
||||||
const float KART_Z = 0.0f;
|
const float KART_Z = 0.0f;
|
||||||
|
|
||||||
|
|
||||||
const float GARAGE_DOOR_OPEN_TIME = 6.0f;
|
|
||||||
|
|
||||||
const int MAX_KART_COUNT = 4;
|
const int MAX_KART_COUNT = 4;
|
||||||
|
|
||||||
DEFINE_SCREEN_SINGLETON( GrandPrixLose );
|
DEFINE_SCREEN_SINGLETON( GrandPrixLose );
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
#include "network/network_manager.hpp"
|
#include "network/network_manager.hpp"
|
||||||
#include "states_screens/state_manager.hpp"
|
#include "states_screens/state_manager.hpp"
|
||||||
|
|
||||||
static const char RANDOM_KART_ID[] = "randomkart";
|
|
||||||
static const char ID_LOCKED[] = "locked/";
|
static const char ID_LOCKED[] = "locked/";
|
||||||
|
|
||||||
using namespace GUIEngine;
|
using namespace GUIEngine;
|
||||||
|
@ -272,7 +272,6 @@ void OptionsScreenInput::filterInput(Input::InputType type,
|
|||||||
int deviceID,
|
int deviceID,
|
||||||
int btnID,
|
int btnID,
|
||||||
int axisDir,
|
int axisDir,
|
||||||
int axisRange,
|
|
||||||
int value)
|
int value)
|
||||||
{
|
{
|
||||||
if (type == Input::IT_STICKMOTION || type == Input::IT_STICKBUTTON)
|
if (type == Input::IT_STICKMOTION || type == Input::IT_STICKBUTTON)
|
||||||
|
@ -70,7 +70,6 @@ public:
|
|||||||
int deviceID,
|
int deviceID,
|
||||||
int btnID,
|
int btnID,
|
||||||
int axisDir,
|
int axisDir,
|
||||||
int axisRange,
|
|
||||||
int value);
|
int value);
|
||||||
|
|
||||||
/** \brief implement callback from parent class GUIEngine::Screen */
|
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||||
|
@ -46,9 +46,6 @@ private:
|
|||||||
|
|
||||||
// Minimap related variables
|
// 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,
|
/** The size of a single marker on the screen for AI karts,
|
||||||
* need not be a power of 2. */
|
* need not be a power of 2. */
|
||||||
int m_minimap_ai_size;
|
int m_minimap_ai_size;
|
||||||
|
@ -414,9 +414,9 @@ void RaceGUIBase::preRenderCallback(const Camera *camera)
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
void RaceGUIBase::renderPlayerView(const Camera *camera, float dt)
|
void RaceGUIBase::renderPlayerView(const Camera *camera, float dt)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
const core::recti &viewport = camera->getViewport();
|
const core::recti &viewport = camera->getViewport();
|
||||||
|
|
||||||
#if 0
|
|
||||||
if (m_lightning > 0.0f)
|
if (m_lightning > 0.0f)
|
||||||
{
|
{
|
||||||
GLint glviewport[4];
|
GLint glviewport[4];
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user