MCPcopy Create free account
hub / github.com/JACoders/OpenJK / LoadEALFile

Function LoadEALFile

code/client/snd_dma.cpp:5461–5739  ·  view source on GitHub ↗

Try to load the given .eal file */

Source from the content-addressed store, hash-verified

5459 Try to load the given .eal file
5460*/
5461static bool LoadEALFile(char *szEALFilename)
5462{
5463 char *ealData = NULL;
5464 HRESULT hr;
5465 long i, j, lID, lEnvID;
5466 EMPOINT EMPoint;
5467 char szAperture[128];
5468 char szFullEALFilename[MAX_QPATH];
5469 long lNumInst, lNumInstA, lNumInstB;
5470 bool bLoaded = false;
5471 bool bValid = true;
5472 int result;
5473 char szString[256];
5474
5475 if ((!s_lpEAXManager) || (!s_bEAX))
5476 return false;
5477
5478 if (strstr(szEALFilename, "nomap"))
5479 return false;
5480
5481 s_EnvironmentID = 0xFFFFFFFF;
5482
5483 // Assume there is no aperture information in the .eal file
5484 s_lpEnvTable = NULL;
5485
5486 // Load EAL file from PAK file
5487 result = FS_ReadFile(szEALFilename, (void **)&ealData);
5488
5489 if ((ealData) && (result != -1))
5490 {
5491 hr = s_lpEAXManager->LoadDataSet(ealData, EMFLAG_LOADFROMMEMORY);
5492
5493 // Unload EAL file
5494 FS_FreeFile (ealData);
5495
5496 if (hr == EM_OK)
5497 {
5498 Com_DPrintf("Loaded %s by Quake loader\n", szEALFilename);
5499 bLoaded = true;
5500 }
5501 }
5502 else
5503 {
5504 // Failed to load via Quake loader, try manually
5505 Com_sprintf(szFullEALFilename, MAX_QPATH, "base/%s", szEALFilename);
5506 if (SUCCEEDED(s_lpEAXManager->LoadDataSet(szFullEALFilename, 0)))
5507 {
5508 Com_DPrintf("Loaded %s by EAXManager\n", szEALFilename);
5509 bLoaded = true;
5510 }
5511 }
5512
5513 if (bLoaded)
5514 {
5515 // For a valid eal file ... need to find 'Center' tag, record num of instances, and then find
5516 // the right number of instances of 'Aperture0a' and 'Aperture0b'.
5517
5518 if (s_lpEAXManager->GetSourceID("Center", &lID)==EM_OK)

Callers 1

EALFileInitFunction · 0.70

Calls 6

FS_ReadFileFunction · 0.50
FS_FreeFileFunction · 0.50
Com_DPrintfFunction · 0.50
Com_sprintfFunction · 0.50
Z_MallocFunction · 0.50
Z_FreeFunction · 0.50

Tested by

no test coverage detected