- if(position.y<terrain.getHeight(position.x,position.z)){
- if(terrain.getOpacity(position.x,position.z)<.2){
- velocity=0;
- if(terrain.lineTerrain(oldposition,position,&colpoint)!=-1){
- position=colpoint*terrain.scale;
- }
- else position.y=terrain.getHeight(position.x,position.z);
-
- terrain.MakeDecal(shadowdecalpermanent,position,.06,.5,0);
- normalrot=terrain.getNormal(position.x,position.z)*-1;
- velocity=0;
- glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
- glPushMatrix();
- GLfloat M[16];
- glLoadIdentity();
- glRotatef(bigrotation,0,1,0);
- glRotatef(bigtilt2,1,0,0);
- glRotatef(bigtilt,0,0,1);
- glRotatef(-rotation1+90,0,1,0);
- glRotatef(-rotation2+90,0,0,1);
- glRotatef(-rotation3,0,1,0);
- glRotatef(smallrotation,1,0,0);
- glRotatef(smallrotation2,0,1,0);
- glTranslatef(0,0,1);
- glGetFloatv(GL_MODELVIEW_MATRIX,M);
- tippoint.x=M[12];
- tippoint.y=M[13];
- tippoint.z=M[14];
- glPopMatrix();
- position-=tippoint*.15;
- XYZ temppoint1,temppoint2,tempforward;
-
- rotation3=0;
- smallrotation=90;
- smallrotation2=0;
- bigtilt=0;
- bigtilt2=0;
- bigrotation=0;
-
- emit_sound_at(knifesheathesound, position, 128.);
-
- XYZ terrainlight;
- terrainlight=terrain.getLighting(position.x,position.z);
- if(environment==snowyenvironment){
- if(findDistancefast(&position,&viewer)<viewdistance*viewdistance/4)Sprite::MakeSprite(cloudsprite, position,velocity, terrainlight.x,terrainlight.y,terrainlight.z, .5, .7);
- }
- else if(environment==grassyenvironment){
- if(findDistancefast(&position,&viewer)<viewdistance*viewdistance/4)Sprite::MakeSprite(cloudsprite, position,velocity, terrainlight.x*90/255,terrainlight.y*70/255,terrainlight.z*8/255, .5, .5);
- }
- else if(environment==desertenvironment){
- if(findDistancefast(&position,&viewer)<viewdistance*viewdistance/4)Sprite::MakeSprite(cloudsprite, position,velocity, terrainlight.x*190/255,terrainlight.y*170/255,terrainlight.z*108/255, .5, .7);
- }