From 7cbc713b4edace6db0cc10f9b20c99bc4e741708 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 2 Dec 2022 17:34:44 +0100 Subject: [PATCH] - scriptified stat121 special effect. --- source/games/duke/src/actors_r.cpp | 32 +------------ source/games/duke/src/constants.h | 1 + source/games/duke/src/namelist_r.h | 5 ++ source/games/duke/src/premap_r.cpp | 2 +- source/games/duke/src/spawn_r.cpp | 8 ---- .../redneck.ridesagain/engine/engine.def | 1 + wadsrc/static/zscript.txt | 1 + .../zscript/games/duke/actors/pigback.zs | 47 +++++++++++++++++++ wadsrc/static/zscript/games/duke/dukeactor.zs | 1 + 9 files changed, 58 insertions(+), 40 deletions(-) create mode 100644 wadsrc/static/zscript/games/duke/actors/pigback.zs diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index 6ac276bfe..306c6d90b 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -996,7 +996,7 @@ void movetransports_r(void) static void rrra_specialstats() { Collision coll; - DukeStatIterator it(118); + DukeStatIterator it(STAT_BOBBING); while (auto act = it.Next()) { if (act->spr.hitag > 1) @@ -1087,36 +1087,6 @@ static void rrra_specialstats() enemysizecheat = 0; } - it.Reset(121); - while (auto act = it.Next()) - { - act->spr.extra++; - if (act->spr.extra < 100) - { - if (act->spr.extra == 90) - { - act->spr.picnum--; - if (act->spr.picnum < PIG + 7) - act->spr.picnum = PIG + 7; - act->spr.extra = 1; - } - movesprite_ex(act, DVector3(0, 0, -300/256.), CLIPMASK0, coll); - if (act->sector()->ceilingz+ 4 > act->spr.pos.Z) - { - act->spr.picnum = 0; - act->spr.extra = 100; - } - } - else if (act->spr.extra == 200) - { - // This was really 10 and not (10 << 8)! - SetActor(act, DVector3(act->spr.pos.X, act->spr.pos.Y, act->sector()->floorz - 10 * zmaptoworld)); - act->spr.extra = 1; - act->spr.picnum = PIG + 11; - spawn(act, TRANSPORTERSTAR); - } - } - it.Reset(STAT_RABBITSPAWN); while (auto act = it.Next()) { diff --git a/source/games/duke/src/constants.h b/source/games/duke/src/constants.h index ace79f8fd..fd2983140 100644 --- a/source/games/duke/src/constants.h +++ b/source/games/duke/src/constants.h @@ -280,6 +280,7 @@ enum STAT_CHICKENPLANT = 106, STAT_LUMBERMILL = 107, STAT_TELEPORT = 108, + STAT_BOBBING = 118, STAT_RABBITSPAWN = 119, STAT_REMOVED = MAXSTATUS-2, STAT_NETALLOC = MAXSTATUS-1 diff --git a/source/games/duke/src/namelist_r.h b/source/games/duke/src/namelist_r.h index cdefcd9ff..a288866fd 100644 --- a/source/games/duke/src/namelist_r.h +++ b/source/games/duke/src/namelist_r.h @@ -1457,6 +1457,11 @@ x(HENSTAND, 4897) x(HENSTAND1, 4898) x(PIG, 4945) x(PIGSTAYPUT, 4946) +x(PIGBACK4, 4952) +x(PIGBACK3, 4953) +x(PIGBACK2, 4954) +x(PIGBACK1, 4955) +x(PIGBACK, 4956) x(PIGEAT, 4983) x(SBMOVE, 5015) // E1L7 shit boss, only RR1. x(SBSPIT, 5050) diff --git a/source/games/duke/src/premap_r.cpp b/source/games/duke/src/premap_r.cpp index a04af4b8f..c51421e69 100644 --- a/source/games/duke/src/premap_r.cpp +++ b/source/games/duke/src/premap_r.cpp @@ -438,7 +438,7 @@ void prelevel_r(int g, TArray& actors) actor->spr.extra = 0; actor->spr.hitag = 1; actor->spr.pal = 0; - ChangeActorStat(actor, 118); + ChangeActorStat(actor, STAT_BOBBING); } } } diff --git a/source/games/duke/src/spawn_r.cpp b/source/games/duke/src/spawn_r.cpp index af3955449..d02603a0c 100644 --- a/source/games/duke/src/spawn_r.cpp +++ b/source/games/duke/src/spawn_r.cpp @@ -63,14 +63,6 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray* act->spr.cstat |= CSTAT_SPRITE_BLOCK_ALL; ChangeActorStat(act, 116); break; - case PIG + 11: - if (!isRRRA()) goto default_case; - act->spr.scale = DVector2(0.25, 0.25); - act->clipdist = 0; - act->spr.extra = 0; - act->spr.cstat = 0; - ChangeActorStat(act, 121); - break; case RRTILE7936: if (!isRRRA()) goto default_case; act->spr.scale = DVector2(0, 0); diff --git a/wadsrc/static/filter/redneck.ridesagain/engine/engine.def b/wadsrc/static/filter/redneck.ridesagain/engine/engine.def index 761ff7081..163bbafc2 100644 --- a/wadsrc/static/filter/redneck.ridesagain/engine/engine.def +++ b/wadsrc/static/filter/redneck.ridesagain/engine/engine.def @@ -44,6 +44,7 @@ spawnclasses 8192 = RedneckUfoSpawnerToggle 1781 = RedneckChickenArrow 1790 = RedneckBoatGrenade + 4956 = RedneckPigDisplay 7636 = DukeGenericDestructible, "OLDPHOTO0", "OLDPHOTO0BROKE", "VENT_BUST" 7638 = DukeGenericDestructible, "OLDPHOTO1", "OLDPHOTO1BROKE", "VENT_BUST" diff --git a/wadsrc/static/zscript.txt b/wadsrc/static/zscript.txt index 14f13fe1d..1e80525f7 100644 --- a/wadsrc/static/zscript.txt +++ b/wadsrc/static/zscript.txt @@ -109,6 +109,7 @@ version "4.10" #include "zscript/games/duke/actors/rrcactus.zs" #include "zscript/games/duke/actors/balloons.zs" #include "zscript/games/duke/actors/gamblingmachine.zs" +#include "zscript/games/duke/actors/pigback.zs" #include "zscript/games/blood/bloodgame.zs" #include "zscript/games/blood/ui/menu.zs" diff --git a/wadsrc/static/zscript/games/duke/actors/pigback.zs b/wadsrc/static/zscript/games/duke/actors/pigback.zs new file mode 100644 index 000000000..60af717a1 --- /dev/null +++ b/wadsrc/static/zscript/games/duke/actors/pigback.zs @@ -0,0 +1,47 @@ +// This appears not to be used +class RedneckPigDisplay : DukeActor +{ + default + { + spriteset "PIGBACK", "PIGBACK1", "PIGBACK2", "PIGBACK3", "PIGBACK4"; + ScaleX 0.25; + ScaleY 0.25; + clipdist 0; + extra 0; + statnum STAT_ACTOR; + } + + override void Initialize() + { + cstat = 0; + } + + override void Tick() + { + self.extra++; + if (self.extra < 100) + { + if (self.extra == 90) + { + self.setSpriteSetImage(min(self.spritesetIndex + 1, 4)); + self.extra = 1; + } + self.movesprite((0, 0, -300/256.), CLIPMASK0); + if (self.sector.ceilingz + 4 > self.pos.Z) + { + self.cstat = CSTAT_SPRITE_INVISIBLE; + self.extra = 100; + } + } + else if (self.extra == 200) + { + // This was really 10 and not (10 << 8)! + self.SetPosition((self.pos.X, self.pos.Y, self.sector.floorz - 10 * zmaptoworld)); + self.extra = 1; + self.cstat = 0; + self.setSpriteSetImage(0); + self.spawn("DukeTransporterStar"); + } + } +} + diff --git a/wadsrc/static/zscript/games/duke/dukeactor.zs b/wadsrc/static/zscript/games/duke/dukeactor.zs index 043310933..5f7b5ebc5 100644 --- a/wadsrc/static/zscript/games/duke/dukeactor.zs +++ b/wadsrc/static/zscript/games/duke/dukeactor.zs @@ -109,6 +109,7 @@ class DukeActor : CoreActor native STAT_CHICKENPLANT = 106, STAT_LUMBERMILL = 107, STAT_TELEPORT = 108, + STAT_BOBBING = 118, STAT_RABBITSPAWN = 119, STAT_REMOVED = MAXSTATUS-2,