Added missing files from previous patch.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1326 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2007-12-08 13:22:05 +00:00
parent 7ed846ca3e
commit eaac399a09
8 changed files with 715 additions and 0 deletions

253
src/flyable.cpp Normal file
View File

@ -0,0 +1,253 @@
// $Id: flyable.cpp 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.
#include <math.h>
#include "flyable.hpp"
#include "constants.hpp"
#include "world.hpp"
#include "kart.hpp"
#include "projectile_manager.hpp"
#include "sound_manager.hpp"
#include "scene.hpp"
#include "ssg_help.hpp"
// static variables:
float Flyable::m_st_speed[COLLECT_MAX];
ssgEntity* Flyable::m_st_model[COLLECT_MAX];
float Flyable::m_st_min_height[COLLECT_MAX];
float Flyable::m_st_max_height[COLLECT_MAX];
float Flyable::m_st_force_updown[COLLECT_MAX];
btVector3 Flyable::m_st_extend[COLLECT_MAX];
// ----------------------------------------------------------------------------
Flyable::Flyable(Kart *kart, CollectableType type) : Moveable(false)
{
// get the appropriate data from the static fields
m_speed = m_st_speed[type];
m_extend = m_st_extend[type];
m_max_height = m_st_max_height[type];
m_min_height = m_st_min_height[type];
m_force_updown = m_st_force_updown[type];
m_owner = kart;
m_has_hit_something = false;
m_last_radar_beep = -1;
m_exploded = false;
m_shape = NULL;
m_mass = 1.0f;
// Add the graphical model
ssgTransform *m = getModelTransform();
m->addKid(m_st_model[type]);
scene->add(m);
} // Flyable
// ----------------------------------------------------------------------------
void Flyable::createPhysics(const btVector3& offset, const btVector3 velocity)
{
// The actual transform is determined as follows:
// 1) Compute the heading of the kart
// 2) Compute the pitch of the terrain. This avoids the problem of the
// rocket hitting the floor (e.g. if the kart is braking and therefore
// pointing downwards).
btTransform trans;
m_owner->getTrans(&trans);
// Compute heading so that straight forward (direction=(0,1,0)) is 0:
btVector3 forwards(0.0f, 1.0f, 0.0f);
btVector3 direction=trans.getBasis()*forwards;
float heading=atan2(-direction.getX(), direction.getY());
btVector3 normal;
float pitch=0.0f;
if(world->getTerrainNormal(trans.getOrigin(),&normal))
{
const float X =-sin(heading);
const float Y = cos(heading);
// Compute the angle between the normal of the plane and the line to
// (x,y,0). (x,y,0) is normalised, so are the coordinates of the plane,
// simplifying the computation of the scalar product.
pitch = ( normal.getX()*X + normal.getY()*Y ); // use ( x,y,0)
// The actual angle computed above is between the normal and the (x,y,0)
// line, so to compute the actual angles 90 degrees must be subtracted.
pitch = acosf(pitch) - NINETY_DEGREE_RAD;
}
btMatrix3x3 m;
m.setEulerZYX(pitch, 0.0f, heading);
trans.setBasis(m);
// Apply rotation and offset
btTransform offset_transform;
offset_transform.setIdentity();
offset_transform.setOrigin(offset);
trans *= offset_transform;
m_shape = createShape(); // get shape
createBody(m_mass, trans, m_shape, Moveable::MOV_PROJECTILE);
world->getPhysics()->addBody(getBody());
// Simplified rockets: no gravity
m_body->setGravity(btVector3(0.0f, 0.0f, 0.0f));
// Rotate velocity to point in the right direction
btVector3 v=trans.getBasis()*velocity;
if(m_mass!=0.0f) // Don't set velocity for kinematic or static objects
{
m_body->setLinearVelocity(v);
m_body->setAngularFactor(0.0f); // prevent rotations
}
m_body->setCollisionFlags(btCollisionObject::CF_NO_CONTACT_RESPONSE);
// FIXME: for now it is necessary to synch the graphical position with the
// physical position, since 'hot' computation is done using the
// graphical position (and hot can trigger an explosion when no
// terrain is under the rocket). Once hot is done with bullet as
// well, this shouldn't be necessary anymore.
placeModel();
//FIXME m_current_HAT = world->getHAT(offset.getOrigin());
m_HAT_counter = 0;
} // createPhysics
// -----------------------------------------------------------------------------
void Flyable::init(const lisp::Lisp* lisp, ssgEntity *model,
CollectableType type)
{
m_st_speed[type] = 25.0f;
m_st_max_height[type] = 1.0f;
m_st_min_height[type] = 3.0f;
m_st_force_updown[type] = 15.0f;
lisp->get("speed", m_st_speed[type] );
lisp->get("min-height", m_st_min_height[type] );
lisp->get("max-height", m_st_max_height[type] );
lisp->get("force-updown", m_st_force_updown[type]);
// Store the size of the model
float x_min, x_max, y_min, y_max, z_min, z_max;
MinMax(model, &x_min, &x_max, &y_min, &y_max, &z_min, &z_max);
m_st_extend[type] = btVector3(x_max-x_min,y_max-y_min, z_max-z_min);
m_st_model[type] = model;
} // init
//-----------------------------------------------------------------------------
Flyable::~Flyable()
{
if(m_shape) delete m_shape;
world->getPhysics()->removeBody(getBody());
} // ~Flyable
//-----------------------------------------------------------------------------
void Flyable::getClosestKart(const Kart **minKart, float *minDist, btVector3 *minDelta) const
{
btTransform tProjectile;
getTrans(&tProjectile);
*minDist = 99999.9f;
for(unsigned int i=0 ; i<world->getNumKarts(); i++ )
{
Kart *kart = world -> getKart(i);
if(kart == m_owner) continue;
btTransform t;
kart->getTrans(&t);
btVector3 delta = t.getOrigin()-tProjectile.getOrigin();
float distance2 = delta.length2();
if(distance2 < *minDist)
{
*minDist = sqrt(distance2);
*minKart = kart;
*minDelta = delta;
}
} // for i<getNumKarts
} // getClosestKart
//-----------------------------------------------------------------------------
void Flyable::update (float dt)
{
if(m_exploded) return;
m_HAT_counter++;
if(m_HAT_counter==1)
{
btTransform trans=getBody()->getWorldTransform();
m_current_HAT = world->getHAT(trans.getOrigin());
m_HAT_counter = 0;
printf("pos: %f %f %f height %f min %f max %f\n",
trans.getOrigin().getX(),trans.getOrigin().getY(),trans.getOrigin().getZ(),
m_current_HAT, m_min_height, m_max_height);
if(m_current_HAT!=Physics::NOHIT)
{
if(m_current_HAT<m_min_height)
{printf("up \n");too_low(dt);}
else if(m_current_HAT>m_max_height)
{printf("down \n");too_high(dt);}
else
right_height(dt);
}
else explode(NULL);
}
Moveable::update(dt);
} // update
// -----------------------------------------------------------------------------
void Flyable::placeModel()
{
btTransform t;
getTrans(&t);
float m[4][4];
t.getOpenGLMatrix((float*)&m);
sgSetCoord(&m_curr_pos, m);
const btVector3 &v=m_body->getLinearVelocity();
sgSetVec3(m_velocity.xyz, v.x(), v.y(), v.z());
m_model_transform->setTransform(&m_curr_pos);
} // placeModel
// -----------------------------------------------------------------------------
void Flyable::explode(Kart *kart_hit)
{
if(m_exploded) return;
m_has_hit_something=true;
m_curr_pos.xyz[2] += 1.2f ;
// Notify the projectile manager that this rocket has hit something.
// The manager will create the appropriate explosion object.
projectile_manager->explode();
// Now remove this projectile from the graph:
ssgTransform *m = getModelTransform();
m->removeAllKids();
scene->remove(m);
world->getPhysics()->removeBody(getBody());
m_exploded=true;
for ( unsigned int i = 0 ; i < world->getNumKarts() ; i++ )
{
Kart *kart = world -> getKart(i);
// handle the actual explosion. Set a flag it if was a direct hit.
kart->handleExplosion(m_curr_pos.xyz, kart==kart_hit);
}
} // explode
/* EOF */

87
src/flyable.hpp Normal file
View File

@ -0,0 +1,87 @@
// $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"
#include "kart.hpp"
class Flyable : public Moveable
{
sgCoord m_last_pos;
bool m_has_hit_something;
int m_last_radar_beep;
bool m_exploded;
int m_HAT_counter; // compute HAT only every N timesteps
protected:
const Kart* m_owner; // the kart which released this flyable
btCollisionShape *m_shape;
float m_max_height;
float m_min_height;
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
float m_current_HAT; // height above terrain
void getClosestKart(const Kart **minKart, float *minDist,
btVector3 *minDelta) const;
virtual btCollisionShape *createShape()=0;
virtual void too_low (float dt)
{m_body->applyCentralForce(
btVector3(0.0f, 0.0f, m_force_updown)); }
virtual void too_high(float dt)
{m_body->applyCentralForce(
btVector3(0.0f, 0.0f, -m_force_updown)); }
virtual void right_height(float dt)
{btVector3 v=m_body->getLinearVelocity();
v.setZ(0.0f);
m_body->setLinearVelocity(v); }
void createPhysics(const btVector3& offset,
const btVector3 velocity);
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 () {};
void explode (Kart* kart);
bool hasHit () { return m_has_hit_something; }
void reset () { Moveable::reset();
sgCopyCoord(&m_last_pos,&m_reset_pos ); }
void OutsideTrack (int isReset) { explode(NULL); }
}; // Flyable
#endif

100
src/homing.cpp Normal file
View File

@ -0,0 +1,100 @@
// $Id: homing.cpp 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.
#include "homing.hpp"
#include "constants.hpp"
float Homing::m_st_max_distance;
float Homing::m_st_max_turn_angle;
// -----------------------------------------------------------------------------
Homing::Homing (Kart *kart) : Flyable(kart, COLLECT_HOMING)
{
m_mass = 0.0f; // a kinematik object must have mass=0, otherwise warnings
// will be printed during bullet collision handling.
btVector3 offset(0.0f,
kart->getKartLength()+2.0f*m_extend.getY(),
0.3f );
// The cylinder needs to be rotated by 90 degrees to face in the right direction:
m_initial_velocity = btVector3(0.0f, m_speed, 0.0f);
createPhysics(offset, m_initial_velocity);
m_body->setCollisionFlags(m_body->getCollisionFlags() |
btCollisionObject::CF_KINEMATIC_OBJECT );
m_body->setActivationState(DISABLE_DEACTIVATION);
} // Homing
// -----------------------------------------------------------------------------
void Homing::init(const lisp::Lisp* lisp, ssgEntity *homing)
{
Flyable::init(lisp, homing, COLLECT_HOMING);
m_st_max_turn_angle = 15.0f;
m_st_max_distance = 20.0f;
lisp->get("max-distance", m_st_max_distance );
lisp->get("max-turn-angle", m_st_max_turn_angle);
} // init
// -----------------------------------------------------------------------------
btCollisionShape *Homing::createShape()
{
return new btCylinderShape(0.5f*m_extend);
} // createShape
// -----------------------------------------------------------------------------
void Homing::update(float dt)
{
Flyable::update(dt);
const Kart *kart=0;
btVector3 direction;
float minDistance;
getClosestKart(&kart, &minDistance, &direction);
btTransform my_trans;
getTrans(&my_trans);
if(minDistance<m_st_max_distance) // move homing towards kart
{
btTransform target;
kart->getTrans(&target);
getTrans(&my_trans);
float steer=steerTowards(my_trans, target.getOrigin());
if(fabsf(steer)>90.0f) steer=0.0f;
if(steer<-m_st_max_turn_angle) steer = -m_st_max_turn_angle;
if(steer> m_st_max_turn_angle) steer = m_st_max_turn_angle;
btMatrix3x3 steerMatrix(btQuaternion(0.0f,0.0f,DEGREE_TO_RAD(steer)));
my_trans.setBasis(my_trans.getBasis()*steerMatrix);
} // minDistance<m_st_max_distance
btVector3 v =my_trans.getBasis()*m_initial_velocity;
my_trans.setOrigin(my_trans.getOrigin()+dt*v);
setTrans(my_trans);
} // update
// -----------------------------------------------------------------------------
float Homing::steerTowards(btTransform& trans, btVector3& target)
{
btMatrix3x3 m(trans.getBasis());
btVector3 forwards(0.f,1.f,0.0f);
btVector3 direction=m*forwards;
float heading = RAD_TO_DEGREE(atan2(direction.getY(),direction.getX()));
btVector3 pos=trans.getOrigin();
float angle = RAD_TO_DEGREE(atan2(target.getY()-pos.getY(), target.getX()-pos.getX()));
angle -=heading;
if(angle> 180.0f) angle=angle-360.0f;
if(angle<-180.0f) angle=angle+360.0f;
return angle;
} // steerTowards

47
src/homing.hpp Normal file
View File

@ -0,0 +1,47 @@
// $Id: missile.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_HOMING_H
#define HEADER_HOMING_H
#include "flyable.hpp"
class Homing : public Flyable
{
private:
static float m_st_max_distance; // maximum distance for a spark to be attracted
static float m_st_max_turn_angle;
btVector3 m_initial_velocity;
float steerTowards(btTransform& trans, btVector3& target);
protected:
virtual btCollisionShape *createShape();
virtual void too_low (float dt) {m_initial_velocity.setZ(m_force_updown*dt);}
virtual void too_high(float dt) {m_initial_velocity.setZ(-m_force_updown*dt);}
virtual void right_height(float dt) {m_initial_velocity.setZ(0.0f); }
public:
Homing (Kart *kart);
static void init (const lisp::Lisp* lisp, ssgEntity* homing);
virtual void update (float dt);
virtual void hitTrack () { explode(NULL); }
}; // Homing
#endif

49
src/missile.cpp Normal file
View File

@ -0,0 +1,49 @@
// $Id: missile.cpp 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.
#include "missile.hpp"
#include "constants.hpp"
// -----------------------------------------------------------------------------
Missile::Missile(Kart *kart) : Flyable(kart, COLLECT_MISSILE)
{
btVector3 offset(0.0f,
kart->getKartLength()+2.0f*m_extend.getY(),
0.3f );
createPhysics(offset, btVector3(0.0f, m_speed, 0.0f));
} // Missile
// -----------------------------------------------------------------------------
void Missile::init(const lisp::Lisp* lisp, ssgEntity *missile)
{
Flyable::init(lisp, missile, COLLECT_MISSILE);
} // init
// -----------------------------------------------------------------------------
btCollisionShape *Missile::createShape()
{
return new btCylinderShape(0.5f*m_extend);
} // createShape
// -----------------------------------------------------------------------------
void Missile::update(float dt)
{
Flyable::update(dt);
} // update
// -----------------------------------------------------------------------------

37
src/missile.hpp Normal file
View File

@ -0,0 +1,37 @@
// $Id: missile.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_MISSILE_H
#define HEADER_MISSILE_H
#include "flyable.hpp"
class Missile : public Flyable
{
protected:
virtual btCollisionShape *createShape();
public:
Missile(Kart *kart);
static void init (const lisp::Lisp* lisp, ssgEntity* missile);
virtual void update (float dt);
virtual void hitTrack () { explode(NULL); }
}; // Missile
#endif

102
src/spark.cpp Normal file
View File

@ -0,0 +1,102 @@
// $Id: spark.cpp 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.
#include "spark.hpp"
float Spark::m_st_max_distance; // maximum distance for a spark to be attracted
float Spark::m_st_force_to_target;
// -----------------------------------------------------------------------------
Spark::Spark(Kart *kart) : Flyable(kart, COLLECT_SPARK)
{
btVector3 offset(0.0f,
-0.5f*kart->getKartLength()-2.0f*m_extend.getY(),
0.5f*kart->getKartHeight());
float speed=-m_speed;
// if the kart is driving backwards, release from the front
if(m_owner->getSpeed()<0)
{
offset.setY(0.5f*kart->getKartLength()+2.0f*m_extend.getY());
speed = m_speed;
}
createPhysics(offset, btVector3(0.0f, speed, 0.0f));
// unset no_contact_response flags, so that the spark
// will bounce off the track
int flag = getBody()->getCollisionFlags();
flag = flag & (~ btCollisionObject::CF_NO_CONTACT_RESPONSE);
getBody()->setCollisionFlags(flag);
} // Spark
// -----------------------------------------------------------------------------
void Spark::init(const lisp::Lisp* lisp, ssgEntity *spark)
{
Flyable::init(lisp, spark, COLLECT_SPARK);
m_st_max_distance = 20.0f;
m_st_force_to_target = 10.0f;
lisp->get("max-distance", m_st_max_distance );
lisp->get("force-to-target", m_st_force_to_target);
} // init
// -----------------------------------------------------------------------------
btCollisionShape *Spark::createShape()
{
return new btSphereShape(0.5f*m_extend.getY());
} // createShape
// -----------------------------------------------------------------------------
void Spark::update(float dt)
{
Flyable::update(dt);
const Kart *kart=0;
btVector3 direction;
float minDistance;
getClosestKart(&kart, &minDistance, &direction);
if(minDistance<m_st_max_distance) // move spark towards kart
{
direction*=1/direction.length()*m_st_force_to_target;
m_body->applyCentralForce(direction);
}
else
{ // Sparks lose energy (e.g. when hitting the track), so increase the
// speed if the spark is too slow, but only if it's not too high (if
// the spark is too high, it is 'pushed down', which can reduce the
// speed, which causes the speed to increase, which in turn causes
// the spark to fly higher and higher.
btVector3 v=m_body->getLinearVelocity();
if (m_current_HAT<= m_max_height)
{
float vlen = v.length2();
if(vlen<0.8*m_speed*m_speed)
{ // spark lost energy (less than 80%), i.e. it's too slow - speed it up:
if(vlen==0.0f) {
v = btVector3(.5f, .5f, .5f); // avoid 0 div.
vlen = 0.75;
}
else
{
m_body->setLinearVelocity(v*m_speed/sqrt(vlen));
}
} // vlen < 0.8*m_speed*m_speed
} // m_current_HAT < m_max_height
} // spar lose energy
} // update
// -----------------------------------------------------------------------------

40
src/spark.hpp Normal file
View File

@ -0,0 +1,40 @@
// $Id: spark.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_SPARK_H
#define HEADER_SPARK_H
#include "flyable.hpp"
class Spark : public Flyable
{
private:
static float m_st_max_distance; // maximum distance for a spark to be attracted
static float m_st_force_to_target;
protected:
virtual btCollisionShape *createShape();
public:
Spark(Kart* kart);
static void init(const lisp::Lisp* lisp, ssgEntity* spark);
virtual void update(float dt);
}; // Spark
#endif