Moved all kart specific files into separate subdirs.
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1629 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
1bcfab771a
commit
6c5efc2bc2
File diff suppressed because it is too large
Load Diff
28125
models/dinokart.ac
28125
models/dinokart.ac
File diff suppressed because it is too large
Load Diff
17957
models/eviltux.ac
17957
models/eviltux.ac
File diff suppressed because it is too large
Load Diff
9258
models/hexleykart.ac
9258
models/hexleykart.ac
File diff suppressed because it is too large
Load Diff
19066
models/mriceblock.ac
19066
models/mriceblock.ac
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
32121
models/sushikart.ac
32121
models/sushikart.ac
File diff suppressed because it is too large
Load Diff
11555
models/tuxkart.ac
11555
models/tuxkart.ac
File diff suppressed because it is too large
Load Diff
11103
models/wilber-hi.ac
11103
models/wilber-hi.ac
File diff suppressed because it is too large
Load Diff
4811
models/wilber-low.ac
4811
models/wilber-low.ac
File diff suppressed because it is too large
Load Diff
20447
models/yetikart.ac
20447
models/yetikart.ac
File diff suppressed because it is too large
Load Diff
@ -47,7 +47,7 @@ KartProperties::KartProperties() : m_icon_material(0), m_model(0)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void KartProperties::load(const std::string filename, const std::string node,
|
||||
bool dont_load_models)
|
||||
bool dont_load_models, bool dont_load_materials)
|
||||
{
|
||||
|
||||
init_defaults();
|
||||
@ -78,14 +78,28 @@ void KartProperties::load(const std::string filename, const std::string node,
|
||||
}
|
||||
delete root;
|
||||
|
||||
// Load material
|
||||
m_icon_material = material_manager->getMaterial(m_icon_file);
|
||||
if(!dont_load_materials)
|
||||
{
|
||||
// Load material
|
||||
std::string materials_file = file_manager->getKartFile("materials.dat",getIdent());
|
||||
file_manager->pushModelSearchPath(file_manager->getKartFile("", getIdent()));
|
||||
file_manager->pushTextureSearchPath(file_manager->getKartFile("", getIdent()));
|
||||
|
||||
// addShared makes sure that these textures/material infos stay in memory
|
||||
material_manager->addSharedMaterial(materials_file);
|
||||
m_icon_material = material_manager->getMaterial(m_icon_file);
|
||||
}
|
||||
// Load model, except when called as part of --list-karts
|
||||
if(m_model_file.length()>0 && !dont_load_models)
|
||||
{
|
||||
|
||||
m_model = loader->load(m_model_file, CB_KART, false);
|
||||
if(!m_model)
|
||||
{
|
||||
fprintf(stderr, "Can't find kart model '%s'.\n",m_model_file);
|
||||
file_manager->popTextureSearchPath();
|
||||
file_manager->popModelSearchPath();
|
||||
return;
|
||||
}
|
||||
ssgStripify(m_model);
|
||||
float x_min, x_max, y_min, y_max, z_min, z_max;
|
||||
MinMax(m_model, &x_min, &x_max, &y_min, &y_max, &z_min, &z_max);
|
||||
@ -93,6 +107,11 @@ void KartProperties::load(const std::string filename, const std::string node,
|
||||
m_kart_length = y_max-y_min;
|
||||
m_model->ref();
|
||||
} // if
|
||||
if(!dont_load_materials)
|
||||
{
|
||||
file_manager->popTextureSearchPath();
|
||||
file_manager->popModelSearchPath();
|
||||
}
|
||||
|
||||
} // load
|
||||
|
||||
|
@ -108,7 +108,8 @@ public:
|
||||
virtual void getAllData (const lisp::Lisp* lisp);
|
||||
virtual void load (const std::string filename,
|
||||
const std::string node="tuxkart-kart",
|
||||
bool dont_load_models=false);
|
||||
bool dont_load_models=false,
|
||||
bool dont_load_materials=false);
|
||||
|
||||
Material* getIconMaterial () const {return m_icon_material; }
|
||||
ssgEntity* getModel () const {return m_model; }
|
||||
|
@ -74,18 +74,7 @@ void MaterialManager::loadMaterial()
|
||||
// material index later, so that these materials are not popped
|
||||
const std::string fname = "materials.dat";
|
||||
std::string full_name = file_manager->getTextureFile(fname);
|
||||
if(full_name=="")
|
||||
{
|
||||
char msg[MAX_ERROR_MESSAGE_LENGTH];
|
||||
snprintf(msg, sizeof(msg), "FATAL: File '%s' not found\n", fname.c_str());
|
||||
throw std::runtime_error(msg);
|
||||
}
|
||||
if(!pushTempMaterial(full_name))
|
||||
{
|
||||
char msg[MAX_ERROR_MESSAGE_LENGTH];
|
||||
snprintf(msg, sizeof(msg), "FATAL: Parsing error in '%s'\n", full_name.c_str());
|
||||
throw std::runtime_error(msg);
|
||||
}
|
||||
addSharedMaterial(full_name);
|
||||
|
||||
ssgSetAppStateCallback(getAppState);
|
||||
fuzzy_gst = getMaterial("fuzzy.rgb")->getState();
|
||||
@ -93,6 +82,26 @@ void MaterialManager::loadMaterial()
|
||||
m_shared_material_index = (int)m_materials.size();
|
||||
} // MaterialManager
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void MaterialManager::addSharedMaterial(const std::string& filename)
|
||||
{
|
||||
// Use temp material for reading, but then set the shared
|
||||
// material index later, so that these materials are not popped
|
||||
if(filename=="")
|
||||
{
|
||||
char msg[MAX_ERROR_MESSAGE_LENGTH];
|
||||
snprintf(msg, sizeof(msg), "FATAL: File '%s' not found\n", filename.c_str());
|
||||
throw std::runtime_error(msg);
|
||||
}
|
||||
if(!pushTempMaterial(filename))
|
||||
{
|
||||
char msg[MAX_ERROR_MESSAGE_LENGTH];
|
||||
snprintf(msg, sizeof(msg), "FATAL: Parsing error in '%s'\n", filename.c_str());
|
||||
throw std::runtime_error(msg);
|
||||
}
|
||||
m_shared_material_index = (int)m_materials.size();
|
||||
} // addSharedMaterial
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool MaterialManager::pushTempMaterial(const std::string& filename)
|
||||
{
|
||||
|
@ -38,14 +38,14 @@ private:
|
||||
std::vector<Material*> m_materials;
|
||||
public:
|
||||
MaterialManager();
|
||||
void loadMaterial ();
|
||||
void reInit ();
|
||||
int addEntity (Material *m);
|
||||
Material *getMaterial (ssgLeaf *lf);
|
||||
// Material *getMaterial (const char *texname);
|
||||
Material *getMaterial (const std::string& t, bool is_full_path=false);
|
||||
bool pushTempMaterial(const std::string& filename);
|
||||
void popTempMaterial ();
|
||||
void loadMaterial ();
|
||||
void reInit ();
|
||||
int addEntity (Material *m);
|
||||
Material *getMaterial (ssgLeaf *lf);
|
||||
Material *getMaterial (const std::string& t, bool is_full_path=false);
|
||||
void addSharedMaterial(const std::string& filename);
|
||||
bool pushTempMaterial (const std::string& filename);
|
||||
void popTempMaterial ();
|
||||
};
|
||||
|
||||
extern ssgState *fuzzy_gst, *herringbones_gst;
|
||||
|
@ -25,7 +25,11 @@ STKConfig* stk_config=0;
|
||||
void STKConfig::load(const std::string filename)
|
||||
{
|
||||
|
||||
KartProperties::load(filename, "config");
|
||||
// Use the kart properties loader to read in the default kart
|
||||
// values, but don't try to load any models or materials */
|
||||
KartProperties::load(filename, "config",
|
||||
/*dont_load_models */ true,
|
||||
/*dont_load_materials*/ true );
|
||||
|
||||
// Check that all necessary values are indeed set physics.data file
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user