From: terencehill Date: Fri, 20 Sep 2024 16:43:14 +0000 (+0200) Subject: Change key to change spectator camera mode from Backspace (drop weapon) to Right... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=07cdd84a9fb888b2c61ca34e4d300bd69493704e;p=xonotic%2Fxonotic-data.pk3dir.git Change key to change spectator camera mode from Backspace (drop weapon) to Right mouse button (secondary fire) Right mouse button used to allow switching from spectator to observer but it's now redundant since F3 can do it --- diff --git a/qcsrc/client/hud/panel/infomessages.qc b/qcsrc/client/hud/panel/infomessages.qc index 5866271ef..bea111f6e 100644 --- a/qcsrc/client/hud/panel/infomessages.qc +++ b/qcsrc/client/hud/panel/infomessages.qc @@ -112,7 +112,7 @@ void HUD_InfoMessages() if(spectatee_status == -1) s = sprintf(_("^1Use ^3%s^1 or ^3%s^1 to change the speed"), getcommandkey(_("next weapon"), "weapnext"), getcommandkey(_("previous weapon"), "weapprev")); else if(!observe_blocked) - s = sprintf(_("^1Press ^3%s^1 to observe, ^3%s^1 to change camera mode"), getcommandkey(_("secondary fire"), "+fire2"), getcommandkey(_("drop weapon"), "dropweapon")); + s = sprintf(_("^1Press ^3%s^1 to observe, ^3%s^1 to change camera mode"), getcommandkey(_("observe"), "spec"), getcommandkey(_("secondary fire"), "+fire2")); else s = sprintf(_("^1Press ^3%s^1 to change camera mode"), getcommandkey(_("drop weapon"), "dropweapon")); break; diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index 261fd1b01..09dc73979 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -603,7 +603,7 @@ bool View_SpectatorCamera() { if (!waiting_CAMERA_SPECTATOR_update) { - Impulse_Send(IMP_weapon_drop); // switch to CAMERA_SPECTATOR 2 + localcmd("\n+attack2; wait; -attack2\n"); // switch to CAMERA_SPECTATOR 2 waiting_CAMERA_SPECTATOR_update = 1; } } @@ -618,7 +618,7 @@ bool View_SpectatorCamera() { if (waiting_CAMERA_SPECTATOR_update != STAT(CAMERA_SPECTATOR)) { - Impulse_Send(IMP_weapon_drop); // switch to CAMERA_SPECTATOR (2 and) 0 + localcmd("\n+attack2; wait; -attack2\n"); // switch to CAMERA_SPECTATOR (2 and) 0 waiting_CAMERA_SPECTATOR_update = STAT(CAMERA_SPECTATOR); } } diff --git a/qcsrc/common/mutators/mutator/overkill/oknex.qc b/qcsrc/common/mutators/mutator/overkill/oknex.qc index 2b205fea9..325ccd4d7 100644 --- a/qcsrc/common/mutators/mutator/overkill/oknex.qc +++ b/qcsrc/common/mutators/mutator/overkill/oknex.qc @@ -358,7 +358,7 @@ METHOD(OverkillNex, wr_zoom, bool(entity thiswep, entity actor)) METHOD(OverkillNex, wr_zoomdir, bool(entity thiswep)) { - return button_attack2 && !WEP_CVAR(WEP_OVERKILL_NEX, secondary); + return button_attack2 && !WEP_CVAR(WEP_OVERKILL_NEX, secondary); } #endif diff --git a/qcsrc/menu/xonotic/dialog_forfeit.qh b/qcsrc/menu/xonotic/dialog_forfeit.qh index 7e8ecb3b2..55acbf6a3 100644 --- a/qcsrc/menu/xonotic/dialog_forfeit.qh +++ b/qcsrc/menu/xonotic/dialog_forfeit.qh @@ -1,6 +1,6 @@ #pragma once -#include "dialog.qh" +#include "rootdialog.qh" CLASS(XonoticForfeitDialog, XonoticRootDialog) METHOD(XonoticForfeitDialog, fill, void(entity)); ATTRIB(XonoticForfeitDialog, title, string, _("Forfeit")); diff --git a/qcsrc/menu/xonotic/keybinder.qc b/qcsrc/menu/xonotic/keybinder.qc index 918826332..47f7a3557 100644 --- a/qcsrc/menu/xonotic/keybinder.qc +++ b/qcsrc/menu/xonotic/keybinder.qc @@ -115,7 +115,7 @@ void KeyBinds_BuildList() KEYBIND_HEADER(_("Teamplay")); KEYBIND_DEF("team_auto" , _("auto-join team")); KEYBIND_DEF("team_selection_show" , _("team selection")); - KEYBIND_DEF("spec" , _("spectate")); + KEYBIND_DEF("spec" , _("observe")); KEYBIND_EMPTY_LINE(); KEYBIND_HEADER(_("Misc")); diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index bd7ab6a9b..b3d3dc8a7 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -2429,23 +2429,28 @@ bool PlayerThink(entity this) return true; } -.bool would_spectate; +.int new_CAMERA_SPECTATOR; // merged SpectatorThink and ObserverThink (old names are here so you can grep for them) void ObserverOrSpectatorThink(entity this) { bool is_spec = IS_SPEC(this); + if ( CS(this).impulse ) { int r = MinigameImpulse(this, CS(this).impulse); if (!is_spec || r) CS(this).impulse = 0; + } - if (is_spec && CS(this).impulse == IMP_weapon_drop.impulse) + if (is_spec) + { + if (PHYS_INPUT_BUTTON_ATCK2(this)) { - STAT(CAMERA_SPECTATOR, this) = (STAT(CAMERA_SPECTATOR, this) + 1) % 3; - CS(this).impulse = 0; - return; + if (this.new_CAMERA_SPECTATOR == STAT(CAMERA_SPECTATOR, this)) + this.new_CAMERA_SPECTATOR = (STAT(CAMERA_SPECTATOR, this) + 1) % 3; } + else if (STAT(CAMERA_SPECTATOR, this) != this.new_CAMERA_SPECTATOR) + STAT(CAMERA_SPECTATOR, this) = this.new_CAMERA_SPECTATOR; } if (frametime && autocvar_sv_show_entnum) show_entnum(this); @@ -2490,13 +2495,6 @@ void ObserverOrSpectatorThink(entity this) PutClientInServer(this); } CS(this).impulse = 0; - } else if(PHYS_INPUT_BUTTON_ATCK2(this)) { - if(!observe_blocked_if_eliminated || !INGAME(this)) { - this.would_spectate = false; - this.flags &= ~FL_JUMPRELEASED; - TRANSMUTE(Observer, this); - PutClientInServer(this); - } } else if(!SpectateUpdate(this) && !SpectateNext(this)) { PutObserverInServer(this, false, true); this.would_spectate = true; @@ -2510,7 +2508,7 @@ void ObserverOrSpectatorThink(entity this) set_movetype(this, preferred_movetype); } } else { // jump pressed - if ((is_spec && !(PHYS_INPUT_BUTTON_ATCK(this) || PHYS_INPUT_BUTTON_ATCK2(this))) + if ((is_spec && !(PHYS_INPUT_BUTTON_ATCK(this))) || (!is_spec && !(PHYS_INPUT_BUTTON_ATCK(this) || PHYS_INPUT_BUTTON_JUMP(this)))) { this.flags |= FL_JUMPRELEASED; // primary attack pressed diff --git a/qcsrc/server/client.qh b/qcsrc/server/client.qh index 815e26390..e9b5f63d6 100644 --- a/qcsrc/server/client.qh +++ b/qcsrc/server/client.qh @@ -68,7 +68,7 @@ float autocvar_sv_player_scale; .float alivetime; // time of being alive .bool wasplayer; - +.bool would_spectate; .int spectatee_status; .bool zoomstate;