diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 8f5d563efe..801efa503d 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -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; diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index ad7e9e9302..58ff4827f5 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -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 whichweapon);