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 DMover::Destroy() { StopInterpolation(); Super::Destroy(); }
void DFloor::Tick () { EMoveResult res; // [RH] Handle resetting stairs if (m_Type == buildStair || m_Type == waitStair) { if (m_ResetCount) { if (--m_ResetCount == 0) { m_Type = resetStair; m_Direction = (m_Direction > 0) ? -1 : 1; m_FloorDestDist = m_OrgDist; } } if (m_PauseTime) { m_PauseTime--; return; } else if (m_StepTime) { if (--m_StepTime == 0) { m_PauseTime = m_Delay; m_StepTime = m_PerStepTime; } } } if (m_Type == waitStair) return; res = m_Sector->MoveFloor (m_Speed, m_FloorDestDist, m_Crush, m_Direction, m_Hexencrush, m_Instant); if (res == EMoveResult::pastdest) { SN_StopSequence (m_Sector, CHAN_FLOOR); if (m_Type == buildStair) m_Type = waitStair; if (m_Type != waitStair || m_ResetCount == 0) { if (m_Direction == 1) { switch (m_Type) { case donutRaise: case genFloorChgT: case genFloorChg0: m_Sector->SetSpecial(&m_NewSpecial); //fall thru case genFloorChg: m_Sector->SetTexture(sector_t::floor, m_Texture); break; default: break; } } else if (m_Direction == -1) { switch (m_Type) { case floorLowerAndChange: case genFloorChgT: case genFloorChg0: m_Sector->SetSpecial(&m_NewSpecial); //fall thru case genFloorChg: m_Sector->SetTexture(sector_t::floor, m_Texture); break; default: break; } } m_Sector->floordata = NULL; //jff 2/22/98 StopInterpolation(); //jff 2/26/98 implement stair retrigger lockout while still building // note this only applies to the retriggerable generalized stairs if (m_Sector->stairlock == -2) // if this sector is stairlocked { sector_t *sec = m_Sector; sec->stairlock = -1; // thinker done, promote lock to -1 while (sec->prevsec != -1 && level.sectors[sec->prevsec].stairlock != -2) sec = &level.sectors[sec->prevsec]; // search for a non-done thinker if (sec->prevsec == -1) // if all thinkers previous are done { sec = m_Sector; // search forward while (sec->nextsec != -1 && level.sectors[sec->nextsec].stairlock != -2) sec = &level.sectors[sec->nextsec]; if (sec->nextsec == -1) // if all thinkers ahead are done too { while (sec->prevsec != -1) // clear all locks { sec->stairlock = 0; sec = &level.sectors[sec->prevsec]; } sec->stairlock = 0; } } } Destroy (); } } }