Beispiel #1
0
void ProjectDialog(){
	const char *filename;
	char buffer[NAME_MAX];

	/*
	 * Obtain the system directory name and
	 * store it in buffer.
	 */

	strcpy( buffer, g_qeglobals.m_strHomeGame.GetBuffer() );
	strcat( buffer, g_pGameDescription->mBaseGame.GetBuffer() );
	strcat( buffer, "/scripts/" );

	// Display the Open dialog box
	filename = file_dialog( NULL, TRUE, _( "Open File" ), buffer, "project" );

	if ( filename == NULL ) {
		return; // canceled

	}
	// Open the file.
	// NOTE: QE_LoadProject takes care of saving prefs with new path to the project file
	if ( !QE_LoadProject( filename ) ) {
		Sys_Printf( "Failed to load project from file: %s\n", filename );
	}
	else{
		// FIXME TTimo QE_Init is probably broken if you don't call it during startup right now ..
		QE_Init();
	}
}
Beispiel #2
0
/*
==================
WinMain

==================
*/
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance
					,LPSTR lpCmdLine, int nCmdShow)
{
    MSG        msg;
	double		time, oldtime, delta;
	HACCEL		accelerators;

	g_qeglobals.d_hInstance = hInstance;

	InitCommonControls ();

	screen_width = GetSystemMetrics (SM_CXFULLSCREEN);
	screen_height = GetSystemMetrics (SM_CYFULLSCREEN);

	// hack for broken NT 4.0 dual screen
	if (screen_width > 2*screen_height)
		screen_width /= 2;

	accelerators = LoadAccelerators (hInstance
		, MAKEINTRESOURCE(IDR_ACCELERATOR1));
	if (!accelerators)
		Error ("LoadAccelerators failed");

	Main_Create (hInstance);

	WCam_Create (hInstance);
	WXY_Create (hInstance);
	WZ_Create (hInstance);
	CreateEntityWindow(hInstance);

	// the project file can be specified on the command line,
	// or implicitly found in the scripts directory
	if (lpCmdLine && strlen(lpCmdLine))
	{
		ParseCommandLine (lpCmdLine);
		if (!QE_LoadProject(argv[1]))
			Error ("Couldn't load %s project file", argv[1]);
	}
	else if (!QE_LoadProject("scripts/quake.qe4"))
		Error ("Couldn't load scripts/quake.qe4 project file");

	QE_Init ();

	Sys_Printf ("Entering message loop\n");

	oldtime = Sys_DoubleTime ();

	while (!have_quit)
	{
		Sys_EndWait ();		// remove wait cursor if active

		while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
		{
			if (!TranslateAccelerator(g_qeglobals.d_hwndMain, accelerators, &msg) )
			{
      			TranslateMessage (&msg);
      			DispatchMessage (&msg);
			}
			if (msg.message == WM_QUIT)
				have_quit = true;
		}


		CheckBspProcess ();

		time = Sys_DoubleTime ();
		delta = time - oldtime;
		oldtime = time;
		if (delta > 0.2)
			delta = 0.2;

		// run time dependant behavior
		Cam_MouseControl (delta);

		// update any windows now
		if (update_bits & W_CAMERA)
		{
			InvalidateRect(g_qeglobals.d_hwndCamera, NULL, false);
			UpdateWindow (g_qeglobals.d_hwndCamera);
		}
		if (update_bits & (W_Z | W_Z_OVERLAY) )
		{
			InvalidateRect(g_qeglobals.d_hwndZ, NULL, false);
			UpdateWindow (g_qeglobals.d_hwndZ);
		}
			
		if ( update_bits & W_TEXTURE )
		{
			InvalidateRect(g_qeglobals.d_hwndTexture, NULL, false);
			UpdateWindow (g_qeglobals.d_hwndEntity);
		}
	
		if (update_bits & (W_XY | W_XY_OVERLAY))
		{
			InvalidateRect(g_qeglobals.d_hwndXY, NULL, false);
			UpdateWindow (g_qeglobals.d_hwndXY);
		}

		update_bits = 0;

		if (!cambuttonstate && !have_quit)
		{	// if not driving in the camera view, block
			WaitMessage ();
		}

	}

    /* return success of application */
    return TRUE;

}