summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/strife/p_floor.c187
-rw-r--r--src/strife/p_spec.c5
-rw-r--r--src/strife/p_spec.h6
-rw-r--r--src/strife/p_switch.c53
4 files changed, 143 insertions, 108 deletions
diff --git a/src/strife/p_floor.c b/src/strife/p_floor.c
index 8c676452..df966d28 100644
--- a/src/strife/p_floor.c
+++ b/src/strife/p_floor.c
@@ -477,101 +477,110 @@ EV_BuildStairs
( line_t* line,
stair_e type )
{
- int secnum;
- int height;
- int i;
- int newsecnum;
- int texture;
- int ok;
- int rtn;
-
- sector_t* sec;
- sector_t* tsec;
+ int secnum;
+ int height;
+ int i;
+ int newsecnum;
+ int texture;
+ int ok;
+ int rtn;
- floormove_t* floor;
-
- fixed_t stairsize = 0;
- fixed_t speed = 0;
+ sector_t* sec;
+ sector_t* tsec;
+
+ floormove_t* floor;
+
+ // Either Watcom or Rogue moved the switch out of the loop below, probably
+ // because it was a loop invariant, and put the default values in the
+ // initializers here. I cannot be bothered to figure it out without doing
+ // this myself :P
+ fixed_t stairsize = 8*FRACUNIT;
+ fixed_t speed = FLOORSPEED;
+ int direction = 1;
+
+ switch(type)
+ {
+ case build8: // [STRIFE] Verified unmodified.
+ speed = FLOORSPEED/4;
+ break;
+ case turbo16: // [STRIFE] Verified unmodified.
+ speed = FLOORSPEED*4;
+ stairsize = 16*FRACUNIT;
+ break;
+ case buildDown16: // [STRIFE] New stair type
+ stairsize = -16*FRACUNIT;
+ direction = -1;
+ break;
+ }
secnum = -1;
rtn = 0;
while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0)
{
- sec = &sectors[secnum];
-
- // ALREADY MOVING? IF SO, KEEP GOING...
- if (sec->specialdata)
- continue;
-
- // new floor thinker
- rtn = 1;
- floor = Z_Malloc (sizeof(*floor), PU_LEVSPEC, 0);
- P_AddThinker (&floor->thinker);
- sec->specialdata = floor;
- floor->thinker.function.acp1 = (actionf_p1) T_MoveFloor;
- floor->direction = 1;
- floor->sector = sec;
- switch(type)
- {
- case build8:
- speed = FLOORSPEED/4;
- stairsize = 8*FRACUNIT;
- break;
- case turbo16:
- speed = FLOORSPEED*4;
- stairsize = 16*FRACUNIT;
- break;
- }
- floor->speed = speed;
- height = sec->floorheight + stairsize;
- floor->floordestheight = height;
-
- texture = sec->floorpic;
-
- // Find next sector to raise
- // 1. Find 2-sided line with same sector side[0]
- // 2. Other side is the next sector to raise
- do
- {
- ok = 0;
- for (i = 0;i < sec->linecount;i++)
- {
- if ( !((sec->lines[i])->flags & ML_TWOSIDED) )
- continue;
-
- tsec = (sec->lines[i])->frontsector;
- newsecnum = tsec-sectors;
-
- if (secnum != newsecnum)
- continue;
-
- tsec = (sec->lines[i])->backsector;
- newsecnum = tsec - sectors;
-
- if (tsec->floorpic != texture)
- continue;
-
- height += stairsize;
-
- if (tsec->specialdata)
- continue;
-
- sec = tsec;
- secnum = newsecnum;
- floor = Z_Malloc (sizeof(*floor), PU_LEVSPEC, 0);
-
- P_AddThinker (&floor->thinker);
-
- sec->specialdata = floor;
- floor->thinker.function.acp1 = (actionf_p1) T_MoveFloor;
- floor->direction = 1;
- floor->sector = sec;
- floor->speed = speed;
- floor->floordestheight = height;
- ok = 1;
- break;
- }
- } while(ok);
+ sec = &sectors[secnum];
+
+ // ALREADY MOVING? IF SO, KEEP GOING...
+ if (sec->specialdata)
+ continue;
+
+ // new floor thinker
+ rtn = 1;
+ floor = Z_Malloc (sizeof(*floor), PU_LEVSPEC, 0);
+ P_AddThinker (&floor->thinker);
+ sec->specialdata = floor;
+ floor->thinker.function.acp1 = (actionf_p1) T_MoveFloor;
+ floor->direction = 1;
+ floor->sector = sec;
+ floor->speed = speed;
+ height = sec->floorheight + stairsize;
+ floor->floordestheight = height;
+
+ texture = sec->floorpic;
+
+ // Find next sector to raise
+ // 1. Find 2-sided line with same sector side[0]
+ // 2. Other side is the next sector to raise
+ do
+ {
+ ok = 0;
+ for (i = 0;i < sec->linecount;i++)
+ {
+ if ( !((sec->lines[i])->flags & ML_TWOSIDED) )
+ continue;
+
+ tsec = (sec->lines[i])->frontsector;
+ newsecnum = tsec-sectors;
+
+ if (secnum != newsecnum)
+ continue;
+
+ tsec = (sec->lines[i])->backsector;
+ newsecnum = tsec - sectors;
+
+ if (tsec->floorpic != texture)
+ continue;
+
+ height += stairsize;
+
+ if (tsec->specialdata)
+ continue;
+
+ sec = tsec;
+ secnum = newsecnum;
+ floor = Z_Malloc (sizeof(*floor), PU_LEVSPEC, 0);
+
+ P_AddThinker (&floor->thinker);
+
+ sec->specialdata = floor;
+ floor->thinker.function.acp1 = (actionf_p1) T_MoveFloor;
+ floor->direction = direction; // [STRIFE]: for buildDown16
+ floor->sector = sec;
+ floor->speed = speed;
+ floor->floordestheight = height;
+ ok = 1;
+ break;
+ }
+ } while(ok);
}
return rtn;
}
diff --git a/src/strife/p_spec.c b/src/strife/p_spec.c
index 627966f3..70a15450 100644
--- a/src/strife/p_spec.c
+++ b/src/strife/p_spec.c
@@ -935,8 +935,9 @@ P_CrossSpecialLine
line->special = 0;
break;
- case 178: // STRIFE-TODO: new Stairs type?
- // EV_BuildStairs(line, 2);
+ case 178:
+ // haleyjd 09/24/10: [STRIFE] W1 Build Stairs Down 16
+ EV_BuildStairs(line, buildDown16);
line->special = 0;
break;
diff --git a/src/strife/p_spec.h b/src/strife/p_spec.h
index 2179bf9b..144b77d5 100644
--- a/src/strife/p_spec.h
+++ b/src/strife/p_spec.h
@@ -598,9 +598,9 @@ typedef enum
typedef enum
{
- build8, // slowly build by 8
- turbo16 // quickly build by 16
-
+ build8, // slowly build by 8
+ turbo16, // quickly build by 16
+ buildDown16 // haleyjd 09/24/10: [STRIFE] new stair type
} stair_e;
diff --git a/src/strife/p_switch.c b/src/strife/p_switch.c
index b37e6586..ac14c4af 100644
--- a/src/strife/p_switch.c
+++ b/src/strife/p_switch.c
@@ -444,7 +444,7 @@ static void P_MoveWall(line_t *line, mobj_t *thing)
}
// villsa [STRIFE]
-static char speciallinemsg[92];
+static char usemessage[92];
//
// P_UseSpecialLine
@@ -453,8 +453,6 @@ static char speciallinemsg[92];
//
boolean P_UseSpecialLine(mobj_t* thing, line_t* line, int side)
{
- static char usemessage[92]; // [STRIFE]
-
// Err...
// Use the back sides of VERY SPECIAL lines...
if (side)
@@ -516,7 +514,7 @@ boolean P_UseSpecialLine(mobj_t* thing, line_t* line, int side)
// SWITCHES
case 7:
- // Build Stairs
+ // Build Stairs - [STRIFE] Verified unmodified
if (EV_BuildStairs(line,build8))
P_ChangeSwitchTexture(line,0);
break;
@@ -661,7 +659,7 @@ boolean P_UseSpecialLine(mobj_t* thing, line_t* line, int side)
break;
case 127:
- // Build Stairs Turbo 16
+ // Build Stairs Turbo 16 - [STRIFE] Verified unmodified
if (EV_BuildStairs(line,turbo16))
P_ChangeSwitchTexture(line,0);
break;
@@ -830,6 +828,18 @@ boolean P_UseSpecialLine(mobj_t* thing, line_t* line, int side)
EV_SlidingDoor(line, thing);
break;
+ case 146:
+ // haleyjd 09/24/10: [STRIFE] S1 Build Stairs Down 16 (new type)
+ if(EV_BuildStairs(line, buildDown16))
+ P_ChangeSwitchTexture(line, 0);
+ break;
+
+ case 147:
+ // haleyjd 09/24/10: [STRIFE] S1 Clear Force Fields
+ if(EV_ClearForceFields(line))
+ P_ChangeSwitchTexture(line, 0);
+ break;
+
case 148:
// haleyjd 09/16/10: [STRIFE] using forcefields hurts
P_DamageMobj(thing, NULL, NULL, 16);
@@ -852,26 +862,41 @@ boolean P_UseSpecialLine(mobj_t* thing, line_t* line, int side)
P_ChangeSwitchTexture(line, 1);
break; // haleyjd
+ case 209:
+ // haleyjd 09/24/10: [STRIFE] S1 Build Stairs Down 16 if Have Chalice
+ if(!P_PlayerHasItem(thing->player, MT_INV_CHALICE))
+ {
+ DEH_snprintf(usemessage, sizeof(usemessage), "You need the chalice!");
+ thing->player->message = usemessage;
+ S_StartSound(thing, sfx_oof);
+ break;
+ }
+ else if(EV_BuildStairs(line, buildDown16))
+ P_ChangeSwitchTexture(line, 0);
+ break;
+
case 211:
// villsa [STRIFE] play VOC## sound
if(&players[consoleplayer] == thing->player &&
thing->player->powers[pw_communicator])
{
- DEH_snprintf(speciallinemsg, sizeof(speciallinemsg), "voc%i", line->tag);
- I_StartVoice(speciallinemsg);
+ DEH_snprintf(usemessage, sizeof(usemessage), "voc%i", line->tag);
+ I_StartVoice(usemessage);
line->special = 0;
}
break;
case 226:
// villsa [STRIFE] complete training area
- if(!EV_DoFloor(line, lowerFloor))
- return true;
-
- P_GiveItemToPlayer(thing->player, SPR_TOKN, MT_TOKEN_STAMINA);
- P_GiveItemToPlayer(thing->player, SPR_TOKN, MT_TOKEN_NEW_ACCURACY);
- P_ChangeSwitchTexture(line, 0);
- thing->player->message = DEH_String("Congratulations! You have completed the training area.");
+ if(EV_DoFloor(line, lowerFloor))
+ {
+ P_GiveItemToPlayer(thing->player, SPR_TOKN, MT_TOKEN_STAMINA);
+ P_GiveItemToPlayer(thing->player, SPR_TOKN, MT_TOKEN_NEW_ACCURACY);
+ P_ChangeSwitchTexture(line, 0);
+ DEH_snprintf(usemessage, sizeof(usemessage),
+ DEH_String("Congratulations! You have completed the training area."));
+ thing->player->message = usemessage;
+ }
break;
case 229: