2007-12-08 08:22:05 -05:00
|
|
|
// $Id: flyable.hpp 1284 2007-11-08 12:31:54Z hikerstk $
|
|
|
|
//
|
|
|
|
// SuperTuxKart - a fun racing game with go-kart
|
|
|
|
// Copyright (C) 2007 Joerg Henrichs
|
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License
|
|
|
|
// as published by the Free Software Foundation; either version 2
|
|
|
|
// of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
|
|
|
#ifndef HEADER_FLYABLE_H
|
|
|
|
#define HEADER_FLYABLE_H
|
|
|
|
|
|
|
|
#include "moveable.hpp"
|
2008-02-05 06:56:21 -05:00
|
|
|
#include "moving_physics.hpp"
|
2007-12-08 08:22:05 -05:00
|
|
|
#include "kart.hpp"
|
2007-12-17 08:16:09 -05:00
|
|
|
#include "terrain_info.hpp"
|
2007-12-08 08:22:05 -05:00
|
|
|
|
2007-12-17 08:16:09 -05:00
|
|
|
class Flyable : public Moveable, public TerrainInfo
|
2007-12-08 08:22:05 -05:00
|
|
|
{
|
|
|
|
sgCoord m_last_pos;
|
|
|
|
bool m_has_hit_something;
|
|
|
|
int m_last_radar_beep;
|
|
|
|
bool m_exploded;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
const Kart* m_owner; // the kart which released this flyable
|
|
|
|
btCollisionShape *m_shape;
|
|
|
|
float m_max_height;
|
|
|
|
float m_min_height;
|
2008-01-11 08:48:09 -05:00
|
|
|
float m_average_height; // average of m_{min,ax}_height
|
2007-12-08 08:22:05 -05:00
|
|
|
float m_force_updown;
|
|
|
|
float m_speed;
|
|
|
|
float m_mass;
|
|
|
|
btVector3 m_extend;
|
|
|
|
// The flyable class stores the values for each flyable type, e.g.
|
|
|
|
// speed, min_height, max_height. These variables must be static,
|
|
|
|
// so we need arrays of these variables to have different values
|
|
|
|
// for sparks, missiles, ...
|
|
|
|
static float m_st_speed[COLLECT_MAX]; // Speed of the projectile
|
|
|
|
static ssgEntity* m_st_model[COLLECT_MAX]; // 3d model
|
|
|
|
static float m_st_min_height[COLLECT_MAX]; // min height above track
|
|
|
|
static float m_st_max_height[COLLECT_MAX]; // max height above track
|
|
|
|
static float m_st_force_updown[COLLECT_MAX]; // force pushing up/down
|
|
|
|
static btVector3 m_st_extend[COLLECT_MAX]; // size of the model
|
|
|
|
|
|
|
|
void getClosestKart(const Kart **minKart, float *minDist,
|
|
|
|
btVector3 *minDelta) const;
|
2008-01-11 08:48:09 -05:00
|
|
|
void createPhysics(float y_offset,
|
2008-01-09 07:09:55 -05:00
|
|
|
const btVector3 velocity,
|
|
|
|
btCollisionShape *shape);
|
2007-12-08 08:22:05 -05:00
|
|
|
public:
|
|
|
|
|
|
|
|
Flyable (Kart* kart, CollectableType type);
|
|
|
|
virtual ~Flyable ();
|
|
|
|
static void init (const lisp::Lisp* lisp, ssgEntity *model,
|
|
|
|
CollectableType type);
|
|
|
|
virtual void update (float);
|
|
|
|
|
|
|
|
void placeModel ();
|
|
|
|
virtual void hitTrack () {};
|
2008-02-05 06:56:21 -05:00
|
|
|
void explode (Kart* kart, MovingPhysics* moving_physics=NULL);
|
2007-12-08 08:22:05 -05:00
|
|
|
bool hasHit () { return m_has_hit_something; }
|
|
|
|
void reset () { Moveable::reset();
|
|
|
|
sgCopyCoord(&m_last_pos,&m_reset_pos ); }
|
|
|
|
}; // Flyable
|
|
|
|
|
|
|
|
#endif
|