diff --git a/config/menus_settings.cfg b/config/menus_settings.cfg index de10aeda..344d6ed6 100644 --- a/config/menus_settings.cfg +++ b/config/menus_settings.cfg @@ -287,10 +287,13 @@ newmenu [Spectating keys] menuitem "Select an action and press ENTER to bind a new key:" -1 menuitem "" -1 menuitem "\f2Demo watching:" -1 -menuitemspectkeyinput [Toggle game speed: ] key_demo_togglespeed -menuitemspectkeyinput [Increase game speed: ] key_demo_gamespeedup -menuitemspectkeyinput [Decrease game speed: ] key_demo_gamespeeddown -menuitemspectkeyinput [Reset game speed: ] key_demo_gamespeedreset +menuitemspectkeyinput [Toggle game speed: ] speckey_demo_togglespeed +menuitemspectkeyinput [Increase game speed: ] speckey_demo_gamespeedup +menuitemspectkeyinput [Decrease game speed: ] speckey_demo_gamespeeddown +menuitemspectkeyinput [Reset game speed: ] speckey_demo_gamespeedreset +menuitem "" -1 +menuitem "\f2Misc spectating keys:" -1 +menuitemspectkeyinput [Whois spectated player: ] speckey_whois_spectatecn newmenu Mouse menuitemcheckbox [Invert mouse: ] "$invmouse" [ invmouse $arg1 ] diff --git a/config/resetbinds.cfg b/config/resetbinds.cfg index 4e9b43b0..67692e93 100644 --- a/config/resetbinds.cfg +++ b/config/resetbinds.cfg @@ -9,10 +9,6 @@ alias key_console_end [ conskip -1000 ] alias key_console_forward [ conskip -5 ] alias key_console_rewind [ conskip 5 ] alias key_console_scroll [ if (strcmp $modifier 0) [ tempalias __confade $confade ] ; onrelease "confade $__confade ; if (! $__scrolled) [ conskip -1000 ]" ; confade 0 ; tempalias __scrolled 0 ; domodifier conscroll ] -alias key_demo_gamespeeddown [ if (watchingdemo) [ if (<= $gamespeed 100) [ gamespeed (- $gamespeed 10) ] [ gamespeed (- $gamespeed 100) ]; gamespeed ] ] -alias key_demo_gamespeedup [ if (watchingdemo) [ if (< $gamespeed 100) [ gamespeed (+ $gamespeed 10) ] [ gamespeed (+ $gamespeed 100) ]; gamespeed ] ] -alias key_demo_gamespeedreset [ if (watchingdemo) [ gamespeed 100; gamespeed ] ] -alias key_demo_togglespeed [ if (watchingdemo) [ onrelease (concat gamespeed $gamespeed) ; gamespeed 1000 ] ] alias key_domodifier_1 [ domodifier 1 ] alias key_domodifier_2 [ domodifier 2 ] alias key_escape [ if $connected [ ingamemenu ] [ if (watchingdemo) [ showmenu [Watching demo] ] [ showmenu main ] ] ] @@ -67,6 +63,12 @@ alias editkey_tagclip_clip [ edittagclip clip ] alias editkey_scroll_spawns [ domodifier spawns ] alias editkey_scroll_todoents [ domodifier todoents ] +alias speckey_demo_gamespeeddown [ if (watchingdemo) [ if (<= $gamespeed 100) [ gamespeed (- $gamespeed 10) ] [ gamespeed (- $gamespeed 100) ]; gamespeed ] ] +alias speckey_demo_gamespeedup [ if (watchingdemo) [ if (< $gamespeed 100) [ gamespeed (+ $gamespeed 10) ] [ gamespeed (+ $gamespeed 100) ]; gamespeed ] ] +alias speckey_demo_gamespeedreset [ if (watchingdemo) [ gamespeed 100; gamespeed ] ] +alias speckey_demo_togglespeed [ if (watchingdemo) [ onrelease (concat gamespeed $gamespeed) ; gamespeed 1000 ] ] +alias speckey_whois_spectatecn [ if (>= (spectatecn) 0) [ whois (spectatecn) ] ] + _defaultbinds 1 // do not save the following binds to saved.cfg _resetallbinds @@ -149,13 +151,14 @@ bind E edittoggle editbind E edittoggle bind F [] editbind F editkey_cubes_solid -specbind F key_demo_togglespeed +specbind F speckey_demo_togglespeed bind G quicknadethrow editbind G editkey_cubes_space bind H [] editbind H editkey_cubes_hf_floor bind I [] editbind I editkey_cubes_hf_ceiling +specbind I speckey_whois_spectatecn bind J [] bind K [] editbind K corner @@ -216,15 +219,15 @@ bind INSERT [] editbind INSERT editkey_floortex_up bind HOME [] editbind HOME editkey_walltex_up -specbind HOME key_demo_gamespeedreset +specbind HOME speckey_demo_gamespeedreset bind END [] editbind END editkey_walltex_dn bind PAGEUP [] editbind PAGEUP editkey_ceiltex_up -specbind PAGEUP key_demo_gamespeedup +specbind PAGEUP speckey_demo_gamespeedup bind PAGEDOWN [] editbind PAGEDOWN editkey_ceiltex_dn -specbind PAGEDOWN key_demo_gamespeeddown +specbind PAGEDOWN speckey_demo_gamespeeddown bind F1 key_voteyes bind F2 key_voteno bind F3 [] diff --git a/source/src/clientgame.cpp b/source/src/clientgame.cpp index 10db784f..f9298db0 100644 --- a/source/src/clientgame.cpp +++ b/source/src/clientgame.cpp @@ -1662,6 +1662,8 @@ void spectate() else tryrespawn(); } +COMMAND(spectate, ""); + void setfollowplayer(int cn) { // silently ignores invalid player-cn value passed @@ -1675,6 +1677,8 @@ void setfollowplayer(int cn) } } +COMMANDF(setfollowplayer, "i", (int *cn) { setfollowplayer(*cn); }); + // set new spect mode void spectatemode(int mode) { @@ -1713,6 +1717,8 @@ void spectatemode(int mode) player1->spectatemode = mode; } +COMMANDF(spectatemode, "i", (int *mode) { spectatemode(*mode); }); + void togglespect() // cycle through all spectating modes { if(m_botmode) @@ -1726,16 +1732,24 @@ void togglespect() // cycle through all spectating modes } } +COMMAND(togglespect, ""); + void changefollowplayer(int shift) { if(!m_botmode) updatefollowplayer(shift); } -COMMAND(spectate, ""); -COMMANDF(spectatemode, "i", (int *mode) { spectatemode(*mode); }); -COMMAND(togglespect, ""); COMMANDF(changefollowplayer, "i", (int *dir) { changefollowplayer(*dir); }); -COMMANDF(setfollowplayer, "i", (int *cn) { setfollowplayer(*cn); }); + +void spectatecn() +{ + int spectcn = -1; + if(player1->isspectating() && player1->spectatemode >= SM_FOLLOW1ST && player1->spectatemode <= SM_FOLLOW3RD_TRANSPARENT) + spectcn = player1->followplayercn; + intret(spectcn); +} + +COMMAND(spectatecn, ""); void serverextension(char *ext, char *args) {