| version 1.2 | | version 1.3 |
|---|
| | |
| * Routines to display the credits. | | * Routines to display the credits. |
| * | | * |
| * $Log$ | | * $Log$ |
| | | * Revision 1.3 1999/11/20 10:05:16 donut |
| | | * variable size menu patch from Jan Bobrowski. Variable menu font size support and a bunch of fixes for menus that didn't work quite right, by me (MPM). |
| | | * |
| * Revision 1.2 1999/08/05 22:53:41 sekmu | | * Revision 1.2 1999/08/05 22:53:41 sekmu |
| * | | * |
| * D3D patch(es) from ADB | | * D3D patch(es) from ADB |
| | |
| #include "compbit.h" | | #include "compbit.h" |
| #include "songs.h" | | #include "songs.h" |
| | | |
| #define ROW_SPACING 11 | | //#define ROW_SPACING 11 |
| #define NUM_LINES 20 //19 | | //#define NUM_LINES 20 //19 |
| | | |
| ubyte fade_values[200] = { 1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,8,9,9,10,10, | | ubyte fade_values[200] = { 1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,8,9,9,10,10, |
| 11,11,12,12,12,13,13,14,14,15,15,15,16,16,17,17,17,18,18,19,19,19,20,20, | | 11,11,12,12,12,13,13,14,14,15,15,15,16,16,17,17,17,18,18,19,19,19,20,20, |
| | |
| { | | { |
| int i, j, l, done; | | int i, j, l, done; |
| CFILE * file; | | CFILE * file; |
| char buffer[NUM_LINES][80]; | | char (*buffer)[80]; |
| grs_bitmap backdrop; | | grs_bitmap backdrop; |
| | | grs_canvas menucanv; |
| ubyte backdrop_palette[768]; | | ubyte backdrop_palette[768]; |
| int pcx_error; | | int pcx_error; |
| int buffer_line = 0; | | int buffer_line = 0; |
| fix last_time; | | fix last_time; |
| fix time_delay = 4180; // ~ F1_0 / 12.9 | | fix time_delay = 4180*200/SHEIGHT; // ~ F1_0 / 12.9 |
| int first_line_offset,extra_inc=0; | | int first_line_offset,extra_inc=0; |
| int have_bin_file = 0; | | int have_bin_file = 0; |
| | | ubyte *fade_values_scalled; |
| | | int num_lines; |
| char * tempp; | | char * tempp; |
| | | int ROW_SPACING; |
| | | |
| | | gr_use_palette_table( "credits.256" ); |
| | | //we need to reload the fonts, because we are using a different palette. But we also want to load the correct sized font. Thus, the gamefont_curfontname() calls. -MPM |
| | | header_font = gr_init_font( gamefont_curfontname(0));// "font1-1.fnt" ); |
| | | title_font = gr_init_font( gamefont_curfontname(3));//"font2-3.fnt" ); |
| | | names_font = gr_init_font( gamefont_curfontname(2));//"font2-2.fnt" ); |
| | | ROW_SPACING=names_font->ft_h+1; |
| | | |
| | | l = SHEIGHT; |
| | | fade_values_scalled = malloc(l); |
| | | scale_line(fade_values, fade_values_scalled, 200, l);//hey, why not? Its just a one dimensional bitmap :) -MPM |
| | | |
| | | // memset(fade_values_scalled, 31, l); |
| | | // memcpy(fade_values_scalled, fade_values, 100); |
| | | // memcpy(fade_values_scalled+l-100, fade_values+100, 100); |
| set_screen_mode(SCREEN_MENU); | | set_screen_mode(SCREEN_MENU); |
| | | num_lines = l/ROW_SPACING + 1; |
| | | buffer = malloc(num_lines*80);// l*80); <--typo? -MPM |
| | | |
| // Clear out all tex buffer lines. | | // Clear out all tex buffer lines. |
| for (i=0; i<NUM_LINES; i++ ) buffer[i][0] = 0; | | for (i=0; i<num_lines; i++ ) buffer[i][0] = 0; |
| | | |
| have_bin_file = 0; | | have_bin_file = 0; |
| file = cfopen( "credits.tex", "rb" ); | | file = cfopen( "credits.tex", "rb" ); |
| | |
| have_bin_file = 1; | | have_bin_file = 1; |
| } | | } |
| | | |
| gr_use_palette_table( "credits.256" ); | | |
| header_font = gr_init_font( "font1-1.fnt" ); | | |
| title_font = gr_init_font( "font2-3.fnt" ); | | |
| names_font = gr_init_font( "font2-2.fnt" ); | | |
| gr_init_bitmap_data (&backdrop); | | gr_init_bitmap_data (&backdrop); |
| pcx_error = pcx_read_bitmap("stars.pcx",&backdrop,grd_curcanv->cv_bitmap.bm_type,backdrop_palette); | | pcx_error = pcx_read_bitmap("stars.pcx",&backdrop,BM_LINEAR,//grd_curcanv->cv_bitmap.bm_type, |
| | | backdrop_palette); |
| if (pcx_error != PCX_ERROR_NONE) { | | if (pcx_error != PCX_ERROR_NONE) { |
| cfclose(file); | | cfclose(file); |
| return; | | return; |
| | |
| | | |
| gr_remap_bitmap_good( &backdrop,backdrop_palette, -1, -1 ); | | gr_remap_bitmap_good( &backdrop,backdrop_palette, -1, -1 ); |
| | | |
| | | gr_init_sub_canvas(&menucanv, VR_offscreen_menu, 0, 0, SWIDTH, SHEIGHT);//if the game res higher than the menu res, VR_offscreen_menu is too big. -MPM |
| | | |
| gr_set_current_canvas(NULL); | | gr_set_current_canvas(NULL); |
| gr_bitmap(0,0,&backdrop); | | show_fullscr(&backdrop); |
| | | |
| gr_update(); | | gr_update(); |
| | | |
| | |
| | | |
| | | |
| | | |
| buffer_line = (buffer_line+1) % NUM_LINES; | | buffer_line = (buffer_line+1) % num_lines; |
| if (cfgets( buffer[buffer_line], 80, file )) { | | if (cfgets( buffer[buffer_line], 80, file )) { |
| char *p; | | char *p; |
| if (have_bin_file) { // is this a binary tbl file | | if (have_bin_file) { // is this a binary tbl file |
| | |
| | | |
| y = first_line_offset - i; | | y = first_line_offset - i; |
| | | |
| gr_set_current_canvas(VR_offscreen_menu); | | //gr_set_current_canvas(VR_offscreen_menu); |
| gr_bitmap(0,0,&backdrop); | | gr_set_current_canvas(&menucanv); |
| for (j=0; j<NUM_LINES; j++ ) { | | show_fullscr(&backdrop); |
| | | for (j=0; j<num_lines; j++ ) { |
| char *s; | | char *s; |
| | | |
| l = (buffer_line + j + 1 ) % NUM_LINES; | | l = (buffer_line + j + 1 ) % num_lines; |
| s = buffer[l]; | | s = buffer[l]; |
| | | |
| if ( s[0] == '!' ) { | | if ( s[0] == '!' ) { |
| | |
| } else | | } else |
| grd_curcanv->cv_font = names_font; | | grd_curcanv->cv_font = names_font; |
| | | |
| gr_bitblt_fade_table = fade_values; | | gr_bitblt_fade_table = fade_values_scalled; |
| | | |
| tempp = strchr( s, '\t' ); | | tempp = strchr( s, '\t' ); |
| if ( tempp ) { | | if ( tempp ) { |
| | |
| else | | else |
| y += ROW_SPACING; | | y += ROW_SPACING; |
| } | | } |
| gr_bm_ubitblt(320, 200, 0, 0, 0, 0, &(VR_offscreen_menu->cv_bitmap), &(grd_curscreen->sc_canvas.cv_bitmap) ); | | gr_bm_ubitblt( |
| | | GWIDTH, GHEIGHT, |
| | | 0, 0, 0, 0, |
| | | &VR_offscreen_menu->cv_bitmap, |
| | | &grd_curscreen->sc_canvas.cv_bitmap |
| | | ); |
| | | |
| gr_update(); | | gr_update(); |
| | | |
| | |
| k = 0; | | k = 0; |
| } | | } |
| | | |
| if ((k>0)||(done>NUM_LINES)) { | | if ((k>0)||(done>num_lines)) { |
| gr_close_font(header_font); | | gr_close_font(header_font); |
| gr_close_font(title_font); | | gr_close_font(title_font); |
| gr_close_font(names_font); | | gr_close_font(names_font); |
| | |
| gr_free_bitmap_data (&backdrop); | | gr_free_bitmap_data (&backdrop); |
| cfclose(file); | | cfclose(file); |
| songs_play_song( SONG_TITLE, 1 ); | | songs_play_song( SONG_TITLE, 1 ); |
| | | free(fade_values_scalled); |
| return; | | return; |
| } | | } |
| } | | } |
| | | |
| if (buffer[(buffer_line + 1 ) % NUM_LINES][0] == '!') { | | if (buffer[(buffer_line + 1 ) % num_lines][0] == '!') { |
| first_line_offset -= ROW_SPACING-ROW_SPACING/2; | | first_line_offset -= ROW_SPACING-ROW_SPACING/2; |
| if (first_line_offset <= -ROW_SPACING) { | | if (first_line_offset <= -ROW_SPACING) { |
| first_line_offset += ROW_SPACING; | | first_line_offset += ROW_SPACING; |