From: Ryan Hanson Date: Fri, 14 May 2010 21:26:32 +0000 (-0500) Subject: Made filepaths use ConvertFileName(), so it works on Windows compiled with MinGW X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=58aaf9dc190781f673fd5928277d3ade7434268a;p=lugaru.git Made filepaths use ConvertFileName(), so it works on Windows compiled with MinGW --- diff --git a/Source/GameInitDispose.cpp b/Source/GameInitDispose.cpp index e712154..f59c837 100644 --- a/Source/GameInitDispose.cpp +++ b/Source/GameInitDispose.cpp @@ -427,8 +427,11 @@ void Game::LoadTexture(const char *fileName, GLuint *textureid,int mipmap, bool LOG(std::string("Loading texture...") + fileName); + // Fix filename so that is os appropreate + char * fixedFN = ConvertFileName(fileName); + unsigned char fileNamep[256]; - CopyCStringToPascal(fileName,fileNamep); + CopyCStringToPascal(fixedFN, fileNamep); //Load Image upload_image( fileNamep ,hasalpha); @@ -484,7 +487,7 @@ void Game::LoadTextureSave(const char *fileName, GLuint *textureid,int mipmap,GL //Load Image unsigned char fileNamep[256]; - CopyCStringToPascal(fileName,fileNamep); + CopyCStringToPascal(ConvertFileName(fileName), fileNamep); //Load Image upload_image( fileNamep ,0); //LoadTGA( fileName ); @@ -550,9 +553,13 @@ void Game::LoadSave(const char *fileName, GLuint *textureid,bool mipmap,GLubyte texdetail=1; //upload_image( fileName ); //LoadTGA( fileName ); + + // Converting file to something os specific + char * fixedFN = ConvertFileName(fileName); + //Load Image unsigned char fileNamep[256]; - CopyCStringToPascal(fileName,fileNamep); + CopyCStringToPascal(fixedFN, fileNamep); //Load Image upload_image( fileNamep ,0); texdetail=temptexdetail; diff --git a/Source/GameTick.cpp b/Source/GameTick.cpp index 670bdcf..e247d53 100644 --- a/Source/GameTick.cpp +++ b/Source/GameTick.cpp @@ -883,9 +883,12 @@ void Game::Loadlevel(char *name){ OPENAL_SetPaused(channels[whooshsound], true); OPENAL_SetPaused(channels[stream_firesound], true); + // Change the map filename into something that is os specific + char *FixedFN = ConvertFileName(name); + int mapvers; FILE *tfile; - tfile=fopen( name, "rb" ); + tfile=fopen( FixedFN, "rb" ); if(tfile) { OPENAL_SetPaused(channels[stream_firesound], true); diff --git a/Source/Models.cpp b/Source/Models.cpp index 1eae468..5339b9b 100644 --- a/Source/Models.cpp +++ b/Source/Models.cpp @@ -436,7 +436,7 @@ bool Model::loadnotex(char *filename ) type=notextype; color=0; - tfile=fopen( filename, "rb" ); + tfile=fopen( ConvertFileName(filename), "rb" ); // read model settings fseek(tfile, 0, SEEK_SET); @@ -594,7 +594,10 @@ bool Model::loaddecal(char *filename,bool texture ) LOGFUNC; - LOG(std::string("Loading decal...") + filename); + // Changing the filename so that its more os specific + char * FixedFN = ConvertFileName(filename); + + LOG(std::string("Loading decal...") + FixedFN); int oldvertexNum,oldTriangleNum; oldvertexNum=vertexNum; @@ -604,7 +607,7 @@ bool Model::loaddecal(char *filename,bool texture ) numdecals=0; color=0; - tfile=fopen( filename, "rb" ); + tfile=fopen( FixedFN, "rb" ); // read model settings diff --git a/Source/OpenGL_Windows.cpp b/Source/OpenGL_Windows.cpp index f8f180c..da51185 100644 --- a/Source/OpenGL_Windows.cpp +++ b/Source/OpenGL_Windows.cpp @@ -19,6 +19,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + #ifdef WIN32 #define UINT8 WIN32API_UINT8 #define UINT16 WIN32API_UINT16 @@ -35,7 +36,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. extern "C" { #include "zlib.h" #include "png.h" - #include "jpeglib.h" + #ifdef WIN32 + #define INT32 INT32_jpeg + #include "jpeglib.h" + #undef INT32 + #else + #include "jpeglib.h" + #endif } static bool load_image(const char * fname, TGAImageRec & tex); @@ -110,6 +117,7 @@ extern float volume; #include "gamegl.h" #include "MacCompatibility.h" + #ifdef WIN32 #include #endif @@ -1499,6 +1507,7 @@ int main(int argc, char **argv) } } + bool LoadImage(const char * fname, TGAImageRec & tex) { bool res = true; diff --git a/Source/Skeleton.cpp b/Source/Skeleton.cpp index cd4e791..18806a8 100644 --- a/Source/Skeleton.cpp +++ b/Source/Skeleton.cpp @@ -1017,7 +1017,10 @@ void Animation::Load(char *filename, int aheight, int aattack) LOGFUNC; - LOG(std::string("Loading animation...") + filename); + // Changing the filename into something the OS can understand + char *fixedFN = ConvertFileName(filename); + + LOG(std::string("Loading animation...") + fixedFN); deallocate(); @@ -1026,7 +1029,7 @@ void Animation::Load(char *filename, int aheight, int aattack) if(visibleloading)pgame->LoadingScreen(); - tfile=fopen( filename, "rb" ); + tfile=fopen( fixedFN, "rb" ); if(tfile){ funpackf(tfile, "Bi Bi", &numframes, &joints); /* @@ -1133,7 +1136,12 @@ void Animation::Move(XYZ how) } } -void Skeleton::Load(char *filename,char *lowfilename,char *clothesfilename, char *modelfilename, char *model2filename, char *model3filename, char *model4filename, char *model5filename, char *model6filename, char *model7filename, char *modellowfilename, char *modelclothesfilename, bool aclothes) +void Skeleton::Load(char *filename, char *lowfilename, char *clothesfilename, + char *modelfilename, char *model2filename, + char *model3filename, char *model4filename, + char *model5filename, char *model6filename, + char *model7filename, char *modellowfilename, + char *modelclothesfilename, bool aclothes) { static GLfloat M[16]; static int parentID; @@ -1145,6 +1153,7 @@ void Skeleton::Load(char *filename,char *lowfilename,char *clothesfilename, char LOGFUNC; + newload=0; num_models=7; @@ -1198,7 +1207,7 @@ void Skeleton::Load(char *filename,char *lowfilename,char *clothesfilename, char drawmodelclothes.CalculateNormals(0); } - tfile=fopen( filename, "rb" ); + tfile=fopen( ConvertFileName(filename), "rb" ); if(1){ funpackf(tfile, "Bi", &num_joints); //joints.resize(num_joints); @@ -1285,7 +1294,7 @@ void Skeleton::Load(char *filename,char *lowfilename,char *clothesfilename, char } fclose(tfile); - tfile=fopen( lowfilename, "rb" ); + tfile=fopen( ConvertFileName(lowfilename), "rb" ); if(1){ lSize=sizeof(num_joints); fseek ( tfile, lSize, SEEK_CUR); @@ -1391,7 +1400,7 @@ void Skeleton::Load(char *filename,char *lowfilename,char *clothesfilename, char } if(clothes){ - tfile=fopen( clothesfilename, "rb" ); + tfile=fopen( ConvertFileName(clothesfilename), "rb" ); lSize=sizeof(num_joints); fseek ( tfile, lSize, SEEK_CUR); //joints = new Joint[num_joints]; diff --git a/Source/Terrain.cpp b/Source/Terrain.cpp index 6ee96a5..1683dfc 100644 --- a/Source/Terrain.cpp +++ b/Source/Terrain.cpp @@ -380,8 +380,12 @@ bool Terrain::load(const char *fileName) float temptexdetail=texdetail; texdetail=terraindetail; //LoadTGA( fileName ); + + // Fixing filename so that it works with its own os + char * FixedFN = ConvertFileName(fileName); + unsigned char fileNamep[256]; - CopyCStringToPascal(fileName,fileNamep); + CopyCStringToPascal(FixedFN, fileNamep); //Load Image upload_image( fileNamep ,0);