return strcat(m, ".", fil);
}
-float get_model_parameters(string m, float sk)
+float read_model_parameters_file(string m, float sk, bool from_translated_file)
{
- get_model_parameters_modelname = string_null;
- get_model_parameters_modelskin = -1;
- get_model_parameters_name = string_null;
- get_model_parameters_species = -1;
- get_model_parameters_sex = string_null;
- get_model_parameters_weight = -1;
- get_model_parameters_age = -1;
- get_model_parameters_desc = string_null;
- get_model_parameters_bone_upperbody = string_null;
- get_model_parameters_bone_weapon = string_null;
- for(int i = 0; i < MAX_AIM_BONES; ++i)
- {
- get_model_parameters_bone_aim[i] = string_null;
- get_model_parameters_bone_aimweight[i] = 0;
- }
- get_model_parameters_fixbone = 0;
-
-#ifndef MENUQC
- MUTATOR_CALLHOOK(ClearModelParams);
-#endif
-
- if (!m)
- return 1;
-
- if(substring(m, -9, 5) == "_lod1" || substring(m, -9, 5) == "_lod2")
- m = strcat(substring(m, 0, -10), substring(m, -4, -1));
-
- if(sk < 0)
- {
- if(substring(m, -4, -1) != ".txt")
- return 0;
- if(substring(m, -6, 1) != "_")
- return 0;
- sk = stof(substring(m, -5, 1));
- m = substring(m, 0, -7);
- }
-
- string fn = language_filename(get_model_datafilename(m, sk, "txt"));
+ string fn = get_model_datafilename(m, sk, "txt");
+ if(from_translated_file)
+ fn = language_filename(fn);
int fh = fopen(fn, FILE_READ);
if(fh < 0)
{
sk = 0;
- fn = language_filename(get_model_datafilename(m, sk, "txt"));
+ fn = get_model_datafilename(m, sk, "txt");
+ if(from_translated_file)
+ fn = language_filename(fn);
fh = fopen(fn, FILE_READ);
if(fh < 0)
return 0;
s = cdr(s);
if(c == "name")
get_model_parameters_name = s;
+ if(c == "sex")
+ get_model_parameters_sex = s;
+ if(c == "description")
+ get_model_parameters_description = s;
+
+ if(from_translated_file)
+ continue;
+
+ // technical/non-translatable fields start here
if(c == "species")
switch(s)
{
case "animal": get_model_parameters_species = SPECIES_ANIMAL; break;
case "reserved": get_model_parameters_species = SPECIES_RESERVED; break;
}
- if(c == "sex")
- get_model_parameters_sex = s;
if(c == "weight")
get_model_parameters_weight = stof(s);
if(c == "age")
get_model_parameters_age = stof(s);
- if(c == "description")
- get_model_parameters_description = s;
if(c == "bone_upperbody")
get_model_parameters_bone_upperbody = s;
if(c == "bone_weapon")
get_model_parameters_fixbone = stof(s);
}
+ // FIXME
while((s = fgets(fh)))
{
if(get_model_parameters_desc)
return 1;
}
+float get_model_parameters(string m, float sk)
+{
+ get_model_parameters_modelname = string_null;
+ get_model_parameters_modelskin = -1;
+ get_model_parameters_name = string_null;
+ get_model_parameters_species = -1;
+ get_model_parameters_sex = string_null;
+ get_model_parameters_weight = -1;
+ get_model_parameters_age = -1;
+ get_model_parameters_desc = string_null;
+ get_model_parameters_bone_upperbody = string_null;
+ get_model_parameters_bone_weapon = string_null;
+ for(int i = 0; i < MAX_AIM_BONES; ++i)
+ {
+ get_model_parameters_bone_aim[i] = string_null;
+ get_model_parameters_bone_aimweight[i] = 0;
+ }
+ get_model_parameters_fixbone = 0;
+
+#ifndef MENUQC
+ MUTATOR_CALLHOOK(ClearModelParams);
+#endif
+
+ if (!m)
+ return 1;
+
+ if(substring(m, -9, 5) == "_lod1" || substring(m, -9, 5) == "_lod2")
+ m = strcat(substring(m, 0, -10), substring(m, -4, -1));
+
+ if(sk < 0)
+ {
+ if(substring(m, -4, -1) != ".txt")
+ return 0;
+ if(substring(m, -6, 1) != "_")
+ return 0;
+ sk = stof(substring(m, -5, 1));
+ m = substring(m, 0, -7);
+ }
+
+ float ret_value = read_model_parameters_file(m, sk, false);
+ read_model_parameters_file(m, sk, true); // overrides translateble fields
+ return ret_value;
+}
+
// x-encoding (encoding as zero length invisible string)
const string XENCODE_2 = "xX";
const string XENCODE_22 = "0123456789abcdefABCDEF";