void T_BuildPillar(pillar_t *pillar) { DENG2_ASSERT(pillar); // First, raise the floor result_e res1 = T_MovePlane(pillar->sector, pillar->floorSpeed, pillar->floorDest, pillar->crush, 0, pillar->direction); // floorOrCeiling, direction // Then, lower the ceiling result_e res2 = T_MovePlane(pillar->sector, pillar->ceilingSpeed, pillar->ceilingDest, pillar->crush, 1, -pillar->direction); if(res1 == pastdest && res2 == pastdest) { P_ToXSector(pillar->sector)->specialData = 0; SN_StopSequenceInSec(pillar->sector); P_NotifySectorFinished(P_ToXSector(pillar->sector)->tag); Thinker_Remove(&pillar->thinker); } }
void T_BuildPillar(pillar_t *pillar) { result_e res1; result_e res2; // First, raise the floor res1 = T_MovePlane(pillar->sector, pillar->floorSpeed, pillar->floordest, pillar->crush, 0, pillar->direction); // floorOrCeiling, direction // Then, lower the ceiling res2 = T_MovePlane(pillar->sector, pillar->ceilingSpeed, pillar->ceilingdest, pillar->crush, 1, -pillar->direction); if (res1 == RES_PASTDEST && res2 == RES_PASTDEST) { pillar->sector->specialdata = NULL; SN_StopSequence((mobj_t *)&pillar->sector->soundorg); P_TagFinished(pillar->sector->tag); P_RemoveThinker(&pillar->thinker); } }
// // MOVE AN ELEVATOR TO IT'S DESTINATION (UP OR DOWN) // // Called once per tick for each moving floor. // Passed an elevator_t structure that contains all pertinent info // about the move. Supports parallel floor/ceiling motion. // // This is from Boom. // void T_MoveElevator(elevator_t *elevator) { result_e res; if (elevator->direction < 0) // moving down { res = T_MovePlane(elevator->sector, elevator->speed, // move floor elevator->ceilingdestheight, 0, 1, elevator->direction); if (res == ok || res == pastdest) // don't move ceil if blocked T_MovePlane(elevator->sector, elevator->speed, // move ceil elevator->floordestheight, 0, 0, elevator->direction ); } else // moving down { res = T_MovePlane(elevator->sector, elevator->speed, elevator->floordestheight, 0, 0, elevator->direction); if (res == ok || res == pastdest) // don't move floor if blocked T_MovePlane(elevator->sector, elevator->speed, elevator->ceilingdestheight, 0, 1, elevator->direction); } // make floor move sound if (!(leveltime & 7)) S_StartSound((mobj_t *)&elevator->sector->soundorg, sfx_stnmov); if (res == pastdest) // if destination height archived { elevator->sector->floordata = (void *)0; elevator->sector->ceilingdata = (void *)0; P_RemoveThinker(&elevator->thinker); // make flor stop sound S_StartSound((mobj_t *)&elevator->sector->soundorg, sfx_pstop); } }
// // MOVE A FLOOR TO IT'S DESTINATION (UP OR DOWN) // void T_MoveFloor(floormove_t* floor) { result_e res; res = T_MovePlane(floor->sector, floor->speed, floor->floordestheight, floor->crush,0,floor->direction); if (!(leveltime&7)) S_StartSound((mobj_t *)&floor->sector->soundorg, sfx_stnmov); if (res == pastdest) { floor->sector->specialdata = NULL; if (floor->direction == 1) { switch(floor->type) { case donutRaise: floor->sector->special = floor->newspecial; floor->sector->floorpic = floor->texture; default: break; } } else if (floor->direction == -1) { switch(floor->type) { case lowerAndChange: floor->sector->special = floor->newspecial; floor->sector->floorpic = floor->texture; default: break; } } P_RemoveThinker(&floor->thinker); S_StartSound((mobj_t *)&floor->sector->soundorg, sfx_pstop); } }
// // MOVE A FLOOR TO IT'S DESTINATION (UP OR DOWN) // void T_MoveFloor(floormove_t* floor) { result_e res; res = T_MovePlane(floor->sector, floor->speed, floor->floordestheight, floor->crush,0,floor->direction); if (res == pastdest) { floor->sector->specialdata = NULL; if (floor->direction == 1) { switch(floor->type) { case donutRaise: floor->sector->special = (short)floor->newspecial; floor->sector->floorpic = floor->texture; default: break; } } else if (floor->direction == -1) { switch(floor->type) { case lowerAndChange: floor->sector->special = (short)floor->newspecial; floor->sector->floorpic = floor->texture; default: break; } } P_RemoveThinker(&floor->thinker); } }
// // T_VerticalDoor // void T_VerticalDoor(vldoor_t* door) { 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((mobj_t *)&door->sector->soundorg,sfx_door2dwn); break; case normal: door->direction = -1; // time to go back down S_StartSound((mobj_t *)&door->sector->soundorg,sfx_doordown); break; case close30ThenOpen: door->direction = 1; S_StartSound((mobj_t *)&door->sector->soundorg,sfx_doorup); break; default: break; } } break; case 2: // INITIAL WAIT if(!--door->topcountdown) { switch(door->type) { case raiseIn5Mins: door->direction = 1; door->type = normal; S_StartSound((mobj_t *)&door->sector->soundorg,sfx_doorup); break; default: break; } } break; case -1: // DOWN res1 = T_MovePlane(door->sector, door->speed, door->initceiling, false, 1, -1); res2 = T_MovePlane(door->sector, door->speed, door->initceiling, false, 0, 1); if(res1 == pastdest && res2 == pastdest) { switch(door->type) { case blazeRaise: case blazeClose: door->sector->specialdata = NULL; P_RemoveThinker(&door->thinker); // unlink and free S_StartSound((mobj_t *)&door->sector->soundorg,sfx_door2dwn); break; case normal: case doorclose: door->sector->specialdata = NULL; P_RemoveThinker(&door->thinker); // unlink and free break; case close30ThenOpen: door->direction = 0; door->topcountdown = 30*30; break; default: break; } } else if(res1 == crushed) { switch(door->type) { case blazeClose: case doorclose: // DO NOT GO BACK UP! break; default: door->direction = 1; S_StartSound((mobj_t *)&door->sector->soundorg,sfx_doorup); break; } } break; case 1: // UP res1 = T_MovePlane(door->sector, door->speed, door->topheight, false, 1, 1); res2 = T_MovePlane(door->sector, door->speed, door->bottomheight, false, 0, -1); if(res1 == pastdest && res2 == pastdest) { switch(door->type) { case blazeRaise: case normal: door->direction = 0; // wait at top door->topcountdown = door->topwait; break; case close30ThenOpen: case blazeOpen: case dooropen: door->sector->specialdata = NULL; P_RemoveThinker(&door->thinker); // unlink and free break; default: break; } } break; } }
// // Move a plat up and down // void T_PlatRaise(plat_t *plat) { result_e res; if (freeze) return; switch (plat->status) { case up: res = T_MovePlane(plat->sector, plat->speed, plat->high, plat->crush, 0, 1, false); if (plat->type == raiseAndChange || plat->type == raiseToNearestAndChange) if (!(leveltime & 7) && plat->sector->floorheight != plat->high) S_StartSectorSound(&plat->sector->soundorg, sfx_stnmov); if (res == crushed && !plat->crush) { plat->count = plat->wait; plat->status = down; S_StartSectorSound(&plat->sector->soundorg, sfx_pstart); } else { if (res == pastdest) { // if not an instant toggle type, wait, make plat stop sound if (plat->type != toggleUpDn) { plat->count = plat->wait; plat->status = waiting; S_StartSectorSound(&plat->sector->soundorg, sfx_pstop); } else // else go into stasis awaiting next toggle activation { plat->oldstatus = plat->status; // jff 3/14/98 after action wait plat->status = in_stasis; // for reactivation of toggle } switch (plat->type) { case blazeDWUS: case downWaitUpStay: case raiseAndChange: case raiseToNearestAndChange: case genLift: P_RemoveActivePlat(plat); break; default: break; } } } break; case down: res = T_MovePlane(plat->sector, plat->speed, plat->low, false, 0, -1, false); if (res == pastdest) { // if not an instant toggle, start waiting, make plat stop sound if (plat->type != toggleUpDn) // jff 3/14/98 toggle up down { // is silent, instant, no waiting plat->count = plat->wait; plat->status = waiting; S_StartSectorSound(&plat->sector->soundorg, sfx_pstop); } else // instant toggles go into stasis awaiting next activation { plat->oldstatus = plat->status; // jff 3/14/98 after action wait plat->status = in_stasis; // for reactivation of toggle } // jff 1/26/98 remove the plat if it bounced so it can be tried again // only affects plats that raise and bounce switch (plat->type) { case raiseAndChange: case raiseToNearestAndChange: P_RemoveActivePlat(plat); default: break; } } break; case waiting: if (!--plat->count) { plat->status = (plat->sector->floorheight == plat->low ? up : down); S_StartSectorSound(&plat->sector->soundorg, sfx_pstart); } break; case in_stasis: break; } }
void T_PlatRaise(void *platThinkerPtr) { plat_t *plat = (plat_t *)platThinkerPtr; result_e res; switch(plat->state) { case PS_UP: res = T_MovePlane(plat->sector, plat->speed, plat->high, plat->crush, 0, 1); // Play a "while-moving" sound? #if __JHERETIC__ if(!(mapTime & 31)) S_PlaneSound((Plane *)P_GetPtrp(plat->sector, DMU_FLOOR_PLANE), SFX_PLATFORMMOVE); #endif #if __JDOOM__ || __JDOOM64__ if(plat->type == PT_RAISEANDCHANGE || plat->type == PT_RAISETONEARESTANDCHANGE) { if(!(mapTime & 7)) S_PlaneSound((Plane *)P_GetPtrp(plat->sector, DMU_FLOOR_PLANE), SFX_PLATFORMMOVE); } #endif if(res == crushed && (!plat->crush)) { plat->count = plat->wait; plat->state = PS_DOWN; #if __JHEXEN__ SN_StartSequenceInSec(plat->sector, SEQ_PLATFORM); #else # if __JDOOM64__ if(plat->type != PT_DOWNWAITUPDOOR) // jd64 added test # endif S_PlaneSound((Plane *)P_GetPtrp(plat->sector, DMU_FLOOR_PLANE), SFX_PLATFORMSTART); #endif } else { if(res == pastdest) { plat->count = plat->wait; plat->state = PS_WAIT; #if __JHEXEN__ SN_StopSequenceInSec(plat->sector); #else S_PlaneSound((Plane *)P_GetPtrp(plat->sector, DMU_FLOOR_PLANE), SFX_PLATFORMSTOP); #endif switch(plat->type) { case PT_DOWNWAITUPSTAY: #if __JHEXEN__ case PT_DOWNBYVALUEWAITUPSTAY: #else # if !__JHERETIC__ case PT_DOWNWAITUPSTAYBLAZE: case PT_RAISETONEARESTANDCHANGE: # endif # if __JDOOM64__ case PT_DOWNWAITUPPLUS16STAYBLAZE: // jd64 case PT_DOWNWAITUPDOOR: // jd64 # endif case PT_RAISEANDCHANGE: #endif stopPlat(plat); break; default: break; } } } break; case PS_DOWN: res = T_MovePlane(plat->sector, plat->speed, plat->low, false, 0, -1); if(res == pastdest) { plat->count = plat->wait; plat->state = PS_WAIT; #if __JHEXEN__ || __JDOOM64__ switch(plat->type) { # if __JHEXEN__ case PT_UPBYVALUEWAITDOWNSTAY: # endif case PT_UPWAITDOWNSTAY: stopPlat(plat); break; default: break; } #endif #if __JHEXEN__ SN_StopSequenceInSec(plat->sector); #else S_PlaneSound((Plane *)P_GetPtrp(plat->sector, DMU_FLOOR_PLANE), SFX_PLATFORMSTOP); #endif } else { // Play a "while-moving" sound? #if __JHERETIC__ if(!(mapTime & 31)) S_PlaneSound((Plane *)P_GetPtrp(plat->sector, DMU_FLOOR_PLANE), SFX_PLATFORMMOVE); #endif } break; case PS_WAIT: if(!--plat->count) { if(FEQUAL(P_GetDoublep(plat->sector, DMU_FLOOR_HEIGHT), plat->low)) plat->state = PS_UP; else plat->state = PS_DOWN; #if __JHEXEN__ SN_StartSequenceInSec(plat->sector, SEQ_PLATFORM); #else S_PlaneSound((Plane *)P_GetPtrp(plat->sector, DMU_FLOOR_PLANE), SFX_PLATFORMSTART); #endif } break; default: break; } }
// // EV_SlidingDoor // // villsa [STRIFE] // void EV_SlidingDoor(line_t* line, mobj_t* thing) { sector_t* sec; slidedoor_t* door; int i; line_t* secline; // Make sure door isn't already being animated sec = sides[line->sidenum[1]].sector; door = NULL; if(sec->specialdata) { if (!thing->player) return; door = sec->specialdata; if(door->type == sdt_openAndClose) { if(door->status == sd_waiting) { door->status = sd_closing; door->timer = SWAITTICS; // villsa [STRIFE] } } else return; } // Init sliding door vars if(!door) { door = Z_Malloc (sizeof(*door), PU_LEVSPEC, 0); P_AddThinker (&door->thinker); sec->specialdata = door; door->type = sdt_openAndClose; door->status = sd_opening; door->whichDoorIndex = P_FindSlidingDoorType(line); // villsa [STRIFE] different error message if(door->whichDoorIndex < 0) I_Error(DEH_String("EV_SlidingDoor: Textures are not defined for sliding door!")); sides[line->sidenum[0]].midtexture = sides[line->sidenum[0]].toptexture; // villsa [STRIFE] door->line1 = line; door->line2 = line; // villsa [STRIFE] this loop assumes that the sliding door is made up // of only four linedefs! for(i = 0; i < 4; i++) { secline = sec->lines[i]; if(secline != line) { side_t* side1; side_t* side2; side1 = &sides[secline->sidenum[0]]; side2 = &sides[line->sidenum[0]]; if(side1->toptexture == side2->toptexture) door->line2 = secline; } } door->thinker.function.acp1 = (actionf_p1)T_SlidingDoor; door->timer = SWAITTICS; door->frontsector = sec; door->frame = 0; // villsa [STRIFE] preset flags door->line1->flags |= ML_BLOCKING; door->line2->flags |= ML_BLOCKING; // villsa [STRIFE] set the closing sector T_MovePlane( door->frontsector, (128*FRACUNIT), P_FindLowestCeilingSurrounding(door->frontsector), 0, 1, 1); // villsa [STRIFE] play open sound S_StartSound(&door->frontsector->soundorg, slideOpenSounds[door->whichDoorIndex]); } }
// // T_MoveCeiling // void T_MoveCeiling(ceiling_t *ceiling) { result_e res; switch (ceiling->direction) { case 0: // IN STASIS break; case 1: // UP res = T_MovePlane(ceiling->sector, ceiling->speed, ceiling->topheight, false, 1, ceiling->direction); if (!(leveltime & 7) && ceiling->sector->ceilingheight != ceiling->topheight) switch (ceiling->type) { case silentCrushAndRaise: case genSilentCrusher: break; default: S_StartMapSound(&ceiling->sector->soundorg, sfx_stnmov); break; } if (res == pastdest) { switch (ceiling->type) { case raiseToHighest: case genCeiling: P_RemoveActiveCeiling(ceiling); break; // movers with texture change, change the texture then get removed case genCeilingChgT: case genCeilingChg0: ceiling->sector->special = ceiling->newspecial; case genCeilingChg: ceiling->sector->ceilingpic = ceiling->texture; P_RemoveActiveCeiling(ceiling); break; case silentCrushAndRaise: S_StartMapSound(&ceiling->sector->soundorg, sfx_pstop); case genSilentCrusher: case genCrusher: case fastCrushAndRaise: case crushAndRaise: ceiling->direction = -1; break; default: break; } } break; case -1: // DOWN res = T_MovePlane(ceiling->sector, ceiling->speed, ceiling->bottomheight, ceiling->crush, 1, ceiling->direction); if (!(leveltime & 7) && ceiling->sector->ceilingheight != ceiling->bottomheight) switch (ceiling->type) { case silentCrushAndRaise: case genSilentCrusher: break; default: S_StartMapSound(&ceiling->sector->soundorg, sfx_stnmov); } if (res == pastdest) { switch (ceiling->type) { // 02/09/98 jff change slow crushers' speed back to normal // start back up case genSilentCrusher: case genCrusher: if (ceiling->oldspeed < CEILSPEED * 3) ceiling->speed = ceiling->oldspeed; ceiling->direction = 1; // jff 2/22/98 make it go back up! break; case silentCrushAndRaise: S_StartMapSound(&ceiling->sector->soundorg, sfx_pstop); case crushAndRaise: ceiling->speed = CEILSPEED; case fastCrushAndRaise: ceiling->direction = 1; break; // in the case of ceiling mover/changer, change the texture // then remove the active ceiling case genCeilingChgT: case genCeilingChg0: ceiling->sector->special = ceiling->newspecial; case genCeilingChg: ceiling->sector->ceilingpic = ceiling->texture; P_RemoveActiveCeiling(ceiling); break; case lowerAndCrush: case lowerToFloor: case lowerToLowest: case lowerToMaxFloor: case genCeiling: P_RemoveActiveCeiling(ceiling); break; default: break; } } else { if (res == crushed) { switch (ceiling->type) { // jff 02/08/98 slow down slow crushers on obstacle case genCrusher: case genSilentCrusher: if (ceiling->oldspeed < CEILSPEED * 3) ceiling->speed = CEILSPEED / 8; break; case silentCrushAndRaise: case crushAndRaise: case lowerAndCrush: ceiling->speed = CEILSPEED / 8; break; default: break; } } } break; } }
//================================================================== // // T_VerticalDoor // //================================================================== void T_VerticalDoor(vldoor_t * door) { result_e res; switch (door->direction) { case 0: // WAITING if (!--door->topcountdown) switch (door->type) { case normal: door->direction = -1; // time to go back down S_StartSound(&door->sector->soundorg, sfx_doropn); break; case close30ThenOpen: door->direction = 1; S_StartSound(&door->sector->soundorg, sfx_doropn); 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_doropn); 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 normal: case close: door->sector->specialdata = NULL; P_RemoveThinker(&door->thinker); // unlink and free S_StartSound(&door->sector->soundorg, sfx_dorcls); break; case close30ThenOpen: door->direction = 0; door->topcountdown = 35 * 30; break; default: break; } } else if (res == crushed) { switch (door->type) { case close: // DON'T GO BACK UP! break; default: door->direction = 1; S_StartSound(&door->sector->soundorg, sfx_doropn); 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 normal: door->direction = 0; // wait at top door->topcountdown = door->topwait; break; case close30ThenOpen: case open: door->sector->specialdata = NULL; P_RemoveThinker(&door->thinker); // unlink and free S_StopSound(&door->sector->soundorg); break; default: break; } } break; } }
//================================================================== // // MOVE A FLOOR TO IT'S DESTINATION (UP OR DOWN) // //================================================================== void T_MoveFloor(floormove_t *floor) { result_e res; if(floor->resetDelayCount) { floor->resetDelayCount--; if(!floor->resetDelayCount) { floor->floordestheight = floor->resetHeight; floor->direction = -floor->direction; floor->resetDelay = 0; floor->delayCount = 0; floor->delayTotal = 0; } } if(floor->delayCount) { floor->delayCount--; if(!floor->delayCount && floor->textureChange) { floor->sector->floorpic += floor->textureChange; } return; } res = T_MovePlane(floor->sector,floor->speed, floor->floordestheight,floor->crush,0,floor->direction); if(floor->type == FLEV_RAISEBUILDSTEP) { if((floor->direction == 1 && floor->sector->floorheight >= floor->stairsDelayHeight) || (floor->direction == -1 && floor->sector->floorheight <= floor->stairsDelayHeight)) { floor->delayCount = floor->delayTotal; floor->stairsDelayHeight += floor->stairsDelayHeightDelta; } } if (res == RES_PASTDEST) { SN_StopSequence((mobj_t *)&floor->sector->soundorg); if(floor->delayTotal) { floor->delayTotal = 0; } if(floor->resetDelay) { // floor->resetDelayCount = floor->resetDelay; // floor->resetDelay = 0; return; } floor->sector->specialdata = NULL; /* if (floor->direction == 1) switch(floor->type) { case donutRaise: floor->sector->special = floor->newspecial; floor->sector->floorpic = floor->texture; default: break; } else if (floor->direction == -1) switch(floor->type) { case lowerAndChange: floor->sector->special = floor->newspecial; floor->sector->floorpic = floor->texture; default: break; } */ if(floor->textureChange) { floor->sector->floorpic -= floor->textureChange; } P_TagFinished(floor->sector->tag); P_RemoveThinker(&floor->thinker); } }
// // T_VerticalDoor // void T_VerticalDoor(vldoor_t *door) { result_e res; switch(door->direction) { case 0: // WAITING if (!--door->topcountdown) { switch(door->type) { case blazeRaise: door->direction = -1; // time to go back down S_StartSound((mobj_t *)&door->sector->soundorg, sfx_bdcls); break; case normal: door->direction = -1; // time to go back down S_StartSound((mobj_t *)&door->sector->soundorg, sfx_dorcls); break; case close30ThenOpen: door->direction = 1; S_StartSound((mobj_t *)&door->sector->soundorg, sfx_doropn); break; default: break; } } break; case 2: // INITIAL WAIT if (!--door->topcountdown) { switch(door->type) { case raiseIn5Mins: door->direction = 1; door->type = normal; S_StartSound((mobj_t *)&door->sector->soundorg, sfx_doropn); 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->ceilingdata = (void *)0; P_RemoveThinker(&door->thinker); // unlink and free S_StartSound((mobj_t *)&door->sector->soundorg, sfx_bdcls); break; case normal: case close: door->sector->ceilingdata = (void *)0; P_RemoveThinker(&door->thinker); // unlink and free break; case close30ThenOpen: door->direction = 0; door->topcountdown = 35 * 30; break; default: break; } // turn lighting off in tagged sectors of manual doors // idea taken from Boom if (door->line && door->line->tag) { switch (door->line->special) { case 1: case 31: case 26: case 27: case 28: case 32: case 33: case 34: case 117: case 118: EV_TurnTagLightsOff(door->line); 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((mobj_t *)&door->sector->soundorg, sfx_doropn); 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->ceilingdata = (void *)0; P_RemoveThinker(&door->thinker); // unlink and free break; default: break; } // turn lighting on in tagged sectors of manual doors // idea taken from Boom if (door->line && door->line->tag) { switch (door->line->special) { case 1: case 31: case 26: case 27: case 28: case 32: case 33: case 34: case 117: case 118: EV_LightTurnOn(door->line, 0); break; default: break; } } } break; } }
// // T_VerticalDoor // void T_VerticalDoor (vldoor_t* door) { result_e res; line_t* line; switch(door->direction) { case 0: // WAITING if (!--door->topcountdown) { switch(door->type) { case normal: case blazeRaise: door->direction = -1; // time to go back down T_Makedoorsound (door); break; case closeThenOpen: case close30ThenOpen: door->direction = 1; T_Makedoorsound (door); break; default: break; } } break; case 2: // INITIAL WAIT if (!--door->topcountdown) { switch(door->type) { case raiseIn5Mins: door->direction = 1; door->type = normal; T_Makedoorsound (door); break; default: break; } } break; case -1: // DOWN res = T_MovePlane(door->sector, door->speed, door->sector->floorheight, false,1,door->direction); switch (res) { case pastdest: if ((line = door->line) != NULL) EV_TurnTagLightsOff (line); switch(door->type) { case blazeRaise: case blazeClose: door->sector->ceilingdata = NULL; P_RemoveThinker (&door->thinker); // unlink and free //S_StartSound((mobj_t *)&door->sector->soundorg, sfx_bdcls); break; case normal: case normalClose: door->sector->ceilingdata = NULL; P_RemoveThinker (&door->thinker); // unlink and free break; case close30ThenOpen: door->direction = 0; door->topcountdown = 35*30; break; case closeThenOpen: door->direction = 0; door->topcountdown = door->topwait; break; default: break; } break; case crushed: switch(door->type) { case blazeClose: case normalClose: // DO NOT GO BACK UP! break; default: door->direction = 1; T_Makedoorsound (door); break; } break; default: if ((line = door->line) != NULL) { sector_t* sector; fixed_t fraction; sector = door->sector; fraction = FixedDiv (sector->ceilingheight - sector->floorheight, door->topheight - sector->floorheight); P_AdjustDoorLight (line, fraction); } break; } break; case 1: // UP res = T_MovePlane(door->sector, door->speed, door->topheight, false,1,door->direction); switch (res) { case pastdest: if ((line = door->line) != NULL) EV_LightTurnOn (line, 0); switch(door->type) { case blazeRaise: case normal: if (netgame || (!gamekeydown['`'])) // Stay open cheat { door->direction = 0; // wait at top door->topcountdown = door->topwait; break; } case closeThenOpen: case close30ThenOpen: case blazeOpen: case normalOpen: door->sector->ceilingdata = NULL; P_RemoveThinker (&door->thinker); // unlink and free break; default: break; } break; default: if ((line = door->line) != NULL) { sector_t* sector; fixed_t fraction; sector = door->sector; fraction = FixedDiv (sector->ceilingheight - sector->floorheight, door->topheight - sector->floorheight); P_AdjustDoorLight (line, fraction); } break; } break; } }
//================================================================== // // T_MoveCeiling // //================================================================== void T_MoveCeiling(ceiling_t * ceiling) { result_e res; switch (ceiling->direction) { // case 0: // IN STASIS // break; case 1: // UP res = T_MovePlane(ceiling->sector, ceiling->speed, ceiling->topheight, false, 1, ceiling->direction); if(res == RES_PASTDEST) { SN_StopSequence((mobj_t *) &ceiling->sector->soundorg); switch (ceiling->type) { case CLEV_CRUSHANDRAISE: ceiling->direction = -1; ceiling->speed = ceiling->speed * 2; break; default: P_RemoveActiveCeiling(ceiling); break; } } break; case -1: // DOWN res = T_MovePlane(ceiling->sector, ceiling->speed, ceiling->bottomheight, ceiling->crush, 1, ceiling->direction); if(res == RES_PASTDEST) { SN_StopSequence((mobj_t *) &ceiling->sector->soundorg); switch (ceiling->type) { case CLEV_CRUSHANDRAISE: case CLEV_CRUSHRAISEANDSTAY: ceiling->direction = 1; ceiling->speed = ceiling->speed / 2; break; default: P_RemoveActiveCeiling(ceiling); break; } } else if(res == RES_CRUSHED) { switch (ceiling->type) { case CLEV_CRUSHANDRAISE: case CLEV_LOWERANDCRUSH: case CLEV_CRUSHRAISEANDSTAY: //ceiling->speed = ceiling->speed/4; break; default: break; } } break; } }
/*================================================================== */ void T_VerticalDoor (vldoor_t *door) { result_e res; switch(door->direction) { case 0: /* WAITING */ if (!--door->topcountdown) switch(door->type) { case normal: door->direction = -1; /* time to go back down */ S_StartSound((mobj_t *)&door->sector->soundorg,sfx_dorcls); break; case close30ThenOpen: door->direction = 1; S_StartSound((mobj_t *)&door->sector->soundorg,sfx_doropn); break; default: break; } break; case 2: /* INITIAL WAIT */ if (!--door->topcountdown) switch(door->type) { case raiseIn5Mins: door->direction = 1; door->type = normal; S_StartSound((mobj_t *)&door->sector->soundorg,sfx_doropn); 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 normal: case close: door->sector->specialdata = NULL; P_RemoveThinker (&door->thinker); /* unlink and free */ break; case close30ThenOpen: door->direction = 0; door->topcountdown = 15*30; break; default: break; } else if (res == crushed) { door->direction = 1; S_StartSound((mobj_t *)&door->sector->soundorg,sfx_doropn); } break; case 1: /* UP */ res = T_MovePlane(door->sector,door->speed, door->topheight,false,1,door->direction); if (res == pastdest) switch(door->type) { case normal: door->direction = 0; /* wait at top */ door->topcountdown = door->topwait; break; case close30ThenOpen: case open: door->sector->specialdata = NULL; P_RemoveThinker (&door->thinker); /* unlink and free */ break; default: break; } break; } }
//================================================================== // // T_MoveCeiling // //================================================================== void T_MoveCeiling(ceiling_t * ceiling) { result_e res; switch (ceiling->direction) { case 0: // IN STASIS break; case 1: // UP res = T_MovePlane(ceiling->sector, ceiling->speed, ceiling->topheight, false, 1, ceiling->direction); if(!(leveltime & 7)) //S_StartSound((mobj_t *)&ceiling->sector->soundorg, sfx_dormov); S_SectorSound(ceiling->sector, sfx_dormov); //gi.Sv_PlaneSound(ceiling->sector, true, sfx_dormov, 7); if(res == pastdest) switch (ceiling->type) { case raiseToHighest: P_RemoveActiveCeiling(ceiling); break; case fastCrushAndRaise: case crushAndRaise: ceiling->direction = -1; break; default: break; } break; case -1: // DOWN res = T_MovePlane(ceiling->sector, ceiling->speed, ceiling->bottomheight, ceiling->crush, 1, ceiling->direction); if(!(leveltime & 7)) //S_StartSound((mobj_t *)&ceiling->sector->soundorg,sfx_dormov); S_SectorSound(ceiling->sector, sfx_dormov); //gi.Sv_PlaneSound(ceiling->sector, true, sfx_dormov, 7); if(res == pastdest) switch (ceiling->type) { case crushAndRaise: ceiling->speed = CEILSPEED; case fastCrushAndRaise: ceiling->direction = 1; break; case lowerAndCrush: case lowerToFloor: P_RemoveActiveCeiling(ceiling); break; default: break; } else if(res == crushed) switch (ceiling->type) { case crushAndRaise: case lowerAndCrush: ceiling->speed = CEILSPEED / 8; break; default: break; } break; } }
void T_PlatRaise(plat_t* plat) { result_e res; // handle plat moving, up, down, waiting, or in stasis, switch(plat->status) { case up: // plat moving up res = T_MovePlane(plat->sector,plat->speed,plat->high,plat->crush,0,1); // if a pure raise type, make the plat moving sound if (plat->type == raiseAndChange || plat->type == raiseToNearestAndChange) { if (!(leveltime&7)) S_StartSound((mobj_t *)&plat->sector->soundorg, sfx_stnmov); } // if encountered an obstacle, and not a crush type, reverse direction if (res == crushed && (!plat->crush)) { plat->count = plat->wait; plat->status = down; S_StartSound((mobj_t *)&plat->sector->soundorg, sfx_pstart); } else // else handle reaching end of up stroke { if (res == pastdest) // end of stroke { // if not an instant toggle type, wait, make plat stop sound if (plat->type!=toggleUpDn) { plat->count = plat->wait; plat->status = waiting; S_StartSound((mobj_t *)&plat->sector->soundorg, sfx_pstop); } else // else go into stasis awaiting next toggle activation { plat->oldstatus = plat->status;//jff 3/14/98 after action wait plat->status = in_stasis; //for reactivation of toggle } // lift types and pure raise types are done at end of up stroke // only the perpetual type waits then goes back up switch(plat->type) { case blazeDWUS: case downWaitUpStay: case raiseAndChange: case raiseToNearestAndChange: case genLift: P_RemoveActivePlat(plat); // killough default: break; } } } break; case down: // plat moving down res = T_MovePlane(plat->sector,plat->speed,plat->low,false,0,-1); // handle reaching end of down stroke if (res == pastdest) { // if not an instant toggle, start waiting, make plat stop sound if (plat->type!=toggleUpDn) //jff 3/14/98 toggle up down { // is silent, instant, no waiting plat->count = plat->wait; plat->status = waiting; S_StartSound((mobj_t *)&plat->sector->soundorg,sfx_pstop); } else // instant toggles go into stasis awaiting next activation { plat->oldstatus = plat->status;//jff 3/14/98 after action wait plat->status = in_stasis; //for reactivation of toggle } //jff 1/26/98 remove the plat if it bounced so it can be tried again //only affects plats that raise and bounce //killough 1/31/98: relax compatibility to demo_compatibility // remove the plat if its a pure raise type if (!comp[comp_floors]) { switch(plat->type) { case raiseAndChange: case raiseToNearestAndChange: P_RemoveActivePlat(plat); default: break; } } } break; case waiting: // plat is waiting if (!--plat->count) // downcount and check for delay elapsed { if (plat->sector->floorheight == plat->low) plat->status = up; // if at bottom, start up else plat->status = down; // if at top, start down // make plat start sound S_StartSound((mobj_t *)&plat->sector->soundorg,sfx_pstart); } break; //jff 1/27/98 don't pickup code added later to in_stasis case in_stasis: // do nothing if in stasis break; } }
// // T_MoveCeiling // // Action routine that moves ceilings. Called once per tick. // // Passed a ceiling_t structure that contains all the info about the move. // see P_SPEC.H for fields. No return value. // // jff 02/08/98 all cases with labels beginning with gen added to support // generalized line type behaviors. // void T_MoveCeiling(ceiling_t* ceiling) { result_e res; switch (ceiling->direction) { case 0: // If ceiling in stasis, do nothing break; case 1: // Ceiling is moving up res = T_MovePlane ( ceiling->sector, ceiling->speed, ceiling->topheight, false, 1, ceiling->direction ); // if not a silent crusher, make moving sound if (!(leveltime & 7)) { switch (ceiling->type) { case silentCrushAndRaise: case genSilentCrusher: break; default: S_StartSound((mobj_t*)&ceiling->sector->soundorg, sfx_stnmov); break; } } // handle reaching destination height if (res == pastdest) { switch (ceiling->type) { // plain movers are just removed case raiseToHighest: case genCeiling: P_RemoveActiveCeiling(ceiling); break; // movers with texture change, change the texture then get removed case genCeilingChgT: case genCeilingChg0: ceiling->sector->special = ceiling->newspecial; //jff 3/14/98 transfer old special field as well ceiling->sector->oldspecial = ceiling->oldspecial; case genCeilingChg: ceiling->sector->ceilingpic = ceiling->texture; P_RemoveActiveCeiling(ceiling); break; // crushers reverse direction at the top case silentCrushAndRaise: S_StartSound((mobj_t*)&ceiling->sector->soundorg, sfx_pstop); case genSilentCrusher: case genCrusher: case fastCrushAndRaise: case crushAndRaise: ceiling->direction = -1; break; default: break; } } break; case -1: // Ceiling moving down res = T_MovePlane ( ceiling->sector, ceiling->speed, ceiling->bottomheight, ceiling->crush, 1, ceiling->direction ); // if not silent crusher type make moving sound if (!(leveltime & 7)) { switch (ceiling->type) { case silentCrushAndRaise: case genSilentCrusher: break; default: S_StartSound((mobj_t*)&ceiling->sector->soundorg, sfx_stnmov); } } // handle reaching destination height if (res == pastdest) { switch (ceiling->type) { // 02/09/98 jff change slow crushers' speed back to normal // start back up case genSilentCrusher: case genCrusher: if (ceiling->oldspeed < CEILSPEED * 3) ceiling->speed = ceiling->oldspeed; ceiling->direction = 1; //jff 2/22/98 make it go back up! break; // make platform stop at bottom of all crusher strokes // except generalized ones, reset speed, start back up case silentCrushAndRaise: S_StartSound((mobj_t*)&ceiling->sector->soundorg, sfx_pstop); case crushAndRaise: ceiling->speed = CEILSPEED; case fastCrushAndRaise: ceiling->direction = 1; break; // in the case of ceiling mover/changer, change the texture // then remove the active ceiling case genCeilingChgT: case genCeilingChg0: ceiling->sector->special = ceiling->newspecial; //jff add to fix bug in special transfers from changes ceiling->sector->oldspecial = ceiling->oldspecial; case genCeilingChg: ceiling->sector->ceilingpic = ceiling->texture; P_RemoveActiveCeiling(ceiling); break; // all other case, just remove the active ceiling case lowerAndCrush: case lowerToFloor: case lowerToLowest: case lowerToMaxFloor: case genCeiling: P_RemoveActiveCeiling(ceiling); break; default: break; } } else // ( res != pastdest ) { // handle the crusher encountering an obstacle if (res == crushed) { switch (ceiling->type) { //jff 02/08/98 slow down slow crushers on obstacle case genCrusher: case genSilentCrusher: if (ceiling->oldspeed < CEILSPEED * 3) ceiling->speed = CEILSPEED / 8; break; case silentCrushAndRaise: case crushAndRaise: case lowerAndCrush: ceiling->speed = CEILSPEED / 8; break; default: break; } } } break; } }
void T_MoveCeiling (ceiling_t* ceiling) { result_e res; switch(ceiling->direction) { case 0: // IN STASIS break; case 1: // UP res = T_MovePlane(ceiling->sector, ceiling->speed, ceiling->topheight, false,1,ceiling->direction); if (!(leveltime&7)) { switch(ceiling->type) { case silentCrushAndRaise: break; default: S_StartSound((mobj_t *)&ceiling->sector->soundorg, sfx_stnmov); // ? break; } } if (res == pastdest) { switch(ceiling->type) { case raiseToHighest: P_RemoveActiveCeiling(ceiling); break; case silentCrushAndRaise: S_StartSound((mobj_t *)&ceiling->sector->soundorg, sfx_pstop); case fastCrushAndRaise: case crushAndRaise: ceiling->direction = -1; break; default: break; } } break; case -1: // DOWN res = T_MovePlane(ceiling->sector, ceiling->speed, ceiling->bottomheight, ceiling->crush,1,ceiling->direction); if (!(leveltime&7)) { switch(ceiling->type) { case silentCrushAndRaise: break; default: S_StartSound((mobj_t *)&ceiling->sector->soundorg, sfx_stnmov); } } if (res == pastdest) { switch(ceiling->type) { case silentCrushAndRaise: S_StartSound((mobj_t *)&ceiling->sector->soundorg, sfx_pstop); case crushAndRaise: ceiling->speed = CEILSPEED; case fastCrushAndRaise: ceiling->direction = 1; break; case lowerAndCrush: case lowerToFloor: P_RemoveActiveCeiling(ceiling); break; default: break; } } else // ( res != pastdest ) { if (res == crushed) { switch(ceiling->type) { case silentCrushAndRaise: case crushAndRaise: case lowerAndCrush: ceiling->speed = CEILSPEED / 8; break; default: break; } } } break; } }
//================================================================== // // T_VerticalDoor // //================================================================== void T_VerticalDoor(vldoor_t *door) { result_e res; switch(door->direction) { case 0: // WAITING if(!--door->topcountdown) switch(door->type) { case DREV_NORMAL: door->direction = -1; // time to go back down SN_StartSequence((mobj_t *)&door->sector->soundorg, SEQ_DOOR_STONE+door->sector->seqType); break; case DREV_CLOSE30THENOPEN: door->direction = 1; break; default: break; } break; case 2: // INITIAL WAIT if(!--door->topcountdown) { switch(door->type) { case DREV_RAISEIN5MINS: door->direction = 1; door->type = DREV_NORMAL; break; default: break; } } break; case -1: // DOWN res = T_MovePlane(door->sector, door->speed, door->sector->floorheight, false, 1, door->direction); if(res == RES_PASTDEST) { SN_StopSequence((mobj_t *)&door->sector->soundorg); switch(door->type) { case DREV_NORMAL: case DREV_CLOSE: door->sector->specialdata = NULL; P_TagFinished(door->sector->tag); P_RemoveThinker(&door->thinker); // unlink and free break; case DREV_CLOSE30THENOPEN: door->direction = 0; door->topcountdown = 35*30; break; default: break; } } else if(res == RES_CRUSHED) { switch(door->type) { case DREV_CLOSE: // DON'T GO BACK UP! break; default: door->direction = 1; break; } } break; case 1: // UP res = T_MovePlane(door->sector, door->speed, door->topheight, false, 1, door->direction); if(res == RES_PASTDEST) { SN_StopSequence((mobj_t *)&door->sector->soundorg); switch(door->type) { case DREV_NORMAL: door->direction = 0; // wait at top door->topcountdown = door->topwait; break; case DREV_CLOSE30THENOPEN: case DREV_OPEN: door->sector->specialdata = NULL; P_TagFinished(door->sector->tag); P_RemoveThinker (&door->thinker); // unlink and free break; default: break; } } break; } }
// // T_VerticalDoor // void T_VerticalDoor(vldoor_t* door) { 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 // 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; } }
//================================================================== // // Move a plat up and down // //================================================================== 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 (!(leveltime & 31)) { S_StartSound(&plat->sector->soundorg, sfx_stnmov); } 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); switch (plat->type) { case downWaitUpStay: P_RemoveActivePlat(plat); break; case raiseAndChange: P_RemoveActivePlat(plat); break; default: break; } } break; case down: res = T_MovePlane(plat->sector, plat->speed, plat->low, false, 0, -1); if (res == pastdest) { plat->count = plat->wait; plat->status = waiting; S_StartSound(&plat->sector->soundorg, sfx_pstop); } else { if (!(leveltime & 31)) { S_StartSound(&plat->sector->soundorg, sfx_stnmov); } } 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; } }
// // Move a plat up and down // 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((mobj_t *)&plat->sector->soundorg, sfx_secmove); } // // [d64] crushed and plat->crush is no longer used. // more likely to avoid confusion with ceilings // if(res == stop) { plat->count = plat->wait; plat->status = down; S_StartSound((mobj_t *)&plat->sector->soundorg, sfx_pstart); } else { if(res == pastdest) { plat->count = plat->wait; plat->status = waiting; S_StartSound((mobj_t *)&plat->sector->soundorg, sfx_pstop); switch(plat->type) { case blazeDWUS: case downWaitUpStay: case customDownUp: case customDownUpFast: 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(res == pastdest) { plat->count = plat->wait; plat->status = waiting; S_StartSound((mobj_t *)&plat->sector->soundorg, sfx_pstop); switch(plat->type) { case blazeUWDS: case upWaitDownStay: case customUpDown: case customUpDownFast: P_RemoveActivePlat(plat); break; default: break; } } break; case waiting: if(!--plat->count) { if(plat->sector->floorheight == plat->low) plat->status = up; else plat->status = down; S_StartSound((mobj_t *)&plat->sector->soundorg, sfx_pstart); } case in_stasis: break; } }
void T_VerticalDoor (vldoor_t* door) { result_e res; // Is the door waiting, going up, or going down? switch(door->direction) { case 0: // Door is waiting if (!--door->topcountdown) // downcount and check { switch(door->type) { case blazeRaise: case genBlazeRaise: door->direction = -1; // time to go back down S_StartSound((mobj_t *)&door->sector->soundorg,sfx_bdcls); break; case normal: case genRaise: door->direction = -1; // time to go back down S_StartSound((mobj_t *)&door->sector->soundorg,sfx_dorcls); break; case close30ThenOpen: case genCdO: door->direction = 1; // time to go back up S_StartSound((mobj_t *)&door->sector->soundorg,sfx_doropn); break; case genBlazeCdO: door->direction = 1; // time to go back up S_StartSound((mobj_t *)&door->sector->soundorg,sfx_bdopn); break; default: break; } } break; case 2: // Special case for sector type door that opens in 5 mins if (!--door->topcountdown) // 5 minutes up? { switch(door->type) { case raiseIn5Mins: door->direction = 1; // time to raise then door->type = normal; // door acts just like normal 1 DR door now S_StartSound((mobj_t *)&door->sector->soundorg,sfx_doropn); break; default: break; } } break; case -1: // Door is moving down res = T_MovePlane ( door->sector, door->speed, door->sector->floorheight, false, 1, door->direction ); /* killough 10/98: implement gradual lighting effects */ // e6y: "Tagged doors don't trigger special lighting" handled wrong // http://sourceforge.net/tracker/index.php?func=detail&aid=1411400&group_id=148658&atid=772943 // Old code: if (door->lighttag && door->topheight - door->sector->floorheight) if (door->lighttag && door->topheight - door->sector->floorheight && compatibility_level >= mbf_compatibility) EV_LightTurnOnPartway(door->line, FixedDiv(door->sector->ceilingheight - door->sector->floorheight, door->topheight - door->sector->floorheight)); // handle door reaching bottom if (res == pastdest) { switch(door->type) { // regular open and close doors are all done, remove them case blazeRaise: case blazeClose: case genBlazeRaise: case genBlazeClose: door->sector->ceilingdata = NULL; //jff 2/22/98 P_RemoveThinker (&door->thinker); // unlink and free // killough 4/15/98: remove double-closing sound of blazing doors if (comp[comp_blazing]) S_StartSound((mobj_t *)&door->sector->soundorg,sfx_bdcls); break; case normal: case closeDoor: case genRaise: case genClose: door->sector->ceilingdata = NULL; //jff 2/22/98 P_RemoveThinker (&door->thinker); // unlink and free break; // close then open doors start waiting case close30ThenOpen: door->direction = 0; door->topcountdown = TICRATE*30; break; case genCdO: case genBlazeCdO: door->direction = 0; door->topcountdown = door->topwait; // jff 5/8/98 insert delay break; default: break; } // e6y: "Tagged doors don't trigger special lighting" handled wrong // http://sourceforge.net/tracker/index.php?func=detail&aid=1411400&group_id=148658&atid=772943 if (door->lighttag && door->topheight - door->sector->floorheight && compatibility_level < mbf_compatibility) EV_LightTurnOnPartway(door->line,0); } /* jff 1/31/98 turn lighting off in tagged sectors of manual doors * killough 10/98: replaced with gradual lighting code */ else if (res == crushed) // handle door meeting obstruction on way down { switch(door->type) { case genClose: case genBlazeClose: case blazeClose: case closeDoor: // Close types do not bounce, merely wait break; case blazeRaise: case genBlazeRaise: door->direction = 1; if (!comp[comp_blazing]) { S_StartSound((mobj_t *)&door->sector->soundorg,sfx_bdopn); break; } default: // other types bounce off the obstruction door->direction = 1; S_StartSound((mobj_t *)&door->sector->soundorg,sfx_doropn); break; } } break; case 1: // Door is moving up res = T_MovePlane ( door->sector, door->speed, door->topheight, false, 1, door->direction ); /* killough 10/98: implement gradual lighting effects */ // e6y: "Tagged doors don't trigger special lighting" handled wrong // http://sourceforge.net/tracker/index.php?func=detail&aid=1411400&group_id=148658&atid=772943 // Old code: if (door->lighttag && door->topheight - door->sector->floorheight) if (door->lighttag && door->topheight - door->sector->floorheight && compatibility_level >= mbf_compatibility) EV_LightTurnOnPartway(door->line, FixedDiv(door->sector->ceilingheight - door->sector->floorheight, door->topheight - door->sector->floorheight)); // handle door reaching the top if (res == pastdest) { switch(door->type) { case blazeRaise: // regular open/close doors start waiting case normal: case genRaise: case genBlazeRaise: door->direction = 0; // wait at top with delay door->topcountdown = door->topwait; break; case close30ThenOpen: // close and close/open doors are done case blazeOpen: case openDoor: case genBlazeOpen: case genOpen: case genCdO: case genBlazeCdO: door->sector->ceilingdata = NULL; //jff 2/22/98 P_RemoveThinker (&door->thinker); // unlink and free break; default: break; } /* jff 1/31/98 turn lighting on in tagged sectors of manual doors * killough 10/98: replaced with gradual lighting code */ // e6y: "Tagged doors don't trigger special lighting" handled wrong // http://sourceforge.net/tracker/index.php?func=detail&aid=1411400&group_id=148658&atid=772943 if (door->lighttag && door->topheight - door->sector->floorheight && compatibility_level < mbf_compatibility) EV_LightTurnOnPartway(door->line,FRACUNIT); } break; } }
// // T_SlidingDoor // // villsa [STRIFE] resurrected // void T_SlidingDoor(slidedoor_t* door) { sector_t* sec; sec = door->frontsector; switch(door->status) { case sd_opening: if(!door->timer--) { if(++door->frame == SNUMFRAMES) { // IF DOOR IS DONE OPENING... door->line1->flags &= ~ML_BLOCKING; door->line2->flags &= ~ML_BLOCKING; if(door->type == sdt_openOnly) { door->frontsector->specialdata = NULL; P_RemoveThinker (&door->thinker); return; } door->timer = SDOORWAIT; door->status = sd_waiting; } else { // IF DOOR NEEDS TO ANIMATE TO NEXT FRAME... door->timer = SWAITTICS; sides[door->line2->sidenum[0]].midtexture = slideFrames[door->whichDoorIndex].frames[door->frame]; sides[door->line2->sidenum[1]].midtexture = slideFrames[door->whichDoorIndex].frames[door->frame]; sides[door->line1->sidenum[0]].midtexture = slideFrames[door->whichDoorIndex].frames[door->frame]; sides[door->line1->sidenum[1]].midtexture = slideFrames[door->whichDoorIndex].frames[door->frame]; } } return; case sd_waiting: // IF DOOR IS DONE WAITING... if(!door->timer--) { fixed_t speed; fixed_t cheight; sec = door->frontsector; // CAN DOOR CLOSE? if(sec->thinglist != NULL) { door->timer = SDOORWAIT; return; } else { cheight = sec->ceilingheight; speed = cheight - sec->floorheight - (10*FRACUNIT); // something blocking it? if(T_MovePlane(sec, speed, sec->floorheight, 0, 1, -1) == crushed) { door->timer = SDOORWAIT; return; } else { // Instantly move plane T_MovePlane(sec, (128*FRACUNIT), cheight, 0, 1, 1); // turn line blocking back on door->line1->flags |= ML_BLOCKING; door->line2->flags |= ML_BLOCKING; // play close sound S_StartSound(&sec->soundorg, slideCloseSounds[door->whichDoorIndex]); door->status = sd_closing; door->timer = SWAITTICS; } } } return; case sd_closing: if (!door->timer--) { if(--door->frame < 0) { // IF DOOR IS DONE CLOSING... T_MovePlane(sec, (128*FRACUNIT), sec->floorheight, 0, 1, -1); door->frontsector->specialdata = NULL; P_RemoveThinker (&door->thinker); return; } else { // IF DOOR NEEDS TO ANIMATE TO NEXT FRAME... door->timer = SWAITTICS; sides[door->line2->sidenum[0]].midtexture = slideFrames[door->whichDoorIndex].frames[door->frame]; sides[door->line2->sidenum[1]].midtexture = slideFrames[door->whichDoorIndex].frames[door->frame]; sides[door->line1->sidenum[0]].midtexture = slideFrames[door->whichDoorIndex].frames[door->frame]; sides[door->line1->sidenum[1]].midtexture = slideFrames[door->whichDoorIndex].frames[door->frame]; } } return; } }