Skip to content

Commit

Permalink
Fixed: "Bad guys slow to wake up" (see here http://sourceforge.net/tr…
Browse files Browse the repository at this point in the history
  • Loading branch information
danij committed Jun 5, 2009
1 parent 1a6db4b commit 8b76d4d
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 14 deletions.
3 changes: 2 additions & 1 deletion doomsday/engine/api/doomsday.h
Expand Up @@ -251,7 +251,8 @@ extern "C" {
boolean P_PathTraverse(float x1, float y1, float x2, float y2,
int flags,
boolean (*trav) (intercept_t*));
boolean P_CheckLineSight(const float from[3], const float to[3]);
boolean P_CheckLineSight(const float from[3], const float to[3],
float bottomSlope, float topSlope);

// Play: Controls.
void P_NewPlayerControl(int id, controltype_t type, const char* name, const char* bindContext);
Expand Down
3 changes: 2 additions & 1 deletion doomsday/engine/portable/include/p_sight.h
Expand Up @@ -29,6 +29,7 @@
#ifndef __DOOMSDAY_PLAY_SIGHT_H__
#define __DOOMSDAY_PLAY_SIGHT_H__

boolean P_CheckLineSight(const float from[3], const float to[3]);
boolean P_CheckLineSight(const float from[3], const float to[3],
float bottomSlope, float topSlope);

#endif
7 changes: 4 additions & 3 deletions doomsday/engine/portable/src/p_sight.c
Expand Up @@ -245,13 +245,14 @@ static boolean crossBSPNode(unsigned int bspNum, losdata_t* los)
* @return @c true if the traverser function returns @c true
* for all visited lines.
*/
boolean P_CheckLineSight(const float from[3], const float to[3])
boolean P_CheckLineSight(const float from[3], const float to[3],
float bottomSlope, float topSlope)
{
losdata_t los;

los.startZ = from[VZ];
los.topSlope = to[VZ] + 1 - los.startZ;
los.bottomSlope = to[VZ] - 1 - los.startZ;
los.topSlope = to[VZ] + topSlope - los.startZ;
los.bottomSlope = to[VZ] + bottomSlope - los.startZ;
los.trace.pos[VX] = FLT2FIX(from[VX]);
los.trace.pos[VY] = FLT2FIX(from[VY]);
los.trace.dX = FLT2FIX(to[VX] - from[VX]);
Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/portable/src/rend_bias.c
Expand Up @@ -1205,7 +1205,7 @@ void SB_EvalPoint(float light[4], vertexillum_t* illum,
V3_Scale(surfacePoint, 1.f / 100);
V3_Sum(surfacePoint, surfacePoint, point);

if(useSightCheck && !P_CheckLineSight(s->pos, surfacePoint))
if(useSightCheck && !P_CheckLineSight(s->pos, surfacePoint, -1, 1))
{
// LOS fail.
if(casted)
Expand Down
10 changes: 2 additions & 8 deletions doomsday/plugins/common/src/p_map.c
Expand Up @@ -216,7 +216,7 @@ static boolean checkReject(subsector_t* a, subsector_t* b)
*/
boolean P_CheckSight(const mobj_t* from, const mobj_t* to)
{
float fPos[3], tPos[3];
float fPos[3];

// If either is unlinked, they can't see each other.
if(!from->subsector || !to->subsector)
Expand All @@ -236,13 +236,7 @@ boolean P_CheckSight(const mobj_t* from, const mobj_t* to)
if(!P_MobjIsCamera(from))
fPos[VZ] += from->height + -(from->height / 4);

tPos[VX] = to->pos[VX];
tPos[VY] = to->pos[VY];
tPos[VZ] = to->pos[VZ];

tPos[VZ] += to->height;

return P_CheckLineSight(fPos, tPos);
return P_CheckLineSight(fPos, to->pos, 0, to->height);
}

boolean PIT_StompThing(mobj_t* mo, void* data)
Expand Down

0 comments on commit 8b76d4d

Please sign in to comment.