Difference for main/newmenu.c from version 1.8 to 1.9


version 1.8 version 1.9
Line 19
 
Line 19
  * Routines for menus.   * Routines for menus.
  *    *
  * $Log$   * $Log$
    * Revision 1.9  2000/10/27 02:58:00  donut
    * menu background drawing correctly scaled at high res instead of being squished.  made nm_restore_background scale as well
    *
  * Revision 1.8  2000/01/19 04:59:50  donut   * Revision 1.8  2000/01/19 04:59:50  donut
  * increased MESSAGEBOX_TEXT_SIZE to fix netgame join list score crash   * increased MESSAGEBOX_TEXT_SIZE to fix netgame join list score crash
  *   *
Line 617
 
Line 620
 // x2 = x1 + w - 1;  // x2 = x1 + w - 1;
 // y2 = y1 + h - 1;  // y2 = y1 + h - 1;
    
  if ( w > nm_background.bm_w || h > nm_background.bm_h ){//Resize background to fit.  Perhaps it should resize so that the original aspect is preserved, but this looks fine. -MPM   if ( GWIDTH > nm_background.bm_w || GHEIGHT > nm_background.bm_h ){//Resize background to fit.  Resize so that the original aspect is preserved. -MPM
  grs_canvas *tmp,*old;   grs_canvas *tmp,*old;
    grs_bitmap bg;
  old=grd_curcanv;   old=grd_curcanv;
  tmp=gr_create_sub_canvas(old,x1,y1,w,h);   tmp=gr_create_sub_canvas(old,x1,y1,w,h);
    gr_init_sub_bitmap(&bg,&nm_background,0,0,w*(320.0/GWIDTH),h*(200.0/GHEIGHT));//note that we haven't replaced current_canvas yet, so these macros are still ok.
  gr_set_current_canvas(tmp);   gr_set_current_canvas(tmp);
  show_fullscr( &nm_background );   show_fullscr( &bg );
  gr_set_current_canvas(old);   gr_set_current_canvas(old);
  gr_free_sub_canvas(tmp);   gr_free_sub_canvas(tmp);
  }else{   }else{
Line 659
 
Line 664
  if ( x1 < 0 ) x1 = 0;   if ( x1 < 0 ) x1 = 0;
  if ( y1 < 0 ) y1 = 0;   if ( y1 < 0 ) y1 = 0;
   
  if ( x2 >= nm_background.bm_w ) x2=nm_background.bm_w-1;   if ( x2 >= GWIDTH ) x2=GWIDTH-1;
  if ( y2 >= nm_background.bm_h ) y2=nm_background.bm_h-1;   if ( y2 >= GHEIGHT ) y2=GHEIGHT-1;
   
  w = x2 - x1 + 1;   w = x2 - x1 + 1;
  h = y2 - y1 + 1;   h = y2 - y1 + 1;
   
    if (GWIDTH > nm_background.bm_w || GHEIGHT > nm_background.bm_h){
    grs_bitmap sbg;
    grs_canvas *tmp,*old;
    old=grd_curcanv;
    tmp=gr_create_sub_canvas(old,x1,y1,w,h);
    gr_init_sub_bitmap(&sbg,&nm_background,x1*(320.0/GWIDTH),y1*(200.0/GHEIGHT),w*(320.0/GWIDTH),h*(200.0/GHEIGHT));//use the correctly resized portion of the background. -MPM
    gr_set_current_canvas(tmp);
    show_fullscr( &sbg );
    gr_set_current_canvas(old);
    gr_free_sub_canvas(tmp);
    }else{
  gr_bm_bitblt(w, h, x1, y1, x1, y1, &nm_background, &(grd_curcanv->cv_bitmap) );   gr_bm_bitblt(w, h, x1, y1, x1, y1, &nm_background, &(grd_curcanv->cv_bitmap) );
 }  }
   }
   
 // Draw a left justfied string  // Draw a left justfied string
 void nm_string( bkg * b, int w1,int x, int y, char * s )  void nm_string( bkg * b, int w1,int x, int y, char * s )
Line 1175
 
Line 1192
 #endif  #endif
 //end changes - adb  //end changes - adb
  nm_draw_background(x,y,x+w-1,y+h-1);   nm_draw_background(x,y,x+w-1,y+h-1);
  if (w > nm_background.bm_w || h > nm_background.bm_h){   if (GWIDTH > nm_background.bm_w || GHEIGHT > nm_background.bm_h){
    grs_bitmap sbg;
    gr_init_sub_bitmap(&sbg,&nm_background,0,0,w*(320.0/GWIDTH),h*(200.0/GHEIGHT));//use the correctly resized portion of the background instead of the whole thing -MPM
  bg.background=gr_create_bitmap(w,h);   bg.background=gr_create_bitmap(w,h);
  gr_bitmap_scale_to(&nm_background,bg.background);   gr_bitmap_scale_to(&sbg,bg.background);
  bg.background_is_sub=0;   bg.background_is_sub=0;
  }else{   }else{
  bg.background = gr_create_sub_bitmap(&nm_background,0,0,w,h);   bg.background = gr_create_sub_bitmap(&nm_background,0,0,w,h);
Line 2483
 
Line 2502
  gr_bm_bitblt(w, h, 0, 0, 0, 0, &grd_curcanv->cv_bitmap, bg.saved );   gr_bm_bitblt(w, h, 0, 0, 0, 0, &grd_curcanv->cv_bitmap, bg.saved );
  gr_set_current_canvas( NULL );   gr_set_current_canvas( NULL );
  nm_draw_background(x,y,x+w-1,y+h-1);   nm_draw_background(x,y,x+w-1,y+h-1);
  if (w > nm_background.bm_w || h > nm_background.bm_h){   if (GWIDTH > nm_background.bm_w || GHEIGHT > nm_background.bm_h){
    grs_bitmap sbg;
    gr_init_sub_bitmap(&sbg,&nm_background,0,0,w*(320.0/GWIDTH),h*(200.0/GHEIGHT));//use the correctly resized portion of the background instead of the whole thing -MPM
  bg.background=gr_create_bitmap(w,h);   bg.background=gr_create_bitmap(w,h);
  gr_bitmap_scale_to(&nm_background,bg.background);   gr_bitmap_scale_to(&sbg,bg.background);
  bg.background_is_sub=0;   bg.background_is_sub=0;
  }else{   }else{
  bg.background = gr_create_sub_bitmap(&nm_background,0,0,w,h);   bg.background = gr_create_sub_bitmap(&nm_background,0,0,w,h);

Legend:
line(s) removed in v.1.8 
line(s) changed
 line(s) added in v.1.9