else if(WARN_COND)
LOG_WARN("Map ", pFilename, " supports unknown feature ", t, ", ignored");
}
+ else if(t == "locked")
+ {
+ t = car(s); s = cdr(s); f = stof(s);
+ // hide the map based on campaign status
+ if(f > 0)
+ {
+ // we need to have reached this level
+ if(cvar(strcat("g_campaign_", t, "_index")) < f);
+ f |= MAPINFO_FLAG_LOCKED;
+ }
+ else
+ {
+ // we need to have won the campaign
+ if(!cvar(strcat("g_campaign_", t, "_won")));
+ f |= MAPINFO_FLAG_LOCKED;
+ }
+ }
else if(t == "hidden")
{
MapInfo_Map_flags |= MAPINFO_FLAG_HIDDEN;
{
int f = MAPINFO_FLAG_FORBIDDEN;
+#ifdef GAMEQC
+ if (!cvar("g_maplist_allow_locked"))
+#endif
+ f |= MAPINFO_FLAG_LOCKED;
+
#ifdef GAMEQC
if (!cvar("g_maplist_allow_hidden"))
#endif
const int MAPINFO_FEATURE_TURRETS = 4;
const int MAPINFO_FEATURE_MONSTERS = 8;
-const int MAPINFO_FLAG_HIDDEN = 1; // not in lsmaps/menu/vcall/etc., can just be changed to manually
-const int MAPINFO_FLAG_FORBIDDEN = 2; // don't even allow the map by a cvar setting that allows hidden maps
-const int MAPINFO_FLAG_FRUSTRATING = 4; // this map is near impossible to play, enable at your own risk
-const int MAPINFO_FLAG_NOAUTOMAPLIST = 8; // do not include when automatically building maplist (counts as hidden for maplist building purposes)
+const int MAPINFO_FLAG_LOCKED = 1; // same as hidden but unlocked by a campaign
+const int MAPINFO_FLAG_HIDDEN = 2; // not in lsmaps/menu/vcall/etc., can just be changed to manually
+const int MAPINFO_FLAG_FORBIDDEN = 4; // don't even allow the map by a cvar setting that allows hidden maps
+const int MAPINFO_FLAG_FRUSTRATING = 8; // this map is near impossible to play, enable at your own risk
+const int MAPINFO_FLAG_NOAUTOMAPLIST = 16; // do not include when automatically building maplist (counts as hidden for maplist building purposes)
float MapInfo_count;
get_model_parameters_bone_aimweight[i] = 0;
}
get_model_parameters_fixbone = 0;
+ get_model_parameters_locked_name = string_null;
+ get_model_parameters_locked_level = 0;
get_model_parameters_hidden = false;
#ifdef GAMEQC
}
if(c == "fixbone")
get_model_parameters_fixbone = stof(s);
+ if(c == "locked")
+ {
+ get_model_parameters_locked_name = car(s);
+ get_model_parameters_locked_level = stof(cdr(s));
+ }
if(c == "hidden")
get_model_parameters_hidden = stob(s);
}
string get_model_parameters_sex;
float get_model_parameters_weight;
float get_model_parameters_age;
+string get_model_parameters_locked_name; // campaign name
+float get_model_parameters_locked_level; // campaign level
bool get_model_parameters_hidden;
string get_model_parameters_description;
string get_model_parameters_bone_upperbody;
me.configureXonoticImage(me, string_null, -1);
}
+bool XonoticPlayerModelSelector_loadModels_isLocked()
+{
+ bool hidden = false; // hide the player model based on campaign status
+ if(get_model_parameters_locked_name)
+ {
+ if(get_model_parameters_locked_level > 0) // we need to have reached this level
+ hidden = cvar(strcat("g_campaign_", get_model_parameters_locked_name, "_index")) < get_model_parameters_locked_level;
+ else // we need to have won the campaign
+ hidden = !cvar(strcat("g_campaign_", get_model_parameters_locked_name, "_won"));
+ }
+ return hidden;
+}
+
void XonoticPlayerModelSelector_loadModels(entity me)
{
int i;
fn = search_getfilename(glob, i);
if(!get_model_parameters(fn, -1))
continue;
- if(get_model_parameters_hidden)
+ if(get_model_parameters_hidden || XonoticPlayerModelSelector_loadModels_isLocked())
continue;
bufstr_add(sortbuf, sprintf("%-128s%s", get_model_parameters_name, fn), 1);
}
fn = substring(bufstr_get(sortbuf, i), 128, -1);
if(!get_model_parameters(fn, -1))
error("But it JUST worked!");
- if(get_model_parameters_hidden)
+ if(get_model_parameters_hidden || XonoticPlayerModelSelector_loadModels_isLocked())
continue;
bufstr_set(me.bufModels, BUFMODELS_COUNT*i+BUFMODELS_TITLE, get_model_parameters_name);
bufstr_set(me.bufModels, BUFMODELS_COUNT*i+BUFMODELS_IMAGE, strcat("/", substring(get_model_datafilename(get_model_parameters_modelname, get_model_parameters_modelskin, "tga"), 0, -5)));
set g_jump_grunt 0 "Do you make a grunting noise every time you jump? Is it the same grunting noise every time?"
+set g_maplist_allow_locked 1 "allow locked maps to be, e.g., voted for and in the maplist"
set g_maplist_allow_hidden 0 "allow hidden maps to be, e.g., voted for and in the maplist"
set g_maplist_allow_frustrating 0 "allow impossible maps to be, e.g., voted for and in the maplist (if set to 2, ONLY impossible maps are allowed)"