mirror of
https://github.com/kevinbentley/Descent3.git
synced 2025-01-22 11:28:56 +00:00
Convert bitmap to use new logging facility
This commit is contained in:
parent
867a1d2e07
commit
c76637d97f
@ -17,6 +17,7 @@ target_link_libraries(bitmap PRIVATE
|
||||
ddio
|
||||
mem
|
||||
misc
|
||||
plog::plog
|
||||
stb
|
||||
)
|
||||
target_include_directories(bitmap PUBLIC
|
||||
|
@ -307,7 +307,7 @@
|
||||
#include "cfile.h"
|
||||
#include "bitmap.h"
|
||||
#include "pserror.h"
|
||||
#include "mono.h"
|
||||
#include "log.h"
|
||||
#include "iff.h"
|
||||
#include "ddio.h"
|
||||
#include "lightmap.h"
|
||||
@ -471,7 +471,7 @@ void bm_InitBitmaps() {
|
||||
}
|
||||
void bm_ShutdownBitmaps(void) {
|
||||
int i;
|
||||
mprintf(0, "Freeing all bitmap memory.\n");
|
||||
LOG_DEBUG << "Freeing all bitmap memory.";
|
||||
bm_FreeBitmapMain(0);
|
||||
for (i = 0; i < MAX_BITMAPS; i++) {
|
||||
while (GameBitmaps[i].used > 0)
|
||||
@ -512,8 +512,8 @@ int bm_AllocateMemoryForIndex(int n, int w, int h, int add_mem) {
|
||||
int bm_AllocBitmap(int w, int h, int add_mem) {
|
||||
int n = 0, i;
|
||||
if (!Bitmaps_initted) {
|
||||
LOG_ERROR << "Bitmaps not initted!!!";
|
||||
Int3();
|
||||
mprintf(0, "Bitmaps not initted!!!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -525,8 +525,8 @@ int bm_AllocBitmap(int w, int h, int add_mem) {
|
||||
}
|
||||
// If we can't find a free slot in which to alloc, bail out
|
||||
if (i == MAX_BITMAPS) {
|
||||
LOG_ERROR << "ERROR! Couldn't find a free bitmap to alloc!";
|
||||
Int3();
|
||||
mprintf(0, "ERROR! Couldn't find a free bitmap to alloc!\n");
|
||||
return -1;
|
||||
}
|
||||
memset(&GameBitmaps[n], 0, sizeof(bms_bitmap));
|
||||
@ -541,8 +541,8 @@ int bm_AllocBitmap(int w, int h, int add_mem) {
|
||||
int bm_AllocNoMemBitmap(int w, int h) {
|
||||
int n = 0, i;
|
||||
if (!Bitmaps_initted) {
|
||||
LOG_ERROR << "Bitmaps not initted!!!";
|
||||
Int3();
|
||||
mprintf(0, "Bitmaps not initted!!!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -554,8 +554,8 @@ int bm_AllocNoMemBitmap(int w, int h) {
|
||||
}
|
||||
// If we can't find a free slot in which to alloc, bail out
|
||||
if (i == MAX_BITMAPS) {
|
||||
LOG_ERROR << "Couldn't find a free bitmap to alloc!";
|
||||
Int3();
|
||||
mprintf(0, "ERROR! Couldn't find a free bitmap to alloc!\n");
|
||||
return -1;
|
||||
}
|
||||
// If no go on the malloc, bail out with -1
|
||||
@ -589,8 +589,8 @@ int bm_FindBitmapName(const char *name) {
|
||||
// Given a handle, frees the bitmap memory and flags this bitmap as unused
|
||||
void bm_FreeBitmap(int handle) {
|
||||
if (!Bitmaps_initted) {
|
||||
LOG_ERROR << "Bitmaps not initted!!!";
|
||||
Int3();
|
||||
mprintf(0, "Bitmaps not initted!!!\n");
|
||||
return;
|
||||
}
|
||||
if (handle == BAD_BITMAP_HANDLE)
|
||||
@ -701,8 +701,8 @@ int bm_GetFileType(CFILE *infile, const char *dest) {
|
||||
int bm_AllocLoadFileBitmap(const char *fname, int mipped, int format) {
|
||||
CFILE *infile;
|
||||
if (!Bitmaps_initted) {
|
||||
LOG_ERROR << "Bitmaps not initted!!!";
|
||||
Int3();
|
||||
mprintf(0, "Bitmaps not initted!!!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -723,19 +723,19 @@ int bm_AllocLoadFileBitmap(const char *fname, int mipped, int format) {
|
||||
while ((end_ptr >= start_ptr) && (*end_ptr != '\\'))
|
||||
end_ptr--;
|
||||
if (end_ptr < start_ptr) {
|
||||
mprintf(0, "Unable to find bitmap %s\n", fname);
|
||||
LOG_ERROR.printf("Unable to find bitmap %s", fname);
|
||||
return -1;
|
||||
}
|
||||
ASSERT(*end_ptr == '\\');
|
||||
end_ptr++;
|
||||
filename = end_ptr;
|
||||
mprintf(0, "Couldn't find %s, so gonna try %s\n", fname, filename);
|
||||
LOG_DEBUG.printf("Couldn't find %s, so gonna try %s", fname, filename);
|
||||
}
|
||||
|
||||
// Check to see if this bitmap is already in memory, if so, just return that
|
||||
// bitmaps handle
|
||||
if ((n = bm_TestName(filename)) != -1) {
|
||||
mprintf(1, "Found duplicate bitmap %s.\n", GameBitmaps[n].name);
|
||||
LOG_DEBUG.printf("Found duplicate bitmap %s.", GameBitmaps[n].name);
|
||||
old_used = GameBitmaps[n].used;
|
||||
GameBitmaps[n].used = 1;
|
||||
bm_FreeBitmap(n);
|
||||
@ -749,13 +749,13 @@ int bm_AllocLoadFileBitmap(const char *fname, int mipped, int format) {
|
||||
strcpy(name, GameBitmaps[n].name);
|
||||
}
|
||||
if (strlen(name) > 33) {
|
||||
mprintf(0, "ERROR!! This bitmaps name is too long, try shortening it and retry!\n");
|
||||
LOG_FATAL << "This bitmaps name is too long, try shortening it and retry!";
|
||||
return -1;
|
||||
}
|
||||
// Try to open the file. If we can't load it from the network if possible
|
||||
infile = (CFILE *)cfopen(filename, "rb");
|
||||
if (!infile) {
|
||||
mprintf(0, "bm_AllocLoadFileBitmap: Can't open file named %s.\n", filename);
|
||||
LOG_ERROR.printf("bm_AllocLoadFileBitmap: Can't open file named %s.", filename);
|
||||
|
||||
return BAD_BITMAP_HANDLE; // return the bad texture
|
||||
}
|
||||
@ -781,7 +781,7 @@ int bm_AllocLoadFileBitmap(const char *fname, int mipped, int format) {
|
||||
}
|
||||
cfclose(infile);
|
||||
if (src_bm < 0) {
|
||||
mprintf(0, "Couldn't load %s.", filename);
|
||||
LOG_ERROR.printf("Couldn't load %s.", filename);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -864,8 +864,8 @@ int bm_AllocLoadFileBitmap(const char *fname, int mipped, int format) {
|
||||
// Returns -1 if something is wrong
|
||||
int bm_AllocLoadFileNoMemBitmap(const char *fname, int mipped, int format) {
|
||||
if (!Bitmaps_initted) {
|
||||
LOG_ERROR << "Bitmaps not initted!!!";
|
||||
Int3();
|
||||
mprintf(0, "Bitmaps not initted!!!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -883,26 +883,26 @@ int bm_AllocLoadFileNoMemBitmap(const char *fname, int mipped, int format) {
|
||||
while ((end_ptr >= start_ptr) && (*end_ptr != '\\'))
|
||||
end_ptr--;
|
||||
if (end_ptr < start_ptr) {
|
||||
mprintf(0, "Unable to find bitmap %s\n", fname);
|
||||
LOG_ERROR.printf("Unable to find bitmap %s", fname);
|
||||
return -1;
|
||||
}
|
||||
ASSERT(*end_ptr == '\\');
|
||||
end_ptr++;
|
||||
filename = end_ptr;
|
||||
mprintf(0, "Couldn't find %s, so gonna try %s\n", fname, filename);
|
||||
LOG_DEBUG.printf("Couldn't find %s, so gonna try %s", fname, filename);
|
||||
}
|
||||
|
||||
// Check to see if this bitmap is already in memory, if so, just return that
|
||||
// bitmaps handle
|
||||
if ((n = bm_TestName(filename)) != -1) {
|
||||
GameBitmaps[n].used++;
|
||||
mprintf(1, "Found duplicate bitmap %s.\n", GameBitmaps[n].name);
|
||||
LOG_DEBUG.printf("Found duplicate bitmap %s.", GameBitmaps[n].name);
|
||||
return n;
|
||||
}
|
||||
|
||||
bm_ChangeEndName(filename, name);
|
||||
if (strlen(name) > 33) {
|
||||
mprintf(0, "ERROR!! This bitmaps name is too long, try shortening it and retry!\n");
|
||||
LOG_ERROR << "This bitmaps name is too long, try shortening it and retry!";
|
||||
return -1;
|
||||
}
|
||||
n = bm_AllocNoMemBitmap(1, 1);
|
||||
@ -922,8 +922,8 @@ int bm_AllocLoadBitmap(CFILE *infile, int mipped, int format) {
|
||||
char name[BITMAP_NAME_LEN];
|
||||
int n, src_bm;
|
||||
if (!Bitmaps_initted) {
|
||||
LOG_ERROR << "Bitmaps not initted!!!";
|
||||
Int3();
|
||||
mprintf(0, "Bitmaps not initted!!!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -931,7 +931,7 @@ int bm_AllocLoadBitmap(CFILE *infile, int mipped, int format) {
|
||||
|
||||
src_bm = bm_tga_alloc_file(infile, name, format);
|
||||
if (src_bm < 0) {
|
||||
mprintf(0, "Couldn't load %s.", name);
|
||||
LOG_ERROR.printf("Couldn't load %s.", name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1000,9 +1000,9 @@ int bm_SaveBitmap(CFILE *fp, int handle) {
|
||||
uint8_t dumbbyte = 0, image_type = OUTRAGE_1555_COMPRESSED_MIPPED, pixsize = 32, desc = 8 + 32;
|
||||
int i, done = 0;
|
||||
int num_mips;
|
||||
mprintf(0, "Saving bitmap %s...\n", GameBitmaps[handle].name);
|
||||
LOG_DEBUG.printf("Saving bitmap %s...", GameBitmaps[handle].name);
|
||||
if (!GameBitmaps[handle].used) {
|
||||
mprintf(0, "bm_SaveBitmap: Trying to save a bitmap that isn't used!\n");
|
||||
LOG_ERROR << "bm_SaveBitmap: Trying to save a bitmap that isn't used!";
|
||||
Int3();
|
||||
return -1;
|
||||
}
|
||||
@ -1013,7 +1013,7 @@ int bm_SaveBitmap(CFILE *fp, int handle) {
|
||||
if (GameBitmaps[handle].format == BITMAP_FORMAT_4444)
|
||||
image_type = OUTRAGE_4444_COMPRESSED_MIPPED;
|
||||
if (!fp) {
|
||||
mprintf(0, "bm_SaveBitmap: Trying to save a bitmap to a closed file!\n");
|
||||
LOG_ERROR << "bm_SaveBitmap: Trying to save a bitmap to a closed file!";
|
||||
Int3();
|
||||
return -1;
|
||||
}
|
||||
@ -1071,7 +1071,7 @@ int bm_MakeBitmapResident(int handle) {
|
||||
GameBitmaps[handle].flags &= ~BF_NOT_RESIDENT;
|
||||
GameBitmaps[handle].flags |= BF_CHANGED | BF_BRAND_NEW;
|
||||
} else {
|
||||
mprintf(0, "Error paging in bitmap %s!\n", GameBitmaps[handle].name);
|
||||
LOG_ERROR.printf("Error paging in bitmap %s!", GameBitmaps[handle].name);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -1083,7 +1083,7 @@ int bm_SaveFileBitmap(const std::filesystem::path &filename, int handle) {
|
||||
int ret;
|
||||
CFILE *fp;
|
||||
if (!GameBitmaps[handle].used) {
|
||||
mprintf(0, "bm_SaveBitmap: Trying to save a bitmap that isn't used!\n");
|
||||
LOG_ERROR << "Trying to save a bitmap that isn't used!";
|
||||
Int3();
|
||||
return -1;
|
||||
}
|
||||
@ -1092,13 +1092,13 @@ int bm_SaveFileBitmap(const std::filesystem::path &filename, int handle) {
|
||||
return -1;
|
||||
}
|
||||
if (!bm_MakeBitmapResident(handle)) {
|
||||
mprintf(0, "There was a problem paging this bitmap in!\n");
|
||||
LOG_ERROR << "There was a problem paging this bitmap in!";
|
||||
return -1;
|
||||
}
|
||||
fp = (CFILE *)cfopen(filename, "wb");
|
||||
|
||||
if (!fp) {
|
||||
mprintf(0, "bm_SaveBitmap: Trying to save a bitmap to a closed file!\n");
|
||||
LOG_ERROR << "Trying to save a bitmap to a closed file!";
|
||||
Int3();
|
||||
return -1;
|
||||
}
|
||||
|
@ -16,13 +16,14 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
#include "bumpmap.h"
|
||||
#include "pstypes.h"
|
||||
#include "pserror.h"
|
||||
#include "mono.h"
|
||||
#include "log.h"
|
||||
#include "mem.h"
|
||||
#include "mono.h"
|
||||
#include "pserror.h"
|
||||
|
||||
static int Num_of_bumpmaps = 0;
|
||||
static uint16_t Free_bumpmap_list[MAX_BUMPMAPS];
|
||||
@ -46,7 +47,7 @@ void bump_InitBumpmaps() {
|
||||
void bump_ShutdownBumpmaps(void) {
|
||||
int i;
|
||||
|
||||
mprintf(0, "Freeing all bumpmap memory.\n");
|
||||
LOG_DEBUG << "Freeing all bumpmap memory.";
|
||||
|
||||
for (i = 0; i < MAX_BUMPMAPS; i++) {
|
||||
while (GameBumpmaps[i].flags & BUMPF_USED)
|
||||
@ -72,7 +73,7 @@ int bump_AllocBumpmap(int w, int h) {
|
||||
|
||||
GameBumpmaps[n].data = (uint16_t *)mem_malloc(w * h * 2);
|
||||
if (!GameBumpmaps[n].data) {
|
||||
mprintf(0, "NOT ENOUGHT MEMORY FOR BUMPMAP!\n");
|
||||
LOG_ERROR << "NOT ENOUGH MEMORY FOR BUMPMAP!";
|
||||
Int3();
|
||||
return BAD_BUMP_INDEX;
|
||||
}
|
||||
|
@ -67,9 +67,9 @@
|
||||
|
||||
#define MIN_COMPRESS_WIDTH 65 // don't compress if less than this wide
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
#include "mem.h"
|
||||
#include "iff.h"
|
||||
@ -78,7 +78,7 @@
|
||||
#include "pserror.h"
|
||||
#include "pstypes.h"
|
||||
#include "bitmap.h"
|
||||
#include "mono.h"
|
||||
#include "log.h"
|
||||
#include "grdefs.h"
|
||||
|
||||
// Internal constants and structures for this library
|
||||
@ -515,7 +515,7 @@ int bm_iff_alloc_file(CFILE *ifile) {
|
||||
cur_sig[i] = cf_ReadByte(ifile);
|
||||
|
||||
if (strncmp("PBM ", cur_sig, 4)) {
|
||||
mprintf(0, "IFF file isn't a PBM...aborting.\n");
|
||||
LOG_ERROR << "IFF file isn't a PBM...aborting.";
|
||||
return -1;
|
||||
}
|
||||
if (!strncmp("PBM ", cur_sig, 4))
|
||||
@ -526,7 +526,7 @@ int bm_iff_alloc_file(CFILE *ifile) {
|
||||
ret = bm_iff_parse_file(ifile, &bmheader, NULL);
|
||||
|
||||
if (ret != IFF_NO_ERROR) {
|
||||
mprintf(0, "Couldn't load IFF file.\n");
|
||||
LOG_ERROR << "Couldn't load IFF file.";
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -565,7 +565,7 @@ int bm_iff_read_animbrush(const char *ifilename, int *bm_list) {
|
||||
form_len = cf_ReadInt(ifile, false);
|
||||
|
||||
if (sig != IFF_SIG_FORM) {
|
||||
mprintf(0, "Not a valid IFF file.\n");
|
||||
LOG_ERROR << "Not a valid IFF file.";
|
||||
cfclose(ifile);
|
||||
return -1;
|
||||
}
|
||||
|
@ -16,19 +16,14 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "lightmap.h"
|
||||
#include "pstypes.h"
|
||||
#include "pserror.h"
|
||||
#include "bitmap.h"
|
||||
#include "mono.h"
|
||||
#include "mem.h"
|
||||
#if !defined(POSIX)
|
||||
#include "Macros.h"
|
||||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
#include "lightmap.h"
|
||||
#include "log.h"
|
||||
#include "mem.h"
|
||||
#include "pserror.h"
|
||||
|
||||
static int Num_of_lightmaps = 0;
|
||||
static uint16_t Free_lightmap_list[MAX_LIGHTMAPS];
|
||||
@ -48,7 +43,7 @@ void lm_InitLightmaps() {
|
||||
}
|
||||
void lm_ShutdownLightmaps(void) {
|
||||
int i;
|
||||
mprintf(0, "Freeing all lightmap memory.\n");
|
||||
LOG_DEBUG << "Freeing all lightmap memory.";
|
||||
for (i = 0; i < MAX_LIGHTMAPS; i++) {
|
||||
while (GameLightmaps[i].used > 0)
|
||||
lm_FreeLightmap(i);
|
||||
@ -68,7 +63,7 @@ int lm_AllocLightmap(int w, int h) {
|
||||
memset(&GameLightmaps[n], 0, sizeof(bms_lightmap));
|
||||
GameLightmaps[n].data = (uint16_t *)mem_malloc((w * h * 2));
|
||||
if (!GameLightmaps[n].data) {
|
||||
mprintf(0, "NOT ENOUGHT MEMORY FOR LIGHTMAP!\n");
|
||||
LOG_DEBUG << "NOT ENOUGH MEMORY FOR LIGHTMAP!";
|
||||
Int3();
|
||||
return BAD_LM_INDEX;
|
||||
}
|
||||
|
@ -54,12 +54,14 @@
|
||||
* $NoKeywords: $
|
||||
*/
|
||||
|
||||
#include "mem.h"
|
||||
#include <cstdlib>
|
||||
|
||||
#include "bitmap.h"
|
||||
#include "pserror.h"
|
||||
#include "pstypes.h"
|
||||
#include "cfile.h"
|
||||
#include "grdefs.h"
|
||||
#include <stdlib.h>
|
||||
#include "log.h"
|
||||
#include "mem.h"
|
||||
#include "pserror.h"
|
||||
|
||||
// load an 8bit pcx image
|
||||
static int bm_pcx_8bit_alloc_file(CFILE *infile);
|
||||
@ -190,13 +192,13 @@ int bm_pcx_24bit_alloc_file(CFILE *infile) {
|
||||
|
||||
if (temp[1] < 5) {
|
||||
// need at least version 5.0f
|
||||
mprintf(0, "PCXLoad: PCX Not version 5.0 or greater\n");
|
||||
LOG_ERROR << "PCXLoad: PCX Not version 5.0 or greater";
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (temp[3] != 8) {
|
||||
// need 8 bits per pixel
|
||||
mprintf(0, "PCXLoad: PCX Not 8 bpp\n");
|
||||
LOG_ERROR << "PCXLoad: PCX Not 8 bpp";
|
||||
return -1; // nope...bail
|
||||
}
|
||||
|
||||
@ -211,7 +213,7 @@ int bm_pcx_24bit_alloc_file(CFILE *infile) {
|
||||
|
||||
if (temp[65 - PCXHEADER_OFFSET] != 3) {
|
||||
// Must have 3 planes
|
||||
mprintf(0, "PCXLoad: PCX Not 3 Planes for 24bit encoding\n");
|
||||
LOG_ERROR << "PCXLoad: PCX Not 3 Planes for 24bit encoding";
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -228,7 +230,7 @@ int bm_pcx_24bit_alloc_file(CFILE *infile) {
|
||||
|
||||
uint8_t *rawdata = (uint8_t *)mem_malloc(total * height);
|
||||
if (!rawdata) {
|
||||
mprintf(0, "PCXLoad: Out of memory\n");
|
||||
LOG_ERROR << "PCXLoad: Out of memory";
|
||||
return -1; // no memory!
|
||||
}
|
||||
|
||||
|
@ -132,18 +132,17 @@
|
||||
* $NoKeywords: $
|
||||
*/
|
||||
|
||||
#include "cfile.h"
|
||||
#include "pserror.h"
|
||||
#include "pstypes.h"
|
||||
#include "bitmap.h"
|
||||
#include "mono.h"
|
||||
#include "grdefs.h"
|
||||
#include "byteswap.h"
|
||||
#include <string.h>
|
||||
#include "mem.h"
|
||||
#include "gamesequence.h"
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "bitmap.h"
|
||||
#include "byteswap.h"
|
||||
#include "cfile.h"
|
||||
#include "gamesequence.h"
|
||||
#include "grdefs.h"
|
||||
#include "log.h"
|
||||
#include "mem.h"
|
||||
#include "pserror.h"
|
||||
|
||||
static char *Tga_file_data = NULL;
|
||||
static int Fake_pos = 0;
|
||||
@ -340,7 +339,7 @@ int bm_tga_alloc_file(CFILE *infile, char *name, int format) {
|
||||
(image_type != 10 && image_type != 2 && image_type != OUTRAGE_TGA_TYPE && image_type != OUTRAGE_COMPRESSED_OGF &&
|
||||
image_type != OUTRAGE_COMPRESSED_MIPPED && image_type != OUTRAGE_NEW_COMPRESSED_MIPPED &&
|
||||
image_type != OUTRAGE_1555_COMPRESSED_MIPPED && image_type != OUTRAGE_4444_COMPRESSED_MIPPED)) {
|
||||
mprintf(0, "bm_tga: Can't read this type of TGA.\n");
|
||||
LOG_ERROR << "bm_tga: Can't read this type of TGA.";
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -376,13 +375,13 @@ int bm_tga_alloc_file(CFILE *infile, char *name, int format) {
|
||||
pixsize = cf_ReadByte(infile);
|
||||
|
||||
if (pixsize != 32 && pixsize != 24) {
|
||||
mprintf(0, "bm_tga: This file has a pixsize of field of %d, it should be 32. ", pixsize);
|
||||
LOG_ERROR.printf("bm_tga: This file has a pixsize of field of %d, it should be 32.", pixsize);
|
||||
return -1;
|
||||
}
|
||||
|
||||
descriptor = cf_ReadByte(infile);
|
||||
if (((descriptor & 0x0F) != 8) && ((descriptor & 0x0F) != 0)) {
|
||||
mprintf(0, "bm_tga: Descriptor field & 0x0F must be 8 or 0, but this is %d.", descriptor & 0x0F);
|
||||
LOG_ERROR.printf("bm_tga: Descriptor field & 0x0F must be 8 or 0, but this is %d.", descriptor & 0x0F);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -401,7 +400,7 @@ int bm_tga_alloc_file(CFILE *infile, char *name, int format) {
|
||||
GameBitmaps[n].flags |= BF_MIPMAPPED;
|
||||
|
||||
if (n < 0) {
|
||||
mprintf(0, "bm_tga: Failed to allocate memory.\n");
|
||||
LOG_ERROR << "bm_tga: Failed to allocate memory.";
|
||||
Int3();
|
||||
return -1;
|
||||
}
|
||||
@ -549,7 +548,7 @@ int bm_page_in_file(int n) {
|
||||
|
||||
infile = (CFILE *)cfopen(GameBitmaps[n].name, "rb");
|
||||
if (!infile) {
|
||||
mprintf(0, "Couldn't page in bitmap %s!\n", GameBitmaps[n].name);
|
||||
LOG_ERROR.printf("Couldn't page in bitmap %s!", GameBitmaps[n].name);
|
||||
return 0;
|
||||
}
|
||||
// Used for progress bar when loading the level
|
||||
@ -563,7 +562,7 @@ int bm_page_in_file(int n) {
|
||||
(image_type != 10 && image_type != 2 && image_type != OUTRAGE_TGA_TYPE && image_type != OUTRAGE_COMPRESSED_OGF &&
|
||||
image_type != OUTRAGE_COMPRESSED_MIPPED && image_type != OUTRAGE_NEW_COMPRESSED_MIPPED &&
|
||||
image_type != OUTRAGE_1555_COMPRESSED_MIPPED && image_type != OUTRAGE_4444_COMPRESSED_MIPPED)) {
|
||||
mprintf(0, "bm_tga: Can't read this type of TGA.\n");
|
||||
LOG_ERROR << "bm_tga: Can't read this type of TGA.";
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -599,13 +598,13 @@ int bm_page_in_file(int n) {
|
||||
pixsize = cf_ReadByte(infile);
|
||||
|
||||
if (pixsize != 32 && pixsize != 24) {
|
||||
mprintf(0, "bm_tga: This file has a pixsize of field of %d, it should be 32. ", pixsize);
|
||||
LOG_ERROR.printf("bm_tga: This file has a pixsize of field of %d, it should be 32. ", pixsize);
|
||||
return 0;
|
||||
}
|
||||
|
||||
descriptor = cf_ReadByte(infile);
|
||||
if (((descriptor & 0x0F) != 8) && ((descriptor & 0x0F) != 0)) {
|
||||
mprintf(0, "bm_tga: Descriptor field & 0x0F must be 8 or 0, but this is %d.", descriptor & 0x0F);
|
||||
LOG_ERROR.printf("bm_tga: Descriptor field & 0x0F must be 8 or 0, but this is %d.", descriptor & 0x0F);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -618,7 +617,7 @@ int bm_page_in_file(int n) {
|
||||
int size = (width * height * 2) + (mipped * ((width * height * 2) / 3)) + 2;
|
||||
GameBitmaps[n].data16 = (uint16_t *)mem_malloc(size);
|
||||
if (!GameBitmaps[n].data16) {
|
||||
mprintf(0, "Out of memory in bm_page_in_file!\n");
|
||||
LOG_ERROR << "Out of memory in bm_page_in_file!";
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -639,7 +638,7 @@ int bm_page_in_file(int n) {
|
||||
|
||||
strcpy(GameBitmaps[n].name, name);
|
||||
|
||||
mprintf(0, "Paging in bitmap %s!\n", GameBitmaps[n].name);
|
||||
LOG_DEBUG.printf("Paging in bitmap %s!", GameBitmaps[n].name);
|
||||
|
||||
if (file_mipped)
|
||||
GameBitmaps[n].flags |= BF_MIPMAPPED;
|
||||
|
Loading…
Reference in New Issue
Block a user