Kart shadows can now be loaded from the data/texture directory, too.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@4461 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2010-01-13 14:43:17 +00:00
parent 36fa5d07cc
commit 797ac71d4b
5 changed files with 15 additions and 12 deletions

View File

@ -23,9 +23,8 @@
#include "graphics/irr_driver.hpp"
Shadow::Shadow(const std::string &name, scene::IAnimatedMeshSceneNode *node)
Shadow::Shadow(video::ITexture *texture, scene::IAnimatedMeshSceneNode *node)
{
video::ITexture *texture = irr_driver->getTexture(name);
video::SMaterial m;
m.setTexture(0, texture);
m.BackfaceCulling = false;

View File

@ -39,11 +39,11 @@ private:
/** The scene node of the kart to which this shadow belongs. */
scene::ISceneNode *m_parent_kart_node;
public:
Shadow(const std::string &name,
scene::IAnimatedMeshSceneNode *node);
~Shadow();
void enableShadow();
void disableShadow();
Shadow(video::ITexture *texture,
scene::IAnimatedMeshSceneNode *node);
~Shadow();
void enableShadow();
void disableShadow();
}; // Shadow
#endif

View File

@ -1210,10 +1210,10 @@ void Kart::loadData()
if(m_kart_properties->hasSkidmarks())
m_skidmarks = new SkidMarks(*this);
m_shadow = new Shadow(m_kart_properties->getShadowTexture(),
m_animated_node);
m_shadow = new Shadow(file_manager->getKartFile(m_kart_properties->getShadowFile(),
getIdent() ),
m_animated_node);
m_stars_effect = new Stars(m_animated_node);
} // loadData

View File

@ -25,6 +25,7 @@
#include "config/stk_config.hpp"
#include "config/user_config.hpp"
#include "graphics/irr_driver.hpp"
#include "graphics/material_manager.hpp"
#include "io/file_manager.hpp"
#include "karts/kart_model.hpp"
@ -46,7 +47,8 @@ KartProperties::KartProperties(const std::string &filename) : m_icon_material(0)
m_name = "Tux";
m_ident = "tux";
m_icon_file = "tuxicon.png";
m_shadow_file = "tuxkartshadow.png";
m_shadow_file = "generickartshadow.png";
m_groups.clear();
m_custom_sfx_id.resize(SFXManager::NUM_CUSTOMS);
@ -195,6 +197,7 @@ void KartProperties::load(const std::string &filename, const std::string &node)
m_kart_model.getWidth(), m_kart_model.getLength(),
m_kart_model.getHeight());
m_shadow_texture = irr_driver->getTexture(m_shadow_file);
file_manager->popTextureSearchPath();
file_manager->popModelSearchPath();

View File

@ -71,6 +71,7 @@ private:
* character select screen. */
std::string m_shadow_file; /**< Filename of the image file that
* contains the shadow for this kart.*/
video::ITexture *m_shadow_texture;/**< The texture with the shadow. */
video::SColor m_color; /**< Color the represents the kart in the
* status bar and on the track-view. */
int m_shape; /**< Number of vertices in polygon when
@ -185,7 +186,7 @@ public:
KartModel* getKartModel () const {return &m_kart_model; }
const irr::core::stringw& getName() const {return m_name; }
const std::string& getIdent () const {return m_ident; }
const std::string& getShadowFile () const {return m_shadow_file; }
video::ITexture *getShadowTexture() const {return m_shadow_texture; }
const std::string& getIconFile () const {return m_icon_file; }
const int getCustomSfxId (SFXManager::CustomSFX type)
const {return m_custom_sfx_id[type]; }