Rename "AATriangle::DEFORM[1234]" to more meaningfull names.
authorflorianf <florianf@837edb03-e0f3-0310-88ca-d4d4e8b29345>
Thu, 11 Mar 2010 08:11:10 +0000 (08:11 +0000)
committerflorianf <florianf@837edb03-e0f3-0310-88ca-d4d4e8b29345>
Thu, 11 Mar 2010 08:11:10 +0000 (08:11 +0000)
They are named now:
  AATriangle::DEFORM_TOP
  AATriangle::DEFORM_BOTTOM
  AATriangle::DEFORM_LEFT
  AATriangle::DEFORM_RIGHT

git-svn-id: http://supertux.lethargik.org/svn/supertux/trunk/supertux@6592 837edb03-e0f3-0310-88ca-d4d4e8b29345

src/math/aatriangle.cpp
src/math/aatriangle.hpp
src/supertux/collision.cpp
src/supertux/sector.cpp

index 815e58d..d846bed 100644 (file)
@@ -24,11 +24,11 @@ int AATriangle::vertical_flip(int dir) {
   direction = 3 - direction;
   int deform = dir & AATriangle::DEFORM_MASK;
   switch (deform) {
-    case AATriangle::DEFORM1:
-      deform = AATriangle::DEFORM2;
+    case AATriangle::DEFORM_BOTTOM:
+      deform = AATriangle::DEFORM_TOP;
       break;
-    case AATriangle::DEFORM2:
-      deform = AATriangle::DEFORM1;
+    case AATriangle::DEFORM_TOP:
+      deform = AATriangle::DEFORM_BOTTOM;
       break;
     default:
       // unchanged
index db0ca5d..228c1e2 100644 (file)
@@ -42,10 +42,10 @@ public:
     SOUTHEAST,
     NORTHWEST,
     DIRECTION_MASK = 0x0003,
-    DEFORM1 = 0x0010,
-    DEFORM2 = 0x0020,
-    DEFORM3 = 0x0030,
-    DEFORM4 = 0x0040,
+    DEFORM_BOTTOM = 0x0010,
+    DEFORM_TOP = 0x0020,
+    DEFORM_LEFT = 0x0030,
+    DEFORM_RIGHT = 0x0040,
     DEFORM_MASK = 0x0070
   };
 
index b45065c..99282fa 100644 (file)
@@ -62,19 +62,19 @@ bool rectangle_aatriangle(Constraints* constraints, const Rectf& rect,
       area.p1 = triangle.bbox.p1;
       area.p2 = triangle.bbox.p2;
       break;
-    case AATriangle::DEFORM1:
+    case AATriangle::DEFORM_BOTTOM:
       area.p1 = Vector(triangle.bbox.p1.x, triangle.bbox.p1.y + triangle.bbox.get_height()/2);
       area.p2 = triangle.bbox.p2;
       break;
-    case AATriangle::DEFORM2:
+    case AATriangle::DEFORM_TOP:
       area.p1 = triangle.bbox.p1;
       area.p2 = Vector(triangle.bbox.p2.x, triangle.bbox.p1.y + triangle.bbox.get_height()/2);
       break;
-    case AATriangle::DEFORM3:
+    case AATriangle::DEFORM_LEFT:
       area.p1 = triangle.bbox.p1;
       area.p2 = Vector(triangle.bbox.p1.x + triangle.bbox.get_width()/2, triangle.bbox.p2.y);
       break;
-    case AATriangle::DEFORM4:
+    case AATriangle::DEFORM_RIGHT:
       area.p1 = Vector(triangle.bbox.p1.x + triangle.bbox.get_width()/2, triangle.bbox.p1.y);
       area.p2 = triangle.bbox.p2;
       break;
index cffda6b..ecb7bab 100644 (file)
 #include "trigger/sequence_trigger.hpp"
 #include "util/file_system.hpp"
 
-#define DEFORM_BOTTOM  AATriangle::DEFORM1
-#define DEFORM_TOP     AATriangle::DEFORM2
-#define DEFORM_LEFT    AATriangle::DEFORM3
-#define DEFORM_RIGHT   AATriangle::DEFORM4
-
 Sector* Sector::_current = 0;
 
 bool Sector::show_collrects = false;
@@ -1033,11 +1028,11 @@ int check_movement_unisolid (Vector movement, const Tile* tile)
 
   /* determine tangent of the slope */
   slope_tan = 1.0;
-  if (((slope_info & AATriangle::DEFORM_MASK) == DEFORM_BOTTOM)
-      || ((slope_info & AATriangle::DEFORM_MASK) == DEFORM_TOP))
+  if (((slope_info & AATriangle::DEFORM_MASK) == AATriangle::DEFORM_BOTTOM)
+      || ((slope_info & AATriangle::DEFORM_MASK) == AATriangle::DEFORM_TOP))
     slope_tan = 0.5; /* ~= 26.6 deg */
-  else if (((slope_info & AATriangle::DEFORM_MASK) == DEFORM_LEFT)
-      || ((slope_info & AATriangle::DEFORM_MASK) == DEFORM_RIGHT))
+  else if (((slope_info & AATriangle::DEFORM_MASK) == AATriangle::DEFORM_LEFT)
+      || ((slope_info & AATriangle::DEFORM_MASK) == AATriangle::DEFORM_RIGHT))
     slope_tan = 2.0; /* ~= 63.4 deg */
 
   /* up and right */
@@ -1120,40 +1115,40 @@ int check_position_unisolid (const Rectf& obj_bbox,
       & (AATriangle::DIRECTION_MASK | AATriangle::DEFORM_MASK))
   {
     case AATriangle::SOUTHWEST:
-    case AATriangle::SOUTHWEST | DEFORM_TOP:
-    case AATriangle::SOUTHWEST | DEFORM_LEFT:
+    case AATriangle::SOUTHWEST | AATriangle::DEFORM_TOP:
+    case AATriangle::SOUTHWEST | AATriangle::DEFORM_LEFT:
     case AATriangle::NORTHEAST:
-    case AATriangle::NORTHEAST | DEFORM_TOP:
-    case AATriangle::NORTHEAST | DEFORM_LEFT:
+    case AATriangle::NORTHEAST | AATriangle::DEFORM_TOP:
+    case AATriangle::NORTHEAST | AATriangle::DEFORM_LEFT:
       tile_x = tile_bbox.get_left ();
       tile_y = tile_bbox.get_top ();
       gradient = 1.0;
       break;
 
     case AATriangle::SOUTHEAST:
-    case AATriangle::SOUTHEAST | DEFORM_TOP:
-    case AATriangle::SOUTHEAST | DEFORM_RIGHT:
+    case AATriangle::SOUTHEAST | AATriangle::DEFORM_TOP:
+    case AATriangle::SOUTHEAST | AATriangle::DEFORM_RIGHT:
     case AATriangle::NORTHWEST:
-    case AATriangle::NORTHWEST | DEFORM_TOP:
-    case AATriangle::NORTHWEST | DEFORM_RIGHT:
+    case AATriangle::NORTHWEST | AATriangle::DEFORM_TOP:
+    case AATriangle::NORTHWEST | AATriangle::DEFORM_RIGHT:
       tile_x = tile_bbox.get_right ();
       tile_y = tile_bbox.get_top ();
       gradient = -1.0;
       break;
 
-    case AATriangle::SOUTHEAST | DEFORM_BOTTOM:
-    case AATriangle::SOUTHEAST | DEFORM_LEFT:
-    case AATriangle::NORTHWEST | DEFORM_BOTTOM:
-    case AATriangle::NORTHWEST | DEFORM_LEFT:
+    case AATriangle::SOUTHEAST | AATriangle::DEFORM_BOTTOM:
+    case AATriangle::SOUTHEAST | AATriangle::DEFORM_LEFT:
+    case AATriangle::NORTHWEST | AATriangle::DEFORM_BOTTOM:
+    case AATriangle::NORTHWEST | AATriangle::DEFORM_LEFT:
       tile_x = tile_bbox.get_left ();
       tile_y = tile_bbox.get_bottom ();
       gradient = -1.0;
       break;
 
-    case AATriangle::SOUTHWEST | DEFORM_BOTTOM:
-    case AATriangle::SOUTHWEST | DEFORM_RIGHT:
-    case AATriangle::NORTHEAST | DEFORM_BOTTOM:
-    case AATriangle::NORTHEAST | DEFORM_RIGHT:
+    case AATriangle::SOUTHWEST | AATriangle::DEFORM_BOTTOM:
+    case AATriangle::SOUTHWEST | AATriangle::DEFORM_RIGHT:
+    case AATriangle::NORTHEAST | AATriangle::DEFORM_BOTTOM:
+    case AATriangle::NORTHEAST | AATriangle::DEFORM_RIGHT:
       tile_x = tile_bbox.get_right ();
       tile_y = tile_bbox.get_bottom ();
       gradient = 1.0;
@@ -1209,15 +1204,15 @@ int check_position_unisolid (const Rectf& obj_bbox,
       delta_y *= .70710678118654752440; /* 1/sqrt(2) */
       break;
 
-    case DEFORM_BOTTOM:
-    case DEFORM_TOP:
+    case AATriangle::DEFORM_BOTTOM:
+    case AATriangle::DEFORM_TOP:
       delta_x *= .44721359549995793928; /* 1/sqrt(5) */
       delta_y *= .89442719099991587856; /* 2/sqrt(5) */
       gradient *= 0.5;
       break;
 
-    case DEFORM_LEFT:
-    case DEFORM_RIGHT:
+    case AATriangle::DEFORM_LEFT:
+    case AATriangle::DEFORM_RIGHT:
       delta_x *= .89442719099991587856; /* 2/sqrt(5) */
       delta_y *= .44721359549995793928; /* 1/sqrt(5) */
       gradient *= 2.0;