Merge in xonotic/xonotic-data.pk3dir.git: mirceakitsune/scoreboard_respawn_info
git-manager created issue #1331 (closed) on 2012-10-06T13:36:33Z:
Purpose of the branch:
When the player is dead, respawn info is shown in the scoreboard below the map information string. This is useful to know how many seconds you must wait until you may spawn back, or if you're already awaiting respawn (pressed fire or jump while dead).
Repository: xonotic/xonotic-data.pk3dir.git Commit: be48928f Branch: mirceakitsune/scoreboard_respawn_info
Merge commands:
cd data/xonotic-data.pk3dir
git checkout master
git reset --hard origin/master
git pull && git diff 'be48928fb84ee1951c1d5eb2e0c5ed6ef64c0b04'..'origin/mirceakitsune/scoreboard_respawn_info'
# 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/mirceakitsune/scoreboard_respawn_info'
# 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 'mirceakitsune/scoreboard_respawn_info'
Diffstat:
qcsrc/client/scoreboard.qc | 21 +++++++++++++++++++++
qcsrc/common/constants.qh | 2 ++
qcsrc/server/cl_client.qc | 11 +++++++++++
qcsrc/server/defs.qh | 2 ++
qcsrc/server/g_world.qc | 3 +++
5 files changed, 39 insertions(+), 0 deletions(-)
Revision log:
commit be48928fb84ee1951c1d5eb2e0c5ed6ef64c0b04
Author: Mircea Kitsune
Commit: Mircea Kitsune
Improve last commit, and show a separate text while the server is working on respawning the player
commit 04852fe26cf701d01c27af9c1b551815ddb2e30e
Author: Mircea Kitsune
Commit: Mircea Kitsune
Don't show a negative value while the server is respawning the player
commit ce46a70f6613f7e04e319bd4947d1c0bdcda2f3f
Author: Mircea Kitsune
Commit: Mircea Kitsune
Use ftos_decimals instead of foolshly bounding and substring-ing the value. Respawn timer will now show values past 9.99
commit 895afff11288d798d6d66f1ec6b5f77fb4e7dae6
Author: Mircea Kitsune
Commit: Mircea Kitsune
Only show when the player is allowed to spawn, not during rounds in Arena or Clan Arena
commit 14cfbdee1a2b90bff05e9b9fb4e1f96c8f9daa52
Author: Mircea Kitsune
Commit: Mircea Kitsune
Better text colors
commit f38cc65e6b814cbbc909424423db9994f82c33b3
Author: Mircea Kitsune
Commit: Mircea Kitsune
Copy stat_respawn_time for spectated players
commit c7df878d742427829b294ae9043a64e98aa00c8d
Author: Mircea Kitsune
Commit: Mircea Kitsune
Code cleanup
commit e66d119ea383c642f0eab2905bd005067c7ba1b9
Author: Mircea Kitsune
Commit: Mircea Kitsune
Bound timer to 9.999999 seconds... no one should set a spawn timer longer than 10 either way
commit 809becdca7b6d0bd84d3b9e0939d6498806d8d7c
Author: Mircea Kitsune
Commit: Mircea Kitsune
Limit seconds to 4 characters (eg: 1.23 instead of 1.234567)
commit cb0709da8ee360c0b175ed4cede85dbe276faf9c
Author: Mircea Kitsune
Commit: Mircea Kitsune
Show key name when indicating the player how to respawn. Not that it's needed, but if we're doing it let's do it right :P
commit 4cd55965e8d7759f6118859ae37a3095288af8bd
Author: Mircea Kitsune
Commit: Mircea Kitsune
Colorize seconds in yellow
commit d363eb368a00bc3837c8729014ee50e3e09700a8
Author: Mircea Kitsune
Commit: Mircea Kitsune
Properly draw respawn info on a new line
commit 45da8007011542ca3b5979b7f85827b10632f1fc
Author: Mircea Kitsune
Commit: Mircea Kitsune
Show respawn information below the scoreboard when dead. Useful to know if you've already triggered a respawn, or how long you have to wait until you can spawn back. Uses a single extra stat for all info
User agreed to the GPLv2*.
Diff:
<pre>diff —git a/qcsrc/client/scoreboard.qc b/qcsrc/client/scoreboard.qc
index 48a7217..913a0bf 100644
— a/qcsrc/client/scoreboard.qc
**+ b/qcsrc/client/scoreboard.qc
@ -1374,9 +1374,30
@ void HUD_DrawScoreboard
}
}
- pos_y *= 1.2 * hud_fontsize_y;
- drawcolorcodedstring(pos + ‘0.5 0 0’ * (sbwidth - stringwidth(str, TRUE, hud_fontsize)), str, hud_fontsize, scoreboard_alpha_fg, DRAWFLAG_NORMAL);
- // print information about respawn status
- float respawn_time = getstatf(STAT_RESPAWN_TIME);
- if(respawn_time)
- {
- if(respawn_time < 0)
- {
- // a negative number means we are awaiting respawn, time value is still the same
- respawn_time *= ~~1; // remove mark now that we checked it
- if // don’t show a negative value while the server is respawning the player
- str = strcat;
- else
- str = strcat, “1\ seconds…"); +\ } +\ else\ if +\ str\ =\ strcat,\ "7 seconds before respawning”);
- else if
- str = strcat, “^7 to respawn”); pos_y *= 1.2 * hud_fontsize_y; drawcolorcodedstring), str, hud_fontsize, scoreboard_alpha_fg, DRAWFLAG_NORMAL);
- }
scoreboard_bottom = pos_y + 2 * hud_fontsize_y;
}
diff —git a/qcsrc/common/constants.qh b/qcsrc/common/constants.qh
index c270b61..75f5a0b 100644
— a/qcsrc/common/constants.qh
**+ b/qcsrc/common/constants.qh
@ -179,6 +179,8
@ const float STAT_VEHICLESTAT_RELOAD2 = 66; const float STAT_SECRETS_TOTAL = 70; const float STAT_SECRETS_FOUND = 71; *const float STAT_RESPAWN_TIME = 72;
// mod stats
const float STAT_REDALIVE = 100;
const float STAT_BLUEALIVE = 101;
diff —git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc
index 9d6bcf7..22c2f0d 100644
— a/qcsrc/server/cl_client.qc
**+ b/qcsrc/server/cl_client.qc
@ -2167,6 +2167,7
@ void SpectateCopy {
self.dmg_inflictor = spectatee.dmg_inflictor;
self.v_angle = spectatee.v_angle;
self.angles = spectatee.v_angle;
- self.stat_respawn_time = spectatee.stat_respawn_time;
if
self.fixangle = TRUE;
setorigin;
@ -2558,6 +2559,11
@ void PlayerPreThink self.stat_allow_oldnexbeam = autocvar_g_allow_oldnexbeam; self.stat_leadlimit = autocvar_leadlimit; - if
- self.stat_respawn_time = self.respawn_time;
- else
- self.stat_respawn_time = 0;
if
{
// physics frames: update anticheat stuff
@ -2730,6 +2736,11
@ void PlayerPreThink
}
ShowRespawnCountdown;
}
+
- // if respawning, invert stat_respawn_time to indicate this, the client translates it
- if
- self.stat_respawn_time *=~~1;
return;
}
// FIXME from now on self.deadflag is always 0 (and self.health is never < 1)
diff —git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh
index 9068fa7..d7772e5 100644
— a/qcsrc/server/defs.qh
**+ b/qcsrc/server/defs.qh
@ -647,6 +647,8
@ float serverflags;
.entity muzzle_flash;
.float misc_bulletcounter; // replaces uzi & hlac bullet counter.
*.float stat_respawn_time; // shows respawn time, and is negative when awaiting respawn
*
void PlayerUseKey();
typedef vector(entity player, entity spot, vector current) spawn_evalfunc_t;
diff —git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc
index 4cd5cc8..69bf57d 100644
— a/qcsrc/server/g_world.qc
**+ b/qcsrc/server/g_world.qc
@ -831,6 +831,9
@ void spawnfunc_worldspawn
addstat;
addstat;
- // misc
- addstat(STAT_RESPAWN_TIME, AS_FLOAT, stat_respawn_time);
next_pingtime = time + 5;
detect_maptype();