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

Method CMod_LoadPlanes

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

Loads planes.

(lump_t l)

Source from the content-addressed store, hash-verified

507
508 /** Loads planes. */
509 public void CMod_LoadPlanes(lump_t l) {
510 Com.DPrintf("CMod_LoadPlanes()\n");
511 int i, j;
512 cplane_t out;
513 qfiles.dplane_t in;
514 int count;
515 int bits;
516
517 if ((l.filelen % qfiles.dplane_t.SIZE) != 0)
518 Com.Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size");
519
520 count = l.filelen / qfiles.dplane_t.SIZE;
521
522 if (count < 1)
523 Com.Error(Defines.ERR_DROP, "Map with no planes");
524
525 // need to save space for box planes
526 if (count > Defines.MAX_MAP_PLANES)
527 Com.Error(Defines.ERR_DROP, "Map has too many planes");
528
529 Com.DPrintf(" numplanes=" + count + "\n");
530
531 numplanes = count;
532 if (debugloadmap) {
533 Com
534 .DPrintf("cplanes(normal[0],normal[1],normal[2], dist, type, signbits)\n");
535 }
536
537 for (i = 0; i < count; i++) {
538 in = new qfiles.dplane_t(ByteBuffer.wrap(cmod_base, i
539 * qfiles.dplane_t.SIZE + l.fileofs, qfiles.dplane_t.SIZE));
540
541 out = map_planes[i];
542
543 bits = 0;
544 for (j = 0; j < 3; j++) {
545 out.normal[j] = in.normal[j];
546
547 if (out.normal[j] < 0)
548 bits |= 1 << j;
549 }
550
551 out.dist = in.dist;
552 out.type = (byte) in.type;
553 out.signbits = (byte) bits;
554
555 if (debugloadmap) {
556 Com.DPrintf("|%6.2f|%6.2f|%6.2f| %10.2f|%3i| %1i|\n",
557 new Vargs().add(out.normal[0]).add(out.normal[1]).add(
558 out.normal[2]).add(out.dist).add(out.type).add(
559 out.signbits));
560 }
561 }
562 }
563
564 /** Loads leaf brushes. */
565 public void CMod_LoadLeafBrushes(lump_t l) {

Callers 1

CM_LoadMapMethod · 0.95

Calls 3

DPrintfMethod · 0.95
ErrorMethod · 0.95
addMethod · 0.45

Tested by

no test coverage detected