Replaced tabs with spaces.
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14448 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
c5b8732087
commit
8247f73604
@ -456,22 +456,22 @@ bool AddonsManager::uninstall(const Addon &addon)
|
|||||||
m_addons_list.getData()[index].setInstalled(false);
|
m_addons_list.getData()[index].setInstalled(false);
|
||||||
|
|
||||||
//remove the addons directory
|
//remove the addons directory
|
||||||
bool error = false;
|
bool error = false;
|
||||||
// if the user deleted the data directory for an add-on with
|
// if the user deleted the data directory for an add-on with
|
||||||
// filesystem tools, removeTrack/removeKart will trigger an assert
|
// filesystem tools, removeTrack/removeKart will trigger an assert
|
||||||
// because the kart/track was never added in the first place
|
// because the kart/track was never added in the first place
|
||||||
if (file_manager->fileExists(addon.getDataDir()))
|
if (file_manager->fileExists(addon.getDataDir()))
|
||||||
{
|
{
|
||||||
error = !file_manager->removeDirectory(addon.getDataDir());
|
error = !file_manager->removeDirectory(addon.getDataDir());
|
||||||
if(addon.getType()=="kart")
|
if(addon.getType()=="kart")
|
||||||
{
|
{
|
||||||
kart_properties_manager->removeKart(addon.getId());
|
kart_properties_manager->removeKart(addon.getId());
|
||||||
}
|
}
|
||||||
else if(addon.getType()=="track" || addon.getType()=="arena")
|
else if(addon.getType()=="track" || addon.getType()=="arena")
|
||||||
{
|
{
|
||||||
track_manager->removeTrack(addon.getId());
|
track_manager->removeTrack(addon.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
saveInstalled();
|
saveInstalled();
|
||||||
return !error;
|
return !error;
|
||||||
} // uninstall
|
} // uninstall
|
||||||
|
@ -494,19 +494,19 @@ CURLcode NetworkHttp::downloadFileInternal(Request *request)
|
|||||||
|
|
||||||
curl_easy_setopt(m_curl_session, CURLOPT_URL, full_url.c_str());
|
curl_easy_setopt(m_curl_session, CURLOPT_URL, full_url.c_str());
|
||||||
std::string uagent = (std::string)"SuperTuxKart/" + STK_VERSION;
|
std::string uagent = (std::string)"SuperTuxKart/" + STK_VERSION;
|
||||||
// Add platform to user-agent string for informational purposes.
|
// Add platform to user-agent string for informational purposes.
|
||||||
// Add more cases as necessary.
|
// Add more cases as necessary.
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
uagent += (std::string)" (Windows)";
|
uagent += (std::string)" (Windows)";
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
uagent += (std::string)" (Macintosh)";
|
uagent += (std::string)" (Macintosh)";
|
||||||
#elif defined(__FreeBSD__)
|
#elif defined(__FreeBSD__)
|
||||||
uagent += (std::string)" (FreeBSD)";
|
uagent += (std::string)" (FreeBSD)";
|
||||||
#elif defined(linux)
|
#elif defined(linux)
|
||||||
uagent += (std::string)" (Linux)";
|
uagent += (std::string)" (Linux)";
|
||||||
#else
|
#else
|
||||||
// Unknown system type
|
// Unknown system type
|
||||||
#endif
|
#endif
|
||||||
curl_easy_setopt(m_curl_session, CURLOPT_USERAGENT, uagent.c_str());
|
curl_easy_setopt(m_curl_session, CURLOPT_USERAGENT, uagent.c_str());
|
||||||
curl_easy_setopt(m_curl_session, CURLOPT_FOLLOWLOCATION, 1);
|
curl_easy_setopt(m_curl_session, CURLOPT_FOLLOWLOCATION, 1);
|
||||||
curl_easy_setopt(m_curl_session, CURLOPT_PROGRESSDATA, request);
|
curl_easy_setopt(m_curl_session, CURLOPT_PROGRESSDATA, request);
|
||||||
|
@ -721,11 +721,11 @@ bool UserConfig::loadConfig()
|
|||||||
|
|
||||||
void UserConfig::postLoadInit()
|
void UserConfig::postLoadInit()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < UserConfigParams::m_all_players.size(); i++)
|
for (int i = 0; i < UserConfigParams::m_all_players.size(); i++)
|
||||||
{
|
{
|
||||||
PlayerProfile* player = UserConfigParams::m_all_players.get(i);
|
PlayerProfile* player = UserConfigParams::m_all_players.get(i);
|
||||||
if (player->isGuestAccount()) player->setName(_LTR("Guest"));
|
if (player->isGuestAccount()) player->setName(_LTR("Guest"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@ -354,27 +354,27 @@ namespace UserConfigParams
|
|||||||
&m_wiimote_group,
|
&m_wiimote_group,
|
||||||
"At what raw input value maximum steering is reached (between 1 and 25).") );
|
"At what raw input value maximum steering is reached (between 1 and 25).") );
|
||||||
|
|
||||||
PARAM_PREFIX FloatUserConfigParam m_wiimote_weight_linear
|
PARAM_PREFIX FloatUserConfigParam m_wiimote_weight_linear
|
||||||
PARAM_DEFAULT( FloatUserConfigParam(0.2f, "wiimote-weight-linear",
|
PARAM_DEFAULT( FloatUserConfigParam(0.2f, "wiimote-weight-linear",
|
||||||
&m_wiimote_group,
|
&m_wiimote_group,
|
||||||
"A weight applied to the linear component of mapping wiimote angle to steering angle"));
|
"A weight applied to the linear component of mapping wiimote angle to steering angle"));
|
||||||
|
|
||||||
PARAM_PREFIX FloatUserConfigParam m_wiimote_weight_square
|
PARAM_PREFIX FloatUserConfigParam m_wiimote_weight_square
|
||||||
PARAM_DEFAULT( FloatUserConfigParam(0.8f, "wiimote-weight-square",
|
PARAM_DEFAULT( FloatUserConfigParam(0.8f, "wiimote-weight-square",
|
||||||
&m_wiimote_group,
|
&m_wiimote_group,
|
||||||
"A weight applied to the square component of mapping wiimote angle to steering angle"));
|
"A weight applied to the square component of mapping wiimote angle to steering angle"));
|
||||||
|
|
||||||
PARAM_PREFIX FloatUserConfigParam m_wiimote_weight_asin
|
PARAM_PREFIX FloatUserConfigParam m_wiimote_weight_asin
|
||||||
PARAM_DEFAULT( FloatUserConfigParam(0.0f, "wiimote-weight-asin",
|
PARAM_DEFAULT( FloatUserConfigParam(0.0f, "wiimote-weight-asin",
|
||||||
&m_wiimote_group,
|
&m_wiimote_group,
|
||||||
"A weight applied to the asin component of mapping wiimote angle to steering angle"));
|
"A weight applied to the asin component of mapping wiimote angle to steering angle"));
|
||||||
|
|
||||||
PARAM_PREFIX FloatUserConfigParam m_wiimote_weight_sin
|
PARAM_PREFIX FloatUserConfigParam m_wiimote_weight_sin
|
||||||
PARAM_DEFAULT( FloatUserConfigParam(0.0f, "wiimote-weight-sin",
|
PARAM_DEFAULT( FloatUserConfigParam(0.0f, "wiimote-weight-sin",
|
||||||
&m_wiimote_group,
|
&m_wiimote_group,
|
||||||
"A weight applied to the sin component of mapping wiimote angle to steering angle"));
|
"A weight applied to the sin component of mapping wiimote angle to steering angle"));
|
||||||
|
|
||||||
// ---- GP start order
|
// ---- GP start order
|
||||||
PARAM_PREFIX GroupUserConfigParam m_gp_start_order
|
PARAM_PREFIX GroupUserConfigParam m_gp_start_order
|
||||||
PARAM_DEFAULT( GroupUserConfigParam("GpStartOrder",
|
PARAM_DEFAULT( GroupUserConfigParam("GpStartOrder",
|
||||||
"Order karts start in GP") );
|
"Order karts start in GP") );
|
||||||
@ -719,7 +719,7 @@ public:
|
|||||||
const irr::core::stringw& getWarning() { return m_warning; }
|
const irr::core::stringw& getWarning() { return m_warning; }
|
||||||
void resetWarning() { m_warning=""; }
|
void resetWarning() { m_warning=""; }
|
||||||
void setWarning(irr::core::stringw& warning) { m_warning=warning; }
|
void setWarning(irr::core::stringw& warning) { m_warning=warning; }
|
||||||
void postLoadInit();
|
void postLoadInit();
|
||||||
void addDefaultPlayer();
|
void addDefaultPlayer();
|
||||||
|
|
||||||
}; // UserConfig
|
}; // UserConfig
|
||||||
|
@ -265,8 +265,8 @@ void IrrDriver::initDevice()
|
|||||||
if(m_modes.size()==0)
|
if(m_modes.size()==0)
|
||||||
{
|
{
|
||||||
createListOfVideoModes();
|
createListOfVideoModes();
|
||||||
// The debug name is only set if irrlicht is compiled in debug
|
// The debug name is only set if irrlicht is compiled in debug
|
||||||
// mode. So we use this to print a warning to the user.
|
// mode. So we use this to print a warning to the user.
|
||||||
if(m_device->getDebugName())
|
if(m_device->getDebugName())
|
||||||
{
|
{
|
||||||
Log::warn("irr_driver",
|
Log::warn("irr_driver",
|
||||||
@ -858,8 +858,8 @@ scene::ISceneNode *IrrDriver::addBillboard(const core::dimension2d< f32 > size,
|
|||||||
m_scene_manager->addBillboardSceneNode(parent, size);
|
m_scene_manager->addBillboardSceneNode(parent, size);
|
||||||
assert(node->getMaterialCount() > 0);
|
assert(node->getMaterialCount() > 0);
|
||||||
node->setMaterialTexture(0, texture);
|
node->setMaterialTexture(0, texture);
|
||||||
if(alphaTesting)
|
if(alphaTesting)
|
||||||
node->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF);
|
node->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF);
|
||||||
return node;
|
return node;
|
||||||
} // addMesh
|
} // addMesh
|
||||||
|
|
||||||
|
@ -112,8 +112,8 @@ public:
|
|||||||
std::vector<scene::ISceneNode*>& getAllNodes() { return m_nodes; }
|
std::vector<scene::ISceneNode*>& getAllNodes() { return m_nodes; }
|
||||||
|
|
||||||
//! OnAnimate() is called just before rendering the whole scene.
|
//! OnAnimate() is called just before rendering the whole scene.
|
||||||
/** This method will be called once per frame, independent
|
/** This method will be called once per frame, independent
|
||||||
of whether the scene node is visible or not. */
|
of whether the scene node is visible or not. */
|
||||||
virtual void OnAnimate(u32 timeMs);
|
virtual void OnAnimate(u32 timeMs);
|
||||||
|
|
||||||
virtual void OnRegisterSceneNode();
|
virtual void OnRegisterSceneNode();
|
||||||
|
@ -1426,11 +1426,11 @@ void Material::setMaterialProperties(video::SMaterial *m, scene::IMeshBuffer* m
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
//! Texture is clamped to the last pixel
|
//! Texture is clamped to the last pixel
|
||||||
ETC_CLAMP,
|
ETC_CLAMP,
|
||||||
//! Texture is clamped to the edge pixel
|
//! Texture is clamped to the edge pixel
|
||||||
ETC_CLAMP_TO_EDGE,
|
ETC_CLAMP_TO_EDGE,
|
||||||
//! Texture is clamped to the border pixel (if exists)
|
//! Texture is clamped to the border pixel (if exists)
|
||||||
ETC_CLAMP_TO_BORDER,
|
ETC_CLAMP_TO_BORDER,
|
||||||
*/
|
*/
|
||||||
for (unsigned int n=0; n<video::MATERIAL_MAX_TEXTURES; n++)
|
for (unsigned int n=0; n<video::MATERIAL_MAX_TEXTURES; n++)
|
||||||
{
|
{
|
||||||
|
@ -219,7 +219,7 @@ void ParticleEmitter::update(float dt)
|
|||||||
|
|
||||||
// the emission direction does not automatically follow the orientation of
|
// the emission direction does not automatically follow the orientation of
|
||||||
// the node so fix that manually...
|
// the node so fix that manually...
|
||||||
core::matrix4 transform = m_node->getAbsoluteTransformation();
|
core::matrix4 transform = m_node->getAbsoluteTransformation();
|
||||||
core::vector3df velocity(m_particle_type->getVelocityX(),
|
core::vector3df velocity(m_particle_type->getVelocityX(),
|
||||||
m_particle_type->getVelocityY(),
|
m_particle_type->getVelocityY(),
|
||||||
m_particle_type->getVelocityZ());
|
m_particle_type->getVelocityZ());
|
||||||
|
@ -77,12 +77,12 @@ namespace GUIEngine
|
|||||||
Widget* getWidget(const int id);
|
Widget* getWidget(const int id);
|
||||||
|
|
||||||
/** This function searches and returns a widget by name, cast as specified type,
|
/** This function searches and returns a widget by name, cast as specified type,
|
||||||
* if that widget is found and the type is correct.
|
* if that widget is found and the type is correct.
|
||||||
* \param name The name of the widget to find
|
* \param name The name of the widget to find
|
||||||
* \return an object by name, casted to specified type, or NULL if
|
* \return an object by name, casted to specified type, or NULL if
|
||||||
* not found/wrong type */
|
* not found/wrong type */
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T* getWidget(const char* name)
|
T* getWidget(const char* name)
|
||||||
{
|
{
|
||||||
Widget* out = getWidget(name);
|
Widget* out = getWidget(name);
|
||||||
T* outCasted = dynamic_cast<T*>( out );
|
T* outCasted = dynamic_cast<T*>( out );
|
||||||
|
@ -128,7 +128,7 @@ namespace SkinConfig
|
|||||||
|
|
||||||
if(node->get("type", &type) == 0)
|
if(node->get("type", &type) == 0)
|
||||||
{
|
{
|
||||||
Log::error("skin", "All elements must have a type\n");
|
Log::error("skin", "All elements must have a type\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
node->get("state", &state);
|
node->get("state", &state);
|
||||||
@ -155,7 +155,7 @@ namespace SkinConfig
|
|||||||
if(!root)
|
if(!root)
|
||||||
{
|
{
|
||||||
Log::error("skin", "Could not read XML file '%s'.",
|
Log::error("skin", "Could not read XML file '%s'.",
|
||||||
file.c_str());
|
file.c_str());
|
||||||
throw std::runtime_error("Invalid skin file");
|
throw std::runtime_error("Invalid skin file");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,7 +175,7 @@ namespace SkinConfig
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log::error("skin", "Unknown node in XML file '%s'.",
|
Log::error("skin", "Unknown node in XML file '%s'.",
|
||||||
node->getName().c_str());
|
node->getName().c_str());
|
||||||
}
|
}
|
||||||
}// nend for
|
}// nend for
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
|||||||
// SuperTuxKart - a fun racing game with go-kart
|
// Supertuxkart - a fun racing game with go-kart
|
||||||
// Copyright (C) 2009-2013 Marianne Gagnon
|
// Copyright (C) 2009-2013 Marianne Gagnon
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or
|
// This program is free software; you can redistribute it and/or
|
||||||
@ -945,37 +945,37 @@ void DynamicRibbonWidget::updateItemDisplay()
|
|||||||
IconButtonWidget* icon = dynamic_cast<IconButtonWidget*>(&row.m_children[i]);
|
IconButtonWidget* icon = dynamic_cast<IconButtonWidget*>(&row.m_children[i]);
|
||||||
assert(icon != NULL);
|
assert(icon != NULL);
|
||||||
|
|
||||||
//FIXME : it is a bit hackish
|
//FIXME : it is a bit hackish
|
||||||
if(i < item_placement[n].size())
|
if(i < item_placement[n].size())
|
||||||
{
|
{
|
||||||
icon_id = item_placement[n][i];
|
icon_id = item_placement[n][i];
|
||||||
if (icon_id < item_amount && icon_id != -1)
|
if (icon_id < item_amount && icon_id != -1)
|
||||||
{
|
{
|
||||||
std::string item_icon = (m_items[icon_id].m_animated ?
|
std::string item_icon = (m_items[icon_id].m_animated ?
|
||||||
m_items[icon_id].m_all_images[0] :
|
m_items[icon_id].m_all_images[0] :
|
||||||
m_items[icon_id].m_sshot_file);
|
m_items[icon_id].m_sshot_file);
|
||||||
icon->setImage( item_icon.c_str(), m_items[icon_id].m_image_path_type );
|
icon->setImage( item_icon.c_str(), m_items[icon_id].m_image_path_type );
|
||||||
|
|
||||||
icon->m_properties[PROP_ID] = m_items[icon_id].m_code_name;
|
icon->m_properties[PROP_ID] = m_items[icon_id].m_code_name;
|
||||||
icon->setLabel(m_items[icon_id].m_user_name);
|
icon->setLabel(m_items[icon_id].m_user_name);
|
||||||
icon->m_text = m_items[icon_id].m_user_name;
|
icon->m_text = m_items[icon_id].m_user_name;
|
||||||
icon->m_badges = m_items[icon_id].m_badges;
|
icon->m_badges = m_items[icon_id].m_badges;
|
||||||
|
|
||||||
//std::cout << " item " << i << " is " << m_items[icon_id].m_code_name << "\n";
|
//std::cout << " item " << i << " is " << m_items[icon_id].m_code_name << "\n";
|
||||||
|
|
||||||
//std::wcout << L"Setting widget text '" << icon->m_text.c_str() << L"'\n";
|
//std::wcout << L"Setting widget text '" << icon->m_text.c_str() << L"'\n";
|
||||||
|
|
||||||
// if the ribbon has no "ribbon-wide" label, call will do nothing
|
// if the ribbon has no "ribbon-wide" label, call will do nothing
|
||||||
row.setLabel(i, m_items[icon_id].m_user_name);
|
row.setLabel(i, m_items[icon_id].m_user_name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
icon->setImage( "textures/transparence.png", IconButtonWidget::ICON_PATH_TYPE_RELATIVE );
|
icon->setImage( "textures/transparence.png", IconButtonWidget::ICON_PATH_TYPE_RELATIVE );
|
||||||
icon->resetAllBadges();
|
icon->resetAllBadges();
|
||||||
icon->m_properties[PROP_ID] = RibbonWidget::NO_ITEM_ID;
|
icon->m_properties[PROP_ID] = RibbonWidget::NO_ITEM_ID;
|
||||||
//std::cout << " item " << i << " is a FILLER\n";
|
//std::cout << " item " << i << " is a FILLER\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // next column
|
} // next column
|
||||||
} // next row
|
} // next row
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ void SpinnerWidget::add()
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
std::istringstream myStream(min_s);
|
std::istringstream myStream(min_s);
|
||||||
myStream >> i;
|
myStream >> i;
|
||||||
bool is_number = (i!=0);
|
bool is_number = (i!=0);
|
||||||
if (is_number)
|
if (is_number)
|
||||||
{
|
{
|
||||||
@ -80,7 +80,7 @@ void SpinnerWidget::add()
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
std::istringstream myStream(max_s);
|
std::istringstream myStream(max_s);
|
||||||
myStream >> i;
|
myStream >> i;
|
||||||
bool is_number = (i!=0);
|
bool is_number = (i!=0);
|
||||||
if (is_number)
|
if (is_number)
|
||||||
{
|
{
|
||||||
|
@ -156,7 +156,7 @@ public:
|
|||||||
StateManager::ActivePlayer** player /* out */,
|
StateManager::ActivePlayer** player /* out */,
|
||||||
PlayerAction* action /* out */ );
|
PlayerAction* action /* out */ );
|
||||||
|
|
||||||
void clearLatestUsedDevice();
|
void clearLatestUsedDevice();
|
||||||
InputDevice* getLatestUsedDevice();
|
InputDevice* getLatestUsedDevice();
|
||||||
bool initialize();
|
bool initialize();
|
||||||
void serialize();
|
void serialize();
|
||||||
|
@ -105,7 +105,7 @@ void Wiimote::update()
|
|||||||
const float sign = normalized_angle >= 0.0f ? 1.0f : -1.0f;
|
const float sign = normalized_angle >= 0.0f ? 1.0f : -1.0f;
|
||||||
const float normalized_angle_2 = w1 * normalized_angle
|
const float normalized_angle_2 = w1 * normalized_angle
|
||||||
+ w2 * sign*normalized_angle*normalized_angle
|
+ w2 * sign*normalized_angle*normalized_angle
|
||||||
+ wa * asin(normalized_angle)*(2.0f/M_PI)
|
+ wa * asin(normalized_angle)*(2.0f/M_PI)
|
||||||
+ ws * sin(normalized_angle*(M_PI/2.0f));
|
+ ws * sin(normalized_angle*(M_PI/2.0f));
|
||||||
const float JOYSTICK_ABS_MAX_ANGLE = 32766.0f;
|
const float JOYSTICK_ABS_MAX_ANGLE = 32766.0f;
|
||||||
|
|
||||||
|
@ -304,19 +304,19 @@ void* WiimoteManager::threadFuncWrapper(void *data)
|
|||||||
*/
|
*/
|
||||||
int WiimoteManager::askUserToConnectWiimotes()
|
int WiimoteManager::askUserToConnectWiimotes()
|
||||||
{
|
{
|
||||||
new MessageDialog(
|
new MessageDialog(
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
_("Connect your wiimote to the Bluetooth manager, then click on Ok."
|
_("Connect your wiimote to the Bluetooth manager, then click on Ok."
|
||||||
"Detailed instructions at supertuxkart.net/Wiimote"),
|
"Detailed instructions at supertuxkart.net/Wiimote"),
|
||||||
#else
|
#else
|
||||||
_("Press the buttons 1+2 simultaneously on your wiimote to put "
|
_("Press the buttons 1+2 simultaneously on your wiimote to put "
|
||||||
"it in discovery mode, then click on Ok."
|
"it in discovery mode, then click on Ok."
|
||||||
"Detailed instructions at supertuxkart.net/Wiimote"),
|
"Detailed instructions at supertuxkart.net/Wiimote"),
|
||||||
#endif
|
#endif
|
||||||
MessageDialog::MESSAGE_DIALOG_OK_CANCEL,
|
MessageDialog::MESSAGE_DIALOG_OK_CANCEL,
|
||||||
new WiimoteDialogListener(), true);
|
new WiimoteDialogListener(), true);
|
||||||
|
|
||||||
return getNumberOfWiimotes();
|
return getNumberOfWiimotes();
|
||||||
} // askUserToConnectWiimotes
|
} // askUserToConnectWiimotes
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
@ -325,23 +325,23 @@ int WiimoteManager::askUserToConnectWiimotes()
|
|||||||
*/
|
*/
|
||||||
void WiimoteManager::WiimoteDialogListener::onConfirm()
|
void WiimoteManager::WiimoteDialogListener::onConfirm()
|
||||||
{
|
{
|
||||||
GUIEngine::ModalDialog::dismiss();
|
GUIEngine::ModalDialog::dismiss();
|
||||||
|
|
||||||
wiimote_manager->launchDetection(5);
|
wiimote_manager->launchDetection(5);
|
||||||
|
|
||||||
int nb_wiimotes = wiimote_manager->getNumberOfWiimotes();
|
int nb_wiimotes = wiimote_manager->getNumberOfWiimotes();
|
||||||
if(nb_wiimotes > 0)
|
if(nb_wiimotes > 0)
|
||||||
{
|
{
|
||||||
core::stringw msg = StringUtils::insertValues(
|
core::stringw msg = StringUtils::insertValues(
|
||||||
_("Found %d wiimote(s)"),
|
_("Found %d wiimote(s)"),
|
||||||
core::stringw(nb_wiimotes));
|
core::stringw(nb_wiimotes));
|
||||||
|
|
||||||
new MessageDialog( msg );
|
new MessageDialog( msg );
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
new MessageDialog( _("Could not detect any wiimote :/") );
|
new MessageDialog( _("Could not detect any wiimote :/") );
|
||||||
}
|
}
|
||||||
} // WiimoteDialogListeneronConfirm
|
} // WiimoteDialogListeneronConfirm
|
||||||
#endif // ENABLE_WIIUSE
|
#endif // ENABLE_WIIUSE
|
||||||
|
@ -63,8 +63,8 @@ private:
|
|||||||
bool m_shut;
|
bool m_shut;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** True if wii is enabled via command line option. */
|
/** True if wii is enabled via command line option. */
|
||||||
static bool m_enabled;
|
static bool m_enabled;
|
||||||
|
|
||||||
/** Wiimotes update thread */
|
/** Wiimotes update thread */
|
||||||
void threadFunc();
|
void threadFunc();
|
||||||
@ -75,11 +75,11 @@ public:
|
|||||||
WiimoteManager();
|
WiimoteManager();
|
||||||
~WiimoteManager();
|
~WiimoteManager();
|
||||||
|
|
||||||
/** Sets the wiimote to be enabled. */
|
/** Sets the wiimote to be enabled. */
|
||||||
static void enable() { m_enabled = true; }
|
static void enable() { m_enabled = true; }
|
||||||
|
|
||||||
/** Returns if the wii was enabled on the command line. */
|
/** Returns if the wii was enabled on the command line. */
|
||||||
static bool isEnabled() { return m_enabled; }
|
static bool isEnabled() { return m_enabled; }
|
||||||
|
|
||||||
void launchDetection(int timeout);
|
void launchDetection(int timeout);
|
||||||
void update();
|
void update();
|
||||||
@ -87,20 +87,20 @@ public:
|
|||||||
|
|
||||||
void enableAccelerometer(bool state);
|
void enableAccelerometer(bool state);
|
||||||
|
|
||||||
/** A simple listener to allow the user to connect wiimotes. It
|
/** A simple listener to allow the user to connect wiimotes. It
|
||||||
* will display a feedback windows (# wiimotes connected or 'no wiimotes
|
* will display a feedback windows (# wiimotes connected or 'no wiimotes
|
||||||
* found').
|
* found').
|
||||||
*/
|
*/
|
||||||
class WiimoteDialogListener : public MessageDialog::IConfirmDialogListener
|
class WiimoteDialogListener : public MessageDialog::IConfirmDialogListener
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void onConfirm() OVERRIDE;
|
virtual void onConfirm() OVERRIDE;
|
||||||
}; // class WiimoteDialoListener
|
}; // class WiimoteDialoListener
|
||||||
|
|
||||||
/** Shows a dialog allowing the user to connect wiimotes.
|
/** Shows a dialog allowing the user to connect wiimotes.
|
||||||
* \return Number of wiimotes connected.
|
* \return Number of wiimotes connected.
|
||||||
*/
|
*/
|
||||||
int askUserToConnectWiimotes();
|
int askUserToConnectWiimotes();
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
/** Returns the number of wiimotes connected. */
|
/** Returns the number of wiimotes connected. */
|
||||||
unsigned int getNumberOfWiimotes() const {return m_wiimotes.size();}
|
unsigned int getNumberOfWiimotes() const {return m_wiimotes.size();}
|
||||||
|
@ -578,7 +578,7 @@ float RubberBall::updateHeight()
|
|||||||
if(m_current_max_height>m_max_height)
|
if(m_current_max_height>m_max_height)
|
||||||
m_current_max_height = m_max_height;
|
m_current_max_height = m_max_height;
|
||||||
m_interval = m_current_max_height / 10.0f;
|
m_interval = m_current_max_height / 10.0f;
|
||||||
// Avoid too small hops and esp. a division by zero
|
// Avoid too small hops and esp. a division by zero
|
||||||
if(m_interval<0.01f)
|
if(m_interval<0.01f)
|
||||||
m_interval = 0.1f;
|
m_interval = 0.1f;
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ AbstractKart::AbstractKart(const std::string& ident,
|
|||||||
m_kart_width = m_kart_model->getWidth();
|
m_kart_width = m_kart_model->getWidth();
|
||||||
m_kart_height = m_kart_model->getHeight();
|
m_kart_height = m_kart_model->getHeight();
|
||||||
m_kart_length = m_kart_model->getLength();
|
m_kart_length = m_kart_model->getLength();
|
||||||
m_kart_highest_point = m_kart_model->getHighestPoint();
|
m_kart_highest_point = m_kart_model->getHighestPoint();
|
||||||
m_wheel_graphics_position = m_kart_model->getWheelsGraphicsPosition();
|
m_wheel_graphics_position = m_kart_model->getWheelsGraphicsPosition();
|
||||||
} // AbstractKart
|
} // AbstractKart
|
||||||
|
|
||||||
|
@ -51,8 +51,8 @@ private:
|
|||||||
float m_kart_width;
|
float m_kart_width;
|
||||||
/** Height of the kart, copy of the data from KartModel. */
|
/** Height of the kart, copy of the data from KartModel. */
|
||||||
float m_kart_height;
|
float m_kart_height;
|
||||||
/** Coordinate on up axis */
|
/** Coordinate on up axis */
|
||||||
float m_kart_highest_point;
|
float m_kart_highest_point;
|
||||||
/** The position of all four wheels in the 3d model */
|
/** The position of all four wheels in the 3d model */
|
||||||
const Vec3* m_wheel_graphics_position;
|
const Vec3* m_wheel_graphics_position;
|
||||||
|
|
||||||
@ -151,9 +151,9 @@ public:
|
|||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
/** Returns the width of the kart. */
|
/** Returns the width of the kart. */
|
||||||
float getKartWidth() const {return m_kart_width; }
|
float getKartWidth() const {return m_kart_width; }
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
/** Returns the highest point of the kart (coordinate on up axis) */
|
/** Returns the highest point of the kart (coordinate on up axis) */
|
||||||
float getHighestPoint() const { return m_kart_highest_point; }
|
float getHighestPoint() const { return m_kart_highest_point; }
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
/** Returns true if this kart has no wheels. */
|
/** Returns true if this kart has no wheels. */
|
||||||
bool isWheeless() const;
|
bool isWheeless() const;
|
||||||
|
@ -41,8 +41,8 @@ private:
|
|||||||
/** Name of this animation, used for debug prints only. */
|
/** Name of this animation, used for debug prints only. */
|
||||||
std::string m_name;
|
std::string m_name;
|
||||||
protected:
|
protected:
|
||||||
/** A pointer to the kart which is animated by this class. */
|
/** A pointer to the kart which is animated by this class. */
|
||||||
AbstractKart *m_kart;
|
AbstractKart *m_kart;
|
||||||
|
|
||||||
/** Timer for the explosion. */
|
/** Timer for the explosion. */
|
||||||
float m_timer;
|
float m_timer;
|
||||||
|
@ -119,8 +119,8 @@ AIBaseController::AIBaseController(AbstractKart *kart,
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void AIBaseController::reset()
|
void AIBaseController::reset()
|
||||||
{
|
{
|
||||||
m_stuck_trigger_rescue = false;
|
m_stuck_trigger_rescue = false;
|
||||||
m_collision_times.clear();
|
m_collision_times.clear();
|
||||||
} // reset
|
} // reset
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -220,7 +220,7 @@ void AIBaseController::computePath()
|
|||||||
*/
|
*/
|
||||||
void AIBaseController::update(float dt)
|
void AIBaseController::update(float dt)
|
||||||
{
|
{
|
||||||
m_stuck_trigger_rescue = false;
|
m_stuck_trigger_rescue = false;
|
||||||
|
|
||||||
if(QuadGraph::get())
|
if(QuadGraph::get())
|
||||||
{
|
{
|
||||||
@ -255,52 +255,52 @@ void AIBaseController::update(float dt)
|
|||||||
*/
|
*/
|
||||||
void AIBaseController::crashed(const Material *m)
|
void AIBaseController::crashed(const Material *m)
|
||||||
{
|
{
|
||||||
// Defines how many collision in what time will trigger a rescue.
|
// Defines how many collision in what time will trigger a rescue.
|
||||||
// Note that typically it takes ~0.5 seconds for the AI to hit
|
// Note that typically it takes ~0.5 seconds for the AI to hit
|
||||||
// the track again if it is stuck (i.e. time for the push back plus
|
// the track again if it is stuck (i.e. time for the push back plus
|
||||||
// time for the AI to accelerate and hit the terrain again).
|
// time for the AI to accelerate and hit the terrain again).
|
||||||
const unsigned int NUM_COLLISION = 3;
|
const unsigned int NUM_COLLISION = 3;
|
||||||
const float COLLISION_TIME = 1.5f;
|
const float COLLISION_TIME = 1.5f;
|
||||||
|
|
||||||
float time = World::getWorld()->getTime();
|
float time = World::getWorld()->getTime();
|
||||||
if(m_collision_times.size()==0)
|
if(m_collision_times.size()==0)
|
||||||
{
|
{
|
||||||
m_collision_times.push_back(time);
|
m_collision_times.push_back(time);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter out multiple collisions report caused by single collision
|
// Filter out multiple collisions report caused by single collision
|
||||||
// (bullet can report a collision more than once per frame, and
|
// (bullet can report a collision more than once per frame, and
|
||||||
// resolving it can take a few frames as well, causing more reported
|
// resolving it can take a few frames as well, causing more reported
|
||||||
// collisions to happen). The time of 0.2 seconds was experimentally
|
// collisions to happen). The time of 0.2 seconds was experimentally
|
||||||
// found, typically it takes 0.5 seconds for a kart to be pushed back
|
// found, typically it takes 0.5 seconds for a kart to be pushed back
|
||||||
// from the terrain and accelerate to hit the same terrain again.
|
// from the terrain and accelerate to hit the same terrain again.
|
||||||
if(time - m_collision_times.back() < 0.2f)
|
if(time - m_collision_times.back() < 0.2f)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
// Remove all outdated entries, i.e. entries that are older than the
|
// Remove all outdated entries, i.e. entries that are older than the
|
||||||
// collision time plus 1 second. Older entries must be deleted,
|
// collision time plus 1 second. Older entries must be deleted,
|
||||||
// otherwise a collision that happened (say) 10 seconds ago could
|
// otherwise a collision that happened (say) 10 seconds ago could
|
||||||
// contribute to a stuck condition.
|
// contribute to a stuck condition.
|
||||||
while(m_collision_times.size()>0 &&
|
while(m_collision_times.size()>0 &&
|
||||||
time - m_collision_times[0] > 1.0f+COLLISION_TIME)
|
time - m_collision_times[0] > 1.0f+COLLISION_TIME)
|
||||||
m_collision_times.erase(m_collision_times.begin());
|
m_collision_times.erase(m_collision_times.begin());
|
||||||
|
|
||||||
m_collision_times.push_back(time);
|
m_collision_times.push_back(time);
|
||||||
|
|
||||||
// Now detect if there are enough collision records in the
|
// Now detect if there are enough collision records in the
|
||||||
// specified time interval.
|
// specified time interval.
|
||||||
if(time - m_collision_times.front() > COLLISION_TIME
|
if(time - m_collision_times.front() > COLLISION_TIME
|
||||||
&& m_collision_times.size()>=NUM_COLLISION)
|
&& m_collision_times.size()>=NUM_COLLISION)
|
||||||
{
|
{
|
||||||
// We can't call m_kart->forceRescue here, since crased() is
|
// We can't call m_kart->forceRescue here, since crased() is
|
||||||
// called during physics processing, and forceRescue() removes the
|
// called during physics processing, and forceRescue() removes the
|
||||||
// chassis from the physics world, which would then cause
|
// chassis from the physics world, which would then cause
|
||||||
// inconsistencies and potentially a crash during the physics
|
// inconsistencies and potentially a crash during the physics
|
||||||
// processing. So only set a flag, which is tested during update.
|
// processing. So only set a flag, which is tested during update.
|
||||||
m_stuck_trigger_rescue = true;
|
m_stuck_trigger_rescue = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // crashed(Material)
|
} // crashed(Material)
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ public:
|
|||||||
virtual void handleZipper(bool play_sound) {};
|
virtual void handleZipper(bool play_sound) {};
|
||||||
virtual void finishedRace(float time) {};
|
virtual void finishedRace(float time) {};
|
||||||
virtual void collectedItem(const Item &item, int add_info=-1,
|
virtual void collectedItem(const Item &item, int add_info=-1,
|
||||||
float previous_energy=0) {};
|
float previous_energy=0) {};
|
||||||
virtual void setPosition(int p) {};
|
virtual void setPosition(int p) {};
|
||||||
virtual bool isNetworkController() const { return false; }
|
virtual bool isNetworkController() const { return false; }
|
||||||
virtual bool isPlayerController() const { return false; }
|
virtual bool isPlayerController() const { return false; }
|
||||||
|
@ -72,20 +72,20 @@ public:
|
|||||||
virtual bool isPlayerController () const = 0;
|
virtual bool isPlayerController () const = 0;
|
||||||
virtual bool isNetworkController() const = 0;
|
virtual bool isNetworkController() const = 0;
|
||||||
virtual bool disableSlipstreamBonus() const = 0;
|
virtual bool disableSlipstreamBonus() const = 0;
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
/** Sets the controller name for this controller. */
|
/** Sets the controller name for this controller. */
|
||||||
virtual void setControllerName(const std::string &name)
|
virtual void setControllerName(const std::string &name)
|
||||||
{ m_controller_name = name; }
|
{ m_controller_name = name; }
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
/** Returns the name of this controller. */
|
/** Returns the name of this controller. */
|
||||||
const std::string &getControllerName() const { return m_controller_name; }
|
const std::string &getControllerName() const { return m_controller_name; }
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
/** Returns the active player for this controller (NULL
|
/** Returns the active player for this controller (NULL
|
||||||
* if this controller does not belong to a player. */
|
* if this controller does not belong to a player. */
|
||||||
StateManager::ActivePlayer *getPlayer () {return m_player;}
|
StateManager::ActivePlayer *getPlayer () {return m_player;}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
/** Returns the player object (or NULL if it's a computer controller). */
|
/** Returns the player object (or NULL if it's a computer controller). */
|
||||||
const StateManager::ActivePlayer *getPlayer () const { return m_player; }
|
const StateManager::ActivePlayer *getPlayer () const { return m_player; }
|
||||||
|
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
@ -208,7 +208,7 @@ void SkiddingAI::reset()
|
|||||||
m_track_node = QuadGraph::get()->findOutOfRoadSector(m_kart->getXYZ());
|
m_track_node = QuadGraph::get()->findOutOfRoadSector(m_kart->getXYZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
AIBaseController::reset();
|
AIBaseController::reset();
|
||||||
} // reset
|
} // reset
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -486,8 +486,8 @@ void SkiddingAI::handleSteering(float dt)
|
|||||||
*finite state machine.
|
*finite state machine.
|
||||||
*/
|
*/
|
||||||
//Reaction to being outside of the road
|
//Reaction to being outside of the road
|
||||||
float side_dist =
|
float side_dist =
|
||||||
m_world->getDistanceToCenterForKart( m_kart->getWorldKartId() );
|
m_world->getDistanceToCenterForKart( m_kart->getWorldKartId() );
|
||||||
|
|
||||||
if( fabsf(side_dist) >
|
if( fabsf(side_dist) >
|
||||||
0.5f* QuadGraph::get()->getNode(m_track_node).getPathWidth()+0.5f )
|
0.5f* QuadGraph::get()->getNode(m_track_node).getPathWidth()+0.5f )
|
||||||
|
@ -278,7 +278,7 @@ KartModel* KartModel::makeCopy()
|
|||||||
km->m_kart_width = m_kart_width;
|
km->m_kart_width = m_kart_width;
|
||||||
km->m_kart_length = m_kart_length;
|
km->m_kart_length = m_kart_length;
|
||||||
km->m_kart_height = m_kart_height;
|
km->m_kart_height = m_kart_height;
|
||||||
km->m_kart_highest_point= m_kart_highest_point;
|
km->m_kart_highest_point= m_kart_highest_point;
|
||||||
km->m_kart_lowest_point = m_kart_lowest_point;
|
km->m_kart_lowest_point = m_kart_lowest_point;
|
||||||
km->m_mesh = m_mesh;
|
km->m_mesh = m_mesh;
|
||||||
km->m_model_filename = m_model_filename;
|
km->m_model_filename = m_model_filename;
|
||||||
@ -473,7 +473,7 @@ bool KartModel::loadModels(const KartProperties &kart_properties)
|
|||||||
MeshTools::minMax3D(m_mesh->getMesh(m_animation_frame[AF_STRAIGHT]),
|
MeshTools::minMax3D(m_mesh->getMesh(m_animation_frame[AF_STRAIGHT]),
|
||||||
&kart_min, &kart_max);
|
&kart_min, &kart_max);
|
||||||
#endif
|
#endif
|
||||||
m_kart_highest_point = kart_max.getY();
|
m_kart_highest_point = kart_max.getY();
|
||||||
m_kart_lowest_point = kart_min.getY();
|
m_kart_lowest_point = kart_min.getY();
|
||||||
|
|
||||||
// Load the speed weighted object models. We need to do that now because it can affect the dimensions of the kart
|
// Load the speed weighted object models. We need to do that now because it can affect the dimensions of the kart
|
||||||
@ -490,7 +490,7 @@ bool KartModel::loadModels(const KartProperties &kart_properties)
|
|||||||
|
|
||||||
// Update min/max
|
// Update min/max
|
||||||
Vec3 obj_min, obj_max;
|
Vec3 obj_min, obj_max;
|
||||||
MeshTools::minMax3D(obj.m_model, &obj_min, &obj_max);
|
MeshTools::minMax3D(obj.m_model, &obj_min, &obj_max);
|
||||||
obj_min += obj.m_position;
|
obj_min += obj.m_position;
|
||||||
obj_max += obj.m_position;
|
obj_max += obj.m_position;
|
||||||
kart_min.min(obj_min);
|
kart_min.min(obj_min);
|
||||||
@ -870,37 +870,35 @@ void KartModel::update(float dt, float rotation_dt, float steer,
|
|||||||
} // update
|
} // update
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void KartModel::attachHat(){
|
void KartModel::attachHat(){
|
||||||
m_hat_node = NULL;
|
m_hat_node = NULL;
|
||||||
if(m_hat_name.size()>0)
|
if(m_hat_name.size()>0)
|
||||||
|
{
|
||||||
|
scene::IBoneSceneNode *bone = m_animated_node->getJointNode("Head");
|
||||||
|
if(!bone)
|
||||||
|
bone = m_animated_node->getJointNode("head");
|
||||||
|
if(bone)
|
||||||
{
|
{
|
||||||
scene::IBoneSceneNode *bone = m_animated_node->getJointNode("Head");
|
// Till we have all models fixed, accept Head and head as bone naartme
|
||||||
if(!bone)
|
scene::IMesh *hat_mesh =
|
||||||
bone = m_animated_node->getJointNode("head");
|
irr_driver->getAnimatedMesh(
|
||||||
if(bone)
|
file_manager->getModelFile(m_hat_name));
|
||||||
{
|
m_hat_node = irr_driver->addMesh(hat_mesh);
|
||||||
|
bone->addChild(m_hat_node);
|
||||||
// Till we have all models fixed, accept Head and head as bone naartme
|
m_animated_node->setCurrentFrame((float)m_animation_frame[AF_STRAIGHT]);
|
||||||
scene::IMesh *hat_mesh =
|
m_animated_node->OnAnimate(0);
|
||||||
irr_driver->getAnimatedMesh(
|
bone->updateAbsolutePosition();
|
||||||
file_manager->getModelFile(m_hat_name));
|
// With the hat node attached to the head bone, we have to
|
||||||
m_hat_node = irr_driver->addMesh(hat_mesh);
|
// reverse the transformation of the bone, so that the hat
|
||||||
bone->addChild(m_hat_node);
|
// is still properly placed. Esp. the hat offset needs
|
||||||
m_animated_node->setCurrentFrame((float)m_animation_frame[AF_STRAIGHT]);
|
// to be rotated.
|
||||||
m_animated_node->OnAnimate(0);
|
const core::matrix4 mat = bone->getAbsoluteTransformation();
|
||||||
bone->updateAbsolutePosition();
|
core::matrix4 inv;
|
||||||
|
mat.getInverse(inv);
|
||||||
// With the hat node attached to the head bone, we have to
|
core::vector3df rotated_offset;
|
||||||
// reverse the transformation of the bone, so that the hat
|
inv.rotateVect(rotated_offset, m_hat_offset);
|
||||||
// is still properly placed. Esp. the hat offset needs
|
m_hat_node->setPosition(rotated_offset);
|
||||||
// to be rotated.
|
m_hat_node->setScale(inv.getScale());
|
||||||
const core::matrix4 mat = bone->getAbsoluteTransformation();
|
m_hat_node->setRotation(inv.getRotationDegrees());
|
||||||
core::matrix4 inv;
|
} // if bone
|
||||||
mat.getInverse(inv);
|
} // if(m_hat_name)
|
||||||
core::vector3df rotated_offset;
|
|
||||||
inv.rotateVect(rotated_offset, m_hat_offset);
|
|
||||||
m_hat_node->setPosition(rotated_offset);
|
|
||||||
m_hat_node->setScale(inv.getScale());
|
|
||||||
m_hat_node->setRotation(inv.getRotationDegrees());
|
|
||||||
} // if bone
|
|
||||||
} // if(m_hat_name)
|
|
||||||
}
|
}
|
||||||
|
@ -200,7 +200,7 @@ private:
|
|||||||
float m_kart_height;
|
float m_kart_height;
|
||||||
|
|
||||||
/** Largest coordinate on up axis. */
|
/** Largest coordinate on up axis. */
|
||||||
float m_kart_highest_point;
|
float m_kart_highest_point;
|
||||||
|
|
||||||
/** Smallest coordinate on up axis. */
|
/** Smallest coordinate on up axis. */
|
||||||
float m_kart_lowest_point;
|
float m_kart_lowest_point;
|
||||||
@ -304,12 +304,12 @@ public:
|
|||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
/** Returns the height of the kart. */
|
/** Returns the height of the kart. */
|
||||||
float getHeight () const {return m_kart_height; }
|
float getHeight () const {return m_kart_height; }
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
/** Highest coordinate on up axis */
|
/** Highest coordinate on up axis */
|
||||||
float getHighestPoint () const { return m_kart_highest_point; }
|
float getHighestPoint () const { return m_kart_highest_point; }
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
/** Lowest coordinate on up axis */
|
/** Lowest coordinate on up axis */
|
||||||
float getLowestPoint () const { return m_kart_lowest_point; }
|
float getLowestPoint () const { return m_kart_lowest_point; }
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
/** Enables- or disables the end animation. */
|
/** Enables- or disables the end animation. */
|
||||||
void setAnimation(AnimationFrameType type);
|
void setAnimation(AnimationFrameType type);
|
||||||
@ -319,15 +319,15 @@ public:
|
|||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
/** Name of the hat mesh to use. */
|
/** Name of the hat mesh to use. */
|
||||||
void setHatMeshName(const std::string &name) {m_hat_name = name; }
|
void setHatMeshName(const std::string &name) {m_hat_name = name; }
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
void attachHat();
|
void attachHat();
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
/** Returns the array of wheel nodes. */
|
/** Returns the array of wheel nodes. */
|
||||||
scene::ISceneNode** getWheelNodes() { return m_wheel_node; }
|
scene::ISceneNode** getWheelNodes() { return m_wheel_node; }
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
scene::IAnimatedMeshSceneNode* getAnimatedNode(){ return m_animated_node; }
|
scene::IAnimatedMeshSceneNode* getAnimatedNode(){ return m_animated_node; }
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
core::vector3df getHatOffset() { return m_hat_offset; }
|
core::vector3df getHatOffset() { return m_hat_offset; }
|
||||||
|
|
||||||
}; // KartModel
|
}; // KartModel
|
||||||
#endif
|
#endif
|
||||||
|
@ -192,7 +192,7 @@ bool KartPropertiesManager::loadKart(const std::string &dir)
|
|||||||
{
|
{
|
||||||
std::string config_filename=dir+"/kart.xml";
|
std::string config_filename=dir+"/kart.xml";
|
||||||
if(!file_manager->fileExists(config_filename))
|
if(!file_manager->fileExists(config_filename))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
KartProperties* kart_properties;
|
KartProperties* kart_properties;
|
||||||
try
|
try
|
||||||
|
@ -1147,7 +1147,7 @@ void initUserConfig(char *argv[])
|
|||||||
translations = new Translations(); // needs file_manager
|
translations = new Translations(); // needs file_manager
|
||||||
stk_config = new STKConfig(); // in case of --stk-config
|
stk_config = new STKConfig(); // in case of --stk-config
|
||||||
// command line parameters
|
// command line parameters
|
||||||
user_config->postLoadInit();
|
user_config->postLoadInit();
|
||||||
if (!config_ok || UserConfigParams::m_all_players.size() == 0)
|
if (!config_ok || UserConfigParams::m_all_players.size() == 0)
|
||||||
{
|
{
|
||||||
user_config->addDefaultPlayer();
|
user_config->addDefaultPlayer();
|
||||||
|
@ -218,6 +218,6 @@ void EasterEggHunt::checkForWrongDirection(unsigned int i)
|
|||||||
|
|
||||||
void EasterEggHunt::terminateRace()
|
void EasterEggHunt::terminateRace()
|
||||||
{
|
{
|
||||||
m_karts[0]->getControls().reset();
|
m_karts[0]->getControls().reset();
|
||||||
WorldWithRank::terminateRace();
|
WorldWithRank::terminateRace();
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ public:
|
|||||||
virtual bool raceHasLaps(){ return false; }
|
virtual bool raceHasLaps(){ return false; }
|
||||||
|
|
||||||
virtual const std::string& getIdent() const;
|
virtual const std::string& getIdent() const;
|
||||||
virtual void terminateRace();
|
virtual void terminateRace();
|
||||||
virtual void update(float dt);
|
virtual void update(float dt);
|
||||||
virtual void getKartsDisplayInfo(
|
virtual void getKartsDisplayInfo(
|
||||||
std::vector<RaceGUIBase::KartIconDisplayInfo> *info);
|
std::vector<RaceGUIBase::KartIconDisplayInfo> *info);
|
||||||
|
@ -86,10 +86,10 @@ void OverWorld::enterOverWorld()
|
|||||||
network_manager->setupPlayerKartInfo();
|
network_manager->setupPlayerKartInfo();
|
||||||
race_manager->startNew(false);
|
race_manager->startNew(false);
|
||||||
if(race_manager->haveKartLastPositionOnOverworld()){
|
if(race_manager->haveKartLastPositionOnOverworld()){
|
||||||
OverWorld *ow = (OverWorld*)World::getWorld();
|
OverWorld *ow = (OverWorld*)World::getWorld();
|
||||||
ow->getKart(0)->setXYZ(race_manager->getKartLastPositionOnOverworld());
|
ow->getKart(0)->setXYZ(race_manager->getKartLastPositionOnOverworld());
|
||||||
ow->moveKartAfterRescue(ow->getKart(0));
|
ow->moveKartAfterRescue(ow->getKart(0));
|
||||||
}
|
}
|
||||||
irr_driver->showPointer(); // User should be able to click on the minimap
|
irr_driver->showPointer(); // User should be able to click on the minimap
|
||||||
|
|
||||||
} // enterOverWorld
|
} // enterOverWorld
|
||||||
@ -116,7 +116,7 @@ void OverWorld::update(float dt)
|
|||||||
m_karts[0]->startEngineSFX();
|
m_karts[0]->startEngineSFX();
|
||||||
}
|
}
|
||||||
WorldWithRank::update(dt);
|
WorldWithRank::update(dt);
|
||||||
WorldWithRank::updateTrack(dt);
|
WorldWithRank::updateTrack(dt);
|
||||||
const unsigned int kart_amount = m_karts.size();
|
const unsigned int kart_amount = m_karts.size();
|
||||||
|
|
||||||
// isn't it cool, on the overworld nitro is free!
|
// isn't it cool, on the overworld nitro is free!
|
||||||
|
@ -51,11 +51,11 @@ private:
|
|||||||
SFXBase *m_goal_sound;
|
SFXBase *m_goal_sound;
|
||||||
/** Timer for displaying goal text*/
|
/** Timer for displaying goal text*/
|
||||||
float m_goal_timer;
|
float m_goal_timer;
|
||||||
int m_lastKartToHitBall;
|
int m_lastKartToHitBall;
|
||||||
std::vector<int> m_redScorers;
|
std::vector<int> m_redScorers;
|
||||||
std::vector<float> m_redScoreTimes;
|
std::vector<float> m_redScoreTimes;
|
||||||
std::vector<int> m_blueScorers;
|
std::vector<int> m_blueScorers;
|
||||||
std::vector<float> m_blueScoreTimes;
|
std::vector<float> m_blueScoreTimes;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
SoccerWorld();
|
SoccerWorld();
|
||||||
@ -83,21 +83,21 @@ public:
|
|||||||
|
|
||||||
void onCheckGoalTriggered(bool first_goal);
|
void onCheckGoalTriggered(bool first_goal);
|
||||||
int getTeamLeader(unsigned int i);
|
int getTeamLeader(unsigned int i);
|
||||||
void setLastKartTohitBall(unsigned int kartId);
|
void setLastKartTohitBall(unsigned int kartId);
|
||||||
std::vector<int> getScorers(unsigned int team)
|
std::vector<int> getScorers(unsigned int team)
|
||||||
{
|
{
|
||||||
if(team == 0)
|
if(team == 0)
|
||||||
return m_redScorers;
|
return m_redScorers;
|
||||||
else
|
else
|
||||||
return m_blueScorers;
|
return m_blueScorers;
|
||||||
}
|
}
|
||||||
std::vector<float> getScoreTimes(unsigned int team)
|
std::vector<float> getScoreTimes(unsigned int team)
|
||||||
{
|
{
|
||||||
if(team == 0)
|
if(team == 0)
|
||||||
return m_redScoreTimes;
|
return m_redScoreTimes;
|
||||||
else
|
else
|
||||||
return m_blueScoreTimes;
|
return m_blueScoreTimes;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initKartList();
|
void initKartList();
|
||||||
|
@ -265,11 +265,7 @@ void World::reset()
|
|||||||
|
|
||||||
void World::createRaceGUI()
|
void World::createRaceGUI()
|
||||||
{
|
{
|
||||||
//if(UserConfigParams::m_minimal_race_gui &&
|
m_race_gui = new RaceGUI();
|
||||||
// race_manager->getTrackName() != "tutorial")
|
|
||||||
// m_race_gui = new MinimalRaceGUI();
|
|
||||||
//else
|
|
||||||
m_race_gui = new RaceGUI();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -300,7 +296,7 @@ AbstractKart *World::createKart(const std::string &kart_ident, int index,
|
|||||||
m_num_players ++;
|
m_num_players ++;
|
||||||
break;
|
break;
|
||||||
case RaceManager::KT_NETWORK_PLAYER:
|
case RaceManager::KT_NETWORK_PLAYER:
|
||||||
break; // Avoid compiler warning about enum not handled.
|
break; // Avoid compiler warning about enum not handled.
|
||||||
//controller = new NetworkController(kart_ident, position, init_pos,
|
//controller = new NetworkController(kart_ident, position, init_pos,
|
||||||
// global_player_id);
|
// global_player_id);
|
||||||
//m_num_players++;
|
//m_num_players++;
|
||||||
|
@ -146,7 +146,7 @@ void WorldStatus::update(const float dt)
|
|||||||
// long, we use the aux timer to force the next phase
|
// long, we use the aux timer to force the next phase
|
||||||
// after 3.5 seconds.
|
// after 3.5 seconds.
|
||||||
if(m_track_intro_sound->getStatus()==SFXManager::SFX_PLAYING
|
if(m_track_intro_sound->getStatus()==SFXManager::SFX_PLAYING
|
||||||
&& m_auxiliary_timer<3.5f)
|
&& m_auxiliary_timer<3.5f)
|
||||||
return;
|
return;
|
||||||
// Wait before ready phase if sounds are disabled
|
// Wait before ready phase if sounds are disabled
|
||||||
if(!UserConfigParams::m_sfx && m_auxiliary_timer<3.0f)
|
if(!UserConfigParams::m_sfx && m_auxiliary_timer<3.0f)
|
||||||
@ -239,8 +239,8 @@ void WorldStatus::update(const float dt)
|
|||||||
case FINISH_PHASE:
|
case FINISH_PHASE:
|
||||||
// Nothing to do here.
|
// Nothing to do here.
|
||||||
break;
|
break;
|
||||||
case GOAL_PHASE:
|
case GOAL_PHASE:
|
||||||
// Nothing to do here as well.
|
// Nothing to do here as well.
|
||||||
|
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
@ -79,8 +79,8 @@ public:
|
|||||||
// Undefined, used in asserts to catch incorrect states.
|
// Undefined, used in asserts to catch incorrect states.
|
||||||
UNDEFINED_PHASE,
|
UNDEFINED_PHASE,
|
||||||
|
|
||||||
//Goal scored phase
|
//Goal scored phase
|
||||||
GOAL_PHASE
|
GOAL_PHASE
|
||||||
};
|
};
|
||||||
protected:
|
protected:
|
||||||
/** Sound to play at the beginning of a race, during which a
|
/** Sound to play at the beginning of a race, during which a
|
||||||
|
@ -653,7 +653,7 @@ void NetworkManager::receiveUpdates()
|
|||||||
{
|
{
|
||||||
RaceResultMessage m(event.packet);
|
RaceResultMessage m(event.packet);
|
||||||
m_state = NS_WAIT_FOR_RACE_RESULT;
|
m_state = NS_WAIT_FOR_RACE_RESULT;
|
||||||
World::getWorld()->enterRaceOverState();
|
World::getWorld()->enterRaceOverState();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
race_state->receive(event.packet);
|
race_state->receive(event.packet);
|
||||||
|
@ -37,9 +37,9 @@ void* btKartRaycaster::castRay(const btVector3& from, const btVector3& to,
|
|||||||
} // CloestWithNormal
|
} // CloestWithNormal
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
/** Stores the index of the triangle hit. */
|
/** Stores the index of the triangle hit. */
|
||||||
virtual btScalar addSingleResult(btCollisionWorld::LocalRayResult& rayResult,
|
virtual btScalar addSingleResult(btCollisionWorld::LocalRayResult& rayResult,
|
||||||
bool normalInWorldSpace)
|
bool normalInWorldSpace)
|
||||||
{
|
{
|
||||||
// We don't always get a triangle index, sometimes (e.g. ray hits
|
// We don't always get a triangle index, sometimes (e.g. ray hits
|
||||||
// other kart) we get shapePart=-1, or no localShapeInfo at all
|
// other kart) we get shapePart=-1, or no localShapeInfo at all
|
||||||
if(rayResult.m_localShapeInfo &&
|
if(rayResult.m_localShapeInfo &&
|
||||||
@ -48,7 +48,7 @@ void* btKartRaycaster::castRay(const btVector3& from, const btVector3& to,
|
|||||||
return
|
return
|
||||||
btCollisionWorld::ClosestRayResultCallback::addSingleResult(rayResult,
|
btCollisionWorld::ClosestRayResultCallback::addSingleResult(rayResult,
|
||||||
normalInWorldSpace);
|
normalInWorldSpace);
|
||||||
}
|
}
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
/** Returns the index of the triangle which was hit, or -1 if
|
/** Returns the index of the triangle which was hit, or -1 if
|
||||||
* no triangle was hit. */
|
* no triangle was hit. */
|
||||||
@ -57,19 +57,19 @@ void* btKartRaycaster::castRay(const btVector3& from, const btVector3& to,
|
|||||||
}; // CloestWithNormal
|
}; // CloestWithNormal
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
|
|
||||||
ClosestWithNormal rayCallback(from,to);
|
ClosestWithNormal rayCallback(from,to);
|
||||||
|
|
||||||
m_dynamicsWorld->rayTest(from, to, rayCallback);
|
m_dynamicsWorld->rayTest(from, to, rayCallback);
|
||||||
|
|
||||||
if (rayCallback.hasHit())
|
if (rayCallback.hasHit())
|
||||||
{
|
{
|
||||||
btRigidBody* body = btRigidBody::upcast(rayCallback.m_collisionObject);
|
btRigidBody* body = btRigidBody::upcast(rayCallback.m_collisionObject);
|
||||||
if (body && body->hasContactResponse())
|
if (body && body->hasContactResponse())
|
||||||
{
|
{
|
||||||
result.m_hitPointInWorld = rayCallback.m_hitPointWorld;
|
result.m_hitPointInWorld = rayCallback.m_hitPointWorld;
|
||||||
result.m_hitNormalInWorld = rayCallback.m_hitNormalWorld;
|
result.m_hitNormalInWorld = rayCallback.m_hitNormalWorld;
|
||||||
result.m_hitNormalInWorld.normalize();
|
result.m_hitNormalInWorld.normalize();
|
||||||
result.m_distFraction = rayCallback.m_closestHitFraction;
|
result.m_distFraction = rayCallback.m_closestHitFraction;
|
||||||
const TriangleMesh &tm =
|
const TriangleMesh &tm =
|
||||||
World::getWorld()->getTrack()->getTriangleMesh();
|
World::getWorld()->getTrack()->getTriangleMesh();
|
||||||
if(m_smooth_normals &&
|
if(m_smooth_normals &&
|
||||||
@ -89,8 +89,8 @@ void* btKartRaycaster::castRay(const btVector3& from, const btVector3& to,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return body;
|
return body;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,17 +23,17 @@ class btDynamicsWorld;
|
|||||||
class btKartRaycaster : public btVehicleRaycaster
|
class btKartRaycaster : public btVehicleRaycaster
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
btDynamicsWorld* m_dynamicsWorld;
|
btDynamicsWorld* m_dynamicsWorld;
|
||||||
/** True if the normals should be smoothed. Not all tracks support this,
|
/** True if the normals should be smoothed. Not all tracks support this,
|
||||||
* so this flag is set depending on track when constructing this object. */
|
* so this flag is set depending on track when constructing this object. */
|
||||||
bool m_smooth_normals;
|
bool m_smooth_normals;
|
||||||
public:
|
public:
|
||||||
btKartRaycaster(btDynamicsWorld* world, bool smooth_normals=false)
|
btKartRaycaster(btDynamicsWorld* world, bool smooth_normals=false)
|
||||||
:m_dynamicsWorld(world), m_smooth_normals(smooth_normals)
|
:m_dynamicsWorld(world), m_smooth_normals(smooth_normals)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void* castRay(const btVector3& from,const btVector3& to,
|
virtual void* castRay(const btVector3& from,const btVector3& to,
|
||||||
btVehicleRaycasterResult& result);
|
btVehicleRaycasterResult& result);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -111,7 +111,7 @@ public:
|
|||||||
timeStep);
|
timeStep);
|
||||||
virtual void getInfo1 (btConstraintInfo1* info);
|
virtual void getInfo1 (btConstraintInfo1* info);
|
||||||
virtual void getInfo2 (btConstraintInfo2* info);
|
virtual void getInfo2 (btConstraintInfo2* info);
|
||||||
virtual void setParam(int num, btScalar value, int axis = -1);
|
virtual void setParam(int num, btScalar value, int axis = -1);
|
||||||
virtual btScalar getParam(int num, int axis) const;
|
virtual btScalar getParam(int num, int axis) const;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -533,7 +533,7 @@ void PhysicalObject::handleExplosion(const Vec3& pos, bool direct_hit)
|
|||||||
*/
|
*/
|
||||||
bool PhysicalObject::isSoccerBall() const
|
bool PhysicalObject::isSoccerBall() const
|
||||||
{
|
{
|
||||||
return m_object->isSoccerBall();
|
return m_object->isSoccerBall();
|
||||||
} // is SoccerBall
|
} // is SoccerBall
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@ -85,13 +85,13 @@ Physics::~Physics()
|
|||||||
*/
|
*/
|
||||||
void Physics::addKart(const AbstractKart *kart)
|
void Physics::addKart(const AbstractKart *kart)
|
||||||
{
|
{
|
||||||
const btCollisionObjectArray &all_objs =
|
const btCollisionObjectArray &all_objs =
|
||||||
m_dynamics_world->getCollisionObjectArray();
|
m_dynamics_world->getCollisionObjectArray();
|
||||||
for(unsigned int i=0; i<(unsigned int)all_objs.size(); i++)
|
for(unsigned int i=0; i<(unsigned int)all_objs.size(); i++)
|
||||||
{
|
{
|
||||||
if(btRigidBody::upcast(all_objs[i])== kart->getBody())
|
if(btRigidBody::upcast(all_objs[i])== kart->getBody())
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_dynamics_world->addRigidBody(kart->getBody());
|
m_dynamics_world->addRigidBody(kart->getBody());
|
||||||
m_dynamics_world->addVehicle(kart->getVehicle());
|
m_dynamics_world->addVehicle(kart->getVehicle());
|
||||||
m_dynamics_world->addConstraint(kart->getUprightConstraint());
|
m_dynamics_world->addConstraint(kart->getUprightConstraint());
|
||||||
@ -189,12 +189,12 @@ void Physics::update(float dt)
|
|||||||
const KartProperties* kp = kart->getKartProperties();
|
const KartProperties* kp = kart->getKartProperties();
|
||||||
kart->setSquash(kp->getSquashDuration(), kp->getSquashSlowdown());
|
kart->setSquash(kp->getSquashDuration(), kp->getSquashSlowdown());
|
||||||
}
|
}
|
||||||
else if(obj->isSoccerBall())
|
else if(obj->isSoccerBall())
|
||||||
{
|
{
|
||||||
int kartId = p->getUserPointer(1)->getPointerKart()->getWorldKartId();
|
int kartId = p->getUserPointer(1)->getPointerKart()->getWorldKartId();
|
||||||
SoccerWorld* soccerWorld = (SoccerWorld*)World::getWorld();
|
SoccerWorld* soccerWorld = (SoccerWorld*)World::getWorld();
|
||||||
soccerWorld->setLastKartTohitBall(kartId);
|
soccerWorld->setLastKartTohitBall(kartId);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
class STKDynamicsWorld : public btDiscreteDynamicsWorld
|
class STKDynamicsWorld : public btDiscreteDynamicsWorld
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** The standard constructor which just created a btDiscreteDynamicsWorld. */
|
/** The standard constructor which just created a btDiscreteDynamicsWorld. */
|
||||||
STKDynamicsWorld(btDispatcher* dispatcher,
|
STKDynamicsWorld(btDispatcher* dispatcher,
|
||||||
btBroadphaseInterface* pairCache,
|
btBroadphaseInterface* pairCache,
|
||||||
btConstraintSolver* constraintSolver,
|
btConstraintSolver* constraintSolver,
|
||||||
|
@ -331,7 +331,7 @@ private:
|
|||||||
int m_coin_target;
|
int m_coin_target;
|
||||||
bool m_has_time_target;
|
bool m_has_time_target;
|
||||||
float m_time_target;
|
float m_time_target;
|
||||||
int m_goal_target;
|
int m_goal_target;
|
||||||
|
|
||||||
void startNextRace(); // start a next race
|
void startNextRace(); // start a next race
|
||||||
|
|
||||||
@ -394,9 +394,9 @@ public:
|
|||||||
|
|
||||||
bool hasTimeTarget() const { return m_has_time_target; }
|
bool hasTimeTarget() const { return m_has_time_target; }
|
||||||
|
|
||||||
void setMaxGoal(int maxGoal){ m_goal_target = maxGoal; }
|
void setMaxGoal(int maxGoal){ m_goal_target = maxGoal; }
|
||||||
|
|
||||||
int getMaxGoal(){ return m_goal_target; }
|
int getMaxGoal(){ return m_goal_target; }
|
||||||
|
|
||||||
/** Sort karts and update the m_gp_rank KartStatus member, in preparation
|
/** Sort karts and update the m_gp_rank KartStatus member, in preparation
|
||||||
* for future calls to RaceManager::getKartGPRank or
|
* for future calls to RaceManager::getKartGPRank or
|
||||||
|
@ -140,7 +140,7 @@ void AddonsScreen::init()
|
|||||||
m_sort_default = true;
|
m_sort_default = true;
|
||||||
m_sort_col = 0;
|
m_sort_col = 0;
|
||||||
|
|
||||||
getWidget<GUIEngine::RibbonWidget>("category")->setDeactivated();
|
getWidget<GUIEngine::RibbonWidget>("category")->setDeactivated();
|
||||||
|
|
||||||
GUIEngine::getFont()->setTabStop(0.66f);
|
GUIEngine::getFont()->setTabStop(0.66f);
|
||||||
|
|
||||||
@ -273,8 +273,8 @@ void AddonsScreen::loadList()
|
|||||||
if(addon->isInstalled())
|
if(addon->isInstalled())
|
||||||
icon = addon->needsUpdate() ? m_icon_needs_update
|
icon = addon->needsUpdate() ? m_icon_needs_update
|
||||||
: m_icon_installed;
|
: m_icon_installed;
|
||||||
else
|
else
|
||||||
icon = m_icon_not_installed;
|
icon = m_icon_not_installed;
|
||||||
|
|
||||||
core::stringw s;
|
core::stringw s;
|
||||||
if (addon->getDesigner().size()==0)
|
if (addon->getDesigner().size()==0)
|
||||||
@ -367,15 +367,15 @@ void AddonsScreen::loadList()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getWidget<GUIEngine::RibbonWidget>("category")->setActivated();
|
getWidget<GUIEngine::RibbonWidget>("category")->setActivated();
|
||||||
if(m_type == "kart")
|
if(m_type == "kart")
|
||||||
getWidget<GUIEngine::RibbonWidget>("category")->select("tab_kart",
|
getWidget<GUIEngine::RibbonWidget>("category")->select("tab_kart",
|
||||||
PLAYER_ID_GAME_MASTER);
|
PLAYER_ID_GAME_MASTER);
|
||||||
else if(m_type == "track")
|
else if(m_type == "track")
|
||||||
getWidget<GUIEngine::RibbonWidget>("category")->select("tab_track",
|
getWidget<GUIEngine::RibbonWidget>("category")->select("tab_track",
|
||||||
PLAYER_ID_GAME_MASTER);
|
PLAYER_ID_GAME_MASTER);
|
||||||
else
|
else
|
||||||
getWidget<GUIEngine::RibbonWidget>("category")->select("tab_update",
|
getWidget<GUIEngine::RibbonWidget>("category")->select("tab_update",
|
||||||
PLAYER_ID_GAME_MASTER);
|
PLAYER_ID_GAME_MASTER);
|
||||||
} // loadList
|
} // loadList
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ GUIEngine::EventPropagation AddDeviceDialog::processEvent
|
|||||||
{
|
{
|
||||||
// Remove the previous modal dialog to avoid a warning
|
// Remove the previous modal dialog to avoid a warning
|
||||||
GUIEngine::ModalDialog::dismiss();
|
GUIEngine::ModalDialog::dismiss();
|
||||||
if(wiimote_manager->askUserToConnectWiimotes() > 0)
|
if(wiimote_manager->askUserToConnectWiimotes() > 0)
|
||||||
((OptionsScreenInput*)GUIEngine::getCurrentScreen())->rebuildDeviceList();
|
((OptionsScreenInput*)GUIEngine::getCurrentScreen())->rebuildDeviceList();
|
||||||
|
|
||||||
return GUIEngine::EVENT_BLOCK;
|
return GUIEngine::EVENT_BLOCK;
|
||||||
|
@ -122,7 +122,7 @@ TrackInfoDialog::TrackInfoDialog(const std::string& ribbonItem, const std::strin
|
|||||||
|
|
||||||
// Reverse track
|
// Reverse track
|
||||||
const bool reverse_available = track->reverseAvailable() &&
|
const bool reverse_available = track->reverseAvailable() &&
|
||||||
race_manager->getMinorMode() != RaceManager::MINOR_MODE_EASTER_EGG;
|
race_manager->getMinorMode() != RaceManager::MINOR_MODE_EASTER_EGG;
|
||||||
if (reverse_available)
|
if (reverse_available)
|
||||||
{
|
{
|
||||||
m_checkbox = getWidget<CheckBoxWidget>("reverse");
|
m_checkbox = getWidget<CheckBoxWidget>("reverse");
|
||||||
|
@ -108,16 +108,16 @@ void HelpScreen1::init()
|
|||||||
{
|
{
|
||||||
Screen::init();
|
Screen::init();
|
||||||
RibbonWidget* w = this->getWidget<RibbonWidget>("category");
|
RibbonWidget* w = this->getWidget<RibbonWidget>("category");
|
||||||
ButtonWidget* tutorial = getWidget<ButtonWidget>("startTutorial");
|
ButtonWidget* tutorial = getWidget<ButtonWidget>("startTutorial");
|
||||||
|
|
||||||
if (StateManager::get()->getGameState() == GUIEngine::INGAME_MENU)
|
if (StateManager::get()->getGameState() == GUIEngine::INGAME_MENU)
|
||||||
{
|
{
|
||||||
tutorial->setDeactivated();
|
tutorial->setDeactivated();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tutorial->setActivated();
|
tutorial->setActivated();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (w != NULL) w->select( "page1", PLAYER_ID_GAME_MASTER );
|
if (w != NULL) w->select( "page1", PLAYER_ID_GAME_MASTER );
|
||||||
} //init
|
} //init
|
||||||
|
@ -105,7 +105,7 @@ private:
|
|||||||
/** Display items that are shown once only (for all karts). */
|
/** Display items that are shown once only (for all karts). */
|
||||||
void drawGlobalMiniMap ();
|
void drawGlobalMiniMap ();
|
||||||
void drawGlobalTimer ();
|
void drawGlobalTimer ();
|
||||||
void drawScores();
|
void drawScores();
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -70,7 +70,7 @@ RaceGUIBase::RaceGUIBase()
|
|||||||
//I18N: as in "ready, set, go", shown at the beginning of the race
|
//I18N: as in "ready, set, go", shown at the beginning of the race
|
||||||
m_string_go = _("Go!");
|
m_string_go = _("Go!");
|
||||||
//I18N: Shown when a goal is scored
|
//I18N: Shown when a goal is scored
|
||||||
m_string_goal = _("GOAL!");
|
m_string_goal = _("GOAL!");
|
||||||
// Make the two materials permanent (in case that they are not listed
|
// Make the two materials permanent (in case that they are not listed
|
||||||
// in the textures/materials.xml file).
|
// in the textures/materials.xml file).
|
||||||
m_music_icon = material_manager->getMaterial("notes.png",
|
m_music_icon = material_manager->getMaterial("notes.png",
|
||||||
@ -678,14 +678,15 @@ void RaceGUIBase::drawGlobalMusicDescription()
|
|||||||
} // drawGlobalMusicDescription
|
} // drawGlobalMusicDescription
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void RaceGUIBase::drawGlobalGoal(){
|
void RaceGUIBase::drawGlobalGoal()
|
||||||
static video::SColor color = video::SColor(255, 255, 255, 255);
|
{
|
||||||
core::rect<s32> pos(UserConfigParams::m_width>>1,
|
static video::SColor color = video::SColor(255, 255, 255, 255);
|
||||||
UserConfigParams::m_height>>1,
|
core::rect<s32> pos(UserConfigParams::m_width>>1,
|
||||||
UserConfigParams::m_width>>1,
|
UserConfigParams::m_height>>1,
|
||||||
UserConfigParams::m_height>>1);
|
UserConfigParams::m_width>>1,
|
||||||
gui::IGUIFont* font = GUIEngine::getTitleFont();
|
UserConfigParams::m_height>>1);
|
||||||
font->draw(m_string_goal.c_str(), pos, color, true, true);
|
gui::IGUIFont* font = GUIEngine::getTitleFont();
|
||||||
|
font->draw(m_string_goal.c_str(), pos, color, true, true);
|
||||||
}
|
}
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
/** Draws the ready-set-go message on the screen.
|
/** Draws the ready-set-go message on the screen.
|
||||||
|
@ -198,8 +198,8 @@ protected:
|
|||||||
const core::recti &viewport,
|
const core::recti &viewport,
|
||||||
const core::vector2df &scaling);
|
const core::vector2df &scaling);
|
||||||
void drawGlobalMusicDescription();
|
void drawGlobalMusicDescription();
|
||||||
void drawGlobalReadySetGo ();
|
void drawGlobalReadySetGo();
|
||||||
void drawGlobalGoal ();
|
void drawGlobalGoal();
|
||||||
void drawPlungerInFace(const Camera *camera, float dt);
|
void drawPlungerInFace(const Camera *camera, float dt);
|
||||||
/** Instructs the base gui to ignore unimportant messages (like
|
/** Instructs the base gui to ignore unimportant messages (like
|
||||||
* item messages).
|
* item messages).
|
||||||
|
@ -102,9 +102,9 @@ public:
|
|||||||
PlayerProfile* getProfile()
|
PlayerProfile* getProfile()
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
assert(m_magic_number == 0xAC1EF1AE);
|
assert(m_magic_number == 0xAC1EF1AE);
|
||||||
#endif
|
#endif
|
||||||
return m_player;
|
return m_player;
|
||||||
} // getProfile
|
} // getProfile
|
||||||
|
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
@ -112,9 +112,9 @@ public:
|
|||||||
const PlayerProfile* getConstProfile() const
|
const PlayerProfile* getConstProfile() const
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
assert(m_magic_number == 0xAC1EF1AE);
|
assert(m_magic_number == 0xAC1EF1AE);
|
||||||
#endif
|
#endif
|
||||||
return m_player;
|
return m_player;
|
||||||
} // getConstProfile
|
} // getConstProfile
|
||||||
|
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
@ -127,9 +127,9 @@ public:
|
|||||||
int getID() const
|
int getID() const
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
assert(m_magic_number == 0xAC1EF1AE);
|
assert(m_magic_number == 0xAC1EF1AE);
|
||||||
#endif
|
#endif
|
||||||
return m_id;
|
return m_id;
|
||||||
} // getID
|
} // getID
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
|
|
||||||
@ -138,9 +138,9 @@ public:
|
|||||||
InputDevice* getDevice() const
|
InputDevice* getDevice() const
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
assert(m_magic_number == 0xAC1EF1AE);
|
assert(m_magic_number == 0xAC1EF1AE);
|
||||||
#endif
|
#endif
|
||||||
return m_device;
|
return m_device;
|
||||||
} // getDevice
|
} // getDevice
|
||||||
|
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
@ -151,9 +151,9 @@ public:
|
|||||||
void setKart(AbstractKart *kart)
|
void setKart(AbstractKart *kart)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
assert(m_magic_number == 0xAC1EF1AE);
|
assert(m_magic_number == 0xAC1EF1AE);
|
||||||
#endif
|
#endif
|
||||||
m_kart = kart;
|
m_kart = kart;
|
||||||
} // setKart
|
} // setKart
|
||||||
|
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
@ -161,7 +161,7 @@ public:
|
|||||||
AbstractKart* getKart()
|
AbstractKart* getKart()
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
assert(m_magic_number == 0xAC1EF1AE);
|
assert(m_magic_number == 0xAC1EF1AE);
|
||||||
#endif
|
#endif
|
||||||
return m_kart;
|
return m_kart;
|
||||||
} // getKart
|
} // getKart
|
||||||
|
@ -382,7 +382,7 @@ POParser::parse()
|
|||||||
{
|
{
|
||||||
std::string msgid_plural = get_string(12);
|
std::string msgid_plural = get_string(12);
|
||||||
std::vector<std::string> msgstr_num;
|
std::vector<std::string> msgstr_num;
|
||||||
bool saw_nonempty_msgstr = false;
|
bool saw_nonempty_msgstr = false;
|
||||||
|
|
||||||
next:
|
next:
|
||||||
if (is_empty_line())
|
if (is_empty_line())
|
||||||
@ -395,10 +395,10 @@ POParser::parse()
|
|||||||
isdigit(current_line[7]) && current_line[8] == ']')
|
isdigit(current_line[7]) && current_line[8] == ']')
|
||||||
{
|
{
|
||||||
unsigned int number = static_cast<unsigned int>(current_line[7] - '0');
|
unsigned int number = static_cast<unsigned int>(current_line[7] - '0');
|
||||||
std::string msgstr = get_string(9);
|
std::string msgstr = get_string(9);
|
||||||
|
|
||||||
if(!msgstr.empty())
|
if(!msgstr.empty())
|
||||||
saw_nonempty_msgstr = true;
|
saw_nonempty_msgstr = true;
|
||||||
|
|
||||||
if (number >= msgstr_num.size())
|
if (number >= msgstr_num.size())
|
||||||
msgstr_num.resize(number+1);
|
msgstr_num.resize(number+1);
|
||||||
@ -414,38 +414,38 @@ POParser::parse()
|
|||||||
if (!is_empty_line())
|
if (!is_empty_line())
|
||||||
error("expected 'msgstr[N]' or empty line");
|
error("expected 'msgstr[N]' or empty line");
|
||||||
|
|
||||||
if (saw_nonempty_msgstr)
|
if (saw_nonempty_msgstr)
|
||||||
{
|
{
|
||||||
if (use_fuzzy || !fuzzy)
|
if (use_fuzzy || !fuzzy)
|
||||||
{
|
{
|
||||||
if (!dict.get_plural_forms())
|
if (!dict.get_plural_forms())
|
||||||
{
|
{
|
||||||
warning("msgstr[N] seen, but no Plural-Forms given");
|
warning("msgstr[N] seen, but no Plural-Forms given");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (msgstr_num.size() != dict.get_plural_forms().get_nplural())
|
if (msgstr_num.size() != dict.get_plural_forms().get_nplural())
|
||||||
{
|
{
|
||||||
warning("msgstr[N] count doesn't match Plural-Forms.nplural");
|
warning("msgstr[N] count doesn't match Plural-Forms.nplural");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (has_msgctxt)
|
if (has_msgctxt)
|
||||||
dict.add_translation(msgctxt, msgid, msgid_plural, msgstr_num);
|
dict.add_translation(msgctxt, msgid, msgid_plural, msgstr_num);
|
||||||
else
|
else
|
||||||
dict.add_translation(msgid, msgid_plural, msgstr_num);
|
dict.add_translation(msgid, msgid_plural, msgstr_num);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0)
|
if (0)
|
||||||
{
|
{
|
||||||
std::cout << (fuzzy?"fuzzy":"not-fuzzy") << std::endl;
|
std::cout << (fuzzy?"fuzzy":"not-fuzzy") << std::endl;
|
||||||
std::cout << "msgid \"" << msgid << "\"" << std::endl;
|
std::cout << "msgid \"" << msgid << "\"" << std::endl;
|
||||||
std::cout << "msgid_plural \"" << msgid_plural << "\"" << std::endl;
|
std::cout << "msgid_plural \"" << msgid_plural << "\"" << std::endl;
|
||||||
for(std::vector<std::string>::size_type i = 0; i < msgstr_num.size(); ++i)
|
for(std::vector<std::string>::size_type i = 0; i < msgstr_num.size(); ++i)
|
||||||
std::cout << "msgstr[" << i << "] \"" << msgstr_num[i] /*conv.convert(msgstr_num[i])*/ << "\"" << std::endl;
|
std::cout << "msgstr[" << i << "] \"" << msgstr_num[i] /*conv.convert(msgstr_num[i])*/ << "\"" << std::endl;
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (prefix("msgstr"))
|
else if (prefix("msgstr"))
|
||||||
{
|
{
|
||||||
|
@ -36,7 +36,7 @@ class XMLNode;
|
|||||||
class CheckCannon : public CheckLine
|
class CheckCannon : public CheckLine
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
/** The target point the kart will fly to. */
|
/** The target point the kart will fly to. */
|
||||||
core::line3df m_target;
|
core::line3df m_target;
|
||||||
|
|
||||||
/** Stores the cannon curve data. */
|
/** Stores the cannon curve data. */
|
||||||
|
@ -49,8 +49,8 @@ CheckStructure::CheckStructure(const XMLNode &node, unsigned int index)
|
|||||||
else if(kind=="ambient-light")
|
else if(kind=="ambient-light")
|
||||||
m_check_type = CT_AMBIENT_SPHERE;
|
m_check_type = CT_AMBIENT_SPHERE;
|
||||||
// Cannons don't have a kind specified, so test for the name in this case
|
// Cannons don't have a kind specified, so test for the name in this case
|
||||||
else if(node.getName()=="cannon")
|
else if(node.getName()=="cannon")
|
||||||
m_check_type = CT_CANNON;
|
m_check_type = CT_CANNON;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("Unknown check structure '%s' - ignored.\n", kind.c_str());
|
printf("Unknown check structure '%s' - ignored.\n", kind.c_str());
|
||||||
|
@ -64,7 +64,7 @@ public:
|
|||||||
* enabling you to count the lap again.
|
* enabling you to count the lap again.
|
||||||
*/
|
*/
|
||||||
enum CheckType {CT_NEW_LAP, CT_ACTIVATE, CT_TOGGLE, CT_CANNON,
|
enum CheckType {CT_NEW_LAP, CT_ACTIVATE, CT_TOGGLE, CT_CANNON,
|
||||||
CT_GOAL, CT_AMBIENT_SPHERE};
|
CT_GOAL, CT_AMBIENT_SPHERE};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** Stores the previous position of all karts. This is needed to detect
|
/** Stores the previous position of all karts. This is needed to detect
|
||||||
|
@ -67,9 +67,9 @@ void Log::setTerminalColor(LogLevel level)
|
|||||||
#else
|
#else
|
||||||
enum TermAttr
|
enum TermAttr
|
||||||
{
|
{
|
||||||
TERM_RESET = 0, // "normal" mode
|
TERM_RESET = 0, // "normal" mode
|
||||||
TERM_BRIGHT = 1,// more luminosity for the foreground
|
TERM_BRIGHT = 1,// more luminosity for the foreground
|
||||||
TERM_DIM = 2, // less luminosity for the foreground
|
TERM_DIM = 2, // less luminosity for the foreground
|
||||||
};
|
};
|
||||||
|
|
||||||
enum TermColor
|
enum TermColor
|
||||||
|
@ -64,7 +64,7 @@ Profiler profiler;
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
Profiler::Profiler()
|
Profiler::Profiler()
|
||||||
{
|
{
|
||||||
m_thread_infos.resize(1); // TODO: monothread now, should support multithreading
|
m_thread_infos.resize(1); // TODO: monothread now, should support multithreading
|
||||||
m_write_id = 0;
|
m_write_id = 0;
|
||||||
m_time_last_sync = _getTimeMilliseconds();
|
m_time_last_sync = _getTimeMilliseconds();
|
||||||
m_time_between_sync = 0.0;
|
m_time_between_sync = 0.0;
|
||||||
@ -101,7 +101,7 @@ void Profiler::popCpuMarker()
|
|||||||
if(m_freeze_state == FROZEN || m_freeze_state == WAITING_FOR_UNFREEZE)
|
if(m_freeze_state == FROZEN || m_freeze_state == WAITING_FOR_UNFREEZE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ThreadInfo& ti = getThreadInfo();
|
ThreadInfo& ti = getThreadInfo();
|
||||||
assert(ti.markers_stack[m_write_id].size() > 0);
|
assert(ti.markers_stack[m_write_id].size() > 0);
|
||||||
|
|
||||||
MarkerStack& markers_stack = ti.markers_stack[m_write_id];
|
MarkerStack& markers_stack = ti.markers_stack[m_write_id];
|
||||||
@ -195,7 +195,7 @@ void Profiler::draw()
|
|||||||
int read_id = !m_write_id;
|
int read_id = !m_write_id;
|
||||||
|
|
||||||
// Compute some values for drawing (unit: pixels, but we keep floats for reducing errors accumulation)
|
// Compute some values for drawing (unit: pixels, but we keep floats for reducing errors accumulation)
|
||||||
core::dimension2d<u32> screen_size = driver->getScreenSize();
|
core::dimension2d<u32> screen_size = driver->getScreenSize();
|
||||||
const double profiler_width = (1.0 - 2.0*MARGIN_X) * screen_size.Width;
|
const double profiler_width = (1.0 - 2.0*MARGIN_X) * screen_size.Width;
|
||||||
const double x_offset = MARGIN_X*screen_size.Width;
|
const double x_offset = MARGIN_X*screen_size.Width;
|
||||||
const double y_offset = (MARGIN_Y + LINE_HEIGHT)*screen_size.Height;
|
const double y_offset = (MARGIN_Y + LINE_HEIGHT)*screen_size.Height;
|
||||||
@ -220,12 +220,12 @@ void Profiler::draw()
|
|||||||
MarkerList::const_iterator it_end = markers.end();
|
MarkerList::const_iterator it_end = markers.end();
|
||||||
for(MarkerList::const_iterator it = markers.begin() ; it != it_end ; it++)
|
for(MarkerList::const_iterator it = markers.begin() ; it != it_end ; it++)
|
||||||
{
|
{
|
||||||
const Marker& m = *it;
|
const Marker& m = *it;
|
||||||
assert(m.end >= 0.0);
|
assert(m.end >= 0.0);
|
||||||
core::rect<s32> pos((s32)( x_offset + factor*m.start ),
|
core::rect<s32> pos((s32)( x_offset + factor*m.start ),
|
||||||
(s32)( y_offset + i*line_height ),
|
(s32)( y_offset + i*line_height ),
|
||||||
(s32)( x_offset + factor*m.end ),
|
(s32)( x_offset + factor*m.end ),
|
||||||
(s32)( y_offset + (i+1)*line_height ));
|
(s32)( y_offset + (i+1)*line_height ));
|
||||||
|
|
||||||
// Reduce vertically the size of the markers according to their layer
|
// Reduce vertically the size of the markers according to their layer
|
||||||
pos.UpperLeftCorner.Y += m.layer;
|
pos.UpperLeftCorner.Y += m.layer;
|
||||||
|
@ -77,8 +77,8 @@ private:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::list<Marker> MarkerList;
|
typedef std::list<Marker> MarkerList;
|
||||||
typedef std::stack<Marker> MarkerStack;
|
typedef std::stack<Marker> MarkerStack;
|
||||||
|
|
||||||
struct ThreadInfo
|
struct ThreadInfo
|
||||||
{
|
{
|
||||||
@ -86,7 +86,7 @@ private:
|
|||||||
MarkerStack markers_stack[2];
|
MarkerStack markers_stack[2];
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector<ThreadInfo> ThreadInfoList;
|
typedef std::vector<ThreadInfo> ThreadInfoList;
|
||||||
|
|
||||||
ThreadInfoList m_thread_infos;
|
ThreadInfoList m_thread_infos;
|
||||||
int m_write_id;
|
int m_write_id;
|
||||||
|
@ -644,54 +644,56 @@ namespace StringUtils
|
|||||||
|
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
/** Converts a version string (in the form of 'X.Y.Za-rcU' into an
|
/** Converts a version string (in the form of 'X.Y.Za-rcU' into an
|
||||||
* integer number.
|
* integer number.
|
||||||
* \param s The version string to convert.
|
* \param s The version string to convert.
|
||||||
*/
|
*/
|
||||||
int versionToInt(const std::string &version_string)
|
int versionToInt(const std::string &version_string)
|
||||||
{
|
{
|
||||||
// Special case: SVN
|
// Special case: SVN
|
||||||
if(version_string=="SVN" || version_string=="svn")
|
if(version_string=="SVN" || version_string=="svn")
|
||||||
// SVN version will be version 99.99.99i-rcJ
|
{
|
||||||
return 1000000*99
|
// SVN version will be version 99.99.99i-rcJ
|
||||||
+ 10000*99
|
return 1000000*99
|
||||||
+ 100*99
|
+ 10000*99
|
||||||
+ 10* 9
|
+ 100*99
|
||||||
+ 9;
|
+ 10* 9
|
||||||
|
+ 9;
|
||||||
|
}
|
||||||
|
|
||||||
std::string s=version_string;
|
std::string s=version_string;
|
||||||
// To guarantee that a release gets a higher version number than
|
// To guarantee that a release gets a higher version number than
|
||||||
// a release candidate, we assign a 'release_candidate' number
|
// a release candidate, we assign a 'release_candidate' number
|
||||||
// of 9 to versions which are not a RC. We assert that any RC
|
// of 9 to versions which are not a RC. We assert that any RC
|
||||||
// is less than 9 to guarantee the ordering.
|
// is less than 9 to guarantee the ordering.
|
||||||
int release_candidate=9;
|
int release_candidate=9;
|
||||||
if(s.length()>4 && sscanf(s.substr(s.length()-4, 4).c_str(), "-rc%d",
|
if(s.length()>4 && sscanf(s.substr(s.length()-4, 4).c_str(), "-rc%d",
|
||||||
&release_candidate)==1)
|
&release_candidate)==1)
|
||||||
{
|
{
|
||||||
s = s.substr(0, s.length()-4);
|
s = s.substr(0, s.length()-4);
|
||||||
// Otherwise a RC can get a higher version number than
|
// Otherwise a RC can get a higher version number than
|
||||||
// the corresponding release! If this should ever get
|
// the corresponding release! If this should ever get
|
||||||
// triggered, multiply all scaling factors above and
|
// triggered, multiply all scaling factors above and
|
||||||
// below by 10, to get two digits for RC numbers.
|
// below by 10, to get two digits for RC numbers.
|
||||||
assert(release_candidate<9);
|
assert(release_candidate<9);
|
||||||
}
|
}
|
||||||
int very_minor=0;
|
int very_minor=0;
|
||||||
if(s.length()>0 && s[s.size()-1]>='a' && s[s.size()-1]<='z')
|
if(s.length()>0 && s[s.size()-1]>='a' && s[s.size()-1]<='z')
|
||||||
{
|
{
|
||||||
very_minor = s[s.size()-1]-'a'+1;
|
very_minor = s[s.size()-1]-'a'+1;
|
||||||
s = s.substr(0, s.size()-1);
|
s = s.substr(0, s.size()-1);
|
||||||
}
|
}
|
||||||
std::vector<std::string> l = StringUtils::split(s, '.');
|
std::vector<std::string> l = StringUtils::split(s, '.');
|
||||||
while(l.size()<3)
|
while(l.size()<3)
|
||||||
l.push_back("0");
|
l.push_back("0");
|
||||||
int version = 1000000*atoi(l[0].c_str())
|
int version = 1000000*atoi(l[0].c_str())
|
||||||
+ 10000*atoi(l[1].c_str())
|
+ 10000*atoi(l[1].c_str())
|
||||||
+ 100*atoi(l[2].c_str())
|
+ 100*atoi(l[2].c_str())
|
||||||
+ 10*very_minor
|
+ 10*very_minor
|
||||||
+ release_candidate;
|
+ release_candidate;
|
||||||
|
|
||||||
if(version<=0)
|
if(version<=0)
|
||||||
printf("Invalid version string '%s'.\n", s.c_str());
|
printf("Invalid version string '%s'.\n", s.c_str());
|
||||||
return version;
|
return version;
|
||||||
} // versionToInt
|
} // versionToInt
|
||||||
} // namespace StringUtils
|
} // namespace StringUtils
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user