Page 1 of 1

Problems With GZDoom Not Respecting Tic Delays

PostPosted: Wed Aug 14, 2019 2:20 am
by 22alpha22
I've recently started simplifying my weapons in my mods by using Anonymous functions rather than a billion or so jumpifs, in the process I've run into a peculiar, game breaking problem. After I simplified my unarmed weapon (code below), switching from the unarmed weapon to any other weapon now causes the other weapons to switch near instantly despite there being delays in how many A_Raise is called per tic. Not only that, after switching to a new weapon from the fist, the new weapon behaves strangely, with random weapon actions performing much quicker than there supposed to and sometimes the weapon locks up completely. If the weapon locks up, it wont respond to any command and becomes impossible to switch away from. Even more strangely, the rest of the game continues to run fine, I can still move and interact with the map. I have to manually remove the weapon via console commands to regain control of my arsenal. This only happens when switching from the fist to another weapon. Switching from any other weapon to another doesn't break anything.

The new unarmed fist:
Spoiler:

The old fist:
Spoiler:

Note when I reverted back to the old fist code, the problems went away.

Another weapon's code for reference:
Spoiler:

When switching from the fist to this weapon or any other, the weapon raises instantly and behaves unpredictably. When switching from any other weapon, it raises at the normal speed and behaves as expected.

Re: Problems With GZDoom Not Respecting Tic Delays

PostPosted: Wed Aug 14, 2019 3:07 am
by Graf Zahl
You shouldn't call A_Raise and A_Lower repeatedly in the same state. This behaves subtly different in case the desired animation ends. With only one call per state it jumps to the ready state, meaning that the following A_Raise states never get called. But with your new grouping it jumps to the ready state just as before, but since the anonymous function hasn't ended yet it will also run through the subsequent A_Raise calls and mess things up quite badly.

Sadly the weapon code suffers from some serious design issues that cannot be undone without breaking 25 years of modding.

Re: Problems With GZDoom Not Respecting Tic Delays

PostPosted: Wed Aug 14, 2019 1:34 pm
by 22alpha22
Ok that makes sense now that I think about it. I wasted several hours trying figure it out where problem was before I isolated it to the fist but I didn't know what the actual problem was. Glad to have this worked out. :)

Re: Problems With GZDoom Not Respecting Tic Delays

PostPosted: Wed Aug 14, 2019 8:37 pm
by Void Weaver
A bit offtopic but you can just specify weapon lowering or rising speed in function itself. So A_Lower(24) will deselect weapon 4 times faster.