// check for pending announcement, play it and remove it
if(announce_snd != "")
{
- sound(world, CHAN_AUTO, strcat("announcer/", autocvar_cl_announcer, "/", announce_snd, ".wav"), VOL_BASEVOICE, ATTN_NONE);
+ sound(world, CH_INFO, strcat("announcer/", autocvar_cl_announcer, "/", announce_snd, ".wav"), VOL_BASEVOICE, ATTN_NONE);
strunzone(announce_snd);
announce_snd = "";
}
countdown_rounded = floor(0.5 + countdown);
if(countdown <= 0) {
if (!spectatee_status) //do cprint only for players
- centerprint(_("^1Begin!"));
+ centerprint_generic(CPID_GAME_STARTING, _("^1Begin!"), 1, 0);
- sound(world, CHAN_AUTO, strcat("announcer/", autocvar_cl_announcer, "/begin.wav"), VOL_BASEVOICE, ATTN_NONE);
+ sound(world, CH_INFO, strcat("announcer/", autocvar_cl_announcer, "/begin.wav"), VOL_BASEVOICE, ATTN_NONE);
//reset maptime announcers now as well
announcer_5min = announcer_1min = FALSE;
}
else {
if (!spectatee_status) //do cprint only for players
- centerprint(sprintf(_("^1Game starts in %d seconds"), countdown_rounded));
+ centerprint_generic(CPID_GAME_STARTING, _("^1Game starts in %d seconds"), 1, countdown_rounded);
if(countdown_rounded <= 3 && countdown_rounded >= 1) {
- sound(world, CHAN_AUTO, strcat("announcer/", autocvar_cl_announcer, "/", ftos(countdown_rounded), ".wav"), VOL_BASEVOICE, ATTN_NONE);
+ sound(world, CH_INFO, strcat("announcer/", autocvar_cl_announcer, "/", ftos(countdown_rounded), ".wav"), VOL_BASEVOICE, ATTN_NONE);
}
self.nextthink = getstatf(STAT_GAMESTARTTIME) - (countdown - 1);
//if we're in warmup mode, check whether there's a warmup timelimit
if not (warmuplimit == -1 && warmup_stage) {
announcer_5min = TRUE;
- sound(world, CHAN_AUTO, strcat("announcer/", autocvar_cl_announcer, "/5minutesremain.wav"), VOL_BASEVOICE, ATTN_NONE);
+ sound(world, CH_INFO, strcat("announcer/", autocvar_cl_announcer, "/5minutesremain.wav"), VOL_BASEVOICE, ATTN_NONE);
}
}
//if we're in warmup mode, check whether there's a warmup timelimit
if not (warmuplimit == -1 && warmup_stage) {
announcer_1min = TRUE;
- sound(world, CHAN_AUTO, strcat("announcer/", autocvar_cl_announcer, "/1minuteremains.wav"), VOL_BASEVOICE, ATTN_NONE);
+ sound(world, CH_INFO, strcat("announcer/", autocvar_cl_announcer, "/1minuteremains.wav"), VOL_BASEVOICE, ATTN_NONE);
}
}
}
float PreviewExists(string name)
{
- float f;
- string file;
-
if(autocvar_cl_readpicture_force)
return false;
- file = strcat(name, ".tga");
- f = fopen(file, FILE_READ);
- if(f >= 0)
- {
- fclose(f);
- return true;
- }
- file = strcat(name, ".png");
- f = fopen(file, FILE_READ);
- if(f >= 0)
- {
- fclose(f);
- return true;
- }
- file = strcat(name, ".jpg");
- f = fopen(file, FILE_READ);
- if(f >= 0)
- {
- fclose(f);
- return true;
- }
- file = strcat(name, ".pcx");
- f = fopen(file, FILE_READ);
- if(f >= 0)
- {
- fclose(f);
- return true;
- }
+ if (fexists(strcat(name, ".tga"))) return true;
+ if (fexists(strcat(name, ".png"))) return true;
+ if (fexists(strcat(name, ".jpg"))) return true;
+ if (fexists(strcat(name, ".pcx"))) return true;
+
return false;
}
return s;
}
+string Team_ColorCode(float teamid)
+{
+ if (teamid == COLOR_TEAM1)
+ return "^1";
+ else if (teamid == COLOR_TEAM2)
+ return "^4";
+ else if (teamid == COLOR_TEAM3)
+ return "^3";
+ else if (teamid == COLOR_TEAM4)
+ return "^6";
+ else
+ return "^7";
+}
+
+// decolorizes and team colors the player name when needed
+string playername(string thename, float teamid)
+{
+ string t;
+ if (teamplay)
+ {
+ t = Team_ColorCode(teamid);
+ return strcat(t, strdecolorize(thename));
+ }
+ else
+ return strdecolorize(thename);
+}
+
float cvar_or(string cv, float v)
{
string s;
R_EndPolygon();
}
}
+
+const vector GETPLAYERORIGIN_ERROR = '1123581321 2357111317 3141592653'; // way out of bounds for anything on the map
+vector getplayerorigin(float pl)
+{
+ string s;
+ entity e;
+
+ s = getplayerkey(pl, "TEMPHACK_origin");
+ if(s != "")
+ return stov(s);
+
+ e = entcs_receiver[pl];
+ if(e)
+ return e.origin;
+
+ return GETPLAYERORIGIN_ERROR;
+}