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