- scriptified Duke's spit projectile.

This commit is contained in:
Christoph Oelckers 2022-11-29 19:24:44 +01:00
parent fcd05e38c9
commit f2df8a162f
3 changed files with 49 additions and 27 deletions

View file

@ -818,26 +818,6 @@ static bool weaponhitsprite(DDukeActor* proj, DDukeActor *targ, bool fireball)
S_PlayActorSound(PISTOL_BODYHIT, targ); S_PlayActorSound(PISTOL_BODYHIT, targ);
if (proj->spr.picnum == SPIT)
{
ps[p].Angles.addPitch(DAngle::fromDeg(-14.04));
ps[p].sync.actions |= SB_CENTERVIEW;
if (ps[p].loogcnt == 0)
{
if (!S_CheckActorSoundPlaying(ps[p].GetActor(), DUKE_LONGTERM_PAIN))
S_PlayActorSound(DUKE_LONGTERM_PAIN, ps[p].GetActor());
int j = 3 + (krand() & 3);
ps[p].numloogs = j;
ps[p].loogcnt = 24 * 4;
for (int x = 0; x < j; x++)
{
ps[p].loogie[x].X = krand() % 320;
ps[p].loogie[x].Y = krand() % 200;
}
}
}
} }
return false; return false;
} }
@ -935,10 +915,6 @@ static void weaponcommon_d(DDukeActor* proj)
movesprite_ex(proj, DVector3(proj->spr.Angles.Yaw.ToVector() * vel, velz), CLIPMASK1, coll); movesprite_ex(proj, DVector3(proj->spr.Angles.Yaw.ToVector() * vel, velz), CLIPMASK1, coll);
if (proj->spr.picnum == RPG && proj->temp_actor != nullptr)
if ((proj->spr.pos.XY() - proj->temp_actor->spr.pos.XY()).Length() < 16)
coll.setSprite(proj->temp_actor);
if (!proj->insector()) if (!proj->insector())
{ {
proj->Destroy(); proj->Destroy();
@ -962,9 +938,6 @@ static void weaponcommon_d(DDukeActor* proj)
} }
} }
if (proj->spr.picnum == SPIT) if (proj->vel.Z < 24)
proj->vel.Z += gs.gravity - 112 / 256.;
if (coll.type != 0) if (coll.type != 0)
{ {
if (proj->spr.picnum == COOLEXPLOSION1) if (proj->spr.picnum == COOLEXPLOSION1)

View file

@ -59,6 +59,7 @@ spawnclasses
1646 = DukeShrinkSpark 1646 = DukeShrinkSpark
2605 = DukeRPG 2605 = DukeRPG
1641 = DukeFreezeBlast 1641 = DukeFreezeBlast
1636 = DukeSpit
1272 = DukeTrash 1272 = DukeTrash
634 = DukeBolt1 634 = DukeBolt1

View file

@ -455,3 +455,51 @@ class DukeFreezeBlast : DukeProjectile
} }
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
class DukeSpit : DukeProjectile
{
default
{
pic "SPIT";
}
override bool postmoveeffect(CollisionData coll)
{
Super.postmoveeffect(coll);
if (self.vel.Z < 24)
self.vel.Z += gs.gravity - 112 / 256.;
return false;
}
override bool weaponhitplayer(DukeActor targ)
{
if (Super.weaponhitplayer(targ)) return true;
let p = targ.GetPlayer();
p.addPitch(-14.04);
p.centerview();
if (p.loogcnt == 0)
{
if (!p.actor.CheckSoundPlaying("PLAYER_LONGTERM_PAIN"))
p.actor.PlayActorSound("PLAYER_LONGTERM_PAIN");
int j = random(3, 7);
p.numloogs = j;
p.loogcnt = 24 * 4;
for (int x = 0; x < j; x++)
{
p.loogie[x].X = random(0, 319);
p.loogie[x].Y = random(0, 199);
}
}
return false;
}
}