Merge in xonotic/xonotic-data.pk3dir.git: terencehill/spectate_prev
git-manager created issue #1513 (closed) on 2013-04-19T15:31:04Z:
Purpose of the branch:
See commit messages
Repository: xonotic/xonotic-data.pk3dir.git Commit: b0e4ebf4 Branch: terencehill/spectate_prev
Merge commands:
cd data/xonotic-data.pk3dir
git checkout master
git reset --hard origin/master
git pull && git diff 'b0e4ebf4cf698adc8d6322fb366d0e6045d555e6'..'origin/terencehill/spectate_prev'
# please check that the diff you just saw did not contain anything complex that
# needs a new merge request, and review these changes
git merge --no-ff 'origin/terencehill/spectate_prev'
# please make sure this merge worked, and if not, fix merge conflicts and git
# commit BEFORE the next command
#
# also, THIS is the point to do final pre-merge testing
#
# use git reset --hard origin/master to bail out
git push && git push --delete origin 'terencehill/spectate_prev'
Diffstat:
qcsrc/client/hud.qc | 2 +-
qcsrc/server/cl_client.qc | 120 ++++++++++++++++++++-------
qcsrc/server/mutators/mutator_superspec.qc | 2 +-
3 files changed, 91 insertions(+), 33 deletions(-)
Revision log:
commit b0e4ebf4cf698adc8d6322fb366d0e6045d555e6
Author: terencehill
Commit: terencehill
Implement a function to spectate previous player and add possibility to spectate next/previous player with next/previous weapon binds (primary fire still changes to the next player)
commit 7afcbb39433ed2a94c33c820f2ace04b42fc5a8b
Author: terencehill
Commit: terencehill
Superspec mutator shouldn't call SpectateNext as it may lead to spectate an unwanted player in CA since players of the same team cannot be spectated
User agreed to the GPLv2*.
Diff:
<pre>diff —git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc
index bf72c2f..90dac2e 100644
— a/qcsrc/client/hud.qc
**+ b/qcsrc/client/hud.qc
@ -3656,7 +3656,7
@ void HUD_InfoMessages
if
s = sprintf, getcommandkey);
else
- s = sprintf, getcommandkey);
- s = sprintf(*, getcommandkey, getcommandkey);
drawInfoMessage
if
diff —git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc
index 4c7d5c5..3f60068 100644
— a/qcsrc/server/cl_client.qc
**+ b/qcsrc/server/cl_client.qc
@ -2192,6 +2192,46
@ float SpectateUpdate { }
*float setSpectator *{
- if
- return FALSE;
- /*if
- {
- msg_entity = self;
- WriteByte;
- WriteEntity;
- //stuffcmd;
- self.movetype = MOVETYPE_NONE;
- accuracy_resend;
- }
- else
- return TRUE; *}
*float Spectate *{
- if
- if
- return 0;
- self.enemy = pl;
- return setSpectator; *}
// Returns next available player to spectate if g_ca_spectate_enemies 0
entity CA_SpectateNext(entity start) {
if (start.team self.team) {
@ -2215,11 +2255,8
@ entity CA_SpectateNext {
return other;
}
~~float SpectateNext {
~~
- if
- other =*prefer;
- else *float SpectateNext *{ other = find(self.enemy, classname, “player”);
if (g_ca && !autocvar_g_ca_spectate_enemies && self.caplayer) {
@ -2234,34 +2271,45
@ float SpectateNext(entity *prefer) {
if
self.enemy = other;
- if {
- /*if
- {
- return setSpectator; *}
- msg_entity = self;
- WriteByte;
- WriteEntity;
- //stuffcmd; *float SpectatePrev *{
- // NOTE: chain order is from the highest to the lower entnum
- other = findchain;
- if not // no player
- return FALSE;
- self.movetype = MOVETYPE_NONE;
- accuracy_resend;
- entity first = other;
- // skip players until current spectated player
- if
- while
- other = other.chain;
- if
- {
- do { other = other.chain; }
- while;
- if not
- {
- other = first;
- while
- other = other.chain;
- if
- return TRUE;
- } } else
- return 1;
- } else {
- return 0;
- {
- if
- other = other.chain;
- else
- other = first; }
- self.enemy = other;
- return setSpectator;
}
/*
@ -2419,7 +2467,7
@ void ObserverThink self.flags |= FL_SPAWNING; } else if { self.flags &=\ FL_JUMPRELEASED; -\ if\ \ 1)\ { +\ \ \ \ \ \ \ \ \ \ \ if(SpectateNext())\ { \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ self.classname\ =\ "spectator"; \ \ \ \ \ \ \ \ \ \ \ \ } \ \ \ \ \ \ \ \ }\ else\ { @@\ -2448,14\ +2496,24\ @@\ void\ SpectatorThink() \ \ \ \ \ \ \ \ if\ (self.BUTTON_JUMP\ &&\ !self.version_mismatch)\ { \ \ \ \ \ \ \ \ \ \ \ \ self.flags\ &~=\ FL_JUMPRELEASED; \ \ \ \ \ \ \ \ \ \ \ \ self.flags\ |=\ FL_SPAWNING; -\ \ \ \ \ \ \ }\ else\ if(self.BUTTON_ATCK)\ { +\ \ \ \ \ \ \ }\ else\ if(self.BUTTON_ATCK\ ||\ self.impulse\ \ 10\ ||\ self.impulse\ \ 15\ ||\ self.impulse\ \ 18\ ||\ self.impulse\ >=\ 200\ &&\ self.impulse\ <=\ 209)\ { \ self.flags\ &= FL_JUMPRELEASED;
- if 1) {
-
if(SpectateNext()) { self.classname = "spectator"; } else { self.classname = "observer"; PutClientInServer(); }
-
self.impulse = 0;
-
} else if(self.impulse 12 || self.impulse 16 || self.impulse 19 || self.impulse \>= 220 && self.impulse \<= 229) {
- self.flags &=\ FL_JUMPRELEASED;
+\ if)\ {
+\ self.classname\ =\ “spectator”;
+\ }\ else\ {
+\ self.classname\ =\ “observer”;
+\ PutClientInServer;
+\ }
+\ self.impulse\ =\ 0;
\ }\ else\ if\ {
\ self.flags\ &= FL_JUMPRELEASED;
self.classname = “observer”;
diff —git a/qcsrc/server/mutators/mutator_superspec.qc b/qcsrc/server/mutators/mutator_superspec.qc
index a351f93..16aa80c 100644
— a/qcsrc/server/mutators/mutator_superspec.qc
+ b/qcsrc/server/mutators/mutator_superspec.qc
@ -21,7 +21,7
@ float*spectate(entity _player) {
- if(SpectateNext(_player) 1)
- if(Spectate(_player) 1) { PutObserverInServer(); self.classname = “spectator”;