comparison src/dmtext_bm.c @ 2586:9807ae37ad69

Require stdbool.h, we require C11 now.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 08 Dec 2022 15:59:22 +0200
parents 92b93a12c014
children
comparison
equal deleted inserted replaced
2585:ef6c826c5b7a 2586:9807ae37ad69
6 */ 6 */
7 #include "dmtext.h" 7 #include "dmtext.h"
8 8
9 9
10 void dmDrawBMTextConst(SDL_Surface *screen, const DMBitmapFont *font, 10 void dmDrawBMTextConst(SDL_Surface *screen, const DMBitmapFont *font,
11 const BOOL condensed, const int mode, int xc, int yc, const char *fmt) 11 const bool condensed, const int mode, int xc, int yc, const char *fmt)
12 { 12 {
13 const char *ptr = fmt; 13 const char *ptr = fmt;
14 DMUnscaledBlitFunc blit = dmGetUnscaledBlitFunc(font->glyphs->format, screen->format, mode); 14 DMUnscaledBlitFunc blit = dmGetUnscaledBlitFunc(font->glyphs->format, screen->format, mode);
15 SDL_Surface surf; 15 SDL_Surface surf;
16 Uint8 *orig = font->glyphs->pixels; 16 Uint8 *orig = font->glyphs->pixels;
40 } 40 }
41 } 41 }
42 42
43 43
44 void dmDrawBMTextVA(SDL_Surface *screen, const DMBitmapFont *font, 44 void dmDrawBMTextVA(SDL_Surface *screen, const DMBitmapFont *font,
45 const BOOL condensed, const int mode, const int xc, const int yc, 45 const bool condensed, const int mode, const int xc, const int yc,
46 const char *fmt, va_list ap) 46 const char *fmt, va_list ap)
47 { 47 {
48 char tmp[512]; 48 char tmp[512];
49 vsnprintf(tmp, sizeof(tmp), fmt, ap); 49 vsnprintf(tmp, sizeof(tmp), fmt, ap);
50 dmDrawBMTextConst(screen, font, condensed, mode, xc, yc, tmp); 50 dmDrawBMTextConst(screen, font, condensed, mode, xc, yc, tmp);
51 dmFree(tmp); 51 dmFree(tmp);
52 } 52 }
53 53
54 54
55 void dmDrawBMText(SDL_Surface *screen, const DMBitmapFont *font, 55 void dmDrawBMText(SDL_Surface *screen, const DMBitmapFont *font,
56 const BOOL condensed, const int mode, const int xc, const int yc, 56 const bool condensed, const int mode, const int xc, const int yc,
57 const char *fmt, ...) 57 const char *fmt, ...)
58 { 58 {
59 va_list ap; 59 va_list ap;
60 60
61 va_start(ap, fmt); 61 va_start(ap, fmt);
141 { 141 {
142 DMBitmapFont *font; 142 DMBitmapFont *font;
143 char magic[8]; 143 char magic[8];
144 Uint16 version, nglyphs, maxglyph; 144 Uint16 version, nglyphs, maxglyph;
145 Uint8 width, height, bpp; 145 Uint8 width, height, bpp;
146 BOOL tsfont = FALSE; 146 bool tsfont = false;
147 147
148 // Check magic and version 148 // Check magic and version
149 if (!dmf_read_str(fp, (Uint8 *) &magic, 6) || 149 if (!dmf_read_str(fp, (Uint8 *) &magic, 6) ||
150 !dmf_read_le16(fp, &version)) 150 !dmf_read_le16(fp, &version))
151 return DMERR_FREAD; 151 return DMERR_FREAD;
153 // Check if it is a legacy TSFONT file 153 // Check if it is a legacy TSFONT file
154 if (memcmp(magic, TSFONT_MAGIC, 6) == 0) 154 if (memcmp(magic, TSFONT_MAGIC, 6) == 0)
155 { 155 {
156 // Yep, we handle these a bit differently 156 // Yep, we handle these a bit differently
157 int encoding = dmfgetc(fp); 157 int encoding = dmfgetc(fp);
158 tsfont = TRUE; 158 tsfont = true;
159 159
160 #ifdef FN_DEBUG 160 #ifdef FN_DEBUG
161 fprintf(stderr, "TSFONT v%d.%d (0x%04x), encoding=%d\n", 161 fprintf(stderr, "TSFONT v%d.%d (0x%04x), encoding=%d\n",
162 version >> 8, version & 0xff, version, encoding); 162 version >> 8, version & 0xff, version, encoding);
163 #endif 163 #endif