mirror of
https://github.com/kevinbentley/Descent3.git
synced 2025-01-22 11:28:56 +00:00
Convert 2dlib to use new logging facility
This commit is contained in:
parent
30f8fefa0b
commit
a3324dc06e
@ -17,6 +17,7 @@ target_link_libraries(2dlib PRIVATE
|
||||
cfile
|
||||
mem
|
||||
misc
|
||||
plog::plog
|
||||
)
|
||||
target_include_directories(2dlib PUBLIC
|
||||
$<BUILD_INTERFACE:
|
||||
|
@ -122,8 +122,8 @@
|
||||
#include "bitmap.h"
|
||||
#include "cfile.h"
|
||||
#include "gr.h"
|
||||
#include "log.h"
|
||||
#include "mem.h"
|
||||
#include "mono.h"
|
||||
#include "pserror.h"
|
||||
#include "renderer.h"
|
||||
|
||||
@ -145,7 +145,7 @@ static inline int READ_FONT_INT(FONTFILE ffile);
|
||||
static inline int16_t READ_FONT_SHORT(FONTFILE ffile);
|
||||
static inline uint8_t READ_FONT_BYTE(FONTFILE ffile);
|
||||
static inline int READ_FONT_DATA(FONTFILE ffile, void *buf, int size, int nelem);
|
||||
static inline FONTFILE OPEN_FONT(char *filename, bool &success);
|
||||
static inline FONTFILE OPEN_FONT(const char *filename, bool &success);
|
||||
static inline void CLOSE_FONT(FONTFILE ffile);
|
||||
|
||||
#define BITS_TO_BYTES(_c) (((_c) + 7) >> 3)
|
||||
@ -167,7 +167,7 @@ inline int READ_FONT_DATA(FONTFILE ffile, void *buf, int size, int nelem) {
|
||||
return i;
|
||||
}
|
||||
|
||||
inline FONTFILE OPEN_FONT(char *filename, bool &success) {
|
||||
inline FONTFILE OPEN_FONT(const char *filename, bool &success) {
|
||||
FONTFILE fp;
|
||||
int file_id;
|
||||
|
||||
@ -219,7 +219,7 @@ void grFont::close_system() {
|
||||
}
|
||||
|
||||
// we should free any fonts currently allocated here.
|
||||
mprintf(0, "Freeing cached fonts...");
|
||||
LOG_DEBUG << "Freeing cached fonts...";
|
||||
for (int i = 0; i < MAX_FONTS; i++) {
|
||||
gr_font_record *ft;
|
||||
if (grFont::m_FontList[i].references) {
|
||||
@ -389,8 +389,6 @@ void grFont::load(char *filename, int slot) {
|
||||
Error("Illegal font file: %s.\n", filename);
|
||||
}
|
||||
|
||||
mprintf(0, "%s font.\n", grFont::m_FontList[slot].name);
|
||||
|
||||
ft->width = READ_FONT_SHORT(ff);
|
||||
ft->height = READ_FONT_SHORT(ff);
|
||||
ft->flags = READ_FONT_SHORT(ff);
|
||||
@ -399,8 +397,6 @@ void grFont::load(char *filename, int slot) {
|
||||
ft->max_ascii = READ_FONT_BYTE(ff);
|
||||
READ_FONT_DATA(ff, fontname, 32, 1);
|
||||
|
||||
mprintf(0, " <ht %d>::<min %d>::<max %d>::<base %d>", ft->height, ft->min_ascii, ft->max_ascii, ft->baseline);
|
||||
|
||||
num_char = ft->max_ascii - ft->min_ascii + 1;
|
||||
|
||||
// Read in all widths
|
||||
@ -408,7 +404,6 @@ void grFont::load(char *filename, int slot) {
|
||||
ft->char_widths = new int16_t[num_char];
|
||||
for (i = 0; i < num_char; i++)
|
||||
ft->char_widths[i] = READ_FONT_SHORT(ff);
|
||||
mprintf(0, "::proportional");
|
||||
} else {
|
||||
ft->char_widths = NULL;
|
||||
}
|
||||
@ -427,7 +422,6 @@ void grFont::load(char *filename, int slot) {
|
||||
|
||||
if (ft->flags & FT_COLOR) {
|
||||
int off = 0;
|
||||
mprintf(0, "::color");
|
||||
for (i = 0; i < num_char; i++) {
|
||||
ft->char_data[i] = ft->raw_data + off;
|
||||
if (ft->flags & FT_PROPORTIONAL)
|
||||
@ -437,7 +431,6 @@ void grFont::load(char *filename, int slot) {
|
||||
}
|
||||
} else { // Monochrome
|
||||
uint8_t *ptr = ft->raw_data;
|
||||
mprintf(0, "::mono");
|
||||
for (i = 0; i < num_char; i++) {
|
||||
ft->char_data[i] = ptr;
|
||||
if (ft->flags & FT_PROPORTIONAL)
|
||||
@ -452,8 +445,9 @@ void grFont::load(char *filename, int slot) {
|
||||
|
||||
// Then read in
|
||||
CLOSE_FONT(ff);
|
||||
|
||||
mprintf(0, "\n");
|
||||
LOG_DEBUG.printf("%s font: <ht %d>::<min %d>::<max %d>::<base %d>::<proportional %d>::<color %d>",
|
||||
grFont::m_FontList[slot].name, ft->height, ft->min_ascii, ft->max_ascii, ft->baseline,
|
||||
ft->flags & FT_PROPORTIONAL, ft->flags & FT_COLOR);
|
||||
|
||||
grFont::m_FontList[slot].font = fnt;
|
||||
|
||||
|
@ -73,6 +73,7 @@
|
||||
|
||||
#include "bitmap.h"
|
||||
#include "lib2d.h"
|
||||
#include "log.h"
|
||||
#include "mem.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -172,7 +173,7 @@ bool gr_mem_surf_Create(ddgr_surface *sf) {
|
||||
|
||||
bm->data = (char *)mem_malloc(bm->rowsize * sf->h);
|
||||
if (!bm->data) {
|
||||
mprintf(0, "mem_Create malloc fail <%s>\n", sf->name);
|
||||
LOG_WARNING.printf("mem_Create malloc fail <%s>\n", sf->name);
|
||||
delete bm;
|
||||
return false;
|
||||
}
|
||||
|
@ -745,8 +745,6 @@ void grSurface::add_to_list(ddgr_surface *sf) {
|
||||
node->prev = grSurface::surf_list_cur;
|
||||
grSurface::surf_list_cur = node;
|
||||
}
|
||||
|
||||
// mprintf(0, "Allocated surface %s [%d].\n", sf->name, DDData.surfs_alloc);
|
||||
}
|
||||
|
||||
void grSurface::remove_from_list(ddgr_surface *sf) {
|
||||
@ -776,6 +774,4 @@ void grSurface::remove_from_list(ddgr_surface *sf) {
|
||||
node = node->prev;
|
||||
}
|
||||
}
|
||||
|
||||
// mprintf(0, "Freed surface %s [%d].\n", sf->name, DDData.surfs_alloc);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user