git-svn-id: https://svn.eduke32.com/eduke32@904 1a8010ca-5511-0410-912e-c29ae57300e0

This commit is contained in:
terminx 2008-07-25 23:39:41 +00:00
parent f5b049379c
commit d1df28e457
3 changed files with 42 additions and 16 deletions

View file

@ -2890,28 +2890,28 @@ static void ReleaseDirectDrawSurfaces(void)
{ {
if (lpDDPalette) if (lpDDPalette)
{ {
initprintf(" - Releasing palette\n"); // initprintf(" - Releasing palette\n");
IDirectDrawPalette_Release(lpDDPalette); IDirectDrawPalette_Release(lpDDPalette);
lpDDPalette = NULL; lpDDPalette = NULL;
} }
if (lpDDSBack) if (lpDDSBack)
{ {
initprintf(" - Releasing back-buffer surface\n"); // initprintf(" - Releasing back-buffer surface\n");
IDirectDrawSurface_Release(lpDDSBack); IDirectDrawSurface_Release(lpDDSBack);
lpDDSBack = NULL; lpDDSBack = NULL;
} }
if (lpDDSPrimary) if (lpDDSPrimary)
{ {
initprintf(" - Releasing primary surface\n"); // initprintf(" - Releasing primary surface\n");
IDirectDrawSurface_Release(lpDDSPrimary); IDirectDrawSurface_Release(lpDDSPrimary);
lpDDSPrimary = NULL; lpDDSPrimary = NULL;
} }
if (lpOffscreen) if (lpOffscreen)
{ {
initprintf(" - Freeing offscreen buffer\n"); // initprintf(" - Freeing offscreen buffer\n");
free(lpOffscreen); free(lpOffscreen);
lpOffscreen = NULL; lpOffscreen = NULL;
} }
@ -2934,7 +2934,7 @@ static int SetupDirectDraw(int width, int height)
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP | DDSCAPS_COMPLEX; ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP | DDSCAPS_COMPLEX;
ddsd.dwBackBufferCount = 2; // triple-buffer ddsd.dwBackBufferCount = 2; // triple-buffer
initprintf(" - Creating primary surface\n"); // initprintf(" - Creating primary surface\n");
result = IDirectDraw_CreateSurface(lpDD, &ddsd, &lpDDSPrimary, NULL); result = IDirectDraw_CreateSurface(lpDD, &ddsd, &lpDDSPrimary, NULL);
if (result != DD_OK) if (result != DD_OK)
{ {
@ -2947,7 +2947,7 @@ static int SetupDirectDraw(int width, int height)
ddsd.ddsCaps.dwCaps = DDSCAPS_BACKBUFFER; ddsd.ddsCaps.dwCaps = DDSCAPS_BACKBUFFER;
numpages = 1; // KJS 20031225 numpages = 1; // KJS 20031225
initprintf(" - Getting back buffer\n"); // initprintf(" - Getting back buffer\n");
result = IDirectDrawSurface_GetAttachedSurface(lpDDSPrimary, &ddsd.ddsCaps, &lpDDSBack); result = IDirectDrawSurface_GetAttachedSurface(lpDDSPrimary, &ddsd.ddsCaps, &lpDDSBack);
if (result != DD_OK) if (result != DD_OK)
{ {
@ -2956,7 +2956,7 @@ static int SetupDirectDraw(int width, int height)
return TRUE; return TRUE;
} }
initprintf(" - Allocating offscreen buffer\n"); // initprintf(" - Allocating offscreen buffer\n");
lpOffscreen = (char *)malloc((width|1)*height); lpOffscreen = (char *)malloc((width|1)*height);
if (!lpOffscreen) if (!lpOffscreen)
{ {
@ -2966,7 +2966,7 @@ static int SetupDirectDraw(int width, int height)
} }
// attach a palette to the primary surface // attach a palette to the primary surface
initprintf(" - Creating palette\n"); // initprintf(" - Creating palette\n");
for (i=0; i<256; i++) for (i=0; i<256; i++)
curpalettefaded[i].f = PC_NOCOLLAPSE; curpalettefaded[i].f = PC_NOCOLLAPSE;
result = IDirectDraw_CreatePalette(lpDD, DDPCAPS_8BIT | DDPCAPS_ALLOW256, (LPPALETTEENTRY)curpalettefaded, &lpDDPalette, NULL); result = IDirectDraw_CreatePalette(lpDD, DDPCAPS_8BIT | DDPCAPS_ALLOW256, (LPPALETTEENTRY)curpalettefaded, &lpDDPalette, NULL);
@ -4084,19 +4084,18 @@ static LRESULT CALLBACK WndProcCallback(HWND hWnd, UINT uMsg, WPARAM wParam, LPA
case WM_PALETTECHANGED: case WM_PALETTECHANGED:
// someone stole the palette so try and steal it back // someone stole the palette so try and steal it back
if (appactive && (HWND)wParam != hWindow) setpalette(0,0);
if (bDDrawInited && bpp == 8 && fullscreen) if (bDDrawInited && bpp == 8 && fullscreen)
{ {
int result = IDirectDrawSurface_SetPalette(lpDDSPrimary, lpDDPalette); int result = IDirectDrawSurface_SetPalette(lpDDSPrimary, lpDDPalette);
OSD_Printf("DirectDraw palette stolen! Resetting...\n");
if (result != DD_OK) if (result != DD_OK)
{ {
ShowDDrawErrorBox("Failure setting palette", result); initprintf("Palette set failed: %s\n", GetDDrawError(result));
UninitDirectDraw();
break; break;
} }
setpalette(0,0); setpalette(0,256);
break;
} }
if (appactive && (HWND)wParam != hWindow) setpalette(0,256);
break; break;
case WM_DISPLAYCHANGE: case WM_DISPLAYCHANGE:

View file

@ -8245,7 +8245,7 @@ FAKE_F3:
restorepalette = 1; restorepalette = 1;
vscrn(); vscrn();
} }
/*
if (KB_UnBoundKeyPressed(sc_F11)) if (KB_UnBoundKeyPressed(sc_F11))
{ {
KB_ClearKeyDown(sc_F11); KB_ClearKeyDown(sc_F11);
@ -8261,6 +8261,20 @@ FAKE_F3:
if (ud.brightness < 40) FTA(29 + (ud.brightness>>3) ,g_player[myconnectindex].ps); if (ud.brightness < 40) FTA(29 + (ud.brightness>>3) ,g_player[myconnectindex].ps);
else if (ud.brightness < 80) FTA(96 + (ud.brightness>>3) - 5,g_player[myconnectindex].ps); else if (ud.brightness < 80) FTA(96 + (ud.brightness>>3) - 5,g_player[myconnectindex].ps);
} }
*/
if (KB_UnBoundKeyPressed(sc_F11))
{
KB_ClearKeyDown(sc_F11);
cmenu(232);
FX_StopAllSounds();
clearsoundlocks();
g_player[myconnectindex].ps->gm |= MODE_MENU;
if (ud.multimode < 2 && ud.recstat != 2)
{
ready2send = 0;
totalclock = ototalclock;
}
}
} }
static void comlinehelp(void) static void comlinehelp(void)

View file

@ -2572,6 +2572,7 @@ cheat_for_port_credits:
#endif #endif
break; break;
case 231: case 231:
case 232:
rotatesprite(320<<15,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); rotatesprite(320<<15,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1);
menutext(320>>1,24,0,0,"COLOR CORRECTION"); menutext(320>>1,24,0,0,"COLOR CORRECTION");
@ -2584,8 +2585,20 @@ cheat_for_port_credits:
if (x == -1) if (x == -1)
{ {
cmenu(203); if (g_player[myconnectindex].ps->gm&MODE_GAME && current_menu == 232)
probey = 4; {
g_player[myconnectindex].ps->gm &= ~MODE_MENU;
if (ud.multimode < 2 && ud.recstat != 2)
{
ready2send = 1;
totalclock = ototalclock;
}
}
else
{
cmenu(203);
probey = 4;
}
break; break;
} }