- floatified tracers

This commit is contained in:
Christoph Oelckers 2022-09-13 23:07:08 +02:00
parent 623e0ff30e
commit cb7c5dc3ac
4 changed files with 13 additions and 17 deletions

View file

@ -127,7 +127,7 @@ void playerLookUp(int snum, ESyncBits actions);
void playerLookDown(int snum, ESyncBits actions);
void playerAimUp(int snum, ESyncBits actions);
void playerAimDown(int snum, ESyncBits actions);
void tracers(int x1, int y1, int z1, int x2, int y2, int z2, int n);
void tracers(const DVector3& start, const DVector3& dest, int n);
DDukeActor* aim(DDukeActor* s, int aang);
void checkweapons(player_struct* const p);
int findotherplayer(int p, double* d);

View file

@ -128,31 +128,27 @@ void forceplayerangle(int snum)
//
//---------------------------------------------------------------------------
void tracers(int x1, int y1, int z1, int x2, int y2, int z2, int n)
void tracers(const DVector3& start, const DVector3& dest, int n)
{
int i, xv, yv, zv;
sectortype* sect = nullptr;
i = n + 1;
xv = (x2 - x1) / i;
yv = (y2 - y1) / i;
zv = (z2 - z1) / i;
auto direction = dest - start;
if ((abs(x1 - x2) + abs(y1 - y2)) < 3084)
if (direction.XY().Sum() < 192.75)
return;
for (i = n; i > 0; i--)
auto pos = start;
auto add = direction / (n + 1);
for (int i = n; i > 0; i--)
{
x1 += xv;
y1 += yv;
z1 += zv;
updatesector(x1, y1, &sect);
pos += add;
updatesector(pos, &sect);
if (sect)
{
if (sect->lotag == 2)
EGS(sect, x1, y1, z1, TILE_WATERBUBBLE, -32, 4 + (krand() & 3), 4 + (krand() & 3), krand() & 2047, 0, 0, ps[0].GetActor(), 5);
CreateActor(sect, pos, TILE_WATERBUBBLE, -32, 4 + (krand() & 3), 4 + (krand() & 3), krand() & 2047, 0, 0, ps[0].GetActor(), 5);
else
EGS(sect, x1, y1, z1, TILE_SMALLSMOKE, -32, 14, 14, 0, 0, 0, ps[0].GetActor(), 5);
CreateActor(sect, pos, TILE_SMALLSMOKE, -32, 14, 14, 0, 0, 0, ps[0].GetActor(), 5);
}
}
}

View file

@ -407,7 +407,7 @@ static void shootweapon(DDukeActor *actor, int p, DVector3 pos, DAngle ang, int
if (hit.hitSector == nullptr) return;
if ((krand() & 15) == 0 && hit.hitSector->lotag == 2)
tracers(hit.int_hitpos().X, hit.int_hitpos().Y, hit.int_hitpos().Z, pos.X * worldtoint, pos.Y * worldtoint, pos.Z * zworldtoint, 8 - (ud.multimode >> 1));
tracers(hit.hitpos, pos, 8 - (ud.multimode >> 1));
DDukeActor* spark;
if (p >= 0)

View file

@ -296,7 +296,7 @@ static void shootweapon(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int
return;
if ((krand() & 15) == 0 && hit.hitSector->lotag == 2)
tracers(hit.int_hitpos().X, hit.int_hitpos().Y, hit.int_hitpos().Z, pos.X * worldtoint, pos.Y * worldtoint, pos.Z * zworldtoint, 8 - (ud.multimode >> 1));
tracers(hit.hitpos, pos, 8 - (ud.multimode >> 1));
DDukeActor* spark;
if (p >= 0)