Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Heretic: Adding a11y-Option - Flickering Sector Lighting #1246

Merged

Conversation

Noseey
Copy link

@Noseey Noseey commented Dec 15, 2024

Related Issue:
Closes #1244

Changes Summary

  • Added Accessibility Option to Heretic Setup for Flickering Sector Lighting.
  • Ported solution from Crispy-Doom for the actual disabling.
  • Fixed issue having static strobe/glow/flash lightlevel != maxlight when loading save-files.
  • Fixed issue having flickering-glitches in some level segment compositions (E1M1, E2M7).

Verified on E1M1 and E2M7 that no further flickering-glitches remain. Checked vanilla compatibility using 4 Demos (E1M1, E2M7, E4M1, E4M7), no deviation seen. No indication in the source-code found that lightlevel impacts player-detection by enemies.

if (a11y_sector_lighting)
flash->sector->rlightlevel = flash->sector->lightlevel;
else
flash->sector->rlightlevel = flash->maxlight;
Copy link
Author

@Noseey Noseey Dec 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Required to restore maxlight for those sectors after loading a save file. Should be fixed in crispy-doom aswell?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Speaking of savegames, I had to add some code to doom/p_extsave.c to make sure that both values are restored for sectors for which sector->lightlevel and sector->rlightlevel differ. I don't see any such code in your PR. Does this mean that the code I added for Doom becomes unnecessary with the changes you introduced here?

Copy link
Author

@Noseey Noseey Dec 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I experimented with storing, but eventually undid that. Since all the flash-lights are thinkers and they are already stored, I took the maxlight level from there to restore it on startup/load of a game. Without further testing, I presume the same could be done in Doom aswell without separate handling when storing the lightlevel.

In fact, the code in p_extsave.c doesn't appear to prevent inconsitent light-levels when changing the flickering-option between saves. You can verify this by:

  • Enable Sector Light Flickering in Doom.
  • Go up to a flickering light and save when the lightlevel is minimum/off (might require some timing)
  • Change Setup to Disable Sector Light Flickering.
  • Load the previous save

Expected Result:
Light should be a static maxlight

Actual Result:
Light remains static on last saved flickering value.

However, there is still one finding as I also undid by mistake the copy of lightlevel to rlightlevel when unarchiving. I have corrected that now. This is required to ensure that changes to lights ( e. g. caused by triggers) are correctly restored when loading a save.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, I see now. Seems you have got better insight into the topic than I had when implementing it for Doom. 😁 Could you please do me a favour and fix all the things you learned here for the Doom code base as well? I guess the P_WriteRLightlevel() and P_ReadRLightlevel() functions in doom/p_extsaveg.c could be turned into NOPs then.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, I see now. Seems you have got better insight into the topic than I had when implementing it for Doom. 😁 Could you please do me a favour and fix all the things you learned here for the Doom code base as well? I guess the P_WriteRLightlevel() and P_ReadRLightlevel() functions in doom/p_extsaveg.c could be turned into NOPs then.

In a separate RP, that is. Forgot to mention this. 😬

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, I see now. Seems you have got better insight into the topic than I had when implementing it for Doom. 😁 Could you please do me a favour and fix all the things you learned here for the Doom code base as well? I guess the P_WriteRLightlevel() and P_ReadRLightlevel() functions in doom/p_extsaveg.c could be turned into NOPs then.

No worries! Like mentioned in the issue post, this also caused me quite some headache when doing the first proposal. 😀
Sure, I will take a look at doom and open a seperate pull-request!

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@@ -313,7 +313,7 @@ void R_AddLine(seg_t * line)
// reject empty lines used for triggers and special events
if (backsector->ceilingpic == frontsector->ceilingpic
&& backsector->floorpic == frontsector->floorpic
&& backsector->lightlevel == frontsector->lightlevel
&& backsector->rlightlevel == frontsector->rlightlevel
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Required to avoid flickering glitch in E1M1 Hallway where Gauntlets are located. Should be fixed in crispy-doom aswell?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's probably not even an oversight, as I wanted to reduce changes to apparently unrelated code paths to a minimum. My initial idea was to let the rest of the game act on the unmodified light levels, but if this leads to glitches, these should of course get fixed. Have you found similar glitches in Doom already?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you found similar glitches in Doom already?

Yes, e. g. in Doom2 Level 09 near the yellow key-card:
2024-12-15 12_45_01-Window

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, wow! Yes, this needs to get fixed, please!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These glitches however only happen when the flickering is disabled. When it is enabled, the rlightlevel and lightlevel are coupled and the condition leads to correct results.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, sure, but a feature targeted at accessibility shouldn't end up in a visual glitch anyway!

@@ -675,15 +676,15 @@ void R_StoreWallRange(int start, int stop)

if (worldlow != worldbottom
|| backsector->floorpic != frontsector->floorpic
|| backsector->lightlevel != frontsector->lightlevel
|| backsector->rlightlevel != frontsector->rlightlevel
Copy link
Author

@Noseey Noseey Dec 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Required to avoid flickering glitch in E2M7 Hub Area. Should be fixed in crispy-doom aswell?

2024-12-14 13_21_05-Heretic_ Shadow of the Serpent Riders - Crispy Doom 7 0 0

..  to reflect light-changes done throughout the map.
Copy link
Owner

@fabiangreffrath fabiangreffrath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

@fabiangreffrath fabiangreffrath merged commit a87b615 into fabiangreffrath:master Dec 17, 2024
6 checks passed
@Noseey Noseey deleted the Heretic_Accessibility_Flickering branch December 18, 2024 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Suggestion] Heretic: Option to disable Strobe Lights
2 participants