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