added SWF_SELECTPRIORITY flag to A_SelectWeapon
This commit is contained in:
parent
13fa06fe7a
commit
a1a0da1f13
3 changed files with 20 additions and 2 deletions
|
|
@ -3103,12 +3103,19 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Recoil)
|
|||
// A_SelectWeapon
|
||||
//
|
||||
//===========================================================================
|
||||
enum SW_Flags
|
||||
{
|
||||
SWF_SELECTPRIORITY = 1,
|
||||
};
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SelectWeapon)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(AActor);
|
||||
PARAM_CLASS(cls, AWeapon);
|
||||
PARAM_INT_OPT(flags) { flags = 0; }
|
||||
|
||||
if (cls == NULL || self->player == NULL)
|
||||
bool selectPriority = !!(flags & SWF_SELECTPRIORITY);
|
||||
|
||||
if ((!selectPriority && cls == NULL) || self->player == NULL)
|
||||
{
|
||||
ACTION_RETURN_BOOL(false);
|
||||
}
|
||||
|
|
@ -3123,6 +3130,14 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SelectWeapon)
|
|||
}
|
||||
ACTION_RETURN_BOOL(true);
|
||||
}
|
||||
else if (selectPriority)
|
||||
{
|
||||
// [XA] if the named weapon cannot be found (or is a dummy like 'None'),
|
||||
// select the next highest priority weapon. This is basically
|
||||
// the same as A_CheckReload minus the ammo check. Handy.
|
||||
self->player->mo->PickNewWeapon(NULL);
|
||||
ACTION_RETURN_BOOL(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
ACTION_RETURN_BOOL(false);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue