Merge branch 'master' into skybox_refactoring
This commit is contained in:
commit
ae5f71e50e
@ -20,7 +20,7 @@ option(USE_FRIBIDI "Support for right-to-left languages" ON)
|
||||
option(CHECK_ASSETS "Check if assets are installed in ../stk-assets" ON)
|
||||
option(USE_SYSTEM_ANGELSCRIPT "Use system angelscript instead of built-in angelscript. If you enable this option, make sure to use a compatible version." OFF)
|
||||
|
||||
if(MSVC)
|
||||
if(MSVC AND (MSVC_VERSION LESS 1900))
|
||||
# Normally hide the option to build wiiuse on VS, since it depends
|
||||
# on the installation of the Windows DDK (Driver Developer Kit),
|
||||
# which also needs an absolute path :(
|
||||
@ -211,6 +211,11 @@ if(WIN32)
|
||||
|
||||
# And shut up about unsafe stuff
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
|
||||
# Avoid timespec structure redeclaration on Visual Studio 2015
|
||||
if (MSVC_VERSION EQUAL 1900)
|
||||
add_definitions(-DHAVE_STRUCT_TIMESPEC)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
|
@ -2,6 +2,8 @@ uniform sampler2D tex_128;
|
||||
uniform sampler2D tex_256;
|
||||
uniform sampler2D tex_512;
|
||||
|
||||
uniform sampler2D tex_dust;
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
void main()
|
||||
@ -10,5 +12,13 @@ void main()
|
||||
vec4 col = .125 * texture(tex_128, uv);
|
||||
col += .25 * texture(tex_256, uv);
|
||||
col += .5 * texture(tex_512, uv);
|
||||
|
||||
/* Lens dust effect ---- */
|
||||
vec4 col2 = texture(tex_128, uv);
|
||||
col2 += col2;
|
||||
col2 += col2;
|
||||
//float dustMask = max(col2.r,max(col2.g,col2.b));
|
||||
col += texture(tex_dust, uv) * col2;
|
||||
|
||||
FragColor = vec4(col.xyz, 1.);
|
||||
}
|
||||
|
@ -426,7 +426,7 @@
|
||||
chassis-angular-damping="0"
|
||||
downward-impulse-factor="5"
|
||||
track-connection-accel="2"
|
||||
smooth-flying-impulse="25"/>
|
||||
smooth-flying-impulse="250"/>
|
||||
|
||||
<!-- collision
|
||||
impulse-type: STK can apply an additional impulse in case of
|
||||
@ -623,7 +623,7 @@
|
||||
time-reset-steer="0.1" />
|
||||
|
||||
<!-- Speed and acceleration related values: power and max-speed (in m/s)
|
||||
have 3 values, one for low, medium, and hard.
|
||||
have 4 values, one for low, medium, hard, and supertux.
|
||||
brake-factor: Value used when braking.
|
||||
brake-time-increase: The brake force is multiplied by
|
||||
(1+brake_time*brake_time_increase - i.e. the longer the brake was
|
||||
|
@ -584,8 +584,8 @@ BEGIN_AS_NAMESPACE
|
||||
template<typename T>
|
||||
asUINT asGetTypeTraits()
|
||||
{
|
||||
#if defined(_MSC_VER) || defined(_LIBCPP_TYPE_TRAITS)
|
||||
// MSVC & XCode/Clang
|
||||
#if defined(_MSC_VER) || defined(_LIBCPP_TYPE_TRAITS) || (__GNUC__ >= 5)
|
||||
// MSVC & XCode/Clang, and gnuc 5+
|
||||
// C++11 compliant code
|
||||
bool hasConstructor = std::is_default_constructible<T>::value && !std::is_trivially_default_constructible<T>::value;
|
||||
bool hasDestructor = std::is_destructible<T>::value && !std::is_trivially_destructible<T>::value;
|
||||
|
@ -61,7 +61,7 @@ namespace scene
|
||||
|
||||
//! Get the name of the bone
|
||||
/** \deprecated Use getName instead. This method may be removed by Irrlicht 1.9 */
|
||||
_IRR_DEPRECATED_ virtual const c8* getBoneName() const { return getName(); }
|
||||
//~ _IRR_DEPRECATED_ virtual const c8* getBoneName() const { return getName(); }
|
||||
|
||||
//! Get the index of the bone
|
||||
virtual u32 getBoneIndex() const = 0;
|
||||
|
@ -53,7 +53,7 @@ ChallengeData::ChallengeData(const std::string& filename)
|
||||
|
||||
// we are using auto_ptr to make sure the XML node is released when leaving
|
||||
// the scope
|
||||
std::auto_ptr<XMLNode> root(new XMLNode( filename ));
|
||||
std::unique_ptr<XMLNode> root(new XMLNode( filename ));
|
||||
|
||||
if(root.get() == NULL || root->getName()!="challenge")
|
||||
{
|
||||
|
@ -173,9 +173,10 @@ void SavedGrandPrix::loadKarts(std::vector<RaceManager::KartStatus> & kart_list)
|
||||
{
|
||||
if(kart_list[x].m_local_player_id == m_karts[i].m_local_player_id)
|
||||
{
|
||||
if(kp) kart_list[x].m_ident = m_karts[i].m_ident;
|
||||
kart_list[x].m_score = m_karts[i].m_score;
|
||||
kart_list[x].m_overall_time = m_karts[i].m_overall_time;
|
||||
} // if kart_list[x].m_local_player_id == m_karts[i].,_local
|
||||
} // if kart_list[x].m_local_player_id == m_karts[i].local
|
||||
} // for x
|
||||
} // if m_local_player_id == -1
|
||||
} // for i
|
||||
|
@ -84,21 +84,19 @@ Material::Material(const XMLNode *node, bool deprecated)
|
||||
|
||||
|
||||
std::string s;
|
||||
//node->get("adjust-image", &s );
|
||||
//if(s=="premultiply")
|
||||
// m_adjust_image = ADJ_PREMUL;
|
||||
//else if (s=="divide")
|
||||
// m_adjust_image = ADJ_DIV;
|
||||
//else if (s=="" || s=="none")
|
||||
// m_adjust_image = ADJ_NONE;
|
||||
//else
|
||||
// Log::warn("material",
|
||||
// "Incorrect adjust-image specification: '%s' - ignored.",
|
||||
// s.c_str());
|
||||
|
||||
node->get("high-adhesion", &m_high_tire_adhesion);
|
||||
node->get("reset", &m_drive_reset );
|
||||
|
||||
node->get("high-adhesion", &m_high_tire_adhesion );
|
||||
node->get("reset", &m_drive_reset );
|
||||
s = "";
|
||||
node->get("mirror-axis", &s);
|
||||
if (s == "u")
|
||||
s = "U";
|
||||
else if (s == "v")
|
||||
s = "V";
|
||||
if (s != "U" && s != "V")
|
||||
m_mirror_axis_when_reverse = ' ';
|
||||
else
|
||||
m_mirror_axis_when_reverse = s[0];
|
||||
// backwards compatibility
|
||||
bool crash_reset = false;
|
||||
node->get("crash-reset", &crash_reset );
|
||||
@ -433,6 +431,7 @@ void Material::init()
|
||||
m_surface = false;
|
||||
m_ignore = false;
|
||||
m_drive_reset = false;
|
||||
m_mirror_axis_when_reverse = ' ';
|
||||
m_collision_reaction = NORMAL;
|
||||
m_disable_z_write = false;
|
||||
m_water_shader_speed_1 = 6.6667f;
|
||||
|
@ -156,6 +156,11 @@ private:
|
||||
|
||||
bool m_fog;
|
||||
|
||||
/** Either ' ' (no mirroring), 'U' or 'V' if a texture needs to be
|
||||
* mirrored when driving in reverse. Typically used for arrows indicating
|
||||
* the direction. */
|
||||
char m_mirror_axis_when_reverse;
|
||||
|
||||
ParticleKind* m_particles_effects[EMIT_KINDS_COUNT];
|
||||
|
||||
/** For normal maps */
|
||||
@ -373,6 +378,9 @@ public:
|
||||
// ------------------------------------------------------------------------
|
||||
ShaderType getShaderType() const { return m_shader_type; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** True if this texture should have the U coordinates mirrored. */
|
||||
char getMirrorAxisInReverse() const { return m_mirror_axis_when_reverse; }
|
||||
// ------------------------------------------------------------------------
|
||||
} ;
|
||||
|
||||
|
||||
|
@ -332,25 +332,32 @@ public:
|
||||
} // render
|
||||
}; // BloomShader
|
||||
|
||||
static video::ITexture *lensDustTex = 0;
|
||||
|
||||
// ============================================================================
|
||||
class BloomBlendShader : public TextureShader<BloomBlendShader, 3>
|
||||
class BloomBlendShader : public TextureShader<BloomBlendShader, 4>
|
||||
{
|
||||
public:
|
||||
BloomBlendShader()
|
||||
{
|
||||
if (!lensDustTex)
|
||||
lensDustTex = irr_driver->getTexture(FileManager::TEXTURE, "gfx_lensDust_a.png");
|
||||
|
||||
loadProgram(OBJECT, GL_VERTEX_SHADER, "screenquad.vert",
|
||||
GL_FRAGMENT_SHADER, "bloomblend.frag");
|
||||
assignUniforms();
|
||||
assignSamplerNames(0, "tex_128", ST_BILINEAR_FILTERED,
|
||||
1, "tex_256", ST_BILINEAR_FILTERED,
|
||||
2, "tex_512", ST_BILINEAR_FILTERED);
|
||||
2, "tex_512", ST_BILINEAR_FILTERED,
|
||||
3, "tex_dust", ST_BILINEAR_FILTERED);
|
||||
} // BloomBlendShader
|
||||
// ------------------------------------------------------------------------
|
||||
void render()
|
||||
{
|
||||
setTextureUnits(irr_driver->getRenderTargetTexture(RTT_BLOOM_128),
|
||||
irr_driver->getRenderTargetTexture(RTT_BLOOM_256),
|
||||
irr_driver->getRenderTargetTexture(RTT_BLOOM_512));
|
||||
irr_driver->getRenderTargetTexture(RTT_BLOOM_512),
|
||||
getTextureGLuint(lensDustTex));
|
||||
drawFullScreenEffect();
|
||||
} // render
|
||||
}; // BloomBlendShader
|
||||
|
@ -44,7 +44,7 @@ IconButtonWidget::IconButtonWidget(ScaleMode scale_mode, const bool tab_stop,
|
||||
m_texture = NULL;
|
||||
m_deactivated_texture = NULL;
|
||||
m_highlight_texture = NULL;
|
||||
|
||||
|
||||
m_custom_aspect_ratio = 1.0f;
|
||||
|
||||
m_texture_w = 0;
|
||||
@ -112,7 +112,7 @@ void IconButtonWidget::add()
|
||||
// irrlicht widgets don't support scaling while keeping aspect ratio
|
||||
// so, happily, let's implement it ourselves
|
||||
float useAspectRatio = -1.0f;
|
||||
|
||||
|
||||
if (m_properties[PROP_CUSTOM_RATIO] != "")
|
||||
{
|
||||
StringUtils::fromString(m_properties[PROP_CUSTOM_RATIO],
|
||||
@ -227,7 +227,7 @@ void IconButtonWidget::add()
|
||||
m_id = m_element->getID();
|
||||
if (m_tab_stop) m_element->setTabOrder(m_id);
|
||||
m_element->setTabGroup(false);
|
||||
|
||||
|
||||
if (!m_is_visible)
|
||||
m_element->setVisible(false);
|
||||
}
|
||||
@ -334,7 +334,7 @@ video::ITexture* IconButtonWidget::getDeactivatedTexture(video::ITexture* textur
|
||||
|
||||
std::string name = texture->getName().getPath().c_str();
|
||||
name += "_disabled";
|
||||
t = irr_driver->getTexture(name, /*premul*/false, /*prediv*/false,
|
||||
t = irr_driver->getTexture(name, /*premul*/false, /*prediv*/false,
|
||||
/*compain_if_not_found*/false);
|
||||
if (t == NULL)
|
||||
{
|
||||
@ -342,7 +342,7 @@ video::ITexture* IconButtonWidget::getDeactivatedTexture(video::ITexture* textur
|
||||
u32 g;
|
||||
|
||||
video::IVideoDriver* driver = irr_driver->getVideoDriver();
|
||||
std::auto_ptr<video::IImage> image (driver->createImageFromData (texture->getColorFormat(),
|
||||
std::unique_ptr<video::IImage> image (driver->createImageFromData (texture->getColorFormat(),
|
||||
texture->getSize(), texture->lock(), false));
|
||||
texture->unlock();
|
||||
|
||||
|
@ -560,7 +560,9 @@ EventPropagation RibbonWidget::focused(const int playerID)
|
||||
{
|
||||
if (m_selection[playerID] != -1)
|
||||
{
|
||||
m_active_children.get(m_selection[playerID])->focused(playerID);
|
||||
int selection = m_selection[playerID];
|
||||
if (selection < (int)m_active_children.size())
|
||||
m_active_children.get(selection)->focused(playerID);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -110,45 +110,85 @@ irr::core::stringw Binding::getAsString() const
|
||||
case 221: s="]"; break;
|
||||
case 222: s="'"; break;
|
||||
#endif
|
||||
case irr::KEY_LBUTTON : s = "left mouse button"; break;
|
||||
case irr::KEY_RBUTTON : s = "right mouse button"; break;
|
||||
case irr::KEY_CANCEL : s = "cancel"; break;
|
||||
case irr::KEY_MBUTTON : s = "middle mouse button"; break;
|
||||
case irr::KEY_XBUTTON1 : s = "X1 mouse button"; break;
|
||||
case irr::KEY_XBUTTON2 : s = "X2 mouse button"; break;
|
||||
case irr::KEY_BACK : s = "backspace"; break;
|
||||
case irr::KEY_TAB : s = "tab"; break;
|
||||
case irr::KEY_CLEAR : s = "clear"; break;
|
||||
case irr::KEY_RETURN : s = "return"; break;
|
||||
case irr::KEY_SHIFT : s = "shift"; break;
|
||||
case irr::KEY_CONTROL : s = "control"; break;
|
||||
case irr::KEY_MENU : s = "alt/menu"; break;
|
||||
case irr::KEY_PAUSE : s = "pause"; break;
|
||||
case irr::KEY_CAPITAL : s = "caps lock"; break;
|
||||
case irr::KEY_KANA : s = "kana"; break;
|
||||
case irr::KEY_JUNJA : s = "junja"; break;
|
||||
case irr::KEY_FINAL : s = "final"; break;
|
||||
case irr::KEY_ESCAPE : s = "escape"; break;
|
||||
case irr::KEY_CONVERT : s = "convert"; break;
|
||||
case irr::KEY_NONCONVERT : s = "nonconvert"; break;
|
||||
case irr::KEY_ACCEPT : s = "accept"; break;
|
||||
case irr::KEY_MODECHANGE : s = "modechange"; break;
|
||||
case irr::KEY_SPACE : s = "space"; break;
|
||||
case irr::KEY_PRIOR : s = "page up"; break;
|
||||
case irr::KEY_NEXT : s = "page down"; break;
|
||||
case irr::KEY_END : s = "end"; break;
|
||||
case irr::KEY_HOME : s = "home"; break;
|
||||
case irr::KEY_LEFT : s = "left"; break;
|
||||
case irr::KEY_UP : s = "up"; break;
|
||||
case irr::KEY_RIGHT : s = "right"; break;
|
||||
case irr::KEY_DOWN : s = "down"; break;
|
||||
case irr::KEY_SELECT : s = "select"; break;
|
||||
case irr::KEY_PRINT : s = "print"; break;
|
||||
case irr::KEY_EXECUT : s = "exec"; break;
|
||||
case irr::KEY_SNAPSHOT : s = "print screen"; break;
|
||||
case irr::KEY_INSERT : s = "insert"; break;
|
||||
case irr::KEY_DELETE : s = "delete"; break;
|
||||
case irr::KEY_HELP : s = "help"; break;
|
||||
//I18N: input configuration screen: mouse button
|
||||
case irr::KEY_LBUTTON : s = _("Left Mouse Button"); break;
|
||||
//I18N: input configuration screen: mouse button
|
||||
case irr::KEY_RBUTTON : s = _("Right Mouse Button"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_CANCEL : s = _("Cancel"); break;
|
||||
//I18N: input configuration screen: mouse button
|
||||
case irr::KEY_MBUTTON : s = _("Middle Mouse Button"); break;
|
||||
//I18N: input configuration screen: mouse button
|
||||
case irr::KEY_XBUTTON1 : s = _("X1 Mouse Button"); break;
|
||||
//I18N: input configuration screen: mouse button
|
||||
case irr::KEY_XBUTTON2 : s = _("X2 Mouse Button"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_BACK : s = _("Backspace"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_TAB : s = _("Tab"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_CLEAR : s = _("Clear"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_RETURN : s = _("Return"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_SHIFT : s = _("Shift"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_CONTROL : s = _("Control"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_MENU : s = _("Alt/Menu"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_PAUSE : s = _("Pause"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_CAPITAL : s = _("Caps Lock"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_KANA : s = _("Kana"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_JUNJA : s = _("Junja"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_FINAL : s = _("Final"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_ESCAPE : s = _("Escape"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_CONVERT : s = _("Convert"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_NONCONVERT : s = _("Nonconvert"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_ACCEPT : s = _("Accept"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_MODECHANGE : s = _("Modechange"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_SPACE : s = _("Space"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_PRIOR : s = _("Page Up"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_NEXT : s = _("Page Down"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_END : s = _("End"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_HOME : s = _("Home"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_LEFT : s = _("Left"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_UP : s = _("Up"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_RIGHT : s = _("Right"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_DOWN : s = _("Down"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_SELECT : s = _("Select"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_PRINT : s = _("Print"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_EXECUT : s = _("Exec"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_SNAPSHOT : s = _("Print Screen"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_INSERT : s = _("Insert"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_DELETE : s = _("Delete"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_HELP : s = _("Help"); break;
|
||||
case irr::KEY_KEY_0 : s = "0"; break;
|
||||
case irr::KEY_KEY_1 : s = "1"; break;
|
||||
case irr::KEY_KEY_2 : s = "2"; break;
|
||||
@ -185,26 +225,44 @@ irr::core::stringw Binding::getAsString() const
|
||||
case irr::KEY_KEY_X : s = "X"; break;
|
||||
case irr::KEY_KEY_Y : s = "Y"; break;
|
||||
case irr::KEY_KEY_Z : s = "Z"; break;
|
||||
case irr::KEY_LWIN : s = "Left Logo"; break;
|
||||
case irr::KEY_RWIN : s = "Right Logo"; break;
|
||||
case irr::KEY_APPS : s = "apps"; break;
|
||||
case irr::KEY_SLEEP : s = "sleep"; break;
|
||||
case irr::KEY_NUMPAD0 : s = "numpad 0"; break;
|
||||
case irr::KEY_NUMPAD1 : s = "numpad 1"; break;
|
||||
case irr::KEY_NUMPAD2 : s = "numpad 2"; break;
|
||||
case irr::KEY_NUMPAD3 : s = "numpad 3"; break;
|
||||
case irr::KEY_NUMPAD4 : s = "numpad 4"; break;
|
||||
case irr::KEY_NUMPAD5 : s = "numpad 5"; break;
|
||||
case irr::KEY_NUMPAD6 : s = "numpad 6"; break;
|
||||
case irr::KEY_NUMPAD7 : s = "numpad 7"; break;
|
||||
case irr::KEY_NUMPAD8 : s = "numpad 8"; break;
|
||||
case irr::KEY_NUMPAD9 : s = "numpad 9"; break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_LWIN : s = _("Left Logo"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_RWIN : s = _("Right Logo"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_APPS : s = _("Apps"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_SLEEP : s = _("Sleep"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_NUMPAD0 : s = _("Numpad 0"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_NUMPAD1 : s = _("Numpad 1"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_NUMPAD2 : s = _("Numpad 2"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_NUMPAD3 : s = _("Numpad 3"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_NUMPAD4 : s = _("Numpad 4"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_NUMPAD5 : s = _("Numpad 5"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_NUMPAD6 : s = _("Numpad 6"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_NUMPAD7 : s = _("Numpad 7"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_NUMPAD8 : s = _("Numpad 8"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_NUMPAD9 : s = _("Numpad 9"); break;
|
||||
case irr::KEY_MULTIPLY : s = "*"; break;
|
||||
case irr::KEY_ADD : s = "+"; break;
|
||||
case irr::KEY_SEPARATOR : s = "separator"; break;
|
||||
case irr::KEY_SUBTRACT : s = "- (subtract)"; break;
|
||||
case irr::KEY_DECIMAL : s = "decimal"; break;
|
||||
case irr::KEY_DIVIDE : s = "/ (divide)"; break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_SEPARATOR : s = _("Separator"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_SUBTRACT : s = _("- (Subtract)"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_DECIMAL : s = _("Decimal"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_DIVIDE : s = _("/ (Divide)"); break;
|
||||
case irr::KEY_F1 : s = "F1"; break;
|
||||
case irr::KEY_F2 : s = "F2"; break;
|
||||
case irr::KEY_F3 : s = "F3"; break;
|
||||
@ -229,26 +287,42 @@ irr::core::stringw Binding::getAsString() const
|
||||
case irr::KEY_F22 : s = "F22"; break;
|
||||
case irr::KEY_F23 : s = "F23"; break;
|
||||
case irr::KEY_F24 : s = "F24"; break;
|
||||
case irr::KEY_NUMLOCK : s = "num lock"; break;
|
||||
case irr::KEY_SCROLL : s = "scroll lock"; break;
|
||||
case irr::KEY_LSHIFT : s = "left shift"; break;
|
||||
case irr::KEY_RSHIFT : s = "right shift"; break;
|
||||
case irr::KEY_LCONTROL : s = "left control"; break;
|
||||
case irr::KEY_RCONTROL : s = "right control"; break;
|
||||
case irr::KEY_LMENU : s = "left menu"; break;
|
||||
case irr::KEY_RMENU : s = "right menu"; break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_NUMLOCK : s = _("Num Lock"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_SCROLL : s = _("Scroll Lock"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_LSHIFT : s = _("Left Shift"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_RSHIFT : s = _("Right Shift"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_LCONTROL : s = _("Left Control"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_RCONTROL : s = _("Right Control"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_LMENU : s = _("Left Menu"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_RMENU : s = _("Right Menu"); break;
|
||||
case irr::KEY_PLUS : s = "+"; break;
|
||||
case irr::KEY_COMMA : s = ","; break;
|
||||
case irr::KEY_MINUS : s = "-"; break;
|
||||
case irr::KEY_PERIOD : s = "."; break;
|
||||
case irr::KEY_ATTN : s = "attn"; break;
|
||||
case irr::KEY_CRSEL : s = "crsel"; break;
|
||||
case irr::KEY_EXSEL : s = "exsel"; break;
|
||||
case irr::KEY_EREOF : s = "ereof"; break;
|
||||
case irr::KEY_PLAY : s = "play"; break;
|
||||
case irr::KEY_ZOOM : s = "zoom"; break;
|
||||
case irr::KEY_PA1 : s = "pa1"; break;
|
||||
case irr::KEY_OEM_CLEAR : s = "oem clear"; break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_ATTN : s = _("Attn"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_CRSEL : s = _("Crsel"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_EXSEL : s = _("Exsel"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_EREOF : s = _("Ereof"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_PLAY : s = _("Play"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_ZOOM : s = _("Zoom"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_PA1 : s = _("Pa1"); break;
|
||||
//I18N: input configuration screen: keyboard key
|
||||
case irr::KEY_OEM_CLEAR : s = _("Oem Clear"); break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -109,11 +109,8 @@ ExplosionAnimation::ExplosionAnimation(AbstractKart *kart,
|
||||
float t = m_kart->getKartProperties()->getExplosionInvulnerabilityTime() *
|
||||
m_kart->getPlayerDifficulty()->getExplosionInvulnerabilityTime();
|
||||
m_kart->setInvulnerableTime(t);
|
||||
if ( UserConfigParams::m_graphical_effects )
|
||||
{
|
||||
m_kart->showStarEffect(t);
|
||||
}
|
||||
|
||||
m_kart->showStarEffect(t);
|
||||
|
||||
m_kart->getAttachment()->clear();
|
||||
|
||||
}; // ExplosionAnimation
|
||||
|
@ -1077,11 +1077,8 @@ void Kart::update(float dt)
|
||||
m_max_speed->getCurrentMaxSpeed());
|
||||
#endif
|
||||
|
||||
if ( UserConfigParams::m_graphical_effects )
|
||||
{
|
||||
// update star effect (call will do nothing if stars are not activated)
|
||||
m_stars_effect->update(dt);
|
||||
}
|
||||
// update star effect (call will do nothing if stars are not activated)
|
||||
m_stars_effect->update(dt);
|
||||
|
||||
if(m_squash_time>=0)
|
||||
{
|
||||
|
@ -1,71 +0,0 @@
|
||||
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
|
@ -211,7 +211,7 @@ namespace Online
|
||||
int userid_fetched = input->get("userid", &userid);
|
||||
setLastOnlineName(username);
|
||||
|
||||
m_profile = new OnlineProfile(userid, username, true);
|
||||
OnlineProfile* profile = new OnlineProfile(userid, username, true);
|
||||
assert(token_fetched && username_fetched && userid_fetched);
|
||||
m_online_state = OS_SIGNED_IN;
|
||||
if(rememberPassword())
|
||||
@ -219,7 +219,7 @@ namespace Online
|
||||
saveSession(getOnlineId(), getToken());
|
||||
}
|
||||
|
||||
ProfileManager::get()->addPersistent(m_profile);
|
||||
m_profile = ProfileManager::get()->addPersistent(profile);
|
||||
std::string achieved_string("");
|
||||
|
||||
// Even if no achievements were sent, we have to call sync
|
||||
|
@ -253,7 +253,7 @@ bool ProfileManager::inPersistent(const uint32_t id)
|
||||
* the friends, while the other could have fetched the achievements.)
|
||||
* \param profile The profile to make persistent.
|
||||
*/
|
||||
void ProfileManager::addPersistent(OnlineProfile * profile)
|
||||
OnlineProfile* ProfileManager::addPersistent(OnlineProfile * profile)
|
||||
{
|
||||
if (inPersistent(profile->getID()))
|
||||
{
|
||||
@ -263,6 +263,8 @@ void ProfileManager::addPersistent(OnlineProfile * profile)
|
||||
{
|
||||
m_profiles_persistent[profile->getID()] = profile;
|
||||
}
|
||||
|
||||
return m_profiles_persistent[profile->getID()];
|
||||
} // addPersistent
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
@ -103,7 +103,7 @@ public:
|
||||
// ----------------------------------------------------------------
|
||||
|
||||
void addToCache(OnlineProfile *profile);
|
||||
void addPersistent(OnlineProfile *profile);
|
||||
OnlineProfile* addPersistent(OnlineProfile *profile);
|
||||
void deleteFromPersistent(const uint32_t id);
|
||||
void clearPersistent();
|
||||
void moveToCache(const uint32_t id);
|
||||
|
@ -446,9 +446,12 @@ void btKart::updateVehicle( btScalar step )
|
||||
{
|
||||
btVector3 kart_up = getChassisWorldTransform().getBasis().getColumn(1);
|
||||
btVector3 terrain_up(0,1,0);
|
||||
// Length of axis depends on the angle - i.e. the further awat
|
||||
// the kart is from being upright, the larger the applied impulse
|
||||
// will be, resulting in fast changes when the kart is on its
|
||||
// side, but not overcompensating (and therefore shaking) when
|
||||
// the kart is not much away from being upright.
|
||||
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.
|
||||
|
@ -106,7 +106,7 @@ void GrandPrixData::changeTrackNumber(const unsigned int number_of_tracks,
|
||||
// Ignore no-racing tracks:
|
||||
if(!track->isRaceTrack())
|
||||
continue;
|
||||
|
||||
|
||||
if (PlayerManager::getCurrentPlayer()->isLocked(track->getIdent()))
|
||||
continue;
|
||||
|
||||
@ -132,10 +132,10 @@ void GrandPrixData::changeTrackNumber(const unsigned int number_of_tracks,
|
||||
|
||||
const Track *track = track_manager->getTrack(track_index);
|
||||
std::string id = track->getIdent();
|
||||
|
||||
|
||||
if (PlayerManager::getCurrentPlayer()->isLocked(track->getIdent()))
|
||||
continue;
|
||||
|
||||
|
||||
bool is_already_added = false;
|
||||
for (unsigned int i = 0; i < m_tracks.size(); i++)
|
||||
{
|
||||
@ -145,7 +145,7 @@ void GrandPrixData::changeTrackNumber(const unsigned int number_of_tracks,
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!is_already_added)
|
||||
{
|
||||
m_tracks.push_back(id);
|
||||
@ -251,7 +251,7 @@ void GrandPrixData::reload()
|
||||
m_laps.clear();
|
||||
m_reversed.clear();
|
||||
|
||||
std::auto_ptr<XMLNode> root(file_manager->createXMLTree(m_filename));
|
||||
std::unique_ptr<XMLNode> root(file_manager->createXMLTree(m_filename));
|
||||
if (root.get() == NULL)
|
||||
{
|
||||
Log::error("GrandPrixData",
|
||||
|
@ -39,8 +39,6 @@ GrandPrixManager::GrandPrixManager()
|
||||
// ----------------------------------------------------------------------------
|
||||
GrandPrixManager::~GrandPrixManager()
|
||||
{
|
||||
for(unsigned int i=0; i<m_gp_data.size(); i++)
|
||||
delete m_gp_data[i];
|
||||
} // ~GrandPrixManager
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -84,9 +82,10 @@ void GrandPrixManager::loadDir(const std::string& dir, enum GrandPrixData::GPGro
|
||||
// ----------------------------------------------------------------------------
|
||||
void GrandPrixManager::load(const std::string& filename, enum GrandPrixData::GPGroupType group)
|
||||
{
|
||||
GrandPrixData* gp = NULL;
|
||||
try
|
||||
{
|
||||
GrandPrixData* gp = new GrandPrixData(filename, group);
|
||||
gp = new GrandPrixData(filename, group);
|
||||
m_gp_data.push_back(gp);
|
||||
Log::debug("GrandPrixManager",
|
||||
"Grand Prix '%s' loaded from %s",
|
||||
@ -94,6 +93,8 @@ void GrandPrixManager::load(const std::string& filename, enum GrandPrixData::GPG
|
||||
}
|
||||
catch (std::runtime_error& e)
|
||||
{
|
||||
if (gp != NULL)
|
||||
delete gp;
|
||||
Log::error("GrandPrixManager",
|
||||
"Ignoring Grand Prix %s (%s)\n", filename.c_str(), e.what());
|
||||
}
|
||||
@ -102,9 +103,7 @@ void GrandPrixManager::load(const std::string& filename, enum GrandPrixData::GPG
|
||||
// ----------------------------------------------------------------------------
|
||||
void GrandPrixManager::reload()
|
||||
{
|
||||
for(unsigned int i=0; i<m_gp_data.size(); i++)
|
||||
delete m_gp_data[i];
|
||||
m_gp_data.clear();
|
||||
m_gp_data.clearAndDeleteAll();
|
||||
|
||||
loadFiles();
|
||||
} // reload
|
||||
@ -124,7 +123,7 @@ std::string GrandPrixManager::generateId()
|
||||
unique = true;
|
||||
for (unsigned int i = 0; i < m_gp_data.size(); i++)
|
||||
{
|
||||
if (m_gp_data[i]->getId() == s.str())
|
||||
if (m_gp_data[i].getId() == s.str())
|
||||
{
|
||||
unique = false;
|
||||
break;
|
||||
@ -139,25 +138,31 @@ std::string GrandPrixManager::generateId()
|
||||
bool GrandPrixManager::existsName(const irr::core::stringw& name) const
|
||||
{
|
||||
for (unsigned int i = 0; i < m_gp_data.size(); i++)
|
||||
if (m_gp_data[i]->getName() == name)
|
||||
if (m_gp_data[i].getName() == name)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
} // existsName
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
GrandPrixData* GrandPrixManager::getGrandPrix(const std::string& s) const
|
||||
const GrandPrixData* GrandPrixManager::getGrandPrix(const std::string& s) const
|
||||
{
|
||||
return editGrandPrix(s);
|
||||
for (unsigned int i = 0; i<m_gp_data.size(); i++)
|
||||
{
|
||||
if (m_gp_data[i].getId() == s)
|
||||
return m_gp_data.get(i);
|
||||
} // for i in m_gp_data
|
||||
|
||||
return NULL;
|
||||
} // getGrandPrix
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
GrandPrixData* GrandPrixManager::editGrandPrix(const std::string& s) const
|
||||
GrandPrixData* GrandPrixManager::editGrandPrix(const std::string& s)
|
||||
{
|
||||
for(unsigned int i=0; i<m_gp_data.size(); i++)
|
||||
{
|
||||
if(m_gp_data[i]->getId() == s)
|
||||
return m_gp_data[i];
|
||||
if (m_gp_data[i].getId() == s)
|
||||
return m_gp_data.get(i);
|
||||
} // for i in m_gp_data
|
||||
|
||||
return NULL;
|
||||
@ -166,13 +171,12 @@ GrandPrixData* GrandPrixManager::editGrandPrix(const std::string& s) const
|
||||
// ----------------------------------------------------------------------------
|
||||
void GrandPrixManager::checkConsistency()
|
||||
{
|
||||
for(unsigned int i=0; i<m_gp_data.size(); i++)
|
||||
for (int i = (int)m_gp_data.size() - 1; i >= 0; i--)
|
||||
{
|
||||
if(!m_gp_data[i]->checkConsistency())
|
||||
if (!m_gp_data[i].checkConsistency())
|
||||
{
|
||||
// delete this GP, since a track is missing
|
||||
delete *(m_gp_data.erase(m_gp_data.begin()+i));
|
||||
i--;
|
||||
m_gp_data.erase(i);
|
||||
}
|
||||
}
|
||||
} // checkConsistency
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include "utils/ptr_vector.hpp"
|
||||
|
||||
#include "irrlicht.h"
|
||||
class GrandPrixData;
|
||||
@ -35,7 +36,7 @@ class GrandPrixManager
|
||||
private:
|
||||
static const char* SUFFIX;
|
||||
|
||||
std::vector<GrandPrixData*> m_gp_data;
|
||||
PtrVector<GrandPrixData> m_gp_data;
|
||||
|
||||
/** Load all the grands prix from the 3 directories known */
|
||||
void loadFiles();
|
||||
@ -51,20 +52,23 @@ public:
|
||||
GrandPrixManager();
|
||||
~GrandPrixManager();
|
||||
void reload();
|
||||
GrandPrixData* getGrandPrix(const std::string& s) const;
|
||||
bool existsName(const irr::core::stringw& name) const;
|
||||
void checkConsistency();
|
||||
|
||||
// Methods for the gp editor
|
||||
GrandPrixData* editGrandPrix(const std::string& s) const;
|
||||
GrandPrixData* editGrandPrix(const std::string& s);
|
||||
GrandPrixData* createNewGP(const irr::core::stringw& newName);
|
||||
GrandPrixData* copy(const std::string& id,
|
||||
const irr::core::stringw& newName);
|
||||
void remove(const std::string& id);
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns a pointer to the data for the specified GP.
|
||||
* \param i Index of the GP. */
|
||||
const GrandPrixData* getGrandPrix(const std::string& s) const;
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns a pointer to the data for the specified GP.
|
||||
* \param i Index of the GP. */
|
||||
GrandPrixData* getGrandPrix(const int i) const { return m_gp_data[i]; }
|
||||
const GrandPrixData* getGrandPrix(const int i) const { return m_gp_data.get(i); }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the number of GPs. */
|
||||
unsigned int getNumberOfGrandPrix() const { return (int)m_gp_data.size(); }
|
||||
|
@ -182,6 +182,8 @@ void History::Save()
|
||||
fprintf(fd, "numkarts: %d\n", num_karts);
|
||||
fprintf(fd, "numplayers: %d\n", race_manager->getNumPlayers());
|
||||
fprintf(fd, "difficulty: %d\n", race_manager->getDifficulty());
|
||||
fprintf(fd, "reverse: %c\n", race_manager->getReverseTrack() ? 'y' : 'n');
|
||||
|
||||
fprintf(fd, "track: %s\n", world->getTrack()->getIdent().c_str());
|
||||
|
||||
assert(num_karts > 0);
|
||||
@ -269,7 +271,17 @@ void History::Load()
|
||||
Log::fatal("History", "No difficulty found in history file.");
|
||||
race_manager->setDifficulty((RaceManager::Difficulty)n);
|
||||
|
||||
|
||||
// Optional (not supported in older history files): include reverse
|
||||
fgets(s, 1023, fd);
|
||||
char r;
|
||||
if (!sscanf(s, "reverse: %c", &r) != 1)
|
||||
{
|
||||
fgets(s, 1023, fd);
|
||||
race_manager->setReverseTrack(r == 'y');
|
||||
}
|
||||
|
||||
|
||||
if(sscanf(s, "track: %1023s",s1)!=1)
|
||||
Log::warn("History", "Track not found in history file.");
|
||||
race_manager->setTrack(s1);
|
||||
|
@ -546,7 +546,7 @@ void RaceManager::saveGP()
|
||||
m_saved_gp->setKarts(m_kart_status);
|
||||
m_saved_gp->setNextTrack(m_track_number);
|
||||
}
|
||||
else
|
||||
else if(!m_grand_prix.isRandomGP())
|
||||
{
|
||||
m_saved_gp = new SavedGrandPrix(
|
||||
StateManager::get()->getActivePlayerProfile(0)->getUniqueID(),
|
||||
@ -556,12 +556,30 @@ void RaceManager::saveGP()
|
||||
m_track_number,
|
||||
m_grand_prix.getReverseType(),
|
||||
m_kart_status);
|
||||
|
||||
|
||||
// If a new GP is saved, delete any other saved data for this
|
||||
// GP at the same difficulty (even if #karts is different, otherwise
|
||||
// the user has to remember the number of AI karts, with no indication
|
||||
// on which ones are saved).
|
||||
for (unsigned int i = 0;
|
||||
i < UserConfigParams::m_saved_grand_prix_list.size();)
|
||||
{
|
||||
// Delete other save files (and random GP, which should never
|
||||
// have been saved in the first place)
|
||||
const SavedGrandPrix &sgp = UserConfigParams::m_saved_grand_prix_list[i];
|
||||
if (sgp.getGPID() == "random" ||
|
||||
(sgp.getGPID() == m_saved_gp->getGPID() &&
|
||||
sgp.getDifficulty() == m_saved_gp->getDifficulty()) )
|
||||
{
|
||||
UserConfigParams::m_saved_grand_prix_list.erase(i);
|
||||
}
|
||||
else i++;
|
||||
}
|
||||
UserConfigParams::m_saved_grand_prix_list.push_back(m_saved_gp);
|
||||
}
|
||||
|
||||
user_config->saveConfig();
|
||||
}
|
||||
} // saveGP
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
@ -156,7 +156,7 @@ DictionaryManager::get_dictionary(const Language& language)
|
||||
std::string pofile = *p + "/" + best_filename;
|
||||
try
|
||||
{
|
||||
std::auto_ptr<std::istream> in = filesystem->open_file(pofile);
|
||||
std::unique_ptr<std::istream> in = filesystem->open_file(pofile);
|
||||
if (!in.get())
|
||||
{
|
||||
Log::error("tinygettext", "error: failure opening: '%s'.",
|
||||
@ -252,11 +252,11 @@ DictionaryManager::add_directory(const std::string& pathname)
|
||||
search_path.push_back(pathname);
|
||||
}
|
||||
|
||||
/*void
|
||||
DictionaryManager::set_filesystem(std::auto_ptr<FileSystem> filesystem_)
|
||||
void
|
||||
DictionaryManager::set_filesystem(std::unique_ptr<FileSystem> filesystem_)
|
||||
{
|
||||
filesystem = filesystem_;
|
||||
}*/
|
||||
filesystem = std::move(filesystem_);
|
||||
}
|
||||
// ----------------------------------------------------------------------------
|
||||
/** This function converts a .po filename (e.g. zh_TW.po) into a language
|
||||
* specification (zh_TW). On case insensitive file systems (think windows)
|
||||
|
@ -51,7 +51,7 @@ private:
|
||||
|
||||
Dictionary empty_dict;
|
||||
|
||||
std::auto_ptr<FileSystem> filesystem;
|
||||
std::unique_ptr<FileSystem> filesystem;
|
||||
|
||||
void clear_cache();
|
||||
|
||||
@ -89,7 +89,7 @@ public:
|
||||
/** Return a set of the available languages in their country code */
|
||||
std::set<Language> get_languages();
|
||||
|
||||
//void set_filesystem(std::auto_ptr<FileSystem> filesystem);
|
||||
void set_filesystem(std::unique_ptr<FileSystem> filesystem);
|
||||
std::string convertFilename2Language(const std::string &s_in) const;
|
||||
|
||||
|
||||
|
@ -31,7 +31,7 @@ public:
|
||||
virtual ~FileSystem() {}
|
||||
|
||||
virtual std::vector<std::string> open_directory(const std::string& pathname) =0;
|
||||
virtual std::auto_ptr<std::istream> open_file(const std::string& filename) =0;
|
||||
virtual std::unique_ptr<std::istream> open_file(const std::string& filename) =0;
|
||||
};
|
||||
|
||||
} // namespace tinygettext
|
||||
|
@ -44,10 +44,10 @@ StkFileSystem::open_directory(const std::string& pathname)
|
||||
return files;
|
||||
}
|
||||
|
||||
std::auto_ptr<std::istream>
|
||||
std::unique_ptr<std::istream>
|
||||
StkFileSystem::open_file(const std::string& filename)
|
||||
{
|
||||
return std::auto_ptr<std::istream>(new std::ifstream(filename.c_str()));
|
||||
return std::unique_ptr<std::istream>(new std::ifstream(filename.c_str()));
|
||||
}
|
||||
|
||||
} // namespace tinygettext
|
||||
|
@ -28,7 +28,7 @@ public:
|
||||
StkFileSystem();
|
||||
|
||||
std::vector<std::string> open_directory(const std::string& pathname);
|
||||
std::auto_ptr<std::istream> open_file(const std::string& filename);
|
||||
std::unique_ptr<std::istream> open_file(const std::string& filename);
|
||||
};
|
||||
|
||||
} // namespace tinygettext
|
||||
|
@ -69,7 +69,7 @@ void CheckGoal::update(float dt)
|
||||
continue;
|
||||
|
||||
const Vec3 &xyz = obj->getPresentation<TrackObjectPresentationMesh>()->getNode()->getPosition();
|
||||
if(isTriggered(m_previous_position[ball_index], xyz, ball_index))
|
||||
if(isTriggered(m_previous_position[ball_index], xyz, -1))
|
||||
{
|
||||
if(UserConfigParams::m_check_debug)
|
||||
Log::info("CheckGoal", "Goal check structure %d triggered for object %s.",
|
||||
@ -101,7 +101,7 @@ void CheckGoal::trigger(unsigned int kart_index)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
bool CheckGoal::isTriggered(const Vec3 &old_pos, const Vec3 &new_pos,
|
||||
unsigned int indx)
|
||||
unsigned int kartIndex)
|
||||
{
|
||||
core::vector2df cross_point;
|
||||
|
||||
|
@ -63,10 +63,6 @@ bool CheckLap::isTriggered(const Vec3 &old_pos, const Vec3 &new_pos,
|
||||
{
|
||||
World* w = World::getWorld();
|
||||
LinearWorld* lin_world = dynamic_cast<LinearWorld*>(w);
|
||||
if (lin_world != NULL)
|
||||
{
|
||||
lin_world->getTrackSector(kart_index).setLastTriggeredCheckline(m_index);
|
||||
}
|
||||
|
||||
float track_length = w->getTrack()->getTrackLength();
|
||||
// Can happen if a non-lap based race mode is used with a scene file that
|
||||
@ -87,10 +83,7 @@ bool CheckLap::isTriggered(const Vec3 &old_pos, const Vec3 &new_pos,
|
||||
m_previous_distance[kart_index] = current_distance;
|
||||
|
||||
if (result)
|
||||
{
|
||||
LinearWorld* lw = dynamic_cast<LinearWorld*>(w);
|
||||
if (lw != NULL)
|
||||
lw->setLastTriggeredCheckline(kart_index, m_index);
|
||||
}
|
||||
lin_world->setLastTriggeredCheckline(kart_index, m_index);
|
||||
|
||||
return result;
|
||||
} // isTriggered
|
||||
|
@ -120,10 +120,11 @@ CheckLine::~CheckLine()
|
||||
void CheckLine::reset(const Track &track)
|
||||
{
|
||||
CheckStructure::reset(track);
|
||||
for(unsigned int i=0; i<m_previous_sign.size(); i++)
|
||||
|
||||
for (unsigned int i = 0; i<m_previous_sign.size(); i++)
|
||||
{
|
||||
core::vector2df p = m_previous_position[i].toIrrVector2d();
|
||||
m_previous_sign[i] = m_line.getPointOrientation(p)>=0;
|
||||
m_previous_sign[i] = m_line.getPointOrientation(p) >= 0;
|
||||
}
|
||||
} // reset
|
||||
|
||||
@ -158,9 +159,22 @@ bool CheckLine::isTriggered(const Vec3 &old_pos, const Vec3 &new_pos,
|
||||
core::vector2df p=new_pos.toIrrVector2d();
|
||||
bool sign = m_line.getPointOrientation(p)>=0;
|
||||
bool result;
|
||||
|
||||
bool previous_sign;
|
||||
|
||||
if (kart_index == -1)
|
||||
{
|
||||
core::vector2df p = old_pos.toIrrVector2d();
|
||||
previous_sign = (m_line.getPointOrientation(p) >= 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
previous_sign = m_previous_sign[kart_index];
|
||||
}
|
||||
|
||||
// If the sign has changed, i.e. the infinite line was crossed somewhere,
|
||||
// check if the finite line was actually crossed:
|
||||
if (sign != m_previous_sign[kart_index] &&
|
||||
if (sign != previous_sign &&
|
||||
m_line.intersectWith(core::line2df(old_pos.toIrrVector2d(),
|
||||
new_pos.toIrrVector2d()),
|
||||
m_cross_point) )
|
||||
@ -188,9 +202,11 @@ bool CheckLine::isTriggered(const Vec3 &old_pos, const Vec3 &new_pos,
|
||||
}
|
||||
else
|
||||
result = false;
|
||||
m_previous_sign[kart_index] = sign;
|
||||
|
||||
if (result)
|
||||
if (kart_index != -1)
|
||||
m_previous_sign[kart_index] = sign;
|
||||
|
||||
if (result && kart_index != -1)
|
||||
{
|
||||
LinearWorld* lw = dynamic_cast<LinearWorld*>(w);
|
||||
if (lw != NULL)
|
||||
|
@ -168,7 +168,7 @@ int CheckManager::getChecklineTriggering(const Vec3 &from,
|
||||
// FIXME: why is the lapline skipped?
|
||||
if (dynamic_cast<CheckLap*>(c) != NULL) continue;
|
||||
|
||||
if (c->isTriggered(from, to, 0 /* kart id */))
|
||||
if (c->isTriggered(from, to, -1 /* kart id */))
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
|
@ -885,6 +885,18 @@ void Track::convertTrackToBullet(scene::ISceneNode *node)
|
||||
if (mb->getVertexType() == video::EVT_STANDARD)
|
||||
{
|
||||
irr::video::S3DVertex* mbVertices=(video::S3DVertex*)mb->getVertices();
|
||||
if (race_manager->getReverseTrack() &&
|
||||
material->getMirrorAxisInReverse() != ' ')
|
||||
{
|
||||
for (unsigned int i = 0; i < mb->getVertexCount(); i++)
|
||||
{
|
||||
core::vector2df &tc = mb->getTCoords(i);
|
||||
if (material->getMirrorAxisInReverse() == 'V')
|
||||
tc.Y = 1 - tc.Y;
|
||||
else
|
||||
tc.X = 1 - tc.X;
|
||||
}
|
||||
} // reverse track and texture needs mirroring
|
||||
for (unsigned int matrix_index = 0; matrix_index < matrices.size(); matrix_index++)
|
||||
{
|
||||
for (unsigned int j = 0; j < mb->getIndexCount(); j += 3)
|
||||
|
Loading…
Reference in New Issue
Block a user