void Demo_StopPlayback(void) { //float diff; if(!playback) return; Con_Message("Demo was %.2f seconds (%i tics) long.", (DEMOTIC - demoStartTic) / (float) TICSPERSEC, DEMOTIC - demoStartTic); playback = false; lzClose(playdemo); playdemo = 0; fieldOfView = startFOV; Net_StopGame(); /* if(ArgCheck("-timedemo")) { diff = Sys_GetSeconds() - netConnectTime; if(!diff) diff = 1; // Print summary and exit. Con_Message("Timedemo results: %i game tics in %.1f seconds", r_framecounter, diff); Con_Message("%f FPS", r_framecounter / diff); Sys_Quit(); } */ // "Play demo once" mode? if(CommandLine_Check("-playdemo")) Sys_Quit(); }
static int Mouse_Win32_Init() { if(CommandLine_Check("-nomouse") || novideo) return false; // We'll need a window handle for this. HWND hWnd = (HWND) ClientWindow::main().nativeHandle(); HRESULT hr = E_FAIL; // Prefer the newer version 8 interface if available. if(LPDIRECTINPUT8 dInput = DirectInput_IVersion8()) { hr = dInput->CreateDevice(GUID_SysMouse, &didMouse, 0); } else if(LPDIRECTINPUT dInput = DirectInput_IVersion3()) { hr = dInput->CreateDevice(GUID_SysMouse, (LPDIRECTINPUTDEVICE*) &didMouse, 0); } if(FAILED(hr)) { LOGDEV_INPUT_ERROR("Failed to create device (0x%x: %s)") << hr << DirectInput_ErrorMsg(hr); return false; } // Set data format. hr = didMouse->SetDataFormat(&c_dfDIMouse2); if(FAILED(hr)) { LOGDEV_INPUT_ERROR("Failed to set data format (0x%x: %s)") << hr << DirectInput_ErrorMsg(hr); goto kill_mouse; } // Set behavior. hr = didMouse->SetCooperativeLevel(hWnd, DISCL_EXCLUSIVE | DISCL_FOREGROUND); if(FAILED(hr)) { LOGDEV_INPUT_ERROR("Failed to set co-op level (0x%x: %s)") << hr << DirectInput_ErrorMsg(hr); goto kill_mouse; } // Acquire the device. //didMouse->Acquire(); //mouseTrapped = true; // We will be told when to trap the mouse. mouseTrapped = false; // Init was successful. return true; kill_mouse: I_SAFE_RELEASE(didMouse); return false; }
static void Mouse_Init(void) { if(CommandLine_Check("-nomouse") || novideo) return; assert(iMouse); iMouse->init(); // Init was successful. useMouse = true; }
static void Mouse_Init(void) { if(CommandLine_Check("-nomouse") || novideo) return; LOG_AS("Mouse_Init"); DENG_ASSERT(iMouse); iMouse->init(); // Init was successful. useMouse = true; }
/** * A ridiculous amount of code to do something this simple. * But mixers are pretty abstract a subject, I guess... * (No, the API just sucks.) */ static int initMixer(void) { MIXERCAPS mixerCaps; int num = mixerGetNumDevs(); // Number of mixer devices. if(initMixerOk || CommandLine_Check("-nomixer")) return true; if(verbose) { // In verbose mode, print a lot of extra information. Con_Message("dsWinMM::initMixer: Number of mixer devices: %i", num); } // Open the mixer device. res = mixerOpen(&mixer, 0, 0, 0, MIXER_OBJECTF_MIXER); if(res != MMSYSERR_NOERROR) { if(verbose) Con_Message(" Error opening mixer: Error %i", res); return 0; } // Get the device caps. mixerGetDevCaps((UINT_PTR) mixer, &mixerCaps, sizeof(mixerCaps)); Con_Message("dsWinMM::initMixer: %s", mixerCaps.szPname); if(verbose) Con_Message(" Audio line destinations: %i", mixerCaps.cDestinations); // Init CD mixer. if(verbose) Con_Message("Init CD audio line:"); initMixerLine(&mixCD, MIXERLINE_COMPONENTTYPE_SRC_COMPACTDISC); if(verbose) Con_Message("Init synthesizer line:"); initMixerLine(&mixMidi, MIXERLINE_COMPONENTTYPE_SRC_SYNTHESIZER); // We're successful. initMixerOk = true; // Get the original mixer volume settings (restored at shutdown). origVol = mixer3i(MIX_MIDI, MIX_GET, MIX_VOLUME); origCDVol = mixer3i(MIX_CDAUDIO, MIX_GET, MIX_VOLUME); return true; }
/** * Post Game Initialization routine. * All game-specific actions that should take place at this time go here. */ void D_PostInit(void) { AutoStr* path; Uri* uri; int p; /// @todo Kludge: Border background is different in DOOM2. /// @todo Do this properly! if(gameModeBits & GM_ANY_DOOM2) borderGraphics[0] = "Flats:GRNROCK"; else borderGraphics[0] = "Flats:FLOOR7_2"; // Common post init routine G_CommonPostInit(); // Initialize ammo info. P_InitAmmoInfo(); // Initialize weapon info. P_InitWeaponInfo(); // Game parameters. monsterInfight = GetDefInt("AI|Infight", 0); // Get skill / episode / map from parms. gameSkill = startSkill = SM_NOITEMS; startEpisode = 0; startMap = 0; autoStart = false; // Command line options. noMonstersParm = CommandLine_Check("-nomonsters")? true : false; respawnParm = CommandLine_Check("-respawn")? true : false; fastParm = CommandLine_Check("-fast")? true : false; devParm = CommandLine_Check("-devparm")? true : false; if(CommandLine_Check("-altdeath")) cfg.netDeathmatch = 2; else if(CommandLine_Check("-deathmatch")) cfg.netDeathmatch = 1; p = CommandLine_Check("-timer"); if(p && p < myargc - 1 && deathmatch) { int time = atoi(CommandLine_At(p + 1)); Con_Message("Maps will end after %d %s", time, time == 1? "minute" : "minutes"); } // Turbo option. p = CommandLine_Check("-turbo"); turboMul = 1.0f; if(p) { int scale = 200; turboParm = true; if(p < myargc - 1) scale = atoi(CommandLine_At(p + 1)); if(scale < 10) scale = 10; if(scale > 400) scale = 400; Con_Message("turbo scale: %i%%", scale); turboMul = scale / 100.f; } // Load a saved game? p = CommandLine_Check("-loadgame"); if(p && p < myargc - 1) { const int saveSlot = SV_ParseSlotIdentifier(CommandLine_At(p + 1)); if(SV_IsUserWritableSlot(saveSlot) && G_LoadGame(saveSlot)) { // No further initialization is to be done. return; } } p = CommandLine_Check("-skill"); if(p && p < myargc - 1) { startSkill = CommandLine_At(p + 1)[0] - '1'; autoStart = true; } p = CommandLine_Check("-episode"); if(p && p < myargc - 1) { startEpisode = CommandLine_At(p + 1)[0] - '1'; startMap = 0; autoStart = true; } p = CommandLine_Check("-warp"); if(p && p < myargc - 1) { if(gameModeBits & (GM_ANY_DOOM2|GM_DOOM_CHEX)) { startMap = atoi(CommandLine_At(p + 1)) - 1; autoStart = true; } else if(p < myargc - 2) { startEpisode = CommandLine_At(p + 1)[0] - '1'; startMap = CommandLine_At(p + 2)[0] - '1'; autoStart = true; } } // Are we autostarting? if(autoStart) { if(gameModeBits & (GM_ANY_DOOM2|GM_DOOM_CHEX)) Con_Message("Warp to Map %d, Skill %d", startMap+1, startSkill + 1); else Con_Message("Warp to Episode %d, Map %d, Skill %d", startEpisode+1, startMap+1, startSkill + 1); } // Validate episode and map. uri = G_ComposeMapUri((gameModeBits & (GM_DOOM|GM_DOOM_SHAREWARE|GM_DOOM_ULTIMATE))? startEpisode : 0, startMap); path = Uri_Compose(uri); if((autoStart || IS_NETGAME) && !P_MapExists(Str_Text(path))) { startEpisode = 0; startMap = 0; } Uri_Delete(uri); if(autoStart || IS_NETGAME) { G_DeferredNewGame(startSkill, startEpisode, startMap, 0/*default*/); } else { G_StartTitle(); // Start up intro loop. } }