]> icculus.org git repositories - btb/d2x.git/blob - main/gamefont.c
strip out colors, etc when printing to stdout
[btb/d2x.git] / main / gamefont.c
1 /*
2 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
3 SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
4 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
5 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
6 IN USING, DISPLAYING,  AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
7 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
8 FREE PURPOSES.  IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
9 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES.  THE END-USER UNDERSTANDS
10 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.  
11 COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
12 */
13
14 #ifdef HAVE_CONFIG_H
15 #include <conf.h>
16 #endif
17
18 #ifdef RCS
19 static char rcsid[] = "$Id: gamefont.c,v 1.3 2002-07-30 11:05:53 btb Exp $";
20 #endif
21
22 #include <stdlib.h>
23
24 #include "inferno.h"
25 #include "gr.h"
26 #include "gamefont.h"
27
28 //if 1, use high-res versions of fonts
29 int FontHires=0;
30 int FontHiresAvailable=0;
31
32 char * Gamefont_filenames[] = { "font1-1.fnt",                  // Font 0
33                                                                                         "font1-1h.fnt",         // Font 0 High-res
34                                                                                         "font2-1.fnt",                  // Font 1
35                                                                                         "font2-1h.fnt",         // Font 1 High-res
36                                                                                         "font2-2.fnt",                  // Font 2
37                                                                                         "font2-2h.fnt",         // Font 2 High-res
38                                                                                         "font2-3.fnt",                  // Font 3
39                                                                                         "font2-3h.fnt",         // Font 3 High-res
40                                                                                         "font3-1.fnt",                  // Font 4
41                                                                                         "font3-1h.fnt",         // Font 4 High-res
42                                                                                 };
43
44 grs_font *Gamefonts[MAX_FONTS];
45
46 int Gamefont_installed=0;
47
48 void gamefont_init()
49 {
50         int i;
51
52         if (Gamefont_installed) return;
53         Gamefont_installed = 1;
54         FontHiresAvailable = 1;
55
56         for (i=0; i<MAX_FONTS; i+=2)
57                 Gamefonts[i] = gr_init_font(Gamefont_filenames[i]);
58         for (i=1; i<MAX_FONTS; i+=2) {
59                 Gamefonts[i] = gr_init_font(Gamefont_filenames[i]);
60                 if (!Gamefonts[i])
61                         FontHiresAvailable = 0;
62         }
63
64         atexit( gamefont_close );
65 }
66
67
68 void gamefont_close()
69 {
70         int i;
71
72         if (!Gamefont_installed) return;
73         Gamefont_installed = 0;
74
75         for (i=0; i<MAX_FONTS; i++ )    {
76                 gr_close_font( Gamefonts[i] );
77                 Gamefonts[i] = NULL;
78         }
79
80 }