shithub: choc

Download patch

ref: 4c9a85fa61a4298b342a76d4ac128c036b199055
parent: fe531d051d66611d82c233f8a02b435bece34ab6
author: Samuel Villareal <[email protected]>
date: Tue Sep 14 02:24:04 EDT 2010

+ P_FindSlidingDoorType fixed where it was returning a null slidetype
+ EV_SlideDoor updated
+ Linetypes 207 (RemoteSlideDoor) and linetype 229 (Sigil SlideDoor)
  added
+ T_MovePlane updated

Subversion-branch: /branches/strife-branch
Subversion-revision: 2085

--- a/src/strife/p_doors.c
+++ b/src/strife/p_doors.c
@@ -737,7 +737,7 @@
     int i;
     int val;
 	
-    for(i = 0; i < MAXSLIDEDOORS; i++)
+    for(i = 0; i < MAXSLIDEDOORS-1; i++)
     {
         val = sides[line->sidenum[0]].toptexture;
 	if(val == slideFrames[i].frames[0])
@@ -805,13 +805,12 @@
         if(!door->timer--)
         {
             fixed_t speed;
-            boolean thinglist;
+            fixed_t cheight;
 
             sec = door->frontsector;
-            thinglist = (sec->thinglist != NULL);
 
             // CAN DOOR CLOSE?
-            if(thinglist)
+            if(sec->thinglist != NULL)
             {
                 door->timer = SDOORWAIT;
                 return;
@@ -819,12 +818,11 @@
             else
             {
 
-                speed = sec->ceilingheight -
-                    sec->floorheight - (10*FRACUNIT);
+                cheight = sec->ceilingheight;
+                speed = cheight - sec->floorheight - (10*FRACUNIT);
 
                 // something blocking it?
-                // [STRIFE] TODO this function here is causing some abnormalites when closing
-                if(T_MovePlane(sec, speed, sec->floorheight, thinglist, 1, -1) == 1)
+                if(T_MovePlane(sec, speed, sec->floorheight, 0, 1, -1) == crushed)
                 {
                     door->timer = SDOORWAIT;
                     return;
@@ -832,7 +830,7 @@
                 else
                 {
                     // Instantly move plane
-                    T_MovePlane(sec, (128*FRACUNIT), sec->ceilingheight, 0, 1, 1);
+                    T_MovePlane(sec, (128*FRACUNIT), cheight, 0, 1, 1);
 
                     // turn line blocking back on
                     door->line1->flags |= ML_BLOCKING;
@@ -886,10 +884,39 @@
 //
 // EV_RemoteSlidingDoor
 //
-// villsa [STRIFE] TODO
+// villsa [STRIFE] new function
 //
-void EV_RemoteSlidingDoor(line_t* line, mobj_t* thing)
+int EV_RemoteSlidingDoor(line_t* line, mobj_t* thing)
 {
+    int		    secnum;
+    sector_t*       sec;
+    slidedoor_t*    door;
+    int             i;
+    int             rtn;
+    line_t*         secline;
+	
+    secnum = -1;
+    rtn = 0;
+    
+    while((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0)
+    {
+        sec = &sectors[secnum];
+        if(sec->specialdata)
+            continue;
+
+        for(i = 0; i < 4; i++)
+        {
+            secline = sec->lines[i];
+
+            if(P_FindSlidingDoorType(secline) < 0)
+                continue;
+
+            EV_SlidingDoor(secline, thing);
+            rtn = 1;
+        }
+    }
+
+    return rtn;
 }
 
 
@@ -918,7 +945,6 @@
         {
             if(door->status == sd_waiting)
             {
-                // [STRIFE] TODO lines are still passable when closed manually by player
                 door->status = sd_closing;
                 door->timer = SWAITTICS;    // villsa [STRIFE]
             }
--- a/src/strife/p_floor.c
+++ b/src/strife/p_floor.c
@@ -68,28 +68,35 @@
 	    // DOWN
 	    if (sector->floorheight - speed < dest)
 	    {
-		lastpos = sector->floorheight;
+                // villsa [STRIFE] unused
+		//lastpos = sector->floorheight;
 		sector->floorheight = dest;
 		flag = P_ChangeSector(sector,crush);
-		if (flag == true)
+
+                // villsa [STRIFE] unused
+		/*if (flag == true)
 		{
 		    sector->floorheight =lastpos;
 		    P_ChangeSector(sector,crush);
 		    //return crushed;
-		}
+		}*/
 		return pastdest;
 	    }
 	    else
 	    {
-		lastpos = sector->floorheight;
+                // villsa [STRIFE] unused
+		//lastpos = sector->floorheight;
 		sector->floorheight -= speed;
 		flag = P_ChangeSector(sector,crush);
-		if (flag == true)
+
+                // villsa [STRIFE] unused
+		/*if (flag == true)
 		{
 		    sector->floorheight = lastpos;
 		    P_ChangeSector(sector,crush);
 		    return crushed;
-		}
+		}*/
+                return ok;
 	    }
 	    break;
 						
@@ -116,12 +123,15 @@
 		flag = P_ChangeSector(sector,crush);
 		if (flag == true)
 		{
-		    if (crush == true)
-			return crushed;
+                    // villsa [STRIFE] unused
+		    //if (crush == true)
+			//return crushed;
 		    sector->floorheight = lastpos;
 		    P_ChangeSector(sector,crush);
 		    return crushed;
 		}
+                else
+                    return ok;
 	    }
 	    break;
 	}
@@ -169,31 +179,29 @@
 	    // UP
 	    if (sector->ceilingheight + speed > dest)
 	    {
-		lastpos = sector->ceilingheight;
+                // villsa [STRIFE] unused
+		//lastpos = sector->ceilingheight;
 		sector->ceilingheight = dest;
-		flag = P_ChangeSector(sector,crush);
-		if (flag == true)
+
+                // villsa [STRIFE] unused
+		//flag = P_ChangeSector(sector,crush);
+		/*if (flag == true)
 		{
 		    sector->ceilingheight = lastpos;
 		    P_ChangeSector(sector,crush);
 		    //return crushed;
-		}
+		}*/
 		return pastdest;
 	    }
 	    else
 	    {
-		lastpos = sector->ceilingheight;
+                // villsa [STRIFE] unused
+		//lastpos = sector->ceilingheight;
 		sector->ceilingheight += speed;
-		flag = P_ChangeSector(sector,crush);
-// UNUSED
-#if 0
-		if (flag == true)
-		{
-		    sector->ceilingheight = lastpos;
-		    P_ChangeSector(sector,crush);
-		    return crushed;
-		}
-#endif
+
+                // villsa [STRIFE] unused
+		//flag = P_ChangeSector(sector,crush);
+                return ok;
 	    }
 	    break;
 	}
--- a/src/strife/p_spec.h
+++ b/src/strife/p_spec.h
@@ -488,6 +488,7 @@
 
 void P_InitSlidingDoorFrames(void);
 void EV_SlidingDoor(line_t* line, mobj_t* thing);
+int EV_RemoteSlidingDoor(line_t* line, mobj_t* thing);
 
 
 
--- a/src/strife/p_switch.c
+++ b/src/strife/p_switch.c
@@ -820,6 +820,19 @@
           EV_SlidingDoor(line, thing);
           break;
 
+      case 207:
+          // villsa [STRIFE] remote sliding door
+          if(EV_RemoteSlidingDoor(line, thing))
+              P_ChangeSwitchTexture(line, 1);
+
+      case 229:
+          // villsa [STRIFE] sigil sliding door
+          if(thing->player && thing->player->sigiltype == 4)
+          {
+              if(EV_RemoteSlidingDoor(line, thing))
+                  P_ChangeSwitchTexture(line, 1);
+          }
+
       case 666:
           // villsa [STRIFE] Move wall
           P_MoveWall(line, thing);