palette-related fixes for Doublebuffered menus; fixes for SDL-build

This commit is contained in:
zicodxx 2007-03-29 00:13:08 +00:00
parent 1851b7d1fe
commit add8710081
4 changed files with 29 additions and 26 deletions

View file

@ -1,5 +1,9 @@
D1X-Rebirth Changelog
20070329
--------
main/automap.c, main/game.c, main/newmenu.c: palette-related fixes for Doublebuffered menus; fixes for SDL-build
20070326
--------
main/game.c, main/menu.c: unbind Minus/Equal from Shrink/Grow-window - only use ALT-F9/F10 to get richt with all keyboard layouts; Always allow screen resolution switching, even if selected is not supported to ensure Multi-Monitor support

View file

@ -230,18 +230,7 @@ void modex_printf(int x,int y,char *s,grs_font *font,int color)
void modex_print_message(int x, int y, char *str)
{
#ifndef OGL
int i;
for (i=0; i<2; i++ ) {
gr_set_current_canvas(&Pages[i]);
#endif
modex_printf(x, y, str, (grs_font *)GFONT_MEDIUM_1,Green_31);
#ifndef OGL
}
gr_set_current_canvas(&DrawingPages[current_page]);
#endif
modex_printf(x, y, str, (grs_font *)GFONT_MEDIUM_1,Green_31);
}
//name for each group. maybe move somewhere else

View file

@ -1686,10 +1686,6 @@ void show_boxed_message(char *msg)
int w,h,aw;
int x,y;
#ifdef OGL
gr_clear_canvas(0);
#endif
gr_set_current_canvas(NULL);
gr_set_curfont( HELP_FONT );

View file

@ -91,8 +91,10 @@ grs_bitmap nm_background1;
extern void gr_bm_bitblt(int w, int h, int dx, int dy, int sx, int sy, grs_bitmap * src, grs_bitmap * dest);
void newmenu_close() {
gr_free_bitmap_data ( &nm_background );
gr_free_bitmap_data ( &nm_background1 );
if (nm_background.bm_data)
free(nm_background.bm_data);
if (nm_background1.bm_data)
free(nm_background1.bm_data);
}
// Draw Copyright and Version strings
@ -110,7 +112,11 @@ void nm_draw_background1(char * filename)
{
int pcx_error;
#ifdef OGL
#ifndef OGL
if (nm_background1.bm_data)
free(nm_background1.bm_data);
#else
if (filename == NULL && Function_mode == FMODE_MENU)
filename = Menu_pcx_name;
if (filename != NULL)
@ -122,7 +128,7 @@ void nm_draw_background1(char * filename)
gr_init_bitmap_data (&nm_background1);
pcx_error = pcx_read_bitmap( filename, &nm_background1, BM_LINEAR, newpal );
Assert(pcx_error == PCX_ERROR_NONE);
gr_remap_bitmap_good( &nm_background, newpal, -1, -1 );
// gr_remap_bitmap_good( &nm_background, newpal, -1, -1 );
}
#ifndef OGL
show_fullscr(&nm_background1);
@ -140,7 +146,13 @@ void nm_draw_background(int x1, int y1, int x2, int y2 )
{
int w,h;
if (nm_background.bm_data == NULL) {
#ifndef OGL
if (nm_background.bm_data)
free(nm_background.bm_data);
#else
if (nm_background.bm_data == NULL)
#endif
{
int pcx_error;
ubyte newpal[768];
atexit( newmenu_close );
@ -1333,6 +1345,8 @@ int newmenu_do3_real( char * title, char * subtitle, int nitems, newmenu_item *
gr_set_current_canvas( save_canvas );
keyd_repeat = old_keyd_repeat;
newmenu_close();
game_flush_inputs();
if (time_stopped)
@ -1606,13 +1620,9 @@ ReadFileNames:
bg.background = gr_create_bitmap( w_w, w_h );
#ifdef OGL
bg.background->bm_type = BM_OGL; // glReadPixels isn't supported on all configurations, so just make it redraw (blitting BM_OGL to BM_OGL does nothing currently)
#endif
Assert( bg.background != NULL );
gr_bm_bitblt(GWIDTH, GHEIGHT, 0, 0, 0, 0, &(grd_curcanv->cv_bitmap), &(VR_offscreen_buffer->cv_bitmap) );
gr_bm_bitblt(w_w, w_h, 0, 0, w_x, w_y, &grd_curcanv->cv_bitmap, bg.background );
nm_draw_background( w_x,w_y,w_x+w_w-1,w_y+w_h );
@ -1921,6 +1931,8 @@ ReadFileNames:
}
}
newmenu_close();
ExitFileMenuEarly:
if ( citem > -1 ) {
strncpy( filename, (&filenames[citem*14])+((player_mode && filenames[citem*14]=='$')?1:0), 13 );
@ -2255,6 +2267,8 @@ int newmenu_listbox1( char * title, int nitems, char * items[], int allow_abort_
if ( bg.background != &VR_offscreen_buffer->cv_bitmap )
gr_free_bitmap(bg.background);
newmenu_close();
return citem;
}