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

Function ReadPortal

Descent3/LoadLevel.cpp:2163–2199  ·  view source on GitHub ↗

Reads a portal to a disk file Parameters: ifile - file to Read to pp - portal to Read Returns: 1 if written ok, else 0

Source from the content-addressed store, hash-verified

2161// pp - portal to Read
2162// Returns: 1 if written ok, else 0
2163int ReadPortal(CFILE *ifile, portal *pp, int version) {
2164 int i, num_faces;
2165
2166 pp->flags = cf_ReadInt(ifile);
2167
2168 // Kill old trigger flag
2169 if (version < 103)
2170 pp->flags &= ~OLD_PF_HAS_TRIGGER;
2171
2172 if (version < 80) { // read old list of portal verts
2173 int num_verts = cf_ReadShort(ifile);
2174 for (i = 0; i < num_verts; i++)
2175 cf_ReadShort(ifile); // was pp->portal_verts[i]
2176
2177 num_faces = cf_ReadShort(ifile);
2178 ASSERT(num_faces == 1);
2179 }
2180
2181 pp->portal_face = cf_ReadShort(ifile);
2182
2183 pp->croom = cf_ReadInt(ifile);
2184 pp->cportal = cf_ReadInt(ifile);
2185
2186 if (version >= 123)
2187 pp->bnode_index = cf_ReadShort(ifile);
2188 else
2189 pp->bnode_index = -1;
2190
2191 if (version >= 63) {
2192 cf_ReadVector(ifile, &pp->path_pnt);
2193 }
2194
2195 if (version >= 100)
2196 pp->combine_master = cf_ReadInt(ifile);
2197
2198 return 1;
2199}
2200
2201int n_degenerate_faces_removed;
2202

Callers 1

ReadRoomFunction · 0.85

Calls 2

cf_ReadIntFunction · 0.85
cf_ReadShortFunction · 0.85

Tested by

no test coverage detected