| version 1.2 | | version 1.3 |
|---|
| | |
| * Fonts for the game. | | * Fonts for the game. |
| * | | * |
| * $Log$ | | * $Log$ |
| | | * Revision 1.3 1999/10/08 04:14:02 donut |
| | | * added default usage of larger fonts at highres, added checks for font existance before trying to load |
| | | * |
| * Revision 1.2 1999/10/08 00:57:03 donut | | * Revision 1.2 1999/10/08 00:57:03 donut |
| * variable GAME_FONT | | * variable GAME_FONT |
| * | | * |
| | |
| #include "strutil.h" | | #include "strutil.h" |
| #include "mono.h" | | #include "mono.h" |
| #include "args.h" | | #include "args.h" |
| | | #include "cfile.h" |
| | | #include "hudmsg.h" |
| #include "gamefont.h" | | #include "gamefont.h" |
| | | |
| char * Gamefont_filenames[] = { "font1-1.fnt", // Font 0 | | char * Gamefont_filenames[] = { "font1-1.fnt", // Font 0 |
| | |
| | | |
| void gamefont_unloadfont(void){ | | void gamefont_unloadfont(void){ |
| if (game_font){ | | if (game_font){ |
| | | if (cur_font_conf>=0){ |
| if (!font_conf[cur_font_conf].builtin) | | if (!font_conf[cur_font_conf].builtin) |
| gr_close_font(game_font); | | gr_close_font(game_font); |
| | | } |
| game_font=NULL; | | game_font=NULL; |
| } | | } |
| } | | } |
| void gamefont_loadfont(int fi){ | | void gamefont_loadfont(int fi){ |
| | | if (font_conf[fi].builtin){ |
| gamefont_unloadfont(); | | gamefont_unloadfont(); |
| if (font_conf[fi].builtin) | | |
| game_font=font_conf[fi].f.ptr; | | game_font=font_conf[fi].f.ptr; |
| else | | }else{ |
| | | if (cfexist(font_conf[fi].f.name)){ |
| | | gamefont_unloadfont(); |
| game_font=gr_init_font(font_conf[fi].f.name); | | game_font=gr_init_font(font_conf[fi].f.name); |
| | | }else { |
| | | hud_message(MSGC_GAME_FEEDBACK,"Couldn't find font file %s!",font_conf[fi].f.name); |
| | | if (game_font==NULL){ |
| | | game_font=Gamefonts[GFONT_SMALL]; |
| | | cur_font_conf=-1; |
| | | } |
| | | return; |
| | | } |
| | | } |
| cur_font_conf=fi; | | cur_font_conf=fi; |
| } | | } |
| void gamefont_choose_game_font(int scrx,int scry){ | | void gamefont_choose_game_font(int scrx,int scry){ |
| | |
| Gamefonts[i] = gr_init_font(Gamefont_filenames[i]); | | Gamefonts[i] = gr_init_font(Gamefont_filenames[i]); |
| | | |
| addfontconf(0,"font3-1.fnt");//default font. | | addfontconf(0,"font3-1.fnt");//default font. |
| // addfontconf(800,"pc6x8.fnt"); | | addfontconf(640,"pc6x8.fnt"); |
| // addfontconf(1024,"pc8x16.fnt"); | | addfontconf(1024,"pc8x16.fnt"); |
| if ((i=FindArg("-font320"))) | | if ((i=FindArg("-font320"))) |
| addfontconf(320,Args[i+1]); | | addfontconf(320,Args[i+1]); |
| if ((i=FindArg("-font640"))) | | if ((i=FindArg("-font640"))) |