Backport RETURNTID and FORCETID flags for PickActor from GLOOME. Renamed prefix to avoid confusion with Pain Attack flags. Fixed broken enum.

This commit is contained in:
John Palomo Jr 2015-11-21 06:05:16 -05:00
parent a8ac748123
commit 2612fad326

View file

@ -133,6 +133,16 @@ enum
ARMORINFO_ACTUALSAVEAMOUNT, ARMORINFO_ACTUALSAVEAMOUNT,
}; };
// PickActor
// [JP] I've renamed these flags to something else to avoid confusion with the other PAF_ flags
enum
{
// PAF_FORCETID,
// PAF_RETURNTID
PICKAF_FORCETID = 1,
PICKAF_RETURNTID = 2,
};
struct CallReturn struct CallReturn
{ {
CallReturn(int pc, ScriptFunction *func, FBehavior *module, SDWORD *locals, ACSLocalArrays *arrays, bool discard, unsigned int runaway) CallReturn(int pc, ScriptFunction *func, FBehavior *module, SDWORD *locals, ACSLocalArrays *arrays, bool discard, unsigned int runaway)
@ -5779,11 +5789,10 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
wallMask = args[6]; wallMask = args[6];
} }
bool forceTID = 0; int flags = 0;
if (argCount >= 8) if (argCount >= 8)
{ {
if (args[7] != 0) flags = args[7];
forceTID = 1;
} }
AActor* pickedActor = P_LinePickActor(actor, args[1] << 16, args[3], args[2] << 16, actorMask, wallMask); AActor* pickedActor = P_LinePickActor(actor, args[1] << 16, args[3], args[2] << 16, actorMask, wallMask);
@ -5791,15 +5800,19 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
return 0; return 0;
} }
if (!(forceTID) && (args[4] == 0) && (pickedActor->tid == 0)) if (!(flags & PICKAF_FORCETID) && (args[4] == 0) && (pickedActor->tid == 0))
return 0; return 0;
if ((pickedActor->tid == 0) || (forceTID)) if ((pickedActor->tid == 0) || (flags & PICKAF_FORCETID))
{ {
pickedActor->RemoveFromHash(); pickedActor->RemoveFromHash();
pickedActor->tid = args[4]; pickedActor->tid = args[4];
pickedActor->AddToHash(); pickedActor->AddToHash();
} }
if (flags & PICKAF_RETURNTID)
{
return pickedActor->tid;
}
return 1; return 1;
} }
break; break;