]> git.jsancho.org Git - lugaru.git/commitdiff
Patched to compile on newer gcc.
authorRyan C. Gordon <icculus@icculus.org>
Wed, 19 Aug 2009 03:09:39 +0000 (23:09 -0400)
committerRyan C. Gordon <icculus@icculus.org>
Wed, 19 Aug 2009 03:09:39 +0000 (23:09 -0400)
Source/Objects.cpp
Source/Quaternions.cpp
makefile

index cc6008b409cf7389ccc68a5ffc16c9c0f274aaea..9bf8397e05b39ad95d55ef5e7ec67234a572790a 100644 (file)
@@ -97,26 +97,26 @@ void Objects::Draw()
                                                                if(type[i]==bushtype){
                                                                        messedwith[i]-=multiplier;
                                                                        if(rotxvel[i]||rotx[i]){
-                                                                               if(rotx[i]>0)rotxvel[i]-=multiplier*8*abs(rotx[i]);
-                                                                               if(rotx[i]<0)rotxvel[i]+=multiplier*8*abs(rotx[i]);
+                                                                               if(rotx[i]>0)rotxvel[i]-=multiplier*8*fabs(rotx[i]);
+                                                                               if(rotx[i]<0)rotxvel[i]+=multiplier*8*fabs(rotx[i]);
                                                                                if(rotx[i]>0)rotxvel[i]-=multiplier*4;
                                                                                if(rotx[i]<0)rotxvel[i]+=multiplier*4;
                                                                                if(rotxvel[i]>0)rotxvel[i]-=multiplier*4;
                                                                                if(rotxvel[i]<0)rotxvel[i]+=multiplier*4;
-                                                                               if(abs(rotx[i])<multiplier*4)rotx[i]=0;
-                                                                               if(abs(rotxvel[i])<multiplier*4)rotxvel[i]=0;
+                                                                               if(fabs(rotx[i])<multiplier*4)rotx[i]=0;
+                                                                               if(fabs(rotxvel[i])<multiplier*4)rotxvel[i]=0;
 
                                                                                rotx[i]+=rotxvel[i]*multiplier*4;
                                                                        }
                                                                        if(rotyvel[i]||roty[i]){
-                                                                               if(roty[i]>0)rotyvel[i]-=multiplier*8*abs(roty[i]);
-                                                                               if(roty[i]<0)rotyvel[i]+=multiplier*8*abs(roty[i]);
+                                                                               if(roty[i]>0)rotyvel[i]-=multiplier*8*fabs(roty[i]);
+                                                                               if(roty[i]<0)rotyvel[i]+=multiplier*8*fabs(roty[i]);
                                                                                if(roty[i]>0)rotyvel[i]-=multiplier*4;
                                                                                if(roty[i]<0)rotyvel[i]+=multiplier*4;
                                                                                if(rotyvel[i]>0)rotyvel[i]-=multiplier*4;
                                                                                if(rotyvel[i]<0)rotyvel[i]+=multiplier*4;
-                                                                               if(abs(roty[i])<multiplier*4)roty[i]=0;
-                                                                               if(abs(rotyvel[i])<multiplier*4)rotyvel[i]=0;
+                                                                               if(fabs(roty[i])<multiplier*4)roty[i]=0;
+                                                                               if(fabs(rotyvel[i])<multiplier*4)rotyvel[i]=0;
 
                                                                                roty[i]+=rotyvel[i]*multiplier*4;
                                                                        }
@@ -135,26 +135,26 @@ void Objects::Draw()
                                                                        if(type[i]==treetrunktype||environment==2){
                                                                                messedwith[i]-=multiplier;
                                                                                if(rotxvel[i]||rotx[i]){
-                                                                                       if(rotx[i]>0)rotxvel[i]-=multiplier*8*abs(rotx[i]);
-                                                                                       if(rotx[i]<0)rotxvel[i]+=multiplier*8*abs(rotx[i]);
+                                                                                       if(rotx[i]>0)rotxvel[i]-=multiplier*8*fabs(rotx[i]);
+                                                                                       if(rotx[i]<0)rotxvel[i]+=multiplier*8*fabs(rotx[i]);
                                                                                        if(rotx[i]>0)rotxvel[i]-=multiplier*4;
                                                                                        if(rotx[i]<0)rotxvel[i]+=multiplier*4;
                                                                                        if(rotxvel[i]>0)rotxvel[i]-=multiplier*4;
                                                                                        if(rotxvel[i]<0)rotxvel[i]+=multiplier*4;
-                                                                                       if(abs(rotx[i])<multiplier*4)rotx[i]=0;
-                                                                                       if(abs(rotxvel[i])<multiplier*4)rotxvel[i]=0;
+                                                                                       if(fabs(rotx[i])<multiplier*4)rotx[i]=0;
+                                                                                       if(fabs(rotxvel[i])<multiplier*4)rotxvel[i]=0;
 
                                                                                        rotx[i]+=rotxvel[i]*multiplier*4;
                                                                                }
                                                                                if(rotyvel[i]||roty[i]){
-                                                                                       if(roty[i]>0)rotyvel[i]-=multiplier*8*abs(roty[i]);
-                                                                                       if(roty[i]<0)rotyvel[i]+=multiplier*8*abs(roty[i]);
+                                                                                       if(roty[i]>0)rotyvel[i]-=multiplier*8*fabs(roty[i]);
+                                                                                       if(roty[i]<0)rotyvel[i]+=multiplier*8*fabs(roty[i]);
                                                                                        if(roty[i]>0)rotyvel[i]-=multiplier*4;
                                                                                        if(roty[i]<0)rotyvel[i]+=multiplier*4;
                                                                                        if(rotyvel[i]>0)rotyvel[i]-=multiplier*4;
                                                                                        if(rotyvel[i]<0)rotyvel[i]+=multiplier*4;
-                                                                                       if(abs(roty[i])<multiplier*4)roty[i]=0;
-                                                                                       if(abs(rotyvel[i])<multiplier*4)rotyvel[i]=0;
+                                                                                       if(fabs(roty[i])<multiplier*4)roty[i]=0;
+                                                                                       if(fabs(rotyvel[i])<multiplier*4)rotyvel[i]=0;
 
                                                                                        roty[i]+=rotyvel[i]*multiplier*4;
                                                                                }
@@ -173,26 +173,26 @@ void Objects::Draw()
                                                                        {
                                                                                messedwith[i]-=multiplier;
                                                                                if(rotxvel[i]||rotx[i]){
-                                                                                       if(rotx[i]>0)rotxvel[i]-=multiplier*8*abs(rotx[i]);
-                                                                                       if(rotx[i]<0)rotxvel[i]+=multiplier*8*abs(rotx[i]);
+                                                                                       if(rotx[i]>0)rotxvel[i]-=multiplier*8*fabs(rotx[i]);
+                                                                                       if(rotx[i]<0)rotxvel[i]+=multiplier*8*fabs(rotx[i]);
                                                                                        if(rotx[i]>0)rotxvel[i]-=multiplier*4;
                                                                                        if(rotx[i]<0)rotxvel[i]+=multiplier*4;
                                                                                        if(rotxvel[i]>0)rotxvel[i]-=multiplier*4;
                                                                                        if(rotxvel[i]<0)rotxvel[i]+=multiplier*4;
-                                                                                       if(abs(rotx[i])<multiplier*4)rotx[i]=0;
-                                                                                       if(abs(rotxvel[i])<multiplier*4)rotxvel[i]=0;
+                                                                                       if(fabs(rotx[i])<multiplier*4)rotx[i]=0;
+                                                                                       if(fabs(rotxvel[i])<multiplier*4)rotxvel[i]=0;
 
                                                                                        rotx[i]+=rotxvel[i]*multiplier*4;
                                                                                }
                                                                                if(rotyvel[i]||roty[i]){
-                                                                                       if(roty[i]>0)rotyvel[i]-=multiplier*8*abs(roty[i]);
-                                                                                       if(roty[i]<0)rotyvel[i]+=multiplier*8*abs(roty[i]);
+                                                                                       if(roty[i]>0)rotyvel[i]-=multiplier*8*fabs(roty[i]);
+                                                                                       if(roty[i]<0)rotyvel[i]+=multiplier*8*fabs(roty[i]);
                                                                                        if(roty[i]>0)rotyvel[i]-=multiplier*4;
                                                                                        if(roty[i]<0)rotyvel[i]+=multiplier*4;
                                                                                        if(rotyvel[i]>0)rotyvel[i]-=multiplier*4;
                                                                                        if(rotyvel[i]<0)rotyvel[i]+=multiplier*4;
-                                                                                       if(abs(roty[i])<multiplier*4)roty[i]=0;
-                                                                                       if(abs(rotyvel[i])<multiplier*4)rotyvel[i]=0;
+                                                                                       if(fabs(roty[i])<multiplier*4)roty[i]=0;
+                                                                                       if(fabs(rotyvel[i])<multiplier*4)rotyvel[i]=0;
 
                                                                                        roty[i]+=rotyvel[i]*multiplier*4;
                                                                                }
@@ -324,26 +324,26 @@ void Objects::Draw()
                                                                if(type[i]==bushtype){
                                                                        messedwith[i]-=multiplier;
                                                                        if(rotxvel[i]||rotx[i]){
-                                                                               if(rotx[i]>0)rotxvel[i]-=multiplier*8*abs(rotx[i]);
-                                                                               if(rotx[i]<0)rotxvel[i]+=multiplier*8*abs(rotx[i]);
+                                                                               if(rotx[i]>0)rotxvel[i]-=multiplier*8*fabs(rotx[i]);
+                                                                               if(rotx[i]<0)rotxvel[i]+=multiplier*8*fabs(rotx[i]);
                                                                                if(rotx[i]>0)rotxvel[i]-=multiplier*4;
                                                                                if(rotx[i]<0)rotxvel[i]+=multiplier*4;
                                                                                if(rotxvel[i]>0)rotxvel[i]-=multiplier*4;
                                                                                if(rotxvel[i]<0)rotxvel[i]+=multiplier*4;
-                                                                               if(abs(rotx[i])<multiplier*4)rotx[i]=0;
-                                                                               if(abs(rotxvel[i])<multiplier*4)rotxvel[i]=0;
+                                                                               if(fabs(rotx[i])<multiplier*4)rotx[i]=0;
+                                                                               if(fabs(rotxvel[i])<multiplier*4)rotxvel[i]=0;
 
                                                                                rotx[i]+=rotxvel[i]*multiplier*4;
                                                                        }
                                                                        if(rotyvel[i]||roty[i]){
-                                                                               if(roty[i]>0)rotyvel[i]-=multiplier*8*abs(roty[i]);
-                                                                               if(roty[i]<0)rotyvel[i]+=multiplier*8*abs(roty[i]);
+                                                                               if(roty[i]>0)rotyvel[i]-=multiplier*8*fabs(roty[i]);
+                                                                               if(roty[i]<0)rotyvel[i]+=multiplier*8*fabs(roty[i]);
                                                                                if(roty[i]>0)rotyvel[i]-=multiplier*4;
                                                                                if(roty[i]<0)rotyvel[i]+=multiplier*4;
                                                                                if(rotyvel[i]>0)rotyvel[i]-=multiplier*4;
                                                                                if(rotyvel[i]<0)rotyvel[i]+=multiplier*4;
-                                                                               if(abs(roty[i])<multiplier*4)roty[i]=0;
-                                                                               if(abs(rotyvel[i])<multiplier*4)rotyvel[i]=0;
+                                                                               if(fabs(roty[i])<multiplier*4)roty[i]=0;
+                                                                               if(fabs(rotyvel[i])<multiplier*4)rotyvel[i]=0;
 
                                                                                roty[i]+=rotyvel[i]*multiplier*4;
                                                                        }
@@ -361,26 +361,26 @@ void Objects::Draw()
                                                                if(type[i]==treetrunktype||type[i]==treeleavestype){
                                                                        messedwith[i]-=multiplier;
                                                                        if(rotxvel[i]||rotx[i]){
-                                                                               if(rotx[i]>0)rotxvel[i]-=multiplier*8*abs(rotx[i]);
-                                                                               if(rotx[i]<0)rotxvel[i]+=multiplier*8*abs(rotx[i]);
+                                                                               if(rotx[i]>0)rotxvel[i]-=multiplier*8*fabs(rotx[i]);
+                                                                               if(rotx[i]<0)rotxvel[i]+=multiplier*8*fabs(rotx[i]);
                                                                                if(rotx[i]>0)rotxvel[i]-=multiplier*4;
                                                                                if(rotx[i]<0)rotxvel[i]+=multiplier*4;
                                                                                if(rotxvel[i]>0)rotxvel[i]-=multiplier*4;
                                                                                if(rotxvel[i]<0)rotxvel[i]+=multiplier*4;
-                                                                               if(abs(rotx[i])<multiplier*4)rotx[i]=0;
-                                                                               if(abs(rotxvel[i])<multiplier*4)rotxvel[i]=0;
+                                                                               if(fabs(rotx[i])<multiplier*4)rotx[i]=0;
+                                                                               if(fabs(rotxvel[i])<multiplier*4)rotxvel[i]=0;
 
                                                                                rotx[i]+=rotxvel[i]*multiplier*4;
                                                                        }
                                                                        if(rotyvel[i]||roty[i]){
-                                                                               if(roty[i]>0)rotyvel[i]-=multiplier*8*abs(roty[i]);
-                                                                               if(roty[i]<0)rotyvel[i]+=multiplier*8*abs(roty[i]);
+                                                                               if(roty[i]>0)rotyvel[i]-=multiplier*8*fabs(roty[i]);
+                                                                               if(roty[i]<0)rotyvel[i]+=multiplier*8*fabs(roty[i]);
                                                                                if(roty[i]>0)rotyvel[i]-=multiplier*4;
                                                                                if(roty[i]<0)rotyvel[i]+=multiplier*4;
                                                                                if(rotyvel[i]>0)rotyvel[i]-=multiplier*4;
                                                                                if(rotyvel[i]<0)rotyvel[i]+=multiplier*4;
-                                                                               if(abs(roty[i])<multiplier*4)roty[i]=0;
-                                                                               if(abs(rotyvel[i])<multiplier*4)rotyvel[i]=0;
+                                                                               if(fabs(roty[i])<multiplier*4)roty[i]=0;
+                                                                               if(fabs(rotyvel[i])<multiplier*4)rotyvel[i]=0;
 
                                                                                roty[i]+=rotyvel[i]*multiplier*4;
                                                                        }
@@ -467,7 +467,7 @@ void Objects::DeleteObject(int which)
 void Objects::MakeObject(int atype, XYZ where, float arotation, float ascale){
        if((atype!=treeleavestype&&atype!=bushtype)||foliage==1){
                scale[numobjects]=ascale;
-               if(atype==treeleavestype)scale[numobjects]+=abs((float)(Random()%100)/900)*ascale;
+               if(atype==treeleavestype)scale[numobjects]+=fabs((float)(Random()%100)/900)*ascale;
 
                onfire[numobjects]=0;
                flamedelay[numobjects]=0;
@@ -550,7 +550,7 @@ void Objects::MakeObject(int atype, XYZ where, float arotation, float ascale){
 void Objects::MakeObject(int atype, XYZ where, float arotation, float arotation2, float ascale){
        if((atype!=treeleavestype&&atype!=bushtype)||foliage==1){
                scale[numobjects]=ascale;
-               if(atype==treeleavestype)scale[numobjects]+=abs((float)(Random()%100)/900)*ascale;
+               if(atype==treeleavestype)scale[numobjects]+=fabs((float)(Random()%100)/900)*ascale;
 
                onfire[numobjects]=0;
                flamedelay[numobjects]=0;
@@ -597,7 +597,7 @@ void Objects::MakeObject(int atype, XYZ where, float arotation, float arotation2
                if(atype==treetrunktype)friction[numobjects]=.4;
                if(atype==treeleavestype)friction[numobjects]=0;
 
-               if(friction[numobjects]==1.5&&abs(arotation2)>5)friction[numobjects]=.5;
+               if(friction[numobjects]==1.5&&fabs(arotation2)>5)friction[numobjects]=.5;
 
                if(atype==platformtype){
                        model[numobjects].loaddecal((char *)":Data:Models:Platform.solid",0);
index 11704141d2d5f01390835f1cbfa84fdb0a1ddf21..43ab061fa5ca098ba25efe269f438ddb666d510f 100644 (file)
@@ -275,7 +275,7 @@ bool LineFacet(Vector p1,Vector p2,Vector pa,Vector pb,Vector pc,Vector *p)
 
        //Calculate the position on the line that intersects the plane 
        denom = n.x * (p2.x - p1.x) + n.y * (p2.y - p1.y) + n.z * (p2.z - p1.z);
-       if (abs(denom) < 0.0000001)        // Line and plane don't intersect 
+       if (fabs(denom) < 0.0000001)        // Line and plane don't intersect 
                return 0;
        mu = - (d + n.x * p1.x + n.y * p1.y + n.z * p1.z) / denom;
        p->x = p1.x + mu * (p2.x - p1.x);
@@ -382,7 +382,7 @@ bool LineFacet(XYZ p1,XYZ p2,XYZ pa,XYZ pb,XYZ pc,XYZ *p)
 
        //Calculate the position on the line that intersects the plane 
        denom = n.x * (p2.x - p1.x) + n.y * (p2.y - p1.y) + n.z * (p2.z - p1.z);
-       if (abs(denom) < 0.0000001)        // Line and plane don't intersect 
+       if (fabs(denom) < 0.0000001)        // Line and plane don't intersect 
                return 0;
        mu = - (d + n.x * p1.x + n.y * p1.y + n.z * p1.z) / denom;
        p->x = p1.x + mu * (p2.x - p1.x);
@@ -412,7 +412,7 @@ float LineFacetd(XYZ p1,XYZ p2,XYZ pa,XYZ pb,XYZ pc,XYZ *p)
 
        //Calculate the position on the line that intersects the plane 
        denom = n.x * (p2.x - p1.x) + n.y * (p2.y - p1.y) + n.z * (p2.z - p1.z);
-       if (abs(denom) < 0.0000001)        // Line and plane don't intersect 
+       if (fabs(denom) < 0.0000001)        // Line and plane don't intersect 
                return 0;
        mu = - (d + n.x * p1.x + n.y * p1.y + n.z * p1.z) / denom;
        p->x = p1.x + mu * (p2.x - p1.x);
@@ -438,7 +438,7 @@ float LineFacetd(XYZ p1,XYZ p2,XYZ pa,XYZ pb,XYZ pc, XYZ n, XYZ *p)
 
        //Calculate the position on the line that intersects the plane 
        denom = n.x * (p2.x - p1.x) + n.y * (p2.y - p1.y) + n.z * (p2.z - p1.z);
-       if (abs(denom) < 0.0000001)        // Line and plane don't intersect 
+       if (fabs(denom) < 0.0000001)        // Line and plane don't intersect 
                return 0;
        mu = - (d + n.x * p1.x + n.y * p1.y + n.z * p1.z) / denom;
        p->x = p1.x + mu * (p2.x - p1.x);
@@ -468,7 +468,7 @@ float LineFacetd(XYZ *p1,XYZ *p2,XYZ *pa,XYZ *pb,XYZ *pc, XYZ *p)
 
        //Calculate the position on the line that intersects the plane 
        denom = n.x * (p2->x - p1->x) + n.y * (p2->y - p1->y) + n.z * (p2->z - p1->z);
-       if (abs(denom) < 0.0000001)        // Line and plane don't intersect 
+       if (fabs(denom) < 0.0000001)        // Line and plane don't intersect 
                return 0;
        mu = - (d + n.x * p1->x + n.y * p1->y + n.z * p1->z) / denom;
        p->x = p1->x + mu * (p2->x - p1->x);
@@ -493,7 +493,7 @@ float LineFacetd(XYZ *p1,XYZ *p2,XYZ *pa,XYZ *pb,XYZ *pc, XYZ *n, XYZ *p)
 
        //Calculate the position on the line that intersects the plane 
        denom = n->x * (p2->x - p1->x) + n->y * (p2->y - p1->y) + n->z * (p2->z - p1->z);
-       if (abs(denom) < 0.0000001)        // Line and plane don't intersect 
+       if (fabs(denom) < 0.0000001)        // Line and plane don't intersect 
                return 0;
        mu = - (d + n->x * p1->x + n->y * p1->y + n->z * p1->z) / denom;
        p->x = p1->x + mu * (p2->x - p1->x);
index 5c0270b0e7db982a86b23fd5cbe8b98f738802f1..2e74c4f2bb11d79408beb210e1eb722c5f69cac9 100644 (file)
--- a/makefile
+++ b/makefile
@@ -40,6 +40,7 @@ DEFINES := \
        -DTRUE=1 \
        -DFALSE=0 \
        -Dstricmp=strcasecmp \
+       -DBinIO_STDINT_HEADER="<stdint.h>" \
 
 INCLUDES := \
                        -I$(SRCDIR) \