Added new cl_hooks, menu_cmd isdemo and fixed demoseeking.cfg
This branch documents cl_hook_game*
implementation with some comments and adds start and end hooks for demos as those were missing and game hooks were not fired during demos.
Hook explanations:
-
cl_hook_gamestart hook is still only fired when a gamemode is init'd or with nop fallback if that hasn't happened before VM shutdown
-
cl_hook_gameend hook now with a breaking change no longer fires at the start of an intermission if a gamestart hook has been called OR when the CSQC VM shuts down. It is now always only called when the CSQC VM shuts down
-
cl_hook_intermission is now a separate hook from cl_hook_gameend which is only fired when an intermission starts if a gamestart hook has been called
-
a new cl_hook_demostart hook is now fired when a gamemode is properly init'd while playing a demo
-
a new cl_hook_demointermission hook is now fired if a gamemode has been properly init'd and an intermission starts running in a demo
-
a new cl_hook_demoend hook is now fired when the CSQC VM shuts down while playing a demo
New menu_cmd isdemo
Now there is a way to live check if your client is running a demo or not from the console. If menu_cmd isdemo
is called without an argument then it will create a new cvar _menu_isdemo
while if it called with an argument like set asdf "69";menu_cmd isdemo asdf
then it'll write into asdf
either a 1 or a 0 depending on if a demo is playing or not.
Breaking changes:
None anymore.
Backwards compatibility issues:
Old servers and old demos will never have cl_hook_demo* hooks. This means that they can not be used for any fancy stuff as they depend on demo age and servers to update.
Fixes:
Reworked how demos are detected to allow forward seeking in demos for engine master branch clients with new demos. When darkplaces#397 (closed) is fixed master engine branch is able to seek backwards too without manually setting _current_demo_name "demos/asdf.dem"
Cruft Removal:
-
_demo_is_playing
variable is no longer needed at all AFAIK and thus it was removed -
alias cl_hook_gamestart_all "demoseeking_game_started"
is no longer needed to be set by the player in their configs -
_demoseeking_playdemo_check
hack which depended on weird behavior which changed in master branch which broke the hack