diff --git a/source/games/duke/src/funct.h b/source/games/duke/src/funct.h index fa15cd25a..4154fa3d5 100644 --- a/source/games/duke/src/funct.h +++ b/source/games/duke/src/funct.h @@ -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); diff --git a/source/games/duke/src/player.cpp b/source/games/duke/src/player.cpp index 9b8643980..c9828314e 100644 --- a/source/games/duke/src/player.cpp +++ b/source/games/duke/src/player.cpp @@ -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 && diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index d8003ff04..c3589d4bc 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -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: diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index 6d3277981..b93a5cfec 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -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; } }