From 676ca7398350ec4c7f676dd266139cbfdd2ad601 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 19 Nov 2022 12:54:15 +0100 Subject: [PATCH] - scriptified the trash actor. --- source/games/duke/src/actors.cpp | 19 ------------ source/games/duke/src/actors_d.cpp | 5 ---- source/games/duke/src/spawn_d.cpp | 6 ---- source/games/duke/src/spawn_r.cpp | 7 ----- wadsrc/static/filter/duke/engine/engine.def | 1 + .../static/filter/redneck/engine/engine.def | 1 + wadsrc/static/zscript.txt | 1 + .../static/zscript/games/duke/actors/trash.zs | 30 +++++++++++++++++++ 8 files changed, 33 insertions(+), 37 deletions(-) create mode 100644 wadsrc/static/zscript/games/duke/actors/trash.zs diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index 6f2a8fa7c..e7d7b68ea 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -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]) diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index 82ac6db6d..034fcc406 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -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); diff --git a/source/games/duke/src/spawn_d.cpp b/source/games/duke/src/spawn_d.cpp index e35353b21..98843f868 100644 --- a/source/games/duke/src/spawn_d.cpp +++ b/source/games/duke/src/spawn_d.cpp @@ -641,14 +641,8 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray* 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; diff --git a/source/games/duke/src/spawn_r.cpp b/source/games/duke/src/spawn_r.cpp index 727fec433..6b368a029 100644 --- a/source/games/duke/src/spawn_r.cpp +++ b/source/games/duke/src/spawn_r.cpp @@ -671,13 +671,6 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray* 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; diff --git a/wadsrc/static/filter/duke/engine/engine.def b/wadsrc/static/filter/duke/engine/engine.def index 9e1a33a69..2e1396262 100644 --- a/wadsrc/static/filter/duke/engine/engine.def +++ b/wadsrc/static/filter/duke/engine/engine.def @@ -25,5 +25,6 @@ spawnclasses 916 = DukeFireext 1079 = DukeOozFilter 1247 = DukeSeenine + 1272 = DukeTrash } diff --git a/wadsrc/static/filter/redneck/engine/engine.def b/wadsrc/static/filter/redneck/engine/engine.def index 2e222e189..7a6ab397b 100644 --- a/wadsrc/static/filter/redneck/engine/engine.def +++ b/wadsrc/static/filter/redneck/engine/engine.def @@ -21,5 +21,6 @@ spawnclasses 1078 = DukeCrack4 1273 = DukeOozFilter 1324 = DukeSeenine + 1346 = DukeTrash } diff --git a/wadsrc/static/zscript.txt b/wadsrc/static/zscript.txt index 2f290cb5c..91688940b 100644 --- a/wadsrc/static/zscript.txt +++ b/wadsrc/static/zscript.txt @@ -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" diff --git a/wadsrc/static/zscript/games/duke/actors/trash.zs b/wadsrc/static/zscript/games/duke/actors/trash.zs new file mode 100644 index 000000000..8f1ea9221 --- /dev/null +++ b/wadsrc/static/zscript/games/duke/actors/trash.zs @@ -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(); + } +} + +