- scriptified the fire extinguisher.

This commit is contained in:
Christoph Oelckers 2022-11-17 20:19:22 +01:00
parent f9826241ef
commit 26ba1f601e
6 changed files with 75 additions and 81 deletions

View file

@ -794,63 +794,6 @@ void movefallers_d(void)
//
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
//
// Duke only
//
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
//
// Duke only
//
//---------------------------------------------------------------------------
static void movefireext(DDukeActor* actor)
{
int j = fi.ifhitbyweapon(actor);
if (j == -1) return;
for (int k = 0; k < 16; k++)
{
auto a = randomAngle();
auto vel = krandf(4) + 4;
auto zvel = -krandf(16) - actor->vel.Z * 0.25;
auto spawned = CreateActor(actor->sector(), actor->spr.pos.plusZ(krandf(-48)), PClass::FindActor("DukeScrap"), -8, DVector2(0.75, 0.75), a, vel, zvel, actor, STAT_MISC);
if (spawned)
{
if (spawned) spawned->spriteextra = Scrap3 + krand() & 3;
spawned->spr.pal = 2;
}
}
spawn(actor, EXPLOSION2);
S_PlayActorSound(PIPEBOMB_EXPLODE, actor);
S_PlayActorSound(GLASS_HEAVYBREAK, actor);
if (actor->spr.hitag > 0)
{
DukeStatIterator it(STAT_STANDABLE);
while (auto a1 = it.Next())
{
if (actor->spr.hitag == a1->spr.hitag && actorflag(a1, SFLAG2_BRIGHTEXPLODE))
if (a1->spr.shade != -32)
a1->spr.shade = -32;
}
int x = actor->spr.extra;
spawn(actor, EXPLOSION2);
fi.hitradius(actor, gs.pipebombblastradius, x >> 2, x - (x >> 1), x - (x >> 2), x);
S_PlayActorSound(PIPEBOMB_EXPLODE, actor);
detonate(actor, EXPLOSION2);
}
else
{
fi.hitradius(actor, gs.seenineblastradius, 10, 15, 20, 25);
deletesprite(actor);
}
}
//---------------------------------------------------------------------------
//
//
@ -1002,11 +945,6 @@ void movestandables_d(void)
continue;
}
else if (picnum == FIREEXT)
{
movefireext(act);
}
else if (picnum == OOZFILTER || picnum == SEENINE || picnum == SEENINEDEAD || picnum == (SEENINEDEAD + 1))
{
moveooz(act, SEENINE, SEENINEDEAD, OOZFILTER, EXPLOSION2);

View file

@ -108,7 +108,6 @@ x(MASKWALL12, 150)
x(MASKWALL13, 151)
x(MASKWALL14, 152)
x(MASKWALL15, 153)
x(FIREEXT, 155)
x(W_LIGHT, 156)
x(SCREENBREAK1, 159)
x(SCREENBREAK2, 160)

View file

@ -1060,24 +1060,6 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
ChangeActorStat(act, STAT_STANDABLE);
break;
case FIREEXT:
act->spr.cstat = CSTAT_SPRITE_BLOCK_ALL;
act->spr.extra = gs.impact_damage << 2;
if (ud.multimode < 2 && act->spr.pal != 0)
{
act->spr.scale = DVector2(0, 0);
ChangeActorStat(act, STAT_MISC);
break;
}
act->spr.pal = 0;
act->SetOwner(act);
ChangeActorStat(act, STAT_STANDABLE);
act->vel.X = 0.5;
ssp(act, CLIPMASK0);
break;
case TOILET:
case STALL:
act->spr.lotag = 1;

View file

@ -20,4 +20,5 @@ spawnclasses
547 = DukeCrack2
548 = DukeCrack3
549 = DukeCrack4
916 = DukeFireext
}

View file

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

View file

@ -0,0 +1,73 @@
class DukeFireext : DukeActor
{
default
{
statnum STAT_STANDABLE;
pic "FIREEXT";
}
override void Initialize()
{
self.cstat = CSTAT_SPRITE_BLOCK_ALL;
self.extra = gs.impact_damage << 2;
if (ud.multimode < 2 && self.pal != 0)
{
self.scale = (0, 0);
self.ChangeStat(STAT_MISC);
return;
}
self.pal = 0;
self.ownerActor = self;
self.vel.X = 0.5;
self.DoMove(CLIPMASK0);
}
override void Tick()
{
int j = self.ifhitbyweapon();
if (j == -1) return;
for (int k = 0; k < 16; k++)
{
let a = frandom(0, 360);
let vel = frandom(0, 4) + 4;
let zvel = -frandom(0, 16) - self.vel.Z * 0.25;
let spawned = dlevel.SpawnActor(self.sector, self.pos.plusZ(frandom(-48, 0)), 'DukeScrap', -8, (0.75, 0.75), a, vel, zvel, self);
if (spawned)
{
if (spawned) spawned.spriteextra = DukeScrap.Scrap3 + random(0, 3);
spawned.pal = 2;
}
}
self.spawn("DukeExplosion2");
self.PlayActorSound(DukeSnd.PIPEBOMB_EXPLODE);
self.PlayActorSound(DukeSnd.GLASS_HEAVYBREAK);
if (self.hitag > 0)
{
DukeStatIterator it;
for(let a1 = it.First(STAT_STANDABLE); a1; a1 = it.Next())
{
if (self.hitag == a1.hitag && a1.actorflag2(SFLAG2_BRIGHTEXPLODE))
if (a1.shade != -32)
a1.shade = -32;
}
int x = self.extra;
self.spawn("DukeExplosion2");
self.hitradius(gs.pipebombblastradius, x >> 2, x - (x >> 1), x - (x >> 2), x);
self.PlayActorSound(DukeSnd.PIPEBOMB_EXPLODE);
self.detonate("DukeExplosion2");
}
else
{
self.hitradius(gs.seenineblastradius, 10, 15, 20, 25);
self.Destroy();
}
}
}