Merge branch 'master' of github.com:supertuxkart/stk-code
This commit is contained in:
commit
3a0f2e7ce5
@ -26,3 +26,29 @@ TutorialWorld::TutorialWorld()
|
||||
{
|
||||
m_stop_music_when_dialog_open = false;
|
||||
} // TutorialWorld
|
||||
|
||||
unsigned int TutorialWorld::getRescuePositionIndex(AbstractKart *kart)
|
||||
{
|
||||
const int start_spots_amount = getTrack()->getNumberOfStartPositions();
|
||||
assert(start_spots_amount > 0);
|
||||
|
||||
float closest_distance = 999999.0f;
|
||||
int closest_id_found = 0;
|
||||
|
||||
Vec3 kart_pos = kart->getFrontXYZ();
|
||||
|
||||
for (int n = 0; n<start_spots_amount; n++)
|
||||
{
|
||||
const btTransform &s = getStartTransform(n);
|
||||
const Vec3 &v = s.getOrigin();
|
||||
float distance = (v - kart_pos).length2_2d();
|
||||
|
||||
if (n == 0 || distance < closest_distance)
|
||||
{
|
||||
closest_id_found = n;
|
||||
closest_distance = distance;
|
||||
}
|
||||
}
|
||||
|
||||
return closest_id_found;
|
||||
}
|
||||
|
@ -35,12 +35,7 @@ public:
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
/** Determines the rescue position index of the specified kart. */
|
||||
virtual unsigned int getRescuePositionIndex(AbstractKart *kart) OVERRIDE
|
||||
{
|
||||
// Don't use LinearWorld's function, but WorldWithRank, since the
|
||||
// latter is based on rescuing to start positions
|
||||
return WorldWithRank::getRescuePositionIndex(kart);
|
||||
}
|
||||
virtual unsigned int getRescuePositionIndex(AbstractKart *kart) OVERRIDE;
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the bullet transformation for the specified rescue index. */
|
||||
virtual btTransform getRescueTransform(unsigned int index) const OVERRIDE
|
||||
@ -50,6 +45,8 @@ public:
|
||||
return WorldWithRank::getRescueTransform(index);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}; // class TutorialWorld
|
||||
|
||||
#endif
|
||||
|
@ -252,8 +252,14 @@ void PhysicalObject::init()
|
||||
Log::fatal("PhysicalObject", "Unknown node type");
|
||||
}
|
||||
|
||||
max = max * Vec3(m_init_scale);
|
||||
min = min * Vec3(m_init_scale);
|
||||
Vec3 parent_scale(1.0f, 1.0f, 1.0f);
|
||||
if (m_object->getParentLibrary() != NULL)
|
||||
{
|
||||
parent_scale = m_object->getParentLibrary()->getScale();
|
||||
}
|
||||
|
||||
max = max * (Vec3(m_init_scale) * parent_scale);
|
||||
min = min * (Vec3(m_init_scale) * parent_scale);
|
||||
|
||||
Vec3 extend = max-min;
|
||||
// Adjust the mesth of the graphical object so that its center is where it
|
||||
@ -466,6 +472,26 @@ void PhysicalObject::init()
|
||||
m_init_pos.setOrigin(m_init_pos.getOrigin() +
|
||||
btVector3(0, extend.getY()*0.5f, 0));
|
||||
}
|
||||
|
||||
|
||||
// If this object has a parent, apply the parent's rotation
|
||||
if (m_object->getParentLibrary() != NULL)
|
||||
{
|
||||
core::vector3df parent_rot_hpr = m_object->getParentLibrary()->getInitRotation();
|
||||
core::matrix4 parent_rot_matrix;
|
||||
parent_rot_matrix.setRotationDegrees(parent_rot_hpr);
|
||||
|
||||
btQuaternion child_rot_quat = m_init_pos.getRotation();
|
||||
core::matrix4 child_rot_matrix;
|
||||
Vec3 axis = child_rot_quat.getAxis();
|
||||
child_rot_matrix.setRotationAxisRadians(child_rot_quat.getAngle(), axis.toIrrVector());
|
||||
|
||||
irr::core::quaternion tempQuat(parent_rot_matrix * child_rot_matrix);
|
||||
btQuaternion q(tempQuat.X, tempQuat.Y, tempQuat.Z, tempQuat.W);
|
||||
|
||||
m_init_pos.setRotation(q);
|
||||
}
|
||||
|
||||
m_motion_state = new btDefaultMotionState(m_init_pos);
|
||||
btVector3 inertia(1,1,1);
|
||||
if (m_body_type != MP_EXACT)
|
||||
|
@ -107,7 +107,7 @@ namespace Scripting
|
||||
script.resize(len);
|
||||
int c = fread(&script[0], len, 1, f);
|
||||
fclose(f);
|
||||
if (c == NULL)
|
||||
if (c != 1)
|
||||
{
|
||||
Log::error("Scripting", "Failed to load script file.");
|
||||
return "";
|
||||
|
@ -53,10 +53,9 @@ namespace Scripting
|
||||
{
|
||||
InputDevice* device = input_manager->getDeviceManager()->getLatestUsedDevice();
|
||||
DeviceConfig* config = device->getConfiguration();
|
||||
irr::core::stringw control;
|
||||
PlayerAction ScriptAction = (PlayerAction)Enum_value;
|
||||
control = config->getBindingAsString(ScriptAction);
|
||||
std::string key = std::string(irr::core::stringc(control).c_str());
|
||||
irr::core::stringw control = config->getBindingAsString(ScriptAction);
|
||||
std::string key = StringUtils::wide_to_utf8(control.c_str());
|
||||
return key;
|
||||
}
|
||||
|
||||
|
@ -16,10 +16,10 @@
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "config/user_config.hpp"
|
||||
#include "guiengine/engine.hpp"
|
||||
#include "guiengine/scalable_font.hpp"
|
||||
#include "graphics/2dutils.hpp"
|
||||
#include "graphics/irr_driver.hpp"
|
||||
#include "states_screens/cutscene_gui.hpp"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -40,21 +40,23 @@ CutsceneGUI::~CutsceneGUI()
|
||||
|
||||
void CutsceneGUI::renderGlobal(float dt)
|
||||
{
|
||||
core::dimension2d<u32> screen_size = irr_driver->getActualScreenSize();
|
||||
|
||||
if (m_fade_level > 0.0f)
|
||||
{
|
||||
GL32_draw2DRectangle(
|
||||
video::SColor((int)(m_fade_level*255), 0,0,0),
|
||||
core::rect<s32>(0, 0,
|
||||
UserConfigParams::m_width,
|
||||
UserConfigParams::m_height));
|
||||
screen_size.Width,
|
||||
screen_size.Height));
|
||||
}
|
||||
|
||||
if (m_subtitle.size() > 0)
|
||||
{
|
||||
core::rect<s32> r(0, UserConfigParams::m_height - GUIEngine::getFontHeight()*2,
|
||||
UserConfigParams::m_width, UserConfigParams::m_height);
|
||||
core::rect<s32> r(0, screen_size.Height - GUIEngine::getFontHeight()*2,
|
||||
screen_size.Width, screen_size.Height);
|
||||
|
||||
if (GUIEngine::getFont()->getDimension(m_subtitle.c_str()).Width > (unsigned int)UserConfigParams::m_width)
|
||||
if (GUIEngine::getFont()->getDimension(m_subtitle.c_str()).Width > screen_size.Width)
|
||||
{
|
||||
GUIEngine::getSmallFont()->draw(m_subtitle, r,
|
||||
video::SColor(255,255,255,255), true, true, NULL);
|
||||
|
@ -95,6 +95,13 @@ static GFXPreset GFX_PRESETS[] =
|
||||
false /* depth of field */, false /* global illumination */, false /* degraded IBL */, 1 /* hd_textures */
|
||||
},
|
||||
|
||||
{
|
||||
true /* light */, 512 /* shadow */, true /* bloom */, true /* motionblur */,
|
||||
true /* lightshaft */, true /* glow */, true /* mlaa */, true /* ssao */, true /* weather */,
|
||||
true /* animatedScenery */, 2 /* animatedCharacters */, 16 /* anisotropy */,
|
||||
true /* depth of field */, false /* global illumination */, false /* degraded IBL */, 1 /* hd_textures */
|
||||
},
|
||||
|
||||
{
|
||||
true /* light */, 1024 /* shadow */, true /* bloom */, true /* motionblur */,
|
||||
true /* lightshaft */, true /* glow */, true /* mlaa */, true /* ssao */, true /* weather */,
|
||||
@ -103,7 +110,7 @@ static GFXPreset GFX_PRESETS[] =
|
||||
}
|
||||
};
|
||||
|
||||
static const int GFX_LEVEL_AMOUNT = 5;
|
||||
static const int GFX_LEVEL_AMOUNT = 6;
|
||||
|
||||
struct Resolution
|
||||
{
|
||||
|
@ -544,7 +544,7 @@ const core::vector3df& TrackObject::getScale() const
|
||||
if (m_presentation != NULL)
|
||||
return m_presentation->getScale();
|
||||
else
|
||||
return m_init_xyz;
|
||||
return m_init_scale;
|
||||
} // getScale
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -90,7 +90,7 @@ const core::vector3df TrackObjectPresentationSceneNode::getAbsolutePosition() co
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
const core::vector3df& TrackObjectPresentationSceneNode::getAbsoluteCenterPosition() const
|
||||
const core::vector3df TrackObjectPresentationSceneNode::getAbsoluteCenterPosition() const
|
||||
{
|
||||
if (m_node == NULL) return m_init_xyz;
|
||||
m_node->updateAbsolutePosition();
|
||||
|
@ -100,7 +100,7 @@ public:
|
||||
return m_init_xyz;
|
||||
} // getAbsolutePosition
|
||||
// ------------------------------------------------------------------------
|
||||
virtual const core::vector3df& getAbsoluteCenterPosition() const
|
||||
virtual const core::vector3df getAbsoluteCenterPosition() const
|
||||
{
|
||||
return m_init_xyz;
|
||||
}
|
||||
@ -146,7 +146,7 @@ public:
|
||||
// ------------------------------------------------------------------------
|
||||
virtual const core::vector3df& getPosition() const OVERRIDE;
|
||||
virtual const core::vector3df getAbsolutePosition() const OVERRIDE;
|
||||
virtual const core::vector3df& getAbsoluteCenterPosition() const OVERRIDE;
|
||||
virtual const core::vector3df getAbsoluteCenterPosition() const OVERRIDE;
|
||||
virtual const core::vector3df& getRotation() const OVERRIDE;
|
||||
virtual const core::vector3df& getScale() const OVERRIDE;
|
||||
virtual void move(const core::vector3df& xyz, const core::vector3df& hpr,
|
||||
|
Loading…
x
Reference in New Issue
Block a user