Use unique_ptr to manage fonts

This commit is contained in:
Kp 2014-07-20 03:48:27 +00:00
parent bd1c6d8c5d
commit c1d184240d
19 changed files with 112 additions and 103 deletions

View file

@ -169,7 +169,7 @@ extern int Large_view_index;
extern UI_GADGET_USERBOX * LargeViewBox;
extern int Found_seg_index; // Index in Found_segs corresponding to Cursegp
extern int gamestate_not_restored;
extern grs_font *editor_font;
extern grs_font_ptr editor_font;
extern vms_vector Ed_view_target; // what editor is looking at

View file

@ -27,6 +27,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#define _GR_H
#include <cstdint>
#include <memory>
#include "pstypes.h"
#include "maths.h"
#include "palette.h"
@ -148,7 +149,7 @@ struct grs_font : public prohibit_void_ptr<grs_font>
struct grs_canvas : public prohibit_void_ptr<grs_canvas>
{
grs_bitmap cv_bitmap; // the bitmap for this canvas
grs_font * cv_font; // the currently selected font
const grs_font * cv_font; // the currently selected font
short cv_color; // current color
short cv_drawmode; // fill,XOR,etc.
short cv_font_fg_color; // current font foreground color (-1==Invisible)
@ -315,10 +316,20 @@ void gr_ubox(int left,int top,int right,int bot);
void gr_scanline( int x1, int x2, int y );
void gr_uscanline( int x1, int x2, int y );
void gr_close_font(std::unique_ptr<grs_font> font);
struct font_delete
{
void operator()(grs_font *p) const
{
gr_close_font(std::unique_ptr<grs_font>(p));
}
};
typedef std::unique_ptr<grs_font, font_delete> grs_font_ptr;
// Reads in a font file... current font set to this one.
grs_font * gr_init_font( const char * fontfile );
void gr_close_font( grs_font * font );
grs_font_ptr gr_init_font( const char * fontfile );
#if defined(DXX_BUILD_DESCENT_I)
#define DXX_SDL_WINDOW_CAPTION "Descent"
@ -337,7 +348,11 @@ void gr_remap_mono_fonts();
#endif
// Writes a string using current font. Returns the next column after last char.
void gr_set_curfont( grs_font * );
void gr_set_curfont(const grs_font *);
static inline void gr_set_curfont(const grs_font_ptr &p)
{
gr_set_curfont(p.get());
}
void gr_set_fontcolor( int fg_color, int bg_color );
void gr_string(int x, int y, const char *s );
void gr_ustring(int x, int y, const char *s );

View file

@ -15,6 +15,7 @@
#define PHYSFSX_H
#include <cstddef>
#include <memory>
#include <string.h>
#include <stdarg.h>
@ -100,6 +101,16 @@ static inline PHYSFS_sint64 PHYSFSX_check_read(PHYSFS_file *file, array<V, N> &v
return PHYSFSX_check_read(file, &v[0], S, C);
}
template <typename V, typename D>
static inline PHYSFS_sint64 PHYSFSX_check_read(PHYSFS_file *file, const std::unique_ptr<V, D> &v, PHYSFS_uint32 S, PHYSFS_uint32 C)
{
#if defined(DXX_HAVE_BUILTIN_CONSTANT_P) && defined(DXX_HAVE_BUILTIN_OBJECT_SIZE)
if (__builtin_object_size(v.get(), 1) != -1 && dxx_builtin_constant_p(S * C > __builtin_object_size(v.get(), 1)) && S * C > __builtin_object_size(v.get(), 1))
DXX_ALWAYS_ERROR_FUNCTION(dxx_trap_overwrite, "read size exceeds allocated size");
#endif
return PHYSFS_read(file, v.get(), S, C);
}
template <typename V>
static inline PHYSFS_sint64 PHYSFSX_check_read(PHYSFS_file *file, const RAIIdmem<V> &v, PHYSFS_uint32 S, PHYSFS_uint32 C)
{

View file

@ -222,7 +222,7 @@ struct UI_DIALOG
#define B1_JUST_RELEASED (event->type == EVENT_MOUSE_BUTTON_UP && event_mouse_get_button(event) == 0)
#define B1_DOUBLE_CLICKED (event->type == EVENT_MOUSE_DOUBLE_CLICKED && event_mouse_get_button(event) == 0)
extern grs_font * ui_small_font;
extern grs_font_ptr ui_small_font;
extern unsigned char CBLACK,CGREY,CWHITE,CBRIGHT,CRED;
extern UI_GADGET * selected_gadget;

View file

@ -62,7 +62,7 @@ extern float FNTScaleX, FNTScaleY;
#define FSPACY(y) ((float)((y)*(FNTScaleY*(GAME_FONT->ft_h/5))))
#define LINE_SPACING ((float)(FNTScaleY*(grd_curcanv->cv_font->ft_h+(GAME_FONT->ft_h/5))))
extern grs_font *Gamefonts[MAX_FONTS];
extern array<grs_font_ptr, MAX_FONTS> Gamefonts;
void gamefont_init();
void gamefont_close();

View file

@ -321,8 +321,8 @@ static inline void nm_set_item_slider(newmenu_item *ni, const char *text, unsign
#define UP_ARROW_MARKER "+" // 135
#define DOWN_ARROW_MARKER "+" // 136
#elif defined(DXX_BUILD_DESCENT_II)
#define UP_ARROW_MARKER ((grd_curcanv->cv_font==GAME_FONT)?"\202":"\207") // 135
#define DOWN_ARROW_MARKER ((grd_curcanv->cv_font==GAME_FONT)?"\200":"\210") // 136
#define UP_ARROW_MARKER ((grd_curcanv->cv_font==GAME_FONT.get())?"\202":"\207") // 135
#define DOWN_ARROW_MARKER ((grd_curcanv->cv_font==GAME_FONT.get())?"\200":"\210") // 136
#endif
#define BORDERX (15*(SWIDTH/320))

View file

@ -98,7 +98,7 @@ UI_GADGET_ICON * ui_add_gadget_icon( UI_DIALOG * dlg, const char * text, short x
icon->oldposition = 0;
icon->position = 0;
icon->pressed = 0;
icon->canvas->cv_font = ui_small_font;
icon->canvas->cv_font = ui_small_font.get();
// Call twice to get original;
if (f)

View file

@ -107,55 +107,55 @@ void ui_pad_activate( UI_DIALOG * dlg, int x, int y )
n=0; row = 0; col = 0; w = 1; h = 1;
Pad[n] = ui_add_gadget_button( dlg, x+(bw*col), y+(bh*row), bw*w, bh*h, NULL, NULL );
Pad[n]->canvas->cv_font = ui_small_font;
Pad[n]->canvas->cv_font = ui_small_font.get();
n=1; row = 0; col = 1; w = 1; h = 1;
Pad[n] = ui_add_gadget_button( dlg, x+(bw*col), y+(bh*row), bw*w, bh*h, NULL, NULL );
Pad[n]->canvas->cv_font = ui_small_font;
Pad[n]->canvas->cv_font = ui_small_font.get();
n=2; row = 0; col = 2; w = 1; h = 1;
Pad[n] = ui_add_gadget_button( dlg, x+(bw*col), y+(bh*row), bw*w, bh*h, NULL, NULL );
Pad[n]->canvas->cv_font = ui_small_font;
Pad[n]->canvas->cv_font = ui_small_font.get();
n=3; row = 0; col = 3; w = 1; h = 1;
Pad[n] = ui_add_gadget_button( dlg, x+(bw*col), y+(bh*row), bw*w, bh*h, NULL, NULL );
Pad[n]->canvas->cv_font = ui_small_font;
Pad[n]->canvas->cv_font = ui_small_font.get();
n=4; row = 1; col = 0; w = 1; h = 1;
Pad[n] = ui_add_gadget_button( dlg, x+(bw*col), y+(bh*row), bw*w, bh*h, NULL, NULL );
Pad[n]->canvas->cv_font = ui_small_font;
Pad[n]->canvas->cv_font = ui_small_font.get();
n=5; row = 1; col = 1; w = 1; h = 1;
Pad[n] = ui_add_gadget_button( dlg, x+(bw*col), y+(bh*row), bw*w, bh*h, NULL, NULL );
Pad[n]->canvas->cv_font = ui_small_font;
Pad[n]->canvas->cv_font = ui_small_font.get();
n=6; row = 1; col = 2; w = 1; h = 1;
Pad[n] = ui_add_gadget_button( dlg, x+(bw*col), y+(bh*row), bw*w, bh*h, NULL, NULL );
Pad[n]->canvas->cv_font = ui_small_font;
Pad[n]->canvas->cv_font = ui_small_font.get();
n=7; row = 1; col = 3; w = 1; h = 2;
Pad[n] = ui_add_gadget_button( dlg, x+(bw*col), y+(bh*row), bw*w, bh*h, NULL, NULL );
Pad[n]->canvas->cv_font = ui_small_font;
Pad[n]->canvas->cv_font = ui_small_font.get();
n=8; row = 2; col = 0; w = 1; h = 1;
Pad[n] = ui_add_gadget_button( dlg, x+(bw*col), y+(bh*row), bw*w, bh*h, NULL, NULL );
Pad[n]->canvas->cv_font = ui_small_font;
Pad[n]->canvas->cv_font = ui_small_font.get();
n=9; row = 2; col = 1; w = 1; h = 1;
Pad[n] = ui_add_gadget_button( dlg, x+(bw*col), y+(bh*row), bw*w, bh*h, NULL, NULL );
Pad[n]->canvas->cv_font = ui_small_font;
Pad[n]->canvas->cv_font = ui_small_font.get();
n=10; row = 2; col = 2; w = 1; h = 1;
Pad[n] = ui_add_gadget_button( dlg, x+(bw*col), y+(bh*row), bw*w, bh*h, NULL, NULL );
Pad[n]->canvas->cv_font = ui_small_font;
Pad[n]->canvas->cv_font = ui_small_font.get();
n=11; row = 3; col = 0; w = 1; h = 1;
Pad[n] = ui_add_gadget_button( dlg, x+(bw*col), y+(bh*row), bw*w, bh*h, NULL, NULL );
Pad[n]->canvas->cv_font = ui_small_font;
Pad[n]->canvas->cv_font = ui_small_font.get();
n=12; row = 3; col = 1; w = 1; h = 1;
Pad[n] = ui_add_gadget_button( dlg, x+(bw*col), y+(bh*row), bw*w, bh*h, NULL, NULL );
Pad[n]->canvas->cv_font = ui_small_font;
Pad[n]->canvas->cv_font = ui_small_font.get();
n=13; row = 3; col = 2; w = 1; h = 1;
Pad[n] = ui_add_gadget_button( dlg, x+(bw*col), y+(bh*row), bw*w, bh*h, NULL, NULL );
Pad[n]->canvas->cv_font = ui_small_font;
Pad[n]->canvas->cv_font = ui_small_font.get();
n=14; row = 3; col = 3; w = 1; h = 2;
Pad[n] = ui_add_gadget_button( dlg, x+(bw*col), y+(bh*row), bw*w, bh*h, NULL, NULL );
Pad[n]->canvas->cv_font = ui_small_font;
Pad[n]->canvas->cv_font = ui_small_font.get();
n=15; row = 4; col = 0; w = 2; h = 1;
Pad[n] = ui_add_gadget_button( dlg, x+(bw*col), y+(bh*row), bw*w, bh*h, NULL, NULL );
Pad[n]->canvas->cv_font = ui_small_font;
Pad[n]->canvas->cv_font = ui_small_font.get();
n=16; row = 4; col = 2; w = 1; h = 1;
Pad[n] = ui_add_gadget_button( dlg, x+(bw*col), y+(bh*row), bw*w, bh*h, NULL, NULL );
Pad[n]->canvas->cv_font = ui_small_font;
Pad[n]->canvas->cv_font = ui_small_font.get();
HotKey[0] = KEY_CTRLED + KEY_NUMLOCK;
HotKey[1] = KEY_CTRLED + KEY_PADDIVIDE;

View file

@ -59,13 +59,13 @@ static int messagebox_handler(UI_DIALOG *dlg, d_event *event, messagebox *m)
if (event->type == EVENT_UI_DIALOG_DRAW)
{
grs_font * temp_font;
const grs_font * temp_font;
gr_set_current_canvas( &grd_curscreen->sc_canvas );
temp_font = grd_curscreen->sc_canvas.cv_font;
if ( grd_curscreen->sc_w < 640 ) {
grd_curscreen->sc_canvas.cv_font = ui_small_font;
grd_curscreen->sc_canvas.cv_font = ui_small_font.get();
}
ui_dialog_set_current_canvas(dlg);

View file

@ -38,17 +38,16 @@ static int Initialized = 0;
unsigned char CBLACK,CGREY,CWHITE,CBRIGHT,CRED;
grs_font * ui_small_font = NULL;
grs_font_ptr ui_small_font;
void ui_init()
{
grs_font * org_font;
if (Initialized) return;
Initialized = 1;
org_font = grd_curcanv->cv_font;
const grs_font *org_font = grd_curcanv->cv_font;
ui_small_font = gr_init_font( "pc6x8.fnt" );
grd_curcanv->cv_font =org_font;
@ -77,9 +76,7 @@ void ui_close()
menubar_close();
ui_pad_close();
gr_close_font( ui_small_font );
ui_small_font.reset();
}
return;

View file

@ -23,6 +23,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
*
*/
#include <memory>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
@ -47,6 +48,8 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "ogl_init.h"
#endif
#include "compiler-array.h"
#define FONTSCALE_X(x) ((float)(x)*(FNTScaleX))
#define FONTSCALE_Y(x) ((float)(x)*(FNTScaleY))
@ -54,13 +57,14 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
struct openfont
{
char filename[FILENAME_LEN];
array<char, FILENAME_LEN> filename;
// Unowned
grs_font *ptr;
char *dataptr;
std::unique_ptr<uint8_t[]> dataptr;
};
//list of open fonts, for use (for now) for palette remapping
openfont open_font[MAX_OPEN_FONTS];
static array<openfont, MAX_OPEN_FONTS> open_font;
#define BITS_TO_BYTES(x) (((x)+7)>>3)
@ -942,22 +946,15 @@ void (gr_printf)( int x, int y, const char * format, ... )
gr_string( x, y, buffer );
}
void gr_close_font( grs_font * font )
void gr_close_font(std::unique_ptr<grs_font> font)
{
if (font)
{
int fontnum;
char * font_data;
//find font in list
for (fontnum=0;fontnum<MAX_OPEN_FONTS && open_font[fontnum].ptr!=font;fontnum++);
Assert(fontnum<MAX_OPEN_FONTS); //did we find slot?
font_data = open_font[fontnum].dataptr;
d_free( font_data );
open_font[fontnum].ptr = NULL;
open_font[fontnum].dataptr = NULL;
auto e = end(open_font);
auto i = std::find_if(begin(open_font), e, [&font](const openfont &o) { return o.ptr == font.get(); });
if (i == e)
throw std::logic_error("closing non-open font");
if ( font->ft_chars )
d_free( font->ft_chars );
@ -966,13 +963,14 @@ void gr_close_font( grs_font * font )
d_free( font->ft_bitmaps );
gr_free_bitmap_data(&font->ft_parent_bitmap);
#endif
d_free( font );
auto &f = *i;
f.dataptr.reset();
}
}
#if defined(DXX_BUILD_DESCENT_II)
//remap a font, re-reading its data & palette
static void gr_remap_font( grs_font *font, const char * fontname, char *font_data );
static void gr_remap_font( grs_font *font, const char * fontname, uint8_t *font_data );
//remap (by re-reading) all the color fonts
void gr_remap_color_fonts()
@ -985,7 +983,7 @@ void gr_remap_color_fonts()
font = open_font[fontnum].ptr;
if (font && (font->ft_flags & FT_COLOR))
gr_remap_font(font, open_font[fontnum].filename, open_font[fontnum].dataptr);
gr_remap_font(font, &open_font[fontnum].filename[0], open_font[fontnum].dataptr.get());
}
}
@ -997,7 +995,7 @@ void gr_remap_mono_fonts()
grs_font *font;
font = open_font[fontnum].ptr;
if (font && !(font->ft_flags & FT_COLOR))
gr_remap_font(font, open_font[fontnum].filename, open_font[fontnum].dataptr);
gr_remap_font(font, &open_font[fontnum].filename[0], open_font[fontnum].dataptr.get());
}
}
#endif
@ -1020,10 +1018,8 @@ static void grs_font_read(grs_font *gf, PHYSFS_file *fp)
gf->ft_kerndata = (ubyte *)((size_t)PHYSFSX_readInt(fp) - GRS_FONT_SIZE);
}
grs_font * gr_init_font( const char * fontname )
grs_font_ptr gr_init_font( const char * fontname )
{
grs_font *font;
char *font_data;
int i,fontnum;
unsigned char * ptr;
int nchars;
@ -1035,33 +1031,30 @@ grs_font * gr_init_font( const char * fontname )
for (fontnum=0;fontnum<MAX_OPEN_FONTS && open_font[fontnum].ptr!=NULL;fontnum++);
Assert(fontnum<MAX_OPEN_FONTS); //did we find one?
strncpy(open_font[fontnum].filename,fontname,FILENAME_LEN);
strncpy(&open_font[fontnum].filename[0], fontname, FILENAME_LEN);
fontfile = PHYSFSX_openReadBuffered(fontname);
if (!fontfile) {
con_printf(CON_VERBOSE, "Can't open font file %s", fontname);
return NULL;
return {};
}
PHYSFS_read(fontfile, file_id, 4, 1);
if (memcmp( file_id, "PSFN", 4 )) {
con_printf(CON_NORMAL, "File %s is not a font file", fontname);
return NULL;
return {};
}
datasize = PHYSFSX_readInt(fontfile);
datasize -= GRS_FONT_SIZE; // subtract the size of the header.
MALLOC(font, grs_font, 1);
grs_font_read(font, fontfile);
std::unique_ptr<grs_font> font(new grs_font);
grs_font_read(font.get(), fontfile);
MALLOC(font_data, char, datasize);
std::unique_ptr<uint8_t[]> font_data(new uint8_t[datasize]);
PHYSFS_read(fontfile, font_data, 1, datasize);
open_font[fontnum].ptr = font;
open_font[fontnum].dataptr = font_data;
nchars = font->ft_maxchar - font->ft_minchar + 1;
if (font->ft_flags & FT_PROPORTIONAL) {
@ -1083,7 +1076,7 @@ grs_font * gr_init_font( const char * fontname )
} else {
font->ft_data = (unsigned char *) font_data;
font->ft_data = font_data.get();
font->ft_chars = NULL;
font->ft_widths = NULL;
@ -1111,20 +1104,22 @@ grs_font * gr_init_font( const char * fontname )
//set curcanv vars
grd_curcanv->cv_font = font;
grd_curcanv->cv_font = font.get();
grd_curcanv->cv_font_fg_color = 0;
grd_curcanv->cv_font_bg_color = 0;
#ifdef OGL
ogl_init_font(font);
ogl_init_font(font.get());
#endif
return font;
open_font[fontnum].ptr = font.get();
open_font[fontnum].dataptr = move(font_data);
return grs_font_ptr(font.release());
}
#if defined(DXX_BUILD_DESCENT_II)
//remap a font by re-reading its data & palette
void gr_remap_font( grs_font *font, const char * fontname, char *font_data )
void gr_remap_font( grs_font *font, const char * fontname, uint8_t *font_data )
{
int i;
int nchars;
@ -1210,7 +1205,7 @@ void gr_remap_font( grs_font *font, const char * fontname, char *font_data )
}
#endif
void gr_set_curfont( grs_font * n)
void gr_set_curfont(const grs_font *n)
{
grd_curcanv->cv_font = n;
}

View file

@ -117,7 +117,7 @@ grs_canvas *Canv_editor_game=&_canv_editor_game; //the game on the editor screen
window *Pad_info; // Keypad text
grs_font *editor_font=NULL;
grs_font_ptr editor_font;
//where the editor is looking
vms_vector Ed_view_target=ZERO_VECTOR;
@ -730,12 +730,12 @@ void init_editor_screen()
if (editor_screen_open) return;
grd_curscreen->sc_canvas.cv_font = editor_font;
grd_curscreen->sc_canvas.cv_font = editor_font.get();
//create canvas for game on the editor screen
initializing = 1;
gr_set_current_canvas(Canv_editor);
Canv_editor->cv_font = editor_font;
Canv_editor->cv_font = editor_font.get();
gr_init_sub_canvas(Canv_editor_game,Canv_editor,GAMEVIEW_X,GAMEVIEW_Y,GAMEVIEW_W,GAMEVIEW_H);
//Editor renders into full (320x200) game screen
@ -898,7 +898,7 @@ void close_editor() {
ui_close();
gr_close_font(editor_font);
editor_font.reset();
PHYSFSX_removeRelFromSearchPath("editor/data");
PHYSFSX_removeRelFromSearchPath("editor");

View file

@ -219,7 +219,7 @@ int texpage_do(d_event *event)
if (event->type == EVENT_UI_DIALOG_DRAW)
{
gr_set_current_canvas( TmapnameCanvas );
gr_set_curfont( ui_small_font );
gr_set_curfont( ui_small_font.get() );
gr_set_fontcolor( CBLACK, CWHITE );
texpage_redraw();

View file

@ -52,7 +52,7 @@ static const char Gamefont_filenames_h[][16] = {
"font3-1h.fnt" // Font 4
};
grs_font *Gamefonts[MAX_FONTS];
array<grs_font_ptr, MAX_FONTS> Gamefonts;
int Gamefont_installed=0;
float FNTScaleX = 1, FNTScaleY = 1;
@ -81,8 +81,7 @@ static void gamefont_unloadfont(int gf)
{
if (Gamefonts[gf]){
font_conf[gf].cur=-1;
gr_close_font(Gamefonts[gf]);
Gamefonts[gf]=NULL;
Gamefonts[gf].reset();
}
}
@ -92,7 +91,7 @@ static void gamefont_loadfont(int gf,int fi)
gamefont_unloadfont(gf);
Gamefonts[gf]=gr_init_font(font_conf[gf].font[fi].f.name);
}else {
if (Gamefonts[gf]==NULL){
if (!Gamefonts[gf]){
Gamefonts[gf]=gr_init_font(Gamefont_filenames_l[gf]);
font_conf[gf].cur=-1;
}

View file

@ -818,7 +818,6 @@ static int get_item_height(const kc_item &item, const kc_mitem &mitem)
static void kconfig_draw(kc_menu *menu)
{
grs_canvas * save_canvas = grd_curcanv;
grs_font * save_font;
int w = FSPACX(290), h = FSPACY(170);
gr_set_current_canvas(NULL);
@ -826,13 +825,13 @@ static void kconfig_draw(kc_menu *menu)
gr_set_current_canvas(window_get_canvas(menu->wind));
save_font = grd_curcanv->cv_font;
grd_curcanv->cv_font = MEDIUM3_FONT;
const grs_font *save_font = grd_curcanv->cv_font;
gr_set_curfont(MEDIUM3_FONT);
Assert(!strchr( menu->title, '\n' ));
gr_string( 0x8000, FSPACY(8), menu->title );
grd_curcanv->cv_font = GAME_FONT;
gr_set_curfont(GAME_FONT);
gr_set_fontcolor( BM_XRGB(28,28,28), -1 );
gr_string( 0x8000, FSPACY(21), "Enter changes, ctrl-d deletes, ctrl-r resets defaults, ESC exits");
gr_set_fontcolor( BM_XRGB(28,28,28), -1 );

View file

@ -166,7 +166,7 @@ static void kmatrix_draw_coop_names(int *)
static void kmatrix_status_msg (fix time, int reactor)
{
grd_curcanv->cv_font = GAME_FONT;
gr_set_curfont(GAME_FONT);
gr_set_fontcolor(gr_find_closest_color(255,255,255),-1);
if (reactor)
@ -198,7 +198,7 @@ static void kmatrix_redraw(kmatrix_screen *km)
else
{
multi_sort_kill_list();
grd_curcanv->cv_font = MEDIUM3_FONT;
gr_set_curfont(MEDIUM3_FONT);
#if defined(DXX_BUILD_DESCENT_II)
if (game_mode_capture_flag())
@ -209,7 +209,7 @@ static void kmatrix_redraw(kmatrix_screen *km)
#endif
gr_string( 0x8000, FSPACY(10), TXT_KILL_MATRIX_TITLE);
grd_curcanv->cv_font = GAME_FONT;
gr_set_curfont(GAME_FONT);
multi_get_kill_list(sorted);
kmatrix_draw_names(sorted);
@ -238,9 +238,9 @@ static void kmatrix_redraw_coop()
int sorted[MAX_PLAYERS];
multi_sort_kill_list();
grd_curcanv->cv_font = MEDIUM3_FONT;
gr_set_curfont(MEDIUM3_FONT);
gr_string( 0x8000, FSPACY(10), "COOPERATIVE SUMMARY");
grd_curcanv->cv_font = GAME_FONT;
gr_set_curfont(GAME_FONT);
multi_get_kill_list(sorted);
kmatrix_draw_coop_names(sorted);

View file

@ -5170,14 +5170,12 @@ static int show_game_rules_handler(window *wind, d_event *event, netgame_info *n
nm_draw_background(((SWIDTH-w)/2)-BORDERX,((SHEIGHT-h)/2)-BORDERY,((SWIDTH-w)/2)+w+BORDERX,((SHEIGHT-h)/2)+h+BORDERY);
gr_set_current_canvas(window_get_canvas(wind));
grd_curcanv->cv_font = MEDIUM3_FONT;
gr_set_curfont(MEDIUM3_FONT);
gr_set_fontcolor(gr_find_closest_color_current(29,29,47),-1);
#if defined(DXX_BUILD_DESCENT_I)
gr_string( 0x8000, FSPACY(35), "NETGAME INFO" );
grd_curcanv->cv_font = GAME_FONT;
gr_set_curfont(GAME_FONT);
gr_printf( FSPACX( 25),FSPACY( 55), "Reactor Life:");
gr_printf( FSPACX( 25),FSPACY( 61), "Max Time:");
gr_printf( FSPACX( 25),FSPACY( 67), "Kill Goal:");
@ -5226,7 +5224,7 @@ static int show_game_rules_handler(window *wind, d_event *event, netgame_info *n
#elif defined(DXX_BUILD_DESCENT_II)
gr_string( 0x8000, FSPACY(15), "NETGAME INFO");
grd_curcanv->cv_font = GAME_FONT;
gr_set_curfont(GAME_FONT);
gr_string( FSPACX( 25),FSPACY( 35), "Reactor Life:");
gr_string( FSPACX( 25),FSPACY( 41), "Max Time:");
gr_string( FSPACX( 25),FSPACY( 47), "Kill Goal:");

View file

@ -1153,7 +1153,6 @@ static void newmenu_create_structure( newmenu *menu )
{
int i,j,aw, tw, th, twidth,fm,right_offset;
int nmenus, nothers;
grs_font *save_font;
grs_canvas *save_canvas;
int string_width, string_height, average_width;
@ -1161,7 +1160,7 @@ static void newmenu_create_structure( newmenu *menu )
gr_set_current_canvas(NULL);
save_font = grd_curcanv->cv_font;
const grs_font *save_font = grd_curcanv->cv_font;
tw = th = 0;

View file

@ -415,13 +415,9 @@ static int scores_handler(window *wind, d_event *event, scores_menu *menu)
nm_draw_background(((SWIDTH-w)/2)-BORDERX,((SHEIGHT-h)/2)-BORDERY,((SWIDTH-w)/2)+w+BORDERX,((SHEIGHT-h)/2)+h+BORDERY);
gr_set_current_canvas(window_get_canvas(wind));
grd_curcanv->cv_font = MEDIUM3_FONT;
gr_set_curfont(MEDIUM3_FONT);
gr_string( 0x8000, FSPACY(15), TXT_HIGH_SCORES );
grd_curcanv->cv_font = GAME_FONT;
gr_set_curfont(GAME_FONT);
gr_set_fontcolor( BM_XRGB(31,26,5), -1 );
gr_string( FSPACX( 71), FSPACY(50), TXT_NAME );
gr_string( FSPACX(122), FSPACY(50), TXT_SCORE );