Debian Codegraph @

prboom2/src/dsda/font.c

raw
1 //
2 // Copyright(C) 2023 by Ryan Krafnick
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // DESCRIPTION:
15 // DSDA Font
16 //
17
18 #include "r_data.h"
19
20 #include "font.h"
21
22 static patchnum_t hu_font[HU_FONTSIZE];
23 static patchnum_t hu_font2[HU_FONTSIZE];
24
25 dsda_font_t hud_font;
26 dsda_font_t exhud_font;
27
28 void dsda_InitFont(void) {
29 int i;
30 int j;
31 char buffer[9];
32
33 j = HU_FONTSTART;
34 for (i = 0; i < HU_FONTSIZE - 1; i++, j++) {
35 snprintf(buffer, sizeof(buffer), "DIG%.3d", j);
36 R_SetPatchNum(&hu_font2[i], buffer);
37 }
38
39 j = HU_FONTSTART;
40 for (i = 0; i < HU_FONTSIZE; ++i, ++j) {
41 if ('0' <= j && j <= '9') {
42 if (raven)
43 snprintf(buffer, sizeof(buffer), "FONTA%.2d", j - 32);
44 else
45 snprintf(buffer, sizeof(buffer), "STCFN%.3d", j);
46 R_SetPatchNum(&hu_font[i], buffer);
47 }
48 else if ('A' <= j && j <= 'Z') {
49 if (raven)
50 snprintf(buffer, sizeof(buffer), "FONTA%.2d", j - 32);
51 else
52 snprintf(buffer, sizeof(buffer), "STCFN%.3d", j);
53 R_SetPatchNum(&hu_font[i], buffer);
54 }
55 else if (!raven && j < 97) {
56 snprintf(buffer, sizeof(buffer), "STCFN%.3d", j);
57 R_SetPatchNum(&hu_font[i], buffer);
58 //jff 2/23/98 make all font chars defined, useful or not
59 }
60 else if (raven && j < 91) {
61 snprintf(buffer, sizeof(buffer), "FONTA%.2d", j - 32);
62 R_SetPatchNum(&hu_font[i], buffer);
63 //jff 2/23/98 make all font chars defined, useful or not
64 }
65 else {
66 hu_font[i] = hu_font2[i]; //jff 2/16/98 account for gap
67 }
68 }
69
70 hud_font.font = hu_font;
71 hud_font.height = hu_font['0' - HU_FONTSTART].height;
72 hud_font.line_height = hud_font.height + 1;
73 hud_font.space_width = 4;
74 hud_font.start = HU_FONTSTART;
75
76 exhud_font.font = hu_font2;
77 exhud_font.height = hu_font2['0' - HU_FONTSTART].height;
78 exhud_font.line_height = exhud_font.height + 1;
79 exhud_font.space_width = 5;
80 exhud_font.start = HU_FONTSTART;
81 }