#include "Game.h"
#include "Models.h"
+#include "Utils/Folders.h"
extern float multiplier;
extern float viewdistance;
}
}
-bool Model::loadnotex(const char *filename )
+bool Model::loadnotex(const std::string& filename )
{
FILE *tfile;
long i;
type = notextype;
color = 0;
- tfile = fopen( ConvertFileName(filename), "rb" );
+ tfile = Folders::openMandatoryFile( Folders::getResourcePath(filename), "rb" );
+
// read model settings
fseek(tfile, 0, SEEK_SET);
}
boundingsphereradius = fast_sqrt(boundingsphereradius);
- return 1;
+ return true;
}
-bool Model::load(const char *filename, bool texture )
+bool Model::load(const std::string& filename, bool texture )
{
FILE *tfile;
long i;
type = normaltype;
color = 0;
- tfile = fopen( ConvertFileName(filename), "rb" );
- // read model settings
+ tfile = Folders::openMandatoryFile( Folders::getResourcePath(filename), "rb" );
+ // read model settings
fseek(tfile, 0, SEEK_SET);
funpackf(tfile, "Bs Bs", &vertexNum, &TriangleNum);
}
boundingsphereradius = fast_sqrt(boundingsphereradius);
- return 1;
+ return true;
}
-bool Model::loaddecal(const char *filename, bool texture )
+bool Model::loaddecal(const std::string& filename, bool texture )
{
FILE *tfile;
long i, j;
LOGFUNC;
- // Changing the filename so that its more os specific
- char * FixedFN = ConvertFileName(filename);
-
- LOG(std::string("Loading decal...") + FixedFN);
+ LOG(std::string("Loading decal...") + Folders::getResourcePath(filename));
type = decalstype;
numdecals = 0;
color = 0;
- tfile = fopen( FixedFN, "rb" );
- // read model settings
+ tfile = Folders::openMandatoryFile( Folders::getResourcePath(filename), "rb" );
+ // read model settings
fseek(tfile, 0, SEEK_SET);
funpackf(tfile, "Bs Bs", &vertexNum, &TriangleNum);
decalposition = (XYZ*)malloc(sizeof(XYZ) * max_model_decals);
}
- return 1;
+ return true;
}
-bool Model::loadraw(char *filename )
+bool Model::loadraw(const std::string& filename)
{
FILE *tfile;
long i;
type = rawtype;
color = 0;
- tfile = fopen( ConvertFileName(filename), "rb" );
- // read model settings
+ tfile = Folders::openMandatoryFile( Folders::getResourcePath(filename), "rb" );
+ // read model settings
fseek(tfile, 0, SEEK_SET);
funpackf(tfile, "Bs Bs", &vertexNum, &TriangleNum);
owner[i] = -1;
}
- return 1;
+ return true;
}