mirror of
https://github.com/DrBeef/Raze.git
synced 2025-02-01 05:20:43 +00:00
- final BuildAnim calls
This was a bit more complex.
This commit is contained in:
parent
8ee10c5488
commit
f6c7a1c41d
2 changed files with 18 additions and 26 deletions
|
@ -149,6 +149,13 @@ extern vec2_t hitscangoal;
|
|||
|
||||
struct HitInfoBase;
|
||||
int hitscan(const vec3_t& start, const sectortype* startsect, const vec3_t& direction, HitInfoBase& hitinfo, unsigned cliptype);
|
||||
inline int hitscan(const DVector3& start, const sectortype* startsect, const DVector3& direction, HitInfoBase& hitinfo, unsigned cliptype)
|
||||
{
|
||||
vec3_t istart(int(start.X * worldtoint), int(start.Y * worldtoint), int(start.Z * zworldtoint) );
|
||||
vec3_t idir( int(direction.X * worldtoint), int(direction.Y * worldtoint), int(direction.Z * zworldtoint) );
|
||||
return hitscan(istart, startsect, idir, hitinfo, cliptype);
|
||||
}
|
||||
|
||||
void neartag(const vec3_t& pos, sectortype* sect, int angle, HitInfoBase& result, int neartagrange, int tagsearch);
|
||||
|
||||
int cansee(int x1, int y1, int z1, sectortype* sect1, int x2, int y2, int z2, sectortype* sect2);
|
||||
|
|
|
@ -241,38 +241,25 @@ void ResetSwordSeqs()
|
|||
WeaponInfo[kWeaponSword].b[3] = 7;
|
||||
}
|
||||
|
||||
Collision CheckCloseRange(int nPlayer, int *x, int *y, int *z, sectortype* *ppSector)
|
||||
Collision CheckCloseRange(int nPlayer, DVector3& pos, sectortype* *ppSector)
|
||||
{
|
||||
auto pActor = PlayerList[nPlayer].pActor;
|
||||
|
||||
int ang = pActor->int_ang();
|
||||
int xVect = bcos(ang);
|
||||
int yVect = bsin(ang);
|
||||
|
||||
HitInfo hit{};
|
||||
hitscan({ *x, *y, *z }, *ppSector, { xVect, yVect, 0 }, hit, CLIPMASK1);
|
||||
hitscan(pos, *ppSector, DVector3(pActor->spr.angle.ToVector() * 1024, 0 ), hit, CLIPMASK1);
|
||||
|
||||
int ecx = bsin(150, -3);
|
||||
const double ecx = 56.84; // bsin(150, -3)
|
||||
double sqrtNum = (hit.hitpos.XY() - pos.XY()).LengthSquared();
|
||||
|
||||
uint32_t yDiff = abs(hit.int_hitpos().Y - *y);
|
||||
uint32_t xDiff = abs(hit.int_hitpos().X - *x);
|
||||
|
||||
uint32_t sqrtNum = xDiff * xDiff + yDiff * yDiff;
|
||||
|
||||
if (sqrtNum > INT_MAX)
|
||||
{
|
||||
DPrintf(DMSG_WARNING, "%s %d: overflow\n", __func__, __LINE__);
|
||||
sqrtNum = INT_MAX;
|
||||
}
|
||||
Collision c;
|
||||
c.setNone();
|
||||
|
||||
if (ksqrt(sqrtNum) >= ecx)
|
||||
if (sqrtNum >= ecx * ecx)
|
||||
return c;
|
||||
|
||||
*x = hit.int_hitpos().X;
|
||||
*y = hit.int_hitpos().Y;
|
||||
*z = hit.int_hitpos().Z;
|
||||
pos = hit.hitpos;
|
||||
*ppSector = hit.hitSector;
|
||||
|
||||
if (hit.actor()) {
|
||||
|
@ -648,9 +635,7 @@ loc_flag:
|
|||
|
||||
int nAmmoType = WeaponInfo[nWeapon].nAmmoType;
|
||||
int nAngle = pPlayerActor->int_ang();
|
||||
int theX = pPlayerActor->int_pos().X;
|
||||
int theY = pPlayerActor->int_pos().Y;
|
||||
int theZ = pPlayerActor->int_pos().Z;
|
||||
auto thePos = pPlayerActor->spr.pos;
|
||||
|
||||
int ebp = bcos(nAngle) * (pPlayerActor->spr.clipdist << 3);
|
||||
int ebx = bsin(nAngle) * (pPlayerActor->spr.clipdist << 3);
|
||||
|
@ -696,7 +681,7 @@ loc_flag:
|
|||
{
|
||||
nHeight += -PlayerList[nLocalPlayer].horizon.horiz.asq16() >> 10;
|
||||
|
||||
theZ += nHeight;
|
||||
thePos.Z += nHeight * zinttoworld;
|
||||
|
||||
int var_28;
|
||||
|
||||
|
@ -707,7 +692,7 @@ loc_flag:
|
|||
var_28 = 9;
|
||||
}
|
||||
|
||||
auto cRange = CheckCloseRange(nPlayer, &theX, &theY, &theZ, &pSectorB);
|
||||
auto cRange = CheckCloseRange(nPlayer, thePos, &pSectorB);
|
||||
|
||||
if (cRange.type != kHitNone)
|
||||
{
|
||||
|
@ -742,7 +727,7 @@ loc_flag:
|
|||
else if (pActor2->spr.statnum == 102)
|
||||
{
|
||||
// loc_27370:
|
||||
BuildAnim(nullptr, 12, 0, DVector3(theX * inttoworld, theY * inttoworld, theZ * zinttoworld), pSectorB, 30, 0);
|
||||
BuildAnim(nullptr, 12, 0, thePos, pSectorB, 30, 0);
|
||||
}
|
||||
else if (pActor2->spr.statnum == kStatExplodeTrigger) {
|
||||
var_28 += 2;
|
||||
|
@ -754,7 +739,7 @@ loc_flag:
|
|||
else
|
||||
{
|
||||
// loc_27370:
|
||||
BuildAnim(nullptr, 12, 0, DVector3(theX * inttoworld, theY * inttoworld, theZ * zinttoworld), pSectorB, 30, 0);
|
||||
BuildAnim(nullptr, 12, 0, thePos, pSectorB, 30, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue