- Added FDARI's CLOFF_JUMP_ON_MISS and CLOFF_AIM_VERT_NOOFFSET flags.

SVN r4207 (trunk)
This commit is contained in:
Randy Heit 2013-03-28 01:29:23 +00:00
parent 4cf3a4a1cf
commit 147da94e2f
2 changed files with 63 additions and 52 deletions

View file

@ -2947,7 +2947,10 @@ enum CLOF_flags
CLOFF_FROMBASE = 0x40000, CLOFF_FROMBASE = 0x40000,
CLOFF_MUL_HEIGHT = 0x80000, CLOFF_MUL_HEIGHT = 0x80000,
CLOFF_MUL_WIDTH = 0x100000 CLOFF_MUL_WIDTH = 0x100000,
CLOFF_JUMP_ON_MISS = 0x200000,
CLOFF_AIM_VERT_NOOFFSET = 0x400000,
}; };
struct LOFData struct LOFData
@ -2955,6 +2958,7 @@ struct LOFData
AActor *Self; AActor *Self;
AActor *Target; AActor *Target;
int Flags; int Flags;
bool BadActor;
}; };
ETraceStatus CheckLOFTraceFunc(FTraceResults &trace, void *userdata) ETraceStatus CheckLOFTraceFunc(FTraceResults &trace, void *userdata)
@ -3025,6 +3029,7 @@ ETraceStatus CheckLOFTraceFunc(FTraceResults &trace, void *userdata)
{ {
return TRACE_Skip; return TRACE_Skip;
} }
data->BadActor = true;
return TRACE_Abort; return TRACE_Abort;
} }
@ -3124,7 +3129,14 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckLOF)
{ {
pitch += self->pitch; pitch += self->pitch;
} }
else pitch += R_PointToAngle2 (0,0, (fixed_t)xyvec.Length(), target->z - z1 + target->height / 2); else if (flags & CLOFF_AIM_VERT_NOOFFSET)
{
pitch += R_PointToAngle2 (0,0, (fixed_t)xyvec.Length(), target->z - z1 + offsetheight + target->height / 2);
}
else
{
pitch += R_PointToAngle2 (0,0, (fixed_t)xyvec.Length(), target->z - z1 + target->height / 2);
}
} }
else if (flags & CLOFF_ALLOWNULL) else if (flags & CLOFF_ALLOWNULL)
{ {
@ -3166,22 +3178,18 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckLOF)
lof_data.Self = self; lof_data.Self = self;
lof_data.Target = target; lof_data.Target = target;
lof_data.Flags = flags; lof_data.Flags = flags;
lof_data.BadActor = false;
Trace(x1, y1, z1, sec, vx, vy, vz, range, 0xFFFFFFFF, ML_BLOCKEVERYTHING, self, trace, 0, Trace(x1, y1, z1, sec, vx, vy, vz, range, 0xFFFFFFFF, ML_BLOCKEVERYTHING, self, trace, 0,
CheckLOFTraceFunc, &lof_data); CheckLOFTraceFunc, &lof_data);
if (trace.HitType == TRACE_HitActor) if (trace.HitType == TRACE_HitActor ||
((flags & CLOFF_JUMP_ON_MISS) && !lof_data.BadActor && trace.HitType != TRACE_HitNone))
{ {
if (minrange > 0) if (minrange > 0 && trace.Distance < minrange)
{
double dx = trace.Actor->x - x1,
dy = trace.Actor->y - y1,
dz = trace.Actor->z + trace.Actor->height/2 - z1;
if (dx*dx+ dy*dy+ dz*dz < (double)minrange*(double)minrange)
{ {
return; return;
} }
}
ACTION_JUMP(jump); ACTION_JUMP(jump);
} }
} }

View file

@ -337,6 +337,9 @@ enum
CLOFF_MUL_HEIGHT = 0x80000, CLOFF_MUL_HEIGHT = 0x80000,
CLOFF_MUL_WIDTH = 0x100000, CLOFF_MUL_WIDTH = 0x100000,
CLOFF_JUMP_ON_MISS = 0x200000,
CLOFF_AIM_VERT_NOOFFSET = 0x400000,
CLOFF_SKIPOBSTACLES = CLOFF_SKIPENEMY|CLOFF_SKIPFRIEND|CLOFF_SKIPOBJECT|CLOFF_SKIPNONHOSTILE, CLOFF_SKIPOBSTACLES = CLOFF_SKIPENEMY|CLOFF_SKIPFRIEND|CLOFF_SKIPOBJECT|CLOFF_SKIPNONHOSTILE,
CLOFF_NOAIM = CLOFF_NOAIM_VERT|CLOFF_NOAIM_HORZ CLOFF_NOAIM = CLOFF_NOAIM_VERT|CLOFF_NOAIM_HORZ
}; };