X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FSkeleton.cpp;h=9bdd4cea0dcf6ac3bbbb0643395c0d4a272d83a1;hb=decb00e82a2e65e25dbcdd8f16fff5a6a07d31d6;hp=057ea9d046af22afd0fb41361571acd1f16eddb9;hpb=d435148bf0fd538f3b69a8232253618e10249ffa;p=lugaru.git diff --git a/Source/Skeleton.cpp b/Source/Skeleton.cpp index 057ea9d..9bdd4ce 100644 --- a/Source/Skeleton.cpp +++ b/Source/Skeleton.cpp @@ -22,12 +22,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /**> HEADER FILES <**/ #include "Game.h" #include "Skeleton.h" +#include "openal_wrapper.h" extern float multiplier; extern float gravity; extern Skeleton testskeleton; extern Terrain terrain; -extern FSOUND_SAMPLE *samp[100]; +extern OPENAL_SAMPLE *samp[100]; extern int channels[100]; extern Objects objects; extern Sprites sprites; @@ -49,7 +50,7 @@ extern int whichjointendarray[26]; extern Game * pgame; extern bool visibleloading; -extern "C" void PlaySoundEx(int channel, FSOUND_SAMPLE *sptr, FSOUND_DSPUNIT *dsp, signed char startpaused); +extern "C" void PlaySoundEx(int channel, OPENAL_SAMPLE *sptr, OPENAL_DSPUNIT *dsp, signed char startpaused); void dealloc2(void* param){ free(param); @@ -295,9 +296,9 @@ float Skeleton::DoConstraints(XYZ *coords,float *scale) vel[1]=joints[jointlabels[head]].velocity.y; vel[2]=joints[jointlabels[head]].velocity.z; PlaySoundEx( landsound1, samp[landsound1], NULL, true); - FSOUND_3D_SetAttributes(channels[landsound1], gLoc, vel); - FSOUND_SetVolume(channels[landsound1], 128); - FSOUND_SetPaused(channels[landsound1], false); + OPENAL_3D_SetAttributes(channels[landsound1], gLoc, vel); + OPENAL_SetVolume(channels[landsound1], 128); + OPENAL_SetPaused(channels[landsound1], false); breaking=1; } @@ -314,9 +315,9 @@ float Skeleton::DoConstraints(XYZ *coords,float *scale) vel[1]=joints[jointlabels[head]].velocity.y; vel[2]=joints[jointlabels[head]].velocity.z; PlaySoundEx( landsound2, samp[landsound2], NULL, true); - FSOUND_3D_SetAttributes(channels[landsound2], gLoc, vel); - FSOUND_SetVolume(channels[landsound2], 128); - FSOUND_SetPaused(channels[landsound2], false); + OPENAL_3D_SetAttributes(channels[landsound2], gLoc, vel); + OPENAL_SetVolume(channels[landsound2], 128); + OPENAL_SetPaused(channels[landsound2], false); } terrainnormal=DoRotation(objects.model[k].facenormals[whichhit],0,objects.rotation[k],0)*-1; @@ -341,9 +342,9 @@ float Skeleton::DoConstraints(XYZ *coords,float *scale) vel[1]=joints[jointlabels[head]].velocity.y; vel[2]=joints[jointlabels[head]].velocity.z; PlaySoundEx( breaksound2, samp[breaksound2], NULL, true); - FSOUND_3D_SetAttributes(channels[breaksound2], gLoc, vel); - FSOUND_SetVolume(channels[breaksound2], 300); - FSOUND_SetPaused(channels[breaksound2], false); + OPENAL_3D_SetAttributes(channels[breaksound2], gLoc, vel); + OPENAL_SetVolume(channels[breaksound2], 300); + OPENAL_SetPaused(channels[breaksound2], false); envsound[numenvsounds]=*coords; envsoundvol[numenvsounds]=64; @@ -426,9 +427,9 @@ float Skeleton::DoConstraints(XYZ *coords,float *scale) vel[2]=joints[i].velocity.z; if(tutoriallevel!=1||id==0){ PlaySoundEx( landsound1, samp[landsound1], NULL, true); - FSOUND_3D_SetAttributes(channels[landsound1], gLoc, vel); - FSOUND_SetVolume(channels[landsound1], 128); - FSOUND_SetPaused(channels[landsound1], false); + OPENAL_3D_SetAttributes(channels[landsound1], gLoc, vel); + OPENAL_SetVolume(channels[landsound1], 128); + OPENAL_SetPaused(channels[landsound1], false); } breaking=1; } @@ -446,9 +447,9 @@ float Skeleton::DoConstraints(XYZ *coords,float *scale) vel[2]=joints[i].velocity.z; if(tutoriallevel!=1||id==0){ PlaySoundEx( landsound2, samp[landsound2], NULL, true); - FSOUND_3D_SetAttributes(channels[landsound2], gLoc, vel); - FSOUND_SetVolume(channels[landsound2], 128); - FSOUND_SetPaused(channels[landsound2], false); + OPENAL_3D_SetAttributes(channels[landsound2], gLoc, vel); + OPENAL_SetVolume(channels[landsound2], 128); + OPENAL_SetPaused(channels[landsound2], false); } } @@ -479,9 +480,9 @@ float Skeleton::DoConstraints(XYZ *coords,float *scale) vel[1]=joints[i].velocity.y; vel[2]=joints[i].velocity.z; PlaySoundEx( breaksound2, samp[breaksound2], NULL, true); - FSOUND_3D_SetAttributes(channels[breaksound2], gLoc, vel); - FSOUND_SetVolume(channels[breaksound2], 300); - FSOUND_SetPaused(channels[breaksound2], false); + OPENAL_3D_SetAttributes(channels[breaksound2], gLoc, vel); + OPENAL_SetVolume(channels[breaksound2], 300); + OPENAL_SetPaused(channels[breaksound2], false); envsound[numenvsounds]=*coords; envsoundvol[numenvsounds]=64; @@ -548,9 +549,9 @@ float Skeleton::DoConstraints(XYZ *coords,float *scale) vel[2]=joints[i].velocity.z; if(tutoriallevel!=1||id==0){ PlaySoundEx( landsound1, samp[landsound1], NULL, true); - FSOUND_3D_SetAttributes(channels[landsound1], gLoc, vel); - FSOUND_SetVolume(channels[landsound1], 128); - FSOUND_SetPaused(channels[landsound1], false); + OPENAL_3D_SetAttributes(channels[landsound1], gLoc, vel); + OPENAL_SetVolume(channels[landsound1], 128); + OPENAL_SetPaused(channels[landsound1], false); } breaking=1; } @@ -568,9 +569,9 @@ float Skeleton::DoConstraints(XYZ *coords,float *scale) vel[2]=joints[i].velocity.z; if(tutoriallevel!=1||id==0){ PlaySoundEx( landsound2, samp[landsound2], NULL, true); - FSOUND_3D_SetAttributes(channels[landsound2], gLoc, vel); - FSOUND_SetVolume(channels[landsound2], 128); - FSOUND_SetPaused(channels[landsound2], false); + OPENAL_3D_SetAttributes(channels[landsound2], gLoc, vel); + OPENAL_SetVolume(channels[landsound2], 128); + OPENAL_SetPaused(channels[landsound2], false); } } @@ -597,9 +598,9 @@ float Skeleton::DoConstraints(XYZ *coords,float *scale) vel[1]=joints[i].velocity.y; vel[2]=joints[i].velocity.z; PlaySoundEx( breaksound2, samp[breaksound2], NULL, true); - FSOUND_3D_SetAttributes(channels[breaksound2], gLoc, vel); - FSOUND_SetVolume(channels[breaksound2], 300); - FSOUND_SetPaused(channels[breaksound2], false); + OPENAL_3D_SetAttributes(channels[breaksound2], gLoc, vel); + OPENAL_SetVolume(channels[breaksound2], 300); + OPENAL_SetPaused(channels[breaksound2], false); envsound[numenvsounds]=*coords; envsoundvol[numenvsounds]=64; @@ -1016,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(); @@ -1025,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); /* @@ -1132,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(const char *filename, const char *lowfilename, const char *clothesfilename, + const char *modelfilename, const char *model2filename, + const char *model3filename, const char *model4filename, + const char *model5filename, const char *model6filename, + const char *model7filename, const char *modellowfilename, + const char *modelclothesfilename, bool aclothes) { static GLfloat M[16]; static int parentID; @@ -1144,6 +1153,7 @@ void Skeleton::Load(char *filename,char *lowfilename,char *clothesfilename, char LOGFUNC; + newload=0; num_models=7; @@ -1197,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); @@ -1284,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); @@ -1390,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];