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

Method CM_LoadMap

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

Loads in the map and all submodels.

(String name, boolean clientload, int[] checksum)

Source from the content-addressed store, hash-verified

185 * Loads in the map and all submodels.
186 */
187 public cmodel_t CM_LoadMap(String name, boolean clientload, int[] checksum) {
188 Com.DPrintf("CM_LoadMap(" + name + ")...\n");
189 byte buf[];
190 qfiles.dheader_t header;
191 int length;
192
193 map_noareas = Cvar.getInstance().Get("map_noareas", "0", 0);
194
195 if (map_name.equals(name)
196 && (clientload || 0 == Cvar.getInstance().VariableValue("flushmap"))) {
197
198 checksum[0] = last_checksum;
199
200 if (!clientload) {
201 Arrays.fill(portalopen, false);
202 FloodAreaConnections();
203 }
204 return map_cmodels[0]; // still have the right version
205 }
206
207 // free old stuff
208 numnodes = 0;
209 numleafs = 0;
210 numcmodels = 0;
211 numvisibility = 0;
212 numentitychars = 0;
213 map_entitystring = "";
214 map_name = "";
215
216 if (name == null || name.length() == 0) {
217 numleafs = 1;
218 numclusters = 1;
219 numareas = 1;
220 checksum[0] = 0;
221 return map_cmodels[0];
222 // cinematic servers won't have anything at all
223 }
224
225 //
226 // load the file
227 //
228 buf = FS.LoadFile(name);
229
230 if (buf == null)
231 Com.Error(Defines.ERR_DROP, "Couldn't load " + name);
232
233 length = buf.length;
234
235 ByteBuffer bbuf = ByteBuffer.wrap(buf);
236
237 last_checksum = MD4.Com_BlockChecksum(buf, length);
238 checksum[0] = last_checksum;
239
240 header = new qfiles.dheader_t(bbuf.slice());
241
242 if (header.version != Defines.BSPVERSION)
243 Com.Error(Defines.ERR_DROP, "CMod_LoadBrushModel: " + name
244 + " has wrong version number (" + header.version

Callers 5

LoadBspFileMethod · 0.95
CLClass · 0.80
RequestNextDownloadMethod · 0.80
GameImportsImplMethod · 0.80
mainMethod · 0.80

Calls 15

DPrintfMethod · 0.95
getInstanceMethod · 0.95
FloodAreaConnectionsMethod · 0.95
LoadFileMethod · 0.95
ErrorMethod · 0.95
Com_BlockChecksumMethod · 0.95
CMod_LoadSurfacesMethod · 0.95
CMod_LoadLeafsMethod · 0.95
CMod_LoadLeafBrushesMethod · 0.95
CMod_LoadPlanesMethod · 0.95
CMod_LoadBrushesMethod · 0.95
CMod_LoadBrushSidesMethod · 0.95

Tested by 1

mainMethod · 0.64