13 #define BMPMAN_INTERNAL
49 #define EFF_FILENAME_CHECK { if ( be->type == BM_TYPE_EFF ) strcpy_s( filename, be->info.ani.eff.filename ); else strcpy_s( filename, be->filename ); }
69 const char *
bm_ext_list[] = {
".dds",
".tga",
".png",
".jpg",
".pcx" };
89 static int bm_inited = 0;
90 static uint Bm_next_signature = 0x1234;
91 static int bm_next_handle = 1;
92 static int Bm_low_mem = 0;
101 static int Bm_max_ram = 0;
103 static int Bm_ignore_duplicates = 0;
104 static int Bm_ignore_load_count = 0;
134 if ( Bitmap_data != NULL ) {
141 return Bitmap_data != NULL;
144 float bitmap_lookup::map_texture_address(
float address)
147 return address - floorf(address);
152 Assert( Bitmap_data != NULL );
157 int x =
fl2i(map_texture_address(u) * (Width-1));
158 int y =
fl2i(map_texture_address(v) * (Height-1));
160 return i2fl(Bitmap_data[(y*Width + x)*Num_channels]) / 255.0f;
165 Assert( Bitmap_data != NULL );
170 int x =
fl2i(map_texture_address(u) * (Width-1));
171 int y =
fl2i(map_texture_address(v) * (Height-1));
173 return i2fl(Bitmap_data[(y*Width + x)*Num_channels + 1]) / 255.0f;
178 Assert( Bitmap_data != NULL );
180 int x =
fl2i(map_texture_address(u) * (Width-1));
181 int y =
fl2i(map_texture_address(v) * (Height-1));
183 return i2fl(Bitmap_data[(y*Width + x)*Num_channels + 2]) / 255.0f;
188 Assert( Bitmap_data != NULL );
190 int x =
fl2i(map_texture_address(u) * (Width-1));
191 int y =
fl2i(map_texture_address(v) * (Height-1));
193 return i2fl(Bitmap_data[(y*Width + x)*Num_channels + 3]) / 255.0f;
204 static void bm_free_data(
int n,
bool release =
false);
213 static void bm_free_data_fast(
int n);
222 static int bm_load_sub_slow(
const char *real_filename,
const int num_ext,
const char **ext_list,
CFILE **img_cfp = NULL,
int dir_type =
CF_TYPE_ANY);
230 static int bm_load_sub_fast(
const char *real_filename,
int *handle,
int dir_type =
CF_TYPE_ANY,
bool animated_type =
false);
238 static int find_block_of(
int n);
243 DCF(bm_frag,
"Shows BmpMan fragmentation") {
245 dc_printf(
"Displays a graphic showing the BmpMan fragmentation. Color key:\n");
248 dc_printf(
"\tGreen : USER, TGA, PNG, DDS, other\n");
251 dc_printf(
"Once done reviewing the graphic, press any key to return to the console\n");
262 switch (bm_bitmaps[
i].
type) {
296 DCF(bm_used,
"Shows BmpMan Slot Usage") {
298 dc_printf(
"Displays used bmpman slots usage with a breakdown per filetype\n\n");
302 int none = 0, pcx = 0, user = 0, tga = 0, png = 0;
int jpg = 0, dds = 0, ani = 0;
303 int eff = 0, eff_dds = 0, eff_tga = 0, eff_png = 0, eff_jpg = 0, eff_pcx = 0;
304 int render_target_dynamic = 0, render_target_static = 0;
307 switch (bm_bitmaps[
i].
type) {
335 switch (bm_bitmaps[
i].info.ani.eff.
type) {
352 Warning(
LOCATION,
"Unhandled EFF image type (%i), get a coder!", bm_bitmaps[i].info.ani.eff.
type);
357 render_target_static++;
360 render_target_dynamic++;
363 Warning(
LOCATION,
"Unhandled image type (%i), get a coder!", bm_bitmaps[i].type);
369 text <<
"BmpMan Used Slots\n";
370 text <<
" " << std::dec << std::setw(4) << std::setfill(
'0') << pcx <<
", PCX\n";
371 text <<
" " << std::dec << std::setw(4) << std::setfill(
'0') << user <<
", User\n";
372 text <<
" " << std::dec << std::setw(4) << std::setfill(
'0') << tga <<
", TGA\n";
373 text <<
" " << std::dec << std::setw(4) << std::setfill(
'0') << png <<
", PNG\n";
374 text <<
" " << std::dec << std::setw(4) << std::setfill(
'0') << jpg <<
", JPG\n";
375 text <<
" " << std::dec << std::setw(4) << std::setfill(
'0') << dds <<
", DDS\n";
376 text <<
" " << std::dec << std::setw(4) << std::setfill(
'0') << ani <<
", ANI\n";
377 text <<
" " << std::dec << std::setw(4) << std::setfill(
'0') << eff <<
", EFF\n";
378 text <<
" " << std::dec << std::setw(4) << std::setfill(
'0') << eff_dds <<
", EFF/DDS\n";
379 text <<
" " << std::dec << std::setw(4) << std::setfill(
'0') << eff_tga <<
", EFF/TGA\n";
380 text <<
" " << std::dec << std::setw(4) << std::setfill(
'0') << eff_png <<
", EFF/PNG\n";
381 text <<
" " << std::dec << std::setw(4) << std::setfill(
'0') << eff_jpg <<
", EFF/JPG\n";
382 text <<
" " << std::dec << std::setw(4) << std::setfill(
'0') << eff_pcx <<
", EFF/PCX\n";
383 text <<
" " << std::dec << std::setw(4) << std::setfill(
'0') << render_target_static <<
", Render/Static\n";
384 text <<
" " << std::dec << std::setw(4) << std::setfill(
'0') << render_target_dynamic <<
", Render/Dynamic\n";
385 text <<
" " << std::dec << std::setw(4) << std::setfill(
'0') << MAX_BITMAPS-none <<
"/" << MAX_BITMAPS <<
", Total\n";
389 mprintf((
"%s", text.str().c_str()));
394 DCF(bmpman,
"Shows/changes bitmap caching parameters and usage") {
396 dc_printf(
"Usage: BmpMan [arg]\nWhere arg can be any of the following:\n");
397 dc_printf(
"\tflush Unloads all bitmaps.\n");
398 dc_printf(
"\tram [x] Sets max mem usage to x MB. (Set to 0 to have no limit.)\n");
399 dc_printf(
"\t? Displays status of Bitmap manager.\n");
406 if (Bm_max_ram > 1024 * 1024) {
407 dc_printf(
"\tMax RAM allowed: %.1f MB\n",
i2fl(Bm_max_ram) / (1024.0
f*1024.0
f));
408 }
else if (Bm_max_ram > 1024) {
409 dc_printf(
"\tMax RAM allowed: %.1f KB\n",
i2fl(Bm_max_ram) / (1024.0
f));
410 }
else if (Bm_max_ram > 0) {
411 dc_printf(
"\tMax RAM allowed: %d bytes\n", Bm_max_ram);
431 if (Bm_max_ram > 0) {
432 dc_printf(
"BmpMan limited to %i, MB's\n", Bm_max_ram);
433 Bm_max_ram *= 1024 * 1024;
434 }
else if (Bm_max_ram == 0) {
435 dc_printf(
"!!BmpMan memory is unlimited!!\n");
437 dc_printf(
"Illegal value. Must be non-negative.");
440 dc_printf(
"<BmpMan> No argument given\n");
444 DCF(bmpslots,
"Writes bitmap slot info to fs2_open.log") {
447 dc_printf(
"\tWrites bitmap slot info to fs2_open.log\n");
473 Assert((bpp == 16) || (bpp == 24) || (bpp == 32));
506 bm_bitmaps[
n].
bm.
w = (short)w;
507 bm_bitmaps[
n].
bm.
h = (short)h;
518 bm_bitmaps[
n].
signature = Bm_next_signature++;
522 bm_bitmaps[
n].
mem_taken = (w * h * (bpp >> 3));
544 if (flags & BMP_AABITMAP)
552 for (idx = 0; idx<bmp->
w*bmp->
h; idx++) {
563 void bm_free_data(
int n,
bool release)
584 if ( be->data_size != 0 )
592 if (bmp->
data == 0) {
594 if ( be->data_size != 0 )
623 void bm_free_data_fast(
int n)
642 if ( be->data_size != 0 )
650 if (bmp->
data == 0) {
652 if ( be->data_size != 0 ) {
673 Assert(bm_bitmaps[n].handle == bitmap_id);
721 if (!(((
unsigned short*)pixel)[0] & 0x8000)) {
731 Assert(bm_bitmaps[n].handle == handle);
737 strcpy(filename,
"");
746 strcpy(filename, bm_bitmaps[n].filename);
757 if ((bm_bitmaps[i].
type !=
BM_TYPE_NONE) && (bm_bitmaps[i].used_this_frame)) {
758 if (!bm_bitmaps[i].used_last_frame) {
759 *nnew += (
int)bm_bitmaps[i].mem_taken;
761 *ntotal += (
int)bm_bitmaps[i].mem_taken;
763 bm_bitmaps[
i].used_last_frame = bm_bitmaps[
i].used_this_frame;
764 bm_bitmaps[
i].used_this_frame = 0;
772 if (!bm_inited)
return -1;
777 if (bm_bitmaps[bitmapnum].handle != handle) {
778 mprintf((
"bm_get_info - %s: bm_bitmaps[%d].handle = %d, handle = %d\n", bm_bitmaps[bitmapnum].
filename, bitmapnum, bm_bitmaps[bitmapnum].handle, handle));
782 Assertion(bm_bitmaps[bitmapnum].handle == handle,
"Invalid bitmap handle %d passed to bm_get_info().\nThis might be due to an invalid animation somewhere else.\n", handle);
784 if ((bm_bitmaps[bitmapnum].
type ==
BM_TYPE_NONE) || (bm_bitmaps[bitmapnum].handle != handle)) {
787 if (flags) *flags = 0;
788 if (nframes) *nframes = 0;
793 bmp = &(bm_bitmaps[bitmapnum].
bm);
797 if (flags) *flags = bmp->
flags;
830 if ((bm_next_handle + 1) > INT_MAX /
MAX_BITMAPS) {
832 mprintf((
"BMPMAN: bitmap handles wrapped back to 1\n"));
835 return bm_next_handle;
842 Assert(num == bm_bitmaps[n].handle);
844 if (bm_bitmaps[n].num_mipmaps == 0)
855 Assert(bm_bitmaps[n].handle == handle);
860 strcpy(name, filename);
873 Assertion(bm_bitmaps[bitmapnum].handle == handle,
"Invalid bitmap handle %d passed to bm_get_signature().\nThis might be due to an invalid animation somewhere else.\n", handle);
882 Assert(handle == bm_bitmaps[n].handle);
898 Assertion(bm_bitmaps[bitmapnum].handle == handle,
"Invalid bitmap handle %d passed to bm_get_type().\nThis might be due to an invalid animation somewhere else.\n", handle);
900 return bm_bitmaps[bitmapnum].
type;
907 Assert(handle == bm_bitmaps[n].handle);
913 return (bm_bitmaps[n].bm.true_bpp == 32);
919 mprintf((
"Size of bitmap info = " SIZE_T_ARG " KB\n",
sizeof(bm_bitmaps) / 1024));
939 bm_bitmaps[
i].data_size = 0;
940 bm_bitmaps[
i].used_count = 0;
941 bm_bitmaps[
i].used_last_frame = 0;
942 bm_bitmaps[
i].used_this_frame = 0;
961 Assert(num == bm_bitmaps[n].handle);
997 Assert(bitmap_id == bm_bitmaps[n].handle);
1003 return bm_bitmaps[
n].
type;
1009 if (!bm_inited)
return 0;
1010 if (handle < 0)
return 0;
1012 return (bm_bitmaps[handle %
MAX_BITMAPS].handle == handle);
1033 int dds_error =
dds_read_header(filename, img_cfp, w, h, bpp, &dds_ct, mm_lvl, size);
1074 Error(
LOCATION,
"Bad DDS file compression! Not using DXT1,3,5: %s", filename);
1082 mprintf((
"tga: Couldn't open '%s'\n", filename));
1090 mprintf((
"png: Couldn't open '%s'\n", filename));
1098 mprintf((
"jpg: Couldn't open '%s'\n", filename));
1106 mprintf((
"pcx: Couldn't open '%s'\n", filename));
1111 Assertion(
false,
"Unknown file type specified! This is probably a coding error.");
1120 int i, free_slot = -1;
1123 int bm_size = 0, mm_lvl = 0;
1127 CFILE *img_cfp = NULL;
1134 if ((real_filename == NULL) || (strlen(real_filename) <= 0))
1140 char *
p = strrchr(filename,
'.');
1142 mprintf((
"Someone passed an extension to bm_load for file '%s'\n", real_filename));
1150 strcpy_s(filename, standalone_filename);
1156 Warning(
LOCATION,
"Passed filename, '%s', is too long to support an extension!!\n\nMaximum length, minus the extension, is %i characters.\n", filename,
MAX_FILENAME_LEN - 5);
1163 if (bm_load_sub_fast(filename, &handle))
1186 if (free_slot < 0) {
1187 Assertion(free_slot < 0,
"Could not find free BMPMAN slot for bitmap: %s", real_filename);
1191 rc = bm_load_info(type, free_slot, filename, img_cfp, &w, &h, &bpp, &c_type, &mm_lvl, &bm_size);
1196 if ((bm_size <= 0) && (w) && (h) && (bpp))
1197 bm_size = (w * h * (bpp >> 3));
1203 memset(&bm_bitmaps[free_slot], 0,
sizeof(
bitmap_entry));
1209 bm_bitmaps[free_slot].
comp_type = c_type;
1210 bm_bitmaps[free_slot].
signature = Bm_next_signature++;
1211 bm_bitmaps[free_slot].
bm.
w = (short)w;
1212 bm_bitmaps[free_slot].
bm.
rowsize = (short)w;
1213 bm_bitmaps[free_slot].
bm.
h = (short)h;
1214 bm_bitmaps[free_slot].
bm.
bpp = 0;
1216 bm_bitmaps[free_slot].
bm.
flags = 0;
1217 bm_bitmaps[free_slot].
bm.
data = 0;
1218 bm_bitmaps[free_slot].
bm.
palette = NULL;
1220 bm_bitmaps[free_slot].
mem_taken = (size_t)bm_size;
1223 bm_bitmaps[free_slot].
handle = handle;
1229 if (img_cfp != NULL)
1236 return bm_load(filename.c_str());
1240 int frames = 0, fps = 30, keyframe = 0;
1243 char file_text[1024];
1244 char file_text_raw[1024];
1246 memset(ext, 0,
sizeof(ext));
1247 memset(file_text, 0,
sizeof(file_text));
1248 memset(file_text_raw, 0,
sizeof(file_text_raw));
1273 mprintf((
"BMPMAN: Unable to parse '%s'! Error message = %s.\n", filename, e.what()));
1292 mprintf((
"BMPMAN: Unknown file type in EFF parse!\n"));
1298 mprintf((
"BMPMAN: EFF parse ERROR!\n"));
1321 static int bm_load_image_data(
const char *filename,
int handle,
int bitmapnum,
ubyte bpp,
ubyte flags,
bool nodebug)
1337 if (bmp->
data == 0) {
1342 nprintf((
"BmpMan",
"Loading %s for the first time.\n", be->
filename));
1347 nprintf((
"Paging",
"Loading %s (%dx%dx%d)\n", be->
filename, bmp->
w, bmp->
h, true_bpp));
1351 if (flags & BMP_AABITMAP)
1369 bm_lock_pcx(handle, bitmapnum, be, bmp, true_bpp, flags);
1373 bm_lock_ani(handle, bitmapnum, be, bmp, true_bpp, flags);
1377 bm_lock_tga(handle, bitmapnum, be, bmp, true_bpp, flags);
1382 bm_lock_png(handle, bitmapnum, be, bmp, true_bpp, flags);
1386 bm_lock_jpg(handle, bitmapnum, be, bmp, true_bpp, flags);
1397 bm_lock_dds(handle, bitmapnum, be, bmp, true_bpp, flags);
1401 bm_lock_user(handle, bitmapnum, be, bmp, true_bpp, flags);
1423 CFILE *img_cfp = NULL;
1426 int anim_fps = 0, anim_frames = 0,
key = 0;
1427 int anim_width = 0, anim_height = 0;
1429 int bpp = 0, mm_lvl = 0, img_size = 0;
1447 char *
p = strchr(filename,
'.');
1449 mprintf((
"Someone passed an extension to bm_load_animation for file '%s'\n", real_filename));
1457 strcpy_s(filename, standalone_filename);
1463 Warning(
LOCATION,
"Passed filename, '%s', is too long to support an extension!!\n\nMaximum length, minus the extension, is %i characters.\n", filename,
MAX_FILENAME_LEN - 5);
1475 if (bm_load_sub_fast(filename, &handle, dir_type,
true)) {
1477 Assert(bm_bitmaps[n].handle == handle);
1492 int rval = bm_load_sub_slow(filename, BM_ANI_NUM_TYPES, bm_ani_ext_list, &img_cfp, dir_type);
1497 strcat_s(filename, bm_ani_ext_list[rval]);
1498 type = bm_ani_type_list[rval];
1507 Warning(
LOCATION,
"Passed filename, '%s', is too long to support an extension and frames!!\n\nMaximum length for an ANI/EFF, minus the extension, is %i characters.\n", filename,
MAX_FILENAME_LEN - 10);
1514 mprintf((
"BMPMAN: Error reading EFF\n"));
1517 mprintf((
"BMPMAN: Found EFF (%s) with %d frames at %d fps.\n", filename, anim_frames, anim_fps));
1529 anim_fps = the_anim.
fps;
1530 anim_width = the_anim.
width;
1531 anim_height = the_anim.
height;
1533 img_size = (anim_width * anim_height * bpp);
1541 for (i = 0; i<the_anim.
num_keys; i++) {
1552 the_anim.
keys =
nullptr;
1559 if (Bm_low_mem == 1) {
1561 anim_frames = (anim_frames + 1) / 2;
1562 anim_fps = (anim_fps / 2);
1563 }
else if (Bm_low_mem == 2) {
1569 n = find_block_of(anim_frames);
1572 if (img_cfp != NULL)
1580 for (i = 0; i < anim_frames; i++) {
1585 sprintf(bm_bitmaps[n + i].info.ani.eff.
filename,
"%s_%.4d", clean_name, i);
1588 if (bm_load_info(eff_type, n + i, bm_bitmaps[n + i].info.ani.eff.
filename, NULL, &anim_width, &anim_height, &bpp, &c_type, &mm_lvl, &img_size)) {
1591 Warning(
LOCATION,
"EFF: No frame images were found. EFF, %s, is invalid.\n", filename);
1593 if (img_cfp != NULL)
1599 Warning(
LOCATION,
"EFF: Unable to load all frames for '%s', stopping at #%d\n", filename, i);
1605 for (
int j = 0; j<anim_frames; j++)
1606 bm_bitmaps[n + j].info.ani.num_frames = anim_frames;
1611 if ((img_size <= 0) && (anim_width) && (anim_height) && (bpp)) {
1612 img_size = (anim_width * anim_height * (bpp >> 3));
1620 bm_bitmaps[n +
i].
bm.
w = (short)anim_width;
1621 bm_bitmaps[n +
i].
bm.
rowsize = (short)anim_width;
1622 bm_bitmaps[n +
i].
bm.
h = (short)anim_height;
1624 bm_bitmaps[n +
i].
bm.
w /= 2;
1626 bm_bitmaps[n +
i].
bm.
h /= 2;
1629 bm_bitmaps[n +
i].
bm.
bpp = 0;
1631 bm_bitmaps[n +
i].
bm.
data = 0;
1636 bm_bitmaps[n +
i].
signature = Bm_next_signature++;
1640 bm_bitmaps[n +
i].
mem_taken = (size_t)img_size;
1646 sprintf(bm_bitmaps[n + i].filename,
"%s", filename);
1648 sprintf(bm_bitmaps[n + i].filename,
"%s[%d]", filename, i);
1654 *nframes = anim_frames;
1659 if (img_cfp != NULL)
1672 Bm_ignore_duplicates = 1;
1678 Bm_ignore_duplicates = 0;
1684 if (nframes != NULL)
1688 int tidx =
bm_load_animation(filename, nframes, fps, keyframe, can_drop_frames, dir_type);
1691 if (tidx != -1 && nframes != NULL)
1698 int bm_load_sub_fast(
const char *real_filename,
int *handle,
int dir_type,
bool animated_type) {
1699 if (Bm_ignore_duplicates)
1708 if (bm_bitmaps[i].dir_type != dir_type)
1713 if (animated_type && !animated)
1715 else if (!animated_type && animated)
1718 if (!
strextcmp(real_filename, bm_bitmaps[i].filename)) {
1719 nprintf((
"BmpFastLoad",
"Found bitmap %s -- number %d\n", bm_bitmaps[i].filename, i));
1721 *handle = bm_bitmaps[
i].
handle;
1730 int bm_load_sub_slow(
const char *real_filename,
const int num_ext,
const char **ext_list,
CFILE **img_cfp,
int dir_type) {
1732 int size = 0,
offset = 0;
1738 if ((rval < 0) || (rval >= num_ext))
1744 if (img_cfp != NULL)
1762 Assertion(bm_bitmaps[bitmapnum].handle == handle,
"Invalid handle %d passed to bm_lock. This might be due to an animation elsewhere in the code being too short.\n", handle);
1765 if (flags & BMP_AABITMAP)
1775 if (flags & BMP_AABITMAP) {
1792 be = &bm_bitmaps[bitmapnum];
1806 #ifdef BMPMAN_NDEBUG
1807 if (be->used_this_frame < 255) {
1808 be->used_this_frame++;
1813 if (bm_load_image_data(be->
filename, handle, bitmapnum, bpp, flags, nodebug) == -1) {
1839 #ifdef BMPMAN_NDEBUG
1841 bm_bitmaps[first +
i].used_count++;
1850 #ifdef BMPMAN_NDEBUG
1866 int first_frame, nframes;
1871 if ((the_anim =
anim_load(bm_bitmaps[first_frame].filename, bm_bitmaps[first_frame].dir_type)) == NULL) {
1882 int can_drop_frames = 0;
1885 can_drop_frames = 1;
1888 bm = &bm_bitmaps[first_frame].
bm;
1889 size = bm->
w * bm->
h * (bpp >> 3);
1894 for (i = 0; i<nframes; i++) {
1895 be = &bm_bitmaps[first_frame +
i];
1896 bm = &bm_bitmaps[first_frame +
i].
bm;
1899 bm_free_data(first_frame + i);
1920 fix u, utmp,
v, du, dv;
1927 for (h = 0; h < bm->
h; h++) {
1928 ubyte *drow = &dptr[bm->
w *
h];
1933 for (w = 0; w < bm->
w; w++) {
1934 *drow++ = srow[
f2i(utmp)];
1943 fix u, utmp,
v, du, dv;
1950 for (h = 0; h < bm->
h; h++) {
1951 unsigned short *drow = &((
unsigned short*)dptr)[bm->
w *
h];
1952 unsigned short *srow = &((
unsigned short*)sptr)[
f2i(v)*the_anim->
width];
1956 for (w = 0; w < bm->
w; w++) {
1957 *drow++ = srow[
f2i(utmp)];
1965 memcpy(dptr, sptr, size);
1968 bm_convert_format(bm, flags);
1971 if ((i < nframes - 1) && can_drop_frames) {
1987 bm_free_data(bitmapnum);
2005 #if BYTE_ORDER == BIG_ENDIAN
2010 if (dds_bpp == 32) {
2011 unsigned int *swap_tmp;
2013 for (i = 0; i < be->
mem_taken; i += 4) {
2014 swap_tmp = (
unsigned int *)(data + i);
2017 }
else if (dds_bpp == 16) {
2018 unsigned short *swap_tmp;
2020 for (i = 0; i < be->
mem_taken; i += 2) {
2021 swap_tmp = (
unsigned short *)(data + i);
2033 bm_free_data(bitmapnum);
2037 #ifdef BMPMAN_NDEBUG
2038 Assert(be->data_size > 0);
2049 bm_free_data(bitmapnum);
2051 d_size = (bpp >> 3);
2075 bm_free_data(bitmapnum);
2079 #ifdef BMPMAN_NDEBUG
2080 Assert(be->data_size > 0);
2090 bm_free_data(bitmapnum);
2100 #ifdef BMPMAN_NDEBUG
2101 Assert(be->data_size > 0);
2105 Assert(!((flags & BMP_AABITMAP) && (flags & BMP_TEX_ANY)));
2114 mprintf((
"Couldn't load PCX!!! (%s)\n", filename));
2118 #ifdef BMPMAN_NDEBUG
2119 Assert(be->data_size > 0);
2124 bm_convert_format(bmp, flags);
2135 bm_free_data(bitmapnum);
2142 d_size = bmp->
bpp >> 3;
2147 memset(data, 0, bmp->
w * bmp->
h * d_size);
2161 bm_free_data(bitmapnum);
2165 #ifdef BMPMAN_NDEBUG
2166 Assert(be->data_size > 0);
2172 int d_size, byte_size;
2176 bm_free_data(bitmapnum);
2181 Assert((bpp == 16) || (bpp == 24) || (bpp == 32));
2185 byte_size = (bpp >> 3);
2204 #ifdef BMPMAN_NDEBUG
2205 Assert(be->data_size > 0);
2217 bm_free_data(bitmapnum);
2223 bm_convert_format(bmp, flags);
2228 bm_free_data(bitmapnum);
2230 if ((bpp != be->
info.
user.
bpp) && !(flags & BMP_AABITMAP))
2253 Assert(flags & BMP_AABITMAP);
2264 bm_convert_format(bmp, flags);
2279 for (n = -1, i = MAX_BITMAPS - 1; i >= 0; i--) {
2297 size = (w * h * (bpp >> 3));
2301 size += (size / 3) - 1;
2314 bm_bitmaps[
n].
signature = Bm_next_signature++;
2315 sprintf(bm_bitmaps[n].filename,
"RT_%dx%d+%d", w, h, bpp);
2316 bm_bitmaps[
n].
bm.
w = (short)w;
2317 bm_bitmaps[
n].
bm.
h = (short)h;
2332 if (bm_bitmaps[n].mem_taken) {
2340 Assert((n >= 0) && (n < MAX_BITMAPS));
2345 #ifdef BMPMAN_NDEBUG
2346 Assert(bm_bitmaps[n].data_size == 0);
2347 bm_bitmaps[
n].data_size +=
size;
2361 Assert(bm_bitmaps[n].handle == bitmapnum);
2363 for (i = 0; i<nframes; i++) {
2379 if (!Cmdline_cache_bitmaps && (bm_bitmaps[i].type !=
BM_TYPE_NONE)) {
2384 #ifdef BMPMAN_NDEBUG
2385 bm_bitmaps[
i].used_count = 0;
2400 nprintf((
"BmpInfo",
"BMPMAN: Loading all used bitmaps.\n"));
2405 int bm_preloading = 1;
2409 if (bm_bitmaps[i].preloaded) {
2410 if (bm_preloading) {
2411 if (!
gr_preload(bm_bitmaps[i].handle, (bm_bitmaps[i].preloaded == 2))) {
2412 mprintf((
"Out of VRAM. Done preloading.\n"));
2416 bm_lock(bm_bitmaps[i].handle, (bm_bitmaps[i].used_flags == BMP_AABITMAP) ? 8 : 16, bm_bitmaps[i].used_flags);
2417 if (bm_bitmaps[i].ref_count >= 1) {
2426 if ((bm_bitmaps[i].info.ani.first_frame == 0) || (bm_bitmaps[i].
info.
ani.
first_frame == i)) {
2428 memset(busy_text, 0,
sizeof(busy_text));
2430 strcat_s(busy_text,
"** BmpMan: ");
2431 strcat_s(busy_text, bm_bitmaps[i].filename);
2445 nprintf((
"BmpInfo",
"BMPMAN: Loaded %d bitmaps that are marked as used for this level.\n", n));
2447 int total_bitmaps = 0;
2453 mprintf((
"User bitmap '%s'\n", bm_bitmaps[i].filename));
2457 mprintf((
"Bmpman: %d/%d bitmap slots in use.\n", total_bitmaps, MAX_BITMAPS));
2469 Assertion((bm_bitmaps[n].handle == bitmapnum),
"bitmapnum = %i, n = %i, bm_bitmaps[n].handle = %i", bitmapnum, n, bm_bitmaps[n].handle);
2478 for (i = 0; i < nframes; i++) {
2486 switch (bm_bitmaps[n + i].comp_type) {
2521 Assert(bm_bitmaps[n].handle == bitmapnum);
2523 for (i = 0; i < nframes; i++) {
2531 switch (bm_bitmaps[n + i].comp_type) {
2563 Assert(handle == bm_bitmaps[n].handle);
2571 if (bm_bitmaps[n].preload_count > 0) {
2573 "PAGE-OUT: %s - preload_count remaining: %d\n",
2574 bm_bitmaps[n].filename,
2575 bm_bitmaps[n].preload_count));
2587 #ifdef BMPMAN_NDEBUG
2592 if (bm_bitmaps[i].data_size) {
2593 nprintf((
"BMP DEBUG",
"BMPMAN = num: %d, name: %s, handle: %d - (%s) size: %.3fM\n", i, bm_bitmaps[i].filename, bm_bitmaps[i].handle, bm_bitmaps[i].data_size ?
NOX(
"*LOCKED*") :
NOX(
""), ((
float)bm_bitmaps[i].data_size / 1024.0
f) / 1024.0
f));
2595 nprintf((
"BMP DEBUG",
"BMPMAN = num: %d, name: %s, handle: %d\n", i, bm_bitmaps[i].filename, bm_bitmaps[i].handle));
2610 Assert((n >= 0) && (n < MAX_BITMAPS));
2611 be = &bm_bitmaps[
n];
2617 Assertion(be->
handle == handle,
"Invalid bitmap handle number %d (expected %d) for %s passed to bm_release()\n", be->
handle, handle, be->
filename);
2620 nprintf((
"BmpMan",
"Tried to release a render target!\n"));
2626 nprintf((
"BmpMan",
"Tried to release %s that has a lock count of %d.. not releasing\n", be->
filename, be->
ref_count));
2637 nprintf((
"BmpMan",
"Tried to release %s that has a load count of %d.. not releasing\n", be->
filename, be->
load_count + 1));
2642 nprintf((
"BmpMan",
"Releasing bitmap %s in slot %i with handle %i\n", be->
filename, n, handle));
2649 for (i = 0; i < total; i++) {
2650 bm_free_data(first + i,
true);
2652 memset(&bm_bitmaps[first + i], 0,
sizeof(
bitmap_entry));
2660 strcpy_s(bm_bitmaps[first + i].filename,
"IVE_BEEN_RELEASED!");
2661 bm_bitmaps[first +
i].
signature = 0xDEADBEEF;
2670 bm_bitmaps[first +
i].
handle = -1;
2673 bm_free_data(n,
true);
2683 strcpy_s(bm_bitmaps[n].filename,
"IVE_BEEN_RELEASED!");
2704 if ((filename == NULL) || (strlen(filename) <= 0))
2712 if (bm_bitmaps[bitmapnum].ref_count) {
2713 nprintf((
"BmpMan",
"Trying to reload a bitmap that is still locked. Filename: %s, ref_count: %d", bm_bitmaps[bitmapnum].filename, bm_bitmaps[bitmapnum].ref_count));
2717 strcpy_s(bm_bitmaps[bitmapnum].filename, filename);
2718 return bitmap_handle;
2770 *((
unsigned short*)pixel) = 0;
2793 *((
unsigned int*)pixel) = 0;
2804 Assert((mode >= 0) && (mode <= 2));
2814 Assert(handle == bm_bitmaps[n].handle);
2818 mprintf((
"Trying to set invalid bitmap (slot: %i, handle: %i) as render target!\n", n, handle));
2890 int bm_unload(
int handle,
int clear_render_targets,
bool nodebug) {
2896 Assert((n >= 0) && (n < MAX_BITMAPS));
2897 be = &bm_bitmaps[
n];
2912 nprintf((
"BmpMan",
"Tried to unload %s that has a lock count of %d.. not unloading\n", be->
filename, be->
ref_count));
2919 if (!Bm_ignore_load_count) {
2924 nprintf((
"BmpMan",
"Tried to unload %s that has a load count of %d.. not unloading\n", be->
filename, be->
load_count + 1));
2940 nprintf((
"BmpMan",
"Unloading %s frame %d. %dx%dx%d\n", be->
filename, i, bmp->
w, bmp->
h, bmp->
bpp));
2941 bm_free_data(first + i);
2957 Bm_ignore_load_count = 1;
2965 Bm_ignore_load_count = 0;
2974 Assert((n >= 0) && (n < MAX_BITMAPS));
2975 be = &bm_bitmaps[
n];
2992 nprintf((
"BmpMan",
"Tried to unload_fast %s that has a lock count of %d.. not unloading\n", be->
filename, be->
ref_count));
3000 bm_free_data_fast(n);
3013 if (bm_bitmaps[bitmapnum].handle != handle) {
3014 mprintf((
"bm_unlock - %s: bm_bitmaps[%d].handle = %d, handle = %d\n", bm_bitmaps[bitmapnum].filename, bitmapnum, bm_bitmaps[bitmapnum].handle, handle));
3018 Assert(bm_bitmaps[bitmapnum].handle == handle);
3020 Assert((bitmapnum >= 0) && (bitmapnum < MAX_BITMAPS));
3022 be = &bm_bitmaps[bitmapnum];
3030 Assert( (n >= 0) && (n < MAX_BITMAPS) );
3033 #ifdef BMPMAN_NDEBUG
3034 Assert( bm_bitmaps[n].data_size == 0 );
3035 bm_bitmaps[
n].data_size +=
size;
3040 int find_block_of(
int n)
3042 int i, cnt = 0, nstart = 0;
void gr_rect(int x, int y, int w, int h, int resize_mode)
void bm_unlock(int handle)
Unlocks a bitmap.
ubyte bpp
Requested bitdepth of each pixel. ( 7, 8, 15, 16, 24, 32)
#define EFF_FILENAME_CHECK
int bm_get_next_handle()
Gets the next available bitmap slot.
const char * bm_ext_list[]
List of extensions for those types.
#define PNG_ERROR_INVALID
generic DDS cubemap (uncompressed cubemap surface)
int pcx_read_bitmap(const char *real_filename, ubyte *org_data, ubyte *pal, int byte_size, int aabitmap, int nondark, int cf_type)
bool bm_page_out(int handle)
Unloads the bitmap indexed by handle that was previously paged-in.
uint bm_get_signature(int handle)
Returns a unique signiature for the bitmap indexed by handle.
void bm_print_bitmaps()
(DEBUG) Prints all loaded bitmaps to an outwindow
#define TCACHE_TYPE_COMPRESSED
void bm_lock_dds(int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyte bpp, ubyte flags)
#define BMP_TEX_DXT3
dxt3 compressed 8r8g8b4a (32bit)
GLfloat GLfloat GLfloat GLfloat h
int dds_read_header(const char *filename, CFILE *img_cfp, int *width, int *height, int *bpp, int *compression_type, int *levels, int *size, ubyte *palette)
int dir_type
which directory this was loaded from (to skip other locations with same name)
#define BMP_TEX_ANY
Any texture.
int cfread(void *buf, int elsize, int nelem, CFILE *fp)
bool bm_load_and_parse_eff(const char *filename, int dir_type, int *nframes, int *nfps, int *key, BM_TYPE *type)
Loads and parses an .EFF.
std::basic_stringstream< char, std::char_traits< char >, std::allocator< char > > SCP_stringstream
void multi_send_anti_timeout_ping()
size_t mem_taken
How much memory does this bitmap use? - UnknownPlayer.
void bm_set_components_argb_16_tex(ubyte *pixel, ubyte *rv, ubyte *gv, ubyte *bv, ubyte *av)
Sets the 16bpp texture pixel to the specified RGBA value.
int Bm_paging
Bool type that indicates if BMPMAN is currently paging.
int targa_read_header(const char *real_filename, CFILE *img_cfp, int *w, int *h, int *bpp, ubyte *palette)
24-bit cubemap (compressed cubemap surface)
void _cdecl void void _cdecl void _cdecl Warning(char *filename, int line, SCP_FORMAT_STRING const char *format,...) SCP_FORMAT_STRING_ARGS(3
ubyte true_bpp
The image's actual bitdepth.
int targa_read_bitmap(const char *real_filename, ubyte *image_data, ubyte *palette, int dest_size, int cf_type)
ubyte flags
Various texture type flags.
__inline int gr_bm_set_render_target(int n, int face=-1)
int png_read_bitmap(const char *real_filename, ubyte *image_data, ubyte *bpp, int dest_size, int cf_type)
void bm_page_in_stop()
Tells bmpman to stop paging (?)
int bm_get_info(int handle, int *w, int *h, ubyte *flags, int *nframes, int *fps)
Gets info on the bitmap indexed by handle.
int bm_texture_ram
how many bytes of textures are used.
const int BM_ANI_NUM_TYPES
Calculated number of bitmap animation types.
BM_TYPE type
PCX, USER, ANI, etc.
int bm_load_duplicate(const char *filename)
Reloads a bitmap as a duplicate.
#define Assertion(expr, msg,...)
size_t bm_get_size(int handle)
Gets the size, in bytes, taken up by the bitmap indexed by handle.
#define BMP_TEX_NONCOMP
Non-compressed textures.
ubyte used_flags
What flags it was accessed thru.
void bm_page_in_start()
Tells bmpman to start keeping track of what bitmaps are used where.
uint signature
a unique signature identifying the data
int cf_find_file_location_ext(const char *filename, const int ext_num, const char **ext_list, int pathtype, int max_out=0, char *pack_filename=NULL, int *size=NULL, int *offset=NULL, bool localize=false)
int bm_get_tcache_type(int num)
Gets the correct TCACHE_TYPE for compressed graphics (uncompressed are assumed TCACHE_TYPE_NORMAL) ...
void bm_update_memory_used(int n, int size)
(DEBUG) Similar to bm_malloc, but only updates how much memory is used
void bm_lock_pcx(int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyte bpp, ubyte flags)
std::basic_string< char, std::char_traits< char >, std::allocator< char > > SCP_string
int png_read_header(const char *real_filename, CFILE *img_cfp, int *w, int *h, int *bpp, ubyte *palette)
#define BMP_TEX_DXT5
dxt5 compressed 8r8g8b8a (32bit)
bool bm_has_alpha_channel(int handle)
Checks to see if the indexed bitmap has an alpha channel.
color_gun * Gr_current_green
void free_anim_instance(anim_instance *inst)
void bm_page_in_xparent_texture(int bitmapnum, int nframes)
Marks a textures as being used for level and is transparant.
#define cfopen_special(...)
short h
Height, in number of pixels.
void bm_init()
Initilizes the bitmap manager.
int bm_unload_fast(int handle, int clear_render_targets)
Quickly unloads a bitmap's data, ignoring the load_count.
int bm_release(int handle, int clear_render_targets)
Frees both a bitmap's data and it's associated slot.
int NORMMAP
Normal mapping.
#define BMP_FLAG_RENDER_TARGET_STATIC
Texture is a static type.
void bm_lock_ani(int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyte bpp, ubyte flags)
void BM_SELECT_TEX_FORMAT()
Sets bm_set_components and bm_get_components to reference texture format functions.
#define gr_bm_make_render_target
#define BMP_AABITMAP
antialiased bitmap
#define JPEG_ERROR_INVALID
int bm_load_animation(const char *real_filename, int *nframes, int *fps, int *keyframe, int can_drop_frames, int dir_type)
Loads a bitmap sequance so we can draw with it.
#define CLAMP(x, min, max)
int HEIGHTMAP
Height map for normal mapping.
const BM_TYPE bm_type_list[]
List of valid bitmap types.
ubyte * palette
Pointer to this bitmap's palette (if it has one).
void game_busy(const char *filename=NULL)
void gr_set_color(int r, int g, int b)
int handle
Handle = id*MAX_BITMAPS + bitmapnum.
int jpeg_read_bitmap(const char *real_filename, ubyte *image_data, ubyte *palette, int dest_size, int cf_type)
int bm_is_valid(int handle)
Checks if the bitmap indexed by handle is valid.
GLenum GLuint GLint GLenum face
void opengl_setup_viewport()
int strextcmp(const char *s1, const char *s2)
typedef int(SCP_EXT_CALLCONV *SCPDLL_PFVERSION)(SCPDLL_Version *)
int preload_count
how many times this gets used in game, for unlocking
GLdouble GLdouble GLdouble r
const char * bm_ani_ext_list[]
List of extensions for those types.
#define BMP_TEX_DXT1
dxt1 compressed 8r8g8b1a (24bit)
void(* bm_set_components)(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a)
Functional pointer that references any of the bm_set_components functions.
int bm_is_compressed(int num)
Returns the compression type of the bitmap indexed by handle.
#define BMP_FLAG_CUBEMAP
Texture is a cubemap.
GLboolean GLboolean GLboolean GLboolean a
specifies any type of animated image, the EFF itself is just text
bitmap_entry bm_bitmaps[MAX_BITMAPS]
int GLOWMAP
References a map that is a fully lit version of its index -Bobboau.
int Use_compressed_textures
void stuff_string(char *outstr, int type, int len, char *terminators)
void(* bm_set_components_32)(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a)
Functional pointer that references any of the bm_set_components_32 functions.
sprintf(buf,"(%f,%f,%f)", v3->xyz.x, v3->xyz.y, v3->xyz.z)
int Cmdline_cache_bitmaps
24 bit with switchable alpha
const char * bm_get_filename(int handle)
Gets the filename of the bitmap indexed by handle, which must exist.
color_gun * Gr_current_red
short w
Width, in number of pixels.
int anim_free(anim *ptr)
Free an animation that was loaded with anim_load().
const BM_TYPE bm_ani_type_list[]
List of valid bitmap animation types.
short rowsize
What you need to add to go to next row.
32-bit cubemap (compressed cubemap surface)
int required_string(const char *pstr)
void bm_lock_user(int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyte bpp, ubyte flags)
uint palette_checksum
checksum used to be sure bitmap is in current palette
char filename[MAX_FILENAME_LEN]
filename for this bitmap
bitmap * bm_lock(int handle, ubyte bpp, ubyte flags, bool nodebug)
Locks down the bitmap indexed by bitmapnum.
int optional_string(const char *pstr)
void bm_set_components_argb_32_screen(ubyte *pixel, ubyte *rv, ubyte *gv, ubyte *bv, ubyte *av)
Sets the 32bpp screen pixel to the specified RGBA value.
bool dc_optional_string_either(const char *str1, const char *str2)
Searches for an optional string and it's alias.
#define MONITOR(function_name)
float get_channel_alpha(float u, float v)
color_gun * Gr_current_blue
int pcx_read_header(const char *real_filename, CFILE *img_cfp, int *w, int *h, int *bpp, ubyte *pal)
void bm_get_frame_usage(int *ntotal, int *nnew)
(DEBUG) Gets memory size, in bytes, of the locked bitmaps
#define DDS_CUBEMAP_UNCOMPRESSED
void read_file_text(const char *filename, int mode, char *processed_text, char *raw_text)
bool bm_set_render_target(int handle, int face)
(GR function) Calls gr_bm_set_render target for the given bitmap indexed by handle ...
#define BMP_TEX_OTHER
so we can identify all "normal" textures
float get_channel_blue(float u, float v)
int bm_is_render_target(int bitmap_id)
Checks to see if the given bitmap indexed by handle is a render target.
void bm_get_palette(int handle, ubyte *pal, char *name)
Gets the palette for a given bitmap indexed by handle, and optionally the filename.
int save_max_w_unscaled_zoomed
GLint GLint GLint GLint GLint x
signed char ref_count
Number of locks on bitmap. Can't unload unless ref_count is 0.
bitmap_lookup(int bitmap_num)
#define MONITOR_INC(function_name, inc)
void bm_set_low_mem(int mode)
Sets BMPMAN's memory mode.
int bm_create(int bpp, int w, int h, void *data, int flags)
const int BM_NUM_TYPES
Calculated number of bitmap types.
float get_channel_green(float u, float v)
void _cdecl void void _cdecl Error(const char *filename, int line, SCP_FORMAT_STRING const char *format,...) SCP_FORMAT_STRING_ARGS(3
24/32 bit setup internally as a dynamic render target
typedef void(APIENTRY *PFNGLARRAYELEMENTEXTPROC)(GLint i)
void reset_parse(char *text)
void dc_stuff_int(int *i)
Stuffs an int to the given variable. Supports binary (0b), hexadecimal (0x), and octal (0o) formats...
GLuint const GLchar * name
int dds_read_bitmap(const char *filename, ubyte *data, ubyte *bpp, int cf_type)
int max_w_unscaled_zoomed
void bm_lock_png(int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyte bpp, ubyte flags)
int bm_load(const char *real_filename)
Loads a bitmap so we can draw with it later.
int bm_get_cache_slot(int bitmap_id, int separate_ani_frames)
GLboolean GLboolean GLboolean b
#define BMP_TEX_CUBEMAP
a texture made for cubic environment map
void anim_read_header(anim *ptr, CFILE *fp)
int last_used
When this bitmap was last used.
GLint GLsizei GLsizei height
ubyte * anim_get_next_raw_buffer(anim_instance *inst, int xlate_pal, int aabitmap, int bpp)
GLubyte GLubyte GLubyte GLubyte w
ubyte preloaded
If set, then this was loaded from the lst file.
void bm_page_in_aabitmap(int bitmapnum, int nframes)
Marks a texture as being used for this level, and is anti-aliased.
void bm_set_components_argb_16_screen(ubyte *pixel, ubyte *rv, ubyte *gv, ubyte *bv, ubyte *av)
Sets the 16bpp screen pixel to the specified RGBA value.
const char * dds_error_string(int code)
void bm_set_components_argb_32_tex(ubyte *pixel, ubyte *rv, ubyte *gv, ubyte *bv, ubyte *av)
Sets the 32bpp texture pixel to the specified RGBA value.
void BM_SELECT_ALPHA_TEX_FORMAT()
Sets bm_set_components and bm_get_components to reference texture format functions (with alpha) ...
void bm_page_in_texture(int bitmapnum, int nframes)
Marks a texture as being used for this level.
generic identifier for DDS
#define BMP_TEX_COMP
Compressed textures.
#define TCACHE_TYPE_NORMAL
void bm_lock_jpg(int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyte bpp, ubyte flags)
color_gun * Gr_current_alpha
An overhauled/updated debug console to allow monitoring, testing, and general debugging of new featur...
GLenum GLsizei GLenum GLenum const GLvoid * data
24/32 bit setup internally as a static render target
ptr_u data
Pointer to data, or maybe offset into VRAM.
int num_mipmaps
number of mipmap levels, we need to read all of them
BM_TYPE bm_get_type(int handle)
Returns the image type of the given bitmap handle.
bm_extra_info info
Data for animations and user bitmaps.
void bm_get_components(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a)
Gets the RGBA components of a pixel according to the selected mode.
int ENVMAP
References a map that is for environment mapping -Bobboau.
#define MAX_BITMAPS
How many bitmaps the game can handle.
anim_instance * init_anim_instance(anim *ptr, int bpp)
void * bm_malloc(int n, int size)
Allocates memory for the given handle.
bool dc_optional_string(const char *pstr)
Searches for an optional string.
int SPECMAP
References a map that is for specular mapping -Bobboau.
void dc_printf(const char *format,...)
Prints the given char string to the debug console.
int bm_load_either(const char *filename, int *nframes, int *fps, int *keyframe, int can_drop_frames, int dir_type)
Loads either animation (bm_load_animation) or still image (bm_load)
#define gr_bm_page_in_start
int bm_unload(int handle, int clear_render_targets, bool nodebug)
Unloads a bitmap's data, but not the bitmap info.
void bm_clean_slot(int n)
32-bit cubemap (compressed cubemap surface)
int MISCMAP
Utility map, to be utilized for various things shader authors can come up with.
int cfclose(CFILE *cfile)
int save_max_h_unscaled_zoomed
#define gr_get_bitmap_from_texture
int bm_make_render_target(int width, int height, int flags)
Creates a render target as close to the desired resolution as possible.
void bm_unload_all()
Unloads all used bitmaps, should only ever be called by game_shutdown()
#define BMP_TEX_XPARENT
transparent texture
int jpeg_read_header(const char *real_filename, CFILE *img_cfp, int *w, int *h, int *bpp, ubyte *palette)
int bm_get_num_mipmaps(int num)
Gets the number of mipmaps of the indexed texture.
int timer_get_milliseconds()
float get_channel_red(float u, float v)
int max_h_unscaled_zoomed
void bm_lock_tga(int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyte bpp, ubyte flags)
DCF(bm_frag,"Shows BmpMan fragmentation")
BM_TYPE comp_type
What sort of compressed type, BM_TYPE_NONE if not compressed.
anim * anim_load(char *real_filename, int cf_dir_type, int file_mapped)
Load an animation. This stores the compressed data, which instances of the animation can reference...
void BM_SELECT_SCREEN_FORMAT()
Sets bm_set_components and bm_get_components to reference screen format functions.
int bm_reload(int bitmap_handle, const char *filename)
Reloads an existing bmpman slot with different bitmap.
void bm_close()
Closes the bitmap manager, freeing any allocated memory used by bitmaps. Is called at program close...