Making weapons not execute two frames in the first tic

Moderator: GZDoom Developers

Post Reply
User avatar
Spleen
Posts: 497
Joined: Fri Nov 28, 2008 7:07 pm

Making weapons not execute two frames in the first tic

Post by Spleen »

I recently stumbled upon an issue when fixing weapon desyncs in Skulltag: weapons execute their first frame twice when the player spawns, once from the P_BringUpWeapon call from P_SetupPsprites, and the second time when the player is ticked. For the pistol that the default player has, this means calling A_Raise twice. This makes it very difficult to sync weapons of newly-spawned players in a non-hacky way without making Skulltag more vulnerable to instant weapon switch hacks, since the default way of keeping weapons in sync is having the server follow the client's lead in switching weapons.

I fixed this issue in the cleanest way I could think of: ReadyWeapon starts off as NULL, and P_SetupPsprites no longer calls P_BringUpWeapon. Instead, P_MovePsprites automatically calls P_BringUpWeapon when the player is ticked, because ReadyWeapon is NULL. (I did not change P_MovePsprites, it already did this)

Since we Skulltag developers are very interested in keeping our codebase compatible with ZDoom's as much as possible so that future revisions of ZDoom can be more easily updated to, I am submitting this patch as a possible solution. If it is unacceptable in its current form, please tell me how I can improve it. Feel free to remove the code I have commented out.

Pastebin of patch: http://paste.pocoo.org/show/256940/
Attachments
twoticksraise.zip
(764 Bytes) Downloaded 25 times
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49234
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Making weapons not execute two frames in the first tic

Post by Graf Zahl »

I hope you know what you are doing here... ;)
User avatar
Spleen
Posts: 497
Joined: Fri Nov 28, 2008 7:07 pm

Re: Making weapons not execute two frames in the first tic

Post by Spleen »

Graf Zahl wrote:I hope you know what you are doing here... ;)
I tried to understand the weapon code as best as I could before submitting a patch. But well, I'd hoped that someone who knew the weapon code better would take a look and confirm that I'm not doing something [censored word].

Thanks for adding it, anyways. I'll keep an eye on the Bugs forum to help fix any unforeseen issues that this may cause, if any. No matter how much effort I spend to make my code bug-free, I never assume it is. :wink:
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49234
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Making weapons not execute two frames in the first tic

Post by Graf Zahl »

Well, since this doesn't work I had to revert it.

See http://forum.zdoom.org/viewtopic.php?f=2&t=27168
User avatar
Spleen
Posts: 497
Joined: Fri Nov 28, 2008 7:07 pm

Re: Making weapons not execute two frames in the first tic

Post by Spleen »

Sorry!! I'll get back to figuring out how to make it work properly. Thanks for being patient with me.


Or maybe I'm not cut out for this stuff, maybe I should stay away from trying to fix ancient bugs.. :?
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”