{
if not(isdemo())
{
- localcmd("\n_cl_hook_gamestart ", GametypeNameFromType(gametype), "\n");
+ localcmd("\n_cl_hook_gamestart ", MapInfo_Type_ToString(gametype), "\n");
calledhooks |= HOOK_START;
}
}
{
float i;
self.classname = "ent_client_scores_info";
- gametype = ReadByte();
+ gametype = ReadInt24_t();
for(i = 0; i < MAX_SCORE; ++i)
{
scores_label[i] = strzone(ReadString());
vector p, dir, ang, q, nextdir;
float idx, portal_number, portal1_idx;
- if(activeweapon != WEP_PORTO || spectatee_status || gametype == GAME_NEXBALL)
+ if(activeweapon != WEP_PORTO || spectatee_status || gametype == MAPINFO_TYPE_NEXBALL)
return;
if(intermission == 1)
return;
if(menu_visible)
menu_show();
- /*if(gametype == GAME_CTF)
+ /*if(gametype == MAPINFO_TYPE_CTF)
{
ctf_view();
} else */
//else
{
- if(gametype == GAME_FREEZETAG)
+ if(gametype == MAPINFO_TYPE_FREEZETAG)
{
if(getstati(STAT_FROZEN))
drawfill('0 0 0', eX * vid_conwidth + eY * vid_conheight, '0.25 0.90 1', autocvar_hud_colorflash_alpha, DRAWFLAG_ADDITIVE);
{
// do some accuracy var caching
float i;
- if(!(gametype == GAME_RACE || gametype == GAME_CTS))
+ if(!(gametype == MAPINFO_TYPE_RACE || gametype == MAPINFO_TYPE_CTS))
{
if(autocvar_accuracy_color_levels != acc_color_levels)
{
alsoprint = (autocvar_hud_panel_notify_print || !panel_enabled); // print message to console if: notify panel disabled, or cvar to do so enabled
gentle = (autocvar_cl_gentle || autocvar_cl_gentle_messages);
- if ((msg == MSG_SUICIDE || msg == MSG_KILL || msg == MSG_KILL_ACTION) && gametype == GAME_CTS) // selfkill isn't interesting in CTS and only spams up the notify panel
+ if ((msg == MSG_SUICIDE || msg == MSG_KILL || msg == MSG_KILL_ACTION) && gametype == MAPINFO_TYPE_CTS) // selfkill isn't interesting in CTS and only spams up the notify panel
return;
if(msg == MSG_SUICIDE) {
if(!autocvar__hud_configure)
{
if(!autocvar_hud_panel_score) return;
- if(spectatee_status == -1 && (gametype == GAME_RACE || gametype == GAME_CTS)) return;
+ if(spectatee_status == -1 && (gametype == MAPINFO_TYPE_RACE || gametype == MAPINFO_TYPE_CTS)) return;
}
else
hud_configure_active_panel = HUD_PANEL_SCORE;
if(!autocvar__hud_configure)
{
if(!autocvar_hud_panel_racetimer) return;
- if(!(gametype == GAME_RACE || gametype == GAME_CTS)) return;
+ if(!(gametype == MAPINFO_TYPE_RACE || gametype == MAPINFO_TYPE_CTS)) return;
if(spectatee_status == -1) return;
}
else
void HUD_VoteWindow(void)
{
- if(autocvar_cl_allow_uid2name == -1 && (gametype == GAME_CTS || gametype == GAME_RACE || (serverflags & SERVERFLAG_PLAYERSTATS)))
+ if(autocvar_cl_allow_uid2name == -1 && (gametype == MAPINFO_TYPE_CTS || gametype == MAPINFO_TYPE_RACE || (serverflags & SERVERFLAG_PLAYERSTATS)))
{
vote_active = 1;
if (autocvar__hud_configure)
// clientside personal record
string rr;
- if(gametype == GAME_CTS)
+ if(gametype == MAPINFO_TYPE_CTS)
rr = CTS_RECORD;
else
rr = RACE_RECORD;
if(!autocvar__hud_configure)
{
if(!autocvar_hud_panel_modicons) return;
- if (gametype != GAME_CTF && gametype != GAME_KEYHUNT && gametype != GAME_NEXBALL && gametype != GAME_CTS && gametype != GAME_RACE && gametype != GAME_CA && gametype != GAME_FREEZETAG && gametype != GAME_KEEPAWAY && gametype != GAME_DOMINATION) return;
+ if (gametype != MAPINFO_TYPE_CTF && gametype != MAPINFO_TYPE_KEYHUNT && gametype != MAPINFO_TYPE_NEXBALL && gametype != MAPINFO_TYPE_CTS && gametype != MAPINFO_TYPE_RACE && gametype != MAPINFO_TYPE_CA && gametype != MAPINFO_TYPE_FREEZETAG && gametype != MAPINFO_TYPE_KEEPAWAY && gametype != MAPINFO_TYPE_DOMINATION) return;
}
else
hud_configure_active_panel = HUD_PANEL_MODICONS;
}
// these MUST be ran in order to update mod_active
- if(gametype == GAME_KEYHUNT)
+ if(gametype == MAPINFO_TYPE_KEYHUNT)
HUD_Mod_KH(pos, mySize);
- else if(gametype == GAME_CTF || autocvar__hud_configure)
+ else if(gametype == MAPINFO_TYPE_CTF || autocvar__hud_configure)
HUD_Mod_CTF(pos, mySize); // forcealpha only needed for ctf icons, as only they are shown in config mode
- else if(gametype == GAME_NEXBALL)
+ else if(gametype == MAPINFO_TYPE_NEXBALL)
HUD_Mod_NexBall(pos, mySize);
- else if(gametype == GAME_CTS || gametype == GAME_RACE)
+ else if(gametype == MAPINFO_TYPE_CTS || gametype == MAPINFO_TYPE_RACE)
HUD_Mod_Race(pos, mySize);
- else if(gametype == GAME_CA || gametype == GAME_FREEZETAG)
+ else if(gametype == MAPINFO_TYPE_CA || gametype == MAPINFO_TYPE_FREEZETAG)
HUD_Mod_CA(pos, mySize);
- else if(gametype == GAME_DOMINATION)
+ else if(gametype == MAPINFO_TYPE_DOMINATION)
HUD_Mod_Dom(pos, mySize);
- else if(gametype == GAME_KEEPAWAY)
+ else if(gametype == MAPINFO_TYPE_KEEPAWAY)
HUD_Mod_Keepaway(pos, mySize);
}
s = sprintf(_("^1Press ^3%s^1 for gamemode info"), getcommandkey("server info", "+show_info"));
drawInfoMessage(s)
- if(gametype == GAME_ARENA)
+ if(gametype == MAPINFO_TYPE_ARENA)
s = _("^1Wait for your turn to join");
- else if(gametype == GAME_LMS)
+ else if(gametype == MAPINFO_TYPE_LMS)
{
entity sk;
sk = playerslots[player_localnum];
drawInfoMessage(s)
}
- if(teamplay && !intermission && !spectatee_status && gametype != GAME_CA && teamnagger)
+ if(teamplay && !intermission && !spectatee_status && gametype != MAPINFO_TYPE_CA && teamnagger)
{
float ts_min, ts_max;
tm = teams.sort_next;
{
if(!autocvar_hud_panel_physics) return;
if(spectatee_status == -1 && (autocvar_hud_panel_physics == 1 || autocvar_hud_panel_physics == 3)) return;
- if(autocvar_hud_panel_physics == 3 && !(gametype == GAME_RACE || gametype == GAME_CTS)) return;
+ if(autocvar_hud_panel_physics == 3 && !(gametype == MAPINFO_TYPE_RACE || gametype == MAPINFO_TYPE_CTS)) return;
}
else
hud_configure_active_panel = HUD_PANEL_PHYSICS;
void HUD_Reset (void)
{
// reset gametype specific icons
- if(gametype == GAME_KEYHUNT)
+ if(gametype == MAPINFO_TYPE_KEYHUNT)
HUD_Mod_KH_Reset();
- else if(gametype == GAME_CTF)
+ else if(gametype == MAPINFO_TYPE_CTF)
HUD_Mod_CTF_Reset();
}
return 1;
else if (intermission == 2)
return 0;
- else if (spectatee_status != -1 && getstati(STAT_HEALTH) <= 0 && autocvar_cl_deathscoreboard && gametype != GAME_CTS)
+ else if (spectatee_status != -1 && getstati(STAT_HEALTH) <= 0 && autocvar_cl_deathscoreboard && gametype != MAPINFO_TYPE_CTS)
return 1;
else if (scoreboard_showscores_force)
return 1;
}
}
- if(gametype == GAME_CTS || gametype == GAME_RACE) {
+ if(gametype == MAPINFO_TYPE_CTS || gametype == MAPINFO_TYPE_RACE) {
if(race_speedaward) {
drawcolorcodedstring(pos, sprintf(_("Speed award: %d ^7(%s^7)"), race_speedaward, race_speedaward_holder), hud_fontsize, scoreboard_alpha_fg, DRAWFLAG_NORMAL);
pos_y += 1.25 * hud_fontsize_y;
tl = getstatf(STAT_TIMELIMIT);
fl = getstatf(STAT_FRAGLIMIT);
ll = getstatf(STAT_LEADLIMIT);
- if(gametype == GAME_LMS)
+ if(gametype == MAPINFO_TYPE_LMS)
{
if(tl > 0)
str = strcat(str, sprintf(_(" for up to ^1%1.0f minutes^7"), tl));
// Revision 22: hook shot origin
#define CSQC_REVISION 22
-// probably put these in common/
-// so server/ and client/ can be synced better
-const float GAME_DEATHMATCH = 1;
-const float GAME_TEAM_DEATHMATCH = 2;
-const float GAME_DOMINATION = 3;
-const float GAME_CTF = 4;
-const float GAME_RUNEMATCH = 5;
-const float GAME_LMS = 6;
-const float GAME_ARENA = 7;
-const float GAME_KEYHUNT = 8;
-const float GAME_ASSAULT = 9;
-const float GAME_ONSLAUGHT = 10;
-const float GAME_RACE = 11;
-const float GAME_NEXBALL = 12;
-const float GAME_CTS = 13;
-const float GAME_CA = 14;
-const float GAME_FREEZETAG = 15;
-const float GAME_KEEPAWAY = 16;
-
const float AS_STRING = 1;
const float AS_INT = 2;
const float AS_FLOAT_TRUNCATED = 2;
fclose(fh);
}
-string GametypeNameFromType(float g)
-{
- if (g == GAME_DEATHMATCH) return "dm";
- else if (g == GAME_TEAM_DEATHMATCH) return "tdm";
- else if (g == GAME_DOMINATION) return "dom";
- else if (g == GAME_CTF) return "ctf";
- else if (g == GAME_RUNEMATCH) return "rune";
- else if (g == GAME_LMS) return "lms";
- else if (g == GAME_ARENA) return "arena";
- else if (g == GAME_CA) return "ca";
- else if (g == GAME_KEYHUNT) return "kh";
- else if (g == GAME_ONSLAUGHT) return "ons";
- else if (g == GAME_ASSAULT) return "as";
- else if (g == GAME_RACE) return "rc";
- else if (g == GAME_NEXBALL) return "nexball";
- else if (g == GAME_CTS) return "cts";
- else if (g == GAME_FREEZETAG) return "freezetag";
- else if (g == GAME_KEEPAWAY) return "ka";
- return "dm";
-}
-
string mmsss(float tenths)
{
float minutes;
float isGametypeInFilter(float gt, float tp, float ts, string pattern)
{
string subpattern, subpattern2, subpattern3, subpattern4;
- subpattern = strcat(",", GametypeNameFromType(gt), ",");
+ subpattern = strcat(",", MapInfo_Type_ToString(gt), ",");
if(tp)
subpattern2 = ",teams,";
else
subpattern3 = ",teamspawns,";
else
subpattern3 = ",noteamspawns,";
- if(gt == GAME_RACE || gt == GAME_CTS)
+ if(gt == MAPINFO_TYPE_RACE || gt == MAPINFO_TYPE_CTS)
subpattern4 = ",race,";
else
subpattern4 = string_null;
float mod(float a, float b) { return a - (floor(a / b) * b); }
#endif
-string GametypeNameFromType(float g);
#define TIME_TO_NTHS(t,n) floor((t) * (n) + 0.4)
string mmsss(float t);
string mmssss(float t);
else
s = "";
- for(i = 1; ; ++i) // 20 modes ought to be enough for anyone
+ for(i = 1; ; i *= 2) // 20 modes ought to be enough for anyone
{
- t = GametypeNameFromType(i);
+ t = MapInfo_Type_ToString(i);
if(i > 1)
- if(t == GametypeNameFromType(0)) // it repeats (default case)
+ if(t == "") // it repeats (default case)
{
// no type was found
// choose the first one
- s = t;
+ s = MapInfo_Type_ToString(1);
break;
}
- if(s == GametypeNameFromType(i))
+ if(s == t)
{
// the type was found
// choose the next one
- s = GametypeNameFromType(i + 1);
- if(s == GametypeNameFromType(0))
- s = "";
+ s = MapInfo_Type_ToString(i * 2);
+ if(s == "")
+ s = MapInfo_Type_ToString(1);
break;
}
}
else
stuffcmd(self, "set _teams_available 0\n");
- stuffcmd(self, strcat("set gametype ", ftos(game), "\n"));
-
if(g_arena || g_ca)
{
self.classname = "observer";
//float GAME_FULLBRIGHT_PLAYERS = 64; /// makes the players model fullbright
//float GAME_TEAMS = 128; /// Teams, red/green/yellow/blue
-float game; // set to "gamecfg" on spawnfunc_worldspawn
-
//float POWERUP_STRENGTH_DAMAGE = 2; // damage multiplier for strength powerup
//float POWERUP_STRENGTH_FORCE = 4; // force multiplier for strength powerup
string GetGametype()
{
- return GametypeNameFromType(game);
+ return MapInfo_Type_ToString(MapInfo_LoadedGametype);
}
string getmapname_stored;
{
float i;
WriteByte(MSG_ENTITY, ENT_CLIENT_SCORES_INFO);
- WriteByte(MSG_ENTITY, game);
+ WriteInt24_t(MSG_ENTITY, MapInfo_LoadedGametype);
for(i = 0; i < MAX_SCORE; ++i)
{
WriteString(MSG_ENTITY, scores_label[i]);
float DoesQ3ARemoveThisEntity();
void SV_OnEntityPreSpawnFunction()
{
- if(self.gametypefilter != "")
- if not(isGametypeInFilter(game, teamplay, have_team_spawns, self.gametypefilter))
+ if (self)
+ if (self.gametypefilter != "")
+ if not(isGametypeInFilter(MapInfo_LoadedGametype, teamplay, have_team_spawns, self.gametypefilter))
{
remove(self);
return;
if(g_dm)
{
- game = GAME_DEATHMATCH;
gamemode_name = "Deathmatch";
}
if(g_tdm)
{
- game = GAME_TEAM_DEATHMATCH;
gamemode_name = "Team Deathmatch";
ActivateTeamplay();
tdm_init();
if(g_domination)
{
- game = GAME_DOMINATION;
gamemode_name = "Domination";
ActivateTeamplay();
fraglimit_override = autocvar_g_domination_point_limit;
if(g_ctf)
{
- game = GAME_CTF;
gamemode_name = "Capture the Flag";
ActivateTeamplay();
g_ctf_ignore_frags = autocvar_g_ctf_ignore_frags;
if(g_runematch)
{
- game = GAME_RUNEMATCH;
gamemode_name = "Rune Match";
// ActivateTeamplay();
fraglimit_override = autocvar_g_runematch_point_limit;
if(g_lms)
{
- game = GAME_LMS;
gamemode_name = "Last Man Standing";
fraglimit_override = autocvar_g_lms_lives_override;
leadlimit_override = 0; // not supported by LMS
if(g_arena)
{
- game = GAME_ARENA;
gamemode_name = "Arena";
fraglimit_override = autocvar_g_arena_point_limit;
leadlimit_override = autocvar_g_arena_point_leadlimit;
if(g_ca)
{
- game = GAME_CA;
gamemode_name = "Clan Arena";
ActivateTeamplay();
fraglimit_override = autocvar_g_ca_point_limit;
}
if(g_keyhunt)
{
- game = GAME_KEYHUNT;
gamemode_name = "Key Hunt";
ActivateTeamplay();
fraglimit_override = autocvar_g_keyhunt_point_limit;
if(g_freezetag)
{
- game = GAME_FREEZETAG;
gamemode_name = "Freeze Tag";
ActivateTeamplay();
fraglimit_override = autocvar_g_freezetag_point_limit;
if(g_assault)
{
- game = GAME_ASSAULT;
gamemode_name = "Assault";
ActivateTeamplay();
ScoreRules_assault();
if(g_onslaught)
{
- game = GAME_ONSLAUGHT;
gamemode_name = "Onslaught";
ActivateTeamplay();
have_team_spawns = -1; // request team spawns
if(g_race)
{
- game = GAME_RACE;
gamemode_name = "Race";
if(autocvar_g_race_teams)
if(g_cts)
{
- game = GAME_CTS;
gamemode_name = "CTS";
g_race_qualifying = 1;
fraglimit_override = 0;
if(g_nexball)
{
- game = GAME_NEXBALL;
gamemode_name = "Nexball";
fraglimit_override = autocvar_g_nexball_goallimit;
leadlimit_override = autocvar_g_nexball_goalleadlimit;
if(g_keepaway)
{
- game = GAME_KEEPAWAY;
gamemode_name = "Keepaway";
MUTATOR_ADD(gamemode_keepaway);
}
if(teamplay)
entcs_init();
- // save it (for the next startup)
- cvar_set("gamecfg", ftos(game));
-
cache_mutatormsg = strzone("");
cache_lastmutatormsg = strzone("");