mirror of
https://github.com/DrBeef/Raze.git
synced 2025-02-22 03:31:26 +00:00
- floatified the main shoot functions.
This commit is contained in:
parent
be0eb81c95
commit
99ca695333
2 changed files with 29 additions and 39 deletions
|
@ -1074,7 +1074,12 @@ static void shootshrinker(DDukeActor* actor, int p, const DVector3& pos, DAngle
|
||||||
|
|
||||||
void shoot_d(DDukeActor* actor, int atwith)
|
void shoot_d(DDukeActor* actor, int atwith)
|
||||||
{
|
{
|
||||||
int sx, sy, sz, sa, p, zvel;
|
int p;
|
||||||
|
DVector3 spos;
|
||||||
|
DAngle sang;
|
||||||
|
|
||||||
|
auto const sect = actor->sector();
|
||||||
|
|
||||||
if (actor->isPlayer())
|
if (actor->isPlayer())
|
||||||
{
|
{
|
||||||
p = actor->PlayerIndex();
|
p = actor->PlayerIndex();
|
||||||
|
@ -1093,37 +1098,29 @@ void shoot_d(DDukeActor* actor, int atwith)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
auto sect = actor->sector();
|
|
||||||
zvel = 0;
|
|
||||||
|
|
||||||
if (actor->isPlayer())
|
if (actor->isPlayer())
|
||||||
{
|
{
|
||||||
sx = ps[p].player_int_pos().X;
|
spos = ps[p].pos.plusZ(ps[p].pyoff + 4);
|
||||||
sy = ps[p].player_int_pos().Y;
|
sang = ps[p].angle.ang;
|
||||||
sz = ps[p].player_int_pos().Z + ps[p].pyoff * zworldtoint + (4 << 8);
|
|
||||||
sa = ps[p].angle.ang.Buildang();
|
|
||||||
|
|
||||||
ps[p].crack_time = CRACK_TIME;
|
ps[p].crack_time = CRACK_TIME;
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sa = actor->int_ang();
|
sang = actor->spr.angle;
|
||||||
sx = actor->int_pos().X;
|
spos = actor->spr.pos.plusZ(-(actor->spr.yrepeat * tileHeight(actor->spr.picnum) * REPEAT_SCALE * 0.5) + 4);
|
||||||
sy = actor->int_pos().Y;
|
|
||||||
sz = actor->int_pos().Z - (actor->spr.yrepeat * tileHeight(actor->spr.picnum) << 1) + (4 << 8);
|
|
||||||
if (actor->spr.picnum != ROTATEGUN)
|
if (actor->spr.picnum != ROTATEGUN)
|
||||||
{
|
{
|
||||||
sz -= (7 << 8);
|
spos.Z -= 7;
|
||||||
if (badguy(actor) && actor->spr.picnum != COMMANDER)
|
if (badguy(actor) && actor->spr.picnum != COMMANDER)
|
||||||
{
|
{
|
||||||
sx -= bsin(sa + 96, -7);
|
spos.X -= (sang + DAngle22_5 * 0.75).Sin() * 8;
|
||||||
sy += bcos(sa + 96, -7);
|
spos.Y += (sang + DAngle22_5 * 0.75).Cos() * 8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DVector3 spos(sx * inttoworld, sy * inttoworld, sz * zinttoworld);
|
|
||||||
DAngle sang = DAngle::fromBuild(sa);
|
|
||||||
|
|
||||||
if (isWorldTour())
|
if (isWorldTour())
|
||||||
{ // Twentieth Anniversary World Tour
|
{ // Twentieth Anniversary World Tour
|
||||||
|
@ -1179,10 +1176,10 @@ void shoot_d(DDukeActor* actor, int atwith)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case FREEZEBLAST:
|
case FREEZEBLAST:
|
||||||
sz += (3 << 8);
|
spos.Z += 3;
|
||||||
[[fallthrough]];
|
[[fallthrough]];
|
||||||
case RPG:
|
|
||||||
|
|
||||||
|
case RPG:
|
||||||
shootrpg(actor, p, spos, sang, atwith);
|
shootrpg(actor, p, spos, sang, atwith);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -856,42 +856,33 @@ static void shootmortar(DDukeActor* actor, int p, const DVector3& pos, DAngle an
|
||||||
|
|
||||||
void shoot_r(DDukeActor* actor, int atwith)
|
void shoot_r(DDukeActor* actor, int atwith)
|
||||||
{
|
{
|
||||||
int sa, p;
|
int p;
|
||||||
int sx, sy, sz, zvel;
|
DVector3 spos;
|
||||||
|
DAngle sang;
|
||||||
|
|
||||||
auto const sect = actor->sector();
|
auto const sect = actor->sector();
|
||||||
zvel = 0;
|
|
||||||
|
|
||||||
if (actor->isPlayer())
|
if (actor->isPlayer())
|
||||||
{
|
{
|
||||||
p = actor->PlayerIndex();
|
p = actor->PlayerIndex();
|
||||||
|
spos = ps[p].pos.plusZ(ps[p].pyoff + 4);
|
||||||
sx = ps[p].player_int_pos().X;
|
sang = ps[p].angle.ang;
|
||||||
sy = ps[p].player_int_pos().Y;
|
|
||||||
sz = ps[p].player_int_pos().Z + ps[p].pyoff * zworldtoint + (4 << 8);
|
|
||||||
sa = ps[p].angle.ang.Buildang();
|
|
||||||
|
|
||||||
if (isRRRA()) ps[p].crack_time = CRACK_TIME;
|
if (isRRRA()) ps[p].crack_time = CRACK_TIME;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
p = -1;
|
p = -1;
|
||||||
sa = actor->int_ang();
|
sang = actor->spr.angle;
|
||||||
sx = actor->int_pos().X;
|
spos = actor->spr.pos.plusZ(-(actor->spr.yrepeat * tileHeight(actor->spr.picnum) * REPEAT_SCALE * 0.5) - 3);
|
||||||
sy = actor->int_pos().Y;
|
|
||||||
sz = actor->int_pos().Z - ((actor->spr.yrepeat * tileHeight(actor->spr.picnum)) << 1) + (4 << 8);
|
|
||||||
sz -= (7 << 8);
|
|
||||||
if (badguy(actor))
|
if (badguy(actor))
|
||||||
{
|
{
|
||||||
sx -= bsin(sa, -7);
|
spos.X -= (sang + DAngle22_5 * 0.75).Sin() * 8;
|
||||||
sy += bcos(sa, -7);
|
spos.Y += (sang + DAngle22_5 * 0.75).Cos() * 8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DVector3 spos(sx * inttoworld, sy * inttoworld, sz * zinttoworld);
|
|
||||||
DAngle sang = DAngle::fromBuild(sa);
|
|
||||||
|
|
||||||
SetGameVarID(g_iAtWithVarID, atwith, actor, p);
|
SetGameVarID(g_iAtWithVarID, atwith, actor, p);
|
||||||
SetGameVarID(g_iReturnVarID, 0, actor, p);
|
SetGameVarID(g_iReturnVarID, 0, actor, p);
|
||||||
OnEvent(EVENT_SHOOT, p, ps[p].GetActor(), -1);
|
OnEvent(EVENT_SHOOT, p, ps[p].GetActor(), -1);
|
||||||
|
@ -962,7 +953,9 @@ void shoot_r(DDukeActor* actor, int atwith)
|
||||||
else break;
|
else break;
|
||||||
|
|
||||||
case FREEZEBLAST:
|
case FREEZEBLAST:
|
||||||
sz += (3 << 8);
|
spos.Z += 3;
|
||||||
|
[[fallthrough]];
|
||||||
|
|
||||||
case RPG:
|
case RPG:
|
||||||
case SHRINKSPARK:
|
case SHRINKSPARK:
|
||||||
rrra_rpg2:
|
rrra_rpg2:
|
||||||
|
|
Loading…
Reference in a new issue