- scriptified the functions in a_possessed.cpp and added the needed exports and constants.

- fixed: Script functions did not receive the function name when being created.
- relaxed the asserts for PARAM_STATE, because the VM knows nothing about ATAG_STATE. Any state variable's content (e.g. Actor.SeeState) will receive ATAG_GENERIC, rather than ATAG_STATE.
- added a 'NeedResult' flag so that certain operations can create shorter code if the result of the expression is not needed. So far only used for postdecrement/increment statements on local variables (which is the most frequent case where this matters.)
- fixed postincrement and decrement for local variables. Due to the result preservation semantics it created faulty code.
This commit is contained in:
Christoph Oelckers 2016-10-26 11:30:30 +02:00
commit 823c52aeb2
16 changed files with 246 additions and 170 deletions

View file

@ -4043,6 +4043,18 @@ DAngle P_AimLineAttack(AActor *t1, DAngle angle, double distance, FTranslatedLin
return result->linetarget ? result->pitch : t1->Angles.Pitch;
}
DEFINE_ACTION_FUNCTION(AActor, AimLineAttack)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_ANGLE(angle);
PARAM_FLOAT(distance);
PARAM_POINTER_OPT(pLineTarget, FTranslatedLineTarget) { pLineTarget = nullptr; }
PARAM_ANGLE_OPT(vrange) { vrange = 0.; }
PARAM_INT_OPT(flags) { flags = 0; }
PARAM_OBJECT_OPT(target, AActor) { target = nullptr; }
PARAM_OBJECT_OPT(friender, AActor) { friender = nullptr; }
ACTION_RETURN_FLOAT(P_AimLineAttack(self, angle, distance, pLineTarget, vrange, flags, target, friender).Degrees);
}
//==========================================================================
//
@ -4410,6 +4422,25 @@ AActor *P_LineAttack(AActor *t1, DAngle angle, double distance,
}
}
DEFINE_ACTION_FUNCTION(AActor, LineAttack)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_ANGLE(angle);
PARAM_FLOAT(distance);
PARAM_ANGLE(pitch);
PARAM_INT(damage);
PARAM_NAME(damageType);
PARAM_CLASS(puffType, AActor);
PARAM_INT_OPT(flags) { flags = 0; }
PARAM_POINTER_OPT(victim, FTranslatedLineTarget) { victim = nullptr; }
int acdmg;
auto puff = P_LineAttack(self, angle, distance, pitch, damage, damageType, puffType, flags, victim, &acdmg);
if (numret > 0) ret[0].SetPointer(puff, ATAG_OBJECT);
if (numret > 1) ret[1].SetInt(acdmg), numret = 2;
return numret;
}
//==========================================================================
//
// P_LinePickActor