Try to load the given .eal file */
| 5459 | Try to load the given .eal file |
| 5460 | */ |
| 5461 | static 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) |
no test coverage detected