mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-11-16 01:02:03 +00:00
Add CanRaiseActor ACS function.
This commit is contained in:
parent
313b229319
commit
bb3d2fa535
3 changed files with 56 additions and 0 deletions
|
@ -4369,6 +4369,7 @@ enum EACSFunctions
|
|||
ACSF_GetArmorInfo,
|
||||
ACSF_DropInventory,
|
||||
ACSF_PickActor,
|
||||
ACSF_CanRaiseActor,
|
||||
|
||||
/* Zandronum's - these must be skipped when we reach 99!
|
||||
-100:ResetMap(0),
|
||||
|
@ -5626,6 +5627,26 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
|
|||
}
|
||||
break;
|
||||
|
||||
case ACSF_CanRaiseActor:
|
||||
if (argCount >= 1) {
|
||||
if (args[0] == 0) {
|
||||
actor = SingleActorFromTID(args[0], activator);
|
||||
if (actor != NULL) {
|
||||
return P_Thing_CanRaise(actor);
|
||||
}
|
||||
}
|
||||
|
||||
FActorIterator iterator(args[0]);
|
||||
bool canraiseall = false;
|
||||
while ((actor = iterator.Next()))
|
||||
{
|
||||
canraiseall = !P_Thing_CanRaise(actor) | canraiseall;
|
||||
}
|
||||
|
||||
return !canraiseall;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -171,6 +171,7 @@ int P_Thing_Damage (int tid, AActor *whofor0, int amount, FName type);
|
|||
void P_Thing_SetVelocity(AActor *actor, fixed_t vx, fixed_t vy, fixed_t vz, bool add, bool setbob);
|
||||
void P_RemoveThing(AActor * actor);
|
||||
bool P_Thing_Raise(AActor *thing);
|
||||
bool P_Thing_CanRaise(AActor *thing);
|
||||
const PClass *P_GetSpawnableType(int spawnnum);
|
||||
|
||||
//
|
||||
|
|
|
@ -445,6 +445,40 @@ bool P_Thing_Raise(AActor *thing)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool P_Thing_CanRaise(AActor *thing)
|
||||
{
|
||||
FState * RaiseState = thing->GetRaiseState();
|
||||
if (RaiseState == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
AActor *info = thing->GetDefault();
|
||||
|
||||
// Check against real height and radius
|
||||
int oldflags = thing->flags;
|
||||
fixed_t oldheight = thing->height;
|
||||
fixed_t oldradius = thing->radius;
|
||||
|
||||
thing->flags |= MF_SOLID;
|
||||
thing->height = info->height;
|
||||
thing->radius = info->radius;
|
||||
|
||||
bool check = P_CheckPosition (thing, thing->x, thing->y);
|
||||
|
||||
// Restore checked properties
|
||||
thing->flags = oldflags;
|
||||
thing->radius = oldradius;
|
||||
thing->height = oldheight;
|
||||
|
||||
if (!check)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void P_Thing_SetVelocity(AActor *actor, fixed_t vx, fixed_t vy, fixed_t vz, bool add, bool setbob)
|
||||
{
|
||||
if (actor != NULL)
|
||||
|
|
Loading…
Reference in a new issue