[Since 2.2.0] A_CheckForReload is acting weird for my case

Is there something that doesn't work right in the latest GZDoom? Post about it here.

Moderator: GZDoom Developers

Forum rules
Please construct and post a simple demo whenever possible for all bug reports. Please provide links to everything.

If you can include a wad demonstrating the problem, please do so. Bug reports that include fully-constructed demos have a much better chance of being investigated in a timely manner than those that don't.

Please make a new topic for every bug. Don't combine multiple bugs into a single topic. Thanks!

[Since 2.2.0] A_CheckForReload is acting weird for my case

Postby 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 allExpand view
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
You do not have the required permissions to view the files attached to this post.
Last edited by Dark-Assassin on Mon Jun 22, 2020 5:48 pm, edited 2 times in total.
User avatar
Dark-Assassin
 
Joined: 19 Mar 2009
Location: South Australia

Re: [Since 2.2.0] A_CheckForReload is acting weird for my ca

Postby _mental_ » Fri Jun 19, 2020 11:46 pm

Post a runnable sample please.
_mental_
 
 
 
Joined: 07 Aug 2011

Re: [Since 2.2.0] A_CheckForReload is acting weird for my ca

Postby Dark-Assassin » Mon Jun 22, 2020 4:33 pm

Attached to OP
User avatar
Dark-Assassin
 
Joined: 19 Mar 2009
Location: South Australia

Re: [Since 2.2.0] A_CheckForReload is acting weird for my ca

Postby drfrag » Mon Aug 30, 2021 3:40 am

Well according to the A_CheckForReload spec i can't make head and tails of your example. The second parameter is a string not an integer and you pass always the same (besides it doesn't exist).
https://zdoom.org/wiki/A_CheckForReload
User avatar
drfrag
Os voy a romper a pedazos!
Vintage GZDoom Developer
 
Joined: 23 Apr 2004
Location: Spain
Discord: drfrag#3555
Github ID: drfrag666

Re: [Since 2.2.0] A_CheckForReload is acting weird for my ca

Postby Dark-Assassin » Mon Aug 30, 2021 4:48 am

Integers are accepted as an offset just like pretty much all other A_Jump functions.
User avatar
Dark-Assassin
 
Joined: 19 Mar 2009
Location: South Australia

Re: [Since 2.2.0] A_CheckForReload is acting weird for my ca

Postby drfrag » Mon Aug 30, 2021 4:59 am

Are you sure? It's not documented and it is in A_Jump.
User avatar
drfrag
Os voy a romper a pedazos!
Vintage GZDoom Developer
 
Joined: 23 Apr 2004
Location: Spain
Discord: drfrag#3555
Github ID: drfrag666

Re: [Since 2.2.0] A_CheckForReload is acting weird for my ca

Postby Graf Zahl » Mon Aug 30, 2021 5:27 am

This has always been possible in DECORATE. The documentation has it wrong.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: [Since 2.2.0] A_CheckForReload is acting weird for my ca

Postby drfrag » Mon Aug 30, 2021 5:32 am

Okay true but he's changing the counter in the middle of the loop is that right?
User avatar
drfrag
Os voy a romper a pedazos!
Vintage GZDoom Developer
 
Joined: 23 Apr 2004
Location: Spain
Discord: drfrag#3555
Github ID: drfrag666

Re: [Since 2.2.0] A_CheckForReload is acting weird for my ca

Postby drfrag » Mon Aug 30, 2021 11:50 am

I don't think you can have several calls to A_CheckForReload inside the same loop, after all it's a generalization for A_CheckRailReload. May be before it happened to work "as intended". I know that jumps are handled differently now but the code for that function is pretty much the same as before.
User avatar
drfrag
Os voy a romper a pedazos!
Vintage GZDoom Developer
 
Joined: 23 Apr 2004
Location: Spain
Discord: drfrag#3555
Github ID: drfrag666

Re: [Since 2.2.0] A_CheckForReload is acting weird for my ca

Postby Graf Zahl » Mon Aug 30, 2021 11:56 am

Setting the last parameter to 1 will not increment the counter. This was definitely never meant to be used like here but it should work anyway.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: [Since 2.2.0] A_CheckForReload is acting weird for my ca

Postby drfrag » Mon Aug 30, 2021 12:07 pm

I dunno but this commit looks relevant:
https://github.com/coelckers/gzdoom/com ... 93bdef5e9a
User avatar
drfrag
Os voy a romper a pedazos!
Vintage GZDoom Developer
 
Joined: 23 Apr 2004
Location: Spain
Discord: drfrag#3555
Github ID: drfrag666


Return to Bugs

Who is online

Users browsing this forum: No registered users and 3 guests