Blood: fixed vector math in spider attacks.

This commit is contained in:
Christoph Oelckers 2024-02-04 13:26:46 +01:00
parent 0ad7e198d8
commit 3dbc67150d
4 changed files with 6 additions and 6 deletions

View file

@ -745,7 +745,7 @@ double checkSectorPlaneHit(sectortype* sec, const DVector3& start, const DVector
//
//==========================================================================
int hitscan(const DVector3& start, const sectortype* startsect, const DVector3& vect, HitInfoBase& hitinfo, unsigned cliptype, double maxrange)
int hitscan(const DVector3& start, const sectortype* startsect, const DVector3& vect, HitInfoBase& hitinfo, unsigned cliptype, double maxrange, bool rangeisxy)
{
double hitfactor = DBL_MAX;
@ -758,7 +758,7 @@ int hitscan(const DVector3& start, const sectortype* startsect, const DVector3&
if (maxrange > 0)
{
hitfactor = maxrange / vect.Length();
hitfactor = maxrange / (rangeisxy? vect.XY().Length() : vect.Length());
hitinfo.hitpos = start + hitfactor * vect;
}
else hitinfo.hitpos.X = hitinfo.hitpos.Y = DBL_MAX;

View file

@ -215,7 +215,7 @@ double checkWallHit(walltype* wal, EWallFlags flagmask, const DVector3& start, c
double checkSectorPlaneHit(sectortype* sec, const DVector3& start, const DVector3& direction, DVector3& result, double maxfactor);
void neartag(const DVector3& start, sectortype* sect, DAngle angle, HitInfoBase& result, double neartagrange, int tagsearch);
int testpointinquad(const DVector2& pt, const DVector2* quad);
int hitscan(const DVector3& start, const sectortype* startsect, const DVector3& vect, HitInfoBase& hitinfo, unsigned cliptype, double maxrange = -1);
int hitscan(const DVector3& start, const sectortype* startsect, const DVector3& vect, HitInfoBase& hitinfo, unsigned cliptype, double maxrange = -1, bool rangeisxy = false);
bool checkRangeOfWall(walltype* wal, EWallFlags flagmask, const DVector3& pos, double maxdist, double* theZs);
bool checkRangeOfFaceSprite(DCoreActor* itActor, const DVector3& pos, double maxdist, double* theZs);

View file

@ -73,7 +73,7 @@ void SpidBiteSeqCallback(int, DBloodActor* actor)
int hit = HitScan(actor, actor->spr.pos.Z, DVector3(vec.XY(), 0), CLIPMASK1, 0);
if (hit == 3 && gHitInfo.actor()->IsPlayerActor())
{
vec.Z += target->spr.pos.Z - actor->spr.pos.Z;
vec.Z += (target->spr.pos.Z - actor->spr.pos.Z) / (target->spr.pos.XY() - actor->spr.pos.XY()).Length();
DBloodPlayer* pPlayer = getPlayer(target->spr.type - kDudePlayer1);
switch (actor->spr.type)
{

View file

@ -219,7 +219,7 @@ int HitScan(DBloodActor* actor, double z, const DVector3& vect, unsigned int nMa
gHitInfo.clearObj();
auto bakCstat = actor->spr.cstat;
actor->spr.cstat &= ~CSTAT_SPRITE_BLOCK_HITSCAN;
hitscan(DVector3(actor->spr.pos.XY(), z), actor->sector(), vect, gHitInfo, nMask, nRange);
hitscan(DVector3(actor->spr.pos.XY(), z), actor->sector(), vect, gHitInfo, nMask, nRange, true);
actor->spr.cstat = bakCstat;
if (gHitInfo.actor() != nullptr)
@ -257,7 +257,7 @@ int VectorScan(DBloodActor* actor, double nOffset, double nZOffset, const DVecto
auto bakCstat = actor->spr.cstat;
actor->spr.cstat &= ~CSTAT_SPRITE_BLOCK_HITSCAN;
hitscan(pos, actor->sector(), vel, gHitInfo, CLIPMASK1, nRange);
hitscan(pos, actor->sector(), vel, gHitInfo, CLIPMASK1, nRange, true);
actor->spr.cstat = bakCstat;
while (nNum--)