22 #ifndef HEADER_FLYABLE_HPP
23 #define HEADER_FLYABLE_HPP
25 #include "items/powerup_manager.hpp"
26 #include "karts/moveable.hpp"
27 #include "network/rewinder.hpp"
28 #include "tracks/terrain_info.hpp"
29 #include "utils/cpp2011.hpp"
31 #include <irrString.h>
34 namespace scene {
class IMesh; }
52 bool m_has_hit_something;
73 uint32_t m_compressed_gravity_vector;
84 PowerupManager::PowerupType
119 bool m_has_server_state;
131 int m_last_deleted_ticks;
139 static float m_st_speed[PowerupManager::POWERUP_MAX];
142 static scene::IMesh *m_st_model[PowerupManager::POWERUP_MAX];
145 static float m_st_min_height[PowerupManager::POWERUP_MAX];
148 static float m_st_max_height[PowerupManager::POWERUP_MAX];
151 static float m_st_force_updown[PowerupManager::POWERUP_MAX];
154 static Vec3 m_st_extend[PowerupManager::POWERUP_MAX];
164 float *minDistSquared,
167 const bool backwards=
false)
const;
169 void getLinearKartItemIntersection(
const Vec3 &origin,
171 float item_XY_velocity,
float gravity,
173 float *fire_angle,
float *up_velocity);
177 void createPhysics(
float y_offset,
178 const Vec3 &velocity,
179 btCollisionShape *shape,
181 const btVector3& gravity=btVector3(0.0f,0.0f,0.0f),
182 const bool rotates=
false,
183 const bool turn_around=
false,
184 const btTransform* customDirection=NULL);
186 void moveToInfinity(
bool set_moveable_trans =
true);
187 void removePhysics();
188 void fixSFXSplitscreen(
SFXBase* sfx);
192 PowerupManager::PowerupType type,
195 static void init (
const XMLNode &node, scene::IMesh *model,
196 PowerupManager::PowerupType type);
197 void updateGraphics(
float dt) OVERRIDE;
198 virtual bool updateAndDelete(
int ticks);
201 bool isOwnerImmunity(
const AbstractKart *kart_hit)
const;
204 bool secondary_hits=
true);
205 unsigned int getOwnerId();
226 bool hasHit () {
return m_has_hit_something; }
236 PowerupManager::PowerupType
getType()
const {
return m_type;}
250 void addForRewind(
const std::string& uid);
258 virtual void saveTransform() OVERRIDE;
260 virtual
void computeError() OVERRIDE;
268 bool hasServerState()
const {
return m_has_server_state; }
272 virtual void onFireFlyable();
274 virtual void onDeleteFlyable();
276 void setCreatedTicks(
int ticks) { m_created_ticks = 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
Describes a chain of 8-bit unsigned integers.
Definition: network_string.hpp:53
Definition: flyable.hpp:50
virtual void undoState(BareNetworkString *buffer) OVERRIDE
Undo the effects of the given state, but do not rewind to that state (which is done by rewindTo).
Definition: flyable.hpp:256
void setPositionOffset(const Vec3 &o)
Sets the offset to be used when determining the terrain under the flyable.
Definition: flyable.hpp:218
PowerupManager::PowerupType getType() const
Returns the type of flyable.
Definition: flyable.hpp:236
const Vec3 & getExtend() const
Returns the size (extend) of the mesh.
Definition: flyable.hpp:248
bool m_owner_has_temporary_immunity
If set to true, the kart that throwns this flyable can't collide with it for a short time.
Definition: flyable.hpp:123
float m_min_height
Minimum height above terrain.
Definition: flyable.hpp:94
float m_average_height
Average of average of m_{min,ax}_height.
Definition: flyable.hpp:97
float m_speed
Speed of this Flyable.
Definition: flyable.hpp:103
int m_max_lifespan
Set to something > -1 if this flyable should auto-destrcut after that may ticks.
Definition: flyable.hpp:158
bool m_adjust_up_velocity
If this flag is set, the up velocity of the kart will not be adjusted in case that the objects is too...
Definition: flyable.hpp:57
AbstractKart * getOwner() const
Returns the owner's kart.
Definition: flyable.hpp:240
void setHasHit()
Indicates that something was hit and that this object must be removed.
Definition: flyable.hpp:230
PowerupManager::PowerupType m_type
Type of the powerup.
Definition: flyable.hpp:85
uint16_t m_ticks_since_thrown
Time since thrown.
Definition: flyable.hpp:113
bool m_do_terrain_info
If this variable is set to true (which is the default) flyable will update the height of terrain when...
Definition: flyable.hpp:70
AbstractKart * m_owner
Kart which shot this flyable.
Definition: flyable.hpp:81
float m_max_height
Maximum height above terrain.
Definition: flyable.hpp:91
void setAdjustUpVelocity(bool f)
If true the up velocity of the flyable will be adjust so that the flyable stays at a height close to ...
Definition: flyable.hpp:213
Vec3 m_position_offset
An offset that is added when doing the raycast for terrain.
Definition: flyable.hpp:63
const float m_mass
Mass of this Flyable.
Definition: flyable.hpp:106
Vec3 m_extend
Size of this flyable.
Definition: flyable.hpp:109
bool hasHit()
Enables/disables adjusting ov velocity depending on height above terrain.
Definition: flyable.hpp:226
void setDoTerrainInfo(bool d)
Sets wether Flyable should update TerrainInfo as part of its update call, or if the inheriting object...
Definition: flyable.hpp:245
btCollisionShape * m_shape
Collision shape of this Flyable.
Definition: flyable.hpp:88
virtual void undoEvent(BareNetworkString *buffer) OVERRIDE
Called when an event needs to be undone.
Definition: flyable.hpp:252
AbstractKartAnimation * m_animation
If the flyable is in a cannon, this is the pointer to the cannon animation.
Definition: flyable.hpp:77
void reset() OVERRIDE
Resets this flyable.
Definition: flyable.hpp:233
virtual void hitTrack()
Called when this flyable hits the track.
Definition: flyable.hpp:221
float m_force_updown
Force pushing the Flyable up.
Definition: flyable.hpp:100
bool hasAnimation() const
Returns if this flyable has an animation playing (e.g.
Definition: flyable.hpp:208
virtual void rewindToEvent(BareNetworkString *buffer) OVERRIDE
Called when an event needs to be replayed.
Definition: flyable.hpp:254
A small interface for effects to be used when a kart is hit.
Definition: hit_effect.hpp:33
Definition: moveable.hpp:46
virtual void reset()
The reset position must be set before calling reset.
Definition: moveable.cpp:104
Definition: physical_object.hpp:40
Definition: rewinder.hpp:44
The base class for sound effects.
Definition: sfx_base.hpp:43
This class stores information about the triangle that's under an object, i.e.
Definition: terrain_info.hpp:32
A wrapper around bullets btVector3 to include conventient conversion functions (e....
Definition: vec3.hpp:35
utility class used to parse XML files
Definition: xml_node.hpp:48