From c845fc126a3d62467c23ae4e3b0def6b4e05d507 Mon Sep 17 00:00:00 2001 From: ZZYZX Date: Fri, 30 Dec 2016 23:26:56 +0200 Subject: [PATCH 1/2] Enabled user shader for a cameratexture --- src/gl/textures/gl_material.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gl/textures/gl_material.cpp b/src/gl/textures/gl_material.cpp index 5aa1d75b9..4be2e9619 100644 --- a/src/gl/textures/gl_material.cpp +++ b/src/gl/textures/gl_material.cpp @@ -447,6 +447,11 @@ FMaterial::FMaterial(FTexture * tx, bool expanded) } else if (tx->bHasCanvas) { + if (tx->gl_info.shaderindex >= FIRST_USER_SHADER) + { + mShaderIndex = tx->gl_info.shaderindex; + } + // no brightmap for cameratexture } else { From 3d61d2c1f4380067fc494a8e89857ea2215994b3 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 31 Dec 2016 15:40:16 +0100 Subject: [PATCH 2/2] - reviewd script code for spawn calls that did not check their results. Nothing should ever assume that spawning an actor is unconditionally successful. There can always be some edge cases where this is not the case. --- wadsrc/static/zscript/doom/archvile.txt | 11 +++-- wadsrc/static/zscript/doom/fatso.txt | 1 + wadsrc/static/zscript/doom/revenant.txt | 11 +++-- wadsrc/static/zscript/heretic/chicken.txt | 13 +++--- wadsrc/static/zscript/heretic/dsparil.txt | 22 +++++---- .../zscript/heretic/hereticartifacts.txt | 2 +- wadsrc/static/zscript/heretic/hereticimp.txt | 18 +++++--- wadsrc/static/zscript/heretic/hereticmisc.txt | 26 ++++++----- wadsrc/static/zscript/heretic/ironlich.txt | 28 +++++++----- wadsrc/static/zscript/heretic/knight.txt | 9 ++-- .../static/zscript/heretic/weaponblaster.txt | 11 +++-- wadsrc/static/zscript/heretic/weaponmace.txt | 45 +++++++++++-------- .../static/zscript/heretic/weaponphoenix.txt | 25 +++++++---- wadsrc/static/zscript/hexen/blastradius.txt | 3 +- wadsrc/static/zscript/hexen/clericholy.txt | 15 ++++--- wadsrc/static/zscript/hexen/flechette.txt | 11 +++-- wadsrc/static/zscript/hexen/korax.txt | 23 +++++----- wadsrc/static/zscript/raven/minotaur.txt | 11 +++-- wadsrc/static/zscript/strife/entityboss.txt | 9 ++-- wadsrc/static/zscript/strife/inquisitor.txt | 9 ++-- wadsrc/static/zscript/strife/rebels.txt | 4 ++ wadsrc/static/zscript/strife/sigil.txt | 2 +- wadsrc/static/zscript/strife/spectral.txt | 38 ++++++++++------ .../static/zscript/strife/strifefunctions.txt | 5 ++- 24 files changed, 222 insertions(+), 130 deletions(-) diff --git a/wadsrc/static/zscript/doom/archvile.txt b/wadsrc/static/zscript/doom/archvile.txt index a19e5c705..2ea153be1 100644 --- a/wadsrc/static/zscript/doom/archvile.txt +++ b/wadsrc/static/zscript/doom/archvile.txt @@ -116,10 +116,13 @@ extend class Actor A_FaceTarget (); Actor fog = Spawn (fire, target.Pos, ALLOW_REPLACE); - tracer = fog; - fog.target = self; - fog.tracer = self.target; - fog.A_Fire(0); + if (fog != null) + { + tracer = fog; + fog.target = self; + fog.tracer = self.target; + fog.A_Fire(0); + } } } diff --git a/wadsrc/static/zscript/doom/fatso.txt b/wadsrc/static/zscript/doom/fatso.txt index 3831110c0..e70c97924 100644 --- a/wadsrc/static/zscript/doom/fatso.txt +++ b/wadsrc/static/zscript/doom/fatso.txt @@ -188,6 +188,7 @@ extend class Actor // Now launch mushroom cloud Actor aimtarget = Spawn("Mapspot", pos, NO_REPLACE); // We need something to aim at. + if (aimtarget == null) return; Actor owner = (flags & MSF_DontHurt) ? target : self; aimtarget.Height = Height; diff --git a/wadsrc/static/zscript/doom/revenant.txt b/wadsrc/static/zscript/doom/revenant.txt index 2fa335a2d..82d563934 100644 --- a/wadsrc/static/zscript/doom/revenant.txt +++ b/wadsrc/static/zscript/doom/revenant.txt @@ -233,10 +233,13 @@ extend class Actor SpawnPuff ("BulletPuff", pos, angle, angle, 3); Actor smoke = Spawn ("RevenantTracerSmoke", Vec3Offset(-Vel.X, -Vel.Y, 0.), ALLOW_REPLACE); - smoke.Vel.Z = 1.; - smoke.tics -= random[Tracer](0, 3); - if (smoke.tics < 1) - smoke.tics = 1; + if (smoke != null) + { + smoke.Vel.Z = 1.; + smoke.tics -= random[Tracer](0, 3); + if (smoke.tics < 1) + smoke.tics = 1; + } // The rest of this function was identical with Strife's version, except for the angle being used. A_Tracer2(16.875); diff --git a/wadsrc/static/zscript/heretic/chicken.txt b/wadsrc/static/zscript/heretic/chicken.txt index 9f4429d50..b60a89136 100644 --- a/wadsrc/static/zscript/heretic/chicken.txt +++ b/wadsrc/static/zscript/heretic/chicken.txt @@ -335,11 +335,14 @@ extend class Actor for (int i = 0; i < count; i++) { Actor mo = Spawn("Feather", pos + (0, 0, 20), NO_REPLACE); - mo.target = self; - mo.Vel.X = Random2[Feathers]() / 256.; - mo.Vel.Y = Random2[Feathers]() / 256.; - mo.Vel.Z = 1. + random[Feathers]() / 128.; - mo.SetState (mo.SpawnState + (random[Feathers]()&7)); + if (mo != null) + { + mo.target = self; + mo.Vel.X = Random2[Feathers]() / 256.; + mo.Vel.Y = Random2[Feathers]() / 256.; + mo.Vel.Z = 1. + random[Feathers]() / 128.; + mo.SetState (mo.SpawnState + (random[Feathers]()&7)); + } } } diff --git a/wadsrc/static/zscript/heretic/dsparil.txt b/wadsrc/static/zscript/heretic/dsparil.txt index 54931b65e..579f47492 100644 --- a/wadsrc/static/zscript/heretic/dsparil.txt +++ b/wadsrc/static/zscript/heretic/dsparil.txt @@ -166,13 +166,14 @@ class Sorcerer1 : Actor { bSolid = false; Actor mo = Spawn("Sorcerer2", Pos, ALLOW_REPLACE); - mo.Translation = Translation; - mo.SetStateLabel("Rise"); - mo.angle = angle; - mo.CopyFriendliness (self, true); + if (mo != null) + { + mo.Translation = Translation; + mo.SetStateLabel("Rise"); + mo.angle = angle; + mo.CopyFriendliness (self, true); + } } - - } @@ -434,9 +435,12 @@ class Sorcerer2FX1 : Actor for (int i = 0; i < 2; i++) { Actor mo = Spawn("Sorcerer2FXSpark", pos, ALLOW_REPLACE); - mo.Vel.X = Random2[BlueSpark]() / 128.; - mo.Vel.Y = Random2[BlueSpark]() / 128.; - mo.Vel.Z = 1. + Random[BlueSpark]() / 256.; + if (mo != null) + { + mo.Vel.X = Random2[BlueSpark]() / 128.; + mo.Vel.Y = Random2[BlueSpark]() / 128.; + mo.Vel.Z = 1. + Random[BlueSpark]() / 256.; + } } } } diff --git a/wadsrc/static/zscript/heretic/hereticartifacts.txt b/wadsrc/static/zscript/heretic/hereticartifacts.txt index 3ef265735..20f52a2c9 100644 --- a/wadsrc/static/zscript/heretic/hereticartifacts.txt +++ b/wadsrc/static/zscript/heretic/hereticartifacts.txt @@ -149,7 +149,7 @@ Class ArtiTimeBomb : Inventory override bool Use (bool pickup) { Actor mo = Spawn("ActivatedTimeBomb", Owner.Vec3Angle(24., Owner.angle, - Owner.Floorclip), ALLOW_REPLACE); - mo.target = Owner; + if (mo != null) mo.target = Owner; return true; } diff --git a/wadsrc/static/zscript/heretic/hereticimp.txt b/wadsrc/static/zscript/heretic/hereticimp.txt index c1443de03..e6915c7f6 100644 --- a/wadsrc/static/zscript/heretic/hereticimp.txt +++ b/wadsrc/static/zscript/heretic/hereticimp.txt @@ -102,14 +102,20 @@ class HereticImp : Actor bNoGravity = false; chunk = Spawn("HereticImpChunk1", pos, ALLOW_REPLACE); - chunk.vel.x = random2[ImpExplode]() / 64.; - chunk.vel.y = random2[ImpExplode]() / 64.; - chunk.vel.z = 9; + if (chunk != null) + { + chunk.vel.x = random2[ImpExplode]() / 64.; + chunk.vel.y = random2[ImpExplode]() / 64.; + chunk.vel.z = 9; + } chunk = Spawn("HereticImpChunk2", pos, ALLOW_REPLACE); - chunk.vel.x = random2[ImpExplode]() / 64.; - chunk.vel.y = random2[ImpExplode]() / 64.; - chunk.vel.z = 9; + if (chunk != null) + { + chunk.vel.x = random2[ImpExplode]() / 64.; + chunk.vel.y = random2[ImpExplode]() / 64.; + chunk.vel.z = 9; + } if (extremecrash) { diff --git a/wadsrc/static/zscript/heretic/hereticmisc.txt b/wadsrc/static/zscript/heretic/hereticmisc.txt index ea79f5f80..b66217352 100644 --- a/wadsrc/static/zscript/heretic/hereticmisc.txt +++ b/wadsrc/static/zscript/heretic/hereticmisc.txt @@ -60,10 +60,13 @@ class Pod : Actor for (int count = chance > 240 ? 2 : 1; count; count--) { Actor goo = Spawn(gootype, pos + (0, 0, 48), ALLOW_REPLACE); - goo.target = self; - goo.Vel.X = Random2[PodPain]() / 128.; - goo.Vel.Y = Random2[PodPain]() / 128.; - goo.Vel.Z = 0.5 + random[PodPain]() / 128.; + if (goo != null) + { + goo.target = self; + goo.Vel.X = Random2[PodPain]() / 128.; + goo.Vel.Y = Random2[PodPain]() / 128.; + goo.Vel.Z = 0.5 + random[PodPain]() / 128.; + } } } @@ -295,12 +298,15 @@ class Volcano : Actor for (int i = 0; i < count; i++) { Actor blast = Spawn("VolcanoBlast", pos + (0, 0, 44), ALLOW_REPLACE); - blast.target = self; - blast.Angle = random[VolcanoBlast]() * (360 / 256.); - blast.VelFromAngle(1.); - blast.Vel.Z = 2.5 + random[VolcanoBlast]() / 64.; - blast.A_PlaySound ("world/volcano/shoot", CHAN_BODY); - blast.CheckMissileSpawn (radius); + if (blast != null) + { + blast.target = self; + blast.Angle = random[VolcanoBlast]() * (360 / 256.); + blast.VelFromAngle(1.); + blast.Vel.Z = 2.5 + random[VolcanoBlast]() / 64.; + blast.A_PlaySound ("world/volcano/shoot", CHAN_BODY); + blast.CheckMissileSpawn (radius); + } } } } diff --git a/wadsrc/static/zscript/heretic/ironlich.txt b/wadsrc/static/zscript/heretic/ironlich.txt index 8a4dd4c05..65e510932 100644 --- a/wadsrc/static/zscript/heretic/ironlich.txt +++ b/wadsrc/static/zscript/heretic/ironlich.txt @@ -102,12 +102,15 @@ class Ironlich : Actor { A_PlaySound ("ironlich/attack1", CHAN_BODY); } - fire.target = baseFire.target; - fire.angle = baseFire.angle; - fire.Vel = baseFire.Vel; - fire.SetDamage(0); - fire.health = (i+1) * 2; - fire.CheckMissileSpawn (radius); + if (fire != null) + { + fire.target = baseFire.target; + fire.angle = baseFire.angle; + fire.Vel = baseFire.Vel; + fire.SetDamage(0); + fire.health = (i+1) * 2; + fire.CheckMissileSpawn (radius); + } } } } @@ -167,11 +170,14 @@ class HeadFX1 : Actor for (int i = 0; i < 8; i++) { Actor shard = Spawn("HeadFX2", Pos, ALLOW_REPLACE); - shard.target = target; - shard.angle = i*45.; - shard.VelFromAngle(); - shard.Vel.Z = -.6; - shard.CheckMissileSpawn (radius); + if (shard != null) + { + shard.target = target; + shard.angle = i*45.; + shard.VelFromAngle(); + shard.Vel.Z = -.6; + shard.CheckMissileSpawn (radius); + } } } } diff --git a/wadsrc/static/zscript/heretic/knight.txt b/wadsrc/static/zscript/heretic/knight.txt index 01b7252c6..e66e191f0 100644 --- a/wadsrc/static/zscript/heretic/knight.txt +++ b/wadsrc/static/zscript/heretic/knight.txt @@ -163,8 +163,11 @@ class RedAxe : KnightAxe double xo = random2[DripBlood]() / 32.0; double yo = random2[DripBlood]() / 32.0; Actor mo = Spawn ("Blood", Vec3Offset(xo, yo, 0.), ALLOW_REPLACE); - mo.Vel.X = random2[DripBlood]() / 64.0; - mo.Vel.Y = random2[DripBlood]() / 64.0; - mo.Gravity = 1./8; + if (mo != null) + { + mo.Vel.X = random2[DripBlood]() / 64.0; + mo.Vel.Y = random2[DripBlood]() / 64.0; + mo.Gravity = 1./8; + } } } diff --git a/wadsrc/static/zscript/heretic/weaponblaster.txt b/wadsrc/static/zscript/heretic/weaponblaster.txt index 612e630c0..913abffdb 100644 --- a/wadsrc/static/zscript/heretic/weaponblaster.txt +++ b/wadsrc/static/zscript/heretic/weaponblaster.txt @@ -160,10 +160,13 @@ class BlasterFX1 : FastProjectile for(int i = 0; i < 8; i++) { Actor ripper = Spawn("Ripper", pos, ALLOW_REPLACE); - ripper.target = target; - ripper.angle = i*45; - ripper.VelFromAngle(); - ripper.CheckMissileSpawn (radius); + if (ripper != null) + { + ripper.target = target; + ripper.angle = i*45; + ripper.VelFromAngle(); + ripper.CheckMissileSpawn (radius); + } } } } diff --git a/wadsrc/static/zscript/heretic/weaponmace.txt b/wadsrc/static/zscript/heretic/weaponmace.txt index fd11e685f..3ef747e0f 100644 --- a/wadsrc/static/zscript/heretic/weaponmace.txt +++ b/wadsrc/static/zscript/heretic/weaponmace.txt @@ -60,14 +60,17 @@ class Mace : HereticWeapon if (random[MaceAtk]() < 28) { Actor ball = Spawn("MaceFX2", Pos + (0, 0, 28 - Floorclip), ALLOW_REPLACE); - ball.Vel.Z = 2 - clamp(tan(pitch), -5, 5); - ball.target = self; - ball.angle = self.angle; - ball.AddZ(ball.Vel.Z); - ball.VelFromAngle(); - ball.Vel += Vel.xy / 2; - ball.A_PlaySound ("weapons/maceshoot", CHAN_BODY); - ball.CheckMissileSpawn (radius); + if (ball != null) + { + ball.Vel.Z = 2 - clamp(tan(pitch), -5, 5); + ball.target = self; + ball.angle = self.angle; + ball.AddZ(ball.Vel.Z); + ball.VelFromAngle(); + ball.Vel += Vel.xy / 2; + ball.A_PlaySound ("weapons/maceshoot", CHAN_BODY); + ball.CheckMissileSpawn (radius); + } } else { @@ -260,18 +263,24 @@ class MaceFX2 : MaceFX1 SetState (SpawnState); Actor tiny = Spawn("MaceFX3", Pos, ALLOW_REPLACE); - tiny.target = target; - tiny.angle = angle + 90.; - tiny.VelFromAngle(Vel.Z - 1.); - tiny.Vel += (Vel.XY * .5, Vel.Z); - tiny.CheckMissileSpawn (radius); + if (tiny != null) + { + tiny.target = target; + tiny.angle = angle + 90.; + tiny.VelFromAngle(Vel.Z - 1.); + tiny.Vel += (Vel.XY * .5, Vel.Z); + tiny.CheckMissileSpawn (radius); + } tiny = Spawn("MaceFX3", Pos, ALLOW_REPLACE); - tiny.target = target; - tiny.angle = angle - 90.; - tiny.VelFromAngle(Vel.Z - 1.); - tiny.Vel += (Vel.XY * .5, Vel.Z); - tiny.CheckMissileSpawn (radius); + if (tiny != null) + { + tiny.target = target; + tiny.angle = angle - 90.; + tiny.VelFromAngle(Vel.Z - 1.); + tiny.Vel += (Vel.XY * .5, Vel.Z); + tiny.CheckMissileSpawn (radius); + } return; } } diff --git a/wadsrc/static/zscript/heretic/weaponphoenix.txt b/wadsrc/static/zscript/heretic/weaponphoenix.txt index 6b949b8f6..eb75acb1d 100644 --- a/wadsrc/static/zscript/heretic/weaponphoenix.txt +++ b/wadsrc/static/zscript/heretic/weaponphoenix.txt @@ -151,16 +151,19 @@ class PhoenixRodPowered : PhoenixRod slope += 0.1; Actor mo = Spawn("PhoenixFX2", spawnpos, ALLOW_REPLACE); - mo.target = self; - mo.Angle = Angle; - mo.VelFromAngle(); - mo.Vel.XY += Vel.XY; - mo.Vel.Z = mo.Speed * slope; + if (mo != null) + { + mo.target = self; + mo.Angle = Angle; + mo.VelFromAngle(); + mo.Vel.XY += Vel.XY; + mo.Vel.Z = mo.Speed * slope; + mo.CheckMissileSpawn (radius); + } if (!player.refire) { A_PlaySound("weapons/phoenixpowshoot", CHAN_WEAPON, 1, true); } - mo.CheckMissileSpawn (radius); } //---------------------------------------------------------------------------- @@ -239,10 +242,16 @@ class PhoenixFX1 : Actor //[RH] Heretic never sets the target for seeking //P_SeekerMissile (self, 5, 10); Actor puff = Spawn("PhoenixPuff", Pos, ALLOW_REPLACE); - puff.Vel.XY = AngleToVector(Angle + 90, 1.3); + if (puff != null) + { + puff.Vel.XY = AngleToVector(Angle + 90, 1.3); + } puff = Spawn("PhoenixPuff", Pos, ALLOW_REPLACE); - puff.Vel.XY = AngleToVector(Angle - 90, 1.3); + if (puff != null) + { + puff.Vel.XY = AngleToVector(Angle - 90, 1.3); + } } diff --git a/wadsrc/static/zscript/hexen/blastradius.txt b/wadsrc/static/zscript/hexen/blastradius.txt index 7374a4523..3dd355b7c 100644 --- a/wadsrc/static/zscript/hexen/blastradius.txt +++ b/wadsrc/static/zscript/hexen/blastradius.txt @@ -70,7 +70,8 @@ extend class Actor // [RH] Floor and ceiling huggers should not be blasted vertically. if (!victim.bFloorHugger && !victim.bCeilingHugger) { - mo.Vel.Z = victim.Vel.Z = 8; + victim.Vel.Z = 8; + if (mo != null) mo.Vel.Z = 8; } } else diff --git a/wadsrc/static/zscript/hexen/clericholy.txt b/wadsrc/static/zscript/hexen/clericholy.txt index 33b69bf25..3846c75d5 100644 --- a/wadsrc/static/zscript/hexen/clericholy.txt +++ b/wadsrc/static/zscript/hexen/clericholy.txt @@ -567,14 +567,17 @@ class HolyTail : Actor static void SpawnSpiritTail (Actor spirit) { Actor tail = Spawn ("HolyTail", spirit.Pos, ALLOW_REPLACE); - tail.target = spirit; // parent - for (int i = 1; i < 3; i++) + if (tail != null) { - Actor next = Spawn ("HolyTailTrail", spirit.Pos, ALLOW_REPLACE); - tail.tracer = next; - tail = next; + tail.target = spirit; // parent + for (int i = 1; i < 3; i++) + { + Actor next = Spawn ("HolyTailTrail", spirit.Pos, ALLOW_REPLACE); + tail.tracer = next; + tail = next; + } + tail.tracer = null; // last tail bit } - tail.tracer = null; // last tail bit } //============================================================================ diff --git a/wadsrc/static/zscript/hexen/flechette.txt b/wadsrc/static/zscript/hexen/flechette.txt index fc9268c5b..3440312c9 100644 --- a/wadsrc/static/zscript/hexen/flechette.txt +++ b/wadsrc/static/zscript/hexen/flechette.txt @@ -255,10 +255,13 @@ class ArtiPoisonBag : Inventory } class spawntype = GetFlechetteType(other); - Inventory copy = Inventory(Spawn (spawntype)); - copy.Amount = Amount; - copy.MaxAmount = MaxAmount; - GoAwayAndDie (); + let copy = Inventory(Spawn (spawntype)); + if (copy != null) + { + copy.Amount = Amount; + copy.MaxAmount = MaxAmount; + GoAwayAndDie (); + } return copy; } } diff --git a/wadsrc/static/zscript/hexen/korax.txt b/wadsrc/static/zscript/hexen/korax.txt index 1c1f31712..8f313bc19 100644 --- a/wadsrc/static/zscript/hexen/korax.txt +++ b/wadsrc/static/zscript/hexen/korax.txt @@ -315,17 +315,20 @@ class Korax : Actor private void SpawnKoraxMissile (Vector3 pos, Actor dest, Class type) { Actor th = Spawn (type, pos, ALLOW_REPLACE); - th.target = self; // Originator - double an = th.AngleTo(dest); - if (dest.bShadow) - { // Invisible target - an += Random2[KoraxMissile]() * (45/256.); + if (th != null) + { + th.target = self; // Originator + double an = th.AngleTo(dest); + if (dest.bShadow) + { // Invisible target + an += Random2[KoraxMissile]() * (45/256.); + } + th.angle = an; + th.VelFromAngle(); + double dist = dest.DistanceBySpeed(th, th.Speed); + th.Vel.Z = (dest.pos.z - pos.Z + 30) / dist; + th.CheckMissileSpawn(radius); } - th.angle = an; - th.VelFromAngle(); - double dist = dest.DistanceBySpeed(th, th.Speed); - th.Vel.Z = (dest.pos.z - pos.Z + 30) / dist; - th.CheckMissileSpawn(radius); } //============================================================================ diff --git a/wadsrc/static/zscript/raven/minotaur.txt b/wadsrc/static/zscript/raven/minotaur.txt index 01cd63541..06bb6daae 100644 --- a/wadsrc/static/zscript/raven/minotaur.txt +++ b/wadsrc/static/zscript/raven/minotaur.txt @@ -262,7 +262,7 @@ class Minotaur : Actor type = "PunchPuff"; } Actor puff = Spawn (type, Pos, ALLOW_REPLACE); - puff.Vel.Z = 2; + if (puff != null) puff.Vel.Z = 2; special1--; } else @@ -710,9 +710,12 @@ class MinotaurFX2 : MinotaurFX1 double y = Random2[MntrFloorFire]() / 64.; Actor mo = Spawn("MinotaurFX3", Vec2OffsetZ(x, y, floorz), ALLOW_REPLACE); - mo.target = target; - mo.Vel.X = MinVel; // Force block checking - mo.CheckMissileSpawn (radius); + if (mo != null) + { + mo.target = target; + mo.Vel.X = MinVel; // Force block checking + mo.CheckMissileSpawn (radius); + } } } diff --git a/wadsrc/static/zscript/strife/entityboss.txt b/wadsrc/static/zscript/strife/entityboss.txt index a9ec94bb2..ff26280c3 100644 --- a/wadsrc/static/zscript/strife/entityboss.txt +++ b/wadsrc/static/zscript/strife/entityboss.txt @@ -202,9 +202,12 @@ class EntityBoss : SpectralMonster Vector3 pos = spot.Vec3Angle(secondRadius, an, tracer ? 70. : 0.); second = Spawn("EntitySecond", pos, ALLOW_REPLACE); - second.CopyFriendliness(self, true); - second.A_FaceTarget(); - second.VelFromAngle(i == 0? 4.8828125 : secondRadius * 4., an); + if (second != null) + { + second.CopyFriendliness(self, true); + second.A_FaceTarget(); + second.VelFromAngle(i == 0? 4.8828125 : secondRadius * 4., an); + } } } diff --git a/wadsrc/static/zscript/strife/inquisitor.txt b/wadsrc/static/zscript/strife/inquisitor.txt index 6d3c5bc7f..5c15f4af7 100644 --- a/wadsrc/static/zscript/strife/inquisitor.txt +++ b/wadsrc/static/zscript/strife/inquisitor.txt @@ -171,9 +171,12 @@ class Inquisitor : Actor void A_TossArm () { Actor foo = Spawn("InquisitorArm", Pos + (0,0,24), ALLOW_REPLACE); - foo.angle = angle - 90. + Random2[Inquisitor]() * (360./1024.); - foo.VelFromAngle(foo.Speed / 8); - foo.Vel.Z = random[Inquisitor]() / 64.; + if (foo != null) + { + foo.angle = angle - 90. + Random2[Inquisitor]() * (360./1024.); + foo.VelFromAngle(foo.Speed / 8); + foo.Vel.Z = random[Inquisitor]() / 64.; + } } diff --git a/wadsrc/static/zscript/strife/rebels.txt b/wadsrc/static/zscript/strife/rebels.txt index 24deea25b..7302f1c02 100644 --- a/wadsrc/static/zscript/strife/rebels.txt +++ b/wadsrc/static/zscript/strife/rebels.txt @@ -163,6 +163,10 @@ class TeleporterBeacon : Inventory { Actor owner = target; Actor rebel = Spawn("Rebel1", (pos.xy, floorz), ALLOW_REPLACE); + if (rebel == null) + { + return; + } if (!rebel.TryMove (rebel.Pos.xy, true)) { rebel.Destroy (); diff --git a/wadsrc/static/zscript/strife/sigil.txt b/wadsrc/static/zscript/strife/sigil.txt index 096915ccf..bfdcae77a 100644 --- a/wadsrc/static/zscript/strife/sigil.txt +++ b/wadsrc/static/zscript/strife/sigil.txt @@ -268,7 +268,7 @@ class Sigil : Weapon action void A_FireSigil1 () { - Actor spot; + Actor spot = null; FTranslatedLineTarget t; if (player == null || player.ReadyWeapon == null) diff --git a/wadsrc/static/zscript/strife/spectral.txt b/wadsrc/static/zscript/strife/spectral.txt index 0878cff94..a56d9e717 100644 --- a/wadsrc/static/zscript/strife/spectral.txt +++ b/wadsrc/static/zscript/strife/spectral.txt @@ -62,11 +62,13 @@ class SpectralMonster : Actor return; Actor foo = Spawn("SpectralLightningV2", Pos + (0, 0, 32), ALLOW_REPLACE); - - foo.Vel.Z = -12; - foo.target = self; - foo.FriendPlayer = 0; - foo.tracer = target; + if (foo != null) + { + foo.Vel.Z = -12; + foo.target = self; + foo.FriendPlayer = 0; + foo.tracer = target; + } Angle -= 90.; for (int i = 0; i < 20; ++i) @@ -217,9 +219,11 @@ class SpectralLightningH1 : SpectralLightningBase void A_SpectralLightningTail () { Actor foo = Spawn("SpectralLightningHTail", Vec3Offset(-Vel.X, -Vel.Y, 0.), ALLOW_REPLACE); - - foo.Angle = Angle; - foo.FriendPlayer = FriendPlayer; + if (foo != null) + { + foo.Angle = Angle; + foo.FriendPlayer = FriendPlayer; + } } } @@ -386,15 +390,21 @@ class SpectralLightningSpot : SpectralLightningDeath1 Actor flash = Spawn (cls, Vec2OffsetZ(xo, yo, ONCEILINGZ), ALLOW_REPLACE); - flash.target = target; - flash.Vel.Z = -18; - flash.FriendPlayer = FriendPlayer; + if (flash != null) + { + flash.target = target; + flash.Vel.Z = -18; + flash.FriendPlayer = FriendPlayer; + } flash = Spawn("SpectralLightningV2", (pos.xy, ONCEILINGZ), ALLOW_REPLACE); - flash.target = target; - flash.Vel.Z = -18; - flash.FriendPlayer = FriendPlayer; + if (flash != null) + { + flash.target = target; + flash.Vel.Z = -18; + flash.FriendPlayer = FriendPlayer; + } } } diff --git a/wadsrc/static/zscript/strife/strifefunctions.txt b/wadsrc/static/zscript/strife/strifefunctions.txt index ed6c3854e..5e0312a95 100644 --- a/wadsrc/static/zscript/strife/strifefunctions.txt +++ b/wadsrc/static/zscript/strife/strifefunctions.txt @@ -133,7 +133,10 @@ extend class Actor void A_DropFire() { Actor drop = Spawn("FireDroplet", pos + (0,0,24), ALLOW_REPLACE); - drop.Vel.Z = -1.; + if (drop != null) + { + drop.Vel.Z = -1.; + } A_Explode(64, 64, XF_NOSPLASH, damagetype: 'Fire'); }