19#ifndef HEADER_ABSTRACT_KART_HPP
20#define HEADER_ABSTRACT_KART_HPP
24#include "items/powerup_manager.hpp"
25#include "karts/moveable.hpp"
26#include "karts/controller/kart_control.hpp"
27#include "race/race_manager.hpp"
33 class IDummyTransformationSceneNode;
49namespace GE {
class GERenderInfo; }
82 void loadKartProperties(
const std::string& new_ident,
84 std::shared_ptr<GE::GERenderInfo> ri,
87 btTransform m_starting_transform;
116 int position,
const btTransform& init_transform,
118 std::shared_ptr<GE::GERenderInfo> ri);
124 virtual void reset();
146 virtual void changeKart(
const std::string& new_ident,
148 std::shared_ptr<GE::GERenderInfo> ri,
162 virtual const std::string&
getIdent()
const;
275 virtual void finishedRace(
float time,
bool from_server=
false) = 0;
335 float engine_force,
int duration,
336 int fade_out_time) = 0;
351 float speed_boost,
float engine_force,
352 int duration,
int fade_out_time) = 0;
359 virtual void setSlowdown(
unsigned int category,
float max_speed_fraction,
360 int fade_in_time) = 0;
408 bool play_sound=
false) = 0;
413 virtual void setEnergy(
float val) = 0;
442 virtual void setPowerup (PowerupManager::PowerupType t,
int n) = 0;
447 virtual btQuaternion getVisualRotation()
const = 0;
468 virtual void setInvulnerableTicks(
int ticks) = 0;
473 virtual void setShieldTime(
float t) = 0;
475 virtual float getShieldTime()
const = 0;
532 virtual void playSound(
SFXBuffer* buffer) = 0;
534 virtual bool isVisible()
const = 0;
538 virtual void setStartupBoost(
float val) = 0;
540 virtual float getStartupBoost()
const = 0;
542 virtual float getStartupBoostFromStartTicks(
int ticks)
const = 0;
544 virtual Stars* getStarsEffect()
const = 0;
546 int getLiveJoinUntilTicks()
const {
return m_live_join_util; }
548 void setLiveJoinKart(
int util_ticks) { m_live_join_util = util_ticks; }
The base class for all kart animation, like rescue, explosion, or cannon.
Definition: abstract_kart_animation.hpp:60
An abstract interface for the actual karts.
Definition: abstract_kart.hpp:62
virtual int getNetworkConfirmedFinishTicks() const =0
Return the confirmed finish ticks (sent by the server) indicating that this kart has really finished ...
virtual int getPosition() const =0
Returns the current position of this kart in the race.
virtual bool getRaceResult() const =0
Returns whether this kart wins or loses.
const core::stringw & getName() const
Returns a name to be displayed for this kart.
Definition: abstract_kart.hpp:122
virtual const Vec3 & getPreviousXYZ() const =0
Returns the position 0.25s before.
virtual const Skidding * getSkidding() const =0
Returns the skidding object for this kart (which can be used to query skidding related values).
virtual KartGFX * getKartGFX()=0
Returns a points to this kart's graphical effects.
virtual const float getRecentPreviousXYZTime() const =0
Returns the time at which the recent previous position occured.
virtual Controller * getController()=0
Returns the controller of this kart.
float m_kart_height
Height of the kart, copy of the data from KartModel.
Definition: abstract_kart.hpp:69
virtual void changeKart(const std::string &new_ident, HandicapLevel handicap, std::shared_ptr< GE::GERenderInfo > ri, const KartData &kart_data=KartData())
Change to new kart instancely (used in network live join).
Definition: abstract_kart.cpp:182
virtual void adjustSpeed(float f)=0
Multiplies the velocity of the kart by a factor f (both linear and angular).
virtual void kartIsInRestNow()
Called after the kart comes to rest.
Definition: abstract_kart.cpp:252
float m_kart_highest_point
Coordinate on up axis.
Definition: abstract_kart.hpp:71
float getKartLength() const
Returns the length of the kart.
Definition: abstract_kart.hpp:193
virtual float getFinishTime() const =0
Returns the finished time for a kart.
virtual void decreaseShieldTime()=0
Decreases the kart's shield time.
virtual bool playCustomSFX(unsigned int type)=0
This function will play a particular character voice for this kart.
virtual const Vec3 & getNormal() const =0
Returns the normal of the terrain the kart is over atm.
virtual float getSteerPercent() const
Returns the current steering value for this kart.
Definition: abstract_kart.hpp:130
const KartProperties * getKartProperties() const
Returns the kart properties of this kart.
Definition: abstract_kart.hpp:142
virtual const Material * getMaterial() const =0
Returns the current material the kart is on.
virtual bool isJumping() const =0
Returns whether this kart is jumping.
Attachment * getAttachment()
Returns the current attachment, non-const version.
Definition: abstract_kart.hpp:184
virtual void instantSpeedIncrease(unsigned int category, float add_max_speed, float speed_boost, float engine_force, int duration, int fade_out_time)=0
This adjusts the top speed using increaseMaxSpeed, but additionally causes an instant speed boost,...
virtual void showZipperFire()=0
Show fire to go with a zipper.
core::stringw m_name
Name of the kart with translation.
Definition: abstract_kart.hpp:79
virtual const Powerup * getPowerup() const =0
Returns the current powerup.
virtual Powerup * getPowerup()=0
Returns the current powerup.
virtual PowerupManager::PowerupType getLastUsedPowerup()=0
Returns the last used powerup type.
virtual bool isEliminated() const =0
Returns true if the kart is eliminated.
virtual void setBoostAI(bool boosted)=0
Sets the kart AI boost state.
virtual void blockViewWithPlunger()=0
Sets that the view is blocked by a plunger.
bool isWheeless() const
Returns true if this kart has no wheels.
Definition: abstract_kart.cpp:202
std::unique_ptr< KartModel > m_kart_model
This stores a copy of the kart model.
Definition: abstract_kart.hpp:100
virtual void eliminate()=0
Marks this kart to be eliminated.
virtual float getEnergy() const =0
Returns the remaining collected energy.
KartModel * getKartModel() const
Returns this kart's kart model.
Definition: abstract_kart.hpp:190
virtual int getSpeedIncreaseTicksLeft(unsigned int category) const =0
Returns how much increased speed time is left over in the given category.
virtual void setKartAnimation(AbstractKartAnimation *ka)
Sets a new kart animation.
Definition: abstract_kart.cpp:214
virtual float getTimeFullSteer(float steer) const =0
Returns the time till full steering is reached for this kart.
virtual void makeKartRest()
Called before go phase to make sure all karts start at the same position in case there is a slope.
Definition: abstract_kart.cpp:263
virtual float getSpeed() const =0
Returns the speed of the kart in meters/second.
float getKartWidth() const
Returns the width of the kart.
Definition: abstract_kart.hpp:199
virtual int getNumPowerup() const =0
Returns the number of powerups.
HandicapLevel m_handicap
The handicap level of this kart.
Definition: abstract_kart.hpp:95
const KartControl & getControls() const
Returns all controls of this kart - const version.
Definition: abstract_kart.hpp:136
virtual SlipStream * getSlipstream()=0
Returns the slipstream object of this kart.
unsigned int m_world_kart_id
Index of kart in world.
Definition: abstract_kart.hpp:76
const Vec3 * m_wheel_graphics_position
The position of all four wheels in the 3d model.
Definition: abstract_kart.hpp:73
std::unique_ptr< KartProperties > m_kart_properties
The kart properties.
Definition: abstract_kart.hpp:92
virtual float getSpeedForTurnRadius(float radius) const =0
Returns the (maximum) speed for a given turn radius.
virtual float getTimeForDistance(float distance)
Returns the time at which the kart was at a given distance.
Definition: abstract_kart.cpp:244
virtual void setSlipstreamEffect(float f)=0
Activates a slipstream effect, atm that is display some nitro.
virtual bool getBoostAI() const =0
Returns the kart AI boost state.
virtual int getBlockedByPlungerTicks() const =0
Returns true if the kart has a plunger attached to its face.
virtual void startEngineSFX()=0
Starts the engine sound effect.
virtual const std::string & getIdent() const
Returns a unique identifier for this kart (name of the directory the kart was loaded from).
Definition: abstract_kart.cpp:197
virtual void beep()=0
Plays a beep sfx.
virtual void crashed(AbstractKart *k, bool update_attachments)=0
Called when the kart crashes against another kart.
virtual int getInitialPosition() const =0
Returns the initial position of this kart.
virtual const Controller * getController() const =0
Returns the controller of this kart (const version).
virtual void setSlowdown(unsigned int category, float max_speed_fraction, int fade_in_time)=0
Defines a slowdown, which is in fraction of top speed.
virtual float getCurrentMaxSpeed() const =0
Returns the current maximum speed for this kart, this includes all bonus and maluses that are current...
virtual void setPosition(int p)=0
Returns the current position of this kart in the race.
virtual float getHoT() const =0
Returns the height of the terrain.
const Attachment * getAttachment() const
Returns the current attachment.
Definition: abstract_kart.hpp:181
float m_kart_length
Length of the kart, copy of the data from KartModel.
Definition: abstract_kart.hpp:65
virtual bool setSquash(float time, float slowdown)=0
Squashes this kart: it will scale the kart in up direction, and causes a slowdown while this kart is ...
virtual bool isInRest() const =0
Returns true if the kart is 'resting', i.e.
virtual void setOnScreenText(const core::stringw &text)=0
Set a text that is displayed on top of a kart.
const HandicapLevel getHandicap() const
Returns the handicap of this kart.
Definition: abstract_kart.hpp:154
virtual void unsetSquash()=0
Makes the kart unsquashed again.
virtual const SlipStream * getSlipstream() const =0
Returns the slipstream object of this kart.
virtual float getMaxSteerAngle() const =0
Returns the maximum steering angle for this kart, which depends on the speed.
float m_kart_width
Width of the kart, copy of the data from KartModel.
Definition: abstract_kart.hpp:67
virtual void showStarEffect(float t)=0
Shows the star effect for a certain time.
virtual void handleZipper(const Material *m=NULL, bool play_sound=false)=0
Sets zipper time, and apply one time additional speed boost.
AbstractKartAnimation * m_kart_animation
A kart animation object to handle rescue, explosion etc.
Definition: abstract_kart.hpp:109
virtual void setSpeed(float s)=0
This is used on the client side only to set the speed of the kart from the server information.
virtual bool isOnGround() const =0
True if the wheels are touching the ground.
virtual const Material * getLastMaterial() const =0
Returns the previous material the kart was one (which might be the same as getMaterial() ).
virtual const Vec3 & getFrontXYZ() const =0
Returns the coordinates of the front of the kart.
virtual btTransform getAlignedTransform(const float customPitch=-1)=0
Returns a bullet transform object located at the kart's position and oriented in the direction the ka...
virtual bool isOnMinNitroTime() const =0
Return whether nitro is being used despite the nitro button not being pressed due to minimal use time...
float getKartHeight() const
Returns the height of the kart.
Definition: abstract_kart.hpp:196
float getHighestPoint() const
Returns the highest point of the kart (coordinate on up axis)
Definition: abstract_kart.hpp:202
virtual float getTerrainPitch(float heading) const =0
Returns the pitch of the terrain depending on the heading.
virtual bool isSquashed() const =0
Returns if the kart is currently being squashed.
const Vec3 & getWheelGraphicsPosition(int i) const
Returns the position of a wheel relative to the kart.
Definition: abstract_kart.hpp:225
virtual void increaseMaxSpeed(unsigned int category, float add_speed, float engine_force, int duration, int fade_out_time)=0
Sets an increased maximum speed for a category.
virtual btKart * getVehicle() const =0
Returns the bullet vehicle which represents this kart.
virtual Skidding * getSkidding()=0
Returns the skidding object for this kart (which can be used to query skidding related values),...
virtual const TerrainInfo * getTerrainInfo() const =0
Returns the terrain info oject.
virtual bool isGhostKart() const =0
Returns whether this kart is a ghost (replay) kart.
virtual const Vec3 & getRecentPreviousXYZ() const =0
Returns the most recent different previous position.
virtual bool isInvulnerable() const =0
Returns if the kart is invulnerable.
KartControl m_controls
The kart controls (e.g.
Definition: abstract_kart.hpp:106
virtual void setController(Controller *controller)=0
Saves the old controller in m_saved_controller and stores a new controller.
KartControl & getControls()
Returns all controls of this kart.
Definition: abstract_kart.hpp:133
irr::scene::IDummyTransformationSceneNode * m_wheel_box
Node between wheels and kart.
Definition: abstract_kart.hpp:112
std::unique_ptr< Attachment > m_attachment
Handles the attachment the kart might have.
Definition: abstract_kart.hpp:103
virtual void reset()
The reset position must be set before calling reset.
Definition: abstract_kart.cpp:70
virtual bool isShielded() const =0
Returns if the kart is protected by a shield.
void setHandicap(const HandicapLevel h)
Sets the handicap.
Definition: abstract_kart.hpp:157
virtual bool hasFinishedRace() const =0
Returns true if this kart has finished the race.
AbstractKartAnimation * getKartAnimation()
Returns a kart animation (if any), or NULL if currently no kart animation is being shown.
Definition: abstract_kart.hpp:233
virtual void collectedItem(ItemState *item_state)=0
Called when an item is collected.
unsigned int getWorldKartId() const
Returns the index of this kart in world.
Definition: abstract_kart.hpp:245
This objects is permanently available in a kart and stores information about addons.
Definition: attachment.hpp:52
This is the base class for kart controller - that can be a player or a a robot.
Definition: controller.hpp:46
Contains the state information of an item, i.e.
Definition: item.hpp:53
Definition: kart_control.hpp:30
float getSteer() const
Returns the current steering value in [-1, 1].
Definition: kart_control.hpp:128
Definition: kart_data.hpp:12
Definition: kart_gfx.hpp:40
This class stores a 3D kart model.
Definition: kart_model.hpp:168
This class stores the properties of a kart.
Definition: kart_properties.hpp:60
Definition: material.hpp:48
Definition: moveable.hpp:46
Definition: powerup.hpp:38
KartType
Different kart types: A local player, a player connected via network, an AI kart, the leader kart (cu...
Definition: race_manager.hpp:242
The buffer (data) for one kind of sound effects.
Definition: sfx_buffer.hpp:44
Definition: skidding.hpp:40
Definition: slip_stream.hpp:48
This class is used to display rotating stars around a kart's head.
Definition: stars.hpp:41
This class stores information about the triangle that's under an object, i.e.: the normal,...
Definition: terrain_info.hpp:32
A wrapper around bullets btVector3 to include conventient conversion functions (e....
Definition: vec3.hpp:35
rayCast vehicle, very special constraint that turn a rigidbody into a vehicle.
Definition: btKart.hpp:32
HandicapLevel
Handicap per player.
Definition: remote_kart_info.hpp:42