foxygit / doom Log in
commit 1011b3bd314e515e6357df8b5b77d33a2528ae34
Author:     James Haley <haleyjd@hotmail.com>
AuthorDate: Sun Feb 10 18:34:41 2013 +0000
Commit:     James Haley <haleyjd@hotmail.com>
CommitDate: Sun Feb 10 18:34:41 2013 +0000

    * Made formatting consistent in T_MovePlane so code could be read
    * Fixed an error in the translation of T_MovePlane changes; floors
      moving up SHOULD test crush == true before calling P_ChangeSector
      again.

    Subversion-branch: /branches/v2-branch
    Subversion-revision: 2559
---
 src/strife/p_floor.c | 283 ++++++++++++++++++++++++++-------------------------
 1 file changed, 143 insertions(+), 140 deletions(-)

diff --git a/src/strife/p_floor.c b/src/strife/p_floor.c
index df966d28..31f2a7cf 100644
--- a/src/strife/p_floor.c
+++ b/src/strife/p_floor.c
@@ -46,167 +46,170 @@
 //
 // Move a plane (floor or ceiling) and check for crushing
 //
+// [STRIFE] Various changes were made to remove calls to P_ChangeSector when
+// P_ChangeSector returns true.
+//
 result_e
 T_MovePlane
-( sector_t*	sector,
-  fixed_t	speed,
-  fixed_t	dest,
-  boolean	crush,
-  int		floorOrCeiling,
-  int		direction )
+( sector_t*     sector,
+ fixed_t        speed,
+ fixed_t        dest,
+ boolean        crush,
+ int            floorOrCeiling,
+ int            direction )
 {
-    boolean	flag;
-    fixed_t	lastpos;
-
+    boolean     flag;
+    fixed_t     lastpos;
+
     switch(floorOrCeiling)
     {
-      case 0:
-	// FLOOR
-	switch(direction)
-	{
-	  case -1:
-	    // DOWN
-	    if (sector->floorheight - speed < dest)
-	    {
+    case 0:
+        // FLOOR
+        switch(direction)
+        {
+        case -1:
+            // DOWN
+            if (sector->floorheight - speed < dest)
+            {
                 // villsa [STRIFE] unused
-		//lastpos = sector->floorheight;
-		sector->floorheight = dest;
-		flag = P_ChangeSector(sector,crush);
+                //lastpos = sector->floorheight;
+                sector->floorheight = dest;
+                flag = P_ChangeSector(sector,crush);

                 // villsa [STRIFE] unused
-		/*if (flag == true)
-		{
-		    sector->floorheight =lastpos;
-		    P_ChangeSector(sector,crush);
-		    //return crushed;
-		}*/
-		return pastdest;
-	    }
-	    else
-	    {
+                /*if (flag == true)
+                {
+                    sector->floorheight =lastpos;
+                    P_ChangeSector(sector,crush);
+                    //return crushed;
+                }*/
+                return pastdest;
+            }
+            else
+            {
                 // villsa [STRIFE] unused
-		//lastpos = sector->floorheight;
-		sector->floorheight -= speed;
-		flag = P_ChangeSector(sector,crush);
+                //lastpos = sector->floorheight;
+                sector->floorheight -= speed;
+                flag = P_ChangeSector(sector,crush);

                 // villsa [STRIFE] unused
-		/*if (flag == true)
-		{
-		    sector->floorheight = lastpos;
-		    P_ChangeSector(sector,crush);
-		    return crushed;
-		}*/
+                /*if (flag == true)
+                {
+                    sector->floorheight = lastpos;
+                    P_ChangeSector(sector,crush);
+                    return crushed;
+                }*/
                 return ok;
-	    }
-	    break;
-
-	  case 1:
-	    // UP
-	    if (sector->floorheight + speed > dest)
-	    {
-		lastpos = sector->floorheight;
-		sector->floorheight = dest;
-		flag = P_ChangeSector(sector,crush);
-		if (flag == true)
-		{
-		    sector->floorheight = lastpos;
-		    P_ChangeSector(sector,crush);
-		    //return crushed;
-		}
-		return pastdest;
-	    }
-	    else
-	    {
-		// COULD GET CRUSHED
-		lastpos = sector->floorheight;
-		sector->floorheight += speed;
-		flag = P_ChangeSector(sector,crush);
-		if (flag == true)
-		{
-                    // villsa [STRIFE] unused
-		    //if (crush == true)
-			//return crushed;
-		    sector->floorheight = lastpos;
-		    P_ChangeSector(sector,crush);
-		    return crushed;
-		}
+             }
+             break;
+
+        case 1:
+            // UP
+            if (sector->floorheight + speed > dest)
+            {
+                lastpos = sector->floorheight;
+                sector->floorheight = dest;
+                flag = P_ChangeSector(sector,crush);
+                if (flag == true)
+                {
+                    sector->floorheight = lastpos;
+                    P_ChangeSector(sector,crush);
+                    //return crushed;
+                }
+                return pastdest;
+            }
+            else
+            {
+                // COULD GET CRUSHED
+                lastpos = sector->floorheight;
+                sector->floorheight += speed;
+                flag = P_ChangeSector(sector,crush);
+                if (flag == true)
+                {
+                    // haleyjd 20130210: Bug fix - Strife DOES do this.
+                    if (crush == true)
+                        return crushed;
+                    sector->floorheight = lastpos;
+                    P_ChangeSector(sector,crush);
+                    return crushed;
+                }
                 else
                     return ok;
-	    }
-	    break;
-	}
-	break;
-
-      case 1:
-	// CEILING
-	switch(direction)
-	{
-	  case -1:
-	    // DOWN
-	    if (sector->ceilingheight - speed < dest)
-	    {
-		lastpos = sector->ceilingheight;
-		sector->ceilingheight = dest;
-		flag = P_ChangeSector(sector,crush);
-
-		if (flag == true)
-		{
-		    sector->ceilingheight = lastpos;
-		    P_ChangeSector(sector,crush);
-		    //return crushed;
-		}
-		return pastdest;
-	    }
-	    else
-	    {
-		// COULD GET CRUSHED
-		lastpos = sector->ceilingheight;
-		sector->ceilingheight -= speed;
-		flag = P_ChangeSector(sector,crush);
-
-		if (flag == true)
-		{
-		    if (crush == true)
-			return crushed;
-		    sector->ceilingheight = lastpos;
-		    P_ChangeSector(sector,crush);
-		    return crushed;
-		}
-	    }
-	    break;
-
-	  case 1:
-	    // UP
-	    if (sector->ceilingheight + speed > dest)
-	    {
+            }
+            break;
+        }
+        break;
+
+    case 1:
+        // CEILING
+        switch(direction)
+        {
+        case -1:
+            // DOWN
+            if (sector->ceilingheight - speed < dest)
+            {
+                lastpos = sector->ceilingheight;
+                sector->ceilingheight = dest;
+                flag = P_ChangeSector(sector,crush);
+
+                if (flag == true)
+                {
+                    sector->ceilingheight = lastpos;
+                    P_ChangeSector(sector,crush);
+                    //return crushed;
+                }
+                return pastdest;
+            }
+            else
+            {
+                // COULD GET CRUSHED
+                lastpos = sector->ceilingheight;
+                sector->ceilingheight -= speed;
+                flag = P_ChangeSector(sector,crush);
+
+                if (flag == true)
+                {
+                    if (crush == true)
+                        return crushed;
+                    sector->ceilingheight = lastpos;
+                    P_ChangeSector(sector,crush);
+                    return crushed;
+                }
+            }
+            break;
+
+        case 1:
+            // UP
+            if (sector->ceilingheight + speed > dest)
+            {
                 // villsa [STRIFE] unused
-		//lastpos = sector->ceilingheight;
-		sector->ceilingheight = dest;
+                //lastpos = sector->ceilingheight;
+                sector->ceilingheight = dest;

                 // villsa [STRIFE] unused
-		//flag = P_ChangeSector(sector,crush);
-		/*if (flag == true)
-		{
-		    sector->ceilingheight = lastpos;
-		    P_ChangeSector(sector,crush);
-		    //return crushed;
-		}*/
-		return pastdest;
-	    }
-	    else
-	    {
+                //flag = P_ChangeSector(sector,crush);
+                /*if (flag == true)
+                {
+                    sector->ceilingheight = lastpos;
+                    P_ChangeSector(sector,crush);
+                    //return crushed;
+                }*/
+                return pastdest;
+            }
+            else
+            {
                 // villsa [STRIFE] unused
-		//lastpos = sector->ceilingheight;
-		sector->ceilingheight += speed;
+                //lastpos = sector->ceilingheight;
+                sector->ceilingheight += speed;

                 // villsa [STRIFE] unused
-		//flag = P_ChangeSector(sector,crush);
+                //flag = P_ChangeSector(sector,crush);
                 return ok;
-	    }
-	    break;
-	}
-	break;
-
+            }
+            break;
+        }
+        break;
+
     }
     return ok;
 }