Skip to content

Commit

Permalink
Fixes for Door_AnimatedClose (#838)
Browse files Browse the repository at this point in the history
* Fixes for Door_AnimatedClose

- Fixing that Door_AnimatedClose would be activated on an already closed door (playing the sound and the 1st frame of the animation)
- There was no check if the Door is already Animated when a tag was used with Door_AnimatedClose

* Removed doubled "door->StartClosing();".
  • Loading branch information
XxMiltenXx authored and madame-rachelle committed May 14, 2019
1 parent e1f2e34 commit 0cb5ea1
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/g_shared/a_doors.cpp
Expand Up @@ -777,6 +777,9 @@ bool FLevelLocals::EV_SlidingDoor (line_t *line, AActor *actor, int tag, int spe
}
return false;
}
// Do not attempt to close the door if it already is
else if (type == DAnimatedDoor::adClose)
return false;
FDoorAnimation *anim = TexMan.FindAnimatedDoor (line->sidedef[0]->GetTexture(side_t::top));
if (anim != NULL)
{
Expand All @@ -792,8 +795,20 @@ bool FLevelLocals::EV_SlidingDoor (line_t *line, AActor *actor, int tag, int spe
sec = &sectors[secnum];
if (sec->ceilingdata != NULL)
{
// Check if the animated door is already open and waiting, if so, close it.
if (sec->ceilingdata->IsA (RUNTIME_CLASS(DAnimatedDoor)))
{
DAnimatedDoor *door = barrier_cast<DAnimatedDoor *>(sec->ceilingdata);
if (door->m_Status == DAnimatedDoor::Waiting)
{
door->StartClosing();
}
}
continue;
}
// Do not attempt to close the door if it already is
else if (type == DAnimatedDoor::adClose)
continue;

for (auto line : sec->Lines)
{
Expand Down

0 comments on commit 0cb5ea1

Please sign in to comment.