PropData: Rewrite how BreakModel entries are precached, now that the model line no longer is just a path to a model.
This commit is contained in:
parent
8b15c59ecd
commit
440f4b047f
2 changed files with 30 additions and 2 deletions
|
@ -41,6 +41,12 @@
|
|||
// model path / fadeout time pair
|
||||
// e.g.
|
||||
"foo.vvm" "2.5"
|
||||
|
||||
// but I also added
|
||||
"foo.mdl#9" "5.0"
|
||||
// where the # symbol notes that >9< submodels of the first
|
||||
// submodel group will be chosen at random to represent 1 unit
|
||||
// of the breakmodel collective
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -132,8 +132,6 @@ BreakModel_ParseField(int i, int a)
|
|||
string mdl, fadetime;
|
||||
mdl = argv(0);
|
||||
fadetime = argv(1);
|
||||
precache_model(mdl);
|
||||
print(sprintf("caching breakmodel %s %s\n", mdl, fadetime));
|
||||
g_breakmodel[i].data = sprintf("%s%S %S\n", g_breakmodel[i].data, mdl, fadetime);
|
||||
}
|
||||
};
|
||||
|
@ -436,6 +434,30 @@ PropData_Init(void)
|
|||
}
|
||||
fclose(fh);
|
||||
|
||||
/* now let's precache all of our breakmodel units.
|
||||
first we gotta interate through each cached breakmodel line */
|
||||
for (int i = 0; i < g_breakmodel_count; i++) {
|
||||
float x = tokenize(g_breakmodel[i].data);
|
||||
int r = (int)(x/2);
|
||||
|
||||
/* now we're getting the individual 2-part segments (model, fadetime) */
|
||||
for (int b = 0; b < r; b++) {
|
||||
string mname = argv(b*2);
|
||||
int p = tokenizebyseparator(mname, "#"); /* special submodel character */
|
||||
|
||||
/* either precache the first part, or whole part */
|
||||
if (p == 2) {
|
||||
mname = argv(0);
|
||||
}
|
||||
|
||||
precache_model(mname);
|
||||
NSLog("precaching break model: %S", mname);
|
||||
|
||||
/* gotta tokenize our inputs again */
|
||||
x = tokenize(g_breakmodel[i].data);
|
||||
}
|
||||
}
|
||||
|
||||
print("PropData initialized.\n");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue