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

Function BSPGetMineChecksum

Descent3/bsp.cpp:69–130  ·  view source on GitHub ↗

Goes through all the valid points in the indoor engine and returns a unique checksum

Source from the content-addressed store, hash-verified

67// Goes through all the valid points in the indoor engine and returns a unique
68// checksum
69int BSPGetMineChecksum() {
70 int i, t, k;
71 float total = 0;
72 int checksum;
73
74 for (i = 0; i <= Highest_room_index; i++) {
75 room *rp = &Rooms[i];
76
77 if (!Rooms[i].used)
78 continue;
79
80 if (Rooms[i].flags & RF_EXTERNAL)
81 continue;
82
83 for (t = 0; t < rp->num_faces; t++) {
84 face *fp = &rp->faces[t];
85
86 for (k = 0; k < fp->num_verts; k++) {
87 total += rp->verts[fp->face_verts[k]].x;
88 total += rp->verts[fp->face_verts[k]].y;
89 total += rp->verts[fp->face_verts[k]].z;
90 }
91 }
92 }
93
94 for (t = 0; t <= Highest_object_index; t++) {
95 object *obj = &Objects[t];
96 vector vert;
97
98 if (obj->type == OBJ_NONE)
99 continue;
100
101 if (OBJECT_OUTSIDE(obj))
102 continue;
103
104 if (obj->lighting_render_type == LRT_LIGHTMAPS) {
105 poly_model *po = &Poly_models[obj->rtype.pobj_info.model_num];
106 if (!po->new_style)
107 continue;
108
109 for (k = 0; k < po->n_models; k++) {
110 bsp_info *sm = &po->submodel[k];
111
112 if (IsNonRenderableSubmodel(po, k))
113 continue;
114
115 for (int j = 0; j < sm->num_faces; j++) {
116 for (int x = 0; x < sm->faces[j].nverts; x++) {
117 GetObjectPointInWorld(&vert, obj, k, sm->faces[j].vertnums[x]);
118 total += vert.x;
119 total += vert.y;
120 total += vert.z;
121 }
122 }
123 }
124 }
125 }
126

Callers 1

BuildBSPTreeFunction · 0.85

Calls 2

IsNonRenderableSubmodelFunction · 0.85
GetObjectPointInWorldFunction · 0.85

Tested by

no test coverage detected