- scriptified the firelaser projectile.

This also fixes the animation of the RR variant, which used a bad value with '&'.
This commit is contained in:
Christoph Oelckers 2022-11-29 15:12:35 +01:00
parent d946ebb74d
commit a756b71647
10 changed files with 76 additions and 61 deletions

View file

@ -1861,7 +1861,7 @@ void handle_se04(DDukeActor *actor)
//
//---------------------------------------------------------------------------
void handle_se05(DDukeActor* actor, int FIRELASER)
void handle_se05(DDukeActor* actor)
{
auto sc = actor->sector();
int j;
@ -1872,7 +1872,7 @@ void handle_se05(DDukeActor* actor, int FIRELASER)
{
auto ang = actor->spr.Angles.Yaw;
actor->spr.Angles.Yaw = (actor->spr.pos.XY() - ps[p].GetActor()->spr.pos.XY()).Angle();
fi.shoot(actor, FIRELASER, nullptr);
fi.shoot(actor, -1, PClass::FindActor("DukeFireLaser"));
actor->spr.Angles.Yaw = ang;
}

View file

@ -1016,24 +1016,7 @@ static void weaponcommon_d(DDukeActor* proj)
}
}
if (proj->spr.picnum == FIRELASER)
{
for (int k = -3; k < 2; k++)
{
double zAdd = k * proj->vel.Z / 24;
auto spawned = CreateActor(proj->sector(), proj->spr.pos.plusZ(zAdd) + proj->spr.Angles.Yaw.ToVector() * k * 2.,
FIRELASER, -40 + (k << 2),
proj->spr.scale, nullAngle, 0., 0., proj->GetOwner(), 5);
if (spawned)
{
spawned->opos = proj->opos - proj->spr.pos + spawned->spr.pos;
spawned->spr.cstat = CSTAT_SPRITE_YCENTER;
spawned->spr.pal = proj->spr.pal;
}
}
}
else if (proj->spr.picnum == SPIT) if (proj->vel.Z < 24)
if (proj->spr.picnum == SPIT) if (proj->vel.Z < 24)
proj->vel.Z += gs.gravity - 112 / 256.;
if (coll.type != 0)
@ -1076,7 +1059,7 @@ static void weaponcommon_d(DDukeActor* proj)
S_PlayActorSound(SHRINKER_HIT, proj);
fi.hitradius(proj, gs.shrinkerblastradius, 0, 0, 0, 0);
}
else if (proj->spr.picnum != COOLEXPLOSION1 && proj->spr.picnum != FREEZEBLAST && proj->spr.picnum != FIRELASER && (!isWorldTour() || proj->spr.picnum != FIREBALL))
else if (proj->spr.picnum != COOLEXPLOSION1 && proj->spr.picnum != FREEZEBLAST && (!isWorldTour() || proj->spr.picnum != FIREBALL))
{
auto spawned = spawn(proj, EXPLOSION2);
if (spawned)
@ -1166,7 +1149,6 @@ void moveweapons_d(void)
[[fallthrough]];
case SHRINKSPARK:
case RPG:
case FIRELASER:
case SPIT:
case COOLEXPLOSION1:
weaponcommon_d(act);
@ -2453,15 +2435,6 @@ void moveexplosions_d(void) // STATNUM 5
case FRAMEEFFECT1:
frameeffect1(act);
continue;
case FIRELASER:
if (act->spr.extra != 999)
act->spr.extra = 999;
else
{
act->Destroy();
continue;
}
break;
case MONEY + 1:
case MAIL + 1:
case PAPER + 1:
@ -2710,7 +2683,7 @@ void moveeffectors_d(void) //STATNUM 3
//BOSS
case SE_5_BOSS:
handle_se05(act, FIRELASER);
handle_se05(act);
break;
case SE_8_UP_OPEN_DOOR_LIGHTS:

View file

@ -940,23 +940,7 @@ static void weaponcommon_r(DDukeActor *proj)
}
}
if (proj->spr.picnum == FIRELASER)
{
for (int k = -3; k < 2; k++)
{
double zAdd = k * proj->vel.Z / 24;
auto x = CreateActor(proj->sector(), proj->spr.pos.plusZ(zAdd) + proj->spr.Angles.Yaw.ToVector() * k * 2.,
FIRELASER, -40 + (k << 2),
proj->spr.scale, nullAngle, 0., 0., proj->GetOwner(), 5);
if (x)
{
x->spr.cstat = CSTAT_SPRITE_YCENTER;
x->spr.pal = proj->spr.pal;
}
}
}
else if (proj->spr.picnum == SHITBALL) if (proj->vel.Z < 24)
if (proj->spr.picnum == SHITBALL) if (proj->vel.Z < 24)
proj->vel.Z += gs.gravity - 112/256.;
if (coll.type != 0)
@ -979,7 +963,7 @@ static void weaponcommon_r(DDukeActor *proj)
if (proj->spr.picnum == RPG) rpgexplode(proj, coll.type, oldpos, EXPLOSION2, -1, -1, RPG_EXPLODE);
else if (isRRRA() && proj->spr.picnum == RPG2) rpgexplode(proj, coll.type, oldpos, EXPLOSION2, -1, 150, 247);
else if (isRRRA() && proj->spr.picnum == BOATGRENADE) rpgexplode(proj, coll.type, oldpos, EXPLOSION2, -1, 160, RPG_EXPLODE);
else if (proj->spr.picnum != FREEZEBLAST && proj->spr.picnum != FIRELASER && proj->spr.picnum != SAWBLADE)
else if (proj->spr.picnum != FREEZEBLAST && proj->spr.picnum != SAWBLADE)
{
auto spawned = spawn(proj, 1441);
if (spawned)
@ -1049,7 +1033,6 @@ void moveweapons_r(void)
[[fallthrough]];
case SAWBLADE:
case RPG:
case FIRELASER:
case SHITBALL:
case COOLEXPLOSION1:
case OWHIP:
@ -2201,7 +2184,6 @@ void moveexplosions_r(void) // STATNUM 5
frameeffect1(act);
continue;
case COOLEXPLOSION1:
case FIRELASER:
case OWHIP:
case UWHIP:
if (act->spr.extra != 999)
@ -2438,7 +2420,7 @@ void moveeffectors_r(void) //STATNUM 3
//BOSS
case SE_5_BOSS:
handle_se05(act, FIRELASER);
handle_se05(act);
break;
case SE_8_UP_OPEN_DOOR_LIGHTS:

View file

@ -519,7 +519,6 @@ void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
case EXPLOSION2BOT:
case FREEZEBLAST:
case ATOMICHEALTH:
case FIRELASER:
case SHRINKSPARK:
case GROWSPARK:
case CHAINGUN:

View file

@ -645,7 +645,6 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
case EXPLOSION2:
case FREEZEBLAST:
case ATOMICHEALTH:
case FIRELASER:
case SAWBLADE:
case CHAINGUN:
case RPG:
@ -659,10 +658,6 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
lastvisinc = PlayClock + 32;
t->pal = 0;
}
else if (t->picnum == FIRELASER)
{
t->picnum = FIRELASER + ((PlayClock >> 2) & 5);
}
t->shade = -127;
break;
case UFOBEAM:

View file

@ -60,7 +60,7 @@ void handle_se30(DDukeActor* i, int JIBS6);
void handle_se02(DDukeActor* i);
void handle_se03(DDukeActor* i);
void handle_se04(DDukeActor* i);
void handle_se05(DDukeActor* i, int FIRELASER);
void handle_se05(DDukeActor* i);
void handle_se08(DDukeActor* i, bool checkhitag1);
void handle_se10(DDukeActor* i, const int *);
void handle_se11(DDukeActor* i);

View file

@ -31,7 +31,6 @@ int PicForName(int intname)
{"DukeLavaPool", "LAVAPOOL"},
{"RedneckCircleStuck", "CIRCLESTUCK"},
{"DukePigCop", "PIGCOP"},
{"DukeFireLaser", "FIRELASER"},
};
for (auto& p : classes)

View file

@ -55,6 +55,7 @@ spawnclasses
2297 = DukeBloodSplat2
2298 = DukeBloodSplat3
2299 = DukeBloodSplat4
1625 = DukeFireLaser
1272 = DukeTrash
634 = DukeBolt1

View file

@ -56,6 +56,7 @@ spawnclasses
1526 = DukeBloodSplat2
1527 = DukeBloodSplat3
1528 = DukeBloodSplat4
3420 = DukeFireLaser
285 = RedneckChickenSpawner1
286 = RedneckChickenSpawner2

View file

@ -159,3 +159,68 @@ class DukeProjectile : DukeActor
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
class DukeFirelaser : DukeProjectile // Liztrooper shot
{
default
{
spriteset "FIRELASER", "FIRELASER2", "FIRELASER3", "FIRELASER4", "FIRELASER5", "FIRELASER6";
}
override bool postmoveeffect(CollisionData coll)
{
if (Super.postmoveeffect(coll)) return true;
for (int k = -3; k < 2; k++)
{
double zAdd = k * self.vel.Z / 24;
let spawned = dlevel.SpawnActor(self.sector, self.pos.plusZ(zAdd) + self.angle.ToVector() * k * 2., 'DukeFireLaserTrail', -40 + (k << 2), self.scale, 0, 0., 0., self.ownerActor, STAT_MISC);
if (spawned)
{
spawned.opos = self.opos - self.pos + spawned.pos;
spawned.cstat = CSTAT_SPRITE_YCENTER;
spawned.pal = self.pal;
}
}
return false;
}
override bool animate(tspritetype tspr)
{
if (Raze.isRR()) tspr.setSpritePic(self, ((PlayClock >> 2) % 6));
tspr.shade = -127;
return true;
}
}
class DukeFirelaserTrail : DukeActor
{
default
{
statnum STAT_MISC;
spriteset "FIRELASER", "FIRELASER2", "FIRELASER3", "FIRELASER4", "FIRELASER5", "FIRELASER6";
}
override void Tick()
{
if (self.extra == 999)
{
self.Destroy();
}
}
override bool animate(tspritetype tspr)
{
self.extra = 999;
if (Raze.isRR()) tspr.setSpritePic(self, ((PlayClock >> 2) % 6));
tspr.shade = -127;
return true;
}
}