//================================================================== // // 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; 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(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; } }
// // 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; } }