mirror of
https://github.com/ZDoom/Raze.git
synced 2025-02-22 11:31:11 +00:00
- floatified Duke's shootstuff.
This commit is contained in:
parent
1702491619
commit
b5a869b053
1 changed files with 34 additions and 21 deletions
|
@ -562,10 +562,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)
|
||||||
{
|
{
|
||||||
sectortype* sect = actor->sector();
|
sectortype* sect = actor->sector();
|
||||||
int vel, zvel;
|
double vel, zvel;
|
||||||
int scount;
|
int scount;
|
||||||
|
|
||||||
if (actor->spr.extra >= 0) actor->spr.shade = -96;
|
if (actor->spr.extra >= 0) actor->spr.shade = -96;
|
||||||
|
@ -577,13 +577,13 @@ static void shootstuff(DDukeActor* actor, int p, int sx, int sy, int sz, int sa,
|
||||||
if (atwith == COOLEXPLOSION1)
|
if (atwith == COOLEXPLOSION1)
|
||||||
{
|
{
|
||||||
if (actor->spr.picnum == BOSS2) vel = 644;
|
if (actor->spr.picnum == BOSS2) vel = 644;
|
||||||
else vel = 348;
|
else vel = 348 / 16.;
|
||||||
sz -= (4 << 7);
|
pos.Z -= 2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
vel = 840;
|
vel = 840 / 16.;
|
||||||
sz -= (4 << 7);
|
pos.Z -= 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -593,33 +593,46 @@ static void shootstuff(DDukeActor* actor, int p, int sx, int sy, int sz, int sa,
|
||||||
|
|
||||||
if (aimed)
|
if (aimed)
|
||||||
{
|
{
|
||||||
int dal = ((aimed->spr.xrepeat * tileHeight(aimed->spr.picnum)) << 1) - (12 << 8);
|
double dal = ((aimed->spr.xrepeat * tileHeight(aimed->spr.picnum)) * REPEAT_SCALE * 0.5) - 12;
|
||||||
zvel = ((aimed->int_pos().Z - sz - dal) * vel) / ldist(ps[p].GetActor(), aimed);
|
double dist = (ps[p].GetActor()->spr.pos.XY() - aimed->spr.pos.XY()).Length();
|
||||||
sa = getangle(aimed->int_pos().X - sx, aimed->int_pos().Y - sy);
|
|
||||||
|
zvel = ((aimed->spr.pos.Z - pos.Z - dal) * vel) / dist;
|
||||||
|
ang = VecToAngle(aimed->spr.pos.XY() - pos.XY());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
zvel = -MulScale(ps[p].horizon.sum().asq16(), 98, 16);
|
zvel = -ps[p].horizon.sum().asbuildf() * (98 / 256.);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int x;
|
double x;
|
||||||
int j = findplayer(actor, &x);
|
int j = findplayer(actor, &x);
|
||||||
// sa = getangle(ps[j].oposx-sx,ps[j].oposy-sy);
|
ang += DAngle22_5 / 8 - randomAngle(22.5 / 4);
|
||||||
sa += 16 - (krand() & 31);
|
#if 1
|
||||||
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;
|
||||||
|
#else
|
||||||
|
// this is for pitch corrected velocity
|
||||||
|
auto dist = (ps[j].GetActor()->spr.pos - actor->spr.pos).Resized(vel);
|
||||||
|
vel = dist.XY().Length();
|
||||||
|
zvel = dist.Z;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int oldzvel = zvel;
|
double oldzvel = zvel;
|
||||||
int sizx, sizy;
|
int sizx, sizy;
|
||||||
|
|
||||||
if (atwith == SPIT) { sizx = 18; sizy = 18, sz -= (10 << 8); }
|
if (atwith == SPIT)
|
||||||
|
{
|
||||||
|
sizx = 18;
|
||||||
|
sizy = 18;
|
||||||
|
pos.Z -= 10;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (atwith == FIRELASER)
|
if (atwith == FIRELASER)
|
||||||
{
|
{
|
||||||
if (p >= 0)
|
if (p >= 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
sizx = 34;
|
sizx = 34;
|
||||||
sizy = 34;
|
sizy = 34;
|
||||||
}
|
}
|
||||||
|
@ -640,7 +653,7 @@ static void shootstuff(DDukeActor* actor, int p, int sx, int sy, int sz, int sa,
|
||||||
|
|
||||||
while (scount > 0)
|
while (scount > 0)
|
||||||
{
|
{
|
||||||
auto spawned = EGS(sect, sx, sy, sz, atwith, -127, sizx, sizy, sa, vel, zvel, actor, 4);
|
auto spawned = CreateActor(sect, pos, atwith, -127, sizx, sizy, ang.Buildang(), vel * worldtoint, zvel * zworldtoint, actor, 4);
|
||||||
if (!spawned) return;
|
if (!spawned) return;
|
||||||
spawned->spr.extra += (krand() & 7);
|
spawned->spr.extra += (krand() & 7);
|
||||||
|
|
||||||
|
@ -660,8 +673,8 @@ static void shootstuff(DDukeActor* actor, int p, int sx, int sy, int sz, int sa,
|
||||||
spawned->spr.cstat = CSTAT_SPRITE_YCENTER;
|
spawned->spr.cstat = CSTAT_SPRITE_YCENTER;
|
||||||
spawned->set_const_clipdist(4);
|
spawned->set_const_clipdist(4);
|
||||||
|
|
||||||
sa = actor->int_ang() + 32 - (krand() & 63);
|
ang = actor->spr.angle + DAngle22_5 / 4 - randomAngle(22.5 / 2);
|
||||||
zvel = oldzvel + 512 - (krand() & 1023);
|
zvel = oldzvel + 2 - krandf(4);
|
||||||
|
|
||||||
scount--;
|
scount--;
|
||||||
}
|
}
|
||||||
|
@ -1096,7 +1109,7 @@ void shoot_d(DDukeActor* actor, int atwith)
|
||||||
case FIRELASER:
|
case FIRELASER:
|
||||||
case SPIT:
|
case SPIT:
|
||||||
case COOLEXPLOSION1:
|
case COOLEXPLOSION1:
|
||||||
shootstuff(actor, p, sx, sy, sz, sa, atwith);
|
shootstuff(actor, p, spos, sang, atwith);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case FREEZEBLAST:
|
case FREEZEBLAST:
|
||||||
|
|
Loading…
Reference in a new issue