mirror of
https://github.com/1dot13/source.git
synced 2026-09-02 14:36:06 +02:00
Move main executable source to its own directory (#248)
* Move main executable files to their own directory * Adapt the build to the new file structure ... and fix some weird #include's that were relying on the project root being an include directory.
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
set(Ja2Src
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/aniviewscreen.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Credits.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Fade Screen.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/FeaturesScreen.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/GameInitOptionsScreen.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/gameloop.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/gamescreen.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/GameSettings.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/GameVersion.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/HelpScreen.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Init.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Intro.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/JA2 Splash.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Ja25Update.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/jascreens.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Language Defines.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Loading Screen.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/MainMenuScreen.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/MessageBoxScreen.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/MPChatScreen.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/MPConnectScreen.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/MPHostScreen.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/MPJoinScreen.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/MPScoreScreen.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/MPXmlTeams.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Options Screen.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/profiler.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/SaveLoadGame.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/SaveLoadScreen.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/SCREENS.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Sys Globals.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/ub_config.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/XML_DifficultySettings.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/XML_IntroFiles.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/XML_Layout_MainMenu.cpp"
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Res/ja2.rc
|
||||
PARENT_SCOPE)
|
||||
|
||||
set(Ja2_Libraries
|
||||
"${CMAKE_SOURCE_DIR}/libexpatMT.lib"
|
||||
"Dbghelp.lib"
|
||||
Lua
|
||||
"${CMAKE_SOURCE_DIR}/lua51.lib"
|
||||
"${CMAKE_SOURCE_DIR}/lua51.vc9.lib"
|
||||
"Winmm.lib"
|
||||
"${CMAKE_SOURCE_DIR}/SMACKW32.LIB"
|
||||
"${CMAKE_SOURCE_DIR}/binkw32.lib"
|
||||
bfVFS
|
||||
"ws2_32.lib"
|
||||
Multiplayer
|
||||
PARENT_SCOPE)
|
||||
@@ -0,0 +1,25 @@
|
||||
#ifndef _CHEATS__H_
|
||||
#define _CHEATS__H_
|
||||
|
||||
#include "Language Defines.h"
|
||||
|
||||
extern UINT8 gubCheatLevel;
|
||||
|
||||
// GLOBALS FOR CHEAT MODE......
|
||||
#ifdef JA2TESTVERSION
|
||||
#define STARTING_CHEAT_LEVEL 6
|
||||
#elif defined JA2BETAVERSION
|
||||
#define STARTING_CHEAT_LEVEL 3
|
||||
#else
|
||||
#define STARTING_CHEAT_LEVEL 0
|
||||
#endif
|
||||
|
||||
// ATE: remove cheats unless we're doing a debug build
|
||||
#define INFORMATION_CHEAT_LEVEL( ) ( gubCheatLevel >= 3 )
|
||||
#define CHEATER_CHEAT_LEVEL( ) ( gubCheatLevel >= 5 )
|
||||
#define DEBUG_CHEAT_LEVEL( ) ( gubCheatLevel >= 6 )
|
||||
|
||||
#define RESET_CHEAT_LEVEL( ) ( gubCheatLevel = 0 )
|
||||
#define ACTIVATE_CHEAT_LEVEL() ( gubCheatLevel = 6 )
|
||||
|
||||
#endif
|
||||
+1468
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,10 @@
|
||||
#ifndef _CREDITS__H_
|
||||
#define _CREDITS__H_
|
||||
|
||||
|
||||
UINT32 CreditScreenInit( void );
|
||||
UINT32 CreditScreenHandle( void );
|
||||
UINT32 CreditScreenShutdown( void );
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,696 @@
|
||||
#include "sgp.h"
|
||||
#include "screenids.h"
|
||||
#include "Timer Control.h"
|
||||
#include "sys globals.h"
|
||||
#include "fade screen.h"
|
||||
#include "sysutil.h"
|
||||
#include "vobject_blitters.h"
|
||||
#include "cursor control.h"
|
||||
#include "music control.h"
|
||||
#include "Render Dirty.h"
|
||||
#include "gameloop.h"
|
||||
|
||||
#define SQUARE_STEP 8
|
||||
|
||||
extern UINT32 guiExitScreen; // symbol already declared globally in laptop.cpp (jonathanl)
|
||||
BOOLEAN gfFadeInitialized = FALSE;
|
||||
INT8 gbFadeValue;
|
||||
INT16 gsFadeLimit;
|
||||
UINT32 guiTime;
|
||||
UINT32 guiFadeDelay;
|
||||
BOOLEAN gfFirstTimeInFade = FALSE;
|
||||
INT16 gsFadeCount;
|
||||
INT8 gbFadeType;
|
||||
// BOOLEAN gfFadeIn; // duplicate def (jonathanl)
|
||||
INT32 giX1, giX2, giY1, giY2;
|
||||
INT16 gsFadeRealCount;
|
||||
BOOLEAN gfFadeInVideo;
|
||||
|
||||
// unused
|
||||
//UINT32 uiOldMusicMode;
|
||||
|
||||
FADE_FUNCTION gFadeFunction = NULL;
|
||||
|
||||
FADE_HOOK gFadeInDoneCallback = NULL;
|
||||
FADE_HOOK gFadeOutDoneCallback = NULL;
|
||||
|
||||
|
||||
void FadeFrameBufferSquare( );
|
||||
void FadeFrameBufferVersionOne( );
|
||||
void FadeFrameBufferVersionFaster( INT8 bFadeValue );
|
||||
void FadeFrameBufferSide( );
|
||||
void FadeFrameBufferRealFade( );
|
||||
|
||||
void FadeInBackBufferVersionOne( );
|
||||
void FadeInBackBufferSquare( );
|
||||
void FadeInFrameBufferRealFade( );
|
||||
|
||||
|
||||
extern BOOLEAN ShadowVideoSurfaceRectUsingLowPercentTable( UINT32 uiDestVSurface, INT32 X1, INT32 Y1, INT32 X2, INT32 Y2);
|
||||
BOOLEAN UpdateSaveBufferWithBackbuffer( void );
|
||||
|
||||
|
||||
BOOLEAN gfFadeIn = FALSE;
|
||||
BOOLEAN gfFadeOut = FALSE;
|
||||
BOOLEAN gfFadeOutDone = FALSE;
|
||||
BOOLEAN gfFadeInDone = FALSE;
|
||||
|
||||
|
||||
void FadeInNextFrame( )
|
||||
{
|
||||
gfFadeIn = TRUE;
|
||||
gfFadeInDone = FALSE;
|
||||
}
|
||||
|
||||
void FadeOutNextFrame( )
|
||||
{
|
||||
gfFadeOut = TRUE;
|
||||
gfFadeOutDone = FALSE;
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN HandleBeginFadeIn( UINT32 uiScreenExit )
|
||||
{
|
||||
if ( gfFadeIn )
|
||||
{
|
||||
BeginFade( uiScreenExit, 35, FADE_IN_REALFADE, 5 );
|
||||
|
||||
gfFadeIn = FALSE;
|
||||
|
||||
gfFadeInDone = TRUE;
|
||||
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
BOOLEAN HandleBeginFadeOut( UINT32 uiScreenExit )
|
||||
{
|
||||
if ( gfFadeOut )
|
||||
{
|
||||
BeginFade( uiScreenExit, 35, FADE_OUT_REALFADE, 5 );
|
||||
|
||||
gfFadeOut = FALSE;
|
||||
|
||||
gfFadeOutDone = TRUE;
|
||||
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN HandleFadeOutCallback( )
|
||||
{
|
||||
if ( gfFadeOutDone )
|
||||
{
|
||||
gfFadeOutDone = FALSE;
|
||||
|
||||
if ( gFadeOutDoneCallback != NULL )
|
||||
{
|
||||
gFadeOutDoneCallback( );
|
||||
|
||||
gFadeOutDoneCallback = NULL;
|
||||
|
||||
return( TRUE );
|
||||
}
|
||||
}
|
||||
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN HandleFadeInCallback( )
|
||||
{
|
||||
if ( gfFadeInDone )
|
||||
{
|
||||
gfFadeInDone = FALSE;
|
||||
|
||||
if ( gFadeInDoneCallback != NULL )
|
||||
{
|
||||
gFadeInDoneCallback( );
|
||||
}
|
||||
|
||||
gFadeInDoneCallback = NULL;
|
||||
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
|
||||
void BeginFade( UINT32 uiExitScreen, INT8 bFadeValue, INT8 bType, UINT32 uiDelay )
|
||||
{
|
||||
//Init some paramters
|
||||
guiExitScreen = uiExitScreen;
|
||||
gbFadeValue = bFadeValue;
|
||||
guiFadeDelay = uiDelay;
|
||||
gfFadeIn = FALSE;
|
||||
gfFadeInVideo = TRUE;
|
||||
|
||||
// unused
|
||||
//uiOldMusicMode = uiMusicHandle;
|
||||
|
||||
|
||||
// Calculate step;
|
||||
switch ( bType )
|
||||
{
|
||||
case FADE_IN_REALFADE:
|
||||
|
||||
gsFadeRealCount = -1;
|
||||
gsFadeLimit = 8;
|
||||
gFadeFunction = (FADE_FUNCTION)FadeInFrameBufferRealFade;
|
||||
gfFadeInVideo = FALSE;
|
||||
|
||||
// Copy backbuffer to savebuffer
|
||||
UpdateSaveBufferWithBackbuffer( );
|
||||
|
||||
// Clear framebuffer
|
||||
ColorFillVideoSurfaceArea( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );
|
||||
break;
|
||||
|
||||
case FADE_OUT_REALFADE:
|
||||
|
||||
gsFadeRealCount = -1;
|
||||
gsFadeLimit = 10;
|
||||
gFadeFunction = (FADE_FUNCTION)FadeFrameBufferRealFade;
|
||||
gfFadeInVideo = FALSE;
|
||||
|
||||
// Clear framebuffer
|
||||
//ColorFillVideoSurfaceArea( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );
|
||||
break;
|
||||
|
||||
case FADE_OUT_VERSION_ONE:
|
||||
//gsFadeLimit = 255 / bFadeValue;
|
||||
//gFadeFunction = (FADE_FUNCTION)FadeFrameBufferVersionOne;
|
||||
//SetMusicFadeSpeed( 25 );
|
||||
//SetMusicMode( MUSIC_NONE );
|
||||
break;
|
||||
|
||||
case FADE_OUT_SQUARE:
|
||||
gsFadeLimit = (SCREEN_WIDTH / ( SQUARE_STEP * 2 ) );
|
||||
giX1 = 0;
|
||||
giX2 = SCREEN_WIDTH;
|
||||
giY1 = 0;
|
||||
giY2 = SCREEN_HEIGHT;
|
||||
gFadeFunction = (FADE_FUNCTION)FadeFrameBufferSquare;
|
||||
|
||||
// Zero frame buffer
|
||||
ColorFillVideoSurfaceArea( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );
|
||||
//ColorFillVideoSurfaceArea( guiSAVEBUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );
|
||||
|
||||
// SetMusicFadeSpeed( 25 );
|
||||
//SetMusicMode( MUSIC_NONE );
|
||||
break;
|
||||
|
||||
case FADE_IN_VERSION_ONE:
|
||||
gsFadeLimit = 255 / bFadeValue;
|
||||
gFadeFunction = (FADE_FUNCTION)FadeInBackBufferVersionOne;
|
||||
break;
|
||||
|
||||
case FADE_IN_SQUARE:
|
||||
gFadeFunction = (FADE_FUNCTION)FadeInBackBufferSquare;
|
||||
giX1 = SCREEN_WIDTH/2;
|
||||
giX2 = SCREEN_WIDTH/2;
|
||||
giY1 = SCREEN_HEIGHT/2;
|
||||
giY2 = SCREEN_HEIGHT/2;
|
||||
gsFadeLimit = (SCREEN_WIDTH / ( SQUARE_STEP * 2 ) );
|
||||
gfFadeIn = TRUE;
|
||||
break;
|
||||
|
||||
case FADE_OUT_VERSION_FASTER:
|
||||
gsFadeLimit = (255 / bFadeValue) * 2;
|
||||
gFadeFunction = (FADE_FUNCTION)FadeFrameBufferVersionFaster;
|
||||
|
||||
//SetMusicFadeSpeed( 25 );
|
||||
//SetMusicMode( MUSIC_NONE );
|
||||
break;
|
||||
|
||||
case FADE_OUT_VERSION_SIDE:
|
||||
// Copy frame buffer to save buffer
|
||||
gsFadeLimit = (SCREEN_WIDTH / 8 );
|
||||
gFadeFunction = (FADE_FUNCTION)FadeFrameBufferSide;
|
||||
|
||||
//SetMusicFadeSpeed( 25 );
|
||||
//SetMusicMode( MUSIC_NONE );
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
gfFadeInitialized = TRUE;
|
||||
gfFirstTimeInFade = TRUE;
|
||||
gsFadeCount = 0;
|
||||
gbFadeType = bType;
|
||||
|
||||
SetPendingNewScreen(FADE_SCREEN);
|
||||
|
||||
}
|
||||
|
||||
|
||||
UINT32 FadeScreenInit( )
|
||||
{
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
|
||||
UINT32 FadeScreenHandle( )
|
||||
{
|
||||
UINT32 uiTime;
|
||||
|
||||
if ( !gfFadeInitialized )
|
||||
{
|
||||
SET_ERROR( "Fade Screen called but not intialized " );
|
||||
return( ERROR_SCREEN );
|
||||
}
|
||||
|
||||
// ATE: Remove cursor
|
||||
SetCurrentCursorFromDatabase( VIDEO_NO_CURSOR );
|
||||
|
||||
|
||||
if ( gfFirstTimeInFade )
|
||||
{
|
||||
gfFirstTimeInFade = FALSE;
|
||||
|
||||
// Calcuate delay
|
||||
guiTime = GetJA2Clock( );
|
||||
}
|
||||
|
||||
// Get time
|
||||
uiTime = GetJA2Clock( );
|
||||
|
||||
MusicPoll( TRUE );
|
||||
|
||||
if ( ( uiTime - guiTime ) > guiFadeDelay )
|
||||
{
|
||||
// Fade!
|
||||
if ( !gfFadeIn )
|
||||
{
|
||||
//gFadeFunction( );
|
||||
}
|
||||
|
||||
InvalidateScreen();
|
||||
|
||||
if ( !gfFadeInVideo )
|
||||
{
|
||||
gFadeFunction( );
|
||||
}
|
||||
|
||||
gsFadeCount++;
|
||||
|
||||
if ( gsFadeCount > gsFadeLimit )
|
||||
{
|
||||
switch( gbFadeType )
|
||||
{
|
||||
case FADE_OUT_REALFADE:
|
||||
|
||||
// Clear framebuffer
|
||||
ColorFillVideoSurfaceArea( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );
|
||||
break;
|
||||
}
|
||||
|
||||
//End!
|
||||
gfFadeInitialized = FALSE;
|
||||
gfFadeIn = FALSE;
|
||||
|
||||
return( guiExitScreen );
|
||||
}
|
||||
}
|
||||
|
||||
return( FADE_SCREEN );
|
||||
}
|
||||
|
||||
UINT32 FadeScreenShutdown( )
|
||||
{
|
||||
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
|
||||
void FadeFrameBufferVersionOne( )
|
||||
{
|
||||
INT32 cX, cY;
|
||||
UINT32 uiDestPitchBYTES;
|
||||
UINT16 *pBuf;
|
||||
INT16 bR, bG, bB;
|
||||
UINT32 uiRGBColor;
|
||||
UINT16 s16BPPSrc;
|
||||
|
||||
|
||||
pBuf = (UINT16*)LockVideoSurface(FRAME_BUFFER, &uiDestPitchBYTES);
|
||||
|
||||
// LOCK FRAME BUFFER
|
||||
for ( cX = 0; cX < SCREEN_WIDTH; cX++ )
|
||||
{
|
||||
for ( cY = 0; cY < SCREEN_HEIGHT; cY++ )
|
||||
{
|
||||
s16BPPSrc = pBuf[ ( cY * 640 ) + cX ];
|
||||
|
||||
uiRGBColor = GetRGBColor( s16BPPSrc );
|
||||
|
||||
bR = SGPGetRValue( uiRGBColor );
|
||||
bG = SGPGetGValue( uiRGBColor );
|
||||
bB = SGPGetBValue( uiRGBColor );
|
||||
|
||||
// Fade down
|
||||
bR -= gbFadeValue;
|
||||
if ( bR < 0 )
|
||||
bR = 0;
|
||||
|
||||
bG -= gbFadeValue;
|
||||
if ( bG < 0 )
|
||||
bG = 0;
|
||||
|
||||
bB -= gbFadeValue;
|
||||
if ( bB < 0 )
|
||||
bB = 0;
|
||||
|
||||
// Set back info buffer
|
||||
pBuf[ ( cY * SCREEN_WIDTH ) + cX ] = Get16BPPColor( FROMRGB( bR, bG, bB ) );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
UnLockVideoSurface(FRAME_BUFFER);
|
||||
|
||||
}
|
||||
|
||||
void FadeInBackBufferVersionOne( )
|
||||
{
|
||||
INT32 cX, cY;
|
||||
UINT32 uiDestPitchBYTES, uiSrcPitchBYTES;
|
||||
UINT16 *pSrcBuf, *pDestBuf;
|
||||
INT16 bR, bG, bB;
|
||||
UINT32 uiRGBColor;
|
||||
UINT16 s16BPPSrc;
|
||||
INT16 bFadeVal = ( gsFadeLimit - gsFadeCount ) * gbFadeValue;
|
||||
|
||||
pDestBuf = (UINT16*)LockVideoSurface(BACKBUFFER, &uiDestPitchBYTES);
|
||||
pSrcBuf = (UINT16*)LockVideoSurface(FRAME_BUFFER, &uiSrcPitchBYTES);
|
||||
|
||||
// LOCK FRAME BUFFER
|
||||
for ( cX = 0; cX < SCREEN_WIDTH; cX++ )
|
||||
{
|
||||
for ( cY = 0; cY < SCREEN_HEIGHT; cY++ )
|
||||
{
|
||||
s16BPPSrc = pSrcBuf[ ( cY * SCREEN_WIDTH ) + cX ];
|
||||
|
||||
uiRGBColor = GetRGBColor( s16BPPSrc );
|
||||
|
||||
bR = SGPGetRValue( uiRGBColor );
|
||||
bG = SGPGetGValue( uiRGBColor );
|
||||
bB = SGPGetBValue( uiRGBColor );
|
||||
|
||||
// Fade down
|
||||
bR -= bFadeVal;
|
||||
if ( bR < 0 )
|
||||
bR = 0;
|
||||
|
||||
bG -= bFadeVal;
|
||||
if ( bG < 0 )
|
||||
bG = 0;
|
||||
|
||||
bB -= bFadeVal;
|
||||
if ( bB < 0 )
|
||||
bB = 0;
|
||||
|
||||
// Set back info dest buffer
|
||||
pDestBuf[ ( cY * SCREEN_WIDTH ) + cX ] = Get16BPPColor( FROMRGB( bR, bG, bB ) );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
UnLockVideoSurface(FRAME_BUFFER);
|
||||
UnLockVideoSurface(BACKBUFFER);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void FadeFrameBufferVersionFaster( INT8 bFadeValue )
|
||||
{
|
||||
INT32 cX, cY, iStartX, iStartY;
|
||||
UINT32 uiDestPitchBYTES;
|
||||
UINT16 *pBuf;
|
||||
INT16 bR, bG, bB;
|
||||
UINT32 uiRGBColor;
|
||||
UINT16 s16BPPSrc;
|
||||
|
||||
|
||||
pBuf = (UINT16*)LockVideoSurface(FRAME_BUFFER, &uiDestPitchBYTES);
|
||||
|
||||
iStartX = gsFadeCount % 2;
|
||||
iStartY = 0;
|
||||
|
||||
// LOCK FRAME BUFFER
|
||||
for ( cX = iStartX; cX < SCREEN_WIDTH; cX+= 2 )
|
||||
{
|
||||
if ( iStartX == 1 )
|
||||
{
|
||||
iStartX = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
iStartX = 1;
|
||||
}
|
||||
|
||||
for ( cY = iStartY; cY < SCREEN_HEIGHT; cY++ )
|
||||
{
|
||||
s16BPPSrc = pBuf[ ( cY * SCREEN_WIDTH ) + cX ];
|
||||
|
||||
uiRGBColor = GetRGBColor( s16BPPSrc );
|
||||
|
||||
bR = SGPGetRValue( uiRGBColor );
|
||||
bG = SGPGetGValue( uiRGBColor );
|
||||
bB = SGPGetBValue( uiRGBColor );
|
||||
|
||||
// Fade down
|
||||
bR -= bFadeValue;
|
||||
if ( bR < 0 )
|
||||
bR = 0;
|
||||
|
||||
bG -= bFadeValue;
|
||||
if ( bG < 0 )
|
||||
bG = 0;
|
||||
|
||||
bB -= bFadeValue;
|
||||
if ( bB < 0 )
|
||||
bB = 0;
|
||||
|
||||
// Set back info buffer
|
||||
pBuf[ ( cY * SCREEN_WIDTH ) + cX ] = Get16BPPColor( FROMRGB( bR, bG, bB ) );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
UnLockVideoSurface(FRAME_BUFFER);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void FadeFrameBufferSide( )
|
||||
{
|
||||
INT32 iX1, iX2;
|
||||
INT16 sFadeMove;
|
||||
|
||||
sFadeMove = gsFadeCount * 4;
|
||||
|
||||
iX1 = 0;
|
||||
iX2 = sFadeMove;
|
||||
|
||||
ColorFillVideoSurfaceArea( FRAME_BUFFER, iX1, 0, iX2, SCREEN_HEIGHT, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );
|
||||
|
||||
iX1 = 640 - sFadeMove;
|
||||
iX2 = 640;
|
||||
|
||||
ColorFillVideoSurfaceArea( FRAME_BUFFER, iX1, 0, iX2, SCREEN_HEIGHT, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );
|
||||
|
||||
}
|
||||
|
||||
void FadeFrameBufferSquare( )
|
||||
{
|
||||
INT32 iX1, iX2, iY1, iY2;
|
||||
INT16 sFadeXMove, sFadeYMove;
|
||||
|
||||
sFadeXMove = SQUARE_STEP;
|
||||
sFadeYMove = (INT16)(sFadeXMove * .75);
|
||||
|
||||
|
||||
iX1 = giX1;
|
||||
iX2 = giX1 + sFadeXMove;
|
||||
iY1 = giY1;
|
||||
iY2 = giY1 + sFadeYMove;
|
||||
|
||||
ColorFillVideoSurfaceArea( BACKBUFFER, iX1, 0, iX2, SCREEN_HEIGHT, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );
|
||||
ColorFillVideoSurfaceArea( BACKBUFFER, 0, iY1, SCREEN_WIDTH, iY2, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );
|
||||
|
||||
iX1 = giX2 - sFadeXMove;
|
||||
iX2 = giX2;
|
||||
iY1 = giY2 - sFadeYMove;
|
||||
iY2 = giY2;
|
||||
|
||||
ColorFillVideoSurfaceArea( BACKBUFFER, iX1, 0, iX2, SCREEN_HEIGHT, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );
|
||||
ColorFillVideoSurfaceArea( BACKBUFFER, 0, iY1, SCREEN_WIDTH, iY2, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );
|
||||
|
||||
giX1 += sFadeXMove;
|
||||
giX2 -= sFadeXMove;
|
||||
giY1 += sFadeYMove;
|
||||
giY2 -= sFadeYMove;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void FadeInBackBufferSquare( )
|
||||
{
|
||||
INT32 iX1, iX2, iY1, iY2;
|
||||
INT16 sFadeXMove, sFadeYMove;
|
||||
blt_vs_fx BltFx;
|
||||
|
||||
sFadeXMove = SQUARE_STEP;
|
||||
sFadeYMove = (INT16)(sFadeXMove * .75);
|
||||
|
||||
if ( gsFadeCount == 0 )
|
||||
{
|
||||
ColorFillVideoSurfaceArea( BACKBUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );
|
||||
}
|
||||
|
||||
iX1 = giX1 - sFadeXMove;
|
||||
iX2 = giX1;
|
||||
iY1 = giY1 - sFadeYMove;
|
||||
iY2 = giY2 + sFadeYMove;
|
||||
|
||||
BltFx.SrcRect.iLeft = iX1;
|
||||
BltFx.SrcRect.iTop = iY1;
|
||||
BltFx.SrcRect.iRight = iX2;
|
||||
BltFx.SrcRect.iBottom = iY2;
|
||||
|
||||
if ( BltFx.SrcRect.iRight != BltFx.SrcRect.iLeft )
|
||||
{
|
||||
BltVideoSurface( BACKBUFFER, FRAME_BUFFER, 0,
|
||||
iX1, iY1,
|
||||
VS_BLT_SRCSUBRECT, &BltFx );
|
||||
}
|
||||
|
||||
iX1 = giX2;
|
||||
iX2 = giX2 + sFadeXMove;
|
||||
iY1 = giY1 - sFadeYMove;
|
||||
iY2 = giY2 + sFadeYMove;
|
||||
|
||||
BltFx.SrcRect.iLeft = iX1;
|
||||
BltFx.SrcRect.iTop = iY1;
|
||||
BltFx.SrcRect.iRight = iX2;
|
||||
BltFx.SrcRect.iBottom = iY2;
|
||||
|
||||
if ( BltFx.SrcRect.iRight != BltFx.SrcRect.iLeft )
|
||||
{
|
||||
BltVideoSurface( BACKBUFFER, FRAME_BUFFER, 0,
|
||||
iX1, iY1,
|
||||
VS_BLT_SRCSUBRECT, &BltFx );
|
||||
}
|
||||
|
||||
iX1 = giX1;
|
||||
iX2 = giX2;
|
||||
iY1 = giY1 - sFadeYMove;
|
||||
iY2 = giY1;
|
||||
|
||||
BltFx.SrcRect.iLeft = iX1;
|
||||
BltFx.SrcRect.iTop = iY1;
|
||||
BltFx.SrcRect.iRight = iX2;
|
||||
BltFx.SrcRect.iBottom = iY2;
|
||||
|
||||
if ( BltFx.SrcRect.iBottom != BltFx.SrcRect.iTop )
|
||||
{
|
||||
BltVideoSurface( BACKBUFFER, FRAME_BUFFER, 0,
|
||||
iX1, iY1,
|
||||
VS_BLT_SRCSUBRECT, &BltFx );
|
||||
}
|
||||
|
||||
iX1 = giX1;
|
||||
iX2 = giX2;
|
||||
iY1 = giY2;
|
||||
iY2 = giY2 + sFadeYMove;
|
||||
|
||||
BltFx.SrcRect.iLeft = iX1;
|
||||
BltFx.SrcRect.iTop = iY1;
|
||||
BltFx.SrcRect.iRight = iX2;
|
||||
BltFx.SrcRect.iBottom = iY2;
|
||||
|
||||
if ( BltFx.SrcRect.iBottom != BltFx.SrcRect.iTop )
|
||||
{
|
||||
BltVideoSurface( BACKBUFFER, FRAME_BUFFER, 0,
|
||||
iX1, iY1,
|
||||
VS_BLT_SRCSUBRECT, &BltFx );
|
||||
}
|
||||
|
||||
giX1 -= sFadeXMove;
|
||||
giX2 += sFadeXMove;
|
||||
giY1 -= sFadeYMove;
|
||||
giY2 += sFadeYMove;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void FadeFrameBufferRealFade( )
|
||||
{
|
||||
if ( gsFadeRealCount != gsFadeCount )
|
||||
{
|
||||
ShadowVideoSurfaceRectUsingLowPercentTable( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT );
|
||||
|
||||
gsFadeRealCount = gsFadeCount;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void FadeInFrameBufferRealFade( )
|
||||
{
|
||||
INT32 cnt;
|
||||
|
||||
if ( gsFadeRealCount != gsFadeCount )
|
||||
{
|
||||
|
||||
for ( cnt = 0; cnt < ( gsFadeLimit - gsFadeCount ); cnt++ )
|
||||
{
|
||||
ShadowVideoSurfaceRectUsingLowPercentTable( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT );
|
||||
}
|
||||
|
||||
// Refresh Screen
|
||||
RefreshScreen( NULL );
|
||||
|
||||
// Copy save buffer back
|
||||
RestoreExternBackgroundRect( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT );
|
||||
|
||||
gsFadeRealCount = gsFadeCount;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN UpdateSaveBufferWithBackbuffer(void)
|
||||
{
|
||||
UINT32 uiDestPitchBYTES, uiSrcPitchBYTES;
|
||||
UINT8 *pDestBuf, *pSrcBuf;
|
||||
UINT16 usWidth, usHeight;
|
||||
UINT8 ubBitDepth;
|
||||
|
||||
|
||||
// Update saved buffer - do for the viewport size ony!
|
||||
GetCurrentVideoSettings( &usWidth, &usHeight, &ubBitDepth );
|
||||
|
||||
pSrcBuf = LockVideoSurface(FRAME_BUFFER, &uiSrcPitchBYTES);
|
||||
pDestBuf = LockVideoSurface(guiSAVEBUFFER, &uiDestPitchBYTES);
|
||||
|
||||
if(gbPixelDepth==16)
|
||||
{
|
||||
// BLIT HERE
|
||||
Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES,
|
||||
(UINT16 *)pSrcBuf, uiSrcPitchBYTES,
|
||||
0, 0, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT );
|
||||
}
|
||||
|
||||
UnLockVideoSurface(FRAME_BUFFER);
|
||||
UnLockVideoSurface(guiSAVEBUFFER);
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
#ifndef FADE_SCREEN_H
|
||||
#define FADE_SCREEN_H
|
||||
|
||||
#define FADE_OUT_VERSION_ONE 1
|
||||
#define FADE_OUT_VERSION_FASTER 2
|
||||
#define FADE_OUT_VERSION_SIDE 3
|
||||
#define FADE_OUT_SQUARE 4
|
||||
#define FADE_OUT_REALFADE 5
|
||||
|
||||
#define FADE_IN_VERSION_ONE 10
|
||||
#define FADE_IN_SQUARE 11
|
||||
#define FADE_IN_REALFADE 12
|
||||
|
||||
typedef void (*FADE_HOOK)( void );
|
||||
|
||||
extern FADE_HOOK gFadeInDoneCallback;
|
||||
extern FADE_HOOK gFadeOutDoneCallback;
|
||||
|
||||
|
||||
typedef void (*FADE_FUNCTION)( void );
|
||||
|
||||
|
||||
extern BOOLEAN gfFadeInitialized;
|
||||
extern BOOLEAN gfFadeIn;
|
||||
extern INT8 gbFadeType;
|
||||
extern FADE_FUNCTION gFadeFunction;
|
||||
extern BOOLEAN gfFadeInVideo;
|
||||
|
||||
void BeginFade( UINT32 uiExitScreen, INT8 bFadeValue, INT8 bType, UINT32 uiDelay );
|
||||
|
||||
BOOLEAN HandleBeginFadeIn( UINT32 uiScreenExit );
|
||||
BOOLEAN HandleBeginFadeOut( UINT32 uiScreenExit );
|
||||
|
||||
BOOLEAN HandleFadeOutCallback( );
|
||||
BOOLEAN HandleFadeInCallback( );
|
||||
|
||||
void FadeInNextFrame( );
|
||||
void FadeOutNextFrame( );
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,19 @@
|
||||
#ifndef _FEATURES_SCREEN__H_
|
||||
#define _FEATURES_SCREEN__H_
|
||||
|
||||
#include "MessageBoxScreen.h"
|
||||
#include "Options Screen.h"
|
||||
|
||||
namespace FeaturesScreen {
|
||||
|
||||
UINT32 Shutdown(void);
|
||||
UINT32 Handle(void);
|
||||
UINT32 Init(void);
|
||||
|
||||
BOOLEAN DoMessageBox(UINT8 ubStyle, STR16 zString, UINT32 uiExitScreen, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback);
|
||||
BOOLEAN DoMessageBoxWithRect(UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UINT32 usFlags, MSGBOX_CALLBACK ReturnCallback, SGPRect* pCenteringRect);
|
||||
|
||||
void SetPreviousScreen(UINT32 screenId, BOOLEAN setOptionsToo = TRUE);
|
||||
|
||||
}
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,110 @@
|
||||
#ifndef _GAME_INIT_OPTIONS_SCREEN_H_
|
||||
#define _GAME_INIT_OPTIONS_SCREEN_H_
|
||||
|
||||
|
||||
UINT32 GameInitOptionsScreenInit( void );
|
||||
UINT32 GameInitOptionsScreenHandle( void );
|
||||
UINT32 GameInitOptionsScreenShutdown( void );
|
||||
|
||||
BOOLEAN SpIniExists();
|
||||
|
||||
// Flugente: moved enums
|
||||
//Enums for the difficulty levels
|
||||
enum
|
||||
{
|
||||
DIF_LEVEL_EASY = 1,
|
||||
DIF_LEVEL_MEDIUM,
|
||||
DIF_LEVEL_HARD,
|
||||
DIF_LEVEL_INSANE,
|
||||
MAX_DIF_LEVEL,
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UINT16 uiIndex;
|
||||
CHAR16 szDiffName[128];
|
||||
CHAR16 szConfirmText[1024];
|
||||
CHAR16 szPrefixXmlName[128];
|
||||
|
||||
INT32 iStartingCash;
|
||||
INT8 iEnemyAPBonus;
|
||||
UINT16 iNumKillsPerProgressPoint;
|
||||
INT32 iInitialGarrisonPercentages;
|
||||
UINT8 iMinEnemyGroupSize;
|
||||
UINT8 iCounterAttackGroupSize;
|
||||
BOOLEAN bUnlimitedPoolOfTroops;
|
||||
INT32 iQueensInitialPoolOfTroops;
|
||||
INT32 iQueenPoolMaxSizePerDifficultyLevel;
|
||||
UINT16 iQueenPoolIncrementDaysPerDifficultyLevel;
|
||||
INT32 iQueenPoolBaseIncrementSizePerDifficultyLevel;
|
||||
UINT8 iQueenPoolRecruitPercentPerDifficultyLevel;
|
||||
UINT32 iEnemyStartingAlertLevel;
|
||||
UINT32 iEnemyAlertDecay;
|
||||
UINT32 iNumAwareBattles;
|
||||
UINT32 iBaseDelayInMinutesBetweenEvaluations;
|
||||
UINT32 iEvaluationDelayVariance;
|
||||
UINT32 iGracePeriodInHoursAfterSectorLiberation;
|
||||
UINT32 iGracePeriodInDaysAfterPatrolDestroyed;
|
||||
BOOLEAN bAggressiveQueenAi;
|
||||
INT32 iMaxMercDeaths;
|
||||
UINT8 usLootStatusModifier;
|
||||
|
||||
//Creatures Settings
|
||||
UINT16 iCreatureSpreadTime;
|
||||
UINT8 iQueenReproductionBase;
|
||||
UINT8 iQueenReproductionBonus;
|
||||
UINT8 iQueenInitBonusSpread;
|
||||
INT8 iCreaturePopulationModifier;
|
||||
INT8 iCreatureTownAggressiveness;
|
||||
|
||||
//sectors
|
||||
UINT8 iJ9B1NumTroops;
|
||||
UINT8 iJ9B2NumCreatures;
|
||||
UINT8 iK4B1NumTroops;
|
||||
UINT8 iK4B1NumElites;
|
||||
UINT8 iO3B1NumTroops;
|
||||
UINT8 iO3B1NumElites;
|
||||
UINT8 iP3B1NumElites;
|
||||
|
||||
BOOLEAN bStrategicAiActionWakeQueen;
|
||||
UINT16 iUpdateLastDayOfPlayerActivity;
|
||||
INT32 iChanceOfEnemyAmbushes;
|
||||
BOOLEAN bAllowReinforcements;
|
||||
BOOLEAN bAllowReinforcementsOmerta;
|
||||
INT32 iPercentElitesBonus;
|
||||
BOOLEAN iDesiredPopulationL3;
|
||||
BOOLEAN iDesiredPopulationL2;
|
||||
UINT8 iWeaponCacheTroops1;
|
||||
UINT8 iWeaponCacheTroops2;
|
||||
UINT8 iWeaponCacheTroops3;
|
||||
UINT8 iWeaponCacheTroops4;
|
||||
UINT8 iWeaponCacheTroops5;
|
||||
BOOLEAN bUpgradeAdminsToTroops;
|
||||
BOOLEAN bUpgradeGarrisonsAdminsToTroops;
|
||||
UINT8 usAlwaysUpGradeAdminsToTroopsProgress;
|
||||
UINT8 usLevelModifierLowLimit;
|
||||
UINT8 usLevelModifierHighLimit;
|
||||
BOOLEAN bAllowUnrestrictedXPLevels;
|
||||
BOOLEAN bQueenLosingControlOfSector;
|
||||
BOOLEAN bBloodcatAmbush;
|
||||
BOOLEAN bAirRaidLookForDive;
|
||||
UINT32 iGetNumberOfTurnsPowerGenFanWillBeStoppedFor; //UB
|
||||
BOOLEAN bRadioSightings;
|
||||
BOOLEAN bRadioSightings2;
|
||||
|
||||
FLOAT fCTHSettingsBaseDifficultyEnemy;
|
||||
FLOAT fCTHSettingsAimDifficultyEnemy;
|
||||
FLOAT fCTHSettingsBaseDifficultyMilitia;
|
||||
FLOAT fCTHSettingsAimDifficultyMilitia;
|
||||
FLOAT fCTHSettingsBaseDifficultyPlayer;
|
||||
FLOAT fCTHSettingsAimDifficultyPlayer;
|
||||
|
||||
BOOLEAN bEnemyMoraleWorried;
|
||||
|
||||
UINT8 usMaxMortarsPerTeam;
|
||||
|
||||
} DIFFICULTY_SETTINGS_VALUES;
|
||||
extern UINT8 MaxDifficultySettingsValues;
|
||||
extern DIFFICULTY_SETTINGS_VALUES zDiffSetting[MAX_DIF_LEVEL];
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
+2807
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,45 @@
|
||||
#include "Types.h"
|
||||
#include "GameVersion.h"
|
||||
|
||||
//
|
||||
// Keeps track of the game version
|
||||
//
|
||||
|
||||
#ifdef JA2EDITOR // map editor
|
||||
|
||||
#ifdef JA2UB
|
||||
CHAR16 zProductLabel[64] = { L"JA2 1.13 Unfinished Business - Map Editor" };
|
||||
#else
|
||||
CHAR16 zProductLabel[64] = { L"JA2 1.13 - Map Editor" };
|
||||
#endif
|
||||
|
||||
#elif defined JA2BETAVERSION // debug
|
||||
|
||||
#ifdef JA2UB
|
||||
CHAR16 zProductLabel[64] = { L"Debug: JA2 1.13 Unfinished Business" };
|
||||
#elif defined (JA113DEMO)
|
||||
CHAR16 zProductLabel[64] = { L"Debug: JA2 1.13 Demo" };
|
||||
#else
|
||||
CHAR16 zProductLabel[64] = { L"Debug: JA2 1.13" };
|
||||
#endif
|
||||
|
||||
#elif defined CRIPPLED_VERSION
|
||||
|
||||
CHAR16 zProductLabel[64] = { L"JA2 113 Beta-0.98" };
|
||||
|
||||
#else // release
|
||||
|
||||
#ifdef JA2UB
|
||||
CHAR16 zProductLabel[64] = { L"JA2 1.13 Unfinished Business" };
|
||||
#elif defined (JA113DEMO)
|
||||
CHAR16 zProductLabel[64] = { L"JA2 1.13 Demo" };
|
||||
#else
|
||||
CHAR16 zProductLabel[64] = { L"JA2 1.13" };
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
CHAR8 czVersionString[16] = { "@Version@" };
|
||||
CHAR16 zBuildInformation[256] = { L"@Build@" };
|
||||
|
||||
// SAVE_GAME_VERSION is defined in header, change it there
|
||||
@@ -0,0 +1,116 @@
|
||||
#ifndef _GAME_VERSION_H_
|
||||
#define _GAME_VERSION_H_
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
// Keeps track of the game version
|
||||
//
|
||||
|
||||
// name of the product, Unfinished Business, Map Editor etc..
|
||||
extern CHAR16 zProductLabel[64];
|
||||
// used for save game comparison
|
||||
extern CHAR8 czVersionString[16];
|
||||
// can contain information regarding the build: what git ref was the base (tag, branch), by whom, commit date, build date, etc..
|
||||
extern CHAR16 zBuildInformation[256];
|
||||
|
||||
//ADB: I needed these here so I moved them, and why put them in *.cpp anyways?
|
||||
//
|
||||
// Keeps track of the saved game version. Increment the saved game version whenever
|
||||
// you will invalidate the saved game file
|
||||
|
||||
#define GROWTH_MODIFIERS 184
|
||||
#define REBELCOMMAND 183
|
||||
#define DRAGSTRUCTURE 182 // Flugente: we can drag structures behind us
|
||||
#define DISABILITYFLAGMASK 181 // Flugente: disabilities get a flagmask
|
||||
#define PROFILETYPE_STORED 180 // Flugente: the type of each profile is stored in the savegame
|
||||
#define CORPSE_DISPOSAL 179 // Flugente: corpses can be removed by assignment
|
||||
#define RAID_EVENTS 178 // Flugente: added bloodcat/zombie/bandit raids
|
||||
#define INDIVIDUAL_MILITIA_EXP_FLOAT 177 // Flugente: changed the way we store individual militia experience
|
||||
#define CHAT_TO_DISTRACT 176 // Flugente: internal variable allows us to distract enemies by engrossing them in conversation
|
||||
#define INDIVIDUAL_MILITIA_RANKFIX 175 // Flugente: internal individual militia change requires variable change
|
||||
#define DRAGPERSONS 174 // Flugente: we can drag people and corpses now
|
||||
#define SEPARATE_VOICESETS 173 // Flugente: voice sets are now separate from profile slots, and we can have many more of them
|
||||
#define HACKABLE_SAMS 172 // Flugente: SAM sites now have a status for hacking
|
||||
#define LUA_MODDERDATA 171 // Flugente: modders can set and use data in an exclusive array
|
||||
#define WORKERS 170 // Flugente: train workers for facilities
|
||||
#define WEATHER_CHANGE 169 // Flugente: sector-specific weather & more weather types
|
||||
#define ASD_INIT_FIX 168 // Flugente: fix for ASD feature introduced with ENEMY_HELICOPTERS
|
||||
#define NONPROFILE_MERCHANTS 167 // Flugente: merchants can be created from non-profile NPCs
|
||||
#define INDIVIDUAL_MILITIA 166 // Flugente: individual militia
|
||||
#define ENEMY_JEEPS 165 // Flugente: enemy jeeps
|
||||
#define ENEMY_HELICOPTERS 164 // Flugente: enemy helicopters
|
||||
#define DRUG_SYSTEM_REDONE 163 // Flugente: reworked the drug system
|
||||
#define MILITIA_PATH_PLOTTING 162 // Flugente: the player can plot militia paths in strategic, similar to player or helicopter travel
|
||||
#define STRATEGIC_TEAM_GROUPS 161 // Flugente: a change to the GROUP-structure allows any team to have strategic movement groups
|
||||
#define PMC_WEBSITE 160 // Flugente: a new PMC allows us to hire trained militia
|
||||
#define DISEASE_SYSTEM 159 // Flugente: mercs can get diseases
|
||||
#define PRISONER_EXPANSION 158 // Flugente: more types of prisoners
|
||||
#define DYNAMIC_DIALOGUE 157 // Flugente: mercs have dynamic dialogue depending on newly formed opinions, an the player can interact with them
|
||||
#define DYNAMIC_OPINIONS 156 // Flugente: mercs can form opinions on other people depending on their behaviour
|
||||
#define INCREASED_REFUEL_SITES 155 // Flugente: increased the number of helicopter refuel sites
|
||||
#define ENEMY_VIPS 154 // Flugente: enemy generals are placed randomly in the map
|
||||
#define MORE_LOCKS_AND_KEYS 153 // anv: externalized locks and keys to xml
|
||||
#define MILITIA_MOVEMENT 152 // Flugente: allow control of strategic militia movement
|
||||
#define SNITCH_TRAIT_EXTENDED 151 // anv: more soldier flags, remembering exposition of snitch
|
||||
#define CAMPAIGNSTATS 150 // Flugente: store campaign statistics
|
||||
#define WALDO_CAN_REPAIR_HELICOPTER 149 // anv: have to refresh Waldo records
|
||||
#define ENCYCLOPEDIA_ITEM_VISIBILITY 148 // Moa: Items discovered during compain have to be saved.
|
||||
#define TRAIT_RADIO_OPERATOR 147 // Flugente: new trait radio operator
|
||||
#define BACKGROUNDS_FIX_UINT8 146 // Flugente: had to change usBackground-vars from UINT8 to UINT16
|
||||
#define BACKGROUNDS 145 // Flugente: background feature
|
||||
#define NO_VEHICLE_SAVE 144 // Flugente: vehicle data isn't saved anymore, as it has long been externalised
|
||||
#define SOLDIER_PROFILES 143 // Flugente: profiles for enemy and militia (possibly any non-NPC/RPC character)
|
||||
#define DYNAMIC_FLASHLIGHTS 142 // Flugente: had to add variables to LIGHTEFFECT-struct
|
||||
#define ENLARGED_OPINIONS 141 // Flugente: increased number of merc opinions to 255, thus need to change savegame reading
|
||||
#define MODULARIZED_AI 140 // Flugente: new savegame version due to modularized AI
|
||||
#define MILITIA_EQUIPMENT 139 // Flugente: militia can equip from sector inventory
|
||||
#define MULTITURN_ACTIONS 138 // Flugente: multiturn actions
|
||||
#define EXTERNALISED_MERCHANTS 137 // Flugente: increased the number of merchants and externalised their data
|
||||
#define PRISON_SYSTEM 136 // Flugente: added var to the sector structure. Shouldn't break compatibility, but let's be safe
|
||||
#define DUAL_BURST_ADDED 135
|
||||
#define MORE_ROOMS 134 // changed room numbers from 8 to 16 bit by DBrot
|
||||
#define FOOD_CHANGES 133 // changes for food system
|
||||
#define ZOMBIE_CHANGES 132 // Included some changes for Zombies
|
||||
#define JA25_UB_INTEGRATION 131 // Before this, the JA25 Unfinished Business code was not integrated (see "Builddefines.h" JA2UB)
|
||||
#define IMPROVED_INTERRUPT_SYSTEM 130
|
||||
#define ENCYCLOPEDIA_SAVEGAME_CHANGE 129 // Added encyclopedia
|
||||
#define HIDDENTOWN_DATATYPE_CHANGE 128
|
||||
#define NEW_EMAIL_SAVE_GAME 127
|
||||
#define NEW_SAVE_GAME_GENERAL_SAVE_INFO_DATA 126
|
||||
#define QUESTS_DATATYPE_CHANGE 125 // Before this, we had a maximum number of 30 quests (JA2 default) (by Jazz)
|
||||
#define VEHICLES_DATATYPE_CHANGE 124 // Before this, vehicles were not externalized (by Jazz)
|
||||
#define FIXED_MERC_NOT_AVAILABLE_ON_MERC_WEBSITE 123 // Before this, only Bubba was available on MERC website
|
||||
#define FIXED_CREPITUS_IN_REALISTIC_GAME_MODE 122 // Before this, there was an initializing problem in GameInit.lua on startup, in which we could meet crepitus in Tixa underground map
|
||||
#define FIXED_NPC_QUOTE_BUG 121 // Before this, we need to reload all npc quote information because it was not being saved and loaded correctly.
|
||||
#define MOVED_GENERAL_INFO 120 // Before this, general game information was saved much later in the save game process.
|
||||
#define NCTH_AUTOFIRE_UPDATE 119 // Before this, we didn't track the original autofire offsets
|
||||
#define BR_EMAIL_DATA_CHANGE 118 // Before this, BR emails caused CTD
|
||||
#define NCTH_DATATYPE_CHANGE 117 // Before this, we did not have HAM 4.0 NCTH
|
||||
#define NEW_GENERAL_SAVE_INFO_DATA 116 // Before this, we did not have HAM 4.0 general info
|
||||
#define IMP_TRAIT_EXPERT_ITEMS_CHANGE 115 // Before this, we did not have additional expert items defined in IMPItemChoices.xml
|
||||
#define LUA_SAVEGAME_CHANGE 114 // Before this, we did not have additional lua script files (e.g: Intro.lua, ...)
|
||||
#define STOMP12_SAVEGAME_DATATYPE_CHANGE2 113 // Before this, STOMP did not allow to have up to 30 traits
|
||||
#define NAS_SAVEGAME_DATATYPE_CHANGE 112 // Before this, NAS settings (ON/OFF) was not saved to the savegame
|
||||
#define STOMP12_SAVEGAME_DATATYPE_CHANGE 111 // Before this, STOMP v1.2 was not included in the source
|
||||
#define BUGFIX_NPC_DATA_FOR_BIG_MAPS 110 // Before this, we had a bug in the NPC Data for Big Maps (this fix was introduced in the Closed Beta)
|
||||
#define STRATEGIC_MINES_DATATYPE_CHANGE 109 // Before this, we did not have strategic mines initialization via lua script
|
||||
#define HIDE_NPC_NAMES_FOR_UNKNOWN_PERSONS 108 // Before this, we did not have hiding of npc names for unknown persons included (by jazz)
|
||||
#define BIG_MAPS_PROJECT_SAVEGAME_DATATYPE_CHANGE 107 // Before this, we did not have big maps project
|
||||
#define AIRPORT_SAVEGAME_DATATYPE_CHANGE 106 // Before this, we did not have airport externalized
|
||||
#define AP100_SAVEGAME_DATATYPE_CHANGE 105 // Before this, we didn't have the 100AP structure changes
|
||||
#define NIV_SAVEGAME_DATATYPE_CHANGE 102 // Before this, we used the old structure system
|
||||
|
||||
#define SAVE_GAME_VERSION GROWTH_MODIFIERS
|
||||
|
||||
//#define RUSSIANGOLD
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
+2562
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,75 @@
|
||||
#ifndef _HELP_SCREEN__H_
|
||||
#define _HELP_SCREEN__H_
|
||||
|
||||
|
||||
//enum used for the different help screens that can come up
|
||||
enum
|
||||
{
|
||||
HELP_SCREEN_LAPTOP,
|
||||
HELP_SCREEN_MAPSCREEN,
|
||||
HELP_SCREEN_MAPSCREEN_NO_ONE_HIRED,
|
||||
HELP_SCREEN_MAPSCREEN_NOT_IN_ARULCO,
|
||||
HELP_SCREEN_MAPSCREEN_SECTOR_INVENTORY,
|
||||
HELP_SCREEN_TACTICAL,
|
||||
HELP_SCREEN_OPTIONS,
|
||||
HELP_SCREEN_LOAD_GAME,
|
||||
|
||||
HELP_SCREEN_NUMBER_OF_HELP_SCREENS,
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
INT8 bCurrentHelpScreen;
|
||||
UINT32 uiFlags;
|
||||
|
||||
UINT16 usHasPlayerSeenHelpScreenInCurrentScreen;
|
||||
|
||||
UINT8 ubHelpScreenDirty;
|
||||
|
||||
UINT16 usScreenLocX;
|
||||
UINT16 usScreenLocY;
|
||||
UINT16 usScreenWidth;
|
||||
UINT16 usScreenHeight;
|
||||
|
||||
INT32 iLastMouseClickY; //last position the mouse was clicked ( if != -1 )
|
||||
|
||||
INT8 bCurrentHelpScreenActiveSubPage; //used to keep track of the current page being displayed
|
||||
|
||||
INT8 bNumberOfButtons;
|
||||
|
||||
//used so if the user checked the box to show the help, it doesnt automatically come up every frame
|
||||
BOOLEAN fHaveAlreadyBeenInHelpScreenSinceEnteringCurrenScreen;
|
||||
|
||||
INT8 bDelayEnteringHelpScreenBy1FrameCount;
|
||||
UINT16 usLeftMarginPosX;
|
||||
|
||||
UINT16 usCursor;
|
||||
|
||||
BOOLEAN fWasTheGamePausedPriorToEnteringHelpScreen;
|
||||
|
||||
|
||||
|
||||
//scroll variables
|
||||
UINT16 usTotalNumberOfPixelsInBuffer;
|
||||
INT32 iLineAtTopOfTextBuffer;
|
||||
UINT16 usTotalNumberOfLinesInBuffer;
|
||||
BOOLEAN fForceHelpScreenToComeUp;
|
||||
|
||||
} HELP_SCREEN_STRUCT;
|
||||
|
||||
extern HELP_SCREEN_STRUCT gHelpScreen;
|
||||
|
||||
|
||||
|
||||
|
||||
BOOLEAN ShouldTheHelpScreenComeUp( UINT8 ubScreenID, BOOLEAN fForceHelpScreenToComeUp );
|
||||
void HelpScreenHandler();
|
||||
void InitHelpScreenSystem();
|
||||
void NewScreenSoResetHelpScreen( );
|
||||
INT8 HelpScreenDetermineWhichMapScreenHelpToShow();
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,178 @@
|
||||
#ifndef HELP_SCREEN_TEXT__H_
|
||||
#define HELP_SCREEN_TEXT__H_
|
||||
|
||||
|
||||
#include "Encrypted File.h"
|
||||
|
||||
#define HELPSCREEN_FILE "BINARYDATA\\Help.edt"
|
||||
|
||||
#define HELPSCREEN_RECORD_SIZE 80 * 8 * 2
|
||||
|
||||
//enum for the help text paragrphs
|
||||
enum
|
||||
{
|
||||
HLP_TXT_CONSTANT_SUBTITLE, //0
|
||||
HLP_TXT_CONSTANT_FOOTER,
|
||||
HLP_TXT_LAPTOP_TITLE,
|
||||
HLP_TXT_LAPTOP_BUTTON_1,
|
||||
HLP_TXT_LAPTOP_OVERVIEW_P1,
|
||||
HLP_TXT_LAPTOP_OVERVIEW_P2,
|
||||
HLP_TXT_LAPTOP_BUTTON_2,
|
||||
HLP_TXT_LAPTOP_EMAIL_P1,
|
||||
HLP_TXT_LAPTOP_BUTTON_3,
|
||||
HLP_TXT_LAPTOP_WEB_P1,
|
||||
|
||||
HLP_TXT_LAPTOP_BUTTON_4, //10
|
||||
HLP_TXT_LAPTOP_FILES_P1,
|
||||
HLP_TXT_LAPTOP_BUTTON_5,
|
||||
HLP_TXT_LAPTOP_HISTORY_P1,
|
||||
HLP_TXT_LAPTOP_BUTTON_6,
|
||||
HLP_TXT_LAPTOP_PERSONNEL_P1,
|
||||
|
||||
HLP_TXT_LAPTOP_BUTTON_7,
|
||||
HLP_TXT_FINANCES_P1,
|
||||
HLP_TXT_FINANCES_P2,
|
||||
|
||||
HLP_TXT_LAPTOP_BUTTON_8,
|
||||
HLP_TXT_MERC_STATS_P1,
|
||||
HLP_TXT_MERC_STATS_P2,
|
||||
HLP_TXT_MERC_STATS_P3,
|
||||
HLP_TXT_MERC_STATS_P4,
|
||||
HLP_TXT_MERC_STATS_P5,
|
||||
HLP_TXT_MERC_STATS_P6,
|
||||
HLP_TXT_MERC_STATS_P7,
|
||||
HLP_TXT_MERC_STATS_P8,
|
||||
HLP_TXT_MERC_STATS_P9,
|
||||
HLP_TXT_MERC_STATS_P10,
|
||||
HLP_TXT_MERC_STATS_P11,
|
||||
HLP_TXT_MERC_STATS_P12,
|
||||
HLP_TXT_MERC_STATS_P13,
|
||||
HLP_TXT_MERC_STATS_P14,
|
||||
HLP_TXT_MERC_STATS_P15,
|
||||
|
||||
//mapscreen no one hired yet
|
||||
HLP_TXT_MPSCRN_NO_1_HIRED_YET_TITLE,
|
||||
HLP_TXT_MPSCRN_NO_1_HIRED_YET_P1, //20
|
||||
HLP_TXT_MPSCRN_NO_1_HIRED_YET_P2,
|
||||
|
||||
//mapscreen not in arulco yet
|
||||
HLP_TXT_MPSCRN_NOT_IN_ARULCO_TITLE,
|
||||
|
||||
HLP_TXT_MPSCRN_NOT_IN_ARULCO_P1,
|
||||
HLP_TXT_MPSCRN_NOT_IN_ARULCO_P2,
|
||||
HLP_TXT_MPSCRN_NOT_IN_ARULCO_P3,
|
||||
|
||||
HLP_TXT_WELCOM_TO_ARULCO_TITLE,
|
||||
HLP_TXT_WELCOM_TO_ARULCO_BUTTON_1,
|
||||
HLP_TXT_WELCOM_TO_ARULCO_OVERVIEW_P1,
|
||||
HLP_TXT_WELCOM_TO_ARULCO_OVERVIEW_P2,
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
HLP_TXT_WELCOM_TO_ARULCO_OVERVIEW_P3, //30
|
||||
HLP_TXT_WELCOM_TO_ARULCO_OVERVIEW_P4,
|
||||
HLP_TXT_WELCOM_TO_ARULCO_OVERVIEW_P5,
|
||||
HLP_TXT_WELCOM_TO_ARULCO_BUTTON_2,
|
||||
HLP_TXT_WELCOM_TO_ARULCO_ASSNMNT_P1,
|
||||
HLP_TXT_WELCOM_TO_ARULCO_ASSNMNT_P2,
|
||||
HLP_TXT_WELCOM_TO_ARULCO_ASSNMNT_P3,
|
||||
HLP_TXT_WELCOM_TO_ARULCO_ASSNMNT_P4,
|
||||
HLP_TXT_WELCOM_TO_ARULCO_ASSNMNT_P5,
|
||||
HLP_TXT_WELCOM_TO_ARULCO_ASSNMNT_P6,
|
||||
|
||||
|
||||
HLP_TXT_WELCOM_TO_ARULCO_ASSNMNT_P7, //40
|
||||
HLP_TXT_WELCOM_TO_ARULCO_ASSNMNT_P8,
|
||||
HLP_TXT_WELCOM_TO_ARULCO_BUTTON_3,
|
||||
HLP_TXT_WELCOM_TO_ARULCO_DSTINATION_P1,
|
||||
HLP_TXT_WELCOM_TO_ARULCO_DSTINATION_P2,
|
||||
HLP_TXT_WELCOM_TO_ARULCO_DSTINATION_P3,
|
||||
HLP_TXT_WELCOM_TO_ARULCO_DSTINATION_P4,
|
||||
HLP_TXT_WELCOM_TO_ARULCO_DSTINATION_P5,
|
||||
HLP_TXT_WELCOM_TO_ARULCO_BUTTON_4,
|
||||
HLP_TXT_WELCOM_TO_ARULCO_MAP_P1,
|
||||
|
||||
HLP_TXT_WELCOM_TO_ARULCO_MAP_P2, //50
|
||||
HLP_TXT_WELCOM_TO_ARULCO_MAP_P3,
|
||||
HLP_TXT_WELCOM_TO_ARULCO_MAP_P4,
|
||||
HLP_TXT_WELCOM_TO_ARULCO_MAP_P5,
|
||||
HLP_TXT_WELCOM_TO_ARULCO_MAP_P6,
|
||||
HLP_TXT_WELCOM_TO_ARULCO_MAP_P7,
|
||||
HLP_TXT_WELCOM_TO_ARULCO_BUTTON_5,
|
||||
HLP_TXT_WELCOM_TO_ARULCO_MILITIA_P1,
|
||||
HLP_TXT_WELCOM_TO_ARULCO_MILITIA_P2,
|
||||
|
||||
|
||||
HLP_TXT_WELCOM_TO_ARULCO_MILITIA_P3, //60
|
||||
|
||||
HLP_TXT_WELCOM_TO_ARULCO_BUTTON_6,
|
||||
HLP_TXT_WELCOM_TO_ARULCO_AIRSPACE_P1,
|
||||
HLP_TXT_WELCOM_TO_ARULCO_AIRSPACE_P2,
|
||||
|
||||
|
||||
HLP_TXT_WELCOM_TO_ARULCO_BUTTON_7,
|
||||
HLP_TXT_WELCOM_TO_ARULCO_ITEMS_P1,
|
||||
|
||||
HLP_TXT_WELCOM_TO_ARULCO_BUTTON_8,
|
||||
HLP_TXT_WELCOM_TO_ARULCO_KEYBOARD_P1,
|
||||
HLP_TXT_WELCOM_TO_ARULCO_KEYBOARD_P2,
|
||||
HLP_TXT_WELCOM_TO_ARULCO_KEYBOARD_P3,
|
||||
HLP_TXT_WELCOM_TO_ARULCO_KEYBOARD_P4,
|
||||
|
||||
|
||||
HLP_TXT_TACTICAL_TITLE,
|
||||
HLP_TXT_TACTICAL_BUTTON_1,
|
||||
HLP_TXT_TACTICAL_OVERVIEW_P1,
|
||||
HLP_TXT_TACTICAL_OVERVIEW_P2,
|
||||
HLP_TXT_TACTICAL_OVERVIEW_P3,
|
||||
HLP_TXT_TACTICAL_OVERVIEW_P4,
|
||||
|
||||
HLP_TXT_TACTICAL_BUTTON_2,
|
||||
HLP_TXT_TACTICAL_MOVEMENT_P1,
|
||||
HLP_TXT_TACTICAL_MOVEMENT_P2,
|
||||
HLP_TXT_TACTICAL_MOVEMENT_P3,
|
||||
HLP_TXT_TACTICAL_MOVEMENT_P4,
|
||||
|
||||
|
||||
HLP_TXT_TACTICAL_BUTTON_3,
|
||||
HLP_TXT_TACTICAL_SIGHT_P1,
|
||||
HLP_TXT_TACTICAL_SIGHT_P2,
|
||||
HLP_TXT_TACTICAL_SIGHT_P3,
|
||||
HLP_TXT_TACTICAL_SIGHT_P4,
|
||||
|
||||
HLP_TXT_TACTICAL_BUTTON_4,
|
||||
HLP_TXT_TACTICAL_ATTACKING_P1,
|
||||
HLP_TXT_TACTICAL_ATTACKING_P2,
|
||||
HLP_TXT_TACTICAL_ATTACKING_P3,
|
||||
|
||||
HLP_TXT_TACTICAL_BUTTON_5,
|
||||
|
||||
HLP_TXT_TACTICAL_ITEMS_P1,
|
||||
HLP_TXT_TACTICAL_ITEMS_P2,
|
||||
HLP_TXT_TACTICAL_ITEMS_P3,
|
||||
HLP_TXT_TACTICAL_ITEMS_P4,
|
||||
HLP_TXT_TACTICAL_BUTTON_6,
|
||||
|
||||
|
||||
HLP_TXT_TACTICAL_KEYBOARD_P1,
|
||||
HLP_TXT_TACTICAL_KEYBOARD_P2,
|
||||
HLP_TXT_TACTICAL_KEYBOARD_P3,
|
||||
HLP_TXT_TACTICAL_KEYBOARD_P4,
|
||||
HLP_TXT_TACTICAL_KEYBOARD_P5,
|
||||
HLP_TXT_TACTICAL_KEYBOARD_P6,
|
||||
HLP_TXT_TACTICAL_KEYBOARD_P7,
|
||||
HLP_TXT_TACTICAL_KEYBOARD_P8,
|
||||
|
||||
|
||||
HLP_TXT_SECTOR_INVTRY_TITLE,
|
||||
// HLP_TXT_SECTOR_INVTRY_BUTTON_1,
|
||||
HLP_TXT_SECTOR_INVTRY_OVERVIEW_P1,
|
||||
HLP_TXT_SECTOR_INVTRY_OVERVIEW_P2,
|
||||
|
||||
|
||||
// HLP_TXT_,
|
||||
};
|
||||
|
||||
#endif
|
||||
+1803
File diff suppressed because it is too large
Load Diff
+240
@@ -0,0 +1,240 @@
|
||||
#ifndef _INIT_H
|
||||
#define _INIT_H
|
||||
|
||||
#include "LogicalBodyTypes/BodyTypeDB.h"
|
||||
#include "LogicalBodyTypes/Layers.h"
|
||||
#include "LogicalBodyTypes/AbstractXMLLoader.h"
|
||||
#include "LogicalBodyTypes/SurfaceDB.h"
|
||||
#include "LogicalBodyTypes/FilterDB.h"
|
||||
#include "LogicalBodyTypes/EnumeratorDB.h"
|
||||
#include "LogicalBodyTypes/BodyTypeDB.h"
|
||||
#include "LogicalBodyTypes/PaletteDB.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
UINT32 InitializeJA2( );
|
||||
void ShutdownJA2( );
|
||||
|
||||
BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer);
|
||||
void SetupMaxActionPointsAnimation();
|
||||
|
||||
//This is an enum to reference to array of ints that holds the values for all these constants. Gotthard 1/18/07
|
||||
|
||||
enum {
|
||||
AP_MAXIMUM,
|
||||
AP_MINIMUM,
|
||||
MIN_APS_TO_INTERRUPT,
|
||||
AP_MONSTER_MAXIMUM,
|
||||
AP_VEHICLE_MAXIMUM,
|
||||
MAX_AP_CARRIED,
|
||||
AP_YOUNG_MONST_FACTOR,
|
||||
AP_MONST_FRENZY_FACTOR,
|
||||
AP_CLAUSTROPHOBE,
|
||||
AP_AFRAID_OF_INSECTS,
|
||||
AP_EXCHANGE_PLACES,
|
||||
AP_REVERSE_MODIFIER,
|
||||
AP_STEALTH_MODIFIER,
|
||||
AP_STEAL_ITEM,
|
||||
AP_TAKE_BLOOD,
|
||||
AP_TALK,
|
||||
AP_MOVEMENT_FLAT,
|
||||
AP_MOVEMENT_GRASS,
|
||||
AP_MOVEMENT_BUSH,
|
||||
AP_MOVEMENT_RUBBLE,
|
||||
AP_MOVEMENT_SHORE,
|
||||
AP_MOVEMENT_LAKE,
|
||||
AP_MOVEMENT_OCEAN,
|
||||
AP_MODIFIER_RUN,
|
||||
AP_MODIFIER_WALK,
|
||||
AP_MODIFIER_SWAT,
|
||||
AP_MODIFIER_CRAWL,
|
||||
AP_MODIFIER_PACK,
|
||||
AP_MODIFIER_READY,
|
||||
AP_CHANGE_FACING,
|
||||
AP_CHANGE_TARGET,
|
||||
AP_TOSS_ITEM,
|
||||
AP_REFUEL_VEHICLE,
|
||||
AP_RADIO,
|
||||
AP_CROUCH,
|
||||
AP_PRONE,
|
||||
AP_LOOK_STANDING,
|
||||
AP_LOOK_CROUCHED,
|
||||
AP_LOOK_PRONE,
|
||||
AP_READY_KNIFE,
|
||||
AP_READY_DUAL,
|
||||
AP_MIN_AIM_ATTACK,
|
||||
AP_DROP_BOMB,
|
||||
AP_RELOAD_GUN,
|
||||
AP_START_FIRST_AID,
|
||||
AP_START_REPAIR,
|
||||
AP_GET_WOUNDED_DIVISOR,
|
||||
AP_FALL_DOWN,
|
||||
AP_OPEN_DOOR,
|
||||
AP_PICKLOCK,
|
||||
AP_EXAMINE_DOOR,
|
||||
AP_BOOT_DOOR,
|
||||
AP_USE_CROWBAR,
|
||||
AP_UNLOCK_DOOR,
|
||||
AP_LOCK_DOOR,
|
||||
AP_EXPLODE_DOOR,
|
||||
AP_UNTRAP_DOOR,
|
||||
AP_USEWIRECUTTERS,
|
||||
AP_CLIMBROOF,
|
||||
AP_CLIMBOFFROOF,
|
||||
AP_JUMPFENCE,
|
||||
AP_JUMPFENCEBPACK,
|
||||
AP_USE_REMOTE,
|
||||
AP_PULL_TRIGGER,
|
||||
AP_PUNCH,
|
||||
AP_PICKUP_ITEM,
|
||||
AP_GIVE_ITEM,
|
||||
AP_BURY_MINE,
|
||||
AP_DISARM_MINE,
|
||||
AP_DRINK,
|
||||
AP_CAMOFLAGE,
|
||||
AP_START_RUN_COST,
|
||||
AP_ATTACH_CAN,
|
||||
AP_JUMP_OVER,
|
||||
AP_BACK_PACK,
|
||||
AP_OPEN_ZIPPER,
|
||||
AP_CLOSE_ZIPPER,
|
||||
AP_CLICK_AIM,
|
||||
// HEADROCK HAM 3.1: Eight different settings for each aiming click with a scope.
|
||||
AP_FIRST_CLICK_AIM_SCOPE,
|
||||
AP_SECOND_CLICK_AIM_SCOPE,
|
||||
AP_THIRD_CLICK_AIM_SCOPE,
|
||||
AP_FOURTH_CLICK_AIM_SCOPE,
|
||||
AP_FIFTH_CLICK_AIM_SCOPE,
|
||||
AP_SIXTH_CLICK_AIM_SCOPE,
|
||||
AP_SEVENTH_CLICK_AIM_SCOPE,
|
||||
AP_EIGHTH_CLICK_AIM_SCOPE,
|
||||
AP_RELOAD_LOOSE,
|
||||
AP_UNJAM,
|
||||
AP_GRENADE_MODE,
|
||||
|
||||
AP_JUMPWINDOW, //WANNE: jump window APs
|
||||
|
||||
AP_WRONG_MAG,
|
||||
AP_MAX_SUPPRESSED,
|
||||
AP_MAX_TURN_SUPPRESSED,
|
||||
AP_MIN_LIMIT,
|
||||
AP_LOST_PER_MORALE_DROP,
|
||||
AP_SUPPRESSION_MOD,
|
||||
// HEADROCK HAM 3.3: AP loss per point of damage, inflicted when a character is knocked down by a hit to the legs.
|
||||
AP_LOSS_PER_LEGSHOT_DAMAGE,
|
||||
|
||||
AUTOFIRE_SHOTS_AP_VALUE,
|
||||
BAD_AP_COST,
|
||||
//Cost to take item from position
|
||||
AP_INV_FROM_NONE,
|
||||
AP_INV_FROM_HANDS,
|
||||
AP_INV_FROM_EQUIPMENT,
|
||||
AP_INV_FROM_VEST,
|
||||
AP_INV_FROM_RIG,
|
||||
AP_INV_FROM_CPACK,
|
||||
AP_INV_FROM_BPACK,
|
||||
AP_INV_FROM_SLING,
|
||||
AP_INV_FROM_KNIFE,
|
||||
AP_INV_FROM_FACE,
|
||||
AP_INV_FROM_BIG_POCKET,
|
||||
AP_INV_FROM_SMALL_POCKET,
|
||||
//Cost to move item to position
|
||||
AP_INV_TO_NONE,
|
||||
AP_INV_TO_HANDS,
|
||||
AP_INV_TO_EQUIPMENT,
|
||||
AP_INV_TO_VEST,
|
||||
AP_INV_TO_RIG,
|
||||
AP_INV_TO_CPACK,
|
||||
AP_INV_TO_BPACK,
|
||||
AP_INV_TO_SLING,
|
||||
AP_INV_TO_KNIFE,
|
||||
AP_INV_TO_FACE,
|
||||
AP_INV_TO_BIG_POCKET,
|
||||
AP_INV_TO_SMALL_POCKET,
|
||||
//Max inventory cost
|
||||
AP_INV_MAX_COST,
|
||||
AP_JUMPWALL,
|
||||
AP_JUMPOFFWALL,
|
||||
AP_FORTIFICATION,
|
||||
AP_REMOVE_FORTIFICATION,
|
||||
AP_EAT,
|
||||
AP_CLEANINGKIT,
|
||||
AP_DISGUISE,
|
||||
AP_HANDCUFF,
|
||||
AP_APPLYITEM,
|
||||
AP_INVENTORY_ARM,
|
||||
AP_SPOTTER,
|
||||
AP_HACK,
|
||||
AP_READFILE,
|
||||
AP_WATERTAP,
|
||||
AP_SODAMACHINE,
|
||||
AP_CAMERA,
|
||||
AP_FILLBLOODBAG,
|
||||
|
||||
AP_ENTER_VEHICLE,
|
||||
AP_EXIT_VEHICLE,
|
||||
AP_CHANGE_SEAT_VEHICLE,
|
||||
|
||||
DEFAULT_APS,
|
||||
DEFAULT_AIMSKILL,
|
||||
BP_RATIO_RED_PTS_TO_NORMAL,
|
||||
BP_RT_BREATH_RECOVER_MODIFIER, // modifies breath regeneration during realtime mode
|
||||
BP_RT_BREATH_DEDUCT_MODIFIER, // modifies breath drain for all movement during realtime mode
|
||||
BP_RUN_ENERGYCOSTFACTOR,
|
||||
BP_WALK_ENERGYCOSTFACTOR,
|
||||
BP_SWAT_ENERGYCOSTFACTOR,
|
||||
BP_CRAWL_ENERGYCOSTFACTOR,
|
||||
BP_RADIO,
|
||||
BP_USE_DETONATOR,
|
||||
BP_PER_AP_NO_EFFORT,
|
||||
BP_PER_AP_MIN_EFFORT,
|
||||
BP_PER_AP_LT_EFFORT,
|
||||
BP_PER_AP_MOD_EFFORT,
|
||||
BP_MOVEMENT_FLAT,
|
||||
BP_MOVEMENT_GRASS,
|
||||
BP_MOVEMENT_BUSH,
|
||||
BP_MOVEMENT_RUBBLE,
|
||||
BP_MOVEMENT_SHORE,
|
||||
BP_MOVEMENT_LAKE,
|
||||
BP_MOVEMENT_OCEAN,
|
||||
BP_MOVEMENT_READY,
|
||||
BP_CROUCH,
|
||||
BP_PRONE,
|
||||
BP_CLIMBROOF,
|
||||
BP_CLIMBOFFROOF,
|
||||
BP_JUMPFENCE,
|
||||
BP_JUMPFENCEBPACK,
|
||||
BP_STEAL_ITEM,
|
||||
BP_START_FIRST_AID,
|
||||
BP_GET_HIT,
|
||||
BP_GET_WOUNDED,
|
||||
BP_FALL_DOWN,
|
||||
BP_OPEN_DOOR,
|
||||
BP_PICKLOCK,
|
||||
BP_EXAMINE_DOOR,
|
||||
BP_BOOT_DOOR,
|
||||
BP_USE_CROWBAR,
|
||||
BP_UNLOCK_DOOR,
|
||||
BP_EXPLODE_DOOR,
|
||||
BP_UNTRAP_DOOR,
|
||||
BP_LOCK_DOOR,
|
||||
BP_USEWIRECUTTERS,
|
||||
BP_DROP_BOMB,
|
||||
BP_BURY_MINE,
|
||||
BP_DISARM_MINE,
|
||||
BP_JUMP_OVER,
|
||||
BP_BACK_PACK,
|
||||
BP_WORK_ZIPPER,
|
||||
BP_UNJAM,
|
||||
BP_JUMPOFFWALL,
|
||||
BP_JUMPWALL,
|
||||
BP_FORTIFICATION,
|
||||
BP_REMOVE_FORTIFICATION,
|
||||
BP_HANDCUFF,
|
||||
BP_APPLYITEM,
|
||||
BP_INVENTORY_ARM,
|
||||
BP_FILLBLOODBAG,
|
||||
TOTAL_APBP_VALUES
|
||||
};
|
||||
#endif
|
||||
+747
@@ -0,0 +1,747 @@
|
||||
#include "sgp.h"
|
||||
#include "sysutil.h"
|
||||
#include "vobject_blitters.h"
|
||||
#include "font control.h"
|
||||
#include "cursor control.h"
|
||||
#include "render dirty.h"
|
||||
#include "Text.h"
|
||||
#include "Utilities.h"
|
||||
#include "WordWrap.h"
|
||||
#include "text.h"
|
||||
#include "Line.h"
|
||||
#include "Intro.h"
|
||||
#include "Cinematics.h"
|
||||
#include "Cinematics Bink.h"
|
||||
#include "mainmenuscreen.h"
|
||||
#include "Music Control.h"
|
||||
#include "LibraryDataBase.h"
|
||||
#include "english.h"
|
||||
#include "soldier profile type.h"
|
||||
#include "MessageBoxScreen.h"
|
||||
#include "sgp_logger.h"
|
||||
#include "Soldier Profile.h"
|
||||
#include "Game Init.h"
|
||||
#include "INIReader.h"
|
||||
|
||||
#include <vfs/Core/vfs.h>
|
||||
|
||||
#include "Luaglobal.h"
|
||||
#ifdef JA2UB
|
||||
#include "strategicmap.h"
|
||||
#include "Map Screen Interface Map.h"
|
||||
#include "Map Screen Interface.h"
|
||||
#include "End Game.h"
|
||||
#include "Cinematics Bink.h"
|
||||
#endif
|
||||
|
||||
#include "LuaInitNPCs.h"
|
||||
#include "XML.h"
|
||||
|
||||
BOOLEAN Style_JA = TRUE;
|
||||
extern INT8 Test = 0;
|
||||
|
||||
INTRO_NAMES_VALUES zVideoFile[255];
|
||||
UINT32 iStringToUseLua = -1;
|
||||
|
||||
// BF
|
||||
class VideoPlayer
|
||||
{
|
||||
public:
|
||||
enum VideoType
|
||||
{
|
||||
VT_NONE = 0,
|
||||
VT_SMK = 1,
|
||||
VT_BINK = 2,
|
||||
};
|
||||
VideoPlayer(UINT32 type) : _type(type), _smk(NULL), _bink(NULL), _current(VT_NONE)
|
||||
{
|
||||
}
|
||||
void Initialize()
|
||||
{
|
||||
if(_type & VT_SMK)
|
||||
{
|
||||
SmkInitialize( ghWindow, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
}
|
||||
if(_type & VT_BINK)
|
||||
{
|
||||
BinkInitialize(ghWindow, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
}
|
||||
}
|
||||
void Shutdown()
|
||||
{
|
||||
stopVideo(); // if one is still "running"
|
||||
if(_type & VT_SMK)
|
||||
{
|
||||
SmkShutdown();
|
||||
}
|
||||
if(_type & VT_BINK)
|
||||
{
|
||||
BinkShutdownVideo();
|
||||
}
|
||||
}
|
||||
|
||||
bool isValid()
|
||||
{
|
||||
if( (_current == VT_SMK && _smk && !_bink) || (_current == VT_BINK && !_smk && _bink) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isPlaying()
|
||||
{
|
||||
if( _current == VT_SMK && _smk && !_bink )
|
||||
{
|
||||
return SmkPollFlics() != 0;
|
||||
}
|
||||
else if(_current == VT_BINK && !_smk && _bink)
|
||||
{
|
||||
return BinkPollFlics() != 0;
|
||||
}
|
||||
else if(_current == VT_NONE && !_smk && !_bink)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
SGP_THROW(L"Invalid Video Player state : last video was not properly stopped ");
|
||||
}
|
||||
|
||||
void stopVideo()
|
||||
{
|
||||
if(_current == VT_SMK && _smk && !_bink)
|
||||
{
|
||||
SmkCloseFlic(_smk);
|
||||
_smk = NULL;
|
||||
}
|
||||
else if(_current == VT_BINK && !_smk && _bink)
|
||||
{
|
||||
BinkCloseFlic(_bink);
|
||||
_bink = NULL;
|
||||
}
|
||||
_current = VT_NONE;
|
||||
}
|
||||
|
||||
bool startVideo(std::string const& filename)
|
||||
{
|
||||
if(isPlaying())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// stop running video before starting a new one
|
||||
stopVideo();
|
||||
|
||||
if(filename.empty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/// check file extension
|
||||
std::string ext;
|
||||
std::string::size_type pos = filename.find_last_of(".");
|
||||
if(pos != std::string::npos)
|
||||
{
|
||||
ext = filename.substr(pos, filename.size() - pos);
|
||||
}
|
||||
if(vfs::StrCmp::Equal(ext, ".smk"))
|
||||
{
|
||||
return startSmkVideo(filename);
|
||||
}
|
||||
else if(vfs::StrCmp::Equal(ext, ".bik"))
|
||||
{
|
||||
return startBinkVideo(filename);
|
||||
}
|
||||
else if(ext.empty())
|
||||
{
|
||||
// try .bik first
|
||||
if(!startBinkVideo(filename + ".bik"))
|
||||
{
|
||||
return startSmkVideo(filename + ".smk");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
SGP_INFO(L"Unknown video file format");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
private:
|
||||
bool startSmkVideo(std::string const& filename)
|
||||
{
|
||||
_smk = SmkPlayFlic( filename.c_str(), (SCREEN_WIDTH-640)/2, (SCREEN_HEIGHT-480)/2, TRUE );
|
||||
if(_smk)
|
||||
{
|
||||
_current = VT_SMK;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool startBinkVideo(std::string const& filename)
|
||||
{
|
||||
_bink = BinkPlayFlic( filename.c_str(), (SCREEN_WIDTH-640)/2, (SCREEN_HEIGHT-480)/2, BINK_FLIC_AUTOCLOSE | BINK_FLIC_CENTER_VERTICAL);
|
||||
if(_bink)
|
||||
{
|
||||
_current = VT_BINK;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
private:
|
||||
UINT32 _type;
|
||||
SMKFLIC* _smk;
|
||||
BINKFLIC* _bink;
|
||||
VideoType _current;
|
||||
};
|
||||
|
||||
static VideoPlayer s_VP(VideoPlayer::VT_SMK | VideoPlayer::VT_BINK);
|
||||
|
||||
extern STR16 gzIntroScreen[];
|
||||
extern HVSURFACE ghFrameBuffer;
|
||||
|
||||
enum
|
||||
{
|
||||
INTRO_TXT__CANT_FIND_INTRO,
|
||||
};
|
||||
|
||||
//ddd
|
||||
|
||||
|
||||
//ggg
|
||||
BOOLEAN gfIntroScreenEntry;
|
||||
BOOLEAN gfIntroScreenExit;
|
||||
|
||||
UINT32 guiIntroExitScreen = INTRO_SCREEN;
|
||||
|
||||
|
||||
extern BOOLEAN gfDoneWithSplashScreen;
|
||||
|
||||
//BF SMKFLIC *gpSmackFlic = NULL;
|
||||
|
||||
//enums for the various smacker files
|
||||
enum EGameVideos
|
||||
{
|
||||
INTRO_NO_VIDEO = -1,
|
||||
INTRO_REBEL_CRDT = 0,
|
||||
INTRO_OMERTA,
|
||||
INTRO_PRAGUE_CRDT,
|
||||
INTRO_PRAGUE,
|
||||
|
||||
//there are no more videos shown for the begining
|
||||
|
||||
|
||||
INTRO_END_END_SPEECH_MIGUEL,
|
||||
INTRO_END_END_SPEECH_NO_MIGUEL,
|
||||
INTRO_END_HELI_FLYBY,
|
||||
INTRO_END_SKYRIDER_HELICOPTER,
|
||||
INTRO_END_NOSKYRIDER_HELICOPTER,
|
||||
|
||||
INTRO_SPLASH_SCREEN,
|
||||
INTRO_SPLASH_TALONSOFT,
|
||||
|
||||
#ifdef JA2UB
|
||||
|
||||
INTRO_HELI_CRASH_SCENE_1,
|
||||
INTRO_END_SCENE_1,
|
||||
|
||||
#endif
|
||||
|
||||
//there are no more videos shown for the endgame
|
||||
INTRO_LAST_END_GAME,
|
||||
|
||||
INTRO_FIRST_VIDEO = 255
|
||||
};
|
||||
|
||||
EGameVideos giCurrentIntroBeingPlayed = INTRO_NO_VIDEO;
|
||||
/*
|
||||
CHAR *gpzSmackerFileNames[] =
|
||||
{
|
||||
//begining of the game
|
||||
"INTRO\\Rebel_cr.smk",
|
||||
"INTRO\\Omerta.smk",
|
||||
"INTRO\\Prague_cr.smk",
|
||||
"INTRO\\Prague.smk",
|
||||
|
||||
|
||||
//endgame
|
||||
"INTRO\\Throne_Mig.smk",
|
||||
"INTRO\\Throne_NoMig.smk",
|
||||
"INTRO\\Heli_FlyBy.smk",
|
||||
"INTRO\\Heli_Sky.smk",
|
||||
"INTRO\\Heli_NoSky.smk",
|
||||
|
||||
"INTRO\\SplashScreen.smk",
|
||||
"INTRO\\TalonSoftid_endhold.smk",
|
||||
};
|
||||
*/
|
||||
typedef std::map<EGameVideos,std::string> VideoFileNames_t;
|
||||
static VideoFileNames_t s_VFN;
|
||||
|
||||
//enums used for when the intro screen can come up, either begining game intro, or end game cinematic
|
||||
INT8 gbIntroScreenMode=-1;
|
||||
|
||||
|
||||
extern void CDromEjectionErrorMessageBoxCallBack( UINT8 bExitValue );
|
||||
|
||||
void GetIntroScreenUserInput();
|
||||
BOOLEAN EnterIntroScreen();
|
||||
void RenderIntroScreen();
|
||||
void ExitIntroScreen();
|
||||
void HandleIntroScreen();
|
||||
void PrepareToExitIntroScreen();
|
||||
EGameVideos GetNextIntroVideo( EGameVideos uiCurrentVideo );
|
||||
void StartPlayingIntroFlic( EGameVideos iIndexOfFlicToPlay );
|
||||
void DisplaySirtechSplashScreen();
|
||||
|
||||
|
||||
//ppp
|
||||
|
||||
|
||||
UINT32 IntroScreenInit( void )
|
||||
{
|
||||
//Set so next time we come in, we can set up
|
||||
gfIntroScreenEntry = TRUE;
|
||||
|
||||
CIniReader inireader("IntroVideos.ini");
|
||||
|
||||
// BF: If NO_DEFAULT_VALUES is set to true, then only the explicitely used videos will be shown.
|
||||
BOOLEAN no_defaults = inireader.ReadBoolean("INTRO", "NO_DEFAULT_VALUES", false);
|
||||
|
||||
s_VFN[INTRO_REBEL_CRDT] = inireader.ReadString("INTRO_BEGINNING", "INTRO_REBEL_CRDT", no_defaults ? "" : "INTRO\\Rebel_cr");
|
||||
s_VFN[INTRO_OMERTA] = inireader.ReadString("INTRO_BEGINNING", "INTRO_OMERTA", no_defaults ? "" : "INTRO\\Omerta");
|
||||
s_VFN[INTRO_PRAGUE_CRDT] = inireader.ReadString("INTRO_BEGINNING", "INTRO_PRAGUE_CRDT", no_defaults ? "" : "INTRO\\Prague_cr");
|
||||
s_VFN[INTRO_PRAGUE] = inireader.ReadString("INTRO_BEGINNING", "INTRO_PRAGUE", no_defaults ? "" : "INTRO\\Prague");
|
||||
|
||||
//there are no more videos shown for the begining
|
||||
s_VFN[INTRO_END_END_SPEECH_MIGUEL] = inireader.ReadString("INTRO_ENDING","INTRO_END_END_SPEECH_MIGUEL", no_defaults ? "" : "INTRO\\Throne_Mig");
|
||||
s_VFN[INTRO_END_END_SPEECH_NO_MIGUEL] = inireader.ReadString("INTRO_ENDING","INTRO_END_END_SPEECH_NO_MIGUEL", no_defaults ? "" : "INTRO\\Throne_NoMig");
|
||||
s_VFN[INTRO_END_HELI_FLYBY] = inireader.ReadString("INTRO_ENDING","INTRO_END_HELI_FLYBY", no_defaults ? "" : "INTRO\\Heli_FlyBy");
|
||||
s_VFN[INTRO_END_SKYRIDER_HELICOPTER] = inireader.ReadString("INTRO_ENDING","INTRO_END_SKYRIDER_HELICOPTER", no_defaults ? "" : "INTRO\\Heli_Sky");
|
||||
s_VFN[INTRO_END_NOSKYRIDER_HELICOPTER] = inireader.ReadString("INTRO_ENDING","INTRO_END_NOSKYRIDER_HELICOPTER", no_defaults ? "" : "INTRO\\Heli_NoSky");
|
||||
|
||||
s_VFN[INTRO_SPLASH_SCREEN] = inireader.ReadString("INTRO_SPLASH","INTRO_SPLASH_SCREEN", no_defaults ? "" : "INTRO\\SplashScreen");
|
||||
s_VFN[INTRO_SPLASH_TALONSOFT] = inireader.ReadString("INTRO_SPLASH","INTRO_SPLASH_TALONSOFT", no_defaults ? "" : "INTRO\\TalonSoftid_endhold");
|
||||
|
||||
//UB
|
||||
#ifdef JA2UB
|
||||
s_VFN[INTRO_HELI_CRASH_SCENE_1] = inireader.ReadString("INTRO_BEGINNING","INTRO_HELI_CRASH_SCENE", no_defaults ? "" : "INTRO\\Intro");
|
||||
s_VFN[INTRO_END_SCENE_1] = inireader.ReadString("INTRO_ENDING","INTRO_END_SCENE", no_defaults ? "" : "INTRO\\MissileEnding");
|
||||
#endif
|
||||
|
||||
|
||||
//there are no more videos shown for the endgame
|
||||
|
||||
return( 1 );
|
||||
}
|
||||
|
||||
|
||||
UINT32 IntroScreenShutdown( void )
|
||||
{
|
||||
return( 1 );
|
||||
}
|
||||
|
||||
|
||||
UINT32 IntroScreenHandle( void )
|
||||
{
|
||||
if( gfIntroScreenEntry )
|
||||
{
|
||||
EnterIntroScreen();
|
||||
gfIntroScreenEntry = FALSE;
|
||||
gfIntroScreenExit = FALSE;
|
||||
|
||||
InvalidateRegion( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT );
|
||||
}
|
||||
|
||||
//RestoreBackgroundRects();//shadooow: fixes graphical artefacts visible around end game videos
|
||||
|
||||
|
||||
GetIntroScreenUserInput();
|
||||
|
||||
HandleIntroScreen();
|
||||
|
||||
ExecuteBaseDirtyRectQueue();
|
||||
EndFrameBufferRender();
|
||||
|
||||
|
||||
if( gfIntroScreenExit )
|
||||
{
|
||||
ExitIntroScreen();
|
||||
gfIntroScreenExit = FALSE;
|
||||
gfIntroScreenEntry = TRUE;
|
||||
}
|
||||
|
||||
return( guiIntroExitScreen );
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN EnterIntroScreen()
|
||||
{
|
||||
|
||||
Test = 0;
|
||||
|
||||
ClearMainMenu();
|
||||
|
||||
SetCurrentCursorFromDatabase( VIDEO_NO_CURSOR );
|
||||
|
||||
// Don't play music....
|
||||
SetMusicMode( MUSIC_NONE );
|
||||
|
||||
// WANNE: No we have an INI option for the choise if the intro should be played
|
||||
if (!iPlayIntro && gbIntroScreenMode != INTRO_ENDING)
|
||||
{
|
||||
PrepareToExitIntroScreen();
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
//initialize video player
|
||||
s_VP.Initialize();
|
||||
|
||||
//get the index opf the first video to watch
|
||||
EGameVideos iFirstVideoID = GetNextIntroVideo( INTRO_FIRST_VIDEO );
|
||||
|
||||
if( iFirstVideoID != -1 )
|
||||
{
|
||||
StartPlayingIntroFlic( iFirstVideoID );
|
||||
|
||||
guiIntroExitScreen = INTRO_SCREEN;
|
||||
}
|
||||
|
||||
//Got no intro video, exit
|
||||
else
|
||||
{
|
||||
PrepareToExitIntroScreen();
|
||||
}
|
||||
|
||||
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
void RenderIntroScreen()
|
||||
{
|
||||
}
|
||||
|
||||
void ExitIntroScreen()
|
||||
{
|
||||
//shutdown video player
|
||||
s_VP.Shutdown();
|
||||
}
|
||||
|
||||
void StopIntroVideo()
|
||||
{
|
||||
s_VP.stopVideo();
|
||||
}
|
||||
|
||||
void HandleIntroScreen()
|
||||
{
|
||||
//if we are exiting this screen, this frame, dont update the screen
|
||||
if( gfIntroScreenExit )
|
||||
return;
|
||||
|
||||
//handle video in each frame
|
||||
BOOLEAN fFlicStillPlaying = s_VP.isPlaying();
|
||||
|
||||
//if the flic is not playing
|
||||
if( !fFlicStillPlaying )
|
||||
{
|
||||
EGameVideos iNextVideoToPlay = GetNextIntroVideo( giCurrentIntroBeingPlayed );
|
||||
|
||||
if( iNextVideoToPlay != -1 )
|
||||
{
|
||||
StartPlayingIntroFlic( iNextVideoToPlay );
|
||||
}
|
||||
else
|
||||
{
|
||||
PrepareToExitIntroScreen();
|
||||
giCurrentIntroBeingPlayed = INTRO_NO_VIDEO;
|
||||
}
|
||||
}
|
||||
|
||||
InvalidateScreen();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void GetIntroScreenUserInput()
|
||||
{
|
||||
InputAtom Event;
|
||||
POINT MousePos;
|
||||
|
||||
GetCursorPos(&MousePos);
|
||||
ScreenToClient(ghWindow, &MousePos); // In window coords!
|
||||
|
||||
while( DequeueEvent( &Event ) )
|
||||
{
|
||||
// HOOK INTO MOUSE HOOKS
|
||||
switch( Event.usEvent)
|
||||
{
|
||||
case LEFT_BUTTON_DOWN:
|
||||
MouseSystemHook(LEFT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown);
|
||||
break;
|
||||
case LEFT_BUTTON_UP:
|
||||
MouseSystemHook(LEFT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y ,_LeftButtonDown, _RightButtonDown);
|
||||
break;
|
||||
case RIGHT_BUTTON_DOWN:
|
||||
MouseSystemHook(RIGHT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown);
|
||||
break;
|
||||
case RIGHT_BUTTON_UP:
|
||||
MouseSystemHook(RIGHT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown);
|
||||
break;
|
||||
case RIGHT_BUTTON_REPEAT:
|
||||
MouseSystemHook(RIGHT_BUTTON_REPEAT, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown);
|
||||
break;
|
||||
case LEFT_BUTTON_REPEAT:
|
||||
MouseSystemHook(LEFT_BUTTON_REPEAT, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown);
|
||||
break;
|
||||
}
|
||||
|
||||
if( Event.usEvent == KEY_UP )
|
||||
{
|
||||
switch( Event.usParam )
|
||||
{
|
||||
case ESC:
|
||||
s_VP.stopVideo();
|
||||
PrepareToExitIntroScreen();
|
||||
break;
|
||||
case SPACE:
|
||||
s_VP.stopVideo();
|
||||
break;
|
||||
|
||||
#ifdef JA2TESTVERSION
|
||||
|
||||
case 'r':
|
||||
break;
|
||||
|
||||
case 'i':
|
||||
InvalidateRegion( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT );
|
||||
break;
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if the user presses either mouse button
|
||||
if( gfLeftButtonState || gfRightButtonState )
|
||||
{
|
||||
//advance to the next flic
|
||||
s_VP.stopVideo();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PrepareToExitIntroScreen()
|
||||
{
|
||||
#ifdef LUA_INTRO
|
||||
LuaIntro(0, 0, 0, 0);
|
||||
#else
|
||||
//if its the intro at the begining of the game
|
||||
if( gbIntroScreenMode == INTRO_BEGINNING )
|
||||
{
|
||||
//go to the init screen
|
||||
guiIntroExitScreen = INIT_SCREEN;
|
||||
}
|
||||
else if( gbIntroScreenMode == INTRO_SPLASH )
|
||||
{
|
||||
//display a logo when exiting
|
||||
DisplaySirtechSplashScreen();
|
||||
|
||||
gfDoneWithSplashScreen = TRUE;
|
||||
guiIntroExitScreen = INIT_SCREEN;
|
||||
}
|
||||
else
|
||||
{
|
||||
//We want to reinitialize the game
|
||||
ReStartingGame();
|
||||
|
||||
// guiIntroExitScreen = MAINMENU_SCREEN;
|
||||
guiIntroExitScreen = CREDIT_SCREEN;
|
||||
}
|
||||
|
||||
gfIntroScreenExit = TRUE;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
EGameVideos GetNextIntroVideo( EGameVideos uiCurrentVideo )
|
||||
{
|
||||
EGameVideos iStringToUse = INTRO_NO_VIDEO;
|
||||
#ifdef LUA_INTRO
|
||||
switch( Test )
|
||||
{
|
||||
case 0:
|
||||
LuaIntro(1, uiCurrentVideo, 0, 0);
|
||||
iStringToUse = (EGameVideos)iStringToUseLua;
|
||||
//Test = 1;
|
||||
break;
|
||||
}
|
||||
#else
|
||||
//switch on whether it is the beginging or the end game video
|
||||
switch( gbIntroScreenMode )
|
||||
{
|
||||
//the video at the begining of the game
|
||||
case INTRO_BEGINNING:
|
||||
{
|
||||
switch( uiCurrentVideo )
|
||||
{
|
||||
case INTRO_FIRST_VIDEO:
|
||||
iStringToUse = INTRO_REBEL_CRDT;
|
||||
break;
|
||||
case INTRO_REBEL_CRDT:
|
||||
iStringToUse = INTRO_OMERTA;
|
||||
break;
|
||||
case INTRO_OMERTA:
|
||||
iStringToUse = INTRO_PRAGUE_CRDT;
|
||||
break;
|
||||
case INTRO_PRAGUE_CRDT:
|
||||
iStringToUse = INTRO_PRAGUE;
|
||||
break;
|
||||
case INTRO_PRAGUE:
|
||||
iStringToUse = INTRO_NO_VIDEO;
|
||||
break;
|
||||
// case INTRO_LAST_INTRO:
|
||||
// iStringToUse = -1;
|
||||
// break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
//end game
|
||||
case INTRO_ENDING:
|
||||
{
|
||||
switch( uiCurrentVideo )
|
||||
{
|
||||
case INTRO_FIRST_VIDEO:
|
||||
{
|
||||
//if Miguel is dead, play the flic with out him in it
|
||||
if( gMercProfiles[ MIGUEL ].bMercStatus == MERC_IS_DEAD )
|
||||
iStringToUse = INTRO_END_END_SPEECH_NO_MIGUEL;
|
||||
else
|
||||
iStringToUse = INTRO_END_END_SPEECH_MIGUEL;
|
||||
break;
|
||||
}
|
||||
case INTRO_END_END_SPEECH_MIGUEL:
|
||||
case INTRO_END_END_SPEECH_NO_MIGUEL:
|
||||
{
|
||||
iStringToUse = INTRO_END_HELI_FLYBY;
|
||||
break;
|
||||
}
|
||||
//if SkyRider is dead, play the flic without him
|
||||
case INTRO_END_HELI_FLYBY:
|
||||
{
|
||||
if( gMercProfiles[ SKYRIDER ].bMercStatus == MERC_IS_DEAD )
|
||||
iStringToUse = INTRO_END_NOSKYRIDER_HELICOPTER;
|
||||
else
|
||||
iStringToUse = INTRO_END_SKYRIDER_HELICOPTER;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case INTRO_SPLASH:
|
||||
switch( uiCurrentVideo )
|
||||
{
|
||||
case INTRO_FIRST_VIDEO:
|
||||
iStringToUse = INTRO_SPLASH_SCREEN;
|
||||
break;
|
||||
case INTRO_SPLASH_SCREEN:
|
||||
//iStringToUse = SMKINTRO_SPLASH_TALONSOFT;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
#endif
|
||||
return( iStringToUse );
|
||||
}
|
||||
|
||||
|
||||
void StartPlayingIntroFlic( EGameVideos iIndexOfFlicToPlay )
|
||||
{
|
||||
if( iIndexOfFlicToPlay != -1 )
|
||||
{
|
||||
giCurrentIntroBeingPlayed = iIndexOfFlicToPlay;
|
||||
//start playing a flic
|
||||
if(s_VP.startVideo( s_VFN[iIndexOfFlicToPlay] ))
|
||||
{
|
||||
if(!s_VP.isValid())
|
||||
{
|
||||
//do a check
|
||||
#ifdef JA2BETAVERSION
|
||||
PrepareToExitIntroScreen();
|
||||
#else
|
||||
DoScreenIndependantMessageBox( gzIntroScreen[INTRO_TXT__CANT_FIND_INTRO], MSG_BOX_FLAG_OK, CDromEjectionErrorMessageBoxCallBack );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SetIntroType( INT8 bIntroType )
|
||||
{
|
||||
#ifdef LUA_INTRO
|
||||
LuaIntro(2, 0, bIntroType, 0);
|
||||
#else
|
||||
if( bIntroType == INTRO_BEGINNING )
|
||||
{
|
||||
gbIntroScreenMode = INTRO_BEGINNING;
|
||||
}
|
||||
else if( bIntroType == INTRO_ENDING )
|
||||
{
|
||||
gbIntroScreenMode = INTRO_ENDING;
|
||||
}
|
||||
else if( bIntroType == INTRO_SPLASH )
|
||||
{
|
||||
gbIntroScreenMode = INTRO_SPLASH;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void DisplaySirtechSplashScreen()
|
||||
{
|
||||
// CLEAR THE FRAME BUFFER
|
||||
UINT32 uiDestPitchBYTES;
|
||||
UINT8* pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES );
|
||||
memset(pDestBuf, 0, SCREEN_HEIGHT * uiDestPitchBYTES );
|
||||
UnLockVideoSurface( FRAME_BUFFER );
|
||||
|
||||
VOBJECT_DESC VObjectDesc;
|
||||
memset( &VObjectDesc, 0, sizeof( VOBJECT_DESC ) );
|
||||
VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE | VOBJECT_CREATE_FROMPNG_FALLBACK;
|
||||
FilenameForBPP("INTERFACE\\SirtechSplash.sti", VObjectDesc.ImageFile);
|
||||
// FilenameForBPP("INTERFACE\\TShold.sti", VObjectDesc.ImageFile);
|
||||
|
||||
UINT32 uiLogoID;
|
||||
if( !AddVideoObject(&VObjectDesc, &uiLogoID) )
|
||||
{
|
||||
FilenameForBPP("GERMAN\\SPLASH_GERMAN.sti", VObjectDesc.ImageFile);
|
||||
if( !AddVideoObject(&VObjectDesc, &uiLogoID) )
|
||||
{
|
||||
/*
|
||||
* This is the place, where most non english coders stranding.
|
||||
* Don't hesitate, don't give up!
|
||||
* I'll now tell You what You made wrong
|
||||
* (2006-10-10, Sergeant_Kolja)
|
||||
*/
|
||||
#ifdef _DEBUG
|
||||
# if defined(ENGLISH)
|
||||
AssertMsg( 0, String( "Wheter English nor German works. May be You built English - but have only German or other foreign Disk?" ) );
|
||||
# elif defined(GERMAN)
|
||||
AssertMsg( 0, String( "Weder Englisch noch Deutsch geht. Deutsche Version kompiliert und mit englischer CDs gestartet? Das geht nicht!" ) );
|
||||
# endif
|
||||
#endif
|
||||
AssertMsg( 0, String( "Failed to load %s", VObjectDesc.ImageFile ) );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
HVOBJECT hPixHandle;
|
||||
GetVideoObject(&hPixHandle, uiLogoID);
|
||||
BltVideoObject(FRAME_BUFFER, hPixHandle, 0,(SCREEN_WIDTH-640)/2, (SCREEN_HEIGHT-480)/2, VO_BLT_SRCTRANSPARENCY,NULL);
|
||||
DeleteVideoObjectFromIndex(uiLogoID);
|
||||
|
||||
InvalidateScreen();
|
||||
RefreshScreen( NULL );
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
#ifndef _INTRO__C_
|
||||
#define _INTRO__C_
|
||||
|
||||
|
||||
|
||||
UINT32 IntroScreenShutdown( void );
|
||||
UINT32 IntroScreenHandle( void );
|
||||
UINT32 IntroScreenInit( void );
|
||||
|
||||
void StopIntroVideo();
|
||||
|
||||
//enums used for when the intro screen can come up, used with 'gbIntroScreenMode'
|
||||
enum EIntroType
|
||||
{
|
||||
#ifdef JA2UB
|
||||
INTRO_HELI_CRASH,
|
||||
#endif
|
||||
INTRO_BEGINNING, //set when viewing the intro at the begining of the game
|
||||
INTRO_ENDING, //set when viewing the end game video.
|
||||
|
||||
INTRO_SPLASH,
|
||||
};
|
||||
|
||||
|
||||
extern UINT32 guiSmackerSurface;
|
||||
|
||||
|
||||
void SetIntroType( INT8 bIntroType );
|
||||
extern void DisplaySirtechSplashScreen();
|
||||
extern UINT32 guiIntroExitScreen;
|
||||
extern BOOLEAN gfIntroScreenExit;
|
||||
extern INT8 gbIntroScreenMode;
|
||||
|
||||
#define MAX_VIDEO_NAMES_CHARS 128
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UINT16 uiIndex;
|
||||
CHAR16 szFile[MAX_VIDEO_NAMES_CHARS];
|
||||
|
||||
} INTRO_NAMES_VALUES;
|
||||
|
||||
extern INTRO_NAMES_VALUES zVideoFile[255];
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,78 @@
|
||||
#include "Types.h"
|
||||
#include "vsurface.h"
|
||||
#include "mainmenuscreen.h"
|
||||
#include "Video.h"
|
||||
#include "Timer Control.h"
|
||||
#include "Multi Language Graphic Utils.h"
|
||||
#include <stdio.h>
|
||||
|
||||
UINT32 guiSplashFrameFade = 10;
|
||||
UINT32 guiSplashStartTime = 0;
|
||||
extern HVSURFACE ghFrameBuffer;
|
||||
|
||||
//Simply create videosurface, load image, and draw it to the screen.
|
||||
void InitJA2SplashScreen()
|
||||
{
|
||||
#ifdef ENGLISH
|
||||
ClearMainMenu();
|
||||
|
||||
#else
|
||||
UINT32 uiLogoID = 0;
|
||||
HVSURFACE hVSurface; // unused jonathanl // lalien reenabled for international versions
|
||||
VSURFACE_DESC VSurfaceDesc; //unused jonathanl // lalien reenabled for international versions
|
||||
# ifdef JA2TESTVERSION
|
||||
INT32 i = 0;
|
||||
|
||||
memset( &VSurfaceDesc, 0, sizeof( VSURFACE_DESC ) );
|
||||
VSurfaceDesc.fCreateFlags = VSURFACE_CREATE_FROMFILE | VSURFACE_SYSTEM_MEM_USAGE | VSURFACE_CREATE_FROMPNG_FALLBACK;
|
||||
sprintf( VSurfaceDesc.ImageFile, "LOADSCREENS\\Notification.sti" );
|
||||
if( !AddVideoSurface( &VSurfaceDesc, &uiLogoID ) )
|
||||
{
|
||||
//AssertMsg( 0, String( "Failed to load %s", VSurfaceDesc.ImageFile ) );
|
||||
return;
|
||||
}
|
||||
GetVideoSurface(&hVSurface, uiLogoID );
|
||||
//BltVideoSurfaceToVideoSurface( ghFrameBuffer, hVSurface, 0, 0, 0, 0, NULL );
|
||||
BltVideoSurfaceToVideoSurface( ghFrameBuffer, hVSurface, 0, iScreenWidthOffset, iScreenHeightOffset, 0, NULL );
|
||||
DeleteVideoSurfaceFromIndex( uiLogoID );
|
||||
|
||||
|
||||
InvalidateScreen();
|
||||
RefreshScreen( NULL );
|
||||
|
||||
guiSplashStartTime = GetJA2Clock();
|
||||
while( i < 60 * 15 )//guiSplashStartTime + 15000 > GetJA2Clock() )
|
||||
{
|
||||
//Allow the user to pick his bum.
|
||||
InvalidateScreen();
|
||||
RefreshScreen( NULL );
|
||||
i++;
|
||||
}
|
||||
# endif // JA2TESTVERSION
|
||||
|
||||
memset( &VSurfaceDesc, 0, sizeof( VSURFACE_DESC ) );
|
||||
VSurfaceDesc.fCreateFlags = VSURFACE_CREATE_FROMFILE | VSURFACE_SYSTEM_MEM_USAGE | VSURFACE_CREATE_FROMPNG_FALLBACK;
|
||||
GetMLGFilename( VSurfaceDesc.ImageFile, MLG_SPLASH );
|
||||
try
|
||||
{
|
||||
if( !AddVideoSurface( &VSurfaceDesc, &uiLogoID ) )
|
||||
{
|
||||
AssertMsg( 0, String( "Failed to load %s", VSurfaceDesc.ImageFile ) );
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch(std::exception &ex)
|
||||
{
|
||||
SGP_RETHROW(L"Failed loading splash screen", ex);
|
||||
}
|
||||
|
||||
GetVideoSurface( &hVSurface, uiLogoID );
|
||||
BltVideoSurfaceToVideoSurface( ghFrameBuffer, hVSurface, 0, iScreenWidthOffset, iScreenHeightOffset, 0, NULL );
|
||||
DeleteVideoSurfaceFromIndex( uiLogoID );
|
||||
#endif // ENGLISH
|
||||
|
||||
InvalidateScreen();
|
||||
RefreshScreen( NULL );
|
||||
|
||||
guiSplashStartTime = GetJA2Clock();
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
#ifndef __JA2_SPLASH_H
|
||||
#define __JA2_SPLASH_H
|
||||
|
||||
void InitJA2SplashScreen();
|
||||
|
||||
extern UINT32 guiSplashFrameFade;
|
||||
extern UINT32 guiSplashStartTime;
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,96 @@
|
||||
#include "builddefines.h"
|
||||
#include <wchar.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "Render Fun.h"
|
||||
#include "stdlib.h"
|
||||
#include "debug.h"
|
||||
#include "MemMan.h"
|
||||
#include "Overhead Types.h"
|
||||
//#include "Soldier Control.h"
|
||||
#include "Animation Cache.h"
|
||||
#include "Animation Data.h"
|
||||
#include "Animation Control.h"
|
||||
#include <math.h>
|
||||
#include "pathai.h"
|
||||
#include "Random.h"
|
||||
#include "Isometric Utils.h"
|
||||
#include "renderworld.h"
|
||||
#include "video.h"
|
||||
#include "weapons.h"
|
||||
#include "vobject_blitters.h"
|
||||
#include "Handle UI.h"
|
||||
#include "Event pump.h"
|
||||
#include "ai.h"
|
||||
#include "interface.h"
|
||||
#include "lighting.h"
|
||||
#include "faces.h"
|
||||
#include "Soldier Profile.h"
|
||||
#include "soldier macros.h"
|
||||
#include "english.h"
|
||||
#include "Squads.h"
|
||||
|
||||
#ifdef NETWORKED
|
||||
#include "Networking.h"
|
||||
#include "NetworkEvent.h"
|
||||
#endif
|
||||
#include "items.h"
|
||||
#include "Soundman.h"
|
||||
#include "utilities.h"
|
||||
#include "Strategic.h"
|
||||
#include "soldier tile.h"
|
||||
#include "Smell.h"
|
||||
#include "Keys.h"
|
||||
#include "dialogue control.h"
|
||||
#include "soldier functions.h"
|
||||
#include "Exit Grids.h"
|
||||
#include "Quests.h"
|
||||
#include "message.h"
|
||||
#include "SkillCheck.h"
|
||||
#include "interface dialogue.h"
|
||||
#include "GameSettings.h"
|
||||
#include "ShopKeeper Interface.h"
|
||||
#include "vehicles.h"
|
||||
#include "strategicmap.h"
|
||||
#include "morale.h"
|
||||
#include "drugs and alcohol.h"
|
||||
#include "SkillCheck.h"
|
||||
#include "Map Information.h"
|
||||
#include "Buildings.h"
|
||||
#include "Text.h"
|
||||
#include "Campaign Types.h"
|
||||
#include "Strategic Status.h"
|
||||
#include "civ quotes.h"
|
||||
#include "Debug Control.h"
|
||||
|
||||
#ifdef JA2UB
|
||||
|
||||
#include "Ja25_Tactical.h"
|
||||
#include "Ja25 Strategic Ai.h"
|
||||
|
||||
INT16 JA2_5_START_SECTOR_X;
|
||||
INT16 JA2_5_START_SECTOR_Y;
|
||||
|
||||
//** Defines *******************************************************************
|
||||
|
||||
//Starting money
|
||||
#define JA2_5_STARTING_MONEY_EASY 40000
|
||||
#define JA2_5_STARTING_MONEY_MEDIUM 35000
|
||||
#define JA2_5_STARTING_MONEY_HARD 30000
|
||||
|
||||
|
||||
#define JA2SAVE_CONV_FILENAME "..\\SavedGames\\Ja2.dts"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
INT8 bMercID;
|
||||
INT8 bPercentStatIncrease;
|
||||
} STAT_CHANGE;
|
||||
|
||||
#define NUM_MERCS_TO_USE_IN_PERCENT_STAT_INCREASE 6
|
||||
|
||||
#define MAX_STAT_INCREASE 30
|
||||
|
||||
#endif
|
||||
|
||||
//******************************************************************************
|
||||
@@ -0,0 +1,34 @@
|
||||
#ifndef JA25UPDATE__C_
|
||||
#define JA25UPDATE__C_
|
||||
|
||||
#include "Types.h"
|
||||
|
||||
#ifdef JA2UB
|
||||
|
||||
//Used in the editor to compensate for the 2_<map name>
|
||||
#define JA25_EXP_MAP_NAME_PREFIX L""
|
||||
#define JA25_EXP_MAP_NAME_SIZE_OFFSET 0
|
||||
|
||||
|
||||
//The starting sector of the Expanion pack
|
||||
extern INT16 JA2_5_START_SECTOR_X;
|
||||
extern INT16 JA2_5_START_SECTOR_Y;
|
||||
//#define JA2_5_START_SECTOR_X 7
|
||||
//#define JA2_5_START_SECTOR_Y 8
|
||||
|
||||
#define JA25_PROF_DAT "BINARYDATA\\Ja25Prof.dat"
|
||||
|
||||
/*
|
||||
BOOLEAN ConvertJa2SaveToJa2_5();
|
||||
|
||||
BOOLEAN ImportOldProfilesAndProcessThem();
|
||||
|
||||
void GivePlayerStartingJa25Money();
|
||||
|
||||
UINT32 HandleDifficultyModifierForImportedGames();
|
||||
|
||||
BOOLEAN DoesJa25ImportSaveExistAndSeemValid();
|
||||
*/
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,21 @@
|
||||
#include "Language Defines.h"
|
||||
|
||||
#if defined(ENGLISH)
|
||||
# pragma message(" (Language set to ENGLISH, You'll need english CDs)")
|
||||
#elif defined(GERMAN)
|
||||
# pragma message(" (Language set to GERMAN, You'll need Topware/german CDs)")
|
||||
#elif defined(RUSSIAN)
|
||||
# pragma message(" (Language set to RUSSIAN, You'll need russian CDs)")
|
||||
#elif defined(DUTCH)
|
||||
# pragma message(" (Language set to DUTCH, You'll need dutch CDs)")
|
||||
#elif defined(POLISH)
|
||||
# pragma message(" (Language set to POLISH, You'll need polish CDs)")
|
||||
#elif defined(FRENCH)
|
||||
# pragma message(" (Language set to FRENCH, You'll need french CDs)")
|
||||
#elif defined(ITALIAN)
|
||||
# pragma message(" (Language set to ITALIAN, You'll need italian CDs)")
|
||||
#elif defined(CHINESE)
|
||||
# pragma message(" (Language set to CHINESE, You'll need chinese CDs)")
|
||||
#else
|
||||
# error "At least You have to specify a Language somewhere. See comments above."
|
||||
#endif
|
||||
@@ -0,0 +1,119 @@
|
||||
#ifndef __LANGUAGE_DEFINES_H
|
||||
#define __LANGUAGE_DEFINES_H
|
||||
|
||||
#pragma once
|
||||
|
||||
/* ============================================================================
|
||||
* ONLY ONE OF THESE LANGUAGES CAN BE DEFINED AT A TIME!
|
||||
* BUT now You can define it _here_ by uncommenting one _or_ (better):
|
||||
* You can comment them all out and then set it _global_ in "Preprocessor
|
||||
* options" (do it for ALL projects in the workspace and both debug & release)
|
||||
* _or_
|
||||
* give it do Your MAKEFILE, f.i. make ENGLISH, but keep in mind that some
|
||||
* weird make tools will require 'make ENGLISH=1' instead
|
||||
*
|
||||
* using one of the two later methods will keep this SVN file unchanged for the
|
||||
* future, only Your private project files (workspace/solution) will differ
|
||||
* from the SVN stuff.
|
||||
* (2006-10-10, Sergeant_Kolja)
|
||||
*/
|
||||
|
||||
|
||||
/* The recommend approach for VS2010 multi-language builds is to use the command line or the ja2.props file.
|
||||
|
||||
By default the language is ENGLISH and the Language Prefix is EN.
|
||||
|
||||
There are 3 ways you can build the JA2 1.13 executable file:
|
||||
|
||||
// -------------------------------------------------------
|
||||
// 1. Using the command line
|
||||
// -------------------------------------------------------
|
||||
|
||||
For example, where msbuild is located in %SystemRoot%\Microsoft.NET\Framework\v4.0.30319\ if not on your path
|
||||
msbuild.exe /p:Configuration=Release ja2_VS2010.sln
|
||||
msbuild.exe /p:Configuration=Release /p:JA2LangPrefix=PL /p:JA2Language=POLISH ja2_VS2010.sln
|
||||
msbuild.exe /p:Configuration=Release /p:JA2LangPrefix=DE /p:JA2Language=GERMAN ja2_VS2010.sln
|
||||
msbuild.exe /p:Configuration=Release /p:JA2LangPrefix=RU /p:JA2Language=RUSSIAN ja2_VS2010.sln
|
||||
msbuild.exe /p:Configuration=Release /p:JA2LangPrefix=NL /p:JA2Language=DUTCH ja2_VS2010.sln
|
||||
msbuild.exe /p:Configuration=Release /p:JA2LangPrefix=FR /p:JA2Language=FRENCH ja2_VS2010.sln
|
||||
msbuild.exe /p:Configuration=Release /p:JA2LangPrefix=IT /p:JA2Language=ITALIAN ja2_VS2010.sln
|
||||
msbuild.exe /p:Configuration=Release /p:JA2LangPrefix=CN /p:JA2Language=CHINESE ja2_VS2010.sln
|
||||
|
||||
Note: If you want to build "Unfinished Business" version, just append the /p:JA2Config=JA2UB in the command line
|
||||
msbuild.exe /p:Configuration=Release /p:JA2Config=JA2UB ja2_VS2010.sln
|
||||
msbuild.exe /p:Configuration=Release /p:JA2LangPrefix=DE /p:JA2Language=GERMAN /p:JA2Config=JA2UB ja2_VS2010.sln
|
||||
|
||||
Note2: You can also specify the target output name with the parameter /p:TargetName
|
||||
msbuild.exe /p:Configuration=Release /p:JA2LangPrefix=DE /p:JA2Language=GERMAN /p:JA2Config=JA2UB /p:TargetName="JA2UB_113" ja2_VS2010.sln
|
||||
|
||||
// --------------------------------------------------------
|
||||
// 2. Editing the ja2.props file and then build in VS 2010
|
||||
// -------------------------------------------------------
|
||||
|
||||
1. Open the "ja2.props" file in a text editor and set the <BuildMacro> tags to your likeing.
|
||||
|
||||
For example: If you want to build Russian Version (normal JA2, not UB) then set the following:
|
||||
|
||||
<BuildMacro Include="JA2Config">
|
||||
<Value></Value>
|
||||
</BuildMacro>
|
||||
<BuildMacro Include="JA2LangPrefix">
|
||||
<Value>RU</Value>
|
||||
</BuildMacro>
|
||||
<BuildMacro Include="JA2Language">
|
||||
<Value>RUSSIAN</Value>
|
||||
</BuildMacro>
|
||||
|
||||
2. Save the file
|
||||
3. Build the project in Visual Studio 2010
|
||||
|
||||
// --------------------------------------------------------
|
||||
// 3. The "old" way for building the executable
|
||||
// -------------------------------------------------------
|
||||
|
||||
1. Enable the "#undef ENGLISH" define below, so English will not be used anymore
|
||||
2. Set the desired language below
|
||||
3. If you want to build "Unfinished Business" version, enable "#define JA2UB" and "#define JA2UBMAPS" in builddefines.h"
|
||||
4. Build the executable in VS 2005 / 2008 / 2010
|
||||
5. The output will be placed in the "Build\bin\" folder
|
||||
*/
|
||||
|
||||
// Only enable this "undef", if you use the 3. way of building the executable!
|
||||
#undef ENGLISH
|
||||
|
||||
#if !defined(ENGLISH) && !defined(GERMAN) && !defined(RUSSIAN) && !defined(DUTCH) && !defined(POLISH) && !defined(FRENCH) && !defined(ITALIAN) && !defined(CHINESE)
|
||||
/* please set one manually here (by uncommenting) if not willingly to set Workspace wide */
|
||||
|
||||
#define ENGLISH
|
||||
//#define GERMAN
|
||||
//#define RUSSIAN
|
||||
//#define DUTCH
|
||||
//#define FRENCH
|
||||
//#define ITALIAN
|
||||
//#define POLISH
|
||||
|
||||
// INFO: For Chinese 1.13 version, you also have to set USE_WINFONTS = 1 in ja2.ini inside your JA2 installation directory!
|
||||
//#define CHINESE
|
||||
|
||||
#endif
|
||||
|
||||
//**ddd direct link libraries
|
||||
#pragma comment (lib, "user32.lib")
|
||||
#pragma comment (lib, "gdi32.lib")
|
||||
#pragma comment (lib, "advapi32.lib")
|
||||
#pragma comment (lib, "shell32.lib")
|
||||
|
||||
/* ====================================================================
|
||||
* Regardless of if we did it Workspace wide or by uncommenting above,
|
||||
* HERE we must see, what language was selected. If one, we
|
||||
*/
|
||||
#if !defined(ENGLISH) && !defined(GERMAN) && !defined(RUSSIAN) && !defined(DUTCH) && !defined(POLISH) && !defined(FRENCH) && !defined(ITALIAN) && !defined(CHINESE)
|
||||
# error "At least You have to specify a Language somewhere. See comments above."
|
||||
#endif
|
||||
|
||||
//if the language represents words as single chars
|
||||
/*#ifdef TAIWAN
|
||||
#define SINGLE_CHAR_WORDS
|
||||
#endif*/
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,571 @@
|
||||
#include "vsurface.h"
|
||||
#include "mapscreen.h"
|
||||
#include "Loading Screen.h"
|
||||
#include "Campaign Types.h"
|
||||
#include "Game Clock.h"
|
||||
#include "GameSettings.h"
|
||||
#include "Random.h"
|
||||
#include "Debug.h"
|
||||
#include "local.h"
|
||||
#include "Font Control.h"
|
||||
#include "font.h"
|
||||
#include "render dirty.h"
|
||||
#include "Strategic Movement.h"
|
||||
#include "UndergroundInit.h"
|
||||
#include <string>
|
||||
#include "strategicmap.h"
|
||||
|
||||
extern HVSURFACE ghFrameBuffer;
|
||||
extern BOOLEAN gfSchedulesHosed;
|
||||
|
||||
#ifdef JA2UB
|
||||
#include "Ja25_Tactical.h"
|
||||
#include "Ja25 Strategic Ai.h"
|
||||
#endif
|
||||
UINT8 gubLastLoadingScreenID = LOADINGSCREEN_NOTHING;
|
||||
FLOAT fLoadingScreenAspectRatio;
|
||||
//BOOLEAN bShowSmallImage = FALSE;
|
||||
SECTOR_LOADSCREENS gSectorLoadscreens[MAX_SECTOR_LOADSCREENS];
|
||||
|
||||
static INT16 requestedX, requestedY, requestedZ;
|
||||
static STR8 szSector;
|
||||
static STR8 szSectorMap[MAP_WORLD_Y][MAP_WORLD_X] = {
|
||||
{"N", "N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N" , "N" , "N" , "N" , "N" , "N" , "N" , "N" ,"N"},
|
||||
|
||||
{"N", "A1","A2","A3","A4","A5","A6","A7","A8","A9","A10","A11","A12","A13","A14","A15","A16" ,"N"},
|
||||
{"N", "B1","B2","B3","B4","B5","B6","B7","B8","B9","B10","B11","B12","B13","B14","B15","B16" ,"N"},
|
||||
{"N", "C1","C2","C3","C4","C5","C6","C7","C8","C9","C10","C11","C12","C13","C14","C15","C16" ,"N"},
|
||||
{"N", "D1","D2","D3","D4","D5","D6","D7","D8","D9","D10","D11","D12","D13","D14","D15","D16" ,"N"},
|
||||
{"N", "E1","E2","E3","E4","E5","E6","E7","E8","E9","E10","E11","E12","E13","E14","E15","E16" ,"N"},
|
||||
{"N", "F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","F13","F14","F15","F16" ,"N"},
|
||||
{"N", "G1","G2","G3","G4","G5","G6","G7","G8","G9","G10","G11","G12","G13","G14","G15","G16" ,"N"},
|
||||
{"N", "H1","H2","H3","H4","H5","H6","H7","H8","H9","H10","H11","H12","H13","H14","H15","H16" ,"N"},
|
||||
{"N", "I1","I2","I3","I4","I5","I6","I7","I8","I9","I10","I11","I12","I13","I14","I15","I16" ,"N"},
|
||||
{"N", "J1","J2","J3","J4","J5","J6","J7","J8","J9","J10","J11","J12","J13","J14","J15","J16" ,"N"},
|
||||
{"N", "K1","K2","K3","K4","K5","K6","K7","K8","K9","K10","K11","K12","K13","K14","K15","K16" ,"N"},
|
||||
{"N", "L1","L2","L3","L4","L5","L6","L7","L8","L9","L10","L11","L12","L13","L14","L15","L16" ,"N"},
|
||||
{"N", "M1","M2","M3","M4","M5","M6","M7","M8","M9","M10","M11","M12","M13","M14","M15","M16" ,"N"},
|
||||
{"N", "N1","N2","N3","N4","N5","N6","N7","N8","N9","N10","N11","N12","N13","N14","N15","N16" ,"N"},
|
||||
{"N", "O1","O2","O3","O4","O5","O6","O7","O8","O9","O10","O11","O12","O13","O14","O15","O16" ,"N"},
|
||||
{"N", "P1","P2","P3","P4","P5","P6","P7","P8","P9","P10","P11","P12","P13","P14","P15","P16" ,"N"},
|
||||
|
||||
{"N", "N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N" ,"N" , "N" , "N" , "N" , "N" , "N" , "N" , "N" ,"N"},
|
||||
};
|
||||
|
||||
// Map LOADINGSCREEN_NOTHING, ..., LOADINGSCREEN_NIGHTBALIME (see enum in header file)
|
||||
// to some strings which will be used to create the actual filename
|
||||
// (by appending e.g. "_800x600.sti" or something).
|
||||
// This is only used when NOT loading them from SectorLoadscreens.xml.
|
||||
static STR8 LoadScreenNames[LOADINGSCREEN_NIGHTBALIME+1] =
|
||||
{
|
||||
"LS_Heli",
|
||||
"LS_DayGeneric",
|
||||
"LS_DayTown1",
|
||||
"LS_DayTown2",
|
||||
"LS_DayWild",
|
||||
"LS_DayTropical",
|
||||
"LS_DayForest",
|
||||
"LS_DayDesert",
|
||||
"LS_DayPalace",
|
||||
"LS_NightGeneric",
|
||||
"LS_NightWild",
|
||||
"LS_NightTown1",
|
||||
"LS_NightTown2",
|
||||
"LS_NightForest",
|
||||
"LS_NightTropical",
|
||||
"LS_NightDesert",
|
||||
"LS_NightPalace",
|
||||
"LS_Heli",
|
||||
"LS_Basement",
|
||||
"LS_Mine",
|
||||
"LS_Cave",
|
||||
"LS_DayPine",
|
||||
"LS_NightPine",
|
||||
"LS_DayMilitary",
|
||||
"LS_NightMilitary",
|
||||
"LS_DaySAM",
|
||||
"LS_NightSAM",
|
||||
"LS_DayPrison",
|
||||
"LS_NightPrison",
|
||||
"LS_DayHospital",
|
||||
"LS_NightHospital",
|
||||
"LS_DayAirport",
|
||||
"LS_NightAirport",
|
||||
"LS_DayLab",
|
||||
"LS_NightLab",
|
||||
"LS_DayOmerta",
|
||||
"LS_NightOmerta",
|
||||
"LS_DayChitzena",
|
||||
"LS_NightChitzena",
|
||||
"LS_DayMine",
|
||||
"LS_NightMine",
|
||||
"LS_DayBalime",
|
||||
"LS_NightBalime",
|
||||
};
|
||||
|
||||
//returns the UINT8 ID for the specified sector.
|
||||
// Which for sectors above ground is one of { HELI, DAY, NIGHT }
|
||||
// if gGameExternalOptions.gfUseExternalLoadscreens.
|
||||
// Otherwise and for underground sectors this is the actual loadsceen ID.
|
||||
UINT8 GetLoadScreenID(INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ)
|
||||
{
|
||||
const UINT8 ubSectorID = SECTOR( sSectorX, sSectorY );
|
||||
const BOOLEAN fNight = NightTime(); //before 5AM or after 9PM
|
||||
|
||||
requestedX = sSectorX; requestedY = sSectorY; requestedZ = bSectorZ;
|
||||
|
||||
/* User made system - BEGIN */
|
||||
if (gGameExternalOptions.gfUseExternalLoadscreens)
|
||||
{
|
||||
szSector = szSectorMap [sSectorY][sSectorX];
|
||||
if (DidGameJustStart())
|
||||
return DidGameJustStart() ? HELI : (fNight ? NIGHT : DAY);
|
||||
|
||||
else if (bSectorZ != 0)
|
||||
return UNDERGROUND;
|
||||
|
||||
else
|
||||
return fNight ? NIGHT : DAY;
|
||||
|
||||
} /* WANNE: User made System - END */
|
||||
|
||||
/* WANNE: Sir-Tech System - BEGIN */
|
||||
else
|
||||
{
|
||||
// Which map layer? (ground, basement 1-3)?
|
||||
switch( bSectorZ )
|
||||
{
|
||||
// Ground
|
||||
case 0:
|
||||
{
|
||||
switch( ubSectorID )
|
||||
{
|
||||
case SEC_A2:
|
||||
case SEC_B2:
|
||||
return fNight ? LOADINGSCREEN_NIGHTCHITZENA : LOADINGSCREEN_DAYCHITZENA;
|
||||
case SEC_A9:
|
||||
return DidGameJustStart() ? LOADINGSCREEN_HELI :
|
||||
(fNight ? LOADINGSCREEN_NIGHTOMERTA : LOADINGSCREEN_DAYOMERTA);
|
||||
case SEC_A10:
|
||||
return fNight ? LOADINGSCREEN_NIGHTOMERTA : LOADINGSCREEN_DAYOMERTA;
|
||||
case SEC_P3:
|
||||
return fNight ? LOADINGSCREEN_NIGHTPALACE : LOADINGSCREEN_DAYPALACE;
|
||||
case SEC_H13:
|
||||
case SEC_H14: //military installations
|
||||
case SEC_I13:
|
||||
case SEC_N7:
|
||||
return fNight ? LOADINGSCREEN_NIGHTMILITARY : LOADINGSCREEN_DAYMILITARY;
|
||||
case SEC_K4:
|
||||
return fNight ? LOADINGSCREEN_NIGHTLAB : LOADINGSCREEN_DAYLAB;
|
||||
case SEC_J9:
|
||||
return fNight ? LOADINGSCREEN_NIGHTPRISON : LOADINGSCREEN_DAYPRISON;
|
||||
case SEC_D2:
|
||||
case SEC_D15:
|
||||
case SEC_I8:
|
||||
case SEC_N4:
|
||||
return fNight ? LOADINGSCREEN_NIGHTSAM : LOADINGSCREEN_DAYSAM;
|
||||
case SEC_F8:
|
||||
return fNight ? LOADINGSCREEN_NIGHTHOSPITAL : LOADINGSCREEN_DAYHOSPITAL;
|
||||
case SEC_B13:
|
||||
case SEC_N3:
|
||||
return fNight ? LOADINGSCREEN_NIGHTAIRPORT : LOADINGSCREEN_DAYAIRPORT;
|
||||
case SEC_L11:
|
||||
case SEC_L12:
|
||||
return fNight ? LOADINGSCREEN_NIGHTBALIME : LOADINGSCREEN_DAYBALIME;
|
||||
case SEC_H3:
|
||||
case SEC_H8:
|
||||
case SEC_D4:
|
||||
return fNight ? LOADINGSCREEN_NIGHTMINE : LOADINGSCREEN_DAYMINE;
|
||||
}
|
||||
|
||||
SECTORINFO *pSector = &SectorInfo[ ubSectorID ];
|
||||
switch( pSector->ubTraversability[ THROUGH_STRATEGIC_MOVE ] )
|
||||
{
|
||||
case TOWN:
|
||||
return Random(2) > 0 ?
|
||||
(fNight ? LOADINGSCREEN_NIGHTTOWN2 : LOADINGSCREEN_DAYTOWN2) :
|
||||
(fNight ? LOADINGSCREEN_NIGHTTOWN1 : LOADINGSCREEN_DAYTOWN1);
|
||||
case SAND:
|
||||
case SAND_ROAD:
|
||||
return fNight ? LOADINGSCREEN_NIGHTDESERT : LOADINGSCREEN_DAYDESERT;
|
||||
case FARMLAND:
|
||||
case FARMLAND_ROAD:
|
||||
case ROAD:
|
||||
return fNight ? LOADINGSCREEN_NIGHTGENERIC : LOADINGSCREEN_DAYGENERIC;
|
||||
case PLAINS:
|
||||
case SPARSE:
|
||||
case HILLS:
|
||||
case PLAINS_ROAD:
|
||||
case SPARSE_ROAD:
|
||||
case HILLS_ROAD:
|
||||
return fNight ? LOADINGSCREEN_NIGHTWILD : LOADINGSCREEN_DAYWILD;
|
||||
case DENSE:
|
||||
case SWAMP:
|
||||
case SWAMP_ROAD:
|
||||
case DENSE_ROAD:
|
||||
return fNight ? LOADINGSCREEN_NIGHTFOREST : LOADINGSCREEN_DAYFOREST;
|
||||
case TROPICS:
|
||||
case TROPICS_ROAD:
|
||||
case WATER:
|
||||
case NS_RIVER:
|
||||
case EW_RIVER:
|
||||
case COASTAL:
|
||||
case COASTAL_ROAD:
|
||||
return fNight ? LOADINGSCREEN_NIGHTTROPICAL : LOADINGSCREEN_DAYTROPICAL;
|
||||
default:
|
||||
Assert( 0 );
|
||||
return fNight ? LOADINGSCREEN_NIGHTGENERIC : LOADINGSCREEN_DAYGENERIC;
|
||||
}
|
||||
/* WANNE: Sir-Tech System */
|
||||
}
|
||||
#ifdef JA2UB
|
||||
|
||||
case 1:
|
||||
{
|
||||
switch( ubSectorID )
|
||||
{
|
||||
case SEC_I13:
|
||||
case SEC_J13:
|
||||
return fNight ? LOADINGSCREEN_MINE : LOADINGSCREEN_MINE;
|
||||
//tunnels
|
||||
case SEC_J14:
|
||||
case SEC_K14:
|
||||
return LOADINGSCREEN_TUNNELS;
|
||||
case SEC_K15:
|
||||
{
|
||||
if( gJa25SaveStruct.ubLoadScreenStairTraversal == LS__GOING_UP_STAIRS )
|
||||
return LOADINGSCREEN_UP_STAIRS;
|
||||
else if( gJa25SaveStruct.ubLoadScreenStairTraversal == LS__GOING_DOWN_STAIRS )
|
||||
return LOADINGSCREEN_DOWN_STAIRS;
|
||||
else
|
||||
return LOADINGSCREEN_COMPLEX_BASEMENT_GENERIC;
|
||||
}
|
||||
default:
|
||||
return LOADINGSCREEN_BASEMENT;
|
||||
}
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
switch( ubSectorID )
|
||||
{
|
||||
case SEC_K15:
|
||||
{
|
||||
//if we are going up stairs, else traversing at same level
|
||||
if( gJa25SaveStruct.ubLoadScreenStairTraversal == LS__GOING_UP_STAIRS )
|
||||
return LOADINGSCREEN_UP_STAIRS;
|
||||
else if( gJa25SaveStruct.ubLoadScreenStairTraversal == LS__GOING_DOWN_STAIRS )
|
||||
return LOADINGSCREEN_DOWN_STAIRS;
|
||||
else
|
||||
return LOADINGSCREEN_COMPLEX_BASEMENT;
|
||||
}
|
||||
case SEC_L15:
|
||||
{
|
||||
//if we are going up stairs, else traversing at same level
|
||||
if( gJa25SaveStruct.ubLoadScreenStairTraversal == LS__GOING_UP_STAIRS )
|
||||
return LOADINGSCREEN_UP_STAIRS;
|
||||
else
|
||||
return LOADINGSCREEN_COMPLEX_BASEMENT;
|
||||
}
|
||||
default:
|
||||
return LOADINGSCREEN_BASEMENT;
|
||||
}
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
switch( ubSectorID )
|
||||
{
|
||||
case SEC_L15:
|
||||
{
|
||||
//if we are going up stairs, else traversing at same level
|
||||
if( gJa25SaveStruct.ubLoadScreenStairTraversal == LS__GOING_DOWN_STAIRS )
|
||||
return LOADINGSCREEN_DOWN_STAIRS;
|
||||
else
|
||||
return LOADINGSCREEN_COMPLEX_BASEMENT_GENERIC;
|
||||
}
|
||||
default:
|
||||
return LOADINGSCREEN_CAVE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
return LOADINGSCREEN_CAVE;
|
||||
default:
|
||||
|
||||
/*
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
return LOADINGSCREEN_CAVE;
|
||||
break;
|
||||
return LOADINGSCREEN_CAVE;
|
||||
default:
|
||||
*/
|
||||
#else
|
||||
// Basement Level 1
|
||||
case 1:
|
||||
switch( ubSectorID )
|
||||
{
|
||||
case SEC_A10: //Miguel's basement
|
||||
case SEC_I13: //Alma prison dungeon
|
||||
case SEC_J9: //Tixa prison dungeon
|
||||
case SEC_K4: //Orta weapons plant
|
||||
case SEC_O3: //Meduna
|
||||
case SEC_P3: //Meduna
|
||||
return LOADINGSCREEN_BASEMENT;
|
||||
default: //rest are mines
|
||||
return LOADINGSCREEN_MINE;
|
||||
}
|
||||
// Basement Level 2 and 3
|
||||
case 2:
|
||||
case 3:
|
||||
//all level 2 and 3 maps are caves!
|
||||
return LOADINGSCREEN_CAVE;
|
||||
default:
|
||||
#endif
|
||||
// shouldn't ever happen
|
||||
Assert( FALSE );
|
||||
return fNight ? LOADINGSCREEN_NIGHTGENERIC : LOADINGSCREEN_DAYGENERIC;
|
||||
}
|
||||
|
||||
} /* WANNE: Sir-Tech System - END */
|
||||
}
|
||||
|
||||
static void BuildLoadscreenFilename(std::string& dst, const char* path, int resolution, const char* ext)
|
||||
{
|
||||
if (path)
|
||||
dst.append(path);
|
||||
|
||||
if (ext)
|
||||
{
|
||||
dst.append(".");
|
||||
dst.append(ext);
|
||||
}
|
||||
else
|
||||
// This might suck later on. If it does, remove it.
|
||||
dst.append(".sti");
|
||||
}
|
||||
|
||||
std::string GetResolutionSuffix(SCREEN_RESOLUTION resolution)
|
||||
{
|
||||
switch (resolution)
|
||||
{
|
||||
case _960x540: return "_960x540";
|
||||
case _800x600: return "_800x600";
|
||||
case _1024x600: return "_1024x600";
|
||||
case _1280x720: return "_1280x720";
|
||||
case _1024x768: return "_1024x768";
|
||||
case _1280x768: return "_1280x768";
|
||||
case _1360x768: return "_1360x768";
|
||||
case _1366x768: return "_1366x768";
|
||||
case _1280x800: return "_1280x800";
|
||||
case _1440x900: return "_1440x900";
|
||||
case _1600x900: return "_1600x900";
|
||||
case _1280x960: return "_1280x960";
|
||||
case _1440x960: return "_1440x960";
|
||||
case _1770x1000: return "_1770x1000";
|
||||
case _1280x1024: return "_1280x1024";
|
||||
case _1360x1024: return "_1360x1024";
|
||||
case _1600x1024: return "_1600x1024";
|
||||
case _1440x1050: return "_1440x1050";
|
||||
case _1680x1050: return "_1680x1050";
|
||||
case _1920x1080: return "_1920x1080";
|
||||
case _1600x1200: return "_1600x1200";
|
||||
case _1920x1200: return "_1920x1200";
|
||||
case _2560x1440: return "_2560x1440";
|
||||
case _2560x1600: return "_2560x1600";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
std::string FindBestFittingLoadscreenFilename(const std::string& baseName, SCREEN_RESOLUTION resolution)
|
||||
{
|
||||
for (SCREEN_RESOLUTION res = resolution; res <= _2560x1600; res = (SCREEN_RESOLUTION)(res + 1))
|
||||
{
|
||||
std::string fileName = baseName + GetResolutionSuffix(res);
|
||||
if (FileExists((CHAR8*)((fileName + ".png").c_str())))
|
||||
{
|
||||
return fileName + ".png";
|
||||
}
|
||||
|
||||
if (FileExists((CHAR8*)((fileName + ".sti").c_str())))
|
||||
{
|
||||
return fileName + ".sti";
|
||||
}
|
||||
}
|
||||
|
||||
if (FileExists((CHAR8*)((baseName + ".png").c_str())))
|
||||
{
|
||||
return baseName + ".png";
|
||||
}
|
||||
|
||||
return baseName + ".sti";
|
||||
}
|
||||
|
||||
//sets up the loadscreen with specified ID, and draws it to the FRAME_BUFFER,
|
||||
//and refreshing the screen with it.
|
||||
void DisplayLoadScreenWithID( UINT8 ubLoadScreenID )
|
||||
{
|
||||
VSURFACE_DESC vs_desc = {};
|
||||
HVSURFACE hVSurface;
|
||||
UINT32 uiLoadScreen;
|
||||
|
||||
vs_desc.fCreateFlags = VSURFACE_CREATE_FROMFILE | VSURFACE_SYSTEM_MEM_USAGE | VSURFACE_CREATE_FROMPNG_FALLBACK;
|
||||
|
||||
szSector = szSectorMap [gWorldSectorY][gWorldSectorX];
|
||||
const BOOLEAN fExternalLS = (szSector != NULL && strcmp(szSector, "N") != 0) && ((DAY <= ubLoadScreenID && ubLoadScreenID <= NIGHT_ALT) || (ubLoadScreenID == UNDERGROUND));
|
||||
|
||||
if (fExternalLS)
|
||||
{
|
||||
// Get the image path
|
||||
std::string imagePath;
|
||||
std::string imageFormat;
|
||||
|
||||
// Start screen
|
||||
if (ubLoadScreenID == HELI)
|
||||
{
|
||||
imagePath = gSectorLoadscreens[0].szDay;
|
||||
imageFormat = gSectorLoadscreens[0].szImageFormat;
|
||||
}
|
||||
else if (ubLoadScreenID == UNDERGROUND)
|
||||
{
|
||||
g_luaUnderground.GetLoadscreen(requestedX, requestedY, requestedZ, imagePath, imageFormat);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 1; i < MAX_SECTOR_LOADSCREENS; i++)
|
||||
{
|
||||
// We found the sector
|
||||
if (strcmp(gSectorLoadscreens[i].szLocation, szSector) == 0)
|
||||
{
|
||||
imageFormat = gSectorLoadscreens[i].szImageFormat;
|
||||
|
||||
BOOLEAN fAlternate = gSectorLoadscreens[i].RandomAltSector;
|
||||
|
||||
if (fAlternate && (Random(2) > 0))
|
||||
{
|
||||
if (strlen(gSectorLoadscreens[i].szImageFormatAlt) > 0)
|
||||
imageFormat = gSectorLoadscreens[i].szImageFormatAlt;
|
||||
switch (ubLoadScreenID)
|
||||
{
|
||||
case DAY:
|
||||
ubLoadScreenID = DAY_ALT;
|
||||
break;
|
||||
case NIGHT:
|
||||
ubLoadScreenID = NIGHT_ALT;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch (ubLoadScreenID)
|
||||
{
|
||||
case DAY:
|
||||
imagePath = gSectorLoadscreens[i].szDay;
|
||||
break;
|
||||
case DAY_ALT:
|
||||
imagePath = gSectorLoadscreens[i].szDayAlt;
|
||||
break;
|
||||
case NIGHT:
|
||||
imagePath = gSectorLoadscreens[i].szNight;
|
||||
break;
|
||||
case NIGHT_ALT:
|
||||
imagePath = gSectorLoadscreens[i].szNight;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::string strImage = FindBestFittingLoadscreenFilename(imagePath, (SCREEN_RESOLUTION)iResolution);
|
||||
strImage.copy(vs_desc.ImageFile, sizeof(vs_desc.ImageFile) - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string strImage("LOADSCREENS\\");
|
||||
|
||||
if (LOADINGSCREEN_NOTHING <= ubLoadScreenID && ubLoadScreenID <= LOADINGSCREEN_NIGHTBALIME)
|
||||
{
|
||||
BuildLoadscreenFilename(strImage, LoadScreenNames[ubLoadScreenID], 0, "sti");
|
||||
}
|
||||
else
|
||||
{
|
||||
// for some reason the heli screen is the default
|
||||
BuildLoadscreenFilename(strImage, LoadScreenNames[0], 0, "sti");
|
||||
}
|
||||
strImage.copy(vs_desc.ImageFile, sizeof(vs_desc.ImageFile)-1);
|
||||
}
|
||||
|
||||
|
||||
if( gfSchedulesHosed )
|
||||
{
|
||||
SetFont( FONT10ARIAL );
|
||||
SetFontForeground( FONT_YELLOW );
|
||||
SetFontShadow( FONT_NEARBLACK );
|
||||
ColorFillVideoSurfaceArea( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0 );
|
||||
mprintf( 5, 5, L"Error loading save, attempting to patch save to version 1.02...", vs_desc.ImageFile );
|
||||
}
|
||||
else
|
||||
{
|
||||
if (FileExists(vs_desc.ImageFile) && AddVideoSurface(&vs_desc, &uiLoadScreen))
|
||||
{
|
||||
SGPRect SrcRect, DstRect;
|
||||
|
||||
//Blit the background image
|
||||
GetVideoSurface(&hVSurface, uiLoadScreen);
|
||||
|
||||
fLoadingScreenAspectRatio = (FLOAT)hVSurface->usWidth / (FLOAT)hVSurface->usHeight;
|
||||
FLOAT fScreenAspectRatio = (FLOAT)SCREEN_WIDTH / (FLOAT)SCREEN_HEIGHT;
|
||||
|
||||
if (gGameExternalOptions.ubLoadscreenStretchMode == 1 ||
|
||||
(gGameExternalOptions.ubLoadscreenStretchMode == 2 && fLoadingScreenAspectRatio > fScreenAspectRatio))
|
||||
{
|
||||
// match height, preserve aspect ratio
|
||||
INT32 iCalculatedWidth = (INT32)(SCREEN_HEIGHT * fLoadingScreenAspectRatio + 0.5f);
|
||||
|
||||
SrcRect.iLeft = 0;
|
||||
SrcRect.iTop = 0;
|
||||
SrcRect.iRight = hVSurface->usWidth;
|
||||
SrcRect.iBottom = hVSurface->usHeight;
|
||||
|
||||
DstRect.iLeft = (SCREEN_WIDTH - iCalculatedWidth) / 2;
|
||||
DstRect.iTop = 0;
|
||||
DstRect.iRight = SCREEN_WIDTH - ((SCREEN_WIDTH - iCalculatedWidth) / 2);
|
||||
DstRect.iBottom = SCREEN_HEIGHT;
|
||||
}
|
||||
else
|
||||
{
|
||||
// vanilla (stretch to fit)
|
||||
// Stretch the background image
|
||||
SrcRect.iLeft = 0;
|
||||
SrcRect.iTop = 0;
|
||||
SrcRect.iRight = hVSurface->usWidth;
|
||||
SrcRect.iBottom = hVSurface->usHeight;
|
||||
|
||||
DstRect.iLeft = 0;
|
||||
DstRect.iTop = 0;
|
||||
DstRect.iRight = SCREEN_WIDTH;
|
||||
DstRect.iBottom = SCREEN_HEIGHT;
|
||||
}
|
||||
|
||||
BltStretchVideoSurface( FRAME_BUFFER, uiLoadScreen, 0, 0, 0, &SrcRect, &DstRect );
|
||||
|
||||
DeleteVideoSurfaceFromIndex( uiLoadScreen );
|
||||
}
|
||||
else
|
||||
{
|
||||
//Failed to load the file, so use a black screen and print out message.
|
||||
SetFont( FONT10ARIAL );
|
||||
SetFontForeground( FONT_YELLOW );
|
||||
SetFontShadow( FONT_NEARBLACK );
|
||||
ColorFillVideoSurfaceArea( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0 );
|
||||
mprintf( 5, 5, L"%S loadscreen data file not found...", vs_desc.ImageFile );
|
||||
}
|
||||
}
|
||||
|
||||
gubLastLoadingScreenID = ubLoadScreenID;
|
||||
InvalidateScreen( );
|
||||
ExecuteBaseDirtyRectQueue();
|
||||
EndFrameBufferRender();
|
||||
RefreshScreen( NULL );
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
#ifndef __LOADING_SCREEN_H
|
||||
#define __LOADING_SCREEN_H
|
||||
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
LOADINGSCREEN_NOTHING,
|
||||
LOADINGSCREEN_DAYGENERIC,
|
||||
LOADINGSCREEN_DAYTOWN1,
|
||||
LOADINGSCREEN_DAYTOWN2,
|
||||
LOADINGSCREEN_DAYWILD,
|
||||
LOADINGSCREEN_DAYTROPICAL,
|
||||
LOADINGSCREEN_DAYFOREST,
|
||||
LOADINGSCREEN_DAYDESERT,
|
||||
LOADINGSCREEN_DAYPALACE,
|
||||
LOADINGSCREEN_NIGHTGENERIC,
|
||||
LOADINGSCREEN_NIGHTWILD,
|
||||
LOADINGSCREEN_NIGHTTOWN1,
|
||||
LOADINGSCREEN_NIGHTTOWN2,
|
||||
LOADINGSCREEN_NIGHTFOREST,
|
||||
LOADINGSCREEN_NIGHTTROPICAL,
|
||||
LOADINGSCREEN_NIGHTDESERT,
|
||||
LOADINGSCREEN_NIGHTPALACE,
|
||||
LOADINGSCREEN_HELI,
|
||||
LOADINGSCREEN_BASEMENT,
|
||||
LOADINGSCREEN_MINE,
|
||||
LOADINGSCREEN_CAVE,
|
||||
LOADINGSCREEN_DAYPINE,
|
||||
LOADINGSCREEN_NIGHTPINE,
|
||||
LOADINGSCREEN_DAYMILITARY,
|
||||
LOADINGSCREEN_NIGHTMILITARY,
|
||||
LOADINGSCREEN_DAYSAM,
|
||||
LOADINGSCREEN_NIGHTSAM,
|
||||
LOADINGSCREEN_DAYPRISON,
|
||||
LOADINGSCREEN_NIGHTPRISON,
|
||||
LOADINGSCREEN_DAYHOSPITAL,
|
||||
LOADINGSCREEN_NIGHTHOSPITAL,
|
||||
LOADINGSCREEN_DAYAIRPORT,
|
||||
LOADINGSCREEN_NIGHTAIRPORT,
|
||||
LOADINGSCREEN_DAYLAB,
|
||||
LOADINGSCREEN_NIGHTLAB,
|
||||
LOADINGSCREEN_DAYOMERTA,
|
||||
LOADINGSCREEN_NIGHTOMERTA,
|
||||
LOADINGSCREEN_DAYCHITZENA,
|
||||
LOADINGSCREEN_NIGHTCHITZENA,
|
||||
LOADINGSCREEN_DAYMINE,
|
||||
LOADINGSCREEN_NIGHTMINE,
|
||||
LOADINGSCREEN_DAYBALIME,
|
||||
LOADINGSCREEN_NIGHTBALIME,
|
||||
DAY,
|
||||
NIGHT,
|
||||
HELI,
|
||||
DAY_ALT,
|
||||
NIGHT_ALT,
|
||||
UNDERGROUND,
|
||||
#ifdef JA2UB
|
||||
LOADINGSCREEN_HELI_CRASH,
|
||||
|
||||
LOADINGSCREEN_DAY_SNOW,
|
||||
LOADINGSCREEN_NIGHT_SNOW,
|
||||
|
||||
LOADINGSCREEN_GUARDPOST_DAY,
|
||||
LOADINGSCREEN_GUARDPOST_NIGHT,
|
||||
|
||||
LOADINGSCREEN_POWERPLANT_DAY,
|
||||
LOADINGSCREEN_POWERPLANT_NIGHT,
|
||||
|
||||
LOADINGSCREEN_DOWN_STAIRS,
|
||||
LOADINGSCREEN_UP_STAIRS,
|
||||
|
||||
LOADINGSCREEN_COMPLEX_BASEMENT,
|
||||
LOADINGSCREEN_COMPLEX_BASEMENT_GENERIC,
|
||||
|
||||
LOADINGSCREEN_COMPLEX_TOP_LEVEL_DAY,
|
||||
LOADINGSCREEN_COMPLEX_TOP_LEVEL_NIGHT,
|
||||
|
||||
LOADINGSCREEN_TUNNELS,
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
||||
//For use by the game loader, before it can possibly know the situation.
|
||||
extern UINT8 gubLastLoadingScreenID;
|
||||
|
||||
extern FLOAT fLoadingScreenAspectRatio;
|
||||
|
||||
//returns the UINT8 ID for the specified sector.
|
||||
UINT8 GetLoadScreenID( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ );
|
||||
|
||||
//sets up the loadscreen with specified ID, and draws it to the FRAME_BUFFER,
|
||||
//and refreshing the screen with it.
|
||||
void DisplayLoadScreenWithID( UINT8 ubLoadScreenID );
|
||||
|
||||
#define MAX_SECTOR_LOADSCREENS 257 // 16x16 + Start Sector
|
||||
#define MAX_LOCATION_CHARS 10
|
||||
#define MAX_IMAGE_FORMAT_CHARS 5
|
||||
#define MAX_IMAGE_PATH_CHARS 80
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UINT32 uiIndex;
|
||||
CHAR8 szLocation[MAX_LOCATION_CHARS];
|
||||
BOOLEAN RandomAltSector;
|
||||
CHAR8 szImageFormat[MAX_IMAGE_FORMAT_CHARS];
|
||||
CHAR8 szDay[MAX_IMAGE_PATH_CHARS];
|
||||
CHAR8 szNight[MAX_IMAGE_PATH_CHARS];
|
||||
CHAR8 szDayAlt[MAX_IMAGE_PATH_CHARS];
|
||||
CHAR8 szNightAlt[MAX_IMAGE_PATH_CHARS];
|
||||
CHAR8 szImageFormatAlt[MAX_IMAGE_FORMAT_CHARS];
|
||||
} SECTOR_LOADSCREENS;
|
||||
|
||||
extern SECTOR_LOADSCREENS gSectorLoadscreens[MAX_SECTOR_LOADSCREENS];
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,29 @@
|
||||
#ifndef _MP_CHAT_SCREEN_H_
|
||||
#define _MP_CHAT_SCREEN_H_
|
||||
|
||||
#include "MessageBoxScreen.h"
|
||||
|
||||
UINT32 MPChatScreenInit( void );
|
||||
UINT32 MPChatScreenHandle( void );
|
||||
UINT32 MPChatScreenShutdown( void );
|
||||
|
||||
extern CHAR16 gszChatBoxInputString[255];
|
||||
extern BOOLEAN gbChatSendToAll;
|
||||
extern MESSAGE_BOX_STRUCT gChatBox;
|
||||
extern BOOLEAN gfInChatBox;
|
||||
|
||||
#define CHAT_FONT_COLOR 208 // WHITE
|
||||
|
||||
////////////////////////////////
|
||||
// ubStyle: Determines the look of graphics including buttons
|
||||
// zString: 16-bit string
|
||||
// uiExitScreen The screen to exit to
|
||||
// ubFlags Some flags for button style
|
||||
// ReturnCallback Callback for return. Can be NULL. Returns any above return value
|
||||
// pCenteringRect Rect to send if MSG_BOX_FLAG_USE_CENTERING_RECT set. Can be NULL
|
||||
////////////////////////////////
|
||||
|
||||
INT32 DoChatBox( bool bIncludeChatLog, const STR16 zString, UINT32 uiExitScreen, MSGBOX_CALLBACK ReturnCallback, SGPRect *pCenteringRect );
|
||||
void ChatLogMessage( UINT16 usColor, UINT8 ubPriority, STR16 pStringA, ...);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,551 @@
|
||||
#include "Types.h"
|
||||
#include "MPConnectScreen.h"
|
||||
#include "GameSettings.h"
|
||||
#include "Utilities.h"
|
||||
#include "wCheck.h"
|
||||
#include "Font Control.h"
|
||||
#include "WordWrap.h"
|
||||
#include "Render Dirty.h"
|
||||
#include "Input.h"
|
||||
#include "Options Screen.h"
|
||||
#include "English.h"
|
||||
#include "Sysutil.h"
|
||||
#include "Fade Screen.h"
|
||||
#include "Cursor Control.h"
|
||||
#include "Music Control.h"
|
||||
#include "cursors.h"
|
||||
#include "Text.h"
|
||||
#include "Text Input.h"
|
||||
#include "Soldier Profile.h"
|
||||
#include "Animated ProgressBar.h"
|
||||
#include "mainmenuscreen.h"
|
||||
|
||||
#include "gameloop.h"
|
||||
#include "Game Init.h"
|
||||
#include "connect.h"
|
||||
#include "network.h" // for client name
|
||||
#include "message.h"
|
||||
#include "init.h"
|
||||
#include "xml.h"
|
||||
|
||||
|
||||
////////////////////////////////////////////
|
||||
//
|
||||
// Global Defines
|
||||
//
|
||||
///////////////////////////////////////////
|
||||
|
||||
#define MPC_TITLE_FONT FONT14ARIAL//FONT16ARIAL
|
||||
#define MPC_TITLE_COLOR FONT_MCOLOR_WHITE
|
||||
|
||||
#define MPC_SUBHEADING_FONT FONT12ARIAL//FONT16ARIAL
|
||||
#define MPC_SUBHEADING_COLOR FONT_MCOLOR_WHITE
|
||||
|
||||
//buttons
|
||||
#define MPC_BTN_CANCEL_X iScreenWidthOffset + ((320 - 115) / 2)
|
||||
#define MPC_BTN_CANCEL_Y iScreenHeightOffset + SCREEN_HEIGHT - 50
|
||||
|
||||
//main title
|
||||
#define MPC_MAIN_TITLE_X 0
|
||||
#define MPC_MAIN_TITLE_Y iScreenHeightOffset + 10
|
||||
#define MPC_MAIN_TITLE_WIDTH SCREEN_WIDTH
|
||||
|
||||
//subtitle
|
||||
#define MPC_SUBHEADING_X 0
|
||||
#define MPC_SUBHEADING_Y MPC_MAIN_TITLE_Y + 30
|
||||
#define MPC_SUBHEADING_WIDTH SCREEN_WIDTH
|
||||
|
||||
//help
|
||||
#define MPC_HELP_X 0
|
||||
#define MPC_HELP_Y MPC_SUBHEADING_Y + 30
|
||||
#define MPC_HELP_WIDTH SCREEN_WIDTH
|
||||
|
||||
|
||||
////////////////////////////////////////////
|
||||
//
|
||||
// Global Variables
|
||||
//
|
||||
///////////////////////////////////////////
|
||||
|
||||
BOOLEAN gfMPCScreenEntry = TRUE;
|
||||
BOOLEAN gfMPCScreenExit = FALSE;
|
||||
BOOLEAN gfReRenderMPCScreen=TRUE;
|
||||
BOOLEAN gfMPCButtonsAllocated = FALSE;
|
||||
BOOLEAN gfMPConnectScreenCanContinue = FALSE;
|
||||
|
||||
//enum for different states of screen
|
||||
enum
|
||||
{
|
||||
MPC_NOTHING,
|
||||
MPC_CANCEL,
|
||||
MPC_CONTINUE,
|
||||
};
|
||||
|
||||
UINT8 gubMPCScreenHandler=MPC_NOTHING; // State changer for HandleMPCNScreen()
|
||||
|
||||
UINT32 gubMPCExitScreen = MP_CONNECT_SCREEN; // The screen that is in control next iteration of the game_loop
|
||||
|
||||
UINT8 loadscreenID = 0;
|
||||
|
||||
////////////////////////////////////////////
|
||||
//
|
||||
// Screen Controls
|
||||
//
|
||||
///////////////////////////////////////////
|
||||
|
||||
// Cancel Button
|
||||
void BtnMPCCancelCallback(GUI_BUTTON *btn,INT32 reason);
|
||||
UINT32 guiMPCCancelButton;
|
||||
INT32 giMPCCancelBtnImage;
|
||||
|
||||
UINT32 guiMPCMainBackGroundImage;
|
||||
|
||||
// Message Box handle
|
||||
INT8 giMPCMessageBox = -1;
|
||||
|
||||
// connect screen message
|
||||
CHAR16 gszConnectHeadingMsg[512];
|
||||
CHAR16 gszConnectSubMsg[512];
|
||||
|
||||
////////////////////////////////////////////
|
||||
//
|
||||
// Local Function Prototypes
|
||||
//
|
||||
///////////////////////////////////////////
|
||||
|
||||
extern void ClearMainMenu();
|
||||
|
||||
BOOLEAN EnterMPCScreen();
|
||||
BOOLEAN ExitMPCScreen();
|
||||
void HandleMPCScreen();
|
||||
BOOLEAN RenderMPCScreen();
|
||||
|
||||
void GetMPCScreenUserInput();
|
||||
void DoneFadeOutForExitMPCScreen( void );
|
||||
void DoneFadeInForExitMPCScreen( void );
|
||||
void CheckForContinue();
|
||||
|
||||
|
||||
UINT32 MPConnectScreenInit( void )
|
||||
{
|
||||
return (1);
|
||||
}
|
||||
|
||||
UINT32 MPConnectScreenHandle( void )
|
||||
{
|
||||
StartFrameBufferRender();
|
||||
|
||||
RestoreBackgroundRects( );
|
||||
|
||||
if( gfMPCScreenEntry )
|
||||
{
|
||||
// PauseGame();
|
||||
|
||||
EnterMPCScreen();
|
||||
gfMPCScreenEntry = FALSE;
|
||||
gfMPCScreenExit = FALSE;
|
||||
InvalidateRegion( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT );
|
||||
}
|
||||
|
||||
// add scrolling string log
|
||||
ScrollString( );
|
||||
|
||||
|
||||
GetMPCScreenUserInput();
|
||||
|
||||
// connect to the server
|
||||
NetworkAutoStart();
|
||||
|
||||
// Check if we need to leave this screen
|
||||
CheckForContinue();
|
||||
|
||||
HandleMPCScreen();
|
||||
|
||||
// draw chat texts
|
||||
ExecuteVideoOverlays( );
|
||||
|
||||
SaveBackgroundRects();
|
||||
//InvalidateScreen();
|
||||
|
||||
ExecuteBaseDirtyRectQueue();
|
||||
EndFrameBufferRender();
|
||||
|
||||
// handle fades in and out
|
||||
if ( HandleFadeOutCallback( ) )
|
||||
{
|
||||
ClearMainMenu();
|
||||
return( gubMPCExitScreen );
|
||||
}
|
||||
|
||||
if ( HandleBeginFadeOut( gubMPCExitScreen ) )
|
||||
{
|
||||
return( gubMPCExitScreen );
|
||||
}
|
||||
|
||||
if ( HandleFadeInCallback( ) )
|
||||
{
|
||||
// Re-render the scene!
|
||||
RenderMPCScreen();
|
||||
}
|
||||
|
||||
if ( HandleBeginFadeIn( gubMPCExitScreen ) )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
if( gfMPCScreenExit ) // we are exiting this screen
|
||||
{
|
||||
ExitMPCScreen(); // perform destruction
|
||||
}
|
||||
|
||||
return( gubMPCExitScreen );
|
||||
} // end MPScoreScreenHandle()
|
||||
|
||||
UINT32 MPConnectScreenShutdown( void )
|
||||
{
|
||||
return( 1 );
|
||||
}
|
||||
|
||||
BOOLEAN EnterMPCScreen()
|
||||
{
|
||||
// make sure only chat messages show up on connect screen
|
||||
ClearTacticalMessageQueue( );
|
||||
SetTacticalMessageFilter( MSG_CHAT );
|
||||
|
||||
gfMPConnectScreenCanContinue = FALSE;
|
||||
|
||||
VOBJECT_DESC VObjectDesc;
|
||||
|
||||
if( gfMPCButtonsAllocated )
|
||||
return( TRUE );
|
||||
|
||||
SetCurrentCursorFromDatabase( CURSOR_NORMAL );
|
||||
|
||||
// load the Main trade screen backgroiund image
|
||||
VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE;
|
||||
if (iResolution >= _640x480 && iResolution < _800x600)
|
||||
FilenameForBPP("INTERFACE\\MPConnect.sti",VObjectDesc.ImageFile);
|
||||
else if (iResolution < _1024x768)
|
||||
FilenameForBPP("INTERFACE\\MPConnect_800x600.sti",VObjectDesc.ImageFile);
|
||||
else
|
||||
FilenameForBPP("INTERFACE\\MPConnect_1024x768.sti", VObjectDesc.ImageFile);
|
||||
|
||||
|
||||
CHECKF(AddVideoObject(&VObjectDesc, &guiMPCMainBackGroundImage ));
|
||||
|
||||
|
||||
CreateLoadingScreenProgressBar(TRUE);
|
||||
// default to red connecting color
|
||||
SetProgressBarColor(0,150,0,0);
|
||||
SetRelativeStartAndEndPercentage(0,0,100,L"");
|
||||
|
||||
//Cancel button
|
||||
/*giMPCCancelBtnImage = LoadButtonImage("INTERFACE\\PreferencesButtons.sti", -1,0,-1,2,-1 );
|
||||
guiMPCCancelButton = CreateIconAndTextButton( giMPCCancelBtnImage, gzMPCScreenText[MPC_CANCEL_TEXT], OPT_BUTTON_FONT,
|
||||
OPT_BUTTON_ON_COLOR, DEFAULT_SHADOW,
|
||||
OPT_BUTTON_OFF_COLOR, DEFAULT_SHADOW,
|
||||
TEXT_CJUSTIFIED,
|
||||
MPC_BTN_CANCEL_X, MPC_BTN_CANCEL_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH,
|
||||
DEFAULT_MOVE_CALLBACK, BtnMPCCancelCallback);
|
||||
|
||||
SpecifyButtonSoundScheme( guiMPCCancelButton, BUTTON_SOUND_SCHEME_BIGSWITCH3 );
|
||||
SpecifyDisabledButtonStyle( guiMPCCancelButton, DISABLED_STYLE_NONE );*/
|
||||
|
||||
//Reset the exit screen - screen the main game loop will call next iteration
|
||||
gubMPCExitScreen = MP_CONNECT_SCREEN;
|
||||
|
||||
//REnder the screen once so we can blt ot to ths save buffer
|
||||
RenderMPCScreen();
|
||||
|
||||
BlitBufferToBuffer(guiRENDERBUFFER, guiSAVEBUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT );
|
||||
|
||||
gfMPCButtonsAllocated = TRUE;
|
||||
|
||||
return( TRUE );
|
||||
|
||||
} // End of EnterMPSScreen()
|
||||
|
||||
|
||||
BOOLEAN ExitMPCScreen()
|
||||
{
|
||||
RemoveTacticalMessageFilter();
|
||||
|
||||
if( !gfMPCButtonsAllocated )
|
||||
return( TRUE );
|
||||
|
||||
//Delete the main options screen background
|
||||
DeleteVideoObjectFromIndex( guiMPCMainBackGroundImage );
|
||||
RemoveProgressBar(0);
|
||||
|
||||
//RemoveButton( guiMPCCancelButton );
|
||||
//UnloadButtonImage( giMPCCancelBtnImage );
|
||||
|
||||
// exit text input mode in this screen and clean up text boxes
|
||||
//KillAllTextInputModes();
|
||||
SetTextInputCursor( CURSOR_IBEAM );
|
||||
|
||||
gfMPCButtonsAllocated = FALSE;
|
||||
|
||||
//If we are starting the game stop playing the music
|
||||
if( gubMPCScreenHandler == MPC_CONTINUE )
|
||||
SetMusicMode( MUSIC_NONE );
|
||||
|
||||
gfMPCScreenExit = FALSE;
|
||||
gfMPCScreenEntry = TRUE;
|
||||
|
||||
return( TRUE );
|
||||
|
||||
} // End of ExitMPJScreen()
|
||||
|
||||
|
||||
void HandleMPCScreen()
|
||||
{
|
||||
if( gubMPCScreenHandler != MPC_NOTHING )
|
||||
{
|
||||
switch( gubMPCScreenHandler )
|
||||
{
|
||||
case MPC_CANCEL:
|
||||
gubMPCExitScreen = MP_JOIN_SCREEN;
|
||||
gfMPCScreenExit = TRUE;
|
||||
|
||||
// disconnect the client
|
||||
client_disconnect();
|
||||
break;
|
||||
|
||||
case MPC_CONTINUE:
|
||||
{
|
||||
//if we are already fading out, get out of here
|
||||
if( gFadeOutDoneCallback != DoneFadeOutForExitMPCScreen )
|
||||
{
|
||||
//Disable the ok button
|
||||
DisableButton( guiMPCCancelButton );
|
||||
|
||||
gFadeOutDoneCallback = DoneFadeOutForExitMPCScreen;
|
||||
|
||||
FadeOutNextFrame( );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
gubMPCScreenHandler = MPC_NOTHING;
|
||||
}
|
||||
|
||||
if( gfReRenderMPCScreen )
|
||||
{
|
||||
RenderMPCScreen();
|
||||
gfReRenderMPCScreen = FALSE;
|
||||
}
|
||||
|
||||
} // end of HandleMPCScreen
|
||||
|
||||
|
||||
BOOLEAN RenderMPCScreen()
|
||||
{
|
||||
HVOBJECT hPixHandle;
|
||||
|
||||
//Get the main background screen graphic and blt it
|
||||
GetVideoObject(&hPixHandle, guiMPCMainBackGroundImage );
|
||||
|
||||
BltVideoObject(FRAME_BUFFER, hPixHandle, 0,(SCREEN_WIDTH - xResSize)/2,(SCREEN_HEIGHT - yResSize)/2, VO_BLT_SRCTRANSPARENCY,NULL);
|
||||
|
||||
//Shade the background
|
||||
//ShadowVideoSurfaceRect( FRAME_BUFFER, iScreenWidthOffset, iScreenHeightOffset, iScreenWidthOffset + 640, iScreenHeightOffset + 480 );
|
||||
|
||||
UINT8 iProgress = 0;
|
||||
|
||||
if (is_connecting)
|
||||
{
|
||||
iProgress = (UINT8)(100 * (float)((MAX_CONNECT_RETRIES-(float)giNumTries)/MAX_CONNECT_RETRIES));
|
||||
SetProgressBarColor(0,150,0,0);
|
||||
|
||||
SetConnectScreenHeadingW(gzMPCScreenText[ MPC_CONNECTING_TEXT ]);
|
||||
}
|
||||
else if (is_connected)
|
||||
{
|
||||
if (!recieved_settings && !recieved_transfer_settings)
|
||||
{
|
||||
//Display the title
|
||||
SetConnectScreenHeadingW( gzMPCScreenText[ MPC_GETSETTINGS_TEXT ]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (serverSyncClientsDirectory==1)
|
||||
{
|
||||
SetConnectScreenHeadingW( gzMPCScreenText[ MPC_DOWNLOADING_TEXT ]);
|
||||
SetProgressBarColor(0,0,0,150);
|
||||
iProgress = client_progress[CLIENT_NUM-1];
|
||||
}
|
||||
else
|
||||
{
|
||||
SetConnectScreenHeadingW( gzMPCScreenText[ MPC_READY_TEXT ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Display the title
|
||||
DrawTextToScreen( gszConnectHeadingMsg, MPC_MAIN_TITLE_X, MPC_MAIN_TITLE_Y, MPC_MAIN_TITLE_WIDTH, MPC_TITLE_FONT, MPC_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED );
|
||||
InvalidateRegion(MPC_MAIN_TITLE_X,MPC_MAIN_TITLE_Y,MPC_MAIN_TITLE_WIDTH,MPC_MAIN_TITLE_Y+20);
|
||||
//Display the subheading
|
||||
DrawTextToScreen( gszConnectSubMsg, MPC_SUBHEADING_X, MPC_SUBHEADING_Y, MPC_SUBHEADING_WIDTH, MPC_SUBHEADING_FONT, MPC_SUBHEADING_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED );
|
||||
InvalidateRegion(MPC_SUBHEADING_X,MPC_SUBHEADING_Y,MPC_MAIN_TITLE_WIDTH,MPC_SUBHEADING_Y+20);
|
||||
//Display the help text
|
||||
DrawTextToScreen( (is_connected && recieved_settings ? gzMPCScreenText[ MPC_HELP1_TEXT ] : gzMPCScreenText[MPC_HELP2_TEXT] ), MPC_HELP_X, MPC_HELP_Y, MPC_HELP_WIDTH, MPC_SUBHEADING_FONT, MPC_SUBHEADING_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED );
|
||||
InvalidateRegion(MPC_HELP_X,MPC_HELP_Y,MPC_HELP_WIDTH,MPC_HELP_Y+20);
|
||||
|
||||
SetProgressBarRenderBuffer(0,FRAME_BUFFER);
|
||||
RenderProgressBar(0,iProgress);
|
||||
|
||||
return( TRUE );
|
||||
} // end of RenderMPCScreen()
|
||||
|
||||
|
||||
|
||||
void GetMPCScreenUserInput()
|
||||
{
|
||||
InputAtom Event;
|
||||
// POINT MousePos;
|
||||
|
||||
// GetCursorPos(&MousePos);
|
||||
|
||||
while (DequeueSpecificEvent(&Event, KEY_DOWN|KEY_UP|KEY_REPEAT))
|
||||
{
|
||||
// check if this event is swallowed by text input, otherwise process key
|
||||
if( Event.usEvent == KEY_DOWN )
|
||||
{
|
||||
switch( Event.usParam )
|
||||
{
|
||||
|
||||
case ESC:
|
||||
//Exit out of the screen
|
||||
gubMPCScreenHandler = MPC_CANCEL;
|
||||
break;
|
||||
case 'y':
|
||||
if (is_connected && recieved_settings)
|
||||
OpenChatMsgBox();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} // end of GetMPCScreenUserInput()
|
||||
|
||||
void DoneFadeOutForExitMPCScreen( void )
|
||||
{
|
||||
// ------------------------------------------
|
||||
// Now Initialize the client again with all the files from the "_MULTIPLAYER" profile!!!
|
||||
LoadExternalGameplayData(TABLEDATA_DIRECTORY, true);
|
||||
LoadAllExternalText();
|
||||
InitDependingGameStyleOptions();
|
||||
InitNewGame(false);
|
||||
|
||||
// Overwrite some client settings with values from the server (cash, ...)
|
||||
reapplySETTINGS();
|
||||
// ------------------------------------------
|
||||
|
||||
gubMPCExitScreen = MAP_SCREEN;
|
||||
ExitMPCScreen(); // cleanup please, if we called a fadeout then we didnt do it above
|
||||
SetCurrentCursorFromDatabase( VIDEO_NO_CURSOR );
|
||||
}
|
||||
|
||||
void DoneFadeInForExitMPCScreen( void )
|
||||
{
|
||||
SetCurrentCursorFromDatabase( VIDEO_NO_CURSOR );
|
||||
}
|
||||
|
||||
void BtnMPCCancelCallback(GUI_BUTTON *btn,INT32 reason)
|
||||
{
|
||||
if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN )
|
||||
{
|
||||
btn->uiFlags |= BUTTON_CLICKED_ON;
|
||||
InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY);
|
||||
}
|
||||
if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
|
||||
{
|
||||
btn->uiFlags &= (~BUTTON_CLICKED_ON );
|
||||
|
||||
gubMPCScreenHandler = MPC_CANCEL;
|
||||
|
||||
InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void SetConnectScreenHeadingW( STR16 cmsg )
|
||||
{
|
||||
wcscpy(gszConnectHeadingMsg,cmsg);
|
||||
gfReRenderMPCScreen=TRUE;
|
||||
}
|
||||
|
||||
void SetConnectScreenHeadingA( const char* cmsg )
|
||||
{
|
||||
CHAR16 converted[512];
|
||||
MultiByteToWideChar( CP_UTF8, 0, cmsg, -1, (LPWSTR)converted, 512);
|
||||
SetConnectScreenHeadingW( converted );
|
||||
}
|
||||
|
||||
void SetConnectScreenSubMessageW( STR16 cmsg )
|
||||
{
|
||||
wcscpy(gszConnectSubMsg,cmsg);
|
||||
gfReRenderMPCScreen=TRUE;
|
||||
}
|
||||
|
||||
void SetConnectScreenSubMessageA( const char* cmsg )
|
||||
{
|
||||
CHAR16 converted[512];
|
||||
MultiByteToWideChar( CP_UTF8, 0, cmsg, -1, (LPWSTR)converted, 512);
|
||||
SetConnectScreenSubMessageW( converted );
|
||||
}
|
||||
|
||||
void CheckForContinue()
|
||||
{
|
||||
if (is_connected && is_client && recieved_settings)
|
||||
{
|
||||
if (serverSyncClientsDirectory == 1)
|
||||
{
|
||||
if (fClientReceivedAllFiles)
|
||||
gubMPCScreenHandler = MPC_CONTINUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
gubMPCScreenHandler = MPC_CONTINUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include <vfs/Core/vfs_os_functions.h>
|
||||
#include <vfs/Core/vfs_profile.h>
|
||||
#include <vfs/Core/vfs.h>
|
||||
#include <vfs/Core/vfs_init.h>
|
||||
#include <memory>
|
||||
|
||||
void ja2::mp::InitializeMultiplayerProfile(vfs::Path const& profileRoot)
|
||||
{
|
||||
// does the profile root directory actually exist
|
||||
if(!vfs::OS::checkRealDirectory(profileRoot))
|
||||
{
|
||||
// OK, directory did not exist, probably a new profile
|
||||
SGP_THROW_IFFALSE( vfs::OS::createRealDirectory(profileRoot),
|
||||
_BS(L"Could not create directory : ") << profileRoot << _BS::wget );
|
||||
}
|
||||
|
||||
// create and initialize a new Multiplayer profile
|
||||
std::unique_ptr<vfs::CVirtualProfile> pProf( new vfs::CVirtualProfile("_MULTIPLAYER",profileRoot,true) );
|
||||
|
||||
if(!vfs_init::initWriteProfile(*pProf))
|
||||
{
|
||||
SGP_THROW(_BS(L"Could not initialize client profile") << profileRoot << _BS::wget);
|
||||
}
|
||||
|
||||
vfs::CProfileStack *PS = getVFS()->getProfileStack();
|
||||
|
||||
// remove old Multiplayer profile (if it exists)
|
||||
vfs::CVirtualProfile *pOldProf = PS->getProfile("_MULTIPLAYER");
|
||||
if( pOldProf && (pOldProf == PS->topProfile()) )
|
||||
{
|
||||
SGP_THROW_IFFALSE(PS->popProfile(), L"Could not remove old \"_MULTIPLAYER\" profile");
|
||||
}
|
||||
|
||||
// add new profile
|
||||
PS->pushProfile(pProf.release());
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
#ifndef _MP_CONNECT_SCREEN_H_
|
||||
#define _MP_CONNECT_SCREEN_H_
|
||||
|
||||
|
||||
UINT32 MPConnectScreenInit( void );
|
||||
UINT32 MPConnectScreenHandle( void );
|
||||
UINT32 MPConnectScreenShutdown( void );
|
||||
|
||||
void SetConnectScreenHeadingW( STR16 cmsg );
|
||||
void SetConnectScreenHeadingA( const char* cmsg );
|
||||
void SetConnectScreenSubMessageW( STR16 cmsg );
|
||||
void SetConnectScreenSubMessageA( const char* cmsg );
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,12 @@
|
||||
#ifndef _MP_HOST_SCREEN_H_
|
||||
#define _MP_HOST_SCREEN_H_
|
||||
|
||||
|
||||
UINT32 MPHostScreenInit( void );
|
||||
UINT32 MPHostScreenHandle( void );
|
||||
UINT32 MPHostScreenShutdown( void );
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,797 @@
|
||||
#include "Types.h"
|
||||
#include "MPJoinScreen.h"
|
||||
#include "GameSettings.h"
|
||||
#include "Utilities.h"
|
||||
#include "wCheck.h"
|
||||
#include "Font Control.h"
|
||||
#include "WordWrap.h"
|
||||
#include "Render Dirty.h"
|
||||
#include "Input.h"
|
||||
#include "Options Screen.h"
|
||||
#include "English.h"
|
||||
#include "Sysutil.h"
|
||||
#include "Fade Screen.h"
|
||||
#include "Cursor Control.h"
|
||||
#include "cursors.h"
|
||||
#include "Text.h"
|
||||
#include "Text Input.h"
|
||||
#include "Soldier Profile.h"
|
||||
|
||||
#include "gameloop.h"
|
||||
#include "connect.h"
|
||||
#include "network.h" // for client name
|
||||
#include "saveloadscreen.h"
|
||||
#include "game init.h"
|
||||
|
||||
#include <vfs/Core/vfs.h>
|
||||
#include <vfs/Core/vfs_init.h>
|
||||
#include <vfs/Tools/vfs_property_container.h>
|
||||
#include <vfs/Core/vfs_os_functions.h>
|
||||
|
||||
#include "Random.h"
|
||||
|
||||
////////////////////////////////////////////
|
||||
//
|
||||
// Global Defines
|
||||
//
|
||||
///////////////////////////////////////////
|
||||
|
||||
#define MPJ_TITLE_FONT FONT14ARIAL//FONT16ARIAL
|
||||
#define MPJ_TITLE_COLOR FONT_MCOLOR_WHITE
|
||||
|
||||
#define MPJ_LABEL_TEXT_FONT FONT12ARIAL//FONT16ARIAL
|
||||
#define MPJ_LABEL_TEXT_COLOR FONT_MCOLOR_WHITE
|
||||
|
||||
//buttons
|
||||
#define MPJ_CANCEL_X iScreenWidthOffset + ((320 - 115) / 2)
|
||||
|
||||
#define MPJ_BTN_HOST_X iScreenWidthOffset + 265
|
||||
#define MPJ_BTN_HOST_Y iScreenHeightOffset + 435
|
||||
|
||||
#define MPJ_BTN_JOIN_X iScreenWidthOffset + 425
|
||||
#define MPJ_BTN_JOIN_Y iScreenHeightOffset + 435
|
||||
|
||||
//textboxes
|
||||
#define MPJ_TXT_HANDLE_X iScreenWidthOffset + 100
|
||||
#define MPJ_TXT_HANDLE_Y iScreenHeightOffset + 100
|
||||
#define MPJ_TXT_HANDLE_WIDTH 120
|
||||
#define MPJ_TXT_HANDLE_HEIGHT 17
|
||||
#define MPJ_TXT_IP_X iScreenWidthOffset + 100
|
||||
#define MPJ_TXT_IP_Y iScreenHeightOffset + 400
|
||||
#define MPJ_TXT_IP_WIDTH 100
|
||||
#define MPJ_TXT_IP_HEIGHT 17
|
||||
#define MPJ_TXT_PORT_X MPJ_TXT_IP_X + MPJ_TXT_IP_WIDTH + 40
|
||||
#define MPJ_TXT_PORT_Y iScreenHeightOffset + 400
|
||||
#define MPJ_TXT_PORT_WIDTH 40
|
||||
#define MPJ_TXT_PORT_HEIGHT 17
|
||||
|
||||
|
||||
//main title
|
||||
#define MPJ_MAIN_TITLE_X 0
|
||||
#define MPJ_MAIN_TITLE_Y iScreenHeightOffset + 10
|
||||
#define MPJ_MAIN_TITLE_WIDTH SCREEN_WIDTH
|
||||
|
||||
//labels
|
||||
#define MPJ_LABEL_HANDLE_X MPJ_TXT_HANDLE_X - 80
|
||||
#define MPJ_LABEL_HANDLE_Y MPJ_TXT_HANDLE_Y + 3
|
||||
#define MPJ_LABEL_HANDLE_WIDTH 80
|
||||
#define MPJ_LABEL_HANDLE_HEIGHT 17
|
||||
#define MPJ_LABEL_IP_X MPJ_TXT_IP_X - 80
|
||||
#define MPJ_LABEL_IP_Y MPJ_TXT_IP_Y + 3
|
||||
#define MPJ_LABEL_IP_WIDTH 80
|
||||
#define MPJ_LABEL_IP_HEIGHT 17
|
||||
#define MPJ_LABEL_PORT_X MPJ_TXT_PORT_X - 30
|
||||
#define MPJ_LABEL_PORT_Y MPJ_TXT_PORT_Y + 3
|
||||
#define MPJ_LABEL_PORT_WIDTH 80
|
||||
#define MPJ_LABEL_PORT_HEIGHT 17
|
||||
|
||||
////////////////////////////////////////////
|
||||
//
|
||||
// Global Variables
|
||||
//
|
||||
///////////////////////////////////////////
|
||||
|
||||
BOOLEAN gfMPJScreenEntry = TRUE;
|
||||
BOOLEAN gfMPJScreenExit = FALSE;
|
||||
BOOLEAN gfReRenderMPJScreen=TRUE;
|
||||
BOOLEAN gfMPJButtonsAllocated = FALSE;
|
||||
|
||||
//enum for different states of screen
|
||||
enum
|
||||
{
|
||||
MPJ_NOTHING,
|
||||
MPJ_CANCEL,
|
||||
MPJ_EXIT,
|
||||
MPJ_HOST,
|
||||
MPJ_JOIN
|
||||
};
|
||||
|
||||
UINT8 gubMPJScreenHandler=MPJ_NOTHING; // State changer for HandleMPJScreen()
|
||||
|
||||
UINT32 gubMPJExitScreen = MP_JOIN_SCREEN; // The screen that is in control next iteration of the game_loop
|
||||
|
||||
UINT32 guiMPJMainBackGroundImage;
|
||||
|
||||
// Wide-char strings that will hold the variables until they are transferred to the CHAR ascii fields
|
||||
CHAR16 gzPlayerHandleField[ 10+1 ] = {0} ;
|
||||
CHAR16 gzServerIPField[ 15+1 ] = {0} ;
|
||||
CHAR16 gzServerPortField[ 5+1 ] = {0} ;
|
||||
|
||||
// client sets this when joining
|
||||
extern CHAR16 gzFileTransferDirectory[100];
|
||||
|
||||
|
||||
void CUniqueServerId::uniqueRandomString(vfs::String& str)
|
||||
{
|
||||
std::vector<wchar_t> _rand(30,0);
|
||||
int pos = 0;
|
||||
for(int block = 0; block < 5; ++block)
|
||||
{
|
||||
for(int i=0; i<5; ++i)
|
||||
{
|
||||
int r = Random(36);
|
||||
if(r < 10)
|
||||
{
|
||||
r += L'0';
|
||||
}
|
||||
else
|
||||
{
|
||||
r += L'A' - 10;
|
||||
}
|
||||
_rand[pos++] = r;
|
||||
}
|
||||
_rand[pos++] = L'-';
|
||||
}
|
||||
str.r_wcs().assign(&_rand[0],29);
|
||||
}
|
||||
|
||||
vfs::String const& CUniqueServerId::getServerId(vfs::Path dir, vfs::PropertyContainer* props)
|
||||
{
|
||||
if(!props)
|
||||
{
|
||||
return _id;
|
||||
}
|
||||
vfs::String key = L"\"" + dir.c_wcs() + L"\"";
|
||||
vfs::String id = props->getStringProperty(JA2MP_INI_SERVER_SECTION,key);
|
||||
if(id.empty())
|
||||
{
|
||||
uniqueRandomString(id);
|
||||
}
|
||||
_id = id;
|
||||
props->setStringProperty(JA2MP_INI_SERVER_SECTION,key,_id);
|
||||
return _id;
|
||||
}
|
||||
|
||||
CUniqueServerId s_ServerId;
|
||||
|
||||
////////////////////////////////////////////
|
||||
//
|
||||
// Screen Controls
|
||||
//
|
||||
///////////////////////////////////////////
|
||||
|
||||
// Join Button
|
||||
void BtnMPJoinCallback(GUI_BUTTON *btn,INT32 reason);
|
||||
UINT32 guiMPJoinButton;
|
||||
INT32 giMPJoinBtnImage;
|
||||
|
||||
// Host Button
|
||||
void BtnMPJHostCallback(GUI_BUTTON *btn,INT32 reason);
|
||||
UINT32 guiMPJHostButton;
|
||||
INT32 giMPJHostBtnImage;
|
||||
|
||||
// Cancel Button
|
||||
void BtnMPJCancelCallback(GUI_BUTTON *btn,INT32 reason);
|
||||
UINT32 guiMPJCancelButton;
|
||||
INT32 giMPJCancelBtnImage;
|
||||
|
||||
// Message Box handle
|
||||
INT8 giMPJMessageBox = -1;
|
||||
|
||||
|
||||
////////////////////////////////////////////
|
||||
//
|
||||
// Local Function Prototypes
|
||||
//
|
||||
///////////////////////////////////////////
|
||||
|
||||
extern void ClearMainMenu();
|
||||
|
||||
BOOLEAN EnterMPJScreen();
|
||||
BOOLEAN ExitMPJScreen();
|
||||
void HandleMPJScreen();
|
||||
BOOLEAN RenderMPJScreen();
|
||||
void GetMPJScreenUserInput();
|
||||
bool ValidateJoinSettings(bool bSkipServerAddress);
|
||||
BOOLEAN DoMPJMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback );
|
||||
void DoneFadeOutForExitMPJScreen( void );
|
||||
void DoneFadeInForExitMPJScreen( void );
|
||||
|
||||
|
||||
void MpIniExists()
|
||||
{
|
||||
if(!getVFS()->fileExists(JA2MP_INI_FILENAME))
|
||||
{
|
||||
SGP_THROW_IFFALSE(getVFS()->createNewFile(JA2MP_INI_FILENAME),L"could not create file : Ja2_mp.ini");
|
||||
vfs::tWritableFile* file = getVFS()->getWriteFile(JA2MP_INI_FILENAME);
|
||||
if(file)
|
||||
{
|
||||
file->openWrite(true);
|
||||
file->close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
UINT32 MPJoinScreenInit( void )
|
||||
{
|
||||
// WANNE - MP: Read the values from Profiles/UserProfile/ja2_mp.ini
|
||||
MpIniExists();
|
||||
vfs::PropertyContainer props;
|
||||
props.initFromIniFile( JA2MP_INI_FILENAME);
|
||||
props.getStringProperty( JA2MP_INI_INITIAL_SECTION, JA2MP_SERVER_IP, gzServerIPField, 16, "127.0.0.1");
|
||||
props.getStringProperty( JA2MP_INI_INITIAL_SECTION, JA2MP_SERVER_PORT, gzServerPortField, 6, "60005");
|
||||
props.getStringProperty( JA2MP_INI_INITIAL_SECTION, JA2MP_CLIENT_NAME, gzPlayerHandleField, 12, L"Player Name");
|
||||
return( 1 );
|
||||
}
|
||||
|
||||
void SaveJoinSettings(bool ReSaving)
|
||||
{
|
||||
if (!ReSaving)
|
||||
{
|
||||
Get16BitStringFromField( 0, gzPlayerHandleField, 12 ); // these indexes are based on the order created
|
||||
Get16BitStringFromField( 1, gzServerIPField, 16 );
|
||||
Get16BitStringFromField( 2, gzServerPortField, 6 );
|
||||
}
|
||||
|
||||
MpIniExists();
|
||||
vfs::PropertyContainer props;
|
||||
props.initFromIniFile(JA2MP_INI_FILENAME);
|
||||
|
||||
props.setStringProperty(JA2MP_INI_INITIAL_SECTION,JA2MP_SERVER_IP, gzServerIPField);
|
||||
props.setStringProperty(JA2MP_INI_INITIAL_SECTION,JA2MP_SERVER_PORT, gzServerPortField);
|
||||
props.setStringProperty(JA2MP_INI_INITIAL_SECTION,JA2MP_CLIENT_NAME, gzPlayerHandleField);
|
||||
|
||||
s_ServerId.getServerId(vfs::Path(gzFileTransferDirectory), &props);
|
||||
|
||||
props.writeToIniFile(JA2MP_INI_FILENAME,false);
|
||||
}
|
||||
|
||||
bool ValidateJoinSettings(bool bSkipServerAddress, bool bSkipSyncDir)
|
||||
{
|
||||
// Check a Player name is entered
|
||||
Get16BitStringFromField( 0, gzPlayerHandleField, 12 ); // these indexes are based on the order created
|
||||
if (wcscmp(gzPlayerHandleField,L"")<=0)
|
||||
{
|
||||
DoMPJMessageBox( MSG_BOX_BASIC_STYLE, gzMPJScreenText[MPJ_HANDLE_INVALID], MP_JOIN_SCREEN, MSG_BOX_FLAG_OK, NULL );
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!bSkipServerAddress)
|
||||
{
|
||||
// Verify the IP Address
|
||||
Get16BitStringFromField( 1, gzServerIPField, 16 );
|
||||
|
||||
// loop through octets and check
|
||||
int numOctets = 0;
|
||||
wchar_t* tok;
|
||||
tok = wcstok(gzServerIPField,L".");
|
||||
while (tok != NULL)
|
||||
{
|
||||
numOctets++;
|
||||
INT32 oct = _wtoi(tok);
|
||||
// check for invalid conversion, ie alpha chars
|
||||
// wtoi returns 0 if it cant convert, but we need this value
|
||||
// therefore if tok <> 0 then it was a bad convert.
|
||||
if (oct == 0 && wcscmp(tok,L"0") != 0)
|
||||
{
|
||||
// force error
|
||||
numOctets=0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (oct < 0 || oct > 255) // allow 255
|
||||
{
|
||||
// bad octet, error
|
||||
numOctets=0;
|
||||
break;
|
||||
}
|
||||
|
||||
// get next octet
|
||||
tok = wcstok(NULL,L".");
|
||||
}
|
||||
|
||||
if (numOctets != 4)
|
||||
{
|
||||
// not a valid ip address
|
||||
DoMPJMessageBox( MSG_BOX_BASIC_STYLE, gzMPJScreenText[MPJ_SERVERIP_INVALID], MP_JOIN_SCREEN, MSG_BOX_FLAG_OK, NULL );
|
||||
return false;
|
||||
}
|
||||
|
||||
// Verify the Server Port
|
||||
Get16BitStringFromField( 2, gzServerPortField, 6 );
|
||||
INT32 svrPort = _wtoi(gzServerPortField);
|
||||
if (svrPort < 1 || svrPort > 65535)
|
||||
{
|
||||
DoMPJMessageBox( MSG_BOX_BASIC_STYLE, gzMPJScreenText[MPJ_SERVERPORT_INVALID], MP_JOIN_SCREEN, MSG_BOX_FLAG_OK, NULL );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!bSkipSyncDir)
|
||||
{
|
||||
if(vfs::OS::createRealDirectory(vfs::Path(L"Multiplayer")))
|
||||
{
|
||||
vfs::OS::createRealDirectory(vfs::Path(L"Multiplayer/Servers"));
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
UINT32 MPJoinScreenHandle( void )
|
||||
{
|
||||
StartFrameBufferRender();
|
||||
|
||||
if( gfMPJScreenEntry )
|
||||
{
|
||||
EnterMPJScreen();
|
||||
gfMPJScreenEntry = FALSE;
|
||||
gfMPJScreenExit = FALSE;
|
||||
InvalidateRegion( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT );
|
||||
}
|
||||
|
||||
GetMPJScreenUserInput();
|
||||
|
||||
HandleMPJScreen();
|
||||
|
||||
// render buttons marked dirty
|
||||
MarkButtonsDirty( );
|
||||
RenderButtons( );
|
||||
|
||||
// render text boxes
|
||||
RenderAllTextFields(); // textbox system call
|
||||
|
||||
ExecuteBaseDirtyRectQueue();
|
||||
EndFrameBufferRender();
|
||||
|
||||
// handle fades in and out
|
||||
if ( HandleFadeOutCallback( ) )
|
||||
{
|
||||
ClearMainMenu();
|
||||
return( gubMPJExitScreen );
|
||||
}
|
||||
|
||||
if ( HandleBeginFadeOut( gubMPJExitScreen ) )
|
||||
{
|
||||
return( gubMPJExitScreen );
|
||||
}
|
||||
|
||||
if ( HandleFadeInCallback( ) )
|
||||
{
|
||||
// Re-render the scene!
|
||||
RenderMPJScreen();
|
||||
}
|
||||
|
||||
if ( HandleBeginFadeIn( gubMPJExitScreen ) )
|
||||
{
|
||||
}
|
||||
|
||||
if( gfMPJScreenExit )
|
||||
{
|
||||
ExitMPJScreen();
|
||||
}
|
||||
|
||||
return( gubMPJExitScreen );
|
||||
}
|
||||
|
||||
UINT32 MPJoinScreenShutdown( void )
|
||||
{
|
||||
return( 1 );
|
||||
}
|
||||
|
||||
BOOLEAN EnterMPJScreen()
|
||||
{
|
||||
VOBJECT_DESC VObjectDesc;
|
||||
|
||||
if( gfMPJButtonsAllocated )
|
||||
return( TRUE );
|
||||
|
||||
SetCurrentCursorFromDatabase( CURSOR_NORMAL );
|
||||
|
||||
// load the Main trade screen backgroiund image
|
||||
ColorFillVideoSurfaceArea( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );
|
||||
VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE;
|
||||
|
||||
if (iResolution >= _640x480 && iResolution < _800x600)
|
||||
FilenameForBPP("INTERFACE\\OptionsScreenBackGround.sti", VObjectDesc.ImageFile);
|
||||
else if (iResolution < _1024x768)
|
||||
FilenameForBPP("INTERFACE\\OptionsScreenBackGround_800x600.sti", VObjectDesc.ImageFile);
|
||||
else
|
||||
FilenameForBPP("INTERFACE\\OptionsScreenBackGround_1024x768.sti", VObjectDesc.ImageFile);
|
||||
|
||||
|
||||
CHECKF(AddVideoObject(&VObjectDesc, &guiMPJMainBackGroundImage ));
|
||||
|
||||
//Join button
|
||||
giMPJoinBtnImage = LoadButtonImage("INTERFACE\\PreferencesButtons.sti", -1,0,-1,2,-1 );
|
||||
guiMPJoinButton = CreateIconAndTextButton( giMPJoinBtnImage, gzMPJScreenText[MPJ_JOIN_TEXT], OPT_BUTTON_FONT,
|
||||
OPT_BUTTON_ON_COLOR, DEFAULT_SHADOW,
|
||||
OPT_BUTTON_OFF_COLOR, DEFAULT_SHADOW,
|
||||
TEXT_CJUSTIFIED,
|
||||
MPJ_BTN_JOIN_X, MPJ_BTN_JOIN_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH,
|
||||
DEFAULT_MOVE_CALLBACK, BtnMPJoinCallback);
|
||||
|
||||
SpecifyButtonSoundScheme( guiMPJoinButton, BUTTON_SOUND_SCHEME_BIGSWITCH3 );
|
||||
SpecifyDisabledButtonStyle( guiMPJoinButton, DISABLED_STYLE_NONE );
|
||||
|
||||
//Host button
|
||||
giMPJHostBtnImage = UseLoadedButtonImage( giMPJoinBtnImage, -1,1,-1,3,-1 );
|
||||
guiMPJHostButton = CreateIconAndTextButton( giMPJHostBtnImage, gzMPJScreenText[MPJ_HOST_TEXT], OPT_BUTTON_FONT,
|
||||
OPT_BUTTON_ON_COLOR, DEFAULT_SHADOW,
|
||||
OPT_BUTTON_OFF_COLOR, DEFAULT_SHADOW,
|
||||
TEXT_CJUSTIFIED,
|
||||
MPJ_BTN_HOST_X, MPJ_BTN_HOST_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH,
|
||||
DEFAULT_MOVE_CALLBACK, BtnMPJHostCallback);
|
||||
|
||||
SpecifyButtonSoundScheme( guiMPJHostButton, BUTTON_SOUND_SCHEME_BIGSWITCH3 );
|
||||
SpecifyDisabledButtonStyle( guiMPJHostButton, DISABLED_STYLE_NONE );
|
||||
|
||||
//Cancel button
|
||||
giMPJCancelBtnImage = UseLoadedButtonImage( giMPJoinBtnImage, -1,1,-1,3,-1 );
|
||||
guiMPJCancelButton = CreateIconAndTextButton( giMPJCancelBtnImage, gzMPJScreenText[MPJ_CANCEL_TEXT], OPT_BUTTON_FONT,
|
||||
OPT_BUTTON_ON_COLOR, DEFAULT_SHADOW,
|
||||
OPT_BUTTON_OFF_COLOR, DEFAULT_SHADOW,
|
||||
TEXT_CJUSTIFIED,
|
||||
MPJ_CANCEL_X, MPJ_BTN_JOIN_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH,
|
||||
DEFAULT_MOVE_CALLBACK, BtnMPJCancelCallback );
|
||||
SpecifyButtonSoundScheme( guiMPJCancelButton, BUTTON_SOUND_SCHEME_BIGSWITCH3 );
|
||||
|
||||
// Initialise Text Boxes
|
||||
InitTextInputMode(); // API call to initialise text input mode for this screen
|
||||
// does not mean we are inputting text right away
|
||||
|
||||
// Player Name field
|
||||
SetTextInputCursor( CUROSR_IBEAM_WHITE );
|
||||
SetTextInputFont( (UINT16) FONT12ARIALFIXEDWIDTH ); //FONT12ARIAL //FONT12ARIALFIXEDWIDTH
|
||||
Set16BPPTextFieldColor( Get16BPPColor(FROMRGB( 0, 0, 0) ) );
|
||||
SetBevelColors( Get16BPPColor(FROMRGB(136, 138, 135)), Get16BPPColor(FROMRGB(24, 61, 81)) );
|
||||
SetTextInputRegularColors( FONT_WHITE, 2 );
|
||||
SetTextInputHilitedColors( 2, FONT_WHITE, FONT_WHITE );
|
||||
SetCursorColor( Get16BPPColor(FROMRGB(255, 255, 255) ) );
|
||||
|
||||
//AddUserInputField( NULL ); // API Call that sets a special input-handling routine and method for the TAB key
|
||||
|
||||
//Add Player Name textbox
|
||||
AddTextInputField( MPJ_TXT_HANDLE_X,
|
||||
MPJ_TXT_HANDLE_Y,
|
||||
MPJ_TXT_HANDLE_WIDTH,
|
||||
MPJ_TXT_HANDLE_HEIGHT,
|
||||
MSYS_PRIORITY_HIGH+2,
|
||||
gzPlayerHandleField,
|
||||
11,
|
||||
INPUTTYPE_ASCII );//23
|
||||
|
||||
//Add Server IP textbox
|
||||
AddTextInputField( MPJ_TXT_IP_X,
|
||||
MPJ_TXT_IP_Y,
|
||||
MPJ_TXT_IP_WIDTH,
|
||||
MPJ_TXT_IP_HEIGHT,
|
||||
MSYS_PRIORITY_HIGH+2,
|
||||
gzServerIPField,
|
||||
15,
|
||||
INPUTTYPE_ASCII );//23
|
||||
|
||||
//Add Server Port textbox
|
||||
AddTextInputField( MPJ_TXT_PORT_X,
|
||||
MPJ_TXT_PORT_Y,
|
||||
MPJ_TXT_PORT_WIDTH,
|
||||
MPJ_TXT_PORT_HEIGHT,
|
||||
MSYS_PRIORITY_HIGH+2,
|
||||
gzServerPortField,
|
||||
5,
|
||||
INPUTTYPE_ASCII );//23
|
||||
|
||||
SetActiveField( 0 ); // Playername textbox has focus
|
||||
|
||||
//Reset the exit screen - screen the main game loop will call next iteration
|
||||
gubMPJExitScreen = MP_JOIN_SCREEN;
|
||||
|
||||
//REnder the screen once so we can blt ot to ths save buffer
|
||||
RenderMPJScreen();
|
||||
|
||||
BlitBufferToBuffer(guiRENDERBUFFER, guiSAVEBUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT );
|
||||
|
||||
gfMPJButtonsAllocated = TRUE;
|
||||
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
BOOLEAN ExitMPJScreen()
|
||||
{
|
||||
if( !gfMPJButtonsAllocated )
|
||||
return( TRUE );
|
||||
|
||||
//Delete the main options screen background
|
||||
DeleteVideoObjectFromIndex( guiMPJMainBackGroundImage );
|
||||
|
||||
RemoveButton( guiMPJoinButton );
|
||||
RemoveButton( guiMPJHostButton );
|
||||
RemoveButton( guiMPJCancelButton );
|
||||
|
||||
|
||||
UnloadButtonImage( giMPJCancelBtnImage );
|
||||
UnloadButtonImage( giMPJHostBtnImage );
|
||||
UnloadButtonImage( giMPJoinBtnImage );
|
||||
|
||||
// exit text input mode in this screen and clean up text boxes
|
||||
KillAllTextInputModes();
|
||||
SetTextInputCursor( CURSOR_IBEAM );
|
||||
|
||||
gfMPJButtonsAllocated = FALSE;
|
||||
|
||||
//If we are starting the game stop playing the music
|
||||
// <TODO> review this, i think MPJ_EXIT is the proceed mode...
|
||||
//if( gubMPJScreenHandler == MPJ_EXIT )
|
||||
// SetMusicMode( MUSIC_NONE );
|
||||
|
||||
gfMPJScreenExit = FALSE;
|
||||
gfMPJScreenEntry = TRUE;
|
||||
|
||||
return( TRUE );
|
||||
|
||||
}
|
||||
|
||||
void HandleMPJScreen()
|
||||
{
|
||||
if( gubMPJScreenHandler != MPJ_NOTHING )
|
||||
{
|
||||
switch( gubMPJScreenHandler )
|
||||
{
|
||||
case MPJ_CANCEL:
|
||||
gubMPJExitScreen = MAINMENU_SCREEN;
|
||||
gfMPJScreenExit = TRUE;
|
||||
break;
|
||||
|
||||
case MPJ_HOST:
|
||||
gubMPJExitScreen = MP_HOST_SCREEN;
|
||||
gfMPJScreenExit = TRUE;
|
||||
break;
|
||||
|
||||
|
||||
case MPJ_JOIN:
|
||||
{
|
||||
//if we are already fading out, get out of here
|
||||
if( gFadeOutDoneCallback != DoneFadeOutForExitMPJScreen )
|
||||
{
|
||||
//Disable the ok button
|
||||
DisableButton( guiMPJoinButton );
|
||||
DisableButton( guiMPJHostButton );
|
||||
|
||||
gFadeOutDoneCallback = DoneFadeOutForExitMPJScreen;
|
||||
|
||||
FadeOutNextFrame( );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
gubMPJScreenHandler = MPJ_NOTHING;
|
||||
}
|
||||
|
||||
if( gfReRenderMPJScreen )
|
||||
{
|
||||
RenderMPJScreen();
|
||||
gfReRenderMPJScreen = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
void DrawHelpText()
|
||||
{
|
||||
int x = MPJ_LABEL_HANDLE_X;
|
||||
int y = iScreenHeightOffset + 60;
|
||||
int width = 640 - (2 * 50);
|
||||
int lineSpacing = 12;
|
||||
|
||||
// Visit IRC
|
||||
DrawTextToScreen( gzMPJHelpText[ 0 ], x, y, width, FONT10ARIAL, MPJ_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED );
|
||||
|
||||
y+= lineSpacing;
|
||||
DrawTextToScreen( gzMPJHelpText[ 1 ], x, y, width, FONT10ARIAL, MPJ_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED );
|
||||
|
||||
// Host
|
||||
y += 150;
|
||||
|
||||
y+= lineSpacing;
|
||||
DrawTextToScreen( gzMPJHelpText[ 2 ], x, y, width, FONT12ARIAL, MPJ_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
y+= lineSpacing + 5;
|
||||
DrawTextToScreen( gzMPJHelpText[ 3 ], x, y, width, FONT10ARIAL, MPJ_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
y+= lineSpacing;
|
||||
DrawTextToScreen( gzMPJHelpText[ 4 ], x, y, width, FONT10ARIAL, MPJ_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
y+= lineSpacing;
|
||||
DrawTextToScreen( gzMPJHelpText[ 5 ], x, y, width, FONT10ARIAL, MPJ_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
y+= lineSpacing;
|
||||
DrawTextToScreen( gzMPJHelpText[ 6 ], x, y, width, FONT10ARIAL, MPJ_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
|
||||
// Join
|
||||
y += 20;
|
||||
|
||||
y += lineSpacing;
|
||||
DrawTextToScreen( gzMPJHelpText[ 7 ], x, y, width, FONT12ARIAL, MPJ_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
y += lineSpacing + 5;
|
||||
DrawTextToScreen( gzMPJHelpText[ 8 ], x, y, width, FONT10ARIAL, MPJ_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
y += lineSpacing;
|
||||
DrawTextToScreen( gzMPJHelpText[ 9 ], x, y, width, FONT10ARIAL, MPJ_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
y += lineSpacing;
|
||||
DrawTextToScreen( gzMPJHelpText[ 10 ], x, y, width, FONT10ARIAL, MPJ_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
}
|
||||
|
||||
BOOLEAN RenderMPJScreen()
|
||||
{
|
||||
HVOBJECT hPixHandle;
|
||||
|
||||
//Get the main background screen graphic and blt it
|
||||
GetVideoObject(&hPixHandle, guiMPJMainBackGroundImage );
|
||||
|
||||
BltVideoObject(FRAME_BUFFER, hPixHandle, 0,(SCREEN_WIDTH - xResSize)/2,(SCREEN_HEIGHT - yResSize)/2, VO_BLT_SRCTRANSPARENCY,NULL);
|
||||
|
||||
|
||||
//Shade the background
|
||||
ShadowVideoSurfaceRect( FRAME_BUFFER, iScreenWidthOffset, iScreenHeightOffset, iScreenWidthOffset + 640, iScreenHeightOffset + 480 );
|
||||
|
||||
//Display the title
|
||||
DrawTextToScreen( gzMPJScreenText[ MPJ_TITLE_TEXT ], MPJ_MAIN_TITLE_X, MPJ_MAIN_TITLE_Y, MPJ_MAIN_TITLE_WIDTH, MPJ_TITLE_FONT, MPJ_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED );
|
||||
|
||||
DrawHelpText();
|
||||
|
||||
// Player name text label
|
||||
DisplayWrappedString( MPJ_LABEL_HANDLE_X, MPJ_LABEL_HANDLE_Y, MPJ_LABEL_HANDLE_WIDTH, 2, MPJ_LABEL_TEXT_FONT, MPJ_LABEL_TEXT_COLOR, gzMPJScreenText[ MPJ_HANDLE_TEXT ], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
|
||||
// Server IP text label
|
||||
DisplayWrappedString( MPJ_LABEL_IP_X, MPJ_LABEL_IP_Y, MPJ_LABEL_IP_WIDTH, 2, MPJ_LABEL_TEXT_FONT, MPJ_LABEL_TEXT_COLOR, gzMPJScreenText[ MPJ_SERVERIP_TEXT ], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
|
||||
// Server Port text label
|
||||
DisplayWrappedString( MPJ_LABEL_PORT_X, MPJ_LABEL_PORT_Y, MPJ_LABEL_PORT_WIDTH, 2, MPJ_LABEL_TEXT_FONT, MPJ_LABEL_TEXT_COLOR, gzMPJScreenText[ MPJ_SERVERPORT_TEXT ], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
void GetMPJScreenUserInput()
|
||||
{
|
||||
InputAtom Event;
|
||||
|
||||
while (DequeueSpecificEvent(&Event, KEY_DOWN|KEY_UP|KEY_REPEAT))
|
||||
{
|
||||
// check if this event is swallowed by text input, otherwise process key
|
||||
if( !HandleTextInput( &Event ) && Event.usEvent == KEY_DOWN )
|
||||
{
|
||||
switch( Event.usParam )
|
||||
{
|
||||
|
||||
case ESC:
|
||||
//Exit out of the screen
|
||||
gubMPJScreenHandler = MPJ_CANCEL;
|
||||
break;
|
||||
|
||||
case ENTER:
|
||||
if (ValidateJoinSettings(false, false))
|
||||
{
|
||||
SaveJoinSettings(false);
|
||||
gubMPJScreenHandler = MPJ_JOIN;
|
||||
|
||||
// force client to use "MULTIPLAYER/SERVERS" path
|
||||
memset(gzFileTransferDirectory,0,100*sizeof(CHAR16));
|
||||
wcscpy(gzFileTransferDirectory,L"multiplayer/servers");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// CALLBACKS
|
||||
void BtnMPJoinCallback(GUI_BUTTON *btn,INT32 reason)
|
||||
{
|
||||
if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN )
|
||||
{
|
||||
btn->uiFlags |= BUTTON_CLICKED_ON;
|
||||
InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY);
|
||||
}
|
||||
if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
|
||||
{
|
||||
btn->uiFlags &= (~BUTTON_CLICKED_ON );
|
||||
|
||||
if (ValidateJoinSettings(false, false))
|
||||
{
|
||||
SaveJoinSettings(false);
|
||||
gubMPJScreenHandler = MPJ_JOIN;
|
||||
|
||||
// force client to use "MULTIPLAYER/SERVERS" path
|
||||
memset(gzFileTransferDirectory,0,100*sizeof(CHAR16));
|
||||
wcscpy(gzFileTransferDirectory,L"multiplayer/servers");
|
||||
}
|
||||
|
||||
InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY);
|
||||
}
|
||||
}
|
||||
|
||||
void BtnMPJHostCallback(GUI_BUTTON *btn,INT32 reason)
|
||||
{
|
||||
if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN )
|
||||
{
|
||||
btn->uiFlags |= BUTTON_CLICKED_ON;
|
||||
InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY);
|
||||
}
|
||||
if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
|
||||
{
|
||||
btn->uiFlags &= (~BUTTON_CLICKED_ON );
|
||||
|
||||
if (ValidateJoinSettings(true, false))
|
||||
{
|
||||
SaveJoinSettings(false);
|
||||
gubMPJScreenHandler = MPJ_HOST;
|
||||
}
|
||||
InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY);
|
||||
}
|
||||
}
|
||||
|
||||
void BtnMPJCancelCallback(GUI_BUTTON *btn,INT32 reason)
|
||||
{
|
||||
if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN )
|
||||
{
|
||||
btn->uiFlags |= BUTTON_CLICKED_ON;
|
||||
InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY);
|
||||
}
|
||||
if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
|
||||
{
|
||||
btn->uiFlags &= (~BUTTON_CLICKED_ON );
|
||||
|
||||
gubMPJScreenHandler = MPJ_CANCEL;
|
||||
|
||||
InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY);
|
||||
}
|
||||
}
|
||||
|
||||
BOOLEAN DoMPJMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback )
|
||||
{
|
||||
SGPRect CenteringRect= {0 + xResOffset, 0, SCREEN_WIDTH - xResOffset, SCREEN_HEIGHT };
|
||||
|
||||
// do message box and return
|
||||
giMPJMessageBox = DoMessageBox( ubStyle, zString, uiExitScreen, ( UINT16 ) ( usFlags| MSG_BOX_FLAG_USE_CENTERING_RECT ), ReturnCallback, &CenteringRect );
|
||||
|
||||
// send back return state
|
||||
return( ( giMPJMessageBox != -1 ) );
|
||||
}
|
||||
|
||||
void DoneFadeOutForExitMPJScreen( void )
|
||||
{
|
||||
// As we bypassed the GIO screen, set up some game options for multiplayer here
|
||||
is_networked = true;
|
||||
is_host = false; // we want to be a client, not we ARE a client yet (is_client)
|
||||
auto_retry = true;
|
||||
giNumTries = 5;
|
||||
|
||||
// set up and initialise a new game on the client
|
||||
InitNewGame(false);
|
||||
SetPendingNewScreen( MP_CONNECT_SCREEN );
|
||||
|
||||
if (is_networked)
|
||||
gGameOptions.fTurnTimeLimit = TRUE;
|
||||
else
|
||||
gGameOptions.fTurnTimeLimit = FALSE;
|
||||
|
||||
// Bobby Rays - why would we want anything less than the best
|
||||
gGameOptions.ubBobbyRayQuality = BR_AWESOME;
|
||||
gGameOptions.ubBobbyRayQuantity = BR_AWESOME;
|
||||
|
||||
gubMPJExitScreen = MP_CONNECT_SCREEN;
|
||||
|
||||
ExitMPJScreen(); // cleanup please, if we called a fadeout then we didnt do it above
|
||||
|
||||
SetCurrentCursorFromDatabase( VIDEO_NO_CURSOR );
|
||||
}
|
||||
|
||||
void DoneFadeInForExitMPJScreen( void )
|
||||
{
|
||||
SetCurrentCursorFromDatabase( VIDEO_NO_CURSOR );
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
#ifndef _MP_JOIN_SCREEN_H_
|
||||
#define _MP_JOIN_SCREEN_H_
|
||||
|
||||
#include <vfs/Core/vfs.h>
|
||||
|
||||
namespace vfs{
|
||||
class PropertyContainer;
|
||||
}
|
||||
|
||||
class CUniqueServerId
|
||||
{
|
||||
public:
|
||||
vfs::String const& getServerId(vfs::Path dir, vfs::PropertyContainer* props = NULL);
|
||||
|
||||
static void uniqueRandomString(vfs::String& str);
|
||||
private:
|
||||
vfs::String _id;
|
||||
};
|
||||
|
||||
extern CUniqueServerId s_ServerId;
|
||||
|
||||
UINT32 MPJoinScreenInit( void );
|
||||
UINT32 MPJoinScreenHandle( void );
|
||||
UINT32 MPJoinScreenShutdown( void );
|
||||
|
||||
void SaveJoinSettings(bool ReSaving);
|
||||
|
||||
void MpIniExists();
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,653 @@
|
||||
#include "Types.h"
|
||||
#include "MPScoreScreen.h"
|
||||
#include "GameSettings.h"
|
||||
#include "Utilities.h"
|
||||
#include "wCheck.h"
|
||||
#include "Font Control.h"
|
||||
#include "WordWrap.h"
|
||||
#include "Render Dirty.h"
|
||||
#include "Input.h"
|
||||
#include "Options Screen.h"
|
||||
#include "English.h"
|
||||
#include "Sysutil.h"
|
||||
#include "Fade Screen.h"
|
||||
#include "Cursor Control.h"
|
||||
#include "Music Control.h"
|
||||
#include "cursors.h"
|
||||
#include "Intro.h"
|
||||
#include "Text.h"
|
||||
#include "Text Input.h"
|
||||
#include "Soldier Profile.h"
|
||||
|
||||
#include "gameloop.h"
|
||||
#include "Game Init.h"
|
||||
#include "connect.h"
|
||||
#include "network.h" // for client name
|
||||
|
||||
|
||||
////////////////////////////////////////////
|
||||
//
|
||||
// Global Defines
|
||||
//
|
||||
///////////////////////////////////////////
|
||||
|
||||
#define MPS_TITLE_FONT FONT14ARIAL//FONT16ARIAL
|
||||
#define MPS_TITLE_COLOR FONT_MCOLOR_WHITE
|
||||
|
||||
#define MPS_LABEL_TEXT_FONT FONT12ARIAL//FONT16ARIAL
|
||||
#define MPS_LABEL_TEXT_COLOR FONT_MCOLOR_WHITE
|
||||
|
||||
//buttons
|
||||
#define MPS_BTN_CONTINUE_X iScreenWidthOffset + 320 + 143
|
||||
#define MPS_BTN_CONTINUE_Y iScreenHeightOffset + 435
|
||||
//#define MPJ_BTN_HOST_X MPJ_BTN_JOIN_X-180
|
||||
//#define MPJ_BTN_HOST_Y iScreenHeightOffset + 435
|
||||
#define MPS_BTN_CANCEL_X iScreenWidthOffset + ((320 - 115) / 2)
|
||||
#define MPS_BTN_CANCEL_Y MPS_BTN_CONTINUE_Y
|
||||
|
||||
//main title
|
||||
#define MPS_MAIN_TITLE_X 0
|
||||
#define MPS_MAIN_TITLE_Y iScreenHeightOffset + 10
|
||||
#define MPS_MAIN_TITLE_WIDTH SCREEN_WIDTH
|
||||
|
||||
//labels
|
||||
#define MPS_LABEL_PLAYER_X iScreenWidthOffset + 80
|
||||
#define MPS_LABEL_PLAYER_Y iScreenHeightOffset + 80
|
||||
#define MPS_LABEL_PLAYER_WIDTH 80
|
||||
#define MPS_LABEL_KILLS_X MPS_LABEL_PLAYER_X + MPS_LABEL_PLAYER_WIDTH + 20
|
||||
#define MPS_LABEL_KILLS_Y MPS_LABEL_PLAYER_Y
|
||||
#define MPS_LABEL_KILLS_WIDTH 50
|
||||
#define MPS_LABEL_DEATHS_X MPS_LABEL_KILLS_X + MPS_LABEL_KILLS_WIDTH + 20
|
||||
#define MPS_LABEL_DEATHS_Y MPS_LABEL_PLAYER_Y
|
||||
#define MPS_LABEL_DEATHS_WIDTH 50
|
||||
#define MPS_LABEL_HITS_X MPS_LABEL_DEATHS_X + MPS_LABEL_DEATHS_WIDTH + 20
|
||||
#define MPS_LABEL_HITS_Y MPS_LABEL_PLAYER_Y
|
||||
#define MPS_LABEL_HITS_WIDTH 50
|
||||
#define MPS_LABEL_MISSES_X MPS_LABEL_HITS_X + MPS_LABEL_HITS_WIDTH + 20
|
||||
#define MPS_LABEL_MISSES_Y MPS_LABEL_PLAYER_Y
|
||||
#define MPS_LABEL_MISSES_WIDTH 50
|
||||
#define MPS_LABEL_ACCURACY_X MPS_LABEL_MISSES_X + MPS_LABEL_MISSES_WIDTH + 20
|
||||
#define MPS_LABEL_ACCURACY_Y MPS_LABEL_PLAYER_Y
|
||||
#define MPS_LABEL_ACCURACY_WIDTH 70
|
||||
|
||||
|
||||
#define MPS_PLAYERLIST_Y MPS_LABEL_PLAYER_Y + 30
|
||||
#define MPS_PLAYER_GAP 17
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////
|
||||
//
|
||||
// Global Variables
|
||||
//
|
||||
///////////////////////////////////////////
|
||||
|
||||
BOOLEAN gfMPSScreenEntry = TRUE;
|
||||
BOOLEAN gfMPSScreenExit = FALSE;
|
||||
BOOLEAN gfReRenderMPSScreen=TRUE;
|
||||
BOOLEAN gfMPSButtonsAllocated = FALSE;
|
||||
BOOLEAN gfMPSScoreScreenCanContinue = FALSE;
|
||||
|
||||
//enum for different states of screen
|
||||
enum
|
||||
{
|
||||
MPS_NOTHING,
|
||||
MPS_CANCEL,
|
||||
MPS_CONTINUE,
|
||||
};
|
||||
|
||||
UINT8 gubMPSScreenHandler=MPS_NOTHING; // State changer for HandleMPJScreen()
|
||||
|
||||
UINT32 gubMPSExitScreen = MP_SCORE_SCREEN; // The screen that is in control next iteration of the game_loop
|
||||
|
||||
UINT32 guiMPSMainBackGroundImage;
|
||||
|
||||
////////////////////////////////////////////
|
||||
//
|
||||
// Screen Controls
|
||||
//
|
||||
///////////////////////////////////////////
|
||||
|
||||
// Cancel Button
|
||||
void BtnMPSCancelCallback(GUI_BUTTON *btn,INT32 reason);
|
||||
UINT32 guiMPSCancelButton;
|
||||
INT32 giMPSCancelBtnImage;
|
||||
|
||||
// Continue Button
|
||||
void BtnMPSContinueCallback(GUI_BUTTON *btn,INT32 reason);
|
||||
UINT32 guiMPSContinueButton;
|
||||
INT32 giMPSContinueBtnImage;
|
||||
|
||||
// Message Box handle
|
||||
INT8 giMPSMessageBox = -1;
|
||||
|
||||
|
||||
////////////////////////////////////////////
|
||||
//
|
||||
// Local Function Prototypes
|
||||
//
|
||||
///////////////////////////////////////////
|
||||
|
||||
extern void ClearMainMenu();
|
||||
|
||||
BOOLEAN EnterMPSScreen();
|
||||
BOOLEAN ExitMPSScreen();
|
||||
void HandleMPSScreen();
|
||||
BOOLEAN RenderMPSScreen();
|
||||
|
||||
void GetMPSScreenUserInput();
|
||||
void DoneFadeOutForExitMPSScreen( void );
|
||||
void DoneFadeInForExitMPSScreen( void );
|
||||
|
||||
UINT32 MPScoreScreenInit( void )
|
||||
{
|
||||
return (1);
|
||||
}
|
||||
|
||||
UINT32 MPScoreScreenHandle( void )
|
||||
{
|
||||
StartFrameBufferRender();
|
||||
|
||||
if( gfMPSScreenEntry )
|
||||
{
|
||||
// PauseGame();
|
||||
|
||||
EnterMPSScreen();
|
||||
gfMPSScreenEntry = FALSE;
|
||||
gfMPSScreenExit = FALSE;
|
||||
InvalidateRegion( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT );
|
||||
}
|
||||
|
||||
GetMPSScreenUserInput();
|
||||
|
||||
|
||||
HandleMPSScreen();
|
||||
|
||||
// render buttons marked dirty
|
||||
MarkButtonsDirty( );
|
||||
RenderButtons( );
|
||||
|
||||
// render text boxes
|
||||
RenderAllTextFields(); // textbox system call
|
||||
|
||||
// render help
|
||||
// RenderFastHelp( );
|
||||
// RenderButtonsFastHelp( );
|
||||
|
||||
|
||||
ExecuteBaseDirtyRectQueue();
|
||||
EndFrameBufferRender();
|
||||
|
||||
// handle fades in and out
|
||||
if ( HandleFadeOutCallback( ) )
|
||||
{
|
||||
ClearMainMenu();
|
||||
return( gubMPSExitScreen );
|
||||
}
|
||||
|
||||
if ( HandleBeginFadeOut( gubMPSExitScreen ) )
|
||||
{
|
||||
return( gubMPSExitScreen );
|
||||
}
|
||||
|
||||
if ( HandleFadeInCallback( ) )
|
||||
{
|
||||
// Re-render the scene!
|
||||
RenderMPSScreen();
|
||||
}
|
||||
|
||||
if ( HandleBeginFadeIn( gubMPSExitScreen ) )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
if( gfMPSScreenExit ) // we are exiting this screen
|
||||
{
|
||||
ExitMPSScreen(); // perform destruction
|
||||
}
|
||||
|
||||
return( gubMPSExitScreen );
|
||||
} // end MPScoreScreenHandle()
|
||||
|
||||
UINT32 MPScoreScreenShutdown( void )
|
||||
{
|
||||
return( 1 );
|
||||
}
|
||||
|
||||
BOOLEAN EnterMPSScreen()
|
||||
{
|
||||
gfMPSScoreScreenCanContinue = FALSE;
|
||||
|
||||
VOBJECT_DESC VObjectDesc;
|
||||
|
||||
if( gfMPSButtonsAllocated )
|
||||
return( TRUE );
|
||||
|
||||
SetCurrentCursorFromDatabase( CURSOR_NORMAL );
|
||||
|
||||
// load the Main trade screen backgroiund image
|
||||
ColorFillVideoSurfaceArea( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );
|
||||
VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE;
|
||||
|
||||
if (iResolution >= _640x480 && iResolution < _800x600)
|
||||
FilenameForBPP("INTERFACE\\OptionsScreenBackGround.sti", VObjectDesc.ImageFile);
|
||||
else if (iResolution < _1024x768)
|
||||
FilenameForBPP("INTERFACE\\OptionsScreenBackGround_800x600.sti", VObjectDesc.ImageFile);
|
||||
else
|
||||
FilenameForBPP("INTERFACE\\OptionsScreenBackGround_1024x768.sti", VObjectDesc.ImageFile);
|
||||
|
||||
|
||||
CHECKF(AddVideoObject(&VObjectDesc, &guiMPSMainBackGroundImage ));
|
||||
|
||||
//Cancel button
|
||||
giMPSCancelBtnImage = LoadButtonImage("INTERFACE\\PreferencesButtons.sti", -1,0,-1,2,-1 );
|
||||
guiMPSCancelButton = CreateIconAndTextButton( giMPSCancelBtnImage, gzMPSScreenText[MPS_CANCEL_TEXT], OPT_BUTTON_FONT,
|
||||
OPT_BUTTON_ON_COLOR, DEFAULT_SHADOW,
|
||||
OPT_BUTTON_OFF_COLOR, DEFAULT_SHADOW,
|
||||
TEXT_CJUSTIFIED,
|
||||
MPS_BTN_CANCEL_X, MPS_BTN_CANCEL_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH,
|
||||
DEFAULT_MOVE_CALLBACK, BtnMPSCancelCallback);
|
||||
|
||||
SpecifyButtonSoundScheme( guiMPSCancelButton, BUTTON_SOUND_SCHEME_BIGSWITCH3 );
|
||||
SpecifyDisabledButtonStyle( guiMPSCancelButton, DISABLED_STYLE_NONE );
|
||||
|
||||
//Continue button
|
||||
giMPSContinueBtnImage = UseLoadedButtonImage( giMPSCancelBtnImage, -1,1,-1,3,-1 );
|
||||
guiMPSContinueButton = CreateIconAndTextButton( giMPSContinueBtnImage, gzMPSScreenText[MPS_CONTINUE_TEXT], OPT_BUTTON_FONT,
|
||||
OPT_BUTTON_ON_COLOR, DEFAULT_SHADOW,
|
||||
OPT_BUTTON_OFF_COLOR, DEFAULT_SHADOW,
|
||||
TEXT_CJUSTIFIED,
|
||||
MPS_BTN_CONTINUE_X, MPS_BTN_CONTINUE_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH,
|
||||
DEFAULT_MOVE_CALLBACK, BtnMPSContinueCallback);
|
||||
|
||||
SpecifyButtonSoundScheme( guiMPSContinueButton, BUTTON_SOUND_SCHEME_BIGSWITCH3 );
|
||||
SpecifyDisabledButtonStyle( guiMPSContinueButton, DISABLED_STYLE_NONE );
|
||||
|
||||
//Reset the exit screen - screen the main game loop will call next iteration
|
||||
gubMPSExitScreen = MP_SCORE_SCREEN;
|
||||
|
||||
//REnder the screen once so we can blt ot to ths save buffer
|
||||
RenderMPSScreen();
|
||||
|
||||
BlitBufferToBuffer(guiRENDERBUFFER, guiSAVEBUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT );
|
||||
|
||||
gfMPSButtonsAllocated = TRUE;
|
||||
|
||||
return( TRUE );
|
||||
|
||||
} // End of EnterMPSScreen()
|
||||
|
||||
|
||||
BOOLEAN ExitMPSScreen()
|
||||
{
|
||||
if( !gfMPSButtonsAllocated )
|
||||
return( TRUE );
|
||||
|
||||
//Delete the main options screen background
|
||||
DeleteVideoObjectFromIndex( guiMPSMainBackGroundImage );
|
||||
|
||||
RemoveButton( guiMPSContinueButton );
|
||||
RemoveButton( guiMPSCancelButton );
|
||||
|
||||
|
||||
UnloadButtonImage( giMPSCancelBtnImage );
|
||||
UnloadButtonImage( giMPSContinueBtnImage );
|
||||
|
||||
// exit text input mode in this screen and clean up text boxes
|
||||
//KillAllTextInputModes();
|
||||
SetTextInputCursor( CURSOR_IBEAM );
|
||||
|
||||
gfMPSButtonsAllocated = FALSE;
|
||||
|
||||
//If we are starting the game stop playing the music
|
||||
if( gubMPSScreenHandler == MPS_CONTINUE )
|
||||
SetMusicMode( MUSIC_NONE );
|
||||
|
||||
gfMPSScreenExit = FALSE;
|
||||
gfMPSScreenEntry = TRUE;
|
||||
|
||||
return( TRUE );
|
||||
|
||||
} // End of ExitMPJScreen()
|
||||
|
||||
|
||||
void HandleMPSScreen()
|
||||
{
|
||||
if( gubMPSScreenHandler != MPS_NOTHING )
|
||||
{
|
||||
switch( gubMPSScreenHandler )
|
||||
{
|
||||
case MPS_CANCEL:
|
||||
|
||||
if (is_server)
|
||||
server_disconnect();
|
||||
|
||||
if (is_client)
|
||||
client_disconnect();
|
||||
|
||||
gubMPSExitScreen = MAINMENU_SCREEN;
|
||||
gfMPSScreenExit = TRUE;
|
||||
break;
|
||||
|
||||
/*case MPJ_HOST:
|
||||
gubMPJExitScreen = MP_HOST_SCREEN;
|
||||
gfMPJScreenExit = TRUE;
|
||||
break;*/
|
||||
|
||||
|
||||
case MPS_CONTINUE:
|
||||
{
|
||||
//if we are already fading out, get out of here
|
||||
if( gFadeOutDoneCallback != DoneFadeOutForExitMPSScreen )
|
||||
{
|
||||
//Disable the ok button
|
||||
DisableButton( guiMPSCancelButton );
|
||||
DisableButton( guiMPSContinueButton );
|
||||
|
||||
gFadeOutDoneCallback = DoneFadeOutForExitMPSScreen;
|
||||
|
||||
FadeOutNextFrame( );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
gubMPSScreenHandler = MPS_NOTHING;
|
||||
}
|
||||
|
||||
// disable the continue button
|
||||
if (!is_server)
|
||||
{
|
||||
if (gfMPSScoreScreenCanContinue)
|
||||
ShowButton( guiMPSContinueButton );
|
||||
else
|
||||
HideButton( guiMPSContinueButton );
|
||||
}
|
||||
|
||||
|
||||
|
||||
if( gfReRenderMPSScreen )
|
||||
{
|
||||
RenderMPSScreen();
|
||||
gfReRenderMPSScreen = FALSE;
|
||||
}
|
||||
|
||||
// <TODO> add restore backgrounds in...
|
||||
//RestoreGIOButtonBackGrounds();
|
||||
} // end of HandleMPJScreen
|
||||
|
||||
|
||||
BOOLEAN RenderMPSScreen()
|
||||
{
|
||||
HVOBJECT hPixHandle;
|
||||
UINT16 usPosY;
|
||||
|
||||
//Get the main background screen graphic and blt it
|
||||
GetVideoObject(&hPixHandle, guiMPSMainBackGroundImage );
|
||||
|
||||
BltVideoObject(FRAME_BUFFER, hPixHandle, 0,(SCREEN_WIDTH - xResSize)/2,(SCREEN_HEIGHT - yResSize)/2, VO_BLT_SRCTRANSPARENCY,NULL);
|
||||
|
||||
//Shade the background
|
||||
ShadowVideoSurfaceRect( FRAME_BUFFER, iScreenWidthOffset, iScreenHeightOffset, iScreenWidthOffset + 640, iScreenHeightOffset + 480 );
|
||||
|
||||
//Display the title
|
||||
DrawTextToScreen( gzMPSScreenText[ MPS_TITLE_TEXT ], MPS_MAIN_TITLE_X, MPS_MAIN_TITLE_Y, MPS_MAIN_TITLE_WIDTH, MPS_TITLE_FONT, MPS_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED );
|
||||
|
||||
// Player Column
|
||||
DisplayWrappedString( MPS_LABEL_PLAYER_X, MPS_LABEL_PLAYER_Y, MPS_LABEL_PLAYER_WIDTH, 2, MPS_TITLE_FONT, MPS_TITLE_COLOR, gzMPSScreenText[ MPS_PLAYER_TEXT ], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
// Kills Column
|
||||
DisplayWrappedString( MPS_LABEL_KILLS_X, MPS_LABEL_KILLS_Y, MPS_LABEL_KILLS_WIDTH, 2, MPS_TITLE_FONT, MPS_TITLE_COLOR, gzMPSScreenText[ MPS_KILLS_TEXT ], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
// Deaths Column
|
||||
DisplayWrappedString( MPS_LABEL_DEATHS_X, MPS_LABEL_DEATHS_Y, MPS_LABEL_DEATHS_WIDTH, 2, MPS_TITLE_FONT, MPS_TITLE_COLOR, gzMPSScreenText[ MPS_DEATHS_TEXT ], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
// Hits Column
|
||||
DisplayWrappedString( MPS_LABEL_HITS_X, MPS_LABEL_HITS_Y, MPS_LABEL_HITS_WIDTH, 2, MPS_TITLE_FONT, MPS_TITLE_COLOR, gzMPSScreenText[ MPS_HITS_TEXT ], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
// Misses Column
|
||||
DisplayWrappedString( MPS_LABEL_MISSES_X, MPS_LABEL_MISSES_Y, MPS_LABEL_MISSES_WIDTH, 2, MPS_TITLE_FONT, MPS_TITLE_COLOR, gzMPSScreenText[ MPS_MISSES_TEXT ], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
// Accuracy Column
|
||||
DisplayWrappedString( MPS_LABEL_ACCURACY_X, MPS_LABEL_ACCURACY_Y, MPS_LABEL_ACCURACY_WIDTH, 2, MPS_TITLE_FONT, MPS_TITLE_COLOR, gzMPSScreenText[ MPS_ACCURACY_TEXT ], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
|
||||
// Draw players
|
||||
wchar_t szPlayerName[30];
|
||||
wchar_t szPlayerKills[4];
|
||||
wchar_t szPlayerDeaths[4];
|
||||
wchar_t szPlayerHits[4];
|
||||
wchar_t szPlayerMisses[4];
|
||||
wchar_t szPlayerAccuracy[8];
|
||||
float flAccuracy = 0;
|
||||
for(int i=0; i < 4; i++)
|
||||
{
|
||||
if (client_names[i] != NULL)
|
||||
{
|
||||
if (strcmp(client_names[i],"")!=0)
|
||||
{
|
||||
// valid player
|
||||
usPosY = MPS_PLAYERLIST_Y + (i * MPS_PLAYER_GAP);
|
||||
|
||||
// Draw Player Name Column
|
||||
memset(szPlayerName,0,30*sizeof(wchar_t));
|
||||
mbstowcs( szPlayerName,client_names[i],30);
|
||||
|
||||
DisplayWrappedString( MPS_LABEL_PLAYER_X, usPosY, MPS_LABEL_PLAYER_WIDTH, 2, MPS_LABEL_TEXT_FONT, MPS_LABEL_TEXT_COLOR, szPlayerName, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
|
||||
// Draw Kills Column
|
||||
memset(szPlayerKills,0,4*sizeof(wchar_t));
|
||||
_itow(gMPPlayerStats[i].kills,szPlayerKills,10);
|
||||
DisplayWrappedString( MPS_LABEL_KILLS_X, usPosY, MPS_LABEL_KILLS_WIDTH, 2, MPS_LABEL_TEXT_FONT, MPS_LABEL_TEXT_COLOR, szPlayerKills, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
|
||||
// Draw Deaths Column
|
||||
memset(szPlayerDeaths,0,4*sizeof(wchar_t));
|
||||
_itow(gMPPlayerStats[i].deaths,szPlayerDeaths,10);
|
||||
DisplayWrappedString( MPS_LABEL_DEATHS_X, usPosY, MPS_LABEL_DEATHS_WIDTH, 2, MPS_LABEL_TEXT_FONT, MPS_LABEL_TEXT_COLOR, szPlayerDeaths, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
|
||||
// Draw Hits Column
|
||||
memset(szPlayerHits,0,4*sizeof(wchar_t));
|
||||
_itow(gMPPlayerStats[i].hits,szPlayerHits,10);
|
||||
DisplayWrappedString( MPS_LABEL_HITS_X, usPosY, MPS_LABEL_HITS_WIDTH, 2, MPS_LABEL_TEXT_FONT, MPS_LABEL_TEXT_COLOR, szPlayerHits, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
|
||||
// Draw Misses Column
|
||||
memset(szPlayerMisses,0,4*sizeof(wchar_t));
|
||||
_itow(gMPPlayerStats[i].misses,szPlayerMisses,10);
|
||||
DisplayWrappedString( MPS_LABEL_MISSES_X, usPosY, MPS_LABEL_MISSES_WIDTH, 2, MPS_LABEL_TEXT_FONT, MPS_LABEL_TEXT_COLOR, szPlayerMisses, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
|
||||
// Draw Accuracy Column
|
||||
if ( gMPPlayerStats[i].misses + gMPPlayerStats[i].hits > 0 )
|
||||
flAccuracy = ((float)gMPPlayerStats[i].hits / (float)(gMPPlayerStats[i].misses + gMPPlayerStats[i].hits)) * 100.0f;
|
||||
else
|
||||
flAccuracy = 0;
|
||||
memset(szPlayerAccuracy,0,8*sizeof(wchar_t));
|
||||
swprintf(szPlayerAccuracy,L"%i%%%%%%%%",(int)flAccuracy); // this thing goes through like three printfs before being rendered....
|
||||
DisplayWrappedString( MPS_LABEL_ACCURACY_X, usPosY, MPS_LABEL_ACCURACY_WIDTH, 2, MPS_LABEL_TEXT_FONT, MPS_LABEL_TEXT_COLOR, szPlayerAccuracy, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (cGameType==MP_TYPE_COOP)
|
||||
{
|
||||
// CO-OP Mode, show stats for queens army
|
||||
usPosY = MPS_PLAYERLIST_Y + (5 * MPS_PLAYER_GAP); // leave a space between players and AI
|
||||
|
||||
// Draw AI Team Name
|
||||
DisplayWrappedString( MPS_LABEL_PLAYER_X, usPosY, MPS_LABEL_PLAYER_WIDTH, 2, MPS_LABEL_TEXT_FONT, MPS_LABEL_TEXT_COLOR, gzMPSScreenText[MPS_AITEAM_TEXT], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
|
||||
// Draw Kills Column
|
||||
memset(szPlayerKills,0,4*sizeof(wchar_t));
|
||||
_itow(gMPPlayerStats[4].kills,szPlayerKills,10);
|
||||
DisplayWrappedString( MPS_LABEL_KILLS_X, usPosY, MPS_LABEL_KILLS_WIDTH, 2, MPS_LABEL_TEXT_FONT, MPS_LABEL_TEXT_COLOR, szPlayerKills, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
|
||||
// Draw Deaths Column
|
||||
memset(szPlayerDeaths,0,4*sizeof(wchar_t));
|
||||
_itow(gMPPlayerStats[4].deaths,szPlayerDeaths,10);
|
||||
DisplayWrappedString( MPS_LABEL_DEATHS_X, usPosY, MPS_LABEL_DEATHS_WIDTH, 2, MPS_LABEL_TEXT_FONT, MPS_LABEL_TEXT_COLOR, szPlayerDeaths, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
|
||||
// Draw Hits Column
|
||||
memset(szPlayerHits,0,4*sizeof(wchar_t));
|
||||
_itow(gMPPlayerStats[4].hits,szPlayerHits,10);
|
||||
DisplayWrappedString( MPS_LABEL_HITS_X, usPosY, MPS_LABEL_HITS_WIDTH, 2, MPS_LABEL_TEXT_FONT, MPS_LABEL_TEXT_COLOR, szPlayerHits, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
|
||||
// Draw Misses Column
|
||||
memset(szPlayerMisses,0,4*sizeof(wchar_t));
|
||||
_itow(gMPPlayerStats[4].misses,szPlayerMisses,10);
|
||||
DisplayWrappedString( MPS_LABEL_MISSES_X, usPosY, MPS_LABEL_MISSES_WIDTH, 2, MPS_LABEL_TEXT_FONT, MPS_LABEL_TEXT_COLOR, szPlayerMisses, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
|
||||
// Draw Accuracy Column
|
||||
if ( gMPPlayerStats[4].misses + gMPPlayerStats[4].hits > 0 )
|
||||
flAccuracy = ((float)gMPPlayerStats[4].hits / (float)(gMPPlayerStats[4].misses + gMPPlayerStats[4].hits)) * 100.0f;
|
||||
else
|
||||
flAccuracy = 0;
|
||||
memset(szPlayerAccuracy,0,8*sizeof(wchar_t));
|
||||
swprintf(szPlayerAccuracy,L"%i%%%%%%%%",(int)flAccuracy);
|
||||
DisplayWrappedString( MPS_LABEL_ACCURACY_X, usPosY, MPS_LABEL_ACCURACY_WIDTH, 2, MPS_LABEL_TEXT_FONT, MPS_LABEL_TEXT_COLOR, szPlayerAccuracy, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
}
|
||||
|
||||
// OJW - 20090403
|
||||
// Draw Please wait for server message
|
||||
if (!is_server)
|
||||
{
|
||||
if (!gfMPSScoreScreenCanContinue)
|
||||
DisplayWrappedString( MPS_BTN_CONTINUE_X, MPS_BTN_CONTINUE_Y, 100, 2, MPS_LABEL_TEXT_FONT, MPS_LABEL_TEXT_COLOR, gzMPSScreenText[MPS_WAITSERVER_TEXT], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
}
|
||||
|
||||
/*
|
||||
// Player name text label
|
||||
DisplayWrappedString( MPJ_LABEL_HANDLE_X, MPJ_LABEL_HANDLE_Y, MPJ_LABEL_HANDLE_WIDTH, 2, MPJ_LABEL_TEXT_FONT, MPJ_LABEL_TEXT_COLOR, gzMPJScreenText[ MPJ_HANDLE_TEXT ], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
|
||||
// Server IP text label
|
||||
DisplayWrappedString( MPJ_LABEL_IP_X, MPJ_LABEL_IP_Y, MPJ_LABEL_IP_WIDTH, 2, MPJ_LABEL_TEXT_FONT, MPJ_LABEL_TEXT_COLOR, gzMPJScreenText[ MPJ_SERVERIP_TEXT ], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
|
||||
// Server Port text label
|
||||
DisplayWrappedString( MPJ_LABEL_PORT_X, MPJ_LABEL_PORT_Y, MPJ_LABEL_PORT_WIDTH, 2, MPJ_LABEL_TEXT_FONT, MPJ_LABEL_TEXT_COLOR, gzMPJScreenText[ MPJ_SERVERPORT_TEXT ], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
*/
|
||||
return( TRUE );
|
||||
} // end of RenderMPSScreen()
|
||||
|
||||
|
||||
|
||||
void GetMPSScreenUserInput()
|
||||
{
|
||||
InputAtom Event;
|
||||
|
||||
while (DequeueSpecificEvent(&Event, KEY_DOWN|KEY_UP|KEY_REPEAT))
|
||||
{
|
||||
// check if this event is swallowed by text input, otherwise process key
|
||||
if( !HandleTextInput( &Event ) && Event.usEvent == KEY_DOWN )
|
||||
{
|
||||
switch( Event.usParam )
|
||||
{
|
||||
|
||||
case ESC:
|
||||
//Exit out of the screen
|
||||
gubMPSScreenHandler = MPS_CANCEL;
|
||||
break;
|
||||
|
||||
case ENTER:
|
||||
gubMPSScreenHandler = MPS_CONTINUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} // end of GetMPSScreenUserInput()
|
||||
|
||||
void DoneFadeOutForExitMPSScreen( void )
|
||||
{
|
||||
// As we bypassed the GIO screen, set up some game options for multiplayer here
|
||||
// <TODO> most things i have left as thier defaults here for testing.
|
||||
is_networked = true;
|
||||
|
||||
ReStartingGame();
|
||||
|
||||
if (is_client)
|
||||
{
|
||||
client_disconnect();
|
||||
}
|
||||
|
||||
if(is_server)
|
||||
{
|
||||
server_disconnect();
|
||||
}
|
||||
|
||||
//NetworkAutoStart will handle reconnection in Map Screen
|
||||
// reset client auto_retry for NetworkAutoStart called in MapScreenHandle
|
||||
auto_retry = true;
|
||||
giNumTries = 5;
|
||||
|
||||
if (is_networked)
|
||||
gGameOptions.fTurnTimeLimit = TRUE;
|
||||
else
|
||||
gGameOptions.fTurnTimeLimit = FALSE;
|
||||
|
||||
// Bobby Rays - why would we want anything less than the best
|
||||
gGameOptions.ubBobbyRayQuality = BR_AWESOME;
|
||||
gGameOptions.ubBobbyRayQuantity = BR_AWESOME;
|
||||
|
||||
gubMPSExitScreen = INTRO_SCREEN;
|
||||
|
||||
//set the fact that we should do the intro videos
|
||||
// gbIntroScreenMode = INTRO_BEGINING;
|
||||
#ifdef JA2TESTVERSION
|
||||
if( gfKeyState[ ALT ] )
|
||||
{
|
||||
if( gfKeyState[ CTRL ] )
|
||||
{
|
||||
gMercProfiles[ MIGUEL ].bMercStatus = MERC_IS_DEAD;
|
||||
gMercProfiles[ SKYRIDER ].bMercStatus = MERC_IS_DEAD;
|
||||
}
|
||||
|
||||
SetIntroType( INTRO_ENDING );
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
||||
#ifdef JA2UB
|
||||
//SetIntroType( INTRO_BEGINNING );
|
||||
#else
|
||||
SetIntroType( INTRO_BEGINNING );
|
||||
#endif
|
||||
|
||||
ExitMPSScreen(); // cleanup please, if we called a fadeout then we didnt do it above
|
||||
|
||||
SetCurrentCursorFromDatabase( VIDEO_NO_CURSOR );
|
||||
}
|
||||
|
||||
void DoneFadeInForExitMPSScreen( void )
|
||||
{
|
||||
SetCurrentCursorFromDatabase( VIDEO_NO_CURSOR );
|
||||
}
|
||||
|
||||
void BtnMPSCancelCallback(GUI_BUTTON *btn,INT32 reason)
|
||||
{
|
||||
if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN )
|
||||
{
|
||||
btn->uiFlags |= BUTTON_CLICKED_ON;
|
||||
InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY);
|
||||
}
|
||||
if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
|
||||
{
|
||||
btn->uiFlags &= (~BUTTON_CLICKED_ON );
|
||||
|
||||
gubMPSScreenHandler = MPS_CANCEL;
|
||||
|
||||
InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void BtnMPSContinueCallback(GUI_BUTTON *btn,INT32 reason)
|
||||
{
|
||||
if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN )
|
||||
{
|
||||
btn->uiFlags |= BUTTON_CLICKED_ON;
|
||||
InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY);
|
||||
}
|
||||
if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
|
||||
{
|
||||
btn->uiFlags &= (~BUTTON_CLICKED_ON );
|
||||
|
||||
gubMPSScreenHandler = MPS_CONTINUE;
|
||||
|
||||
|
||||
InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
#ifndef _MP_SCORE_SCREEN_H_
|
||||
#define _MP_SCORE_SCREEN_H_
|
||||
|
||||
|
||||
UINT32 MPScoreScreenInit( void );
|
||||
UINT32 MPScoreScreenHandle( void );
|
||||
UINT32 MPScoreScreenShutdown( void );
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,251 @@
|
||||
#include "MPXmlTeams.hpp"
|
||||
#include "sgp.h"
|
||||
#include "FileMan.h"
|
||||
#include "expat.h"
|
||||
#include "XML.h"
|
||||
#include "random.h"
|
||||
#include <cstdio>
|
||||
|
||||
MultiplayerTeams mpTeams = MultiplayerTeams();
|
||||
|
||||
// fallback data
|
||||
const int MultiplayerTeams::random_merc_teams[NUM_RANDOM_MERC_TEAMS][RANDOM_MERC_TEAM_SIZE] = {
|
||||
{ 16, 10, 19, 25, 4 , 11, 39 }, // Gus , Shadow, Spider , Raven , Vicki , Red , Meltdown
|
||||
{ 29, 36, 28, 2 , 22, 8 , 32 }, // Magic , Scope, Danny , Lynx , Hitman , Steroid , Malice
|
||||
{ 12, 5, 20, 23, 48, 34, 17 }, // Reaper , Trevor, Cliff , Buzz , Cougar , Nails , Buns
|
||||
{ 31, 7, 33, 35, 27, 37, 1 }, // Scully , Ivan , Dr Q , Thor , Len , Wolf , Blood
|
||||
};
|
||||
|
||||
void MultiplayerTeams::SerializeProfiles(int* dest)
|
||||
{
|
||||
int id;
|
||||
int r = Random(teams.size());
|
||||
|
||||
// if team is already used, choose next
|
||||
while (teamsTaken.at(r))
|
||||
{
|
||||
r++;
|
||||
if (r == teams.size())
|
||||
r = 0;
|
||||
}
|
||||
|
||||
teamsTaken.at(r) = true;
|
||||
id = r;
|
||||
|
||||
this->SerializeProfiles(dest, id);
|
||||
}
|
||||
|
||||
void MultiplayerTeams::SerializeProfiles(int* dest, int teamID)
|
||||
{
|
||||
teamID = teamID % this->teams.size();
|
||||
for (int i = 0; i < RANDOM_MERC_TEAM_SIZE; i++)
|
||||
{
|
||||
// poor man's memcpy
|
||||
*dest = teams.at(teamID).members.at(i);
|
||||
dest++;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void MultiplayerTeams::HandleServerStarted()
|
||||
{
|
||||
// reset
|
||||
teamsTaken = std::vector<bool>(teams.size(), false);
|
||||
}
|
||||
|
||||
void MultiplayerTeams::UseFallbackDataIfNecessary()
|
||||
{
|
||||
for (size_t team = 0; team < max(NUM_RANDOM_MERC_TEAMS, teams.size()); team++)
|
||||
{
|
||||
if (teams.size() <= team)
|
||||
{
|
||||
// create teams 1-4
|
||||
teams.push_back(MPTeam());
|
||||
}
|
||||
|
||||
// fill any empty merc slots
|
||||
for (int merc = teams.at(team).members.size(); merc < RANDOM_MERC_TEAM_SIZE; merc++)
|
||||
{
|
||||
teams.at(team).members.push_back(MultiplayerTeams::random_merc_teams[team%NUM_RANDOM_MERC_TEAMS][merc]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN MultiplayerTeams::ReadInMPTeams(STR fileName)
|
||||
{
|
||||
BOOLEAN result = this->ReadXMLFile(fileName);
|
||||
this->UseFallbackDataIfNecessary();
|
||||
return result;
|
||||
}
|
||||
|
||||
BOOLEAN MultiplayerTeams::ReadXMLFile(STR fileName)
|
||||
{
|
||||
|
||||
HWFILE hFile;
|
||||
UINT32 uiBytesRead;
|
||||
UINT32 uiFSize;
|
||||
CHAR8 *lpcBuffer;
|
||||
|
||||
|
||||
CHAR8 msg[128];
|
||||
sprintf(msg, "Loading %s", fileName);
|
||||
DebugMsg(TOPIC_JA2, DBG_LEVEL_3, msg);
|
||||
|
||||
if(!FileExists(fileName))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// open file
|
||||
hFile = FileOpen(fileName, FILE_ACCESS_READ, FALSE);
|
||||
if (!hFile)
|
||||
{
|
||||
// this might issue an error in the caller
|
||||
// but we can proceed, actually
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
uiFSize = FileGetSize(hFile);
|
||||
lpcBuffer = (CHAR*) MemAlloc(uiFSize);
|
||||
|
||||
// read in block
|
||||
if (!FileRead(hFile, lpcBuffer, uiFSize, &uiBytesRead))
|
||||
{
|
||||
MemFree(lpcBuffer);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
FileClose(hFile);
|
||||
|
||||
XML_Parser parser = XML_ParserCreate(NULL);
|
||||
struct teamsParseData parseData = { };
|
||||
parseData.mpTeams = this;
|
||||
|
||||
XML_SetElementHandler(parser, &MultiplayerTeams::teamsStartElementHandler, &MultiplayerTeams::teamsEndElementHandler);
|
||||
XML_SetCharacterDataHandler(parser, this->teamsCharacterDataHandler);
|
||||
XML_SetUserData(parser, &parseData);
|
||||
|
||||
|
||||
if (this->initialized)
|
||||
this->TrashTeams();
|
||||
|
||||
if (!XML_Parse(parser, lpcBuffer, uiFSize, TRUE))
|
||||
{
|
||||
// Cannot load, but that's okay. There is fallback data.
|
||||
MemFree(lpcBuffer);
|
||||
XML_ParserFree(parser);
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
this->initialized = true;
|
||||
|
||||
|
||||
MemFree(lpcBuffer);
|
||||
|
||||
XML_ParserFree(parser);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
MultiplayerTeams::MultiplayerTeams()
|
||||
{
|
||||
this->initialized = false;
|
||||
}
|
||||
|
||||
MultiplayerTeams::~MultiplayerTeams()
|
||||
{
|
||||
}
|
||||
|
||||
void MultiplayerTeams::TrashTeams()
|
||||
{
|
||||
this->teams.clear();
|
||||
this->initialized = false;
|
||||
}
|
||||
|
||||
void XMLCALL MultiplayerTeams::teamsStartElementHandler(void *userData, const XML_Char *name, const XML_Char **atts)
|
||||
{
|
||||
struct teamsParseData * pData = (struct teamsParseData *)userData;
|
||||
|
||||
if (pData->currentDepth <= pData->maxReadDepth)
|
||||
{
|
||||
if (!strcmp(name, "mp_teams") && pData->curElement == ELEMENT_NONE)
|
||||
{
|
||||
// root element
|
||||
pData->curElement = ELEMENT_LIST;
|
||||
pData->maxReadDepth++;
|
||||
}
|
||||
else if (!strcmp(name, "team") && pData->curElement == ELEMENT_LIST)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
MPTeam team = MPTeam();
|
||||
|
||||
if (atts[0] && !strcmp(atts[0], "name"))
|
||||
{
|
||||
team.name = std::string(atts[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
team.name = std::string("unnamed team");
|
||||
}
|
||||
|
||||
pData->mpTeams->teams.push_back(team);
|
||||
|
||||
pData->maxReadDepth++;
|
||||
}
|
||||
else if (!strcmp(name, "id"))
|
||||
{
|
||||
pData->curElement = ELEMENT_PROPERTY;
|
||||
pData->maxReadDepth++;
|
||||
}
|
||||
|
||||
pData->szCharData[0] = '\0';
|
||||
}
|
||||
|
||||
pData->currentDepth++;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void XMLCALL MultiplayerTeams::teamsEndElementHandler(void *userData, const XML_Char *name)
|
||||
{
|
||||
struct teamsParseData *pData = (struct teamsParseData *)userData;
|
||||
|
||||
if (pData->currentDepth <= pData->maxReadDepth)
|
||||
{
|
||||
if (!strcmp(name, "mp_teams"))
|
||||
{
|
||||
pData->curElement = ELEMENT_NONE;
|
||||
}
|
||||
else if (!strcmp(name, "team"))
|
||||
{
|
||||
pData->curElement = ELEMENT_LIST;
|
||||
}
|
||||
else if(!strcmp(name, "id"))
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
|
||||
INT8 id = atoi(pData->szCharData);
|
||||
pData->mpTeams->teams.back().members.push_back(id);
|
||||
}
|
||||
|
||||
pData->maxReadDepth--;
|
||||
}
|
||||
|
||||
pData->currentDepth--;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void XMLCALL MultiplayerTeams::teamsCharacterDataHandler(void *userData, const XML_Char *s, int len)
|
||||
{
|
||||
struct teamsParseData *pData = (struct teamsParseData *)userData;
|
||||
|
||||
if ((pData->currentDepth <= pData->maxReadDepth)
|
||||
&& (strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH))
|
||||
{
|
||||
strncat(pData->szCharData, s, __min((unsigned int)len, MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData)));
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
#ifndef MPXMLTEAMS_HPP
|
||||
#define MPXMLTEAMS_HPP
|
||||
|
||||
#include "types.h"
|
||||
#include "XML.h"
|
||||
#include "expat.h"
|
||||
#include <vector>
|
||||
|
||||
|
||||
#define NUM_RANDOM_MERC_TEAMS 4
|
||||
#define RANDOM_MERC_TEAM_SIZE 7
|
||||
|
||||
/* MPTeams.xml structure:
|
||||
|
||||
- name attribute is optional and not used anywhere yet
|
||||
|
||||
<mp_teams>
|
||||
<team name="team1">
|
||||
<id>42</id>
|
||||
<id>23</id>
|
||||
...
|
||||
</team>
|
||||
<team>
|
||||
<id>97</id>
|
||||
...
|
||||
</team>
|
||||
...
|
||||
</mp_teams>
|
||||
*/
|
||||
|
||||
class MultiplayerTeams
|
||||
{
|
||||
private:
|
||||
struct MPTeam
|
||||
{
|
||||
std::string name;
|
||||
std::vector<int> members;
|
||||
};
|
||||
|
||||
public:
|
||||
BOOLEAN ReadInMPTeams(STR fileName);
|
||||
void HandleServerStarted();
|
||||
|
||||
MultiplayerTeams();
|
||||
~MultiplayerTeams();
|
||||
|
||||
void SerializeProfiles(int* dest);
|
||||
void SerializeProfiles(int* dest, int teamID);
|
||||
|
||||
|
||||
private:
|
||||
std::vector< MPTeam > teams;
|
||||
std::vector<bool> teamsTaken;
|
||||
bool initialized;
|
||||
|
||||
BOOLEAN ReadXMLFile(STR fileName);
|
||||
void UseFallbackDataIfNecessary();
|
||||
void TrashTeams();
|
||||
|
||||
static void XMLCALL teamsStartElementHandler(void *userData, const XML_Char *name, const XML_Char **atts);
|
||||
static void XMLCALL teamsEndElementHandler(void *userData, const XML_Char *name);
|
||||
static void XMLCALL teamsCharacterDataHandler(void *userData, const XML_Char *s, int len);
|
||||
|
||||
struct teamsParseData
|
||||
{
|
||||
PARSE_STAGE curElement;
|
||||
CHAR8 szCharData[MAX_CHAR_DATA_LENGTH+1];
|
||||
|
||||
UINT32 currentDepth;
|
||||
UINT32 maxReadDepth;
|
||||
|
||||
MultiplayerTeams *mpTeams;
|
||||
};
|
||||
|
||||
static const int random_merc_teams[NUM_RANDOM_MERC_TEAMS][RANDOM_MERC_TEAM_SIZE];
|
||||
};
|
||||
|
||||
// make global
|
||||
extern MultiplayerTeams mpTeams;
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,900 @@
|
||||
#include "sgp.h"
|
||||
#include "screenids.h"
|
||||
#include "Timer Control.h"
|
||||
#include "sysutil.h"
|
||||
#include "vobject_blitters.h"
|
||||
#include "MercTextBox.h"
|
||||
#include "cursors.h"
|
||||
#include "font control.h"
|
||||
#include "mainmenuscreen.h"
|
||||
#include "cursor control.h"
|
||||
#include "render dirty.h"
|
||||
#include "music control.h"
|
||||
#include "GameSettings.h"
|
||||
#include "SaveLoadScreen.h"
|
||||
#include "SaveLoadGame.h"
|
||||
#include "Options Screen.h"
|
||||
#include "English.h"
|
||||
#include "Gameloop.h"
|
||||
#include "Game Init.h"
|
||||
#include "Utilities.h"
|
||||
#include "WordWrap.h"
|
||||
#include "Font Control.h"
|
||||
#include "text.h"
|
||||
#include "Multi Language Graphic Utils.h"
|
||||
#include "Encrypted File.h"
|
||||
#include "ja2 splash.h"
|
||||
#include "GameVersion.h"
|
||||
|
||||
#include "gamesettings.h"
|
||||
#include "connect.h"
|
||||
#include "strategic.h"
|
||||
#include "strategic movement.h"
|
||||
#include "overhead.h"
|
||||
#include "init.h"
|
||||
#include "xml.h"
|
||||
#include <vfs/Core/vfs.h>
|
||||
#include <vfs/Core/vfs_profile.h>
|
||||
|
||||
#ifdef JA2UB
|
||||
#include "ub_config.h"
|
||||
#endif
|
||||
|
||||
#define MAINMENU_TEXT_FILE "LoadScreens\\MainMenu.edt"
|
||||
#define MAINMENU_RECORD_SIZE 80 * 2
|
||||
|
||||
//externals
|
||||
extern HVSURFACE ghFrameBuffer;
|
||||
extern HVSURFACE ghBackBuffer;
|
||||
// MENU ITEMS
|
||||
enum
|
||||
{
|
||||
NEW_GAME,
|
||||
NEW_MP_GAME,
|
||||
LOAD_GAME,
|
||||
PREFERENCES,
|
||||
CREDITS,
|
||||
QUIT,
|
||||
NUM_MENU_ITEMS
|
||||
};
|
||||
|
||||
UINT32 MAINMENU_Y;
|
||||
UINT32 MAINMENU_X;
|
||||
UINT32 MAINMENU_Y_SPACE;
|
||||
|
||||
INT32 iMenuImages[ NUM_MENU_ITEMS ];
|
||||
INT32 iMenuButtons[ NUM_MENU_ITEMS ];
|
||||
|
||||
UINT16 gusMainMenuButtonWidths[ NUM_MENU_ITEMS ];
|
||||
|
||||
MOUSE_REGION gBackRegion;
|
||||
INT8 gbHandledMainMenu = 0;
|
||||
BOOLEAN fInitialRender = FALSE;
|
||||
|
||||
BOOLEAN gfMainMenuScreenEntry = FALSE;
|
||||
BOOLEAN gfMainMenuScreenExit = FALSE;
|
||||
|
||||
UINT32 guiMainMenuExitScreen = MAINMENU_SCREEN;
|
||||
|
||||
extern BOOLEAN gfLoadGameUponEntry;
|
||||
|
||||
void ExitMainMenu( );
|
||||
void MenuButtonCallback(GUI_BUTTON *btn, INT32 reason);
|
||||
void HandleMainMenuKeyboardInput();
|
||||
void HandleMainMenuInput();
|
||||
void HandleMainMenuScreen();
|
||||
void DisplayAssignmentText();
|
||||
void ClearMainMenu();
|
||||
void SelectMainMenuBackGroundRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason );
|
||||
void SetMainMenuExitScreen( UINT32 uiNewScreen );
|
||||
void CreateDestroyBackGroundMouseMask( BOOLEAN fCreate );
|
||||
BOOLEAN CreateDestroyMainMenuButtons( BOOLEAN fCreate );
|
||||
void RenderMainMenu();
|
||||
void RestoreButtonBackGrounds();
|
||||
|
||||
//Main Menu layout by Jazz
|
||||
MAIN_MENU_VALUES gMainMenulayout[MAX_MAIN_MENU_IMAGE];
|
||||
//VSURFACE_DESC vs_desc;
|
||||
|
||||
extern void InitSightRange(); //lal
|
||||
|
||||
UINT32 MainMenuScreenInit( )
|
||||
{
|
||||
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Product: %S", zProductLabel ));
|
||||
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Version: %s", czVersionString ));
|
||||
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Build: %S", zBuildInformation ));
|
||||
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
UINT32 MainMenuScreenHandle( )
|
||||
{
|
||||
UINT32 cnt;
|
||||
UINT32 uiTime;
|
||||
|
||||
if( guiSplashStartTime + 4000 > GetJA2Clock() )
|
||||
{
|
||||
SetCurrentCursorFromDatabase( VIDEO_NO_CURSOR );
|
||||
SetMusicMode( MUSIC_NONE );
|
||||
return MAINMENU_SCREEN; //The splash screen hasn't been up long enough yet.
|
||||
}
|
||||
if( guiSplashFrameFade )
|
||||
{
|
||||
uiTime = GetJA2Clock();
|
||||
if( guiSplashFrameFade > 2 )
|
||||
ShadowVideoSurfaceRectUsingLowPercentTable( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT );
|
||||
else if( guiSplashFrameFade > 1 )
|
||||
ColorFillVideoSurfaceArea( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0 );
|
||||
else
|
||||
{
|
||||
uiTime = GetJA2Clock();
|
||||
SetMusicMode( MUSIC_MAIN_MENU );
|
||||
}
|
||||
|
||||
guiSplashFrameFade--;
|
||||
|
||||
InvalidateScreen();
|
||||
EndFrameBufferRender();
|
||||
|
||||
SetCurrentCursorFromDatabase( VIDEO_NO_CURSOR );
|
||||
|
||||
return MAINMENU_SCREEN;
|
||||
}
|
||||
|
||||
SetCurrentCursorFromDatabase( CURSOR_NORMAL );
|
||||
|
||||
if( gfMainMenuScreenEntry )
|
||||
{
|
||||
InitMainMenu( );
|
||||
gfMainMenuScreenEntry = FALSE;
|
||||
gfMainMenuScreenExit = FALSE;
|
||||
guiMainMenuExitScreen = MAINMENU_SCREEN;
|
||||
SetMusicMode( MUSIC_MAIN_MENU );
|
||||
}
|
||||
|
||||
if ( fInitialRender )
|
||||
{
|
||||
ClearMainMenu();
|
||||
RenderMainMenu();
|
||||
|
||||
fInitialRender = FALSE;
|
||||
}
|
||||
|
||||
RestoreButtonBackGrounds();
|
||||
|
||||
// Render buttons
|
||||
for ( cnt = 0; cnt < NUM_MENU_ITEMS; cnt++ )
|
||||
{
|
||||
MarkAButtonDirty( iMenuButtons[ cnt ] );
|
||||
}
|
||||
|
||||
RenderButtons( );
|
||||
|
||||
EndFrameBufferRender( );
|
||||
|
||||
HandleMainMenuKeyboardInput();
|
||||
HandleMainMenuScreen();
|
||||
|
||||
if( gfMainMenuScreenExit )
|
||||
{
|
||||
ExitMainMenu( );
|
||||
gfMainMenuScreenExit = FALSE;
|
||||
gfMainMenuScreenEntry = TRUE;
|
||||
}
|
||||
|
||||
if( guiMainMenuExitScreen != MAINMENU_SCREEN )
|
||||
gfMainMenuScreenEntry = TRUE;
|
||||
|
||||
return( guiMainMenuExitScreen );
|
||||
}
|
||||
|
||||
UINT32 MainMenuScreenShutdown( )
|
||||
{
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
void HandleMainMenuScreen()
|
||||
{
|
||||
if ( gbHandledMainMenu != 0 )
|
||||
{
|
||||
// Exit according to handled value!
|
||||
switch( gbHandledMainMenu )
|
||||
{
|
||||
case QUIT:
|
||||
gfMainMenuScreenExit = TRUE;
|
||||
gfProgramIsRunning = FALSE;
|
||||
break;
|
||||
|
||||
case NEW_GAME:
|
||||
break;
|
||||
|
||||
case NEW_MP_GAME:
|
||||
break;
|
||||
|
||||
case LOAD_GAME:
|
||||
// Select the game which is to be restored
|
||||
SetOptionsPreviousScreen(guiCurrentScreen);
|
||||
guiMainMenuExitScreen = SAVE_LOAD_SCREEN;
|
||||
gbHandledMainMenu = 0;
|
||||
gfSaveGame = FALSE;
|
||||
gfMainMenuScreenExit = TRUE;
|
||||
break;
|
||||
|
||||
case PREFERENCES:
|
||||
SetOptionsPreviousScreen(guiCurrentScreen);
|
||||
guiMainMenuExitScreen = OPTIONS_SCREEN;
|
||||
gbHandledMainMenu = 0;
|
||||
gfMainMenuScreenExit = TRUE;
|
||||
break;
|
||||
|
||||
case CREDITS:
|
||||
guiMainMenuExitScreen = CREDIT_SCREEN;
|
||||
gbHandledMainMenu = 0;
|
||||
gfMainMenuScreenExit = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BOOLEAN InitMainMenu( )
|
||||
{
|
||||
//VOBJECT_DESC VObjectDesc;
|
||||
VSURFACE_DESC vs_desc = {};
|
||||
|
||||
//main Menu by JAzz
|
||||
UINT16 iCounter2;
|
||||
|
||||
if(is_networked)
|
||||
{
|
||||
is_networked = FALSE;
|
||||
|
||||
// remove Multiplayer profile if it exists
|
||||
vfs::CProfileStack *PS = getVFS()->getProfileStack();
|
||||
vfs::CVirtualProfile *pProf = PS->getProfile("_MULTIPLAYER");
|
||||
if( pProf && (pProf == PS->topProfile()) )
|
||||
{
|
||||
SGP_THROW_IFFALSE(PS->popProfile(), "Leaving Multiplayer mode : Could not remove \"_MULTIPLAYER\" profile");
|
||||
}
|
||||
|
||||
// Snap: UN-Init MP save game directory
|
||||
if ( !InitSaveDir() )
|
||||
{
|
||||
//if something didnt work, dont even know how to make error code...//hayden
|
||||
}
|
||||
}
|
||||
|
||||
//Check to see whatr saved game files exist
|
||||
InitSaveGameArray();
|
||||
|
||||
//Create the background mouse mask
|
||||
CreateDestroyBackGroundMouseMask( TRUE );
|
||||
|
||||
CreateDestroyMainMenuButtons( TRUE );
|
||||
|
||||
// load background graphic and add it
|
||||
//Main Menu by Jazz
|
||||
for( iCounter2 = 1; iCounter2 < MAX_ELEMENT; iCounter2++ )
|
||||
{
|
||||
//VObjectDesc.fCreateFlags = VSURFACE_CREATE_FROMFILE;
|
||||
vs_desc.fCreateFlags = VSURFACE_CREATE_FROMFILE | VSURFACE_SYSTEM_MEM_USAGE | VSURFACE_CREATE_FROMPNG_FALLBACK;
|
||||
|
||||
if (gMainMenulayout[iCounter2].Visible == 1)
|
||||
{
|
||||
strcpy(vs_desc.ImageFile, gMainMenulayout[iCounter2].FileName);
|
||||
|
||||
if( !AddVideoSurface( &vs_desc, &gMainMenulayout[iCounter2].uiIndex ) )
|
||||
AssertMsg(0, String( "Missing %s", gMainMenulayout[iCounter2].FileName ) );
|
||||
|
||||
|
||||
//if (iResolution >= _640x480 && iResolution < _800x600)
|
||||
//{
|
||||
// strcpy(VObjectDesc.ImageFile, gMainMenulayout[iCounter2].FileName);
|
||||
|
||||
// if( !AddVideoObject( &VObjectDesc, &gMainMenulayout[iCounter2].uiIndex ) )
|
||||
// AssertMsg(0, String( "Missing %s", gMainMenulayout[iCounter2].FileName ) );
|
||||
//}
|
||||
//else if (iResolution < _1024x768)
|
||||
//{
|
||||
// strcpy(VObjectDesc.ImageFile, gMainMenulayout[iCounter2].FileName800x600);
|
||||
|
||||
// if( !AddVideoObject( &VObjectDesc, &gMainMenulayout[iCounter2].uiIndex ) )
|
||||
// AssertMsg(0, String( "Missing %s", gMainMenulayout[iCounter2].FileName800x600 ) );
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// strcpy(VObjectDesc.ImageFile, gMainMenulayout[iCounter2].FileName1024x768);
|
||||
|
||||
// if( !AddVideoObject( &VObjectDesc, &gMainMenulayout[iCounter2].uiIndex ) )
|
||||
// AssertMsg(0, String( "Missing %s", gMainMenulayout[iCounter2].FileName1024x768 ) );
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
//if there are no saved games, disable the button
|
||||
if( !IsThereAnySavedGameFiles() )
|
||||
DisableButton( iMenuButtons[ LOAD_GAME ] );
|
||||
|
||||
|
||||
#ifdef JA113DEMO
|
||||
DisableButton( iMenuButtons[ NEW_MP_GAME ] );
|
||||
#endif
|
||||
|
||||
gbHandledMainMenu = 0;
|
||||
fInitialRender = TRUE;
|
||||
|
||||
SetPendingNewScreen( MAINMENU_SCREEN);
|
||||
guiMainMenuExitScreen = MAINMENU_SCREEN;
|
||||
|
||||
DequeueAllKeyBoardEvents();
|
||||
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
|
||||
void ExitMainMenu( )
|
||||
{
|
||||
UINT32 iCounter2 ;
|
||||
|
||||
CreateDestroyBackGroundMouseMask( FALSE );
|
||||
CreateDestroyMainMenuButtons( FALSE );
|
||||
|
||||
for( iCounter2 = 1; iCounter2 < MAX_ELEMENT; iCounter2++ )
|
||||
{
|
||||
if (gMainMenulayout[iCounter2].Visible == 1)
|
||||
{
|
||||
// WANNE: This is a dirty fix. I don't know when that was introduced, but when clicking on "Multiplayer Game", the game crashes when trying to call DeleteVideoSurfaceFromIndex()
|
||||
if (is_networked && iCounter2 == 1)
|
||||
continue;
|
||||
|
||||
// DeleteVideoObjectFromIndex( gMainMenulayout[iCounter2].uiIndex );
|
||||
DeleteVideoSurfaceFromIndex( gMainMenulayout[iCounter2].uiIndex );
|
||||
}
|
||||
}
|
||||
|
||||
gMsgBox.uiExitScreen = MAINMENU_SCREEN;
|
||||
}
|
||||
|
||||
// WANNE - MP: This method initializes variables that should be initialized
|
||||
// differently for single and multiplayer
|
||||
void InitDependingGameStyleOptions()
|
||||
{
|
||||
// Yes, also initialize these ones, because of SP and MP game!
|
||||
InitStrategicEngine();
|
||||
InitStrategicMovementCosts();
|
||||
InitializeFaceGearGraphics();
|
||||
|
||||
// WANNE: Initialize again, because if differs from SP to MP game!
|
||||
LoadGameSettings();
|
||||
|
||||
FreeGameExternalOptions();
|
||||
|
||||
// Load APBPConstants.ini
|
||||
LoadGameAPBPConstants();
|
||||
// Load ja2_options.ini
|
||||
LoadGameExternalOptions();
|
||||
// Load feature flags after external options, since it overwrites them (if enabled)
|
||||
LoadFeatureFlags();
|
||||
// Load new STOMP ini - SANDRO
|
||||
LoadSkillTraitsExternalSettings();
|
||||
// HEADROCK HAM 4: CTH constants
|
||||
LoadCTHConstants();
|
||||
// Load externalised taunts settings
|
||||
LoadTauntsSettings();
|
||||
// Load helicopter repair settings
|
||||
LoadHelicopterRepairRefuelSettings();
|
||||
// Load externalised morale settings
|
||||
LoadMoraleSettings();
|
||||
// Load externalised reputation settings
|
||||
LoadReputationSettings();
|
||||
// Load creatures settings
|
||||
LoadCreaturesSettings();
|
||||
// Load rebel command settings
|
||||
LoadRebelCommandSettings();
|
||||
|
||||
#ifdef JA2UB
|
||||
LoadGameUBOptions(); // JA25 UB
|
||||
#endif
|
||||
|
||||
InitSightRange(); //lal
|
||||
|
||||
ReStartingGame();
|
||||
}
|
||||
|
||||
|
||||
// WANNE - MP: In this method we decide if we want to play a single or multiplayer game
|
||||
void MenuButtonCallback(GUI_BUTTON *btn,INT32 reason)
|
||||
{
|
||||
INT8 bID;
|
||||
|
||||
bID = (UINT8)btn->UserData[0];
|
||||
|
||||
if (!(btn->uiFlags & BUTTON_ENABLED))
|
||||
return;
|
||||
|
||||
if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
|
||||
{
|
||||
// handle menu
|
||||
gbHandledMainMenu = bID;
|
||||
RenderMainMenu();
|
||||
|
||||
HandleMainMenuInput();
|
||||
|
||||
btn->uiFlags &= (~BUTTON_CLICKED_ON );
|
||||
}
|
||||
if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN )
|
||||
{
|
||||
RenderMainMenu();
|
||||
btn->uiFlags |= BUTTON_CLICKED_ON;
|
||||
}
|
||||
}
|
||||
|
||||
void MenuButtonMoveCallback(GUI_BUTTON *btn,INT32 reason)
|
||||
{
|
||||
if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE)
|
||||
{
|
||||
RenderMainMenu();
|
||||
InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY);
|
||||
}
|
||||
if(reason & MSYS_CALLBACK_REASON_GAIN_MOUSE)
|
||||
{
|
||||
RenderMainMenu();
|
||||
InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY);
|
||||
}
|
||||
}
|
||||
|
||||
void HandleMainMenuKeyboardInput()
|
||||
{
|
||||
InputAtom InputEvent;
|
||||
|
||||
// Check for esc
|
||||
while (DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT))
|
||||
{
|
||||
if( InputEvent.usEvent == KEY_UP )
|
||||
{
|
||||
switch( InputEvent.usParam )
|
||||
{
|
||||
//#ifdef JA2TESTVERSION
|
||||
|
||||
case 'n':
|
||||
gbHandledMainMenu = NEW_GAME;
|
||||
HandleMainMenuInput();
|
||||
break;
|
||||
|
||||
case 'm':
|
||||
gbHandledMainMenu = NEW_MP_GAME;
|
||||
HandleMainMenuInput();
|
||||
break;
|
||||
|
||||
case 'i':
|
||||
SetPendingNewScreen( INTRO_SCREEN );
|
||||
gfMainMenuScreenExit = TRUE;
|
||||
break;
|
||||
//#endif
|
||||
case 'c':
|
||||
gbHandledMainMenu = LOAD_GAME;
|
||||
HandleMainMenuInput();
|
||||
break;
|
||||
|
||||
case 'o':
|
||||
gbHandledMainMenu = PREFERENCES;
|
||||
HandleMainMenuInput();
|
||||
break;
|
||||
|
||||
case 's':
|
||||
gbHandledMainMenu = CREDITS;
|
||||
HandleMainMenuInput();
|
||||
break;
|
||||
|
||||
case 'q':
|
||||
gbHandledMainMenu = QUIT;
|
||||
HandleMainMenuInput();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void HandleMainMenuInput()
|
||||
{
|
||||
switch( gbHandledMainMenu )
|
||||
{
|
||||
case NEW_GAME:
|
||||
giMAXIMUM_NUMBER_OF_PLAYER_SLOTS = CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS;
|
||||
if(is_networked)
|
||||
{
|
||||
is_networked = FALSE;
|
||||
// Snap: UN-Init MP save game directory
|
||||
if ( !InitSaveDir() )
|
||||
{
|
||||
//if something didnt work, dont even know how to make error code...//hayden
|
||||
}
|
||||
};
|
||||
|
||||
SetMainMenuExitScreen( GAME_INIT_OPTIONS_SCREEN );
|
||||
|
||||
InitDependingGameStyleOptions();
|
||||
break;
|
||||
|
||||
case NEW_MP_GAME:
|
||||
is_networked = TRUE;
|
||||
|
||||
// WANNE - MP: Only reset this here, because otherwise after a MP game ends and a new starts, we would receive the files again.
|
||||
fClientReceivedAllFiles = FALSE;
|
||||
|
||||
giMAXIMUM_NUMBER_OF_PLAYER_SLOTS = 7;
|
||||
|
||||
// Snap: Re-Init MP save game directory
|
||||
if ( !InitSaveDir() )
|
||||
{
|
||||
|
||||
//if something didnt work, dont even know how to make error code...//hayden
|
||||
}
|
||||
|
||||
// WANNE: Removed, cause I don't think it is needed if we only want to play a multiplayer game!
|
||||
// Reload the external gameplay data, because maybe we started a MP game before!
|
||||
//LoadExternalGameplayData(TABLEDATA_DIRECTORY);
|
||||
|
||||
SetMainMenuExitScreen( MP_JOIN_SCREEN ); // OJW - 20081129
|
||||
//SetMainMenuExitScreen( GAME_INIT_OPTIONS_SCREEN );
|
||||
|
||||
InitDependingGameStyleOptions();
|
||||
break;
|
||||
|
||||
case LOAD_GAME:
|
||||
giMAXIMUM_NUMBER_OF_PLAYER_SLOTS = CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS;
|
||||
if(is_networked)
|
||||
{
|
||||
is_networked = FALSE;
|
||||
// Snap: UN-Init MP save game directory
|
||||
if ( !InitSaveDir() )
|
||||
{
|
||||
|
||||
//if something didnt work, dont even know how to make error code...//hayden
|
||||
}
|
||||
}
|
||||
|
||||
if( gfKeyState[ ALT ] )
|
||||
gfLoadGameUponEntry = TRUE;
|
||||
|
||||
InitDependingGameStyleOptions();
|
||||
break;
|
||||
|
||||
}
|
||||
// Buggler: subsequent code execution is in HandleMainMenuScreen()
|
||||
}
|
||||
|
||||
|
||||
void ClearMainMenu()
|
||||
{
|
||||
UINT32 uiDestPitchBYTES;
|
||||
UINT8 *pDestBuf;
|
||||
|
||||
// CLEAR THE FRAME BUFFER
|
||||
pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES );
|
||||
memset(pDestBuf, 0, SCREEN_HEIGHT * uiDestPitchBYTES );
|
||||
UnLockVideoSurface( FRAME_BUFFER );
|
||||
InvalidateScreen( );
|
||||
}
|
||||
|
||||
|
||||
void SelectMainMenuBackGroundRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason )
|
||||
{
|
||||
if (iReason & MSYS_CALLBACK_REASON_INIT)
|
||||
{
|
||||
}
|
||||
else if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP)
|
||||
{
|
||||
}
|
||||
else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
void SetMainMenuExitScreen( UINT32 uiNewScreen )
|
||||
{
|
||||
guiMainMenuExitScreen = uiNewScreen;
|
||||
|
||||
//REmove the background region
|
||||
CreateDestroyBackGroundMouseMask( FALSE );
|
||||
|
||||
gfMainMenuScreenExit = TRUE;
|
||||
}
|
||||
|
||||
|
||||
void CreateDestroyBackGroundMouseMask( BOOLEAN fCreate )
|
||||
{
|
||||
static BOOLEAN fRegionCreated = FALSE;
|
||||
|
||||
if( fCreate )
|
||||
{
|
||||
if( fRegionCreated )
|
||||
return;
|
||||
|
||||
// Make a mouse region
|
||||
MSYS_DefineRegion( &(gBackRegion), 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, MSYS_PRIORITY_HIGHEST,
|
||||
CURSOR_NORMAL, MSYS_NO_CALLBACK, SelectMainMenuBackGroundRegionCallBack );
|
||||
// Add region
|
||||
MSYS_AddRegion(&(gBackRegion) );
|
||||
|
||||
fRegionCreated = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( !fRegionCreated )
|
||||
return;
|
||||
|
||||
MSYS_RemoveRegion( &gBackRegion );
|
||||
fRegionCreated = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN CreateDestroyMainMenuButtons( BOOLEAN fCreate )
|
||||
{
|
||||
static BOOLEAN fButtonsCreated = FALSE;
|
||||
INT32 cnt;
|
||||
SGPFILENAME filename;
|
||||
SGPFILENAME filenameMP;
|
||||
INT16 sSlot;
|
||||
|
||||
MAINMENU_X = SCREEN_WIDTH * gMainMenulayout[0].MAINMENU_X / 640;
|
||||
MAINMENU_Y = SCREEN_HEIGHT * gMainMenulayout[0].MAINMENU_Y / 480;
|
||||
MAINMENU_Y_SPACE = gMainMenulayout[0].MAINMENU_Y_SPACE;
|
||||
|
||||
//if (iResolution >= _640x480 && iResolution < _800x600)
|
||||
//{
|
||||
// MAINMENU_X = gMainMenulayout[0].MAINMENU_X;
|
||||
// MAINMENU_Y = gMainMenulayout[0].MAINMENU_Y;
|
||||
// MAINMENU_Y_SPACE = gMainMenulayout[0].MAINMENU_Y_SPACE;
|
||||
//}
|
||||
//else if (iResolution < _1024x768)
|
||||
//{
|
||||
// MAINMENU_X = gMainMenulayout[0].MAINMENU_800x600X + xResOffset;
|
||||
// MAINMENU_Y = gMainMenulayout[0].MAINMENU_800x600Y + yResOffset;
|
||||
// MAINMENU_Y_SPACE = gMainMenulayout[0].MAINMENU_Y_SPACE;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// MAINMENU_X = gMainMenulayout[0].MAINMENU_1024x768X + xResOffset;
|
||||
// MAINMENU_Y = gMainMenulayout[0].MAINMENU_1024x768Y + yResOffset;
|
||||
// MAINMENU_Y_SPACE = gMainMenulayout[0].MAINMENU_Y_SPACE;
|
||||
//}
|
||||
|
||||
if( fCreate )
|
||||
{
|
||||
if( fButtonsCreated )
|
||||
return( TRUE );
|
||||
|
||||
//reset the variable that allows the user to ALT click on the continue save btn to load the save instantly
|
||||
gfLoadGameUponEntry = FALSE;
|
||||
|
||||
// Load button images
|
||||
GetMLGFilename( filename, MLG_TITLETEXT );
|
||||
GetMLGFilename( filenameMP, MLG_TITLETEXT_MP );
|
||||
|
||||
#ifdef JA113DEMO
|
||||
// Load the "Start Demo" image
|
||||
iMenuImages[ NEW_GAME ] = LoadButtonImage( filename ,17,17,18,19,-1 );
|
||||
#else
|
||||
iMenuImages[ NEW_GAME ] = LoadButtonImage( filename, 0,0, 1, 2 ,-1 );
|
||||
#endif
|
||||
|
||||
iMenuImages[ NEW_MP_GAME ] = LoadButtonImage( filenameMP, 0, 0, 1, 2, -1 );
|
||||
|
||||
sSlot = 0;
|
||||
iMenuImages[ LOAD_GAME ] = UseLoadedButtonImage( iMenuImages[ NEW_GAME ] ,6,3,4,5,-1 );
|
||||
|
||||
iMenuImages[ PREFERENCES ] = UseLoadedButtonImage( iMenuImages[ NEW_GAME ] ,7,7,8,9,-1 );
|
||||
iMenuImages[ CREDITS ] = UseLoadedButtonImage( iMenuImages[ NEW_GAME ] ,13,10,11,12,-1 );
|
||||
iMenuImages[ QUIT ] = UseLoadedButtonImage( iMenuImages[ NEW_GAME ] ,14,14,15,16,-1 );
|
||||
|
||||
for ( cnt = 0; cnt < NUM_MENU_ITEMS; cnt++ )
|
||||
{
|
||||
switch( cnt )
|
||||
{
|
||||
case NEW_GAME: gusMainMenuButtonWidths[cnt] = GetWidthOfButtonPic( (UINT16)iMenuImages[cnt], sSlot ); break;
|
||||
case NEW_MP_GAME: gusMainMenuButtonWidths[cnt] = GetWidthOfButtonPic( (UINT16)iMenuImages[cnt], 0); break;
|
||||
case LOAD_GAME: gusMainMenuButtonWidths[cnt] = GetWidthOfButtonPic( (UINT16)iMenuImages[cnt], 3 ); break;
|
||||
case PREFERENCES: gusMainMenuButtonWidths[cnt] = GetWidthOfButtonPic( (UINT16)iMenuImages[cnt], 7 ); break;
|
||||
case CREDITS: gusMainMenuButtonWidths[cnt] = GetWidthOfButtonPic( (UINT16)iMenuImages[cnt], 10 ); break;
|
||||
case QUIT: gusMainMenuButtonWidths[cnt] = GetWidthOfButtonPic( (UINT16)iMenuImages[cnt], 15 ); break;
|
||||
}
|
||||
#ifdef TESTFOREIGNFONTS
|
||||
// iMenuButtons[ cnt ] = QuickCreateButton( iMenuImages[ cnt ], (INT16)((SCREEN_WIDTH / 2) - gusMainMenuButtonWidths[cnt]/2), (INT16)( 0 + ( cnt * 18 ) ),
|
||||
iMenuButtons[ cnt ] = QuickCreateButton( iMenuImages[ cnt ], (INT16)(MAINMENU_X - gusMainMenuButtonWidths[cnt]/2), (INT16)( 0 + ( cnt * 18 ) ), //(INT16)((SCREEN_WIDTH / 2) - gusMainMenuButtonWidths[cnt]/2)
|
||||
BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST,
|
||||
DEFAULT_MOVE_CALLBACK, MenuButtonCallback );
|
||||
#else
|
||||
iMenuButtons[ cnt ] = QuickCreateButton( iMenuImages[ cnt ], (INT16)(MAINMENU_X - gusMainMenuButtonWidths[cnt]/2), (INT16)( MAINMENU_Y + ( cnt * MAINMENU_Y_SPACE ) ),
|
||||
BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST,
|
||||
DEFAULT_MOVE_CALLBACK, MenuButtonCallback );
|
||||
#endif
|
||||
if ( iMenuButtons[ cnt ] == -1 )
|
||||
{
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
ButtonList[ iMenuButtons[ cnt ] ]->UserData[0] = cnt;
|
||||
}
|
||||
|
||||
fButtonsCreated = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( !fButtonsCreated )
|
||||
return( TRUE );
|
||||
|
||||
// Delete images/buttons
|
||||
for ( cnt = 0; cnt < NUM_MENU_ITEMS; cnt++ )
|
||||
{
|
||||
RemoveButton( iMenuButtons[ cnt ] );
|
||||
UnloadButtonImage( iMenuImages[ cnt ] );
|
||||
}
|
||||
fButtonsCreated = FALSE;
|
||||
}
|
||||
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
|
||||
void RenderMainMenu()
|
||||
{
|
||||
HVSURFACE hVSurface;
|
||||
UINT32 iCounter2;
|
||||
|
||||
//Get and display the background image
|
||||
for( iCounter2 = 1; iCounter2 < MAX_ELEMENT; iCounter2++ )
|
||||
{
|
||||
if (gMainMenulayout[iCounter2].Visible == 1)
|
||||
{
|
||||
SGPRect SrcRect, DstRect;
|
||||
INT32 iPosX = 0, iPosY = 0;
|
||||
|
||||
GetVideoSurface(&hVSurface, gMainMenulayout[iCounter2].uiIndex);
|
||||
|
||||
SrcRect.iLeft = 0;
|
||||
SrcRect.iTop = 0;
|
||||
SrcRect.iRight = hVSurface->usWidth;
|
||||
SrcRect.iBottom = hVSurface->usHeight;
|
||||
|
||||
//DstRect.iLeft = 0;
|
||||
//DstRect.iTop = 0;
|
||||
//DstRect.iRight = hVSurface->usWidth;
|
||||
//DstRect.iBottom = hVSurface->usHeight;
|
||||
|
||||
//Stretch the background image to screen size
|
||||
if(gMainMenulayout[iCounter2].FitToScreen == 1)
|
||||
{
|
||||
DstRect.iLeft = 0;
|
||||
DstRect.iTop = 0;
|
||||
DstRect.iRight = SCREEN_WIDTH;
|
||||
DstRect.iBottom = SCREEN_HEIGHT;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(gMainMenulayout[iCounter2].ImagePositionRelative == 1)
|
||||
{
|
||||
iPosX = SCREEN_WIDTH * gMainMenulayout[iCounter2].ImagePositionX / 640;
|
||||
iPosY = SCREEN_HEIGHT * gMainMenulayout[iCounter2].ImagePositionY / 480;
|
||||
}
|
||||
else
|
||||
{
|
||||
iPosX = gMainMenulayout[iCounter2].ImagePositionX;
|
||||
iPosY = gMainMenulayout[iCounter2].ImagePositionY;
|
||||
}
|
||||
|
||||
DstRect.iLeft = iPosX;
|
||||
DstRect.iTop = iPosY;
|
||||
DstRect.iRight = iPosX + hVSurface->usWidth;
|
||||
DstRect.iBottom = iPosY + hVSurface->usHeight;
|
||||
|
||||
if(gMainMenulayout[iCounter2].StretchImage == 1)
|
||||
{
|
||||
DstRect.iRight = iPosX + SCREEN_WIDTH * hVSurface->usWidth / 640;
|
||||
DstRect.iBottom = iPosY + SCREEN_HEIGHT * hVSurface->usHeight / 480;
|
||||
}
|
||||
|
||||
if(gMainMenulayout[iCounter2].CenterImage == 1)
|
||||
{
|
||||
INT32 iTmpXSize = DstRect.iRight - DstRect.iLeft;
|
||||
|
||||
DstRect.iLeft = SCREEN_WIDTH / 2 - iTmpXSize / 2;
|
||||
DstRect.iRight = DstRect.iLeft + iTmpXSize;
|
||||
}
|
||||
}
|
||||
|
||||
BltStretchVideoSurface( FRAME_BUFFER, gMainMenulayout[iCounter2].uiIndex, 0, 0, VO_BLT_SRCTRANSPARENCY, &SrcRect, &DstRect );
|
||||
BltStretchVideoSurface( guiSAVEBUFFER, gMainMenulayout[iCounter2].uiIndex, 0, 0, VO_BLT_SRCTRANSPARENCY, &SrcRect, &DstRect );
|
||||
|
||||
|
||||
|
||||
|
||||
//if (iResolution >= _640x480 && iResolution < _800x600)
|
||||
//{
|
||||
// GetVideoObject(&hPixHandle, gMainMenulayout[iCounter2].uiIndex);
|
||||
// BltVideoObject( guiSAVEBUFFER, hPixHandle, 0, gMainMenulayout[iCounter2].ImagePositionX + xResOffset, gMainMenulayout[iCounter2].ImagePositionY + yResOffset, VO_BLT_SRCTRANSPARENCY,NULL);
|
||||
// BltVideoObject( FRAME_BUFFER, hPixHandle, 0, gMainMenulayout[iCounter2].ImagePositionX + xResOffset, gMainMenulayout[iCounter2].ImagePositionY + yResOffset, VO_BLT_SRCTRANSPARENCY,NULL);
|
||||
//}
|
||||
//else if (iResolution < _1024x768)
|
||||
//{
|
||||
// GetVideoObject(&hPixHandle, gMainMenulayout[iCounter2].uiIndex);
|
||||
// BltVideoObject( guiSAVEBUFFER, hPixHandle, 0, gMainMenulayout[iCounter2].ImagePosition800x600X + xResOffset, gMainMenulayout[iCounter2].ImagePosition800x600Y + yResOffset, VO_BLT_SRCTRANSPARENCY,NULL);
|
||||
// BltVideoObject( FRAME_BUFFER, hPixHandle, 0, gMainMenulayout[iCounter2].ImagePosition800x600X + xResOffset, gMainMenulayout[iCounter2].ImagePosition800x600Y + yResOffset, VO_BLT_SRCTRANSPARENCY,NULL);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// GetVideoObject(&hPixHandle, gMainMenulayout[iCounter2].uiIndex);
|
||||
// BltVideoObject( guiSAVEBUFFER, hPixHandle, 0, gMainMenulayout[iCounter2].ImagePosition1024x768X + xResOffset, gMainMenulayout[iCounter2].ImagePosition1024x768Y + yResOffset, VO_BLT_SRCTRANSPARENCY,NULL);
|
||||
// BltVideoObject( FRAME_BUFFER, hPixHandle, 0, gMainMenulayout[iCounter2].ImagePosition1024x768X + xResOffset, gMainMenulayout[iCounter2].ImagePosition1024x768Y + yResOffset, VO_BLT_SRCTRANSPARENCY,NULL);
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef TESTFOREIGNFONTS
|
||||
DrawTextToScreen( L"LARGEFONT1: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 105, 640, LARGEFONT1, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
DrawTextToScreen( L"SMALLFONT1: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 125, 640, SMALLFONT1, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
DrawTextToScreen( L"TINYFONT1: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 145, 640, TINYFONT1, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
DrawTextToScreen( L"FONT12POINT1: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 165, 640, FONT12POINT1, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
DrawTextToScreen( L"COMPFONT: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 185, 640, COMPFONT, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
DrawTextToScreen( L"SMALLCOMPFONT: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 205, 640, SMALLCOMPFONT, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
DrawTextToScreen( L"FONT10ROMAN: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 225, 640, FONT10ROMAN, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
DrawTextToScreen( L"FONT12ROMAN: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 245, 640, FONT12ROMAN, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
DrawTextToScreen( L"FONT14SANSERIF: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 255, 640, FONT14SANSERIF, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
DrawTextToScreen( L"MILITARYFONT: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 265, 640, MILITARYFONT1, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
DrawTextToScreen( L"FONT10ARIAL: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 285, 640, FONT10ARIAL, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
DrawTextToScreen( L"FONT14ARIAL: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 305, 640, FONT14ARIAL, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
DrawTextToScreen( L"FONT12ARIAL: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 325, 640, FONT12ARIAL, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
DrawTextToScreen( L"FONT10ARIALBOLD: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 345, 640, FONT10ARIALBOLD, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
DrawTextToScreen( L"BLOCKFONT: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 365, 640, BLOCKFONT, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
DrawTextToScreen( L"BLOCKFONT2: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 385, 640, BLOCKFONT2, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
DrawTextToScreen( L"BLOCKFONT3: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 385, 640, BLOCKFONT3, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
DrawTextToScreen( L"FONT12ARIALFIXEDWIDTH: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 405, 640, FONT12ARIALFIXEDWIDTH, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
DrawTextToScreen( L"FONT16ARIAL: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 425, 640, FONT16ARIAL, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
DrawTextToScreen( L"BLOCKFONTNARROW: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 445, 640, BLOCKFONTNARROW, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
DrawTextToScreen( L"FONT14HUMANIST: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 465, 640, FONT14HUMANIST, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
#else
|
||||
CHAR16 text[128];
|
||||
swprintf(text, L"%s: %s %S %s", pMessageStrings[ MSG_VERSION ], zProductLabel, czVersionString, zBuildInformation );
|
||||
DrawTextToScreen( text, 10, 10, SCREEN_WIDTH, TINYFONT1, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
DrawTextToScreen( gzCopyrightText[ 0 ], 0, SCREEN_HEIGHT - 20, SCREEN_WIDTH, FONT10ARIAL, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED );
|
||||
#endif
|
||||
|
||||
InvalidateRegion( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT );
|
||||
}
|
||||
|
||||
void RestoreButtonBackGrounds()
|
||||
{
|
||||
UINT8 cnt;
|
||||
|
||||
#ifndef TESTFOREIGNFONTS
|
||||
|
||||
MAINMENU_X = SCREEN_WIDTH * gMainMenulayout[0].MAINMENU_X / 640;
|
||||
MAINMENU_Y = SCREEN_HEIGHT * gMainMenulayout[0].MAINMENU_Y / 480;
|
||||
MAINMENU_Y_SPACE = gMainMenulayout[0].MAINMENU_Y_SPACE;
|
||||
|
||||
//if (iResolution >= _640x480 && iResolution < _800x600)
|
||||
//{
|
||||
// MAINMENU_Y = gMainMenulayout[0].MAINMENU_Y;
|
||||
// MAINMENU_X = gMainMenulayout[0].MAINMENU_X;
|
||||
// MAINMENU_Y_SPACE = gMainMenulayout[0].MAINMENU_Y_SPACE;
|
||||
//}
|
||||
//else if (iResolution < _1024x768)
|
||||
//{
|
||||
// MAINMENU_Y = gMainMenulayout[0].MAINMENU_800x600Y;
|
||||
// MAINMENU_X = gMainMenulayout[0].MAINMENU_800x600X;
|
||||
// MAINMENU_Y_SPACE = gMainMenulayout[0].MAINMENU_Y_SPACE;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// MAINMENU_Y = gMainMenulayout[0].MAINMENU_1024x768Y;
|
||||
// MAINMENU_X = gMainMenulayout[0].MAINMENU_1024x768X;
|
||||
// MAINMENU_Y_SPACE = gMainMenulayout[0].MAINMENU_Y_SPACE;
|
||||
//}
|
||||
|
||||
for ( cnt = 0; cnt < NUM_MENU_ITEMS; cnt++ )
|
||||
{
|
||||
RestoreExternBackgroundRect( (UINT16)(MAINMENU_X - gusMainMenuButtonWidths[cnt]/2), (INT16)( MAINMENU_Y + ( cnt * MAINMENU_Y_SPACE )-1), (UINT16)(gusMainMenuButtonWidths[cnt]+1), 23 );
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,155 @@
|
||||
#ifndef _MSGBOX_H
|
||||
#define _MSGBOX_H
|
||||
|
||||
#include "mousesystem.h"
|
||||
|
||||
// Message box flags
|
||||
#define MSG_BOX_FLAG_USE_CENTERING_RECT 0x00000001 // Pass in a rect to center in
|
||||
#define MSG_BOX_FLAG_OK 0x00000002 // Displays OK button
|
||||
#define MSG_BOX_FLAG_YESNO 0x00000004 // Displays YES NO buttons
|
||||
#define MSG_BOX_FLAG_CANCEL 0x00000008 // Displays YES NO buttons
|
||||
#define MSG_BOX_FLAG_FOUR_NUMBERED_BUTTONS 0x00000010 // Displays four numbered buttons, 1-4
|
||||
#define MSG_BOX_FLAG_YESNOCONTRACT 0x00000020 // yes no and contract buttons
|
||||
#define MSG_BOX_FLAG_OKCONTRACT 0x00000040 // ok and contract buttons
|
||||
#define MSG_BOX_FLAG_YESNOLIE 0x00000080 // ok and contract buttons
|
||||
#define MSG_BOX_FLAG_CONTINUESTOP 0x00000100 // continue stop box
|
||||
#define MSG_BOX_FLAG_OKSKIP 0x00000200 // Displays ok or skip (meanwhile) buttons
|
||||
#define MSG_BOX_FLAG_GENERICCONTRACT 0x00000400 // displays contract buttoin + 2 user-defined text buttons
|
||||
#define MSG_BOX_FLAG_GENERIC_TWO_BUTTONS 0x00000800 // 2 user-defined text buttons
|
||||
// OJW - Adding text chatbox
|
||||
#define MSG_BOX_FLAG_INPUTBOX 0x00001000 // has a text input field
|
||||
// Flugente - added boxes with multiple buttons that can be renamed easily
|
||||
#define MSG_BOX_FLAG_GENERIC_FOUR_BUTTONS 0x00002000 // Displays four numbered buttons with definable labels
|
||||
#define MSG_BOX_FLAG_GENERIC_EIGHT_BUTTONS 0x00004000 // Displays eight numbered buttons with definable labels
|
||||
#define MSG_BOX_FLAG_GENERIC_SIXTEEN_BUTTONS 0x00008000 // Displays sixteen numbered buttons with definable labels
|
||||
|
||||
#define MSG_BOX_FLAG_DROPDOWN_1 0x00010000 // Displays an additional dropdown box
|
||||
#define MSG_BOX_FLAG_DROPDOWN_2 0x00020000 // Displays another additional dropdown box
|
||||
#define MSG_BOX_FLAG_IMAGE 0x00040000 // Displays an image
|
||||
#define MSG_BOX_BUTTONS_HORIZONTAL_ORIENTATION 0x00080000 // MSG_BOX_FLAG_GENERIC_FOUR_BUTTONS sets the buttons horizontally
|
||||
|
||||
// rftr - bigger msg box
|
||||
#define MSG_BOX_FLAG_BIGGER 0x00100000 // Bigger msg box
|
||||
#define MSG_BOX_FLAG_WIDE_BUTTONS 0x00200000 // Wide buttons
|
||||
|
||||
// message box return codes
|
||||
#define MSG_BOX_RETURN_OK 1 // ENTER or on OK button
|
||||
#define MSG_BOX_RETURN_YES 2 // ENTER or YES button
|
||||
#define MSG_BOX_RETURN_NO 3 // ESC, Right Click or NO button
|
||||
#define MSG_BOX_RETURN_CONTRACT 4 // contract button
|
||||
#define MSG_BOX_RETURN_LIE 5 // LIE BUTTON
|
||||
|
||||
// message box style flags
|
||||
enum
|
||||
{
|
||||
MSG_BOX_BASIC_STYLE = 0, // We'll have other styles, like in laptop, etc
|
||||
// Graphics are all that are required here...
|
||||
MSG_BOX_RED_ON_WHITE,
|
||||
MSG_BOX_BLUE_ON_GREY,
|
||||
MSG_BOX_BASIC_SMALL_BUTTONS,
|
||||
MSG_BOX_IMP_STYLE,
|
||||
MSG_BOX_LAPTOP_DEFAULT,
|
||||
MSG_BOX_BASIC_MEDIUM_BUTTONS,
|
||||
MSG_BOX_MINIEVENT_STYLE,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
MSG_BOX_DEFAULT_BUTTON_NONE = 0,
|
||||
|
||||
MSG_BOX_DEFAULT_BUTTON_1,
|
||||
MSG_BOX_DEFAULT_BUTTON_2,
|
||||
MSG_BOX_DEFAULT_BUTTON_3,
|
||||
MSG_BOX_DEFAULT_BUTTON_4,
|
||||
MSG_BOX_DEFAULT_BUTTON_5,
|
||||
MSG_BOX_DEFAULT_BUTTON_6,
|
||||
MSG_BOX_DEFAULT_BUTTON_7,
|
||||
MSG_BOX_DEFAULT_BUTTON_8,
|
||||
MSG_BOX_DEFAULT_BUTTON_9,
|
||||
MSG_BOX_DEFAULT_BUTTON_10,
|
||||
MSG_BOX_DEFAULT_BUTTON_11,
|
||||
MSG_BOX_DEFAULT_BUTTON_12,
|
||||
MSG_BOX_DEFAULT_BUTTON_13,
|
||||
MSG_BOX_DEFAULT_BUTTON_14,
|
||||
MSG_BOX_DEFAULT_BUTTON_15,
|
||||
MSG_BOX_DEFAULT_BUTTON_16,
|
||||
};
|
||||
|
||||
typedef void (*MSGBOX_CALLBACK)( UINT8 bExitValue );
|
||||
|
||||
// Flugente: made an array for user-defined buttons
|
||||
#define NUM_CUSTOM_BUTTONS 16
|
||||
|
||||
extern CHAR16 gzUserDefinedButton[ NUM_CUSTOM_BUTTONS ][ 128 ];
|
||||
// sevenfm: color for buttons
|
||||
extern UINT16 gzUserDefinedButtonColor[ NUM_CUSTOM_BUTTONS ];
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UINT32 usFlags;
|
||||
UINT32 uiExitScreen;
|
||||
MSGBOX_CALLBACK ExitCallback;
|
||||
INT16 sX;
|
||||
INT16 sY;
|
||||
UINT32 uiSaveBuffer;
|
||||
MOUSE_REGION BackRegion;
|
||||
UINT16 usWidth;
|
||||
UINT16 usHeight;
|
||||
INT32 iButtonImages;
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
UINT32 uiOKButton;
|
||||
UINT32 uiYESButton;
|
||||
UINT32 uiNOButton;
|
||||
UINT32 uiUnusedButton;
|
||||
};
|
||||
struct
|
||||
{
|
||||
UINT32 uiButton[16];
|
||||
};
|
||||
};
|
||||
BOOLEAN fRenderBox;
|
||||
INT8 bHandled;
|
||||
INT32 iBoxId;
|
||||
|
||||
BOOLEAN fWasPaused;
|
||||
} MESSAGE_BOX_STRUCT;
|
||||
|
||||
|
||||
|
||||
|
||||
extern MESSAGE_BOX_STRUCT gMsgBox;
|
||||
extern BOOLEAN fRestoreBackgroundForMessageBox;
|
||||
|
||||
//this variable can be unset if ur in a non gamescreen and DONT want the msg box to use the save buffer
|
||||
extern BOOLEAN gfDontOverRideSaveBuffer;
|
||||
|
||||
//OJW - 20090208
|
||||
extern CHAR16 gszMsgBoxInputString[255];
|
||||
////////////////////////////////
|
||||
// ubStyle: Determines the look of graphics including buttons
|
||||
// zString: 16-bit string
|
||||
// uiExitScreen The screen to exit to
|
||||
// ubFlags Some flags for button style
|
||||
// ReturnCallback Callback for return. Can be NULL. Returns any above return value
|
||||
// pCenteringRect Rect to send if MSG_BOX_FLAG_USE_CENTERING_RECT set. Can be NULL
|
||||
////////////////////////////////
|
||||
|
||||
INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UINT32 usFlags, MSGBOX_CALLBACK ReturnCallback, SGPRect *pCenteringRect, UINT8 ubDefaultButton = MSG_BOX_DEFAULT_BUTTON_NONE );
|
||||
void DoScreenIndependantMessageBoxFullScreen( const STR16 zString, UINT32 usFlags, MSGBOX_CALLBACK ReturnCallback );
|
||||
void DoScreenIndependantMessageBox( const STR16 zString, UINT32 usFlags, MSGBOX_CALLBACK ReturnCallback );
|
||||
void DoUpperScreenIndependantMessageBox( const STR16 zString, UINT32 usFlags, MSGBOX_CALLBACK ReturnCallback );
|
||||
|
||||
void DoLowerScreenIndependantMessageBox( const STR16 zString, UINT32 usFlags, MSGBOX_CALLBACK ReturnCallback );
|
||||
void DoScreenIndependantMessageBoxWithRect( const STR16 zString, UINT32 usFlags, MSGBOX_CALLBACK ReturnCallback, SGPRect *pCenteringRect );
|
||||
|
||||
//wrappers for other screens
|
||||
BOOLEAN DoLapTopSystemMessageBoxWithRect( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UINT32 usFlags, MSGBOX_CALLBACK ReturnCallback, SGPRect *pCenteringRect );
|
||||
INT32 DoMapMessageBoxWithRect( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UINT32 usFlags, MSGBOX_CALLBACK ReturnCallback, SGPRect *pCenteringRect );
|
||||
BOOLEAN DoOptionsMessageBoxWithRect( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UINT32 usFlags, MSGBOX_CALLBACK ReturnCallback, SGPRect *pCenteringRect );
|
||||
BOOLEAN DoSaveLoadMessageBoxWithRect( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UINT32 usFlags, MSGBOX_CALLBACK ReturnCallback, SGPRect *pCenteringRect );
|
||||
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,131 @@
|
||||
#ifndef _OPTIONS_SCREEN__H_
|
||||
#define _OPTIONS_SCREEN__H_
|
||||
|
||||
#include "MessageBoxScreen.h"
|
||||
|
||||
/////////////////////////////////
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
/////////////////////////////////
|
||||
#define OPT_MAIN_FONT FONT10ARIAL
|
||||
#define OPT_SLIDER_FONT FONT12ARIAL
|
||||
|
||||
#define OPT_MAIN_COLOR OPT_BUTTON_ON_COLOR
|
||||
#define OPT_HIGHLIGHT_COLOR FONT_MCOLOR_WHITE
|
||||
|
||||
// these both could be established at run time, then never worry about it again
|
||||
// derived from "OPTIONSCREENBASE.sti"
|
||||
#define OPTIONS_SCREEN_WIDTH 638
|
||||
#define OPTIONS_SCREEN_HEIGHT 478
|
||||
|
||||
#define OPTIONS__TOP_LEFT_X iScreenWidthOffset
|
||||
#define OPTIONS__TOP_LEFT_Y iScreenHeightOffset
|
||||
#define OPTIONS__BOTTOM_RIGHT_X OPTIONS__TOP_LEFT_X + OPTIONS_SCREEN_WIDTH
|
||||
#define OPTIONS__BOTTOM_RIGHT_Y OPTIONS__TOP_LEFT_Y + OPTIONS_SCREEN_HEIGHT
|
||||
|
||||
#define OPT_SAVE_BTN_X iScreenWidthOffset + 20
|
||||
#define OPT_SAVE_BTN_Y iScreenHeightOffset + 443
|
||||
|
||||
#define OPT_LOAD_BTN_X OPT_SAVE_BTN_X + 70
|
||||
#define OPT_LOAD_BTN_Y OPT_SAVE_BTN_Y
|
||||
|
||||
#define OPT_QUIT_BTN_X OPT_LOAD_BTN_X + 70
|
||||
#define OPT_QUIT_BTN_Y OPT_SAVE_BTN_Y
|
||||
|
||||
#define OPT_SWAP_BTN_X OPT_QUIT_BTN_X + 70
|
||||
#define OPT_SWAP_BTN_Y OPT_SAVE_BTN_Y
|
||||
|
||||
// ary-05/05/2009 : need more option screen toggles : Add in buttons that allow for options column paging
|
||||
#define OPT_PREV_BTN_X OPT_SWAP_BTN_X + 100
|
||||
#define OPT_PREV_BTN_Y OPT_SAVE_BTN_Y
|
||||
|
||||
#define OPT_PAGE_X OPT_PREV_BTN_X + 54
|
||||
#define OPT_PAGE_Y OPT_SAVE_BTN_Y + 7
|
||||
|
||||
#define OPT_NEXT_BTN_X OPT_PREV_BTN_X + 110
|
||||
#define OPT_NEXT_BTN_Y OPT_SAVE_BTN_Y
|
||||
|
||||
#define OPT_DONE_BTN_X OPT_NEXT_BTN_X + 110
|
||||
#define OPT_DONE_BTN_Y OPT_SAVE_BTN_Y
|
||||
|
||||
#define OPT_GAP_BETWEEN_TOGGLE_BOXES 18
|
||||
|
||||
//Text
|
||||
#define OPT_TOGGLE_BOX_FIRST_COL_TEXT_X OPT_TOGGLE_BOX_FIRST_COLUMN_X + OPT_SPACE_BETWEEN_TEXT_AND_TOGGLE_BOX
|
||||
#define OPT_TOGGLE_BOX_FIRST_COL_TEXT_Y OPT_TOGGLE_BOX_FIRST_COLUMN_START_Y
|
||||
|
||||
#define OPT_TOGGLE_BOX_SECOND_TEXT_X OPT_TOGGLE_BOX_SECOND_COLUMN_X + OPT_SPACE_BETWEEN_TEXT_AND_TOGGLE_BOX
|
||||
#define OPT_TOGGLE_BOX_SECOND_TEXT_Y OPT_TOGGLE_BOX_SECOND_COLUMN_START_Y
|
||||
|
||||
//toggle boxes
|
||||
#define OPT_SPACE_BETWEEN_TEXT_AND_TOGGLE_BOX 30
|
||||
#define OPT_TOGGLE_TEXT_OFFSET_Y 2
|
||||
|
||||
#define OPT_TOGGLE_BOX_FIRST_COLUMN_X iScreenWidthOffset + 260
|
||||
#define OPT_TOGGLE_BOX_FIRST_COLUMN_START_Y iScreenHeightOffset + 82
|
||||
|
||||
#define OPT_TOGGLE_BOX_SECOND_COLUMN_X iScreenWidthOffset + 435
|
||||
#define OPT_TOGGLE_BOX_SECOND_COLUMN_START_Y OPT_TOGGLE_BOX_FIRST_COLUMN_START_Y
|
||||
|
||||
#define OPT_TOGGLE_BOX_TEXT_WIDTH OPT_TOGGLE_BOX_SECOND_COLUMN_X - OPT_TOGGLE_BOX_FIRST_COLUMN_X - 20
|
||||
|
||||
// Slider bar defines
|
||||
#define OPT_GAP_BETWEEN_SLIDER_BARS 60
|
||||
#define OPT_SLIDER_BAR_SIZE 258
|
||||
|
||||
#define OPT_SLIDER_TEXT_WIDTH 45
|
||||
|
||||
#define OPT_SOUND_FX_TEXT_X iScreenWidthOffset + 38
|
||||
#define OPT_SOUND_FX_TEXT_Y iScreenHeightOffset + 87
|
||||
|
||||
#define OPT_SPEECH_TEXT_X iScreenWidthOffset + 85
|
||||
#define OPT_SPEECH_TEXT_Y OPT_SOUND_FX_TEXT_Y
|
||||
|
||||
#define OPT_MUSIC_TEXT_X iScreenWidthOffset + 137
|
||||
#define OPT_MUSIC_TEXT_Y OPT_SOUND_FX_TEXT_Y
|
||||
|
||||
#define OPT_TEXT_TO_SLIDER_OFFSET_Y 25
|
||||
|
||||
#define OPT_SOUND_EFFECTS_SLIDER_X iScreenWidthOffset + 56
|
||||
#define OPT_SOUND_EFFECTS_SLIDER_Y iScreenHeightOffset + 126
|
||||
|
||||
#define OPT_SPEECH_SLIDER_X iScreenWidthOffset + 107
|
||||
#define OPT_SPEECH_SLIDER_Y OPT_SOUND_EFFECTS_SLIDER_Y
|
||||
|
||||
#define OPT_MUSIC_SLIDER_X iScreenWidthOffset + 158
|
||||
#define OPT_MUSIC_SLIDER_Y OPT_SOUND_EFFECTS_SLIDER_Y
|
||||
|
||||
#define OPT_MUSIC_SLIDER_PLAY_SOUND_DELAY 75
|
||||
|
||||
#define OPT_FIRST_COLUMN_TOGGLE_CUT_OFF 18
|
||||
#define MAX_NUMBER_OF_OPTION_TOGGLES (OPT_FIRST_COLUMN_TOGGLE_CUT_OFF * 2)
|
||||
#define OPT_BUTTON_FONT FONT14ARIAL
|
||||
#define OPT_BUTTON_FONT2 FONT10ARIAL //smaller button on options screen
|
||||
#define OPT_BUTTON_ON_COLOR 73//FONT_MCOLOR_WHITE
|
||||
#define OPT_BUTTON_OFF_COLOR 73//FONT_MCOLOR_WHITE
|
||||
|
||||
|
||||
|
||||
//Record the previous screen the user was in.
|
||||
extern UINT32 guiPreviousOptionScreen;
|
||||
|
||||
|
||||
|
||||
UINT32 OptionsScreenShutdown( void );
|
||||
UINT32 OptionsScreenHandle( void );
|
||||
UINT32 OptionsScreenInit( void );
|
||||
|
||||
|
||||
|
||||
void SetOptionsScreenToggleBoxes();
|
||||
void GetOptionsScreenToggleBoxes();
|
||||
// OJW - moved this here so can exit options screen on client disconnect
|
||||
void SetOptionsExitScreen( UINT32 uiExitScreen );
|
||||
void SetOptionsPreviousScreen( UINT32 uiPrevScreen, BOOLEAN setFeaturesToo = TRUE );
|
||||
|
||||
|
||||
BOOLEAN DoOptionsMessageBox( UINT8 ubStyle, STR16 zString, UINT32 uiExitScreen, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback );
|
||||
|
||||
|
||||
#endif
|
||||
Binary file not shown.
+111
@@ -0,0 +1,111 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "windows.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE
|
||||
BEGIN
|
||||
"#include ""afxres.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,0,0,1
|
||||
PRODUCTVERSION 1,0,0,1
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x40004L
|
||||
FILETYPE 0x7L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Sir-Tech Canada Ltd."
|
||||
VALUE "FileDescription", "Jagged Alliance 2 Gold"
|
||||
VALUE "FileVersion", "1, 0, 0, 6"
|
||||
VALUE "InternalName", "Jagged Alliance 2"
|
||||
VALUE "LegalCopyright", "Copyright © 1998"
|
||||
VALUE "OriginalFilename", "Ja2.exe"
|
||||
VALUE "ProductName", "Jagged Alliance 2 Gold"
|
||||
VALUE "ProductVersion", "1, 0, 0, 6"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Icon
|
||||
//
|
||||
|
||||
// Icon with lowest ID value placed first to ensure application icon
|
||||
// remains consistent on all systems.
|
||||
IDI_ICON1 ICON "jagged3.ico"
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.2 KiB |
@@ -0,0 +1,28 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by ja2.rc and console.rc
|
||||
//
|
||||
#define IDI_ICON1 113
|
||||
#define IDI_ICON2 115
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 114
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1000
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#define ID_ABOUT 116
|
||||
#define IDD_ABOUT 117
|
||||
#define ID_COPY 118
|
||||
#define ID_PASTE 119
|
||||
#define ID_EXIT_CONSOLE 120
|
||||
#define IDR_POPUP_MENU 130
|
||||
|
||||
|
||||
|
||||
+10097
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,107 @@
|
||||
#ifndef _SAVE_LOAD_GAME_H_
|
||||
#define _SAVE_LOAD_GAME_H_
|
||||
|
||||
#include "GameSettings.h"
|
||||
|
||||
//forward declarations of common classes to eliminate includes
|
||||
class OBJECTTYPE;
|
||||
class SOLDIERTYPE;
|
||||
|
||||
|
||||
#define BYTESINMEGABYTE 1048576 //1024*1024
|
||||
#define REQUIRED_FREE_SPACE (20 * BYTESINMEGABYTE)
|
||||
|
||||
#define SIZE_OF_SAVE_GAME_DESC 128
|
||||
|
||||
#define GAME_VERSION_LENGTH 16
|
||||
|
||||
#define SAVE__ERROR_NUM 249//99
|
||||
|
||||
// WANNE: The end turn have 2 saves (Auto00.sav and Auto01.sav). This 2 save slots should be underneath the 5 auto save slots
|
||||
#define SAVE__END_TURN_NUM 248//98
|
||||
#define SAVE__END_TURN_NUM_1 6//98
|
||||
#define SAVE__END_TURN_NUM_2 7//98
|
||||
|
||||
// WDS - Automatically try to save when an assertion failure occurs
|
||||
|
||||
// WANNE: This SAVEGAME should not show up in the load screen
|
||||
#define SAVE__ASSERTION_FAILURE 247//97
|
||||
|
||||
#define SAVE__TIMED_AUTOSAVE_SLOT1 1 //19 // WANNE: This slot does not show up in the load/save screen because it is > 18
|
||||
#define SAVE__TIMED_AUTOSAVE_SLOT2 2
|
||||
#define SAVE__TIMED_AUTOSAVE_SLOT3 3
|
||||
#define SAVE__TIMED_AUTOSAVE_SLOT4 4
|
||||
#define SAVE__TIMED_AUTOSAVE_SLOT5 5
|
||||
|
||||
#define EARLIST_SPECIAL_SAVE 247//97
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UINT32 uiSavedGameVersion;
|
||||
CHAR8 zGameVersionNumber[ GAME_VERSION_LENGTH ];
|
||||
|
||||
CHAR16 sSavedGameDesc[ SIZE_OF_SAVE_GAME_DESC ];
|
||||
|
||||
UINT32 uiFlags;
|
||||
|
||||
#ifdef CRIPPLED_VERSION
|
||||
UINT8 ubCrippleFiller[20];
|
||||
#endif
|
||||
|
||||
|
||||
//The following will be used to quickly access info to display in the save/load screen
|
||||
UINT32 uiDay;
|
||||
UINT8 ubHour;
|
||||
UINT8 ubMin;
|
||||
INT16 sSectorX;
|
||||
INT16 sSectorY;
|
||||
INT8 bSectorZ;
|
||||
UINT8 ubNumOfMercsOnPlayersTeam;
|
||||
INT32 iCurrentBalance;
|
||||
|
||||
UINT32 uiCurrentScreen;
|
||||
|
||||
BOOLEAN fAlternateSector;
|
||||
|
||||
BOOLEAN fWorldLoaded;
|
||||
|
||||
UINT8 ubLoadScreenID; //The load screen that should be used when loading the saved game
|
||||
|
||||
GAME_OPTIONS sInitialGameOptions; //need these in the header so we can get the info from it on the save load screen.
|
||||
|
||||
UINT32 uiRandom;
|
||||
|
||||
UINT8 ubFiller[500]; // WANNE: Decrease this filler by 1, for each new UINT8 variable!
|
||||
|
||||
} SAVED_GAME_HEADER;
|
||||
|
||||
|
||||
extern UINT32 guiScreenToGotoAfterLoadingSavedGame;
|
||||
extern UINT32 guiCurrentSaveGameVersion;
|
||||
|
||||
void CreateSavedGameFileNameFromNumber( UINT8 ubSaveGameID, STR pzNewFileName );
|
||||
|
||||
|
||||
BOOLEAN InitSaveDir();
|
||||
|
||||
BOOLEAN SaveGame( int ubSaveGameID, STR16 pGameDesc );
|
||||
BOOLEAN LoadSavedGame( int ubSavedGameID );
|
||||
|
||||
BOOLEAN CopySavedSoldierInfoToNewSoldier( SOLDIERTYPE *pDestSourceInfo, SOLDIERTYPE *pSourceInfo );
|
||||
|
||||
BOOLEAN SaveFilesToSavedGame( STR pSrcFileName, HWFILE hFile );
|
||||
BOOLEAN LoadFilesFromSavedGame( STR pSrcFileName, HWFILE hFile );
|
||||
|
||||
void GetBestPossibleSectorXYZValues( INT16 *psSectorX, INT16 *psSectorY, INT8 *pbSectorZ );
|
||||
|
||||
|
||||
extern UINT32 guiLastSaveGameNum; // The end turn auto save number (0 = Auto00.sav, 1 = Auto01.sav)
|
||||
|
||||
/*CHRISL: This function is designed to allow reading the save game file one field at a time. We currently save structures by saving a block of memory,
|
||||
but variables are stored in memory so that they fit neatly into a WORD resulting in the program automatically adding some padding. This padding is saved
|
||||
during the save game process and this function is designed to calculate where that padding is so that we can account for it during the load process. The
|
||||
use of this function should allow changes to be made to various structures within the designated "POD", while still allowing for save game continuity.*/
|
||||
INT32 ReadFieldByField( HWFILE hFile, PTR pDest, UINT32 uiFieldSize, UINT32 uiElementSize, UINT32 uiCurByteCount );
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,61 @@
|
||||
#ifndef _SAVE_LOAD_SCREEN__H_
|
||||
#define _SAVE_LOAD_SCREEN__H_
|
||||
|
||||
#include "MessageBoxScreen.h"
|
||||
|
||||
|
||||
#define NUM_SAVE_GAMES_OLD 11
|
||||
#define NUM_SAVE_GAMES_NEW 19
|
||||
|
||||
#define NUM_SAVE_GAMES 255//19
|
||||
|
||||
extern BOOLEAN AutoSaveToSlot[5];
|
||||
|
||||
// WANNE: Used For auto save games
|
||||
extern UINT32 lastLoadedSaveGameDay;
|
||||
extern UINT8 lastLoadedSaveGameHour;
|
||||
|
||||
extern UINT16 NUM_SLOT;
|
||||
extern UINT32 SLG_SAVELOCATION_HEIGHT;
|
||||
extern UINT32 SLG_GAP_BETWEEN_LOCATIONS;
|
||||
extern UINT32 SLG_DATE_OFFSET_Y;
|
||||
extern UINT32 SLG_SELECTED_SLOT_GRAPHICS_NUMBER;
|
||||
extern UINT32 SLG_UNSELECTED_SLOT_GRAPHICS_NUMBER;
|
||||
extern void LoadSaveGameOldOrNew();
|
||||
|
||||
//This flag is used to diferentiate between loading a game and saveing a game.
|
||||
// gfSaveGame=TRUE For saving a game
|
||||
// gfSaveGame=FALSE For loading a game
|
||||
extern BOOLEAN gfSaveGame;
|
||||
|
||||
//if there is to be a slot selected when entering this screen
|
||||
extern INT32 gbSetSlotToBeSelected;
|
||||
|
||||
extern BOOLEAN gbSaveGameArray[ NUM_SAVE_GAMES ];
|
||||
|
||||
extern BOOLEAN gfCameDirectlyFromGame;
|
||||
|
||||
UINT32 SaveLoadScreenShutdown( void );
|
||||
UINT32 SaveLoadScreenHandle( void );
|
||||
UINT32 SaveLoadScreenInit( void );
|
||||
|
||||
//Kaiden : Trying to get Editor to work
|
||||
extern BOOLEAN DoSaveLoadMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback );
|
||||
|
||||
BOOLEAN InitSaveGameArray();
|
||||
|
||||
void DoneFadeOutForSaveLoadScreen( void );
|
||||
void DoneFadeInForSaveLoadScreen( void );
|
||||
|
||||
|
||||
BOOLEAN DoQuickSave();
|
||||
BOOLEAN DoQuickLoad();
|
||||
|
||||
BOOLEAN IsThereAnySavedGameFiles();
|
||||
|
||||
void DeleteSaveGameNumber( UINT8 ubSaveGameSlotID );
|
||||
|
||||
extern BOOLEAN DoAutoSave( int ubSaveGameID, STR16 pGameDesc );
|
||||
extern BOOLEAN SaveDataSaveToSaveGameFile( HWFILE hFile );
|
||||
extern BOOLEAN LoadDataSaveFromLoadGameFile( HWFILE hFile );
|
||||
#endif
|
||||
@@ -0,0 +1,77 @@
|
||||
#include "Screens.h"
|
||||
|
||||
int iResolution; // INI file
|
||||
int iPlayIntro;
|
||||
int iDisableMouseScrolling;
|
||||
int iUseWinFonts;
|
||||
float fTooltipScaleFactor;
|
||||
/* WANNE, Sgt.Kolja
|
||||
* 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;
|
||||
|
||||
UINT16 SCREEN_WIDTH;
|
||||
UINT16 SCREEN_HEIGHT;
|
||||
|
||||
INT16 iScreenWidthOffset;
|
||||
INT16 iScreenHeightOffset;
|
||||
|
||||
UINT16 xResSize; // 640 / 800 / 1024
|
||||
UINT16 yResSize; // 480 / 600 / 768
|
||||
|
||||
UINT16 xResOffset; // For ARSP: ((SCREEN_WIDTH - xResSize) / 2)
|
||||
UINT16 yResOffset; // For ARSP: ((SCREEN_HEIGHT - yResSize) / 2)
|
||||
|
||||
BOOLEAN fDisplayOverheadMap;
|
||||
|
||||
Screens GameScreens[MAX_SCREENS] =
|
||||
{
|
||||
{ EditScreenInit, EditScreenHandle, EditScreenShutdown },
|
||||
{ SavingScreenInitialize, SavingScreenHandle, SavingScreenShutdown }, // Title Screen
|
||||
{ LoadingScreenInitialize, LoadingScreenHandle, LoadingScreenShutdown }, // Title Screen
|
||||
{ ErrorScreenInitialize, ErrorScreenHandle, ErrorScreenShutdown }, // Title Screen
|
||||
{ InitScreenInitialize, InitScreenHandle, InitScreenShutdown }, // Title Screen
|
||||
{ MainGameScreenInit, MainGameScreenHandle, MainGameScreenShutdown },
|
||||
{ AniEditScreenInit, AniEditScreenHandle, AniEditScreenShutdown },
|
||||
{ PalEditScreenInit, PalEditScreenHandle, PalEditScreenShutdown },
|
||||
{ DebugScreenInit, DebugScreenHandle, DebugScreenShutdown },
|
||||
{ MapScreenInit, MapScreenHandle, MapScreenShutdown },
|
||||
{ LaptopScreenInit, LaptopScreenHandle, LaptopScreenShutdown },
|
||||
{ LoadSaveScreenInit, LoadSaveScreenHandle, LoadSaveScreenShutdown },
|
||||
{ MapUtilScreenInit, MapUtilScreenHandle, MapUtilScreenShutdown },
|
||||
{ FadeScreenInit, FadeScreenHandle, FadeScreenShutdown },
|
||||
{ MessageBoxScreenInit, MessageBoxScreenHandle, MessageBoxScreenShutdown },
|
||||
{ MainMenuScreenInit, MainMenuScreenHandle, MainMenuScreenShutdown },
|
||||
{ AutoResolveScreenInit, AutoResolveScreenHandle, AutoResolveScreenShutdown },
|
||||
{ SaveLoadScreenInit, SaveLoadScreenHandle, SaveLoadScreenShutdown },
|
||||
{ OptionsScreenInit, OptionsScreenHandle, OptionsScreenShutdown },
|
||||
{ ShopKeeperScreenInit, ShopKeeperScreenHandle, ShopKeeperScreenShutdown },
|
||||
{ SexScreenInit, SexScreenHandle, SexScreenShutdown },
|
||||
{ GameInitOptionsScreenInit, GameInitOptionsScreenHandle, GameInitOptionsScreenShutdown },
|
||||
{ DemoExitScreenInit, DemoExitScreenHandle, DemoExitScreenShutdown },
|
||||
{ IntroScreenInit, IntroScreenHandle, IntroScreenShutdown },
|
||||
{ CreditScreenInit, CreditScreenHandle, CreditScreenShutdown },
|
||||
{ MPJoinScreenInit, MPJoinScreenHandle, MPJoinScreenShutdown }, // OJW - 20081129
|
||||
{ MPHostScreenInit, MPHostScreenHandle, MPHostScreenShutdown },
|
||||
{ MPScoreScreenInit, MPScoreScreenHandle, MPScoreScreenShutdown }, // OJW - 20081222
|
||||
{ MPChatScreenInit, MPChatScreenHandle, MPChatScreenShutdown }, // OJW - 20090314
|
||||
{ MPConnectScreenInit, MPConnectScreenHandle, MPConnectScreenShutdown }, // OJW - 20090422
|
||||
|
||||
{ MiniGameScreenInit, MiniGameScreenHandle, MiniGameScreenShutdown }, // added by Flugente
|
||||
{ FeaturesScreen::Init, FeaturesScreen::Handle, FeaturesScreen::Shutdown }, //rftr
|
||||
|
||||
#ifdef JA2BETAVERSION
|
||||
{ AIViewerScreenInit, AIViewerScreenHandle, AIViewerScreenShutdown },
|
||||
#endif
|
||||
|
||||
{ QuestDebugScreenInit, QuestDebugScreenHandle, QuestDebugScreenShutdown }
|
||||
};
|
||||
@@ -0,0 +1,37 @@
|
||||
#ifndef __SCREEN_MANAGER
|
||||
#define __SCREEN_MANAGER
|
||||
|
||||
#include "Types.h"
|
||||
#include "ScreenIds.h"
|
||||
|
||||
// Each screen in the game comes with a Status flag (what was the last thing the screen was doing), an Initialization
|
||||
// function (which loads up the screen if necessary), a Handler function which is called while the screen is showing and
|
||||
// a shutdown function which is called when the screen is getting ready to make another screen active.
|
||||
|
||||
typedef struct Screens
|
||||
{
|
||||
UINT32 (*InitializeScreen)(void);
|
||||
UINT32 (*HandleScreen)(void);
|
||||
UINT32 (*ShutdownScreen)(void);
|
||||
|
||||
} Screens;
|
||||
|
||||
// These defines are used as flags for each screen state. The only legal transition of states is
|
||||
// SCR_INACTIVE->SCR_INITIALIZING->SCR_ACTIVE->SCR_SHUTTING_DOWN->SCR_INACTIVE ... Anything else
|
||||
// will cause the system to yak.
|
||||
|
||||
#define SCR_INACTIVE 0x00
|
||||
#define SCR_INITIALIZING 0x01
|
||||
#define SCR_ACTIVE 0x02
|
||||
#define SCR_SHUTTING_DOWN 0x04
|
||||
|
||||
// This extern is made available to make sure that external modules will have access to the screen information
|
||||
|
||||
extern Screens GameScreens[MAX_SCREENS];
|
||||
|
||||
// We must include all the following .H files which have prototypes for all the initialization, handler and shutdown
|
||||
// functions for all the screens. There should be as many includes as there are screens.
|
||||
|
||||
#include "jascreens.h"
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,46 @@
|
||||
#include "builddefines.h"
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <wchar.h>
|
||||
#include "types.h"
|
||||
#include "screenids.h"
|
||||
#include "Sys Globals.h"
|
||||
#include "gameloop.h"
|
||||
|
||||
|
||||
// External globals
|
||||
extern CHAR8 gubFilename[ 200 ]; // symbol already declared globally in editscreen.cpp (jonathanl)
|
||||
BOOLEAN gfEditMode = FALSE;
|
||||
extern CHAR8 gDebugStr[128]; // symbol already defined in overhead.cpp (jonathanl)
|
||||
CHAR8 gSystemDebugStr[128];
|
||||
INT8 gbFPSDisplay = SHOW_MIN_FPS;
|
||||
BOOLEAN gfResetInputCheck = FALSE;
|
||||
BOOLEAN gfGlobalError = FALSE;
|
||||
|
||||
UINT32 guiGameCycleCounter = 0;
|
||||
CHAR8 gubErrorText[ 512 ];//for long filenames
|
||||
|
||||
BOOLEAN SET_ERROR( const STR8 String, ...)
|
||||
{
|
||||
va_list ArgPtr;
|
||||
|
||||
va_start(ArgPtr, String);
|
||||
vsprintf( gubErrorText, String, ArgPtr);
|
||||
va_end(ArgPtr);
|
||||
|
||||
SetPendingNewScreen( ERROR_SCREEN );
|
||||
|
||||
gfGlobalError = TRUE;
|
||||
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
//create a varible that can be tested outside the pre-compiler convention.
|
||||
// also see its "Sys Globals.h" declaration
|
||||
#ifdef JA2BETAVERSION
|
||||
BOOLEAN JA2BETAVERSION_FLAG = 1;
|
||||
#else
|
||||
BOOLEAN JA2BETAVERSION_FLAG = 0;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
#ifndef __SYS_GLOBALS_H
|
||||
#define __SYS_GLOBALS_H
|
||||
|
||||
#define SHOW_MIN_FPS 0
|
||||
#define SHOW_FULL_FPS 1
|
||||
|
||||
extern CHAR8 gubErrorText[ 512 ];//for long filenames
|
||||
extern BOOLEAN gfAniEditMode;
|
||||
extern BOOLEAN gfEditMode;
|
||||
extern BOOLEAN fFirstTimeInGameScreen;
|
||||
extern BOOLEAN fDirtyRectangleMode;
|
||||
extern CHAR8 gDebugStr[128];
|
||||
extern CHAR8 gSystemDebugStr[128];
|
||||
|
||||
extern BOOLEAN gfMode;
|
||||
extern INT16 gsCurrentActionPoints;
|
||||
extern INT8 gbFPSDisplay;
|
||||
extern BOOLEAN gfResetInputCheck;
|
||||
extern BOOLEAN gfGlobalError;
|
||||
|
||||
extern UINT32 guiGameCycleCounter;
|
||||
|
||||
|
||||
// VIDEO OVERLAYS
|
||||
extern INT32 giFPSOverlay;
|
||||
extern INT32 giCounterPeriodOverlay;
|
||||
|
||||
extern BOOLEAN SET_ERROR( const STR8 String, ...);
|
||||
|
||||
// arynn : note : a varible version of #define JA2BETAVERSION, used for control flow when not debugging
|
||||
// : note : i wasnt sure about any existing. i'd imagine there is one. if so, it will get fixed later.
|
||||
extern BOOLEAN JA2BETAVERSION_FLAG;
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,58 @@
|
||||
/*********************************************************************************
|
||||
* vtuneapi.h 11-05-97
|
||||
* Intel Corporation
|
||||
*
|
||||
* To use VTune's programatic method to start and stop sampling:
|
||||
* include this header file with your project when using the VTune pasue/resume APIs,
|
||||
* then link the vtuneapi.lib file to your module or load the vtuneapi.dll during runtime
|
||||
*
|
||||
* When running your application under VTune, if you want to start the session with the
|
||||
* sampler paused, make sure the "Start the new session
|
||||
* in Pause mode" option is enabled under View Sampling Options/Advanced tab
|
||||
*
|
||||
* The sampler is controlled by a flag. When the flag is set, sampling is stopped. When the
|
||||
* flag is reset, sampling is running. If you start VTune without enabling the "Start the
|
||||
* new session in Pause mode" option, the flag is reset and the sampler is running. If you
|
||||
* start VTune and enable the "Start the new session in Pause mode" option, the flag is set
|
||||
* and the sampler is not running.
|
||||
*
|
||||
* To set the flag, call VtPauseSampling(). To rest the flag, call
|
||||
* VtResumeSampling().
|
||||
*
|
||||
* Be aware that the flag is global. If one thread pauses sampling, any other thread
|
||||
* in the system can resume the sampler.
|
||||
*
|
||||
\*********************************************************************************/
|
||||
|
||||
#ifndef _VTUNEAPI_H_
|
||||
#define _VTUNEAPI_H_
|
||||
|
||||
#ifdef _VTUNE_PROFILING //Preprocessor directive that is set when using debug,
|
||||
//release with debug info, and boundschecker builds.
|
||||
//(all VTune code vanishes in release builds where this preprocessor directive isn't set)
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#if !defined(_VTUNEAPI_)
|
||||
#define VTUNEAPI __declspec(dllimport)
|
||||
#else
|
||||
#define VTUNEAPI __declspec(dllexport)
|
||||
#endif
|
||||
|
||||
|
||||
VTUNEAPI
|
||||
BOOL VtPauseSampling(void);
|
||||
|
||||
VTUNEAPI
|
||||
BOOL VtResumeSampling(void);
|
||||
|
||||
#else
|
||||
|
||||
//Replace all calls with empty statements so release builds don't waste any time!
|
||||
#define VtPauseSampling()
|
||||
#define VtResumeSampling()
|
||||
|
||||
#endif // _VTUNE_PROFILING
|
||||
|
||||
#endif // _VTUNEAPI_H_
|
||||
|
||||
@@ -0,0 +1,693 @@
|
||||
#include "sgp.h"
|
||||
#include "Debug Control.h"
|
||||
#include "expat.h"
|
||||
#include "XML.h"
|
||||
#include "Interface.h"
|
||||
#include "Text.h"
|
||||
#include "GameInitOptionsScreen.h"
|
||||
|
||||
struct
|
||||
{
|
||||
PARSE_STAGE curElement;
|
||||
|
||||
CHAR8 szCharData[MAX_CHAR_DATA_LENGTH+1];
|
||||
DIFFICULTY_SETTINGS_VALUES curDifficultySettings;
|
||||
DIFFICULTY_SETTINGS_VALUES * curArray;
|
||||
|
||||
UINT32 maxArraySize;
|
||||
UINT32 curIndex;
|
||||
UINT32 currentDepth;
|
||||
UINT32 maxReadDepth;
|
||||
}
|
||||
typedef difficultySettingsParseData;
|
||||
|
||||
BOOLEAN DifficultySettings_TextOnly;
|
||||
|
||||
static void XMLCALL
|
||||
DifficultySettingsParseDataStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts)
|
||||
{
|
||||
difficultySettingsParseData * pData = (difficultySettingsParseData *)userData;
|
||||
|
||||
if(pData->currentDepth <= pData->maxReadDepth) //are we reading this element?
|
||||
{
|
||||
if(strcmp(name, "DIFFICULTY_SETTINGS") == 0 && pData->curElement == ELEMENT_NONE)
|
||||
{
|
||||
pData->curElement = ELEMENT_LIST;
|
||||
|
||||
pData->maxReadDepth++; //we are not skipping this element
|
||||
}
|
||||
else if(strcmp(name, "DIFFICULTY") == 0 && pData->curElement == ELEMENT_LIST)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
|
||||
pData->maxReadDepth++; //we are not skipping this element
|
||||
}
|
||||
else if(pData->curElement == ELEMENT &&
|
||||
(strcmp(name, "uiIndex") == 0 ||
|
||||
strcmp(name, "Name") == 0 ||
|
||||
strcmp(name, "ConfirmText") == 0 ||
|
||||
strcmp(name, "StartingCash") == 0 ||
|
||||
strcmp(name, "EnemyAPBonus") == 0 ||
|
||||
strcmp(name, "NumKillsPerProgressPoint") == 0 ||
|
||||
strcmp(name, "InitialGarrisonPercentages") == 0 ||
|
||||
strcmp(name, "MinEnemyGroupSize") == 0 ||
|
||||
strcmp(name, "CounterAttackGroupSize") == 0 ||
|
||||
strcmp(name, "UnlimitedPoolOfTroops") == 0 ||
|
||||
strcmp(name, "QueensInitialPoolOfTroops") == 0 ||
|
||||
strcmp(name, "QueenPoolMaxSizePerDifficultyLevel" ) == 0 ||
|
||||
strcmp(name, "QueenPoolIncrementDaysPerDifficultyLevel" ) == 0 ||
|
||||
strcmp(name, "QueenPoolBaseIncrementSizePerDifficultyLevel" ) == 0 ||
|
||||
strcmp(name, "QueenPoolRecruitPercentPerDifficultyLevel" ) == 0 ||
|
||||
strcmp(name, "EnemyStartingAlertLevel") == 0 ||
|
||||
strcmp(name, "EnemyAlertDecay") == 0 ||
|
||||
strcmp(name, "NumAwareBattles") == 0 ||
|
||||
strcmp(name, "BaseDelayInMinutesBetweenEvaluations") == 0 ||
|
||||
strcmp(name, "EvaluationDelayVariance") == 0 ||
|
||||
strcmp(name, "GracePeriodInHoursAfterSectorLiberation") == 0 ||
|
||||
strcmp(name, "GracePeriodInDaysAfterPatrolDestroyed") == 0 ||
|
||||
strcmp(name, "AggressiveQueenAi") == 0 ||
|
||||
strcmp(name, "MaxMercDeaths") == 0 ||
|
||||
strcmp(name, "LootStatusModifier") == 0 ||
|
||||
strcmp(name, "CreatureSpreadTime") == 0 ||
|
||||
strcmp(name, "QueenReproductionBase") == 0 ||
|
||||
strcmp(name, "QueenReproductionBonus") == 0 ||
|
||||
strcmp(name, "QueenInitBonusSpread") == 0 ||
|
||||
strcmp(name, "CreaturePopulationModifier") == 0 ||
|
||||
strcmp(name, "CreatureTownAggressiveness") == 0 ||
|
||||
strcmp(name, "SectorJ9B1NumTroops") == 0 ||
|
||||
strcmp(name, "SectorJ9B2NumCreatures") == 0 ||
|
||||
strcmp(name, "SectorK4B1NumTroops") == 0 ||
|
||||
strcmp(name, "SectorK4B2NumElites") == 0 ||
|
||||
strcmp(name, "SectorO3B1NumTroops") == 0 ||
|
||||
strcmp(name, "SectorO3B2NumElites") == 0 ||
|
||||
strcmp(name, "SectorP3B1NumElites") == 0 ||
|
||||
strcmp(name, "StrategicAiActionWakeQueen") == 0 ||
|
||||
strcmp(name, "UpdateLastDayOfPlayerActivity") == 0 ||
|
||||
strcmp(name, "ChanceOfEnemyAmbushes") == 0 ||
|
||||
strcmp(name, "AllowReinforcements") == 0 ||
|
||||
strcmp(name, "AllowReinforcementsOmerta") == 0 ||
|
||||
strcmp(name, "PopulationLevel2") == 0 ||
|
||||
strcmp(name, "PopulationLevel3") == 0 ||
|
||||
strcmp(name, "PercentElitesBonus") == 0 ||
|
||||
strcmp(name, "WeaponCacheTroops1") == 0 ||
|
||||
strcmp(name, "WeaponCacheTroops2") == 0 ||
|
||||
strcmp(name, "WeaponCacheTroops3") == 0 ||
|
||||
strcmp(name, "WeaponCacheTroops4") == 0 ||
|
||||
strcmp(name, "WeaponCacheTroops5") == 0 ||
|
||||
strcmp(name, "UpgradeAdminsToTroops") == 0 ||
|
||||
strcmp(name, "UpgradeGarrisonsAdminsToTroops") == 0 ||
|
||||
strcmp(name, "AlwaysUpGradeAdminsToTroopsProgress" ) == 0 ||
|
||||
strcmp(name, "LevelModifierLowLimit" ) == 0 ||
|
||||
strcmp(name, "LevelModifierHighLimit" ) == 0 ||
|
||||
strcmp(name, "AllowUnrestrictedXPLevels" ) == 0 ||
|
||||
strcmp(name, "QueenAttackLosingControlOfSector") == 0 ||
|
||||
strcmp(name, "BloodcatAmbushSectors") == 0 ||
|
||||
strcmp(name, "AirRaidLookForDive") == 0 ||
|
||||
strcmp(name, "NumberOfTurnsPowerGenFanWillBeStoppedFor") == 0 ||
|
||||
strcmp(name, "RadioSightings") == 0 ||
|
||||
strcmp(name, "RadioSightings2") == 0 ||
|
||||
strcmp(name, "EnemyMoraleWorried") == 0 ||
|
||||
strcmp(name, "MaxMortarsPerTeam" ) == 0 ||
|
||||
strcmp(name, "CthConstantsAimDifficulty") == 0 ||
|
||||
strcmp(name, "CthConstantsBaseDifficulty") == 0 ||
|
||||
strcmp(name, "CthConstantsAimDifficultyMilitia") == 0 ||
|
||||
strcmp(name, "CthConstantsBaseDifficultyMilitia") == 0 ||
|
||||
strcmp(name, "CthConstantsAimDifficultyPlayer") == 0 ||
|
||||
strcmp(name, "CthConstantsBaseDifficultyPlayer") == 0
|
||||
))
|
||||
{
|
||||
pData->curElement = ELEMENT_PROPERTY;
|
||||
|
||||
pData->maxReadDepth++; //we are not skipping this element
|
||||
}
|
||||
|
||||
pData->szCharData[0] = '\0';
|
||||
}
|
||||
|
||||
pData->currentDepth++;
|
||||
|
||||
}
|
||||
|
||||
static void XMLCALL
|
||||
DifficultySettingsDataHandle(void *userData, const XML_Char *str, int len)
|
||||
{
|
||||
difficultySettingsParseData * pData = (difficultySettingsParseData *)userData;
|
||||
|
||||
if( (pData->currentDepth <= pData->maxReadDepth) &&
|
||||
(strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH)
|
||||
){
|
||||
strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void XMLCALL
|
||||
difficultySettingsEndElementHandle(void *userData, const XML_Char *name)
|
||||
{
|
||||
difficultySettingsParseData * pData = (difficultySettingsParseData *)userData;
|
||||
|
||||
if(pData->currentDepth <= pData->maxReadDepth) //we're at the end of an element that we've been reading
|
||||
{
|
||||
if(strcmp(name, "DIFFICULTY_SETTINGS") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT_NONE;
|
||||
}
|
||||
else if(strcmp(name, "DIFFICULTY") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT_LIST;
|
||||
|
||||
if (!DifficultySettings_TextOnly)
|
||||
{
|
||||
wcscpy(zDiffSetting[pData->curDifficultySettings.uiIndex].szDiffName, pData->curDifficultySettings.szDiffName);
|
||||
wcscpy(zDiffSetting[pData->curDifficultySettings.uiIndex].szConfirmText, pData->curDifficultySettings.szConfirmText);
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].iStartingCash = pData->curDifficultySettings.iStartingCash;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].iEnemyAPBonus = pData->curDifficultySettings.iEnemyAPBonus;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].iNumKillsPerProgressPoint = pData->curDifficultySettings.iNumKillsPerProgressPoint;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].iInitialGarrisonPercentages = pData->curDifficultySettings.iInitialGarrisonPercentages;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].iMinEnemyGroupSize = pData->curDifficultySettings.iMinEnemyGroupSize;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].iCounterAttackGroupSize = pData->curDifficultySettings.iCounterAttackGroupSize;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].bUnlimitedPoolOfTroops = pData->curDifficultySettings.bUnlimitedPoolOfTroops;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].iQueensInitialPoolOfTroops = pData->curDifficultySettings.iQueensInitialPoolOfTroops;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].iQueenPoolMaxSizePerDifficultyLevel = pData->curDifficultySettings.iQueenPoolMaxSizePerDifficultyLevel;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].iQueenPoolIncrementDaysPerDifficultyLevel = pData->curDifficultySettings.iQueenPoolIncrementDaysPerDifficultyLevel;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].iQueenPoolBaseIncrementSizePerDifficultyLevel = pData->curDifficultySettings.iQueenPoolBaseIncrementSizePerDifficultyLevel;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].iQueenPoolRecruitPercentPerDifficultyLevel = pData->curDifficultySettings.iQueenPoolRecruitPercentPerDifficultyLevel;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].iEnemyStartingAlertLevel = pData->curDifficultySettings.iEnemyStartingAlertLevel;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].iEnemyAlertDecay = pData->curDifficultySettings.iEnemyAlertDecay;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].iNumAwareBattles = pData->curDifficultySettings.iNumAwareBattles;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].iBaseDelayInMinutesBetweenEvaluations = pData->curDifficultySettings.iBaseDelayInMinutesBetweenEvaluations;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].iEvaluationDelayVariance = pData->curDifficultySettings.iEvaluationDelayVariance;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].iGracePeriodInHoursAfterSectorLiberation = pData->curDifficultySettings.iGracePeriodInHoursAfterSectorLiberation;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].iGracePeriodInDaysAfterPatrolDestroyed = pData->curDifficultySettings.iGracePeriodInDaysAfterPatrolDestroyed;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].bAggressiveQueenAi = pData->curDifficultySettings.bAggressiveQueenAi;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].iMaxMercDeaths = pData->curDifficultySettings.iMaxMercDeaths;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].usLootStatusModifier = pData->curDifficultySettings.usLootStatusModifier;
|
||||
|
||||
//Creatures Settings
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].iCreatureSpreadTime = pData->curDifficultySettings.iCreatureSpreadTime;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].iQueenReproductionBase = pData->curDifficultySettings.iQueenReproductionBase;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].iQueenReproductionBonus = pData->curDifficultySettings.iQueenReproductionBonus;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].iQueenInitBonusSpread = pData->curDifficultySettings.iQueenInitBonusSpread;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].iCreaturePopulationModifier = pData->curDifficultySettings.iCreaturePopulationModifier;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].iCreatureTownAggressiveness = pData->curDifficultySettings.iCreatureTownAggressiveness;
|
||||
|
||||
//sectors
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].iJ9B1NumTroops = pData->curDifficultySettings.iJ9B1NumTroops;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].iJ9B2NumCreatures = pData->curDifficultySettings.iJ9B2NumCreatures;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].iK4B1NumTroops = pData->curDifficultySettings.iK4B1NumTroops;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].iK4B1NumElites = pData->curDifficultySettings.iK4B1NumElites;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].iO3B1NumTroops = pData->curDifficultySettings.iO3B1NumTroops;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].iO3B1NumElites = pData->curDifficultySettings.iO3B1NumElites;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].iP3B1NumElites = pData->curDifficultySettings.iP3B1NumElites;
|
||||
|
||||
//Other
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].bStrategicAiActionWakeQueen = pData->curDifficultySettings.bStrategicAiActionWakeQueen;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].iUpdateLastDayOfPlayerActivity = pData->curDifficultySettings.iUpdateLastDayOfPlayerActivity;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].iChanceOfEnemyAmbushes = pData->curDifficultySettings.iChanceOfEnemyAmbushes;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].bAllowReinforcements = pData->curDifficultySettings.bAllowReinforcements;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].bAllowReinforcementsOmerta = pData->curDifficultySettings.bAllowReinforcementsOmerta;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].iPercentElitesBonus = pData->curDifficultySettings.iPercentElitesBonus;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].iDesiredPopulationL2 = pData->curDifficultySettings.iDesiredPopulationL2;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].iDesiredPopulationL3 = pData->curDifficultySettings.iDesiredPopulationL3;
|
||||
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].iWeaponCacheTroops1 = pData->curDifficultySettings.iWeaponCacheTroops1;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].iWeaponCacheTroops2 = pData->curDifficultySettings.iWeaponCacheTroops2;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].iWeaponCacheTroops3 = pData->curDifficultySettings.iWeaponCacheTroops3;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].iWeaponCacheTroops4 = pData->curDifficultySettings.iWeaponCacheTroops4;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].iWeaponCacheTroops5 = pData->curDifficultySettings.iWeaponCacheTroops5;
|
||||
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].bUpgradeAdminsToTroops = pData->curDifficultySettings.bUpgradeAdminsToTroops;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].bUpgradeGarrisonsAdminsToTroops = pData->curDifficultySettings.bUpgradeGarrisonsAdminsToTroops;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].usAlwaysUpGradeAdminsToTroopsProgress = pData->curDifficultySettings.usAlwaysUpGradeAdminsToTroopsProgress;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].usLevelModifierLowLimit = pData->curDifficultySettings.usLevelModifierLowLimit;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].usLevelModifierHighLimit = pData->curDifficultySettings.usLevelModifierHighLimit;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].bAllowUnrestrictedXPLevels = pData->curDifficultySettings.bAllowUnrestrictedXPLevels;
|
||||
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].bQueenLosingControlOfSector = pData->curDifficultySettings.bQueenLosingControlOfSector;
|
||||
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].bBloodcatAmbush = pData->curDifficultySettings.bBloodcatAmbush;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].bAirRaidLookForDive = pData->curDifficultySettings.bAirRaidLookForDive;
|
||||
|
||||
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].iGetNumberOfTurnsPowerGenFanWillBeStoppedFor = pData->curDifficultySettings.iGetNumberOfTurnsPowerGenFanWillBeStoppedFor;
|
||||
|
||||
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].bRadioSightings = pData->curDifficultySettings.bRadioSightings;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].bRadioSightings2 = pData->curDifficultySettings.bRadioSightings2;
|
||||
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].fCTHSettingsAimDifficultyEnemy = pData->curDifficultySettings.fCTHSettingsAimDifficultyEnemy;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].fCTHSettingsBaseDifficultyEnemy = pData->curDifficultySettings.fCTHSettingsBaseDifficultyEnemy;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].fCTHSettingsAimDifficultyMilitia = pData->curDifficultySettings.fCTHSettingsAimDifficultyMilitia;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].fCTHSettingsBaseDifficultyMilitia = pData->curDifficultySettings.fCTHSettingsBaseDifficultyMilitia;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].fCTHSettingsAimDifficultyPlayer = pData->curDifficultySettings.fCTHSettingsAimDifficultyPlayer;
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].fCTHSettingsBaseDifficultyPlayer = pData->curDifficultySettings.fCTHSettingsBaseDifficultyPlayer;
|
||||
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].bEnemyMoraleWorried = pData->curDifficultySettings.bEnemyMoraleWorried;
|
||||
|
||||
zDiffSetting[pData->curDifficultySettings.uiIndex].usMaxMortarsPerTeam = pData->curDifficultySettings.usMaxMortarsPerTeam;
|
||||
}
|
||||
else
|
||||
{
|
||||
wcscpy(zDiffSetting[pData->curDifficultySettings.uiIndex].szDiffName, pData->curDifficultySettings.szDiffName);
|
||||
wcscpy(zDiffSetting[pData->curDifficultySettings.uiIndex].szConfirmText, pData->curDifficultySettings.szConfirmText);
|
||||
}
|
||||
|
||||
}
|
||||
else if(strcmp(name, "uiIndex") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.uiIndex = (UINT16) atol(pData->szCharData);
|
||||
MaxDifficultySettingsValues++;
|
||||
}
|
||||
else if(strcmp(name, "Name") == 0 )
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
|
||||
MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curDifficultySettings.szDiffName, sizeof(pData->curDifficultySettings.szDiffName)/sizeof(pData->curDifficultySettings.szDiffName[0]) );
|
||||
pData->curDifficultySettings.szDiffName[sizeof(pData->curDifficultySettings.szDiffName)/sizeof(pData->curDifficultySettings.szDiffName[0]) - 1] = '\0';
|
||||
}
|
||||
else if(strcmp(name, "ConfirmText") == 0 )
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
|
||||
MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curDifficultySettings.szConfirmText, sizeof(pData->curDifficultySettings.szConfirmText)/sizeof(pData->curDifficultySettings.szConfirmText[0]) );
|
||||
pData->curDifficultySettings.szConfirmText[sizeof(pData->curDifficultySettings.szConfirmText)/sizeof(pData->curDifficultySettings.szConfirmText[0]) - 1] = '\0';
|
||||
}
|
||||
else if(strcmp(name, "StartingCash") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.iStartingCash = (INT32) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "EnemyAPBonus") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.iEnemyAPBonus = (INT8) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "NumKillsPerProgressPoint") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.iNumKillsPerProgressPoint = (UINT16) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "InitialGarrisonPercentages") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.iInitialGarrisonPercentages = (INT32) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "MinEnemyGroupSize") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.iMinEnemyGroupSize = (UINT8) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "CounterAttackGroupSize") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.iCounterAttackGroupSize = (UINT8) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "PercentElitesBonus") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.iPercentElitesBonus = (INT32) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "UnlimitedPoolOfTroops") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.bUnlimitedPoolOfTroops = (BOOLEAN) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "QueensInitialPoolOfTroops") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.iQueensInitialPoolOfTroops = max( 0, (INT32)atol( pData->szCharData ) );
|
||||
}
|
||||
else if ( strcmp( name, "QueenPoolIncrementDaysPerDifficultyLevel" ) == 0 )
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.iQueenPoolIncrementDaysPerDifficultyLevel = (UINT16)atol( pData->szCharData );
|
||||
}
|
||||
else if ( strcmp( name, "QueenPoolBaseIncrementSizePerDifficultyLevel" ) == 0 )
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.iQueenPoolBaseIncrementSizePerDifficultyLevel = (INT32)atol( pData->szCharData );
|
||||
pData->curDifficultySettings.iQueenPoolBaseIncrementSizePerDifficultyLevel = max( 0, pData->curDifficultySettings.iQueenPoolBaseIncrementSizePerDifficultyLevel );
|
||||
}
|
||||
else if ( strcmp( name, "QueenPoolRecruitPercentPerDifficultyLevel" ) == 0 )
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.iQueenPoolRecruitPercentPerDifficultyLevel = (UINT8)atol( pData->szCharData );
|
||||
pData->curDifficultySettings.iQueenPoolRecruitPercentPerDifficultyLevel = min( 100, pData->curDifficultySettings.iQueenPoolRecruitPercentPerDifficultyLevel );
|
||||
}
|
||||
else if ( strcmp( name, "QueenPoolMaxSizePerDifficultyLevel" ) == 0 )
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.iQueenPoolMaxSizePerDifficultyLevel = (INT32)atol( pData->szCharData );
|
||||
pData->curDifficultySettings.iQueenPoolMaxSizePerDifficultyLevel = max( 0, pData->curDifficultySettings.iQueenPoolMaxSizePerDifficultyLevel );
|
||||
}
|
||||
else if(strcmp(name, "EnemyStartingAlertLevel") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.iEnemyStartingAlertLevel = (UINT32) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "EnemyAlertDecay") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.iEnemyAlertDecay = (UINT32) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "NumAwareBattles") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.iNumAwareBattles = (UINT32) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "BaseDelayInMinutesBetweenEvaluations") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.iBaseDelayInMinutesBetweenEvaluations = (UINT32) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "EvaluationDelayVariance") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.iEvaluationDelayVariance = (UINT32) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "GracePeriodInHoursAfterSectorLiberation") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.iGracePeriodInHoursAfterSectorLiberation = (UINT32) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "GracePeriodInDaysAfterPatrolDestroyed") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.iGracePeriodInDaysAfterPatrolDestroyed = (UINT32) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "AggressiveQueenAi") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.bAggressiveQueenAi = (BOOLEAN) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "MaxMercDeaths") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.iMaxMercDeaths = (INT32) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "LootStatusModifier") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.usLootStatusModifier = (UINT8) atol(pData->szCharData);
|
||||
}
|
||||
//Creatures Settings
|
||||
else if(strcmp(name, "CreatureSpreadTime") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.iCreatureSpreadTime = (UINT16) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "QueenReproductionBase") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.iQueenReproductionBase = (UINT8) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "QueenReproductionBonus") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.iQueenReproductionBonus = (UINT8) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "QueenInitBonusSpread") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.iQueenInitBonusSpread = (UINT8) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "CreaturePopulationModifier") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.iCreaturePopulationModifier = (INT8) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "CreatureTownAggressiveness") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.iCreatureTownAggressiveness = (INT8) atol(pData->szCharData);
|
||||
}
|
||||
//sectors
|
||||
else if(strcmp(name, "SectorJ9B1NumTroops") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.iJ9B1NumTroops = (UINT8) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "SectorJ9B2NumCreatures") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.iJ9B2NumCreatures = (UINT8) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "SectorK4B1NumTroops") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.iK4B1NumTroops = (UINT8) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "SectorK4B1NumElites") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.iK4B1NumElites = (UINT8) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "SectorO3B1NumTroops") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.iO3B1NumTroops = (UINT8) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "SectorO3B1NumElites") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.iO3B1NumElites = (UINT8) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "SectorP3B1NumElites") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.iP3B1NumElites = (UINT8) atol(pData->szCharData);
|
||||
}
|
||||
//Sector
|
||||
else if(strcmp(name, "StrategicAiActionWakeQueen") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.bStrategicAiActionWakeQueen = (BOOLEAN) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "UpdateLastDayOfPlayerActivity") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.iUpdateLastDayOfPlayerActivity = (UINT16) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "ChanceOfEnemyAmbushes") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.iChanceOfEnemyAmbushes = (INT32) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "AllowReinforcements") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.bAllowReinforcements = (BOOLEAN) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "AllowReinforcementsOmerta") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.bAllowReinforcementsOmerta = (BOOLEAN) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "PopulationLevel2") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.iDesiredPopulationL2 = (BOOLEAN) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "PopulationLevel3") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.iDesiredPopulationL3 = (BOOLEAN) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "WeaponCacheTroops1") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.iWeaponCacheTroops1 = (UINT8) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "WeaponCacheTroops2") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.iWeaponCacheTroops2 = (UINT8) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "WeaponCacheTroops3") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.iWeaponCacheTroops3 = (UINT8) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "WeaponCacheTroops4") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.iWeaponCacheTroops4 = (UINT8) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "WeaponCacheTroops5") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.iWeaponCacheTroops5 = (UINT8) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "UpgradeAdminsToTroops") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.bUpgradeAdminsToTroops = (BOOLEAN) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "UpgradeGarrisonsAdminsToTroops") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.bUpgradeGarrisonsAdminsToTroops = (BOOLEAN)atol( pData->szCharData );
|
||||
}
|
||||
else if ( strcmp( name, "AlwaysUpGradeAdminsToTroopsProgress" ) == 0 )
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.usAlwaysUpGradeAdminsToTroopsProgress = (UINT8)atol( pData->szCharData );
|
||||
pData->curDifficultySettings.usAlwaysUpGradeAdminsToTroopsProgress = min( pData->curDifficultySettings.usAlwaysUpGradeAdminsToTroopsProgress, 100 );
|
||||
}
|
||||
else if ( strcmp( name, "LevelModifierLowLimit" ) == 0 )
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.usLevelModifierLowLimit = (UINT8)atol( pData->szCharData );
|
||||
pData->curDifficultySettings.usLevelModifierLowLimit = min( pData->curDifficultySettings.usLevelModifierLowLimit, 5 );
|
||||
}
|
||||
else if ( strcmp( name, "LevelModifierHighLimit" ) == 0 )
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.usLevelModifierHighLimit = (UINT8)atol( pData->szCharData );
|
||||
pData->curDifficultySettings.usLevelModifierHighLimit = min( pData->curDifficultySettings.usLevelModifierHighLimit, 5 );
|
||||
}
|
||||
else if(strcmp(name, "AllowUnrestrictedXPLevels") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.bAllowUnrestrictedXPLevels = (BOOLEAN) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "QueenAttackLosingControlOfSector") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.bQueenLosingControlOfSector = (BOOLEAN) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "BloodcatAmbushSectors") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.bBloodcatAmbush = (BOOLEAN) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "AirRaidLookForDive") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.bAirRaidLookForDive = (BOOLEAN) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "NumberOfTurnsPowerGenFanWillBeStoppedFor") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.iGetNumberOfTurnsPowerGenFanWillBeStoppedFor = (UINT32) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "RadioSightings") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.bRadioSightings = (BOOLEAN) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "RadioSightings2") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.bRadioSightings2 = (BOOLEAN) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "EnemyMoraleWorried") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.bEnemyMoraleWorried = (BOOLEAN) atol(pData->szCharData);
|
||||
}
|
||||
else if ( strcmp( name, "MaxMortarsPerTeam" ) == 0 )
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.usMaxMortarsPerTeam = (UINT8)atol( pData->szCharData );
|
||||
}
|
||||
else if(strcmp(name, "CthConstantsAimDifficulty") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.fCTHSettingsAimDifficultyEnemy = (FLOAT) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "CthConstantsBaseDifficulty") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.fCTHSettingsBaseDifficultyEnemy = (FLOAT) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "CthConstantsAimDifficultyMilitia") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.fCTHSettingsAimDifficultyMilitia = (FLOAT) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "CthConstantsBaseDifficultyMilitia") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.fCTHSettingsBaseDifficultyMilitia = (FLOAT) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "CthConstantsAimDifficultyPlayer") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.fCTHSettingsAimDifficultyPlayer = (FLOAT) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "CthConstantsBaseDifficultyPlayer") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curDifficultySettings.fCTHSettingsBaseDifficultyPlayer = (FLOAT) atol(pData->szCharData);
|
||||
}
|
||||
pData->maxReadDepth--;
|
||||
}
|
||||
pData->currentDepth--;
|
||||
}
|
||||
|
||||
BOOLEAN ReadInDifficultySettings( STR fileName, BOOLEAN localizedVersion)
|
||||
{
|
||||
HWFILE hFile;
|
||||
UINT32 uiBytesRead;
|
||||
UINT32 uiFSize;
|
||||
CHAR8 * lpcBuffer;
|
||||
XML_Parser parser = XML_ParserCreate(NULL);
|
||||
|
||||
difficultySettingsParseData pData;
|
||||
|
||||
MaxDifficultySettingsValues = 0;
|
||||
|
||||
DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "Loading DifficultySettings.xml" );
|
||||
|
||||
DifficultySettings_TextOnly = localizedVersion;
|
||||
|
||||
// Open file
|
||||
hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE );
|
||||
if ( !hFile )
|
||||
return( localizedVersion );
|
||||
|
||||
uiFSize = FileGetSize(hFile);
|
||||
lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1);
|
||||
|
||||
//Read in block
|
||||
if ( !FileRead( hFile, lpcBuffer, uiFSize, &uiBytesRead ) )
|
||||
{
|
||||
MemFree(lpcBuffer);
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
lpcBuffer[uiFSize] = 0; //add a null terminator
|
||||
|
||||
FileClose( hFile );
|
||||
|
||||
|
||||
XML_SetElementHandler(parser, DifficultySettingsParseDataStartElementHandle, difficultySettingsEndElementHandle);
|
||||
XML_SetCharacterDataHandler(parser, DifficultySettingsDataHandle);
|
||||
|
||||
|
||||
memset(&pData,0,sizeof(pData));
|
||||
XML_SetUserData(parser, &pData);
|
||||
|
||||
|
||||
if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE))
|
||||
{
|
||||
CHAR8 errorBuf[511];
|
||||
|
||||
sprintf(errorBuf, "XML Parser Error in DifficultySettings.xml: %s at line %d", XML_ErrorString(XML_GetErrorCode(parser)), XML_GetCurrentLineNumber(parser));
|
||||
LiveMessage(errorBuf);
|
||||
|
||||
MemFree(lpcBuffer);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
MemFree(lpcBuffer);
|
||||
|
||||
|
||||
XML_ParserFree(parser);
|
||||
|
||||
MaxDifficultySettingsValues--;
|
||||
|
||||
return( TRUE );
|
||||
}
|
||||
@@ -0,0 +1,179 @@
|
||||
#include "sgp.h"
|
||||
#include "Debug Control.h"
|
||||
#include "expat.h"
|
||||
#include "XML.h"
|
||||
#include "Interface.h"
|
||||
#include "Intro.h"
|
||||
|
||||
struct
|
||||
{
|
||||
PARSE_STAGE curElement;
|
||||
|
||||
CHAR8 szCharData[MAX_CHAR_DATA_LENGTH+1];
|
||||
INTRO_NAMES_VALUES curIntroNames;
|
||||
INTRO_NAMES_VALUES * curArray;
|
||||
|
||||
UINT32 maxArraySize;
|
||||
UINT32 curIndex;
|
||||
UINT32 currentDepth;
|
||||
UINT32 maxReadDepth;
|
||||
//CHAR16 gzEnemyNames[MAX_ENEMY_NAMES_CHARS];
|
||||
}
|
||||
typedef introNamesParseData;
|
||||
|
||||
BOOLEAN IntroName_TextOnly;
|
||||
|
||||
static void XMLCALL
|
||||
introNamesStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts)
|
||||
{
|
||||
introNamesParseData * pData = (introNamesParseData *)userData;
|
||||
|
||||
if(pData->currentDepth <= pData->maxReadDepth) //are we reading this element?
|
||||
{
|
||||
if(strcmp(name, "INTRO_FILES") == 0 && pData->curElement == ELEMENT_NONE)
|
||||
{
|
||||
pData->curElement = ELEMENT_LIST;
|
||||
|
||||
pData->maxReadDepth++; //we are not skipping this element
|
||||
}
|
||||
else if(strcmp(name, "FILE") == 0 && pData->curElement == ELEMENT_LIST)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
|
||||
pData->maxReadDepth++; //we are not skipping this element
|
||||
}
|
||||
else if(pData->curElement == ELEMENT &&
|
||||
(strcmp(name, "uiIndex") == 0 ||
|
||||
strcmp(name, "szFile") == 0 ))
|
||||
{
|
||||
pData->curElement = ELEMENT_PROPERTY;
|
||||
|
||||
pData->maxReadDepth++; //we are not skipping this element
|
||||
}
|
||||
|
||||
pData->szCharData[0] = '\0';
|
||||
}
|
||||
|
||||
pData->currentDepth++;
|
||||
|
||||
}
|
||||
|
||||
static void XMLCALL
|
||||
introNamesCharacterDataHandle(void *userData, const XML_Char *str, int len)
|
||||
{
|
||||
introNamesParseData * pData = (introNamesParseData *)userData;
|
||||
|
||||
if( (pData->currentDepth <= pData->maxReadDepth) &&
|
||||
(strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH)
|
||||
){
|
||||
strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void XMLCALL
|
||||
introNamesEndElementHandle(void *userData, const XML_Char *name)
|
||||
{
|
||||
introNamesParseData * pData = (introNamesParseData *)userData;
|
||||
|
||||
if(pData->currentDepth <= pData->maxReadDepth)
|
||||
{
|
||||
if(strcmp(name, "VIDEO_FILES") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT_NONE;
|
||||
}
|
||||
else if(strcmp(name, "FILE") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT_LIST;
|
||||
|
||||
if (!IntroName_TextOnly)
|
||||
{
|
||||
wcscpy(zVideoFile[pData->curIntroNames.uiIndex].szFile, pData->curIntroNames.szFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
wcscpy(zVideoFile[pData->curIntroNames.uiIndex].szFile, pData->curIntroNames.szFile);
|
||||
}
|
||||
|
||||
}
|
||||
else if(strcmp(name, "uiIndex") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curIntroNames.uiIndex = (UINT16) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "szFile") == 0 )
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
|
||||
MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curIntroNames.szFile, sizeof(pData->curIntroNames.szFile)/sizeof(pData->curIntroNames.szFile[0]) );
|
||||
pData->curIntroNames.szFile[sizeof(pData->curIntroNames.szFile)/sizeof(pData->curIntroNames.szFile[0]) - 1] = '\0';
|
||||
}
|
||||
pData->maxReadDepth--;
|
||||
}
|
||||
pData->currentDepth--;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
BOOLEAN ReadInIntroNames(STR fileName, BOOLEAN localizedVersion)
|
||||
{
|
||||
HWFILE hFile;
|
||||
UINT32 uiBytesRead;
|
||||
UINT32 uiFSize;
|
||||
CHAR8 * lpcBuffer;
|
||||
XML_Parser parser = XML_ParserCreate(NULL);
|
||||
|
||||
introNamesParseData pData;
|
||||
|
||||
DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "Loading IntroFiles.xml" );
|
||||
|
||||
IntroName_TextOnly = localizedVersion;
|
||||
|
||||
// Open file
|
||||
hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE );
|
||||
if ( !hFile )
|
||||
return( localizedVersion );
|
||||
|
||||
uiFSize = FileGetSize(hFile);
|
||||
lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1);
|
||||
|
||||
//Read in block
|
||||
if ( !FileRead( hFile, lpcBuffer, uiFSize, &uiBytesRead ) )
|
||||
{
|
||||
MemFree(lpcBuffer);
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
lpcBuffer[uiFSize] = 0; //add a null terminator
|
||||
|
||||
FileClose( hFile );
|
||||
|
||||
|
||||
XML_SetElementHandler(parser, introNamesStartElementHandle, introNamesEndElementHandle);
|
||||
XML_SetCharacterDataHandler(parser, introNamesCharacterDataHandle);
|
||||
|
||||
|
||||
memset(&pData,0,sizeof(pData));
|
||||
XML_SetUserData(parser, &pData);
|
||||
|
||||
|
||||
if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE))
|
||||
{
|
||||
CHAR8 errorBuf[511];
|
||||
|
||||
sprintf(errorBuf, "XML Parser Error in IntroFiles.xml: %s at line %d", XML_ErrorString(XML_GetErrorCode(parser)), XML_GetCurrentLineNumber(parser));
|
||||
LiveMessage(errorBuf);
|
||||
|
||||
MemFree(lpcBuffer);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
MemFree(lpcBuffer);
|
||||
|
||||
|
||||
XML_ParserFree(parser);
|
||||
|
||||
|
||||
return( TRUE );
|
||||
}
|
||||
@@ -0,0 +1,259 @@
|
||||
#include "sgp.h"
|
||||
#include "Debug Control.h"
|
||||
#include "expat.h"
|
||||
#include "XML.h"
|
||||
#include "mainmenuscreen.h"
|
||||
|
||||
struct
|
||||
{
|
||||
PARSE_STAGE curElement;
|
||||
|
||||
CHAR8 szCharData[MAX_CHAR_DATA_LENGTH+1];
|
||||
MAIN_MENU_VALUES curMainMenu;
|
||||
MAIN_MENU_VALUES * curArray;
|
||||
|
||||
UINT32 maxArraySize;
|
||||
UINT32 curIndex;
|
||||
UINT32 currentDepth;
|
||||
UINT32 maxReadDepth;
|
||||
}
|
||||
typedef mainMenuParseData;
|
||||
|
||||
static void XMLCALL
|
||||
mainMenuStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts)
|
||||
{
|
||||
mainMenuParseData * pData = (mainMenuParseData *)userData;
|
||||
|
||||
if(pData->currentDepth <= pData->maxReadDepth) //are we reading this element?
|
||||
{
|
||||
if(strcmp(name, "MAINMENU") == 0 && pData->curElement == ELEMENT_NONE)
|
||||
{
|
||||
pData->curElement = ELEMENT_LIST;
|
||||
|
||||
memset(pData->curArray,0,sizeof(MAIN_MENU_VALUES)*pData->maxArraySize);
|
||||
|
||||
pData->maxReadDepth++; //we are not skipping this element
|
||||
}
|
||||
else if(strcmp(name, "IMAGE") == 0 && pData->curElement == ELEMENT_LIST)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
|
||||
memset(&pData->curMainMenu,0,sizeof(MAIN_MENU_VALUES));
|
||||
|
||||
pData->maxReadDepth++; //we are not skipping this element
|
||||
}
|
||||
else if(pData->curElement == ELEMENT &&
|
||||
(strcmp(name, "uiIndex") == 0 ||
|
||||
strcmp(name, "Visible") == 0 ||
|
||||
strcmp(name, "FileName") == 0 ||
|
||||
strcmp(name, "FitToScreen") == 0 ||
|
||||
strcmp(name, "StretchImage") == 0 ||
|
||||
strcmp(name, "CenterImage") == 0 ||
|
||||
strcmp(name, "ImagePositionRelative") == 0 ||
|
||||
strcmp(name, "ImagePositionX") == 0 ||
|
||||
strcmp(name, "ImagePositionY") == 0 ||
|
||||
strcmp(name, "MainMenuY") == 0 ||
|
||||
strcmp(name, "MainMenuX") == 0 ||
|
||||
strcmp(name, "MainMenuYSpace") == 0 ))
|
||||
{
|
||||
pData->curElement = ELEMENT_PROPERTY;
|
||||
|
||||
pData->maxReadDepth++; //we are not skipping this element
|
||||
}
|
||||
|
||||
pData->szCharData[0] = '\0';
|
||||
}
|
||||
|
||||
pData->currentDepth++;
|
||||
|
||||
}
|
||||
|
||||
static void XMLCALL
|
||||
mainMenuCharacterDataHandle(void *userData, const XML_Char *str, int len)
|
||||
{
|
||||
mainMenuParseData * pData = (mainMenuParseData *)userData;
|
||||
|
||||
if( (pData->currentDepth <= pData->maxReadDepth) &&
|
||||
(strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH)
|
||||
){
|
||||
strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void XMLCALL
|
||||
mainMenuEndElementHandle(void *userData, const XML_Char *name)
|
||||
{
|
||||
char temp;
|
||||
mainMenuParseData * pData = (mainMenuParseData *)userData;
|
||||
|
||||
if(pData->currentDepth <= pData->maxReadDepth)
|
||||
{
|
||||
if(strcmp(name, "MAINMENU") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT_NONE;
|
||||
}
|
||||
else if(strcmp(name, "IMAGE") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT_LIST;
|
||||
|
||||
if(pData->curMainMenu.uiIndex < pData->maxArraySize)
|
||||
{
|
||||
pData->curArray[pData->curMainMenu.uiIndex] = pData->curMainMenu;
|
||||
}
|
||||
}
|
||||
else if(strcmp(name, "uiIndex") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curMainMenu.uiIndex = (UINT32) strtoul(pData->szCharData, NULL, 0);
|
||||
}
|
||||
else if(strcmp(name, "Visible") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
if (pData->curMainMenu.uiIndex == 0 ) pData->curMainMenu.Visible = 0;
|
||||
|
||||
else pData->curMainMenu.Visible = (BOOLEAN) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "FileName") == 0 && pData->curMainMenu.uiIndex > 0)
|
||||
{
|
||||
|
||||
pData->curElement = ELEMENT;
|
||||
|
||||
if(MAX_MAIN_MENU_CHARS >= strlen(pData->szCharData))
|
||||
strcpy(pData->curMainMenu.FileName,pData->szCharData);
|
||||
else
|
||||
{
|
||||
strncpy(pData->curMainMenu.FileName,pData->szCharData,MAX_MAIN_MENU_CHARS);
|
||||
pData->curMainMenu.FileName[MAX_MAIN_MENU_CHARS-1] = '\0';
|
||||
}
|
||||
|
||||
for(int i=0;i<min((int)strlen(pData->szCharData),MAX_MAIN_MENU_CHARS);i++) {
|
||||
temp = pData->szCharData[i];
|
||||
pData->curMainMenu.FileName[i] = temp;
|
||||
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("itemEndElementHandle: szLocation[%d] = %s, temp = %s",i,&pData->curSectorLoadscreens.szLocation[i],&temp));
|
||||
}
|
||||
}
|
||||
else if(strcmp(name, "FitToScreen") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
if (pData->curMainMenu.uiIndex == 0 ) pData->curMainMenu.FitToScreen = 0;
|
||||
|
||||
else pData->curMainMenu.FitToScreen = (BOOLEAN) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "StretchImage") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
if (pData->curMainMenu.uiIndex == 0 ) pData->curMainMenu.StretchImage = 0;
|
||||
|
||||
else pData->curMainMenu.StretchImage = (BOOLEAN) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "CenterImage") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
if (pData->curMainMenu.uiIndex == 0 ) pData->curMainMenu.CenterImage = 0;
|
||||
|
||||
else pData->curMainMenu.CenterImage = (BOOLEAN) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "ImagePositionRelative") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
if (pData->curMainMenu.uiIndex == 0 ) pData->curMainMenu.ImagePositionRelative = 0;
|
||||
|
||||
else pData->curMainMenu.ImagePositionRelative = (BOOLEAN) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "ImagePositionX") == 0 && pData->curMainMenu.uiIndex > 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curMainMenu.ImagePositionX = (INT32) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "ImagePositionY") == 0 && pData->curMainMenu.uiIndex > 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curMainMenu.ImagePositionY = (INT32) atol(pData->szCharData);
|
||||
}
|
||||
else if(strcmp(name, "MainMenuY") == 0 && pData->curMainMenu.uiIndex == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curMainMenu.MAINMENU_Y = (UINT32) strtoul(pData->szCharData, NULL, 0);
|
||||
}
|
||||
else if(strcmp(name, "MainMenuX") == 0 && pData->curMainMenu.uiIndex == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curMainMenu.MAINMENU_X = (UINT32) strtoul(pData->szCharData, NULL, 0);
|
||||
}
|
||||
else if(strcmp(name, "MainMenuYSpace") == 0 && pData->curMainMenu.uiIndex == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curMainMenu.MAINMENU_Y_SPACE = (UINT32) strtoul(pData->szCharData, NULL, 0);
|
||||
}
|
||||
pData->maxReadDepth--;
|
||||
}
|
||||
|
||||
pData->currentDepth--;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
BOOLEAN ReadInMainMenu(MAIN_MENU_VALUES *pMainMenu, STR fileName)
|
||||
{
|
||||
HWFILE hFile;
|
||||
UINT32 uiBytesRead;
|
||||
UINT32 uiFSize;
|
||||
CHAR8 * lpcBuffer;
|
||||
XML_Parser parser = XML_ParserCreate(NULL);
|
||||
|
||||
mainMenuParseData pData;
|
||||
|
||||
DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "Loading Layout:LayoutMainMenu.xml" );
|
||||
|
||||
// Open file
|
||||
hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE );
|
||||
if ( !hFile )
|
||||
return( FALSE );
|
||||
|
||||
uiFSize = FileGetSize(hFile);
|
||||
lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1);
|
||||
|
||||
//Read in block
|
||||
if ( !FileRead( hFile, lpcBuffer, uiFSize, &uiBytesRead ) )
|
||||
{
|
||||
MemFree(lpcBuffer);
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
lpcBuffer[uiFSize] = 0; //add a null terminator
|
||||
|
||||
FileClose( hFile );
|
||||
|
||||
|
||||
XML_SetElementHandler(parser, mainMenuStartElementHandle, mainMenuEndElementHandle);
|
||||
XML_SetCharacterDataHandler(parser, mainMenuCharacterDataHandle);
|
||||
|
||||
|
||||
memset(&pData,0,sizeof(pData));
|
||||
pData.curArray = pMainMenu;
|
||||
pData.maxArraySize = MAX_MAIN_MENU_IMAGE;
|
||||
|
||||
XML_SetUserData(parser, &pData);
|
||||
|
||||
|
||||
if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE))
|
||||
{
|
||||
CHAR8 errorBuf[511];
|
||||
|
||||
sprintf(errorBuf, "XML Parser Error in MainMenu.xml: %s at line %d", XML_ErrorString(XML_GetErrorCode(parser)), XML_GetCurrentLineNumber(parser));
|
||||
LiveMessage(errorBuf);
|
||||
|
||||
MemFree(lpcBuffer);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
MemFree(lpcBuffer);
|
||||
|
||||
|
||||
XML_ParserFree(parser);
|
||||
|
||||
|
||||
return( TRUE );
|
||||
}
|
||||
@@ -0,0 +1,397 @@
|
||||
#include "builddefines.h"
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include "sgp.h"
|
||||
#include "gameloop.h"
|
||||
#include "himage.h"
|
||||
#include "vobject.h"
|
||||
#include "vobject_blitters.h"
|
||||
#include "worlddef.h"
|
||||
#include "renderworld.h"
|
||||
#include "input.h"
|
||||
#include "font.h"
|
||||
#include "screenids.h"
|
||||
#include "overhead.h"
|
||||
#include "sysutil.h"
|
||||
#include "Font Control.h"
|
||||
#include "Animation Control.h"
|
||||
#include "Animation Data.h"
|
||||
#include "Event Pump.h"
|
||||
#include "Render Dirty.h"
|
||||
#include "Sys Globals.h"
|
||||
#include "Interface.h"
|
||||
#include <wchar.h>
|
||||
#include <tchar.h>
|
||||
#include "english.h"
|
||||
#include "Fileman.h"
|
||||
#include "messageboxscreen.h"
|
||||
|
||||
//forward declarations of common classes to eliminate includes
|
||||
class OBJECTTYPE;
|
||||
class SOLDIERTYPE;
|
||||
|
||||
|
||||
void BuildListFile( );
|
||||
|
||||
|
||||
BOOLEAN gfAniEditMode = FALSE;
|
||||
static UINT16 usStartAnim = 0;
|
||||
static UINT8 ubStartHeight = 0;
|
||||
static SOLDIERTYPE *pSoldier;
|
||||
|
||||
static BOOLEAN fOKFiles = FALSE;
|
||||
static UINT8 ubNumStates = 0;
|
||||
static UINT16 *pusStates = NULL;
|
||||
static INT8 ubCurLoadedState = 0;
|
||||
|
||||
void CycleAnimations( )
|
||||
{
|
||||
INT32 cnt;
|
||||
|
||||
// FInd the next animation with start height the same...
|
||||
for ( cnt = usStartAnim + 1; cnt < NUMANIMATIONSTATES; cnt++ )
|
||||
{
|
||||
if ( gAnimControl[ cnt ].ubHeight == ubStartHeight )
|
||||
{
|
||||
usStartAnim = ( UINT8) cnt;
|
||||
pSoldier->EVENT_InitNewSoldierAnim( usStartAnim, 0 , TRUE );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
usStartAnim = 0;
|
||||
pSoldier->EVENT_InitNewSoldierAnim( usStartAnim, 0 , TRUE );
|
||||
}
|
||||
|
||||
|
||||
UINT32 AniEditScreenInit(void)
|
||||
{
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// The ShutdownGame function will free up/undo all things that were started in InitializeGame()
|
||||
// It will also be responsible to making sure that all Gaming Engine tasks exit properly
|
||||
|
||||
UINT32 AniEditScreenShutdown(void)
|
||||
{
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
UINT32 AniEditScreenHandle(void)
|
||||
{
|
||||
InputAtom InputEvent;
|
||||
static BOOLEAN fFirstTime = TRUE;
|
||||
static UINT16 usOldState;
|
||||
static BOOLEAN fToggle = FALSE;
|
||||
static BOOLEAN fToggle2 = FALSE;
|
||||
|
||||
// EV_S_SETPOSITION SSetPosition;
|
||||
|
||||
// Make backups
|
||||
if ( fFirstTime )
|
||||
{
|
||||
gfAniEditMode = TRUE;
|
||||
|
||||
usStartAnim = 0;
|
||||
ubStartHeight = ANIM_STAND;
|
||||
|
||||
fFirstTime = FALSE;
|
||||
fToggle = FALSE;
|
||||
fToggle2 = FALSE;
|
||||
ubCurLoadedState = 0;
|
||||
|
||||
pSoldier = MercPtrs[ gusSelectedSoldier ];
|
||||
|
||||
gTacticalStatus.uiFlags |= LOADING_SAVED_GAME;
|
||||
|
||||
pSoldier->EVENT_InitNewSoldierAnim( usStartAnim, 0 , TRUE );
|
||||
|
||||
BuildListFile( );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
StartFrameBufferRender( );
|
||||
|
||||
RenderWorld( );
|
||||
|
||||
ExecuteBaseDirtyRectQueue( );
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
EndFrameBufferRender( );
|
||||
|
||||
|
||||
SetFont( LARGEFONT1 );
|
||||
mprintf( 0,0,L"SOLDIER ANIMATION VIEWER" );
|
||||
gprintfdirty( (INT16)0,(INT16)0,L"SOLDIER ANIMATION VIEWER" );
|
||||
|
||||
|
||||
mprintf( 0,20,L"Current Animation: %S %S", gAnimControl[ usStartAnim ].zAnimStr, gAnimSurfaceDatabase[ pSoldier->usAnimSurface ].Filename );
|
||||
gprintfdirty( (INT16)0,(INT16)20,L"Current Animation: %S %S", gAnimControl[ usStartAnim ].zAnimStr, gAnimSurfaceDatabase[ pSoldier->usAnimSurface ].Filename );
|
||||
|
||||
|
||||
switch( ubStartHeight )
|
||||
{
|
||||
case ANIM_STAND:
|
||||
|
||||
mprintf( 0,40,L"Current Stance: STAND" );
|
||||
break;
|
||||
|
||||
case ANIM_CROUCH:
|
||||
|
||||
mprintf( 0,40,L"Current Stance: CROUCH" );
|
||||
break;
|
||||
|
||||
case ANIM_PRONE:
|
||||
|
||||
mprintf( 0,40,L"Current Stance: PRONE" );
|
||||
break;
|
||||
}
|
||||
gprintfdirty( (INT16)0,(INT16)40,L"Current Animation: %S", gAnimControl[ usStartAnim ].zAnimStr );
|
||||
|
||||
|
||||
if ( fToggle )
|
||||
{
|
||||
mprintf( 0,60,L"FORCE ON" );
|
||||
gprintfdirty( (INT16)0,(INT16)60,L"FORCE OFF" );
|
||||
}
|
||||
|
||||
if ( fToggle2 )
|
||||
{
|
||||
mprintf( 0,70,L"LOADED ORDER ON" );
|
||||
gprintfdirty( (INT16)0,(INT16)70,L"LOADED ORDER ON" );
|
||||
|
||||
mprintf( 0,90,L"LOADED ORDER : %S", gAnimControl[ pusStates[ ubCurLoadedState ] ].zAnimStr );
|
||||
gprintfdirty( (INT16)0,(INT16)90,L"LOADED ORDER : %S", gAnimControl[ pusStates[ ubCurLoadedState ] ].zAnimStr );
|
||||
|
||||
}
|
||||
|
||||
if (DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT))
|
||||
{
|
||||
if ((InputEvent.usEvent == KEY_DOWN)&&(InputEvent.usParam == ESC))
|
||||
{
|
||||
fFirstTime = TRUE;
|
||||
|
||||
gfAniEditMode = FALSE;
|
||||
|
||||
fFirstTimeInGameScreen = TRUE;
|
||||
|
||||
gTacticalStatus.uiFlags &= (~LOADING_SAVED_GAME);
|
||||
|
||||
if ( fOKFiles )
|
||||
{
|
||||
MemFree( pusStates );
|
||||
}
|
||||
|
||||
fOKFiles = FALSE;
|
||||
|
||||
return( GAME_SCREEN );
|
||||
}
|
||||
|
||||
if ((InputEvent.usEvent == KEY_UP) && (InputEvent.usParam == SPACE ))
|
||||
{
|
||||
if ( !fToggle && !fToggle2 )
|
||||
{
|
||||
CycleAnimations( );
|
||||
}
|
||||
}
|
||||
|
||||
if ((InputEvent.usEvent == KEY_UP) && (InputEvent.usParam == 's' ))
|
||||
{
|
||||
if ( !fToggle )
|
||||
{
|
||||
UINT16 usAnim=0;
|
||||
usOldState = usStartAnim;
|
||||
|
||||
switch( ubStartHeight )
|
||||
{
|
||||
case ANIM_STAND:
|
||||
|
||||
usAnim = STANDING;
|
||||
break;
|
||||
|
||||
case ANIM_CROUCH:
|
||||
|
||||
usAnim = CROUCHING;
|
||||
break;
|
||||
|
||||
case ANIM_PRONE:
|
||||
|
||||
usAnim = PRONE;
|
||||
break;
|
||||
}
|
||||
|
||||
pSoldier->EVENT_InitNewSoldierAnim( usAnim, 0 , TRUE );
|
||||
}
|
||||
else
|
||||
{
|
||||
pSoldier->EVENT_InitNewSoldierAnim( usOldState, 0 , TRUE );
|
||||
}
|
||||
|
||||
fToggle = !fToggle;
|
||||
}
|
||||
|
||||
if ((InputEvent.usEvent == KEY_UP) && (InputEvent.usParam == 'l' ))
|
||||
{
|
||||
if ( !fToggle2 )
|
||||
{
|
||||
usOldState = usStartAnim;
|
||||
|
||||
pSoldier->EVENT_InitNewSoldierAnim( pusStates[ ubCurLoadedState ], 0 , TRUE );
|
||||
}
|
||||
else
|
||||
{
|
||||
pSoldier->EVENT_InitNewSoldierAnim( usOldState, 0 , TRUE );
|
||||
}
|
||||
|
||||
fToggle2 = !fToggle2;
|
||||
}
|
||||
|
||||
|
||||
if ((InputEvent.usEvent == KEY_UP) && (InputEvent.usParam == PGUP ))
|
||||
{
|
||||
if ( fOKFiles && fToggle2 )
|
||||
{
|
||||
ubCurLoadedState++;
|
||||
|
||||
if ( ubCurLoadedState == ubNumStates )
|
||||
{
|
||||
ubCurLoadedState = 0;
|
||||
}
|
||||
|
||||
pSoldier->EVENT_InitNewSoldierAnim( pusStates[ ubCurLoadedState ], 0 , TRUE );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((InputEvent.usEvent == KEY_UP) && (InputEvent.usParam == PGDN ))
|
||||
{
|
||||
if ( fOKFiles && fToggle2 )
|
||||
{
|
||||
ubCurLoadedState--;
|
||||
|
||||
if ( ubCurLoadedState == 0 )
|
||||
{
|
||||
ubCurLoadedState = ubNumStates;
|
||||
}
|
||||
|
||||
pSoldier->EVENT_InitNewSoldierAnim( pusStates[ ubCurLoadedState ], 0 , TRUE );
|
||||
}
|
||||
}
|
||||
|
||||
if ((InputEvent.usEvent == KEY_UP) && (InputEvent.usParam == 'c' ))
|
||||
{
|
||||
// CLEAR!
|
||||
usStartAnim = 0;
|
||||
pSoldier->EVENT_InitNewSoldierAnim( usStartAnim, 0 , TRUE );
|
||||
}
|
||||
|
||||
if ((InputEvent.usEvent == KEY_UP) && (InputEvent.usParam == ENTER ))
|
||||
{
|
||||
if ( ubStartHeight == ANIM_STAND )
|
||||
{
|
||||
ubStartHeight = ANIM_CROUCH;
|
||||
}
|
||||
else if ( ubStartHeight == ANIM_CROUCH )
|
||||
{
|
||||
ubStartHeight = ANIM_PRONE;
|
||||
}
|
||||
else
|
||||
{
|
||||
ubStartHeight = ANIM_STAND;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
return( ANIEDIT_SCREEN );
|
||||
|
||||
}
|
||||
|
||||
|
||||
UINT16 GetAnimStateFromName( STR8 zName )
|
||||
{
|
||||
INT32 cnt;
|
||||
|
||||
// FInd the next animation with start height the same...
|
||||
for ( cnt = 0; cnt < NUMANIMATIONSTATES; cnt++ )
|
||||
{
|
||||
if ( _stricmp( gAnimControl[ cnt ].zAnimStr, zName ) == 0 )
|
||||
{
|
||||
return( (UINT16) cnt );
|
||||
}
|
||||
}
|
||||
|
||||
return( 5555 );
|
||||
}
|
||||
|
||||
|
||||
void BuildListFile( )
|
||||
{
|
||||
FILE *infoFile;
|
||||
CHAR8 currFilename[128];
|
||||
int numEntries = 0;
|
||||
int cnt;
|
||||
UINT16 usState;
|
||||
CHAR16 zError[128];
|
||||
|
||||
|
||||
//Verify the existance of the header text file.
|
||||
infoFile = fopen( "ANITEST.DAT", "rb");
|
||||
if(!infoFile)
|
||||
{
|
||||
return;
|
||||
}
|
||||
//count STIs inside header and verify each one's existance.
|
||||
while( !feof( infoFile ) )
|
||||
{
|
||||
fgets( currFilename, 128, infoFile );
|
||||
//valid entry in header, continue on...
|
||||
|
||||
numEntries++;
|
||||
}
|
||||
fseek( infoFile, 0, SEEK_SET ); //reset header file
|
||||
|
||||
// Allocate array
|
||||
pusStates = (UINT16 *) MemAlloc( sizeof( UINT16 ) * numEntries );
|
||||
|
||||
fOKFiles = TRUE;
|
||||
|
||||
cnt = 0;
|
||||
while( !feof( infoFile ) && cnt < numEntries )
|
||||
{
|
||||
fgets( currFilename, 128, infoFile );
|
||||
|
||||
// Remove newline
|
||||
currFilename[ strlen( currFilename ) -1 ] = '\0';
|
||||
currFilename[ strlen( currFilename ) -1 ] = '\0';
|
||||
|
||||
usState = GetAnimStateFromName( currFilename );
|
||||
|
||||
if ( usState != 5555 )
|
||||
{
|
||||
// Bob: swapped places, there's numEntries things to be put in pusStates, I'm guessing supposed to start at 0
|
||||
pusStates[cnt] = usState;
|
||||
cnt++;
|
||||
ubNumStates = (UINT8)cnt;
|
||||
// pusStates[ cnt ] = usState;
|
||||
}
|
||||
else
|
||||
{
|
||||
swprintf( zError, L"Animation str %S is not known: ", currFilename );
|
||||
DoMessageBox( MSG_BOX_BASIC_STYLE, zError, ANIEDIT_SCREEN, ( UINT8 )MSG_BOX_FLAG_YESNO, NULL, NULL );
|
||||
fclose( infoFile );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
#ifndef _BUILDDEFINES_H
|
||||
#define _BUILDDEFINES_H
|
||||
|
||||
#include "Language Defines.h"
|
||||
|
||||
//----- Briefing Room (Mission based JA2 like in JA/DG) - by Jazz -----
|
||||
// Once enabled here and also enabled in the ja2_options.ini (BRIEFING_ROOM),
|
||||
// you can access the briefing room feature from the laptop
|
||||
// Of course, you also need a briefing room 1.13-MOD, otherwise you have a blank briefing room.
|
||||
// There are 2 examples (Briefing Room Example 1.zip, Briefing Room Example 2.zip) in the documents svn folder:
|
||||
// https://ja2svn.dyndns.org/source/ja2/trunk/Documents/1.13%20Modding/Modding%20Examples
|
||||
#define ENABLE_BRIEFINGROOM
|
||||
|
||||
// -----------------------------
|
||||
// *****************************
|
||||
// WANNE: Enable those 2 defines, if you want to build UB-Version!!
|
||||
|
||||
//JA2/Unfinished Business
|
||||
//#define JA2UB
|
||||
|
||||
//Unfinished Business - Titles (ja2set.dat)
|
||||
//#define JA2UBMAPS
|
||||
// *****************************
|
||||
// -----------------------------
|
||||
|
||||
// -----------------------------
|
||||
// *****************************
|
||||
// WANNE: With this defin we can build JA2 DEMO version that runs with 1.13
|
||||
// The 2 UB defines (JA2UB and JA2UBMAPS) should be disabled, because we only want to build the demo version from the JA2 code!
|
||||
|
||||
//#define JA113DEMO
|
||||
// *****************************
|
||||
// -----------------------------
|
||||
|
||||
// Map Editor version - you should use the MapEditor configuration instead of messing with these defines (ChrisL)
|
||||
//#define JA2BETAVERSION
|
||||
//#define JA2EDITOR
|
||||
// Normal test version
|
||||
//#define JA2TESTVERSION
|
||||
|
||||
//#define SGP_DEBUG
|
||||
//#define DEBUG_ATTACKBUSY
|
||||
//#define DEBUGDECISIONS
|
||||
#define ROBOT_ALWAYS_READY
|
||||
#define FORCE_ASSERTS_ON
|
||||
|
||||
//#ifdef _DEBUG
|
||||
// #ifndef JA2TESTVERSION
|
||||
// #define JA2TESTVERSION
|
||||
// #endif
|
||||
//#endif
|
||||
|
||||
// Do combinations
|
||||
//#ifdef JA2TESTVERSION
|
||||
// #define JA2BETAVERSION
|
||||
// #define JA2EDITOR
|
||||
//#endif
|
||||
|
||||
|
||||
|
||||
#ifdef JA2BETAVERSION
|
||||
#ifndef JA2EDITOR
|
||||
// #define SGP_DEBUG
|
||||
// #define FORCE_ASSERTS_ON
|
||||
// #define SGP_VIDEO_DEBUGGING
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//#define CRIPPLED_VERSION
|
||||
|
||||
// Huge speed and memory hog, but thorough -- will work with release builds.
|
||||
// #define EXTREME_MEMORY_DEBUGGING
|
||||
|
||||
// 0verhaul
|
||||
// These squelch warnings in VC2K5 about printf's and string operations being unsafe. Maybe we should work on building a better
|
||||
// system that gives buffer sizes for copies (which would prevent future problems like a stack corruption issue I fixed a while back),
|
||||
// but for now, just tell the compiler to shut up so I can see the real errors.
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#define _CRT_NON_CONFORMING_SWPRINTFS
|
||||
#define _SCL_SECURE_NO_WARNINGS
|
||||
|
||||
#include "Profiler.h"
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,670 @@
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include "sgp.h"
|
||||
#include "Gameloop.h"
|
||||
#include "Screens.h"
|
||||
#include "cursors.h"
|
||||
#include "init.h"
|
||||
#include "music control.h"
|
||||
#include "sys globals.h"
|
||||
#include "laptop.h"
|
||||
#include "mapscreen.h"
|
||||
#include "Game Clock.h"
|
||||
#include "Timer Control.h"
|
||||
#include "overhead.h"
|
||||
#include "LibraryDataBase.h"
|
||||
#include "Map Screen Interface.h"
|
||||
#include "Tactical Save.h"
|
||||
#include "Interface.h"
|
||||
#include "GameSettings.h"
|
||||
#include "mapscreen.h"
|
||||
#include "Interface Control.h"
|
||||
#include "text.h"
|
||||
#include "HelpScreen.h"
|
||||
#include "PreBattle Interface.h"
|
||||
#include "Tactical Placement GUI.h"//dnl ch45 071009
|
||||
#include "Map Screen Interface Map Inventory.h"//dnl ch51 081009
|
||||
#include "World Items.h"//dnl ch77 191113
|
||||
#include "Overhead.h" // added by Flugente
|
||||
#include "Ambient Control.h" // sevenfm
|
||||
|
||||
#include "SaveLoadScreen.h"
|
||||
|
||||
#include "Lua Interpreter.h"
|
||||
//**ddd direct link libraries
|
||||
#pragma comment (lib, "user32.lib")
|
||||
#pragma comment (lib, "gdi32.lib")
|
||||
#pragma comment (lib, "advapi32.lib")
|
||||
#pragma comment (lib, "shell32.lib")
|
||||
|
||||
#ifdef JA2UB
|
||||
#include "ub_config.h"
|
||||
#endif
|
||||
|
||||
// rain
|
||||
#include "Rain.h"
|
||||
// end rain
|
||||
|
||||
// arynn : render mouse regions
|
||||
#include "line.h"
|
||||
|
||||
//network headers
|
||||
#include "connect.h"
|
||||
|
||||
UINT32 guiCurrentScreen;
|
||||
UINT32 guiPendingScreen = NO_PENDING_SCREEN;
|
||||
UINT32 guiPreviousScreen = NO_PENDING_SCREEN;
|
||||
|
||||
INT32 giStartingMemValue = 0;
|
||||
|
||||
#define DONT_CHECK_FOR_FREE_SPACE 255
|
||||
UINT8 gubCheckForFreeSpaceOnHardDriveCount=DONT_CHECK_FOR_FREE_SPACE;
|
||||
|
||||
extern BOOLEAN DoSkiMessageBox( UINT8 ubStyle, STR16 zString, UINT32 uiExitScreen, UINT8 ubFlags, MSGBOX_CALLBACK ReturnCallback );
|
||||
|
||||
extern void NotEnoughHardDriveSpaceForQuickSaveMessageBoxCallBack( UINT8 bExitValue );
|
||||
extern BOOLEAN gfTacticalPlacementGUIActive;
|
||||
extern BOOLEAN gfTacticalPlacementGUIDirty;
|
||||
extern BOOLEAN gfValidLocationsChanged;
|
||||
extern BOOLEAN gfInMsgBox;
|
||||
extern BOOLEAN gfInChatBox; // OJW - 20090314 - new chatbox
|
||||
extern void InitSightRange(); //lal
|
||||
|
||||
|
||||
// callback to confirm game is over
|
||||
void EndGameMessageBoxCallBack( UINT8 bExitValue );
|
||||
void HandleNewScreenChange( UINT32 uiNewScreen, UINT32 uiOldScreen );
|
||||
|
||||
// The InitializeGame function is responsible for setting up all data and Gaming Engine
|
||||
// tasks which will run the game
|
||||
|
||||
#ifdef JA2BETAVERSION
|
||||
BOOLEAN gubReportMapscreenLock = 0;
|
||||
void ReportMapscreenErrorLock()
|
||||
{
|
||||
switch( gubReportMapscreenLock )
|
||||
{
|
||||
case 1:
|
||||
DoScreenIndependantMessageBox( L"You have just loaded the game which is in a state that you shouldn't be able to. You can still play, but there should be a sector with enemies co-existing with mercs. Please don't report that.", MSG_BOX_FLAG_OK, NULL );
|
||||
fDisableDueToBattleRoster = FALSE;
|
||||
fDisableMapInterfaceDueToBattle = FALSE;
|
||||
gubReportMapscreenLock = 0;
|
||||
break;
|
||||
case 2:
|
||||
DoScreenIndependantMessageBox( L"You have just saved the game which is in a state that you shouldn't be able to. Please report circumstances (ex: merc in other sector pipes up about enemies), etc. Autocorrected, but if you reload the save, don't report the error appearing in load.", MSG_BOX_FLAG_OK, NULL );
|
||||
fDisableDueToBattleRoster = FALSE;
|
||||
fDisableMapInterfaceDueToBattle = FALSE;
|
||||
gubReportMapscreenLock = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
BOOLEAN InitializeGame(void)
|
||||
{
|
||||
UINT32 uiIndex;
|
||||
|
||||
giStartingMemValue = MemGetFree( );
|
||||
|
||||
//InitializeLua();
|
||||
is_networked = FALSE;
|
||||
is_client = FALSE;
|
||||
is_server = FALSE;
|
||||
|
||||
// Set up the debugging topics
|
||||
//
|
||||
// Turn off all the flags
|
||||
ClearAllDebugTopics();
|
||||
//
|
||||
// Now turn on the ones we are interested in watching
|
||||
RegisterJA2DebugTopic( TOPIC_JA2OPPLIST, "Reg" );
|
||||
RegisterJA2DebugTopic( TOPIC_JA2INTERRUPT, "Reg" );
|
||||
|
||||
// Snap: Read options from an INI file in the default of custom Data directory
|
||||
// Moved this up because some settings are used during other inits
|
||||
LoadGameAPBPConstants();
|
||||
LoadGameExternalOptions();
|
||||
// Load new ini - SANDRO
|
||||
LoadSkillTraitsExternalSettings();
|
||||
|
||||
// HEADROCK HAM 4: Read CTH values
|
||||
LoadCTHConstants();
|
||||
//DBrot: load mod settings
|
||||
LoadModSettings();
|
||||
// silversurfer: load item settings modifiers
|
||||
LoadItemSettings();
|
||||
// Load externalised taunts settings
|
||||
LoadTauntsSettings();
|
||||
// Load helicopter repair settings
|
||||
LoadHelicopterRepairRefuelSettings();
|
||||
// Load externalised morale settings
|
||||
LoadMoraleSettings();
|
||||
// Load externalised reputation settings
|
||||
LoadReputationSettings();
|
||||
// Load creatures settings
|
||||
LoadCreaturesSettings();
|
||||
// Load rebel command settings
|
||||
LoadRebelCommandSettings();
|
||||
|
||||
#ifdef JA2UB
|
||||
LoadGameUBOptions(); // JA25 UB
|
||||
#endif
|
||||
|
||||
InitSightRange(); //lal
|
||||
|
||||
// Initlaize mouse subsystems
|
||||
MSYS_Init( );
|
||||
InitButtonSystem();
|
||||
InitCursors( );
|
||||
|
||||
SetFastForwardPeriod(gGameExternalOptions.iFastForwardPeriod);
|
||||
SetFastForwardKey(gGameExternalOptions.iFastForwardKey);
|
||||
SetNotifyFrequencyKey(gGameExternalOptions.iNotifyFrequency);
|
||||
SetClockSpeedPercent(gGameExternalOptions.fClockSpeedPercent);
|
||||
|
||||
// Init Fonts
|
||||
if ( !InitializeFonts( ) )
|
||||
{
|
||||
// Send debug message and quit
|
||||
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "COULD NOT INUT FONT SYSTEM...");
|
||||
return( ERROR_SCREEN );
|
||||
}
|
||||
|
||||
//Deletes all the Temp files in the Maps\Temp directory
|
||||
InitTacticalSave( TRUE );
|
||||
|
||||
// Initialize Game Screens.
|
||||
for (uiIndex = 0; uiIndex < MAX_SCREENS; uiIndex++)
|
||||
{
|
||||
if ((*(GameScreens[uiIndex].InitializeScreen))() == FALSE)
|
||||
{ // Failed to initialize one of the screens.
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
//Init the help screen system
|
||||
InitHelpScreenSystem();
|
||||
|
||||
//LoadSavegame Slot
|
||||
LoadSaveGameOldOrNew();
|
||||
|
||||
//Loads the saved (if any) general JA2 game settings
|
||||
LoadGameSettings();
|
||||
LoadFeatureFlags();
|
||||
|
||||
guiCurrentScreen = INIT_SCREEN;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// The ShutdownGame function will free up/undo all things that were started in InitializeGame()
|
||||
// It will also be responsible to making sure that all Gaming Engine tasks exit properly
|
||||
|
||||
void ShutdownGame(void)
|
||||
{
|
||||
// handle shutdown of game with respect to preloaded mapscreen graphics
|
||||
HandleRemovalOfPreLoadedMapGraphics( );
|
||||
|
||||
ShutdownJA2( );
|
||||
|
||||
//Save the general save game settings to disk
|
||||
SaveGameSettings();
|
||||
SaveFeatureFlags();
|
||||
|
||||
//shutdown the file database manager
|
||||
ShutDownFileDatabase( );
|
||||
|
||||
if(gGameExternalOptions.fEnableInventoryPoolQ)//dnl ch51 081009
|
||||
MemFreeInventoryPoolQ();
|
||||
|
||||
//Deletes all the Temp files in the Maps\Temp directory
|
||||
InitTacticalSave( FALSE );
|
||||
|
||||
//ShutdownLua( );
|
||||
|
||||
FreeGameExternalOptions();
|
||||
}
|
||||
|
||||
|
||||
// This is the main Gameloop. This should eventually be one big switch statement which represents
|
||||
// the state of the game (i.e. Main Menu, PC Generation, Combat loop, etc....)
|
||||
// This function exits constantly and reenters constantly
|
||||
|
||||
// rain
|
||||
static BOOLEAN gfSkipFrame = FALSE;
|
||||
|
||||
extern void RefreshBoxes( );
|
||||
|
||||
void GameLoop(void)
|
||||
{
|
||||
// DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"GameLoop");
|
||||
|
||||
InputAtom InputEvent;
|
||||
POINT MousePos;
|
||||
UINT32 uiOldScreen=guiCurrentScreen;
|
||||
clock_t startTime = clock(); // decrease CPU load patch from defrog
|
||||
|
||||
if(_LeftButtonDown | _RightButtonDown)//dnl ch77 191113 to prevent memory corruption during resize
|
||||
ResizeWorldItems();
|
||||
|
||||
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"GameLoop: get mouse position");
|
||||
GetCursorPos(&MousePos);
|
||||
ScreenToClient(ghWindow, &MousePos); // In window coords!
|
||||
|
||||
// Hook into mouse stuff for MOVEMENT MESSAGES
|
||||
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"GameLoop: get mouse hook");
|
||||
MouseSystemHook(MOUSE_POS, (UINT16)MousePos.x ,(UINT16)MousePos.y ,_LeftButtonDown, _RightButtonDown);
|
||||
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"GameLoop: get music");
|
||||
MusicPoll( FALSE );
|
||||
|
||||
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"GameLoop: check for mouse events");
|
||||
//*** dddd
|
||||
//while (DequeueSpecificEvent(&InputEvent, LEFT_BUTTON_REPEAT|RIGHT_BUTTON_REPEAT|LEFT_BUTTON_DOWN|LEFT_BUTTON_UP|RIGHT_BUTTON_DOWN|RIGHT_BUTTON_UP ) == TRUE )
|
||||
while (DequeueSpecificEvent(&InputEvent,
|
||||
LEFT_BUTTON_REPEAT|RIGHT_BUTTON_REPEAT|
|
||||
LEFT_BUTTON_DOWN|LEFT_BUTTON_UP|MIDDLE_BUTTON_UP|X1_BUTTON_UP|X2_BUTTON_UP|
|
||||
RIGHT_BUTTON_DOWN|RIGHT_BUTTON_UP|MIDDLE_BUTTON_DOWN|X1_BUTTON_DOWN|X2_BUTTON_DOWN|
|
||||
MOUSE_WHEEL_UP|MOUSE_WHEEL_DOWN) == TRUE )
|
||||
{
|
||||
// HOOK INTO MOUSE HOOKS
|
||||
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("GameLoop: mouse event %d", InputEvent.usEvent ));
|
||||
MouseSystemHook(InputEvent.usEvent, (UINT16)MousePos.x ,(UINT16)MousePos.y ,_LeftButtonDown, _RightButtonDown);
|
||||
|
||||
|
||||
/* switch(InputEvent.usEvent)
|
||||
{
|
||||
case LEFT_BUTTON_DOWN:
|
||||
MouseSystemHook(LEFT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown);
|
||||
break;
|
||||
case LEFT_BUTTON_UP:
|
||||
MouseSystemHook(LEFT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y ,_LeftButtonDown, _RightButtonDown);
|
||||
break;
|
||||
case RIGHT_BUTTON_DOWN:
|
||||
MouseSystemHook(RIGHT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown);
|
||||
break;
|
||||
case RIGHT_BUTTON_UP:
|
||||
MouseSystemHook(RIGHT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown);
|
||||
break;
|
||||
case LEFT_BUTTON_REPEAT:
|
||||
MouseSystemHook(LEFT_BUTTON_REPEAT, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown);
|
||||
break;
|
||||
case RIGHT_BUTTON_REPEAT:
|
||||
MouseSystemHook(RIGHT_BUTTON_REPEAT, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown);
|
||||
break;
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"GameLoop: check for errors");
|
||||
if ( gfGlobalError )
|
||||
{
|
||||
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"GameLoop: global error");
|
||||
|
||||
guiCurrentScreen = ERROR_SCREEN;
|
||||
}
|
||||
|
||||
/*
|
||||
// Madd: removed check because it kept coming up for me, even on new games, even though I have 12GB free!! I think the "DoesUserHaveEnoughHardDriveSpace" function is busted.
|
||||
//if we are to check for free space on the hard drive
|
||||
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"GameLoop: check hard drive");
|
||||
if( gubCheckForFreeSpaceOnHardDriveCount < DONT_CHECK_FOR_FREE_SPACE )
|
||||
{
|
||||
//only if we are in a screen that can get this check
|
||||
if( guiCurrentScreen == MAP_SCREEN || guiCurrentScreen == GAME_SCREEN || guiCurrentScreen == SAVE_LOAD_SCREEN )
|
||||
{
|
||||
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"GameLoop: check for free hard drive space");
|
||||
if( gubCheckForFreeSpaceOnHardDriveCount < 1 )
|
||||
{
|
||||
gubCheckForFreeSpaceOnHardDriveCount++;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Make sure the user has enough hard drive space
|
||||
if( !DoesUserHaveEnoughHardDriveSpace() )
|
||||
{
|
||||
CHAR16 zText[512];
|
||||
CHAR16 zSpaceOnDrive[512];
|
||||
UINT32 uiSpaceOnDrive;
|
||||
CHAR16 zSizeNeeded[512];
|
||||
|
||||
swprintf( zSizeNeeded, L"%d", REQUIRED_FREE_SPACE / BYTESINMEGABYTE );
|
||||
InsertCommasForDollarFigure( zSizeNeeded );
|
||||
|
||||
uiSpaceOnDrive = GetFreeSpaceOnHardDriveWhereGameIsRunningFrom( );
|
||||
|
||||
swprintf( zSpaceOnDrive, L"%.2f", uiSpaceOnDrive / (FLOAT)BYTESINMEGABYTE );
|
||||
|
||||
swprintf( zText, pMessageStrings[ MSG_LOWDISKSPACE_WARNING ], zSpaceOnDrive, zSizeNeeded );
|
||||
|
||||
if( guiPreviousOptionScreen == MAP_SCREEN )
|
||||
DoMapMessageBox( MSG_BOX_BASIC_STYLE, zText, MAP_SCREEN, MSG_BOX_FLAG_OK, NULL );
|
||||
else
|
||||
DoMessageBox( MSG_BOX_BASIC_STYLE, zText, GAME_SCREEN, MSG_BOX_FLAG_OK, NULL, NULL );
|
||||
}
|
||||
gubCheckForFreeSpaceOnHardDriveCount = DONT_CHECK_FOR_FREE_SPACE;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
// ATE: Force to be in message box screen!
|
||||
if ( gfInMsgBox )
|
||||
{
|
||||
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"GameLoop: message box");
|
||||
guiPendingScreen = MSG_BOX_SCREEN;
|
||||
}
|
||||
|
||||
// OJW - 20090314 - new chatbox
|
||||
if (gfInChatBox)
|
||||
{
|
||||
guiPendingScreen = MP_CHAT_SCREEN;
|
||||
}
|
||||
if ( guiPendingScreen != NO_PENDING_SCREEN )
|
||||
{
|
||||
// Based on active screen, deinit!
|
||||
if( guiPendingScreen != guiCurrentScreen )
|
||||
{
|
||||
switch( guiCurrentScreen )
|
||||
{
|
||||
case MAP_SCREEN:
|
||||
if( guiPendingScreen != MSG_BOX_SCREEN && guiPendingScreen != MP_CHAT_SCREEN )
|
||||
{
|
||||
EndMapScreen( FALSE );
|
||||
}
|
||||
break;
|
||||
case LAPTOP_SCREEN:
|
||||
ExitLaptop();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// if the screen has chnaged
|
||||
if( uiOldScreen != guiPendingScreen )
|
||||
{
|
||||
// Set the fact that the screen has changed
|
||||
uiOldScreen = guiPendingScreen;
|
||||
|
||||
HandleNewScreenChange( guiPendingScreen, guiCurrentScreen );
|
||||
}
|
||||
guiCurrentScreen = guiPendingScreen;
|
||||
guiPendingScreen = NO_PENDING_SCREEN;
|
||||
|
||||
}
|
||||
|
||||
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"GameLoop: screen changed");
|
||||
AssertNotNIL (GameScreens[guiCurrentScreen].HandleScreen);
|
||||
uiOldScreen = (*(GameScreens[guiCurrentScreen].HandleScreen))();
|
||||
|
||||
// if the screen has changed
|
||||
if( uiOldScreen != guiCurrentScreen )
|
||||
{
|
||||
HandleNewScreenChange( uiOldScreen, guiCurrentScreen );
|
||||
guiPreviousScreen = guiCurrentScreen;
|
||||
guiCurrentScreen = uiOldScreen;
|
||||
}
|
||||
|
||||
// rain
|
||||
RenderRain();
|
||||
|
||||
// sevenfm: update tactical ambients
|
||||
if (guiCurrentScreen == GAME_SCREEN)
|
||||
{
|
||||
UpdateFireAmbient();
|
||||
}
|
||||
|
||||
// Flugente: dynamic opinions: Dialogue Boxes need to be refreshed
|
||||
if (gGameExternalOptions.fDynamicOpinions)
|
||||
{
|
||||
RefreshBoxes();
|
||||
}
|
||||
|
||||
// Flugente:disguised mercs can distract enemies by talking to them. In order to display that, we sometimes display excerpts of their 'chats'
|
||||
CheckChatPartners();
|
||||
|
||||
//DEBUG MODE : DEBUG RENDER ENTRY : point to drop in debugging render code
|
||||
if( (gGameSettings.fOptions[TOPTION_RETAIN_DEBUG_OPTIONS_IN_RELEASE]) || (JA2BETAVERSION_FLAG))
|
||||
{
|
||||
// arynn : render mouse regions
|
||||
if(gGameSettings.fOptions[TOPTION_RENDER_MOUSE_REGIONS])
|
||||
{
|
||||
MOUSE_REGION *curr;
|
||||
UINT32 uiDestPitchBYTES;
|
||||
UINT8 *pDestBuf;
|
||||
|
||||
curr = get_first_entry_in_MSYS_RegList();
|
||||
|
||||
while((curr != NULL) )
|
||||
{
|
||||
pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES );
|
||||
SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT );
|
||||
LineDraw( TRUE, curr->RegionTopLeftX, curr->RegionTopLeftY,
|
||||
curr->RegionBottomRightX, curr->RegionBottomRightY,
|
||||
Get16BPPColor( FROMRGB( 200, 200, 200 )), pDestBuf);
|
||||
RectangleDraw( TRUE, curr->RegionTopLeftX, curr->RegionTopLeftY,
|
||||
curr->RegionBottomRightX, curr->RegionBottomRightY,
|
||||
Get16BPPColor( FROMRGB( 200, 200, 200 )), pDestBuf);
|
||||
curr = get_next_entry_in_MSYS_RegList(curr);
|
||||
UnLockVideoSurface( FRAME_BUFFER );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//when coming from a recent debug.exe to a rel.exe, and option to carry over debug functions is off, disable debug mode options
|
||||
gGameSettings.fOptions[TOPTION_RENDER_MOUSE_REGIONS] = FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if( gfSkipFrame )
|
||||
gfSkipFrame = FALSE;
|
||||
else
|
||||
// end rain
|
||||
|
||||
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"GameLoop: refresh screen");
|
||||
RefreshScreen( NULL );
|
||||
|
||||
guiGameCycleCounter++;
|
||||
|
||||
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"GameLoop: update clock");
|
||||
UpdateClock();
|
||||
|
||||
#ifdef JA2BETAVERSION
|
||||
if( gubReportMapscreenLock )
|
||||
{
|
||||
ReportMapscreenErrorLock();
|
||||
}
|
||||
#endif
|
||||
|
||||
// WANNE: Removed Low CPU option
|
||||
/*
|
||||
if( gGameSettings.fOptions[ TOPTION_LOW_CPU_USAGE ] == TRUE )
|
||||
{
|
||||
// decrease CPU load patch from MTX (http://www.ja-galaxy-forum.com/board/ubbthreads.php/ubb/showflat/Number/102405/page/1#Post102405)
|
||||
//OK! 12% CPU:
|
||||
//Sleep(10);
|
||||
|
||||
// decrease CPU load patch from defrog
|
||||
clock_t endTime = clock();
|
||||
|
||||
//long sleeptime = 33 - (endTime-startTime)/(CLK_TCK/1000);
|
||||
long sleeptime = 33 - (endTime-startTime);
|
||||
|
||||
if( sleeptime > 0 )
|
||||
Sleep(sleeptime);
|
||||
}
|
||||
*/
|
||||
|
||||
if ( is_networked )
|
||||
{
|
||||
client_packet();
|
||||
server_packet();
|
||||
}
|
||||
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"GameLoop done");
|
||||
}
|
||||
|
||||
void SetCurrentScreen( UINT32 uiNewScreen )
|
||||
{
|
||||
guiCurrentScreen = uiNewScreen;
|
||||
(*(GameScreens[guiCurrentScreen].HandleScreen))();
|
||||
|
||||
}
|
||||
|
||||
void SetPendingNewScreen( UINT32 uiNewScreen )
|
||||
{
|
||||
guiPendingScreen = uiNewScreen;
|
||||
}
|
||||
|
||||
// rain
|
||||
extern UINT32 guiRainLoop;
|
||||
// end rain
|
||||
|
||||
// sevenfm
|
||||
extern UINT32 guiCurrentSteadyStateSoundHandle;
|
||||
|
||||
// Gets called when the screen changes, place any needed in code in here
|
||||
void HandleNewScreenChange( UINT32 uiNewScreen, UINT32 uiOldScreen )
|
||||
{
|
||||
//if we are not going into the message box screen, and we didnt just come from it
|
||||
if( ( uiNewScreen != MSG_BOX_SCREEN && uiOldScreen != MSG_BOX_SCREEN && uiNewScreen != MP_CHAT_SCREEN && uiOldScreen != MP_CHAT_SCREEN ) )
|
||||
{
|
||||
//reset the help screen
|
||||
NewScreenSoResetHelpScreen( );
|
||||
}
|
||||
|
||||
//rain
|
||||
if( uiNewScreen == MAP_SCREEN )
|
||||
{
|
||||
if ( guiRainLoop != NO_SAMPLE )
|
||||
{
|
||||
SoundStop( guiRainLoop );
|
||||
guiRainLoop = NO_SAMPLE;
|
||||
}
|
||||
}
|
||||
// end rain
|
||||
|
||||
// sevenfm: start/stop SSA
|
||||
if (uiNewScreen == GAME_SCREEN)
|
||||
{
|
||||
// check that no sound is playing currently
|
||||
if (guiCurrentSteadyStateSoundHandle == NO_SAMPLE)
|
||||
{
|
||||
SetSSA();
|
||||
}
|
||||
}
|
||||
else if (uiNewScreen != MSG_BOX_SCREEN)
|
||||
{
|
||||
// Stop SSA
|
||||
if (guiCurrentSteadyStateSoundHandle != NO_SAMPLE)
|
||||
{
|
||||
SoundStop(guiCurrentSteadyStateSoundHandle);
|
||||
guiCurrentSteadyStateSoundHandle = NO_SAMPLE;
|
||||
}
|
||||
// stop ambients
|
||||
StopFireAmbient();
|
||||
}
|
||||
}
|
||||
|
||||
void HandleShortCutExitState( void )
|
||||
{
|
||||
// look at the state of fGameIsRunning, if set false, then prompt user for confirmation
|
||||
|
||||
// use YES/NO Pop up box, settup for particular screen
|
||||
SGPRect pCenteringRect= {0 + xResOffset, 0, SCREEN_WIDTH - xResOffset, INV_INTERFACE_START_Y };
|
||||
|
||||
if( guiCurrentScreen == ERROR_SCREEN )
|
||||
{ //an assert failure, don't bring up the box!
|
||||
gfProgramIsRunning = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
if( guiCurrentScreen == AUTORESOLVE_SCREEN )
|
||||
{
|
||||
DoMessageBox( MSG_BOX_BASIC_STYLE, pMessageStrings[ MSG_EXITGAME ], guiCurrentScreen, ( MSG_BOX_FLAG_YESNO | MSG_BOX_FLAG_USE_CENTERING_RECT ), EndGameMessageBoxCallBack, &pCenteringRect );
|
||||
return;
|
||||
}
|
||||
|
||||
/// which screen are we in?
|
||||
if ( (guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) )
|
||||
{
|
||||
// set up for mapscreen
|
||||
DoMapMessageBox( MSG_BOX_BASIC_STYLE, pMessageStrings[ MSG_EXITGAME ], MAP_SCREEN, MSG_BOX_FLAG_YESNO, EndGameMessageBoxCallBack );
|
||||
|
||||
}
|
||||
else if( guiCurrentScreen == LAPTOP_SCREEN )
|
||||
{
|
||||
// set up for laptop
|
||||
DoLapTopSystemMessageBox( MSG_BOX_LAPTOP_DEFAULT, pMessageStrings[ MSG_EXITGAME ], LAPTOP_SCREEN, MSG_BOX_FLAG_YESNO, EndGameMessageBoxCallBack );
|
||||
}
|
||||
else if( guiCurrentScreen == SHOPKEEPER_SCREEN )
|
||||
{
|
||||
DoSkiMessageBox( MSG_BOX_BASIC_STYLE, pMessageStrings[ MSG_EXITGAME ], SHOPKEEPER_SCREEN, MSG_BOX_FLAG_YESNO, EndGameMessageBoxCallBack );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
// check if error or editor
|
||||
#ifdef JA2BETAVERSION
|
||||
if ( guiCurrentScreen == AIVIEWER_SCREEN || guiCurrentScreen == QUEST_DEBUG_SCREEN )
|
||||
{
|
||||
// then don't prompt
|
||||
gfProgramIsRunning = FALSE;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if( ( guiCurrentScreen == ERROR_SCREEN ) || ( guiCurrentScreen == EDIT_SCREEN ) || ( guiCurrentScreen == DEBUG_SCREEN ) )
|
||||
{
|
||||
// then don't prompt
|
||||
gfProgramIsRunning = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
// set up for all otherscreens
|
||||
DoMessageBox( MSG_BOX_BASIC_STYLE, pMessageStrings[ MSG_EXITGAME ], guiCurrentScreen, ( UINT8 ) ( MSG_BOX_FLAG_YESNO | MSG_BOX_FLAG_USE_CENTERING_RECT ), EndGameMessageBoxCallBack, &pCenteringRect );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void EndGameMessageBoxCallBack( UINT8 bExitValue )
|
||||
{
|
||||
// yes, so start over, else stay here and do nothing for now
|
||||
if( bExitValue == MSG_BOX_RETURN_YES )
|
||||
{
|
||||
gfProgramIsRunning = FALSE;
|
||||
}
|
||||
|
||||
//If we are in the tactical placement gui, we need this flag set so the interface is updated.
|
||||
if( gfTacticalPlacementGUIActive )
|
||||
{
|
||||
gfTacticalPlacementGUIDirty = TRUE;
|
||||
gfValidLocationsChanged = TRUE;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void NextLoopCheckForEnoughFreeHardDriveSpace()
|
||||
{
|
||||
gubCheckForFreeSpaceOnHardDriveCount = 0;
|
||||
}
|
||||
|
||||
// Called by any game loop after all known events were handled
|
||||
void HandleDefaultEvent(InputAtom *Event)
|
||||
{
|
||||
const int MouseButtonEvents = LEFT_BUTTON_REPEAT|RIGHT_BUTTON_REPEAT|
|
||||
LEFT_BUTTON_DOWN|LEFT_BUTTON_UP|MIDDLE_BUTTON_UP|X1_BUTTON_UP|X2_BUTTON_UP|
|
||||
RIGHT_BUTTON_DOWN|RIGHT_BUTTON_UP|MIDDLE_BUTTON_DOWN|X1_BUTTON_DOWN|X2_BUTTON_DOWN|
|
||||
MOUSE_WHEEL_UP|MOUSE_WHEEL_DOWN;
|
||||
|
||||
if (Event != NULL && Event->usEvent & MouseButtonEvents)
|
||||
{
|
||||
POINT MousePos;
|
||||
GetCursorPos(&MousePos);
|
||||
ScreenToClient(ghWindow, &MousePos); // In window coords!
|
||||
MouseSystemHook(Event->usEvent, (UINT16)MousePos.x ,(UINT16)MousePos.y ,_LeftButtonDown, _RightButtonDown);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
#ifndef __GAMELOOP_
|
||||
#define __GAMELOOP_
|
||||
|
||||
#include "Types.h"
|
||||
|
||||
// main game loop systems
|
||||
#define INIT_SYSTEM 0
|
||||
|
||||
#define NO_PENDING_SCREEN 0xFFFF
|
||||
|
||||
|
||||
extern BOOLEAN InitializeGame(void);
|
||||
extern void ShutdownGame(void);
|
||||
extern void GameLoop(void);
|
||||
|
||||
// handle exit from game due to shortcut key
|
||||
void HandleShortCutExitState( void );
|
||||
|
||||
void SetPendingNewScreen( UINT32 uiNewScreen );
|
||||
|
||||
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
|
||||
struct InputAtom;
|
||||
void HandleDefaultEvent(InputAtom *Event);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+1222
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,44 @@
|
||||
#ifndef _GAMESCREEN_H
|
||||
#define _GAMESCREEN_H
|
||||
|
||||
|
||||
#include "fade screen.h"
|
||||
|
||||
#define ARE_IN_FADE_IN( ) ( gfFadeIn || gfFadeInitialized )
|
||||
|
||||
|
||||
|
||||
void FadeInGameScreen( );
|
||||
void FadeOutGameScreen( );
|
||||
|
||||
typedef void (*MODAL_HOOK)( void );
|
||||
|
||||
|
||||
extern BOOLEAN gfGameScreenLocateToSoldier;
|
||||
extern BOOLEAN gfEnteringMapScreen;
|
||||
extern UINT8 gubPreferredInitialSelectedGuy;
|
||||
|
||||
|
||||
void EnterMapScreen( );
|
||||
|
||||
void UpdateTeamPanelAssignments( );
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define TACTICAL_MODAL_NOMOUSE 1
|
||||
#define TACTICAL_MODAL_WITHMOUSE 2
|
||||
|
||||
extern MODAL_HOOK gModalDoneCallback;
|
||||
|
||||
void EnterModalTactical( INT8 bMode );
|
||||
void EndModalTactical( );
|
||||
|
||||
|
||||
// handle the entrance of the mercs at the beginning of the game
|
||||
void InitHelicopterEntranceByMercs( void );
|
||||
|
||||
void InternalLeaveTacticalScreen( UINT32 uiNewScreen );
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,8 @@
|
||||
#ifndef __JA2_H
|
||||
#define __JA2_H
|
||||
|
||||
#define JA2VERSION_NUM 0.01
|
||||
#define JA2MAPVERSION_NUM 1.00
|
||||
|
||||
#endif
|
||||
|
||||
+1095
File diff suppressed because it is too large
Load Diff
+187
@@ -0,0 +1,187 @@
|
||||
#ifndef __JASCREENS_H_
|
||||
#define __JASCREENS_H_
|
||||
|
||||
#include "sgp.h"
|
||||
#include "ScreenIds.h"
|
||||
#include "mousesystem.h"
|
||||
#include "Button System.h"
|
||||
#include <list>
|
||||
#include <vfs/Core/vfs_string.h>
|
||||
#include "FeaturesScreen.h"
|
||||
|
||||
extern UINT32 EditScreenInit(void);
|
||||
extern UINT32 EditScreenHandle(void);
|
||||
extern UINT32 EditScreenShutdown(void);
|
||||
|
||||
extern UINT32 LoadSaveScreenInit(void);
|
||||
extern UINT32 LoadSaveScreenHandle(void);
|
||||
extern UINT32 LoadSaveScreenShutdown(void);
|
||||
|
||||
extern UINT32 SavingScreenInitialize(void);
|
||||
extern UINT32 SavingScreenHandle(void);
|
||||
extern UINT32 SavingScreenShutdown(void);
|
||||
|
||||
extern UINT32 LoadingScreenInitialize(void);
|
||||
extern UINT32 LoadingScreenHandle(void);
|
||||
extern UINT32 LoadingScreenShutdown(void);
|
||||
|
||||
extern UINT32 ErrorScreenInitialize(void);
|
||||
extern UINT32 ErrorScreenHandle(void);
|
||||
extern UINT32 ErrorScreenShutdown(void);
|
||||
|
||||
extern UINT32 InitScreenInitialize(void);
|
||||
extern UINT32 InitScreenHandle(void);
|
||||
extern UINT32 InitScreenShutdown(void);
|
||||
|
||||
extern UINT32 MainGameScreenInit(void);
|
||||
extern UINT32 MainGameScreenHandle(void);
|
||||
extern UINT32 MainGameScreenShutdown(void);
|
||||
|
||||
#ifdef JA2BETAVERSION
|
||||
extern UINT32 AIViewerScreenInit(void);
|
||||
extern UINT32 AIViewerScreenHandle(void);
|
||||
extern UINT32 AIViewerScreenShutdown(void);
|
||||
#endif
|
||||
|
||||
extern UINT32 QuestDebugScreenInit(void);
|
||||
extern UINT32 QuestDebugScreenHandle(void);
|
||||
extern UINT32 QuestDebugScreenShutdown(void);
|
||||
|
||||
UINT32 AniEditScreenInit(void);
|
||||
UINT32 AniEditScreenHandle(void);
|
||||
UINT32 AniEditScreenShutdown(void);
|
||||
|
||||
UINT32 PalEditScreenInit(void);
|
||||
UINT32 PalEditScreenHandle(void);
|
||||
UINT32 PalEditScreenShutdown(void);
|
||||
|
||||
UINT32 DebugScreenInit(void);
|
||||
UINT32 DebugScreenHandle(void);
|
||||
UINT32 DebugScreenShutdown(void);
|
||||
|
||||
UINT32 MapScreenInit(void);
|
||||
UINT32 MapScreenHandle(void);
|
||||
UINT32 MapScreenShutdown(void);
|
||||
|
||||
UINT32 LaptopScreenInit(void);
|
||||
UINT32 LaptopScreenHandle(void);
|
||||
UINT32 LaptopScreenShutdown(void);
|
||||
|
||||
|
||||
UINT32 MapUtilScreenInit( void );
|
||||
UINT32 MapUtilScreenHandle( void );
|
||||
UINT32 MapUtilScreenShutdown( void );
|
||||
|
||||
UINT32 FadeScreenInit( void );
|
||||
UINT32 FadeScreenHandle( void );
|
||||
UINT32 FadeScreenShutdown( void );
|
||||
|
||||
UINT32 MessageBoxScreenInit( void );
|
||||
UINT32 MessageBoxScreenHandle( void );
|
||||
UINT32 MessageBoxScreenShutdown( void );
|
||||
|
||||
UINT32 MainMenuScreenInit( void );
|
||||
UINT32 MainMenuScreenHandle( void );
|
||||
UINT32 MainMenuScreenShutdown( void );
|
||||
|
||||
UINT32 AutoResolveScreenInit( void );
|
||||
UINT32 AutoResolveScreenHandle( void );
|
||||
UINT32 AutoResolveScreenShutdown( void );
|
||||
|
||||
|
||||
UINT32 SaveLoadScreenShutdown( void );
|
||||
UINT32 SaveLoadScreenHandle( void );
|
||||
UINT32 SaveLoadScreenInit( void );
|
||||
|
||||
UINT32 OptionsScreenShutdown( void );
|
||||
UINT32 OptionsScreenHandle( void );
|
||||
UINT32 OptionsScreenInit( void );
|
||||
|
||||
UINT32 ShopKeeperScreenInit( void );
|
||||
UINT32 ShopKeeperScreenHandle( void );
|
||||
UINT32 ShopKeeperScreenShutdown( void );
|
||||
|
||||
UINT32 SexScreenInit( void );
|
||||
UINT32 SexScreenHandle( void );
|
||||
UINT32 SexScreenShutdown( void );
|
||||
|
||||
UINT32 GameInitOptionsScreenInit( void );
|
||||
UINT32 GameInitOptionsScreenHandle( void );
|
||||
UINT32 GameInitOptionsScreenShutdown( void );
|
||||
|
||||
UINT32 DemoExitScreenInit( void );
|
||||
UINT32 DemoExitScreenHandle( void );
|
||||
UINT32 DemoExitScreenShutdown( void );
|
||||
|
||||
extern UINT32 IntroScreenShutdown( void );
|
||||
extern UINT32 IntroScreenHandle( void );
|
||||
extern UINT32 IntroScreenInit( void );
|
||||
|
||||
extern UINT32 CreditScreenInit( void );
|
||||
extern UINT32 CreditScreenHandle( void );
|
||||
extern UINT32 CreditScreenShutdown( void );
|
||||
|
||||
// OJW - 20081129
|
||||
extern UINT32 MPJoinScreenInit( void );
|
||||
extern UINT32 MPJoinScreenHandle( void );
|
||||
extern UINT32 MPJoinScreenShutdown( void );
|
||||
|
||||
extern UINT32 MPHostScreenInit( void );
|
||||
extern UINT32 MPHostScreenHandle( void );
|
||||
extern UINT32 MPHostScreenShutdown( void );
|
||||
|
||||
// OJW - 20081222
|
||||
extern UINT32 MPScoreScreenInit( void );
|
||||
extern UINT32 MPScoreScreenHandle( void );
|
||||
extern UINT32 MPScoreScreenShutdown( void );
|
||||
|
||||
// OJW - 20090314
|
||||
extern UINT32 MPChatScreenInit( void );
|
||||
extern UINT32 MPChatScreenHandle( void );
|
||||
extern UINT32 MPChatScreenShutdown( void );
|
||||
|
||||
// OJW - 20090422
|
||||
extern UINT32 MPConnectScreenInit( void );
|
||||
extern UINT32 MPConnectScreenHandle( void );
|
||||
extern UINT32 MPConnectScreenShutdown( void );
|
||||
|
||||
extern UINT32 MiniGameScreenInit( void );
|
||||
extern UINT32 MiniGameScreenHandle( void );
|
||||
extern UINT32 MiniGameScreenShutdown( void );
|
||||
|
||||
|
||||
// External functions
|
||||
void DisplayFrameRate( );
|
||||
|
||||
void HandleTitleScreenAnimation();
|
||||
|
||||
//External Globals
|
||||
extern CHAR8 gubFilename[ 200 ];
|
||||
extern UINT32 guiCurrentScreen;
|
||||
extern UINT32 guiPendingScreen;
|
||||
|
||||
typedef void (*RENDER_HOOK)( void );
|
||||
|
||||
void SetRenderHook( RENDER_HOOK pRenderOverride );
|
||||
void SetCurrentScreen( UINT32 uiNewScreen );
|
||||
void SetDebugRenderHook( RENDER_HOOK pDebugRenderOverride, INT8 ubPage );
|
||||
|
||||
void DisableFPSOverlay( BOOLEAN fEnable );
|
||||
|
||||
void EnterTacticalScreen( );
|
||||
void LeaveTacticalScreen( UINT32 uiNewScreen );
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
struct SExceptionData
|
||||
{
|
||||
vfs::String message,function,file;
|
||||
int line;
|
||||
};
|
||||
|
||||
extern std::list<SExceptionData> g_ExceptionList;
|
||||
|
||||
void PrintExceptionList();
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,277 @@
|
||||
//legion 2
|
||||
#include "Types.h"
|
||||
#include "types.h"
|
||||
#include "Random.h"
|
||||
#include "Campaign Types.h"
|
||||
#include "Queen Command.h"
|
||||
#include "overhead.h"
|
||||
#include "Strategic Movement.h"
|
||||
#include "Strategic Status.h"
|
||||
#include "GameSettings.h"
|
||||
#include "Strategic AI.h"
|
||||
#include "XML.h"
|
||||
#include "INIReader.h"
|
||||
#include "Game Event Hook.h"
|
||||
#include "sgp.h"
|
||||
#include "jascreens.h"
|
||||
#include "laptop.h"
|
||||
#include "worlddef.h"
|
||||
#include "Soldier Control.h"
|
||||
#include "overhead.h"
|
||||
#include "email.h"
|
||||
#include "soldier profile.h"
|
||||
#include "strategicmap.h"
|
||||
#include "game init.h"
|
||||
#include "animation data.h"
|
||||
#include "soldier create.h"
|
||||
#include "Soldier Init List.h"
|
||||
#include "strategic.h"
|
||||
#include "Squads.h"
|
||||
#include "Strategic Town Loyalty.h"
|
||||
#include "Strategic Mines.h"
|
||||
#include "gameloop.h"
|
||||
#include "Random.h"
|
||||
#include "Map Screen Interface.h"
|
||||
#include "Tactical Save.h"
|
||||
#include "Campaign Types.h"
|
||||
#include "Message.h"
|
||||
#include "Game Event Hook.h"
|
||||
#include "Strategic Movement.h"
|
||||
#include "Quests.h"
|
||||
#include "Strategic AI.h"
|
||||
#include "dialogue control.h"
|
||||
#include "GameSettings.h"
|
||||
#include "INIReader.h"
|
||||
#include "Soldier Profile.h"
|
||||
#include "XML.h"
|
||||
#include "Item Types.h"
|
||||
#include "Items.h"
|
||||
#include "text.h"
|
||||
#include "GameSettings.h"
|
||||
|
||||
#ifdef JA2UB
|
||||
#include "Ja25 Strategic Ai.h"
|
||||
#include "Ja25Update.h"
|
||||
#endif
|
||||
|
||||
#include "legion cfg.h" //legion2
|
||||
#include "Campaign Types.h"
|
||||
#include "Interface.h"
|
||||
#include "Map Screen Interface Map.h"
|
||||
#include "renderworld.h"
|
||||
#include "connect.h"
|
||||
#include "XMLWriter.h"
|
||||
#include "Debug Control.h"
|
||||
#include <vfs/Core/vfs.h>
|
||||
|
||||
GAME_LEGION_OPTIONS gGameLegionOptions;
|
||||
|
||||
#define GAME_LEGION_OPTIONS_FILE "UB_Options.ini"
|
||||
|
||||
void LoadGameLegionOptions();
|
||||
|
||||
#ifdef JA2UB
|
||||
void RandomAddEnemy( UINT8 SectorX, UINT8 SectorY, UINT8 Level );
|
||||
#endif
|
||||
|
||||
void RandomStats ();
|
||||
|
||||
#ifdef JA2UB
|
||||
|
||||
void RandomAddEnemy( UINT8 SectorX, UINT8 SectorY, UINT8 Level )
|
||||
{
|
||||
UNDERGROUND_SECTORINFO *pSector;
|
||||
UINT8 ubNumAdmins = 0;
|
||||
UINT8 ubNumTroops = 0;
|
||||
UINT8 ubNumElites = 0;
|
||||
|
||||
if ( Level != 0 )
|
||||
{
|
||||
pSector = FindUnderGroundSector( SectorX, SectorY, Level );
|
||||
if ( pSector )
|
||||
{
|
||||
if ( pSector->fVisited != TRUE )
|
||||
{
|
||||
switch( gGameOptions.ubDifficultyLevel )
|
||||
{
|
||||
case DIF_LEVEL_EASY:
|
||||
ubNumAdmins = Random( 0 );
|
||||
ubNumTroops = 10 + Random( 5 );
|
||||
ubNumElites = Random( 4 );
|
||||
SetNumberJa25EnemiesInSector( SectorX, SectorY, Level, ubNumAdmins, ubNumTroops, ubNumElites );
|
||||
break;
|
||||
case DIF_LEVEL_MEDIUM:
|
||||
ubNumAdmins = Random( 0 );
|
||||
ubNumTroops = 15 + Random( 8 );
|
||||
ubNumElites = 1 + Random( 2 );
|
||||
SetNumberJa25EnemiesInSector( SectorX, SectorY, Level, ubNumAdmins, ubNumTroops, ubNumElites );
|
||||
break;
|
||||
case DIF_LEVEL_HARD:
|
||||
ubNumAdmins = Random( 0 );
|
||||
ubNumTroops = 20 + Random( 7 );
|
||||
ubNumElites = 2 + Random( 2 );
|
||||
SetNumberJa25EnemiesInSector( SectorX, SectorY, Level, ubNumAdmins, ubNumTroops, ubNumElites );
|
||||
break;
|
||||
case DIF_LEVEL_INSANE:
|
||||
ubNumAdmins = Random( 0 );
|
||||
ubNumTroops = 20 + Random( 3 );
|
||||
ubNumElites = 6 + Random( 3 );
|
||||
SetNumberJa25EnemiesInSector( SectorX, SectorY, Level, ubNumAdmins, ubNumTroops, ubNumElites );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( !GetSectorFlagStatus( SectorX, SectorY, Level, SF_ALREADY_VISITED ) )
|
||||
{
|
||||
switch( gGameOptions.ubDifficultyLevel )
|
||||
{
|
||||
case DIF_LEVEL_EASY:
|
||||
ubNumAdmins = Random( 0 );
|
||||
ubNumTroops = 10 + Random( 5 );
|
||||
ubNumElites = Random( 4 );
|
||||
SetNumberJa25EnemiesInSector( SectorX, SectorY, Level, ubNumAdmins, ubNumTroops, ubNumElites );
|
||||
break;
|
||||
case DIF_LEVEL_MEDIUM:
|
||||
ubNumAdmins = Random( 0 );
|
||||
ubNumTroops = 15 + Random( 8 );
|
||||
ubNumElites = 1 + Random( 2 );
|
||||
SetNumberJa25EnemiesInSector( SectorX, SectorY, Level, ubNumAdmins, ubNumTroops, ubNumElites );
|
||||
break;
|
||||
case DIF_LEVEL_HARD:
|
||||
ubNumAdmins = Random( 0 );
|
||||
ubNumTroops = 23 + Random( 7);
|
||||
ubNumElites = 2 + Random( 2 );
|
||||
SetNumberJa25EnemiesInSector( SectorX, SectorY, Level, ubNumAdmins, ubNumTroops, ubNumElites );
|
||||
break;
|
||||
case DIF_LEVEL_INSANE:
|
||||
ubNumAdmins = Random( 0 );
|
||||
ubNumTroops = 20 + Random( 3 );
|
||||
ubNumElites = 6 + Random( 3 );
|
||||
SetNumberJa25EnemiesInSector( SectorX, SectorY, Level, ubNumAdmins, ubNumTroops, ubNumElites );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void LoadGameLegionOptions()
|
||||
{
|
||||
#ifdef JA2UB
|
||||
JA2_5_START_SECTOR_X = gGameExternalOptions.ubDefaultArrivalSectorX;
|
||||
JA2_5_START_SECTOR_Y = gGameExternalOptions.ubDefaultArrivalSectorY;
|
||||
#endif
|
||||
|
||||
gGameLegionOptions.MercStartingGear25XML = TRUE;
|
||||
gGameLegionOptions.LOCATEGRIDNO = gGameExternalOptions.iInitialMercArrivalLocation;
|
||||
gGameLegionOptions.LOCATEGRIDNO2 = 0;
|
||||
gGameLegionOptions.OLDUBInventory = FALSE;
|
||||
|
||||
CIniReader iniReader(GAME_LEGION_OPTIONS_FILE);
|
||||
|
||||
// -----------------------
|
||||
// Unfinished Business
|
||||
// -----------------------
|
||||
|
||||
gGameLegionOptions.BorderTown = iniReader.ReadBoolean("Unfinished Business Settings","BORDER_TOWN", TRUE);
|
||||
gGameLegionOptions.BorderMine = iniReader.ReadBoolean("Unfinished Business Settings","BORDER_MINE", TRUE);
|
||||
gGameLegionOptions.BorderTeams = iniReader.ReadBoolean("Unfinished Business Settings","BORDER_TEAMS", TRUE);
|
||||
gGameLegionOptions.BorderMilitia = iniReader.ReadBoolean("Unfinished Business Settings","BORDER_MILITIA", FALSE);
|
||||
gGameLegionOptions.BorderAirspace = iniReader.ReadBoolean("Unfinished Business Settings","BORDER_AIRSPACE", TRUE);
|
||||
gGameLegionOptions.BorderItem = iniReader.ReadBoolean("Unfinished Business Settings","BORDER_ITEM", TRUE);
|
||||
|
||||
gGameLegionOptions.EventAttackInitialSectorIfPlayerStillThere = iniReader.ReadBoolean("Unfinished Business Settings","EVENT_ATTACK_INITIAL_SECTOR_IF_PLAYER_STILL_THERE", TRUE);
|
||||
gGameLegionOptions.HandleAddingEnemiesToTunnelMaps = iniReader.ReadBoolean("Unfinished Business Settings","HANDLE_ADDING_ENEMIES_TO_TUNNEL_MAPS", TRUE);
|
||||
gGameLegionOptions.ubEndDefaultSectorX = iniReader.ReadInteger("Unfinished Business Settings","DEFAULT_END_SECTOR_X", 16, 1, 16);
|
||||
gGameLegionOptions.ubEndDefaultSectorY = iniReader.ReadInteger("Unfinished Business Settings","DEFAULT_END_SECTOR_Y", 11, 1, 16);
|
||||
gGameLegionOptions.ubEndDefaultSectorZ = iniReader.ReadInteger("Unfinished Business Settings","DEFAULT_END_SECTOR_Z", 0, 0, 16);
|
||||
gGameLegionOptions.AutoResolove = iniReader.ReadBoolean("Unfinished Business Settings","AUTO_RESOLVE", FALSE);
|
||||
|
||||
gGameLegionOptions.InitialHeliGridNo[ 0 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_GRIDNO_1", 14947);
|
||||
gGameLegionOptions.InitialHeliGridNo[ 1 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_GRIDNO_2", 15584);
|
||||
gGameLegionOptions.InitialHeliGridNo[ 2 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_GRIDNO_3", 15754);
|
||||
gGameLegionOptions.InitialHeliGridNo[ 3 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_GRIDNO_4", 16232);
|
||||
gGameLegionOptions.InitialHeliGridNo[ 4 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_GRIDNO_5", 16067);
|
||||
gGameLegionOptions.InitialHeliGridNo[ 5 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_GRIDNO_6", 16230);
|
||||
gGameLegionOptions.InitialHeliGridNo[ 6 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_GRIDNO_7", 15272);
|
||||
|
||||
gGameLegionOptions.InitalHeliRandomTimes[ 0 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_RANDOM_TIME_1", 1300);
|
||||
gGameLegionOptions.InitalHeliRandomTimes[ 1 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_RANDOM_TIME_2", 2000);
|
||||
gGameLegionOptions.InitalHeliRandomTimes[ 2 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_RANDOM_TIME_3", 2750);
|
||||
gGameLegionOptions.InitalHeliRandomTimes[ 3 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_RANDOM_TIME_4", 3400);
|
||||
gGameLegionOptions.InitalHeliRandomTimes[ 4 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_RANDOM_TIME_5", 4160);
|
||||
gGameLegionOptions.InitalHeliRandomTimes[ 5 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_RANDOM_TIME_6", 4700);
|
||||
gGameLegionOptions.InitalHeliRandomTimes[ 6 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_RANDOM_TIME_7", 5630);
|
||||
|
||||
gGameLegionOptions.InGameHeliCrash = iniReader.ReadBoolean("Unfinished Business Settings","ENABLE_UB_HELICOPTER_CRASH", TRUE);
|
||||
gGameLegionOptions.JerryQuotes = iniReader.ReadBoolean("Unfinished Business Settings","JERRY_QUOTES", TRUE);
|
||||
gGameLegionOptions.InJerry = iniReader.ReadBoolean("Unfinished Business Settings","JERRY", TRUE);
|
||||
gGameLegionOptions.JerryGridNo = iniReader.ReadInteger("Unfinished Business Settings","JERRY_GRIDNO", 15109);
|
||||
gGameLegionOptions.InGameHeli = iniReader.ReadBoolean("Unfinished Business Settings","ENABLE_JA2_HELICOPTER_LANDING", FALSE);
|
||||
|
||||
gGameLegionOptions.SwitchInMorrisAreaGridNo = iniReader.ReadInteger("Unfinished Business Settings","SWITCH_IN_MORRIS_AREA_GRIDNO", 15231);
|
||||
gGameLegionOptions.SwitchToLaunchMisslesGridNo1 = iniReader.ReadInteger("Unfinished Business Settings","SWITCH_TO_LAUNCH_MISSLES_GRIDNO_1", 14268);
|
||||
gGameLegionOptions.SwitchToLaunchMisslesGridNo2 = iniReader.ReadInteger("Unfinished Business Settings","SWITCH_TO_LAUNCH_MISSLES_GRIDNO_2", 15708);
|
||||
gGameLegionOptions.RadioLocatorsGridNo1 = iniReader.ReadInteger("Unfinished Business Settings","RADIO_LOCATORS_GRIDNO_1", 15070);
|
||||
gGameLegionOptions.RadioLocatorsGridNo2 = iniReader.ReadInteger("Unfinished Business Settings","RADIO_LOCATORS_GRIDNO_2", 14744);
|
||||
gGameLegionOptions.PowergenSectorGridNo1 = iniReader.ReadInteger("Unfinished Business Settings","POWERGEN_SECTOR_GRIDNO_1", 15100);
|
||||
gGameLegionOptions.PowergenSectorGridNo2 = iniReader.ReadInteger("Unfinished Business Settings","POWERGEN_SECTOR_GRIDNO_2", 12220);
|
||||
gGameLegionOptions.PowergenSectorGridNo3 = iniReader.ReadInteger("Unfinished Business Settings","POWERGEN_SECTOR_GRIDNO_3", 14155);
|
||||
gGameLegionOptions.PowergenSectorGridNo4 = iniReader.ReadInteger("Unfinished Business Settings","POWERGEN_SECTOR_GRIDNO_4", 13980);
|
||||
|
||||
gGameLegionOptions.PowergenSectorExitgridGridNo = iniReader.ReadInteger("Unfinished Business Settings","POWERGEN_SECTOR_EXITGRID_GRIDNO", 19749);
|
||||
gGameLegionOptions.PowergenFanSoundGridNo1 = iniReader.ReadInteger("Unfinished Business Settings","POWERGEN_FAN_SOUND_GRIDNO_1", 10979);
|
||||
gGameLegionOptions.PowergenFanSoundGridNo2 = iniReader.ReadInteger("Unfinished Business Settings","POWERGEN_FAN_SOUND_GRIDNO_2", 19749);
|
||||
gGameLegionOptions.StartFanbackupAgainGridNo = iniReader.ReadInteger("Unfinished Business Settings","START_FANBACKUP_AGAIN_GRIDNO", 10980);
|
||||
gGameLegionOptions.StopPowergenFanGridNo = iniReader.ReadInteger("Unfinished Business Settings","STOP_POWERGEN_FAN_GRIDNO", 10980);
|
||||
|
||||
//sec J13
|
||||
gGameLegionOptions.FanGridNo[0] = iniReader.ReadInteger("Unfinished Business Settings","FAN_GRIDNO_1", 10978);
|
||||
gGameLegionOptions.FanGridNo[1] = iniReader.ReadInteger("Unfinished Business Settings","FAN_GRIDNO_2", 10979);
|
||||
gGameLegionOptions.FanGridNo[2] = iniReader.ReadInteger("Unfinished Business Settings","FAN_GRIDNO_3", 10980);
|
||||
gGameLegionOptions.FanGridNo[3] = iniReader.ReadInteger("Unfinished Business Settings","FAN_GRIDNO_4", 10818);
|
||||
gGameLegionOptions.FanGridNo[4] = iniReader.ReadInteger("Unfinished Business Settings","FAN_GRIDNO_5", 10819);
|
||||
gGameLegionOptions.FanGridNo[5] = iniReader.ReadInteger("Unfinished Business Settings","FAN_GRIDNO_6", 10820);
|
||||
gGameLegionOptions.FanGridNo[6] = iniReader.ReadInteger("Unfinished Business Settings","FAN_GRIDNO_7", 10658);
|
||||
gGameLegionOptions.FanGridNo[7] = iniReader.ReadInteger("Unfinished Business Settings","FAN_GRIDNO_8", 10659);
|
||||
gGameLegionOptions.FanGridNo[8] = iniReader.ReadInteger("Unfinished Business Settings","FAN_GRIDNO_9", 10660);
|
||||
|
||||
if ( gGameLegionOptions.InGameHeli == TRUE )
|
||||
gGameLegionOptions.InGameHeliCrash = FALSE;
|
||||
|
||||
if ( gGameLegionOptions.InGameHeliCrash == TRUE )
|
||||
gGameLegionOptions.InGameHeli = FALSE;
|
||||
|
||||
if ( gGameLegionOptions.InGameHeli == TRUE && gGameLegionOptions.InGameHeliCrash == TRUE )
|
||||
{
|
||||
gGameLegionOptions.InGameHeliCrash = TRUE;
|
||||
gGameLegionOptions.InGameHeli = FALSE;
|
||||
}
|
||||
|
||||
// -----------------------
|
||||
// Campaign
|
||||
// -----------------------
|
||||
|
||||
gGameLegionOptions.EnemyXML = iniReader.ReadBoolean("Campaign Settings","USE_ENEMY_ARMY_XMLS", TRUE);
|
||||
gGameLegionOptions.AddRandomEnemyToSector = iniReader.ReadBoolean("Campaign Settings","ADD_RANDOM_ENEMY_TO_SECTOR", FALSE);
|
||||
gGameLegionOptions.StrategicMovementCostsXML = iniReader.ReadBoolean("Campaign Settings","STRATEGIC_MOVEMENT_COSTS_XML", FALSE);
|
||||
gGameLegionOptions.MakeStrategicMovementCosts = iniReader.ReadBoolean("Campaign Settings","MAKE_STRATEGIC_MOVEMENT_COSTS", FALSE);
|
||||
gGameLegionOptions.LaptopQuestEnabled = iniReader.ReadBoolean("Campaign Settings","LAPTOP_QUEST", TRUE);
|
||||
gGameLegionOptions.pJA2UB = iniReader.ReadBoolean("Campaign Settings","JA2UB", TRUE);
|
||||
gGameLegionOptions.fDeadMerc = iniReader.ReadBoolean("Campaign Settings","NOTIFY_ON_DEAD_AIM_MERCS", FALSE);
|
||||
|
||||
// -----------------------
|
||||
// Laptop
|
||||
// -----------------------
|
||||
|
||||
gGameLegionOptions.LaptopIMPPassJA2 = iniReader.ReadBoolean("Laptop Settings","IMP_PASS_JA2", FALSE);
|
||||
gGameLegionOptions.LaptopIMPPassUB = iniReader.ReadBoolean("Laptop Settings","IMP_PASS_UB", TRUE);
|
||||
gGameLegionOptions.LaptopLinkInsurance = iniReader.ReadBoolean("Laptop Settings","LINK_INSURANCE", FALSE);
|
||||
gGameLegionOptions.LaptopLinkFuneral = iniReader.ReadBoolean("Laptop Settings","LINK_FUNERAL", TRUE);
|
||||
gGameLegionOptions.LaptopLinkBobby = iniReader.ReadBoolean("Laptop Settings","LINK_BOBBY", FALSE);
|
||||
gGameLegionOptions.fBobbyRSite = iniReader.ReadBoolean("Laptop Settings","BOBBY_SITE_ACCESSED", FALSE);
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
#ifndef _LEGION_CFG_H
|
||||
#define _LEGION_CFG_H
|
||||
|
||||
#include "soldier profile type.h"
|
||||
|
||||
extern void LoadGameLegionOptions();
|
||||
|
||||
typedef struct
|
||||
{
|
||||
BOOLEAN BorderTown;
|
||||
BOOLEAN BorderMine;
|
||||
BOOLEAN BorderTeams;
|
||||
BOOLEAN BorderMilitia;
|
||||
BOOLEAN BorderAirspace;
|
||||
BOOLEAN BorderItem;
|
||||
|
||||
BOOLEAN EnemyXML;
|
||||
BOOLEAN EventAttackInitialSectorIfPlayerStillThere;
|
||||
BOOLEAN HandleAddingEnemiesToTunnelMaps;
|
||||
BOOLEAN BobbyRayInventory_UB;
|
||||
BOOLEAN InitTownLoyalty_UB;
|
||||
BOOLEAN AutoResolove;
|
||||
BOOLEAN AddRandomEnemyToSector;
|
||||
BOOLEAN StrategicMovementCostsXML;
|
||||
BOOLEAN MakeStrategicMovementCosts;
|
||||
BOOLEAN MercStartingGear25XML;
|
||||
UINT32 InitialHeliGridNo[ 7 ];
|
||||
INT16 InitalHeliRandomTimes[ 7 ];
|
||||
UINT32 LOCATEGRIDNO;
|
||||
BOOLEAN LaptopIMPPassJA2;
|
||||
BOOLEAN LaptopIMPPassUB;
|
||||
|
||||
UINT8 ubDefaultArrivalSectorX;
|
||||
UINT8 ubDefaultArrivalSectorY;
|
||||
|
||||
INT32 iStartingCashNovice;
|
||||
INT32 iStartingCashExperienced;
|
||||
INT32 iStartingCashExpert;
|
||||
INT32 iStartingCashInsane;
|
||||
|
||||
BOOLEAN TEX_AND_JOHN;
|
||||
|
||||
BOOLEAN Random_Manuel_Text;
|
||||
|
||||
BOOLEAN RISRAPORT;
|
||||
|
||||
BOOLEAN LaptopQuestEnabled;
|
||||
|
||||
BOOLEAN InGameHeliCrash;
|
||||
|
||||
BOOLEAN InGameHeli;
|
||||
|
||||
UINT32 LOCATEGRIDNO2;
|
||||
|
||||
BOOLEAN JerryQuotes;
|
||||
|
||||
BOOLEAN InJerry;
|
||||
|
||||
UINT32 JerryGridNo;
|
||||
|
||||
UINT32 SwitchInMorrisAreaGridNo;
|
||||
UINT32 SwitchToLaunchMisslesGridNo1;
|
||||
UINT32 SwitchToLaunchMisslesGridNo2;
|
||||
UINT32 RadioLocatorsGridNo1;
|
||||
UINT32 RadioLocatorsGridNo2;
|
||||
UINT32 PowergenSectorGridNo1;
|
||||
UINT32 PowergenSectorGridNo2;
|
||||
UINT32 PowergenSectorGridNo3;
|
||||
UINT32 PowergenSectorGridNo4;
|
||||
UINT32 PowergenSectorExitgridGridNo;
|
||||
UINT32 PowergenFanSoundGridNo1;
|
||||
UINT32 PowergenFanSoundGridNo2;
|
||||
UINT32 StartFanbackupAgainGridNo;
|
||||
UINT32 StopPowergenFanGridNo;
|
||||
|
||||
BOOLEAN TestUB;
|
||||
|
||||
BOOLEAN LaptopLinkInsurance;
|
||||
BOOLEAN LaptopLinkFuneral;
|
||||
BOOLEAN LaptopLinkBobby;
|
||||
|
||||
UINT32 FanGridNo[9];
|
||||
|
||||
UINT8 ubEndDefaultSectorX;
|
||||
UINT8 ubEndDefaultSectorY;
|
||||
UINT8 ubEndDefaultSectorZ;
|
||||
|
||||
BOOLEAN pJA2UB;
|
||||
|
||||
BOOLEAN fBobbyRSite;
|
||||
BOOLEAN fDeadMerc;
|
||||
|
||||
BOOLEAN OLDUBInventory;
|
||||
|
||||
} GAME_LEGION_OPTIONS;
|
||||
|
||||
extern GAME_LEGION_OPTIONS gGameLegionOptions;
|
||||
|
||||
#ifdef JA2UB
|
||||
extern void RandomAddEnemy( UINT8 SectorX, UINT8 SectorY, UINT8 Level );
|
||||
extern void RandomStats ();
|
||||
#endif
|
||||
|
||||
extern void RandomStats ();
|
||||
#endif
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
#ifndef __LOCAL_DEFINES_
|
||||
#define __LOCAL_DEFINES_
|
||||
|
||||
#include "Screens.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Make sure the application has a name
|
||||
//
|
||||
|
||||
#define APPLICATION_NAME "Jagged Alliance 2 v1.13"
|
||||
#define APPLICATION_NAMEW L"Jagged Alliance 2 v1.13"
|
||||
|
||||
//
|
||||
// Basic defines for the video manager. These represent the starting values
|
||||
//
|
||||
|
||||
#ifdef BOUNDS_CHECKER
|
||||
#define WINDOWED_MODE
|
||||
#endif
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define WINDOWED_MODE
|
||||
#endif
|
||||
|
||||
extern UINT16 SCREEN_WIDTH;
|
||||
extern UINT16 SCREEN_HEIGHT;
|
||||
|
||||
extern int iResolution; // Resolution id from the ini file
|
||||
extern int iPlayIntro;
|
||||
extern int iUseWinFonts;
|
||||
extern float fTooltipScaleFactor;
|
||||
extern int iDisableMouseScrolling;
|
||||
extern INT16 iScreenWidthOffset;
|
||||
extern INT16 iScreenHeightOffset;
|
||||
|
||||
extern UINT16 xResOffset;
|
||||
extern UINT16 yResOffset;
|
||||
|
||||
extern UINT16 xResSize; // 640 / 800 / 1024
|
||||
extern UINT16 yResSize; // 480 / 600 / 768
|
||||
|
||||
typedef enum
|
||||
{
|
||||
// The 640x480 resolution should always be the FIRST entry in this enum
|
||||
_640x480 = 0,
|
||||
|
||||
_960x540 = 1,
|
||||
|
||||
// Place all resolutions that have both (a lower height AND a lower width) BEFORE the 800x600 resolution
|
||||
_800x600 = 2,
|
||||
_1024x600 = 3,
|
||||
_1280x720 = 4,
|
||||
|
||||
// Place all resolutions that have both (a lower height AND a lower width) BEFORE the 1024x768 resolution
|
||||
_1024x768 = 5,
|
||||
_1280x768 = 6,
|
||||
_1360x768 = 7,
|
||||
_1366x768 = 8,
|
||||
_1280x800 = 9,
|
||||
_1440x900 = 10,
|
||||
_1600x900 = 11,
|
||||
_1280x960 = 12,
|
||||
_1440x960 = 13,
|
||||
_1770x1000 = 14,
|
||||
_1280x1024 = 15,
|
||||
_1360x1024 = 16,
|
||||
_1600x1024 = 17,
|
||||
_1440x1050 = 18,
|
||||
_1680x1050 = 19,
|
||||
_1920x1080 = 20,
|
||||
_1600x1200 = 21,
|
||||
_1920x1200 = 22,
|
||||
_2560x1440 = 23,
|
||||
_2560x1600 = 24,
|
||||
_CustomRes = 25,
|
||||
} SCREEN_RESOLUTION;
|
||||
|
||||
extern BOOLEAN fDisplayOverheadMap;
|
||||
|
||||
#define PIXEL_DEPTH 16
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,40 @@
|
||||
#ifndef _MAINMENU_H
|
||||
#define _MAINMENU_H
|
||||
|
||||
//MainMenu by Jazz
|
||||
#define MAX_MAIN_MENU_IMAGE 200
|
||||
#define MAX_MAIN_MENU_CHARS 500
|
||||
#define MAX_ELEMENT 20
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UINT32 uiIndex; // add
|
||||
BOOLEAN Visible;
|
||||
CHAR8 Description[MAX_MAIN_MENU_CHARS];
|
||||
CHAR8 FileName[MAX_MAIN_MENU_CHARS];
|
||||
BOOLEAN FitToScreen;
|
||||
BOOLEAN StretchImage;
|
||||
BOOLEAN CenterImage;
|
||||
BOOLEAN ImagePositionRelative;
|
||||
INT32 ImagePositionX;
|
||||
INT32 ImagePositionY;
|
||||
|
||||
UINT32 MAINMENU_Y;
|
||||
UINT32 MAINMENU_Y_SPACE;
|
||||
UINT32 MAINMENU_X;
|
||||
|
||||
} MAIN_MENU_VALUES;
|
||||
|
||||
//Main Menu layout by Jazz
|
||||
extern MAIN_MENU_VALUES gMainMenulayout[MAX_MAIN_MENU_IMAGE];
|
||||
|
||||
extern UINT32 MAINMENU_Y;
|
||||
extern UINT32 MAINMENU_X;
|
||||
extern UINT32 MAINMENU_Y_SPACE;
|
||||
|
||||
BOOLEAN InitMainMenu( );
|
||||
void ClearMainMenu( );
|
||||
|
||||
void InitDependingGameStyleOptions();
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,442 @@
|
||||
#ifdef PROFILER_ENABLED
|
||||
|
||||
#include "builddefines.h"
|
||||
#include <sstream>
|
||||
|
||||
#ifdef PERIODIC_PROFILING
|
||||
bool gRecordingProfile = false;
|
||||
#endif
|
||||
|
||||
PerfManager* PerfManager::_instance(NULL);
|
||||
|
||||
PerfDatum::PerfDatum( const char* const fileName,
|
||||
const char* const functionName,
|
||||
const int lineNumber,
|
||||
__int64 cycles,
|
||||
__int64 calls)
|
||||
:
|
||||
_fileName(fileName),
|
||||
_functionName(functionName),
|
||||
_lineNumber(lineNumber),
|
||||
_cycles(cycles),
|
||||
_calls(calls)
|
||||
{
|
||||
}
|
||||
|
||||
PerfManager::PerfManager(void)
|
||||
:
|
||||
_callTime(0),
|
||||
_totalTime(0)
|
||||
{
|
||||
//Set up a root function so that the stack is never empty:
|
||||
//(this will be the only entry with _lineNumber equal to 0)
|
||||
_perfLog.insert(PerfDatum(__FILE__, "Root",0));
|
||||
_perfStack.push_back(&*(_perfLog.begin()));
|
||||
_lastTime = getCPUCount();
|
||||
calibrate();
|
||||
}
|
||||
|
||||
void PerfManager::calibrate()
|
||||
{
|
||||
}
|
||||
|
||||
PerfManager::~PerfManager(void)
|
||||
{
|
||||
}
|
||||
|
||||
PerfManager* PerfManager::instance()
|
||||
{
|
||||
if(!_instance) //Double-check locking (first check)
|
||||
{ _instance = new PerfManager();
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
|
||||
void PerfManager::enterFunction(const char* const fileName,
|
||||
const char* const functionName,
|
||||
const int lineNumber)
|
||||
{
|
||||
//Mark the time when we end processing the previous function
|
||||
__int64 endTime = getCPUCount();
|
||||
//assuming we haven't corrupted the stack and reduced it to zero elements
|
||||
if(_perfStack.size())
|
||||
{ PERF_STACK_T::reverse_iterator lastMarker = _perfStack.rbegin();
|
||||
//Update the total time spent processing the previous function
|
||||
__int64 runTime = (endTime - _lastTime) - _callTime;
|
||||
(**lastMarker)._cycles += runTime;
|
||||
_totalTime += runTime;
|
||||
}
|
||||
|
||||
//If we fail to insert the performance marker into our log, it means it is
|
||||
//a duplicate. We can ignore this "error" as using the existing copy is
|
||||
//the correct behavior.
|
||||
std::pair<PERF_LOG_T::iterator, bool> result =
|
||||
_perfLog.insert(PerfDatum(fileName, functionName, lineNumber));
|
||||
//Update the call count on the new function:
|
||||
PerfDatum* marker = &*(result.first);
|
||||
marker->_calls++;
|
||||
//Add performance marker to the stack as well as the log:
|
||||
_perfStack.push_back(marker);
|
||||
//Now that we are clear of any complex operations, we can set the call
|
||||
//time of the new marker more accurately:
|
||||
_lastTime = getCPUCount();
|
||||
}
|
||||
|
||||
void PerfManager::exitFunction()
|
||||
{
|
||||
//Mark the time when we exited the function
|
||||
__int64 endTime = getCPUCount();
|
||||
//Update the function in our log with its new runtime
|
||||
PERF_STACK_T::reverse_iterator lastMarker = _perfStack.rbegin();
|
||||
__int64 runTime = endTime - _lastTime;
|
||||
(**lastMarker)._cycles += runTime;
|
||||
_totalTime += runTime;
|
||||
_perfStack.pop_back();
|
||||
//Lastly, update the function we've fallen back to with the new current
|
||||
//run time.
|
||||
_lastTime = getCPUCount();
|
||||
}
|
||||
|
||||
__int64 PerfManager::getCPUCount () const
|
||||
{
|
||||
_asm rdtsc
|
||||
}
|
||||
|
||||
bool PerfSort::operator ()(const PerfDatum& lhs, const PerfDatum&rhs) const
|
||||
{
|
||||
if(rhs._lineNumber == lhs._lineNumber)
|
||||
{ return 0 < strcmp(rhs._fileName, lhs._fileName);
|
||||
}
|
||||
else
|
||||
{ return rhs._lineNumber > lhs._lineNumber;
|
||||
}
|
||||
}
|
||||
|
||||
bool PerfSort2::operator ()(const PerfDatum& lhs, const PerfDatum&rhs) const
|
||||
{
|
||||
return lhs._cycles > rhs._cycles;
|
||||
}
|
||||
|
||||
int PerfManager::getPercision(const double value) const
|
||||
{
|
||||
int retVal = 1;
|
||||
if(10.0 <= value)
|
||||
{ retVal = 3;
|
||||
}
|
||||
else if (1.0 <= value)
|
||||
{ retVal = 2;
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
void PerfManager::log(std::ostream &os)
|
||||
{
|
||||
//Create a copy of the log that sorts by cycles used
|
||||
std::set<PerfDatum, PerfSort2> logCopy;
|
||||
for(PERF_LOG_T::iterator i = _perfLog.begin(); i != _perfLog.end(); i++)
|
||||
{
|
||||
logCopy.insert(*i);
|
||||
}
|
||||
|
||||
int cyclesWidth = 1;
|
||||
//I want the formatting to be nice!
|
||||
for(std::set<PerfDatum, PerfSort2>::iterator i = logCopy.begin();
|
||||
i != logCopy.end();
|
||||
i++)
|
||||
{
|
||||
if(i->_lineNumber) {
|
||||
std::stringstream cyclesString;
|
||||
cyclesString << i->_cycles;
|
||||
std::string tempString;
|
||||
cyclesString >> tempString;
|
||||
cyclesWidth = tempString.size();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Stream the sorted log to the supplied ostream
|
||||
for(std::set<PerfDatum, PerfSort2>::iterator i = logCopy.begin();
|
||||
i != logCopy.end();
|
||||
++i)
|
||||
{
|
||||
if(i->_lineNumber)
|
||||
{ //Truncate path from file name if the compiler included it.
|
||||
const char* j = i->_fileName + strlen(i->_fileName);
|
||||
while('\\' != *j && '/' != *j && j >= i->_fileName){j--;}
|
||||
if('\\' == *j || '/' == *j){j++;}
|
||||
std::stringstream cyclesString;
|
||||
std::string tempString;
|
||||
cyclesString << i->_cycles;
|
||||
cyclesString >> tempString;
|
||||
os.width(cyclesWidth);
|
||||
os << tempString.c_str() << ", ";
|
||||
__int64 cyclesPerCall = i->_cycles / i->_calls;
|
||||
cyclesString.clear();
|
||||
tempString.clear();
|
||||
cyclesString << cyclesPerCall;
|
||||
cyclesString >> tempString;
|
||||
os.width(cyclesWidth);
|
||||
os << tempString.c_str() << "] cycles (";
|
||||
double percent = double(i->_cycles) / double(_totalTime) * 100;
|
||||
os.precision(getPercision(percent));
|
||||
os.width(4);
|
||||
os << percent << "%) used in [";
|
||||
os.width(8);
|
||||
os << i->_calls << "] calls by " << j << "::" << i->_functionName\
|
||||
<< " at line " << i->_lineNumber << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PerfMarker::PerfMarker( const char* const fileName,
|
||||
const char* const functionName,
|
||||
const int lineNumber)
|
||||
:
|
||||
#ifdef PERIODIC_PROFILING
|
||||
_onStack(gRecordingProfile)
|
||||
#else
|
||||
_onStack(true)
|
||||
#endif
|
||||
{
|
||||
#ifdef PERIODIC_PROFILING
|
||||
if (gRecordingProfile == true) {
|
||||
#endif
|
||||
PerfManager::instance()->enterFunction(fileName,functionName,lineNumber);
|
||||
#ifdef PERIODIC_PROFILING
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
PerfMarker::~PerfMarker()
|
||||
{
|
||||
endMark();
|
||||
}
|
||||
|
||||
void PerfMarker::endMark()
|
||||
{
|
||||
if(_onStack)
|
||||
{ PerfManager::instance()->exitFunction();
|
||||
_onStack = false;
|
||||
}
|
||||
}
|
||||
#include "profiler.h"
|
||||
#include <sstream>
|
||||
|
||||
#ifdef PERIODIC_PROFILING
|
||||
bool gRecordingProfile = false;
|
||||
#endif
|
||||
|
||||
PerfManager* PerfManager::_instance(NULL);
|
||||
|
||||
PerfDatum::PerfDatum( const char* const fileName,
|
||||
const char* const functionName,
|
||||
const int lineNumber,
|
||||
__int64 cycles,
|
||||
__int64 calls)
|
||||
:
|
||||
_fileName(fileName),
|
||||
_functionName(functionName),
|
||||
_lineNumber(lineNumber),
|
||||
_cycles(cycles),
|
||||
_calls(calls)
|
||||
{
|
||||
}
|
||||
|
||||
PerfManager::PerfManager(void)
|
||||
:
|
||||
_callTime(0),
|
||||
_totalTime(0)
|
||||
{
|
||||
//Set up a root function so that the stack is never empty:
|
||||
//(this will be the only entry with _lineNumber equal to 0)
|
||||
_perfLog.insert(PerfDatum(__FILE__, "Root",0));
|
||||
_perfStack.push_back(&*(_perfLog.begin()));
|
||||
_lastTime = getCPUCount();
|
||||
calibrate();
|
||||
}
|
||||
|
||||
void PerfManager::calibrate()
|
||||
{
|
||||
}
|
||||
|
||||
PerfManager::~PerfManager(void)
|
||||
{
|
||||
}
|
||||
|
||||
PerfManager* PerfManager::instance()
|
||||
{
|
||||
if(!_instance) //Double-check locking (first check)
|
||||
{ _instance = new PerfManager();
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
|
||||
void PerfManager::enterFunction(const char* const fileName,
|
||||
const char* const functionName,
|
||||
const int lineNumber)
|
||||
{
|
||||
//Mark the time when we end processing the previous function
|
||||
__int64 endTime = getCPUCount();
|
||||
//assuming we haven't corrupted the stack and reduced it to zero elements
|
||||
if(_perfStack.size())
|
||||
{ PERF_STACK_T::reverse_iterator lastMarker = _perfStack.rbegin();
|
||||
//Update the total time spent processing the previous function
|
||||
__int64 runTime = (endTime - _lastTime) - _callTime;
|
||||
(**lastMarker)._cycles += runTime;
|
||||
_totalTime += runTime;
|
||||
}
|
||||
|
||||
//If we fail to insert the performance marker into our log, it means it is
|
||||
//a duplicate. We can ignore this "error" as using the existing copy is
|
||||
//the correct behavior.
|
||||
std::pair<PERF_LOG_T::iterator, bool> result =
|
||||
_perfLog.insert(PerfDatum(fileName, functionName, lineNumber));
|
||||
//Update the call count on the new function:
|
||||
PerfDatum* marker = &*(result.first);
|
||||
marker->_calls++;
|
||||
//Add performance marker to the stack as well as the log:
|
||||
_perfStack.push_back(marker);
|
||||
//Now that we are clear of any complex operations, we can set the call
|
||||
//time of the new marker more accurately:
|
||||
_lastTime = getCPUCount();
|
||||
}
|
||||
|
||||
void PerfManager::exitFunction()
|
||||
{
|
||||
//Mark the time when we exited the function
|
||||
__int64 endTime = getCPUCount();
|
||||
//Update the function in our log with its new runtime
|
||||
PERF_STACK_T::reverse_iterator lastMarker = _perfStack.rbegin();
|
||||
__int64 runTime = endTime - _lastTime;
|
||||
(**lastMarker)._cycles += runTime;
|
||||
_totalTime += runTime;
|
||||
_perfStack.pop_back();
|
||||
//Lastly, update the function we've fallen back to with the new current
|
||||
//run time.
|
||||
_lastTime = getCPUCount();
|
||||
}
|
||||
|
||||
__int64 PerfManager::getCPUCount () const
|
||||
{
|
||||
_asm rdtsc
|
||||
}
|
||||
|
||||
bool PerfSort::operator ()(const PerfDatum& lhs, const PerfDatum&rhs) const
|
||||
{
|
||||
if(rhs._lineNumber == lhs._lineNumber)
|
||||
{ return 0 < strcmp(rhs._fileName, lhs._fileName);
|
||||
}
|
||||
else
|
||||
{ return rhs._lineNumber > lhs._lineNumber;
|
||||
}
|
||||
}
|
||||
|
||||
bool PerfSort2::operator ()(const PerfDatum& lhs, const PerfDatum&rhs) const
|
||||
{
|
||||
return lhs._cycles > rhs._cycles;
|
||||
}
|
||||
|
||||
int PerfManager::getPercision(const double value) const
|
||||
{
|
||||
int retVal = 1;
|
||||
if(10.0 <= value)
|
||||
{ retVal = 3;
|
||||
}
|
||||
else if (1.0 <= value)
|
||||
{ retVal = 2;
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
void PerfManager::log(std::ostream &os)
|
||||
{
|
||||
//Create a copy of the log that sorts by cycles used
|
||||
std::set<PerfDatum, PerfSort2> logCopy;
|
||||
for(PERF_LOG_T::iterator i = _perfLog.begin(); i != _perfLog.end(); i++)
|
||||
{
|
||||
logCopy.insert(*i);
|
||||
}
|
||||
|
||||
int cyclesWidth = 1;
|
||||
//I want the formatting to be nice!
|
||||
for(std::set<PerfDatum, PerfSort2>::iterator i = logCopy.begin();
|
||||
i != logCopy.end();
|
||||
i++)
|
||||
{
|
||||
if(i->_lineNumber) {
|
||||
std::stringstream cyclesString;
|
||||
cyclesString << i->_cycles;
|
||||
std::string tempString;
|
||||
cyclesString >> tempString;
|
||||
cyclesWidth = tempString.size();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Stream the sorted log to the supplied ostream
|
||||
for(std::set<PerfDatum, PerfSort2>::iterator i = logCopy.begin();
|
||||
i != logCopy.end();
|
||||
++i)
|
||||
{
|
||||
if(i->_lineNumber)
|
||||
{ //Truncate path from file name if the compiler included it.
|
||||
const char* j = i->_fileName + strlen(i->_fileName);
|
||||
while('\\' != *j && '/' != *j && j >= i->_fileName){j--;}
|
||||
if('\\' == *j || '/' == *j){j++;}
|
||||
std::stringstream cyclesString;
|
||||
std::string tempString;
|
||||
cyclesString << i->_cycles;
|
||||
cyclesString >> tempString;
|
||||
os.width(cyclesWidth);
|
||||
os << tempString.c_str() << ", ";
|
||||
__int64 cyclesPerCall = i->_cycles / i->_calls;
|
||||
cyclesString.clear();
|
||||
tempString.clear();
|
||||
cyclesString << cyclesPerCall;
|
||||
cyclesString >> tempString;
|
||||
os.width(cyclesWidth);
|
||||
os << tempString.c_str() << "] cycles (";
|
||||
double percent = double(i->_cycles) / double(_totalTime) * 100;
|
||||
os.precision(getPercision(percent));
|
||||
os.width(4);
|
||||
os << percent << "%) used in [";
|
||||
os.width(8);
|
||||
os << i->_calls << "] calls by " << j << "::" << i->_functionName\
|
||||
<< " at line " << i->_lineNumber << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PerfMarker::PerfMarker( const char* const fileName,
|
||||
const char* const functionName,
|
||||
const int lineNumber)
|
||||
:
|
||||
#ifdef PERIODIC_PROFILING
|
||||
_onStack(gRecordingProfile)
|
||||
#else
|
||||
_onStack(true)
|
||||
#endif
|
||||
{
|
||||
#ifdef PERIODIC_PROFILING
|
||||
if (gRecordingProfile == true) {
|
||||
#endif
|
||||
PerfManager::instance()->enterFunction(fileName,functionName,lineNumber);
|
||||
#ifdef PERIODIC_PROFILING
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
PerfMarker::~PerfMarker()
|
||||
{
|
||||
endMark();
|
||||
}
|
||||
|
||||
void PerfMarker::endMark()
|
||||
{
|
||||
if(_onStack)
|
||||
{ PerfManager::instance()->exitFunction();
|
||||
_onStack = false;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,87 @@
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <ostream>
|
||||
|
||||
//#ifndef PROFILER_ENABLED
|
||||
//#define PROFILER_ENABLED
|
||||
//#endif
|
||||
|
||||
#ifdef PROFILER_ENABLED
|
||||
#define STRINGIZE(x) #x
|
||||
#define NAMED_ PERFORMANCE_MARKER(x) PerfMarker x(__FILE__, STRINGIZE(x), __LINE__);
|
||||
#define END_NAMED_ PERFORMANCE_MARKER(x) x.endMark();
|
||||
#define PERFORMANCE_MARKER PerfMarker MARK(__FILE__, __FUNCTION__, __LINE__);
|
||||
#define PERIODIC_PROFILING
|
||||
#else
|
||||
#define PERFORMANCE_MARKER
|
||||
#endif
|
||||
#pragma warning (disable : 4512)//disables assignment operator could not be generated
|
||||
|
||||
struct PerfDatum
|
||||
{
|
||||
PerfDatum( const char* const fileName,
|
||||
const char* const functionName,
|
||||
const int lineNumber,
|
||||
__int64 cycles = 0,
|
||||
__int64 calls = 0);
|
||||
const char* const _fileName;
|
||||
const char* const _functionName;
|
||||
const int _lineNumber;
|
||||
__int64 _cycles; //Number of CPU cycles used
|
||||
__int64 _calls; //Number of calls to this function
|
||||
};
|
||||
#pragma warning (default : 4512)//disables assignment operator could not be generated
|
||||
|
||||
class PerfSort
|
||||
{
|
||||
public:
|
||||
bool operator()(const PerfDatum& lhs, const PerfDatum& rhs) const;
|
||||
};
|
||||
|
||||
class PerfSort2
|
||||
{
|
||||
public:
|
||||
bool operator()(const PerfDatum& lhs, const PerfDatum& rhs) const;
|
||||
};
|
||||
|
||||
|
||||
typedef std::set<PerfDatum, PerfSort> PERF_LOG_T;
|
||||
typedef std::vector<PerfDatum* > PERF_STACK_T;
|
||||
|
||||
class PerfManager
|
||||
{
|
||||
public:
|
||||
~PerfManager(void);
|
||||
static PerfManager* instance();
|
||||
void enterFunction( const char* const fileName,
|
||||
const char* const functionName,
|
||||
const int lineNumber);
|
||||
void exitFunction();
|
||||
void log(std::ostream &os);
|
||||
private:
|
||||
PerfManager(void);
|
||||
__int64 getCPUCount(void) const;
|
||||
void calibrate(void);
|
||||
int getPercision(const double value) const; //used for formatting percentages
|
||||
static PerfManager* _instance;
|
||||
PERF_LOG_T _perfLog;
|
||||
PERF_STACK_T _perfStack;
|
||||
__int64 _callTime; //Time it takes to call the getCPUCount function
|
||||
__int64 _totalTime;
|
||||
__int64 _lastTime; //The last time we got hte CPU count.
|
||||
};
|
||||
|
||||
class PerfMarker
|
||||
{
|
||||
public:
|
||||
PerfMarker( const char* const fileName,
|
||||
const char* const functionName,
|
||||
const int lineNumber);
|
||||
~PerfMarker();
|
||||
void endMark();
|
||||
private:
|
||||
bool _onStack;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
#ifndef __SCREEN_IDS
|
||||
#define __SCREEN_IDS
|
||||
|
||||
enum ScreenTypes
|
||||
{
|
||||
EDIT_SCREEN,
|
||||
SAVING_SCREEN,
|
||||
LOADING_SCREEN,
|
||||
ERROR_SCREEN,
|
||||
INIT_SCREEN,
|
||||
GAME_SCREEN,
|
||||
ANIEDIT_SCREEN,
|
||||
PALEDIT_SCREEN,
|
||||
DEBUG_SCREEN,
|
||||
MAP_SCREEN,
|
||||
LAPTOP_SCREEN,
|
||||
LOADSAVE_SCREEN,
|
||||
MAPUTILITY_SCREEN,
|
||||
FADE_SCREEN,
|
||||
MSG_BOX_SCREEN,
|
||||
MAINMENU_SCREEN,
|
||||
AUTORESOLVE_SCREEN,
|
||||
SAVE_LOAD_SCREEN,
|
||||
OPTIONS_SCREEN,
|
||||
SHOPKEEPER_SCREEN,
|
||||
SEX_SCREEN,
|
||||
GAME_INIT_OPTIONS_SCREEN,
|
||||
DEMO_EXIT_SCREEN,
|
||||
INTRO_SCREEN,
|
||||
CREDIT_SCREEN,
|
||||
MP_JOIN_SCREEN, // OJW - 20081129
|
||||
MP_HOST_SCREEN,
|
||||
MP_SCORE_SCREEN, // OJW - 20081222
|
||||
MP_CHAT_SCREEN, // OJW - 20090315
|
||||
MP_CONNECT_SCREEN, //OJW - 20090422
|
||||
MINIGAME_SCREEN, // Flugente
|
||||
FEATURES_SCREEN, //rftr
|
||||
|
||||
#ifdef JA2BETAVERSION
|
||||
AIVIEWER_SCREEN,
|
||||
#endif
|
||||
|
||||
//#ifdef JA2BETAVERSION
|
||||
QUEST_DEBUG_SCREEN,
|
||||
//#endif
|
||||
|
||||
MAX_SCREENS
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,440 @@
|
||||
#include "Types.h"
|
||||
#include "types.h"
|
||||
#include "Random.h"
|
||||
#include "Campaign Types.h"
|
||||
#include "Queen Command.h"
|
||||
#include "overhead.h"
|
||||
#include "Strategic Movement.h"
|
||||
#include "Strategic Status.h"
|
||||
#include "GameSettings.h"
|
||||
#include "Strategic AI.h"
|
||||
#include "XML.h"
|
||||
#include "INIReader.h"
|
||||
#include "Game Event Hook.h"
|
||||
#include "sgp.h"
|
||||
#include "jascreens.h"
|
||||
#include "laptop.h"
|
||||
#include "worlddef.h"
|
||||
#include "Soldier Control.h"
|
||||
#include "overhead.h"
|
||||
#include "email.h"
|
||||
#include "soldier profile.h"
|
||||
#include "strategicmap.h"
|
||||
#include "game init.h"
|
||||
#include "animation data.h"
|
||||
#include "soldier create.h"
|
||||
#include "Soldier Init List.h"
|
||||
#include "strategic.h"
|
||||
#include "Squads.h"
|
||||
#include "Strategic Town Loyalty.h"
|
||||
#include "Strategic Mines.h"
|
||||
#include "gameloop.h"
|
||||
#include "Random.h"
|
||||
#include "Map Screen Interface.h"
|
||||
#include "Tactical Save.h"
|
||||
#include "Campaign Types.h"
|
||||
#include "Message.h"
|
||||
#include "Game Event Hook.h"
|
||||
#include "Strategic Movement.h"
|
||||
#include "Quests.h"
|
||||
#include "Strategic AI.h"
|
||||
#include "dialogue control.h"
|
||||
#include "GameSettings.h"
|
||||
#include "INIReader.h"
|
||||
#include "Soldier Profile.h"
|
||||
#include "XML.h"
|
||||
#include "Item Types.h"
|
||||
#include "Items.h"
|
||||
#include "text.h"
|
||||
#include "GameSettings.h"
|
||||
|
||||
#ifdef JA2UB
|
||||
#include "Ja25 Strategic Ai.h"
|
||||
#include "Ja25_Tactical.h"
|
||||
#include "Ja25Update.h"
|
||||
#endif
|
||||
|
||||
#include "GameInitOptionsScreen.h"
|
||||
|
||||
#include "ub_config.h" //legion2
|
||||
#include "Campaign Types.h"
|
||||
#include "Interface.h"
|
||||
#include "Map Screen Interface Map.h"
|
||||
#include "renderworld.h"
|
||||
#include "connect.h"
|
||||
#include "XMLWriter.h"
|
||||
#include "Debug Control.h"
|
||||
#include <vfs/Core/vfs.h>
|
||||
|
||||
GAME_UB_OPTIONS gGameUBOptions;
|
||||
|
||||
#define GAME_UB_OPTIONS_FILE "UB_Options.ini"
|
||||
|
||||
void LoadGameUBOptions();
|
||||
|
||||
#ifdef JA2UB
|
||||
void RandomAddEnemy( UINT8 SectorX, UINT8 SectorY, UINT8 Level );
|
||||
#endif
|
||||
|
||||
void RandomStats ();
|
||||
|
||||
#ifdef JA2UB
|
||||
|
||||
void RandomAddEnemy( UINT8 SectorX, UINT8 SectorY, UINT8 Level )
|
||||
{
|
||||
UNDERGROUND_SECTORINFO *pSector;
|
||||
UINT8 ubNumAdmins = 0;
|
||||
UINT8 ubNumTroops = 0;
|
||||
UINT8 ubNumElites = 0;
|
||||
UINT8 ubNumTanks = 0;
|
||||
UINT8 ubNumJeeps = 0;
|
||||
UINT8 ubNumRobots = 0;
|
||||
|
||||
if ( Level != 0 )
|
||||
{
|
||||
pSector = FindUnderGroundSector( SectorX, SectorY, Level );
|
||||
if ( pSector )
|
||||
{
|
||||
if ( pSector->fVisited != TRUE )
|
||||
{
|
||||
switch( gGameOptions.ubDifficultyLevel )
|
||||
{
|
||||
case DIF_LEVEL_EASY:
|
||||
ubNumAdmins = Random( 0 );
|
||||
ubNumTroops = 10 + Random( 5 );
|
||||
ubNumElites = Random( 4 );
|
||||
SetNumberJa25EnemiesInSector( SectorX, SectorY, Level, ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks, ubNumJeeps, ubNumRobots );
|
||||
break;
|
||||
case DIF_LEVEL_MEDIUM:
|
||||
ubNumAdmins = Random( 0 );
|
||||
ubNumTroops = 15 + Random( 8 );
|
||||
ubNumElites = 1 + Random( 2 );
|
||||
SetNumberJa25EnemiesInSector( SectorX, SectorY, Level, ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks, ubNumJeeps, ubNumRobots );
|
||||
break;
|
||||
case DIF_LEVEL_HARD:
|
||||
ubNumAdmins = Random( 0 );
|
||||
ubNumTroops = 20 + Random( 7 );
|
||||
ubNumElites = 2 + Random( 2 );
|
||||
SetNumberJa25EnemiesInSector( SectorX, SectorY, Level, ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks, ubNumJeeps, ubNumRobots );
|
||||
break;
|
||||
case DIF_LEVEL_INSANE:
|
||||
ubNumAdmins = Random( 0 );
|
||||
ubNumTroops = 20 + Random( 3 );
|
||||
ubNumElites = 6 + Random( 3 );
|
||||
SetNumberJa25EnemiesInSector( SectorX, SectorY, Level, ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks, ubNumJeeps, ubNumRobots );
|
||||
break;
|
||||
default:
|
||||
ubNumAdmins = Random( 0 );
|
||||
ubNumTroops = 10 + Random( 5 );
|
||||
ubNumElites = Random( 4 );
|
||||
SetNumberJa25EnemiesInSector( SectorX, SectorY, Level, ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks, ubNumJeeps, ubNumRobots );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( !GetSectorFlagStatus( SectorX, SectorY, Level, SF_ALREADY_VISITED ) )
|
||||
{
|
||||
switch( gGameOptions.ubDifficultyLevel )
|
||||
{
|
||||
case DIF_LEVEL_EASY:
|
||||
ubNumAdmins = Random( 0 );
|
||||
ubNumTroops = 10 + Random( 5 );
|
||||
ubNumElites = Random( 4 );
|
||||
SetNumberJa25EnemiesInSector( SectorX, SectorY, Level, ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks, ubNumJeeps, ubNumRobots );
|
||||
break;
|
||||
case DIF_LEVEL_MEDIUM:
|
||||
ubNumAdmins = Random( 0 );
|
||||
ubNumTroops = 15 + Random( 8 );
|
||||
ubNumElites = 1 + Random( 2 );
|
||||
SetNumberJa25EnemiesInSector( SectorX, SectorY, Level, ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks, ubNumJeeps, ubNumRobots );
|
||||
break;
|
||||
case DIF_LEVEL_HARD:
|
||||
ubNumAdmins = Random( 0 );
|
||||
ubNumTroops = 23 + Random( 7);
|
||||
ubNumElites = 2 + Random( 2 );
|
||||
SetNumberJa25EnemiesInSector( SectorX, SectorY, Level, ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks, ubNumJeeps, ubNumRobots );
|
||||
break;
|
||||
case DIF_LEVEL_INSANE:
|
||||
ubNumAdmins = Random( 0 );
|
||||
ubNumTroops = 20 + Random( 3 );
|
||||
ubNumElites = 6 + Random( 3 );
|
||||
SetNumberJa25EnemiesInSector( SectorX, SectorY, Level, ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks, ubNumJeeps, ubNumRobots );
|
||||
break;
|
||||
default:
|
||||
ubNumAdmins = Random( 0 );
|
||||
ubNumTroops = 10 + Random( 5 );
|
||||
ubNumElites = Random( 4 );
|
||||
SetNumberJa25EnemiesInSector( SectorX, SectorY, Level, ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks, ubNumJeeps, ubNumRobots );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void LoadGameUBOptions()
|
||||
{
|
||||
#ifdef JA2UB
|
||||
JA2_5_START_SECTOR_X = gGameExternalOptions.ubDefaultArrivalSectorX;
|
||||
JA2_5_START_SECTOR_Y = gGameExternalOptions.ubDefaultArrivalSectorY;
|
||||
#endif
|
||||
|
||||
gGameUBOptions.LOCATEGRIDNO = gGameExternalOptions.iInitialMercArrivalLocation;
|
||||
gGameUBOptions.LOCATEGRIDNO2 = 0;
|
||||
|
||||
CIniReader iniReader(GAME_UB_OPTIONS_FILE);
|
||||
|
||||
// -----------------------
|
||||
// Unfinished Business
|
||||
// -----------------------
|
||||
|
||||
gGameUBOptions.BorderTown = iniReader.ReadBoolean("Unfinished Business Settings","BORDER_TOWN", TRUE);
|
||||
gGameUBOptions.BorderMine = iniReader.ReadBoolean("Unfinished Business Settings","BORDER_MINE", TRUE);
|
||||
gGameUBOptions.BorderTeams = iniReader.ReadBoolean("Unfinished Business Settings","BORDER_TEAMS", TRUE);
|
||||
gGameUBOptions.BorderMilitia = iniReader.ReadBoolean("Unfinished Business Settings","BORDER_MILITIA", FALSE);
|
||||
gGameUBOptions.BorderAirspace = iniReader.ReadBoolean("Unfinished Business Settings","BORDER_AIRSPACE", TRUE);
|
||||
gGameUBOptions.BorderItem = iniReader.ReadBoolean("Unfinished Business Settings","BORDER_ITEM", TRUE);
|
||||
|
||||
gGameUBOptions.EventAttackInitialSectorIfPlayerStillThere = iniReader.ReadBoolean("Unfinished Business Settings","EVENT_ATTACK_INITIAL_SECTOR_IF_PLAYER_STILL_THERE", TRUE);
|
||||
gGameUBOptions.HandleAddingEnemiesToTunnelMaps = iniReader.ReadBoolean("Unfinished Business Settings","HANDLE_ADDING_ENEMIES_TO_TUNNEL_MAPS", TRUE);
|
||||
gGameUBOptions.ubEndDefaultSectorX = iniReader.ReadInteger("Unfinished Business Settings","DEFAULT_END_SECTOR_X", 16, 1, 16);
|
||||
gGameUBOptions.ubEndDefaultSectorY = iniReader.ReadInteger("Unfinished Business Settings","DEFAULT_END_SECTOR_Y", 11, 1, 16);
|
||||
gGameUBOptions.ubEndDefaultSectorZ = iniReader.ReadInteger("Unfinished Business Settings","DEFAULT_END_SECTOR_Z", 0, 0, 16);
|
||||
gGameUBOptions.AutoResolve = iniReader.ReadBoolean("Unfinished Business Settings","AUTO_RESOLVE", FALSE);
|
||||
|
||||
gGameUBOptions.InitialHeliGridNo[ 0 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_GRIDNO_1", 14947);
|
||||
gGameUBOptions.InitialHeliGridNo[ 1 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_GRIDNO_2", 15584);
|
||||
gGameUBOptions.InitialHeliGridNo[ 2 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_GRIDNO_3", 15754);
|
||||
gGameUBOptions.InitialHeliGridNo[ 3 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_GRIDNO_4", 16232);
|
||||
gGameUBOptions.InitialHeliGridNo[ 4 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_GRIDNO_5", 16067);
|
||||
gGameUBOptions.InitialHeliGridNo[ 5 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_GRIDNO_6", 16230);
|
||||
gGameUBOptions.InitialHeliGridNo[ 6 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_GRIDNO_7", 15272);
|
||||
|
||||
gGameUBOptions.InitalHeliRandomTimes[ 0 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_RANDOM_TIME_1", 1300);
|
||||
gGameUBOptions.InitalHeliRandomTimes[ 1 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_RANDOM_TIME_2", 2000);
|
||||
gGameUBOptions.InitalHeliRandomTimes[ 2 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_RANDOM_TIME_3", 2750);
|
||||
gGameUBOptions.InitalHeliRandomTimes[ 3 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_RANDOM_TIME_4", 3400);
|
||||
gGameUBOptions.InitalHeliRandomTimes[ 4 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_RANDOM_TIME_5", 4160);
|
||||
gGameUBOptions.InitalHeliRandomTimes[ 5 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_RANDOM_TIME_6", 4700);
|
||||
gGameUBOptions.InitalHeliRandomTimes[ 6 ] = iniReader.ReadInteger("Unfinished Business Settings","INITIAL_HELICOPTER_RANDOM_TIME_7", 5630);
|
||||
|
||||
gGameUBOptions.InGameHeliCrash = iniReader.ReadBoolean("Unfinished Business Settings","ENABLE_UB_HELICOPTER_CRASH", TRUE);
|
||||
gGameUBOptions.JerryQuotes = iniReader.ReadBoolean("Unfinished Business Settings","JERRY_QUOTES", TRUE);
|
||||
gGameUBOptions.InJerry = iniReader.ReadBoolean("Unfinished Business Settings","JERRY", TRUE);
|
||||
gGameUBOptions.JerryGridNo = iniReader.ReadInteger("Unfinished Business Settings","JERRY_GRIDNO", 15109);
|
||||
gGameUBOptions.InGameHeli = iniReader.ReadBoolean("Unfinished Business Settings","ENABLE_JA2_HELICOPTER_LANDING", FALSE);
|
||||
|
||||
gGameUBOptions.SwitchInMorrisAreaGridNo = iniReader.ReadInteger("Unfinished Business Settings","SWITCH_IN_MORRIS_AREA_GRIDNO", 15231);
|
||||
gGameUBOptions.SwitchToLaunchMisslesGridNo1 = iniReader.ReadInteger("Unfinished Business Settings","SWITCH_TO_LAUNCH_MISSLES_GRIDNO_1", 14268);
|
||||
gGameUBOptions.SwitchToLaunchMisslesGridNo2 = iniReader.ReadInteger("Unfinished Business Settings","SWITCH_TO_LAUNCH_MISSLES_GRIDNO_2", 15708);
|
||||
gGameUBOptions.RadioLocatorsGridNo1 = iniReader.ReadInteger("Unfinished Business Settings","RADIO_LOCATORS_GRIDNO_1", 15070);
|
||||
gGameUBOptions.RadioLocatorsGridNo2 = iniReader.ReadInteger("Unfinished Business Settings","RADIO_LOCATORS_GRIDNO_2", 14744);
|
||||
gGameUBOptions.PowergenSectorGridNo1 = iniReader.ReadInteger("Unfinished Business Settings","POWERGEN_SECTOR_GRIDNO_1", 15100);
|
||||
gGameUBOptions.PowergenSectorGridNo2 = iniReader.ReadInteger("Unfinished Business Settings","POWERGEN_SECTOR_GRIDNO_2", 12220);
|
||||
gGameUBOptions.PowergenSectorGridNo3 = iniReader.ReadInteger("Unfinished Business Settings","POWERGEN_SECTOR_GRIDNO_3", 14155);
|
||||
gGameUBOptions.PowergenSectorGridNo4 = iniReader.ReadInteger("Unfinished Business Settings","POWERGEN_SECTOR_GRIDNO_4", 13980);
|
||||
|
||||
gGameUBOptions.PowergenSectorExitgridGridNo = iniReader.ReadInteger("Unfinished Business Settings","POWERGEN_SECTOR_EXITGRID_GRIDNO", 19749);
|
||||
gGameUBOptions.PowergenFanSoundGridNo1 = iniReader.ReadInteger("Unfinished Business Settings","POWERGEN_FAN_SOUND_GRIDNO_1", 10979);
|
||||
gGameUBOptions.PowergenFanSoundGridNo2 = iniReader.ReadInteger("Unfinished Business Settings","POWERGEN_FAN_SOUND_GRIDNO_2", 19749);
|
||||
gGameUBOptions.StartFanbackupAgainGridNo = iniReader.ReadInteger("Unfinished Business Settings","START_FANBACKUP_AGAIN_GRIDNO", 10980);
|
||||
gGameUBOptions.StopPowergenFanGridNo = iniReader.ReadInteger("Unfinished Business Settings","STOP_POWERGEN_FAN_GRIDNO", 10980);
|
||||
|
||||
//sec J13
|
||||
gGameUBOptions.FanGridNo[0] = iniReader.ReadInteger("Unfinished Business Settings","FAN_GRIDNO_1", 10978);
|
||||
gGameUBOptions.FanGridNo[1] = iniReader.ReadInteger("Unfinished Business Settings","FAN_GRIDNO_2", 10979);
|
||||
gGameUBOptions.FanGridNo[2] = iniReader.ReadInteger("Unfinished Business Settings","FAN_GRIDNO_3", 10980);
|
||||
gGameUBOptions.FanGridNo[3] = iniReader.ReadInteger("Unfinished Business Settings","FAN_GRIDNO_4", 10818);
|
||||
gGameUBOptions.FanGridNo[4] = iniReader.ReadInteger("Unfinished Business Settings","FAN_GRIDNO_5", 10819);
|
||||
gGameUBOptions.FanGridNo[5] = iniReader.ReadInteger("Unfinished Business Settings","FAN_GRIDNO_6", 10820);
|
||||
gGameUBOptions.FanGridNo[6] = iniReader.ReadInteger("Unfinished Business Settings","FAN_GRIDNO_7", 10658);
|
||||
gGameUBOptions.FanGridNo[7] = iniReader.ReadInteger("Unfinished Business Settings","FAN_GRIDNO_8", 10659);
|
||||
gGameUBOptions.FanGridNo[8] = iniReader.ReadInteger("Unfinished Business Settings","FAN_GRIDNO_9", 10660);
|
||||
|
||||
//L15-3
|
||||
gGameUBOptions.SectorLaunchMisslesX = iniReader.ReadInteger("Unfinished Business Settings","SECTOR_LAUNCH_MISSLES_X", 15);
|
||||
gGameUBOptions.SectorLaunchMisslesY = iniReader.ReadInteger("Unfinished Business Settings","SECTOR_LAUNCH_MISSLES_Y", 12);
|
||||
gGameUBOptions.SectorLaunchMisslesZ = iniReader.ReadInteger("Unfinished Business Settings","SECTOR_LAUNCH_MISSLES_Z", 3);
|
||||
|
||||
//J13-0
|
||||
gGameUBOptions.SectorFanX = iniReader.ReadInteger("Unfinished Business Settings","POWERGEN_SECTOR_X", 13);
|
||||
gGameUBOptions.SectorFanY = iniReader.ReadInteger("Unfinished Business Settings","POWERGEN_SECTOR_Y", 10);
|
||||
gGameUBOptions.SectorFanZ = iniReader.ReadInteger("Unfinished Business Settings","POWERGEN_SECTOR_Z", 0);
|
||||
|
||||
//K14-1
|
||||
gGameUBOptions.SectorOpenGateInTunnelX = iniReader.ReadInteger("Unfinished Business Settings","SECTOR_OPEN_GATE_IN_TUNNEL_X", 14);
|
||||
gGameUBOptions.SectorOpenGateInTunnelY = iniReader.ReadInteger("Unfinished Business Settings","SECTOR_OPEN_GATE_IN_TUNNEL_Y", 11);
|
||||
gGameUBOptions.SectorOpenGateInTunnelZ = iniReader.ReadInteger("Unfinished Business Settings","SECTOR_OPEN_GATE_IN_TUNNEL_Z", 1);
|
||||
|
||||
//J14-1
|
||||
gGameUBOptions.ExitForFanToPowerGenSectorX = iniReader.ReadInteger("Unfinished Business Settings","EXIT_FOR_FAN_TO_POWER_GEN_SECTOR_X", 14);
|
||||
gGameUBOptions.ExitForFanToPowerGenSectorY = iniReader.ReadInteger("Unfinished Business Settings","EXIT_FOR_FAN_TO_POWER_GEN_SECTOR_Y", 10);
|
||||
gGameUBOptions.ExitForFanToPowerGenSectorZ = iniReader.ReadInteger("Unfinished Business Settings","EXIT_FOR_FAN_TO_POWER_GEN_SECTOR_Z", 1);
|
||||
|
||||
|
||||
//I13
|
||||
gGameUBOptions.MineSectorX = iniReader.ReadInteger("Unfinished Business Settings","MINE_SECTOR_X", 13);
|
||||
gGameUBOptions.MineSectorY = iniReader.ReadInteger("Unfinished Business Settings","MINE_SECTOR_Y", 9);
|
||||
gGameUBOptions.MineSectorZ = iniReader.ReadInteger("Unfinished Business Settings","MINE_SECTOR_Z",0);
|
||||
|
||||
gGameUBOptions.MineEntranceGridno = iniReader.ReadInteger("Unfinished Business Settings","MINE_ENTRANCE_GRIDNO",12421);
|
||||
gGameUBOptions.MineGridnoAddStructToHead = iniReader.ReadInteger("Unfinished Business Settings","MINE_GRIDNO_ADD_STRUCT_TO_HEAD",12745);
|
||||
|
||||
gGameUBOptions.MineRemoveExitGridFromWorld1 = iniReader.ReadInteger("Unfinished Business Settings","MINE_REMOVE_EXIT_GRID_FROM_WORLD_1",12422);
|
||||
gGameUBOptions.MineRemoveExitGridFromWorld2 = iniReader.ReadInteger("Unfinished Business Settings","MINE_REMOVE_EXIT_GRID_FROM_WORLD_2",12423);
|
||||
|
||||
gGameUBOptions.MineSectorUndergroundX = iniReader.ReadInteger("Unfinished Business Settings","MINE_SECTOR_UNDERGROUND_X", 13);
|
||||
gGameUBOptions.MineSectorUndergroundY = iniReader.ReadInteger("Unfinished Business Settings","MINE_SECTOR_UNDERGROUND_Y", 9);
|
||||
gGameUBOptions.MineSectorUndergroundZ = iniReader.ReadInteger("Unfinished Business Settings","MINE_SECTOR_UNDERGROUND_Z", 1);
|
||||
|
||||
gGameUBOptions.MineSectorUndergroundGridno1 = iniReader.ReadInteger("Unfinished Business Settings","MINE_SECTOR_UNDERGROUND_GRIDNO_1", 13057);
|
||||
gGameUBOptions.MineSectorUndergroundGridno2 = iniReader.ReadInteger("Unfinished Business Settings","MINE_SECTOR_UNDERGROUND_GRIDNO_2", 12897);
|
||||
|
||||
//K15-1
|
||||
gGameUBOptions.SectorDoorInTunnelX = iniReader.ReadInteger("Unfinished Business Settings","SECTOR_DOOR_IN_TUNNEL_X", 15);
|
||||
gGameUBOptions.SectorDoorInTunnelY = iniReader.ReadInteger("Unfinished Business Settings","SECTOR_DOOR_IN_TUNNEL_Y", 11);
|
||||
gGameUBOptions.SectorDoorInTunnelZ = iniReader.ReadInteger("Unfinished Business Settings","SECTOR_DOOR_IN_TUNNEL_Z", 1);
|
||||
|
||||
gGameUBOptions.SectorDoorInTunnelGridNo = iniReader.ReadInteger("Unfinished Business Settings","SECTOR_DOOR_IN_TUNNEL_GRIDNO", 11419);
|
||||
|
||||
//H9
|
||||
gGameUBOptions.SectorGuardPostX = iniReader.ReadInteger("Unfinished Business Settings","SECTOR_GUARDPOST_X", 9);
|
||||
gGameUBOptions.SectorGuardPostY = iniReader.ReadInteger("Unfinished Business Settings","SECTOR_GUARDPOST_Y", 8);
|
||||
gGameUBOptions.SectorGuardPostZ = iniReader.ReadInteger("Unfinished Business Settings","SECTOR_GUARDPOST_Z", 0);
|
||||
|
||||
gGameUBOptions.H9MoneyGridNo = iniReader.ReadInteger("Unfinished Business Settings","H9_MONEY_GRIDNO", 9026);
|
||||
gGameUBOptions.H9MoneyEasy = iniReader.ReadInteger("Unfinished Business Settings","H9_MONEY_EASY", 15000);
|
||||
gGameUBOptions.H9MoneyMedium = iniReader.ReadInteger("Unfinished Business Settings","H9_MONEY_MEDIUM", 10000);
|
||||
gGameUBOptions.H9MoneyHard = iniReader.ReadInteger("Unfinished Business Settings","H9_MONEY_HARD", 7000);
|
||||
|
||||
//I10
|
||||
gGameUBOptions.FristSectorTownX = iniReader.ReadInteger("Unfinished Business Settings","SECTOR_TOWN1_X", 10);
|
||||
gGameUBOptions.FristSectorTownY = iniReader.ReadInteger("Unfinished Business Settings","SECTOR_TOWN1_Y", 9);
|
||||
gGameUBOptions.FristSectorTownZ = iniReader.ReadInteger("Unfinished Business Settings","SECTOR_TOWN1_Z", 0);
|
||||
|
||||
gGameUBOptions.I10MoneyGridNo1 = iniReader.ReadInteger("Unfinished Business Settings","I10_MONEY_GRIDNO_1", 11894);
|
||||
gGameUBOptions.I10MoneyEasy1 = iniReader.ReadInteger("Unfinished Business Settings","I10_MONEY_EASY_1", 8000);
|
||||
gGameUBOptions.I10MoneyMedium1 = iniReader.ReadInteger("Unfinished Business Settings","I10_MONEY_MEDIUM_1", 4000);
|
||||
gGameUBOptions.I10MoneyHard1 = iniReader.ReadInteger("Unfinished Business Settings","I10_MONEY_HARD_1", 3000);
|
||||
|
||||
gGameUBOptions.I10MoneyGridNo2 = iniReader.ReadInteger("Unfinished Business Settings","I10_MONEY_GRIDNO_2", 7906);
|
||||
gGameUBOptions.I10MoneyEasy2 = iniReader.ReadInteger("Unfinished Business Settings","I10_MONEY_EASY_2", 12000);
|
||||
gGameUBOptions.I10MoneyMedium2 = iniReader.ReadInteger("Unfinished Business Settings","I10_MONEY_MEDIUM_2", 6000);
|
||||
gGameUBOptions.I10MoneyHard2 = iniReader.ReadInteger("Unfinished Business Settings","I10_MONEY_HARD_2", 5000);
|
||||
|
||||
//J11
|
||||
gGameUBOptions.SectorTown2X = iniReader.ReadInteger("Unfinished Business Settings","SECTOR_TOWN2_X", 10);
|
||||
gGameUBOptions.SectorTown2Y = iniReader.ReadInteger("Unfinished Business Settings","SECTOR_TOWN2_Y", 9);
|
||||
gGameUBOptions.SectorTown2Z = iniReader.ReadInteger("Unfinished Business Settings","SECTOR_TOWN2_Z", 0);
|
||||
|
||||
//H11
|
||||
gGameUBOptions.SectorTown3X = iniReader.ReadInteger("Unfinished Business Settings","SECTOR_TOWN3_X", 11);
|
||||
gGameUBOptions.SectorTown3Y = iniReader.ReadInteger("Unfinished Business Settings","SECTOR_TOWN3_Y", 8);
|
||||
gGameUBOptions.SectorTown3Z = iniReader.ReadInteger("Unfinished Business Settings","SECTOR_TOWN3_Z", 0);
|
||||
|
||||
gGameUBOptions.SectorTownGridNo1a = iniReader.ReadInteger("Unfinished Business Settings","TOWN2_FROM_GRIDNO_1", 15446);
|
||||
gGameUBOptions.SectorTownGridNo1b = iniReader.ReadInteger("Unfinished Business Settings","TOWN2_TO_ROOF_GRIDNO_1", 13993);
|
||||
|
||||
gGameUBOptions.SectorTownGridNo2a = iniReader.ReadInteger("Unfinished Business Settings","TOWN2_FROM_GRIDNO_2", 15436);
|
||||
gGameUBOptions.SectorTownGridNo2b = iniReader.ReadInteger("Unfinished Business Settings","TOWN2_TO_ROOF_GRIDNO_2", 14006);
|
||||
|
||||
gGameUBOptions.SectorTownGridNo3a = iniReader.ReadInteger("Unfinished Business Settings","TOWN3_FROM_GRIDNO_1", 8711);
|
||||
gGameUBOptions.SectorTownGridNo3b = iniReader.ReadInteger("Unfinished Business Settings","TOWN3_TO_ROOF_GRIDNO_1", 5521);
|
||||
|
||||
//I9
|
||||
gGameUBOptions.I9SectorPlayerQuoteX = iniReader.ReadInteger("Unfinished Business Settings","I9_SECTOR_PLAYER_QUOTE_X", 9);
|
||||
gGameUBOptions.I9SectorPlayerQuoteY = iniReader.ReadInteger("Unfinished Business Settings","I9_SECTOR_PLAYER_QUOTE_Y", 9);
|
||||
gGameUBOptions.I9SectorPlayerQuoteZ = iniReader.ReadInteger("Unfinished Business Settings","I9_SECTOR_PLAYER_QUOTE_Z", 0);
|
||||
|
||||
//H10
|
||||
gGameUBOptions.H10SectorPlayerQuoteX = iniReader.ReadInteger("Unfinished Business Settings","H10_SECTOR_PLAYER_QUOTE_X", 10);
|
||||
gGameUBOptions.H10SectorPlayerQuoteY = iniReader.ReadInteger("Unfinished Business Settings","H10_SECTOR_PLAYER_QUOTE_Y", 8);
|
||||
gGameUBOptions.H10SectorPlayerQuoteZ = iniReader.ReadInteger("Unfinished Business Settings","H10_SECTOR_PLAYER_QUOTE_Z", 0);
|
||||
|
||||
|
||||
if ( gGameUBOptions.InGameHeli == TRUE )
|
||||
gGameUBOptions.InGameHeliCrash = FALSE;
|
||||
|
||||
if ( gGameUBOptions.InGameHeliCrash == TRUE )
|
||||
gGameUBOptions.InGameHeli = FALSE;
|
||||
|
||||
if ( gGameUBOptions.InGameHeli == TRUE && gGameUBOptions.InGameHeliCrash == TRUE )
|
||||
{
|
||||
gGameUBOptions.InGameHeliCrash = TRUE;
|
||||
gGameUBOptions.InGameHeli = FALSE;
|
||||
}
|
||||
|
||||
// -----------------------
|
||||
// Campaign
|
||||
// -----------------------
|
||||
|
||||
gGameUBOptions.EnemyXML = iniReader.ReadBoolean("Campaign Settings","USE_ENEMY_ARMY_XMLS", TRUE);
|
||||
gGameUBOptions.AddRandomEnemyToSector = iniReader.ReadBoolean("Campaign Settings","ADD_RANDOM_ENEMY_TO_SECTOR", FALSE);
|
||||
gGameUBOptions.StrategicMovementCostsXML = iniReader.ReadBoolean("Campaign Settings","STRATEGIC_MOVEMENT_COSTS_XML", FALSE);
|
||||
gGameUBOptions.MakeStrategicMovementCosts = iniReader.ReadBoolean("Campaign Settings","MAKE_STRATEGIC_MOVEMENT_COSTS", FALSE);
|
||||
gGameUBOptions.LaptopQuestEnabled = iniReader.ReadBoolean("Campaign Settings","LAPTOP_QUEST", TRUE);
|
||||
gGameUBOptions.pJA2UB = iniReader.ReadBoolean("Campaign Settings","JA2UB", TRUE);
|
||||
gGameUBOptions.fDeadMerc = iniReader.ReadBoolean("Campaign Settings","NOTIFY_ON_DEAD_AIM_MERCS", FALSE);
|
||||
|
||||
// -----------------------
|
||||
// Laptop
|
||||
// -----------------------
|
||||
|
||||
gGameUBOptions.LaptopIMPPassJA2 = iniReader.ReadBoolean("Laptop Settings","IMP_PASS_JA2", FALSE);
|
||||
gGameUBOptions.LaptopIMPPassUB = iniReader.ReadBoolean("Laptop Settings","IMP_PASS_UB", TRUE);
|
||||
gGameUBOptions.LaptopLinkInsurance = iniReader.ReadBoolean("Laptop Settings","LINK_INSURANCE", FALSE);
|
||||
gGameUBOptions.LaptopLinkFuneral = iniReader.ReadBoolean("Laptop Settings","LINK_FUNERAL", TRUE);
|
||||
gGameUBOptions.LaptopLinkBobby = iniReader.ReadBoolean("Laptop Settings","LINK_BOBBY", FALSE);
|
||||
gGameUBOptions.fBobbyRSite = iniReader.ReadBoolean("Laptop Settings","BOBBY_SITE_ACCESSED", FALSE);
|
||||
|
||||
// -----------------------
|
||||
// Weapon
|
||||
// -----------------------
|
||||
#ifdef JA2UB
|
||||
gGameUBOptions.ubTEX_MOVIE_ATTACK_CLYDESDALES = iniReader.ReadInteger("Unfinished Business Items","TEX_MOVIE_ATTACK_CLYDESDALES", 1356);
|
||||
gGameUBOptions.ubTEX_MOVIE_WILD_EAST = iniReader.ReadInteger("Unfinished Business Items","TEX_MOVIE_WILD_EAST", 1357);
|
||||
gGameUBOptions.ubTEX_MOVIE_HAVE_HONDA = iniReader.ReadInteger("Unfinished Business Items","TEX_MOVIE_HAVE_HONDA", 1358);
|
||||
gGameUBOptions.ubLAPTOP_TRANSMITTER = iniReader.ReadInteger("Unfinished Business Items","LAPTOP_TRANSMITTER", 1355);
|
||||
gGameUBOptions.ubCHE_GUEVARA_CANTEEN = iniReader.ReadInteger("Unfinished Business Items","CHE_GUEVARA_CANTEEN", 1359);
|
||||
gGameUBOptions.ubMERC_WRISTWATCH = iniReader.ReadInteger("Unfinished Business Items","MERC_WRISTWATCH", 1360);
|
||||
gGameUBOptions.ubSAM_GARVER_COMBAT_KNIFE = iniReader.ReadInteger("Unfinished Business Items","SAM_GARVER_COMBAT_KNIFE", 1353);
|
||||
gGameUBOptions.ubMERC_UMBRELLA_OLD = iniReader.ReadInteger("Unfinished Business Items","MERC_UMBRELLA_OLD", 1361);
|
||||
gGameUBOptions.ubMORRIS_INSTRUCTION_NOTE = iniReader.ReadInteger("Unfinished Business Items","MORRIS_INSTRUCTION_NOTE", 1362);
|
||||
gGameUBOptions.ubHAND_CANNON = iniReader.ReadInteger("Unfinished Business Items","HAND_CANNON", 1352);
|
||||
gGameUBOptions.ubHARTFORD_6_SHOOTER = iniReader.ReadInteger("Unfinished Business Items","HARTFORD_6_SHOOTER", 66);
|
||||
gGameUBOptions.ubMERC_UMBRELLA = iniReader.ReadInteger("Unfinished Business Items","MERC_UMBRELLA", 1361);
|
||||
gGameUBOptions.ubCLIP_CANNON_BALL = iniReader.ReadInteger("Unfinished Business Items","CLIP_CANNON_BALL", 1354);
|
||||
gGameUBOptions.ubBARRETT_UB = iniReader.ReadInteger("Unfinished Business Items","BARRETT_UB", 335);
|
||||
gGameUBOptions.ubCALICO_960_UB = iniReader.ReadInteger("Unfinished Business Items","CALICO_960_UB", 69);
|
||||
gGameUBOptions.ubPSG1_UB = iniReader.ReadInteger("Unfinished Business Items","PSG1_UB", 334);
|
||||
gGameUBOptions.ubL85_UB = iniReader.ReadInteger("Unfinished Business Items","L85_UB", 331);
|
||||
gGameUBOptions.ubTAR21_UB = iniReader.ReadInteger("Unfinished Business Items","TAR21_UB", 332);
|
||||
gGameUBOptions.ubVAL_SILENT_UB = iniReader.ReadInteger("Unfinished Business Items","VAL_SILENT_UB", 333);
|
||||
gGameUBOptions.ubMICRO_UZI_UB = iniReader.ReadInteger("Unfinished Business Items","MICRO_UZI_UB", 330);
|
||||
gGameUBOptions.ubCALICO_950_UB = iniReader.ReadInteger("Unfinished Business Items","CALICO_950_UB", 67);
|
||||
gGameUBOptions.ubCALICO_900_UB = iniReader.ReadInteger("Unfinished Business Items","CALICO_900_UB", 68);
|
||||
|
||||
// -----------------------
|
||||
// Profiles
|
||||
// -----------------------
|
||||
|
||||
gGameUBOptions.ubMANUEL_UB = iniReader.ReadInteger("Unfinished Business Profiles","MANUEL", 60);
|
||||
gGameUBOptions.ubBIGGENS_UB = iniReader.ReadInteger("Unfinished Business Profiles","BIGENS", 61);
|
||||
gGameUBOptions.ubJOHN_K_UB = iniReader.ReadInteger("Unfinished Business Profiles","JOHN_K", 62);
|
||||
gGameUBOptions.ubTEX_UB = iniReader.ReadInteger("Unfinished Business Profiles","TEX", 64);
|
||||
gGameUBOptions.ubGASTON_UB = iniReader.ReadInteger("Unfinished Business Profiles","GASTON", 58);
|
||||
gGameUBOptions.ubSTOGIE_UB = iniReader.ReadInteger("Unfinished Business Profiles","STOGIE", 59);
|
||||
gGameUBOptions.ubJERRY_MILO_UB = iniReader.ReadInteger("Unfinished Business Profiles","JERRY", 76);
|
||||
gGameUBOptions.ubPGMALE4_UB = iniReader.ReadInteger("Unfinished Business Profiles","PGMALE4", 57);
|
||||
gGameUBOptions.ubBETTY_UB = iniReader.ReadInteger("Unfinished Business Profiles","BETTY", 73);
|
||||
gGameUBOptions.ubRAUL_UB = iniReader.ReadInteger("Unfinished Business Profiles","RAUL", 74);
|
||||
gGameUBOptions.ubMORRIS_UB = iniReader.ReadInteger("Unfinished Business Profiles","MORRIS", 75);
|
||||
gGameUBOptions.ubRUDY_UB = iniReader.ReadInteger("Unfinished Business Profiles","RUDY", 77);
|
||||
|
||||
|
||||
#endif
|
||||
}
|
||||
+233
@@ -0,0 +1,233 @@
|
||||
#ifndef _UB_CONFIG_CFG_H
|
||||
#define _UB_CONFIG_CFG_H
|
||||
|
||||
#include "soldier profile type.h"
|
||||
|
||||
extern void LoadGameUBOptions();
|
||||
|
||||
typedef struct
|
||||
{
|
||||
BOOLEAN BorderTown;
|
||||
BOOLEAN BorderMine;
|
||||
BOOLEAN BorderTeams;
|
||||
BOOLEAN BorderMilitia;
|
||||
BOOLEAN BorderAirspace;
|
||||
BOOLEAN BorderItem;
|
||||
|
||||
BOOLEAN EnemyXML;
|
||||
BOOLEAN EventAttackInitialSectorIfPlayerStillThere;
|
||||
BOOLEAN HandleAddingEnemiesToTunnelMaps;
|
||||
BOOLEAN BobbyRayInventory_UB;
|
||||
BOOLEAN InitTownLoyalty_UB;
|
||||
BOOLEAN AutoResolve;
|
||||
BOOLEAN AddRandomEnemyToSector;
|
||||
BOOLEAN StrategicMovementCostsXML;
|
||||
BOOLEAN MakeStrategicMovementCosts;
|
||||
UINT32 InitialHeliGridNo[ 7 ];
|
||||
INT16 InitalHeliRandomTimes[ 7 ];
|
||||
UINT32 LOCATEGRIDNO;
|
||||
BOOLEAN LaptopIMPPassJA2;
|
||||
BOOLEAN LaptopIMPPassUB;
|
||||
|
||||
UINT8 ubDefaultArrivalSectorX;
|
||||
UINT8 ubDefaultArrivalSectorY;
|
||||
|
||||
INT32 iStartingCashNovice;
|
||||
INT32 iStartingCashExperienced;
|
||||
INT32 iStartingCashExpert;
|
||||
INT32 iStartingCashInsane;
|
||||
|
||||
BOOLEAN fTexAndJohn;
|
||||
|
||||
BOOLEAN fRandomManuelText;
|
||||
|
||||
BOOLEAN RISRAPORT;
|
||||
|
||||
BOOLEAN LaptopQuestEnabled;
|
||||
|
||||
BOOLEAN InGameHeliCrash;
|
||||
|
||||
BOOLEAN InGameHeli;
|
||||
|
||||
UINT32 LOCATEGRIDNO2;
|
||||
|
||||
BOOLEAN JerryQuotes;
|
||||
|
||||
BOOLEAN InJerry;
|
||||
|
||||
UINT32 JerryGridNo;
|
||||
|
||||
UINT32 SwitchInMorrisAreaGridNo;
|
||||
UINT32 SwitchToLaunchMisslesGridNo1;
|
||||
UINT32 SwitchToLaunchMisslesGridNo2;
|
||||
UINT32 RadioLocatorsGridNo1;
|
||||
UINT32 RadioLocatorsGridNo2;
|
||||
UINT32 PowergenSectorGridNo1;
|
||||
UINT32 PowergenSectorGridNo2;
|
||||
UINT32 PowergenSectorGridNo3;
|
||||
UINT32 PowergenSectorGridNo4;
|
||||
UINT32 PowergenSectorExitgridGridNo;
|
||||
UINT32 PowergenFanSoundGridNo1;
|
||||
UINT32 PowergenFanSoundGridNo2;
|
||||
UINT32 StartFanbackupAgainGridNo;
|
||||
UINT32 StopPowergenFanGridNo;
|
||||
|
||||
BOOLEAN TestUB;
|
||||
|
||||
BOOLEAN LaptopLinkInsurance;
|
||||
BOOLEAN LaptopLinkFuneral;
|
||||
BOOLEAN LaptopLinkBobby;
|
||||
|
||||
UINT32 FanGridNo[9];
|
||||
|
||||
UINT8 ubEndDefaultSectorX;
|
||||
UINT8 ubEndDefaultSectorY;
|
||||
UINT8 ubEndDefaultSectorZ;
|
||||
|
||||
BOOLEAN pJA2UB;
|
||||
|
||||
BOOLEAN fBobbyRSite;
|
||||
BOOLEAN fDeadMerc;
|
||||
|
||||
UINT8 ubMANUEL_UB;
|
||||
UINT8 ubBIGGENS_UB;
|
||||
UINT8 ubJOHN_K_UB;
|
||||
UINT8 ubTEX_UB;
|
||||
UINT8 ubGASTON_UB;
|
||||
UINT8 ubSTOGIE_UB;
|
||||
UINT8 ubJERRY_MILO_UB;
|
||||
UINT8 ubPGMALE4_UB;
|
||||
UINT8 ubBETTY_UB;
|
||||
UINT8 ubRAUL_UB;
|
||||
UINT8 ubMORRIS_UB;
|
||||
UINT8 ubRUDY_UB;
|
||||
|
||||
UINT32 ubTEX_MOVIE_ATTACK_CLYDESDALES;
|
||||
UINT32 ubTEX_MOVIE_WILD_EAST;
|
||||
UINT32 ubTEX_MOVIE_HAVE_HONDA;
|
||||
UINT32 ubLAPTOP_TRANSMITTER;
|
||||
UINT32 ubCHE_GUEVARA_CANTEEN;
|
||||
UINT32 ubMERC_WRISTWATCH;
|
||||
UINT32 ubSAM_GARVER_COMBAT_KNIFE;
|
||||
UINT32 ubMERC_UMBRELLA_OLD;
|
||||
UINT32 ubMORRIS_INSTRUCTION_NOTE;
|
||||
UINT32 ubHAND_CANNON;
|
||||
UINT32 ubHARTFORD_6_SHOOTER;
|
||||
UINT32 ubMERC_UMBRELLA;
|
||||
UINT32 ubCLIP_CANNON_BALL;
|
||||
UINT32 ubBARRETT_UB;
|
||||
UINT32 ubCALICO_960_UB;
|
||||
UINT32 ubPSG1_UB;
|
||||
UINT32 ubL85_UB;
|
||||
UINT32 ubTAR21_UB;
|
||||
UINT32 ubVAL_SILENT_UB;
|
||||
UINT32 ubMICRO_UZI_UB;
|
||||
UINT32 ubCALICO_950_UB;
|
||||
UINT32 ubCALICO_900_UB;
|
||||
|
||||
//L15-3
|
||||
UINT32 SectorLaunchMisslesX;
|
||||
UINT32 SectorLaunchMisslesY;
|
||||
UINT32 SectorLaunchMisslesZ;
|
||||
|
||||
//J13-0
|
||||
UINT32 SectorFanX;
|
||||
UINT32 SectorFanY;
|
||||
UINT32 SectorFanZ;
|
||||
|
||||
//K14-1
|
||||
UINT32 SectorOpenGateInTunnelX;
|
||||
UINT32 SectorOpenGateInTunnelY;
|
||||
UINT32 SectorOpenGateInTunnelZ;
|
||||
|
||||
//J14-1
|
||||
UINT32 ExitForFanToPowerGenSectorX;
|
||||
UINT32 ExitForFanToPowerGenSectorY;
|
||||
UINT32 ExitForFanToPowerGenSectorZ;
|
||||
|
||||
UINT32 MineSectorX;
|
||||
UINT32 MineSectorY;
|
||||
UINT32 MineSectorZ;
|
||||
|
||||
UINT32 MineEntranceGridno;
|
||||
UINT32 MineGridnoAddStructToHead;
|
||||
|
||||
UINT32 MineRemoveExitGridFromWorld1;
|
||||
UINT32 MineRemoveExitGridFromWorld2;
|
||||
|
||||
UINT32 MineSectorUndergroundX;
|
||||
UINT32 MineSectorUndergroundY;
|
||||
UINT32 MineSectorUndergroundZ;
|
||||
|
||||
UINT32 MineSectorUndergroundGridno1;
|
||||
UINT32 MineSectorUndergroundGridno2;
|
||||
|
||||
UINT32 SectorDoorInTunnelX;
|
||||
UINT32 SectorDoorInTunnelY;
|
||||
UINT32 SectorDoorInTunnelZ;
|
||||
|
||||
UINT32 SectorGuardPostX;
|
||||
UINT32 SectorGuardPostZ;
|
||||
UINT32 SectorGuardPostY;
|
||||
|
||||
UINT32 H9MoneyGridNo;
|
||||
UINT32 H9MoneyEasy;
|
||||
UINT32 H9MoneyMedium;
|
||||
UINT32 H9MoneyHard;
|
||||
|
||||
UINT32 FristSectorTownX;
|
||||
UINT32 FristSectorTownY;
|
||||
UINT32 FristSectorTownZ;
|
||||
|
||||
UINT32 I10MoneyGridNo1;
|
||||
UINT32 I10MoneyEasy1;
|
||||
UINT32 I10MoneyMedium1;
|
||||
UINT32 I10MoneyHard1;
|
||||
|
||||
UINT32 I10MoneyGridNo2;
|
||||
UINT32 I10MoneyEasy2;
|
||||
UINT32 I10MoneyMedium2;
|
||||
UINT32 I10MoneyHard2;
|
||||
|
||||
UINT32 SectorTown2X;
|
||||
UINT32 SectorTown2Y;
|
||||
UINT32 SectorTown2Z;
|
||||
|
||||
UINT32 SectorTown3X;
|
||||
UINT32 SectorTown3Y;
|
||||
UINT32 SectorTown3Z;
|
||||
|
||||
UINT32 SectorTownGridNo1a;
|
||||
UINT32 SectorTownGridNo1b;
|
||||
|
||||
UINT32 SectorTownGridNo2a;
|
||||
UINT32 SectorTownGridNo2b;
|
||||
|
||||
UINT32 SectorTownGridNo3a;
|
||||
UINT32 SectorTownGridNo3b;
|
||||
|
||||
//I9
|
||||
UINT32 I9SectorPlayerQuoteX;
|
||||
UINT32 I9SectorPlayerQuoteY;
|
||||
UINT32 I9SectorPlayerQuoteZ;
|
||||
|
||||
//H10
|
||||
UINT32 H10SectorPlayerQuoteX;
|
||||
UINT32 H10SectorPlayerQuoteY;
|
||||
UINT32 H10SectorPlayerQuoteZ;
|
||||
|
||||
UINT32 SectorDoorInTunnelGridNo;
|
||||
|
||||
UINT8 MaxNumberOfMercs;
|
||||
|
||||
} GAME_UB_OPTIONS;
|
||||
|
||||
extern GAME_UB_OPTIONS gGameUBOptions;
|
||||
|
||||
#ifdef JA2UB
|
||||
extern void RandomAddEnemy( UINT8 SectorX, UINT8 SectorY, UINT8 Level );
|
||||
extern void RandomStats ();
|
||||
#endif
|
||||
|
||||
extern void RandomStats ();
|
||||
#endif
|
||||
Reference in New Issue
Block a user