summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Villareal2010-09-15 04:41:10 +0000
committerSamuel Villareal2010-09-15 04:41:10 +0000
commitbbb39c2906ab01b75e7959a0d07560a4a56c459a (patch)
treede5e41240b223688c2ee135874ee95e64747daa3
parent3228ddb99f72d00c089fc7a87d1edfec2c4519fc (diff)
downloadchocolate-doom-bbb39c2906ab01b75e7959a0d07560a4a56c459a.tar.gz
chocolate-doom-bbb39c2906ab01b75e7959a0d07560a4a56c459a.tar.bz2
chocolate-doom-bbb39c2906ab01b75e7959a0d07560a4a56c459a.zip
+ EV_DoDoor updated
+ New door types added to enum + T_VerticalDoor updated + Split Door mechanic implemented + Linetypes 40, 174, 183 implemented Subversion-branch: /branches/strife-branch Subversion-revision: 2088
-rw-r--r--src/strife/p_doors.c626
-rw-r--r--src/strife/p_enemy.c2
-rw-r--r--src/strife/p_spec.c16
-rw-r--r--src/strife/p_spec.h7
-rw-r--r--src/strife/p_switch.c5
5 files changed, 388 insertions, 268 deletions
diff --git a/src/strife/p_doors.c b/src/strife/p_doors.c
index fa86ebf6..0615448a 100644
--- a/src/strife/p_doors.c
+++ b/src/strife/p_doors.c
@@ -49,134 +49,163 @@
//
// T_VerticalDoor
//
-void T_VerticalDoor (vldoor_t* door)
+void T_VerticalDoor(vldoor_t* door)
{
- result_e res;
-
+ result_e res1;
+ result_e res2;
+
switch(door->direction)
{
- case 0:
- // WAITING
- if (!--door->topcountdown)
- {
- switch(door->type)
- {
- case blazeRaise:
- door->direction = -1; // time to go back down
- S_StartSound(&door->sector->soundorg, sfx_bdcls);
- break;
-
- case normal:
- door->direction = -1; // time to go back down
- S_StartSound(&door->sector->soundorg, sfx_swish); // villsa [STRIFE] TODO - fix sounds
- break;
-
- case close30ThenOpen:
- door->direction = 1;
- S_StartSound(&door->sector->soundorg, sfx_swish); // villsa [STRIFE] TODO - fix sounds
- break;
-
- default:
- break;
- }
- }
- break;
-
- case 2:
- // INITIAL WAIT
- if (!--door->topcountdown)
- {
- switch(door->type)
- {
- case raiseIn5Mins:
- door->direction = 1;
- door->type = normal;
- S_StartSound(&door->sector->soundorg, sfx_swish); // villsa [STRIFE] TODO - fix sounds
- break;
-
- default:
- break;
- }
- }
- break;
-
- case -1:
- // DOWN
- res = T_MovePlane(door->sector,
- door->speed,
- door->sector->floorheight,
- false,1,door->direction);
- if (res == pastdest)
- {
- switch(door->type)
- {
- case blazeRaise:
- case blazeClose:
- door->sector->specialdata = NULL;
- P_RemoveThinker (&door->thinker); // unlink and free
- S_StartSound(&door->sector->soundorg, sfx_bdcls);
- break;
-
- case normal:
- case close:
- door->sector->specialdata = NULL;
- P_RemoveThinker (&door->thinker); // unlink and free
- break;
-
- case close30ThenOpen:
- door->direction = 0;
- door->topcountdown = TICRATE*30;
- break;
-
- default:
- break;
- }
- }
- else if (res == crushed)
- {
- switch(door->type)
- {
- case blazeClose:
- case close: // DO NOT GO BACK UP!
- break;
-
- default:
- door->direction = 1;
- S_StartSound(&door->sector->soundorg, sfx_swish); // villsa [STRIFE] TODO - fix sounds
- break;
- }
- }
- break;
-
- case 1:
- // UP
- res = T_MovePlane(door->sector,
- door->speed,
- door->topheight,
- false,1,door->direction);
-
- if (res == pastdest)
- {
- switch(door->type)
- {
- case blazeRaise:
- case normal:
- door->direction = 0; // wait at top
- door->topcountdown = door->topwait;
- break;
-
- case close30ThenOpen:
- case blazeOpen:
- case open:
- door->sector->specialdata = NULL;
- P_RemoveThinker (&door->thinker); // unlink and free
- break;
-
- default:
- break;
- }
- }
- break;
+ case 0:
+ // WAITING
+ if (!--door->topcountdown)
+ {
+ switch(door->type)
+ {
+ case blazeRaise:
+ door->direction = -1; // time to go back down
+ S_StartSound(&door->sector->soundorg, sfx_bdcls);
+ break;
+
+ case normal:
+ door->direction = -1; // time to go back down
+ // villsa [STRIFE] closesound added
+ S_StartSound(&door->sector->soundorg, door->closesound);
+ break;
+
+ // villsa [STRIFE]
+ case shopClose:
+ door->direction = 1;
+ door->speed = (2*FRACUNIT);
+ S_StartSound(&door->sector->soundorg, door->opensound);
+ break;
+
+ case close30ThenOpen:
+ door->direction = 1;
+
+ // villsa [STRIFE] opensound added
+ S_StartSound(&door->sector->soundorg, door->opensound);
+ break;
+
+ default:
+ break;
+ }
+ }
+ break;
+
+ case 2:
+ // INITIAL WAIT
+ if (!--door->topcountdown)
+ {
+ switch(door->type)
+ {
+ case raiseIn5Mins:
+ door->direction = 1;
+ door->type = normal;
+
+ // villsa [STRIFE] opensound added
+ S_StartSound(&door->sector->soundorg, door->opensound);
+ break;
+
+ default:
+ break;
+ }
+ }
+ break;
+
+ // villsa [STRIFE]
+ case -2:
+ // SPLIT
+ res1 = T_MovePlane(door->sector, door->speed, door->topheight, 0, 1, 1);
+ res2 = T_MovePlane(door->sector, door->speed, door->topwait, 0, 0, -1);
+
+ if(res1 == pastdest && res2 == pastdest)
+ {
+ door->sector->specialdata = NULL;
+ P_RemoveThinker(&door->thinker); // unlink and free
+ }
+
+ break;
+
+ case -1:
+ // DOWN
+ res1 = T_MovePlane(door->sector, door->speed, door->sector->floorheight, false, 1, door->direction);
+ if(res1 == pastdest)
+ {
+ switch(door->type)
+ {
+ case normal:
+ case close:
+ case blazeRaise:
+ case blazeClose:
+ door->sector->specialdata = NULL;
+ P_RemoveThinker (&door->thinker); // unlink and free
+ // villsa [STRIFE] no sounds
+ break;
+
+ case close30ThenOpen:
+ door->direction = 0;
+ door->topcountdown = TICRATE*30;
+ break;
+
+ // villsa [STRIFE]
+ case shopClose:
+ door->direction = 0;
+ door->topcountdown = TICRATE*120;
+ break;
+
+ default:
+ break;
+ }
+ }
+ else if(res1 == crushed)
+ {
+ switch(door->type)
+ {
+ case blazeClose:
+ case close: // DO NOT GO BACK UP!
+ case shopClose: // villsa [STRIFE]
+ break;
+
+ default:
+ door->direction = 1;
+ // villsa [STRIFE] opensound added
+ S_StartSound(&door->sector->soundorg, door->opensound);
+ break;
+ }
+ }
+ break;
+
+ case 1:
+ // UP
+ res1 = T_MovePlane(door->sector,
+ door->speed,
+ door->topheight,
+ false,1,door->direction);
+
+ if(res1 == pastdest)
+ {
+ switch(door->type)
+ {
+ case blazeRaise:
+ case normal:
+ door->direction = 0; // wait at top
+ door->topcountdown = door->topwait;
+ break;
+
+ case close30ThenOpen:
+ case blazeOpen:
+ case open:
+ case shopClose: // villsa [STRIFE]
+ door->sector->specialdata = NULL;
+ P_RemoveThinker (&door->thinker); // unlink and free
+ break;
+
+ default:
+ break;
+ }
+ }
+ break;
}
}
@@ -243,101 +272,172 @@ EV_DoLockedDoor
}
-int
-EV_DoDoor
-( line_t* line,
- vldoor_e type )
+int EV_DoDoor(line_t* line, vldoor_e type)
{
- int secnum,rtn;
- sector_t* sec;
- vldoor_t* door;
-
+ int secnum, rtn;
+ sector_t* sec;
+ vldoor_t* door;
+
secnum = -1;
rtn = 0;
-
- while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0)
+
+ while((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0)
{
- sec = &sectors[secnum];
- if (sec->specialdata)
- continue;
-
-
- // new door thinker
- rtn = 1;
- door = Z_Malloc (sizeof(*door), PU_LEVSPEC, 0);
- P_AddThinker (&door->thinker);
- sec->specialdata = door;
-
- door->thinker.function.acp1 = (actionf_p1) T_VerticalDoor;
- door->sector = sec;
- door->type = type;
- door->topwait = VDOORWAIT;
- door->speed = VDOORSPEED;
-
- switch(type)
- {
- case blazeClose:
- door->topheight = P_FindLowestCeilingSurrounding(sec);
- door->topheight -= 4*FRACUNIT;
- door->direction = -1;
- door->speed = VDOORSPEED * 4;
- S_StartSound(&door->sector->soundorg, sfx_bdcls);
- break;
-
- case close:
- door->topheight = P_FindLowestCeilingSurrounding(sec);
- door->topheight -= 4*FRACUNIT;
- door->direction = -1;
- S_StartSound(&door->sector->soundorg, sfx_swish); // villsa [STRIFE] TODO - fix sounds
- break;
-
- case close30ThenOpen:
- door->topheight = sec->ceilingheight;
- door->direction = -1;
- S_StartSound(&door->sector->soundorg, sfx_swish); // villsa [STRIFE] TODO - fix sounds
- break;
-
- case blazeRaise:
- case blazeOpen:
- door->direction = 1;
- door->topheight = P_FindLowestCeilingSurrounding(sec);
- door->topheight -= 4*FRACUNIT;
- door->speed = VDOORSPEED * 4;
- if (door->topheight != sec->ceilingheight)
- S_StartSound(&door->sector->soundorg, sfx_bdopn);
- break;
-
- case normal:
- case open:
- door->direction = 1;
- door->topheight = P_FindLowestCeilingSurrounding(sec);
- door->topheight -= 4*FRACUNIT;
- if (door->topheight != sec->ceilingheight)
- S_StartSound(&door->sector->soundorg, sfx_swish); // villsa [STRIFE] TODO - fix sounds
- break;
-
- default:
- break;
- }
-
+ sec = &sectors[secnum];
+ if(sec->specialdata)
+ continue;
+
+
+ // new door thinker
+ rtn = 1;
+ door = Z_Malloc (sizeof(*door), PU_LEVSPEC, 0);
+ P_AddThinker (&door->thinker);
+ sec->specialdata = door;
+
+ door->thinker.function.acp1 = (actionf_p1)T_VerticalDoor;
+ door->sector = sec;
+ door->type = type;
+ door->topwait = VDOORWAIT;
+ door->speed = VDOORSPEED;
+ R_SoundNumForDoor(door); // villsa [STRIFE] set door sounds
+
+ switch(type)
+ {
+ // villsa [STRIFE] new door type
+ case splitOpen:
+ door->direction = -2;
+ door->topheight = P_FindLowestCeilingSurrounding(sec);
+ door->topheight -= 4*FRACUNIT;
+ door->speed = FRACUNIT;
+ // yes, it using topwait to get the floor height
+ door->topwait = P_FindLowestFloorSurrounding(sec);
+ if(door->topheight == sec->ceilingheight)
+ continue;
+
+ S_StartSound(&sec->soundorg, door->opensound);
+ break;
+
+ // villsa [STRIFE] new door type
+ case splitRaiseNearest:
+ door->direction = -2;
+ door->topheight = P_FindLowestCeilingSurrounding(sec);
+ door->topheight -= 4*FRACUNIT;
+ door->speed = FRACUNIT;
+ // yes, it using topwait to get the floor height
+ door->topwait = P_FindHighestFloorSurrounding(sec);
+ if(door->topheight == sec->ceilingheight)
+ continue;
+
+ S_StartSound(&sec->soundorg, door->opensound);
+ break;
+
+ case blazeClose:
+ case shopClose: // villsa [STRIFE]
+ door->topheight = P_FindLowestCeilingSurrounding(sec);
+ door->topheight -= 4*FRACUNIT;
+ door->direction = -1;
+ door->speed = VDOORSPEED * 4;
+ S_StartSound(&door->sector->soundorg, sfx_bdcls);
+ break;
+
+ case close:
+ door->topheight = P_FindLowestCeilingSurrounding(sec);
+ door->topheight -= 4*FRACUNIT;
+ door->direction = -1;
+
+ // villsa [STRIFE] set door sounds
+ S_StartSound(&door->sector->soundorg, door->opensound);
+ break;
+
+ case close30ThenOpen:
+ door->topheight = sec->ceilingheight;
+ door->direction = -1;
+
+ // villsa [STRIFE] set door sounds
+ S_StartSound(&door->sector->soundorg, door->closesound);
+ break;
+
+ case blazeRaise:
+ case blazeOpen:
+ door->direction = 1;
+ door->topheight = P_FindLowestCeilingSurrounding(sec);
+ door->topheight -= 4*FRACUNIT;
+ door->speed = VDOORSPEED * 4;
+ if (door->topheight != sec->ceilingheight)
+ S_StartSound(&door->sector->soundorg, sfx_bdopn);
+ break;
+
+ case normal:
+ case open:
+ door->direction = 1;
+ door->topheight = P_FindLowestCeilingSurrounding(sec);
+ door->topheight -= 4*FRACUNIT;
+
+ if(door->topheight != sec->ceilingheight)
+ S_StartSound(&door->sector->soundorg, door->opensound);
+ break;
+
+ default:
+ break;
+ }
+
}
return rtn;
}
+//
+// EV_ClearForceFields
+//
+// villsa [STRIFE] new function
+//
+int EV_ClearForceFields(line_t* line)
+{
+ int secnum;
+ int rtn;
+ sector_t* sec;
+ int i;
+ line_t* secline;
+
+ secnum = -1;
+ rtn = 0;
+
+ while((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0)
+ {
+ sec = &sectors[secnum];
+ rtn = 1;
+
+ line->special = 0;
+
+ if(!sec->linecount)
+ return;
+
+ for(i = 0; i < sec->linecount; i++)
+ {
+ secline = sec->lines[i];
+ if(!(secline->flags & ML_TWOSIDED))
+ continue;
+ if(secline->special != 148)
+ continue;
+
+ secline->flags &= ~ML_BLOCKING;
+ secline->special = 0;
+ sides[secline->sidenum[0]].midtexture = 0;
+ sides[secline->sidenum[1]].midtexture = 0;
+ }
+ }
+}
+
//
// EV_VerticalDoor : open a door manually, no tag value
//
-void
-EV_VerticalDoor
-( line_t* line,
- mobj_t* thing )
+void EV_VerticalDoor(line_t* line, mobj_t* thing)
{
- player_t* player;
- int secnum;
- sector_t* sec;
- vldoor_t* door;
- int side;
+ player_t* player;
+ int secnum;
+ sector_t* sec;
+ vldoor_t* door;
+ int side;
side = 0; // only front sides can be used
@@ -573,85 +673,85 @@ static slidename_t slideFrameNames[MAXSLIDEDOORS] =
{
// SIGLDR
{
- { "SIGLDR01" }, // frame1
- { "SIGLDR02" }, // frame2
- { "SIGLDR03" }, // frame3
- { "SIGLDR04" }, // frame4
- { "SIGLDR05" }, // frame5
- { "SIGLDR06" }, // frame6
- { "SIGLDR07" }, // frame7
- { "SIGLDR08" } // frame8
+ "SIGLDR01", // frame1
+ "SIGLDR02", // frame2
+ "SIGLDR03", // frame3
+ "SIGLDR04", // frame4
+ "SIGLDR05", // frame5
+ "SIGLDR06", // frame6
+ "SIGLDR07", // frame7
+ "SIGLDR08" // frame8
},
// DORSTN
{
- { "DORSTN01" }, // frame1
- { "DORSTN02" }, // frame2
- { "DORSTN03" }, // frame3
- { "DORSTN04" }, // frame4
- { "DORSTN05" }, // frame5
- { "DORSTN06" }, // frame6
- { "DORSTN07" }, // frame7
- { "DORSTN08" } // frame8
+ "DORSTN01", // frame1
+ "DORSTN02", // frame2
+ "DORSTN03", // frame3
+ "DORSTN04", // frame4
+ "DORSTN05", // frame5
+ "DORSTN06", // frame6
+ "DORSTN07", // frame7
+ "DORSTN08" // frame8
},
// DORQTR
{
- { "DORQTR01" }, // frame1
- { "DORQTR02" }, // frame2
- { "DORQTR03" }, // frame3
- { "DORQTR04" }, // frame4
- { "DORQTR05" }, // frame5
- { "DORQTR06" }, // frame6
- { "DORQTR07" }, // frame7
- { "DORQTR08" } // frame8
+ "DORQTR01", // frame1
+ "DORQTR02", // frame2
+ "DORQTR03", // frame3
+ "DORQTR04", // frame4
+ "DORQTR05", // frame5
+ "DORQTR06", // frame6
+ "DORQTR07", // frame7
+ "DORQTR08" // frame8
},
// DORCRG
{
- { "DORCRG01" }, // frame1
- { "DORCRG02" }, // frame2
- { "DORCRG03" }, // frame3
- { "DORCRG04" }, // frame4
- { "DORCRG05" }, // frame5
- { "DORCRG06" }, // frame6
- { "DORCRG07" }, // frame7
- { "DORCRG08" } // frame8
+ "DORCRG01", // frame1
+ "DORCRG02", // frame2
+ "DORCRG03", // frame3
+ "DORCRG04", // frame4
+ "DORCRG05", // frame5
+ "DORCRG06", // frame6
+ "DORCRG07", // frame7
+ "DORCRG08" // frame8
},
// DORCHN
{
- { "DORCHN01" }, // frame1
- { "DORCHN02" }, // frame2
- { "DORCHN03" }, // frame3
- { "DORCHN04" }, // frame4
- { "DORCHN05" }, // frame5
- { "DORCHN06" }, // frame6
- { "DORCHN07" }, // frame7
- { "DORCHN08" } // frame8
+ "DORCHN01", // frame1
+ "DORCHN02", // frame2
+ "DORCHN03", // frame3
+ "DORCHN04", // frame4
+ "DORCHN05", // frame5
+ "DORCHN06", // frame6
+ "DORCHN07", // frame7
+ "DORCHN08" // frame8
},
// DORIRS
{
- { "DORIRS01" }, // frame1
- { "DORIRS02" }, // frame2
- { "DORIRS03" }, // frame3
- { "DORIRS04" }, // frame4
- { "DORIRS05" }, // frame5
- { "DORIRS06" }, // frame6
- { "DORIRS07" }, // frame7
- { "DORIRS08" } // frame8
+ "DORIRS01", // frame1
+ "DORIRS02", // frame2
+ "DORIRS03", // frame3
+ "DORIRS04", // frame4
+ "DORIRS05", // frame5
+ "DORIRS06", // frame6
+ "DORIRS07", // frame7
+ "DORIRS08" // frame8
},
// DORALN
{
- { "DORALN01" }, // frame1
- { "DORALN02" }, // frame2
- { "DORALN03" }, // frame3
- { "DORALN04" }, // frame4
- { "DORALN05" }, // frame5
- { "DORALN06" }, // frame6
- { "DORALN07" }, // frame7
- { "DORALN08" } // frame8
+ "DORALN01", // frame1
+ "DORALN02", // frame2
+ "DORALN03", // frame3
+ "DORALN04", // frame4
+ "DORALN05", // frame5
+ "DORALN06", // frame6
+ "DORALN07", // frame7
+ "DORALN08" // frame8
},
{"\0","\0","\0","\0","\0","\0","\0","\0"}
diff --git a/src/strife/p_enemy.c b/src/strife/p_enemy.c
index 6d6dbb09..d0c235c0 100644
--- a/src/strife/p_enemy.c
+++ b/src/strife/p_enemy.c
@@ -2342,7 +2342,7 @@ void A_MerchantPain(mobj_t* actor)
line_t junk;
junk.tag = 999;
- //EV_DoDoor(&junk, 8); // villsa [STRIFE] TODO - identify vldoor_e enum
+ EV_DoDoor(&junk, shopClose);
if(actor->target && actor->target->player)
P_NoiseAlert(actor->target, actor); // inlined in asm
diff --git a/src/strife/p_spec.c b/src/strife/p_spec.c
index 1da1265d..3b7e9602 100644
--- a/src/strife/p_spec.c
+++ b/src/strife/p_spec.c
@@ -757,12 +757,12 @@ P_CrossSpecialLine
line->special = 0;
break;
- case 40:
+ /*case 40:
// RaiseCeilingLowerFloor
EV_DoCeiling( line, raiseToHighest );
EV_DoFloor( line, lowerFloorToLowest );
line->special = 0;
- break;
+ break;*/
case 44:
// Ceiling Crush
@@ -1042,6 +1042,18 @@ P_CrossSpecialLine
// Raise Floor Turbo
EV_DoFloor(line,raiseFloorTurbo);
break;
+
+ case 174:
+ // villsa [STRIFE] Split Open
+ EV_DoDoor(line, splitOpen);
+ line->special = 0;
+ break;
+
+ case 183:
+ // villsa [STRIFE] Split Raise Nearest
+ EV_DoDoor(line, splitRaiseNearest);
+ line->special = 0;
+ break;
}
}
diff --git a/src/strife/p_spec.h b/src/strife/p_spec.h
index 763591a0..1c10287e 100644
--- a/src/strife/p_spec.h
+++ b/src/strife/p_spec.h
@@ -132,7 +132,7 @@ getNextSector
// SPECIAL
//
int EV_DoDonut(line_t* line);
-
+int EV_ClearForceFields(line_t* line); // villsa [STRIFE]
//
@@ -352,7 +352,10 @@ typedef enum
raiseIn5Mins,
blazeRaise,
blazeOpen,
- blazeClose
+ blazeClose,
+ shopClose, // villsa [STRIFE]
+ splitRaiseNearest, // villsa [STRIFE]
+ splitOpen // villsa [STRIFE]
} vldoor_e;
diff --git a/src/strife/p_switch.c b/src/strife/p_switch.c
index 6c88e885..e18ecb6f 100644
--- a/src/strife/p_switch.c
+++ b/src/strife/p_switch.c
@@ -571,6 +571,11 @@ P_UseSpecialLine
if (EV_DoDoor(line,normal))
P_ChangeSwitchTexture(line,0);
break;
+
+ case 40:
+ // villsa [STRIFE] Split Open Door
+ if(EV_DoDoor(line, splitOpen))
+ P_ChangeSwitchTexture(line, 0);
case 41:
// Lower Ceiling to Floor