Page 1 of 1

Stop mouse input entirely for a brief moment?

PostPosted: Tue Apr 06, 2021 5:31 pm
by Mini--Joe
I'm trying to get a glory kill system working, and making the player unable to move is simple enough, but I don't know if its possible to stop the player from aiming at all.

Anyone have any pointers? I was considering using A_Saw to at least adjust the angle towards the monster, but I don't want to use that because you would still be able to turn around if you moved the mouse quickly enough.

Re: Stop mouse input entirely for a brief moment?

PostPosted: Tue Apr 06, 2021 11:43 pm
by Jarewill
The only way I know how to do it is with SetPlayerProperty and PROP_TOTALLYFROZEN, which is a shame since it's ACS only.
If someone knows of a way to do this with DECORATE or ZScript, I'd appreciate the knowledge too.

Re: Stop mouse input entirely for a brief moment?

PostPosted: Wed Apr 07, 2021 12:51 am
by Player701
Code: Select allExpand view
player.cheats |= CF_TOTALLYFROZEN;

upd: To disable:

Code: Select allExpand view
player.cheats &= ~CF_TOTALLYFROZEN;

Re: Stop mouse input entirely for a brief moment?

PostPosted: Wed Apr 07, 2021 12:58 am
by Jarewill
Oh wow, thank you a lot Player701!
Does that work with all SetPlayerProperty values?
If so, maybe the wiki page could be updated with the ZScript method?
I know it could come in handy for me if I forget how to do it again.

Re: Stop mouse input entirely for a brief moment?

PostPosted: Wed Apr 07, 2021 1:28 am
by Player701
The relevant code is here.

It looks like PROP_FROZEN, PROP_NOTARGET, PROP_INSTANTWEAPONSWITCH, PROP_TOTALLYFROZEN, and PROP_BUDDHA do correspond to cheat flags: CF_FROZEN, CF_NOTARGET, CF_INSTANTWEAPSWITCH, CF_TOTALLYFROZEN, and CF_BUDDHA respectively.

PROP_FLY is supposed to set the cheat flag CF_FLY, but that is commented out for some reason. Instead, it sets the actor flags NOGRAVITY, FLY, and FLYCHEAT (undocumented but appears to be accessible in ZScript). The FLYCHEAT flag is set only if the first argument is 0 (set for current player only). I have no idea why it works like that, better ask a dev.

There's also a certain compatibility hack for PROP_FROZEN and PROP_TOTALLYFROZEN, but it's only used in one map so it's probably not worth mentioning in detail (if you're interested, open compatibility.txt in gzdoom.pk3 and search for "linkfrozenprops").

Remaining properties (marked "deprecated" in the wiki) do not set or clear any flags but give and take powerups instead. Except for PROP_ALLMAP, which doesn't give anything but toggles the level flag to reveal the map (same as a MapRevealer would do).

Note that it is also possible to call SetPlayerProperty directly from ZScript, but it doesn't do anything unless the first argument is non-zero (set for all players). Probably because the activator is not bound when such a call is made ("toucher.SetPlayerProperty" doesn't work, you can only call it as a global-scope function).