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

Function ShowLevelStats

editor/HFile.cpp:664–821  ·  view source on GitHub ↗

Shows the stats for a level in a messagebox, and copies to the clipboard

Source from the content-addressed store, hash-verified

662
663// Shows the stats for a level in a messagebox, and copies to the clipboard
664void ShowLevelStats() {
665 int n_rooms, n_rooms_external, n_faces, n_verts, n_objects, n_portals, n_doors, n_objects_outside;
666 int n_object_faces, n_object_lightmap_faces;
667 int i;
668 room *rp;
669 int bytes_wasted = 0, spec_faces = 0, lm_bytes = 0;
670 int total_volume_bytes = 0;
671 int num_redgoals = 0, num_bluegoals = 0, num_greengoals = 0, num_yellowgoals = 0;
672 int num_sp1 = 0, num_sp2 = 0, num_sp3 = 0, num_sp4 = 0, num_sp5 = 0, num_sp6 = 0;
673
674 uint8_t lightmaps_used[MAX_LIGHTMAPS];
675
676 object *objp;
677#define BUF_LEN 5000
678 char text_buf[BUF_LEN];
679
680 // Count the number of rooms, and the number of faces & points per room
681 n_rooms = n_rooms_external = n_faces = n_verts = n_doors = n_portals = 0;
682 for (i = 0, rp = Rooms; i <= Highest_room_index; i++, rp++)
683 if (rp->used) {
684 n_rooms++;
685 n_verts += rp->num_verts;
686 n_faces += rp->num_faces;
687 n_portals += rp->num_portals;
688 if (rp->flags & RF_EXTERNAL)
689 n_rooms_external++;
690 else {
691 // Get volume size of room
692 total_volume_bytes += GetVolumeSizeOfRoom(rp);
693 }
694
695 for (int t = 0; t < rp->num_faces; t++) {
696 face *fp = &rp->faces[t];
697 if (fp->special_handle != BAD_SPECIAL_FACE_INDEX && GameTextures[fp->tmap].flags & TF_SPECULAR &&
698 fp->lmi_handle != BAD_LMI_INDEX)
699 spec_faces++;
700 }
701
702 if (rp->flags & RF_DOOR)
703 n_doors++;
704
705 if (rp->flags & RF_SPECIAL1)
706 num_sp1++;
707
708 if (rp->flags & RF_SPECIAL2)
709 num_sp2++;
710
711 if (rp->flags & RF_SPECIAL3)
712 num_sp3++;
713
714 if (rp->flags & RF_SPECIAL4)
715 num_sp4++;
716
717 if (rp->flags & RF_SPECIAL5)
718 num_sp5++;
719
720 if (rp->flags & RF_SPECIAL6)
721 num_sp6++;

Callers 1

OnFileStatsMethod · 0.85

Calls 8

GetVolumeSizeOfRoomFunction · 0.85
GetPolymodelPointerFunction · 0.85
lm_dataFunction · 0.85
lm_wFunction · 0.85
lm_hFunction · 0.85
IntSpacingFunction · 0.85
dump_text_to_clipboardFunction · 0.85
OutrageMessageBoxFunction · 0.85

Tested by

no test coverage detected