X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=blobdiff_plain;f=vid_wgl.c;h=789f64d3dfb7d5bf54089821072e4ea095bc8268;hp=eb4ff7702d03076cc250018abeec4f38b69bb0c5;hb=bdffd88cf8584630d1e24363e75a969435af2809;hpb=a308444491ff5488c82a196a9810142a10b142e3 diff --git a/vid_wgl.c b/vid_wgl.c index eb4ff770..789f64d3 100644 --- a/vid_wgl.c +++ b/vid_wgl.c @@ -40,7 +40,7 @@ BOOL (WINAPI *qwglMakeCurrent)(HDC, HGLRC); BOOL (WINAPI *qwglSwapIntervalEXT)(int interval); const char *(WINAPI *qwglGetExtensionsStringARB)(HDC hdc); -static gl_extensionfunctionlist_t wglfuncs[] = +static dllfunction_t wglfuncs[] = { {"wglChoosePixelFormat", (void **) &qwglChoosePixelFormat}, {"wglDescribePixelFormat", (void **) &qwglDescribePixelFormat}, @@ -56,7 +56,7 @@ static gl_extensionfunctionlist_t wglfuncs[] = {NULL, NULL} }; -static gl_extensionfunctionlist_t wglswapintervalfuncs[] = +static dllfunction_t wglswapintervalfuncs[] = { {"wglSwapIntervalEXT", (void **) &qwglSwapIntervalEXT}, {NULL, NULL} @@ -539,14 +539,9 @@ LONG WINAPI MainWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) break; - case WM_DESTROY: - { - if (mainwindow) - DestroyWindow (mainwindow); - - PostQuitMessage (0); - } - break; + //case WM_DESTROY: + // PostQuitMessage (0); + // break; case MM_MCINOTIFY: lRet = CDAudio_MessageHandler (hWnd, uMsg, wParam, lParam); @@ -607,118 +602,6 @@ void VID_RestoreSystemGamma(void) ReleaseDC (NULL, hdc); } -//======================================================== -// Video menu stuff -//======================================================== - -#if 0 -extern void M_Menu_Options_f (void); -extern void M_Print (float cx, float cy, char *str); -extern void M_PrintWhite (float cx, float cy, char *str); -extern void M_DrawCharacter (float cx, float cy, int num); -extern void M_DrawPic (float cx, float cy, char *picname); - -static int vid_wmodes; - -typedef struct -{ - int modenum; - char *desc; - int iscur; -} modedesc_t; - -#define MAX_COLUMN_SIZE 9 -#define MODE_AREA_HEIGHT (MAX_COLUMN_SIZE + 2) -#define MAX_MODEDESCS (MAX_COLUMN_SIZE*3) - -static modedesc_t modedescs[MAX_MODEDESCS]; - -/* -================ -VID_MenuDraw -================ -*/ -void VID_MenuDraw (void) -{ - cachepic_t *p; - char *ptr; - int lnummodes, i, k, column, row; - vmode_t *pv; - - p = Draw_CachePic ("gfx/vidmodes.lmp"); - M_DrawPic ( (320-p->width)/2, 4, "gfx/vidmodes.lmp"); - - vid_wmodes = 0; - lnummodes = VID_NumModes (); - - for (i=1 ; (i 0) - { - M_Print (2*8, 36+0*8, "Fullscreen Modes (WIDTHxHEIGHTxBPP)"); - - column = 8; - row = 36+2*8; - - for (i=0 ; i"); - M_Print (3*8, 36 + MODE_AREA_HEIGHT * 8 + 8*4, "and -bpp "); - M_Print (3*8, 36 + MODE_AREA_HEIGHT * 8 + 8*6, "Select windowed mode with -window"); -} - - -/* -================ -VID_MenuKey -================ -*/ -void VID_MenuKey (int key) -{ - switch (key) - { - case K_ESCAPE: - S_LocalSound ("misc/menu1.wav"); - M_Menu_Options_f (); - break; - - default: - break; - } -} -#endif static HINSTANCE gldll; @@ -814,14 +697,21 @@ int VID_InitMode (int fullscreen, int width, int height, int bpp, int stencil) HGLRC baseRC; int CenterX, CenterY; const char *gldrivername; - + if (vid_initialized) Sys_Error("VID_InitMode called when video is already initialised\n"); + // if stencil is enabled, ask for alpha too if (stencil) + { pfd.cStencilBits = 8; + pfd.cAlphaBits = 8; + } else + { pfd.cStencilBits = 0; + pfd.cAlphaBits = 0; + } gldrivername = "opengl32.dll"; i = COM_CheckParm("-gl_driver"); @@ -904,8 +794,8 @@ int VID_InitMode (int fullscreen, int width, int height, int bpp, int stencil) mainwindow = CreateWindowEx (ExWindowStyle, "DarkPlacesWindowClass", gamename, WindowStyle, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, NULL, NULL, global_hInstance, NULL); if (!mainwindow) { + Con_Printf("CreateWindowEx(%d, %s, %s, %d, %d, %d, %d, %d, %p, %p, %d, %p) failed\n", ExWindowStyle, "DarkPlacesWindowClass", gamename, WindowStyle, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, NULL, NULL, global_hInstance, NULL); VID_Shutdown(); - Con_Printf("CreateWindowEx(%d, %s, %s, %d, %d, %d, %d, %d, %p, %p, %d, %p) failed\n", ExWindowStyle, gamename, gamename, WindowStyle, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, NULL, NULL, global_hInstance, NULL); return false; } @@ -1031,36 +921,28 @@ void VID_Shutdown (void) HGLRC hRC = 0; HDC hDC = 0; - if (vid_initialized) - { - vid_initialized = false; - IN_Shutdown(); - - if (qwglGetCurrentContext) - hRC = qwglGetCurrentContext(); - - if (qwglGetCurrentDC) - hDC = qwglGetCurrentDC(); - - if (qwglMakeCurrent) - qwglMakeCurrent(NULL, NULL); - - if (hRC && qwglDeleteContext) - qwglDeleteContext(hRC); - - // close the library before we get rid of the window - GL_CloseLibrary(); - - if (hDC && mainwindow) - ReleaseDC(mainwindow, hDC); - - if (vid_isfullscreen) - ChangeDisplaySettings (NULL, 0); - - AppActivate(false, false); - - VID_RestoreSystemGamma(); - } + vid_initialized = false; + IN_Shutdown(); + if (qwglGetCurrentContext) + hRC = qwglGetCurrentContext(); + if (qwglGetCurrentDC) + hDC = qwglGetCurrentDC(); + if (qwglMakeCurrent) + qwglMakeCurrent(NULL, NULL); + if (hRC && qwglDeleteContext) + qwglDeleteContext(hRC); + // close the library before we get rid of the window + GL_CloseLibrary(); + if (hDC && mainwindow) + ReleaseDC(mainwindow, hDC); + if (vid_isfullscreen) + ChangeDisplaySettings (NULL, 0); + vid_isfullscreen = false; + AppActivate(false, false); + VID_RestoreSystemGamma(); + if (mainwindow) + DestroyWindow(mainwindow); + mainwindow = 0; }