Start with getters

This commit is contained in:
Flakebi 2015-04-10 22:58:04 +02:00
parent 5dec3c4602
commit 483993d2d8
3 changed files with 301 additions and 197 deletions

View File

@ -7,7 +7,9 @@
rest: Length of suspension when at rest.
travel-cm: maximum movement of suspension - in cm!!
exp-string-response: dampen the suspension spring reaction
exponentially.
exponentially. See
http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?f=9&t=7369\&p=25236&hilit=vehicle#p25236
for details.
max-force: Maximum suspension force -->
<suspension stiffness="140" rest="0.3" travel-cm="29"
exp-spring-response="false" max-force="12000" />
@ -163,7 +165,69 @@
<lean max="8.6" speed="5.0" />
<!-- ********** Gameplay ********** -->
<!-- ********** Items ********** -->
<!-- Anvil
weight: The additional weight an anvil adds to a kart.
speed-factor: The additional slowdown caused by the anvil.
duration: The time an anvil is active. -->
<anvil duration="2.0" weight="150" speed-factor="0.2" />
<!-- Parachute
friction: The friction increase when a parachute is attached.
duration: The time an attached parachute is active
duration-other: The time a parachute attached from other kart works
lbound-fraction: The lower bound fraction of speed when lost will
detach parachute. E.g. at nearly 0 speed, only 5% of speed
need to be lost.
ubound-fraction: The upper bound fraction of speed when lost will
detach parachute. E.g. at max-speed 30% of speed must be lost.
max-speed: A factor that decides the impact of rate of speed
(distance between bounds) -->
<parachute friction="2.0" duration="4.0" duration-other="8.0"
lbound-fraction="0.95" ubound-fraction="0.7" max-speed="23" />
<!-- Bubblegum
duration: How long the bubblegum lasts.
speed-fraction: To what fraction of top-speed the speed is reduced.
torque: To rotate the kart somewhat.
fade-in-time: How quick the slowdown takes effect.
shield-duration: How long the bubblegum shield lasts -->
<bubblegum duration="1" speed-fraction="0.3" torque="500" fade-in-time="0.01"
shield-duration="10.0" />
<!-- Zipper
duration: Time a zipper is active.
force: Additional zipper force.
speed-gain: One time additional speed.
max-speed-increase: Additional speed allowed on top of the
kart-specific maximum kart speed.
fade-out-time: determines how long it takes for a zipper
to fade out (after 'time'). -->
<zipper duration="3.5" force="250.0" speed-gain="4.5" max-speed-increase="15"
fade-out-time="1.0" />
<!-- Swatter
duration: how long can the swatter be active.
distance: How close a kart or an item must be before it can be hit.
squash-duration: How long a kart will remain squashed.
squash-slowdown: percentage of max speed that a kart is
restricted to. -->
<swatter duration="10" distance="3" squash-duration="5"
squash-slowdown="0.5" />
<!-- Plunger and rubber band handling
max-length: Te maximum length of rubber band before it snaps.
force: The force a plunger/rubber band applies to the kart(s).
duration: The duration a rubber band acts.
in-face-time determines how long it takes before a plunger
in your face is removed. -->
<plunger band-max-length="50" band-force="1500" band-duration="1"
band-speed-increase="7" band-fade-out-time="3"
in-face-time="3 4 4.5 4.5" />
<!-- ********** Miscellaneous ********** -->
<!-- Startup
If a kart starts within the specified time after 'go',
@ -174,23 +238,23 @@
boost="6 3" />
<!-- Rescue
time: How long it takes the kart to be raised.
duration: How long it takes the kart to be raised.
height: how height the kart will be raised before it is
dropped back onto the track.
vert rescue offset: used to raise karts a bit higher before
releasing them on the ground after a rescue. Used to avoid
resetting karts into the track. Not sure if this is still
necessary. -->
<rescue vert-offset="0.0" time="1.2" height="2" />
<rescue vert-offset="0.0" duration="1.2" height="2" />
<!-- Explosion
time: how long it takes before the kart can drive again (this
duration: how long it takes before the kart can drive again (this
determines how height the kart is being thrown).
invulnerability-time: how long a kart will be invulnerable
after being hit by an explosion.
radius: Kart closer to this value will be affected by
an explosion as well. -->
<explosion time="2" radius="5"
<explosion duration="2" radius="5"
invulnerability-time="6" />
<!-- Nitro
@ -225,66 +289,4 @@
<slipstream length="10" width="2" collect-time="2" use-time="5"
add-power="3" min-speed="10" max-speed-increase="5"
duration="1" fade-out-time="2" />
<!-- ********** Items ********** -->
<!-- Anvil
weight: The additional weight an anvil adds to a kart.
speed-factor: The additional slowdown caused by the anvil.
time: The time an anvil is active. -->
<anvil time="2.0" weight="150" speed-factor="0.2" />
<!-- Parachute
friction: The friction increase when a parachute is attached.
time: The time an attached parachute is active
time-other: The time a parachute attached from other kart works
lbound-fraction: The lower bound fraction of speed when lost will
detach parachute. E.g. at nearly 0 speed, only 5% of speed
need to be lost.
ubound-fraction: The upper bound fraction of speed when lost will
detach parachute. E.g. at max-speed 30% of speed must be lost.
max-speed: A factor that decides the impact of rate of speed
(distance between bounds) -->
<parachute friction="2.0" time="4.0" time-other="8.0"
lbound-fraction="0.95" ubound-fraction="0.7" max-speed="23" />
<!-- Bubblegum
time: How long the bubblegum lasts.
speed-fraction: To what fraction of top-speed the speed is reduced.
torque: To rotate the kart somewhat.
fade-in-time: How quick the slowdown takes effect.
shield-time: How long the bubblegum shield lasts -->
<bubblegum time="1" speed-fraction="0.3" torque="500" fade-in-time="0.01"
shield-time="10.0" />
<!-- Zipper
time: Time a zipper is active.
force: Additional zipper force.
speed-gain: One time additional speed.
max-speed-increase: Additional speed allowed on top of the
kart-specific maximum kart speed.
fade-out-time: determines how long it takes for a zipper
to fade out (after 'time'). -->
<zipper time="3.5" force="250.0" speed-gain="4.5" max-speed-increase="15"
fade-out-time="1.0" />
<!-- Swatter
duration: how long can the swatter be active.
distance: How close a kart or an item must be before it can be hit.
squash-duration: How long a kart will remain squashed.
squash-slowdown: percentage of max speed that a kart is
restricted to. -->
<swatter duration="10" distance="3" squash-duration="5"
squash-slowdown="0.5" />
<!-- Plunger and rubber band handling
max-length: Te maximum length of rubber band before it snaps.
force: The force a plunger/rubber band applies to the kart(s).
duration: The duration a rubber band acts.
in-face-time determines how long it takes before a plunger
in your face is removed. -->
<plunger band-max-length="50" band-force="1500" band-duration="1"
band-speed-increase="7" band-fade-out-time="3"
in-face-time="3 4 4.5 4.5" />
</kart-properties>

View File

@ -17,3 +17,8 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "karts/abstract_characteristics.hpp"
AbstractCharacteristics::AbstractCharacteristics()
{
// Set default value
}

View File

@ -24,6 +24,8 @@
#include <vector>
class SkiddingProperties;
/**
* Characteristics are the properties of a kart that influence
* gameplay mechanics.
@ -39,165 +41,260 @@
class AbstractCharacteristics
{
private:
/* ---------- Physics ---------- */
/* ---------- Physics ---------- */
// Suspension
float m_suspension_stiffness;
float m_suspension_rest;
float m_suspension_travel_cm;
float m_suspension_exp_spring_response;
float m_suspension_max_force;
// Suspension
float m_suspension_stiffness;
float m_suspension_rest;
float m_suspension_travel_cm;
float m_suspension_exp_spring_response;
float m_suspension_max_force;
// Stability
float m_stability_roll_influence;
float m_stability_chassis_linear_damping;
float m_stability_chassis_angular_damping;
float m_stability_downward_impulse_factor;
float m_stability_track_connection_accel;
float m_stability_smooth_flying_impulse;
// Stability
float m_stability_roll_influence;
float m_stability_chassis_linear_damping;
float m_stability_chassis_angular_damping;
float m_stability_downward_impulse_factor;
float m_stability_track_connection_accel;
float m_stability_smooth_flying_impulse;
// Turn
std::vector<float> m_turn_radius;
InterpolationArray m_turn_time_full_steer;
float m_turn_time_reset_steer;
// Turn
InterpolationArray m_turn_radius;
InterpolationArray m_turn_time_full_steer;
float m_turn_time_reset_steer;
// Engine
std::vector<float> m_engine_power;
std::vector<float> m_engine_max_speed;
float m_brake_factor;
float m_break_time_increase;
float m_max_speed_reverse_ratio;
// Engine
float m_engine_power;
float m_engine_max_speed;
float m_brake_factor;
float m_brake_time_increase;
float m_max_speed_reverse_ratio;
// Gear
std::vector<float> m_gear_switch_ratio;
std::vector<float> m_gear_power_increase;
// Gear
std::vector<float> m_gear_switch_ratio;
std::vector<float> m_gear_power_increase;
// Mass
float m_mass;
// Mass
float m_mass;
// Wheels
float m_damping_relaxation;
float m_damping_compression;
float m_wheel_radius;
Vec3 m_wheel_position[4];
// Wheels
float m_damping_relaxation;
float m_damping_compression;
float m_wheel_radius;
std::vector<Vec3> m_wheel_position;
/* ---------- Visuals ---------- */
/* ---------- Visuals ---------- */
// Skid
float m_skid_increase;
float m_skid_decrease;
float m_skid_max;
float m_skid_time_till_max;
float m_skid_visual;
float m_skid_visual_time;
float m_skid_revert_visual_time;
float m_skid_min_speed;
std::vector<float> m_skid_time_till_bonus;
std::vector<float> m_skid_bonus_speed;
std::vector<float> m_skid_bonus_time;
std::vector<float> m_skid_bonus_force;
float m_skid_physical_jump_time;
float m_skid_graphical_jump_time;
float m_skid_post_skid_rotate_factor;
float m_skid_reduce_turn_min;
float m_skid_reduce_turn_max;
// Skid
SkiddingProperties *m_skidding;
// Camera
float m_camera_distance;
float m_camera_forward_up_angle;
float m_camera_backward_up_angle;
// Camera
float m_camera_distance;
float m_camera_forward_up_angle;
float m_camera_backward_up_angle;
// Jump
float m_jump_animation_time;
// Jump
float m_jump_animation_time;
// Lean
float m_lean_max;
float m_lean_speed;
// Lean
float m_lean_max;
float m_lean_speed;
/* ---------- Items ---------- */
/* ---------- Items ---------- */
// Anvil
float m_anvil_time;
float m_anvil_weight;
float m_anvil_speed_factor;
// Anvil
float m_anvil_duration;
float m_anvil_weight;
float m_anvil_speed_factor;
// Parachute
float m_parachute_friction;
float m_parachute_time;
float m_parachute_time_other;
float m_parachute_lbound_fraction;
float m_parachute_ubound_fraction;
float m_parachute_max_speed;
// Parachute
float m_parachute_friction;
float m_parachute_duration;
float m_parachute_duration_other;
float m_parachute_lbound_fraction;
float m_parachute_ubound_fraction;
float m_parachute_max_speed;
// Bubblegum
float m_bubblegum_time;
float m_bubblegum_speed_fraction;
float m_bubblegum_torque;
float m_bubblegum_fade_in_time;
float m_bubblegum_shield_time;
// Bubblegum
float m_bubblegum_duration;
float m_bubblegum_speed_fraction;
float m_bubblegum_torque;
float m_bubblegum_fade_in_time;
float m_bubblegum_shield_duration;
// Zipper
float m_zipper_time;
float m_zipper_force;
float m_zipper_speed_gain;
float m_zipper_max_speed_increase;
float m_zipper_fade_out_time;
// Zipper
float m_zipper_duration;
float m_zipper_force;
float m_zipper_speed_gain;
float m_zipper_max_speed_increase;
float m_zipper_fade_out_time;
// Swatter
float m_swatter_duration;
float m_swatter_distance;
float m_swatter_squash_duration;
float m_swatter_squash_slowdown;
// Swatter
float m_swatter_duration;
float m_swatter_distance;
float m_swatter_squash_duration;
float m_swatter_squash_slowdown;
// Plunger
float m_plunger_band_max_length;
float m_plunger_band_force;
float m_plunger_band_duration;
float m_plunger_band_speed_increase;
float m_plunger_band_fade_out_time;
std::vector<float> m_plunger_in_face_time;
// Plunger
float m_plunger_band_max_length;
float m_plunger_band_force;
float m_plunger_band_duration;
float m_plunger_band_speed_increase;
float m_plunger_band_fade_out_time;
float m_plunger_in_face_time;
/* ---------- Miscellaneous ---------- */
/* ---------- Miscellaneous ---------- */
// Startup
std::vector<float> m_startup_time;
std::vector<float> m_startup_boost;
// Startup
std::vector<float> m_startup_time;
std::vector<float> m_startup_boost;
// Rescue
float m_rescue_vert_offset;
float m_rescue_time;
float m_rescue_height;
// Rescue
float m_rescue_vert_offset;
float m_rescue_duration;
float m_rescue_height;
// Explosion
float m_explosion_time;
float m_explosion_radius;
float m_explosion_invulnerability_time;
// Explosion
float m_explosion_duration;
float m_explosion_radius;
float m_explosion_invulnerability_time;
// Nitro
float m_nitro_engine_force;
float m_nitro_consumption;
float m_nitro_small_container;
float m_nitro_big_container;
float m_nitro_max_speed_increase;
float m_nitro_duration;
float m_nitro_fade_out_time;
float m_nitro_max;
// Nitro
float m_nitro_engine_force;
float m_nitro_consumption;
float m_nitro_small_container;
float m_nitro_big_container;
float m_nitro_max_speed_increase;
float m_nitro_duration;
float m_nitro_fade_out_time;
float m_nitro_max;
// Slipstream
float m_slipstream_length;
float m_slipstream_width;
float m_slipstream_collect_time;
float m_slipstream_use_time;
float m_slipstream_add_power;
float m_slipstream_min_speed;
float m_slipstream_max_speed_increase;
float m_slipstream_duration;
float m_slipstream_fade_out_time;
// Slipstream
float m_slipstream_length;
float m_slipstream_width;
float m_slipstream_collect_time;
float m_slipstream_use_time;
float m_slipstream_add_power;
float m_slipstream_min_speed;
float m_slipstream_max_speed_increase;
float m_slipstream_duration;
float m_slipstream_fade_out_time;
public:
AbstractCharacteristics();
float getSuspensionStiffness() const { return m_suspension_stiffness; }
float getSuspensionRest() const { return m_suspension_rest; }
float getSuspensionTravelCM() const { return m_suspension_travel_cm; }
float getSuspensionExpSpringResponse() const { return m_suspension_exp_spring_response; }
float getSuspensionMaxForce() const { return m_suspension_max_force; }
float getStabilityRollInfluence() const { return m_stability_roll_influence; }
float getStabilityChassisLinearDamping() const { return m_stability_chassis_linear_damping; }
float getStabilityChassisAngularDamping() const { return m_stability_chassis_angular_damping; }
float getStabilityDownwardImpulseFactor() const { return m_stability_downward_impulse_factor; }
float getStabilityTrackConnectionAccel() const { return m_stability_track_connection_accel; }
float getStabilitySmoothFlyingImpulse() const { return m_stability_smooth_flying_impulse; }
float getTurnRadius(float steer) const { return m_turn_radius.get(steer); }
float getTurnTimeFullSteer(float steer) const { return m_turn_time_full_steer.get(steer); }
float getTurnTimeResetSteer() const { return m_turn_time_reset_steer; }
float getEnginePower() const { return m_engine_power; }
float getEngineMaxSpeed() const { return m_engine_max_speed; }
float getBreakFactor() const { return m_brake_factor; }
float getBrakeTimeIncrease() const { return m_brake_time_increase; }
float getMaxSpeedReverseRatio() const;
float getGearSwitchRatio(int gear) const;
float getGearPowerIncrease(int gear) const;
float getMass() const;
float getDampingRelaxation() const;
float getDampingCompression() const;
float getWheelRadius() const;
Vec3 getWheelPosition(int wheel) const;
SkiddingProperties* getSkiddingProperties() const;
float getCameraDistance() const;
float getCameraForwardUpAngle() const;
float getCameraBackwardUpAngle() const;
float getJumpAnimationTime() const;
float getLeanMax() const;
float getLeanSpeed() const;
float getAnvilDuration() const;
float getAnvilWeight() const;
float getAnvilSpeedFactor() const;
float getParachuteFriction() const;
float getParachuteDuration() const;
float getParachuteDurationOther() const;
float getParachuteLBoundFraction() const;
float getParachuteUBoundFranction() const;
float getParachuteMaxSpeed() const;
float getBubblegumDuration() const;
float getBubblegumSpeedFraction() const;
float getBubblegumTorque() const;
float getBubblegumFadeInTime() const;
float getBubblegumShieldDuration() const;
float getZipperDuration() const;
float getZipperForce() const;
float getZipperSpeedGain() const;
float getZipperMaxSpeedIncrease() const;
float getZipperFadeOutTime() const;
float getSwatterDuration() const;
float getSwatterDistance() const;
float getSwatterSquashDuration() const;
float getSwatterSquashSlowdown() const;
float getPlungerBandMaxLength() const;
float getPlungerBandForce() const;
float getPlungerBandDuration() const;
float getPlungerBandSpeedIncrease() const;
float getPlungerBandFadeOutTime() const;
float getPlungerInFaceTime() const;
float getStartupBoost(float time) const;
float getRescueVertOffset() const;
float getRescueDuration() const;
float getRescueHeight() const;
float getExplosionDuration() const;
float getExplosionRadius() const;
float getExplosionInvulnerabilityTime() const;
float getNitroEngineForce() const;
float getNitroConsumption() const;
float getNitroSmallContainer() const;
float getNitroBigContainer() const;
float getNitroMaxSpeedIncrease() const;
float getNitroDuration() const;
float getNitroFadeOutTime() const;
float getNitroMax() const;
float getSlipstreamLength() const;
float getSlipstreamWidth() const;
float getSlipstreamCollectTime() const;
float getSlipstreamUseTime() const;
float getSlipstreamAddPower() const;
float getSlipstreamMinSpeed() const;
float getSlipstreamMaxSpeedIncrease() const;
float getSlipstreamDuration() const;
float getSlipstreamFadeOutTime() const;
protected:
void setSuspensionStiffness(float value);
};
#endif