- fixed: sv_smartaim 3 treated the player like a shootable decoration.

- Added A_CheckIfInTargetLOS
- Removed redundant A_CheckIfTargetInSight.


SVN r1656 (trunk)
This commit is contained in:
Christoph Oelckers 2009-06-08 23:39:08 +00:00
parent 64b7468bf4
commit a425214432
3 changed files with 58 additions and 21 deletions

View file

@ -2926,7 +2926,7 @@ void aim_t::AimTraverse (fixed_t startx, fixed_t starty, fixed_t endx, fixed_t e
pitch_friend=thingpitch;
}
}
else if (!(th->flags3&MF3_ISMONSTER) )
else if (!(th->flags3&MF3_ISMONSTER) && th->player == NULL)
{
if (sv_smartaim < 3)
{

View file

@ -1781,24 +1781,6 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckSight)
}
//===========================================================================
//
// A_JumpIfTargetInSight
// jumps if monster can see its target
//
//===========================================================================
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfTargetInSight)
{
ACTION_PARAM_START(1);
ACTION_PARAM_STATE(jump, 0);
ACTION_SET_RESULT(false); // Jumps should never set the result for inventory state chains!
if (self->target == NULL || !P_CheckSight(self, self->target,4)) return;
ACTION_JUMP(jump);
}
//===========================================================================
//
// Inventory drop
@ -2211,6 +2193,62 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfTargetInLOS)
ACTION_JUMP(jump);
}
//==========================================================================
//
// A_JumpIfInTargetLOS (state label, optional fixed fov, optional bool
// projectiletarget)
//
//==========================================================================
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfInTargetLOS)
{
ACTION_PARAM_START(3);
ACTION_PARAM_STATE(jump, 0);
ACTION_PARAM_ANGLE(fov, 1);
ACTION_PARAM_BOOL(projtarg, 2);
angle_t an;
AActor *target;
ACTION_SET_RESULT(false); // Jumps should never set the result for inventory state chains!
if (self->flags & MF_MISSILE && projtarg)
{
if (self->flags2 & MF2_SEEKERMISSILE)
target = self->tracer;
else
target = NULL;
}
else
{
target = self->target;
}
if (!target) return; // [KS] Let's not call P_CheckSight unnecessarily in this case.
if (!P_CheckSight (target, self, 1))
return;
if (fov && (fov < ANGLE_MAX))
{
an = R_PointToAngle2 (self->x,
self->y,
target->x,
target->y)
- self->angle;
if (an > (fov / 2) && an < (ANGLE_MAX - (fov / 2)))
{
return; // [KS] Outside of FOV - return
}
}
ACTION_JUMP(jump);
}
//===========================================================================
//
// A_DamageMaster (int amount)

View file

@ -221,6 +221,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_ClearTarget();
action native A_JumpIfTargetInLOS (state label, float fov = 0, bool projectiletarget = false);
action native A_JumpIfInTargetLOS (state label, float fov = 0, bool projectiletarget = false);
action native A_DamageMaster(int amount, name damagetype = "none");
action native A_DamageChildren(int amount, name damagetype = "none");
action native A_DamageSiblings(int amount, name damagetype = "none");
@ -236,8 +237,6 @@ ACTOR Actor native //: Thinker
action native A_RemoveForcefield();
action native A_DropWeaponPieces(class<Actor> p1, class<Actor> p2, class<Actor> p3);
action native A_PigPain ();
action native A_JumpIfTargetInSight(state label);
action native A_MonsterRefire(int chance, state label);
States