- scriptified the trash actor.

This commit is contained in:
Christoph Oelckers 2022-11-19 12:54:15 +01:00
parent 9cf6f5dabc
commit 676ca73983
8 changed files with 33 additions and 37 deletions

View file

@ -673,25 +673,6 @@ void detonate(DDukeActor *actor, int explosion)
//
//---------------------------------------------------------------------------
void movetrash(DDukeActor *actor)
{
if (actor->vel.X == 0) actor->vel.X = 1 / 16.;
if (ssp(actor, CLIPMASK0))
{
makeitfall(actor);
if (krand() & 1) actor->vel.Z -= 1;
if (abs(actor->vel.X) < 3)
actor->vel.X += (krand() & 3) / 16.;
}
else deletesprite(actor);
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void movewaterdrip(DDukeActor *actor, int drip)
{
if (actor->temp_data[1])

View file

@ -950,11 +950,6 @@ void movestandables_d(void)
moveviewscreen(act);
}
else if (picnum == TRASH)
{
movetrash(act);
}
else if (picnum >= SIDEBOLT1 && picnum <= SIDEBOLT1 + 3)
{
movesidebolt(act);

View file

@ -641,14 +641,8 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
case WATERDRIP:
initwaterdrip(actj, act);
break;
case TRASH:
if (act->spr.picnum != WATERDRIP)
act->spr.angle = randomAngle();
[[fallthrough]];
case WATERDRIPSPLASH:
act->spr.scale = DVector2(0.375, 0.375);
ChangeActorStat(act, STAT_STANDABLE);
break;

View file

@ -671,13 +671,6 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
case WATERDRIP:
initwaterdrip(actj, act);
break;
case TRASH:
if (act->spr.picnum != WATERDRIP) act->spr.angle = randomAngle();
act->spr.scale = DVector2(0.375, 0.375);
ChangeActorStat(act, STAT_STANDABLE);
break;
case PLUG:
act->spr.lotag = 9999;

View file

@ -25,5 +25,6 @@ spawnclasses
916 = DukeFireext
1079 = DukeOozFilter
1247 = DukeSeenine
1272 = DukeTrash
}

View file

@ -21,5 +21,6 @@ spawnclasses
1078 = DukeCrack4
1273 = DukeOozFilter
1324 = DukeSeenine
1346 = DukeTrash
}

View file

@ -60,6 +60,7 @@ version "4.10"
#include "zscript/games/duke/actors/crack.zs"
#include "zscript/games/duke/actors/fireext.zs"
#include "zscript/games/duke/actors/oozfilter.zs"
#include "zscript/games/duke/actors/trash.zs"
#include "zscript/games/blood/bloodgame.zs"
#include "zscript/games/blood/ui/menu.zs"

View file

@ -0,0 +1,30 @@
class DukeTrash : DukeActor
{
default
{
ScaleX 0.375;
ScaleY 0.375;
statnum STAT_STANDABLE;
pic "TRASH";
}
override void Initialize()
{
self.angle = frandom(0, 360);
}
override void Tick()
{
if (self.vel.X == 0) self.vel.X = 1 / 16.;
if (self.DoMove(CLIPMASK0))
{
self.makeitfall();
if (random(0, 1)) self.vel.Z -= 1;
if (abs(self.vel.X) < 3)
self.vel.X += random(0, 3) / 16.;
}
else self.Destroy();
}
}