]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
unify game type name strings
authorRudolf Polzer <divverent@xonotic.org>
Thu, 29 Dec 2011 11:14:20 +0000 (12:14 +0100)
committerRudolf Polzer <divverent@xonotic.org>
Thu, 29 Dec 2011 11:14:20 +0000 (12:14 +0100)
qcsrc/common/mapinfo.qc
qcsrc/common/mapinfo.qh
qcsrc/menu/xonotic/dialog_multiplayer_create_mapinfo.c
qcsrc/menu/xonotic/gametypelist.c
qcsrc/menu/xonotic/util.qc
qcsrc/menu/xonotic/util.qh
qcsrc/server/teamplay.qc

index 3a72f7387687ae9d942cd2b17f203d91091bbafb..923316652c34189247d927d52e4103840404b11b 100644 (file)
@@ -538,7 +538,7 @@ string _MapInfo_GetDefaultEx(float t)
        entity e;
        for(e = MapInfo_Type_first; e; e = e.enemy)
                if(t == e.weapons)
-                       return e.message;
+                       return e.model2;
        return "";
 }
 
@@ -668,6 +668,15 @@ string MapInfo_Type_ToString(float t)
        return "";
 }
 
+string MapInfo_Type_ToText(float t)
+{
+       entity e;
+       for(e = MapInfo_Type_first; e; e = e.enemy)
+               if(t == e.weapons)
+                       return e.message;
+       return _("@!#%'n Tuba Throwing");
+}
+
 void _MapInfo_Parse_Settemp(string pFilename, string acl, float type, string s, float recurse)
 {
        string t;
index 2524f76bf12e711dbf7e34f029b930f6215c6a15..1fc8bb59f6d6b85fd237181bdd54da371ea32f2a 100644 (file)
@@ -6,9 +6,10 @@ entity MapInfo_Type_last;
 .float weapons; // game type ID
 .string netname; // game type name as in cvar (with g_ prefix)
 .string mdl; // game type short name
-.string message; // game type defaults
+.string message; // human readable name
+.string model2; // game type defaults
 
-#define REGISTER_GAMETYPE(sname,g_name,NAME,defaults) \
+#define REGISTER_GAMETYPE(hname,sname,g_name,NAME,defaults) \
        var float MAPINFO_TYPE_##NAME; \
        var entity MapInfo_Type##g_name; \
        void RegisterGametypes_##g_name() \
@@ -19,7 +20,8 @@ entity MapInfo_Type_last;
                MapInfo_Type##g_name.weapons = MAPINFO_TYPE_##NAME; \
                MapInfo_Type##g_name.netname = #g_name; \
                MapInfo_Type##g_name.mdl = #sname; \
-               MapInfo_Type##g_name.message = defaults; \
+               MapInfo_Type##g_name.message = hname; \
+               MapInfo_Type##g_name.model2 = defaults; \
                if(!MapInfo_Type_first) \
                        MapInfo_Type_first = MapInfo_Type##g_name; \
                if(MapInfo_Type_last) \
@@ -31,52 +33,52 @@ entity MapInfo_Type_last;
 #define IS_GAMETYPE(NAME) \
        (MapInfo_LoadedGametype == MAPINFO_TYPE_##NAME)
 
-REGISTER_GAMETYPE(dm,g_dm,DEATHMATCH,"timelimit=20 pointlimit=30 leadlimit=0")
+REGISTER_GAMETYPE(_("Deathmatch"),dm,g_dm,DEATHMATCH,"timelimit=20 pointlimit=30 leadlimit=0")
 #define g_dm IS_GAMETYPE(DEATHMATCH)
 
-REGISTER_GAMETYPE(lms,g_lms,LMS,"timelimit=20 lives=9 leadlimit=0")
+REGISTER_GAMETYPE(_("Last Man Standing"),lms,g_lms,LMS,"timelimit=20 lives=9 leadlimit=0")
 #define g_lms IS_GAMETYPE(LMS)
 
-REGISTER_GAMETYPE(arena,g_arena,ARENA,"timelimit=20 pointlimit=10 leadlimit=0")
+REGISTER_GAMETYPE(_("Arena"),arena,g_arena,ARENA,"timelimit=20 pointlimit=10 leadlimit=0")
 #define g_arena IS_GAMETYPE(ARENA)
 
-REGISTER_GAMETYPE(rune,g_runematch,RUNEMATCH,"timelimit=20 pointlimit=200 leadlimit=0")
+REGISTER_GAMETYPE(_("Runematch"),rune,g_runematch,RUNEMATCH,"timelimit=20 pointlimit=200 leadlimit=0")
 #define g_runematch IS_GAMETYPE(RUNEMATCH)
 
-REGISTER_GAMETYPE(rc,g_race,RACE,"timelimit=20 qualifying_timelimit=5 laplimit=7 teamlaplimit=15 leadlimit=0")
+REGISTER_GAMETYPE(_("Race"),rc,g_race,RACE,"timelimit=20 qualifying_timelimit=5 laplimit=7 teamlaplimit=15 leadlimit=0")
 #define g_race IS_GAMETYPE(RACE)
 
-REGISTER_GAMETYPE(cts,g_cts,CTS,"timelimit=20 skill=-1")
+REGISTER_GAMETYPE(_("Race CTS"),cts,g_cts,CTS,"timelimit=20 skill=-1")
 #define g_cts IS_GAMETYPE(CTS)
 
-REGISTER_GAMETYPE(tdm,g_tdm,TEAM_DEATHMATCH,"timelimit=20 pointlimit=50 teams=2 leadlimit=0")
+REGISTER_GAMETYPE(_("Team Deathmatch"),tdm,g_tdm,TEAM_DEATHMATCH,"timelimit=20 pointlimit=50 teams=2 leadlimit=0")
 #define g_tdm IS_GAMETYPE(TEAM_DEATHMATCH)
 
-REGISTER_GAMETYPE(ctf,g_ctf,CTF,"timelimit=20 pointlimit=300 caplimit=10 leadlimit=0")
+REGISTER_GAMETYPE(_("Capture the Flag"),ctf,g_ctf,CTF,"timelimit=20 pointlimit=300 caplimit=10 leadlimit=0")
 #define g_ctf IS_GAMETYPE(CTF)
 
-REGISTER_GAMETYPE(ca,g_ca,CA,"timelimit=20 pointlimit=10 leadlimit=0")
+REGISTER_GAMETYPE(_("Clan Arena"),ca,g_ca,CA,"timelimit=20 pointlimit=10 leadlimit=0")
 #define g_ca IS_GAMETYPE(CA)
 
-REGISTER_GAMETYPE(dom,g_domination,DOMINATION,"timelimit=20 pointlimit=200 teams=2 leadlimit=0")
+REGISTER_GAMETYPE(_("Domination"),dom,g_domination,DOMINATION,"timelimit=20 pointlimit=200 teams=2 leadlimit=0")
 #define g_domination IS_GAMETYPE(DOMINATION)
 
-REGISTER_GAMETYPE(kh,g_keyhunt,KEYHUNT,"timelimit=20 pointlimit=1000 teams=3 leadlimit=0")
+REGISTER_GAMETYPE(_("Key Hunt"),kh,g_keyhunt,KEYHUNT,"timelimit=20 pointlimit=1000 teams=3 leadlimit=0")
 #define g_keyhunt IS_GAMETYPE(KEYHUNT)
 
-REGISTER_GAMETYPE(as,g_assault,ASSAULT,"timelimit=20")
+REGISTER_GAMETYPE(_("Assault"),as,g_assault,ASSAULT,"timelimit=20")
 #define g_assault IS_GAMETYPE(ASSAULT)
 
-REGISTER_GAMETYPE(ons,g_onslaught,ONSLAUGHT,"timelimit=20")
+REGISTER_GAMETYPE(_("Onslaught"),ons,g_onslaught,ONSLAUGHT,"timelimit=20")
 #define g_onslaught IS_GAMETYPE(ONSLAUGHT)
 
-REGISTER_GAMETYPE(nexball,g_nexball,NEXBALL,"timelimit=20 pointlimit=5 leadlimit=0")
+REGISTER_GAMETYPE(_("Nexball"),nexball,g_nexball,NEXBALL,"timelimit=20 pointlimit=5 leadlimit=0")
 #define g_nexball IS_GAMETYPE(NEXBALL)
 
-REGISTER_GAMETYPE(freezetag,g_freezetag,FREEZETAG,"timelimit=20 pointlimit=10 teams=2 leadlimit=0")
+REGISTER_GAMETYPE(_("Freeze Tag"),freezetag,g_freezetag,FREEZETAG,"timelimit=20 pointlimit=10 teams=2 leadlimit=0")
 #define g_freezetag IS_GAMETYPE(FREEZETAG)
 
-REGISTER_GAMETYPE(keepaway,g_keepaway,KEEPAWAY,"timelimit=20 pointlimit=30")
+REGISTER_GAMETYPE(_("Keepaway"),keepaway,g_keepaway,KEEPAWAY,"timelimit=20 pointlimit=30")
 #define g_keepaway IS_GAMETYPE(KEEPAWAY)
 
 float MAPINFO_FEATURE_WEAPONS       = 1; // not defined for minstagib-only maps
@@ -140,6 +142,7 @@ string MapInfo_ListAllAllowedMaps(float pFlagsRequired, float pFlagsForbidden);
 // gets a gametype from a string
 float MapInfo_Type_FromString(string t);
 string MapInfo_Type_ToString(float t);
+string MapInfo_Type_ToText(float t);
 void MapInfo_SwitchGameType(float t);
 
 // to be called from worldspawn to set up cvars
index e242b6667546e5576444ccee6fa668908693be3f..31ea3e084bbe8f67623e7bd3f2c3bf1fa4922267 100644 (file)
@@ -103,7 +103,7 @@ void XonoticMapInfoDialog_fill(entity me)
                        me.TR(me);
                        me.TDempty(me, 0.2);
                }
-               me.TD(me, 1, wgt, e = makeXonoticTextLabel(0, GameType_GetName(i)));
+               me.TD(me, 1, wgt, e = makeXonoticTextLabel(0, MapInfo_Type_ToText(GameType_GetID(i))));
                        me.(typeLabels[i]) = e;
        }
 
index ec21c65b97c4fd6b6be2466c96a922c5e89b3bef..cbc239946a70112b25f1818756dbf930b4c63a2a 100644 (file)
@@ -70,7 +70,7 @@ void XonoticGametypeList_drawListBoxItem(entity me, float i, vector absSize, flo
        string s;
        if(isSelected)
                draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
-       s = GameType_GetName(i);
+       s = MapInfo_Type_ToText(GameType_GetID(i));
        draw_Text(me.realUpperMargin * eY + (me.columnNameOrigin + (me.columnNameSize - draw_TextWidth(s, 0, me.realFontSize)) * 0.5) * eX, s, me.realFontSize, '1 1 1', SKINALPHA_TEXT, 0);
 }
 void XonoticGametypeList_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
index b8215d52cac6c97150ea863fa05c7dd885d02a25..74fe810fe74759d9d015e69f1248c4207e4cb8a4 100644 (file)
@@ -543,47 +543,38 @@ float updateCompression()
 
 // note: include only those that should be in the menu!
 #define GAMETYPES \
-       GAMETYPE(MAPINFO_TYPE_ARENA, _("Arena")) \
-       GAMETYPE(MAPINFO_TYPE_ASSAULT, _("Assault")) \
-       GAMETYPE(MAPINFO_TYPE_CTF, _("Capture The Flag")) \
-       GAMETYPE(MAPINFO_TYPE_CA, _("Clan Arena")) \
-       GAMETYPE(MAPINFO_TYPE_DEATHMATCH, _("Deathmatch")) \
-       GAMETYPE(MAPINFO_TYPE_DOMINATION, _("Domination")) \
-       GAMETYPE(MAPINFO_TYPE_FREEZETAG, _("Freeze Tag")) \
-       GAMETYPE(MAPINFO_TYPE_KEEPAWAY, _("Keepaway")) \
-       GAMETYPE(MAPINFO_TYPE_KEYHUNT, _("Key Hunt")) \
-       GAMETYPE(MAPINFO_TYPE_LMS, _("Last Man Standing")) \
-       GAMETYPE(MAPINFO_TYPE_NEXBALL, _("Nexball")) \
-       GAMETYPE(MAPINFO_TYPE_ONSLAUGHT, _("Onslaught")) \
-       GAMETYPE(MAPINFO_TYPE_RACE, _("Race")) \
-       GAMETYPE(MAPINFO_TYPE_CTS, _("Race CTS")) \
-       GAMETYPE(MAPINFO_TYPE_RUNEMATCH, _("Runematch")) \
-       GAMETYPE(MAPINFO_TYPE_TEAM_DEATHMATCH, _("Team Deathmatch")) \
+       GAMETYPE(MAPINFO_TYPE_ARENA) \
+       GAMETYPE(MAPINFO_TYPE_ASSAULT) \
+       GAMETYPE(MAPINFO_TYPE_CTF) \
+       GAMETYPE(MAPINFO_TYPE_CA) \
+       GAMETYPE(MAPINFO_TYPE_DEATHMATCH) \
+       GAMETYPE(MAPINFO_TYPE_DOMINATION) \
+       GAMETYPE(MAPINFO_TYPE_FREEZETAG) \
+       GAMETYPE(MAPINFO_TYPE_KEEPAWAY) \
+       GAMETYPE(MAPINFO_TYPE_KEYHUNT) \
+       GAMETYPE(MAPINFO_TYPE_LMS) \
+       GAMETYPE(MAPINFO_TYPE_NEXBALL) \
+       GAMETYPE(MAPINFO_TYPE_ONSLAUGHT) \
+       GAMETYPE(MAPINFO_TYPE_RACE) \
+       GAMETYPE(MAPINFO_TYPE_CTS) \
+       GAMETYPE(MAPINFO_TYPE_RUNEMATCH) \
+       GAMETYPE(MAPINFO_TYPE_TEAM_DEATHMATCH) \
        /* nothing */
 
 float GameType_GetID(float cnt)
 {
        float i;
        i = 0;
-#define GAMETYPE(id,name) if(i++ == cnt) return id;
+#define GAMETYPE(id) if(i++ == cnt) return id;
        GAMETYPES
 #undef GAMETYPE
        return 0;
 }
-string GameType_GetName(float cnt)
-{
-       float i;
-       i = 0;
-#define GAMETYPE(id,name) if(i++ == cnt) return name;
-       GAMETYPES
-#undef GAMETYPE
-       return _("@!#%'n Tuba Throwing");
-}
 float GameType_GetCount()
 {
        float i;
        i = 0;
-#define GAMETYPE(id,name) ++i;
+#define GAMETYPE(id) ++i;
        GAMETYPES
 #undef GAMETYPE
        return i;
index d8f66f4e967ec242cafb3da865da541619a2ac9f..6165fb3606b945968910c437bf76732d931c3ad5 100644 (file)
@@ -37,7 +37,6 @@ void URI_Get_Callback(float id, float status, string data);
 // game type list box stuff (does not NEED to contain all game types, other
 // types stay available via console)
 float GameType_GetID(float cnt);
-string GameType_GetName(float cnt);
 float GameType_GetCount();
 
 void dialog_hudpanel_common_notoggle(entity me, string panelname);
index cfadcf69966712b98c79f74372ac2f2e9bbc3fd7..52bab5d9d0669550cec63f053a2492698d22136a 100644 (file)
@@ -132,15 +132,14 @@ void InitGameplayMode()
        timelimit_override = autocvar_timelimit_override;
        fraglimit_override = autocvar_fraglimit_override;
        leadlimit_override = autocvar_leadlimit_override;
+       gamemode_name = MapInfo_Type_ToText(MapInfo_LoadedGametype);
 
        if(g_dm)
        {
-               gamemode_name = "Deathmatch";
        }
 
        if(g_tdm)
        {
-               gamemode_name = "Team Deathmatch";
                ActivateTeamplay();
                tdm_init();
                if(autocvar_g_tdm_team_spawns)
@@ -149,7 +148,6 @@ void InitGameplayMode()
 
        if(g_domination)
        {
-               gamemode_name = "Domination";
                ActivateTeamplay();
                fraglimit_override = autocvar_g_domination_point_limit;
                leadlimit_override = autocvar_g_domination_point_leadlimit;
@@ -159,7 +157,6 @@ void InitGameplayMode()
 
        if(g_ctf)
        {
-               gamemode_name = "Capture the Flag";
                ActivateTeamplay();
                g_ctf_ignore_frags = autocvar_g_ctf_ignore_frags;
                if(g_ctf_win_mode == 2)
@@ -178,7 +175,6 @@ void InitGameplayMode()
 
        if(g_runematch)
        {
-               gamemode_name = "Rune Match";
                // ActivateTeamplay();
                fraglimit_override = autocvar_g_runematch_point_limit;
                leadlimit_override = autocvar_g_runematch_point_leadlimit;
@@ -187,7 +183,6 @@ void InitGameplayMode()
 
        if(g_lms)
        {
-               gamemode_name = "Last Man Standing";
                fraglimit_override = autocvar_g_lms_lives_override;
                leadlimit_override = 0; // not supported by LMS
                if(fraglimit_override == 0)
@@ -199,7 +194,6 @@ void InitGameplayMode()
 
        if(g_arena)
        {
-               gamemode_name = "Arena";
                fraglimit_override = autocvar_g_arena_point_limit;
                leadlimit_override = autocvar_g_arena_point_leadlimit;
                maxspawned = autocvar_g_arena_maxspawned;
@@ -210,7 +204,6 @@ void InitGameplayMode()
 
        if(g_ca)
        {
-               gamemode_name = "Clan Arena";
                ActivateTeamplay();
                fraglimit_override = autocvar_g_ca_point_limit;
                leadlimit_override = autocvar_g_ca_point_leadlimit;
@@ -219,7 +212,6 @@ void InitGameplayMode()
        }
        if(g_keyhunt)
        {
-               gamemode_name = "Key Hunt";
                ActivateTeamplay();
                fraglimit_override = autocvar_g_keyhunt_point_limit;
                leadlimit_override = autocvar_g_keyhunt_point_leadlimit;
@@ -228,7 +220,6 @@ void InitGameplayMode()
 
        if(g_freezetag)
        {
-               gamemode_name = "Freeze Tag";
                ActivateTeamplay();
                fraglimit_override = autocvar_g_freezetag_point_limit;
                leadlimit_override = autocvar_g_freezetag_point_leadlimit;
@@ -237,7 +228,6 @@ void InitGameplayMode()
 
        if(g_assault)
        {
-               gamemode_name = "Assault";
                ActivateTeamplay();
                ScoreRules_assault();
                have_team_spawns = -1; // request team spawns
@@ -245,14 +235,12 @@ void InitGameplayMode()
 
        if(g_onslaught)
        {
-               gamemode_name = "Onslaught";
                ActivateTeamplay();
                have_team_spawns = -1; // request team spawns
        }
 
        if(g_race)
        {
-               gamemode_name = "Race";
 
                if(autocvar_g_race_teams)
                {
@@ -270,7 +258,6 @@ void InitGameplayMode()
 
        if(g_cts)
        {
-               gamemode_name = "CTS";
                g_race_qualifying = 1;
                fraglimit_override = 0;
                leadlimit_override = 0;
@@ -278,7 +265,6 @@ void InitGameplayMode()
 
        if(g_nexball)
        {
-               gamemode_name = "Nexball";
                fraglimit_override = autocvar_g_nexball_goallimit;
                leadlimit_override = autocvar_g_nexball_goalleadlimit;
                ActivateTeamplay();
@@ -288,7 +274,6 @@ void InitGameplayMode()
 
        if(g_keepaway)
        {
-               gamemode_name = "Keepaway";
                MUTATOR_ADD(gamemode_keepaway);
        }