Introduced an 'abstract kart' class, which is used to
de-couple kart implementation and its interface. This significantly reduces compile time when changing kart.hpp, but is at this stage still work in progress. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@10997 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
48cc8d6044
commit
ebbc1a71d8
@ -33,6 +33,7 @@
|
||||
#include "graphics/irr_driver.hpp"
|
||||
#include "io/file_manager.hpp"
|
||||
#include "io/xml_node.hpp"
|
||||
#include "karts/kart_properties.hpp"
|
||||
#include "karts/kart_properties_manager.hpp"
|
||||
#include "states_screens/kart_selection.hpp"
|
||||
#include "tracks/track.hpp"
|
||||
|
@ -21,7 +21,8 @@
|
||||
#include <sstream>
|
||||
|
||||
#include "challenges/unlock_manager.hpp"
|
||||
#include "karts/kart.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "karts/kart_properties.hpp"
|
||||
#include "karts/kart_properties_manager.hpp"
|
||||
#include "modes/linear_world.hpp"
|
||||
#include "race/grand_prix_data.hpp"
|
||||
@ -366,7 +367,7 @@ bool ChallengeData::raceFinished()
|
||||
|
||||
int d = race_manager->getDifficulty();
|
||||
|
||||
Kart* kart = world->getPlayerKart(0);
|
||||
AbstractKart* kart = world->getPlayerKart(0);
|
||||
|
||||
if (track_name != m_track_id ) return false;
|
||||
if ((int)world->getNumKarts() < m_num_karts[d] ) return false;
|
||||
|
@ -29,7 +29,8 @@
|
||||
#include "config/user_config.hpp"
|
||||
#include "graphics/irr_driver.hpp"
|
||||
#include "io/xml_node.hpp"
|
||||
#include "karts/kart.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "karts/kart_properties.hpp"
|
||||
#include "karts/skidding.hpp"
|
||||
#include "modes/world.hpp"
|
||||
#include "race/race_manager.hpp"
|
||||
@ -42,7 +43,7 @@
|
||||
|
||||
AlignedArray<Camera::EndCameraInformation> Camera::m_end_cameras;
|
||||
|
||||
Camera::Camera(int camera_index, Kart* kart)
|
||||
Camera::Camera(int camera_index, AbstractKart* kart)
|
||||
{
|
||||
m_mode = CM_NORMAL;
|
||||
m_index = camera_index;
|
||||
@ -87,7 +88,7 @@ Camera::~Camera()
|
||||
/** Changes the owner of this camera to the new kart.
|
||||
* \param new_kart The new kart to use this camera.
|
||||
*/
|
||||
void Camera::changeOwner(Kart *new_kart)
|
||||
void Camera::changeOwner(AbstractKart *new_kart)
|
||||
{
|
||||
m_kart->setCamera(NULL);
|
||||
m_kart = new_kart;
|
||||
|
@ -37,7 +37,7 @@ using namespace irr;
|
||||
#include "utils/aligned_array.hpp"
|
||||
#include "utils/vec3.hpp"
|
||||
|
||||
class Kart;
|
||||
class AbstractKart;
|
||||
|
||||
/**
|
||||
* \brief Handles the game camera
|
||||
@ -89,7 +89,7 @@ private:
|
||||
|
||||
/** The kart that the camera follows. It can't be const,
|
||||
* since in profile mode the camera might change its owner. */
|
||||
Kart *m_kart;
|
||||
AbstractKart *m_kart;
|
||||
|
||||
/** The list of viewports for this cameras. */
|
||||
core::recti m_viewport;
|
||||
@ -191,7 +191,7 @@ private:
|
||||
void positionCamera(float dt, float above_kart, float cam_angle,
|
||||
float side_way, float distance, float smoothing);
|
||||
public:
|
||||
Camera (int camera_index, Kart* kart);
|
||||
Camera (int camera_index, AbstractKart* kart);
|
||||
~Camera ();
|
||||
static void readEndCamera(const XMLNode &root);
|
||||
static void clearEndCameras();
|
||||
@ -203,7 +203,7 @@ public:
|
||||
void setInitialTransform();
|
||||
void activate();
|
||||
void update (float dt);
|
||||
void changeOwner (Kart *new_kart);
|
||||
void changeOwner (AbstractKart *new_kart);
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Sets the ambient light for this camera. */
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "items/powerup_manager.hpp"
|
||||
#include "items/attachment_manager.hpp"
|
||||
#include "items/projectile_manager.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "karts/kart_properties_manager.hpp"
|
||||
#include "main_loop.hpp"
|
||||
#include "modes/profile_world.hpp"
|
||||
@ -1312,7 +1313,7 @@ void IrrDriver::update(float dt)
|
||||
rg->update(dt);
|
||||
for(unsigned int i=0; i<world->getNumKarts(); i++)
|
||||
{
|
||||
Kart *kart=world->getKart(i);
|
||||
AbstractKart *kart=world->getKart(i);
|
||||
if(kart->getCamera())
|
||||
{
|
||||
#ifdef ENABLE_PROFILER
|
||||
@ -1352,7 +1353,7 @@ void IrrDriver::update(float dt)
|
||||
|
||||
for(unsigned int i=0; i<world->getNumKarts(); i++)
|
||||
{
|
||||
Kart *kart = world->getKart(i);
|
||||
AbstractKart *kart = world->getKart(i);
|
||||
if(kart->getCamera())
|
||||
{
|
||||
{
|
||||
|
@ -49,8 +49,8 @@ using namespace irr;
|
||||
#include "utils/ptr_vector.hpp"
|
||||
#include "utils/vec3.hpp"
|
||||
|
||||
class AbstractKart;
|
||||
class Camera;
|
||||
class Kart;
|
||||
class PerCameraNode;
|
||||
|
||||
/**
|
||||
@ -177,7 +177,7 @@ public:
|
||||
*addAnimatedMesh(scene::IAnimatedMesh *mesh);
|
||||
scene::ICameraSceneNode
|
||||
*addCameraSceneNode();
|
||||
Camera *addCamera(unsigned int index, Kart *kart);
|
||||
Camera *addCamera(unsigned int index, AbstractKart *kart);
|
||||
void removeCameraSceneNode(scene::ICameraSceneNode *camera);
|
||||
void removeCamera(Camera *camera);
|
||||
void update(float dt);
|
||||
|
@ -37,7 +37,9 @@
|
||||
|
||||
#include <IGPUProgrammingServices.h>
|
||||
#include <IMaterialRendererServices.h>
|
||||
#include <ISceneNode.h>
|
||||
#include <IShaderConstantSetCallBack.h>
|
||||
|
||||
using namespace irr::video;
|
||||
|
||||
const unsigned int UCLAMP = 1;
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#include "graphics/particle_kind_manager.hpp"
|
||||
#include "io/file_manager.hpp"
|
||||
#include "race/race_manager.hpp"
|
||||
#include "tracks/track.hpp"
|
||||
#include "tracks/track_manager.hpp"
|
||||
#include <stdexcept>
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
#include "graphics/irr_driver.hpp"
|
||||
#include "graphics/mesh_tools.hpp"
|
||||
#include "karts/kart.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "io/file_manager.hpp"
|
||||
#include "io/xml_node.hpp"
|
||||
#include "utils/constants.hpp"
|
||||
@ -182,7 +182,7 @@ Referee::Referee()
|
||||
* it. This is the constructor used when a rescue referee is needed.
|
||||
* \param kart The kart which the referee should rescue.
|
||||
*/
|
||||
Referee::Referee(const Kart &kart)
|
||||
Referee::Referee(const AbstractKart &kart)
|
||||
{
|
||||
assert(m_st_referee_mesh);
|
||||
// First add a NULL mesh, then set the material to be read only
|
||||
|
@ -24,7 +24,7 @@ using namespace irr;
|
||||
|
||||
#include "utils/vec3.hpp"
|
||||
|
||||
class Kart;
|
||||
class AbstractKart;
|
||||
|
||||
/**
|
||||
* \ingroup graphics
|
||||
@ -78,7 +78,7 @@ private:
|
||||
|
||||
public:
|
||||
Referee();
|
||||
Referee(const Kart &kart);
|
||||
Referee(const AbstractKart &kart);
|
||||
~Referee();
|
||||
void selectReadySetGo(int rsg);
|
||||
void attachToSceneNode();
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include "config/stk_config.hpp"
|
||||
#include "graphics/irr_driver.hpp"
|
||||
#include "karts/controller/controller.hpp"
|
||||
#include "karts/kart.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "physics/btKart.hpp"
|
||||
|
||||
#include <IMeshSceneNode.h>
|
||||
@ -32,7 +32,7 @@ const int SkidMarks::m_start_alpha = 128;
|
||||
const int SkidMarks::m_start_grey = 32;
|
||||
|
||||
/** Initialises empty skid marks. */
|
||||
SkidMarks::SkidMarks(const Kart& kart, float width) : m_kart(kart)
|
||||
SkidMarks::SkidMarks(const AbstractKart& kart, float width) : m_kart(kart)
|
||||
{
|
||||
m_width = width;
|
||||
m_material = new video::SMaterial();
|
||||
|
@ -33,7 +33,7 @@ using namespace irr;
|
||||
#include "utils/no_copy.hpp"
|
||||
#include "utils/vec3.hpp"
|
||||
|
||||
class Kart;
|
||||
class AbstractKart;
|
||||
|
||||
/** \brief This class is responsible for drawing skid marks for a kart.
|
||||
* \ingroup graphics
|
||||
@ -42,7 +42,7 @@ class SkidMarks : public NoCopy
|
||||
{
|
||||
private:
|
||||
/** Reference to the kart to which these skidmarks belong. */
|
||||
const Kart &m_kart;
|
||||
const AbstractKart &m_kart;
|
||||
|
||||
/** True if the kart was skidding in the previous frame. */
|
||||
bool m_skid_marking;
|
||||
@ -102,7 +102,7 @@ private:
|
||||
static float m_avoid_z_fighting;
|
||||
|
||||
public:
|
||||
SkidMarks(const Kart& kart, float width=0.2f);
|
||||
SkidMarks(const AbstractKart& kart, float width=0.2f);
|
||||
~SkidMarks();
|
||||
void update (float dt, bool force_skid_marks=false,
|
||||
video::SColor* custom_color = NULL);
|
||||
|
@ -23,7 +23,9 @@
|
||||
#include "graphics/irr_driver.hpp"
|
||||
#include "io/file_manager.hpp"
|
||||
#include "karts/controller/controller.hpp"
|
||||
#include "karts/kart.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "karts/kart_properties.hpp"
|
||||
#include "karts/max_speed.hpp"
|
||||
#include "modes/world.hpp"
|
||||
#include "tracks/quad.hpp"
|
||||
#include "utils/constants.hpp"
|
||||
@ -36,7 +38,7 @@
|
||||
* \param kart Pointer to the kart to which the slip stream
|
||||
* belongs to.
|
||||
*/
|
||||
SlipStream::SlipStream(Kart* kart) : MovingTexture(0, 0), m_kart(kart)
|
||||
SlipStream::SlipStream(AbstractKart* kart) : MovingTexture(0, 0), m_kart(kart)
|
||||
{
|
||||
video::SMaterial m;
|
||||
m.BackfaceCulling = false;
|
||||
@ -233,7 +235,7 @@ void SlipStream::createMesh(const video::SMaterial &material)
|
||||
* 1 = collecting
|
||||
* 2 = using slip stream bonus
|
||||
*/
|
||||
void SlipStream::setIntensity(float f, const Kart *kart)
|
||||
void SlipStream::setIntensity(float f, const AbstractKart *kart)
|
||||
{
|
||||
if(!kart)
|
||||
{
|
||||
|
@ -30,7 +30,7 @@ using namespace irr;
|
||||
#include "graphics/moving_texture.hpp"
|
||||
#include "utils/no_copy.hpp"
|
||||
|
||||
class Kart;
|
||||
class AbstractKart;
|
||||
class Quad;
|
||||
|
||||
/**
|
||||
@ -40,7 +40,7 @@ class SlipStream : public MovingTexture
|
||||
{
|
||||
private:
|
||||
/** The kart to which this smoke belongs. */
|
||||
Kart *m_kart;
|
||||
AbstractKart *m_kart;
|
||||
|
||||
/** The scene node. */
|
||||
scene::IMeshSceneNode *m_node;
|
||||
@ -78,16 +78,16 @@ private:
|
||||
|
||||
/** The kart from which this kart gets slipstream. Used by the AI to
|
||||
** overtake the right kart. */
|
||||
Kart *m_target_kart;
|
||||
AbstractKart* m_target_kart;
|
||||
|
||||
void createMesh(const video::SMaterial &m);
|
||||
void setDebugColor(const video::SColor &color);
|
||||
public:
|
||||
SlipStream (Kart* kart);
|
||||
SlipStream (AbstractKart* kart);
|
||||
virtual ~SlipStream ();
|
||||
void reset();
|
||||
virtual void update(float dt);
|
||||
void setIntensity(float f, const Kart* kart);
|
||||
void setIntensity(float f, const AbstractKart* kart);
|
||||
float getSlipstreamPower();
|
||||
bool isSlipstreamReady() const;
|
||||
|
||||
@ -97,7 +97,7 @@ public:
|
||||
const Quad& getSlipstreamQuad() const { return *m_slipstream_quad; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the kart from which slipstream is 'collected'. */
|
||||
const Kart* getSlipstreamTarget() const {return m_target_kart;}
|
||||
const AbstractKart* getSlipstreamTarget() const {return m_target_kart;}
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns if slipstream is being used. */
|
||||
bool inUse() const {return m_slipstream_mode==SS_USE; }
|
||||
|
@ -828,6 +828,10 @@
|
||||
<Filter
|
||||
Name="karts"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\karts\abstract_kart.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\karts\emergency_animation.cpp"
|
||||
>
|
||||
@ -1974,6 +1978,10 @@
|
||||
<Filter
|
||||
Name="karts"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\karts\abstract_kart.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\karts\emergency_animation.hpp"
|
||||
>
|
||||
|
@ -3,8 +3,8 @@
|
||||
#include "guiengine/abstract_state_manager.hpp"
|
||||
#include "input/input.hpp"
|
||||
#include "input/input_device.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "karts/controller/player_controller.hpp"
|
||||
#include "karts/kart.hpp"
|
||||
#include "modes/world.hpp"
|
||||
#include "race/race_manager.hpp"
|
||||
#include "states_screens/state_manager.hpp"
|
||||
@ -136,7 +136,7 @@ void GamePadDevice::resetAxisDirection(const int axis,
|
||||
// ignore this while in menus
|
||||
if (StateManager::get()->getGameState() != GUIEngine::GAME) return;
|
||||
|
||||
Kart* pk = player->getKart();
|
||||
AbstractKart* pk = player->getKart();
|
||||
if (pk == NULL)
|
||||
{
|
||||
fprintf(stderr, "Error, trying to reset axis for an unknown player\n");
|
||||
|
@ -32,7 +32,7 @@
|
||||
#include "input/device_manager.hpp"
|
||||
#include "input/input.hpp"
|
||||
#include "karts/controller/controller.hpp"
|
||||
#include "karts/kart.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "modes/profile_world.hpp"
|
||||
#include "modes/world.hpp"
|
||||
#include "race/history.hpp"
|
||||
@ -42,6 +42,8 @@
|
||||
#include "states_screens/state_manager.hpp"
|
||||
#include "utils/string_utils.hpp"
|
||||
|
||||
#include <ISceneNode.h>
|
||||
|
||||
InputManager *input_manager;
|
||||
|
||||
using GUIEngine::EventPropagation;
|
||||
@ -128,7 +130,7 @@ void InputManager::handleStaticAction(int key, int value)
|
||||
{
|
||||
if (!world || !UserConfigParams::m_artist_debug_mode) break;
|
||||
|
||||
Kart* kart = world->getLocalPlayerKart(0);
|
||||
AbstractKart* kart = world->getLocalPlayerKart(0);
|
||||
if (kart == NULL) break;
|
||||
|
||||
kart->flyUp();
|
||||
@ -138,7 +140,7 @@ void InputManager::handleStaticAction(int key, int value)
|
||||
{
|
||||
if (!world || !UserConfigParams::m_artist_debug_mode) break;
|
||||
|
||||
Kart* kart = world->getLocalPlayerKart(0);
|
||||
AbstractKart* kart = world->getLocalPlayerKart(0);
|
||||
if (kart == NULL) break;
|
||||
|
||||
kart->flyDown();
|
||||
@ -147,7 +149,7 @@ void InputManager::handleStaticAction(int key, int value)
|
||||
case KEY_F1:
|
||||
if (UserConfigParams::m_artist_debug_mode && world)
|
||||
{
|
||||
Kart* kart = world->getLocalPlayerKart(0);
|
||||
AbstractKart* kart = world->getLocalPlayerKart(0);
|
||||
kart->setPowerup(PowerupManager::POWERUP_BUBBLEGUM, 10000);
|
||||
#ifdef FORCE_RESCUE_ON_FIRST_KART
|
||||
// Can be useful for debugging places where the AI gets into
|
||||
@ -159,42 +161,42 @@ void InputManager::handleStaticAction(int key, int value)
|
||||
case KEY_F2:
|
||||
if (UserConfigParams::m_artist_debug_mode && world)
|
||||
{
|
||||
Kart* kart = world->getLocalPlayerKart(0);
|
||||
AbstractKart* kart = world->getLocalPlayerKart(0);
|
||||
kart->setPowerup(PowerupManager::POWERUP_PLUNGER, 10000);
|
||||
}
|
||||
break;
|
||||
case KEY_F3:
|
||||
if (UserConfigParams::m_artist_debug_mode && world)
|
||||
{
|
||||
Kart* kart = world->getLocalPlayerKart(0);
|
||||
AbstractKart* kart = world->getLocalPlayerKart(0);
|
||||
kart->setPowerup(PowerupManager::POWERUP_CAKE, 10000);
|
||||
}
|
||||
break;
|
||||
case KEY_F4:
|
||||
if (UserConfigParams::m_artist_debug_mode && world)
|
||||
{
|
||||
Kart* kart = world->getLocalPlayerKart(0);
|
||||
AbstractKart* kart = world->getLocalPlayerKart(0);
|
||||
kart->setPowerup(PowerupManager::POWERUP_SWITCH, 10000);
|
||||
}
|
||||
break;
|
||||
case KEY_F5:
|
||||
if (UserConfigParams::m_artist_debug_mode && world)
|
||||
{
|
||||
Kart* kart = world->getLocalPlayerKart(0);
|
||||
AbstractKart* kart = world->getLocalPlayerKart(0);
|
||||
kart->setPowerup(PowerupManager::POWERUP_BOWLING, 10000);
|
||||
}
|
||||
break;
|
||||
case KEY_F6:
|
||||
if (UserConfigParams::m_artist_debug_mode && world)
|
||||
{
|
||||
Kart* kart = world->getLocalPlayerKart(0);
|
||||
AbstractKart* kart = world->getLocalPlayerKart(0);
|
||||
kart->setPowerup(PowerupManager::POWERUP_BUBBLEGUM, 10000);
|
||||
}
|
||||
break;
|
||||
case KEY_F7:
|
||||
if (UserConfigParams::m_artist_debug_mode && world)
|
||||
{
|
||||
Kart* kart = world->getLocalPlayerKart(0);
|
||||
AbstractKart* kart = world->getLocalPlayerKart(0);
|
||||
kart->setPowerup(PowerupManager::POWERUP_ZIPPER, 10000);
|
||||
}
|
||||
break;
|
||||
@ -216,7 +218,7 @@ void InputManager::handleStaticAction(int key, int value)
|
||||
}
|
||||
else
|
||||
{
|
||||
Kart* kart = world->getLocalPlayerKart(0);
|
||||
AbstractKart* kart = world->getLocalPlayerKart(0);
|
||||
kart->setEnergy(100.0f);
|
||||
}
|
||||
}
|
||||
@ -225,7 +227,7 @@ void InputManager::handleStaticAction(int key, int value)
|
||||
case KEY_F9:
|
||||
if (UserConfigParams::m_artist_debug_mode && world)
|
||||
{
|
||||
Kart* kart = world->getLocalPlayerKart(0);
|
||||
AbstractKart* kart = world->getLocalPlayerKart(0);
|
||||
if(control_is_pressed && race_manager->getMinorMode()!=
|
||||
RaceManager::MINOR_MODE_3_STRIKES)
|
||||
kart->setPowerup(PowerupManager::POWERUP_RUBBERBALL,
|
||||
@ -535,16 +537,14 @@ void InputManager::dispatchInput(Input::InputType type, int deviceID,
|
||||
if (StateManager::get()->getGameState() == GUIEngine::GAME &&
|
||||
!GUIEngine::ModalDialog::isADialogActive() )
|
||||
{
|
||||
// Find the corresponding PlayerKart from our ActivePlayer instance
|
||||
Kart* pk;
|
||||
|
||||
if (player == NULL)
|
||||
{
|
||||
// Prevent null pointer crash
|
||||
return;
|
||||
}
|
||||
|
||||
pk = player->getKart();
|
||||
// Find the corresponding PlayerKart from our ActivePlayer instance
|
||||
AbstractKart* pk = player->getKart();
|
||||
|
||||
if (pk == NULL)
|
||||
{
|
||||
|
@ -27,8 +27,9 @@
|
||||
#include "items/attachment_manager.hpp"
|
||||
#include "items/projectile_manager.hpp"
|
||||
#include "items/swatter.hpp"
|
||||
#include "karts/kart.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "karts/controller/controller.hpp"
|
||||
#include "karts/kart_properties.hpp"
|
||||
#include "modes/three_strikes_battle.hpp"
|
||||
#include "network/race_state.hpp"
|
||||
#include "network/network_manager.hpp"
|
||||
@ -36,7 +37,7 @@
|
||||
|
||||
/** Initialises the attachment each kart has.
|
||||
*/
|
||||
Attachment::Attachment(Kart* kart)
|
||||
Attachment::Attachment(AbstractKart* kart)
|
||||
{
|
||||
m_type = ATTACH_NOTHING;
|
||||
m_time_left = 0.0;
|
||||
@ -84,7 +85,8 @@ Attachment::~Attachment()
|
||||
* can be passed back to the previous owner). NULL if a no
|
||||
* previous owner exists.
|
||||
*/
|
||||
void Attachment::set(AttachmentType type, float time, Kart *current_kart)
|
||||
void Attachment::set(AttachmentType type, float time,
|
||||
AbstractKart *current_kart)
|
||||
{
|
||||
bool was_bomb = (m_type == ATTACH_BOMB);
|
||||
scene::ISceneNode* bomb_scene_node = NULL;
|
||||
@ -298,7 +300,7 @@ void Attachment::hitBanana(Item *item, int new_attachment)
|
||||
* the attachment for both karts.
|
||||
* \param other Pointer to the other kart hit.
|
||||
*/
|
||||
void Attachment::handleCollisionWithKart(Kart *other)
|
||||
void Attachment::handleCollisionWithKart(AbstractKart *other)
|
||||
{
|
||||
Attachment *attachment_other=other->getAttachment();
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include <IAnimatedMeshSceneNode.h>
|
||||
using namespace irr;
|
||||
|
||||
class Kart;
|
||||
class AbstractKart;
|
||||
class Item;
|
||||
class SFXBase;
|
||||
|
||||
@ -67,7 +67,7 @@ private:
|
||||
AttachmentType m_type;
|
||||
|
||||
/** Kart the attachment is attached to. */
|
||||
Kart *m_kart;
|
||||
AbstractKart *m_kart;
|
||||
|
||||
/** Time left till attachment expires. */
|
||||
float m_time_left;
|
||||
@ -81,7 +81,7 @@ private:
|
||||
*m_node;
|
||||
|
||||
/** Used by bombs so that it's not passed back to previous owner. */
|
||||
Kart *m_previous_owner;
|
||||
AbstractKart *m_previous_owner;
|
||||
|
||||
/** An optional attachment - additional functionality can be implemented
|
||||
* for certain attachments. */
|
||||
@ -94,13 +94,14 @@ private:
|
||||
SFXBase *m_bomb_sound;
|
||||
|
||||
public:
|
||||
Attachment(Kart* kart);
|
||||
Attachment(AbstractKart* kart);
|
||||
~Attachment();
|
||||
void clear ();
|
||||
void hitBanana(Item *item, int new_attachment=-1);
|
||||
void update (float dt);
|
||||
void handleCollisionWithKart(Kart *other);
|
||||
void set (AttachmentType type, float time, Kart *previous_kart=NULL);
|
||||
void handleCollisionWithKart(AbstractKart *other);
|
||||
void set (AttachmentType type, float time,
|
||||
AbstractKart *previous_kart=NULL);
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Sets the type of the attachment, but keeps the old time left value. */
|
||||
@ -117,7 +118,7 @@ public:
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the previous owner of this attachment, used in bombs that
|
||||
* are being passed between karts. */
|
||||
Kart* getPreviousOwner() const { return m_previous_owner; }
|
||||
AbstractKart* getPreviousOwner() const { return m_previous_owner; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns additional weight for the kart. */
|
||||
float weightAdjust() const {
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#include "vector3d.h"
|
||||
|
||||
class Kart;
|
||||
class AbstractKart;
|
||||
class Attachment;
|
||||
|
||||
/**
|
||||
@ -38,11 +38,11 @@ class AttachmentPlugin
|
||||
{
|
||||
protected:
|
||||
/** Kart the attachment is attached to. */
|
||||
Kart *m_kart;
|
||||
AbstractKart *m_kart;
|
||||
|
||||
public:
|
||||
/** Constructor for a plugin. */
|
||||
AttachmentPlugin(Kart *kart)
|
||||
AttachmentPlugin(AbstractKart *kart)
|
||||
{
|
||||
m_kart = kart;
|
||||
}
|
||||
|
@ -19,15 +19,16 @@
|
||||
#include "graphics/material.hpp"
|
||||
#include "io/xml_node.hpp"
|
||||
#include "items/bowling.hpp"
|
||||
#include "karts/kart.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "utils/random_generator.hpp"
|
||||
|
||||
float Bowling::m_st_max_distance; // maximum distance for a bowling ball to be attracted
|
||||
float Bowling::m_st_max_distance_squared;
|
||||
float Bowling::m_st_force_to_target;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
Bowling::Bowling(Kart *kart) : Flyable(kart, PowerupManager::POWERUP_BOWLING,
|
||||
50.0f /* mass */)
|
||||
Bowling::Bowling(AbstractKart *kart)
|
||||
: Flyable(kart, PowerupManager::POWERUP_BOWLING, 50.0f /* mass */)
|
||||
{
|
||||
float y_offset = 0.5f*kart->getKartLength() + m_extend.getZ()*0.5f;
|
||||
|
||||
@ -94,7 +95,7 @@ void Bowling::init(const XMLNode &node, scene::IMesh *bowling)
|
||||
* \param kart The kart that was hit.
|
||||
* \returns The string to display.
|
||||
*/
|
||||
const core::stringw Bowling::getHitString(const Kart *kart) const
|
||||
const core::stringw Bowling::getHitString(const AbstractKart *kart) const
|
||||
{
|
||||
RandomGenerator r;
|
||||
|
||||
@ -145,7 +146,7 @@ bool Bowling::updateAndDelete(float dt)
|
||||
if(can_be_deleted)
|
||||
return true;
|
||||
|
||||
const Kart *kart=0;
|
||||
const AbstractKart *kart=0;
|
||||
Vec3 direction;
|
||||
float minDistance;
|
||||
getClosestKart(&kart, &minDistance, &direction);
|
||||
@ -204,7 +205,7 @@ bool Bowling::updateAndDelete(float dt)
|
||||
* \returns True if there was actually a hit (i.e. not owner, and target is
|
||||
* not immune), false otherwise.
|
||||
*/
|
||||
bool Bowling::hit(Kart* kart, PhysicalObject* obj)
|
||||
bool Bowling::hit(AbstractKart* kart, PhysicalObject* obj)
|
||||
{
|
||||
bool was_real_hit = Flyable::hit(kart, obj);
|
||||
if(was_real_hit)
|
||||
|
@ -41,11 +41,11 @@ private:
|
||||
static float m_st_force_to_target;
|
||||
|
||||
public:
|
||||
Bowling(Kart* kart);
|
||||
Bowling(AbstractKart* kart);
|
||||
static void init(const XMLNode &node, scene::IMesh *bowling);
|
||||
virtual bool updateAndDelete(float dt);
|
||||
virtual const core::stringw getHitString(const Kart *kart) const;
|
||||
virtual bool hit(Kart* kart, PhysicalObject* obj=NULL);
|
||||
virtual const core::stringw getHitString(const AbstractKart *kart) const;
|
||||
virtual bool hit(AbstractKart* kart, PhysicalObject* obj=NULL);
|
||||
|
||||
/** Returns the sfx to use when the bowling ball explodes. */
|
||||
const char* getExplosionSound() const { return "strike"; }
|
||||
|
@ -22,13 +22,14 @@
|
||||
#include "items/cake.hpp"
|
||||
|
||||
#include "io/xml_node.hpp"
|
||||
#include "karts/kart.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "utils/constants.hpp"
|
||||
#include "utils/random_generator.hpp"
|
||||
|
||||
float Cake::m_st_max_distance_squared;
|
||||
float Cake::m_gravity;
|
||||
|
||||
Cake::Cake (Kart *kart) : Flyable(kart, PowerupManager::POWERUP_CAKE)
|
||||
Cake::Cake (AbstractKart *kart) : Flyable(kart, PowerupManager::POWERUP_CAKE)
|
||||
{
|
||||
m_target = NULL;
|
||||
|
||||
@ -59,7 +60,7 @@ Cake::Cake (Kart *kart) : Flyable(kart, PowerupManager::POWERUP_CAKE)
|
||||
|
||||
// Find closest kart in front of the current one
|
||||
const bool backwards = kart->getControls().m_look_back;
|
||||
const Kart *closest_kart=NULL;
|
||||
const AbstractKart *closest_kart=NULL;
|
||||
Vec3 direction;
|
||||
float kart_dist_squared;
|
||||
getClosestKart(&closest_kart, &kart_dist_squared, &direction,
|
||||
@ -74,7 +75,7 @@ Cake::Cake (Kart *kart) : Flyable(kart, PowerupManager::POWERUP_CAKE)
|
||||
if(closest_kart != NULL && kart_dist_squared < m_st_max_distance_squared &&
|
||||
m_speed>closest_kart->getSpeed())
|
||||
{
|
||||
m_target = (Kart*)closest_kart;
|
||||
m_target = (AbstractKart*)closest_kart;
|
||||
|
||||
float fire_angle = 0.0f;
|
||||
getLinearKartItemIntersection (kart->getXYZ(), closest_kart,
|
||||
@ -138,7 +139,7 @@ void Cake::init(const XMLNode &node, scene::IMesh *cake_model)
|
||||
* \param The kart that was hit (ignored here).
|
||||
* \returns The string to display.
|
||||
*/
|
||||
const core::stringw Cake::getHitString(const Kart *kart) const
|
||||
const core::stringw Cake::getHitString(const AbstractKart *kart) const
|
||||
{
|
||||
const int CAKE_STRINGS_AMOUNT = 3;
|
||||
RandomGenerator r;
|
||||
@ -161,7 +162,7 @@ const core::stringw Cake::getHitString(const Kart *kart) const
|
||||
* \returns True if there was actually a hit (i.e. not owner, and target is
|
||||
* not immune), false otherwise.
|
||||
*/
|
||||
bool Cake::hit(Kart* kart, PhysicalObject* obj)
|
||||
bool Cake::hit(AbstractKart* kart, PhysicalObject* obj)
|
||||
{
|
||||
bool was_real_hit = Flyable::hit(kart, obj);
|
||||
if(was_real_hit)
|
||||
|
@ -47,11 +47,11 @@ private:
|
||||
/** Which kart is targeted by this projectile (NULL if none). */
|
||||
Moveable* m_target;
|
||||
public:
|
||||
Cake (Kart *kart);
|
||||
Cake (AbstractKart *kart);
|
||||
static void init (const XMLNode &node, scene::IMesh *cake_model);
|
||||
virtual const core::stringw
|
||||
getHitString(const Kart *kart) const;
|
||||
virtual bool hit(Kart* kart, PhysicalObject* obj=NULL);
|
||||
getHitString(const AbstractKart *kart) const;
|
||||
virtual bool hit(AbstractKart* kart, PhysicalObject* obj=NULL);
|
||||
// ------------------------------------------------------------------------
|
||||
virtual void hitTrack () { hit(NULL); }
|
||||
// ------------------------------------------------------------------------
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include "graphics/stars.hpp"
|
||||
#include "io/xml_node.hpp"
|
||||
#include "items/projectile_manager.hpp"
|
||||
#include "karts/kart.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "modes/world.hpp"
|
||||
#include "network/flyable_info.hpp"
|
||||
#include "tracks/track.hpp"
|
||||
@ -51,7 +51,8 @@ float Flyable::m_st_force_updown[PowerupManager::POWERUP_MAX];
|
||||
Vec3 Flyable::m_st_extend [PowerupManager::POWERUP_MAX];
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
Flyable::Flyable(Kart *kart, PowerupManager::PowerupType type, float mass)
|
||||
Flyable::Flyable(AbstractKart *kart, PowerupManager::PowerupType type,
|
||||
float mass)
|
||||
: Moveable(), TerrainInfo()
|
||||
{
|
||||
// get the appropriate data from the static fields
|
||||
@ -196,8 +197,9 @@ Flyable::~Flyable()
|
||||
* behind). Useful e.g. for throwing projectiles in front only.
|
||||
*/
|
||||
|
||||
void Flyable::getClosestKart(const Kart **minKart, float *minDistSquared,
|
||||
Vec3 *minDelta, const Kart* inFrontOf,
|
||||
void Flyable::getClosestKart(const AbstractKart **minKart,
|
||||
float *minDistSquared, Vec3 *minDelta,
|
||||
const AbstractKart* inFrontOf,
|
||||
const bool backwards) const
|
||||
{
|
||||
btTransform trans_projectile = (inFrontOf != NULL ? inFrontOf->getTrans()
|
||||
@ -209,7 +211,7 @@ void Flyable::getClosestKart(const Kart **minKart, float *minDistSquared,
|
||||
World *world = World::getWorld();
|
||||
for(unsigned int i=0 ; i<world->getNumKarts(); i++ )
|
||||
{
|
||||
Kart *kart = world->getKart(i);
|
||||
AbstractKart *kart = world->getKart(i);
|
||||
// If a kart has star effect shown, the kart is immune, so
|
||||
// it is not considered a target anymore.
|
||||
if(kart->isEliminated() || kart == m_owner ||
|
||||
@ -268,7 +270,7 @@ void Flyable::getClosestKart(const Kart **minKart, float *minDistSquared,
|
||||
* \param up_velocity Returns the upwards velocity to use for the item.
|
||||
*/
|
||||
void Flyable::getLinearKartItemIntersection (const Vec3 &origin,
|
||||
const Kart *target_kart,
|
||||
const AbstractKart *target_kart,
|
||||
float item_XZ_speed,
|
||||
float gravity, float forw_offset,
|
||||
float *fire_angle,
|
||||
@ -419,7 +421,7 @@ void Flyable::updateFromServer(const FlyableInfo &f, float dt)
|
||||
* that's too close to the shoter hits the shoter).
|
||||
* \param kart Kart who was hit.
|
||||
*/
|
||||
bool Flyable::isOwnerImmunity(const Kart* kart_hit) const
|
||||
bool Flyable::isOwnerImmunity(const AbstractKart* kart_hit) const
|
||||
{
|
||||
return m_owner_has_temporary_immunity &&
|
||||
kart_hit == m_owner &&
|
||||
@ -433,7 +435,7 @@ bool Flyable::isOwnerImmunity(const Kart* kart_hit) const
|
||||
* \return True if there was actually a hit (i.e. not owner, and target is
|
||||
* not immune), false otherwise.
|
||||
*/
|
||||
bool Flyable::hit(Kart *kart_hit, PhysicalObject* object)
|
||||
bool Flyable::hit(AbstractKart *kart_hit, PhysicalObject* object)
|
||||
{
|
||||
// the owner of this flyable should not be hit by his own flyable
|
||||
if(isOwnerImmunity(kart_hit)) return false;
|
||||
@ -461,14 +463,14 @@ bool Flyable::hit(Kart *kart_hit, PhysicalObject* object)
|
||||
/** Creates the explosion physical effect, i.e. pushes the karts and ph
|
||||
* appropriately. The corresponding visual/sfx needs to be added manually!
|
||||
*/
|
||||
void Flyable::explode(Kart *kart_hit, PhysicalObject *object)
|
||||
void Flyable::explode(AbstractKart *kart_hit, PhysicalObject *object)
|
||||
{
|
||||
// Apply explosion effect
|
||||
// ----------------------
|
||||
World *world = World::getWorld();
|
||||
for ( unsigned int i = 0 ; i < world->getNumKarts() ; i++ )
|
||||
{
|
||||
Kart *kart = world->getKart(i);
|
||||
AbstractKart *kart = world->getKart(i);
|
||||
// Handle the actual explosion. The kart that fired a flyable will
|
||||
// only be affected if it's a direct hit. This allows karts to use
|
||||
// rockets on short distance.
|
||||
|
@ -33,9 +33,9 @@ using namespace irr;
|
||||
#include "karts/moveable.hpp"
|
||||
#include "tracks/terrain_info.hpp"
|
||||
|
||||
class AbstractKart;
|
||||
class FlyableInfo;
|
||||
class HitEffect;
|
||||
class Kart;
|
||||
class PhysicalObject;
|
||||
class XMLNode;
|
||||
|
||||
@ -71,7 +71,7 @@ private:
|
||||
bool m_do_terrain_info;
|
||||
protected:
|
||||
/** Kart which shot this flyable. */
|
||||
Kart* m_owner;
|
||||
AbstractKart* m_owner;
|
||||
|
||||
/** Type of the powerup. */
|
||||
PowerupManager::PowerupType
|
||||
@ -136,14 +136,14 @@ protected:
|
||||
* with it for a short time. */
|
||||
bool m_owner_has_temporary_immunity;
|
||||
|
||||
void getClosestKart(const Kart **minKart,
|
||||
void getClosestKart(const AbstractKart **minKart,
|
||||
float *minDistSquared,
|
||||
Vec3 *minDelta,
|
||||
const Kart* inFrontOf=NULL,
|
||||
const AbstractKart* inFrontOf=NULL,
|
||||
const bool backwards=false) const;
|
||||
|
||||
void getLinearKartItemIntersection(const Vec3 &origin,
|
||||
const Kart *target_kart,
|
||||
const AbstractKart *target_kart,
|
||||
float item_XY_velocity, float gravity,
|
||||
float forw_offset,
|
||||
float *fire_angle, float *up_velocity);
|
||||
@ -160,18 +160,19 @@ protected:
|
||||
const btTransform* customDirection=NULL);
|
||||
public:
|
||||
|
||||
Flyable (Kart* kart, PowerupManager::PowerupType type,
|
||||
Flyable (AbstractKart* kart,
|
||||
PowerupManager::PowerupType type,
|
||||
float mass=1.0f);
|
||||
virtual ~Flyable ();
|
||||
static void init (const XMLNode &node, scene::IMesh *model,
|
||||
PowerupManager::PowerupType type);
|
||||
virtual bool updateAndDelete(float);
|
||||
virtual const core::stringw getHitString(const Kart *kart) const = 0;
|
||||
virtual const core::stringw getHitString(const AbstractKart *kart) const = 0;
|
||||
virtual HitEffect* getHitEffect() const;
|
||||
void updateFromServer(const FlyableInfo &f, float dt);
|
||||
bool isOwnerImmunity(const Kart *kart_hit) const;
|
||||
virtual bool hit(Kart* kart, PhysicalObject* obj=NULL);
|
||||
void explode(Kart* kart, PhysicalObject* obj=NULL);
|
||||
bool isOwnerImmunity(const AbstractKart *kart_hit) const;
|
||||
virtual bool hit(AbstractKart* kart, PhysicalObject* obj=NULL);
|
||||
void explode(AbstractKart* kart, PhysicalObject* obj=NULL);
|
||||
// ------------------------------------------------------------------------
|
||||
/** If true the up velocity of the flyable will be adjust so that the
|
||||
* flyable stays at a height close to the average height.
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#include "graphics/irr_driver.hpp"
|
||||
#include "graphics/lod_node.hpp"
|
||||
#include "karts/kart.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "modes/three_strikes_battle.hpp"
|
||||
#include "modes/world.hpp"
|
||||
#include "tracks/track.hpp"
|
||||
@ -217,7 +217,7 @@ void Item::reset()
|
||||
* affected by its own items.
|
||||
* \param parent Kart that dropped the item.
|
||||
*/
|
||||
void Item::setParent(Kart* parent)
|
||||
void Item::setParent(AbstractKart* parent)
|
||||
{
|
||||
m_event_handler = parent;
|
||||
m_deactive_time = 1.5f;
|
||||
@ -274,7 +274,7 @@ void Item::update(float dt)
|
||||
* has been collected, and the time to return to the parameter.
|
||||
* \param t Time till the object reappears (defaults to 2 seconds).
|
||||
*/
|
||||
void Item::collected(const Kart *kart, float t)
|
||||
void Item::collected(const AbstractKart *kart, float t)
|
||||
{
|
||||
m_collected = true;
|
||||
m_event_handler = kart;
|
||||
|
@ -30,9 +30,10 @@ namespace irr
|
||||
}
|
||||
using namespace irr;
|
||||
|
||||
#include "karts/kart.hpp"
|
||||
#include "utils/no_copy.hpp"
|
||||
#include "utils/vec3.hpp"
|
||||
|
||||
class AbstractKart;
|
||||
class LODNode;
|
||||
class Item;
|
||||
|
||||
@ -118,7 +119,7 @@ private:
|
||||
|
||||
/** Optionally set this if this item was laid by a particular kart. in
|
||||
* this case the 'm_deactive_time' will also be set - see below. */
|
||||
const Kart *m_event_handler;
|
||||
const AbstractKart *m_event_handler;
|
||||
|
||||
/** Optionally if item was placed by a kart, a timer can be used to
|
||||
* temporarly deactivate collision so a kart is not hit by its own item */
|
||||
@ -145,17 +146,20 @@ public:
|
||||
unsigned int item_id);
|
||||
virtual ~Item ();
|
||||
void update (float delta);
|
||||
virtual void collected(const Kart *kart, float t=2.0f);
|
||||
virtual void collected(const AbstractKart *kart, float t=2.0f);
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns true if the Kart is close enough to hit this item, and
|
||||
* the item is not deactivated anymore.
|
||||
/** Returns true if the Kart is close enough to hit this item, the item is
|
||||
* not deactivated anymore, and it wasn't placed by this kart (this is
|
||||
* e.g. used to avoid that a kart hits a bubble gum it just dropped).
|
||||
* \param kart Kart to test.
|
||||
* \param xyz Location of kart (avoiding to use kart->getXYZ() so that
|
||||
* kart.hpp does not need to be included here).
|
||||
*/
|
||||
bool hitKart (Kart* kart ) const
|
||||
bool hitKart (const AbstractKart *kart, const Vec3 &xyz) const
|
||||
{
|
||||
return (m_event_handler!=kart || m_deactive_time <=0) &&
|
||||
(kart->getXYZ()-m_xyz).length2()<m_distance_2;
|
||||
(xyz-m_xyz).length2()<m_distance_2;
|
||||
} // hitKart
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
@ -188,7 +192,7 @@ public:
|
||||
/** Returns the time the item is disabled for. */
|
||||
float getDisableTime() const { return m_time_till_return; }
|
||||
// ------------------------------------------------------------------------
|
||||
void setParent(Kart* parent);
|
||||
void setParent(AbstractKart* parent);
|
||||
void reset();
|
||||
void switchTo(ItemType type, scene::IMesh *mesh, scene::IMesh *lowmesh);
|
||||
void switchBack();
|
||||
|
@ -28,11 +28,14 @@
|
||||
#include "graphics/material.hpp"
|
||||
#include "graphics/material_manager.hpp"
|
||||
#include "io/file_manager.hpp"
|
||||
#include "karts/kart.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "network/network_manager.hpp"
|
||||
#include "tracks/track.hpp"
|
||||
#include "utils/string_utils.hpp"
|
||||
|
||||
#include <IMesh.h>
|
||||
#include <IAnimatedMesh.h>
|
||||
|
||||
ItemManager* item_manager;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -162,7 +165,7 @@ void ItemManager::loadDefaultItems()
|
||||
* is affected by its own items.
|
||||
*/
|
||||
Item* ItemManager::newItem(Item::ItemType type, const Vec3& xyz,
|
||||
const Vec3 &normal, Kart *parent)
|
||||
const Vec3 &normal, AbstractKart *parent)
|
||||
{
|
||||
// Find where the item can be stored in the index list: either in a
|
||||
// previously deleted entry, otherwise at the end.
|
||||
@ -213,7 +216,7 @@ Item* ItemManager::newItem(const Vec3& xyz, float distance, TriggerItemListener*
|
||||
/** Set an item as collected.
|
||||
* This function is called on the server when an item is collected, or on the
|
||||
* client upon receiving information about collected items. */
|
||||
void ItemManager::collectedItem(int item_id, Kart *kart, int add_info)
|
||||
void ItemManager::collectedItem(int item_id, AbstractKart *kart, int add_info)
|
||||
{
|
||||
Item *item=m_all_items[item_id];
|
||||
assert(item);
|
||||
@ -226,7 +229,7 @@ void ItemManager::collectedItem(int item_id, Kart *kart, int add_info)
|
||||
* collectedItem if an item was collected.
|
||||
* \param kart Pointer to the kart.
|
||||
*/
|
||||
void ItemManager::checkItemHit(Kart* kart)
|
||||
void ItemManager::checkItemHit(AbstractKart* kart)
|
||||
{
|
||||
// Only do this on the server
|
||||
if(network_manager->getMode()==NetworkManager::NW_CLIENT) return;
|
||||
@ -235,7 +238,9 @@ void ItemManager::checkItemHit(Kart* kart)
|
||||
i!=m_all_items.end(); i++)
|
||||
{
|
||||
if((!*i) || (*i)->wasCollected()) continue;
|
||||
if((*i)->hitKart(kart))
|
||||
// To allow inlining and avoid including kart.hpp in item.hpp,
|
||||
// we pass the kart and the position separately.
|
||||
if((*i)->hitKart(kart, kart->getXYZ()))
|
||||
{
|
||||
collectedItem(i-m_all_items.begin(), kart);
|
||||
} // if hit
|
||||
|
@ -20,8 +20,9 @@
|
||||
#define HEADER_ITEMMANAGER_HPP
|
||||
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "items/item.hpp"
|
||||
#include "utils/no_copy.hpp"
|
||||
@ -61,15 +62,17 @@ public:
|
||||
~ItemManager();
|
||||
void loadDefaultItems();
|
||||
Item* newItem (Item::ItemType type, const Vec3& xyz,
|
||||
const Vec3 &normal, Kart* parent=NULL);
|
||||
Item* newItem (const Vec3& xyz, float distance, TriggerItemListener* listener);
|
||||
const Vec3 &normal,
|
||||
AbstractKart* parent=NULL);
|
||||
Item* newItem (const Vec3& xyz, float distance,
|
||||
TriggerItemListener* listener);
|
||||
void update (float delta);
|
||||
void checkItemHit (Kart* kart);
|
||||
void checkItemHit (AbstractKart* kart);
|
||||
void cleanup ();
|
||||
void reset ();
|
||||
void removeTextures ();
|
||||
void setUserFilename (char *s) {m_user_filename=s;}
|
||||
void collectedItem (int item_id, Kart *kart,
|
||||
void collectedItem (int item_id, AbstractKart *kart,
|
||||
int add_info=-1);
|
||||
void switchItems ();
|
||||
void setSwitchItems(const std::vector<int> &switch_items);
|
||||
|
@ -25,7 +25,8 @@
|
||||
#include "io/xml_node.hpp"
|
||||
#include "items/rubber_band.hpp"
|
||||
#include "items/projectile_manager.hpp"
|
||||
#include "karts/kart.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "karts/kart_properties.hpp"
|
||||
#include "modes/world.hpp"
|
||||
#include "physics/physical_object.hpp"
|
||||
#include "tracks/track.hpp"
|
||||
@ -35,7 +36,8 @@
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
Plunger::Plunger(Kart *kart) : Flyable(kart, PowerupManager::POWERUP_PLUNGER)
|
||||
Plunger::Plunger(AbstractKart *kart)
|
||||
: Flyable(kart, PowerupManager::POWERUP_PLUNGER)
|
||||
{
|
||||
const float gravity = 0.0f;
|
||||
|
||||
@ -47,7 +49,7 @@ Plunger::Plunger(Kart *kart) : Flyable(kart, PowerupManager::POWERUP_PLUNGER)
|
||||
m_reverse_mode = kart->getControls().m_look_back;
|
||||
|
||||
// find closest kart in front of the current one
|
||||
const Kart *closest_kart=0;
|
||||
const AbstractKart *closest_kart=0;
|
||||
Vec3 direction;
|
||||
float kart_dist_2;
|
||||
getClosestKart(&closest_kart, &kart_dist_2, &direction,
|
||||
@ -120,7 +122,7 @@ void Plunger::init(const XMLNode &node, scene::IMesh *plunger_model)
|
||||
* \param The kart that was hit (ignored here).
|
||||
* \returns The string to display.
|
||||
*/
|
||||
const core::stringw Plunger::getHitString(const Kart *kart) const
|
||||
const core::stringw Plunger::getHitString(const AbstractKart *kart) const
|
||||
{
|
||||
const int PLUNGER_IN_FACE_STRINGS_AMOUNT = 2;
|
||||
RandomGenerator r;
|
||||
@ -173,7 +175,7 @@ bool Plunger::updateAndDelete(float dt)
|
||||
* \returns True if there was actually a hit (i.e. not owner, and target is
|
||||
* not immune), false otherwise.
|
||||
*/
|
||||
bool Plunger::hit(Kart *kart, PhysicalObject *obj)
|
||||
bool Plunger::hit(AbstractKart *kart, PhysicalObject *obj)
|
||||
{
|
||||
if(isOwnerImmunity(kart)) return false;
|
||||
|
||||
|
@ -27,7 +27,7 @@ using namespace irr;
|
||||
|
||||
#include "items/flyable.hpp"
|
||||
|
||||
class Kart;
|
||||
class AbstractKart;
|
||||
class PhysicalObject;
|
||||
class RubberBand;
|
||||
class XMLNode;
|
||||
@ -46,13 +46,13 @@ private:
|
||||
|
||||
bool m_reverse_mode;
|
||||
public:
|
||||
Plunger(Kart *kart);
|
||||
Plunger(AbstractKart *kart);
|
||||
~Plunger();
|
||||
static void init(const XMLNode &node, scene::IMesh* missile);
|
||||
virtual bool updateAndDelete(float dt);
|
||||
virtual void hitTrack ();
|
||||
virtual const core::stringw getHitString(const Kart *kart) const;
|
||||
virtual bool hit (Kart *kart, PhysicalObject *obj=NULL);
|
||||
virtual const core::stringw getHitString(const AbstractKart *kart) const;
|
||||
virtual bool hit (AbstractKart *kart, PhysicalObject *obj=NULL);
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Sets the keep-alive value. Setting it to 0 will remove the plunger
|
||||
|
@ -25,8 +25,9 @@
|
||||
#include "items/attachment.hpp"
|
||||
#include "items/item_manager.hpp"
|
||||
#include "items/projectile_manager.hpp"
|
||||
#include "karts/kart.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "karts/controller/controller.hpp"
|
||||
#include "karts/kart_properties.hpp"
|
||||
#include "modes/world.hpp"
|
||||
#include "network/network_manager.hpp"
|
||||
#include "network/race_state.hpp"
|
||||
@ -90,7 +91,7 @@ const wchar_t* getSwapperString()
|
||||
/** Constructor, stores the kart to which this powerup belongs.
|
||||
* \param kart The kart to which this powerup belongs.
|
||||
*/
|
||||
Powerup::Powerup(Kart* kart)
|
||||
Powerup::Powerup(AbstractKart* kart)
|
||||
{
|
||||
m_owner = kart;
|
||||
m_sound_use = NULL;
|
||||
@ -309,7 +310,7 @@ void Powerup::use()
|
||||
//by the bananas) to the kart in the 1st position.
|
||||
for(unsigned int i = 0 ; i < world->getNumKarts(); ++i)
|
||||
{
|
||||
Kart *kart=world->getKart(i);
|
||||
AbstractKart *kart=world->getKart(i);
|
||||
if(kart->isEliminated()) continue;
|
||||
if(kart == m_owner) continue;
|
||||
if(kart->getPosition() == 1)
|
||||
@ -342,13 +343,13 @@ void Powerup::use()
|
||||
|
||||
case PowerupManager::POWERUP_PARACHUTE:
|
||||
{
|
||||
Kart* player_kart = NULL;
|
||||
AbstractKart* player_kart = NULL;
|
||||
//Attach a parachutte(that last twice as long as the
|
||||
//one from the bananas) to all the karts that
|
||||
//are in front of this one.
|
||||
for(unsigned int i = 0 ; i < world->getNumKarts(); ++i)
|
||||
{
|
||||
Kart *kart=world->getKart(i);
|
||||
AbstractKart *kart=world->getKart(i);
|
||||
if(kart->isEliminated() || kart== m_owner) continue;
|
||||
if(m_owner->getPosition() > kart->getPosition())
|
||||
{
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include "utils/no_copy.hpp"
|
||||
#include "utils/random_generator.hpp"
|
||||
|
||||
class Kart;
|
||||
class AbstractKart;
|
||||
class Item;
|
||||
class SFXBase;
|
||||
|
||||
@ -48,10 +48,10 @@ private:
|
||||
int m_number;
|
||||
|
||||
/** The owner (kart) of this powerup. */
|
||||
Kart* m_owner;
|
||||
AbstractKart* m_owner;
|
||||
|
||||
public:
|
||||
Powerup (Kart* kart_);
|
||||
Powerup (AbstractKart* kart_);
|
||||
~Powerup ();
|
||||
void set (PowerupManager::PowerupType _type, int n=1);
|
||||
void reset ();
|
||||
|
@ -151,7 +151,7 @@ void ProjectileManager::updateClient(float dt)
|
||||
|
||||
} // updateClient
|
||||
// -----------------------------------------------------------------------------
|
||||
Flyable *ProjectileManager::newProjectile(Kart *kart, Track* track,
|
||||
Flyable *ProjectileManager::newProjectile(AbstractKart *kart, Track* track,
|
||||
PowerupManager::PowerupType type)
|
||||
{
|
||||
Flyable *f;
|
||||
|
@ -30,11 +30,11 @@ namespace irr
|
||||
#include "items/powerup_manager.hpp"
|
||||
#include "utils/no_copy.hpp"
|
||||
|
||||
class Vec3;
|
||||
class Kart;
|
||||
class HitEffect;
|
||||
class AbstractKart;
|
||||
class Flyable;
|
||||
class HitEffect;
|
||||
class Track;
|
||||
class Vec3;
|
||||
|
||||
/**
|
||||
* \ingroup items
|
||||
@ -61,7 +61,7 @@ public:
|
||||
void loadData ();
|
||||
void cleanup ();
|
||||
void update (float dt);
|
||||
Flyable* newProjectile (Kart *kart, Track* track,
|
||||
Flyable* newProjectile (AbstractKart *kart, Track* track,
|
||||
PowerupManager::PowerupType type);
|
||||
void Deactivate (Flyable *p) {}
|
||||
void removeTextures ();
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include "audio/sfx_manager.hpp"
|
||||
#include "items/attachment.hpp"
|
||||
#include "items/projectile_manager.hpp"
|
||||
#include "karts/kart.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "modes/linear_world.hpp"
|
||||
#include "physics/btKart.hpp"
|
||||
#include "physics/triangle_mesh.hpp"
|
||||
@ -43,7 +43,7 @@ int RubberBall::m_next_id = 0;
|
||||
// Debug only, so that we can get a feel on how well balls are aiming etc.
|
||||
#undef PRINT_BALL_REMOVE_INFO
|
||||
|
||||
RubberBall::RubberBall(Kart *kart)
|
||||
RubberBall::RubberBall(AbstractKart *kart)
|
||||
: Flyable(kart, PowerupManager::POWERUP_RUBBERBALL, 0.0f /* mass */),
|
||||
TrackSector()
|
||||
{
|
||||
@ -187,7 +187,7 @@ unsigned int RubberBall::getSuccessorToHitTarget(unsigned int node_index,
|
||||
if(lin_world)
|
||||
{
|
||||
unsigned int sect =
|
||||
lin_world->getSectorForKart(m_target->getWorldKartId());
|
||||
lin_world->getSectorForKart(m_target);
|
||||
succ = QuadGraph::get()->getNode(node_index).getSuccessorToReach(sect);
|
||||
}
|
||||
if(dist)
|
||||
@ -294,7 +294,7 @@ void RubberBall::init(const XMLNode &node, scene::IMesh *bowling)
|
||||
* \param The kart that was hit (ignored here).
|
||||
* \returns The string to display.
|
||||
*/
|
||||
const core::stringw RubberBall::getHitString(const Kart *kart) const
|
||||
const core::stringw RubberBall::getHitString(const AbstractKart *kart) const
|
||||
{
|
||||
const int COUNT = 2;
|
||||
RandomGenerator r;
|
||||
@ -686,7 +686,7 @@ void RubberBall::updateDistanceToTarget()
|
||||
* \params object The object that was hit (NULL if none).
|
||||
* \returns True if
|
||||
*/
|
||||
bool RubberBall::hit(Kart* kart, PhysicalObject* object)
|
||||
bool RubberBall::hit(AbstractKart* kart, PhysicalObject* object)
|
||||
{
|
||||
#ifdef PRINT_BALL_REMOVE_INFO
|
||||
if(kart)
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include "items/flyable.hpp"
|
||||
#include "tracks/track_sector.hpp"
|
||||
|
||||
class Kart;
|
||||
class AbstractKart;
|
||||
class QuadGraph;
|
||||
class SFXBase;
|
||||
|
||||
@ -99,7 +99,7 @@ private:
|
||||
static float m_st_early_target_factor;
|
||||
|
||||
/** A pointer to the target kart. */
|
||||
const Kart *m_target;
|
||||
const AbstractKart *m_target;
|
||||
|
||||
/** The last graph node who's coordinates are stored in
|
||||
* m_control_points[3]. */
|
||||
@ -197,12 +197,12 @@ private:
|
||||
float getMaxTerrainHeight(const Vec3 &vertical_offset) const;
|
||||
bool checkTunneling();
|
||||
public:
|
||||
RubberBall (Kart* kart);
|
||||
RubberBall (AbstractKart* kart);
|
||||
virtual ~RubberBall();
|
||||
static void init(const XMLNode &node, scene::IMesh *bowling);
|
||||
virtual bool updateAndDelete(float dt);
|
||||
virtual bool hit(Kart* kart, PhysicalObject* obj=NULL);
|
||||
virtual const core::stringw getHitString(const Kart *kart) const;
|
||||
virtual bool hit(AbstractKart* kart, PhysicalObject* obj=NULL);
|
||||
virtual const core::stringw getHitString(const AbstractKart *kart) const;
|
||||
// ------------------------------------------------------------------------
|
||||
/** This object does not create an explosion, all affects on
|
||||
* karts are handled by this hit() function. */
|
||||
|
@ -24,12 +24,15 @@
|
||||
#include "graphics/material_manager.hpp"
|
||||
#include "items/plunger.hpp"
|
||||
#include "items/projectile_manager.hpp"
|
||||
#include "karts/kart.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "karts/kart_properties.hpp"
|
||||
#include "karts/max_speed.hpp"
|
||||
#include "modes/world.hpp"
|
||||
#include "physics/physics.hpp"
|
||||
#include "race/race_manager.hpp"
|
||||
#include "utils/string_utils.hpp"
|
||||
|
||||
#include <IMesh.h>
|
||||
|
||||
const wchar_t* getPlungerString()
|
||||
{
|
||||
@ -59,8 +62,8 @@ const wchar_t* getPlungerString()
|
||||
* can trigger an explosion)
|
||||
* \param kart Reference to the kart.
|
||||
*/
|
||||
RubberBand::RubberBand(Plunger *plunger, Kart *kart) :
|
||||
m_plunger(plunger), m_owner(kart)
|
||||
RubberBand::RubberBand(Plunger *plunger, AbstractKart *kart)
|
||||
: m_plunger(plunger), m_owner(kart)
|
||||
{
|
||||
video::SColor color(77, 179, 0, 0);
|
||||
video::SMaterial m;
|
||||
@ -228,7 +231,7 @@ void RubberBand::checkForHit(const Vec3 &k, const Vec3 &p)
|
||||
* \param track _xyz The coordinated where the track was hit (NULL if a kart
|
||||
* was hit.
|
||||
*/
|
||||
void RubberBand::hit(Kart *kart_hit, const Vec3 *track_xyz)
|
||||
void RubberBand::hit(AbstractKart *kart_hit, const Vec3 *track_xyz)
|
||||
{
|
||||
// More than one report of a hit. This can happen if the raycast detects
|
||||
// a hit as well as the bullet physics.
|
||||
|
@ -28,7 +28,7 @@ namespace irr
|
||||
}
|
||||
using namespace irr;
|
||||
|
||||
class Kart;
|
||||
class AbstractKart;
|
||||
class Plunger;
|
||||
|
||||
/** This class is used together with the pluger to display a rubber band from
|
||||
@ -49,7 +49,7 @@ private:
|
||||
/** The plunger the rubber band is attached to. */
|
||||
Plunger *m_plunger;
|
||||
/** The kart who shot this plunger. */
|
||||
Kart *m_owner;
|
||||
AbstractKart *m_owner;
|
||||
|
||||
/** The scene node for the rubber band. */
|
||||
scene::ISceneNode *m_node;
|
||||
@ -59,7 +59,7 @@ private:
|
||||
scene::IMeshBuffer *m_buffer;
|
||||
|
||||
/** The kart a plunger might have hit. */
|
||||
Kart *m_hit_kart;
|
||||
AbstractKart *m_hit_kart;
|
||||
/** Stores the end of the rubber band (i.e. the side attached to the
|
||||
* plunger. */
|
||||
Vec3 m_end_position;
|
||||
@ -68,9 +68,9 @@ private:
|
||||
void updatePosition();
|
||||
|
||||
public:
|
||||
RubberBand(Plunger *plunger, Kart *kart);
|
||||
RubberBand(Plunger *plunger, AbstractKart *kart);
|
||||
~RubberBand();
|
||||
void update(float dt);
|
||||
void hit(Kart *kart_hit, const Vec3 *track_xyz=NULL);
|
||||
void hit(AbstractKart *kart_hit, const Vec3 *track_xyz=NULL);
|
||||
}; // RubberBand
|
||||
#endif
|
||||
|
@ -34,8 +34,9 @@
|
||||
#include "items/attachment.hpp"
|
||||
#include "items/projectile_manager.hpp"
|
||||
#include "karts/controller/controller.hpp"
|
||||
#include "karts/kart_properties.hpp"
|
||||
#include "modes/world.hpp"
|
||||
#include "karts/kart.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
|
||||
#define SWAT_POS_OFFSET core::vector3df(0.0, 0.2f, -0.4f)
|
||||
#define SWAT_ANGLE_MIN 45
|
||||
@ -51,7 +52,7 @@
|
||||
* \param bomb_scene_node The scene node of the bomb (i.e. the previous
|
||||
* attachment scene node).
|
||||
*/
|
||||
Swatter::Swatter(Kart *kart, bool was_bomb,
|
||||
Swatter::Swatter(AbstractKart *kart, bool was_bomb,
|
||||
scene::ISceneNode* bomb_scene_node)
|
||||
: AttachmentPlugin(kart)
|
||||
{
|
||||
@ -201,12 +202,12 @@ void Swatter::chooseTarget()
|
||||
{
|
||||
// TODO: for the moment, only handle karts...
|
||||
const World* world = World::getWorld();
|
||||
Kart *closest_kart = NULL;
|
||||
AbstractKart* closest_kart = NULL;
|
||||
float min_dist2 = FLT_MAX;
|
||||
|
||||
for(unsigned int i=0; i<world->getNumKarts(); i++)
|
||||
{
|
||||
Kart *kart = world->getKart(i);
|
||||
AbstractKart *kart = world->getKart(i);
|
||||
// TODO: isSwatterReady(), isSquashable()?
|
||||
if(kart->isEliminated() || kart==m_kart)
|
||||
continue;
|
||||
@ -269,7 +270,7 @@ void Swatter::squashThingsAround()
|
||||
// Squash karts around
|
||||
for(unsigned int i=0; i<world->getNumKarts(); i++)
|
||||
{
|
||||
Kart *kart = world->getKart(i);
|
||||
AbstractKart *kart = world->getKart(i);
|
||||
// TODO: isSwatterReady()
|
||||
if(kart->isEliminated() || kart==m_kart)
|
||||
continue;
|
||||
|
@ -21,15 +21,17 @@
|
||||
|
||||
#include "config/stk_config.hpp"
|
||||
#include "items/attachment_plugin.hpp"
|
||||
#include "karts/moveable.hpp"
|
||||
#include "utils/no_copy.hpp"
|
||||
#include "utils/random_generator.hpp"
|
||||
|
||||
#include <vector3d.h>
|
||||
#include <IAnimatedMeshSceneNode.h>
|
||||
|
||||
class Kart;
|
||||
using namespace irr;
|
||||
|
||||
class AbstractKart;
|
||||
class Item;
|
||||
class Moveable;
|
||||
class SFXBase;
|
||||
|
||||
/**
|
||||
@ -66,7 +68,7 @@ private:
|
||||
float m_swat_bomb_frame;
|
||||
|
||||
public:
|
||||
Swatter(Kart *kart, bool was_bomb,
|
||||
Swatter(AbstractKart *kart, bool was_bomb,
|
||||
scene::ISceneNode* bomb_scene_node);
|
||||
virtual ~Swatter();
|
||||
bool updateAndTestFinished(float dt);
|
||||
|
@ -21,19 +21,20 @@
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "karts/kart.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "karts/kart_properties.hpp"
|
||||
#include "karts/skidding_properties.hpp"
|
||||
#include "modes/linear_world.hpp"
|
||||
#include "tracks/track.hpp"
|
||||
#include "utils/constants.hpp"
|
||||
|
||||
AIBaseController::AIBaseController(Kart *kart,
|
||||
AIBaseController::AIBaseController(AbstractKart *kart,
|
||||
StateManager::ActivePlayer *player)
|
||||
: Controller(kart, player)
|
||||
{
|
||||
m_kart = kart;
|
||||
m_kart_length = m_kart->getKartModel()->getLength();
|
||||
m_kart_width = m_kart->getKartModel()->getWidth();
|
||||
m_kart_length = m_kart->getKartLength();
|
||||
m_kart_width = m_kart->getKartWidth();
|
||||
|
||||
if(race_manager->getMinorMode()!=RaceManager::MINOR_MODE_3_STRIKES)
|
||||
{
|
||||
|
@ -80,7 +80,7 @@ protected:
|
||||
void computePath();
|
||||
|
||||
public:
|
||||
AIBaseController(Kart *kart,
|
||||
AIBaseController(AbstractKart *kart,
|
||||
StateManager::ActivePlayer *player=NULL);
|
||||
virtual ~AIBaseController() {};
|
||||
};
|
||||
|
@ -22,12 +22,12 @@
|
||||
|
||||
#include "karts/controller/controller.hpp"
|
||||
|
||||
#include "karts/kart.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
|
||||
/** Constructor, saves the kart pointer and a pointer to the KartControl
|
||||
* of the kart.
|
||||
*/
|
||||
Controller::Controller(Kart *kart, StateManager::ActivePlayer *player)
|
||||
Controller::Controller(AbstractKart *kart, StateManager::ActivePlayer *player)
|
||||
{
|
||||
m_controls = &(kart->getControls());
|
||||
m_kart = kart;
|
||||
|
@ -29,11 +29,11 @@ using namespace irr;
|
||||
*/
|
||||
|
||||
#include "input/input.hpp"
|
||||
#include "karts/controller/kart_control.hpp"
|
||||
#include "states_screens/state_manager.hpp"
|
||||
|
||||
class Kart;
|
||||
class AbstractKart;
|
||||
class Item;
|
||||
class KartControl;
|
||||
|
||||
/** This is the base class for kart controller - that can be a player
|
||||
* or a a robot.
|
||||
@ -43,7 +43,7 @@ class Controller
|
||||
{
|
||||
protected:
|
||||
/** Pointer to the kart that is controlled by this controller. */
|
||||
Kart *m_kart;
|
||||
AbstractKart *m_kart;
|
||||
|
||||
/** A pointer to the main controller, from which the kart takes
|
||||
* it commands. */
|
||||
@ -53,7 +53,8 @@ protected:
|
||||
* structure. Otherwise it is 0. */
|
||||
StateManager::ActivePlayer *m_player;
|
||||
public:
|
||||
Controller (Kart *kart, StateManager::ActivePlayer *player=NULL);
|
||||
Controller (AbstractKart *kart,
|
||||
StateManager::ActivePlayer *player=NULL);
|
||||
virtual ~Controller () {};
|
||||
/** Returns the active player for this controller (NULL
|
||||
* if this controller does not belong to a player. */
|
||||
|
@ -39,7 +39,12 @@
|
||||
# include "graphics/irr_driver.hpp"
|
||||
#endif
|
||||
#include "graphics/slip_stream.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "karts/controller/kart_control.hpp"
|
||||
#include "karts/kart_properties.hpp"
|
||||
#include "karts/max_speed.hpp"
|
||||
#include "items/attachment.hpp"
|
||||
#include "items/powerup.hpp"
|
||||
#include "modes/linear_world.hpp"
|
||||
#include "network/network_manager.hpp"
|
||||
#include "race/race_manager.hpp"
|
||||
@ -47,7 +52,8 @@
|
||||
#include "tracks/track.hpp"
|
||||
#include "utils/constants.hpp"
|
||||
|
||||
DefaultAIController::DefaultAIController(Kart *kart) : AIBaseController(kart)
|
||||
DefaultAIController::DefaultAIController(AbstractKart *kart)
|
||||
: AIBaseController(kart)
|
||||
{
|
||||
reset();
|
||||
|
||||
@ -621,7 +627,7 @@ void DefaultAIController::computeNearestKarts()
|
||||
float my_dist = m_world->getDistanceDownTrackForKart(m_kart->getWorldKartId());
|
||||
for(unsigned int i=0; i<m_world->getNumKarts(); i++)
|
||||
{
|
||||
Kart *k = m_world->getKart(i);
|
||||
AbstractKart *k = m_world->getKart(i);
|
||||
if(k->isEliminated() || k->hasFinishedRace() || k==m_kart) continue;
|
||||
if(k->getPosition()==my_position+1)
|
||||
{
|
||||
@ -875,9 +881,10 @@ void DefaultAIController::checkCrashes(int steps, const Vec3& pos )
|
||||
{
|
||||
for( unsigned int j = 0; j < NUM_KARTS; ++j )
|
||||
{
|
||||
const Kart* kart = m_world->getKart(j);
|
||||
if(kart==m_kart||kart->isEliminated()) continue; // ignore eliminated karts
|
||||
const Kart *other_kart = m_world->getKart(j);
|
||||
const AbstractKart* kart = m_world->getKart(j);
|
||||
// Ignore eliminated karts
|
||||
if(kart==m_kart||kart->isEliminated()) continue;
|
||||
const AbstractKart *other_kart = m_world->getKart(j);
|
||||
// Ignore karts ahead that are faster than this kart.
|
||||
if(m_kart->getVelocityLC().getZ() < other_kart->getVelocityLC().getZ())
|
||||
continue;
|
||||
|
@ -100,13 +100,13 @@ private:
|
||||
|
||||
/** Pointer to the closest kart ahead of this kart. NULL if this
|
||||
* kart is first. */
|
||||
Kart *m_kart_ahead;
|
||||
AbstractKart *m_kart_ahead;
|
||||
/** Distance to the kart ahead. */
|
||||
float m_distance_ahead;
|
||||
|
||||
/** Pointer to the closest kart behind this kart. NULL if this kart
|
||||
* is last. */
|
||||
Kart *m_kart_behind;
|
||||
AbstractKart *m_kart_behind;
|
||||
/** Distance to the kard behind. */
|
||||
float m_distance_behind;
|
||||
|
||||
@ -147,11 +147,11 @@ protected:
|
||||
virtual unsigned int getNextSector(unsigned int index);
|
||||
|
||||
public:
|
||||
DefaultAIController(Kart *kart);
|
||||
DefaultAIController(AbstractKart *kart);
|
||||
~DefaultAIController();
|
||||
virtual void update (float delta) ;
|
||||
virtual void reset ();
|
||||
virtual void crashed (Kart *k) {if(k) m_collided = true;};
|
||||
virtual void crashed (AbstractKart *k) {if(k) m_collided = true;};
|
||||
virtual const irr::core::stringw& getNamePostfix() const;
|
||||
};
|
||||
|
||||
|
@ -38,6 +38,9 @@
|
||||
#ifdef AI_DEBUG
|
||||
#include "graphics/irr_driver.hpp"
|
||||
#endif
|
||||
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "karts/max_speed.hpp"
|
||||
#include "modes/linear_world.hpp"
|
||||
#include "network/network_manager.hpp"
|
||||
#include "race/race_manager.hpp"
|
||||
@ -46,7 +49,7 @@
|
||||
#include "tracks/track.hpp"
|
||||
#include "utils/constants.hpp"
|
||||
|
||||
EndController::EndController(Kart *kart, StateManager::ActivePlayer *player)
|
||||
EndController::EndController(AbstractKart *kart, StateManager::ActivePlayer *player)
|
||||
: AIBaseController(kart, player)
|
||||
{
|
||||
if(race_manager->getMinorMode()!=RaceManager::MINOR_MODE_3_STRIKES)
|
||||
|
@ -77,7 +77,8 @@ private:
|
||||
void findNonCrashingPoint(Vec3 *result);
|
||||
int calcSteps();
|
||||
public:
|
||||
EndController(Kart *kart, StateManager::ActivePlayer* player);
|
||||
EndController(AbstractKart *kart,
|
||||
StateManager::ActivePlayer* player);
|
||||
~EndController();
|
||||
virtual void update (float delta) ;
|
||||
virtual void reset ();
|
||||
|
@ -38,7 +38,12 @@
|
||||
#ifdef AI_DEBUG
|
||||
#include "graphics/irr_driver.hpp"
|
||||
#endif
|
||||
|
||||
#include "items/attachment.hpp"
|
||||
#include "items/powerup.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "karts/controller/kart_control.hpp"
|
||||
#include "karts/max_speed.hpp"
|
||||
#include "modes/linear_world.hpp"
|
||||
#include "network/network_manager.hpp"
|
||||
#include "race/race_manager.hpp"
|
||||
@ -46,7 +51,7 @@
|
||||
#include "tracks/track.hpp"
|
||||
#include "utils/constants.hpp"
|
||||
|
||||
NewAIController::NewAIController(Kart *kart) : AIBaseController(kart)
|
||||
NewAIController::NewAIController(AbstractKart *kart) : AIBaseController(kart)
|
||||
{
|
||||
// Reset must be called after QuadGraph::get() etc. is set up
|
||||
reset();
|
||||
@ -482,7 +487,7 @@ void NewAIController::computeNearestKarts()
|
||||
float my_dist = m_world->getDistanceDownTrackForKart(m_kart->getWorldKartId());
|
||||
for(unsigned int i=0; i<m_world->getNumKarts(); i++)
|
||||
{
|
||||
Kart *k = m_world->getKart(i);
|
||||
AbstractKart *k = m_world->getKart(i);
|
||||
if(k->isEliminated() || k==m_kart) continue;
|
||||
if(k->getPosition()==my_position+1)
|
||||
{
|
||||
@ -706,9 +711,10 @@ void NewAIController::checkCrashes( const int STEPS, const Vec3& pos )
|
||||
{
|
||||
for( unsigned int j = 0; j < NUM_KARTS; ++j )
|
||||
{
|
||||
const Kart* kart = m_world->getKart(j);
|
||||
if(kart==m_kart||kart->isEliminated()) continue; // ignore eliminated karts
|
||||
const Kart *other_kart = m_world->getKart(j);
|
||||
const AbstractKart* kart = m_world->getKart(j);
|
||||
// Ignore eliminated karts
|
||||
if(kart==m_kart||kart->isEliminated()) continue;
|
||||
const AbstractKart *other_kart = m_world->getKart(j);
|
||||
// Ignore karts ahead that are faster than this kart.
|
||||
if(m_kart->getVelocityLC().getZ() < other_kart->getVelocityLC().getZ())
|
||||
continue;
|
||||
|
@ -25,9 +25,10 @@
|
||||
|
||||
/* third coord won't be used */
|
||||
|
||||
class Track;
|
||||
class LinearWorld;
|
||||
class QuadGraph;
|
||||
class Track;
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace scene
|
||||
@ -88,13 +89,13 @@ private:
|
||||
|
||||
/** Pointer to the closest kart ahead of this kart. NULL if this
|
||||
* kart is first. */
|
||||
Kart *m_kart_ahead;
|
||||
AbstractKart *m_kart_ahead;
|
||||
/** Distance to the kart ahead. */
|
||||
float m_distance_ahead;
|
||||
|
||||
/** Pointer to the closest kart behind this kart. NULL if this kart
|
||||
* is last. */
|
||||
Kart *m_kart_behind;
|
||||
AbstractKart *m_kart_behind;
|
||||
/** Distance to the kard behind. */
|
||||
float m_distance_behind;
|
||||
|
||||
@ -143,11 +144,11 @@ protected:
|
||||
virtual unsigned int getNextSector(unsigned int index);
|
||||
|
||||
public:
|
||||
NewAIController(Kart *kart);
|
||||
NewAIController(AbstractKart *kart);
|
||||
virtual ~NewAIController();
|
||||
virtual void update (float delta) ;
|
||||
virtual void reset ();
|
||||
virtual void crashed (Kart *k) {if(k) m_collided = true;};
|
||||
virtual void crashed (AbstractKart *k) {if(k) m_collided = true;};
|
||||
virtual const irr::core::stringw& getN() const
|
||||
{
|
||||
static irr::core::stringw name("(NewAI)");
|
||||
|
@ -27,6 +27,8 @@
|
||||
#include "input/input_manager.hpp"
|
||||
#include "items/attachment.hpp"
|
||||
#include "items/item.hpp"
|
||||
#include "items/powerup.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "modes/world.hpp"
|
||||
#include "race/history.hpp"
|
||||
#include "states_screens/race_gui_base.hpp"
|
||||
@ -40,7 +42,8 @@
|
||||
* \param init_pos The start coordinates and heading of the kart.
|
||||
* \param player_index Index of the player kart.
|
||||
*/
|
||||
PlayerController::PlayerController(Kart *kart, StateManager::ActivePlayer *player,
|
||||
PlayerController::PlayerController(AbstractKart *kart,
|
||||
StateManager::ActivePlayer *player,
|
||||
unsigned int player_index)
|
||||
: Controller(kart)
|
||||
{
|
||||
@ -383,7 +386,7 @@ void PlayerController::setPosition(int p)
|
||||
//I'm not sure if this method of finding the passing kart is fail-safe.
|
||||
for(unsigned int i = 0 ; i < world->getNumKarts(); i++ )
|
||||
{
|
||||
Kart *kart = world->getKart(i);
|
||||
AbstractKart *kart = world->getKart(i);
|
||||
if(kart->getPosition() == p + 1)
|
||||
{
|
||||
kart->beep();
|
||||
|
@ -24,8 +24,9 @@
|
||||
#include "config/player.hpp"
|
||||
#include "karts/controller/controller.hpp"
|
||||
|
||||
class SFXBase;
|
||||
class AbstractKart;
|
||||
class Player;
|
||||
class SFXBase;
|
||||
|
||||
/** PlayerKart manages control events from the player and moves
|
||||
* them to the Kart
|
||||
@ -49,7 +50,8 @@ private:
|
||||
|
||||
void steer(float, int);
|
||||
public:
|
||||
PlayerController (Kart *kart, StateManager::ActivePlayer *_player,
|
||||
PlayerController (AbstractKart *kart,
|
||||
StateManager::ActivePlayer *_player,
|
||||
unsigned int player_index);
|
||||
~PlayerController ();
|
||||
void update (float);
|
||||
|
@ -47,6 +47,7 @@
|
||||
#include "karts/controller/end_controller.hpp"
|
||||
#include "karts/kart_model.hpp"
|
||||
#include "karts/kart_properties_manager.hpp"
|
||||
#include "karts/max_speed.hpp"
|
||||
#include "karts/skidding.hpp"
|
||||
#include "modes/linear_world.hpp"
|
||||
#include "network/race_state.hpp"
|
||||
@ -74,28 +75,19 @@
|
||||
*/
|
||||
Kart::Kart (const std::string& ident, unsigned int world_kart_id,
|
||||
int position, const btTransform& init_transform)
|
||||
: TerrainInfo(1),
|
||||
Moveable(), EmergencyAnimation(this), MaxSpeed(this), m_powerup(this)
|
||||
: AbstractKart(ident, world_kart_id, position, init_transform)
|
||||
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
# pragma warning(1:4355)
|
||||
#endif
|
||||
{
|
||||
m_kart_properties = kart_properties_manager->getKart(ident);
|
||||
assert(m_kart_properties != NULL);
|
||||
|
||||
// We have to take a copy of the kart model, since otherwise
|
||||
// the animations will be mixed up (i.e. different instances of
|
||||
// the same model will set different animation frames).
|
||||
// Technically the mesh in m_kart_model needs to be grab'ed and
|
||||
// released when the kart is deleted, but since the original
|
||||
// kart_model is stored in the kart_properties all the time,
|
||||
// there is no risk of a mesh being deleted to early.
|
||||
m_kart_model = m_kart_properties->getKartModelCopy();
|
||||
m_emergency_animation = new EmergencyAnimation(this);
|
||||
m_max_speed = new MaxSpeed(this);
|
||||
m_terrain_info = new TerrainInfo();
|
||||
m_powerup = new Powerup(this);
|
||||
m_vehicle = NULL;
|
||||
m_initial_position = position;
|
||||
m_race_position = position;
|
||||
m_world_kart_id = world_kart_id;
|
||||
m_collected_energy = 0;
|
||||
m_finished_race = false;
|
||||
m_finish_time = 0.0f;
|
||||
@ -201,6 +193,65 @@ void Kart::init(RaceManager::KartType type, bool is_first_kart)
|
||||
reset();
|
||||
} // init
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** The destructor frees the memory of this kart, but note that the actual kart
|
||||
* model is still stored in the kart_properties (m_kart_model variable), so
|
||||
* it is not reloaded).
|
||||
*/
|
||||
Kart::~Kart()
|
||||
{
|
||||
// Delete all custom sounds (TODO: add back when properly done)
|
||||
/*
|
||||
for (int n = 0; n < SFXManager::NUM_CUSTOMS; n++)
|
||||
{
|
||||
if (m_custom_sounds[n] != NULL)
|
||||
sfx_manager->deleteSFX(m_custom_sounds[n]);
|
||||
}*/
|
||||
|
||||
sfx_manager->deleteSFX(m_engine_sound );
|
||||
sfx_manager->deleteSFX(m_crash_sound );
|
||||
sfx_manager->deleteSFX(m_skid_sound );
|
||||
sfx_manager->deleteSFX(m_goo_sound );
|
||||
sfx_manager->deleteSFX(m_beep_sound );
|
||||
delete m_kart_gfx;
|
||||
if(m_terrain_sound) sfx_manager->deleteSFX(m_terrain_sound);
|
||||
if(m_previous_terrain_sound) sfx_manager->deleteSFX(m_previous_terrain_sound);
|
||||
if(m_collision_particles) delete m_collision_particles;
|
||||
if(m_slipstream) delete m_slipstream;
|
||||
if(m_rain) delete m_rain;
|
||||
if(m_sky_particles_emitter) delete m_sky_particles_emitter;
|
||||
if(m_attachment) delete m_attachment;
|
||||
|
||||
delete m_shadow;
|
||||
|
||||
if(m_skidmarks) delete m_skidmarks ;
|
||||
|
||||
// Ghost karts don't have a body
|
||||
if(m_body)
|
||||
{
|
||||
World::getWorld()->getPhysics()->removeKart(this);
|
||||
delete m_vehicle;
|
||||
delete m_vehicle_raycaster;
|
||||
delete m_uprightConstraint;
|
||||
}
|
||||
|
||||
for(int i=0; i<m_kart_chassis.getNumChildShapes(); i++)
|
||||
{
|
||||
delete m_kart_chassis.getChildShape(i);
|
||||
}
|
||||
delete m_skidding;
|
||||
delete m_max_speed;
|
||||
delete m_emergency_animation;
|
||||
delete m_terrain_info;
|
||||
delete m_powerup;
|
||||
|
||||
if(m_controller)
|
||||
delete m_controller;
|
||||
if(m_saved_controller)
|
||||
delete m_saved_controller;
|
||||
if (m_camera) delete m_camera;
|
||||
} // ~Kart
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Reset before a new race. It will remove all attachments, and
|
||||
* puts the kart back at its original start position.
|
||||
@ -213,8 +264,10 @@ void Kart::reset()
|
||||
stopFlying();
|
||||
}
|
||||
|
||||
EmergencyAnimation::reset();
|
||||
MaxSpeed::reset();
|
||||
m_emergency_animation->reset();
|
||||
m_max_speed->reset();
|
||||
m_powerup->reset();
|
||||
|
||||
if (m_camera)
|
||||
{
|
||||
m_camera->reset();
|
||||
@ -240,7 +293,6 @@ void Kart::reset()
|
||||
|
||||
if (m_collision_particles)
|
||||
m_collision_particles->setCreationRateAbsolute(0.0f);
|
||||
m_powerup.reset();
|
||||
|
||||
m_race_position = m_initial_position;
|
||||
m_finished_race = false;
|
||||
@ -299,7 +351,7 @@ void Kart::reset()
|
||||
}
|
||||
|
||||
|
||||
TerrainInfo::update(getXYZ());
|
||||
m_terrain_info->update(getXYZ());
|
||||
|
||||
// Reset is also called when the kart is created, at which time
|
||||
// m_controller is not yet defined, so this has to be tested here.
|
||||
@ -315,6 +367,100 @@ void Kart::reset()
|
||||
|
||||
} // reset
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
void Kart::increaseMaxSpeed(unsigned int category, float add_speed,
|
||||
float duration, float fade_out_time)
|
||||
{
|
||||
m_max_speed->increaseMaxSpeed(category, add_speed, duration, fade_out_time);
|
||||
} // increaseMaxSpeed
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
void Kart::setSlowdown(unsigned int category, float max_speed_fraction,
|
||||
float fade_in_time)
|
||||
{
|
||||
m_max_speed->setSlowdown(category, max_speed_fraction, fade_in_time);
|
||||
} // setSlowdown
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
float Kart::getCurrentMaxSpeed() const
|
||||
{
|
||||
return m_max_speed->getCurrentMaxSpeed();
|
||||
} // getCurrentMaxSpeed
|
||||
// -----------------------------------------------------------------------------
|
||||
float Kart::getSpeedIncreaseTimeLeft(unsigned int category) const
|
||||
{
|
||||
return m_max_speed->getSpeedIncreaseTimeLeft(category);
|
||||
} // getSpeedIncreaseTimeLeft
|
||||
// -----------------------------------------------------------------------------
|
||||
bool Kart::playingRescueAnimation() const
|
||||
{
|
||||
return m_emergency_animation->playingRescueAnimation();
|
||||
} // playingRescueAnimation
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
bool Kart::playingExplosionAnimation() const
|
||||
{
|
||||
return m_emergency_animation->playingExplosionAnimation();
|
||||
} // playingExplosionAnimation
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
/** Returns the timer for the currently played animation. */
|
||||
float Kart::getAnimationTimer() const
|
||||
{
|
||||
return m_emergency_animation->getAnimationTimer();
|
||||
} // getAnimationTimer
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
/** Returns true if an emergency animation is being played. */
|
||||
bool Kart::playingEmergencyAnimation() const
|
||||
{
|
||||
return m_emergency_animation->playingEmergencyAnimation();
|
||||
} // playingEmergencyAnimation
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
/** Returns the current material the kart is on. */
|
||||
const Material *Kart::getMaterial() const
|
||||
{
|
||||
return m_terrain_info->getMaterial();
|
||||
} // getMaterial
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
/** Returns the previous material the kart was one (which might be
|
||||
* the same as getMaterial() ). */
|
||||
const Material *Kart::getLastMaterial() const
|
||||
{
|
||||
return m_terrain_info->getLastMaterial();
|
||||
} // getLastMaterial
|
||||
// -----------------------------------------------------------------------------
|
||||
/** Returns the pitch of the terrain depending on the heading. */
|
||||
float Kart::getTerrainPitch(float heading) const
|
||||
{
|
||||
return m_terrain_info->getTerrainPitch(heading);
|
||||
} // getTerrainPitch
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
/** Returns the height of the terrain. we're currently above */
|
||||
float Kart::getHoT() const
|
||||
{
|
||||
return m_terrain_info->getHoT();
|
||||
} // getHoT
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Sets the powerup this kart has collected.
|
||||
* \param t Type of the powerup.
|
||||
* \param n Number of powerups collected.
|
||||
*/
|
||||
void Kart::setPowerup(PowerupManager::PowerupType t, int n)
|
||||
{
|
||||
m_powerup->set(t, n);
|
||||
} // setPowerup
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
int Kart::getNumPowerup() const
|
||||
{
|
||||
return m_powerup->getNum();
|
||||
} // getNumPowerup
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
/** Saves the old controller in m_saved_controller and stores a new
|
||||
* controller. The save controller is needed in case of a reset.
|
||||
@ -514,7 +660,7 @@ void Kart::flyDown()
|
||||
{
|
||||
Moveable::flyDown();
|
||||
}
|
||||
}
|
||||
} // flyUp
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Starts the engine sound effect. Called once the track intro phase is over.
|
||||
@ -546,61 +692,6 @@ void Kart::startEngineSFX()
|
||||
m_engine_sound->play();
|
||||
} // startEngineSFX
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** The destructor frees the memory of this kart, but note that the actual kart
|
||||
* model is still stored in the kart_properties (m_kart_model variable), so
|
||||
* it is not reloaded).
|
||||
*/
|
||||
Kart::~Kart()
|
||||
{
|
||||
// Delete all custom sounds (TODO: add back when properly done)
|
||||
/*
|
||||
for (int n = 0; n < SFXManager::NUM_CUSTOMS; n++)
|
||||
{
|
||||
if (m_custom_sounds[n] != NULL)
|
||||
sfx_manager->deleteSFX(m_custom_sounds[n]);
|
||||
}*/
|
||||
|
||||
sfx_manager->deleteSFX(m_engine_sound );
|
||||
sfx_manager->deleteSFX(m_crash_sound );
|
||||
sfx_manager->deleteSFX(m_skid_sound );
|
||||
sfx_manager->deleteSFX(m_goo_sound );
|
||||
sfx_manager->deleteSFX(m_beep_sound );
|
||||
delete m_kart_gfx;
|
||||
if(m_terrain_sound) sfx_manager->deleteSFX(m_terrain_sound);
|
||||
if(m_previous_terrain_sound) sfx_manager->deleteSFX(m_previous_terrain_sound);
|
||||
if(m_collision_particles) delete m_collision_particles;
|
||||
if(m_slipstream) delete m_slipstream;
|
||||
if(m_rain) delete m_rain;
|
||||
if(m_sky_particles_emitter) delete m_sky_particles_emitter;
|
||||
if(m_attachment) delete m_attachment;
|
||||
|
||||
delete m_shadow;
|
||||
|
||||
if(m_skidmarks) delete m_skidmarks ;
|
||||
|
||||
// Ghost karts don't have a body
|
||||
if(m_body)
|
||||
{
|
||||
World::getWorld()->getPhysics()->removeKart(this);
|
||||
delete m_vehicle;
|
||||
delete m_vehicle_raycaster;
|
||||
delete m_uprightConstraint;
|
||||
}
|
||||
|
||||
for(int i=0; i<m_kart_chassis.getNumChildShapes(); i++)
|
||||
{
|
||||
delete m_kart_chassis.getChildShape(i);
|
||||
}
|
||||
delete m_kart_model;
|
||||
delete m_skidding;
|
||||
if(m_controller)
|
||||
delete m_controller;
|
||||
if(m_saved_controller)
|
||||
delete m_saved_controller;
|
||||
if (m_camera) delete m_camera;
|
||||
} // ~Kart
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Returns true if the kart is 'resting', i.e. (nearly) not moving.
|
||||
*/
|
||||
@ -620,23 +711,6 @@ void Kart::adjustSpeed(float f)
|
||||
m_body->setAngularVelocity(m_body->getAngularVelocity()*f);
|
||||
} // adjustSpeed
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Caps the speed at a given value. If necessary the kart will
|
||||
* instantaneously change its speed.
|
||||
* \param max_speed Maximum speed of the kart.
|
||||
*/
|
||||
void Kart::capSpeed(float max_speed)
|
||||
{
|
||||
if ( m_speed > max_speed && isOnGround() )
|
||||
{
|
||||
const float velocity_ratio = max_speed/m_speed;
|
||||
btVector3 velocity = getBody()->getLinearVelocity();
|
||||
velocity *= velocity_ratio;
|
||||
getVehicle()->getRigidBody()->setLinearVelocity( velocity );
|
||||
}
|
||||
|
||||
} // capSpeed
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** This method is to be called every time the mass of the kart is updated,
|
||||
* which includes attaching an anvil to the kart (and detaching).
|
||||
@ -744,7 +818,7 @@ void Kart::collectedItem(Item *item, int add_info)
|
||||
break;
|
||||
case Item::ITEM_BONUS_BOX :
|
||||
{
|
||||
m_powerup.hitBonusBox(*item, add_info);
|
||||
m_powerup->hitBonusBox(*item, add_info);
|
||||
break;
|
||||
}
|
||||
case Item::ITEM_BUBBLEGUM:
|
||||
@ -781,18 +855,21 @@ void Kart::collectedItem(Item *item, int add_info)
|
||||
*/
|
||||
float Kart::getActualWheelForce()
|
||||
{
|
||||
float time_left = MaxSpeed::getSpeedIncreaseTimeLeft(MS_INCREASE_ZIPPER);
|
||||
float zipper_force = time_left>0.0f ? m_kart_properties->getZipperForce(): 0.0f;
|
||||
float time_left =
|
||||
m_max_speed->getSpeedIncreaseTimeLeft(MaxSpeed::MS_INCREASE_ZIPPER);
|
||||
float zipper_force = time_left>0.0f ? m_kart_properties->getZipperForce()
|
||||
: 0.0f;
|
||||
const std::vector<float>& gear_ratio=m_kart_properties->getGearSwitchRatio();
|
||||
for(unsigned int i=0; i<gear_ratio.size(); i++)
|
||||
{
|
||||
if(m_speed <= m_kart_properties->getMaxSpeed()*gear_ratio[i])
|
||||
{
|
||||
return getMaxPower()*m_kart_properties->getGearPowerIncrease()[i]
|
||||
return m_kart_properties->getMaxPower()
|
||||
*m_kart_properties->getGearPowerIncrease()[i]
|
||||
+zipper_force;
|
||||
}
|
||||
}
|
||||
return getMaxPower()+zipper_force;
|
||||
return m_kart_properties->getMaxPower()+zipper_force;
|
||||
|
||||
} // getActualWheelForce
|
||||
|
||||
@ -813,12 +890,46 @@ bool Kart::isOnGround() const
|
||||
*/
|
||||
bool Kart::isNearGround() const
|
||||
{
|
||||
if(getHoT()==Track::NOHIT)
|
||||
if(m_terrain_info->getHoT()==Track::NOHIT)
|
||||
return false;
|
||||
else
|
||||
return ((getXYZ().getY() - getHoT()) < stk_config->m_near_ground);
|
||||
return ((getXYZ().getY() - m_terrain_info->getHoT())
|
||||
< stk_config->m_near_ground);
|
||||
} // isNearGround
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Returns true if the kart is eliminated.
|
||||
*/
|
||||
bool Kart::isEliminated() const
|
||||
{
|
||||
return m_emergency_animation->isEliminated();
|
||||
} // isEliminated
|
||||
// ------------------------------------------------------------------------
|
||||
void Kart::eliminate(bool remove)
|
||||
{
|
||||
m_emergency_animation->eliminate(remove);
|
||||
} // eliminate
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Starts an explosion animation.
|
||||
* \param pos The coordinates of the explosion.
|
||||
* \param direct_hig True if the kart was hit directly --> maximal impact.
|
||||
*/
|
||||
void Kart::handleExplosion(const Vec3& pos, bool direct_hit)
|
||||
{
|
||||
m_emergency_animation->handleExplosion(pos, direct_hit);
|
||||
} // handleExplosion
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Sets the mode of the kart to being rescued, attaches the rescue model
|
||||
* and saves the current pitch and roll (for the rescue animation). It
|
||||
* also removes the kart from the physics world.
|
||||
*/
|
||||
void Kart::forceRescue(bool is_auto_rescue)
|
||||
{
|
||||
m_emergency_animation->forceRescue(is_auto_rescue);
|
||||
} // forceRescue
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Updates the kart in each time step. It updates the physics setting,
|
||||
* particle effects, camera position, etc.
|
||||
@ -826,9 +937,9 @@ bool Kart::isNearGround() const
|
||||
*/
|
||||
void Kart::update(float dt)
|
||||
{
|
||||
if (m_eliminated)
|
||||
if (m_emergency_animation->isEliminated())
|
||||
{
|
||||
EmergencyAnimation::update(dt);
|
||||
m_emergency_animation->update(dt);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -839,7 +950,7 @@ void Kart::update(float dt)
|
||||
if(m_squash_time<=0)
|
||||
{
|
||||
m_node->setScale(core::vector3df(1.0f, 1.0f, 1.0f));
|
||||
MaxSpeed::setSlowdown(MaxSpeed::MS_DECREASE_SQUASH,
|
||||
m_max_speed->setSlowdown(MaxSpeed::MS_DECREASE_SQUASH,
|
||||
/*slowdown*/1.0f, /*fade in*/0.0f);
|
||||
}
|
||||
}
|
||||
@ -885,7 +996,7 @@ void Kart::update(float dt)
|
||||
{
|
||||
// use() needs to be called even if there currently is no collecteable
|
||||
// since use() can test if something needs to be switched on/off.
|
||||
m_powerup.use() ;
|
||||
m_powerup->use() ;
|
||||
m_controls.m_fire = false;
|
||||
}
|
||||
|
||||
@ -894,7 +1005,7 @@ void Kart::update(float dt)
|
||||
// When really on air, free fly, when near ground, try to glide / adjust for landing
|
||||
// If zipped, be stable, so ramp+zipper can allow nice jumps without scripting the fly
|
||||
if(!isNearGround() &&
|
||||
MaxSpeed::getSpeedIncreaseTimeLeft(MS_INCREASE_ZIPPER)<=0.0f )
|
||||
m_max_speed->getSpeedIncreaseTimeLeft(MaxSpeed::MS_INCREASE_ZIPPER)<=0.0f )
|
||||
m_uprightConstraint->setLimit(M_PI);
|
||||
else
|
||||
m_uprightConstraint->setLimit(m_kart_properties->getUprightTolerance());
|
||||
@ -923,7 +1034,7 @@ void Kart::update(float dt)
|
||||
m_wheel_rotation += m_speed*dt / m_kart_properties->getWheelRadius();
|
||||
m_wheel_rotation=fmodf(m_wheel_rotation, 2*M_PI);
|
||||
|
||||
EmergencyAnimation::update(dt);
|
||||
m_emergency_animation->update(dt);
|
||||
|
||||
m_attachment->update(dt);
|
||||
|
||||
@ -978,13 +1089,13 @@ void Kart::update(float dt)
|
||||
old_group = m_body->getBroadphaseHandle()->m_collisionFilterGroup;
|
||||
m_body->getBroadphaseHandle()->m_collisionFilterGroup = 0;
|
||||
}
|
||||
TerrainInfo::update(pos_plus_epsilon);
|
||||
m_terrain_info->update(pos_plus_epsilon);
|
||||
if(m_body->getBroadphaseHandle())
|
||||
{
|
||||
m_body->getBroadphaseHandle()->m_collisionFilterGroup = old_group;
|
||||
}
|
||||
handleMaterialGFX();
|
||||
const Material* material=TerrainInfo::getMaterial();
|
||||
const Material* material=m_terrain_info->getMaterial();
|
||||
if (!material) // kart falling off the track
|
||||
{
|
||||
// let kart fall a bit before rescuing
|
||||
@ -1005,7 +1116,7 @@ void Kart::update(float dt)
|
||||
}
|
||||
else
|
||||
{
|
||||
MaxSpeed::setSlowdown(MaxSpeed::MS_DECREASE_TERRAIN,
|
||||
m_max_speed->setSlowdown(MaxSpeed::MS_DECREASE_TERRAIN,
|
||||
material->getMaxSpeedFraction(),
|
||||
material->getSlowDownTime() );
|
||||
#ifdef DEBUG
|
||||
@ -1062,9 +1173,7 @@ void Kart::update(float dt)
|
||||
} // update
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Show fire to go with a zipper
|
||||
/** Show fire to go with a zipper.
|
||||
*/
|
||||
void Kart::showZipperFire()
|
||||
{
|
||||
@ -1087,7 +1196,7 @@ void Kart::setSquash(float time, float slowdown)
|
||||
return;
|
||||
}
|
||||
m_node->setScale(core::vector3df(1.0f, 0.5f, 1.0f));
|
||||
MaxSpeed::setSlowdown(MaxSpeed::MS_DECREASE_SQUASH, slowdown, 0.1f);
|
||||
m_max_speed->setSlowdown(MaxSpeed::MS_DECREASE_SQUASH, slowdown, 0.1f);
|
||||
m_squash_time = time;
|
||||
} // setSquash
|
||||
|
||||
@ -1177,7 +1286,8 @@ void Kart::handleMaterialGFX()
|
||||
// something with the wheels, and the material has not the
|
||||
// below surface property set.
|
||||
if (material && isOnGround() && !material->isBelowSurface() &&
|
||||
m_kart_mode != EA_RESCUE && UserConfigParams::m_graphical_effects)
|
||||
!m_emergency_animation->playingRescueAnimation()&&
|
||||
UserConfigParams::m_graphical_effects)
|
||||
{
|
||||
|
||||
// Get the appropriate particle data depending on
|
||||
@ -1225,7 +1335,7 @@ void Kart::handleMaterialGFX()
|
||||
Vec3 from = (ri2.m_contactPointWS + ri3.m_contactPointWS)*0.5f;
|
||||
Vec3 xyz;
|
||||
const Material *surface_material;
|
||||
if(!getSurfaceInfo(from, &xyz, &surface_material))
|
||||
if(!m_terrain_info->getSurfaceInfo(from, &xyz, &surface_material))
|
||||
{
|
||||
m_kart_gfx->setCreationRateAbsolute(KartGFX::KGFX_TERRAIN, 0);
|
||||
return;
|
||||
@ -1233,7 +1343,7 @@ void Kart::handleMaterialGFX()
|
||||
const ParticleKind *pk =
|
||||
surface_material->getParticlesWhen(Material::EMIT_ON_DRIVE);
|
||||
|
||||
if(!pk || m_flying || m_kart_mode == EA_RESCUE)
|
||||
if(!pk || m_flying || m_emergency_animation->playingRescueAnimation())
|
||||
return;
|
||||
|
||||
// Now the kart is under a surface, and there is a surface effect
|
||||
@ -1251,7 +1361,7 @@ void Kart::handleMaterialGFX()
|
||||
// Play special sound effects for this terrain
|
||||
// -------------------------------------------
|
||||
const std::string s = surface_material->getSFXName();
|
||||
if (s != "" && m_kart_mode != EA_RESCUE &&
|
||||
if (s != "" && !m_emergency_animation->playingRescueAnimation()&&
|
||||
(m_terrain_sound == NULL || m_terrain_sound->getStatus() == SFXManager::SFX_STOPPED))
|
||||
{
|
||||
if (m_previous_terrain_sound) sfx_manager->deleteSFX(m_previous_terrain_sound);
|
||||
@ -1280,7 +1390,7 @@ void Kart::setCamera(Camera *camera)
|
||||
|
||||
#ifdef DEBUG
|
||||
m_camera->getCameraSceneNode()
|
||||
->setName((m_kart_properties->getIdent() + "'s camera").c_str());
|
||||
->setName((getIdent() + "'s camera").c_str());
|
||||
#endif
|
||||
|
||||
// Handle camera-specific nodes for now if in multiplayer
|
||||
@ -1338,7 +1448,7 @@ void Kart::handleZipper(const Material *material, bool play_sound)
|
||||
// Ignore a zipper that's activated while braking
|
||||
if(m_controls.m_brake || m_speed<0) return;
|
||||
|
||||
MaxSpeed::instantSpeedIncrease(MaxSpeed::MS_INCREASE_ZIPPER,
|
||||
m_max_speed->instantSpeedIncrease(MaxSpeed::MS_INCREASE_ZIPPER,
|
||||
max_speed_increase, speed_gain,
|
||||
duration, fade_out_time);
|
||||
// Play custom character sound (weee!)
|
||||
@ -1359,11 +1469,12 @@ float Kart::handleNitro(float dt)
|
||||
m_collected_energy = 0;
|
||||
return 0.0;
|
||||
}
|
||||
MaxSpeed::increaseMaxSpeed(MaxSpeed::MS_INCREASE_NITRO,
|
||||
m_max_speed->increaseMaxSpeed(MaxSpeed::MS_INCREASE_NITRO,
|
||||
m_kart_properties->getNitroMaxSpeedIncrease(),
|
||||
m_kart_properties->getNitroDuration(),
|
||||
m_kart_properties->getNitroFadeOutTime() );
|
||||
return m_kart_properties->getNitroPowerBoost() * getMaxPower();
|
||||
return m_kart_properties->getNitroPowerBoost()
|
||||
* m_kart_properties->getMaxPower();
|
||||
|
||||
} // handleNitro
|
||||
|
||||
@ -1380,7 +1491,7 @@ void Kart::setSlipstreamEffect(float f)
|
||||
* \param update_attachments If true the attachment of this kart and the
|
||||
* other kart hit will be updated (e.g. bombs will be moved)
|
||||
*/
|
||||
void Kart::crashed(Kart *k, bool update_attachments)
|
||||
void Kart::crashed(AbstractKart *k, bool update_attachments)
|
||||
{
|
||||
if(update_attachments)
|
||||
{
|
||||
@ -1421,7 +1532,7 @@ void Kart::crashed(const Material *m)
|
||||
const LinearWorld *lw = dynamic_cast<LinearWorld*>(World::getWorld());
|
||||
if(lw && m_vehicle->getCentralImpulseTime()<=0)
|
||||
{
|
||||
int sector = lw->getSectorForKart(m_world_kart_id);
|
||||
int sector = lw->getSectorForKart(this);
|
||||
if(sector!=QuadGraph::UNKNOWN_SECTOR)
|
||||
{
|
||||
const GraphNode &gn = QuadGraph::get()->getNode(
|
||||
@ -1519,6 +1630,8 @@ void Kart::crashed()
|
||||
} // crashed
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
/** Plays a beep sfx.
|
||||
*/
|
||||
void Kart::beep()
|
||||
{
|
||||
// If the custom horn can't play (isn't defined) then play the default one
|
||||
@ -1605,7 +1718,7 @@ void Kart::updatePhysics(float dt)
|
||||
{
|
||||
m_has_started = true;
|
||||
float f = m_kart_properties->getStartupBoost();
|
||||
MaxSpeed::instantSpeedIncrease(MS_INCREASE_ZIPPER, 0.9f*f,
|
||||
m_max_speed->instantSpeedIncrease(MaxSpeed::MS_INCREASE_ZIPPER, 0.9f*f,
|
||||
f, /*duration*/5.0f,
|
||||
/*fade_out_time*/5.0f);
|
||||
}
|
||||
@ -1643,7 +1756,7 @@ void Kart::updatePhysics(float dt)
|
||||
m_speed *= -1.f;
|
||||
|
||||
// Cap speed if necessary
|
||||
MaxSpeed::update(dt);
|
||||
m_max_speed->update(dt);
|
||||
|
||||
// To avoid tunneling (which can happen on long falls), clamp the
|
||||
// velocity in Y direction. Tunneling can happen if the Y velocity
|
||||
@ -1697,7 +1810,7 @@ void Kart::updateEngineSFX()
|
||||
|
||||
if(isOnGround())
|
||||
{
|
||||
float max_speed = MaxSpeed::getCurrentMaxSpeed();
|
||||
float max_speed = m_max_speed->getCurrentMaxSpeed();
|
||||
// Engine noise is based half in total speed, half in fake gears:
|
||||
// With a sawtooth graph like /|/|/| we get 3 even spaced gears,
|
||||
// ignoring the gear settings from stk_config, but providing a
|
||||
@ -1782,7 +1895,7 @@ void Kart::updateEnginePowerAndBrakes(float dt)
|
||||
m_vehicle->setAllBrakes(0);
|
||||
// going backward, apply reverse gear ratio (unless he goes
|
||||
// too fast backwards)
|
||||
if ( -m_speed < MaxSpeed::getCurrentMaxSpeed()
|
||||
if ( -m_speed < m_max_speed->getCurrentMaxSpeed()
|
||||
*m_kart_properties->getMaxSpeedReverseRatio())
|
||||
{
|
||||
// The backwards acceleration is artificially increased to
|
||||
@ -1919,7 +2032,7 @@ void Kart::loadData(RaceManager::KartType type, bool is_first_kart,
|
||||
m_node = m_kart_model->attachModel(is_animated_model);
|
||||
|
||||
#ifdef DEBUG
|
||||
m_node->setName( (m_kart_properties->getIdent()+"(lod-node)").c_str() );
|
||||
m_node->setName( (getIdent()+"(lod-node)").c_str() );
|
||||
#endif
|
||||
|
||||
// Attachment must be created after attachModel, since only then the
|
||||
|
@ -29,10 +29,8 @@
|
||||
#include "LinearMath/btTransform.h"
|
||||
|
||||
#include "items/powerup.hpp"
|
||||
#include "karts/controller/kart_control.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "karts/emergency_animation.hpp"
|
||||
#include "karts/max_speed.hpp"
|
||||
#include "karts/moveable.hpp"
|
||||
#include "karts/kart_properties.hpp"
|
||||
#include "tracks/terrain_info.hpp"
|
||||
#include "utils/no_copy.hpp"
|
||||
@ -43,9 +41,10 @@ class btUprightConstraint;
|
||||
class Attachment;
|
||||
class Camera;
|
||||
class Controller;
|
||||
class EmergencyAnimation;
|
||||
class Item;
|
||||
class KartGFX;
|
||||
class KartModel;
|
||||
class MaxSpeed;
|
||||
class ParticleEmitter;
|
||||
class ParticleKind;
|
||||
class Rain;
|
||||
@ -64,19 +63,29 @@ class SlipStream;
|
||||
* and TerrainInfo, which manages the terrain the kart is on.
|
||||
* \ingroup karts
|
||||
*/
|
||||
class Kart : public TerrainInfo, public Moveable, public EmergencyAnimation,
|
||||
public MaxSpeed
|
||||
class Kart : public AbstractKart
|
||||
{
|
||||
friend class Skidding;
|
||||
protected:
|
||||
/** Handles all emergency animations: rescue and explosion. */
|
||||
EmergencyAnimation *m_emergency_animation;
|
||||
|
||||
private:
|
||||
/** Handles speed increase and capping due to powerup, terrain, ... */
|
||||
MaxSpeed *m_max_speed;
|
||||
|
||||
/** Stores information about the terrain the kart is on. */
|
||||
TerrainInfo *m_terrain_info;
|
||||
|
||||
/** Handles the powerup of a kart. */
|
||||
Powerup *m_powerup;
|
||||
|
||||
/** True if kart is flying (for debug purposes only). */
|
||||
bool m_flying;
|
||||
|
||||
/** Reset position. */
|
||||
btTransform m_reset_transform;
|
||||
|
||||
/** Index of kart in world. */
|
||||
unsigned int m_world_kart_id;
|
||||
|
||||
/** This object handles all skidding. */
|
||||
Skidding *m_skidding;
|
||||
|
||||
@ -84,6 +93,7 @@ private:
|
||||
* controller is used to run the kart. It will be replaced
|
||||
* with an end kart controller when the kart finishes the race. */
|
||||
Controller *m_controller;
|
||||
|
||||
/** This saves the original controller when the end controller is
|
||||
* used. This is an easy solution for restarting the race, since
|
||||
* the controller do not need to be reinitialised. */
|
||||
@ -96,12 +106,8 @@ private:
|
||||
int m_race_position;
|
||||
|
||||
|
||||
|
||||
protected: // Used by the AI atm
|
||||
|
||||
KartControl m_controls; // The kart controls (e.g. steering, fire, ...)
|
||||
Powerup m_powerup;
|
||||
Attachment *m_attachment;
|
||||
|
||||
/** The camera for each kart. Not all karts have cameras (e.g. AI karts
|
||||
* usually don't), but there are exceptions: e.g. after the end of a
|
||||
* race an AI kart is replacing the kart for a player.
|
||||
@ -201,234 +207,202 @@ private:
|
||||
void updateSliding();
|
||||
void updateEnginePowerAndBrakes(float dt);
|
||||
void updateEngineSFX();
|
||||
|
||||
float handleNitro(float dt);
|
||||
float getActualWheelForce();
|
||||
void crashed();
|
||||
|
||||
protected:
|
||||
const KartProperties *m_kart_properties;
|
||||
/** This stores a copy of the kart model. It has to be a copy
|
||||
* since otherwise incosistencies can happen if the same kart
|
||||
* is used more than once. */
|
||||
KartModel* m_kart_model;
|
||||
void loadData(RaceManager::KartType type, bool is_first_kart,
|
||||
bool animatedModel);
|
||||
|
||||
public:
|
||||
Kart(const std::string& ident, unsigned int world_kart_id,
|
||||
int position, const btTransform& init_transform);
|
||||
virtual ~Kart();
|
||||
virtual void init(RaceManager::KartType type, bool is_first_kart);
|
||||
void loadData(RaceManager::KartType type, bool is_first_kart,
|
||||
bool animatedModel);
|
||||
virtual void updateGraphics(float dt, const Vec3& off_xyz,
|
||||
const btQuaternion& off_rotation);
|
||||
virtual void createPhysics ();
|
||||
virtual void updateWeight ();
|
||||
bool isInRest () const;
|
||||
void setSuspensionLength();
|
||||
virtual bool isInRest () const;
|
||||
virtual void setSuspensionLength();
|
||||
virtual void applyEngineForce (float force);
|
||||
float handleNitro (float dt);
|
||||
float getActualWheelForce();
|
||||
|
||||
virtual void flyUp();
|
||||
virtual void flyDown();
|
||||
|
||||
void startEngineSFX ();
|
||||
void adjustSpeed (float f);
|
||||
void capSpeed (float max_speed);
|
||||
virtual void startEngineSFX ();
|
||||
virtual void adjustSpeed (float f);
|
||||
virtual void increaseMaxSpeed(unsigned int category, float add_speed,
|
||||
float duration, float fade_out_time);
|
||||
virtual void setSlowdown(unsigned int category, float max_speed_fraction,
|
||||
float fade_in_time);
|
||||
virtual float getSpeedIncreaseTimeLeft(unsigned int category) const;
|
||||
virtual void collectedItem(Item *item, int random_attachment);
|
||||
virtual const Material *getMaterial() const;
|
||||
virtual const Material *getLastMaterial() const;
|
||||
/** Returns the pitch of the terrain depending on the heading. */
|
||||
virtual float getTerrainPitch(float heading) const;
|
||||
|
||||
virtual void reset ();
|
||||
void handleZipper (const Material *m=NULL, bool play_sound=false);
|
||||
void setSquash (float time, float slowdown);
|
||||
|
||||
void crashed (Kart *k, bool update_attachments);
|
||||
void crashed (const Material *m);
|
||||
virtual void handleZipper (const Material *m=NULL,
|
||||
bool play_sound=false);
|
||||
virtual void setSquash (float time, float slowdown);
|
||||
|
||||
virtual void crashed (AbstractKart *k, bool update_attachments);
|
||||
virtual void crashed (const Material *m);
|
||||
virtual float getHoT () const;
|
||||
virtual void update (float dt);
|
||||
virtual void finishedRace(float time);
|
||||
virtual void setPosition(int p);
|
||||
void beep ();
|
||||
void showZipperFire ();
|
||||
bool playCustomSFX (unsigned int type);
|
||||
void setController(Controller *controller);
|
||||
virtual void beep ();
|
||||
virtual void showZipperFire ();
|
||||
virtual bool playingExplosionAnimation() const;
|
||||
virtual bool playingRescueAnimation() const;
|
||||
virtual bool playingEmergencyAnimation() const;
|
||||
virtual float getCurrentMaxSpeed() const;
|
||||
|
||||
virtual bool playCustomSFX (unsigned int type);
|
||||
virtual void setController(Controller *controller);
|
||||
|
||||
// ========================================================================
|
||||
// Powerup related functions.
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the index of this kart in world. */
|
||||
unsigned int getWorldKartId() const { return m_world_kart_id; }
|
||||
/** Sets a new powerup. */
|
||||
virtual void setPowerup (PowerupManager::PowerupType t, int n);
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns this kart's kart model. */
|
||||
KartModel* getKartModel() { return m_kart_model; }
|
||||
/** Returns the current powerup. */
|
||||
virtual const Powerup* getPowerup() const { return m_powerup; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the current powerup. */
|
||||
virtual Powerup* getPowerup() { return m_powerup; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the number of powerups. */
|
||||
virtual int getNumPowerup() const;
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns a points to this kart's graphical effects. */
|
||||
KartGFX* getKartGFX() { return m_kart_gfx; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the kart properties of this kart. */
|
||||
const KartProperties*
|
||||
getKartProperties() const { return m_kart_properties; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Sets the kart properties. */
|
||||
void setKartProperties(const KartProperties *kp) { m_kart_properties=kp; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Sets a new powerup. */
|
||||
void setPowerup (PowerupManager::PowerupType t, int n)
|
||||
{ m_powerup.set(t, n); }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the current attachment. */
|
||||
const Attachment* getAttachment() const {return m_attachment; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the current attachment, non-const version. */
|
||||
Attachment* getAttachment() {return m_attachment; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the camera of this kart (or NULL if no camera is attached
|
||||
* to this kart). */
|
||||
Camera* getCamera () {return m_camera;}
|
||||
virtual Camera* getCamera () {return m_camera;}
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the camera of this kart (or NULL if no camera is attached
|
||||
* to this kart) - const version. */
|
||||
const Camera* getCamera () const {return m_camera;}
|
||||
virtual const Camera* getCamera () const {return m_camera;}
|
||||
// ------------------------------------------------------------------------
|
||||
/** Sets the camera for this kart. Takes ownership of the camera and will delete it. */
|
||||
void setCamera(Camera *camera);
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the current powerup. */
|
||||
const Powerup *getPowerup () const { return &m_powerup; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the current powerup. */
|
||||
Powerup *getPowerup () { return &m_powerup; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the number of powerups. */
|
||||
int getNumPowerup () const { return m_powerup.getNum(); }
|
||||
/** Sets the camera for this kart. Takes ownership of the camera and
|
||||
* will delete it. */
|
||||
virtual void setCamera(Camera *camera);
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the remaining collected energy. */
|
||||
float getEnergy () const { return m_collected_energy; }
|
||||
virtual float getEnergy () const { return m_collected_energy; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the current position of this kart in the race. */
|
||||
int getPosition () const { return m_race_position; }
|
||||
virtual int getPosition () const { return m_race_position; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the initial position of this kart. */
|
||||
int getInitialPosition () const { return m_initial_position; }
|
||||
virtual int getInitialPosition () const { return m_initial_position; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the finished time for a kart. */
|
||||
float getFinishTime () const { return m_finish_time; }
|
||||
virtual float getFinishTime () const { return m_finish_time; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns true if this kart has finished the race. */
|
||||
bool hasFinishedRace () const { return m_finished_race; }
|
||||
virtual bool hasFinishedRace () const { return m_finished_race; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns true if the kart has a plunger attached to its face. */
|
||||
bool hasViewBlockedByPlunger() const
|
||||
virtual bool hasViewBlockedByPlunger() const
|
||||
{ return m_view_blocked_by_plunger > 0; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Sets that the view is blocked by a plunger. The duration depends on
|
||||
* the difficulty, see KartPorperties getPlungerInFaceTime. */
|
||||
void blockViewWithPlunger()
|
||||
virtual void blockViewWithPlunger()
|
||||
{ m_view_blocked_by_plunger =
|
||||
m_kart_properties->getPlungerInFaceTime();}
|
||||
// -------------------------------------------------------------------------
|
||||
/** Returns a bullet transform object located at the kart's position
|
||||
and oriented in the direction the kart is going. Can be useful
|
||||
e.g. to calculate the starting point and direction of projectiles. */
|
||||
btTransform getAlignedTransform(const float customPitch=-1);
|
||||
virtual btTransform getAlignedTransform(const float customPitch=-1);
|
||||
// -------------------------------------------------------------------------
|
||||
/** Returns the color used for this kart. */
|
||||
const video::SColor &getColor() const
|
||||
{return m_kart_properties->getColor();}
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the maximum engine power for this kart. */
|
||||
float getMaxPower () const {return m_kart_properties->getMaxPower(); }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the time till full steering is reached for this kart. */
|
||||
float getTimeFullSteer() const
|
||||
virtual float getTimeFullSteer() const
|
||||
{ return m_kart_properties->getTimeFullSteer(); }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the maximum steering angle for this kart, which depends on the
|
||||
* speed. */
|
||||
float getMaxSteerAngle () const
|
||||
virtual float getMaxSteerAngle () const
|
||||
{ return m_kart_properties->getMaxSteerAngle(getSpeed()); }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the skidding object for this kart (which can be used to query
|
||||
* skidding related values). */
|
||||
const Skidding *getSkidding() const { return m_skidding; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the current steering value for this kart. */
|
||||
float getSteerPercent() const { return m_controls.m_steer; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns all controls of this kart. */
|
||||
KartControl& getControls() { return m_controls; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns all controls of this kart - const version. */
|
||||
const KartControl& getControls() const { return m_controls; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Sets the kart controls. Used e.g. by replaying history. */
|
||||
void setControls(const KartControl &c) { m_controls = c; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the length of the kart. */
|
||||
float getKartLength () const {return m_kart_model->getLength();}
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the height of the kart. */
|
||||
float getKartHeight () const {return m_kart_model->getHeight();}
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the width of the kart. */
|
||||
float getKartWidth () const {return m_kart_model->getWidth(); }
|
||||
virtual const Skidding *getSkidding() const { return m_skidding; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the bullet vehicle which represents this kart. */
|
||||
btKart *getVehicle () const {return m_vehicle; }
|
||||
virtual btKart *getVehicle () const {return m_vehicle; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the upright constraint for this kart. */
|
||||
btUprightConstraint *getUprightConstraint() const
|
||||
virtual btUprightConstraint *getUprightConstraint() const
|
||||
{return m_uprightConstraint;}
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the speed of the kart in meters/second. */
|
||||
float getSpeed () const {return m_speed; }
|
||||
virtual float getSpeed() const {return m_speed; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** This is used on the client side only to set the speed of the kart
|
||||
* from the server information. */
|
||||
void setSpeed (float s) {m_speed = s; }
|
||||
virtual void setSpeed(float s) {m_speed = s; }
|
||||
// ------------------------------------------------------------------------
|
||||
btQuaternion getVisualRotation() const ;
|
||||
virtual btQuaternion getVisualRotation() const;
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the slipstream object of this kart. */
|
||||
const SlipStream* getSlipstream() const {return m_slipstream; }
|
||||
virtual const SlipStream* getSlipstream() const {return m_slipstream; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the slipstream object of this kart. */
|
||||
SlipStream* getSlipstream() {return m_slipstream; }
|
||||
virtual SlipStream* getSlipstream() {return m_slipstream; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Activates a slipstream effect, atm that is display some nitro. */
|
||||
void setSlipstreamEffect(float f);
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns a name to be displayed for this kart. */
|
||||
virtual const wchar_t* getName() const
|
||||
{ return m_kart_properties->getName(); }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns a unique identifier for this kart (name of the directory the
|
||||
* kart was loaded from). */
|
||||
const std::string& getIdent() const {return m_kart_properties->getIdent();}
|
||||
virtual void setSlipstreamEffect(float f);
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the start transform, i.e. position and rotation. */
|
||||
const btTransform& getResetTransform() const {return m_reset_transform;}
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the controller of this kart. */
|
||||
Controller* getController() { return m_controller; }
|
||||
virtual Controller* getController() { return m_controller; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the controller of this kart (const version). */
|
||||
const Controller* getController() const { return m_controller; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** True if the wheels are touching the ground. */
|
||||
bool isOnGround () const;
|
||||
virtual bool isOnGround() const;
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns true if the kart is close to the ground, used to dis/enable
|
||||
* the upright constraint to allow for more realistic explosions. */
|
||||
bool isNearGround () const;
|
||||
// ------------------------------------------------------------------------
|
||||
virtual bool isEliminated() const;
|
||||
// ------------------------------------------------------------------------
|
||||
virtual void eliminate (bool remove);
|
||||
// ------------------------------------------------------------------------
|
||||
virtual void handleExplosion(const Vec3& pos, bool direct_hit);
|
||||
// ------------------------------------------------------------------------
|
||||
virtual void forceRescue(bool is_auto_rescue=false);
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the timer for the currently played animation. */
|
||||
virtual float getAnimationTimer() const;
|
||||
// ------------------------------------------------------------------------
|
||||
/** Makes a kart invulnerable for a certain amount of time. */
|
||||
void setInvulnerableTime(float t) { m_invulnerable_time = t; };
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns if the kart is invulnerable. */
|
||||
bool isInvulnerable() const { return m_invulnerable_time > 0; }
|
||||
virtual bool isInvulnerable() const { return m_invulnerable_time > 0; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Sets the energy the kart has collected. */
|
||||
void setEnergy(float val) { m_collected_energy = val; }
|
||||
virtual void setEnergy(float val) { m_collected_energy = val; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns if the kart is currently being squashed. */
|
||||
bool isSquashed() const { return m_squash_time >0; }
|
||||
// ------------------------------------------------------------------------
|
||||
bool isWheeless() const {return m_kart_model->getWheelModel(0)==NULL;}
|
||||
virtual bool isSquashed() const { return m_squash_time >0; }
|
||||
}; // Kart
|
||||
|
||||
|
||||
|
@ -23,13 +23,14 @@
|
||||
#include "graphics/particle_emitter.hpp"
|
||||
#include "graphics/particle_kind.hpp"
|
||||
#include "graphics/particle_kind_manager.hpp"
|
||||
#include "karts/kart.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "karts/kart_properties.hpp"
|
||||
#include "karts/skidding.hpp"
|
||||
#include "physics/btKart.hpp"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
KartGFX::KartGFX(const Kart *kart)
|
||||
KartGFX::KartGFX(const AbstractKart *kart)
|
||||
{
|
||||
if(!UserConfigParams::m_graphical_effects)
|
||||
{
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
class Kart;
|
||||
class AbstractKart;
|
||||
class ParticleEmitter;
|
||||
class ParticleKind;
|
||||
class Vec3;
|
||||
@ -58,7 +58,7 @@ private:
|
||||
std::vector<ParticleEmitter*> m_all_emitters;
|
||||
|
||||
/** Pointer to the owner of this kart. */
|
||||
const Kart *m_kart;
|
||||
const AbstractKart *m_kart;
|
||||
|
||||
/** Used to alternate particle effects from the rear wheels. */
|
||||
int m_wheel_toggle;
|
||||
@ -67,7 +67,7 @@ private:
|
||||
const Vec3 &position);
|
||||
|
||||
public:
|
||||
KartGFX(const Kart *kart);
|
||||
KartGFX(const AbstractKart *kart);
|
||||
~KartGFX();
|
||||
void reset();
|
||||
void setSkidLevel(const unsigned int level);
|
||||
|
@ -27,7 +27,8 @@
|
||||
#include "graphics/lod_node.hpp"
|
||||
#include "graphics/mesh_tools.hpp"
|
||||
#include "io/xml_node.hpp"
|
||||
#include "karts/kart.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "karts/kart_properties.hpp"
|
||||
#include "physics/btKart.hpp"
|
||||
#include "utils/constants.hpp"
|
||||
|
||||
|
@ -31,7 +31,7 @@ using namespace irr;
|
||||
#include "utils/no_copy.hpp"
|
||||
#include "utils/vec3.hpp"
|
||||
|
||||
class Kart;
|
||||
class AbstractKart;
|
||||
class KartProperties;
|
||||
class XMLNode;
|
||||
|
||||
@ -135,7 +135,7 @@ private:
|
||||
void OnAnimationEnd(scene::IAnimatedMeshSceneNode *node);
|
||||
|
||||
/** Pointer to the kart object belonging to this kart model. */
|
||||
Kart* m_kart;
|
||||
AbstractKart* m_kart;
|
||||
|
||||
public:
|
||||
KartModel(bool is_master);
|
||||
@ -197,7 +197,7 @@ public:
|
||||
void setAnimation(AnimationFrameType type);
|
||||
// ------------------------------------------------------------------------
|
||||
/** Sets the kart this model is currently used for */
|
||||
void setKart(Kart* k) { m_kart = k; }
|
||||
void setKart(AbstractKart* k) { m_kart = k; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the array of wheel nodes. */
|
||||
scene::ISceneNode** getWheelNodes() { return m_wheel_node; }
|
||||
|
@ -75,10 +75,10 @@ void KartWithStats::handleExplosion(const Vec3& pos, bool direct_hit)
|
||||
Kart::handleExplosion(pos, direct_hit);
|
||||
// If a kart is too far away from an explosion to be affected, its timer
|
||||
// will be 0, and this should then not be counted as an explosion.
|
||||
if(is_new_explosion && EmergencyAnimation::m_timer>0)
|
||||
if(is_new_explosion && m_emergency_animation->getAnimationTimer()>0)
|
||||
{
|
||||
m_explosion_count ++;
|
||||
m_explosion_time += EmergencyAnimation::m_timer;
|
||||
m_explosion_time += m_emergency_animation->getAnimationTimer();
|
||||
}
|
||||
|
||||
} // handleExplosion
|
||||
@ -97,7 +97,7 @@ void KartWithStats::forceRescue(bool is_auto_rescue)
|
||||
if(is_new_rescue)
|
||||
{
|
||||
m_rescue_count++;
|
||||
m_rescue_time += EmergencyAnimation::m_timer;
|
||||
m_rescue_time += m_emergency_animation->getAnimationTimer();
|
||||
}
|
||||
} // forceRescue
|
||||
|
||||
|
@ -21,7 +21,8 @@
|
||||
#include <algorithm>
|
||||
#include <assert.h>
|
||||
|
||||
#include "karts/kart.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "karts/kart_properties.hpp"
|
||||
#include "physics/btKart.hpp"
|
||||
|
||||
/** This class handles maximum speed for karts. Several factors can influence
|
||||
@ -44,7 +45,7 @@
|
||||
* At the end the maximum is capped by a value specified in stk_config
|
||||
* (to avoid issues with physics etc).
|
||||
*/
|
||||
MaxSpeed::MaxSpeed(Kart *kart)
|
||||
MaxSpeed::MaxSpeed(AbstractKart *kart)
|
||||
{
|
||||
m_kart = kart;
|
||||
} // MaxSpeed
|
||||
@ -143,6 +144,11 @@ void MaxSpeed::SpeedIncrease::update(float dt)
|
||||
} // SpeedIncrease::update
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Defines a slowdown, which is in fraction of top speed.
|
||||
* \param category The category for which the speed is increased.
|
||||
* \param max_speed_fraction Fraction of top speed to allow only.
|
||||
* \param fade_in_time How long till maximum speed is capped.
|
||||
*/
|
||||
void MaxSpeed::setSlowdown(unsigned int category, float max_speed_fraction,
|
||||
float fade_in_time)
|
||||
{
|
||||
@ -211,7 +217,8 @@ void MaxSpeed::update(float dt)
|
||||
|
||||
// Then cap the current speed of the kart
|
||||
// --------------------------------------
|
||||
m_kart->capSpeed(m_current_max_speed);
|
||||
if ( m_kart->getSpeed()>m_current_max_speed && m_kart->isOnGround() )
|
||||
m_kart->getVehicle()->capSpeed(m_current_max_speed);
|
||||
|
||||
} // update
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
/** \defgroup karts */
|
||||
|
||||
class Kart;
|
||||
class AbstractKart;
|
||||
|
||||
class MaxSpeed
|
||||
{
|
||||
@ -47,7 +47,7 @@ public:
|
||||
|
||||
private:
|
||||
/** A pointer to the kart to which this speed handling object belongs. */
|
||||
Kart *m_kart;
|
||||
AbstractKart *m_kart;
|
||||
|
||||
/** The current maximum speed. */
|
||||
float m_current_max_speed;
|
||||
@ -125,7 +125,7 @@ private:
|
||||
SpeedIncrease m_speed_increase[MS_INCREASE_MAX];
|
||||
|
||||
public:
|
||||
MaxSpeed(Kart *kart);
|
||||
MaxSpeed(AbstractKart *kart);
|
||||
|
||||
void increaseMaxSpeed(unsigned int category, float add_speed,
|
||||
float duration, float fade_out_time);
|
||||
|
@ -26,6 +26,8 @@
|
||||
#include "modes/world.hpp"
|
||||
#include "tracks/track.hpp"
|
||||
|
||||
#include "ISceneNode.h"
|
||||
|
||||
Moveable::Moveable()
|
||||
{
|
||||
m_body = 0;
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "karts/kart.hpp"
|
||||
#include "karts/kart_gfx.hpp"
|
||||
#include "karts/kart_properties.hpp"
|
||||
#include "karts/max_speed.hpp"
|
||||
#include "modes/world.hpp"
|
||||
#include "physics/btKart.hpp"
|
||||
#include "tracks/track.hpp"
|
||||
@ -208,7 +209,7 @@ void Skidding::update(float dt, bool is_on_ground,
|
||||
{
|
||||
m_kart->getKartGFX()
|
||||
->setCreationRateRelative(KartGFX::KGFX_SKID, 1.0f);
|
||||
m_kart->MaxSpeed::
|
||||
m_kart->m_max_speed->
|
||||
instantSpeedIncrease(MaxSpeed::MS_INCREASE_SKIDDING,
|
||||
bonus_speed, bonus_speed,
|
||||
bonus_time,
|
||||
|
@ -164,8 +164,8 @@
|
||||
#include "items/attachment_manager.hpp"
|
||||
#include "items/item_manager.hpp"
|
||||
#include "items/projectile_manager.hpp"
|
||||
#include "karts/kart_properties.hpp"
|
||||
#include "karts/kart_properties_manager.hpp"
|
||||
#include "karts/kart.hpp"
|
||||
#include "modes/profile_world.hpp"
|
||||
#include "network/network_manager.hpp"
|
||||
#include "race/grand_prix_manager.hpp"
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "challenges/unlock_manager.hpp"
|
||||
#include "config/user_config.hpp"
|
||||
#include "items/powerup_manager.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "states_screens/race_gui_base.hpp"
|
||||
#include "tracks/track.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
@ -73,7 +74,7 @@ void FollowTheLeaderRace::countdownReachedZero()
|
||||
// kart, otherwise remove the last kart.
|
||||
int position_to_remove = m_karts[0]->getPosition()==1
|
||||
? getCurrentNumKarts() : 1;
|
||||
Kart *kart = getKartAtPosition(position_to_remove);
|
||||
AbstractKart *kart = getKartAtPosition(position_to_remove);
|
||||
if(!kart || kart->isEliminated())
|
||||
{
|
||||
fprintf(stderr,"Problem with removing leader: position %d not found\n",
|
||||
|
@ -16,16 +16,18 @@
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "modes/linear_world.hpp"
|
||||
#include "states_screens/race_gui_base.hpp"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "audio/music_manager.hpp"
|
||||
#include "audio/sfx_base.hpp"
|
||||
#include "audio/sfx_manager.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "karts/controller/controller.hpp"
|
||||
#include "karts/kart_properties.hpp"
|
||||
#include "network/network_manager.hpp"
|
||||
#include "race/history.hpp"
|
||||
#include "states_screens/race_gui_base.hpp"
|
||||
#include "tracks/track_sector.hpp"
|
||||
#include "tracks/track.hpp"
|
||||
#include "utils/constants.hpp"
|
||||
@ -150,7 +152,7 @@ void LinearWorld::update(float dt)
|
||||
for(unsigned int n=0; n<kart_amount; n++)
|
||||
{
|
||||
KartInfo& kart_info = m_kart_info[n];
|
||||
Kart* kart = m_karts[n];
|
||||
AbstractKart* kart = m_karts[n];
|
||||
|
||||
// Nothing to do for karts that are currently being
|
||||
// rescued or eliminated
|
||||
@ -215,7 +217,7 @@ void LinearWorld::update(float dt)
|
||||
void LinearWorld::newLap(unsigned int kart_index)
|
||||
{
|
||||
KartInfo &kart_info = m_kart_info[kart_index];
|
||||
Kart *kart = m_karts[kart_index];
|
||||
AbstractKart *kart = m_karts[kart_index];
|
||||
|
||||
// Only update the kart controller if a kart that has already finished
|
||||
// the race crosses the start line again. This avoids 'fastest lap'
|
||||
@ -349,11 +351,12 @@ void LinearWorld::newLap(unsigned int kart_index)
|
||||
* \param kart_id The world kart id of the kart for which to return
|
||||
* the sector.
|
||||
*/
|
||||
int LinearWorld::getSectorForKart(const int kart_id) const
|
||||
int LinearWorld::getSectorForKart(const AbstractKart *kart) const
|
||||
{
|
||||
if(kart_id>=(int)m_kart_info.size())
|
||||
if(kart->getWorldKartId()>=(int)m_kart_info.size())
|
||||
return QuadGraph::UNKNOWN_SECTOR;
|
||||
return m_kart_info[kart_id].getSector()->getCurrentGraphNode();
|
||||
return m_kart_info[kart->getWorldKartId()].getSector()
|
||||
->getCurrentGraphNode();
|
||||
} // getSectorForKart
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -415,7 +418,7 @@ RaceGUIBase::KartIconDisplayInfo* LinearWorld::getKartsDisplayInfo()
|
||||
for(unsigned int i = 0; i < kart_amount ; i++)
|
||||
{
|
||||
RaceGUIBase::KartIconDisplayInfo& rank_info = m_kart_display_info[i];
|
||||
Kart* kart = m_karts[i];
|
||||
AbstractKart* kart = m_karts[i];
|
||||
|
||||
// reset color
|
||||
rank_info.r = 1.0;
|
||||
@ -446,7 +449,7 @@ RaceGUIBase::KartIconDisplayInfo* LinearWorld::getKartsDisplayInfo()
|
||||
{
|
||||
RaceGUIBase::KartIconDisplayInfo& rank_info = m_kart_display_info[i];
|
||||
KartInfo& kart_info = m_kart_info[i];
|
||||
Kart* kart = m_karts[i];
|
||||
AbstractKart* kart = m_karts[i];
|
||||
|
||||
const int position = kart->getPosition();
|
||||
|
||||
@ -504,7 +507,7 @@ RaceGUIBase::KartIconDisplayInfo* LinearWorld::getKartsDisplayInfo()
|
||||
* be updated to get the correct scoring.
|
||||
* \param kart The kart for which to estimate the finishing times.
|
||||
*/
|
||||
float LinearWorld::estimateFinishTimeForKart(Kart* kart)
|
||||
float LinearWorld::estimateFinishTimeForKart(AbstractKart* kart)
|
||||
{
|
||||
const KartInfo &kart_info = m_kart_info[kart->getWorldKartId()];
|
||||
float distance_covered = kart_info.m_race_lap * m_track->getTrackLength()
|
||||
@ -542,7 +545,7 @@ float LinearWorld::estimateFinishTimeForKart(Kart* kart)
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Decide where to drop a rescued kart
|
||||
*/
|
||||
void LinearWorld::moveKartAfterRescue(Kart* kart)
|
||||
void LinearWorld::moveKartAfterRescue(AbstractKart* kart)
|
||||
{
|
||||
KartInfo& info = m_kart_info[kart->getWorldKartId()];
|
||||
|
||||
@ -608,7 +611,7 @@ void LinearWorld::updateRacePosition()
|
||||
// so that debug output is still correct!!!!!!!!!!!
|
||||
for (unsigned int i=0; i<kart_amount; i++)
|
||||
{
|
||||
Kart* kart = m_karts[i];
|
||||
AbstractKart* kart = m_karts[i];
|
||||
// Karts that are either eliminated or have finished the
|
||||
// race already have their (final) position assigned. If
|
||||
// these karts would get their rank updated, it could happen
|
||||
@ -800,7 +803,7 @@ void LinearWorld::checkForWrongDirection(unsigned int i)
|
||||
if(!m_kart_info[i].getSector()->isOnRoad()||
|
||||
m_karts[i]->playingEmergencyAnimation()) return;
|
||||
|
||||
const Kart *kart=m_karts[i];
|
||||
const AbstractKart *kart=m_karts[i];
|
||||
// If the kart can go in more than one directions from the current track
|
||||
// don't do any reverse message handling, since it is likely that there
|
||||
// will be one direction in which it isn't going backwards anyway.
|
||||
|
@ -102,10 +102,10 @@ protected:
|
||||
/** Linear races can trigger rescues for one additional reason : shortcuts.
|
||||
* It may need to do some specific world before calling the generic Kart::forceRescue
|
||||
*/
|
||||
void rescueKartAfterShortcut(Kart* kart, KartInfo& kart_info);
|
||||
void rescueKartAfterShortcut(AbstractKart* kart, KartInfo& kart_info);
|
||||
virtual void checkForWrongDirection(unsigned int i);
|
||||
void updateRacePosition();
|
||||
virtual float estimateFinishTimeForKart(Kart* kart);
|
||||
virtual float estimateFinishTimeForKart(AbstractKart* kart);
|
||||
|
||||
public:
|
||||
LinearWorld();
|
||||
@ -116,7 +116,7 @@ public:
|
||||
virtual ~LinearWorld();
|
||||
|
||||
virtual void update(float delta);
|
||||
int getSectorForKart(const int kart_id) const;
|
||||
int getSectorForKart(const AbstractKart *kart) const;
|
||||
float getDistanceDownTrackForKart(const int kart_id) const;
|
||||
float getDistanceToCenterForKart(const int kart_id) const;
|
||||
float getEstimatedFinishTime(const int kart_id) const;
|
||||
@ -125,7 +125,7 @@ public:
|
||||
|
||||
virtual RaceGUIBase::KartIconDisplayInfo*
|
||||
getKartsDisplayInfo();
|
||||
virtual void moveKartAfterRescue(Kart* kart);
|
||||
virtual void moveKartAfterRescue(AbstractKart* kart);
|
||||
virtual void restartRace();
|
||||
virtual void newLap(unsigned int kart_index);
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include "input/device_manager.hpp"
|
||||
#include "input/input.hpp"
|
||||
#include "input/input_manager.hpp"
|
||||
#include "karts/kart.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "karts/kart_properties_manager.hpp"
|
||||
#include "modes/overworld.hpp"
|
||||
#include "network/network_manager.hpp"
|
||||
|
@ -22,6 +22,9 @@
|
||||
|
||||
#include "audio/music_manager.hpp"
|
||||
#include "io/file_manager.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "karts/kart_model.hpp"
|
||||
#include "karts/kart_properties.hpp"
|
||||
#include "states_screens/race_gui_base.hpp"
|
||||
#include "tracks/track.hpp"
|
||||
#include "tracks/track_object_manager.hpp"
|
||||
@ -101,7 +104,7 @@ ThreeStrikesBattle::~ThreeStrikesBattle()
|
||||
* \param kart The pointer to the kart (not used here).
|
||||
* \param node The scene node of this kart.
|
||||
*/
|
||||
void ThreeStrikesBattle::kartAdded(Kart* kart, scene::ISceneNode* node)
|
||||
void ThreeStrikesBattle::kartAdded(AbstractKart* kart, scene::ISceneNode* node)
|
||||
{
|
||||
float coord = -kart->getKartLength()*0.5f;
|
||||
|
||||
@ -470,7 +473,7 @@ RaceGUIBase::KartIconDisplayInfo* ThreeStrikesBattle::getKartsDisplayInfo()
|
||||
/** Moves a kart to its rescue position.
|
||||
* \param kart The kart that was rescued.
|
||||
*/
|
||||
void ThreeStrikesBattle::moveKartAfterRescue(Kart* kart)
|
||||
void ThreeStrikesBattle::moveKartAfterRescue(AbstractKart* kart)
|
||||
{
|
||||
// find closest point to drop kart on
|
||||
World *world = World::getWorld();
|
||||
@ -494,7 +497,7 @@ void ThreeStrikesBattle::moveKartAfterRescue(Kart* kart)
|
||||
|
||||
for(unsigned int k=0; k<getCurrentNumKarts(); k++)
|
||||
{
|
||||
const Kart *currentKart = World::getWorld()->getKart(k);
|
||||
const AbstractKart *currentKart = World::getWorld()->getKart(k);
|
||||
const float currentKart_x = currentKart->getXYZ().getX();
|
||||
const float currentKartk_z = currentKart->getXYZ().getZ();
|
||||
|
||||
|
@ -96,14 +96,14 @@ public:
|
||||
virtual bool useFastMusicNearEnd() const { return false; }
|
||||
virtual RaceGUIBase::KartIconDisplayInfo* getKartsDisplayInfo();
|
||||
virtual bool raceHasLaps(){ return false; }
|
||||
virtual void moveKartAfterRescue(Kart* kart);
|
||||
virtual void moveKartAfterRescue(AbstractKart* kart);
|
||||
|
||||
virtual const std::string& getIdent() const;
|
||||
|
||||
virtual void kartHit(const int kart_id);
|
||||
virtual void update(float dt);
|
||||
|
||||
virtual void kartAdded(Kart* kart, scene::ISceneNode* node);
|
||||
virtual void kartAdded(AbstractKart* kart, scene::ISceneNode* node);
|
||||
|
||||
|
||||
void updateKartRanks();
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "audio/music_manager.hpp"
|
||||
#include "tutorial/tutorial_manager.hpp"
|
||||
#include "config/user_config.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "items/powerup_manager.hpp"
|
||||
#include "states_screens/race_gui_base.hpp"
|
||||
#include "tracks/track.hpp"
|
||||
@ -74,7 +75,7 @@ void TutorialRace::countdownReachedZero()
|
||||
// kart, otherwise remove the last kart.
|
||||
int position_to_remove = m_karts[0]->getPosition()==1
|
||||
? getCurrentNumKarts() : 1;
|
||||
Kart *kart = getKartAtPosition(position_to_remove);
|
||||
AbstractKart *kart = getKartAtPosition(position_to_remove);
|
||||
if(!kart || kart->isEliminated())
|
||||
{
|
||||
fprintf(stderr,"Problem with removing leader: position %d not found\n",
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "karts/controller/new_ai_controller.hpp"
|
||||
#include "karts/controller/player_controller.hpp"
|
||||
#include "karts/controller/end_controller.hpp"
|
||||
#include "karts/kart.hpp"
|
||||
#include "karts/kart_properties_manager.hpp"
|
||||
#include "modes/profile_world.hpp"
|
||||
#include "network/network_manager.hpp"
|
||||
@ -143,7 +144,7 @@ void World::init()
|
||||
: race_manager->getKartIdent(i);
|
||||
int local_player_id = race_manager->getKartLocalPlayerId(i);
|
||||
int global_player_id = race_manager->getKartGlobalPlayerId(i);
|
||||
Kart* newkart = createKart(kart_ident, i, local_player_id,
|
||||
AbstractKart* newkart = createKart(kart_ident, i, local_player_id,
|
||||
global_player_id,
|
||||
race_manager->getKartType(i));
|
||||
m_karts.push_back(newkart);
|
||||
@ -191,13 +192,13 @@ void World::createRaceGUI()
|
||||
* \param global_player_id If the kart is a player kart this is the index of
|
||||
* this player globally (i.e. including network players).
|
||||
*/
|
||||
Kart *World::createKart(const std::string &kart_ident, int index,
|
||||
AbstractKart *World::createKart(const std::string &kart_ident, int index,
|
||||
int local_player_id, int global_player_id,
|
||||
RaceManager::KartType kart_type)
|
||||
{
|
||||
int position = index+1;
|
||||
btTransform init_pos = m_track->getStartTransform(index);
|
||||
Kart *new_kart = new Kart(kart_ident, index, position, init_pos);
|
||||
AbstractKart *new_kart = new Kart(kart_ident, index, position, init_pos);
|
||||
new_kart->init(race_manager->getKartType(index), (local_player_id == 0));
|
||||
Controller *controller = NULL;
|
||||
switch(kart_type)
|
||||
@ -232,7 +233,7 @@ Kart *World::createKart(const std::string &kart_ident, int index,
|
||||
/** Creates an AI controller for the kart.
|
||||
* \param kart The kart to be controlled by an AI.
|
||||
*/
|
||||
Controller* World::loadAIController(Kart *kart)
|
||||
Controller* World::loadAIController(AbstractKart *kart)
|
||||
{
|
||||
Controller *controller;
|
||||
// const int NUM_ROBOTS = 1;
|
||||
@ -398,7 +399,7 @@ void World::resetAllKarts()
|
||||
// heights and so things might change from kart to kart.
|
||||
for(unsigned int kart_id=0; kart_id<m_karts.size(); kart_id++)
|
||||
{
|
||||
Kart *kart = m_karts[kart_id];
|
||||
AbstractKart *kart = m_karts[kart_id];
|
||||
kart->setXYZ(center);
|
||||
|
||||
btQuaternion heading(btVector3(0.0f, 1.0f, 0.0f),
|
||||
@ -792,7 +793,7 @@ void World::updateHighscores(int* best_highscore_rank, int* best_finish_time,
|
||||
* so it shouldn't be called inside of loops.
|
||||
* \param n Index of player kart to return.
|
||||
*/
|
||||
Kart *World::getPlayerKart(unsigned int n) const
|
||||
AbstractKart *World::getPlayerKart(unsigned int n) const
|
||||
{
|
||||
unsigned int count=-1;
|
||||
|
||||
@ -811,7 +812,7 @@ Kart *World::getPlayerKart(unsigned int n) const
|
||||
* (since an AI kart will have the camera).
|
||||
* \param n Index of player kart to return.
|
||||
*/
|
||||
Kart *World::getLocalPlayerKart(unsigned int n) const
|
||||
AbstractKart *World::getLocalPlayerKart(unsigned int n) const
|
||||
{
|
||||
int count=-1;
|
||||
const int kart_count = m_karts.size();
|
||||
@ -833,7 +834,7 @@ Kart *World::getLocalPlayerKart(unsigned int n) const
|
||||
void World::eliminateKart(int kart_number, bool notify_of_elimination,
|
||||
bool remove)
|
||||
{
|
||||
Kart *kart = m_karts[kart_number];
|
||||
AbstractKart *kart = m_karts[kart_number];
|
||||
|
||||
// Display a message about the eliminated kart in the race gui
|
||||
if (notify_of_elimination)
|
||||
|
@ -34,9 +34,9 @@
|
||||
#include "states_screens/state_manager.hpp"
|
||||
#include "utils/random_generator.hpp"
|
||||
|
||||
class AbstractKart;
|
||||
class btRigidBody;
|
||||
class Controller;
|
||||
class Kart;
|
||||
class Track;
|
||||
|
||||
/**
|
||||
@ -60,7 +60,7 @@ class Track;
|
||||
class World : public WorldStatus
|
||||
{
|
||||
public:
|
||||
typedef std::vector<Kart*> KartList;
|
||||
typedef std::vector<AbstractKart*> KartList;
|
||||
private:
|
||||
/** A pointer to the global world object for a race. */
|
||||
static World *m_world;
|
||||
@ -71,7 +71,7 @@ protected:
|
||||
RandomGenerator m_random;
|
||||
|
||||
Physics* m_physics;
|
||||
Kart* m_fastest_kart;
|
||||
AbstractKart* m_fastest_kart;
|
||||
/** Number of eliminated karts. */
|
||||
int m_eliminated_karts;
|
||||
/** Number of eliminated players. */
|
||||
@ -93,9 +93,9 @@ protected:
|
||||
void eliminateKart (int kart_number, bool notifyOfElimination=true,
|
||||
bool remove=true);
|
||||
Controller*
|
||||
loadAIController (Kart *kart);
|
||||
loadAIController (AbstractKart *kart);
|
||||
|
||||
virtual Kart *createKart(const std::string &kart_ident, int index,
|
||||
virtual AbstractKart *createKart(const std::string &kart_ident, int index,
|
||||
int local_player_id, int global_player_id,
|
||||
RaceManager::KartType type);
|
||||
/** Pointer to the track. The track is managed by world. */
|
||||
@ -115,22 +115,6 @@ protected:
|
||||
|
||||
irr::video::SColor m_clear_color;
|
||||
|
||||
virtual void onGo();
|
||||
/** Returns true if the race is over. Must be defined by all modes. */
|
||||
virtual bool isRaceOver() = 0;
|
||||
virtual void update(float dt);
|
||||
void updateTrack(float dt);
|
||||
/** Used for AI karts that are still racing when all player kart finished.
|
||||
* Generally it should estimate the arrival time for those karts, but as
|
||||
* a default (useful for battle mode and ftl races) we just use the
|
||||
* current time for this (since this is a good value for karts still
|
||||
* around at the end of a race, and other criteria (number of lives,
|
||||
* race position) will be used to determine the final order.
|
||||
*/
|
||||
virtual float estimateFinishTimeForKart(Kart* kart) {return getTime(); }
|
||||
|
||||
virtual void createRaceGUI();
|
||||
|
||||
/** Pausing/unpausing are not done immediately, but at next udpdate. The
|
||||
* use of this is when switching between screens : if we leave a screen
|
||||
* that paused the game, only to go to another screen that pauses back
|
||||
@ -152,6 +136,24 @@ protected:
|
||||
*/
|
||||
bool m_self_destruct;
|
||||
|
||||
virtual void onGo();
|
||||
/** Returns true if the race is over. Must be defined by all modes. */
|
||||
virtual bool isRaceOver() = 0;
|
||||
virtual void update(float dt);
|
||||
virtual void createRaceGUI();
|
||||
void updateTrack(float dt);
|
||||
// ------------------------------------------------------------------------
|
||||
/** Used for AI karts that are still racing when all player kart finished.
|
||||
* Generally it should estimate the arrival time for those karts, but as
|
||||
* a default (useful for battle mode and ftl races) we just use the
|
||||
* current time for this (since this is a good value for karts still
|
||||
* around at the end of a race, and other criteria (number of lives,
|
||||
* race position) will be used to determine the final order.
|
||||
*/
|
||||
virtual float estimateFinishTimeForKart(AbstractKart* kart)
|
||||
{return getTime(); }
|
||||
|
||||
|
||||
public:
|
||||
World();
|
||||
virtual ~World();
|
||||
@ -182,7 +184,7 @@ public:
|
||||
/** Since each mode will have a different way of deciding where a rescued
|
||||
* kart is dropped, this method will be called and each mode can implement
|
||||
* it. */
|
||||
virtual void moveKartAfterRescue(Kart* kart) = 0;
|
||||
virtual void moveKartAfterRescue(AbstractKart* kart) = 0;
|
||||
// ------------------------------------------------------------------------
|
||||
/** Called when it is needed to know whether this kind of race involves
|
||||
* counting laps. */
|
||||
@ -212,7 +214,7 @@ public:
|
||||
// ------------------------------------------------------------------------
|
||||
/** If you want to do something to karts or their graphics at the start
|
||||
* of the race, override this. */
|
||||
virtual void kartAdded(Kart* kart, scene::ISceneNode* node) {}
|
||||
virtual void kartAdded(AbstractKart* kart, scene::ISceneNode* node) {}
|
||||
// ------------------------------------------------------------------------
|
||||
/** Called whenever a kart starts a new lap. Meaningless (and won't be
|
||||
* called) in non-laped races.
|
||||
@ -229,10 +231,10 @@ public:
|
||||
void schedulePause(Phase phase);
|
||||
void scheduleUnpause();
|
||||
void updateWorld(float dt);
|
||||
void handleExplosion(const Vec3 &xyz, Kart *kart_hit,
|
||||
void handleExplosion(const Vec3 &xyz, AbstractKart *kart_hit,
|
||||
PhysicalObject *object);
|
||||
Kart *getPlayerKart(unsigned int player) const;
|
||||
Kart *getLocalPlayerKart(unsigned int n) const;
|
||||
AbstractKart* getPlayerKart(unsigned int player) const;
|
||||
AbstractKart* getLocalPlayerKart(unsigned int n) const;
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns a pointer to the race gui. */
|
||||
RaceGUIBase *getRaceGUI() const { return m_race_gui;}
|
||||
@ -241,7 +243,7 @@ public:
|
||||
unsigned int getNumKarts() const { return m_karts.size(); }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the kart with a given world id. */
|
||||
Kart *getKart(int kartId) const {
|
||||
AbstractKart *getKart(int kartId) const {
|
||||
assert(kartId >= 0 && kartId < int(m_karts.size()));
|
||||
return m_karts[kartId]; }
|
||||
// ------------------------------------------------------------------------
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "audio/sfx_base.hpp"
|
||||
#include "config/stk_config.hpp"
|
||||
#include "guiengine/modaldialog.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "modes/world.hpp"
|
||||
#include "tracks/track.hpp"
|
||||
#include "network/network_manager.hpp"
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
#include "modes/world_with_rank.hpp"
|
||||
|
||||
#include "karts/kart.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "race/history.hpp"
|
||||
|
||||
#include <iostream>
|
||||
@ -40,7 +40,7 @@ void WorldWithRank::init()
|
||||
/** Returns the kart with a given position.
|
||||
* \param p The position of the kart, 1<=p<=num_karts).
|
||||
*/
|
||||
Kart* WorldWithRank::getKartAtPosition(unsigned int p) const
|
||||
AbstractKart* WorldWithRank::getKartAtPosition(unsigned int p) const
|
||||
{
|
||||
if(p<1 || p>m_position_index.size())
|
||||
return NULL;
|
||||
|
@ -22,6 +22,8 @@
|
||||
|
||||
#include "modes/world.hpp"
|
||||
|
||||
class AbstractKart;
|
||||
|
||||
/**
|
||||
* A WorldWithRank is a world where the karts are ranked. This is the base
|
||||
* class for races and battle modes - all of which rank the kart.
|
||||
@ -63,7 +65,7 @@ public:
|
||||
unsigned int position);
|
||||
void endSetKartPositions();
|
||||
|
||||
Kart* getKartAtPosition(unsigned int p) const;
|
||||
AbstractKart* getKartAtPosition(unsigned int p) const;
|
||||
}; // WorldWithRank
|
||||
|
||||
#endif
|
||||
|
@ -31,7 +31,7 @@ KartControlMessage::KartControlMessage()
|
||||
allocate(control_size*num_local_players);
|
||||
for(unsigned int i=0; i<num_local_players; i++)
|
||||
{
|
||||
const Kart *kart = world->getLocalPlayerKart(i);
|
||||
const AbstractKart *kart = world->getLocalPlayerKart(i);
|
||||
const KartControl& controls = kart->getControls();
|
||||
controls.serialise(this);
|
||||
}
|
||||
@ -51,7 +51,7 @@ KartControlMessage::KartControlMessage(ENetPacket* pkt, int kart_id_offset,
|
||||
for(int i=kart_id_offset; i<kart_id_offset+num_local_players; i++)
|
||||
{
|
||||
KartControl kc(this);
|
||||
Kart *kart = World::getWorld()->getKart(i);
|
||||
AbstractKart *kart = World::getWorld()->getKart(i);
|
||||
if(kart->getController()->isNetworkController())
|
||||
{
|
||||
((NetworkKart*)kart)->setControl(kc);
|
||||
|
@ -18,8 +18,8 @@
|
||||
|
||||
#include "network/kart_update_message.hpp"
|
||||
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "modes/world.hpp"
|
||||
#include "karts/kart.hpp"
|
||||
|
||||
KartUpdateMessage::KartUpdateMessage()
|
||||
: Message(Message::MT_KART_INFO)
|
||||
@ -35,7 +35,7 @@ KartUpdateMessage::KartUpdateMessage()
|
||||
addChar(num_karts);
|
||||
for(unsigned int i=0; i<num_karts; i++)
|
||||
{
|
||||
const Kart* kart = world->getKart(i);
|
||||
const AbstractKart* kart = world->getKart(i);
|
||||
const KartControl& kc=kart->getControls();
|
||||
kc.serialise(this);
|
||||
addVec3(kart->getXYZ());
|
||||
@ -54,7 +54,7 @@ KartUpdateMessage::KartUpdateMessage(ENetPacket* pkt)
|
||||
KartControl kc(this);
|
||||
Vec3 xyz = getVec3();
|
||||
btQuaternion q = getQuaternion();
|
||||
Kart *kart = world->getKart(i);
|
||||
AbstractKart *kart = world->getKart(i);
|
||||
kart->setXYZ(xyz);
|
||||
kart->setRotation(q);
|
||||
} // for i
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
#include "network/race_result_message.hpp"
|
||||
|
||||
#include "karts/kart.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "modes/world.hpp"
|
||||
#include "race/race_manager.hpp"
|
||||
|
||||
@ -32,7 +32,7 @@ RaceResultMessage::RaceResultMessage() : Message(MT_RACE_RESULT)
|
||||
allocate(num_karts * (getFloatLength()+getCharLength()));
|
||||
for(unsigned int i=0; i<num_karts; i++)
|
||||
{
|
||||
const Kart *kart = world->getKart(i);
|
||||
const AbstractKart *kart = world->getKart(i);
|
||||
addFloat(kart->getFinishTime());
|
||||
addChar(kart->getPosition());
|
||||
} // for i in karts
|
||||
@ -50,7 +50,7 @@ RaceResultMessage::RaceResultMessage(ENetPacket* pkt)
|
||||
const unsigned int num_karts = world->getNumKarts();
|
||||
for(unsigned int i=0; i<num_karts; i++)
|
||||
{
|
||||
Kart *kart = world->getKart(i);
|
||||
AbstractKart *kart = world->getKart(i);
|
||||
float time = getFloat();
|
||||
char position = getChar();
|
||||
kart->setPosition(position);
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "network/network_manager.hpp"
|
||||
#include "network/race_state.hpp"
|
||||
#include "items/item_manager.hpp"
|
||||
#include "items/powerup.hpp"
|
||||
#include "items/projectile_manager.hpp"
|
||||
|
||||
RaceState *race_state=NULL;
|
||||
@ -64,7 +65,7 @@ void RaceState::serialise()
|
||||
World *world = World::getWorld();
|
||||
for(unsigned int i=0; i<num_karts; i++)
|
||||
{
|
||||
const Kart* kart = world->getKart(i);
|
||||
const AbstractKart* kart = world->getKart(i);
|
||||
m_kart_controls[i].serialise(this);
|
||||
addVec3(kart->getXYZ());
|
||||
addQuaternion(kart->getRotation());
|
||||
@ -123,7 +124,7 @@ void RaceState::receive(ENetPacket *pkt)
|
||||
// Currently not used!
|
||||
Vec3 xyz = getVec3();
|
||||
btQuaternion q = getQuaternion();
|
||||
Kart *kart = world->getKart(i);
|
||||
AbstractKart *kart = world->getKart(i);
|
||||
// Firing needs to be done from here to guarantee that any potential
|
||||
// new rockets are created before the update for the rockets is handled
|
||||
if(kc.m_fire)
|
||||
|
@ -23,8 +23,8 @@
|
||||
|
||||
#include "items/flyable.hpp"
|
||||
#include "items/item.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "karts/controller/kart_control.hpp"
|
||||
#include "karts/kart.hpp"
|
||||
#include "modes/world.hpp"
|
||||
#include "network/flyable_info.hpp"
|
||||
#include "network/item_info.hpp"
|
||||
@ -90,7 +90,7 @@ private:
|
||||
* called. This allows modifications of kart->m_control during the
|
||||
* update (e.g. see in kart::update() how firing is handled).
|
||||
*/
|
||||
void storeKartControls(const Kart& kart)
|
||||
void storeKartControls(const AbstractKart& kart)
|
||||
{
|
||||
m_kart_controls[kart.getWorldKartId()] = kart.getControls();
|
||||
} // storeKartControls
|
||||
|
@ -915,6 +915,17 @@ void btKart::instantSpeedIncreaseTo(float speed)
|
||||
m_zipper_velocity = speed;
|
||||
} // activateZipper
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Caps the speed at a given value. If necessary the kart will
|
||||
* instantaneously change its speed. */
|
||||
void btKart::capSpeed(float max_speed)
|
||||
{
|
||||
const btVector3 &velocity = m_chassisBody->getLinearVelocity();
|
||||
float speed = velocity.length();
|
||||
const float velocity_ratio = max_speed/speed;
|
||||
m_chassisBody->setLinearVelocity( velocity * velocity_ratio);
|
||||
} // capSpeed
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//Shorter version of above raycast function. This is used when projecting
|
||||
//vehicles towards the ground at the start of a race
|
||||
|
@ -168,6 +168,7 @@ public:
|
||||
public:
|
||||
void setSliding(bool active);
|
||||
void instantSpeedIncreaseTo(float speed);
|
||||
void capSpeed(float max_speed);
|
||||
bool projectVehicleToSurface(const btVector3& ray,
|
||||
bool translate_vehicle);
|
||||
|
||||
|
@ -18,9 +18,11 @@
|
||||
|
||||
#include "physics/irr_debug_drawer.hpp"
|
||||
|
||||
#include "karts/kart.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "modes/world.hpp"
|
||||
|
||||
#include <ISceneNode.h>
|
||||
|
||||
IrrDebugDrawer::IrrDebugDrawer()
|
||||
{
|
||||
m_debug_mode = DM_NONE;
|
||||
@ -37,7 +39,7 @@ void IrrDebugDrawer::nextDebugMode()
|
||||
unsigned int num_karts = world->getNumKarts();
|
||||
for(unsigned int i=0; i<num_karts; i++)
|
||||
{
|
||||
Kart *kart = world->getKart(i);
|
||||
AbstractKart *kart = world->getKart(i);
|
||||
if(kart->isEliminated()) continue;
|
||||
kart->getNode()->setVisible(!(m_debug_mode & DM_NO_KARTS_GRAPHICS));
|
||||
}
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include "animations/three_d_animation.hpp"
|
||||
#include "config/user_config.hpp"
|
||||
#include "karts/kart_properties.hpp"
|
||||
#include "network/race_state.hpp"
|
||||
#include "graphics/stars.hpp"
|
||||
#include "physics/btKart.hpp"
|
||||
@ -76,7 +77,7 @@ Physics::~Physics()
|
||||
* \param kart The kart to add.
|
||||
* \param vehicle The raycast vehicle object.
|
||||
*/
|
||||
void Physics::addKart(const Kart *kart)
|
||||
void Physics::addKart(const AbstractKart *kart)
|
||||
{
|
||||
m_dynamics_world->addRigidBody(kart->getBody());
|
||||
m_dynamics_world->addVehicle(kart->getVehicle());
|
||||
@ -88,7 +89,7 @@ void Physics::addKart(const Kart *kart)
|
||||
* (and during cleanup).
|
||||
* \param kart The kart to remove.
|
||||
*/
|
||||
void Physics::removeKart(const Kart *kart)
|
||||
void Physics::removeKart(const AbstractKart *kart)
|
||||
{
|
||||
m_dynamics_world->removeRigidBody(kart->getBody());
|
||||
m_dynamics_world->removeVehicle(kart->getVehicle());
|
||||
@ -124,8 +125,8 @@ void Physics::update(float dt)
|
||||
// --------------------
|
||||
if(p->getUserPointer(0)->is(UserPointer::UP_KART))
|
||||
{
|
||||
Kart *a=p->getUserPointer(0)->getPointerKart();
|
||||
Kart *b=p->getUserPointer(1)->getPointerKart();
|
||||
AbstractKart *a=p->getUserPointer(0)->getPointerKart();
|
||||
AbstractKart *b=p->getUserPointer(1)->getPointerKart();
|
||||
race_state->addCollision(a->getWorldKartId(),
|
||||
b->getWorldKartId());
|
||||
KartKartCollision(p->getUserPointer(0)->getPointerKart(),
|
||||
@ -143,7 +144,7 @@ void Physics::update(float dt)
|
||||
->getPointerPhysicalObject();
|
||||
if(obj->isCrashReset())
|
||||
{
|
||||
Kart *kart = p->getUserPointer(1)->getPointerKart();
|
||||
AbstractKart *kart = p->getUserPointer(1)->getPointerKart();
|
||||
kart->forceRescue();
|
||||
}
|
||||
continue;
|
||||
@ -155,7 +156,7 @@ void Physics::update(float dt)
|
||||
ThreeDAnimation *anim=p->getUserPointer(0)->getPointerAnimation();
|
||||
if(anim->isCrashReset())
|
||||
{
|
||||
Kart *kart = p->getUserPointer(1)->getPointerKart();
|
||||
AbstractKart *kart = p->getUserPointer(1)->getPointerKart();
|
||||
kart->forceRescue();
|
||||
}
|
||||
continue;
|
||||
@ -204,7 +205,7 @@ void Physics::update(float dt)
|
||||
* Used in setting the starting positions of all the karts.
|
||||
*/
|
||||
|
||||
bool Physics::projectKartDownwards(const Kart *k)
|
||||
bool Physics::projectKartDownwards(const AbstractKart *k)
|
||||
{
|
||||
btVector3 hell(0, -10000, 0);
|
||||
return k->getVehicle()->projectVehicleToSurface(hell,
|
||||
@ -224,15 +225,17 @@ bool Physics::projectKartDownwards(const Kart *k)
|
||||
* \param contact_point_b Location of collision at second kart (in kart
|
||||
* coordinates).
|
||||
*/
|
||||
void Physics::KartKartCollision(Kart *kart_a, const Vec3 &contact_point_a,
|
||||
Kart *kart_b, const Vec3 &contact_point_b)
|
||||
void Physics::KartKartCollision(AbstractKart *kart_a,
|
||||
const Vec3 &contact_point_a,
|
||||
AbstractKart *kart_b,
|
||||
const Vec3 &contact_point_b)
|
||||
{
|
||||
// Only one kart needs to handle the attachments, it will
|
||||
// fix the attachments for the other kart.
|
||||
kart_a->crashed(kart_b, /*handle_attachments*/true);
|
||||
kart_b->crashed(kart_a, /*handle_attachments*/false);
|
||||
|
||||
Kart *left_kart, *right_kart;
|
||||
AbstractKart *left_kart, *right_kart;
|
||||
|
||||
// Determine which kart is pushed to the left, and which one to the
|
||||
// right. Ideally the sign of the X coordinate of the local conact point
|
||||
@ -399,7 +402,7 @@ btScalar Physics::solveGroup(btCollisionObject** bodies, int numBodies,
|
||||
upA, contact_manifold->getContactPoint(0).m_localPointA);
|
||||
else if(upB->is(UserPointer::UP_KART))
|
||||
{
|
||||
Kart *kart=upB->getPointerKart();
|
||||
AbstractKart *kart=upB->getPointerKart();
|
||||
race_state->addCollision(kart->getWorldKartId());
|
||||
int n = contact_manifold->getContactPoint(0).m_index0;
|
||||
const Material *m
|
||||
@ -414,7 +417,7 @@ btScalar Physics::solveGroup(btCollisionObject** bodies, int numBodies,
|
||||
{
|
||||
if(upB->is(UserPointer::UP_TRACK))
|
||||
{
|
||||
Kart *kart = upA->getPointerKart();
|
||||
AbstractKart *kart = upA->getPointerKart();
|
||||
race_state->addCollision(kart->getWorldKartId());
|
||||
int n = contact_manifold->getContactPoint(0).m_index1;
|
||||
const Material *m
|
||||
|
@ -33,7 +33,7 @@
|
||||
#include "physics/stk_dynamics_world.hpp"
|
||||
#include "physics/user_pointer.hpp"
|
||||
|
||||
class Kart;
|
||||
class AbstractKart;
|
||||
class STKDynamicsWorld;
|
||||
class Vec3;
|
||||
|
||||
@ -138,12 +138,12 @@ public:
|
||||
Physics ();
|
||||
~Physics ();
|
||||
void init (const Vec3 &min_world, const Vec3 &max_world);
|
||||
void addKart (const Kart *k);
|
||||
void addKart (const AbstractKart *k);
|
||||
void addBody (btRigidBody* b) {m_dynamics_world->addRigidBody(b);}
|
||||
void removeKart (const Kart *k);
|
||||
void removeKart (const AbstractKart *k);
|
||||
void removeBody (btRigidBody* b) {m_dynamics_world->removeRigidBody(b);}
|
||||
void KartKartCollision(Kart *ka, const Vec3 &contact_point_a,
|
||||
Kart *kb, const Vec3 &contact_point_b);
|
||||
void KartKartCollision(AbstractKart *ka, const Vec3 &contact_point_a,
|
||||
AbstractKart *kb, const Vec3 &contact_point_b);
|
||||
void update (float dt);
|
||||
void draw ();
|
||||
STKDynamicsWorld*
|
||||
@ -153,7 +153,7 @@ public:
|
||||
void nextDebugMode () {m_debug_drawer->nextDebugMode(); }
|
||||
/** Returns true if the debug drawer is enabled. */
|
||||
bool isDebug() const {return m_debug_drawer->debugEnabled(); }
|
||||
bool projectKartDownwards(const Kart *k);
|
||||
bool projectKartDownwards(const AbstractKart *k);
|
||||
virtual btScalar solveGroup(btCollisionObject** bodies, int numBodies,
|
||||
btPersistentManifold** manifold,int numManifolds,
|
||||
btTypedConstraint** constraints,int numConstraints,
|
||||
|
@ -22,12 +22,12 @@
|
||||
/** Some bullet objects store 'user pointers'. This is a base class
|
||||
* that allows to easily determine the type of the user pointer.
|
||||
*/
|
||||
class TriangleMesh;
|
||||
class Moveable;
|
||||
class AbstractKart;
|
||||
class Flyable;
|
||||
class Kart;
|
||||
class Moveable;
|
||||
class PhysicalObject;
|
||||
class ThreeDAnimation;
|
||||
class TriangleMesh;
|
||||
|
||||
/** A UserPointer is stored as a user pointer in all bullet bodies. This
|
||||
* allows easily finding the appropriate STK object for a bullet body.
|
||||
@ -47,12 +47,12 @@ public:
|
||||
TriangleMesh* getPointerTriangleMesh() const {return (TriangleMesh*)m_pointer; }
|
||||
Moveable* getPointerMoveable() const {return (Moveable*)m_pointer; }
|
||||
Flyable* getPointerFlyable() const {return (Flyable*)m_pointer; }
|
||||
Kart* getPointerKart() const {return (Kart*)m_pointer; }
|
||||
AbstractKart* getPointerKart() const {return (AbstractKart*)m_pointer; }
|
||||
PhysicalObject *getPointerPhysicalObject() const {return (PhysicalObject*)m_pointer; }
|
||||
ThreeDAnimation*getPointerAnimation() const {return (ThreeDAnimation*)m_pointer;}
|
||||
void set(PhysicalObject* p) { m_user_pointer_type=UP_PHYSICAL_OBJECT;
|
||||
m_pointer =p; }
|
||||
void set(Kart* p) { m_user_pointer_type=UP_KART;
|
||||
void set(AbstractKart* p) { m_user_pointer_type=UP_KART;
|
||||
m_pointer =p; }
|
||||
void set(Flyable* p) { m_user_pointer_type=UP_FLYABLE;
|
||||
m_pointer =p; }
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
#include "io/file_manager.hpp"
|
||||
#include "modes/world.hpp"
|
||||
#include "karts/kart.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "physics/physics.hpp"
|
||||
#include "race/race_manager.hpp"
|
||||
#include "tracks/track.hpp"
|
||||
@ -110,7 +110,7 @@ void History::updateSaving(float dt)
|
||||
unsigned int index = m_current*num_karts;
|
||||
for(unsigned int i=0; i<num_karts; i++)
|
||||
{
|
||||
const Kart *kart = world->getKart(i);
|
||||
const AbstractKart *kart = world->getKart(i);
|
||||
m_all_controls[index+i] = kart->getControls();
|
||||
m_all_xyz[index+i] = kart->getXYZ();
|
||||
m_all_rotations[index+i] = kart->getVisualRotation();
|
||||
@ -136,7 +136,7 @@ void History::updateReplay(float dt)
|
||||
unsigned int num_karts = world->getNumKarts();
|
||||
for(unsigned k=0; k<num_karts; k++)
|
||||
{
|
||||
Kart *kart = world->getKart(k);
|
||||
AbstractKart *kart = world->getKart(k);
|
||||
unsigned int index=m_current*num_karts+k;
|
||||
if(m_replay_mode==HISTORY_POSITION)
|
||||
{
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include "config/stk_config.hpp"
|
||||
#include "input/device_manager.hpp"
|
||||
#include "input/input_manager.hpp"
|
||||
#include "karts/kart.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "karts/controller/controller.hpp"
|
||||
#include "karts/kart_properties_manager.hpp"
|
||||
#include "modes/follow_the_leader.hpp"
|
||||
@ -140,7 +140,7 @@ void RaceManager::setLocalKartInfo(unsigned int player_id,
|
||||
/** Returns a pointer to the kart which has a given GP rank.
|
||||
* \param n The rank (1 to number of karts) to look for.
|
||||
*/
|
||||
const Kart *RaceManager::getKartWithGPRank(unsigned int n)
|
||||
const AbstractKart *RaceManager::getKartWithGPRank(unsigned int n)
|
||||
{
|
||||
for(unsigned int i=0; i<m_kart_status.size(); i++)
|
||||
if(m_kart_status[i].m_gp_rank == (int)n)
|
||||
@ -477,7 +477,7 @@ void RaceManager::computeGPRanks()
|
||||
// m_kart_status[position[i]].m_ident.c_str(), i-start);
|
||||
if(UserConfigParams::m_ftl_debug)
|
||||
{
|
||||
const Kart *kart =
|
||||
const AbstractKart *kart =
|
||||
World::getWorld()->getKart(sort_data[i].m_position);
|
||||
printf("[ftl] kart '%s' has now position %d.\n",
|
||||
kart->getIdent().c_str(),
|
||||
@ -573,7 +573,7 @@ void RaceManager::exitRace(bool delete_world)
|
||||
* \param kart The kart that finished the race.
|
||||
* \param time Time at which the kart finished the race.
|
||||
*/
|
||||
void RaceManager::kartFinishedRace(const Kart *kart, float time)
|
||||
void RaceManager::kartFinishedRace(const AbstractKart *kart, float time)
|
||||
{
|
||||
unsigned int id = kart->getWorldKartId();
|
||||
int pos = kart->getPosition();
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include "race/grand_prix_data.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
|
||||
class Kart;
|
||||
class AbstractKart;
|
||||
class Track;
|
||||
|
||||
static const std::string IDENT_STD ("STANDARD" );
|
||||
@ -380,7 +380,7 @@ public:
|
||||
/** \brief Returns the kart with a given GP rank (or NULL if no such kart exists).
|
||||
* \param n Rank (0<=n<num_karts) to look for.
|
||||
*/
|
||||
const Kart* getKartWithGPRank(unsigned int n);
|
||||
const AbstractKart* getKartWithGPRank(unsigned int n);
|
||||
|
||||
/** \return the GP rank of a local player, or -1 if the given player ID doesn't exist */
|
||||
int getLocalPlayerGPRank(const int playerID) const;
|
||||
@ -507,7 +507,7 @@ public:
|
||||
* the race manager know about current status
|
||||
*/
|
||||
bool allPlayerFinished() const {return m_num_finished_players==m_player_karts.size();}
|
||||
void kartFinishedRace(const Kart* kart, float time);
|
||||
void kartFinishedRace(const AbstractKart* kart, float time);
|
||||
|
||||
/** \} */
|
||||
|
||||
|
@ -94,7 +94,7 @@ void ReplayRecorder::update(float dt)
|
||||
|
||||
for(unsigned int i=0; i<num_karts; i++)
|
||||
{
|
||||
const Kart *kart = world->getKart(i);
|
||||
const AbstractKart *kart = world->getKart(i);
|
||||
|
||||
// Check if skidding state has changed. If so, store this
|
||||
if(kart->getControls().m_skid != m_skid_control[i])
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "states_screens/dialogs/track_info_dialog.hpp"
|
||||
#include "tracks/track.hpp"
|
||||
#include "tracks/track_manager.hpp"
|
||||
#include "utils/random_generator.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
|
||||
#include <iostream>
|
||||
|
@ -15,14 +15,13 @@
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
|
||||
#include "audio/sfx_manager.hpp"
|
||||
#include "guiengine/engine.hpp"
|
||||
#include "guiengine/screen.hpp"
|
||||
#include "guiengine/widgets/button_widget.hpp"
|
||||
#include "guiengine/widgets/icon_button_widget.hpp"
|
||||
#include "guiengine/widgets/label_widget.hpp"
|
||||
#include "io/file_manager.hpp"
|
||||
//#include "network/network_manager.hpp"
|
||||
#include "race/grand_prix_manager.hpp"
|
||||
#include "race/race_manager.hpp"
|
||||
#include "states_screens/dialogs/gp_info_dialog.hpp"
|
||||
|
@ -23,7 +23,8 @@
|
||||
#include "guiengine/widgets.hpp"
|
||||
#include "io/file_manager.hpp"
|
||||
#include "input/input_manager.hpp"
|
||||
#include "karts/kart.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "karts/kart_properties.hpp"
|
||||
#include "karts/kart_properties_manager.hpp"
|
||||
#include "modes/three_strikes_battle.hpp"
|
||||
#include "modes/world.hpp"
|
||||
@ -129,7 +130,7 @@ RaceOverDialog::RaceOverDialog(const float percentWidth,
|
||||
int kart_id = 0; // 'i' below is not reliable because some karts (e.g. leader) will be skipped
|
||||
for (unsigned int position = 1; position <= num_karts; position++)
|
||||
{
|
||||
const Kart* current_kart = world->getKartAtPosition(position);
|
||||
const AbstractKart* current_kart = world->getKartAtPosition(position);
|
||||
stringw kart_results_line;
|
||||
|
||||
const stringw& kart_name = current_kart->getName();
|
||||
@ -277,7 +278,7 @@ RaceOverDialog::RaceOverDialog(const float percentWidth,
|
||||
//if (order[i] == -1) continue;
|
||||
const int gp_rank = race_manager->getKartGPRank(i);
|
||||
|
||||
const Kart *current_kart = world->getKart(i);
|
||||
const AbstractKart *current_kart = world->getKart(i);
|
||||
const KartProperties* prop = current_kart->getKartProperties();
|
||||
const std::string &icon_path = prop->getAbsoluteIconFile();
|
||||
ITexture* kart_icon_texture = irr_driver->getTexture( icon_path );
|
||||
@ -650,7 +651,7 @@ void RaceOverDialog::renderThreeStrikesGraph(const int x, const int y, const int
|
||||
const int iconSize = h/10;
|
||||
for (unsigned int k=0; k<kart_count; k++)
|
||||
{
|
||||
const Kart* current_kart = world->getKart(k);
|
||||
const AbstractKart* current_kart = world->getKart(k);
|
||||
|
||||
const KartProperties* prop = current_kart->getKartProperties();
|
||||
const std::string& icon_path = prop->getAbsoluteIconFile();
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "guiengine/widgets/label_widget.hpp"
|
||||
#include "guiengine/widgets/spinner_widget.hpp"
|
||||
#include "io/file_manager.hpp"
|
||||
#include "karts/kart_properties.hpp"
|
||||
#include "karts/kart_properties_manager.hpp"
|
||||
#include "network/network_manager.hpp"
|
||||
#include "race/highscores.hpp"
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include "guiengine/engine.hpp"
|
||||
#include "guiengine/scalable_font.hpp"
|
||||
#include "io/file_manager.hpp"
|
||||
#include "karts/kart.hpp"
|
||||
#include "karts/kart_properties.hpp"
|
||||
#include "karts/kart_properties_manager.hpp"
|
||||
#include "modes/world.hpp"
|
||||
#include "race/grand_prix_manager.hpp"
|
||||
@ -34,8 +34,9 @@
|
||||
#include "tracks/track_manager.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
|
||||
#include <ILightSceneNode.h>
|
||||
#include <IAnimatedMeshSceneNode.h>
|
||||
#include <ICameraSceneNode.h>
|
||||
#include <ILightSceneNode.h>
|
||||
#include <IMeshSceneNode.h>
|
||||
#include <ISceneManager.h>
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "guiengine/widgets/label_widget.hpp"
|
||||
#include "io/file_manager.hpp"
|
||||
#include "items/item_manager.hpp"
|
||||
#include "karts/kart_properties.hpp"
|
||||
#include "karts/kart_properties_manager.hpp"
|
||||
#include "states_screens/feature_unlocked.hpp"
|
||||
#include "states_screens/state_manager.hpp"
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "guiengine/widgets/label_widget.hpp"
|
||||
#include "io/file_manager.hpp"
|
||||
#include "items/item_manager.hpp"
|
||||
#include "karts/kart_properties.hpp"
|
||||
#include "karts/kart_properties_manager.hpp"
|
||||
#include "states_screens/feature_unlocked.hpp"
|
||||
#include "states_screens/state_manager.hpp"
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user