Removed callback manager, callbacks are not needed the way they were
with plib, and the track is now updating its animated textures and physical objects. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3337 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
0681523762
commit
30de5e36f8
@ -161,9 +161,6 @@ supertuxkart_SOURCES = \
|
|||||||
loader.hpp \
|
loader.hpp \
|
||||||
race_manager.cpp \
|
race_manager.cpp \
|
||||||
race_manager.hpp \
|
race_manager.hpp \
|
||||||
callback.hpp \
|
|
||||||
callback_manager.cpp \
|
|
||||||
callback_manager.hpp \
|
|
||||||
main_loop.cpp \
|
main_loop.cpp \
|
||||||
main_loop.hpp \
|
main_loop.hpp \
|
||||||
user_pointer.hpp \
|
user_pointer.hpp \
|
||||||
|
@ -1,37 +0,0 @@
|
|||||||
// $Id: callback.hpp 796 2006-09-27 07:06:34Z hiker $
|
|
||||||
//
|
|
||||||
// SuperTuxKart - a fun racing game with go-kart
|
|
||||||
// Copyright (C) 2006 Joerg Henrichs
|
|
||||||
//
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation; either version 3
|
|
||||||
// of the License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with this program; if not, write to the Free Software
|
|
||||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
|
|
||||||
#ifndef CALLBACK_H
|
|
||||||
#define CALLBACK_H
|
|
||||||
|
|
||||||
#include "btBulletDynamicsCommon.h"
|
|
||||||
|
|
||||||
class Callback
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
virtual ~Callback() {};
|
|
||||||
virtual void update (float dt) = 0;
|
|
||||||
virtual void init () = 0;
|
|
||||||
virtual void reset () {};
|
|
||||||
virtual void handleExplosion(const btVector3& pos, bool directHit) {};
|
|
||||||
}
|
|
||||||
; // Callback
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,142 +0,0 @@
|
|||||||
// $Id: callback_manager.cpp 796 2006-09-27 07:06:34Z hiker $
|
|
||||||
//
|
|
||||||
// SuperTuxKart - a fun racing game with go-kart
|
|
||||||
// Copyright (C) 2006 Joerg Henrichs
|
|
||||||
//
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation; either version 3
|
|
||||||
// of the License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with this program; if not, write to the Free Software
|
|
||||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
|
|
||||||
#include "callback_manager.hpp"
|
|
||||||
#include "physics/moving_physics.hpp"
|
|
||||||
|
|
||||||
CallbackManager *callback_manager=NULL;
|
|
||||||
|
|
||||||
CallbackManager::CallbackManager()
|
|
||||||
{
|
|
||||||
for(int i=0; i<CB_MAX; i++)
|
|
||||||
{
|
|
||||||
m_allCallbacks[i].clear();
|
|
||||||
}
|
|
||||||
} // CallbackManager
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
CallbackManager::~CallbackManager()
|
|
||||||
{
|
|
||||||
for(int i=0; i<CB_MAX; i++)
|
|
||||||
{
|
|
||||||
for(std::vector<Callback*>::const_iterator c = m_allCallbacks[i].begin();
|
|
||||||
c != m_allCallbacks[i].end(); c++)
|
|
||||||
{
|
|
||||||
MovingPhysics *mp = dynamic_cast<MovingPhysics*>(*c);
|
|
||||||
if(mp)
|
|
||||||
{
|
|
||||||
#ifndef HAVE_IRRLICHT
|
|
||||||
ssgDeRefDelete(mp);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
delete *c;
|
|
||||||
}
|
|
||||||
} // for c in m_allCallbacks[i]
|
|
||||||
m_allCallbacks[i].clear();
|
|
||||||
} // for i <CB_MAX
|
|
||||||
} // ~CallbackManager
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
void CallbackManager::addCallback(Callback *c, CallbackType t)
|
|
||||||
{
|
|
||||||
m_allCallbacks[t].push_back(c);
|
|
||||||
MovingPhysics *mp = dynamic_cast<MovingPhysics*>(c);
|
|
||||||
if(mp)
|
|
||||||
{
|
|
||||||
#ifndef HAVE_IRRLICHT
|
|
||||||
mp->ref();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
} // addCallback
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
void CallbackManager::clear(CallbackType cbType)
|
|
||||||
{
|
|
||||||
for(std::vector<Callback*>::const_iterator c = m_allCallbacks[cbType].begin();
|
|
||||||
c != m_allCallbacks[cbType].end(); c++)
|
|
||||||
{
|
|
||||||
MovingPhysics *mp = dynamic_cast<MovingPhysics*>(*c);
|
|
||||||
if(mp)
|
|
||||||
{
|
|
||||||
#ifndef HAVE_IRRLICHT
|
|
||||||
ssgDeRefDelete(mp);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
delete *c;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m_allCallbacks[cbType].clear();
|
|
||||||
} // clear
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
void CallbackManager::update(float dt) const
|
|
||||||
{
|
|
||||||
for(int i=0; i<CB_MAX; i++)
|
|
||||||
{
|
|
||||||
for(std::vector<Callback*>::const_iterator c = m_allCallbacks[i].begin();
|
|
||||||
c != m_allCallbacks[i].end(); c++)
|
|
||||||
(*c)->update(dt);
|
|
||||||
} // for i
|
|
||||||
|
|
||||||
} // update
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
void CallbackManager::initAll() const
|
|
||||||
{
|
|
||||||
for(int i=0; i<CB_MAX; i++)
|
|
||||||
{
|
|
||||||
for(std::vector<Callback*>::const_iterator c = m_allCallbacks[i].begin();
|
|
||||||
c != m_allCallbacks[i].end(); c++)
|
|
||||||
(*c)->init();
|
|
||||||
} // for i
|
|
||||||
|
|
||||||
} // initAll
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Called when restarting a race
|
|
||||||
void CallbackManager::reset() const
|
|
||||||
{
|
|
||||||
for(int i=0; i<CB_MAX; i++)
|
|
||||||
{
|
|
||||||
for(std::vector<Callback*>::const_iterator c = m_allCallbacks[i].begin();
|
|
||||||
c != m_allCallbacks[i].end(); c++)
|
|
||||||
(*c)->reset();
|
|
||||||
} // for i
|
|
||||||
|
|
||||||
} // initAll
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
void CallbackManager::handleExplosion(const btVector3& pos,
|
|
||||||
const MovingPhysics* mp) const
|
|
||||||
{
|
|
||||||
for(int i=0; i<CB_MAX; i++)
|
|
||||||
{
|
|
||||||
for(std::vector<Callback*>::const_iterator c = m_allCallbacks[i].begin();
|
|
||||||
c != m_allCallbacks[i].end(); c++)
|
|
||||||
(*c)->handleExplosion(pos, mp==(*c));
|
|
||||||
} // for i
|
|
||||||
|
|
||||||
} // handleExplosion
|
|
||||||
|
|
@ -1,57 +0,0 @@
|
|||||||
// $Id: callback_manager.hpp 796 2006-09-27 07:06:34Z hiker $
|
|
||||||
//
|
|
||||||
// SuperTuxKart - a fun racing game with go-kart
|
|
||||||
// Copyright (C) 2006 Joerg Henrichs
|
|
||||||
//
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation; either version 3
|
|
||||||
// of the License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with this program; if not, write to the Free Software
|
|
||||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
|
|
||||||
#ifndef CALLBACK_MANAGER_HPP
|
|
||||||
#define CALLBACK_MANAGER_HPP
|
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
#include "btBulletDynamicsCommon.h"
|
|
||||||
#include "callback.hpp"
|
|
||||||
|
|
||||||
class MovingPhysics;
|
|
||||||
|
|
||||||
// It might actually be enough to have only two different values: track (which
|
|
||||||
// get deleted and loaded more than one), and everything else, which only
|
|
||||||
// gets loaded once, and deleted at the end (and when switching windows /
|
|
||||||
// fullscreen). Sinace it's not much overhead, a separate class is provided
|
|
||||||
// for every model that might contain a callback.
|
|
||||||
enum CallbackType { CB_COLLECTABLE, CB_ATTACHMENT, CB_EXPLOSION, CB_ITEM,
|
|
||||||
CB_KART, CB_TRACK, CB_MAX };
|
|
||||||
|
|
||||||
class CallbackManager
|
|
||||||
{
|
|
||||||
std::vector<Callback*> m_allCallbacks[CB_MAX];
|
|
||||||
|
|
||||||
public:
|
|
||||||
CallbackManager();
|
|
||||||
~CallbackManager();
|
|
||||||
void update (float dt) const;
|
|
||||||
void initAll () const;
|
|
||||||
void reset () const;
|
|
||||||
void clear (CallbackType cbType);
|
|
||||||
void addCallback (Callback *c, CallbackType t);
|
|
||||||
void handleExplosion(const btVector3& pos, const MovingPhysics* mo) const;
|
|
||||||
}
|
|
||||||
; // CallbackManager
|
|
||||||
|
|
||||||
extern CallbackManager *callback_manager;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
/* EOF */
|
|
||||||
|
|
@ -24,11 +24,9 @@
|
|||||||
#include "irrlicht.h"
|
#include "irrlicht.h"
|
||||||
using namespace irr;
|
using namespace irr;
|
||||||
|
|
||||||
#include "callback.hpp"
|
|
||||||
|
|
||||||
class XMLNode;
|
class XMLNode;
|
||||||
|
|
||||||
class MovingTexture : public Callback
|
class MovingTexture
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
/** Translation increment per second. */
|
/** Translation increment per second. */
|
||||||
|
@ -193,10 +193,6 @@
|
|||||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||||
>
|
>
|
||||||
<File
|
|
||||||
RelativePath="../../../src\callback_manager.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="../../../src\explosion.cpp"
|
RelativePath="../../../src\explosion.cpp"
|
||||||
>
|
>
|
||||||
@ -687,14 +683,6 @@
|
|||||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||||
>
|
>
|
||||||
<File
|
|
||||||
RelativePath="../../../src\callback.hpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="../../../src\callback_manager.hpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="../../../src\constants.hpp"
|
RelativePath="../../../src\constants.hpp"
|
||||||
>
|
>
|
||||||
|
@ -226,7 +226,7 @@ void InputManager::handleStaticAction(int key, int value)
|
|||||||
if (race_manager->getNumPlayers() ==1 )
|
if (race_manager->getNumPlayers() ==1 )
|
||||||
{
|
{
|
||||||
Kart* kart = RaceManager::getWorld()->getLocalPlayerKart(0);
|
Kart* kart = RaceManager::getWorld()->getLocalPlayerKart(0);
|
||||||
// kart->setPowerup(POWERUP_BUBBLEGUM, 10000);
|
kart->setPowerup(POWERUP_BOWLING, 10000);
|
||||||
kart->attach(ATTACH_ANVIL, 5);
|
kart->attach(ATTACH_ANVIL, 5);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
#include "items/attachment_manager.hpp"
|
#include "items/attachment_manager.hpp"
|
||||||
|
|
||||||
#include "callback_manager.hpp"
|
|
||||||
#include "graphics/irr_driver.hpp"
|
#include "graphics/irr_driver.hpp"
|
||||||
#include "io/file_manager.hpp"
|
#include "io/file_manager.hpp"
|
||||||
|
|
||||||
@ -60,7 +59,6 @@ void AttachmentManager::removeTextures()
|
|||||||
{
|
{
|
||||||
// FIXME: free attachment textures
|
// FIXME: free attachment textures
|
||||||
} // for
|
} // for
|
||||||
callback_manager->clear(CB_ATTACHMENT);
|
|
||||||
} // removeTextures
|
} // removeTextures
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "callback_manager.hpp"
|
|
||||||
#include "race_manager.hpp"
|
#include "race_manager.hpp"
|
||||||
#include "graphics/irr_driver.hpp"
|
#include "graphics/irr_driver.hpp"
|
||||||
#include "graphics/mesh_tools.hpp"
|
#include "graphics/mesh_tools.hpp"
|
||||||
@ -285,7 +284,7 @@ void Flyable::hit(Kart *kart_hit, MovingPhysics* moving_physics)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
callback_manager->handleExplosion(pos_explosion, moving_physics);
|
RaceManager::getTrack()->handleExplosion(pos_explosion, moving_physics);
|
||||||
} // hit
|
} // hit
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#include "callback_manager.hpp"
|
|
||||||
#include "user_config.hpp"
|
#include "user_config.hpp"
|
||||||
#include "material_manager.hpp"
|
#include "material_manager.hpp"
|
||||||
#include "material.hpp"
|
#include "material.hpp"
|
||||||
@ -106,7 +105,6 @@ void ItemManager::removeTextures()
|
|||||||
i->second->drop();
|
i->second->drop();
|
||||||
}
|
}
|
||||||
m_all_meshes.clear();
|
m_all_meshes.clear();
|
||||||
callback_manager->clear(CB_ITEM);
|
|
||||||
} // removeTextures
|
} // removeTextures
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -23,7 +23,6 @@
|
|||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#include "callback_manager.hpp"
|
|
||||||
#include "material_manager.hpp"
|
#include "material_manager.hpp"
|
||||||
#include "material.hpp"
|
#include "material.hpp"
|
||||||
#include "graphics/irr_driver.hpp"
|
#include "graphics/irr_driver.hpp"
|
||||||
@ -74,7 +73,7 @@ void PowerupManager::removeTextures()
|
|||||||
if(m_all_models[i]) ssgDeRefDelete(m_all_models[i] );
|
if(m_all_models[i]) ssgDeRefDelete(m_all_models[i] );
|
||||||
} // for
|
} // for
|
||||||
#endif
|
#endif
|
||||||
callback_manager->clear(CB_COLLECTABLE);
|
|
||||||
} // removeTextures
|
} // removeTextures
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -57,7 +57,7 @@ void ProjectileManager::removeTextures()
|
|||||||
//ssgDeRefDelete(m_explosion_model);
|
//ssgDeRefDelete(m_explosion_model);
|
||||||
// Only the explosion is here, all other models are actually managed
|
// Only the explosion is here, all other models are actually managed
|
||||||
// by powerup_manager.
|
// by powerup_manager.
|
||||||
callback_manager->clear(CB_EXPLOSION);
|
//callback_manager->clear(CB_EXPLOSION);
|
||||||
} // removeTextures
|
} // removeTextures
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
#include "stk_config.hpp"
|
#include "stk_config.hpp"
|
||||||
#include "user_config.hpp"
|
#include "user_config.hpp"
|
||||||
#include "callback_manager.hpp"
|
|
||||||
#include "challenges/unlock_manager.hpp"
|
#include "challenges/unlock_manager.hpp"
|
||||||
#include "io/file_manager.hpp"
|
#include "io/file_manager.hpp"
|
||||||
#include "karts/kart_properties.hpp"
|
#include "karts/kart_properties.hpp"
|
||||||
@ -60,7 +59,6 @@ void KartPropertiesManager::removeTextures()
|
|||||||
delete *i;
|
delete *i;
|
||||||
}
|
}
|
||||||
m_karts_properties.clear();
|
m_karts_properties.clear();
|
||||||
callback_manager->clear(CB_KART);
|
|
||||||
} // removeTextures
|
} // removeTextures
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -43,7 +43,6 @@ Loader* loader = 0;
|
|||||||
|
|
||||||
Loader::Loader()
|
Loader::Loader()
|
||||||
{
|
{
|
||||||
m_current_callback_type = CB_COLLECTABLE;
|
|
||||||
} // Loader
|
} // Loader
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -82,20 +81,12 @@ void Loader::makeModelPath(char* path, const char* FNAME) const
|
|||||||
* \param optimise Default is true. If set to false, the model will not
|
* \param optimise Default is true. If set to false, the model will not
|
||||||
* be flattened.
|
* be flattened.
|
||||||
*/
|
*/
|
||||||
ssgEntity *Loader::load(const std::string& filename, CallbackType t,
|
ssgEntity *Loader::load(const std::string& filename,
|
||||||
bool optimise, bool is_full_path)
|
bool optimise, bool is_full_path)
|
||||||
{
|
{
|
||||||
m_current_callback_type = t;
|
|
||||||
m_is_full_path = is_full_path;
|
m_is_full_path = is_full_path;
|
||||||
#ifdef HAVE_IRRLICHT
|
|
||||||
// FIXME: for now
|
// FIXME: for now
|
||||||
return NULL;
|
return NULL;
|
||||||
#else
|
|
||||||
ssgEntity *obj = optimise ? ssgLoad (filename.c_str(), this)
|
|
||||||
: ssgLoadAC(filename.c_str(), this);
|
|
||||||
preProcessObj(obj, false);
|
|
||||||
return obj;
|
|
||||||
#endif
|
|
||||||
} // load
|
} // load
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include "callback_manager.hpp"
|
|
||||||
|
|
||||||
class Loader : public ssgLoaderOptions
|
class Loader : public ssgLoaderOptions
|
||||||
{
|
{
|
||||||
@ -43,20 +42,12 @@ public:
|
|||||||
~Loader();
|
~Loader();
|
||||||
|
|
||||||
virtual void makeModelPath (char* path, const char* fname) const;
|
virtual void makeModelPath (char* path, const char* fname) const;
|
||||||
|
ssgEntity *load(const std::string& filename, bool optimise=true,
|
||||||
ssgEntity *load(const std::string& filename, CallbackType t, bool optimise=true,
|
|
||||||
bool is_full_path=false);
|
bool is_full_path=false);
|
||||||
void setCallbackType(CallbackType t) {m_current_callback_type=t;}
|
|
||||||
private:
|
private:
|
||||||
CallbackType m_current_callback_type;
|
|
||||||
|
|
||||||
void makePath (std::string& path, const std::string& dir,
|
void makePath (std::string& path, const std::string& dir,
|
||||||
const std::string& fname) const;
|
const std::string& fname) const;
|
||||||
#ifndef HAVE_IRRLICHT
|
|
||||||
ssgBranch *createBranch (char *data) const;
|
|
||||||
void preProcessObj( ssgEntity *n, bool mirror );
|
|
||||||
ssgBranch *animInit (char *data) const;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern Loader* loader;
|
extern Loader* loader;
|
||||||
|
@ -50,7 +50,6 @@
|
|||||||
#include "main_loop.hpp"
|
#include "main_loop.hpp"
|
||||||
#include "material_manager.hpp"
|
#include "material_manager.hpp"
|
||||||
#include "input/input_manager.hpp"
|
#include "input/input_manager.hpp"
|
||||||
#include "callback_manager.hpp"
|
|
||||||
#include "history.hpp"
|
#include "history.hpp"
|
||||||
#include "stk_config.hpp"
|
#include "stk_config.hpp"
|
||||||
#include "highscore_manager.hpp"
|
#include "highscore_manager.hpp"
|
||||||
@ -448,9 +447,8 @@ void InitTuxkart()
|
|||||||
stk_config = new STKConfig ();
|
stk_config = new STKConfig ();
|
||||||
kart_properties_manager = new KartPropertiesManager();
|
kart_properties_manager = new KartPropertiesManager();
|
||||||
projectile_manager = new ProjectileManager ();
|
projectile_manager = new ProjectileManager ();
|
||||||
powerup_manager = new PowerupManager ();
|
powerup_manager = new PowerupManager ();
|
||||||
callback_manager = new CallbackManager ();
|
item_manager = new ItemManager ();
|
||||||
item_manager = new ItemManager ();
|
|
||||||
attachment_manager = new AttachmentManager ();
|
attachment_manager = new AttachmentManager ();
|
||||||
highscore_manager = new HighscoreManager ();
|
highscore_manager = new HighscoreManager ();
|
||||||
grand_prix_manager = new GrandPrixManager ();
|
grand_prix_manager = new GrandPrixManager ();
|
||||||
@ -489,7 +487,6 @@ void CleanTuxKart()
|
|||||||
if(highscore_manager) delete highscore_manager;
|
if(highscore_manager) delete highscore_manager;
|
||||||
if(attachment_manager) delete attachment_manager;
|
if(attachment_manager) delete attachment_manager;
|
||||||
if(item_manager) delete item_manager;
|
if(item_manager) delete item_manager;
|
||||||
if(callback_manager) delete callback_manager;
|
|
||||||
if(powerup_manager) delete powerup_manager;
|
if(powerup_manager) delete powerup_manager;
|
||||||
if(projectile_manager) delete projectile_manager;
|
if(projectile_manager) delete projectile_manager;
|
||||||
if(kart_properties_manager) delete kart_properties_manager;
|
if(kart_properties_manager) delete kart_properties_manager;
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
#include "race_manager.hpp"
|
#include "race_manager.hpp"
|
||||||
#include "user_config.hpp"
|
#include "user_config.hpp"
|
||||||
#include "callback_manager.hpp"
|
|
||||||
#include "history.hpp"
|
#include "history.hpp"
|
||||||
#include "highscore_manager.hpp"
|
#include "highscore_manager.hpp"
|
||||||
#include "audio/sound_manager.hpp"
|
#include "audio/sound_manager.hpp"
|
||||||
@ -157,7 +156,6 @@ void World::init()
|
|||||||
//ssgSetBackFaceCollisions ( !not defined! race_manager->mirror ) ;
|
//ssgSetBackFaceCollisions ( !not defined! race_manager->mirror ) ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
callback_manager->initAll();
|
|
||||||
// TODO - race GUI
|
// TODO - race GUI
|
||||||
//menu_manager->switchToRace();
|
//menu_manager->switchToRace();
|
||||||
|
|
||||||
@ -175,8 +173,6 @@ World::~World()
|
|||||||
// In case that a race is aborted (e.g. track not found) m_track is 0.
|
// In case that a race is aborted (e.g. track not found) m_track is 0.
|
||||||
if(m_track)
|
if(m_track)
|
||||||
m_track->cleanup();
|
m_track->cleanup();
|
||||||
// Clear all callbacks
|
|
||||||
callback_manager->clear(CB_TRACK);
|
|
||||||
|
|
||||||
for ( unsigned int i = 0 ; i < m_kart.size() ; i++ )
|
for ( unsigned int i = 0 ; i < m_kart.size() ; i++ )
|
||||||
delete m_kart[i];
|
delete m_kart[i];
|
||||||
@ -293,9 +289,8 @@ void World::update(float dt)
|
|||||||
projectile_manager->update(dt);
|
projectile_manager->update(dt);
|
||||||
item_manager->update(dt);
|
item_manager->update(dt);
|
||||||
|
|
||||||
/* Routine stuff we do even when paused */
|
} // update
|
||||||
callback_manager->update(dt);
|
|
||||||
}
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
HighscoreEntry* World::getHighscores() const
|
HighscoreEntry* World::getHighscores() const
|
||||||
@ -513,7 +508,6 @@ void World::restartRace()
|
|||||||
item_manager->reset();
|
item_manager->reset();
|
||||||
projectile_manager->cleanup();
|
projectile_manager->cleanup();
|
||||||
race_manager->reset();
|
race_manager->reset();
|
||||||
callback_manager->reset();
|
|
||||||
|
|
||||||
// Resets the cameras in case that they are pointing too steep up or down
|
// Resets the cameras in case that they are pointing too steep up or down
|
||||||
stk_scene->reset();
|
stk_scene->reset();
|
||||||
|
@ -24,14 +24,13 @@
|
|||||||
using namespace irr;
|
using namespace irr;
|
||||||
|
|
||||||
#include "btBulletDynamicsCommon.h"
|
#include "btBulletDynamicsCommon.h"
|
||||||
#include "callback.hpp"
|
|
||||||
#include "user_pointer.hpp"
|
#include "user_pointer.hpp"
|
||||||
|
|
||||||
class Vec3;
|
class Vec3;
|
||||||
class scene::IAnimatedMesh;
|
class scene::IAnimatedMesh;
|
||||||
class XMLNode;
|
class XMLNode;
|
||||||
|
|
||||||
class MovingPhysics : public Callback
|
class MovingPhysics
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum bodyTypes {MP_NONE, MP_CONE, MP_BOX, MP_SPHERE};
|
enum bodyTypes {MP_NONE, MP_CONE, MP_BOX, MP_SPHERE};
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
|
|
||||||
#include "stk_config.hpp"
|
#include "stk_config.hpp"
|
||||||
#include "material_manager.hpp"
|
#include "material_manager.hpp"
|
||||||
#include "callback_manager.hpp"
|
|
||||||
#include "isect.hpp"
|
#include "isect.hpp"
|
||||||
#include "user_config.hpp"
|
#include "user_config.hpp"
|
||||||
#include "audio/sound_manager.hpp"
|
#include "audio/sound_manager.hpp"
|
||||||
@ -1283,7 +1282,28 @@ void Track::update(float dt)
|
|||||||
{
|
{
|
||||||
m_animated_textures[i]->update(dt);
|
m_animated_textures[i]->update(dt);
|
||||||
}
|
}
|
||||||
|
for(unsigned int i=0; i<m_physical_objects.size(); i++)
|
||||||
|
{
|
||||||
|
m_physical_objects[i]->update(dt);
|
||||||
|
}
|
||||||
} // update
|
} // update
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
/** Handles an explosion, i.e. it makes sure that all physical objects are
|
||||||
|
* affected accordingly.
|
||||||
|
* \param pos Position of the explosion.
|
||||||
|
* \param mp If the hit was a physical object, this object will be affected
|
||||||
|
* more. Otherwise this is NULL.
|
||||||
|
*/
|
||||||
|
void Track::handleExplosion(const Vec3 &pos, const MovingPhysics *mp) const
|
||||||
|
{
|
||||||
|
for(std::vector<MovingPhysics*>::const_iterator i=m_physical_objects.begin();
|
||||||
|
i!=m_physical_objects.end(); i++)
|
||||||
|
{
|
||||||
|
(*i)->handleExplosion(pos, mp==(*i));
|
||||||
|
}
|
||||||
|
} // handleExplosion
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
/** Creates a water node.
|
/** Creates a water node.
|
||||||
* \param node The XML node containing the specifications for the water node.
|
* \param node The XML node containing the specifications for the water node.
|
||||||
@ -1376,8 +1396,7 @@ void Track::loadTrackModel()
|
|||||||
if(name=="track") continue;
|
if(name=="track") continue;
|
||||||
if(name=="object")
|
if(name=="object")
|
||||||
{
|
{
|
||||||
MovingPhysics *mp = new MovingPhysics(node);
|
m_physical_objects.push_back(new MovingPhysics(node));
|
||||||
callback_manager->addCallback(mp, CB_TRACK);
|
|
||||||
}
|
}
|
||||||
else if(name=="water")
|
else if(name=="water")
|
||||||
{
|
{
|
||||||
@ -1429,6 +1448,13 @@ void Track::loadTrackModel()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Init all physical objects
|
||||||
|
for(std::vector<MovingPhysics*>::const_iterator i=m_physical_objects.begin();
|
||||||
|
i!=m_physical_objects.end(); i++)
|
||||||
|
{
|
||||||
|
(*i)->init();
|
||||||
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
std::string path = file_manager->getTrackFile(getIdent()+".loc");
|
std::string path = file_manager->getTrackFile(getIdent()+".loc");
|
||||||
|
|
||||||
|
@ -77,6 +77,10 @@ private:
|
|||||||
|
|
||||||
/** The list of all animated textures. */
|
/** The list of all animated textures. */
|
||||||
std::vector<MovingTexture*> m_animated_textures;
|
std::vector<MovingTexture*> m_animated_textures;
|
||||||
|
|
||||||
|
/** List of all physical objects. */
|
||||||
|
std::vector<MovingPhysics*> m_physical_objects;
|
||||||
|
|
||||||
/** If a sky dome is used, the number of horizontal segments
|
/** If a sky dome is used, the number of horizontal segments
|
||||||
* the sphere should be divided in. */
|
* the sphere should be divided in. */
|
||||||
int m_sky_hori_segments;
|
int m_sky_hori_segments;
|
||||||
@ -217,6 +221,7 @@ public:
|
|||||||
float getTerrainHeight(const Vec3 &pos) const;
|
float getTerrainHeight(const Vec3 &pos) const;
|
||||||
void createPhysicsModel();
|
void createPhysicsModel();
|
||||||
void update(float dt);
|
void update(float dt);
|
||||||
|
void handleExplosion(const Vec3 &pos, const MovingPhysics *mp) const;
|
||||||
void glVtx (sgVec2 v, float x_offset, float y_offset) const
|
void glVtx (sgVec2 v, float x_offset, float y_offset) const
|
||||||
{
|
{
|
||||||
glVertex2f(
|
glVertex2f(
|
||||||
|
Loading…
Reference in New Issue
Block a user