mirror of
https://github.com/DrBeef/Raze.git
synced 2025-03-24 18:12:00 +00:00
- added missing distance check for sprites to hitscan.
This commit is contained in:
parent
dcd4ee133b
commit
0501482160
2 changed files with 7 additions and 5 deletions
|
@ -1247,10 +1247,12 @@ int hitscan(const vec3_t& start, const sectortype* startsect, const vec3_t& dire
|
|||
case 0:
|
||||
{
|
||||
auto v = hitinfo.hitpos;
|
||||
if (intersectSprite(actor, DVector3(sv->X * inttoworld, sv->Y * inttoworld, sv->Z * zinttoworld),
|
||||
DVector3(vx * inttoworld, vy * inttoworld, vz * zinttoworld), v, 0) )
|
||||
DVector3 start(sv->X * inttoworld, sv->Y * inttoworld, sv->Z * zinttoworld);
|
||||
DVector3 direction(vx * inttoworld, vy * inttoworld, vz * zinttoworld);
|
||||
if (intersectSprite(actor, start, direction, v, 0))
|
||||
{
|
||||
hit_set(&hitinfo, sec, nullptr, actor, v.X * worldtoint, v.Y * worldtoint, v.Z * zworldtoint);
|
||||
if ((v.XY() - start.XY()).Sum() < (hitinfo.hitpos.XY() - start.XY()).Sum())
|
||||
hit_set(&hitinfo, sec, nullptr, actor, v.X * worldtoint, v.Y * worldtoint, v.Z * zworldtoint);
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
@ -310,13 +310,13 @@ struct TVector2
|
|||
}
|
||||
|
||||
// Returns a vector rotated 90 degrees clockwise.
|
||||
TVector2 Rotated90CW()
|
||||
TVector2 Rotated90CW() const
|
||||
{
|
||||
return TVector2(Y, -X);
|
||||
}
|
||||
|
||||
// Returns a vector rotated 90 degrees counterclockwise.
|
||||
TVector2 Rotated90CCW()
|
||||
TVector2 Rotated90CCW() const
|
||||
{
|
||||
return TVector2(-Y, X);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue