by Spleen » Tue Aug 31, 2010 6:37 pm
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
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/