mirror of
https://github.com/1dot13/source.git
synced 2026-08-26 14:30:26 +02:00
Added new, optional JA2.INI parameter to select windowed mode instead of Fullscreen ([Ja2 Setting] SCREEN_MODE_WINDOWED=1). To keep Fullscreen, simply omit this swith or set it to 0. Also, added a cmdline switch for the same effect, but with higher prio. /FULLSCREEN overwrites INI/SCREEN_MODE_WINDOWED=1 while /WINDOW overrides INI/SCREEN_MODE_WINDOWED=0.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@734 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+13
-2
@@ -6,8 +6,19 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
int iResolution; // INI file
|
int iResolution; // INI file
|
||||||
// WANNE
|
/* WANNE, Sgt.Kolja
|
||||||
int iScreenMode; // INI file (Windowed or Fullscreen) // REPLACE all defines WINDOWED_MODE with this variable
|
* INI file (Windowed or Fullscreen)
|
||||||
|
* REPLACE all defines WINDOWED_MODE with this variable
|
||||||
|
* this is the LAST occurence of WINDOWED_MODE !
|
||||||
|
* If (and only if) optionally set, we got a preset of
|
||||||
|
* Windowed Screen. But this can be overloaded by INI or CmdLine
|
||||||
|
*/
|
||||||
|
#ifdef WINDOWED_MODE
|
||||||
|
int iScreenMode = 1; /* 1 for Windowed, 0 for Fullscreen */
|
||||||
|
#else
|
||||||
|
int iScreenMode = 0; /* 0 for Fullscreen */
|
||||||
|
#endif
|
||||||
|
BOOL bScreenModeCmdLine = FALSE;
|
||||||
|
|
||||||
int SCREEN_WIDTH;
|
int SCREEN_WIDTH;
|
||||||
int SCREEN_HEIGHT;
|
int SCREEN_HEIGHT;
|
||||||
|
|||||||
@@ -54,6 +54,8 @@
|
|||||||
extern UINT32 MemDebugCounter;
|
extern UINT32 MemDebugCounter;
|
||||||
#ifdef JA2
|
#ifdef JA2
|
||||||
extern BOOLEAN gfPauseDueToPlayerGamePause;
|
extern BOOLEAN gfPauseDueToPlayerGamePause;
|
||||||
|
extern int iScreenMode;
|
||||||
|
extern BOOL bScreenModeCmdLine;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern BOOLEAN CheckIfGameCdromIsInCDromDrive();
|
extern BOOLEAN CheckIfGameCdromIsInCDromDrive();
|
||||||
@@ -89,9 +91,7 @@ HINSTANCE ghInstance;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Global Variable Declarations
|
// Global Variable Declarations
|
||||||
#ifdef WINDOWED_MODE
|
|
||||||
RECT rcWindow;
|
RECT rcWindow;
|
||||||
#endif
|
|
||||||
|
|
||||||
// moved from header file: 24mar98:HJH
|
// moved from header file: 24mar98:HJH
|
||||||
UINT32 giStartMem;
|
UINT32 giStartMem;
|
||||||
@@ -139,14 +139,14 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef JA2
|
#ifdef JA2
|
||||||
#ifdef WINDOWED_MODE
|
|
||||||
case WM_MOVE:
|
case WM_MOVE:
|
||||||
|
if( 1==iScreenMode )
|
||||||
GetClientRect(hWindow, &rcWindow);
|
{
|
||||||
ClientToScreen(hWindow, (LPPOINT)&rcWindow);
|
GetClientRect(hWindow, &rcWindow);
|
||||||
ClientToScreen(hWindow, (LPPOINT)&rcWindow+1);
|
ClientToScreen(hWindow, (LPPOINT)&rcWindow);
|
||||||
|
ClientToScreen(hWindow, (LPPOINT)&rcWindow+1);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
#else
|
#else
|
||||||
case WM_MOUSEMOVE:
|
case WM_MOUSEMOVE:
|
||||||
break;
|
break;
|
||||||
@@ -905,6 +905,11 @@ void GetRuntimeSettings( )
|
|||||||
|
|
||||||
iScreenWidthOffset = (SCREEN_WIDTH - 640) / 2;
|
iScreenWidthOffset = (SCREEN_WIDTH - 640) / 2;
|
||||||
iScreenHeightOffset = (SCREEN_HEIGHT - 480) / 2;
|
iScreenHeightOffset = (SCREEN_HEIGHT - 480) / 2;
|
||||||
|
|
||||||
|
/* Sergeant_Kolja. 2007-02-20: runtime Windowed mode instead of compile-time */
|
||||||
|
/* 1 for Windowed, 0 for Fullscreen */
|
||||||
|
if( !bScreenModeCmdLine )
|
||||||
|
iScreenMode = (int) GetPrivateProfileInt( "Ja2 Settings","SCREEN_MODE_WINDOWED", iScreenMode, INIFile );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShutdownWithErrorBox(CHAR8 *pcMessage)
|
void ShutdownWithErrorBox(CHAR8 *pcMessage)
|
||||||
@@ -1014,8 +1019,22 @@ void ProcessJa2CommandLineBeforeInitialization(CHAR8 *pCommandLine)
|
|||||||
//disable the sound
|
//disable the sound
|
||||||
SoundEnableSound(FALSE);
|
SoundEnableSound(FALSE);
|
||||||
}
|
}
|
||||||
|
else if(!_strnicmp(pToken, "/FULLSCREEN", 11))
|
||||||
|
{
|
||||||
|
//overwrite Graphic setting from JA2_settings.ini
|
||||||
|
iScreenMode=0; /* 1 for Windowed, 0 for Fullscreen */
|
||||||
|
bScreenModeCmdLine = TRUE; /* if set TRUE, INI is no longer evaluated */
|
||||||
|
/* no resolution read from Args. Still from INI, but could be added here, too...*/
|
||||||
|
}
|
||||||
|
else if(!_strnicmp(pToken, "/WINDOW", 7))
|
||||||
|
{
|
||||||
|
//overwrite Graphic setting from JA2_settings.ini
|
||||||
|
iScreenMode=1; /* 1 for Windowed, 0 for Fullscreen */
|
||||||
|
bScreenModeCmdLine = TRUE; /* if set TRUE, INI is no longer evaluated */
|
||||||
|
/* no resolution read from Args. Still from INI, but could be added here, too...*/
|
||||||
|
}
|
||||||
|
|
||||||
//get the next token
|
//get the next token
|
||||||
pToken=strtok(NULL, cSeparators);
|
pToken=strtok(NULL, cSeparators);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+106
-126
@@ -22,6 +22,8 @@
|
|||||||
#define _MT
|
#define _MT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
extern int iScreenMode;
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Local Defines
|
// Local Defines
|
||||||
@@ -101,15 +103,9 @@ static LPDIRECTDRAWSURFACE2 gpBackBuffer = NULL;
|
|||||||
|
|
||||||
static LPDIRECTDRAWSURFACE _gpFrameBuffer = NULL;
|
static LPDIRECTDRAWSURFACE _gpFrameBuffer = NULL;
|
||||||
static LPDIRECTDRAWSURFACE2 gpFrameBuffer = NULL;
|
static LPDIRECTDRAWSURFACE2 gpFrameBuffer = NULL;
|
||||||
|
|
||||||
#ifdef WINDOWED_MODE
|
|
||||||
|
|
||||||
static LPDIRECTDRAWSURFACE _gpBackBuffer = NULL;
|
static LPDIRECTDRAWSURFACE _gpBackBuffer = NULL;
|
||||||
|
extern RECT rcWindow;
|
||||||
|
|
||||||
extern RECT rcWindow;
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -217,11 +213,7 @@ BOOLEAN InitializeVideoManager(HINSTANCE hInstance, UINT16 usCommandShow, void *
|
|||||||
DDSURFACEDESC SurfaceDescription;
|
DDSURFACEDESC SurfaceDescription;
|
||||||
DDCOLORKEY ColorKey;
|
DDCOLORKEY ColorKey;
|
||||||
PTR pTmpPointer;
|
PTR pTmpPointer;
|
||||||
|
|
||||||
#ifndef WINDOWED_MODE
|
|
||||||
DDSCAPS SurfaceCaps;
|
DDSCAPS SurfaceCaps;
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Register debug topics
|
// Register debug topics
|
||||||
@@ -255,11 +247,11 @@ BOOLEAN InitializeVideoManager(HINSTANCE hInstance, UINT16 usCommandShow, void *
|
|||||||
// Get a window handle for our application (gotta have on of those)
|
// Get a window handle for our application (gotta have on of those)
|
||||||
// Don't change this
|
// Don't change this
|
||||||
//
|
//
|
||||||
#ifdef WINDOWED_MODE
|
if( 1==iScreenMode )
|
||||||
hWindow = CreateWindowEx(0, (LPCSTR) ClassName, "Windowed JA2 !!", WS_POPUP, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, NULL, NULL, hInstance, NULL);
|
hWindow = CreateWindowEx(0, (LPCSTR) ClassName, "Windowed JA2 !!", WS_POPUP, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, NULL, NULL, hInstance, NULL);
|
||||||
#else
|
else
|
||||||
hWindow = CreateWindowEx(WS_EX_TOPMOST, (LPCSTR) ClassName, (LPCSTR)ClassName, WS_POPUP | WS_VISIBLE, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), NULL, NULL, hInstance, NULL);
|
hWindow = CreateWindowEx(WS_EX_TOPMOST, (LPCSTR) ClassName, (LPCSTR)ClassName, WS_POPUP | WS_VISIBLE, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), NULL, NULL, hInstance, NULL);
|
||||||
#endif
|
|
||||||
if (hWindow == NULL)
|
if (hWindow == NULL)
|
||||||
{
|
{
|
||||||
DebugMsg(TOPIC_VIDEO, DBG_LEVEL_0, "Failed to create window frame for Direct Draw");
|
DebugMsg(TOPIC_VIDEO, DBG_LEVEL_0, "Failed to create window frame for Direct Draw");
|
||||||
@@ -311,11 +303,11 @@ BOOLEAN InitializeVideoManager(HINSTANCE hInstance, UINT16 usCommandShow, void *
|
|||||||
//
|
//
|
||||||
// Set the exclusive mode
|
// Set the exclusive mode
|
||||||
//
|
//
|
||||||
#ifdef WINDOWED_MODE
|
if( 1==iScreenMode ) /* Windowed mode */
|
||||||
ReturnCode = IDirectDraw2_SetCooperativeLevel(gpDirectDrawObject, ghWindow, DDSCL_NORMAL );
|
ReturnCode = IDirectDraw2_SetCooperativeLevel(gpDirectDrawObject, ghWindow, DDSCL_NORMAL );
|
||||||
#else
|
else
|
||||||
ReturnCode = IDirectDraw2_SetCooperativeLevel(gpDirectDrawObject, ghWindow, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN );
|
ReturnCode = IDirectDraw2_SetCooperativeLevel(gpDirectDrawObject, ghWindow, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN );
|
||||||
#endif
|
|
||||||
if (ReturnCode != DD_OK)
|
if (ReturnCode != DD_OK)
|
||||||
{
|
{
|
||||||
DirectXAttempt ( ReturnCode, __LINE__, __FILE__ );
|
DirectXAttempt ( ReturnCode, __LINE__, __FILE__ );
|
||||||
@@ -325,14 +317,15 @@ BOOLEAN InitializeVideoManager(HINSTANCE hInstance, UINT16 usCommandShow, void *
|
|||||||
//
|
//
|
||||||
// Set the display mode
|
// Set the display mode
|
||||||
//
|
//
|
||||||
#ifndef WINDOWED_MODE
|
if( 0==iScreenMode ) /* Fullscreen mode */
|
||||||
ReturnCode = IDirectDraw2_SetDisplayMode( gpDirectDrawObject, SCREEN_WIDTH, SCREEN_HEIGHT, gbPixelDepth, 0, 0 );
|
{
|
||||||
if (ReturnCode != DD_OK)
|
ReturnCode = IDirectDraw2_SetDisplayMode( gpDirectDrawObject, SCREEN_WIDTH, SCREEN_HEIGHT, gbPixelDepth, 0, 0 );
|
||||||
{
|
if (ReturnCode != DD_OK)
|
||||||
DirectXAttempt ( ReturnCode, __LINE__, __FILE__ );
|
{
|
||||||
return FALSE;
|
DirectXAttempt ( ReturnCode, __LINE__, __FILE__ );
|
||||||
}
|
return FALSE;
|
||||||
#endif
|
}
|
||||||
|
}
|
||||||
|
|
||||||
gusScreenWidth = SCREEN_WIDTH;
|
gusScreenWidth = SCREEN_WIDTH;
|
||||||
gusScreenHeight = SCREEN_HEIGHT;
|
gusScreenHeight = SCREEN_HEIGHT;
|
||||||
@@ -349,81 +342,80 @@ BOOLEAN InitializeVideoManager(HINSTANCE hInstance, UINT16 usCommandShow, void *
|
|||||||
//
|
//
|
||||||
|
|
||||||
ZEROMEM(SurfaceDescription);
|
ZEROMEM(SurfaceDescription);
|
||||||
#ifdef WINDOWED_MODE
|
if( 1==iScreenMode ) /* Windowed mode */
|
||||||
|
{
|
||||||
|
// Create a primary surface and a backbuffer in system memory
|
||||||
|
SurfaceDescription.dwSize = sizeof(DDSURFACEDESC);
|
||||||
|
SurfaceDescription.dwFlags = DDSD_CAPS;
|
||||||
|
SurfaceDescription.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
|
||||||
|
|
||||||
// Create a primary surface and a backbuffer in system memory
|
ReturnCode = IDirectDraw2_CreateSurface ( gpDirectDrawObject, &SurfaceDescription, &_gpPrimarySurface, NULL );
|
||||||
SurfaceDescription.dwSize = sizeof(DDSURFACEDESC);
|
if (ReturnCode != DD_OK)
|
||||||
SurfaceDescription.dwFlags = DDSD_CAPS;
|
{
|
||||||
SurfaceDescription.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
|
DirectXAttempt ( ReturnCode, __LINE__, __FILE__ );
|
||||||
|
return FALSE;
|
||||||
ReturnCode = IDirectDraw2_CreateSurface ( gpDirectDrawObject, &SurfaceDescription, &_gpPrimarySurface, NULL );
|
}
|
||||||
if (ReturnCode != DD_OK)
|
|
||||||
{
|
|
||||||
DirectXAttempt ( ReturnCode, __LINE__, __FILE__ );
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ReturnCode = IDirectDrawSurface_QueryInterface(_gpPrimarySurface, /*&*/IID_IDirectDrawSurface2, (LPVOID *)&gpPrimarySurface); // (jonathanl)
|
ReturnCode = IDirectDrawSurface_QueryInterface(_gpPrimarySurface, /*&*/IID_IDirectDrawSurface2, (LPVOID *)&gpPrimarySurface); // (jonathanl)
|
||||||
if (ReturnCode != DD_OK)
|
if (ReturnCode != DD_OK)
|
||||||
{
|
{
|
||||||
DirectXAttempt ( ReturnCode, __LINE__, __FILE__ );
|
DirectXAttempt ( ReturnCode, __LINE__, __FILE__ );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Backbuffer
|
// Backbuffer
|
||||||
ZEROMEM(SurfaceDescription);
|
ZEROMEM(SurfaceDescription);
|
||||||
SurfaceDescription.dwSize = sizeof(DDSURFACEDESC);
|
SurfaceDescription.dwSize = sizeof(DDSURFACEDESC);
|
||||||
SurfaceDescription.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
|
SurfaceDescription.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
|
||||||
SurfaceDescription.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY;
|
SurfaceDescription.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY;
|
||||||
SurfaceDescription.dwWidth = SCREEN_WIDTH;
|
SurfaceDescription.dwWidth = SCREEN_WIDTH;
|
||||||
SurfaceDescription.dwHeight = SCREEN_HEIGHT;
|
SurfaceDescription.dwHeight = SCREEN_HEIGHT;
|
||||||
ReturnCode = IDirectDraw2_CreateSurface ( gpDirectDrawObject, &SurfaceDescription, &_gpBackBuffer, NULL );
|
ReturnCode = IDirectDraw2_CreateSurface ( gpDirectDrawObject, &SurfaceDescription, &_gpBackBuffer, NULL );
|
||||||
if (ReturnCode != DD_OK)
|
if (ReturnCode != DD_OK)
|
||||||
{
|
{
|
||||||
DirectXAttempt ( ReturnCode, __LINE__, __FILE__ );
|
DirectXAttempt ( ReturnCode, __LINE__, __FILE__ );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ReturnCode = IDirectDrawSurface_QueryInterface(_gpBackBuffer, /*&*/IID_IDirectDrawSurface2, (LPVOID *)&gpBackBuffer); // (jonathanl)
|
ReturnCode = IDirectDrawSurface_QueryInterface(_gpBackBuffer, /*&*/IID_IDirectDrawSurface2, (LPVOID *)&gpBackBuffer); // (jonathanl)
|
||||||
if (ReturnCode != DD_OK)
|
if (ReturnCode != DD_OK)
|
||||||
{
|
{
|
||||||
DirectXAttempt ( ReturnCode, __LINE__, __FILE__ );
|
DirectXAttempt ( ReturnCode, __LINE__, __FILE__ );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else /* iScreenMode = FULLSCREEN */
|
||||||
|
{
|
||||||
|
SurfaceDescription.dwSize = sizeof(DDSURFACEDESC);
|
||||||
|
SurfaceDescription.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT;
|
||||||
|
SurfaceDescription.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP | DDSCAPS_COMPLEX;
|
||||||
|
SurfaceDescription.dwBackBufferCount = 1;
|
||||||
|
|
||||||
|
ReturnCode = IDirectDraw2_CreateSurface ( gpDirectDrawObject, &SurfaceDescription, &_gpPrimarySurface, NULL );
|
||||||
|
if (ReturnCode != DD_OK)
|
||||||
|
{
|
||||||
|
DirectXAttempt ( ReturnCode, __LINE__, __FILE__ );
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#else
|
ReturnCode = IDirectDrawSurface_QueryInterface(_gpPrimarySurface, /*&*/IID_IDirectDrawSurface2, (LPVOID *) &gpPrimarySurface);
|
||||||
SurfaceDescription.dwSize = sizeof(DDSURFACEDESC);
|
if (ReturnCode != DD_OK)
|
||||||
SurfaceDescription.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT;
|
{
|
||||||
SurfaceDescription.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP | DDSCAPS_COMPLEX;
|
DirectXAttempt ( ReturnCode, __LINE__, __FILE__ );
|
||||||
SurfaceDescription.dwBackBufferCount = 1;
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
ReturnCode = IDirectDraw2_CreateSurface ( gpDirectDrawObject, &SurfaceDescription, &_gpPrimarySurface, NULL );
|
SurfaceCaps.dwCaps = DDSCAPS_BACKBUFFER;
|
||||||
if (ReturnCode != DD_OK)
|
ReturnCode = IDirectDrawSurface2_GetAttachedSurface( gpPrimarySurface, &SurfaceCaps, &gpBackBuffer );
|
||||||
{
|
if (ReturnCode != DD_OK)
|
||||||
DirectXAttempt ( ReturnCode, __LINE__, __FILE__ );
|
{
|
||||||
return FALSE;
|
DirectXAttempt ( ReturnCode, __LINE__, __FILE__ );
|
||||||
}
|
return FALSE;
|
||||||
|
}
|
||||||
|
} /* endif iScreenMode */
|
||||||
ReturnCode = IDirectDrawSurface_QueryInterface(_gpPrimarySurface, /*&*/IID_IDirectDrawSurface2, (LPVOID *) &gpPrimarySurface);
|
|
||||||
if (ReturnCode != DD_OK)
|
|
||||||
{
|
|
||||||
DirectXAttempt ( ReturnCode, __LINE__, __FILE__ );
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
SurfaceCaps.dwCaps = DDSCAPS_BACKBUFFER;
|
|
||||||
ReturnCode = IDirectDrawSurface2_GetAttachedSurface( gpPrimarySurface, &SurfaceCaps, &gpBackBuffer );
|
|
||||||
if (ReturnCode != DD_OK)
|
|
||||||
{
|
|
||||||
DirectXAttempt ( ReturnCode, __LINE__, __FILE__ );
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Initialize the frame buffer
|
// Initialize the frame buffer
|
||||||
@@ -2153,20 +2145,28 @@ void RefreshScreen(void *DummyVariable)
|
|||||||
//
|
//
|
||||||
// Step (1) - Flip pages
|
// Step (1) - Flip pages
|
||||||
//
|
//
|
||||||
#ifdef WINDOWED_MODE
|
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
if( 1==iScreenMode ) /* Windowed mode */
|
||||||
|
{
|
||||||
|
ReturnCode = IDirectDrawSurface_Blt(
|
||||||
|
gpPrimarySurface, // dest surface
|
||||||
|
&rcWindow, // dest rect
|
||||||
|
gpBackBuffer, // src surface
|
||||||
|
NULL, // src rect (all of it)
|
||||||
|
DDBLT_WAIT,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ReturnCode = IDirectDrawSurface_Flip(
|
||||||
|
_gpPrimarySurface,
|
||||||
|
NULL,
|
||||||
|
gGameExternalOptions.gfVSync ? DDFLIP_WAIT : 0x00000008l
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
ReturnCode = IDirectDrawSurface_Blt(
|
if ((ReturnCode != DD_OK)&&(ReturnCode != DDERR_WASSTILLDRAWING))
|
||||||
gpPrimarySurface, // dest surface
|
|
||||||
&rcWindow, // dest rect
|
|
||||||
gpBackBuffer, // src surface
|
|
||||||
NULL, // src rect (all of it)
|
|
||||||
DDBLT_WAIT,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
if ((ReturnCode != DD_OK)&&(ReturnCode != DDERR_WASSTILLDRAWING))
|
|
||||||
{
|
{
|
||||||
DirectXAttempt ( ReturnCode, __LINE__, __FILE__ );
|
DirectXAttempt ( ReturnCode, __LINE__, __FILE__ );
|
||||||
|
|
||||||
@@ -2179,26 +2179,6 @@ void RefreshScreen(void *DummyVariable)
|
|||||||
} while (ReturnCode != DD_OK);
|
} while (ReturnCode != DD_OK);
|
||||||
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
ReturnCode = IDirectDrawSurface_Flip(_gpPrimarySurface, NULL, gGameExternalOptions.gfVSync ? DDFLIP_WAIT : 0x00000008l );//DDFLIP_WAIT );
|
|
||||||
// if ((ReturnCode != DD_OK)&&(ReturnCode != DDERR_WASSTILLDRAWING))
|
|
||||||
if ((ReturnCode != DD_OK)&&(ReturnCode != DDERR_WASSTILLDRAWING))
|
|
||||||
{
|
|
||||||
DirectXAttempt ( ReturnCode, __LINE__, __FILE__ );
|
|
||||||
|
|
||||||
if (ReturnCode == DDERR_SURFACELOST)
|
|
||||||
{
|
|
||||||
goto ENDOFLOOP;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} while (ReturnCode != DD_OK);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Step (2) - Copy Primary Surface to the Back Buffer
|
// Step (2) - Copy Primary Surface to the Back Buffer
|
||||||
//
|
//
|
||||||
|
|||||||
+13
-17
@@ -15,6 +15,7 @@
|
|||||||
#include "fade screen.h"
|
#include "fade screen.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
extern int iScreenMode;
|
||||||
|
|
||||||
UINT32 uiMusicHandle=NO_SAMPLE;
|
UINT32 uiMusicHandle=NO_SAMPLE;
|
||||||
UINT32 uiMusicVolume=50;
|
UINT32 uiMusicVolume=50;
|
||||||
@@ -99,9 +100,10 @@ void MusicStopCallback( void *pData );
|
|||||||
//********************************************************************************
|
//********************************************************************************
|
||||||
BOOLEAN MusicPlay(UINT32 uiNum)
|
BOOLEAN MusicPlay(UINT32 uiNum)
|
||||||
{
|
{
|
||||||
#ifndef WINDOWED_MODE
|
if( 1==iScreenMode ) /* on Windowed mode, skip the music? was coded for WINDOWED_MODE that way...*/
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
SOUNDPARMS spParms;
|
SOUNDPARMS spParms;
|
||||||
|
|
||||||
if(fMusicPlaying)
|
if(fMusicPlaying)
|
||||||
MusicStop();
|
MusicStop();
|
||||||
@@ -128,10 +130,6 @@ SOUNDPARMS spParms;
|
|||||||
}
|
}
|
||||||
|
|
||||||
//DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "Music PLay %d %d", uiMusicHandle, gubMusicMode ) );
|
//DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "Music PLay %d %d", uiMusicHandle, gubMusicMode ) );
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,9 +145,11 @@ BOOLEAN MusicSetVolume(UINT32 uiVolume)
|
|||||||
{
|
{
|
||||||
INT32 uiOldMusicVolume = uiMusicVolume;
|
INT32 uiOldMusicVolume = uiMusicVolume;
|
||||||
|
|
||||||
#ifndef WINDOWED_MODE
|
if( 1==iScreenMode ) /* on Windowed mode, skip the music? was coded for WINDOWED_MODE that way...*/
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
uiMusicVolume=__min(uiVolume, 127);
|
|
||||||
|
uiMusicVolume=__min(uiVolume, 127);
|
||||||
|
|
||||||
if(uiMusicHandle!=NO_SAMPLE)
|
if(uiMusicHandle!=NO_SAMPLE)
|
||||||
{
|
{
|
||||||
@@ -173,8 +173,6 @@ BOOLEAN MusicSetVolume(UINT32 uiVolume)
|
|||||||
StartMusicBasedOnMode( );
|
StartMusicBasedOnMode( );
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -201,8 +199,8 @@ UINT32 MusicGetVolume(void)
|
|||||||
//********************************************************************************
|
//********************************************************************************
|
||||||
BOOLEAN MusicStop(void)
|
BOOLEAN MusicStop(void)
|
||||||
{
|
{
|
||||||
|
if( 1==iScreenMode ) /* on Windowed mode, skip the music? was coded for WINDOWED_MODE that way...*/
|
||||||
#ifndef WINDOWED_MODE
|
return(FALSE);
|
||||||
|
|
||||||
|
|
||||||
if(uiMusicHandle!=NO_SAMPLE)
|
if(uiMusicHandle!=NO_SAMPLE)
|
||||||
@@ -216,9 +214,6 @@ BOOLEAN MusicStop(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "Music Stop %d %d", uiMusicHandle, gubMusicMode ) );
|
//DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "Music Stop %d %d", uiMusicHandle, gubMusicMode ) );
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -271,7 +266,9 @@ BOOLEAN MusicPoll( BOOLEAN fForce )
|
|||||||
{
|
{
|
||||||
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"MusicPoll");
|
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"MusicPoll");
|
||||||
|
|
||||||
#ifndef WINDOWED_MODE
|
if( 1==iScreenMode ) /* on Windowed mode, skip the music? was coded for WINDOWED_MODE that way...*/
|
||||||
|
return(TRUE);
|
||||||
|
|
||||||
INT32 iVol;
|
INT32 iVol;
|
||||||
|
|
||||||
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"MusicPoll: SoundServiceStreams ");
|
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"MusicPoll: SoundServiceStreams ");
|
||||||
@@ -356,7 +353,6 @@ BOOLEAN MusicPoll( BOOLEAN fForce )
|
|||||||
gfDontRestartSong = FALSE;
|
gfDontRestartSong = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"MusicPoll done");
|
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"MusicPoll done");
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
|
|||||||
Reference in New Issue
Block a user