- Added bounce states. Set the BOUNCE_UseBounceState flag to use them (+USEBOUNCESTATE via

DECORATE). Then you can use:
  * Bounce
  * Bounce.Floor
  * Bounce.Ceiling
  * Bounce.Wall
  * Bounce.Actor
  * Bounce.Actor.Creature
  Partial matches work just like Pain states, so if an actor bounces off a floor and you don't
  have a Bounce.Floor state, but you do have a Bounce state, it will use the Bounce state.
  Conversely, if you only have a Bounce.Floor state but no Bounce state, then the actor will
  only enter the Bounce.Floor state when it bounces on a floor; bouncing off anything else will
  not cause it to change state.

SVN r4250 (trunk)
This commit is contained in:
Randy Heit 2013-05-04 22:52:37 +00:00
commit 40f7abb8e9
5 changed files with 54 additions and 0 deletions

View file

@ -2869,6 +2869,14 @@ bool FSlide::BounceWall (AActor *mo)
}
mo->velx = FixedMul(movelen, finecosine[deltaangle]);
mo->vely = FixedMul(movelen, finesine[deltaangle]);
if (mo->BounceFlags & BOUNCE_UseBounceState)
{
FState *bouncestate = mo->FindState(NAME_Bounce, NAME_Wall);
if (bouncestate != NULL)
{
mo->SetState(bouncestate);
}
}
return true;
}
@ -2906,6 +2914,22 @@ bool P_BounceActor (AActor *mo, AActor *BlockingMobj, bool ontop)
mo->velx = FixedMul (speed, finecosine[angle]);
mo->vely = FixedMul (speed, finesine[angle]);
mo->PlayBounceSound(true);
if (mo->BounceFlags & BOUNCE_UseBounceState)
{
FName names[] = { NAME_Bounce, NAME_Actor, NAME_Creature };
FState *bouncestate;
int count = 2;
if ((BlockingMobj->flags & MF_SHOOTABLE) && !(BlockingMobj->flags & MF_NOBLOOD))
{
count = 3;
}
bouncestate = mo->FindState(count, names);
if (bouncestate != NULL)
{
mo->SetState(bouncestate);
}
}
}
else
{