Esempio n. 1
0
/** Adds variables and commands relating to the master server.
  *
  * \sa cv_internetserver, cv_masterserver, cv_servername,
  *     Command_Listserv_f
  */
void AddMServCommands(void)
{
	CV_RegisterVar(&cv_internetserver);
	CV_RegisterVar(&cv_masterserver);
	CV_RegisterVar(&cv_servername);
	COM_AddCommand("listserv", Command_Listserv_f);
}
Esempio n. 2
0
// *************************************************************************************
// VID_Init
// Initialize Video modes subsystem
// *************************************************************************************
static VOID VID_Init(VOID)
{
#ifdef _DEBUG
    vmode_t *pv;
    int iMode;
#endif

    // if '-win' is specified on the command line, do not add DirectDraw modes
    bWinParm = M_CheckParm("-win");

    COM_AddCommand("vid_nummodes", VID_Command_NumModes_f);
    COM_AddCommand("vid_modeinfo", VID_Command_ModeInfo_f);
    COM_AddCommand("vid_modelist", VID_Command_ModeList_f);
    COM_AddCommand("vid_mode", VID_Command_Mode_f);

    CV_RegisterVar(&cv_vidwait);
    CV_RegisterVar(&cv_stretch);
    CV_RegisterVar(&cv_ontop);

    // setup the videmodes list,
    // note that mode 0 must always be VGA mode 0x13
    pvidmodes = pcurrentmode = NULL;
    numvidmodes = 0;

    //DisableAero();

    // store the main window handle in viddef struct
    SetWindowPos(hWndMain, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE|SWP_NOSENDCHANGING|SWP_NOSIZE|SWP_NOMOVE);
    vid.WndParent = hWndMain;
    vid.buffer = NULL;

    // we startup in windowed mode using DIB bitmap
    // we will use DirectDraw when switching fullScreen and entering main game loop
    bDIBMode = TRUE;
    bAppFullScreen = FALSE;

#ifdef HWRENDER
    // initialize the appropriate display device
    if (rendermode != render_soft)
    {
        const char *drvname = NULL;

        switch (rendermode)
        {
        case render_opengl:
            drvname = "r_opengl.dll";
            break;
        default:
            I_Error("Unknown hardware render mode");
        }

        // load the DLL
        if (drvname && Init3DDriver(drvname))
        {
            int hwdversion = HWD.pfnGetRenderVersion();
            if (hwdversion != VERSION)
                CONS_Printf("%s", M_GetText("WARNING: This r_opengl version is not supported, use it at your own risk.\n"));

            // perform initialisations
            HWD.pfnInit(I_Error);
            // get available display modes for the device
            HWD.pfnGetModeList(&pvidmodes, &numvidmodes);
        }
        else
        {
            switch (rendermode)
            {
            case render_opengl:
                I_Error("Error initializing OpenGL");
            default:
                break;
            }
            rendermode = render_soft;
        }
    }

    if (rendermode == render_soft)
#endif
        if (!bWinParm)
        {
            if (!CreateDirectDrawInstance())
                bWinParm = TRUE;
            else // get available display modes for the device
                VID_GetExtraModes();
        }

    // the game boots in 320x200 standard VGA, but
    // we need a highcolor mode to run the game in highcolor
    if (highcolor && !numvidmodes)
        I_Error("Cannot run in highcolor - No 15bit highcolor DirectX video mode found.");

    // add windowed mode at the start of the list, very important!
    WindowMode_Init();

    if (!numvidmodes)
        I_Error("No display modes available.");

#ifdef _DEBUG // DEBUG
    for (iMode = 0, pv = pvidmodes; pv; pv = pv->pnext, iMode++)
        DEBPRINT(va("#%02d: %dx%dx%dbpp (desc: '%s')\n", iMode, pv->width, pv->height, pv->bytesperpixel, pv->name));
#endif

    // set the startup screen in a window
    VID_SetMode(0);
}
Esempio n. 3
0
// do some initial settings for the game loading screen
//
void SCR_Startup(void)
{
	const CPUInfoFlags *RCpuInfo = I_CPUInfo();
	if (!M_CheckParm("-NOCPUID") && RCpuInfo)
	{
#if defined (__i386__) || defined (_M_IX86) || defined (__WATCOMC__)
		R_486 = true;
#endif
		if (RCpuInfo->RDTSC)
			R_586 = true;
		if (RCpuInfo->MMX)
			R_MMX = true;
		if (RCpuInfo->AMD3DNow)
			R_3DNow = true;
		if (RCpuInfo->MMXExt)
			R_MMXExt = true;
		if (RCpuInfo->SSE)
			R_SSE = true;
		if (RCpuInfo->SSE2)
			R_SSE2 = true;
		CONS_Printf("CPU Info: 486: %i, 586: %i, MMX: %i, 3DNow: %i, MMXExt: %i, SSE2: %i\n", R_486, R_586, R_MMX, R_3DNow, R_MMXExt, R_SSE2);
	}

	if (M_CheckParm("-noASM"))
		R_ASM = false;
	if (M_CheckParm("-486"))
		R_486 = true;
	if (M_CheckParm("-586"))
		R_586 = true;
	if (M_CheckParm("-MMX"))
		R_MMX = true;
	if (M_CheckParm("-3DNow"))
		R_3DNow = true;
	if (M_CheckParm("-MMXExt"))
		R_MMXExt = true;

	if (M_CheckParm("-SSE"))
		R_SSE = true;
	if (M_CheckParm("-noSSE"))
		R_SSE = false;

	if (M_CheckParm("-SSE2"))
		R_SSE2 = true;

	M_SetupMemcpy();

	if (dedicated)
	{
		V_Init();
		V_SetPalette(0);
		return;
	}

	vid.modenum = 0;

	vid.dupx = vid.width / BASEVIDWIDTH;
	vid.dupy = vid.height / BASEVIDHEIGHT;
	vid.dupx = vid.dupy = (vid.dupx < vid.dupy ? vid.dupx : vid.dupy);
	vid.fdupx = FixedDiv(vid.width*FRACUNIT, BASEVIDWIDTH*FRACUNIT);
	vid.fdupy = FixedDiv(vid.height*FRACUNIT, BASEVIDHEIGHT*FRACUNIT);

#ifdef HWRENDER
	if (rendermode != render_opengl && rendermode != render_none) // This was just placing it incorrectly at non aspect correct resolutions in opengl
#endif
		vid.fdupx = vid.fdupy = (vid.fdupx < vid.fdupy ? vid.fdupx : vid.fdupy);

	vid.meddupx = (UINT8)(vid.dupx >> 1) + 1;
	vid.meddupy = (UINT8)(vid.dupy >> 1) + 1;
#ifdef HWRENDER
	vid.fmeddupx = vid.meddupx*FRACUNIT;
	vid.fmeddupy = vid.meddupy*FRACUNIT;
#endif

	vid.smalldupx = (UINT8)(vid.dupx / 3) + 1;
	vid.smalldupy = (UINT8)(vid.dupy / 3) + 1;
#ifdef HWRENDER
	vid.fsmalldupx = vid.smalldupx*FRACUNIT;
	vid.fsmalldupy = vid.smalldupy*FRACUNIT;
#endif

	vid.baseratio = FRACUNIT;

	V_Init();
	CV_RegisterVar(&cv_ticrate);
	CV_RegisterVar(&cv_constextsize);

	V_SetPalette(0);
}
Esempio n. 4
0
// do some initial settings for the game loading screen
//
void SCR_Startup(void)
{
	const CPUInfoFlags *RCpuInfo = I_CPUInfo();
	if (!M_CheckParm("-NOCPUID") && RCpuInfo)
	{
#if defined (__i386__) || defined (_M_IX86) || defined (__WATCOMC__)
		R_486 = true;
#endif
		if (RCpuInfo->RDTSC)
			R_586 = true;
		if (RCpuInfo->MMX)
			R_MMX = true;
		if (RCpuInfo->AMD3DNow)
			R_3DNow = true;
		if (RCpuInfo->MMXExt)
			R_MMXExt = true;
		if (RCpuInfo->SSE2)
			R_SSE2 = true;

		if (RCpuInfo->CPUs > 1)
		{
			R_ASM = false; //with more than 1 CPU, ASM go BOOM!
		}
		CONS_Printf("CPU Info: 486: %i, 586: %i, MMX: %i, 3DNow: %i, MMXExt: %i, SSE2: %i\n",
		            R_486, R_586, R_MMX, R_3DNow, R_MMXExt, R_SSE2);
	}

	if (M_CheckParm("-noASM"))
		R_ASM = false;
	if (M_CheckParm("-486"))
		R_486 = true;
	if (M_CheckParm("-586"))
		R_586 = true;
	if (M_CheckParm("-MMX"))
		R_MMX = true;
	if (M_CheckParm("-3DNow"))
		R_3DNow = true;
	if (M_CheckParm("-MMXExt"))
		R_MMXExt = true;
	if (M_CheckParm("-SSE2"))
		R_SSE2 = true;

#if defined (_WIN32) && !defined (_WIN32_WCE) && !defined (_XBOX)
	if (!RCpuInfo || !RCpuInfo->CPUs) //bad CPUID code?
	{
		LPCSTR cNOP = I_GetEnv("NUMBER_OF_PROCESSORS");
		if (cNOP && atoi(cNOP) > 1 && !M_CheckParm("-ASM"))
		{
			R_ASM = false;
			CONS_Printf("Disabling ASM code\n");
		}
	}
#endif

	M_SetupMemcpy();

	if (dedicated)
	{
		V_Init();
		V_SetPalette(0);
		return;
	}

	vid.modenum = 0;

	vid.fdupx = (float)vid.width/BASEVIDWIDTH;
	vid.fdupy = (float)vid.height/BASEVIDHEIGHT;
	vid.dupx = (INT32)vid.fdupx;
	vid.dupy = (INT32)vid.fdupy;

	vid.baseratio = FRACUNIT;

#ifdef RUSEASM
	if (R_ASM)
		ASM_PatchRowBytes(vid.rowbytes);
//	if (R_486 || R_586 || R_MMX)
//		MMX_PatchRowBytes(vid.rowbytes);
#endif

	V_Init();
	CV_RegisterVar(&cv_ticrate);

	V_SetPalette(0);
}