- fixed the bloodspawning completely: It has to check for parent class's states, too, so that inherited blood still works

- made the 'Spray' state in P_SpawnBlood available for all games.


SVN r3580 (trunk)
This commit is contained in:
Christoph Oelckers 2012-04-22 07:23:59 +00:00
parent bf48b7620c
commit a79bcb73ac
2 changed files with 34 additions and 16 deletions

View file

@ -232,6 +232,11 @@ struct FActorInfo
return FindState(1, &name); return FindState(1, &name);
} }
bool OwnsState(const FState *state)
{
return state >= OwnedStates && state < OwnedStates + NumOwnedStates;
}
FActorInfo *GetReplacement (bool lookskill=true); FActorInfo *GetReplacement (bool lookskill=true);
FActorInfo *GetReplacee (bool lookskill=true); FActorInfo *GetReplacee (bool lookskill=true);

View file

@ -4657,19 +4657,20 @@ void P_SpawnBlood (fixed_t x, fixed_t y, fixed_t z, angle_t dir, int damage, AAc
{ {
th->Translation = TRANSLATION(TRANSLATION_Blood, bloodcolor.a); th->Translation = TRANSLATION(TRANSLATION_Blood, bloodcolor.a);
} }
FState *state = th->FindState(NAME_Spray);
if (state != NULL)
{
if (damage > 13)
{
th->SetState (state);
}
else damage += 2;
}
// Moved out of the blood actor so that replacing blood is easier // Moved out of the blood actor so that replacing blood is easier
if (gameinfo.gametype & GAME_DoomStrifeChex) if (gameinfo.gametype & GAME_DoomStrifeChex)
{ {
if (gameinfo.gametype == GAME_Strife)
{
if (damage > 13)
{
FState *state = th->FindState(NAME_Spray);
if (state != NULL) th->SetState (state);
}
else damage += 2;
}
int advance = 0; int advance = 0;
if (damage <= 12 && damage >= 9) if (damage <= 12 && damage >= 9)
{ {
@ -4679,19 +4680,31 @@ void P_SpawnBlood (fixed_t x, fixed_t y, fixed_t z, angle_t dir, int damage, AAc
{ {
advance = 2; advance = 2;
} }
FActorInfo *ai = th->GetClass()->ActorInfo;
for (; advance > 0; --advance) PClass *cls = th->GetClass();
while (cls != RUNTIME_CLASS(AActor))
{ {
// [RH] Do not set to a state we do not own. FActorInfo *ai = cls->ActorInfo;
if (th->SpawnState + advance < ai->OwnedStates + ai->NumOwnedStates) if (ai->OwnsState(th->SpawnState))
{ {
th->SetState(th->SpawnState + advance); for (; advance > 0; --advance)
break; {
// [RH] Do not set to a state we do not own.
if (ai->OwnsState(th->SpawnState + advance))
{
th->SetState(th->SpawnState + advance);
goto statedone;
}
}
} }
cls = cls->ParentClass;
} }
} }
} }
statedone:
if (bloodtype >= 1) if (bloodtype >= 1)
P_DrawSplash2 (40, x, y, z, dir, 2, bloodcolor); P_DrawSplash2 (40, x, y, z, dir, 2, bloodcolor);
} }