Pages in all the necessary bitmaps, textures & sounds for the TelCom so that they are in memory
| 3351 | |
| 3352 | // Pages in all the necessary bitmaps, textures & sounds for the TelCom so that they are in memory |
| 3353 | void TelcomPageAllIn(void) { |
| 3354 | extern void UpdateInitMessage(float amount); // amount is 0 to 1 |
| 3355 | const float TELCOM_SOUND_PORTION = 0.3f, TELCOM_BITMAP_PORTION = 0.3f, TELCOM_TEXTUREHI_PORTION = 0.2f, |
| 3356 | TELCOM_TEXTURELO_PORTION = 0.2f; |
| 3357 | |
| 3358 | int i; |
| 3359 | int count; |
| 3360 | float amount_loaded = 0.0f; |
| 3361 | |
| 3362 | // Page in all sounds |
| 3363 | for (i = 0; i < TCSND_SOUNDCOUNT; i++) { |
| 3364 | int id = FindSoundName(IGNORE_TABLE(TCSoundFiles[i])); |
| 3365 | if (id != -1) { |
| 3366 | Sound_system.CheckAndForceSoundDataAlloc(id); |
| 3367 | amount_loaded += (1.0f * TELCOM_SOUND_PORTION) / (float)TCSND_SOUNDCOUNT; |
| 3368 | if ((i % 4) == 0) { |
| 3369 | UpdateInitMessage(amount_loaded); |
| 3370 | } |
| 3371 | } |
| 3372 | } |
| 3373 | |
| 3374 | // Page in all bitmaps |
| 3375 | count = Telcom_bitmap.w * Telcom_bitmap.h; |
| 3376 | for (i = 0; i < count; i++) { |
| 3377 | bm_data(Telcom_bitmap.bm_array[i], 0); |
| 3378 | UpdateInitMessage(amount_loaded); |
| 3379 | } |
| 3380 | amount_loaded += TELCOM_BITMAP_PORTION; |
| 3381 | |
| 3382 | // Page in all textures |
| 3383 | count = 0; |
| 3384 | while (hilites[count]) { |
| 3385 | i = FindTextureName(IGNORE_TABLE(hilites[count])); |
| 3386 | if (i != -1) { |
| 3387 | PageInTexture(i, false); |
| 3388 | } |
| 3389 | count++; |
| 3390 | } |
| 3391 | amount_loaded += TELCOM_TEXTURELO_PORTION; |
| 3392 | UpdateInitMessage(amount_loaded); |
| 3393 | |
| 3394 | count = 0; |
| 3395 | while (smhilites[count]) { |
| 3396 | i = FindTextureName(IGNORE_TABLE(smhilites[count])); |
| 3397 | if (i != -1) |
| 3398 | PageInTexture(i, false); |
| 3399 | count++; |
| 3400 | } |
| 3401 | |
| 3402 | i = FindTextureName("TelcomPowerbar"); |
| 3403 | if (i != -1) |
| 3404 | PageInTexture(i, false); |
| 3405 | |
| 3406 | amount_loaded += TELCOM_TEXTURELO_PORTION; |
| 3407 | UpdateInitMessage(amount_loaded); |
| 3408 | } |
| 3409 | |
| 3410 | /* |
no test coverage detected