P_Thing_Raise fixes & cleanup

- Transfer flags directly into the function and process inside instead of the action functions
- Pass in raiser for all function calls
This commit is contained in:
Major Cooke 2018-11-17 10:44:06 -06:00 committed by Christoph Oelckers
commit a8d4d45e89
4 changed files with 17 additions and 21 deletions

View file

@ -4477,13 +4477,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_ChangeCountFlags)
return 0;
}
enum ERaise
{
RF_TRANSFERFRIENDLINESS = 1,
RF_NOCHECKPOSITION = 2
};
//===========================================================================
//
// A_RaiseMaster
@ -4494,10 +4487,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_RaiseMaster)
PARAM_SELF_PROLOGUE(AActor);
PARAM_INT_DEF(flags);
bool copy = !!(flags & RF_TRANSFERFRIENDLINESS);
if (self->master != NULL)
{
P_Thing_Raise(self->master, copy ? self : NULL, (flags & RF_NOCHECKPOSITION));
P_Thing_Raise(self->master, self, flags);
}
return 0;
}
@ -4515,12 +4507,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_RaiseChildren)
TThinkerIterator<AActor> it;
AActor *mo;
bool copy = !!(flags & RF_TRANSFERFRIENDLINESS);
while ((mo = it.Next()) != NULL)
{
if (mo->master == self)
{
P_Thing_Raise(mo, copy ? self : NULL, (flags & RF_NOCHECKPOSITION));
P_Thing_Raise(mo, self, flags);
}
}
return 0;
@ -4539,14 +4530,13 @@ DEFINE_ACTION_FUNCTION(AActor, A_RaiseSiblings)
TThinkerIterator<AActor> it;
AActor *mo;
bool copy = !!(flags & RF_TRANSFERFRIENDLINESS);
if (self->master != NULL)
{
while ((mo = it.Next()) != NULL)
{
if (mo->master == self->master && mo != self)
{
P_Thing_Raise(mo, copy ? self : NULL, (flags & RF_NOCHECKPOSITION));
P_Thing_Raise(mo, self, flags);
}
}
}
@ -4562,7 +4552,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_RaiseSelf)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_INT_DEF(flags);
ACTION_RETURN_BOOL(P_Thing_Raise(self, NULL, (flags & RF_NOCHECKPOSITION)));
ACTION_RETURN_BOOL(P_Thing_Raise(self, self, flags));
}
//===========================================================================
@ -4576,7 +4566,7 @@ DEFINE_ACTION_FUNCTION(AActor, RaiseActor)
PARAM_SELF_PROLOGUE(AActor);
PARAM_OBJECT(other, AActor);
PARAM_INT_DEF(flags);
ACTION_RETURN_BOOL(P_Thing_Raise(other, self, (flags & RF_NOCHECKPOSITION)));
ACTION_RETURN_BOOL(P_Thing_Raise(other, self, flags));
}
//===========================================================================