- floatified shootbloodsplat.

This commit is contained in:
Christoph Oelckers 2022-09-13 20:54:34 +02:00
parent 4f5dce81f6
commit 9deb1dfa69
4 changed files with 14 additions and 13 deletions

View file

@ -135,7 +135,7 @@ void quickkill(player_struct* p);
int setpal(player_struct* p);
int madenoise(int playerNum);
int haskey(sectortype* sect, int snum);
void shootbloodsplat(DDukeActor* i, int p, int sx, int sy, int sz, int sa, int atwith, int BIGFORCE, int OOZFILTER, int NEWBEAST);
void shootbloodsplat(DDukeActor* i, int p, const DVector3& pos, DAngle ang, int atwith, int BIGFORCE, int OOZFILTER, int NEWBEAST);
void breakwall(int newpn, DDukeActor* spr, walltype* dawallnum);
int callsound(sectortype* sectnum,DDukeActor* snum, bool endstate = false);

View file

@ -1009,22 +1009,23 @@ int haskey(sectortype* sectp, int snum)
//
//---------------------------------------------------------------------------
void shootbloodsplat(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, int atwith, int BIGFORCE, int OOZFILTER, int NEWBEAST)
void shootbloodsplat(DDukeActor* actor, int p, const DVector3& pos, DAngle ang, int atwith, int BIGFORCE, int OOZFILTER, int NEWBEAST)
{
auto sectp = actor->sector();
int zvel;
double zvel;
HitInfo hit{};
if (p >= 0)
sa += 64 - (krand() & 127);
else sa += 1024 + 64 - (krand() & 127);
zvel = 1024 - (krand() & 2047);
ang += DAngle22_5 / 2 - randomAngle(22.5);
else ang += DAngle180 + DAngle22_5/2 - randomAngle(22.5);
zvel = 4 - krandf(8);
hitscan(vec3_t( sx, sy, sz ), sectp, { bcos(sa), bsin(sa), zvel << 6 }, hit, CLIPMASK1);
hitscan(pos, sectp, DVector3(ang.ToVector() * 1024, zvel * 64), hit, CLIPMASK1);
// oh my...
if (FindDistance2D(sx - hit.int_hitpos().X, sy - hit.int_hitpos().Y) < 1024 &&
if ( (pos.XY() - hit.hitpos.XY()).Length() < 64 &&
(hit.hitWall != nullptr && hit.hitWall->overpicnum != BIGFORCE) &&
((hit.hitWall->twoSided() && hit.hitSector != nullptr &&
hit.hitWall->nextSector()->lotag == 0 &&

View file

@ -1078,7 +1078,7 @@ void shoot_d(DDukeActor* actor, int atwith)
case BLOODSPLAT2:
case BLOODSPLAT3:
case BLOODSPLAT4:
shootbloodsplat(actor, p, sx, sy, sz, sa, atwith, BIGFORCE, OOZFILTER, NEWBEAST);
shootbloodsplat(actor, p, spos, sang, atwith, BIGFORCE, OOZFILTER, NEWBEAST);
break;
case KNEE:

View file

@ -855,7 +855,7 @@ void shoot_r(DDukeActor* actor, int atwith)
}
}
DVector3 svec(sx * inttoworld, sy * inttoworld, sz * zinttoworld);
DVector3 spos(sx * inttoworld, sy * inttoworld, sz * zinttoworld);
DAngle sang = DAngle::fromBuild(sa);
SetGameVarID(g_iAtWithVarID, atwith, actor, p);
@ -872,7 +872,7 @@ void shoot_r(DDukeActor* actor, int atwith)
case BLOODSPLAT2:
case BLOODSPLAT3:
case BLOODSPLAT4:
shootbloodsplat(actor, p, sx, sy, sz, sa, atwith, BIGFORCE, OOZFILTER, -1);
shootbloodsplat(actor, p, spos, sang, atwith, BIGFORCE, OOZFILTER, -1);
return;
case SLINGBLADE:
@ -952,9 +952,9 @@ void shoot_r(DDukeActor* actor, int atwith)
sang += DAngle90;
if (atwith == CHEERBOMB)
CreateActor(sect, svec + DVector3(-sang.Sin() * 4, sang.Cos() * 4, 6), atwith, -64, 16, 16, sa, vel, zvel, actor, 1);
CreateActor(sect, spos + DVector3(-sang.Sin() * 4, sang.Cos() * 4, 6), atwith, -64, 16, 16, sa, vel, zvel, actor, 1);
else
CreateActor(sect, svec + DVector3(-sang.Sin() * 4, sang.Cos() * 4, 6), atwith, -64, 32, 32, sa, vel, zvel, actor, 1);
CreateActor(sect, spos + DVector3(-sang.Sin() * 4, sang.Cos() * 4, 6), atwith, -64, 32, 32, sa, vel, zvel, actor, 1);
break;
}
}