shithub: choc

Download patch

ref: 12aafe9c5c927139a295d59675d8b7931bc2b96f
parent: 096d3d1121fe825261c4adb78fdadf40853443c3
author: Samuel Villareal <svkaiser@gmail.com>
date: Fri Sep 24 22:21:59 EDT 2010

+ Plats finished
+ All plat line types identified

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

--- a/src/strife/p_plats.c
+++ b/src/strife/p_plats.c
@@ -43,7 +43,7 @@
 #include "sounds.h"
 
 
-plat_t*		activeplats[MAXPLATS];
+plat_t* activeplats[MAXPLATS];
 
 
 
@@ -53,260 +53,311 @@
 void T_PlatRaise(plat_t* plat)
 {
     result_e	res;
-	
+
     switch(plat->status)
     {
-      case up:
-	res = T_MovePlane(plat->sector,
-			  plat->speed,
-			  plat->high,
-			  plat->crush,0,1);
-					
-	if (plat->type == raiseAndChange
-	    || plat->type == raiseToNearestAndChange)
-	{
-	    if (!(leveltime&7))
-		S_StartSound(&plat->sector->soundorg, sfx_stnmov);
-	}
-	
-				
-	if (res == crushed && (!plat->crush))
-	{
-	    plat->count = plat->wait;
-	    plat->status = down;
-	    S_StartSound(&plat->sector->soundorg, sfx_pstart);
-	}
-	else
-	{
-	    if (res == pastdest)
-	    {
-		plat->count = plat->wait;
-		plat->status = waiting;
-		S_StartSound(&plat->sector->soundorg, sfx_pstop);
+    case up:
+        res = T_MovePlane(plat->sector, plat->speed, plat->high, plat->crush, 0, 1);
 
-		switch(plat->type)
-		{
-		  case blazeDWUS:
-		  case downWaitUpStay:
-		    P_RemoveActivePlat(plat);
-		    break;
-		    
-		  case raiseAndChange:
-		  case raiseToNearestAndChange:
-		    P_RemoveActivePlat(plat);
-		    break;
-		    
-		  default:
-		    break;
-		}
-	    }
-	}
-	break;
-	
-      case	down:
-	res = T_MovePlane(plat->sector,plat->speed,plat->low,false,0,-1);
+        if(plat->type == raiseAndChange
+            || plat->type == raiseToNearestAndChange)
+        {
+            if(!(leveltime&7))
+                S_StartSound(&plat->sector->soundorg, sfx_stnmov);
+        }
 
-	if (res == pastdest)
-	{
-	    plat->count = plat->wait;
-	    plat->status = waiting;
-	    S_StartSound(&plat->sector->soundorg,sfx_pstop);
-	}
-	break;
-	
-      case	waiting:
-	if (!--plat->count)
-	{
-	    if (plat->sector->floorheight == plat->low)
-		plat->status = up;
-	    else
-		plat->status = down;
-	    S_StartSound(&plat->sector->soundorg,sfx_pstart);
-	}
-      case	in_stasis:
-	break;
+        // villsa [STRIFE]
+        if(plat->type == slowDWUS)
+        {
+            if(!(leveltime&7))
+                S_StartSound(&plat->sector->soundorg, sfx_stnmov);
+        }
+
+
+        if(res == crushed && (!plat->crush))
+        {
+            plat->count = plat->wait;
+            plat->status = down;
+            S_StartSound(&plat->sector->soundorg, sfx_pstart);
+        }
+        else
+        {
+            if(res == pastdest)
+            {
+                plat->count = plat->wait;
+                plat->status = waiting;
+                S_StartSound(&plat->sector->soundorg, sfx_pstop);
+
+                switch(plat->type)
+                {
+                case blazeDWUS:
+                case downWaitUpStay:
+                case raiseAndChange:
+                case slowDWUS:  // villsa [STRIFE]
+                case raiseToNearestAndChange:
+                    P_RemoveActivePlat(plat);
+                    break;
+
+                default:
+                    break;
+                }
+            }
+        }
+        break;
+
+    case down:
+        res = T_MovePlane(plat->sector, plat->speed, plat->low, false, 0, -1);
+
+        // villsa [STRIFE]
+        if(plat->type == slowDWUS)
+        {
+            if(!(leveltime&7))
+                S_StartSound(&plat->sector->soundorg, sfx_stnmov);
+        }
+
+        if(res == pastdest)
+        {
+            plat->count = plat->wait;
+            plat->status = waiting;
+            S_StartSound(&plat->sector->soundorg,sfx_pstop);
+
+            // villsa [STRIFE]
+            if(plat->type == upWaitDownStay)
+                P_RemoveActivePlat(plat);
+        }
+        break;
+
+    case waiting:
+        if(!--plat->count)
+        {
+            if(plat->sector->floorheight == plat->low)
+                plat->status = up;
+            else
+                plat->status = down;
+            S_StartSound(&plat->sector->soundorg,sfx_pstart);
+        }
     }
 }
 
 
 //
-// Do Platforms
-//  "amount" is only used for SOME platforms.
+// EV_DoPlat
 //
-int
-EV_DoPlat
-( line_t*	line,
-  plattype_e	type,
-  int		amount )
+// Do Platforms "amount" is only used for SOME platforms.
+//
+int EV_DoPlat(line_t* line, plattype_e type, int amount)
 {
-    plat_t*	plat;
-    int		secnum;
-    int		rtn;
-    sector_t*	sec;
-	
+    plat_t*     plat;
+    int         secnum;
+    int         rtn;
+    sector_t*   sec;
+
     secnum = -1;
     rtn = 0;
 
-    
+
     //	Activate all <type> plats that are in_stasis
     switch(type)
     {
-      case perpetualRaise:
-	P_ActivateInStasis(line->tag);
-	break;
-	
-      default:
-	break;
+    case perpetualRaise:
+        P_ActivateInStasis(line->tag);
+        break;
+
+    default:
+        break;
     }
-	
-    while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0)
+
+    while((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0)
     {
-	sec = &sectors[secnum];
+        sec = &sectors[secnum];
 
-	if (sec->specialdata)
-	    continue;
-	
-	// Find lowest & highest floors around sector
-	rtn = 1;
-	plat = Z_Malloc( sizeof(*plat), PU_LEVSPEC, 0);
-	P_AddThinker(&plat->thinker);
-		
-	plat->type = type;
-	plat->sector = sec;
-	plat->sector->specialdata = plat;
-	plat->thinker.function.acp1 = (actionf_p1) T_PlatRaise;
-	plat->crush = false;
-	plat->tag = line->tag;
-	
-	switch(type)
-	{
-	  case raiseToNearestAndChange:
-	    plat->speed = PLATSPEED/2;
-	    sec->floorpic = sides[line->sidenum[0]].sector->floorpic;
-	    plat->high = P_FindNextHighestFloor(sec,sec->floorheight);
-	    plat->wait = 0;
-	    plat->status = up;
-	    // NO MORE DAMAGE, IF APPLICABLE
-	    sec->special = 0;		
+        if (sec->specialdata)
+            continue;
 
-	    S_StartSound(&sec->soundorg,sfx_stnmov);
-	    break;
-	    
-	  case raiseAndChange:
-	    plat->speed = PLATSPEED/2;
-	    sec->floorpic = sides[line->sidenum[0]].sector->floorpic;
-	    plat->high = sec->floorheight + amount*FRACUNIT;
-	    plat->wait = 0;
-	    plat->status = up;
+        // Find lowest & highest floors around sector
+        rtn = 1;
+        plat = Z_Malloc( sizeof(*plat), PU_LEVSPEC, 0);
+        P_AddThinker(&plat->thinker);
 
-	    S_StartSound(&sec->soundorg,sfx_stnmov);
-	    break;
-	    
-	  case downWaitUpStay:
-	    plat->speed = PLATSPEED * 4;
-	    plat->low = P_FindLowestFloorSurrounding(sec);
+        plat->type = type;
+        plat->sector = sec;
+        plat->sector->specialdata = plat;
+        plat->thinker.function.acp1 = (actionf_p1) T_PlatRaise;
+        plat->crush = false;
+        plat->tag = line->tag;
 
-	    if (plat->low > sec->floorheight)
-		plat->low = sec->floorheight;
+        switch(type)
+        {
+        case raiseToNearestAndChange:
+            plat->speed = PLATSPEED/2;
+            sec->floorpic = sides[line->sidenum[0]].sector->floorpic;
+            plat->high = P_FindNextHighestFloor(sec,sec->floorheight);
+            plat->wait = 0;
+            plat->status = up;
 
-	    plat->high = sec->floorheight;
-	    plat->wait = TICRATE*PLATWAIT;
-	    plat->status = down;
-	    S_StartSound(&sec->soundorg,sfx_pstart);
-	    break;
-	    
-	  case blazeDWUS:
-	    plat->speed = PLATSPEED * 8;
-	    plat->low = P_FindLowestFloorSurrounding(sec);
+            // NO MORE DAMAGE, IF APPLICABLE
+            sec->special = 0;		
 
-	    if (plat->low > sec->floorheight)
-		plat->low = sec->floorheight;
+            S_StartSound(&sec->soundorg, sfx_stnmov);
+            break;
 
-	    plat->high = sec->floorheight;
-	    plat->wait = TICRATE*PLATWAIT;
-	    plat->status = down;
-	    S_StartSound(&sec->soundorg,sfx_pstart);
-	    break;
-	    
-	  case perpetualRaise:
-	    plat->speed = PLATSPEED;
-	    plat->low = P_FindLowestFloorSurrounding(sec);
+        case raiseAndChange:
+            plat->speed = PLATSPEED/2;
+            sec->floorpic = sides[line->sidenum[0]].sector->floorpic;
+            plat->high = sec->floorheight + amount * FRACUNIT;
+            plat->wait = 0;
+            plat->status = up;
 
-	    if (plat->low > sec->floorheight)
-		plat->low = sec->floorheight;
+            S_StartSound(&sec->soundorg, sfx_stnmov);
+            break;
 
-	    plat->high = P_FindHighestFloorSurrounding(sec);
+            // villsa [STRIFE]
+        case upWaitDownStay:
+            plat->speed = PLATSPEED * 4;
+            plat->low = P_FindNextHighestFloor(sec, sec->floorheight);
 
-	    if (plat->high < sec->floorheight)
-		plat->high = sec->floorheight;
+            if(plat->low > sec->floorheight)
+                plat->low = sec->floorheight;
 
-	    plat->wait = TICRATE*PLATWAIT;
-	    plat->status = P_Random()&1;
+            plat->high = sec->floorheight;
+            plat->wait = TICRATE * PLATWAIT;
+            plat->status = up;
+            S_StartSound(&sec->soundorg, sfx_pstart);
+            break;
 
-	    S_StartSound(&sec->soundorg,sfx_pstart);
-	    break;
-	}
-	P_AddActivePlat(plat);
+        case downWaitUpStay:
+            plat->speed = PLATSPEED * 4;
+            plat->low = P_FindLowestFloorSurrounding(sec);
+
+            if(plat->low > sec->floorheight)
+                plat->low = sec->floorheight;
+
+            plat->high = sec->floorheight;
+            plat->wait = TICRATE * PLATWAIT;
+            plat->status = down;
+            S_StartSound(&sec->soundorg, sfx_pstart);
+            break;
+
+            // villsa [STRIFE]
+        case slowDWUS:
+            plat->speed = PLATSPEED;
+            plat->low = P_FindLowestFloorSurrounding(sec);
+
+            if(plat->low > sec->floorheight)
+                plat->low = sec->floorheight;
+
+            plat->high = sec->floorheight;
+            plat->wait = TICRATE * (PLATWAIT * 10);
+            plat->status = down;
+            S_StartSound(&sec->soundorg,sfx_pstart);
+            break;
+
+        case blazeDWUS:
+            plat->speed = PLATSPEED * 8;
+            plat->low = P_FindLowestFloorSurrounding(sec);
+
+            if(plat->low > sec->floorheight)
+                plat->low = sec->floorheight;
+
+            plat->high = sec->floorheight;
+            plat->wait = TICRATE * PLATWAIT;
+            plat->status = down;
+            S_StartSound(&sec->soundorg, sfx_pstart);
+            break;
+
+        case perpetualRaise:
+            plat->speed = PLATSPEED;
+            plat->low = P_FindLowestFloorSurrounding(sec);
+
+            if(plat->low > sec->floorheight)
+                plat->low = sec->floorheight;
+
+            plat->high = P_FindHighestFloorSurrounding(sec);
+
+            if(plat->high < sec->floorheight)
+                plat->high = sec->floorheight;
+
+            plat->wait = TICRATE * PLATWAIT;
+            plat->status = P_Random() & 1;
+
+            S_StartSound(&sec->soundorg, sfx_pstart);
+            break;
+        }
+
+        P_AddActivePlat(plat);
     }
     return rtn;
 }
 
 
-
+//
+// P_ActivateInStasis
+//
 void P_ActivateInStasis(int tag)
 {
-    int		i;
-	
-    for (i = 0;i < MAXPLATS;i++)
-	if (activeplats[i]
-	    && (activeplats[i])->tag == tag
-	    && (activeplats[i])->status == in_stasis)
-	{
-	    (activeplats[i])->status = (activeplats[i])->oldstatus;
-	    (activeplats[i])->thinker.function.acp1
-	      = (actionf_p1) T_PlatRaise;
-	}
+    int i;
+
+    for(i = 0; i < MAXPLATS; i++)
+        if(activeplats[i]
+        && (activeplats[i])->tag == tag
+            && (activeplats[i])->status == in_stasis)
+        {
+            (activeplats[i])->status = (activeplats[i])->oldstatus;
+            (activeplats[i])->thinker.function.acp1
+                = (actionf_p1)T_PlatRaise;
+        }
 }
 
+//
+// EV_StopPlat
+//
 void EV_StopPlat(line_t* line)
 {
-    int		j;
-	
-    for (j = 0;j < MAXPLATS;j++)
-	if (activeplats[j]
-	    && ((activeplats[j])->status != in_stasis)
-	    && ((activeplats[j])->tag == line->tag))
-	{
-	    (activeplats[j])->oldstatus = (activeplats[j])->status;
-	    (activeplats[j])->status = in_stasis;
-	    (activeplats[j])->thinker.function.acv = (actionf_v)NULL;
-	}
+    int j;
+
+    for(j = 0; j < MAXPLATS; j++)
+        if (activeplats[j]
+        && ((activeplats[j])->status != in_stasis)
+            && ((activeplats[j])->tag == line->tag))
+        {
+            (activeplats[j])->oldstatus = (activeplats[j])->status;
+            (activeplats[j])->status = in_stasis;
+            (activeplats[j])->thinker.function.acv = (actionf_v)NULL;
+        }
 }
 
+//
+// P_AddActivePlat
+//
 void P_AddActivePlat(plat_t* plat)
 {
-    int		i;
-    
-    for (i = 0;i < MAXPLATS;i++)
-	if (activeplats[i] == NULL)
-	{
-	    activeplats[i] = plat;
-	    return;
-	}
-    I_Error ("P_AddActivePlat: no more plats!");
+    int i;
+
+    for(i = 0; i < MAXPLATS; i++)
+        if (activeplats[i] == NULL)
+        {
+            activeplats[i] = plat;
+            return;
+        }
+
+        I_Error("P_AddActivePlat: no more plats!");
 }
 
+//
+// P_RemoveActivePlat
+//
 void P_RemoveActivePlat(plat_t* plat)
 {
-    int		i;
-    for (i = 0;i < MAXPLATS;i++)
-	if (plat == activeplats[i])
-	{
-	    (activeplats[i])->sector->specialdata = NULL;
-	    P_RemoveThinker(&(activeplats[i])->thinker);
-	    activeplats[i] = NULL;
-	    
-	    return;
-	}
-    I_Error ("P_RemoveActivePlat: can't find plat!");
+    int i;
+    for(i = 0; i < MAXPLATS; i++)
+        if(plat == activeplats[i])
+        {
+            (activeplats[i])->sector->specialdata = NULL;
+            P_RemoveThinker(&(activeplats[i])->thinker);
+            activeplats[i] = NULL;
+
+            return;
+        }
+
+        I_Error("P_RemoveActivePlat: can't find plat!");
 }
--- a/src/strife/p_spec.c
+++ b/src/strife/p_spec.c
@@ -735,7 +735,8 @@
         line->special = 0;
         break;
 
-    case 22: // STRIFE-TODO: Something is different about this type - uses plat type 4
+    case 22:
+        // villsa [STRIFE] Verified unmodified.
         // Raise floor to nearest height and change texture
         EV_DoPlat(line,raiseToNearestAndChange,0);
         line->special = 0;
@@ -889,7 +890,8 @@
         line->special = 0;
         break;
 
-    case 121: // STRIFE-TODO: This has been modified! - uses plat type 5
+    case 121:
+        // villsa [STRIFE] Verified unmodified.
         // Blazing PlatDownWaitUpStay
         EV_DoPlat(line,blazeDWUS,0);
         line->special = 0;
@@ -1209,7 +1211,8 @@
         EV_DoFloor(line,raiseFloorCrush);
         break;
 
-    case 95: // STRIFE-TODO: changed to use plat type 4...
+    case 95:
+        // villsa [STRIFE] Verified unmodified.
         // Raise floor to nearest height
         // and change texture.
         EV_DoPlat(line,raiseToNearestAndChange,0);
@@ -1246,7 +1249,8 @@
         EV_DoDoor (line,blazeClose);
         break;
 
-    case 120: // STRIFE-TODO: changed - uses plat type 5
+    case 120:
+        // villsa [STRIFE] Verified unmodified.
         // Blazing PlatDownWaitUpStay.
         EV_DoPlat(line,blazeDWUS,0);
         break;
@@ -1426,7 +1430,8 @@
         P_ChangeSwitchTexture(line,1);
         break;
 
-    case 47: // STRIFE-TODO: plat type changed to 4 ????
+    case 47:
+        // villsa [STRIFE] Verified unmodified.
         // RAISE FLOOR NEAR AND CHANGE
         EV_DoPlat(line,raiseToNearestAndChange,0);
         P_ChangeSwitchTexture(line,0);
--- a/src/strife/p_spec.h
+++ b/src/strife/p_spec.h
@@ -292,9 +292,11 @@
 {
     perpetualRaise,
     downWaitUpStay,
+    slowDWUS,           // villsa [STRIFE]
     raiseAndChange,
     raiseToNearestAndChange,
-    blazeDWUS
+    blazeDWUS,
+    upWaitDownStay      // villsa [STRIFE]
 
 } plattype_e;
 
--- a/src/strife/p_switch.c
+++ b/src/strife/p_switch.c
@@ -535,13 +535,13 @@
 
     case 14:
         // Raise Floor 32 and change texture
-        if (EV_DoPlat(line,raiseAndChange,32))
+        if (EV_DoPlat(line, raiseAndChange,32))
             P_ChangeSwitchTexture(line,0);
         break;
 
     case 15:
         // Raise Floor 24 and change texture
-        if (EV_DoPlat(line,raiseAndChange,24))
+        if (EV_DoPlat(line, raiseAndChange,24))
             P_ChangeSwitchTexture(line,0);
         break;
 
@@ -553,13 +553,13 @@
 
     case 20:
         // Raise Plat next highest floor and change texture
-        if (EV_DoPlat(line,raiseToNearestAndChange,0))
+        if(EV_DoPlat(line, raiseToNearestAndChange, 0))
             P_ChangeSwitchTexture(line,0);
         break;
 
     case 21:
         // PlatDownWaitUpStay
-        if (EV_DoPlat(line,downWaitUpStay,0))
+        if (EV_DoPlat(line, downWaitUpStay,0))
             P_ChangeSwitchTexture(line,0);
         break;
 
@@ -654,7 +654,7 @@
 
     case 122:
         // Blazing PlatDownWaitUpStay
-        if (EV_DoPlat(line,blazeDWUS,0))
+        if(EV_DoPlat(line, blazeDWUS, 0))
             P_ChangeSwitchTexture(line,0);
         break;
 
@@ -719,7 +719,7 @@
 
     case 62:
         // PlatDownWaitUpStay
-        if (EV_DoPlat(line,downWaitUpStay,1))
+        if (EV_DoPlat(line, downWaitUpStay,1))
             P_ChangeSwitchTexture(line,1);
         break;
 
@@ -737,13 +737,13 @@
 
     case 66:
         // Raise Floor 24 and change texture
-        if (EV_DoPlat(line,raiseAndChange,24))
+        if (EV_DoPlat(line, raiseAndChange, 24))
             P_ChangeSwitchTexture(line,1);
         break;
 
     case 67:
         // Raise Floor 32 and change texture
-        if (EV_DoPlat(line,raiseAndChange,32))
+        if (EV_DoPlat(line, raiseAndChange, 32))
             P_ChangeSwitchTexture(line,1);
         break;
 
@@ -755,7 +755,7 @@
 
     case 68:
         // Raise Plat to next highest floor and change texture
-        if (EV_DoPlat(line,raiseToNearestAndChange,0))
+        if (EV_DoPlat(line, raiseToNearestAndChange, 0))
             P_ChangeSwitchTexture(line,1);
         break;
 
@@ -791,7 +791,7 @@
 
     case 123:
         // Blazing PlatDownWaitUpStay
-        if (EV_DoPlat(line,blazeDWUS,0))
+        if(EV_DoPlat(line, blazeDWUS, 0))
             P_ChangeSwitchTexture(line,1);
         break;
 
@@ -846,6 +846,52 @@
         P_Thrust(thing->player, thing->angle + ANG180, 125*FRACUNIT/16);
         break;
 
+    case 151:
+        // villsa [STRIFE] BlzOpenDoor Gold key
+        if(EV_DoLockedDoor(line, blazeOpen,thing))
+            P_ChangeSwitchTexture(line, 1);
+        break;
+
+    case 154:
+        // villsa [STRIFE] plat lower wait rise if have gold key
+        if(thing->player->cards[key_GoldKey])
+        {
+            if(EV_DoPlat(line, downWaitUpStay, 0))
+                P_ChangeSwitchTexture(line, 1);
+        }
+        else
+        {
+            thing->player->message = DEH_String("You need a gold key");
+            S_StartSound(thing, sfx_oof);
+        }
+        break;
+
+    case 155:
+        // villsa [STRIFE] raise plat wait lower
+        if(EV_DoPlat(line, upWaitDownStay, 0))
+            P_ChangeSwitchTexture(line, 1);
+        break;
+
+    case 164:
+        // villsa [STRIFE] BlzOpenDoor Gold key
+        if(EV_DoLockedDoor(line, blazeOpen,thing))
+            P_ChangeSwitchTexture(line, 0);
+        break;
+
+    case 177:
+        // villsa [STRIFE] plat lower wait rise if have power3 key
+        if(thing->player->cards[key_Power3Key])
+        {
+            if(EV_DoPlat(line, downWaitUpStay, 0))
+                P_ChangeSwitchTexture(line, 1);
+        }
+        else
+        {
+            thing->player->message = DEH_String("You don't have the key");
+            S_StartSound(thing, sfx_oof);
+        }
+        break;
+
     case 194:
         // villsa [STRIFE] free prisoners
         if(EV_DoDoor(line, open))
@@ -884,6 +930,12 @@
             I_StartVoice(usemessage);
             line->special = 0;
         }
+        break;
+
+    case 214:
+        // villsa [STRIFE] slow lift lower wait up stay
+        if(EV_DoPlat(line, slowDWUS, 1))
+            P_ChangeSwitchTexture(line, 1);
         break;
 
     case 226: