cdfile = -1;
}
+void CDAudio_Open(void)
+{
+}
+
+void CDAudio_Close(void)
+{
+}
{
}
+
+void CDAudio_Open(void)
+{
+}
+
+void CDAudio_Close(void)
+{
+}
Con_DPrintf("CDAudio_Shutdown: MCI_CLOSE failed\n");
}
+
+void CDAudio_Open(void)
+{
+}
+
+void CDAudio_Close(void)
+{
+}
*/
int CDAudio_Init(void);
+void CDAudio_Open(void);
+void CDAudio_Close(void);
void CDAudio_Play(qbyte track, qboolean looping);
void CDAudio_Stop(void);
void CDAudio_Pause(void);
void Render_Init(void)
{
- R_Modules_Shutdown();
R_Textures_Init();
Mod_RenderInit();
gl_backend_init();
R_Explosion_Init();
ui_init();
Sbar_Init();
- R_Modules_Start();
}
/*
if (cls.state != ca_dedicated)
{
- VID_InitCvars();
-
Gamma_Init();
-
Palette_Init();
-
-#ifndef _WIN32 // on non win32, mouse comes before video for security reasons
- IN_Init ();
-#endif
+ VID_Shared_Init();
VID_Init();
- if (!VID_Mode(vid_fullscreen.integer, vid_width.integer, vid_height.integer, vid_bitsperpixel.integer))
- {
- if (vid_fullscreen.integer)
- {
- if (!VID_Mode(true, 640, 480, 16))
- if (!VID_Mode(false, 640, 480, 16))
- Sys_Error("Video modes failed\n");
- }
- else
- Sys_Error("Requested windowed video mode failed\n");
- }
Render_Init();
S_Init ();
CDAudio_Init ();
CL_Init ();
-#ifdef _WIN32 // on non win32, mouse comes before video for security reasons
- IN_Init ();
-#endif
}
Cbuf_InsertText ("exec quake.rc\n");
+ Cbuf_Execute ();
+ Cbuf_Execute ();
+ Cbuf_Execute ();
+ Cbuf_Execute ();
host_initialized = true;
- Sys_Printf ("========Quake Initialized=========\n");
+ Con_Printf ("========Quake Initialized=========\n");
+
+ if (cls.state != ca_dedicated)
+ VID_Open();
}
CDAudio_Shutdown ();
NET_Shutdown ();
S_Shutdown();
- IN_Shutdown ();
if (cls.state != ca_dedicated)
{
extern cvar_t in_pitch_min;
extern cvar_t in_pitch_max;
-void IN_Init (void);
-
-void IN_Shutdown (void);
-
void IN_Commands (void);
// oportunity for devices to stick commands on the script buffer
void S_UnlockBuffer(void)
{
}
+
+void S_Open(void)
+{
+}
+
+void S_Close(void)
+{
+}
{
}
+
+void S_Open(void)
+{
+}
+
+void S_Close(void)
+{
+}
{
return 0;
}
+
+
+void S_Open(void)
+{
+}
+
+void S_Close(void)
+{
+}
void S_UnlockBuffer(void)
{
}
+
+
+void S_Open(void)
+{
+}
+
+void S_Close(void)
+{
+}
return shm->buffer;
}
-void S_UnlockBuffer()
+void S_UnlockBuffer(void)
{
if (pDSBuf)
pDSBuf->lpVtbl->Unlock(pDSBuf, dsound_pbuf, dsound_dwSize, dsound_pbuf2, dsound_dwSize2);
}
+void S_Open(void)
+{
+}
+
+void S_Close(void)
+{
+}
void S_Init (void);
void S_Startup (void);
void S_Shutdown (void);
+void S_Open (void);
+void S_Close (void);
void S_StartSound (int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float fvol, float attenuation);
void S_StaticSound (sfx_t *sfx, vec3_t origin, float vol, float attenuation);
void S_StopSound (int entnum, int entchannel);
void *GL_GetProcAddress(const char *name);
int GL_CheckExtension(const char *name, const gl_extensionfunctionlist_t *funcs, const char *disableparm, int silent);
-void VID_InitCvars(void);
+void VID_Shared_Init(void);
void GL_Init (void);
void VID_Finish (void);
+void VID_Restart_f(void);
+
+void VID_Open (void);
+void VID_Close (void);
+
#endif
if (!ctx || !vidx11_display)
return;
+ vid_hidden = true;
if (vidx11_display)
{
uninstall_grabs();
Cvar_RegisterVariable (&vid_dga);
Cvar_RegisterVariable (&vid_dga_mouseaccel);
InitSig(); // trap evil signals
+ if (COM_CheckParm ("-nomouse") || COM_CheckParm("-safe"))
+ mouse_avail = false;
}
int VID_InitMode(int fullscreen, int width, int height, int bpp)
HandleEvents();
}
-void IN_Init(void)
-{
- if (COM_CheckParm ("-nomouse") || COM_CheckParm("-safe"))
- mouse_avail = false;
-}
-
-void IN_Shutdown(void)
-{
-}
-
/*
===========
IN_Commands
{
}
-void IN_Init(void)
-{
-}
-
-void IN_Shutdown(void)
-{
-}
-
void IN_Move(usercmd_t *cmd)
{
}
int gl_videosyncavailable = false;
// LordHavoc: if window is hidden, don't update screen
-int vid_hidden = false;
+int vid_hidden = true;
// LordHavoc: if window is not the active window, don't hog as much CPU time,
// let go of the mouse, turn off sound, and restore system gamma ramps...
int vid_activewindow = true;
-cvar_t vid_fullscreen = {0, "vid_fullscreen", "1"};
-cvar_t vid_width = {0, "vid_width", "640"};
-cvar_t vid_height = {0, "vid_height", "480"};
-cvar_t vid_bitsperpixel = {0, "vid_bitsperpixel", "16"};
+cvar_t vid_fullscreen = {CVAR_SAVE, "vid_fullscreen", "1"};
+cvar_t vid_width = {CVAR_SAVE, "vid_width", "640"};
+cvar_t vid_height = {CVAR_SAVE, "vid_height", "480"};
+cvar_t vid_bitsperpixel = {CVAR_SAVE, "vid_bitsperpixel", "16"};
cvar_t vid_mouse = {CVAR_SAVE, "vid_mouse", "1"};
cvar_t gl_combine = {0, "gl_combine", "1"};
}
}
-void VID_InitCvars(void)
+void VID_Shared_Init(void)
{
int i;
Cvar_RegisterVariable(&in_pitch_max);
Cvar_RegisterVariable(&m_filter);
Cmd_AddCommand("force_centerview", Force_CenterView_f);
+ Cmd_AddCommand("vid_restart", VID_Restart_f);
// interpret command-line parameters
if ((i = COM_CheckParm("-window")) != 0)
Cvar_SetQuick(&vid_bitsperpixel, com_argv[i+1]);
}
+int current_vid_fullscreen;
+int current_vid_width;
+int current_vid_height;
+int current_vid_bitsperpixel;
extern int VID_InitMode (int fullscreen, int width, int height, int bpp);
int VID_Mode(int fullscreen, int width, int height, int bpp)
{
else
Con_Printf("Video: %dx%d windowed\n", width, height);
if (VID_InitMode(fullscreen, width, height, bpp))
+ {
+ current_vid_fullscreen = fullscreen;
+ current_vid_width = width;
+ current_vid_height = height;
+ current_vid_bitsperpixel = bpp;
return true;
+ }
else
return false;
}
+
+static void VID_OpenSystems(void)
+{
+ R_Modules_Start();
+ S_Open();
+ CDAudio_Open();
+}
+
+static void VID_CloseSystems(void)
+{
+ CDAudio_Close();
+ S_Close();
+ R_Modules_Shutdown();
+}
+
+void VID_Restart_f(void)
+{
+ Con_Printf("VID_Restart: changing from %s %dx%dx%dbpp, to %s %dx%dx%dbpp.\n",
+ current_vid_fullscreen ? "fullscreen" : "window", current_vid_width, current_vid_height, current_vid_bitsperpixel,
+ vid_fullscreen.integer ? "fullscreen" : "window", vid_width.integer, vid_height.integer, vid_bitsperpixel.integer);
+ VID_Close();
+ if (!VID_Mode(vid_fullscreen.integer, vid_width.integer, vid_height.integer, vid_bitsperpixel.integer))
+ {
+ Con_Printf("Video mode change failed\n");
+ if (!VID_Mode(current_vid_fullscreen, current_vid_width, current_vid_height, current_vid_bitsperpixel))
+ Sys_Error("Unable to restore to last working video mode\n");
+ }
+ VID_OpenSystems();
+}
+
+void VID_Open(void)
+{
+ Con_Printf("Starting video system\n");
+ if (!VID_Mode(vid_fullscreen.integer, vid_width.integer, vid_height.integer, vid_bitsperpixel.integer))
+ {
+ if (vid_fullscreen.integer)
+ {
+ if (!VID_Mode(true, 640, 480, 16))
+ if (!VID_Mode(false, 640, 480, 16))
+ Sys_Error("Video modes failed\n");
+ }
+ else
+ Sys_Error("Windowed video failed\n");
+ }
+ VID_OpenSystems();
+}
+
+void VID_Close(void)
+{
+ VID_CloseSystems();
+ VID_Shutdown();
+}
if (!RegisterClass (&wc))
Sys_Error("Couldn't register window class\n");
+
+ uiWheelMessage = RegisterWindowMessage ( "MSWHEEL_ROLLMSG" );
+
+ // joystick variables
+ Cvar_RegisterVariable (&in_joystick);
+ Cvar_RegisterVariable (&joy_name);
+ Cvar_RegisterVariable (&joy_advanced);
+ Cvar_RegisterVariable (&joy_advaxisx);
+ Cvar_RegisterVariable (&joy_advaxisy);
+ Cvar_RegisterVariable (&joy_advaxisz);
+ Cvar_RegisterVariable (&joy_advaxisr);
+ Cvar_RegisterVariable (&joy_advaxisu);
+ Cvar_RegisterVariable (&joy_advaxisv);
+ Cvar_RegisterVariable (&joy_forwardthreshold);
+ Cvar_RegisterVariable (&joy_sidethreshold);
+ Cvar_RegisterVariable (&joy_pitchthreshold);
+ Cvar_RegisterVariable (&joy_yawthreshold);
+ Cvar_RegisterVariable (&joy_forwardsensitivity);
+ Cvar_RegisterVariable (&joy_sidesensitivity);
+ Cvar_RegisterVariable (&joy_pitchsensitivity);
+ Cvar_RegisterVariable (&joy_yawsensitivity);
+ Cvar_RegisterVariable (&joy_wwhack1);
+ Cvar_RegisterVariable (&joy_wwhack2);
+ Cmd_AddCommand ("joyadvancedupdate", Joy_AdvancedUpdate_f);
}
int VID_InitMode (int fullscreen, int width, int height, int bpp)
//vid_menukeyfn = VID_MenuKey;
vid_hidden = false;
vid_initialized = true;
+
+ IN_StartupMouse ();
+ IN_StartupJoystick ();
+
return true;
}
if (vid_initialized)
{
vid_initialized = false;
+
+ IN_DeactivateMouse ();
+ IN_ShowMouse ();
+
+ if (g_pMouse)
+ IDirectInputDevice_Release(g_pMouse);
+ g_pMouse = NULL;
+
+ if (g_pdi)
+ IDirectInput_Release(g_pdi);
+ g_pdi = NULL;
+
if (qwglGetCurrentContext)
hRC = qwglGetCurrentContext();
+
if (qwglGetCurrentDC)
hDC = qwglGetCurrentDC();
}
-/*
-===========
-IN_Init
-===========
-*/
-void IN_Init (void)
-{
- // joystick variables
- Cvar_RegisterVariable (&in_joystick);
- Cvar_RegisterVariable (&joy_name);
- Cvar_RegisterVariable (&joy_advanced);
- Cvar_RegisterVariable (&joy_advaxisx);
- Cvar_RegisterVariable (&joy_advaxisy);
- Cvar_RegisterVariable (&joy_advaxisz);
- Cvar_RegisterVariable (&joy_advaxisr);
- Cvar_RegisterVariable (&joy_advaxisu);
- Cvar_RegisterVariable (&joy_advaxisv);
- Cvar_RegisterVariable (&joy_forwardthreshold);
- Cvar_RegisterVariable (&joy_sidethreshold);
- Cvar_RegisterVariable (&joy_pitchthreshold);
- Cvar_RegisterVariable (&joy_yawthreshold);
- Cvar_RegisterVariable (&joy_forwardsensitivity);
- Cvar_RegisterVariable (&joy_sidesensitivity);
- Cvar_RegisterVariable (&joy_pitchsensitivity);
- Cvar_RegisterVariable (&joy_yawsensitivity);
- Cvar_RegisterVariable (&joy_wwhack1);
- Cvar_RegisterVariable (&joy_wwhack2);
-
- Cmd_AddCommand ("joyadvancedupdate", Joy_AdvancedUpdate_f);
-
- uiWheelMessage = RegisterWindowMessage ( "MSWHEEL_ROLLMSG" );
-
- IN_StartupMouse ();
- IN_StartupJoystick ();
-}
-
-/*
-===========
-IN_Shutdown
-===========
-*/
-void IN_Shutdown (void)
-{
- IN_DeactivateMouse ();
- IN_ShowMouse ();
-
- if (g_pMouse)
- {
- IDirectInputDevice_Release(g_pMouse);
- g_pMouse = NULL;
- }
-
- if (g_pdi)
- {
- IDirectInput_Release(g_pdi);
- g_pdi = NULL;
- }
-}
-
-
/*
===========
IN_MouseEvent
IN_MouseMove (cmd);
IN_JoyMove (cmd);
}
-
- cl.viewangles[PITCH] = bound (in_pitch_min.value, cl.viewangles[PITCH], in_pitch_max.value);
}