1 //
2 //  SuperTuxKart - a fun racing game with go-kart
3 //  Copyright (C) 2004-2015 Steve Baker <sjbaker1@airmail.net>
4 //  Copyright (C) 2006-2015 SuperTuxKart-Team, Joerg Henrichs, Steve Baker
5 //
6 //  This program is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU General Public License
8 //  as published by the Free Software Foundation; either version 3
9 //  of the License, or (at your option) any later version.
10 //
11 //  This program is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 //  GNU General Public License for more details.
15 //
16 //  You should have received a copy of the GNU General Public License
17 //  along with this program; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19 
20 #ifndef HEADER_KART_HPP
21 #define HEADER_KART_HPP
22 
23 /**
24   * \defgroup karts
25   * Contains classes that deal with the properties, models and physics
26   * of karts.
27   */
28 
29 #include "LinearMath/btTransform.h"
30 
31 #include "items/powerup_manager.hpp"    // For PowerupType
32 #include "karts/abstract_kart.hpp"
33 #include "utils/cpp2011.hpp"
34 #include "utils/no_copy.hpp"
35 
36 #include <SColor.h>
37 
38 class AbstractKartAnimation;
39 class Attachment;
40 class btKart;
41 class btUprightConstraint;
42 class Controller;
43 class HitEffect;
44 class Item;
45 class ItemState;
46 class KartGFX;
47 class KartRewinder;
48 class MaxSpeed;
49 class ParticleEmitter;
50 class ParticleKind;
51 class SFXBase;
52 class Shadow;
53 class Skidding;
54 class SkidMarks;
55 class SlipStream;
56 class Stars;
57 class TerrainInfo;
58 
59 /** The main kart class. All type of karts are of this object, but with
60  *  different controllers. The controllers are what turn a kart into a
61  *  player kart (i.e. the controller handle input), or an AI kart (the
62  *  controller runs the AI code to set steering etc).
63  *  Kart has two base classes: the most important one is moveable (which
64  *  is an object that is moved on the track, and has position and rotations)
65  *  and TerrainInfo, which manages the terrain the kart is on.
66  * \ingroup karts
67  */
68 class Kart : public AbstractKart
69 {
70     friend class Skidding;
71 private:
72     int m_network_finish_check_ticks;
73     int m_network_confirmed_finish_ticks;
74 protected:
75     /** Offset of the graphical kart chassis from the physical chassis. */
76     float m_graphical_y_offset;
77 
78     /** The coordinates of the front of the kart, used to determine when a
79      *  new lap is triggered. */
80     Vec3 m_xyz_front;
81 
82     /* Determines the time covered by the history size, in seconds */
83     const float XYZ_HISTORY_TIME = 0.25f;
84 
85     /* Determines the number of previous XYZ positions of the kart to remember
86        Initialized in the constructor and unchanged from then on */
87     int m_xyz_history_size;
88 
89     /** The coordinates of the XYZ_HISTORY_SIZE previous positions */
90     std::vector<Vec3> m_previous_xyz;
91 
92     /** The times at which the previous positions occured.
93         Currently used for finish time computation */
94     std::vector<float> m_previous_xyz_times;
95 
96     float m_time_previous_counter;
97 
98     /** Is time flying activated */
99     bool m_is_jumping;
100 
101     /** The sign of torque to apply after hitting a bubble gum. */
102     bool        m_bubblegum_torque_sign;
103 
104     /** A short time after a collision acceleration is disabled to allow
105      *  the karts to bounce back*/
106     uint8_t      m_bounce_back_ticks;
107 
108 protected:
109     /** Handles speed increase and capping due to powerup, terrain, ... */
110     MaxSpeed *m_max_speed;
111 
112     /** Stores information about the terrain the kart is on. */
113     TerrainInfo *m_terrain_info;
114 
115     /** Handles the powerup of a kart. */
116     Powerup *m_powerup;
117 
118     std::unique_ptr<btVehicleRaycaster> m_vehicle_raycaster;
119 
120     std::unique_ptr<btKart> m_vehicle;
121 
122     /** This object handles all skidding. */
123     std::unique_ptr<Skidding> m_skidding;
124 
125     /** For stars rotating around head effect */
126     std::unique_ptr<Stars> m_stars_effect;
127 
128     // Graphical effects
129     // -----------------
130 
131 #ifndef SERVER_ONLY
132     /** The shadow of a kart. */
133     std::unique_ptr<Shadow> m_shadow;
134 
135     /** The skidmarks object for this kart. */
136     std::unique_ptr<SkidMarks> m_skidmarks;
137 #endif
138 
139     /** All particle effects. */
140     std::unique_ptr<KartGFX> m_kart_gfx;
141 
142     /** Handles all slipstreaming. */
143     std::unique_ptr<SlipStream> m_slipstream;
144 
145     // Bullet physics parameters
146     // -------------------------
147     struct btCompoundShapeDeleter
148     {
operator ()Kart::btCompoundShapeDeleter149         void operator()(btCompoundShape* p) const
150         {
151             for(int i = 0; i< p->getNumChildShapes(); i++)
152                 delete p->getChildShape(i);
153             delete p;
154         }
155     };
156     std::unique_ptr<btCompoundShape, btCompoundShapeDeleter> m_kart_chassis;
157 
158     /** For collisions */
159     ParticleEmitter *m_collision_particles;
160 
161     /** The main controller of this object, used for driving. This
162      *  controller is used to run the kart. It will be replaced
163      *  with an end kart controller when the kart finishes the race. */
164     Controller  *m_controller;
165 
166     /** This saves the original controller when the end controller is
167      *  used. This is an easy solution for restarting the race, since
168      *  the controller do not need to be reinitialised. */
169     Controller  *m_saved_controller;
170 
171     /** Remember the last **used** powerup type of a kart for AI purposes. */
172     PowerupManager::PowerupType m_last_used_powerup;
173 
174     /** True if kart is flying (for debug purposes only). */
175     bool m_flying;
176 
177     /** Set when hitting bubblegum */
178     bool m_has_caught_nolok_bubblegum;
179 
180     /** True if the kart wins, false otherwise. */
181     bool m_race_result;
182 
183     /** True if the kart is eliminated. */
184     bool m_eliminated;
185 
186     /** Initial rank of the kart. */
187     int m_initial_position;
188 
189     /** Current race position (1-num_karts). */
190     int m_race_position;
191 
192     /** Maximum engine rpm's for the current gear. */
193     float        m_max_gear_rpm;
194 
195     /** How long the brake key has been pressed - the longer the harder
196      *  the kart will brake. */
197     int          m_brake_ticks;
198 
199     /** Time a kart is invulnerable. */
200     int16_t      m_invulnerable_ticks;
201 
202     /** If > 0 then bubble gum effect is on. This is the sliding when hitting a gum on the floor, not the shield. */
203     int16_t      m_bubblegum_ticks;
204 
205     /** When a kart has its view blocked by the plunger, this variable will be
206      *  > 0 the number it contains is the time left before removing plunger. */
207     int16_t       m_view_blocked_by_plunger;
208 
209     /** Current leaning of the kart. */
210     float        m_current_lean;
211 
212     /** To prevent using nitro in too short bursts */
213     int8_t        m_min_nitro_ticks;
214 
215     /** True if fire button was pushed and not released */
216     bool         m_fire_clicked;
217 
218     /** True if the kart has been selected to have a boosted ai */
219     bool         m_boosted_ai;
220 
221     bool            m_finished_race;
222 
223     float           m_finish_time;
224 
225      /** The amount of energy collected with nitro cans. Note that it
226       *  must be float, since dt is subtraced in each timestep. */
227     float         m_collected_energy;
228 
229     float         m_consumption_per_tick;
230 
231     float         m_energy_to_min_ratio;
232 
233     float           m_startup_boost;
234 
235     float           m_falling_time;
236 
237     float           m_weight;
238 
239     /** The current speed (i.e. length of velocity vector) of this kart. */
240     float         m_speed;
241 
242     /** For smoothing engine sound**/
243     float         m_last_factor_engine_sound;
244 
245     /** For changeKart**/
246     float         m_default_suspension_force;
247 
248     /** Reset position. */
249     btTransform  m_reset_transform;
250 
251     std::vector<SFXBase*> m_custom_sounds;
252     int m_emitter_id = 0;
253     static const int EMITTER_COUNT = 3;
254     SFXBase      *m_emitters[EMITTER_COUNT];
255     SFXBase      *m_engine_sound;
256     /** Sound to be played depending on terrain. */
257     SFXBase      *m_terrain_sound;
258 
259     /** The material for which the last sound effect was played. */
260     const Material *m_last_sound_material;
261 
262     SFXBase      *m_nitro_sound;
263     /** A pointer to the previous terrain sound needs to be saved so that an
264      *  'older' sfx can be finished and an abrupt end of the sfx is avoided. */
265     SFXBase      *m_previous_terrain_sound;
266     SFXBase      *m_skid_sound;
267     SFXBuffer    *m_horn_sound;
268     static const int CRASH_SOUND_COUNT = 3;
269     SFXBuffer    *m_crash_sounds[CRASH_SOUND_COUNT];
270     SFXBuffer    *m_goo_sound;
271     SFXBuffer    *m_boing_sound;
272     /* Used to avoid re-play the sound during rewinding, if it's happening at
273      * the same ticks. */
274     int          m_ticks_last_crash;
275     int          m_ticks_last_zipper;
276     RaceManager::KartType m_type;
277 
278     void          updatePhysics(int ticks);
279     void          handleMaterialSFX();
280     void          handleMaterialGFX(float dt);
281     void          updateFlying();
282     void          updateSliding();
283     void          updateEnginePowerAndBrakes(int ticks);
284     void          updateEngineSFX(float dt);
285     void          updateSpeed();
286     void          updateNitro(int ticks);
287     float         applyAirFriction (float engine_power);
288     float         getActualWheelForce();
289     void          playCrashSFX(const Material* m, AbstractKart *k);
290     void          loadData(RaceManager::KartType type, bool animatedModel);
291     void          updateWeight();
292 public:
293                    Kart(const std::string& ident, unsigned int world_kart_id,
294                         int position, const btTransform& init_transform,
295                         HandicapLevel handicap,
296                         std::shared_ptr<RenderInfo> ri);
297     virtual       ~Kart();
298     virtual void   init(RaceManager::KartType type) OVERRIDE;
299     virtual void   kartIsInRestNow() OVERRIDE;
300     virtual void   updateGraphics(float dt) OVERRIDE;
301     virtual void   createPhysics    ();
302     virtual bool   isInRest         () const OVERRIDE;
303     virtual void   applyEngineForce (float force);
304 
305     virtual void   flyUp() OVERRIDE;
306     virtual void   flyDown() OVERRIDE;
307 
308     virtual void   startEngineSFX   () OVERRIDE;
309     virtual void  collectedItem(ItemState *item) OVERRIDE;
310     virtual float getStartupBoostFromStartTicks(int ticks) const OVERRIDE;
getStartupBoost() const311     virtual float getStartupBoost() const OVERRIDE  { return m_startup_boost; }
setStartupBoost(float val)312     virtual void setStartupBoost(float val) OVERRIDE { m_startup_boost = val; }
313     virtual const Material *getMaterial() const OVERRIDE;
314     virtual const Material *getLastMaterial() const OVERRIDE;
315     /** Returns the pitch of the terrain depending on the heading. */
316     virtual float getTerrainPitch(float heading) const OVERRIDE;
317 
318     virtual void   reset            () OVERRIDE;
319     virtual void   handleZipper     (const Material *m=NULL,
320                                      bool play_sound=false) OVERRIDE;
321     virtual bool   setSquash        (float time, float slowdown) OVERRIDE;
322             void   setSquashGraphics();
323     virtual void   unsetSquash      () OVERRIDE;
324 
325     virtual void   crashed          (AbstractKart *k, bool update_attachments) OVERRIDE;
326     virtual void   crashed          (const Material *m, const Vec3 &normal) OVERRIDE;
327     virtual float  getHoT           () const OVERRIDE;
328     virtual void   update           (int ticks) OVERRIDE;
329     virtual void   finishedRace     (float time, bool from_server=false) OVERRIDE;
330     virtual void   setPosition      (int p) OVERRIDE;
331     virtual void   beep             () OVERRIDE;
332     virtual void   showZipperFire   () OVERRIDE;
333 
334 
335     virtual bool   playCustomSFX    (unsigned int type) OVERRIDE;
336     virtual void   setController(Controller *controller) OVERRIDE;
337     virtual void   setXYZ(const Vec3& a) OVERRIDE;
338     virtual void changeKart(const std::string& new_ident,
339                             HandicapLevel handicap,
340                             std::shared_ptr<RenderInfo> ri) OVERRIDE;
341 
342     // ========================================================================================
343     // SPEED and speed-boost related functions
344     // ----------------------------------------------------------------------------------------
345     virtual void   adjustSpeed      (float f) OVERRIDE;
346     // ----------------------------------------------------------------------------------------
347     virtual void   increaseMaxSpeed(unsigned int category, float add_speed,
348                                     float engine_force, int duration,
349                                     int fade_out_time) OVERRIDE;
350     // ----------------------------------------------------------------------------------------
351     virtual void   instantSpeedIncrease(unsigned int category, float add_max_speed,
352                                     float speed_boost, float engine_force,
353                                     int duration, int fade_out_time) OVERRIDE;
354     // ----------------------------------------------------------------------------------------
355     virtual void   setSlowdown(unsigned int category, float max_speed_fraction,
356                                int fade_in_time) OVERRIDE;
357     // ----------------------------------------------------------------------------------------
358     virtual int   getSpeedIncreaseTicksLeft(unsigned int category) const OVERRIDE;
359     // ----------------------------------------------------------------------------------------
getSpeed() const360     virtual float  getSpeed() const OVERRIDE { return m_speed; }
361     // ----------------------------------------------------------------------------------------
362     virtual float  getCurrentMaxSpeed() const OVERRIDE;
363     // ----------------------------------------------------------------------------------------
364     /** This is used on the client side only to set the speed of the kart
365      *  from the server information. */
setSpeed(float s)366     virtual void setSpeed(float s) OVERRIDE { m_speed = s; }
367 
368     // ========================================================================================
369     // STEERING and skidding related functions
370     // ----------------------------------------------------------------------------------------
371     /** Returns the maximum steering angle for this kart, which depends on the
372      *  speed. */
getMaxSteerAngle() const373     virtual float getMaxSteerAngle () const OVERRIDE
374                     { return getMaxSteerAngle(getSpeed()); }
375     // ----------------------------------------------------------------------------------------
376     /** Returns the time till full steering is reached for this kart.
377      *  \param steer Current steer value (must be >=0), on which the time till
378      *         full steer depends. */
379     virtual float getTimeFullSteer(float steer) const OVERRIDE;
380     // ----------------------------------------------------------------------------------------
381     virtual float  getSpeedForTurnRadius(float radius) const OVERRIDE;
382     // ----------------------------------------------------------------------------------------
383     virtual float  getMaxSteerAngle(float speed) const;
384     // ----------------------------------------------------------------------------------------
385     /** Returns the skidding object for this kart (which can be used to query
386      *  skidding related values). */
getSkidding() const387     virtual const Skidding *getSkidding() const OVERRIDE { return m_skidding.get(); }
388     // ----------------------------------------------------------------------------------------
389     /** Returns the skidding object for this kart (which can be used to query
390      *  skidding related values) - non-const. */
getSkidding()391     virtual Skidding *getSkidding() OVERRIDE { return m_skidding.get(); }
392 
393     // ========================================================================================
394     // NITRO related functions.
395     // ----------------------------------------------------------------------------------------
396     /** Returns the remaining collected energy. */
getEnergy() const397     virtual float getEnergy() const OVERRIDE { return m_collected_energy; }
398     // ----------------------------------------------------------------------------------------
399     /** Sets the energy the kart has collected. */
setEnergy(float val)400     virtual void setEnergy(float val) OVERRIDE { m_collected_energy = val; }
401     // ----------------------------------------------------------------------------------------
402     /** Return whether nitro is being used despite the nitro button not being
403      *  pressed due to minimal use time requirements
404      */
isOnMinNitroTime() const405     virtual bool isOnMinNitroTime() const OVERRIDE { return m_min_nitro_ticks > 0; }
406 
407     // ========================================================================================
408     // POWERUP related functions.
409     // ----------------------------------------------------------------------------------------
410     /** Sets a new powerup. */
411     virtual void setPowerup (PowerupManager::PowerupType t, int n) OVERRIDE;
412     // ----------------------------------------------------------------------------------------
413     /** Sets the last used powerup. */
414     virtual void setLastUsedPowerup (PowerupManager::PowerupType t);
415     // ----------------------------------------------------------------------------------------
416     /** Returns the current powerup. */
getPowerup() const417     virtual const Powerup* getPowerup() const OVERRIDE { return m_powerup; }
418     // ----------------------------------------------------------------------------------------
419     /** Returns the current powerup. */
getPowerup()420     virtual Powerup* getPowerup() OVERRIDE  { return m_powerup; }
421     // ----------------------------------------------------------------------------------------
422     /** Returns the last used powerup. */
getLastUsedPowerup()423     virtual PowerupManager::PowerupType getLastUsedPowerup() OVERRIDE
424     {
425         return m_last_used_powerup;
426     }
427     // ----------------------------------------------------------------------------------------
428     /** Returns the number of powerups. */
429     virtual int getNumPowerup() const OVERRIDE;
430 
431     // ========================================================================================
432     // SPECIAL-STATUS related functions (plunger, squash, shield, immunity).
433     // ----------------------------------------------------------------------------------------
434     /** Makes a kart invulnerable for a certain amount of time. */
setInvulnerableTicks(int ticks)435     virtual void setInvulnerableTicks(int ticks) OVERRIDE
436     {
437         // int16_t max
438         if (ticks > 32767)
439             ticks = 32767;
440         m_invulnerable_ticks = ticks;
441     }   // setInvulnerableTicks
442     // ----------------------------------------------------------------------------------------
443     /** Returns if the kart is invulnerable. */
isInvulnerable() const444     virtual bool isInvulnerable() const OVERRIDE { return m_invulnerable_ticks > 0; }
445     // ----------------------------------------------------------------------------------------
446     /** Returns true if the kart has a plunger attached to its face. */
getBlockedByPlungerTicks() const447     virtual int getBlockedByPlungerTicks() const OVERRIDE
448                                          { return m_view_blocked_by_plunger; }
449     // ----------------------------------------------------------------------------------------
450     /** Sets the view to blocked by a plunger. The duration depends on
451      *  the difficulty, see KartProperties getPlungerInFaceTime. */
452     virtual void blockViewWithPlunger() OVERRIDE;
453     // ----------------------------------------------------------------------------------------
454     /** Enables a kart shield protection for a certain amount of time. */
455     virtual void setShieldTime(float t) OVERRIDE;
456     // ----------------------------------------------------------------------------------------
457     /** Returns if the kart is protected by a shield. */
458     virtual bool isShielded() const OVERRIDE;
459     // ----------------------------------------------------------------------------------------
460     /** Returns the remaining time the kart is protected by a shield. */
461     virtual float getShieldTime() const OVERRIDE;
462     // ----------------------------------------------------------------------------------------
463     /** Decreases the kart's shield time. */
464     virtual void decreaseShieldTime() OVERRIDE;
465     // ----------------------------------------------------------------------------------------
466     /** Returns if the kart is currently being squashed. */
467     virtual bool isSquashed() const OVERRIDE;
468 
469     // ========================================================================================
470     // CONTROLLER related functions
471     // ----------------------------------------------------------------------------------------
472     virtual void  setBoostAI     (bool boosted) OVERRIDE;
473     // ----------------------------------------------------------------------------------------
474     virtual bool  getBoostAI     () const OVERRIDE;
475     // ----------------------------------------------------------------------------------------
476     /** Returns the controller of this kart. */
getController()477     virtual Controller* getController() OVERRIDE { return m_controller; }
478     // ----------------------------------------------------------------------------------------
479     /** Returns the controller of this kart (const version). */
getController() const480     const Controller* getController() const OVERRIDE { return m_controller; }
481 
482     // ========================================================================================
483     // LOCATION ON-TRACK related functions
484     // ----------------------------------------------------------------------------------------
485     /** Returns the coordinates of the front of the kart. This is used for
486      *  determining when the lap line is crossed. */
getFrontXYZ() const487     virtual const Vec3& getFrontXYZ() const OVERRIDE { return m_xyz_front; }
488     // -----------------------------------------------------------------------------------------
489     /** Returns a bullet transform object located at the kart's position
490         and oriented in the direction the kart is going. Can be useful
491         e.g. to calculate the starting point and direction of projectiles. */
492     virtual btTransform getAlignedTransform(const float customPitch=-1) OVERRIDE;
493     // ----------------------------------------------------------------------------------------
494     /** Returns the start transform, i.e. position and rotation. */
getResetTransform() const495     const btTransform& getResetTransform() const {return m_reset_transform;}
496     // ----------------------------------------------------------------------------------------
497     /** True if the wheels are touching the ground. */
498     virtual bool isOnGround() const OVERRIDE;
499     // ----------------------------------------------------------------------------------------
500     /** Returns true if the kart is close to the ground, used to dis/enable
501      *  the upright constraint to allow for more realistic explosions. */
502     bool isNearGround() const;
503     // ----------------------------------------------------------------------------------------
504     /** Returns the normal of the terrain the kart is over atm. This is
505      *  defined even if the kart is flying. */
506     virtual const Vec3& getNormal() const OVERRIDE;
507     // ----------------------------------------------------------------------------------------
508     /** Returns the position 0.25s before */
getPreviousXYZ() const509     virtual const Vec3& getPreviousXYZ() const OVERRIDE
510             { return m_previous_xyz[m_xyz_history_size-1]; }
511     // ----------------------------------------------------------------------------------------
512     /** Returns a more recent different previous position */
513     virtual const Vec3& getRecentPreviousXYZ() const OVERRIDE;
514     // ----------------------------------------------------------------------------------------
515     /** Returns the time at which the recent previous position occured */
getRecentPreviousXYZTime() const516     virtual const float getRecentPreviousXYZTime() const OVERRIDE
517             { return m_previous_xyz_times[m_xyz_history_size/5]; }
518     // ----------------------------------------------------------------------------------------
519     /** For debugging only: check if a kart is flying. */
isFlying() const520     bool isFlying() const { return m_flying;  }
521     // ----------------------------------------------------------------------------------------
522     /** Returns whether this kart is jumping. */
isJumping() const523     virtual bool isJumping() const OVERRIDE { return m_is_jumping; }
524     // ----------------------------------------------------------------------------------------
525     /** Returns the terrain info oject. */
getTerrainInfo() const526     virtual const TerrainInfo *getTerrainInfo() const OVERRIDE { return m_terrain_info; }
527 
528     // ========================================================================================
529     // ----------------------------------------------------------------------------------------
530     /** Returns a pointer to this kart's graphical effects. */
getKartGFX()531     virtual KartGFX* getKartGFX() OVERRIDE         { return m_kart_gfx.get(); }
532     // ----------------------------------------------------------------------------------------
533     /** Returns the current position of this kart in the race. */
getPosition() const534     virtual int getPosition() const OVERRIDE { return m_race_position; }
535     // ----------------------------------------------------------------------------------------
536     /** Returns the initial position of this kart. */
getInitialPosition() const537     virtual int getInitialPosition () const OVERRIDE { return m_initial_position; }
538     // ----------------------------------------------------------------------------------------
539     /** Returns the finished time for a kart. */
getFinishTime() const540     virtual float getFinishTime () const OVERRIDE { return m_finish_time; }
541     // ----------------------------------------------------------------------------------------
542     /** Returns true if this kart has finished the race. */
hasFinishedRace() const543     virtual bool hasFinishedRace () const OVERRIDE { return m_finished_race; }
544     // -----------------------------------------------------------------------------------------
545     /** Returns the color used for this kart. */
546     const irr::video::SColor &getColor() const;
547     // ----------------------------------------------------------------------------------------
getType() const548     virtual RaceManager::KartType getType() const OVERRIDE { return m_type; }
549     // ----------------------------------------------------------------------------------------
550     /** Returns the bullet vehicle which represents this kart. */
getVehicle() const551     virtual btKart *getVehicle() const OVERRIDE { return m_vehicle.get(); }
552     // ----------------------------------------------------------------------------------------
553     virtual btQuaternion getVisualRotation() const OVERRIDE;
554     // ----------------------------------------------------------------------------------------
555     /** Returns the slipstream object of this kart. */
getSlipstream() const556     virtual const SlipStream* getSlipstream() const OVERRIDE { return m_slipstream.get(); }
557     // ----------------------------------------------------------------------------------------
558     /** Returns the slipstream object of this kart. */
getSlipstream()559     virtual SlipStream* getSlipstream() OVERRIDE  {return m_slipstream.get(); }
560     // ----------------------------------------------------------------------------------------
561     /** Activates a slipstream effect, atm that is display some nitro. */
562     virtual void setSlipstreamEffect(float f) OVERRIDE;
563     // ----------------------------------------------------------------------------------------
isEliminated() const564     virtual bool isEliminated() const OVERRIDE { return m_eliminated; }
565     // ----------------------------------------------------------------------------------------
566     virtual void eliminate() OVERRIDE;
567     // ----------------------------------------------------------------------------------------
568     virtual void setOnScreenText(const core::stringw& text) OVERRIDE;
569     // ----------------------------------------------------------------------------------------
570     /** Returns whether this kart wins or loses. */
getRaceResult() const571     virtual bool getRaceResult() const OVERRIDE { return m_race_result;  }
572     // ----------------------------------------------------------------------------------------
573     /** Set this kart race result. */
574     void setRaceResult();
575     // ----------------------------------------------------------------------------------------
576     /** Returns whether this kart is a ghost (replay) kart. */
isGhostKart() const577     virtual bool isGhostKart() const OVERRIDE { return false;  }
578     // ----------------------------------------------------------------------------------------
579     SFXBase* getNextEmitter();
580     // ----------------------------------------------------------------------------------------
581     virtual void playSound(SFXBuffer* buffer) OVERRIDE;
582     // ----------------------------------------------------------------------------------------
583     virtual bool isVisible() const OVERRIDE;
584     // ----------------------------------------------------------------------------------------
585     /** Shows the star effect for a certain time. */
586     virtual void showStarEffect(float t) OVERRIDE;
587     // ----------------------------------------------------------------------------------------
getStarsEffect() const588     virtual Stars* getStarsEffect() const OVERRIDE
589                                                { return m_stars_effect.get(); }
590     // ------------------------------------------------------------------------
591     /** Return the confirmed finish ticks (sent by the server)
592      *  indicating that this kart has really finished the race. */
getNetworkConfirmedFinishTicks() const593     int getNetworkConfirmedFinishTicks() const OVERRIDE
594                                    { return m_network_confirmed_finish_ticks; }
595 
596 };   // Kart
597 
598 
599 #endif
600 
601 /* EOF */
602