]> git.jsancho.org Git - lugaru.git/commitdiff
Removed unused methods
authorCôme Chilliet <come@chilliet.eu>
Wed, 23 Nov 2016 16:23:33 +0000 (00:23 +0800)
committerCôme Chilliet <come@chilliet.eu>
Wed, 23 Nov 2016 16:23:33 +0000 (00:23 +0800)
Note: I left some unused methods just in case:
Input.cpp::CharToKey
Quaternions.cpp::Quat_Mult
Quaternions.cpp::To_Quat
Quaternions.cpp::Quat_2_Matrix
Quaternions.cpp::Quat_2_AA
Quaternions.cpp::Quat2Vector
Models.cpp::loadraw
Models.cpp::Translate
Sprite.cpp::clearTextures
GameTick.cpp::getEndX
GameTick.cpp::getEndY
pack.c::packf
pack.c::spackf
unpack.c::sunpackf
unpack.c::unpackf

Source/Lights.cpp
Source/Lights.h
Source/Models.cpp
Source/Models.h
Source/OpenGL_Windows.cpp
Source/Terrain.cpp
Source/Terrain.h
Source/openal_wrapper.cpp
Source/openal_wrapper.h

index d3437ee3ba706ccaf56438758f23e7168bf37605..f7e9d753858275a9f60e6310d37e5eb94d5852df 100644 (file)
@@ -70,22 +70,3 @@ void SetUpLight(Light* whichsource, int whichlight)
 
     }
 }
-
-void SetUpMainLight(Light* whichsource, int whichlight, float ambientr, float ambientg, float ambientb)
-{
-    static float qattenuation[] = {0.0f};
-
-    //Initialize lights
-
-    if (whichlight == 0) {
-        GLfloat LightAmbient[] = { ambientr, ambientg, ambientb, 1.0f};
-        GLfloat LightDiffuse[] = { whichsource->color[0], whichsource->color[1], whichsource->color[2], 1.0f };
-        GLfloat LightPosition[] = { whichsource->location.x, whichsource->location.y, whichsource->location.z, 1.0f };
-
-        glLightfv(GL_LIGHT0, GL_QUADRATIC_ATTENUATION, qattenuation);
-        glLightfv(GL_LIGHT0, GL_POSITION, LightPosition);
-        glLightfv(GL_LIGHT0, GL_AMBIENT, LightAmbient);
-        glLightfv(GL_LIGHT0, GL_DIFFUSE, LightDiffuse);
-        glEnable(GL_LIGHT0);
-    }
-}
index b4a1b2fb2bfd160575fb9edbd5d9824e7c46a537..f07bb8683cd8b74c7208d1d3e2d8cf7cff221758 100644 (file)
@@ -44,7 +44,6 @@ public:
     }
 };
 
-void SetUpMainLight(Light* whichsource, int whichlight, float ambientr, float ambientg, float ambientb);
 void SetUpLight(Light* whichsource, int whichlight);
 
 #endif
index f6a2a9164e636618eef72a9a892e942397839c94..0b8105396bd4f00204e73440c319a0783707d65f 100644 (file)
@@ -64,43 +64,6 @@ int Model::LineCheck(XYZ *p1, XYZ *p2, XYZ *p, XYZ *move, float *rotate)
     return firstintersecting;
 }
 
-int Model::LineCheckSlide(XYZ *p1, XYZ *p2, XYZ *p, XYZ *move, float *rotate)
-{
-    static int j;
-    static float distance;
-    static float olddistance;
-    static int intersecting;
-    static int firstintersecting;
-    static XYZ point;
-
-    *p1 = *p1 - *move;
-    *p2 = *p2 - *move;
-    if (!sphere_line_intersection(p1, p2, &boundingspherecenter, &boundingsphereradius))
-        return -1;
-    firstintersecting = -1;
-    if (*rotate)
-        *p1 = DoRotation(*p1, 0, -*rotate, 0);
-    if (*rotate)
-        *p2 = DoRotation(*p2, 0, -*rotate, 0);
-
-    for (j = 0; j < TriangleNum; j++) {
-        intersecting = LineFacetd(p1, p2, &vertex[Triangles[j].vertex[0]], &vertex[Triangles[j].vertex[1]], &vertex[Triangles[j].vertex[2]], &facenormals[j], &point);
-        distance = (point.x - p1->x) * (point.x - p1->x) + (point.y - p1->y) * (point.y - p1->y) + (point.z - p1->z) * (point.z - p1->z);
-        if ((distance < olddistance || firstintersecting == -1) && intersecting) {
-            olddistance = distance;
-            firstintersecting = j;
-        }
-    }
-
-    distance = abs((facenormals[firstintersecting].x * p2->x) + (facenormals[firstintersecting].y * p2->y) + (facenormals[firstintersecting].z * p2->z) - ((facenormals[firstintersecting].x * vertex[Triangles[firstintersecting].vertex[0]].x) + (facenormals[firstintersecting].y * vertex[Triangles[firstintersecting].vertex[0]].y) + (facenormals[firstintersecting].z * vertex[Triangles[firstintersecting].vertex[0]].z)));
-    *p2 -= facenormals[firstintersecting] * distance;
-
-    if (*rotate)
-        *p2 = DoRotation(*p2, 0, *rotate, 0);
-    *p2 = *p2 + *move;
-    return firstintersecting;
-}
-
 int Model::LineCheckPossible(XYZ *p1, XYZ *p2, XYZ *p, XYZ *move, float *rotate)
 {
     static int j;
@@ -1027,7 +990,6 @@ void Model::drawdifftex(GLuint texture)
         glDisableClientState(GL_COLOR_ARRAY);
     glDisableClientState(GL_VERTEX_ARRAY);
     glDisableClientState(GL_TEXTURE_COORD_ARRAY);
-    //drawdiffteximmediate(texture);
 }
 
 void Model::drawdifftex(Texture texture)
@@ -1060,49 +1022,6 @@ void Model::drawdifftex(Texture texture)
         glDisableClientState(GL_COLOR_ARRAY);
     glDisableClientState(GL_VERTEX_ARRAY);
     glDisableClientState(GL_TEXTURE_COORD_ARRAY);
-    //drawdiffteximmediate(texture);
-}
-
-void Model::drawdiffteximmediate(GLuint texture)
-{
-    glBindTexture(GL_TEXTURE_2D, (unsigned long)texture);
-
-    glBegin(GL_TRIANGLES);
-    for (int i = 0; i < TriangleNum; i++) {
-        /*if(Triangles[i].vertex[0]<vertexNum&&Triangles[i].vertex[1]<vertexNum&&Triangles[i].vertex[2]<vertexNum&&Triangles[i].vertex[0]>=0&&Triangles[i].vertex[1]>=0&&Triangles[i].vertex[2]>=0){
-        if(isnormal(vertex[Triangles[i].vertex[0]].x)&&isnormal(vertex[Triangles[i].vertex[0]].y)&&isnormal(vertex[Triangles[i].vertex[0]].z)
-        &&isnormal(vertex[Triangles[i].vertex[1]].x)&&isnormal(vertex[Triangles[i].vertex[1]].y)&&isnormal(vertex[Triangles[i].vertex[1]].z)
-        &&isnormal(vertex[Triangles[i].vertex[2]].x)&&isnormal(vertex[Triangles[i].vertex[2]].y)&&isnormal(vertex[Triangles[i].vertex[2]].z)){
-        */glTexCoord2f(Triangles[i].gx[0], Triangles[i].gy[0]);
-        if (color)
-            glColor3f(normals[Triangles[i].vertex[0]].x, normals[Triangles[i].vertex[0]].y, normals[Triangles[i].vertex[0]].z);
-        if (!color && !flat)
-            glNormal3f(normals[Triangles[i].vertex[0]].x, normals[Triangles[i].vertex[0]].y, normals[Triangles[i].vertex[0]].z);
-        if (!color && flat)
-            glNormal3f(facenormals[i].x, facenormals[i].y, facenormals[i].y);
-        glVertex3f(vertex[Triangles[i].vertex[0]].x, vertex[Triangles[i].vertex[0]].y, vertex[Triangles[i].vertex[0]].z);
-
-        glTexCoord2f(Triangles[i].gx[1], Triangles[i].gy[1]);
-        if (color)
-            glColor3f(normals[Triangles[i].vertex[1]].x, normals[Triangles[i].vertex[1]].y, normals[Triangles[i].vertex[1]].z);
-        if (!color && !flat)
-            glNormal3f(normals[Triangles[i].vertex[1]].x, normals[Triangles[i].vertex[1]].y, normals[Triangles[i].vertex[1]].z);
-        if (!color && flat)
-            glNormal3f(facenormals[i].x, facenormals[i].y, facenormals[i].y);
-        glVertex3f(vertex[Triangles[i].vertex[1]].x, vertex[Triangles[i].vertex[1]].y, vertex[Triangles[i].vertex[1]].z);
-
-        glTexCoord2f(Triangles[i].gx[2], Triangles[i].gy[2]);
-        if (color)
-            glColor3f(normals[Triangles[i].vertex[2]].x, normals[Triangles[i].vertex[2]].y, normals[Triangles[i].vertex[2]].z);
-        if (!color && !flat)
-            glNormal3f(normals[Triangles[i].vertex[2]].x, normals[Triangles[i].vertex[2]].y, normals[Triangles[i].vertex[2]].z);
-        if (!color && flat)
-            glNormal3f(facenormals[i].x, facenormals[i].y, facenormals[i].y);
-        glVertex3f(vertex[Triangles[i].vertex[2]].x, vertex[Triangles[i].vertex[2]].y, vertex[Triangles[i].vertex[2]].z);
-        //}
-        //}
-    }
-    glEnd();
 }
 
 void Model::drawdecals(Texture shadowtexture, Texture bloodtexture, Texture bloodtexture2, Texture breaktexture)
index 6cbb5c5d7a2e3d5d4b79c778a437eafb092765a9..a861acde1d29ce63c8f74c706255fdaea25b1c49 100644 (file)
@@ -121,7 +121,6 @@ public:
     int SphereCheck(XYZ *p1, float radius, XYZ *p, XYZ *move, float *rotate);
     int SphereCheckPossible(XYZ *p1, float radius, XYZ *move, float *rotate);
     int LineCheck(XYZ *p1, XYZ *p2, XYZ *p, XYZ *move, float *rotate);
-    int LineCheckSlide(XYZ *p1, XYZ *p2, XYZ *p, XYZ *move, float *rotate);
     int LineCheckPossible(XYZ *p1, XYZ *p2, XYZ *p, XYZ *move, float *rotate);
     int LineCheckSlidePossible(XYZ *p1, XYZ *p2, XYZ *p, XYZ *move, float *rotate);
     void UpdateVertexArray();
@@ -142,7 +141,6 @@ public:
     void drawdifftex(GLuint texture);
     void drawdifftex(Texture texture);
     void drawimmediate();
-    void drawdiffteximmediate(GLuint texture);
     void Rotate(float xang, float yang, float zang);
     ~Model();
     void deallocate();
index 6d684ba1d2cbe4e413aebc9264cf924459d2d065..8af915cb5a23810f1fec342d6e4f0a93dab019ec 100644 (file)
@@ -772,13 +772,6 @@ bool LoadImage(const char * fname, TGAImageRec & tex)
         return load_image(fname, tex);
 }
 
-void ScreenShot(const char * fname)
-{
-
-}
-
-
-
 static bool load_image(const char *file_name, TGAImageRec &tex)
 {
     const char *ptr = strrchr((char *)file_name, '.');
index ea3b8028eb55b369648a2cbe9f2c6d54afa82ba2..b0aff61581df56406c7c174de27d4fa09bf620cb 100644 (file)
@@ -889,75 +889,6 @@ float Terrain::getHeight(float pointx, float pointz)
     //return height1*(1-(pointz-tiley))*scale+height2*(pointz-tiley)*scale;
 }
 
-float Terrain::getHeightExtrude(float pointx, float pointz, float point2x, float point2z)
-{
-    static int tilex, tiley;
-    static XYZ startpoint, endpoint, intersect, triangle[3], average;
-
-    pointx /= scale;
-    pointz /= scale;
-    point2x /= scale;
-    point2z /= scale;
-
-    if (pointx >= size - 1 || pointz >= size - 1 || pointx <= 0 || pointz <= 0)
-        return 0;
-    if (point2x >= size - 1 || point2z >= size - 1 || point2x <= 0 || point2z <= 0)
-        return 0;
-
-    startpoint.x = point2x;
-    startpoint.y = -1000;
-    startpoint.z = point2z;
-
-    endpoint = startpoint;
-    endpoint.y = 1000;
-
-    tilex = pointx;
-    tiley = pointz;
-
-    triangle[0].x = tilex;
-    triangle[0].z = tiley;
-    triangle[0].y = heightmap[tilex][tiley];
-
-    triangle[1].x = tilex + 1;
-    triangle[1].z = tiley;
-    triangle[1].y = heightmap[tilex + 1][tiley];
-
-    triangle[2].x = tilex;
-    triangle[2].z = tiley + 1;
-    triangle[2].y = heightmap[tilex][tiley + 1];
-
-    XYZ mid;
-
-    mid = (triangle[0] + triangle[1] + triangle[2]) / 2;
-
-    triangle[0] = mid + (triangle[0] - mid) * 10;
-    triangle[1] = mid + (triangle[0] - mid) * 10;
-    triangle[2] = mid + (triangle[0] - mid) * 10;
-
-    /*
-    if(!LineFacetd(&startpoint,&endpoint,&triangle[0],&triangle[1],&triangle[2],&intersect)){
-    triangle[0].x=tilex+1;
-    triangle[0].z=tiley;
-    triangle[0].y=heightmap[tilex+1][tiley];
-
-    triangle[1].x=tilex+1;
-    triangle[1].z=tiley+1;
-    triangle[1].y=heightmap[tilex+1][tiley+1];
-
-    triangle[2].x=tilex;
-    triangle[2].z=tiley+1;
-    triangle[2].y=heightmap[tilex][tiley+1];
-    LineFacetd(&startpoint,&endpoint,&triangle[0],&triangle[1],&triangle[2],&intersect);
-    }*/
-    return intersect.y * scale + getOpacity(pointx * scale, pointz * scale) / 8;
-
-    //height1=heightmap[tilex][tiley]*(1-(pointx-tilex))+heightmap[tilex+1][tiley]*(pointx-tilex);
-    //height2=heightmap[tilex][tiley+1]*(1-(pointx-tilex))+heightmap[tilex+1][tiley+1]*(pointx-tilex);
-
-    //return height1*(1-(pointz-tiley))*scale+height2*(pointz-tiley)*scale;
-}
-
-
 float Terrain::getOpacity(float pointx, float pointz)
 {
     static float height1, height2;
@@ -1465,89 +1396,6 @@ void Terrain::MakeDecalLock(int type, XYZ where, int whichx, int whichy, float s
     }
 }
 
-void Terrain::DoLighting()
-{
-    static int i, j, k, todivide;
-    static float brightness, total;
-    static XYZ blank, terrainpoint, lightloc;
-    lightloc = light.location;
-    Normalise(&lightloc);
-    //Calculate shadows
-    for (i = 0; i < size; i++) {
-        for (j = 0; j < size; j++) {
-            terrainpoint.x = (float)i * scale;
-            terrainpoint.z = (float)j * scale;
-            terrainpoint.y = heightmap[i][j] * scale + .1;
-            /*brightness=0;
-            if(lineTerrain(lightlocation*10+terrainpoint,terrainpoint,&blank)==-1)
-            */
-            brightness = dotproduct(&lightloc, &normals[i][j]);
-
-            if (brightness > 1)
-                brightness = 1;
-            if (brightness < 0)
-                brightness = 0;
-
-            colors[i][j][0] = light.color[0] * brightness + light.ambient[0];
-            colors[i][j][1] = light.color[1] * brightness + light.ambient[1];
-            colors[i][j][2] = light.color[2] * brightness + light.ambient[2];
-
-            if (colors[i][j][0] > 1) colors[i][j][0] = 1;
-            if (colors[i][j][1] > 1) colors[i][j][1] = 1;
-            if (colors[i][j][2] > 1) colors[i][j][2] = 1;
-            if (colors[i][j][0] < 0) colors[i][j][0] = 0;
-            if (colors[i][j][1] < 0) colors[i][j][1] = 0;
-            if (colors[i][j][2] < 0) colors[i][j][2] = 0;
-        }
-    }
-
-    //Smooth shadows
-    for (i = 0; i < size; i++) {
-        for (j = 0; j < size; j++) {
-            for (k = 0; k < 3; k++) {
-                total = 0;
-                todivide = 0;
-                if (i != 0) {
-                    total += colors[j][i - 1][k];
-                    todivide++;
-                }
-                if (i != size - 1) {
-                    total += colors[j][i + 1][k];
-                    todivide++;
-                }
-                if (j != 0) {
-                    total += colors[j - 1][i][k];
-                    todivide++;
-                }
-                if (j != size - 1) {
-                    total += colors[j + 1][i][k];
-                    todivide++;
-                }
-                if (i != 0 && j != 0) {
-                    total += colors[j - 1][i - 1][k];
-                    todivide++;
-                }
-                if (i != size - 1 && j != 0) {
-                    total += colors[j - 1][i + 1][k];
-                    todivide++;
-                }
-                if (j != size - 1 && i != size - 1) {
-                    total += colors[j + 1][i + 1][k];
-                    todivide++;
-                }
-                if (j != size - 1 && i != 0) {
-                    total += colors[j + 1][i - 1][k];
-                    todivide++;
-                }
-                total += colors[j][i][k];
-                todivide++;
-
-                colors[j][i][k] = total / todivide;
-            }
-        }
-    }
-}
-
 void Terrain::DoShadows()
 {
     static int i, j, k, l, todivide;
index bc57ca061e52fbde0a4b4aa82e355f1dd7ef2067..9f919b485734d61456e227140b71c4c5dc3aae16 100644 (file)
@@ -109,7 +109,6 @@ public:
     void MakeDecalLock(int type, XYZ where, int whichx, int whichy, float size, float opacity, float rotation);
     int lineTerrain(XYZ p1, XYZ p2, XYZ *p);
     float getHeight(float pointx, float pointz);
-    float getHeightExtrude(float pointx, float pointz, float point2x, float point2z);
     float getOpacity(float pointx, float pointz);
     XYZ getLighting(float pointx, float pointz);
     XYZ getNormal(float pointx, float pointz);
@@ -124,7 +123,6 @@ public:
     void drawpatch(int whichx, int whichy, float opacity);
     void drawpatchother(int whichx, int whichy, float opacity);
     void drawpatchotherother(int whichx, int whichy, float opacity);
-    void DoLighting();
     void DoShadows();
 
     Terrain();
index 209ce1a0a4dc8a3be0f8292baa17db3c15289a7e..65fe055b8f23cca1cc1598420b2d43644f594a47 100644 (file)
@@ -528,11 +528,6 @@ AL_API signed char OPENAL_StopSound(int channel)
     return true;
 }
 
-AL_API void OPENAL_Stream_Close(OPENAL_STREAM *stream)
-{
-    OPENAL_Sample_Free((OPENAL_SAMPLE *) stream);
-}
-
 static OPENAL_SAMPLE *OPENAL_Stream_GetSample(OPENAL_STREAM *stream)
 {
     if (!initialized)
index 39f05eb96417695e6505c02eb5e3daa740e15fed..6b957302a96bf09b9fb723258ca8a00167bebb8b 100644 (file)
@@ -98,7 +98,6 @@ extern "C" {
     AL_API signed char OPENAL_SetPaused(int channel, signed char paused);
     AL_API void OPENAL_SetSFXMasterVolume(int volume);
     AL_API signed char OPENAL_StopSound(int channel);
-    AL_API void OPENAL_Stream_Close(OPENAL_STREAM *stream);
     AL_API signed char OPENAL_Stream_SetMode(OPENAL_STREAM *stream, unsigned int mode);
     AL_API void OPENAL_Update();
     AL_API signed char OPENAL_SetOutput(int outputtype);