]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Restore BACKSPACE to change spectator camera mode, make right mouse button switch...
authorterencehill <piuntn@gmail.com>
Tue, 24 Sep 2024 10:57:26 +0000 (12:57 +0200)
committerterencehill <piuntn@gmail.com>
Tue, 24 Sep 2024 10:57:26 +0000 (12:57 +0200)
qcsrc/client/hud/panel/infomessages.qc
qcsrc/client/view.qc
qcsrc/server/client.qc

index bea111f6e2725ff00f02beb9a4b70e4c5ec216a6..6c73ddad7db9c0f61f599e84c93b50a96fcc75fe 100644 (file)
@@ -106,13 +106,13 @@ void HUD_InfoMessages()
                                                if(spectatee_status == -1)
                                                        s = sprintf(_("^1Press ^3%s^1 to spectate"), getcommandkey(_("primary fire"), "+fire"));
                                                else
-                                                       s = sprintf(_("^1Press ^3%s^1 or ^3%s^1 for next or previous player"), getcommandkey(_("next weapon"), "weapnext"), getcommandkey(_("previous weapon"), "weapprev"));
+                                                       s = sprintf(_("^1Press ^3%s^1 or ^3%s^1 for next or previous player"), getcommandkey(_("primary fire"), "+fire"), getcommandkey(_("secondary fire"), "+fire2"));
                                                break;
                                        case 1:
                                                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(_("observe"), "spec"), getcommandkey(_("secondary fire"), "+fire2"));
+                                                       s = sprintf(_("^1Press ^3%s^1 to observe, ^3%s^1 to change camera mode"), getcommandkey(_("observe"), "spec"), getcommandkey(_("drop weapon"), "dropweapon"));
                                                else
                                                        s = sprintf(_("^1Press ^3%s^1 to change camera mode"), getcommandkey(_("drop weapon"), "dropweapon"));
                                                break;
index 09dc739799dbe92ca7cf48a9e560864b9faebc79..261fd1b01149392e106e1b2e56b5bb15b6b1e5a2 100644 (file)
@@ -603,7 +603,7 @@ bool View_SpectatorCamera()
                        {
                                if (!waiting_CAMERA_SPECTATOR_update)
                                {
-                                       localcmd("\n+attack2; wait; -attack2\n"); // switch to CAMERA_SPECTATOR 2
+                                       Impulse_Send(IMP_weapon_drop); // 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))
                                {
-                                       localcmd("\n+attack2; wait; -attack2\n"); // switch to CAMERA_SPECTATOR (2 and) 0
+                                       Impulse_Send(IMP_weapon_drop); // switch to CAMERA_SPECTATOR (2 and) 0
                                        waiting_CAMERA_SPECTATOR_update = STAT(CAMERA_SPECTATOR);
                                }
                        }
index b3d3dc8a79906204634b80a7435122f812adff96..5de427a78fed9465c8e538ec80f0d4ff1404314f 100644 (file)
@@ -2429,7 +2429,9 @@ bool PlayerThink(entity this)
        return true;
 }
 
-.int new_CAMERA_SPECTATOR;
+#define IS_WEAPNEXT_IMPULSE(imp) (imp == 10 || imp == 15 || imp == 18 || (imp >= 200 && imp <= 209))
+#define IS_WEAPPREV_IMPULSE(imp) (imp == 12 || imp == 16 || imp == 19 || (imp >= 220 && imp <= 229))
+
 // merged SpectatorThink and ObserverThink (old names are here so you can grep for them)
 void ObserverOrSpectatorThink(entity this)
 {
@@ -2440,17 +2442,12 @@ void ObserverOrSpectatorThink(entity this)
                int r = MinigameImpulse(this, CS(this).impulse);
                if (!is_spec || r)
                        CS(this).impulse = 0;
-       }
-
-       if (is_spec)
-       {
-               if (PHYS_INPUT_BUTTON_ATCK2(this))
+               if (is_spec && CS(this).impulse == IMP_weapon_drop.impulse)
                {
-                       if (this.new_CAMERA_SPECTATOR == STAT(CAMERA_SPECTATOR, this))
-                               this.new_CAMERA_SPECTATOR = (STAT(CAMERA_SPECTATOR, this) + 1) % 3;
+                       STAT(CAMERA_SPECTATOR, this) = (STAT(CAMERA_SPECTATOR, this) + 1) % 3;
+                       CS(this).impulse = 0;
+                       return;
                }
-               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);
@@ -2472,7 +2469,7 @@ void ObserverOrSpectatorThink(entity this)
                if (PHYS_INPUT_BUTTON_JUMP(this) && (joinAllowed(this, this.wants_join) || time < CS(this).jointime + MIN_SPEC_TIME)) {
                        this.flags &= ~FL_JUMPRELEASED;
                        this.flags |= FL_SPAWNING;
-               } else if((is_spec && (PHYS_INPUT_BUTTON_ATCK(this) || CS(this).impulse == 10 || CS(this).impulse == 15 || CS(this).impulse == 18 || (CS(this).impulse >= 200 && CS(this).impulse <= 209)))
+               } else if((is_spec && (PHYS_INPUT_BUTTON_ATCK(this) || IS_WEAPNEXT_IMPULSE(CS(this).impulse)))
                        || (!is_spec && ((PHYS_INPUT_BUTTON_ATCK(this) && !CS(this).version_mismatch) || this.would_spectate))) {
                        this.flags &= ~FL_JUMPRELEASED;
                        if(SpectateNext(this)) {
@@ -2486,7 +2483,7 @@ void ObserverOrSpectatorThink(entity this)
                        if (is_spec)
                                CS(this).impulse = 0;
                } else if (is_spec) {
-                       if(CS(this).impulse == 12 || CS(this).impulse == 16  || CS(this).impulse == 19 || (CS(this).impulse >= 220 && CS(this).impulse <= 229)) {
+                       if(PHYS_INPUT_BUTTON_ATCK2(this) || IS_WEAPPREV_IMPULSE(CS(this).impulse)) {
                                this.flags &= ~FL_JUMPRELEASED;
                                if(SpectatePrev(this)) {
                                        TRANSMUTE(Spectator, this);
@@ -2508,7 +2505,7 @@ void ObserverOrSpectatorThink(entity this)
                        set_movetype(this, preferred_movetype);
                }
        } else { // jump pressed
-               if ((is_spec && !(PHYS_INPUT_BUTTON_ATCK(this)))
+               if ((is_spec && !(PHYS_INPUT_BUTTON_ATCK(this) || PHYS_INPUT_BUTTON_ATCK2(this)))
                        || (!is_spec && !(PHYS_INPUT_BUTTON_ATCK(this) || PHYS_INPUT_BUTTON_JUMP(this)))) {
                        this.flags |= FL_JUMPRELEASED;
                        // primary attack pressed
@@ -2528,6 +2525,8 @@ void ObserverOrSpectatorThink(entity this)
        if (is_spec)
                this.flags |= FL_CLIENT | FL_NOTARGET;
 }
+#undef IS_WEAPNEXT_IMPULSE
+#undef IS_WEAPPREV_IMPULSE
 
 void PlayerUseKey(entity this)
 {