From 7b9e42ff357c377958dd84f44b93ce06eb27aa85 Mon Sep 17 00:00:00 2001 From: Nick Date: Mon, 27 Apr 2026 18:06:05 -0400 Subject: [PATCH] fix spawn blood to use hard-coded vanilla frames when dehacked is present. --- .../Entities/Definition/EntityFrameTable.cs | 2 +- Core/World/WorldBase.cs | 22 ++++++++++--------- RELEASENOTES.md | 1 + 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/Core/World/Entities/Definition/EntityFrameTable.cs b/Core/World/Entities/Definition/EntityFrameTable.cs index e049dd2ae..7ca2f1299 100644 --- a/Core/World/Entities/Definition/EntityFrameTable.cs +++ b/Core/World/Entities/Definition/EntityFrameTable.cs @@ -36,7 +36,7 @@ public class EntityFrameTable return m_vileHealFrame; } - public int GetBloodIndex() + public int GetBloodFrameIndex() { if (m_bloodIndex != -1) return m_bloodIndex; diff --git a/Core/World/WorldBase.cs b/Core/World/WorldBase.cs index 86a26c586..8cbca783f 100644 --- a/Core/World/WorldBase.cs +++ b/Core/World/WorldBase.cs @@ -3135,13 +3135,13 @@ private void CreateBloodOrPulletPuff(Entity? entity, Vec3D intersect, double ang return; bool bulletPuff = entity == null || entity.Definition.Flags.NoBlood() || entity.Flags.Dormant(); - EntityDefinition? def; + EntityDefinition? def = null; if (bulletPuff) { def = EntityManager.DefinitionComposer.BulletPuffDefinition; intersect.Z += Random.NextDiff() * Constants.PuffRandZ; } - else + else if (entity != null) { def = entity!.GetBloodDefinition(); } @@ -3186,20 +3186,22 @@ private void SetBloodValues(Entity? entity, Entity blood, int damage, bool rippe blood.Velocity.Z = 2; - // Doom had the blood states hardcoded. Supercharged bulletride seems to function differing in gz vs dsda. - // The changed the frame for blood that dsda will ignore because of hardcoded states, but work in gz. - if (HasDehacked && entity != null && entity.FrameState.Frame.VanillaIndex != (int)ThingState.BLOOD1) - return; - int offset = 0; if (damage <= 12 && damage >= 9) offset = 1; else if (damage < 9) offset = 2; - if (offset == 0) - blood.SetRandomizeTicks(); - else if (blood.Definition.SpawnState != null) + blood.SetRandomizeTicks(); + + if (HasDehacked) + { + if (offset > 0) + blood.FrameState.SetFrameIndex(blood, ArchiveCollection.EntityFrameTable.GetBloodFrameIndex() + offset); + return; + } + + if (blood.Definition.SpawnState != null) blood.FrameState.SetFrameIndex(blood, blood.Definition.SpawnState.Value + offset); } diff --git a/RELEASENOTES.md b/RELEASENOTES.md index c57940fa1..11d48819a 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -29,6 +29,7 @@ - Fix A_Refire not calling noise alert. - Match Doom behavior in the thing tick function that wouldn't advance the state for zero duration frames and leave them in a -1 loop. - Fix PNGs with fully transparent pixels loading colors that causes rendering issues when used with texture filtering. +- Fix spawn blood to use hard-coded vanilla frames when dehacked is present. ## Misc: - Refactor of old Status Bar renderer to data-driven SBARDEF format.