| 480 | bm_DeleteHashTable(); |
| 481 | } |
| 482 | int bm_AllocateMemoryForIndex(int n, int w, int h, int add_mem) { |
| 483 | // If no go on the malloc, bail out with -1 |
| 484 | |
| 485 | int size = (w * h * 2) + (add_mem) + 2; |
| 486 | GameBitmaps[n].data16 = (uint16_t *)mem_malloc(size); |
| 487 | if (!GameBitmaps[n].data16) { |
| 488 | Int3(); // Ran out of memory! |
| 489 | return -1; |
| 490 | } |
| 491 | Bitmap_memory_used += (size); |
| 492 | memset(GameBitmaps[n].data16, 0xAA, size); |
| 493 | |
| 494 | GameBitmaps[n].format = BITMAP_FORMAT_STANDARD; |
| 495 | GameBitmaps[n].width = w; |
| 496 | GameBitmaps[n].height = h; |
| 497 | GameBitmaps[n].flags = BF_CHANGED | BF_BRAND_NEW; |
| 498 | |
| 499 | #ifdef USE_OPENGL |
| 500 | for (int tmp = w; tmp > 0; tmp = tmp >> 1) |
| 501 | GameBitmaps[n].mip_levels++; |
| 502 | #else |
| 503 | GameBitmaps[n].mip_levels = NUM_MIP_LEVELS; |
| 504 | #endif |
| 505 | |
| 506 | Num_of_bitmaps++; |
| 507 | return n; |
| 508 | } |
| 509 | // Allocs a bitmap of w x h size |
| 510 | // If add_mem is nonzero, adds that to the amount alloced |
| 511 | // Returns bitmap handle if successful, -1 if otherwise |
no outgoing calls
no test coverage detected