by Dark-Assassin » Fri Jun 19, 2020 6:55 pm
Seems A_CheckForReload is a little bit broken in GZDoom under certain circumstances.
I have a weapon that has sequential fire frames but may be canceled at any time.
Due to Zandronum compatibility (hurr durr I know...) my choices are limited and if I don't want the weapon animations to be ping delayed I can't use ACS calls.
I choose the next frame by using this:
Code: Select all
ChooseFireFrame:
QSNG # 0 A_CheckForReload(8,1)
Goto FireFrame7
QSNG # 0 A_CheckForReload(7,1,1)
Goto FireFrame6
QSNG # 0 A_CheckForReload(6,1,1)
Goto FireFrame5
QSNG # 0 A_CheckForReload(5,1,1)
Goto FireFrame4
QSNG # 0 A_CheckForReload(4,1,1)
Goto FireFrame3
QSNG # 0 A_CheckForReload(3,1,1)
Goto FireFrame2
QSNG # 0 A_CheckForReload(2,1,1)
Goto FireFrame1
QSNG # 0 A_ResetReloadCounter
Goto FireFrame0
In Zandronum and GZDoom versions up to 2.1.0, the frames go 0, 1, 2, 3, 4, 5, 6, 7 as they should, but in GZDoom 2.2.0 and later it goes 1, 2, 3, 4, 5, 6, 3, 7 which isn't right. Note it starting at 1 instead of 0 and the 2nd 3 before the 7.
I've spoken to phantombeta on Discord about it and after a bit of back and fourth, they said:
phantombeta wrote:
Congrats, either you've found a very old bug that no one else has been affected by, or your code was accidentally relying on undefined behaviour
You should report it on the forums now
- Attachments
-
- A_CheckForReload Test.pk3
- Test weapon is a pistol in slot 0. Numbers will be printed to the console and message area when firing.
- (448 Bytes) Downloaded 59 times
Seems A_CheckForReload is a little bit broken in GZDoom under certain circumstances.
I have a weapon that has sequential fire frames but may be canceled at any time.
Due to Zandronum compatibility (hurr durr I know...) my choices are limited and if I don't want the weapon animations to be ping delayed I can't use ACS calls.
I choose the next frame by using this:
[code]ChooseFireFrame:
QSNG # 0 A_CheckForReload(8,1)
Goto FireFrame7
QSNG # 0 A_CheckForReload(7,1,1)
Goto FireFrame6
QSNG # 0 A_CheckForReload(6,1,1)
Goto FireFrame5
QSNG # 0 A_CheckForReload(5,1,1)
Goto FireFrame4
QSNG # 0 A_CheckForReload(4,1,1)
Goto FireFrame3
QSNG # 0 A_CheckForReload(3,1,1)
Goto FireFrame2
QSNG # 0 A_CheckForReload(2,1,1)
Goto FireFrame1
QSNG # 0 A_ResetReloadCounter
Goto FireFrame0
[/code]
In Zandronum and GZDoom versions up to 2.1.0, the frames go 0, 1, 2, 3, 4, 5, 6, 7 as they should, but in GZDoom 2.2.0 and later it goes 1, 2, 3, 4, 5, 6, 3, 7 which isn't right. Note it starting at 1 instead of 0 and the 2nd 3 before the 7.
I've spoken to phantombeta on Discord about it and after a bit of back and fourth, they said:
[quote="phantombeta"]
Congrats, either you've found a very old bug that no one else has been affected by, or your code was accidentally relying on undefined behaviour
You should report it on the forums now
[/quote]