Esempio n. 1
0
static void display_win32_alert(const char *message, int error)
{
	window	*wind;

	// Handle Descent's windows properly
	if ((wind = window_get_front()))
	{
		const d_event event{EVENT_WINDOW_DEACTIVATED};
		WINDOW_SEND_EVENT(wind);
	}

	int fullscreen = (grd_curscreen && gr_check_fullscreen());
	if (fullscreen)
		gr_toggle_fullscreen();

	MessageBox(NULL, message, error?"Sorry, a critical error has occurred.":"Attention!", error?MB_OK|MB_ICONERROR:MB_OK|MB_ICONWARNING);

	if ((wind = window_get_front()))
	{
		const d_event event{EVENT_WINDOW_ACTIVATED};
		WINDOW_SEND_EVENT(wind);
	}
	
	if (!error && fullscreen)
		gr_toggle_fullscreen();
}
Esempio n. 2
0
void change_res()
{
 //edited 05/27/99 Matt Mueller - ingame fullscreen changing
 newmenu_item m[11];
 u_int32_t modes[11];
 int i=0, mc=0, num_presets=0;
 char customres[16];
#ifdef GR_SUPPORTS_FULLSCREEN_TOGGLE
 int fullscreenc;
#endif
 //end edit -MM
 u_int32_t screen_mode = 0;
 int screen_width = 0;
 int screen_height = 0;
 int vr_mode = VR_NONE;
 int screen_compatible = 0;
 int use_double_buffer = 0;
 
//changed 6/15/1999 by Owen Evans to fix some platform-related problems
#ifdef __MSDOS__
 m[mc].type = NM_TYPE_RADIO; m[mc].text = "320x100"; m[mc].value=(Game_screen_mode==SM(320,100)); m[mc].group=0; modes[mc] = SM(320,100); mc++;
#endif
 m[mc].type = NM_TYPE_RADIO; m[mc].text = "320x200"; m[mc].value=(Game_screen_mode==SM(320,200)); m[mc].group=0; modes[mc] = SM(320,200); mc++;
 m[mc].type = NM_TYPE_RADIO; m[mc].text = "320x240"; m[mc].value=(Game_screen_mode==SM(320,240)); m[mc].group=0; modes[mc] = SM(320,240); mc++;
 m[mc].type = NM_TYPE_RADIO; m[mc].text = "320x400"; m[mc].value=(Game_screen_mode==SM(320,400)); m[mc].group=0; modes[mc] = SM(320,400); mc++;
//#ifndef __LINUX__ - heh?  640x400 is perfectly fine on linux
 m[mc].type = NM_TYPE_RADIO; m[mc].text = "640x400"; m[mc].value=(Game_screen_mode==SM(640,400)); m[mc].group=0; modes[mc] = SM(640,400); mc++;
//#endif
 m[mc].type = NM_TYPE_RADIO; m[mc].text = "640x480"; m[mc].value=(Game_screen_mode==SM(640,480)); m[mc].group=0; modes[mc] = SM(640,480); mc++;
 m[mc].type = NM_TYPE_RADIO; m[mc].text = "800x600"; m[mc].value=(Game_screen_mode==SM(800,600)); m[mc].group=0; modes[mc] = SM(800,600); mc++;
 m[mc].type = NM_TYPE_RADIO; m[mc].text = "1024x768"; m[mc].value=(Game_screen_mode==SM(1024,768)); m[mc].group=0; modes[mc] = SM(1024,768); mc++;
//end section - OE
 num_presets = mc;
 for (i=0; i<mc; i++)
	 if (m[mc].value)
		 break;
 m[mc].type = NM_TYPE_RADIO; m[mc].text = "custom:"; m[mc].value=(i==mc); m[mc].group=0; modes[mc] = 0; mc++;
 sprintf(customres, "%ix%i", SM_W(Game_screen_mode), SM_H(Game_screen_mode));
 m[mc].type = NM_TYPE_INPUT; m[mc].text = customres; m[mc].text_len=11; modes[mc] = 0; mc++;

// m[mc].type = NM_TYPE_CHECK; m[mc].text = "No Doublebuffer"; m[mc].value = use_double_buffer;

 //added 05/27/99 Matt Mueller - ingame fullscreen changing
#ifdef GR_SUPPORTS_FULLSCREEN_TOGGLE
 fullscreenc=mc;m[mc].type = NM_TYPE_CHECK; m[mc].text = "Fullscreen"; m[mc].value = gr_check_fullscreen();mc++;
#endif
 //end addition -MM


   i=newmenu_do1( NULL, "Screen Resolution", mc, m, &change_res_poll, 0);

  //added 05/27/99 Matt Mueller - ingame fullscreen changing
#ifdef GR_SUPPORTS_FULLSCREEN_TOGGLE
   if (m[fullscreenc].value != gr_check_fullscreen()){
	   gr_toggle_fullscreen();
        Game_screen_mode = -1;
   }
#endif
  //end addition -MM
   
  for(i=0;(m[i].value==0)&&(i<num_presets);i++);
  if (modes[i]==0){
	  char *h=strchr(customres, 'x');
	  if (!h) 
		  return;
	  screen_mode = SM(atoi(customres), atoi(h+1));
  }else{
	  screen_mode = modes[i];
  }

  screen_width = SM_W(screen_mode);
  screen_height = SM_H(screen_mode);
  if (screen_height<=0 || screen_width<=0)
	  return;

  switch(screen_mode)
   {
    case SM(320,100)://19:
           screen_compatible = 0;
           use_double_buffer = 0;
           break;
	case SM(320,200)://SM_320x200C:
           screen_compatible = 1;
           use_double_buffer = 0;
           break;
	default:
           screen_compatible = 0;
           use_double_buffer = 1;
           break;
   }
#ifdef __MSDOS__
  if ( FindArg( "-nodoublebuffer" ) )
#endif
   use_double_buffer = 0;

//added 6/15/1999 by Owen Evans to eliminate unneccesary mode modification
	if (Game_screen_mode == screen_mode)
		return;
//      gr_set_mode(Game_screen_mode);
//end section - OE

        VR_offscreen_buffer = 0;        //Disable VR (so that VR_Screen_mode doesnt mess us up
        Game_screen_mode = screen_mode;
        Game_window_w=screen_width;
        Game_window_h=screen_height;
        game_init_render_buffers(screen_mode, screen_width, screen_height, use_double_buffer, vr_mode, screen_compatible);
        

        mprintf( (0, "\nInitializing palette system..." ));
        gr_use_palette_table( "PALETTE.256" );
        mprintf( (0, "\nInitializing font system..." ));
        gamefont_init();        // must load after palette data loaded.


  reset_palette_add();
  init_cockpit();
  last_drawn_cockpit[0]=-1;
  last_drawn_cockpit[1]=-1;
//  init_gauges();

   vr_reset_display();
}
Esempio n. 3
0
void display_mac_alert(char *message, int error)
{
	window	*wind;
	d_event	event;
	int		fullscreen;
	bool	osX = FALSE;
	uint 	response;
	int16_t itemHit;

	// Handle Descent's windows properly
	if ((wind = window_get_front()))
		WINDOW_SEND_EVENT(wind, EVENT_WINDOW_DEACTIVATED);

	if (grd_curscreen && (fullscreen = gr_check_fullscreen()))
		gr_toggle_fullscreen();
	
	osX = ( Gestalt(gestaltSystemVersion, (long *) &response) == noErr)
		&& (response >= 0x01000 );

    ShowCursor();

	if (osX)
	{
#ifdef TARGET_API_MAC_CARBON
		DialogRef	alert;
		CFStringRef	error_text = CFSTR("Sorry, a critical error has occurred.");
		CFStringRef	text = NULL;

		text = CFStringCreateWithCString(CFAllocatorGetDefault(), message, kCFStringEncodingMacRoman);
		if (!text)
		{
			if (wind) WINDOW_SEND_EVENT(wind, EVENT_WINDOW_ACTIVATED);
			return;
		}

		if (CreateStandardAlert(error ? kAlertStopAlert : kAlertNoteAlert, error ? error_text : text, error ? text : NULL, 0, &alert) != noErr)
		{
			CFRelease(text);
			if (wind) WINDOW_SEND_EVENT(wind, EVENT_WINDOW_ACTIVATED);
			return;
		}
		
		RunStandardAlert(alert, 0, &itemHit);
		CFRelease(text);
#endif
	}
	else
	{
		// This #if guard removes both compiler warnings
		// and complications if we didn't link the (older) Mac OS X SDK that actually supports the following.
#if !defined(MAC_OS_X_VERSION_MAX_ALLOWED) || (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_4)
		Str255 	error_text = "\pSorry, a critical error has occurred.";
		Str255 	text;
		
		CopyCStringToPascal(message, text);
		StandardAlert(error ? kAlertStopAlert : kAlertNoteAlert, error ? error_text : text, error ? text : NULL, 0, &itemHit);
#endif
	}

	if ((wind = window_get_front()))
		WINDOW_SEND_EVENT(wind, EVENT_WINDOW_ACTIVATED);
	
	if (grd_curscreen && !error && fullscreen)
		gr_toggle_fullscreen();
}