1) Renamed loader to file_manager
2) Moved more track specific textures into corresponding track subdirectories. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1610 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
@@ -24,7 +24,6 @@
|
||||
#include "projectile_manager.hpp"
|
||||
#include "kart.hpp"
|
||||
#include "constants.hpp"
|
||||
#include "loader.hpp"
|
||||
#include "world.hpp"
|
||||
#include "sound_manager.hpp"
|
||||
#include "stk_config.hpp"
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "attachment_manager.hpp"
|
||||
#include "loader.hpp"
|
||||
#include "file_manager.hpp"
|
||||
|
||||
AttachmentManager *attachment_manager = 0;
|
||||
|
||||
@@ -65,7 +65,7 @@ void AttachmentManager::loadModels()
|
||||
{
|
||||
for(int i=0; iat[i].attachment!=ATTACH_MAX; i++)
|
||||
{
|
||||
m_attachments[iat[i].attachment]=loader->load(iat[i].file, CB_ATTACHMENT);
|
||||
m_attachments[iat[i].attachment]=file_manager->load(iat[i].file, CB_ATTACHMENT);
|
||||
m_attachments[iat[i].attachment]->ref();
|
||||
} // for
|
||||
} // reInit
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
#include "collectable_manager.hpp"
|
||||
#include "loader.hpp"
|
||||
#include "file_manager.hpp"
|
||||
#include "material_manager.hpp"
|
||||
#include "material.hpp"
|
||||
#include "translation.hpp"
|
||||
@@ -89,7 +89,7 @@ void CollectableManager::Load(int collectType, const char* filename)
|
||||
|
||||
lisp::Parser parser;
|
||||
std::string tmp= "data/" + (std::string)filename;
|
||||
ROOT = parser.parse(loader->getConfigFile(filename));
|
||||
ROOT = parser.parse(file_manager->getConfigFile(filename));
|
||||
|
||||
const lisp::Lisp* lisp = ROOT->getLisp("tuxkart-collectable");
|
||||
if(!lisp)
|
||||
@@ -124,7 +124,7 @@ void CollectableManager::LoadNode(const lisp::Lisp* lisp, int collectType )
|
||||
|
||||
if(sModel!="")
|
||||
{
|
||||
ssgEntity* e = loader->load(sModel, CB_COLLECTABLE);
|
||||
ssgEntity* e = file_manager->load(sModel, CB_COLLECTABLE);
|
||||
m_all_models[collectType] = e;
|
||||
e->ref();
|
||||
e->clrTraversalMaskBits(SSGTRAV_ISECT|SSGTRAV_HOT);
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
#include "loader.hpp"
|
||||
#include "file_manager.hpp"
|
||||
#include "lisp/parser.hpp"
|
||||
#include "lisp/lisp.hpp"
|
||||
#include "cup_data.hpp"
|
||||
@@ -32,7 +32,7 @@ CupData::CupData(const std::string filename_)
|
||||
try
|
||||
{
|
||||
lisp::Parser parser;
|
||||
lisp = parser.parse(loader->getConfigFile(m_filename));
|
||||
lisp = parser.parse(file_manager->getConfigFile(m_filename));
|
||||
|
||||
lisp = lisp->getLisp("supertuxkart-cup");
|
||||
if(!lisp)
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
# define CONFIGDIR ".supertuxkart"
|
||||
#endif
|
||||
#include "plib/ul.h"
|
||||
#include "loader.hpp"
|
||||
#include "file_manager.hpp"
|
||||
#include "world.hpp"
|
||||
#include "btBulletDynamicsCommon.h"
|
||||
#include "moving_physics.hpp"
|
||||
@@ -80,9 +80,9 @@ bool macSetBundlePathIfRelevant(std::string& data_dir)
|
||||
}
|
||||
#endif
|
||||
|
||||
Loader* loader = 0;
|
||||
FileManager* file_manager = 0;
|
||||
|
||||
Loader::Loader()
|
||||
FileManager::FileManager()
|
||||
{
|
||||
m_is_full_path = false;
|
||||
|
||||
@@ -109,18 +109,18 @@ Loader::Loader()
|
||||
pushTextureSearchPath(m_root_dir+"/data/textures");
|
||||
pushModelSearchPath (m_root_dir+"/models" );
|
||||
pushMusicSearchPath (m_root_dir+"/ogg" );
|
||||
} // Loader
|
||||
} // FileManager
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
Loader::~Loader()
|
||||
FileManager::~FileManager()
|
||||
{
|
||||
popMusicSearchPath();
|
||||
popModelSearchPath();
|
||||
popTextureSearchPath();
|
||||
} // ~Loader
|
||||
} // ~FileManager
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool Loader::findFile(std::string& full_path,
|
||||
bool FileManager::findFile(std::string& full_path,
|
||||
const std::string& fname,
|
||||
const std::vector<std::string>& search_path) const
|
||||
{
|
||||
@@ -138,7 +138,7 @@ bool Loader::findFile(std::string& full_path,
|
||||
} // findFile
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void Loader::makeModelPath(char* path, const char* FNAME) const
|
||||
void FileManager::makeModelPath(char* path, const char* FNAME) const
|
||||
{
|
||||
if(m_is_full_path)
|
||||
{
|
||||
@@ -155,7 +155,7 @@ void Loader::makeModelPath(char* path, const char* FNAME) const
|
||||
} // makeModelPath
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
std::string Loader::getTextureFile(const std::string& FNAME) const
|
||||
std::string FileManager::getTextureFile(const std::string& FNAME) const
|
||||
{
|
||||
std::string path;
|
||||
findFile(path, FNAME, m_texture_search_path);
|
||||
@@ -163,7 +163,7 @@ std::string Loader::getTextureFile(const std::string& FNAME) const
|
||||
} // makeTexturePath
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
std::string Loader::getModelFile(const std::string& FNAME) const
|
||||
std::string FileManager::getModelFile(const std::string& FNAME) const
|
||||
{
|
||||
std::string path;
|
||||
findFile(path, FNAME, m_model_search_path);
|
||||
@@ -171,18 +171,18 @@ std::string Loader::getModelFile(const std::string& FNAME) const
|
||||
} // makeTexturePath
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
std::string Loader::getKartFile(const std::string& fname) const
|
||||
std::string FileManager::getKartFile(const std::string& fname) const
|
||||
{
|
||||
return m_root_dir+"/data/"+fname;
|
||||
} // getKartFile
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
std::string Loader::getTrackDir() const
|
||||
std::string FileManager::getTrackDir() const
|
||||
{
|
||||
return m_root_dir+"/data/tracks";
|
||||
} // getTrackDir
|
||||
//-----------------------------------------------------------------------------
|
||||
std::string Loader::getTrackFile(const std::string& fname,
|
||||
std::string FileManager::getTrackFile(const std::string& fname,
|
||||
const std::string& track_name) const
|
||||
{
|
||||
// tracks file are in data/tracks/TRACKNAME/TRACKNAME.ext
|
||||
@@ -194,13 +194,13 @@ std::string Loader::getTrackFile(const std::string& fname,
|
||||
} // getTrackFile
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
std::string Loader::getConfigFile(const std::string& fname) const
|
||||
std::string FileManager::getConfigFile(const std::string& fname) const
|
||||
{
|
||||
return m_root_dir+"/data/"+fname;
|
||||
} // getConfigFile
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
std::string Loader::getHomeDir() const
|
||||
std::string FileManager::getHomeDir() const
|
||||
{
|
||||
std::string DIRNAME;
|
||||
#ifdef WIN32
|
||||
@@ -223,41 +223,41 @@ std::string Loader::getHomeDir() const
|
||||
} // getHomeDir
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
std::string Loader::getLogFile(const std::string& fname) const
|
||||
std::string FileManager::getLogFile(const std::string& fname) const
|
||||
{
|
||||
return getHomeDir()+"/"+fname;
|
||||
} // getLogFile
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
std::string Loader::getMusicFile(const std::string& fname) const
|
||||
std::string FileManager::getMusicFile(const std::string& fname) const
|
||||
{
|
||||
return m_root_dir+"/oggs/"+fname;
|
||||
} // getMusicFile
|
||||
//-----------------------------------------------------------------------------
|
||||
std::string Loader::getSFXFile(const std::string& fname) const
|
||||
std::string FileManager::getSFXFile(const std::string& fname) const
|
||||
{
|
||||
return m_root_dir+"/wavs/"+fname;
|
||||
} // getSFXFile
|
||||
//-----------------------------------------------------------------------------
|
||||
std::string Loader::getFontFile(const std::string& fname) const
|
||||
std::string FileManager::getFontFile(const std::string& fname) const
|
||||
{
|
||||
return m_root_dir+"/fonts/"+fname;
|
||||
} // getFontFile
|
||||
//-----------------------------------------------------------------------------
|
||||
std::string Loader::getHighscoreFile(const std::string& fname) const
|
||||
std::string FileManager::getHighscoreFile(const std::string& fname) const
|
||||
{
|
||||
return getHomeDir()+"/"+fname;
|
||||
} // getHighscoreFile
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifdef HAVE_GHOST_REPLAY
|
||||
std::string Loader::getReplayFile(const std::string& fname) const
|
||||
std::string FileManager::getReplayFile(const std::string& fname) const
|
||||
{
|
||||
return m_root_dir+"/replay/"+fname;
|
||||
} // getReplayFile
|
||||
#endif
|
||||
//-----------------------------------------------------------------------------
|
||||
void Loader::initConfigDir()
|
||||
void FileManager::initConfigDir()
|
||||
{
|
||||
#ifdef WIN32
|
||||
/*nothing*/
|
||||
@@ -275,7 +275,7 @@ void Loader::initConfigDir()
|
||||
} // initConfigDir
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void Loader::listFiles(std::set<std::string>& result, const std::string& dir,
|
||||
void FileManager::listFiles(std::set<std::string>& result, const std::string& dir,
|
||||
bool is_full_path) const
|
||||
{
|
||||
struct stat mystat;
|
||||
@@ -318,7 +318,7 @@ void Loader::listFiles(std::set<std::string>& result, const std::string& dir,
|
||||
* \param optimise Default is true. If set to false, the model will not
|
||||
* be flattened.
|
||||
*/
|
||||
ssgEntity *Loader::load(const std::string& filename, CallbackType t,
|
||||
ssgEntity *FileManager::load(const std::string& filename, CallbackType t,
|
||||
bool optimise, bool is_full_path)
|
||||
{
|
||||
m_current_callback_type = t;
|
||||
@@ -330,7 +330,7 @@ ssgEntity *Loader::load(const std::string& filename, CallbackType t,
|
||||
} // load
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void Loader::preProcessObj ( ssgEntity *n, bool mirror )
|
||||
void FileManager::preProcessObj ( ssgEntity *n, bool mirror )
|
||||
{
|
||||
if ( n == NULL ) return ;
|
||||
|
||||
@@ -365,7 +365,7 @@ void Loader::preProcessObj ( ssgEntity *n, bool mirror )
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
ssgBranch *Loader::animInit (char *data ) const
|
||||
ssgBranch *FileManager::animInit (char *data ) const
|
||||
{
|
||||
while ( ! isdigit ( *data ) && *data != '\0' )
|
||||
data++ ;
|
||||
@@ -399,7 +399,7 @@ ssgBranch *Loader::animInit (char *data ) const
|
||||
* to be created, which are then handled by the callback manager.
|
||||
*/
|
||||
|
||||
ssgBranch *Loader::createBranch(char *data) const
|
||||
ssgBranch *FileManager::createBranch(char *data) const
|
||||
{
|
||||
|
||||
if ( data == NULL || data[0] != '@' ) return NULL;
|
||||
@@ -17,8 +17,8 @@
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#ifndef HEADER_LOADER_H
|
||||
#define HEADER_LOADER_H
|
||||
#ifndef HEADER_FILE_MANAGER_H
|
||||
#define HEADER_FILE_MANAGER_H
|
||||
|
||||
#include <plib/ssg.h>
|
||||
#include <string>
|
||||
@@ -26,7 +26,7 @@
|
||||
#include <set>
|
||||
#include "callback_manager.hpp"
|
||||
|
||||
class Loader : public ssgLoaderOptions
|
||||
class FileManager : public ssgLoaderOptions
|
||||
{
|
||||
private:
|
||||
bool m_is_full_path;
|
||||
@@ -38,8 +38,8 @@ private:
|
||||
const std::string& fname,
|
||||
const std::vector<std::string>& search_path) const;
|
||||
public:
|
||||
Loader();
|
||||
~Loader();
|
||||
FileManager();
|
||||
~FileManager();
|
||||
|
||||
virtual void makeModelPath (char* path, const char* fname) const;
|
||||
std::string getTextureFile (const std::string& fname) const;
|
||||
@@ -86,7 +86,7 @@ private:
|
||||
ssgBranch *animInit (char *data) const;
|
||||
};
|
||||
|
||||
extern Loader* loader;
|
||||
extern FileManager* file_manager;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
#include "loader.hpp"
|
||||
#include "char_sel.hpp"
|
||||
#include "kart_properties_manager.hpp"
|
||||
#include "widget_manager.hpp"
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include <iostream>
|
||||
|
||||
#include "credits_menu.hpp"
|
||||
#include "loader.hpp"
|
||||
#include "file_manager.hpp"
|
||||
#include "translation.hpp"
|
||||
#include "widget_manager.hpp"
|
||||
#include "menu_manager.hpp"
|
||||
@@ -42,7 +42,7 @@ CreditsMenu::CreditsMenu()
|
||||
std::string line;
|
||||
std::string credits_text;
|
||||
|
||||
filename = loader->getConfigFile("CREDITS");
|
||||
filename = file_manager->getConfigFile("CREDITS");
|
||||
std::ifstream file(filename.c_str());
|
||||
|
||||
if( file.is_open() )
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "loader.hpp"
|
||||
#include "file_manager.hpp"
|
||||
#include "user_config.hpp"
|
||||
#include "gui/font.hpp"
|
||||
|
||||
@@ -42,7 +42,7 @@ int delete_fonts()
|
||||
// =============================================================================
|
||||
Font::Font(const char *fontname)
|
||||
{
|
||||
m_fnt = new fntTexFont(loader->getFontFile(fontname).c_str(),
|
||||
m_fnt = new fntTexFont(file_manager->getFontFile(fontname).c_str(),
|
||||
GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR);
|
||||
m_text_out = new fntRenderer();
|
||||
m_text_out->setFont(m_fnt);
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#include <SDL/SDL.h>
|
||||
|
||||
#include "loader.hpp"
|
||||
#include "file_manager.hpp"
|
||||
#include "sound_manager.hpp"
|
||||
#include "grand_prix_ending.hpp"
|
||||
#include "kart_properties_manager.hpp"
|
||||
@@ -177,7 +177,7 @@ GrandPrixEnd::~GrandPrixEnd()
|
||||
//going white after finishing the grandprix
|
||||
// FIXME: I think this is not necessary anymore after the
|
||||
// texture bug fix (r733) - but I can't currently test this.
|
||||
loader->shared_textures.removeAll();
|
||||
file_manager->shared_textures.removeAll();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include <set>
|
||||
#include "loader.hpp"
|
||||
#include "file_manager.hpp"
|
||||
#include "string_utils.hpp"
|
||||
#include "grand_prix_select.hpp"
|
||||
#include "widget_manager.hpp"
|
||||
@@ -54,7 +54,7 @@ GrandPrixSelect::GrandPrixSelect()
|
||||
widget_manager->setWgtText(WTOK_TITLE, _("Choose a Grand Prix"));
|
||||
|
||||
std::set<std::string> result;
|
||||
loader->listFiles(result, "data");
|
||||
file_manager->listFiles(result, "data");
|
||||
|
||||
widget_manager->setInitialActivationState(true);
|
||||
// Findout which grand prixs are available and load them
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include <sstream>
|
||||
#include "user_config.hpp"
|
||||
#include "herring_manager.hpp"
|
||||
#include "loader.hpp"
|
||||
#include "file_manager.hpp"
|
||||
#include "material_manager.hpp"
|
||||
#include "material.hpp"
|
||||
#include "kart.hpp"
|
||||
@@ -116,19 +116,19 @@ HerringManager::~HerringManager()
|
||||
//-----------------------------------------------------------------------------
|
||||
void HerringManager::loadDefaultHerrings()
|
||||
{
|
||||
// Load all models. This can't be done in the constructor, since the loader
|
||||
// Load all models. This can't be done in the constructor, since the file_manager
|
||||
// isn't ready at that stage.
|
||||
|
||||
// Load all models from the models/herrings directory
|
||||
// --------------------------------------------------
|
||||
std::set<std::string> files;
|
||||
loader->listFiles(files, "models/herrings");
|
||||
file_manager->listFiles(files, "models/herrings");
|
||||
for(std::set<std::string>::iterator i = files.begin();
|
||||
i != files.end(); ++i)
|
||||
{
|
||||
if(!StringUtils::has_suffix(*i, ".ac")) continue;
|
||||
std::string fullName = "herrings/"+(*i);
|
||||
ssgEntity* h = loader->load(fullName, CB_HERRING);
|
||||
ssgEntity* h = file_manager->load(fullName, CB_HERRING);
|
||||
std::string shortName = StringUtils::without_extension(*i);
|
||||
h->ref();
|
||||
h->setName(shortName.c_str());
|
||||
@@ -333,7 +333,7 @@ void HerringManager::loadHerringStyle(const std::string filename)
|
||||
const lisp::Lisp* root = 0;
|
||||
lisp::Parser parser;
|
||||
|
||||
root = parser.parse(loader->getConfigFile(filename + ".herring"));
|
||||
root = parser.parse(file_manager->getConfigFile(filename + ".herring"));
|
||||
|
||||
const lisp::Lisp* herring_node = root->getLisp("herring");
|
||||
if(!herring_node)
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "lisp/writer.hpp"
|
||||
#include "translation.hpp"
|
||||
#include "string_utils.hpp"
|
||||
#include "loader.hpp"
|
||||
#include "file_manager.hpp"
|
||||
#include "race_setup.hpp"
|
||||
#include "user_config.hpp"
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
@@ -59,7 +59,7 @@ void HighscoreManager::SetFilename()
|
||||
}
|
||||
else
|
||||
{
|
||||
m_filename=loader->getHighscoreFile("highscore.data");
|
||||
m_filename=file_manager->getHighscoreFile("highscore.data");
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
@@ -702,6 +702,10 @@
|
||||
RelativePath="../../../src\explosion.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\file_manager.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\flyable.cpp"
|
||||
>
|
||||
@@ -750,10 +754,6 @@
|
||||
RelativePath="../../../src\kart_properties_manager.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="../../../src\loader.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="../../../src\main.cpp"
|
||||
>
|
||||
@@ -1096,6 +1096,10 @@
|
||||
RelativePath="../../../src\explosion.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\file_manager.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\flyable.hpp"
|
||||
>
|
||||
@@ -1156,10 +1160,6 @@
|
||||
RelativePath="../../../src\kart_properties_manager.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="../../../src\loader.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="../../../src\material.hpp"
|
||||
>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
#include "herring_manager.hpp"
|
||||
#include "sound_manager.hpp"
|
||||
#include "loader.hpp"
|
||||
#include "file_manager.hpp"
|
||||
#include "skid_mark.hpp"
|
||||
#include "user_config.hpp"
|
||||
#include "constants.hpp"
|
||||
@@ -1104,7 +1104,7 @@ void Kart::loadData()
|
||||
float r [ 2 ] = { -10.0f, 100.0f } ;
|
||||
|
||||
m_smokepuff = new ssgSimpleState ();
|
||||
m_smokepuff -> setTexture (loader->createTexture ("smoke.rgb", true, true, true)) ;
|
||||
m_smokepuff -> setTexture (file_manager->createTexture ("smoke.rgb", true, true, true)) ;
|
||||
m_smokepuff -> setTranslucent () ;
|
||||
m_smokepuff -> enable ( GL_TEXTURE_2D ) ;
|
||||
m_smokepuff -> setShadeModel ( GL_SMOOTH ) ;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "material_manager.hpp"
|
||||
#include "lisp/parser.hpp"
|
||||
#include "lisp/lisp.hpp"
|
||||
#include "loader.hpp"
|
||||
#include "file_manager.hpp"
|
||||
#include "string_utils.hpp"
|
||||
#include "kart_properties.hpp"
|
||||
#include "stk_config.hpp"
|
||||
@@ -83,7 +83,7 @@ void KartProperties::load(const std::string filename, const std::string node,
|
||||
// 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);
|
||||
m_model = file_manager->load(m_model_file, CB_KART, false);
|
||||
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);
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include <stdexcept>
|
||||
#include <algorithm>
|
||||
#include <ctime>
|
||||
#include "loader.hpp"
|
||||
#include "file_manager.hpp"
|
||||
#include "string_utils.hpp"
|
||||
#include "kart_properties_manager.hpp"
|
||||
#include "kart_properties.hpp"
|
||||
@@ -59,7 +59,7 @@ void KartPropertiesManager::loadKartData(bool dont_load_models)
|
||||
{
|
||||
m_max_steer_angle = -1.0f;
|
||||
std::set<std::string> result;
|
||||
loader->listFiles(result, "data");
|
||||
file_manager->listFiles(result, "data");
|
||||
|
||||
// Find out which characters are available and load them
|
||||
for(std::set<std::string>::iterator i = result.begin();
|
||||
@@ -68,7 +68,7 @@ void KartPropertiesManager::loadKartData(bool dont_load_models)
|
||||
if (StringUtils::has_suffix(*i, ".tkkf"))
|
||||
{
|
||||
KartProperties* kp = new KartProperties();
|
||||
std::string filename=loader->getKartFile(*i);
|
||||
std::string filename=file_manager->getKartFile(*i);
|
||||
kp->load(filename.c_str(), "tuxkart-kart", dont_load_models);
|
||||
m_karts_properties.push_back(kp);
|
||||
if(kp->getMaxSteerAngle() > m_max_steer_angle)
|
||||
|
||||
18
src/main.cpp
18
src/main.cpp
@@ -50,7 +50,7 @@
|
||||
#include "kart.hpp"
|
||||
#include "projectile_manager.hpp"
|
||||
#include "race_manager.hpp"
|
||||
#include "loader.hpp"
|
||||
#include "file_manager.hpp"
|
||||
#include "game_manager.hpp"
|
||||
#include "widget_manager.hpp"
|
||||
#include "material_manager.hpp"
|
||||
@@ -145,7 +145,7 @@ int handleCmdLine(int argc, char **argv)
|
||||
}
|
||||
else if( (!strcmp(argv[i], "--kart") && i+1<argc ))
|
||||
{
|
||||
std::string filename=loader->getKartFile(std::string(argv[i+1])+".tkkf");
|
||||
std::string filename=file_manager->getKartFile(std::string(argv[i+1])+".tkkf");
|
||||
if(filename!="")
|
||||
{
|
||||
race_manager->setPlayerKart(0, argv[i+1]);
|
||||
@@ -180,7 +180,7 @@ int handleCmdLine(int argc, char **argv)
|
||||
}
|
||||
else if( (!strcmp(argv[i], "--stk-config")) && i+1<argc )
|
||||
{
|
||||
stk_config->load(loader->getConfigFile(argv[i+1]));
|
||||
stk_config->load(file_manager->getConfigFile(argv[i+1]));
|
||||
fprintf ( stdout, _("STK config will be read from %s.\n"), argv[i+1] ) ;
|
||||
}
|
||||
else if( (!strcmp(argv[i], "--numkarts") || !strcmp(argv[i], "-k")) &&
|
||||
@@ -369,8 +369,8 @@ int handleCmdLine(int argc, char **argv)
|
||||
//=============================================================================
|
||||
void InitTuxkart()
|
||||
{
|
||||
loader = new Loader();
|
||||
loader->setCreateStateCallback(getAppState);
|
||||
file_manager = new FileManager();
|
||||
file_manager->setCreateStateCallback(getAppState);
|
||||
user_config = new UserConfig();
|
||||
sound_manager = new SoundManager();
|
||||
|
||||
@@ -395,7 +395,7 @@ void InitTuxkart()
|
||||
race_manager->setNumLaps (3);
|
||||
race_manager->setRaceMode (RaceSetup::RM_QUICK_RACE);
|
||||
race_manager->setDifficulty(RD_MEDIUM);
|
||||
stk_config->load(loader->getConfigFile("stk_config.data"));
|
||||
stk_config->load(file_manager->getConfigFile("stk_config.data"));
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
@@ -412,8 +412,8 @@ int main(int argc, char *argv[] )
|
||||
|
||||
if (user_config->m_log_errors) //Enable logging of stdout and stderr to logfile
|
||||
{
|
||||
std::string logoutfile = loader->getLogFile("stdout.log");
|
||||
std::string logerrfile = loader->getLogFile("stderr.log");
|
||||
std::string logoutfile = file_manager->getLogFile("stdout.log");
|
||||
std::string logerrfile = file_manager->getLogFile("stderr.log");
|
||||
std::cout << "Error messages and other text output will be logged to " ;
|
||||
std::cout << logoutfile << " and "<<logerrfile;
|
||||
if(freopen (logoutfile.c_str(),"w",stdout)!=stdout)
|
||||
@@ -434,7 +434,7 @@ int main(int argc, char *argv[] )
|
||||
|
||||
game_manager = new GameManager ();
|
||||
// loadMaterials needs ssgLoadTextures (internally), which can
|
||||
// only be called after ssgInit (since this adds the actual loader)
|
||||
// only be called after ssgInit (since this adds the actual file_manager)
|
||||
// so this next call can't be in InitTuxkart. And InitPlib needs
|
||||
// config, which gets defined in InitTuxkart, so swapping those two
|
||||
// calls is not possible either ... so loadMaterial has to be done here :(
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "loader.hpp"
|
||||
#include "file_manager.hpp"
|
||||
#include "material.hpp"
|
||||
|
||||
#define UCLAMP 1
|
||||
@@ -156,7 +156,7 @@ void Material::install(bool is_full_path)
|
||||
if ( m_texname.size()>0 )
|
||||
{
|
||||
std::string fn=is_full_path ? m_texname
|
||||
: loader->getTextureFile(m_texname);
|
||||
: file_manager->getTextureFile(m_texname);
|
||||
if(fn=="")
|
||||
{
|
||||
fprintf(stderr, "WARNING: texture '%s' not found.\n",
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include <stdexcept>
|
||||
#include "loader.hpp"
|
||||
#include "file_manager.hpp"
|
||||
#include "material_manager.hpp"
|
||||
#include "material.hpp"
|
||||
#include "translation.hpp"
|
||||
@@ -73,7 +73,7 @@ void MaterialManager::loadMaterial()
|
||||
// Use temp material for reading, but then set the shared
|
||||
// material index later, so that these materials are not popped
|
||||
const std::string fname = "materials.dat";
|
||||
std::string full_name = loader->getTextureFile(fname);
|
||||
std::string full_name = file_manager->getTextureFile(fname);
|
||||
if(full_name=="")
|
||||
{
|
||||
char msg[MAX_ERROR_MESSAGE_LENGTH];
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include <AL/alut.h>
|
||||
|
||||
#include "music_ogg.hpp"
|
||||
#include "loader.hpp"
|
||||
#include "file_manager.hpp"
|
||||
#include "user_config.hpp"
|
||||
|
||||
#define BUFFER_SIZE (4096 * 8)
|
||||
@@ -59,7 +59,7 @@ bool MusicOggStream::load(const std::string& filename)
|
||||
return false;
|
||||
}
|
||||
|
||||
m_fileName = loader->getMusicFile(filename);
|
||||
m_fileName = file_manager->getMusicFile(filename);
|
||||
if(m_fileName=="") return false;
|
||||
|
||||
oggFile = fopen(m_fileName.c_str(), "rb");
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "loader.hpp"
|
||||
#include "file_manager.hpp"
|
||||
#include "projectile_manager.hpp"
|
||||
#include "spark.hpp"
|
||||
#include "missile.hpp"
|
||||
@@ -36,7 +36,7 @@ void ProjectileManager::loadData()
|
||||
|
||||
// Load the explosion model and find the actual selector branch in it.
|
||||
// Only the explosion model is loaded here, see collectable_manager.
|
||||
m_explosion_model = find_selector((ssgBranch*)loader->load("explode.ac",
|
||||
m_explosion_model = find_selector((ssgBranch*)file_manager->load("explode.ac",
|
||||
CB_EXPLOSION) );
|
||||
m_explosion_model->ref();
|
||||
if ( m_explosion_model == NULL )
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "loader.hpp"
|
||||
#include "track_manager.hpp"
|
||||
#include "race_setup.hpp"
|
||||
#include "game_manager.hpp"
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#include "collectable_manager.hpp"
|
||||
#include "attachment_manager.hpp"
|
||||
#include "projectile_manager.hpp"
|
||||
#include "loader.hpp"
|
||||
#include "file_manager.hpp"
|
||||
#include "gui/menu_manager.hpp"
|
||||
#include "player.hpp"
|
||||
#include "gui/font.hpp"
|
||||
@@ -176,7 +176,7 @@ void setVideoMode(bool resetTextures)
|
||||
if(resetTextures)
|
||||
{
|
||||
// Clear plib internal texture cache
|
||||
loader->endLoad();
|
||||
file_manager->endLoad();
|
||||
|
||||
// Windows needs to reload all textures, display lists, ... which means
|
||||
// that all models have to be reloaded. So first, free all textures,
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include <AL/alut.h>
|
||||
|
||||
#include "sfx_openal.hpp"
|
||||
#include "loader.hpp"
|
||||
#include "file_manager.hpp"
|
||||
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ void SFXImpl::play()
|
||||
//-----------------------------------------------------------------------------
|
||||
bool SFXImpl::load(const char* filename)
|
||||
{
|
||||
std::string path = loader->getSFXFile(filename);
|
||||
std::string path = file_manager->getSFXFile(filename);
|
||||
|
||||
alGenBuffers(1, &m_soundBuffer);
|
||||
if (alGetError() != AL_NO_ERROR)
|
||||
@@ -89,8 +89,8 @@ bool SFXImpl::load(const char* filename)
|
||||
|
||||
if (data == NULL)
|
||||
{
|
||||
const int ERROR = alutGetError();
|
||||
fprintf(stderr, "Error 1 loading SFX: %s failed because %s \n", path.c_str(), alutGetErrorString(ERROR));
|
||||
const int ALUT_ERROR = alutGetError();
|
||||
fprintf(stderr, "Error 1 loading SFX: %s failed because %s \n", path.c_str(), alutGetErrorString(ALUT_ERROR));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "user_config.hpp"
|
||||
#include "string_utils.hpp"
|
||||
#include "gui/font.hpp"
|
||||
#include "loader.hpp"
|
||||
#include "file_manager.hpp"
|
||||
|
||||
#define USE_PLIB_SOUND !(HAVE_OPENAL && HAVE_OGGVORBIS)
|
||||
#if USE_PLIB_SOUND
|
||||
@@ -197,7 +197,7 @@ void SoundManager::playMusic(const std::string& filename)
|
||||
std::string name_readme;
|
||||
try
|
||||
{
|
||||
name_readme = loader->getMusicFile(
|
||||
name_readme = file_manager->getMusicFile(
|
||||
StringUtils::without_extension(filename)+".readme");
|
||||
}
|
||||
catch(std::exception)
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include <algorithm>
|
||||
#include "loader.hpp"
|
||||
#include "string_utils.hpp"
|
||||
|
||||
namespace StringUtils
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include <stdexcept>
|
||||
#include <sstream>
|
||||
#include <plib/ssgAux.h>
|
||||
#include "loader.hpp"
|
||||
#include "file_manager.hpp"
|
||||
#include "track.hpp"
|
||||
#include "string_utils.hpp"
|
||||
#include "lisp/lisp.hpp"
|
||||
@@ -833,8 +833,8 @@ void Track::loadTrack(std::string filename_)
|
||||
LISP->get ("AI-curve-speed-adjust", m_AI_curve_speed_adjustment);
|
||||
|
||||
// Set the correct paths
|
||||
m_screenshot = loader->getTrackFile(m_screenshot, getIdent());
|
||||
m_top_view = loader->getTrackFile(m_top_view, getIdent());
|
||||
m_screenshot = file_manager->getTrackFile(m_screenshot, getIdent());
|
||||
m_top_view = file_manager->getTrackFile(m_top_view, getIdent());
|
||||
|
||||
delete ROOT;
|
||||
} // loadTrack
|
||||
@@ -947,7 +947,7 @@ Track::loadDriveline()
|
||||
void
|
||||
Track::readDrivelineFromFile(std::vector<sgVec3Wrapper>& line, const std::string& file_ext)
|
||||
{
|
||||
std::string path = loader->getTrackFile(m_ident+file_ext);
|
||||
std::string path = file_manager->getTrackFile(m_ident+file_ext);
|
||||
FILE *fd = fopen ( path.c_str(), "r" ) ;
|
||||
|
||||
if ( fd == NULL )
|
||||
@@ -1105,12 +1105,12 @@ void Track::convertTrackToBullet(ssgEntity *track, sgMat4 m)
|
||||
void Track::loadTrackModel()
|
||||
{
|
||||
// Add the track directory to the texture search path
|
||||
loader->pushTextureSearchPath(loader->getTrackFile("",getIdent()));
|
||||
loader->pushModelSearchPath (loader->getTrackFile("",getIdent()));
|
||||
file_manager->pushTextureSearchPath(file_manager->getTrackFile("",getIdent()));
|
||||
file_manager->pushModelSearchPath (file_manager->getTrackFile("",getIdent()));
|
||||
// First read the temporary materials.dat file if it exists
|
||||
try
|
||||
{
|
||||
std::string materials_file = loader->getTrackFile("materials.dat",getIdent());
|
||||
std::string materials_file = file_manager->getTrackFile("materials.dat",getIdent());
|
||||
material_manager->pushTempMaterial(materials_file);
|
||||
}
|
||||
catch (std::exception& e)
|
||||
@@ -1118,7 +1118,7 @@ void Track::loadTrackModel()
|
||||
// no temporary materials.dat file, ignore
|
||||
(void)e;
|
||||
}
|
||||
std::string path = loader->getTrackFile(getIdent()+".loc");
|
||||
std::string path = file_manager->getTrackFile(getIdent()+".loc");
|
||||
|
||||
FILE *fd = fopen (path.c_str(), "r" );
|
||||
if ( fd == NULL )
|
||||
@@ -1249,7 +1249,7 @@ void Track::loadTrackModel()
|
||||
}
|
||||
} // if need_hat
|
||||
|
||||
ssgEntity *obj = loader->load(loader->getModelFile(fname),
|
||||
ssgEntity *obj = file_manager->load(file_manager->getModelFile(fname),
|
||||
CB_TRACK,
|
||||
/* optimise */ true,
|
||||
/*is_full_path*/ true);
|
||||
@@ -1258,8 +1258,8 @@ void Track::loadTrackModel()
|
||||
fclose(fd);
|
||||
char msg[MAX_ERROR_MESSAGE_LENGTH];
|
||||
snprintf(msg, sizeof(msg), "Can't open track model '%s'",fname);
|
||||
loader->popTextureSearchPath();
|
||||
loader->popModelSearchPath ();
|
||||
file_manager->popTextureSearchPath();
|
||||
file_manager->popModelSearchPath ();
|
||||
throw std::runtime_error(msg);
|
||||
}
|
||||
createDisplayLists(obj);
|
||||
@@ -1288,8 +1288,8 @@ void Track::loadTrackModel()
|
||||
} // while fgets
|
||||
|
||||
fclose ( fd ) ;
|
||||
loader->popTextureSearchPath();
|
||||
loader->popModelSearchPath ();
|
||||
file_manager->popTextureSearchPath();
|
||||
file_manager->popModelSearchPath ();
|
||||
|
||||
createPhysicsModel();
|
||||
} // loadTrack
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdexcept>
|
||||
#include "loader.hpp"
|
||||
#include "file_manager.hpp"
|
||||
#include "string_utils.hpp"
|
||||
#include "track_manager.hpp"
|
||||
#include "track.hpp"
|
||||
@@ -72,14 +72,14 @@ TrackManager::loadTrackList ()
|
||||
{
|
||||
// Load up a list of tracks - and their names
|
||||
std::set<std::string> files;
|
||||
loader->listFiles(files, loader->getTrackDir(), /*is_full_path*/ true);
|
||||
file_manager->listFiles(files, file_manager->getTrackDir(), /*is_full_path*/ true);
|
||||
for(std::set<std::string>::iterator i = files.begin(); i != files.end(); ++i)
|
||||
{
|
||||
if(*i=="." || *i=="..") continue;
|
||||
std::string config_file;
|
||||
try
|
||||
{
|
||||
config_file = loader->getTrackFile((*i)+".track");
|
||||
config_file = file_manager->getTrackFile((*i)+".track");
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
#include "lisp/writer.hpp"
|
||||
#include "translation.hpp"
|
||||
#include "race_manager.hpp"
|
||||
#include "loader.hpp"
|
||||
#include "file_manager.hpp"
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
# define snprintf _snprintf
|
||||
#endif
|
||||
@@ -76,9 +76,9 @@ UserConfig::~UserConfig()
|
||||
void UserConfig::setFilename()
|
||||
{
|
||||
#ifdef WIN32
|
||||
m_filename = loader->getLogFile("supertuxkart.cfg");
|
||||
m_filename = file_manager->getLogFile("supertuxkart.cfg");
|
||||
#else
|
||||
m_filename = loader->getLogFile("config");
|
||||
m_filename = file_manager->getLogFile("config");
|
||||
#endif
|
||||
} // setFilename
|
||||
|
||||
@@ -298,7 +298,7 @@ void UserConfig::loadConfig()
|
||||
*/
|
||||
int UserConfig::CheckAndCreateDir()
|
||||
{
|
||||
const std::string DIRNAME = loader->getHomeDir();
|
||||
const std::string DIRNAME = file_manager->getHomeDir();
|
||||
ulDir* u = ulOpenDir(DIRNAME.c_str());
|
||||
if(u)
|
||||
{ // OK, directory exists
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "herring_manager.hpp"
|
||||
#include "projectile_manager.hpp"
|
||||
#include "gui/menu_manager.hpp"
|
||||
#include "loader.hpp"
|
||||
#include "file_manager.hpp"
|
||||
#include "player_kart.hpp"
|
||||
#include "auto_kart.hpp"
|
||||
#include "track.hpp"
|
||||
@@ -335,7 +335,7 @@ void World::update(float dt)
|
||||
bool World::saveReplayHumanReadable( std::string const &filename ) const
|
||||
{
|
||||
std::string path;
|
||||
path = loader->getReplayFile(filename+"."+ReplayBase::REPLAY_FILE_EXTENSION_HUMAN_READABLE);
|
||||
path = file_manager->getReplayFile(filename+"."+ReplayBase::REPLAY_FILE_EXTENSION_HUMAN_READABLE);
|
||||
|
||||
FILE *fd = fopen( path.c_str(), "w" );
|
||||
if( !fd )
|
||||
@@ -378,12 +378,12 @@ bool World::loadReplayHumanReadable( std::string const &filename )
|
||||
assert( m_p_replay_player );
|
||||
m_p_replay_player->destroy();
|
||||
|
||||
std::string path = loader->getReplayFile(filename+"."+
|
||||
std::string path = file_manager->getReplayFile(filename+"."+
|
||||
ReplayBase::REPLAY_FILE_EXTENSION_HUMAN_READABLE);
|
||||
|
||||
try
|
||||
{
|
||||
path = loader->getPath(path.c_str());
|
||||
path = file_manager->getPath(path.c_str());
|
||||
}
|
||||
catch(std::runtime_error& e)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user