From 92790a75c7a87e4d36544374f04c284c1ac13c46 Mon Sep 17 00:00:00 2001 From: div0 Date: Tue, 24 Mar 2009 17:26:57 +0000 Subject: [PATCH] - add a "forbidden" flag to mapinfo that's stronger than hidden, and set it for turret_test and walker_pathtest2 - move gun down by 2 more units when in shootfromcenter mode git-svn-id: svn://svn.icculus.org/nexuiz/trunk@6278 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- data/maps/turret_test.mapinfo | 2 +- data/maps/walker_pathtest2.mapinfo | 11 +++++++++++ data/qcsrc/common/gamecommand.qc | 4 ++-- data/qcsrc/common/mapinfo.qc | 4 ++++ data/qcsrc/common/mapinfo.qh | 1 + data/qcsrc/menu/nexuiz/maplist.c | 4 ++-- data/qcsrc/server/g_world.qc | 18 +++++++++--------- data/qcsrc/server/gamecommand.qc | 8 ++++---- data/qcsrc/server/miscfunctions.qc | 4 ++-- 9 files changed, 36 insertions(+), 20 deletions(-) create mode 100644 data/maps/walker_pathtest2.mapinfo diff --git a/data/maps/turret_test.mapinfo b/data/maps/turret_test.mapinfo index 5072c785d..495c1bbed 100644 --- a/data/maps/turret_test.mapinfo +++ b/data/maps/turret_test.mapinfo @@ -11,4 +11,4 @@ type kh 1000 20 3 // optional: settemp_for_type (all|gametypename) cvarname value // optional: clientsettemp_for_type (all|gametypename) cvarname value // optional: size mins_x mins_y mins_z maxs_x maxs_y maxs_z -hidden +forbidden diff --git a/data/maps/walker_pathtest2.mapinfo b/data/maps/walker_pathtest2.mapinfo new file mode 100644 index 000000000..ec5ec9f27 --- /dev/null +++ b/data/maps/walker_pathtest2.mapinfo @@ -0,0 +1,11 @@ +title +description <DESCRIPTION> +author <AUTHOR> +cdtrack 2 +// uncomment this if you added weapon pickups: has weapons +// optional: fog density red green blue alpha mindist maxdist +// optional: settemp_for_type (all|gametypename) cvarname value +// optional: clientsettemp_for_type (all|gametypename) cvarname value +// optional: size mins_x mins_y mins_z maxs_x maxs_y maxs_z +// optional: hidden +forbidden diff --git a/data/qcsrc/common/gamecommand.qc b/data/qcsrc/common/gamecommand.qc index f219d988c..74703cf26 100644 --- a/data/qcsrc/common/gamecommand.qc +++ b/data/qcsrc/common/gamecommand.qc @@ -126,9 +126,9 @@ float GameCommand_Generic(string command) { MapInfo_Enumerate(); if(cvar("g_maplist_allow_hidden")) - i = 0; + i = MAPINFO_FLAG_FORBIDDEN; else - i = MAPINFO_FLAG_HIDDEN; + i = MAPINFO_FLAG_HIDDEN | MAPINFO_FLAG_FORBIDDEN; MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), 0, i, 0); n = tokenizebyseparator(cvar_string("g_maplist"), " "); s2 = ""; diff --git a/data/qcsrc/common/mapinfo.qc b/data/qcsrc/common/mapinfo.qc index 19db1e59d..1ec2534d0 100644 --- a/data/qcsrc/common/mapinfo.qc +++ b/data/qcsrc/common/mapinfo.qc @@ -657,6 +657,10 @@ float MapInfo_Get_ByName(string pFilename, float pAllowGenerate, float pGametype { MapInfo_Map_flags |= MAPINFO_FLAG_HIDDEN; } + else if(t == "forbidden") + { + MapInfo_Map_flags |= MAPINFO_FLAG_FORBIDDEN; + } else if(t == "type") { t = car(s); s = cdr(s); diff --git a/data/qcsrc/common/mapinfo.qh b/data/qcsrc/common/mapinfo.qh index 636c43b25..c217cbf12 100644 --- a/data/qcsrc/common/mapinfo.qh +++ b/data/qcsrc/common/mapinfo.qh @@ -14,6 +14,7 @@ float MAPINFO_TYPE_ALL = 65535; // this has to include all above bi float MAPINFO_FEATURE_WEAPONS = 1; // not defined for minstagib-only maps float MAPINFO_FLAG_HIDDEN = 1; // not in lsmaps/menu/vcall/etc., can just be changed to manually +float MAPINFO_FLAG_FORBIDDEN = 2; // don't even allow the map by a cvar setting that allows hidden maps float MapInfo_count; diff --git a/data/qcsrc/menu/nexuiz/maplist.c b/data/qcsrc/menu/nexuiz/maplist.c index c9a5d52f3..51f5f4aee 100644 --- a/data/qcsrc/menu/nexuiz/maplist.c +++ b/data/qcsrc/menu/nexuiz/maplist.c @@ -202,7 +202,7 @@ void refilterNexuizMapList(entity me) float gt, f; gt = MapInfo_CurrentGametype(); f = MapInfo_CurrentFeatures(); - MapInfo_FilterGametype(gt, f, 0, MAPINFO_FLAG_HIDDEN, 0); + MapInfo_FilterGametype(gt, f, 0, MAPINFO_FLAG_HIDDEN | MAPINFO_FLAG_FORBIDDEN, 0); me.nItems = MapInfo_count; for(i = 0; i < MapInfo_count; ++i) draw_PreloadPicture(strcat("/maps/", MapInfo_BSPName_ByID(i))); @@ -235,7 +235,7 @@ void MapList_All(entity btn, entity me) { float i; string s; - MapInfo_FilterGametype(MAPINFO_TYPE_ALL, 0, 0, MAPINFO_FLAG_HIDDEN, 0); // all + MapInfo_FilterGametype(MAPINFO_TYPE_ALL, 0, 0, MAPINFO_FLAG_HIDDEN | MAPINFO_FLAG_FORBIDDEN, 0); // all s = ""; for(i = 0; i < MapInfo_count; ++i) s = strcat(s, " ", MapInfo_BSPName_ByID(i)); diff --git a/data/qcsrc/server/g_world.qc b/data/qcsrc/server/g_world.qc index 989b8e65f..5f4095657 100644 --- a/data/qcsrc/server/g_world.qc +++ b/data/qcsrc/server/g_world.qc @@ -146,7 +146,7 @@ void GotoFirstMap() cvar_set("g_maplist_index", ftos(n - 1)); // jump to map 0 in GotoNextMap MapInfo_Enumerate(); - MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), 0, (g_maplist_allow_hidden ? 0 : MAPINFO_FLAG_HIDDEN), 0); + MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), 0, (g_maplist_allow_hidden ? 0 : MAPINFO_FLAG_HIDDEN) | MAPINFO_FLAG_FORBIDDEN, 0); if(!DoNextMapOverride()) GotoNextMap(); @@ -361,7 +361,7 @@ void spawnfunc___init_dedicated_server(void) g_maplist_allow_hidden = cvar("g_maplist_allow_hidden"); MapInfo_Enumerate(); - MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), 0, (g_maplist_allow_hidden ? 0 : MAPINFO_FLAG_HIDDEN), 0); + MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), 0, (g_maplist_allow_hidden ? 0 : MAPINFO_FLAG_HIDDEN) | MAPINFO_FLAG_FORBIDDEN, 0); } void Map_MarkAsRecent(string m); @@ -541,7 +541,7 @@ void spawnfunc_worldspawn (void) orig_slowmo = cvar("slowmo"); MapInfo_Enumerate(); - MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), 0, (g_maplist_allow_hidden ? 0 : MAPINFO_FLAG_HIDDEN), 1); + MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), 0, (g_maplist_allow_hidden ? 0 : MAPINFO_FLAG_HIDDEN) | MAPINFO_FLAG_FORBIDDEN, 1); if(whichpack(strcat("maps/", mapname, ".cfg")) != "") { @@ -599,7 +599,7 @@ void spawnfunc_worldspawn (void) for(i = 0, j = 0; i < MapInfo_count; ++i) { if(MapInfo_Get_ByID(i)) - if not(MapInfo_Map_flags & MAPINFO_FLAG_HIDDEN) + if not(MapInfo_Map_flags & (MAPINFO_FLAG_HIDDEN | MAPINFO_FLAG_FORBIDDEN)) { if(mod(i, 2)) col = "^2"; @@ -905,7 +905,7 @@ void Maplist_Init() if(Map_Count == 0) { bprint( "Maplist is empty! Resetting it to default map list.\n" ); - cvar_set("g_maplist", MapInfo_ListAllowedMaps(0, MAPINFO_FLAG_HIDDEN)); + cvar_set("g_maplist", MapInfo_ListAllowedMaps(0, MAPINFO_FLAG_HIDDEN | MAPINFO_FLAG_FORBIDDEN)); if(cvar("g_maplist_shuffle")) ShuffleMaplist(); localcmd("\nmenu_cmd sync\n"); @@ -1025,7 +1025,7 @@ void GotoNextMap() if(allowReset) { bprint( "Maplist contains no single playable map! Resetting it to default map list.\n" ); - cvar_set("g_maplist", MapInfo_ListAllowedMaps(0, MAPINFO_FLAG_HIDDEN)); + cvar_set("g_maplist", MapInfo_ListAllowedMaps(0, MAPINFO_FLAG_HIDDEN | MAPINFO_FLAG_FORBIDDEN)); if(cvar("g_maplist_shuffle")) ShuffleMaplist(); localcmd("\nmenu_cmd sync\n"); @@ -2059,7 +2059,7 @@ void MapVote_Init() if(mapvote_count == 0) { bprint( "Maplist contains no single playable map! Resetting it to default map list.\n" ); - cvar_set("g_maplist", MapInfo_ListAllowedMaps(0, MAPINFO_FLAG_HIDDEN)); + cvar_set("g_maplist", MapInfo_ListAllowedMaps(0, MAPINFO_FLAG_HIDDEN | MAPINFO_FLAG_FORBIDDEN)); if(cvar("g_maplist_shuffle")) ShuffleMaplist(); localcmd("\nmenu_cmd sync\n"); @@ -2387,7 +2387,7 @@ void MapVote_Start() return; MapInfo_Enumerate(); - if(MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), 0, (g_maplist_allow_hidden ? 0 : MAPINFO_FLAG_HIDDEN), 1)) + if(MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), 0, (g_maplist_allow_hidden ? 0 : MAPINFO_FLAG_HIDDEN) | MAPINFO_FLAG_FORBIDDEN, 1)) mapvote_run = TRUE; } void MapVote_Think() @@ -2526,7 +2526,7 @@ void RestoreGame() // Mapinfo MapInfo_Shutdown(); MapInfo_Enumerate(); - MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), 0, (g_maplist_allow_hidden ? 0 : MAPINFO_FLAG_HIDDEN), 1); + MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), 0, (g_maplist_allow_hidden ? 0 : MAPINFO_FLAG_HIDDEN) | MAPINFO_FLAG_FORBIDDEN, 1); } void SV_Shutdown() diff --git a/data/qcsrc/server/gamecommand.qc b/data/qcsrc/server/gamecommand.qc index e482e9db5..acd81039f 100644 --- a/data/qcsrc/server/gamecommand.qc +++ b/data/qcsrc/server/gamecommand.qc @@ -564,7 +564,7 @@ void make_mapinfo_Think() if(MapInfo_FilterGametype(MAPINFO_TYPE_ALL, 0, 0, 0, 1)) { print("Done rebuiling mapinfos.\n"); - MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), 0, (g_maplist_allow_hidden ? MAPINFO_FLAG_HIDDEN : 0), 0); + MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), 0, (g_maplist_allow_hidden ? MAPINFO_FLAG_HIDDEN : 0) | MAPINFO_FLAG_FORBIDDEN, 0); remove(self); } else @@ -652,17 +652,17 @@ void GameCommand(string command) if(t) { MapInfo_SwitchGameType(t); - MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), 0, MAPINFO_FLAG_HIDDEN, 0); + MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), 0, MAPINFO_FLAG_HIDDEN | MAPINFO_FLAG_FORBIDDEN, 0); if(MapInfo_count > 0) { bprint("Game type successfully switched to ", s, "\n"); - MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), 0, (g_maplist_allow_hidden ? MAPINFO_FLAG_HIDDEN : 0), 0); + MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), 0, (g_maplist_allow_hidden ? MAPINFO_FLAG_HIDDEN : 0) | MAPINFO_FLAG_FORBIDDEN, 0); } else { bprint("Cannot use this game type: no map for it found\n"); MapInfo_SwitchGameType(tsave); - MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), 0, (g_maplist_allow_hidden ? MAPINFO_FLAG_HIDDEN : 0), 0); + MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), 0, (g_maplist_allow_hidden ? MAPINFO_FLAG_HIDDEN : 0) | MAPINFO_FLAG_FORBIDDEN, 0); } } else diff --git a/data/qcsrc/server/miscfunctions.qc b/data/qcsrc/server/miscfunctions.qc index 66d5f497f..231ec10ae 100644 --- a/data/qcsrc/server/miscfunctions.qc +++ b/data/qcsrc/server/miscfunctions.qc @@ -2033,7 +2033,7 @@ vector shotorg_adjust(vector vecs, float y_is_right, float visual) if(visual) { vecs_y = 0; - vecs_z -= 2; + vecs_z -= 4; } else { @@ -2044,7 +2044,7 @@ vector shotorg_adjust(vector vecs, float y_is_right, float visual) else if (cvar("g_shootfromcenter")) { vecs_y = 0; - vecs_z -= 2; + vecs_z -= 4; } return vecs; } -- 2.39.2