diff --git a/source/core/actorlist.cpp b/source/core/actorlist.cpp index 16b4e4884..257337b89 100644 --- a/source/core/actorlist.cpp +++ b/source/core/actorlist.cpp @@ -249,7 +249,7 @@ static void AddSectTail(DCoreActor *actor, sectortype* sect) // //========================================================================== -static void AddSectHead(DCoreActor *actor, sectortype* sect) +static void AddSectHead(DCoreActor* actor, sectortype* sect) { assert(actor->prevSect == nullptr && actor->nextSect == nullptr); @@ -280,8 +280,8 @@ static void RemoveActorSect(DCoreActor* actor) assert(actor->prevSect == nullptr && actor->nextSect == nullptr); return; } - DCoreActor *prev = actor->prevSect; - DCoreActor *next = actor->nextSect; + DCoreActor* prev = actor->prevSect; + DCoreActor* next = actor->nextSect; auto& firstEntry = actor->link_sector->firstEntry; auto& lastEntry = actor->link_sector->lastEntry; @@ -346,6 +346,10 @@ void ChangeActorSect(DCoreActor* actor, sectortype* sect, bool tail) DCoreActor* InsertActor(PClass* type, sectortype* sector, int stat, bool tail) { assert(type->IsDescendantOf(RUNTIME_CLASS(DCoreActor))); + if (!type->IsDescendantOf(RUNTIME_CLASS(DCoreActor))) + { + I_Error("Tried to spawn object of non - actor class %s", type->TypeName.GetChars()); + } auto actor = static_cast(type->CreateNew()); auto defaults = GetDefaultByType(type); diff --git a/source/core/thingdef_properties.cpp b/source/core/thingdef_properties.cpp index 74681e300..79e47e174 100644 --- a/source/core/thingdef_properties.cpp +++ b/source/core/thingdef_properties.cpp @@ -452,8 +452,8 @@ DEFINE_PROPERTY(clipdist, I, CoreActor) //========================================================================== DEFINE_PROPERTY(scalex, F, CoreActor) { - PROP_INT_PARM(i, 0); - defaults->spr.scale.X = (i); + PROP_FLOAT_PARM(i, 0); + defaults->spr.scale.X = i; bag.Info->ActorInfo()->DefaultFlags |= DEFF_XREPEAT; } @@ -462,8 +462,8 @@ DEFINE_PROPERTY(scalex, F, CoreActor) //========================================================================== DEFINE_PROPERTY(scaley, F, CoreActor) { - PROP_INT_PARM(i, 0); - defaults->spr.scale.Y = (i); + PROP_FLOAT_PARM(i, 0); + defaults->spr.scale.Y = i; bag.Info->ActorInfo()->DefaultFlags |= DEFF_YREPEAT; } diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index e7d7b68ea..9a5f17550 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -673,48 +673,6 @@ void detonate(DDukeActor *actor, int explosion) // //--------------------------------------------------------------------------- -void movewaterdrip(DDukeActor *actor, int drip) -{ - if (actor->temp_data[1]) - { - actor->temp_data[1]--; - if (actor->temp_data[1] == 0) - actor->spr.cstat &= ~CSTAT_SPRITE_INVISIBLE; - } - else - { - makeitfall(actor); - ssp(actor, CLIPMASK0); - if(actor->vel.X > 0) actor->vel.X -= 1/8.; - - if (actor->vel.Z == 0) - { - actor->spr.cstat |= CSTAT_SPRITE_INVISIBLE; - - if (actor->spr.pal != 2 && (isRR() || actor->spr.hitag == 0)) - S_PlayActorSound(SOMETHING_DRIPPING, actor); - - auto Owner = actor->GetOwner(); - if (!Owner || Owner->spr.picnum != drip) - { - deletesprite(actor); - } - else - { - actor->spr.pos.Z = actor->temp_pos.Z; - actor->backupz(); - actor->temp_data[1] = 48 + (krand() & 31); - } - } - } -} - -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- - void movedoorshock(DDukeActor* actor) { auto sectp = actor->sector(); diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index dbdc69509..42b5cb889 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -849,11 +849,6 @@ void movestandables_d(void) moveviewscreen(act); } - else if (picnum == WATERDRIP) - { - movewaterdrip(act, WATERDRIP); - } - else if (picnum == DOORSHOCK) { movedoorshock(act); diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index 8814c846c..1e2014a02 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -732,11 +732,6 @@ void movestandables_r(void) continue; } - else if (picnum == WATERDRIP) - { - movewaterdrip(act, WATERDRIP); - } - else if (picnum == DOORSHOCK) { movedoorshock(act); diff --git a/source/games/duke/src/funct.h b/source/games/duke/src/funct.h index 9ceea7379..3b803ae31 100644 --- a/source/games/duke/src/funct.h +++ b/source/games/duke/src/funct.h @@ -32,7 +32,6 @@ void movefta(); void clearcameras(int i, player_struct* p); void RANDOMSCRAP(DDukeActor* i); void detonate(DDukeActor* i, int explosion); -void movewaterdrip(DDukeActor* i, int drip); void movedoorshock(DDukeActor* i); void movetouchplate(DDukeActor* i, int plate); void movecanwithsomething(DDukeActor* i); @@ -191,7 +190,6 @@ void spawntransporter(DDukeActor* actj, DDukeActor* acti, bool beam); int spawnbloodpoolpart1(DDukeActor* acti); void initfootprint(DDukeActor* actj, DDukeActor* acti); void initshell(DDukeActor* actj, DDukeActor* acti, bool isshell); -void initwaterdrip(DDukeActor* actj, DDukeActor* acti); int initreactor(DDukeActor* actj, DDukeActor* acti, bool isrecon); void spawneffector(DDukeActor* actor, TArray* actors); int startrts(int lumpNum, int localPlayer); diff --git a/source/games/duke/src/spawn.cpp b/source/games/duke/src/spawn.cpp index aa810d002..5e1503758 100644 --- a/source/games/duke/src/spawn.cpp +++ b/source/games/duke/src/spawn.cpp @@ -462,38 +462,6 @@ void initshell(DDukeActor* actj, DDukeActor* act, bool isshell) } } -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- - -void initwaterdrip(DDukeActor* actj, DDukeActor* actor) -{ - if (actj && (actj->spr.statnum == 10 || actj->spr.statnum == 1)) - { - actor->spr.shade = 32; - if (actj->spr.pal != 1) - { - actor->spr.pal = 2; - actor->spr.pos.Z -= 18; - } - else actor->spr.pos.Z -= 13; - actor->spr.angle = (ps[connecthead].pos.XY() - actor->spr.pos.XY()).Angle(); - actor->vel.X = 3 - krandf(2); - ssp(actor, CLIPMASK0); - } - else if (!actj) - { - actor->spr.pos.Z += 4; - actor->temp_pos.Z = actor->spr.pos.Z; - if (!isRR()) actor->temp_data[1] = krand() & 127; - } - actor->spr.scale = DVector2(0.375, 0.375); - ChangeActorStat(actor, STAT_STANDABLE); -} - - //--------------------------------------------------------------------------- // // diff --git a/source/games/duke/src/spawn_d.cpp b/source/games/duke/src/spawn_d.cpp index 54135766a..38aa7d1c4 100644 --- a/source/games/duke/src/spawn_d.cpp +++ b/source/games/duke/src/spawn_d.cpp @@ -638,10 +638,6 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray* ChangeActorStat(act, STAT_MISC); break; - case WATERDRIP: - initwaterdrip(actj, act); - break; - case WATERDRIPSPLASH: act->spr.scale = DVector2(0.375, 0.375); ChangeActorStat(act, STAT_STANDABLE); diff --git a/source/games/duke/src/spawn_r.cpp b/source/games/duke/src/spawn_r.cpp index bf8016a0a..0c3d11470 100644 --- a/source/games/duke/src/spawn_r.cpp +++ b/source/games/duke/src/spawn_r.cpp @@ -668,9 +668,6 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray* act->spr.scale = DVector2(0.5, 0.5); ChangeActorStat(act, STAT_MISC); break; - case WATERDRIP: - initwaterdrip(actj, act); - 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 c4877ca37..d0c1a2b61 100644 --- a/wadsrc/static/filter/duke/engine/engine.def +++ b/wadsrc/static/filter/duke/engine/engine.def @@ -34,4 +34,5 @@ spawnclasses 4526 = DukeSideBolt2 4527 = DukeSideBolt3 4528 = DukeSideBolt4 + 660 = DukeWaterdrip } diff --git a/wadsrc/static/filter/redneck/engine/engine.def b/wadsrc/static/filter/redneck/engine/engine.def index 47e3ba969..fbcc6daee 100644 --- a/wadsrc/static/filter/redneck/engine/engine.def +++ b/wadsrc/static/filter/redneck/engine/engine.def @@ -26,5 +26,6 @@ spawnclasses 1128 = DukeBolt2 1129 = DukeBolt3 1130 = DukeBolt4 + 239 = DukeWaterdrip } diff --git a/wadsrc/static/zscript.txt b/wadsrc/static/zscript.txt index 797efbb90..b42b1700d 100644 --- a/wadsrc/static/zscript.txt +++ b/wadsrc/static/zscript.txt @@ -62,6 +62,7 @@ version "4.10" #include "zscript/games/duke/actors/oozfilter.zs" #include "zscript/games/duke/actors/trash.zs" #include "zscript/games/duke/actors/bolt.zs" +#include "zscript/games/duke/actors/waterdrip.zs" #include "zscript/games/blood/bloodgame.zs" #include "zscript/games/blood/ui/menu.zs" diff --git a/wadsrc/static/zscript/games/duke/actors/waterdrip.zs b/wadsrc/static/zscript/games/duke/actors/waterdrip.zs new file mode 100644 index 000000000..d374634f0 --- /dev/null +++ b/wadsrc/static/zscript/games/duke/actors/waterdrip.zs @@ -0,0 +1,74 @@ +class DukeWaterDrip : DukeActor +{ + default + { + ScaleX 0.375; + ScaleY 0.375; + statnum STAT_STANDABLE; + pic "WATERDRIP"; + } + + override void Initialize() + { + let owner = self.ownerActor; + if (owner && (owner.statnum == STAT_PLAYER || owner.statnum == STAT_ACTOR)) + { + self.shade = 32; + if (owner.pal != 1) + { + self.pal = 2; + self.pos.Z -= 18; + } + else self.pos.Z -= 13; + self.angle = (Duke.GetViewPlayer().actor.pos.XY - self.pos.XY).Angle(); + self.vel.X = frandom(1, 3); + self.DoMove(CLIPMASK0); + } + else if (owner == self) + { + self.pos.Z += 4; + self.temp_pos.Z = self.pos.Z; + self.temp_data[1] = random(0, 127); + } + } + + override void Tick() + { + if (self.temp_data[1]) + { + self.temp_data[1]--; + if (self.temp_data[1] == 0) + self.cstat &= ~CSTAT_SPRITE_INVISIBLE; + } + else + { + self.makeitfall(); + self.DoMove(CLIPMASK0); + if(self.vel.X > 0) self.vel.X -= 1/8.; + + if (self.vel.Z == 0) + { + self.cstat |= CSTAT_SPRITE_INVISIBLE; + + if (self.pal != 2 && (self.hitag == 0 || Raze.isRR())) + self.PlayActorSound(DukeSnd.SOMETHING_DRIPPING); + + if (self.ownerActor != self) + { + self.Destroy(); + } + else + { + self.pos.Z = self.temp_pos.Z; + self.backuppos(); + self.temp_data[1] = random(48, 79); + } + } + } + } + + +} + + +