MCPcopy Create free account
hub / github.com/demoth/jake2 / CMod_LoadLeafs

Method CMod_LoadLeafs

qcommon/src/main/java/jake2/qcommon/CM.java:441–506  ·  view source on GitHub ↗

Loads leafs.

(lump_t l)

Source from the content-addressed store, hash-verified

439
440 /** Loads leafs. */
441 public void CMod_LoadLeafs(lump_t l) {
442 Com.DPrintf("CMod_LoadLeafs()\n");
443 int i;
444 cleaf_t out;
445 qfiles.dleaf_t in;
446 int count;
447
448 if ((l.filelen % qfiles.dleaf_t.SIZE) != 0)
449 Com.Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size");
450
451 count = l.filelen / qfiles.dleaf_t.SIZE;
452
453 if (count < 1)
454 Com.Error(Defines.ERR_DROP, "Map with no leafs");
455
456 // need to save space for box planes
457 if (count > Defines.MAX_MAP_PLANES)
458 Com.Error(Defines.ERR_DROP, "Map has too many planes");
459
460 Com.DPrintf(" numleafes=" + count + "\n");
461
462 numleafs = count;
463 numclusters = 0;
464 if (debugloadmap)
465 Com.DPrintf("cleaf-list:(contents, cluster, area, firstleafbrush, numleafbrushes)\n");
466 for (i = 0; i < count; i++) {
467 in = new qfiles.dleaf_t(cmod_base, i * qfiles.dleaf_t.SIZE
468 + l.fileofs, qfiles.dleaf_t.SIZE);
469
470 out = map_leafs[i];
471
472 out.contents = in.contents;
473 out.cluster = in.cluster;
474 out.area = in.area;
475 out.firstleafbrush = (short) in.firstleafbrush;
476 out.numleafbrushes = (short) in.numleafbrushes;
477
478 if (out.cluster >= numclusters)
479 numclusters = out.cluster + 1;
480
481 if (debugloadmap) {
482 Com.DPrintf("|%8x|%6i|%6i|%6i|\n", new Vargs()
483 .add(out.contents).add(out.cluster).add(out.area).add(
484 out.firstleafbrush).add(out.numleafbrushes));
485 }
486
487 }
488
489 Com.DPrintf(" numclusters=" + numclusters + "\n");
490
491 if (map_leafs[0].contents != Defines.CONTENTS_SOLID)
492 Com.Error(Defines.ERR_DROP, "Map leaf 0 is not CONTENTS_SOLID");
493
494 solidleaf = 0;
495 emptyleaf = -1;
496
497 for (i = 1; i < numleafs; i++) {
498 if (map_leafs[i].contents == 0) {

Callers 1

CM_LoadMapMethod · 0.95

Calls 3

DPrintfMethod · 0.95
ErrorMethod · 0.95
addMethod · 0.45

Tested by

no test coverage detected