/** 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); }
// -------- // I_InitCD // Init CD Audio subsystem // -------- void I_InitCD (void) { MCI_SET_PARMS mciSet; MCIERROR iErr; int i; // We don't have an open device yet m_MCIOpen.wDeviceID = 0; m_nTracksCount = 0; cdaudio_started = false; m_MCIOpen.lpstrDeviceType = (LPCTSTR)MCI_DEVTYPE_CD_AUDIO; iErr = mciSendCommand(0, MCI_OPEN, MCI_OPEN_TYPE|MCI_OPEN_TYPE_ID, (DWORD_PTR)&m_MCIOpen); if (iErr) { MCIErrorMessageBox (iErr); return; } // Set the time format to track/minute/second/frame (TMSF). mciSet.dwTimeFormat = MCI_FORMAT_TMSF; iErr = mciSendCommand(m_MCIOpen.wDeviceID, MCI_SET, MCI_SET_TIME_FORMAT, (DWORD_PTR)&mciSet); if (iErr) { MCIErrorMessageBox (iErr); mciSendCommand(m_MCIOpen.wDeviceID, MCI_CLOSE, 0, 0); return; } I_AddExitFunc (I_ShutdownCD); cdaudio_started = true; CONS_Printf ("I_InitCD: CD Audio started\n"); // last saved in config.cfg i = cd_volume.value; //I_SetVolumeCD (0); // initialize to 0 for some odd cd drivers I_SetVolumeCD (i); // now set the last saved volume for (i = 0; i < MAX_CD_TRACKS; i++) cdRemap[i] = (UINT8)i; if (!CD_ReadTrackInfo()) { CONS_Printf("\2I_InitCD: no CD in player.\n"); cdEnabled = false; cdValid = false; } else { cdEnabled = true; cdValid = true; } COM_AddCommand ("cd", Command_Cd_f); }
/************************************************************************** * * function: InitCD * * description: * Initialize the first CD drive SDL detects and add console command 'cd' * **************************************************************************/ void I_InitCD (void) { #ifndef NOSDLCD INT32 i; // Has been checked in d_main.c, but doesn't hurt here if (M_CheckParm ("-nocd")) return; CONS_Printf("I_InitCD: Init CD audio\n"); // Initialize SDL first if (SDL_InitSubSystem(SDL_INIT_CDROM) < 0) { CONS_Printf("Couldn't initialize SDL CDROM: %s\n",SDL_GetError()); return; } // Open drive cdrom = SDL_CDOpen(0); if (!cdrom) { const char *cdName = SDL_CDName(0); if (!cdName) { CONS_Printf("Couldn't open default CD-ROM drive: %s\n", SDL_GetError()); } else { CONS_Printf("Couldn't open default CD-ROM drive %s: %s\n", cdName, SDL_GetError()); } //return; } for (i = 0; i < MAX_CD_TRACKS; i++) cdRemap[i] = (Uint8)i; cdaudio_started = true; if (cdrom) cdEnabled = true; if (CDAudio_GetAudioDiskInfo()==-1) { CONS_Printf("I_InitCD: No CD in player.\n"); cdValid = SDL_FALSE; } COM_AddCommand ("cd", Command_Cd_f); CONS_Printf("CD audio Initialized\n"); #endif }
/** Initializes command buffer and adds basic commands. */ void COM_Init(void) { // allocate command buffer VS_Alloc(&com_text, COM_BUF_SIZE); // add standard commands COM_AddCommand("alias", COM_Alias_f); COM_AddCommand("echo", COM_Echo_f); COM_AddCommand("cecho", COM_CEcho_f); COM_AddCommand("cechoflags", COM_CEchoFlags_f); COM_AddCommand("cechoduration", COM_CEchoDuration_f); COM_AddCommand("exec", COM_Exec_f); COM_AddCommand("wait", COM_Wait_f); COM_AddCommand("help", COM_Help_f); COM_AddCommand("toggle", COM_Toggle_f); RegisterNetXCmd(XD_NETVAR, Got_NetVar); }
// ************************************************************************************* // 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); }