diff --git a/src/shared/propdata.h b/src/shared/propdata.h index e78a216f..4b7bd840 100644 --- a/src/shared/propdata.h +++ b/src/shared/propdata.h @@ -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 } } } diff --git a/src/shared/propdata.qc b/src/shared/propdata.qc index d5e6301d..12310a09 100644 --- a/src/shared/propdata.qc +++ b/src/shared/propdata.qc @@ -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"); }