- scriptified the remaining Duke destructibles, except the toilets.

This commit is contained in:
Christoph Oelckers 2022-12-02 20:47:23 +01:00
parent e6c466fcba
commit 15bee4ca6a
12 changed files with 221 additions and 172 deletions

View file

@ -72,22 +72,6 @@ void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
case FOOTPRINTS4:
if (t->shade == 127) continue;
break;
case CHAIR3:
if (hw_models && modelManager.CheckModel(t->picnum, t->pal))
{
t->cstat &= ~CSTAT_SPRITE_XFLIP;
break;
}
k = angletorotation1(t->Angles.Yaw, viewang);
if (k > 4)
{
k = 8 - k;
t->cstat |= CSTAT_SPRITE_XFLIP;
}
else t->cstat &= ~CSTAT_SPRITE_XFLIP;
t->picnum = h->spr.picnum + k;
break;
case BULLETHOLE:
t->shade = 16;
continue;

View file

@ -61,17 +61,6 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
case FOOTPRINTS4:
if (t->shade == 127) continue;
break;
case CHAIR3:
k = angletorotation1(t->Angles.Yaw, viewang);
if (k > 4)
{
k = 8 - k;
t->cstat |= CSTAT_SPRITE_XFLIP;
}
else t->cstat &= ~CSTAT_SPRITE_XFLIP;
t->picnum = h->spr.picnum + k;
break;
case BULLETHOLE:
t->shade = 16;
continue;

View file

@ -111,7 +111,7 @@ void initactorflags_d()
setflag(SFLAG2_DONTANIMATE, { TRIPBOMB, LASERLINE });
setflag(SFLAG2_INTERPOLATEANGLE, { BEARINGPLATE });
setflag(SFLAG2_GREENBLOOD, { OOZFILTER, NEWBEAST, NUKEBARREL });
setflag(SFLAG2_ALWAYSROTATE1, { RAT, CAMERA1 });
setflag(SFLAG2_ALWAYSROTATE1, { RAT, CAMERA1, CHAIR3 });
setflag(SFLAG2_ALWAYSROTATE2, { RPG });
setflag(SFLAG2_DIENOW, { RADIUSEXPLOSION, KNEE });
setflag(SFLAG2_TRANFERPALTOJIBS, { LIZTROOP });

View file

@ -176,7 +176,7 @@ void initactorflags_r()
if (isRRRA()) setflag(SFLAG2_BREAKMIRRORS, { RPG2 });
setflag(SFLAG2_CAMERA, { CAMERA1 });
setflag(SFLAG2_GREENBLOOD, { OOZFILTER, NUKEBARREL });
setflag(SFLAG2_ALWAYSROTATE1, { RAT, CAMERA1 });
setflag(SFLAG2_ALWAYSROTATE1, { RAT, CAMERA1, CHAIR3 });
setflag(SFLAG2_ALWAYSROTATE2, { RPG });
setflag(SFLAG2_DIENOW, { RADIUSEXPLOSION });
setflag(SFLAG2_NORADIUSPUSH, { HULK });

View file

@ -1049,8 +1049,6 @@ void checkhitdefault_d(DDukeActor* targ, DDukeActor* proj)
void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj)
{
int j;
if (targ->GetClass() != RUNTIME_CLASS(DDukeActor))
{
CallOnHit(targ, proj);
@ -1076,75 +1074,6 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj)
S_PlayActorSound(GLASS_HEAVYBREAK, targ);
break;
case HYDRENT:
targ->spr.picnum = BROKEFIREHYDRENT;
spawn(targ, TOILETWATER);
S_PlayActorSound(GLASS_HEAVYBREAK, targ);
break;
case PIPE1:
case PIPE2:
case PIPE3:
case PIPE4:
case PIPE5:
case PIPE6:
switch (targ->spr.picnum)
{
case PIPE1:targ->spr.picnum = PIPE1B; break;
case PIPE2:targ->spr.picnum = PIPE2B; break;
case PIPE3:targ->spr.picnum = PIPE3B; break;
case PIPE4:targ->spr.picnum = PIPE4B; break;
case PIPE5:targ->spr.picnum = PIPE5B; break;
case PIPE6:targ->spr.picnum = PIPE6B; break;
}
{
auto spawned = spawn(targ, STEAM);
if (spawned) spawned->spr.pos.Z = targ->sector()->floorz - 32;
}
break;
case MONK:
case LUKE:
case INDY:
case JURYGUY:
S_PlayActorSound(targ->spr.lotag, targ);
spawn(targ, targ->spr.hitag);
[[fallthrough]];
case SPACEMARINE:
{
targ->spr.extra -= proj->spr.extra;
if (targ->spr.extra > 0) break;
targ->spr.Angles.Yaw = randomAngle();
fi.shoot(targ, -1, PClass::FindActor("DukeBloodSplat1"));
targ->spr.Angles.Yaw = randomAngle();
fi.shoot(targ, -1, PClass::FindActor("DukeBloodSplat2"));
targ->spr.Angles.Yaw = randomAngle();
fi.shoot(targ, -1, PClass::FindActor("DukeBloodSplat3"));
targ->spr.Angles.Yaw = randomAngle();
fi.shoot(targ, -1, PClass::FindActor("DukeBloodSplat4"));
targ->spr.Angles.Yaw = randomAngle();
fi.shoot(targ, -1, PClass::FindActor("DukeBloodSplat1"));
targ->spr.Angles.Yaw = randomAngle();
fi.shoot(targ, -1, PClass::FindActor("DukeBloodSplat2"));
targ->spr.Angles.Yaw = randomAngle();
fi.shoot(targ, -1, PClass::FindActor("DukeBloodSplat3"));
targ->spr.Angles.Yaw = randomAngle();
fi.shoot(targ, -1, PClass::FindActor("DukeBloodSplat4"));
spawnguts(targ, PClass::FindActor("DukeJibs1"), 1);
spawnguts(targ, PClass::FindActor("DukeJibs2"), 2);
spawnguts(targ, PClass::FindActor("DukeJibs3"), 3);
spawnguts(targ, PClass::FindActor("DukeJibs4"), 4);
spawnguts(targ, PClass::FindActor("DukeJibs5"), 1);
spawnguts(targ, PClass::FindActor("DukeJibs3"), 6);
S_PlaySound(SQUISHED);
targ->Destroy();
break;
}
case CHAIR3:
S_PlayActorSound(GLASS_HEAVYBREAK, targ);
for (j = 0; j < 16; j++) RANDOMSCRAP(targ);
targ->Destroy();
break;
case PLAYERONWATER:
targ = targ->GetOwner();
if (!targ) break;

View file

@ -1385,8 +1385,6 @@ void checkhitdefault_r(DDukeActor* targ, DDukeActor* proj)
void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj)
{
int j, k;
if (targ->GetClass() != RUNTIME_CLASS(DDukeActor))
{
CallOnHit(targ, proj);
@ -1424,7 +1422,7 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj)
S_PlayActorSound(GLASS_BREAKING, targ);
lotsofglass(targ, nullptr, 10);
targ->spr.picnum++;
for (k = 0; k < 6; k++)
for (int k = 0; k < 6; k++)
{
auto a = randomAngle();
auto vel = krandf(4) + 4;
@ -1458,39 +1456,6 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj)
S_PlayActorSound(GLASS_HEAVYBREAK, targ);
break;
case HYDRENT:
targ->spr.picnum = BROKEFIREHYDRENT;
spawn(targ, TOILETWATER);
S_PlayActorSound(GLASS_HEAVYBREAK, targ);
break;
case PIPE1:
case PIPE2:
case PIPE3:
case PIPE4:
case PIPE5:
case PIPE6:
switch (targ->spr.picnum)
{
case PIPE1:targ->spr.picnum = PIPE1B; break;
case PIPE2:targ->spr.picnum = PIPE2B; break;
case PIPE3:targ->spr.picnum = PIPE3B; break;
case PIPE4:targ->spr.picnum = PIPE4B; break;
case PIPE5:targ->spr.picnum = PIPE5B; break;
case PIPE6:targ->spr.picnum = PIPE6B; break;
}
{
auto spawned = spawn(targ, STEAM);
if (spawned) spawned->spr.pos.Z = targ->sector()->floorz - 32;
}
break;
case CHAIR3:
S_PlayActorSound(GLASS_HEAVYBREAK, targ);
for (j = 0; j < 16; j++) RANDOMSCRAP(targ);
targ->Destroy();
break;
case PLAYERONWATER:
targ = targ->GetOwner();
if (!targ) break;

View file

@ -179,27 +179,6 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
ChangeActorStat(act, STAT_MISC);
break;
case SPACEMARINE:
act->spr.extra = 20;
act->spr.cstat |= CSTAT_SPRITE_BLOCK_ALL;
ChangeActorStat(act, STAT_ZOMBIEACTOR);
break;
case HYDRENT:
case MONK:
case INDY:
case LUKE:
case JURYGUY:
case PIPE1:
case PIPE2:
case PIPE3:
case PIPE4:
case PIPE5:
case PIPE6:
act->clipdist = 8;
act->spr.cstat |= CSTAT_SPRITE_BLOCK_ALL;
ChangeActorStat(act, 0);
break;
case FEMMAG1:
case FEMMAG2:
act->spr.cstat &= ~CSTAT_SPRITE_BLOCK_ALL;

View file

@ -92,14 +92,7 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
act->spr.pos.Z -= 26;
ChangeActorStat(act, STAT_MISC);
break;
case HYDRENT:
case GRATE1:
case PIPE1:
case PIPE2:
case PIPE3:
case PIPE4:
case PIPE5:
case PIPE6:
act->clipdist = 8;
act->spr.cstat |= CSTAT_SPRITE_BLOCK_ALL;
ChangeActorStat(act, 0);

View file

@ -31,7 +31,8 @@ int PicForName(int intname)
{"DukeSmallSmoke", "SMALLSMOKE"},
{"DukeBurning", "BURNING"},
{"RedneckBowlingBallSprite", "BOWLINGBALLSPRITE"},
{"DukeBloodSplat1", "BLOODSPLAT1"},
{"DukeToiletWater", "TOILETWATER"},
{"DukeSteam", "STEAM"},
};
for (auto& p : classes)

View file

@ -107,7 +107,20 @@ spawnclasses
1359 = DukeFetusBroke
969 = DukeHydroplant
1003 = DukeHydroplantBroke
981 = DukeHydrant
619 = DukePipe1
616 = DukePipe2
618 = DukePipe3
996 = DukePipe4
994 = DukePipe5
995 = DukePipe6
4943 = DukeJuryGuy
1353 = DukeSpaceMarine
1355 = DukeIndy
1352 = DukeMonk
1354 = DukeLuke
680 = DukeChair3
1272 = DukeTrash
634 = DukeBolt1

View file

@ -94,8 +94,14 @@ spawnclasses
1067 = DukeFuelPod
1114 = DukeSolarPanel
1117 = DukeAntenna
1349 = DukeFetus
1360 = DukeFetusBroke
1228 = DukeHydrant
1124 = DukePipe1
1121 = DukePipe2
1123 = DukePipe3
1234 = DukePipe4
1232 = DukePipe5
1233 = DukePipe6
1152 = DukeChair3
26 = RedneckDynamite
1416 = RedneckMortar

View file

@ -209,18 +209,14 @@ class DukeFetus : DukeActor
}
override void OnHit(DukeActor proj)
{
Console.printf("a%d", self.spritesetindex);
if (self.spritesetindex == 0)
{
Console.printf("a%d", proj.spawnindex);
self.setSpriteSetImage(1);
self.PlayActorSound("GLASS_BREAKING");
self.lotsofglass(10);
}
else
{
Console.printf("b%d", proj.spawnindex);
for (int j = 0; j < 48; j++)
{
self.shoot("DukeBloodSplat1");
@ -276,3 +272,197 @@ class DukeHydroplantBroke : DukeHydroplant
spritesetindex 1;
}
}
class DukeHydrant : DukeActor
{
Default
{
spriteset "HYDRENT", "BROKEFIREHYDRENT";
clipdist 8;
statnum STAT_DEFAULT;
}
override void Initialize()
{
self.cstat |= CSTAT_SPRITE_BLOCK_ALL;
}
override void OnHit(DukeActor proj)
{
if (self.spritesetindex == 0)
{
self.setSpriteSetImage(1);
self.spawn("DukeToiletWater");
self.PlayActorSound("GLASS_HEAVYBREAK");
}
}
}
class DukePipe1 : DukeActor
{
Default
{
spriteset "PIPE1", "PIPE1B";
clipdist 8;
statnum STAT_DEFAULT;
}
override void Initialize()
{
self.cstat |= CSTAT_SPRITE_BLOCK_ALL;
}
override void OnHit(DukeActor proj)
{
if (self.spritesetindex == 0)
{
self.setSpriteSetImage(1);
let spawned = self.spawn("DukeSteam");
if (spawned) spawned.pos.Z = self.sector.floorz - 32;
}
}
}
class DukePipe2 : DukePipe1
{
Default
{
spriteset "PIPE2", "PIPE2B";
}
}
class DukePipe3 : DukePipe1
{
Default
{
spriteset "PIPE3", "PIPE3B";
}
}
class DukePipe4 : DukePipe1
{
Default
{
spriteset "PIPE4", "PIPE4B";
}
}
class DukePipe5 : DukePipe1
{
Default
{
spriteset "PIPE5", "PIPE5B";
}
}
class DukePipe6 : DukePipe1
{
Default
{
spriteset "PIPE6", "PIPE6B";
}
}
class DukeSpaceMarine : DukeActor
{
Default
{
pic "SPACEMARINE";
}
override void Initialize()
{
self.cstat |= CSTAT_SPRITE_BLOCK_ALL;
self.extra = 20;
ChangeStat(STAT_ZOMBIEACTOR);
}
override void OnHit(DukeActor proj)
{
self.extra -= proj.extra;
if (self.extra > 0) return;
self.angle = frandom(0, 360);
self.shoot("DukeBloodSplat1");
self.angle = frandom(0, 360);
self.shoot("DukeBloodSplat2");
self.angle = frandom(0, 360);
self.shoot("DukeBloodSplat3");
self.angle = frandom(0, 360);
self.shoot("DukeBloodSplat4");
self.angle = frandom(0, 360);
self.shoot("DukeBloodSplat1");
self.angle = frandom(0, 360);
self.shoot("DukeBloodSplat2");
self.angle = frandom(0, 360);
self.shoot("DukeBloodSplat3");
self.angle = frandom(0, 360);
self.shoot("DukeBloodSplat4");
self.spawnguts("DukeJibs1", 1);
self.spawnguts("DukeJibs2", 2);
self.spawnguts("DukeJibs3", 3);
self.spawnguts("DukeJibs4", 4);
self.spawnguts("DukeJibs5", 1);
self.spawnguts("DukeJibs3", 6);
Duke.PlaySound("SQUISHED");
self.Destroy();
}
}
class DukeMonk : DukeSpaceMarine
{
default
{
pic "MONK";
clipdist 8;
}
override void Initialize()
{
self.cstat |= CSTAT_SPRITE_BLOCK_ALL;
ChangeStat(STAT_DEFAULT);
}
override void OnHit(DukeActor proj)
{
self.PlayActorSound(Raze.FindSoundByResID(self.lotag));
self.spawnsprite(self.hitag);
super.OnHit(proj);
}
}
class DukeLuke : DukeMonk
{
default
{
pic "LUKE";
}
}
class DukeIndy : DukeMonk
{
default
{
pic "INDY";
}
}
class DukeJuryGuy : DukeMonk
{
default
{
pic "JURYGUY";
}
}
class DukeChair3 : DukeActor
{
default
{
pic "CHAIR3";
}
override void OnHit(DukeActor proj)
{
self.PlayActorSound("GLASS_HEAVYBREAK");
for (int j = 0; j < 16; j++) self.RANDOMSCRAP();
self.Destroy();
}
}