X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FModels.cpp;h=2c301689ea38f8cd3695e7ebd5693fc2d838ec0c;hb=8a32dc9e4e1011b10f009e999d7d008aa2711d8a;hp=16f92badf78552f5d1667896e0485184ba7276b1;hpb=757fd9c1ec8d263225df90ef486051712f448483;p=lugaru.git diff --git a/Source/Models.cpp b/Source/Models.cpp index 16f92ba..2c30168 100644 --- a/Source/Models.cpp +++ b/Source/Models.cpp @@ -400,7 +400,7 @@ void Model::UpdateVertexArrayNoTexNoNorm() } } -bool Model::loadnotex(const char *filename ) +bool Model::loadnotex(const std::string& filename ) { FILE *tfile; long i; @@ -408,7 +408,8 @@ bool Model::loadnotex(const char *filename ) type = notextype; color = 0; - tfile = fopen( Folders::getResourcePath(filename).c_str(), "rb" ); + tfile = Folders::openMandatoryFile( Folders::getResourcePath(filename), "rb" ); + // read model settings fseek(tfile, 0, SEEK_SET); @@ -459,11 +460,11 @@ bool Model::loadnotex(const char *filename ) } 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; @@ -478,9 +479,9 @@ bool Model::load(const char *filename, bool texture ) type = normaltype; color = 0; - tfile = fopen( Folders::getResourcePath(filename).c_str(), "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); @@ -534,10 +535,10 @@ bool Model::load(const char *filename, bool texture ) } 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; @@ -550,9 +551,9 @@ bool Model::loaddecal(const char *filename, bool texture ) numdecals = 0; color = 0; - tfile = fopen( Folders::getResourcePath(filename).c_str(), "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); @@ -629,10 +630,10 @@ bool Model::loaddecal(const char *filename, bool texture ) 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; @@ -644,9 +645,9 @@ bool Model::loadraw(char *filename ) type = rawtype; color = 0; - tfile = fopen( Folders::getResourcePath(filename).c_str(), "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); @@ -684,7 +685,7 @@ bool Model::loadraw(char *filename ) owner[i] = -1; } - return 1; + return true; }