MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / ReadNewModelFile

Function ReadNewModelFile

model/polymodel.cpp:1270–2052  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1268}
1269
1270int ReadNewModelFile(int polynum, CFILE *infile) {
1271 int version, done = 0, i, t, version_major;
1272 int id, len;
1273 poly_model *pm = &Poly_models[polynum];
1274 int timed = 0;
1275
1276 ASSERT(pm->new_style);
1277
1278 id = cf_ReadInt(infile);
1279
1280 if (id != 'OPSP')
1281 Error("Bad ID in model file!");
1282
1283 // Version is major*100+minor
1284 // So, major = version / 100;
1285 // minor = version % 100;
1286
1287 version = cf_ReadInt(infile);
1288 if (version < 18) {
1289 mprintf(0, "Old POF Version of %d fixed up to %d\n", version, version * 100);
1290 version *= 100;
1291 }
1292
1293 if (version < PM_COMPATIBLE_VERSION || version > PM_OBJFILE_VERSION) {
1294 mprintf(0, "Bad version (%d) in model file!\n", version);
1295 Int3();
1296 return 0;
1297 }
1298
1299 pm->version = version;
1300 version_major = version / 100;
1301
1302 if (version_major >= 21)
1303 pm->flags |= PMF_LIGHTMAP_RES;
1304 if (version_major >= 22) {
1305 timed = 1;
1306 pm->flags |= PMF_TIMED;
1307 pm->frame_min = 0;
1308 pm->frame_max = 0;
1309 }
1310
1311 pm->n_attach = 0;
1312
1313 memset(&pm->view_pos, 0, sizeof(pm->view_pos));
1314
1315 while (!done) {
1316 if (cfeof(infile)) {
1317 done = 1;
1318 continue;
1319 }
1320
1321 id = cf_ReadInt(infile);
1322 len = cf_ReadInt(infile);
1323
1324 switch (id) {
1325 case ID_OHDR: {
1326 // Object header
1327

Callers 2

LoadPolyModelFunction · 0.85
PageInPolymodelFunction · 0.85

Calls 15

cf_ReadIntFunction · 0.85
ErrorFunction · 0.85
cfeofFunction · 0.85
cf_ReadFloatFunction · 0.85
ReadModelVectorFunction · 0.85
vm_MakeZeroFunction · 0.85
ReadModelStringLenFunction · 0.85
SetPolymodelPropertiesFunction · 0.85
cftellFunction · 0.85
cf_ReadBytesFunction · 0.85
cfseekFunction · 0.85
cf_ReadByteFunction · 0.85

Tested by

no test coverage detected