r2113 - trunk/data/qcsrc/server
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Sun Jan 14 14:08:55 EST 2007
Author: div0
Date: 2007-01-14 14:08:54 -0500 (Sun, 14 Jan 2007)
New Revision: 2113
Removed:
trunk/data/qcsrc/server/centermsg.qc
trunk/data/qcsrc/server/centermsg.qh
Modified:
trunk/data/qcsrc/server/arena.qc
trunk/data/qcsrc/server/cl_client.qc
trunk/data/qcsrc/server/cl_physics.qc
trunk/data/qcsrc/server/cl_player.qc
trunk/data/qcsrc/server/cl_weapons.qc
trunk/data/qcsrc/server/clientcommands.qc
trunk/data/qcsrc/server/ctf.qc
trunk/data/qcsrc/server/defs.qh
trunk/data/qcsrc/server/g_damage.qc
trunk/data/qcsrc/server/g_triggers.qc
trunk/data/qcsrc/server/g_world.qc
trunk/data/qcsrc/server/miscfunctions.qc
trunk/data/qcsrc/server/progs.src
trunk/data/qcsrc/server/t_items.qc
trunk/data/qcsrc/server/t_plats.qc
trunk/data/qcsrc/server/teamplay.qc
trunk/data/qcsrc/server/w_nex.qc
Log:
Replaced trunk's centerprint system by the simpler one in branch; this is to
keep trunk and branch in sync.
Eventually, it will get replaced by CSQC stuff anyway, so why keep it
unnecessarily different.
Modified: trunk/data/qcsrc/server/arena.qc
===================================================================
--- trunk/data/qcsrc/server/arena.qc 2007-01-14 18:57:35 UTC (rev 2112)
+++ trunk/data/qcsrc/server/arena.qc 2007-01-14 19:08:54 UTC (rev 2113)
@@ -126,16 +126,18 @@
if(time < warmup && self.spawned)
{
if(champion)
- centermsg_set(CENTERMSG_ARENACHAMP, strcat("The Champion is ", champion.netname));
+ msg = strcat(msg, "The Champion is ", champion.netname, "^7\n\n\n");
if(f)
- centermsg_set(CENTERMSG_ARENATIMER, strcat("Round will start in ", ftos(f)));
+ msg = strcat(msg, "Round will start in ", ftos(f));
else
{
if(self.spawned)
- centermsg_set(CENTERMSG_ARENATIMER, "^1Fight!");
+ msg = strcat(msg, "^1Fight!");
}
+ centerprint(self, msg);
+
if(self.spawned)
self.movetype = MOVETYPE_NONE;
@@ -147,7 +149,7 @@
else if(self.movetype == MOVETYPE_NONE)
{
self.movetype = MOVETYPE_WALK;
- centermsg_reset();
+ centerprint(self, "\n");
}
}
Deleted: trunk/data/qcsrc/server/centermsg.qc
===================================================================
--- trunk/data/qcsrc/server/centermsg.qc 2007-01-14 18:57:35 UTC (rev 2112)
+++ trunk/data/qcsrc/server/centermsg.qc 2007-01-14 19:08:54 UTC (rev 2113)
@@ -1,129 +0,0 @@
-.float centermsg_expire[MAXCENTERMSG];
-.string centermsg_text[MAXCENTERMSG];
-.float centermsg_nextdisplay;
-
-void centermsg_makedirty()
-{
- self.centermsg_nextdisplay = time;
-}
-
-void centermsg_free(float lineno)
-{
- if(self.(centermsg_expire[lineno]) > 0)
- strunzone(self.(centermsg_text[lineno]));
- self.(centermsg_expire[lineno]) = -1;
- self.(centermsg_text[lineno]) = "";
- centermsg_makedirty();
-}
-
-void centermsg_freefor(entity p, float lineno)
-{
- entity oldself;
- oldself = self;
- self = p;
- centermsg_free(lineno);
- self = oldself;
-}
-
-void centermsg_set(float lineno, string text)
-{
- centermsg_free(lineno);
- self.(centermsg_expire[lineno]) = time + self.cvar_scr_centertime;
- self.(centermsg_text[lineno]) = strzone(text);
- centermsg_makedirty();
-}
-
-void centermsg_setexpire(float lineno, string text, float expire)
-{
- centermsg_free(lineno);
- self.(centermsg_expire[lineno]) = time + self.cvar_scr_centertime * expire;
- self.(centermsg_text[lineno]) = strzone(text);
- centermsg_makedirty();
-}
-
-void centermsg_setfor(entity p, float lineno, string text)
-{
- entity oldself;
- oldself = self;
- self = p;
- centermsg_set(lineno, text);
- self = oldself;
-}
-
-float centermsg_checkexpire(float lineno)
-{
- if(self.(centermsg_expire[lineno]) >= 0)
- {
- if(self.(centermsg_expire[lineno]) < time)
- {
- centermsg_free(lineno);
- return FALSE;
- }
- return TRUE;
- }
- return FALSE;
-}
-
-void centermsg_do()
-{
- float i;
- float found;
- string out;
- found = 0;
-
- if(self.cvar_scr_centertime)
- self.centermsg_nextdisplay = time + self.cvar_scr_centertime * 0.8;
-
- for(i = 0; i < MAXCENTERMSG; ++i)
- if(centermsg_checkexpire(i))
- found = 1;
-
- if(!found)
- return;
-
- out = "\n\n\n\n\n\n\n\n\n\n\n\n\n";
- for(i = 0; i < MAXCENTERMSG; ++i)
- {
- out = strcat(out, "^7");
- if(self.centermsg_expire[i] >= 0)
- out = strcat(out, self.(centermsg_text[i]));
- out = strcat(out, "\n");
- }
- centerprint(self, out);
-}
-
-void centermsg_check()
-{
- if(clienttype(self) != CLIENTTYPE_REAL)
- return;
- if(self.centermsg_nextdisplay && self.centermsg_nextdisplay <= time)
- centermsg_do();
-}
-
-void centermsg_reset()
-{
- float i;
- self.centermsg_nextdisplay = 0;
- for(i = 0; i < MAXCENTERMSG; ++i)
- centermsg_free(i);
- centerprint(self, "");
-}
-
-void centermsg_setall(string s)
-{
- float i;
- centerprint(self, s);
- self.centermsg_nextdisplay = 0;
- for(i = 0; i < MAXCENTERMSG; ++i)
- centermsg_free(i);
-}
-
-void centermsg_setallfor(entity p, string text)
-{
- entity oldself;
- oldself = self;
- self = p;
- centermsg_setall(text);
- self = oldself;
-}
-
Deleted: trunk/data/qcsrc/server/centermsg.qh
===================================================================
--- trunk/data/qcsrc/server/centermsg.qh 2007-01-14 18:57:35 UTC (rev 2112)
+++ trunk/data/qcsrc/server/centermsg.qh 2007-01-14 19:08:54 UTC (rev 2113)
@@ -1,30 +0,0 @@
-// centerprint locations
-#define MAXCENTERMSG 11
-#define CENTERMSG_VOTE 0
-#define CENTERMSG_GAMEMODE1 2
-#define CENTERMSG_GAMEMODE2 3
-#define CENTERMSG_NIXNEXCOUNT 4
-#define CENTERMSG_TRIGGER 5
-#define CENTERMSG_NIXNEX 6
-#define CENTERMSG_MINSTAGIB 6
-#define CENTERMSG_MINSTAGIB2 7
-#define CENTERMSG_TEAMCHANGE 7
-#define CENTERMSG_TEAMCHANGE2 8
-#define CENTERMSG_KILL 8
-#define CENTERMSG_DEATH 8
-#define CENTERMSG_CAMP 8
-#define CENTERMSG_POINT 9
-#define CENTERMSG_TEAMSAY 10
-
-#define CENTERMSG_ARENACHAMP CENTERMSG_GAMEMODE1
-#define CENTERMSG_ARENATIMER CENTERMSG_GAMEMODE2
-#define CENTERMSG_CTF CENTERMSG_GAMEMODE1
-
-void centermsg_check();
-void centermsg_reset();
-void centermsg_set(float lineno, string text);
-void centermsg_setfor(entity player, float lineno, string text);
-void centermsg_free(float lineno);
-void centermsg_freefor(entity player, float lineno);
-void centermsg_setall(string s);
-void centermsg_setallfor(entity player, string s);
Modified: trunk/data/qcsrc/server/cl_client.qc
===================================================================
--- trunk/data/qcsrc/server/cl_client.qc 2007-01-14 18:57:35 UTC (rev 2112)
+++ trunk/data/qcsrc/server/cl_client.qc 2007-01-14 19:08:54 UTC (rev 2113)
@@ -664,7 +664,6 @@
//void dom_player_join_team(entity pl);
void ClientConnect (void)
{
- //local float fh;
local string s;
self.classname = "player_joining";
@@ -720,23 +719,7 @@
self.welcomemessage_time = time + cvar("welcome_message_time");
self.welcomemessage_time2 = 0;
- /*
- // the client might not have his maps/%s.cfg file yet!
- // so send the one from the server...
- fh = fopen(strcat("maps/", mapname, ".cfg"), FILE_READ);
- if(fh >= 0)
- {
- while((s = fgets(fh)))
- stuffcmd(self, strcat(s, "\n"));
- fclose(fh);
- }
- // and then execute the client's so he can still override CD tracks
-
- not needed any more: current map download system disconnects and reconnects
- after the download, and then the file will be there
- */
stuffcmd(self, strcat("exec maps/", mapname, ".cfg\n"));
-
// TODO: is this being used for anything else than cd tracks?
// Remember: SVC_CDTRACK exists. Maybe it should be used.
@@ -1426,7 +1409,7 @@
//sprint(self, "distance: ", ftos(self.lms_traveled_distance), "\n");
if(self.lms_traveled_distance < cvar("g_lms_campcheck_distance"))
{
- centermsg_set(CENTERMSG_CAMP, cvar_string("g_lms_campcheck_message"));
+ centerprint(self, cvar_string("g_lms_campcheck_message"));
// FIXME KadaverJack: gibbing player here causes playermodel to bounce around, instead of eye.md3
// I wasn't able to find out WHY that happens, so I put a workaround in place that shall prevent players from being gibbed :(
Damage(self, self, self, bound(0, cvar("g_lms_campcheck_damage"), self.health + self.armorvalue * cvar("g_balance_armor_blockpercent") + 5), DEATH_CAMP, self.origin, '0 0 0');
@@ -1554,7 +1537,7 @@
PutClientInServer();
if(self.flags & !FL_NOTARGET)
bprint (strcat("^4", self.netname, "^4 is playing now\n"));
- centermsg_reset();
+ centerprint(self,"");
return;
} else {
self.flags = self.flags & !FL_JUMPRELEASED;
@@ -1587,7 +1570,7 @@
if(cvar("g_campaign"))
campaign_bots_may_start = 1;
PutClientInServer();
- centermsg_reset();
+ centerprint(self,"");
return;
} else {
self.flags = self.flags & !FL_JUMPRELEASED;
Modified: trunk/data/qcsrc/server/cl_physics.qc
===================================================================
--- trunk/data/qcsrc/server/cl_physics.qc 2007-01-14 18:57:35 UTC (rev 2112)
+++ trunk/data/qcsrc/server/cl_physics.qc 2007-01-14 19:08:54 UTC (rev 2113)
@@ -20,7 +20,7 @@
local vector wishvel, wishdir, v;
local float wishspeed, f, maxspd_mod, spd, maxairspd, airaccel, swampspd_mod;
string temps;
-
+
if (clienttype(self) == CLIENTTYPE_BOT)
bot_think();
Modified: trunk/data/qcsrc/server/cl_player.qc
===================================================================
--- trunk/data/qcsrc/server/cl_player.qc 2007-01-14 18:57:35 UTC (rev 2112)
+++ trunk/data/qcsrc/server/cl_player.qc 2007-01-14 19:08:54 UTC (rev 2113)
@@ -409,7 +409,7 @@
{
if(self.selected_player)
{
- centermsg_set(CENTERMSG_POINT, "");
+ centerprint_expire(self, CENTERPRIO_POINT);
self.selected_player = world;
self.selected_player_display_needs_update = FALSE;
}
@@ -495,7 +495,7 @@
{
namestr = selected.netname;
}
- centermsg_set(CENTERMSG_POINT, namestr);
+ centerprint_atprio(self, CENTERPRIO_POINT, namestr);
}
}
else
Modified: trunk/data/qcsrc/server/cl_weapons.qc
===================================================================
--- trunk/data/qcsrc/server/cl_weapons.qc 2007-01-14 18:57:35 UTC (rev 2112)
+++ trunk/data/qcsrc/server/cl_weapons.qc 2007-01-14 19:08:54 UTC (rev 2113)
@@ -355,19 +355,13 @@
if(dt >= 1 && dt <= 5)
self.nixnex_lastinfotime = -42;
else
- {
- centermsg_free(CENTERMSG_NIXNEXCOUNT);
- centermsg_set(CENTERMSG_NIXNEX, strcat("^2Active weapon: ^3", W_Name(nixnex_weapon)));
- }
+ centerprint(self, strcat("\n\n^2Active weapon: ^3", W_Name(nixnex_weapon), "\n"));
}
if(self.nixnex_lastinfotime != dt)
{
self.nixnex_lastinfotime = dt; // initial value 0 should count as "not seen"
if(dt >= 1 && dt <= 5)
- {
- centermsg_set(CENTERMSG_NIXNEXCOUNT, strcat("^3", ftos(dt), "^2 seconds until weapon change..."));
- centermsg_set(CENTERMSG_NIXNEX, strcat("Next weapon: ^3", W_Name(nixnex_nextweapon)));
- }
+ centerprint(self, strcat("^3", ftos(dt), "^2 seconds until weapon change...\n\nNext weapon: ^3", W_Name(nixnex_nextweapon), "\n"));
}
if(cvar("g_use_ammunition") && time > self.nixnex_nextincr)
Modified: trunk/data/qcsrc/server/clientcommands.qc
===================================================================
--- trunk/data/qcsrc/server/clientcommands.qc 2007-01-14 18:57:35 UTC (rev 2112)
+++ trunk/data/qcsrc/server/clientcommands.qc 2007-01-14 19:08:54 UTC (rev 2113)
@@ -44,7 +44,7 @@
{
sprint(head, msgstr);
if(teamsay)
- centermsg_setfor(head, CENTERMSG_TEAMSAY, cmsgstr);
+ centerprint(head, cmsgstr);
//stuffcmd(head, "play2 misc/talk.wav\n");
}
head = find(head, classname, "player");
Modified: trunk/data/qcsrc/server/ctf.qc
===================================================================
--- trunk/data/qcsrc/server/ctf.qc 2007-01-14 18:57:35 UTC (rev 2112)
+++ trunk/data/qcsrc/server/ctf.qc 2007-01-14 19:08:54 UTC (rev 2113)
@@ -248,7 +248,7 @@
player = find(world, classname, "player");
while(player) {
- if(player.team == self.team) centermsg_setfor(player, CENTERMSG_CTF, "The enemy got your flag! Retrieve it!");
+ if(player.team == self.team) centerprint(player, "The enemy got your flag! Retrieve it!");
player = find(player, classname, "player");
}
@@ -289,7 +289,7 @@
player = find(world, classname, "player");
while(player) {
- if(player.team == self.team) centermsg_setfor(player, CENTERMSG_CTF, "The enemy got your flag! Retrieve it!");
+ if(player.team == self.team) centerprint(player, "The enemy got your flag! Retrieve it!");
player = find(player, classname, "player");
}
self.movetype = MOVETYPE_NONE; // flag must have MOVETYPE_NONE here, otherwise it will drop through the floor...
Modified: trunk/data/qcsrc/server/defs.qh
===================================================================
--- trunk/data/qcsrc/server/defs.qh 2007-01-14 18:57:35 UTC (rev 2112)
+++ trunk/data/qcsrc/server/defs.qh 2007-01-14 19:08:54 UTC (rev 2113)
@@ -155,7 +155,7 @@
void(entity client, string s) stuffcmd = #21;
void(entity client, string s) sprint = #24;
vector(entity e, float sped) aim = #44;
-void(entity client, string s) centerprint = #73;
+void(entity client, string s) centerprint_builtin = #73;
void(entity e) setspawnparms = #78;
void(float to, float f) WriteByte = #52;
void(float to, float f) WriteChar = #53;
@@ -301,4 +301,8 @@
.float selected_player_display_needs_update; // are regular updates necessary? (health)
.float selected_player_display_timeout; // when the selection will time out
+void centerprint_atprio(entity e, float prio, string s);
+void centerprint_expire(entity e, float prio);
+void centerprint(entity e, string s);
+
.float respawn_countdown; // next number to count
Modified: trunk/data/qcsrc/server/g_damage.qc
===================================================================
--- trunk/data/qcsrc/server/g_damage.qc 2007-01-14 18:57:35 UTC (rev 2112)
+++ trunk/data/qcsrc/server/g_damage.qc 2007-01-14 19:08:54 UTC (rev 2113)
@@ -107,12 +107,11 @@
m = strcat(m, "^6Pink Team");
else if (targ.team == 13)
m = strcat(m, "^3Yellow Team");
- centermsg_setfor(targ, CENTERMSG_TEAMCHANGE, m);
+ centerprint(targ, m);
}
else if (deathtype == DEATH_AUTOTEAMCHANGE)
{
- centermsg_setfor(targ, CENTERMSG_TEAMCHANGE, "You have been moved into a different team to improve team balance");
- m = "You are now on: ";
+ m = "You have been moved into a different team to improve team balance\nYou are now on: ";
if (targ.team == 5)
m = strcat(m, "^1Red Team");
else if (targ.team == 14)
@@ -121,19 +120,19 @@
m = strcat(m, "^6Pink Team");
else if (targ.team == 13)
m = strcat(m, "^3Yellow Team");
- centermsg_setfor(targ, CENTERMSG_TEAMCHANGE2, m);
+ centerprint(targ, m);
return;
}
else if (deathtype == DEATH_CAMP)
- centermsg_setfor(targ, CENTERMSG_DEATH, "^1Die camper!");
+ centerprint(targ, strcat("^1Die camper!\n\n\n"));
else if (deathtype == DEATH_NOAMMO)
- centermsg_setfor(targ, CENTERMSG_DEATH, "^1You were killed for running out of ammo...");
+ centerprint(targ, strcat("^1You were killed for running out of ammo...\n\n\n"));
else if (deathtype == DEATH_ROT)
- centermsg_setfor(targ, CENTERMSG_DEATH, "^1You grew too old without taking your medicine");
+ centerprint(targ, strcat("^1You grew too old without taking your medicine\n\n\n"));
else if (deathtype == DEATH_MIRRORDAMAGE)
- centermsg_setfor(targ, CENTERMSG_DEATH, "^1Don't shoot your team mates!");
+ centerprint(targ, strcat("^1Don't shoot your team mates!\n\n\n"));
else
- centermsg_setfor(targ, CENTERMSG_DEATH, "^1You killed your own dumb self!");
+ centerprint(targ, strcat("^1You killed your own dumb self!\n\n\n"));
if (deathtype == IT_GRENADE_LAUNCHER)
bprint ("^1",s, "^1 detonated\n");
@@ -168,7 +167,7 @@
}
else if (teamplay && attacker.team == targ.team)
{
- centermsg_setfor(attacker, CENTERMSG_DEATH, "^1Moron! You fragged a teammate!");
+ centerprint(attacker, strcat("^1Moron! You fragged a teammate!\n\n\n"));
bprint ("^1", attacker.netname, "^1 mows down a teammate\n");
GiveFrags(attacker, targ, -1);
//attacker.frags = attacker.frags - 1;
@@ -191,8 +190,8 @@
bprint("^1",attacker.netname, "^1 drew first blood", "\n");
}
- centermsg_setfor(attacker, CENTERMSG_KILL, strcat("^4You fragged ^7", s));
- centermsg_setfor(targ, CENTERMSG_DEATH, strcat("^1You were fragged by ^7", attacker.netname));
+ centerprint(attacker, strcat("^4You fragged ^7", s, "\n\n\n"));
+ centerprint(targ, strcat("^1You were fragged by ^7", attacker.netname, "\n\n\n"));
if (deathtype == IT_LASER)
bprint ("^1",s, "^1 was blasted by ", attacker.netname, "\n");
@@ -279,7 +278,7 @@
}
else
{
- centermsg_setfor(targ, CENTERMSG_DEATH, "^1Watch your step!");
+ centerprint(targ, strcat("^1Watch your step!\n\n\n"));
if (deathtype == DEATH_HURTTRIGGER && attacker.message != "")
bprint ("^1",s, "^1 ", attacker.message, "\n");
else if (deathtype == DEATH_DROWN)
@@ -403,7 +402,7 @@
if (targ.armorvalue && (deathtype == IT_NEX) && damage)
{
targ.armorvalue -= 1;
- centermsg_setfor(targ, CENTERMSG_MINSTAGIB, strcat("^3Remaining extra lives: ",ftos(targ.armorvalue)));
+ centerprint(targ, strcat("^3Remaining extra lives: ",ftos(targ.armorvalue),"\n"));
damage = 0;
if(clienttype(targ) == CLIENTTYPE_REAL) stuffcmd(targ, "play2 misc/hit.wav\n");
//stuffcmd(attacker, "play2 misc/hit.wav\n");
@@ -418,7 +417,7 @@
if (targ != attacker)
{
if (targ.classname == "player")
- centermsg_setfor(attacker, CENTERMSG_MINSTAGIB, "Secondary fire inflicts no damage!\n");
+ centerprint(attacker, "Secondary fire inflicts no damage!\n");
damage = 0;
mirrordamage = 0;
force = '0 0 0';
@@ -541,7 +540,7 @@
if(attacker.armorvalue > 0)
{
attacker.armorvalue = attacker.armorvalue - 1;
- centermsg_setfor(attacker, CENTERMSG_MINSTAGIB, strcat("^3Remaining extra lives: ",ftos(attacker.armorvalue)));
+ centerprint(attacker, strcat("^3Remaining extra lives: ",ftos(attacker.armorvalue),"\n"));
if(clienttype(attacker) == CLIENTTYPE_REAL) stuffcmd(attacker, "play2 misc/hit.wav\n");
}
mirrordamage = 0;
Modified: trunk/data/qcsrc/server/g_triggers.qc
===================================================================
--- trunk/data/qcsrc/server/g_triggers.qc 2007-01-14 18:57:35 UTC (rev 2112)
+++ trunk/data/qcsrc/server/g_triggers.qc 2007-01-14 19:08:54 UTC (rev 2113)
@@ -54,7 +54,7 @@
//
if (activator.classname == "player" && self.message != "")
{
- centermsg_setfor (activator, CENTERMSG_TRIGGER, self.message);
+ centerprint (activator, self.message);
if (!self.noise)
sound (activator, CHAN_VOICE, "misc/talk.wav", 1, ATTN_NORM);
}
@@ -307,20 +307,20 @@
&& (self.spawnflags & SPAWNFLAG_NOMESSAGE) == 0)
{
if (self.count >= 4)
- centermsg_setfor (activator, CENTERMSG_TRIGGER, "There are more to go...");
+ centerprint (activator, "There are more to go...");
else if (self.count == 3)
- centermsg_setfor (activator, CENTERMSG_TRIGGER, "Only 3 more to go...");
+ centerprint (activator, "Only 3 more to go...");
else if (self.count == 2)
- centermsg_setfor (activator, CENTERMSG_TRIGGER, "Only 2 more to go...");
+ centerprint (activator, "Only 2 more to go...");
else
- centermsg_setfor (activator, CENTERMSG_TRIGGER, "Only 1 more to go...");
+ centerprint (activator, "Only 1 more to go...");
}
return;
}
if (activator.classname == "player"
&& (self.spawnflags & SPAWNFLAG_NOMESSAGE) == 0)
- centermsg_setfor(activator, CENTERMSG_TRIGGER, "Sequence completed!");
+ centerprint(activator, "Sequence completed!");
self.enemy = activator;
multi_trigger ();
};
@@ -429,7 +429,6 @@
}
}
*/
-
void() rain_think =
{
self.nextthink = time + 0.1;
Modified: trunk/data/qcsrc/server/g_world.qc
===================================================================
--- trunk/data/qcsrc/server/g_world.qc 2007-01-14 18:57:35 UTC (rev 2112)
+++ trunk/data/qcsrc/server/g_world.qc 2007-01-14 19:08:54 UTC (rev 2113)
@@ -959,7 +959,6 @@
// fixme: don't check players; instead check dom_team and ctf_team entities
// (div0: and that in CheckRules_World please)
- centermsg_check();
};
float checkrules_oneminutewarning;
Modified: trunk/data/qcsrc/server/miscfunctions.qc
===================================================================
--- trunk/data/qcsrc/server/miscfunctions.qc 2007-01-14 18:57:35 UTC (rev 2112)
+++ trunk/data/qcsrc/server/miscfunctions.qc 2007-01-14 19:08:54 UTC (rev 2113)
@@ -561,3 +561,31 @@
}
return out;
}
+
+#define CENTERPRIO_POINT 1
+#define CENTERPRIO_NORMAL 5
+.float centerprint_priority;
+.float centerprint_expires;
+void centerprint_atprio(entity e, float prio, string s)
+{
+ if(time > e.centerprint_expires)
+ e.centerprint_priority = 0;
+ if(prio >= e.centerprint_priority)
+ {
+ e.centerprint_priority = prio;
+ e.centerprint_expires = time + e.cvar_scr_centertime;
+ centerprint_builtin(e, s);
+ }
+}
+void centerprint_expire(entity e, float prio)
+{
+ if(prio == e.centerprint_priority)
+ {
+ e.centerprint_priority = 0;
+ centerprint_builtin(e, "");
+ }
+}
+void centerprint(entity e, string s)
+{
+ centerprint_atprio(e, CENTERPRIO_NORMAL, s);
+}
Modified: trunk/data/qcsrc/server/progs.src
===================================================================
--- trunk/data/qcsrc/server/progs.src 2007-01-14 18:57:35 UTC (rev 2112)
+++ trunk/data/qcsrc/server/progs.src 2007-01-14 19:08:54 UTC (rev 2113)
@@ -8,7 +8,6 @@
extensions.qh
campaign.qh
-centermsg.qh
../common/campaign_common.qh
../common/util.qh
../common/util.qc
@@ -80,5 +79,3 @@
campaign.qc
../common/campaign_file.qc
../common/campaign_setup.qc
-
-centermsg.qc
Modified: trunk/data/qcsrc/server/t_items.qc
===================================================================
--- trunk/data/qcsrc/server/t_items.qc 2007-01-14 18:57:35 UTC (rev 2112)
+++ trunk/data/qcsrc/server/t_items.qc 2007-01-14 19:08:54 UTC (rev 2113)
@@ -53,8 +53,7 @@
if (self.ammo_cells)
{
// play some cool sounds ;)
- centermsg_freefor(other, CENTERMSG_MINSTAGIB);
- centermsg_freefor(other, CENTERMSG_MINSTAGIB2);
+ centerprint(other, "\n");
if(other.health <= 5)
stuffcmd(other, "play2 announcer/robotic/lastsecond.ogg\n");
else if(other.health < 50)
Modified: trunk/data/qcsrc/server/t_plats.qc
===================================================================
--- trunk/data/qcsrc/server/t_plats.qc 2007-01-14 18:57:35 UTC (rev 2112)
+++ trunk/data/qcsrc/server/t_plats.qc 2007-01-14 19:08:54 UTC (rev 2113)
@@ -894,7 +894,7 @@
if (self.owner.message != "")
{
if (other.flags & FL_CLIENT)
- centermsg_setfor (other, CENTERMSG_TRIGGER, self.owner.message);
+ centerprint (other, self.owner.message);
sound (other, CHAN_VOICE, "misc/talk.wav", 1, ATTN_NORM);
}
};
@@ -1295,7 +1295,7 @@
if (self.message)
{
if (other.flags & FL_CLIENT)
- centermsg_setfor (other, CENTERMSG_TRIGGER, self.message);
+ centerprint (other, self.message);
sound (other, CHAN_BODY, "misc/talk.wav", 1, ATTN_NORM);
}
};
Modified: trunk/data/qcsrc/server/teamplay.qc
===================================================================
--- trunk/data/qcsrc/server/teamplay.qc 2007-01-14 18:57:35 UTC (rev 2112)
+++ trunk/data/qcsrc/server/teamplay.qc 2007-01-14 19:08:54 UTC (rev 2113)
@@ -309,16 +309,16 @@
if(self.classname == "observer")
{
if(cvar("g_lms") && self.frags <= 0 && self.frags > -666)
- return centermsg_setall(strcat(newlines, "^1You have no more lives left\nwait for next round\n\n\n^7press attack to spectate other players"));
+ return centerprint(self, strcat(newlines, "^1You have no more lives left\nwait for next round\n\n\n^7press attack to spectate other players"));
else if(cvar("g_lms") && self.frags == -666)
- return centermsg_setall(strcat(newlines, "^1Match has already begun\nwait for next round\n\n\n^7press attack to spectate other players"));
+ return centerprint(self, strcat(newlines, "^1Match has already begun\nwait for next round\n\n\n^7press attack to spectate other players"));
}
else if(self.classname == "spectator")
{
if ((cvar("g_lms") && self.frags < 1) || cvar("g_arena"))
- return centermsg_setall(strcat(newlines, "spectating ", self.enemy.netname, "\n\n\n^7press attack for next player\npress attack2 for free fly mode"));
+ return centerprint(self, strcat(newlines, "spectating ", self.enemy.netname, "\n\n\n^7press attack for next player\npress attack2 for free fly mode"));
else
- return centermsg_setall(strcat(newlines, "spectating ", self.enemy.netname, "\n\n\n^7press jump to play\n^7press attack for next player\npress attack2 for free fly mode"));
+ return centerprint(self, strcat(newlines, "spectating ", self.enemy.netname, "\n\n\n^7press jump to play\n^7press attack for next player\npress attack2 for free fly mode"));
}
@@ -327,7 +327,7 @@
if(cvar("g_campaign"))
{
- centermsg_setallfor(pl, campaign_message);
+ centerprint(pl, campaign_message);
return;
}
@@ -413,7 +413,7 @@
s = strzone(s);
- centermsg_setallfor(pl, s);
+ centerprint(pl, s);
//sprint(pl, s);
strunzone(s);
@@ -931,6 +931,7 @@
float smallestteam, smallestteam_count, steam;
float lowest_bot_score, lowest_player_score;
entity head, lowest_bot, lowest_player, selected;
+ string m;
smallestteam = 0;
smallestteam_count = 999999999;
@@ -1066,7 +1067,6 @@
if(selected.deadflag == DEAD_NO)
Damage(selected, selected, selected, 100000, DEATH_AUTOTEAMCHANGE, selected.origin, '0 0 0');
- /*
m = "You have been moved into a different team to improve team balance\nYou are now on: ";
if (selected.team == 5)
m = strcat(m, "^1Red Team");
@@ -1077,7 +1077,6 @@
else if (selected.team == 13)
m = strcat(m, "^3Yellow Team");
centerprint(selected, m);
- */
}
// part of g_balance_teams_force
Modified: trunk/data/qcsrc/server/w_nex.qc
===================================================================
--- trunk/data/qcsrc/server/w_nex.qc 2007-01-14 18:57:35 UTC (rev 2112)
+++ trunk/data/qcsrc/server/w_nex.qc 2007-01-14 19:08:54 UTC (rev 2113)
@@ -67,68 +67,67 @@
{
if (self.health == 5)
{
- centermsg_set(CENTERMSG_MINSTAGIB, "you're dead now...");
+ centerprint(self, "you're dead now...\n");
Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0');
stuffcmd(self, "play2 announcer/robotic/terminated.ogg\n");
}
if (self.health == 10)
{
- centermsg_set(CENTERMSG_MINSTAGIB, "^11^7 second left to find some ammo");
+ centerprint(self, "^11^7 second left to find some ammo\n");
Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0');
stuffcmd(self, "play2 announcer/robotic/1.ogg\n");
}
if (self.health == 20)
{
- centermsg_set(CENTERMSG_MINSTAGIB, "^12^7 seconds left to find some ammo");
+ centerprint(self, "^12^7 seconds left to find some ammo\n");
Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
stuffcmd(self, "play2 announcer/robotic/2.ogg\n");
}
if (self.health == 30)
{
- centermsg_set(CENTERMSG_MINSTAGIB, "^13^7 seconds left to find some ammo");
+ centerprint(self, "^13^7 seconds left to find some ammo\n");
Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
stuffcmd(self, "play2 announcer/robotic/3.ogg\n");
}
if (self.health == 40)
{
- centermsg_set(CENTERMSG_MINSTAGIB, "^14^7 seconds left to find some ammo");
+ centerprint(self, "^14^7 seconds left to find some ammo\n");
Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
stuffcmd(self, "play2 announcer/robotic/4.ogg\n");
}
if (self.health == 50)
{
- centermsg_set(CENTERMSG_MINSTAGIB, "^15^7 seconds left to find some ammo");
+ centerprint(self, "^15^7 seconds left to find some ammo\n");
Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
stuffcmd(self, "play2 announcer/robotic/5.ogg\n");
}
if (self.health == 60)
{
- centermsg_set(CENTERMSG_MINSTAGIB, "^36^7 seconds left to find some ammo");
+ centerprint(self, "^36^7 seconds left to find some ammo\n");
Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
stuffcmd(self, "play2 announcer/robotic/6.ogg\n");
}
if (self.health == 70)
{
- centermsg_set(CENTERMSG_MINSTAGIB, "^37^7 seconds left to find some ammo");
+ centerprint(self, "^37^7 seconds left to find some ammo\n");
Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
stuffcmd(self, "play2 announcer/robotic/7.ogg\n");
}
if (self.health == 80)
{
- centermsg_set(CENTERMSG_MINSTAGIB, "^38^7 seconds left to find some ammo");
+ centerprint(self, "^38^7 seconds left to find some ammo\n");
Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
stuffcmd(self, "play2 announcer/robotic/8.ogg\n");
}
if (self.health == 90)
{
- centermsg_set(CENTERMSG_MINSTAGIB, "^39^7 seconds left to find some ammo");
+ centerprint(self, "^39^7 seconds left to find some ammo\n");
Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
stuffcmd(self, "play2 announcer/robotic/9.ogg\n");
}
if (self.health == 100)
{
- centermsg_set(CENTERMSG_MINSTAGIB, "get some ammo or");
- centermsg_set(CENTERMSG_MINSTAGIB2, "you'll be dead in ^310^7 seconds...");
+ centerprint(self, "get some ammo or\nyou'll be dead in ^310^7 seconds...");
Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
stuffcmd(self, "play2 announcer/robotic/10.ogg\n");
}
More information about the nexuiz-commits
mailing list