- scriptified the native parts of the powder keg.

This was the last remaining actor with its own native ticking part.
This commit is contained in:
Christoph Oelckers 2022-12-12 08:40:14 +01:00
parent 9f01c87ccb
commit 0db441accb
7 changed files with 38 additions and 57 deletions

View file

@ -1018,10 +1018,6 @@ static void rrra_specialstats()
void moveactors_r(void) void moveactors_r(void)
{ {
double xx;
int p;
Collision coll;
dojaildoor(); dojaildoor();
moveminecart(); moveminecart();
@ -1033,46 +1029,7 @@ void moveactors_r(void)
if (ud.chickenplant) tickstat(STAT_CHICKENPLANT); if (ud.chickenplant) tickstat(STAT_CHICKENPLANT);
tickstat(STAT_BOWLING); tickstat(STAT_BOWLING);
tickstat(STAT_TELEPORT); tickstat(STAT_TELEPORT);
tickstat(STAT_ACTOR);
DukeStatIterator it(STAT_ACTOR);
while (auto act = it.Next())
{
if( act->spr.scale.X == 0 || !act->insector() || actorflag(act, SFLAG2_DIENOW))
{
act->Destroy();
continue;
}
if (monsterCheatCheck(act) && badguy(act))
{
continue;
}
auto sectp = act->sector();
if (act->GetClass() != RUNTIME_CLASS(DDukeActor))
{
CallTick(act);
continue;
}
else switch(act->spr.picnum)
{
case RTILE_POWDERKEG:
if (!isRRRA() || (sectp->lotag != ST_1_ABOVE_WATER && sectp->lotag != ST_160_FLOOR_TELEPORT))
if (act->vel.X != 0)
{
movesprite_ex(act, DVector3(act->spr.Angles.Yaw.ToVector()* act->vel.X, act->vel.Z), CLIPMASK0, coll);
act->vel.X -= 1. / 16.;
}
break;
}
p = findplayer(act, &xx);
execute(act,p,xx);
}
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------

View file

@ -126,8 +126,6 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
if (h->spr.extra > 0) if (h->spr.extra > 0)
t->pos.Z += 6; t->pos.Z += 6;
break; break;
case RTILE_POWDERKEG:
continue;
case RTILE_BURNING: case RTILE_BURNING:
if (OwnerAc && OwnerAc->spr.statnum == STAT_PLAYER) if (OwnerAc && OwnerAc->spr.statnum == STAT_PLAYER)
{ {

View file

@ -230,6 +230,7 @@ void initactorflags_r()
RTILE_SHITBALL, RTILE_SHITBALL,
RTILE_RPG, RTILE_RPG,
RTILE_RECON, RTILE_RECON,
RTILE_POWDERKEG
}); });
// Animals were not supposed to have this, but due to a coding bug the logic was unconditional for everything in the game. // Animals were not supposed to have this, but due to a coding bug the logic was unconditional for everything in the game.
for (auto& ainf : gs.actorinfo) for (auto& ainf : gs.actorinfo)

View file

@ -816,17 +816,6 @@ void shoot_r(DDukeActor* actor, int atwith, PClass* cls)
shootweapon(actor, p, spos, sang, atwith); shootweapon(actor, p, spos, sang, atwith);
return; return;
case RTILE_POWDERKEG:
{
auto j = spawn(actor, atwith);
if (j)
{
j->vel.X = 2;
j->spr.Angles.Yaw = actor->spr.Angles.Yaw;
j->spr.pos.Z -= 5;
}
break;
}
case RTILE_OWHIP: case RTILE_OWHIP:
case RTILE_UWHIP: case RTILE_UWHIP:
shootwhip(actor, p, spos, sang, atwith); shootwhip(actor, p, spos, sang, atwith);

View file

@ -125,6 +125,7 @@ spawnclasses
1083 = DukeCameraPole 1083 = DukeCameraPole
26 = RedneckDynamite 26 = RedneckDynamite
27 = RedneckPowderKeg
1416 = RedneckMortar 1416 = RedneckMortar
285 = RedneckChickenSpawner1 285 = RedneckChickenSpawner1
286 = RedneckChickenSpawner2 286 = RedneckChickenSpawner2

View file

@ -105,6 +105,7 @@ version "4.10"
#include "zscript/games/duke/actors/flamethrowerflame.zs" #include "zscript/games/duke/actors/flamethrowerflame.zs"
#include "zscript/games/duke/actors/firefly.zs" #include "zscript/games/duke/actors/firefly.zs"
#include "zscript/games/duke/actors/powderkeg.zs"
#include "zscript/games/duke/actors/redneckmisc.zs" #include "zscript/games/duke/actors/redneckmisc.zs"
#include "zscript/games/duke/actors/emptybike.zs" #include "zscript/games/duke/actors/emptybike.zs"
#include "zscript/games/duke/actors/rrteleport.zs" #include "zscript/games/duke/actors/rrteleport.zs"

View file

@ -0,0 +1,34 @@
class RedneckPowderKeg : DukeActor
{
default
{
pic "POWDERKEG";
}
override void Tick()
{
let sectp = self.sector;
if (sectp.lotag != ST_1_ABOVE_WATER && sectp.lotag != ST_160_FLOOR_TELEPORT)
if (self.vel.X != 0)
{
movesprite((self.Angle.ToVector()* self.vel.X, self.vel.Z), CLIPMASK0);
self.vel.X -= 1. / 16.;
}
Super.Tick();
}
override bool shootthis(DukeActor actor, DukePlayer p, Vector3 spos, double sang)
{
let j = actor.spawn("RedneckPowderKeg");
if (j)
{
j.vel.X = 2;
j.Angle = actor.Angle;
j.pos.Z -= 5;
}
return true;
}
}