Move copyright drawing to main menu's event handler for tidiness

This commit is contained in:
kreatordxx 2010-04-03 10:16:53 +00:00
parent eb0458ba5f
commit 643c57614b
4 changed files with 18 additions and 23 deletions

View file

@ -5,6 +5,7 @@ D1X-Rebirth Changelog
arch/sdl/mouse.c, main/game.c, main/net_ipx.c, main/net_ipx.h, main/newmenu.c, main/newmenu.h, main/state.c: Make newmenu_do3 and newmenu_dotiny return as soon as the newmenu is created, which will allow the main menu (and others) to persist
main/menu.c: Make main menu persist to streamline redrawing (later)
main/kconfig.c, main/menu.h, main/net_ipx.c, main/net_udp.c, main/newmenu.c, main/scores.c: Remove calls to nm_draw_background1 to show newmenus stacked
main/menu.c, main/newmenu.c, main/scores.c: Move copyright drawing to main menu's event handler for tidiness
20100402
--------

View file

@ -375,6 +375,17 @@ int RegisterPlayer()
return 1;
}
// Draw Copyright and Version strings
void draw_copyright()
{
gr_set_current_canvas(NULL);
gr_set_curfont(GAME_FONT);
gr_set_fontcolor(BM_XRGB(6,6,6),-1);
gr_printf(0x8000,SHEIGHT-LINE_SPACING,TXT_COPYRIGHT);
gr_set_fontcolor( BM_XRGB(25,0,0), -1);
gr_printf(0x8000,SHEIGHT-(LINE_SPACING*2),DESCENT_VERSION);
}
int main_menu_handler(newmenu *menu, d_event *event, int *menu_choice )
{
int curtime;
@ -407,6 +418,10 @@ int main_menu_handler(newmenu *menu, d_event *event, int *menu_choice )
}
break;
case EVENT_NEWMENU_DRAW:
draw_copyright();
break;
case EVENT_NEWMENU_SELECTED:
return do_option(menu_choice[newmenu_get_citem(menu)]);
break;

View file

@ -96,7 +96,6 @@ grs_bitmap nm_background, nm_background1;
grs_bitmap *nm_background_sub = NULL;
ubyte MenuReordering=0;
ubyte SurfingNet=0;
static int draw_copyright=0;
newmenu *newmenu_do4( char * title, char * subtitle, int nitems, newmenu_item * item, int (*subfunction)(newmenu *menu, d_event *event, void *userdata), void *userdata, int citem, char * filename, int width, int height, int TinyMode );
@ -114,17 +113,7 @@ void newmenu_close() {
gr_free_bitmap_data (&nm_background1);
}
// Draw Copyright and Version strings
void nm_draw_copyright()
{
gr_set_curfont(GAME_FONT);
gr_set_fontcolor(BM_XRGB(6,6,6),-1);
gr_printf(0x8000,SHEIGHT-LINE_SPACING,TXT_COPYRIGHT);
gr_set_fontcolor( BM_XRGB(25,0,0), -1);
gr_printf(0x8000,SHEIGHT-(LINE_SPACING*2),DESCENT_VERSION);
}
// Draws the background of menus (i.e. Descent Logo screen)
// Draws the custom menu background pcx, if available
void nm_draw_background1(char * filename)
{
int pcx_error;
@ -136,16 +125,9 @@ void nm_draw_background1(char * filename)
gr_init_bitmap_data (&nm_background1);
pcx_error = pcx_read_bitmap( filename, &nm_background1, BM_LINEAR, gr_palette );
Assert(pcx_error == PCX_ERROR_NONE);
if (!strcmp(filename,Menu_pcx_name))
draw_copyright=1;
else
draw_copyright=0;
}
gr_palette_load( gr_palette );
show_fullscr(&nm_background1);
if (draw_copyright)
nm_draw_copyright();
}
}

View file

@ -71,8 +71,6 @@ typedef struct all_scores {
stats_info stats[MAX_HIGH_SCORES];
} __pack__ all_scores;
extern void nm_draw_background1(char * filename);
void scores_read(all_scores *scores)
{
@ -360,8 +358,6 @@ int scores_handler(window *wind, d_event *event, scores_menu *menu)
case EVENT_WINDOW_DRAW:
gr_set_current_canvas(NULL);
if (Game_wind)
nm_draw_background1(Menu_pcx_name); // haven't closed the game yet, need to draw menu pcx here
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));
@ -439,6 +435,7 @@ void scores_view(stats_info *last_game, int citem)
scores_read(&menu->scores);
set_screen_mode(SCREEN_MENU);
show_menus();
window_create(&grd_curscreen->sc_canvas, (SWIDTH - FSPACX(320))/2, (SHEIGHT - FSPACY(200))/2, FSPACX(320), FSPACY(200),
(int (*)(window *, d_event *, void *))scores_handler, menu);