Remove characteristics from kart

This commit is contained in:
Flakebi 2015-11-29 04:03:48 +01:00
parent 9fbe72b3c5
commit aea68a2c14
No known key found for this signature in database
GPG Key ID: 38E7ED984D7DCD02
30 changed files with 176 additions and 235 deletions

View File

@ -25,7 +25,6 @@
#include "config/user_config.hpp"
#include "graphics/irr_driver.hpp"
#include "io/xml_node.hpp"
#include "karts/abstract_characteristic.hpp"
#include "karts/abstract_kart.hpp"
#include "karts/explosion_animation.hpp"
#include "karts/kart.hpp"
@ -68,7 +67,7 @@ Camera::Camera(int camera_index, AbstractKart* kart) : m_kart(NULL)
setupCamera();
if (kart != NULL)
{
m_distance = kart->getCharacteristic()->getCameraDistance();
m_distance = kart->getKartProperties()->getCameraDistance();
setKart(kart);
}
else
@ -379,9 +378,9 @@ void Camera::smoothMoveCamera(float dt)
core::vector3df current_position = m_camera->getPosition();
// Smoothly interpolate towards the position and target
const AbstractCharacteristic *ch = m_kart->getCharacteristic();
float max_increase_with_zipper = ch->getZipperMaxSpeedIncrease();
float max_speed_without_zipper = ch->getEngineMaxSpeed();
const KartProperties *kp = m_kart->getKartProperties();
float max_increase_with_zipper = kp->getZipperMaxSpeedIncrease();
float max_speed_without_zipper = kp->getEngineMaxSpeed();
float current_speed = m_kart->getSpeed();
const Skidding *ks = m_kart->getSkidding();
@ -447,7 +446,7 @@ void Camera::getCameraSettings(float *above_kart, float *cam_angle,
float *sideway, float *distance,
bool *smoothing)
{
const AbstractCharacteristic *ch = m_kart->getCharacteristic();
const KartProperties *kp = m_kart->getKartProperties();
switch(m_mode)
{
@ -470,7 +469,7 @@ void Camera::getCameraSettings(float *above_kart, float *cam_angle,
else
{
*above_kart = 0.75f;
*cam_angle = ch->getCameraForwardUpAngle() * DEGREE_TO_RAD;
*cam_angle = kp->getCameraForwardUpAngle() * DEGREE_TO_RAD;
*distance = -m_distance;
}
float steering = m_kart->getSteerPercent()
@ -485,7 +484,7 @@ void Camera::getCameraSettings(float *above_kart, float *cam_angle,
case CM_REVERSE: // Same as CM_NORMAL except it looks backwards
{
*above_kart = 0.75f;
*cam_angle = ch->getCameraBackwardUpAngle() * DEGREE_TO_RAD;
*cam_angle = kp->getCameraBackwardUpAngle() * DEGREE_TO_RAD;
*sideway = 0;
*distance = 2.0f*m_distance;
*smoothing = false;
@ -833,8 +832,7 @@ void Camera::handleEndCamera(float dt)
}
case EndCameraInformation::EC_AHEAD_OF_KART:
{
const AbstractCharacteristic *ch = m_kart->getCharacteristic();
float cam_angle = ch->getCameraBackwardUpAngle() * DEGREE_TO_RAD;
float cam_angle = m_kart->getKartProperties()->getCameraBackwardUpAngle() * DEGREE_TO_RAD;
positionCamera(dt, /*above_kart*/0.75f,
cam_angle, /*side_way*/0,

View File

@ -25,7 +25,6 @@
#include "graphics/material_manager.hpp"
#include "graphics/stk_mesh_scene_node.hpp"
#include "io/file_manager.hpp"
#include "karts/abstract_characteristic.hpp"
#include "karts/abstract_kart.hpp"
#include "karts/controller/controller.hpp"
#include "karts/kart_properties.hpp"
@ -68,9 +67,9 @@ SlipStream::SlipStream(AbstractKart* kart) : MovingTexture(0, 0), m_kart(kart)
setTextureMatrix(&(m_node->getMaterial(0).getTextureMatrix(0)));
m_slipstream_time = 0.0f;
float length = m_kart->getCharacteristic()->getSlipstreamLength();
float length = m_kart->getKartProperties()->getSlipstreamLength();
float kw = m_kart->getKartWidth();
float ew = m_kart->getCharacteristic()->getSlipstreamWidth();
float ew = m_kart->getKartProperties()->getSlipstreamWidth();
float kl = m_kart->getKartLength();
Vec3 p[4];
@ -313,7 +312,7 @@ void SlipStream::setIntensity(float f, const AbstractKart *kart)
bool SlipStream::isSlipstreamReady() const
{
return m_slipstream_time>
m_kart->getCharacteristic()->getSlipstreamCollectTime();
m_kart->getKartProperties()->getSlipstreamCollectTime();
} // isSlipstreamReady
//-----------------------------------------------------------------------------
@ -327,12 +326,12 @@ void SlipStream::updateSlipstreamPower()
if(m_slipstream_mode==SS_USE)
{
setIntensity(2.0f, NULL);
const AbstractCharacteristic *ch=m_kart->getCharacteristic();
const KartProperties *kp = m_kart->getKartProperties();
m_kart->increaseMaxSpeed(MaxSpeed::MS_INCREASE_SLIPSTREAM,
ch->getSlipstreamMaxSpeedIncrease(),
ch->getSlipstreamAddPower(),
ch->getSlipstreamDuration(),
ch->getSlipstreamFadeOutTime());
kp->getSlipstreamMaxSpeedIncrease(),
kp->getSlipstreamAddPower(),
kp->getSlipstreamDuration(),
kp->getSlipstreamFadeOutTime());
}
} // upateSlipstreamPower
@ -388,7 +387,7 @@ void SlipStream::update(float dt)
// not moving. This is useful for debugging the graphics of SS-ing.
//#define DISPLAY_SLIPSTREAM_WITH_0_SPEED_FOR_DEBUGGING
#ifndef DISPLAY_SLIPSTREAM_WITH_0_SPEED_FOR_DEBUGGING
if(m_kart->getSpeed() < m_kart->getCharacteristic()->getSlipstreamMinSpeed())
if(m_kart->getSpeed() < m_kart->getKartProperties()->getSlipstreamMinSpeed())
{
setIntensity(0, NULL);
m_slipstream_mode = SS_NONE;
@ -430,7 +429,7 @@ void SlipStream::update(float dt)
// give karts different slipstream properties.
#ifndef DISPLAY_SLIPSTREAM_WITH_0_SPEED_FOR_DEBUGGING
if(m_target_kart->getSpeed() <
m_kart->getCharacteristic()->getSlipstreamMinSpeed())
m_kart->getKartProperties()->getSlipstreamMinSpeed())
{
if(UserConfigParams::m_slipstream_debug &&
m_kart->getController()->isPlayerController())
@ -444,7 +443,7 @@ void SlipStream::update(float dt)
// slipstream length+0.5*kart_length()+0.5*target_kart_length
// away from the other kart
Vec3 delta = m_kart->getXYZ() - m_target_kart->getXYZ();
float l = m_kart->getCharacteristic()->getSlipstreamLength()
float l = m_kart->getKartProperties()->getSlipstreamLength()
+ 0.5f*( m_target_kart->getKartLength()
+m_kart->getKartLength() );
if(delta.length2_2d() > l*l)
@ -485,7 +484,7 @@ void SlipStream::update(float dt)
m_slipstream_mode = SS_USE;
m_kart->handleZipper();
m_slipstream_time =
m_kart->getCharacteristic()->getSlipstreamCollectTime();
m_kart->getKartProperties()->getSlipstreamCollectTime();
return;
}
}
@ -506,7 +505,7 @@ void SlipStream::update(float dt)
setIntensity(m_slipstream_time, m_target_kart);
m_slipstream_mode = SS_COLLECT;
if(m_slipstream_time>m_kart->getCharacteristic()->getSlipstreamCollectTime())
if(m_slipstream_time>m_kart->getKartProperties()->getSlipstreamCollectTime())
{
setIntensity(1.0f, m_target_kart);
}

View File

@ -30,7 +30,6 @@
#include "items/item_manager.hpp"
#include "items/projectile_manager.hpp"
#include "items/swatter.hpp"
#include "karts/abstract_characteristic.hpp"
#include "karts/abstract_kart.hpp"
#include "karts/controller/controller.hpp"
#include "karts/explosion_animation.hpp"

View File

@ -25,7 +25,6 @@
#include "io/xml_node.hpp"
#include "items/rubber_band.hpp"
#include "items/projectile_manager.hpp"
#include "karts/abstract_characteristic.hpp"
#include "karts/abstract_kart.hpp"
#include "karts/controller/controller.hpp"
#include "karts/kart_properties.hpp"

View File

@ -28,7 +28,6 @@
#include "items/item_manager.hpp"
#include "items/projectile_manager.hpp"
#include "items/rubber_ball.hpp"
#include "karts/abstract_characteristic.hpp"
#include "karts/abstract_kart.hpp"
#include "karts/controller/controller.hpp"
#include "karts/kart_properties.hpp"

View File

@ -26,7 +26,6 @@
#include "graphics/stk_mesh_scene_node.hpp"
#include "items/plunger.hpp"
#include "items/projectile_manager.hpp"
#include "karts/abstract_characteristic.hpp"
#include "karts/abstract_kart.hpp"
#include "karts/kart_properties.hpp"
#include "karts/max_speed.hpp"

View File

@ -34,7 +34,6 @@
#include "io/file_manager.hpp"
#include "items/attachment.hpp"
#include "items/projectile_manager.hpp"
#include "karts/abstract_characteristic.hpp"
#include "karts/controller/controller.hpp"
#include "karts/explosion_animation.hpp"
#include "karts/kart_properties.hpp"

View File

@ -20,8 +20,6 @@
#include "karts/abstract_kart.hpp"
#include "items/powerup.hpp"
#include "karts/cached_characteristic.hpp"
#include "karts/combined_characteristic.hpp"
#include "karts/abstract_kart_animation.hpp"
#include "karts/kart_model.hpp"
#include "karts/kart_properties.hpp"
@ -60,26 +58,6 @@ AbstractKart::AbstractKart(const std::string& ident,
m_kart_length = m_kart_model->getLength();
m_kart_highest_point = m_kart_model->getHighestPoint();
m_wheel_graphics_position = m_kart_model->getWheelsGraphicsPosition();
// Combine the characteristics for this player
m_combined_characteristic.reset(new CombinedCharacteristic());
m_combined_characteristic->addCharacteristic(kart_properties_manager->
getBaseCharacteristic());
m_combined_characteristic->addCharacteristic(kart_properties_manager->
getDifficultyCharacteristic(race_manager->getDifficultyAsString(
race_manager->getDifficulty())));
// Try to get the kart type
const AbstractCharacteristic *characteristic = kart_properties_manager->
getKartTypeCharacteristic(m_kart_properties->getKartType());
if (characteristic)
m_combined_characteristic->addCharacteristic(characteristic);
m_combined_characteristic->addCharacteristic(kart_properties_manager->
getPlayerCharacteristic(KartProperties::getPerPlayerDifficultyAsString(
m_difficulty)));
m_combined_characteristic->addCharacteristic(m_kart_properties->getCharacteristic());
m_characteristic.reset(new CachedCharacteristic(m_combined_characteristic.get()));
} // AbstractKart
// ----------------------------------------------------------------------------
@ -101,12 +79,6 @@ void AbstractKart::reset()
}
} // reset
// ----------------------------------------------------------------------------
const AbstractCharacteristic* AbstractKart::getCharacteristic() const
{
return m_characteristic.get();
}
// ----------------------------------------------------------------------------
/** Returns a name to be displayed for this kart. */
core::stringw AbstractKart::getName() const

View File

@ -34,13 +34,10 @@ namespace irr
}
}
class AbstractCharacteristic;
class AbstractKartAnimation;
class Attachment;
class btKart;
class btQuaternion;
class CachedCharacteristic;
class CombinedCharacteristic;
class Controller;
class Item;
class KartModel;
@ -78,10 +75,6 @@ protected:
/** The per-player difficulty. */
PerPlayerDifficulty m_difficulty;
/** The combined properties of the kart, the player, etc. */
std::unique_ptr<CombinedCharacteristic> m_combined_characteristic;
/** The cached combined characteristics. */
std::unique_ptr<CachedCharacteristic> m_characteristic;
/** This stores a copy of the kart model. It has to be a copy
* since otherwise incosistencies can happen if the same kart
@ -129,9 +122,6 @@ public:
/** Returns the kart properties of this kart. */
const KartProperties* getKartProperties() const
{ return m_kart_properties.get(); }
// ------------------------------------------------------------------------
/** Returns the characteristics of this kart. */
const AbstractCharacteristic* getCharacteristic() const;
// ========================================================================
// Access to the per-player difficulty.

View File

@ -21,7 +21,6 @@
#include "animations/animation_base.hpp"
#include "animations/ipo.hpp"
#include "animations/three_d_animation.hpp"
#include "karts/abstract_characteristic.hpp"
#include "karts/abstract_kart.hpp"
#include "karts/kart_properties.hpp"
#include "modes/world.hpp"
@ -70,7 +69,7 @@ CannonAnimation::~CannonAnimation()
m_kart->getHeading() ));
m_kart->getBody()->setCenterOfMassTransform(pos);
Vec3 v(0, 0, m_kart->getCharacteristic()->getEngineMaxSpeed());
Vec3 v(0, 0, m_kart->getKartProperties()->getEngineMaxSpeed());
m_kart->setVelocity(pos.getBasis()*v);
} // ~CannonAnimation

View File

@ -20,7 +20,6 @@
#include "karts/controller/ai_base_controller.hpp"
#include "config/user_config.hpp"
#include "karts/abstract_characteristic.hpp"
#include "karts/abstract_kart.hpp"
#include "karts/kart_properties.hpp"
#include "karts/controller/ai_properties.hpp"
@ -501,7 +500,7 @@ bool AIBaseController::doSkid(float steer_fraction)
// FIXME: Disable skidding for now if the new skidding
// code is activated, since the AI can not handle this
// properly.
if(m_kart->getCharacteristic()->getSkidVisualTime() > 0)
if(m_kart->getKartProperties()->getSkidVisualTime() > 0)
return false;
// Otherwise return if we need a sharp turn (which is

View File

@ -7,7 +7,6 @@
#include "items/attachment.hpp"
#include "items/item.hpp"
#include "items/powerup.hpp"
#include "karts/abstract_characteristic.hpp"
#include "karts/abstract_kart.hpp"
#include "karts/kart_properties.hpp"
#include "karts/skidding.hpp"
@ -198,7 +197,7 @@ void NetworkPlayerController::steer(float dt, int steer_val)
// change speed is used.
const float STEER_CHANGE = ( (steer_val<=0 && m_controls->m_steer<0) ||
(steer_val>=0 && m_controls->m_steer>0) )
? dt/m_kart->getCharacteristic()->getTurnTimeResetSteer()
? dt/m_kart->getKartProperties()->getTurnTimeResetSteer()
: dt/m_kart->getTimeFullSteer(fabsf(m_controls->m_steer));
if (steer_val < 0)
{

View File

@ -29,7 +29,6 @@
#include "items/attachment.hpp"
#include "items/item.hpp"
#include "items/powerup.hpp"
#include "karts/abstract_characteristic.hpp"
#include "karts/abstract_kart.hpp"
#include "karts/kart_properties.hpp"
#include "karts/skidding.hpp"
@ -255,7 +254,7 @@ void PlayerController::steer(float dt, int steer_val)
// change speed is used.
const float STEER_CHANGE = ( (steer_val<=0 && m_controls->m_steer<0) ||
(steer_val>=0 && m_controls->m_steer>0) )
? dt/m_kart->getCharacteristic()->getTurnTimeResetSteer()
? dt/m_kart->getKartProperties()->getTurnTimeResetSteer()
: dt/m_kart->getTimeFullSteer(fabsf(m_controls->m_steer));
if (steer_val < 0)
{
@ -469,8 +468,8 @@ void PlayerController::handleZipper(bool play_sound)
*/
void PlayerController::collectedItem(const Item &item, int add_info, float old_energy)
{
if (old_energy < m_kart->getCharacteristic()->getNitroMax() &&
m_kart->getEnergy() == m_kart->getCharacteristic()->getNitroMax())
if (old_energy < m_kart->getKartProperties()->getNitroMax() &&
m_kart->getEnergy() == m_kart->getKartProperties()->getNitroMax())
{
m_full_sound->play();
}

View File

@ -31,7 +31,6 @@
#include "items/item_manager.hpp"
#include "items/powerup.hpp"
#include "items/projectile_manager.hpp"
#include "karts/abstract_characteristic.hpp"
#include "karts/abstract_kart.hpp"
#include "karts/controller/kart_control.hpp"
#include "karts/controller/ai_properties.hpp"
@ -1052,8 +1051,8 @@ void SkiddingAI::evaluateItems(const Item *item, float kart_aim_angle,
case Item::ITEM_NITRO_BIG:
// Only collect nitro, if it can actually be stored.
if(m_kart->getEnergy() +
m_kart->getCharacteristic()->getNitroBigContainer()
> m_kart->getCharacteristic()->getNitroMax())
m_kart->getKartProperties()->getNitroBigContainer()
> m_kart->getKartProperties()->getNitroMax())
return;
// fall through: if we have enough space to store a big
// container, we can also store a small container, and
@ -1061,8 +1060,8 @@ void SkiddingAI::evaluateItems(const Item *item, float kart_aim_angle,
case Item::ITEM_NITRO_SMALL: avoid = false;
// Only collect nitro, if it can actually be stored.
if (m_kart->getEnergy() +
m_kart->getCharacteristic()->getNitroSmallContainer()
> m_kart->getCharacteristic()->getNitroMax())
m_kart->getKartProperties()->getNitroSmallContainer()
> m_kart->getKartProperties()->getNitroMax())
return;
case Item::ITEM_BONUS_BOX:
break;
@ -1092,7 +1091,7 @@ void SkiddingAI::evaluateItems(const Item *item, float kart_aim_angle,
// be if the kart would need to turn sharper, therefore stops
// skidding, and will get the bonus speed.
bool high_speed = (m_kart->getCurrentMaxSpeed() >
m_kart->getCharacteristic()->getEngineMaxSpeed() ) ||
m_kart->getKartProperties()->getEngineMaxSpeed() ) ||
m_kart->getSkidding()->getSkidBonusReady();
float max_angle = high_speed
? m_ai_properties->m_max_item_angle_high_speed
@ -1354,13 +1353,13 @@ void SkiddingAI::handleItems(const float dt)
case PowerupManager::POWERUP_PARACHUTE:
// Wait one second more than a previous parachute
if(m_time_since_last_shot > m_kart->getCharacteristic()->getParachuteDurationOther() + 1.0f)
if(m_time_since_last_shot > m_kart->getKartProperties()->getParachuteDurationOther() + 1.0f)
m_controls->m_fire = true;
break; // POWERUP_PARACHUTE
case PowerupManager::POWERUP_ANVIL:
// Wait one second more than a previous anvil
if(m_time_since_last_shot < m_kart->getCharacteristic()->getAnvilDuration() + 1.0f) break;
if(m_time_since_last_shot < m_kart->getKartProperties()->getAnvilDuration() + 1.0f) break;
if(race_manager->getMinorMode()==RaceManager::MINOR_MODE_FOLLOW_LEADER)
{
@ -1377,7 +1376,7 @@ void SkiddingAI::handleItems(const float dt)
case PowerupManager::POWERUP_SWATTER:
{
// Squared distance for which the swatter works
float d2 = m_kart->getCharacteristic()->getSwatterDistance();
float d2 = m_kart->getKartProperties()->getSwatterDistance();
// if the kart has a shield, do not break it by using a swatter.
if(m_kart->getShieldTime() > min_bubble_time)
break;
@ -2287,8 +2286,8 @@ bool SkiddingAI::doSkid(float steer_fraction)
return false;
}
// If there is a skidding bonus, try to get it.
else if (m_kart->getCharacteristic()->getSkidBonusSpeed().size() > 0 &&
m_kart->getCharacteristic()->getSkidTimeTillBonus()[0] < duration)
else if (m_kart->getKartProperties()->getSkidBonusSpeed().size() > 0 &&
m_kart->getKartProperties()->getSkidTimeTillBonus()[0] < duration)
{
#ifdef DEBUG
if(!m_controls->m_skid && m_ai_debug)

View File

@ -22,7 +22,6 @@
#include "graphics/callbacks.hpp"
#include "graphics/camera.hpp"
#include "items/attachment.hpp"
#include "karts/abstract_characteristic.hpp"
#include "karts/abstract_kart.hpp"
#include "karts/kart_properties.hpp"
#include "modes/world.hpp"
@ -41,7 +40,7 @@ ExplosionAnimation *ExplosionAnimation::create(AbstractKart *kart,
{
if(kart->isInvulnerable()) return NULL;
float r = kart->getCharacteristic()->getExplosionRadius();
float r = kart->getKartProperties()->getExplosionRadius();
// Ignore explosion that are too far away.
if(!direct_hit && pos.distance2(kart->getXYZ())>r*r) return NULL;
@ -79,7 +78,7 @@ ExplosionAnimation::ExplosionAnimation(AbstractKart *kart,
m_xyz = m_kart->getXYZ();
m_orig_y = m_xyz.getY();
m_kart->playCustomSFX(SFXManager::CUSTOM_EXPLODE);
m_timer = m_kart->getCharacteristic()->getExplosionDuration();
m_timer = m_kart->getKartProperties()->getExplosionDuration();
// Non-direct hits will be only affected half as much.
if(!direct_hit) m_timer*=0.5f;
@ -106,7 +105,7 @@ ExplosionAnimation::ExplosionAnimation(AbstractKart *kart,
m_add_rotation.setRoll( (rand()%(2*max_rotation+1)-max_rotation)*f );
// Set invulnerable time, and graphical effects
float t = m_kart->getCharacteristic()->getExplosionInvulnerabilityTime();
float t = m_kart->getKartProperties()->getExplosionInvulnerabilityTime();
m_kart->setInvulnerableTime(t);
m_kart->showStarEffect(t);

View File

@ -364,8 +364,8 @@ void Kart::reset()
// In case that the kart was in the air, in which case its
// linear damping is 0
if(m_body)
m_body->setDamping(m_characteristic->getStabilityChassisLinearDamping(),
m_characteristic->getStabilityChassisAngularDamping() );
m_body->setDamping(m_kart_properties->getStabilityChassisLinearDamping(),
m_kart_properties->getStabilityChassisAngularDamping());
if(m_terrain_sound)
{
@ -522,7 +522,7 @@ void Kart::blockViewWithPlunger()
{
// Avoid that a plunger extends the plunger time
if(m_view_blocked_by_plunger<=0 && !isShielded())
m_view_blocked_by_plunger = m_characteristic->getPlungerInFaceTime();
m_view_blocked_by_plunger = m_kart_properties->getPlungerInFaceTime();
if(isShielded())
{
decreaseShieldTime();
@ -556,7 +556,7 @@ btTransform Kart::getAlignedTransform(const float custom_pitch)
// ----------------------------------------------------------------------------
float Kart::getTimeFullSteer(float steer) const
{
return m_characteristic->getTurnTimeFullSteer().get(steer);
return m_kart_properties->getTurnTimeFullSteer().get(steer);
} // getTimeFullSteer
// ----------------------------------------------------------------------------
@ -601,7 +601,7 @@ void Kart::createPhysics()
if (y == -1)
{
int index = (x + 1) / 2 + 1 - z; // get index of wheel
float f = getKartProperties()->getPhysicalWheelPosition();
float f = m_kart_properties->getPhysicalWheelPosition();
// f < 0 indicates to use the old physics position, i.e.
// to place the wheels outside of the chassis
if(f<0)
@ -639,7 +639,7 @@ void Kart::createPhysics()
// Set mass and inertia
// --------------------
float mass = m_characteristic->getMass();
float mass = m_kart_properties->getMass();
// Position the chassis
// --------------------
@ -648,8 +648,8 @@ void Kart::createPhysics()
createBody(mass, trans, &m_kart_chassis,
m_kart_properties->getRestitution());
m_user_pointer.set(this);
m_body->setDamping(m_characteristic->getStabilityChassisLinearDamping(),
m_characteristic->getStabilityChassisAngularDamping() );
m_body->setDamping(m_kart_properties->getStabilityChassisLinearDamping(),
m_kart_properties->getStabilityChassisAngularDamping() );
// Reset velocities
// ----------------
@ -669,18 +669,18 @@ void Kart::createPhysics()
// Add wheels
// ----------
float suspension_rest = m_characteristic->getSuspensionRest();
float suspension_rest = m_kart_properties->getSuspensionRest();
btVector3 wheel_direction(0.0f, -1.0f, 0.0f);
btVector3 wheel_axle(-1.0f, 0.0f, 0.0f);
btKart::btVehicleTuning tuning;
tuning.m_maxSuspensionTravel =
m_characteristic->getSuspensionTravel();
m_kart_properties->getSuspensionTravel();
tuning.m_maxSuspensionForce =
m_characteristic->getSuspensionMaxForce();
m_kart_properties->getSuspensionMaxForce();
const Vec3 &cs = getKartProperties()->getGravityCenterShift();
const Vec3 &cs = m_kart_properties->getGravityCenterShift();
for(unsigned int i=0; i<4; i++)
{
bool is_front_wheel = i<2;
@ -689,11 +689,11 @@ void Kart::createPhysics()
wheel_direction, wheel_axle, suspension_rest,
m_kart_model->getWheelGraphicsRadius(i),
tuning, is_front_wheel);
wheel.m_suspensionStiffness = m_characteristic->getSuspensionStiffness();
wheel.m_wheelsDampingRelaxation = m_characteristic->getWheelsDampingRelaxation();
wheel.m_wheelsDampingCompression = m_characteristic->getWheelsDampingCompression();
wheel.m_suspensionStiffness = m_kart_properties->getSuspensionStiffness();
wheel.m_wheelsDampingRelaxation = m_kart_properties->getWheelsDampingRelaxation();
wheel.m_wheelsDampingCompression = m_kart_properties->getWheelsDampingCompression();
wheel.m_frictionSlip = m_kart_properties->getFrictionSlip();
wheel.m_rollInfluence = m_characteristic->getStabilityRollInfluence();
wheel.m_rollInfluence = m_kart_properties->getStabilityRollInfluence();
}
// Obviously these allocs have to be properly managed/freed
btTransform t;
@ -779,7 +779,7 @@ void Kart::adjustSpeed(float f)
*/
void Kart::updateWeight()
{
float mass = m_characteristic->getMass() + m_attachment->weightAdjust();
float mass = m_kart_properties->getMass() + m_attachment->weightAdjust();
btVector3 inertia;
m_kart_chassis.calculateLocalInertia(mass, inertia);
@ -791,7 +791,7 @@ void Kart::updateWeight()
* \param radius The radius for which the speed needs to be computed. */
float Kart::getSpeedForTurnRadius(float radius) const
{
InterpolationArray turn_angle_at_speed = m_characteristic->getTurnRadius();
InterpolationArray turn_angle_at_speed = m_kart_properties->getTurnRadius();
// Convert the turn radius into turn angle
for(std::size_t i = 0; i < turn_angle_at_speed.size(); i++)
turn_angle_at_speed.setY(i, sin(m_kart_properties->getWheelBase() /
@ -805,7 +805,7 @@ float Kart::getSpeedForTurnRadius(float radius) const
/** Returns the maximum steering angle (depending on speed). */
float Kart::getMaxSteerAngle(float speed) const
{
InterpolationArray turn_angle_at_speed = m_characteristic->getTurnRadius();
InterpolationArray turn_angle_at_speed = m_kart_properties->getTurnRadius();
// Convert the turn radius into turn angle
for(std::size_t i = 0; i < turn_angle_at_speed.size(); i++)
turn_angle_at_speed.setY(i, sin(m_kart_properties->getWheelBase() /
@ -921,10 +921,10 @@ void Kart::collectedItem(Item *item, int add_info)
m_attachment->hitBanana(item, add_info);
break;
case Item::ITEM_NITRO_SMALL:
m_collected_energy += m_characteristic->getNitroSmallContainer();
m_collected_energy += m_kart_properties->getNitroSmallContainer();
break;
case Item::ITEM_NITRO_BIG:
m_collected_energy += m_characteristic->getNitroBigContainer();
m_collected_energy += m_kart_properties->getNitroBigContainer();
break;
case Item::ITEM_BONUS_BOX :
{
@ -936,13 +936,13 @@ void Kart::collectedItem(Item *item, int add_info)
item->getEmitter()->getIdent() == "nolok");
// slow down
m_bubblegum_time = m_characteristic->getBubblegumDuration();
m_bubblegum_time = m_kart_properties->getBubblegumDuration();
m_bubblegum_torque = ((rand()%2)
? m_characteristic->getBubblegumTorque()
: -m_characteristic->getBubblegumTorque());
? m_kart_properties->getBubblegumTorque()
: -m_kart_properties->getBubblegumTorque());
m_max_speed->setSlowdown(MaxSpeed::MS_DECREASE_BUBBLE,
m_characteristic->getBubblegumSpeedFraction() ,
m_characteristic->getBubblegumFadeInTime(),
m_kart_properties->getBubblegumSpeedFraction() ,
m_kart_properties->getBubblegumFadeInTime(),
m_bubblegum_time);
m_goo_sound->setPosition(getXYZ());
m_goo_sound->play();
@ -952,8 +952,8 @@ void Kart::collectedItem(Item *item, int add_info)
default : break;
} // switch TYPE
if ( m_collected_energy > m_characteristic->getNitroMax())
m_collected_energy = m_characteristic->getNitroMax();
if ( m_collected_energy > m_kart_properties->getNitroMax())
m_collected_energy = m_kart_properties->getNitroMax();
m_controller->collectedItem(*item, add_info, old_energy);
} // collectedItem
@ -968,11 +968,11 @@ void Kart::collectedItem(Item *item, int add_info)
float Kart::getStartupBoost() const
{
float t = World::getWorld()->getTime();
std::vector<float> startup_times = m_characteristic->getStartupTime();
std::vector<float> startup_times = m_kart_properties->getStartupTime();
for (unsigned int i = 0; i < startup_times.size(); i++)
{
if (t <= startup_times[i])
return m_characteristic->getStartupBoost()[i];
return m_kart_properties->getStartupBoost()[i];
}
return 0;
} // getStartupBoost
@ -985,20 +985,20 @@ float Kart::getActualWheelForce()
{
float add_force = m_max_speed->getCurrentAdditionalEngineForce();
assert(!isnan(add_force));
const std::vector<float>& gear_ratio=m_characteristic->getGearSwitchRatio();
const std::vector<float>& gear_ratio=m_kart_properties->getGearSwitchRatio();
for(unsigned int i=0; i<gear_ratio.size(); i++)
{
if(m_speed <= m_characteristic->getEngineMaxSpeed() * gear_ratio[i])
if(m_speed <= m_kart_properties->getEngineMaxSpeed() * gear_ratio[i])
{
assert(!isnan(m_characteristic->getEnginePower()));
assert(!isnan(m_characteristic->getGearPowerIncrease()[i]));
return m_characteristic->getEnginePower()
* m_characteristic->getGearPowerIncrease()[i]
assert(!isnan(m_kart_properties->getEnginePower()));
assert(!isnan(m_kart_properties->getGearPowerIncrease()[i]));
return m_kart_properties->getEnginePower()
* m_kart_properties->getGearPowerIncrease()[i]
+ add_force;
}
}
assert(!isnan(m_characteristic->getEnginePower()));
return m_characteristic->getEnginePower() + add_force * 2;
assert(!isnan(m_kart_properties->getEnginePower()));
return m_kart_properties->getEnginePower() + add_force * 2;
} // getActualWheelForce
@ -1195,12 +1195,12 @@ void Kart::update(float dt)
// When the kart is jumping, linear damping reduces the falling speed
// of a kart so much that it can appear to be in slow motion. So
// disable linear damping if a kart is in the air
m_body->setDamping(0, m_characteristic->getStabilityChassisAngularDamping());
m_body->setDamping(0, m_kart_properties->getStabilityChassisAngularDamping());
}
else
{
m_body->setDamping(m_characteristic->getStabilityChassisLinearDamping(),
m_characteristic->getStabilityChassisAngularDamping());
m_body->setDamping(m_kart_properties->getStabilityChassisLinearDamping(),
m_kart_properties->getStabilityChassisAngularDamping());
}
if(m_kart_animation)
@ -1368,7 +1368,7 @@ void Kart::update(float dt)
static video::SColor green(255, 61, 87, 23);
// draw skidmarks if relevant (we force pink skidmarks on when hitting a bubblegum)
if(m_characteristic->getSkidEnabled())
if(m_kart_properties->getSkidEnabled())
{
m_skidmarks->update(dt,
m_bubblegum_time > 0,
@ -1411,7 +1411,7 @@ void Kart::update(float dt)
// Jump if either the jump is estimated to be long enough, or
// the texture has the jump property set.
if (t > m_characteristic->getJumpAnimationTime() ||
if (t > m_kart_properties->getJumpAnimationTime() ||
last_m->isJumpTexture())
{
m_kart_model->setAnimation(KartModel::AF_JUMP_START);
@ -1706,23 +1706,23 @@ void Kart::handleZipper(const Material *material, bool play_sound)
material->getZipperParameter(&max_speed_increase, &duration,
&speed_gain, &fade_out_time, &engine_force);
if(max_speed_increase<0)
max_speed_increase = m_characteristic->getZipperMaxSpeedIncrease();
max_speed_increase = m_kart_properties->getZipperMaxSpeedIncrease();
if(duration<0)
duration = m_characteristic->getZipperDuration();
duration = m_kart_properties->getZipperDuration();
if(speed_gain<0)
speed_gain = m_characteristic->getZipperSpeedGain();
speed_gain = m_kart_properties->getZipperSpeedGain();
if(fade_out_time<0)
fade_out_time = m_characteristic->getZipperFadeOutTime();
fade_out_time = m_kart_properties->getZipperFadeOutTime();
if(engine_force<0)
engine_force = m_characteristic->getZipperForce();
engine_force = m_kart_properties->getZipperForce();
}
else
{
max_speed_increase = m_characteristic->getZipperMaxSpeedIncrease();
duration = m_characteristic->getZipperDuration();
speed_gain = m_characteristic->getZipperSpeedGain();
fade_out_time = m_characteristic->getZipperFadeOutTime();
engine_force = m_characteristic->getZipperForce();
max_speed_increase = m_kart_properties->getZipperMaxSpeedIncrease();
duration = m_kart_properties->getZipperDuration();
speed_gain = m_kart_properties->getZipperSpeedGain();
fade_out_time = m_kart_properties->getZipperFadeOutTime();
engine_force = m_kart_properties->getZipperForce();
}
// Ignore a zipper that's activated while braking
if(m_controls.m_brake || m_speed<0) return;
@ -1763,7 +1763,7 @@ void Kart::updateNitro(float dt)
return;
}
m_collected_energy -= dt * m_characteristic->getNitroConsumption();
m_collected_energy -= dt * m_kart_properties->getNitroConsumption();
if (m_collected_energy < 0)
{
if(m_nitro_sound->getStatus() == SFXBase::SFX_PLAYING)
@ -1777,10 +1777,10 @@ void Kart::updateNitro(float dt)
if(m_nitro_sound->getStatus() != SFXBase::SFX_PLAYING)
m_nitro_sound->play();
m_max_speed->increaseMaxSpeed(MaxSpeed::MS_INCREASE_NITRO,
m_characteristic->getNitroMaxSpeedIncrease(),
m_characteristic->getNitroEngineForce(),
m_characteristic->getNitroDuration(),
m_characteristic->getNitroFadeOutTime());
m_kart_properties->getNitroMaxSpeedIncrease(),
m_kart_properties->getNitroEngineForce(),
m_kart_properties->getNitroDuration(),
m_kart_properties->getNitroFadeOutTime());
}
else
{
@ -1839,7 +1839,7 @@ void Kart::crashed(const Material *m, const Vec3 &normal)
#endif
const LinearWorld *lw = dynamic_cast<LinearWorld*>(World::getWorld());
if(getKartProperties()->getTerrainImpulseType()
if(m_kart_properties->getTerrainImpulseType()
==KartProperties::IMPULSE_NORMAL &&
m_vehicle->getCentralImpulseTime()<=0 )
{
@ -1866,7 +1866,7 @@ void Kart::crashed(const Material *m, const Vec3 &normal)
// graph node center (we have to use the previous point since the
// kart might have only now reached the new quad, meaning the kart
// would be pushed forward).
else if(getKartProperties()->getTerrainImpulseType()
else if(m_kart_properties->getTerrainImpulseType()
==KartProperties::IMPULSE_TO_DRIVELINE &&
lw && m_vehicle->getCentralImpulseTime()<=0 &&
World::getWorld()->getTrack()->isPushBackEnabled())
@ -2137,11 +2137,11 @@ void Kart::updatePhysics(float dt)
// Only apply if near ground instead of purely based on speed avoiding
// the "parachute on top" look.
const Vec3 &v = m_body->getLinearVelocity();
if(/*isNearGround() &&*/ v.getY() < - m_characteristic->getSuspensionTravel() * 0.01f * 60)
if(/*isNearGround() &&*/ v.getY() < - m_kart_properties->getSuspensionTravel() * 0.01f * 60)
{
Vec3 v_clamped = v;
// clamp the speed to 99% of the maxium falling speed.
v_clamped.setY(-m_characteristic->getSuspensionTravel() * 0.01f * 60 * 0.99f);
v_clamped.setY(-m_kart_properties->getSuspensionTravel() * 0.01f * 60 * 0.99f);
//m_body->setLinearVelocity(v_clamped);
}
@ -2244,7 +2244,7 @@ void Kart::updateEnginePowerAndBrakes(float dt)
// Lose some traction when skidding, to balance the advantage
if (m_controls.m_skid &&
m_characteristic->getSkidVisualTime() == 0)
m_kart_properties->getSkidVisualTime() == 0)
engine_power *= 0.5f;
applyEngineForce(engine_power*m_controls.m_accel);
@ -2267,8 +2267,8 @@ void Kart::updateEnginePowerAndBrakes(float dt)
m_brake_time += dt;
// Apply the brakes - include the time dependent brake increase
float f = 1 + m_brake_time
* m_characteristic->getEngineBrakeTimeIncrease();
m_vehicle->setAllBrakes(m_characteristic->getEngineBrakeFactor() * f);
* m_kart_properties->getEngineBrakeTimeIncrease();
m_vehicle->setAllBrakes(m_kart_properties->getEngineBrakeFactor() * f);
}
else // m_speed < 0
{
@ -2276,7 +2276,7 @@ void Kart::updateEnginePowerAndBrakes(float dt)
// going backward, apply reverse gear ratio (unless he goes
// too fast backwards)
if ( -m_speed < m_max_speed->getCurrentMaxSpeed()
*m_characteristic->getEngineMaxSpeedReverseRatio())
*m_kart_properties->getEngineMaxSpeedReverseRatio())
{
// The backwards acceleration is artificially increased to
// allow players to get "unstuck" quicker if they hit e.g.
@ -2445,7 +2445,7 @@ void Kart::loadData(RaceManager::KartType type, bool is_animated_model)
m_slipstream = new SlipStream(this);
if (m_characteristic->getSkidEnabled())
if (m_kart_properties->getSkidEnabled())
{
m_skidmarks = new SkidMarks(*this);
m_skidmarks->adjustFog(
@ -2629,7 +2629,7 @@ void Kart::updateGraphics(float dt, const Vec3& offset_xyz,
{
// fabs(speed) is important, otherwise the negative number will
// become a huge unsigned number in the particle scene node!
nitro_frac = fabsf(getSpeed()) / (m_characteristic->getEngineMaxSpeed());
nitro_frac = fabsf(getSpeed()) / (m_kart_properties->getEngineMaxSpeed());
// The speed of the kart can be higher (due to powerups) than
// the normal maximum speed of the kart.
if(nitro_frac>1.0f) nitro_frac = 1.0f;
@ -2643,7 +2643,7 @@ void Kart::updateGraphics(float dt, const Vec3& offset_xyz,
// leaning might get less if a kart gets a special that increases
// its maximum speed, but not the current speed (by much). On the
// other hand, that ratio can often be greater than 1.
float speed_frac = m_speed / m_characteristic->getEngineMaxSpeed();
float speed_frac = m_speed / m_kart_properties->getEngineMaxSpeed();
if(speed_frac>1.0f)
speed_frac = 1.0f;
else if (speed_frac < 0.0f) // no leaning when backwards driving

View File

@ -25,7 +25,6 @@
#include "graphics/particle_emitter.hpp"
#include "graphics/particle_kind.hpp"
#include "graphics/particle_kind_manager.hpp"
#include "karts/abstract_characteristic.hpp"
#include "karts/abstract_kart.hpp"
#include "karts/controller/controller.hpp"
#include "karts/kart.hpp"
@ -327,7 +326,7 @@ void KartGFX::updateTerrain(const ParticleKind *pk)
if (skidding > 1.0f && on_ground)
rate = fabsf(m_kart->getControls().m_steer) > 0.8 ? skidding - 1 : 0;
else if (speed >= 0.5f && on_ground)
rate = speed/m_kart->getCharacteristic()->getEngineMaxSpeed();
rate = speed/m_kart->getKartProperties()->getEngineMaxSpeed();
else
{
pe->setCreationRateAbsolute(0);

View File

@ -309,6 +309,9 @@ void KartProperties::combineCharacteristics()
m_combined_characteristic.reset(new CombinedCharacteristic());
m_combined_characteristic->addCharacteristic(kart_properties_manager->
getBaseCharacteristic());
m_combined_characteristic->addCharacteristic(kart_properties_manager->
getDifficultyCharacteristic(race_manager->getDifficultyAsString(
race_manager->getDifficulty())));
// Try to get the kart type
const AbstractCharacteristic *characteristic = kart_properties_manager->

View File

@ -40,6 +40,7 @@ using namespace irr;
class AbstractCharacteristic;
class AIProperties;
class CachedCharacteristic;
class CombinedCharacteristic;
class Material;
class XMLNode;
@ -124,7 +125,7 @@ private:
/** The base characteristics combined with the characteristics of this kart. */
std::shared_ptr<CombinedCharacteristic> m_combined_characteristic;
/** The cached combined characteristics. */
std::unique_ptr<CachedCharacteristic> m_cached_characteristic;
std::shared_ptr<CachedCharacteristic> m_cached_characteristic;
// Physic properties
// -----------------

View File

@ -21,7 +21,6 @@
#include <algorithm>
#include <assert.h>
#include "karts/abstract_characteristic.hpp"
#include "karts/abstract_kart.hpp"
#include "karts/kart_properties.hpp"
#include "physics/btKart.hpp"
@ -63,7 +62,7 @@ MaxSpeed::MaxSpeed(AbstractKart *kart)
*/
void MaxSpeed::reset()
{
m_current_max_speed = m_kart->getCharacteristic()->getEngineMaxSpeed();
m_current_max_speed = m_kart->getKartProperties()->getEngineMaxSpeed();
m_min_speed = -1.0f;
for(unsigned int i=MS_DECREASE_MIN; i<MS_DECREASE_MAX; i++)
@ -243,7 +242,7 @@ void MaxSpeed::update(float dt)
}
m_add_engine_force = 0;
m_current_max_speed = m_kart->getCharacteristic()->getEngineMaxSpeed();
m_current_max_speed = m_kart->getKartProperties()->getEngineMaxSpeed();
// Then add the speed increase from each category
// ----------------------------------------------

View File

@ -22,7 +22,6 @@
#include "graphics/camera.hpp"
#include "graphics/referee.hpp"
#include "items/attachment.hpp"
#include "karts/abstract_characteristic.hpp"
#include "karts/abstract_kart.hpp"
#include "karts/kart_properties.hpp"
#include "modes/three_strikes_battle.hpp"
@ -40,8 +39,8 @@ RescueAnimation::RescueAnimation(AbstractKart *kart, bool is_auto_rescue)
{
m_referee = new Referee(*m_kart);
m_kart->getNode()->addChild(m_referee->getSceneNode());
m_timer = m_kart->getCharacteristic()->getRescueDuration();
m_velocity = m_kart->getCharacteristic()->getRescueHeight() / m_timer;
m_timer = m_kart->getKartProperties()->getRescueDuration();
m_velocity = m_kart->getKartProperties()->getRescueHeight() / m_timer;
m_xyz = m_kart->getXYZ();
m_kart->getAttachment()->clear();

View File

@ -23,7 +23,6 @@
#endif
#include "achievements/achievement_info.hpp"
#include "config/player_manager.hpp"
#include "karts/abstract_characteristic.hpp"
#include "karts/ghost_kart.hpp"
#include "karts/kart.hpp"
#include "karts/kart_gfx.hpp"
@ -48,7 +47,7 @@ Skidding::Skidding(Kart *kart)
m_actual_curve->setVisible(false);
#endif
m_kart = kart;
m_skid_reduce_turn_delta = m_kart->getCharacteristic()->getSkidReduceTurnMax() - m_kart->getCharacteristic()->getSkidReduceTurnMin();
m_skid_reduce_turn_delta = m_kart->getKartProperties()->getSkidReduceTurnMax() - m_kart->getKartProperties()->getSkidReduceTurnMin();
reset();
} // Skidding
@ -101,7 +100,7 @@ void Skidding::updateSteering(float steer, float dt)
case SKID_SHOW_GFX_RIGHT:
case SKID_NONE:
m_real_steering = steer;
if (m_skid_time < m_kart->getCharacteristic()->getSkidVisualTime() && m_skid_time > 0)
if (m_skid_time < m_kart->getKartProperties()->getSkidVisualTime() && m_skid_time > 0)
{
float f = m_visual_rotation - m_visual_rotation*dt/m_skid_time;
// Floating point errors when m_skid_time is very close to 0
@ -125,27 +124,27 @@ void Skidding::updateSteering(float steer, float dt)
case SKID_ACCUMULATE_RIGHT:
{
float f = (1.0f+steer)*0.5f; // map [-1,1] --> [0, 1]
m_real_steering = m_kart->getCharacteristic()->getSkidReduceTurnMin()
m_real_steering = m_kart->getKartProperties()->getSkidReduceTurnMin()
+ m_skid_reduce_turn_delta * f;
if(m_skid_time < m_kart->getCharacteristic()->getSkidVisualTime())
m_visual_rotation = m_kart->getCharacteristic()->getSkidVisual()
if(m_skid_time < m_kart->getKartProperties()->getSkidVisualTime())
m_visual_rotation = m_kart->getKartProperties()->getSkidVisual()
* m_real_steering * m_skid_time
/ m_kart->getCharacteristic()->getSkidVisualTime();
/ m_kart->getKartProperties()->getSkidVisualTime();
else
m_visual_rotation = m_kart->getCharacteristic()->getSkidVisual() * m_real_steering;
m_visual_rotation = m_kart->getKartProperties()->getSkidVisual() * m_real_steering;
break;
}
case SKID_ACCUMULATE_LEFT:
{
float f = (-1.0f+steer)*0.5f; // map [-1,1] --> [-1, 0]
m_real_steering = -m_kart->getCharacteristic()->getSkidReduceTurnMin()
m_real_steering = -m_kart->getKartProperties()->getSkidReduceTurnMin()
+ m_skid_reduce_turn_delta * f;
if(m_skid_time < m_kart->getCharacteristic()->getSkidVisualTime())
m_visual_rotation = m_kart->getCharacteristic()->getSkidVisual()
if(m_skid_time < m_kart->getKartProperties()->getSkidVisualTime())
m_visual_rotation = m_kart->getKartProperties()->getSkidVisual()
* m_real_steering * m_skid_time
/ m_kart->getCharacteristic()->getSkidVisualTime();
/ m_kart->getKartProperties()->getSkidVisualTime();
else
m_visual_rotation = m_kart->getCharacteristic()->getSkidVisual() * m_real_steering;
m_visual_rotation = m_kart->getKartProperties()->getSkidVisual() * m_real_steering;
break;
}
@ -175,13 +174,13 @@ float Skidding::getSteeringWhenSkidding(float steering) const
break;
case SKID_ACCUMULATE_RIGHT:
{
float f = (steering - m_kart->getCharacteristic()->getSkidReduceTurnMin())
float f = (steering - m_kart->getKartProperties()->getSkidReduceTurnMin())
/ m_skid_reduce_turn_delta;
return f *2.0f-1.0f;
}
case SKID_ACCUMULATE_LEFT:
{
float f = (steering + m_kart->getCharacteristic()->getSkidReduceTurnMin())
float f = (steering + m_kart->getKartProperties()->getSkidReduceTurnMin())
/ m_skid_reduce_turn_delta;
return 2.0f * f +1.0f;
}
@ -214,7 +213,7 @@ void Skidding::update(float dt, bool is_on_ground,
#endif
// No skidding backwards or while stopped
if(m_kart->getSpeed() < m_kart->getCharacteristic()->getSkidMinSpeed() &&
if(m_kart->getSpeed() < m_kart->getKartProperties()->getSkidMinSpeed() &&
m_skid_state != SKID_NONE && m_skid_state != SKID_BREAK)
{
m_skid_state = SKID_BREAK;
@ -226,15 +225,15 @@ void Skidding::update(float dt, bool is_on_ground,
if (is_on_ground)
{
if ((fabs(steering) > 0.001f) &&
m_kart->getSpeed() > m_kart->getCharacteristic()->getSkidMinSpeed() &&
m_kart->getSpeed() > m_kart->getKartProperties()->getSkidMinSpeed() &&
(skidding == KartControl::SC_LEFT || skidding == KartControl::SC_RIGHT))
{
m_skid_factor += m_kart->getCharacteristic()->getSkidIncrease()
* dt / m_kart->getCharacteristic()->getSkidTimeTillMax();
m_skid_factor += m_kart->getKartProperties()->getSkidIncrease()
* dt / m_kart->getKartProperties()->getSkidTimeTillMax();
}
else if (m_skid_factor > 1.0f)
{
m_skid_factor *= m_kart->getCharacteristic()->getSkidDecrease();
m_skid_factor *= m_kart->getKartProperties()->getSkidDecrease();
}
}
else
@ -242,8 +241,8 @@ void Skidding::update(float dt, bool is_on_ground,
m_skid_factor = 1.0f; // Lose any skid factor as soon as we fly
}
if (m_skid_factor > m_kart->getCharacteristic()->getSkidMax())
m_skid_factor = m_kart->getCharacteristic()->getSkidMax();
if (m_skid_factor > m_kart->getKartProperties()->getSkidMax())
m_skid_factor = m_kart->getKartProperties()->getSkidMax();
else
if (m_skid_factor < 1.0f) m_skid_factor = 1.0f;
@ -292,7 +291,7 @@ void Skidding::update(float dt, bool is_on_ground,
// Don't allow skidding while the kart is (apparently)
// still in the air, or when the kart is too slow
if (m_remaining_jump_time > 0 ||
m_kart->getSpeed() < m_kart->getCharacteristic()->getSkidMinSpeed())
m_kart->getSpeed() < m_kart->getKartProperties()->getSkidMinSpeed())
break;
m_skid_state = skidding==KartControl::SC_RIGHT
@ -304,14 +303,14 @@ void Skidding::update(float dt, bool is_on_ground,
// Then use this speed to determine the impulse necessary to
// reach this speed.
float v = World::getWorld()->getTrack()->getGravity()
* 0.5f * m_kart->getCharacteristic()->getSkidPhysicalJumpTime();
* 0.5f * m_kart->getKartProperties()->getSkidPhysicalJumpTime();
btVector3 imp(0, v / m_kart->getBody()->getInvMass(),0);
m_kart->getVehicle()->getRigidBody()->applyCentralImpulse(imp);
// Some karts might use a graphical-only jump. Set it up:
m_jump_speed = World::getWorld()->getTrack()->getGravity()
* 0.5f * m_kart->getCharacteristic()->getSkidGraphicalJumpTime();
m_remaining_jump_time = m_kart->getCharacteristic()->getSkidGraphicalJumpTime();
* 0.5f * m_kart->getKartProperties()->getSkidGraphicalJumpTime();
m_remaining_jump_time = m_kart->getKartProperties()->getSkidGraphicalJumpTime();
#ifdef SKID_DEBUG
#define SPEED 20.0f
@ -392,11 +391,11 @@ void Skidding::update(float dt, bool is_on_ground,
m_skid_state = m_skid_state == SKID_ACCUMULATE_LEFT
? SKID_SHOW_GFX_LEFT
: SKID_SHOW_GFX_RIGHT;
float t = std::min(m_skid_time, m_kart->getCharacteristic()->getSkidVisualTime());
t = std::min(t, m_kart->getCharacteristic()->getSkidRevertVisualTime());
float t = std::min(m_skid_time, m_kart->getKartProperties()->getSkidVisualTime());
t = std::min(t, m_kart->getKartProperties()->getSkidRevertVisualTime());
float vso = getVisualSkidRotation();
btVector3 rot(0, vso * m_kart->getCharacteristic()->getSkidPostSkidRotateFactor(), 0);
btVector3 rot(0, vso * m_kart->getKartProperties()->getSkidPostSkidRotateFactor(), 0);
m_kart->getVehicle()->setTimedRotation(t, rot);
// skid_time is used to count backwards for the GFX
m_skid_time = t;
@ -459,14 +458,14 @@ unsigned int Skidding::getSkidBonus(float *bonus_time,
*bonus_time = 0;
*bonus_speed = 0;
*bonus_force = 0;
for (unsigned int i = 0; i < m_kart->getCharacteristic()->getSkidBonusSpeed().size(); i++)
for (unsigned int i = 0; i < m_kart->getKartProperties()->getSkidBonusSpeed().size(); i++)
{
if (m_skid_time <= m_kart->getCharacteristic()->getSkidTimeTillBonus()[i])
if (m_skid_time <= m_kart->getKartProperties()->getSkidTimeTillBonus()[i])
return i;
*bonus_speed = m_kart->getCharacteristic()->getSkidBonusSpeed()[i];
*bonus_time = m_kart->getCharacteristic()->getSkidBonusTime()[i];
*bonus_force = m_kart->getCharacteristic()->getSkidBonusForce()[i];
*bonus_speed = m_kart->getKartProperties()->getSkidBonusSpeed()[i];
*bonus_time = m_kart->getKartProperties()->getSkidBonusTime()[i];
*bonus_force = m_kart->getKartProperties()->getSkidBonusForce()[i];
}
return (unsigned int) m_kart->getCharacteristic()->getSkidBonusSpeed().size();
return (unsigned int) m_kart->getKartProperties()->getSkidBonusSpeed().size();
} // getSkidBonusForce

View File

@ -21,7 +21,6 @@
#include "audio/sfx_base.hpp"
#include "io/file_manager.hpp"
#include "graphics/irr_driver.hpp"
#include "karts/abstract_characteristic.hpp"
#include "karts/abstract_kart.hpp"
#include "karts/kart.hpp"
#include "karts/kart_model.hpp"

View File

@ -22,7 +22,6 @@
#include "LinearMath/btIDebugDraw.h"
#include "BulletDynamics/ConstraintSolver/btContactConstraint.h"
#include "karts/abstract_characteristic.hpp"
#include "karts/kart.hpp"
#include "modes/world.hpp"
#include "physics/triangle_mesh.hpp"
@ -462,7 +461,7 @@ void btKart::updateVehicle( btScalar step )
av.setZ(0);
m_chassisBody->setAngularVelocity(av);
// Give a nicely balanced feeling for rebalancing the kart
m_chassisBody->applyTorqueImpulse(axis * m_kart->getCharacteristic()->getStabilitySmoothFlyingImpulse());
m_chassisBody->applyTorqueImpulse(axis * m_kart->getKartProperties()->getStabilitySmoothFlyingImpulse());
}
// Work around: make sure that either both wheels on one axis
@ -544,7 +543,7 @@ void btKart::updateVehicle( btScalar step )
// If configured, add a force to keep karts on the track
// -----------------------------------------------------
float dif = m_kart->getCharacteristic()->getStabilityDownwardImpulseFactor();
float dif = m_kart->getKartProperties()->getStabilityDownwardImpulseFactor();
if(dif!=0 && m_num_wheels_on_ground==4)
{
float f = -fabsf(m_kart->getSpeed()) * dif;
@ -656,7 +655,7 @@ void btKart::updateSuspension(btScalar deltaTime)
// is already guaranteed that either both or no wheels on one axis
// are on the ground, so we have to test only one of the wheels
wheel_info.m_wheelsSuspensionForce =
-m_kart->getCharacteristic()->getStabilityTrackConnectionAccel()
-m_kart->getKartProperties()->getStabilityTrackConnectionAccel()
* chassisMass;
continue;
}
@ -667,7 +666,7 @@ void btKart::updateSuspension(btScalar deltaTime)
btScalar susp_length = wheel_info.getSuspensionRestLength();
btScalar current_length = wheel_info.m_raycastInfo.m_suspensionLength;
btScalar length_diff = (susp_length - current_length);
if(m_kart->getCharacteristic()->getSuspensionExpSpringResponse())
if(m_kart->getKartProperties()->getSuspensionExpSpringResponse())
length_diff *= fabsf(length_diff)/susp_length;
float f = (1.0f + fabsf(length_diff) / susp_length);
// Scale the length diff. This results that in uphill sections, when

View File

@ -26,7 +26,6 @@
#include "graphics/irr_driver.hpp"
#include "graphics/stars.hpp"
#include "items/flyable.hpp"
#include "karts/abstract_characteristic.hpp"
#include "karts/kart_properties.hpp"
#include "karts/rescue_animation.hpp"
#include "karts/controller/player_controller.hpp"
@ -219,9 +218,9 @@ void Physics::update(float dt)
}
else if (obj->isFlattenKartObject())
{
const AbstractCharacteristic *ch = kart->getCharacteristic();
kart->setSquash(ch->getSwatterSquashDuration(),
ch->getSwatterSquashSlowdown());
const KartProperties *kp = kart->getKartProperties();
kart->setSquash(kp->getSwatterSquashDuration(),
kp->getSwatterSquashSlowdown());
}
else if(obj->isSoccerBall() &&
race_manager->getMinorMode() == RaceManager::MINOR_MODE_SOCCER)
@ -249,9 +248,9 @@ void Physics::update(float dt)
else if (anim->isFlattenKartObject())
{
AbstractKart *kart = p->getUserPointer(1)->getPointerKart();
const AbstractCharacteristic *ch = kart->getCharacteristic();
kart->setSquash(ch->getSwatterSquashDuration(),
ch->getSwatterSquashSlowdown());
const KartProperties *kp = kart->getKartProperties();
kart->setSquash(kp->getSwatterSquashDuration(),
kp->getSwatterSquashSlowdown());
}
continue;
@ -398,9 +397,9 @@ void Physics::KartKartCollision(AbstractKart *kart_a,
// Add a scaling factor depending on the mass (avoid div by zero).
// The value of f_right is applied to the right kart, and f_left
// to the left kart. f_left = 1 / f_right
float f_right = right_kart->getCharacteristic()->getMass() > 0
? left_kart->getCharacteristic()->getMass()
/ right_kart->getCharacteristic()->getMass()
float f_right = right_kart->getKartProperties()->getMass() > 0
? left_kart->getKartProperties()->getMass()
/ right_kart->getKartProperties()->getMass()
: 1.5f;
// Add a scaling factor depending on speed (avoid div by 0)
f_right *= right_kart->getSpeed() > 0

View File

@ -18,7 +18,6 @@
#include "script_kart.hpp"
#include "karts/abstract_characteristic.hpp"
#include "karts/kart.hpp"
#include "modes/world.hpp"
#include "scriptvec3.hpp"
@ -123,7 +122,7 @@ namespace Scripting
float getMaxSpeed(int idKart)
{
AbstractKart* kart = World::getWorld()->getKart(idKart);
return kart->getCharacteristic()->getEngineMaxSpeed();
return kart->getKartProperties()->getEngineMaxSpeed();
}
/** @}*/

View File

@ -38,7 +38,6 @@ using namespace irr;
#include "items/attachment.hpp"
#include "items/attachment_manager.hpp"
#include "items/powerup_manager.hpp"
#include "karts/abstract_characteristic.hpp"
#include "karts/abstract_kart.hpp"
#include "karts/controller/controller.hpp"
#include "karts/kart_properties.hpp"
@ -413,7 +412,7 @@ void RaceGUI::drawEnergyMeter(int x, int y, const AbstractKart *kart,
int gauge_height = (int)(GAUGEWIDTH*min_ratio);
float state = (float)(kart->getEnergy())
/ kart->getCharacteristic()->getNitroMax();
/ kart->getKartProperties()->getNitroMax();
if (state < 0.0f) state = 0.0f;
else if (state > 1.0f) state = 1.0f;
@ -436,7 +435,7 @@ void RaceGUI::drawEnergyMeter(int x, int y, const AbstractKart *kart,
if (race_manager->getCoinTarget() > 0)
{
float coin_target = (float)race_manager->getCoinTarget()
/ kart->getCharacteristic()->getNitroMax();
/ kart->getKartProperties()->getNitroMax();
video::S3DVertex vertices[5];
unsigned int count=2;

View File

@ -36,7 +36,6 @@
#include "items/attachment.hpp"
#include "items/attachment_manager.hpp"
#include "items/powerup_manager.hpp"
#include "karts/abstract_characteristic.hpp"
#include "karts/abstract_kart.hpp"
#include "karts/controller/controller.hpp"
#include "karts/kart_properties.hpp"
@ -559,7 +558,7 @@ void RaceGUIOverworld::drawEnergyMeter(int x, int y, const AbstractKart *kart,
const core::vector2df &scaling)
{
float state = (float)(kart->getEnergy())
/ kart->getCharacteristic()->getNitroMax();
/ kart->getKartProperties()->getNitroMax();
if (state < 0.0f) state = 0.0f;
else if (state > 1.0f) state = 1.0f;
@ -580,7 +579,7 @@ void RaceGUIOverworld::drawEnergyMeter(int x, int y, const AbstractKart *kart,
if (race_manager->getCoinTarget() > 0)
{
float coin_target = (float)race_manager->getCoinTarget()
/ kart->getCharacteristic()->getNitroMax();
/ kart->getKartProperties()->getNitroMax();
const int EMPTY_TOP_PIXELS = 4;
const int EMPTY_BOTTOM_PIXELS = 3;

View File

@ -44,7 +44,6 @@
#include "io/xml_node.hpp"
#include "items/item.hpp"
#include "items/item_manager.hpp"
#include "karts/abstract_characteristic.hpp"
#include "karts/abstract_kart.hpp"
#include "karts/kart_properties.hpp"
#include "modes/linear_world.hpp"
@ -2343,7 +2342,7 @@ bool Track::findGround(AbstractKart *kart)
// length of the suspension with the weight of the kart resting on
// it). On the other hand this initial bouncing looks nice imho
// - so I'll leave it in for now.
float offset = kart->getCharacteristic()->getSuspensionRest();
float offset = kart->getKartProperties()->getSuspensionRest();
t.setOrigin(hit_point+Vec3(0, offset, 0) );
kart->getBody()->setCenterOfMassTransform(t);
kart->setTrans(t);

View File

@ -25,8 +25,8 @@
#include "graphics/shaders.hpp"
#include "items/powerup_manager.hpp"
#include "items/attachment.hpp"
#include "karts/abstract_characteristic.hpp"
#include "karts/abstract_kart.hpp"
#include "karts/kart_properties.hpp"
#include "karts/controller/controller.hpp"
#include "modes/world.hpp"
#include "physics/irr_debug_drawer.hpp"
@ -137,14 +137,14 @@ void addAttachment(Attachment::AttachmentType type)
if (type == Attachment::ATTACH_ANVIL)
{
kart->getAttachment()
->set(type, kart->getCharacteristic()->getAnvilDuration());
kart->adjustSpeed(kart->getCharacteristic()->getAnvilSpeedFactor());
->set(type, kart->getKartProperties()->getAnvilDuration());
kart->adjustSpeed(kart->getKartProperties()->getAnvilSpeedFactor());
kart->updateWeight();
}
else if (type == Attachment::ATTACH_PARACHUTE)
{
kart->getAttachment()
->set(type, kart->getCharacteristic()->getParachuteDuration());
->set(type, kart->getKartProperties()->getParachuteDuration());
}
else if (type == Attachment::ATTACH_BOMB)
{