kraflab / dsda-doom

This is a successor of prboom+ with extra tooling for demo recording and playback, with a focus on speedrunning and quality of life.
336 stars 84 forks source link

MBF21: SSG autoswitch causes weapons to disappear #431

Closed d-bind closed 3 months ago

d-bind commented 12 months ago

If the last two shells are fired immediately after automatically switching to SSG, the weapons will disappear, and it becomes impossible to switch to any weapon, either manually or by picking them up. Also Doomguy gets stuck with an angry face.

Lasts until respawn and persists across level transitions, though the face does get fixed. The SSG has to be fired right after switching to it, but not by holding the fire button, so the timing is tricky.

Error log shows "P_BringUpWeapon: weaponinfo overrun has occurred."

Only happens in complevel 21. In cl 11, the same actions lead to the SSG staying up with 0 shells, but switching manually is possible, and attempting to fire will switch automatically. Happens in 0.27.1 and 0.24.0. Can't seem to trigger in 0.23 or 0.22, but it still happens when playing demos from later versions. When played back in other ports, the demos crash the game.

Demos

d-bind commented 12 months ago

With "boom weapon auto switch" disabled (dsda_switch_when_ammo_runs_out 0), the effect can be consistently replicated by firing (not REfiring) the last two shells from attached custom SSG. No precise timing or autoswitching from another weapon needed in this case. deh_ssg.zip

fabiangreffrath commented 11 months ago

This is a bummer. Do we have a solution to this @kraflab ?

kraflab commented 11 months ago

I haven't looked into it at all, but it's going to require a new comp flag to fix.

T-117 commented 11 months ago

This seems like an issue very similar to what was described in this PRBoom+ Issue https://github.com/coelckers/prboom-plus/issues/131

Apparently this fixed it. https://github.com/coelckers/prboom-plus/commit/febe0e16b855b9f893be2268e782596edb984509

T-117 commented 11 months ago

looking at the history, that line was removed here https://github.com/kraflab/dsda-doom/commit/52b4365ba4a283ef60e8cf78ade87fbdcff4b07c#comments I have no idea if adding it back is the correct answer though.

SirBofu commented 5 months ago

Couple of observations:

kraflab commented 3 months ago

The issue shown in the demos posted seems related to the fact that chaining multiple weapon swaps never leaves things in an "off" state for the check "have i done a weapon autoswitch already?" to reset, meaning the second time (when using the last shells), the game thinks the autoswitch already happened and thus never bothers to set the new weapon. I think that could be fixed by resetting the autoswitch check inside A_CheckReload, at least I wasn't able to trigger the bug with that change. But that doesn't affect the dehacked ssg issue, that even still happens if I delete the code in A_CheckReload that messes with weapon state. I'm not sure exactly why it still lowers the weapon in that case.

fabiangreffrath commented 3 months ago

There is some probably related code commented out in the original MBF sources:

https://github.com/Doom-Utils/historic-ports/blob/12f0105340a2aaae66a0a3efac6bd8b9af5f960c/p_pspr.c#L273-L277

kraflab commented 3 months ago

Adopting this suggestion from @fabiangreffrath: https://github.com/kraflab/dsda-doom/commit/fb53471fae5aed6b780894c0a126cd073b4f87c1 The auto switch logic can be improved separately, for now this fixes the critical outcome.