ZDoom / Raze

Build engine port backed by GZDoom tech. Currently supports Duke Nukem 3D, Blood, Shadow Warrior, Redneck Rampage and Powerslave/Exhumed.
678 stars 59 forks source link

[BUG] [Blood] Bullet Cases Floating After Train Move #634

Open Enjay001 opened 2 years ago

Enjay001 commented 2 years ago

Raze version

1.4.0

Which game are you running with Raze?

Blood

What Operating System are you using?

Windows 10

If Other OS, please describe

No response

Relevant hardware info

No response

Have you checked that no other similar issue already exists?

A clear and concise description of what the bug is.

I had cheated to get all of the weapons (when playing the first map). I transitioned to the second map and used the Tommy gun to kill all of the bad guys in the railway carriage near the start. I then flicked the switch to get the turntable to turn and rotate the carriage. The bullet casings that had been on the floor of the carriage remained where they were relative to the map and were therefore floating in mid air. Blood_0001

No idea if this happens in the original game or not but I spotted it so I thought that I might as well report it.

Steps to reproduce the behaviour.

Explain how to reproduce

  1. Go to map 2 and give yourself the Tommy gun
  2. Go into the carriage near the start that rotates when the turntable moves
  3. fire the Tommy gun so that there are a lot of casings on the carriage floor
  4. flick the switch to rotate the turntable
  5. observe

Your configuration

No response

Provide a Log

No response

coelckers commented 2 years ago

Yuck!

This one looks like an original Blood bug, I can trace it back to at least 0.5.0.

sinisterseed commented 2 years ago

100% vanilla Blood bug, same behavior in GDX and no doubt NBlood too.

carnivoroussociety commented 2 years ago

The reason spent casing sprites are not dragged over sectors is because they're not touching the sector when they stop bouncing. This usually means the bottom of the sprite is a few units above the floor, and thus won't be dragged along. https://github.com/coelckers/Raze/blob/2f55d2a1c74ae053c394655166cc02564e5ba84e/source/games/blood/src/triggers.cpp#L942 This can be fixed by adjusting sleeveStopBouncing() to set the bottom of the sprite to align with the floor.

As for blood splatter that can be changed by tweaking the sprite cstat compare. Perhaps something like:

bool bDraggable = !(pSprite->cstat&CSTAT_SPRITE_ALIGNMENT_MASK) && (floorZ <= bottom);
if (!bDraggable && !VanillaMode()) // if floor aligned sprite, drag element
    bDraggable = (pSprite->cstat&CSTAT_SPRITE_ALIGNMENT_MASK) == CSTAT_SPRITE_ALIGNMENT_FLOOR;
if (bDraggable)
coelckers commented 1 year ago

This also seems to affect wall decals:

https://forum.zdoom.org/viewtopic.php?t=76540

kw-create commented 1 year ago

It really happens with so many things, like bullet casings landing on top of open doors and then you close the door, the bullets don't move, they float. Same with blood on moving floors and elevators

mjr4077au commented 1 year ago

It really happens with so many things, like bullet casings landing on top of open doors and then you close the door, the bullets don't move, they float. Same with blood on moving floors and elevators

tmyqlfpir (carnivoroussociety) has this patched/implemented in NotBlood which I'm happy to explore, but would love a 1st party patch if they're willing. Since its a vanilla bug, its lower on our list as compared to bugs we've inadvertently introduced.

tmyqlfpir commented 11 months ago

tmyqlfpir (carnivoroussociety) has this patched/implemented in NotBlood which I'm happy to explore, but would love a 1st party patch if they're willing. Since its a vanilla bug, its lower on our list as compared to bugs we've inadvertently introduced.

As the Raze refactor pretty much remove any resemblance of NBlood, it's difficult (for me) to contribute code from NotBlood as so much is changed. That may be for the best, as some of my 'fixes' are hardly up to the quality of Raze's codebase.

Regardless, feel free to take as much from NotBlood and incorporate into Raze, - it is open source after all.

mjr4077au commented 11 months ago

@tmyqlfpir given the code differences as you've said, I wouldn't expect you to go out of your way to PR something but I appreciate your permission to take a look at your sources and pinch a fix or two.

I wouldn't be so harsh on yourself regarding any fixes you've done either, a lot of them are great and are a massive win for the community; we've already got some of those that you've contributed early on. The original code isn't great, especially the underlying filesystem stuff and you've managed to do a lot without good infrastructure. I'd be proud 🙂

mjr4077au commented 11 months ago

I also wonder if this is similar to whatever causes the flare gun's light to reflect off a ROR sector boundary? Good example is E1L1 in the courtyard outside the funeral house.

tmyqlfpir commented 11 months ago

It is not related, but to 'fix' that add a hitscan test for kViewEffectCeilGlow/kViewEffectFloorGlow to confirm if the area below/above is a room over room picnum, or something solid such as a bridge (E1M4) or fake floor (E2M5). A fix similar to this is present in NBlood's shadow casting effect.

The actual bug in question is because blood decals/spent shells are not being dragged by the sector. It can be fixed by adding some checks in the trigger.cpp sector movement code, along with making sure that the decals are properly aligned to the floor on spawning.