mirror of
https://github.com/1dot13/source.git
synced 2026-07-29 13:52:17 +02:00
remove UTIL and JA2 preprocessor definitions (#66)
UTIL is never used, and JA2 is always used. assumption being we'll never make 1.13 for Wizardry 8. video2.h doesn't exist, which prevented me from deleting it.
This commit is contained in:
@@ -15,13 +15,8 @@
|
||||
#include "Random.h"
|
||||
#include "gameloop.h"
|
||||
#include "soundman.h"
|
||||
#ifdef JA2
|
||||
#include "JA2 Splash.h"
|
||||
#include "Timer Control.h"
|
||||
#endif
|
||||
#if !defined( JA2 ) && !defined( UTIL )
|
||||
#include "GameData.h" // for MoveTimer() [Wizardry specific]
|
||||
#endif
|
||||
#include "LibraryDataBase.h"
|
||||
#include "utilities.h"
|
||||
|
||||
@@ -56,10 +51,8 @@
|
||||
#include "connect.h"
|
||||
#include "english.h"
|
||||
|
||||
#ifdef JA2
|
||||
#include "BuildDefines.h"
|
||||
#include "Intro.h"
|
||||
#endif
|
||||
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
@@ -125,11 +118,9 @@ void SHOWEXCEPTION(vfs::Exception& ex)
|
||||
|
||||
|
||||
extern UINT32 MemDebugCounter;
|
||||
#ifdef JA2
|
||||
extern BOOLEAN gfPauseDueToPlayerGamePause;
|
||||
extern int iScreenMode;
|
||||
extern BOOL bScreenModeCmdLine;
|
||||
#endif
|
||||
|
||||
extern BOOLEAN CheckIfGameCdromIsInCDromDrive();
|
||||
extern void QueueEvent(UINT16 ubInputEvent, UINT32 usParam, UINT32 uiParam);
|
||||
@@ -155,17 +146,6 @@ int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pC
|
||||
Console g_Console("", "", "Lua Console", "no");
|
||||
#endif
|
||||
|
||||
#if !defined(JA2) && !defined(UTILS)
|
||||
void ProcessCommandLine(CHAR8 *pCommandLine);
|
||||
BOOLEAN RunSetup(void);
|
||||
|
||||
// Should the game immediately load the quick save at startup?
|
||||
BOOLEAN gfLoadAtStartup=FALSE;
|
||||
BOOLEAN gfUsingBoundsChecker=FALSE;
|
||||
CHAR8 *gzStringDataOverride=NULL;
|
||||
BOOLEAN gfCapturingVideo = FALSE;
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef USE_VFS
|
||||
static void PopulateSectionFromCommandLine(vfs::PropertyContainer &oProps, vfs::String const& sSection);
|
||||
@@ -174,9 +154,7 @@ static void PopulateSectionFromCommandLine(vfs::PropertyContainer &oProps, vfs::
|
||||
HINSTANCE ghInstance;
|
||||
|
||||
|
||||
#ifdef JA2
|
||||
void ProcessJa2CommandLineBeforeInitialization(CHAR8 *pCommandLine);
|
||||
#endif
|
||||
|
||||
// Global Variable Declarations
|
||||
RECT rcWindow;
|
||||
@@ -259,7 +237,6 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP
|
||||
// break;
|
||||
// }
|
||||
*/
|
||||
#ifdef JA2
|
||||
case WM_MOVE:
|
||||
// if( 1==iScreenMode )
|
||||
{
|
||||
@@ -298,160 +275,6 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP
|
||||
mmi->ptMinTrackSize = mmi->ptMaxSize;
|
||||
break;
|
||||
}
|
||||
#else
|
||||
case WM_MOUSEMOVE:
|
||||
break;
|
||||
|
||||
case WM_SIZING:
|
||||
{
|
||||
LPRECT lpWindow;
|
||||
INT32 iWidth, iHeight, iX, iY;
|
||||
BOOLEAN fWidthByHeight=FALSE, fHoldRight=FALSE;
|
||||
|
||||
lpWindow = (LPRECT) lParam;
|
||||
|
||||
iWidth = lpWindow->right-lpWindow->left;
|
||||
iHeight = lpWindow->bottom-lpWindow->top;
|
||||
iX = (lpWindow->left + lpWindow->right)/2;
|
||||
iY = (lpWindow->top + lpWindow->bottom)/2;
|
||||
|
||||
switch(wParam)
|
||||
{
|
||||
case WMSZ_BOTTOMLEFT:
|
||||
fHoldRight=TRUE;
|
||||
case WMSZ_BOTTOM:
|
||||
case WMSZ_BOTTOMRIGHT:
|
||||
if(iHeight < SCREEN_HEIGHT)
|
||||
{
|
||||
lpWindow->bottom=lpWindow->top+SCREEN_HEIGHT;
|
||||
iHeight=SCREEN_HEIGHT;
|
||||
}
|
||||
fWidthByHeight=TRUE;
|
||||
break;
|
||||
|
||||
case WMSZ_TOPLEFT:
|
||||
fHoldRight=TRUE;
|
||||
case WMSZ_TOP:
|
||||
case WMSZ_TOPRIGHT:
|
||||
if(iHeight < SCREEN_HEIGHT)
|
||||
{
|
||||
lpWindow->top=lpWindow->bottom-SCREEN_HEIGHT;
|
||||
iHeight=SCREEN_HEIGHT;
|
||||
}
|
||||
fWidthByHeight=TRUE;
|
||||
break;
|
||||
|
||||
case WMSZ_LEFT:
|
||||
if(iWidth < SCREEN_WIDTH)
|
||||
{
|
||||
lpWindow->left=lpWindow->right-SCREEN_WIDTH;
|
||||
iWidth = SCREEN_WIDTH;
|
||||
}
|
||||
break;
|
||||
|
||||
case WMSZ_RIGHT:
|
||||
if(iWidth < SCREEN_WIDTH)
|
||||
{
|
||||
lpWindow->right=lpWindow->left+SCREEN_WIDTH;
|
||||
iWidth = SCREEN_WIDTH;
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate width as a factor of height
|
||||
if(fWidthByHeight)
|
||||
{
|
||||
iWidth = iHeight * SCREEN_WIDTH / SCREEN_HEIGHT;
|
||||
// lpWindow->left = iX - iWidth/2;
|
||||
// lpWindow->right = iX + iWidth / 2;
|
||||
if(fHoldRight)
|
||||
lpWindow->left = lpWindow->right - iWidth;
|
||||
else
|
||||
lpWindow->right = lpWindow->left + iWidth;
|
||||
}
|
||||
else // Calculate height as a factor of width
|
||||
{
|
||||
iHeight = iWidth * SCREEN_HEIGHT / SCREEN_WIDTH;
|
||||
// lpWindow->top = iY - iHeight/2;
|
||||
// lpWindow->bottom = iY + iHeight/2;
|
||||
lpWindow->bottom = lpWindow->top + iHeight;
|
||||
}
|
||||
|
||||
/*
|
||||
switch(wParam)
|
||||
{
|
||||
case WMSZ_BOTTOM:
|
||||
case WMSZ_BOTTOMLEFT:
|
||||
case WMSZ_BOTTOMRIGHT:
|
||||
if(iHeight < SCREEN_HEIGHT)
|
||||
{
|
||||
lpWindow->bottom=lpWindow->top+SCREEN_HEIGHT;
|
||||
}
|
||||
}
|
||||
|
||||
switch(wParam)
|
||||
{
|
||||
case WMSZ_TOP:
|
||||
case WMSZ_TOPLEFT:
|
||||
case WMSZ_TOPRIGHT:
|
||||
if(iHeight < SCREEN_HEIGHT)
|
||||
{
|
||||
lpWindow->top=lpWindow->bottom-SCREEN_HEIGHT;
|
||||
}
|
||||
}
|
||||
|
||||
switch(wParam)
|
||||
{
|
||||
case WMSZ_BOTTOMLEFT:
|
||||
case WMSZ_LEFT:
|
||||
case WMSZ_TOPLEFT:
|
||||
if(iWidth < SCREEN_WIDTH)
|
||||
{
|
||||
lpWindow->left=lpWindow->right-SCREEN_WIDTH;
|
||||
}
|
||||
}
|
||||
|
||||
switch(wParam)
|
||||
{
|
||||
case WMSZ_BOTTOMRIGHT:
|
||||
case WMSZ_RIGHT:
|
||||
case WMSZ_TOPRIGHT:
|
||||
if(iWidth < SCREEN_WIDTH)
|
||||
{
|
||||
lpWindow->right=lpWindow->left+SCREEN_WIDTH;
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_SIZE:
|
||||
{
|
||||
UINT16 nWidth = LOWORD(lParam); // width of client area
|
||||
UINT16 nHeight = HIWORD(lParam); // height of client area
|
||||
|
||||
if(nWidth && nHeight)
|
||||
{
|
||||
switch(wParam)
|
||||
{
|
||||
case SIZE_MAXIMIZED:
|
||||
VideoFullScreen(TRUE);
|
||||
break;
|
||||
|
||||
case SIZE_RESTORED:
|
||||
VideoResizeWindow();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_MOVE:
|
||||
{
|
||||
INT32 xPos = (INT32)LOWORD(lParam); // horizontal position
|
||||
INT32 yPos = (INT32)HIWORD(lParam); // vertical position
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case WM_SETCURSOR:
|
||||
SetCursor( NULL);
|
||||
return TRUE;
|
||||
@@ -472,7 +295,6 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP
|
||||
case TRUE: // We are restarting DirectDraw
|
||||
if (fRestore == TRUE)
|
||||
{
|
||||
#ifdef JA2
|
||||
RestoreVideoManager();
|
||||
RestoreVideoSurfaces(); // Restore any video surfaces
|
||||
|
||||
@@ -481,39 +303,18 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP
|
||||
{
|
||||
PauseTime( FALSE );
|
||||
}
|
||||
#else
|
||||
if(!VideoInspectorIsEnabled())
|
||||
{
|
||||
RestoreVideoManager();
|
||||
RestoreVideoSurfaces(); // Restore any video surfaces
|
||||
}
|
||||
|
||||
MoveTimer(TIMER_RESUME);
|
||||
#endif
|
||||
gfApplicationActive = TRUE;
|
||||
}
|
||||
break;
|
||||
case FALSE: // We are suspending direct draw
|
||||
if (iScreenMode == 0)
|
||||
{
|
||||
#ifdef JA2
|
||||
// pause the JA2 Global clock
|
||||
//PauseTime( TRUE );
|
||||
SuspendVideoManager();
|
||||
#else
|
||||
#ifndef UTIL
|
||||
if(!VideoInspectorIsEnabled())
|
||||
{
|
||||
SuspendVideoManager();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
// suspend movement timer, to prevent timer crash if delay becomes long
|
||||
// * it doesn't matter whether the 3-D engine is actually running or not, or if it's even been initialized
|
||||
// * restore is automatic, no need to do anything on reactivation
|
||||
#if !defined( JA2 ) && !defined( UTIL )
|
||||
MoveTimer(TIMER_SUSPEND);
|
||||
#endif
|
||||
// gfApplicationActive = FALSE;
|
||||
fRestore = TRUE;
|
||||
}
|
||||
@@ -535,36 +336,18 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP
|
||||
case WM_SETFOCUS:
|
||||
//if (iScreenMode == 0)
|
||||
{
|
||||
#if !defined( JA2 ) && !defined( UTIL )
|
||||
if(!VideoInspectorIsEnabled())
|
||||
{
|
||||
RestoreVideoManager();
|
||||
}
|
||||
gfApplicationActive=TRUE;
|
||||
// RestrictMouseToXYXY(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
#else
|
||||
RestoreCursorClipRect( );
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_KILLFOCUS:
|
||||
if (iScreenMode == 0)
|
||||
{
|
||||
#if !defined( JA2 ) && !defined( UTIL )
|
||||
if(!VideoInspectorIsEnabled())
|
||||
{
|
||||
SuspendVideoManager();
|
||||
}
|
||||
gfApplicationActive=FALSE;
|
||||
FreeMouseCursor( FALSE );
|
||||
#endif
|
||||
// Set a flag to restore surfaces once a WM_ACTIVEATEAPP is received
|
||||
fRestore = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
#if defined( JA2 )
|
||||
case WM_DEVICECHANGE:
|
||||
{
|
||||
//DEV_BROADCAST_HDR *pHeader = (DEV_BROADCAST_HDR *)lParam;
|
||||
@@ -583,7 +366,6 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP
|
||||
//}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
case WM_SYSKEYUP:
|
||||
case WM_KEYUP:
|
||||
@@ -658,9 +440,6 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow)
|
||||
InitializeRegistryKeys( "Wizardry8", "Wizardry8key" );
|
||||
|
||||
// For rendering DLLs etc.
|
||||
#ifndef JA2
|
||||
AddSubdirectoryToPath("DLL");
|
||||
#endif
|
||||
|
||||
// Second, read in settings
|
||||
GetRuntimeSettings( );
|
||||
@@ -823,9 +602,7 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow)
|
||||
Loc::ImportStrings();
|
||||
}
|
||||
|
||||
//#ifdef JA2
|
||||
InitJA2SplashScreen();
|
||||
//#endif
|
||||
|
||||
// Make sure we start up our local clock (in milliseconds)
|
||||
// We don't need to check for a return value here since so far its always TRUE
|
||||
@@ -851,14 +628,12 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow)
|
||||
|
||||
FastDebugMsg("Initializing Sound Manager");
|
||||
// Initialize the Sound Manager (DirectSound)
|
||||
#ifndef UTIL
|
||||
if (InitializeSoundManager() == FALSE)
|
||||
{
|
||||
// We were unable to initialize the sound manager
|
||||
FastDebugMsg("FAILED : Initializing Sound Manager");
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
FastDebugMsg("Initializing Game Manager");
|
||||
// Initialize the Game
|
||||
@@ -899,22 +674,6 @@ void CreateStandardGamingPlatform(HWND hWindow)
|
||||
|
||||
void ShutdownStandardGamingPlatform(void)
|
||||
{
|
||||
#ifndef JA2
|
||||
static BOOLEAN Reenter = FALSE;
|
||||
|
||||
//
|
||||
// Prevent multiple reentry into this function
|
||||
//
|
||||
|
||||
if (Reenter == FALSE)
|
||||
{
|
||||
Reenter = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
//
|
||||
// Shut down the different components of the SGP
|
||||
@@ -933,9 +692,7 @@ void ShutdownStandardGamingPlatform(void)
|
||||
ShutdownButtonSystem();
|
||||
MSYS_Shutdown();
|
||||
|
||||
#ifndef UTIL
|
||||
ShutdownSoundManager();
|
||||
#endif
|
||||
|
||||
DestroyEnglishTransTable( ); // has to go before ShutdownFontManager()
|
||||
ShutdownFontManager();
|
||||
@@ -1155,29 +912,17 @@ int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pC
|
||||
ghInstance = hInstance;
|
||||
|
||||
// Copy commandline!
|
||||
#ifdef JA2
|
||||
strncpy( gzCommandLine, pCommandLine, 100);
|
||||
gzCommandLine[99]='\0';
|
||||
|
||||
//Process the command line BEFORE initialization
|
||||
ProcessJa2CommandLineBeforeInitialization( pCommandLine );
|
||||
#else
|
||||
ProcessCommandLine(pCommandLine);
|
||||
#endif
|
||||
|
||||
#ifdef JA2
|
||||
// Handle Check for CD
|
||||
if ( !HandleJA2CDCheck( ) )
|
||||
{
|
||||
return( 0 );
|
||||
}
|
||||
#else
|
||||
|
||||
if(!RunSetup())
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
// ShowCursor(FALSE);
|
||||
|
||||
@@ -1212,7 +957,6 @@ int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pC
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef JA2
|
||||
# ifdef ENGLISH
|
||||
try
|
||||
{
|
||||
@@ -1220,7 +964,6 @@ int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pC
|
||||
}
|
||||
HANDLE_FATAL_ERROR;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
gfApplicationActive = TRUE;
|
||||
gfProgramIsRunning = TRUE;
|
||||
@@ -1326,19 +1069,6 @@ void SGPExit(void)
|
||||
gfProgramIsRunning = FALSE;
|
||||
|
||||
// Wizardry only
|
||||
#if !defined( JA2 ) && !defined( UTIL )
|
||||
if (gfGameInitialized)
|
||||
{
|
||||
// ARM: if in DEBUG mode & we've ShutdownWithErrorBox, don't unload screens and release data structs to permit easier debugging
|
||||
#ifdef _DEBUG
|
||||
if (gfIgnoreMessages)
|
||||
{
|
||||
fUnloadScreens = FALSE;
|
||||
}
|
||||
#endif
|
||||
GameloopExit(fUnloadScreens);
|
||||
}
|
||||
#endif
|
||||
|
||||
ShutdownStandardGamingPlatform();
|
||||
// ShowCursor(TRUE);
|
||||
@@ -1347,9 +1077,6 @@ void SGPExit(void)
|
||||
MessageBox(NULL, gzErrorMsg, "Error", MB_OK | MB_ICONERROR );
|
||||
}
|
||||
|
||||
#ifndef JA2
|
||||
VideoDumpMemoryLeaks();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@@ -1722,81 +1449,6 @@ void ShutdownWithErrorBox(CHAR8 *pcMessage)
|
||||
exit(0);
|
||||
}
|
||||
|
||||
#if !defined(JA2) && !defined(UTILS)
|
||||
|
||||
void ProcessCommandLine(CHAR8 *pCommandLine)
|
||||
{
|
||||
CHAR8 cSeparators[] = "\t =";
|
||||
CHAR8 *pCopy=NULL, *pToken;
|
||||
|
||||
pCopy = (CHAR8 *)MemAlloc(strlen(pCommandLine) + 1);
|
||||
|
||||
Assert(pCopy);
|
||||
if(!pCopy)
|
||||
{
|
||||
return;
|
||||
}
|
||||
memcpy(pCopy, pCommandLine, strlen(pCommandLine)+1);
|
||||
|
||||
pToken=strtok(pCopy, cSeparators);
|
||||
while(pToken)
|
||||
{
|
||||
if(!_strnicmp(pToken, "/NOSOUND", 8))
|
||||
{
|
||||
SoundEnableSound(FALSE);
|
||||
}
|
||||
else if(!_strnicmp(pToken, "/INSPECTOR", 10))
|
||||
{
|
||||
VideoInspectorEnable();
|
||||
}
|
||||
else if(!_strnicmp(pToken, "/VIDEOCFG", 9))
|
||||
{
|
||||
pToken=strtok(NULL, cSeparators);
|
||||
VideoSetConfigFile(pToken);
|
||||
}
|
||||
else if(!_strnicmp(pToken, "/LOAD", 5))
|
||||
{
|
||||
gfLoadAtStartup=TRUE;
|
||||
}
|
||||
else if(!_strnicmp(pToken, "/WINDOW", 7))
|
||||
{
|
||||
VideoFullScreen(FALSE);
|
||||
}
|
||||
else if(!_strnicmp(pToken, "/BC", 7))
|
||||
{
|
||||
gfUsingBoundsChecker = TRUE;
|
||||
}
|
||||
else if(!_strnicmp(pToken, "/CAPTURE", 7))
|
||||
{
|
||||
gfCapturingVideo = TRUE;
|
||||
}
|
||||
else if(!_strnicmp(pToken, "/NOOCT", 6))
|
||||
{
|
||||
NoOct();
|
||||
}
|
||||
else if(!_strnicmp(pToken, "/STRINGDATA", 11))
|
||||
{
|
||||
pToken=strtok(NULL, cSeparators);
|
||||
gzStringDataOverride = (CHAR8 *)MemAlloc(strlen(pToken) + 1);
|
||||
strcpy(gzStringDataOverride, pToken);
|
||||
}
|
||||
|
||||
pToken=strtok(NULL, cSeparators);
|
||||
}
|
||||
|
||||
MemFree(pCopy);
|
||||
}
|
||||
|
||||
BOOLEAN RunSetup(void)
|
||||
{
|
||||
if(!FileExists(VideoGetConfigFile()))
|
||||
{
|
||||
_spawnl(_P_WAIT, "3DSetup.EXE", "3DSetup.EXE", VideoGetConfigFile(), NULL);
|
||||
}
|
||||
return(FileExists(VideoGetConfigFile()));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user