extern float gravity;
extern Skeleton testskeleton;
extern Terrain terrain;
-extern OPENAL_SAMPLE *samp[100];
extern int channels[100];
extern Objects objects;
extern int environment;
extern float envsoundvol[30];
extern int numenvsounds;
extern float envsoundlife[30];
-extern int bonus;
-extern float bonustime;
extern int tutoriallevel;
extern int whichjointstartarray[26];
if(joints[i].label==groin&&!joints[i].locked&&joints[i].delay<=0){
joints[i].locked=1;
joints[i].delay=1;
- static float gLoc[3];
- static float vel[3];
- gLoc[0]=joints[i].position.x*(*scale)+coords->x;
- gLoc[1]=joints[i].position.y*(*scale)+coords->y;
- gLoc[2]=joints[i].position.z*(*scale)+coords->z;
- vel[0]=joints[i].velocity.x;
- vel[1]=joints[i].velocity.y;
- vel[2]=joints[i].velocity.z;
if(tutoriallevel!=1||id==0){
- PlaySoundEx( landsound1, samp[landsound1], NULL, true);
- OPENAL_3D_SetAttributes(channels[landsound1], gLoc, vel);
- OPENAL_SetVolume(channels[landsound1], 128);
- OPENAL_SetPaused(channels[landsound1], false);
+ emit_sound_at(landsound1, joints[i].position*(*scale)+*coords, 128.);
}
breaking=1;
}
if(joints[i].label==head&&!joints[i].locked&&joints[i].delay<=0){
joints[i].locked=1;
joints[i].delay=1;
- static float gLoc[3];
- static float vel[3];
- gLoc[0]=joints[i].position.x*(*scale)+coords->x;
- gLoc[1]=joints[i].position.y*(*scale)+coords->y;
- gLoc[2]=joints[i].position.z*(*scale)+coords->z;
- vel[0]=joints[i].velocity.x;
- vel[1]=joints[i].velocity.y;
- vel[2]=joints[i].velocity.z;
if(tutoriallevel!=1||id==0){
- PlaySoundEx( landsound2, samp[landsound2], NULL, true);
- OPENAL_3D_SetAttributes(channels[landsound2], gLoc, vel);
- OPENAL_SetVolume(channels[landsound2], 128);
- OPENAL_SetPaused(channels[landsound2], false);
+ emit_sound_at(landsound2, joints[i].position*(*scale)+*coords, 128.);
}
}
breaking=0;
camerashake+=.6;
- static float gLoc[3];
- static float vel[3];
- gLoc[0]=joints[i].position.x*(*scale)+coords->x;
- gLoc[1]=joints[i].position.y*(*scale)+coords->y;
- gLoc[2]=joints[i].position.z*(*scale)+coords->z;
- vel[0]=joints[i].velocity.x;
- vel[1]=joints[i].velocity.y;
- vel[2]=joints[i].velocity.z;
- PlaySoundEx( breaksound2, samp[breaksound2], NULL, true);
- OPENAL_3D_SetAttributes(channels[breaksound2], gLoc, vel);
- OPENAL_SetVolume(channels[breaksound2], 300);
- OPENAL_SetPaused(channels[breaksound2], false);
+ emit_sound_at(breaksound2, joints[i].position*(*scale)+*coords);
envsound[numenvsounds]=*coords;
envsoundvol[numenvsounds]=64;
if(joints[i].label==groin&&!joints[i].locked&&joints[i].delay<=0){
joints[i].locked=1;
joints[i].delay=1;
- static float gLoc[3];
- static float vel[3];
- gLoc[0]=joints[i].position.x*(*scale)+coords->x;
- gLoc[1]=joints[i].position.y*(*scale)+coords->y;
- gLoc[2]=joints[i].position.z*(*scale)+coords->z;
- vel[0]=joints[i].velocity.x;
- vel[1]=joints[i].velocity.y;
- vel[2]=joints[i].velocity.z;
if(tutoriallevel!=1||id==0){
- PlaySoundEx( landsound1, samp[landsound1], NULL, true);
- OPENAL_3D_SetAttributes(channels[landsound1], gLoc, vel);
- OPENAL_SetVolume(channels[landsound1], 128);
- OPENAL_SetPaused(channels[landsound1], false);
+ emit_sound_at(landsound1, joints[i].position*(*scale)+*coords, 128.);
}
breaking=1;
}
if(joints[i].label==head&&!joints[i].locked&&joints[i].delay<=0){
joints[i].locked=1;
joints[i].delay=1;
- static float gLoc[3];
- static float vel[3];
- gLoc[0]=joints[i].position.x*(*scale)+coords->x;
- gLoc[1]=joints[i].position.y*(*scale)+coords->y;
- gLoc[2]=joints[i].position.z*(*scale)+coords->z;
- vel[0]=joints[i].velocity.x;
- vel[1]=joints[i].velocity.y;
- vel[2]=joints[i].velocity.z;
if(tutoriallevel!=1||id==0){
- PlaySoundEx( landsound2, samp[landsound2], NULL, true);
- OPENAL_3D_SetAttributes(channels[landsound2], gLoc, vel);
- OPENAL_SetVolume(channels[landsound2], 128);
- OPENAL_SetPaused(channels[landsound2], false);
+ emit_sound_at(landsound2, joints[i].position*(*scale)+*coords, 128.);
}
}
breaking=0;
camerashake+=.6;
- static float gLoc[3];
- static float vel[3];
- gLoc[0]=joints[i].position.x*(*scale)+coords->x;
- gLoc[1]=joints[i].position.y*(*scale)+coords->y;
- gLoc[2]=joints[i].position.z*(*scale)+coords->z;
- vel[0]=joints[i].velocity.x;
- vel[1]=joints[i].velocity.y;
- vel[2]=joints[i].velocity.z;
- PlaySoundEx( breaksound2, samp[breaksound2], NULL, true);
- OPENAL_3D_SetAttributes(channels[breaksound2], gLoc, vel);
- OPENAL_SetVolume(channels[breaksound2], 300);
- OPENAL_SetPaused(channels[breaksound2], false);
+ emit_sound_at(breaksound2, joints[i].position*(*scale)+*coords);
envsound[numenvsounds]=*coords;
envsoundvol[numenvsounds]=64;
if(!isnormal(muscles[which].rotate3))muscles[which].rotate3=0;
}
-void Animation::Load(char *filename, int aheight, int aattack)
+void Animation::Load(const char *filename, int aheight, int aattack)
{
static FILE *tfile;
static int i,j;
static XYZ startoffset,endoffset;
static int howmany;
+ static const char *anim_prefix = ":Data:Animations:";
+
+
LOGFUNC;
+ int len = strlen(anim_prefix) + strlen(filename);
+ char *buf = new char[len + 1];
+ snprintf(buf, len + 1, "%s%s", anim_prefix, filename);
// Changing the filename into something the OS can understand
- char *fixedFN = ConvertFileName(filename);
+ char *fixedFN = ConvertFileName(buf);
+ delete[] buf;
LOG(std::string("Loading animation...") + fixedFN);