bool DAnimatedDoor::StartClosing () { // CAN DOOR CLOSE? if (m_Sector->touching_thinglist != NULL) { return false; } fixed_t topdist = m_Sector->ceilingplane.d; if (MoveCeiling (2048*FRACUNIT, m_BotDist, 0, -1, false) == crushed) { return false; } MoveCeiling (2048*FRACUNIT, topdist, 1); m_Line1->flags |= ML_BLOCKING; m_Line2->flags |= ML_BLOCKING; if (m_DoorAnim->CloseSound != NAME_None) { SN_StartSequence (m_Sector, CHAN_CEILING, m_DoorAnim->CloseSound, 1); } m_Status = Closing; m_Timer = m_Speed; return true; }
DAnimatedDoor::DAnimatedDoor (sector_t *sec, line_t *line, int speed, int delay) : DMovingCeiling (sec) { fixed_t topdist; FTextureID picnum; // The DMovingCeiling constructor automatically sets up an interpolation for us. // Stop it, since the ceiling is moving instantly here. StopInterpolation(); m_WhichDoorIndex = P_FindSlidingDoorType (line->sidedef[0]->GetTexture(side_t::top)); if (m_WhichDoorIndex < 0) { Printf ("EV_SlidingDoor: Textures are not defined for sliding door!"); m_Status = Dead; return; } m_Line1 = line; m_Line2 = line; for (int i = 0; i < sec->linecount; ++i) { if (sec->lines[i] == line) continue; if (sec->lines[i]->sidedef[0]->GetTexture(side_t::top) == line->sidedef[0]->GetTexture(side_t::top)) { m_Line2 = sec->lines[i]; break; } } picnum = m_Line1->sidedef[0]->GetTexture(side_t::top); m_Line1->sidedef[0]->SetTexture(side_t::mid, picnum); m_Line2->sidedef[0]->SetTexture(side_t::mid, picnum); // don't forget texture scaling here! FTexture *tex = TexMan[picnum]; topdist = tex ? tex->GetScaledHeight() : 64; topdist = m_Sector->ceilingplane.d - topdist * m_Sector->ceilingplane.c; m_Status = Opening; m_Speed = speed; m_Delay = delay; m_Timer = m_Speed; m_Frame = 0; m_Line1->flags |= ML_BLOCKING; m_Line2->flags |= ML_BLOCKING; m_BotDist = m_Sector->ceilingplane.d; MoveCeiling (2048*FRACUNIT, topdist, 1); if (DoorAnimations[m_WhichDoorIndex].OpenSound != NAME_None) { SN_StartSequence (m_Sector, CHAN_INTERIOR, DoorAnimations[m_WhichDoorIndex].OpenSound, 1); } }
DAnimatedDoor::DAnimatedDoor (sector_t *sec, line_t *line, int speed, int delay, FDoorAnimation *anim) : DMovingCeiling (sec) { fixed_t topdist; FTextureID picnum; // The DMovingCeiling constructor automatically sets up an interpolation for us. // Stop it, since the ceiling is moving instantly here. StopInterpolation(); m_DoorAnim = anim; m_Line1 = line; m_Line2 = line; for (int i = 0; i < sec->linecount; ++i) { if (sec->lines[i] == line) continue; if (sec->lines[i]->sidedef[0]->GetTexture(side_t::top) == line->sidedef[0]->GetTexture(side_t::top)) { m_Line2 = sec->lines[i]; break; } } picnum = m_Line1->sidedef[0]->GetTexture(side_t::top); m_Line1->sidedef[0]->SetTexture(side_t::mid, picnum); m_Line2->sidedef[0]->SetTexture(side_t::mid, picnum); // don't forget texture scaling here! FTexture *tex = TexMan[picnum]; topdist = tex ? tex->GetScaledHeight() : 64; topdist = m_Sector->ceilingplane.d - topdist * m_Sector->ceilingplane.c; m_Status = Opening; m_Speed = speed; m_Delay = delay; m_Timer = m_Speed; m_Frame = 0; m_SetBlocking1 = !!(m_Line1->flags & ML_BLOCKING); m_SetBlocking2 = !!(m_Line2->flags & ML_BLOCKING); m_Line1->flags |= ML_BLOCKING; m_Line2->flags |= ML_BLOCKING; m_BotDist = m_Sector->ceilingplane.d; MoveCeiling (2048*FRACUNIT, topdist, 1); if (m_DoorAnim->OpenSound != NAME_None) { SN_StartSequence (m_Sector, CHAN_INTERIOR, m_DoorAnim->OpenSound, 1); } }
void DPillar::RunThink () { int r, s; if (m_Type == pillarBuild) { r = MoveFloor (m_FloorSpeed, m_FloorTarget, m_Crush, 1); s = MoveCeiling (m_CeilingSpeed, m_CeilingTarget, m_Crush, -1); } else { r = MoveFloor (m_FloorSpeed, m_FloorTarget, m_Crush, -1); s = MoveCeiling (m_CeilingSpeed, m_CeilingTarget, m_Crush, 1); } if (r == pastdest && s == pastdest) { m_Status = finished; PlayPillarSound(); P_SetPillarDestroy(this); } }
// // T_MoveCeiling // void DCeiling::RunThink () { EResult res; switch (m_Direction) { case 0: // IN STASIS break; case 1: // UP res = MoveCeiling (m_Speed, m_TopHeight, m_Direction); if (res == pastdest) { S_StopSound (m_Sector->soundorg); S_Sound (m_Sector->soundorg, CHAN_BODY, "plats/pt1_stop", 1, ATTN_NORM); switch (m_Type) { case ceilCrushAndRaise: m_Direction = -1; m_Speed = m_Speed1; PlayCeilingSound (); break; // movers with texture change, change the texture then get removed case genCeilingChgT: case genCeilingChg0: m_Sector->special = m_NewSpecial; case genCeilingChg: m_Sector->ceilingpic = m_Texture; // fall through default: Destroy (); break; } } break; case -1: // DOWN res = MoveCeiling (m_Speed, m_BottomHeight, m_Crush, m_Direction); if (res == pastdest) { S_StopSound (m_Sector->soundorg); S_Sound (m_Sector->soundorg, CHAN_BODY, "plats/pt1_stop", 1, ATTN_NORM); switch (m_Type) { case ceilCrushAndRaise: case ceilCrushRaiseAndStay: m_Speed = m_Speed2; m_Direction = 1; PlayCeilingSound (); break; // in the case of ceiling mover/changer, change the texture // then remove the active ceiling case genCeilingChgT: case genCeilingChg0: m_Sector->special = m_NewSpecial; case genCeilingChg: m_Sector->ceilingpic = m_Texture; // fall through default: Destroy (); break; } } else // ( res != pastdest ) { if (res == crushed) { switch (m_Type) { case ceilCrushAndRaise: case ceilLowerAndCrush: if (m_Speed1 == FRACUNIT && m_Speed2 == FRACUNIT) m_Speed = FRACUNIT / 8; break; default: break; } } } break; } }
bool P_MoveLinkedSectors(sector_t *sector, int crush, fixed_t move, bool ceiling) { extsector_t::linked::plane &scrollplane = ceiling? sector->e->Linked.Ceiling : sector->e->Linked.Floor; bool ok = true; for(unsigned i = 0; i < scrollplane.Sectors.Size(); i++) { switch(scrollplane.Sectors[i].Type) { case LINK_FLOOR: ok &= MoveFloor(scrollplane.Sectors[i].Sector, crush, move); break; case LINK_CEILING: ok &= MoveCeiling(scrollplane.Sectors[i].Sector, crush, move); break; case LINK_BOTH: if (move < 0) { ok &= MoveFloor(scrollplane.Sectors[i].Sector, crush, move); ok &= MoveCeiling(scrollplane.Sectors[i].Sector, crush, move); } else { ok &= MoveCeiling(scrollplane.Sectors[i].Sector, crush, move); ok &= MoveFloor(scrollplane.Sectors[i].Sector, crush, move); } break; case LINK_FLOORMIRROR: ok &= MoveFloor(scrollplane.Sectors[i].Sector, crush, -move); break; case LINK_CEILINGMIRROR: ok &= MoveCeiling(scrollplane.Sectors[i].Sector, crush, -move); break; case LINK_BOTHMIRROR: if (move > 0) { ok &= MoveFloor(scrollplane.Sectors[i].Sector, crush, -move); ok &= MoveCeiling(scrollplane.Sectors[i].Sector, crush, -move); } else { ok &= MoveCeiling(scrollplane.Sectors[i].Sector, crush, -move); ok &= MoveFloor(scrollplane.Sectors[i].Sector, crush, -move); } break; case LINK_FLOOR+LINK_CEILINGMIRROR: ok &= MoveFloor(scrollplane.Sectors[i].Sector, crush, move); ok &= MoveCeiling(scrollplane.Sectors[i].Sector, crush, -move); break; case LINK_CEILING+LINK_FLOORMIRROR: ok &= MoveFloor(scrollplane.Sectors[i].Sector, crush, -move); ok &= MoveCeiling(scrollplane.Sectors[i].Sector, crush, move); break; default: // all other types are invalid and have to be elimintated in the attachment stage break; } } return ok; }
void DDoor::Tick () { EResult res; if (m_Sector->floorplane.d != m_OldFloorDist) { if (!m_Sector->floordata || !m_Sector->floordata->IsKindOf(RUNTIME_CLASS(DPlat)) || !(barrier_cast<DPlat*>(m_Sector->floordata))->IsLift()) { m_OldFloorDist = m_Sector->floorplane.d; m_BotDist = m_Sector->ceilingplane.PointToDist (m_BotSpot, m_Sector->floorplane.ZatPoint (m_BotSpot)); } } switch (m_Direction) { case 0: // WAITING if (!--m_TopCountdown) { switch (m_Type) { case doorRaise: m_Direction = -1; // time to go back down DoorSound (false); break; case doorCloseWaitOpen: m_Direction = 1; DoorSound (true); break; default: break; } } break; case 2: // INITIAL WAIT if (!--m_TopCountdown) { switch (m_Type) { case doorRaiseIn5Mins: m_Direction = 1; m_Type = doorRaise; DoorSound (true); break; default: break; } } break; case -1: // DOWN res = MoveCeiling (m_Speed, m_BotDist, -1, m_Direction, false); // killough 10/98: implement gradual lighting effects if (m_LightTag != 0 && m_TopDist != -m_Sector->floorplane.d) { EV_LightTurnOnPartway (m_LightTag, FixedDiv (m_Sector->ceilingplane.d + m_Sector->floorplane.d, m_TopDist + m_Sector->floorplane.d)); } if (res == pastdest) { SN_StopSequence (m_Sector, CHAN_CEILING); switch (m_Type) { case doorRaise: case doorClose: m_Sector->ceilingdata = NULL; //jff 2/22/98 Destroy (); // unlink and free break; case doorCloseWaitOpen: m_Direction = 0; m_TopCountdown = m_TopWait; break; default: break; } } else if (res == crushed) { switch (m_Type) { case doorClose: // DO NOT GO BACK UP! break; default: m_Direction = 1; DoorSound (true); break; } } break; case 1: // UP res = MoveCeiling (m_Speed, m_TopDist, -1, m_Direction, false); // killough 10/98: implement gradual lighting effects if (m_LightTag != 0 && m_TopDist != -m_Sector->floorplane.d) { EV_LightTurnOnPartway (m_LightTag, FixedDiv (m_Sector->ceilingplane.d + m_Sector->floorplane.d, m_TopDist + m_Sector->floorplane.d)); } if (res == pastdest) { SN_StopSequence (m_Sector, CHAN_CEILING); switch (m_Type) { case doorRaise: m_Direction = 0; // wait at top m_TopCountdown = m_TopWait; break; case doorCloseWaitOpen: case doorOpen: m_Sector->ceilingdata = NULL; //jff 2/22/98 Destroy (); // unlink and free break; default: break; } } else if (res == crushed) { switch (m_Type) { case doorRaise: case doorRaiseIn5Mins: m_Direction = -1; DoorSound(false); break; default: break; } } break; } }
void DAnimatedDoor::Tick () { if (m_DoorAnim == NULL) { // can only happen when a bad savegame is loaded. Destroy(); return; } switch (m_Status) { case Dead: m_Sector->ceilingdata = NULL; Destroy (); break; case Opening: if (!m_Timer--) { if (++m_Frame >= m_DoorAnim->NumTextureFrames) { // IF DOOR IS DONE OPENING... m_Line1->flags &= ~ML_BLOCKING; m_Line2->flags &= ~ML_BLOCKING; if (m_Delay == 0) { m_Sector->ceilingdata = NULL; Destroy (); break; } m_Timer = m_Delay; m_Status = Waiting; } else { // IF DOOR NEEDS TO ANIMATE TO NEXT FRAME... m_Timer = m_Speed; m_Line1->sidedef[0]->SetTexture(side_t::mid, m_DoorAnim->TextureFrames[m_Frame]); m_Line1->sidedef[1]->SetTexture(side_t::mid, m_DoorAnim->TextureFrames[m_Frame]); m_Line2->sidedef[0]->SetTexture(side_t::mid, m_DoorAnim->TextureFrames[m_Frame]); m_Line2->sidedef[1]->SetTexture(side_t::mid, m_DoorAnim->TextureFrames[m_Frame]); } } break; case Waiting: // IF DOOR IS DONE WAITING... if (!m_Timer--) { if (!StartClosing()) { m_Timer = m_Delay; } } break; case Closing: if (!m_Timer--) { if (--m_Frame < 0) { // IF DOOR IS DONE CLOSING... MoveCeiling (2048*FRACUNIT, m_BotDist, -1); m_Sector->ceilingdata = NULL; Destroy (); // Unset blocking flags on lines that didn't start with them. Since the // ceiling is down now, we shouldn't need this flag anymore to keep things // from getting through. if (!m_SetBlocking1) { m_Line1->flags &= ~ML_BLOCKING; } if (!m_SetBlocking2) { m_Line2->flags &= ~ML_BLOCKING; } break; } else { // IF DOOR NEEDS TO ANIMATE TO NEXT FRAME... m_Timer = m_Speed; m_Line1->sidedef[0]->SetTexture(side_t::mid, m_DoorAnim->TextureFrames[m_Frame]); m_Line1->sidedef[1]->SetTexture(side_t::mid, m_DoorAnim->TextureFrames[m_Frame]); m_Line2->sidedef[0]->SetTexture(side_t::mid, m_DoorAnim->TextureFrames[m_Frame]); m_Line2->sidedef[1]->SetTexture(side_t::mid, m_DoorAnim->TextureFrames[m_Frame]); } } break; } }
void DCeiling::Tick () { EResult res; switch (m_Direction) { case 0: // IN STASIS break; case 1: // UP res = MoveCeiling (m_Speed, m_TopHeight, m_Direction); if (res == pastdest) { switch (m_Type) { case ceilCrushAndRaise: m_Direction = -1; m_Speed = m_Speed1; if (!SN_IsMakingLoopingSound (m_Sector)) PlayCeilingSound (); break; // movers with texture change, change the texture then get removed case genCeilingChgT: case genCeilingChg0: m_Sector->special = m_NewSpecial; // fall through case genCeilingChg: m_Sector->SetTexture(sector_t::ceiling, m_Texture); // fall through default: SN_StopSequence (m_Sector, CHAN_CEILING); Destroy (); break; } } break; case -1: // DOWN res = MoveCeiling (m_Speed, m_BottomHeight, m_Crush, m_Direction, m_Hexencrush); if (res == pastdest) { switch (m_Type) { case ceilCrushAndRaise: case ceilCrushRaiseAndStay: m_Speed = m_Speed2; m_Direction = 1; if (!SN_IsMakingLoopingSound (m_Sector)) PlayCeilingSound (); break; // in the case of ceiling mover/changer, change the texture // then remove the active ceiling case genCeilingChgT: case genCeilingChg0: m_Sector->special = m_NewSpecial; // fall through case genCeilingChg: m_Sector->SetTexture(sector_t::ceiling, m_Texture); // fall through default: SN_StopSequence (m_Sector, CHAN_CEILING); Destroy (); break; } } else // ( res != pastdest ) { if (res == crushed) { switch (m_Type) { case ceilCrushAndRaise: case ceilLowerAndCrush: case ceilLowerAndCrushDist: if (m_Speed1 == FRACUNIT && m_Speed2 == FRACUNIT) m_Speed = FRACUNIT / 8; break; default: break; } } } break; } }
// // T_VerticalDoor // void DDoor::RunThink () { fixed_t ceilingheight = P_CeilingHeight(m_Sector); fixed_t floorheight = P_FloorHeight(m_Sector); EResult res; switch (m_Status) { case finished: PlayDoorSound(); // fall through case destroy: P_SetDoorDestroy(this); return; case waiting: // WAITING if (!--m_TopCountdown) { switch (m_Type) { case doorRaise: // time to go back down m_Status = closing; PlayDoorSound(); break; case doorCloseWaitOpen: m_Status = opening; PlayDoorSound(); break; default: break; } } break; case init: // INITIAL WAIT if (!--m_TopCountdown) { switch (m_Type) { case doorRaiseIn5Mins: m_Type = doorRaise; m_Status = opening; PlayDoorSound(); break; default: break; } } break; case closing: res = MoveCeiling(m_Speed, floorheight, false, -1); if (m_Line && m_Line->id) { EV_LightTurnOnPartway(m_Line->id, FixedDiv(ceilingheight - floorheight, m_TopHeight - floorheight)); } if (res == pastdest) { //S_StopSound (m_Sector->soundorg); SN_StopSequence (m_Sector); switch (m_Type) { case doorRaise: case doorClose: m_Status = finished; return; case doorCloseWaitOpen: m_TopCountdown = m_TopWait; m_Status = waiting; break; default: break; } if (m_Line && m_Line->id) { EV_LightTurnOnPartway(m_Line->id, 0); } } else if (res == crushed) { switch (m_Type) { case doorClose: // DO NOT GO BACK UP! break; default: m_Status = reopening; PlayDoorSound(); break; } } break; case reopening: case opening: res = MoveCeiling(m_Speed, m_TopHeight, false, 1); if (m_Line && m_Line->id) { EV_LightTurnOnPartway(m_Line->id, FixedDiv(ceilingheight - floorheight, m_TopHeight - floorheight)); } if (res == pastdest) { //S_StopSound (m_Sector->soundorg); SN_StopSequence (m_Sector); switch (m_Type) { case doorRaise: // wait at top m_TopCountdown = m_TopWait; m_Status = waiting; break; case doorCloseWaitOpen: case doorOpen: m_Status = finished; return; default: break; } if (m_Line && m_Line->id) { EV_LightTurnOnPartway(m_Line->id, FRACUNIT); } } break; default: break; } }
// // T_MoveCeiling // void DCeiling::Tick () { EResult res; switch (m_Direction) { case 0: // IN STASIS break; case 1: // UP res = MoveCeiling (m_Speed, m_TopHeight, m_Direction); // [BC] Don't need to do anything more here if we're a client. if (( NETWORK_GetState( ) == NETSTATE_CLIENT ) || ( CLIENTDEMO_IsPlaying( ))) break; if (res == pastdest) { // [BC] If the sector has reached its destination, this is probably a good time to verify all the clients // have the correct floor/ceiling height for this sector. if ( NETWORK_GetState( ) == NETSTATE_SERVER ) { if ( m_Sector->floorOrCeiling == 0 ) SERVERCOMMANDS_SetSectorFloorPlane( ULONG( m_Sector - sectors )); else SERVERCOMMANDS_SetSectorCeilingPlane( ULONG( m_Sector - sectors )); } switch (m_Type) { case ceilCrushAndRaise: m_Direction = -1; m_Speed = m_Speed1; if (!SN_IsMakingLoopingSound (m_Sector)) PlayCeilingSound (); // [BC] If we're the server, send out a bunch of updates to clients. if ( NETWORK_GetState( ) == NETSTATE_SERVER ) { // Tell clients to change the direction of the ceiling. SERVERCOMMANDS_ChangeCeilingDirection( m_lCeilingID, m_Direction ); // Tell clients to change the speed of the ceiling. SERVERCOMMANDS_ChangeCeilingSpeed( m_lCeilingID, m_Speed ); // Potentially tell clients to stop playing a ceiling sound. if ( SN_IsMakingLoopingSound( m_Sector ) == false ) SERVERCOMMANDS_PlayCeilingSound( m_lCeilingID ); } break; // movers with texture change, change the texture then get removed case genCeilingChgT: case genCeilingChg0: m_Sector->special = m_NewSpecial; // fall through case genCeilingChg: m_Sector->SetTexture(sector_t::ceiling, m_Texture); // fall through default: // [BC] If we're the server, tell the client to destroy this ceiling. if ( NETWORK_GetState( ) == NETSTATE_SERVER ) { SERVERCOMMANDS_StopSectorSequence( m_Sector ); SERVERCOMMANDS_DestroyCeiling( m_lCeilingID ); } SN_StopSequence (m_Sector); Destroy (); break; } } break; case -1: // DOWN res = MoveCeiling (m_Speed, m_BottomHeight, m_Crush, m_Direction, m_Hexencrush); // [BC] Don't need to do anything more here if we're a client. if (( NETWORK_GetState( ) == NETSTATE_CLIENT ) || ( CLIENTDEMO_IsPlaying( ))) break; if (res == pastdest) { // [BC] If the sector has reached its destination, this is probably a good time to verify all the clients // have the correct floor/ceiling height for this sector. if ( NETWORK_GetState( ) == NETSTATE_SERVER ) { if ( m_Sector->floorOrCeiling == 0 ) SERVERCOMMANDS_SetSectorFloorPlane( ULONG( m_Sector - sectors )); else SERVERCOMMANDS_SetSectorCeilingPlane( ULONG( m_Sector - sectors )); } switch (m_Type) { case ceilCrushAndRaise: case ceilCrushRaiseAndStay: m_Speed = m_Speed2; m_Direction = 1; if (!SN_IsMakingLoopingSound (m_Sector)) PlayCeilingSound (); // [BC] If we're the server, send out a bunch of updates to clients. if ( NETWORK_GetState( ) == NETSTATE_SERVER ) { // Tell clients to change the direction of the ceiling. SERVERCOMMANDS_ChangeCeilingDirection( m_lCeilingID, m_Direction ); // Tell clients to change the speed of the ceiling. SERVERCOMMANDS_ChangeCeilingSpeed( m_lCeilingID, m_Speed ); // Potentially tell clients to stop playing a ceiling sound. if ( SN_IsMakingLoopingSound( m_Sector ) == false ) SERVERCOMMANDS_PlayCeilingSound( m_lCeilingID ); } break; // in the case of ceiling mover/changer, change the texture // then remove the active ceiling case genCeilingChgT: case genCeilingChg0: m_Sector->special = m_NewSpecial; // fall through case genCeilingChg: m_Sector->SetTexture(sector_t::ceiling, m_Texture); // fall through default: // [BC] If we're the server, tell the client to destroy this ceiling. if ( NETWORK_GetState( ) == NETSTATE_SERVER ) { SERVERCOMMANDS_StopSectorSequence( m_Sector ); SERVERCOMMANDS_DestroyCeiling( m_lCeilingID ); } SN_StopSequence (m_Sector); Destroy (); break; } } else // ( res != pastdest ) { if (res == crushed) { switch (m_Type) { case ceilCrushAndRaise: case ceilLowerAndCrush: if (m_Speed1 == FRACUNIT && m_Speed2 == FRACUNIT) { m_Speed = FRACUNIT / 8; // [BC] If we're the server, tell clients to change the ceiling's speed. if ( NETWORK_GetState( ) == NETSTATE_SERVER ) SERVERCOMMANDS_ChangeCeilingSpeed( m_lCeilingID, m_Speed ); } break; default: break; } } } break; } }
// // T_VerticalDoor // void DDoor::RunThink () { EResult res; switch (m_Direction) { case 0: // WAITING if (!--m_TopCountdown) { switch (m_Type) { case doorRaise: m_Direction = -1; // time to go back down DoorSound (false); break; case doorCloseWaitOpen: m_Direction = 1; DoorSound (true); break; default: break; } } break; case 2: // INITIAL WAIT if (!--m_TopCountdown) { switch (m_Type) { case doorRaiseIn5Mins: m_Direction = 1; m_Type = doorRaise; DoorSound (true); break; default: break; } } break; case -1: // DOWN res = MoveCeiling (m_Speed, m_Sector->floorheight, false, m_Direction); if (m_Line && m_Line->id) { EV_LightTurnOnPartway(m_Line->id, FixedDiv( m_Sector->ceilingheight - m_Sector->floorheight, m_TopHeight - m_Sector->floorheight ) ); } if (res == pastdest) { //S_StopSound (m_Sector->soundorg); switch (m_Type) { case doorRaise: case doorClose: m_Sector->ceilingdata = NULL; //jff 2/22/98 Destroy (); // unlink and free break; case doorCloseWaitOpen: m_Direction = 0; m_TopCountdown = m_TopWait; break; default: break; } if (m_Line && m_Line->id) { EV_LightTurnOnPartway(m_Line->id, 0); } } else if (res == crushed) { switch (m_Type) { case doorClose: // DO NOT GO BACK UP! break; default: m_Direction = 1; DoorSound (true); break; } } break; case 1: // UP res = MoveCeiling (m_Speed, m_TopHeight, false, m_Direction); if (m_Line && m_Line->id) { EV_LightTurnOnPartway(m_Line->id, FixedDiv( m_Sector->ceilingheight - m_Sector->floorheight, m_TopHeight - m_Sector->floorheight ) ); } if (res == pastdest) { //S_StopSound (m_Sector->soundorg); switch (m_Type) { case doorRaise: m_Direction = 0; // wait at top m_TopCountdown = m_TopWait; break; case doorCloseWaitOpen: case doorOpen: m_Sector->ceilingdata = NULL; //jff 2/22/98 Destroy (); // unlink and free break; default: break; } if (m_Line && m_Line->id) { EV_LightTurnOnPartway(m_Line->id, FRACUNIT); } } break; } }
void DAnimatedDoor::Tick () { FDoorAnimation &ani = DoorAnimations[m_WhichDoorIndex]; switch (m_Status) { case Dead: m_Sector->ceilingdata = NULL; Destroy (); break; case Opening: if (!m_Timer--) { if (++m_Frame >= ani.NumTextureFrames) { // IF DOOR IS DONE OPENING... m_Line1->flags &= ~ML_BLOCKING; m_Line2->flags &= ~ML_BLOCKING; if (m_Delay == 0) { m_Sector->ceilingdata = NULL; Destroy (); break; } m_Timer = m_Delay; m_Status = Waiting; } else { // IF DOOR NEEDS TO ANIMATE TO NEXT FRAME... m_Timer = m_Speed; m_Line1->sidedef[0]->SetTexture(side_t::mid, ani.TextureFrames[m_Frame]); m_Line1->sidedef[1]->SetTexture(side_t::mid, ani.TextureFrames[m_Frame]); m_Line2->sidedef[0]->SetTexture(side_t::mid, ani.TextureFrames[m_Frame]); m_Line2->sidedef[1]->SetTexture(side_t::mid, ani.TextureFrames[m_Frame]); } } break; case Waiting: // IF DOOR IS DONE WAITING... if (!m_Timer--) { if (!StartClosing()) { m_Timer = m_Delay; } } break; case Closing: if (!m_Timer--) { if (--m_Frame < 0) { // IF DOOR IS DONE CLOSING... MoveCeiling (2048*FRACUNIT, m_BotDist, -1); m_Sector->ceilingdata = NULL; Destroy (); break; } else { // IF DOOR NEEDS TO ANIMATE TO NEXT FRAME... m_Timer = m_Speed; m_Line1->sidedef[0]->SetTexture(side_t::mid, ani.TextureFrames[m_Frame]); m_Line1->sidedef[1]->SetTexture(side_t::mid, ani.TextureFrames[m_Frame]); m_Line2->sidedef[0]->SetTexture(side_t::mid, ani.TextureFrames[m_Frame]); m_Line2->sidedef[1]->SetTexture(side_t::mid, ani.TextureFrames[m_Frame]); } } break; } }