]> git.jsancho.org Git - lugaru.git/commitdiff
Made filepaths use ConvertFileName(), so it works on Windows compiled with MinGW
authorRyan Hanson <hansonry@gmail.com>
Fri, 14 May 2010 21:26:32 +0000 (16:26 -0500)
committerRyan Hanson <hansonry@gmail.com>
Fri, 14 May 2010 21:26:32 +0000 (16:26 -0500)
Source/GameInitDispose.cpp
Source/GameTick.cpp
Source/Models.cpp
Source/OpenGL_Windows.cpp
Source/Skeleton.cpp
Source/Terrain.cpp

index e712154a69fd5f97ba7e492e833ff2c73891a773..f59c83757264c022f125e418a6623f9186cfb512 100644 (file)
@@ -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;
index 670bdcfecd3097cf5d42e359b91eb3d4d831a321..e247d5333a23f324f6aad9576609f5729d720c1d 100644 (file)
@@ -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);
index 1eae46867c265e011890d9eef60c136ce571f0fc..5339b9b1f5e0afe86ba87aae9bb63a94bf7252b0 100644 (file)
@@ -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
 
 
index f8f180c6aa38b3c7a8f7ce889355f12250869b69..da5118519eb0526874f7878c36d76767a69cedf1 100644 (file)
@@ -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 <shellapi.h>
 #endif
@@ -1499,6 +1507,7 @@ int main(int argc, char **argv)
                }
        }
 
+
        bool LoadImage(const char * fname, TGAImageRec & tex)
        {
                bool res = true;
index cd4e79192c67e2dcd08525d81150bc09aaf1ef38..18806a803bf4d71844a7bffcf3b74d43a5279bd0 100644 (file)
@@ -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];
index 6ee96a5e49772837204655ab0c08126910dd1150..1683dfc88c0426cd7d2ab8b79bfd903e565a2d0e 100644 (file)
@@ -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);