Added offsetforward to A_CheckLOF.

- offsetforward is to A_SpawnItemEx's x offset property, just like offsetwidth is to y offset.
This commit is contained in:
MajorCooke 2016-03-02 19:02:20 -06:00 committed by Christoph Oelckers
parent 90cad80422
commit fb3769a730
2 changed files with 11 additions and 5 deletions

View file

@ -3734,6 +3734,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckLOF)
PARAM_FIXED_OPT (offsetheight) { offsetheight = 0; }
PARAM_FIXED_OPT (offsetwidth) { offsetwidth = 0; }
PARAM_INT_OPT (ptr_target) { ptr_target = AAPTR_DEFAULT; }
PARAM_FIXED_OPT (offsetforward) { offsetforward = 0; }
target = COPY_AAPTR(self, ptr_target == AAPTR_DEFAULT ? AAPTR_TARGET|AAPTR_PLAYER_GETTARGET|AAPTR_NULL : ptr_target); // no player-support by default
@ -3751,6 +3752,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckLOF)
}
if (flags & CLOFF_MUL_WIDTH)
{
offsetforward = FixedMul(self->radius, offsetforward);
offsetwidth = FixedMul(self->radius, offsetwidth);
}
@ -3797,9 +3799,13 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckLOF)
ang >>= ANGLETOFINESHIFT;
//pos = self->Vec2Offset(
//FixedMul(xofs, finecosine[ang]) + FixedMul(yofs, finesine[ang]),
//FixedMul(xofs, finesine[ang]) - FixedMul(yofs, finecosine[ang]));
fixedvec2 xy = self->Vec2Offset(
FixedMul(offsetwidth, finesine[ang]),
-FixedMul(offsetwidth, finecosine[ang]));
FixedMul(offsetforward, finecosine[ang]) + FixedMul(offsetwidth, finesine[ang]),
FixedMul(offsetforward, finesine[ang]) - FixedMul(offsetwidth, finecosine[ang]));
pos.x = xy.x;
pos.y = xy.y;
@ -3826,8 +3832,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckLOF)
angle_t ang = self->angle >> ANGLETOFINESHIFT;
fixedvec2 xy = self->Vec2Offset(
FixedMul(offsetwidth, finesine[ang]),
-FixedMul(offsetwidth, finecosine[ang]));
FixedMul(offsetforward, finecosine[ang]) + FixedMul(offsetwidth, finesine[ang]),
FixedMul(offsetforward, finesine[ang]) - FixedMul(offsetwidth, finecosine[ang]));
pos.x = xy.x;
pos.y = xy.y;

View file

@ -251,7 +251,7 @@ ACTOR Actor native //: Thinker
action native A_LookEx(int flags = 0, float minseedist = 0, float maxseedist = 0, float maxheardist = 0, float fov = 0, state label = "");
action native A_ClearLastHeard();
action native A_ClearTarget();
action native state A_CheckLOF(state jump, int flags = 0, float range = 0, float minrange = 0, float angle = 0, float pitch = 0, float offsetheight = 0, float offsetwidth = 0, int ptr_target = AAPTR_DEFAULT);
action native state A_CheckLOF(state jump, int flags = 0, float range = 0, float minrange = 0, float angle = 0, float pitch = 0, float offsetheight = 0, float offsetwidth = 0, int ptr_target = AAPTR_DEFAULT, float offsetforward = 0);
action native state A_JumpIfTargetInLOS (state label, float/*angle*/ fov = 0, int flags = 0, float dist_max = 0, float dist_close = 0);
action native state A_JumpIfInTargetLOS (state label, float/*angle*/ fov = 0, int flags = 0, float dist_max = 0, float dist_close = 0);
action native bool A_SelectWeapon(class<Weapon> whichweapon);