mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 08:52:00 +00:00
- floatified hitpos
This commit is contained in:
parent
1f96b4eac6
commit
5505c362e2
8 changed files with 45 additions and 32 deletions
|
@ -1279,9 +1279,7 @@ static inline void hit_set(HitInfoBase *hit, sectortype* sect, walltype* wal, DC
|
|||
hit->hitSector = sect;
|
||||
hit->hitWall = wal;
|
||||
hit->hitActor = actor;
|
||||
hit->__int_hitpos.X = x;
|
||||
hit->__int_hitpos.Y = y;
|
||||
hit->__int_hitpos.Z = z;
|
||||
hit->set_int_hitpos(x, y, z);
|
||||
}
|
||||
|
||||
static int32_t hitscan_hitsectcf=-1;
|
||||
|
@ -1360,7 +1358,7 @@ int hitscan(const vec3_t& start, const sectortype* startsect, const vec3_t& dire
|
|||
if (startsect == nullptr)
|
||||
return -1;
|
||||
|
||||
hitinfo.__int_hitpos.vec2 = hitscangoal;
|
||||
hitinfo. set_int_hitpos_xy(hitscangoal.X, hitscangoal.Y);
|
||||
|
||||
BFSSectorSearch search(startsect);
|
||||
while (auto sec = search.GetNext())
|
||||
|
@ -1430,11 +1428,13 @@ int hitscan(const vec3_t& start, const sectortype* startsect, const vec3_t& dire
|
|||
{
|
||||
case 0:
|
||||
{
|
||||
if (try_facespr_intersect(actor, *sv, vx, vy, vz, &hitinfo.__int_hitpos, 0))
|
||||
auto v = hitinfo.int_hitpos();
|
||||
if (try_facespr_intersect(actor, *sv, vx, vy, vz, &v, 0))
|
||||
{
|
||||
hitinfo.hitSector = sec;
|
||||
hitinfo.hitWall = nullptr;
|
||||
hitinfo.hitActor = actor;
|
||||
hitinfo.set_int_hitpos(v.X, v.Y, v.Z);
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
@ -288,7 +288,7 @@ void neartag(const vec3_t& sv, sectortype* sect, int ange, HitInfoBase& result,
|
|||
vec3_t hitv = { sv.X+vx, sv.Y+vy, 0 };
|
||||
|
||||
result.clearObj();
|
||||
result.__int_hitpos.X = 0;
|
||||
result.hitpos.X = 0;
|
||||
|
||||
if (!sect || (tagsearch & 3) == 0)
|
||||
return;
|
||||
|
@ -324,7 +324,7 @@ void neartag(const vec3_t& sv, sectortype* sect, int ange, HitInfoBase& result,
|
|||
{
|
||||
if (good & 1) result.hitSector = nextsect;
|
||||
if (good & 2) result.hitWall = wal;
|
||||
result.__int_hitpos.X = DMulScale(intx - sv.X, bcos(ange), inty - sv.Y, bsin(ange), 14);
|
||||
result.hitpos.X = DMulScale(intx - sv.X, bcos(ange), inty - sv.Y, bsin(ange), 14) * inttoworld;
|
||||
hitv.X = intx; hitv.Y = inty; hitv.Z = intz;
|
||||
}
|
||||
|
||||
|
@ -349,7 +349,7 @@ void neartag(const vec3_t& sv, sectortype* sect, int ange, HitInfoBase& result,
|
|||
if (try_facespr_intersect(actor, sv, vx, vy, 0, &hitv, 1))
|
||||
{
|
||||
result.hitActor = actor;
|
||||
result.__int_hitpos.X = DMulScale(hitv.X-sv.X, bcos(ange), hitv.Y-sv.Y, bsin(ange), 14);
|
||||
result.hitpos.X = DMulScale(hitv.X-sv.X, bcos(ange), hitv.Y-sv.Y, bsin(ange), 14) * inttoworld;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -289,7 +289,7 @@ enum EHitBits
|
|||
// Not all utilities use all variables.
|
||||
struct HitInfoBase
|
||||
{
|
||||
vec3_t __int_hitpos;
|
||||
DVector3 hitpos;
|
||||
sectortype* hitSector;
|
||||
walltype* hitWall;
|
||||
DCoreActor* hitActor;
|
||||
|
@ -303,7 +303,20 @@ struct HitInfoBase
|
|||
|
||||
const vec3_t int_hitpos() const
|
||||
{
|
||||
return __int_hitpos;
|
||||
return { int(hitpos.X * worldtoint), int(hitpos.Y * worldtoint), int(hitpos.Z * zworldtoint), };
|
||||
}
|
||||
|
||||
void set_int_hitpos(int x, int y, int z)
|
||||
{
|
||||
hitpos.X = x * inttoworld;
|
||||
hitpos.Y = y * inttoworld;
|
||||
hitpos.Z = z * zinttoworld;
|
||||
}
|
||||
|
||||
void set_int_hitpos_xy(int x, int y)
|
||||
{
|
||||
hitpos.X = x * inttoworld;
|
||||
hitpos.Y = y * inttoworld;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -47,9 +47,9 @@ inline FSerializer& Serialize(FSerializer& arc, const char* keyname, THitInfo<T>
|
|||
arc("sect", w.hitSector)
|
||||
("sprite", w.hitActor)
|
||||
("wall", w.hitWall)
|
||||
("x", w.__int_hitpos.X)
|
||||
("y", w.__int_hitpos.Y)
|
||||
("z", w.__int_hitpos.Z)
|
||||
("x", w.hitpos.X)
|
||||
("y", w.hitpos.Y)
|
||||
("z", w.hitpos.Z)
|
||||
.EndObject();
|
||||
}
|
||||
return arc;
|
||||
|
|
|
@ -5349,9 +5349,7 @@ int MoveMissile(DBloodActor* actor)
|
|||
}
|
||||
CheckLink(actor);
|
||||
gHitInfo.hitSector = actor->sector();
|
||||
gHitInfo.__int_hitpos.X = actor->int_pos().X;
|
||||
gHitInfo.__int_hitpos.Y = actor->int_pos().Y;
|
||||
gHitInfo.__int_hitpos.Z = actor->int_pos().Z;
|
||||
gHitInfo.hitpos = actor->spr.pos;
|
||||
break;
|
||||
}
|
||||
if (Owner) Owner->spr.cstat = bakCstat;
|
||||
|
@ -6702,7 +6700,7 @@ void actFireVector(DBloodActor* shooter, int a2, int a3, int a4, int a5, int a6,
|
|||
if (powerupCheck(pPlayer, kPwUpReflectShots))
|
||||
{
|
||||
gHitInfo.hitActor = shooter;
|
||||
gHitInfo.__int_hitpos = shooter->int_pos();
|
||||
gHitInfo.hitpos = shooter->spr.pos;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -156,7 +156,9 @@ void BuildSnake(int nPlayer, int zVal)
|
|||
|
||||
if (nSqrt < bsin(512, -4))
|
||||
{
|
||||
BackUpBullet(&hit.__int_hitpos.X, &hit.__int_hitpos.Y, nAngle);
|
||||
auto v = hit.int_hitpos();
|
||||
BackUpBullet(&v.X, &v.Y, nAngle);
|
||||
hit.set_int_hitpos_xy(v.X, v.Y);
|
||||
auto pActor = insertActor(hit.hitSector, 202);
|
||||
pActor->set_int_pos(hit.int_hitpos());
|
||||
|
||||
|
|
|
@ -142,11 +142,11 @@ FAFhitscan(int32_t x, int32_t y, int32_t z, sectortype* sect,
|
|||
if ((hit.hitWall->cstat & CSTAT_WALL_WARP_HITSCAN))
|
||||
{
|
||||
// back it up a bit to get a correct warp location
|
||||
hit.__int_hitpos.X -= xvect>>9;
|
||||
hit.__int_hitpos.Y -= yvect>>9;
|
||||
hit.hitpos.X -= (xvect>>9) * inttoworld;
|
||||
hit.hitpos.Y -= (yvect>>9) * inttoworld;
|
||||
|
||||
// warp to new x,y,z, sectnum
|
||||
if (Warp(&hit.__int_hitpos.X, &hit.__int_hitpos.Y, &hit.__int_hitpos.Z, &hit.hitSector))
|
||||
if (Warp(hit.hitpos, &hit.hitSector))
|
||||
{
|
||||
// hitscan needs to pass through dest sect
|
||||
ResetWallWarpHitscan(hit.hitSector);
|
||||
|
@ -177,7 +177,7 @@ FAFhitscan(int32_t x, int32_t y, int32_t z, sectortype* sect,
|
|||
{
|
||||
// hit the floor of a sector that is a warping sector
|
||||
sectortype* newsect = nullptr;
|
||||
if (Warp(&hit.__int_hitpos.X, &hit.__int_hitpos.Y, &hit.__int_hitpos.Z, &newsect))
|
||||
if (Warp(hit.hitpos, &newsect))
|
||||
{
|
||||
auto pos = hit.int_hitpos();
|
||||
hitscan(pos, newsect, { xvect, yvect, zvect }, hit, clipmask);
|
||||
|
@ -187,7 +187,7 @@ FAFhitscan(int32_t x, int32_t y, int32_t z, sectortype* sect,
|
|||
else
|
||||
{
|
||||
sectortype* newsect = nullptr;
|
||||
if (WarpPlane(&hit.__int_hitpos.X, &hit.__int_hitpos.Y, &hit.__int_hitpos.Z, &newsect))
|
||||
if (WarpPlane(hit.hitpos, &newsect))
|
||||
{
|
||||
auto pos = hit.int_hitpos();
|
||||
hitscan(pos, newsect, { xvect, yvect, zvect }, hit, clipmask);
|
||||
|
|
|
@ -12753,7 +12753,7 @@ int ContinueHitscan(PLAYER* pp, sectortype* sect, int x, int y, int z, short ang
|
|||
{
|
||||
if (labs(hit.int_hitpos().Z - hit.hitSector->int_ceilingz()) <= Z(1))
|
||||
{
|
||||
hit.__int_hitpos.Z += Z(16);
|
||||
hit.hitpos.Z += 16;
|
||||
if ((hit.hitSector->ceilingstat & CSTAT_SECTOR_SKY))
|
||||
return 0;
|
||||
}
|
||||
|
@ -12886,7 +12886,7 @@ int InitShotgun(PLAYER* pp)
|
|||
{
|
||||
if (labs(hit.int_hitpos().Z - hit.hitSector->int_ceilingz()) <= Z(1))
|
||||
{
|
||||
hit.__int_hitpos.Z += Z(16);
|
||||
hit.hitpos.Z += 16;
|
||||
cstat |= (CSTAT_SPRITE_YFLIP);
|
||||
|
||||
if ((hit.hitSector->ceilingstat & CSTAT_SECTOR_SKY))
|
||||
|
@ -12894,7 +12894,7 @@ int InitShotgun(PLAYER* pp)
|
|||
|
||||
if (SectorIsUnderwaterArea(hit.hitSector))
|
||||
{
|
||||
WarpToSurface(&hit.hitSector, &hit.__int_hitpos.X, &hit.__int_hitpos.Y, &hit.__int_hitpos.Z);
|
||||
WarpToSurface(hit.hitpos, &hit.hitSector);
|
||||
ContinueHitscan(pp, hit.hitSector, hit.int_hitpos().X, hit.int_hitpos().Y, hit.int_hitpos().Z, ndaang, xvect, yvect, zvect);
|
||||
continue;
|
||||
}
|
||||
|
@ -12907,7 +12907,7 @@ int InitShotgun(PLAYER* pp)
|
|||
|
||||
if (SectorIsDiveArea(hit.hitSector))
|
||||
{
|
||||
WarpToUnderwater(&hit.hitSector, &hit.__int_hitpos.X, &hit.__int_hitpos.Y, &hit.__int_hitpos.Z);
|
||||
WarpToUnderwater(hit.hitpos, &hit.hitSector);
|
||||
ContinueHitscan(pp, hit.hitSector, hit.int_hitpos().X, hit.int_hitpos().Y, hit.int_hitpos().Z, ndaang, xvect, yvect, zvect);
|
||||
}
|
||||
|
||||
|
@ -15215,7 +15215,7 @@ int InitUzi(PLAYER* pp)
|
|||
{
|
||||
if (labs(hit.int_hitpos().Z - hit.hitSector->int_ceilingz()) <= Z(1))
|
||||
{
|
||||
hit.__int_hitpos.Z += Z(16);
|
||||
hit.hitpos.Z += 16;
|
||||
cstat |= (CSTAT_SPRITE_YFLIP);
|
||||
|
||||
if ((hit.hitSector->ceilingstat & CSTAT_SECTOR_SKY))
|
||||
|
@ -15223,7 +15223,7 @@ int InitUzi(PLAYER* pp)
|
|||
|
||||
if (SectorIsUnderwaterArea(hit.hitSector))
|
||||
{
|
||||
WarpToSurface(&hit.hitSector, &hit.__int_hitpos.X, &hit.__int_hitpos.Y, &hit.__int_hitpos.Z);
|
||||
WarpToSurface(hit.hitpos, &hit.hitSector);
|
||||
ContinueHitscan(pp, hit.hitSector, hit.int_hitpos().X, hit.int_hitpos().Y, hit.int_hitpos().Z, daang, xvect, yvect, zvect);
|
||||
return 0;
|
||||
}
|
||||
|
@ -15236,7 +15236,7 @@ int InitUzi(PLAYER* pp)
|
|||
|
||||
if (SectorIsDiveArea(hit.hitSector))
|
||||
{
|
||||
WarpToUnderwater(&hit.hitSector, &hit.__int_hitpos.X, &hit.__int_hitpos.Y, &hit.__int_hitpos.Z);
|
||||
WarpToUnderwater(hit.hitpos, &hit.hitSector);
|
||||
ContinueHitscan(pp, hit.hitSector, hit.int_hitpos().X, hit.int_hitpos().Y, hit.int_hitpos().Z, daang, xvect, yvect, zvect);
|
||||
return 0;
|
||||
}
|
||||
|
@ -15704,7 +15704,7 @@ int InitSobjMachineGun(DSWActor* actor, PLAYER* pp)
|
|||
{
|
||||
if (labs(hit.int_hitpos().Z - hit.hitSector->int_ceilingz()) <= Z(1))
|
||||
{
|
||||
hit.__int_hitpos.Z += Z(16);
|
||||
hit.hitpos.Z += 16;
|
||||
cstat |= (CSTAT_SPRITE_YFLIP);
|
||||
|
||||
if ((hit.hitSector->ceilingstat & CSTAT_SECTOR_SKY))
|
||||
|
@ -16085,7 +16085,7 @@ int InitTurretMgun(SECTOR_OBJECT* sop)
|
|||
{
|
||||
if (labs(hit.int_hitpos().Z - hit.hitSector->int_ceilingz()) <= Z(1))
|
||||
{
|
||||
hit.__int_hitpos.Z += Z(16);
|
||||
hit.hitpos.Z += 16;
|
||||
cstat |= (CSTAT_SPRITE_YFLIP);
|
||||
|
||||
if ((hit.hitSector->ceilingstat & CSTAT_SECTOR_SKY))
|
||||
|
|
Loading…
Reference in a new issue