mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 17:01:28 +00:00
- floatified RR's shootstuff
This commit is contained in:
parent
b105897d9f
commit
81865969be
1 changed files with 35 additions and 34 deletions
|
@ -455,10 +455,10 @@ static void shootweapon(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static void shootstuff(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, int atwith)
|
||||
static void shootstuff(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int atwith)
|
||||
{
|
||||
auto sect = actor->sector();
|
||||
int vel = 0, zvel;
|
||||
double vel = 0, zvel;
|
||||
int scount;
|
||||
|
||||
if (isRRRA())
|
||||
|
@ -469,9 +469,9 @@ static void shootstuff(DDukeActor* actor, int p, int sx, int sy, int sz, int sa,
|
|||
if (atwith == SPIT)
|
||||
{
|
||||
if (actor->spr.picnum == 8705)
|
||||
vel = 600;
|
||||
vel = 37.5;
|
||||
else
|
||||
vel = 400;
|
||||
vel = 25;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -479,21 +479,20 @@ static void shootstuff(DDukeActor* actor, int p, int sx, int sy, int sz, int sa,
|
|||
if (actor->spr.extra >= 0) actor->spr.shade = -96;
|
||||
|
||||
scount = 1;
|
||||
if (atwith == SPIT) vel = 400;
|
||||
if (atwith == SPIT) vel = 25;
|
||||
}
|
||||
if (atwith != SPIT)
|
||||
{
|
||||
vel = 840;
|
||||
sz -= (4 << 7);
|
||||
vel = 52.5;
|
||||
pos.Z -= 4;
|
||||
if (actor->spr.picnum == 4649)
|
||||
{
|
||||
sx += bcos(actor->int_ang() + 256, -6);
|
||||
sy += bsin(actor->int_ang() + 256, -6);
|
||||
sz += (12 << 8);
|
||||
pos += (actor->spr.angle + DAngle45).ToVector() * 16;
|
||||
pos.Z += 12;
|
||||
}
|
||||
if (actor->spr.picnum == VIXEN)
|
||||
{
|
||||
sz -= (12 << 8);
|
||||
pos.Z -= 12;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -501,42 +500,44 @@ static void shootstuff(DDukeActor* actor, int p, int sx, int sy, int sz, int sa,
|
|||
{
|
||||
auto aimed = aim(actor, AUTO_AIM_ANGLE);
|
||||
|
||||
sx += bcos(actor->int_ang() + 160, -7);
|
||||
sy += bsin(actor->int_ang() + 160, -7);
|
||||
pos += (actor->spr.angle + DAngle22_5 * 1.25).ToVector() * 16;
|
||||
|
||||
if (aimed)
|
||||
{
|
||||
int dal = ((aimed->spr.xrepeat * tileHeight(aimed->spr.picnum)) << 1) - (12 << 8);
|
||||
zvel = ((aimed->int_pos().Z - sz - dal) * vel) / ldist(ps[p].GetActor(), aimed);
|
||||
sa = getangle(aimed->int_pos().X - sx, aimed->int_pos().Y - sy);
|
||||
double dal = ((aimed->spr.xrepeat * tileHeight(aimed->spr.picnum)) * REPEAT_SCALE * 0.5) - 12;
|
||||
double dist = (ps[p].GetActor()->spr.pos.XY() - aimed->spr.pos.XY()).Length();
|
||||
|
||||
zvel = ((aimed->spr.pos.Z - pos.Z - dal) * vel) / dist;
|
||||
ang = VecToAngle(aimed->spr.pos.XY() - pos.XY());
|
||||
}
|
||||
else
|
||||
{
|
||||
zvel = -MulScale(ps[p].horizon.sum().asq16(), 98, 16);
|
||||
zvel = -ps[p].horizon.sum().asbuildf() * (98 / 256.);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int x;
|
||||
double x;
|
||||
int j = findplayer(actor, &x);
|
||||
// sa = getangle(ps[j].oposx-sx,ps[j].oposy-sy);
|
||||
if (actor->spr.picnum == HULK)
|
||||
sa -= (krand() & 31);
|
||||
ang -= randomAngle(22.5 / 4);
|
||||
else if (actor->spr.picnum == VIXEN)
|
||||
sa -= (krand() & 16);
|
||||
ang -= randomAngle(22.5 / 8);
|
||||
else if (actor->spr.picnum != UFOBEAM)
|
||||
sa += 16 - (krand() & 31);
|
||||
ang += DAngle22_5 / 8. - randomAngle(22.5 / 4);
|
||||
|
||||
zvel = (((ps[j].player_int_opos().Z - sz + (3 << 8))) * vel) / ldist(ps[j].GetActor(), actor);
|
||||
double dist = (ps[j].GetActor()->spr.pos.XY() - actor->spr.pos.XY()).Length();
|
||||
zvel = ((ps[j].opos.Z - pos.Z + 3) * vel) / dist;
|
||||
}
|
||||
|
||||
int oldzvel = zvel;
|
||||
double oldzvel = zvel;
|
||||
int sizx, sizy;
|
||||
|
||||
if (atwith == SPIT)
|
||||
{
|
||||
sizx = 18; sizy = 18;
|
||||
if (!isRRRA() || actor->spr.picnum != MAMA) sz -= (10 << 8); else sz -= (20 << 8);
|
||||
if (!isRRRA() || actor->spr.picnum != MAMA) pos.Z -= 10; else pos.Z -= (20 << 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -570,19 +571,19 @@ static void shootstuff(DDukeActor* actor, int p, int sx, int sy, int sz, int sa,
|
|||
|
||||
while (scount > 0)
|
||||
{
|
||||
auto j = EGS(sect, sx, sy, sz, atwith, -127, sizx, sizy, sa, vel, zvel, actor, 4);
|
||||
if (!j) return;
|
||||
j->spr.extra += (krand() & 7);
|
||||
j->spr.cstat = CSTAT_SPRITE_YCENTER;
|
||||
j->set_const_clipdist(4);
|
||||
auto spawned = CreateActor(sect, pos, atwith, -127, sizx, sizy, ang.Buildang(), vel * worldtoint, zvel * zworldtoint, actor, 4);
|
||||
if (!spawned) return;
|
||||
spawned->spr.extra += (krand() & 7);
|
||||
spawned->spr.cstat = CSTAT_SPRITE_YCENTER;
|
||||
spawned->set_const_clipdist(4);
|
||||
|
||||
sa = actor->int_ang() + 32 - (krand() & 63);
|
||||
zvel = oldzvel + 512 - (krand() & 1023);
|
||||
ang = actor->spr.angle + DAngle22_5 / 4 + randomAngle(22.5 / 2);
|
||||
zvel = oldzvel + 2 - krandf(4);
|
||||
|
||||
if (atwith == FIRELASER)
|
||||
{
|
||||
j->spr.xrepeat = 8;
|
||||
j->spr.yrepeat = 8;
|
||||
spawned->spr.xrepeat = 8;
|
||||
spawned->spr.yrepeat = 8;
|
||||
}
|
||||
|
||||
scount--;
|
||||
|
@ -919,7 +920,7 @@ void shoot_r(DDukeActor* actor, int atwith)
|
|||
case FIRELASER:
|
||||
case SPIT:
|
||||
case COOLEXPLOSION1:
|
||||
shootstuff(actor, p, sx, sy, sz, sa, atwith);
|
||||
shootstuff(actor, p, spos, sang, atwith);
|
||||
return;
|
||||
|
||||
case RPG2:
|
||||
|
|
Loading…
Reference in a new issue